From: support Date: Fri, 25 Mar 2022 09:38:57 +0000 (+0000) Subject: Built motion from commit 076b6d01.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%2011license.mail?a=commitdiff_plain;h=ab94598496c5c2e949d99c6307a7405f14d1c4de;p=motion2.git Built motion from commit 076b6d01.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 45be773..00d4e22 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-03-25T08:59:50.509Z", + "time": "2022-03-25T09:30:30.041Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cf8cad7..0fd2ce7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-25T08:59:50.509Z", + "time": "2022-03-25T09:30:30.041Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 1f77e4d..8512047 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 _0x24bf=['VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports'];(function(_0x5a61c0,_0x35449e){var _0x50fe35=function(_0x33d97a){while(--_0x33d97a){_0x5a61c0['push'](_0x5a61c0['shift']());}};_0x50fe35(++_0x35449e);}(_0x24bf,0xee));var _0xf24b=function(_0x53d7a8,_0x42bd72){_0x53d7a8=_0x53d7a8-0x0;var _0x4caee1=_0x24bf[_0x53d7a8];return _0x4caee1;};'use strict';var Sequelize=require(_0xf24b('0x0'));module[_0xf24b('0x1')]={'name':{'type':Sequelize[_0xf24b('0x2')],'get':function(_0x4defc1){return this[_0xf24b('0x3')](_0xf24b('0x4'));}},'action':{'type':Sequelize[_0xf24b('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xf24b('0x6'),'integration',_0xf24b('0x7'),'jscripty','urlForward','browser','bot','script']],'msg':_0xf24b('0x8')}},'comment':_0xf24b('0x8')},'data1':{'type':Sequelize[_0xf24b('0x5')](0x1000),'comment':_0xf24b('0x9')},'data2':{'type':Sequelize[_0xf24b('0x5')](0x1000),'comment':_0xf24b('0xa')},'data3':{'type':Sequelize[_0xf24b('0x5')](0x1000),'comment':_0xf24b('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xf24b('0xc')},'data5':{'type':Sequelize[_0xf24b('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xf24b('0x5')],'comments':_0xf24b('0xd')},'data7':{'type':Sequelize[_0xf24b('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xedef=['motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x42353c,_0x1eb7b7){var _0x5ba6d4=function(_0x197180){while(--_0x197180){_0x42353c['push'](_0x42353c['shift']());}};_0x5ba6d4(++_0x1eb7b7);}(_0xedef,0x83));var _0xfede=function(_0x299d68,_0x1455c8){_0x299d68=_0x299d68-0x0;var _0x427fe5=_0xedef[_0x299d68];return _0x427fe5;};'use strict';var Sequelize=require(_0xfede('0x0'));module[_0xfede('0x1')]={'name':{'type':Sequelize[_0xfede('0x2')],'get':function(_0x1dfc1d){return this[_0xfede('0x3')]('action');}},'action':{'type':Sequelize[_0xfede('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xfede('0x5'),'jscripty',_0xfede('0x6'),_0xfede('0x7'),'bot',_0xfede('0x8')]],'msg':_0xfede('0x9')}},'comment':_0xfede('0x9')},'data1':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xa')},'data2':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xb')},'data3':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xfede('0xd')},'data6':{'type':Sequelize[_0xfede('0x4')],'comments':_0xfede('0xe')},'data7':{'type':Sequelize[_0xfede('0xf')],'comments':_0xfede('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c1af917..6d9a6f5 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 _0xef92=['count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xef92,0x176));var _0x2ef9=function(_0x22bd74,_0x3b231b){_0x22bd74=_0x22bd74-0x0;var _0x4b9505=_0xef92[_0x22bd74];return _0x4b9505;};'use strict';var emlformat=require(_0x2ef9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ef9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ef9('0x2'));var moment=require(_0x2ef9('0x3'));var BPromise=require(_0x2ef9('0x4'));var Mustache=require(_0x2ef9('0x5'));var util=require('util');var path=require(_0x2ef9('0x6'));var sox=require(_0x2ef9('0x7'));var csv=require(_0x2ef9('0x8'));var ejs=require(_0x2ef9('0x9'));var fs=require('fs');var fs_extra=require(_0x2ef9('0xa'));var _=require(_0x2ef9('0xb'));var squel=require(_0x2ef9('0xc'));var crypto=require(_0x2ef9('0xd'));var jsforce=require(_0x2ef9('0xe'));var deskjs=require(_0x2ef9('0xf'));var toCsv=require(_0x2ef9('0x8'));var querystring=require(_0x2ef9('0x10'));var Papa=require(_0x2ef9('0x11'));var Redis=require(_0x2ef9('0x12'));var authService=require(_0x2ef9('0x13'));var qs=require(_0x2ef9('0x14'));var as=require(_0x2ef9('0x15'));var hardwareService=require(_0x2ef9('0x16'));var logger=require(_0x2ef9('0x17'))('api');var utils=require(_0x2ef9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ef9('0x19'));var db=require(_0x2ef9('0x1a'))['db'];function respondWithStatusCode(_0x3e9c3e,_0x2c8299){_0x2c8299=_0x2c8299||0xcc;return function(_0x3ba0f0){if(_0x3ba0f0){return _0x3e9c3e[_0x2ef9('0x1b')](_0x2c8299);}return _0x3e9c3e[_0x2ef9('0x1c')](_0x2c8299)[_0x2ef9('0x1d')]();};}function respondWithResult(_0x20f80a,_0x579c1b){_0x579c1b=_0x579c1b||0xc8;return function(_0x366e3a){if(_0x366e3a){return _0x20f80a[_0x2ef9('0x1c')](_0x579c1b)[_0x2ef9('0x1e')](_0x366e3a);}};}function respondWithFilteredResult(_0x23dd58,_0x41fe32){return function(_0xfeaa03){if(_0xfeaa03){var _0x32bd70=typeof _0x41fe32[_0x2ef9('0x1f')]===_0x2ef9('0x20')&&typeof _0x41fe32[_0x2ef9('0x21')]===_0x2ef9('0x20');var _0x3d0efd=_0xfeaa03[_0x2ef9('0x22')];var _0xc2786=_0x32bd70?0x0:_0x41fe32[_0x2ef9('0x1f')];var _0x32ecc8=_0x32bd70?_0xfeaa03[_0x2ef9('0x22')]:_0x41fe32[_0x2ef9('0x1f')]+_0x41fe32['limit'];var _0xef21a3;if(_0x32ecc8>=_0x3d0efd){_0x32ecc8=_0x3d0efd;_0xef21a3=0xc8;}else{_0xef21a3=0xce;}_0x23dd58[_0x2ef9('0x1c')](_0xef21a3);return _0x23dd58[_0x2ef9('0x23')](_0x2ef9('0x24'),_0xc2786+'-'+_0x32ecc8+'/'+_0x3d0efd)[_0x2ef9('0x1e')](_0xfeaa03);}return null;};}function patchUpdates(_0x53d8eb){return function(_0x8e1582){try{jsonpatch[_0x2ef9('0x25')](_0x8e1582,_0x53d8eb,!![]);}catch(_0x574161){return BPromise[_0x2ef9('0x26')](_0x574161);}return _0x8e1582[_0x2ef9('0x27')]();};}function saveUpdates(_0xcb2675,_0x28f9e2){return function(_0x3ff5af){if(_0x3ff5af){return _0x3ff5af[_0x2ef9('0x28')](_0xcb2675)[_0x2ef9('0x29')](function(_0x257748){return _0x257748;});}return null;};}function removeEntity(_0x4bcb2f,_0xbad401){return function(_0x544a4e){if(_0x544a4e){return _0x544a4e[_0x2ef9('0x2a')]()[_0x2ef9('0x29')](function(){_0x4bcb2f[_0x2ef9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3d21,_0x5398ff){return function(_0x33b175){if(!_0x33b175){_0x5b3d21[_0x2ef9('0x1b')](0x194);}return _0x33b175;};}function handleError(_0x1e4e82,_0x1e486a){_0x1e486a=_0x1e486a||0x1f4;return function(_0x4f6bf1){logger['error'](_0x4f6bf1[_0x2ef9('0x2b')]);if(_0x4f6bf1[_0x2ef9('0x2c')]){delete _0x4f6bf1[_0x2ef9('0x2c')];}_0x1e4e82[_0x2ef9('0x1c')](_0x1e486a)[_0x2ef9('0x2d')](_0x4f6bf1);};}exports[_0x2ef9('0x28')]=function(_0x2ab761,_0x1cf18a){if(_0x2ab761[_0x2ef9('0x2e')]['id']){delete _0x2ab761[_0x2ef9('0x2e')]['id'];}return db[_0x2ef9('0x2f')][_0x2ef9('0x30')]({'where':{'id':_0x2ab761[_0x2ef9('0x31')]['id']}})[_0x2ef9('0x29')](handleEntityNotFound(_0x1cf18a,null))[_0x2ef9('0x29')](saveUpdates(_0x2ab761[_0x2ef9('0x2e')],null))['then'](respondWithResult(_0x1cf18a,null))[_0x2ef9('0x32')](handleError(_0x1cf18a,null));};exports[_0x2ef9('0x2a')]=function(_0x46defc,_0x421c85){return db['Action'][_0x2ef9('0x30')]({'where':{'id':_0x46defc[_0x2ef9('0x31')]['id']}})[_0x2ef9('0x29')](handleEntityNotFound(_0x421c85,null))['then'](removeEntity(_0x421c85,null))['catch'](handleError(_0x421c85,null));}; \ No newline at end of file +var _0x91ec=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','sendStatus','stack','name','body','Action','params','then','catch','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3f345d,_0x29513a){var _0x4ebfb9=function(_0x19af4b){while(--_0x19af4b){_0x3f345d['push'](_0x3f345d['shift']());}};_0x4ebfb9(++_0x29513a);}(_0x91ec,0x12b));var _0xc91e=function(_0x3f3d2b,_0x8bb927){_0x3f3d2b=_0x3f3d2b-0x0;var _0x5b12fc=_0x91ec[_0x3f3d2b];return _0x5b12fc;};'use strict';var emlformat=require(_0xc91e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc91e('0x1'));var rp=require(_0xc91e('0x2'));var moment=require(_0xc91e('0x3'));var BPromise=require(_0xc91e('0x4'));var Mustache=require(_0xc91e('0x5'));var util=require('util');var path=require(_0xc91e('0x6'));var sox=require(_0xc91e('0x7'));var csv=require(_0xc91e('0x8'));var ejs=require(_0xc91e('0x9'));var fs=require('fs');var fs_extra=require(_0xc91e('0xa'));var _=require(_0xc91e('0xb'));var squel=require(_0xc91e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc91e('0xd'));var deskjs=require(_0xc91e('0xe'));var toCsv=require(_0xc91e('0x8'));var querystring=require(_0xc91e('0xf'));var Papa=require(_0xc91e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc91e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc91e('0x12'));var logger=require(_0xc91e('0x13'))(_0xc91e('0x14'));var utils=require(_0xc91e('0x15'));var config=require(_0xc91e('0x16'));var licenseUtil=require(_0xc91e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3944f1,_0x27e646){_0x27e646=_0x27e646||0xcc;return function(_0xbefcfc){if(_0xbefcfc){return _0x3944f1['sendStatus'](_0x27e646);}return _0x3944f1[_0xc91e('0x18')](_0x27e646)[_0xc91e('0x19')]();};}function respondWithResult(_0x3b08e8,_0x53aba9){_0x53aba9=_0x53aba9||0xc8;return function(_0xd5c60a){if(_0xd5c60a){return _0x3b08e8[_0xc91e('0x18')](_0x53aba9)[_0xc91e('0x1a')](_0xd5c60a);}};}function respondWithFilteredResult(_0x30f616,_0x49734c){return function(_0x301de8){if(_0x301de8){var _0x594ccc=typeof _0x49734c[_0xc91e('0x1b')]==='undefined'&&typeof _0x49734c[_0xc91e('0x1c')]===_0xc91e('0x1d');var _0x2d4cf9=_0x301de8[_0xc91e('0x1e')];var _0x455524=_0x594ccc?0x0:_0x49734c[_0xc91e('0x1b')];var _0x16f7ae=_0x594ccc?_0x301de8[_0xc91e('0x1e')]:_0x49734c[_0xc91e('0x1b')]+_0x49734c[_0xc91e('0x1c')];var _0x307b44;if(_0x16f7ae>=_0x2d4cf9){_0x16f7ae=_0x2d4cf9;_0x307b44=0xc8;}else{_0x307b44=0xce;}_0x30f616['status'](_0x307b44);return _0x30f616[_0xc91e('0x1f')](_0xc91e('0x20'),_0x455524+'-'+_0x16f7ae+'/'+_0x2d4cf9)[_0xc91e('0x1a')](_0x301de8);}return null;};}function patchUpdates(_0x14da77){return function(_0x3e98f5){try{jsonpatch[_0xc91e('0x21')](_0x3e98f5,_0x14da77,!![]);}catch(_0x4d7a60){return BPromise[_0xc91e('0x22')](_0x4d7a60);}return _0x3e98f5[_0xc91e('0x23')]();};}function saveUpdates(_0x1b6190,_0x3bb1a7){return function(_0x11a01c){if(_0x11a01c){return _0x11a01c['update'](_0x1b6190)['then'](function(_0x36f3fa){return _0x36f3fa;});}return null;};}function removeEntity(_0x522a47,_0xdc5be8){return function(_0x350063){if(_0x350063){return _0x350063['destroy']()['then'](function(){_0x522a47[_0xc91e('0x18')](0xcc)[_0xc91e('0x19')]();});}};}function handleEntityNotFound(_0x18577f,_0x35dba8){return function(_0x2de2ad){if(!_0x2de2ad){_0x18577f[_0xc91e('0x24')](0x194);}return _0x2de2ad;};}function handleError(_0xa175ab,_0x54f026){_0x54f026=_0x54f026||0x1f4;return function(_0x51a7b9){logger['error'](_0x51a7b9[_0xc91e('0x25')]);if(_0x51a7b9['name']){delete _0x51a7b9[_0xc91e('0x26')];}_0xa175ab[_0xc91e('0x18')](_0x54f026)['send'](_0x51a7b9);};}exports['update']=function(_0x23a6ab,_0x1b2dbc){if(_0x23a6ab[_0xc91e('0x27')]['id']){delete _0x23a6ab[_0xc91e('0x27')]['id'];}return db[_0xc91e('0x28')]['find']({'where':{'id':_0x23a6ab[_0xc91e('0x29')]['id']}})[_0xc91e('0x2a')](handleEntityNotFound(_0x1b2dbc,null))[_0xc91e('0x2a')](saveUpdates(_0x23a6ab[_0xc91e('0x27')],null))[_0xc91e('0x2a')](respondWithResult(_0x1b2dbc,null))[_0xc91e('0x2b')](handleError(_0x1b2dbc,null));};exports['destroy']=function(_0x349b85,_0x29c6e9){return db[_0xc91e('0x28')][_0xc91e('0x2c')]({'where':{'id':_0x349b85[_0xc91e('0x29')]['id']}})['then'](handleEntityNotFound(_0x29c6e9,null))[_0xc91e('0x2a')](removeEntity(_0x29c6e9,null))[_0xc91e('0x2b')](handleError(_0x29c6e9,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8ccf0a1..c3b9060 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 _0xd2ee=['tools_actions','util','api','path','rimraf','../../config/environment','./action.attributes','define'];(function(_0x55a832,_0x438a35){var _0x6b362a=function(_0x4ec981){while(--_0x4ec981){_0x55a832['push'](_0x55a832['shift']());}};_0x6b362a(++_0x438a35);}(_0xd2ee,0x161));var _0xed2e=function(_0x3f1e54,_0x4f9625){_0x3f1e54=_0x3f1e54-0x0;var _0x1f38bd=_0xd2ee[_0x3f1e54];return _0x1f38bd;};'use strict';var _=require('lodash');var util=require(_0xed2e('0x0'));var logger=require('../../config/logger')(_0xed2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xed2e('0x2'));var rimraf=require(_0xed2e('0x3'));var config=require(_0xed2e('0x4'));var attributes=require(_0xed2e('0x5'));module['exports']=function(_0x4b2fb9,_0x1971f9){return _0x4b2fb9[_0xed2e('0x6')]('Action',attributes,{'tableName':_0xed2e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','Action','tools_actions','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x50087e,_0x4c5bb2){_0x50087e=_0x50087e-0x0;var _0xd49460=_0x4b1b[_0x50087e];return _0xd49460;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var logger=require(_0xb4b1('0x2'))(_0xb4b1('0x3'));var moment=require(_0xb4b1('0x4'));var BPromise=require(_0xb4b1('0x5'));var rp=require(_0xb4b1('0x6'));var fs=require('fs');var path=require(_0xb4b1('0x7'));var rimraf=require(_0xb4b1('0x8'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x49ddcd,_0x2b28b4){return _0x49ddcd[_0xb4b1('0x9')](_0xb4b1('0xa'),attributes,{'tableName':_0xb4b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index c7b95b9..8ef44d2 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x208774,_0x5676b0){var _0x4ba5c0=function(_0x236eb6){while(--_0x236eb6){_0x208774['push'](_0x208774['shift']());}};_0x4ba5c0(++_0x5676b0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0x7fbe[_0x3cfb0d];return _0x3486b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xcf22a8,_0x35d51c){var _0x1137eb=function(_0x22bdf6){while(--_0x22bdf6){_0xcf22a8['push'](_0xcf22a8['shift']());}};_0x1137eb(++_0x35d51c);}(_0x5fab,0x177));var _0xb5fa=function(_0x273517,_0x50b234){_0x273517=_0x273517-0x0;var _0x2c6334=_0x5fab[_0x273517];return _0x2c6334;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ad362f5..f496c6d 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 _0x4388=['../../components/auth/service','./action.controller','put','/:id','delete','isAuthenticated','exports','multer','util','path','express','Router'];(function(_0x5a0cb3,_0x2620a9){var _0x2cf9ed=function(_0x37ac41){while(--_0x37ac41){_0x5a0cb3['push'](_0x5a0cb3['shift']());}};_0x2cf9ed(++_0x2620a9);}(_0x4388,0x163));var _0x8438=function(_0x42ba84,_0x4a3c10){_0x42ba84=_0x42ba84-0x0;var _0x22a316=_0x4388[_0x42ba84];return _0x22a316;};'use strict';var multer=require(_0x8438('0x0'));var util=require(_0x8438('0x1'));var path=require(_0x8438('0x2'));var timeout=require('connect-timeout');var express=require(_0x8438('0x3'));var router=express[_0x8438('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8438('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8438('0x6'));router[_0x8438('0x7')](_0x8438('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x8438('0x9')]('/:id',auth[_0x8438('0xa')](),controller['destroy']);module[_0x8438('0xb')]=router; \ No newline at end of file +var _0x6542=['/:id','delete','isAuthenticated','destroy','exports','express','Router','../../components/auth/service','../../config/environment','put'];(function(_0x2c47a9,_0x120e40){var _0x792f9b=function(_0x342644){while(--_0x342644){_0x2c47a9['push'](_0x2c47a9['shift']());}};_0x792f9b(++_0x120e40);}(_0x6542,0xeb));var _0x2654=function(_0x5991df,_0x9d6ea2){_0x5991df=_0x5991df-0x0;var _0x36baa1=_0x6542[_0x5991df];return _0x36baa1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2654('0x0'));var router=express[_0x2654('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x2654('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2654('0x3'));var controller=require('./action.controller');router[_0x2654('0x4')](_0x2654('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x2654('0x6')](_0x2654('0x5'),auth[_0x2654('0x7')](),controller[_0x2654('0x8')]);module[_0x2654('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 95f9825..c5b2c1d 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x409a8f,_0xa8d109){var _0x548c1e=function(_0x40ab24){while(--_0x40ab24){_0x409a8f['push'](_0x409a8f['shift']());}};_0x548c1e(++_0xa8d109);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x3270de,_0x293830){var _0x47d908=function(_0x1e2d73){while(--_0x1e2d73){_0x3270de['push'](_0x3270de['shift']());}};_0x47d908(++_0x293830);}(_0x2eb2,0x19f));var _0x22eb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2eb2[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1c28240..8ba993f 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 _0xc5c7=['ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','IS\x20NOT\x20NULL','operator','metric','parentKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','fork','../../components/export/','savename','COUNT(*)','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','CustomReports','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','keys','rawAttributes','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Reports','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)'];(function(_0x44c274,_0x1b2a32){var _0x1a2907=function(_0x4d6d2a){while(--_0x4d6d2a){_0x44c274['push'](_0x44c274['shift']());}};_0x1a2907(++_0x1b2a32);}(_0xc5c7,0xf1));var _0x7c5c=function(_0xcf7c43,_0x215025){_0xcf7c43=_0xcf7c43-0x0;var _0x3ec6de=_0xc5c7[_0xcf7c43];return _0x3ec6de;};'use strict';var emlformat=require(_0x7c5c('0x0'));var rimraf=require(_0x7c5c('0x1'));var zipdir=require(_0x7c5c('0x2'));var jsonpatch=require(_0x7c5c('0x3'));var rp=require(_0x7c5c('0x4'));var moment=require(_0x7c5c('0x5'));var BPromise=require(_0x7c5c('0x6'));var Mustache=require(_0x7c5c('0x7'));var util=require(_0x7c5c('0x8'));var path=require(_0x7c5c('0x9'));var sox=require(_0x7c5c('0xa'));var csv=require('to-csv');var ejs=require(_0x7c5c('0xb'));var fs=require('fs');var fs_extra=require(_0x7c5c('0xc'));var _=require('lodash');var squel=require(_0x7c5c('0xd'));var crypto=require(_0x7c5c('0xe'));var jsforce=require(_0x7c5c('0xf'));var deskjs=require(_0x7c5c('0x10'));var toCsv=require(_0x7c5c('0x11'));var querystring=require('querystring');var Papa=require(_0x7c5c('0x12'));var Redis=require(_0x7c5c('0x13'));var authService=require(_0x7c5c('0x14'));var qs=require(_0x7c5c('0x15'));var as=require(_0x7c5c('0x16'));var hardwareService=require(_0x7c5c('0x17'));var logger=require(_0x7c5c('0x18'))(_0x7c5c('0x19'));var utils=require(_0x7c5c('0x1a'));var config=require(_0x7c5c('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c5c('0x1c'))['db'];var dbH=require(_0x7c5c('0x1c'))[_0x7c5c('0x1d')];function respondWithStatusCode(_0x52f9d3,_0x2d082c){_0x2d082c=_0x2d082c||0xcc;return function(_0x49e58c){if(_0x49e58c){return _0x52f9d3[_0x7c5c('0x1e')](_0x2d082c);}return _0x52f9d3[_0x7c5c('0x1f')](_0x2d082c)[_0x7c5c('0x20')]();};}function respondWithResult(_0x13b23f,_0x328bee){_0x328bee=_0x328bee||0xc8;return function(_0x26d252){if(_0x26d252){return _0x13b23f['status'](_0x328bee)[_0x7c5c('0x21')](_0x26d252);}};}function respondWithFilteredResult(_0x3faece,_0x176b4c){return function(_0x86fd51){if(_0x86fd51){var _0x5928e9=typeof _0x176b4c[_0x7c5c('0x22')]==='undefined'&&typeof _0x176b4c[_0x7c5c('0x23')]===_0x7c5c('0x24');var _0x18c1da=_0x86fd51[_0x7c5c('0x25')];var _0x1bb5de=_0x5928e9?0x0:_0x176b4c[_0x7c5c('0x22')];var _0x2d8d80=_0x5928e9?_0x86fd51[_0x7c5c('0x25')]:_0x176b4c[_0x7c5c('0x22')]+_0x176b4c['limit'];var _0x4d8d5d;if(_0x2d8d80>=_0x18c1da){_0x2d8d80=_0x18c1da;_0x4d8d5d=0xc8;}else{_0x4d8d5d=0xce;}_0x3faece[_0x7c5c('0x1f')](_0x4d8d5d);return _0x3faece[_0x7c5c('0x26')](_0x7c5c('0x27'),_0x1bb5de+'-'+_0x2d8d80+'/'+_0x18c1da)[_0x7c5c('0x21')](_0x86fd51);}return null;};}function patchUpdates(_0x2787b9){return function(_0x247be4){try{jsonpatch[_0x7c5c('0x28')](_0x247be4,_0x2787b9,!![]);}catch(_0x2ad171){return BPromise[_0x7c5c('0x29')](_0x2ad171);}return _0x247be4[_0x7c5c('0x2a')]();};}function saveUpdates(_0x41052b,_0x4d0396){return function(_0x13a640){if(_0x13a640){return _0x13a640[_0x7c5c('0x2b')](_0x41052b)['then'](function(_0x6ceeea){return _0x6ceeea;});}return null;};}function removeEntity(_0x183290,_0x519a8a){return function(_0x533afd){if(_0x533afd){return _0x533afd[_0x7c5c('0x2c')]()[_0x7c5c('0x2d')](function(){var _0x4d6bb5=_0x533afd['get']({'plain':!![]});var _0x4763e9=_0x7c5c('0x2e');return db[_0x7c5c('0x2f')]['destroy']({'where':{'type':_0x4763e9,'resourceId':_0x4d6bb5['id']}})[_0x7c5c('0x2d')](function(){return _0x533afd;});})['then'](function(){_0x183290['status'](0xcc)[_0x7c5c('0x20')]();});}};}function handleEntityNotFound(_0x4cbb2d,_0x283379){return function(_0x152102){if(!_0x152102){_0x4cbb2d[_0x7c5c('0x1e')](0x194);}return _0x152102;};}function handleError(_0x3236b9,_0x12bb09){_0x12bb09=_0x12bb09||0x1f4;return function(_0x371681){logger[_0x7c5c('0x30')](_0x371681[_0x7c5c('0x31')]);if(_0x371681[_0x7c5c('0x32')]){delete _0x371681[_0x7c5c('0x32')];}_0x3236b9[_0x7c5c('0x1f')](_0x12bb09)[_0x7c5c('0x33')](_0x371681);};}exports[_0x7c5c('0x34')]=function(_0x111188,_0x5a1a1c){var _0x4a541b={},_0x3e9404={},_0x540e51={'count':0x0,'rows':[]};var _0x55fe14=_[_0x7c5c('0x35')](db['AnalyticCustomReport']['rawAttributes'],function(_0x14e478){return{'name':_0x14e478['fieldName'],'type':_0x14e478[_0x7c5c('0x36')][_0x7c5c('0x37')]};});_0x3e9404[_0x7c5c('0x38')]=_[_0x7c5c('0x35')](_0x55fe14,_0x7c5c('0x32'));_0x3e9404['query']=_['keys'](_0x111188[_0x7c5c('0x39')]);_0x3e9404[_0x7c5c('0x3a')]=_['intersection'](_0x3e9404[_0x7c5c('0x38')],_0x3e9404[_0x7c5c('0x39')]);_0x4a541b[_0x7c5c('0x3b')]=_['intersection'](_0x3e9404[_0x7c5c('0x38')],qs['fields'](_0x111188[_0x7c5c('0x39')][_0x7c5c('0x3c')]));_0x4a541b[_0x7c5c('0x3b')]=_0x4a541b['attributes'][_0x7c5c('0x3d')]?_0x4a541b[_0x7c5c('0x3b')]:_0x3e9404[_0x7c5c('0x38')];if(!_0x111188[_0x7c5c('0x39')][_0x7c5c('0x3e')]('nolimit')){_0x4a541b[_0x7c5c('0x23')]=qs[_0x7c5c('0x23')](_0x111188['query'][_0x7c5c('0x23')]);_0x4a541b['offset']=qs[_0x7c5c('0x22')](_0x111188[_0x7c5c('0x39')][_0x7c5c('0x22')]);}_0x4a541b['order']=qs[_0x7c5c('0x3f')](_0x111188[_0x7c5c('0x39')][_0x7c5c('0x3f')]);_0x4a541b[_0x7c5c('0x40')]=qs[_0x7c5c('0x3a')](_[_0x7c5c('0x41')](_0x111188[_0x7c5c('0x39')],_0x3e9404[_0x7c5c('0x3a')]),_0x55fe14);if(_0x111188[_0x7c5c('0x39')][_0x7c5c('0x42')]){_0x4a541b[_0x7c5c('0x40')]=_['merge'](_0x4a541b[_0x7c5c('0x40')],{'$or':_[_0x7c5c('0x35')](_0x55fe14,function(_0x10693c){if(_0x10693c[_0x7c5c('0x36')]!=='VIRTUAL'){var _0x1f6288={};_0x1f6288[_0x10693c['name']]={'$like':'%'+_0x111188['query'][_0x7c5c('0x42')]+'%'};return _0x1f6288;}})});}_0x4a541b=_[_0x7c5c('0x43')]({},_0x4a541b,_0x111188[_0x7c5c('0x44')]);var _0x1f62c4={'where':_0x4a541b[_0x7c5c('0x40')]};return db[_0x7c5c('0x45')][_0x7c5c('0x25')](_0x1f62c4)['then'](function(_0x3f273b){_0x540e51[_0x7c5c('0x25')]=_0x3f273b;if(_0x111188[_0x7c5c('0x39')][_0x7c5c('0x46')]){_0x4a541b[_0x7c5c('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7c5c('0x48')](_0x4a541b);})[_0x7c5c('0x2d')](function(_0x2408ad){_0x540e51['rows']=_0x2408ad;return _0x540e51;})['then'](respondWithFilteredResult(_0x5a1a1c,_0x4a541b))[_0x7c5c('0x49')](handleError(_0x5a1a1c,null));};exports[_0x7c5c('0x4a')]=function(_0x5e83e5,_0x1ba5a3){var _0x7d239b={'raw':![],'where':{'id':_0x5e83e5['params']['id']}},_0x2f0581={};_0x2f0581[_0x7c5c('0x38')]=_[_0x7c5c('0x4b')](db['AnalyticCustomReport'][_0x7c5c('0x4c')]);_0x2f0581[_0x7c5c('0x39')]=_['keys'](_0x5e83e5[_0x7c5c('0x39')]);_0x2f0581[_0x7c5c('0x3a')]=_[_0x7c5c('0x4d')](_0x2f0581[_0x7c5c('0x38')],_0x2f0581[_0x7c5c('0x39')]);_0x7d239b[_0x7c5c('0x3b')]=_[_0x7c5c('0x4d')](_0x2f0581['model'],qs[_0x7c5c('0x3c')](_0x5e83e5[_0x7c5c('0x39')][_0x7c5c('0x3c')]));_0x7d239b[_0x7c5c('0x3b')]=_0x7d239b['attributes']['length']?_0x7d239b[_0x7c5c('0x3b')]:_0x2f0581[_0x7c5c('0x38')];if(_0x5e83e5[_0x7c5c('0x39')]['includeAll']){_0x7d239b[_0x7c5c('0x47')]=[{'all':!![]}];}_0x7d239b=_[_0x7c5c('0x43')]({},_0x7d239b,_0x5e83e5[_0x7c5c('0x44')]);return db['AnalyticCustomReport']['find'](_0x7d239b)[_0x7c5c('0x2d')](handleEntityNotFound(_0x1ba5a3,null))[_0x7c5c('0x2d')](respondWithResult(_0x1ba5a3,null))[_0x7c5c('0x49')](handleError(_0x1ba5a3,null));};exports[_0x7c5c('0x4e')]=function(_0x175293,_0x3002be){return db[_0x7c5c('0x45')][_0x7c5c('0x4e')](_0x175293[_0x7c5c('0x4f')],{})[_0x7c5c('0x2d')](function(_0x43518e){var _0x7ffa0c=_0x175293['user']['get']({'plain':!![]});if(!_0x7ffa0c)throw new Error(_0x7c5c('0x50'));if(_0x7ffa0c[_0x7c5c('0x51')]===_0x7c5c('0x52')){var _0x48fb73=_0x43518e[_0x7c5c('0x53')]({'plain':!![]});var _0x4eb8a0=_0x7c5c('0x54');return db[_0x7c5c('0x55')][_0x7c5c('0x56')]({'where':{'name':_0x4eb8a0,'userProfileId':_0x7ffa0c['userProfileId']},'raw':!![]})[_0x7c5c('0x2d')](function(_0x43009d){if(_0x43009d&&_0x43009d[_0x7c5c('0x57')]===0x0){return db[_0x7c5c('0x2f')][_0x7c5c('0x4e')]({'name':_0x48fb73[_0x7c5c('0x32')],'resourceId':_0x48fb73['id'],'type':'CustomReports','sectionId':_0x43009d['id']},{})['then'](function(){return _0x43518e;});}else{return _0x43518e;}})['catch'](function(_0x5ec26e){logger[_0x7c5c('0x30')](_0x7c5c('0x58'),_0x5ec26e);throw _0x5ec26e;});}return _0x43518e;})['then'](respondWithResult(_0x3002be,0xc9))[_0x7c5c('0x49')](handleError(_0x3002be,null));};exports[_0x7c5c('0x2b')]=function(_0x1c9d07,_0x393aaf){if(_0x1c9d07[_0x7c5c('0x4f')]['id']){delete _0x1c9d07[_0x7c5c('0x4f')]['id'];}return db[_0x7c5c('0x45')]['find']({'where':{'id':_0x1c9d07[_0x7c5c('0x59')]['id']}})['then'](handleEntityNotFound(_0x393aaf,null))[_0x7c5c('0x2d')](saveUpdates(_0x1c9d07[_0x7c5c('0x4f')],null))[_0x7c5c('0x2d')](respondWithResult(_0x393aaf,null))['catch'](handleError(_0x393aaf,null));};exports[_0x7c5c('0x2c')]=function(_0x3621e7,_0x7d6197){return db['AnalyticCustomReport']['find']({'where':{'id':_0x3621e7[_0x7c5c('0x59')]['id']}})[_0x7c5c('0x2d')](handleEntityNotFound(_0x7d6197,null))['then'](removeEntity(_0x7d6197,null))[_0x7c5c('0x49')](handleError(_0x7d6197,null));};exports[_0x7c5c('0x5a')]=function(_0x55dc0b,_0x21e7e7){var _0x3be2cb=0xa;var _0x10801b=[_0x7c5c('0x5b'),'left_join',_0x7c5c('0x5c'),_0x7c5c('0x5d')];var _0x10ba25={'SUM':_0x7c5c('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7c5c('0x5f'),'AVG':_0x7c5c('0x60'),'GROUP_CONCAT':_0x7c5c('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7c5c('0x62')};var _0x4cc56f={'SEC_TO_TIME':_0x7c5c('0x63'),'DATE':_0x7c5c('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x7c5c('0x65'),'UNIX_TIMESTAMP':_0x7c5c('0x66')};var _0x29d62b=function(_0x5e9467){return!_[_0x7c5c('0x67')]([_0x7c5c('0x68'),'IS\x20NOT\x20NULL',_0x7c5c('0x69'),'IS\x20NOT\x20EMPTY'],_0x5e9467);};var _0x551908=function(_0x32b3b4){if(!_0x32b3b4||!_0x32b3b4[_0x7c5c('0x6a')][_0x7c5c('0x3d')]){return'';}for(var _0x2ef769='(',_0x5716a5=0x0;_0x5716a5<_0x32b3b4[_0x7c5c('0x6a')][_0x7c5c('0x3d')];_0x5716a5+=0x1){_0x5716a5>0x0&&(_0x2ef769+='\x20'+_0x32b3b4['operator']+'\x20');_0x2ef769+=_0x32b3b4[_0x7c5c('0x6a')][_0x5716a5]['group']?_0x551908(_0x32b3b4['rules'][_0x5716a5][_0x7c5c('0x6b')]):_0x32b3b4[_0x7c5c('0x6a')][_0x5716a5]['field']+'\x20'+_0x32b3b4['rules'][_0x5716a5]['condition']+(_0x29d62b(_0x32b3b4['rules'][_0x5716a5][_0x7c5c('0x6c')])?'\x20'+_0x32b3b4[_0x7c5c('0x6a')][_0x5716a5][_0x7c5c('0x6d')]:'');}return _0x2ef769+')';};var _0xd482b9={'where':{'id':_0x55dc0b[_0x7c5c('0x59')]['id']}},_0x40454d,_0x3a3f6b,_0x2f7839,_0x37b5b1,_0x40560b;_0xd482b9=_[_0x7c5c('0x43')]({},_0xd482b9,_0x55dc0b[_0x7c5c('0x44')]);return db[_0x7c5c('0x45')][_0x7c5c('0x56')](_0xd482b9)['then'](function(_0x564bc2){if(_0x564bc2){_0x40454d=_0x564bc2;return _0x564bc2[_0x7c5c('0x6e')]();}return null;})['then'](function(_0xed8436){if(_0xed8436){if(!_0xed8436['length']){throw new db[(_0x7c5c('0x6f'))][(_0x7c5c('0x70'))](_0x7c5c('0x71'),0x193);}_0x3a3f6b=_0xed8436;return db[_0x7c5c('0x72')][_0x7c5c('0x48')]({'raw':!![]});}return null;})['then'](function(_0x5593ba){if(_0x5593ba){_0x2f7839=_[_0x7c5c('0x73')](_0x5593ba,'id');var _0x30dd1f;var _0x2298c2=squel[_0x7c5c('0x74')]();_0x2298c2[_0x7c5c('0x75')](_0x40454d['table']);for(var _0x243c4a=0x0;_0x243c4a<_0x3a3f6b[_0x7c5c('0x3d')];_0x243c4a+=0x1){_0x30dd1f=_0x3a3f6b[_0x243c4a]['MetricId']?_0x2f7839[_0x3a3f6b[_0x243c4a][_0x7c5c('0x76')]]['metric']:_0x3a3f6b[_0x243c4a][_0x7c5c('0x77')];_0x30dd1f=_0x3a3f6b[_0x243c4a][_0x7c5c('0x78')]?_[_0x7c5c('0x79')](_0x10ba25[_0x3a3f6b[_0x243c4a]['function']],'%s',_0x30dd1f):_0x30dd1f;_0x30dd1f=_0x3a3f6b[_0x243c4a][_0x7c5c('0x7a')]?_[_0x7c5c('0x79')](_0x4cc56f[_0x3a3f6b[_0x243c4a][_0x7c5c('0x7a')]],'%s',_0x30dd1f):_0x30dd1f;if(_0x3a3f6b[_0x243c4a][_0x7c5c('0x7b')]){_0x2298c2[_0x7c5c('0x6b')](_0x30dd1f);}_0x3a3f6b[_0x243c4a][_0x7c5c('0x7c')]&&_0x2298c2[_0x7c5c('0x7d')](_0x30dd1f,_0x3a3f6b[_0x243c4a][_0x7c5c('0x7c')]===_0x7c5c('0x7e')?![]:!![]);_0x2298c2[_0x7c5c('0x77')](_0x30dd1f,_0x3a3f6b[_0x243c4a][_0x7c5c('0x7f')]||_0x30dd1f);}if(_0x40454d[_0x7c5c('0x80')]){_0x40454d[_0x7c5c('0x80')]=JSON[_0x7c5c('0x81')](_0x40454d['joins']);for(var _0x1ab2ef=0x0;_0x1ab2ef<_0x40454d[_0x7c5c('0x80')][_0x7c5c('0x3d')];_0x1ab2ef+=0x1){if(_0x40454d[_0x7c5c('0x80')][_0x1ab2ef][_0x7c5c('0x36')]&&_[_0x7c5c('0x67')](_0x10801b,_0x40454d[_0x7c5c('0x80')][_0x1ab2ef][_0x7c5c('0x36')])&&_0x40454d[_0x7c5c('0x80')][_0x1ab2ef]['parentKey']&&_0x40454d[_0x7c5c('0x80')][_0x1ab2ef][_0x7c5c('0x82')]&&_0x40454d['joins'][_0x1ab2ef][_0x7c5c('0x83')]){_0x2298c2[_0x40454d['joins'][_0x1ab2ef]['type']](_0x40454d['joins'][_0x1ab2ef][_0x7c5c('0x82')],null,util[_0x7c5c('0x7a')](_0x7c5c('0x84'),_0x40454d[_0x7c5c('0x85')],_0x40454d[_0x7c5c('0x80')][_0x1ab2ef]['parentKey'],_0x40454d[_0x7c5c('0x80')][_0x1ab2ef][_0x7c5c('0x82')],_0x40454d[_0x7c5c('0x80')][_0x1ab2ef][_0x7c5c('0x83')]));}}}if(_0x40454d[_0x7c5c('0x86')]){_0x40454d['conditions']=JSON[_0x7c5c('0x81')](_0x40454d[_0x7c5c('0x86')]);_0x2298c2[_0x7c5c('0x40')](_0x551908(_0x40454d[_0x7c5c('0x86')][_0x7c5c('0x6b')]));}_0x40560b=_0x2298c2[_0x7c5c('0x87')]();_0x2298c2[_0x7c5c('0x23')](_0x3be2cb);_0x2298c2['offset'](0x0);logger[_0x7c5c('0x88')](_0x7c5c('0x89'),_0x2298c2['toString']());return dbH[_0x7c5c('0x8a')][_0x7c5c('0x39')](_0x2298c2[_0x7c5c('0x8b')](),{'type':dbH[_0x7c5c('0x8a')][_0x7c5c('0x8c')]['SELECT']});}})[_0x7c5c('0x2d')](respondWithResult(_0x21e7e7,null))['catch'](handleError(_0x21e7e7,null));};function runReport(_0x286786,_0x56269b,_0x35292e){var _0x23390d=_0x56269b[_0x7c5c('0x32')];var _0x50e292=0xa;var _0x2a31e3=[_0x7c5c('0x5b'),_0x7c5c('0x8d'),_0x7c5c('0x5c'),_0x7c5c('0x5d')];var _0x4ed489={'SUM':'SUM(%s)','COUNT':_0x7c5c('0x8e'),'COUNT DISTINCT':_0x7c5c('0x8f'),'MAX':_0x7c5c('0x90'),'MIN':_0x7c5c('0x5f'),'AVG':_0x7c5c('0x60'),'GROUP_CONCAT':_0x7c5c('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7c5c('0x62')};var _0x2636e9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7c5c('0x64'),'HOUR':_0x7c5c('0x91'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7c5c('0x66')};var _0x23b444=function(_0x5f0299){return!_[_0x7c5c('0x67')](['IS\x20NULL',_0x7c5c('0x92'),_0x7c5c('0x69'),'IS\x20NOT\x20EMPTY'],_0x5f0299);};var _0x560ac8=function(_0x32c38b){if(!_0x32c38b||!_0x32c38b[_0x7c5c('0x6a')][_0x7c5c('0x3d')]){return'';}for(var _0x3d914c='(',_0x20c14f=0x0;_0x20c14f<_0x32c38b['rules'][_0x7c5c('0x3d')];_0x20c14f+=0x1){_0x20c14f>0x0&&(_0x3d914c+='\x20'+_0x32c38b[_0x7c5c('0x93')]+'\x20');_0x3d914c+=_0x32c38b[_0x7c5c('0x6a')][_0x20c14f][_0x7c5c('0x6b')]?_0x560ac8(_0x32c38b[_0x7c5c('0x6a')][_0x20c14f][_0x7c5c('0x6b')]):_0x32c38b['rules'][_0x20c14f]['field']+'\x20'+_0x32c38b['rules'][_0x20c14f][_0x7c5c('0x6c')]+(_0x23b444(_0x32c38b['rules'][_0x20c14f]['condition'])?'\x20'+_0x32c38b[_0x7c5c('0x6a')][_0x20c14f][_0x7c5c('0x6d')]:'');}return _0x3d914c+')';};var _0x1abd10={'where':{'id':_0x286786['id']}},_0x951a18,_0x5b775d,_0x2744c8,_0x3d028a,_0x221d89;_0x1abd10=_[_0x7c5c('0x43')]({},_0x1abd10,_0x35292e);return db['AnalyticCustomReport'][_0x7c5c('0x56')](_0x1abd10)['then'](function(_0x52fbb8){if(_0x52fbb8){_0x951a18=_0x52fbb8;return _0x52fbb8[_0x7c5c('0x6e')]();}return null;})[_0x7c5c('0x2d')](function(_0x4870cd){if(_0x4870cd){if(!_0x4870cd[_0x7c5c('0x3d')]){throw new db[(_0x7c5c('0x6f'))][(_0x7c5c('0x70'))](_0x7c5c('0x71'),0x193);}_0x5b775d=_0x4870cd;return db[_0x7c5c('0x72')][_0x7c5c('0x48')]({'raw':!![]});}return null;})['then'](function(_0x5730b8){if(_0x5730b8){_0x2744c8=_[_0x7c5c('0x73')](_0x5730b8,'id');var _0x142dad;var _0x1ff675=squel[_0x7c5c('0x74')]();_0x1ff675[_0x7c5c('0x75')](_0x951a18[_0x7c5c('0x85')]);for(var _0x44a4ae=0x0;_0x44a4ae<_0x5b775d[_0x7c5c('0x3d')];_0x44a4ae+=0x1){_0x142dad=_0x5b775d[_0x44a4ae][_0x7c5c('0x76')]?_0x2744c8[_0x5b775d[_0x44a4ae][_0x7c5c('0x76')]][_0x7c5c('0x94')]:_0x5b775d[_0x44a4ae][_0x7c5c('0x77')];_0x142dad=_0x5b775d[_0x44a4ae][_0x7c5c('0x78')]?_['replace'](_0x4ed489[_0x5b775d[_0x44a4ae][_0x7c5c('0x78')]],'%s',_0x142dad):_0x142dad;_0x142dad=_0x5b775d[_0x44a4ae][_0x7c5c('0x7a')]?_[_0x7c5c('0x79')](_0x2636e9[_0x5b775d[_0x44a4ae][_0x7c5c('0x7a')]],'%s',_0x142dad):_0x142dad;if(_0x5b775d[_0x44a4ae][_0x7c5c('0x7b')]){_0x1ff675[_0x7c5c('0x6b')](_0x142dad);}_0x5b775d[_0x44a4ae][_0x7c5c('0x7c')]&&_0x1ff675[_0x7c5c('0x7d')](_0x142dad,_0x5b775d[_0x44a4ae][_0x7c5c('0x7c')]===_0x7c5c('0x7e')?![]:!![]);_0x1ff675['field'](_0x142dad,_0x5b775d[_0x44a4ae]['alias']||_0x142dad);}if(_0x951a18[_0x7c5c('0x80')]){_0x951a18['joins']=JSON[_0x7c5c('0x81')](_0x951a18[_0x7c5c('0x80')]);for(var _0x4f6eb2=0x0;_0x4f6eb2<_0x951a18[_0x7c5c('0x80')][_0x7c5c('0x3d')];_0x4f6eb2+=0x1){if(_0x951a18[_0x7c5c('0x80')][_0x4f6eb2][_0x7c5c('0x36')]&&_[_0x7c5c('0x67')](_0x2a31e3,_0x951a18['joins'][_0x4f6eb2][_0x7c5c('0x36')])&&_0x951a18[_0x7c5c('0x80')][_0x4f6eb2]['parentKey']&&_0x951a18[_0x7c5c('0x80')][_0x4f6eb2][_0x7c5c('0x82')]&&_0x951a18['joins'][_0x4f6eb2]['foreignKey']){_0x1ff675[_0x951a18[_0x7c5c('0x80')][_0x4f6eb2]['type']](_0x951a18[_0x7c5c('0x80')][_0x4f6eb2][_0x7c5c('0x82')],null,util[_0x7c5c('0x7a')]('%s.%s\x20=\x20%s.%s',_0x951a18[_0x7c5c('0x85')],_0x951a18['joins'][_0x4f6eb2][_0x7c5c('0x95')],_0x951a18[_0x7c5c('0x80')][_0x4f6eb2]['foreignTable'],_0x951a18[_0x7c5c('0x80')][_0x4f6eb2][_0x7c5c('0x83')]));}}}if(_0x951a18[_0x7c5c('0x86')]){_0x951a18['conditions']=JSON[_0x7c5c('0x81')](_0x951a18['conditions']);_0x1ff675[_0x7c5c('0x40')](_0x560ac8(_0x951a18[_0x7c5c('0x86')][_0x7c5c('0x6b')]));}_0x221d89=_0x1ff675['clone']();_0x1ff675[_0x7c5c('0x23')](_0x50e292);_0x1ff675[_0x7c5c('0x22')](0x0);return;}})['then'](function(){if(_0x56269b[_0x7c5c('0x96')]==='web'){return null;}var _0x1200c5=_['merge'](_0x56269b,{'name':_0x56269b[_0x7c5c('0x97')]||_0x56269b[_0x7c5c('0x32')]||_0x951a18['name'],'basename':_0x23390d,'savename':util[_0x7c5c('0x7a')](_0x7c5c('0x98'),_0x56269b[_0x7c5c('0x32')]||_0x951a18[_0x7c5c('0x32')],require(_0x7c5c('0x99'))[_0x7c5c('0x9a')](0x4),_0x56269b[_0x7c5c('0x96')]||_0x7c5c('0x9b')),'reportId':_0x951a18['id'],'reportType':'custom'});return db[_0x7c5c('0x9c')][_0x7c5c('0x4e')](_0x1200c5,{'raw':!![]});})[_0x7c5c('0x2d')](function(_0x4b3ced){if(_0x951a18[_0x7c5c('0x85')]===_0x7c5c('0x9d')){_0x221d89[_0x7c5c('0x40')](_0x951a18[_0x7c5c('0x85')]+_0x7c5c('0x9e'),_0x56269b[_0x7c5c('0x9f')],_0x56269b['endDate']);}else{_0x221d89['where'](_0x951a18[_0x7c5c('0x85')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x56269b['startDate'],_0x56269b[_0x7c5c('0xa0')]);}if(_0x4b3ced){logger['info'](_0x7c5c('0xa1'),_0x221d89[_0x7c5c('0x8b')]());require('child_process')[_0x7c5c('0xa2')](path[_0x7c5c('0x5b')](__dirname,_0x7c5c('0xa3'),_0x4b3ced[_0x7c5c('0x96')]),[_0x4b3ced['id'],_0x221d89[_0x7c5c('0x8b')](),path['join'](__dirname,'../../files/reports',_0x4b3ced[_0x7c5c('0xa4')]),_0x23390d]);return _0x4b3ced;}else{var _0x47ddd5=squel[_0x7c5c('0x74')]();_0x47ddd5[_0x7c5c('0x75')]('('+_0x221d89[_0x7c5c('0x8b')]()+')','countTable');_0x47ddd5[_0x7c5c('0x77')](_0x7c5c('0xa5'),'count');_0x221d89['limit'](_0x56269b[_0x7c5c('0x23')]||_0x50e292);_0x221d89[_0x7c5c('0x22')](_0x56269b[_0x7c5c('0x22')]||0x0);return dbH[_0x7c5c('0x8a')][_0x7c5c('0x39')](_0x47ddd5[_0x7c5c('0x8b')](),{'type':dbH[_0x7c5c('0x8a')][_0x7c5c('0x8c')][_0x7c5c('0xa6')]})[_0x7c5c('0x2d')](function(_0x2a77e3){if(!_0x2a77e3[_0x7c5c('0x3d')]){_0x3d028a=0x0;}else{_0x3d028a=_0x2a77e3[0x0]['count']||0x0;}return dbH[_0x7c5c('0x8a')][_0x7c5c('0x39')](_0x221d89[_0x7c5c('0x8b')](),{'type':dbH[_0x7c5c('0x8a')][_0x7c5c('0x8c')][_0x7c5c('0xa6')]});})[_0x7c5c('0x2d')](function(_0x364dd2){return{'rows':_0x364dd2||[],'count':_0x3d028a};});}});}exports[_0x7c5c('0xa7')]=function(_0x35be68,_0x109faf){return runReport(_0x35be68[_0x7c5c('0x59')],_0x35be68[_0x7c5c('0x39')],_0x35be68[_0x7c5c('0x44')])[_0x7c5c('0x2d')](respondWithResult(_0x109faf,null))[_0x7c5c('0x49')](handleError(_0x109faf,null));};exports[_0x7c5c('0xa8')]=runReport;exports['query']=function(_0x577e8f,_0x35bcad){var _0x31125e=0xa;var _0x4ffe7b=['join',_0x7c5c('0x8d'),_0x7c5c('0x5c'),_0x7c5c('0x5d')];var _0x1698e4={'SUM':'SUM(%s)','COUNT':_0x7c5c('0x8e'),'COUNT DISTINCT':_0x7c5c('0x8f'),'MAX':_0x7c5c('0x90'),'MIN':_0x7c5c('0x5f'),'AVG':_0x7c5c('0x60'),'GROUP_CONCAT':_0x7c5c('0x61'),'GROUP_CONCAT ASC':_0x7c5c('0xa9'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27462f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x7c5c('0x91'),'ROUND':_0x7c5c('0x65'),'UNIX_TIMESTAMP':_0x7c5c('0x66')};var _0x206c3b=function(_0x4b7210){return!_[_0x7c5c('0x67')]([_0x7c5c('0x68'),_0x7c5c('0x92'),'IS\x20EMPTY',_0x7c5c('0xaa')],_0x4b7210);};var _0x1808c1=function(_0x49c38c){if(!_0x49c38c||!_0x49c38c[_0x7c5c('0x6a')][_0x7c5c('0x3d')]){return'';}for(var _0x195aec='(',_0x4fcd85=0x0;_0x4fcd85<_0x49c38c[_0x7c5c('0x6a')]['length'];_0x4fcd85+=0x1){_0x4fcd85>0x0&&(_0x195aec+='\x20'+_0x49c38c[_0x7c5c('0x93')]+'\x20');_0x195aec+=_0x49c38c['rules'][_0x4fcd85][_0x7c5c('0x6b')]?_0x1808c1(_0x49c38c[_0x7c5c('0x6a')][_0x4fcd85][_0x7c5c('0x6b')]):_0x49c38c[_0x7c5c('0x6a')][_0x4fcd85][_0x7c5c('0x77')]+'\x20'+_0x49c38c[_0x7c5c('0x6a')][_0x4fcd85][_0x7c5c('0x6c')]+(_0x206c3b(_0x49c38c[_0x7c5c('0x6a')][_0x4fcd85][_0x7c5c('0x6c')])?'\x20'+_0x49c38c['rules'][_0x4fcd85][_0x7c5c('0x6d')]:'');}return _0x195aec+')';};var _0x3cfeb9={'where':{'id':_0x577e8f[_0x7c5c('0x59')]['id']}},_0x5390f4,_0x404e58,_0xcb6613,_0xf21f88,_0x3fa67b;_0x3cfeb9=_[_0x7c5c('0x43')]({},_0x3cfeb9,_0x577e8f[_0x7c5c('0x44')]);return db[_0x7c5c('0x45')][_0x7c5c('0x56')](_0x3cfeb9)[_0x7c5c('0x2d')](function(_0x4e53e8){if(_0x4e53e8){_0x5390f4=_0x4e53e8;return _0x4e53e8['getFields']();}return null;})[_0x7c5c('0x2d')](function(_0x1e0bd4){if(_0x1e0bd4){if(!_0x1e0bd4[_0x7c5c('0x3d')]){throw new db['Sequelize'][(_0x7c5c('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x404e58=_0x1e0bd4;return db[_0x7c5c('0x72')][_0x7c5c('0x48')]({'raw':!![]});}return null;})[_0x7c5c('0x2d')](function(_0x53374c){if(_0x53374c){_0xcb6613=_['keyBy'](_0x53374c,'id');var _0x5c0186;var _0x1eae34=squel[_0x7c5c('0x74')]();_0x1eae34[_0x7c5c('0x75')](_0x5390f4[_0x7c5c('0x85')]);for(var _0x306d1e=0x0;_0x306d1e<_0x404e58[_0x7c5c('0x3d')];_0x306d1e+=0x1){_0x5c0186=_0x404e58[_0x306d1e][_0x7c5c('0x76')]?_0xcb6613[_0x404e58[_0x306d1e][_0x7c5c('0x76')]]['metric']:_0x404e58[_0x306d1e]['field'];_0x5c0186=_0x404e58[_0x306d1e][_0x7c5c('0x78')]?_['replace'](_0x1698e4[_0x404e58[_0x306d1e]['function']],'%s',_0x5c0186):_0x5c0186;_0x5c0186=_0x404e58[_0x306d1e][_0x7c5c('0x7a')]?_['replace'](_0x27462f[_0x404e58[_0x306d1e][_0x7c5c('0x7a')]],'%s',_0x5c0186):_0x5c0186;if(_0x404e58[_0x306d1e]['groupBy']){_0x1eae34[_0x7c5c('0x6b')](_0x5c0186);}_0x404e58[_0x306d1e][_0x7c5c('0x7c')]&&_0x1eae34[_0x7c5c('0x7d')](_0x5c0186,_0x404e58[_0x306d1e][_0x7c5c('0x7c')]==='DESC'?![]:!![]);_0x1eae34[_0x7c5c('0x77')](_0x5c0186,_0x404e58[_0x306d1e][_0x7c5c('0x7f')]||_0x5c0186);}if(_0x5390f4[_0x7c5c('0x80')]){_0x5390f4['joins']=JSON[_0x7c5c('0x81')](_0x5390f4[_0x7c5c('0x80')]);for(var _0x342577=0x0;_0x342577<_0x5390f4[_0x7c5c('0x80')][_0x7c5c('0x3d')];_0x342577+=0x1){if(_0x5390f4['joins'][_0x342577][_0x7c5c('0x36')]&&_[_0x7c5c('0x67')](_0x4ffe7b,_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x36')])&&_0x5390f4['joins'][_0x342577][_0x7c5c('0x95')]&&_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x82')]&&_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x83')]){_0x1eae34[_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x36')]](_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x82')],null,util[_0x7c5c('0x7a')](_0x7c5c('0x84'),_0x5390f4['table'],_0x5390f4['joins'][_0x342577]['parentKey'],_0x5390f4['joins'][_0x342577][_0x7c5c('0x82')],_0x5390f4[_0x7c5c('0x80')][_0x342577][_0x7c5c('0x83')]));}}}if(_0x5390f4[_0x7c5c('0x86')]){_0x5390f4['conditions']=JSON[_0x7c5c('0x81')](_0x5390f4[_0x7c5c('0x86')]);_0x1eae34[_0x7c5c('0x40')](_0x1808c1(_0x5390f4[_0x7c5c('0x86')][_0x7c5c('0x6b')]));}_0x3fa67b=_0x1eae34['clone']();_0x1eae34[_0x7c5c('0x23')](_0x31125e);_0x1eae34[_0x7c5c('0x22')](0x0);logger[_0x7c5c('0x88')](_0x7c5c('0x89'),_0x1eae34[_0x7c5c('0x8b')]());return dbH['sequelize'][_0x7c5c('0x39')](_0x1eae34['toString'](),{'type':dbH['sequelize'][_0x7c5c('0x8c')][_0x7c5c('0xa6')]});}})[_0x7c5c('0x2d')](function(){return{'sql':_0x3fa67b[_0x7c5c('0x8b')]()};})[_0x7c5c('0x2d')](respondWithResult(_0x35bcad,null))['catch'](handleError(_0x35bcad,null));}; \ No newline at end of file +var _0x96c1=['MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','type','includes','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','operator','ValidationErrorItem','output','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','run','runReport','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table'];(function(_0x53d9ba,_0x33330c){var _0x287bd7=function(_0x26e481){while(--_0x26e481){_0x53d9ba['push'](_0x53d9ba['shift']());}};_0x287bd7(++_0x33330c);}(_0x96c1,0x174));var _0x196c=function(_0x5bea79,_0x5ea536){_0x5bea79=_0x5bea79-0x0;var _0x4bedcd=_0x96c1[_0x5bea79];return _0x4bedcd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x196c('0x0'));var zipdir=require(_0x196c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x196c('0x2'));var moment=require('moment');var BPromise=require(_0x196c('0x3'));var Mustache=require(_0x196c('0x4'));var util=require('util');var path=require(_0x196c('0x5'));var sox=require(_0x196c('0x6'));var csv=require('to-csv');var ejs=require(_0x196c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x196c('0x8'));var squel=require(_0x196c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x196c('0xa'));var toCsv=require(_0x196c('0xb'));var querystring=require(_0x196c('0xc'));var Papa=require(_0x196c('0xd'));var Redis=require(_0x196c('0xe'));var authService=require(_0x196c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x196c('0x10'));var hardwareService=require(_0x196c('0x11'));var logger=require(_0x196c('0x12'))(_0x196c('0x13'));var utils=require(_0x196c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x196c('0x15'))['db'];var dbH=require('../../mysqldb')[_0x196c('0x16')];function respondWithStatusCode(_0xcc4223,_0x3fc403){_0x3fc403=_0x3fc403||0xcc;return function(_0x2ca3be){if(_0x2ca3be){return _0xcc4223[_0x196c('0x17')](_0x3fc403);}return _0xcc4223[_0x196c('0x18')](_0x3fc403)[_0x196c('0x19')]();};}function respondWithResult(_0x46f721,_0x190b69){_0x190b69=_0x190b69||0xc8;return function(_0x228810){if(_0x228810){return _0x46f721['status'](_0x190b69)[_0x196c('0x1a')](_0x228810);}};}function respondWithFilteredResult(_0x352a27,_0x13c8bd){return function(_0x523fae){if(_0x523fae){var _0x4774a2=typeof _0x13c8bd[_0x196c('0x1b')]===_0x196c('0x1c')&&typeof _0x13c8bd[_0x196c('0x1d')]===_0x196c('0x1c');var _0x473fa4=_0x523fae[_0x196c('0x1e')];var _0xe36591=_0x4774a2?0x0:_0x13c8bd[_0x196c('0x1b')];var _0x541b5d=_0x4774a2?_0x523fae[_0x196c('0x1e')]:_0x13c8bd['offset']+_0x13c8bd[_0x196c('0x1d')];var _0x278253;if(_0x541b5d>=_0x473fa4){_0x541b5d=_0x473fa4;_0x278253=0xc8;}else{_0x278253=0xce;}_0x352a27[_0x196c('0x18')](_0x278253);return _0x352a27[_0x196c('0x1f')]('Content-Range',_0xe36591+'-'+_0x541b5d+'/'+_0x473fa4)[_0x196c('0x1a')](_0x523fae);}return null;};}function patchUpdates(_0x45178c){return function(_0xae2770){try{jsonpatch[_0x196c('0x20')](_0xae2770,_0x45178c,!![]);}catch(_0x383973){return BPromise[_0x196c('0x21')](_0x383973);}return _0xae2770['save']();};}function saveUpdates(_0xcb542b,_0x217327){return function(_0x28273f){if(_0x28273f){return _0x28273f[_0x196c('0x22')](_0xcb542b)[_0x196c('0x23')](function(_0x713478){return _0x713478;});}return null;};}function removeEntity(_0x11d5f1,_0x5c328c){return function(_0x152e75){if(_0x152e75){return _0x152e75['destroy']()[_0x196c('0x23')](function(){var _0x47a7d7=_0x152e75[_0x196c('0x24')]({'plain':!![]});var _0x1fc7e5='CustomReports';return db['UserProfileResource'][_0x196c('0x25')]({'where':{'type':_0x1fc7e5,'resourceId':_0x47a7d7['id']}})['then'](function(){return _0x152e75;});})[_0x196c('0x23')](function(){_0x11d5f1[_0x196c('0x18')](0xcc)[_0x196c('0x19')]();});}};}function handleEntityNotFound(_0xc4d939,_0x15c576){return function(_0x3f0328){if(!_0x3f0328){_0xc4d939[_0x196c('0x17')](0x194);}return _0x3f0328;};}function handleError(_0x1a4449,_0x55a3c3){_0x55a3c3=_0x55a3c3||0x1f4;return function(_0x3caa61){logger[_0x196c('0x26')](_0x3caa61[_0x196c('0x27')]);if(_0x3caa61['name']){delete _0x3caa61[_0x196c('0x28')];}_0x1a4449[_0x196c('0x18')](_0x55a3c3)[_0x196c('0x29')](_0x3caa61);};}exports[_0x196c('0x2a')]=function(_0xd9d384,_0x5371cd){var _0x30e8ba={},_0x323d93={},_0x559693={'count':0x0,'rows':[]};var _0x2abc9c=_[_0x196c('0x2b')](db[_0x196c('0x2c')][_0x196c('0x2d')],function(_0x53949d){return{'name':_0x53949d['fieldName'],'type':_0x53949d['type']['key']};});_0x323d93['model']=_['map'](_0x2abc9c,'name');_0x323d93['query']=_[_0x196c('0x2e')](_0xd9d384[_0x196c('0x2f')]);_0x323d93[_0x196c('0x30')]=_['intersection'](_0x323d93[_0x196c('0x31')],_0x323d93['query']);_0x30e8ba[_0x196c('0x32')]=_[_0x196c('0x33')](_0x323d93[_0x196c('0x31')],qs['fields'](_0xd9d384['query'][_0x196c('0x34')]));_0x30e8ba[_0x196c('0x32')]=_0x30e8ba['attributes'][_0x196c('0x35')]?_0x30e8ba[_0x196c('0x32')]:_0x323d93[_0x196c('0x31')];if(!_0xd9d384[_0x196c('0x2f')][_0x196c('0x36')]('nolimit')){_0x30e8ba[_0x196c('0x1d')]=qs[_0x196c('0x1d')](_0xd9d384['query'][_0x196c('0x1d')]);_0x30e8ba[_0x196c('0x1b')]=qs[_0x196c('0x1b')](_0xd9d384[_0x196c('0x2f')][_0x196c('0x1b')]);}_0x30e8ba[_0x196c('0x37')]=qs['sort'](_0xd9d384[_0x196c('0x2f')]['sort']);_0x30e8ba[_0x196c('0x38')]=qs[_0x196c('0x30')](_['pick'](_0xd9d384[_0x196c('0x2f')],_0x323d93['filters']),_0x2abc9c);if(_0xd9d384['query'][_0x196c('0x39')]){_0x30e8ba[_0x196c('0x38')]=_[_0x196c('0x3a')](_0x30e8ba['where'],{'$or':_[_0x196c('0x2b')](_0x2abc9c,function(_0x17c5e2){if(_0x17c5e2['type']!==_0x196c('0x3b')){var _0x463e75={};_0x463e75[_0x17c5e2[_0x196c('0x28')]]={'$like':'%'+_0xd9d384[_0x196c('0x2f')][_0x196c('0x39')]+'%'};return _0x463e75;}})});}_0x30e8ba=_[_0x196c('0x3a')]({},_0x30e8ba,_0xd9d384[_0x196c('0x3c')]);var _0x17a4b4={'where':_0x30e8ba['where']};return db[_0x196c('0x2c')][_0x196c('0x1e')](_0x17a4b4)[_0x196c('0x23')](function(_0x2af661){_0x559693[_0x196c('0x1e')]=_0x2af661;if(_0xd9d384[_0x196c('0x2f')]['includeAll']){_0x30e8ba[_0x196c('0x3d')]=[{'all':!![]}];}return db[_0x196c('0x2c')][_0x196c('0x3e')](_0x30e8ba);})[_0x196c('0x23')](function(_0x2c8b78){_0x559693[_0x196c('0x3f')]=_0x2c8b78;return _0x559693;})['then'](respondWithFilteredResult(_0x5371cd,_0x30e8ba))[_0x196c('0x40')](handleError(_0x5371cd,null));};exports[_0x196c('0x41')]=function(_0x29a823,_0x33e633){var _0x1d46bf={'raw':![],'where':{'id':_0x29a823[_0x196c('0x42')]['id']}},_0x5dd72b={};_0x5dd72b[_0x196c('0x31')]=_[_0x196c('0x2e')](db[_0x196c('0x2c')]['rawAttributes']);_0x5dd72b['query']=_[_0x196c('0x2e')](_0x29a823[_0x196c('0x2f')]);_0x5dd72b[_0x196c('0x30')]=_[_0x196c('0x33')](_0x5dd72b[_0x196c('0x31')],_0x5dd72b[_0x196c('0x2f')]);_0x1d46bf[_0x196c('0x32')]=_['intersection'](_0x5dd72b[_0x196c('0x31')],qs[_0x196c('0x34')](_0x29a823['query'][_0x196c('0x34')]));_0x1d46bf['attributes']=_0x1d46bf['attributes'][_0x196c('0x35')]?_0x1d46bf[_0x196c('0x32')]:_0x5dd72b[_0x196c('0x31')];if(_0x29a823[_0x196c('0x2f')][_0x196c('0x43')]){_0x1d46bf[_0x196c('0x3d')]=[{'all':!![]}];}_0x1d46bf=_[_0x196c('0x3a')]({},_0x1d46bf,_0x29a823[_0x196c('0x3c')]);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x1d46bf)[_0x196c('0x23')](handleEntityNotFound(_0x33e633,null))[_0x196c('0x23')](respondWithResult(_0x33e633,null))[_0x196c('0x40')](handleError(_0x33e633,null));};exports[_0x196c('0x45')]=function(_0x493c4c,_0x4e9e17){return db['AnalyticCustomReport']['create'](_0x493c4c[_0x196c('0x46')],{})[_0x196c('0x23')](function(_0x2f2085){var _0x36146d=_0x493c4c['user']['get']({'plain':!![]});if(!_0x36146d)throw new Error(_0x196c('0x47'));if(_0x36146d['role']===_0x196c('0x48')){var _0x2031ee=_0x2f2085['get']({'plain':!![]});var _0x45bdf2=_0x196c('0x49');return db[_0x196c('0x4a')][_0x196c('0x44')]({'where':{'name':_0x45bdf2,'userProfileId':_0x36146d[_0x196c('0x4b')]},'raw':!![]})[_0x196c('0x23')](function(_0x18650c){if(_0x18650c&&_0x18650c[_0x196c('0x4c')]===0x0){return db[_0x196c('0x4d')][_0x196c('0x45')]({'name':_0x2031ee['name'],'resourceId':_0x2031ee['id'],'type':_0x196c('0x4e'),'sectionId':_0x18650c['id']},{})[_0x196c('0x23')](function(){return _0x2f2085;});}else{return _0x2f2085;}})['catch'](function(_0x521c01){logger['error'](_0x196c('0x4f'),_0x521c01);throw _0x521c01;});}return _0x2f2085;})[_0x196c('0x23')](respondWithResult(_0x4e9e17,0xc9))[_0x196c('0x40')](handleError(_0x4e9e17,null));};exports[_0x196c('0x22')]=function(_0x21ae91,_0x3a7019){if(_0x21ae91['body']['id']){delete _0x21ae91['body']['id'];}return db[_0x196c('0x2c')][_0x196c('0x44')]({'where':{'id':_0x21ae91['params']['id']}})[_0x196c('0x23')](handleEntityNotFound(_0x3a7019,null))[_0x196c('0x23')](saveUpdates(_0x21ae91[_0x196c('0x46')],null))[_0x196c('0x23')](respondWithResult(_0x3a7019,null))[_0x196c('0x40')](handleError(_0x3a7019,null));};exports[_0x196c('0x25')]=function(_0x3a08e9,_0x352144){return db[_0x196c('0x2c')][_0x196c('0x44')]({'where':{'id':_0x3a08e9['params']['id']}})[_0x196c('0x23')](handleEntityNotFound(_0x352144,null))[_0x196c('0x23')](removeEntity(_0x352144,null))['catch'](handleError(_0x352144,null));};exports[_0x196c('0x50')]=function(_0x494e1d,_0x423d2b){var _0x34a238=0xa;var _0x2c3967=[_0x196c('0x51'),_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x1d78af={'SUM':_0x196c('0x54'),'COUNT':_0x196c('0x55'),'COUNT DISTINCT':_0x196c('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x196c('0x57'),'GROUP_CONCAT':_0x196c('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x196c('0x59')};var _0xc82530={'SEC_TO_TIME':_0x196c('0x5a'),'DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':_0x196c('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5418f8=function(_0x189ae5){return!_['includes']([_0x196c('0x5e'),_0x196c('0x5f'),_0x196c('0x60'),_0x196c('0x61')],_0x189ae5);};var _0x569b09=function(_0x48e340){if(!_0x48e340||!_0x48e340[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x586432='(',_0x530784=0x0;_0x530784<_0x48e340['rules']['length'];_0x530784+=0x1){_0x530784>0x0&&(_0x586432+='\x20'+_0x48e340['operator']+'\x20');_0x586432+=_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x63')]?_0x569b09(_0x48e340[_0x196c('0x62')][_0x530784]['group']):_0x48e340['rules'][_0x530784][_0x196c('0x64')]+'\x20'+_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x65')]+(_0x5418f8(_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x65')])?'\x20'+_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x66')]:'');}return _0x586432+')';};var _0x419172={'where':{'id':_0x494e1d[_0x196c('0x42')]['id']}},_0x55b6b0,_0x2e089a,_0x1444dc,_0x4ce772,_0x57a397;_0x419172=_[_0x196c('0x3a')]({},_0x419172,_0x494e1d['options']);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x419172)[_0x196c('0x23')](function(_0x56ffa3){if(_0x56ffa3){_0x55b6b0=_0x56ffa3;return _0x56ffa3[_0x196c('0x67')]();}return null;})['then'](function(_0x3ff7d6){if(_0x3ff7d6){if(!_0x3ff7d6[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))]['ValidationErrorItem'](_0x196c('0x69'),0x193);}_0x2e089a=_0x3ff7d6;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x4b3500){if(_0x4b3500){_0x1444dc=_[_0x196c('0x6b')](_0x4b3500,'id');var _0xb9c690;var _0x5dc983=squel[_0x196c('0x6c')]();_0x5dc983[_0x196c('0x6d')](_0x55b6b0[_0x196c('0x6e')]);for(var _0x2ab622=0x0;_0x2ab622<_0x2e089a[_0x196c('0x35')];_0x2ab622+=0x1){_0xb9c690=_0x2e089a[_0x2ab622][_0x196c('0x6f')]?_0x1444dc[_0x2e089a[_0x2ab622][_0x196c('0x6f')]][_0x196c('0x70')]:_0x2e089a[_0x2ab622][_0x196c('0x64')];_0xb9c690=_0x2e089a[_0x2ab622][_0x196c('0x71')]?_['replace'](_0x1d78af[_0x2e089a[_0x2ab622]['function']],'%s',_0xb9c690):_0xb9c690;_0xb9c690=_0x2e089a[_0x2ab622]['format']?_[_0x196c('0x72')](_0xc82530[_0x2e089a[_0x2ab622]['format']],'%s',_0xb9c690):_0xb9c690;if(_0x2e089a[_0x2ab622][_0x196c('0x73')]){_0x5dc983[_0x196c('0x63')](_0xb9c690);}_0x2e089a[_0x2ab622][_0x196c('0x74')]&&_0x5dc983[_0x196c('0x37')](_0xb9c690,_0x2e089a[_0x2ab622]['orderBy']===_0x196c('0x75')?![]:!![]);_0x5dc983[_0x196c('0x64')](_0xb9c690,_0x2e089a[_0x2ab622][_0x196c('0x76')]||_0xb9c690);}if(_0x55b6b0[_0x196c('0x77')]){_0x55b6b0['joins']=JSON[_0x196c('0x78')](_0x55b6b0[_0x196c('0x77')]);for(var _0xdc3542=0x0;_0xdc3542<_0x55b6b0[_0x196c('0x77')]['length'];_0xdc3542+=0x1){if(_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x2c3967,_0x55b6b0['joins'][_0xdc3542][_0x196c('0x79')])&&_0x55b6b0[_0x196c('0x77')][_0xdc3542]['parentKey']&&_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')]&&_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7c')]){_0x5dc983[_0x55b6b0[_0x196c('0x77')][_0xdc3542]['type']](_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')],null,util[_0x196c('0x7d')](_0x196c('0x7e'),_0x55b6b0[_0x196c('0x6e')],_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7f')],_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')],_0x55b6b0[_0x196c('0x77')][_0xdc3542]['foreignKey']));}}}if(_0x55b6b0['conditions']){_0x55b6b0[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x55b6b0[_0x196c('0x80')]);_0x5dc983['where'](_0x569b09(_0x55b6b0['conditions']['group']));}_0x57a397=_0x5dc983[_0x196c('0x81')]();_0x5dc983['limit'](_0x34a238);_0x5dc983[_0x196c('0x1b')](0x0);logger[_0x196c('0x82')](_0x196c('0x83'),_0x5dc983['toString']());return dbH[_0x196c('0x84')][_0x196c('0x2f')](_0x5dc983[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')][_0x196c('0x87')]});}})['then'](respondWithResult(_0x423d2b,null))['catch'](handleError(_0x423d2b,null));};function runReport(_0x4380ee,_0x1cf5a0,_0x118295){var _0x182a74=_0x1cf5a0[_0x196c('0x28')];var _0x346cc7=0xa;var _0x11b867=['join',_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x2a9442={'SUM':'SUM(%s)','COUNT':_0x196c('0x55'),'COUNT DISTINCT':_0x196c('0x56'),'MAX':_0x196c('0x88'),'MIN':_0x196c('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x196c('0x58'),'GROUP_CONCAT ASC':_0x196c('0x8a'),'GROUP_CONCAT DESC':_0x196c('0x59')};var _0x2967b8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x196c('0x8b')};var _0x2eec1b=function(_0x4c2075){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x196c('0x60'),_0x196c('0x61')],_0x4c2075);};var _0x45df24=function(_0x4bde63){if(!_0x4bde63||!_0x4bde63[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x24e9bd='(',_0x54f405=0x0;_0x54f405<_0x4bde63[_0x196c('0x62')][_0x196c('0x35')];_0x54f405+=0x1){_0x54f405>0x0&&(_0x24e9bd+='\x20'+_0x4bde63[_0x196c('0x8c')]+'\x20');_0x24e9bd+=_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x63')]?_0x45df24(_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x63')]):_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x64')]+'\x20'+_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x65')]+(_0x2eec1b(_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x65')])?'\x20'+_0x4bde63[_0x196c('0x62')][_0x54f405]['value']:'');}return _0x24e9bd+')';};var _0x17f8ea={'where':{'id':_0x4380ee['id']}},_0x26d3ae,_0x1e03aa,_0x175d48,_0x52afd4,_0x43995a;_0x17f8ea=_['merge']({},_0x17f8ea,_0x118295);return db[_0x196c('0x2c')]['find'](_0x17f8ea)['then'](function(_0x1114ed){if(_0x1114ed){_0x26d3ae=_0x1114ed;return _0x1114ed[_0x196c('0x67')]();}return null;})['then'](function(_0x52614c){if(_0x52614c){if(!_0x52614c[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))][(_0x196c('0x8d'))](_0x196c('0x69'),0x193);}_0x1e03aa=_0x52614c;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x4c01fd){if(_0x4c01fd){_0x175d48=_[_0x196c('0x6b')](_0x4c01fd,'id');var _0x386360;var _0x276416=squel[_0x196c('0x6c')]();_0x276416['from'](_0x26d3ae[_0x196c('0x6e')]);for(var _0x5144e7=0x0;_0x5144e7<_0x1e03aa[_0x196c('0x35')];_0x5144e7+=0x1){_0x386360=_0x1e03aa[_0x5144e7]['MetricId']?_0x175d48[_0x1e03aa[_0x5144e7]['MetricId']]['metric']:_0x1e03aa[_0x5144e7][_0x196c('0x64')];_0x386360=_0x1e03aa[_0x5144e7][_0x196c('0x71')]?_[_0x196c('0x72')](_0x2a9442[_0x1e03aa[_0x5144e7][_0x196c('0x71')]],'%s',_0x386360):_0x386360;_0x386360=_0x1e03aa[_0x5144e7][_0x196c('0x7d')]?_[_0x196c('0x72')](_0x2967b8[_0x1e03aa[_0x5144e7][_0x196c('0x7d')]],'%s',_0x386360):_0x386360;if(_0x1e03aa[_0x5144e7][_0x196c('0x73')]){_0x276416['group'](_0x386360);}_0x1e03aa[_0x5144e7]['orderBy']&&_0x276416[_0x196c('0x37')](_0x386360,_0x1e03aa[_0x5144e7]['orderBy']===_0x196c('0x75')?![]:!![]);_0x276416[_0x196c('0x64')](_0x386360,_0x1e03aa[_0x5144e7][_0x196c('0x76')]||_0x386360);}if(_0x26d3ae['joins']){_0x26d3ae[_0x196c('0x77')]=JSON[_0x196c('0x78')](_0x26d3ae['joins']);for(var _0x709908=0x0;_0x709908<_0x26d3ae[_0x196c('0x77')][_0x196c('0x35')];_0x709908+=0x1){if(_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x11b867,_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x79')])&&_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7f')]&&_0x26d3ae['joins'][_0x709908]['foreignTable']&&_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7c')]){_0x276416[_0x26d3ae['joins'][_0x709908][_0x196c('0x79')]](_0x26d3ae['joins'][_0x709908]['foreignTable'],null,util[_0x196c('0x7d')]('%s.%s\x20=\x20%s.%s',_0x26d3ae['table'],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7f')],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7b')],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7c')]));}}}if(_0x26d3ae['conditions']){_0x26d3ae[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x26d3ae['conditions']);_0x276416[_0x196c('0x38')](_0x45df24(_0x26d3ae[_0x196c('0x80')][_0x196c('0x63')]));}_0x43995a=_0x276416[_0x196c('0x81')]();_0x276416[_0x196c('0x1d')](_0x346cc7);_0x276416[_0x196c('0x1b')](0x0);return;}})['then'](function(){if(_0x1cf5a0[_0x196c('0x8e')]==='web'){return null;}var _0x1141be=_[_0x196c('0x3a')](_0x1cf5a0,{'name':_0x1cf5a0['fullPath']||_0x1cf5a0[_0x196c('0x28')]||_0x26d3ae[_0x196c('0x28')],'basename':_0x182a74,'savename':util['format'](_0x196c('0x8f'),_0x1cf5a0[_0x196c('0x28')]||_0x26d3ae[_0x196c('0x28')],require(_0x196c('0x90'))['generate'](0x4),_0x1cf5a0[_0x196c('0x8e')]||_0x196c('0x91')),'reportId':_0x26d3ae['id'],'reportType':_0x196c('0x92')});return db[_0x196c('0x93')][_0x196c('0x45')](_0x1141be,{'raw':!![]});})[_0x196c('0x23')](function(_0x452b1c){if(_0x26d3ae[_0x196c('0x6e')]===_0x196c('0x94')){_0x43995a[_0x196c('0x38')](_0x26d3ae[_0x196c('0x6e')]+_0x196c('0x95'),_0x1cf5a0[_0x196c('0x96')],_0x1cf5a0[_0x196c('0x97')]);}else{_0x43995a[_0x196c('0x38')](_0x26d3ae['table']+_0x196c('0x98'),_0x1cf5a0[_0x196c('0x96')],_0x1cf5a0[_0x196c('0x97')]);}if(_0x452b1c){logger['info'](_0x196c('0x99'),_0x43995a[_0x196c('0x85')]());require(_0x196c('0x9a'))[_0x196c('0x9b')](path['join'](__dirname,_0x196c('0x9c'),_0x452b1c[_0x196c('0x8e')]),[_0x452b1c['id'],_0x43995a['toString'](),path['join'](__dirname,_0x196c('0x9d'),_0x452b1c[_0x196c('0x9e')]),_0x182a74]);return _0x452b1c;}else{var _0x36e32f=squel[_0x196c('0x6c')]();_0x36e32f[_0x196c('0x6d')]('('+_0x43995a[_0x196c('0x85')]()+')','countTable');_0x36e32f[_0x196c('0x64')]('COUNT(*)',_0x196c('0x1e'));_0x43995a[_0x196c('0x1d')](_0x1cf5a0[_0x196c('0x1d')]||_0x346cc7);_0x43995a['offset'](_0x1cf5a0[_0x196c('0x1b')]||0x0);return dbH[_0x196c('0x84')][_0x196c('0x2f')](_0x36e32f[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')][_0x196c('0x87')]})[_0x196c('0x23')](function(_0x1cc619){if(!_0x1cc619['length']){_0x52afd4=0x0;}else{_0x52afd4=_0x1cc619[0x0][_0x196c('0x1e')]||0x0;}return dbH['sequelize'][_0x196c('0x2f')](_0x43995a[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')]['QueryTypes'][_0x196c('0x87')]});})[_0x196c('0x23')](function(_0x486d48){return{'rows':_0x486d48||[],'count':_0x52afd4};});}});}exports[_0x196c('0x9f')]=function(_0x35a90,_0x212686){return runReport(_0x35a90[_0x196c('0x42')],_0x35a90[_0x196c('0x2f')],_0x35a90['options'])[_0x196c('0x23')](respondWithResult(_0x212686,null))['catch'](handleError(_0x212686,null));};exports[_0x196c('0xa0')]=runReport;exports[_0x196c('0x2f')]=function(_0x1b8f99,_0x3661e4){var _0x1aa0ca=0xa;var _0x1d8936=['join',_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x545a56={'SUM':_0x196c('0x54'),'COUNT':_0x196c('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x196c('0x88'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x196c('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4b9c10={'SEC_TO_TIME':_0x196c('0x5a'),'DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':_0x196c('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e6843=function(_0x3b7584){return!_['includes']([_0x196c('0x5e'),_0x196c('0x5f'),_0x196c('0x60'),_0x196c('0x61')],_0x3b7584);};var _0x346561=function(_0x5f03e4){if(!_0x5f03e4||!_0x5f03e4[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x4a665f='(',_0x5ef8d4=0x0;_0x5ef8d4<_0x5f03e4[_0x196c('0x62')][_0x196c('0x35')];_0x5ef8d4+=0x1){_0x5ef8d4>0x0&&(_0x4a665f+='\x20'+_0x5f03e4[_0x196c('0x8c')]+'\x20');_0x4a665f+=_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x63')]?_0x346561(_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x63')]):_0x5f03e4[_0x196c('0x62')][_0x5ef8d4]['field']+'\x20'+_0x5f03e4[_0x196c('0x62')][_0x5ef8d4]['condition']+(_0x4e6843(_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x65')])?'\x20'+_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x66')]:'');}return _0x4a665f+')';};var _0x3ed925={'where':{'id':_0x1b8f99[_0x196c('0x42')]['id']}},_0x1f8565,_0x340fcf,_0x526627,_0x830ae4,_0x27d054;_0x3ed925=_['merge']({},_0x3ed925,_0x1b8f99[_0x196c('0x3c')]);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x3ed925)['then'](function(_0x1c7252){if(_0x1c7252){_0x1f8565=_0x1c7252;return _0x1c7252['getFields']();}return null;})[_0x196c('0x23')](function(_0x5b620f){if(_0x5b620f){if(!_0x5b620f[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))][(_0x196c('0x8d'))](_0x196c('0x69'),0x193);}_0x340fcf=_0x5b620f;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})[_0x196c('0x23')](function(_0xe511a){if(_0xe511a){_0x526627=_[_0x196c('0x6b')](_0xe511a,'id');var _0x38939a;var _0x1e9134=squel[_0x196c('0x6c')]();_0x1e9134[_0x196c('0x6d')](_0x1f8565[_0x196c('0x6e')]);for(var _0x143823=0x0;_0x143823<_0x340fcf['length'];_0x143823+=0x1){_0x38939a=_0x340fcf[_0x143823][_0x196c('0x6f')]?_0x526627[_0x340fcf[_0x143823]['MetricId']]['metric']:_0x340fcf[_0x143823][_0x196c('0x64')];_0x38939a=_0x340fcf[_0x143823][_0x196c('0x71')]?_['replace'](_0x545a56[_0x340fcf[_0x143823][_0x196c('0x71')]],'%s',_0x38939a):_0x38939a;_0x38939a=_0x340fcf[_0x143823][_0x196c('0x7d')]?_[_0x196c('0x72')](_0x4b9c10[_0x340fcf[_0x143823][_0x196c('0x7d')]],'%s',_0x38939a):_0x38939a;if(_0x340fcf[_0x143823]['groupBy']){_0x1e9134[_0x196c('0x63')](_0x38939a);}_0x340fcf[_0x143823][_0x196c('0x74')]&&_0x1e9134['order'](_0x38939a,_0x340fcf[_0x143823]['orderBy']===_0x196c('0x75')?![]:!![]);_0x1e9134[_0x196c('0x64')](_0x38939a,_0x340fcf[_0x143823]['alias']||_0x38939a);}if(_0x1f8565[_0x196c('0x77')]){_0x1f8565[_0x196c('0x77')]=JSON[_0x196c('0x78')](_0x1f8565[_0x196c('0x77')]);for(var _0x61cf23=0x0;_0x61cf23<_0x1f8565[_0x196c('0x77')][_0x196c('0x35')];_0x61cf23+=0x1){if(_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x1d8936,_0x1f8565['joins'][_0x61cf23]['type'])&&_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7f')]&&_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7b')]&&_0x1f8565['joins'][_0x61cf23]['foreignKey']){_0x1e9134[_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x79')]](_0x1f8565['joins'][_0x61cf23]['foreignTable'],null,util[_0x196c('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1f8565[_0x196c('0x6e')],_0x1f8565[_0x196c('0x77')][_0x61cf23]['parentKey'],_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7b')],_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7c')]));}}}if(_0x1f8565[_0x196c('0x80')]){_0x1f8565[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x1f8565[_0x196c('0x80')]);_0x1e9134[_0x196c('0x38')](_0x346561(_0x1f8565['conditions'][_0x196c('0x63')]));}_0x27d054=_0x1e9134[_0x196c('0x81')]();_0x1e9134[_0x196c('0x1d')](_0x1aa0ca);_0x1e9134[_0x196c('0x1b')](0x0);logger[_0x196c('0x82')](_0x196c('0x83'),_0x1e9134['toString']());return dbH[_0x196c('0x84')]['query'](_0x1e9134['toString'](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')]['SELECT']});}})[_0x196c('0x23')](function(){return{'sql':_0x27d054['toString']()};})[_0x196c('0x23')](respondWithResult(_0x3661e4,null))['catch'](handleError(_0x3661e4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1214e23..b5dbde8 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 _0x00d5=['request-promise','path','rimraf','exports','AnalyticCustomReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x41ef92,_0x4012d6){var _0x3a2add=function(_0x55d9bd){while(--_0x55d9bd){_0x41ef92['push'](_0x41ef92['shift']());}};_0x3a2add(++_0x4012d6);}(_0x00d5,0x19f));var _0x500d=function(_0x5de58a,_0x23d58e){_0x5de58a=_0x5de58a-0x0;var _0x589a6d=_0x00d5[_0x5de58a];return _0x589a6d;};'use strict';var _=require(_0x500d('0x0'));var util=require(_0x500d('0x1'));var logger=require(_0x500d('0x2'))(_0x500d('0x3'));var moment=require('moment');var BPromise=require(_0x500d('0x4'));var rp=require(_0x500d('0x5'));var fs=require('fs');var path=require(_0x500d('0x6'));var rimraf=require(_0x500d('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x500d('0x8')]=function(_0xda6957,_0x435ad3){return _0xda6957['define'](_0x500d('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ec=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0xd2ec,0x17b));var _0xcd2e=function(_0x3b811c,_0x1e5435){_0x3b811c=_0x3b811c-0x0;var _0x126b18=_0xd2ec[_0x3b811c];return _0x126b18;};'use strict';var _=require(_0xcd2e('0x0'));var util=require(_0xcd2e('0x1'));var logger=require(_0xcd2e('0x2'))(_0xcd2e('0x3'));var moment=require(_0xcd2e('0x4'));var BPromise=require(_0xcd2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd2e('0x6'));var rimraf=require(_0xcd2e('0x7'));var config=require(_0xcd2e('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xcd2e('0x9')]=function(_0x3a72b2,_0x164760){return _0x3a72b2[_0xcd2e('0xa')](_0xcd2e('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 04ec0b2..e830d30 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 _0xc9dc=['request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc9dc,0x9e));var _0xcc9d=function(_0x170bda,_0x3c08ab){_0x170bda=_0x170bda-0x0;var _0x1df66d=_0xc9dc[_0x170bda];return _0x1df66d;};'use strict';var _=require(_0xcc9d('0x0'));var util=require(_0xcc9d('0x1'));var moment=require(_0xcc9d('0x2'));var BPromise=require(_0xcc9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc9d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc9d('0x5'));var logger=require(_0xcc9d('0x6'))('rpc');var config=require(_0xcc9d('0x7'));var jayson=require(_0xcc9d('0x8'));var client=jayson[_0xcc9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x360c03,_0x5ce81c,_0x28aa02){return new BPromise(function(_0x4ee175,_0x36c7d4){return client[_0xcc9d('0xa')](_0x360c03,_0x28aa02)['then'](function(_0x21131b){logger[_0xcc9d('0xb')](_0xcc9d('0xc'),_0x5ce81c,_0xcc9d('0xd'));logger[_0xcc9d('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5ce81c,_0xcc9d('0xd'),JSON[_0xcc9d('0xf')](_0x21131b));if(_0x21131b[_0xcc9d('0x10')]){if(_0x21131b[_0xcc9d('0x10')][_0xcc9d('0x11')]===0x1f4){logger[_0xcc9d('0x10')](_0xcc9d('0xc'),_0x5ce81c,_0x21131b[_0xcc9d('0x10')]['message']);return _0x36c7d4(_0x21131b['error'][_0xcc9d('0x12')]);}logger['error'](_0xcc9d('0xc'),_0x5ce81c,_0x21131b['error'][_0xcc9d('0x12')]);return _0x4ee175(_0x21131b['error'][_0xcc9d('0x12')]);}else{logger['info'](_0xcc9d('0xc'),_0x5ce81c,'request\x20sent');_0x4ee175(_0x21131b[_0xcc9d('0x13')][_0xcc9d('0x12')]);}})[_0xcc9d('0x14')](function(_0x446281){logger[_0xcc9d('0x10')](_0xcc9d('0xc'),_0x5ce81c,_0x446281);_0x36c7d4(_0x446281);});});} \ No newline at end of file +var _0x530f=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x17323e,_0x3ed331){var _0x577592=function(_0xe72d15){while(--_0xe72d15){_0x17323e['push'](_0x17323e['shift']());}};_0x577592(++_0x3ed331);}(_0x530f,0x1a6));var _0xf530=function(_0x426dd2,_0x4b0012){_0x426dd2=_0x426dd2-0x0;var _0x4bc76c=_0x530f[_0x426dd2];return _0x4bc76c;};'use strict';var _=require(_0xf530('0x0'));var util=require(_0xf530('0x1'));var moment=require('moment');var BPromise=require(_0xf530('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf530('0x3'));var db=require(_0xf530('0x4'))['db'];var utils=require(_0xf530('0x5'));var logger=require(_0xf530('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf530('0x7'));var client=jayson[_0xf530('0x8')][_0xf530('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2a9a,_0x436ebf,_0x57dab6){return new BPromise(function(_0x33384,_0x528d25){return client[_0xf530('0xa')](_0x4b2a9a,_0x57dab6)[_0xf530('0xb')](function(_0xe85709){logger[_0xf530('0xc')](_0xf530('0xd'),_0x436ebf,_0xf530('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x436ebf,'request\x20sent',JSON['stringify'](_0xe85709));if(_0xe85709[_0xf530('0xf')]){if(_0xe85709[_0xf530('0xf')]['code']===0x1f4){logger['error'](_0xf530('0xd'),_0x436ebf,_0xe85709['error'][_0xf530('0x10')]);return _0x528d25(_0xe85709[_0xf530('0xf')][_0xf530('0x10')]);}logger[_0xf530('0xf')](_0xf530('0xd'),_0x436ebf,_0xe85709[_0xf530('0xf')][_0xf530('0x10')]);return _0x33384(_0xe85709['error']['message']);}else{logger[_0xf530('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x436ebf,_0xf530('0xe'));_0x33384(_0xe85709['result']['message']);}})[_0xf530('0x11')](function(_0x2364fc){logger[_0xf530('0xf')](_0xf530('0xd'),_0x436ebf,_0x2364fc);_0x528d25(_0x2364fc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3b75861..c2090d7 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 _0xa94d=['/:id','show','run','/:id/query','query','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x5b1d90,_0x479bd6){var _0x4fecce=function(_0x3c87c0){while(--_0x3c87c0){_0x5b1d90['push'](_0x5b1d90['shift']());}};_0x4fecce(++_0x479bd6);}(_0xa94d,0x147));var _0xda94=function(_0x1ba3fd,_0x254b67){_0x1ba3fd=_0x1ba3fd-0x0;var _0x3341b7=_0xa94d[_0x1ba3fd];return _0x3341b7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda94('0x0'));var timeout=require(_0xda94('0x1'));var express=require(_0xda94('0x2'));var router=express['Router']();var fs_extra=require(_0xda94('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda94('0x4'));var controller=require(_0xda94('0x5'));router[_0xda94('0x6')]('/',auth[_0xda94('0x7')](),controller[_0xda94('0x8')]);router[_0xda94('0x6')](_0xda94('0x9'),auth['isAuthenticated'](),controller[_0xda94('0xa')]);router[_0xda94('0x6')]('/:id/preview',auth[_0xda94('0x7')](),controller['preview']);router[_0xda94('0x6')]('/:id/run',auth[_0xda94('0x7')](),controller[_0xda94('0xb')]);router['get'](_0xda94('0xc'),auth[_0xda94('0x7')](),controller[_0xda94('0xd')]);router[_0xda94('0xe')]('/',auth[_0xda94('0x7')](),controller[_0xda94('0xf')]);router[_0xda94('0x10')](_0xda94('0x9'),auth['isAuthenticated'](),controller[_0xda94('0x11')]);router[_0xda94('0x12')](_0xda94('0x9'),auth[_0xda94('0x7')](),controller[_0xda94('0x13')]);module[_0xda94('0x14')]=router; \ No newline at end of file +var _0xd213=['get','isAuthenticated','index','/:id','run','query','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57a6a6,_0x170131){var _0x1d29b9=function(_0x42dc4c){while(--_0x42dc4c){_0x57a6a6['push'](_0x57a6a6['shift']());}};_0x1d29b9(++_0x170131);}(_0xd213,0xca));var _0x3d21=function(_0x3416d1,_0xb068b7){_0x3416d1=_0x3416d1-0x0;var _0x47a68b=_0xd213[_0x3416d1];return _0x47a68b;};'use strict';var multer=require(_0x3d21('0x0'));var util=require('util');var path=require(_0x3d21('0x1'));var timeout=require(_0x3d21('0x2'));var express=require('express');var router=express[_0x3d21('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3d21('0x4'));var interaction=require(_0x3d21('0x5'));var config=require(_0x3d21('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x3d21('0x7')]('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0x9')]);router['get'](_0x3d21('0xa'),auth[_0x3d21('0x8')](),controller['show']);router[_0x3d21('0x7')]('/:id/preview',auth[_0x3d21('0x8')](),controller['preview']);router[_0x3d21('0x7')]('/:id/run',auth[_0x3d21('0x8')](),controller[_0x3d21('0xb')]);router[_0x3d21('0x7')]('/:id/query',auth[_0x3d21('0x8')](),controller[_0x3d21('0xc')]);router['post']('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0xd')]);router[_0x3d21('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3d21('0xf')]);router[_0x3d21('0x10')](_0x3d21('0xa'),auth[_0x3d21('0x8')](),controller[_0x3d21('0x11')]);module[_0x3d21('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b431135..bfca99e 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x2c9288,_0x16be0d){var _0x4691a2=function(_0x34c63e){while(--_0x34c63e){_0x2c9288['push'](_0x2c9288['shift']());}};_0x4691a2(++_0x16be0d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x557a0c,_0x78cee2){_0x557a0c=_0x557a0c-0x0;var _0xdbee70=_0xdbf5[_0x557a0c];return _0xdbee70;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x2e7b8d,_0x3c8076){var _0x14b1ca=function(_0x2863da){while(--_0x2863da){_0x2e7b8d['push'](_0x2e7b8d['shift']());}};_0x14b1ca(++_0x3c8076);}(_0x33c5,0xe6));var _0x533c=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x33c5[_0x37cc52];return _0x2b4a90;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8355a03..ef6c546 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','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','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x28afe3,_0xef8354){var _0x377bf4=function(_0x189a04){while(--_0x189a04){_0x28afe3['push'](_0x28afe3['shift']());}};_0x377bf4(++_0xef8354);}(_0x53ec,0x192));var _0xc53e=function(_0x45030e,_0x32b6b8){_0x45030e=_0x45030e-0x0;var _0x4df3be=_0x53ec[_0x45030e];return _0x4df3be;};'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'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x524e=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','from','clone','output','web','fullPath','generate','csv','default'];(function(_0x454cc9,_0x2dc258){var _0x538d36=function(_0x1b1655){while(--_0x1b1655){_0x454cc9['push'](_0x454cc9['shift']());}};_0x538d36(++_0x2dc258);}(_0x524e,0x15e));var _0xe524=function(_0x801fea,_0x246d11){_0x801fea=_0x801fea-0x0;var _0x341147=_0x524e[_0x801fea];return _0x341147;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xfdc2a5,_0x1541d8){_0x1541d8=_0x1541d8||0xcc;return function(_0x11adbc){if(_0x11adbc){return _0xfdc2a5[_0xe524('0x1c')](_0x1541d8);}return _0xfdc2a5[_0xe524('0x1d')](_0x1541d8)['end']();};}function respondWithResult(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xc8;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x1d')](_0x51e9fe)['json'](_0x19f013);}};}function respondWithFilteredResult(_0x569660,_0x488fce){return function(_0x109795){if(_0x109795){var _0x538754=typeof _0x488fce[_0xe524('0x1e')]==='undefined'&&typeof _0x488fce['limit']==='undefined';var _0x3a4027=_0x109795['count'];var _0x11b2a1=_0x538754?0x0:_0x488fce[_0xe524('0x1e')];var _0x278de9=_0x538754?_0x109795[_0xe524('0x1f')]:_0x488fce['offset']+_0x488fce[_0xe524('0x20')];var _0x3ccb3f;if(_0x278de9>=_0x3a4027){_0x278de9=_0x3a4027;_0x3ccb3f=0xc8;}else{_0x3ccb3f=0xce;}_0x569660['status'](_0x3ccb3f);return _0x569660[_0xe524('0x21')](_0xe524('0x22'),_0x11b2a1+'-'+_0x278de9+'/'+_0x3a4027)[_0xe524('0x23')](_0x109795);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x24')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x25')](_0xbf059b);}return _0x1c4194[_0xe524('0x26')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x27')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x28')]()['then'](function(){var _0x17e245=_0x599d5d[_0xe524('0x29')]({'plain':!![]});var _0xd62772=_0xe524('0x2a');return db[_0xe524('0x2b')][_0xe524('0x28')]({'where':{'type':_0xd62772,'resourceId':_0x17e245['id']}})[_0xe524('0x27')](function(){return _0x599d5d;});})['then'](function(){_0x1ad106['status'](0xcc)[_0xe524('0x2c')]();});}};}function handleEntityNotFound(_0x45abad,_0x476572){return function(_0x109a96){if(!_0x109a96){_0x45abad[_0xe524('0x1c')](0x194);}return _0x109a96;};}function handleError(_0x5405e4,_0x52f140){_0x52f140=_0x52f140||0x1f4;return function(_0x4b1ff){logger[_0xe524('0x2d')](_0x4b1ff[_0xe524('0x2e')]);if(_0x4b1ff[_0xe524('0x2f')]){delete _0x4b1ff[_0xe524('0x2f')];}_0x5405e4['status'](_0x52f140)[_0xe524('0x30')](_0x4b1ff);};}exports[_0xe524('0x31')]=function(_0x4a4e15,_0x5b7ded){var _0x20688e={},_0x376324={},_0x5b2fc3={'count':0x0,'rows':[]};var _0x31d4a7=_['map'](db[_0xe524('0x32')]['rawAttributes'],function(_0x315e56){return{'name':_0x315e56[_0xe524('0x33')],'type':_0x315e56[_0xe524('0x34')]['key']};});_0x376324[_0xe524('0x35')]=_['map'](_0x31d4a7,_0xe524('0x2f'));_0x376324[_0xe524('0x36')]=_[_0xe524('0x37')](_0x4a4e15['query']);_0x376324[_0xe524('0x38')]=_[_0xe524('0x39')](_0x376324['model'],_0x376324[_0xe524('0x36')]);_0x20688e[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x376324[_0xe524('0x35')],qs['fields'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3b')]));_0x20688e[_0xe524('0x3a')]=_0x20688e[_0xe524('0x3a')][_0xe524('0x3c')]?_0x20688e[_0xe524('0x3a')]:_0x376324[_0xe524('0x35')];if(!_0x4a4e15[_0xe524('0x36')]['hasOwnProperty'](_0xe524('0x3d'))){_0x20688e['limit']=qs[_0xe524('0x20')](_0x4a4e15[_0xe524('0x36')]['limit']);_0x20688e[_0xe524('0x1e')]=qs['offset'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x1e')]);}_0x20688e[_0xe524('0x3e')]=qs[_0xe524('0x3f')](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3f')]);_0x20688e[_0xe524('0x40')]=qs[_0xe524('0x38')](_['pick'](_0x4a4e15[_0xe524('0x36')],_0x376324[_0xe524('0x38')]),_0x31d4a7);if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x41')]){_0x20688e[_0xe524('0x40')]=_[_0xe524('0x42')](_0x20688e[_0xe524('0x40')],{'$or':_[_0xe524('0x43')](_0x31d4a7,function(_0x5d3ea1){if(_0x5d3ea1[_0xe524('0x34')]!==_0xe524('0x44')){var _0x2e4a13={};_0x2e4a13[_0x5d3ea1['name']]={'$like':'%'+_0x4a4e15[_0xe524('0x36')]['filter']+'%'};return _0x2e4a13;}})});}_0x20688e=_[_0xe524('0x42')]({},_0x20688e,_0x4a4e15[_0xe524('0x45')]);var _0x43c314={'where':_0x20688e[_0xe524('0x40')]};return db[_0xe524('0x32')][_0xe524('0x1f')](_0x43c314)[_0xe524('0x27')](function(_0x52cd0e){_0x5b2fc3[_0xe524('0x1f')]=_0x52cd0e;if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x46')]){_0x20688e[_0xe524('0x47')]=[{'all':!![]}];}return db[_0xe524('0x32')][_0xe524('0x48')](_0x20688e);})['then'](function(_0xb694b9){_0x5b2fc3[_0xe524('0x49')]=_0xb694b9;return _0x5b2fc3;})[_0xe524('0x27')](respondWithFilteredResult(_0x5b7ded,_0x20688e))['catch'](handleError(_0x5b7ded,null));};exports[_0xe524('0x4a')]=function(_0x5209dc,_0x4e5d99){var _0x2b9b3b={'raw':!![],'where':{'id':_0x5209dc['params']['id']}},_0x33906d={};_0x33906d[_0xe524('0x35')]=_[_0xe524('0x37')](db[_0xe524('0x32')][_0xe524('0x4b')]);_0x33906d['query']=_['keys'](_0x5209dc[_0xe524('0x36')]);_0x33906d[_0xe524('0x38')]=_['intersection'](_0x33906d[_0xe524('0x35')],_0x33906d['query']);_0x2b9b3b[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x33906d[_0xe524('0x35')],qs[_0xe524('0x3b')](_0x5209dc[_0xe524('0x36')][_0xe524('0x3b')]));_0x2b9b3b[_0xe524('0x3a')]=_0x2b9b3b[_0xe524('0x3a')][_0xe524('0x3c')]?_0x2b9b3b[_0xe524('0x3a')]:_0x33906d[_0xe524('0x35')];if(_0x5209dc[_0xe524('0x36')][_0xe524('0x46')]){_0x2b9b3b[_0xe524('0x47')]=[{'all':!![]}];}_0x2b9b3b=_[_0xe524('0x42')]({},_0x2b9b3b,_0x5209dc['options']);return db[_0xe524('0x32')]['find'](_0x2b9b3b)['then'](handleEntityNotFound(_0x4e5d99,null))[_0xe524('0x27')](respondWithResult(_0x4e5d99,null))['catch'](handleError(_0x4e5d99,null));};exports[_0xe524('0x4c')]=function(_0x15d7ee,_0x561107){return db[_0xe524('0x32')]['create'](_0x15d7ee['body'],{})[_0xe524('0x27')](function(_0x1e5687){var _0x203e71=_0x15d7ee['user']['get']({'plain':!![]});if(!_0x203e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203e71['role']==='user'){var _0x5477ca=_0x1e5687[_0xe524('0x29')]({'plain':!![]});var _0x2ce5c0='Reports';return db[_0xe524('0x4d')][_0xe524('0x4e')]({'where':{'name':_0x2ce5c0,'userProfileId':_0x203e71[_0xe524('0x4f')]},'raw':!![]})[_0xe524('0x27')](function(_0x2fa143){if(_0x2fa143&&_0x2fa143['autoAssociation']===0x0){return db[_0xe524('0x2b')][_0xe524('0x4c')]({'name':_0x5477ca[_0xe524('0x2f')],'resourceId':_0x5477ca['id'],'type':'DefaultReports','sectionId':_0x2fa143['id']},{})[_0xe524('0x27')](function(){return _0x1e5687;});}else{return _0x1e5687;}})['catch'](function(_0x12e5d0){logger[_0xe524('0x2d')](_0xe524('0x50'),_0x12e5d0);throw _0x12e5d0;});}return _0x1e5687;})[_0xe524('0x27')](respondWithResult(_0x561107,0xc9))[_0xe524('0x51')](handleError(_0x561107,null));};exports[_0xe524('0x52')]=function(_0x1cec31,_0x374450){if(_0x1cec31[_0xe524('0x53')]['id']){delete _0x1cec31[_0xe524('0x53')]['id'];}return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x1cec31['params']['id']}})['then'](handleEntityNotFound(_0x374450,null))['then'](saveUpdates(_0x1cec31[_0xe524('0x53')],null))[_0xe524('0x27')](respondWithResult(_0x374450,null))[_0xe524('0x51')](handleError(_0x374450,null));};exports[_0xe524('0x28')]=function(_0x45fb0d,_0xef3d2f){return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x45fb0d[_0xe524('0x54')]['id']}})[_0xe524('0x27')](handleEntityNotFound(_0xef3d2f,null))[_0xe524('0x27')](removeEntity(_0xef3d2f,null))['catch'](handleError(_0xef3d2f,null));};exports[_0xe524('0x55')]=function(_0x1f0567,_0x4a5f4a){var _0x53da86=0xa;var _0x54adbd=['join',_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x8a2c00={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':_0xe524('0x5a'),'MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x582fbb={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x4f58ff=function(_0x5d0507){return!_[_0xe524('0x63')]([_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x67')],_0x5d0507);};var _0x474ed4=function(_0x5135f0){if(!_0x5135f0||!_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0xc3ccfd='(',_0x5d3b9c=0x0;_0x5d3b9c<_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')];_0x5d3b9c+=0x1){_0x5d3b9c>0x0&&(_0xc3ccfd+='\x20'+_0x5135f0[_0xe524('0x69')]+'\x20');_0xc3ccfd+=_0x5135f0['rules'][_0x5d3b9c]['group']?_0x474ed4(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6a')]):_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6b')]+'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c]['condition']+(_0x4f58ff(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6c')])?'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6d')]:'');}return _0xc3ccfd+')';};var _0x3ce098={'where':{'id':_0x1f0567[_0xe524('0x54')]['id']}},_0x22d06a,_0x35e6b2,_0x1e4b32,_0x27c55c,_0x7e5992;_0x3ce098=_['merge']({},_0x3ce098,_0x1f0567[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x3ce098)[_0xe524('0x27')](function(_0xeec885){if(_0xeec885){_0x22d06a=_0xeec885;return _0xeec885['getFields']();}return null;})[_0xe524('0x27')](function(_0x2341cf){if(_0x2341cf){if(!_0x2341cf[_0xe524('0x3c')]){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x35e6b2=_0x2341cf;return db[_0xe524('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x245501){if(_0x245501){_0x1e4b32=_[_0xe524('0x72')](_0x245501,'id');var _0xce15f5;var _0x5ec07c=squel[_0xe524('0x73')]();_0x5ec07c['from'](_0x22d06a[_0xe524('0x74')]);for(var _0x2a88e2=0x0;_0x2a88e2<_0x35e6b2[_0xe524('0x3c')];_0x2a88e2+=0x1){_0xce15f5=_0x35e6b2[_0x2a88e2]['MetricId']?_0x1e4b32[_0x35e6b2[_0x2a88e2][_0xe524('0x75')]][_0xe524('0x76')]:_0x35e6b2[_0x2a88e2][_0xe524('0x6b')];_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x77')]?_[_0xe524('0x78')](_0x8a2c00[_0x35e6b2[_0x2a88e2]['function']],'%s',_0xce15f5):_0xce15f5;_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x79')]?_[_0xe524('0x78')](_0x582fbb[_0x35e6b2[_0x2a88e2][_0xe524('0x79')]],'%s',_0xce15f5):_0xce15f5;if(_0x35e6b2[_0x2a88e2][_0xe524('0x7a')]){_0x5ec07c[_0xe524('0x6a')](_0xce15f5);}_0x35e6b2[_0x2a88e2]['orderBy']&&_0x5ec07c[_0xe524('0x3e')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7b')]===_0xe524('0x7c')?![]:!![]);_0x5ec07c[_0xe524('0x6b')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7d')]||_0xce15f5);}if(_0x22d06a[_0xe524('0x7e')]){_0x22d06a['joins']=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x7e')]);for(var _0x1beaa2=0x0;_0x1beaa2<_0x22d06a['joins'][_0xe524('0x3c')];_0x1beaa2+=0x1){if(_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['type']&&_[_0xe524('0x63')](_0x54adbd,_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')])&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')]&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['foreignTable']&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]){_0x5ec07c[_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')]](_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x22d06a[_0xe524('0x74')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]));}}}if(_0x22d06a['conditions']){_0x22d06a[_0xe524('0x84')]=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x84')]);_0x5ec07c['where'](_0x474ed4(_0x22d06a[_0xe524('0x84')][_0xe524('0x6a')]));}_0x7e5992=_0x5ec07c['clone']();_0x5ec07c['limit'](_0x53da86);_0x5ec07c[_0xe524('0x1e')](0x0);logger['debug'](_0xe524('0x85'),_0x5ec07c['toString']());return dbH[_0xe524('0x86')][_0xe524('0x36')](_0x5ec07c[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')]['QueryTypes']['SELECT']});}})[_0xe524('0x27')](respondWithResult(_0x4a5f4a,null))[_0xe524('0x51')](handleError(_0x4a5f4a,null));};function runReport(_0x50eb96,_0x45c287,_0x449842){var _0x1f3ed1=_0x45c287['name'];var _0x19b063=0xa;var _0x140a4e=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x54385f={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':_0xe524('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1681c5={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x50f5e3=function(_0x11298c){return!_[_0xe524('0x63')]([_0xe524('0x64'),'IS\x20NOT\x20NULL',_0xe524('0x66'),_0xe524('0x67')],_0x11298c);};var _0x5603d0=function(_0x2712ac){if(!_0x2712ac||!_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0x32c9f6='(',_0x58d29e=0x0;_0x58d29e<_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')];_0x58d29e+=0x1){_0x58d29e>0x0&&(_0x32c9f6+='\x20'+_0x2712ac[_0xe524('0x69')]+'\x20');_0x32c9f6+=_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]?_0x5603d0(_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]):_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6b')]+'\x20'+_0x2712ac['rules'][_0x58d29e][_0xe524('0x6c')]+(_0x50f5e3(_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6c')])?'\x20'+_0x2712ac['rules'][_0x58d29e]['value']:'');}return _0x32c9f6+')';};var _0x334164={'where':{'id':_0x50eb96['id']}},_0x512572,_0x903e24,_0x4964c3,_0x2dc3f5,_0x246c62;_0x334164=_['merge']({},_0x334164,_0x449842);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x334164)['then'](function(_0x482b72){if(_0x482b72){_0x512572=_0x482b72;return _0x482b72[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x1b3e03){if(_0x1b3e03){if(!_0x1b3e03['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x903e24=_0x1b3e03;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x57501c){if(_0x57501c){_0x4964c3=_[_0xe524('0x72')](_0x57501c,'id');var _0x3a2834;var _0x4c7f45=squel['select']();_0x4c7f45[_0xe524('0x8c')](_0x512572[_0xe524('0x74')]);for(var _0x41f842=0x0;_0x41f842<_0x903e24[_0xe524('0x3c')];_0x41f842+=0x1){_0x3a2834=_0x903e24[_0x41f842]['MetricId']?_0x4964c3[_0x903e24[_0x41f842][_0xe524('0x75')]][_0xe524('0x76')]:_0x903e24[_0x41f842]['field'];_0x3a2834=_0x903e24[_0x41f842]['function']?_[_0xe524('0x78')](_0x54385f[_0x903e24[_0x41f842][_0xe524('0x77')]],'%s',_0x3a2834):_0x3a2834;_0x3a2834=_0x903e24[_0x41f842][_0xe524('0x79')]?_[_0xe524('0x78')](_0x1681c5[_0x903e24[_0x41f842][_0xe524('0x79')]],'%s',_0x3a2834):_0x3a2834;if(_0x903e24[_0x41f842][_0xe524('0x7a')]){_0x4c7f45['group'](_0x3a2834);}_0x903e24[_0x41f842]['orderBy']&&_0x4c7f45[_0xe524('0x3e')](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x4c7f45['field'](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7d')]||_0x3a2834);}if(_0x512572[_0xe524('0x7e')]){_0x512572[_0xe524('0x7e')]=JSON[_0xe524('0x7f')](_0x512572[_0xe524('0x7e')]);for(var _0xa820a1=0x0;_0xa820a1<_0x512572['joins']['length'];_0xa820a1+=0x1){if(_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x140a4e,_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')])&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x80')]&&_0x512572[_0xe524('0x7e')][_0xa820a1]['foreignTable']&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]){_0x4c7f45[_0x512572[_0xe524('0x7e')][_0xa820a1]['type']](_0x512572['joins'][_0xa820a1][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x512572[_0xe524('0x74')],_0x512572['joins'][_0xa820a1][_0xe524('0x80')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x82')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]));}}}if(_0x512572['conditions']){_0x512572[_0xe524('0x84')]=JSON['parse'](_0x512572[_0xe524('0x84')]);_0x4c7f45[_0xe524('0x40')](_0x5603d0(_0x512572['conditions'][_0xe524('0x6a')]));}_0x246c62=_0x4c7f45[_0xe524('0x8d')]();_0x4c7f45['limit'](_0x19b063);_0x4c7f45[_0xe524('0x1e')](0x0);return;}})['then'](function(){if(_0x45c287[_0xe524('0x8e')]===_0xe524('0x8f')){return null;}var _0x1be681=_[_0xe524('0x42')](_0x45c287,{'name':_0x45c287[_0xe524('0x90')]||_0x45c287[_0xe524('0x2f')]||_0x512572[_0xe524('0x2f')],'basename':_0x1f3ed1,'savename':util[_0xe524('0x79')]('%s-%s.%s',_0x45c287[_0xe524('0x2f')]||_0x512572['name'],require('randomstring')[_0xe524('0x91')](0x4),_0x45c287['output']||_0xe524('0x92')),'reportId':_0x512572['id'],'reportType':_0xe524('0x93')});return db[_0xe524('0x94')][_0xe524('0x4c')](_0x1be681,{'raw':!![]});})[_0xe524('0x27')](function(_0x26c802){if(_0x512572['table']==='cdr'){_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x95'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}else{_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x98'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}if(_0x26c802){logger['info'](_0xe524('0x99'),_0x246c62[_0xe524('0x87')]());require(_0xe524('0x9a'))[_0xe524('0x9b')](path[_0xe524('0x88')](__dirname,_0xe524('0x9c'),_0x26c802['output']),[_0x26c802['id'],_0x246c62[_0xe524('0x87')](),path[_0xe524('0x88')](__dirname,_0xe524('0x9d'),_0x26c802[_0xe524('0x9e')]),_0x1f3ed1]);return _0x26c802;}else{var _0x84bbd7=squel[_0xe524('0x73')]();_0x84bbd7[_0xe524('0x8c')]('('+_0x246c62[_0xe524('0x87')]()+')','countTable');_0x84bbd7['field']('COUNT(*)',_0xe524('0x1f'));_0x246c62[_0xe524('0x20')](_0x45c287['limit']||_0x19b063);_0x246c62[_0xe524('0x1e')](_0x45c287[_0xe524('0x1e')]||0x0);return dbH['sequelize'][_0xe524('0x36')](_0x84bbd7[_0xe524('0x87')](),{'type':dbH['sequelize'][_0xe524('0x9f')][_0xe524('0xa0')]})[_0xe524('0x27')](function(_0x542182){if(!_0x542182[_0xe524('0x3c')]){_0x2dc3f5=0x0;}else{_0x2dc3f5=_0x542182[0x0][_0xe524('0x1f')]||0x0;}return dbH[_0xe524('0x86')]['query'](_0x246c62[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});})['then'](function(_0x5e6a3d){return{'rows':_0x5e6a3d||[],'count':_0x2dc3f5};});}});}exports[_0xe524('0xa1')]=function(_0x33d066,_0x3ea495){return runReport(_0x33d066[_0xe524('0x54')],_0x33d066[_0xe524('0x36')],_0x33d066[_0xe524('0x45')])[_0xe524('0x27')](respondWithResult(_0x3ea495,null))[_0xe524('0x51')](handleError(_0x3ea495,null));};exports[_0xe524('0xa2')]=runReport;exports[_0xe524('0x36')]=function(_0x4505de,_0x292f14){var _0x2d24c1=0xa;var _0x483307=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x280022={'SUM':_0xe524('0xa3'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':'MIN(%s)','AVG':_0xe524('0x89'),'GROUP_CONCAT':_0xe524('0xa4'),'GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x46d6da={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x39998a=function(_0x107de8){return!_['includes']([_0xe524('0x64'),_0xe524('0x65'),'IS\x20EMPTY',_0xe524('0x67')],_0x107de8);};var _0x458e14=function(_0x4e0886){if(!_0x4e0886||!_0x4e0886['rules'][_0xe524('0x3c')]){return'';}for(var _0x3639cf='(',_0x575c14=0x0;_0x575c14<_0x4e0886['rules'][_0xe524('0x3c')];_0x575c14+=0x1){_0x575c14>0x0&&(_0x3639cf+='\x20'+_0x4e0886['operator']+'\x20');_0x3639cf+=_0x4e0886['rules'][_0x575c14]['group']?_0x458e14(_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6a')]):_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6b')]+'\x20'+_0x4e0886['rules'][_0x575c14]['condition']+(_0x39998a(_0x4e0886['rules'][_0x575c14][_0xe524('0x6c')])?'\x20'+_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6d')]:'');}return _0x3639cf+')';};var _0x289720={'where':{'id':_0x4505de[_0xe524('0x54')]['id']}},_0x3fb45c,_0x3362fe,_0x119684,_0x19e4fd,_0x4b4349;_0x289720=_[_0xe524('0x42')]({},_0x289720,_0x4505de[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x289720)[_0xe524('0x27')](function(_0x404a49){if(_0x404a49){_0x3fb45c=_0x404a49;return _0x404a49[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x8e8087){if(_0x8e8087){if(!_0x8e8087['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x3362fe=_0x8e8087;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x113a54){if(_0x113a54){_0x119684=_[_0xe524('0x72')](_0x113a54,'id');var _0x4ebca4;var _0x40043c=squel[_0xe524('0x73')]();_0x40043c[_0xe524('0x8c')](_0x3fb45c[_0xe524('0x74')]);for(var _0x19a773=0x0;_0x19a773<_0x3362fe[_0xe524('0x3c')];_0x19a773+=0x1){_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x75')]?_0x119684[_0x3362fe[_0x19a773][_0xe524('0x75')]][_0xe524('0x76')]:_0x3362fe[_0x19a773][_0xe524('0x6b')];_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x77')]?_[_0xe524('0x78')](_0x280022[_0x3362fe[_0x19a773]['function']],'%s',_0x4ebca4):_0x4ebca4;_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x79')]?_[_0xe524('0x78')](_0x46d6da[_0x3362fe[_0x19a773][_0xe524('0x79')]],'%s',_0x4ebca4):_0x4ebca4;if(_0x3362fe[_0x19a773]['groupBy']){_0x40043c['group'](_0x4ebca4);}_0x3362fe[_0x19a773][_0xe524('0x7b')]&&_0x40043c[_0xe524('0x3e')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x40043c[_0xe524('0x6b')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7d')]||_0x4ebca4);}if(_0x3fb45c[_0xe524('0x7e')]){_0x3fb45c['joins']=JSON['parse'](_0x3fb45c[_0xe524('0x7e')]);for(var _0x2a85e5=0x0;_0x2a85e5<_0x3fb45c[_0xe524('0x7e')]['length'];_0x2a85e5+=0x1){if(_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x483307,_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')])&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')]&&_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')]&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]){_0x40043c[_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]](_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')],null,util[_0xe524('0x79')]('%s.%s\x20=\x20%s.%s',_0x3fb45c[_0xe524('0x74')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x82')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]));}}}if(_0x3fb45c[_0xe524('0x84')]){_0x3fb45c[_0xe524('0x84')]=JSON['parse'](_0x3fb45c['conditions']);_0x40043c[_0xe524('0x40')](_0x458e14(_0x3fb45c[_0xe524('0x84')][_0xe524('0x6a')]));}_0x4b4349=_0x40043c[_0xe524('0x8d')]();_0x40043c[_0xe524('0x20')](_0x2d24c1);_0x40043c[_0xe524('0x1e')](0x0);logger[_0xe524('0xa5')]('Limited\x20Query:',_0x40043c['toString']());return dbH[_0xe524('0x86')]['query'](_0x40043c['toString'](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});}})[_0xe524('0x27')](function(){return{'sql':_0x4b4349[_0xe524('0x87')]()};})[_0xe524('0x27')](respondWithResult(_0x292f14,null))['catch'](handleError(_0x292f14,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0ee4c8e..5a44f5e 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 _0x0382=['api','moment','request-promise','path','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x57c9db,_0x5e3706){var _0x34b33d=function(_0x1976fb){while(--_0x1976fb){_0x57c9db['push'](_0x57c9db['shift']());}};_0x34b33d(++_0x5e3706);}(_0x0382,0x1c5));var _0x2038=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x0382[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0x2038('0x0'));var util=require(_0x2038('0x1'));var logger=require(_0x2038('0x2'))(_0x2038('0x3'));var moment=require(_0x2038('0x4'));var BPromise=require('bluebird');var rp=require(_0x2038('0x5'));var fs=require('fs');var path=require(_0x2038('0x6'));var rimraf=require(_0x2038('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x2038('0x8')]=function(_0xb7eab,_0x360fd8){return _0xb7eab[_0x2038('0x9')](_0x2038('0xa'),attributes,{'tableName':_0x2038('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbe7=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x357dd7,_0x431a02){var _0xcb0466=function(_0x3ab60d){while(--_0x3ab60d){_0x357dd7['push'](_0x357dd7['shift']());}};_0xcb0466(++_0x431a02);}(_0xdbe7,0xe4));var _0x7dbe=function(_0x4ae4d6,_0x2f62d5){_0x4ae4d6=_0x4ae4d6-0x0;var _0x5de416=_0xdbe7[_0x4ae4d6];return _0x5de416;};'use strict';var _=require(_0x7dbe('0x0'));var util=require('util');var logger=require(_0x7dbe('0x1'))(_0x7dbe('0x2'));var moment=require('moment');var BPromise=require(_0x7dbe('0x3'));var rp=require(_0x7dbe('0x4'));var fs=require('fs');var path=require(_0x7dbe('0x5'));var rimraf=require(_0x7dbe('0x6'));var config=require(_0x7dbe('0x7'));var attributes=require(_0x7dbe('0x8'));module[_0x7dbe('0x9')]=function(_0x5c9a55,_0x4ee1fc){return _0x5c9a55[_0x7dbe('0xa')](_0x7dbe('0xb'),attributes,{'tableName':_0x7dbe('0xc'),'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 17e63b2..e3f4925 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 _0x0e8e=['../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','AnalyticDefaultReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0x0e8e,0xd5));var _0xe0e8=function(_0x5500c4,_0x160ef0){_0x5500c4=_0x5500c4-0x0;var _0x36c5ff=_0x0e8e[_0x5500c4];return _0x36c5ff;};'use strict';var _=require(_0xe0e8('0x0'));var util=require(_0xe0e8('0x1'));var moment=require(_0xe0e8('0x2'));var BPromise=require(_0xe0e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0e8('0x4'));var db=require(_0xe0e8('0x5'))['db'];var utils=require(_0xe0e8('0x6'));var logger=require(_0xe0e8('0x7'))(_0xe0e8('0x8'));var config=require('../../config/environment');var jayson=require(_0xe0e8('0x9'));var client=jayson[_0xe0e8('0xa')][_0xe0e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59f947,_0x60cd75,_0x1f7c17){return new BPromise(function(_0x47e025,_0x45013f){return client[_0xe0e8('0xc')](_0x59f947,_0x1f7c17)['then'](function(_0x2b2ab9){logger[_0xe0e8('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x60cd75,_0xe0e8('0xe'));logger[_0xe0e8('0xf')](_0xe0e8('0x10'),_0x60cd75,_0xe0e8('0xe'),JSON['stringify'](_0x2b2ab9));if(_0x2b2ab9['error']){if(_0x2b2ab9[_0xe0e8('0x11')]['code']===0x1f4){logger[_0xe0e8('0x11')](_0xe0e8('0x12'),_0x60cd75,_0x2b2ab9[_0xe0e8('0x11')][_0xe0e8('0x13')]);return _0x45013f(_0x2b2ab9['error'][_0xe0e8('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x60cd75,_0x2b2ab9['error'][_0xe0e8('0x13')]);return _0x47e025(_0x2b2ab9['error'][_0xe0e8('0x13')]);}else{logger[_0xe0e8('0xd')](_0xe0e8('0x12'),_0x60cd75,'request\x20sent');_0x47e025(_0x2b2ab9['result']['message']);}})['catch'](function(_0x5dd6c5){logger['error'](_0xe0e8('0x12'),_0x60cd75,_0x5dd6c5);_0x45013f(_0x5dd6c5);});});} \ No newline at end of file +var _0xee48=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x31aed6,_0x424dcc){var _0x45ac4a=function(_0x1b5d37){while(--_0x1b5d37){_0x31aed6['push'](_0x31aed6['shift']());}};_0x45ac4a(++_0x424dcc);}(_0xee48,0x1a5));var _0x8ee4=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xee48[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x8ee4('0x0'));var util=require(_0x8ee4('0x1'));var moment=require(_0x8ee4('0x2'));var BPromise=require(_0x8ee4('0x3'));var rs=require(_0x8ee4('0x4'));var fs=require('fs');var Redis=require(_0x8ee4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ee4('0x6'));var logger=require(_0x8ee4('0x7'))(_0x8ee4('0x8'));var config=require(_0x8ee4('0x9'));var jayson=require(_0x8ee4('0xa'));var client=jayson[_0x8ee4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x774139,_0x4f03f6,_0x1e9158){return new BPromise(function(_0x4943fd,_0x3b45e4){return client[_0x8ee4('0xc')](_0x774139,_0x1e9158)[_0x8ee4('0xd')](function(_0x4e53ce){logger[_0x8ee4('0xe')](_0x8ee4('0xf'),_0x4f03f6,_0x8ee4('0x10'));logger[_0x8ee4('0x11')](_0x8ee4('0x12'),_0x4f03f6,_0x8ee4('0x10'),JSON['stringify'](_0x4e53ce));if(_0x4e53ce[_0x8ee4('0x13')]){if(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x14')]===0x1f4){logger[_0x8ee4('0x13')](_0x8ee4('0xf'),_0x4f03f6,_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);return _0x3b45e4(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4f03f6,_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);return _0x4943fd(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);}else{logger[_0x8ee4('0xe')](_0x8ee4('0xf'),_0x4f03f6,'request\x20sent');_0x4943fd(_0x4e53ce[_0x8ee4('0x16')][_0x8ee4('0x15')]);}})['catch'](function(_0x33981d){logger['error'](_0x8ee4('0xf'),_0x4f03f6,_0x33981d);_0x3b45e4(_0x33981d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cad32b5..ed90403 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 _0x8276=['Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','run','query','post','update','multer','util','express'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x8276,0xa7));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6827('0x2'));var router=express[_0x6827('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6827('0x4'));var interaction=require(_0x6827('0x5'));var config=require('../../config/environment');var controller=require(_0x6827('0x6'));router[_0x6827('0x7')]('/',auth[_0x6827('0x8')](),controller[_0x6827('0x9')]);router[_0x6827('0x7')](_0x6827('0xa'),auth[_0x6827('0x8')](),controller[_0x6827('0xb')]);router[_0x6827('0x7')]('/:id/preview',auth[_0x6827('0x8')](),controller[_0x6827('0xc')]);router[_0x6827('0x7')]('/:id/run',auth[_0x6827('0x8')](),controller[_0x6827('0xd')]);router[_0x6827('0x7')]('/:id/query',auth[_0x6827('0x8')](),controller[_0x6827('0xe')]);router[_0x6827('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6827('0xa'),auth[_0x6827('0x8')](),controller[_0x6827('0x10')]);router['delete'](_0x6827('0xa'),auth[_0x6827('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4be7=['index','/:id','/:id/preview','preview','/:id/run','/:id/query','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x189fe1,_0x373c91){var _0x17364e=function(_0x1b5471){while(--_0x1b5471){_0x189fe1['push'](_0x189fe1['shift']());}};_0x17364e(++_0x373c91);}(_0x4be7,0x114));var _0x74be=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x4be7[_0x59ae80];return _0x473bf9;};'use strict';var multer=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var path=require(_0x74be('0x2'));var timeout=require('connect-timeout');var express=require(_0x74be('0x3'));var router=express[_0x74be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74be('0x5'));var config=require(_0x74be('0x6'));var controller=require(_0x74be('0x7'));router[_0x74be('0x8')]('/',auth[_0x74be('0x9')](),controller[_0x74be('0xa')]);router['get'](_0x74be('0xb'),auth[_0x74be('0x9')](),controller['show']);router['get'](_0x74be('0xc'),auth[_0x74be('0x9')](),controller[_0x74be('0xd')]);router[_0x74be('0x8')](_0x74be('0xe'),auth[_0x74be('0x9')](),controller['run']);router['get'](_0x74be('0xf'),auth[_0x74be('0x9')](),controller['query']);router[_0x74be('0x10')]('/',auth[_0x74be('0x9')](),controller[_0x74be('0x11')]);router[_0x74be('0x12')]('/:id',auth[_0x74be('0x9')](),controller['update']);router[_0x74be('0x13')](_0x74be('0xb'),auth[_0x74be('0x9')](),controller[_0x74be('0x14')]);module[_0x74be('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 00d448c..28aa429 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 _0x684d=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x4232bf,_0x538fe0){var _0x11e51e=function(_0x246746){while(--_0x246746){_0x4232bf['push'](_0x4232bf['shift']());}};_0x11e51e(++_0x538fe0);}(_0x684d,0xe2));var _0xd684=function(_0x869bce,_0x18c2f9){_0x869bce=_0x869bce-0x0;var _0x889be3=_0x684d[_0x869bce];return _0x889be3;};'use strict';var Sequelize=require(_0xd684('0x0'));var moment=require(_0xd684('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xd684('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd684('0x3')]('csv',_0xd684('0x4'),_0xd684('0x5')),'allowNull':![],'defaultValue':_0xd684('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd684('0x7')]},'endDate':{'type':Sequelize[_0xd684('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xd684('0x8')},'type':{'type':Sequelize[_0xd684('0x3')](_0xd684('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xd684('0x9')},'reportId':{'type':Sequelize[_0xd684('0xa')](0xb)[_0xd684('0xb')]},'reportType':{'type':Sequelize[_0xd684('0x2')]}}; \ No newline at end of file +var _0xba3f=['STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','moment','exports'];(function(_0x4177c6,_0x4e2e1d){var _0xb34d1f=function(_0x5dbf33){while(--_0x5dbf33){_0x4177c6['push'](_0x4177c6['shift']());}};_0xb34d1f(++_0x4e2e1d);}(_0xba3f,0x195));var _0xfba3=function(_0x46964a,_0x3a9ed5){_0x46964a=_0x46964a-0x0;var _0x2df4ad=_0xba3f[_0x46964a];return _0x2df4ad;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfba3('0x0'));module[_0xfba3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xfba3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xfba3('0x3')](_0xfba3('0x4'),_0xfba3('0x5'),_0xfba3('0x6')),'allowNull':![],'defaultValue':_0xfba3('0x4')},'savename':{'type':Sequelize[_0xfba3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfba3('0x7')]},'endDate':{'type':Sequelize[_0xfba3('0x7')]},'status':{'type':Sequelize[_0xfba3('0x2')],'defaultValue':_0xfba3('0x8')},'type':{'type':Sequelize[_0xfba3('0x3')](_0xfba3('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xfba3('0x9')},'reportId':{'type':Sequelize[_0xfba3('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xfba3('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e8382d8..90edff4 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 _0xfd59=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','AnalyticExtractedReport','includeAll','include','findAll','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','download','basename','savename','output','existsSync','join','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','stack','name','index','map','fieldName','type','model'];(function(_0x33a2b3,_0x4dcb36){var _0xf11442=function(_0x3bfd77){while(--_0x3bfd77){_0x33a2b3['push'](_0x33a2b3['shift']());}};_0xf11442(++_0x4dcb36);}(_0xfd59,0x154));var _0x9fd5=function(_0x1b59af,_0x40b2db){_0x1b59af=_0x1b59af-0x0;var _0x54e6f5=_0xfd59[_0x1b59af];return _0x54e6f5;};'use strict';var emlformat=require(_0x9fd5('0x0'));var rimraf=require(_0x9fd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fd5('0x2'));var rp=require(_0x9fd5('0x3'));var moment=require(_0x9fd5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fd5('0x5'));var util=require(_0x9fd5('0x6'));var path=require(_0x9fd5('0x7'));var sox=require(_0x9fd5('0x8'));var csv=require(_0x9fd5('0x9'));var ejs=require(_0x9fd5('0xa'));var fs=require('fs');var fs_extra=require(_0x9fd5('0xb'));var _=require(_0x9fd5('0xc'));var squel=require(_0x9fd5('0xd'));var crypto=require(_0x9fd5('0xe'));var jsforce=require(_0x9fd5('0xf'));var deskjs=require(_0x9fd5('0x10'));var toCsv=require(_0x9fd5('0x9'));var querystring=require(_0x9fd5('0x11'));var Papa=require(_0x9fd5('0x12'));var Redis=require(_0x9fd5('0x13'));var authService=require(_0x9fd5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9fd5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd5('0x16'))(_0x9fd5('0x17'));var utils=require(_0x9fd5('0x18'));var config=require(_0x9fd5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9fd5('0x1a'))['db'];function respondWithStatusCode(_0x30c2f3,_0x2ee368){_0x2ee368=_0x2ee368||0xcc;return function(_0x4d486f){if(_0x4d486f){return _0x30c2f3[_0x9fd5('0x1b')](_0x2ee368);}return _0x30c2f3[_0x9fd5('0x1c')](_0x2ee368)['end']();};}function respondWithResult(_0x46f810,_0x5b34cc){_0x5b34cc=_0x5b34cc||0xc8;return function(_0x429928){if(_0x429928){return _0x46f810[_0x9fd5('0x1c')](_0x5b34cc)[_0x9fd5('0x1d')](_0x429928);}};}function respondWithFilteredResult(_0x211868,_0x213626){return function(_0x28d83b){if(_0x28d83b){var _0x4f13c8=typeof _0x213626[_0x9fd5('0x1e')]==='undefined'&&typeof _0x213626[_0x9fd5('0x1f')]===_0x9fd5('0x20');var _0x292383=_0x28d83b['count'];var _0x5beed3=_0x4f13c8?0x0:_0x213626[_0x9fd5('0x1e')];var _0x5eb46f=_0x4f13c8?_0x28d83b[_0x9fd5('0x21')]:_0x213626['offset']+_0x213626[_0x9fd5('0x1f')];var _0x58db0e;if(_0x5eb46f>=_0x292383){_0x5eb46f=_0x292383;_0x58db0e=0xc8;}else{_0x58db0e=0xce;}_0x211868[_0x9fd5('0x1c')](_0x58db0e);return _0x211868[_0x9fd5('0x22')]('Content-Range',_0x5beed3+'-'+_0x5eb46f+'/'+_0x292383)['json'](_0x28d83b);}return null;};}function patchUpdates(_0x1a8662){return function(_0x1fdc00){try{jsonpatch[_0x9fd5('0x23')](_0x1fdc00,_0x1a8662,!![]);}catch(_0x1f4462){return BPromise[_0x9fd5('0x24')](_0x1f4462);}return _0x1fdc00[_0x9fd5('0x25')]();};}function saveUpdates(_0x17bc53,_0x4e7d6c){return function(_0x59bb9d){if(_0x59bb9d){return _0x59bb9d[_0x9fd5('0x26')](_0x17bc53)[_0x9fd5('0x27')](function(_0xf07d03){return _0xf07d03;});}return null;};}function removeEntity(_0x28c8dd,_0x45b97b){return function(_0x5cadef){if(_0x5cadef){return _0x5cadef[_0x9fd5('0x28')]()[_0x9fd5('0x27')](function(){var _0x1d9d77=_0x5cadef[_0x9fd5('0x29')]({'plain':!![]});var _0x379b8b=_0x9fd5('0x2a');return db[_0x9fd5('0x2b')][_0x9fd5('0x28')]({'where':{'type':_0x379b8b,'resourceId':_0x1d9d77['id']}})[_0x9fd5('0x27')](function(){return _0x5cadef;});})[_0x9fd5('0x27')](function(){_0x28c8dd[_0x9fd5('0x1c')](0xcc)[_0x9fd5('0x2c')]();});}};}function handleEntityNotFound(_0x420cc8,_0x2dc21a){return function(_0x2505eb){if(!_0x2505eb){_0x420cc8[_0x9fd5('0x1b')](0x194);}return _0x2505eb;};}function handleError(_0x11c260,_0x59d978){_0x59d978=_0x59d978||0x1f4;return function(_0x237c2d){logger['error'](_0x237c2d[_0x9fd5('0x2d')]);if(_0x237c2d[_0x9fd5('0x2e')]){delete _0x237c2d[_0x9fd5('0x2e')];}_0x11c260[_0x9fd5('0x1c')](_0x59d978)['send'](_0x237c2d);};}exports[_0x9fd5('0x2f')]=function(_0x4247a6,_0x117573){var _0x3910cf={},_0x4cb4e4={},_0xceb175={'count':0x0,'rows':[]};var _0x5a4aac=_[_0x9fd5('0x30')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x397df6){return{'name':_0x397df6[_0x9fd5('0x31')],'type':_0x397df6[_0x9fd5('0x32')]['key']};});_0x4cb4e4[_0x9fd5('0x33')]=_[_0x9fd5('0x30')](_0x5a4aac,_0x9fd5('0x2e'));_0x4cb4e4[_0x9fd5('0x34')]=_[_0x9fd5('0x35')](_0x4247a6['query']);_0x4cb4e4[_0x9fd5('0x36')]=_[_0x9fd5('0x37')](_0x4cb4e4[_0x9fd5('0x33')],_0x4cb4e4[_0x9fd5('0x34')]);_0x3910cf[_0x9fd5('0x38')]=_[_0x9fd5('0x37')](_0x4cb4e4[_0x9fd5('0x33')],qs[_0x9fd5('0x39')](_0x4247a6[_0x9fd5('0x34')]['fields']));_0x3910cf[_0x9fd5('0x38')]=_0x3910cf['attributes'][_0x9fd5('0x3a')]?_0x3910cf[_0x9fd5('0x38')]:_0x4cb4e4[_0x9fd5('0x33')];if(!_0x4247a6[_0x9fd5('0x34')][_0x9fd5('0x3b')](_0x9fd5('0x3c'))){_0x3910cf[_0x9fd5('0x1f')]=qs[_0x9fd5('0x1f')](_0x4247a6[_0x9fd5('0x34')][_0x9fd5('0x1f')]);_0x3910cf[_0x9fd5('0x1e')]=qs[_0x9fd5('0x1e')](_0x4247a6[_0x9fd5('0x34')][_0x9fd5('0x1e')]);}_0x3910cf[_0x9fd5('0x3d')]=qs['sort'](_0x4247a6[_0x9fd5('0x34')][_0x9fd5('0x3e')]);_0x3910cf[_0x9fd5('0x3f')]=qs['filters'](_[_0x9fd5('0x40')](_0x4247a6[_0x9fd5('0x34')],_0x4cb4e4[_0x9fd5('0x36')]),_0x5a4aac);if(_0x4247a6[_0x9fd5('0x34')]['filter']){_0x3910cf[_0x9fd5('0x3f')]=_[_0x9fd5('0x41')](_0x3910cf['where'],{'$or':_[_0x9fd5('0x30')](_0x5a4aac,function(_0x5d7040){if(_0x5d7040[_0x9fd5('0x32')]!=='VIRTUAL'){var _0x5e5228={};_0x5e5228[_0x5d7040[_0x9fd5('0x2e')]]={'$like':'%'+_0x4247a6[_0x9fd5('0x34')][_0x9fd5('0x42')]+'%'};return _0x5e5228;}})});}_0x3910cf=_[_0x9fd5('0x41')]({},_0x3910cf,_0x4247a6[_0x9fd5('0x43')]);var _0xad78db={'where':_0x3910cf[_0x9fd5('0x3f')]};return db[_0x9fd5('0x44')][_0x9fd5('0x21')](_0xad78db)[_0x9fd5('0x27')](function(_0x320d9d){_0xceb175['count']=_0x320d9d;if(_0x4247a6['query'][_0x9fd5('0x45')]){_0x3910cf[_0x9fd5('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x9fd5('0x47')](_0x3910cf);})[_0x9fd5('0x27')](function(_0x26061d){_0xceb175['rows']=_0x26061d;return _0xceb175;})[_0x9fd5('0x27')](respondWithFilteredResult(_0x117573,_0x3910cf))[_0x9fd5('0x48')](handleError(_0x117573,null));};exports[_0x9fd5('0x49')]=function(_0x11e157,_0x37f46c){var _0x10b5c2={'raw':!![],'where':{'id':_0x11e157['params']['id']}},_0x1d411f={};_0x1d411f[_0x9fd5('0x33')]=_[_0x9fd5('0x35')](db['AnalyticExtractedReport']['rawAttributes']);_0x1d411f['query']=_[_0x9fd5('0x35')](_0x11e157[_0x9fd5('0x34')]);_0x1d411f[_0x9fd5('0x36')]=_['intersection'](_0x1d411f[_0x9fd5('0x33')],_0x1d411f[_0x9fd5('0x34')]);_0x10b5c2['attributes']=_[_0x9fd5('0x37')](_0x1d411f[_0x9fd5('0x33')],qs[_0x9fd5('0x39')](_0x11e157['query'][_0x9fd5('0x39')]));_0x10b5c2[_0x9fd5('0x38')]=_0x10b5c2[_0x9fd5('0x38')][_0x9fd5('0x3a')]?_0x10b5c2[_0x9fd5('0x38')]:_0x1d411f[_0x9fd5('0x33')];if(_0x11e157[_0x9fd5('0x34')][_0x9fd5('0x45')]){_0x10b5c2[_0x9fd5('0x46')]=[{'all':!![]}];}_0x10b5c2=_['merge']({},_0x10b5c2,_0x11e157['options']);return db[_0x9fd5('0x44')]['find'](_0x10b5c2)[_0x9fd5('0x27')](handleEntityNotFound(_0x37f46c,null))[_0x9fd5('0x27')](respondWithResult(_0x37f46c,null))['catch'](handleError(_0x37f46c,null));};exports[_0x9fd5('0x4a')]=function(_0x534479,_0x343180){return db[_0x9fd5('0x44')]['create'](_0x534479[_0x9fd5('0x4b')],{})[_0x9fd5('0x27')](function(_0x1c2ae1){var _0x32f5b3=_0x534479[_0x9fd5('0x4c')]['get']({'plain':!![]});if(!_0x32f5b3)throw new Error(_0x9fd5('0x4d'));if(_0x32f5b3[_0x9fd5('0x4e')]===_0x9fd5('0x4c')){var _0x1f1cb4=_0x1c2ae1[_0x9fd5('0x29')]({'plain':!![]});var _0xc9ec1e=_0x9fd5('0x2a');return db[_0x9fd5('0x4f')]['find']({'where':{'name':_0xc9ec1e,'userProfileId':_0x32f5b3[_0x9fd5('0x50')]},'raw':!![]})[_0x9fd5('0x27')](function(_0x5ba2d8){if(_0x5ba2d8&&_0x5ba2d8[_0x9fd5('0x51')]===0x0){return db['UserProfileResource'][_0x9fd5('0x4a')]({'name':_0x1f1cb4[_0x9fd5('0x2e')],'resourceId':_0x1f1cb4['id'],'type':_0x5ba2d8['name'],'sectionId':_0x5ba2d8['id']},{})['then'](function(){return _0x1c2ae1;});}else{return _0x1c2ae1;}})[_0x9fd5('0x48')](function(_0x3227ef){logger[_0x9fd5('0x52')](_0x9fd5('0x53'),_0x3227ef);throw _0x3227ef;});}return _0x1c2ae1;})[_0x9fd5('0x27')](respondWithResult(_0x343180,0xc9))[_0x9fd5('0x48')](handleError(_0x343180,null));};exports['update']=function(_0x4e7eab,_0x231cd0){if(_0x4e7eab[_0x9fd5('0x4b')]['id']){delete _0x4e7eab['body']['id'];}return db[_0x9fd5('0x44')]['find']({'where':{'id':_0x4e7eab['params']['id']}})[_0x9fd5('0x27')](handleEntityNotFound(_0x231cd0,null))['then'](saveUpdates(_0x4e7eab['body'],null))['then'](respondWithResult(_0x231cd0,null))[_0x9fd5('0x48')](handleError(_0x231cd0,null));};exports['destroy']=function(_0x481584,_0x324206){return db[_0x9fd5('0x44')][_0x9fd5('0x54')]({'where':{'id':_0x481584[_0x9fd5('0x55')]['id']}})[_0x9fd5('0x27')](handleEntityNotFound(_0x324206,null))[_0x9fd5('0x27')](removeEntity(_0x324206,null))['catch'](handleError(_0x324206,null));};exports[_0x9fd5('0x56')]=function(_0x890360,_0x17e1a9,_0x574f1d){return db[_0x9fd5('0x44')][_0x9fd5('0x54')]({'where':{'id':_0x890360['params']['id']},'attributes':[_0x9fd5('0x2e'),_0x9fd5('0x57'),_0x9fd5('0x58'),_0x9fd5('0x59')],'raw':!![]})[_0x9fd5('0x27')](handleEntityNotFound(_0x17e1a9,null))[_0x9fd5('0x27')](function(_0x1c4fa0){if(_0x1c4fa0){if(!fs[_0x9fd5('0x5a')](path[_0x9fd5('0x5b')](config['root'],'server/files/reports',_0x1c4fa0[_0x9fd5('0x58')]))){throw new db['Sequelize'][(_0x9fd5('0x5c'))](_0x9fd5('0x5d'));}if(_0x890360['query'][_0x9fd5('0x5e')]){return _0x17e1a9[_0x9fd5('0x1b')](0xc8);}return _0x17e1a9[_0x9fd5('0x56')](path[_0x9fd5('0x5b')](config['root'],_0x9fd5('0x5f'),_0x1c4fa0[_0x9fd5('0x58')]),util[_0x9fd5('0x60')](_0x9fd5('0x61'),_0x1c4fa0['basename']||_0x1c4fa0[_0x9fd5('0x2e')],_0x1c4fa0[_0x9fd5('0x59')]['toLowerCase']()));}})['catch'](handleError(_0x17e1a9,null));}; \ No newline at end of file +var _0xd25e=['offset','undefined','limit','count','Content-Range','json','apply','save','then','get','ExtractedReports','destroy','error','stack','name','map','AnalyticExtractedReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','length','find','catch','create','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x237bf7,_0xb851fc){var _0x5928ba=function(_0x14c0d0){while(--_0x14c0d0){_0x237bf7['push'](_0x237bf7['shift']());}};_0x5928ba(++_0xb851fc);}(_0xd25e,0x1c3));var _0xed25=function(_0x4eb4b0,_0x27c635){_0x4eb4b0=_0x4eb4b0-0x0;var _0x4209c9=_0xd25e[_0x4eb4b0];return _0x4209c9;};'use strict';var emlformat=require(_0xed25('0x0'));var rimraf=require(_0xed25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed25('0x2'));var rp=require(_0xed25('0x3'));var moment=require(_0xed25('0x4'));var BPromise=require(_0xed25('0x5'));var Mustache=require(_0xed25('0x6'));var util=require(_0xed25('0x7'));var path=require(_0xed25('0x8'));var sox=require(_0xed25('0x9'));var csv=require('to-csv');var ejs=require(_0xed25('0xa'));var fs=require('fs');var fs_extra=require(_0xed25('0xb'));var _=require('lodash');var squel=require(_0xed25('0xc'));var crypto=require(_0xed25('0xd'));var jsforce=require(_0xed25('0xe'));var deskjs=require(_0xed25('0xf'));var toCsv=require(_0xed25('0x10'));var querystring=require(_0xed25('0x11'));var Papa=require(_0xed25('0x12'));var Redis=require(_0xed25('0x13'));var authService=require(_0xed25('0x14'));var qs=require(_0xed25('0x15'));var as=require(_0xed25('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed25('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xed25('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xed25('0x19'))['db'];function respondWithStatusCode(_0xaee3b5,_0x231a75){_0x231a75=_0x231a75||0xcc;return function(_0x303081){if(_0x303081){return _0xaee3b5[_0xed25('0x1a')](_0x231a75);}return _0xaee3b5[_0xed25('0x1b')](_0x231a75)[_0xed25('0x1c')]();};}function respondWithResult(_0x47b11e,_0x26ef59){_0x26ef59=_0x26ef59||0xc8;return function(_0x27781c){if(_0x27781c){return _0x47b11e[_0xed25('0x1b')](_0x26ef59)['json'](_0x27781c);}};}function respondWithFilteredResult(_0x427b37,_0x47771b){return function(_0x3238fb){if(_0x3238fb){var _0x377e29=typeof _0x47771b[_0xed25('0x1d')]===_0xed25('0x1e')&&typeof _0x47771b[_0xed25('0x1f')]==='undefined';var _0xe43e3b=_0x3238fb[_0xed25('0x20')];var _0x3bc551=_0x377e29?0x0:_0x47771b[_0xed25('0x1d')];var _0x324f30=_0x377e29?_0x3238fb['count']:_0x47771b[_0xed25('0x1d')]+_0x47771b[_0xed25('0x1f')];var _0x2e7ee3;if(_0x324f30>=_0xe43e3b){_0x324f30=_0xe43e3b;_0x2e7ee3=0xc8;}else{_0x2e7ee3=0xce;}_0x427b37[_0xed25('0x1b')](_0x2e7ee3);return _0x427b37['set'](_0xed25('0x21'),_0x3bc551+'-'+_0x324f30+'/'+_0xe43e3b)[_0xed25('0x22')](_0x3238fb);}return null;};}function patchUpdates(_0x5bdff5){return function(_0x20a589){try{jsonpatch[_0xed25('0x23')](_0x20a589,_0x5bdff5,!![]);}catch(_0x60060f){return BPromise['reject'](_0x60060f);}return _0x20a589[_0xed25('0x24')]();};}function saveUpdates(_0x5d6133,_0x2aba00){return function(_0x499368){if(_0x499368){return _0x499368['update'](_0x5d6133)['then'](function(_0x1c6ce4){return _0x1c6ce4;});}return null;};}function removeEntity(_0x5a55ea,_0x11c7f4){return function(_0x392de7){if(_0x392de7){return _0x392de7['destroy']()[_0xed25('0x25')](function(){var _0x12e3f=_0x392de7[_0xed25('0x26')]({'plain':!![]});var _0x499943=_0xed25('0x27');return db['UserProfileResource'][_0xed25('0x28')]({'where':{'type':_0x499943,'resourceId':_0x12e3f['id']}})['then'](function(){return _0x392de7;});})[_0xed25('0x25')](function(){_0x5a55ea[_0xed25('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13173c,_0x5ea7eb){return function(_0x51da28){if(!_0x51da28){_0x13173c[_0xed25('0x1a')](0x194);}return _0x51da28;};}function handleError(_0x130b6c,_0x3aae3a){_0x3aae3a=_0x3aae3a||0x1f4;return function(_0x186e5c){logger[_0xed25('0x29')](_0x186e5c[_0xed25('0x2a')]);if(_0x186e5c[_0xed25('0x2b')]){delete _0x186e5c[_0xed25('0x2b')];}_0x130b6c[_0xed25('0x1b')](_0x3aae3a)['send'](_0x186e5c);};}exports['index']=function(_0x45b95b,_0x224c8e){var _0x26a14f={},_0x276a6a={},_0x3418f9={'count':0x0,'rows':[]};var _0xfb157c=_[_0xed25('0x2c')](db[_0xed25('0x2d')]['rawAttributes'],function(_0x27de92){return{'name':_0x27de92[_0xed25('0x2e')],'type':_0x27de92[_0xed25('0x2f')][_0xed25('0x30')]};});_0x276a6a[_0xed25('0x31')]=_[_0xed25('0x2c')](_0xfb157c,_0xed25('0x2b'));_0x276a6a['query']=_[_0xed25('0x32')](_0x45b95b[_0xed25('0x33')]);_0x276a6a['filters']=_[_0xed25('0x34')](_0x276a6a[_0xed25('0x31')],_0x276a6a[_0xed25('0x33')]);_0x26a14f[_0xed25('0x35')]=_['intersection'](_0x276a6a[_0xed25('0x31')],qs[_0xed25('0x36')](_0x45b95b[_0xed25('0x33')][_0xed25('0x36')]));_0x26a14f['attributes']=_0x26a14f['attributes']['length']?_0x26a14f[_0xed25('0x35')]:_0x276a6a[_0xed25('0x31')];if(!_0x45b95b['query'][_0xed25('0x37')](_0xed25('0x38'))){_0x26a14f[_0xed25('0x1f')]=qs[_0xed25('0x1f')](_0x45b95b[_0xed25('0x33')]['limit']);_0x26a14f[_0xed25('0x1d')]=qs[_0xed25('0x1d')](_0x45b95b[_0xed25('0x33')][_0xed25('0x1d')]);}_0x26a14f[_0xed25('0x39')]=qs[_0xed25('0x3a')](_0x45b95b[_0xed25('0x33')]['sort']);_0x26a14f[_0xed25('0x3b')]=qs[_0xed25('0x3c')](_[_0xed25('0x3d')](_0x45b95b[_0xed25('0x33')],_0x276a6a[_0xed25('0x3c')]),_0xfb157c);if(_0x45b95b[_0xed25('0x33')][_0xed25('0x3e')]){_0x26a14f[_0xed25('0x3b')]=_['merge'](_0x26a14f[_0xed25('0x3b')],{'$or':_[_0xed25('0x2c')](_0xfb157c,function(_0x270d82){if(_0x270d82[_0xed25('0x2f')]!==_0xed25('0x3f')){var _0x3fe677={};_0x3fe677[_0x270d82['name']]={'$like':'%'+_0x45b95b[_0xed25('0x33')][_0xed25('0x3e')]+'%'};return _0x3fe677;}})});}_0x26a14f=_[_0xed25('0x40')]({},_0x26a14f,_0x45b95b[_0xed25('0x41')]);var _0x145fef={'where':_0x26a14f[_0xed25('0x3b')]};return db[_0xed25('0x2d')][_0xed25('0x20')](_0x145fef)[_0xed25('0x25')](function(_0x30a543){_0x3418f9[_0xed25('0x20')]=_0x30a543;if(_0x45b95b[_0xed25('0x33')][_0xed25('0x42')]){_0x26a14f['include']=[{'all':!![]}];}return db[_0xed25('0x2d')][_0xed25('0x43')](_0x26a14f);})[_0xed25('0x25')](function(_0x43168b){_0x3418f9[_0xed25('0x44')]=_0x43168b;return _0x3418f9;})[_0xed25('0x25')](respondWithFilteredResult(_0x224c8e,_0x26a14f))['catch'](handleError(_0x224c8e,null));};exports[_0xed25('0x45')]=function(_0xb5b181,_0x2c501e){var _0x11dcb2={'raw':!![],'where':{'id':_0xb5b181['params']['id']}},_0x1dac52={};_0x1dac52['model']=_['keys'](db[_0xed25('0x2d')]['rawAttributes']);_0x1dac52['query']=_['keys'](_0xb5b181[_0xed25('0x33')]);_0x1dac52[_0xed25('0x3c')]=_[_0xed25('0x34')](_0x1dac52['model'],_0x1dac52[_0xed25('0x33')]);_0x11dcb2[_0xed25('0x35')]=_[_0xed25('0x34')](_0x1dac52['model'],qs[_0xed25('0x36')](_0xb5b181['query'][_0xed25('0x36')]));_0x11dcb2['attributes']=_0x11dcb2[_0xed25('0x35')][_0xed25('0x46')]?_0x11dcb2[_0xed25('0x35')]:_0x1dac52[_0xed25('0x31')];if(_0xb5b181[_0xed25('0x33')]['includeAll']){_0x11dcb2['include']=[{'all':!![]}];}_0x11dcb2=_[_0xed25('0x40')]({},_0x11dcb2,_0xb5b181[_0xed25('0x41')]);return db[_0xed25('0x2d')][_0xed25('0x47')](_0x11dcb2)[_0xed25('0x25')](handleEntityNotFound(_0x2c501e,null))[_0xed25('0x25')](respondWithResult(_0x2c501e,null))[_0xed25('0x48')](handleError(_0x2c501e,null));};exports[_0xed25('0x49')]=function(_0x1aa332,_0x3f8ec1){return db[_0xed25('0x2d')][_0xed25('0x49')](_0x1aa332['body'],{})[_0xed25('0x25')](function(_0x3f29a5){var _0x1f2352=_0x1aa332['user'][_0xed25('0x26')]({'plain':!![]});if(!_0x1f2352)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f2352[_0xed25('0x4a')]==='user'){var _0x3e8564=_0x3f29a5[_0xed25('0x26')]({'plain':!![]});var _0x5e9ae8=_0xed25('0x27');return db[_0xed25('0x4b')][_0xed25('0x47')]({'where':{'name':_0x5e9ae8,'userProfileId':_0x1f2352[_0xed25('0x4c')]},'raw':!![]})[_0xed25('0x25')](function(_0x37ec03){if(_0x37ec03&&_0x37ec03[_0xed25('0x4d')]===0x0){return db[_0xed25('0x4e')][_0xed25('0x49')]({'name':_0x3e8564[_0xed25('0x2b')],'resourceId':_0x3e8564['id'],'type':_0x37ec03[_0xed25('0x2b')],'sectionId':_0x37ec03['id']},{})[_0xed25('0x25')](function(){return _0x3f29a5;});}else{return _0x3f29a5;}})['catch'](function(_0x46702b){logger[_0xed25('0x29')](_0xed25('0x4f'),_0x46702b);throw _0x46702b;});}return _0x3f29a5;})['then'](respondWithResult(_0x3f8ec1,0xc9))[_0xed25('0x48')](handleError(_0x3f8ec1,null));};exports[_0xed25('0x50')]=function(_0x152145,_0x4cc127){if(_0x152145['body']['id']){delete _0x152145[_0xed25('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xed25('0x47')]({'where':{'id':_0x152145['params']['id']}})[_0xed25('0x25')](handleEntityNotFound(_0x4cc127,null))[_0xed25('0x25')](saveUpdates(_0x152145[_0xed25('0x51')],null))['then'](respondWithResult(_0x4cc127,null))['catch'](handleError(_0x4cc127,null));};exports[_0xed25('0x28')]=function(_0x3a28c6,_0x206078){return db['AnalyticExtractedReport'][_0xed25('0x47')]({'where':{'id':_0x3a28c6[_0xed25('0x52')]['id']}})[_0xed25('0x25')](handleEntityNotFound(_0x206078,null))[_0xed25('0x25')](removeEntity(_0x206078,null))['catch'](handleError(_0x206078,null));};exports[_0xed25('0x53')]=function(_0x43704c,_0x55f662,_0x3eb282){return db[_0xed25('0x2d')]['find']({'where':{'id':_0x43704c[_0xed25('0x52')]['id']},'attributes':[_0xed25('0x2b'),_0xed25('0x54'),_0xed25('0x55'),_0xed25('0x56')],'raw':!![]})[_0xed25('0x25')](handleEntityNotFound(_0x55f662,null))[_0xed25('0x25')](function(_0xb7a3b){if(_0xb7a3b){if(!fs[_0xed25('0x57')](path[_0xed25('0x58')](config[_0xed25('0x59')],'server/files/reports',_0xb7a3b[_0xed25('0x55')]))){throw new db[(_0xed25('0x5a'))][(_0xed25('0x5b'))](_0xed25('0x5c'));}if(_0x43704c['query'][_0xed25('0x5d')]){return _0x55f662['sendStatus'](0xc8);}return _0x55f662[_0xed25('0x53')](path[_0xed25('0x58')](config[_0xed25('0x59')],_0xed25('0x5e'),_0xb7a3b[_0xed25('0x55')]),util[_0xed25('0x5f')]('%s.%s',_0xb7a3b[_0xed25('0x54')]||_0xb7a3b[_0xed25('0x2b')],_0xb7a3b['output']['toLowerCase']()));}})[_0xed25('0x48')](handleError(_0x55f662,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4cfc14c..860f4c2 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 _0x9970=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api'];(function(_0x85e29d,_0x9a1e60){var _0x351b9e=function(_0x2b7457){while(--_0x2b7457){_0x85e29d['push'](_0x85e29d['shift']());}};_0x351b9e(++_0x9a1e60);}(_0x9970,0x8c));var _0x0997=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9970[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0997('0x0'));var util=require('util');var logger=require(_0x0997('0x1'))(_0x0997('0x2'));var moment=require(_0x0997('0x3'));var BPromise=require(_0x0997('0x4'));var rp=require(_0x0997('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0997('0x6'));var config=require(_0x0997('0x7'));var attributes=require(_0x0997('0x8'));module[_0x0997('0x9')]=function(_0x411da7,_0x1e98b7){return _0x411da7[_0x0997('0xa')](_0x0997('0xb'),attributes,{'tableName':_0x0997('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90c3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90c3,0xdb));var _0x390c=function(_0x3b06a5,_0xbbecbb){_0x3b06a5=_0x3b06a5-0x0;var _0x9ea4ea=_0x90c3[_0x3b06a5];return _0x9ea4ea;};'use strict';var _=require(_0x390c('0x0'));var util=require(_0x390c('0x1'));var logger=require(_0x390c('0x2'))('api');var moment=require(_0x390c('0x3'));var BPromise=require(_0x390c('0x4'));var rp=require(_0x390c('0x5'));var fs=require('fs');var path=require(_0x390c('0x6'));var rimraf=require(_0x390c('0x7'));var config=require(_0x390c('0x8'));var attributes=require(_0x390c('0x9'));module[_0x390c('0xa')]=function(_0x456e06,_0x51eeca){return _0x456e06['define'](_0x390c('0xb'),attributes,{'tableName':_0x390c('0xc'),'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 cf2842f..e68d029 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 _0x2dac=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x2bc186,_0x3a4e44){var _0x30a0c4=function(_0x32a129){while(--_0x32a129){_0x2bc186['push'](_0x2bc186['shift']());}};_0x30a0c4(++_0x3a4e44);}(_0x2dac,0x98));var _0xc2da=function(_0x31d636,_0x11a8cf){_0x31d636=_0x31d636-0x0;var _0x3a5382=_0x2dac[_0x31d636];return _0x3a5382;};'use strict';var _=require(_0xc2da('0x0'));var util=require(_0xc2da('0x1'));var moment=require('moment');var BPromise=require(_0xc2da('0x2'));var rs=require(_0xc2da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2da('0x4'))['db'];var utils=require(_0xc2da('0x5'));var logger=require(_0xc2da('0x6'))('rpc');var config=require(_0xc2da('0x7'));var jayson=require(_0xc2da('0x8'));var client=jayson[_0xc2da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x794d4c,_0x2c04b7,_0x430061){return new BPromise(function(_0x5ddb53,_0x5765fe){return client['request'](_0x794d4c,_0x430061)[_0xc2da('0xa')](function(_0x4e8a99){logger[_0xc2da('0xb')](_0xc2da('0xc'),_0x2c04b7,_0xc2da('0xd'));logger[_0xc2da('0xe')](_0xc2da('0xf'),_0x2c04b7,_0xc2da('0xd'),JSON['stringify'](_0x4e8a99));if(_0x4e8a99[_0xc2da('0x10')]){if(_0x4e8a99[_0xc2da('0x10')][_0xc2da('0x11')]===0x1f4){logger[_0xc2da('0x10')](_0xc2da('0xc'),_0x2c04b7,_0x4e8a99[_0xc2da('0x10')][_0xc2da('0x12')]);return _0x5765fe(_0x4e8a99[_0xc2da('0x10')][_0xc2da('0x12')]);}logger[_0xc2da('0x10')](_0xc2da('0xc'),_0x2c04b7,_0x4e8a99[_0xc2da('0x10')]['message']);return _0x5ddb53(_0x4e8a99[_0xc2da('0x10')][_0xc2da('0x12')]);}else{logger[_0xc2da('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2c04b7,'request\x20sent');_0x5ddb53(_0x4e8a99[_0xc2da('0x13')][_0xc2da('0x12')]);}})[_0xc2da('0x14')](function(_0x165434){logger[_0xc2da('0x10')](_0xc2da('0xc'),_0x2c04b7,_0x165434);_0x5765fe(_0x165434);});});} \ No newline at end of file +var _0x7b21=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x496af1,_0x2d5f59){var _0x5700b3=function(_0x4e346a){while(--_0x4e346a){_0x496af1['push'](_0x496af1['shift']());}};_0x5700b3(++_0x2d5f59);}(_0x7b21,0x159));var _0x17b2=function(_0x339852,_0x717220){_0x339852=_0x339852-0x0;var _0x734c8c=_0x7b21[_0x339852];return _0x734c8c;};'use strict';var _=require(_0x17b2('0x0'));var util=require(_0x17b2('0x1'));var moment=require('moment');var BPromise=require(_0x17b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17b2('0x3'))['db'];var utils=require(_0x17b2('0x4'));var logger=require(_0x17b2('0x5'))(_0x17b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17b2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x252018,_0x225614,_0x24d9b5){return new BPromise(function(_0x2b80df,_0x38c9e9){return client[_0x17b2('0x8')](_0x252018,_0x24d9b5)[_0x17b2('0x9')](function(_0x38fd92){logger[_0x17b2('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x225614,'request\x20sent');logger['debug'](_0x17b2('0xb'),_0x225614,_0x17b2('0xc'),JSON['stringify'](_0x38fd92));if(_0x38fd92[_0x17b2('0xd')]){if(_0x38fd92[_0x17b2('0xd')][_0x17b2('0xe')]===0x1f4){logger['error'](_0x17b2('0xf'),_0x225614,_0x38fd92[_0x17b2('0xd')]['message']);return _0x38c9e9(_0x38fd92[_0x17b2('0xd')][_0x17b2('0x10')]);}logger[_0x17b2('0xd')](_0x17b2('0xf'),_0x225614,_0x38fd92[_0x17b2('0xd')][_0x17b2('0x10')]);return _0x2b80df(_0x38fd92['error'][_0x17b2('0x10')]);}else{logger[_0x17b2('0xa')](_0x17b2('0xf'),_0x225614,_0x17b2('0xc'));_0x2b80df(_0x38fd92[_0x17b2('0x11')][_0x17b2('0x10')]);}})[_0x17b2('0x12')](function(_0x953e8a){logger[_0x17b2('0xd')](_0x17b2('0xf'),_0x225614,_0x953e8a);_0x38c9e9(_0x953e8a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 76cc56c..768450d 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 _0x688c=['/:id/download','download','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show'];(function(_0x4fab3f,_0x5b0e8a){var _0x27364e=function(_0x4fa9f0){while(--_0x4fa9f0){_0x4fab3f['push'](_0x4fab3f['shift']());}};_0x27364e(++_0x5b0e8a);}(_0x688c,0x97));var _0xc688=function(_0x55fc12,_0x2ed9e4){_0x55fc12=_0x55fc12-0x0;var _0x272887=_0x688c[_0x55fc12];return _0x272887;};'use strict';var multer=require(_0xc688('0x0'));var util=require('util');var path=require(_0xc688('0x1'));var timeout=require(_0xc688('0x2'));var express=require(_0xc688('0x3'));var router=express[_0xc688('0x4')]();var fs_extra=require(_0xc688('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc688('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xc688('0x7')]('/',auth[_0xc688('0x8')](),controller[_0xc688('0x9')]);router[_0xc688('0x7')]('/:id',auth[_0xc688('0x8')](),controller[_0xc688('0xa')]);router['get'](_0xc688('0xb'),auth['isAuthenticated'](),controller[_0xc688('0xc')]);router['post']('/',auth[_0xc688('0x8')](),controller['create']);router['put']('/:id',auth[_0xc688('0x8')](),controller[_0xc688('0xd')]);router[_0xc688('0xe')](_0xc688('0xf'),auth['isAuthenticated'](),controller[_0xc688('0x10')]);module[_0xc688('0x11')]=router; \ No newline at end of file +var _0xea0b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','put','delete'];(function(_0x3ce7ff,_0xa8ff6){var _0x634f0d=function(_0x1e2a78){while(--_0x1e2a78){_0x3ce7ff['push'](_0x3ce7ff['shift']());}};_0x634f0d(++_0xa8ff6);}(_0xea0b,0x18e));var _0xbea0=function(_0xda8f94,_0xba9150){_0xda8f94=_0xda8f94-0x0;var _0x5ef241=_0xea0b[_0xda8f94];return _0x5ef241;};'use strict';var multer=require(_0xbea0('0x0'));var util=require('util');var path=require(_0xbea0('0x1'));var timeout=require(_0xbea0('0x2'));var express=require(_0xbea0('0x3'));var router=express[_0xbea0('0x4')]();var fs_extra=require(_0xbea0('0x5'));var auth=require(_0xbea0('0x6'));var interaction=require(_0xbea0('0x7'));var config=require(_0xbea0('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xbea0('0x9')]('/',auth[_0xbea0('0xa')](),controller[_0xbea0('0xb')]);router[_0xbea0('0x9')](_0xbea0('0xc'),auth[_0xbea0('0xa')](),controller['show']);router[_0xbea0('0x9')]('/:id/download',auth[_0xbea0('0xa')](),controller[_0xbea0('0xd')]);router['post']('/',auth[_0xbea0('0xa')](),controller['create']);router[_0xbea0('0xe')]('/:id',auth[_0xbea0('0xa')](),controller['update']);router[_0xbea0('0xf')](_0xbea0('0xc'),auth[_0xbea0('0xa')](),controller[_0xbea0('0x10')]);module[_0xbea0('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 791c484..3df8881 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 _0x057c=['exports','STRING','BOOLEAN'];(function(_0xcc4dda,_0x149272){var _0x22aec3=function(_0x32c947){while(--_0x32c947){_0xcc4dda['push'](_0xcc4dda['shift']());}};_0x22aec3(++_0x149272);}(_0x057c,0x1e9));var _0xc057=function(_0x141bd8,_0xde2cfa){_0x141bd8=_0x141bd8-0x0;var _0x343827=_0x057c[_0x141bd8];return _0x343827;};'use strict';var Sequelize=require('sequelize');module[_0xc057('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xc057('0x1')]},'function':{'type':Sequelize[_0xc057('0x1')]},'format':{'type':Sequelize[_0xc057('0x1')]},'groupBy':{'type':Sequelize[_0xc057('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc057('0x1')]},'custom':{'type':Sequelize[_0xc057('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7864=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1fa4c8,_0x5d9c19){var _0x1cb245=function(_0x5acc86){while(--_0x5acc86){_0x1fa4c8['push'](_0x1fa4c8['shift']());}};_0x1cb245(++_0x5d9c19);}(_0x7864,0x9e));var _0x4786=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x7864[_0x5d80de];return _0x1c7556;};'use strict';var Sequelize=require(_0x4786('0x0'));module[_0x4786('0x1')]={'field':{'type':Sequelize[_0x4786('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x4786('0x3')]},'format':{'type':Sequelize[_0x4786('0x3')]},'groupBy':{'type':Sequelize[_0x4786('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4786('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 637e2a7..b392c3c 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 _0x7913=['pick','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','bulkCreate','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0xc3583b,_0x3edf7a){var _0x19bc79=function(_0x2b68e1){while(--_0x2b68e1){_0xc3583b['push'](_0xc3583b['shift']());}};_0x19bc79(++_0x3edf7a);}(_0x7913,0xbb));var _0x3791=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7913[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3791('0x1'));var jsonpatch=require(_0x3791('0x2'));var rp=require(_0x3791('0x3'));var moment=require(_0x3791('0x4'));var BPromise=require(_0x3791('0x5'));var Mustache=require(_0x3791('0x6'));var util=require(_0x3791('0x7'));var path=require(_0x3791('0x8'));var sox=require('sox');var csv=require(_0x3791('0x9'));var ejs=require(_0x3791('0xa'));var fs=require('fs');var fs_extra=require(_0x3791('0xb'));var _=require('lodash');var squel=require(_0x3791('0xc'));var crypto=require('crypto');var jsforce=require(_0x3791('0xd'));var deskjs=require(_0x3791('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3791('0xf'));var Redis=require(_0x3791('0x10'));var authService=require(_0x3791('0x11'));var qs=require(_0x3791('0x12'));var as=require(_0x3791('0x13'));var hardwareService=require(_0x3791('0x14'));var logger=require('../../config/logger')(_0x3791('0x15'));var utils=require(_0x3791('0x16'));var config=require(_0x3791('0x17'));var licenseUtil=require(_0x3791('0x18'));var db=require(_0x3791('0x19'))['db'];function respondWithStatusCode(_0x3e3f98,_0x5c77f4){_0x5c77f4=_0x5c77f4||0xcc;return function(_0x245f09){if(_0x245f09){return _0x3e3f98[_0x3791('0x1a')](_0x5c77f4);}return _0x3e3f98[_0x3791('0x1b')](_0x5c77f4)[_0x3791('0x1c')]();};}function respondWithResult(_0x1e31a8,_0x53d540){_0x53d540=_0x53d540||0xc8;return function(_0x447974){if(_0x447974){return _0x1e31a8[_0x3791('0x1b')](_0x53d540)[_0x3791('0x1d')](_0x447974);}};}function respondWithFilteredResult(_0x5c2a1d,_0x22a87e){return function(_0x99049a){if(_0x99049a){var _0x4407f9=typeof _0x22a87e[_0x3791('0x1e')]===_0x3791('0x1f')&&typeof _0x22a87e[_0x3791('0x20')]===_0x3791('0x1f');var _0x50f445=_0x99049a['count'];var _0x578901=_0x4407f9?0x0:_0x22a87e[_0x3791('0x1e')];var _0x56cced=_0x4407f9?_0x99049a[_0x3791('0x21')]:_0x22a87e[_0x3791('0x1e')]+_0x22a87e[_0x3791('0x20')];var _0x5b75c9;if(_0x56cced>=_0x50f445){_0x56cced=_0x50f445;_0x5b75c9=0xc8;}else{_0x5b75c9=0xce;}_0x5c2a1d[_0x3791('0x1b')](_0x5b75c9);return _0x5c2a1d['set']('Content-Range',_0x578901+'-'+_0x56cced+'/'+_0x50f445)[_0x3791('0x1d')](_0x99049a);}return null;};}function patchUpdates(_0x28eb13){return function(_0x50f865){try{jsonpatch['apply'](_0x50f865,_0x28eb13,!![]);}catch(_0x264367){return BPromise[_0x3791('0x22')](_0x264367);}return _0x50f865['save']();};}function saveUpdates(_0x57dd3b,_0x5c7d02){return function(_0x5b14d7){if(_0x5b14d7){return _0x5b14d7[_0x3791('0x23')](_0x57dd3b)[_0x3791('0x24')](function(_0x2a4135){return _0x2a4135;});}return null;};}function removeEntity(_0x274975,_0x21943d){return function(_0x329511){if(_0x329511){return _0x329511['destroy']()['then'](function(){_0x274975[_0x3791('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100b1f,_0xd84eb7){return function(_0x3d2433){if(!_0x3d2433){_0x100b1f['sendStatus'](0x194);}return _0x3d2433;};}function handleError(_0x1c75fb,_0x505e09){_0x505e09=_0x505e09||0x1f4;return function(_0x5171c8){logger[_0x3791('0x25')](_0x5171c8[_0x3791('0x26')]);if(_0x5171c8[_0x3791('0x27')]){delete _0x5171c8['name'];}_0x1c75fb[_0x3791('0x1b')](_0x505e09)[_0x3791('0x28')](_0x5171c8);};}exports['index']=function(_0x1057dd,_0x34048e){var _0x3efa83={},_0x58df47={},_0x4cf376={'count':0x0,'rows':[]};var _0x4bd437=_[_0x3791('0x29')](db['AnalyticFieldReport'][_0x3791('0x2a')],function(_0x3c2a60){return{'name':_0x3c2a60[_0x3791('0x2b')],'type':_0x3c2a60[_0x3791('0x2c')]['key']};});_0x58df47[_0x3791('0x2d')]=_[_0x3791('0x29')](_0x4bd437,_0x3791('0x27'));_0x58df47[_0x3791('0x2e')]=_['keys'](_0x1057dd[_0x3791('0x2e')]);_0x58df47[_0x3791('0x2f')]=_['intersection'](_0x58df47['model'],_0x58df47[_0x3791('0x2e')]);_0x3efa83[_0x3791('0x30')]=_[_0x3791('0x31')](_0x58df47[_0x3791('0x2d')],qs[_0x3791('0x32')](_0x1057dd[_0x3791('0x2e')][_0x3791('0x32')]));_0x3efa83[_0x3791('0x30')]=_0x3efa83[_0x3791('0x30')][_0x3791('0x33')]?_0x3efa83[_0x3791('0x30')]:_0x58df47[_0x3791('0x2d')];if(!_0x1057dd[_0x3791('0x2e')][_0x3791('0x34')](_0x3791('0x35'))){_0x3efa83[_0x3791('0x20')]=qs[_0x3791('0x20')](_0x1057dd[_0x3791('0x2e')][_0x3791('0x20')]);_0x3efa83[_0x3791('0x1e')]=qs[_0x3791('0x1e')](_0x1057dd[_0x3791('0x2e')][_0x3791('0x1e')]);}_0x3efa83['order']=qs[_0x3791('0x36')](_0x1057dd[_0x3791('0x2e')][_0x3791('0x36')]);_0x3efa83[_0x3791('0x37')]=qs[_0x3791('0x2f')](_[_0x3791('0x38')](_0x1057dd['query'],_0x58df47['filters']),_0x4bd437);if(_0x1057dd['query']['filter']){_0x3efa83['where']=_[_0x3791('0x39')](_0x3efa83['where'],{'$or':_[_0x3791('0x29')](_0x4bd437,function(_0x582d17){if(_0x582d17[_0x3791('0x2c')]!==_0x3791('0x3a')){var _0x14316a={};_0x14316a[_0x582d17[_0x3791('0x27')]]={'$like':'%'+_0x1057dd[_0x3791('0x2e')][_0x3791('0x3b')]+'%'};return _0x14316a;}})});}_0x3efa83=_['merge']({},_0x3efa83,_0x1057dd[_0x3791('0x3c')]);var _0x350273={'where':_0x3efa83['where']};return db[_0x3791('0x3d')][_0x3791('0x21')](_0x350273)[_0x3791('0x24')](function(_0x12c4bb){_0x4cf376[_0x3791('0x21')]=_0x12c4bb;if(_0x1057dd[_0x3791('0x2e')][_0x3791('0x3e')]){_0x3efa83[_0x3791('0x3f')]=[{'all':!![]}];}return db[_0x3791('0x3d')][_0x3791('0x40')](_0x3efa83);})[_0x3791('0x24')](function(_0x3fe678){_0x4cf376[_0x3791('0x41')]=_0x3fe678;return _0x4cf376;})[_0x3791('0x24')](respondWithFilteredResult(_0x34048e,_0x3efa83))[_0x3791('0x42')](handleError(_0x34048e,null));};exports[_0x3791('0x43')]=function(_0x39890,_0x4d8a36){var _0x50cc43={'raw':![],'where':{'id':_0x39890[_0x3791('0x44')]['id']}},_0x4cd184={};_0x4cd184['model']=_['keys'](db[_0x3791('0x3d')][_0x3791('0x2a')]);_0x4cd184[_0x3791('0x2e')]=_[_0x3791('0x45')](_0x39890[_0x3791('0x2e')]);_0x4cd184[_0x3791('0x2f')]=_['intersection'](_0x4cd184[_0x3791('0x2d')],_0x4cd184[_0x3791('0x2e')]);_0x50cc43[_0x3791('0x30')]=_[_0x3791('0x31')](_0x4cd184[_0x3791('0x2d')],qs['fields'](_0x39890['query'][_0x3791('0x32')]));_0x50cc43[_0x3791('0x30')]=_0x50cc43['attributes'][_0x3791('0x33')]?_0x50cc43[_0x3791('0x30')]:_0x4cd184[_0x3791('0x2d')];if(_0x39890[_0x3791('0x2e')][_0x3791('0x3e')]){_0x50cc43['include']=[{'all':!![]}];}_0x50cc43=_[_0x3791('0x39')]({},_0x50cc43,_0x39890[_0x3791('0x3c')]);return db[_0x3791('0x3d')][_0x3791('0x46')](_0x50cc43)[_0x3791('0x24')](handleEntityNotFound(_0x4d8a36,null))[_0x3791('0x24')](respondWithResult(_0x4d8a36,null))['catch'](handleError(_0x4d8a36,null));};exports[_0x3791('0x47')]=function(_0x44094b,_0x38cdfa){return db[_0x3791('0x3d')][_0x3791('0x47')](_0x44094b['body'],{})[_0x3791('0x24')](respondWithResult(_0x38cdfa,0xc9))[_0x3791('0x42')](handleError(_0x38cdfa,null));};exports[_0x3791('0x48')]=function(_0xc2b51e,_0x5942bd){return db[_0x3791('0x3d')][_0x3791('0x48')](_0xc2b51e[_0x3791('0x49')],{'raw':![],'individualHooks':!![]})[_0x3791('0x24')](respondWithResult(_0x5942bd,0xc9))['catch'](handleError(_0x5942bd,null));};exports['update']=function(_0x52efea,_0x62dd77){if(_0x52efea[_0x3791('0x49')]['id']){delete _0x52efea[_0x3791('0x49')]['id'];}return db[_0x3791('0x3d')][_0x3791('0x46')]({'where':{'id':_0x52efea[_0x3791('0x44')]['id']}})['then'](handleEntityNotFound(_0x62dd77,null))['then'](saveUpdates(_0x52efea[_0x3791('0x49')],null))[_0x3791('0x24')](respondWithResult(_0x62dd77,null))[_0x3791('0x42')](handleError(_0x62dd77,null));};exports[_0x3791('0x4a')]=function(_0x3bec54,_0x3603fb){return db[_0x3791('0x3d')][_0x3791('0x46')]({'where':{'id':_0x3bec54['params']['id']}})[_0x3791('0x24')](handleEntityNotFound(_0x3603fb,null))[_0x3791('0x24')](removeEntity(_0x3603fb,null))[_0x3791('0x42')](handleError(_0x3603fb,null));};exports[_0x3791('0x4b')]=function(_0x1ebb7e,_0x192afc){return db[_0x3791('0x3d')][_0x3791('0x4a')]({'where':{'id':_0x1ebb7e[_0x3791('0x2e')][_0x3791('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x3791('0x24')](respondWithResult(_0x192afc,0xcc))['catch'](handleError(_0x192afc,null));};exports[_0x3791('0x4d')]=function(_0x58d13c,_0x236fa9,_0xb46aa3){return db[_0x3791('0x4e')]['findOne']({'where':{'id':_0x58d13c['params']['id']}})['then'](handleEntityNotFound(_0x236fa9,null))['then'](function(_0x15d606){if(_0x15d606){return db[_0x3791('0x4f')][_0x3791('0x50')](function(_0x547c04){return db['AnalyticFieldReport'][_0x3791('0x4a')]({'where':{'CustomReportId':_0x58d13c['params']['id']},'transaction':_0x547c04})[_0x3791('0x24')](function(_0x1edf26){var _0x2947a1=_[_0x3791('0x29')](_0x58d13c[_0x3791('0x49')],function(_0x3ad58e){delete _0x3ad58e['id'];_0x3ad58e['CustomReportId']=_0x58d13c[_0x3791('0x44')]['id'];return _0x3ad58e;});return db[_0x3791('0x3d')][_0x3791('0x48')](_0x2947a1,{'transaction':_0x547c04});});})['then'](function(){return db[_0x3791('0x3d')]['findAll']({'where':{'CustomReportId':_0x58d13c[_0x3791('0x44')]['id']}});});}})[_0x3791('0x24')](respondWithResult(_0x236fa9,null))[_0x3791('0x42')](handleError(_0x236fa9,null));}; \ No newline at end of file +var _0xc832=['transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','limit','undefined','count','status','set','apply','reject','save','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','fieldName','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','bulkCreate','body','update','ids','addFields','findOne','sequelize'];(function(_0x31c178,_0x4a428c){var _0x2d5a9f=function(_0x367641){while(--_0x367641){_0x31c178['push'](_0x31c178['shift']());}};_0x2d5a9f(++_0x4a428c);}(_0xc832,0x1e8));var _0x2c83=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xc832[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x2c83('0x0'));var rimraf=require(_0x2c83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c83('0x2'));var rp=require(_0x2c83('0x3'));var moment=require(_0x2c83('0x4'));var BPromise=require(_0x2c83('0x5'));var Mustache=require(_0x2c83('0x6'));var util=require(_0x2c83('0x7'));var path=require('path');var sox=require(_0x2c83('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c83('0x9'));var squel=require(_0x2c83('0xa'));var crypto=require(_0x2c83('0xb'));var jsforce=require(_0x2c83('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c83('0xd'));var Papa=require(_0x2c83('0xe'));var Redis=require(_0x2c83('0xf'));var authService=require(_0x2c83('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c83('0x11'));var logger=require('../../config/logger')(_0x2c83('0x12'));var utils=require(_0x2c83('0x13'));var config=require(_0x2c83('0x14'));var licenseUtil=require(_0x2c83('0x15'));var db=require(_0x2c83('0x16'))['db'];function respondWithStatusCode(_0x4000fd,_0x18a7e9){_0x18a7e9=_0x18a7e9||0xcc;return function(_0x70565a){if(_0x70565a){return _0x4000fd[_0x2c83('0x17')](_0x18a7e9);}return _0x4000fd['status'](_0x18a7e9)['end']();};}function respondWithResult(_0x48cc96,_0x40ac5c){_0x40ac5c=_0x40ac5c||0xc8;return function(_0x360ac1){if(_0x360ac1){return _0x48cc96['status'](_0x40ac5c)['json'](_0x360ac1);}};}function respondWithFilteredResult(_0x1569f0,_0x355838){return function(_0xe35370){if(_0xe35370){var _0x42135d=typeof _0x355838[_0x2c83('0x18')]==='undefined'&&typeof _0x355838[_0x2c83('0x19')]===_0x2c83('0x1a');var _0x5ef8dc=_0xe35370[_0x2c83('0x1b')];var _0x1a6883=_0x42135d?0x0:_0x355838['offset'];var _0x51fe17=_0x42135d?_0xe35370[_0x2c83('0x1b')]:_0x355838[_0x2c83('0x18')]+_0x355838[_0x2c83('0x19')];var _0x21fa0c;if(_0x51fe17>=_0x5ef8dc){_0x51fe17=_0x5ef8dc;_0x21fa0c=0xc8;}else{_0x21fa0c=0xce;}_0x1569f0[_0x2c83('0x1c')](_0x21fa0c);return _0x1569f0[_0x2c83('0x1d')]('Content-Range',_0x1a6883+'-'+_0x51fe17+'/'+_0x5ef8dc)['json'](_0xe35370);}return null;};}function patchUpdates(_0x515ce3){return function(_0x464bd8){try{jsonpatch[_0x2c83('0x1e')](_0x464bd8,_0x515ce3,!![]);}catch(_0x1252f8){return BPromise[_0x2c83('0x1f')](_0x1252f8);}return _0x464bd8[_0x2c83('0x20')]();};}function saveUpdates(_0x31190e,_0x3b13ed){return function(_0x54b5b7){if(_0x54b5b7){return _0x54b5b7['update'](_0x31190e)[_0x2c83('0x21')](function(_0x37e2b1){return _0x37e2b1;});}return null;};}function removeEntity(_0x1fd0cf,_0x410f27){return function(_0x2d8e39){if(_0x2d8e39){return _0x2d8e39[_0x2c83('0x22')]()['then'](function(){_0x1fd0cf[_0x2c83('0x1c')](0xcc)[_0x2c83('0x23')]();});}};}function handleEntityNotFound(_0x4918a1,_0x13a92d){return function(_0x48a11e){if(!_0x48a11e){_0x4918a1['sendStatus'](0x194);}return _0x48a11e;};}function handleError(_0x1a1770,_0x52edad){_0x52edad=_0x52edad||0x1f4;return function(_0x2e92c3){logger[_0x2c83('0x24')](_0x2e92c3['stack']);if(_0x2e92c3[_0x2c83('0x25')]){delete _0x2e92c3[_0x2c83('0x25')];}_0x1a1770[_0x2c83('0x1c')](_0x52edad)[_0x2c83('0x26')](_0x2e92c3);};}exports[_0x2c83('0x27')]=function(_0x21daf9,_0x3a6ce1){var _0x3c441c={},_0x25d800={},_0x40fdbb={'count':0x0,'rows':[]};var _0x2bfdbc=_[_0x2c83('0x28')](db[_0x2c83('0x29')]['rawAttributes'],function(_0x452af0){return{'name':_0x452af0[_0x2c83('0x2a')],'type':_0x452af0[_0x2c83('0x2b')]['key']};});_0x25d800['model']=_['map'](_0x2bfdbc,_0x2c83('0x25'));_0x25d800['query']=_['keys'](_0x21daf9[_0x2c83('0x2c')]);_0x25d800[_0x2c83('0x2d')]=_[_0x2c83('0x2e')](_0x25d800['model'],_0x25d800['query']);_0x3c441c[_0x2c83('0x2f')]=_[_0x2c83('0x2e')](_0x25d800[_0x2c83('0x30')],qs[_0x2c83('0x31')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x31')]));_0x3c441c['attributes']=_0x3c441c[_0x2c83('0x2f')]['length']?_0x3c441c['attributes']:_0x25d800[_0x2c83('0x30')];if(!_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x32')](_0x2c83('0x33'))){_0x3c441c['limit']=qs[_0x2c83('0x19')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x19')]);_0x3c441c['offset']=qs[_0x2c83('0x18')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x18')]);}_0x3c441c[_0x2c83('0x34')]=qs[_0x2c83('0x35')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x35')]);_0x3c441c[_0x2c83('0x36')]=qs[_0x2c83('0x2d')](_[_0x2c83('0x37')](_0x21daf9[_0x2c83('0x2c')],_0x25d800[_0x2c83('0x2d')]),_0x2bfdbc);if(_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x38')]){_0x3c441c['where']=_[_0x2c83('0x39')](_0x3c441c['where'],{'$or':_[_0x2c83('0x28')](_0x2bfdbc,function(_0xc9c0ef){if(_0xc9c0ef[_0x2c83('0x2b')]!==_0x2c83('0x3a')){var _0x1685c0={};_0x1685c0[_0xc9c0ef['name']]={'$like':'%'+_0x21daf9['query'][_0x2c83('0x38')]+'%'};return _0x1685c0;}})});}_0x3c441c=_[_0x2c83('0x39')]({},_0x3c441c,_0x21daf9[_0x2c83('0x3b')]);var _0x482be3={'where':_0x3c441c['where']};return db[_0x2c83('0x29')][_0x2c83('0x1b')](_0x482be3)[_0x2c83('0x21')](function(_0x2d36fd){_0x40fdbb[_0x2c83('0x1b')]=_0x2d36fd;if(_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x3c')]){_0x3c441c[_0x2c83('0x3d')]=[{'all':!![]}];}return db[_0x2c83('0x29')][_0x2c83('0x3e')](_0x3c441c);})[_0x2c83('0x21')](function(_0x52b7bc){_0x40fdbb[_0x2c83('0x3f')]=_0x52b7bc;return _0x40fdbb;})['then'](respondWithFilteredResult(_0x3a6ce1,_0x3c441c))[_0x2c83('0x40')](handleError(_0x3a6ce1,null));};exports[_0x2c83('0x41')]=function(_0x151520,_0x5ede27){var _0x324fd2={'raw':![],'where':{'id':_0x151520[_0x2c83('0x42')]['id']}},_0x27ea5e={};_0x27ea5e[_0x2c83('0x30')]=_[_0x2c83('0x43')](db[_0x2c83('0x29')][_0x2c83('0x44')]);_0x27ea5e[_0x2c83('0x2c')]=_['keys'](_0x151520[_0x2c83('0x2c')]);_0x27ea5e[_0x2c83('0x2d')]=_[_0x2c83('0x2e')](_0x27ea5e[_0x2c83('0x30')],_0x27ea5e['query']);_0x324fd2[_0x2c83('0x2f')]=_[_0x2c83('0x2e')](_0x27ea5e[_0x2c83('0x30')],qs[_0x2c83('0x31')](_0x151520['query']['fields']));_0x324fd2[_0x2c83('0x2f')]=_0x324fd2[_0x2c83('0x2f')][_0x2c83('0x45')]?_0x324fd2['attributes']:_0x27ea5e[_0x2c83('0x30')];if(_0x151520[_0x2c83('0x2c')][_0x2c83('0x3c')]){_0x324fd2[_0x2c83('0x3d')]=[{'all':!![]}];}_0x324fd2=_[_0x2c83('0x39')]({},_0x324fd2,_0x151520['options']);return db['AnalyticFieldReport'][_0x2c83('0x46')](_0x324fd2)[_0x2c83('0x21')](handleEntityNotFound(_0x5ede27,null))[_0x2c83('0x21')](respondWithResult(_0x5ede27,null))['catch'](handleError(_0x5ede27,null));};exports['create']=function(_0x466970,_0x87177c){return db[_0x2c83('0x29')][_0x2c83('0x47')](_0x466970['body'],{})['then'](respondWithResult(_0x87177c,0xc9))['catch'](handleError(_0x87177c,null));};exports[_0x2c83('0x48')]=function(_0xab3388,_0x49ccf4){return db['AnalyticFieldReport'][_0x2c83('0x48')](_0xab3388[_0x2c83('0x49')],{'raw':![],'individualHooks':!![]})[_0x2c83('0x21')](respondWithResult(_0x49ccf4,0xc9))[_0x2c83('0x40')](handleError(_0x49ccf4,null));};exports[_0x2c83('0x4a')]=function(_0x22fae2,_0x2314dc){if(_0x22fae2['body']['id']){delete _0x22fae2['body']['id'];}return db['AnalyticFieldReport'][_0x2c83('0x46')]({'where':{'id':_0x22fae2[_0x2c83('0x42')]['id']}})['then'](handleEntityNotFound(_0x2314dc,null))[_0x2c83('0x21')](saveUpdates(_0x22fae2[_0x2c83('0x49')],null))[_0x2c83('0x21')](respondWithResult(_0x2314dc,null))[_0x2c83('0x40')](handleError(_0x2314dc,null));};exports[_0x2c83('0x22')]=function(_0x4f290a,_0x488883){return db[_0x2c83('0x29')][_0x2c83('0x46')]({'where':{'id':_0x4f290a[_0x2c83('0x42')]['id']}})['then'](handleEntityNotFound(_0x488883,null))[_0x2c83('0x21')](removeEntity(_0x488883,null))[_0x2c83('0x40')](handleError(_0x488883,null));};exports['bulkDestroy']=function(_0x153320,_0x21bc93){return db['AnalyticFieldReport'][_0x2c83('0x22')]({'where':{'id':_0x153320['query'][_0x2c83('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x2c83('0x21')](respondWithResult(_0x21bc93,0xcc))[_0x2c83('0x40')](handleError(_0x21bc93,null));};exports[_0x2c83('0x4c')]=function(_0xa7d0cc,_0x96bf12,_0x3cd559){return db['AnalyticCustomReport'][_0x2c83('0x4d')]({'where':{'id':_0xa7d0cc['params']['id']}})[_0x2c83('0x21')](handleEntityNotFound(_0x96bf12,null))[_0x2c83('0x21')](function(_0x4b75d8){if(_0x4b75d8){return db[_0x2c83('0x4e')][_0x2c83('0x4f')](function(_0x50f3b2){return db[_0x2c83('0x29')][_0x2c83('0x22')]({'where':{'CustomReportId':_0xa7d0cc['params']['id']},'transaction':_0x50f3b2})[_0x2c83('0x21')](function(_0x34fa01){var _0x479037=_[_0x2c83('0x28')](_0xa7d0cc[_0x2c83('0x49')],function(_0x21ba86){delete _0x21ba86['id'];_0x21ba86[_0x2c83('0x50')]=_0xa7d0cc['params']['id'];return _0x21ba86;});return db['AnalyticFieldReport'][_0x2c83('0x48')](_0x479037,{'transaction':_0x50f3b2});});})[_0x2c83('0x21')](function(){return db[_0x2c83('0x29')][_0x2c83('0x3e')]({'where':{'CustomReportId':_0xa7d0cc[_0x2c83('0x42')]['id']}});});}})['then'](respondWithResult(_0x96bf12,null))[_0x2c83('0x40')](handleError(_0x96bf12,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1c8c389..6df9a70 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 _0x92db=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x14761d,_0x204fcc){var _0x8f69ee=function(_0x1fd266){while(--_0x1fd266){_0x14761d['push'](_0x14761d['shift']());}};_0x8f69ee(++_0x204fcc);}(_0x92db,0xa9));var _0xb92d=function(_0x492bb6,_0x3e67b2){_0x492bb6=_0x492bb6-0x0;var _0x18ea7e=_0x92db[_0x492bb6];return _0x18ea7e;};'use strict';var _=require(_0xb92d('0x0'));var util=require('util');var logger=require(_0xb92d('0x1'))('api');var moment=require(_0xb92d('0x2'));var BPromise=require(_0xb92d('0x3'));var rp=require(_0xb92d('0x4'));var fs=require('fs');var path=require(_0xb92d('0x5'));var rimraf=require(_0xb92d('0x6'));var config=require('../../config/environment');var attributes=require(_0xb92d('0x7'));module['exports']=function(_0x171822,_0x1b4bf4){return _0x171822[_0xb92d('0x8')](_0xb92d('0x9'),attributes,{'tableName':_0xb92d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f4=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0x5dce5a,_0x553e15){var _0x17fd57=function(_0x39055e){while(--_0x39055e){_0x5dce5a['push'](_0x5dce5a['shift']());}};_0x17fd57(++_0x553e15);}(_0x36f4,0x163));var _0x436f=function(_0x14cbd8,_0x4c86ed){_0x14cbd8=_0x14cbd8-0x0;var _0x305443=_0x36f4[_0x14cbd8];return _0x305443;};'use strict';var _=require(_0x436f('0x0'));var util=require(_0x436f('0x1'));var logger=require(_0x436f('0x2'))(_0x436f('0x3'));var moment=require(_0x436f('0x4'));var BPromise=require(_0x436f('0x5'));var rp=require(_0x436f('0x6'));var fs=require('fs');var path=require(_0x436f('0x7'));var rimraf=require(_0x436f('0x8'));var config=require(_0x436f('0x9'));var attributes=require(_0x436f('0xa'));module[_0x436f('0xb')]=function(_0x1c0dda,_0xa70d8a){return _0x1c0dda[_0x436f('0xc')](_0x436f('0xd'),attributes,{'tableName':_0x436f('0xe'),'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 63ca9be..267483a 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 _0x41a5=['code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4ab19d,_0x8be494){var _0x1c2201=function(_0x1dace2){while(--_0x1dace2){_0x4ab19d['push'](_0x4ab19d['shift']());}};_0x1c2201(++_0x8be494);}(_0x41a5,0x146));var _0x541a=function(_0x2185f9,_0x14aeb8){_0x2185f9=_0x2185f9-0x0;var _0x64f64d=_0x41a5[_0x2185f9];return _0x64f64d;};'use strict';var _=require('lodash');var util=require(_0x541a('0x0'));var moment=require(_0x541a('0x1'));var BPromise=require(_0x541a('0x2'));var rs=require(_0x541a('0x3'));var fs=require('fs');var Redis=require(_0x541a('0x4'));var db=require(_0x541a('0x5'))['db'];var utils=require(_0x541a('0x6'));var logger=require(_0x541a('0x7'))(_0x541a('0x8'));var config=require('../../config/environment');var jayson=require(_0x541a('0x9'));var client=jayson[_0x541a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1af9fd,_0x4ba24f,_0x1141a3){return new BPromise(function(_0x41a3a1,_0x412be6){return client[_0x541a('0xb')](_0x1af9fd,_0x1141a3)[_0x541a('0xc')](function(_0x51274d){logger[_0x541a('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));logger[_0x541a('0xf')](_0x541a('0x10'),_0x4ba24f,_0x541a('0xe'),JSON[_0x541a('0x11')](_0x51274d));if(_0x51274d[_0x541a('0x12')]){if(_0x51274d['error'][_0x541a('0x13')]===0x1f4){logger[_0x541a('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ba24f,_0x51274d[_0x541a('0x12')]['message']);return _0x412be6(_0x51274d[_0x541a('0x12')]['message']);}logger['error'](_0x541a('0x14'),_0x4ba24f,_0x51274d['error'][_0x541a('0x15')]);return _0x41a3a1(_0x51274d[_0x541a('0x12')][_0x541a('0x15')]);}else{logger[_0x541a('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));_0x41a3a1(_0x51274d['result'][_0x541a('0x15')]);}})[_0x541a('0x16')](function(_0x37d070){logger['error'](_0x541a('0x14'),_0x4ba24f,_0x37d070);_0x412be6(_0x37d070);});});} \ No newline at end of file +var _0x2316=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','ioredis'];(function(_0x574308,_0x447878){var _0x233bb4=function(_0x347814){while(--_0x347814){_0x574308['push'](_0x574308['shift']());}};_0x233bb4(++_0x447878);}(_0x2316,0xc4));var _0x6231=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x2316[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x6231('0x0'));var util=require(_0x6231('0x1'));var moment=require(_0x6231('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6231('0x3'));var db=require(_0x6231('0x4'))['db'];var utils=require(_0x6231('0x5'));var logger=require(_0x6231('0x6'))('rpc');var config=require(_0x6231('0x7'));var jayson=require(_0x6231('0x8'));var client=jayson[_0x6231('0x9')][_0x6231('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf63932,_0x89e20f,_0x16dec1){return new BPromise(function(_0x9abe76,_0x5a7117){return client[_0x6231('0xb')](_0xf63932,_0x16dec1)[_0x6231('0xc')](function(_0x3f2994){logger['info'](_0x6231('0xd'),_0x89e20f,'request\x20sent');logger[_0x6231('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x89e20f,_0x6231('0xf'),JSON['stringify'](_0x3f2994));if(_0x3f2994[_0x6231('0x10')]){if(_0x3f2994[_0x6231('0x10')][_0x6231('0x11')]===0x1f4){logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);return _0x5a7117(_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);}logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);return _0x9abe76(_0x3f2994[_0x6231('0x10')]['message']);}else{logger[_0x6231('0x13')](_0x6231('0xd'),_0x89e20f,_0x6231('0xf'));_0x9abe76(_0x3f2994['result']['message']);}})['catch'](function(_0x196ac7){logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x196ac7);_0x5a7117(_0x196ac7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0230ec8..a12ca20 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(_0x591dd7,_0xfc74e4){var _0xc384bd=function(_0x3fb04c){while(--_0x3fb04c){_0x591dd7['push'](_0x591dd7['shift']());}};_0xc384bd(++_0xfc74e4);}(_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['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(_0x51c87e,_0x5dc3ea){var _0x38da34=function(_0x5cb9e5){while(--_0x5cb9e5){_0x51c87e['push'](_0x51c87e['shift']());}};_0x38da34(++_0x5dc3ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 255db96..43d3b00 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 _0xbb95=['exports','STRING','TEXT','sequelize'];(function(_0x5733f7,_0x1080f3){var _0x16de42=function(_0x519a3f){while(--_0x519a3f){_0x5733f7['push'](_0x5733f7['shift']());}};_0x16de42(++_0x1080f3);}(_0xbb95,0x7f));var _0x5bb9=function(_0x5ce7e2,_0x8dd5de){_0x5ce7e2=_0x5ce7e2-0x0;var _0x5224d1=_0xbb95[_0x5ce7e2];return _0x5224d1;};'use strict';var Sequelize=require(_0x5bb9('0x0'));module[_0x5bb9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x5bb9('0x2')]},'metric':{'type':Sequelize[_0x5bb9('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41bb=['TEXT','STRING','sequelize','exports','name'];(function(_0x48a91d,_0x54cdaa){var _0x288403=function(_0x72e98b){while(--_0x72e98b){_0x48a91d['push'](_0x48a91d['shift']());}};_0x288403(++_0x54cdaa);}(_0x41bb,0xc5));var _0xb41b=function(_0xe37b5,_0x5ef854){_0xe37b5=_0xe37b5-0x0;var _0x2b09ab=_0x41bb[_0xe37b5];return _0x2b09ab;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb41b('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xb41b('0x3')]},'description':{'type':Sequelize[_0xb41b('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 91734eb..fbe48e0 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 _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x104056,_0x330044){_0x104056=_0x104056-0x0;var _0x2c7cd0=_0x8d0e[_0x104056];return _0x2c7cd0;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5552d7,_0x37c9da){var _0x5b49d6=function(_0x1a2c78){while(--_0x1a2c78){_0x5552d7['push'](_0x5552d7['shift']());}};_0x5b49d6(++_0x37c9da);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x7fbe[_0x650e11];return _0x1a9b47;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index bc56bb2..2c68043 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 _0x7d10=['AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','path','rimraf','./analyticMetric.attributes','exports'];(function(_0x27dfcc,_0x561bb1){var _0x2031c4=function(_0x4e7290){while(--_0x4e7290){_0x27dfcc['push'](_0x27dfcc['shift']());}};_0x2031c4(++_0x561bb1);}(_0x7d10,0x1ce));var _0x07d1=function(_0x35b49d,_0x4bbcb1){_0x35b49d=_0x35b49d-0x0;var _0xf1de19=_0x7d10[_0x35b49d];return _0xf1de19;};'use strict';var _=require('lodash');var util=require(_0x07d1('0x0'));var logger=require(_0x07d1('0x1'))('api');var moment=require(_0x07d1('0x2'));var BPromise=require(_0x07d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07d1('0x4'));var rimraf=require(_0x07d1('0x5'));var config=require('../../config/environment');var attributes=require(_0x07d1('0x6'));module[_0x07d1('0x7')]=function(_0x1c8f3d,_0x36198a){return _0x1c8f3d['define'](_0x07d1('0x8'),attributes,{'tableName':_0x07d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c3=['path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xc9c3,0x96));var _0x3c9c=function(_0x191d71,_0x32ce70){_0x191d71=_0x191d71-0x0;var _0x3b6195=_0xc9c3[_0x191d71];return _0x3b6195;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 45c91d5..6df5731 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 _0x4892=['../../config/environment','jayson/promise','client','http','request','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4aa6cb,_0x4b3912){var _0x300640=function(_0x29c0b7){while(--_0x29c0b7){_0x4aa6cb['push'](_0x4aa6cb['shift']());}};_0x300640(++_0x4b3912);}(_0x4892,0x10b));var _0x2489=function(_0xe76499,_0x300943){_0xe76499=_0xe76499-0x0;var _0x4617fb=_0x4892[_0xe76499];return _0x4617fb;};'use strict';var _=require(_0x2489('0x0'));var util=require(_0x2489('0x1'));var moment=require(_0x2489('0x2'));var BPromise=require(_0x2489('0x3'));var rs=require(_0x2489('0x4'));var fs=require('fs');var Redis=require(_0x2489('0x5'));var db=require(_0x2489('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2489('0x7'))(_0x2489('0x8'));var config=require(_0x2489('0x9'));var jayson=require(_0x2489('0xa'));var client=jayson[_0x2489('0xb')][_0x2489('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa454a9,_0x504483,_0xb7ac89){return new BPromise(function(_0x3bc7b9,_0x34ff86){return client[_0x2489('0xd')](_0xa454a9,_0xb7ac89)['then'](function(_0x3dee5b){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x504483,_0x2489('0xe'));logger['debug'](_0x2489('0xf'),_0x504483,_0x2489('0xe'),JSON[_0x2489('0x10')](_0x3dee5b));if(_0x3dee5b[_0x2489('0x11')]){if(_0x3dee5b[_0x2489('0x11')][_0x2489('0x12')]===0x1f4){logger[_0x2489('0x11')](_0x2489('0x13'),_0x504483,_0x3dee5b[_0x2489('0x11')]['message']);return _0x34ff86(_0x3dee5b[_0x2489('0x11')][_0x2489('0x14')]);}logger[_0x2489('0x11')](_0x2489('0x13'),_0x504483,_0x3dee5b[_0x2489('0x11')][_0x2489('0x14')]);return _0x3bc7b9(_0x3dee5b[_0x2489('0x11')][_0x2489('0x14')]);}else{logger[_0x2489('0x15')](_0x2489('0x13'),_0x504483,'request\x20sent');_0x3bc7b9(_0x3dee5b['result'][_0x2489('0x14')]);}})[_0x2489('0x16')](function(_0x3aa496){logger[_0x2489('0x11')](_0x2489('0x13'),_0x504483,_0x3aa496);_0x34ff86(_0x3aa496);});});} \ No newline at end of file +var _0x2bc9=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4d275c,_0x522396){var _0x55b75f=function(_0x47e6d3){while(--_0x47e6d3){_0x4d275c['push'](_0x4d275c['shift']());}};_0x55b75f(++_0x522396);}(_0x2bc9,0x151));var _0x92bc=function(_0x6a47c,_0x2cbd54){_0x6a47c=_0x6a47c-0x0;var _0x1b8c47=_0x2bc9[_0x6a47c];return _0x1b8c47;};'use strict';var _=require(_0x92bc('0x0'));var util=require(_0x92bc('0x1'));var moment=require(_0x92bc('0x2'));var BPromise=require(_0x92bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x92bc('0x5'));var logger=require(_0x92bc('0x6'))(_0x92bc('0x7'));var config=require(_0x92bc('0x8'));var jayson=require(_0x92bc('0x9'));var client=jayson[_0x92bc('0xa')][_0x92bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11dbd1,_0x55ac11,_0xca1ba8){return new BPromise(function(_0x22abc5,_0x579b83){return client[_0x92bc('0xc')](_0x11dbd1,_0xca1ba8)[_0x92bc('0xd')](function(_0x446166){logger[_0x92bc('0xe')](_0x92bc('0xf'),_0x55ac11,_0x92bc('0x10'));logger['debug'](_0x92bc('0x11'),_0x55ac11,_0x92bc('0x10'),JSON[_0x92bc('0x12')](_0x446166));if(_0x446166['error']){if(_0x446166['error'][_0x92bc('0x13')]===0x1f4){logger[_0x92bc('0x14')](_0x92bc('0xf'),_0x55ac11,_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);return _0x579b83(_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);}logger[_0x92bc('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x55ac11,_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);return _0x22abc5(_0x446166['error'][_0x92bc('0x15')]);}else{logger[_0x92bc('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x55ac11,_0x92bc('0x10'));_0x22abc5(_0x446166[_0x92bc('0x16')][_0x92bc('0x15')]);}})['catch'](function(_0x258a8c){logger[_0x92bc('0x14')](_0x92bc('0xf'),_0x55ac11,_0x258a8c);_0x579b83(_0x258a8c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1f33a3b..aefaad9 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 _0x05bc=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc05b('0x0'));var path=require('path');var timeout=require(_0xc05b('0x1'));var express=require(_0xc05b('0x2'));var router=express['Router']();var fs_extra=require(_0xc05b('0x3'));var auth=require(_0xc05b('0x4'));var interaction=require(_0xc05b('0x5'));var config=require(_0xc05b('0x6'));var controller=require(_0xc05b('0x7'));router[_0xc05b('0x8')]('/',auth[_0xc05b('0x9')](),controller[_0xc05b('0xa')]);router[_0xc05b('0x8')](_0xc05b('0xb'),auth[_0xc05b('0x9')](),controller[_0xc05b('0xc')]);router[_0xc05b('0xd')]('/',auth[_0xc05b('0x9')](),controller['create']);router['put'](_0xc05b('0xb'),auth[_0xc05b('0x9')](),controller[_0xc05b('0xe')]);router[_0xc05b('0xf')](_0xc05b('0xb'),auth[_0xc05b('0x9')](),controller[_0xc05b('0x10')]);module[_0xc05b('0x11')]=router; \ No newline at end of file +var _0x078c=['index','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x078c,0x19f));var _0xc078=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x078c[_0x3a3758];return _0x1a9234;};'use strict';var multer=require(_0xc078('0x0'));var util=require('util');var path=require(_0xc078('0x1'));var timeout=require(_0xc078('0x2'));var express=require('express');var router=express[_0xc078('0x3')]();var fs_extra=require(_0xc078('0x4'));var auth=require(_0xc078('0x5'));var interaction=require(_0xc078('0x6'));var config=require('../../config/environment');var controller=require(_0xc078('0x7'));router[_0xc078('0x8')]('/',auth[_0xc078('0x9')](),controller[_0xc078('0xa')]);router[_0xc078('0x8')](_0xc078('0xb'),auth[_0xc078('0x9')](),controller[_0xc078('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc078('0xd')](_0xc078('0xb'),auth['isAuthenticated'](),controller[_0xc078('0xe')]);router[_0xc078('0xf')](_0xc078('0xb'),auth[_0xc078('0x9')](),controller[_0xc078('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9ac34e5..feab01b 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 _0x7f5e=['sequelize','exports','TEXT'];(function(_0x2755b2,_0x4cca8c){var _0x260f28=function(_0x1faf58){while(--_0x1faf58){_0x2755b2['push'](_0x2755b2['shift']());}};_0x260f28(++_0x4cca8c);}(_0x7f5e,0x10b));var _0xe7f5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f5e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe7f5('0x0'));module[_0xe7f5('0x1')]={'tree':{'type':Sequelize[_0xe7f5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8b80=['TEXT','sequelize','exports'];(function(_0x3dacec,_0x2c775a){var _0x20335e=function(_0x4e3e61){while(--_0x4e3e61){_0x3dacec['push'](_0x3dacec['shift']());}};_0x20335e(++_0x2c775a);}(_0x8b80,0xbb));var _0x08b8=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x8b80[_0x3ad7ad];return _0x225a60;};'use strict';var Sequelize=require(_0x08b8('0x0'));module[_0x08b8('0x1')]={'tree':{'type':Sequelize[_0x08b8('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 0ed57cb..440b4e6 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 _0x3a3e=['fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','status','error','stack','name','send','index','map','rawAttributes'];(function(_0x433446,_0x4e8885){var _0xe3aad3=function(_0x555a18){while(--_0x555a18){_0x433446['push'](_0x433446['shift']());}};_0xe3aad3(++_0x4e8885);}(_0x3a3e,0x180));var _0xe3a3=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x3a3e[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0xe3a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3a3('0x1'));var jsonpatch=require(_0xe3a3('0x2'));var rp=require(_0xe3a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe3a3('0x4'));var util=require(_0xe3a3('0x5'));var path=require(_0xe3a3('0x6'));var sox=require('sox');var csv=require(_0xe3a3('0x7'));var ejs=require(_0xe3a3('0x8'));var fs=require('fs');var fs_extra=require(_0xe3a3('0x9'));var _=require('lodash');var squel=require(_0xe3a3('0xa'));var crypto=require(_0xe3a3('0xb'));var jsforce=require(_0xe3a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe3a3('0x7'));var querystring=require('querystring');var Papa=require(_0xe3a3('0xd'));var Redis=require(_0xe3a3('0xe'));var authService=require(_0xe3a3('0xf'));var qs=require(_0xe3a3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3a3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe3a3('0x12'));var licenseUtil=require(_0xe3a3('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36090a,_0x2e99e6){_0x2e99e6=_0x2e99e6||0xcc;return function(_0x5eb7c){if(_0x5eb7c){return _0x36090a[_0xe3a3('0x14')](_0x2e99e6);}return _0x36090a['status'](_0x2e99e6)[_0xe3a3('0x15')]();};}function respondWithResult(_0x5cb312,_0x1eb142){_0x1eb142=_0x1eb142||0xc8;return function(_0x12bdae){if(_0x12bdae){return _0x5cb312['status'](_0x1eb142)[_0xe3a3('0x16')](_0x12bdae);}};}function respondWithFilteredResult(_0x190d0a,_0x6b39ec){return function(_0x5c70ad){if(_0x5c70ad){var _0x2fa5ea=typeof _0x6b39ec[_0xe3a3('0x17')]===_0xe3a3('0x18')&&typeof _0x6b39ec[_0xe3a3('0x19')]===_0xe3a3('0x18');var _0x521263=_0x5c70ad['count'];var _0x47869b=_0x2fa5ea?0x0:_0x6b39ec[_0xe3a3('0x17')];var _0x33273b=_0x2fa5ea?_0x5c70ad[_0xe3a3('0x1a')]:_0x6b39ec[_0xe3a3('0x17')]+_0x6b39ec[_0xe3a3('0x19')];var _0x3b3c6c;if(_0x33273b>=_0x521263){_0x33273b=_0x521263;_0x3b3c6c=0xc8;}else{_0x3b3c6c=0xce;}_0x190d0a['status'](_0x3b3c6c);return _0x190d0a[_0xe3a3('0x1b')](_0xe3a3('0x1c'),_0x47869b+'-'+_0x33273b+'/'+_0x521263)[_0xe3a3('0x16')](_0x5c70ad);}return null;};}function patchUpdates(_0x1a83b4){return function(_0x270e33){try{jsonpatch[_0xe3a3('0x1d')](_0x270e33,_0x1a83b4,!![]);}catch(_0x5c1109){return BPromise['reject'](_0x5c1109);}return _0x270e33[_0xe3a3('0x1e')]();};}function saveUpdates(_0x212ce0,_0x5ddf7f){return function(_0x23358b){if(_0x23358b){return _0x23358b[_0xe3a3('0x1f')](_0x212ce0)['then'](function(_0x3b6107){return _0x3b6107;});}return null;};}function removeEntity(_0x3d36ba,_0x50d0fe){return function(_0x5e921c){if(_0x5e921c){return _0x5e921c[_0xe3a3('0x20')]()[_0xe3a3('0x21')](function(){_0x3d36ba[_0xe3a3('0x22')](0xcc)[_0xe3a3('0x15')]();});}};}function handleEntityNotFound(_0x51624b,_0x48a6a2){return function(_0x5ce4c6){if(!_0x5ce4c6){_0x51624b[_0xe3a3('0x14')](0x194);}return _0x5ce4c6;};}function handleError(_0x3e8b3f,_0x32f92b){_0x32f92b=_0x32f92b||0x1f4;return function(_0xa4ac26){logger[_0xe3a3('0x23')](_0xa4ac26[_0xe3a3('0x24')]);if(_0xa4ac26[_0xe3a3('0x25')]){delete _0xa4ac26[_0xe3a3('0x25')];}_0x3e8b3f[_0xe3a3('0x22')](_0x32f92b)[_0xe3a3('0x26')](_0xa4ac26);};}exports[_0xe3a3('0x27')]=function(_0x3811ee,_0x2a8216){var _0x17adcc={},_0x2d79e={},_0x34de36={'count':0x0,'rows':[]};var _0x2d3e37=_[_0xe3a3('0x28')](db['AnalyticTreeReport'][_0xe3a3('0x29')],function(_0x2a33d2){return{'name':_0x2a33d2[_0xe3a3('0x2a')],'type':_0x2a33d2['type'][_0xe3a3('0x2b')]};});_0x2d79e[_0xe3a3('0x2c')]=_[_0xe3a3('0x28')](_0x2d3e37,'name');_0x2d79e[_0xe3a3('0x2d')]=_[_0xe3a3('0x2e')](_0x3811ee['query']);_0x2d79e['filters']=_[_0xe3a3('0x2f')](_0x2d79e[_0xe3a3('0x2c')],_0x2d79e[_0xe3a3('0x2d')]);_0x17adcc[_0xe3a3('0x30')]=_[_0xe3a3('0x2f')](_0x2d79e[_0xe3a3('0x2c')],qs['fields'](_0x3811ee[_0xe3a3('0x2d')][_0xe3a3('0x31')]));_0x17adcc[_0xe3a3('0x30')]=_0x17adcc[_0xe3a3('0x30')][_0xe3a3('0x32')]?_0x17adcc['attributes']:_0x2d79e['model'];if(!_0x3811ee[_0xe3a3('0x2d')][_0xe3a3('0x33')]('nolimit')){_0x17adcc['limit']=qs['limit'](_0x3811ee['query'][_0xe3a3('0x19')]);_0x17adcc['offset']=qs['offset'](_0x3811ee[_0xe3a3('0x2d')]['offset']);}_0x17adcc['order']=qs[_0xe3a3('0x34')](_0x3811ee['query']['sort']);_0x17adcc[_0xe3a3('0x35')]=qs[_0xe3a3('0x36')](_[_0xe3a3('0x37')](_0x3811ee[_0xe3a3('0x2d')],_0x2d79e[_0xe3a3('0x36')]),_0x2d3e37);if(_0x3811ee['query'][_0xe3a3('0x38')]){_0x17adcc[_0xe3a3('0x35')]=_[_0xe3a3('0x39')](_0x17adcc['where'],{'$or':_[_0xe3a3('0x28')](_0x2d3e37,function(_0x43c4a9){if(_0x43c4a9[_0xe3a3('0x3a')]!=='VIRTUAL'){var _0x2298d2={};_0x2298d2[_0x43c4a9[_0xe3a3('0x25')]]={'$like':'%'+_0x3811ee[_0xe3a3('0x2d')][_0xe3a3('0x38')]+'%'};return _0x2298d2;}})});}_0x17adcc=_[_0xe3a3('0x39')]({},_0x17adcc,_0x3811ee['options']);var _0xbfc0e0={'where':_0x17adcc[_0xe3a3('0x35')]};return db[_0xe3a3('0x3b')]['count'](_0xbfc0e0)[_0xe3a3('0x21')](function(_0x4c98ce){_0x34de36[_0xe3a3('0x1a')]=_0x4c98ce;if(_0x3811ee[_0xe3a3('0x2d')][_0xe3a3('0x3c')]){_0x17adcc[_0xe3a3('0x3d')]=[{'all':!![]}];}return db[_0xe3a3('0x3b')][_0xe3a3('0x3e')](_0x17adcc);})['then'](function(_0x15a5f1){_0x34de36[_0xe3a3('0x3f')]=_0x15a5f1;return _0x34de36;})[_0xe3a3('0x21')](respondWithFilteredResult(_0x2a8216,_0x17adcc))[_0xe3a3('0x40')](handleError(_0x2a8216,null));};exports[_0xe3a3('0x41')]=function(_0x59f046,_0xba3200){var _0x52dc21={'raw':!![],'where':{'id':_0x59f046['params']['id']}},_0x1ad4c6={};_0x1ad4c6[_0xe3a3('0x2c')]=_[_0xe3a3('0x2e')](db[_0xe3a3('0x3b')][_0xe3a3('0x29')]);_0x1ad4c6['query']=_[_0xe3a3('0x2e')](_0x59f046[_0xe3a3('0x2d')]);_0x1ad4c6[_0xe3a3('0x36')]=_[_0xe3a3('0x2f')](_0x1ad4c6[_0xe3a3('0x2c')],_0x1ad4c6[_0xe3a3('0x2d')]);_0x52dc21['attributes']=_['intersection'](_0x1ad4c6[_0xe3a3('0x2c')],qs[_0xe3a3('0x31')](_0x59f046[_0xe3a3('0x2d')]['fields']));_0x52dc21[_0xe3a3('0x30')]=_0x52dc21[_0xe3a3('0x30')][_0xe3a3('0x32')]?_0x52dc21[_0xe3a3('0x30')]:_0x1ad4c6[_0xe3a3('0x2c')];if(_0x59f046[_0xe3a3('0x2d')][_0xe3a3('0x3c')]){_0x52dc21[_0xe3a3('0x3d')]=[{'all':!![]}];}_0x52dc21=_[_0xe3a3('0x39')]({},_0x52dc21,_0x59f046[_0xe3a3('0x42')]);return db[_0xe3a3('0x3b')][_0xe3a3('0x43')](_0x52dc21)[_0xe3a3('0x21')](handleEntityNotFound(_0xba3200,null))[_0xe3a3('0x21')](respondWithResult(_0xba3200,null))[_0xe3a3('0x40')](handleError(_0xba3200,null));};exports[_0xe3a3('0x44')]=function(_0xb84cfe,_0x378461){return db[_0xe3a3('0x3b')][_0xe3a3('0x44')](_0xb84cfe[_0xe3a3('0x45')],{})['then'](respondWithResult(_0x378461,0xc9))[_0xe3a3('0x40')](handleError(_0x378461,null));};exports[_0xe3a3('0x1f')]=function(_0x4b8bc5,_0x329383){if(_0x4b8bc5[_0xe3a3('0x45')]['id']){delete _0x4b8bc5[_0xe3a3('0x45')]['id'];}return db[_0xe3a3('0x3b')][_0xe3a3('0x43')]({'where':{'id':_0x4b8bc5[_0xe3a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x329383,null))['then'](saveUpdates(_0x4b8bc5[_0xe3a3('0x45')],null))[_0xe3a3('0x21')](respondWithResult(_0x329383,null))[_0xe3a3('0x40')](handleError(_0x329383,null));};exports[_0xe3a3('0x20')]=function(_0x186c65,_0x2fe17c){return db[_0xe3a3('0x3b')]['find']({'where':{'id':_0x186c65[_0xe3a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fe17c,null))[_0xe3a3('0x21')](removeEntity(_0x2fe17c,null))['catch'](handleError(_0x2fe17c,null));}; \ No newline at end of file +var _0xaca5=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','keys','find','catch','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x536256,_0x237fb5){var _0x1675f7=function(_0x339198){while(--_0x339198){_0x536256['push'](_0x536256['shift']());}};_0x1675f7(++_0x237fb5);}(_0xaca5,0xe4));var _0x5aca=function(_0x225a50,_0x593a61){_0x225a50=_0x225a50-0x0;var _0xc7afb4=_0xaca5[_0x225a50];return _0xc7afb4;};'use strict';var emlformat=require(_0x5aca('0x0'));var rimraf=require(_0x5aca('0x1'));var zipdir=require(_0x5aca('0x2'));var jsonpatch=require(_0x5aca('0x3'));var rp=require(_0x5aca('0x4'));var moment=require(_0x5aca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5aca('0x6'));var util=require(_0x5aca('0x7'));var path=require(_0x5aca('0x8'));var sox=require(_0x5aca('0x9'));var csv=require(_0x5aca('0xa'));var ejs=require(_0x5aca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5aca('0xc'));var squel=require(_0x5aca('0xd'));var crypto=require('crypto');var jsforce=require(_0x5aca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5aca('0xa'));var querystring=require(_0x5aca('0xf'));var Papa=require(_0x5aca('0x10'));var Redis=require(_0x5aca('0x11'));var authService=require(_0x5aca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5aca('0x13'));var hardwareService=require(_0x5aca('0x14'));var logger=require(_0x5aca('0x15'))(_0x5aca('0x16'));var utils=require(_0x5aca('0x17'));var config=require(_0x5aca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5aca('0x19'))['db'];function respondWithStatusCode(_0x52327b,_0x160781){_0x160781=_0x160781||0xcc;return function(_0x5d1156){if(_0x5d1156){return _0x52327b[_0x5aca('0x1a')](_0x160781);}return _0x52327b[_0x5aca('0x1b')](_0x160781)[_0x5aca('0x1c')]();};}function respondWithResult(_0x5e977e,_0x586ce9){_0x586ce9=_0x586ce9||0xc8;return function(_0x2f6c54){if(_0x2f6c54){return _0x5e977e[_0x5aca('0x1b')](_0x586ce9)[_0x5aca('0x1d')](_0x2f6c54);}};}function respondWithFilteredResult(_0x2fb818,_0x396cb6){return function(_0x4b3d70){if(_0x4b3d70){var _0x4c3ab4=typeof _0x396cb6[_0x5aca('0x1e')]===_0x5aca('0x1f')&&typeof _0x396cb6[_0x5aca('0x20')]===_0x5aca('0x1f');var _0x30c95e=_0x4b3d70['count'];var _0x18ac71=_0x4c3ab4?0x0:_0x396cb6['offset'];var _0x13dae6=_0x4c3ab4?_0x4b3d70[_0x5aca('0x21')]:_0x396cb6[_0x5aca('0x1e')]+_0x396cb6[_0x5aca('0x20')];var _0x4a2cbb;if(_0x13dae6>=_0x30c95e){_0x13dae6=_0x30c95e;_0x4a2cbb=0xc8;}else{_0x4a2cbb=0xce;}_0x2fb818[_0x5aca('0x1b')](_0x4a2cbb);return _0x2fb818[_0x5aca('0x22')](_0x5aca('0x23'),_0x18ac71+'-'+_0x13dae6+'/'+_0x30c95e)['json'](_0x4b3d70);}return null;};}function patchUpdates(_0x106fc6){return function(_0x3131c3){try{jsonpatch[_0x5aca('0x24')](_0x3131c3,_0x106fc6,!![]);}catch(_0x4b241f){return BPromise[_0x5aca('0x25')](_0x4b241f);}return _0x3131c3[_0x5aca('0x26')]();};}function saveUpdates(_0x37823b,_0x3f87a4){return function(_0x34c40a){if(_0x34c40a){return _0x34c40a['update'](_0x37823b)[_0x5aca('0x27')](function(_0x5d7bd7){return _0x5d7bd7;});}return null;};}function removeEntity(_0x56da55,_0x44a1df){return function(_0x453e45){if(_0x453e45){return _0x453e45[_0x5aca('0x28')]()[_0x5aca('0x27')](function(){_0x56da55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1a327,_0x3427b5){return function(_0x2e4075){if(!_0x2e4075){_0xf1a327[_0x5aca('0x1a')](0x194);}return _0x2e4075;};}function handleError(_0x59e0a8,_0x2c9c2f){_0x2c9c2f=_0x2c9c2f||0x1f4;return function(_0x2f8944){logger[_0x5aca('0x29')](_0x2f8944[_0x5aca('0x2a')]);if(_0x2f8944[_0x5aca('0x2b')]){delete _0x2f8944[_0x5aca('0x2b')];}_0x59e0a8['status'](_0x2c9c2f)['send'](_0x2f8944);};}exports[_0x5aca('0x2c')]=function(_0x1b9894,_0x135252){var _0x271106={},_0x5068de={},_0x3a6cc7={'count':0x0,'rows':[]};var _0xf4928c=_[_0x5aca('0x2d')](db[_0x5aca('0x2e')][_0x5aca('0x2f')],function(_0x31e75e){return{'name':_0x31e75e[_0x5aca('0x30')],'type':_0x31e75e[_0x5aca('0x31')][_0x5aca('0x32')]};});_0x5068de['model']=_['map'](_0xf4928c,_0x5aca('0x2b'));_0x5068de[_0x5aca('0x33')]=_['keys'](_0x1b9894[_0x5aca('0x33')]);_0x5068de[_0x5aca('0x34')]=_[_0x5aca('0x35')](_0x5068de[_0x5aca('0x36')],_0x5068de['query']);_0x271106[_0x5aca('0x37')]=_[_0x5aca('0x35')](_0x5068de[_0x5aca('0x36')],qs['fields'](_0x1b9894['query'][_0x5aca('0x38')]));_0x271106['attributes']=_0x271106[_0x5aca('0x37')][_0x5aca('0x39')]?_0x271106['attributes']:_0x5068de[_0x5aca('0x36')];if(!_0x1b9894[_0x5aca('0x33')][_0x5aca('0x3a')](_0x5aca('0x3b'))){_0x271106[_0x5aca('0x20')]=qs[_0x5aca('0x20')](_0x1b9894[_0x5aca('0x33')][_0x5aca('0x20')]);_0x271106['offset']=qs['offset'](_0x1b9894['query']['offset']);}_0x271106[_0x5aca('0x3c')]=qs[_0x5aca('0x3d')](_0x1b9894[_0x5aca('0x33')][_0x5aca('0x3d')]);_0x271106[_0x5aca('0x3e')]=qs[_0x5aca('0x34')](_[_0x5aca('0x3f')](_0x1b9894[_0x5aca('0x33')],_0x5068de['filters']),_0xf4928c);if(_0x1b9894[_0x5aca('0x33')][_0x5aca('0x40')]){_0x271106[_0x5aca('0x3e')]=_['merge'](_0x271106[_0x5aca('0x3e')],{'$or':_[_0x5aca('0x2d')](_0xf4928c,function(_0x178f7e){if(_0x178f7e[_0x5aca('0x31')]!=='VIRTUAL'){var _0x23fb42={};_0x23fb42[_0x178f7e[_0x5aca('0x2b')]]={'$like':'%'+_0x1b9894[_0x5aca('0x33')][_0x5aca('0x40')]+'%'};return _0x23fb42;}})});}_0x271106=_[_0x5aca('0x41')]({},_0x271106,_0x1b9894[_0x5aca('0x42')]);var _0x1a04a9={'where':_0x271106[_0x5aca('0x3e')]};return db[_0x5aca('0x2e')][_0x5aca('0x21')](_0x1a04a9)[_0x5aca('0x27')](function(_0x2a8be8){_0x3a6cc7[_0x5aca('0x21')]=_0x2a8be8;if(_0x1b9894['query'][_0x5aca('0x43')]){_0x271106[_0x5aca('0x44')]=[{'all':!![]}];}return db[_0x5aca('0x2e')]['findAll'](_0x271106);})[_0x5aca('0x27')](function(_0x4325c0){_0x3a6cc7[_0x5aca('0x45')]=_0x4325c0;return _0x3a6cc7;})[_0x5aca('0x27')](respondWithFilteredResult(_0x135252,_0x271106))['catch'](handleError(_0x135252,null));};exports['show']=function(_0x28c768,_0x112980){var _0x2cd346={'raw':!![],'where':{'id':_0x28c768[_0x5aca('0x46')]['id']}},_0x1e5800={};_0x1e5800['model']=_[_0x5aca('0x47')](db['AnalyticTreeReport'][_0x5aca('0x2f')]);_0x1e5800[_0x5aca('0x33')]=_['keys'](_0x28c768[_0x5aca('0x33')]);_0x1e5800['filters']=_[_0x5aca('0x35')](_0x1e5800['model'],_0x1e5800['query']);_0x2cd346[_0x5aca('0x37')]=_['intersection'](_0x1e5800['model'],qs['fields'](_0x28c768[_0x5aca('0x33')][_0x5aca('0x38')]));_0x2cd346['attributes']=_0x2cd346[_0x5aca('0x37')][_0x5aca('0x39')]?_0x2cd346['attributes']:_0x1e5800[_0x5aca('0x36')];if(_0x28c768[_0x5aca('0x33')][_0x5aca('0x43')]){_0x2cd346[_0x5aca('0x44')]=[{'all':!![]}];}_0x2cd346=_[_0x5aca('0x41')]({},_0x2cd346,_0x28c768[_0x5aca('0x42')]);return db['AnalyticTreeReport'][_0x5aca('0x48')](_0x2cd346)[_0x5aca('0x27')](handleEntityNotFound(_0x112980,null))[_0x5aca('0x27')](respondWithResult(_0x112980,null))[_0x5aca('0x49')](handleError(_0x112980,null));};exports['create']=function(_0x4ee0d5,_0x50573d){return db[_0x5aca('0x2e')][_0x5aca('0x4a')](_0x4ee0d5[_0x5aca('0x4b')],{})['then'](respondWithResult(_0x50573d,0xc9))['catch'](handleError(_0x50573d,null));};exports[_0x5aca('0x4c')]=function(_0x2ac1eb,_0x1123b3){if(_0x2ac1eb['body']['id']){delete _0x2ac1eb['body']['id'];}return db[_0x5aca('0x2e')][_0x5aca('0x48')]({'where':{'id':_0x2ac1eb['params']['id']}})['then'](handleEntityNotFound(_0x1123b3,null))['then'](saveUpdates(_0x2ac1eb['body'],null))[_0x5aca('0x27')](respondWithResult(_0x1123b3,null))[_0x5aca('0x49')](handleError(_0x1123b3,null));};exports[_0x5aca('0x28')]=function(_0x319026,_0x117c46){return db['AnalyticTreeReport'][_0x5aca('0x48')]({'where':{'id':_0x319026['params']['id']}})['then'](handleEntityNotFound(_0x117c46,null))[_0x5aca('0x27')](removeEntity(_0x117c46,null))[_0x5aca('0x49')](handleError(_0x117c46,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e0c0407..301cb3d 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 _0xc68a=['define','AnalyticTreeReport','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xc68a,0xf4));var _0xac68=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xc68a[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0xac68('0x0'));var util=require(_0xac68('0x1'));var logger=require(_0xac68('0x2'))(_0xac68('0x3'));var moment=require('moment');var BPromise=require(_0xac68('0x4'));var rp=require(_0xac68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac68('0x6'));var attributes=require(_0xac68('0x7'));module[_0xac68('0x8')]=function(_0x10df11,_0x17962c){return _0x10df11[_0xac68('0x9')](_0xac68('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1db=['exports','AnalyticTreeReport','analytics_report_trees','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x14d752,_0x40833b){var _0x225bea=function(_0x1fe54d){while(--_0x1fe54d){_0x14d752['push'](_0x14d752['shift']());}};_0x225bea(++_0x40833b);}(_0xf1db,0x83));var _0xbf1d=function(_0x3471ab,_0x513323){_0x3471ab=_0x3471ab-0x0;var _0x1f8413=_0xf1db[_0x3471ab];return _0x1f8413;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf1d('0x0'))('api');var moment=require(_0xbf1d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf1d('0x2'));var rimraf=require(_0xbf1d('0x3'));var config=require(_0xbf1d('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0xbf1d('0x5')]=function(_0x2bd3b4,_0x15fa55){return _0x2bd3b4['define'](_0xbf1d('0x6'),attributes,{'tableName':_0xbf1d('0x7'),'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 cb8b53b..c71ac8a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xb92da,_0x50b913){var _0x2957e6=function(_0x415958){while(--_0x415958){_0xb92da['push'](_0xb92da['shift']());}};_0x2957e6(++_0x50b913);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +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(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c0a05,_0x4ba9f3){_0x4c0a05=_0x4c0a05-0x0;var _0x4ff639=_0x2ef3[_0x4c0a05];return _0x4ff639;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index aa1b56e..b556730 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 _0xf5f1=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','create','put','/:id','update','exports','multer','path','connect-timeout','Router'];(function(_0x2614d2,_0x5656f1){var _0x43d9cd=function(_0x2904c5){while(--_0x2904c5){_0x2614d2['push'](_0x2614d2['shift']());}};_0x43d9cd(++_0x5656f1);}(_0xf5f1,0x155));var _0x1f5f=function(_0x13c4ea,_0xe23d79){_0x13c4ea=_0x13c4ea-0x0;var _0x5dd633=_0xf5f1[_0x13c4ea];return _0x5dd633;};'use strict';var multer=require(_0x1f5f('0x0'));var util=require('util');var path=require(_0x1f5f('0x1'));var timeout=require(_0x1f5f('0x2'));var express=require('express');var router=express[_0x1f5f('0x3')]();var fs_extra=require(_0x1f5f('0x4'));var auth=require(_0x1f5f('0x5'));var interaction=require(_0x1f5f('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x1f5f('0x7')]('/',auth[_0x1f5f('0x8')](),controller[_0x1f5f('0x9')]);router[_0x1f5f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1f5f('0x8')](),controller[_0x1f5f('0xa')]);router[_0x1f5f('0xb')](_0x1f5f('0xc'),auth[_0x1f5f('0x8')](),controller[_0x1f5f('0xd')]);router['delete'](_0x1f5f('0xc'),auth[_0x1f5f('0x8')](),controller['destroy']);module[_0x1f5f('0xe')]=router; \ No newline at end of file +var _0xee82=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee82,0x155));var _0x2ee8=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0xee82[_0x2136d5];return _0x3bee2e;};'use strict';var multer=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var path=require('path');var timeout=require(_0x2ee8('0x2'));var express=require('express');var router=express[_0x2ee8('0x3')]();var fs_extra=require(_0x2ee8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2ee8('0x5'));var config=require(_0x2ee8('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x2ee8('0x7')]('/',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0x9')]);router[_0x2ee8('0x7')]('/:id',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xa')]);router['post']('/',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xb')]);router[_0x2ee8('0xc')](_0x2ee8('0xd'),auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xe')]);router[_0x2ee8('0xf')](_0x2ee8('0xd'),auth[_0x2ee8('0x8')](),controller['destroy']);module[_0x2ee8('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 629a935..d22404a 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 _0x7bae=['STRING'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x7bae,0x13b));var _0xe7ba=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7bae[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7ba('0x0')]},'basename':{'type':Sequelize[_0xe7ba('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x9d95b8,_0x4050d6){var _0x4098cc=function(_0x4350b6){while(--_0x4350b6){_0x9d95b8['push'](_0x9d95b8['shift']());}};_0x4098cc(++_0x4050d6);}(_0x34e8,0x12c));var _0x834e=function(_0x290c60,_0x2f8f66){_0x290c60=_0x290c60-0x0;var _0x332089=_0x34e8[_0x290c60];return _0x332089;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'basename':{'type':Sequelize[_0x834e('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d7e38cd..c301a92 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 _0xdd7a=['set','Content-Range','json','reject','save','update','then','destroy','error','name','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','find','get','updatedAt','body','omit','createdAt','create','catch','file','originalname','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','offset','count'];(function(_0x3c7731,_0x345465){var _0x77af90=function(_0x58f69c){while(--_0x58f69c){_0x3c7731['push'](_0x3c7731['shift']());}};_0x77af90(++_0x345465);}(_0xdd7a,0x149));var _0xadd7=function(_0x86a1fb,_0x33d77e){_0x86a1fb=_0x86a1fb-0x0;var _0x27c791=_0xdd7a[_0x86a1fb];return _0x27c791;};'use strict';var emlformat=require(_0xadd7('0x0'));var rimraf=require(_0xadd7('0x1'));var zipdir=require(_0xadd7('0x2'));var jsonpatch=require(_0xadd7('0x3'));var rp=require(_0xadd7('0x4'));var moment=require('moment');var BPromise=require(_0xadd7('0x5'));var Mustache=require(_0xadd7('0x6'));var util=require(_0xadd7('0x7'));var path=require(_0xadd7('0x8'));var sox=require(_0xadd7('0x9'));var csv=require('to-csv');var ejs=require(_0xadd7('0xa'));var fs=require('fs');var fs_extra=require(_0xadd7('0xb'));var _=require(_0xadd7('0xc'));var squel=require(_0xadd7('0xd'));var crypto=require(_0xadd7('0xe'));var jsforce=require(_0xadd7('0xf'));var deskjs=require(_0xadd7('0x10'));var toCsv=require(_0xadd7('0x11'));var querystring=require('querystring');var Papa=require(_0xadd7('0x12'));var Redis=require(_0xadd7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xadd7('0x14'));var as=require(_0xadd7('0x15'));var hardwareService=require(_0xadd7('0x16'));var logger=require(_0xadd7('0x17'))(_0xadd7('0x18'));var utils=require(_0xadd7('0x19'));var config=require(_0xadd7('0x1a'));var licenseUtil=require(_0xadd7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4714c8,_0x5a2686){_0x5a2686=_0x5a2686||0xcc;return function(_0x183779){if(_0x183779){return _0x4714c8[_0xadd7('0x1c')](_0x5a2686);}return _0x4714c8[_0xadd7('0x1d')](_0x5a2686)[_0xadd7('0x1e')]();};}function respondWithResult(_0x5fa10e,_0x3c89b4){_0x3c89b4=_0x3c89b4||0xc8;return function(_0x4357dc){if(_0x4357dc){return _0x5fa10e[_0xadd7('0x1d')](_0x3c89b4)['json'](_0x4357dc);}};}function respondWithFilteredResult(_0x268a10,_0x27a7cf){return function(_0x485f39){if(_0x485f39){var _0x35a9fc=typeof _0x27a7cf['offset']==='undefined'&&typeof _0x27a7cf[_0xadd7('0x1f')]===_0xadd7('0x20');var _0x150b03=_0x485f39['count'];var _0x30adf5=_0x35a9fc?0x0:_0x27a7cf[_0xadd7('0x21')];var _0x557985=_0x35a9fc?_0x485f39[_0xadd7('0x22')]:_0x27a7cf['offset']+_0x27a7cf[_0xadd7('0x1f')];var _0x217a20;if(_0x557985>=_0x150b03){_0x557985=_0x150b03;_0x217a20=0xc8;}else{_0x217a20=0xce;}_0x268a10[_0xadd7('0x1d')](_0x217a20);return _0x268a10[_0xadd7('0x23')](_0xadd7('0x24'),_0x30adf5+'-'+_0x557985+'/'+_0x150b03)[_0xadd7('0x25')](_0x485f39);}return null;};}function patchUpdates(_0x56638f){return function(_0x5a548a){try{jsonpatch['apply'](_0x5a548a,_0x56638f,!![]);}catch(_0x24030c){return BPromise[_0xadd7('0x26')](_0x24030c);}return _0x5a548a[_0xadd7('0x27')]();};}function saveUpdates(_0x3657a5,_0x1ba59f){return function(_0x30ae47){if(_0x30ae47){return _0x30ae47[_0xadd7('0x28')](_0x3657a5)[_0xadd7('0x29')](function(_0x1aec6b){return _0x1aec6b;});}return null;};}function removeEntity(_0x20ebcd,_0x48f851){return function(_0x41da3f){if(_0x41da3f){return _0x41da3f[_0xadd7('0x2a')]()[_0xadd7('0x29')](function(){_0x20ebcd[_0xadd7('0x1d')](0xcc)[_0xadd7('0x1e')]();});}};}function handleEntityNotFound(_0x3b2313,_0x493785){return function(_0x1465f9){if(!_0x1465f9){_0x3b2313[_0xadd7('0x1c')](0x194);}return _0x1465f9;};}function handleError(_0x38812a,_0x49080c){_0x49080c=_0x49080c||0x1f4;return function(_0x5c5a41){logger[_0xadd7('0x2b')](_0x5c5a41['stack']);if(_0x5c5a41[_0xadd7('0x2c')]){delete _0x5c5a41[_0xadd7('0x2c')];}_0x38812a[_0xadd7('0x1d')](_0x49080c)['send'](_0x5c5a41);};}exports[_0xadd7('0x2d')]=function(_0x118e1b,_0x54fbb9){var _0x1368e2={},_0x132a92={},_0x552829={'count':0x0,'rows':[]};var _0xe400d3=_[_0xadd7('0x2e')](db[_0xadd7('0x2f')]['rawAttributes'],function(_0x395c08){return{'name':_0x395c08[_0xadd7('0x30')],'type':_0x395c08[_0xadd7('0x31')][_0xadd7('0x32')]};});_0x132a92[_0xadd7('0x33')]=_[_0xadd7('0x2e')](_0xe400d3,_0xadd7('0x2c'));_0x132a92[_0xadd7('0x34')]=_[_0xadd7('0x35')](_0x118e1b[_0xadd7('0x34')]);_0x132a92[_0xadd7('0x36')]=_[_0xadd7('0x37')](_0x132a92['model'],_0x132a92[_0xadd7('0x34')]);_0x1368e2[_0xadd7('0x38')]=_[_0xadd7('0x37')](_0x132a92[_0xadd7('0x33')],qs['fields'](_0x118e1b['query'][_0xadd7('0x39')]));_0x1368e2['attributes']=_0x1368e2[_0xadd7('0x38')][_0xadd7('0x3a')]?_0x1368e2['attributes']:_0x132a92[_0xadd7('0x33')];if(!_0x118e1b['query']['hasOwnProperty']('nolimit')){_0x1368e2['limit']=qs[_0xadd7('0x1f')](_0x118e1b['query'][_0xadd7('0x1f')]);_0x1368e2[_0xadd7('0x21')]=qs[_0xadd7('0x21')](_0x118e1b[_0xadd7('0x34')][_0xadd7('0x21')]);}_0x1368e2[_0xadd7('0x3b')]=qs[_0xadd7('0x3c')](_0x118e1b[_0xadd7('0x34')][_0xadd7('0x3c')]);_0x1368e2['where']=qs[_0xadd7('0x36')](_[_0xadd7('0x3d')](_0x118e1b[_0xadd7('0x34')],_0x132a92['filters']),_0xe400d3);if(_0x118e1b[_0xadd7('0x34')]['filter']){_0x1368e2[_0xadd7('0x3e')]=_[_0xadd7('0x3f')](_0x1368e2[_0xadd7('0x3e')],{'$or':_['map'](_0xe400d3,function(_0x3cbf94){if(_0x3cbf94[_0xadd7('0x31')]!==_0xadd7('0x40')){var _0x41001a={};_0x41001a[_0x3cbf94['name']]={'$like':'%'+_0x118e1b[_0xadd7('0x34')][_0xadd7('0x41')]+'%'};return _0x41001a;}})});}_0x1368e2=_['merge']({},_0x1368e2,_0x118e1b[_0xadd7('0x42')]);var _0x5ccba0={'where':_0x1368e2[_0xadd7('0x3e')]};return db[_0xadd7('0x2f')][_0xadd7('0x22')](_0x5ccba0)[_0xadd7('0x29')](function(_0x520ef4){_0x552829[_0xadd7('0x22')]=_0x520ef4;if(_0x118e1b['query'][_0xadd7('0x43')]){_0x1368e2[_0xadd7('0x44')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x1368e2);})['then'](function(_0x1700dd){_0x552829[_0xadd7('0x45')]=_0x1700dd;return _0x552829;})[_0xadd7('0x29')](respondWithFilteredResult(_0x54fbb9,_0x1368e2))['catch'](handleError(_0x54fbb9,null));};exports[_0xadd7('0x46')]=function(_0x36dfac,_0x3be8db){var _0x2ea287={'raw':!![],'where':{'id':_0x36dfac[_0xadd7('0x47')]['id']}},_0x9973b9={};_0x9973b9[_0xadd7('0x33')]=_[_0xadd7('0x35')](db['Attachment'][_0xadd7('0x48')]);_0x9973b9[_0xadd7('0x34')]=_['keys'](_0x36dfac[_0xadd7('0x34')]);_0x9973b9[_0xadd7('0x36')]=_[_0xadd7('0x37')](_0x9973b9['model'],_0x9973b9['query']);_0x2ea287[_0xadd7('0x38')]=_[_0xadd7('0x37')](_0x9973b9[_0xadd7('0x33')],qs['fields'](_0x36dfac[_0xadd7('0x34')]['fields']));_0x2ea287[_0xadd7('0x38')]=_0x2ea287[_0xadd7('0x38')][_0xadd7('0x3a')]?_0x2ea287[_0xadd7('0x38')]:_0x9973b9[_0xadd7('0x33')];if(_0x36dfac[_0xadd7('0x34')][_0xadd7('0x43')]){_0x2ea287[_0xadd7('0x44')]=[{'all':!![]}];}_0x2ea287=_[_0xadd7('0x3f')]({},_0x2ea287,_0x36dfac['options']);return db[_0xadd7('0x2f')][_0xadd7('0x49')](_0x2ea287)[_0xadd7('0x29')](handleEntityNotFound(_0x3be8db,null))[_0xadd7('0x29')](respondWithResult(_0x3be8db,null))['catch'](handleError(_0x3be8db,null));};exports['clone']=function(_0x384b3b,_0x2bd23b){var _0x564c3e={'where':{'id':_0x384b3b[_0xadd7('0x47')]['id']}},_0x19ad2d={};_0x19ad2d['model']=_['keys'](db[_0xadd7('0x2f')]['rawAttributes']);_0x564c3e[_0xadd7('0x38')]=_[_0xadd7('0x37')](_0x19ad2d[_0xadd7('0x33')],qs[_0xadd7('0x39')](_0x384b3b[_0xadd7('0x34')]['fields']));_0x564c3e['attributes']=_0x564c3e[_0xadd7('0x38')][_0xadd7('0x3a')]?_0x564c3e[_0xadd7('0x38')]:_0x19ad2d[_0xadd7('0x33')];if(_0x384b3b[_0xadd7('0x34')][_0xadd7('0x43')]){_0x564c3e[_0xadd7('0x44')]=[{'all':!![]}];}_0x564c3e=_[_0xadd7('0x3f')]({},_0x564c3e,_0x384b3b[_0xadd7('0x42')]);return db[_0xadd7('0x2f')][_0xadd7('0x49')](_0x564c3e)[_0xadd7('0x29')](handleEntityNotFound(_0x2bd23b,null))['then'](function(_0x61da1d){if(_0x61da1d){var _0x68691b=_0x61da1d[_0xadd7('0x4a')]({'plain':!![]});_0x68691b=qs['omit'](_0x68691b,['id','createdAt',_0xadd7('0x4b')]);_0x384b3b[_0xadd7('0x4c')]=_[_0xadd7('0x4d')](_0x384b3b[_0xadd7('0x4c')],['id',_0xadd7('0x4e'),_0xadd7('0x4b')]);return db[_0xadd7('0x2f')][_0xadd7('0x4f')](_[_0xadd7('0x3f')](_0x68691b,_0x384b3b[_0xadd7('0x4c')]),{'include':_0x384b3b[_0xadd7('0x34')][_0xadd7('0x43')]?[{'all':!![]}]:undefined});}})[_0xadd7('0x29')](respondWithResult(_0x2bd23b,0xc9))[_0xadd7('0x50')](handleError(_0x2bd23b,null));};exports['update']=function(_0x3dfa66,_0x4fee20){if(_0x3dfa66[_0xadd7('0x4c')]['id']){delete _0x3dfa66['body']['id'];}return db[_0xadd7('0x2f')]['find']({'where':{'id':_0x3dfa66[_0xadd7('0x47')]['id']}})[_0xadd7('0x29')](handleEntityNotFound(_0x4fee20,null))['then'](saveUpdates(_0x3dfa66[_0xadd7('0x4c')],null))[_0xadd7('0x29')](respondWithResult(_0x4fee20,null))[_0xadd7('0x50')](handleError(_0x4fee20,null));};exports[_0xadd7('0x2a')]=function(_0x43381b,_0x1e3439){return db[_0xadd7('0x2f')][_0xadd7('0x49')]({'where':{'id':_0x43381b[_0xadd7('0x47')]['id']}})[_0xadd7('0x29')](handleEntityNotFound(_0x1e3439,null))[_0xadd7('0x29')](removeEntity(_0x1e3439,null))[_0xadd7('0x50')](handleError(_0x1e3439,null));};exports['create']=function(_0x58c2cf,_0x43c83a,_0x3ab7e5){_0x58c2cf[_0xadd7('0x4c')][_0xadd7('0x2c')]=_0x58c2cf[_0xadd7('0x51')][_0xadd7('0x52')];_0x58c2cf[_0xadd7('0x4c')]['basename']=_0x58c2cf['file']['filename'];_0x58c2cf['body'][_0xadd7('0x31')]=_0x58c2cf['file'][_0xadd7('0x53')];return db['Attachment'][_0xadd7('0x4f')](_0x58c2cf['body'])[_0xadd7('0x29')](respondWithResult(_0x43c83a,0xc9))[_0xadd7('0x50')](handleError(_0x43c83a,null));};exports['download']=function(_0x348436,_0x3240ca,_0x590a0c){return db[_0xadd7('0x2f')]['findOne']({'where':{'id':_0x348436['params']['id']},'raw':!![]})[_0xadd7('0x29')](handleEntityNotFound(_0x3240ca,null))['then'](function(_0x36f5d8){if(_0x36f5d8){var _0x14271a=_0x36f5d8[_0xadd7('0x54')]!==null;var _0x1607dc=path[_0xadd7('0x55')](config[_0xadd7('0x56')],_0xadd7('0x57'));if(_0x14271a){_0x1607dc=path[_0xadd7('0x55')](_0x1607dc,_0xadd7('0x58'));}var _0x4e4b55=path[_0xadd7('0x55')](_0x1607dc,_0x36f5d8[_0xadd7('0x59')]);return _0x3240ca[_0xadd7('0x5a')](_0x4e4b55);}})[_0xadd7('0x50')](handleError(_0x3240ca,null));}; \ No newline at end of file +var _0xdd60=['name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','Attachment','includeAll','include','findAll','rows','catch','show','params','keys','options','clone','find','get','updatedAt','body','omit','createdAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','status','end','error'];(function(_0x58b768,_0x27c50d){var _0x17d09d=function(_0x1b9566){while(--_0x1b9566){_0x58b768['push'](_0x58b768['shift']());}};_0x17d09d(++_0x27c50d);}(_0xdd60,0xe4));var _0x0dd6=function(_0x559587,_0x53504b){_0x559587=_0x559587-0x0;var _0x21f2b0=_0xdd60[_0x559587];return _0x21f2b0;};'use strict';var emlformat=require(_0x0dd6('0x0'));var rimraf=require(_0x0dd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd6('0x2'));var rp=require(_0x0dd6('0x3'));var moment=require(_0x0dd6('0x4'));var BPromise=require(_0x0dd6('0x5'));var Mustache=require(_0x0dd6('0x6'));var util=require(_0x0dd6('0x7'));var path=require('path');var sox=require(_0x0dd6('0x8'));var csv=require(_0x0dd6('0x9'));var ejs=require(_0x0dd6('0xa'));var fs=require('fs');var fs_extra=require(_0x0dd6('0xb'));var _=require('lodash');var squel=require(_0x0dd6('0xc'));var crypto=require(_0x0dd6('0xd'));var jsforce=require(_0x0dd6('0xe'));var deskjs=require(_0x0dd6('0xf'));var toCsv=require(_0x0dd6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0dd6('0x10'));var authService=require(_0x0dd6('0x11'));var qs=require(_0x0dd6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0dd6('0x13'));var utils=require(_0x0dd6('0x14'));var config=require(_0x0dd6('0x15'));var licenseUtil=require(_0x0dd6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4311e6,_0xd1c56b){_0xd1c56b=_0xd1c56b||0xcc;return function(_0x469a6d){if(_0x469a6d){return _0x4311e6[_0x0dd6('0x17')](_0xd1c56b);}return _0x4311e6['status'](_0xd1c56b)['end']();};}function respondWithResult(_0x44e3d3,_0x586acf){_0x586acf=_0x586acf||0xc8;return function(_0x283c82){if(_0x283c82){return _0x44e3d3['status'](_0x586acf)[_0x0dd6('0x18')](_0x283c82);}};}function respondWithFilteredResult(_0x56c8e1,_0x43e4){return function(_0x40c965){if(_0x40c965){var _0x4df0f3=typeof _0x43e4['offset']==='undefined'&&typeof _0x43e4[_0x0dd6('0x19')]===_0x0dd6('0x1a');var _0x230e26=_0x40c965[_0x0dd6('0x1b')];var _0x27b15d=_0x4df0f3?0x0:_0x43e4['offset'];var _0x2e389f=_0x4df0f3?_0x40c965[_0x0dd6('0x1b')]:_0x43e4['offset']+_0x43e4[_0x0dd6('0x19')];var _0x4260a3;if(_0x2e389f>=_0x230e26){_0x2e389f=_0x230e26;_0x4260a3=0xc8;}else{_0x4260a3=0xce;}_0x56c8e1['status'](_0x4260a3);return _0x56c8e1[_0x0dd6('0x1c')](_0x0dd6('0x1d'),_0x27b15d+'-'+_0x2e389f+'/'+_0x230e26)[_0x0dd6('0x18')](_0x40c965);}return null;};}function patchUpdates(_0x1d9a5b){return function(_0x312a95){try{jsonpatch[_0x0dd6('0x1e')](_0x312a95,_0x1d9a5b,!![]);}catch(_0x5b5042){return BPromise[_0x0dd6('0x1f')](_0x5b5042);}return _0x312a95[_0x0dd6('0x20')]();};}function saveUpdates(_0x77ec07,_0x3d1c0a){return function(_0x8ffaf5){if(_0x8ffaf5){return _0x8ffaf5[_0x0dd6('0x21')](_0x77ec07)[_0x0dd6('0x22')](function(_0xd27fb3){return _0xd27fb3;});}return null;};}function removeEntity(_0x4ef99e,_0x29030d){return function(_0x43576b){if(_0x43576b){return _0x43576b[_0x0dd6('0x23')]()['then'](function(){_0x4ef99e[_0x0dd6('0x24')](0xcc)[_0x0dd6('0x25')]();});}};}function handleEntityNotFound(_0x88381f,_0xa14859){return function(_0x171451){if(!_0x171451){_0x88381f[_0x0dd6('0x17')](0x194);}return _0x171451;};}function handleError(_0x445c6f,_0x242481){_0x242481=_0x242481||0x1f4;return function(_0x4879af){logger[_0x0dd6('0x26')](_0x4879af['stack']);if(_0x4879af[_0x0dd6('0x27')]){delete _0x4879af['name'];}_0x445c6f[_0x0dd6('0x24')](_0x242481)[_0x0dd6('0x28')](_0x4879af);};}exports['index']=function(_0x206232,_0x2f5e41){var _0x5c7581={},_0x328e3f={},_0x1e16d6={'count':0x0,'rows':[]};var _0x54fb55=_[_0x0dd6('0x29')](db['Attachment'][_0x0dd6('0x2a')],function(_0x1d64bd){return{'name':_0x1d64bd[_0x0dd6('0x2b')],'type':_0x1d64bd[_0x0dd6('0x2c')][_0x0dd6('0x2d')]};});_0x328e3f['model']=_[_0x0dd6('0x29')](_0x54fb55,_0x0dd6('0x27'));_0x328e3f[_0x0dd6('0x2e')]=_['keys'](_0x206232[_0x0dd6('0x2e')]);_0x328e3f[_0x0dd6('0x2f')]=_[_0x0dd6('0x30')](_0x328e3f[_0x0dd6('0x31')],_0x328e3f[_0x0dd6('0x2e')]);_0x5c7581['attributes']=_['intersection'](_0x328e3f['model'],qs[_0x0dd6('0x32')](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x5c7581[_0x0dd6('0x33')]=_0x5c7581[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x5c7581['attributes']:_0x328e3f[_0x0dd6('0x31')];if(!_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x35')]('nolimit')){_0x5c7581[_0x0dd6('0x19')]=qs['limit'](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x19')]);_0x5c7581[_0x0dd6('0x36')]=qs[_0x0dd6('0x36')](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x36')]);}_0x5c7581['order']=qs['sort'](_0x206232['query'][_0x0dd6('0x37')]);_0x5c7581[_0x0dd6('0x38')]=qs[_0x0dd6('0x2f')](_[_0x0dd6('0x39')](_0x206232[_0x0dd6('0x2e')],_0x328e3f[_0x0dd6('0x2f')]),_0x54fb55);if(_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x3a')]){_0x5c7581[_0x0dd6('0x38')]=_['merge'](_0x5c7581['where'],{'$or':_[_0x0dd6('0x29')](_0x54fb55,function(_0xbdc208){if(_0xbdc208[_0x0dd6('0x2c')]!=='VIRTUAL'){var _0x5c4e68={};_0x5c4e68[_0xbdc208['name']]={'$like':'%'+_0x206232['query'][_0x0dd6('0x3a')]+'%'};return _0x5c4e68;}})});}_0x5c7581=_[_0x0dd6('0x3b')]({},_0x5c7581,_0x206232['options']);var _0x477ecb={'where':_0x5c7581[_0x0dd6('0x38')]};return db[_0x0dd6('0x3c')][_0x0dd6('0x1b')](_0x477ecb)['then'](function(_0x4842f0){_0x1e16d6[_0x0dd6('0x1b')]=_0x4842f0;if(_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x3d')]){_0x5c7581[_0x0dd6('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x0dd6('0x3f')](_0x5c7581);})[_0x0dd6('0x22')](function(_0x223018){_0x1e16d6[_0x0dd6('0x40')]=_0x223018;return _0x1e16d6;})[_0x0dd6('0x22')](respondWithFilteredResult(_0x2f5e41,_0x5c7581))[_0x0dd6('0x41')](handleError(_0x2f5e41,null));};exports[_0x0dd6('0x42')]=function(_0x215ca9,_0xaa0c7){var _0x26270e={'raw':!![],'where':{'id':_0x215ca9[_0x0dd6('0x43')]['id']}},_0x20b0d6={};_0x20b0d6[_0x0dd6('0x31')]=_[_0x0dd6('0x44')](db['Attachment']['rawAttributes']);_0x20b0d6[_0x0dd6('0x2e')]=_[_0x0dd6('0x44')](_0x215ca9[_0x0dd6('0x2e')]);_0x20b0d6[_0x0dd6('0x2f')]=_[_0x0dd6('0x30')](_0x20b0d6[_0x0dd6('0x31')],_0x20b0d6[_0x0dd6('0x2e')]);_0x26270e[_0x0dd6('0x33')]=_['intersection'](_0x20b0d6['model'],qs[_0x0dd6('0x32')](_0x215ca9[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x26270e[_0x0dd6('0x33')]=_0x26270e[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x26270e[_0x0dd6('0x33')]:_0x20b0d6[_0x0dd6('0x31')];if(_0x215ca9[_0x0dd6('0x2e')]['includeAll']){_0x26270e['include']=[{'all':!![]}];}_0x26270e=_[_0x0dd6('0x3b')]({},_0x26270e,_0x215ca9[_0x0dd6('0x45')]);return db[_0x0dd6('0x3c')]['find'](_0x26270e)[_0x0dd6('0x22')](handleEntityNotFound(_0xaa0c7,null))[_0x0dd6('0x22')](respondWithResult(_0xaa0c7,null))[_0x0dd6('0x41')](handleError(_0xaa0c7,null));};exports[_0x0dd6('0x46')]=function(_0x594393,_0x420c23){var _0x18818a={'where':{'id':_0x594393['params']['id']}},_0xd0a2de={};_0xd0a2de[_0x0dd6('0x31')]=_[_0x0dd6('0x44')](db[_0x0dd6('0x3c')]['rawAttributes']);_0x18818a[_0x0dd6('0x33')]=_[_0x0dd6('0x30')](_0xd0a2de[_0x0dd6('0x31')],qs[_0x0dd6('0x32')](_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x18818a[_0x0dd6('0x33')]=_0x18818a[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x18818a[_0x0dd6('0x33')]:_0xd0a2de[_0x0dd6('0x31')];if(_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x3d')]){_0x18818a['include']=[{'all':!![]}];}_0x18818a=_['merge']({},_0x18818a,_0x594393['options']);return db['Attachment'][_0x0dd6('0x47')](_0x18818a)[_0x0dd6('0x22')](handleEntityNotFound(_0x420c23,null))[_0x0dd6('0x22')](function(_0x13a00b){if(_0x13a00b){var _0x5ac297=_0x13a00b[_0x0dd6('0x48')]({'plain':!![]});_0x5ac297=qs['omit'](_0x5ac297,['id','createdAt',_0x0dd6('0x49')]);_0x594393[_0x0dd6('0x4a')]=_[_0x0dd6('0x4b')](_0x594393[_0x0dd6('0x4a')],['id',_0x0dd6('0x4c'),'updatedAt']);return db['Attachment'][_0x0dd6('0x4d')](_[_0x0dd6('0x3b')](_0x5ac297,_0x594393['body']),{'include':_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x3d')]?[{'all':!![]}]:undefined});}})[_0x0dd6('0x22')](respondWithResult(_0x420c23,0xc9))['catch'](handleError(_0x420c23,null));};exports['update']=function(_0x5850df,_0x2c3754){if(_0x5850df[_0x0dd6('0x4a')]['id']){delete _0x5850df[_0x0dd6('0x4a')]['id'];}return db[_0x0dd6('0x3c')][_0x0dd6('0x47')]({'where':{'id':_0x5850df[_0x0dd6('0x43')]['id']}})[_0x0dd6('0x22')](handleEntityNotFound(_0x2c3754,null))[_0x0dd6('0x22')](saveUpdates(_0x5850df[_0x0dd6('0x4a')],null))[_0x0dd6('0x22')](respondWithResult(_0x2c3754,null))[_0x0dd6('0x41')](handleError(_0x2c3754,null));};exports['destroy']=function(_0x35e4f2,_0xc9b9b1){return db[_0x0dd6('0x3c')]['find']({'where':{'id':_0x35e4f2[_0x0dd6('0x43')]['id']}})['then'](handleEntityNotFound(_0xc9b9b1,null))[_0x0dd6('0x22')](removeEntity(_0xc9b9b1,null))['catch'](handleError(_0xc9b9b1,null));};exports['create']=function(_0x24b1d9,_0x126f5d,_0x2342a4){_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x27')]=_0x24b1d9[_0x0dd6('0x4e')][_0x0dd6('0x4f')];_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x50')]=_0x24b1d9[_0x0dd6('0x4e')][_0x0dd6('0x51')];_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x2c')]=_0x24b1d9['file'][_0x0dd6('0x52')];return db[_0x0dd6('0x3c')][_0x0dd6('0x4d')](_0x24b1d9[_0x0dd6('0x4a')])[_0x0dd6('0x22')](respondWithResult(_0x126f5d,0xc9))[_0x0dd6('0x41')](handleError(_0x126f5d,null));};exports[_0x0dd6('0x53')]=function(_0x3babc0,_0x23f7db,_0x37e7d8){return db[_0x0dd6('0x3c')][_0x0dd6('0x54')]({'where':{'id':_0x3babc0[_0x0dd6('0x43')]['id']},'raw':!![]})[_0x0dd6('0x22')](handleEntityNotFound(_0x23f7db,null))[_0x0dd6('0x22')](function(_0x5cdf1e){if(_0x5cdf1e){var _0x50a2e4=_0x5cdf1e[_0x0dd6('0x55')]!==null;var _0x4023a2=path[_0x0dd6('0x56')](config['root'],_0x0dd6('0x57'));if(_0x50a2e4){_0x4023a2=path[_0x0dd6('0x56')](_0x4023a2,_0x0dd6('0x58'));}var _0x39e954=path[_0x0dd6('0x56')](_0x4023a2,_0x5cdf1e['basename']);return _0x23f7db[_0x0dd6('0x53')](_0x39e954);}})[_0x0dd6('0x41')](handleError(_0x23f7db,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5ad9fed..f45d3ce 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 _0x7366=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','attachments','lodash','util'];(function(_0x3452e3,_0x1ba27c){var _0x4e6bd1=function(_0x3f46b1){while(--_0x3f46b1){_0x3452e3['push'](_0x3452e3['shift']());}};_0x4e6bd1(++_0x1ba27c);}(_0x7366,0xbe));var _0x6736=function(_0x7371d,_0x5d145a){_0x7371d=_0x7371d-0x0;var _0x238e70=_0x7366[_0x7371d];return _0x238e70;};'use strict';var _=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var logger=require(_0x6736('0x2'))(_0x6736('0x3'));var moment=require(_0x6736('0x4'));var BPromise=require(_0x6736('0x5'));var rp=require(_0x6736('0x6'));var fs=require('fs');var path=require(_0x6736('0x7'));var rimraf=require('rimraf');var config=require(_0x6736('0x8'));var attributes=require(_0x6736('0x9'));module[_0x6736('0xa')]=function(_0x7a70f9,_0x50c6b5){return _0x7a70f9['define']('Attachment',attributes,{'tableName':_0x6736('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3310=['path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise'];(function(_0x495c36,_0x4ada64){var _0x87e294=function(_0x3519d2){while(--_0x3519d2){_0x495c36['push'](_0x495c36['shift']());}};_0x87e294(++_0x4ada64);}(_0x3310,0x7c));var _0x0331=function(_0x2b3be8,_0x2356c3){_0x2b3be8=_0x2b3be8-0x0;var _0x5596d8=_0x3310[_0x2b3be8];return _0x5596d8;};'use strict';var _=require(_0x0331('0x0'));var util=require(_0x0331('0x1'));var logger=require('../../config/logger')(_0x0331('0x2'));var moment=require(_0x0331('0x3'));var BPromise=require(_0x0331('0x4'));var rp=require(_0x0331('0x5'));var fs=require('fs');var path=require(_0x0331('0x6'));var rimraf=require(_0x0331('0x7'));var config=require(_0x0331('0x8'));var attributes=require(_0x0331('0x9'));module['exports']=function(_0x4e5e8c,_0x541f97){return _0x4e5e8c[_0x0331('0xa')](_0x0331('0xb'),attributes,{'tableName':_0x0331('0xc'),'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 44d6cc5..8273eea 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 _0xe205=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateAttachment','Attachment','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x443093,_0x657163){var _0x5c9622=function(_0x1bb592){while(--_0x1bb592){_0x443093['push'](_0x443093['shift']());}};_0x5c9622(++_0x657163);}(_0xe205,0xa7));var _0x5e20=function(_0x4e5f0d,_0xac055e){_0x4e5f0d=_0x4e5f0d-0x0;var _0x52dcf6=_0xe205[_0x4e5f0d];return _0x52dcf6;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('Attachment,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('Attachment,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['create'](_0x1cc706[_0x5e20('0x1a')],{'raw':_0x1cc706[_0x5e20('0x1b')]?_0x1cc706[_0x5e20('0x1b')][_0x5e20('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2954fc){logger['info']('CreateAttachment',_0x1cc706);logger['debug']('CreateAttachment',_0x1cc706,JSON[_0x5e20('0x13')](_0x2954fc));_0x4d3e4a(_0x2954fc);})['catch'](function(_0x3d89e4){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x3d89e4[_0x5e20('0x16')],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x3d89e4[_0x5e20('0x16')]));});});}; \ No newline at end of file +var _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8e0d,0x82));var _0xd8e0=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x8e0d[_0x1c5142];return _0x1268cb;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1fc9ff1..b57dc92 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x49eb05,_0x4da739){var _0xcc2076=function(_0xb7d987){while(--_0xb7d987){_0x49eb05['push'](_0x49eb05['shift']());}};_0xcc2076(++_0x4da739);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e3e8d,_0x4b3914){_0x3e3e8d=_0x3e3e8d-0x0;var _0x3d51d4=_0x5f2f[_0x3e3e8d];return _0x3d51d4;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x242711,_0x44fbd3){var _0x45d109=function(_0x251dad){while(--_0x251dad){_0x242711['push'](_0x242711['shift']());}};_0x45d109(++_0x44fbd3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f98c0,_0x4ddddf){_0x1f98c0=_0x1f98c0-0x0;var _0x1cc656=_0xb10b[_0x1f98c0];return _0x1cc656;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 1673367..5c15922 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 _0xe700=['role','blocked','blockedAt','online','user','agent','disabled','add','minutes','clearBlockUser','getLicense','catch','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt'];(function(_0x6a371d,_0x539e2d){var _0x165a01=function(_0x3a3536){while(--_0x3a3536){_0x6a371d['push'](_0x6a371d['shift']());}};_0x165a01(++_0x539e2d);}(_0xe700,0x75));var _0x0e70=function(_0x591422,_0x3e498c){_0x591422=_0x591422-0x0;var _0x3ca6ce=_0xe700[_0x591422];return _0x3ca6ce;};'use strict';var passport=require(_0x0e70('0x0'));var LocalStrategy=require(_0x0e70('0x1'))[_0x0e70('0x2')];var moment=require(_0x0e70('0x3'));var ActiveDirectory=require(_0x0e70('0x4'));var BPromise=require(_0x0e70('0x5'));var util=require(_0x0e70('0x6'));var db=require(_0x0e70('0x7'))['db'];var authService=require(_0x0e70('0x8'));var utils=require(_0x0e70('0x9'));var config=require('../../config/environment');var logger=require(_0x0e70('0xa'))('api');function isActiveDirectoryConfigured(_0x44a1ee){var _0x30303a=![];if(typeof _0x44a1ee[_0x0e70('0xb')]!==_0x0e70('0xc')){_0x30303a=_0x44a1ee[_0x0e70('0xb')][_0x0e70('0xd')]&&_0x44a1ee[_0x0e70('0xb')][_0x0e70('0xe')]&&_0x44a1ee[_0x0e70('0xb')][_0x0e70('0xf')];}return _0x30303a;}function adAuthenticate(_0x1332a2,_0x32a108,_0x3240d5){return new BPromise(function(_0x1accbb,_0x8a3776){try{var _0x5c5673=new ActiveDirectory(_0x1332a2);_0x5c5673[_0x0e70('0x10')](_0x32a108,_0x3240d5,function(_0x145ae6,_0x2e31f3){if(_0x145ae6){logger['error'](_0x0e70('0x11'),_0x32a108,util[_0x0e70('0x12')](_0x145ae6,{'showHidden':![],'depth':null}));_0x8a3776(_0x0e70('0x13'));}else if(!_0x2e31f3){logger[_0x0e70('0x14')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x32a108);_0x8a3776(_0x0e70('0x13'));}else{_0x1accbb(_0x2e31f3);}});}catch(_0x175bca){_0x8a3776(_0x175bca);}});}function ActiveDirectoryAuthenticate(_0x30660e,_0x58a533,_0x5049ec,_0x1c427a){var _0x4b3e5f,_0x47446b;if(!isActiveDirectoryConfigured(config)){logger[_0x0e70('0x14')](_0x0e70('0x15'),_0x58a533);return _0x1c427a(null,![],{'message':_0x0e70('0x13')});}return db['Setting'][_0x0e70('0x16')]({'where':{'id':0x1},'attributes':[_0x0e70('0x17'),_0x0e70('0x18')],'raw':!![]})[_0x0e70('0x19')](function(_0x13ff53){_0x4b3e5f=_0x13ff53;if(!_0x4b3e5f[_0x0e70('0x17')]){logger['error'](_0x0e70('0x1a'),_0x58a533);throw new Error(_0x0e70('0x13'));}return _0x30660e['findOne']({'attributes':['id',_0x0e70('0x1b'),_0x0e70('0x1c'),_0x0e70('0x1d'),_0x0e70('0x1e'),'disabled',_0x0e70('0x1f'),_0x0e70('0x20'),_0x0e70('0x21')],'where':{'name':_0x58a533,'role':{'$or':['admin',_0x0e70('0x22'),_0x0e70('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x3b2d2a){if(!_0x3b2d2a||_0x3b2d2a&&_0x3b2d2a[_0x0e70('0x1b')]!==_0x58a533){throw new Error(_0x0e70('0x13'));}_0x47446b=_0x3b2d2a;var _0x15ee8c=_0x47446b[_0x0e70('0x1b')]+'@'+config[_0x0e70('0xb')][_0x0e70('0xf')];return adAuthenticate(config[_0x0e70('0xb')],_0x15ee8c,_0x5049ec);})[_0x0e70('0x19')](function(_0x1e81c5){if(_0x47446b[_0x0e70('0x24')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4b3e5f['blockDuration']>0x0){if(_0x47446b[_0x0e70('0x1f')]){if(moment(_0x47446b['blockedAt'])[_0x0e70('0x25')](_0x4b3e5f['blockDuration'],_0x0e70('0x26'))>moment()){throw new Error(_0x0e70('0x13'));}return utils[_0x0e70('0x27')](_0x47446b,0x0,![],null)[_0x0e70('0x19')](function(){return utils[_0x0e70('0x28')](_0x47446b);})[_0x0e70('0x19')](function(){return _0x1c427a(null,_0x47446b);});}else{return utils[_0x0e70('0x28')](_0x47446b)[_0x0e70('0x19')](function(){return _0x1c427a(null,_0x47446b);});}}else{return utils[_0x0e70('0x28')](_0x47446b)[_0x0e70('0x19')](function(){return _0x1c427a(null,_0x47446b);});}})[_0x0e70('0x29')](function(_0x132fe2){return _0x1c427a(null,![],_0x132fe2);});}function handleError(_0xa59504,_0x36bbc5,_0x5e7409){return _0xa59504['status'](_0x36bbc5||0x1f4)[_0x0e70('0x2a')]({'message':_0x5e7409?_0x5e7409[_0x0e70('0x2b')]||_0x5e7409:''});}exports['login']=function(_0x5c9c73,_0x16e6ae,_0xa6e8a3){passport[_0x0e70('0x10')](_0x0e70('0x2c'),function(_0x301383,_0x1498b1,_0x1e35d2){var _0x16cd39=_0x301383||_0x1e35d2;if(_0x16cd39){return handleError(_0x16e6ae,0x191,_0x16cd39);}if(!_0x1498b1){return handleError(_0x16e6ae,0x194,{'message':_0x0e70('0x2d')});}else{var _0xa71a83={'payload':{'id':_0x1498b1['id'],'role':_0x1498b1[_0x0e70('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0x0e70('0x2e')](_0xa71a83)['then'](function(_0x530138){_0x16e6ae[_0x0e70('0x2f')]({'id':_0x1498b1['id'],'token':_0x530138,'statusCall':'','isAlreadyLogged':_0x1498b1[_0x0e70('0x21')]});});}})(_0x5c9c73,_0x16e6ae,_0xa6e8a3);};passport[_0x0e70('0x30')](_0x0e70('0x2c'),new LocalStrategy({'usernameField':'name','passwordField':_0x0e70('0x1c')},function(_0x5f50dd,_0xbba7a0,_0xf7430){return ActiveDirectoryAuthenticate(db['User'],_0x5f50dd,_0xbba7a0,_0xf7430);})); \ No newline at end of file +var _0xa12e=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','agent','add','minutes','clearBlockUser','getLicense','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect'];(function(_0x291374,_0x1f67b3){var _0x5c62a9=function(_0x4dbf99){while(--_0x4dbf99){_0x291374['push'](_0x291374['shift']());}};_0x5c62a9(++_0x1f67b3);}(_0xa12e,0x138));var _0xea12=function(_0x14c358,_0x522070){_0x14c358=_0x14c358-0x0;var _0x33b11d=_0xa12e[_0x14c358];return _0x33b11d;};'use strict';var passport=require(_0xea12('0x0'));var LocalStrategy=require(_0xea12('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xea12('0x2'));var util=require(_0xea12('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xea12('0x4'));var utils=require(_0xea12('0x5'));var config=require(_0xea12('0x6'));var logger=require(_0xea12('0x7'))(_0xea12('0x8'));function isActiveDirectoryConfigured(_0x2904ef){var _0x2f325a=![];if(typeof _0x2904ef[_0xea12('0x9')]!==_0xea12('0xa')){_0x2f325a=_0x2904ef[_0xea12('0x9')][_0xea12('0xb')]&&_0x2904ef[_0xea12('0x9')]['url']&&_0x2904ef[_0xea12('0x9')][_0xea12('0xc')];}return _0x2f325a;}function adAuthenticate(_0x13bf70,_0x2398c6,_0x1dd0c6){return new BPromise(function(_0x1eccaf,_0x5494b6){try{var _0x2b65d9=new ActiveDirectory(_0x13bf70);_0x2b65d9[_0xea12('0xd')](_0x2398c6,_0x1dd0c6,function(_0x41c45b,_0x400ce4){if(_0x41c45b){logger[_0xea12('0xe')](_0xea12('0xf'),_0x2398c6,util[_0xea12('0x10')](_0x41c45b,{'showHidden':![],'depth':null}));_0x5494b6(_0xea12('0x11'));}else if(!_0x400ce4){logger[_0xea12('0xe')](_0xea12('0x12'),_0x2398c6);_0x5494b6(_0xea12('0x11'));}else{_0x1eccaf(_0x400ce4);}});}catch(_0x4d3b1d){_0x5494b6(_0x4d3b1d);}});}function ActiveDirectoryAuthenticate(_0x2d3ed6,_0x34aa8f,_0x351852,_0x4f07bb){var _0x369e9b,_0x4e5177;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xea12('0x13'),_0x34aa8f);return _0x4f07bb(null,![],{'message':_0xea12('0x11')});}return db[_0xea12('0x14')][_0xea12('0x15')]({'where':{'id':0x1},'attributes':[_0xea12('0x16'),_0xea12('0x17')],'raw':!![]})[_0xea12('0x18')](function(_0x33f3a5){_0x369e9b=_0x33f3a5;if(!_0x369e9b['adSsoEnabled']){logger['error'](_0xea12('0x19'),_0x34aa8f);throw new Error(_0xea12('0x11'));}return _0x2d3ed6[_0xea12('0x15')]({'attributes':['id',_0xea12('0x1a'),_0xea12('0x1b'),_0xea12('0x1c'),_0xea12('0x1d'),_0xea12('0x1e'),_0xea12('0x1f'),_0xea12('0x20'),_0xea12('0x21')],'where':{'name':_0x34aa8f,'role':{'$or':['admin','user',_0xea12('0x22')]},'adSsoEnabled':!![]}});})[_0xea12('0x18')](function(_0x4c6c39){if(!_0x4c6c39||_0x4c6c39&&_0x4c6c39[_0xea12('0x1a')]!==_0x34aa8f){throw new Error(_0xea12('0x11'));}_0x4e5177=_0x4c6c39;var _0x3b7a01=_0x4e5177[_0xea12('0x1a')]+'@'+config[_0xea12('0x9')]['domain'];return adAuthenticate(config[_0xea12('0x9')],_0x3b7a01,_0x351852);})['then'](function(_0x48104e){if(_0x4e5177['disabled']){throw new Error(_0xea12('0x11'));}if(_0x369e9b[_0xea12('0x17')]>0x0){if(_0x4e5177[_0xea12('0x1f')]){if(moment(_0x4e5177['blockedAt'])[_0xea12('0x23')](_0x369e9b[_0xea12('0x17')],_0xea12('0x24'))>moment()){throw new Error(_0xea12('0x11'));}return utils[_0xea12('0x25')](_0x4e5177,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4e5177);})[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}else{return utils['getLicense'](_0x4e5177)[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}}else{return utils[_0xea12('0x26')](_0x4e5177)[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}})['catch'](function(_0x212258){return _0x4f07bb(null,![],_0x212258);});}function handleError(_0x314ca2,_0x874216,_0x281971){return _0x314ca2[_0xea12('0x27')](_0x874216||0x1f4)[_0xea12('0x28')]({'message':_0x281971?_0x281971[_0xea12('0x29')]||_0x281971:''});}exports['login']=function(_0x14c404,_0xaf7b07,_0x4cf591){passport[_0xea12('0xd')]('ad-login',function(_0x4e8d21,_0x3decbc,_0x3b2ad9){var _0x569930=_0x4e8d21||_0x3b2ad9;if(_0x569930){return handleError(_0xaf7b07,0x191,_0x569930);}if(!_0x3decbc){return handleError(_0xaf7b07,0x194,{'message':_0xea12('0x2a')});}else{var _0x2b8c7f={'payload':{'id':_0x3decbc['id'],'role':_0x3decbc[_0xea12('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xea12('0x2b')](_0x2b8c7f)[_0xea12('0x18')](function(_0x3fc39c){_0xaf7b07[_0xea12('0x2c')]({'id':_0x3decbc['id'],'token':_0x3fc39c,'statusCall':'','isAlreadyLogged':_0x3decbc['online']});});}})(_0x14c404,_0xaf7b07,_0x4cf591);};passport[_0xea12('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xea12('0x1a'),'passwordField':_0xea12('0x1b')},function(_0xa44c3e,_0x3d2646,_0x507cb8){return ActiveDirectoryAuthenticate(db[_0xea12('0x2e')],_0xa44c3e,_0x3d2646,_0x507cb8);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index acb1f26..ec0fafd 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 _0x49e6=['express','./authActiveDirectory.controller','post','login','exports'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x49e6,0xd2));var _0x649e=function(_0x31a5db,_0xc073cc){_0x31a5db=_0x31a5db-0x0;var _0x59ffe1=_0x49e6[_0x31a5db];return _0x59ffe1;};'use strict';var express=require(_0x649e('0x0'));var router=express['Router']();var controller=require(_0x649e('0x1'));router[_0x649e('0x2')]('/',controller[_0x649e('0x3')]);module[_0x649e('0x4')]=router; \ No newline at end of file +var _0x0d1c=['./authActiveDirectory.controller','post','login'];(function(_0x20f0b0,_0x431f47){var _0x1c94a5=function(_0x5c2757){while(--_0x5c2757){_0x20f0b0['push'](_0x20f0b0['shift']());}};_0x1c94a5(++_0x431f47);}(_0x0d1c,0xed));var _0xc0d1=function(_0x45dbd5,_0x293cc4){_0x45dbd5=_0x45dbd5-0x0;var _0x393dfe=_0x0d1c[_0x45dbd5];return _0x393dfe;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xc0d1('0x0'));router[_0xc0d1('0x1')]('/',controller[_0xc0d1('0x2')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index dbbf653..47d3a04 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7a54,0x106));var _0x47a5=function(_0x562ba0,_0x52f234){_0x562ba0=_0x562ba0-0x0;var _0xd0a256=_0x7a54[_0x562ba0];return _0xd0a256;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x2f8801,_0x131c81){_0x2f8801=_0x2f8801-0x0;var _0x3358ea=_0x7a54[_0x2f8801];return _0x3358ea;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7befeb6..fe5ca57 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 _0x465b=['callback','isMiddleware','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x465b,0x1dc));var _0xb465=function(_0x6e96cb,_0x2c9290){_0x6e96cb=_0x6e96cb-0x0;var _0x399691=_0x465b[_0x6e96cb];return _0x399691;};'use strict';var express=require(_0xb465('0x0'));var passport=require(_0xb465('0x1'));var router=express['Router']();var controller=require(_0xb465('0x2'));var userController=require(_0xb465('0x3'));var authService=require(_0xb465('0x4'));router[_0xb465('0x5')]('/',controller[_0xb465('0x6')]);router['get'](_0xb465('0x7'),controller[_0xb465('0x8')],authService[_0xb465('0x9')],userController[_0xb465('0x6')],authService['setTokenCookie']);module[_0xb465('0xa')]=router; \ No newline at end of file +var _0x1c34=['setTokenCookie','exports','express','passport','./authGoogle.controller','get','login','/callback','callback'];(function(_0x401b51,_0x5a05c1){var _0x395ae6=function(_0x1337fa){while(--_0x1337fa){_0x401b51['push'](_0x401b51['shift']());}};_0x395ae6(++_0x5a05c1);}(_0x1c34,0x65));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x41c3('0x0'));var passport=require(_0x41c3('0x1'));var router=express['Router']();var controller=require(_0x41c3('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x41c3('0x3')]('/',controller[_0x41c3('0x4')]);router[_0x41c3('0x3')](_0x41c3('0x5'),controller[_0x41c3('0x6')],authService['isMiddleware'],userController[_0x41c3('0x4')],authService[_0x41c3('0x7')]);module[_0x41c3('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 baf59fd..502a4fd 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 _0xdec7=['generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','enforcePasswordHistory','validatePasswordHistory','previousPasswords','save','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','blocked','blockedAt','catch','MailAccount','find','email','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xdec7,0x1c0));var _0x7dec=function(_0x6cfa99,_0x513821){_0x6cfa99=_0x6cfa99-0x0;var _0x3d3555=_0xdec7[_0x6cfa99];return _0x3d3555;};'use strict';var util=require(_0x7dec('0x0'));var passport=require('passport');var LocalStrategy=require(_0x7dec('0x1'))['Strategy'];var jayson=require(_0x7dec('0x2'));var _=require(_0x7dec('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x7dec('0x4'))['db'];var authService=require(_0x7dec('0x5'));var utils=require(_0x7dec('0x6'));var client=jayson[_0x7dec('0x7')][_0x7dec('0x8')]({'port':0x232b});function localAuthenticate(_0x14ca92,_0xdce360,_0x165760,_0xf94e51){var _0x3b9985,_0xefe553;return db[_0x7dec('0x9')][_0x7dec('0xa')]({'where':{'id':0x1},'attributes':[_0x7dec('0xb'),_0x7dec('0xc')],'raw':!![]})[_0x7dec('0xd')](function(_0x3610cb){_0x3b9985=_0x3610cb;return _0x14ca92[_0x7dec('0xa')]({'attributes':['id',_0x7dec('0xe'),_0x7dec('0xf'),_0x7dec('0x10'),_0x7dec('0x11'),_0x7dec('0x12'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0xdce360,'role':{'$or':[_0x7dec('0x13'),'user',_0x7dec('0x14')]}}});})['then'](function(_0x5e3f4f){if(!_0x5e3f4f||_0x5e3f4f&&_0x5e3f4f['name']!==_0xdce360){throw new Error(_0x7dec('0x15'));}else{_0xefe553=_0x5e3f4f;return _0xefe553;}})[_0x7dec('0xd')](function(){_0xefe553[_0x7dec('0x16')](_0x165760,function(_0x233f0f,_0x4a2959){var _0x3e4745=_0xefe553[_0x7dec('0x17')]+0x1;if(_0x233f0f){return _0xf94e51(_0x233f0f);}else if(!_0x4a2959){if(_0xefe553[_0x7dec('0x12')]){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}else if(_0x3b9985[_0x7dec('0xb')]>0x0){if(_0xefe553['blocked']){if(_0x3b9985[_0x7dec('0xc')]>0x0){if(moment(_0xefe553['blockedAt'])[_0x7dec('0x18')](_0x3b9985['blockDuration'],_0x7dec('0x19'))>moment()){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}else{return utils[_0x7dec('0x1a')](_0xefe553,_0x3e4745,![],null)[_0x7dec('0xd')](function(){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});});}}else{return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}}else{if(_0x3e4745>=_0x3b9985[_0x7dec('0xb')]){return utils['clearBlockUser'](_0xefe553,0x0,!![],moment())[_0x7dec('0xd')](function(){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});});}else{return utils['clearBlockUser'](_0xefe553,_0x3e4745,![],null)[_0x7dec('0xd')](function(){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});});}}}else{return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}}else{if(_0xefe553['disabled']){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}else if(_0x3b9985[_0x7dec('0xb')]>0x0){if(_0xefe553[_0x7dec('0x1b')]){if(_0x3b9985[_0x7dec('0xc')]>0x0){if(moment(_0xefe553[_0x7dec('0x1c')])[_0x7dec('0x18')](_0x3b9985['blockDuration'],_0x7dec('0x19'))>moment()){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}else{return utils[_0x7dec('0x1a')](_0xefe553,0x0,![],null)[_0x7dec('0xd')](function(){return utils['getLicense'](_0xefe553);})[_0x7dec('0xd')](function(){return _0xf94e51(null,_0xefe553);});}}else{return _0xf94e51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7dec('0x1a')](_0xefe553,0x0,![],null)[_0x7dec('0xd')](function(){return utils['getLicense'](_0xefe553);})[_0x7dec('0xd')](function(){return _0xf94e51(null,_0xefe553);})['catch'](function(_0x357024){return _0xf94e51(null,![],_0x357024);});}}else{if(_0xefe553[_0x7dec('0x1b')]){return _0xf94e51(null,![],{'message':_0x7dec('0x15')});}else{return utils['getLicense'](_0xefe553)['then'](function(){return _0xf94e51(null,_0xefe553);});}}}});})[_0x7dec('0x1d')](function(_0x1b8b27){return _0xf94e51(null,![],_0x1b8b27);});}function sendServiceMail(_0x518213){return db[_0x7dec('0x1e')][_0x7dec('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x7dec('0xe'),_0x7dec('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x7dec('0x21'),'include':[{'model':db[_0x7dec('0x22')],'as':_0x7dec('0x22')}]}]})[_0x7dec('0xd')](function(_0x593b51){if(!_0x593b51){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3620dd=_0x593b51[_0x7dec('0x23')]();var _0x4560a8={'account':_0x3620dd,'message':_[_0x7dec('0x24')]({'from':util[_0x7dec('0x25')](_0x7dec('0x26'),_0x593b51[_0x7dec('0xe')],_0x593b51[_0x7dec('0x20')]||_0x593b51[_0x7dec('0x21')][_0x7dec('0x27')])},_0x518213)};return client[_0x7dec('0x28')](_0x7dec('0x29'),_0x4560a8);})[_0x7dec('0xd')](function(_0x1476bc){if(_0x1476bc[_0x7dec('0x2a')]){throw new Error(util[_0x7dec('0x25')](_0x7dec('0x2b'),_0x1476bc['error'][_0x7dec('0x2c')]||JSON[_0x7dec('0x2d')](_0x1476bc[_0x7dec('0x2a')])));}return!![];});}function handleError(_0x35159c,_0x4cd4de,_0x211404){return _0x35159c['status'](_0x4cd4de||0x1f4)[_0x7dec('0x2e')]({'message':_0x211404?_0x211404[_0x7dec('0x2c')]||_0x211404:''});}exports[_0x7dec('0x2f')]=function(_0x67ebe5,_0x57df8e,_0x1d2086){passport[_0x7dec('0x16')](_0x7dec('0x30'),function(_0x6a2a5c,_0x424c69,_0x5c5339){var _0x20ba17=_0x6a2a5c||_0x5c5339;if(_0x20ba17){return handleError(_0x57df8e,0x191,_0x20ba17);}if(!_0x424c69){return handleError(_0x57df8e,0x194,{'message':_0x7dec('0x31')});}else{var _0x2f92e8={'payload':{'id':_0x424c69['id'],'role':_0x424c69[_0x7dec('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x7dec('0x32')](_0x2f92e8)[_0x7dec('0xd')](function(_0x148d3b){_0x57df8e[_0x7dec('0x33')]({'id':_0x424c69['id'],'token':_0x148d3b,'statusCall':'','isAlreadyLogged':_0x424c69[_0x7dec('0x34')]});});}})(_0x67ebe5,_0x57df8e,_0x1d2086);};exports[_0x7dec('0x35')]=function(_0xa73c05,_0xfd658a){if(!_0xa73c05[_0x7dec('0x36')][_0x7dec('0x20')]){return handleError(_0xfd658a,0x1f4,{'message':_0x7dec('0x37')});}var _0x5d830d=rs[_0x7dec('0x38')]();_0xa73c05[_0x7dec('0x36')][_0x7dec('0x20')]=_0xa73c05['body'][_0x7dec('0x20')]['trim']()[_0x7dec('0x39')]();var _0x5a5b10;return db['Setting'][_0x7dec('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7dec('0xc')],'raw':!![]})['then'](function(_0x123ddd){_0x5a5b10=_0x123ddd;return db[_0x7dec('0x3a')][_0x7dec('0x1f')]({'where':{'email':_0xa73c05[_0x7dec('0x36')]['email']}});})[_0x7dec('0xd')](function(_0x1df28a){if(!_0x1df28a){throw new Error(_0x7dec('0x3b'));}if(_0x1df28a[_0x7dec('0x12')]){throw new Error(_0x7dec('0x3c'));}if(_0x1df28a['blocked']){if(moment(_0x1df28a[_0x7dec('0x1c')])[_0x7dec('0x18')](_0x5a5b10[_0x7dec('0xc')],_0x7dec('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1df28a['blocked']=![];_0x1df28a['blockedAt']=null;}}_0x1df28a[_0x7dec('0x3d')]=_0x5d830d;_0x1df28a[_0x7dec('0x3e')]=Date[_0x7dec('0x3f')]()+0x36ee80;return _0x1df28a['save']();})[_0x7dec('0xd')](function(){return sendServiceMail({'to':_0xa73c05[_0x7dec('0x36')][_0x7dec('0x20')],'subject':_0x7dec('0x40'),'text':_0x7dec('0x41')+_0x7dec('0x42')+'https://'+_0xa73c05[_0x7dec('0x43')]['host']+_0x7dec('0x44')+_0x5d830d+'\x0a\x0a'+_0x7dec('0x45')});})['then'](function(){_0xfd658a[_0x7dec('0x46')](0xc8)[_0x7dec('0x2e')]({'message':_0x7dec('0x47')});})[_0x7dec('0x1d')](function(_0x1004ff){return handleError(_0xfd658a,0x1f4,_0x1004ff);});};exports[_0x7dec('0x48')]=function(_0x5e50f0,_0x2d5c29){return db[_0x7dec('0x3a')][_0x7dec('0x1f')]({'where':{'resetPasswordToken':_0x5e50f0[_0x7dec('0x49')][_0x7dec('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x7dec('0x3f')]()}}})[_0x7dec('0xd')](function(_0x17bae4){if(!_0x17bae4){throw new Error(_0x7dec('0x4b'));}return db[_0x7dec('0x9')][_0x7dec('0xa')]({'attributes':['id',_0x7dec('0x4c'),'enforcePasswordHistory',_0x7dec('0x4d')]})[_0x7dec('0xd')](function(_0x704590){if(_0x704590['securePassword'])authService['validatePasswordPattern'](_0x5e50f0['body']['password']);if(!_0x704590[_0x7dec('0x4e')]||!_0x17bae4['previousPasswords'])return _0x17bae4;authService[_0x7dec('0x4f')](_0x5e50f0[_0x7dec('0x36')][_0x7dec('0xf')],_0x17bae4[_0x7dec('0x50')],_0x704590['passwordHistoryLimit']);return _0x17bae4;})[_0x7dec('0xd')](function(){_0x17bae4[_0x7dec('0xf')]=_0x5e50f0[_0x7dec('0x36')][_0x7dec('0xf')];_0x17bae4['resetPasswordToken']=null;_0x17bae4['resetPasswordExpires']=null;return _0x17bae4[_0x7dec('0x51')]();});})[_0x7dec('0xd')](function(){_0x2d5c29['status'](0xc8)[_0x7dec('0x2e')]({'message':_0x7dec('0x52')});})[_0x7dec('0x1d')](function(_0x5662e9){return handleError(_0x2d5c29,0x1f4,_0x5662e9);});};passport[_0x7dec('0x53')]('local-login',new LocalStrategy({'usernameField':_0x7dec('0xe'),'passwordField':_0x7dec('0xf')},function(_0x18b230,_0x38e2d5,_0x191b37){return localAuthenticate(db[_0x7dec('0x3a')],_0x18b230,_0x38e2d5,_0x191b37);})); \ No newline at end of file +var _0x6f05=['Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','disabled','blockedAt','loginAttempts','admin','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','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','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','passwordHistoryLimit','resetPasswordToken','send','Password\x20reset!','use','util','passport'];(function(_0x14259b,_0x588942){var _0x5d87fa=function(_0x2164e9){while(--_0x2164e9){_0x14259b['push'](_0x14259b['shift']());}};_0x5d87fa(++_0x588942);}(_0x6f05,0x19d));var _0x56f0=function(_0x278ab8,_0x16c13f){_0x278ab8=_0x278ab8-0x0;var _0x3995c7=_0x6f05[_0x278ab8];return _0x3995c7;};'use strict';var util=require(_0x56f0('0x0'));var passport=require(_0x56f0('0x1'));var LocalStrategy=require('passport-local')[_0x56f0('0x2')];var jayson=require(_0x56f0('0x3'));var _=require(_0x56f0('0x4'));var rs=require(_0x56f0('0x5'));var moment=require(_0x56f0('0x6'));var db=require(_0x56f0('0x7'))['db'];var authService=require(_0x56f0('0x8'));var utils=require('../../config/utils');var client=jayson['client'][_0x56f0('0x9')]({'port':0x232b});function localAuthenticate(_0x3db8c1,_0x7a7753,_0x280863,_0x28ded5){var _0x4a9abf,_0x3891f2;return db[_0x56f0('0xa')][_0x56f0('0xb')]({'where':{'id':0x1},'attributes':[_0x56f0('0xc'),_0x56f0('0xd')],'raw':!![]})[_0x56f0('0xe')](function(_0x1a47f4){_0x4a9abf=_0x1a47f4;return _0x3db8c1[_0x56f0('0xb')]({'attributes':['id','name','password','salt','role',_0x56f0('0xf'),'blocked',_0x56f0('0x10'),_0x56f0('0x11')],'where':{'name':_0x7a7753,'role':{'$or':[_0x56f0('0x12'),'user',_0x56f0('0x13')]}}});})[_0x56f0('0xe')](function(_0x5aadc7){if(!_0x5aadc7||_0x5aadc7&&_0x5aadc7['name']!==_0x7a7753){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3891f2=_0x5aadc7;return _0x3891f2;}})[_0x56f0('0xe')](function(){_0x3891f2[_0x56f0('0x14')](_0x280863,function(_0x2be8c7,_0x4b3b7f){var _0x5add3d=_0x3891f2['loginAttempts']+0x1;if(_0x2be8c7){return _0x28ded5(_0x2be8c7);}else if(!_0x4b3b7f){if(_0x3891f2[_0x56f0('0xf')]){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else if(_0x4a9abf[_0x56f0('0xc')]>0x0){if(_0x3891f2[_0x56f0('0x16')]){if(_0x4a9abf[_0x56f0('0xd')]>0x0){if(moment(_0x3891f2['blockedAt'])['add'](_0x4a9abf[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else{return utils[_0x56f0('0x18')](_0x3891f2,_0x5add3d,![],null)['then'](function(){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}}else{if(_0x5add3d>=_0x4a9abf[_0x56f0('0xc')]){return utils[_0x56f0('0x18')](_0x3891f2,0x0,!![],moment())['then'](function(){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});});}else{return utils[_0x56f0('0x18')](_0x3891f2,_0x5add3d,![],null)[_0x56f0('0xe')](function(){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3891f2['disabled']){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else if(_0x4a9abf['allowedLoginAttempts']>0x0){if(_0x3891f2[_0x56f0('0x16')]){if(_0x4a9abf[_0x56f0('0xd')]>0x0){if(moment(_0x3891f2[_0x56f0('0x10')])['add'](_0x4a9abf[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else{return utils['clearBlockUser'](_0x3891f2,0x0,![],null)[_0x56f0('0xe')](function(){return utils[_0x56f0('0x19')](_0x3891f2);})[_0x56f0('0xe')](function(){return _0x28ded5(null,_0x3891f2);});}}else{return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}}else{return utils[_0x56f0('0x18')](_0x3891f2,0x0,![],null)['then'](function(){return utils[_0x56f0('0x19')](_0x3891f2);})['then'](function(){return _0x28ded5(null,_0x3891f2);})[_0x56f0('0x1a')](function(_0xed53dd){return _0x28ded5(null,![],_0xed53dd);});}}else{if(_0x3891f2[_0x56f0('0x16')]){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x56f0('0x19')](_0x3891f2)[_0x56f0('0xe')](function(){return _0x28ded5(null,_0x3891f2);});}}}});})[_0x56f0('0x1a')](function(_0x4f6044){return _0x28ded5(null,![],_0x4f6044);});}function sendServiceMail(_0x1062ec){return db[_0x56f0('0x1b')][_0x56f0('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x56f0('0x1d'),_0x56f0('0x1e')],'include':[{'model':db[_0x56f0('0x1f')],'as':_0x56f0('0x20'),'include':[{'model':db[_0x56f0('0x21')],'as':'CloudProvider'}]}]})[_0x56f0('0xe')](function(_0x57646f){if(!_0x57646f){throw new Error(_0x56f0('0x22'));}var _0x4886ff=_0x57646f[_0x56f0('0x23')]();var _0x2bf235={'account':_0x4886ff,'message':_[_0x56f0('0x24')]({'from':util[_0x56f0('0x25')](_0x56f0('0x26'),_0x57646f[_0x56f0('0x1d')],_0x57646f[_0x56f0('0x1e')]||_0x57646f[_0x56f0('0x20')]['user'])},_0x1062ec)};return client[_0x56f0('0x27')]('SendMail',_0x2bf235);})[_0x56f0('0xe')](function(_0x25fd0e){if(_0x25fd0e[_0x56f0('0x28')]){throw new Error(util[_0x56f0('0x25')](_0x56f0('0x29'),_0x25fd0e[_0x56f0('0x28')][_0x56f0('0x2a')]||JSON['stringify'](_0x25fd0e[_0x56f0('0x28')])));}return!![];});}function handleError(_0x3c4a8,_0x14dd57,_0x1e6ecf){return _0x3c4a8[_0x56f0('0x2b')](_0x14dd57||0x1f4)['send']({'message':_0x1e6ecf?_0x1e6ecf[_0x56f0('0x2a')]||_0x1e6ecf:''});}exports[_0x56f0('0x2c')]=function(_0x22f597,_0x5caf6d,_0x53f5ef){passport[_0x56f0('0x14')](_0x56f0('0x2d'),function(_0x46473b,_0x2a0184,_0xff3266){var _0x14e204=_0x46473b||_0xff3266;if(_0x14e204){return handleError(_0x5caf6d,0x191,_0x14e204);}if(!_0x2a0184){return handleError(_0x5caf6d,0x194,{'message':_0x56f0('0x2e')});}else{var _0xaadca1={'payload':{'id':_0x2a0184['id'],'role':_0x2a0184[_0x56f0('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0x56f0('0x30')](_0xaadca1)[_0x56f0('0xe')](function(_0x4ada2e){_0x5caf6d['json']({'id':_0x2a0184['id'],'token':_0x4ada2e,'statusCall':'','isAlreadyLogged':_0x2a0184[_0x56f0('0x31')]});});}})(_0x22f597,_0x5caf6d,_0x53f5ef);};exports['forgot']=function(_0x34d1f2,_0x1b922f){if(!_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]){return handleError(_0x1b922f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xe945c2=rs[_0x56f0('0x33')]();_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]=_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')][_0x56f0('0x34')]()[_0x56f0('0x35')]();var _0x2137be;return db[_0x56f0('0xa')][_0x56f0('0xb')]({'where':{'id':0x1},'attributes':[_0x56f0('0xc'),'blockDuration'],'raw':!![]})[_0x56f0('0xe')](function(_0x1c25de){_0x2137be=_0x1c25de;return db[_0x56f0('0x36')][_0x56f0('0x1c')]({'where':{'email':_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]}});})[_0x56f0('0xe')](function(_0x136b2f){if(!_0x136b2f){throw new Error(_0x56f0('0x37'));}if(_0x136b2f[_0x56f0('0xf')]){throw new Error(_0x56f0('0x38'));}if(_0x136b2f[_0x56f0('0x16')]){if(moment(_0x136b2f[_0x56f0('0x10')])[_0x56f0('0x39')](_0x2137be[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){throw new Error(_0x56f0('0x3a'));}else{_0x136b2f['blocked']=![];_0x136b2f['blockedAt']=null;}}_0x136b2f['resetPasswordToken']=_0xe945c2;_0x136b2f[_0x56f0('0x3b')]=Date['now']()+0x36ee80;return _0x136b2f[_0x56f0('0x3c')]();})['then'](function(){return sendServiceMail({'to':_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x56f0('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x56f0('0x3e')+_0x34d1f2[_0x56f0('0x3f')]['host']+_0x56f0('0x40')+_0xe945c2+'\x0a\x0a'+_0x56f0('0x41')});})['then'](function(){_0x1b922f[_0x56f0('0x2b')](0xc8)['send']({'message':_0x56f0('0x42')});})[_0x56f0('0x1a')](function(_0x5bdd2d){return handleError(_0x1b922f,0x1f4,_0x5bdd2d);});};exports[_0x56f0('0x43')]=function(_0x400ce7,_0xb433a4){return db[_0x56f0('0x36')][_0x56f0('0x1c')]({'where':{'resetPasswordToken':_0x400ce7[_0x56f0('0x44')][_0x56f0('0x45')],'resetPasswordExpires':{'$gt':Date[_0x56f0('0x46')]()}}})['then'](function(_0x1701b7){if(!_0x1701b7){throw new Error(_0x56f0('0x47'));}return db['Setting']['findOne']({'attributes':['id',_0x56f0('0x48'),_0x56f0('0x49'),'passwordHistoryLimit']})[_0x56f0('0xe')](function(_0xc19e37){if(_0xc19e37[_0x56f0('0x48')])authService[_0x56f0('0x4a')](_0x400ce7[_0x56f0('0x32')]['password']);if(!_0xc19e37['enforcePasswordHistory']||!_0x1701b7[_0x56f0('0x4b')])return _0x1701b7;authService[_0x56f0('0x4c')](_0x400ce7[_0x56f0('0x32')][_0x56f0('0x4d')],_0x1701b7['previousPasswords'],_0xc19e37[_0x56f0('0x4e')]);return _0x1701b7;})['then'](function(){_0x1701b7[_0x56f0('0x4d')]=_0x400ce7[_0x56f0('0x32')]['password'];_0x1701b7[_0x56f0('0x4f')]=null;_0x1701b7[_0x56f0('0x3b')]=null;return _0x1701b7[_0x56f0('0x3c')]();});})[_0x56f0('0xe')](function(){_0xb433a4[_0x56f0('0x2b')](0xc8)[_0x56f0('0x50')]({'message':_0x56f0('0x51')});})[_0x56f0('0x1a')](function(_0x3114e5){return handleError(_0xb433a4,0x1f4,_0x3114e5);});};passport[_0x56f0('0x52')](_0x56f0('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0x56f0('0x4d')},function(_0x4cc98b,_0x54d95b,_0x43159b){return localAuthenticate(db[_0x56f0('0x36')],_0x4cc98b,_0x54d95b,_0x43159b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index feba6dd..e068f45 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 _0xd397=['post','forgot','/reset/:token','exports','express','Router','./authLocal.controller'];(function(_0x3b05bc,_0x557573){var _0x2c8f51=function(_0x45afb7){while(--_0x45afb7){_0x3b05bc['push'](_0x3b05bc['shift']());}};_0x2c8f51(++_0x557573);}(_0xd397,0xcf));var _0x7d39=function(_0x3f8314,_0x165b04){_0x3f8314=_0x3f8314-0x0;var _0x515a78=_0xd397[_0x3f8314];return _0x515a78;};'use strict';var express=require(_0x7d39('0x0'));var router=express[_0x7d39('0x1')]();var controller=require(_0x7d39('0x2'));router['post']('/',controller['login']);router[_0x7d39('0x3')]('/forgot',controller[_0x7d39('0x4')]);router[_0x7d39('0x3')](_0x7d39('0x5'),controller['reset']);module[_0x7d39('0x6')]=router; \ No newline at end of file +var _0x9004=['express','Router','./authLocal.controller','post','login','/reset/:token','exports'];(function(_0x571541,_0x3b6dc0){var _0x2a729f=function(_0x12c1ee){while(--_0x12c1ee){_0x571541['push'](_0x571541['shift']());}};_0x2a729f(++_0x3b6dc0);}(_0x9004,0x196));var _0x4900=function(_0x21949d,_0x220ac2){_0x21949d=_0x21949d-0x0;var _0x3989d8=_0x9004[_0x21949d];return _0x3989d8;};'use strict';var express=require(_0x4900('0x0'));var router=express[_0x4900('0x1')]();var controller=require(_0x4900('0x2'));router[_0x4900('0x3')]('/',controller[_0x4900('0x4')]);router['post']('/forgot',controller['forgot']);router[_0x4900('0x3')](_0x4900('0x5'),controller['reset']);module[_0x4900('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 890c478..1e8430d 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 _0xccf7=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1999c4,_0x39059f){var _0x4afd7d=function(_0x846a7a){while(--_0x846a7a){_0x1999c4['push'](_0x1999c4['shift']());}};_0x4afd7d(++_0x39059f);}(_0xccf7,0xd7));var _0x7ccf=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0xccf7[_0x16938f];return _0x5c66e9;};'use strict';var Sequelize=require(_0x7ccf('0x0'));module[_0x7ccf('0x1')]={'name':{'type':Sequelize[_0x7ccf('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7ccf('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7ccf('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7ccf('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb8f4=['exports','STRING','sequelize'];(function(_0x200c4c,_0x3fb6d3){var _0x3c43c9=function(_0x2af216){while(--_0x2af216){_0x200c4c['push'](_0x200c4c['shift']());}};_0x3c43c9(++_0x3fb6d3);}(_0xb8f4,0x104));var _0x4b8f=function(_0x2fc4b4,_0x243370){_0x2fc4b4=_0x2fc4b4-0x0;var _0x346113=_0xb8f4[_0x2fc4b4];return _0x346113;};'use strict';var Sequelize=require(_0x4b8f('0x0'));module[_0x4b8f('0x1')]={'name':{'type':Sequelize[_0x4b8f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b8f('0x2')]},'description':{'type':Sequelize[_0x4b8f('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 3136829..7e2f28c 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 _0xa4c4=['ids','Condition','nolimit','getConditions','addActions','Action','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','addConditions','omit'];(function(_0x403328,_0x519fb9){var _0x3e3162=function(_0x5d3bd9){while(--_0x5d3bd9){_0x403328['push'](_0x403328['shift']());}};_0x3e3162(++_0x519fb9);}(_0xa4c4,0x163));var _0x4a4c=function(_0x4037ac,_0x260423){_0x4037ac=_0x4037ac-0x0;var _0x1d17b5=_0xa4c4[_0x4037ac];return _0x1d17b5;};'use strict';var emlformat=require(_0x4a4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a4c('0x1'));var jsonpatch=require(_0x4a4c('0x2'));var rp=require(_0x4a4c('0x3'));var moment=require(_0x4a4c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a4c('0x5'));var util=require(_0x4a4c('0x6'));var path=require(_0x4a4c('0x7'));var sox=require(_0x4a4c('0x8'));var csv=require('to-csv');var ejs=require(_0x4a4c('0x9'));var fs=require('fs');var fs_extra=require(_0x4a4c('0xa'));var _=require(_0x4a4c('0xb'));var squel=require(_0x4a4c('0xc'));var crypto=require(_0x4a4c('0xd'));var jsforce=require(_0x4a4c('0xe'));var deskjs=require(_0x4a4c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a4c('0x10'));var Papa=require('papaparse');var Redis=require(_0x4a4c('0x11'));var authService=require(_0x4a4c('0x12'));var qs=require(_0x4a4c('0x13'));var as=require(_0x4a4c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a4c('0x15'))(_0x4a4c('0x16'));var utils=require(_0x4a4c('0x17'));var config=require(_0x4a4c('0x18'));var licenseUtil=require(_0x4a4c('0x19'));var db=require(_0x4a4c('0x1a'))['db'];function respondWithStatusCode(_0x3dfce4,_0xb7c1ff){_0xb7c1ff=_0xb7c1ff||0xcc;return function(_0x1c5d5a){if(_0x1c5d5a){return _0x3dfce4[_0x4a4c('0x1b')](_0xb7c1ff);}return _0x3dfce4[_0x4a4c('0x1c')](_0xb7c1ff)[_0x4a4c('0x1d')]();};}function respondWithResult(_0xbd55a8,_0x22b0b5){_0x22b0b5=_0x22b0b5||0xc8;return function(_0x1c6261){if(_0x1c6261){return _0xbd55a8[_0x4a4c('0x1c')](_0x22b0b5)['json'](_0x1c6261);}};}function respondWithFilteredResult(_0x394e82,_0xb427af){return function(_0x478df3){if(_0x478df3){var _0x2c95bd=typeof _0xb427af[_0x4a4c('0x1e')]===_0x4a4c('0x1f')&&typeof _0xb427af[_0x4a4c('0x20')]===_0x4a4c('0x1f');var _0x5462b1=_0x478df3[_0x4a4c('0x21')];var _0x374f9f=_0x2c95bd?0x0:_0xb427af[_0x4a4c('0x1e')];var _0x79eaa7=_0x2c95bd?_0x478df3[_0x4a4c('0x21')]:_0xb427af[_0x4a4c('0x1e')]+_0xb427af[_0x4a4c('0x20')];var _0x115fa3;if(_0x79eaa7>=_0x5462b1){_0x79eaa7=_0x5462b1;_0x115fa3=0xc8;}else{_0x115fa3=0xce;}_0x394e82['status'](_0x115fa3);return _0x394e82['set'](_0x4a4c('0x22'),_0x374f9f+'-'+_0x79eaa7+'/'+_0x5462b1)[_0x4a4c('0x23')](_0x478df3);}return null;};}function patchUpdates(_0x2dcb69){return function(_0x10b9ea){try{jsonpatch['apply'](_0x10b9ea,_0x2dcb69,!![]);}catch(_0x80284f){return BPromise[_0x4a4c('0x24')](_0x80284f);}return _0x10b9ea[_0x4a4c('0x25')]();};}function saveUpdates(_0x25e59d,_0x46ce64){return function(_0x13b723){if(_0x13b723){return _0x13b723[_0x4a4c('0x26')](_0x25e59d)['then'](function(_0xbd696e){return _0xbd696e;});}return null;};}function removeEntity(_0x18685e,_0x4662b9){return function(_0x5d9ab8){if(_0x5d9ab8){return _0x5d9ab8[_0x4a4c('0x27')]()[_0x4a4c('0x28')](function(){_0x18685e[_0x4a4c('0x1c')](0xcc)[_0x4a4c('0x1d')]();});}};}function handleEntityNotFound(_0x591885,_0x13819f){return function(_0x55f01d){if(!_0x55f01d){_0x591885[_0x4a4c('0x1b')](0x194);}return _0x55f01d;};}function handleError(_0x4b56cb,_0x244632){_0x244632=_0x244632||0x1f4;return function(_0x457be4){logger[_0x4a4c('0x29')](_0x457be4['stack']);if(_0x457be4[_0x4a4c('0x2a')]){delete _0x457be4[_0x4a4c('0x2a')];}_0x4b56cb['status'](_0x244632)[_0x4a4c('0x2b')](_0x457be4);};}exports[_0x4a4c('0x2c')]=function(_0x2e32ac,_0x46a1fa){var _0x1f9ead={},_0x2ae116={},_0x48c995={'count':0x0,'rows':[]};var _0x80922f=_[_0x4a4c('0x2d')](db[_0x4a4c('0x2e')][_0x4a4c('0x2f')],function(_0xeb943){return{'name':_0xeb943[_0x4a4c('0x30')],'type':_0xeb943[_0x4a4c('0x31')][_0x4a4c('0x32')]};});_0x2ae116['model']=_['map'](_0x80922f,_0x4a4c('0x2a'));_0x2ae116[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x2e32ac[_0x4a4c('0x33')]);_0x2ae116['filters']=_[_0x4a4c('0x35')](_0x2ae116[_0x4a4c('0x36')],_0x2ae116[_0x4a4c('0x33')]);_0x1f9ead[_0x4a4c('0x37')]=_[_0x4a4c('0x35')](_0x2ae116['model'],qs[_0x4a4c('0x38')](_0x2e32ac[_0x4a4c('0x33')]['fields']));_0x1f9ead[_0x4a4c('0x37')]=_0x1f9ead['attributes'][_0x4a4c('0x39')]?_0x1f9ead[_0x4a4c('0x37')]:_0x2ae116[_0x4a4c('0x36')];if(!_0x2e32ac[_0x4a4c('0x33')][_0x4a4c('0x3a')]('nolimit')){_0x1f9ead[_0x4a4c('0x20')]=qs['limit'](_0x2e32ac[_0x4a4c('0x33')][_0x4a4c('0x20')]);_0x1f9ead[_0x4a4c('0x1e')]=qs[_0x4a4c('0x1e')](_0x2e32ac[_0x4a4c('0x33')][_0x4a4c('0x1e')]);}_0x1f9ead[_0x4a4c('0x3b')]=qs[_0x4a4c('0x3c')](_0x2e32ac[_0x4a4c('0x33')][_0x4a4c('0x3c')]);_0x1f9ead[_0x4a4c('0x3d')]=qs[_0x4a4c('0x3e')](_[_0x4a4c('0x3f')](_0x2e32ac[_0x4a4c('0x33')],_0x2ae116[_0x4a4c('0x3e')]),_0x80922f);if(_0x2e32ac[_0x4a4c('0x33')]['filter']){_0x1f9ead[_0x4a4c('0x3d')]=_[_0x4a4c('0x40')](_0x1f9ead['where'],{'$or':_[_0x4a4c('0x2d')](_0x80922f,function(_0xd2ce76){if(_0xd2ce76[_0x4a4c('0x31')]!==_0x4a4c('0x41')){var _0x4f266b={};_0x4f266b[_0xd2ce76[_0x4a4c('0x2a')]]={'$like':'%'+_0x2e32ac[_0x4a4c('0x33')][_0x4a4c('0x42')]+'%'};return _0x4f266b;}})});}_0x1f9ead=_['merge']({},_0x1f9ead,_0x2e32ac['options']);var _0x2c306c={'where':_0x1f9ead['where']};return db[_0x4a4c('0x2e')][_0x4a4c('0x21')](_0x2c306c)['then'](function(_0x1061f6){_0x48c995[_0x4a4c('0x21')]=_0x1061f6;if(_0x2e32ac[_0x4a4c('0x33')]['includeAll']){_0x1f9ead[_0x4a4c('0x43')]=[{'all':!![]}];}return db[_0x4a4c('0x2e')][_0x4a4c('0x44')](_0x1f9ead);})[_0x4a4c('0x28')](function(_0x6c4c13){_0x48c995[_0x4a4c('0x45')]=_0x6c4c13;return _0x48c995;})['then'](respondWithFilteredResult(_0x46a1fa,_0x1f9ead))[_0x4a4c('0x46')](handleError(_0x46a1fa,null));};exports[_0x4a4c('0x47')]=function(_0x264cda,_0x220dff){var _0x4b65bb={'raw':![],'where':{'id':_0x264cda[_0x4a4c('0x48')]['id']}},_0x131c46={};_0x131c46[_0x4a4c('0x36')]=_[_0x4a4c('0x34')](db[_0x4a4c('0x2e')][_0x4a4c('0x2f')]);_0x131c46['query']=_[_0x4a4c('0x34')](_0x264cda[_0x4a4c('0x33')]);_0x131c46[_0x4a4c('0x3e')]=_[_0x4a4c('0x35')](_0x131c46[_0x4a4c('0x36')],_0x131c46[_0x4a4c('0x33')]);_0x4b65bb[_0x4a4c('0x37')]=_['intersection'](_0x131c46[_0x4a4c('0x36')],qs[_0x4a4c('0x38')](_0x264cda['query'][_0x4a4c('0x38')]));_0x4b65bb['attributes']=_0x4b65bb[_0x4a4c('0x37')]['length']?_0x4b65bb[_0x4a4c('0x37')]:_0x131c46[_0x4a4c('0x36')];if(_0x264cda[_0x4a4c('0x33')][_0x4a4c('0x49')]){_0x4b65bb['include']=[{'all':!![]}];}_0x4b65bb=_['merge']({},_0x4b65bb,_0x264cda[_0x4a4c('0x4a')]);return db['Automation']['find'](_0x4b65bb)[_0x4a4c('0x28')](handleEntityNotFound(_0x220dff,null))['then'](respondWithResult(_0x220dff,null))['catch'](handleError(_0x220dff,null));};exports[_0x4a4c('0x4b')]=function(_0x19b403,_0x4b9e89){return db['Automation'][_0x4a4c('0x4b')](_0x19b403['body'],{})[_0x4a4c('0x28')](respondWithResult(_0x4b9e89,0xc9))[_0x4a4c('0x46')](handleError(_0x4b9e89,null));};exports[_0x4a4c('0x26')]=function(_0x3df3f4,_0x170452){if(_0x3df3f4['body']['id']){delete _0x3df3f4[_0x4a4c('0x4c')]['id'];}return db[_0x4a4c('0x2e')][_0x4a4c('0x4d')]({'where':{'id':_0x3df3f4[_0x4a4c('0x48')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x170452,null))[_0x4a4c('0x28')](saveUpdates(_0x3df3f4['body'],null))[_0x4a4c('0x28')](respondWithResult(_0x170452,null))[_0x4a4c('0x46')](handleError(_0x170452,null));};exports['destroy']=function(_0x2b75ff,_0x357aa5){return db[_0x4a4c('0x2e')][_0x4a4c('0x4d')]({'where':{'id':_0x2b75ff['params']['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x357aa5,null))[_0x4a4c('0x28')](removeEntity(_0x357aa5,null))[_0x4a4c('0x46')](handleError(_0x357aa5,null));};exports[_0x4a4c('0x4e')]=function(_0x3591d5,_0x486e11,_0x2bdb76){return db['Condition'][_0x4a4c('0x4d')]({'where':{'id':_0x3591d5[_0x4a4c('0x48')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x486e11,null))[_0x4a4c('0x28')](function(_0x4b157a){if(_0x4b157a){return _0x4b157a[_0x4a4c('0x4e')](_0x3591d5[_0x4a4c('0x4c')]['ids'],_[_0x4a4c('0x4f')](_0x3591d5[_0x4a4c('0x4c')],[_0x4a4c('0x50'),'id'])||{});}})[_0x4a4c('0x28')](respondWithResult(_0x486e11,null))[_0x4a4c('0x46')](handleError(_0x486e11,null));};exports['getConditions']=function(_0x25e0de,_0x392a4a,_0x433b29){var _0x35a97d={};var _0x105a16={};var _0x360e78;var _0x74be9f;return db[_0x4a4c('0x2e')]['findOne']({'where':{'id':_0x25e0de['params']['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x392a4a,null))[_0x4a4c('0x28')](function(_0xa33cdf){if(_0xa33cdf){_0x360e78=_0xa33cdf;_0x105a16['model']=_[_0x4a4c('0x34')](db[_0x4a4c('0x51')][_0x4a4c('0x2f')]);_0x105a16[_0x4a4c('0x33')]=_['keys'](_0x25e0de[_0x4a4c('0x33')]);_0x105a16['filters']=_[_0x4a4c('0x35')](_0x105a16[_0x4a4c('0x36')],_0x105a16[_0x4a4c('0x33')]);_0x35a97d['attributes']=_['intersection'](_0x105a16['model'],qs[_0x4a4c('0x38')](_0x25e0de[_0x4a4c('0x33')][_0x4a4c('0x38')]));_0x35a97d['attributes']=_0x35a97d[_0x4a4c('0x37')]['length']?_0x35a97d['attributes']:_0x105a16[_0x4a4c('0x36')];_0x35a97d[_0x4a4c('0x3b')]=qs['sort'](_0x25e0de[_0x4a4c('0x33')][_0x4a4c('0x3c')]);_0x35a97d[_0x4a4c('0x3d')]=qs[_0x4a4c('0x3e')](_[_0x4a4c('0x3f')](_0x25e0de[_0x4a4c('0x33')],_0x105a16['filters']));if(_0x25e0de[_0x4a4c('0x33')][_0x4a4c('0x42')]){_0x35a97d['where']=_['merge'](_0x35a97d[_0x4a4c('0x3d')],{'$or':_[_0x4a4c('0x2d')](_0x35a97d[_0x4a4c('0x37')],function(_0x3b143e){var _0x2981c3={};_0x2981c3[_0x3b143e]={'$like':'%'+_0x25e0de[_0x4a4c('0x33')]['filter']+'%'};return _0x2981c3;})});}_0x35a97d=_[_0x4a4c('0x40')]({},_0x35a97d,_0x25e0de[_0x4a4c('0x4a')]);return _0x360e78['getConditions'](_0x35a97d);}})[_0x4a4c('0x28')](function(_0x1f33dc){if(_0x1f33dc){_0x74be9f=_0x1f33dc[_0x4a4c('0x39')];if(!_0x25e0de[_0x4a4c('0x33')][_0x4a4c('0x3a')](_0x4a4c('0x52'))){_0x35a97d['limit']=qs[_0x4a4c('0x20')](_0x25e0de[_0x4a4c('0x33')]['limit']);_0x35a97d['offset']=qs[_0x4a4c('0x1e')](_0x25e0de[_0x4a4c('0x33')]['offset']);}return _0x360e78[_0x4a4c('0x53')](_0x35a97d);}})['then'](function(_0x245d95){if(_0x245d95){return _0x245d95?{'count':_0x74be9f,'rows':_0x245d95}:null;}})[_0x4a4c('0x28')](respondWithResult(_0x392a4a,null))[_0x4a4c('0x46')](handleError(_0x392a4a,null));};exports[_0x4a4c('0x54')]=function(_0x31fd7a,_0x3871c4,_0x5e3a19){return db[_0x4a4c('0x55')][_0x4a4c('0x4d')]({'where':{'id':_0x31fd7a['params']['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x3871c4,null))['then'](function(_0x546bd4){if(_0x546bd4){return _0x546bd4[_0x4a4c('0x54')](_0x31fd7a[_0x4a4c('0x4c')][_0x4a4c('0x50')],_[_0x4a4c('0x4f')](_0x31fd7a[_0x4a4c('0x4c')],[_0x4a4c('0x50'),'id'])||{});}})[_0x4a4c('0x28')](respondWithResult(_0x3871c4,null))[_0x4a4c('0x46')](handleError(_0x3871c4,null));};exports['getActions']=function(_0x39db56,_0x48e8a3,_0x289a2d){var _0x5d9511={};var _0x5c8f1a={};var _0x2fd001;var _0x55e310;return db[_0x4a4c('0x2e')][_0x4a4c('0x56')]({'where':{'id':_0x39db56['params']['id']}})['then'](handleEntityNotFound(_0x48e8a3,null))[_0x4a4c('0x28')](function(_0x3be374){if(_0x3be374){_0x2fd001=_0x3be374;_0x5c8f1a['model']=_[_0x4a4c('0x34')](db[_0x4a4c('0x55')][_0x4a4c('0x2f')]);_0x5c8f1a[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x39db56['query']);_0x5c8f1a[_0x4a4c('0x3e')]=_[_0x4a4c('0x35')](_0x5c8f1a['model'],_0x5c8f1a[_0x4a4c('0x33')]);_0x5d9511[_0x4a4c('0x37')]=_[_0x4a4c('0x35')](_0x5c8f1a[_0x4a4c('0x36')],qs[_0x4a4c('0x38')](_0x39db56['query'][_0x4a4c('0x38')]));_0x5d9511[_0x4a4c('0x37')]=_0x5d9511[_0x4a4c('0x37')][_0x4a4c('0x39')]?_0x5d9511['attributes']:_0x5c8f1a[_0x4a4c('0x36')];_0x5d9511[_0x4a4c('0x3b')]=qs['sort'](_0x39db56[_0x4a4c('0x33')][_0x4a4c('0x3c')]);_0x5d9511['where']=qs['filters'](_[_0x4a4c('0x3f')](_0x39db56[_0x4a4c('0x33')],_0x5c8f1a[_0x4a4c('0x3e')]));if(_0x39db56['query']['filter']){_0x5d9511[_0x4a4c('0x3d')]=_[_0x4a4c('0x40')](_0x5d9511[_0x4a4c('0x3d')],{'$or':_[_0x4a4c('0x2d')](_0x5d9511['attributes'],function(_0x354f3d){var _0x27ba14={};_0x27ba14[_0x354f3d]={'$like':'%'+_0x39db56['query'][_0x4a4c('0x42')]+'%'};return _0x27ba14;})});}_0x5d9511=_[_0x4a4c('0x40')]({},_0x5d9511,_0x39db56[_0x4a4c('0x4a')]);return _0x2fd001['getActions'](_0x5d9511);}})[_0x4a4c('0x28')](function(_0x40606e){if(_0x40606e){_0x55e310=_0x40606e[_0x4a4c('0x39')];if(!_0x39db56[_0x4a4c('0x33')][_0x4a4c('0x3a')]('nolimit')){_0x5d9511['limit']=qs[_0x4a4c('0x20')](_0x39db56[_0x4a4c('0x33')][_0x4a4c('0x20')]);_0x5d9511[_0x4a4c('0x1e')]=qs[_0x4a4c('0x1e')](_0x39db56[_0x4a4c('0x33')][_0x4a4c('0x1e')]);}return _0x2fd001['getActions'](_0x5d9511);}})[_0x4a4c('0x28')](function(_0x458861){if(_0x458861){return _0x458861?{'count':_0x55e310,'rows':_0x458861}:null;}})['then'](respondWithResult(_0x48e8a3,null))[_0x4a4c('0x46')](handleError(_0x48e8a3,null));}; \ No newline at end of file +var _0x40c5=['merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','length','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','Action','addActions','omit','getActions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','key','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x46bd4a,_0x38f47d){var _0x5bb00f=function(_0x5308d6){while(--_0x5308d6){_0x46bd4a['push'](_0x46bd4a['shift']());}};_0x5bb00f(++_0x38f47d);}(_0x40c5,0x1d2));var _0x540c=function(_0x5b4849,_0x44297b){_0x5b4849=_0x5b4849-0x0;var _0x1f3f55=_0x40c5[_0x5b4849];return _0x1f3f55;};'use strict';var emlformat=require(_0x540c('0x0'));var rimraf=require(_0x540c('0x1'));var zipdir=require(_0x540c('0x2'));var jsonpatch=require(_0x540c('0x3'));var rp=require(_0x540c('0x4'));var moment=require(_0x540c('0x5'));var BPromise=require(_0x540c('0x6'));var Mustache=require('mustache');var util=require(_0x540c('0x7'));var path=require(_0x540c('0x8'));var sox=require(_0x540c('0x9'));var csv=require(_0x540c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x540c('0xb'));var _=require(_0x540c('0xc'));var squel=require(_0x540c('0xd'));var crypto=require(_0x540c('0xe'));var jsforce=require(_0x540c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x540c('0xa'));var querystring=require(_0x540c('0x10'));var Papa=require(_0x540c('0x11'));var Redis=require('ioredis');var authService=require(_0x540c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x540c('0x13'));var logger=require(_0x540c('0x14'))(_0x540c('0x15'));var utils=require(_0x540c('0x16'));var config=require(_0x540c('0x17'));var licenseUtil=require(_0x540c('0x18'));var db=require(_0x540c('0x19'))['db'];function respondWithStatusCode(_0x369a2d,_0x49458f){_0x49458f=_0x49458f||0xcc;return function(_0x5cacee){if(_0x5cacee){return _0x369a2d[_0x540c('0x1a')](_0x49458f);}return _0x369a2d[_0x540c('0x1b')](_0x49458f)[_0x540c('0x1c')]();};}function respondWithResult(_0x48a1b1,_0x3fd3af){_0x3fd3af=_0x3fd3af||0xc8;return function(_0x1ed572){if(_0x1ed572){return _0x48a1b1['status'](_0x3fd3af)[_0x540c('0x1d')](_0x1ed572);}};}function respondWithFilteredResult(_0x42f837,_0x1d4cd2){return function(_0x44f848){if(_0x44f848){var _0x8f3852=typeof _0x1d4cd2[_0x540c('0x1e')]===_0x540c('0x1f')&&typeof _0x1d4cd2[_0x540c('0x20')]==='undefined';var _0x261a64=_0x44f848[_0x540c('0x21')];var _0xa22369=_0x8f3852?0x0:_0x1d4cd2['offset'];var _0x177a43=_0x8f3852?_0x44f848[_0x540c('0x21')]:_0x1d4cd2[_0x540c('0x1e')]+_0x1d4cd2[_0x540c('0x20')];var _0x22335f;if(_0x177a43>=_0x261a64){_0x177a43=_0x261a64;_0x22335f=0xc8;}else{_0x22335f=0xce;}_0x42f837[_0x540c('0x1b')](_0x22335f);return _0x42f837[_0x540c('0x22')](_0x540c('0x23'),_0xa22369+'-'+_0x177a43+'/'+_0x261a64)[_0x540c('0x1d')](_0x44f848);}return null;};}function patchUpdates(_0x115fa7){return function(_0x1bb88e){try{jsonpatch[_0x540c('0x24')](_0x1bb88e,_0x115fa7,!![]);}catch(_0x42efc4){return BPromise[_0x540c('0x25')](_0x42efc4);}return _0x1bb88e[_0x540c('0x26')]();};}function saveUpdates(_0x4f2e91,_0x5a149e){return function(_0x48ac36){if(_0x48ac36){return _0x48ac36[_0x540c('0x27')](_0x4f2e91)[_0x540c('0x28')](function(_0x3cf330){return _0x3cf330;});}return null;};}function removeEntity(_0x4f2f3b,_0x394694){return function(_0x31c1b2){if(_0x31c1b2){return _0x31c1b2[_0x540c('0x29')]()[_0x540c('0x28')](function(){_0x4f2f3b[_0x540c('0x1b')](0xcc)[_0x540c('0x1c')]();});}};}function handleEntityNotFound(_0x4775ad,_0x25c4a7){return function(_0x3969a7){if(!_0x3969a7){_0x4775ad[_0x540c('0x1a')](0x194);}return _0x3969a7;};}function handleError(_0x2d26e6,_0x273ecb){_0x273ecb=_0x273ecb||0x1f4;return function(_0x29953f){logger[_0x540c('0x2a')](_0x29953f[_0x540c('0x2b')]);if(_0x29953f[_0x540c('0x2c')]){delete _0x29953f['name'];}_0x2d26e6[_0x540c('0x1b')](_0x273ecb)[_0x540c('0x2d')](_0x29953f);};}exports[_0x540c('0x2e')]=function(_0x296587,_0x48dc1d){var _0x854ecd={},_0x1048ad={},_0x42d7c7={'count':0x0,'rows':[]};var _0xa6290c=_['map'](db[_0x540c('0x2f')]['rawAttributes'],function(_0x424235){return{'name':_0x424235['fieldName'],'type':_0x424235['type'][_0x540c('0x30')]};});_0x1048ad[_0x540c('0x31')]=_[_0x540c('0x32')](_0xa6290c,_0x540c('0x2c'));_0x1048ad['query']=_['keys'](_0x296587['query']);_0x1048ad[_0x540c('0x33')]=_[_0x540c('0x34')](_0x1048ad[_0x540c('0x31')],_0x1048ad[_0x540c('0x35')]);_0x854ecd[_0x540c('0x36')]=_[_0x540c('0x34')](_0x1048ad[_0x540c('0x31')],qs['fields'](_0x296587['query'][_0x540c('0x37')]));_0x854ecd[_0x540c('0x36')]=_0x854ecd[_0x540c('0x36')]['length']?_0x854ecd[_0x540c('0x36')]:_0x1048ad['model'];if(!_0x296587[_0x540c('0x35')][_0x540c('0x38')]('nolimit')){_0x854ecd['limit']=qs['limit'](_0x296587['query'][_0x540c('0x20')]);_0x854ecd['offset']=qs['offset'](_0x296587[_0x540c('0x35')]['offset']);}_0x854ecd[_0x540c('0x39')]=qs['sort'](_0x296587[_0x540c('0x35')][_0x540c('0x3a')]);_0x854ecd[_0x540c('0x3b')]=qs[_0x540c('0x33')](_[_0x540c('0x3c')](_0x296587[_0x540c('0x35')],_0x1048ad[_0x540c('0x33')]),_0xa6290c);if(_0x296587[_0x540c('0x35')][_0x540c('0x3d')]){_0x854ecd[_0x540c('0x3b')]=_[_0x540c('0x3e')](_0x854ecd[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0xa6290c,function(_0x4359f2){if(_0x4359f2[_0x540c('0x3f')]!==_0x540c('0x40')){var _0x285ff7={};_0x285ff7[_0x4359f2['name']]={'$like':'%'+_0x296587[_0x540c('0x35')][_0x540c('0x3d')]+'%'};return _0x285ff7;}})});}_0x854ecd=_['merge']({},_0x854ecd,_0x296587[_0x540c('0x41')]);var _0x22c819={'where':_0x854ecd[_0x540c('0x3b')]};return db[_0x540c('0x2f')][_0x540c('0x21')](_0x22c819)[_0x540c('0x28')](function(_0x4290c7){_0x42d7c7[_0x540c('0x21')]=_0x4290c7;if(_0x296587[_0x540c('0x35')][_0x540c('0x42')]){_0x854ecd[_0x540c('0x43')]=[{'all':!![]}];}return db['Automation'][_0x540c('0x44')](_0x854ecd);})[_0x540c('0x28')](function(_0xe99b09){_0x42d7c7['rows']=_0xe99b09;return _0x42d7c7;})['then'](respondWithFilteredResult(_0x48dc1d,_0x854ecd))[_0x540c('0x45')](handleError(_0x48dc1d,null));};exports[_0x540c('0x46')]=function(_0x2f8190,_0x10657d){var _0x547f50={'raw':![],'where':{'id':_0x2f8190['params']['id']}},_0x4fd719={};_0x4fd719[_0x540c('0x31')]=_[_0x540c('0x47')](db[_0x540c('0x2f')][_0x540c('0x48')]);_0x4fd719[_0x540c('0x35')]=_[_0x540c('0x47')](_0x2f8190['query']);_0x4fd719[_0x540c('0x33')]=_[_0x540c('0x34')](_0x4fd719[_0x540c('0x31')],_0x4fd719[_0x540c('0x35')]);_0x547f50['attributes']=_[_0x540c('0x34')](_0x4fd719[_0x540c('0x31')],qs[_0x540c('0x37')](_0x2f8190['query'][_0x540c('0x37')]));_0x547f50[_0x540c('0x36')]=_0x547f50['attributes'][_0x540c('0x49')]?_0x547f50[_0x540c('0x36')]:_0x4fd719[_0x540c('0x31')];if(_0x2f8190['query'][_0x540c('0x42')]){_0x547f50[_0x540c('0x43')]=[{'all':!![]}];}_0x547f50=_['merge']({},_0x547f50,_0x2f8190['options']);return db[_0x540c('0x2f')][_0x540c('0x4a')](_0x547f50)[_0x540c('0x28')](handleEntityNotFound(_0x10657d,null))[_0x540c('0x28')](respondWithResult(_0x10657d,null))[_0x540c('0x45')](handleError(_0x10657d,null));};exports[_0x540c('0x4b')]=function(_0x29178b,_0x13cb55){return db[_0x540c('0x2f')][_0x540c('0x4b')](_0x29178b[_0x540c('0x4c')],{})[_0x540c('0x28')](respondWithResult(_0x13cb55,0xc9))[_0x540c('0x45')](handleError(_0x13cb55,null));};exports['update']=function(_0x2116b1,_0x52f26d){if(_0x2116b1[_0x540c('0x4c')]['id']){delete _0x2116b1[_0x540c('0x4c')]['id'];}return db[_0x540c('0x2f')]['find']({'where':{'id':_0x2116b1['params']['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x52f26d,null))['then'](saveUpdates(_0x2116b1[_0x540c('0x4c')],null))[_0x540c('0x28')](respondWithResult(_0x52f26d,null))[_0x540c('0x45')](handleError(_0x52f26d,null));};exports[_0x540c('0x29')]=function(_0x676595,_0x11cd37){return db[_0x540c('0x2f')][_0x540c('0x4a')]({'where':{'id':_0x676595[_0x540c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x11cd37,null))[_0x540c('0x28')](removeEntity(_0x11cd37,null))['catch'](handleError(_0x11cd37,null));};exports[_0x540c('0x4e')]=function(_0xd29d6,_0x3f4e7c,_0x4e04e7){return db['Condition'][_0x540c('0x4a')]({'where':{'id':_0xd29d6['params']['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x3f4e7c,null))[_0x540c('0x28')](function(_0x97b110){if(_0x97b110){return _0x97b110[_0x540c('0x4e')](_0xd29d6['body'][_0x540c('0x4f')],_['omit'](_0xd29d6[_0x540c('0x4c')],['ids','id'])||{});}})[_0x540c('0x28')](respondWithResult(_0x3f4e7c,null))[_0x540c('0x45')](handleError(_0x3f4e7c,null));};exports[_0x540c('0x50')]=function(_0x4acb42,_0x324d0c,_0x148108){var _0x5356ec={};var _0x48fea2={};var _0x16bf81;var _0x119df4;return db[_0x540c('0x2f')][_0x540c('0x51')]({'where':{'id':_0x4acb42[_0x540c('0x4d')]['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x324d0c,null))[_0x540c('0x28')](function(_0x1eca7e){if(_0x1eca7e){_0x16bf81=_0x1eca7e;_0x48fea2[_0x540c('0x31')]=_[_0x540c('0x47')](db[_0x540c('0x52')][_0x540c('0x48')]);_0x48fea2[_0x540c('0x35')]=_[_0x540c('0x47')](_0x4acb42[_0x540c('0x35')]);_0x48fea2[_0x540c('0x33')]=_['intersection'](_0x48fea2['model'],_0x48fea2[_0x540c('0x35')]);_0x5356ec[_0x540c('0x36')]=_[_0x540c('0x34')](_0x48fea2[_0x540c('0x31')],qs[_0x540c('0x37')](_0x4acb42['query']['fields']));_0x5356ec[_0x540c('0x36')]=_0x5356ec['attributes']['length']?_0x5356ec['attributes']:_0x48fea2[_0x540c('0x31')];_0x5356ec[_0x540c('0x39')]=qs['sort'](_0x4acb42['query'][_0x540c('0x3a')]);_0x5356ec[_0x540c('0x3b')]=qs[_0x540c('0x33')](_['pick'](_0x4acb42[_0x540c('0x35')],_0x48fea2['filters']));if(_0x4acb42['query'][_0x540c('0x3d')]){_0x5356ec['where']=_[_0x540c('0x3e')](_0x5356ec[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0x5356ec[_0x540c('0x36')],function(_0x11bdef){var _0x3095cd={};_0x3095cd[_0x11bdef]={'$like':'%'+_0x4acb42[_0x540c('0x35')]['filter']+'%'};return _0x3095cd;})});}_0x5356ec=_[_0x540c('0x3e')]({},_0x5356ec,_0x4acb42[_0x540c('0x41')]);return _0x16bf81['getConditions'](_0x5356ec);}})[_0x540c('0x28')](function(_0x21f482){if(_0x21f482){_0x119df4=_0x21f482[_0x540c('0x49')];if(!_0x4acb42['query'][_0x540c('0x38')]('nolimit')){_0x5356ec['limit']=qs[_0x540c('0x20')](_0x4acb42[_0x540c('0x35')][_0x540c('0x20')]);_0x5356ec['offset']=qs[_0x540c('0x1e')](_0x4acb42[_0x540c('0x35')][_0x540c('0x1e')]);}return _0x16bf81[_0x540c('0x50')](_0x5356ec);}})[_0x540c('0x28')](function(_0x26d376){if(_0x26d376){return _0x26d376?{'count':_0x119df4,'rows':_0x26d376}:null;}})[_0x540c('0x28')](respondWithResult(_0x324d0c,null))[_0x540c('0x45')](handleError(_0x324d0c,null));};exports['addActions']=function(_0x5f2541,_0x48fa93,_0x2ca8c0){return db[_0x540c('0x53')][_0x540c('0x4a')]({'where':{'id':_0x5f2541[_0x540c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48fa93,null))['then'](function(_0x171dee){if(_0x171dee){return _0x171dee[_0x540c('0x54')](_0x5f2541[_0x540c('0x4c')][_0x540c('0x4f')],_[_0x540c('0x55')](_0x5f2541['body'],[_0x540c('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x48fa93,null))['catch'](handleError(_0x48fa93,null));};exports[_0x540c('0x56')]=function(_0xd9766a,_0x38bd3f,_0x549970){var _0x429b59={};var _0x3040d1={};var _0x2d7a2f;var _0x5d0982;return db[_0x540c('0x2f')]['findOne']({'where':{'id':_0xd9766a[_0x540c('0x4d')]['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x38bd3f,null))[_0x540c('0x28')](function(_0x42d485){if(_0x42d485){_0x2d7a2f=_0x42d485;_0x3040d1['model']=_['keys'](db[_0x540c('0x53')]['rawAttributes']);_0x3040d1[_0x540c('0x35')]=_[_0x540c('0x47')](_0xd9766a[_0x540c('0x35')]);_0x3040d1[_0x540c('0x33')]=_[_0x540c('0x34')](_0x3040d1[_0x540c('0x31')],_0x3040d1[_0x540c('0x35')]);_0x429b59[_0x540c('0x36')]=_[_0x540c('0x34')](_0x3040d1[_0x540c('0x31')],qs[_0x540c('0x37')](_0xd9766a[_0x540c('0x35')][_0x540c('0x37')]));_0x429b59[_0x540c('0x36')]=_0x429b59['attributes'][_0x540c('0x49')]?_0x429b59[_0x540c('0x36')]:_0x3040d1[_0x540c('0x31')];_0x429b59[_0x540c('0x39')]=qs[_0x540c('0x3a')](_0xd9766a[_0x540c('0x35')][_0x540c('0x3a')]);_0x429b59[_0x540c('0x3b')]=qs['filters'](_[_0x540c('0x3c')](_0xd9766a[_0x540c('0x35')],_0x3040d1[_0x540c('0x33')]));if(_0xd9766a['query'][_0x540c('0x3d')]){_0x429b59['where']=_[_0x540c('0x3e')](_0x429b59[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0x429b59[_0x540c('0x36')],function(_0x1cc799){var _0x4e6583={};_0x4e6583[_0x1cc799]={'$like':'%'+_0xd9766a[_0x540c('0x35')][_0x540c('0x3d')]+'%'};return _0x4e6583;})});}_0x429b59=_['merge']({},_0x429b59,_0xd9766a[_0x540c('0x41')]);return _0x2d7a2f[_0x540c('0x56')](_0x429b59);}})[_0x540c('0x28')](function(_0x320329){if(_0x320329){_0x5d0982=_0x320329[_0x540c('0x49')];if(!_0xd9766a[_0x540c('0x35')][_0x540c('0x38')](_0x540c('0x57'))){_0x429b59[_0x540c('0x20')]=qs[_0x540c('0x20')](_0xd9766a[_0x540c('0x35')][_0x540c('0x20')]);_0x429b59[_0x540c('0x1e')]=qs[_0x540c('0x1e')](_0xd9766a[_0x540c('0x35')][_0x540c('0x1e')]);}return _0x2d7a2f[_0x540c('0x56')](_0x429b59);}})['then'](function(_0x15fdcb){if(_0x15fdcb){return _0x15fdcb?{'count':_0x5d0982,'rows':_0x15fdcb}:null;}})[_0x540c('0x28')](respondWithResult(_0x38bd3f,null))['catch'](handleError(_0x38bd3f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 57e3338..e86ae81 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 _0x03f8=['moment','bluebird','path','./automation.attributes','exports','define','Automation','lodash','../../config/logger','api'];(function(_0x4541e4,_0x41e295){var _0x45c618=function(_0x280993){while(--_0x280993){_0x4541e4['push'](_0x4541e4['shift']());}};_0x45c618(++_0x41e295);}(_0x03f8,0x1d3));var _0x803f=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x03f8[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require(_0x803f('0x0'));var util=require('util');var logger=require(_0x803f('0x1'))(_0x803f('0x2'));var moment=require(_0x803f('0x3'));var BPromise=require(_0x803f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x803f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x803f('0x6'));module[_0x803f('0x7')]=function(_0x20861f,_0xed797e){return _0x20861f[_0x803f('0x8')](_0x803f('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3320=['moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x3320,0x171));var _0x0332=function(_0x544a8b,_0x22977f){_0x544a8b=_0x544a8b-0x0;var _0x399cb2=_0x3320[_0x544a8b];return _0x399cb2;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require(_0x0332('0x2'))('api');var moment=require(_0x0332('0x3'));var BPromise=require(_0x0332('0x4'));var rp=require(_0x0332('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x6'));var config=require(_0x0332('0x7'));var attributes=require(_0x0332('0x8'));module[_0x0332('0x9')]=function(_0x104a3d,_0x12ecca){return _0x104a3d['define'](_0x0332('0xa'),attributes,{'tableName':_0x0332('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 4cdef89..6a7d1ad 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 _0x9672=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0x5c4546,_0x5b914e){var _0x422f39=function(_0x1af47a){while(--_0x1af47a){_0x5c4546['push'](_0x5c4546['shift']());}};_0x422f39(++_0x5b914e);}(_0x9672,0xee));var _0x2967=function(_0x4d79b1,_0x28a8b9){_0x4d79b1=_0x4d79b1-0x0;var _0x885257=_0x9672[_0x4d79b1];return _0x885257;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var moment=require('moment');var BPromise=require(_0x2967('0x2'));var rs=require(_0x2967('0x3'));var fs=require('fs');var Redis=require(_0x2967('0x4'));var db=require(_0x2967('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2967('0x6'))(_0x2967('0x7'));var config=require(_0x2967('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2967('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x355e82,_0x1aa9a5,_0x77f846){return new BPromise(function(_0x3bcd7e,_0xf353b6){return client[_0x2967('0xa')](_0x355e82,_0x77f846)[_0x2967('0xb')](function(_0x4aec0f){logger[_0x2967('0xc')](_0x2967('0xd'),_0x1aa9a5,_0x2967('0xe'));logger[_0x2967('0xf')](_0x2967('0x10'),_0x1aa9a5,_0x2967('0xe'),JSON['stringify'](_0x4aec0f));if(_0x4aec0f[_0x2967('0x11')]){if(_0x4aec0f['error'][_0x2967('0x12')]===0x1f4){logger['error'](_0x2967('0xd'),_0x1aa9a5,_0x4aec0f[_0x2967('0x11')]['message']);return _0xf353b6(_0x4aec0f[_0x2967('0x11')]['message']);}logger[_0x2967('0x11')](_0x2967('0xd'),_0x1aa9a5,_0x4aec0f[_0x2967('0x11')]['message']);return _0x3bcd7e(_0x4aec0f['error'][_0x2967('0x13')]);}else{logger[_0x2967('0xc')](_0x2967('0xd'),_0x1aa9a5,'request\x20sent');_0x3bcd7e(_0x4aec0f['result'][_0x2967('0x13')]);}})[_0x2967('0x14')](function(_0x1bcec9){logger[_0x2967('0x11')](_0x2967('0xd'),_0x1aa9a5,_0x1bcec9);_0xf353b6(_0x1bcec9);});});} \ No newline at end of file +var _0x5ed9=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Automation,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5ed9[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1dd0df2..86f8938 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 _0x16c1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','delete','destroy','exports','multer','util'];(function(_0x4b1434,_0x1fa900){var _0x9870da=function(_0x1e9432){while(--_0x1e9432){_0x4b1434['push'](_0x4b1434['shift']());}};_0x9870da(++_0x1fa900);}(_0x16c1,0x66));var _0x116c=function(_0x48acc8,_0x1b3e47){_0x48acc8=_0x48acc8-0x0;var _0x19a079=_0x16c1[_0x48acc8];return _0x19a079;};'use strict';var multer=require(_0x116c('0x0'));var util=require(_0x116c('0x1'));var path=require(_0x116c('0x2'));var timeout=require(_0x116c('0x3'));var express=require(_0x116c('0x4'));var router=express[_0x116c('0x5')]();var fs_extra=require(_0x116c('0x6'));var auth=require(_0x116c('0x7'));var interaction=require(_0x116c('0x8'));var config=require('../../config/environment');var controller=require(_0x116c('0x9'));router['get']('/',auth[_0x116c('0xa')](),controller[_0x116c('0xb')]);router[_0x116c('0xc')](_0x116c('0xd'),auth[_0x116c('0xa')](),controller[_0x116c('0xe')]);router['get'](_0x116c('0xf'),auth[_0x116c('0xa')](),controller[_0x116c('0x10')]);router[_0x116c('0xc')](_0x116c('0x11'),auth[_0x116c('0xa')](),controller['getActions']);router[_0x116c('0x12')]('/',auth[_0x116c('0xa')](),controller[_0x116c('0x13')]);router[_0x116c('0x12')](_0x116c('0xf'),auth[_0x116c('0xa')](),controller[_0x116c('0x14')]);router[_0x116c('0x12')](_0x116c('0x11'),auth['isAuthenticated'](),controller[_0x116c('0x15')]);router[_0x116c('0x16')](_0x116c('0xd'),auth[_0x116c('0xa')](),controller['update']);router[_0x116c('0x17')](_0x116c('0xd'),auth[_0x116c('0xa')](),controller[_0x116c('0x18')]);module[_0x116c('0x19')]=router; \ No newline at end of file +var _0xeec3=['destroy','multer','util','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/conditions','getConditions','post','create','addActions','put','update'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xeec3,0x1c3));var _0x3eec=function(_0x5dc9d9,_0x5b91c0){_0x5dc9d9=_0x5dc9d9-0x0;var _0x4824b7=_0xeec3[_0x5dc9d9];return _0x4824b7;};'use strict';var multer=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3eec('0x2'));var interaction=require(_0x3eec('0x3'));var config=require('../../config/environment');var controller=require(_0x3eec('0x4'));router['get']('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0x6')]);router['get'](_0x3eec('0x7'),auth[_0x3eec('0x5')](),controller[_0x3eec('0x8')]);router[_0x3eec('0x9')](_0x3eec('0xa'),auth[_0x3eec('0x5')](),controller[_0x3eec('0xb')]);router[_0x3eec('0x9')]('/:id/actions',auth[_0x3eec('0x5')](),controller['getActions']);router[_0x3eec('0xc')]('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0xd')]);router[_0x3eec('0xc')]('/:id/conditions',auth[_0x3eec('0x5')](),controller['addConditions']);router['post']('/:id/actions',auth[_0x3eec('0x5')](),controller[_0x3eec('0xe')]);router[_0x3eec('0xf')](_0x3eec('0x7'),auth['isAuthenticated'](),controller[_0x3eec('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3eec('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d896745..461975a 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 _0xd2ca=['never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd2ca,0xba));var _0xad2c=function(_0x414356,_0x591827){_0x414356=_0x414356-0x0;var _0x4bdafb=_0xd2ca[_0x414356];return _0x4bdafb;};'use strict';var Sequelize=require('sequelize');module[_0xad2c('0x0')]={'name':{'type':Sequelize[_0xad2c('0x1')],'unique':_0xad2c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xad2c('0x3')](_0xad2c('0x4')),'allowNull':![],'defaultValue':_0xad2c('0x4')},'description':{'type':Sequelize[_0xad2c('0x1')]},'active':{'type':Sequelize[_0xad2c('0x5')],'defaultValue':0x0,'comment':_0xad2c('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xad2c('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xad2c('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xad2c('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xad2c('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xad2c('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xad2c('0xa')](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xad2c('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xad2c('0x1')],'defaultValue':_0xad2c('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xad2c('0x3')](_0xad2c('0x11'),_0xad2c('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xad2c('0x5')],'defaultValue':0x0,'comment':_0xad2c('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xad2c('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xad2c('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xad2c('0xa')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xad2c('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xad2c('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad2c('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xad2c('0xa')](0x9)[_0xad2c('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xad2c('0xa')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xad2c('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xad2c('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xad2c('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad2c('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xad2c('0x3')](_0xad2c('0x19'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xad2c('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xad2c('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xad2c('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xad2c('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xad2c('0xa')](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xad2c('0xa')](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xad2c('0xa')](0x3)[_0xad2c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad2c('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xad2c('0xa')](0x5)[_0xad2c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad2c('0x21')}}; \ No newline at end of file +var _0x3441=['ENUM','ivr','STRING','INTEGER','Max\x20200\x20calls.','UNSIGNED','#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','BOOLEAN','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x3441,0x14b));var _0x1344=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0x3441[_0x1ef726];return _0x4c3c66;};'use strict';var Sequelize=require(_0x1344('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1344('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1344('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x1344('0x3')},'description':{'type':Sequelize[_0x1344('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1344('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1344('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'comment':_0x1344('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1344('0xd')},'dialTimezone':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1344('0x4')],'defaultValue':_0x1344('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1344('0x2')](_0x1344('0xf'),_0x1344('0x10'),_0x1344('0x11')),'defaultValue':_0x1344('0xf')},'dialAMDActive':{'type':Sequelize[_0x1344('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1344('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1344('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1344('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1344('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1344('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1344('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1344('0x2')](_0x1344('0x19'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1a')},'dialCutDigit':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5a3d3de..f36cee3 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 _0x316b=['order','sort','where','pick','filter','VIRTUAL','options','Campaign','includeAll','include','catch','show','params','keys','intersection','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','userProfileId','error','getHoppers','findOne','nolimit','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','scheduledAt','cmHopperId','OrderBy','h.id','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','limit','offset'];(function(_0x22ad0c,_0x56e8a1){var _0x3787a9=function(_0x1d87a9){while(--_0x1d87a9){_0x22ad0c['push'](_0x22ad0c['shift']());}};_0x3787a9(++_0x56e8a1);}(_0x316b,0x17e));var _0xb316=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x316b[_0x568a61];return _0x334c3b;};'use strict';var emlformat=require(_0xb316('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb316('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb316('0x2'));var moment=require(_0xb316('0x3'));var BPromise=require(_0xb316('0x4'));var Mustache=require(_0xb316('0x5'));var util=require(_0xb316('0x6'));var path=require(_0xb316('0x7'));var sox=require(_0xb316('0x8'));var csv=require('to-csv');var ejs=require(_0xb316('0x9'));var fs=require('fs');var fs_extra=require(_0xb316('0xa'));var _=require(_0xb316('0xb'));var squel=require(_0xb316('0xc'));var crypto=require('crypto');var jsforce=require(_0xb316('0xd'));var deskjs=require(_0xb316('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb316('0xf'));var Papa=require(_0xb316('0x10'));var Redis=require(_0xb316('0x11'));var authService=require(_0xb316('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb316('0x13'));var hardwareService=require(_0xb316('0x14'));var logger=require(_0xb316('0x15'))(_0xb316('0x16'));var utils=require(_0xb316('0x17'));var config=require(_0xb316('0x18'));var licenseUtil=require(_0xb316('0x19'));var db=require(_0xb316('0x1a'))['db'];function respondWithStatusCode(_0x1c96cc,_0x3f45df){_0x3f45df=_0x3f45df||0xcc;return function(_0x5bbf73){if(_0x5bbf73){return _0x1c96cc[_0xb316('0x1b')](_0x3f45df);}return _0x1c96cc[_0xb316('0x1c')](_0x3f45df)['end']();};}function respondWithResult(_0x451ef6,_0x9aa523){_0x9aa523=_0x9aa523||0xc8;return function(_0x2e4583){if(_0x2e4583){return _0x451ef6[_0xb316('0x1c')](_0x9aa523)['json'](_0x2e4583);}};}function respondWithFilteredResult(_0xf00fc6,_0x19df6a){return function(_0x47d482){if(_0x47d482){var _0x4a1e93=typeof _0x19df6a['offset']===_0xb316('0x1d')&&typeof _0x19df6a['limit']===_0xb316('0x1d');var _0x58d965=_0x47d482['count'];var _0x1463cd=_0x4a1e93?0x0:_0x19df6a['offset'];var _0x54c716=_0x4a1e93?_0x47d482[_0xb316('0x1e')]:_0x19df6a['offset']+_0x19df6a['limit'];var _0x1fc163;if(_0x54c716>=_0x58d965){_0x54c716=_0x58d965;_0x1fc163=0xc8;}else{_0x1fc163=0xce;}_0xf00fc6[_0xb316('0x1c')](_0x1fc163);return _0xf00fc6[_0xb316('0x1f')]('Content-Range',_0x1463cd+'-'+_0x54c716+'/'+_0x58d965)['json'](_0x47d482);}return null;};}function patchUpdates(_0x3f0c08){return function(_0x2b1698){try{jsonpatch[_0xb316('0x20')](_0x2b1698,_0x3f0c08,!![]);}catch(_0x1d9e14){return BPromise[_0xb316('0x21')](_0x1d9e14);}return _0x2b1698[_0xb316('0x22')]();};}function saveUpdates(_0x4c5d06,_0x222375){return function(_0x5d65b6){if(_0x5d65b6){return _0x5d65b6[_0xb316('0x23')](_0x4c5d06)[_0xb316('0x24')](function(_0x515cb5){return _0x515cb5;});}return null;};}function removeEntity(_0x5f069e,_0x55fa58){return function(_0x32cbf2){if(_0x32cbf2){return _0x32cbf2['destroy']()[_0xb316('0x24')](function(){var _0x549535=_0x32cbf2[_0xb316('0x25')]({'plain':!![]});var _0x199511=_0xb316('0x26');return db[_0xb316('0x27')][_0xb316('0x28')]({'where':{'type':_0x199511,'resourceId':_0x549535['id']}})[_0xb316('0x24')](function(){return _0x32cbf2;});})[_0xb316('0x24')](function(){_0x5f069e[_0xb316('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x152686,_0x5e9b17){return function(_0x2ab05a){if(!_0x2ab05a){_0x152686[_0xb316('0x1b')](0x194);}return _0x2ab05a;};}function handleError(_0xe1a09,_0x2b9be0){_0x2b9be0=_0x2b9be0||0x1f4;return function(_0x1dc996){logger['error'](_0x1dc996[_0xb316('0x29')]);if(_0x1dc996['name']){delete _0x1dc996[_0xb316('0x2a')];}_0xe1a09['status'](_0x2b9be0)['send'](_0x1dc996);};}exports['index']=function(_0x55588d,_0xd071f9){var _0x575650={},_0xd51317={},_0x3c08ca={'count':0x0,'rows':[]};var _0x1533e9=_['map'](db['Campaign'][_0xb316('0x2b')],function(_0x40e781){return{'name':_0x40e781[_0xb316('0x2c')],'type':_0x40e781[_0xb316('0x2d')][_0xb316('0x2e')]};});_0xd51317[_0xb316('0x2f')]=_[_0xb316('0x30')](_0x1533e9,_0xb316('0x2a'));_0xd51317[_0xb316('0x31')]=_['keys'](_0x55588d[_0xb316('0x31')]);_0xd51317[_0xb316('0x32')]=_['intersection'](_0xd51317[_0xb316('0x2f')],_0xd51317[_0xb316('0x31')]);_0x575650[_0xb316('0x33')]=_['intersection'](_0xd51317[_0xb316('0x2f')],qs[_0xb316('0x34')](_0x55588d[_0xb316('0x31')][_0xb316('0x34')]));_0x575650['attributes']=_0x575650[_0xb316('0x33')]['length']?_0x575650[_0xb316('0x33')]:_0xd51317[_0xb316('0x2f')];if(!_0x55588d['query'][_0xb316('0x35')]('nolimit')){_0x575650[_0xb316('0x36')]=qs[_0xb316('0x36')](_0x55588d[_0xb316('0x31')][_0xb316('0x36')]);_0x575650[_0xb316('0x37')]=qs[_0xb316('0x37')](_0x55588d[_0xb316('0x31')][_0xb316('0x37')]);}_0x575650[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x55588d[_0xb316('0x31')][_0xb316('0x39')]);_0x575650[_0xb316('0x3a')]=qs['filters'](_[_0xb316('0x3b')](_0x55588d[_0xb316('0x31')],_0xd51317[_0xb316('0x32')]),_0x1533e9);if(_0x55588d['query'][_0xb316('0x3c')]){_0x575650[_0xb316('0x3a')]=_['merge'](_0x575650[_0xb316('0x3a')],{'$or':_[_0xb316('0x30')](_0x1533e9,function(_0x4b553d){if(_0x4b553d['type']!==_0xb316('0x3d')){var _0xc30fb9={};_0xc30fb9[_0x4b553d['name']]={'$like':'%'+_0x55588d['query'][_0xb316('0x3c')]+'%'};return _0xc30fb9;}})});}_0x575650=_['merge']({},_0x575650,_0x55588d[_0xb316('0x3e')]);var _0x4a8afd={'where':_0x575650['where']};return db[_0xb316('0x3f')]['count'](_0x4a8afd)[_0xb316('0x24')](function(_0x21d6cd){_0x3c08ca[_0xb316('0x1e')]=_0x21d6cd;if(_0x55588d[_0xb316('0x31')][_0xb316('0x40')]){_0x575650[_0xb316('0x41')]=[{'all':!![]}];}return db[_0xb316('0x3f')]['findAll'](_0x575650);})[_0xb316('0x24')](function(_0x442243){_0x3c08ca['rows']=_0x442243;return _0x3c08ca;})['then'](respondWithFilteredResult(_0xd071f9,_0x575650))[_0xb316('0x42')](handleError(_0xd071f9,null));};exports[_0xb316('0x43')]=function(_0x134957,_0x35db08){var _0x37f743={'raw':![],'where':{'id':_0x134957[_0xb316('0x44')]['id']}},_0x2521c9={};_0x2521c9['model']=_[_0xb316('0x45')](db[_0xb316('0x3f')]['rawAttributes']);_0x2521c9[_0xb316('0x31')]=_[_0xb316('0x45')](_0x134957['query']);_0x2521c9['filters']=_[_0xb316('0x46')](_0x2521c9[_0xb316('0x2f')],_0x2521c9['query']);_0x37f743[_0xb316('0x33')]=_[_0xb316('0x46')](_0x2521c9[_0xb316('0x2f')],qs[_0xb316('0x34')](_0x134957['query'][_0xb316('0x34')]));_0x37f743[_0xb316('0x33')]=_0x37f743['attributes'][_0xb316('0x47')]?_0x37f743[_0xb316('0x33')]:_0x2521c9[_0xb316('0x2f')];if(_0x134957[_0xb316('0x31')][_0xb316('0x40')]){_0x37f743[_0xb316('0x41')]=[{'all':!![]}];}_0x37f743=_[_0xb316('0x48')]({},_0x37f743,_0x134957[_0xb316('0x3e')]);return db['Campaign']['find'](_0x37f743)[_0xb316('0x24')](handleEntityNotFound(_0x35db08,null))[_0xb316('0x24')](respondWithResult(_0x35db08,null))[_0xb316('0x42')](handleError(_0x35db08,null));};exports['create']=function(_0x2427fb,_0x4f04ff){return db[_0xb316('0x3f')][_0xb316('0x49')](_0x2427fb[_0xb316('0x4a')],{})['then'](function(_0x2fb415){var _0x466789=_0x2427fb[_0xb316('0x4b')][_0xb316('0x25')]({'plain':!![]});if(!_0x466789)throw new Error(_0xb316('0x4c'));if(_0x466789[_0xb316('0x4d')]==='user'){var _0x17683a=_0x2fb415['get']({'plain':!![]});var _0x1e2c89=_0xb316('0x26');return db[_0xb316('0x4e')][_0xb316('0x4f')]({'where':{'name':_0x1e2c89,'userProfileId':_0x466789['userProfileId']},'raw':!![]})[_0xb316('0x24')](function(_0x4fe5e5){if(_0x4fe5e5&&_0x4fe5e5['autoAssociation']===0x0){return db[_0xb316('0x27')][_0xb316('0x49')]({'name':_0x17683a['name'],'resourceId':_0x17683a['id'],'type':_0x4fe5e5[_0xb316('0x2a')],'sectionId':_0x4fe5e5['id']},{})[_0xb316('0x24')](function(){return _0x2fb415;});}else{return _0x2fb415;}})[_0xb316('0x42')](function(_0x2575e3){logger['error'](_0xb316('0x50'),_0x2575e3);throw _0x2575e3;});}return _0x2fb415;})['then'](respondWithResult(_0x4f04ff,0xc9))[_0xb316('0x42')](handleError(_0x4f04ff,null));};exports[_0xb316('0x51')]=function(_0x1d3dcd,_0x2a8cb7){var _0xefbd4d={'where':{'id':_0x1d3dcd[_0xb316('0x44')]['id']}},_0x9b6d3b={};_0x9b6d3b[_0xb316('0x2f')]=_[_0xb316('0x45')](db[_0xb316('0x3f')][_0xb316('0x2b')]);_0xefbd4d[_0xb316('0x33')]=_[_0xb316('0x46')](_0x9b6d3b[_0xb316('0x2f')],qs[_0xb316('0x34')](_0x1d3dcd[_0xb316('0x31')]['fields']));_0xefbd4d[_0xb316('0x33')]=_0xefbd4d['attributes'][_0xb316('0x47')]?_0xefbd4d['attributes']:_0x9b6d3b['model'];if(_0x1d3dcd[_0xb316('0x31')][_0xb316('0x40')]){_0xefbd4d[_0xb316('0x41')]=[{'all':!![]}];}_0xefbd4d=_[_0xb316('0x48')]({},_0xefbd4d,_0x1d3dcd[_0xb316('0x3e')]);return db['Campaign'][_0xb316('0x4f')](_0xefbd4d)[_0xb316('0x24')](handleEntityNotFound(_0x2a8cb7,null))[_0xb316('0x24')](function(_0x3ab74d){if(_0x3ab74d){var _0x3b3a62=_0x3ab74d[_0xb316('0x25')]({'plain':!![]});_0x3b3a62=qs['omit'](_0x3b3a62,['id',_0xb316('0x52'),_0xb316('0x53')]);_0x1d3dcd['body']=_[_0xb316('0x54')](_0x1d3dcd[_0xb316('0x4a')],['id',_0xb316('0x52'),_0xb316('0x53')]);return db[_0xb316('0x3f')]['create'](_[_0xb316('0x48')](_0x3b3a62,_0x1d3dcd[_0xb316('0x4a')]),{'include':_0x1d3dcd[_0xb316('0x31')][_0xb316('0x40')]?[{'all':!![]}]:undefined})[_0xb316('0x24')](function(_0x5e2a64){var _0x3c6c08=_0x1d3dcd[_0xb316('0x4b')][_0xb316('0x25')]({'plain':!![]});if(!_0x3c6c08)throw new Error(_0xb316('0x4c'));if(_0x3c6c08[_0xb316('0x4d')]===_0xb316('0x4b')){var _0x43fecf=_0x5e2a64[_0xb316('0x25')]({'plain':!![]});var _0x3b5f48='IvrCampaigns';return db[_0xb316('0x4e')][_0xb316('0x4f')]({'where':{'name':_0x3b5f48,'userProfileId':_0x3c6c08[_0xb316('0x55')]},'raw':!![]})[_0xb316('0x24')](function(_0xc3d37e){if(_0xc3d37e&&_0xc3d37e['autoAssociation']===0x0){return db[_0xb316('0x27')]['create']({'name':_0x43fecf['name'],'resourceId':_0x43fecf['id'],'type':_0xc3d37e[_0xb316('0x2a')],'sectionId':_0xc3d37e['id']},{})['then'](function(){return _0x5e2a64;});}else{return _0x5e2a64;}})[_0xb316('0x42')](function(_0xae708a){logger[_0xb316('0x56')](_0xb316('0x50'),_0xae708a);throw _0xae708a;});}return _0x5e2a64;});}})[_0xb316('0x24')](respondWithResult(_0x2a8cb7,0xc9))['catch'](handleError(_0x2a8cb7,null));};exports[_0xb316('0x23')]=function(_0x4b63c1,_0x2a36f8){if(_0x4b63c1['body']['id']){delete _0x4b63c1['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x4b63c1[_0xb316('0x44')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x2a36f8,null))[_0xb316('0x24')](saveUpdates(_0x4b63c1[_0xb316('0x4a')],null))['then'](respondWithResult(_0x2a36f8,null))[_0xb316('0x42')](handleError(_0x2a36f8,null));};exports['destroy']=function(_0x366ceb,_0x11c307){return db[_0xb316('0x3f')][_0xb316('0x4f')]({'where':{'id':_0x366ceb[_0xb316('0x44')]['id']}})['then'](handleEntityNotFound(_0x11c307,null))[_0xb316('0x24')](removeEntity(_0x11c307,null))['catch'](handleError(_0x11c307,null));};exports[_0xb316('0x57')]=function(_0x3c388b,_0x695ebe,_0x7405f8){var _0x2f0348={'raw':!![],'where':{}};var _0x30afb5={};var _0x44b76a={'count':0x0,'rows':[]};return db[_0xb316('0x3f')][_0xb316('0x58')]({'where':{'id':_0x3c388b[_0xb316('0x44')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x695ebe,null))['then'](function(_0x3cf379){if(_0x3cf379){_0x30afb5[_0xb316('0x2f')]=_[_0xb316('0x45')](db['CmHopper']['rawAttributes']);_0x30afb5[_0xb316('0x31')]=_[_0xb316('0x45')](_0x3c388b['query']);_0x30afb5[_0xb316('0x32')]=_[_0xb316('0x46')](_0x30afb5[_0xb316('0x2f')],_0x30afb5[_0xb316('0x31')]);_0x2f0348['attributes']=_[_0xb316('0x46')](_0x30afb5[_0xb316('0x2f')],qs[_0xb316('0x34')](_0x3c388b['query'][_0xb316('0x34')]));_0x2f0348['attributes']=_0x2f0348[_0xb316('0x33')][_0xb316('0x47')]?_0x2f0348[_0xb316('0x33')]:_0x30afb5['model'];if(!_0x3c388b[_0xb316('0x31')][_0xb316('0x35')](_0xb316('0x59'))){_0x2f0348[_0xb316('0x36')]=qs[_0xb316('0x36')](_0x3c388b[_0xb316('0x31')][_0xb316('0x36')]);_0x2f0348[_0xb316('0x37')]=qs[_0xb316('0x37')](_0x3c388b[_0xb316('0x31')][_0xb316('0x37')]);}_0x2f0348[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x3c388b['query'][_0xb316('0x39')]);_0x2f0348[_0xb316('0x3a')]=qs[_0xb316('0x32')](_['pick'](_0x3c388b[_0xb316('0x31')],_0x30afb5['filters']));_0x2f0348['where'][_0xb316('0x5a')]=_0x3cf379['id'];if(_0x3c388b[_0xb316('0x31')][_0xb316('0x3c')]){_0x2f0348['where']=_[_0xb316('0x48')](_0x2f0348[_0xb316('0x3a')],{'$or':_['map'](_0x2f0348[_0xb316('0x33')],function(_0x4d1484){var _0x32cb08={};_0x32cb08[_0x4d1484]={'$like':'%'+_0x3c388b[_0xb316('0x31')][_0xb316('0x3c')]+'%'};return _0x32cb08;})});}_0x2f0348=_['merge']({},_0x2f0348,_0x3c388b['options']);return db[_0xb316('0x5b')][_0xb316('0x1e')]({'where':_0x2f0348[_0xb316('0x3a')]})[_0xb316('0x24')](function(_0x22ac31){_0x44b76a[_0xb316('0x1e')]=_0x22ac31;if(_0x3c388b[_0xb316('0x31')]['includeAll']){_0x2f0348[_0xb316('0x41')]=[{'all':!![]}];}return db[_0xb316('0x5b')][_0xb316('0x5c')](_0x2f0348);})[_0xb316('0x24')](function(_0x2995c0){_0x44b76a[_0xb316('0x5d')]=_0x2995c0;return _0x44b76a;});}})[_0xb316('0x24')](respondWithFilteredResult(_0x695ebe,_0x2f0348))[_0xb316('0x42')](handleError(_0x695ebe,null));};exports[_0xb316('0x5e')]=function(_0x184e6d,_0x16d93f,_0x457659){var _0x391b63={'raw':!![],'where':{}};var _0x57074c={};var _0x140f30={'count':0x0,'rows':[]};return db[_0xb316('0x3f')][_0xb316('0x58')]({'where':{'id':_0x184e6d['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x16d93f,null))[_0xb316('0x24')](function(_0x12556e){if(_0x12556e){_0x57074c[_0xb316('0x2f')]=_[_0xb316('0x45')](db['CmHopperHistory'][_0xb316('0x2b')]);_0x57074c[_0xb316('0x31')]=_[_0xb316('0x45')](_0x184e6d[_0xb316('0x31')]);_0x57074c[_0xb316('0x32')]=_[_0xb316('0x46')](_0x57074c['model'],_0x57074c['query']);_0x391b63['attributes']=_[_0xb316('0x46')](_0x57074c[_0xb316('0x2f')],qs['fields'](_0x184e6d[_0xb316('0x31')][_0xb316('0x34')]));_0x391b63[_0xb316('0x33')]=_0x391b63[_0xb316('0x33')][_0xb316('0x47')]?_0x391b63['attributes']:_0x57074c['model'];if(!_0x184e6d[_0xb316('0x31')]['hasOwnProperty'](_0xb316('0x59'))){_0x391b63[_0xb316('0x36')]=qs[_0xb316('0x36')](_0x184e6d['query'][_0xb316('0x36')]);_0x391b63[_0xb316('0x37')]=qs[_0xb316('0x37')](_0x184e6d['query'][_0xb316('0x37')]);}_0x391b63[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x184e6d[_0xb316('0x31')]['sort']);_0x391b63[_0xb316('0x3a')]=qs[_0xb316('0x32')](_[_0xb316('0x3b')](_0x184e6d[_0xb316('0x31')],_0x57074c['filters']));_0x391b63[_0xb316('0x3a')][_0xb316('0x5a')]=_0x12556e['id'];if(_0x184e6d[_0xb316('0x31')][_0xb316('0x3c')]){_0x391b63[_0xb316('0x3a')]=_[_0xb316('0x48')](_0x391b63[_0xb316('0x3a')],{'$or':_['map'](_0x391b63[_0xb316('0x33')],function(_0x4c18e2){var _0x7535a5={};_0x7535a5[_0x4c18e2]={'$like':'%'+_0x184e6d[_0xb316('0x31')][_0xb316('0x3c')]+'%'};return _0x7535a5;})});}_0x391b63=_['merge']({},_0x391b63,_0x184e6d['options']);return db[_0xb316('0x5f')]['count']({'where':_0x391b63['where']})[_0xb316('0x24')](function(_0x2cbaee){_0x140f30[_0xb316('0x1e')]=_0x2cbaee;if(_0x184e6d['query'][_0xb316('0x40')]){_0x391b63[_0xb316('0x41')]=[{'all':!![]}];}return db[_0xb316('0x5f')][_0xb316('0x5c')](_0x391b63);})['then'](function(_0x161bbe){_0x140f30['rows']=_0x161bbe;return _0x140f30;});}})[_0xb316('0x24')](respondWithFilteredResult(_0x16d93f,_0x391b63))[_0xb316('0x42')](handleError(_0x16d93f,null));};exports['getHopperFinals']=function(_0x4daf85,_0x5ee730,_0x312660){var _0x3ea249={'raw':!![],'where':{}};var _0x1cd9e5={};var _0x62bbe3={'count':0x0,'rows':[]};return db[_0xb316('0x3f')][_0xb316('0x58')]({'where':{'id':_0x4daf85['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x5ee730,null))[_0xb316('0x24')](function(_0x4e3e0f){if(_0x4e3e0f){_0x1cd9e5[_0xb316('0x2f')]=_[_0xb316('0x45')](db[_0xb316('0x60')]['rawAttributes']);_0x1cd9e5[_0xb316('0x31')]=_[_0xb316('0x45')](_0x4daf85[_0xb316('0x31')]);_0x1cd9e5[_0xb316('0x32')]=_[_0xb316('0x46')](_0x1cd9e5[_0xb316('0x2f')],_0x1cd9e5[_0xb316('0x31')]);_0x3ea249[_0xb316('0x33')]=_['intersection'](_0x1cd9e5['model'],qs[_0xb316('0x34')](_0x4daf85[_0xb316('0x31')][_0xb316('0x34')]));_0x3ea249['attributes']=_0x3ea249[_0xb316('0x33')][_0xb316('0x47')]?_0x3ea249[_0xb316('0x33')]:_0x1cd9e5['model'];if(!_0x4daf85['query'][_0xb316('0x35')]('nolimit')){_0x3ea249[_0xb316('0x36')]=qs['limit'](_0x4daf85[_0xb316('0x31')][_0xb316('0x36')]);_0x3ea249['offset']=qs[_0xb316('0x37')](_0x4daf85['query'][_0xb316('0x37')]);}_0x3ea249['order']=qs[_0xb316('0x39')](_0x4daf85['query'][_0xb316('0x39')]);_0x3ea249['where']=qs[_0xb316('0x32')](_[_0xb316('0x3b')](_0x4daf85['query'],_0x1cd9e5[_0xb316('0x32')]));_0x3ea249['where'][_0xb316('0x5a')]=_0x4e3e0f['id'];if(_0x4daf85[_0xb316('0x31')]['filter']){_0x3ea249[_0xb316('0x3a')]=_['merge'](_0x3ea249[_0xb316('0x3a')],{'$or':_[_0xb316('0x30')](_0x3ea249['attributes'],function(_0x5c78a8){var _0x2758bf={};_0x2758bf[_0x5c78a8]={'$like':'%'+_0x4daf85[_0xb316('0x31')][_0xb316('0x3c')]+'%'};return _0x2758bf;})});}_0x3ea249=_[_0xb316('0x48')]({},_0x3ea249,_0x4daf85[_0xb316('0x3e')]);return db[_0xb316('0x60')][_0xb316('0x1e')]({'where':_0x3ea249[_0xb316('0x3a')]})[_0xb316('0x24')](function(_0x1bc554){_0x62bbe3[_0xb316('0x1e')]=_0x1bc554;if(_0x4daf85[_0xb316('0x31')]['includeAll']){_0x3ea249[_0xb316('0x41')]=[{'all':!![]}];}return db[_0xb316('0x60')][_0xb316('0x5c')](_0x3ea249);})['then'](function(_0x4a947d){_0x62bbe3[_0xb316('0x5d')]=_0x4a947d;return _0x62bbe3;});}})[_0xb316('0x24')](respondWithFilteredResult(_0x5ee730,_0x3ea249))['catch'](handleError(_0x5ee730,null));};exports['getHopperBlacks']=function(_0x4f3aa4,_0xa9376f,_0x4f1d20){var _0x35975d={'raw':!![],'where':{}};var _0xe400eb={};var _0x4c80a0={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4f3aa4['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0xa9376f,null))['then'](function(_0x82823){if(_0x82823){_0xe400eb[_0xb316('0x2f')]=_[_0xb316('0x45')](db[_0xb316('0x61')][_0xb316('0x2b')]);_0xe400eb[_0xb316('0x31')]=_[_0xb316('0x45')](_0x4f3aa4['query']);_0xe400eb[_0xb316('0x32')]=_[_0xb316('0x46')](_0xe400eb[_0xb316('0x2f')],_0xe400eb[_0xb316('0x31')]);_0x35975d[_0xb316('0x33')]=_['intersection'](_0xe400eb['model'],qs['fields'](_0x4f3aa4['query']['fields']));_0x35975d['attributes']=_0x35975d[_0xb316('0x33')]['length']?_0x35975d['attributes']:_0xe400eb[_0xb316('0x2f')];if(!_0x4f3aa4[_0xb316('0x31')][_0xb316('0x35')](_0xb316('0x59'))){_0x35975d[_0xb316('0x36')]=qs[_0xb316('0x36')](_0x4f3aa4[_0xb316('0x31')][_0xb316('0x36')]);_0x35975d[_0xb316('0x37')]=qs[_0xb316('0x37')](_0x4f3aa4['query']['offset']);}_0x35975d[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x4f3aa4['query'][_0xb316('0x39')]);_0x35975d['where']=qs[_0xb316('0x32')](_['pick'](_0x4f3aa4[_0xb316('0x31')],_0xe400eb[_0xb316('0x32')]));_0x35975d[_0xb316('0x3a')][_0xb316('0x5a')]=_0x82823['id'];if(_0x4f3aa4['query']['filter']){_0x35975d[_0xb316('0x3a')]=_[_0xb316('0x48')](_0x35975d[_0xb316('0x3a')],{'$or':_[_0xb316('0x30')](_0x35975d[_0xb316('0x33')],function(_0x37cc45){var _0x553c80={};_0x553c80[_0x37cc45]={'$like':'%'+_0x4f3aa4['query'][_0xb316('0x3c')]+'%'};return _0x553c80;})});}_0x35975d=_[_0xb316('0x48')]({},_0x35975d,_0x4f3aa4[_0xb316('0x3e')]);return db[_0xb316('0x61')][_0xb316('0x1e')]({'where':_0x35975d[_0xb316('0x3a')]})[_0xb316('0x24')](function(_0x2c3982){_0x4c80a0['count']=_0x2c3982;if(_0x4f3aa4['query'][_0xb316('0x40')]){_0x35975d[_0xb316('0x41')]=[{'all':!![]}];}return db[_0xb316('0x61')][_0xb316('0x5c')](_0x35975d);})[_0xb316('0x24')](function(_0x519050){_0x4c80a0[_0xb316('0x5d')]=_0x519050;return _0x4c80a0;});}})[_0xb316('0x24')](respondWithFilteredResult(_0xa9376f,_0x35975d))[_0xb316('0x42')](handleError(_0xa9376f,null));};exports[_0xb316('0x62')]=function(_0x3b7c8e,_0x145043,_0x1ba87a){var _0x51082c={};var _0x491fe1={};var _0x3686c4;var _0x470f9d;return db[_0xb316('0x3f')][_0xb316('0x58')]({'where':{'id':_0x3b7c8e['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x145043,null))[_0xb316('0x24')](function(_0x3e0acb){if(_0x3e0acb){_0x3686c4=_0x3e0acb;_0x491fe1[_0xb316('0x2f')]=_[_0xb316('0x45')](db[_0xb316('0x63')][_0xb316('0x2b')]);_0x491fe1[_0xb316('0x31')]=_[_0xb316('0x45')](_0x3b7c8e['query']);_0x491fe1['filters']=_[_0xb316('0x46')](_0x491fe1['model'],_0x491fe1[_0xb316('0x31')]);_0x51082c[_0xb316('0x33')]=_[_0xb316('0x46')](_0x491fe1['model'],qs[_0xb316('0x34')](_0x3b7c8e['query'][_0xb316('0x34')]));_0x51082c[_0xb316('0x33')]=_0x51082c[_0xb316('0x33')][_0xb316('0x47')]?_0x51082c[_0xb316('0x33')]:_0x491fe1[_0xb316('0x2f')];_0x51082c[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x3b7c8e[_0xb316('0x31')][_0xb316('0x39')]);_0x51082c[_0xb316('0x3a')]=qs[_0xb316('0x32')](_['pick'](_0x3b7c8e[_0xb316('0x31')],_0x491fe1[_0xb316('0x32')]));if(_0x3b7c8e['query'][_0xb316('0x3c')]){_0x51082c[_0xb316('0x3a')]=_[_0xb316('0x48')](_0x51082c[_0xb316('0x3a')],{'$or':_[_0xb316('0x30')](_0x51082c[_0xb316('0x33')],function(_0x21fdc3){var _0x2b984f={};_0x2b984f[_0x21fdc3]={'$like':'%'+_0x3b7c8e['query'][_0xb316('0x3c')]+'%'};return _0x2b984f;})});}_0x51082c=_[_0xb316('0x48')]({},_0x51082c,_0x3b7c8e[_0xb316('0x3e')]);return _0x3686c4['getLists'](_0x51082c);}})['then'](function(_0x3f97f4){if(_0x3f97f4){_0x470f9d=_0x3f97f4[_0xb316('0x47')];if(!_0x3b7c8e[_0xb316('0x31')]['hasOwnProperty'](_0xb316('0x59'))){_0x51082c[_0xb316('0x36')]=qs['limit'](_0x3b7c8e[_0xb316('0x31')][_0xb316('0x36')]);_0x51082c[_0xb316('0x37')]=qs[_0xb316('0x37')](_0x3b7c8e[_0xb316('0x31')][_0xb316('0x37')]);}return _0x3686c4[_0xb316('0x62')](_0x51082c);}})[_0xb316('0x24')](function(_0x3a479c){if(_0x3a479c){return _0x3a479c?{'count':_0x470f9d,'rows':_0x3a479c}:null;}})[_0xb316('0x24')](respondWithResult(_0x145043,null))[_0xb316('0x42')](handleError(_0x145043,null));};exports[_0xb316('0x64')]=function(_0x2c8f28,_0x18c94e,_0x340db3){var _0x4670db,_0x372037;var _0x9e58c5=[];var _0x9cefe=moment()[_0xb316('0x65')](_0xb316('0x66'));return db[_0xb316('0x3f')][_0xb316('0x4f')]({'where':{'id':_0x2c8f28['params']['id']}})['then'](handleEntityNotFound(_0x18c94e,null))[_0xb316('0x24')](function(_0x37f3fa){if(_0x37f3fa){_0x372037=_0x37f3fa;return _0x37f3fa[_0xb316('0x64')](_0x2c8f28['body'][_0xb316('0x67')],_[_0xb316('0x54')](_0x2c8f28[_0xb316('0x4a')],['ids','id'])||{});}return null;})[_0xb316('0x68')](function(_0x3aedcb){var _0x3d2db8;var _0x301bb9;_0x4670db=_0x3aedcb||[];var _0x33968b=[];if(_0x3aedcb){for(var _0x2ab203=0x0;_0x2ab203<_0x3aedcb[_0xb316('0x47')];_0x2ab203+=0x1){var _0x4336c3=_0x3aedcb[_0x2ab203][_0xb316('0x25')]({'plain':!![]});_0x372037['dialCheckDuplicateType']=_0x2c8f28[_0xb316('0x4a')][_0xb316('0x69')]?_0x2c8f28['body'][_0xb316('0x69')]:_0x372037[_0xb316('0x69')];switch(_0x372037['dialCheckDuplicateType']){case _0xb316('0x6a'):_0x3d2db8=squel[_0xb316('0x6b')]()[_0xb316('0x6c')](_0xb316('0x6d'))[_0xb316('0x6e')]([_0xb316('0x6f'),'scheduledAt',_0xb316('0x70'),_0xb316('0x71'),_0xb316('0x5a'),_0xb316('0x52'),_0xb316('0x53')],squel[_0xb316('0x72')]()[_0xb316('0x73')](_0xb316('0x6f'),_0xb316('0x6f'))[_0xb316('0x73')](_0xb316('0x74'),'scheduledAt')['field']('id',_0xb316('0x70'))[_0xb316('0x73')](_0x4336c3[_0xb316('0x75')][_0xb316('0x76')](),_0xb316('0x71'))[_0xb316('0x73')](_0x2c8f28[_0xb316('0x44')]['id'][_0xb316('0x76')](),'CampaignId')['field']('\x27'+_0x9cefe+'\x27','createdAt')[_0xb316('0x73')]('\x27'+_0x9cefe+'\x27',_0xb316('0x53'))[_0xb316('0x77')](_0xb316('0x78'))[_0xb316('0x3a')](_0xb316('0x79'))[_0xb316('0x3a')]('ListId\x20=\x20?',_0x4336c3[_0xb316('0x75')][_0xb316('0x76')]())[_0xb316('0x3a')](_0xb316('0x7a'))[_0xb316('0x3a')](_0xb316('0x7b'),squel[_0xb316('0x72')]()['field'](_0xb316('0x7c'))[_0xb316('0x77')]('cm_hopper_final')[_0xb316('0x3a')](_0xb316('0x7d'),_0x2c8f28['params']['id'][_0xb316('0x76')]()))[_0xb316('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb316('0x72')]()[_0xb316('0x73')](_0xb316('0x7e'))[_0xb316('0x77')](_0xb316('0x6d'))[_0xb316('0x3a')](_0xb316('0x7d'),_0x2c8f28[_0xb316('0x44')]['id']['toString']())))[_0xb316('0x76')]();break;case'onlyIfOpen':_0x3d2db8=squel[_0xb316('0x6b')]()[_0xb316('0x6c')](_0xb316('0x6d'))[_0xb316('0x6e')](['phone','scheduledAt',_0xb316('0x70'),_0xb316('0x71'),_0xb316('0x5a'),_0xb316('0x52'),_0xb316('0x53')],squel[_0xb316('0x72')]()['field'](_0xb316('0x6f'),'phone')[_0xb316('0x73')](_0xb316('0x74'),'scheduledAt')[_0xb316('0x73')]('id','ContactId')[_0xb316('0x73')](_0x4336c3[_0xb316('0x75')][_0xb316('0x76')](),'ListId')[_0xb316('0x73')](_0x2c8f28[_0xb316('0x44')]['id'][_0xb316('0x76')](),_0xb316('0x5a'))[_0xb316('0x73')]('\x27'+_0x9cefe+'\x27','createdAt')['field']('\x27'+_0x9cefe+'\x27',_0xb316('0x53'))[_0xb316('0x77')](_0xb316('0x78'))[_0xb316('0x3a')](_0xb316('0x79'))[_0xb316('0x3a')](_0xb316('0x7f'),_0x4336c3[_0xb316('0x75')]['toString']())[_0xb316('0x3a')](_0xb316('0x7a'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb316('0x73')](_0xb316('0x7e'))['from'](_0xb316('0x6d'))[_0xb316('0x3a')](_0xb316('0x7d'),_0x2c8f28[_0xb316('0x44')]['id']['toString']())))['toString']();break;default:_0x3d2db8=squel[_0xb316('0x6b')]()[_0xb316('0x6c')](_0xb316('0x6d'))[_0xb316('0x6e')]([_0xb316('0x6f'),_0xb316('0x80'),'ContactId',_0xb316('0x71'),_0xb316('0x5a'),'createdAt',_0xb316('0x53')],squel['select']()[_0xb316('0x73')](_0xb316('0x6f'),_0xb316('0x6f'))[_0xb316('0x73')]('NOW()',_0xb316('0x80'))['field']('id',_0xb316('0x70'))[_0xb316('0x73')](_0x4336c3[_0xb316('0x75')][_0xb316('0x76')](),_0xb316('0x71'))[_0xb316('0x73')](_0x2c8f28['params']['id']['toString'](),_0xb316('0x5a'))[_0xb316('0x73')]('\x27'+_0x9cefe+'\x27',_0xb316('0x52'))['field']('\x27'+_0x9cefe+'\x27',_0xb316('0x53'))[_0xb316('0x77')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xb316('0x3a')](_0xb316('0x7f'),_0x4336c3[_0xb316('0x75')][_0xb316('0x76')]())[_0xb316('0x3a')](_0xb316('0x7a')))[_0xb316('0x76')]();}_0x301bb9=squel[_0xb316('0x6b')]()[_0xb316('0x6c')]('cm_hopper_additional_phones')['fromQuery']([_0xb316('0x81'),'scheduledAt',_0xb316('0x6f'),_0xb316('0x82'),_0xb316('0x52'),_0xb316('0x53')],squel[_0xb316('0x72')]()[_0xb316('0x73')](_0xb316('0x83'),'id')[_0xb316('0x73')](_0xb316('0x74'),'scheduledAt')['field']('ci.item',_0xb316('0x6f'))[_0xb316('0x73')]('ci.OrderBY',_0xb316('0x82'))[_0xb316('0x73')]('\x27'+_0x9cefe+'\x27',_0xb316('0x52'))[_0xb316('0x73')]('\x27'+_0x9cefe+'\x27',_0xb316('0x53'))[_0xb316('0x77')](_0xb316('0x84'),'ci')[_0xb316('0x85')](_0xb316('0x6d'),'h',_0xb316('0x86'))[_0xb316('0x3a')](_0xb316('0x87'),_0x4336c3[_0xb316('0x75')][_0xb316('0x76')]())[_0xb316('0x3a')](_0xb316('0x88'),_0x2c8f28[_0xb316('0x44')]['id'][_0xb316('0x76')]())[_0xb316('0x3a')](_0xb316('0x89'),_0x9cefe))[_0xb316('0x76')]();_0x33968b[_0xb316('0x8a')](db[_0xb316('0x8b')][_0xb316('0x31')](_0x3d2db8));_0x9e58c5[_0xb316('0x8a')](db[_0xb316('0x8b')][_0xb316('0x31')](_0x301bb9));}return BPromise[_0xb316('0x8c')](_0x33968b);}})['then'](function(){return BPromise[_0xb316('0x8c')](_0x9e58c5);})[_0xb316('0x24')](function(){return _0x4670db;})[_0xb316('0x24')](respondWithResult(_0x18c94e,null))[_0xb316('0x42')](handleError(_0x18c94e,null));};exports[_0xb316('0x8d')]=function(_0x1b9e66,_0xfb88ba,_0x26e457){return db[_0xb316('0x3f')][_0xb316('0x4f')]({'where':{'id':_0x1b9e66[_0xb316('0x44')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0xfb88ba,null))['then'](function(_0x340be6){if(_0x340be6){return _0x340be6[_0xb316('0x8d')](_0x1b9e66[_0xb316('0x31')][_0xb316('0x67')]);}})[_0xb316('0x24')](function(_0x436a50){if(_0x436a50){return db[_0xb316('0x5b')][_0xb316('0x28')]({'where':{'ListId':_0x1b9e66[_0xb316('0x31')][_0xb316('0x67')],'CampaignId':_0x1b9e66['params']['id']}})[_0xb316('0x24')](function(){return _0x436a50;});}})['then'](respondWithStatusCode(_0xfb88ba,null))[_0xb316('0x42')](handleError(_0xfb88ba,null));};exports[_0xb316('0x8e')]=function(_0x24fac9,_0xf21d91,_0xc1c6a3){var _0x37b8bb={};var _0x192225={};var _0x35dc3e;var _0x273776;return db[_0xb316('0x3f')]['findOne']({'where':{'id':_0x24fac9[_0xb316('0x44')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0xf21d91,null))[_0xb316('0x24')](function(_0x2db500){if(_0x2db500){_0x35dc3e=_0x2db500;_0x192225[_0xb316('0x2f')]=_[_0xb316('0x45')](db[_0xb316('0x63')][_0xb316('0x2b')]);_0x192225[_0xb316('0x31')]=_[_0xb316('0x45')](_0x24fac9[_0xb316('0x31')]);_0x192225[_0xb316('0x32')]=_[_0xb316('0x46')](_0x192225[_0xb316('0x2f')],_0x192225[_0xb316('0x31')]);_0x37b8bb['attributes']=_[_0xb316('0x46')](_0x192225['model'],qs[_0xb316('0x34')](_0x24fac9[_0xb316('0x31')][_0xb316('0x34')]));_0x37b8bb[_0xb316('0x33')]=_0x37b8bb['attributes'][_0xb316('0x47')]?_0x37b8bb[_0xb316('0x33')]:_0x192225[_0xb316('0x2f')];_0x37b8bb[_0xb316('0x38')]=qs[_0xb316('0x39')](_0x24fac9['query'][_0xb316('0x39')]);_0x37b8bb[_0xb316('0x3a')]=qs[_0xb316('0x32')](_[_0xb316('0x3b')](_0x24fac9[_0xb316('0x31')],_0x192225[_0xb316('0x32')]));if(_0x24fac9[_0xb316('0x31')][_0xb316('0x3c')]){_0x37b8bb[_0xb316('0x3a')]=_[_0xb316('0x48')](_0x37b8bb[_0xb316('0x3a')],{'$or':_[_0xb316('0x30')](_0x37b8bb['attributes'],function(_0x1736d8){var _0x41faf8={};_0x41faf8[_0x1736d8]={'$like':'%'+_0x24fac9[_0xb316('0x31')]['filter']+'%'};return _0x41faf8;})});}_0x37b8bb=_[_0xb316('0x48')]({},_0x37b8bb,_0x24fac9[_0xb316('0x3e')]);return _0x35dc3e[_0xb316('0x8e')](_0x37b8bb);}})[_0xb316('0x24')](function(_0x57d15c){if(_0x57d15c){_0x273776=_0x57d15c[_0xb316('0x47')];if(!_0x24fac9[_0xb316('0x31')]['hasOwnProperty'](_0xb316('0x59'))){_0x37b8bb[_0xb316('0x36')]=qs['limit'](_0x24fac9[_0xb316('0x31')][_0xb316('0x36')]);_0x37b8bb['offset']=qs[_0xb316('0x37')](_0x24fac9[_0xb316('0x31')]['offset']);}return _0x35dc3e['getBlackLists'](_0x37b8bb);}})[_0xb316('0x24')](function(_0x118106){if(_0x118106){return _0x118106?{'count':_0x273776,'rows':_0x118106}:null;}})['then'](respondWithResult(_0xf21d91,null))['catch'](handleError(_0xf21d91,null));};exports[_0xb316('0x8f')]=function(_0x3274f8,_0x5b5df2,_0x311306){var _0x6ec3bf,_0xd9dc4e;var _0x1f0c6c=[];var _0x12dcf5=moment()[_0xb316('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xb316('0x3f')][_0xb316('0x4f')]({'where':{'id':_0x3274f8[_0xb316('0x44')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x5b5df2,null))[_0xb316('0x24')](function(_0x5a418b){if(_0x5a418b){_0xd9dc4e=_0x5a418b;return _0x5a418b[_0xb316('0x8f')](_0x3274f8[_0xb316('0x4a')][_0xb316('0x67')],_[_0xb316('0x54')](_0x3274f8[_0xb316('0x4a')],[_0xb316('0x67'),'id'])||{});}return null;})[_0xb316('0x68')](function(_0x2a1bd9){var _0xf0a7ab;var _0x6406bc;_0x6ec3bf=_0x2a1bd9||[];var _0x46c86b=[];if(_0x2a1bd9){for(var _0x4994f5=0x0;_0x4994f5<_0x2a1bd9[_0xb316('0x47')];_0x4994f5+=0x1){var _0x3d94ef=_0x2a1bd9[_0x4994f5]['get']({'plain':!![]});_0xf0a7ab=squel[_0xb316('0x6b')]()[_0xb316('0x6c')](_0xb316('0x90'))[_0xb316('0x6e')](['phone',_0xb316('0x70'),_0xb316('0x71'),_0xb316('0x5a'),_0xb316('0x52'),_0xb316('0x53')],squel[_0xb316('0x72')]()[_0xb316('0x73')]('phone','phone')[_0xb316('0x73')]('id',_0xb316('0x70'))[_0xb316('0x73')](_0x3d94ef[_0xb316('0x75')][_0xb316('0x76')](),_0xb316('0x71'))[_0xb316('0x73')](_0x3274f8[_0xb316('0x44')]['id']['toString'](),'CampaignId')[_0xb316('0x73')](_0xb316('0x74'),_0xb316('0x52'))['field']('NOW()',_0xb316('0x53'))['from']('cm_contacts')[_0xb316('0x3a')](_0xb316('0x79'))[_0xb316('0x3a')](_0xb316('0x7f'),_0x3d94ef[_0xb316('0x75')]['toString']())[_0xb316('0x3a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x46c86b[_0xb316('0x8a')](db[_0xb316('0x8b')]['query'](_0xf0a7ab));}return BPromise[_0xb316('0x8c')](_0x46c86b);}})[_0xb316('0x24')](function(){return _0x6ec3bf;})['then'](respondWithResult(_0x5b5df2,null))[_0xb316('0x42')](handleError(_0x5b5df2,null));};exports['removeBlackLists']=function(_0x456d74,_0x1471c4,_0x12b76d){return db[_0xb316('0x3f')]['find']({'where':{'id':_0x456d74['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x1471c4,null))['then'](function(_0x152e8a){if(_0x152e8a){return _0x152e8a[_0xb316('0x91')](_0x456d74[_0xb316('0x31')][_0xb316('0x67')]);}})[_0xb316('0x24')](function(_0x4d95f1){if(_0x4d95f1){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x456d74[_0xb316('0x31')][_0xb316('0x67')],'CampaignId':_0x456d74[_0xb316('0x44')]['id']}})[_0xb316('0x24')](function(){return _0x4d95f1;});}})['then'](respondWithStatusCode(_0x1471c4,null))[_0xb316('0x42')](handleError(_0x1471c4,null));}; \ No newline at end of file +var _0x9c02=['limit','count','set','Content-Range','apply','reject','save','then','destroy','IvrCampaigns','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','update','getHoppers','findOne','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId','cm_hopper_additional_phones','fromQuery','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0xf04221,_0x4c7328){var _0x57a74d=function(_0x5c4187){while(--_0x5c4187){_0xf04221['push'](_0xf04221['shift']());}};_0x57a74d(++_0x4c7328);}(_0x9c02,0x196));var _0x29c0=function(_0x222f1b,_0x3a8cdc){_0x222f1b=_0x222f1b-0x0;var _0x132412=_0x9c02[_0x222f1b];return _0x132412;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){var _0x1993a5=_0x402c54['get']({'plain':!![]});var _0x161b39=_0x29c0('0x23');return db['UserProfileResource'][_0x29c0('0x22')]({'where':{'type':_0x161b39,'resourceId':_0x1993a5['id']}})[_0x29c0('0x21')](function(){return _0x402c54;});})[_0x29c0('0x21')](function(){_0x5846d0[_0x29c0('0x15')](0xcc)[_0x29c0('0x16')]();});}};}function handleEntityNotFound(_0x46be76,_0x4d11b3){return function(_0x531c2c){if(!_0x531c2c){_0x46be76['sendStatus'](0x194);}return _0x531c2c;};}function handleError(_0x3a684c,_0x9803d5){_0x9803d5=_0x9803d5||0x1f4;return function(_0x4cdf7c){logger['error'](_0x4cdf7c[_0x29c0('0x24')]);if(_0x4cdf7c[_0x29c0('0x25')]){delete _0x4cdf7c['name'];}_0x3a684c['status'](_0x9803d5)['send'](_0x4cdf7c);};}exports[_0x29c0('0x26')]=function(_0x193e55,_0x322c86){var _0x4edead={},_0x19dd04={},_0x291748={'count':0x0,'rows':[]};var _0x598bc4=_[_0x29c0('0x27')](db[_0x29c0('0x28')][_0x29c0('0x29')],function(_0x188910){return{'name':_0x188910[_0x29c0('0x2a')],'type':_0x188910[_0x29c0('0x2b')][_0x29c0('0x2c')]};});_0x19dd04['model']=_['map'](_0x598bc4,_0x29c0('0x25'));_0x19dd04[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x193e55['query']);_0x19dd04[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x19dd04['model'],_0x19dd04['query']);_0x4edead[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x19dd04[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x4edead[_0x29c0('0x31')]=_0x4edead['attributes'][_0x29c0('0x34')]?_0x4edead['attributes']:_0x19dd04[_0x29c0('0x32')];if(!_0x193e55[_0x29c0('0x2d')][_0x29c0('0x35')]('nolimit')){_0x4edead[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x193e55['query'][_0x29c0('0x1a')]);_0x4edead[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x4edead[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x4edead[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x193e55[_0x29c0('0x2d')],_0x19dd04[_0x29c0('0x2f')]),_0x598bc4);if(_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x4edead[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x4edead[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x598bc4,function(_0x12df6a){if(_0x12df6a[_0x29c0('0x2b')]!==_0x29c0('0x3c')){var _0x5d42f6={};_0x5d42f6[_0x12df6a[_0x29c0('0x25')]]={'$like':'%'+_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x5d42f6;}})});}_0x4edead=_[_0x29c0('0x3b')]({},_0x4edead,_0x193e55[_0x29c0('0x3d')]);var _0x4f1900={'where':_0x4edead[_0x29c0('0x38')]};return db[_0x29c0('0x28')][_0x29c0('0x1b')](_0x4f1900)['then'](function(_0x42d7b9){_0x291748[_0x29c0('0x1b')]=_0x42d7b9;if(_0x193e55['query'][_0x29c0('0x3e')]){_0x4edead['include']=[{'all':!![]}];}return db[_0x29c0('0x28')]['findAll'](_0x4edead);})[_0x29c0('0x21')](function(_0x406a23){_0x291748[_0x29c0('0x3f')]=_0x406a23;return _0x291748;})[_0x29c0('0x21')](respondWithFilteredResult(_0x322c86,_0x4edead))[_0x29c0('0x40')](handleError(_0x322c86,null));};exports[_0x29c0('0x41')]=function(_0x4b1d0d,_0x4a277b){var _0x2dfcb7={'raw':![],'where':{'id':_0x4b1d0d['params']['id']}},_0x44bb0d={};_0x44bb0d[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db[_0x29c0('0x28')][_0x29c0('0x29')]);_0x44bb0d[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x4b1d0d[_0x29c0('0x2d')]);_0x44bb0d[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],_0x44bb0d[_0x29c0('0x2d')]);_0x2dfcb7[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x4b1d0d[_0x29c0('0x2d')]['fields']));_0x2dfcb7[_0x29c0('0x31')]=_0x2dfcb7[_0x29c0('0x31')]['length']?_0x2dfcb7[_0x29c0('0x31')]:_0x44bb0d[_0x29c0('0x32')];if(_0x4b1d0d['query'][_0x29c0('0x3e')]){_0x2dfcb7['include']=[{'all':!![]}];}_0x2dfcb7=_[_0x29c0('0x3b')]({},_0x2dfcb7,_0x4b1d0d['options']);return db[_0x29c0('0x28')][_0x29c0('0x42')](_0x2dfcb7)[_0x29c0('0x21')](handleEntityNotFound(_0x4a277b,null))['then'](respondWithResult(_0x4a277b,null))[_0x29c0('0x40')](handleError(_0x4a277b,null));};exports['create']=function(_0x3e1386,_0x4bc495){return db[_0x29c0('0x28')][_0x29c0('0x43')](_0x3e1386[_0x29c0('0x44')],{})[_0x29c0('0x21')](function(_0x55b2b3){var _0x53edae=_0x3e1386[_0x29c0('0x45')][_0x29c0('0x46')]({'plain':!![]});if(!_0x53edae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53edae[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x32e3ca=_0x55b2b3[_0x29c0('0x46')]({'plain':!![]});var _0x1d2578=_0x29c0('0x23');return db['UserProfileSection'][_0x29c0('0x42')]({'where':{'name':_0x1d2578,'userProfileId':_0x53edae[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x473072){if(_0x473072&&_0x473072[_0x29c0('0x49')]===0x0){return db['UserProfileResource'][_0x29c0('0x43')]({'name':_0x32e3ca['name'],'resourceId':_0x32e3ca['id'],'type':_0x473072['name'],'sectionId':_0x473072['id']},{})[_0x29c0('0x21')](function(){return _0x55b2b3;});}else{return _0x55b2b3;}})['catch'](function(_0x271709){logger[_0x29c0('0x4a')](_0x29c0('0x4b'),_0x271709);throw _0x271709;});}return _0x55b2b3;})[_0x29c0('0x21')](respondWithResult(_0x4bc495,0xc9))[_0x29c0('0x40')](handleError(_0x4bc495,null));};exports['clone']=function(_0x4f3d30,_0x2e3f93){var _0x4bfdb6={'where':{'id':_0x4f3d30[_0x29c0('0x4c')]['id']}},_0x36afb={};_0x36afb['model']=_[_0x29c0('0x2e')](db['Campaign'][_0x29c0('0x29')]);_0x4bfdb6['attributes']=_[_0x29c0('0x30')](_0x36afb[_0x29c0('0x32')],qs['fields'](_0x4f3d30['query']['fields']));_0x4bfdb6[_0x29c0('0x31')]=_0x4bfdb6[_0x29c0('0x31')]['length']?_0x4bfdb6['attributes']:_0x36afb[_0x29c0('0x32')];if(_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x4bfdb6[_0x29c0('0x4d')]=[{'all':!![]}];}_0x4bfdb6=_[_0x29c0('0x3b')]({},_0x4bfdb6,_0x4f3d30['options']);return db[_0x29c0('0x28')]['find'](_0x4bfdb6)[_0x29c0('0x21')](handleEntityNotFound(_0x2e3f93,null))[_0x29c0('0x21')](function(_0x203641){if(_0x203641){var _0x8bd093=_0x203641[_0x29c0('0x46')]({'plain':!![]});_0x8bd093=qs[_0x29c0('0x4e')](_0x8bd093,['id',_0x29c0('0x4f'),_0x29c0('0x50')]);_0x4f3d30[_0x29c0('0x44')]=_['omit'](_0x4f3d30['body'],['id',_0x29c0('0x4f'),_0x29c0('0x50')]);return db[_0x29c0('0x28')][_0x29c0('0x43')](_['merge'](_0x8bd093,_0x4f3d30['body']),{'include':_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]?[{'all':!![]}]:undefined})[_0x29c0('0x21')](function(_0x5a393d){var _0x4fc1bc=_0x4f3d30[_0x29c0('0x45')]['get']({'plain':!![]});if(!_0x4fc1bc)throw new Error(_0x29c0('0x51'));if(_0x4fc1bc[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x2afda9=_0x5a393d[_0x29c0('0x46')]({'plain':!![]});var _0x1fecd8=_0x29c0('0x23');return db[_0x29c0('0x52')]['find']({'where':{'name':_0x1fecd8,'userProfileId':_0x4fc1bc[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x18f619){if(_0x18f619&&_0x18f619[_0x29c0('0x49')]===0x0){return db[_0x29c0('0x53')][_0x29c0('0x43')]({'name':_0x2afda9[_0x29c0('0x25')],'resourceId':_0x2afda9['id'],'type':_0x18f619[_0x29c0('0x25')],'sectionId':_0x18f619['id']},{})[_0x29c0('0x21')](function(){return _0x5a393d;});}else{return _0x5a393d;}})[_0x29c0('0x40')](function(_0x1a686f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a686f);throw _0x1a686f;});}return _0x5a393d;});}})[_0x29c0('0x21')](respondWithResult(_0x2e3f93,0xc9))[_0x29c0('0x40')](handleError(_0x2e3f93,null));};exports[_0x29c0('0x54')]=function(_0x28c970,_0x2006fd){if(_0x28c970[_0x29c0('0x44')]['id']){delete _0x28c970['body']['id'];}return db['Campaign'][_0x29c0('0x42')]({'where':{'id':_0x28c970['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x2006fd,null))['then'](saveUpdates(_0x28c970['body'],null))[_0x29c0('0x21')](respondWithResult(_0x2006fd,null))['catch'](handleError(_0x2006fd,null));};exports[_0x29c0('0x22')]=function(_0x4465b9,_0x19ef14){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x4465b9['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x19ef14,null))[_0x29c0('0x21')](removeEntity(_0x19ef14,null))[_0x29c0('0x40')](handleError(_0x19ef14,null));};exports[_0x29c0('0x55')]=function(_0x28fb45,_0x1acd75,_0x146a41){var _0x1001e1={'raw':!![],'where':{}};var _0x1adafe={};var _0x15eabe={'count':0x0,'rows':[]};return db['Campaign'][_0x29c0('0x56')]({'where':{'id':_0x28fb45[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1acd75,null))[_0x29c0('0x21')](function(_0x1ab96a){if(_0x1ab96a){_0x1adafe['model']=_[_0x29c0('0x2e')](db['CmHopper']['rawAttributes']);_0x1adafe['query']=_[_0x29c0('0x2e')](_0x28fb45[_0x29c0('0x2d')]);_0x1adafe['filters']=_[_0x29c0('0x30')](_0x1adafe['model'],_0x1adafe[_0x29c0('0x2d')]);_0x1001e1[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x1adafe[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x1001e1[_0x29c0('0x31')]=_0x1001e1[_0x29c0('0x31')][_0x29c0('0x34')]?_0x1001e1[_0x29c0('0x31')]:_0x1adafe[_0x29c0('0x32')];if(!_0x28fb45['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x1001e1[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x1001e1[_0x29c0('0x18')]=qs['offset'](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x1001e1[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x1001e1['where']=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x28fb45['query'],_0x1adafe[_0x29c0('0x2f')]));_0x1001e1[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1ab96a['id'];if(_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x1001e1[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x1001e1[_0x29c0('0x38')],{'$or':_['map'](_0x1001e1['attributes'],function(_0x5d4097){var _0x23d4a6={};_0x23d4a6[_0x5d4097]={'$like':'%'+_0x28fb45['query']['filter']+'%'};return _0x23d4a6;})});}_0x1001e1=_['merge']({},_0x1001e1,_0x28fb45['options']);return db['CmHopper'][_0x29c0('0x1b')]({'where':_0x1001e1['where']})[_0x29c0('0x21')](function(_0xa45593){_0x15eabe[_0x29c0('0x1b')]=_0xa45593;if(_0x28fb45['query'][_0x29c0('0x3e')]){_0x1001e1['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1001e1);})[_0x29c0('0x21')](function(_0x43bad4){_0x15eabe[_0x29c0('0x3f')]=_0x43bad4;return _0x15eabe;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x1acd75,_0x1001e1))[_0x29c0('0x40')](handleError(_0x1acd75,null));};exports[_0x29c0('0x59')]=function(_0x483427,_0x7920d5,_0x237359){var _0x5ce488={'raw':!![],'where':{}};var _0x244a09={};var _0x212940={'count':0x0,'rows':[]};return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x483427[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7920d5,null))[_0x29c0('0x21')](function(_0x1941ba){if(_0x1941ba){_0x244a09[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperHistory'][_0x29c0('0x29')]);_0x244a09[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x483427['query']);_0x244a09['filters']=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],_0x244a09[_0x29c0('0x2d')]);_0x5ce488[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x5ce488['attributes']=_0x5ce488['attributes'][_0x29c0('0x34')]?_0x5ce488[_0x29c0('0x31')]:_0x244a09[_0x29c0('0x32')];if(!_0x483427[_0x29c0('0x2d')][_0x29c0('0x35')](_0x29c0('0x57'))){_0x5ce488[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x5ce488['offset']=qs[_0x29c0('0x18')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x5ce488['order']=qs['sort'](_0x483427[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5ce488['where']=qs['filters'](_[_0x29c0('0x39')](_0x483427[_0x29c0('0x2d')],_0x244a09[_0x29c0('0x2f')]));_0x5ce488[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1941ba['id'];if(_0x483427['query'][_0x29c0('0x3a')]){_0x5ce488['where']=_[_0x29c0('0x3b')](_0x5ce488[_0x29c0('0x38')],{'$or':_['map'](_0x5ce488[_0x29c0('0x31')],function(_0x28e32e){var _0x95cb56={};_0x95cb56[_0x28e32e]={'$like':'%'+_0x483427[_0x29c0('0x2d')]['filter']+'%'};return _0x95cb56;})});}_0x5ce488=_['merge']({},_0x5ce488,_0x483427[_0x29c0('0x3d')]);return db[_0x29c0('0x5a')][_0x29c0('0x1b')]({'where':_0x5ce488[_0x29c0('0x38')]})[_0x29c0('0x21')](function(_0x308170){_0x212940['count']=_0x308170;if(_0x483427['query'][_0x29c0('0x3e')]){_0x5ce488[_0x29c0('0x4d')]=[{'all':!![]}];}return db[_0x29c0('0x5a')]['findAll'](_0x5ce488);})[_0x29c0('0x21')](function(_0x432035){_0x212940[_0x29c0('0x3f')]=_0x432035;return _0x212940;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x7920d5,_0x5ce488))[_0x29c0('0x40')](handleError(_0x7920d5,null));};exports[_0x29c0('0x5b')]=function(_0x1a68a2,_0x44d789,_0x2082c1){var _0x2350c7={'raw':!![],'where':{}};var _0x4486ab={};var _0x25bcad={'count':0x0,'rows':[]};return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x1a68a2[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x44d789,null))['then'](function(_0x4c531a){if(_0x4c531a){_0x4486ab[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperFinal'][_0x29c0('0x29')]);_0x4486ab['query']=_[_0x29c0('0x2e')](_0x1a68a2[_0x29c0('0x2d')]);_0x4486ab[_0x29c0('0x2f')]=_['intersection'](_0x4486ab['model'],_0x4486ab[_0x29c0('0x2d')]);_0x2350c7['attributes']=_[_0x29c0('0x30')](_0x4486ab[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x2350c7[_0x29c0('0x31')]=_0x2350c7['attributes']['length']?_0x2350c7['attributes']:_0x4486ab['model'];if(!_0x1a68a2['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x2350c7[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x2350c7[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x1a68a2[_0x29c0('0x2d')]['offset']);}_0x2350c7['order']=qs[_0x29c0('0x37')](_0x1a68a2['query'][_0x29c0('0x37')]);_0x2350c7[_0x29c0('0x38')]=qs['filters'](_[_0x29c0('0x39')](_0x1a68a2['query'],_0x4486ab[_0x29c0('0x2f')]));_0x2350c7[_0x29c0('0x38')][_0x29c0('0x58')]=_0x4c531a['id'];if(_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x2350c7[_0x29c0('0x38')]=_['merge'](_0x2350c7[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x2350c7[_0x29c0('0x31')],function(_0x57b098){var _0x2dd8f6={};_0x2dd8f6[_0x57b098]={'$like':'%'+_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x2dd8f6;})});}_0x2350c7=_['merge']({},_0x2350c7,_0x1a68a2[_0x29c0('0x3d')]);return db[_0x29c0('0x5c')]['count']({'where':_0x2350c7['where']})[_0x29c0('0x21')](function(_0x22a01a){_0x25bcad[_0x29c0('0x1b')]=_0x22a01a;if(_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x2350c7[_0x29c0('0x4d')]=[{'all':!![]}];}return db[_0x29c0('0x5c')][_0x29c0('0x5d')](_0x2350c7);})['then'](function(_0x7e3d54){_0x25bcad['rows']=_0x7e3d54;return _0x25bcad;});}})['then'](respondWithFilteredResult(_0x44d789,_0x2350c7))[_0x29c0('0x40')](handleError(_0x44d789,null));};exports[_0x29c0('0x5e')]=function(_0x29f492,_0x220aa1,_0xfb92a3){var _0x5c6383={'raw':!![],'where':{}};var _0x23f63e={};var _0x4e8b5f={'count':0x0,'rows':[]};return db[_0x29c0('0x28')]['findOne']({'where':{'id':_0x29f492[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x220aa1,null))['then'](function(_0x355c5c){if(_0x355c5c){_0x23f63e[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x23f63e[_0x29c0('0x2d')]=_['keys'](_0x29f492[_0x29c0('0x2d')]);_0x23f63e[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x23f63e[_0x29c0('0x32')],_0x23f63e[_0x29c0('0x2d')]);_0x5c6383[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x23f63e[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x5c6383[_0x29c0('0x31')]=_0x5c6383[_0x29c0('0x31')][_0x29c0('0x34')]?_0x5c6383['attributes']:_0x23f63e[_0x29c0('0x32')];if(!_0x29f492['query']['hasOwnProperty'](_0x29c0('0x57'))){_0x5c6383[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x29f492['query']['limit']);_0x5c6383[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x5c6383[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5c6383[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x29f492[_0x29c0('0x2d')],_0x23f63e[_0x29c0('0x2f')]));_0x5c6383[_0x29c0('0x38')][_0x29c0('0x58')]=_0x355c5c['id'];if(_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x5c6383['where']=_['merge'](_0x5c6383['where'],{'$or':_['map'](_0x5c6383[_0x29c0('0x31')],function(_0x16d5e4){var _0x427ac8={};_0x427ac8[_0x16d5e4]={'$like':'%'+_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x427ac8;})});}_0x5c6383=_[_0x29c0('0x3b')]({},_0x5c6383,_0x29f492[_0x29c0('0x3d')]);return db[_0x29c0('0x5f')][_0x29c0('0x1b')]({'where':_0x5c6383['where']})['then'](function(_0x52ad1e){_0x4e8b5f[_0x29c0('0x1b')]=_0x52ad1e;if(_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x5c6383['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x29c0('0x5d')](_0x5c6383);})['then'](function(_0x16ab77){_0x4e8b5f[_0x29c0('0x3f')]=_0x16ab77;return _0x4e8b5f;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x220aa1,_0x5c6383))[_0x29c0('0x40')](handleError(_0x220aa1,null));};exports['getLists']=function(_0x15abf4,_0x4b94bf,_0x145ce1){var _0x5cbde3={};var _0x30603f={};var _0x5a4272;var _0x22df88;return db['Campaign'][_0x29c0('0x56')]({'where':{'id':_0x15abf4[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x4b94bf,null))[_0x29c0('0x21')](function(_0x1e107d){if(_0x1e107d){_0x5a4272=_0x1e107d;_0x30603f['model']=_['keys'](db[_0x29c0('0x60')][_0x29c0('0x29')]);_0x30603f[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x15abf4[_0x29c0('0x2d')]);_0x30603f['filters']=_[_0x29c0('0x30')](_0x30603f['model'],_0x30603f[_0x29c0('0x2d')]);_0x5cbde3[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x30603f[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x15abf4[_0x29c0('0x2d')]['fields']));_0x5cbde3['attributes']=_0x5cbde3[_0x29c0('0x31')][_0x29c0('0x34')]?_0x5cbde3[_0x29c0('0x31')]:_0x30603f[_0x29c0('0x32')];_0x5cbde3['order']=qs[_0x29c0('0x37')](_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5cbde3[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x15abf4['query'],_0x30603f[_0x29c0('0x2f')]));if(_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x5cbde3[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x5cbde3['where'],{'$or':_['map'](_0x5cbde3[_0x29c0('0x31')],function(_0x41ee35){var _0x305e74={};_0x305e74[_0x41ee35]={'$like':'%'+_0x15abf4[_0x29c0('0x2d')]['filter']+'%'};return _0x305e74;})});}_0x5cbde3=_[_0x29c0('0x3b')]({},_0x5cbde3,_0x15abf4['options']);return _0x5a4272[_0x29c0('0x61')](_0x5cbde3);}})[_0x29c0('0x21')](function(_0x3ff7d3){if(_0x3ff7d3){_0x22df88=_0x3ff7d3[_0x29c0('0x34')];if(!_0x15abf4['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x5cbde3[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x15abf4['query'][_0x29c0('0x1a')]);_0x5cbde3['offset']=qs[_0x29c0('0x18')](_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x18')]);}return _0x5a4272['getLists'](_0x5cbde3);}})[_0x29c0('0x21')](function(_0x2dc543){if(_0x2dc543){return _0x2dc543?{'count':_0x22df88,'rows':_0x2dc543}:null;}})['then'](respondWithResult(_0x4b94bf,null))[_0x29c0('0x40')](handleError(_0x4b94bf,null));};exports['addLists']=function(_0x3a41e8,_0x5ebedc,_0x4c16af){var _0x399ff2,_0x48829e;var _0x514ec0=[];var _0x27d9d6=moment()['format'](_0x29c0('0x62'));return db[_0x29c0('0x28')]['find']({'where':{'id':_0x3a41e8[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x5ebedc,null))[_0x29c0('0x21')](function(_0x264c9e){if(_0x264c9e){_0x48829e=_0x264c9e;return _0x264c9e['addLists'](_0x3a41e8[_0x29c0('0x44')][_0x29c0('0x63')],_[_0x29c0('0x4e')](_0x3a41e8['body'],['ids','id'])||{});}return null;})['spread'](function(_0x636f97){var _0x258b93;var _0x1f2fd9;_0x399ff2=_0x636f97||[];var _0x8492f4=[];if(_0x636f97){for(var _0x4ae0ea=0x0;_0x4ae0ea<_0x636f97[_0x29c0('0x34')];_0x4ae0ea+=0x1){var _0x17dd7e=_0x636f97[_0x4ae0ea][_0x29c0('0x46')]({'plain':!![]});_0x48829e[_0x29c0('0x64')]=_0x3a41e8[_0x29c0('0x44')]['dialCheckDuplicateType']?_0x3a41e8[_0x29c0('0x44')]['dialCheckDuplicateType']:_0x48829e['dialCheckDuplicateType'];switch(_0x48829e[_0x29c0('0x64')]){case _0x29c0('0x65'):_0x258b93=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x68'))['fromQuery']([_0x29c0('0x69'),'scheduledAt',_0x29c0('0x6a'),'ListId',_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()[_0x29c0('0x6c')]('phone',_0x29c0('0x69'))['field'](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e['CmListId'][_0x29c0('0x6f')](),'ListId')['field'](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27','createdAt')[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))[_0x29c0('0x38')](_0x29c0('0x72'))[_0x29c0('0x38')](_0x29c0('0x73'),_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x75'))['where'](_0x29c0('0x76'),squel['select']()['field'](_0x29c0('0x77'))[_0x29c0('0x70')]('cm_hopper_final')['where'](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]()))[_0x29c0('0x38')](_0x29c0('0x76'),squel[_0x29c0('0x6b')]()[_0x29c0('0x6c')](_0x29c0('0x79'))[_0x29c0('0x70')](_0x29c0('0x68'))['where'](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]())))[_0x29c0('0x6f')]();break;case'onlyIfOpen':_0x258b93=squel[_0x29c0('0x66')]()['into'](_0x29c0('0x68'))['fromQuery'](['phone','scheduledAt',_0x29c0('0x6a'),_0x29c0('0x7a'),_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel['select']()[_0x29c0('0x6c')](_0x29c0('0x69'),_0x29c0('0x69'))[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e['CmListId'][_0x29c0('0x6f')](),_0x29c0('0x7a'))[_0x29c0('0x6c')](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))['field']('\x27'+_0x27d9d6+'\x27',_0x29c0('0x4f'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))['where'](_0x29c0('0x72'))['where']('ListId\x20=\x20?',_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())['where'](_0x29c0('0x75'))[_0x29c0('0x38')](_0x29c0('0x76'),squel['select']()[_0x29c0('0x6c')](_0x29c0('0x79'))[_0x29c0('0x70')](_0x29c0('0x68'))[_0x29c0('0x38')](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]())))['toString']();break;default:_0x258b93=squel['insert']()['into'](_0x29c0('0x68'))['fromQuery']([_0x29c0('0x69'),'scheduledAt',_0x29c0('0x6a'),'ListId',_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x69'),'phone')[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')](),'ListId')[_0x29c0('0x6c')](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))['field']('\x27'+_0x27d9d6+'\x27','createdAt')[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27','updatedAt')[_0x29c0('0x70')]('cm_contacts')[_0x29c0('0x38')](_0x29c0('0x72'))[_0x29c0('0x38')](_0x29c0('0x73'),_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())['where'](_0x29c0('0x75')))[_0x29c0('0x6f')]();}_0x1f2fd9=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x7b'))[_0x29c0('0x7c')]([_0x29c0('0x7d'),_0x29c0('0x6e'),_0x29c0('0x69'),_0x29c0('0x7e'),_0x29c0('0x4f'),'updatedAt'],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x7f'),'id')[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')](_0x29c0('0x80'),_0x29c0('0x69'))[_0x29c0('0x6c')](_0x29c0('0x81'),_0x29c0('0x7e'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x4f'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x82'),'ci')[_0x29c0('0x83')](_0x29c0('0x68'),'h',_0x29c0('0x84'))[_0x29c0('0x38')](_0x29c0('0x85'),_0x17dd7e[_0x29c0('0x74')]['toString']())[_0x29c0('0x38')]('h.CampaignId=?',_0x3a41e8['params']['id'][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x86'),_0x27d9d6))[_0x29c0('0x6f')]();_0x8492f4[_0x29c0('0x87')](db['sequelize'][_0x29c0('0x2d')](_0x258b93));_0x514ec0['push'](db[_0x29c0('0x88')][_0x29c0('0x2d')](_0x1f2fd9));}return BPromise[_0x29c0('0x89')](_0x8492f4);}})[_0x29c0('0x21')](function(){return BPromise[_0x29c0('0x89')](_0x514ec0);})['then'](function(){return _0x399ff2;})[_0x29c0('0x21')](respondWithResult(_0x5ebedc,null))['catch'](handleError(_0x5ebedc,null));};exports['removeLists']=function(_0x4d4476,_0x348866,_0x29c329){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x4d4476[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x348866,null))[_0x29c0('0x21')](function(_0x10a565){if(_0x10a565){return _0x10a565[_0x29c0('0x8a')](_0x4d4476[_0x29c0('0x2d')][_0x29c0('0x63')]);}})['then'](function(_0x55b5ed){if(_0x55b5ed){return db['CmHopper'][_0x29c0('0x22')]({'where':{'ListId':_0x4d4476[_0x29c0('0x2d')][_0x29c0('0x63')],'CampaignId':_0x4d4476[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](function(){return _0x55b5ed;});}})[_0x29c0('0x21')](respondWithStatusCode(_0x348866,null))[_0x29c0('0x40')](handleError(_0x348866,null));};exports['getBlackLists']=function(_0x4b634e,_0x281926,_0x51934d){var _0x46c39b={};var _0x164cd4={};var _0x17d7ff;var _0x36259f;return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x4b634e['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x281926,null))['then'](function(_0x59b373){if(_0x59b373){_0x17d7ff=_0x59b373;_0x164cd4['model']=_[_0x29c0('0x2e')](db[_0x29c0('0x60')][_0x29c0('0x29')]);_0x164cd4['query']=_[_0x29c0('0x2e')](_0x4b634e[_0x29c0('0x2d')]);_0x164cd4[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x164cd4[_0x29c0('0x32')],_0x164cd4[_0x29c0('0x2d')]);_0x46c39b[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x164cd4[_0x29c0('0x32')],qs['fields'](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x46c39b[_0x29c0('0x31')]=_0x46c39b[_0x29c0('0x31')][_0x29c0('0x34')]?_0x46c39b['attributes']:_0x164cd4['model'];_0x46c39b[_0x29c0('0x36')]=qs['sort'](_0x4b634e['query'][_0x29c0('0x37')]);_0x46c39b['where']=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x4b634e['query'],_0x164cd4[_0x29c0('0x2f')]));if(_0x4b634e['query'][_0x29c0('0x3a')]){_0x46c39b['where']=_[_0x29c0('0x3b')](_0x46c39b[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x46c39b[_0x29c0('0x31')],function(_0x4f959f){var _0x21ea05={};_0x21ea05[_0x4f959f]={'$like':'%'+_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x21ea05;})});}_0x46c39b=_[_0x29c0('0x3b')]({},_0x46c39b,_0x4b634e[_0x29c0('0x3d')]);return _0x17d7ff[_0x29c0('0x8b')](_0x46c39b);}})['then'](function(_0x420713){if(_0x420713){_0x36259f=_0x420713['length'];if(!_0x4b634e['query'][_0x29c0('0x35')]('nolimit')){_0x46c39b[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x46c39b[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x18')]);}return _0x17d7ff[_0x29c0('0x8b')](_0x46c39b);}})[_0x29c0('0x21')](function(_0x4c55d7){if(_0x4c55d7){return _0x4c55d7?{'count':_0x36259f,'rows':_0x4c55d7}:null;}})[_0x29c0('0x21')](respondWithResult(_0x281926,null))[_0x29c0('0x40')](handleError(_0x281926,null));};exports[_0x29c0('0x8c')]=function(_0x33120e,_0x41e898,_0x4f5d79){var _0x588549,_0x275617;var _0x3ca521=[];var _0x4f4958=moment()['format'](_0x29c0('0x62'));return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x33120e[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x41e898,null))['then'](function(_0x176631){if(_0x176631){_0x275617=_0x176631;return _0x176631[_0x29c0('0x8c')](_0x33120e[_0x29c0('0x44')]['ids'],_['omit'](_0x33120e[_0x29c0('0x44')],[_0x29c0('0x63'),'id'])||{});}return null;})[_0x29c0('0x8d')](function(_0x28b2f5){var _0xacca6c;var _0x3da0b2;_0x588549=_0x28b2f5||[];var _0x14f2e1=[];if(_0x28b2f5){for(var _0x344d78=0x0;_0x344d78<_0x28b2f5['length'];_0x344d78+=0x1){var _0x2db2fd=_0x28b2f5[_0x344d78]['get']({'plain':!![]});_0xacca6c=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x8e'))[_0x29c0('0x7c')]([_0x29c0('0x69'),'ContactId',_0x29c0('0x7a'),_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x69'),'phone')[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x2db2fd['CmListId'][_0x29c0('0x6f')](),'ListId')['field'](_0x33120e['params']['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))[_0x29c0('0x6c')]('NOW()',_0x29c0('0x4f'))[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))[_0x29c0('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0x29c0('0x73'),_0x2db2fd[_0x29c0('0x74')][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x75')))[_0x29c0('0x6f')]();_0x14f2e1[_0x29c0('0x87')](db[_0x29c0('0x88')][_0x29c0('0x2d')](_0xacca6c));}return BPromise[_0x29c0('0x89')](_0x14f2e1);}})['then'](function(){return _0x588549;})[_0x29c0('0x21')](respondWithResult(_0x41e898,null))[_0x29c0('0x40')](handleError(_0x41e898,null));};exports['removeBlackLists']=function(_0x3a4834,_0x2d2152,_0x2d4795){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x3a4834['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x2d2152,null))[_0x29c0('0x21')](function(_0x22e791){if(_0x22e791){return _0x22e791[_0x29c0('0x8f')](_0x3a4834['query'][_0x29c0('0x63')]);}})[_0x29c0('0x21')](function(_0x463fcf){if(_0x463fcf){return db[_0x29c0('0x5f')][_0x29c0('0x22')]({'where':{'ListId':_0x3a4834['query']['ids'],'CampaignId':_0x3a4834[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](function(){return _0x463fcf;});}})[_0x29c0('0x21')](respondWithStatusCode(_0x2d2152,null))[_0x29c0('0x40')](handleError(_0x2d2152,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index dc8fe27..3aee6d5 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x49684e,_0x9a24fb){var _0x54062f=function(_0x4e410a){while(--_0x4e410a){_0x49684e['push'](_0x49684e['shift']());}};_0x54062f(++_0x9a24fb);}(_0x7a54,0x106));var _0x47a5=function(_0x30a150,_0x40d8e1){_0x30a150=_0x30a150-0x0;var _0x5dfd31=_0x7a54[_0x30a150];return _0x5dfd31;};'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 3179d92..5b9f6f4 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 _0xacfe=['where','attributes','limit','map','include','model','then','GetCampaign','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xacfe,0xfd));var _0xeacf=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xacfe[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeacf('0x0'));var BPromise=require(_0xeacf('0x1'));var rs=require(_0xeacf('0x2'));var fs=require('fs');var Redis=require(_0xeacf('0x3'));var db=require(_0xeacf('0x4'))['db'];var utils=require(_0xeacf('0x5'));var logger=require(_0xeacf('0x6'))(_0xeacf('0x7'));var config=require(_0xeacf('0x8'));var jayson=require(_0xeacf('0x9'));var client=jayson[_0xeacf('0xa')][_0xeacf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13cba2,_0x5eb516,_0x411634){return new BPromise(function(_0xce0437,_0x17b21c){return client[_0xeacf('0xc')](_0x13cba2,_0x411634)['then'](function(_0xfe344){logger['info'](_0xeacf('0xd'),_0x5eb516,_0xeacf('0xe'));logger[_0xeacf('0xf')](_0xeacf('0x10'),_0x5eb516,_0xeacf('0xe'),JSON[_0xeacf('0x11')](_0xfe344));if(_0xfe344[_0xeacf('0x12')]){if(_0xfe344[_0xeacf('0x12')][_0xeacf('0x13')]===0x1f4){logger[_0xeacf('0x12')]('Campaign,\x20%s,\x20%s',_0x5eb516,_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);return _0x17b21c(_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);}logger['error'](_0xeacf('0xd'),_0x5eb516,_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);return _0xce0437(_0xfe344['error']['message']);}else{logger[_0xeacf('0x15')](_0xeacf('0xd'),_0x5eb516,'request\x20sent');_0xce0437(_0xfe344[_0xeacf('0x16')]['message']);}})[_0xeacf('0x17')](function(_0x1df080){logger['error'](_0xeacf('0xd'),_0x5eb516,_0x1df080);_0x17b21c(_0x1df080);});});}exports['GetCampaign']=function(_0x650730){var _0xe87314=this;return new Promise(function(_0x18de20,_0x118932){return db['Campaign'][_0xeacf('0x18')]({'raw':_0x650730['options']?_0x650730[_0xeacf('0x19')][_0xeacf('0x1a')]===undefined?!![]:![]:!![],'where':_0x650730[_0xeacf('0x19')]?_0x650730['options'][_0xeacf('0x1b')]||null:null,'attributes':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')][_0xeacf('0x1c')]||null:null,'limit':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')][_0xeacf('0x1d')]||null:null,'include':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')]['include']?_[_0xeacf('0x1e')](_0x650730[_0xeacf('0x19')][_0xeacf('0x1f')],function(_0x35338b){return{'model':db[_0x35338b[_0xeacf('0x20')]],'as':_0x35338b['as'],'attributes':_0x35338b[_0xeacf('0x1c')],'include':_0x35338b[_0xeacf('0x1f')]?_['map'](_0x35338b['include'],function(_0x4332b7){return{'model':db[_0x4332b7[_0xeacf('0x20')]],'as':_0x4332b7['as'],'attributes':_0x4332b7['attributes'],'include':_0x4332b7[_0xeacf('0x1f')]?_[_0xeacf('0x1e')](_0x4332b7[_0xeacf('0x1f')],function(_0x1e368a){return{'model':db[_0x1e368a['model']],'as':_0x1e368a['as'],'attributes':_0x1e368a[_0xeacf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeacf('0x21')](function(_0x4c161e){logger[_0xeacf('0x15')](_0xeacf('0x22'),_0x650730);logger[_0xeacf('0xf')](_0xeacf('0x22'),_0x650730,JSON['stringify'](_0x4c161e));_0x18de20(_0x4c161e);})[_0xeacf('0x17')](function(_0x1d375a){logger['error']('GetCampaign',_0x1d375a['message'],_0x650730);_0x118932(_0xe87314['error'](0x1f4,_0x1d375a[_0xeacf('0x14')]));});});}; \ No newline at end of file +var _0x750a=['GetCampaign','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map'];(function(_0x11f1e0,_0x568eae){var _0x3369c7=function(_0x53105a){while(--_0x53105a){_0x11f1e0['push'](_0x11f1e0['shift']());}};_0x3369c7(++_0x568eae);}(_0x750a,0x140));var _0xa750=function(_0x50a75e,_0x41e663){_0x50a75e=_0x50a75e-0x0;var _0x304e15=_0x750a[_0x50a75e];return _0x304e15;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('Campaign,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetCampaign']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['Campaign']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 88d2a79..e6674b6 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 _0x7f90=['express','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','/:id/blacklists','addBlackLists','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x4d19ce,_0xbc25fa){var _0x3fda80=function(_0x5f087){while(--_0x5f087){_0x4d19ce['push'](_0x4d19ce['shift']());}};_0x3fda80(++_0xbc25fa);}(_0x7f90,0xf4));var _0x07f9=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0x7f90[_0x16b77e];return _0x3ae284;};'use strict';var multer=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var path=require(_0x07f9('0x2'));var timeout=require(_0x07f9('0x3'));var express=require(_0x07f9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07f9('0x5'));var interaction=require(_0x07f9('0x6'));var config=require('../../config/environment');var controller=require(_0x07f9('0x7'));router[_0x07f9('0x8')]('/',auth[_0x07f9('0x9')](),controller[_0x07f9('0xa')]);router[_0x07f9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x07f9('0xb')]);router[_0x07f9('0x8')]('/:id/hoppers',auth[_0x07f9('0x9')](),controller['getHoppers']);router[_0x07f9('0x8')](_0x07f9('0xc'),auth[_0x07f9('0x9')](),controller[_0x07f9('0xd')]);router['get'](_0x07f9('0xe'),auth[_0x07f9('0x9')](),controller[_0x07f9('0xf')]);router[_0x07f9('0x8')]('/:id/hopper_black',auth[_0x07f9('0x9')](),controller['getHopperBlacks']);router[_0x07f9('0x8')](_0x07f9('0x10'),auth[_0x07f9('0x9')](),controller[_0x07f9('0x11')]);router[_0x07f9('0x8')]('/:id/blacklists',auth[_0x07f9('0x9')](),controller[_0x07f9('0x12')]);router['post']('/',auth[_0x07f9('0x9')](),controller['create']);router[_0x07f9('0x13')](_0x07f9('0x14'),auth['isAuthenticated'](),controller[_0x07f9('0x15')]);router[_0x07f9('0x13')](_0x07f9('0x10'),auth[_0x07f9('0x9')](),controller['addLists']);router[_0x07f9('0x13')](_0x07f9('0x16'),auth[_0x07f9('0x9')](),controller[_0x07f9('0x17')]);router['put'](_0x07f9('0x18'),auth[_0x07f9('0x9')](),controller[_0x07f9('0x19')]);router[_0x07f9('0x1a')](_0x07f9('0x18'),auth['isAuthenticated'](),controller[_0x07f9('0x1b')]);router[_0x07f9('0x1a')](_0x07f9('0x10'),auth[_0x07f9('0x9')](),controller[_0x07f9('0x1c')]);router['delete']('/:id/blacklists',auth[_0x07f9('0x9')](),controller[_0x07f9('0x1d')]);module[_0x07f9('0x1e')]=router; \ No newline at end of file +var _0xa567=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','update','destroy','delete','removeBlackLists','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0xa1e6b9,_0x484192){var _0x4db940=function(_0x39c320){while(--_0x39c320){_0xa1e6b9['push'](_0xa1e6b9['shift']());}};_0x4db940(++_0x484192);}(_0xa567,0x119));var _0x7a56=function(_0x540d28,_0x34ef0e){_0x540d28=_0x540d28-0x0;var _0x12635b=_0xa567[_0x540d28];return _0x12635b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a56('0x0'));var timeout=require(_0x7a56('0x1'));var express=require(_0x7a56('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a56('0x3'));var config=require(_0x7a56('0x4'));var controller=require('./campaign.controller');router[_0x7a56('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a56('0x6')]);router['get'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x9')]);router[_0x7a56('0x5')](_0x7a56('0xa'),auth[_0x7a56('0x8')](),controller['getHoppers']);router[_0x7a56('0x5')]('/:id/hopper_histories',auth[_0x7a56('0x8')](),controller[_0x7a56('0xb')]);router[_0x7a56('0x5')](_0x7a56('0xc'),auth[_0x7a56('0x8')](),controller['getHopperFinals']);router[_0x7a56('0x5')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0x7a56('0xd'),auth[_0x7a56('0x8')](),controller[_0x7a56('0xe')]);router[_0x7a56('0x5')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x10')]);router[_0x7a56('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x7a56('0x8')](),controller['clone']);router[_0x7a56('0x11')](_0x7a56('0xd'),auth['isAuthenticated'](),controller['addLists']);router[_0x7a56('0x11')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller['addBlackLists']);router['put'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x12')]);router['delete'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x13')]);router['delete'](_0x7a56('0xd'),auth[_0x7a56('0x8')](),controller['removeLists']);router[_0x7a56('0x14')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5330e82..ef2fa25 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 _0x0994=['sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x562d4a,_0x3c31d5){var _0x28244c=function(_0x189326){while(--_0x189326){_0x562d4a['push'](_0x562d4a['shift']());}};_0x28244c(++_0x3c31d5);}(_0x0994,0x14a));var _0x4099=function(_0x451694,_0x413f83){_0x451694=_0x451694-0x0;var _0x26c770=_0x0994[_0x451694];return _0x26c770;};'use strict';var Sequelize=require(_0x4099('0x0'));module[_0x4099('0x1')]={'key':{'type':Sequelize[_0x4099('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x4099('0x2')]},'name':{'type':Sequelize[_0x4099('0x3')],'get':function(){return this[_0x4099('0x4')]('key');}}}; \ No newline at end of file +var _0xc9aa=['VIRTUAL','sequelize','STRING','TEXT'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc9aa,0xd1));var _0xac9a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc9aa[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0xac9a('0x0'));module['exports']={'key':{'type':Sequelize[_0xac9a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xac9a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xac9a('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b9c88a8..71737df 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 _0x7d39=['apply','reject','save','then','get','UserProfileResource','destroy','send','index','map','CannedAnswer','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../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'];(function(_0x2a2ca0,_0x394fa8){var _0x1a62e6=function(_0x307189){while(--_0x307189){_0x2a2ca0['push'](_0x2a2ca0['shift']());}};_0x1a62e6(++_0x394fa8);}(_0x7d39,0xe7));var _0x97d3=function(_0x53e0c7,_0x3e3e9a){_0x53e0c7=_0x53e0c7-0x0;var _0x2548f3=_0x7d39[_0x53e0c7];return _0x2548f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97d3('0x0'));var zipdir=require(_0x97d3('0x1'));var jsonpatch=require(_0x97d3('0x2'));var rp=require(_0x97d3('0x3'));var moment=require(_0x97d3('0x4'));var BPromise=require(_0x97d3('0x5'));var Mustache=require(_0x97d3('0x6'));var util=require(_0x97d3('0x7'));var path=require(_0x97d3('0x8'));var sox=require(_0x97d3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97d3('0xa'));var _=require(_0x97d3('0xb'));var squel=require('squel');var crypto=require(_0x97d3('0xc'));var jsforce=require(_0x97d3('0xd'));var deskjs=require(_0x97d3('0xe'));var toCsv=require(_0x97d3('0xf'));var querystring=require('querystring');var Papa=require(_0x97d3('0x10'));var Redis=require(_0x97d3('0x11'));var authService=require(_0x97d3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d3('0x13'));var logger=require(_0x97d3('0x14'))(_0x97d3('0x15'));var utils=require(_0x97d3('0x16'));var config=require(_0x97d3('0x17'));var licenseUtil=require(_0x97d3('0x18'));var db=require(_0x97d3('0x19'))['db'];function respondWithStatusCode(_0xcf84db,_0x2cfa95){_0x2cfa95=_0x2cfa95||0xcc;return function(_0x488008){if(_0x488008){return _0xcf84db[_0x97d3('0x1a')](_0x2cfa95);}return _0xcf84db[_0x97d3('0x1b')](_0x2cfa95)[_0x97d3('0x1c')]();};}function respondWithResult(_0x52e3a0,_0x526f62){_0x526f62=_0x526f62||0xc8;return function(_0x4ae610){if(_0x4ae610){return _0x52e3a0['status'](_0x526f62)[_0x97d3('0x1d')](_0x4ae610);}};}function respondWithFilteredResult(_0x32a1d8,_0x56936c){return function(_0x1bd1cc){if(_0x1bd1cc){var _0x4c6647=typeof _0x56936c['offset']===_0x97d3('0x1e')&&typeof _0x56936c[_0x97d3('0x1f')]===_0x97d3('0x1e');var _0x25271a=_0x1bd1cc[_0x97d3('0x20')];var _0x46dd6e=_0x4c6647?0x0:_0x56936c[_0x97d3('0x21')];var _0x5197ca=_0x4c6647?_0x1bd1cc['count']:_0x56936c[_0x97d3('0x21')]+_0x56936c[_0x97d3('0x1f')];var _0x225ec4;if(_0x5197ca>=_0x25271a){_0x5197ca=_0x25271a;_0x225ec4=0xc8;}else{_0x225ec4=0xce;}_0x32a1d8['status'](_0x225ec4);return _0x32a1d8[_0x97d3('0x22')](_0x97d3('0x23'),_0x46dd6e+'-'+_0x5197ca+'/'+_0x25271a)[_0x97d3('0x1d')](_0x1bd1cc);}return null;};}function patchUpdates(_0x178205){return function(_0x59973e){try{jsonpatch[_0x97d3('0x24')](_0x59973e,_0x178205,!![]);}catch(_0x3238aa){return BPromise[_0x97d3('0x25')](_0x3238aa);}return _0x59973e[_0x97d3('0x26')]();};}function saveUpdates(_0x3ab789,_0xf53d0e){return function(_0x58e048){if(_0x58e048){return _0x58e048['update'](_0x3ab789)[_0x97d3('0x27')](function(_0x20d20f){return _0x20d20f;});}return null;};}function removeEntity(_0xd9fbcd,_0xb07618){return function(_0x41db58){if(_0x41db58){return _0x41db58['destroy']()[_0x97d3('0x27')](function(){var _0x457fb6=_0x41db58[_0x97d3('0x28')]({'plain':!![]});var _0x5d6fdd='CannedAnswers';return db[_0x97d3('0x29')][_0x97d3('0x2a')]({'where':{'type':_0x5d6fdd,'resourceId':_0x457fb6['id']}})[_0x97d3('0x27')](function(){return _0x41db58;});})[_0x97d3('0x27')](function(){_0xd9fbcd[_0x97d3('0x1b')](0xcc)[_0x97d3('0x1c')]();});}};}function handleEntityNotFound(_0x260886,_0x3fdaf7){return function(_0x3f9fb5){if(!_0x3f9fb5){_0x260886[_0x97d3('0x1a')](0x194);}return _0x3f9fb5;};}function handleError(_0x1790fc,_0x46da88){_0x46da88=_0x46da88||0x1f4;return function(_0x5119a0){logger['error'](_0x5119a0['stack']);if(_0x5119a0['name']){delete _0x5119a0['name'];}_0x1790fc[_0x97d3('0x1b')](_0x46da88)[_0x97d3('0x2b')](_0x5119a0);};}exports[_0x97d3('0x2c')]=function(_0x5df8e6,_0x4f8715){var _0x36728b={},_0x14f804={},_0x124f57={'count':0x0,'rows':[]};var _0xfca8c9=_[_0x97d3('0x2d')](db[_0x97d3('0x2e')]['rawAttributes'],function(_0x1016bc){return{'name':_0x1016bc[_0x97d3('0x2f')],'type':_0x1016bc[_0x97d3('0x30')][_0x97d3('0x31')]};});_0x14f804[_0x97d3('0x32')]=_[_0x97d3('0x2d')](_0xfca8c9,_0x97d3('0x33'));_0x14f804[_0x97d3('0x34')]=_[_0x97d3('0x35')](_0x5df8e6[_0x97d3('0x34')]);_0x14f804['filters']=_[_0x97d3('0x36')](_0x14f804['model'],_0x14f804[_0x97d3('0x34')]);_0x36728b[_0x97d3('0x37')]=_[_0x97d3('0x36')](_0x14f804[_0x97d3('0x32')],qs[_0x97d3('0x38')](_0x5df8e6['query'][_0x97d3('0x38')]));_0x36728b[_0x97d3('0x37')]=_0x36728b[_0x97d3('0x37')][_0x97d3('0x39')]?_0x36728b[_0x97d3('0x37')]:_0x14f804['model'];if(!_0x5df8e6[_0x97d3('0x34')][_0x97d3('0x3a')]('nolimit')){_0x36728b['limit']=qs[_0x97d3('0x1f')](_0x5df8e6[_0x97d3('0x34')][_0x97d3('0x1f')]);_0x36728b['offset']=qs['offset'](_0x5df8e6['query'][_0x97d3('0x21')]);}_0x36728b[_0x97d3('0x3b')]=qs[_0x97d3('0x3c')](_0x5df8e6[_0x97d3('0x34')][_0x97d3('0x3c')]);_0x36728b[_0x97d3('0x3d')]=qs[_0x97d3('0x3e')](_[_0x97d3('0x3f')](_0x5df8e6[_0x97d3('0x34')],_0x14f804[_0x97d3('0x3e')]),_0xfca8c9);if(_0x5df8e6['query'][_0x97d3('0x40')]){_0x36728b[_0x97d3('0x3d')]=_[_0x97d3('0x41')](_0x36728b[_0x97d3('0x3d')],{'$or':[{'key':{'$like':'%'+_0x5df8e6[_0x97d3('0x34')][_0x97d3('0x40')]+'%'}},{'value':{'$like':'%'+_0x5df8e6['query']['filter']+'%'}}]});}_0x36728b=_[_0x97d3('0x41')]({},_0x36728b,_0x5df8e6[_0x97d3('0x42')]);var _0x5c1e96={'where':_0x36728b[_0x97d3('0x3d')]};return db['CannedAnswer'][_0x97d3('0x20')](_0x5c1e96)[_0x97d3('0x27')](function(_0xf837bd){_0x124f57[_0x97d3('0x20')]=_0xf837bd;if(_0x5df8e6[_0x97d3('0x34')][_0x97d3('0x43')]){_0x36728b[_0x97d3('0x44')]=[{'all':!![]}];}return db[_0x97d3('0x2e')][_0x97d3('0x45')](_0x36728b);})[_0x97d3('0x27')](function(_0x52956e){_0x124f57['rows']=_0x52956e;return _0x124f57;})['then'](respondWithFilteredResult(_0x4f8715,_0x36728b))['catch'](handleError(_0x4f8715,null));};exports['show']=function(_0x4f2862,_0x2930e1){var _0x32886c={'raw':!![],'where':{'id':_0x4f2862[_0x97d3('0x46')]['id']}},_0x183ac3={};_0x183ac3['model']=_['keys'](db[_0x97d3('0x2e')][_0x97d3('0x47')]);_0x183ac3[_0x97d3('0x34')]=_[_0x97d3('0x35')](_0x4f2862[_0x97d3('0x34')]);_0x183ac3[_0x97d3('0x3e')]=_[_0x97d3('0x36')](_0x183ac3[_0x97d3('0x32')],_0x183ac3['query']);_0x32886c[_0x97d3('0x37')]=_[_0x97d3('0x36')](_0x183ac3[_0x97d3('0x32')],qs[_0x97d3('0x38')](_0x4f2862[_0x97d3('0x34')][_0x97d3('0x38')]));_0x32886c[_0x97d3('0x37')]=_0x32886c[_0x97d3('0x37')][_0x97d3('0x39')]?_0x32886c[_0x97d3('0x37')]:_0x183ac3[_0x97d3('0x32')];if(_0x4f2862[_0x97d3('0x34')][_0x97d3('0x43')]){_0x32886c[_0x97d3('0x44')]=[{'all':!![]}];}_0x32886c=_['merge']({},_0x32886c,_0x4f2862['options']);return db[_0x97d3('0x2e')][_0x97d3('0x48')](_0x32886c)['then'](handleEntityNotFound(_0x2930e1,null))[_0x97d3('0x27')](respondWithResult(_0x2930e1,null))[_0x97d3('0x49')](handleError(_0x2930e1,null));};exports[_0x97d3('0x4a')]=function(_0x538dc3,_0x234018){if(_0x538dc3[_0x97d3('0x4b')]['id']){delete _0x538dc3[_0x97d3('0x4b')]['id'];}return db[_0x97d3('0x2e')][_0x97d3('0x48')]({'where':{'id':_0x538dc3[_0x97d3('0x46')]['id']}})[_0x97d3('0x27')](handleEntityNotFound(_0x234018,null))[_0x97d3('0x27')](saveUpdates(_0x538dc3[_0x97d3('0x4b')],null))[_0x97d3('0x27')](respondWithResult(_0x234018,null))[_0x97d3('0x49')](handleError(_0x234018,null));};exports[_0x97d3('0x2a')]=function(_0x412312,_0x16111f){return db[_0x97d3('0x2e')][_0x97d3('0x48')]({'where':{'id':_0x412312[_0x97d3('0x46')]['id']}})[_0x97d3('0x27')](handleEntityNotFound(_0x16111f,null))[_0x97d3('0x27')](removeEntity(_0x16111f,null))[_0x97d3('0x49')](handleError(_0x16111f,null));};exports[_0x97d3('0x4c')]=function(_0x1ea31a,_0x5e809f){var _0x18977={'key':_0x1ea31a[_0x97d3('0x4b')]['key']};if(_0x1ea31a[_0x97d3('0x4b')][_0x97d3('0x4d')]){_0x18977[_0x97d3('0x4d')]=_0x1ea31a[_0x97d3('0x4b')][_0x97d3('0x4d')];}else if(_0x1ea31a[_0x97d3('0x4b')][_0x97d3('0x4e')]){_0x18977['SmsAccountId']=_0x1ea31a[_0x97d3('0x4b')]['SmsAccountId'];}else if(_0x1ea31a['body']['OpenchannelAccountId']){_0x18977['OpenchannelAccountId']=_0x1ea31a[_0x97d3('0x4b')][_0x97d3('0x4f')];}else if(_0x1ea31a['body'][_0x97d3('0x50')]){_0x18977[_0x97d3('0x50')]=_0x1ea31a[_0x97d3('0x4b')][_0x97d3('0x50')];}return db['CannedAnswer'][_0x97d3('0x48')]({'where':_0x18977})[_0x97d3('0x27')](function(_0x51fe65){if(_0x51fe65){throw new db[(_0x97d3('0x51'))]['ValidationError'](_0x97d3('0x52'));}return db[_0x97d3('0x2e')][_0x97d3('0x4c')](_0x1ea31a[_0x97d3('0x4b')]);})[_0x97d3('0x27')](function(_0xfcf98c){var _0x429658=_0x1ea31a[_0x97d3('0x53')][_0x97d3('0x28')]({'plain':!![]});if(!_0x429658)throw new Error(_0x97d3('0x54'));if(_0x429658['role']==='user'){var _0xe88cc4=_0xfcf98c[_0x97d3('0x28')]({'plain':!![]});return db[_0x97d3('0x55')][_0x97d3('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x429658[_0x97d3('0x56')]},'raw':!![]})['then'](function(_0x11d3b4){if(_0x11d3b4&&_0x11d3b4[_0x97d3('0x57')]===0x0){return db[_0x97d3('0x29')]['create']({'name':_0xe88cc4[_0x97d3('0x33')],'resourceId':_0xe88cc4['id'],'type':_0x11d3b4['name'],'sectionId':_0x11d3b4['id']},{})[_0x97d3('0x27')](function(){return _0xfcf98c;});}else{return _0xfcf98c;}})[_0x97d3('0x49')](function(_0x5ac4cf){logger[_0x97d3('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ac4cf);throw _0x5ac4cf;});}return _0xfcf98c;})[_0x97d3('0x27')](respondWithResult(_0x5e809f,0xc9))[_0x97d3('0x49')](handleError(_0x5e809f,null));}; \ No newline at end of file +var _0x3b7c=['then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x97b3e7,_0x19d219){var _0x4d9b45=function(_0x2b23ba){while(--_0x2b23ba){_0x97b3e7['push'](_0x97b3e7['shift']());}};_0x4d9b45(++_0x19d219);}(_0x3b7c,0x90));var _0xc3b7=function(_0x302b72,_0x483f35){_0x302b72=_0x302b72-0x0;var _0x48aa64=_0x3b7c[_0x302b72];return _0x48aa64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3b7('0x0'));var zipdir=require(_0xc3b7('0x1'));var jsonpatch=require(_0xc3b7('0x2'));var rp=require(_0xc3b7('0x3'));var moment=require('moment');var BPromise=require(_0xc3b7('0x4'));var Mustache=require(_0xc3b7('0x5'));var util=require(_0xc3b7('0x6'));var path=require('path');var sox=require(_0xc3b7('0x7'));var csv=require(_0xc3b7('0x8'));var ejs=require(_0xc3b7('0x9'));var fs=require('fs');var fs_extra=require(_0xc3b7('0xa'));var _=require(_0xc3b7('0xb'));var squel=require(_0xc3b7('0xc'));var crypto=require(_0xc3b7('0xd'));var jsforce=require(_0xc3b7('0xe'));var deskjs=require(_0xc3b7('0xf'));var toCsv=require(_0xc3b7('0x8'));var querystring=require('querystring');var Papa=require(_0xc3b7('0x10'));var Redis=require(_0xc3b7('0x11'));var authService=require(_0xc3b7('0x12'));var qs=require(_0xc3b7('0x13'));var as=require(_0xc3b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3b7('0x15'))(_0xc3b7('0x16'));var utils=require(_0xc3b7('0x17'));var config=require(_0xc3b7('0x18'));var licenseUtil=require(_0xc3b7('0x19'));var db=require(_0xc3b7('0x1a'))['db'];function respondWithStatusCode(_0x3ea339,_0x5b1344){_0x5b1344=_0x5b1344||0xcc;return function(_0x50bc8b){if(_0x50bc8b){return _0x3ea339[_0xc3b7('0x1b')](_0x5b1344);}return _0x3ea339[_0xc3b7('0x1c')](_0x5b1344)[_0xc3b7('0x1d')]();};}function respondWithResult(_0xe844f8,_0x536954){_0x536954=_0x536954||0xc8;return function(_0x227bda){if(_0x227bda){return _0xe844f8[_0xc3b7('0x1c')](_0x536954)[_0xc3b7('0x1e')](_0x227bda);}};}function respondWithFilteredResult(_0x58b203,_0x626314){return function(_0x384194){if(_0x384194){var _0x2d3789=typeof _0x626314[_0xc3b7('0x1f')]==='undefined'&&typeof _0x626314[_0xc3b7('0x20')]==='undefined';var _0x349c1e=_0x384194[_0xc3b7('0x21')];var _0x91fb29=_0x2d3789?0x0:_0x626314[_0xc3b7('0x1f')];var _0x38279b=_0x2d3789?_0x384194[_0xc3b7('0x21')]:_0x626314[_0xc3b7('0x1f')]+_0x626314[_0xc3b7('0x20')];var _0x2e0187;if(_0x38279b>=_0x349c1e){_0x38279b=_0x349c1e;_0x2e0187=0xc8;}else{_0x2e0187=0xce;}_0x58b203[_0xc3b7('0x1c')](_0x2e0187);return _0x58b203[_0xc3b7('0x22')](_0xc3b7('0x23'),_0x91fb29+'-'+_0x38279b+'/'+_0x349c1e)[_0xc3b7('0x1e')](_0x384194);}return null;};}function patchUpdates(_0x2ecea1){return function(_0x1b7a93){try{jsonpatch[_0xc3b7('0x24')](_0x1b7a93,_0x2ecea1,!![]);}catch(_0x1949c0){return BPromise[_0xc3b7('0x25')](_0x1949c0);}return _0x1b7a93[_0xc3b7('0x26')]();};}function saveUpdates(_0x5ab44e,_0x44492e){return function(_0x5824e0){if(_0x5824e0){return _0x5824e0[_0xc3b7('0x27')](_0x5ab44e)[_0xc3b7('0x28')](function(_0x206609){return _0x206609;});}return null;};}function removeEntity(_0x251990,_0x414e5c){return function(_0x27ba39){if(_0x27ba39){return _0x27ba39[_0xc3b7('0x29')]()[_0xc3b7('0x28')](function(){var _0x4ea003=_0x27ba39[_0xc3b7('0x2a')]({'plain':!![]});var _0x48ec3d='CannedAnswers';return db[_0xc3b7('0x2b')][_0xc3b7('0x29')]({'where':{'type':_0x48ec3d,'resourceId':_0x4ea003['id']}})[_0xc3b7('0x28')](function(){return _0x27ba39;});})['then'](function(){_0x251990[_0xc3b7('0x1c')](0xcc)[_0xc3b7('0x1d')]();});}};}function handleEntityNotFound(_0x35c319,_0x2f0924){return function(_0x3375fa){if(!_0x3375fa){_0x35c319[_0xc3b7('0x1b')](0x194);}return _0x3375fa;};}function handleError(_0x2808da,_0x402dee){_0x402dee=_0x402dee||0x1f4;return function(_0x1c4009){logger[_0xc3b7('0x2c')](_0x1c4009[_0xc3b7('0x2d')]);if(_0x1c4009[_0xc3b7('0x2e')]){delete _0x1c4009[_0xc3b7('0x2e')];}_0x2808da[_0xc3b7('0x1c')](_0x402dee)[_0xc3b7('0x2f')](_0x1c4009);};}exports[_0xc3b7('0x30')]=function(_0x5027e3,_0x620ce4){var _0x31cc76={},_0x3e99e5={},_0x44965b={'count':0x0,'rows':[]};var _0x1f744f=_[_0xc3b7('0x31')](db[_0xc3b7('0x32')][_0xc3b7('0x33')],function(_0x3bdcfc){return{'name':_0x3bdcfc[_0xc3b7('0x34')],'type':_0x3bdcfc[_0xc3b7('0x35')]['key']};});_0x3e99e5[_0xc3b7('0x36')]=_['map'](_0x1f744f,_0xc3b7('0x2e'));_0x3e99e5[_0xc3b7('0x37')]=_[_0xc3b7('0x38')](_0x5027e3[_0xc3b7('0x37')]);_0x3e99e5[_0xc3b7('0x39')]=_['intersection'](_0x3e99e5['model'],_0x3e99e5[_0xc3b7('0x37')]);_0x31cc76['attributes']=_[_0xc3b7('0x3a')](_0x3e99e5[_0xc3b7('0x36')],qs[_0xc3b7('0x3b')](_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x3b')]));_0x31cc76['attributes']=_0x31cc76[_0xc3b7('0x3c')][_0xc3b7('0x3d')]?_0x31cc76[_0xc3b7('0x3c')]:_0x3e99e5['model'];if(!_0x5027e3['query'][_0xc3b7('0x3e')](_0xc3b7('0x3f'))){_0x31cc76[_0xc3b7('0x20')]=qs[_0xc3b7('0x20')](_0x5027e3[_0xc3b7('0x37')]['limit']);_0x31cc76['offset']=qs['offset'](_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x1f')]);}_0x31cc76[_0xc3b7('0x40')]=qs[_0xc3b7('0x41')](_0x5027e3[_0xc3b7('0x37')]['sort']);_0x31cc76[_0xc3b7('0x42')]=qs[_0xc3b7('0x39')](_[_0xc3b7('0x43')](_0x5027e3[_0xc3b7('0x37')],_0x3e99e5[_0xc3b7('0x39')]),_0x1f744f);if(_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]){_0x31cc76[_0xc3b7('0x42')]=_[_0xc3b7('0x45')](_0x31cc76[_0xc3b7('0x42')],{'$or':[{'key':{'$like':'%'+_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]+'%'}},{'value':{'$like':'%'+_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]+'%'}}]});}_0x31cc76=_[_0xc3b7('0x45')]({},_0x31cc76,_0x5027e3[_0xc3b7('0x46')]);var _0x142cc9={'where':_0x31cc76[_0xc3b7('0x42')]};return db[_0xc3b7('0x32')]['count'](_0x142cc9)[_0xc3b7('0x28')](function(_0x25c10e){_0x44965b['count']=_0x25c10e;if(_0x5027e3[_0xc3b7('0x37')]['includeAll']){_0x31cc76[_0xc3b7('0x47')]=[{'all':!![]}];}return db[_0xc3b7('0x32')][_0xc3b7('0x48')](_0x31cc76);})[_0xc3b7('0x28')](function(_0x407072){_0x44965b[_0xc3b7('0x49')]=_0x407072;return _0x44965b;})[_0xc3b7('0x28')](respondWithFilteredResult(_0x620ce4,_0x31cc76))[_0xc3b7('0x4a')](handleError(_0x620ce4,null));};exports[_0xc3b7('0x4b')]=function(_0xc94fa4,_0x4572c9){var _0x35b578={'raw':!![],'where':{'id':_0xc94fa4[_0xc3b7('0x4c')]['id']}},_0x2db30e={};_0x2db30e[_0xc3b7('0x36')]=_[_0xc3b7('0x38')](db['CannedAnswer']['rawAttributes']);_0x2db30e['query']=_['keys'](_0xc94fa4[_0xc3b7('0x37')]);_0x2db30e[_0xc3b7('0x39')]=_[_0xc3b7('0x3a')](_0x2db30e[_0xc3b7('0x36')],_0x2db30e[_0xc3b7('0x37')]);_0x35b578['attributes']=_['intersection'](_0x2db30e[_0xc3b7('0x36')],qs[_0xc3b7('0x3b')](_0xc94fa4['query'][_0xc3b7('0x3b')]));_0x35b578[_0xc3b7('0x3c')]=_0x35b578['attributes'][_0xc3b7('0x3d')]?_0x35b578[_0xc3b7('0x3c')]:_0x2db30e[_0xc3b7('0x36')];if(_0xc94fa4['query'][_0xc3b7('0x4d')]){_0x35b578[_0xc3b7('0x47')]=[{'all':!![]}];}_0x35b578=_[_0xc3b7('0x45')]({},_0x35b578,_0xc94fa4[_0xc3b7('0x46')]);return db[_0xc3b7('0x32')][_0xc3b7('0x4e')](_0x35b578)[_0xc3b7('0x28')](handleEntityNotFound(_0x4572c9,null))['then'](respondWithResult(_0x4572c9,null))[_0xc3b7('0x4a')](handleError(_0x4572c9,null));};exports[_0xc3b7('0x27')]=function(_0x533c81,_0x16fec0){if(_0x533c81['body']['id']){delete _0x533c81[_0xc3b7('0x4f')]['id'];}return db[_0xc3b7('0x32')]['find']({'where':{'id':_0x533c81[_0xc3b7('0x4c')]['id']}})[_0xc3b7('0x28')](handleEntityNotFound(_0x16fec0,null))['then'](saveUpdates(_0x533c81[_0xc3b7('0x4f')],null))[_0xc3b7('0x28')](respondWithResult(_0x16fec0,null))[_0xc3b7('0x4a')](handleError(_0x16fec0,null));};exports[_0xc3b7('0x29')]=function(_0x576968,_0x5098c3){return db['CannedAnswer'][_0xc3b7('0x4e')]({'where':{'id':_0x576968[_0xc3b7('0x4c')]['id']}})[_0xc3b7('0x28')](handleEntityNotFound(_0x5098c3,null))[_0xc3b7('0x28')](removeEntity(_0x5098c3,null))['catch'](handleError(_0x5098c3,null));};exports[_0xc3b7('0x50')]=function(_0x26eeb2,_0x3cef1b){var _0x7b4ba1={'key':_0x26eeb2[_0xc3b7('0x4f')]['key']};if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x51')]){_0x7b4ba1['MailAccountId']=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x51')];}else if(_0x26eeb2['body'][_0xc3b7('0x52')]){_0x7b4ba1[_0xc3b7('0x52')]=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x52')];}else if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x53')]){_0x7b4ba1['OpenchannelAccountId']=_0x26eeb2['body'][_0xc3b7('0x53')];}else if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x54')]){_0x7b4ba1[_0xc3b7('0x54')]=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x54')];}return db[_0xc3b7('0x32')]['find']({'where':_0x7b4ba1})[_0xc3b7('0x28')](function(_0x280870){if(_0x280870){throw new db[(_0xc3b7('0x55'))][(_0xc3b7('0x56'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xc3b7('0x32')]['create'](_0x26eeb2['body']);})[_0xc3b7('0x28')](function(_0x280cda){var _0x4559da=_0x26eeb2[_0xc3b7('0x57')][_0xc3b7('0x2a')]({'plain':!![]});if(!_0x4559da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4559da['role']==='user'){var _0x4d693d=_0x280cda[_0xc3b7('0x2a')]({'plain':!![]});return db[_0xc3b7('0x58')][_0xc3b7('0x4e')]({'where':{'name':_0xc3b7('0x59'),'userProfileId':_0x4559da[_0xc3b7('0x5a')]},'raw':!![]})[_0xc3b7('0x28')](function(_0x1180dc){if(_0x1180dc&&_0x1180dc[_0xc3b7('0x5b')]===0x0){return db[_0xc3b7('0x2b')][_0xc3b7('0x50')]({'name':_0x4d693d[_0xc3b7('0x2e')],'resourceId':_0x4d693d['id'],'type':_0x1180dc[_0xc3b7('0x2e')],'sectionId':_0x1180dc['id']},{})[_0xc3b7('0x28')](function(){return _0x280cda;});}else{return _0x280cda;}})['catch'](function(_0x3cad8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cad8c);throw _0x3cad8c;});}return _0x280cda;})[_0xc3b7('0x28')](respondWithResult(_0x3cef1b,0xc9))[_0xc3b7('0x4a')](handleError(_0x3cef1b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7bcc455..a894512 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 _0x1584=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2f42d3,_0x362e7a){var _0x25a67e=function(_0x103ce2){while(--_0x103ce2){_0x2f42d3['push'](_0x2f42d3['shift']());}};_0x25a67e(++_0x362e7a);}(_0x1584,0x139));var _0x4158=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1584[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x4158('0x0'));var util=require(_0x4158('0x1'));var logger=require(_0x4158('0x2'))(_0x4158('0x3'));var moment=require(_0x4158('0x4'));var BPromise=require(_0x4158('0x5'));var rp=require(_0x4158('0x6'));var fs=require('fs');var path=require(_0x4158('0x7'));var rimraf=require(_0x4158('0x8'));var config=require(_0x4158('0x9'));var attributes=require('./cannedAnswer.attributes');module[_0x4158('0xa')]=function(_0x540f45,_0x1b8c41){return _0x540f45['define'](_0x4158('0xb'),attributes,{'tableName':_0x4158('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4158('0xd'),'collate':_0x4158('0xe')});}; \ No newline at end of file +var _0xa264=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x40a529,_0x1ac70a){var _0x1936a8=function(_0x1a46b8){while(--_0x1a46b8){_0x40a529['push'](_0x40a529['shift']());}};_0x1936a8(++_0x1ac70a);}(_0xa264,0x1d3));var _0x4a26=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xa264[_0x479160];return _0x47ac6d;};'use strict';var _=require(_0x4a26('0x0'));var util=require('util');var logger=require(_0x4a26('0x1'))(_0x4a26('0x2'));var moment=require('moment');var BPromise=require(_0x4a26('0x3'));var rp=require(_0x4a26('0x4'));var fs=require('fs');var path=require(_0x4a26('0x5'));var rimraf=require(_0x4a26('0x6'));var config=require(_0x4a26('0x7'));var attributes=require(_0x4a26('0x8'));module[_0x4a26('0x9')]=function(_0x528fc6,_0x4cab68){return _0x528fc6[_0x4a26('0xa')](_0x4a26('0xb'),attributes,{'tableName':_0x4a26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a26('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index eb8d2ef..f659542 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(_0x5286f9,_0x31a3a8){var _0x59e798=function(_0x428a72){while(--_0x428a72){_0x5286f9['push'](_0x5286f9['shift']());}};_0x59e798(++_0x31a3a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x22466b,_0x266fad){var _0xa00c5e=function(_0x42c503){while(--_0x42c503){_0x22466b['push'](_0x22466b['shift']());}};_0xa00c5e(++_0x266fad);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 281bebc..4daa978 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 _0xd03e=['index','/:id','show','isAuthenticated','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x495b00,_0x14ea09){var _0x3dae04=function(_0x4684f7){while(--_0x4684f7){_0x495b00['push'](_0x495b00['shift']());}};_0x3dae04(++_0x14ea09);}(_0xd03e,0x116));var _0xed03=function(_0x4d11eb,_0x4dd9cf){_0x4d11eb=_0x4d11eb-0x0;var _0x5bfece=_0xd03e[_0x4d11eb];return _0x5bfece;};'use strict';var multer=require(_0xed03('0x0'));var util=require('util');var path=require(_0xed03('0x1'));var timeout=require(_0xed03('0x2'));var express=require(_0xed03('0x3'));var router=express['Router']();var fs_extra=require(_0xed03('0x4'));var auth=require(_0xed03('0x5'));var interaction=require(_0xed03('0x6'));var config=require(_0xed03('0x7'));var controller=require(_0xed03('0x8'));router[_0xed03('0x9')]('/',auth['isAuthenticated'](),controller[_0xed03('0xa')]);router[_0xed03('0x9')](_0xed03('0xb'),auth['isAuthenticated'](),controller[_0xed03('0xc')]);router['post']('/',auth[_0xed03('0xd')](),controller[_0xed03('0xe')]);router[_0xed03('0xf')](_0xed03('0xb'),auth[_0xed03('0xd')](),controller['update']);router[_0xed03('0x10')]('/:id',auth[_0xed03('0xd')](),controller[_0xed03('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4921=['put','update','/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x5f9810,_0x1cb048){var _0x318fae=function(_0x26d5db){while(--_0x26d5db){_0x5f9810['push'](_0x5f9810['shift']());}};_0x318fae(++_0x1cb048);}(_0x4921,0x1d4));var _0x1492=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x4921[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0x1492('0x0'));var util=require(_0x1492('0x1'));var path=require('path');var timeout=require(_0x1492('0x2'));var express=require(_0x1492('0x3'));var router=express['Router']();var fs_extra=require(_0x1492('0x4'));var auth=require(_0x1492('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1492('0x6'));var controller=require('./cannedAnswer.controller');router[_0x1492('0x7')]('/',auth[_0x1492('0x8')](),controller[_0x1492('0x9')]);router[_0x1492('0x7')]('/:id',auth[_0x1492('0x8')](),controller[_0x1492('0xa')]);router[_0x1492('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1492('0xc')]('/:id',auth[_0x1492('0x8')](),controller[_0x1492('0xd')]);router['delete'](_0x1492('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1492('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7b94822..43389de 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 _0x6aa0=['exports','DATE','STRING','INTEGER'];(function(_0x8a30a2,_0x2d36a6){var _0xa4e91e=function(_0xdabc7b){while(--_0xdabc7b){_0x8a30a2['push'](_0x8a30a2['shift']());}};_0xa4e91e(++_0x2d36a6);}(_0x6aa0,0xb8));var _0x06aa=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x6aa0[_0x3c4a7c];return _0xf13d1e;};'use strict';var Sequelize=require('sequelize');module[_0x06aa('0x0')]={'calldate':{'type':Sequelize[_0x06aa('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x06aa('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x06aa('0x2')]},'dcontext':{'type':Sequelize[_0x06aa('0x2')]},'channel':{'type':Sequelize[_0x06aa('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x06aa('0x2')]},'lastdata':{'type':Sequelize[_0x06aa('0x2')]},'duration':{'type':Sequelize[_0x06aa('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x06aa('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x06aa('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x06aa('0x2')]},'userfield':{'type':Sequelize[_0x06aa('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x06aa('0x2')]},'sequence':{'type':Sequelize[_0x06aa('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x06aa('0x2')]}}; \ No newline at end of file +var _0x1bb2=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1bb2,0x152));var _0x21bb=function(_0x55825c,_0x37b078){_0x55825c=_0x55825c-0x0;var _0x32a9ed=_0x1bb2[_0x55825c];return _0x32a9ed;};'use strict';var Sequelize=require('sequelize');module[_0x21bb('0x0')]={'calldate':{'type':Sequelize[_0x21bb('0x1')],'allowNull':![],'defaultValue':_0x21bb('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x21bb('0x3')]},'dcontext':{'type':Sequelize[_0x21bb('0x3')]},'channel':{'type':Sequelize[_0x21bb('0x3')]},'dstchannel':{'type':Sequelize[_0x21bb('0x3')]},'lastapp':{'type':Sequelize[_0x21bb('0x3')]},'lastdata':{'type':Sequelize[_0x21bb('0x3')]},'duration':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x21bb('0x3')]},'amaflags':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x21bb('0x3')]},'userfield':{'type':Sequelize[_0x21bb('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x21bb('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x21bb('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 12055e9..3e2ce8d 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 _0x9fd4=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','Cdr','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x9fd4,0x16c));var _0x49fd=function(_0xc048e2,_0x3825ef){_0xc048e2=_0xc048e2-0x0;var _0x4012ed=_0x9fd4[_0xc048e2];return _0x4012ed;};'use strict';var emlformat=require(_0x49fd('0x0'));var rimraf=require(_0x49fd('0x1'));var zipdir=require(_0x49fd('0x2'));var jsonpatch=require(_0x49fd('0x3'));var rp=require(_0x49fd('0x4'));var moment=require(_0x49fd('0x5'));var BPromise=require(_0x49fd('0x6'));var Mustache=require(_0x49fd('0x7'));var util=require(_0x49fd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49fd('0x9'));var ejs=require(_0x49fd('0xa'));var fs=require('fs');var fs_extra=require(_0x49fd('0xb'));var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0x9'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var authService=require(_0x49fd('0x12'));var qs=require(_0x49fd('0x13'));var as=require(_0x49fd('0x14'));var hardwareService=require(_0x49fd('0x15'));var logger=require(_0x49fd('0x16'))(_0x49fd('0x17'));var utils=require('../../config/utils');var config=require(_0x49fd('0x18'));var licenseUtil=require(_0x49fd('0x19'));var db=require(_0x49fd('0x1a'))['db'];function respondWithStatusCode(_0x40d1b0,_0x15dabd){_0x15dabd=_0x15dabd||0xcc;return function(_0x206bd8){if(_0x206bd8){return _0x40d1b0[_0x49fd('0x1b')](_0x15dabd);}return _0x40d1b0[_0x49fd('0x1c')](_0x15dabd)[_0x49fd('0x1d')]();};}function respondWithResult(_0x652890,_0x157b09){_0x157b09=_0x157b09||0xc8;return function(_0x44c18c){if(_0x44c18c){return _0x652890[_0x49fd('0x1c')](_0x157b09)[_0x49fd('0x1e')](_0x44c18c);}};}function respondWithFilteredResult(_0x264ab1,_0x201109){return function(_0x2859f2){if(_0x2859f2){var _0x3ca675=typeof _0x201109[_0x49fd('0x1f')]===_0x49fd('0x20')&&typeof _0x201109[_0x49fd('0x21')]===_0x49fd('0x20');var _0x320fe5=_0x2859f2[_0x49fd('0x22')];var _0xb55d24=_0x3ca675?0x0:_0x201109[_0x49fd('0x1f')];var _0x598793=_0x3ca675?_0x2859f2[_0x49fd('0x22')]:_0x201109[_0x49fd('0x1f')]+_0x201109['limit'];var _0x5c323a;if(_0x598793>=_0x320fe5){_0x598793=_0x320fe5;_0x5c323a=0xc8;}else{_0x5c323a=0xce;}_0x264ab1[_0x49fd('0x1c')](_0x5c323a);return _0x264ab1['set'](_0x49fd('0x23'),_0xb55d24+'-'+_0x598793+'/'+_0x320fe5)[_0x49fd('0x1e')](_0x2859f2);}return null;};}function patchUpdates(_0x599315){return function(_0xf7efcf){try{jsonpatch[_0x49fd('0x24')](_0xf7efcf,_0x599315,!![]);}catch(_0x5ae3bc){return BPromise[_0x49fd('0x25')](_0x5ae3bc);}return _0xf7efcf[_0x49fd('0x26')]();};}function saveUpdates(_0x2e1c40,_0x290f59){return function(_0x20fa0d){if(_0x20fa0d){return _0x20fa0d[_0x49fd('0x27')](_0x2e1c40)['then'](function(_0x46019d){return _0x46019d;});}return null;};}function removeEntity(_0xd43815,_0x8f202b){return function(_0x4bf811){if(_0x4bf811){return _0x4bf811[_0x49fd('0x28')]()[_0x49fd('0x29')](function(){_0xd43815[_0x49fd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597161,_0x497469){return function(_0x13c5a8){if(!_0x13c5a8){_0x597161[_0x49fd('0x1b')](0x194);}return _0x13c5a8;};}function handleError(_0x4ec190,_0x302ab2){_0x302ab2=_0x302ab2||0x1f4;return function(_0x9587b9){logger[_0x49fd('0x2a')](_0x9587b9[_0x49fd('0x2b')]);if(_0x9587b9[_0x49fd('0x2c')]){delete _0x9587b9['name'];}_0x4ec190[_0x49fd('0x1c')](_0x302ab2)['send'](_0x9587b9);};}exports[_0x49fd('0x2d')]=function(_0x89badc,_0x54acb5){var _0x203038={},_0x2c8568={},_0x23374c={'count':0x0,'rows':[]};var _0x43826f=_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')],function(_0x242203){return{'name':_0x242203['fieldName'],'type':_0x242203[_0x49fd('0x31')]['key']};});_0x2c8568[_0x49fd('0x32')]=_['map'](_0x43826f,_0x49fd('0x2c'));_0x2c8568[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x89badc['query']);_0x2c8568['filters']=_['intersection'](_0x2c8568[_0x49fd('0x32')],_0x2c8568[_0x49fd('0x33')]);_0x203038['attributes']=_[_0x49fd('0x35')](_0x2c8568['model'],qs['fields'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x36')]));_0x203038[_0x49fd('0x37')]=_0x203038[_0x49fd('0x37')][_0x49fd('0x38')]?_0x203038['attributes']:_0x2c8568['model'];if(!_0x89badc[_0x49fd('0x33')][_0x49fd('0x39')](_0x49fd('0x3a'))){_0x203038[_0x49fd('0x21')]=qs['limit'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x21')]);_0x203038[_0x49fd('0x1f')]=qs[_0x49fd('0x1f')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x1f')]);}_0x203038[_0x49fd('0x3b')]=qs[_0x49fd('0x3c')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x3c')]);_0x203038[_0x49fd('0x3d')]=qs['filters'](_[_0x49fd('0x3e')](_0x89badc[_0x49fd('0x33')],_0x2c8568[_0x49fd('0x3f')]),_0x43826f);if(_0x89badc[_0x49fd('0x33')][_0x49fd('0x40')]){_0x203038[_0x49fd('0x3d')]=_[_0x49fd('0x41')](_0x203038[_0x49fd('0x3d')],{'$or':_[_0x49fd('0x2e')](_0x43826f,function(_0x4a1856){if(_0x4a1856[_0x49fd('0x31')]!=='VIRTUAL'){var _0x46e84c={};_0x46e84c[_0x4a1856[_0x49fd('0x2c')]]={'$like':'%'+_0x89badc['query'][_0x49fd('0x40')]+'%'};return _0x46e84c;}})});}_0x203038=_[_0x49fd('0x41')]({},_0x203038,_0x89badc['options']);var _0x1f9a65={'where':_0x203038['where']};return db['Cdr']['count'](_0x1f9a65)[_0x49fd('0x29')](function(_0x32982e){_0x23374c[_0x49fd('0x22')]=_0x32982e;if(_0x89badc[_0x49fd('0x33')]['includeAll']){_0x203038[_0x49fd('0x42')]=[{'all':!![]}];}return db[_0x49fd('0x2f')][_0x49fd('0x43')](_0x203038);})[_0x49fd('0x29')](function(_0x115c5a){_0x23374c[_0x49fd('0x44')]=_0x115c5a;return _0x23374c;})[_0x49fd('0x29')](respondWithFilteredResult(_0x54acb5,_0x203038))[_0x49fd('0x45')](handleError(_0x54acb5,null));};exports['show']=function(_0x255a73,_0x2c8ab1){var _0x4dce94={'raw':!![],'where':{'id':_0x255a73[_0x49fd('0x46')]['id']}},_0x3be41b={};_0x3be41b['model']=_[_0x49fd('0x34')](db['Cdr'][_0x49fd('0x30')]);_0x3be41b[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x255a73[_0x49fd('0x33')]);_0x3be41b['filters']=_['intersection'](_0x3be41b[_0x49fd('0x32')],_0x3be41b['query']);_0x4dce94[_0x49fd('0x37')]=_[_0x49fd('0x35')](_0x3be41b[_0x49fd('0x32')],qs[_0x49fd('0x36')](_0x255a73['query'][_0x49fd('0x36')]));_0x4dce94[_0x49fd('0x37')]=_0x4dce94[_0x49fd('0x37')][_0x49fd('0x38')]?_0x4dce94[_0x49fd('0x37')]:_0x3be41b[_0x49fd('0x32')];if(_0x255a73[_0x49fd('0x33')][_0x49fd('0x47')]){_0x4dce94[_0x49fd('0x42')]=[{'all':!![]}];}_0x4dce94=_[_0x49fd('0x41')]({},_0x4dce94,_0x255a73[_0x49fd('0x48')]);return db[_0x49fd('0x2f')][_0x49fd('0x49')](_0x4dce94)[_0x49fd('0x29')](handleEntityNotFound(_0x2c8ab1,null))['then'](respondWithResult(_0x2c8ab1,null))['catch'](handleError(_0x2c8ab1,null));};exports[_0x49fd('0x4a')]=function(_0xa3518f,_0x42287e){return db[_0x49fd('0x2f')]['create'](_0xa3518f[_0x49fd('0x4b')],{})[_0x49fd('0x29')](respondWithResult(_0x42287e,0xc9))['catch'](handleError(_0x42287e,null));};exports[_0x49fd('0x27')]=function(_0x270360,_0xaac56f){if(_0x270360[_0x49fd('0x4b')]['id']){delete _0x270360[_0x49fd('0x4b')]['id'];}return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x270360[_0x49fd('0x46')]['id']}})[_0x49fd('0x29')](handleEntityNotFound(_0xaac56f,null))[_0x49fd('0x29')](saveUpdates(_0x270360[_0x49fd('0x4b')],null))['then'](respondWithResult(_0xaac56f,null))[_0x49fd('0x45')](handleError(_0xaac56f,null));};exports[_0x49fd('0x28')]=function(_0x32694b,_0x263cf3){return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x32694b['params']['id']}})['then'](handleEntityNotFound(_0x263cf3,null))[_0x49fd('0x29')](removeEntity(_0x263cf3,null))[_0x49fd('0x45')](handleError(_0x263cf3,null));};exports[_0x49fd('0x4c')]=function(_0x5c34c0,_0x31783f){return db[_0x49fd('0x2f')]['describe']()['then'](respondWithResult(_0x31783f,null))['catch'](handleError(_0x31783f,null));}; \ No newline at end of file +var _0x8958=['describe','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Cdr','includeAll','include','findAll','merge','find','catch','create','body','params'];(function(_0x58ebf8,_0x416386){var _0x17f9a0=function(_0x535d42){while(--_0x535d42){_0x58ebf8['push'](_0x58ebf8['shift']());}};_0x17f9a0(++_0x416386);}(_0x8958,0x93));var _0x8895=function(_0x1105ad,_0x374846){_0x1105ad=_0x1105ad-0x0;var _0x283bfd=_0x8958[_0x1105ad];return _0x283bfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['Cdr']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['map'](_0x16b65b,_0x8895('0x26'));_0x37ac3a['query']=_[_0x8895('0x2e')](_0x5c03ea['query']);_0x37ac3a[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a[_0x8895('0x31')]);_0x6e449d[_0x8895('0x32')]=_['intersection'](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x33')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x33')]));_0x6e449d[_0x8895('0x32')]=_0x6e449d['attributes'][_0x8895('0x34')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea['query'][_0x8895('0x35')](_0x8895('0x36'))){_0x6e449d[_0x8895('0x1d')]=qs[_0x8895('0x1d')](_0x5c03ea[_0x8895('0x31')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs['offset'](_0x5c03ea[_0x8895('0x31')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x37')]=qs[_0x8895('0x38')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x38')]);_0x6e449d['where']=qs[_0x8895('0x2f')](_[_0x8895('0x39')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x2f')]),_0x16b65b);if(_0x5c03ea['query'][_0x8895('0x3a')]){_0x6e449d[_0x8895('0x3b')]=_['merge'](_0x6e449d[_0x8895('0x3b')],{'$or':_[_0x8895('0x29')](_0x16b65b,function(_0x5b7204){if(_0x5b7204['type']!==_0x8895('0x3c')){var _0xf0b378={};_0xf0b378[_0x5b7204[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea[_0x8895('0x31')][_0x8895('0x3a')]+'%'};return _0xf0b378;}})});}_0x6e449d=_['merge']({},_0x6e449d,_0x5c03ea[_0x8895('0x3d')]);var _0x25c854={'where':_0x6e449d[_0x8895('0x3b')]};return db[_0x8895('0x3e')][_0x8895('0x1e')](_0x25c854)[_0x8895('0x24')](function(_0x4a7e22){_0x3fc4cc[_0x8895('0x1e')]=_0x4a7e22;if(_0x5c03ea['query'][_0x8895('0x3f')]){_0x6e449d[_0x8895('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x8895('0x41')](_0x6e449d);})['then'](function(_0x1e6395){_0x3fc4cc['rows']=_0x1e6395;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x4881d0,_0x47cf10){var _0x447ed6={'raw':!![],'where':{'id':_0x4881d0['params']['id']}},_0x206f57={};_0x206f57['model']=_[_0x8895('0x2e')](db[_0x8895('0x3e')]['rawAttributes']);_0x206f57[_0x8895('0x31')]=_[_0x8895('0x2e')](_0x4881d0[_0x8895('0x31')]);_0x206f57[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x206f57['model'],_0x206f57['query']);_0x447ed6['attributes']=_[_0x8895('0x30')](_0x206f57['model'],qs[_0x8895('0x33')](_0x4881d0[_0x8895('0x31')][_0x8895('0x33')]));_0x447ed6[_0x8895('0x32')]=_0x447ed6['attributes'][_0x8895('0x34')]?_0x447ed6[_0x8895('0x32')]:_0x206f57[_0x8895('0x2d')];if(_0x4881d0[_0x8895('0x31')][_0x8895('0x3f')]){_0x447ed6[_0x8895('0x40')]=[{'all':!![]}];}_0x447ed6=_[_0x8895('0x42')]({},_0x447ed6,_0x4881d0[_0x8895('0x3d')]);return db['Cdr'][_0x8895('0x43')](_0x447ed6)[_0x8895('0x24')](handleEntityNotFound(_0x47cf10,null))['then'](respondWithResult(_0x47cf10,null))[_0x8895('0x44')](handleError(_0x47cf10,null));};exports['create']=function(_0x5829ec,_0x13546d){return db[_0x8895('0x3e')][_0x8895('0x45')](_0x5829ec['body'],{})[_0x8895('0x24')](respondWithResult(_0x13546d,0xc9))['catch'](handleError(_0x13546d,null));};exports[_0x8895('0x23')]=function(_0x152197,_0xb3ecd6){if(_0x152197[_0x8895('0x46')]['id']){delete _0x152197[_0x8895('0x46')]['id'];}return db[_0x8895('0x3e')][_0x8895('0x43')]({'where':{'id':_0x152197['params']['id']}})['then'](handleEntityNotFound(_0xb3ecd6,null))[_0x8895('0x24')](saveUpdates(_0x152197[_0x8895('0x46')],null))['then'](respondWithResult(_0xb3ecd6,null))[_0x8895('0x44')](handleError(_0xb3ecd6,null));};exports['destroy']=function(_0x4e8af3,_0x2daafe){return db['Cdr'][_0x8895('0x43')]({'where':{'id':_0x4e8af3[_0x8895('0x47')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2daafe,null))[_0x8895('0x24')](removeEntity(_0x2daafe,null))[_0x8895('0x44')](handleError(_0x2daafe,null));};exports[_0x8895('0x48')]=function(_0x306481,_0x38d6ae){return db['Cdr'][_0x8895('0x48')]()[_0x8895('0x24')](respondWithResult(_0x38d6ae,null))[_0x8895('0x44')](handleError(_0x38d6ae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7e9e6fa..4cb2613 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(_0x39af91,_0x90a626){var _0x1827db=function(_0x56a405){while(--_0x56a405){_0x39af91['push'](_0x39af91['shift']());}};_0x1827db(++_0x90a626);}(_0x7a54,0x106));var _0x47a5=function(_0x5271db,_0xfc90e7){_0x5271db=_0x5271db-0x0;var _0x416438=_0x7a54[_0x5271db];return _0x416438;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x53a316,_0xf26b8f){var _0x37c0df=function(_0x1220b0){while(--_0x1220b0){_0x53a316['push'](_0x53a316['shift']());}};_0x37c0df(++_0xf26b8f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 25ae926..74d09bf 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 _0x6487=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x5223d8,_0x4084f2){var _0x35b768=function(_0x1281d0){while(--_0x1281d0){_0x5223d8['push'](_0x5223d8['shift']());}};_0x35b768(++_0x4084f2);}(_0x6487,0x112));var _0x7648=function(_0x2b5d2c,_0x2da1a8){_0x2b5d2c=_0x2b5d2c-0x0;var _0x50de0a=_0x6487[_0x2b5d2c];return _0x50de0a;};'use strict';var _=require('lodash');var util=require(_0x7648('0x0'));var moment=require(_0x7648('0x1'));var BPromise=require(_0x7648('0x2'));var rs=require(_0x7648('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7648('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7648('0x5'))(_0x7648('0x6'));var config=require(_0x7648('0x7'));var jayson=require(_0x7648('0x8'));var client=jayson[_0x7648('0x9')][_0x7648('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x557d9f,_0x3ab286,_0x1ec19e){return new BPromise(function(_0x331e4f,_0x4560ec){return client[_0x7648('0xb')](_0x557d9f,_0x1ec19e)['then'](function(_0x188d3e){logger[_0x7648('0xc')]('Cdr,\x20%s,\x20%s',_0x3ab286,_0x7648('0xd'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x3ab286,_0x7648('0xd'),JSON[_0x7648('0xe')](_0x188d3e));if(_0x188d3e[_0x7648('0xf')]){if(_0x188d3e['error'][_0x7648('0x10')]===0x1f4){logger['error'](_0x7648('0x11'),_0x3ab286,_0x188d3e[_0x7648('0xf')][_0x7648('0x12')]);return _0x4560ec(_0x188d3e[_0x7648('0xf')]['message']);}logger[_0x7648('0xf')](_0x7648('0x11'),_0x3ab286,_0x188d3e[_0x7648('0xf')][_0x7648('0x12')]);return _0x331e4f(_0x188d3e[_0x7648('0xf')][_0x7648('0x12')]);}else{logger[_0x7648('0xc')]('Cdr,\x20%s,\x20%s',_0x3ab286,_0x7648('0xd'));_0x331e4f(_0x188d3e[_0x7648('0x13')][_0x7648('0x12')]);}})[_0x7648('0x14')](function(_0x2c9dc1){logger[_0x7648('0xf')](_0x7648('0x11'),_0x3ab286,_0x2c9dc1);_0x4560ec(_0x2c9dc1);});});} \ No newline at end of file +var _0x711a=['client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0xb2120f,_0x1e23c1){var _0x3b8dd9=function(_0xa8dafe){while(--_0xa8dafe){_0xb2120f['push'](_0xb2120f['shift']());}};_0x3b8dd9(++_0x1e23c1);}(_0x711a,0xf5));var _0xa711=function(_0x165b12,_0x4aff80){_0x165b12=_0x165b12-0x0;var _0x378222=_0x711a[_0x165b12];return _0x378222;};'use strict';var _=require('lodash');var util=require(_0xa711('0x0'));var moment=require('moment');var BPromise=require(_0xa711('0x1'));var rs=require(_0xa711('0x2'));var fs=require('fs');var Redis=require(_0xa711('0x3'));var db=require(_0xa711('0x4'))['db'];var utils=require(_0xa711('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa711('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa711('0x7')][_0xa711('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256113,_0x43080a,_0x4daae4){return new BPromise(function(_0x4f8d44,_0x19f618){return client[_0xa711('0x9')](_0x256113,_0x4daae4)[_0xa711('0xa')](function(_0x153ece){logger['info'](_0xa711('0xb'),_0x43080a,_0xa711('0xc'));logger[_0xa711('0xd')](_0xa711('0xe'),_0x43080a,'request\x20sent',JSON[_0xa711('0xf')](_0x153ece));if(_0x153ece['error']){if(_0x153ece['error'][_0xa711('0x10')]===0x1f4){logger['error'](_0xa711('0xb'),_0x43080a,_0x153ece[_0xa711('0x11')][_0xa711('0x12')]);return _0x19f618(_0x153ece['error'][_0xa711('0x12')]);}logger['error'](_0xa711('0xb'),_0x43080a,_0x153ece[_0xa711('0x11')][_0xa711('0x12')]);return _0x4f8d44(_0x153ece['error'][_0xa711('0x12')]);}else{logger[_0xa711('0x13')](_0xa711('0xb'),_0x43080a,_0xa711('0xc'));_0x4f8d44(_0x153ece[_0xa711('0x14')]['message']);}})['catch'](function(_0x105483){logger[_0xa711('0x11')]('Cdr,\x20%s,\x20%s',_0x43080a,_0x105483);_0x19f618(_0x105483);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fb85b20..2b40ed0 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x54820c,_0xd5a2f6){var _0x5c60c1=function(_0x495680){while(--_0x495680){_0x54820c['push'](_0x54820c['shift']());}};_0x5c60c1(++_0xd5a2f6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1c1432c..757a463 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 _0x11fc=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1b3228,_0x220869){var _0x47dade=function(_0x27523b){while(--_0x27523b){_0x1b3228['push'](_0x1b3228['shift']());}};_0x47dade(++_0x220869);}(_0x11fc,0x1ea));var _0xc11f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11fc[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xc11f('0x0'));module[_0xc11f('0x1')]={'priority':{'type':Sequelize[_0xc11f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc11f('0x3')],'allowNull':![],'defaultValue':_0xc11f('0x4')},'appdata':{'type':Sequelize[_0xc11f('0x5')]()},'description':{'type':Sequelize[_0xc11f('0x3')]},'interval':{'type':Sequelize[_0xc11f('0x3')],'defaultValue':_0xc11f('0x6')}}; \ No newline at end of file +var _0xe59b=['noop','TEXT','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe59b,0x1de));var _0xbe59=function(_0x52253f,_0x1def94){_0x52253f=_0x52253f-0x0;var _0x462d99=_0xe59b[_0x52253f];return _0x462d99;};'use strict';var Sequelize=require(_0xbe59('0x0'));module[_0xbe59('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbe59('0x2')},'appdata':{'type':Sequelize[_0xbe59('0x3')]()},'description':{'type':Sequelize[_0xbe59('0x4')]},'interval':{'type':Sequelize[_0xbe59('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index bcc7bdc..1dd88ae 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 _0x26f9=['length','includeAll','include','options','find','catch','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x4e5658,_0x1746c3){var _0x5a9e0b=function(_0x17fe7e){while(--_0x17fe7e){_0x4e5658['push'](_0x4e5658['shift']());}};_0x5a9e0b(++_0x1746c3);}(_0x26f9,0x16f));var _0x926f=function(_0x4d830b,_0x27f78d){_0x4d830b=_0x4d830b-0x0;var _0x238c89=_0x26f9[_0x4d830b];return _0x238c89;};'use strict';var emlformat=require(_0x926f('0x0'));var rimraf=require(_0x926f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x926f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x926f('0x3'));var Mustache=require(_0x926f('0x4'));var util=require('util');var path=require(_0x926f('0x5'));var sox=require(_0x926f('0x6'));var csv=require(_0x926f('0x7'));var ejs=require(_0x926f('0x8'));var fs=require('fs');var fs_extra=require(_0x926f('0x9'));var _=require(_0x926f('0xa'));var squel=require(_0x926f('0xb'));var crypto=require(_0x926f('0xc'));var jsforce=require(_0x926f('0xd'));var deskjs=require(_0x926f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x926f('0xf'));var Papa=require('papaparse');var Redis=require(_0x926f('0x10'));var authService=require(_0x926f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x926f('0x12'));var hardwareService=require(_0x926f('0x13'));var logger=require(_0x926f('0x14'))(_0x926f('0x15'));var utils=require(_0x926f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x926f('0x17'));var db=require(_0x926f('0x18'))['db'];function respondWithStatusCode(_0x14f316,_0x1ac8ab){_0x1ac8ab=_0x1ac8ab||0xcc;return function(_0x44f5da){if(_0x44f5da){return _0x14f316[_0x926f('0x19')](_0x1ac8ab);}return _0x14f316[_0x926f('0x1a')](_0x1ac8ab)['end']();};}function respondWithResult(_0x48ee07,_0x5e6fb1){_0x5e6fb1=_0x5e6fb1||0xc8;return function(_0x11197b){if(_0x11197b){return _0x48ee07[_0x926f('0x1a')](_0x5e6fb1)[_0x926f('0x1b')](_0x11197b);}};}function respondWithFilteredResult(_0x280759,_0x57c87f){return function(_0x37035c){if(_0x37035c){var _0x385fad=typeof _0x57c87f['offset']===_0x926f('0x1c')&&typeof _0x57c87f['limit']===_0x926f('0x1c');var _0x5ad99f=_0x37035c['count'];var _0x36ead3=_0x385fad?0x0:_0x57c87f[_0x926f('0x1d')];var _0x4f25e3=_0x385fad?_0x37035c[_0x926f('0x1e')]:_0x57c87f[_0x926f('0x1d')]+_0x57c87f[_0x926f('0x1f')];var _0x50b2d4;if(_0x4f25e3>=_0x5ad99f){_0x4f25e3=_0x5ad99f;_0x50b2d4=0xc8;}else{_0x50b2d4=0xce;}_0x280759[_0x926f('0x1a')](_0x50b2d4);return _0x280759[_0x926f('0x20')]('Content-Range',_0x36ead3+'-'+_0x4f25e3+'/'+_0x5ad99f)[_0x926f('0x1b')](_0x37035c);}return null;};}function patchUpdates(_0x4241ac){return function(_0x56fef1){try{jsonpatch[_0x926f('0x21')](_0x56fef1,_0x4241ac,!![]);}catch(_0xa942ae){return BPromise[_0x926f('0x22')](_0xa942ae);}return _0x56fef1[_0x926f('0x23')]();};}function saveUpdates(_0x150430,_0x3b7179){return function(_0x412260){if(_0x412260){return _0x412260[_0x926f('0x24')](_0x150430)[_0x926f('0x25')](function(_0x61738a){return _0x61738a;});}return null;};}function removeEntity(_0x2be66b,_0x4a93a4){return function(_0x2d76eb){if(_0x2d76eb){return _0x2d76eb[_0x926f('0x26')]()['then'](function(){_0x2be66b[_0x926f('0x1a')](0xcc)[_0x926f('0x27')]();});}};}function handleEntityNotFound(_0x36a17e,_0x26391d){return function(_0x799889){if(!_0x799889){_0x36a17e[_0x926f('0x19')](0x194);}return _0x799889;};}function handleError(_0x4b8964,_0x110e59){_0x110e59=_0x110e59||0x1f4;return function(_0x5065dd){logger[_0x926f('0x28')](_0x5065dd[_0x926f('0x29')]);if(_0x5065dd[_0x926f('0x2a')]){delete _0x5065dd[_0x926f('0x2a')];}_0x4b8964['status'](_0x110e59)[_0x926f('0x2b')](_0x5065dd);};}exports['show']=function(_0xc88ea4,_0x2556ce){var _0x518a47={'raw':!![],'where':{'id':_0xc88ea4[_0x926f('0x2c')]['id']}},_0x5f35fe={};_0x5f35fe[_0x926f('0x2d')]=_['keys'](db[_0x926f('0x2e')][_0x926f('0x2f')]);_0x5f35fe['query']=_['keys'](_0xc88ea4[_0x926f('0x30')]);_0x5f35fe[_0x926f('0x31')]=_[_0x926f('0x32')](_0x5f35fe['model'],_0x5f35fe[_0x926f('0x30')]);_0x518a47[_0x926f('0x33')]=_[_0x926f('0x32')](_0x5f35fe['model'],qs[_0x926f('0x34')](_0xc88ea4[_0x926f('0x30')][_0x926f('0x34')]));_0x518a47[_0x926f('0x33')]=_0x518a47[_0x926f('0x33')][_0x926f('0x35')]?_0x518a47['attributes']:_0x5f35fe[_0x926f('0x2d')];if(_0xc88ea4[_0x926f('0x30')][_0x926f('0x36')]){_0x518a47[_0x926f('0x37')]=[{'all':!![]}];}_0x518a47=_['merge']({},_0x518a47,_0xc88ea4[_0x926f('0x38')]);return db[_0x926f('0x2e')][_0x926f('0x39')](_0x518a47)[_0x926f('0x25')](handleEntityNotFound(_0x2556ce,null))[_0x926f('0x25')](respondWithResult(_0x2556ce,null))[_0x926f('0x3a')](handleError(_0x2556ce,null));};exports[_0x926f('0x24')]=function(_0xaad45d,_0x2184c1){if(_0xaad45d[_0x926f('0x3b')]['id']){delete _0xaad45d[_0x926f('0x3b')]['id'];}return db['ChatApplication'][_0x926f('0x39')]({'where':{'id':_0xaad45d[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2184c1,null))[_0x926f('0x25')](saveUpdates(_0xaad45d[_0x926f('0x3b')],null))[_0x926f('0x25')](respondWithResult(_0x2184c1,null))[_0x926f('0x3a')](handleError(_0x2184c1,null));};exports[_0x926f('0x26')]=function(_0x3a21ca,_0x9ff853){return db[_0x926f('0x2e')]['find']({'where':{'id':_0x3a21ca[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x9ff853,null))[_0x926f('0x25')](removeEntity(_0x9ff853,null))[_0x926f('0x3a')](handleError(_0x9ff853,null));}; \ No newline at end of file +var _0x9c02=['destroy','error','stack','send','show','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','options','find','catch','update','body','params','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../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','apply','reject','save','then'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x9c02,0x196));var _0x29c0=function(_0x906146,_0x2ac357){_0x906146=_0x906146-0x0;var _0x225ecb=_0x9c02[_0x906146];return _0x225ecb;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){_0x5846d0[_0x29c0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161b39,_0x140988){return function(_0x5561af){if(!_0x5561af){_0x161b39[_0x29c0('0x14')](0x194);}return _0x5561af;};}function handleError(_0xd7f9a8,_0x3946f8){_0x3946f8=_0x3946f8||0x1f4;return function(_0x184998){logger[_0x29c0('0x23')](_0x184998[_0x29c0('0x24')]);if(_0x184998['name']){delete _0x184998['name'];}_0xd7f9a8['status'](_0x3946f8)[_0x29c0('0x25')](_0x184998);};}exports[_0x29c0('0x26')]=function(_0x4cdf7c,_0x4aa6bd){var _0x208a5d={'raw':!![],'where':{'id':_0x4cdf7c['params']['id']}},_0x3eebaa={};_0x3eebaa['model']=_['keys'](db[_0x29c0('0x27')][_0x29c0('0x28')]);_0x3eebaa[_0x29c0('0x29')]=_['keys'](_0x4cdf7c[_0x29c0('0x29')]);_0x3eebaa[_0x29c0('0x2a')]=_['intersection'](_0x3eebaa[_0x29c0('0x2b')],_0x3eebaa[_0x29c0('0x29')]);_0x208a5d[_0x29c0('0x2c')]=_[_0x29c0('0x2d')](_0x3eebaa[_0x29c0('0x2b')],qs[_0x29c0('0x2e')](_0x4cdf7c[_0x29c0('0x29')]['fields']));_0x208a5d['attributes']=_0x208a5d[_0x29c0('0x2c')][_0x29c0('0x2f')]?_0x208a5d[_0x29c0('0x2c')]:_0x3eebaa['model'];if(_0x4cdf7c[_0x29c0('0x29')][_0x29c0('0x30')]){_0x208a5d['include']=[{'all':!![]}];}_0x208a5d=_['merge']({},_0x208a5d,_0x4cdf7c[_0x29c0('0x31')]);return db[_0x29c0('0x27')][_0x29c0('0x32')](_0x208a5d)[_0x29c0('0x21')](handleEntityNotFound(_0x4aa6bd,null))[_0x29c0('0x21')](respondWithResult(_0x4aa6bd,null))[_0x29c0('0x33')](handleError(_0x4aa6bd,null));};exports[_0x29c0('0x34')]=function(_0x566e0a,_0x315bca){if(_0x566e0a['body']['id']){delete _0x566e0a[_0x29c0('0x35')]['id'];}return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x566e0a['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x315bca,null))[_0x29c0('0x21')](saveUpdates(_0x566e0a['body'],null))[_0x29c0('0x21')](respondWithResult(_0x315bca,null))[_0x29c0('0x33')](handleError(_0x315bca,null));};exports[_0x29c0('0x22')]=function(_0x28c919,_0x3a9b92){return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x28c919[_0x29c0('0x36')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x3a9b92,null))[_0x29c0('0x21')](removeEntity(_0x3a9b92,null))[_0x29c0('0x33')](handleError(_0x3a9b92,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1cd5565..86f0c62 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 _0x3c57=['./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x516a08,_0xb28bd5){var _0x5bd2b3=function(_0x567e55){while(--_0x567e55){_0x516a08['push'](_0x516a08['shift']());}};_0x5bd2b3(++_0xb28bd5);}(_0x3c57,0x8c));var _0x73c5=function(_0x1bf3b9,_0x3456ec){_0x1bf3b9=_0x1bf3b9-0x0;var _0xcf3b80=_0x3c57[_0x1bf3b9];return _0xcf3b80;};'use strict';var _=require(_0x73c5('0x0'));var util=require(_0x73c5('0x1'));var logger=require(_0x73c5('0x2'))(_0x73c5('0x3'));var moment=require(_0x73c5('0x4'));var BPromise=require(_0x73c5('0x5'));var rp=require(_0x73c5('0x6'));var fs=require('fs');var path=require(_0x73c5('0x7'));var rimraf=require(_0x73c5('0x8'));var config=require(_0x73c5('0x9'));var attributes=require(_0x73c5('0xa'));module[_0x73c5('0xb')]=function(_0x47bec6,_0x5750e5){return _0x47bec6['define'](_0x73c5('0xc'),attributes,{'tableName':_0x73c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x73c5('0xe')});}; \ No newline at end of file +var _0xcb70=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','request-promise','path'];(function(_0x277ac1,_0x1b4e45){var _0x28db07=function(_0x57e0a6){while(--_0x57e0a6){_0x277ac1['push'](_0x277ac1['shift']());}};_0x28db07(++_0x1b4e45);}(_0xcb70,0xf3));var _0x0cb7=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xcb70[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x0cb7('0x0'));var util=require(_0x0cb7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cb7('0x2'));var fs=require('fs');var path=require(_0x0cb7('0x3'));var rimraf=require(_0x0cb7('0x4'));var config=require(_0x0cb7('0x5'));var attributes=require(_0x0cb7('0x6'));module[_0x0cb7('0x7')]=function(_0x19a010,_0x4e5b82){return _0x19a010[_0x0cb7('0x8')](_0x0cb7('0x9'),attributes,{'tableName':_0x0cb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0cb7('0xb'),'collate':_0x0cb7('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2666909..5e4d023 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 _0xf691=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0xf691,0x147));var _0x1f69=function(_0x29799f,_0x57f5b2){_0x29799f=_0x29799f-0x0;var _0x3c98df=_0xf691[_0x29799f];return _0x3c98df;};'use strict';var _=require(_0x1f69('0x0'));var util=require(_0x1f69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f69('0x2'));var fs=require('fs');var Redis=require(_0x1f69('0x3'));var db=require(_0x1f69('0x4'))['db'];var utils=require(_0x1f69('0x5'));var logger=require('../../config/logger')(_0x1f69('0x6'));var config=require(_0x1f69('0x7'));var jayson=require(_0x1f69('0x8'));var client=jayson[_0x1f69('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x431ed9,_0x1b468a,_0x5775cb){return new BPromise(function(_0x555769,_0x33d1a3){return client[_0x1f69('0xa')](_0x431ed9,_0x5775cb)[_0x1f69('0xb')](function(_0x5158cb){logger['info']('ChatApplication,\x20%s,\x20%s',_0x1b468a,_0x1f69('0xc'));logger[_0x1f69('0xd')](_0x1f69('0xe'),_0x1b468a,_0x1f69('0xc'),JSON['stringify'](_0x5158cb));if(_0x5158cb[_0x1f69('0xf')]){if(_0x5158cb['error'][_0x1f69('0x10')]===0x1f4){logger[_0x1f69('0xf')](_0x1f69('0x11'),_0x1b468a,_0x5158cb[_0x1f69('0xf')]['message']);return _0x33d1a3(_0x5158cb[_0x1f69('0xf')]['message']);}logger[_0x1f69('0xf')](_0x1f69('0x11'),_0x1b468a,_0x5158cb['error'][_0x1f69('0x12')]);return _0x555769(_0x5158cb[_0x1f69('0xf')]['message']);}else{logger[_0x1f69('0x13')](_0x1f69('0x11'),_0x1b468a,_0x1f69('0xc'));_0x555769(_0x5158cb['result'][_0x1f69('0x12')]);}})['catch'](function(_0x485798){logger[_0x1f69('0xf')](_0x1f69('0x11'),_0x1b468a,_0x485798);_0x33d1a3(_0x485798);});});} \ No newline at end of file +var _0x7cb1=['ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cb1,0x141));var _0x17cb=function(_0x22c94b,_0x58862a){_0x22c94b=_0x22c94b-0x0;var _0x377849=_0x7cb1[_0x22c94b];return _0x377849;};'use strict';var _=require('lodash');var util=require(_0x17cb('0x0'));var moment=require(_0x17cb('0x1'));var BPromise=require(_0x17cb('0x2'));var rs=require(_0x17cb('0x3'));var fs=require('fs');var Redis=require(_0x17cb('0x4'));var db=require(_0x17cb('0x5'))['db'];var utils=require(_0x17cb('0x6'));var logger=require(_0x17cb('0x7'))(_0x17cb('0x8'));var config=require('../../config/environment');var jayson=require(_0x17cb('0x9'));var client=jayson[_0x17cb('0xa')][_0x17cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ef211,_0x36316a,_0x13172f){return new BPromise(function(_0x4280c2,_0xfc3c3e){return client[_0x17cb('0xc')](_0x5ef211,_0x13172f)[_0x17cb('0xd')](function(_0x2a80d9){logger[_0x17cb('0xe')](_0x17cb('0xf'),_0x36316a,'request\x20sent');logger[_0x17cb('0x10')](_0x17cb('0x11'),_0x36316a,_0x17cb('0x12'),JSON[_0x17cb('0x13')](_0x2a80d9));if(_0x2a80d9[_0x17cb('0x14')]){if(_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x15')]===0x1f4){logger['error'](_0x17cb('0xf'),_0x36316a,_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x16')]);return _0xfc3c3e(_0x2a80d9['error'][_0x17cb('0x16')]);}logger[_0x17cb('0x14')](_0x17cb('0xf'),_0x36316a,_0x2a80d9['error'][_0x17cb('0x16')]);return _0x4280c2(_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x16')]);}else{logger[_0x17cb('0xe')](_0x17cb('0xf'),_0x36316a,_0x17cb('0x12'));_0x4280c2(_0x2a80d9[_0x17cb('0x17')][_0x17cb('0x16')]);}})['catch'](function(_0x2fa848){logger[_0x17cb('0x14')]('ChatApplication,\x20%s,\x20%s',_0x36316a,_0x2fa848);_0xfc3c3e(_0x2fa848);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f982373..4865138 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 _0x5643=['/:id','isAuthenticated','show','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x33a8c0,_0x19c717){var _0x367ab5=function(_0x125eca){while(--_0x125eca){_0x33a8c0['push'](_0x33a8c0['shift']());}};_0x367ab5(++_0x19c717);}(_0x5643,0xb1));var _0x3564=function(_0x3c7233,_0x4bc39b){_0x3c7233=_0x3c7233-0x0;var _0x29283d=_0x5643[_0x3c7233];return _0x29283d;};'use strict';var multer=require(_0x3564('0x0'));var util=require('util');var path=require(_0x3564('0x1'));var timeout=require(_0x3564('0x2'));var express=require(_0x3564('0x3'));var router=express['Router']();var fs_extra=require(_0x3564('0x4'));var auth=require(_0x3564('0x5'));var interaction=require(_0x3564('0x6'));var config=require(_0x3564('0x7'));var controller=require(_0x3564('0x8'));router[_0x3564('0x9')](_0x3564('0xa'),auth[_0x3564('0xb')](),controller[_0x3564('0xc')]);router[_0x3564('0xd')](_0x3564('0xa'),auth[_0x3564('0xb')](),controller[_0x3564('0xe')]);router[_0x3564('0xf')]('/:id',auth[_0x3564('0xb')](),controller['destroy']);module[_0x3564('0x10')]=router; \ No newline at end of file +var _0xa4c2=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa4c2,0xc5));var _0x2a4c=function(_0x28ce22,_0x3dc50b){_0x28ce22=_0x28ce22-0x0;var _0x46c0df=_0xa4c2[_0x28ce22];return _0x46c0df;};'use strict';var multer=require(_0x2a4c('0x0'));var util=require(_0x2a4c('0x1'));var path=require(_0x2a4c('0x2'));var timeout=require(_0x2a4c('0x3'));var express=require(_0x2a4c('0x4'));var router=express['Router']();var fs_extra=require(_0x2a4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var controller=require(_0x2a4c('0x8'));router[_0x2a4c('0x9')]('/:id',auth[_0x2a4c('0xa')](),controller['show']);router[_0x2a4c('0xb')](_0x2a4c('0xc'),auth[_0x2a4c('0xa')](),controller[_0x2a4c('0xd')]);router['delete'](_0x2a4c('0xc'),auth['isAuthenticated'](),controller[_0x2a4c('0xe')]);module[_0x2a4c('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 05b5d4d..b073c54 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 _0x237b=['sequelize','exports','STRING'];(function(_0x5dacf5,_0x5518c3){var _0x4205e3=function(_0x131c39){while(--_0x131c39){_0x5dacf5['push'](_0x5dacf5['shift']());}};_0x4205e3(++_0x5518c3);}(_0x237b,0x1a7));var _0xb237=function(_0x2a6980,_0x348831){_0x2a6980=_0x2a6980-0x0;var _0x368cf7=_0x237b[_0x2a6980];return _0x368cf7;};'use strict';var Sequelize=require(_0xb237('0x0'));module[_0xb237('0x1')]={'name':{'type':Sequelize[_0xb237('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb237('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7510=['BOOLEAN','exports','STRING'];(function(_0x3eb789,_0x48354c){var _0x545ece=function(_0x3f1af0){while(--_0x3f1af0){_0x3eb789['push'](_0x3eb789['shift']());}};_0x545ece(++_0x48354c);}(_0x7510,0xa9));var _0x0751=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7510[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0751('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0751('0x1')]},'write':{'type':Sequelize[_0x0751('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 3d02f5d..bc9dbd2 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 _0xeab6=['count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatGroup','rawAttributes','type','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','pick','filter','length','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','order','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x57706c,_0x609b07){var _0x1e221a=function(_0x239112){while(--_0x239112){_0x57706c['push'](_0x57706c['shift']());}};_0x1e221a(++_0x609b07);}(_0xeab6,0x16b));var _0x6eab=function(_0x29af75,_0x152b87){_0x29af75=_0x29af75-0x0;var _0x32b56b=_0xeab6[_0x29af75];return _0x32b56b;};'use strict';var emlformat=require(_0x6eab('0x0'));var rimraf=require(_0x6eab('0x1'));var zipdir=require(_0x6eab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eab('0x3'));var moment=require(_0x6eab('0x4'));var BPromise=require(_0x6eab('0x5'));var Mustache=require(_0x6eab('0x6'));var util=require('util');var path=require(_0x6eab('0x7'));var sox=require(_0x6eab('0x8'));var csv=require(_0x6eab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6eab('0xa'));var _=require(_0x6eab('0xb'));var squel=require(_0x6eab('0xc'));var crypto=require(_0x6eab('0xd'));var jsforce=require(_0x6eab('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6eab('0x9'));var querystring=require(_0x6eab('0xf'));var Papa=require(_0x6eab('0x10'));var Redis=require(_0x6eab('0x11'));var authService=require(_0x6eab('0x12'));var qs=require(_0x6eab('0x13'));var as=require(_0x6eab('0x14'));var hardwareService=require(_0x6eab('0x15'));var logger=require(_0x6eab('0x16'))(_0x6eab('0x17'));var utils=require(_0x6eab('0x18'));var config=require(_0x6eab('0x19'));var licenseUtil=require(_0x6eab('0x1a'));var db=require(_0x6eab('0x1b'))['db'];config['redis']=_[_0x6eab('0x1c')](config[_0x6eab('0x1d')],{'host':_0x6eab('0x1e'),'port':0x18eb});var socket=require(_0x6eab('0x1f'))(new Redis(config[_0x6eab('0x1d')]));require(_0x6eab('0x20'))[_0x6eab('0x21')](socket);function respondWithStatusCode(_0x3257aa,_0x1a1ef4){_0x1a1ef4=_0x1a1ef4||0xcc;return function(_0x1a1fae){if(_0x1a1fae){return _0x3257aa[_0x6eab('0x22')](_0x1a1ef4);}return _0x3257aa['status'](_0x1a1ef4)[_0x6eab('0x23')]();};}function respondWithResult(_0x19d6f8,_0x2257c4){_0x2257c4=_0x2257c4||0xc8;return function(_0x489958){if(_0x489958){return _0x19d6f8[_0x6eab('0x24')](_0x2257c4)[_0x6eab('0x25')](_0x489958);}};}function respondWithFilteredResult(_0x53d48b,_0x1fba25){return function(_0x4db94a){if(_0x4db94a){var _0x5cb305=typeof _0x1fba25[_0x6eab('0x26')]===_0x6eab('0x27')&&typeof _0x1fba25[_0x6eab('0x28')]===_0x6eab('0x27');var _0xccb114=_0x4db94a[_0x6eab('0x29')];var _0x3a6196=_0x5cb305?0x0:_0x1fba25[_0x6eab('0x26')];var _0x5aa5b8=_0x5cb305?_0x4db94a[_0x6eab('0x29')]:_0x1fba25[_0x6eab('0x26')]+_0x1fba25['limit'];var _0x20cfc0;if(_0x5aa5b8>=_0xccb114){_0x5aa5b8=_0xccb114;_0x20cfc0=0xc8;}else{_0x20cfc0=0xce;}_0x53d48b[_0x6eab('0x24')](_0x20cfc0);return _0x53d48b[_0x6eab('0x2a')](_0x6eab('0x2b'),_0x3a6196+'-'+_0x5aa5b8+'/'+_0xccb114)[_0x6eab('0x25')](_0x4db94a);}return null;};}function patchUpdates(_0x52bc35){return function(_0x469301){try{jsonpatch[_0x6eab('0x2c')](_0x469301,_0x52bc35,!![]);}catch(_0x2aa348){return BPromise[_0x6eab('0x2d')](_0x2aa348);}return _0x469301[_0x6eab('0x2e')]();};}function saveUpdates(_0x16d30d,_0x7e6a52){return function(_0x5bef32){if(_0x5bef32){return _0x5bef32[_0x6eab('0x2f')](_0x16d30d)['then'](function(_0xd98f5b){return _0xd98f5b;});}return null;};}function removeEntity(_0x5955ac,_0x1d4f5a){return function(_0x499e12){if(_0x499e12){return _0x499e12[_0x6eab('0x30')]()[_0x6eab('0x31')](function(){_0x5955ac[_0x6eab('0x24')](0xcc)[_0x6eab('0x23')]();});}};}function handleEntityNotFound(_0x3e505b,_0x30c5e0){return function(_0x3fc065){if(!_0x3fc065){_0x3e505b['sendStatus'](0x194);}return _0x3fc065;};}function handleError(_0x5573ba,_0x25a2b6){_0x25a2b6=_0x25a2b6||0x1f4;return function(_0x185e41){logger['error'](_0x185e41[_0x6eab('0x32')]);if(_0x185e41[_0x6eab('0x33')]){delete _0x185e41[_0x6eab('0x33')];}_0x5573ba[_0x6eab('0x24')](_0x25a2b6)[_0x6eab('0x34')](_0x185e41);};}exports[_0x6eab('0x35')]=function(_0x792a6b,_0x41a7a2){var _0x7afe1={},_0x17b42a={},_0x5cf053={'count':0x0,'rows':[]};var _0x41f7c4=_[_0x6eab('0x36')](db[_0x6eab('0x37')][_0x6eab('0x38')],function(_0x1965ff){return{'name':_0x1965ff['fieldName'],'type':_0x1965ff[_0x6eab('0x39')]['key']};});_0x17b42a['model']=_[_0x6eab('0x36')](_0x41f7c4,_0x6eab('0x33'));_0x17b42a[_0x6eab('0x3a')]=_['keys'](_0x792a6b['query']);_0x17b42a['filters']=_['intersection'](_0x17b42a[_0x6eab('0x3b')],_0x17b42a['query']);_0x7afe1[_0x6eab('0x3c')]=_[_0x6eab('0x3d')](_0x17b42a['model'],qs[_0x6eab('0x3e')](_0x792a6b[_0x6eab('0x3a')][_0x6eab('0x3e')]));_0x7afe1['attributes']=_0x7afe1['attributes']['length']?_0x7afe1[_0x6eab('0x3c')]:_0x17b42a[_0x6eab('0x3b')];if(!_0x792a6b[_0x6eab('0x3a')][_0x6eab('0x3f')](_0x6eab('0x40'))){_0x7afe1[_0x6eab('0x28')]=qs[_0x6eab('0x28')](_0x792a6b[_0x6eab('0x3a')][_0x6eab('0x28')]);_0x7afe1['offset']=qs[_0x6eab('0x26')](_0x792a6b['query']['offset']);}_0x7afe1['order']=qs[_0x6eab('0x41')](_0x792a6b[_0x6eab('0x3a')][_0x6eab('0x41')]);_0x7afe1[_0x6eab('0x42')]=qs[_0x6eab('0x43')](_['pick'](_0x792a6b[_0x6eab('0x3a')],_0x17b42a[_0x6eab('0x43')]),_0x41f7c4);if(_0x792a6b[_0x6eab('0x3a')]['filter']){_0x7afe1['where']=_['merge'](_0x7afe1['where'],{'$or':_[_0x6eab('0x36')](_0x41f7c4,function(_0x5995b5){if(_0x5995b5[_0x6eab('0x39')]!=='VIRTUAL'){var _0x427975={};_0x427975[_0x5995b5[_0x6eab('0x33')]]={'$like':'%'+_0x792a6b[_0x6eab('0x3a')]['filter']+'%'};return _0x427975;}})});}_0x7afe1=_[_0x6eab('0x44')]({},_0x7afe1,_0x792a6b[_0x6eab('0x45')]);var _0x484166={'where':_0x7afe1[_0x6eab('0x42')]};return db['ChatGroup'][_0x6eab('0x29')](_0x484166)[_0x6eab('0x31')](function(_0x5e4826){_0x5cf053[_0x6eab('0x29')]=_0x5e4826;if(_0x792a6b[_0x6eab('0x3a')][_0x6eab('0x46')]){_0x7afe1[_0x6eab('0x47')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x7afe1);})[_0x6eab('0x31')](function(_0x3f5555){_0x5cf053[_0x6eab('0x48')]=_0x3f5555;return _0x5cf053;})['then'](respondWithFilteredResult(_0x41a7a2,_0x7afe1))[_0x6eab('0x49')](handleError(_0x41a7a2,null));};exports[_0x6eab('0x4a')]=function(_0x2f8135,_0x5d244f){var _0x547851={'raw':!![],'where':{'id':_0x2f8135[_0x6eab('0x4b')]['id']}},_0x964a4b={};_0x964a4b[_0x6eab('0x3b')]=_[_0x6eab('0x4c')](db[_0x6eab('0x37')]['rawAttributes']);_0x964a4b[_0x6eab('0x3a')]=_['keys'](_0x2f8135['query']);_0x964a4b[_0x6eab('0x43')]=_[_0x6eab('0x3d')](_0x964a4b['model'],_0x964a4b[_0x6eab('0x3a')]);_0x547851[_0x6eab('0x3c')]=_[_0x6eab('0x3d')](_0x964a4b['model'],qs[_0x6eab('0x3e')](_0x2f8135[_0x6eab('0x3a')][_0x6eab('0x3e')]));_0x547851[_0x6eab('0x3c')]=_0x547851[_0x6eab('0x3c')]['length']?_0x547851[_0x6eab('0x3c')]:_0x964a4b['model'];if(_0x2f8135[_0x6eab('0x3a')][_0x6eab('0x46')]){_0x547851[_0x6eab('0x47')]=[{'all':!![]}];}_0x547851=_[_0x6eab('0x44')]({},_0x547851,_0x2f8135[_0x6eab('0x45')]);return db[_0x6eab('0x37')][_0x6eab('0x4d')](_0x547851)['then'](handleEntityNotFound(_0x5d244f,null))[_0x6eab('0x31')](respondWithResult(_0x5d244f,null))['catch'](handleError(_0x5d244f,null));};exports[_0x6eab('0x4e')]=function(_0x1326f0,_0x1257e1){return db[_0x6eab('0x37')]['create'](_0x1326f0[_0x6eab('0x4f')],{})[_0x6eab('0x31')](respondWithResult(_0x1257e1,0xc9))[_0x6eab('0x49')](handleError(_0x1257e1,null));};exports[_0x6eab('0x2f')]=function(_0x36b0ab,_0x29dc7a){if(_0x36b0ab[_0x6eab('0x4f')]['id']){delete _0x36b0ab['body']['id'];}return db[_0x6eab('0x37')][_0x6eab('0x4d')]({'where':{'id':_0x36b0ab[_0x6eab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29dc7a,null))[_0x6eab('0x31')](saveUpdates(_0x36b0ab[_0x6eab('0x4f')],null))[_0x6eab('0x31')](respondWithResult(_0x29dc7a,null))[_0x6eab('0x49')](handleError(_0x29dc7a,null));};exports[_0x6eab('0x30')]=function(_0x2a2ad9,_0x2fd9cc){return db[_0x6eab('0x37')]['find']({'where':{'id':_0x2a2ad9['params']['id']}})['then'](handleEntityNotFound(_0x2fd9cc,null))['then'](removeEntity(_0x2fd9cc,null))['catch'](handleError(_0x2fd9cc,null));};exports[_0x6eab('0x50')]=function(_0x1f2fba,_0x5842bd){return db[_0x6eab('0x37')][_0x6eab('0x50')]()[_0x6eab('0x31')](respondWithResult(_0x5842bd,null))[_0x6eab('0x49')](handleError(_0x5842bd,null));};exports[_0x6eab('0x51')]=function(_0x19c0fb,_0x5171d5,_0x3e1ab6){return db['ChatInternalMessage'][_0x6eab('0x29')]({'where':{'ChatGroupId':_0x19c0fb[_0x6eab('0x4b')]['id'],'ToId':_0x19c0fb[_0x6eab('0x52')]['id'],'read':![]}})[_0x6eab('0x31')](function(_0x3e69d7){return{'id':_[_0x6eab('0x53')](_0x19c0fb[_0x6eab('0x4b')]['id']),'count':_0x3e69d7};})[_0x6eab('0x31')](respondWithResult(_0x5171d5,null))['catch'](handleError(_0x5171d5,null));};exports[_0x6eab('0x54')]=function(_0x322e33,_0x2b879d,_0x2c02a1){return db[_0x6eab('0x37')]['find']({'where':{'id':_0x322e33['params']['id']}})[_0x6eab('0x31')](handleEntityNotFound(_0x2b879d,null))[_0x6eab('0x31')](function(_0x271a45){if(_0x271a45){return _0x271a45[_0x6eab('0x54')](_0x322e33[_0x6eab('0x4f')][_0x6eab('0x55')],_[_0x6eab('0x56')](_0x322e33[_0x6eab('0x4f')],[_0x6eab('0x55'),'id'])||{});}})[_0x6eab('0x31')](respondWithResult(_0x2b879d,null))[_0x6eab('0x49')](handleError(_0x2b879d,null));};exports[_0x6eab('0x57')]=function(_0x5a49ef,_0xa95171,_0x31068f){var _0x5bb3a9={};var _0x38204d={};var _0x4ed0a5;var _0x1ed574;return db[_0x6eab('0x37')]['findOne']({'where':{'id':_0x5a49ef['params']['id']}})[_0x6eab('0x31')](handleEntityNotFound(_0xa95171,null))[_0x6eab('0x31')](function(_0x2ee999){if(_0x2ee999){_0x4ed0a5=_0x2ee999;_0x38204d['model']=_['keys'](db['User'][_0x6eab('0x38')]);_0x38204d[_0x6eab('0x3a')]=_['keys'](_0x5a49ef[_0x6eab('0x3a')]);_0x38204d[_0x6eab('0x43')]=_[_0x6eab('0x3d')](_0x38204d[_0x6eab('0x3b')],_0x38204d[_0x6eab('0x3a')]);_0x5bb3a9[_0x6eab('0x3c')]=_[_0x6eab('0x3d')](_0x38204d[_0x6eab('0x3b')],qs['fields'](_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x3e')]));_0x5bb3a9[_0x6eab('0x3c')]=_0x5bb3a9[_0x6eab('0x3c')]['length']?_0x5bb3a9[_0x6eab('0x3c')]:_0x38204d['model'];_0x5bb3a9['order']=qs[_0x6eab('0x41')](_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x41')]);_0x5bb3a9['where']=qs[_0x6eab('0x43')](_[_0x6eab('0x58')](_0x5a49ef[_0x6eab('0x3a')],_0x38204d[_0x6eab('0x43')]));if(_0x5a49ef[_0x6eab('0x3a')]['filter']){_0x5bb3a9[_0x6eab('0x42')]=_[_0x6eab('0x44')](_0x5bb3a9[_0x6eab('0x42')],{'$or':_[_0x6eab('0x36')](_0x5bb3a9[_0x6eab('0x3c')],function(_0x5a7871){var _0x12affb={};_0x12affb[_0x5a7871]={'$like':'%'+_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x59')]+'%'};return _0x12affb;})});}_0x5bb3a9=_['merge']({},_0x5bb3a9,_0x5a49ef[_0x6eab('0x45')]);return _0x4ed0a5[_0x6eab('0x57')](_0x5bb3a9);}})[_0x6eab('0x31')](function(_0x5772e9){if(_0x5772e9){_0x1ed574=_0x5772e9[_0x6eab('0x5a')];if(!_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x3f')]('nolimit')){_0x5bb3a9['limit']=qs[_0x6eab('0x28')](_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x28')]);_0x5bb3a9['offset']=qs['offset'](_0x5a49ef[_0x6eab('0x3a')][_0x6eab('0x26')]);}return _0x4ed0a5['getMembers'](_0x5bb3a9);}})[_0x6eab('0x31')](function(_0x1bcff1){if(_0x1bcff1){return _0x1bcff1?{'count':_0x1ed574,'rows':_0x1bcff1}:null;}})['then'](respondWithResult(_0xa95171,null))[_0x6eab('0x49')](handleError(_0xa95171,null));};exports[_0x6eab('0x5b')]=function(_0x166c3d,_0x5a9dd9,_0x2fb2ea){return db[_0x6eab('0x37')][_0x6eab('0x4d')]({'where':{'id':_0x166c3d[_0x6eab('0x4b')]['id']}})[_0x6eab('0x31')](handleEntityNotFound(_0x5a9dd9,null))[_0x6eab('0x31')](function(_0x433da9){if(_0x433da9){return _0x433da9[_0x6eab('0x5b')](_0x166c3d[_0x6eab('0x3a')][_0x6eab('0x55')]);}})[_0x6eab('0x31')](respondWithStatusCode(_0x5a9dd9,null))[_0x6eab('0x49')](handleError(_0x5a9dd9,null));};exports[_0x6eab('0x5c')]=function(_0x3caedd,_0x1da1a0,_0x4f871e){if(_0x3caedd[_0x6eab('0x4f')]['id']){delete _0x3caedd[_0x6eab('0x4f')]['id'];}return db[_0x6eab('0x37')][_0x6eab('0x4d')]({'where':{'id':_0x3caedd[_0x6eab('0x4b')]['id']}})[_0x6eab('0x31')](handleEntityNotFound(_0x1da1a0,null))[_0x6eab('0x31')](function(_0x5c9df8){if(_0x5c9df8){_0x3caedd[_0x6eab('0x4f')][_0x6eab('0x5d')]=_0x5c9df8['id'];return db[_0x6eab('0x5e')][_0x6eab('0x4e')](_0x3caedd['body']);}})[_0x6eab('0x31')](respondWithResult(_0x1da1a0,null))['catch'](handleError(_0x1da1a0,null));};exports[_0x6eab('0x5f')]=function(_0x4bd0c4,_0x167ee5,_0x4abb36){var _0x364e94={};var _0x31df06={};var _0x4d2280;var _0x426bec;return db[_0x6eab('0x37')][_0x6eab('0x60')]({'where':{'id':_0x4bd0c4[_0x6eab('0x4b')]['id']}})[_0x6eab('0x31')](handleEntityNotFound(_0x167ee5,null))['then'](function(_0x117526){if(_0x117526){_0x4d2280=_0x117526;_0x31df06[_0x6eab('0x3b')]=_[_0x6eab('0x4c')](db[_0x6eab('0x5e')][_0x6eab('0x38')]);_0x31df06['query']=_[_0x6eab('0x4c')](_0x4bd0c4['query']);_0x31df06[_0x6eab('0x43')]=_[_0x6eab('0x3d')](_0x31df06[_0x6eab('0x3b')],_0x31df06[_0x6eab('0x3a')]);_0x364e94[_0x6eab('0x3c')]=_[_0x6eab('0x3d')](_0x31df06['model'],qs[_0x6eab('0x3e')](_0x4bd0c4[_0x6eab('0x3a')][_0x6eab('0x3e')]));_0x364e94[_0x6eab('0x3c')]=_0x364e94['attributes'][_0x6eab('0x5a')]?_0x364e94['attributes']:_0x31df06[_0x6eab('0x3b')];_0x364e94[_0x6eab('0x61')]=qs['sort'](_0x4bd0c4[_0x6eab('0x3a')][_0x6eab('0x41')]);_0x364e94[_0x6eab('0x42')]=qs[_0x6eab('0x43')](_[_0x6eab('0x58')](_0x4bd0c4['query'],_0x31df06[_0x6eab('0x43')]));if(_0x4bd0c4[_0x6eab('0x3a')][_0x6eab('0x59')]){_0x364e94[_0x6eab('0x42')]=_[_0x6eab('0x44')](_0x364e94[_0x6eab('0x42')],{'$or':_[_0x6eab('0x36')](_0x364e94[_0x6eab('0x3c')],function(_0x4b05a6){var _0x2d0912={};_0x2d0912[_0x4b05a6]={'$like':'%'+_0x4bd0c4['query']['filter']+'%'};return _0x2d0912;})});}if(_0x4bd0c4['query'][_0x6eab('0x62')]){var _0x2119f2=_0x4bd0c4['query']['$gte'][_0x6eab('0x63')](',');var _0x4a21fe={};_0x4a21fe[_0x2119f2[0x0]]={'$gte':moment(_0x2119f2[0x1])['format'](_0x6eab('0x64'))};_0x364e94[_0x6eab('0x42')]=_[_0x6eab('0x44')](_0x364e94[_0x6eab('0x42')],_0x4a21fe);}_0x364e94=_[_0x6eab('0x44')]({},_0x364e94,_0x4bd0c4[_0x6eab('0x45')]);return _0x4d2280[_0x6eab('0x5f')](_0x364e94);}})['then'](function(_0x97bd81){if(_0x97bd81){_0x426bec=_0x97bd81['length'];if(!_0x4bd0c4[_0x6eab('0x3a')][_0x6eab('0x3f')]('nolimit')){_0x364e94[_0x6eab('0x28')]=qs['limit'](_0x4bd0c4[_0x6eab('0x3a')][_0x6eab('0x28')]);_0x364e94[_0x6eab('0x26')]=qs['offset'](_0x4bd0c4[_0x6eab('0x3a')]['offset']);}return _0x4d2280[_0x6eab('0x5f')](_0x364e94);}})[_0x6eab('0x31')](function(_0x3c47b4){if(_0x3c47b4){return _0x3c47b4?{'count':_0x426bec,'rows':_0x3c47b4}:null;}})['then'](respondWithResult(_0x167ee5,null))['catch'](handleError(_0x167ee5,null));}; \ No newline at end of file +var _0x91cd=['addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','type','query','keys','model','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','hasOwnProperty','removeMembers'];(function(_0x4b7e53,_0x2d02b1){var _0x5a7bd1=function(_0x42f4f6){while(--_0x42f4f6){_0x4b7e53['push'](_0x4b7e53['shift']());}};_0x5a7bd1(++_0x2d02b1);}(_0x91cd,0x176));var _0xd91c=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x91cd[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0xd91c('0x0'));var rimraf=require(_0xd91c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd91c('0x2'));var rp=require(_0xd91c('0x3'));var moment=require('moment');var BPromise=require(_0xd91c('0x4'));var Mustache=require(_0xd91c('0x5'));var util=require('util');var path=require(_0xd91c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd91c('0x7'));var _=require('lodash');var squel=require(_0xd91c('0x8'));var crypto=require(_0xd91c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd91c('0xa'));var toCsv=require(_0xd91c('0xb'));var querystring=require('querystring');var Papa=require(_0xd91c('0xc'));var Redis=require(_0xd91c('0xd'));var authService=require(_0xd91c('0xe'));var qs=require(_0xd91c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd91c('0x10'));var logger=require(_0xd91c('0x11'))(_0xd91c('0x12'));var utils=require(_0xd91c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd91c('0x14'));var db=require(_0xd91c('0x15'))['db'];config['redis']=_[_0xd91c('0x16')](config[_0xd91c('0x17')],{'host':_0xd91c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xd91c('0x19')](socket);function respondWithStatusCode(_0x1a1821,_0x45d524){_0x45d524=_0x45d524||0xcc;return function(_0x139a59){if(_0x139a59){return _0x1a1821[_0xd91c('0x1a')](_0x45d524);}return _0x1a1821['status'](_0x45d524)[_0xd91c('0x1b')]();};}function respondWithResult(_0x3b49af,_0x31eb7a){_0x31eb7a=_0x31eb7a||0xc8;return function(_0x481e27){if(_0x481e27){return _0x3b49af[_0xd91c('0x1c')](_0x31eb7a)[_0xd91c('0x1d')](_0x481e27);}};}function respondWithFilteredResult(_0x3ec5a7,_0x248511){return function(_0x1ac413){if(_0x1ac413){var _0x2b7928=typeof _0x248511[_0xd91c('0x1e')]===_0xd91c('0x1f')&&typeof _0x248511[_0xd91c('0x20')]===_0xd91c('0x1f');var _0x19bb4d=_0x1ac413[_0xd91c('0x21')];var _0x49b907=_0x2b7928?0x0:_0x248511[_0xd91c('0x1e')];var _0xbb3b6e=_0x2b7928?_0x1ac413[_0xd91c('0x21')]:_0x248511[_0xd91c('0x1e')]+_0x248511[_0xd91c('0x20')];var _0x380f1d;if(_0xbb3b6e>=_0x19bb4d){_0xbb3b6e=_0x19bb4d;_0x380f1d=0xc8;}else{_0x380f1d=0xce;}_0x3ec5a7[_0xd91c('0x1c')](_0x380f1d);return _0x3ec5a7[_0xd91c('0x22')](_0xd91c('0x23'),_0x49b907+'-'+_0xbb3b6e+'/'+_0x19bb4d)['json'](_0x1ac413);}return null;};}function patchUpdates(_0x3543df){return function(_0x3677d4){try{jsonpatch[_0xd91c('0x24')](_0x3677d4,_0x3543df,!![]);}catch(_0x1c9dd1){return BPromise[_0xd91c('0x25')](_0x1c9dd1);}return _0x3677d4[_0xd91c('0x26')]();};}function saveUpdates(_0x48c3f9,_0x3f8b4f){return function(_0x34efcc){if(_0x34efcc){return _0x34efcc[_0xd91c('0x27')](_0x48c3f9)[_0xd91c('0x28')](function(_0x583be8){return _0x583be8;});}return null;};}function removeEntity(_0x30ba14,_0xa6316d){return function(_0x39c661){if(_0x39c661){return _0x39c661[_0xd91c('0x29')]()[_0xd91c('0x28')](function(){_0x30ba14['status'](0xcc)[_0xd91c('0x1b')]();});}};}function handleEntityNotFound(_0x5e1adc,_0x3281af){return function(_0x45aa57){if(!_0x45aa57){_0x5e1adc['sendStatus'](0x194);}return _0x45aa57;};}function handleError(_0x2b8770,_0x3dbd6b){_0x3dbd6b=_0x3dbd6b||0x1f4;return function(_0x155e18){logger[_0xd91c('0x2a')](_0x155e18[_0xd91c('0x2b')]);if(_0x155e18[_0xd91c('0x2c')]){delete _0x155e18[_0xd91c('0x2c')];}_0x2b8770[_0xd91c('0x1c')](_0x3dbd6b)['send'](_0x155e18);};}exports[_0xd91c('0x2d')]=function(_0x8f06e3,_0x45de9f){var _0x436e46={},_0x14d262={},_0x592642={'count':0x0,'rows':[]};var _0x3a1760=_[_0xd91c('0x2e')](db[_0xd91c('0x2f')][_0xd91c('0x30')],function(_0x3e7f33){return{'name':_0x3e7f33['fieldName'],'type':_0x3e7f33[_0xd91c('0x31')]['key']};});_0x14d262['model']=_[_0xd91c('0x2e')](_0x3a1760,'name');_0x14d262[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x8f06e3[_0xd91c('0x32')]);_0x14d262['filters']=_['intersection'](_0x14d262[_0xd91c('0x34')],_0x14d262['query']);_0x436e46[_0xd91c('0x35')]=_[_0xd91c('0x36')](_0x14d262[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x8f06e3[_0xd91c('0x32')]['fields']));_0x436e46[_0xd91c('0x35')]=_0x436e46[_0xd91c('0x35')][_0xd91c('0x38')]?_0x436e46[_0xd91c('0x35')]:_0x14d262['model'];if(!_0x8f06e3['query']['hasOwnProperty']('nolimit')){_0x436e46[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x20')]);_0x436e46['offset']=qs[_0xd91c('0x1e')](_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x1e')]);}_0x436e46[_0xd91c('0x39')]=qs[_0xd91c('0x3a')](_0x8f06e3[_0xd91c('0x32')]['sort']);_0x436e46[_0xd91c('0x3b')]=qs[_0xd91c('0x3c')](_[_0xd91c('0x3d')](_0x8f06e3['query'],_0x14d262[_0xd91c('0x3c')]),_0x3a1760);if(_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x436e46[_0xd91c('0x3b')]=_[_0xd91c('0x3f')](_0x436e46[_0xd91c('0x3b')],{'$or':_['map'](_0x3a1760,function(_0x4a86d5){if(_0x4a86d5['type']!=='VIRTUAL'){var _0x2b037d={};_0x2b037d[_0x4a86d5['name']]={'$like':'%'+_0x8f06e3['query']['filter']+'%'};return _0x2b037d;}})});}_0x436e46=_[_0xd91c('0x3f')]({},_0x436e46,_0x8f06e3[_0xd91c('0x40')]);var _0x2dac74={'where':_0x436e46['where']};return db[_0xd91c('0x2f')][_0xd91c('0x21')](_0x2dac74)[_0xd91c('0x28')](function(_0x38ce51){_0x592642[_0xd91c('0x21')]=_0x38ce51;if(_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x41')]){_0x436e46[_0xd91c('0x42')]=[{'all':!![]}];}return db[_0xd91c('0x2f')]['findAll'](_0x436e46);})['then'](function(_0x1408c4){_0x592642[_0xd91c('0x43')]=_0x1408c4;return _0x592642;})[_0xd91c('0x28')](respondWithFilteredResult(_0x45de9f,_0x436e46))['catch'](handleError(_0x45de9f,null));};exports[_0xd91c('0x44')]=function(_0x2373e4,_0xfc2f9f){var _0x1584d9={'raw':!![],'where':{'id':_0x2373e4[_0xd91c('0x45')]['id']}},_0x47cdf9={};_0x47cdf9[_0xd91c('0x34')]=_[_0xd91c('0x33')](db[_0xd91c('0x2f')][_0xd91c('0x30')]);_0x47cdf9[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x2373e4[_0xd91c('0x32')]);_0x47cdf9[_0xd91c('0x3c')]=_[_0xd91c('0x36')](_0x47cdf9[_0xd91c('0x34')],_0x47cdf9['query']);_0x1584d9[_0xd91c('0x35')]=_[_0xd91c('0x36')](_0x47cdf9[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x2373e4[_0xd91c('0x32')][_0xd91c('0x37')]));_0x1584d9[_0xd91c('0x35')]=_0x1584d9[_0xd91c('0x35')][_0xd91c('0x38')]?_0x1584d9[_0xd91c('0x35')]:_0x47cdf9[_0xd91c('0x34')];if(_0x2373e4[_0xd91c('0x32')]['includeAll']){_0x1584d9['include']=[{'all':!![]}];}_0x1584d9=_[_0xd91c('0x3f')]({},_0x1584d9,_0x2373e4['options']);return db['ChatGroup'][_0xd91c('0x46')](_0x1584d9)[_0xd91c('0x28')](handleEntityNotFound(_0xfc2f9f,null))[_0xd91c('0x28')](respondWithResult(_0xfc2f9f,null))[_0xd91c('0x47')](handleError(_0xfc2f9f,null));};exports[_0xd91c('0x48')]=function(_0x336c73,_0x207690){return db[_0xd91c('0x2f')][_0xd91c('0x48')](_0x336c73[_0xd91c('0x49')],{})['then'](respondWithResult(_0x207690,0xc9))[_0xd91c('0x47')](handleError(_0x207690,null));};exports[_0xd91c('0x27')]=function(_0x636151,_0x32d8bf){if(_0x636151[_0xd91c('0x49')]['id']){delete _0x636151[_0xd91c('0x49')]['id'];}return db[_0xd91c('0x2f')][_0xd91c('0x46')]({'where':{'id':_0x636151['params']['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x32d8bf,null))[_0xd91c('0x28')](saveUpdates(_0x636151[_0xd91c('0x49')],null))[_0xd91c('0x28')](respondWithResult(_0x32d8bf,null))[_0xd91c('0x47')](handleError(_0x32d8bf,null));};exports[_0xd91c('0x29')]=function(_0x3fac39,_0x1957d7){return db['ChatGroup'][_0xd91c('0x46')]({'where':{'id':_0x3fac39[_0xd91c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1957d7,null))['then'](removeEntity(_0x1957d7,null))[_0xd91c('0x47')](handleError(_0x1957d7,null));};exports[_0xd91c('0x4a')]=function(_0x234266,_0xa1d8c2){return db[_0xd91c('0x2f')][_0xd91c('0x4a')]()['then'](respondWithResult(_0xa1d8c2,null))[_0xd91c('0x47')](handleError(_0xa1d8c2,null));};exports[_0xd91c('0x4b')]=function(_0xd4a8d5,_0x4d0c9a,_0x1eb59b){return db[_0xd91c('0x4c')][_0xd91c('0x21')]({'where':{'ChatGroupId':_0xd4a8d5['params']['id'],'ToId':_0xd4a8d5[_0xd91c('0x4d')]['id'],'read':![]}})[_0xd91c('0x28')](function(_0x75a0eb){return{'id':_[_0xd91c('0x4e')](_0xd4a8d5['params']['id']),'count':_0x75a0eb};})['then'](respondWithResult(_0x4d0c9a,null))['catch'](handleError(_0x4d0c9a,null));};exports[_0xd91c('0x4f')]=function(_0x5832cf,_0x2e2ef9,_0x30568f){return db['ChatGroup']['find']({'where':{'id':_0x5832cf[_0xd91c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e2ef9,null))[_0xd91c('0x28')](function(_0x537580){if(_0x537580){return _0x537580[_0xd91c('0x4f')](_0x5832cf[_0xd91c('0x49')]['ids'],_[_0xd91c('0x50')](_0x5832cf['body'],[_0xd91c('0x51'),'id'])||{});}})[_0xd91c('0x28')](respondWithResult(_0x2e2ef9,null))['catch'](handleError(_0x2e2ef9,null));};exports[_0xd91c('0x52')]=function(_0x479924,_0x4cf8fd,_0x382161){var _0x900bcc={};var _0xe738e9={};var _0x135c47;var _0x1424b6;return db[_0xd91c('0x2f')][_0xd91c('0x53')]({'where':{'id':_0x479924[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x4cf8fd,null))['then'](function(_0x290296){if(_0x290296){_0x135c47=_0x290296;_0xe738e9[_0xd91c('0x34')]=_['keys'](db['User'][_0xd91c('0x30')]);_0xe738e9[_0xd91c('0x32')]=_['keys'](_0x479924[_0xd91c('0x32')]);_0xe738e9['filters']=_[_0xd91c('0x36')](_0xe738e9['model'],_0xe738e9[_0xd91c('0x32')]);_0x900bcc[_0xd91c('0x35')]=_['intersection'](_0xe738e9[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x479924['query']['fields']));_0x900bcc[_0xd91c('0x35')]=_0x900bcc['attributes'][_0xd91c('0x38')]?_0x900bcc[_0xd91c('0x35')]:_0xe738e9[_0xd91c('0x34')];_0x900bcc[_0xd91c('0x39')]=qs[_0xd91c('0x3a')](_0x479924[_0xd91c('0x32')][_0xd91c('0x3a')]);_0x900bcc['where']=qs['filters'](_[_0xd91c('0x3d')](_0x479924[_0xd91c('0x32')],_0xe738e9[_0xd91c('0x3c')]));if(_0x479924[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x900bcc['where']=_[_0xd91c('0x3f')](_0x900bcc[_0xd91c('0x3b')],{'$or':_[_0xd91c('0x2e')](_0x900bcc[_0xd91c('0x35')],function(_0x225f3e){var _0x11e8e7={};_0x11e8e7[_0x225f3e]={'$like':'%'+_0x479924[_0xd91c('0x32')][_0xd91c('0x3e')]+'%'};return _0x11e8e7;})});}_0x900bcc=_[_0xd91c('0x3f')]({},_0x900bcc,_0x479924['options']);return _0x135c47[_0xd91c('0x52')](_0x900bcc);}})[_0xd91c('0x28')](function(_0x58330d){if(_0x58330d){_0x1424b6=_0x58330d[_0xd91c('0x38')];if(!_0x479924[_0xd91c('0x32')][_0xd91c('0x54')]('nolimit')){_0x900bcc[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x479924[_0xd91c('0x32')][_0xd91c('0x20')]);_0x900bcc[_0xd91c('0x1e')]=qs[_0xd91c('0x1e')](_0x479924['query'][_0xd91c('0x1e')]);}return _0x135c47['getMembers'](_0x900bcc);}})[_0xd91c('0x28')](function(_0x3b5e34){if(_0x3b5e34){return _0x3b5e34?{'count':_0x1424b6,'rows':_0x3b5e34}:null;}})['then'](respondWithResult(_0x4cf8fd,null))['catch'](handleError(_0x4cf8fd,null));};exports['removeMembers']=function(_0x27d48c,_0x533e70,_0x2ce9e5){return db[_0xd91c('0x2f')]['find']({'where':{'id':_0x27d48c[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x533e70,null))[_0xd91c('0x28')](function(_0x710e2a){if(_0x710e2a){return _0x710e2a[_0xd91c('0x55')](_0x27d48c['query'][_0xd91c('0x51')]);}})[_0xd91c('0x28')](respondWithStatusCode(_0x533e70,null))['catch'](handleError(_0x533e70,null));};exports[_0xd91c('0x56')]=function(_0x551440,_0x3596fc,_0x57a87b){if(_0x551440[_0xd91c('0x49')]['id']){delete _0x551440[_0xd91c('0x49')]['id'];}return db[_0xd91c('0x2f')]['find']({'where':{'id':_0x551440[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x3596fc,null))[_0xd91c('0x28')](function(_0x3d9afe){if(_0x3d9afe){_0x551440[_0xd91c('0x49')]['ChatGroupId']=_0x3d9afe['id'];return db[_0xd91c('0x4c')][_0xd91c('0x48')](_0x551440[_0xd91c('0x49')]);}})[_0xd91c('0x28')](respondWithResult(_0x3596fc,null))['catch'](handleError(_0x3596fc,null));};exports[_0xd91c('0x57')]=function(_0x14a291,_0x2591b0,_0x11c6a8){var _0x2fa4cb={};var _0x4c789c={};var _0x3b36ac;var _0x4a9275;return db[_0xd91c('0x2f')][_0xd91c('0x53')]({'where':{'id':_0x14a291[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x2591b0,null))[_0xd91c('0x28')](function(_0x295208){if(_0x295208){_0x3b36ac=_0x295208;_0x4c789c['model']=_[_0xd91c('0x33')](db[_0xd91c('0x4c')][_0xd91c('0x30')]);_0x4c789c[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x14a291[_0xd91c('0x32')]);_0x4c789c[_0xd91c('0x3c')]=_[_0xd91c('0x36')](_0x4c789c['model'],_0x4c789c[_0xd91c('0x32')]);_0x2fa4cb[_0xd91c('0x35')]=_['intersection'](_0x4c789c[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x14a291[_0xd91c('0x32')]['fields']));_0x2fa4cb[_0xd91c('0x35')]=_0x2fa4cb['attributes']['length']?_0x2fa4cb[_0xd91c('0x35')]:_0x4c789c['model'];_0x2fa4cb[_0xd91c('0x39')]=qs['sort'](_0x14a291['query']['sort']);_0x2fa4cb[_0xd91c('0x3b')]=qs[_0xd91c('0x3c')](_[_0xd91c('0x3d')](_0x14a291[_0xd91c('0x32')],_0x4c789c['filters']));if(_0x14a291['query'][_0xd91c('0x3e')]){_0x2fa4cb[_0xd91c('0x3b')]=_['merge'](_0x2fa4cb['where'],{'$or':_[_0xd91c('0x2e')](_0x2fa4cb[_0xd91c('0x35')],function(_0x3c80a1){var _0x2425c3={};_0x2425c3[_0x3c80a1]={'$like':'%'+_0x14a291[_0xd91c('0x32')]['filter']+'%'};return _0x2425c3;})});}if(_0x14a291[_0xd91c('0x32')][_0xd91c('0x58')]){var _0x15ba76=_0x14a291['query'][_0xd91c('0x58')]['split'](',');var _0x5bf6f1={};_0x5bf6f1[_0x15ba76[0x0]]={'$gte':moment(_0x15ba76[0x1])[_0xd91c('0x59')](_0xd91c('0x5a'))};_0x2fa4cb[_0xd91c('0x3b')]=_['merge'](_0x2fa4cb[_0xd91c('0x3b')],_0x5bf6f1);}_0x2fa4cb=_[_0xd91c('0x3f')]({},_0x2fa4cb,_0x14a291['options']);return _0x3b36ac['getMessages'](_0x2fa4cb);}})[_0xd91c('0x28')](function(_0xcbc636){if(_0xcbc636){_0x4a9275=_0xcbc636[_0xd91c('0x38')];if(!_0x14a291[_0xd91c('0x32')]['hasOwnProperty'](_0xd91c('0x5b'))){_0x2fa4cb[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x14a291[_0xd91c('0x32')][_0xd91c('0x20')]);_0x2fa4cb[_0xd91c('0x1e')]=qs[_0xd91c('0x1e')](_0x14a291[_0xd91c('0x32')]['offset']);}return _0x3b36ac[_0xd91c('0x57')](_0x2fa4cb);}})[_0xd91c('0x28')](function(_0x2de048){if(_0x2de048){return _0x2de048?{'count':_0x4a9275,'rows':_0x2de048}:null;}})['then'](respondWithResult(_0x2591b0,null))[_0xd91c('0x47')](handleError(_0x2591b0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 79f554b..71bda71 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 _0x85ed=['exports','events','save','update','remove','hook'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x85ed,0x1e7));var _0xd85e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x85ed[_0x45b034];return _0x509cb0;};'use strict';var EventEmitter=require(_0xd85e('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd85e('0x1'),'afterUpdate':_0xd85e('0x2'),'afterDestroy':_0xd85e('0x3')};function emitEvent(_0xeb1bf9){return function(_0x2ddd68,_0x5178b6,_0x3d70d5){ChatGroupEvents['emit'](_0xeb1bf9+':'+_0x2ddd68['id'],_0x2ddd68);ChatGroupEvents['emit'](_0xeb1bf9,_0x2ddd68);_0x3d70d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xd85e('0x4')](e,emitEvent(event));}}module[_0xd85e('0x5')]=ChatGroupEvents; \ No newline at end of file +var _0x228d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove'];(function(_0x546ce7,_0x135234){var _0x1e1530=function(_0x4459f6){while(--_0x4459f6){_0x546ce7['push'](_0x546ce7['shift']());}};_0x1e1530(++_0x135234);}(_0x228d,0xfe));var _0xd228=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x228d[_0xea46d];return _0x1fa4c5;};'use strict';var EventEmitter=require(_0xd228('0x0'));var ChatGroup=require(_0xd228('0x1'))['db'][_0xd228('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd228('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd228('0x4'),'afterDestroy':_0xd228('0x5')};function emitEvent(_0xa06a3f){return function(_0x560ad1,_0x42172b,_0x2c9e33){ChatGroupEvents[_0xd228('0x6')](_0xa06a3f+':'+_0x560ad1['id'],_0x560ad1);ChatGroupEvents[_0xd228('0x6')](_0xa06a3f,_0x560ad1);_0x2c9e33(null);};}for(var e in events){if(events[_0xd228('0x7')](e)){var event=events[e];ChatGroup[_0xd228('0x8')](e,emitEvent(event));}}module[_0xd228('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 09d96c8..4014e7e 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 _0x21e2=['ChatGroup','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x21e2,0x77));var _0x221e=function(_0x49a1e5,_0xe640ba){_0x49a1e5=_0x49a1e5-0x0;var _0x184230=_0x21e2[_0x49a1e5];return _0x184230;};'use strict';var _=require(_0x221e('0x0'));var util=require(_0x221e('0x1'));var logger=require(_0x221e('0x2'))('api');var moment=require(_0x221e('0x3'));var BPromise=require(_0x221e('0x4'));var rp=require(_0x221e('0x5'));var fs=require('fs');var path=require(_0x221e('0x6'));var rimraf=require(_0x221e('0x7'));var config=require(_0x221e('0x8'));var attributes=require(_0x221e('0x9'));module[_0x221e('0xa')]=function(_0x1de45f,_0x54d35c){return _0x1de45f['define'](_0x221e('0xb'),attributes,{'tableName':_0x221e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bfa=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api'];(function(_0x4b009d,_0x2817e3){var _0x77ff93=function(_0x5228af){while(--_0x5228af){_0x4b009d['push'](_0x4b009d['shift']());}};_0x77ff93(++_0x2817e3);}(_0x8bfa,0xfa));var _0xa8bf=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8bfa[_0x33554b];return _0x256954;};'use strict';var _=require('lodash');var util=require(_0xa8bf('0x0'));var logger=require(_0xa8bf('0x1'))(_0xa8bf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa8bf('0x3'));var fs=require('fs');var path=require(_0xa8bf('0x4'));var rimraf=require('rimraf');var config=require(_0xa8bf('0x5'));var attributes=require(_0xa8bf('0x6'));module[_0xa8bf('0x7')]=function(_0x4d2fe2,_0x3953c6){return _0x4d2fe2[_0xa8bf('0x8')](_0xa8bf('0x9'),attributes,{'tableName':_0xa8bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index d0261fd..6b9b38d 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 _0xa400=['client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x5500e6,_0x614a4f){var _0x72373b=function(_0x3e3c54){while(--_0x3e3c54){_0x5500e6['push'](_0x5500e6['shift']());}};_0x72373b(++_0x614a4f);}(_0xa400,0xc1));var _0x0a40=function(_0x36a94d,_0x2f8299){_0x36a94d=_0x36a94d-0x0;var _0x1aa6ec=_0xa400[_0x36a94d];return _0x1aa6ec;};'use strict';var _=require(_0x0a40('0x0'));var util=require(_0x0a40('0x1'));var moment=require(_0x0a40('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a40('0x3'))['db'];var utils=require(_0x0a40('0x4'));var logger=require('../../config/logger')(_0x0a40('0x5'));var config=require('../../config/environment');var jayson=require(_0x0a40('0x6'));var client=jayson[_0x0a40('0x7')][_0x0a40('0x8')]({'port':0x232a});config[_0x0a40('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a40('0xa'))(new Redis(config[_0x0a40('0x9')]));require(_0x0a40('0xb'))[_0x0a40('0xc')](socket);function respondWithRpcPromise(_0x2495e8,_0x1dc503,_0x229a1f){return new BPromise(function(_0x1f639b,_0x3cc137){return client[_0x0a40('0xd')](_0x2495e8,_0x229a1f)[_0x0a40('0xe')](function(_0x38c13d){logger[_0x0a40('0xf')](_0x0a40('0x10'),_0x1dc503,_0x0a40('0x11'));logger[_0x0a40('0x12')](_0x0a40('0x13'),_0x1dc503,'request\x20sent',JSON['stringify'](_0x38c13d));if(_0x38c13d['error']){if(_0x38c13d[_0x0a40('0x14')][_0x0a40('0x15')]===0x1f4){logger['error'](_0x0a40('0x10'),_0x1dc503,_0x38c13d['error'][_0x0a40('0x16')]);return _0x3cc137(_0x38c13d[_0x0a40('0x14')]['message']);}logger[_0x0a40('0x14')](_0x0a40('0x10'),_0x1dc503,_0x38c13d[_0x0a40('0x14')]['message']);return _0x1f639b(_0x38c13d['error'][_0x0a40('0x16')]);}else{logger[_0x0a40('0xf')](_0x0a40('0x10'),_0x1dc503,_0x0a40('0x11'));_0x1f639b(_0x38c13d[_0x0a40('0x17')]['message']);}})[_0x0a40('0x18')](function(_0x445905){logger[_0x0a40('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1dc503,_0x445905);_0x3cc137(_0x445905);});});} \ No newline at end of file +var _0xb2b5=['result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x30ae7b,_0x3a718f){var _0xa9d0cf=function(_0x8102a1){while(--_0x8102a1){_0x30ae7b['push'](_0x30ae7b['shift']());}};_0xa9d0cf(++_0x3a718f);}(_0xb2b5,0xa3));var _0x5b2b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb2b5[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b2b('0x0'));var fs=require('fs');var Redis=require(_0x5b2b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b2b('0x2'))(_0x5b2b('0x3'));var config=require(_0x5b2b('0x4'));var jayson=require(_0x5b2b('0x5'));var client=jayson['client'][_0x5b2b('0x6')]({'port':0x232a});config[_0x5b2b('0x7')]=_['defaults'](config['redis'],{'host':_0x5b2b('0x8'),'port':0x18eb});var socket=require(_0x5b2b('0x9'))(new Redis(config[_0x5b2b('0x7')]));require(_0x5b2b('0xa'))[_0x5b2b('0xb')](socket);function respondWithRpcPromise(_0x29d7be,_0x15425f,_0xa39fc6){return new BPromise(function(_0x52675e,_0x56c260){return client[_0x5b2b('0xc')](_0x29d7be,_0xa39fc6)['then'](function(_0x1290ed){logger[_0x5b2b('0xd')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x5b2b('0xe'));logger[_0x5b2b('0xf')](_0x5b2b('0x10'),_0x15425f,_0x5b2b('0xe'),JSON[_0x5b2b('0x11')](_0x1290ed));if(_0x1290ed[_0x5b2b('0x12')]){if(_0x1290ed[_0x5b2b('0x12')]['code']===0x1f4){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);return _0x56c260(_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);}logger['error'](_0x5b2b('0x14'),_0x15425f,_0x1290ed['error'][_0x5b2b('0x13')]);return _0x52675e(_0x1290ed['error']['message']);}else{logger[_0x5b2b('0xd')](_0x5b2b('0x14'),_0x15425f,'request\x20sent');_0x52675e(_0x1290ed[_0x5b2b('0x15')][_0x5b2b('0x13')]);}})[_0x5b2b('0x16')](function(_0xce3474){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0xce3474);_0x56c260(_0xce3474);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6acbaab..fb0c752 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 _0x6158=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x107f31,_0x1bcd53){var _0x10560c=function(_0x5e1fc4){while(--_0x5e1fc4){_0x107f31['push'](_0x107f31['shift']());}};_0x10560c(++_0x1bcd53);}(_0x6158,0x14a));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x8615('0x0'));var events=[_0x8615('0x1'),_0x8615('0x2'),_0x8615('0x3')];function createListener(_0x3c10dc,_0x2abebc){return function(_0x6a294d){_0x2abebc[_0x8615('0x4')](_0x3c10dc,_0x6a294d);};}function removeListener(_0x317c9b,_0x479275){return function(){ChatGroupEvents[_0x8615('0x5')](_0x317c9b,_0x479275);};}exports[_0x8615('0x6')]=function(_0x626896){for(var _0xced9a=0x0,_0x3d9380=events[_0x8615('0x7')];_0xced9a<_0x3d9380;_0xced9a++){var _0xb3c75e=events[_0xced9a];var _0x1b2e7f=createListener(_0x8615('0x8')+_0xb3c75e,_0x626896);ChatGroupEvents['on'](_0xb3c75e,_0x1b2e7f);}}; \ No newline at end of file +var _0xa314=['length','chatGroup:','./chatGroup.events','save','removeListener','register'];(function(_0x4c6500,_0xba0326){var _0x7fe60d=function(_0x436843){while(--_0x436843){_0x4c6500['push'](_0x4c6500['shift']());}};_0x7fe60d(++_0xba0326);}(_0xa314,0x152));var _0x4a31=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xa314[_0x81f000];return _0x337aa2;};'use strict';var ChatGroupEvents=require(_0x4a31('0x0'));var events=[_0x4a31('0x1'),'remove','update'];function createListener(_0x465004,_0x37e8d0){return function(_0x2ce6e9){_0x37e8d0['emit'](_0x465004,_0x2ce6e9);};}function removeListener(_0x4b57c9,_0x52c8e3){return function(){ChatGroupEvents[_0x4a31('0x2')](_0x4b57c9,_0x52c8e3);};}exports[_0x4a31('0x3')]=function(_0x5220b9){for(var _0x1edc49=0x0,_0x55c39d=events[_0x4a31('0x4')];_0x1edc49<_0x55c39d;_0x1edc49++){var _0x33e9ff=events[_0x1edc49];var _0x2816e9=createListener(_0x4a31('0x5')+_0x33e9ff,_0x5220b9);ChatGroupEvents['on'](_0x33e9ff,_0x2816e9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index cc31b9c..648acea 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 _0xf05f=['/:id/members','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post'];(function(_0x55c76a,_0x247eba){var _0x1e940c=function(_0x4c5f41){while(--_0x4c5f41){_0x55c76a['push'](_0x55c76a['shift']());}};_0x1e940c(++_0x247eba);}(_0xf05f,0x7c));var _0xff05=function(_0x4ed178,_0x253c5a){_0x4ed178=_0x4ed178-0x0;var _0x24d1ee=_0xf05f[_0x4ed178];return _0x24d1ee;};'use strict';var multer=require(_0xff05('0x0'));var util=require(_0xff05('0x1'));var path=require(_0xff05('0x2'));var timeout=require('connect-timeout');var express=require(_0xff05('0x3'));var router=express['Router']();var fs_extra=require(_0xff05('0x4'));var auth=require(_0xff05('0x5'));var interaction=require(_0xff05('0x6'));var config=require(_0xff05('0x7'));var controller=require(_0xff05('0x8'));router[_0xff05('0x9')]('/',auth[_0xff05('0xa')](),controller[_0xff05('0xb')]);router[_0xff05('0x9')](_0xff05('0xc'),auth[_0xff05('0xa')](),controller[_0xff05('0xd')]);router[_0xff05('0x9')](_0xff05('0xe'),auth[_0xff05('0xa')](),controller[_0xff05('0xf')]);router[_0xff05('0x9')]('/:id/unread',auth[_0xff05('0xa')](),controller[_0xff05('0x10')]);router[_0xff05('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xff05('0x11')]);router[_0xff05('0x9')](_0xff05('0x12'),auth[_0xff05('0xa')](),controller[_0xff05('0x13')]);router[_0xff05('0x14')]('/',auth[_0xff05('0xa')](),controller['create']);router[_0xff05('0x14')](_0xff05('0x15'),auth[_0xff05('0xa')](),controller[_0xff05('0x16')]);router[_0xff05('0x14')](_0xff05('0x12'),auth[_0xff05('0xa')](),controller['addMessage']);router[_0xff05('0x17')](_0xff05('0xe'),auth[_0xff05('0xa')](),controller[_0xff05('0x18')]);router[_0xff05('0x19')](_0xff05('0xe'),auth[_0xff05('0xa')](),controller[_0xff05('0x1a')]);router[_0xff05('0x19')](_0xff05('0x15'),auth['isAuthenticated'](),controller[_0xff05('0x1b')]);module[_0xff05('0x1c')]=router; \ No newline at end of file +var _0x7957=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','update','delete','removeMembers','exports','multer','path','connect-timeout','express','Router'];(function(_0x3a1e38,_0x978148){var _0x370473=function(_0x53975e){while(--_0x53975e){_0x3a1e38['push'](_0x3a1e38['shift']());}};_0x370473(++_0x978148);}(_0x7957,0x8c));var _0x7795=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x7957[_0x21205e];return _0x136ebb;};'use strict';var multer=require(_0x7795('0x0'));var util=require('util');var path=require(_0x7795('0x1'));var timeout=require(_0x7795('0x2'));var express=require(_0x7795('0x3'));var router=express[_0x7795('0x4')]();var fs_extra=require(_0x7795('0x5'));var auth=require(_0x7795('0x6'));var interaction=require(_0x7795('0x7'));var config=require('../../config/environment');var controller=require(_0x7795('0x8'));router['get']('/',auth[_0x7795('0x9')](),controller[_0x7795('0xa')]);router[_0x7795('0xb')](_0x7795('0xc'),auth[_0x7795('0x9')](),controller[_0x7795('0xd')]);router['get'](_0x7795('0xe'),auth['isAuthenticated'](),controller[_0x7795('0xf')]);router[_0x7795('0xb')](_0x7795('0x10'),auth[_0x7795('0x9')](),controller[_0x7795('0x11')]);router['get'](_0x7795('0x12'),auth[_0x7795('0x9')](),controller[_0x7795('0x13')]);router[_0x7795('0xb')](_0x7795('0x14'),auth[_0x7795('0x9')](),controller[_0x7795('0x15')]);router['post']('/',auth[_0x7795('0x9')](),controller[_0x7795('0x16')]);router[_0x7795('0x17')]('/:id/members',auth[_0x7795('0x9')](),controller[_0x7795('0x18')]);router['post'](_0x7795('0x14'),auth[_0x7795('0x9')](),controller['addMessage']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7795('0x19')]);router[_0x7795('0x1a')](_0x7795('0xe'),auth[_0x7795('0x9')](),controller['destroy']);router[_0x7795('0x1a')](_0x7795('0x12'),auth[_0x7795('0x9')](),controller[_0x7795('0x1b')]);module[_0x7795('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2c5f8df..c8a6692 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 _0xbc87=['sequelize','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out'];(function(_0x290c30,_0x27584b){var _0x573cf9=function(_0x428783){while(--_0x428783){_0x290c30['push'](_0x290c30['shift']());}};_0x573cf9(++_0x27584b);}(_0xbc87,0x144));var _0x7bc8=function(_0x1aa4ba,_0x3ca443){_0x1aa4ba=_0x1aa4ba-0x0;var _0xd4f238=_0xbc87[_0x1aa4ba];return _0xd4f238;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7bc8('0x1')]},'ratingType':{'type':Sequelize[_0x7bc8('0x2')](_0x7bc8('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7bc8('0x4')]},'pathTranscript':{'type':Sequelize[_0x7bc8('0x4')]},'mailTranscript':{'type':Sequelize[_0x7bc8('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7bc8('0x6')]},'disposition':{'type':Sequelize[_0x7bc8('0x5')]},'secondDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'note':{'type':Sequelize[_0x7bc8('0x5')]},'browserName':{'type':Sequelize[_0x7bc8('0x5')]},'browserVersion':{'type':Sequelize[_0x7bc8('0x5')]},'osName':{'type':Sequelize[_0x7bc8('0x5')]},'osVersion':{'type':Sequelize[_0x7bc8('0x5')]},'deviceModel':{'type':Sequelize[_0x7bc8('0x5')]},'deviceVendor':{'type':Sequelize[_0x7bc8('0x5')]},'deviceType':{'type':Sequelize[_0x7bc8('0x5')]},'referer':{'type':Sequelize[_0x7bc8('0x4')]},'customerIp':{'type':Sequelize[_0x7bc8('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x7bc8('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7bc8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7bc8('0x2')]('in',_0x7bc8('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7bc8('0x5')]},'customerPort':{'type':Sequelize[_0x7bc8('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x7bc8('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xba5a=['star','TEXT','STRING','long','DATE','exports','BOOLEAN','INTEGER','thumb'];(function(_0x178611,_0x5a2987){var _0x5454f5=function(_0x93af96){while(--_0x93af96){_0x178611['push'](_0x178611['shift']());}};_0x5454f5(++_0x5a2987);}(_0xba5a,0x1d0));var _0xaba5=function(_0x3cd133,_0x222fcb){_0x3cd133=_0x3cd133-0x0;var _0x2512c8=_0xba5a[_0x3cd133];return _0x2512c8;};'use strict';var Sequelize=require('sequelize');module[_0xaba5('0x0')]={'closed':{'type':Sequelize[_0xaba5('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xaba5('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xaba5('0x3')),'defaultValue':_0xaba5('0x4')},'ratingMessage':{'type':Sequelize[_0xaba5('0x5')]},'pathTranscript':{'type':Sequelize[_0xaba5('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaba5('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xaba5('0x6')]},'browserName':{'type':Sequelize[_0xaba5('0x6')]},'browserVersion':{'type':Sequelize[_0xaba5('0x6')]},'osName':{'type':Sequelize[_0xaba5('0x6')]},'osVersion':{'type':Sequelize[_0xaba5('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xaba5('0x6')]},'deviceType':{'type':Sequelize[_0xaba5('0x6')]},'referer':{'type':Sequelize[_0xaba5('0x5')]},'customerIp':{'type':Sequelize[_0xaba5('0x6')]},'formData':{'type':Sequelize[_0xaba5('0x5')](_0xaba5('0x7'))},'read1stAt':{'type':Sequelize[_0xaba5('0x8')]},'lastMsgAt':{'type':Sequelize[_0xaba5('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xaba5('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xaba5('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index fdca4e0..d8781db 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 _0x153f=['sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','setTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','secret','read','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','render','merge','contact','agent','interaction','account','Users','map','TagIds','split','Tags','push','catch','waiting','talking','answered','unmanaged','closed','UserId','disposition','abandoned','total','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','params','fields','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','isNull','vidaooMetadata','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail'];(function(_0x1619c1,_0x21b9fd){var _0x424d3f=function(_0x388463){while(--_0x388463){_0x1619c1['push'](_0x1619c1['shift']());}};_0x424d3f(++_0x21b9fd);}(_0x153f,0x15b));var _0xf153=function(_0xf921b3,_0x27ab6b){_0xf921b3=_0xf921b3-0x0;var _0xbe2b38=_0x153f[_0xf921b3];return _0xbe2b38;};'use strict';var rimraf=require(_0xf153('0x0'));var zipdir=require(_0xf153('0x1'));var rp=require(_0xf153('0x2'));var moment=require(_0xf153('0x3'));var BPromise=require(_0xf153('0x4'));var Mustache=require(_0xf153('0x5'));var util=require(_0xf153('0x6'));var path=require('path');var ejs=require(_0xf153('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf153('0x8'));var Redis=require(_0xf153('0x9'));var qs=require(_0xf153('0xa'));var as=require(_0xf153('0xb'));var pdf=require(_0xf153('0xc'));var logger=require('../../config/logger')(_0xf153('0xd'));var config=require(_0xf153('0xe'));var db=require(_0xf153('0xf'))['db'];config[_0xf153('0x10')]=_[_0xf153('0x11')](config[_0xf153('0x10')],{'host':_0xf153('0x12'),'port':0x18eb});var socket=require(_0xf153('0x13'))(new Redis(config[_0xf153('0x10')]));require(_0xf153('0x14'))['register'](socket);var jayson=require(_0xf153('0x15'));var client=jayson[_0xf153('0x16')][_0xf153('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xf153('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x292f89,_0x65756d,_0x1cc666,_0x256b7d){return new BPromise(function(_0x107d31,_0x3f915c){var _0x1d54c4=_0x256b7d||client;return _0x1d54c4[_0xf153('0x18')](_0x292f89,_0x1cc666)['then'](function(_0x18be7e){logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));logger[_0xf153('0x1c')](_0xf153('0x1d'),_0x65756d,_0xf153('0x1b'),JSON[_0xf153('0x1e')](_0x18be7e));if(_0x18be7e['error']){if(_0x18be7e[_0xf153('0x1f')]['code']===0x1f4){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x3f915c(_0x18be7e['error'][_0xf153('0x20')]);}logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x107d31(_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);}else{logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));_0x107d31(_0x18be7e[_0xf153('0x21')][_0xf153('0x20')]);}})['catch'](function(_0xcd5762){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0xcd5762);_0x3f915c(_0xcd5762);});});}function respondWithStatusCode(_0x32e759,_0x5c9f44){_0x5c9f44=_0x5c9f44||0xcc;return function(_0x3e94b5){if(_0x3e94b5){return _0x32e759[_0xf153('0x22')](_0x5c9f44);}return _0x32e759[_0xf153('0x23')](_0x5c9f44)[_0xf153('0x24')]();};}function respondWithResult(_0x38190c,_0x1570fc){_0x1570fc=_0x1570fc||0xc8;return function(_0x39f3ed){if(_0x39f3ed){return _0x38190c[_0xf153('0x23')](_0x1570fc)[_0xf153('0x25')](_0x39f3ed);}};}function respondWithFilteredResult(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(_0x141ef4){var _0x703adb=typeof _0x35f9da[_0xf153('0x26')]===_0xf153('0x27')&&typeof _0x35f9da['limit']===_0xf153('0x27');var _0x3f1c6f=_0x141ef4['count'];var _0x16cdcd=_0x703adb?0x0:_0x35f9da[_0xf153('0x26')];var _0x4e45f9=_0x703adb?_0x141ef4[_0xf153('0x28')]:_0x35f9da[_0xf153('0x26')]+_0x35f9da[_0xf153('0x29')];var _0x2b9a9c;if(_0x4e45f9>=_0x3f1c6f){_0x4e45f9=_0x3f1c6f;_0x2b9a9c=0xc8;}else{_0x2b9a9c=0xce;}_0xe490f8[_0xf153('0x23')](_0x2b9a9c);return _0xe490f8[_0xf153('0x2a')](_0xf153('0x2b'),_0x16cdcd+'-'+_0x4e45f9+'/'+_0x3f1c6f)[_0xf153('0x25')](_0x141ef4);}return null;};}function saveUpdates(_0x19a568){return function(_0x8e31bf){if(_0x8e31bf){return _0x8e31bf[_0xf153('0x2c')](_0x19a568)[_0xf153('0x2d')](function(_0x5b5237){return _0x5b5237;});}return null;};}function removeEntity(_0x258fb0){return function(_0xbb3619){if(_0xbb3619){return _0xbb3619[_0xf153('0x2e')]()[_0xf153('0x2d')](function(){_0x258fb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28433d){return function(_0x4c6ea0){if(!_0x4c6ea0){_0x28433d['sendStatus'](0x194);}return _0x4c6ea0;};}function handleError(_0x2473d0,_0x4ab958){_0x4ab958=_0x4ab958||0x1f4;return function(_0x2b9623){logger['error'](_0x2b9623[_0xf153('0x2f')]);if(_0x2b9623[_0xf153('0x30')]){delete _0x2b9623['name'];}_0x2473d0[_0xf153('0x23')](_0x4ab958)[_0xf153('0x31')](_0x2b9623);};}function getMustacheRender(_0x538069,_0x40be52){return Mustache[_0xf153('0x32')](_0x538069,_[_0xf153('0x33')](_0x40be52['body'],{'contact':_0x40be52[_0xf153('0x34')],'message':_0x40be52['message'],'agent':_0x40be52[_0xf153('0x35')],'interaction':_0x40be52[_0xf153('0x36')],'account':_0x40be52[_0xf153('0x37')]}))||'';}function getInteractionUsers(_0x1820c3,_0x274bcc){return new BPromise(function(_0x284fe8,_0x4becf3){try{if(_0x274bcc[_0x1820c3['id']]){_0x1820c3[_0xf153('0x38')]=_[_0xf153('0x39')](_0x274bcc[_0x1820c3['id']],function(_0x332809){return{'id':_0x332809['id'],'fullname':_0x332809['fullname']};});}}catch(_0x244172){_0x4becf3(_0x244172);}_0x284fe8(_0x1820c3);});}function getInteractionTags(_0x17d60c,_0xd2a763){return new BPromise(function(_0x254692,_0x36c5cd){try{if(_0x17d60c[_0xf153('0x3a')]){_0x17d60c['Tags']=[];_0x17d60c[_0xf153('0x3a')][_0xf153('0x3b')](',')['forEach'](function(_0x14b2e3){_0x17d60c[_0xf153('0x3c')][_0xf153('0x3d')](_0xd2a763[_0x14b2e3]);});}delete _0x17d60c[_0xf153('0x3a')];}catch(_0x103b91){_0x36c5cd(_0x103b91);}_0x254692(_0x17d60c);});}function updateChatInteraction(_0x42360a,_0xef1510,_0x4d90c1){return new BPromise(function(_0x355131,_0x2f63d6){return getInteractionUsers(_0x42360a,_0x4d90c1)[_0xf153('0x2d')](function(_0x352e7c){return getInteractionTags(_0x352e7c,_0xef1510);})[_0xf153('0x2d')](function(_0x1ee606){return getStateInteraction(_0x1ee606);})['then'](function(_0x4b108e){_0x355131(_0x4b108e);})[_0xf153('0x3e')](function(_0x5051f3){_0x2f63d6(_0x5051f3);});});}function getStateInteraction(_0x46dd09){return new BPromise(function(_0x36c456){_0x46dd09[_0xf153('0x3f')]=0x0;_0x46dd09[_0xf153('0x40')]=0x0;_0x46dd09[_0xf153('0x41')]=0x0;_0x46dd09[_0xf153('0x42')]=0x0;_0x46dd09['abandoned']=0x0;_0x46dd09['total']=0x0;if(!_0x46dd09[_0xf153('0x43')]&&!_0x46dd09[_0xf153('0x44')]){_0x46dd09['waiting']+=0x1;}if(!_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09[_0xf153('0x40')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x45')]===_0xf153('0x46')){_0x46dd09[_0xf153('0x46')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&!_0x46dd09['UserId']&&_0x46dd09[_0xf153('0x45')]){_0x46dd09[_0xf153('0x42')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09['waiting']-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09['answered']+=0x1;if(_0x46dd09[_0xf153('0x40')]){_0x46dd09['talking']-=0x1;}}_0x46dd09[_0xf153('0x47')]+=0x1;_0x36c456(_0x46dd09);});}exports[_0xf153('0x48')]=function(_0x17fb10,_0x550d45){var _0x1f540b={},_0x209048={},_0x1426eb={'count':0x0,'rows':[]};var _0x1bece2=_[_0xf153('0x39')](db['ChatInteraction'][_0xf153('0x49')],function(_0x3bc265){return{'name':_0x3bc265['fieldName'],'type':_0x3bc265[_0xf153('0x4a')][_0xf153('0x4b')]};});_0x209048[_0xf153('0x4c')]=_['map'](_0x1bece2,_0xf153('0x30'));_0x209048[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x17fb10[_0xf153('0x4d')]);_0x209048[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x209048[_0xf153('0x4c')],_0x209048[_0xf153('0x4d')]);_0x1f540b[_0xf153('0x51')]=_['intersection'](_0x209048[_0xf153('0x4c')],qs['fields'](_0x17fb10['query']['fields']));_0x1f540b[_0xf153('0x51')]=_0x1f540b[_0xf153('0x51')]['length']?_0x1f540b[_0xf153('0x51')]:_0x209048[_0xf153('0x4c')];if(!_0x17fb10['query'][_0xf153('0x52')](_0xf153('0x53'))){_0x1f540b[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1f540b['offset']=qs[_0xf153('0x26')](_0x17fb10[_0xf153('0x4d')]['offset']);}_0x1f540b['order']=qs[_0xf153('0x54')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x54')]);_0x1f540b[_0xf153('0x55')]=qs[_0xf153('0x4f')](_[_0xf153('0x56')](_0x17fb10['query'],_0x209048[_0xf153('0x4f')]),_0x1bece2);var _0x51d813=[];var _0x340aba=squel[_0xf153('0x57')]()[_0xf153('0x58')]('id')['field'](_0xf153('0x30'))[_0xf153('0x58')](_0xf153('0x59'))[_0xf153('0x5a')](_0xf153('0x5b'));var _0x18d0ce=squel[_0xf153('0x57')]()['field'](_0xf153('0x5c'))[_0xf153('0x58')](_0xf153('0x5d'))['field'](_0xf153('0x5e'))[_0xf153('0x5a')](_0xf153('0x5f'),'ui')[_0xf153('0x60')](_0xf153('0x61'),'u',_0xf153('0x62'));var _0x245124=squel[_0xf153('0x57')]()['from'](_0xf153('0x63'),'i')[_0xf153('0x60')]('cm_contacts','c',_0xf153('0x64'))[_0xf153('0x60')](_0xf153('0x61'),'o',_0xf153('0x65'))[_0xf153('0x60')](_0xf153('0x66'),'a',_0xf153('0x67'))[_0xf153('0x60')](_0xf153('0x68'),'me',_0xf153('0x69'))[_0xf153('0x60')]('chat_interaction_has_tags','it',_0xf153('0x6a'))[_0xf153('0x60')]('tools_tags','t',_0xf153('0x6b'));var _0x25e66e=squel[_0xf153('0x6c')]();var _0x147d3a=[];var _0x603892=squel[_0xf153('0x6c')]();var _0x2736e3;if(_0x17fb10['query'][_0xf153('0x6d')]){_0x2736e3=as[_0xf153('0x6e')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x6d')]);var _0x17f58d=_0x2736e3[_0xf153('0x6f')];for(var _0x19ec0b=0x0;_0x19ec0b<_0x2736e3[_0xf153('0x70')][_0xf153('0x71')];_0x19ec0b++){var _0x4c9157=_0x2736e3[_0xf153('0x70')][_0x19ec0b];var _0x433566='i';var _0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name',_0x4c9157[_0xf153('0x58')]]);if(!_0x4afdc4){switch(_0x4c9157[_0xf153('0x58')]){case'unreadMessages':if(_0x4c9157[_0xf153('0x73')]==0x1){_0x245124['having']('`'+_0x4c9157[_0xf153('0x58')]+_0xf153('0x74'));}else{_0x245124[_0xf153('0x75')]('`'+_0x4c9157[_0xf153('0x58')]+'`\x20>\x200');}break;case _0xf153('0x76'):if(_0x4c9157[_0xf153('0x77')]==='$substring'){if(_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')]('\x20')[_0xf153('0x71')]>0x1){_0x25e66e[_0x17f58d](_0xf153('0x78'),qs[_0xf153('0x79')](_0x4c9157['value']),null);}else{var _0xf4a542='%'+_0x4c9157['value']+'%';_0x25e66e[_0x17f58d](_0xf153('0x7a'),_0xf4a542,_0xf4a542,_0xf4a542);}}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','ContactId']);_0x4c9157[_0xf153('0x58')]=_0xf153('0x7b');_0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')]['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}break;case _0xf153('0x7d'):var _0x1e5e95=_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')](',')[_0xf153('0x39')](function(_0x364957){return Number(_0x364957);});_0x1e5e95[_0xf153('0x7e')](function(_0x858289){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x858289+',%');});_0x147d3a=_[_0xf153('0x80')](_0x147d3a,_0x1e5e95);break;case _0xf153('0x81'):if(_0x4c9157[_0xf153('0x77')]===_0xf153('0x82')){_0x25e66e[_0x17f58d](_0xf153('0x83'),'%'+_0x4c9157['value']+'%',null);}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','UserId']);_0x4c9157[_0xf153('0x58')]='UserId';_0x44da13=as[_0xf153('0x84')](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')][_0xf153('0x85')],_0x44da13[_0xf153('0x73')]['end']);}break;case _0xf153('0x86'):_0x44da13=as[_0xf153('0x84')]('me',null,_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13['value']['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);break;}}else{var _0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13['text'],_0x44da13['value'][_0xf153('0x85')],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}}}else{var _0x583dbf=_(_0x17fb10[_0xf153('0x4d')])[_0xf153('0x4e')]()['map'](function(_0x193c8c){return _[_0xf153('0x87')](_0x1bece2,[_0xf153('0x30'),_0x193c8c])?_0x193c8c:undefined;})[_0xf153('0x88')]()[_0xf153('0x73')]();if(!_['isEmpty'](_0x583dbf)){_0x583dbf[_0xf153('0x7e')](function(_0xf791a1){if(_0xf791a1===_0xf153('0x89')){_0x245124[_0xf153('0x55')](_0xf153('0x8a'),[][_0xf153('0x8b')](_0x17fb10[_0xf153('0x4d')][_0xf791a1]));}else if(_0xf791a1==='createdAt'){var _0x756f52=JSON[_0xf153('0x8c')](_0x17fb10[_0xf153('0x4d')][_0xf791a1])[_0xf153('0x8d')];var _0x269102=JSON[_0xf153('0x8c')](_0x17fb10['query'][_0xf791a1])[_0xf153('0x8e')];_0x245124[_0xf153('0x55')](_0xf153('0x8f'),_0x756f52,_0x269102);}else{if(_0x17fb10[_0xf153('0x4d')][_0xf791a1]===_0xf153('0x90')){_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x91'));}else{_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x92'),_0x17fb10[_0xf153('0x4d')][_0xf791a1]);}}});}if(_0x17fb10['query']['read']){if(_0x17fb10['query']['read']==0x1){_0x245124[_0xf153('0x75')](_0xf153('0x93'));}else{_0x245124[_0xf153('0x75')](_0xf153('0x94'));}}if(_0x17fb10[_0xf153('0x4d')]['tag']){_0x147d3a=_[_0xf153('0x95')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')])?_0x17fb10[_0xf153('0x4d')]['tag']:new Array(_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')]);_0x147d3a[_0xf153('0x7e')](function(_0x4a5f54){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x4a5f54+',%');});}if(_0x17fb10['query'][_0xf153('0x97')]){var _0x25ab76=_0x17fb10[_0xf153('0x4d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf153('0x98')](_0x25ab76)){_0x25e66e['or'](_0xf153('0x99'),_0x25ab76+'%');}else{_0x25e66e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x25ab76))['or'](_0xf153('0x9a'),_0x25ab76+'%');}}}_0x245124['where'](_0x25e66e);_0x245124[_0xf153('0x9b')]('i.id');var _0xb3632c={'type':db[_0xf153('0x9c')][_0xf153('0x9d')][_0xf153('0x9e')],'raw':!![]};var _0x303dcf=_0x245124[_0xf153('0x9f')]();_0x303dcf['field'](_0xf153('0xa0'));_0x303dcf[_0xf153('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf153('0xa1'));if(_0x1f540b[_0xf153('0xa2')]){_0x1f540b[_0xf153('0xa2')][_0xf153('0x7e')](function(_0x5c6ac2){var _0x3e36fc=_0x5c6ac2[0x0]===_0xf153('0xa3')?_0x5c6ac2[0x0]:'i.'+_0x5c6ac2[0x0];_0x245124['order'](_0x3e36fc,_0x5c6ac2[0x1]===_0xf153('0xa4')?![]:!![]);});}if(!_[_0xf153('0xa5')](_0x147d3a)){_0x245124[_0xf153('0x75')](_0x603892);_0x303dcf[_0xf153('0x55')]('t.id\x20IN\x20?',_0x147d3a);}BPromise[_0xf153('0xa6')]()[_0xf153('0x2d')](function(){if(!_0x2736e3){if(_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return;_0x303dcf[_0xf153('0x55')](_0xf153('0xa7'));_0x245124[_0xf153('0x55')](_0xf153('0xa7'));return;}if(_0x17fb10[_0xf153('0xa8')]['role']!==_0xf153('0x35'))return;return _0x17fb10[_0xf153('0xa8')][_0xf153('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d24b5){if(_[_0xf153('0xa5')](_0x4d24b5)){_0x303dcf['where'](_0xf153('0xaa'));_0x245124[_0xf153('0x55')](_0xf153('0xaa'));}else{_0x303dcf['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xf153('0x39')](_0x4d24b5,'id'));_0x245124[_0xf153('0x55')](_0xf153('0x8a'),_['map'](_0x4d24b5,'id'));}});})[_0xf153('0x2d')](function(){if(_0x17fb10[_0xf153('0xa8')][_0xf153('0xab')]===_0xf153('0x35')&&!_0x2736e3&&!_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x303dcf[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x347859){_0x1426eb[_0xf153('0x28')]=_0x347859[_0xf153('0x71')];if(_0x1426eb['count']===0x0)return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x340aba[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x573032){_0x51d813=_[_0xf153('0xae')](_0x573032,'id');_0xb3632c=_['merge'](_0xb3632c,{'model':db[_0xf153('0xaf')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17fb10[_0xf153('0x4d')]['fields']){_0x1f540b[_0xf153('0x51')][_0xf153('0x7e')](function(_0x3b0b94){_0x245124[_0xf153('0x58')]('i.'+_0x3b0b94);});}else{_0x245124[_0xf153('0x58')](_0xf153('0xb0'),_0xf153('0xa1'));_0x245124[_0xf153('0x58')]('a.key',_0xf153('0xb1'));_0x245124[_0xf153('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x245124[_0xf153('0x58')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x245124[_0xf153('0x58')](_0xf153('0xb2'));_0x245124['field'](_0xf153('0xb3'),_0xf153('0xb4'));_0x245124[_0xf153('0x58')](_0xf153('0xb5'),_0xf153('0xb6'));_0x245124[_0xf153('0x58')](_0xf153('0xb7'),_0xf153('0xb8'));_0x245124[_0xf153('0x58')]('c.phone',_0xf153('0xb9'));_0x245124['field'](_0xf153('0xba'),'Contact.mobile');_0x245124[_0xf153('0x58')]('c.fax','Contact.fax');_0x245124[_0xf153('0x58')]('o.fullname',_0xf153('0xbb'));_0x245124[_0xf153('0x58')]('o.internal','Owner.internal');_0x245124[_0xf153('0x58')](_0xf153('0xbc'),_0xf153('0x3a'));}if(_0x1f540b['limit'])_0x245124[_0xf153('0x29')](_0x1f540b[_0xf153('0x29')]);if(_0x1f540b[_0xf153('0x26')])_0x245124[_0xf153('0x26')](_0x1f540b['offset']);return db[_0xf153('0xac')][_0xf153('0x4d')](_0x245124[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x1022c5){if(_0x1022c5[_0xf153('0x71')]>0x0)_0x18d0ce[_0xf153('0x55')](_0xf153('0xbd'),_[_0xf153('0x39')](_0x1022c5,'id'));return db[_0xf153('0xac')][_0xf153('0x4d')](_0x18d0ce[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x1aebab){var _0x192708=_['groupBy'](_0x1aebab,_0xf153('0xbe'));var _0x4525e1=[];_0x1022c5[_0xf153('0x7e')](function(_0x449f8d){_0x4525e1[_0xf153('0x3d')](updateChatInteraction(_0x449f8d,_0x51d813,_0x192708));});return BPromise['all'](_0x4525e1);});});})[_0xf153('0x2d')](function(_0xa13662){_0x1426eb[_0xf153('0xbf')]=_0xa13662;return _0x1426eb;})[_0xf153('0x2d')](respondWithFilteredResult(_0x550d45,_0x1f540b))[_0xf153('0x3e')](handleError(_0x550d45,null));};exports[_0xf153('0xc0')]=function(_0x2e55f4,_0x1098b7){var _0x29d492={'raw':![],'where':{'id':_0x2e55f4[_0xf153('0xc1')]['id']}},_0x3f7938={};_0x3f7938[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xaf')][_0xf153('0x49')]);_0x3f7938['query']=_[_0xf153('0x4e')](_0x2e55f4[_0xf153('0x4d')]);_0x3f7938[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x3f7938[_0xf153('0x4c')],_0x3f7938[_0xf153('0x4d')]);_0x29d492[_0xf153('0x51')]=_[_0xf153('0x50')](_0x3f7938['model'],qs[_0xf153('0xc2')](_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc2')]));_0x29d492[_0xf153('0x51')]=_0x29d492[_0xf153('0x51')]['length']?_0x29d492[_0xf153('0x51')]:_0x3f7938[_0xf153('0x4c')];if(_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc3')]){_0x29d492['include']=[{'all':!![]}];}_0x29d492=_['merge']({},_0x29d492,_0x2e55f4[_0xf153('0xc4')]);return db[_0xf153('0xaf')]['find'](_0x29d492)['then'](handleEntityNotFound(_0x1098b7,null))[_0xf153('0x2d')](respondWithResult(_0x1098b7,null))[_0xf153('0x3e')](handleError(_0x1098b7,null));};exports[_0xf153('0xc5')]=function(_0x339e9e,_0x31a019){return db[_0xf153('0xaf')][_0xf153('0xc5')](_0x339e9e[_0xf153('0x86')],{})[_0xf153('0x2d')](respondWithResult(_0x31a019,0xc9))['catch'](handleError(_0x31a019,null));};exports[_0xf153('0x2c')]=function(_0x110f72,_0x527cce){if(_0x110f72[_0xf153('0x86')]['id']){delete _0x110f72[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x110f72['params']['id']}})['then'](handleEntityNotFound(_0x527cce,null))[_0xf153('0x2d')](saveUpdates(_0x110f72[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0x527cce,null))['catch'](handleError(_0x527cce,null));};exports[_0xf153('0x2e')]=function(_0x45c835,_0x3ca774){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x45c835[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3ca774,null))['then'](removeEntity(_0x3ca774,null))[_0xf153('0x3e')](handleError(_0x3ca774,null));};exports[_0xf153('0xc6')]=function(_0x3451e9,_0x3af786){return db[_0xf153('0xaf')][_0xf153('0xc6')]()[_0xf153('0x2d')](respondWithResult(_0x3af786,null))[_0xf153('0x3e')](handleError(_0x3af786,null));};exports[_0xf153('0xc7')]=function(_0x53eee4,_0x2dd1d8){var _0x2c3f76=_0x53eee4[_0xf153('0xc1')]['id'];var _0x374ba4;var _0x1b4f50;var _0x40c1d1;return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c3f76}})[_0xf153('0x2d')](function(_0x8711eb){_0x374ba4=_0x8711eb;return db[_0xf153('0xc9')]['findOne']({'where':{'id':_0x8711eb[_0xf153('0x89')]},'attributes':['id',_0xf153('0xca'),_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcd'),'vidaooMetadata'],'raw':!![]});})[_0xf153('0x2d')](function(_0x2e908a){if(_0x2e908a&&_0x2e908a['vidaooApiKey']&&_0x2e908a[_0xf153('0xcb')]){_0x1b4f50=_0x2e908a;var _0x57d320={'interaction':{'id':_0x2c3f76},'agent':{'id':_0x53eee4[_0xf153('0xa8')]['id'],'name':_0x53eee4[_0xf153('0xa8')][_0xf153('0x30')],'fullname':_0x53eee4[_0xf153('0xa8')]['fullname'],'email':_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]},'contact':_0x53eee4['body'][_0xf153('0x34')],'account':_0x53eee4['body'][_0xf153('0x37')]};var _0x30ae3c={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2e908a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]],'buttons':null,'topic':_0x1b4f50['vidaooTopic'],'note':_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xcd')])?null:getMustacheRender(_0x1b4f50['vidaooNote'],_0x57d320),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xd0')])){var _0x32971d=getMustacheRender(_0x1b4f50[_0xf153('0xd0')],_0x57d320);var _0x1a4825=JSON[_0xf153('0x8c')](_0x32971d);_0x30ae3c[_0xf153('0x86')][_0xf153('0xd1')]=_0x1a4825;}}catch(_0xb03f70){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd2'));}return rp(_0x30ae3c);}else{throw new db['Sequelize']['ValidationError'](_0xf153('0xd3'));}})[_0xf153('0x2d')](function(_0x264968){_0x40c1d1=_0x264968;if(_0x40c1d1['id']){var _0xe61167={'body':_0x40c1d1['join_url'],'ChatWebsiteId':_0x1b4f50['id'],'ChatInteractionId':_0x374ba4['id'],'direction':_0xf153('0xd4'),'UserId':_0x53eee4['user']['id']};return db[_0xf153('0xd5')][_0xf153('0xc5')](_0xe61167,{});}else{throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd6'));}})[_0xf153('0x2d')](function(){return _0x374ba4['updateAttributes']({'vidaooSessionId':_0x40c1d1['id']});})[_0xf153('0x2d')](respondWithResult(_0x2dd1d8,null))['catch'](handleError(_0x2dd1d8,null));};exports[_0xf153('0xd7')]=function(_0x1ba174,_0xab67b7){if(_0x1ba174['body']['id']){delete _0x1ba174['body']['id'];}return db[_0xf153('0xaf')]['find']({'where':{'id':_0x1ba174[_0xf153('0xc1')]['id']},'include':[{'model':db[_0xf153('0xd8')],'as':_0xf153('0x76')}]})[_0xf153('0x2d')](handleEntityNotFound(_0xab67b7,null))[_0xf153('0x2d')](saveUpdates(_0x1ba174[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0xab67b7,null))[_0xf153('0x3e')](handleError(_0xab67b7,null));};exports[_0xf153('0xd9')]=function(_0x40ade6,_0x1a9bfb){if(_0x40ade6[_0xf153('0x86')]['id']){delete _0x40ade6[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x40ade6[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](function(_0x50dd96){if(!_0x50dd96){logger[_0xf153('0x1f')](_0xf153('0xda'),_0xf153('0xd9'),0x194,'entity\x20not\x20found');_0x1a9bfb[_0xf153('0x22')](0x194);}else{if(_0x50dd96[_0xf153('0x44')]){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xdb'));}}return _0x50dd96;})[_0xf153('0x2d')](function(_0xeebd4f){if(_0xeebd4f){return _0xeebd4f[_0xf153('0x2c')]({'closed':_0x40ade6[_0xf153('0x86')]['closed'],'disposition':_0x40ade6[_0xf153('0x86')]['disposition']})[_0xf153('0x2d')](function(_0x4fe273){return _0x4fe273;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xf153('0xd9'),_0x40ade6['body'],client9004);})[_0xf153('0x2d')](respondWithResult(_0x1a9bfb,null))['catch'](handleError(_0x1a9bfb,null));};exports[_0xf153('0xdc')]=function(_0x25543b,_0x3c1ae6){_0x25543b[_0xf153('0x86')]['name']=_0x25543b[_0xf153('0xdd')][_0xf153('0xde')];_0x25543b['body'][_0xf153('0xdf')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe0')];_0x25543b[_0xf153('0x86')][_0xf153('0x4a')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe1')];return db['Attachment'][_0xf153('0xc5')](_0x25543b[_0xf153('0x86')])[_0xf153('0x2d')](respondWithResult(_0x3c1ae6,0xc9))[_0xf153('0x3e')](handleError(_0x3c1ae6,null));};exports[_0xf153('0xe2')]=function(_0x2c8401,_0x41ef70){return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0xc1')]['id']},'raw':!![]})[_0xf153('0x2d')](handleEntityNotFound(_0x41ef70,null))[_0xf153('0x2d')](function(_0x283f9e){if(_0x283f9e){if(_0x283f9e['closed']){return _0x41ef70['status'](0x193)[_0xf153('0x25')]({'status':0x193,'message':_0xf153('0xe3')});}return db['Attachment'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0x4d')][_0xf153('0xe4')]},'raw':!![]})['then'](handleEntityNotFound(_0x41ef70,null));}})['then'](function(_0x13b7e2){if(_0x13b7e2){var _0x25222f=_0x13b7e2[_0xf153('0xe5')]!==null;var _0x4b2cdd=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0xe8'));if(_0x25222f){_0x4b2cdd=path[_0xf153('0xe6')](_0x4b2cdd,_0xf153('0xe9'));}var _0x1ac5ff=path[_0xf153('0xe6')](_0x4b2cdd,_0x13b7e2[_0xf153('0xdf')]);return _0x41ef70[_0xf153('0xea')](_0x1ac5ff);}})[_0xf153('0x3e')](handleError(_0x41ef70,null));};exports[_0xf153('0xeb')]=function(_0x126535,_0x392c8e){var _0x203143=null;var _0x173f12=null;var _0x1f8794=null;if(_0x126535[_0xf153('0x86')]['id']){delete _0x126535[_0xf153('0x86')]['id'];}if(_0x126535['body'][_0xf153('0xec')]){_0x1f8794=path['join'](config[_0xf153('0xe7')],_0xf153('0xed'),util['format']('transcript-%s.txt',Date['now']()));_0x126535[_0xf153('0x86')][_0xf153('0xee')]=_0x1f8794;}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x126535['params']['id']},'include':[{'model':db[_0xf153('0xd5')],'as':_0xf153('0xef'),'include':[{'model':db[_0xf153('0x81')],'as':_0xf153('0x81')}]}]})[_0xf153('0x2d')](handleEntityNotFound(_0x392c8e,null))[_0xf153('0x2d')](saveUpdates(_0x126535[_0xf153('0x86')],null))[_0xf153('0x2d')](function(_0x4c2b50){if(_0x4c2b50){_0x203143=_0x4c2b50;return db[_0xf153('0xc9')][_0xf153('0x72')]({'where':{'id':_0x203143['ChatWebsiteId']}});}})['then'](function(_0x3021e6){if(_0x3021e6){_0x173f12=_0x3021e6;return db[_0xf153('0xd8')]['find']({'where':{'id':_0x203143[_0xf153('0x7b')]}});}})['then'](function(_0x3057f1){if(_0x3057f1){if(_0x1f8794){var _0x207255=null;for(var _0xd8cd84=0x1;_0xd8cd84<_0x203143[_0xf153('0xef')][_0xf153('0x71')];++_0xd8cd84){_0x207255=_0x203143['Messages'][_0xd8cd84];var _0xb4dbdd=_0x207255['UserId']?util['format'](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');var _0x5b1a91=_0x126535[_0xf153('0x86')][_0xf153('0xf3')]||util[_0xf153('0xf4')](_0xf153('0xf0'),_0xf153('0xf5'),_0x207255[_0xf153('0x7b')]);switch(_0x173f12[_0xf153('0xf6')]){case _0xf153('0xf7'):_0xb4dbdd=_0x207255['UserId']?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');break;case _0xf153('0xf8'):_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')][_0xf153('0xf9')]||_0x207255[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2');break;case'agent_fullname':_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')]['fullname']:_0xf153('0xf2');break;default:_0xb4dbdd=_0x207255[_0xf153('0x44')]?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');}var _0x4b8d5c=util[_0xf153('0xf4')](_0xf153('0xfb'),moment(_0x207255[_0xf153('0xfc')])[_0xf153('0xf4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x207255[_0xf153('0xfd')]==='in'?_0x5b1a91:_0xb4dbdd,_0x207255[_0xf153('0x86')]);if(!_0x207255['secret']){fs[_0xf153('0xfe')](_0x1f8794,_0x4b8d5c);}}return db['MailAccount'][_0xf153('0xc8')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf153('0xff'),'raw':!![],'include':[{'model':db[_0xf153('0x100')],'as':_0xf153('0x100'),'raw':!![]}]}]});}}})[_0xf153('0x2d')](function(_0x5a8d13){if(!_0x5a8d13||!_0x5a8d13[_0xf153('0xff')]||!_0x126535['body'])return _0x203143;var _0x21285e=_0x5a8d13[_0xf153('0x101')]();return respondWithRpcPromise(_0xf153('0x102'),_0xf153('0x103'),{'account':_0x21285e,'message':{'from':util[_0xf153('0xf4')](_0xf153('0x104'),_0x5a8d13['name'],_0x5a8d13[_0xf153('0xce')]||_0x5a8d13['Smtp'][_0xf153('0xa8')]),'to':_0x126535['body'][_0xf153('0xec')],'subject':_0xf153('0x105'),'text':util[_0xf153('0xf4')](_0xf153('0x106'),_0x126535['body'][_0xf153('0xec')]),'attachments':[{'path':_0x1f8794}]}})['then'](function(){return _0x203143;})[_0xf153('0x3e')](function(_0x5c32d1){logger[_0xf153('0x1f')](_0x5c32d1);});})[_0xf153('0x2d')](respondWithStatusCode(_0x392c8e,0xc8))[_0xf153('0x3e')](handleError(_0x392c8e,null));};exports[_0xf153('0x107')]=function(_0x273b03,_0x3165e5){return db[_0xf153('0xd5')][_0xf153('0x72')]({'where':{'id':_0x273b03['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3165e5,null))[_0xf153('0x2d')](function(_0x48c9e4){if(_0x48c9e4){return _0x48c9e4[_0xf153('0x107')](_0x273b03[_0xf153('0x86')][_0xf153('0x108')],_[_0xf153('0x109')](_0x273b03[_0xf153('0x86')],[_0xf153('0x108'),'id'])||{});}})[_0xf153('0x2d')](respondWithResult(_0x3165e5,null))['catch'](handleError(_0x3165e5,null));};exports['getMessages']=function(_0x550c10,_0x3e8153){var _0x1fb83a={'raw':![],'where':{}};var _0x10f948={};var _0x5cc922={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x550c10['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3e8153,null))[_0xf153('0x2d')](function(_0x21a1c9){if(_0x21a1c9){_0x10f948[_0xf153('0x4c')]=_[_0xf153('0x4e')](db['ChatMessage'][_0xf153('0x49')]);_0x10f948[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x550c10['query']);_0x10f948[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],_0x10f948[_0xf153('0x4d')]);_0x1fb83a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x550c10[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1fb83a[_0xf153('0x51')]=_0x1fb83a[_0xf153('0x51')][_0xf153('0x71')]?_0x1fb83a[_0xf153('0x51')]:_0x10f948[_0xf153('0x4c')];if(!_0x550c10[_0xf153('0x4d')][_0xf153('0x52')]('nolimit')){_0x1fb83a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x550c10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1fb83a['offset']=qs[_0xf153('0x26')](_0x550c10[_0xf153('0x4d')][_0xf153('0x26')]);}_0x1fb83a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x550c10[_0xf153('0x4d')]['sort']);_0x1fb83a[_0xf153('0x55')]=qs[_0xf153('0x4f')](_['pick'](_0x550c10[_0xf153('0x4d')],_0x10f948[_0xf153('0x4f')]));_0x1fb83a[_0xf153('0x55')][_0xf153('0xbe')]=_0x21a1c9['id'];if(_0x550c10[_0xf153('0x4d')][_0xf153('0x97')]){_0x1fb83a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1fb83a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1fb83a[_0xf153('0x51')],function(_0x4538be){var _0x63ad32={};_0x63ad32[_0x4538be]={'$like':'%'+_0x550c10['query'][_0xf153('0x97')]+'%'};return _0x63ad32;})});}if(_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]){var _0x9503e=_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]['split'](',');var _0x49ea9a={};_0x49ea9a[_0x9503e[0x0]]={'$gte':moment(_0x9503e[0x1])[_0xf153('0xf4')](_0xf153('0x10a'))};_0x1fb83a[_0xf153('0x55')]=_['merge'](_0x1fb83a[_0xf153('0x55')],_0x49ea9a);}_0x1fb83a=_[_0xf153('0x33')]({},_0x1fb83a,_0x550c10[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1fb83a[_0xf153('0x55')]})[_0xf153('0x2d')](function(_0x921b52){_0x5cc922['count']=_0x921b52;if(_0x550c10['query'][_0xf153('0xc3')]){_0x1fb83a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1fb83a);})[_0xf153('0x2d')](function(_0x577fc7){_0x5cc922[_0xf153('0xbf')]=_0x577fc7;return _0x5cc922;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x3e8153,_0x1fb83a))[_0xf153('0x3e')](handleError(_0x3e8153,null));};exports[_0xf153('0x10d')]=function(_0x283af8,_0x58be79){var _0x1d0d1a={'where':{}},_0x5397a8={},_0x466386={'count':0x0,'rows':[]};return db[_0xf153('0xaf')][_0xf153('0xc8')]({'where':{'id':_0x283af8[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x58be79,null))['then'](function(_0x5efd23){if(_0x5efd23){_0x5397a8[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xd5')][_0xf153('0x49')]);_0x5397a8[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x283af8[_0xf153('0x4d')]);_0x5397a8[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],_0x5397a8[_0xf153('0x4d')]);_0x1d0d1a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x283af8[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1d0d1a[_0xf153('0x51')]=_0x1d0d1a[_0xf153('0x51')][_0xf153('0x71')]?_0x1d0d1a[_0xf153('0x51')]:_0x5397a8[_0xf153('0x4c')];if(!_0x283af8['query']['hasOwnProperty'](_0xf153('0x53'))){_0x1d0d1a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x283af8['query'][_0xf153('0x29')]);_0x1d0d1a[_0xf153('0x26')]=qs[_0xf153('0x26')](_0x283af8['query'][_0xf153('0x26')]);}_0x1d0d1a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x283af8[_0xf153('0x4d')]['sort']);_0x1d0d1a[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x56')](_0x283af8[_0xf153('0x4d')],_0x5397a8[_0xf153('0x4f')]));_0x1d0d1a[_0xf153('0x55')]['ChatInteractionId']=_0x5efd23['id'];if(_0x283af8[_0xf153('0x4d')]['filter']){_0x1d0d1a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1d0d1a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1d0d1a[_0xf153('0x51')],function(_0x397ee2){var _0x17e62e={};_0x17e62e[_0x397ee2]={'$like':'%'+_0x283af8[_0xf153('0x4d')][_0xf153('0x97')]+'%'};return _0x17e62e;})});}_0x1d0d1a['where']['secret']=![];if(_0x283af8[_0xf153('0x4d')]['id']){_0x1d0d1a[_0xf153('0x55')]['id']={'$gt':_0x283af8[_0xf153('0x4d')]['id']};}_0x1d0d1a=_['merge']({},_0x1d0d1a,_0x283af8[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1d0d1a['where']})[_0xf153('0x2d')](function(_0x100f48){_0x466386[_0xf153('0x28')]=_0x100f48;_0x1d0d1a[_0xf153('0x10b')]=[];if(_0x283af8['query']['includeAgent']){_0x1d0d1a[_0xf153('0x10b')][_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id','fullname',_0xf153('0xf9')]});}if(_0x283af8[_0xf153('0x4d')][_0xf153('0xc3')]){_0x1d0d1a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1d0d1a);})[_0xf153('0x2d')](function(_0x3a94c5){_0x466386[_0xf153('0xbf')]=_0x3a94c5;return _0x466386;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x58be79,_0x1d0d1a))['catch'](handleError(_0x58be79,null));};exports['addTags']=function(_0x11997d,_0x74943){return db[_0xf153('0xaf')]['find']({'where':{'id':_0x11997d[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x74943,null))['then'](function(_0x3f7eb6){if(_0x3f7eb6){return _0x3f7eb6[_0xf153('0x10e')](_0x11997d['body']['ids'],_[_0xf153('0x109')](_0x11997d['body'],[_0xf153('0x108'),'id'])||{})[_0xf153('0x10f')](function(){return db[_0xf153('0x7d')]['findAll']({'attributes':['id',_0xf153('0x30'),_0xf153('0x59')],'where':{'id':_0x11997d['body'][_0xf153('0x108')]}});})['then'](function(_0x5742a6){socket[_0xf153('0x110')](_0xf153('0x111'),{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]});return{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]};});}})[_0xf153('0x2d')](respondWithResult(_0x74943,null))[_0xf153('0x3e')](handleError(_0x74943,null));};exports['removeTags']=function(_0x9d9d65,_0x301675){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x9d9d65[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x301675,null))[_0xf153('0x2d')](function(_0x4a5c86){if(_0x4a5c86){return _0x4a5c86['removeTags'](_0x9d9d65[_0xf153('0x4d')][_0xf153('0x108')]);}})['then'](respondWithStatusCode(_0x301675,null))[_0xf153('0x3e')](handleError(_0x301675,null));};exports[_0xf153('0xea')]=function(_0x252e74,_0x48f9ff){var _0x2180ec=moment()[_0xf153('0x112')]()[_0xf153('0xad')]();var _0x265407=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x115'));var _0x2a39ae=path[_0xf153('0xe6')](config['root'],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x116'));var _0x154c3c=path[_0xf153('0xe6')](_0x265407,_0x2180ec);var _0x5b9c=util[_0xf153('0xf4')](_0xf153('0x117'),_0x252e74[_0xf153('0xc1')]['id'],_0x2180ec);var _0x304d66=path['join'](_0x265407,_0x5b9c);var _0x444f68=[];_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id',_0xf153('0xfa')],'raw':!![]});_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0xd8')],'as':_0xf153('0x76'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x252e74[_0xf153('0x4d')]['attachments']){_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x118')],'as':_0xf153('0x118'),'raw':!![]});}var _0x3d553d=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xf153('0x86'),_0xf153('0xfc'),_0xf153('0xfd'),_0xf153('0x119'),_0xf153('0x11a')],'include':_0x444f68}];_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0xc9')],'as':_0xf153('0x11b'),'attributes':['id',_0xf153('0x30')]});_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x11c'),'attributes':['id',_0xf153('0xfa')]});return db[_0xf153('0xaf')]['find']({'where':{'id':_0x252e74[_0xf153('0xc1')]['id']},'include':_0x3d553d})[_0xf153('0x2d')](handleEntityNotFound(_0x48f9ff,null))[_0xf153('0x2d')](function(_0xf53fc6){if(_0xf53fc6){var _0x45112b=_0xf53fc6[_0xf153('0x11d')]({'plain':!![]});fs[_0xf153('0x11e')](_0x154c3c);var _0x1435bd={'channel':_0xf153('0x11f'),'account':_0x45112b[_0xf153('0x11b')]['name'],'agent':_0x45112b[_0xf153('0x11c')]?_0x45112b[_0xf153('0x11c')][_0xf153('0xfa')]:_0xf153('0x120'),'createdAt':moment(_0x45112b['createdAt'])[_0xf153('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x45112b['closed']?moment(_0x45112b['closedAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')]():'','disposition':_0x45112b[_0xf153('0x45')],'chatInfo':{'browser':_0x45112b[_0xf153('0x121')],'os':_0x45112b['osName'],'referer':_0x45112b[_0xf153('0x122')],'customerIp':_0x45112b[_0xf153('0x123')],'customerPort':_0x45112b['customerPort']?_0x45112b[_0xf153('0x124')]:_0xf153('0x120')},'messages':_(_0x45112b['Messages'])[_0xf153('0x125')]()['filter']({'secret':![]})[_0xf153('0x39')](function(_0x5aa0bf){if(_0x5aa0bf[_0xf153('0x118')]){var _0x5ec77c=path[_0xf153('0xe6')](_0x2a39ae,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')]);if(fs[_0xf153('0x126')](_0x5ec77c)){fs[_0xf153('0x127')](_0x5ec77c)['pipe'](fs[_0xf153('0x128')](path[_0xf153('0xe6')](_0x154c3c,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')])));}}return{'date':moment(_0x5aa0bf['createdAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')](),'sender':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?_0x5aa0bf['User']?_0x5aa0bf[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2'):_0x5aa0bf[_0xf153('0x76')]['firstName']+(_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]?'\x20'+_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]:''),'body':_0x5aa0bf[_0xf153('0x118')]?_0x5aa0bf['Attachment'][_0xf153('0xdf')]:_0x5aa0bf[_0xf153('0x86')],'direction':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?'A':'C','secret':_0x5aa0bf[_0xf153('0x119')],'read':_0x5aa0bf[_0xf153('0x11a')],'attachment':_0x5aa0bf['Attachment']};})['value']()};return ejs[_0xf153('0x12a')](path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x12b'),'downloadInteraction.ejs'),{'interaction':_0x1435bd})[_0xf153('0x2d')](function(_0x415d13){var _0xb2f8e0=path[_0xf153('0xe6')](_0x154c3c,_0xf153('0x12c')+_0x45112b['id']+'-'+_0x2180ec+'.pdf');var _0x3b6a0e={'path':_0xb2f8e0,'channel':_0xf153('0x11f'),'interactionId':_0x45112b['id']};return pdf['createPdfFromHTML'](_0x415d13,_0x3b6a0e);})[_0xf153('0x2d')](function(){return new Promise(function(_0x19de76,_0x5912d8){zipdir(_0x154c3c,{'saveTo':_0x304d66},function(_0x426db4,_0x52677c){if(_0x426db4)return _0x5912d8(_0x426db4);return _0x19de76(_0x52677c);});})[_0xf153('0x2d')](function(){return new BPromise(function(_0x200d37,_0x393d95){rimraf(_0x154c3c,function(_0x30a638){if(_0x30a638)_0x393d95(_0x30a638);return _0x200d37();});});})[_0xf153('0x2d')](function(){return _0x48f9ff['download'](_0x304d66,_0x5b9c,function(_0x416a91){if(_0x416a91){logger['error'](_0xf153('0x12d'),_0x416a91);}else{fs[_0xf153('0x12e')](_0x304d66);}});});});}else{return _0x48f9ff[_0xf153('0x22')](0xc8);}})[_0xf153('0x3e')](handleError(_0x48f9ff,null));}; \ No newline at end of file +var _0xda55=['fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','AbandonInteraction','file','basename','filename','Attachment','attachmentDownload','Unauthorized','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','agentAlias','customer','Visitor','website_alias','agent_alias','System','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','sort','filter','merge','include','findAll','rows','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','views','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','path','ejs','squel','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','undefined','count','limit','Content-Range','destroy','then','stack','name','send','render','body','contact','agent','interaction','account','Users','map','TagIds','split','forEach','Tags','push','waiting','unmanaged','abandoned','total','closed','UserId','talking','disposition','answered','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','keyBy','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','ChatInteractionId','all','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooMetadata'];(function(_0x10e1d9,_0x973af7){var _0x2c0c87=function(_0x502d8b){while(--_0x502d8b){_0x10e1d9['push'](_0x10e1d9['shift']());}};_0x2c0c87(++_0x973af7);}(_0xda55,0x6d));var _0x5da5=function(_0x5353a5,_0x550668){_0x5353a5=_0x5353a5-0x0;var _0x1a856b=_0xda55[_0x5353a5];return _0x1a856b;};'use strict';var rimraf=require(_0x5da5('0x0'));var zipdir=require(_0x5da5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5da5('0x2'));var Mustache=require(_0x5da5('0x3'));var util=require(_0x5da5('0x4'));var path=require(_0x5da5('0x5'));var ejs=require(_0x5da5('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5da5('0x7'));var Redis=require('ioredis');var qs=require(_0x5da5('0x8'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5da5('0x9'));var logger=require(_0x5da5('0xa'))(_0x5da5('0xb'));var config=require(_0x5da5('0xc'));var db=require(_0x5da5('0xd'))['db'];config[_0x5da5('0xe')]=_[_0x5da5('0xf')](config[_0x5da5('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x5da5('0x10'))(new Redis(config[_0x5da5('0xe')]));require(_0x5da5('0x11'))[_0x5da5('0x12')](socket);var jayson=require(_0x5da5('0x13'));var client=jayson[_0x5da5('0x14')][_0x5da5('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x5da5('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x3b5ff9,_0x4f813b,_0x37aeb0,_0x31366e){return new BPromise(function(_0x3ced00,_0x43d526){var _0x1877d4=_0x31366e||client;return _0x1877d4[_0x5da5('0x16')](_0x3b5ff9,_0x37aeb0)['then'](function(_0x489b60){logger['info'](_0x5da5('0x17'),_0x4f813b,_0x5da5('0x18'));logger[_0x5da5('0x19')](_0x5da5('0x1a'),_0x4f813b,_0x5da5('0x18'),JSON[_0x5da5('0x1b')](_0x489b60));if(_0x489b60[_0x5da5('0x1c')]){if(_0x489b60['error'][_0x5da5('0x1d')]===0x1f4){logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x489b60[_0x5da5('0x1c')][_0x5da5('0x1e')]);return _0x43d526(_0x489b60[_0x5da5('0x1c')]['message']);}logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x489b60[_0x5da5('0x1c')][_0x5da5('0x1e')]);return _0x3ced00(_0x489b60[_0x5da5('0x1c')]['message']);}else{logger[_0x5da5('0x1f')](_0x5da5('0x17'),_0x4f813b,_0x5da5('0x18'));_0x3ced00(_0x489b60['result'][_0x5da5('0x1e')]);}})[_0x5da5('0x20')](function(_0x20c8a6){logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x20c8a6);_0x43d526(_0x20c8a6);});});}function respondWithStatusCode(_0x436960,_0x47d4e8){_0x47d4e8=_0x47d4e8||0xcc;return function(_0x1a6bd7){if(_0x1a6bd7){return _0x436960['sendStatus'](_0x47d4e8);}return _0x436960[_0x5da5('0x21')](_0x47d4e8)[_0x5da5('0x22')]();};}function respondWithResult(_0x2dd138,_0x5d983c){_0x5d983c=_0x5d983c||0xc8;return function(_0x31c6ed){if(_0x31c6ed){return _0x2dd138[_0x5da5('0x21')](_0x5d983c)[_0x5da5('0x23')](_0x31c6ed);}};}function respondWithFilteredResult(_0x21e795,_0x55d517){return function(_0x5b0b43){if(_0x5b0b43){var _0x50aadc=typeof _0x55d517[_0x5da5('0x24')]==='undefined'&&typeof _0x55d517['limit']===_0x5da5('0x25');var _0x3974d8=_0x5b0b43['count'];var _0x1798ae=_0x50aadc?0x0:_0x55d517[_0x5da5('0x24')];var _0x558b12=_0x50aadc?_0x5b0b43[_0x5da5('0x26')]:_0x55d517[_0x5da5('0x24')]+_0x55d517[_0x5da5('0x27')];var _0x42292d;if(_0x558b12>=_0x3974d8){_0x558b12=_0x3974d8;_0x42292d=0xc8;}else{_0x42292d=0xce;}_0x21e795[_0x5da5('0x21')](_0x42292d);return _0x21e795['set'](_0x5da5('0x28'),_0x1798ae+'-'+_0x558b12+'/'+_0x3974d8)[_0x5da5('0x23')](_0x5b0b43);}return null;};}function saveUpdates(_0x31cb5f){return function(_0x15a0c0){if(_0x15a0c0){return _0x15a0c0['update'](_0x31cb5f)['then'](function(_0x4cb022){return _0x4cb022;});}return null;};}function removeEntity(_0x245273){return function(_0x27ed41){if(_0x27ed41){return _0x27ed41[_0x5da5('0x29')]()[_0x5da5('0x2a')](function(){_0x245273['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e115){return function(_0x4afb58){if(!_0x4afb58){_0x24e115['sendStatus'](0x194);}return _0x4afb58;};}function handleError(_0x2dd4b6,_0x4c6cce){_0x4c6cce=_0x4c6cce||0x1f4;return function(_0x42dc92){logger[_0x5da5('0x1c')](_0x42dc92[_0x5da5('0x2b')]);if(_0x42dc92[_0x5da5('0x2c')]){delete _0x42dc92[_0x5da5('0x2c')];}_0x2dd4b6[_0x5da5('0x21')](_0x4c6cce)[_0x5da5('0x2d')](_0x42dc92);};}function getMustacheRender(_0x3dc66a,_0x52ce3c){return Mustache[_0x5da5('0x2e')](_0x3dc66a,_['merge'](_0x52ce3c[_0x5da5('0x2f')],{'contact':_0x52ce3c[_0x5da5('0x30')],'message':_0x52ce3c[_0x5da5('0x1e')],'agent':_0x52ce3c[_0x5da5('0x31')],'interaction':_0x52ce3c[_0x5da5('0x32')],'account':_0x52ce3c[_0x5da5('0x33')]}))||'';}function getInteractionUsers(_0x325ccd,_0x117610){return new BPromise(function(_0xf6c5c9,_0x1828e9){try{if(_0x117610[_0x325ccd['id']]){_0x325ccd[_0x5da5('0x34')]=_[_0x5da5('0x35')](_0x117610[_0x325ccd['id']],function(_0x3ba804){return{'id':_0x3ba804['id'],'fullname':_0x3ba804['fullname']};});}}catch(_0x43686c){_0x1828e9(_0x43686c);}_0xf6c5c9(_0x325ccd);});}function getInteractionTags(_0x4cf3ad,_0x2d6280){return new BPromise(function(_0x40f6c6,_0x29d6aa){try{if(_0x4cf3ad[_0x5da5('0x36')]){_0x4cf3ad['Tags']=[];_0x4cf3ad[_0x5da5('0x36')][_0x5da5('0x37')](',')[_0x5da5('0x38')](function(_0x56fd57){_0x4cf3ad[_0x5da5('0x39')][_0x5da5('0x3a')](_0x2d6280[_0x56fd57]);});}delete _0x4cf3ad['TagIds'];}catch(_0x18d00b){_0x29d6aa(_0x18d00b);}_0x40f6c6(_0x4cf3ad);});}function updateChatInteraction(_0xa90d5,_0xe9888e,_0x38a974){return new BPromise(function(_0x2c9b00,_0x664a8d){return getInteractionUsers(_0xa90d5,_0x38a974)['then'](function(_0x1ab02){return getInteractionTags(_0x1ab02,_0xe9888e);})[_0x5da5('0x2a')](function(_0x14c3f5){return getStateInteraction(_0x14c3f5);})[_0x5da5('0x2a')](function(_0x4466b2){_0x2c9b00(_0x4466b2);})['catch'](function(_0x472e9f){_0x664a8d(_0x472e9f);});});}function getStateInteraction(_0x21ffa1){return new BPromise(function(_0x5a189e){_0x21ffa1[_0x5da5('0x3b')]=0x0;_0x21ffa1['talking']=0x0;_0x21ffa1['answered']=0x0;_0x21ffa1[_0x5da5('0x3c')]=0x0;_0x21ffa1[_0x5da5('0x3d')]=0x0;_0x21ffa1[_0x5da5('0x3e')]=0x0;if(!_0x21ffa1[_0x5da5('0x3f')]&&!_0x21ffa1[_0x5da5('0x40')]){_0x21ffa1[_0x5da5('0x3b')]+=0x1;}if(!_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1[_0x5da5('0x40')]){_0x21ffa1[_0x5da5('0x41')]+=0x1;if(_0x21ffa1[_0x5da5('0x3b')]){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}if(_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1[_0x5da5('0x42')]===_0x5da5('0x3d')){_0x21ffa1[_0x5da5('0x3d')]+=0x1;if(_0x21ffa1[_0x5da5('0x3b')]){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}else if(_0x21ffa1[_0x5da5('0x3f')]&&!_0x21ffa1[_0x5da5('0x40')]&&_0x21ffa1[_0x5da5('0x42')]){_0x21ffa1['unmanaged']+=0x1;if(_0x21ffa1['waiting']){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}else if(_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1['UserId']){_0x21ffa1[_0x5da5('0x43')]+=0x1;if(_0x21ffa1[_0x5da5('0x41')]){_0x21ffa1[_0x5da5('0x41')]-=0x1;}}_0x21ffa1[_0x5da5('0x3e')]+=0x1;_0x5a189e(_0x21ffa1);});}exports[_0x5da5('0x44')]=function(_0x207a7c,_0x2775da){var _0x362028={},_0x3cb7a9={},_0x44de08={'count':0x0,'rows':[]};var _0x4fc584=_[_0x5da5('0x35')](db['ChatInteraction']['rawAttributes'],function(_0x2a0fb6){return{'name':_0x2a0fb6[_0x5da5('0x45')],'type':_0x2a0fb6[_0x5da5('0x46')][_0x5da5('0x47')]};});_0x3cb7a9[_0x5da5('0x48')]=_[_0x5da5('0x35')](_0x4fc584,'name');_0x3cb7a9[_0x5da5('0x49')]=_['keys'](_0x207a7c['query']);_0x3cb7a9[_0x5da5('0x4a')]=_[_0x5da5('0x4b')](_0x3cb7a9['model'],_0x3cb7a9[_0x5da5('0x49')]);_0x362028[_0x5da5('0x4c')]=_[_0x5da5('0x4b')](_0x3cb7a9[_0x5da5('0x48')],qs[_0x5da5('0x4d')](_0x207a7c['query'][_0x5da5('0x4d')]));_0x362028['attributes']=_0x362028['attributes'][_0x5da5('0x4e')]?_0x362028['attributes']:_0x3cb7a9[_0x5da5('0x48')];if(!_0x207a7c[_0x5da5('0x49')][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x362028[_0x5da5('0x27')]=qs[_0x5da5('0x27')](_0x207a7c['query']['limit']);_0x362028[_0x5da5('0x24')]=qs[_0x5da5('0x24')](_0x207a7c['query']['offset']);}_0x362028[_0x5da5('0x51')]=qs['sort'](_0x207a7c[_0x5da5('0x49')]['sort']);_0x362028['where']=qs[_0x5da5('0x4a')](_[_0x5da5('0x52')](_0x207a7c[_0x5da5('0x49')],_0x3cb7a9[_0x5da5('0x4a')]),_0x4fc584);var _0x4c654c=[];var _0x267b07=squel[_0x5da5('0x53')]()[_0x5da5('0x54')]('id')['field'](_0x5da5('0x2c'))[_0x5da5('0x54')](_0x5da5('0x55'))[_0x5da5('0x56')](_0x5da5('0x57'));var _0x2e6460=squel[_0x5da5('0x53')]()[_0x5da5('0x54')](_0x5da5('0x58'))[_0x5da5('0x54')](_0x5da5('0x59'))[_0x5da5('0x54')](_0x5da5('0x5a'))[_0x5da5('0x56')](_0x5da5('0x5b'),'ui')[_0x5da5('0x5c')](_0x5da5('0x5d'),'u',_0x5da5('0x5e'));var _0x191691=squel[_0x5da5('0x53')]()[_0x5da5('0x56')]('chat_interactions','i')[_0x5da5('0x5c')](_0x5da5('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x5da5('0x60'))[_0x5da5('0x5c')](_0x5da5('0x61'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x5da5('0x62'),'me',_0x5da5('0x63'))[_0x5da5('0x5c')](_0x5da5('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x5da5('0x5c')](_0x5da5('0x57'),'t',_0x5da5('0x65'));var _0x4e4ffa=squel[_0x5da5('0x66')]();var _0x5913b3=[];var _0x107211=squel[_0x5da5('0x66')]();var _0x4f0e51;if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x67')]){_0x4f0e51=as[_0x5da5('0x68')](_0x207a7c[_0x5da5('0x49')][_0x5da5('0x67')]);var _0x1252b4=_0x4f0e51[_0x5da5('0x69')];for(var _0x2f9f72=0x0;_0x2f9f72<_0x4f0e51[_0x5da5('0x6a')][_0x5da5('0x4e')];_0x2f9f72++){var _0xb3a7a3=_0x4f0e51[_0x5da5('0x6a')][_0x2f9f72];var _0xd7f04d='i';var _0x1a7f01=_[_0x5da5('0x6b')](_0x4fc584,[_0x5da5('0x2c'),_0xb3a7a3[_0x5da5('0x54')]]);if(!_0x1a7f01){switch(_0xb3a7a3[_0x5da5('0x54')]){case'unreadMessages':if(_0xb3a7a3['value']==0x1){_0x191691[_0x5da5('0x6c')]('`'+_0xb3a7a3[_0x5da5('0x54')]+_0x5da5('0x6d'));}else{_0x191691['having']('`'+_0xb3a7a3[_0x5da5('0x54')]+_0x5da5('0x6e'));}break;case _0x5da5('0x6f'):if(_0xb3a7a3[_0x5da5('0x70')]==='$substring'){if(_0xb3a7a3[_0x5da5('0x71')]['split']('\x20')[_0x5da5('0x4e')]>0x1){_0x4e4ffa[_0x1252b4](_0x5da5('0x72'),qs[_0x5da5('0x73')](_0xb3a7a3[_0x5da5('0x71')]),null);}else{var _0x57966d='%'+_0xb3a7a3[_0x5da5('0x71')]+'%';_0x4e4ffa[_0x1252b4](_0x5da5('0x74'),_0x57966d,_0x57966d,_0x57966d);}}else{_0x1a7f01=_['find'](_0x4fc584,['name','ContactId']);_0xb3a7a3[_0x5da5('0x54')]=_0x5da5('0x75');_0x74801a=as[_0x5da5('0x76')](_0xd7f04d,_0x1a7f01[_0x5da5('0x46')],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')]['end']);}break;case _0x5da5('0x79'):var _0x444b99=_0xb3a7a3['value']['split'](',')[_0x5da5('0x35')](function(_0x5b48e5){return Number(_0x5b48e5);});_0x444b99[_0x5da5('0x38')](function(_0x4f7e64){_0x107211['or'](_0x5da5('0x7a'),'%,'+_0x4f7e64+',%');});_0x5913b3=_[_0x5da5('0x7b')](_0x5913b3,_0x444b99);break;case _0x5da5('0x7c'):if(_0xb3a7a3[_0x5da5('0x70')]===_0x5da5('0x7d')){_0x4e4ffa[_0x1252b4](_0x5da5('0x7e'),'%'+_0xb3a7a3[_0x5da5('0x71')]+'%',null);}else{_0x1a7f01=_[_0x5da5('0x6b')](_0x4fc584,[_0x5da5('0x2c'),_0x5da5('0x40')]);_0xb3a7a3[_0x5da5('0x54')]=_0x5da5('0x40');_0x74801a=as['buildExpression'](_0xd7f04d,_0x1a7f01['type'],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')]['end']);}break;case'body':_0x74801a=as['buildExpression']('me',null,_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x22')]);break;}}else{var _0x74801a=as[_0x5da5('0x76')](_0xd7f04d,_0x1a7f01[_0x5da5('0x46')],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x22')]);}}}else{var _0x3852bf=_(_0x207a7c[_0x5da5('0x49')])[_0x5da5('0x7f')]()[_0x5da5('0x35')](function(_0x242ca9){return _[_0x5da5('0x80')](_0x4fc584,[_0x5da5('0x2c'),_0x242ca9])?_0x242ca9:undefined;})[_0x5da5('0x81')]()['value']();if(!_[_0x5da5('0x82')](_0x3852bf)){_0x3852bf[_0x5da5('0x38')](function(_0x3fc27e){if(_0x3fc27e===_0x5da5('0x83')){_0x191691['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x5da5('0x84')](_0x207a7c['query'][_0x3fc27e]));}else if(_0x3fc27e===_0x5da5('0x85')){var _0x2b2856=JSON[_0x5da5('0x86')](_0x207a7c[_0x5da5('0x49')][_0x3fc27e])[_0x5da5('0x87')];var _0x3b0282=JSON[_0x5da5('0x86')](_0x207a7c[_0x5da5('0x49')][_0x3fc27e])[_0x5da5('0x88')];_0x191691['where'](_0x5da5('0x89'),_0x2b2856,_0x3b0282);}else{if(_0x207a7c['query'][_0x3fc27e]===_0x5da5('0x8a')){_0x191691[_0x5da5('0x8b')]('i.'+_0x3fc27e+'\x20IS\x20NULL');}else{_0x191691[_0x5da5('0x8b')]('i.'+_0x3fc27e+'\x20=\x20?',_0x207a7c[_0x5da5('0x49')][_0x3fc27e]);}}});}if(_0x207a7c['query'][_0x5da5('0x8c')]){if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8c')]==0x1){_0x191691[_0x5da5('0x6c')](_0x5da5('0x8d'));}else{_0x191691[_0x5da5('0x6c')](_0x5da5('0x8e'));}}if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')]){_0x5913b3=_['isArray'](_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')])?_0x207a7c['query']['tag']:new Array(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')]);_0x5913b3[_0x5da5('0x38')](function(_0xcc15e9){_0x107211['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xcc15e9+',%');});}if(_0x207a7c[_0x5da5('0x49')]['filter']){var _0x26aa9f=_0x207a7c['query']['filter'][_0x5da5('0x90')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x26aa9f)){_0x4e4ffa['or'](_0x5da5('0x91'),_0x26aa9f+'%');}else{_0x4e4ffa['or'](_0x5da5('0x92'),qs[_0x5da5('0x73')](_0x26aa9f))['or'](_0x5da5('0x93'),_0x26aa9f+'%');}}}_0x191691[_0x5da5('0x8b')](_0x4e4ffa);_0x191691[_0x5da5('0x94')](_0x5da5('0x95'));var _0x2bdcc1={'type':db['Sequelize'][_0x5da5('0x96')][_0x5da5('0x97')],'raw':!![]};var _0x3fb2e9=_0x191691[_0x5da5('0x98')]();_0x3fb2e9[_0x5da5('0x54')](_0x5da5('0x95'));_0x3fb2e9[_0x5da5('0x54')](_0x5da5('0x99'),_0x5da5('0x9a'));if(_0x362028[_0x5da5('0x51')]){_0x362028[_0x5da5('0x51')][_0x5da5('0x38')](function(_0x104ae6){var _0xed45a1=_0x104ae6[0x0]===_0x5da5('0x9b')?_0x104ae6[0x0]:'i.'+_0x104ae6[0x0];_0x191691[_0x5da5('0x51')](_0xed45a1,_0x104ae6[0x1]===_0x5da5('0x9c')?![]:!![]);});}if(!_[_0x5da5('0x82')](_0x5913b3)){_0x191691[_0x5da5('0x6c')](_0x107211);_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0x9d'),_0x5913b3);}BPromise[_0x5da5('0x9e')]()[_0x5da5('0x2a')](function(){if(!_0x4f0e51){if(_0x207a7c[_0x5da5('0x49')]['ChatWebsiteId'])return;_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0x9f'));_0x191691['where'](_0x5da5('0x9f'));return;}if(_0x207a7c['user'][_0x5da5('0xa0')]!==_0x5da5('0x31'))return;return _0x207a7c[_0x5da5('0xa1')][_0x5da5('0xa2')]({'attributes':['id'],'raw':!![]})[_0x5da5('0x2a')](function(_0x16ceeb){if(_['isEmpty'](_0x16ceeb)){_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0xa3'));_0x191691['where'](_0x5da5('0xa3'));}else{_0x3fb2e9[_0x5da5('0x8b')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5da5('0x35')](_0x16ceeb,'id'));_0x191691[_0x5da5('0x8b')](_0x5da5('0xa4'),_[_0x5da5('0x35')](_0x16ceeb,'id'));}});})[_0x5da5('0x2a')](function(){if(_0x207a7c[_0x5da5('0xa1')][_0x5da5('0xa0')]===_0x5da5('0x31')&&!_0x4f0e51&&!_0x207a7c[_0x5da5('0x49')][_0x5da5('0x83')])return[];return db['sequelize'][_0x5da5('0x49')](_0x3fb2e9[_0x5da5('0xa5')](),_0x2bdcc1);})[_0x5da5('0x2a')](function(_0x23c2a7){_0x44de08[_0x5da5('0x26')]=_0x23c2a7[_0x5da5('0x4e')];if(_0x44de08[_0x5da5('0x26')]===0x0)return[];return db['sequelize']['query'](_0x267b07[_0x5da5('0xa5')](),_0x2bdcc1)['then'](function(_0x5c8ec0){_0x4c654c=_[_0x5da5('0xa6')](_0x5c8ec0,'id');_0x2bdcc1=_['merge'](_0x2bdcc1,{'model':db[_0x5da5('0xa7')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x207a7c['query'][_0x5da5('0x4d')]){_0x362028[_0x5da5('0x4c')][_0x5da5('0x38')](function(_0x3b834f){_0x191691['field']('i.'+_0x3b834f);});}else{_0x191691[_0x5da5('0x54')](_0x5da5('0x99'),_0x5da5('0x9a'));_0x191691[_0x5da5('0x54')](_0x5da5('0xa8'),_0x5da5('0xa9'));_0x191691[_0x5da5('0x54')](_0x5da5('0xaa'),'Account.mandatoryDisposition');_0x191691[_0x5da5('0x54')](_0x5da5('0xab'),'contactName');_0x191691[_0x5da5('0x54')](_0x5da5('0xac'));_0x191691[_0x5da5('0x54')](_0x5da5('0xad'),'Contact.firstName');_0x191691['field'](_0x5da5('0xae'),_0x5da5('0xaf'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb0'),_0x5da5('0xb1'));_0x191691['field'](_0x5da5('0xb2'),_0x5da5('0xb3'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb4'),_0x5da5('0xb5'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb6'),_0x5da5('0xb7'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb8'),_0x5da5('0xb9'));_0x191691[_0x5da5('0x54')](_0x5da5('0xba'),_0x5da5('0xbb'));_0x191691[_0x5da5('0x54')](_0x5da5('0xbc'),_0x5da5('0x36'));}if(_0x362028[_0x5da5('0x27')])_0x191691[_0x5da5('0x27')](_0x362028['limit']);if(_0x362028[_0x5da5('0x24')])_0x191691['offset'](_0x362028[_0x5da5('0x24')]);return db[_0x5da5('0xbd')][_0x5da5('0x49')](_0x191691[_0x5da5('0xa5')](),_0x2bdcc1);})[_0x5da5('0x2a')](function(_0x5b1a72){if(_0x5b1a72[_0x5da5('0x4e')]>0x0)_0x2e6460[_0x5da5('0x8b')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x5b1a72,'id'));return db[_0x5da5('0xbd')]['query'](_0x2e6460[_0x5da5('0xa5')](),_0x2bdcc1)[_0x5da5('0x2a')](function(_0x1782a6){var _0x1b555f=_[_0x5da5('0xbe')](_0x1782a6,_0x5da5('0xbf'));var _0x341587=[];_0x5b1a72['forEach'](function(_0x57b6e4){_0x341587['push'](updateChatInteraction(_0x57b6e4,_0x4c654c,_0x1b555f));});return BPromise[_0x5da5('0xc0')](_0x341587);});});})[_0x5da5('0x2a')](function(_0x101cdc){_0x44de08['rows']=_0x101cdc;return _0x44de08;})[_0x5da5('0x2a')](respondWithFilteredResult(_0x2775da,_0x362028))[_0x5da5('0x20')](handleError(_0x2775da,null));};exports[_0x5da5('0xc1')]=function(_0xbe0ade,_0x3d6503){var _0xd56fa3={'raw':![],'where':{'id':_0xbe0ade[_0x5da5('0xc2')]['id']}},_0x51a597={};_0x51a597[_0x5da5('0x48')]=_[_0x5da5('0x7f')](db['ChatInteraction']['rawAttributes']);_0x51a597[_0x5da5('0x49')]=_[_0x5da5('0x7f')](_0xbe0ade['query']);_0x51a597[_0x5da5('0x4a')]=_[_0x5da5('0x4b')](_0x51a597['model'],_0x51a597[_0x5da5('0x49')]);_0xd56fa3['attributes']=_['intersection'](_0x51a597[_0x5da5('0x48')],qs['fields'](_0xbe0ade[_0x5da5('0x49')]['fields']));_0xd56fa3[_0x5da5('0x4c')]=_0xd56fa3[_0x5da5('0x4c')]['length']?_0xd56fa3[_0x5da5('0x4c')]:_0x51a597[_0x5da5('0x48')];if(_0xbe0ade[_0x5da5('0x49')][_0x5da5('0xc3')]){_0xd56fa3['include']=[{'all':!![]}];}_0xd56fa3=_['merge']({},_0xd56fa3,_0xbe0ade[_0x5da5('0xc4')]);return db[_0x5da5('0xa7')][_0x5da5('0x6b')](_0xd56fa3)[_0x5da5('0x2a')](handleEntityNotFound(_0x3d6503,null))[_0x5da5('0x2a')](respondWithResult(_0x3d6503,null))[_0x5da5('0x20')](handleError(_0x3d6503,null));};exports['create']=function(_0x2ddbcb,_0x314e83){return db[_0x5da5('0xa7')][_0x5da5('0xc5')](_0x2ddbcb['body'],{})['then'](respondWithResult(_0x314e83,0xc9))[_0x5da5('0x20')](handleError(_0x314e83,null));};exports[_0x5da5('0xc6')]=function(_0x44a307,_0x51cd21){if(_0x44a307['body']['id']){delete _0x44a307[_0x5da5('0x2f')]['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x44a307[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x51cd21,null))['then'](saveUpdates(_0x44a307['body'],null))[_0x5da5('0x2a')](respondWithResult(_0x51cd21,null))['catch'](handleError(_0x51cd21,null));};exports[_0x5da5('0x29')]=function(_0x449379,_0x24c565){return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x449379[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x24c565,null))[_0x5da5('0x2a')](removeEntity(_0x24c565,null))[_0x5da5('0x20')](handleError(_0x24c565,null));};exports[_0x5da5('0xc7')]=function(_0x2212b1,_0x401cad){return db['ChatInteraction'][_0x5da5('0xc7')]()[_0x5da5('0x2a')](respondWithResult(_0x401cad,null))['catch'](handleError(_0x401cad,null));};exports[_0x5da5('0xc8')]=function(_0x15ccd3,_0x1971c2){var _0x3385eb=_0x15ccd3[_0x5da5('0xc2')]['id'];var _0xe36532;var _0x3568ee;var _0x2daf1d;return db[_0x5da5('0xa7')][_0x5da5('0xc9')]({'where':{'id':_0x3385eb}})['then'](function(_0x3514b3){_0xe36532=_0x3514b3;return db[_0x5da5('0xca')][_0x5da5('0xc9')]({'where':{'id':_0x3514b3['ChatWebsiteId']},'attributes':['id',_0x5da5('0xcb'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x5da5('0xcc')],'raw':!![]});})[_0x5da5('0x2a')](function(_0x1f06ad){if(_0x1f06ad&&_0x1f06ad[_0x5da5('0xcb')]&&_0x1f06ad['vidaooEscalation']){_0x3568ee=_0x1f06ad;var _0x2e341c={'interaction':{'id':_0x3385eb},'agent':{'id':_0x15ccd3[_0x5da5('0xa1')]['id'],'name':_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0x2c')],'fullname':_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0xcd')],'email':_0x15ccd3[_0x5da5('0xa1')]['email']},'contact':_0x15ccd3[_0x5da5('0x2f')][_0x5da5('0x30')],'account':_0x15ccd3[_0x5da5('0x2f')][_0x5da5('0x33')]};var _0x5d85ff={'rejectUnauthorized':![],'method':_0x5da5('0xce'),'url':_0x5da5('0xcf'),'headers':{'X-APIKEY':_0x1f06ad['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0xd0')]],'buttons':null,'topic':_0x3568ee[_0x5da5('0xd1')],'note':_[_0x5da5('0xd2')](_0x3568ee['vidaooNote'])?null:getMustacheRender(_0x3568ee['vidaooNote'],_0x2e341c),'metadata':null},'redirect':_0x5da5('0xd3'),'json':!![]};try{if(!_[_0x5da5('0xd2')](_0x3568ee[_0x5da5('0xcc')])){var _0x513dc5=getMustacheRender(_0x3568ee[_0x5da5('0xcc')],_0x2e341c);var _0x555728=JSON['parse'](_0x513dc5);_0x5d85ff[_0x5da5('0x2f')][_0x5da5('0xd4')]=_0x555728;}}catch(_0x2623e4){throw new db['Sequelize'][(_0x5da5('0xd5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5d85ff);}else{throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xd6'));}})[_0x5da5('0x2a')](function(_0x5a1bf4){_0x2daf1d=_0x5a1bf4;if(_0x2daf1d['id']){var _0x50d000={'body':_0x2daf1d[_0x5da5('0xd7')],'ChatWebsiteId':_0x3568ee['id'],'ChatInteractionId':_0xe36532['id'],'direction':_0x5da5('0xd8'),'UserId':_0x15ccd3['user']['id']};return db['ChatMessage'][_0x5da5('0xc5')](_0x50d000,{});}else{throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xd9'));}})[_0x5da5('0x2a')](function(){return _0xe36532[_0x5da5('0xda')]({'vidaooSessionId':_0x2daf1d['id']});})[_0x5da5('0x2a')](respondWithResult(_0x1971c2,null))[_0x5da5('0x20')](handleError(_0x1971c2,null));};exports[_0x5da5('0xdb')]=function(_0x17c226,_0x41e33d){if(_0x17c226[_0x5da5('0x2f')]['id']){delete _0x17c226[_0x5da5('0x2f')]['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x17c226[_0x5da5('0xc2')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x5da5('0x2a')](handleEntityNotFound(_0x41e33d,null))[_0x5da5('0x2a')](saveUpdates(_0x17c226[_0x5da5('0x2f')],null))[_0x5da5('0x2a')](respondWithResult(_0x41e33d,null))[_0x5da5('0x20')](handleError(_0x41e33d,null));};exports['abandon']=function(_0x165bc8,_0x21c4f6){if(_0x165bc8[_0x5da5('0x2f')]['id']){delete _0x165bc8['body']['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x165bc8[_0x5da5('0xc2')]['id']}})[_0x5da5('0x2a')](function(_0x303676){if(!_0x303676){logger[_0x5da5('0x1c')](_0x5da5('0xdc'),_0x5da5('0xdd'),0x194,_0x5da5('0xde'));_0x21c4f6[_0x5da5('0xdf')](0x194);}else{if(_0x303676[_0x5da5('0x40')]){throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xe0'));}}return _0x303676;})[_0x5da5('0x2a')](function(_0x4baa4b){if(_0x4baa4b){return _0x4baa4b[_0x5da5('0xc6')]({'closed':_0x165bc8['body'][_0x5da5('0x3f')],'disposition':_0x165bc8[_0x5da5('0x2f')][_0x5da5('0x42')]})['then'](function(_0x562291){return _0x562291;});}})[_0x5da5('0x2a')](function(){return respondWithRpcPromise(_0x5da5('0xe1'),_0x5da5('0xdd'),_0x165bc8[_0x5da5('0x2f')],client9004);})[_0x5da5('0x2a')](respondWithResult(_0x21c4f6,null))[_0x5da5('0x20')](handleError(_0x21c4f6,null));};exports['attachmentUpload']=function(_0x222950,_0x596940){_0x222950[_0x5da5('0x2f')][_0x5da5('0x2c')]=_0x222950[_0x5da5('0xe2')]['originalname'];_0x222950['body'][_0x5da5('0xe3')]=_0x222950[_0x5da5('0xe2')][_0x5da5('0xe4')];_0x222950[_0x5da5('0x2f')][_0x5da5('0x46')]=_0x222950['file']['mimetype'];return db[_0x5da5('0xe5')]['create'](_0x222950[_0x5da5('0x2f')])[_0x5da5('0x2a')](respondWithResult(_0x596940,0xc9))[_0x5da5('0x20')](handleError(_0x596940,null));};exports[_0x5da5('0xe6')]=function(_0x340b1d,_0x22c12d){return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0x340b1d[_0x5da5('0xc2')]['id']},'raw':!![]})[_0x5da5('0x2a')](handleEntityNotFound(_0x22c12d,null))[_0x5da5('0x2a')](function(_0x416760){if(_0x416760){if(_0x416760[_0x5da5('0x3f')]){return _0x22c12d['status'](0x193)[_0x5da5('0x23')]({'status':0x193,'message':_0x5da5('0xe7')});}return db[_0x5da5('0xe5')][_0x5da5('0xc9')]({'where':{'id':_0x340b1d[_0x5da5('0x49')]['attachId']},'raw':!![]})[_0x5da5('0x2a')](handleEntityNotFound(_0x22c12d,null));}})[_0x5da5('0x2a')](function(_0x4f32d7){if(_0x4f32d7){var _0x484c7f=_0x4f32d7['ChatOfflineMessageId']!==null;var _0x15c938=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],'server/files/attachments/');if(_0x484c7f){_0x15c938=path[_0x5da5('0xe8')](_0x15c938,_0x5da5('0xea'));}var _0x480b1e=path[_0x5da5('0xe8')](_0x15c938,_0x4f32d7[_0x5da5('0xe3')]);return _0x22c12d[_0x5da5('0xeb')](_0x480b1e);}})[_0x5da5('0x20')](handleError(_0x22c12d,null));};exports['close']=function(_0x22413b,_0x5e6bb4){var _0x1cce33=null;var _0x2199f2=null;var _0x563113=null;if(_0x22413b[_0x5da5('0x2f')]['id']){delete _0x22413b[_0x5da5('0x2f')]['id'];}if(_0x22413b[_0x5da5('0x2f')][_0x5da5('0xec')]){_0x563113=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],_0x5da5('0xed'),util[_0x5da5('0xee')](_0x5da5('0xef'),Date[_0x5da5('0xf0')]()));_0x22413b[_0x5da5('0x2f')][_0x5da5('0xf1')]=_0x563113;}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x22413b[_0x5da5('0xc2')]['id']},'include':[{'model':db[_0x5da5('0xf2')],'as':_0x5da5('0xf3'),'include':[{'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x7c')}]}]})[_0x5da5('0x2a')](handleEntityNotFound(_0x5e6bb4,null))[_0x5da5('0x2a')](saveUpdates(_0x22413b[_0x5da5('0x2f')],null))[_0x5da5('0x2a')](function(_0x35b7e8){if(_0x35b7e8){_0x1cce33=_0x35b7e8;return db[_0x5da5('0xca')][_0x5da5('0x6b')]({'where':{'id':_0x1cce33[_0x5da5('0x83')]}});}})[_0x5da5('0x2a')](function(_0xafe658){if(_0xafe658){_0x2199f2=_0xafe658;return db[_0x5da5('0xf4')][_0x5da5('0x6b')]({'where':{'id':_0x1cce33[_0x5da5('0x75')]}});}})[_0x5da5('0x2a')](function(_0x2ab9ba){if(_0x2ab9ba){if(_0x563113){var _0x423431=null;for(var _0x231009=0x1;_0x231009<_0x1cce33[_0x5da5('0xf3')][_0x5da5('0x4e')];++_0x231009){_0x423431=_0x1cce33[_0x5da5('0xf3')][_0x231009];var _0x3453ce=_0x423431['UserId']?util['format'](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431['UserId']):'System';var _0xd36fe0=_0x22413b[_0x5da5('0x2f')][_0x5da5('0xf7')]||util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x5da5('0xf8'),_0x423431[_0x5da5('0x75')]);switch(_0x2199f2['agentIdentifier']){case _0x5da5('0xf9'):_0x3453ce=_0x423431[_0x5da5('0x40')]?util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431['UserId']):'System';break;case _0x5da5('0xfa'):_0x3453ce=_0x423431[_0x5da5('0x40')]?_0x423431['User']['alias']||_0x423431[_0x5da5('0x7c')][_0x5da5('0xcd')]:_0x5da5('0xfb');break;case'agent_fullname':_0x3453ce=_0x423431[_0x5da5('0x40')]?_0x423431[_0x5da5('0x7c')]['fullname']:'System';break;default:_0x3453ce=_0x423431[_0x5da5('0x40')]?util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431[_0x5da5('0x40')]):_0x5da5('0xfb');}var _0x3a5453=util['format'](_0x5da5('0xfc'),moment(_0x423431['createdAt'])[_0x5da5('0xee')](_0x5da5('0xfd')),_0x423431[_0x5da5('0xfe')]==='in'?_0xd36fe0:_0x3453ce,_0x423431[_0x5da5('0x2f')]);if(!_0x423431[_0x5da5('0xff')]){fs[_0x5da5('0x100')](_0x563113,_0x3a5453);}}return db[_0x5da5('0x101')][_0x5da5('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x5da5('0x102')],'as':_0x5da5('0x103'),'raw':!![],'include':[{'model':db[_0x5da5('0x104')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x5da5('0x2a')](function(_0x268871){if(!_0x268871||!_0x268871[_0x5da5('0x103')]||!_0x22413b['body'])return _0x1cce33;var _0x118647=_0x268871[_0x5da5('0x105')]();return respondWithRpcPromise(_0x5da5('0x106'),_0x5da5('0x107'),{'account':_0x118647,'message':{'from':util[_0x5da5('0xee')](_0x5da5('0x108'),_0x268871[_0x5da5('0x2c')],_0x268871['email']||_0x268871['Smtp'][_0x5da5('0xa1')]),'to':_0x22413b[_0x5da5('0x2f')][_0x5da5('0xec')],'subject':_0x5da5('0x109'),'text':util['format'](_0x5da5('0x10a'),_0x22413b[_0x5da5('0x2f')]['mailTranscript']),'attachments':[{'path':_0x563113}]}})[_0x5da5('0x2a')](function(){return _0x1cce33;})[_0x5da5('0x20')](function(_0xcfa153){logger['error'](_0xcfa153);});})[_0x5da5('0x2a')](respondWithStatusCode(_0x5e6bb4,0xc8))[_0x5da5('0x20')](handleError(_0x5e6bb4,null));};exports['addMessage']=function(_0x2143f0,_0x245338){return db[_0x5da5('0xf2')][_0x5da5('0x6b')]({'where':{'id':_0x2143f0[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x245338,null))[_0x5da5('0x2a')](function(_0x255556){if(_0x255556){return _0x255556[_0x5da5('0x10b')](_0x2143f0[_0x5da5('0x2f')][_0x5da5('0x10c')],_[_0x5da5('0x10d')](_0x2143f0[_0x5da5('0x2f')],['ids','id'])||{});}})['then'](respondWithResult(_0x245338,null))['catch'](handleError(_0x245338,null));};exports[_0x5da5('0x10e')]=function(_0xf685e2,_0x53f7d1){var _0x3c532e={'raw':![],'where':{}};var _0x5ab150={};var _0x58ef45={'count':0x0,'rows':[]};return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0xf685e2[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x53f7d1,null))[_0x5da5('0x2a')](function(_0x1da022){if(_0x1da022){_0x5ab150['model']=_[_0x5da5('0x7f')](db[_0x5da5('0xf2')][_0x5da5('0x10f')]);_0x5ab150[_0x5da5('0x49')]=_[_0x5da5('0x7f')](_0xf685e2[_0x5da5('0x49')]);_0x5ab150['filters']=_['intersection'](_0x5ab150[_0x5da5('0x48')],_0x5ab150[_0x5da5('0x49')]);_0x3c532e['attributes']=_[_0x5da5('0x4b')](_0x5ab150[_0x5da5('0x48')],qs[_0x5da5('0x4d')](_0xf685e2['query']['fields']));_0x3c532e['attributes']=_0x3c532e[_0x5da5('0x4c')][_0x5da5('0x4e')]?_0x3c532e[_0x5da5('0x4c')]:_0x5ab150[_0x5da5('0x48')];if(!_0xf685e2['query'][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x3c532e[_0x5da5('0x27')]=qs[_0x5da5('0x27')](_0xf685e2['query']['limit']);_0x3c532e[_0x5da5('0x24')]=qs[_0x5da5('0x24')](_0xf685e2[_0x5da5('0x49')]['offset']);}_0x3c532e[_0x5da5('0x51')]=qs[_0x5da5('0x110')](_0xf685e2['query']['sort']);_0x3c532e[_0x5da5('0x8b')]=qs['filters'](_[_0x5da5('0x52')](_0xf685e2[_0x5da5('0x49')],_0x5ab150[_0x5da5('0x4a')]));_0x3c532e[_0x5da5('0x8b')]['ChatInteractionId']=_0x1da022['id'];if(_0xf685e2['query'][_0x5da5('0x111')]){_0x3c532e[_0x5da5('0x8b')]=_[_0x5da5('0x112')](_0x3c532e[_0x5da5('0x8b')],{'$or':_[_0x5da5('0x35')](_0x3c532e[_0x5da5('0x4c')],function(_0x5e81d){var _0x41cd89={};_0x41cd89[_0x5e81d]={'$like':'%'+_0xf685e2['query'][_0x5da5('0x111')]+'%'};return _0x41cd89;})});}if(_0xf685e2[_0x5da5('0x49')]['$gte']){var _0x4b0dcd=_0xf685e2[_0x5da5('0x49')][_0x5da5('0x87')]['split'](',');var _0x663647={};_0x663647[_0x4b0dcd[0x0]]={'$gte':moment(_0x4b0dcd[0x1])[_0x5da5('0xee')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c532e[_0x5da5('0x8b')]=_['merge'](_0x3c532e[_0x5da5('0x8b')],_0x663647);}_0x3c532e=_[_0x5da5('0x112')]({},_0x3c532e,_0xf685e2[_0x5da5('0xc4')]);return db[_0x5da5('0xf2')]['count']({'where':_0x3c532e[_0x5da5('0x8b')]})[_0x5da5('0x2a')](function(_0x2226d4){_0x58ef45[_0x5da5('0x26')]=_0x2226d4;if(_0xf685e2['query'][_0x5da5('0xc3')]){_0x3c532e[_0x5da5('0x113')]=[{'all':!![]}];}return db['ChatMessage'][_0x5da5('0x114')](_0x3c532e);})[_0x5da5('0x2a')](function(_0x3c2680){_0x58ef45[_0x5da5('0x115')]=_0x3c2680;return _0x58ef45;});}})[_0x5da5('0x2a')](respondWithFilteredResult(_0x53f7d1,_0x3c532e))[_0x5da5('0x20')](handleError(_0x53f7d1,null));};exports[_0x5da5('0x116')]=function(_0x455bf5,_0x3215b8){var _0x93fc22={'where':{}},_0x29a452={},_0xc0ad3b={'count':0x0,'rows':[]};return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0x455bf5['params']['id']}})['then'](handleEntityNotFound(_0x3215b8,null))['then'](function(_0x2075f8){if(_0x2075f8){_0x29a452[_0x5da5('0x48')]=_['keys'](db['ChatMessage'][_0x5da5('0x10f')]);_0x29a452['query']=_[_0x5da5('0x7f')](_0x455bf5[_0x5da5('0x49')]);_0x29a452['filters']=_[_0x5da5('0x4b')](_0x29a452['model'],_0x29a452[_0x5da5('0x49')]);_0x93fc22[_0x5da5('0x4c')]=_[_0x5da5('0x4b')](_0x29a452['model'],qs['fields'](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x4d')]));_0x93fc22[_0x5da5('0x4c')]=_0x93fc22[_0x5da5('0x4c')][_0x5da5('0x4e')]?_0x93fc22[_0x5da5('0x4c')]:_0x29a452[_0x5da5('0x48')];if(!_0x455bf5[_0x5da5('0x49')][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x93fc22['limit']=qs[_0x5da5('0x27')](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x27')]);_0x93fc22['offset']=qs[_0x5da5('0x24')](_0x455bf5[_0x5da5('0x49')]['offset']);}_0x93fc22[_0x5da5('0x51')]=qs['sort'](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x110')]);_0x93fc22[_0x5da5('0x8b')]=qs[_0x5da5('0x4a')](_[_0x5da5('0x52')](_0x455bf5[_0x5da5('0x49')],_0x29a452['filters']));_0x93fc22['where'][_0x5da5('0xbf')]=_0x2075f8['id'];if(_0x455bf5[_0x5da5('0x49')]['filter']){_0x93fc22[_0x5da5('0x8b')]=_[_0x5da5('0x112')](_0x93fc22[_0x5da5('0x8b')],{'$or':_['map'](_0x93fc22[_0x5da5('0x4c')],function(_0x5b20d9){var _0x54df1a={};_0x54df1a[_0x5b20d9]={'$like':'%'+_0x455bf5[_0x5da5('0x49')][_0x5da5('0x111')]+'%'};return _0x54df1a;})});}_0x93fc22['where'][_0x5da5('0xff')]=![];if(_0x455bf5['query']['id']){_0x93fc22[_0x5da5('0x8b')]['id']={'$gt':_0x455bf5[_0x5da5('0x49')]['id']};}_0x93fc22=_[_0x5da5('0x112')]({},_0x93fc22,_0x455bf5[_0x5da5('0xc4')]);return db['ChatMessage'][_0x5da5('0x26')]({'where':_0x93fc22[_0x5da5('0x8b')]})[_0x5da5('0x2a')](function(_0x70f31d){_0xc0ad3b[_0x5da5('0x26')]=_0x70f31d;_0x93fc22['include']=[];if(_0x455bf5[_0x5da5('0x49')][_0x5da5('0x117')]){_0x93fc22[_0x5da5('0x113')][_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':'User','attributes':['id',_0x5da5('0xcd'),'alias']});}if(_0x455bf5['query'][_0x5da5('0xc3')]){_0x93fc22['include']=[{'all':!![]}];}return db[_0x5da5('0xf2')][_0x5da5('0x114')](_0x93fc22);})[_0x5da5('0x2a')](function(_0x21d019){_0xc0ad3b[_0x5da5('0x115')]=_0x21d019;return _0xc0ad3b;});}})[_0x5da5('0x2a')](respondWithFilteredResult(_0x3215b8,_0x93fc22))[_0x5da5('0x20')](handleError(_0x3215b8,null));};exports[_0x5da5('0x118')]=function(_0x199ab0,_0x38f596){return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x199ab0[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x38f596,null))['then'](function(_0x5f4410){if(_0x5f4410){return _0x5f4410[_0x5da5('0x119')](_0x199ab0[_0x5da5('0x2f')][_0x5da5('0x10c')],_[_0x5da5('0x10d')](_0x199ab0[_0x5da5('0x2f')],['ids','id'])||{})[_0x5da5('0x11a')](function(){return db[_0x5da5('0x79')][_0x5da5('0x114')]({'attributes':['id',_0x5da5('0x2c'),_0x5da5('0x55')],'where':{'id':_0x199ab0['body'][_0x5da5('0x10c')]}});})[_0x5da5('0x2a')](function(_0xb897d){socket[_0x5da5('0x11b')]('chatInteractionTags:save',{'id':Number(_0x199ab0[_0x5da5('0xc2')]['id']),'tags':_0xb897d||[]});return{'id':Number(_0x199ab0[_0x5da5('0xc2')]['id']),'tags':_0xb897d||[]};});}})[_0x5da5('0x2a')](respondWithResult(_0x38f596,null))[_0x5da5('0x20')](handleError(_0x38f596,null));};exports['removeTags']=function(_0x2fd629,_0x3213c8){return db['ChatInteraction'][_0x5da5('0x6b')]({'where':{'id':_0x2fd629[_0x5da5('0xc2')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x3213c8,null))[_0x5da5('0x2a')](function(_0x58fe7d){if(_0x58fe7d){return _0x58fe7d[_0x5da5('0x11c')](_0x2fd629[_0x5da5('0x49')][_0x5da5('0x10c')]);}})[_0x5da5('0x2a')](respondWithStatusCode(_0x3213c8,null))[_0x5da5('0x20')](handleError(_0x3213c8,null));};exports[_0x5da5('0xeb')]=function(_0x10e296,_0x3a6962){var _0xe1a9c2=moment()[_0x5da5('0x11d')]()[_0x5da5('0xa5')]();var _0x13950f=path[_0x5da5('0xe8')](config['root'],_0x5da5('0x11e'),_0x5da5('0x11f'),_0x5da5('0x120'));var _0x1800d0=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],_0x5da5('0x11e'),_0x5da5('0x11f'),_0x5da5('0x121'));var _0x454639=path[_0x5da5('0xe8')](_0x13950f,_0xe1a9c2);var _0x1cddaf=util[_0x5da5('0xee')](_0x5da5('0x122'),_0x10e296[_0x5da5('0xc2')]['id'],_0xe1a9c2);var _0x11394e=path[_0x5da5('0xe8')](_0x13950f,_0x1cddaf);var _0x4413c3=[];_0x4413c3[_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x7c'),'attributes':['id',_0x5da5('0xcd')],'raw':!![]});_0x4413c3[_0x5da5('0x3a')]({'model':db[_0x5da5('0xf4')],'as':_0x5da5('0x6f'),'attributes':['id',_0x5da5('0x123'),_0x5da5('0x124')],'raw':!![]});if(_0x10e296[_0x5da5('0x49')][_0x5da5('0x121')]){_0x4413c3[_0x5da5('0x3a')]({'model':db['Attachment'],'as':_0x5da5('0xe5'),'raw':!![]});}var _0x3203e7=[{'model':db[_0x5da5('0xf2')],'as':'Messages','attributes':['id',_0x5da5('0x2f'),_0x5da5('0x85'),_0x5da5('0xfe'),'secret',_0x5da5('0x8c')],'include':_0x4413c3}];_0x3203e7[_0x5da5('0x3a')]({'model':db[_0x5da5('0xca')],'as':_0x5da5('0x125'),'attributes':['id',_0x5da5('0x2c')]});_0x3203e7[_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x126'),'attributes':['id',_0x5da5('0xcd')]});return db['ChatInteraction'][_0x5da5('0x6b')]({'where':{'id':_0x10e296[_0x5da5('0xc2')]['id']},'include':_0x3203e7})[_0x5da5('0x2a')](handleEntityNotFound(_0x3a6962,null))[_0x5da5('0x2a')](function(_0x512d10){if(_0x512d10){var _0x2b7834=_0x512d10[_0x5da5('0x127')]({'plain':!![]});fs[_0x5da5('0x128')](_0x454639);var _0x182053={'channel':_0x5da5('0x129'),'account':_0x2b7834[_0x5da5('0x125')]['name'],'agent':_0x2b7834['Owner']?_0x2b7834[_0x5da5('0x126')][_0x5da5('0xcd')]:_0x5da5('0x12a'),'createdAt':moment(_0x2b7834['createdAt'])[_0x5da5('0xee')](_0x5da5('0x12b'))[_0x5da5('0xa5')](),'closedAt':_0x2b7834[_0x5da5('0x3f')]?moment(_0x2b7834[_0x5da5('0x12c')])[_0x5da5('0xee')](_0x5da5('0x12b'))[_0x5da5('0xa5')]():'','disposition':_0x2b7834[_0x5da5('0x42')],'chatInfo':{'browser':_0x2b7834[_0x5da5('0x12d')],'os':_0x2b7834[_0x5da5('0x12e')],'referer':_0x2b7834[_0x5da5('0x12f')],'customerIp':_0x2b7834[_0x5da5('0x130')],'customerPort':_0x2b7834[_0x5da5('0x131')]?_0x2b7834[_0x5da5('0x131')]:'N.A.'},'messages':_(_0x2b7834[_0x5da5('0xf3')])[_0x5da5('0x132')]()[_0x5da5('0x111')]({'secret':![]})[_0x5da5('0x35')](function(_0x4aeb17){if(_0x4aeb17[_0x5da5('0xe5')]){var _0x35c55f=path[_0x5da5('0xe8')](_0x1800d0,_0x4aeb17['Attachment'][_0x5da5('0xe3')]);if(fs[_0x5da5('0x133')](_0x35c55f)){fs[_0x5da5('0x134')](_0x35c55f)['pipe'](fs[_0x5da5('0x135')](path['join'](_0x454639,_0x4aeb17[_0x5da5('0xe5')][_0x5da5('0xe3')])));}}return{'date':moment(_0x4aeb17[_0x5da5('0x85')])[_0x5da5('0xee')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5da5('0xa5')](),'sender':_0x4aeb17[_0x5da5('0xfe')]==='out'?_0x4aeb17[_0x5da5('0x7c')]?_0x4aeb17[_0x5da5('0x7c')][_0x5da5('0xcd')]:_0x5da5('0xfb'):_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x123')]+(_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x124')]?'\x20'+_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x124')]:''),'body':_0x4aeb17['Attachment']?_0x4aeb17[_0x5da5('0xe5')][_0x5da5('0xe3')]:_0x4aeb17['body'],'direction':_0x4aeb17[_0x5da5('0xfe')]===_0x5da5('0xd8')?'A':'C','secret':_0x4aeb17[_0x5da5('0xff')],'read':_0x4aeb17[_0x5da5('0x8c')],'attachment':_0x4aeb17['Attachment']};})[_0x5da5('0x71')]()};return ejs['renderFile'](path[_0x5da5('0xe8')](config['root'],_0x5da5('0x11e'),_0x5da5('0x136'),'downloadInteraction.ejs'),{'interaction':_0x182053})[_0x5da5('0x2a')](function(_0x4c13d8){var _0x15e4f9=path['join'](_0x454639,_0x5da5('0x137')+_0x2b7834['id']+'-'+_0xe1a9c2+'.pdf');var _0x5c31c7={'path':_0x15e4f9,'channel':_0x5da5('0x129'),'interactionId':_0x2b7834['id']};return pdf[_0x5da5('0x138')](_0x4c13d8,_0x5c31c7);})[_0x5da5('0x2a')](function(){return new Promise(function(_0x344da7,_0x44774c){zipdir(_0x454639,{'saveTo':_0x11394e},function(_0x1c3d84,_0x2e06f4){if(_0x1c3d84)return _0x44774c(_0x1c3d84);return _0x344da7(_0x2e06f4);});})[_0x5da5('0x2a')](function(){return new BPromise(function(_0xc2e222,_0x1560a5){rimraf(_0x454639,function(_0x464cd6){if(_0x464cd6)_0x1560a5(_0x464cd6);return _0xc2e222();});});})[_0x5da5('0x2a')](function(){return _0x3a6962['download'](_0x11394e,_0x1cddaf,function(_0x5bb2be){if(_0x5bb2be){logger[_0x5da5('0x1c')]('err',_0x5bb2be);}else{fs[_0x5da5('0x139')](_0x11394e);}});});});}else{return _0x3a6962[_0x5da5('0xdf')](0xc8);}})[_0x5da5('0x20')](handleError(_0x3a6962,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index feda90f..7616b10 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 _0x00b3=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','save','update','getUsers'];(function(_0x30e4dc,_0x3087c8){var _0x54245c=function(_0x2d7e1c){while(--_0x2d7e1c){_0x30e4dc['push'](_0x30e4dc['shift']());}};_0x54245c(++_0x3087c8);}(_0x00b3,0x170));var _0x300b=function(_0x2b2b3e,_0x206c3b){_0x2b2b3e=_0x2b2b3e-0x0;var _0x1bc311=_0x00b3[_0x2b2b3e];return _0x1bc311;};'use strict';var EventEmitter=require(_0x300b('0x0'));var ChatInteraction=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var ChatMessage=require(_0x300b('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x300b('0x3'),'afterUpdate':_0x300b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1d4caa){return function(_0x20aeb7,_0x3891ce,_0x5489b1){_0x20aeb7[_0x300b('0x5')]({'attributes':['id'],'raw':!![]})[_0x300b('0x6')](function(_0x50df4c){_0x20aeb7[_0x300b('0x7')](_0x300b('0x8'),_0x50df4c[_0x300b('0x9')](function(_0x6a8fff){return{'id':_0x6a8fff['id']};}));return ChatMessage[_0x300b('0xa')]({'where':{'ChatInteractionId':_0x20aeb7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x300b('0x6')](function(_0x21f6c1){_0x20aeb7['setDataValue']('unreadMessages',_0x21f6c1[_0x300b('0xb')]);ChatInteractionEvents['emit'](_0x1d4caa+':'+_0x20aeb7['id'],_0x20aeb7);ChatInteractionEvents[_0x300b('0xc')](_0x1d4caa,_0x20aeb7);_0x5489b1(null);})[_0x300b('0xd')](_0x5489b1(null));};}for(var e in events){if(events[_0x300b('0xe')](e)){var event=events[e];ChatInteraction[_0x300b('0xf')](e,emitEvent(event));}}module[_0x300b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x10cf=['catch','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','remove','setDataValue','Users','map','findAll','length','emit'];(function(_0x2cb147,_0x35d804){var _0xd5d41f=function(_0x4d8584){while(--_0x4d8584){_0x2cb147['push'](_0x2cb147['shift']());}};_0xd5d41f(++_0x35d804);}(_0x10cf,0x73));var _0xf10c=function(_0x47f5f6,_0x7aa8cd){_0x47f5f6=_0x47f5f6-0x0;var _0x3e7445=_0x10cf[_0x47f5f6];return _0x3e7445;};'use strict';var EventEmitter=require(_0xf10c('0x0'));var ChatInteraction=require(_0xf10c('0x1'))['db'][_0xf10c('0x2')];var ChatMessage=require(_0xf10c('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf10c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf10c('0x4')};function emitEvent(_0x2074ea){return function(_0x1522f9,_0x446bad,_0x2e649e){_0x1522f9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ca25b){_0x1522f9[_0xf10c('0x5')](_0xf10c('0x6'),_0x2ca25b[_0xf10c('0x7')](function(_0x4e7b4c){return{'id':_0x4e7b4c['id']};}));return ChatMessage[_0xf10c('0x8')]({'where':{'ChatInteractionId':_0x1522f9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5992a2){_0x1522f9[_0xf10c('0x5')]('unreadMessages',_0x5992a2[_0xf10c('0x9')]);ChatInteractionEvents[_0xf10c('0xa')](_0x2074ea+':'+_0x1522f9['id'],_0x1522f9);ChatInteractionEvents[_0xf10c('0xa')](_0x2074ea,_0x1522f9);_0x2e649e(null);})[_0xf10c('0xb')](_0x2e649e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xf10c('0xc')](e,emitEvent(event));}}module[_0xf10c('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2abb6ad..451a956 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 _0x661a=['closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x237d67,_0x4ff2db){var _0x292dfb=function(_0x565a7d){while(--_0x565a7d){_0x237d67['push'](_0x237d67['shift']());}};_0x292dfb(++_0x4ff2db);}(_0x661a,0xaa));var _0xa661=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0x661a[_0x628eee];return _0x447718;};'use strict';var _=require(_0xa661('0x0'));var util=require(_0xa661('0x1'));var logger=require('../../config/logger')(_0xa661('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa661('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa661('0x4'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xa661('0x5')]=function(_0xc2da46,_0x5e1af9){return _0xc2da46[_0xa661('0x6')](_0xa661('0x7'),attributes,{'tableName':_0xa661('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2dce78,_0x1da5a0,_0x861c1c){if(_0x2dce78[_0xa661('0x9')](_0xa661('0xa'))){_0x2dce78[_0xa661('0xb')]=moment()[_0xa661('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x861c1c(null,_0x2dce78);}},'charset':_0xa661('0xd'),'collate':_0xa661('0xe')});}; \ No newline at end of file +var _0x672c=['moment','bluebird','rimraf','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x352ec6,_0x43fce0){var _0x221d8e=function(_0x595072){while(--_0x595072){_0x352ec6['push'](_0x352ec6['shift']());}};_0x221d8e(++_0x43fce0);}(_0x672c,0x1bf));var _0xc672=function(_0x46210b,_0x3e08fa){_0x46210b=_0x46210b-0x0;var _0x448b89=_0x672c[_0x46210b];return _0x448b89;};'use strict';var _=require(_0xc672('0x0'));var util=require(_0xc672('0x1'));var logger=require(_0xc672('0x2'))('api');var moment=require(_0xc672('0x3'));var BPromise=require(_0xc672('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc672('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xc672('0x6')]=function(_0x8a65e9,_0x24c545){return _0x8a65e9['define'](_0xc672('0x7'),attributes,{'tableName':_0xc672('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16071a,_0x507bf1,_0x4385cc){if(_0x16071a[_0xc672('0x9')]('closed')){_0x16071a[_0xc672('0xa')]=moment()[_0xc672('0xb')](_0xc672('0xc'));}_0x4385cc(null,_0x16071a);}},'charset':_0xc672('0xd'),'collate':_0xc672('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 51b017a..9837cc4 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 _0x3e31=['where','attributes','limit','debug','catch','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateChatInteraction','ChatInteraction','update','options','raw'];(function(_0x1177f0,_0x508e3e){var _0x3dca9e=function(_0x2f8571){while(--_0x2f8571){_0x1177f0['push'](_0x1177f0['shift']());}};_0x3dca9e(++_0x508e3e);}(_0x3e31,0x10d));var _0x13e3=function(_0x222b59,_0x45b188){_0x222b59=_0x222b59-0x0;var _0x18f9c2=_0x3e31[_0x222b59];return _0x18f9c2;};'use strict';var _=require(_0x13e3('0x0'));var util=require(_0x13e3('0x1'));var moment=require(_0x13e3('0x2'));var BPromise=require(_0x13e3('0x3'));var rs=require(_0x13e3('0x4'));var fs=require('fs');var Redis=require(_0x13e3('0x5'));var db=require(_0x13e3('0x6'))['db'];var utils=require(_0x13e3('0x7'));var logger=require('../../config/logger')(_0x13e3('0x8'));var config=require(_0x13e3('0x9'));var jayson=require(_0x13e3('0xa'));var client=jayson[_0x13e3('0xb')][_0x13e3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x13e3('0xd')],{'host':_0x13e3('0xe'),'port':0x18eb});var socket=require(_0x13e3('0xf'))(new Redis(config[_0x13e3('0xd')]));require(_0x13e3('0x10'))[_0x13e3('0x11')](socket);function respondWithRpcPromise(_0x6c9ca8,_0x3082a2,_0x1a7f1c){return new BPromise(function(_0x4e7868,_0x45a9dd){return client['request'](_0x6c9ca8,_0x1a7f1c)[_0x13e3('0x12')](function(_0xea6c8e){logger['info'](_0x13e3('0x13'),_0x3082a2,_0x13e3('0x14'));logger['debug'](_0x13e3('0x15'),_0x3082a2,'request\x20sent',JSON[_0x13e3('0x16')](_0xea6c8e));if(_0xea6c8e['error']){if(_0xea6c8e[_0x13e3('0x17')][_0x13e3('0x18')]===0x1f4){logger[_0x13e3('0x17')](_0x13e3('0x13'),_0x3082a2,_0xea6c8e['error'][_0x13e3('0x19')]);return _0x45a9dd(_0xea6c8e[_0x13e3('0x17')]['message']);}logger[_0x13e3('0x17')](_0x13e3('0x13'),_0x3082a2,_0xea6c8e[_0x13e3('0x17')][_0x13e3('0x19')]);return _0x4e7868(_0xea6c8e['error'][_0x13e3('0x19')]);}else{logger[_0x13e3('0x1a')](_0x13e3('0x13'),_0x3082a2,_0x13e3('0x14'));_0x4e7868(_0xea6c8e['result'][_0x13e3('0x19')]);}})['catch'](function(_0x3ec74b){logger[_0x13e3('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x3082a2,_0x3ec74b);_0x45a9dd(_0x3ec74b);});});}exports[_0x13e3('0x1b')]=function(_0x36ba6d){var _0x589b62=this;return new Promise(function(_0x398eed,_0x3742bf){return db[_0x13e3('0x1c')][_0x13e3('0x1d')](_0x36ba6d['body'],{'raw':_0x36ba6d[_0x13e3('0x1e')]?_0x36ba6d['options'][_0x13e3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36ba6d['options']?_0x36ba6d[_0x13e3('0x1e')][_0x13e3('0x20')]||null:null,'attributes':_0x36ba6d['options']?_0x36ba6d[_0x13e3('0x1e')][_0x13e3('0x21')]||null:null,'limit':_0x36ba6d[_0x13e3('0x1e')]?_0x36ba6d['options'][_0x13e3('0x22')]||null:null})[_0x13e3('0x12')](function(_0xe3f43b){logger['info'](_0x13e3('0x1b'),_0x36ba6d);logger[_0x13e3('0x23')](_0x13e3('0x1b'),_0x36ba6d,JSON[_0x13e3('0x16')](_0xe3f43b));_0x398eed(_0xe3f43b);})[_0x13e3('0x24')](function(_0x1e09ab){logger[_0x13e3('0x17')](_0x13e3('0x1b'),_0x1e09ab[_0x13e3('0x19')],_0x36ba6d);_0x3742bf(_0x589b62['error'](0x1f4,_0x1e09ab['message']));});});};exports['AddTagsToChatInteraction']=function(_0x2308da){return new Promise(function(_0x122e3b,_0x29d6cc){return db[_0x13e3('0x1c')][_0x13e3('0x25')]({'where':_0x2308da['options']?_0x2308da['options'][_0x13e3('0x20')]||null:null})[_0x13e3('0x12')](function(_0x4fb343){if(_0x4fb343){return _0x4fb343[_0x13e3('0x26')](_0x2308da[_0x13e3('0x27')][_0x13e3('0x28')],_['omit'](_0x2308da['body'],[_0x13e3('0x28'),'id'])||{});}})[_0x13e3('0x29')](function(_0x569ee5){logger[_0x13e3('0x1a')](_0x13e3('0x2a'),_0x2308da);logger[_0x13e3('0x23')]('AddTags',_0x2308da,JSON['stringify'](_0x569ee5));_0x122e3b(_0x569ee5);})[_0x13e3('0x24')](function(_0x3e91b){logger[_0x13e3('0x17')](_0x13e3('0x2a'),_0x3e91b[_0x13e3('0x19')],_0x2308da);_0x29d6cc(_this[_0x13e3('0x17')](0x1f4,_0x3e91b[_0x13e3('0x19')]));});});}; \ No newline at end of file +var _0x21bd=['find','where','then','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','limit','AddTagsToChatInteraction'];(function(_0x4eccbe,_0x4676c7){var _0x59964a=function(_0x29513b){while(--_0x29513b){_0x4eccbe['push'](_0x4eccbe['shift']());}};_0x59964a(++_0x4676c7);}(_0x21bd,0x83));var _0xd21b=function(_0x3706e9,_0x5bafe4){_0x3706e9=_0x3706e9-0x0;var _0x4a96c1=_0x21bd[_0x3706e9];return _0x4a96c1;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var moment=require(_0xd21b('0x2'));var BPromise=require(_0xd21b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd21b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd21b('0x5'));var logger=require(_0xd21b('0x6'))(_0xd21b('0x7'));var config=require(_0xd21b('0x8'));var jayson=require(_0xd21b('0x9'));var client=jayson[_0xd21b('0xa')]['http']({'port':0x232a});config[_0xd21b('0xb')]=_[_0xd21b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd21b('0xd'))(new Redis(config[_0xd21b('0xb')]));require(_0xd21b('0xe'))[_0xd21b('0xf')](socket);function respondWithRpcPromise(_0x367dc3,_0x16a382,_0x18bf18){return new BPromise(function(_0x741ac7,_0x2363da){return client[_0xd21b('0x10')](_0x367dc3,_0x18bf18)['then'](function(_0x372192){logger['info'](_0xd21b('0x11'),_0x16a382,'request\x20sent');logger[_0xd21b('0x12')](_0xd21b('0x13'),_0x16a382,'request\x20sent',JSON[_0xd21b('0x14')](_0x372192));if(_0x372192[_0xd21b('0x15')]){if(_0x372192[_0xd21b('0x15')]['code']===0x1f4){logger[_0xd21b('0x15')](_0xd21b('0x11'),_0x16a382,_0x372192['error'][_0xd21b('0x16')]);return _0x2363da(_0x372192[_0xd21b('0x15')][_0xd21b('0x16')]);}logger[_0xd21b('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x16a382,_0x372192[_0xd21b('0x15')]['message']);return _0x741ac7(_0x372192['error'][_0xd21b('0x16')]);}else{logger[_0xd21b('0x17')](_0xd21b('0x11'),_0x16a382,'request\x20sent');_0x741ac7(_0x372192[_0xd21b('0x18')][_0xd21b('0x16')]);}})[_0xd21b('0x19')](function(_0x5f4fbd){logger['error'](_0xd21b('0x11'),_0x16a382,_0x5f4fbd);_0x2363da(_0x5f4fbd);});});}exports[_0xd21b('0x1a')]=function(_0x3b6b51){var _0x17800d=this;return new Promise(function(_0x494c52,_0x82fcba){return db[_0xd21b('0x1b')][_0xd21b('0x1c')](_0x3b6b51['body'],{'raw':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')][_0xd21b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')]['where']||null:null,'attributes':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')]['attributes']||null:null,'limit':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51['options'][_0xd21b('0x1f')]||null:null})['then'](function(_0x4c580c){logger[_0xd21b('0x17')](_0xd21b('0x1a'),_0x3b6b51);logger[_0xd21b('0x12')](_0xd21b('0x1a'),_0x3b6b51,JSON[_0xd21b('0x14')](_0x4c580c));_0x494c52(_0x4c580c);})['catch'](function(_0x5393fe){logger[_0xd21b('0x15')](_0xd21b('0x1a'),_0x5393fe['message'],_0x3b6b51);_0x82fcba(_0x17800d['error'](0x1f4,_0x5393fe[_0xd21b('0x16')]));});});};exports[_0xd21b('0x20')]=function(_0x1b65f6){return new Promise(function(_0x8ce25d,_0x3ea1e9){return db['ChatInteraction'][_0xd21b('0x21')]({'where':_0x1b65f6['options']?_0x1b65f6[_0xd21b('0x1d')][_0xd21b('0x22')]||null:null})[_0xd21b('0x23')](function(_0x42d013){if(_0x42d013){return _0x42d013[_0xd21b('0x24')](_0x1b65f6['body'][_0xd21b('0x25')],_[_0xd21b('0x26')](_0x1b65f6[_0xd21b('0x27')],[_0xd21b('0x25'),'id'])||{});}})['spread'](function(_0x2dfcf1){logger[_0xd21b('0x17')](_0xd21b('0x28'),_0x1b65f6);logger[_0xd21b('0x12')]('AddTags',_0x1b65f6,JSON[_0xd21b('0x14')](_0x2dfcf1));_0x8ce25d(_0x2dfcf1);})[_0xd21b('0x19')](function(_0x4b8b54){logger['error'](_0xd21b('0x28'),_0x4b8b54[_0xd21b('0x16')],_0x1b65f6);_0x3ea1e9(_this[_0xd21b('0x15')](0x1f4,_0x4b8b54[_0xd21b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f646fd8..1a42ba1 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 _0x1d18=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x4aabec,_0xf02f7e){var _0xc4ea3=function(_0x352942){while(--_0x352942){_0x4aabec['push'](_0x4aabec['shift']());}};_0xc4ea3(++_0xf02f7e);}(_0x1d18,0x10d));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x81d1('0x0'));var events=[_0x81d1('0x1'),_0x81d1('0x2'),_0x81d1('0x3')];function createListener(_0x10c31e,_0x5e7f36){return function(_0x368e61){_0x5e7f36['emit'](_0x10c31e,_0x368e61);};}function removeListener(_0x45bba6,_0x25d207){return function(){ChatInteractionEvents['removeListener'](_0x45bba6,_0x25d207);};}exports[_0x81d1('0x4')]=function(_0x225218){for(var _0x5742ce=0x0,_0x1d8664=events[_0x81d1('0x5')];_0x5742ce<_0x1d8664;_0x5742ce++){var _0x5ecee5=events[_0x5742ce];var _0xa4dbc0=createListener(_0x81d1('0x6')+_0x5ecee5,_0x225218);ChatInteractionEvents['on'](_0x5ecee5,_0xa4dbc0);}}; \ No newline at end of file +var _0x8cd9=['remove','update','emit','removeListener','chatInteraction:','./chatInteraction.events','save'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x8cd9,0x186));var _0x98cd=function(_0x55e773,_0x4c1e79){_0x55e773=_0x55e773-0x0;var _0xe29927=_0x8cd9[_0x55e773];return _0xe29927;};'use strict';var ChatInteractionEvents=require(_0x98cd('0x0'));var events=[_0x98cd('0x1'),_0x98cd('0x2'),_0x98cd('0x3')];function createListener(_0x46677d,_0x37c155){return function(_0x355efa){_0x37c155[_0x98cd('0x4')](_0x46677d,_0x355efa);};}function removeListener(_0x1c8b4f,_0x209fc5){return function(){ChatInteractionEvents[_0x98cd('0x5')](_0x1c8b4f,_0x209fc5);};}exports['register']=function(_0x1379b8){for(var _0x59e346=0x0,_0x386ab8=events['length'];_0x59e346<_0x386ab8;_0x59e346++){var _0x5e6cb3=events[_0x59e346];var _0xe94b8a=createListener(_0x98cd('0x6')+_0x5e6cb3,_0x1379b8);ChatInteractionEvents['on'](_0x5e6cb3,_0xe94b8a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 41c189b..160bdb0 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 _0x8ef5=['/:id/download','post','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages'];(function(_0xa14749,_0x1cd81e){var _0x254790=function(_0x15f59d){while(--_0x15f59d){_0xa14749['push'](_0xa14749['shift']());}};_0x254790(++_0x1cd81e);}(_0x8ef5,0xea));var _0x58ef=function(_0x528db5,_0x31e843){_0x528db5=_0x528db5-0x0;var _0x2e2c9d=_0x8ef5[_0x528db5];return _0x2e2c9d;};'use strict';var multer=require(_0x58ef('0x0'));var util=require('util');var path=require(_0x58ef('0x1'));var timeout=require(_0x58ef('0x2'));var express=require('express');var router=express[_0x58ef('0x3')]();var fs_extra=require(_0x58ef('0x4'));var auth=require(_0x58ef('0x5'));var interaction=require(_0x58ef('0x6'));var config=require(_0x58ef('0x7'));var controller=require(_0x58ef('0x8'));router['get']('/',auth[_0x58ef('0x9')](),controller[_0x58ef('0xa')]);router[_0x58ef('0xb')]('/describe',auth[_0x58ef('0x9')](),controller[_0x58ef('0xc')]);router[_0x58ef('0xb')](_0x58ef('0xd'),auth[_0x58ef('0xe')](),controller[_0x58ef('0xf')]);router[_0x58ef('0xb')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x58ef('0x10')]);router[_0x58ef('0xb')](_0x58ef('0x11'),auth[_0x58ef('0x9')](),controller[_0x58ef('0x12')]);router[_0x58ef('0xb')](_0x58ef('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x58ef('0x14')]);router[_0x58ef('0xb')](_0x58ef('0x15'),auth['isAuthenticated'](),controller['download']);router[_0x58ef('0x16')]('/',auth[_0x58ef('0x9')](),controller['create']);router[_0x58ef('0x16')](_0x58ef('0x17'),auth[_0x58ef('0x9')](),controller[_0x58ef('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd18ffe,_0x548df2,_0x588d05){_0x588d05(null,path[_0x58ef('0x19')](config['root'],_0x58ef('0x1a')));},'filename':function(_0x8bca73,_0x53a217,_0x6b8ba1){_0x6b8ba1(null,util[_0x58ef('0x1b')](_0x58ef('0x1c'),Date[_0x58ef('0x1d')](),_0x53a217[_0x58ef('0x1e')][_0x58ef('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x58ef('0x20'),upload[_0x58ef('0x21')](_0x58ef('0x22')),controller[_0x58ef('0x23')]);router[_0x58ef('0x16')]('/:id/messages',auth[_0x58ef('0xe')](),controller['addMessage']);router[_0x58ef('0x16')](_0x58ef('0x24'),auth['isAuthenticated'](),interaction[_0x58ef('0x25')](_0x58ef('0x26'),_0x58ef('0x27')),controller[_0x58ef('0x28')]);router[_0x58ef('0x29')]('/:id',auth['isAuthenticated'](),interaction[_0x58ef('0x25')]('chat',_0x58ef('0x2a')),controller['update']);router[_0x58ef('0x29')](_0x58ef('0x2b'),controller[_0x58ef('0x2c')]);router['put'](_0x58ef('0x2d'),auth[_0x58ef('0xe')](),controller['abandon']);router[_0x58ef('0x29')](_0x58ef('0x2e'),controller['close']);router['delete'](_0x58ef('0xd'),auth[_0x58ef('0x9')](),interaction['tracked']('chat',_0x58ef('0x2f')),controller[_0x58ef('0x30')]);router[_0x58ef('0x31')]('/:id/tags',auth[_0x58ef('0x9')](),controller[_0x58ef('0x32')]);module['exports']=router; \ No newline at end of file +var _0x6b83=['put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x6b83,0xdc));var _0x36b8=function(_0x5d73b2,_0x1ea5cd){_0x5d73b2=_0x5d73b2-0x0;var _0x1e4551=_0x6b83[_0x5d73b2];return _0x1e4551;};'use strict';var multer=require(_0x36b8('0x0'));var util=require(_0x36b8('0x1'));var path=require(_0x36b8('0x2'));var timeout=require(_0x36b8('0x3'));var express=require(_0x36b8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36b8('0x5'));var config=require(_0x36b8('0x6'));var controller=require(_0x36b8('0x7'));router[_0x36b8('0x8')]('/',auth[_0x36b8('0x9')](),controller['index']);router[_0x36b8('0x8')](_0x36b8('0xa'),auth[_0x36b8('0x9')](),controller['describe']);router[_0x36b8('0x8')](_0x36b8('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0xc')]);router[_0x36b8('0x8')](_0x36b8('0xd'),auth[_0x36b8('0xe')](),controller[_0x36b8('0xf')]);router['get'](_0x36b8('0x10'),auth['isAuthenticated'](),controller[_0x36b8('0x11')]);router[_0x36b8('0x8')](_0x36b8('0x12'),auth[_0x36b8('0xe')](),controller[_0x36b8('0x13')]);router[_0x36b8('0x8')](_0x36b8('0x14'),auth['isAuthenticated'](),controller['download']);router[_0x36b8('0x15')]('/',auth[_0x36b8('0x9')](),controller[_0x36b8('0x16')]);router[_0x36b8('0x15')](_0x36b8('0x17'),auth[_0x36b8('0x9')](),controller[_0x36b8('0x18')]);var upload=multer({'storage':multer[_0x36b8('0x19')]({'destination':function(_0xcb739d,_0x56291b,_0x794662){_0x794662(null,path[_0x36b8('0x1a')](config['root'],_0x36b8('0x1b')));},'filename':function(_0x3cf8c5,_0x2bb171,_0x56064d){_0x56064d(null,util[_0x36b8('0x1c')](_0x36b8('0x1d'),Date[_0x36b8('0x1e')](),_0x2bb171[_0x36b8('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x36b8('0x15')](_0x36b8('0x20'),upload[_0x36b8('0x21')]('file'),controller[_0x36b8('0x22')]);router[_0x36b8('0x15')](_0x36b8('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0x23')]);router[_0x36b8('0x15')](_0x36b8('0x24'),auth[_0x36b8('0x9')](),interaction[_0x36b8('0x25')](_0x36b8('0x26'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x36b8('0xb'),auth[_0x36b8('0x9')](),interaction['tracked'](_0x36b8('0x26'),_0x36b8('0x27')),controller['update']);router[_0x36b8('0x28')](_0x36b8('0x29'),controller[_0x36b8('0x2a')]);router['put'](_0x36b8('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0x2c')]);router[_0x36b8('0x28')](_0x36b8('0x2d'),controller[_0x36b8('0x2e')]);router[_0x36b8('0x2f')]('/:id',auth['isAuthenticated'](),interaction[_0x36b8('0x25')](_0x36b8('0x26'),_0x36b8('0x30')),controller[_0x36b8('0x31')]);router['delete'](_0x36b8('0x24'),auth[_0x36b8('0x9')](),controller[_0x36b8('0x32')]);module[_0x36b8('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index cece5c9..4ebaa72 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 _0x38bf=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x38bf,0x1c8));var _0xf38b=function(_0x112666,_0x2fd1a5){_0x112666=_0x112666-0x0;var _0x381764=_0x38bf[_0x112666];return _0x381764;};'use strict';var Sequelize=require(_0xf38b('0x0'));module['exports']={'body':{'type':Sequelize[_0xf38b('0x1')](_0xf38b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf38b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf38b('0x4')]}}; \ No newline at end of file +var _0x82ce=['INTEGER','sequelize','exports'];(function(_0x565f06,_0x3e9246){var _0x351eb2=function(_0x15d052){while(--_0x15d052){_0x565f06['push'](_0x565f06['shift']());}};_0x351eb2(++_0x3e9246);}(_0x82ce,0x106));var _0xe82c=function(_0x337306,_0x4c72e8){_0x337306=_0x337306-0x0;var _0x4cdfa4=_0x82ce[_0x337306];return _0x4cdfa4;};'use strict';var Sequelize=require(_0xe82c('0x0'));module[_0xe82c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe82c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4401f7f..7c261ea 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 _0xda21=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','stack','name','map','ChatInternalMessage','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','type','merge','options','where','includeAll','include','findAll','rows','catch','show','find','body','params','destroy','describe','get','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xda21,0x135));var _0x1da2=function(_0x4d1c51,_0x3b6fb0){_0x4d1c51=_0x4d1c51-0x0;var _0x667b49=_0xda21[_0x4d1c51];return _0x667b49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1da2('0x0'));var zipdir=require(_0x1da2('0x1'));var jsonpatch=require(_0x1da2('0x2'));var rp=require('request-promise');var moment=require(_0x1da2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1da2('0x4'));var util=require(_0x1da2('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1da2('0x6'));var fs=require('fs');var fs_extra=require(_0x1da2('0x7'));var _=require(_0x1da2('0x8'));var squel=require(_0x1da2('0x9'));var crypto=require(_0x1da2('0xa'));var jsforce=require(_0x1da2('0xb'));var deskjs=require(_0x1da2('0xc'));var toCsv=require(_0x1da2('0xd'));var querystring=require(_0x1da2('0xe'));var Papa=require(_0x1da2('0xf'));var Redis=require(_0x1da2('0x10'));var authService=require(_0x1da2('0x11'));var qs=require(_0x1da2('0x12'));var as=require(_0x1da2('0x13'));var hardwareService=require(_0x1da2('0x14'));var logger=require(_0x1da2('0x15'))(_0x1da2('0x16'));var utils=require(_0x1da2('0x17'));var config=require(_0x1da2('0x18'));var licenseUtil=require(_0x1da2('0x19'));var db=require('../../mysqldb')['db'];config[_0x1da2('0x1a')]=_['defaults'](config['redis'],{'host':_0x1da2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x1da2('0x1c')](socket);function respondWithStatusCode(_0x4926ef,_0x18f8c9){_0x18f8c9=_0x18f8c9||0xcc;return function(_0x312e40){if(_0x312e40){return _0x4926ef['sendStatus'](_0x18f8c9);}return _0x4926ef['status'](_0x18f8c9)['end']();};}function respondWithResult(_0x1af883,_0x524a42){_0x524a42=_0x524a42||0xc8;return function(_0x4a52d9){if(_0x4a52d9){return _0x1af883[_0x1da2('0x1d')](_0x524a42)[_0x1da2('0x1e')](_0x4a52d9);}};}function respondWithFilteredResult(_0x3f1297,_0x792a8f){return function(_0x5eb53a){if(_0x5eb53a){var _0x3ba3d2=typeof _0x792a8f[_0x1da2('0x1f')]===_0x1da2('0x20')&&typeof _0x792a8f[_0x1da2('0x21')]===_0x1da2('0x20');var _0x2f9f4e=_0x5eb53a[_0x1da2('0x22')];var _0x3daa75=_0x3ba3d2?0x0:_0x792a8f[_0x1da2('0x1f')];var _0x1ffe29=_0x3ba3d2?_0x5eb53a[_0x1da2('0x22')]:_0x792a8f[_0x1da2('0x1f')]+_0x792a8f[_0x1da2('0x21')];var _0x17b8f3;if(_0x1ffe29>=_0x2f9f4e){_0x1ffe29=_0x2f9f4e;_0x17b8f3=0xc8;}else{_0x17b8f3=0xce;}_0x3f1297[_0x1da2('0x1d')](_0x17b8f3);return _0x3f1297['set'](_0x1da2('0x23'),_0x3daa75+'-'+_0x1ffe29+'/'+_0x2f9f4e)['json'](_0x5eb53a);}return null;};}function patchUpdates(_0x4fa737){return function(_0xe56867){try{jsonpatch[_0x1da2('0x24')](_0xe56867,_0x4fa737,!![]);}catch(_0x417f18){return BPromise[_0x1da2('0x25')](_0x417f18);}return _0xe56867[_0x1da2('0x26')]();};}function saveUpdates(_0x12cdde,_0x428272){return function(_0x4716d1){if(_0x4716d1){return _0x4716d1['update'](_0x12cdde)[_0x1da2('0x27')](function(_0x923d5a){return _0x923d5a;});}return null;};}function removeEntity(_0xed9c,_0xc4792e){return function(_0x34f06b){if(_0x34f06b){return _0x34f06b['destroy']()[_0x1da2('0x27')](function(){_0xed9c['status'](0xcc)[_0x1da2('0x28')]();});}};}function handleEntityNotFound(_0x1610f8,_0x43cf87){return function(_0x1b54c5){if(!_0x1b54c5){_0x1610f8['sendStatus'](0x194);}return _0x1b54c5;};}function handleError(_0xa0b678,_0xa8c1c0){_0xa8c1c0=_0xa8c1c0||0x1f4;return function(_0x247ac8){logger['error'](_0x247ac8[_0x1da2('0x29')]);if(_0x247ac8[_0x1da2('0x2a')]){delete _0x247ac8[_0x1da2('0x2a')];}_0xa0b678['status'](_0xa8c1c0)['send'](_0x247ac8);};}exports['index']=function(_0xb58413,_0x3b8ed0){var _0x2bcf74={},_0x546145={},_0x59bf78={'count':0x0,'rows':[]};var _0x4afff4=_[_0x1da2('0x2b')](db[_0x1da2('0x2c')][_0x1da2('0x2d')],function(_0x38d395){return{'name':_0x38d395[_0x1da2('0x2e')],'type':_0x38d395['type']['key']};});_0x546145[_0x1da2('0x2f')]=_[_0x1da2('0x2b')](_0x4afff4,'name');_0x546145['query']=_[_0x1da2('0x30')](_0xb58413[_0x1da2('0x31')]);_0x546145[_0x1da2('0x32')]=_['intersection'](_0x546145[_0x1da2('0x2f')],_0x546145['query']);_0x2bcf74[_0x1da2('0x33')]=_[_0x1da2('0x34')](_0x546145[_0x1da2('0x2f')],qs[_0x1da2('0x35')](_0xb58413[_0x1da2('0x31')][_0x1da2('0x35')]));_0x2bcf74[_0x1da2('0x33')]=_0x2bcf74[_0x1da2('0x33')][_0x1da2('0x36')]?_0x2bcf74['attributes']:_0x546145[_0x1da2('0x2f')];if(!_0xb58413[_0x1da2('0x31')][_0x1da2('0x37')](_0x1da2('0x38'))){_0x2bcf74[_0x1da2('0x21')]=qs['limit'](_0xb58413[_0x1da2('0x31')]['limit']);_0x2bcf74['offset']=qs[_0x1da2('0x1f')](_0xb58413[_0x1da2('0x31')][_0x1da2('0x1f')]);}_0x2bcf74[_0x1da2('0x39')]=qs[_0x1da2('0x3a')](_0xb58413[_0x1da2('0x31')][_0x1da2('0x3a')]);_0x2bcf74['where']=qs[_0x1da2('0x32')](_['pick'](_0xb58413[_0x1da2('0x31')],_0x546145[_0x1da2('0x32')]),_0x4afff4);if(_0xb58413[_0x1da2('0x31')][_0x1da2('0x3b')]){_0x2bcf74['where']=_['merge'](_0x2bcf74['where'],{'$or':_[_0x1da2('0x2b')](_0x4afff4,function(_0x444e58){if(_0x444e58[_0x1da2('0x3c')]!=='VIRTUAL'){var _0x409f8f={};_0x409f8f[_0x444e58['name']]={'$like':'%'+_0xb58413[_0x1da2('0x31')]['filter']+'%'};return _0x409f8f;}})});}_0x2bcf74=_[_0x1da2('0x3d')]({},_0x2bcf74,_0xb58413[_0x1da2('0x3e')]);var _0x4b91c8={'where':_0x2bcf74[_0x1da2('0x3f')]};return db[_0x1da2('0x2c')][_0x1da2('0x22')](_0x4b91c8)[_0x1da2('0x27')](function(_0x15a5f7){_0x59bf78[_0x1da2('0x22')]=_0x15a5f7;if(_0xb58413[_0x1da2('0x31')][_0x1da2('0x40')]){_0x2bcf74[_0x1da2('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1da2('0x42')](_0x2bcf74);})[_0x1da2('0x27')](function(_0x4217e2){_0x59bf78[_0x1da2('0x43')]=_0x4217e2;return _0x59bf78;})['then'](respondWithFilteredResult(_0x3b8ed0,_0x2bcf74))[_0x1da2('0x44')](handleError(_0x3b8ed0,null));};exports[_0x1da2('0x45')]=function(_0x4cf5b1,_0x3e3d65){var _0x1de039={'raw':!![],'where':{'id':_0x4cf5b1['params']['id']}},_0x25e049={};_0x25e049[_0x1da2('0x2f')]=_[_0x1da2('0x30')](db[_0x1da2('0x2c')][_0x1da2('0x2d')]);_0x25e049[_0x1da2('0x31')]=_[_0x1da2('0x30')](_0x4cf5b1[_0x1da2('0x31')]);_0x25e049[_0x1da2('0x32')]=_[_0x1da2('0x34')](_0x25e049[_0x1da2('0x2f')],_0x25e049[_0x1da2('0x31')]);_0x1de039[_0x1da2('0x33')]=_['intersection'](_0x25e049['model'],qs[_0x1da2('0x35')](_0x4cf5b1['query']['fields']));_0x1de039['attributes']=_0x1de039[_0x1da2('0x33')][_0x1da2('0x36')]?_0x1de039[_0x1da2('0x33')]:_0x25e049[_0x1da2('0x2f')];if(_0x4cf5b1[_0x1da2('0x31')][_0x1da2('0x40')]){_0x1de039['include']=[{'all':!![]}];}_0x1de039=_[_0x1da2('0x3d')]({},_0x1de039,_0x4cf5b1[_0x1da2('0x3e')]);return db[_0x1da2('0x2c')][_0x1da2('0x46')](_0x1de039)['then'](handleEntityNotFound(_0x3e3d65,null))[_0x1da2('0x27')](respondWithResult(_0x3e3d65,null))[_0x1da2('0x44')](handleError(_0x3e3d65,null));};exports['create']=function(_0x335cfa,_0x25d19f){return db[_0x1da2('0x2c')]['create'](_0x335cfa[_0x1da2('0x47')],{})[_0x1da2('0x27')](respondWithResult(_0x25d19f,0xc9))[_0x1da2('0x44')](handleError(_0x25d19f,null));};exports['update']=function(_0x56fcd1,_0xf6286a){if(_0x56fcd1[_0x1da2('0x47')]['id']){delete _0x56fcd1[_0x1da2('0x47')]['id'];}return db[_0x1da2('0x2c')][_0x1da2('0x46')]({'where':{'id':_0x56fcd1[_0x1da2('0x48')]['id']}})['then'](handleEntityNotFound(_0xf6286a,null))[_0x1da2('0x27')](saveUpdates(_0x56fcd1[_0x1da2('0x47')],null))[_0x1da2('0x27')](respondWithResult(_0xf6286a,null))[_0x1da2('0x44')](handleError(_0xf6286a,null));};exports[_0x1da2('0x49')]=function(_0x5ac154,_0x2138e1){return db[_0x1da2('0x2c')][_0x1da2('0x46')]({'where':{'id':_0x5ac154[_0x1da2('0x48')]['id']}})[_0x1da2('0x27')](handleEntityNotFound(_0x2138e1,null))[_0x1da2('0x27')](removeEntity(_0x2138e1,null))[_0x1da2('0x44')](handleError(_0x2138e1,null));};exports['describe']=function(_0x2d7a5d,_0x31d5c0){return db[_0x1da2('0x2c')][_0x1da2('0x4a')]()['then'](respondWithResult(_0x31d5c0,null))[_0x1da2('0x44')](handleError(_0x31d5c0,null));};function wrapUser(_0x5e5d42){return function(_0x4fabe9){var _0x28ab5b=_0x5e5d42[_0x1da2('0x4b')]({'plain':!![]});_0x28ab5b[_0x1da2('0x4c')]=[];if(_0x4fabe9){_0x28ab5b['lastMessageAt']=_0x4fabe9['createdAt'];_0x28ab5b[_0x1da2('0x4d')]=_0x4fabe9;}else{_0x28ab5b[_0x1da2('0x4e')]=moment(0x0)[_0x1da2('0x4f')](_0x1da2('0x50'));_0x28ab5b[_0x1da2('0x4d')]={};}return _0x28ab5b;};}exports[_0x1da2('0x51')]=function(_0x161f0e,_0x4e121b,_0x52a74a){var _0x13075e=[];return db[_0x1da2('0x52')][_0x1da2('0x42')]({'where':{'role':[_0x1da2('0x53'),_0x1da2('0x54'),_0x1da2('0x55')]},'attributes':['id',_0x1da2('0x56'),_0x1da2('0x2a'),_0x1da2('0x57'),_0x1da2('0x58'),'internal','online',_0x1da2('0x59'),_0x1da2('0x5a'),_0x1da2('0x5b')],'order':qs[_0x1da2('0x3a')]('-online'),'include':[{'model':db[_0x1da2('0x5c')],'as':_0x1da2('0x5d'),'attributes':['id',_0x1da2('0x2a'),_0x1da2('0x3c')],'through':{'attributes':[]}}]})[_0x1da2('0x27')](function(_0x2dc87b){if(_0x2dc87b){var _0x515260=_0x161f0e[_0x1da2('0x55')][_0x1da2('0x4b')]({'plain':!![]});if(!_0x515260)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x515260['role']==='user'){return db[_0x1da2('0x5e')][_0x1da2('0x46')]({'where':{'name':_0x1da2('0x5f'),'userProfileId':_0x515260[_0x1da2('0x60')]},'raw':!![]})[_0x1da2('0x27')](function(_0x195c71){if(_0x195c71){if(_0x195c71[_0x1da2('0x61')]===0x0){return db[_0x1da2('0x62')]['findAll']({'where':{'sectionId':_0x195c71['id']},'raw':!![]})[_0x1da2('0x27')](function(_0x232c87){var _0x52b47c=[];if(_[_0x1da2('0x63')](_0x232c87)){_0x52b47c=_[_0x1da2('0x3b')](_0x2dc87b,function(_0x8ad1db){if(_0x8ad1db[_0x1da2('0x57')]!==_0x1da2('0x53')){return _0x8ad1db;}});return _0x52b47c;}else{for(var _0x59606c=0x0;_0x59606c<_0x2dc87b['length'];_0x59606c++){var _0x45ebf5=_0x2dc87b[_0x59606c];if(_0x45ebf5[_0x1da2('0x57')]===_0x1da2('0x53')){var _0x354476=_[_0x1da2('0x46')](_0x232c87,function(_0x2f688b){return _0x2f688b[_0x1da2('0x64')]===_0x45ebf5['id'];});if(_0x354476)_0x52b47c[_0x1da2('0x65')](_0x45ebf5);}else{_0x52b47c[_0x1da2('0x65')](_0x45ebf5);}}return _0x52b47c;}});}else{return _0x2dc87b;}}else{var _0x620744=_['filter'](_0x2dc87b,function(_0x139400){if(_0x139400['role']!==_0x1da2('0x53')){return _0x139400;}});return _0x620744;}});}else{return _0x2dc87b;}}})[_0x1da2('0x27')](function(_0x5d1aab){var _0x1129d3=[];if(_0x5d1aab){_0x13075e=_0x5d1aab;for(var _0x10ba9f=0x0;_0x10ba9f<_0x5d1aab['length'];_0x10ba9f+=0x1){_0x13075e[_0x10ba9f][_0x1da2('0x4c')]=[];_0x1129d3[_0x1da2('0x65')](db[_0x1da2('0x2c')][_0x1da2('0x46')]({'where':{'FromId':[_0x161f0e['user']['id'],_0x5d1aab[_0x10ba9f]['id']],'ToId':[_0x161f0e[_0x1da2('0x55')]['id'],_0x5d1aab[_0x10ba9f]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1da2('0x66'),_0x1da2('0x67'),_0x1da2('0x68'),'body'],'order':qs['sort'](_0x1da2('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1da2('0x27')](wrapUser(_0x5d1aab[_0x10ba9f])));}return BPromise[_0x1da2('0x6a')](_0x1129d3);}return[];})[_0x1da2('0x27')](function(_0x32f202){return{'rows':_0x32f202,'count':_0x32f202[_0x1da2('0x36')]};})['then'](respondWithResult(_0x4e121b,null))[_0x1da2('0x44')](handleError(_0x4e121b,null));}; \ No newline at end of file +var _0xa095=['count','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','destroy','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','then','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x382649,_0x35867e){var _0x359910=function(_0x40914d){while(--_0x40914d){_0x382649['push'](_0x382649['shift']());}};_0x359910(++_0x35867e);}(_0xa095,0x92));var _0x5a09=function(_0x449e84,_0x505ae7){_0x449e84=_0x449e84-0x0;var _0x72d311=_0xa095[_0x449e84];return _0x72d311;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a09('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a09('0x1'));var rp=require(_0x5a09('0x2'));var moment=require(_0x5a09('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5a09('0x4'));var util=require('util');var path=require(_0x5a09('0x5'));var sox=require(_0x5a09('0x6'));var csv=require(_0x5a09('0x7'));var ejs=require(_0x5a09('0x8'));var fs=require('fs');var fs_extra=require(_0x5a09('0x9'));var _=require(_0x5a09('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a09('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a09('0x7'));var querystring=require(_0x5a09('0xc'));var Papa=require(_0x5a09('0xd'));var Redis=require(_0x5a09('0xe'));var authService=require(_0x5a09('0xf'));var qs=require(_0x5a09('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a09('0x11'));var logger=require(_0x5a09('0x12'))(_0x5a09('0x13'));var utils=require('../../config/utils');var config=require(_0x5a09('0x14'));var licenseUtil=require(_0x5a09('0x15'));var db=require('../../mysqldb')['db'];config[_0x5a09('0x16')]=_[_0x5a09('0x17')](config[_0x5a09('0x16')],{'host':_0x5a09('0x18'),'port':0x18eb});var socket=require(_0x5a09('0x19'))(new Redis(config['redis']));require(_0x5a09('0x1a'))['register'](socket);function respondWithStatusCode(_0x503ed3,_0x70c737){_0x70c737=_0x70c737||0xcc;return function(_0x177afe){if(_0x177afe){return _0x503ed3[_0x5a09('0x1b')](_0x70c737);}return _0x503ed3[_0x5a09('0x1c')](_0x70c737)[_0x5a09('0x1d')]();};}function respondWithResult(_0xb0ec6b,_0x407baa){_0x407baa=_0x407baa||0xc8;return function(_0x2e7d23){if(_0x2e7d23){return _0xb0ec6b['status'](_0x407baa)[_0x5a09('0x1e')](_0x2e7d23);}};}function respondWithFilteredResult(_0x2f1f4d,_0xe4137a){return function(_0x52de0a){if(_0x52de0a){var _0x166d0d=typeof _0xe4137a[_0x5a09('0x1f')]==='undefined'&&typeof _0xe4137a[_0x5a09('0x20')]===_0x5a09('0x21');var _0x225437=_0x52de0a['count'];var _0x267a05=_0x166d0d?0x0:_0xe4137a['offset'];var _0x10259a=_0x166d0d?_0x52de0a['count']:_0xe4137a[_0x5a09('0x1f')]+_0xe4137a[_0x5a09('0x20')];var _0x594501;if(_0x10259a>=_0x225437){_0x10259a=_0x225437;_0x594501=0xc8;}else{_0x594501=0xce;}_0x2f1f4d[_0x5a09('0x1c')](_0x594501);return _0x2f1f4d[_0x5a09('0x22')]('Content-Range',_0x267a05+'-'+_0x10259a+'/'+_0x225437)[_0x5a09('0x1e')](_0x52de0a);}return null;};}function patchUpdates(_0x9ec7ec){return function(_0x1135f4){try{jsonpatch[_0x5a09('0x23')](_0x1135f4,_0x9ec7ec,!![]);}catch(_0x3d29db){return BPromise[_0x5a09('0x24')](_0x3d29db);}return _0x1135f4[_0x5a09('0x25')]();};}function saveUpdates(_0x15c45f,_0x43678f){return function(_0x14b017){if(_0x14b017){return _0x14b017['update'](_0x15c45f)[_0x5a09('0x26')](function(_0x21bb1c){return _0x21bb1c;});}return null;};}function removeEntity(_0x30ec8a,_0x14b217){return function(_0x592238){if(_0x592238){return _0x592238['destroy']()[_0x5a09('0x26')](function(){_0x30ec8a[_0x5a09('0x1c')](0xcc)[_0x5a09('0x1d')]();});}};}function handleEntityNotFound(_0x3a99a8,_0x3b8e12){return function(_0x525e70){if(!_0x525e70){_0x3a99a8[_0x5a09('0x1b')](0x194);}return _0x525e70;};}function handleError(_0x270264,_0x42d355){_0x42d355=_0x42d355||0x1f4;return function(_0x4cea0c){logger[_0x5a09('0x27')](_0x4cea0c[_0x5a09('0x28')]);if(_0x4cea0c[_0x5a09('0x29')]){delete _0x4cea0c[_0x5a09('0x29')];}_0x270264['status'](_0x42d355)[_0x5a09('0x2a')](_0x4cea0c);};}exports['index']=function(_0x2a1a1b,_0x597ffc){var _0xb0edec={},_0x156c66={},_0x430da7={'count':0x0,'rows':[]};var _0x32bc94=_[_0x5a09('0x2b')](db[_0x5a09('0x2c')]['rawAttributes'],function(_0x3675db){return{'name':_0x3675db[_0x5a09('0x2d')],'type':_0x3675db[_0x5a09('0x2e')][_0x5a09('0x2f')]};});_0x156c66[_0x5a09('0x30')]=_[_0x5a09('0x2b')](_0x32bc94,_0x5a09('0x29'));_0x156c66[_0x5a09('0x31')]=_[_0x5a09('0x32')](_0x2a1a1b['query']);_0x156c66[_0x5a09('0x33')]=_[_0x5a09('0x34')](_0x156c66[_0x5a09('0x30')],_0x156c66[_0x5a09('0x31')]);_0xb0edec['attributes']=_[_0x5a09('0x34')](_0x156c66[_0x5a09('0x30')],qs[_0x5a09('0x35')](_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x35')]));_0xb0edec['attributes']=_0xb0edec[_0x5a09('0x36')][_0x5a09('0x37')]?_0xb0edec[_0x5a09('0x36')]:_0x156c66[_0x5a09('0x30')];if(!_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x38')](_0x5a09('0x39'))){_0xb0edec[_0x5a09('0x20')]=qs[_0x5a09('0x20')](_0x2a1a1b[_0x5a09('0x31')]['limit']);_0xb0edec[_0x5a09('0x1f')]=qs['offset'](_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x1f')]);}_0xb0edec[_0x5a09('0x3a')]=qs[_0x5a09('0x3b')](_0x2a1a1b['query'][_0x5a09('0x3b')]);_0xb0edec[_0x5a09('0x3c')]=qs[_0x5a09('0x33')](_['pick'](_0x2a1a1b[_0x5a09('0x31')],_0x156c66['filters']),_0x32bc94);if(_0x2a1a1b['query'][_0x5a09('0x3d')]){_0xb0edec[_0x5a09('0x3c')]=_[_0x5a09('0x3e')](_0xb0edec[_0x5a09('0x3c')],{'$or':_[_0x5a09('0x2b')](_0x32bc94,function(_0x183a0b){if(_0x183a0b[_0x5a09('0x2e')]!==_0x5a09('0x3f')){var _0x21b5c8={};_0x21b5c8[_0x183a0b[_0x5a09('0x29')]]={'$like':'%'+_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x3d')]+'%'};return _0x21b5c8;}})});}_0xb0edec=_[_0x5a09('0x3e')]({},_0xb0edec,_0x2a1a1b['options']);var _0x5d9b87={'where':_0xb0edec[_0x5a09('0x3c')]};return db[_0x5a09('0x2c')][_0x5a09('0x40')](_0x5d9b87)[_0x5a09('0x26')](function(_0xd69f9f){_0x430da7['count']=_0xd69f9f;if(_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x41')]){_0xb0edec['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5a09('0x42')](_0xb0edec);})['then'](function(_0x1b5997){_0x430da7[_0x5a09('0x43')]=_0x1b5997;return _0x430da7;})[_0x5a09('0x26')](respondWithFilteredResult(_0x597ffc,_0xb0edec))[_0x5a09('0x44')](handleError(_0x597ffc,null));};exports['show']=function(_0x35b90f,_0x30e036){var _0xcaecc6={'raw':!![],'where':{'id':_0x35b90f['params']['id']}},_0x33d2a2={};_0x33d2a2[_0x5a09('0x30')]=_[_0x5a09('0x32')](db[_0x5a09('0x2c')][_0x5a09('0x45')]);_0x33d2a2[_0x5a09('0x31')]=_[_0x5a09('0x32')](_0x35b90f[_0x5a09('0x31')]);_0x33d2a2['filters']=_[_0x5a09('0x34')](_0x33d2a2[_0x5a09('0x30')],_0x33d2a2[_0x5a09('0x31')]);_0xcaecc6[_0x5a09('0x36')]=_['intersection'](_0x33d2a2[_0x5a09('0x30')],qs[_0x5a09('0x35')](_0x35b90f[_0x5a09('0x31')][_0x5a09('0x35')]));_0xcaecc6[_0x5a09('0x36')]=_0xcaecc6[_0x5a09('0x36')][_0x5a09('0x37')]?_0xcaecc6[_0x5a09('0x36')]:_0x33d2a2[_0x5a09('0x30')];if(_0x35b90f[_0x5a09('0x31')]['includeAll']){_0xcaecc6[_0x5a09('0x46')]=[{'all':!![]}];}_0xcaecc6=_[_0x5a09('0x3e')]({},_0xcaecc6,_0x35b90f['options']);return db['ChatInternalMessage'][_0x5a09('0x47')](_0xcaecc6)[_0x5a09('0x26')](handleEntityNotFound(_0x30e036,null))['then'](respondWithResult(_0x30e036,null))['catch'](handleError(_0x30e036,null));};exports[_0x5a09('0x48')]=function(_0x232e2f,_0x2415f0){return db[_0x5a09('0x2c')][_0x5a09('0x48')](_0x232e2f['body'],{})[_0x5a09('0x26')](respondWithResult(_0x2415f0,0xc9))['catch'](handleError(_0x2415f0,null));};exports['update']=function(_0x5399ce,_0x2611b3){if(_0x5399ce['body']['id']){delete _0x5399ce[_0x5a09('0x49')]['id'];}return db[_0x5a09('0x2c')][_0x5a09('0x47')]({'where':{'id':_0x5399ce[_0x5a09('0x4a')]['id']}})[_0x5a09('0x26')](handleEntityNotFound(_0x2611b3,null))[_0x5a09('0x26')](saveUpdates(_0x5399ce[_0x5a09('0x49')],null))[_0x5a09('0x26')](respondWithResult(_0x2611b3,null))['catch'](handleError(_0x2611b3,null));};exports[_0x5a09('0x4b')]=function(_0x4259f0,_0x4d10a2){return db[_0x5a09('0x2c')]['find']({'where':{'id':_0x4259f0['params']['id']}})[_0x5a09('0x26')](handleEntityNotFound(_0x4d10a2,null))[_0x5a09('0x26')](removeEntity(_0x4d10a2,null))[_0x5a09('0x44')](handleError(_0x4d10a2,null));};exports[_0x5a09('0x4c')]=function(_0x25b741,_0x508091){return db[_0x5a09('0x2c')][_0x5a09('0x4c')]()[_0x5a09('0x26')](respondWithResult(_0x508091,null))[_0x5a09('0x44')](handleError(_0x508091,null));};function wrapUser(_0x55b1f0){return function(_0x534caf){var _0x5dc435=_0x55b1f0['get']({'plain':!![]});_0x5dc435[_0x5a09('0x4d')]=[];if(_0x534caf){_0x5dc435['lastMessageAt']=_0x534caf[_0x5a09('0x4e')];_0x5dc435[_0x5a09('0x4f')]=_0x534caf;}else{_0x5dc435[_0x5a09('0x50')]=moment(0x0)['format'](_0x5a09('0x51'));_0x5dc435['lastMessage']={};}return _0x5dc435;};}exports[_0x5a09('0x52')]=function(_0x3214ac,_0x24f703,_0xd3eb21){var _0x535ccc=[];return db[_0x5a09('0x53')][_0x5a09('0x42')]({'where':{'role':['agent','admin',_0x5a09('0x54')]},'attributes':['id',_0x5a09('0x55'),_0x5a09('0x29'),_0x5a09('0x56'),_0x5a09('0x57'),_0x5a09('0x58'),'online',_0x5a09('0x59'),_0x5a09('0x5a'),_0x5a09('0x5b')],'order':qs[_0x5a09('0x3b')]('-online'),'include':[{'model':db[_0x5a09('0x5c')],'as':'VoiceQueues','attributes':['id',_0x5a09('0x29'),_0x5a09('0x2e')],'through':{'attributes':[]}}]})[_0x5a09('0x26')](function(_0x496774){if(_0x496774){var _0x513fcc=_0x3214ac[_0x5a09('0x54')]['get']({'plain':!![]});if(!_0x513fcc)throw new Error(_0x5a09('0x5d'));if(_0x513fcc[_0x5a09('0x56')]===_0x5a09('0x54')){return db['UserProfileSection']['find']({'where':{'name':_0x5a09('0x5e'),'userProfileId':_0x513fcc[_0x5a09('0x5f')]},'raw':!![]})[_0x5a09('0x26')](function(_0x4635e8){if(_0x4635e8){if(_0x4635e8[_0x5a09('0x60')]===0x0){return db[_0x5a09('0x61')]['findAll']({'where':{'sectionId':_0x4635e8['id']},'raw':!![]})[_0x5a09('0x26')](function(_0x106122){var _0x1935bc=[];if(_[_0x5a09('0x62')](_0x106122)){_0x1935bc=_['filter'](_0x496774,function(_0x33fda9){if(_0x33fda9[_0x5a09('0x56')]!=='agent'){return _0x33fda9;}});return _0x1935bc;}else{for(var _0x12f807=0x0;_0x12f807<_0x496774[_0x5a09('0x37')];_0x12f807++){var _0x460187=_0x496774[_0x12f807];if(_0x460187['role']===_0x5a09('0x63')){var _0x53099e=_[_0x5a09('0x47')](_0x106122,function(_0x5679b4){return _0x5679b4[_0x5a09('0x64')]===_0x460187['id'];});if(_0x53099e)_0x1935bc[_0x5a09('0x65')](_0x460187);}else{_0x1935bc[_0x5a09('0x65')](_0x460187);}}return _0x1935bc;}});}else{return _0x496774;}}else{var _0x423c68=_[_0x5a09('0x3d')](_0x496774,function(_0x1403d6){if(_0x1403d6[_0x5a09('0x56')]!==_0x5a09('0x63')){return _0x1403d6;}});return _0x423c68;}});}else{return _0x496774;}}})[_0x5a09('0x26')](function(_0xb2f805){var _0x226435=[];if(_0xb2f805){_0x535ccc=_0xb2f805;for(var _0x4a0fad=0x0;_0x4a0fad<_0xb2f805[_0x5a09('0x37')];_0x4a0fad+=0x1){_0x535ccc[_0x4a0fad][_0x5a09('0x4d')]=[];_0x226435[_0x5a09('0x65')](db[_0x5a09('0x2c')][_0x5a09('0x47')]({'where':{'FromId':[_0x3214ac['user']['id'],_0xb2f805[_0x4a0fad]['id']],'ToId':[_0x3214ac[_0x5a09('0x54')]['id'],_0xb2f805[_0x4a0fad]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x5a09('0x66'),'ToId','read',_0x5a09('0x49')],'order':qs[_0x5a09('0x3b')](_0x5a09('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5a09('0x26')](wrapUser(_0xb2f805[_0x4a0fad])));}return BPromise[_0x5a09('0x68')](_0x226435);}return[];})[_0x5a09('0x26')](function(_0x1eddd0){return{'rows':_0x1eddd0,'count':_0x1eddd0['length']};})['then'](respondWithResult(_0x24f703,null))[_0x5a09('0x44')](handleError(_0x24f703,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5deba57..21c7b07 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 _0x689b=['hook','exports','events','ChatInternalMessage','update','remove','emit','hasOwnProperty'];(function(_0x488991,_0x491e2a){var _0x52fa69=function(_0x264ca8){while(--_0x264ca8){_0x488991['push'](_0x488991['shift']());}};_0x52fa69(++_0x491e2a);}(_0x689b,0x142));var _0xb689=function(_0x480020,_0xc7b1db){_0x480020=_0x480020-0x0;var _0x364f47=_0x689b[_0x480020];return _0x364f47;};'use strict';var EventEmitter=require(_0xb689('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xb689('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb689('0x2'),'afterDestroy':_0xb689('0x3')};function emitEvent(_0x220061){return function(_0x4378a8,_0x2bcd76,_0x17ed70){ChatInternalMessageEvents[_0xb689('0x4')](_0x220061+':'+_0x4378a8['id'],_0x4378a8);ChatInternalMessageEvents['emit'](_0x220061,_0x4378a8);_0x17ed70(null);};}for(var e in events){if(events[_0xb689('0x5')](e)){var event=events[e];ChatInternalMessage[_0xb689('0x6')](e,emitEvent(event));}}module[_0xb689('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3525=['emit','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x3a8697,_0x15a965){var _0x1da8d5=function(_0x314035){while(--_0x314035){_0x3a8697['push'](_0x3a8697['shift']());}};_0x1da8d5(++_0x15a965);}(_0x3525,0x16a));var _0x5352=function(_0x6453b,_0xd44754){_0x6453b=_0x6453b-0x0;var _0x2fd18c=_0x3525[_0x6453b];return _0x2fd18c;};'use strict';var EventEmitter=require(_0x5352('0x0'));var ChatInternalMessage=require(_0x5352('0x1'))['db'][_0x5352('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5352('0x3')](0x0);var events={'afterCreate':_0x5352('0x4'),'afterUpdate':_0x5352('0x5'),'afterDestroy':_0x5352('0x6')};function emitEvent(_0x1301b9){return function(_0x39492b,_0x537148,_0x3ef38d){ChatInternalMessageEvents[_0x5352('0x7')](_0x1301b9+':'+_0x39492b['id'],_0x39492b);ChatInternalMessageEvents[_0x5352('0x7')](_0x1301b9,_0x39492b);_0x3ef38d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x5352('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 2503ad6..5aff0b5 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 _0x8bfb=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x477e24,_0x405e6b){var _0x2d82b5=function(_0x6fb74c){while(--_0x6fb74c){_0x477e24['push'](_0x477e24['shift']());}};_0x2d82b5(++_0x405e6b);}(_0x8bfb,0x1d0));var _0xb8bf=function(_0x19d2c8,_0x3eaadc){_0x19d2c8=_0x19d2c8-0x0;var _0x14805a=_0x8bfb[_0x19d2c8];return _0x14805a;};'use strict';var _=require(_0xb8bf('0x0'));var util=require(_0xb8bf('0x1'));var logger=require('../../config/logger')(_0xb8bf('0x2'));var moment=require(_0xb8bf('0x3'));var BPromise=require(_0xb8bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb8bf('0x5'));var config=require(_0xb8bf('0x6'));var attributes=require(_0xb8bf('0x7'));module['exports']=function(_0x44f2e6,_0x1c55f6){return _0x44f2e6[_0xb8bf('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb8bf('0x9'),'collate':_0xb8bf('0xa')});}; \ No newline at end of file +var _0x5ab7=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes'];(function(_0x13c2d1,_0x14355e){var _0x3d1651=function(_0x271341){while(--_0x271341){_0x13c2d1['push'](_0x13c2d1['shift']());}};_0x3d1651(++_0x14355e);}(_0x5ab7,0x1bf));var _0x75ab=function(_0x4f6d01,_0x4d9f26){_0x4f6d01=_0x4f6d01-0x0;var _0x392f88=_0x5ab7[_0x4f6d01];return _0x392f88;};'use strict';var _=require(_0x75ab('0x0'));var util=require(_0x75ab('0x1'));var logger=require(_0x75ab('0x2'))(_0x75ab('0x3'));var moment=require('moment');var BPromise=require(_0x75ab('0x4'));var rp=require(_0x75ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x75ab('0x6'));var attributes=require(_0x75ab('0x7'));module[_0x75ab('0x8')]=function(_0x343554,_0x4da861){return _0x343554['define'](_0x75ab('0x9'),attributes,{'tableName':_0x75ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75ab('0xb'),'collate':_0x75ab('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index cffeebe..816006e 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 _0x8781=['request\x20sent','stringify','code','error','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x8781,0x1c8));var _0x1878=function(_0x328cf0,_0x12065c){_0x328cf0=_0x328cf0-0x0;var _0xd97677=_0x8781[_0x328cf0];return _0xd97677;};'use strict';var _=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var moment=require(_0x1878('0x2'));var BPromise=require(_0x1878('0x3'));var rs=require(_0x1878('0x4'));var fs=require('fs');var Redis=require(_0x1878('0x5'));var db=require(_0x1878('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1878('0x7'))(_0x1878('0x8'));var config=require(_0x1878('0x9'));var jayson=require(_0x1878('0xa'));var client=jayson[_0x1878('0xb')][_0x1878('0xc')]({'port':0x232a});config['redis']=_[_0x1878('0xd')](config[_0x1878('0xe')],{'host':_0x1878('0xf'),'port':0x18eb});var socket=require(_0x1878('0x10'))(new Redis(config[_0x1878('0xe')]));require(_0x1878('0x11'))[_0x1878('0x12')](socket);function respondWithRpcPromise(_0x31008c,_0x3f00a4,_0x23b04b){return new BPromise(function(_0x412d55,_0x5d66e0){return client[_0x1878('0x13')](_0x31008c,_0x23b04b)[_0x1878('0x14')](function(_0x3cf2ac){logger[_0x1878('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x3f00a4,'request\x20sent');logger[_0x1878('0x16')](_0x1878('0x17'),_0x3f00a4,_0x1878('0x18'),JSON[_0x1878('0x19')](_0x3cf2ac));if(_0x3cf2ac['error']){if(_0x3cf2ac['error'][_0x1878('0x1a')]===0x1f4){logger[_0x1878('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x3f00a4,_0x3cf2ac[_0x1878('0x1b')][_0x1878('0x1c')]);return _0x5d66e0(_0x3cf2ac[_0x1878('0x1b')]['message']);}logger['error'](_0x1878('0x1d'),_0x3f00a4,_0x3cf2ac[_0x1878('0x1b')][_0x1878('0x1c')]);return _0x412d55(_0x3cf2ac[_0x1878('0x1b')][_0x1878('0x1c')]);}else{logger[_0x1878('0x15')](_0x1878('0x1d'),_0x3f00a4,_0x1878('0x18'));_0x412d55(_0x3cf2ac[_0x1878('0x1e')][_0x1878('0x1c')]);}})[_0x1878('0x1f')](function(_0x5a8ea3){logger['error'](_0x1878('0x1d'),_0x3f00a4,_0x5a8ea3);_0x5d66e0(_0x5a8ea3);});});} \ No newline at end of file +var _0xe07c=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xda0f1a,_0x42d7f6){var _0x1b8e0c=function(_0x17b3fc){while(--_0x17b3fc){_0xda0f1a['push'](_0xda0f1a['shift']());}};_0x1b8e0c(++_0x42d7f6);}(_0xe07c,0x1f3));var _0xce07=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xe07c[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xce07('0x0'));var util=require(_0xce07('0x1'));var moment=require(_0xce07('0x2'));var BPromise=require(_0xce07('0x3'));var rs=require(_0xce07('0x4'));var fs=require('fs');var Redis=require(_0xce07('0x5'));var db=require(_0xce07('0x6'))['db'];var utils=require(_0xce07('0x7'));var logger=require('../../config/logger')(_0xce07('0x8'));var config=require(_0xce07('0x9'));var jayson=require(_0xce07('0xa'));var client=jayson[_0xce07('0xb')][_0xce07('0xc')]({'port':0x232a});config[_0xce07('0xd')]=_[_0xce07('0xe')](config[_0xce07('0xd')],{'host':_0xce07('0xf'),'port':0x18eb});var socket=require(_0xce07('0x10'))(new Redis(config[_0xce07('0xd')]));require(_0xce07('0x11'))[_0xce07('0x12')](socket);function respondWithRpcPromise(_0x640036,_0x1841c8,_0x140c3e){return new BPromise(function(_0x57d108,_0x33cb49){return client[_0xce07('0x13')](_0x640036,_0x140c3e)[_0xce07('0x14')](function(_0x510afd){logger[_0xce07('0x15')](_0xce07('0x16'),_0x1841c8,_0xce07('0x17'));logger[_0xce07('0x18')](_0xce07('0x19'),_0x1841c8,'request\x20sent',JSON[_0xce07('0x1a')](_0x510afd));if(_0x510afd[_0xce07('0x1b')]){if(_0x510afd[_0xce07('0x1b')][_0xce07('0x1c')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1841c8,_0x510afd[_0xce07('0x1b')][_0xce07('0x1d')]);return _0x33cb49(_0x510afd['error'][_0xce07('0x1d')]);}logger[_0xce07('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x1841c8,_0x510afd['error'][_0xce07('0x1d')]);return _0x57d108(_0x510afd[_0xce07('0x1b')][_0xce07('0x1d')]);}else{logger['info'](_0xce07('0x16'),_0x1841c8,_0xce07('0x17'));_0x57d108(_0x510afd['result']['message']);}})[_0xce07('0x1e')](function(_0x20df84){logger[_0xce07('0x1b')](_0xce07('0x16'),_0x1841c8,_0x20df84);_0x33cb49(_0x20df84);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 36d07fb..e6be1af 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 _0x73dd=['emit','removeListener','./chatInternalMessage.events','save','update'];(function(_0x335dc7,_0x55f535){var _0x526df6=function(_0x3437dd){while(--_0x3437dd){_0x335dc7['push'](_0x335dc7['shift']());}};_0x526df6(++_0x55f535);}(_0x73dd,0xc5));var _0xd73d=function(_0x39a7a5,_0xc92eab){_0x39a7a5=_0x39a7a5-0x0;var _0x55aa3f=_0x73dd[_0x39a7a5];return _0x55aa3f;};'use strict';var ChatInternalMessageEvents=require(_0xd73d('0x0'));var events=[_0xd73d('0x1'),'remove',_0xd73d('0x2')];function createListener(_0xa2fe27,_0x1f4598){return function(_0x3a39a4){_0x1f4598[_0xd73d('0x3')](_0xa2fe27,_0x3a39a4);};}function removeListener(_0xc21b65,_0x1c69d8){return function(){ChatInternalMessageEvents[_0xd73d('0x4')](_0xc21b65,_0x1c69d8);};}exports['register']=function(_0x376595){for(var _0x348d68=0x0,_0x1f632f=events['length'];_0x348d68<_0x1f632f;_0x348d68++){var _0x24c10a=events[_0x348d68];var _0xa4dee5=createListener('chatInternalMessage:'+_0x24c10a,_0x376595);ChatInternalMessageEvents['on'](_0x24c10a,_0xa4dee5);}}; \ No newline at end of file +var _0x54b2=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x1762d,_0x3976d6){var _0x390ff0=function(_0x3962bc){while(--_0x3962bc){_0x1762d['push'](_0x1762d['shift']());}};_0x390ff0(++_0x3976d6);}(_0x54b2,0x113));var _0x254b=function(_0x328bd3,_0x5231d6){_0x328bd3=_0x328bd3-0x0;var _0x5ba7d0=_0x54b2[_0x328bd3];return _0x5ba7d0;};'use strict';var ChatInternalMessageEvents=require(_0x254b('0x0'));var events=[_0x254b('0x1'),_0x254b('0x2'),_0x254b('0x3')];function createListener(_0x50b845,_0x50e4cb){return function(_0x3ed570){_0x50e4cb[_0x254b('0x4')](_0x50b845,_0x3ed570);};}function removeListener(_0x43d5d9,_0x571f13){return function(){ChatInternalMessageEvents[_0x254b('0x5')](_0x43d5d9,_0x571f13);};}exports[_0x254b('0x6')]=function(_0x2ee395){for(var _0x507e55=0x0,_0x34122d=events[_0x254b('0x7')];_0x507e55<_0x34122d;_0x507e55++){var _0x5b5e18=events[_0x507e55];var _0x150147=createListener(_0x254b('0x8')+_0x5b5e18,_0x2ee395);ChatInternalMessageEvents['on'](_0x5b5e18,_0x150147);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 577efd3..b967b31 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 _0xa141=['isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x5ab6fb,_0x2fbddc){var _0xd0aed5=function(_0x411b71){while(--_0x411b71){_0x5ab6fb['push'](_0x5ab6fb['shift']());}};_0xd0aed5(++_0x2fbddc);}(_0xa141,0x11e));var _0x1a14=function(_0x46c4d8,_0x433a55){_0x46c4d8=_0x46c4d8-0x0;var _0x1f0e07=_0xa141[_0x46c4d8];return _0x1f0e07;};'use strict';var multer=require(_0x1a14('0x0'));var util=require('util');var path=require(_0x1a14('0x1'));var timeout=require(_0x1a14('0x2'));var express=require(_0x1a14('0x3'));var router=express[_0x1a14('0x4')]();var fs_extra=require(_0x1a14('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a14('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x1a14('0x7')]('/',auth[_0x1a14('0x8')](),controller[_0x1a14('0x9')]);router['get'](_0x1a14('0xa'),auth[_0x1a14('0x8')](),controller[_0x1a14('0xb')]);router['get'](_0x1a14('0xc'),auth['isAuthenticated'](),controller[_0x1a14('0xd')]);router[_0x1a14('0x7')](_0x1a14('0xe'),auth[_0x1a14('0x8')](),controller['show']);router[_0x1a14('0xf')]('/',auth[_0x1a14('0x8')](),controller[_0x1a14('0x10')]);router['put']('/:id',controller[_0x1a14('0x11')]);router[_0x1a14('0x12')](_0x1a14('0xe'),auth[_0x1a14('0x8')](),controller[_0x1a14('0x13')]);module[_0x1a14('0x14')]=router; \ No newline at end of file +var _0x2dd6=['/describe','isAuthenticated','describe','getUsers','/:id','show','post','create','destroy','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x1aa93c,_0x18bc9b){var _0x4720e6=function(_0x1b1a97){while(--_0x1b1a97){_0x1aa93c['push'](_0x1aa93c['shift']());}};_0x4720e6(++_0x18bc9b);}(_0x2dd6,0x81));var _0x62dd=function(_0x409542,_0x5921c9){_0x409542=_0x409542-0x0;var _0x4cdf40=_0x2dd6[_0x409542];return _0x4cdf40;};'use strict';var multer=require(_0x62dd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62dd('0x1'));var express=require('express');var router=express[_0x62dd('0x2')]();var fs_extra=require(_0x62dd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x62dd('0x4'));var controller=require(_0x62dd('0x5'));router[_0x62dd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62dd('0x6')](_0x62dd('0x7'),auth[_0x62dd('0x8')](),controller[_0x62dd('0x9')]);router['get']('/users',auth['isAuthenticated'](),controller[_0x62dd('0xa')]);router['get'](_0x62dd('0xb'),auth['isAuthenticated'](),controller[_0x62dd('0xc')]);router[_0x62dd('0xd')]('/',auth[_0x62dd('0x8')](),controller[_0x62dd('0xe')]);router['put'](_0x62dd('0xb'),controller['update']);router['delete'](_0x62dd('0xb'),auth[_0x62dd('0x8')](),controller[_0x62dd('0xf')]);module[_0x62dd('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 8fe1e4b..cedad22 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 _0x173d=['exports','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x416d60,_0x56dde9){var _0x286bd7=function(_0x38ba01){while(--_0x38ba01){_0x416d60['push'](_0x416d60['shift']());}};_0x286bd7(++_0x56dde9);}(_0x173d,0x108));var _0xd173=function(_0x17df10,_0x5384be){_0x17df10=_0x17df10-0x0;var _0x2a114b=_0x173d[_0x17df10];return _0x2a114b;};'use strict';var Sequelize=require('sequelize');module[_0xd173('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd173('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd173('0x2')]('in',_0xd173('0x3')),'defaultValue':_0xd173('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd173('0x4')]},'providerName':{'type':Sequelize[_0xd173('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2547=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x2fe986,_0x194907){var _0x360558=function(_0x4c284f){while(--_0x4c284f){_0x2fe986['push'](_0x2fe986['shift']());}};_0x360558(++_0x194907);}(_0x2547,0x1cd));var _0x7254=function(_0x471b87,_0x2e88ed){_0x471b87=_0x471b87-0x0;var _0x3a1236=_0x2547[_0x471b87];return _0x3a1236;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'body':{'type':Sequelize[_0x7254('0x1')](_0x7254('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7254('0x4')]('in',_0x7254('0x5')),'defaultValue':_0x7254('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7254('0x6')]},'providerResponse':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d10f547..aaaca30 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 _0xb7d8=['rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','body','describe','../../config/logger','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','rejectmessage','eml-format'];(function(_0x226232,_0x43950b){var _0x3d8e6d=function(_0x508951){while(--_0x508951){_0x226232['push'](_0x226232['shift']());}};_0x3d8e6d(++_0x43950b);}(_0xb7d8,0x113));var _0x8b7d=function(_0x3aff19,_0x57873f){_0x3aff19=_0x3aff19-0x0;var _0x909e1a=_0xb7d8[_0x3aff19];return _0x909e1a;};'use strict';var emlformat=require(_0x8b7d('0x0'));var rimraf=require(_0x8b7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b7d('0x2'));var moment=require(_0x8b7d('0x3'));var BPromise=require(_0x8b7d('0x4'));var Mustache=require(_0x8b7d('0x5'));var util=require(_0x8b7d('0x6'));var path=require(_0x8b7d('0x7'));var sox=require('sox');var csv=require(_0x8b7d('0x8'));var ejs=require(_0x8b7d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b7d('0xa'));var _=require(_0x8b7d('0xb'));var squel=require(_0x8b7d('0xc'));var crypto=require(_0x8b7d('0xd'));var jsforce=require(_0x8b7d('0xe'));var deskjs=require(_0x8b7d('0xf'));var toCsv=require(_0x8b7d('0x8'));var querystring=require(_0x8b7d('0x10'));var Papa=require(_0x8b7d('0x11'));var Redis=require(_0x8b7d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8b7d('0x13'));var as=require(_0x8b7d('0x14'));var hardwareService=require(_0x8b7d('0x15'));var logger=require('../../config/logger')(_0x8b7d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b7d('0x17'));var db=require('../../mysqldb')['db'];config[_0x8b7d('0x18')]=_[_0x8b7d('0x19')](config[_0x8b7d('0x18')],{'host':_0x8b7d('0x1a'),'port':0x18eb});var socket=require(_0x8b7d('0x1b'))(new Redis(config[_0x8b7d('0x18')]));require('./chatMessage.socket')[_0x8b7d('0x1c')](socket);var jayson=require(_0x8b7d('0x1d'));var client=jayson[_0x8b7d('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x8b7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x213a28,_0x5afe87,_0x4f1483,_0x221759){return new BPromise(function(_0x1fdbe4,_0x858592){var _0x385b98=_0x221759||client;return _0x385b98['request'](_0x213a28,_0x4f1483)['then'](function(_0x57e5ab){logger[_0x8b7d('0x20')](_0x8b7d('0x21'),_0x5afe87,_0x8b7d('0x22'));logger['debug'](_0x8b7d('0x23'),_0x5afe87,_0x8b7d('0x22'),JSON['stringify'](_0x57e5ab));if(_0x57e5ab[_0x8b7d('0x24')]){if(_0x57e5ab[_0x8b7d('0x24')][_0x8b7d('0x25')]===0x1f4){logger[_0x8b7d('0x24')](_0x8b7d('0x21'),_0x5afe87,_0x57e5ab[_0x8b7d('0x24')]['message']);return _0x858592(_0x57e5ab[_0x8b7d('0x24')][_0x8b7d('0x26')]);}logger['error'](_0x8b7d('0x21'),_0x5afe87,_0x57e5ab[_0x8b7d('0x24')][_0x8b7d('0x26')]);return _0x1fdbe4(_0x57e5ab[_0x8b7d('0x24')][_0x8b7d('0x26')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5afe87,_0x8b7d('0x22'));_0x1fdbe4(_0x57e5ab[_0x8b7d('0x27')][_0x8b7d('0x26')]);}})[_0x8b7d('0x28')](function(_0x2ace11){logger[_0x8b7d('0x24')](_0x8b7d('0x21'),_0x5afe87,_0x2ace11);_0x858592(_0x2ace11);});});}function respondWithStatusCode(_0x1126af,_0x428ef8){_0x428ef8=_0x428ef8||0xcc;return function(_0x8e81d){if(_0x8e81d){return _0x1126af[_0x8b7d('0x29')](_0x428ef8);}return _0x1126af[_0x8b7d('0x2a')](_0x428ef8)['end']();};}function respondWithResult(_0x4f3232,_0x5899ab){_0x5899ab=_0x5899ab||0xc8;return function(_0x43b9d9){if(_0x43b9d9){return _0x4f3232['status'](_0x5899ab)['json'](_0x43b9d9);}};}function respondWithFilteredResult(_0xf6f047,_0x3ff0d4){return function(_0x4fc405){if(_0x4fc405){var _0x2bf948=typeof _0x3ff0d4['offset']===_0x8b7d('0x2b')&&typeof _0x3ff0d4['limit']===_0x8b7d('0x2b');var _0x51805b=_0x4fc405[_0x8b7d('0x2c')];var _0x1db041=_0x2bf948?0x0:_0x3ff0d4[_0x8b7d('0x2d')];var _0x591242=_0x2bf948?_0x4fc405[_0x8b7d('0x2c')]:_0x3ff0d4['offset']+_0x3ff0d4['limit'];var _0x47d2d9;if(_0x591242>=_0x51805b){_0x591242=_0x51805b;_0x47d2d9=0xc8;}else{_0x47d2d9=0xce;}_0xf6f047[_0x8b7d('0x2a')](_0x47d2d9);return _0xf6f047[_0x8b7d('0x2e')](_0x8b7d('0x2f'),_0x1db041+'-'+_0x591242+'/'+_0x51805b)[_0x8b7d('0x30')](_0x4fc405);}return null;};}function patchUpdates(_0x7d82cc){return function(_0x20c56b){try{jsonpatch[_0x8b7d('0x31')](_0x20c56b,_0x7d82cc,!![]);}catch(_0x4f1ab1){return BPromise[_0x8b7d('0x32')](_0x4f1ab1);}return _0x20c56b[_0x8b7d('0x33')]();};}function saveUpdates(_0x3a5e71,_0xa6fc0d){return function(_0x4e0d19){if(_0x4e0d19){return _0x4e0d19[_0x8b7d('0x34')](_0x3a5e71)['then'](function(_0x3031ec){return _0x3031ec;});}return null;};}function removeEntity(_0x931dc0,_0x4c5d4a){return function(_0x25e163){if(_0x25e163){return _0x25e163[_0x8b7d('0x35')]()[_0x8b7d('0x36')](function(){_0x931dc0[_0x8b7d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfadcf,_0x197464){return function(_0x5d8a92){if(!_0x5d8a92){_0xfadcf[_0x8b7d('0x29')](0x194);}return _0x5d8a92;};}function handleError(_0x1c92ec,_0x1b23c7){_0x1b23c7=_0x1b23c7||0x1f4;return function(_0x21cda2){logger[_0x8b7d('0x24')](_0x21cda2[_0x8b7d('0x37')]);if(_0x21cda2[_0x8b7d('0x38')]){delete _0x21cda2[_0x8b7d('0x38')];}_0x1c92ec[_0x8b7d('0x2a')](_0x1b23c7)[_0x8b7d('0x39')](_0x21cda2);};}exports['index']=function(_0x333d37,_0x3936d2){var _0x6274d6={},_0x5c6b4a={},_0x1ead79={'count':0x0,'rows':[]};var _0x3203c4=_[_0x8b7d('0x3a')](db[_0x8b7d('0x3b')]['rawAttributes'],function(_0x276741){return{'name':_0x276741[_0x8b7d('0x3c')],'type':_0x276741[_0x8b7d('0x3d')][_0x8b7d('0x3e')]};});_0x5c6b4a[_0x8b7d('0x3f')]=_['map'](_0x3203c4,_0x8b7d('0x38'));_0x5c6b4a[_0x8b7d('0x40')]=_[_0x8b7d('0x41')](_0x333d37['query']);_0x5c6b4a[_0x8b7d('0x42')]=_[_0x8b7d('0x43')](_0x5c6b4a[_0x8b7d('0x3f')],_0x5c6b4a['query']);_0x6274d6[_0x8b7d('0x44')]=_[_0x8b7d('0x43')](_0x5c6b4a[_0x8b7d('0x3f')],qs[_0x8b7d('0x45')](_0x333d37['query'][_0x8b7d('0x45')]));_0x6274d6[_0x8b7d('0x44')]=_0x6274d6[_0x8b7d('0x44')]['length']?_0x6274d6[_0x8b7d('0x44')]:_0x5c6b4a[_0x8b7d('0x3f')];if(!_0x333d37[_0x8b7d('0x40')][_0x8b7d('0x46')](_0x8b7d('0x47'))){_0x6274d6[_0x8b7d('0x48')]=qs[_0x8b7d('0x48')](_0x333d37[_0x8b7d('0x40')]['limit']);_0x6274d6[_0x8b7d('0x2d')]=qs[_0x8b7d('0x2d')](_0x333d37[_0x8b7d('0x40')]['offset']);}_0x6274d6[_0x8b7d('0x49')]=qs[_0x8b7d('0x4a')](_0x333d37[_0x8b7d('0x40')][_0x8b7d('0x4a')]);_0x6274d6[_0x8b7d('0x4b')]=qs[_0x8b7d('0x42')](_[_0x8b7d('0x4c')](_0x333d37['query'],_0x5c6b4a['filters']),_0x3203c4);if(_0x333d37[_0x8b7d('0x40')][_0x8b7d('0x4d')]){_0x6274d6[_0x8b7d('0x4b')]=_[_0x8b7d('0x4e')](_0x6274d6[_0x8b7d('0x4b')],{'$or':_[_0x8b7d('0x3a')](_0x3203c4,function(_0x4d385b){if(_0x4d385b[_0x8b7d('0x3d')]!==_0x8b7d('0x4f')){var _0x1612a9={};_0x1612a9[_0x4d385b['name']]={'$like':'%'+_0x333d37[_0x8b7d('0x40')][_0x8b7d('0x4d')]+'%'};return _0x1612a9;}})});}_0x6274d6=_['merge']({},_0x6274d6,_0x333d37[_0x8b7d('0x50')]);var _0x1da5e4={'where':_0x6274d6[_0x8b7d('0x4b')]};return db[_0x8b7d('0x3b')][_0x8b7d('0x2c')](_0x1da5e4)[_0x8b7d('0x36')](function(_0x540787){_0x1ead79[_0x8b7d('0x2c')]=_0x540787;if(_0x333d37[_0x8b7d('0x40')][_0x8b7d('0x51')]){_0x6274d6[_0x8b7d('0x52')]=[{'all':!![]}];}return db[_0x8b7d('0x3b')][_0x8b7d('0x53')](_0x6274d6);})[_0x8b7d('0x36')](function(_0x2bbd78){_0x1ead79[_0x8b7d('0x54')]=_0x2bbd78;return _0x1ead79;})[_0x8b7d('0x36')](respondWithFilteredResult(_0x3936d2,_0x6274d6))['catch'](handleError(_0x3936d2,null));};exports['show']=function(_0x31ee6d,_0x28805a){var _0x851c1f={'raw':!![],'where':{'id':_0x31ee6d[_0x8b7d('0x55')]['id']}},_0x58c527={};_0x58c527[_0x8b7d('0x3f')]=_[_0x8b7d('0x41')](db['ChatMessage'][_0x8b7d('0x56')]);_0x58c527['query']=_['keys'](_0x31ee6d['query']);_0x58c527['filters']=_[_0x8b7d('0x43')](_0x58c527[_0x8b7d('0x3f')],_0x58c527[_0x8b7d('0x40')]);_0x851c1f[_0x8b7d('0x44')]=_['intersection'](_0x58c527[_0x8b7d('0x3f')],qs[_0x8b7d('0x45')](_0x31ee6d[_0x8b7d('0x40')][_0x8b7d('0x45')]));_0x851c1f['attributes']=_0x851c1f[_0x8b7d('0x44')][_0x8b7d('0x57')]?_0x851c1f[_0x8b7d('0x44')]:_0x58c527[_0x8b7d('0x3f')];if(_0x31ee6d['query']['includeAll']){_0x851c1f['include']=[{'all':!![]}];}_0x851c1f=_[_0x8b7d('0x4e')]({},_0x851c1f,_0x31ee6d['options']);return db['ChatMessage'][_0x8b7d('0x58')](_0x851c1f)[_0x8b7d('0x36')](handleEntityNotFound(_0x28805a,null))['then'](respondWithResult(_0x28805a,null))['catch'](handleError(_0x28805a,null));};exports[_0x8b7d('0x59')]=function(_0x1e2e83,_0x4faba7){return db[_0x8b7d('0x3b')]['create'](_0x1e2e83[_0x8b7d('0x5a')],{})['then'](respondWithResult(_0x4faba7,0xc9))['catch'](handleError(_0x4faba7,null));};exports[_0x8b7d('0x34')]=function(_0x325129,_0x7b542){if(_0x325129[_0x8b7d('0x5a')]['id']){delete _0x325129[_0x8b7d('0x5a')]['id'];}return db['ChatMessage'][_0x8b7d('0x58')]({'where':{'id':_0x325129[_0x8b7d('0x55')]['id']}})[_0x8b7d('0x36')](handleEntityNotFound(_0x7b542,null))[_0x8b7d('0x36')](saveUpdates(_0x325129[_0x8b7d('0x5a')],null))['then'](respondWithResult(_0x7b542,null))[_0x8b7d('0x28')](handleError(_0x7b542,null));};exports[_0x8b7d('0x35')]=function(_0x11d7c1,_0x3a9147){return db[_0x8b7d('0x3b')]['find']({'where':{'id':_0x11d7c1[_0x8b7d('0x55')]['id']}})[_0x8b7d('0x36')](handleEntityNotFound(_0x3a9147,null))['then'](removeEntity(_0x3a9147,null))[_0x8b7d('0x28')](handleError(_0x3a9147,null));};exports[_0x8b7d('0x5b')]=function(_0x51c1ad,_0x2023a2){return db['ChatMessage']['describe']()[_0x8b7d('0x36')](respondWithResult(_0x2023a2,null))['catch'](handleError(_0x2023a2,null));};var interaction_log=require(_0x8b7d('0x5c'))('chat-interactions');exports[_0x8b7d('0x5d')]=function(_0x3e04e0,_0x52867f,_0x4992c2){var _0xfd0f04={'agent':{},'channel':_0x8b7d('0x5e')};if(_0x3e04e0['body']['id']){delete _0x3e04e0[_0x8b7d('0x5a')]['id'];}_0x3e04e0['body']['read']=!![];_0x3e04e0['body'][_0x8b7d('0x5f')]=moment()[_0x8b7d('0x60')](_0x8b7d('0x61'));_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x62')]=_0x3e04e0[_0x8b7d('0x5a')]['UserId']||_0x3e04e0[_0x8b7d('0x63')]['id'];_0xfd0f04[_0x8b7d('0x64')]['id']=_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x62')];return db['ChatMessage'][_0x8b7d('0x58')]({'where':{'id':_0x3e04e0[_0x8b7d('0x55')]['id'],'UserId':null}})[_0x8b7d('0x36')](handleEntityNotFound(_0x52867f,null))['then'](saveUpdates(_0x3e04e0[_0x8b7d('0x5a')],null))['then'](function(_0x310cb9){if(_0x310cb9){_0xfd0f04[_0x8b7d('0x26')]=_0x310cb9['get']({'plain':!![]});return db[_0x8b7d('0x65')][_0x8b7d('0x58')]({'where':{'id':_0x310cb9[_0x8b7d('0x66')]}});}return null;})[_0x8b7d('0x36')](handleEntityNotFound(_0x52867f,null))[_0x8b7d('0x36')](function(_0x31df11){if(_0x31df11){return _0x31df11[_0x8b7d('0x34')]({'UserId':_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x62')],'read1stAt':_[_0x8b7d('0x67')](_0x31df11[_0x8b7d('0x68')])?moment()[_0x8b7d('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3d0a3a){if(_0x3d0a3a){_0xfd0f04[_0x8b7d('0x69')]=_0x3d0a3a[_0x8b7d('0x6a')]({'plain':!![]});interaction_log[_0x8b7d('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e04e0[_0x8b7d('0x63')]['id'],_0x3e04e0[_0x8b7d('0x63')][_0x8b7d('0x38')],_0x3e04e0[_0x8b7d('0x63')]['role'],_0xfd0f04[_0x8b7d('0x69')]['id'],_0x3e04e0[_0x8b7d('0x5a')]?JSON[_0x8b7d('0x6b')](_0x3e04e0['body']):_0x8b7d('0x6c'));return respondWithRpcPromise(_0x8b7d('0x6d'),_0x8b7d('0x6e'),_0xfd0f04);}return null;})[_0x8b7d('0x36')](function(_0x6d44ca){var _0x2ae086=_0x8b7d('0x6f')+_0x6d44ca[_0x8b7d('0x26')][_0x8b7d('0x70')];return db['sequelize'][_0x8b7d('0x40')](_0x2ae086,{'type':db[_0x8b7d('0x71')][_0x8b7d('0x72')][_0x8b7d('0x73')],'raw':!![]})[_0x8b7d('0x36')](function(_0x22ef9b){return _0x22ef9b;});})['then'](function(_0x4f4698){if(_0x4f4698){_0xfd0f04[_0x8b7d('0x26')][_0x8b7d('0x74')]=_0x4f4698[0x0];if(!_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x62')])return;return db[_0x8b7d('0x75')][_0x8b7d('0x58')]({'where':{'id':_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x62')],'role':_0x8b7d('0x64')},'attributes':['id',_0x8b7d('0x38'),_0x8b7d('0x76'),_0x8b7d('0x77'),_0x8b7d('0x78')],'raw':!![]});}return null;})[_0x8b7d('0x36')](function(_0x53eb21){if(!_0x53eb21)return null;_0xfd0f04[_0x8b7d('0x26')]['agent']=_0x53eb21;return _0xfd0f04;})[_0x8b7d('0x36')](function(_0x35c27b){if(_0x35c27b){if(_0x3e04e0[_0x8b7d('0x5a')][_0x8b7d('0x79')]){_0xfd0f04[_0x8b7d('0x26')][_0x8b7d('0x7a')]=util[_0x8b7d('0x60')](_0x8b7d('0x7b'),_0x3e04e0[_0x8b7d('0x63')][_0x8b7d('0x38')]);_0xfd0f04['message'][_0x8b7d('0x7c')]=_0xfd0f04[_0x8b7d('0x7c')];_0xfd0f04[_0x8b7d('0x26')][_0x8b7d('0x7d')]=_0xfd0f04[_0x8b7d('0x7c')];_0xfd0f04['message'][_0x8b7d('0x7e')]=_0x8b7d('0x5d');return respondWithRpcPromise(_0x8b7d('0x7f'),'EventManager',{'event':_0x8b7d('0x80'),'message':_[_0x8b7d('0x4e')](_0xfd0f04[_0x8b7d('0x26')],JSON[_0x8b7d('0x81')](_0xfd0f04[_0x8b7d('0x69')][_0x8b7d('0x82')]))},client9002)[_0x8b7d('0x36')](function(){return _0xfd0f04;});}return _0xfd0f04;}return null;})['then'](respondWithResult(_0x52867f,null))['catch'](handleError(_0x52867f,null));};var interaction_log=require(_0x8b7d('0x5c'))(_0x8b7d('0x83'));exports[_0x8b7d('0x32')]=function(_0x1f9f8c,_0xb74350,_0x1864d6){var _0x37ee05={'agent':{},'channel':_0x8b7d('0x5e')};if(_0x1f9f8c[_0x8b7d('0x5a')]['id']){delete _0x1f9f8c[_0x8b7d('0x5a')]['id'];}_0x1f9f8c[_0x8b7d('0x5a')][_0x8b7d('0x62')]=_0x1f9f8c[_0x8b7d('0x5a')][_0x8b7d('0x62')]||_0x1f9f8c['user']['id'];_0x37ee05[_0x8b7d('0x64')]['id']=_0x1f9f8c['body'][_0x8b7d('0x62')];return db[_0x8b7d('0x3b')][_0x8b7d('0x58')]({'where':{'id':_0x1f9f8c['params']['id'],'UserId':null}})[_0x8b7d('0x36')](handleEntityNotFound(_0xb74350,null))[_0x8b7d('0x36')](function(_0x10b3f4){if(_0x10b3f4){_0x37ee05['message']=_0x10b3f4[_0x8b7d('0x6a')]({'plain':!![]});return db[_0x8b7d('0x65')][_0x8b7d('0x58')]({'where':{'id':_0x10b3f4[_0x8b7d('0x66')]}});}return null;})[_0x8b7d('0x36')](handleEntityNotFound(_0xb74350,null))[_0x8b7d('0x36')](function(_0x490f0c){if(_0x490f0c){_0x37ee05[_0x8b7d('0x69')]=_0x490f0c[_0x8b7d('0x6a')]({'plain':!![]});interaction_log[_0x8b7d('0x20')](_0x8b7d('0x84'),_0x1f9f8c[_0x8b7d('0x63')]['id'],_0x1f9f8c[_0x8b7d('0x63')][_0x8b7d('0x38')],_0x1f9f8c['user'][_0x8b7d('0x85')],_0x37ee05[_0x8b7d('0x69')]['id'],_0x1f9f8c[_0x8b7d('0x5a')]?JSON['stringify'](_0x1f9f8c['body']):_0x8b7d('0x6c'));return respondWithRpcPromise(_0x8b7d('0x86'),_0x8b7d('0x87'),_0x37ee05);}return null;})[_0x8b7d('0x36')](function(_0x21c502){var _0x42df83=_0x8b7d('0x6f')+_0x21c502[_0x8b7d('0x26')]['ContactId'];return db[_0x8b7d('0x88')]['query'](_0x42df83,{'type':db[_0x8b7d('0x71')][_0x8b7d('0x72')][_0x8b7d('0x73')],'raw':!![]})[_0x8b7d('0x36')](function(_0x83896){return _0x83896;});})['then'](function(_0x305525){if(_0x305525){_0x37ee05[_0x8b7d('0x26')][_0x8b7d('0x74')]=_0x305525[0x0];if(!_0x1f9f8c[_0x8b7d('0x5a')][_0x8b7d('0x62')])return;return db[_0x8b7d('0x75')][_0x8b7d('0x58')]({'where':{'id':_0x1f9f8c[_0x8b7d('0x5a')][_0x8b7d('0x62')],'role':_0x8b7d('0x64')},'attributes':['id',_0x8b7d('0x38'),_0x8b7d('0x76'),_0x8b7d('0x77'),'internal'],'raw':!![]});}return null;})[_0x8b7d('0x36')](function(_0xbdfe8b){if(!_0xbdfe8b)return null;_0x37ee05['message'][_0x8b7d('0x64')]=_0xbdfe8b;return _0x37ee05;})[_0x8b7d('0x36')](function(_0xe70953){if(_0xe70953){_0xe70953[_0x8b7d('0x26')]['interface']=util[_0x8b7d('0x60')]('SIP/%s',_0x1f9f8c[_0x8b7d('0x63')][_0x8b7d('0x38')]);_0xe70953['message'][_0x8b7d('0x7c')]=_0x37ee05[_0x8b7d('0x7c')];_0xe70953[_0x8b7d('0x26')][_0x8b7d('0x7d')]=_0x37ee05[_0x8b7d('0x7c')];_0xe70953[_0x8b7d('0x26')][_0x8b7d('0x7e')]=_0x8b7d('0x32');respondWithRpcPromise(_0x8b7d('0x7f'),_0x8b7d('0x7f'),{'event':_0x8b7d('0x89'),'message':_[_0x8b7d('0x4e')](_0x37ee05['message'],JSON[_0x8b7d('0x81')](_0x37ee05['interaction'][_0x8b7d('0x82')]))},client9002);return _0x37ee05;}return null;})[_0x8b7d('0x36')](respondWithResult(_0xb74350,null))['catch'](handleError(_0xb74350,null));}; \ No newline at end of file +var _0xda58=['message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','accept','chat','read','format','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','UserId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','User','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c2df6,_0x3659cd){var _0x41da8c=function(_0xf03476){while(--_0xf03476){_0x2c2df6['push'](_0x2c2df6['shift']());}};_0x41da8c(++_0x3659cd);}(_0xda58,0xea));var _0x8da5=function(_0x1d08f1,_0x8c0438){_0x1d08f1=_0x1d08f1-0x0;var _0x58a254=_0xda58[_0x1d08f1];return _0x58a254;};'use strict';var emlformat=require(_0x8da5('0x0'));var rimraf=require(_0x8da5('0x1'));var zipdir=require(_0x8da5('0x2'));var jsonpatch=require(_0x8da5('0x3'));var rp=require(_0x8da5('0x4'));var moment=require(_0x8da5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8da5('0x6'));var util=require('util');var path=require(_0x8da5('0x7'));var sox=require('sox');var csv=require(_0x8da5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8da5('0x9'));var _=require(_0x8da5('0xa'));var squel=require(_0x8da5('0xb'));var crypto=require('crypto');var jsforce=require(_0x8da5('0xc'));var deskjs=require(_0x8da5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8da5('0xe'));var Papa=require(_0x8da5('0xf'));var Redis=require('ioredis');var authService=require(_0x8da5('0x10'));var qs=require(_0x8da5('0x11'));var as=require(_0x8da5('0x12'));var hardwareService=require(_0x8da5('0x13'));var logger=require(_0x8da5('0x14'))('api');var utils=require(_0x8da5('0x15'));var config=require(_0x8da5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da5('0x17'))['db'];config[_0x8da5('0x18')]=_[_0x8da5('0x19')](config[_0x8da5('0x18')],{'host':_0x8da5('0x1a'),'port':0x18eb});var socket=require(_0x8da5('0x1b'))(new Redis(config[_0x8da5('0x18')]));require(_0x8da5('0x1c'))[_0x8da5('0x1d')](socket);var jayson=require(_0x8da5('0x1e'));var client=jayson[_0x8da5('0x1f')][_0x8da5('0x20')]({'port':0x232c});var client9002=jayson[_0x8da5('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x550fc9,_0xa27e35,_0xfe6fa2,_0x3da833){return new BPromise(function(_0x5f2933,_0xd8a76f){var _0x586c7f=_0x3da833||client;return _0x586c7f[_0x8da5('0x21')](_0x550fc9,_0xfe6fa2)[_0x8da5('0x22')](function(_0x13d522){logger[_0x8da5('0x23')](_0x8da5('0x24'),_0xa27e35,_0x8da5('0x25'));logger[_0x8da5('0x26')](_0x8da5('0x27'),_0xa27e35,_0x8da5('0x25'),JSON[_0x8da5('0x28')](_0x13d522));if(_0x13d522[_0x8da5('0x29')]){if(_0x13d522[_0x8da5('0x29')]['code']===0x1f4){logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);return _0xd8a76f(_0x13d522['error']['message']);}logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);return _0x5f2933(_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);}else{logger['info'](_0x8da5('0x24'),_0xa27e35,'request\x20sent');_0x5f2933(_0x13d522['result'][_0x8da5('0x2a')]);}})[_0x8da5('0x2b')](function(_0x2cc81b){logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x2cc81b);_0xd8a76f(_0x2cc81b);});});}function respondWithStatusCode(_0x52a8c1,_0x5424f1){_0x5424f1=_0x5424f1||0xcc;return function(_0x100e9e){if(_0x100e9e){return _0x52a8c1[_0x8da5('0x2c')](_0x5424f1);}return _0x52a8c1[_0x8da5('0x2d')](_0x5424f1)['end']();};}function respondWithResult(_0x4fefcc,_0x4b4741){_0x4b4741=_0x4b4741||0xc8;return function(_0x38df30){if(_0x38df30){return _0x4fefcc['status'](_0x4b4741)[_0x8da5('0x2e')](_0x38df30);}};}function respondWithFilteredResult(_0x361b54,_0x47ef28){return function(_0x56a425){if(_0x56a425){var _0x4a5dc3=typeof _0x47ef28[_0x8da5('0x2f')]===_0x8da5('0x30')&&typeof _0x47ef28[_0x8da5('0x31')]===_0x8da5('0x30');var _0xb10b6e=_0x56a425['count'];var _0x134211=_0x4a5dc3?0x0:_0x47ef28['offset'];var _0x7d356=_0x4a5dc3?_0x56a425[_0x8da5('0x32')]:_0x47ef28[_0x8da5('0x2f')]+_0x47ef28[_0x8da5('0x31')];var _0x12883d;if(_0x7d356>=_0xb10b6e){_0x7d356=_0xb10b6e;_0x12883d=0xc8;}else{_0x12883d=0xce;}_0x361b54[_0x8da5('0x2d')](_0x12883d);return _0x361b54[_0x8da5('0x33')](_0x8da5('0x34'),_0x134211+'-'+_0x7d356+'/'+_0xb10b6e)['json'](_0x56a425);}return null;};}function patchUpdates(_0x2a3a1e){return function(_0x33a378){try{jsonpatch[_0x8da5('0x35')](_0x33a378,_0x2a3a1e,!![]);}catch(_0x2acbcf){return BPromise[_0x8da5('0x36')](_0x2acbcf);}return _0x33a378[_0x8da5('0x37')]();};}function saveUpdates(_0x446c17,_0xfa877f){return function(_0x517674){if(_0x517674){return _0x517674[_0x8da5('0x38')](_0x446c17)['then'](function(_0x9078fc){return _0x9078fc;});}return null;};}function removeEntity(_0x5239c0,_0x3df03d){return function(_0x232aa1){if(_0x232aa1){return _0x232aa1[_0x8da5('0x39')]()[_0x8da5('0x22')](function(){_0x5239c0[_0x8da5('0x2d')](0xcc)[_0x8da5('0x3a')]();});}};}function handleEntityNotFound(_0x168ff2,_0x597778){return function(_0x195aca){if(!_0x195aca){_0x168ff2['sendStatus'](0x194);}return _0x195aca;};}function handleError(_0xa878b9,_0x519869){_0x519869=_0x519869||0x1f4;return function(_0x4c6d26){logger[_0x8da5('0x29')](_0x4c6d26[_0x8da5('0x3b')]);if(_0x4c6d26['name']){delete _0x4c6d26[_0x8da5('0x3c')];}_0xa878b9[_0x8da5('0x2d')](_0x519869)[_0x8da5('0x3d')](_0x4c6d26);};}exports[_0x8da5('0x3e')]=function(_0x4d59d4,_0x4d244d){var _0x4141fd={},_0x5d8c12={},_0x4cd566={'count':0x0,'rows':[]};var _0x188f2f=_[_0x8da5('0x3f')](db[_0x8da5('0x40')][_0x8da5('0x41')],function(_0x8c0ad8){return{'name':_0x8c0ad8[_0x8da5('0x42')],'type':_0x8c0ad8['type'][_0x8da5('0x43')]};});_0x5d8c12[_0x8da5('0x44')]=_[_0x8da5('0x3f')](_0x188f2f,_0x8da5('0x3c'));_0x5d8c12[_0x8da5('0x45')]=_['keys'](_0x4d59d4[_0x8da5('0x45')]);_0x5d8c12['filters']=_[_0x8da5('0x46')](_0x5d8c12[_0x8da5('0x44')],_0x5d8c12[_0x8da5('0x45')]);_0x4141fd[_0x8da5('0x47')]=_[_0x8da5('0x46')](_0x5d8c12[_0x8da5('0x44')],qs[_0x8da5('0x48')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x48')]));_0x4141fd['attributes']=_0x4141fd['attributes'][_0x8da5('0x49')]?_0x4141fd['attributes']:_0x5d8c12['model'];if(!_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x4a')](_0x8da5('0x4b'))){_0x4141fd[_0x8da5('0x31')]=qs['limit'](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x31')]);_0x4141fd['offset']=qs[_0x8da5('0x2f')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x2f')]);}_0x4141fd[_0x8da5('0x4c')]=qs[_0x8da5('0x4d')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x4d')]);_0x4141fd[_0x8da5('0x4e')]=qs['filters'](_[_0x8da5('0x4f')](_0x4d59d4[_0x8da5('0x45')],_0x5d8c12[_0x8da5('0x50')]),_0x188f2f);if(_0x4d59d4['query'][_0x8da5('0x51')]){_0x4141fd['where']=_[_0x8da5('0x52')](_0x4141fd['where'],{'$or':_[_0x8da5('0x3f')](_0x188f2f,function(_0x1e4245){if(_0x1e4245['type']!==_0x8da5('0x53')){var _0x81663d={};_0x81663d[_0x1e4245[_0x8da5('0x3c')]]={'$like':'%'+_0x4d59d4[_0x8da5('0x45')]['filter']+'%'};return _0x81663d;}})});}_0x4141fd=_['merge']({},_0x4141fd,_0x4d59d4[_0x8da5('0x54')]);var _0x51d924={'where':_0x4141fd[_0x8da5('0x4e')]};return db[_0x8da5('0x40')]['count'](_0x51d924)[_0x8da5('0x22')](function(_0x46631c){_0x4cd566[_0x8da5('0x32')]=_0x46631c;if(_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x55')]){_0x4141fd[_0x8da5('0x56')]=[{'all':!![]}];}return db[_0x8da5('0x40')][_0x8da5('0x57')](_0x4141fd);})[_0x8da5('0x22')](function(_0xa650c1){_0x4cd566[_0x8da5('0x58')]=_0xa650c1;return _0x4cd566;})[_0x8da5('0x22')](respondWithFilteredResult(_0x4d244d,_0x4141fd))[_0x8da5('0x2b')](handleError(_0x4d244d,null));};exports[_0x8da5('0x59')]=function(_0x510dc7,_0x92b997){var _0x2e16da={'raw':!![],'where':{'id':_0x510dc7[_0x8da5('0x5a')]['id']}},_0x35f038={};_0x35f038['model']=_[_0x8da5('0x5b')](db['ChatMessage'][_0x8da5('0x41')]);_0x35f038[_0x8da5('0x45')]=_[_0x8da5('0x5b')](_0x510dc7[_0x8da5('0x45')]);_0x35f038[_0x8da5('0x50')]=_[_0x8da5('0x46')](_0x35f038[_0x8da5('0x44')],_0x35f038[_0x8da5('0x45')]);_0x2e16da[_0x8da5('0x47')]=_[_0x8da5('0x46')](_0x35f038[_0x8da5('0x44')],qs[_0x8da5('0x48')](_0x510dc7[_0x8da5('0x45')][_0x8da5('0x48')]));_0x2e16da[_0x8da5('0x47')]=_0x2e16da[_0x8da5('0x47')][_0x8da5('0x49')]?_0x2e16da[_0x8da5('0x47')]:_0x35f038[_0x8da5('0x44')];if(_0x510dc7['query'][_0x8da5('0x55')]){_0x2e16da[_0x8da5('0x56')]=[{'all':!![]}];}_0x2e16da=_['merge']({},_0x2e16da,_0x510dc7['options']);return db['ChatMessage'][_0x8da5('0x5c')](_0x2e16da)[_0x8da5('0x22')](handleEntityNotFound(_0x92b997,null))[_0x8da5('0x22')](respondWithResult(_0x92b997,null))[_0x8da5('0x2b')](handleError(_0x92b997,null));};exports['create']=function(_0x5643cb,_0x11665f){return db[_0x8da5('0x40')]['create'](_0x5643cb[_0x8da5('0x5d')],{})[_0x8da5('0x22')](respondWithResult(_0x11665f,0xc9))[_0x8da5('0x2b')](handleError(_0x11665f,null));};exports[_0x8da5('0x38')]=function(_0x4cc9e2,_0x2b98df){if(_0x4cc9e2[_0x8da5('0x5d')]['id']){delete _0x4cc9e2[_0x8da5('0x5d')]['id'];}return db[_0x8da5('0x40')][_0x8da5('0x5c')]({'where':{'id':_0x4cc9e2[_0x8da5('0x5a')]['id']}})[_0x8da5('0x22')](handleEntityNotFound(_0x2b98df,null))['then'](saveUpdates(_0x4cc9e2[_0x8da5('0x5d')],null))[_0x8da5('0x22')](respondWithResult(_0x2b98df,null))[_0x8da5('0x2b')](handleError(_0x2b98df,null));};exports[_0x8da5('0x39')]=function(_0x454003,_0x42dfab){return db['ChatMessage'][_0x8da5('0x5c')]({'where':{'id':_0x454003[_0x8da5('0x5a')]['id']}})[_0x8da5('0x22')](handleEntityNotFound(_0x42dfab,null))[_0x8da5('0x22')](removeEntity(_0x42dfab,null))[_0x8da5('0x2b')](handleError(_0x42dfab,null));};exports[_0x8da5('0x5e')]=function(_0x33ad9b,_0x194bf8){return db[_0x8da5('0x40')]['describe']()[_0x8da5('0x22')](respondWithResult(_0x194bf8,null))[_0x8da5('0x2b')](handleError(_0x194bf8,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8da5('0x5f')]=function(_0x5d6584,_0x28829c,_0x4f3f5c){var _0xcd10b0={'agent':{},'channel':_0x8da5('0x60')};if(_0x5d6584[_0x8da5('0x5d')]['id']){delete _0x5d6584[_0x8da5('0x5d')]['id'];}_0x5d6584[_0x8da5('0x5d')][_0x8da5('0x61')]=!![];_0x5d6584[_0x8da5('0x5d')]['readAt']=moment()[_0x8da5('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d6584[_0x8da5('0x5d')]['UserId']=_0x5d6584['body']['UserId']||_0x5d6584[_0x8da5('0x63')]['id'];_0xcd10b0[_0x8da5('0x64')]['id']=_0x5d6584['body']['UserId'];return db[_0x8da5('0x40')]['find']({'where':{'id':_0x5d6584[_0x8da5('0x5a')]['id'],'UserId':null}})[_0x8da5('0x22')](handleEntityNotFound(_0x28829c,null))[_0x8da5('0x22')](saveUpdates(_0x5d6584[_0x8da5('0x5d')],null))[_0x8da5('0x22')](function(_0x1b0259){if(_0x1b0259){_0xcd10b0[_0x8da5('0x2a')]=_0x1b0259['get']({'plain':!![]});return db[_0x8da5('0x65')][_0x8da5('0x5c')]({'where':{'id':_0x1b0259[_0x8da5('0x66')]}});}return null;})[_0x8da5('0x22')](handleEntityNotFound(_0x28829c,null))['then'](function(_0x2952ec){if(_0x2952ec){return _0x2952ec[_0x8da5('0x38')]({'UserId':_0x5d6584[_0x8da5('0x5d')]['UserId'],'read1stAt':_[_0x8da5('0x67')](_0x2952ec[_0x8da5('0x68')])?moment()[_0x8da5('0x62')](_0x8da5('0x69')):undefined});}return null;})['then'](function(_0x446ab8){if(_0x446ab8){_0xcd10b0[_0x8da5('0x6a')]=_0x446ab8[_0x8da5('0x6b')]({'plain':!![]});interaction_log[_0x8da5('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d6584[_0x8da5('0x63')]['id'],_0x5d6584[_0x8da5('0x63')]['name'],_0x5d6584[_0x8da5('0x63')][_0x8da5('0x6c')],_0xcd10b0[_0x8da5('0x6a')]['id'],_0x5d6584[_0x8da5('0x5d')]?JSON[_0x8da5('0x28')](_0x5d6584[_0x8da5('0x5d')]):_0x8da5('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x8da5('0x6e'),_0xcd10b0);}return null;})[_0x8da5('0x22')](function(_0x3f5007){var _0x2786d6=_0x8da5('0x6f')+_0x3f5007[_0x8da5('0x2a')][_0x8da5('0x70')];return db[_0x8da5('0x71')][_0x8da5('0x45')](_0x2786d6,{'type':db['Sequelize'][_0x8da5('0x72')][_0x8da5('0x73')],'raw':!![]})['then'](function(_0x392253){return _0x392253;});})[_0x8da5('0x22')](function(_0x4edfae){if(_0x4edfae){_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x74')]=_0x4edfae[0x0];if(!_0x5d6584[_0x8da5('0x5d')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5d6584[_0x8da5('0x5d')]['UserId'],'role':_0x8da5('0x64')},'attributes':['id',_0x8da5('0x3c'),_0x8da5('0x75'),_0x8da5('0x76'),_0x8da5('0x77')],'raw':!![]});}return null;})['then'](function(_0x503495){if(!_0x503495)return null;_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x64')]=_0x503495;return _0xcd10b0;})[_0x8da5('0x22')](function(_0x28f745){if(_0x28f745){if(_0x5d6584[_0x8da5('0x5d')][_0x8da5('0x78')]){_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x79')]=util[_0x8da5('0x62')](_0x8da5('0x7a'),_0x5d6584[_0x8da5('0x63')]['name']);_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x7b')]=_0xcd10b0['channel'];_0xcd10b0['message'][_0x8da5('0x7c')]=_0xcd10b0['channel'];_0xcd10b0['message'][_0x8da5('0x7d')]=_0x8da5('0x5f');return respondWithRpcPromise(_0x8da5('0x7e'),_0x8da5('0x7e'),{'event':_0x8da5('0x7f'),'message':_[_0x8da5('0x52')](_0xcd10b0['message'],JSON['parse'](_0xcd10b0[_0x8da5('0x6a')][_0x8da5('0x80')]))},client9002)[_0x8da5('0x22')](function(){return _0xcd10b0;});}return _0xcd10b0;}return null;})[_0x8da5('0x22')](respondWithResult(_0x28829c,null))[_0x8da5('0x2b')](handleError(_0x28829c,null));};var interaction_log=require(_0x8da5('0x14'))(_0x8da5('0x81'));exports[_0x8da5('0x36')]=function(_0x178285,_0x396201,_0x201949){var _0x51b31e={'agent':{},'channel':_0x8da5('0x60')};if(_0x178285[_0x8da5('0x5d')]['id']){delete _0x178285[_0x8da5('0x5d')]['id'];}_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')]=_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')]||_0x178285[_0x8da5('0x63')]['id'];_0x51b31e['agent']['id']=_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')];return db['ChatMessage']['find']({'where':{'id':_0x178285[_0x8da5('0x5a')]['id'],'UserId':null}})[_0x8da5('0x22')](handleEntityNotFound(_0x396201,null))['then'](function(_0x4eea3f){if(_0x4eea3f){_0x51b31e['message']=_0x4eea3f[_0x8da5('0x6b')]({'plain':!![]});return db[_0x8da5('0x65')]['find']({'where':{'id':_0x4eea3f['ChatInteractionId']}});}return null;})[_0x8da5('0x22')](handleEntityNotFound(_0x396201,null))[_0x8da5('0x22')](function(_0x13c376){if(_0x13c376){_0x51b31e[_0x8da5('0x6a')]=_0x13c376[_0x8da5('0x6b')]({'plain':!![]});interaction_log['info'](_0x8da5('0x83'),_0x178285[_0x8da5('0x63')]['id'],_0x178285[_0x8da5('0x63')][_0x8da5('0x3c')],_0x178285['user'][_0x8da5('0x6c')],_0x51b31e[_0x8da5('0x6a')]['id'],_0x178285[_0x8da5('0x5d')]?JSON[_0x8da5('0x28')](_0x178285[_0x8da5('0x5d')]):'null');return respondWithRpcPromise(_0x8da5('0x84'),_0x8da5('0x85'),_0x51b31e);}return null;})[_0x8da5('0x22')](function(_0x2bf0a0){var _0x54798b=_0x8da5('0x6f')+_0x2bf0a0[_0x8da5('0x2a')][_0x8da5('0x70')];return db[_0x8da5('0x71')][_0x8da5('0x45')](_0x54798b,{'type':db[_0x8da5('0x86')][_0x8da5('0x72')][_0x8da5('0x73')],'raw':!![]})['then'](function(_0x32037c){return _0x32037c;});})[_0x8da5('0x22')](function(_0x56fdb3){if(_0x56fdb3){_0x51b31e[_0x8da5('0x2a')]['contact']=_0x56fdb3[0x0];if(!_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')])return;return db[_0x8da5('0x87')][_0x8da5('0x5c')]({'where':{'id':_0x178285[_0x8da5('0x5d')]['UserId'],'role':_0x8da5('0x64')},'attributes':['id','name',_0x8da5('0x75'),_0x8da5('0x76'),_0x8da5('0x77')],'raw':!![]});}return null;})[_0x8da5('0x22')](function(_0x2a4288){if(!_0x2a4288)return null;_0x51b31e[_0x8da5('0x2a')]['agent']=_0x2a4288;return _0x51b31e;})['then'](function(_0x399a49){if(_0x399a49){_0x399a49[_0x8da5('0x2a')]['interface']=util['format']('SIP/%s',_0x178285['user']['name']);_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7b')]=_0x51b31e[_0x8da5('0x7b')];_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7c')]=_0x51b31e[_0x8da5('0x7b')];_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7d')]='reject';respondWithRpcPromise(_0x8da5('0x7e'),'EventManager',{'event':_0x8da5('0x88'),'message':_[_0x8da5('0x52')](_0x51b31e[_0x8da5('0x2a')],JSON[_0x8da5('0x89')](_0x51b31e[_0x8da5('0x6a')][_0x8da5('0x80')]))},client9002);return _0x51b31e;}return null;})[_0x8da5('0x22')](respondWithResult(_0x396201,null))[_0x8da5('0x2b')](handleError(_0x396201,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a059169..5c39c8e 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 _0x65d5=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x14d8c1,_0x39c8ec){var _0xe3c07e=function(_0x3bef60){while(--_0x3bef60){_0x14d8c1['push'](_0x14d8c1['shift']());}};_0xe3c07e(++_0x39c8ec);}(_0x65d5,0x1ae));var _0x565d=function(_0x4e8ffa,_0x5c243b){_0x4e8ffa=_0x4e8ffa-0x0;var _0x1ae8cf=_0x65d5[_0x4e8ffa];return _0x1ae8cf;};'use strict';var EventEmitter=require(_0x565d('0x0'));var ChatMessage=require(_0x565d('0x1'))['db'][_0x565d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x565d('0x3')](0x0);var events={'afterCreate':_0x565d('0x4'),'afterUpdate':_0x565d('0x5'),'afterDestroy':_0x565d('0x6')};function emitEvent(_0x1b2cc1){return function(_0x20c7ac,_0x49b4e2,_0x562f5b){ChatMessageEvents['emit'](_0x1b2cc1+':'+_0x20c7ac['id'],_0x20c7ac);ChatMessageEvents[_0x565d('0x7')](_0x1b2cc1,_0x20c7ac);_0x562f5b(null);};}for(var e in events){if(events[_0x565d('0x8')](e)){var event=events[e];ChatMessage[_0x565d('0x9')](e,emitEvent(event));}}module[_0x565d('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0xe174=['../../mysqldb','ChatMessage','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe174,0x1b7));var _0x4e17=function(_0xee4bb8,_0x23b2ae){_0xee4bb8=_0xee4bb8-0x0;var _0xa0c0be=_0xe174[_0xee4bb8];return _0xa0c0be;};'use strict';var EventEmitter=require(_0x4e17('0x0'));var ChatMessage=require(_0x4e17('0x1'))['db'][_0x4e17('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4e17('0x3')](0x0);var events={'afterCreate':_0x4e17('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c9122){return function(_0x44f3e6,_0x2cf4bf,_0xd02cbe){ChatMessageEvents[_0x4e17('0x5')](_0x4c9122+':'+_0x44f3e6['id'],_0x44f3e6);ChatMessageEvents[_0x4e17('0x5')](_0x4c9122,_0x44f3e6);_0xd02cbe(null);};}for(var e in events){if(events[_0x4e17('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x4e17('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 48a6e48..f58c7ac 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 _0x6a46=['isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','out','secret'];(function(_0x2bf8ef,_0x7a261c){var _0x44106b=function(_0x269891){while(--_0x269891){_0x2bf8ef['push'](_0x2bf8ef['shift']());}};_0x44106b(++_0x7a261c);}(_0x6a46,0x1cd));var _0x66a4=function(_0x56d2b3,_0x3c4a59){_0x56d2b3=_0x56d2b3-0x0;var _0x5c7a00=_0x6a46[_0x56d2b3];return _0x5c7a00;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66a4('0x0'))(_0x66a4('0x1'));var moment=require(_0x66a4('0x2'));var BPromise=require(_0x66a4('0x3'));var rp=require(_0x66a4('0x4'));var fs=require('fs');var path=require(_0x66a4('0x5'));var rimraf=require(_0x66a4('0x6'));var config=require(_0x66a4('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x3d0379,_0x43ab8d){return _0x3d0379[_0x66a4('0x8')](_0x66a4('0x9'),attributes,{'tableName':_0x66a4('0xa'),'paranoid':![],'indexes':[{'name':_0x66a4('0xb'),'fields':[_0x66a4('0xc')],'type':_0x66a4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bd249,_0x127271,_0x2aee52){var _0x1e3c20=_0x3d0379[_0x66a4('0xe')];var _0x195b44=_0x3bd249[_0x66a4('0xf')]({'plain':!![]});if(_0x195b44['direction']['toLowerCase']()==='in'||_0x195b44['direction'][_0x66a4('0x10')]()===_0x66a4('0x11')&&!_0x195b44[_0x66a4('0x12')]&&!_[_0x66a4('0x13')](_0x195b44[_0x66a4('0x14')])){_0x1e3c20[_0x66a4('0x15')][_0x66a4('0x16')]({'where':{'id':_0x195b44[_0x66a4('0x17')]}})[_0x66a4('0x18')](function(_0x649ba9){if(_0x649ba9){_0x649ba9[_0x66a4('0x19')]({'lastMsgAt':_0x195b44[_0x66a4('0x1a')],'lastMsgDirection':_0x195b44[_0x66a4('0x1b')][_0x66a4('0x10')]()});}})[_0x66a4('0x1c')](function(_0xaedf94){console[_0x66a4('0x1d')](_0xaedf94);});}_0x2aee52();}},'charset':_0x66a4('0x1e'),'collate':_0x66a4('0x1f')});}; \ No newline at end of file +var _0x8646=['ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','ChatInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x31a8d4,_0x1f9a85){var _0x57cd33=function(_0x3ca875){while(--_0x3ca875){_0x31a8d4['push'](_0x31a8d4['shift']());}};_0x57cd33(++_0x1f9a85);}(_0x8646,0xf1));var _0x6864=function(_0x22c880,_0x392465){_0x22c880=_0x22c880-0x0;var _0x5b193d=_0x8646[_0x22c880];return _0x5b193d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6864('0x0'))(_0x6864('0x1'));var moment=require(_0x6864('0x2'));var BPromise=require(_0x6864('0x3'));var rp=require(_0x6864('0x4'));var fs=require('fs');var path=require(_0x6864('0x5'));var rimraf=require(_0x6864('0x6'));var config=require(_0x6864('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x1e0b07,_0x5a5d6b){return _0x1e0b07[_0x6864('0x8')](_0x6864('0x9'),attributes,{'tableName':_0x6864('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6864('0xb')],'type':_0x6864('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfbc65f,_0x280c00,_0x210a24){var _0x36530f=_0x1e0b07[_0x6864('0xd')];var _0x31b709=_0xfbc65f['get']({'plain':!![]});if(_0x31b709[_0x6864('0xe')][_0x6864('0xf')]()==='in'||_0x31b709[_0x6864('0xe')]['toLowerCase']()===_0x6864('0x10')&&!_0x31b709['secret']&&!_[_0x6864('0x11')](_0x31b709[_0x6864('0x12')])){_0x36530f['ChatInteraction'][_0x6864('0x13')]({'where':{'id':_0x31b709[_0x6864('0x14')]}})['then'](function(_0x476677){if(_0x476677){_0x476677[_0x6864('0x15')]({'lastMsgAt':_0x31b709['createdAt'],'lastMsgDirection':_0x31b709[_0x6864('0xe')][_0x6864('0xf')]()});}})['catch'](function(_0x5cf9f2){console[_0x6864('0x16')](_0x5cf9f2);});}_0x210a24();}},'charset':_0x6864('0x17'),'collate':_0x6864('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3753c97..b5ddcbe 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 _0x1779=['error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','stringify'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x1779,0x175));var _0x9177=function(_0x43480b,_0x253501){_0x43480b=_0x43480b-0x0;var _0x4526d0=_0x1779[_0x43480b];return _0x4526d0;};'use strict';var _=require(_0x9177('0x0'));var util=require(_0x9177('0x1'));var moment=require(_0x9177('0x2'));var BPromise=require(_0x9177('0x3'));var rs=require(_0x9177('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9177('0x5'))['db'];var utils=require(_0x9177('0x6'));var logger=require(_0x9177('0x7'))(_0x9177('0x8'));var config=require('../../config/environment');var jayson=require(_0x9177('0x9'));var client=jayson[_0x9177('0xa')][_0x9177('0xb')]({'port':0x232a});config['redis']=_[_0x9177('0xc')](config[_0x9177('0xd')],{'host':_0x9177('0xe'),'port':0x18eb});var socket=require(_0x9177('0xf'))(new Redis(config[_0x9177('0xd')]));require(_0x9177('0x10'))[_0x9177('0x11')](socket);function respondWithRpcPromise(_0x2d3aaa,_0x3e8105,_0x564e73){return new BPromise(function(_0xa64a96,_0x32eaa4){return client[_0x9177('0x12')](_0x2d3aaa,_0x564e73)[_0x9177('0x13')](function(_0x57aa1e){logger[_0x9177('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3e8105,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3e8105,_0x9177('0x15'),JSON[_0x9177('0x16')](_0x57aa1e));if(_0x57aa1e[_0x9177('0x17')]){if(_0x57aa1e[_0x9177('0x17')][_0x9177('0x18')]===0x1f4){logger[_0x9177('0x17')](_0x9177('0x19'),_0x3e8105,_0x57aa1e[_0x9177('0x17')][_0x9177('0x1a')]);return _0x32eaa4(_0x57aa1e[_0x9177('0x17')][_0x9177('0x1a')]);}logger[_0x9177('0x17')](_0x9177('0x19'),_0x3e8105,_0x57aa1e[_0x9177('0x17')][_0x9177('0x1a')]);return _0xa64a96(_0x57aa1e[_0x9177('0x17')]['message']);}else{logger[_0x9177('0x14')](_0x9177('0x19'),_0x3e8105,_0x9177('0x15'));_0xa64a96(_0x57aa1e[_0x9177('0x1b')][_0x9177('0x1a')]);}})[_0x9177('0x1c')](function(_0x1d09ed){logger['error'](_0x9177('0x19'),_0x3e8105,_0x1d09ed);_0x32eaa4(_0x1d09ed);});});}exports[_0x9177('0x1d')]=function(_0x5be53){var _0x1bfbee=this;return new Promise(function(_0x2a811b,_0x30a78a){return db[_0x9177('0x1e')][_0x9177('0x1f')](_0x5be53[_0x9177('0x20')],{'raw':_0x5be53[_0x9177('0x21')]?_0x5be53[_0x9177('0x21')][_0x9177('0x22')]===undefined?!![]:![]:!![]})[_0x9177('0x13')](function(_0x2a1e6e){logger[_0x9177('0x14')](_0x9177('0x1d'),_0x5be53);logger[_0x9177('0x23')]('CreateChatMessage',_0x5be53,JSON[_0x9177('0x16')](_0x2a1e6e));_0x2a811b(_0x2a1e6e);})[_0x9177('0x1c')](function(_0x473032){logger[_0x9177('0x17')](_0x9177('0x1d'),_0x473032[_0x9177('0x1a')],_0x5be53);_0x30a78a(_0x1bfbee['error'](0x1f4,_0x473032['message']));});});}; \ No newline at end of file +var _0x8331=['client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b4210,_0x521514){var _0x5b5b93=function(_0x2a3140){while(--_0x2a3140){_0x2b4210['push'](_0x2b4210['shift']());}};_0x5b5b93(++_0x521514);}(_0x8331,0xff));var _0x1833=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x8331[_0x454018];return _0x24697d;};'use strict';var _=require(_0x1833('0x0'));var util=require('util');var moment=require(_0x1833('0x1'));var BPromise=require(_0x1833('0x2'));var rs=require(_0x1833('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1833('0x4'));var logger=require(_0x1833('0x5'))(_0x1833('0x6'));var config=require(_0x1833('0x7'));var jayson=require(_0x1833('0x8'));var client=jayson[_0x1833('0x9')]['http']({'port':0x232a});config[_0x1833('0xa')]=_['defaults'](config[_0x1833('0xa')],{'host':_0x1833('0xb'),'port':0x18eb});var socket=require(_0x1833('0xc'))(new Redis(config[_0x1833('0xa')]));require(_0x1833('0xd'))[_0x1833('0xe')](socket);function respondWithRpcPromise(_0x2268d9,_0x6c25db,_0x147235){return new BPromise(function(_0x1c1bd4,_0x55ccbd){return client[_0x1833('0xf')](_0x2268d9,_0x147235)[_0x1833('0x10')](function(_0x1770b6){logger[_0x1833('0x11')](_0x1833('0x12'),_0x6c25db,'request\x20sent');logger[_0x1833('0x13')](_0x1833('0x14'),_0x6c25db,_0x1833('0x15'),JSON[_0x1833('0x16')](_0x1770b6));if(_0x1770b6[_0x1833('0x17')]){if(_0x1770b6['error'][_0x1833('0x18')]===0x1f4){logger[_0x1833('0x17')](_0x1833('0x12'),_0x6c25db,_0x1770b6['error']['message']);return _0x55ccbd(_0x1770b6[_0x1833('0x17')][_0x1833('0x19')]);}logger[_0x1833('0x17')](_0x1833('0x12'),_0x6c25db,_0x1770b6['error']['message']);return _0x1c1bd4(_0x1770b6[_0x1833('0x17')]['message']);}else{logger['info'](_0x1833('0x12'),_0x6c25db,_0x1833('0x15'));_0x1c1bd4(_0x1770b6[_0x1833('0x1a')]['message']);}})[_0x1833('0x1b')](function(_0x22c2b2){logger[_0x1833('0x17')]('ChatMessage,\x20%s,\x20%s',_0x6c25db,_0x22c2b2);_0x55ccbd(_0x22c2b2);});});}exports['CreateChatMessage']=function(_0x351107){var _0x4383e3=this;return new Promise(function(_0x34cd2b,_0x1c7321){return db[_0x1833('0x1c')][_0x1833('0x1d')](_0x351107[_0x1833('0x1e')],{'raw':_0x351107[_0x1833('0x1f')]?_0x351107[_0x1833('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x1833('0x10')](function(_0x3cbe6a){logger[_0x1833('0x11')](_0x1833('0x20'),_0x351107);logger[_0x1833('0x13')](_0x1833('0x20'),_0x351107,JSON[_0x1833('0x16')](_0x3cbe6a));_0x34cd2b(_0x3cbe6a);})['catch'](function(_0x582ec8){logger[_0x1833('0x17')]('CreateChatMessage',_0x582ec8['message'],_0x351107);_0x1c7321(_0x4383e3[_0x1833('0x17')](0x1f4,_0x582ec8[_0x1833('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e0aa5d8..7364655 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 _0xeb5d=['register','length','chatMessage:','save','remove','update','emit','removeListener'];(function(_0x522a17,_0x2736e5){var _0x44f1bd=function(_0x2e0325){while(--_0x2e0325){_0x522a17['push'](_0x522a17['shift']());}};_0x44f1bd(++_0x2736e5);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb5d[_0x40a045];return _0x1a687c;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xdeb5('0x0'),_0xdeb5('0x1'),_0xdeb5('0x2')];function createListener(_0x2b0a09,_0x55bbde){return function(_0x5acd11){_0x55bbde[_0xdeb5('0x3')](_0x2b0a09,_0x5acd11);};}function removeListener(_0x16c31b,_0x546313){return function(){ChatMessageEvents[_0xdeb5('0x4')](_0x16c31b,_0x546313);};}exports[_0xdeb5('0x5')]=function(_0x164ecb){for(var _0x33af72=0x0,_0x120329=events[_0xdeb5('0x6')];_0x33af72<_0x120329;_0x33af72++){var _0x328d6b=events[_0x33af72];var _0x35c086=createListener(_0xdeb5('0x7')+_0x328d6b,_0x164ecb);ChatMessageEvents['on'](_0x328d6b,_0x35c086);}}; \ No newline at end of file +var _0xa7e6=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x3ba89a,_0x34affe){var _0x50bd58=function(_0xa01b75){while(--_0xa01b75){_0x3ba89a['push'](_0x3ba89a['shift']());}};_0x50bd58(++_0x34affe);}(_0xa7e6,0x74));var _0x6a7e=function(_0x119769,_0x32865d){_0x119769=_0x119769-0x0;var _0x105c19=_0xa7e6[_0x119769];return _0x105c19;};'use strict';var ChatMessageEvents=require(_0x6a7e('0x0'));var events=[_0x6a7e('0x1'),_0x6a7e('0x2'),_0x6a7e('0x3')];function createListener(_0x67fa72,_0x21c1de){return function(_0x4c809c){_0x21c1de[_0x6a7e('0x4')](_0x67fa72,_0x4c809c);};}function removeListener(_0x8787b5,_0x1ea310){return function(){ChatMessageEvents[_0x6a7e('0x5')](_0x8787b5,_0x1ea310);};}exports[_0x6a7e('0x6')]=function(_0x599006){for(var _0x79df6f=0x0,_0x16249d=events[_0x6a7e('0x7')];_0x79df6f<_0x16249d;_0x79df6f++){var _0x342c96=events[_0x79df6f];var _0x45e92e=createListener(_0x6a7e('0x8')+_0x342c96,_0x599006);ChatMessageEvents['on'](_0x342c96,_0x45e92e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6833f35..46d16c4 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 _0xe3e3=['accept','put','reject','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','chat','chatmessage:create','update','/:id/accept'];(function(_0x1379b2,_0x550f73){var _0x93f87c=function(_0x44d760){while(--_0x44d760){_0x1379b2['push'](_0x1379b2['shift']());}};_0x93f87c(++_0x550f73);}(_0xe3e3,0xd7));var _0x3e3e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe3e3[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x3e3e('0x0'));var util=require('util');var path=require(_0x3e3e('0x1'));var timeout=require(_0x3e3e('0x2'));var express=require(_0x3e3e('0x3'));var router=express[_0x3e3e('0x4')]();var fs_extra=require(_0x3e3e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e3e('0x6'));var controller=require(_0x3e3e('0x7'));router[_0x3e3e('0x8')]('/',auth[_0x3e3e('0x9')](),controller[_0x3e3e('0xa')]);router[_0x3e3e('0x8')](_0x3e3e('0xb'),auth[_0x3e3e('0x9')](),controller[_0x3e3e('0xc')]);router[_0x3e3e('0x8')]('/:id',auth[_0x3e3e('0x9')](),controller['show']);router[_0x3e3e('0xd')]('/',auth[_0x3e3e('0x9')](),interaction[_0x3e3e('0xe')](_0x3e3e('0xf'),_0x3e3e('0x10')),controller['create']);router['put']('/:id',controller[_0x3e3e('0x11')]);router['put'](_0x3e3e('0x12'),auth['isAuthenticated'](),controller[_0x3e3e('0x13')]);router[_0x3e3e('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3e3e('0x15')]);router[_0x3e3e('0x16')](_0x3e3e('0x17'),auth[_0x3e3e('0x9')](),controller[_0x3e3e('0x18')]);module[_0x3e3e('0x19')]=router; \ No newline at end of file +var _0xcf9f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','show','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5f158a,_0x380823){var _0x3ffb26=function(_0x5c71f3){while(--_0x5c71f3){_0x5f158a['push'](_0x5f158a['shift']());}};_0x3ffb26(++_0x380823);}(_0xcf9f,0x182));var _0xfcf9=function(_0x577298,_0x351f89){_0x577298=_0x577298-0x0;var _0x42c0b0=_0xcf9f[_0x577298];return _0x42c0b0;};'use strict';var multer=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var path=require(_0xfcf9('0x2'));var timeout=require(_0xfcf9('0x3'));var express=require(_0xfcf9('0x4'));var router=express[_0xfcf9('0x5')]();var fs_extra=require(_0xfcf9('0x6'));var auth=require(_0xfcf9('0x7'));var interaction=require(_0xfcf9('0x8'));var config=require('../../config/environment');var controller=require(_0xfcf9('0x9'));router[_0xfcf9('0xa')]('/',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xc')]);router['get']('/describe',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xd')]);router[_0xfcf9('0xa')]('/:id',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xe')]);router['post']('/',auth[_0xfcf9('0xb')](),interaction[_0xfcf9('0xf')](_0xfcf9('0x10'),_0xfcf9('0x11')),controller[_0xfcf9('0x12')]);router[_0xfcf9('0x13')](_0xfcf9('0x14'),controller[_0xfcf9('0x15')]);router[_0xfcf9('0x13')](_0xfcf9('0x16'),auth[_0xfcf9('0xb')](),controller['accept']);router[_0xfcf9('0x13')]('/:id/reject',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0x17')]);router['delete'](_0xfcf9('0x14'),auth['isAuthenticated'](),controller[_0xfcf9('0x18')]);module[_0xfcf9('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f035363..f0239cc 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x222f7a,_0x47de96){var _0x4da2c1=function(_0x53063c){while(--_0x53063c){_0x222f7a['push'](_0x222f7a['shift']());}};_0x4da2c1(++_0x47de96);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f8999,_0x58ef02){_0x1f8999=_0x1f8999-0x0;var _0x4a4d99=_0xb10b[_0x1f8999];return _0x4a4d99;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0x0b0e[_0x58db4e];return _0x40139a;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3ad11d1..16f53eb 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(_0x1a7441,_0x4c408e){var _0xb3c67=function(_0x4bd098){while(--_0x4bd098){_0x1a7441['push'](_0x1a7441['shift']());}};_0xb3c67(++_0x4c408e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x7a54,0x106));var _0x47a5=function(_0x49ab41,_0x501330){_0x49ab41=_0x49ab41-0x0;var _0x5074c7=_0x7a54[_0x49ab41];return _0x5074c7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0ba39de..bccc91d 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 _0x9137=['ChatOfflineMessage','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x9137,0x15d));var _0x7913=function(_0x2a84d6,_0x538497){_0x2a84d6=_0x2a84d6-0x0;var _0x55c2ea=_0x9137[_0x2a84d6];return _0x55c2ea;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x7913('0x0'))['db'][_0x7913('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7913('0x2'),'afterUpdate':'update','afterDestroy':_0x7913('0x3')};function emitEvent(_0x55c380){return function(_0x4e502e,_0x3f4689,_0x4755b3){ChatOfflineMessageEvents[_0x7913('0x4')](_0x55c380+':'+_0x4e502e['id'],_0x4e502e);ChatOfflineMessageEvents['emit'](_0x55c380,_0x4e502e);_0x4755b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x7913('0x5')](e,emitEvent(event));}}module[_0x7913('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7850=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','update','remove'];(function(_0x3c4e48,_0x43a5eb){var _0x37fd7e=function(_0x27aa2b){while(--_0x27aa2b){_0x3c4e48['push'](_0x3c4e48['shift']());}};_0x37fd7e(++_0x43a5eb);}(_0x7850,0x1e1));var _0x0785=function(_0x4fccba,_0x594ed0){_0x4fccba=_0x4fccba-0x0;var _0x4ec9a0=_0x7850[_0x4fccba];return _0x4ec9a0;};'use strict';var EventEmitter=require(_0x0785('0x0'));var ChatOfflineMessage=require(_0x0785('0x1'))['db'][_0x0785('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0785('0x3'),'afterDestroy':_0x0785('0x4')};function emitEvent(_0x59a055){return function(_0x2e5c97,_0x24bbd3,_0x20385a){ChatOfflineMessageEvents[_0x0785('0x5')](_0x59a055+':'+_0x2e5c97['id'],_0x2e5c97);ChatOfflineMessageEvents[_0x0785('0x5')](_0x59a055,_0x2e5c97);_0x20385a(null);};}for(var e in events){if(events[_0x0785('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x0785('0x7')](e,emitEvent(event));}}module[_0x0785('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 28cb74b..10d3d13 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 _0x2011=['./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2011,0x1d1));var _0x1201=function(_0x15ddd4,_0xdb94b2){_0x15ddd4=_0x15ddd4-0x0;var _0x41b6eb=_0x2011[_0x15ddd4];return _0x41b6eb;};'use strict';var attributes=require(_0x1201('0x0'));module[_0x1201('0x1')]=function(_0x37bb3b){return _0x37bb3b[_0x1201('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x1201('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1201('0x4')});}; \ No newline at end of file +var _0x48c0=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x10e084,_0xf761e1){var _0x4ca640=function(_0x196aa3){while(--_0x196aa3){_0x10e084['push'](_0x10e084['shift']());}};_0x4ca640(++_0xf761e1);}(_0x48c0,0x1b9));var _0x048c=function(_0x509572,_0x5c4ee9){_0x509572=_0x509572-0x0;var _0x579f64=_0x48c0[_0x509572];return _0x579f64;};'use strict';var attributes=require(_0x048c('0x0'));module[_0x048c('0x1')]=function(_0x424c4e){return _0x424c4e['define'](_0x048c('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x048c('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f9f52d7..e558b4b 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 _0x5814=['then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x49aee5,_0x35466c){var _0xa69a8d=function(_0xf8e323){while(--_0xf8e323){_0x49aee5['push'](_0x49aee5['shift']());}};_0xa69a8d(++_0x35466c);}(_0x5814,0x6f));var _0x4581=function(_0x340d83,_0x418c44){_0x340d83=_0x340d83-0x0;var _0x2a424f=_0x5814[_0x340d83];return _0x2a424f;};'use strict';var _=require(_0x4581('0x0'));var util=require('util');var moment=require(_0x4581('0x1'));var BPromise=require('bluebird');var rs=require(_0x4581('0x2'));var fs=require('fs');var Redis=require(_0x4581('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4581('0x4'));var logger=require(_0x4581('0x5'))(_0x4581('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4581('0x7')][_0x4581('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53cbd8,_0x47ece4,_0x484124){return new BPromise(function(_0x4216bf,_0x553bb6){return client['request'](_0x53cbd8,_0x484124)[_0x4581('0x9')](function(_0x5547da){logger[_0x4581('0xa')](_0x4581('0xb'),_0x47ece4,'request\x20sent');logger[_0x4581('0xc')](_0x4581('0xd'),_0x47ece4,_0x4581('0xe'),JSON[_0x4581('0xf')](_0x5547da));if(_0x5547da['error']){if(_0x5547da['error'][_0x4581('0x10')]===0x1f4){logger[_0x4581('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x47ece4,_0x5547da[_0x4581('0x11')][_0x4581('0x12')]);return _0x553bb6(_0x5547da[_0x4581('0x11')][_0x4581('0x12')]);}logger[_0x4581('0x11')](_0x4581('0xb'),_0x47ece4,_0x5547da[_0x4581('0x11')][_0x4581('0x12')]);return _0x4216bf(_0x5547da[_0x4581('0x11')]['message']);}else{logger[_0x4581('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x47ece4,_0x4581('0xe'));_0x4216bf(_0x5547da[_0x4581('0x13')][_0x4581('0x12')]);}})['catch'](function(_0x5252f2){logger[_0x4581('0x11')](_0x4581('0xb'),_0x47ece4,_0x5252f2);_0x553bb6(_0x5252f2);});});} \ No newline at end of file +var _0xc3d6=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x38f5b6,_0x5f0777){var _0x43149f=function(_0x36c387){while(--_0x36c387){_0x38f5b6['push'](_0x38f5b6['shift']());}};_0x43149f(++_0x5f0777);}(_0xc3d6,0x153));var _0x6c3d=function(_0x585554,_0x1f84c7){_0x585554=_0x585554-0x0;var _0x34a185=_0xc3d6[_0x585554];return _0x34a185;};'use strict';var _=require(_0x6c3d('0x0'));var util=require(_0x6c3d('0x1'));var moment=require(_0x6c3d('0x2'));var BPromise=require(_0x6c3d('0x3'));var rs=require(_0x6c3d('0x4'));var fs=require('fs');var Redis=require(_0x6c3d('0x5'));var db=require(_0x6c3d('0x6'))['db'];var utils=require(_0x6c3d('0x7'));var logger=require(_0x6c3d('0x8'))(_0x6c3d('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c3d('0xa'));var client=jayson['client'][_0x6c3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5058e2,_0x74763,_0x35c1aa){return new BPromise(function(_0x3fbfc3,_0x7d4b89){return client[_0x6c3d('0xc')](_0x5058e2,_0x35c1aa)[_0x6c3d('0xd')](function(_0x2b251f){logger[_0x6c3d('0xe')](_0x6c3d('0xf'),_0x74763,'request\x20sent');logger[_0x6c3d('0x10')](_0x6c3d('0x11'),_0x74763,'request\x20sent',JSON[_0x6c3d('0x12')](_0x2b251f));if(_0x2b251f[_0x6c3d('0x13')]){if(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x14')]===0x1f4){logger[_0x6c3d('0x13')](_0x6c3d('0xf'),_0x74763,_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);return _0x7d4b89(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);}logger['error'](_0x6c3d('0xf'),_0x74763,_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);return _0x3fbfc3(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);}else{logger[_0x6c3d('0xe')](_0x6c3d('0xf'),_0x74763,_0x6c3d('0x16'));_0x3fbfc3(_0x2b251f[_0x6c3d('0x17')][_0x6c3d('0x15')]);}})[_0x6c3d('0x18')](function(_0x5731fa){logger[_0x6c3d('0x13')](_0x6c3d('0xf'),_0x74763,_0x5731fa);_0x7d4b89(_0x5731fa);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f9c0447..17777dc 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 _0xcabf=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0xcabf,0x1f2));var _0xfcab=function(_0x7ad4d5,_0x44ab61){_0x7ad4d5=_0x7ad4d5-0x0;var _0xfb6b46=_0xcabf[_0x7ad4d5];return _0xfb6b46;};'use strict';var multer=require(_0xfcab('0x0'));var util=require('util');var path=require(_0xfcab('0x1'));var timeout=require(_0xfcab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfcab('0x3'));var auth=require(_0xfcab('0x4'));var interaction=require(_0xfcab('0x5'));var config=require(_0xfcab('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0xfcab('0x7')]('/',auth[_0xfcab('0x8')](),controller['index']);router[_0xfcab('0x7')](_0xfcab('0x9'),auth[_0xfcab('0x8')](),controller[_0xfcab('0xa')]);router[_0xfcab('0x7')](_0xfcab('0xb'),auth[_0xfcab('0x8')](),controller[_0xfcab('0xc')]);router[_0xfcab('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfcab('0xe')](_0xfcab('0xb'),auth[_0xfcab('0x8')](),controller[_0xfcab('0xf')]);router['delete'](_0xfcab('0xb'),auth['isAuthenticated'](),controller[_0xfcab('0x10')]);module[_0xfcab('0x11')]=router; \ No newline at end of file +var _0xecfd=['delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x5a474d,_0x3c85e2){var _0x512f2a=function(_0x2f6669){while(--_0x2f6669){_0x5a474d['push'](_0x5a474d['shift']());}};_0x512f2a(++_0x3c85e2);}(_0xecfd,0x1d6));var _0xdecf=function(_0x275709,_0x51f458){_0x275709=_0x275709-0x0;var _0x20bafb=_0xecfd[_0x275709];return _0x20bafb;};'use strict';var multer=require(_0xdecf('0x0'));var util=require(_0xdecf('0x1'));var path=require(_0xdecf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdecf('0x3'));var auth=require(_0xdecf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdecf('0x5'));var controller=require(_0xdecf('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdecf('0x7')](_0xdecf('0x8'),auth[_0xdecf('0x9')](),controller['describe']);router['get'](_0xdecf('0xa'),auth[_0xdecf('0x9')](),controller[_0xdecf('0xb')]);router[_0xdecf('0xc')]('/',auth['isAuthenticated'](),controller[_0xdecf('0xd')]);router[_0xdecf('0xe')]('/:id',auth[_0xdecf('0x9')](),controller[_0xdecf('0xf')]);router[_0xdecf('0x10')](_0xdecf('0xa'),auth[_0xdecf('0x9')](),controller[_0xdecf('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a426fdc..f4038a5 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 _0x5494=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x47ac41,_0x1dba4b){var _0x5a4c8a=function(_0x201036){while(--_0x201036){_0x47ac41['push'](_0x47ac41['shift']());}};_0x5a4c8a(++_0x1dba4b);}(_0x5494,0x1cd));var _0x4549=function(_0x38a155,_0x2aa026){_0x38a155=_0x38a155-0x0;var _0x269403=_0x5494[_0x38a155];return _0x269403;};'use strict';var Sequelize=require(_0x4549('0x0'));module[_0x4549('0x1')]={'name':{'type':Sequelize[_0x4549('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4549('0x3'),_0x4549('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4549('0x5')]}}; \ No newline at end of file +var _0xd73c=['ENUM','mouseOver','INTEGER','STRING'];(function(_0x166e8d,_0x16181b){var _0x287e90=function(_0x5233a0){while(--_0x5233a0){_0x166e8d['push'](_0x166e8d['shift']());}};_0x287e90(++_0x16181b);}(_0xd73c,0x11b));var _0xcd73=function(_0x581e92,_0x34f32f){_0x581e92=_0x581e92-0x0;var _0xaf08d4=_0xd73c[_0x581e92];return _0xaf08d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcd73('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcd73('0x1')]('mouseOver','timeout'),'defaultValue':_0xcd73('0x2')},'selector':{'type':Sequelize[_0xcd73('0x0')]},'timeout':{'type':Sequelize[_0xcd73('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bde6852..5250a8b 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 _0x177a=['catch','create','body','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','save','then','stack','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','find'];(function(_0x13e999,_0xc4b319){var _0x78e618=function(_0x53e6d4){while(--_0x53e6d4){_0x13e999['push'](_0x13e999['shift']());}};_0x78e618(++_0xc4b319);}(_0x177a,0xdd));var _0xa177=function(_0x3b413b,_0x4a683f){_0x3b413b=_0x3b413b-0x0;var _0x78ef6d=_0x177a[_0x3b413b];return _0x78ef6d;};'use strict';var emlformat=require(_0xa177('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa177('0x1'));var rp=require(_0xa177('0x2'));var moment=require(_0xa177('0x3'));var BPromise=require(_0xa177('0x4'));var Mustache=require(_0xa177('0x5'));var util=require(_0xa177('0x6'));var path=require('path');var sox=require(_0xa177('0x7'));var csv=require(_0xa177('0x8'));var ejs=require(_0xa177('0x9'));var fs=require('fs');var fs_extra=require(_0xa177('0xa'));var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x8'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var licenseUtil=require(_0xa177('0x18'));var db=require(_0xa177('0x19'))['db'];function respondWithStatusCode(_0x411274,_0x34baf1){_0x34baf1=_0x34baf1||0xcc;return function(_0x26c738){if(_0x26c738){return _0x411274['sendStatus'](_0x34baf1);}return _0x411274['status'](_0x34baf1)[_0xa177('0x1a')]();};}function respondWithResult(_0x198a92,_0x39d274){_0x39d274=_0x39d274||0xc8;return function(_0x179f42){if(_0x179f42){return _0x198a92[_0xa177('0x1b')](_0x39d274)[_0xa177('0x1c')](_0x179f42);}};}function respondWithFilteredResult(_0x258985,_0xbc9fa4){return function(_0x278633){if(_0x278633){var _0x3c1443=typeof _0xbc9fa4[_0xa177('0x1d')]===_0xa177('0x1e')&&typeof _0xbc9fa4['limit']===_0xa177('0x1e');var _0x43fc77=_0x278633['count'];var _0x5e6ae3=_0x3c1443?0x0:_0xbc9fa4[_0xa177('0x1d')];var _0x11b060=_0x3c1443?_0x278633[_0xa177('0x1f')]:_0xbc9fa4['offset']+_0xbc9fa4['limit'];var _0x516acf;if(_0x11b060>=_0x43fc77){_0x11b060=_0x43fc77;_0x516acf=0xc8;}else{_0x516acf=0xce;}_0x258985[_0xa177('0x1b')](_0x516acf);return _0x258985[_0xa177('0x20')](_0xa177('0x21'),_0x5e6ae3+'-'+_0x11b060+'/'+_0x43fc77)[_0xa177('0x1c')](_0x278633);}return null;};}function patchUpdates(_0x50a957){return function(_0x324bda){try{jsonpatch['apply'](_0x324bda,_0x50a957,!![]);}catch(_0x3b2fa6){return BPromise['reject'](_0x3b2fa6);}return _0x324bda[_0xa177('0x22')]();};}function saveUpdates(_0x184178,_0x369942){return function(_0x279632){if(_0x279632){return _0x279632['update'](_0x184178)[_0xa177('0x23')](function(_0x27a0f1){return _0x27a0f1;});}return null;};}function removeEntity(_0x1ad5da,_0x4bc686){return function(_0x5d5118){if(_0x5d5118){return _0x5d5118['destroy']()['then'](function(){_0x1ad5da[_0xa177('0x1b')](0xcc)[_0xa177('0x1a')]();});}};}function handleEntityNotFound(_0x1cf775,_0x1b7cec){return function(_0xf5d168){if(!_0xf5d168){_0x1cf775['sendStatus'](0x194);}return _0xf5d168;};}function handleError(_0x31608c,_0x102095){_0x102095=_0x102095||0x1f4;return function(_0x479587){logger['error'](_0x479587[_0xa177('0x24')]);if(_0x479587['name']){delete _0x479587['name'];}_0x31608c['status'](_0x102095)[_0xa177('0x25')](_0x479587);};}exports['show']=function(_0x216cab,_0x3ae38f){var _0x320cce={'raw':!![],'where':{'id':_0x216cab[_0xa177('0x26')]['id']}},_0x5f20d4={};_0x5f20d4[_0xa177('0x27')]=_['keys'](db[_0xa177('0x28')][_0xa177('0x29')]);_0x5f20d4[_0xa177('0x2a')]=_[_0xa177('0x2b')](_0x216cab[_0xa177('0x2a')]);_0x5f20d4[_0xa177('0x2c')]=_[_0xa177('0x2d')](_0x5f20d4[_0xa177('0x27')],_0x5f20d4['query']);_0x320cce[_0xa177('0x2e')]=_[_0xa177('0x2d')](_0x5f20d4['model'],qs[_0xa177('0x2f')](_0x216cab[_0xa177('0x2a')]['fields']));_0x320cce[_0xa177('0x2e')]=_0x320cce[_0xa177('0x2e')]['length']?_0x320cce[_0xa177('0x2e')]:_0x5f20d4[_0xa177('0x27')];if(_0x216cab[_0xa177('0x2a')]['includeAll']){_0x320cce['include']=[{'all':!![]}];}_0x320cce=_['merge']({},_0x320cce,_0x216cab['options']);return db['ChatProactiveAction'][_0xa177('0x30')](_0x320cce)[_0xa177('0x23')](handleEntityNotFound(_0x3ae38f,null))[_0xa177('0x23')](respondWithResult(_0x3ae38f,null))[_0xa177('0x31')](handleError(_0x3ae38f,null));};exports[_0xa177('0x32')]=function(_0x79f018,_0x4c0890){return db[_0xa177('0x28')][_0xa177('0x32')](_0x79f018[_0xa177('0x33')],{})[_0xa177('0x23')](respondWithResult(_0x4c0890,0xc9))[_0xa177('0x31')](handleError(_0x4c0890,null));};exports[_0xa177('0x34')]=function(_0x3d2350,_0x3d141c){if(_0x3d2350['body']['id']){delete _0x3d2350[_0xa177('0x33')]['id'];}return db[_0xa177('0x28')]['find']({'where':{'id':_0x3d2350[_0xa177('0x26')]['id']}})['then'](handleEntityNotFound(_0x3d141c,null))[_0xa177('0x23')](saveUpdates(_0x3d2350[_0xa177('0x33')],null))['then'](respondWithResult(_0x3d141c,null))[_0xa177('0x31')](handleError(_0x3d141c,null));};exports[_0xa177('0x35')]=function(_0x2e4712,_0x80d2ae){return db[_0xa177('0x28')][_0xa177('0x30')]({'where':{'id':_0x2e4712[_0xa177('0x26')]['id']}})[_0xa177('0x23')](handleEntityNotFound(_0x80d2ae,null))[_0xa177('0x23')](removeEntity(_0x80d2ae,null))[_0xa177('0x31')](handleError(_0x80d2ae,null));}; \ No newline at end of file +var _0x04de=['query','keys','filters','intersection','attributes','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','params','model','rawAttributes'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x04de,0x107));var _0xe04d=function(_0xf9936a,_0x3f2f70){_0xf9936a=_0xf9936a-0x0;var _0x234dee=_0x04de[_0xf9936a];return _0x234dee;};'use strict';var emlformat=require(_0xe04d('0x0'));var rimraf=require(_0xe04d('0x1'));var zipdir=require(_0xe04d('0x2'));var jsonpatch=require(_0xe04d('0x3'));var rp=require(_0xe04d('0x4'));var moment=require(_0xe04d('0x5'));var BPromise=require(_0xe04d('0x6'));var Mustache=require(_0xe04d('0x7'));var util=require(_0xe04d('0x8'));var path=require(_0xe04d('0x9'));var sox=require(_0xe04d('0xa'));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(_0xe04d('0xb'));var crypto=require(_0xe04d('0xc'));var jsforce=require(_0xe04d('0xd'));var deskjs=require(_0xe04d('0xe'));var toCsv=require(_0xe04d('0xf'));var querystring=require(_0xe04d('0x10'));var Papa=require(_0xe04d('0x11'));var Redis=require(_0xe04d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe04d('0x13'));var as=require(_0xe04d('0x14'));var hardwareService=require(_0xe04d('0x15'));var logger=require(_0xe04d('0x16'))(_0xe04d('0x17'));var utils=require(_0xe04d('0x18'));var config=require(_0xe04d('0x19'));var licenseUtil=require(_0xe04d('0x1a'));var db=require(_0xe04d('0x1b'))['db'];function respondWithStatusCode(_0x53f59a,_0x8bf2d2){_0x8bf2d2=_0x8bf2d2||0xcc;return function(_0x1d3f03){if(_0x1d3f03){return _0x53f59a[_0xe04d('0x1c')](_0x8bf2d2);}return _0x53f59a[_0xe04d('0x1d')](_0x8bf2d2)[_0xe04d('0x1e')]();};}function respondWithResult(_0xa2521,_0xf205f5){_0xf205f5=_0xf205f5||0xc8;return function(_0x143019){if(_0x143019){return _0xa2521[_0xe04d('0x1d')](_0xf205f5)[_0xe04d('0x1f')](_0x143019);}};}function respondWithFilteredResult(_0xbc5cc7,_0x1aa69b){return function(_0x5cfd5b){if(_0x5cfd5b){var _0x1f29a7=typeof _0x1aa69b['offset']===_0xe04d('0x20')&&typeof _0x1aa69b['limit']===_0xe04d('0x20');var _0xbd5fa1=_0x5cfd5b[_0xe04d('0x21')];var _0x93b107=_0x1f29a7?0x0:_0x1aa69b[_0xe04d('0x22')];var _0x35a2b4=_0x1f29a7?_0x5cfd5b[_0xe04d('0x21')]:_0x1aa69b[_0xe04d('0x22')]+_0x1aa69b[_0xe04d('0x23')];var _0x5d8a1e;if(_0x35a2b4>=_0xbd5fa1){_0x35a2b4=_0xbd5fa1;_0x5d8a1e=0xc8;}else{_0x5d8a1e=0xce;}_0xbc5cc7[_0xe04d('0x1d')](_0x5d8a1e);return _0xbc5cc7[_0xe04d('0x24')](_0xe04d('0x25'),_0x93b107+'-'+_0x35a2b4+'/'+_0xbd5fa1)[_0xe04d('0x1f')](_0x5cfd5b);}return null;};}function patchUpdates(_0x2ac847){return function(_0x34e15f){try{jsonpatch['apply'](_0x34e15f,_0x2ac847,!![]);}catch(_0x3b1f42){return BPromise[_0xe04d('0x26')](_0x3b1f42);}return _0x34e15f['save']();};}function saveUpdates(_0x4b4d8b,_0x5bcfc3){return function(_0x46fab1){if(_0x46fab1){return _0x46fab1['update'](_0x4b4d8b)['then'](function(_0x185d42){return _0x185d42;});}return null;};}function removeEntity(_0x26a869,_0x495f73){return function(_0x942d8a){if(_0x942d8a){return _0x942d8a['destroy']()[_0xe04d('0x27')](function(){_0x26a869['status'](0xcc)[_0xe04d('0x1e')]();});}};}function handleEntityNotFound(_0x456822,_0x48db4e){return function(_0x29ad33){if(!_0x29ad33){_0x456822[_0xe04d('0x1c')](0x194);}return _0x29ad33;};}function handleError(_0x51540e,_0x10aa20){_0x10aa20=_0x10aa20||0x1f4;return function(_0x3e43ca){logger[_0xe04d('0x28')](_0x3e43ca[_0xe04d('0x29')]);if(_0x3e43ca['name']){delete _0x3e43ca[_0xe04d('0x2a')];}_0x51540e[_0xe04d('0x1d')](_0x10aa20)[_0xe04d('0x2b')](_0x3e43ca);};}exports['show']=function(_0x187c29,_0x5a3899){var _0x4f5883={'raw':!![],'where':{'id':_0x187c29[_0xe04d('0x2c')]['id']}},_0x569e4b={};_0x569e4b[_0xe04d('0x2d')]=_['keys'](db['ChatProactiveAction'][_0xe04d('0x2e')]);_0x569e4b[_0xe04d('0x2f')]=_[_0xe04d('0x30')](_0x187c29['query']);_0x569e4b[_0xe04d('0x31')]=_[_0xe04d('0x32')](_0x569e4b['model'],_0x569e4b[_0xe04d('0x2f')]);_0x4f5883['attributes']=_[_0xe04d('0x32')](_0x569e4b[_0xe04d('0x2d')],qs['fields'](_0x187c29[_0xe04d('0x2f')]['fields']));_0x4f5883[_0xe04d('0x33')]=_0x4f5883[_0xe04d('0x33')][_0xe04d('0x34')]?_0x4f5883[_0xe04d('0x33')]:_0x569e4b[_0xe04d('0x2d')];if(_0x187c29[_0xe04d('0x2f')][_0xe04d('0x35')]){_0x4f5883['include']=[{'all':!![]}];}_0x4f5883=_[_0xe04d('0x36')]({},_0x4f5883,_0x187c29[_0xe04d('0x37')]);return db[_0xe04d('0x38')][_0xe04d('0x39')](_0x4f5883)[_0xe04d('0x27')](handleEntityNotFound(_0x5a3899,null))[_0xe04d('0x27')](respondWithResult(_0x5a3899,null))[_0xe04d('0x3a')](handleError(_0x5a3899,null));};exports[_0xe04d('0x3b')]=function(_0x26c6c5,_0x59ed1c){return db[_0xe04d('0x38')]['create'](_0x26c6c5[_0xe04d('0x3c')],{})['then'](respondWithResult(_0x59ed1c,0xc9))['catch'](handleError(_0x59ed1c,null));};exports[_0xe04d('0x3d')]=function(_0x9353a1,_0x261116){if(_0x9353a1[_0xe04d('0x3c')]['id']){delete _0x9353a1['body']['id'];}return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x9353a1[_0xe04d('0x2c')]['id']}})[_0xe04d('0x27')](handleEntityNotFound(_0x261116,null))[_0xe04d('0x27')](saveUpdates(_0x9353a1['body'],null))['then'](respondWithResult(_0x261116,null))[_0xe04d('0x3a')](handleError(_0x261116,null));};exports['destroy']=function(_0x53c072,_0x23e4b2){return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x53c072[_0xe04d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x23e4b2,null))['then'](removeEntity(_0x23e4b2,null))[_0xe04d('0x3a')](handleError(_0x23e4b2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 39b728b..6382068 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 _0xabda=['ChatProactiveAction','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xabda,0xf1));var _0xaabd=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0xabda[_0x540160];return _0x476120;};'use strict';var _=require(_0xaabd('0x0'));var util=require(_0xaabd('0x1'));var logger=require(_0xaabd('0x2'))('api');var moment=require(_0xaabd('0x3'));var BPromise=require(_0xaabd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaabd('0x5'));var rimraf=require(_0xaabd('0x6'));var config=require('../../config/environment');var attributes=require(_0xaabd('0x7'));module[_0xaabd('0x8')]=function(_0x3b6697,_0x57cad3){return _0x3b6697['define'](_0xaabd('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea97=['util','api','moment','bluebird','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xea97,0xd1));var _0x7ea9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xea97[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x7ea9('0x0'));var util=require(_0x7ea9('0x1'));var logger=require('../../config/logger')(_0x7ea9('0x2'));var moment=require(_0x7ea9('0x3'));var BPromise=require(_0x7ea9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ea9('0x5'));var rimraf=require(_0x7ea9('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x7ea9('0x7')]=function(_0x291b42,_0x585fc7){return _0x291b42['define'](_0x7ea9('0x8'),attributes,{'tableName':_0x7ea9('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 3e96899..da3f599 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 _0x6075=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x552352,_0x51e3b0){var _0x1e0d71=function(_0xa0c4f5){while(--_0xa0c4f5){_0x552352['push'](_0x552352['shift']());}};_0x1e0d71(++_0x51e3b0);}(_0x6075,0x142));var _0x5607=function(_0x172ced,_0x16e422){_0x172ced=_0x172ced-0x0;var _0x220b96=_0x6075[_0x172ced];return _0x220b96;};'use strict';var _=require(_0x5607('0x0'));var util=require(_0x5607('0x1'));var moment=require('moment');var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5607('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5607('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5607('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a8d9,_0x49f0f2,_0x415836){return new BPromise(function(_0x5f92ad,_0xbdf802){return client[_0x5607('0x7')](_0x34a8d9,_0x415836)[_0x5607('0x8')](function(_0x2aec99){logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));logger[_0x5607('0xc')](_0x5607('0xd'),_0x49f0f2,_0x5607('0xb'),JSON[_0x5607('0xe')](_0x2aec99));if(_0x2aec99['error']){if(_0x2aec99[_0x5607('0xf')][_0x5607('0x10')]===0x1f4){logger[_0x5607('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);return _0xbdf802(_0x2aec99['error'][_0x5607('0x11')]);}logger[_0x5607('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')]['message']);return _0x5f92ad(_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);}else{logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));_0x5f92ad(_0x2aec99[_0x5607('0x12')][_0x5607('0x11')]);}})[_0x5607('0x13')](function(_0x156060){logger[_0x5607('0xf')](_0x5607('0xa'),_0x49f0f2,_0x156060);_0xbdf802(_0x156060);});});} \ No newline at end of file +var _0x805b=['message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2100f2,_0x254f79){var _0x3e265c=function(_0x6e64c0){while(--_0x6e64c0){_0x2100f2['push'](_0x2100f2['shift']());}};_0x3e265c(++_0x254f79);}(_0x805b,0x162));var _0xb805=function(_0x4df7f8,_0x28cdcf){_0x4df7f8=_0x4df7f8-0x0;var _0x24404b=_0x805b[_0x4df7f8];return _0x24404b;};'use strict';var _=require('lodash');var util=require(_0xb805('0x0'));var moment=require(_0xb805('0x1'));var BPromise=require(_0xb805('0x2'));var rs=require(_0xb805('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb805('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb805('0x5'))(_0xb805('0x6'));var config=require(_0xb805('0x7'));var jayson=require(_0xb805('0x8'));var client=jayson[_0xb805('0x9')][_0xb805('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e3c07,_0x1f4207,_0x53509a){return new BPromise(function(_0x9adfe5,_0x383575){return client[_0xb805('0xb')](_0x1e3c07,_0x53509a)[_0xb805('0xc')](function(_0x44becf){logger[_0xb805('0xd')](_0xb805('0xe'),_0x1f4207,_0xb805('0xf'));logger[_0xb805('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1f4207,_0xb805('0xf'),JSON[_0xb805('0x11')](_0x44becf));if(_0x44becf[_0xb805('0x12')]){if(_0x44becf[_0xb805('0x12')][_0xb805('0x13')]===0x1f4){logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x44becf['error'][_0xb805('0x14')]);return _0x383575(_0x44becf[_0xb805('0x12')]['message']);}logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x44becf[_0xb805('0x12')]['message']);return _0x9adfe5(_0x44becf[_0xb805('0x12')][_0xb805('0x14')]);}else{logger[_0xb805('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x1f4207,_0xb805('0xf'));_0x9adfe5(_0x44becf[_0xb805('0x15')][_0xb805('0x14')]);}})['catch'](function(_0x3f68f0){logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x3f68f0);_0x383575(_0x3f68f0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0a1d7d1..9a414d3 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x40f58b,_0x372061){_0x40f58b=_0x40f58b-0x0;var _0x2bcc2a=_0x8d0e[_0x40f58b];return _0x2bcc2a;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x146ca3,_0x29a10e){var _0x30dd24=function(_0x4b4f36){while(--_0x4b4f36){_0x146ca3['push'](_0x146ca3['shift']());}};_0x30dd24(++_0x29a10e);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3943633..2bf1881 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 _0x46aa=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46aa,0x6e));var _0xa46a=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x46aa[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require('sequelize');module[_0xa46a('0x0')]={'name':{'type':Sequelize[_0xa46a('0x1')],'unique':_0xa46a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa46a('0x1')]},'timeout':{'type':Sequelize[_0xa46a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa46a('0x4')](_0xa46a('0x5'),_0xa46a('0x6'),_0xa46a('0x7'))}}; \ No newline at end of file +var _0xee95=['STRING','rrmemory','beepall','sequelize','exports'];(function(_0x165a3c,_0x31411e){var _0x2a22eb=function(_0x43f0b2){while(--_0x43f0b2){_0x165a3c['push'](_0x165a3c['shift']());}};_0x2a22eb(++_0x31411e);}(_0xee95,0x1b1));var _0x5ee9=function(_0x141db1,_0x550580){_0x141db1=_0x141db1-0x0;var _0x1c70f7=_0xee95[_0x141db1];return _0x1c70f7;};'use strict';var Sequelize=require(_0x5ee9('0x0'));module[_0x5ee9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5ee9('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5ee9('0x3'),_0x5ee9('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 20a2935..7c82df9 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 _0xaf02=['online','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','ids','isEmpty','forEach','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','ChatQueues','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf02,0x1f4));var _0x2af0=function(_0x3005f4,_0x1de400){_0x3005f4=_0x3005f4-0x0;var _0x1fd800=_0xaf02[_0x3005f4];return _0x1fd800;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2af0('0x0'));var zipdir=require(_0x2af0('0x1'));var jsonpatch=require(_0x2af0('0x2'));var rp=require(_0x2af0('0x3'));var moment=require(_0x2af0('0x4'));var BPromise=require(_0x2af0('0x5'));var Mustache=require(_0x2af0('0x6'));var util=require(_0x2af0('0x7'));var path=require(_0x2af0('0x8'));var sox=require(_0x2af0('0x9'));var csv=require(_0x2af0('0xa'));var ejs=require(_0x2af0('0xb'));var fs=require('fs');var fs_extra=require(_0x2af0('0xc'));var _=require(_0x2af0('0xd'));var squel=require(_0x2af0('0xe'));var crypto=require(_0x2af0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2af0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2af0('0x11'));var Papa=require(_0x2af0('0x12'));var Redis=require(_0x2af0('0x13'));var authService=require(_0x2af0('0x14'));var qs=require(_0x2af0('0x15'));var as=require(_0x2af0('0x16'));var hardwareService=require(_0x2af0('0x17'));var logger=require(_0x2af0('0x18'))(_0x2af0('0x19'));var utils=require(_0x2af0('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2af0('0x1b'))['db'];config[_0x2af0('0x1c')]=_[_0x2af0('0x1d')](config['redis'],{'host':_0x2af0('0x1e'),'port':0x18eb});var socket=require(_0x2af0('0x1f'))(new Redis(config[_0x2af0('0x1c')]));require(_0x2af0('0x20'))[_0x2af0('0x21')](socket);var jayson=require(_0x2af0('0x22'));var client=jayson[_0x2af0('0x23')][_0x2af0('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x1b7b54,_0x23d50b,_0x201ae4,_0x45429e){return new BPromise(function(_0x56947f,_0x53cebe){var _0xff2a9e=_0x45429e||client;return _0xff2a9e['request'](_0x1b7b54,_0x201ae4)[_0x2af0('0x25')](function(_0x14127a){logger[_0x2af0('0x26')](_0x2af0('0x27'),_0x23d50b,'request\x20sent');logger[_0x2af0('0x28')](_0x2af0('0x29'),_0x23d50b,'request\x20sent',JSON[_0x2af0('0x2a')](_0x14127a));if(_0x14127a[_0x2af0('0x2b')]){if(_0x14127a[_0x2af0('0x2b')]['code']===0x1f4){logger[_0x2af0('0x2b')](_0x2af0('0x27'),_0x23d50b,_0x14127a[_0x2af0('0x2b')][_0x2af0('0x2c')]);return _0x53cebe(_0x14127a[_0x2af0('0x2b')]['message']);}logger[_0x2af0('0x2b')](_0x2af0('0x27'),_0x23d50b,_0x14127a[_0x2af0('0x2b')][_0x2af0('0x2c')]);return _0x56947f(_0x14127a[_0x2af0('0x2b')][_0x2af0('0x2c')]);}else{logger[_0x2af0('0x26')](_0x2af0('0x27'),_0x23d50b,_0x2af0('0x2d'));_0x56947f(_0x14127a['result'][_0x2af0('0x2c')]);}})[_0x2af0('0x2e')](function(_0x226351){logger['error']('ChatQueue,\x20%s,\x20%s',_0x23d50b,_0x226351);_0x53cebe(_0x226351);});});}function respondWithStatusCode(_0x43fcd5,_0x3e42bd){_0x3e42bd=_0x3e42bd||0xcc;return function(_0x18537c){if(_0x18537c){return _0x43fcd5[_0x2af0('0x2f')](_0x3e42bd);}return _0x43fcd5[_0x2af0('0x30')](_0x3e42bd)[_0x2af0('0x31')]();};}function respondWithResult(_0x4c5227,_0x58cbb7){_0x58cbb7=_0x58cbb7||0xc8;return function(_0x1a6e89){if(_0x1a6e89){return _0x4c5227[_0x2af0('0x30')](_0x58cbb7)[_0x2af0('0x32')](_0x1a6e89);}};}function respondWithFilteredResult(_0x25d697,_0x53d364){return function(_0x51a017){if(_0x51a017){var _0x4c3ad3=typeof _0x53d364[_0x2af0('0x33')]===_0x2af0('0x34')&&typeof _0x53d364['limit']===_0x2af0('0x34');var _0x14b0c2=_0x51a017[_0x2af0('0x35')];var _0x28f289=_0x4c3ad3?0x0:_0x53d364[_0x2af0('0x33')];var _0xaa8452=_0x4c3ad3?_0x51a017[_0x2af0('0x35')]:_0x53d364[_0x2af0('0x33')]+_0x53d364[_0x2af0('0x36')];var _0x3f6697;if(_0xaa8452>=_0x14b0c2){_0xaa8452=_0x14b0c2;_0x3f6697=0xc8;}else{_0x3f6697=0xce;}_0x25d697[_0x2af0('0x30')](_0x3f6697);return _0x25d697[_0x2af0('0x37')](_0x2af0('0x38'),_0x28f289+'-'+_0xaa8452+'/'+_0x14b0c2)[_0x2af0('0x32')](_0x51a017);}return null;};}function patchUpdates(_0x3836b7){return function(_0x41ca4a){try{jsonpatch[_0x2af0('0x39')](_0x41ca4a,_0x3836b7,!![]);}catch(_0x233c20){return BPromise['reject'](_0x233c20);}return _0x41ca4a[_0x2af0('0x3a')]();};}function saveUpdates(_0x12732a,_0x46f073){return function(_0x4b0b93){if(_0x4b0b93){return _0x4b0b93[_0x2af0('0x3b')](_0x12732a)[_0x2af0('0x25')](function(_0x55626a){return _0x55626a;});}return null;};}function removeEntity(_0x91529e,_0x501640){return function(_0x5624be){if(_0x5624be){return _0x5624be[_0x2af0('0x3c')]()['then'](function(){var _0x397cd7=_0x5624be['get']({'plain':!![]});var _0x205dc5=_0x2af0('0x3d');return db['UserProfileResource'][_0x2af0('0x3c')]({'where':{'type':_0x205dc5,'resourceId':_0x397cd7['id']}})[_0x2af0('0x25')](function(){return _0x5624be;});})['then'](function(){_0x91529e['status'](0xcc)[_0x2af0('0x31')]();});}};}function handleEntityNotFound(_0x53edbc,_0x93af2c){return function(_0x5dfc33){if(!_0x5dfc33){_0x53edbc[_0x2af0('0x2f')](0x194);}return _0x5dfc33;};}function handleError(_0x3d4fb8,_0x4dba63){_0x4dba63=_0x4dba63||0x1f4;return function(_0x266b35){logger[_0x2af0('0x2b')](_0x266b35['stack']);if(_0x266b35['name']){delete _0x266b35[_0x2af0('0x3e')];}_0x3d4fb8[_0x2af0('0x30')](_0x4dba63)[_0x2af0('0x3f')](_0x266b35);};}exports[_0x2af0('0x40')]=function(_0x2eb541,_0x312873){var _0x247a8a={},_0xd93c00={},_0x333efb={'count':0x0,'rows':[]};var _0x466d70=_[_0x2af0('0x41')](db[_0x2af0('0x42')][_0x2af0('0x43')],function(_0x4dc17e){return{'name':_0x4dc17e[_0x2af0('0x44')],'type':_0x4dc17e[_0x2af0('0x45')][_0x2af0('0x46')]};});_0xd93c00['model']=_[_0x2af0('0x41')](_0x466d70,_0x2af0('0x3e'));_0xd93c00[_0x2af0('0x47')]=_[_0x2af0('0x48')](_0x2eb541['query']);_0xd93c00[_0x2af0('0x49')]=_[_0x2af0('0x4a')](_0xd93c00['model'],_0xd93c00['query']);_0x247a8a[_0x2af0('0x4b')]=_[_0x2af0('0x4a')](_0xd93c00[_0x2af0('0x4c')],qs[_0x2af0('0x4d')](_0x2eb541[_0x2af0('0x47')][_0x2af0('0x4d')]));_0x247a8a[_0x2af0('0x4b')]=_0x247a8a[_0x2af0('0x4b')][_0x2af0('0x4e')]?_0x247a8a[_0x2af0('0x4b')]:_0xd93c00[_0x2af0('0x4c')];if(!_0x2eb541[_0x2af0('0x47')][_0x2af0('0x4f')](_0x2af0('0x50'))){_0x247a8a[_0x2af0('0x36')]=qs[_0x2af0('0x36')](_0x2eb541[_0x2af0('0x47')]['limit']);_0x247a8a[_0x2af0('0x33')]=qs[_0x2af0('0x33')](_0x2eb541['query'][_0x2af0('0x33')]);}_0x247a8a['order']=qs['sort'](_0x2eb541[_0x2af0('0x47')][_0x2af0('0x51')]);_0x247a8a[_0x2af0('0x52')]=qs[_0x2af0('0x49')](_[_0x2af0('0x53')](_0x2eb541[_0x2af0('0x47')],_0xd93c00[_0x2af0('0x49')]),_0x466d70);if(_0x2eb541[_0x2af0('0x47')][_0x2af0('0x54')]){_0x247a8a[_0x2af0('0x52')]=_[_0x2af0('0x55')](_0x247a8a[_0x2af0('0x52')],{'$or':_[_0x2af0('0x41')](_0x466d70,function(_0x52ef7a){if(_0x52ef7a['type']!==_0x2af0('0x56')){var _0x4e83c3={};_0x4e83c3[_0x52ef7a[_0x2af0('0x3e')]]={'$like':'%'+_0x2eb541['query']['filter']+'%'};return _0x4e83c3;}})});}_0x247a8a=_[_0x2af0('0x55')]({},_0x247a8a,_0x2eb541['options']);var _0x27353a={'where':_0x247a8a[_0x2af0('0x52')]};return db['ChatQueue'][_0x2af0('0x35')](_0x27353a)[_0x2af0('0x25')](function(_0x170005){_0x333efb[_0x2af0('0x35')]=_0x170005;if(_0x2eb541[_0x2af0('0x47')][_0x2af0('0x57')]){_0x247a8a[_0x2af0('0x58')]=[{'all':!![]}];}return db[_0x2af0('0x42')][_0x2af0('0x59')](_0x247a8a);})[_0x2af0('0x25')](function(_0x5093f4){_0x333efb[_0x2af0('0x5a')]=_0x5093f4;return _0x333efb;})[_0x2af0('0x25')](respondWithFilteredResult(_0x312873,_0x247a8a))[_0x2af0('0x2e')](handleError(_0x312873,null));};exports['show']=function(_0x3b6242,_0x26040a){var _0x2dbf80={'raw':!![],'where':{'id':_0x3b6242[_0x2af0('0x5b')]['id']}},_0x21b1a5={};_0x21b1a5[_0x2af0('0x4c')]=_[_0x2af0('0x48')](db[_0x2af0('0x42')]['rawAttributes']);_0x21b1a5[_0x2af0('0x47')]=_[_0x2af0('0x48')](_0x3b6242['query']);_0x21b1a5[_0x2af0('0x49')]=_[_0x2af0('0x4a')](_0x21b1a5[_0x2af0('0x4c')],_0x21b1a5[_0x2af0('0x47')]);_0x2dbf80['attributes']=_[_0x2af0('0x4a')](_0x21b1a5['model'],qs['fields'](_0x3b6242['query'][_0x2af0('0x4d')]));_0x2dbf80['attributes']=_0x2dbf80['attributes'][_0x2af0('0x4e')]?_0x2dbf80[_0x2af0('0x4b')]:_0x21b1a5[_0x2af0('0x4c')];if(_0x3b6242['query'][_0x2af0('0x57')]){_0x2dbf80[_0x2af0('0x58')]=[{'all':!![]}];}_0x2dbf80=_[_0x2af0('0x55')]({},_0x2dbf80,_0x3b6242[_0x2af0('0x5c')]);return db['ChatQueue'][_0x2af0('0x5d')](_0x2dbf80)[_0x2af0('0x25')](handleEntityNotFound(_0x26040a,null))[_0x2af0('0x25')](respondWithResult(_0x26040a,null))[_0x2af0('0x2e')](handleError(_0x26040a,null));};exports[_0x2af0('0x5e')]=function(_0x5a9f27,_0x105fbd){return db[_0x2af0('0x42')][_0x2af0('0x5e')](_0x5a9f27[_0x2af0('0x5f')],{})[_0x2af0('0x25')](function(_0x3b19ee){var _0x2f7af9=_0x5a9f27[_0x2af0('0x60')][_0x2af0('0x61')]({'plain':!![]});if(!_0x2f7af9)throw new Error(_0x2af0('0x62'));if(_0x2f7af9[_0x2af0('0x63')]==='user'){var _0x37e2a9=_0x3b19ee['get']({'plain':!![]});var _0x3f55cc='ChatQueues';return db['UserProfileSection'][_0x2af0('0x5d')]({'where':{'name':_0x3f55cc,'userProfileId':_0x2f7af9[_0x2af0('0x64')]},'raw':!![]})[_0x2af0('0x25')](function(_0x1630ba){if(_0x1630ba&&_0x1630ba[_0x2af0('0x65')]===0x0){return db[_0x2af0('0x66')]['create']({'name':_0x37e2a9[_0x2af0('0x3e')],'resourceId':_0x37e2a9['id'],'type':_0x1630ba[_0x2af0('0x3e')],'sectionId':_0x1630ba['id']},{})[_0x2af0('0x25')](function(){return _0x3b19ee;});}else{return _0x3b19ee;}})[_0x2af0('0x2e')](function(_0x43a7ca){logger[_0x2af0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43a7ca);throw _0x43a7ca;});}return _0x3b19ee;})[_0x2af0('0x25')](respondWithResult(_0x105fbd,0xc9))['catch'](handleError(_0x105fbd,null));};exports[_0x2af0('0x3b')]=function(_0xc5f177,_0x204c5f){if(_0xc5f177[_0x2af0('0x5f')]['id']){delete _0xc5f177[_0x2af0('0x5f')]['id'];}return db[_0x2af0('0x42')][_0x2af0('0x5d')]({'where':{'id':_0xc5f177['params']['id']}})['then'](handleEntityNotFound(_0x204c5f,null))[_0x2af0('0x25')](saveUpdates(_0xc5f177['body'],null))['then'](respondWithResult(_0x204c5f,null))[_0x2af0('0x2e')](handleError(_0x204c5f,null));};exports['destroy']=function(_0x223e15,_0x3691ac){return db[_0x2af0('0x42')][_0x2af0('0x5d')]({'where':{'id':_0x223e15[_0x2af0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3691ac,null))[_0x2af0('0x25')](removeEntity(_0x3691ac,null))[_0x2af0('0x2e')](handleError(_0x3691ac,null));};exports[_0x2af0('0x67')]=function(_0x238d4f,_0x526b4e){return db[_0x2af0('0x42')]['describe']()[_0x2af0('0x25')](respondWithResult(_0x526b4e,null))['catch'](handleError(_0x526b4e,null));};exports[_0x2af0('0x68')]=function(_0x3e19ed,_0x1e6bbd,_0x58cc81){var _0xa82ddb={'raw':!![],'where':{}},_0x17057e={},_0x527476;return db[_0x2af0('0x42')][_0x2af0('0x69')]({'where':{'id':_0x3e19ed[_0x2af0('0x5b')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x1e6bbd,null))[_0x2af0('0x25')](function(_0x5367b5){if(_0x5367b5){_0x527476=_0x5367b5[_0x2af0('0x61')]({'plain':!![]});_0x17057e[_0x2af0('0x4c')]=_[_0x2af0('0x48')](db[_0x2af0('0x6a')][_0x2af0('0x43')]);_0x17057e[_0x2af0('0x47')]=_[_0x2af0('0x48')](_0x3e19ed[_0x2af0('0x47')]);_0x17057e[_0x2af0('0x49')]=_[_0x2af0('0x4a')](_0x17057e[_0x2af0('0x4c')],_0x17057e[_0x2af0('0x47')]);_0xa82ddb[_0x2af0('0x4b')]=_[_0x2af0('0x4a')](_0x17057e[_0x2af0('0x4c')],qs[_0x2af0('0x4d')](_0x3e19ed['query'][_0x2af0('0x4d')]));_0xa82ddb['attributes']=_0xa82ddb['attributes'][_0x2af0('0x4e')]?_0xa82ddb[_0x2af0('0x4b')]:_0x17057e[_0x2af0('0x4c')];if(!_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x4f')](_0x2af0('0x50'))){_0xa82ddb[_0x2af0('0x36')]=qs['limit'](_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x36')]);_0xa82ddb[_0x2af0('0x33')]=qs[_0x2af0('0x33')](_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x33')]);}_0xa82ddb['order']=qs[_0x2af0('0x51')](_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x51')]);_0xa82ddb['where']=qs['filters'](_[_0x2af0('0x53')](_0x3e19ed['query'],_0x17057e[_0x2af0('0x49')]));_0xa82ddb['where'][_0x2af0('0x6b')]=_0x5367b5['id'];if(_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x54')]){_0xa82ddb[_0x2af0('0x52')]=_['merge'](_0xa82ddb['where'],{'$or':_[_0x2af0('0x41')](_0xa82ddb[_0x2af0('0x4b')],function(_0x8dccf9){var _0xb6f55b={};_0xb6f55b[_0x8dccf9]={'$like':'%'+_0x3e19ed[_0x2af0('0x47')][_0x2af0('0x54')]+'%'};return _0xb6f55b;})});}_0xa82ddb=_['merge']({},_0xa82ddb,_0x3e19ed[_0x2af0('0x5c')]);return db[_0x2af0('0x6a')][_0x2af0('0x59')](_0xa82ddb);}})['then'](function(_0x1cac5b){if(_0x1cac5b){return db[_0x2af0('0x6c')][_0x2af0('0x6d')]({'where':{'id':_['map'](_0x1cac5b,_0x2af0('0x6e')),'role':'agent'},'attributes':['id',_0x2af0('0x3e'),_0x2af0('0x6f'),_0x2af0('0x70'),_0x2af0('0x71')]});}})[_0x2af0('0x25')](function(_0x466ea5){if(_0x466ea5){return{'count':_0x466ea5['count'],'rows':_[_0x2af0('0x41')](_0x466ea5[_0x2af0('0x5a')],function(_0x31c1c2){return{'membername':_0x31c1c2[_0x2af0('0x3e')],'UserId':_0x31c1c2['id'],'queue_name':_0x527476[_0x2af0('0x3e')],'ChatQueueId':_0x527476['id'],'interface':util[_0x2af0('0x72')](_0x2af0('0x73'),'SIP',_0x31c1c2[_0x2af0('0x3e')]),'penalty':0x0,'paused':_0x31c1c2[_0x2af0('0x6f')],'createdAt':_0x31c1c2[_0x2af0('0x71')],'updatedAt':_0x31c1c2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2af0('0x25')](respondWithFilteredResult(_0x1e6bbd,_0xa82ddb))[_0x2af0('0x2e')](handleError(_0x1e6bbd,null));};exports[_0x2af0('0x74')]=function(_0x2973d7,_0x1f1da4,_0x24c1d2){var _0x354751={};var _0x417e5c={};var _0x5b1f25;var _0xbe2e87;return db[_0x2af0('0x42')][_0x2af0('0x69')]({'where':{'id':_0x2973d7[_0x2af0('0x5b')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x1f1da4,null))[_0x2af0('0x25')](function(_0x1b5ad7){if(_0x1b5ad7){_0x5b1f25=_0x1b5ad7;_0x417e5c['model']=_['keys'](db[_0x2af0('0x75')][_0x2af0('0x43')]);_0x417e5c[_0x2af0('0x47')]=_[_0x2af0('0x48')](_0x2973d7['query']);_0x417e5c[_0x2af0('0x49')]=_[_0x2af0('0x4a')](_0x417e5c[_0x2af0('0x4c')],_0x417e5c[_0x2af0('0x47')]);_0x354751[_0x2af0('0x4b')]=_[_0x2af0('0x4a')](_0x417e5c[_0x2af0('0x4c')],qs[_0x2af0('0x4d')](_0x2973d7[_0x2af0('0x47')][_0x2af0('0x4d')]));_0x354751['attributes']=_0x354751[_0x2af0('0x4b')]['length']?_0x354751[_0x2af0('0x4b')]:_0x417e5c[_0x2af0('0x4c')];_0x354751['order']=qs[_0x2af0('0x51')](_0x2973d7[_0x2af0('0x47')][_0x2af0('0x51')]);_0x354751[_0x2af0('0x52')]=qs[_0x2af0('0x49')](_[_0x2af0('0x53')](_0x2973d7[_0x2af0('0x47')],_0x417e5c['filters']));if(_0x2973d7[_0x2af0('0x47')][_0x2af0('0x54')]){_0x354751['where']=_[_0x2af0('0x55')](_0x354751['where'],{'$or':_[_0x2af0('0x41')](_0x354751[_0x2af0('0x4b')],function(_0x1b652c){var _0x49e838={};_0x49e838[_0x1b652c]={'$like':'%'+_0x2973d7[_0x2af0('0x47')][_0x2af0('0x54')]+'%'};return _0x49e838;})});}_0x354751=_[_0x2af0('0x55')]({},_0x354751,_0x2973d7[_0x2af0('0x5c')]);return _0x5b1f25[_0x2af0('0x74')](_0x354751);}})[_0x2af0('0x25')](function(_0x443151){if(_0x443151){_0xbe2e87=_0x443151[_0x2af0('0x4e')];if(!_0x2973d7[_0x2af0('0x47')][_0x2af0('0x4f')](_0x2af0('0x50'))){_0x354751[_0x2af0('0x36')]=qs['limit'](_0x2973d7[_0x2af0('0x47')][_0x2af0('0x36')]);_0x354751[_0x2af0('0x33')]=qs[_0x2af0('0x33')](_0x2973d7['query'][_0x2af0('0x33')]);}return _0x5b1f25[_0x2af0('0x74')](_0x354751);}})[_0x2af0('0x25')](function(_0x6510b7){if(_0x6510b7){return _0x6510b7?{'count':_0xbe2e87,'rows':_0x6510b7}:null;}})[_0x2af0('0x25')](respondWithResult(_0x1f1da4,null))[_0x2af0('0x2e')](handleError(_0x1f1da4,null));};exports[_0x2af0('0x76')]=function(_0x21c21c,_0x2f34b0,_0x35a5e3){var _0x199748=_0x21c21c[_0x2af0('0x5f')]['ids'];return db[_0x2af0('0x75')][_0x2af0('0x59')]({'where':{'id':_0x199748},'attributes':['id'],'include':[{'model':db[_0x2af0('0x6c')],'as':_0x2af0('0x77'),'attributes':['id','name',_0x2af0('0x78'),'voicePause',_0x2af0('0x79')],'raw':!![]}]})['then'](function(_0x1a4cae){if(_0x1a4cae){var _0x2705a5=_[_0x2af0('0x7a')](_0x1a4cae,function(_0x6ab288){var _0x48e3da=_0x6ab288[_0x2af0('0x61')]({'plain':!![]});return _0x48e3da['Agents'];});return db[_0x2af0('0x42')][_0x2af0('0x5d')]({'where':{'id':_0x21c21c['params']['id']}})[_0x2af0('0x25')](function(_0x5e1eb8){return db[_0x2af0('0x7b')][_0x2af0('0x7c')](function(_0x51485a){return _0x5e1eb8[_0x2af0('0x76')](_0x199748,{'transaction':_0x51485a})[_0x2af0('0x25')](function(){return BPromise[_0x2af0('0x7d')](_0x2705a5,function(_0x5bbe37){return db[_0x2af0('0x6a')][_0x2af0('0x7e')]({'where':{'UserId':_0x5bbe37['id'],'ChatQueueId':_0x21c21c[_0x2af0('0x5b')]['id']},'transaction':_0x51485a});});})[_0x2af0('0x25')](function(){_0x2705a5['forEach'](function(_0x47f5e7){socket['emit'](_0x2af0('0x7f'),{'UserId':_0x47f5e7['id'],'ChatQueueId':_0x5e1eb8['id']});});});});});}})[_0x2af0('0x25')](respondWithStatusCode(_0x2f34b0,null))['catch'](handleError(_0x2f34b0,null));};exports[_0x2af0('0x80')]=function(_0x38fd30,_0x22db25,_0x156a9a){return db['Team']['findAll']({'where':{'id':_0x38fd30[_0x2af0('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2af0('0x6c')],'as':_0x2af0('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x22db25,null))[_0x2af0('0x25')](function(_0x455672){var _0x4fbd72=_['map'](_0x455672,'id');var _0x45d78b=[];var _0x5ec622=[];var _0x2166c5=squel[_0x2af0('0x81')]();_0x2166c5[_0x2af0('0x82')](_0x2af0('0x83'))[_0x2af0('0x84')](_0x2af0('0x85'),'tq')[_0x2af0('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2af0('0x87'),_0x38fd30[_0x2af0('0x5b')]['id']);for(var _0x543a42=0x0;_0x543a42<_0x455672[_0x2af0('0x4e')];_0x543a42+=0x1){let _0x1c9a88=_0x455672[_0x543a42];for(var _0x57719e=0x0;_0x57719e<_0x1c9a88[_0x2af0('0x77')][_0x2af0('0x4e')];_0x57719e+=0x1){let _0x87b465=_0x1c9a88[_0x2af0('0x77')][_0x57719e];var _0x7ba972=_0x2166c5['clone']();_0x7ba972['where'](_0x2af0('0x88'),_0x87b465['id']);_0x5ec622[_0x2af0('0x89')](db[_0x2af0('0x7b')][_0x2af0('0x47')](_0x7ba972[_0x2af0('0x8a')](),{'type':db['sequelize'][_0x2af0('0x8b')][_0x2af0('0x8c')]})[_0x2af0('0x25')](function(_0x13fad8){if(_0x13fad8['length']===0x1){return _0x87b465['id'];}else{var _0x1f3393=_[_0x2af0('0x8d')](_[_0x2af0('0x41')](_0x13fad8,_0x2af0('0x8e')),function(_0x57ea7e){return _[_0x2af0('0x8f')](_0x4fbd72,_0x57ea7e);});if(_0x1f3393){return _0x87b465['id'];}}}));}}return BPromise[_0x2af0('0x90')](_0x5ec622)[_0x2af0('0x25')](function(_0x56bc49){_0x45d78b=_(_0x45d78b)['union'](_0x56bc49)['compact']()['value']();return db[_0x2af0('0x42')][_0x2af0('0x5d')]({'where':{'id':_0x38fd30['params']['id']}})['then'](function(_0x3f6c78){return db[_0x2af0('0x7b')]['transaction'](function(_0x4629c3){return _0x3f6c78[_0x2af0('0x80')](_0x38fd30[_0x2af0('0x47')][_0x2af0('0x91')],{'transaction':_0x4629c3})[_0x2af0('0x25')](function(){if(!_[_0x2af0('0x92')](_0x45d78b)){return _0x3f6c78['removeAgents'](_0x45d78b,{'transaction':_0x4629c3});}})['then'](function(){_0x45d78b[_0x2af0('0x93')](function(_0x386e57){socket[_0x2af0('0x94')](_0x2af0('0x95'),{'UserId':_0x386e57,'ChatQueueId':_0x3f6c78['id']});});});});});});})['then'](respondWithStatusCode(_0x22db25,null))['catch'](handleError(_0x22db25,null));};exports['addAgents']=function(_0x375b49,_0x4cf4f5,_0x4b8c26){return db['ChatQueue'][_0x2af0('0x5d')]({'where':{'id':_0x375b49['params']['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x4cf4f5,null))[_0x2af0('0x25')](function(_0x5a3782){if(_0x5a3782){return _0x5a3782[_0x2af0('0x96')](_0x375b49['body'][_0x2af0('0x91')],_[_0x2af0('0x97')](_0x375b49[_0x2af0('0x5f')],[_0x2af0('0x91'),'id'])||{})[_0x2af0('0x98')](function(_0x30c704){for(var _0x540e7e=0x0;_0x540e7e<_0x375b49[_0x2af0('0x5f')][_0x2af0('0x91')][_0x2af0('0x4e')];_0x540e7e+=0x1){socket[_0x2af0('0x94')](_0x2af0('0x7f'),{'UserId':Number(_0x375b49[_0x2af0('0x5f')][_0x2af0('0x91')][_0x540e7e]),'ChatQueueId':Number(_0x375b49['params']['id'])});}return _0x30c704;});}})[_0x2af0('0x25')](respondWithResult(_0x4cf4f5,null))[_0x2af0('0x2e')](handleError(_0x4cf4f5,null));};exports[_0x2af0('0x99')]=function(_0x9fdc9a,_0x31f3a0,_0x1594da){return db[_0x2af0('0x42')][_0x2af0('0x5d')]({'where':{'id':_0x9fdc9a[_0x2af0('0x5b')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x31f3a0,null))['then'](function(_0x2c22a9){if(_0x2c22a9){return _0x2c22a9[_0x2af0('0x99')](_0x9fdc9a[_0x2af0('0x47')]['ids'])[_0x2af0('0x25')](function(){if(_['isArray'](_0x9fdc9a[_0x2af0('0x47')][_0x2af0('0x91')])){for(var _0x5e3eff=0x0;_0x5e3eff<_0x9fdc9a['query']['ids'][_0x2af0('0x4e')];_0x5e3eff+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x9fdc9a['query'][_0x2af0('0x91')][_0x5e3eff]),'ChatQueueId':Number(_0x9fdc9a[_0x2af0('0x5b')]['id'])});}}else{socket[_0x2af0('0x94')](_0x2af0('0x95'),{'UserId':Number(_0x9fdc9a[_0x2af0('0x47')]['ids']),'ChatQueueId':Number(_0x9fdc9a[_0x2af0('0x5b')]['id'])});}});}})[_0x2af0('0x25')](respondWithStatusCode(_0x31f3a0,null))[_0x2af0('0x2e')](handleError(_0x31f3a0,null));};exports['getAgents']=function(_0x20c321,_0x50a905,_0x4e0ce8){var _0x24f462={};var _0x5bdb96={};var _0x55fd07;var _0x319467;return db['ChatQueue'][_0x2af0('0x69')]({'where':{'id':_0x20c321[_0x2af0('0x5b')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x50a905,null))[_0x2af0('0x25')](function(_0x40aafe){if(_0x40aafe){_0x55fd07=_0x40aafe;_0x5bdb96['model']=_[_0x2af0('0x48')](db[_0x2af0('0x6c')]['rawAttributes']);_0x5bdb96[_0x2af0('0x47')]=_[_0x2af0('0x48')](_0x20c321[_0x2af0('0x47')]);_0x5bdb96[_0x2af0('0x49')]=_[_0x2af0('0x4a')](_0x5bdb96['model'],_0x5bdb96[_0x2af0('0x47')]);_0x24f462[_0x2af0('0x4b')]=_[_0x2af0('0x4a')](_0x5bdb96[_0x2af0('0x4c')],qs[_0x2af0('0x4d')](_0x20c321['query']['fields']));_0x24f462['attributes']=_0x24f462[_0x2af0('0x4b')]['length']?_0x24f462[_0x2af0('0x4b')]:_0x5bdb96[_0x2af0('0x4c')];_0x24f462['order']=qs[_0x2af0('0x51')](_0x20c321[_0x2af0('0x47')][_0x2af0('0x51')]);_0x24f462[_0x2af0('0x52')]=qs[_0x2af0('0x49')](_[_0x2af0('0x53')](_0x20c321[_0x2af0('0x47')],_0x5bdb96['filters']));if(_0x20c321[_0x2af0('0x47')][_0x2af0('0x54')]){_0x24f462['where']=_[_0x2af0('0x55')](_0x24f462['where'],{'$or':_['map'](_0x24f462[_0x2af0('0x4b')],function(_0x555dad){var _0x4582f2={};_0x4582f2[_0x555dad]={'$like':'%'+_0x20c321[_0x2af0('0x47')]['filter']+'%'};return _0x4582f2;})});}_0x24f462=_['merge']({},_0x24f462,_0x20c321[_0x2af0('0x5c')]);return _0x55fd07[_0x2af0('0x9a')](_0x24f462);}})['then'](function(_0x302b2a){if(_0x302b2a){_0x319467=_0x302b2a[_0x2af0('0x4e')];if(!_0x20c321['query'][_0x2af0('0x4f')](_0x2af0('0x50'))){_0x24f462[_0x2af0('0x36')]=qs['limit'](_0x20c321[_0x2af0('0x47')]['limit']);_0x24f462[_0x2af0('0x33')]=qs[_0x2af0('0x33')](_0x20c321[_0x2af0('0x47')][_0x2af0('0x33')]);}return _0x55fd07[_0x2af0('0x9a')](_0x24f462);}})[_0x2af0('0x25')](function(_0x1ad410){if(_0x1ad410){return _0x1ad410?{'count':_0x319467,'rows':_0x1ad410}:null;}})['then'](respondWithResult(_0x50a905,null))[_0x2af0('0x2e')](handleError(_0x50a905,null));}; \ No newline at end of file +var _0x39e9=['push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','name','send','index','ChatQueue','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','length','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','findAll','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','User','Agents','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x165e10,_0x2d686d){var _0x417ccc=function(_0x4bd53f){while(--_0x4bd53f){_0x165e10['push'](_0x165e10['shift']());}};_0x417ccc(++_0x2d686d);}(_0x39e9,0x1de));var _0x939e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x39e9[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x939e('0x0'));var rimraf=require(_0x939e('0x1'));var zipdir=require(_0x939e('0x2'));var jsonpatch=require(_0x939e('0x3'));var rp=require(_0x939e('0x4'));var moment=require(_0x939e('0x5'));var BPromise=require(_0x939e('0x6'));var Mustache=require('mustache');var util=require(_0x939e('0x7'));var path=require(_0x939e('0x8'));var sox=require('sox');var csv=require(_0x939e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x939e('0xa'));var squel=require('squel');var crypto=require(_0x939e('0xb'));var jsforce=require(_0x939e('0xc'));var deskjs=require(_0x939e('0xd'));var toCsv=require(_0x939e('0x9'));var querystring=require(_0x939e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x939e('0xf'));var qs=require(_0x939e('0x10'));var as=require(_0x939e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x939e('0x12'))(_0x939e('0x13'));var utils=require(_0x939e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x939e('0x15'));var db=require(_0x939e('0x16'))['db'];config[_0x939e('0x17')]=_[_0x939e('0x18')](config[_0x939e('0x17')],{'host':_0x939e('0x19'),'port':0x18eb});var socket=require(_0x939e('0x1a'))(new Redis(config[_0x939e('0x17')]));require(_0x939e('0x1b'))[_0x939e('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x939e('0x1d')][_0x939e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ffd,_0x595c43,_0x338cce,_0x3a4dd7){return new BPromise(function(_0x4490ee,_0x18a09b){var _0xa9254e=_0x3a4dd7||client;return _0xa9254e[_0x939e('0x1f')](_0x1e2ffd,_0x338cce)[_0x939e('0x20')](function(_0x38ce24){logger[_0x939e('0x21')]('ChatQueue,\x20%s,\x20%s',_0x595c43,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x595c43,_0x939e('0x22'),JSON[_0x939e('0x23')](_0x38ce24));if(_0x38ce24[_0x939e('0x24')]){if(_0x38ce24[_0x939e('0x24')][_0x939e('0x25')]===0x1f4){logger[_0x939e('0x24')](_0x939e('0x26'),_0x595c43,_0x38ce24['error'][_0x939e('0x27')]);return _0x18a09b(_0x38ce24[_0x939e('0x24')][_0x939e('0x27')]);}logger[_0x939e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x595c43,_0x38ce24[_0x939e('0x24')][_0x939e('0x27')]);return _0x4490ee(_0x38ce24[_0x939e('0x24')]['message']);}else{logger[_0x939e('0x21')](_0x939e('0x26'),_0x595c43,_0x939e('0x22'));_0x4490ee(_0x38ce24[_0x939e('0x28')][_0x939e('0x27')]);}})[_0x939e('0x29')](function(_0x587943){logger[_0x939e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x595c43,_0x587943);_0x18a09b(_0x587943);});});}function respondWithStatusCode(_0x15ed18,_0x105c47){_0x105c47=_0x105c47||0xcc;return function(_0xf34c76){if(_0xf34c76){return _0x15ed18[_0x939e('0x2a')](_0x105c47);}return _0x15ed18[_0x939e('0x2b')](_0x105c47)[_0x939e('0x2c')]();};}function respondWithResult(_0x332bbc,_0x47c1be){_0x47c1be=_0x47c1be||0xc8;return function(_0x30b8e9){if(_0x30b8e9){return _0x332bbc[_0x939e('0x2b')](_0x47c1be)[_0x939e('0x2d')](_0x30b8e9);}};}function respondWithFilteredResult(_0x16097b,_0x3a9e5e){return function(_0x1627c9){if(_0x1627c9){var _0x318ef0=typeof _0x3a9e5e[_0x939e('0x2e')]===_0x939e('0x2f')&&typeof _0x3a9e5e[_0x939e('0x30')]===_0x939e('0x2f');var _0x1a438f=_0x1627c9[_0x939e('0x31')];var _0x1a3a3a=_0x318ef0?0x0:_0x3a9e5e['offset'];var _0x16830c=_0x318ef0?_0x1627c9[_0x939e('0x31')]:_0x3a9e5e[_0x939e('0x2e')]+_0x3a9e5e[_0x939e('0x30')];var _0x702917;if(_0x16830c>=_0x1a438f){_0x16830c=_0x1a438f;_0x702917=0xc8;}else{_0x702917=0xce;}_0x16097b[_0x939e('0x2b')](_0x702917);return _0x16097b[_0x939e('0x32')]('Content-Range',_0x1a3a3a+'-'+_0x16830c+'/'+_0x1a438f)[_0x939e('0x2d')](_0x1627c9);}return null;};}function patchUpdates(_0x4ad525){return function(_0x5e8e01){try{jsonpatch[_0x939e('0x33')](_0x5e8e01,_0x4ad525,!![]);}catch(_0x3627b6){return BPromise[_0x939e('0x34')](_0x3627b6);}return _0x5e8e01['save']();};}function saveUpdates(_0x4e0388,_0x1b4e03){return function(_0x252c71){if(_0x252c71){return _0x252c71[_0x939e('0x35')](_0x4e0388)[_0x939e('0x20')](function(_0x402ecc){return _0x402ecc;});}return null;};}function removeEntity(_0x4a54fa,_0x2c3c4f){return function(_0x5a9ae9){if(_0x5a9ae9){return _0x5a9ae9[_0x939e('0x36')]()['then'](function(){var _0x2e3442=_0x5a9ae9[_0x939e('0x37')]({'plain':!![]});var _0x4e3704=_0x939e('0x38');return db[_0x939e('0x39')]['destroy']({'where':{'type':_0x4e3704,'resourceId':_0x2e3442['id']}})[_0x939e('0x20')](function(){return _0x5a9ae9;});})[_0x939e('0x20')](function(){_0x4a54fa[_0x939e('0x2b')](0xcc)[_0x939e('0x2c')]();});}};}function handleEntityNotFound(_0x420f99,_0x262ada){return function(_0xed2197){if(!_0xed2197){_0x420f99[_0x939e('0x2a')](0x194);}return _0xed2197;};}function handleError(_0x3dab99,_0x24741d){_0x24741d=_0x24741d||0x1f4;return function(_0x1656a5){logger[_0x939e('0x24')](_0x1656a5['stack']);if(_0x1656a5[_0x939e('0x3a')]){delete _0x1656a5[_0x939e('0x3a')];}_0x3dab99['status'](_0x24741d)[_0x939e('0x3b')](_0x1656a5);};}exports[_0x939e('0x3c')]=function(_0x479154,_0x47f162){var _0x1baef4={},_0x153894={},_0x59df19={'count':0x0,'rows':[]};var _0x2d60c4=_['map'](db[_0x939e('0x3d')]['rawAttributes'],function(_0xb76e29){return{'name':_0xb76e29[_0x939e('0x3e')],'type':_0xb76e29[_0x939e('0x3f')][_0x939e('0x40')]};});_0x153894[_0x939e('0x41')]=_[_0x939e('0x42')](_0x2d60c4,'name');_0x153894[_0x939e('0x43')]=_['keys'](_0x479154['query']);_0x153894[_0x939e('0x44')]=_[_0x939e('0x45')](_0x153894[_0x939e('0x41')],_0x153894['query']);_0x1baef4['attributes']=_[_0x939e('0x45')](_0x153894[_0x939e('0x41')],qs[_0x939e('0x46')](_0x479154[_0x939e('0x43')][_0x939e('0x46')]));_0x1baef4[_0x939e('0x47')]=_0x1baef4[_0x939e('0x47')]['length']?_0x1baef4[_0x939e('0x47')]:_0x153894[_0x939e('0x41')];if(!_0x479154[_0x939e('0x43')][_0x939e('0x48')](_0x939e('0x49'))){_0x1baef4[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x479154[_0x939e('0x43')]['limit']);_0x1baef4['offset']=qs[_0x939e('0x2e')](_0x479154[_0x939e('0x43')]['offset']);}_0x1baef4[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x479154[_0x939e('0x43')][_0x939e('0x4b')]);_0x1baef4[_0x939e('0x4c')]=qs[_0x939e('0x44')](_[_0x939e('0x4d')](_0x479154[_0x939e('0x43')],_0x153894[_0x939e('0x44')]),_0x2d60c4);if(_0x479154[_0x939e('0x43')][_0x939e('0x4e')]){_0x1baef4[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x1baef4[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x2d60c4,function(_0x1fc5bf){if(_0x1fc5bf[_0x939e('0x3f')]!==_0x939e('0x50')){var _0x371f5e={};_0x371f5e[_0x1fc5bf['name']]={'$like':'%'+_0x479154[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x371f5e;}})});}_0x1baef4=_[_0x939e('0x4f')]({},_0x1baef4,_0x479154[_0x939e('0x51')]);var _0x2d7b90={'where':_0x1baef4['where']};return db['ChatQueue']['count'](_0x2d7b90)[_0x939e('0x20')](function(_0x15b08d){_0x59df19['count']=_0x15b08d;if(_0x479154[_0x939e('0x43')][_0x939e('0x52')]){_0x1baef4[_0x939e('0x53')]=[{'all':!![]}];}return db[_0x939e('0x3d')]['findAll'](_0x1baef4);})[_0x939e('0x20')](function(_0x360cb8){_0x59df19[_0x939e('0x54')]=_0x360cb8;return _0x59df19;})['then'](respondWithFilteredResult(_0x47f162,_0x1baef4))[_0x939e('0x29')](handleError(_0x47f162,null));};exports[_0x939e('0x55')]=function(_0x1f2d9b,_0x4a3515){var _0x38a000={'raw':!![],'where':{'id':_0x1f2d9b[_0x939e('0x56')]['id']}},_0x38998f={};_0x38998f[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x3d')][_0x939e('0x58')]);_0x38998f[_0x939e('0x43')]=_[_0x939e('0x57')](_0x1f2d9b['query']);_0x38998f[_0x939e('0x44')]=_[_0x939e('0x45')](_0x38998f[_0x939e('0x41')],_0x38998f[_0x939e('0x43')]);_0x38a000[_0x939e('0x47')]=_[_0x939e('0x45')](_0x38998f[_0x939e('0x41')],qs[_0x939e('0x46')](_0x1f2d9b['query'][_0x939e('0x46')]));_0x38a000[_0x939e('0x47')]=_0x38a000['attributes'][_0x939e('0x59')]?_0x38a000[_0x939e('0x47')]:_0x38998f[_0x939e('0x41')];if(_0x1f2d9b[_0x939e('0x43')][_0x939e('0x52')]){_0x38a000[_0x939e('0x53')]=[{'all':!![]}];}_0x38a000=_[_0x939e('0x4f')]({},_0x38a000,_0x1f2d9b[_0x939e('0x51')]);return db[_0x939e('0x3d')][_0x939e('0x5a')](_0x38a000)[_0x939e('0x20')](handleEntityNotFound(_0x4a3515,null))[_0x939e('0x20')](respondWithResult(_0x4a3515,null))[_0x939e('0x29')](handleError(_0x4a3515,null));};exports[_0x939e('0x5b')]=function(_0x257e1b,_0x6913f0){return db[_0x939e('0x3d')][_0x939e('0x5b')](_0x257e1b['body'],{})[_0x939e('0x20')](function(_0x2887c2){var _0x360c5b=_0x257e1b[_0x939e('0x5c')]['get']({'plain':!![]});if(!_0x360c5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x360c5b[_0x939e('0x5d')]===_0x939e('0x5c')){var _0x535117=_0x2887c2[_0x939e('0x37')]({'plain':!![]});var _0x1e76ee=_0x939e('0x38');return db[_0x939e('0x5e')][_0x939e('0x5a')]({'where':{'name':_0x1e76ee,'userProfileId':_0x360c5b[_0x939e('0x5f')]},'raw':!![]})[_0x939e('0x20')](function(_0xb89544){if(_0xb89544&&_0xb89544['autoAssociation']===0x0){return db[_0x939e('0x39')][_0x939e('0x5b')]({'name':_0x535117[_0x939e('0x3a')],'resourceId':_0x535117['id'],'type':_0xb89544['name'],'sectionId':_0xb89544['id']},{})[_0x939e('0x20')](function(){return _0x2887c2;});}else{return _0x2887c2;}})[_0x939e('0x29')](function(_0x4aab0b){logger['error'](_0x939e('0x60'),_0x4aab0b);throw _0x4aab0b;});}return _0x2887c2;})[_0x939e('0x20')](respondWithResult(_0x6913f0,0xc9))[_0x939e('0x29')](handleError(_0x6913f0,null));};exports[_0x939e('0x35')]=function(_0x290f8c,_0x41e772){if(_0x290f8c[_0x939e('0x61')]['id']){delete _0x290f8c[_0x939e('0x61')]['id'];}return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x290f8c[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x41e772,null))[_0x939e('0x20')](saveUpdates(_0x290f8c[_0x939e('0x61')],null))['then'](respondWithResult(_0x41e772,null))[_0x939e('0x29')](handleError(_0x41e772,null));};exports['destroy']=function(_0x2cff24,_0x55d38a){return db['ChatQueue'][_0x939e('0x5a')]({'where':{'id':_0x2cff24['params']['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x55d38a,null))[_0x939e('0x20')](removeEntity(_0x55d38a,null))[_0x939e('0x29')](handleError(_0x55d38a,null));};exports[_0x939e('0x62')]=function(_0x4f5581,_0x43fa55){return db['ChatQueue'][_0x939e('0x62')]()['then'](respondWithResult(_0x43fa55,null))['catch'](handleError(_0x43fa55,null));};exports[_0x939e('0x63')]=function(_0x5619b5,_0x3923ea,_0x1450ae){var _0x240ebe={'raw':!![],'where':{}},_0x352240={},_0x4adebc;return db[_0x939e('0x3d')][_0x939e('0x64')]({'where':{'id':_0x5619b5[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x3923ea,null))[_0x939e('0x20')](function(_0x25593d){if(_0x25593d){_0x4adebc=_0x25593d[_0x939e('0x37')]({'plain':!![]});_0x352240[_0x939e('0x41')]=_['keys'](db[_0x939e('0x65')][_0x939e('0x58')]);_0x352240['query']=_[_0x939e('0x57')](_0x5619b5[_0x939e('0x43')]);_0x352240['filters']=_['intersection'](_0x352240[_0x939e('0x41')],_0x352240[_0x939e('0x43')]);_0x240ebe[_0x939e('0x47')]=_['intersection'](_0x352240['model'],qs[_0x939e('0x46')](_0x5619b5[_0x939e('0x43')][_0x939e('0x46')]));_0x240ebe[_0x939e('0x47')]=_0x240ebe['attributes']['length']?_0x240ebe['attributes']:_0x352240[_0x939e('0x41')];if(!_0x5619b5['query'][_0x939e('0x48')](_0x939e('0x49'))){_0x240ebe[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x5619b5[_0x939e('0x43')][_0x939e('0x30')]);_0x240ebe['offset']=qs['offset'](_0x5619b5[_0x939e('0x43')][_0x939e('0x2e')]);}_0x240ebe[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x5619b5[_0x939e('0x43')]['sort']);_0x240ebe[_0x939e('0x4c')]=qs[_0x939e('0x44')](_['pick'](_0x5619b5['query'],_0x352240['filters']));_0x240ebe[_0x939e('0x4c')]['ChatQueueId']=_0x25593d['id'];if(_0x5619b5[_0x939e('0x43')][_0x939e('0x4e')]){_0x240ebe[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x240ebe['where'],{'$or':_['map'](_0x240ebe['attributes'],function(_0x159e34){var _0x51c233={};_0x51c233[_0x159e34]={'$like':'%'+_0x5619b5['query'][_0x939e('0x4e')]+'%'};return _0x51c233;})});}_0x240ebe=_['merge']({},_0x240ebe,_0x5619b5['options']);return db['UserChatQueue']['findAll'](_0x240ebe);}})[_0x939e('0x20')](function(_0x383dc9){if(_0x383dc9){return db['User'][_0x939e('0x66')]({'where':{'id':_['map'](_0x383dc9,_0x939e('0x67')),'role':_0x939e('0x68')},'attributes':['id',_0x939e('0x3a'),_0x939e('0x69'),_0x939e('0x6a'),_0x939e('0x6b')]});}})[_0x939e('0x20')](function(_0x3abc8f){if(_0x3abc8f){return{'count':_0x3abc8f[_0x939e('0x31')],'rows':_[_0x939e('0x42')](_0x3abc8f[_0x939e('0x54')],function(_0x52233a){return{'membername':_0x52233a['name'],'UserId':_0x52233a['id'],'queue_name':_0x4adebc[_0x939e('0x3a')],'ChatQueueId':_0x4adebc['id'],'interface':util['format'](_0x939e('0x6c'),_0x939e('0x6d'),_0x52233a[_0x939e('0x3a')]),'penalty':0x0,'paused':_0x52233a[_0x939e('0x69')],'createdAt':_0x52233a[_0x939e('0x6b')],'updatedAt':_0x52233a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x939e('0x20')](respondWithFilteredResult(_0x3923ea,_0x240ebe))[_0x939e('0x29')](handleError(_0x3923ea,null));};exports[_0x939e('0x6e')]=function(_0x82b0a7,_0x1ba4ca,_0x454789){var _0x535ee2={};var _0xcc378c={};var _0x2e7143;var _0x58eb25;return db['ChatQueue'][_0x939e('0x64')]({'where':{'id':_0x82b0a7[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x1ba4ca,null))['then'](function(_0x156b30){if(_0x156b30){_0x2e7143=_0x156b30;_0xcc378c[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x6f')][_0x939e('0x58')]);_0xcc378c[_0x939e('0x43')]=_[_0x939e('0x57')](_0x82b0a7[_0x939e('0x43')]);_0xcc378c['filters']=_[_0x939e('0x45')](_0xcc378c['model'],_0xcc378c['query']);_0x535ee2[_0x939e('0x47')]=_[_0x939e('0x45')](_0xcc378c[_0x939e('0x41')],qs['fields'](_0x82b0a7[_0x939e('0x43')]['fields']));_0x535ee2[_0x939e('0x47')]=_0x535ee2[_0x939e('0x47')][_0x939e('0x59')]?_0x535ee2[_0x939e('0x47')]:_0xcc378c[_0x939e('0x41')];_0x535ee2[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x82b0a7[_0x939e('0x43')][_0x939e('0x4b')]);_0x535ee2[_0x939e('0x4c')]=qs[_0x939e('0x44')](_[_0x939e('0x4d')](_0x82b0a7[_0x939e('0x43')],_0xcc378c[_0x939e('0x44')]));if(_0x82b0a7['query'][_0x939e('0x4e')]){_0x535ee2[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x535ee2[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x535ee2[_0x939e('0x47')],function(_0x3308cc){var _0x585647={};_0x585647[_0x3308cc]={'$like':'%'+_0x82b0a7[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x585647;})});}_0x535ee2=_[_0x939e('0x4f')]({},_0x535ee2,_0x82b0a7[_0x939e('0x51')]);return _0x2e7143[_0x939e('0x6e')](_0x535ee2);}})[_0x939e('0x20')](function(_0x52bfe2){if(_0x52bfe2){_0x58eb25=_0x52bfe2[_0x939e('0x59')];if(!_0x82b0a7[_0x939e('0x43')][_0x939e('0x48')](_0x939e('0x49'))){_0x535ee2[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x82b0a7[_0x939e('0x43')][_0x939e('0x30')]);_0x535ee2['offset']=qs[_0x939e('0x2e')](_0x82b0a7['query'][_0x939e('0x2e')]);}return _0x2e7143['getTeams'](_0x535ee2);}})[_0x939e('0x20')](function(_0x44ae6e){if(_0x44ae6e){return _0x44ae6e?{'count':_0x58eb25,'rows':_0x44ae6e}:null;}})['then'](respondWithResult(_0x1ba4ca,null))[_0x939e('0x29')](handleError(_0x1ba4ca,null));};exports[_0x939e('0x70')]=function(_0x464098,_0x28e304,_0x4cad7c){var _0x537d1d=_0x464098[_0x939e('0x61')][_0x939e('0x71')];return db[_0x939e('0x6f')][_0x939e('0x72')]({'where':{'id':_0x537d1d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x939e('0x3a'),_0x939e('0x73'),_0x939e('0x74'),'interface'],'raw':!![]}]})[_0x939e('0x20')](function(_0x2280c8){if(_0x2280c8){var _0x26f8d1=_[_0x939e('0x75')](_0x2280c8,function(_0x1665c6){var _0x260886=_0x1665c6[_0x939e('0x37')]({'plain':!![]});return _0x260886['Agents'];});return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x464098['params']['id']}})[_0x939e('0x20')](function(_0x207d06){return db[_0x939e('0x76')][_0x939e('0x77')](function(_0x46f095){return _0x207d06[_0x939e('0x70')](_0x537d1d,{'transaction':_0x46f095})[_0x939e('0x20')](function(){return BPromise['each'](_0x26f8d1,function(_0x525992){return db[_0x939e('0x65')][_0x939e('0x78')]({'where':{'UserId':_0x525992['id'],'ChatQueueId':_0x464098['params']['id']},'transaction':_0x46f095});});})['then'](function(){_0x26f8d1[_0x939e('0x79')](function(_0x31080d){socket['emit'](_0x939e('0x7a'),{'UserId':_0x31080d['id'],'ChatQueueId':_0x207d06['id']});});});});});}})[_0x939e('0x20')](respondWithStatusCode(_0x28e304,null))[_0x939e('0x29')](handleError(_0x28e304,null));};exports['removeTeams']=function(_0x170992,_0x20f324,_0x48b83f){return db['Team']['findAll']({'where':{'id':_0x170992[_0x939e('0x43')][_0x939e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x939e('0x7b')],'as':_0x939e('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x939e('0x20')](handleEntityNotFound(_0x20f324,null))['then'](function(_0x265a27){var _0x2fede9=_[_0x939e('0x42')](_0x265a27,'id');var _0x465db6=[];var _0x14ab46=[];var _0x3885cb=squel[_0x939e('0x7d')]();_0x3885cb[_0x939e('0x7e')](_0x939e('0x7f'))['from'](_0x939e('0x80'),'tq')[_0x939e('0x81')](_0x939e('0x82'),'ut',_0x939e('0x83'))[_0x939e('0x4c')](_0x939e('0x84'),_0x170992['params']['id']);for(var _0x3581c7=0x0;_0x3581c7<_0x265a27[_0x939e('0x59')];_0x3581c7+=0x1){let _0x2142ba=_0x265a27[_0x3581c7];for(var _0x3abf86=0x0;_0x3abf86<_0x2142ba[_0x939e('0x7c')][_0x939e('0x59')];_0x3abf86+=0x1){let _0xe47c45=_0x2142ba[_0x939e('0x7c')][_0x3abf86];var _0x406a86=_0x3885cb['clone']();_0x406a86[_0x939e('0x4c')](_0x939e('0x85'),_0xe47c45['id']);_0x14ab46[_0x939e('0x86')](db['sequelize'][_0x939e('0x43')](_0x406a86[_0x939e('0x87')](),{'type':db['sequelize'][_0x939e('0x88')][_0x939e('0x89')]})[_0x939e('0x20')](function(_0x3fe875){if(_0x3fe875['length']===0x1){return _0xe47c45['id'];}else{var _0x37d977=_['every'](_[_0x939e('0x42')](_0x3fe875,_0x939e('0x8a')),function(_0x192a3f){return _[_0x939e('0x8b')](_0x2fede9,_0x192a3f);});if(_0x37d977){return _0xe47c45['id'];}}}));}}return BPromise[_0x939e('0x8c')](_0x14ab46)[_0x939e('0x20')](function(_0x58b546){_0x465db6=_(_0x465db6)[_0x939e('0x8d')](_0x58b546)[_0x939e('0x8e')]()['value']();return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x170992[_0x939e('0x56')]['id']}})[_0x939e('0x20')](function(_0x3d0b6c){return db[_0x939e('0x76')][_0x939e('0x77')](function(_0x464fbd){return _0x3d0b6c[_0x939e('0x8f')](_0x170992[_0x939e('0x43')][_0x939e('0x71')],{'transaction':_0x464fbd})['then'](function(){if(!_[_0x939e('0x90')](_0x465db6)){return _0x3d0b6c['removeAgents'](_0x465db6,{'transaction':_0x464fbd});}})['then'](function(){_0x465db6[_0x939e('0x79')](function(_0x43dd5d){socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':_0x43dd5d,'ChatQueueId':_0x3d0b6c['id']});});});});});});})[_0x939e('0x20')](respondWithStatusCode(_0x20f324,null))[_0x939e('0x29')](handleError(_0x20f324,null));};exports[_0x939e('0x93')]=function(_0x37f88e,_0x1ccd68,_0x43aa86){return db['ChatQueue'][_0x939e('0x5a')]({'where':{'id':_0x37f88e['params']['id']}})['then'](handleEntityNotFound(_0x1ccd68,null))[_0x939e('0x20')](function(_0x3f19f9){if(_0x3f19f9){return _0x3f19f9[_0x939e('0x93')](_0x37f88e[_0x939e('0x61')][_0x939e('0x71')],_[_0x939e('0x94')](_0x37f88e[_0x939e('0x61')],[_0x939e('0x71'),'id'])||{})[_0x939e('0x95')](function(_0x4bd5c3){for(var _0x4ab4f6=0x0;_0x4ab4f6<_0x37f88e[_0x939e('0x61')]['ids'][_0x939e('0x59')];_0x4ab4f6+=0x1){socket[_0x939e('0x91')](_0x939e('0x7a'),{'UserId':Number(_0x37f88e[_0x939e('0x61')][_0x939e('0x71')][_0x4ab4f6]),'ChatQueueId':Number(_0x37f88e[_0x939e('0x56')]['id'])});}return _0x4bd5c3;});}})['then'](respondWithResult(_0x1ccd68,null))[_0x939e('0x29')](handleError(_0x1ccd68,null));};exports[_0x939e('0x96')]=function(_0x50e2d6,_0x5a838a,_0x18744a){return db[_0x939e('0x3d')]['find']({'where':{'id':_0x50e2d6['params']['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x5a838a,null))['then'](function(_0x399ff2){if(_0x399ff2){return _0x399ff2[_0x939e('0x96')](_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')])[_0x939e('0x20')](function(){if(_[_0x939e('0x97')](_0x50e2d6['query']['ids'])){for(var _0x402b54=0x0;_0x402b54<_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')][_0x939e('0x59')];_0x402b54+=0x1){socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':Number(_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')][_0x402b54]),'ChatQueueId':Number(_0x50e2d6[_0x939e('0x56')]['id'])});}}else{socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':Number(_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')]),'ChatQueueId':Number(_0x50e2d6[_0x939e('0x56')]['id'])});}});}})[_0x939e('0x20')](respondWithStatusCode(_0x5a838a,null))['catch'](handleError(_0x5a838a,null));};exports[_0x939e('0x98')]=function(_0x1af4ab,_0x435dff,_0x19d049){var _0x19d3fb={};var _0x59b99f={};var _0x1ce3e8;var _0x2592d0;return db['ChatQueue'][_0x939e('0x64')]({'where':{'id':_0x1af4ab['params']['id']}})['then'](handleEntityNotFound(_0x435dff,null))[_0x939e('0x20')](function(_0x3a155d){if(_0x3a155d){_0x1ce3e8=_0x3a155d;_0x59b99f[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x7b')][_0x939e('0x58')]);_0x59b99f[_0x939e('0x43')]=_[_0x939e('0x57')](_0x1af4ab[_0x939e('0x43')]);_0x59b99f[_0x939e('0x44')]=_[_0x939e('0x45')](_0x59b99f[_0x939e('0x41')],_0x59b99f[_0x939e('0x43')]);_0x19d3fb[_0x939e('0x47')]=_[_0x939e('0x45')](_0x59b99f[_0x939e('0x41')],qs[_0x939e('0x46')](_0x1af4ab[_0x939e('0x43')]['fields']));_0x19d3fb['attributes']=_0x19d3fb[_0x939e('0x47')][_0x939e('0x59')]?_0x19d3fb[_0x939e('0x47')]:_0x59b99f[_0x939e('0x41')];_0x19d3fb[_0x939e('0x4a')]=qs['sort'](_0x1af4ab['query'][_0x939e('0x4b')]);_0x19d3fb[_0x939e('0x4c')]=qs[_0x939e('0x44')](_['pick'](_0x1af4ab[_0x939e('0x43')],_0x59b99f[_0x939e('0x44')]));if(_0x1af4ab[_0x939e('0x43')][_0x939e('0x4e')]){_0x19d3fb[_0x939e('0x4c')]=_['merge'](_0x19d3fb[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x19d3fb['attributes'],function(_0x1aca3e){var _0x5433ac={};_0x5433ac[_0x1aca3e]={'$like':'%'+_0x1af4ab[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x5433ac;})});}_0x19d3fb=_[_0x939e('0x4f')]({},_0x19d3fb,_0x1af4ab[_0x939e('0x51')]);return _0x1ce3e8[_0x939e('0x98')](_0x19d3fb);}})[_0x939e('0x20')](function(_0xd046f1){if(_0xd046f1){_0x2592d0=_0xd046f1[_0x939e('0x59')];if(!_0x1af4ab['query'][_0x939e('0x48')](_0x939e('0x49'))){_0x19d3fb['limit']=qs[_0x939e('0x30')](_0x1af4ab[_0x939e('0x43')][_0x939e('0x30')]);_0x19d3fb[_0x939e('0x2e')]=qs[_0x939e('0x2e')](_0x1af4ab[_0x939e('0x43')][_0x939e('0x2e')]);}return _0x1ce3e8['getAgents'](_0x19d3fb);}})[_0x939e('0x20')](function(_0x678c32){if(_0x678c32){return _0x678c32?{'count':_0x2592d0,'rows':_0x678c32}:null;}})['then'](respondWithResult(_0x435dff,null))[_0x939e('0x29')](handleError(_0x435dff,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e38fa1f..e754e52 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 _0xd2c4=['hook','exports','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xe9fb2,_0x50374b){var _0x822cb9=function(_0x175436){while(--_0x175436){_0xe9fb2['push'](_0xe9fb2['shift']());}};_0x822cb9(++_0x50374b);}(_0xd2c4,0x110));var _0x4d2c=function(_0x507126,_0x3dd5c3){_0x507126=_0x507126-0x0;var _0x5ca642=_0xd2c4[_0x507126];return _0x5ca642;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x4d2c('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4d2c('0x1')](0x0);var events={'afterCreate':_0x4d2c('0x2'),'afterUpdate':_0x4d2c('0x3'),'afterDestroy':_0x4d2c('0x4')};function emitEvent(_0x4d4b9d){return function(_0x57df0,_0x57047f,_0x3cd718){ChatQueueEvents[_0x4d2c('0x5')](_0x4d4b9d+':'+_0x57df0['id'],_0x57df0);ChatQueueEvents[_0x4d2c('0x5')](_0x4d4b9d,_0x57df0);_0x3cd718(null);};}for(var e in events){if(events[_0x4d2c('0x6')](e)){var event=events[e];ChatQueue[_0x4d2c('0x7')](e,emitEvent(event));}}module[_0x4d2c('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x0dcf=['../../mysqldb','ChatQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x21e49b,_0x3d9b77){var _0x374458=function(_0x4c25d3){while(--_0x4c25d3){_0x21e49b['push'](_0x21e49b['shift']());}};_0x374458(++_0x3d9b77);}(_0x0dcf,0x179));var _0xf0dc=function(_0x3a5e7c,_0x5cbdf3){_0x3a5e7c=_0x3a5e7c-0x0;var _0x41dc9f=_0x0dcf[_0x3a5e7c];return _0x41dc9f;};'use strict';var EventEmitter=require(_0xf0dc('0x0'));var ChatQueue=require(_0xf0dc('0x1'))['db'][_0xf0dc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0dc('0x3'),'afterUpdate':_0xf0dc('0x4'),'afterDestroy':_0xf0dc('0x5')};function emitEvent(_0x4d2705){return function(_0x4c44d2,_0x5c44eb,_0x405a46){ChatQueueEvents[_0xf0dc('0x6')](_0x4d2705+':'+_0x4c44d2['id'],_0x4c44d2);ChatQueueEvents[_0xf0dc('0x6')](_0x4d2705,_0x4c44d2);_0x405a46(null);};}for(var e in events){if(events[_0xf0dc('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xf0dc('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ee5d3c0..1b246c3 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 _0x7c74=['ChatQueue','chat_queues','lodash','util','../../config/logger','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7c74,0xa7));var _0x47c7=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0x7c74[_0x23e33d];return _0x818fc;};'use strict';var _=require(_0x47c7('0x0'));var util=require(_0x47c7('0x1'));var logger=require(_0x47c7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x47c7('0x3'));var fs=require('fs');var path=require(_0x47c7('0x4'));var rimraf=require('rimraf');var config=require(_0x47c7('0x5'));var attributes=require(_0x47c7('0x6'));module[_0x47c7('0x7')]=function(_0x26d0c2,_0x2a8763){return _0x26d0c2[_0x47c7('0x8')](_0x47c7('0x9'),attributes,{'tableName':_0x47c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a8=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0x36a1d4,_0x5c3a68){var _0x5eadb5=function(_0x5d9ca0){while(--_0x5d9ca0){_0x36a1d4['push'](_0x36a1d4['shift']());}};_0x5eadb5(++_0x5c3a68);}(_0xf1a8,0x143));var _0x8f1a=function(_0x4d0a56,_0x2a631b){_0x4d0a56=_0x4d0a56-0x0;var _0x1885b6=_0xf1a8[_0x4d0a56];return _0x1885b6;};'use strict';var _=require('lodash');var util=require(_0x8f1a('0x0'));var logger=require(_0x8f1a('0x1'))('api');var moment=require(_0x8f1a('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f1a('0x3'));var fs=require('fs');var path=require(_0x8f1a('0x4'));var rimraf=require(_0x8f1a('0x5'));var config=require(_0x8f1a('0x6'));var attributes=require(_0x8f1a('0x7'));module[_0x8f1a('0x8')]=function(_0x16c03a,_0xd98048){return _0x16c03a[_0x8f1a('0x9')](_0x8f1a('0xa'),attributes,{'tableName':_0x8f1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 6b1c918..e8e8d1b 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 _0x8286=['result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./chatQueue.socket','register','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message'];(function(_0x3259e4,_0x4134e5){var _0x4056db=function(_0x33bd2a){while(--_0x33bd2a){_0x3259e4['push'](_0x3259e4['shift']());}};_0x4056db(++_0x4134e5);}(_0x8286,0x66));var _0x6828=function(_0xd39159,_0x2f4bb3){_0xd39159=_0xd39159-0x0;var _0x4ca362=_0x8286[_0xd39159];return _0x4ca362;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var moment=require(_0x6828('0x2'));var BPromise=require(_0x6828('0x3'));var rs=require(_0x6828('0x4'));var fs=require('fs');var Redis=require(_0x6828('0x5'));var db=require(_0x6828('0x6'))['db'];var utils=require(_0x6828('0x7'));var logger=require(_0x6828('0x8'))(_0x6828('0x9'));var config=require(_0x6828('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6828('0xb')][_0x6828('0xc')]({'port':0x232a});config['redis']=_[_0x6828('0xd')](config[_0x6828('0xe')],{'host':_0x6828('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6828('0xe')]));require(_0x6828('0x10'))[_0x6828('0x11')](socket);function respondWithRpcPromise(_0x7a118c,_0x17925b,_0x2b652c){return new BPromise(function(_0x171faf,_0x15c466){return client[_0x6828('0x12')](_0x7a118c,_0x2b652c)['then'](function(_0x592318){logger[_0x6828('0x13')]('ChatQueue,\x20%s,\x20%s',_0x17925b,_0x6828('0x14'));logger['debug'](_0x6828('0x15'),_0x17925b,_0x6828('0x14'),JSON[_0x6828('0x16')](_0x592318));if(_0x592318[_0x6828('0x17')]){if(_0x592318[_0x6828('0x17')][_0x6828('0x18')]===0x1f4){logger['error'](_0x6828('0x19'),_0x17925b,_0x592318[_0x6828('0x17')][_0x6828('0x1a')]);return _0x15c466(_0x592318['error'][_0x6828('0x1a')]);}logger[_0x6828('0x17')](_0x6828('0x19'),_0x17925b,_0x592318['error'][_0x6828('0x1a')]);return _0x171faf(_0x592318[_0x6828('0x17')]['message']);}else{logger[_0x6828('0x13')]('ChatQueue,\x20%s,\x20%s',_0x17925b,_0x6828('0x14'));_0x171faf(_0x592318[_0x6828('0x1b')][_0x6828('0x1a')]);}})[_0x6828('0x1c')](function(_0x36d297){logger['error']('ChatQueue,\x20%s,\x20%s',_0x17925b,_0x36d297);_0x15c466(_0x36d297);});});}exports[_0x6828('0x1d')]=function(_0x23c634){var _0x32de42=this;return new Promise(function(_0x5a43e4,_0x469a9f){return db[_0x6828('0x1e')][_0x6828('0x1f')]({'raw':_0x23c634[_0x6828('0x20')]?_0x23c634[_0x6828('0x20')][_0x6828('0x21')]===undefined?!![]:![]:!![],'where':_0x23c634[_0x6828('0x20')]?_0x23c634[_0x6828('0x20')][_0x6828('0x22')]||null:null,'attributes':_0x23c634[_0x6828('0x20')]?_0x23c634[_0x6828('0x20')][_0x6828('0x23')]||null:null,'limit':_0x23c634[_0x6828('0x20')]?_0x23c634[_0x6828('0x20')][_0x6828('0x24')]||null:null,'include':_0x23c634[_0x6828('0x20')]?_0x23c634[_0x6828('0x20')][_0x6828('0x25')]?_['map'](_0x23c634[_0x6828('0x20')][_0x6828('0x25')],function(_0x13f4bb){return{'model':db[_0x13f4bb[_0x6828('0x26')]],'as':_0x13f4bb['as'],'attributes':_0x13f4bb[_0x6828('0x23')],'include':_0x13f4bb[_0x6828('0x25')]?_['map'](_0x13f4bb['include'],function(_0x25cd0f){return{'model':db[_0x25cd0f['model']],'as':_0x25cd0f['as'],'attributes':_0x25cd0f[_0x6828('0x23')],'include':_0x25cd0f[_0x6828('0x25')]?_[_0x6828('0x27')](_0x25cd0f[_0x6828('0x25')],function(_0xe49985){return{'model':db[_0xe49985[_0x6828('0x26')]],'as':_0xe49985['as'],'attributes':_0xe49985[_0x6828('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6828('0x28')](function(_0x12ab2a){logger[_0x6828('0x13')](_0x6828('0x1d'),_0x23c634);logger['debug']('GetChatQueue',_0x23c634,JSON[_0x6828('0x16')](_0x12ab2a));_0x5a43e4(_0x12ab2a);})[_0x6828('0x1c')](function(_0x18f747){logger[_0x6828('0x17')](_0x6828('0x1d'),_0x18f747[_0x6828('0x1a')],_0x23c634);_0x469a9f(_0x32de42[_0x6828('0x17')](0x1f4,_0x18f747[_0x6828('0x1a')]));});});};exports[_0x6828('0x29')]=function(_0x4e9396){var _0xaff5f6=this;return new Promise(function(_0x38fae1,_0x4c29d9){return db[_0x6828('0x1e')][_0x6828('0x2a')]({'raw':_0x4e9396[_0x6828('0x20')]?_0x4e9396[_0x6828('0x20')][_0x6828('0x21')]===undefined?!![]:![]:!![],'where':_0x4e9396['options']?_0x4e9396[_0x6828('0x20')]['where']||null:null,'attributes':_0x4e9396['options']?_0x4e9396[_0x6828('0x20')][_0x6828('0x23')]||null:null,'include':_0x4e9396[_0x6828('0x20')]?_0x4e9396['options'][_0x6828('0x25')]?_[_0x6828('0x27')](_0x4e9396[_0x6828('0x20')][_0x6828('0x25')],function(_0x4f3003){return{'model':db[_0x4f3003[_0x6828('0x26')]],'as':_0x4f3003['as'],'attributes':_0x4f3003[_0x6828('0x23')],'include':_0x4f3003[_0x6828('0x25')]?_[_0x6828('0x27')](_0x4f3003['include'],function(_0x1a08cd){return{'model':db[_0x1a08cd[_0x6828('0x26')]],'as':_0x1a08cd['as'],'attributes':_0x1a08cd[_0x6828('0x23')],'include':_0x1a08cd[_0x6828('0x25')]?_[_0x6828('0x27')](_0x1a08cd[_0x6828('0x25')],function(_0x5ee413){return{'model':db[_0x5ee413[_0x6828('0x26')]],'as':_0x5ee413['as'],'attributes':_0x5ee413[_0x6828('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x153bb9){logger['info'](_0x6828('0x29'),_0x4e9396);logger['debug']('ShowChatQueue',_0x4e9396,JSON[_0x6828('0x16')](_0x153bb9));_0x38fae1(_0x153bb9);})[_0x6828('0x1c')](function(_0x1c07df){logger[_0x6828('0x17')](_0x6828('0x29'),_0x1c07df['message'],_0x4e9396);_0x4c29d9(_0xaff5f6[_0x6828('0x17')](0x1f4,_0x1c07df[_0x6828('0x1a')]));});});}; \ No newline at end of file +var _0x174b=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','findAll','options','where','attributes','include','map','model','then','find','raw','ShowChatQueue','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f940c,_0x1d40c0){var _0x166d58=function(_0x5b6110){while(--_0x5b6110){_0x4f940c['push'](_0x4f940c['shift']());}};_0x166d58(++_0x1d40c0);}(_0x174b,0x19d));var _0xb174=function(_0x1f658d,_0x8af0ac){_0x1f658d=_0x1f658d-0x0;var _0x266082=_0x174b[_0x1f658d];return _0x266082;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});config[_0xb174('0xa')]=_[_0xb174('0xb')](config[_0xb174('0xa')],{'host':_0xb174('0xc'),'port':0x18eb});var socket=require(_0xb174('0xd'))(new Redis(config[_0xb174('0xa')]));require(_0xb174('0xe'))['register'](socket);function respondWithRpcPromise(_0x84e738,_0x4b6dd6,_0x3a05e9){return new BPromise(function(_0x1a4775,_0x4dffab){return client[_0xb174('0xf')](_0x84e738,_0x3a05e9)['then'](function(_0x3fbd28){logger[_0xb174('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));logger[_0xb174('0x12')](_0xb174('0x13'),_0x4b6dd6,_0xb174('0x11'),JSON['stringify'](_0x3fbd28));if(_0x3fbd28[_0xb174('0x14')]){if(_0x3fbd28['error'][_0xb174('0x15')]===0x1f4){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')]['message']);return _0x4dffab(_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);}logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);return _0x1a4775(_0x3fbd28['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));_0x1a4775(_0x3fbd28['result'][_0xb174('0x17')]);}})[_0xb174('0x18')](function(_0x5ac337){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x5ac337);_0x4dffab(_0x5ac337);});});}exports[_0xb174('0x19')]=function(_0x3117e2){var _0x835251=this;return new Promise(function(_0x1dc03e,_0xcc8d9a){return db['ChatQueue'][_0xb174('0x1a')]({'raw':_0x3117e2[_0xb174('0x1b')]?_0x3117e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3117e2['options']?_0x3117e2[_0xb174('0x1b')][_0xb174('0x1c')]||null:null,'attributes':_0x3117e2[_0xb174('0x1b')]?_0x3117e2['options'][_0xb174('0x1d')]||null:null,'limit':_0x3117e2[_0xb174('0x1b')]?_0x3117e2[_0xb174('0x1b')]['limit']||null:null,'include':_0x3117e2[_0xb174('0x1b')]?_0x3117e2[_0xb174('0x1b')][_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x3117e2[_0xb174('0x1b')]['include'],function(_0x1f6a70){return{'model':db[_0x1f6a70['model']],'as':_0x1f6a70['as'],'attributes':_0x1f6a70[_0xb174('0x1d')],'include':_0x1f6a70[_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x1f6a70['include'],function(_0x59a348){return{'model':db[_0x59a348[_0xb174('0x20')]],'as':_0x59a348['as'],'attributes':_0x59a348[_0xb174('0x1d')],'include':_0x59a348['include']?_['map'](_0x59a348[_0xb174('0x1e')],function(_0x549fcf){return{'model':db[_0x549fcf[_0xb174('0x20')]],'as':_0x549fcf['as'],'attributes':_0x549fcf[_0xb174('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x21')](function(_0x2e9f7a){logger[_0xb174('0x10')](_0xb174('0x19'),_0x3117e2);logger[_0xb174('0x12')]('GetChatQueue',_0x3117e2,JSON['stringify'](_0x2e9f7a));_0x1dc03e(_0x2e9f7a);})[_0xb174('0x18')](function(_0xa46091){logger[_0xb174('0x14')](_0xb174('0x19'),_0xa46091[_0xb174('0x17')],_0x3117e2);_0xcc8d9a(_0x835251[_0xb174('0x14')](0x1f4,_0xa46091[_0xb174('0x17')]));});});};exports['ShowChatQueue']=function(_0x1517d8){var _0x3af043=this;return new Promise(function(_0x3e1659,_0x362c5c){return db['ChatQueue'][_0xb174('0x22')]({'raw':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x23')]===undefined?!![]:![]:!![],'where':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1c')]||null:null,'attributes':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1d')]||null:null,'include':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x1517d8[_0xb174('0x1b')][_0xb174('0x1e')],function(_0x4a7cd8){return{'model':db[_0x4a7cd8[_0xb174('0x20')]],'as':_0x4a7cd8['as'],'attributes':_0x4a7cd8[_0xb174('0x1d')],'include':_0x4a7cd8['include']?_[_0xb174('0x1f')](_0x4a7cd8[_0xb174('0x1e')],function(_0xe3b6c3){return{'model':db[_0xe3b6c3[_0xb174('0x20')]],'as':_0xe3b6c3['as'],'attributes':_0xe3b6c3[_0xb174('0x1d')],'include':_0xe3b6c3['include']?_[_0xb174('0x1f')](_0xe3b6c3[_0xb174('0x1e')],function(_0x2857a5){return{'model':db[_0x2857a5[_0xb174('0x20')]],'as':_0x2857a5['as'],'attributes':_0x2857a5[_0xb174('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x21')](function(_0x57b823){logger[_0xb174('0x10')](_0xb174('0x24'),_0x1517d8);logger[_0xb174('0x12')]('ShowChatQueue',_0x1517d8,JSON[_0xb174('0x25')](_0x57b823));_0x3e1659(_0x57b823);})[_0xb174('0x18')](function(_0x1a9e9a){logger[_0xb174('0x14')](_0xb174('0x24'),_0x1a9e9a[_0xb174('0x17')],_0x1517d8);_0x362c5c(_0x3af043[_0xb174('0x14')](0x1f4,_0x1a9e9a[_0xb174('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e9cee0c..c2ce964 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 _0x8d0e=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x3f0577,_0x13d404){var _0x3c70dc=function(_0x3fada8){while(--_0x3fada8){_0x3f0577['push'](_0x3f0577['shift']());}};_0x3c70dc(++_0x13d404);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x437006,_0x30c3ae){_0x437006=_0x437006-0x0;var _0x5dc592=_0x8d0e[_0x437006];return _0x5dc592;};'use strict';var ChatQueueEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){ChatQueueEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);ChatQueueEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file +var _0xac9d=['update','emit','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x389f87,_0x5e6f9f){var _0x5a1f4e=function(_0xf0f0b2){while(--_0xf0f0b2){_0x389f87['push'](_0x389f87['shift']());}};_0x5a1f4e(++_0x5e6f9f);}(_0xac9d,0x14d));var _0xdac9=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0xac9d[_0x211576];return _0x3ce235;};'use strict';var ChatQueueEvents=require(_0xdac9('0x0'));var events=[_0xdac9('0x1'),_0xdac9('0x2'),_0xdac9('0x3')];function createListener(_0x12390c,_0x27eb7c){return function(_0x25d1b3){_0x27eb7c[_0xdac9('0x4')](_0x12390c,_0x25d1b3);};}function removeListener(_0x51a5d7,_0x1c17a6){return function(){ChatQueueEvents['removeListener'](_0x51a5d7,_0x1c17a6);};}exports[_0xdac9('0x5')]=function(_0x1f8ff3){for(var _0x1222bb=0x0,_0x776b6c=events[_0xdac9('0x6')];_0x1222bb<_0x776b6c;_0x1222bb++){var _0x39f560=events[_0x1222bb];var _0x5531af=createListener(_0xdac9('0x7')+_0x39f560,_0x1f8ff3);ChatQueueEvents['on'](_0x39f560,_0x5531af);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6903b96..2450f13 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x3e8a05,_0x659ffa){var _0x43daaa=function(_0x1e5348){while(--_0x1e5348){_0x3e8a05['push'](_0x3e8a05['shift']());}};_0x43daaa(++_0x659ffa);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x4021fc,_0x316e5e){_0x4021fc=_0x4021fc-0x0;var _0x29b0df=_0x3e74[_0x4021fc];return _0x29b0df;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b6eaf8c..9159871 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 _0x60fe=['STRING','DATE'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x60fe,0x176));var _0xe60f=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x60fe[_0x10f6e8];return _0x35bb3c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe60f('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe60f('0x0')]},'joinAt':{'type':Sequelize[_0xe60f('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe60f('0x1')]},'reason':{'type':Sequelize[_0xe60f('0x0')]}}; \ No newline at end of file +var _0x64ea=['exports','STRING','DATE','moment','sequelize'];(function(_0x468be0,_0x50b945){var _0x3c71ec=function(_0x40ad7c){while(--_0x40ad7c){_0x468be0['push'](_0x468be0['shift']());}};_0x3c71ec(++_0x50b945);}(_0x64ea,0x80));var _0xa64e=function(_0x4d4e87,_0x3da0bc){_0x4d4e87=_0x4d4e87-0x0;var _0x580ca3=_0x64ea[_0x4d4e87];return _0x580ca3;};'use strict';var moment=require(_0xa64e('0x0'));var Sequelize=require(_0xa64e('0x1'));module[_0xa64e('0x2')]={'uniqueid':{'type':Sequelize[_0xa64e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa64e('0x3')]},'joinAt':{'type':Sequelize[_0xa64e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa64e('0x4')]},'exitAt':{'type':Sequelize[_0xa64e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 407330f..b84a24d 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 _0x3974=['ChatQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index'];(function(_0x14f5c6,_0x204dab){var _0x5df9d0=function(_0x152798){while(--_0x152798){_0x14f5c6['push'](_0x14f5c6['shift']());}};_0x5df9d0(++_0x204dab);}(_0x3974,0xbc));var _0x4397=function(_0x1103e0,_0xf50d22){_0x1103e0=_0x1103e0-0x0;var _0x55d70b=_0x3974[_0x1103e0];return _0x55d70b;};'use strict';var emlformat=require(_0x4397('0x0'));var rimraf=require(_0x4397('0x1'));var zipdir=require(_0x4397('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4397('0x3'));var BPromise=require(_0x4397('0x4'));var Mustache=require(_0x4397('0x5'));var util=require(_0x4397('0x6'));var path=require(_0x4397('0x7'));var sox=require('sox');var csv=require(_0x4397('0x8'));var ejs=require(_0x4397('0x9'));var fs=require('fs');var fs_extra=require(_0x4397('0xa'));var _=require(_0x4397('0xb'));var squel=require('squel');var crypto=require(_0x4397('0xc'));var jsforce=require(_0x4397('0xd'));var deskjs=require(_0x4397('0xe'));var toCsv=require(_0x4397('0x8'));var querystring=require('querystring');var Papa=require(_0x4397('0xf'));var Redis=require(_0x4397('0x10'));var authService=require(_0x4397('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4397('0x12'));var logger=require(_0x4397('0x13'))(_0x4397('0x14'));var utils=require('../../config/utils');var config=require(_0x4397('0x15'));var licenseUtil=require(_0x4397('0x16'));var db=require(_0x4397('0x17'))['db'];function respondWithStatusCode(_0x50b80d,_0x1354f5){_0x1354f5=_0x1354f5||0xcc;return function(_0x35f6ba){if(_0x35f6ba){return _0x50b80d[_0x4397('0x18')](_0x1354f5);}return _0x50b80d['status'](_0x1354f5)[_0x4397('0x19')]();};}function respondWithResult(_0x541bf0,_0x3b7b4a){_0x3b7b4a=_0x3b7b4a||0xc8;return function(_0x5f5899){if(_0x5f5899){return _0x541bf0[_0x4397('0x1a')](_0x3b7b4a)[_0x4397('0x1b')](_0x5f5899);}};}function respondWithFilteredResult(_0x3b6dfa,_0x1aa61f){return function(_0x172ce2){if(_0x172ce2){var _0x423224=typeof _0x1aa61f['offset']===_0x4397('0x1c')&&typeof _0x1aa61f[_0x4397('0x1d')]===_0x4397('0x1c');var _0x27c307=_0x172ce2[_0x4397('0x1e')];var _0xdd7dab=_0x423224?0x0:_0x1aa61f[_0x4397('0x1f')];var _0x24d400=_0x423224?_0x172ce2[_0x4397('0x1e')]:_0x1aa61f['offset']+_0x1aa61f['limit'];var _0xff27cd;if(_0x24d400>=_0x27c307){_0x24d400=_0x27c307;_0xff27cd=0xc8;}else{_0xff27cd=0xce;}_0x3b6dfa[_0x4397('0x1a')](_0xff27cd);return _0x3b6dfa[_0x4397('0x20')](_0x4397('0x21'),_0xdd7dab+'-'+_0x24d400+'/'+_0x27c307)['json'](_0x172ce2);}return null;};}function patchUpdates(_0x523002){return function(_0x64406d){try{jsonpatch[_0x4397('0x22')](_0x64406d,_0x523002,!![]);}catch(_0x52bf64){return BPromise['reject'](_0x52bf64);}return _0x64406d['save']();};}function saveUpdates(_0x2cc426,_0x5b33e9){return function(_0x4f60f1){if(_0x4f60f1){return _0x4f60f1[_0x4397('0x23')](_0x2cc426)[_0x4397('0x24')](function(_0x53d6d3){return _0x53d6d3;});}return null;};}function removeEntity(_0x2797d2,_0x4d6de6){return function(_0x2655f1){if(_0x2655f1){return _0x2655f1[_0x4397('0x25')]()['then'](function(){_0x2797d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe57d,_0x404c69){return function(_0x1d8f8e){if(!_0x1d8f8e){_0x3fe57d[_0x4397('0x18')](0x194);}return _0x1d8f8e;};}function handleError(_0x3dfb6b,_0x5d2e7f){_0x5d2e7f=_0x5d2e7f||0x1f4;return function(_0x224662){logger[_0x4397('0x26')](_0x224662[_0x4397('0x27')]);if(_0x224662[_0x4397('0x28')]){delete _0x224662[_0x4397('0x28')];}_0x3dfb6b[_0x4397('0x1a')](_0x5d2e7f)[_0x4397('0x29')](_0x224662);};}exports[_0x4397('0x2a')]=function(_0x550b0d,_0x5291e9){var _0x3ce44f={},_0x575536={},_0x3d6188={'count':0x0,'rows':[]};var _0x32d542=_['map'](db[_0x4397('0x2b')][_0x4397('0x2c')],function(_0x3492f4){return{'name':_0x3492f4['fieldName'],'type':_0x3492f4[_0x4397('0x2d')][_0x4397('0x2e')]};});_0x575536[_0x4397('0x2f')]=_['map'](_0x32d542,_0x4397('0x28'));_0x575536['query']=_[_0x4397('0x30')](_0x550b0d['query']);_0x575536[_0x4397('0x31')]=_[_0x4397('0x32')](_0x575536[_0x4397('0x2f')],_0x575536[_0x4397('0x33')]);_0x3ce44f[_0x4397('0x34')]=_[_0x4397('0x32')](_0x575536['model'],qs[_0x4397('0x35')](_0x550b0d[_0x4397('0x33')]['fields']));_0x3ce44f['attributes']=_0x3ce44f['attributes'][_0x4397('0x36')]?_0x3ce44f[_0x4397('0x34')]:_0x575536[_0x4397('0x2f')];if(!_0x550b0d[_0x4397('0x33')][_0x4397('0x37')](_0x4397('0x38'))){_0x3ce44f[_0x4397('0x1d')]=qs['limit'](_0x550b0d['query'][_0x4397('0x1d')]);_0x3ce44f[_0x4397('0x1f')]=qs[_0x4397('0x1f')](_0x550b0d[_0x4397('0x33')]['offset']);}_0x3ce44f[_0x4397('0x39')]=qs[_0x4397('0x3a')](_0x550b0d[_0x4397('0x33')][_0x4397('0x3a')]);_0x3ce44f['where']=qs[_0x4397('0x31')](_[_0x4397('0x3b')](_0x550b0d['query'],_0x575536[_0x4397('0x31')]),_0x32d542);if(_0x550b0d[_0x4397('0x33')][_0x4397('0x3c')]){_0x3ce44f['where']=_['merge'](_0x3ce44f[_0x4397('0x3d')],{'$or':_[_0x4397('0x3e')](_0x32d542,function(_0x191e90){if(_0x191e90[_0x4397('0x2d')]!==_0x4397('0x3f')){var _0x32f144={};_0x32f144[_0x191e90['name']]={'$like':'%'+_0x550b0d['query'][_0x4397('0x3c')]+'%'};return _0x32f144;}})});}_0x3ce44f=_['merge']({},_0x3ce44f,_0x550b0d[_0x4397('0x40')]);var _0x9d5070={'where':_0x3ce44f[_0x4397('0x3d')]};return db[_0x4397('0x2b')][_0x4397('0x1e')](_0x9d5070)[_0x4397('0x24')](function(_0x56eeda){_0x3d6188[_0x4397('0x1e')]=_0x56eeda;if(_0x550b0d[_0x4397('0x33')]['includeAll']){_0x3ce44f[_0x4397('0x41')]=[{'all':!![]}];}return db[_0x4397('0x2b')][_0x4397('0x42')](_0x3ce44f);})['then'](function(_0x5aa05a){_0x3d6188[_0x4397('0x43')]=_0x5aa05a;return _0x3d6188;})['then'](respondWithFilteredResult(_0x5291e9,_0x3ce44f))[_0x4397('0x44')](handleError(_0x5291e9,null));};exports[_0x4397('0x45')]=function(_0x20dbd4,_0x469f2b){var _0x4f45a3={'raw':!![],'where':{'id':_0x20dbd4[_0x4397('0x46')]['id']}},_0x102da9={};_0x102da9[_0x4397('0x2f')]=_[_0x4397('0x30')](db[_0x4397('0x2b')][_0x4397('0x2c')]);_0x102da9['query']=_[_0x4397('0x30')](_0x20dbd4[_0x4397('0x33')]);_0x102da9[_0x4397('0x31')]=_['intersection'](_0x102da9[_0x4397('0x2f')],_0x102da9[_0x4397('0x33')]);_0x4f45a3[_0x4397('0x34')]=_[_0x4397('0x32')](_0x102da9[_0x4397('0x2f')],qs[_0x4397('0x35')](_0x20dbd4[_0x4397('0x33')]['fields']));_0x4f45a3[_0x4397('0x34')]=_0x4f45a3[_0x4397('0x34')][_0x4397('0x36')]?_0x4f45a3['attributes']:_0x102da9[_0x4397('0x2f')];if(_0x20dbd4[_0x4397('0x33')][_0x4397('0x47')]){_0x4f45a3[_0x4397('0x41')]=[{'all':!![]}];}_0x4f45a3=_[_0x4397('0x48')]({},_0x4f45a3,_0x20dbd4[_0x4397('0x40')]);return db[_0x4397('0x2b')][_0x4397('0x49')](_0x4f45a3)[_0x4397('0x24')](handleEntityNotFound(_0x469f2b,null))[_0x4397('0x24')](respondWithResult(_0x469f2b,null))['catch'](handleError(_0x469f2b,null));};exports['create']=function(_0x34dbe8,_0x14f430){return db[_0x4397('0x2b')][_0x4397('0x4a')](_0x34dbe8[_0x4397('0x4b')],{})[_0x4397('0x24')](respondWithResult(_0x14f430,0xc9))['catch'](handleError(_0x14f430,null));};exports[_0x4397('0x23')]=function(_0x2dc479,_0x5d095a){if(_0x2dc479['body']['id']){delete _0x2dc479[_0x4397('0x4b')]['id'];}return db[_0x4397('0x2b')][_0x4397('0x49')]({'where':{'id':_0x2dc479['params']['id']}})[_0x4397('0x24')](handleEntityNotFound(_0x5d095a,null))[_0x4397('0x24')](saveUpdates(_0x2dc479['body'],null))[_0x4397('0x24')](respondWithResult(_0x5d095a,null))['catch'](handleError(_0x5d095a,null));};exports[_0x4397('0x25')]=function(_0x4ad473,_0x33e2d7){return db[_0x4397('0x2b')][_0x4397('0x49')]({'where':{'id':_0x4ad473[_0x4397('0x46')]['id']}})[_0x4397('0x24')](handleEntityNotFound(_0x33e2d7,null))[_0x4397('0x24')](removeEntity(_0x33e2d7,null))['catch'](handleError(_0x33e2d7,null));};exports[_0x4397('0x4c')]=function(_0x402239,_0x5b675c){return db[_0x4397('0x2b')][_0x4397('0x4c')]()['then'](respondWithResult(_0x5b675c,null))[_0x4397('0x44')](handleError(_0x5b675c,null));}; \ No newline at end of file +var _0x16a6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2d8428,_0x505867){var _0x4fe776=function(_0x52e9d0){while(--_0x52e9d0){_0x2d8428['push'](_0x2d8428['shift']());}};_0x4fe776(++_0x505867);}(_0x16a6,0x15c));var _0x616a=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x16a6[_0x4bc428];return _0x3ca37f;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616a('0x2'));var rp=require(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var Mustache=require(_0x616a('0x6'));var util=require(_0x616a('0x7'));var path=require('path');var sox=require(_0x616a('0x8'));var csv=require(_0x616a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616a('0xa'));var squel=require(_0x616a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x616a('0xd'));var Papa=require('papaparse');var Redis=require(_0x616a('0xe'));var authService=require(_0x616a('0xf'));var qs=require(_0x616a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616a('0x11'));var logger=require(_0x616a('0x12'))(_0x616a('0x13'));var utils=require(_0x616a('0x14'));var config=require(_0x616a('0x15'));var licenseUtil=require(_0x616a('0x16'));var db=require(_0x616a('0x17'))['db'];function respondWithStatusCode(_0x4122b7,_0x5755c7){_0x5755c7=_0x5755c7||0xcc;return function(_0x318dfe){if(_0x318dfe){return _0x4122b7[_0x616a('0x18')](_0x5755c7);}return _0x4122b7[_0x616a('0x19')](_0x5755c7)[_0x616a('0x1a')]();};}function respondWithResult(_0x295fc2,_0x4a33d5){_0x4a33d5=_0x4a33d5||0xc8;return function(_0x1399c1){if(_0x1399c1){return _0x295fc2[_0x616a('0x19')](_0x4a33d5)[_0x616a('0x1b')](_0x1399c1);}};}function respondWithFilteredResult(_0x18b6dc,_0x3bcf20){return function(_0x53f228){if(_0x53f228){var _0x204e68=typeof _0x3bcf20[_0x616a('0x1c')]==='undefined'&&typeof _0x3bcf20['limit']===_0x616a('0x1d');var _0x4768b2=_0x53f228[_0x616a('0x1e')];var _0x4d59e7=_0x204e68?0x0:_0x3bcf20[_0x616a('0x1c')];var _0x1f3241=_0x204e68?_0x53f228['count']:_0x3bcf20['offset']+_0x3bcf20[_0x616a('0x1f')];var _0x27e95c;if(_0x1f3241>=_0x4768b2){_0x1f3241=_0x4768b2;_0x27e95c=0xc8;}else{_0x27e95c=0xce;}_0x18b6dc[_0x616a('0x19')](_0x27e95c);return _0x18b6dc[_0x616a('0x20')]('Content-Range',_0x4d59e7+'-'+_0x1f3241+'/'+_0x4768b2)['json'](_0x53f228);}return null;};}function patchUpdates(_0x5568fd){return function(_0x5f2e80){try{jsonpatch['apply'](_0x5f2e80,_0x5568fd,!![]);}catch(_0x5ee3f2){return BPromise[_0x616a('0x21')](_0x5ee3f2);}return _0x5f2e80['save']();};}function saveUpdates(_0xb8ceeb,_0x137974){return function(_0x4f5594){if(_0x4f5594){return _0x4f5594[_0x616a('0x22')](_0xb8ceeb)[_0x616a('0x23')](function(_0x3d484b){return _0x3d484b;});}return null;};}function removeEntity(_0x100c98,_0x500c22){return function(_0x2db2bb){if(_0x2db2bb){return _0x2db2bb[_0x616a('0x24')]()[_0x616a('0x23')](function(){_0x100c98[_0x616a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e11f2,_0x4be8a8){return function(_0x30c1a){if(!_0x30c1a){_0x3e11f2[_0x616a('0x18')](0x194);}return _0x30c1a;};}function handleError(_0x5f1e6a,_0x55abc8){_0x55abc8=_0x55abc8||0x1f4;return function(_0x50c6b8){logger[_0x616a('0x25')](_0x50c6b8[_0x616a('0x26')]);if(_0x50c6b8[_0x616a('0x27')]){delete _0x50c6b8[_0x616a('0x27')];}_0x5f1e6a['status'](_0x55abc8)[_0x616a('0x28')](_0x50c6b8);};}exports[_0x616a('0x29')]=function(_0x195b73,_0x163fd0){var _0x28ca50={},_0x87db00={},_0x41a22d={'count':0x0,'rows':[]};var _0x5f3a59=_[_0x616a('0x2a')](db[_0x616a('0x2b')]['rawAttributes'],function(_0x41f722){return{'name':_0x41f722['fieldName'],'type':_0x41f722['type'][_0x616a('0x2c')]};});_0x87db00[_0x616a('0x2d')]=_[_0x616a('0x2a')](_0x5f3a59,'name');_0x87db00[_0x616a('0x2e')]=_[_0x616a('0x2f')](_0x195b73[_0x616a('0x2e')]);_0x87db00[_0x616a('0x30')]=_[_0x616a('0x31')](_0x87db00[_0x616a('0x2d')],_0x87db00['query']);_0x28ca50[_0x616a('0x32')]=_['intersection'](_0x87db00[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x195b73[_0x616a('0x2e')]['fields']));_0x28ca50[_0x616a('0x32')]=_0x28ca50[_0x616a('0x32')]['length']?_0x28ca50['attributes']:_0x87db00[_0x616a('0x2d')];if(!_0x195b73[_0x616a('0x2e')][_0x616a('0x34')](_0x616a('0x35'))){_0x28ca50['limit']=qs['limit'](_0x195b73['query'][_0x616a('0x1f')]);_0x28ca50[_0x616a('0x1c')]=qs[_0x616a('0x1c')](_0x195b73[_0x616a('0x2e')][_0x616a('0x1c')]);}_0x28ca50[_0x616a('0x36')]=qs[_0x616a('0x37')](_0x195b73[_0x616a('0x2e')][_0x616a('0x37')]);_0x28ca50[_0x616a('0x38')]=qs['filters'](_[_0x616a('0x39')](_0x195b73['query'],_0x87db00[_0x616a('0x30')]),_0x5f3a59);if(_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]){_0x28ca50[_0x616a('0x38')]=_[_0x616a('0x3b')](_0x28ca50[_0x616a('0x38')],{'$or':_[_0x616a('0x2a')](_0x5f3a59,function(_0x220c32){if(_0x220c32[_0x616a('0x3c')]!=='VIRTUAL'){var _0x304e27={};_0x304e27[_0x220c32[_0x616a('0x27')]]={'$like':'%'+_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]+'%'};return _0x304e27;}})});}_0x28ca50=_['merge']({},_0x28ca50,_0x195b73[_0x616a('0x3d')]);var _0x4c6a76={'where':_0x28ca50[_0x616a('0x38')]};return db['ChatQueueReport'][_0x616a('0x1e')](_0x4c6a76)[_0x616a('0x23')](function(_0x598085){_0x41a22d[_0x616a('0x1e')]=_0x598085;if(_0x195b73['query'][_0x616a('0x3e')]){_0x28ca50[_0x616a('0x3f')]=[{'all':!![]}];}return db[_0x616a('0x2b')][_0x616a('0x40')](_0x28ca50);})[_0x616a('0x23')](function(_0x21fd2b){_0x41a22d[_0x616a('0x41')]=_0x21fd2b;return _0x41a22d;})['then'](respondWithFilteredResult(_0x163fd0,_0x28ca50))[_0x616a('0x42')](handleError(_0x163fd0,null));};exports['show']=function(_0x409689,_0x35e3e3){var _0x199140={'raw':!![],'where':{'id':_0x409689[_0x616a('0x43')]['id']}},_0x4dbb8b={};_0x4dbb8b[_0x616a('0x2d')]=_[_0x616a('0x2f')](db[_0x616a('0x2b')][_0x616a('0x44')]);_0x4dbb8b['query']=_[_0x616a('0x2f')](_0x409689[_0x616a('0x2e')]);_0x4dbb8b[_0x616a('0x30')]=_['intersection'](_0x4dbb8b[_0x616a('0x2d')],_0x4dbb8b[_0x616a('0x2e')]);_0x199140[_0x616a('0x32')]=_[_0x616a('0x31')](_0x4dbb8b[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x409689[_0x616a('0x2e')]['fields']));_0x199140[_0x616a('0x32')]=_0x199140[_0x616a('0x32')]['length']?_0x199140['attributes']:_0x4dbb8b[_0x616a('0x2d')];if(_0x409689[_0x616a('0x2e')][_0x616a('0x3e')]){_0x199140[_0x616a('0x3f')]=[{'all':!![]}];}_0x199140=_[_0x616a('0x3b')]({},_0x199140,_0x409689[_0x616a('0x3d')]);return db['ChatQueueReport'][_0x616a('0x45')](_0x199140)[_0x616a('0x23')](handleEntityNotFound(_0x35e3e3,null))[_0x616a('0x23')](respondWithResult(_0x35e3e3,null))['catch'](handleError(_0x35e3e3,null));};exports[_0x616a('0x46')]=function(_0x507efa,_0x52d38){return db[_0x616a('0x2b')][_0x616a('0x46')](_0x507efa[_0x616a('0x47')],{})['then'](respondWithResult(_0x52d38,0xc9))[_0x616a('0x42')](handleError(_0x52d38,null));};exports[_0x616a('0x22')]=function(_0x3bea90,_0x3d42fc){if(_0x3bea90[_0x616a('0x47')]['id']){delete _0x3bea90['body']['id'];}return db[_0x616a('0x2b')][_0x616a('0x45')]({'where':{'id':_0x3bea90[_0x616a('0x43')]['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x3d42fc,null))[_0x616a('0x23')](saveUpdates(_0x3bea90[_0x616a('0x47')],null))['then'](respondWithResult(_0x3d42fc,null))[_0x616a('0x42')](handleError(_0x3d42fc,null));};exports[_0x616a('0x24')]=function(_0x349cd0,_0x16e6c2){return db['ChatQueueReport'][_0x616a('0x45')]({'where':{'id':_0x349cd0['params']['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x16e6c2,null))[_0x616a('0x23')](removeEntity(_0x16e6c2,null))['catch'](handleError(_0x16e6c2,null));};exports[_0x616a('0x48')]=function(_0x1ea086,_0x30a48e){return db['ChatQueueReport'][_0x616a('0x48')]()[_0x616a('0x23')](respondWithResult(_0x30a48e,null))[_0x616a('0x42')](handleError(_0x30a48e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c80d363..fcef776 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2f1697,_0x3643c0){var _0x40eff0=function(_0x380c6c){while(--_0x380c6c){_0x2f1697['push'](_0x2f1697['shift']());}};_0x40eff0(++_0x3643c0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xcb91[_0x35da42];return _0x370035;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5f26a6,_0x372d7e){var _0x19ce1a=function(_0x223c4b){while(--_0x223c4b){_0x5f26a6['push'](_0x5f26a6['shift']());}};_0x19ce1a(++_0x372d7e);}(_0x757a,0xde));var _0xa757=function(_0xaa9a91,_0x1469d0){_0xaa9a91=_0xaa9a91-0x0;var _0x1d5402=_0x757a[_0xaa9a91];return _0x1d5402;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 804fa8c..4f69e47 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 _0x49ef=['stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','info','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x4754b6,_0x1c8818){var _0x4726d2=function(_0x361c00){while(--_0x361c00){_0x4754b6['push'](_0x4754b6['shift']());}};_0x4726d2(++_0x1c8818);}(_0x49ef,0x74));var _0xf49e=function(_0x24ada5,_0x5bc7ee){_0x24ada5=_0x24ada5-0x0;var _0x1c54bc=_0x49ef[_0x24ada5];return _0x1c54bc;};'use strict';var _=require(_0xf49e('0x0'));var util=require('util');var moment=require(_0xf49e('0x1'));var BPromise=require(_0xf49e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf49e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf49e('0x4'));var logger=require(_0xf49e('0x5'))(_0xf49e('0x6'));var config=require(_0xf49e('0x7'));var jayson=require(_0xf49e('0x8'));var client=jayson[_0xf49e('0x9')][_0xf49e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c79bb,_0x3156f7,_0x5bdaa5){return new BPromise(function(_0x4d4377,_0x1ff9c0){return client['request'](_0x4c79bb,_0x5bdaa5)[_0xf49e('0xb')](function(_0x35142b){logger['info'](_0xf49e('0xc'),_0x3156f7,_0xf49e('0xd'));logger[_0xf49e('0xe')](_0xf49e('0xf'),_0x3156f7,_0xf49e('0xd'),JSON[_0xf49e('0x10')](_0x35142b));if(_0x35142b[_0xf49e('0x11')]){if(_0x35142b[_0xf49e('0x11')]['code']===0x1f4){logger['error'](_0xf49e('0xc'),_0x3156f7,_0x35142b[_0xf49e('0x11')][_0xf49e('0x12')]);return _0x1ff9c0(_0x35142b[_0xf49e('0x11')]['message']);}logger[_0xf49e('0x11')](_0xf49e('0xc'),_0x3156f7,_0x35142b['error'][_0xf49e('0x12')]);return _0x4d4377(_0x35142b[_0xf49e('0x11')][_0xf49e('0x12')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3156f7,'request\x20sent');_0x4d4377(_0x35142b[_0xf49e('0x13')]['message']);}})[_0xf49e('0x14')](function(_0x2f0187){logger['error'](_0xf49e('0xc'),_0x3156f7,_0x2f0187);_0x1ff9c0(_0x2f0187);});});}exports[_0xf49e('0x15')]=function(_0x11524e){var _0x2741aa=this;return new Promise(function(_0x415984,_0x310e59){return db[_0xf49e('0x16')][_0xf49e('0x17')](_0x11524e[_0xf49e('0x18')],{'raw':_0x11524e[_0xf49e('0x19')]?_0x11524e[_0xf49e('0x19')][_0xf49e('0x1a')]===undefined?!![]:![]:!![]})[_0xf49e('0xb')](function(_0x2c5581){logger['info'](_0xf49e('0x15'),_0x11524e);logger[_0xf49e('0xe')]('CreateChatQueueReport',_0x11524e,JSON[_0xf49e('0x10')](_0x2c5581));_0x415984(_0x2c5581);})[_0xf49e('0x14')](function(_0x4cf4a5){logger[_0xf49e('0x11')](_0xf49e('0x15'),_0x4cf4a5[_0xf49e('0x12')],_0x11524e);_0x310e59(_0x2741aa[_0xf49e('0x11')](0x1f4,_0x4cf4a5[_0xf49e('0x12')]));});});};exports[_0xf49e('0x1b')]=function(_0x2c8584){var _0x1b3390=this;return new Promise(function(_0x65326f,_0x2aad31){return db['ChatQueueReport'][_0xf49e('0x1c')](_0x2c8584[_0xf49e('0x18')],{'raw':_0x2c8584[_0xf49e('0x19')]?_0x2c8584['options'][_0xf49e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8584[_0xf49e('0x19')]?_0x2c8584[_0xf49e('0x19')][_0xf49e('0x1d')]||null:null,'attributes':_0x2c8584[_0xf49e('0x19')]?_0x2c8584['options'][_0xf49e('0x1e')]||null:null,'limit':_0x2c8584[_0xf49e('0x19')]?_0x2c8584[_0xf49e('0x19')][_0xf49e('0x1f')]||null:null})['then'](function(_0x47eb68){logger[_0xf49e('0x20')](_0xf49e('0x1b'),_0x2c8584);logger[_0xf49e('0xe')](_0xf49e('0x1b'),_0x2c8584,JSON[_0xf49e('0x10')](_0x47eb68));_0x65326f(_0x47eb68);})[_0xf49e('0x14')](function(_0x18a1b5){logger[_0xf49e('0x11')](_0xf49e('0x1b'),_0x18a1b5[_0xf49e('0x12')],_0x2c8584);_0x2aad31(_0x1b3390[_0xf49e('0x11')](0x1f4,_0x18a1b5['message']));});});}; \ No newline at end of file +var _0x5c33=['code','message','result','catch','CreateChatQueueReport','body','options','ChatQueueReport','update','raw','limit','then','UpdateChatQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4421eb,_0x17b98f){var _0x142c50=function(_0x5ed18b){while(--_0x5ed18b){_0x4421eb['push'](_0x4421eb['shift']());}};_0x142c50(++_0x17b98f);}(_0x5c33,0x199));var _0x35c3=function(_0x135fce,_0x320c7a){_0x135fce=_0x135fce-0x0;var _0x3a8afc=_0x5c33[_0x135fce];return _0x3a8afc;};'use strict';var _=require(_0x35c3('0x0'));var util=require(_0x35c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35c3('0x2'));var fs=require('fs');var Redis=require(_0x35c3('0x3'));var db=require(_0x35c3('0x4'))['db'];var utils=require(_0x35c3('0x5'));var logger=require(_0x35c3('0x6'))(_0x35c3('0x7'));var config=require(_0x35c3('0x8'));var jayson=require(_0x35c3('0x9'));var client=jayson[_0x35c3('0xa')][_0x35c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d474,_0x19a25d,_0x127032){return new BPromise(function(_0x6918fd,_0xf31fb4){return client[_0x35c3('0xc')](_0x15d474,_0x127032)['then'](function(_0x393606){logger[_0x35c3('0xd')](_0x35c3('0xe'),_0x19a25d,_0x35c3('0xf'));logger[_0x35c3('0x10')](_0x35c3('0x11'),_0x19a25d,_0x35c3('0xf'),JSON[_0x35c3('0x12')](_0x393606));if(_0x393606[_0x35c3('0x13')]){if(_0x393606[_0x35c3('0x13')][_0x35c3('0x14')]===0x1f4){logger[_0x35c3('0x13')](_0x35c3('0xe'),_0x19a25d,_0x393606['error']['message']);return _0xf31fb4(_0x393606[_0x35c3('0x13')][_0x35c3('0x15')]);}logger[_0x35c3('0x13')](_0x35c3('0xe'),_0x19a25d,_0x393606[_0x35c3('0x13')]['message']);return _0x6918fd(_0x393606[_0x35c3('0x13')][_0x35c3('0x15')]);}else{logger[_0x35c3('0xd')](_0x35c3('0xe'),_0x19a25d,'request\x20sent');_0x6918fd(_0x393606[_0x35c3('0x16')][_0x35c3('0x15')]);}})[_0x35c3('0x17')](function(_0xd1e1f3){logger[_0x35c3('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x19a25d,_0xd1e1f3);_0xf31fb4(_0xd1e1f3);});});}exports[_0x35c3('0x18')]=function(_0x180b5b){var _0xe1a1c6=this;return new Promise(function(_0x13ef6e,_0x577036){return db['ChatQueueReport']['create'](_0x180b5b[_0x35c3('0x19')],{'raw':_0x180b5b[_0x35c3('0x1a')]?_0x180b5b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28a0ba){logger[_0x35c3('0xd')](_0x35c3('0x18'),_0x180b5b);logger[_0x35c3('0x10')](_0x35c3('0x18'),_0x180b5b,JSON[_0x35c3('0x12')](_0x28a0ba));_0x13ef6e(_0x28a0ba);})[_0x35c3('0x17')](function(_0x7f5297){logger[_0x35c3('0x13')](_0x35c3('0x18'),_0x7f5297[_0x35c3('0x15')],_0x180b5b);_0x577036(_0xe1a1c6[_0x35c3('0x13')](0x1f4,_0x7f5297[_0x35c3('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x290509){var _0xf3ff71=this;return new Promise(function(_0x2ca057,_0x345e33){return db[_0x35c3('0x1b')][_0x35c3('0x1c')](_0x290509[_0x35c3('0x19')],{'raw':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')][_0x35c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')]['where']||null:null,'attributes':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')]['attributes']||null:null,'limit':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')][_0x35c3('0x1e')]||null:null})[_0x35c3('0x1f')](function(_0x44ac3){logger[_0x35c3('0xd')](_0x35c3('0x20'),_0x290509);logger[_0x35c3('0x10')](_0x35c3('0x20'),_0x290509,JSON[_0x35c3('0x12')](_0x44ac3));_0x2ca057(_0x44ac3);})[_0x35c3('0x17')](function(_0x466757){logger['error'](_0x35c3('0x20'),_0x466757[_0x35c3('0x15')],_0x290509);_0x345e33(_0xf3ff71['error'](0x1f4,_0x466757['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 54540cc..2caab63 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 _0xf886=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','post','create','update','delete','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x561146,_0x43d69b){var _0x20318e=function(_0x2f4fe2){while(--_0x2f4fe2){_0x561146['push'](_0x561146['shift']());}};_0x20318e(++_0x43d69b);}(_0xf886,0x11b));var _0x6f88=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0xf886[_0x4ac60a];return _0x4b22e8;};'use strict';var multer=require(_0x6f88('0x0'));var util=require(_0x6f88('0x1'));var path=require(_0x6f88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f88('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f88('0x4'));var interaction=require(_0x6f88('0x5'));var config=require(_0x6f88('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x6f88('0x7')](),controller['index']);router[_0x6f88('0x8')](_0x6f88('0x9'),auth['isAuthenticated'](),controller[_0x6f88('0xa')]);router[_0x6f88('0x8')]('/:id',auth[_0x6f88('0x7')](),controller['show']);router[_0x6f88('0xb')]('/',auth[_0x6f88('0x7')](),controller[_0x6f88('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6f88('0xd')]);router[_0x6f88('0xe')](_0x6f88('0xf'),auth[_0x6f88('0x7')](),controller[_0x6f88('0x10')]);module[_0x6f88('0x11')]=router; \ No newline at end of file +var _0x4028=['/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x47450d,_0x532512){var _0x3a0212=function(_0xe57f16){while(--_0xe57f16){_0x47450d['push'](_0x47450d['shift']());}};_0x3a0212(++_0x532512);}(_0x4028,0x75));var _0x8402=function(_0x332e78,_0x4ef6fc){_0x332e78=_0x332e78-0x0;var _0x507e27=_0x4028[_0x332e78];return _0x507e27;};'use strict';var multer=require('multer');var util=require(_0x8402('0x0'));var path=require(_0x8402('0x1'));var timeout=require(_0x8402('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8402('0x3'));var auth=require(_0x8402('0x4'));var interaction=require(_0x8402('0x5'));var config=require(_0x8402('0x6'));var controller=require('./chatQueueReport.controller');router[_0x8402('0x7')]('/',auth[_0x8402('0x8')](),controller['index']);router[_0x8402('0x7')](_0x8402('0x9'),auth[_0x8402('0x8')](),controller[_0x8402('0xa')]);router[_0x8402('0x7')](_0x8402('0xb'),auth[_0x8402('0x8')](),controller[_0x8402('0xc')]);router[_0x8402('0xd')]('/',auth[_0x8402('0x8')](),controller[_0x8402('0xe')]);router['put']('/:id',auth[_0x8402('0x8')](),controller[_0x8402('0xf')]);router['delete'](_0x8402('0xb'),auth['isAuthenticated'](),controller[_0x8402('0x10')]);module[_0x8402('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ce7db5a..f399fd0 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x50854a,_0x115342){var _0x322816=function(_0x16a120){while(--_0x16a120){_0x50854a['push'](_0x50854a['shift']());}};_0x322816(++_0x115342);}(_0xedd9,0xfc));var _0x9edd=function(_0x1fbf9d,_0xe1bfb8){_0x1fbf9d=_0x1fbf9d-0x0;var _0x5174c9=_0xedd9[_0x1fbf9d];return _0x5174c9;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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 363d5d6..4d4d703 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 _0x8455=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','save','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','key','model','keys','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','update','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8455,0x82));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5845('0x0'));var rimraf=require(_0x5845('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5845('0x2'));var moment=require('moment');var BPromise=require(_0x5845('0x3'));var Mustache=require(_0x5845('0x4'));var util=require(_0x5845('0x5'));var path=require(_0x5845('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5845('0x7'));var fs=require('fs');var fs_extra=require(_0x5845('0x8'));var _=require(_0x5845('0x9'));var squel=require(_0x5845('0xa'));var crypto=require(_0x5845('0xb'));var jsforce=require(_0x5845('0xc'));var deskjs=require(_0x5845('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5845('0xe'));var Papa=require('papaparse');var Redis=require(_0x5845('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5845('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5845('0x11'));var logger=require(_0x5845('0x12'))('api');var utils=require(_0x5845('0x13'));var config=require(_0x5845('0x14'));var licenseUtil=require(_0x5845('0x15'));var db=require(_0x5845('0x16'))['db'];function respondWithStatusCode(_0x45329e,_0x24ad43){_0x24ad43=_0x24ad43||0xcc;return function(_0x203142){if(_0x203142){return _0x45329e[_0x5845('0x17')](_0x24ad43);}return _0x45329e[_0x5845('0x18')](_0x24ad43)[_0x5845('0x19')]();};}function respondWithResult(_0x248bb8,_0x4c0ac){_0x4c0ac=_0x4c0ac||0xc8;return function(_0x59dfa1){if(_0x59dfa1){return _0x248bb8[_0x5845('0x18')](_0x4c0ac)['json'](_0x59dfa1);}};}function respondWithFilteredResult(_0x27bc21,_0xbe7692){return function(_0x386f46){if(_0x386f46){var _0x59b3dc=typeof _0xbe7692['offset']==='undefined'&&typeof _0xbe7692[_0x5845('0x1a')]===_0x5845('0x1b');var _0x3aad4b=_0x386f46[_0x5845('0x1c')];var _0x5cc99c=_0x59b3dc?0x0:_0xbe7692[_0x5845('0x1d')];var _0x5471b7=_0x59b3dc?_0x386f46[_0x5845('0x1c')]:_0xbe7692['offset']+_0xbe7692[_0x5845('0x1a')];var _0x13da25;if(_0x5471b7>=_0x3aad4b){_0x5471b7=_0x3aad4b;_0x13da25=0xc8;}else{_0x13da25=0xce;}_0x27bc21[_0x5845('0x18')](_0x13da25);return _0x27bc21[_0x5845('0x1e')]('Content-Range',_0x5cc99c+'-'+_0x5471b7+'/'+_0x3aad4b)[_0x5845('0x1f')](_0x386f46);}return null;};}function patchUpdates(_0x3babfd){return function(_0x48b9d3){try{jsonpatch[_0x5845('0x20')](_0x48b9d3,_0x3babfd,!![]);}catch(_0x55e138){return BPromise['reject'](_0x55e138);}return _0x48b9d3[_0x5845('0x21')]();};}function saveUpdates(_0x57c3e6,_0x25df2c){return function(_0x9dbf00){if(_0x9dbf00){return _0x9dbf00['update'](_0x57c3e6)[_0x5845('0x22')](function(_0x29586){return _0x29586;});}return null;};}function removeEntity(_0x4d9ee3,_0x43032f){return function(_0x6f5cfa){if(_0x6f5cfa){return _0x6f5cfa[_0x5845('0x23')]()[_0x5845('0x22')](function(){_0x4d9ee3[_0x5845('0x18')](0xcc)[_0x5845('0x19')]();});}};}function handleEntityNotFound(_0xfa20e3,_0x52e0fc){return function(_0x3de12f){if(!_0x3de12f){_0xfa20e3['sendStatus'](0x194);}return _0x3de12f;};}function handleError(_0x46888e,_0x31d51a){_0x31d51a=_0x31d51a||0x1f4;return function(_0x400118){logger[_0x5845('0x24')](_0x400118[_0x5845('0x25')]);if(_0x400118[_0x5845('0x26')]){delete _0x400118[_0x5845('0x26')];}_0x46888e[_0x5845('0x18')](_0x31d51a)[_0x5845('0x27')](_0x400118);};}exports[_0x5845('0x28')]=function(_0x4907f1,_0x4fbfdd){var _0x3df765={},_0x559d59={},_0x23ba6e={'count':0x0,'rows':[]};var _0x143cf7=_[_0x5845('0x29')](db[_0x5845('0x2a')][_0x5845('0x2b')],function(_0x3b69a3){return{'name':_0x3b69a3['fieldName'],'type':_0x3b69a3['type'][_0x5845('0x2c')]};});_0x559d59[_0x5845('0x2d')]=_[_0x5845('0x29')](_0x143cf7,_0x5845('0x26'));_0x559d59['query']=_[_0x5845('0x2e')](_0x4907f1['query']);_0x559d59['filters']=_['intersection'](_0x559d59[_0x5845('0x2d')],_0x559d59['query']);_0x3df765[_0x5845('0x2f')]=_[_0x5845('0x30')](_0x559d59[_0x5845('0x2d')],qs[_0x5845('0x31')](_0x4907f1[_0x5845('0x32')][_0x5845('0x31')]));_0x3df765[_0x5845('0x2f')]=_0x3df765[_0x5845('0x2f')]['length']?_0x3df765[_0x5845('0x2f')]:_0x559d59[_0x5845('0x2d')];if(!_0x4907f1[_0x5845('0x32')][_0x5845('0x33')](_0x5845('0x34'))){_0x3df765[_0x5845('0x1a')]=qs['limit'](_0x4907f1[_0x5845('0x32')][_0x5845('0x1a')]);_0x3df765[_0x5845('0x1d')]=qs[_0x5845('0x1d')](_0x4907f1['query']['offset']);}_0x3df765[_0x5845('0x35')]=qs[_0x5845('0x36')](_0x4907f1[_0x5845('0x32')][_0x5845('0x36')]);_0x3df765[_0x5845('0x37')]=qs[_0x5845('0x38')](_[_0x5845('0x39')](_0x4907f1[_0x5845('0x32')],_0x559d59[_0x5845('0x38')]),_0x143cf7);if(_0x4907f1[_0x5845('0x32')][_0x5845('0x3a')]){_0x3df765['where']=_[_0x5845('0x3b')](_0x3df765[_0x5845('0x37')],{'$or':_[_0x5845('0x29')](_0x143cf7,function(_0x33ebed){if(_0x33ebed[_0x5845('0x3c')]!=='VIRTUAL'){var _0x38e2c6={};_0x38e2c6[_0x33ebed[_0x5845('0x26')]]={'$like':'%'+_0x4907f1[_0x5845('0x32')]['filter']+'%'};return _0x38e2c6;}})});}_0x3df765=_[_0x5845('0x3b')]({},_0x3df765,_0x4907f1['options']);var _0x2b9624={'where':_0x3df765[_0x5845('0x37')]};return db[_0x5845('0x2a')][_0x5845('0x1c')](_0x2b9624)[_0x5845('0x22')](function(_0x6a3e5a){_0x23ba6e[_0x5845('0x1c')]=_0x6a3e5a;if(_0x4907f1['query'][_0x5845('0x3d')]){_0x3df765[_0x5845('0x3e')]=[{'all':!![]}];}return db[_0x5845('0x2a')][_0x5845('0x3f')](_0x3df765);})[_0x5845('0x22')](function(_0x170203){_0x23ba6e[_0x5845('0x40')]=_0x170203;return _0x23ba6e;})[_0x5845('0x22')](respondWithFilteredResult(_0x4fbfdd,_0x3df765))[_0x5845('0x41')](handleError(_0x4fbfdd,null));};exports[_0x5845('0x42')]=function(_0x31e027,_0x49b3a5){var _0x227118={'raw':!![],'where':{'id':_0x31e027[_0x5845('0x43')]['id']}},_0x2f467f={};_0x2f467f['model']=_['keys'](db[_0x5845('0x2a')]['rawAttributes']);_0x2f467f[_0x5845('0x32')]=_[_0x5845('0x2e')](_0x31e027['query']);_0x2f467f[_0x5845('0x38')]=_[_0x5845('0x30')](_0x2f467f[_0x5845('0x2d')],_0x2f467f['query']);_0x227118[_0x5845('0x2f')]=_[_0x5845('0x30')](_0x2f467f[_0x5845('0x2d')],qs[_0x5845('0x31')](_0x31e027['query'][_0x5845('0x31')]));_0x227118[_0x5845('0x2f')]=_0x227118[_0x5845('0x2f')][_0x5845('0x44')]?_0x227118[_0x5845('0x2f')]:_0x2f467f[_0x5845('0x2d')];if(_0x31e027[_0x5845('0x32')][_0x5845('0x3d')]){_0x227118[_0x5845('0x3e')]=[{'all':!![]}];}_0x227118=_[_0x5845('0x3b')]({},_0x227118,_0x31e027[_0x5845('0x45')]);return db[_0x5845('0x2a')]['find'](_0x227118)['then'](handleEntityNotFound(_0x49b3a5,null))['then'](respondWithResult(_0x49b3a5,null))['catch'](handleError(_0x49b3a5,null));};exports[_0x5845('0x46')]=function(_0x5f042c,_0x23ec33){return db[_0x5845('0x2a')]['create'](_0x5f042c[_0x5845('0x47')],{})[_0x5845('0x22')](respondWithResult(_0x23ec33,0xc9))['catch'](handleError(_0x23ec33,null));};exports[_0x5845('0x48')]=function(_0x3a3540,_0x172ae3){if(_0x3a3540[_0x5845('0x47')]['id']){delete _0x3a3540[_0x5845('0x47')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x3a3540['params']['id']}})['then'](handleEntityNotFound(_0x172ae3,null))[_0x5845('0x22')](saveUpdates(_0x3a3540[_0x5845('0x47')],null))['then'](respondWithResult(_0x172ae3,null))[_0x5845('0x41')](handleError(_0x172ae3,null));};exports['destroy']=function(_0x7be155,_0x30db1c){return db[_0x5845('0x2a')]['find']({'where':{'id':_0x7be155[_0x5845('0x43')]['id']}})[_0x5845('0x22')](handleEntityNotFound(_0x30db1c,null))[_0x5845('0x22')](removeEntity(_0x30db1c,null))[_0x5845('0x41')](handleError(_0x30db1c,null));};exports['describe']=function(_0x3fd1ba,_0x8e1a33){return db[_0x5845('0x2a')][_0x5845('0x49')]()[_0x5845('0x22')](respondWithResult(_0x8e1a33,null))['catch'](handleError(_0x8e1a33,null));}; \ No newline at end of file +var _0xc496=['VIRTUAL','include','findAll','catch','show','params','keys','find','body','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x223f23,_0x1a45da){var _0x51a4aa=function(_0x7f97ce){while(--_0x7f97ce){_0x223f23['push'](_0x223f23['shift']());}};_0x51a4aa(++_0x1a45da);}(_0xc496,0xa1));var _0x6c49=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xc496[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c49('0x1'));var rp=require('request-promise');var moment=require(_0x6c49('0x2'));var BPromise=require(_0x6c49('0x3'));var Mustache=require(_0x6c49('0x4'));var util=require(_0x6c49('0x5'));var path=require(_0x6c49('0x6'));var sox=require(_0x6c49('0x7'));var csv=require(_0x6c49('0x8'));var ejs=require(_0x6c49('0x9'));var fs=require('fs');var fs_extra=require(_0x6c49('0xa'));var _=require(_0x6c49('0xb'));var squel=require(_0x6c49('0xc'));var crypto=require(_0x6c49('0xd'));var jsforce=require(_0x6c49('0xe'));var deskjs=require(_0x6c49('0xf'));var toCsv=require(_0x6c49('0x8'));var querystring=require(_0x6c49('0x10'));var Papa=require(_0x6c49('0x11'));var Redis=require(_0x6c49('0x12'));var authService=require(_0x6c49('0x13'));var qs=require(_0x6c49('0x14'));var as=require(_0x6c49('0x15'));var hardwareService=require(_0x6c49('0x16'));var logger=require('../../config/logger')(_0x6c49('0x17'));var utils=require(_0x6c49('0x18'));var config=require(_0x6c49('0x19'));var licenseUtil=require(_0x6c49('0x1a'));var db=require(_0x6c49('0x1b'))['db'];function respondWithStatusCode(_0x3347a2,_0x10f6b1){_0x10f6b1=_0x10f6b1||0xcc;return function(_0x48d4ff){if(_0x48d4ff){return _0x3347a2[_0x6c49('0x1c')](_0x10f6b1);}return _0x3347a2[_0x6c49('0x1d')](_0x10f6b1)[_0x6c49('0x1e')]();};}function respondWithResult(_0x738849,_0x5500ed){_0x5500ed=_0x5500ed||0xc8;return function(_0x2e623c){if(_0x2e623c){return _0x738849[_0x6c49('0x1d')](_0x5500ed)[_0x6c49('0x1f')](_0x2e623c);}};}function respondWithFilteredResult(_0x44591d,_0x420389){return function(_0x69adfd){if(_0x69adfd){var _0xfc7dc6=typeof _0x420389['offset']==='undefined'&&typeof _0x420389['limit']===_0x6c49('0x20');var _0x49544c=_0x69adfd[_0x6c49('0x21')];var _0x3ef499=_0xfc7dc6?0x0:_0x420389[_0x6c49('0x22')];var _0x32c4e2=_0xfc7dc6?_0x69adfd[_0x6c49('0x21')]:_0x420389[_0x6c49('0x22')]+_0x420389[_0x6c49('0x23')];var _0x3997a5;if(_0x32c4e2>=_0x49544c){_0x32c4e2=_0x49544c;_0x3997a5=0xc8;}else{_0x3997a5=0xce;}_0x44591d[_0x6c49('0x1d')](_0x3997a5);return _0x44591d[_0x6c49('0x24')](_0x6c49('0x25'),_0x3ef499+'-'+_0x32c4e2+'/'+_0x49544c)[_0x6c49('0x1f')](_0x69adfd);}return null;};}function patchUpdates(_0x3a0426){return function(_0x2bc36f){try{jsonpatch['apply'](_0x2bc36f,_0x3a0426,!![]);}catch(_0x500a1b){return BPromise[_0x6c49('0x26')](_0x500a1b);}return _0x2bc36f[_0x6c49('0x27')]();};}function saveUpdates(_0x5d38bc,_0x208915){return function(_0x489525){if(_0x489525){return _0x489525[_0x6c49('0x28')](_0x5d38bc)['then'](function(_0x427b6a){return _0x427b6a;});}return null;};}function removeEntity(_0x353178,_0x4d718e){return function(_0x263ca5){if(_0x263ca5){return _0x263ca5[_0x6c49('0x29')]()[_0x6c49('0x2a')](function(){_0x353178[_0x6c49('0x1d')](0xcc)[_0x6c49('0x1e')]();});}};}function handleEntityNotFound(_0x1ca85d,_0x8e7c29){return function(_0x1e98e3){if(!_0x1e98e3){_0x1ca85d[_0x6c49('0x1c')](0x194);}return _0x1e98e3;};}function handleError(_0x36f605,_0x930e80){_0x930e80=_0x930e80||0x1f4;return function(_0x361c44){logger[_0x6c49('0x2b')](_0x361c44[_0x6c49('0x2c')]);if(_0x361c44['name']){delete _0x361c44['name'];}_0x36f605['status'](_0x930e80)[_0x6c49('0x2d')](_0x361c44);};}exports['index']=function(_0x161eb3,_0x20aedc){var _0x5c74dc={},_0xb8b963={},_0x2aa99d={'count':0x0,'rows':[]};var _0x4bb979=_[_0x6c49('0x2e')](db[_0x6c49('0x2f')][_0x6c49('0x30')],function(_0x1f198e){return{'name':_0x1f198e[_0x6c49('0x31')],'type':_0x1f198e[_0x6c49('0x32')][_0x6c49('0x33')]};});_0xb8b963[_0x6c49('0x34')]=_[_0x6c49('0x2e')](_0x4bb979,_0x6c49('0x35'));_0xb8b963[_0x6c49('0x36')]=_['keys'](_0x161eb3[_0x6c49('0x36')]);_0xb8b963[_0x6c49('0x37')]=_['intersection'](_0xb8b963['model'],_0xb8b963[_0x6c49('0x36')]);_0x5c74dc[_0x6c49('0x38')]=_[_0x6c49('0x39')](_0xb8b963['model'],qs[_0x6c49('0x3a')](_0x161eb3['query'][_0x6c49('0x3a')]));_0x5c74dc[_0x6c49('0x38')]=_0x5c74dc[_0x6c49('0x38')][_0x6c49('0x3b')]?_0x5c74dc['attributes']:_0xb8b963[_0x6c49('0x34')];if(!_0x161eb3[_0x6c49('0x36')][_0x6c49('0x3c')](_0x6c49('0x3d'))){_0x5c74dc[_0x6c49('0x23')]=qs[_0x6c49('0x23')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x23')]);_0x5c74dc[_0x6c49('0x22')]=qs[_0x6c49('0x22')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x22')]);}_0x5c74dc[_0x6c49('0x3e')]=qs[_0x6c49('0x3f')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x3f')]);_0x5c74dc[_0x6c49('0x40')]=qs[_0x6c49('0x37')](_[_0x6c49('0x41')](_0x161eb3[_0x6c49('0x36')],_0xb8b963[_0x6c49('0x37')]),_0x4bb979);if(_0x161eb3[_0x6c49('0x36')][_0x6c49('0x42')]){_0x5c74dc[_0x6c49('0x40')]=_['merge'](_0x5c74dc['where'],{'$or':_[_0x6c49('0x2e')](_0x4bb979,function(_0x2e8c34){if(_0x2e8c34['type']!==_0x6c49('0x43')){var _0xca9cac={};_0xca9cac[_0x2e8c34[_0x6c49('0x35')]]={'$like':'%'+_0x161eb3['query'][_0x6c49('0x42')]+'%'};return _0xca9cac;}})});}_0x5c74dc=_['merge']({},_0x5c74dc,_0x161eb3['options']);var _0x579270={'where':_0x5c74dc[_0x6c49('0x40')]};return db[_0x6c49('0x2f')][_0x6c49('0x21')](_0x579270)[_0x6c49('0x2a')](function(_0x778828){_0x2aa99d[_0x6c49('0x21')]=_0x778828;if(_0x161eb3[_0x6c49('0x36')]['includeAll']){_0x5c74dc[_0x6c49('0x44')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x6c49('0x45')](_0x5c74dc);})['then'](function(_0x173eb8){_0x2aa99d['rows']=_0x173eb8;return _0x2aa99d;})[_0x6c49('0x2a')](respondWithFilteredResult(_0x20aedc,_0x5c74dc))[_0x6c49('0x46')](handleError(_0x20aedc,null));};exports[_0x6c49('0x47')]=function(_0x31d5d3,_0x70923a){var _0x36349f={'raw':!![],'where':{'id':_0x31d5d3[_0x6c49('0x48')]['id']}},_0x1b3b48={};_0x1b3b48[_0x6c49('0x34')]=_[_0x6c49('0x49')](db[_0x6c49('0x2f')][_0x6c49('0x30')]);_0x1b3b48[_0x6c49('0x36')]=_['keys'](_0x31d5d3[_0x6c49('0x36')]);_0x1b3b48['filters']=_[_0x6c49('0x39')](_0x1b3b48[_0x6c49('0x34')],_0x1b3b48['query']);_0x36349f[_0x6c49('0x38')]=_[_0x6c49('0x39')](_0x1b3b48[_0x6c49('0x34')],qs['fields'](_0x31d5d3[_0x6c49('0x36')][_0x6c49('0x3a')]));_0x36349f[_0x6c49('0x38')]=_0x36349f['attributes'][_0x6c49('0x3b')]?_0x36349f[_0x6c49('0x38')]:_0x1b3b48['model'];if(_0x31d5d3[_0x6c49('0x36')]['includeAll']){_0x36349f[_0x6c49('0x44')]=[{'all':!![]}];}_0x36349f=_['merge']({},_0x36349f,_0x31d5d3['options']);return db['ChatTransferReport'][_0x6c49('0x4a')](_0x36349f)[_0x6c49('0x2a')](handleEntityNotFound(_0x70923a,null))['then'](respondWithResult(_0x70923a,null))[_0x6c49('0x46')](handleError(_0x70923a,null));};exports['create']=function(_0x28b1c1,_0x1e972e){return db[_0x6c49('0x2f')]['create'](_0x28b1c1[_0x6c49('0x4b')],{})[_0x6c49('0x2a')](respondWithResult(_0x1e972e,0xc9))[_0x6c49('0x46')](handleError(_0x1e972e,null));};exports['update']=function(_0x5d6971,_0x3f0754){if(_0x5d6971[_0x6c49('0x4b')]['id']){delete _0x5d6971[_0x6c49('0x4b')]['id'];}return db[_0x6c49('0x2f')]['find']({'where':{'id':_0x5d6971[_0x6c49('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f0754,null))['then'](saveUpdates(_0x5d6971['body'],null))[_0x6c49('0x2a')](respondWithResult(_0x3f0754,null))['catch'](handleError(_0x3f0754,null));};exports[_0x6c49('0x29')]=function(_0x3e7b90,_0x203831){return db[_0x6c49('0x2f')]['find']({'where':{'id':_0x3e7b90[_0x6c49('0x48')]['id']}})[_0x6c49('0x2a')](handleEntityNotFound(_0x203831,null))[_0x6c49('0x2a')](removeEntity(_0x203831,null))[_0x6c49('0x46')](handleError(_0x203831,null));};exports['describe']=function(_0x13274b,_0x45450d){return db[_0x6c49('0x2f')]['describe']()[_0x6c49('0x2a')](respondWithResult(_0x45450d,null))['catch'](handleError(_0x45450d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9497189..0b92688 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 _0xcc26=['exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes'];(function(_0xf969eb,_0x4c6c2d){var _0x2de570=function(_0x33f8f7){while(--_0x33f8f7){_0xf969eb['push'](_0xf969eb['shift']());}};_0x2de570(++_0x4c6c2d);}(_0xcc26,0x1b6));var _0x6cc2=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xcc26[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x6cc2('0x0'));var util=require(_0x6cc2('0x1'));var logger=require(_0x6cc2('0x2'))(_0x6cc2('0x3'));var moment=require(_0x6cc2('0x4'));var BPromise=require(_0x6cc2('0x5'));var rp=require(_0x6cc2('0x6'));var fs=require('fs');var path=require(_0x6cc2('0x7'));var rimraf=require(_0x6cc2('0x8'));var config=require('../../config/environment');var attributes=require(_0x6cc2('0x9'));module[_0x6cc2('0xa')]=function(_0x524fe7,_0x7acade){return _0x524fe7['define'](_0x6cc2('0xb'),attributes,{'tableName':_0x6cc2('0xc'),'paranoid':![],'indexes':[{'name':_0x6cc2('0xd'),'fields':[_0x6cc2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2722=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x2722,0x1de));var _0x2272=function(_0x5e0923,_0x51b52e){_0x5e0923=_0x5e0923-0x0;var _0x46e644=_0x2722[_0x5e0923];return _0x46e644;};'use strict';var _=require(_0x2272('0x0'));var util=require(_0x2272('0x1'));var logger=require(_0x2272('0x2'))(_0x2272('0x3'));var moment=require(_0x2272('0x4'));var BPromise=require(_0x2272('0x5'));var rp=require(_0x2272('0x6'));var fs=require('fs');var path=require(_0x2272('0x7'));var rimraf=require(_0x2272('0x8'));var config=require(_0x2272('0x9'));var attributes=require(_0x2272('0xa'));module['exports']=function(_0x5b7e9b,_0x40c104){return _0x5b7e9b[_0x2272('0xb')]('ChatTransferReport',attributes,{'tableName':_0x2272('0xc'),'paranoid':![],'indexes':[{'name':_0x2272('0xd'),'fields':[_0x2272('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8c8d030..d2d7a9a 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 _0x691a=['request\x20sent','debug','stringify','error','message','info','result','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ChatTransferReport,\x20%s,\x20%s'];(function(_0x6b6340,_0x6302c4){var _0x3609bf=function(_0x1620a0){while(--_0x1620a0){_0x6b6340['push'](_0x6b6340['shift']());}};_0x3609bf(++_0x6302c4);}(_0x691a,0x127));var _0xa691=function(_0x1e0b34,_0x584715){_0x1e0b34=_0x1e0b34-0x0;var _0x395f97=_0x691a[_0x1e0b34];return _0x395f97;};'use strict';var _=require(_0xa691('0x0'));var util=require('util');var moment=require(_0xa691('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa691('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa691('0x3'));var logger=require(_0xa691('0x4'))('rpc');var config=require(_0xa691('0x5'));var jayson=require(_0xa691('0x6'));var client=jayson[_0xa691('0x7')][_0xa691('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x390964,_0x51e18f,_0x3697ab){return new BPromise(function(_0x583d6c,_0x560a2e){return client['request'](_0x390964,_0x3697ab)[_0xa691('0x9')](function(_0x3f1615){logger['info'](_0xa691('0xa'),_0x51e18f,_0xa691('0xb'));logger[_0xa691('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x51e18f,_0xa691('0xb'),JSON[_0xa691('0xd')](_0x3f1615));if(_0x3f1615[_0xa691('0xe')]){if(_0x3f1615[_0xa691('0xe')]['code']===0x1f4){logger[_0xa691('0xe')](_0xa691('0xa'),_0x51e18f,_0x3f1615['error']['message']);return _0x560a2e(_0x3f1615[_0xa691('0xe')][_0xa691('0xf')]);}logger[_0xa691('0xe')](_0xa691('0xa'),_0x51e18f,_0x3f1615[_0xa691('0xe')][_0xa691('0xf')]);return _0x583d6c(_0x3f1615[_0xa691('0xe')][_0xa691('0xf')]);}else{logger[_0xa691('0x10')](_0xa691('0xa'),_0x51e18f,_0xa691('0xb'));_0x583d6c(_0x3f1615[_0xa691('0x11')][_0xa691('0xf')]);}})['catch'](function(_0x1d6d92){logger[_0xa691('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x51e18f,_0x1d6d92);_0x560a2e(_0x1d6d92);});});} \ No newline at end of file +var _0xb3bc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x49febd,_0x5f24f3){var _0x51b264=function(_0x40a4c4){while(--_0x40a4c4){_0x49febd['push'](_0x49febd['shift']());}};_0x51b264(++_0x5f24f3);}(_0xb3bc,0x1dd));var _0xcb3b=function(_0x3beff5,_0xd10aa2){_0x3beff5=_0x3beff5-0x0;var _0x7fc726=_0xb3bc[_0x3beff5];return _0x7fc726;};'use strict';var _=require('lodash');var util=require(_0xcb3b('0x0'));var moment=require(_0xcb3b('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb3b('0x2'));var fs=require('fs');var Redis=require(_0xcb3b('0x3'));var db=require(_0xcb3b('0x4'))['db'];var utils=require(_0xcb3b('0x5'));var logger=require(_0xcb3b('0x6'))(_0xcb3b('0x7'));var config=require(_0xcb3b('0x8'));var jayson=require(_0xcb3b('0x9'));var client=jayson[_0xcb3b('0xa')][_0xcb3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36fdfa,_0x18857f,_0x3b25b1){return new BPromise(function(_0x50021b,_0x43b310){return client['request'](_0x36fdfa,_0x3b25b1)['then'](function(_0x479227){logger[_0xcb3b('0xc')](_0xcb3b('0xd'),_0x18857f,_0xcb3b('0xe'));logger[_0xcb3b('0xf')](_0xcb3b('0x10'),_0x18857f,_0xcb3b('0xe'),JSON[_0xcb3b('0x11')](_0x479227));if(_0x479227['error']){if(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x13')]===0x1f4){logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x479227[_0xcb3b('0x12')]['message']);return _0x43b310(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x14')]);}logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x479227[_0xcb3b('0x12')]['message']);return _0x50021b(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x14')]);}else{logger[_0xcb3b('0xc')](_0xcb3b('0xd'),_0x18857f,_0xcb3b('0xe'));_0x50021b(_0x479227[_0xcb3b('0x15')][_0xcb3b('0x14')]);}})[_0xcb3b('0x16')](function(_0x1b1fc8){logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x1b1fc8);_0x43b310(_0x1b1fc8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 25baaf2..4bbf2e9 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 _0x5771=['index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x8ae771,_0x4bc486){var _0x38ba63=function(_0x68029a){while(--_0x68029a){_0x8ae771['push'](_0x8ae771['shift']());}};_0x38ba63(++_0x4bc486);}(_0x5771,0x185));var _0x1577=function(_0x504da4,_0xfd929a){_0x504da4=_0x504da4-0x0;var _0x44bd31=_0x5771[_0x504da4];return _0x44bd31;};'use strict';var multer=require(_0x1577('0x0'));var util=require(_0x1577('0x1'));var path=require(_0x1577('0x2'));var timeout=require(_0x1577('0x3'));var express=require(_0x1577('0x4'));var router=express[_0x1577('0x5')]();var fs_extra=require(_0x1577('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1577('0x7'));router[_0x1577('0x8')]('/',auth[_0x1577('0x9')](),controller[_0x1577('0xa')]);router[_0x1577('0x8')]('/describe',auth[_0x1577('0x9')](),controller['describe']);router['get'](_0x1577('0xb'),auth[_0x1577('0x9')](),controller[_0x1577('0xc')]);router[_0x1577('0xd')]('/',auth[_0x1577('0x9')](),controller[_0x1577('0xe')]);router['put'](_0x1577('0xb'),auth[_0x1577('0x9')](),controller[_0x1577('0xf')]);router[_0x1577('0x10')](_0x1577('0xb'),auth[_0x1577('0x9')](),controller[_0x1577('0x11')]);module[_0x1577('0x12')]=router; \ No newline at end of file +var _0x21fb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21fb,0xab));var _0xb21f=function(_0x3fefaf,_0x298914){_0x3fefaf=_0x3fefaf-0x0;var _0x31bee8=_0x21fb[_0x3fefaf];return _0x31bee8;};'use strict';var multer=require('multer');var util=require(_0xb21f('0x0'));var path=require(_0xb21f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb21f('0x2'));var router=express[_0xb21f('0x3')]();var fs_extra=require(_0xb21f('0x4'));var auth=require(_0xb21f('0x5'));var interaction=require(_0xb21f('0x6'));var config=require(_0xb21f('0x7'));var controller=require(_0xb21f('0x8'));router[_0xb21f('0x9')]('/',auth[_0xb21f('0xa')](),controller[_0xb21f('0xb')]);router[_0xb21f('0x9')]('/describe',auth[_0xb21f('0xa')](),controller[_0xb21f('0xc')]);router[_0xb21f('0x9')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0xe')]);router[_0xb21f('0xf')]('/',auth[_0xb21f('0xa')](),controller[_0xb21f('0x10')]);router[_0xb21f('0x11')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0x12')]);router[_0xb21f('0x13')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0x14')]);module[_0xb21f('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 28cb248..e3d00b4 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 _0xaa88=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Send','Skip','Feedback','star','thumb','input','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','INTEGER','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xaa88,0x137));var _0x8aa8=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xaa88[_0x1d4449];return _0x4dcde3;};'use strict';var Sequelize=require(_0x8aa8('0x0'));var rs=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'name':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8aa8('0x4')},'description':{'type':Sequelize[_0x8aa8('0x3')]},'mapKey':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'mapKeyOffline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8aa8('0x3')]},'animation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0xb'),'squared'),'defaultValue':_0x8aa8('0xb')},'header_online':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xc')},'offline_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xd')},'download_transcript':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8aa8('0xe')]},'closingQuestion':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x11')},'noteTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x13')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x14')},'conditionAgreement':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x15')},'ratingType':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0x16'),_0x8aa8('0x17')),'defaultValue':_0x8aa8('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x8aa8('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8aa8('0x18'),'props':{'title':_0x8aa8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8aa8('0x1a')](_0x8aa8('0x1b'))?JSON[_0x8aa8('0x1c')](this['getDataValue']('onlineForm')):{};},'set':function(_0x2d1508){return this[_0x8aa8('0x1d')](_0x8aa8('0x1b'),JSON[_0x8aa8('0x1e')](_0x2d1508));}},'offlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':_0x8aa8('0x5')},'variable':null},{'type':_0x8aa8('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x8aa8('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8aa8('0x21'))?JSON[_0x8aa8('0x1c')](this[_0x8aa8('0x1a')](_0x8aa8('0x21'))):{};},'set':function(_0xe07a83){return this['setDataValue'](_0x8aa8('0x21'),JSON[_0x8aa8('0x1e')](_0xe07a83));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8aa8('0x22')]();}},'autoclose':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8aa8('0x3')]},'forwardOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8aa8('0x3')]},'waitingTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x23')},'waitingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return _0x8aa8('0x28');}},'notificationSound':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2c')},'messagesAlignment':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x8aa8('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8aa8('0x2b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8aa8('0x2b')],'comment':_0x8aa8('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8aa8('0x30'),'set':function(_0x3c6115){if(!_0x3c6115)this[_0x8aa8('0x1d')](_0x8aa8('0x31'),null);this[_0x8aa8('0x1d')](_0x8aa8('0x32'),_0x3c6115);}},'vidaooEscalation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8aa8('0x3')]},'vidaooTopic':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x33')},'vidaooNote':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':function(){return _0x8aa8('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8aa8('0xe')]}}; \ No newline at end of file +var _0x9c44=['input','parse','getDataValue','setDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','ENUM','star','thumb','name'];(function(_0x391df0,_0x51b2dc){var _0x30bec6=function(_0x2899b1){while(--_0x2899b1){_0x391df0['push'](_0x391df0['shift']());}};_0x30bec6(++_0x51b2dc);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x49c4('0x0')]={'name':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'unique':_0x49c4('0x2')},'description':{'type':Sequelize[_0x49c4('0x1')]},'mapKey':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x4')},'customerAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x49c4('0x1')]},'animation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x49c4('0x8'),_0x49c4('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xa')},'start_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xc')},'download_transcript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x49c4('0xf')]},'closingQuestion':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x11')},'noteTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'skipMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x13')},'ratingType':{'type':Sequelize[_0x49c4('0x14')](_0x49c4('0x15'),_0x49c4('0x16')),'defaultValue':_0x49c4('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x49c4('0x17'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x49c4('0x18'),'props':{'title':_0x49c4('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')]('onlineForm')):{};},'set':function(_0x207358){return this[_0x49c4('0x1b')](_0x49c4('0x1c'),JSON[_0x49c4('0x1d')](_0x207358));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x49c4('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null},{'type':_0x49c4('0x1e'),'config':{'placeholder':_0x49c4('0x1f')},'props':{'title':'Comments','helpText':_0x49c4('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x49c4('0x1a')](_0x49c4('0x21'))?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')](_0x49c4('0x21'))):{};},'set':function(_0x26ba17){return this[_0x49c4('0x1b')](_0x49c4('0x21'),JSON[_0x49c4('0x1d')](_0x26ba17));}},'token':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x49c4('0x1')]},'forwardOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x49c4('0x1')]},'waitingTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x24')},'skipUnmanaged':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x49c4('0x1')]},'notificationTemplate':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':function(){return _0x49c4('0x26');}},'notificationSound':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x29')},'messagesAlignment':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x49c4('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2c')},'systemAvatar':{'type':Sequelize[_0x49c4('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49c4('0xd')],'comment':_0x49c4('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d2510){if(!_0x2d2510)this[_0x49c4('0x1b')](_0x49c4('0x2e'),null);this[_0x49c4('0x1b')](_0x49c4('0x2f'),_0x2d2510);}},'vidaooEscalation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x49c4('0x1')]},'vidaooTopic':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x30')},'vidaooNote':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return _0x49c4('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x49c4('0x7')],'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 dcf7789..8f67807 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 _0x9491=['params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','existsSync','showCustomerAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','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','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','ChatInteraction','threadId','externalUrl','interaction','contact','messageId','created','autoclose','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','email','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','push','all','some','server/files/chat/iframe.ejs','connection','remoteAddress','referer','render','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x5af89d,_0xa40ecd){var _0x44e390=function(_0x296473){while(--_0x296473){_0x5af89d['push'](_0x5af89d['shift']());}};_0x44e390(++_0xa40ecd);}(_0x9491,0xd5));var _0x1949=function(_0x3653e5,_0x2e2f26){_0x3653e5=_0x3653e5-0x0;var _0x17bf62=_0x9491[_0x3653e5];return _0x17bf62;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x1949('0x0'));var util=require('util');var path=require('path');var ejs=require(_0x1949('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x1949('0x2'));var Redis=require(_0x1949('0x3'));var qs=require(_0x1949('0x4'));var logger=require(_0x1949('0x5'))(_0x1949('0x6'));var config=require('../../config/environment');var db=require(_0x1949('0x7'))['db'];config['redis']=_[_0x1949('0x8')](config[_0x1949('0x9')],{'host':_0x1949('0xa'),'port':0x18eb});var socket=require(_0x1949('0xb'))(new Redis(config[_0x1949('0x9')]));require(_0x1949('0xc'))[_0x1949('0xd')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x1949('0xe')]['http']({'port':0x232c});var client9002=jayson[_0x1949('0xe')][_0x1949('0xf')]({'port':0x232a});var client9003=jayson[_0x1949('0xe')][_0x1949('0xf')]({'port':0x232b});var client9001=jayson[_0x1949('0xe')][_0x1949('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x190c33,_0x35df3f,_0x5a0b7f,_0x199b32){return new BPromise(function(_0x2557b4,_0xa737e4){var _0x4e28bb=_0x199b32||client;return _0x4e28bb['request'](_0x190c33,_0x5a0b7f)[_0x1949('0x10')](function(_0x269284){logger[_0x1949('0x11')](_0x1949('0x12'),_0x35df3f,_0x1949('0x13'));logger['debug'](_0x1949('0x14'),_0x35df3f,'request\x20sent',JSON['stringify'](_0x269284));if(_0x269284[_0x1949('0x15')]){if(_0x269284['error']['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x35df3f,_0x269284[_0x1949('0x15')][_0x1949('0x16')]);return _0xa737e4(_0x269284[_0x1949('0x15')]['message']);}logger[_0x1949('0x15')](_0x1949('0x12'),_0x35df3f,_0x269284[_0x1949('0x15')][_0x1949('0x16')]);return _0x2557b4(_0x269284[_0x1949('0x15')][_0x1949('0x16')]);}else{logger['info'](_0x1949('0x12'),_0x35df3f,'request\x20sent');_0x2557b4(_0x269284[_0x1949('0x17')][_0x1949('0x16')]);}})[_0x1949('0x18')](function(_0x319d8e){logger[_0x1949('0x15')](_0x1949('0x12'),_0x35df3f,_0x319d8e);_0xa737e4(_0x319d8e);});});}function respondWithStatusCode(_0x17ee9d,_0x2d316a){_0x2d316a=_0x2d316a||0xcc;return function(_0x1f8371){if(_0x1f8371){return _0x17ee9d['sendStatus'](_0x2d316a);}return _0x17ee9d[_0x1949('0x19')](_0x2d316a)[_0x1949('0x1a')]();};}function respondWithResult(_0x457db4,_0x5465c6){_0x5465c6=_0x5465c6||0xc8;return function(_0x4a8d28){if(_0x4a8d28){return _0x457db4[_0x1949('0x19')](_0x5465c6)['json'](_0x4a8d28);}};}function respondWithFilteredResult(_0x550dfa,_0x4b2578){return function(_0x431593){if(_0x431593){var _0xfcbad0=typeof _0x4b2578[_0x1949('0x1b')]===_0x1949('0x1c')&&typeof _0x4b2578[_0x1949('0x1d')]===_0x1949('0x1c');var _0x33aa5f=_0x431593['count'];var _0x33f76d=_0xfcbad0?0x0:_0x4b2578[_0x1949('0x1b')];var _0x16154c=_0xfcbad0?_0x431593[_0x1949('0x1e')]:_0x4b2578['offset']+_0x4b2578[_0x1949('0x1d')];var _0x4a4f42;if(_0x16154c>=_0x33aa5f){_0x16154c=_0x33aa5f;_0x4a4f42=0xc8;}else{_0x4a4f42=0xce;}_0x550dfa[_0x1949('0x19')](_0x4a4f42);return _0x550dfa['set'](_0x1949('0x1f'),_0x33f76d+'-'+_0x16154c+'/'+_0x33aa5f)[_0x1949('0x20')](_0x431593);}return null;};}function saveUpdates(_0x35cb98){return function(_0x36a204){if(_0x36a204){return _0x36a204['update'](_0x35cb98)[_0x1949('0x10')](function(_0x28a470){return _0x28a470;});}return null;};}function removeEntity(_0x4dcf00){return function(_0x559dee){if(_0x559dee){return _0x559dee['destroy']()[_0x1949('0x10')](function(){var _0x180179=_0x559dee[_0x1949('0x21')]({'plain':!![]});var _0x560273=_0x1949('0x22');return db[_0x1949('0x23')][_0x1949('0x24')]({'where':{'type':_0x560273,'resourceId':_0x180179['id']}})['then'](function(){return _0x559dee;});})[_0x1949('0x10')](function(){_0x4dcf00[_0x1949('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb596d2){return function(_0x17412b){if(!_0x17412b){_0xb596d2[_0x1949('0x25')](0x194);}return _0x17412b;};}function handleError(_0x282299,_0x450790){_0x450790=_0x450790||0x1f4;return function(_0xe28126){logger[_0x1949('0x15')](_0xe28126[_0x1949('0x26')]);if(_0xe28126['name']){delete _0xe28126[_0x1949('0x27')];}_0x282299[_0x1949('0x19')](_0x450790)[_0x1949('0x28')](_0xe28126);};}exports[_0x1949('0x29')]=function(_0x95bfad,_0x4d4990){var _0x38f1a9={'include':[{'model':db[_0x1949('0x2a')],'as':_0x1949('0x2b')}]},_0x2a91ab={},_0x5a6b42={'count':0x0,'rows':[]};var _0x5ad82c=_['map'](db[_0x1949('0x2c')][_0x1949('0x2d')],function(_0x251b12){return{'name':_0x251b12[_0x1949('0x2e')],'type':_0x251b12[_0x1949('0x2f')]['key']};});_0x2a91ab['model']=_[_0x1949('0x30')](_0x5ad82c,'name');_0x2a91ab[_0x1949('0x31')]=_[_0x1949('0x32')](_0x95bfad[_0x1949('0x31')]);_0x2a91ab[_0x1949('0x33')]=_[_0x1949('0x34')](_0x2a91ab[_0x1949('0x35')],_0x2a91ab[_0x1949('0x31')]);_0x38f1a9[_0x1949('0x36')]=_[_0x1949('0x34')](_0x2a91ab['model'],qs['fields'](_0x95bfad[_0x1949('0x31')]['fields']));_0x38f1a9[_0x1949('0x36')]=_0x38f1a9[_0x1949('0x36')][_0x1949('0x37')]?_0x38f1a9[_0x1949('0x36')]:_0x2a91ab['model'];if(!_0x95bfad['query'][_0x1949('0x38')](_0x1949('0x39'))){_0x38f1a9[_0x1949('0x1d')]=qs['limit'](_0x95bfad['query'][_0x1949('0x1d')]);_0x38f1a9['offset']=qs['offset'](_0x95bfad[_0x1949('0x31')][_0x1949('0x1b')]);}_0x38f1a9[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x95bfad['query'][_0x1949('0x3b')]);_0x38f1a9[_0x1949('0x3c')]=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0x95bfad[_0x1949('0x31')],_0x2a91ab[_0x1949('0x33')]),_0x5ad82c);if(_0x95bfad[_0x1949('0x31')][_0x1949('0x3e')]){_0x38f1a9[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0x38f1a9[_0x1949('0x3c')],{'$or':_[_0x1949('0x30')](_0x5ad82c,function(_0xd21af7){if(_0xd21af7[_0x1949('0x2f')]!=='VIRTUAL'){var _0x2f642c={};_0x2f642c[_0xd21af7['name']]={'$like':'%'+_0x95bfad[_0x1949('0x31')]['filter']+'%'};return _0x2f642c;}})});}_0x38f1a9=_['merge']({},_0x38f1a9,_0x95bfad[_0x1949('0x40')]);var _0x3e8acb={'where':_0x38f1a9['where']};return db['ChatWebsite'][_0x1949('0x1e')](_0x3e8acb)['then'](function(_0x4e856f){_0x5a6b42['count']=_0x4e856f;if(_0x95bfad[_0x1949('0x31')][_0x1949('0x41')]){_0x38f1a9[_0x1949('0x42')]=[{'all':!![]}];}return db[_0x1949('0x2c')]['findAll'](_0x38f1a9);})[_0x1949('0x10')](function(_0x268a8c){_0x5a6b42[_0x1949('0x43')]=_0x268a8c;return _0x5a6b42;})[_0x1949('0x10')](respondWithFilteredResult(_0x4d4990,_0x38f1a9))['catch'](handleError(_0x4d4990,null));};exports[_0x1949('0x44')]=function(_0x594da2,_0x2aca2d){var _0x578336={'raw':![],'where':{'id':_0x594da2['params']['id']},'include':[{'model':db[_0x1949('0x2a')],'as':_0x1949('0x2b')}]},_0x336f1d={};_0x336f1d['model']=_[_0x1949('0x32')](db[_0x1949('0x2c')][_0x1949('0x2d')]);_0x336f1d[_0x1949('0x31')]=_[_0x1949('0x32')](_0x594da2['query']);_0x336f1d[_0x1949('0x33')]=_[_0x1949('0x34')](_0x336f1d[_0x1949('0x35')],_0x336f1d[_0x1949('0x31')]);_0x578336[_0x1949('0x36')]=_[_0x1949('0x34')](_0x336f1d['model'],qs['fields'](_0x594da2[_0x1949('0x31')][_0x1949('0x45')]));_0x578336[_0x1949('0x36')]=_0x578336[_0x1949('0x36')]['length']?_0x578336[_0x1949('0x36')]:_0x336f1d[_0x1949('0x35')];if(_0x594da2[_0x1949('0x31')]['includeAll']){_0x578336[_0x1949('0x42')]=[{'all':!![]}];}_0x578336=_[_0x1949('0x3f')]({},_0x578336,_0x594da2[_0x1949('0x40')]);return db['ChatWebsite'][_0x1949('0x46')](_0x578336)['then'](handleEntityNotFound(_0x2aca2d,null))[_0x1949('0x10')](respondWithResult(_0x2aca2d,null))[_0x1949('0x18')](handleError(_0x2aca2d,null));};exports['create']=function(_0x287827,_0x1e8e36){return db['ChatWebsite'][_0x1949('0x47')](_0x287827[_0x1949('0x48')],{})[_0x1949('0x10')](function(_0x151d0a){var _0x580423=_0x287827['user'][_0x1949('0x21')]({'plain':!![]});if(!_0x580423)throw new Error(_0x1949('0x49'));if(_0x580423['role']===_0x1949('0x4a')){var _0x3a4574=_0x151d0a['get']({'plain':!![]});var _0x112859=_0x1949('0x22');return db[_0x1949('0x4b')][_0x1949('0x46')]({'where':{'name':_0x112859,'userProfileId':_0x580423['userProfileId']},'raw':!![]})['then'](function(_0x1bb4ee){if(_0x1bb4ee&&_0x1bb4ee[_0x1949('0x4c')]===0x0){return db[_0x1949('0x23')]['create']({'name':_0x3a4574[_0x1949('0x27')],'resourceId':_0x3a4574['id'],'type':_0x1bb4ee[_0x1949('0x27')],'sectionId':_0x1bb4ee['id']},{})[_0x1949('0x10')](function(){return _0x151d0a;});}else{return _0x151d0a;}})[_0x1949('0x18')](function(_0x243fd6){logger[_0x1949('0x15')](_0x1949('0x4d'),_0x243fd6);throw _0x243fd6;});}return _0x151d0a;})[_0x1949('0x10')](respondWithResult(_0x1e8e36,0xc9))['catch'](handleError(_0x1e8e36,null));};exports[_0x1949('0x4e')]=function(_0x59c9b2,_0x58e958){if(_0x59c9b2[_0x1949('0x48')]['id']){delete _0x59c9b2[_0x1949('0x48')]['id'];}return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x59c9b2['params']['id']},'include':[{'model':db[_0x1949('0x2a')],'as':_0x1949('0x2b')}]})[_0x1949('0x10')](handleEntityNotFound(_0x58e958,null))[_0x1949('0x10')](saveUpdates(_0x59c9b2[_0x1949('0x48')],null))[_0x1949('0x10')](respondWithResult(_0x58e958,null))['catch'](handleError(_0x58e958,null));};exports[_0x1949('0x24')]=function(_0x3f26f4,_0x500a71){return db['ChatWebsite'][_0x1949('0x46')]({'where':{'id':_0x3f26f4[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x500a71,null))['then'](removeEntity(_0x500a71,null))['catch'](handleError(_0x500a71,null));};exports[_0x1949('0x50')]=function(_0x56017f,_0x46a51c){return db[_0x1949('0x2c')][_0x1949('0x50')]()['then'](respondWithResult(_0x46a51c,null))[_0x1949('0x18')](handleError(_0x46a51c,null));};exports[_0x1949('0x51')]=function(_0x43cdb8,_0x1e63c8){if(_0x43cdb8[_0x1949('0x48')]['id']){delete _0x43cdb8[_0x1949('0x48')]['id'];}return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x43cdb8['params']['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x1e63c8,null))['then'](function(_0x179266){if(_0x179266){_0x43cdb8[_0x1949('0x48')][_0x1949('0x52')]=_0x179266['id'];return db[_0x1949('0x53')][_0x1949('0x47')](_0x43cdb8[_0x1949('0x48')]);}})[_0x1949('0x10')](respondWithResult(_0x1e63c8,null))[_0x1949('0x18')](handleError(_0x1e63c8,null));};exports['getDispositions']=function(_0xdb1ab7,_0x12fc24){var _0x1f5522={'raw':![],'where':{}};var _0x2e71ec={};var _0x591646={'count':0x0,'rows':[]};return db[_0x1949('0x2c')][_0x1949('0x54')]({'where':{'id':_0xdb1ab7[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x12fc24,null))[_0x1949('0x10')](function(_0x52b8a1){if(_0x52b8a1){_0x2e71ec[_0x1949('0x35')]=_[_0x1949('0x32')](db[_0x1949('0x53')]['rawAttributes']);_0x2e71ec[_0x1949('0x31')]=_[_0x1949('0x32')](_0xdb1ab7[_0x1949('0x31')]);_0x2e71ec[_0x1949('0x33')]=_[_0x1949('0x34')](_0x2e71ec[_0x1949('0x35')],_0x2e71ec[_0x1949('0x31')]);_0x1f5522[_0x1949('0x36')]=_['intersection'](_0x2e71ec[_0x1949('0x35')],qs[_0x1949('0x45')](_0xdb1ab7['query'][_0x1949('0x45')]));_0x1f5522['attributes']=_0x1f5522['attributes'][_0x1949('0x37')]?_0x1f5522[_0x1949('0x36')]:_0x2e71ec[_0x1949('0x35')];if(!_0xdb1ab7[_0x1949('0x31')][_0x1949('0x38')](_0x1949('0x39'))){_0x1f5522[_0x1949('0x1d')]=qs[_0x1949('0x1d')](_0xdb1ab7['query'][_0x1949('0x1d')]);_0x1f5522['offset']=qs[_0x1949('0x1b')](_0xdb1ab7['query'][_0x1949('0x1b')]);}_0x1f5522['order']=qs[_0x1949('0x3b')](_0xdb1ab7[_0x1949('0x31')][_0x1949('0x3b')]);_0x1f5522[_0x1949('0x3c')]=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0xdb1ab7['query'],_0x2e71ec[_0x1949('0x33')]));_0x1f5522[_0x1949('0x3c')][_0x1949('0x52')]=_0x52b8a1['id'];if(_0xdb1ab7[_0x1949('0x31')][_0x1949('0x3e')]){_0x1f5522[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0x1f5522[_0x1949('0x3c')],{'$or':_[_0x1949('0x30')](_0x1f5522[_0x1949('0x36')],function(_0x47d796){var _0x48441f={};_0x48441f[_0x47d796]={'$like':'%'+_0xdb1ab7[_0x1949('0x31')][_0x1949('0x3e')]+'%'};return _0x48441f;})});}_0x1f5522=_['merge']({},_0x1f5522,_0xdb1ab7[_0x1949('0x40')]);return db[_0x1949('0x53')][_0x1949('0x1e')]({'where':_0x1f5522['where']})[_0x1949('0x10')](function(_0x1a8235){_0x591646[_0x1949('0x1e')]=_0x1a8235;if(_0xdb1ab7['query']['includeAll']){_0x1f5522[_0x1949('0x42')]=[{'all':!![]}];}return db[_0x1949('0x53')][_0x1949('0x55')](_0x1f5522);})[_0x1949('0x10')](function(_0x539088){_0x591646['rows']=_0x539088;return _0x591646;});}})['then'](respondWithFilteredResult(_0x12fc24,_0x1f5522))[_0x1949('0x18')](handleError(_0x12fc24,null));};exports[_0x1949('0x56')]=function(_0x19095f,_0x5a47d5){return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x19095f[_0x1949('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5a47d5,null))[_0x1949('0x10')](function(_0x16cc8d){if(_0x16cc8d){return _0x16cc8d['removeDispositions'](_0x19095f[_0x1949('0x31')][_0x1949('0x57')]);}})[_0x1949('0x10')](respondWithStatusCode(_0x5a47d5,null))[_0x1949('0x18')](handleError(_0x5a47d5,null));};exports[_0x1949('0x58')]=function(_0xe1215,_0x5c29b7){if(_0xe1215[_0x1949('0x48')]['id']){delete _0xe1215['body']['id'];}return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0xe1215['params']['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x5c29b7,null))[_0x1949('0x10')](function(_0x770180){if(_0x770180){_0xe1215['body'][_0x1949('0x52')]=_0x770180['id'];return db['CannedAnswer'][_0x1949('0x47')](_0xe1215[_0x1949('0x48')]);}})[_0x1949('0x10')](respondWithResult(_0x5c29b7,null))[_0x1949('0x18')](handleError(_0x5c29b7,null));};exports[_0x1949('0x59')]=function(_0x42893c,_0x1d0321){var _0xfbdbd3={'raw':![],'where':{}};var _0x292a1e={};var _0x326d9f={'count':0x0,'rows':[]};return db[_0x1949('0x2c')]['findOne']({'where':{'id':_0x42893c['params']['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x1d0321,null))[_0x1949('0x10')](function(_0x16c2cf){if(_0x16c2cf){_0x292a1e[_0x1949('0x35')]=_[_0x1949('0x32')](db[_0x1949('0x5a')][_0x1949('0x2d')]);_0x292a1e[_0x1949('0x31')]=_[_0x1949('0x32')](_0x42893c['query']);_0x292a1e[_0x1949('0x33')]=_[_0x1949('0x34')](_0x292a1e[_0x1949('0x35')],_0x292a1e[_0x1949('0x31')]);_0xfbdbd3[_0x1949('0x36')]=_[_0x1949('0x34')](_0x292a1e[_0x1949('0x35')],qs[_0x1949('0x45')](_0x42893c[_0x1949('0x31')][_0x1949('0x45')]));_0xfbdbd3[_0x1949('0x36')]=_0xfbdbd3[_0x1949('0x36')][_0x1949('0x37')]?_0xfbdbd3[_0x1949('0x36')]:_0x292a1e[_0x1949('0x35')];if(!_0x42893c[_0x1949('0x31')]['hasOwnProperty'](_0x1949('0x39'))){_0xfbdbd3['limit']=qs[_0x1949('0x1d')](_0x42893c['query']['limit']);_0xfbdbd3[_0x1949('0x1b')]=qs[_0x1949('0x1b')](_0x42893c['query'][_0x1949('0x1b')]);}_0xfbdbd3[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x42893c[_0x1949('0x31')][_0x1949('0x3b')]);_0xfbdbd3[_0x1949('0x3c')]=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0x42893c[_0x1949('0x31')],_0x292a1e[_0x1949('0x33')]));_0xfbdbd3[_0x1949('0x3c')][_0x1949('0x52')]=_0x16c2cf['id'];if(_0x42893c[_0x1949('0x31')][_0x1949('0x3e')]){_0xfbdbd3[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0xfbdbd3[_0x1949('0x3c')],{'$or':_[_0x1949('0x30')](_0xfbdbd3['attributes'],function(_0x59cd9c){var _0x193ca2={};_0x193ca2[_0x59cd9c]={'$like':'%'+_0x42893c[_0x1949('0x31')][_0x1949('0x3e')]+'%'};return _0x193ca2;})});}_0xfbdbd3=_[_0x1949('0x3f')]({},_0xfbdbd3,_0x42893c[_0x1949('0x40')]);return db['CannedAnswer']['count']({'where':_0xfbdbd3[_0x1949('0x3c')]})[_0x1949('0x10')](function(_0x44a466){_0x326d9f[_0x1949('0x1e')]=_0x44a466;if(_0x42893c[_0x1949('0x31')]['includeAll']){_0xfbdbd3['include']=[{'all':!![]}];}return db[_0x1949('0x5a')]['findAll'](_0xfbdbd3);})['then'](function(_0x1af6e8){_0x326d9f['rows']=_0x1af6e8;return _0x326d9f;});}})[_0x1949('0x10')](respondWithFilteredResult(_0x1d0321,_0xfbdbd3))[_0x1949('0x18')](handleError(_0x1d0321,null));};exports[_0x1949('0x5b')]=function(_0x2c88ad,_0x52c99e){return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x2c88ad['params']['id']}})['then'](handleEntityNotFound(_0x52c99e,null))[_0x1949('0x10')](function(_0x129eec){if(_0x129eec){return _0x129eec[_0x1949('0x5b')](_0x2c88ad[_0x1949('0x31')][_0x1949('0x57')]);}})['then'](respondWithStatusCode(_0x52c99e,null))[_0x1949('0x18')](handleError(_0x52c99e,null));};exports[_0x1949('0x5c')]=function(_0xfe5c57,_0x3c1c64){_0xfe5c57[_0x1949('0x48')]['sitepic']=_0xfe5c57[_0x1949('0x5d')][_0x1949('0x5e')];return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0xfe5c57[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x3c1c64,null))['then'](saveUpdates(_0xfe5c57[_0x1949('0x48')],null))[_0x1949('0x10')](respondWithResult(_0x3c1c64,null))[_0x1949('0x18')](handleError(_0x3c1c64,null));};exports[_0x1949('0x5f')]=function(_0x5acb38,_0x4bb999){_0x5acb38['body'][_0x1949('0x60')]=_0x5acb38[_0x1949('0x5d')][_0x1949('0x5e')];return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x5acb38[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x4bb999,null))[_0x1949('0x10')](saveUpdates(_0x5acb38[_0x1949('0x48')],null))['then'](respondWithResult(_0x4bb999,null))['catch'](handleError(_0x4bb999,null));};exports[_0x1949('0x61')]=function(_0x1224bc,_0x57b69b){_0x1224bc[_0x1949('0x48')][_0x1949('0x62')]=_0x1224bc[_0x1949('0x5d')][_0x1949('0x5e')];return db['ChatWebsite'][_0x1949('0x46')]({'where':{'id':_0x1224bc[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x57b69b,null))[_0x1949('0x10')](saveUpdates(_0x1224bc['body'],null))['then'](respondWithResult(_0x57b69b,null))[_0x1949('0x18')](handleError(_0x57b69b,null));};exports[_0x1949('0x63')]=function(_0x255f34,_0xc7806a){_0x255f34[_0x1949('0x48')][_0x1949('0x64')]=_0x255f34[_0x1949('0x5d')]['filename'];return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x255f34['params']['id']}})['then'](handleEntityNotFound(_0xc7806a,null))['then'](saveUpdates(_0x255f34[_0x1949('0x48')],null))['then'](respondWithResult(_0xc7806a,null))[_0x1949('0x18')](handleError(_0xc7806a,null));};exports['getLogo']=function(_0x11ccce,_0x16c006){var _0x14a8e7=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x67'));var _0x5bfd41={'where':{'id':_0x11ccce[_0x1949('0x4f')]['id']},'attributes':['id',_0x1949('0x68')],'raw':!![]};var _0x1d886a=![];return require(_0x1949('0x69'))[_0x1949('0x6a')]()[_0x1949('0x10')](function(_0x27bb7f){if(_0x27bb7f){_0x1d886a=_0x27bb7f[_0x1949('0x6b')];}})[_0x1949('0x10')](function(){return db['ChatWebsite'][_0x1949('0x46')](_0x5bfd41);})[_0x1949('0x10')](handleEntityNotFound(_0x16c006,null))[_0x1949('0x10')](function(_0x48be57){if(_0x48be57){if(!_[_0x1949('0x6c')](_0x48be57[_0x1949('0x68')])){if(fs['existsSync'](path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x6d'),_0x48be57[_0x1949('0x68')]))&&_0x1d886a){_0x14a8e7=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x6d'),_0x48be57[_0x1949('0x68')]);}}return _0x16c006[_0x1949('0x6e')](_0x14a8e7);}})[_0x1949('0x18')](handleError(_0x16c006,null));};exports[_0x1949('0x6f')]=function(_0x6d361a,_0x2a700a){var _0x5225ff=path[_0x1949('0x65')](config['root'],_0x1949('0x70'));var _0x17cdb6={'where':{'id':_0x6d361a[_0x1949('0x4f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x1949('0x2c')]['find'](_0x17cdb6)['then'](handleEntityNotFound(_0x2a700a,null))[_0x1949('0x10')](function(_0x4eec85){if(_0x4eec85){if(!_[_0x1949('0x6c')](_0x4eec85[_0x1949('0x60')])){if(fs['existsSync'](path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x71'),_0x4eec85[_0x1949('0x60')]))){_0x5225ff=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x71'),_0x4eec85[_0x1949('0x60')]);}}return _0x2a700a[_0x1949('0x6e')](_0x5225ff);}})[_0x1949('0x18')](handleError(_0x2a700a,null));};exports['getCustomerAvatar']=function(_0x4421f2,_0x46faa6){var _0x98b533=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x72'));var _0x310d83={'where':{'id':_0x4421f2[_0x1949('0x4f')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x1949('0x46')](_0x310d83)['then'](handleEntityNotFound(_0x46faa6,null))[_0x1949('0x10')](function(_0x2044f9){if(_0x2044f9){if(!_[_0x1949('0x6c')](_0x2044f9[_0x1949('0x62')])){if(fs[_0x1949('0x73')](path[_0x1949('0x65')](config['root'],_0x1949('0x71'),_0x2044f9[_0x1949('0x62')]))&&_0x2044f9[_0x1949('0x74')]){_0x98b533=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x71'),_0x2044f9[_0x1949('0x62')]);}}return _0x46faa6[_0x1949('0x6e')](_0x98b533);}})['catch'](handleError(_0x46faa6,null));};exports['getSystemAvatar']=function(_0x308e63,_0x4afb97){var _0x284499=path[_0x1949('0x65')](config[_0x1949('0x66')],'server/files/images/avatars/system_avatar.png');var _0x6ba0e5={'where':{'id':_0x308e63[_0x1949('0x4f')]['id']},'attributes':['id',_0x1949('0x64')],'raw':!![]};return db[_0x1949('0x2c')][_0x1949('0x46')](_0x6ba0e5)[_0x1949('0x10')](handleEntityNotFound(_0x4afb97,null))['then'](function(_0x1ed7c7){if(_0x1ed7c7){if(!_[_0x1949('0x6c')](_0x1ed7c7[_0x1949('0x64')])){if(fs[_0x1949('0x73')](path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x71'),_0x1ed7c7[_0x1949('0x64')]))){_0x284499=path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x71'),_0x1ed7c7[_0x1949('0x64')]);}}return _0x4afb97[_0x1949('0x6e')](_0x284499);}})['catch'](handleError(_0x4afb97,null));};exports[_0x1949('0x75')]=function(_0x248094,_0x390fa9){var _0x5dd60c=require(_0x1949('0x76'));var _0x2b8ece=new _0x5dd60c();var _0x534353=_0x2b8ece[_0x1949('0x77')](_0x248094[_0x1949('0x78')][_0x1949('0x79')])[_0x1949('0x7a')]();var _0x5894ac={'body':_0x248094[_0x1949('0x48')],'channel':_0x1949('0x7b')};var _0x2070ad=[];var _0x594189=[];var _0xd877ba={};var _0x2d39c8=![];return db[_0x1949('0x7c')][_0x1949('0x50')]()['then'](function(_0x25b28a){if(!_0x25b28a){throw new db[(_0x1949('0x7d'))]['ValidationError'](_0x1949('0x7e'));}_0x2070ad=_[_0x1949('0x7f')](_[_0x1949('0x32')](_0x25b28a),[_0x1949('0x80'),_0x1949('0x81')]);_0x594189=_[_0x1949('0x7f')](_['keys'](_0x25b28a),[_0x1949('0x80'),_0x1949('0x81'),_0x1949('0x82'),'ListId']);if(_0x248094[_0x1949('0x48')]['id']){delete _0x248094[_0x1949('0x48')]['id'];}if(_[_0x1949('0x6c')](_0x248094[_0x1949('0x48')][_0x1949('0x83')])){throw new db[(_0x1949('0x7d'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1949('0x6c')](_0x248094[_0x1949('0x48')][_0x1949('0x48')])||_0x248094['body'][_0x1949('0x48')]===''){throw new db[(_0x1949('0x7d'))][(_0x1949('0x84'))](_0x1949('0x85'));}if(_[_0x1949('0x6c')](_0x248094[_0x1949('0x48')]['mapKey'])){throw new db[(_0x1949('0x7d'))][(_0x1949('0x84'))](_0x1949('0x86')+_0x594189);}if(!_[_0x1949('0x87')](_0x594189,_0x248094[_0x1949('0x48')][_0x1949('0x88')])){throw new db['Sequelize'][(_0x1949('0x84'))](_0x1949('0x89')+_0x594189);}_0xd877ba[_0x248094[_0x1949('0x48')]['mapKey']]=_0x248094['body']['from'];})[_0x1949('0x10')](function(){return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x248094[_0x1949('0x4f')]['id']},'include':[{'model':db[_0x1949('0x8a')],'as':_0x1949('0x8b'),'include':[{'model':db['CmContact'],'as':_0x1949('0x8c'),'where':_0xd877ba,'limit':0x1,'order':[['updatedAt',_0x1949('0x8d')]]}]},{'model':db[_0x1949('0x8e')],'as':_0x1949('0x8f')}]});})[_0x1949('0x10')](handleEntityNotFound(_0x390fa9,null))[_0x1949('0x10')](function(_0x376cff){if(_0x376cff&&_0x376cff[_0x1949('0x8b')]){_0x5894ac[_0x1949('0x90')]=_0x376cff;_0x5894ac[_0x1949('0x91')]=_0x376cff[_0x1949('0x8f')];_0x5894ac[_0x1949('0x92')]=_0x376cff[_0x1949('0x8b')];_0x5894ac[_0x1949('0x91')]=_[_0x1949('0x93')](_0x5894ac[_0x1949('0x91')],[_0x1949('0x94')],['asc']);if(_0x5894ac['account'][_0x1949('0x8f')]){delete _0x5894ac[_0x1949('0x90')][_0x1949('0x8f')];}if(_0x5894ac[_0x1949('0x90')][_0x1949('0x8b')]&&_0x5894ac[_0x1949('0x90')][_0x1949('0x8b')][_0x1949('0x8c')]['length']){return _0x5894ac[_0x1949('0x90')][_0x1949('0x8b')]['Contacts'][0x0];}var _0x1f4027=_[_0x1949('0x8')](_0x248094[_0x1949('0x48')],{'firstName':_0x248094[_0x1949('0x48')][_0x1949('0x83')],'ListId':_0x376cff[_0x1949('0x95')]});_0x1f4027[_0x248094[_0x1949('0x48')]['mapKey']]=_0x248094[_0x1949('0x48')][_0x1949('0x83')];return db[_0x1949('0x7c')][_0x1949('0x47')](_0x1f4027,{'fields':_0x2070ad,'raw':!![]});}})[_0x1949('0x10')](handleEntityNotFound(_0x390fa9,null))[_0x1949('0x10')](function(_0x15c3fc){_0x5894ac['contact']=_0x15c3fc;var _0x8e811=_0x248094['body'][_0x1949('0x96')];if(_0x248094['headers'][_0x1949('0x97')]){_0x8e811=_0x248094[_0x1949('0x78')][_0x1949('0x97')];}else if(_0x248094['headers'][_0x1949('0x98')]){_0x8e811=_[_0x1949('0x99')](_0x248094['headers'][_0x1949('0x98')][_0x1949('0x9a')](','));}if(_0x15c3fc){var _0x4923ee={'ContactId':_0x15c3fc['id'],'ChatWebsiteId':_0x248094[_0x1949('0x4f')]['id'],'from':(_0x15c3fc[_0x1949('0x9b')]||'')+'\x20'+(_0x15c3fc[_0x1949('0x9c')]||''),'customerIp':_0x8e811,'customerPort':_0x248094[_0x1949('0x78')][_0x1949('0x9d')]?_0x248094[_0x1949('0x78')][_0x1949('0x9d')]:null,'referer':_0x248094[_0x1949('0x48')]['referer'],'browserName':_0x534353['browser'][_0x1949('0x27')]&&_0x534353[_0x1949('0x9e')]['version']?util['format'](_0x1949('0x9f'),_0x534353[_0x1949('0x9e')][_0x1949('0x27')],_0x534353[_0x1949('0x9e')][_0x1949('0xa0')]):_0x1949('0xa1'),'browserVersion':_0x534353['browser']['version']||_0x1949('0xa1'),'osName':util[_0x1949('0xa2')](_0x1949('0x9f'),_0x534353['os'][_0x1949('0x27')],_0x534353['os'][_0x1949('0xa0')]),'osVersion':_0x534353['os'][_0x1949('0xa0')],'deviceModel':_0x534353['device'][_0x1949('0x35')]&&_0x534353[_0x1949('0xa3')][_0x1949('0xa4')]?util[_0x1949('0xa2')](_0x1949('0xa5'),_0x534353[_0x1949('0xa3')]['model'],_0x534353[_0x1949('0xa3')][_0x1949('0xa4')],_0x534353[_0x1949('0xa3')][_0x1949('0x2f')]):null,'deviceVendor':_0x534353[_0x1949('0xa3')][_0x1949('0xa4')],'deviceType':_0x534353[_0x1949('0xa3')]['type'],'formData':JSON[_0x1949('0xa6')](_0x248094[_0x1949('0x48')])};var _0x580ba3={'ChatWebsiteId':_0x248094['params']['id'],'closed':![]};if(_0x248094['body']['threadId']){_0x580ba3['threadId']=_0x248094[_0x1949('0x48')]['threadId'];return db[_0x1949('0xa7')]['find']({'where':_0x580ba3})['then'](function(_0x185e94){if(_0x185e94){return[_0x185e94,![]];}_0x4923ee[_0x1949('0xa8')]=_0x248094[_0x1949('0x48')][_0x1949('0xa8')];_0x4923ee[_0x1949('0xa9')]=_0x248094[_0x1949('0x48')][_0x1949('0xa9')];return db[_0x1949('0xa7')][_0x1949('0x47')](_0x4923ee)['then'](function(_0x141205){return[_0x141205,!![]];});});}_0x580ba3['ContactId']=_0x15c3fc['id'];if(_0x248094['body'][_0x1949('0xaa')]&&_0x248094[_0x1949('0x48')][_0x1949('0xaa')]['id']){_0x580ba3['id']=_0x248094[_0x1949('0x48')][_0x1949('0xaa')]['id'];return db['ChatInteraction'][_0x1949('0x46')]({'where':_0x580ba3})[_0x1949('0x10')](function(_0x314fcb){if(_0x314fcb){return[_0x314fcb,![]];}return db[_0x1949('0xa7')]['create'](_0x4923ee)['then'](function(_0x5f3c8a){return[_0x5f3c8a,!![]];});});}return db[_0x1949('0xa7')][_0x1949('0x47')](_0x4923ee)[_0x1949('0x10')](function(_0x41aaf5){return[_0x41aaf5,!![]];});}})['spread'](function(_0xcadda5,_0x51a5ff){if(_0xcadda5){_0x2d39c8=_0x51a5ff;if(!_0x51a5ff){var _0x24197f={'from':(_0x5894ac[_0x1949('0xab')][_0x1949('0x9b')]||'')+'\x20'+(_0x5894ac['contact'][_0x1949('0x9c')]||'')};if(_0x248094['body']['threadId']&&_0x248094[_0x1949('0x48')][_0x1949('0xac')]&&_0x248094['body']['threadId']!=_0x248094[_0x1949('0x48')]['messageId']){_0x24197f[_0x1949('0xa8')]=_0x248094['body']['messageId'];}return _0xcadda5['update'](_0x24197f);}else{return _0xcadda5;}}})[_0x1949('0x10')](function(_0x140699){_0x5894ac[_0x1949('0xaa')]=_0x140699['get']({'plain':!![]});_0x5894ac['interaction'][_0x1949('0xad')]=_0x2d39c8;if(_0x5894ac['interaction'][_0x1949('0xad')]){if(_0x5894ac['account'][_0x1949('0xae')]){_0x5894ac[_0x1949('0x91')]['push']({'id':0x0,'priority':_0x5894ac['applications'][_0x1949('0x37')]+0x1,'app':_0x1949('0xaf'),'appdata':_0x1949('0xb0'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x1949('0x47')]({'body':_0x248094[_0x1949('0x48')][_0x1949('0x48')],'ChatWebsiteId':_0x248094[_0x1949('0x4f')]['id'],'ChatInteractionId':_0x140699['id'],'direction':'in','ContactId':_0x5894ac[_0x1949('0xab')]['id'],'AttachmentId':_0x248094[_0x1949('0x48')][_0x1949('0xb1')]});})['then'](function(_0x4c6307){_0x5894ac[_0x1949('0x16')]=_0x4c6307;if(_0x5894ac[_0x1949('0xaa')][_0x1949('0xb2')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x5894ac[_0x1949('0xaa')][_0x1949('0xb2')]}})[_0x1949('0x10')](function(_0x204751){if(_0x204751){_0x5894ac[_0x1949('0x91')][_0x1949('0xb3')]({'id':0x0,'priority':0x0,'app':_0x1949('0xb4'),'appdata':_0x204751[_0x1949('0x27')]+','+(_0x5894ac[_0x1949('0x90')][_0x1949('0xb5')]||0xa),'interval':_0x1949('0xb6')});_0x5894ac[_0x1949('0xb7')]=!![];}return respondWithRpcPromise(_0x1949('0xb8'),_0x1949('0xb9'),_0x5894ac);});}return respondWithRpcPromise(_0x1949('0xb8'),_0x1949('0xb9'),_0x5894ac);})['then'](function(_0x29aab7){respondWithRpcPromise(_0x1949('0xba'),_0x1949('0xba'),{'event':'notify','message':_0x29aab7},client9002);return _0x29aab7;})[_0x1949('0x10')](respondWithResult(_0x390fa9,null))[_0x1949('0x18')](handleError(_0x390fa9,null));};exports[_0x1949('0xbb')]=function(_0x3dfbbb,_0x3caba6){var _0x348efd,_0x3a340d,_0x3ed7d8;var _0x4328c7=[];var _0x422a3c={};var _0x35c2fd=_0x3dfbbb[_0x1949('0xbc')]||[];var _0x2403a2=[];var _0x25c785;return db[_0x1949('0x7c')][_0x1949('0x50')]()[_0x1949('0x10')](function(_0xc97eb5){if(!_0xc97eb5){throw new db[(_0x1949('0x7d'))]['ValidationError'](_0x1949('0x7e'));}_0x4328c7=_[_0x1949('0x7f')](_[_0x1949('0x32')](_0xc97eb5),[_0x1949('0x80'),_0x1949('0x81'),_0x1949('0x82'),'ListId']);if(_0x3dfbbb['body']['id']){delete _0x3dfbbb[_0x1949('0x48')]['id'];}if(_[_0x1949('0x6c')](_0x3dfbbb['body'][_0x1949('0x83')])){throw _0x3caba6[_0x1949('0x19')](0x1f4)[_0x1949('0x28')](new db['Sequelize'][(_0x1949('0x84'))](_0x1949('0xbd')));}if(_[_0x1949('0x6c')](_0x3dfbbb['body'][_0x1949('0x48')])||_0x3dfbbb[_0x1949('0x48')][_0x1949('0x48')]===''){throw _0x3caba6[_0x1949('0x19')](0x1f4)['send'](new db[(_0x1949('0x7d'))][(_0x1949('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x3dfbbb['body'][_0x1949('0xbe')])){throw _0x3caba6[_0x1949('0x19')](0x1f4)['send'](new db[(_0x1949('0x7d'))]['ValidationError'](_0x1949('0xbf')+_0x4328c7));}if(!_[_0x1949('0x87')](_0x4328c7,_0x3dfbbb[_0x1949('0x48')][_0x1949('0xbe')])){throw _0x3caba6[_0x1949('0x19')](0x1f4)[_0x1949('0x28')](new db[(_0x1949('0x7d'))][(_0x1949('0x84'))](_0x1949('0xc0')+_0x4328c7));}_0x422a3c[_0x3dfbbb[_0x1949('0x48')]['mapKeyOffline']]=_0x3dfbbb[_0x1949('0x48')]['from'];})[_0x1949('0x10')](function(){return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x3dfbbb[_0x1949('0x4f')]['id']},'include':[{'model':db[_0x1949('0x8a')],'as':_0x1949('0x8b')},{'model':db[_0x1949('0xc1')],'as':_0x1949('0xc1')}]});})[_0x1949('0x10')](handleEntityNotFound(_0x3caba6,null))[_0x1949('0x10')](function(_0x2dfe43){if(_0x2dfe43&&_0x2dfe43[_0x1949('0x8b')]){_0x3a340d=_0x2dfe43;var _0x2a49ec=_['defaults'](_0x3dfbbb[_0x1949('0x48')],{'firstName':_0x3dfbbb[_0x1949('0x48')][_0x1949('0x83')],'phone':_0x3dfbbb[_0x1949('0x48')][_0x1949('0x83')],'ListId':_0x2dfe43[_0x1949('0x95')]});_0x2a49ec[_0x3dfbbb[_0x1949('0x48')][_0x1949('0xbe')]]=_0x3dfbbb[_0x1949('0x48')][_0x1949('0x83')];return db[_0x1949('0x7c')][_0x1949('0xc2')]({'where':_0x422a3c,'defaults':_0x2a49ec});}})[_0x1949('0xc3')](function(_0x34cd5f){if(_0x34cd5f){_0x3ed7d8=_0x34cd5f;var _0x7aa982=fs['readFileSync'](path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0xc4')),_0x1949('0xc5'));var _0x2d49d9=ejs['render'](_0x7aa982,{'body':_['toPairs'](_0x3dfbbb[_0x1949('0x48')][_0x1949('0x48')]),'bodyTitle':_0x3a340d['offlineMessageBody']});return db[_0x1949('0xc6')]['create']({'body':_0x2d49d9,'plainBody':htmlToText[_0x1949('0xc7')](_0x2d49d9),'ContactId':_0x34cd5f['id'],'ChatWebsiteId':_0x3a340d['id']});}})[_0x1949('0x10')](function(_0x2b5930){_0x25c785=_0x2b5930;if(_0x35c2fd[_0x1949('0x37')]){var _0x815083=_0x35c2fd[_0x1949('0x30')](function(_0x3ab0b3){return{'name':_0x3ab0b3[_0x1949('0xc8')],'basename':_0x3ab0b3[_0x1949('0x5e')],'type':_0x3ab0b3[_0x1949('0xc9')],'ChatOfflineMessageId':_0x2b5930['id']};});_0x2403a2=_0x815083[_0x1949('0x30')](_0xcd49a6=>{var _0x17cb7f={'filename':_0xcd49a6[_0x1949('0x27')],'path':path[_0x1949('0x65')](config[_0x1949('0x66')],'server',_0x1949('0xbc'),_0x1949('0xca'),_0x1949('0xcb'),_0xcd49a6[_0x1949('0xcc')])};return _0x17cb7f;});if(!_0x3a340d[_0x1949('0xcd')]){return db[_0x1949('0xce')][_0x1949('0xcf')](function(_0x48f349){return db[_0x1949('0xd0')]['bulkCreate'](_0x815083,{'transaction':_0x48f349});});}}})[_0x1949('0x10')](function(){if(_0x25c785){_0x348efd=_0x25c785;return db[_0x1949('0xc1')][_0x1949('0x54')]({'where':{'service':!![]},'include':[{'model':db[_0x1949('0xd1')],'as':_0x1949('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1949('0xd3'),'raw':!![]}]}]});}})[_0x1949('0x10')](function(_0x2177de){if(_0x2177de&&_0x2177de[_0x1949('0xd2')]&&_0x3a340d[_0x1949('0xd4')]&&_0x3a340d[_0x1949('0xd5')]){var _0x225935=_0x2177de[_0x1949('0xd6')]();return respondWithRpcPromise(_0x1949('0xd7'),_0x1949('0xd8'),{'account':_0x225935,'message':{'from':util[_0x1949('0xa2')]('\x22%s\x22\x20<%s>',_0x2177de[_0x1949('0x27')],_0x2177de['email']||_0x2177de[_0x1949('0xd2')][_0x1949('0x4a')]),'to':_0x3a340d['forwardOfflineAddress'],'subject':_0x3a340d[_0x1949('0xd9')],'html':_0x348efd['body'],'attachments':_0x2403a2}},client9003)[_0x1949('0x10')](function(){return _0x348efd;})[_0x1949('0x18')](function(_0x1514b0){logger[_0x1949('0x15')](_0x1514b0);});}})[_0x1949('0x10')](function(){if(_0x3a340d&&_0x3a340d[_0x1949('0xcd')]&&_0x3a340d[_0x1949('0xda')]){var _0xffb006=[];if(_0x35c2fd[_0x1949('0x37')]){_0xffb006=_0x35c2fd[_0x1949('0x30')](function(_0x58530b){return{'name':_0x58530b[_0x1949('0xc8')],'basename':_0x58530b['filename'],'type':_0x58530b[_0x1949('0xc9')],'ChatOfflineMessageId':_0x25c785['id']};});}var _0x495ac7;if(!_[_0x1949('0x6c')](_0x3a340d[_0x1949('0xdb')])){var _0x13ee18=_[_0x1949('0x30')](_0x3dfbbb[_0x1949('0x48')],function(_0x3c9ebe){return _0x3c9ebe;});var _0x224895=_['toPairsIn'](_0x13ee18)[0x0];var _0x3dac27=_[_0x1949('0xdc')](_0x224895,function(_0x3780a6){return _0x3780a6;});_0x495ac7=_0x3dac27[0x1][_0x3a340d['subjectOffline']];}var _0xb39e16={'from':_0x3ed7d8[_0x1949('0xdd')],'firstName':_0x3ed7d8[_0x1949('0x9b')],'lastName':_0x3ed7d8[_0x1949('0x9c')],'mapKey':_0x1949('0xdd'),'message':{'from':_0x3ed7d8[_0x1949('0xdd')],'to':_0x3a340d[_0x1949('0xc1')][_0x1949('0xdd')],'cc':'','subject':_[_0x1949('0x6c')](_0x495ac7)?_0x3a340d[_0x1949('0xd9')]:_0x495ac7,'messageId':'','sentAt':new Date(),'attach':_0xffb006[_0x1949('0x37')],'attachments':_0xffb006,'originChannel':_0x1949('0xde'),'ChatWebsiteId':_0x3a340d['id'],'ChatOfflineMessageId':_0x348efd['id'],'originTo':_0x3a340d[_0x1949('0xc1')][_0x1949('0xdd')]},'body':_0x348efd[_0x1949('0x48')]};var _0x146324={'account':{'id':_0x3a340d['MailAccountId']},'body':_0xb39e16,'log':_0x1949('0xdf')};return respondWithRpcPromise(_0x1949('0xdf'),_0x1949('0xe0'),_0x146324,client9001)[_0x1949('0x10')](function(){return _0x348efd;})[_0x1949('0x18')](function(_0x36e5d2){logger[_0x1949('0x15')](_0x36e5d2);});}return;})[_0x1949('0x10')](function(){if(_0x348efd){return _0x348efd;}})['then'](respondWithResult(_0x3caba6,null))[_0x1949('0x18')](function(_0x237c66){logger['error'](_0x1949('0x18'),_0x237c66);for(var _0xa4216a of _0x35c2fd){var _0x4095d3=path[_0x1949('0x65')](config['root'],_0x1949('0xe1'),'files',_0x1949('0xca'),'offline-chat',_0xa4216a[_0x1949('0x5e')]);fs_extra[_0x1949('0xe2')](_0x4095d3)[_0x1949('0x18')](function(_0x412a41){logger['error'](_0x1949('0xe3'),_0x4095d3,_0x412a41);});}});};exports[_0x1949('0xe4')]=function(_0xc58587,_0x491cb0){return db[_0x1949('0xa7')][_0x1949('0x46')]({'where':{'id':_0xc58587[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x491cb0,null))[_0x1949('0x10')](function(_0x21aeab){if(_0x21aeab){return _0x21aeab[_0x1949('0xe4')](_0xc58587[_0x1949('0x48')][_0x1949('0x57')],_[_0x1949('0xe5')](_0xc58587[_0x1949('0x48')],['ids','id'])||{});}})[_0x1949('0x10')](respondWithResult(_0x491cb0,null))[_0x1949('0x18')](handleError(_0x491cb0,null));};exports[_0x1949('0xe6')]=function(_0x17301e,_0x2811b2){var _0x142498={'raw':![],'where':{}};var _0x2ffdef={};var _0x39b1ba={'count':0x0,'rows':[]};return db[_0x1949('0x2c')][_0x1949('0x54')]({'where':{'id':_0x17301e[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x2811b2,null))[_0x1949('0x10')](function(_0x23db84){if(_0x23db84){_0x2ffdef['model']=_[_0x1949('0x32')](db[_0x1949('0xa7')]['rawAttributes']);_0x2ffdef['query']=_[_0x1949('0x32')](_0x17301e[_0x1949('0x31')]);_0x2ffdef[_0x1949('0x33')]=_[_0x1949('0x34')](_0x2ffdef[_0x1949('0x35')],_0x2ffdef['query']);_0x142498[_0x1949('0x36')]=_['intersection'](_0x2ffdef[_0x1949('0x35')],qs[_0x1949('0x45')](_0x17301e[_0x1949('0x31')][_0x1949('0x45')]));_0x142498[_0x1949('0x36')]=_0x142498['attributes'][_0x1949('0x37')]?_0x142498['attributes']:_0x2ffdef[_0x1949('0x35')];if(!_0x17301e[_0x1949('0x31')]['hasOwnProperty']('nolimit')){_0x142498['limit']=qs[_0x1949('0x1d')](_0x17301e[_0x1949('0x31')][_0x1949('0x1d')]);_0x142498[_0x1949('0x1b')]=qs[_0x1949('0x1b')](_0x17301e[_0x1949('0x31')][_0x1949('0x1b')]);}_0x142498[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x17301e[_0x1949('0x31')][_0x1949('0x3b')]);_0x142498[_0x1949('0x3c')]=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0x17301e[_0x1949('0x31')],_0x2ffdef[_0x1949('0x33')]));_0x142498[_0x1949('0x3c')][_0x1949('0x52')]=_0x23db84['id'];if(_0x17301e[_0x1949('0x31')]['filter']){_0x142498[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0x142498[_0x1949('0x3c')],{'$or':_['map'](_0x142498[_0x1949('0x36')],function(_0x3f103f){var _0x5bb44a={};_0x5bb44a[_0x3f103f]={'$like':'%'+_0x17301e[_0x1949('0x31')][_0x1949('0x3e')]+'%'};return _0x5bb44a;})});}_0x142498=_[_0x1949('0x3f')]({},_0x142498,_0x17301e[_0x1949('0x40')]);return db[_0x1949('0xa7')]['count']({'where':_0x142498[_0x1949('0x3c')]})[_0x1949('0x10')](function(_0x43c837){_0x39b1ba[_0x1949('0x1e')]=_0x43c837;if(_0x17301e[_0x1949('0x31')]['includeAll']){_0x142498['include']=[{'model':db['CmContact'],'as':_0x1949('0xe7'),'required':![]},{'model':db[_0x1949('0xe8')],'as':'Owner','attributes':[_0x1949('0x27'),_0x1949('0xe9'),_0x1949('0xea')],'required':![]},{'model':db[_0x1949('0xeb')],'as':_0x1949('0xec'),'attributes':['id',_0x1949('0x27'),_0x1949('0xed')],'where':_0x17301e[_0x1949('0x31')][_0x1949('0xee')]?{'id':_0x17301e[_0x1949('0x31')]['tag']}:undefined,'required':_0x17301e['query'][_0x1949('0xee')]?!![]:![]}];}return db[_0x1949('0xa7')][_0x1949('0x55')](_0x142498);})[_0x1949('0x10')](function(_0x211eb3){_0x39b1ba['rows']=_0x211eb3;return _0x39b1ba;});}})[_0x1949('0x10')](respondWithFilteredResult(_0x2811b2,_0x142498))['catch'](handleError(_0x2811b2,null));};function iftimePromise(_0x4f7a2f,_0x58c7d5){return respondWithRpcPromise(_0x1949('0xef'),_0x1949('0xf0'),{'command':_0x58c7d5[_0x1949('0xf1')]?util[_0x1949('0xa2')]('iftime\x20%s,%s',_0x4f7a2f[_0x1949('0xf2')],_0x58c7d5['timezone']):util['format']('iftime\x20%s',_0x4f7a2f[_0x1949('0xf2')])},client9002)[_0x1949('0x10')](function(_0x45962b){var _0x51bb29=_0x45962b&&_0x45962b[_0x1949('0xf3')](_0x1949('0xf4'))>=0x0?!![]:![];logger[_0x1949('0x11')](_0x1949('0xf5'),_0x58c7d5['id'],_0x4f7a2f['id'],_0x4f7a2f[_0x1949('0xf2')],_0x51bb29?_0x1949('0xf6'):'OFFLINE',_0x58c7d5['timezone']?_0x58c7d5[_0x1949('0xf1')]:_0x1949('0xf7'));return _0x51bb29;})['catch'](function(_0x5af76f){logger[_0x1949('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x58c7d5['id'],_0x4f7a2f['id'],_0x4f7a2f[_0x1949('0xf2')],util[_0x1949('0xf8')](_0x5af76f,{'showHidden':![],'depth':null}),_0x58c7d5[_0x1949('0xf1')]?_0x58c7d5[_0x1949('0xf1')]:_0x1949('0xf7'));return![];});}exports['getSnippet']=function(_0x6087b2,_0x1b00c2){var _0xa464bd=0x0;var _0x349f84=0x0;var _0x24cd35=![];var _0x36943c;var _0x1cdd5d;return db[_0x1949('0x2c')]['find']({'where':{'id':_0x6087b2[_0x1949('0x4f')]['id']},'include':[{'model':db['Interval'],'as':_0x1949('0xf9'),'include':[{'model':db[_0x1949('0xf9')],'as':_0x1949('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x1949('0x10')](handleEntityNotFound(_0x1b00c2,null))[_0x1949('0x10')](function(_0x35eaa2){if(_0x35eaa2){_0x36943c=_0x35eaa2;return _0x35eaa2[_0x1949('0xfb')]({'raw':!![]});}})[_0x1949('0x10')](function(_0x49e59a){if(_0x36943c){if(_0x49e59a){_0x1cdd5d=_0x49e59a;}}return require(_0x1949('0x69'))['getLicense']();})['then'](function(_0x32ca1d){if(_0x32ca1d){_0x349f84=_0x32ca1d[_0x1949('0xfc')];_0x24cd35=_0x32ca1d[_0x1949('0x6b')];}})[_0x1949('0x10')](function(){return db[_0x1949('0xa7')][_0x1949('0x1e')]({'where':{'closed':![]}});})[_0x1949('0x10')](function(_0x1f192e){_0xa464bd=_0x1f192e;if(_0x349f84&&_0x1f192e>_0x349f84){return db[_0x1949('0xfd')]['findOne']({'where':{'id':0x1}})[_0x1949('0x10')](function(_0xbd83c6){if(_0xbd83c6){_0xbd83c6[_0x1949('0xfe')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x36943c['Interval']&&_0x36943c[_0x1949('0xf9')][_0x1949('0xfa')]){var _0xa85283=[];for(var _0x4d70d9=0x0;_0x4d70d9<_0x36943c[_0x1949('0xf9')][_0x1949('0xfa')][_0x1949('0x37')];_0x4d70d9++){var _0x19bf67=_0x36943c[_0x1949('0xf9')]['Intervals'][_0x4d70d9][_0x1949('0x21')]({'plain':!![]});_0xa85283[_0x1949('0xff')](iftimePromise(_0x19bf67,_0x36943c));}return BPromise[_0x1949('0x100')](_0xa85283)['then'](function(_0x37331b){return _[_0x1949('0x101')](_0x37331b);});}else{return!![];}})[_0x1949('0x10')](function(_0x419962){var _0x27d3aa=fs['readFileSync'](path[_0x1949('0x65')](config[_0x1949('0x66')],_0x1949('0x102')),_0x1949('0xc5'));var _0x1b85ca={'remote':_0x36943c['remote'],'query':querystring[_0x1949('0xa6')](_[_0x1949('0x3f')](_0x36943c[_0x1949('0x21')]({'plain':!![]}),{'customerIp':_0x6087b2[_0x1949('0x78')][_0x1949('0x98')]||_0x6087b2['headers']['x-real-ip']||_0x6087b2[_0x1949('0x103')][_0x1949('0x104')]||_0x6087b2['ip'],'referer':_0x6087b2[_0x1949('0x78')][_0x1949('0x105')],'openedInteractions':_0xa464bd,'maxInteractions':_0x349f84,'virtual':_0x24cd35[_0x1949('0xfc')],'online':_0x419962,'custom':_0x24cd35}))['replace'](/'/g,'\x5c\x27')};_0x1b00c2['send'](ejs[_0x1949('0x106')](Mustache[_0x1949('0x106')](_0x27d3aa,_0x1b85ca),{'proactiveActions':_0x1cdd5d,'alignment':_0x36943c['alignment'],'verticalAlignment':_0x36943c[_0x1949('0x107')],'div_color':_0x36943c[_0x1949('0xed')],'labelText':_0x36943c['labelText'],'text_color':_0x36943c[_0x1949('0x108')],'text_button_color':_0x36943c[_0x1949('0x109')],'button_color':_0x36943c[_0x1949('0x10a')],'background_color':_0x36943c[_0x1949('0x10b')],'hideWhenOffline':_0x36943c['hideWhenOffline'],'interval':_0x36943c[_0x1949('0x10c')]}));})[_0x1949('0x18')](handleError(_0x1b00c2,null));};exports[_0x1949('0x10d')]=function(_0x457803,_0x317425){var _0x4765b3=_0x457803[_0x1949('0x4f')]['id'];var _0x5f23e1=_0x457803[_0x1949('0x48')];var _0x37dd6d=0xc8;var _0x268ef0=null;return db[_0x1949('0xce')][_0x1949('0xcf')]({'isolationLevel':db[_0x1949('0xce')]['Transaction'][_0x1949('0x10e')][_0x1949('0x10f')]},function(_0x5dc1aa){return db[_0x1949('0x2c')][_0x1949('0x54')]({'where':{'id':_0x4765b3},'transaction':_0x5dc1aa})[_0x1949('0x10')](function(_0x47d602){if(_0x47d602){return db[_0x1949('0x8e')][_0x1949('0x24')]({'where':{'ChatWebsiteId':_0x4765b3},'transaction':_0x5dc1aa})[_0x1949('0x10')](function(){var _0x3b7e1b=_['map'](_0x5f23e1,function(_0xfe71d9){_0xfe71d9[_0x1949('0x52')]=_0x4765b3;return _0xfe71d9;});return db[_0x1949('0x8e')][_0x1949('0x110')](_0x3b7e1b,{'transaction':_0x5dc1aa});});}else{_0x37dd6d=0x194;_0x268ef0=[];}});})[_0x1949('0x10')](function(){if(_0x37dd6d!==0x194){return db[_0x1949('0x8e')][_0x1949('0x111')]({'where':{'ChatWebsiteId':_0x4765b3},'order':_0x1949('0x94')})[_0x1949('0x10')](function(_0xa50a39){_0x268ef0=_0xa50a39;});}})[_0x1949('0x18')](function(_0x115d56){_0x37dd6d=0x1f4;logger[_0x1949('0x15')](_0x115d56[_0x1949('0x26')]);if(_0x115d56[_0x1949('0x27')]){delete _0x115d56['name'];}_0x268ef0=_0x115d56;})[_0x1949('0x112')](function(){if(_0x268ef0===null){_0x317425[_0x1949('0x25')](_0x37dd6d);}else{if(_0x37dd6d===0x1f4){_0x317425[_0x1949('0x19')](_0x37dd6d)[_0x1949('0x28')](_0x268ef0);}else{_0x317425[_0x1949('0x19')](_0x37dd6d)[_0x1949('0x20')](_0x268ef0);}}});};exports['getApplications']=function(_0x557e23,_0x5b08c3){var _0xf6272a={};var _0x4cd188={};var _0x5c3c0e;var _0xe9d5e7;return db['ChatWebsite'][_0x1949('0x54')]({'where':{'id':_0x557e23[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x5b08c3,null))['then'](function(_0x5064e6){if(_0x5064e6){_0x5c3c0e=_0x5064e6;_0x4cd188[_0x1949('0x35')]=_[_0x1949('0x32')](db[_0x1949('0x8e')][_0x1949('0x2d')]);_0x4cd188['query']=_[_0x1949('0x32')](_0x557e23[_0x1949('0x31')]);_0x4cd188[_0x1949('0x33')]=_[_0x1949('0x34')](_0x4cd188[_0x1949('0x35')],_0x4cd188[_0x1949('0x31')]);_0xf6272a[_0x1949('0x36')]=_['intersection'](_0x4cd188['model'],qs[_0x1949('0x45')](_0x557e23['query'][_0x1949('0x45')]));_0xf6272a['attributes']=_0xf6272a[_0x1949('0x36')]['length']?_0xf6272a['attributes']:_0x4cd188['model'];_0xf6272a[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x557e23[_0x1949('0x31')]['sort']);_0xf6272a[_0x1949('0x3c')]=qs[_0x1949('0x33')](_['pick'](_0x557e23[_0x1949('0x31')],_0x4cd188['filters']));if(_0x557e23['query'][_0x1949('0x3e')]){_0xf6272a[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0xf6272a[_0x1949('0x3c')],{'$or':_['map'](_0xf6272a[_0x1949('0x36')],function(_0x4fdd2c){var _0x97faff={};_0x97faff[_0x4fdd2c]={'$like':'%'+_0x557e23[_0x1949('0x31')]['filter']+'%'};return _0x97faff;})});}_0xf6272a=_[_0x1949('0x3f')]({},_0xf6272a,_0x557e23[_0x1949('0x40')]);return _0x5c3c0e[_0x1949('0x113')](_0xf6272a);}})[_0x1949('0x10')](function(_0x207d66){if(_0x207d66){_0xe9d5e7=_0x207d66[_0x1949('0x37')];if(!_0x557e23[_0x1949('0x31')][_0x1949('0x38')]('nolimit')){_0xf6272a['limit']=qs['limit'](_0x557e23[_0x1949('0x31')][_0x1949('0x1d')]);_0xf6272a[_0x1949('0x1b')]=qs[_0x1949('0x1b')](_0x557e23[_0x1949('0x31')][_0x1949('0x1b')]);}return _0x5c3c0e[_0x1949('0x113')](_0xf6272a);}})[_0x1949('0x10')](function(_0x378ddc){if(_0x378ddc){return _0x378ddc?{'count':_0xe9d5e7,'rows':_0x378ddc}:null;}})[_0x1949('0x10')](respondWithResult(_0x5b08c3,null))[_0x1949('0x18')](handleError(_0x5b08c3,null));};exports[_0x1949('0x114')]=function(_0x495e48,_0x11b7d6){return db[_0x1949('0x115')]['find']({'where':{'id':_0x495e48['params']['id']}})['then'](handleEntityNotFound(_0x11b7d6,null))[_0x1949('0x10')](function(_0x46313c){if(_0x46313c){return _0x46313c[_0x1949('0x114')](_0x495e48[_0x1949('0x48')]['ids'],_[_0x1949('0xe5')](_0x495e48['body'],[_0x1949('0x57'),'id'])||{});}})[_0x1949('0x10')](respondWithResult(_0x11b7d6,null))[_0x1949('0x18')](handleError(_0x11b7d6,null));};exports[_0x1949('0xfb')]=function(_0x5ed0a7,_0x5d5073){var _0x4996f9={};var _0x3978ad={};var _0x3ef4c4;var _0x118d45;return db[_0x1949('0x2c')][_0x1949('0x54')]({'where':{'id':_0x5ed0a7['params']['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x5d5073,null))[_0x1949('0x10')](function(_0x43684a){if(_0x43684a){_0x3ef4c4=_0x43684a;_0x3978ad[_0x1949('0x35')]=_[_0x1949('0x32')](db[_0x1949('0x116')][_0x1949('0x2d')]);_0x3978ad[_0x1949('0x31')]=_['keys'](_0x5ed0a7[_0x1949('0x31')]);_0x3978ad[_0x1949('0x33')]=_[_0x1949('0x34')](_0x3978ad[_0x1949('0x35')],_0x3978ad[_0x1949('0x31')]);_0x4996f9[_0x1949('0x36')]=_[_0x1949('0x34')](_0x3978ad[_0x1949('0x35')],qs['fields'](_0x5ed0a7[_0x1949('0x31')]['fields']));_0x4996f9['attributes']=_0x4996f9[_0x1949('0x36')][_0x1949('0x37')]?_0x4996f9[_0x1949('0x36')]:_0x3978ad[_0x1949('0x35')];_0x4996f9['order']=qs[_0x1949('0x3b')](_0x5ed0a7[_0x1949('0x31')][_0x1949('0x3b')]);_0x4996f9[_0x1949('0x3c')]=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0x5ed0a7[_0x1949('0x31')],_0x3978ad[_0x1949('0x33')]));if(_0x5ed0a7['query']['filter']){_0x4996f9[_0x1949('0x3c')]=_['merge'](_0x4996f9[_0x1949('0x3c')],{'$or':_[_0x1949('0x30')](_0x4996f9[_0x1949('0x36')],function(_0x5ee64f){var _0x5594a9={};_0x5594a9[_0x5ee64f]={'$like':'%'+_0x5ed0a7['query'][_0x1949('0x3e')]+'%'};return _0x5594a9;})});}_0x4996f9=_['merge']({},_0x4996f9,_0x5ed0a7[_0x1949('0x40')]);return _0x3ef4c4[_0x1949('0xfb')](_0x4996f9);}})['then'](function(_0x4b8887){if(_0x4b8887){_0x118d45=_0x4b8887[_0x1949('0x37')];if(!_0x5ed0a7['query'][_0x1949('0x38')]('nolimit')){_0x4996f9[_0x1949('0x1d')]=qs[_0x1949('0x1d')](_0x5ed0a7[_0x1949('0x31')][_0x1949('0x1d')]);_0x4996f9[_0x1949('0x1b')]=qs[_0x1949('0x1b')](_0x5ed0a7[_0x1949('0x31')][_0x1949('0x1b')]);}return _0x3ef4c4[_0x1949('0xfb')](_0x4996f9);}})['then'](function(_0x3bf3d0){if(_0x3bf3d0){return _0x3bf3d0?{'count':_0x118d45,'rows':_0x3bf3d0}:null;}})[_0x1949('0x10')](respondWithResult(_0x5d5073,null))[_0x1949('0x18')](handleError(_0x5d5073,null));};exports['getFields']=function(_0xa1ab80,_0x6eb1d7){var _0x186512=_0xa1ab80[_0x1949('0x31')][_0x1949('0x117')]===_0x1949('0x118')?_0x1949('0x119'):_0x1949('0x11a');return db[_0x1949('0x2c')]['find']({'attributes':['id',_0x186512],'where':{'id':_0xa1ab80['params']['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x6eb1d7,null))[_0x1949('0x10')](function(_0x579a9c){if(_0x579a9c){var _0x3effc0=_0x579a9c[_0x186512];var _0x18d9bf=_0x3effc0&&_0x3effc0[_0x1949('0x11b')]?_0x3effc0['items']:[];_0x6eb1d7[_0x1949('0x28')]({'fromKey':_[_0x1949('0x6c')](_0x3effc0['fromKey'])?undefined:_0x3effc0[_0x1949('0x11c')],'count':_0x18d9bf[_0x1949('0x37')],'rows':_0x18d9bf});}})[_0x1949('0x18')](handleError(_0x6eb1d7,null));};exports['getOfflineMessages']=function(_0x1f82de,_0x27221f){var _0x2323a1={'raw':![],'where':{}};var _0x4f5bca={};var _0x26f5cf={'count':0x0,'rows':[]};return db[_0x1949('0x2c')][_0x1949('0x54')]({'where':{'id':_0x1f82de[_0x1949('0x4f')]['id']}})['then'](handleEntityNotFound(_0x27221f,null))['then'](function(_0x424899){if(_0x424899){_0x4f5bca['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x4f5bca[_0x1949('0x31')]=_[_0x1949('0x32')](_0x1f82de[_0x1949('0x31')]);_0x4f5bca[_0x1949('0x33')]=_[_0x1949('0x34')](_0x4f5bca['model'],_0x4f5bca[_0x1949('0x31')]);_0x2323a1[_0x1949('0x36')]=_['intersection'](_0x4f5bca['model'],qs[_0x1949('0x45')](_0x1f82de[_0x1949('0x31')][_0x1949('0x45')]));_0x2323a1[_0x1949('0x36')]=_0x2323a1[_0x1949('0x36')][_0x1949('0x37')]?_0x2323a1[_0x1949('0x36')]:_0x4f5bca[_0x1949('0x35')];if(!_0x1f82de[_0x1949('0x31')][_0x1949('0x38')](_0x1949('0x39'))){_0x2323a1[_0x1949('0x1d')]=qs['limit'](_0x1f82de[_0x1949('0x31')][_0x1949('0x1d')]);_0x2323a1[_0x1949('0x1b')]=qs['offset'](_0x1f82de[_0x1949('0x31')][_0x1949('0x1b')]);}_0x2323a1[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x1f82de['query'][_0x1949('0x3b')]);_0x2323a1['where']=qs[_0x1949('0x33')](_[_0x1949('0x3d')](_0x1f82de[_0x1949('0x31')],_0x4f5bca['filters']));_0x2323a1[_0x1949('0x3c')]['ChatWebsiteId']=_0x424899['id'];if(_0x1f82de['query']['filter']){_0x2323a1['where']=_[_0x1949('0x3f')](_0x2323a1['where'],{'$or':_['map'](_0x2323a1[_0x1949('0x36')],function(_0x53510f){var _0x2d7174={};_0x2d7174[_0x53510f]={'$like':'%'+_0x1f82de[_0x1949('0x31')][_0x1949('0x3e')]+'%'};return _0x2d7174;})});}_0x2323a1=_['merge']({},_0x2323a1,_0x1f82de[_0x1949('0x40')]);return db[_0x1949('0xc6')]['count']({'where':_0x2323a1['where']})['then'](function(_0x10616a){_0x26f5cf[_0x1949('0x1e')]=_0x10616a;if(_0x1f82de[_0x1949('0x31')][_0x1949('0x41')]){_0x2323a1[_0x1949('0x42')]=[{'all':!![]}];}else{_0x2323a1[_0x1949('0x42')]=[{'model':db[_0x1949('0x7c')],'as':_0x1949('0xe7'),'required':![]},{'model':db[_0x1949('0xd0')],'as':_0x1949('0x11d'),'required':![]}];}return db[_0x1949('0xc6')][_0x1949('0x55')](_0x2323a1);})['then'](function(_0x157b3b){_0x26f5cf[_0x1949('0x43')]=_0x157b3b;return _0x26f5cf;});}})['then'](respondWithFilteredResult(_0x27221f,_0x2323a1))['catch'](handleError(_0x27221f,null));};exports['addAgents']=function(_0x38b760,_0x3f6c8e){return db['ChatWebsite'][_0x1949('0x46')]({'where':{'id':_0x38b760[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x3f6c8e,null))[_0x1949('0x10')](function(_0x1b258a){if(_0x1b258a){return _0x1b258a[_0x1949('0x11e')](_0x38b760['body'][_0x1949('0x57')],_[_0x1949('0xe5')](_0x38b760[_0x1949('0x48')],[_0x1949('0x57'),'id'])||{})[_0x1949('0xc3')](function(_0x2bccd8){for(var _0x3a3968=0x0;_0x3a3968<_0x38b760[_0x1949('0x48')][_0x1949('0x57')][_0x1949('0x37')];_0x3a3968+=0x1){socket[_0x1949('0x11f')]('userChatWebsite:save',{'UserId':Number(_0x38b760[_0x1949('0x48')]['ids'][_0x3a3968]),'ChatWebsiteId':Number(_0x38b760[_0x1949('0x4f')]['id'])});}return _0x2bccd8;});}})[_0x1949('0x10')](respondWithResult(_0x3f6c8e,null))['catch'](handleError(_0x3f6c8e,null));};exports['removeAgents']=function(_0x136e5d,_0x5e8435){return db[_0x1949('0x2c')][_0x1949('0x46')]({'where':{'id':_0x136e5d[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x5e8435,null))[_0x1949('0x10')](function(_0x1e00fd){if(_0x1e00fd){return _0x1e00fd[_0x1949('0x120')](_0x136e5d[_0x1949('0x31')][_0x1949('0x57')])[_0x1949('0x10')](function(){if(_[_0x1949('0x121')](_0x136e5d[_0x1949('0x31')][_0x1949('0x57')])){for(var _0x3a602d=0x0;_0x3a602d<_0x136e5d[_0x1949('0x31')][_0x1949('0x57')]['length'];_0x3a602d+=0x1){socket[_0x1949('0x11f')](_0x1949('0x122'),{'UserId':Number(_0x136e5d[_0x1949('0x31')][_0x1949('0x57')][_0x3a602d]),'ChatWebsiteId':Number(_0x136e5d[_0x1949('0x4f')]['id'])});}}else{socket[_0x1949('0x11f')](_0x1949('0x122'),{'UserId':Number(_0x136e5d['query'][_0x1949('0x57')]),'ChatWebsiteId':Number(_0x136e5d[_0x1949('0x4f')]['id'])});}});}})[_0x1949('0x10')](respondWithStatusCode(_0x5e8435,null))[_0x1949('0x18')](handleError(_0x5e8435,null));};exports[_0x1949('0x123')]=function(_0x1d7500,_0x22068f){var _0x597343={};var _0x23d185={};var _0x3f097a;var _0x3dc3cb;return db['ChatWebsite'][_0x1949('0x54')]({'where':{'id':_0x1d7500[_0x1949('0x4f')]['id']}})[_0x1949('0x10')](handleEntityNotFound(_0x22068f,null))[_0x1949('0x10')](function(_0x2a2ace){if(_0x2a2ace){_0x3f097a=_0x2a2ace;_0x23d185['model']=_[_0x1949('0x32')](db[_0x1949('0xe8')][_0x1949('0x2d')]);_0x23d185['query']=_[_0x1949('0x32')](_0x1d7500[_0x1949('0x31')]);_0x23d185['filters']=_['intersection'](_0x23d185['model'],_0x23d185['query']);_0x597343[_0x1949('0x36')]=_[_0x1949('0x34')](_0x23d185['model'],qs[_0x1949('0x45')](_0x1d7500['query'][_0x1949('0x45')]));_0x597343[_0x1949('0x36')]=_0x597343[_0x1949('0x36')][_0x1949('0x37')]?_0x597343[_0x1949('0x36')]:_0x23d185[_0x1949('0x35')];_0x597343[_0x1949('0x3a')]=qs[_0x1949('0x3b')](_0x1d7500[_0x1949('0x31')][_0x1949('0x3b')]);_0x597343['where']=qs[_0x1949('0x33')](_['pick'](_0x1d7500[_0x1949('0x31')],_0x23d185[_0x1949('0x33')]));if(_0x1d7500[_0x1949('0x31')][_0x1949('0x3e')]){_0x597343[_0x1949('0x3c')]=_[_0x1949('0x3f')](_0x597343['where'],{'$or':_[_0x1949('0x30')](_0x597343[_0x1949('0x36')],function(_0x35774f){var _0x16cdd3={};_0x16cdd3[_0x35774f]={'$like':'%'+_0x1d7500['query'][_0x1949('0x3e')]+'%'};return _0x16cdd3;})});}_0x597343=_['merge']({},_0x597343,_0x1d7500[_0x1949('0x40')]);return _0x3f097a[_0x1949('0x123')](_0x597343);}})['then'](function(_0x2bc8ed){if(_0x2bc8ed){_0x3dc3cb=_0x2bc8ed['length'];if(!_0x1d7500[_0x1949('0x31')][_0x1949('0x38')]('nolimit')){_0x597343[_0x1949('0x1d')]=qs[_0x1949('0x1d')](_0x1d7500[_0x1949('0x31')][_0x1949('0x1d')]);_0x597343[_0x1949('0x1b')]=qs[_0x1949('0x1b')](_0x1d7500[_0x1949('0x31')][_0x1949('0x1b')]);}return _0x3f097a[_0x1949('0x123')](_0x597343);}})['then'](function(_0xaaffae){if(_0xaaffae){return _0xaaffae?{'count':_0x3dc3cb,'rows':_0xaaffae}:null;}})[_0x1949('0x10')](respondWithResult(_0x22068f,null))[_0x1949('0x18')](handleError(_0x22068f,null));}; \ No newline at end of file +var _0x53c0=['No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','all','server/files/chat/iframe.ejs','remote','connection','remoteAddress','referer','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','sitepic','getLicense','custom','isNil','join','server/files/images/logos/','server/files/images/avatars/default_avatar.png','root','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','stringify','threadId','ChatInteraction','ContactId','interaction','messageId','created','push','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','originalname','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','attachments','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE'];(function(_0x174e9e,_0x4ece54){var _0x524f3f=function(_0x28a2ef){while(--_0x28a2ef){_0x174e9e['push'](_0x174e9e['shift']());}};_0x524f3f(++_0x4ece54);}(_0x53c0,0x15b));var _0x053c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x53c0[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x053c('0x0'));var Mustache=require(_0x053c('0x1'));var util=require(_0x053c('0x2'));var path=require(_0x053c('0x3'));var ejs=require(_0x053c('0x4'));var fs=require('fs');var fs_extra=require(_0x053c('0x5'));var _=require(_0x053c('0x6'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0x053c('0x7'));var logger=require(_0x053c('0x8'))('api');var config=require(_0x053c('0x9'));var db=require(_0x053c('0xa'))['db'];config['redis']=_[_0x053c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x053c('0xc')]));require(_0x053c('0xd'))[_0x053c('0xe')](socket);var htmlToText=require(_0x053c('0xf'));var jayson=require(_0x053c('0x10'));var client=jayson[_0x053c('0x11')]['http']({'port':0x232c});var client9002=jayson['client'][_0x053c('0x12')]({'port':0x232a});var client9003=jayson[_0x053c('0x11')][_0x053c('0x12')]({'port':0x232b});var client9001=jayson[_0x053c('0x11')][_0x053c('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x413186,_0x478b98,_0x273c70,_0xee6b4d){return new BPromise(function(_0x297af7,_0x2c0dd6){var _0x118aae=_0xee6b4d||client;return _0x118aae[_0x053c('0x13')](_0x413186,_0x273c70)[_0x053c('0x14')](function(_0x47c277){logger[_0x053c('0x15')](_0x053c('0x16'),_0x478b98,'request\x20sent');logger[_0x053c('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x478b98,'request\x20sent',JSON['stringify'](_0x47c277));if(_0x47c277[_0x053c('0x18')]){if(_0x47c277[_0x053c('0x18')]['code']===0x1f4){logger[_0x053c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x478b98,_0x47c277[_0x053c('0x18')][_0x053c('0x19')]);return _0x2c0dd6(_0x47c277[_0x053c('0x18')][_0x053c('0x19')]);}logger[_0x053c('0x18')](_0x053c('0x16'),_0x478b98,_0x47c277[_0x053c('0x18')]['message']);return _0x297af7(_0x47c277['error'][_0x053c('0x19')]);}else{logger[_0x053c('0x15')](_0x053c('0x16'),_0x478b98,'request\x20sent');_0x297af7(_0x47c277[_0x053c('0x1a')][_0x053c('0x19')]);}})[_0x053c('0x1b')](function(_0x1f4128){logger[_0x053c('0x18')](_0x053c('0x16'),_0x478b98,_0x1f4128);_0x2c0dd6(_0x1f4128);});});}function respondWithStatusCode(_0x18042c,_0x2864ed){_0x2864ed=_0x2864ed||0xcc;return function(_0x40a725){if(_0x40a725){return _0x18042c[_0x053c('0x1c')](_0x2864ed);}return _0x18042c[_0x053c('0x1d')](_0x2864ed)[_0x053c('0x1e')]();};}function respondWithResult(_0x368948,_0x2f327e){_0x2f327e=_0x2f327e||0xc8;return function(_0x523687){if(_0x523687){return _0x368948[_0x053c('0x1d')](_0x2f327e)[_0x053c('0x1f')](_0x523687);}};}function respondWithFilteredResult(_0x1372f4,_0x57630d){return function(_0x185632){if(_0x185632){var _0x20aad0=typeof _0x57630d[_0x053c('0x20')]===_0x053c('0x21')&&typeof _0x57630d[_0x053c('0x22')]===_0x053c('0x21');var _0x16cad9=_0x185632[_0x053c('0x23')];var _0x32ffbf=_0x20aad0?0x0:_0x57630d[_0x053c('0x20')];var _0x21bb05=_0x20aad0?_0x185632[_0x053c('0x23')]:_0x57630d['offset']+_0x57630d[_0x053c('0x22')];var _0x22e112;if(_0x21bb05>=_0x16cad9){_0x21bb05=_0x16cad9;_0x22e112=0xc8;}else{_0x22e112=0xce;}_0x1372f4[_0x053c('0x1d')](_0x22e112);return _0x1372f4[_0x053c('0x24')](_0x053c('0x25'),_0x32ffbf+'-'+_0x21bb05+'/'+_0x16cad9)['json'](_0x185632);}return null;};}function saveUpdates(_0x199d66){return function(_0x197707){if(_0x197707){return _0x197707[_0x053c('0x26')](_0x199d66)[_0x053c('0x14')](function(_0x1b299f){return _0x1b299f;});}return null;};}function removeEntity(_0x569300){return function(_0x4527f8){if(_0x4527f8){return _0x4527f8[_0x053c('0x27')]()[_0x053c('0x14')](function(){var _0x55f3df=_0x4527f8[_0x053c('0x28')]({'plain':!![]});var _0xb27299=_0x053c('0x29');return db[_0x053c('0x2a')][_0x053c('0x27')]({'where':{'type':_0xb27299,'resourceId':_0x55f3df['id']}})[_0x053c('0x14')](function(){return _0x4527f8;});})[_0x053c('0x14')](function(){_0x569300['status'](0xcc)[_0x053c('0x1e')]();});}};}function handleEntityNotFound(_0x14390a){return function(_0x64424d){if(!_0x64424d){_0x14390a[_0x053c('0x1c')](0x194);}return _0x64424d;};}function handleError(_0x14c66c,_0x14157a){_0x14157a=_0x14157a||0x1f4;return function(_0x260f8c){logger[_0x053c('0x18')](_0x260f8c[_0x053c('0x2b')]);if(_0x260f8c[_0x053c('0x2c')]){delete _0x260f8c[_0x053c('0x2c')];}_0x14c66c[_0x053c('0x1d')](_0x14157a)[_0x053c('0x2d')](_0x260f8c);};}exports[_0x053c('0x2e')]=function(_0x58326f,_0x5644b2){var _0x2eedb9={'include':[{'model':db[_0x053c('0x2f')],'as':_0x053c('0x30')}]},_0x3c667a={},_0x16850f={'count':0x0,'rows':[]};var _0x7af68a=_['map'](db[_0x053c('0x31')][_0x053c('0x32')],function(_0x290cea){return{'name':_0x290cea[_0x053c('0x33')],'type':_0x290cea[_0x053c('0x34')][_0x053c('0x35')]};});_0x3c667a[_0x053c('0x36')]=_[_0x053c('0x37')](_0x7af68a,'name');_0x3c667a[_0x053c('0x38')]=_[_0x053c('0x39')](_0x58326f['query']);_0x3c667a['filters']=_[_0x053c('0x3a')](_0x3c667a[_0x053c('0x36')],_0x3c667a[_0x053c('0x38')]);_0x2eedb9[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x3c667a[_0x053c('0x36')],qs['fields'](_0x58326f[_0x053c('0x38')][_0x053c('0x3c')]));_0x2eedb9[_0x053c('0x3b')]=_0x2eedb9[_0x053c('0x3b')][_0x053c('0x3d')]?_0x2eedb9['attributes']:_0x3c667a[_0x053c('0x36')];if(!_0x58326f['query'][_0x053c('0x3e')](_0x053c('0x3f'))){_0x2eedb9[_0x053c('0x22')]=qs['limit'](_0x58326f[_0x053c('0x38')][_0x053c('0x22')]);_0x2eedb9[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x58326f[_0x053c('0x38')][_0x053c('0x20')]);}_0x2eedb9[_0x053c('0x40')]=qs['sort'](_0x58326f[_0x053c('0x38')][_0x053c('0x41')]);_0x2eedb9[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x58326f[_0x053c('0x38')],_0x3c667a[_0x053c('0x43')]),_0x7af68a);if(_0x58326f[_0x053c('0x38')][_0x053c('0x45')]){_0x2eedb9[_0x053c('0x42')]=_['merge'](_0x2eedb9[_0x053c('0x42')],{'$or':_['map'](_0x7af68a,function(_0x33a025){if(_0x33a025['type']!=='VIRTUAL'){var _0x16a676={};_0x16a676[_0x33a025[_0x053c('0x2c')]]={'$like':'%'+_0x58326f[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x16a676;}})});}_0x2eedb9=_[_0x053c('0x46')]({},_0x2eedb9,_0x58326f[_0x053c('0x47')]);var _0xb793b5={'where':_0x2eedb9['where']};return db['ChatWebsite'][_0x053c('0x23')](_0xb793b5)[_0x053c('0x14')](function(_0x59f94b){_0x16850f['count']=_0x59f94b;if(_0x58326f[_0x053c('0x38')]['includeAll']){_0x2eedb9[_0x053c('0x48')]=[{'all':!![]}];}return db[_0x053c('0x31')][_0x053c('0x49')](_0x2eedb9);})[_0x053c('0x14')](function(_0x476762){_0x16850f[_0x053c('0x4a')]=_0x476762;return _0x16850f;})[_0x053c('0x14')](respondWithFilteredResult(_0x5644b2,_0x2eedb9))[_0x053c('0x1b')](handleError(_0x5644b2,null));};exports[_0x053c('0x4b')]=function(_0x32eed9,_0x39fab8){var _0x50649b={'raw':![],'where':{'id':_0x32eed9['params']['id']},'include':[{'model':db['Pause'],'as':_0x053c('0x30')}]},_0x400296={};_0x400296[_0x053c('0x36')]=_['keys'](db['ChatWebsite'][_0x053c('0x32')]);_0x400296['query']=_[_0x053c('0x39')](_0x32eed9['query']);_0x400296[_0x053c('0x43')]=_['intersection'](_0x400296[_0x053c('0x36')],_0x400296[_0x053c('0x38')]);_0x50649b[_0x053c('0x3b')]=_['intersection'](_0x400296[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x32eed9[_0x053c('0x38')][_0x053c('0x3c')]));_0x50649b[_0x053c('0x3b')]=_0x50649b['attributes'][_0x053c('0x3d')]?_0x50649b[_0x053c('0x3b')]:_0x400296[_0x053c('0x36')];if(_0x32eed9['query'][_0x053c('0x4c')]){_0x50649b[_0x053c('0x48')]=[{'all':!![]}];}_0x50649b=_[_0x053c('0x46')]({},_0x50649b,_0x32eed9[_0x053c('0x47')]);return db[_0x053c('0x31')][_0x053c('0x4d')](_0x50649b)['then'](handleEntityNotFound(_0x39fab8,null))[_0x053c('0x14')](respondWithResult(_0x39fab8,null))[_0x053c('0x1b')](handleError(_0x39fab8,null));};exports[_0x053c('0x4e')]=function(_0x19c42a,_0x132515){return db[_0x053c('0x31')][_0x053c('0x4e')](_0x19c42a[_0x053c('0x4f')],{})[_0x053c('0x14')](function(_0x31b55f){var _0x25ded7=_0x19c42a[_0x053c('0x50')]['get']({'plain':!![]});if(!_0x25ded7)throw new Error(_0x053c('0x51'));if(_0x25ded7[_0x053c('0x52')]===_0x053c('0x50')){var _0x5b33ae=_0x31b55f[_0x053c('0x28')]({'plain':!![]});var _0x3ab314=_0x053c('0x29');return db[_0x053c('0x53')][_0x053c('0x4d')]({'where':{'name':_0x3ab314,'userProfileId':_0x25ded7['userProfileId']},'raw':!![]})[_0x053c('0x14')](function(_0x5aba89){if(_0x5aba89&&_0x5aba89[_0x053c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b33ae[_0x053c('0x2c')],'resourceId':_0x5b33ae['id'],'type':_0x5aba89[_0x053c('0x2c')],'sectionId':_0x5aba89['id']},{})[_0x053c('0x14')](function(){return _0x31b55f;});}else{return _0x31b55f;}})[_0x053c('0x1b')](function(_0xa54c0d){logger['error'](_0x053c('0x55'),_0xa54c0d);throw _0xa54c0d;});}return _0x31b55f;})['then'](respondWithResult(_0x132515,0xc9))[_0x053c('0x1b')](handleError(_0x132515,null));};exports['update']=function(_0x545759,_0x122926){if(_0x545759[_0x053c('0x4f')]['id']){delete _0x545759['body']['id'];}return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x545759[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x2f')],'as':_0x053c('0x30')}]})[_0x053c('0x14')](handleEntityNotFound(_0x122926,null))[_0x053c('0x14')](saveUpdates(_0x545759[_0x053c('0x4f')],null))['then'](respondWithResult(_0x122926,null))['catch'](handleError(_0x122926,null));};exports[_0x053c('0x27')]=function(_0x1eeb3e,_0xcace4f){return db[_0x053c('0x31')]['find']({'where':{'id':_0x1eeb3e[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0xcace4f,null))[_0x053c('0x14')](removeEntity(_0xcace4f,null))['catch'](handleError(_0xcace4f,null));};exports['describe']=function(_0x1acc43,_0x505105){return db['ChatWebsite'][_0x053c('0x57')]()[_0x053c('0x14')](respondWithResult(_0x505105,null))[_0x053c('0x1b')](handleError(_0x505105,null));};exports[_0x053c('0x58')]=function(_0x1759ca,_0x4d3b0b){if(_0x1759ca['body']['id']){delete _0x1759ca[_0x053c('0x4f')]['id'];}return db[_0x053c('0x31')]['find']({'where':{'id':_0x1759ca[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d3b0b,null))['then'](function(_0xd486fb){if(_0xd486fb){_0x1759ca[_0x053c('0x4f')][_0x053c('0x59')]=_0xd486fb['id'];return db['Disposition'][_0x053c('0x4e')](_0x1759ca[_0x053c('0x4f')]);}})['then'](respondWithResult(_0x4d3b0b,null))[_0x053c('0x1b')](handleError(_0x4d3b0b,null));};exports['getDispositions']=function(_0x278aae,_0x132d95){var _0x3afff6={'raw':![],'where':{}};var _0x12361c={};var _0x4c7a97={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x278aae[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x132d95,null))['then'](function(_0x80cc8c){if(_0x80cc8c){_0x12361c[_0x053c('0x36')]=_['keys'](db[_0x053c('0x5a')][_0x053c('0x32')]);_0x12361c[_0x053c('0x38')]=_[_0x053c('0x39')](_0x278aae[_0x053c('0x38')]);_0x12361c[_0x053c('0x43')]=_['intersection'](_0x12361c[_0x053c('0x36')],_0x12361c[_0x053c('0x38')]);_0x3afff6[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x12361c['model'],qs[_0x053c('0x3c')](_0x278aae['query']['fields']));_0x3afff6['attributes']=_0x3afff6[_0x053c('0x3b')][_0x053c('0x3d')]?_0x3afff6[_0x053c('0x3b')]:_0x12361c['model'];if(!_0x278aae[_0x053c('0x38')]['hasOwnProperty'](_0x053c('0x3f'))){_0x3afff6[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x278aae[_0x053c('0x38')][_0x053c('0x22')]);_0x3afff6[_0x053c('0x20')]=qs['offset'](_0x278aae[_0x053c('0x38')][_0x053c('0x20')]);}_0x3afff6[_0x053c('0x40')]=qs['sort'](_0x278aae['query'][_0x053c('0x41')]);_0x3afff6[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x278aae[_0x053c('0x38')],_0x12361c[_0x053c('0x43')]));_0x3afff6['where'][_0x053c('0x59')]=_0x80cc8c['id'];if(_0x278aae['query'][_0x053c('0x45')]){_0x3afff6[_0x053c('0x42')]=_[_0x053c('0x46')](_0x3afff6[_0x053c('0x42')],{'$or':_['map'](_0x3afff6[_0x053c('0x3b')],function(_0x4b413d){var _0x508c71={};_0x508c71[_0x4b413d]={'$like':'%'+_0x278aae[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x508c71;})});}_0x3afff6=_[_0x053c('0x46')]({},_0x3afff6,_0x278aae['options']);return db[_0x053c('0x5a')]['count']({'where':_0x3afff6[_0x053c('0x42')]})[_0x053c('0x14')](function(_0x346a65){_0x4c7a97[_0x053c('0x23')]=_0x346a65;if(_0x278aae[_0x053c('0x38')][_0x053c('0x4c')]){_0x3afff6['include']=[{'all':!![]}];}return db[_0x053c('0x5a')][_0x053c('0x49')](_0x3afff6);})[_0x053c('0x14')](function(_0x1cd445){_0x4c7a97[_0x053c('0x4a')]=_0x1cd445;return _0x4c7a97;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x132d95,_0x3afff6))[_0x053c('0x1b')](handleError(_0x132d95,null));};exports[_0x053c('0x5b')]=function(_0x599949,_0x5e074e){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x599949['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5e074e,null))[_0x053c('0x14')](function(_0x507b75){if(_0x507b75){return _0x507b75[_0x053c('0x5b')](_0x599949['query'][_0x053c('0x5c')]);}})[_0x053c('0x14')](respondWithStatusCode(_0x5e074e,null))['catch'](handleError(_0x5e074e,null));};exports[_0x053c('0x5d')]=function(_0x32d7b0,_0x30d51f){if(_0x32d7b0[_0x053c('0x4f')]['id']){delete _0x32d7b0[_0x053c('0x4f')]['id'];}return db[_0x053c('0x31')]['find']({'where':{'id':_0x32d7b0[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x30d51f,null))[_0x053c('0x14')](function(_0x526ee0){if(_0x526ee0){_0x32d7b0[_0x053c('0x4f')][_0x053c('0x59')]=_0x526ee0['id'];return db[_0x053c('0x5e')][_0x053c('0x4e')](_0x32d7b0[_0x053c('0x4f')]);}})[_0x053c('0x14')](respondWithResult(_0x30d51f,null))[_0x053c('0x1b')](handleError(_0x30d51f,null));};exports[_0x053c('0x5f')]=function(_0x3691f1,_0xe45176){var _0x59d3f2={'raw':![],'where':{}};var _0x3ec0c4={};var _0x9fded0={'count':0x0,'rows':[]};return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x3691f1[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0xe45176,null))[_0x053c('0x14')](function(_0x592627){if(_0x592627){_0x3ec0c4[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x5e')][_0x053c('0x32')]);_0x3ec0c4['query']=_['keys'](_0x3691f1[_0x053c('0x38')]);_0x3ec0c4[_0x053c('0x43')]=_['intersection'](_0x3ec0c4[_0x053c('0x36')],_0x3ec0c4['query']);_0x59d3f2['attributes']=_[_0x053c('0x3a')](_0x3ec0c4[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x3691f1[_0x053c('0x38')][_0x053c('0x3c')]));_0x59d3f2[_0x053c('0x3b')]=_0x59d3f2[_0x053c('0x3b')][_0x053c('0x3d')]?_0x59d3f2[_0x053c('0x3b')]:_0x3ec0c4[_0x053c('0x36')];if(!_0x3691f1[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x59d3f2[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x3691f1[_0x053c('0x38')][_0x053c('0x22')]);_0x59d3f2[_0x053c('0x20')]=qs['offset'](_0x3691f1[_0x053c('0x38')][_0x053c('0x20')]);}_0x59d3f2[_0x053c('0x40')]=qs['sort'](_0x3691f1[_0x053c('0x38')]['sort']);_0x59d3f2[_0x053c('0x42')]=qs['filters'](_[_0x053c('0x44')](_0x3691f1[_0x053c('0x38')],_0x3ec0c4[_0x053c('0x43')]));_0x59d3f2[_0x053c('0x42')]['ChatWebsiteId']=_0x592627['id'];if(_0x3691f1['query'][_0x053c('0x45')]){_0x59d3f2['where']=_[_0x053c('0x46')](_0x59d3f2[_0x053c('0x42')],{'$or':_[_0x053c('0x37')](_0x59d3f2[_0x053c('0x3b')],function(_0x2c1f24){var _0x284c19={};_0x284c19[_0x2c1f24]={'$like':'%'+_0x3691f1[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x284c19;})});}_0x59d3f2=_[_0x053c('0x46')]({},_0x59d3f2,_0x3691f1[_0x053c('0x47')]);return db[_0x053c('0x5e')]['count']({'where':_0x59d3f2['where']})[_0x053c('0x14')](function(_0xd5da8d){_0x9fded0[_0x053c('0x23')]=_0xd5da8d;if(_0x3691f1[_0x053c('0x38')][_0x053c('0x4c')]){_0x59d3f2[_0x053c('0x48')]=[{'all':!![]}];}return db['CannedAnswer'][_0x053c('0x49')](_0x59d3f2);})['then'](function(_0x1778b1){_0x9fded0[_0x053c('0x4a')]=_0x1778b1;return _0x9fded0;});}})[_0x053c('0x14')](respondWithFilteredResult(_0xe45176,_0x59d3f2))[_0x053c('0x1b')](handleError(_0xe45176,null));};exports[_0x053c('0x61')]=function(_0x5442ca,_0x29399e){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5442ca[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x29399e,null))[_0x053c('0x14')](function(_0x5dfc70){if(_0x5dfc70){return _0x5dfc70[_0x053c('0x61')](_0x5442ca[_0x053c('0x38')][_0x053c('0x5c')]);}})[_0x053c('0x14')](respondWithStatusCode(_0x29399e,null))[_0x053c('0x1b')](handleError(_0x29399e,null));};exports[_0x053c('0x62')]=function(_0x5084e8,_0x5961ea){_0x5084e8[_0x053c('0x4f')]['sitepic']=_0x5084e8[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5084e8[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5961ea,null))[_0x053c('0x14')](saveUpdates(_0x5084e8[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x5961ea,null))[_0x053c('0x1b')](handleError(_0x5961ea,null));};exports[_0x053c('0x65')]=function(_0x220509,_0x223b9c){_0x220509[_0x053c('0x4f')][_0x053c('0x66')]=_0x220509[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x220509[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x223b9c,null))[_0x053c('0x14')](saveUpdates(_0x220509[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x223b9c,null))[_0x053c('0x1b')](handleError(_0x223b9c,null));};exports[_0x053c('0x67')]=function(_0x337a6b,_0x28fe8a){_0x337a6b[_0x053c('0x4f')][_0x053c('0x68')]=_0x337a6b[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')]['find']({'where':{'id':_0x337a6b[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x28fe8a,null))[_0x053c('0x14')](saveUpdates(_0x337a6b[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x28fe8a,null))['catch'](handleError(_0x28fe8a,null));};exports['addSystemAvatar']=function(_0x131b6b,_0x223e54){_0x131b6b[_0x053c('0x4f')]['systemAvatar']=_0x131b6b[_0x053c('0x63')]['filename'];return db[_0x053c('0x31')]['find']({'where':{'id':_0x131b6b['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x223e54,null))['then'](saveUpdates(_0x131b6b[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x223e54,null))['catch'](handleError(_0x223e54,null));};exports[_0x053c('0x69')]=function(_0x16dfda,_0x44c7bf){var _0x3499fa=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x590372={'where':{'id':_0x16dfda[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x6a')],'raw':!![]};var _0x5e69c6=![];return require('../../config/license/util')[_0x053c('0x6b')]()[_0x053c('0x14')](function(_0x281f71){if(_0x281f71){_0x5e69c6=_0x281f71[_0x053c('0x6c')];}})[_0x053c('0x14')](function(){return db['ChatWebsite'][_0x053c('0x4d')](_0x590372);})['then'](handleEntityNotFound(_0x44c7bf,null))['then'](function(_0x5e0424){if(_0x5e0424){if(!_[_0x053c('0x6d')](_0x5e0424['sitepic'])){if(fs['existsSync'](path[_0x053c('0x6e')](config['root'],_0x053c('0x6f'),_0x5e0424['sitepic']))&&_0x5e69c6){_0x3499fa=path[_0x053c('0x6e')](config['root'],_0x053c('0x6f'),_0x5e0424[_0x053c('0x6a')]);}}return _0x44c7bf['download'](_0x3499fa);}})[_0x053c('0x1b')](handleError(_0x44c7bf,null));};exports['getAvatar']=function(_0x56ffc2,_0x40e7eb){var _0x229431=path[_0x053c('0x6e')](config['root'],_0x053c('0x70'));var _0x3e8255={'where':{'id':_0x56ffc2[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x66')],'raw':!![]};return db[_0x053c('0x31')]['find'](_0x3e8255)['then'](handleEntityNotFound(_0x40e7eb,null))[_0x053c('0x14')](function(_0x4da076){if(_0x4da076){if(!_[_0x053c('0x6d')](_0x4da076['agentAvatar'])){if(fs['existsSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x4da076[_0x053c('0x66')]))){_0x229431=path[_0x053c('0x6e')](config['root'],'server/files/images/avatars/',_0x4da076[_0x053c('0x66')]);}}return _0x40e7eb[_0x053c('0x73')](_0x229431);}})['catch'](handleError(_0x40e7eb,null));};exports[_0x053c('0x74')]=function(_0x209153,_0x2758d9){var _0x53325b=path[_0x053c('0x6e')](config['root'],_0x053c('0x75'));var _0x3738c1={'where':{'id':_0x209153[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x68'),_0x053c('0x76')],'raw':!![]};return db[_0x053c('0x31')][_0x053c('0x4d')](_0x3738c1)[_0x053c('0x14')](handleEntityNotFound(_0x2758d9,null))['then'](function(_0x4c2a0a){if(_0x4c2a0a){if(!_['isNil'](_0x4c2a0a[_0x053c('0x68')])){if(fs[_0x053c('0x77')](path['join'](config['root'],_0x053c('0x72'),_0x4c2a0a[_0x053c('0x68')]))&&_0x4c2a0a[_0x053c('0x76')]){_0x53325b=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x4c2a0a['customerAvatar']);}}return _0x2758d9[_0x053c('0x73')](_0x53325b);}})[_0x053c('0x1b')](handleError(_0x2758d9,null));};exports['getSystemAvatar']=function(_0x3020b6,_0x45d291){var _0x16fe65=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x78'));var _0x2d11cb={'where':{'id':_0x3020b6[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x79')],'raw':!![]};return db[_0x053c('0x31')][_0x053c('0x4d')](_0x2d11cb)[_0x053c('0x14')](handleEntityNotFound(_0x45d291,null))[_0x053c('0x14')](function(_0x231e11){if(_0x231e11){if(!_[_0x053c('0x6d')](_0x231e11[_0x053c('0x79')])){if(fs['existsSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x231e11[_0x053c('0x79')]))){_0x16fe65=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x231e11['systemAvatar']);}}return _0x45d291[_0x053c('0x73')](_0x16fe65);}})[_0x053c('0x1b')](handleError(_0x45d291,null));};exports[_0x053c('0x7a')]=function(_0x5f554a,_0x204d87){var _0x50100e=require(_0x053c('0x7b'));var _0x2d4cb1=new _0x50100e();var _0x263d27=_0x2d4cb1['setUA'](_0x5f554a[_0x053c('0x7c')][_0x053c('0x7d')])[_0x053c('0x7e')]();var _0x8dc531={'body':_0x5f554a[_0x053c('0x4f')],'channel':_0x053c('0x7f')};var _0x56b08c=[];var _0x5a27be=[];var _0x36d753={};var _0x1b8b8a=![];return db[_0x053c('0x80')][_0x053c('0x57')]()[_0x053c('0x14')](function(_0x15adb8){if(!_0x15adb8){throw new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x82'));}_0x56b08c=_[_0x053c('0x83')](_[_0x053c('0x39')](_0x15adb8),['createdAt',_0x053c('0x84')]);_0x5a27be=_['difference'](_[_0x053c('0x39')](_0x15adb8),[_0x053c('0x85'),_0x053c('0x84'),_0x053c('0x86'),_0x053c('0x87')]);if(_0x5f554a['body']['id']){delete _0x5f554a[_0x053c('0x4f')]['id'];}if(_[_0x053c('0x6d')](_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')])){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5f554a[_0x053c('0x4f')]['body'])||_0x5f554a[_0x053c('0x4f')][_0x053c('0x4f')]===''){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))](_0x053c('0x8a'));}if(_[_0x053c('0x6d')](_0x5f554a['body'][_0x053c('0x8b')])){throw new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x8c')+_0x5a27be);}if(!_[_0x053c('0x8d')](_0x5a27be,_0x5f554a[_0x053c('0x4f')][_0x053c('0x8b')])){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a27be);}_0x36d753[_0x5f554a[_0x053c('0x4f')][_0x053c('0x8b')]]=_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')];})[_0x053c('0x14')](function(){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5f554a[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x8e')],'as':_0x053c('0x8f'),'include':[{'model':db[_0x053c('0x80')],'as':_0x053c('0x90'),'where':_0x36d753,'limit':0x1,'order':[[_0x053c('0x84'),_0x053c('0x91')]]}]},{'model':db[_0x053c('0x92')],'as':_0x053c('0x93')}]});})['then'](handleEntityNotFound(_0x204d87,null))[_0x053c('0x14')](function(_0x18a8f7){if(_0x18a8f7&&_0x18a8f7[_0x053c('0x8f')]){_0x8dc531[_0x053c('0x94')]=_0x18a8f7;_0x8dc531['applications']=_0x18a8f7[_0x053c('0x93')];_0x8dc531[_0x053c('0x95')]=_0x18a8f7['List'];_0x8dc531[_0x053c('0x96')]=_[_0x053c('0x97')](_0x8dc531['applications'],['priority'],['asc']);if(_0x8dc531[_0x053c('0x94')][_0x053c('0x93')]){delete _0x8dc531[_0x053c('0x94')][_0x053c('0x93')];}if(_0x8dc531[_0x053c('0x94')][_0x053c('0x8f')]&&_0x8dc531[_0x053c('0x94')][_0x053c('0x8f')][_0x053c('0x90')][_0x053c('0x3d')]){return _0x8dc531[_0x053c('0x94')]['List']['Contacts'][0x0];}var _0x32602f=_['defaults'](_0x5f554a['body'],{'firstName':_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')],'ListId':_0x18a8f7[_0x053c('0x87')]});_0x32602f[_0x5f554a['body'][_0x053c('0x8b')]]=_0x5f554a[_0x053c('0x4f')]['from'];return db['CmContact'][_0x053c('0x4e')](_0x32602f,{'fields':_0x56b08c,'raw':!![]});}})[_0x053c('0x14')](handleEntityNotFound(_0x204d87,null))['then'](function(_0x1b356b){_0x8dc531[_0x053c('0x98')]=_0x1b356b;var _0x4ea62d=_0x5f554a['body'][_0x053c('0x99')];if(_0x5f554a[_0x053c('0x7c')][_0x053c('0x9a')]){_0x4ea62d=_0x5f554a[_0x053c('0x7c')]['cf-connecting-ip'];}else if(_0x5f554a[_0x053c('0x7c')]['x-forwarded-for']){_0x4ea62d=_[_0x053c('0x9b')](_0x5f554a[_0x053c('0x7c')][_0x053c('0x9c')]['split'](','));}if(_0x1b356b){var _0x2c83aa={'ContactId':_0x1b356b['id'],'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'from':(_0x1b356b[_0x053c('0x9d')]||'')+'\x20'+(_0x1b356b[_0x053c('0x9e')]||''),'customerIp':_0x4ea62d,'customerPort':_0x5f554a[_0x053c('0x7c')][_0x053c('0x9f')]?_0x5f554a[_0x053c('0x7c')][_0x053c('0x9f')]:null,'referer':_0x5f554a[_0x053c('0x4f')]['referer'],'browserName':_0x263d27[_0x053c('0xa0')][_0x053c('0x2c')]&&_0x263d27[_0x053c('0xa0')][_0x053c('0xa1')]?util[_0x053c('0xa2')](_0x053c('0xa3'),_0x263d27[_0x053c('0xa0')][_0x053c('0x2c')],_0x263d27['browser'][_0x053c('0xa1')]):_0x053c('0xa4'),'browserVersion':_0x263d27[_0x053c('0xa0')]['version']||'unknown','osName':util['format'](_0x053c('0xa3'),_0x263d27['os']['name'],_0x263d27['os'][_0x053c('0xa1')]),'osVersion':_0x263d27['os'][_0x053c('0xa1')],'deviceModel':_0x263d27['device'][_0x053c('0x36')]&&_0x263d27['device'][_0x053c('0xa5')]?util[_0x053c('0xa2')](_0x053c('0xa6'),_0x263d27[_0x053c('0xa7')][_0x053c('0x36')],_0x263d27[_0x053c('0xa7')][_0x053c('0xa5')],_0x263d27[_0x053c('0xa7')][_0x053c('0x34')]):null,'deviceVendor':_0x263d27[_0x053c('0xa7')][_0x053c('0xa5')],'deviceType':_0x263d27['device'][_0x053c('0x34')],'formData':JSON[_0x053c('0xa8')](_0x5f554a[_0x053c('0x4f')])};var _0x5094a7={'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'closed':![]};if(_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')]){_0x5094a7[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')];return db[_0x053c('0xaa')][_0x053c('0x4d')]({'where':_0x5094a7})[_0x053c('0x14')](function(_0x5d1dd5){if(_0x5d1dd5){return[_0x5d1dd5,![]];}_0x2c83aa[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')];_0x2c83aa['externalUrl']=_0x5f554a[_0x053c('0x4f')]['externalUrl'];return db[_0x053c('0xaa')][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x5b7594){return[_0x5b7594,!![]];});});}_0x5094a7[_0x053c('0xab')]=_0x1b356b['id'];if(_0x5f554a[_0x053c('0x4f')][_0x053c('0xac')]&&_0x5f554a[_0x053c('0x4f')][_0x053c('0xac')]['id']){_0x5094a7['id']=_0x5f554a[_0x053c('0x4f')]['interaction']['id'];return db[_0x053c('0xaa')][_0x053c('0x4d')]({'where':_0x5094a7})[_0x053c('0x14')](function(_0x26ee8a){if(_0x26ee8a){return[_0x26ee8a,![]];}return db[_0x053c('0xaa')][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x2084ef){return[_0x2084ef,!![]];});});}return db['ChatInteraction'][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x35b308){return[_0x35b308,!![]];});}})['spread'](function(_0x44156c,_0xcfa528){if(_0x44156c){_0x1b8b8a=_0xcfa528;if(!_0xcfa528){var _0x2208d6={'from':(_0x8dc531['contact'][_0x053c('0x9d')]||'')+'\x20'+(_0x8dc531[_0x053c('0x98')][_0x053c('0x9e')]||'')};if(_0x5f554a['body'][_0x053c('0xa9')]&&_0x5f554a[_0x053c('0x4f')][_0x053c('0xad')]&&_0x5f554a['body'][_0x053c('0xa9')]!=_0x5f554a[_0x053c('0x4f')][_0x053c('0xad')]){_0x2208d6[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')]['messageId'];}return _0x44156c[_0x053c('0x26')](_0x2208d6);}else{return _0x44156c;}}})[_0x053c('0x14')](function(_0x2504a6){_0x8dc531[_0x053c('0xac')]=_0x2504a6[_0x053c('0x28')]({'plain':!![]});_0x8dc531[_0x053c('0xac')][_0x053c('0xae')]=_0x1b8b8a;if(_0x8dc531['interaction']['created']){if(_0x8dc531['account']['autoclose']){_0x8dc531[_0x053c('0x96')][_0x053c('0xaf')]({'id':0x0,'priority':_0x8dc531['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x053c('0xb0')});}}return db['ChatMessage'][_0x053c('0x4e')]({'body':_0x5f554a[_0x053c('0x4f')][_0x053c('0x4f')],'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'ChatInteractionId':_0x2504a6['id'],'direction':'in','ContactId':_0x8dc531[_0x053c('0x98')]['id'],'AttachmentId':_0x5f554a[_0x053c('0x4f')][_0x053c('0xb1')]});})[_0x053c('0x14')](function(_0x38dfce){_0x8dc531[_0x053c('0x19')]=_0x38dfce;if(_0x8dc531[_0x053c('0xac')][_0x053c('0xb2')]){return db['User'][_0x053c('0x4d')]({'attributes':['id',_0x053c('0x2c')],'where':{'id':_0x8dc531[_0x053c('0xac')][_0x053c('0xb2')]}})['then'](function(_0x3753b2){if(_0x3753b2){_0x8dc531[_0x053c('0x96')][_0x053c('0xb3')]({'id':0x0,'priority':0x0,'app':_0x053c('0xb4'),'appdata':_0x3753b2['name']+','+(_0x8dc531[_0x053c('0x94')][_0x053c('0xb5')]||0xa),'interval':_0x053c('0xb0')});_0x8dc531[_0x053c('0xb6')]=!![];}return respondWithRpcPromise(_0x053c('0xb7'),_0x053c('0xb8'),_0x8dc531);});}return respondWithRpcPromise(_0x053c('0xb7'),_0x053c('0xb8'),_0x8dc531);})[_0x053c('0x14')](function(_0x31d282){respondWithRpcPromise(_0x053c('0xb9'),_0x053c('0xb9'),{'event':_0x053c('0x7a'),'message':_0x31d282},client9002);return _0x31d282;})['then'](respondWithResult(_0x204d87,null))[_0x053c('0x1b')](handleError(_0x204d87,null));};exports[_0x053c('0xba')]=function(_0x3d1cf3,_0x4465e0){var _0x5ba703,_0x476798,_0x26cd40;var _0x24ec5a=[];var _0x24beaa={};var _0x4cf15e=_0x3d1cf3['files']||[];var _0x10d3e2=[];var _0x5af8dd;return db[_0x053c('0x80')][_0x053c('0x57')]()['then'](function(_0x246bad){if(!_0x246bad){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))](_0x053c('0x82'));}_0x24ec5a=_[_0x053c('0x83')](_['keys'](_0x246bad),[_0x053c('0x85'),'updatedAt','CompanyId',_0x053c('0x87')]);if(_0x3d1cf3['body']['id']){delete _0x3d1cf3[_0x053c('0x4f')]['id'];}if(_['isNil'](_0x3d1cf3['body'][_0x053c('0x88')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0xbb')));}if(_[_0x053c('0x6d')](_0x3d1cf3['body'][_0x053c('0x4f')])||_0x3d1cf3['body'][_0x053c('0x4f')]===''){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x8a')));}if(_['isNil'](_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0xbd')+_0x24ec5a));}if(!_[_0x053c('0x8d')](_0x24ec5a,_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db['Sequelize'][(_0x053c('0x89'))](_0x053c('0xbe')+_0x24ec5a));}_0x24beaa[_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')]]=_0x3d1cf3[_0x053c('0x4f')][_0x053c('0x88')];})[_0x053c('0x14')](function(){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x3d1cf3[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x8e')],'as':_0x053c('0x8f')},{'model':db[_0x053c('0xbf')],'as':_0x053c('0xbf')}]});})[_0x053c('0x14')](handleEntityNotFound(_0x4465e0,null))['then'](function(_0x1d8862){if(_0x1d8862&&_0x1d8862[_0x053c('0x8f')]){_0x476798=_0x1d8862;var _0x3a1eaa=_[_0x053c('0xb')](_0x3d1cf3['body'],{'firstName':_0x3d1cf3[_0x053c('0x4f')][_0x053c('0x88')],'phone':_0x3d1cf3['body'][_0x053c('0x88')],'ListId':_0x1d8862[_0x053c('0x87')]});_0x3a1eaa[_0x3d1cf3['body'][_0x053c('0xbc')]]=_0x3d1cf3['body']['from'];return db[_0x053c('0x80')][_0x053c('0xc0')]({'where':_0x24beaa,'defaults':_0x3a1eaa});}})['spread'](function(_0x39c8c6){if(_0x39c8c6){_0x26cd40=_0x39c8c6;var _0x56ff95=fs['readFileSync'](path['join'](config[_0x053c('0x71')],'server/files/templates/chatOfflineMessage.ejs'),_0x053c('0xc1'));var _0x533e87=ejs[_0x053c('0xc2')](_0x56ff95,{'body':_[_0x053c('0xc3')](_0x3d1cf3[_0x053c('0x4f')]['body']),'bodyTitle':_0x476798[_0x053c('0xc4')]});return db[_0x053c('0xc5')][_0x053c('0x4e')]({'body':_0x533e87,'plainBody':htmlToText[_0x053c('0xc6')](_0x533e87),'ContactId':_0x39c8c6['id'],'ChatWebsiteId':_0x476798['id']});}})[_0x053c('0x14')](function(_0x25471c){_0x5af8dd=_0x25471c;if(_0x4cf15e[_0x053c('0x3d')]){var _0x40c1ae=_0x4cf15e[_0x053c('0x37')](function(_0x232c69){return{'name':_0x232c69['originalname'],'basename':_0x232c69['filename'],'type':_0x232c69[_0x053c('0xc7')],'ChatOfflineMessageId':_0x25471c['id']};});_0x10d3e2=_0x40c1ae['map'](_0x23848f=>{var _0x5c9a99={'filename':_0x23848f['name'],'path':path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0xc8'),_0x053c('0xc9'),'attachments',_0x053c('0xca'),_0x23848f[_0x053c('0xcb')])};return _0x5c9a99;});if(!_0x476798[_0x053c('0xcc')]){return db[_0x053c('0xcd')]['transaction'](function(_0x4264a2){return db[_0x053c('0xce')]['bulkCreate'](_0x40c1ae,{'transaction':_0x4264a2});});}}})[_0x053c('0x14')](function(){if(_0x5af8dd){_0x5ba703=_0x5af8dd;return db['MailAccount'][_0x053c('0x60')]({'where':{'service':!![]},'include':[{'model':db[_0x053c('0xcf')],'as':_0x053c('0xd0'),'raw':!![],'include':[{'model':db[_0x053c('0xd1')],'as':_0x053c('0xd1'),'raw':!![]}]}]});}})[_0x053c('0x14')](function(_0x3a6283){if(_0x3a6283&&_0x3a6283[_0x053c('0xd0')]&&_0x476798[_0x053c('0xd2')]&&_0x476798[_0x053c('0xd3')]){var _0x30883a=_0x3a6283[_0x053c('0xd4')]();return respondWithRpcPromise(_0x053c('0xd5'),_0x053c('0xd6'),{'account':_0x30883a,'message':{'from':util[_0x053c('0xa2')](_0x053c('0xd7'),_0x3a6283[_0x053c('0x2c')],_0x3a6283[_0x053c('0xd8')]||_0x3a6283[_0x053c('0xd0')][_0x053c('0x50')]),'to':_0x476798[_0x053c('0xd3')],'subject':_0x476798['offlineMessageSubject'],'html':_0x5ba703[_0x053c('0x4f')],'attachments':_0x10d3e2}},client9003)[_0x053c('0x14')](function(){return _0x5ba703;})[_0x053c('0x1b')](function(_0x29720b){logger[_0x053c('0x18')](_0x29720b);});}})['then'](function(){if(_0x476798&&_0x476798['openNewInteraction']&&_0x476798['MailAccountId']){var _0x55f1fd=[];if(_0x4cf15e[_0x053c('0x3d')]){_0x55f1fd=_0x4cf15e[_0x053c('0x37')](function(_0x548c74){return{'name':_0x548c74[_0x053c('0xd9')],'basename':_0x548c74[_0x053c('0x64')],'type':_0x548c74['mimetype'],'ChatOfflineMessageId':_0x5af8dd['id']};});}var _0x193e34;if(!_[_0x053c('0x6d')](_0x476798[_0x053c('0xda')])){var _0x368544=_[_0x053c('0x37')](_0x3d1cf3[_0x053c('0x4f')],function(_0x321880){return _0x321880;});var _0xdb27fe=_[_0x053c('0xdb')](_0x368544)[0x0];var _0x5f333e=_[_0x053c('0xdc')](_0xdb27fe,function(_0x63142d){return _0x63142d;});_0x193e34=_0x5f333e[0x1][_0x476798[_0x053c('0xda')]];}var _0x2d7bd5={'from':_0x26cd40['email'],'firstName':_0x26cd40['firstName'],'lastName':_0x26cd40[_0x053c('0x9e')],'mapKey':_0x053c('0xd8'),'message':{'from':_0x26cd40[_0x053c('0xd8')],'to':_0x476798['MailAccount']['email'],'cc':'','subject':_['isNil'](_0x193e34)?_0x476798[_0x053c('0xdd')]:_0x193e34,'messageId':'','sentAt':new Date(),'attach':_0x55f1fd[_0x053c('0x3d')],'attachments':_0x55f1fd,'originChannel':_0x053c('0xde'),'ChatWebsiteId':_0x476798['id'],'ChatOfflineMessageId':_0x5ba703['id'],'originTo':_0x476798['MailAccount'][_0x053c('0xd8')]},'body':_0x5ba703[_0x053c('0x4f')]};var _0x27c9c4={'account':{'id':_0x476798[_0x053c('0xdf')]},'body':_0x2d7bd5,'log':_0x053c('0xe0')};return respondWithRpcPromise(_0x053c('0xe0'),'notifyMail',_0x27c9c4,client9001)[_0x053c('0x14')](function(){return _0x5ba703;})[_0x053c('0x1b')](function(_0x453637){logger[_0x053c('0x18')](_0x453637);});}return;})[_0x053c('0x14')](function(){if(_0x5ba703){return _0x5ba703;}})[_0x053c('0x14')](respondWithResult(_0x4465e0,null))['catch'](function(_0x2980aa){logger['error'](_0x053c('0x1b'),_0x2980aa);for(var _0x21305c of _0x4cf15e){var _0xb4f1f1=path['join'](config['root'],'server',_0x053c('0xc9'),_0x053c('0xe1'),_0x053c('0xca'),_0x21305c[_0x053c('0x64')]);fs_extra[_0x053c('0xe2')](_0xb4f1f1)[_0x053c('0x1b')](function(_0x17c9d5){logger[_0x053c('0x18')]('Could\x20not\x20remove\x20attachment\x20file',_0xb4f1f1,_0x17c9d5);});}});};exports[_0x053c('0xe3')]=function(_0x5b19e8,_0x41bfc5){return db[_0x053c('0xaa')]['find']({'where':{'id':_0x5b19e8[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x41bfc5,null))[_0x053c('0x14')](function(_0x1d12ea){if(_0x1d12ea){return _0x1d12ea[_0x053c('0xe3')](_0x5b19e8[_0x053c('0x4f')][_0x053c('0x5c')],_[_0x053c('0xe4')](_0x5b19e8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x41bfc5,null))[_0x053c('0x1b')](handleError(_0x41bfc5,null));};exports[_0x053c('0xe5')]=function(_0x5b2e19,_0x1c750c){var _0x1801de={'raw':![],'where':{}};var _0x32033b={};var _0x3477dc={'count':0x0,'rows':[]};return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x5b2e19['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1c750c,null))[_0x053c('0x14')](function(_0x4da8e7){if(_0x4da8e7){_0x32033b[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0xaa')]['rawAttributes']);_0x32033b[_0x053c('0x38')]=_['keys'](_0x5b2e19[_0x053c('0x38')]);_0x32033b['filters']=_['intersection'](_0x32033b['model'],_0x32033b[_0x053c('0x38')]);_0x1801de[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x32033b[_0x053c('0x36')],qs['fields'](_0x5b2e19['query'][_0x053c('0x3c')]));_0x1801de[_0x053c('0x3b')]=_0x1801de[_0x053c('0x3b')][_0x053c('0x3d')]?_0x1801de[_0x053c('0x3b')]:_0x32033b[_0x053c('0x36')];if(!_0x5b2e19[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x1801de[_0x053c('0x22')]=qs['limit'](_0x5b2e19[_0x053c('0x38')][_0x053c('0x22')]);_0x1801de[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x5b2e19[_0x053c('0x38')]['offset']);}_0x1801de['order']=qs[_0x053c('0x41')](_0x5b2e19[_0x053c('0x38')][_0x053c('0x41')]);_0x1801de['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x5b2e19[_0x053c('0x38')],_0x32033b[_0x053c('0x43')]));_0x1801de[_0x053c('0x42')][_0x053c('0x59')]=_0x4da8e7['id'];if(_0x5b2e19['query']['filter']){_0x1801de[_0x053c('0x42')]=_[_0x053c('0x46')](_0x1801de['where'],{'$or':_[_0x053c('0x37')](_0x1801de['attributes'],function(_0x537078){var _0x373fa2={};_0x373fa2[_0x537078]={'$like':'%'+_0x5b2e19['query'][_0x053c('0x45')]+'%'};return _0x373fa2;})});}_0x1801de=_[_0x053c('0x46')]({},_0x1801de,_0x5b2e19[_0x053c('0x47')]);return db[_0x053c('0xaa')][_0x053c('0x23')]({'where':_0x1801de[_0x053c('0x42')]})['then'](function(_0x23846e){_0x3477dc[_0x053c('0x23')]=_0x23846e;if(_0x5b2e19[_0x053c('0x38')][_0x053c('0x4c')]){_0x1801de[_0x053c('0x48')]=[{'model':db[_0x053c('0x80')],'as':_0x053c('0xe6'),'required':![]},{'model':db[_0x053c('0xe7')],'as':_0x053c('0xe8'),'attributes':['name',_0x053c('0xe9'),_0x053c('0xea')],'required':![]},{'model':db[_0x053c('0xeb')],'as':'Tags','attributes':['id','name',_0x053c('0xec')],'where':_0x5b2e19[_0x053c('0x38')]['tag']?{'id':_0x5b2e19[_0x053c('0x38')][_0x053c('0xed')]}:undefined,'required':_0x5b2e19['query'][_0x053c('0xed')]?!![]:![]}];}return db[_0x053c('0xaa')][_0x053c('0x49')](_0x1801de);})[_0x053c('0x14')](function(_0x4859a3){_0x3477dc[_0x053c('0x4a')]=_0x4859a3;return _0x3477dc;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x1c750c,_0x1801de))['catch'](handleError(_0x1c750c,null));};function iftimePromise(_0x3e46ed,_0x26c555){return respondWithRpcPromise(_0x053c('0xee'),_0x053c('0xef'),{'command':_0x26c555[_0x053c('0xf0')]?util[_0x053c('0xa2')](_0x053c('0xf1'),_0x3e46ed['interval'],_0x26c555['timezone']):util['format'](_0x053c('0xf2'),_0x3e46ed[_0x053c('0xf3')])},client9002)[_0x053c('0x14')](function(_0x2e2c87){var _0x434ea4=_0x2e2c87&&_0x2e2c87[_0x053c('0xf4')]('true')>=0x0?!![]:![];logger['info'](_0x053c('0xf5'),_0x26c555['id'],_0x3e46ed['id'],_0x3e46ed['interval'],_0x434ea4?'ONLINE':_0x053c('0xf6'),_0x26c555[_0x053c('0xf0')]?_0x26c555[_0x053c('0xf0')]:_0x053c('0xf7'));return _0x434ea4;})[_0x053c('0x1b')](function(_0x392855){logger[_0x053c('0x18')](_0x053c('0xf5'),_0x26c555['id'],_0x3e46ed['id'],_0x3e46ed[_0x053c('0xf3')],util[_0x053c('0xf8')](_0x392855,{'showHidden':![],'depth':null}),_0x26c555[_0x053c('0xf0')]?_0x26c555[_0x053c('0xf0')]:_0x053c('0xf7'));return![];});}exports[_0x053c('0xef')]=function(_0x553923,_0x1a18d1){var _0x4b9699=0x0;var _0x37106f=0x0;var _0x232d7f=![];var _0x511f61;var _0xbf99eb;return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x553923[_0x053c('0x56')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x053c('0xf9')],'as':_0x053c('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1a18d1,null))[_0x053c('0x14')](function(_0x100c30){if(_0x100c30){_0x511f61=_0x100c30;return _0x100c30[_0x053c('0xfb')]({'raw':!![]});}})['then'](function(_0x20ead2){if(_0x511f61){if(_0x20ead2){_0xbf99eb=_0x20ead2;}}return require(_0x053c('0xfc'))['getLicense']();})[_0x053c('0x14')](function(_0x3d0ade){if(_0x3d0ade){_0x37106f=_0x3d0ade[_0x053c('0xfd')];_0x232d7f=_0x3d0ade[_0x053c('0x6c')];}})[_0x053c('0x14')](function(){return db['ChatInteraction'][_0x053c('0x23')]({'where':{'closed':![]}});})[_0x053c('0x14')](function(_0x568df2){_0x4b9699=_0x568df2;if(_0x37106f&&_0x568df2>_0x37106f){return db[_0x053c('0xfe')][_0x053c('0x60')]({'where':{'id':0x1}})[_0x053c('0x14')](function(_0x4be783){if(_0x4be783){_0x4be783[_0x053c('0xff')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x511f61[_0x053c('0xf9')]&&_0x511f61['Interval'][_0x053c('0xfa')]){var _0x1f9fd7=[];for(var _0x399e46=0x0;_0x399e46<_0x511f61[_0x053c('0xf9')][_0x053c('0xfa')][_0x053c('0x3d')];_0x399e46++){var _0x292993=_0x511f61[_0x053c('0xf9')][_0x053c('0xfa')][_0x399e46][_0x053c('0x28')]({'plain':!![]});_0x1f9fd7['push'](iftimePromise(_0x292993,_0x511f61));}return BPromise[_0x053c('0x100')](_0x1f9fd7)[_0x053c('0x14')](function(_0x37ee28){return _['some'](_0x37ee28);});}else{return!![];}})[_0x053c('0x14')](function(_0x59b670){var _0x1b0a59=fs['readFileSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x101')),_0x053c('0xc1'));var _0x1153b7={'remote':_0x511f61[_0x053c('0x102')],'query':querystring[_0x053c('0xa8')](_[_0x053c('0x46')](_0x511f61['get']({'plain':!![]}),{'customerIp':_0x553923[_0x053c('0x7c')][_0x053c('0x9c')]||_0x553923[_0x053c('0x7c')]['x-real-ip']||_0x553923[_0x053c('0x103')][_0x053c('0x104')]||_0x553923['ip'],'referer':_0x553923[_0x053c('0x7c')][_0x053c('0x105')],'openedInteractions':_0x4b9699,'maxInteractions':_0x37106f,'virtual':_0x232d7f[_0x053c('0xfd')],'online':_0x59b670,'custom':_0x232d7f}))[_0x053c('0x106')](/'/g,'\x5c\x27')};_0x1a18d1[_0x053c('0x2d')](ejs[_0x053c('0xc2')](Mustache[_0x053c('0xc2')](_0x1b0a59,_0x1153b7),{'proactiveActions':_0xbf99eb,'alignment':_0x511f61[_0x053c('0x107')],'verticalAlignment':_0x511f61[_0x053c('0x108')],'div_color':_0x511f61[_0x053c('0xec')],'labelText':_0x511f61[_0x053c('0x109')],'text_color':_0x511f61[_0x053c('0x10a')],'text_button_color':_0x511f61[_0x053c('0x10b')],'button_color':_0x511f61['color_button'],'background_color':_0x511f61[_0x053c('0x10c')],'hideWhenOffline':_0x511f61['hideWhenOffline'],'interval':_0x511f61[_0x053c('0x10d')]}));})['catch'](handleError(_0x1a18d1,null));};exports['addApplications']=function(_0x2f479f,_0x5a66ae){var _0x167143=_0x2f479f['params']['id'];var _0x277c48=_0x2f479f[_0x053c('0x4f')];var _0x1b2b35=0xc8;var _0x5e4809=null;return db['sequelize'][_0x053c('0x10e')]({'isolationLevel':db[_0x053c('0xcd')][_0x053c('0x10f')][_0x053c('0x110')][_0x053c('0x111')]},function(_0xcdd2da){return db[_0x053c('0x31')]['findOne']({'where':{'id':_0x167143},'transaction':_0xcdd2da})[_0x053c('0x14')](function(_0x15cd52){if(_0x15cd52){return db[_0x053c('0x92')][_0x053c('0x27')]({'where':{'ChatWebsiteId':_0x167143},'transaction':_0xcdd2da})[_0x053c('0x14')](function(){var _0x5cb678=_['map'](_0x277c48,function(_0x200d5a){_0x200d5a['ChatWebsiteId']=_0x167143;return _0x200d5a;});return db[_0x053c('0x92')][_0x053c('0x112')](_0x5cb678,{'transaction':_0xcdd2da});});}else{_0x1b2b35=0x194;_0x5e4809=[];}});})['then'](function(){if(_0x1b2b35!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x167143},'order':_0x053c('0x113')})[_0x053c('0x14')](function(_0x1012b7){_0x5e4809=_0x1012b7;});}})['catch'](function(_0xfc639d){_0x1b2b35=0x1f4;logger[_0x053c('0x18')](_0xfc639d[_0x053c('0x2b')]);if(_0xfc639d['name']){delete _0xfc639d[_0x053c('0x2c')];}_0x5e4809=_0xfc639d;})[_0x053c('0x114')](function(){if(_0x5e4809===null){_0x5a66ae['sendStatus'](_0x1b2b35);}else{if(_0x1b2b35===0x1f4){_0x5a66ae[_0x053c('0x1d')](_0x1b2b35)[_0x053c('0x2d')](_0x5e4809);}else{_0x5a66ae['status'](_0x1b2b35)['json'](_0x5e4809);}}});};exports[_0x053c('0x115')]=function(_0x27d87b,_0x5a571c){var _0x312b95={};var _0x36e305={};var _0x49c555;var _0x2ea465;return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x27d87b[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5a571c,null))[_0x053c('0x14')](function(_0x219c81){if(_0x219c81){_0x49c555=_0x219c81;_0x36e305[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x92')]['rawAttributes']);_0x36e305[_0x053c('0x38')]=_['keys'](_0x27d87b[_0x053c('0x38')]);_0x36e305[_0x053c('0x43')]=_[_0x053c('0x3a')](_0x36e305[_0x053c('0x36')],_0x36e305[_0x053c('0x38')]);_0x312b95['attributes']=_['intersection'](_0x36e305[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x27d87b[_0x053c('0x38')]['fields']));_0x312b95[_0x053c('0x3b')]=_0x312b95[_0x053c('0x3b')]['length']?_0x312b95[_0x053c('0x3b')]:_0x36e305['model'];_0x312b95['order']=qs[_0x053c('0x41')](_0x27d87b[_0x053c('0x38')][_0x053c('0x41')]);_0x312b95[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x27d87b[_0x053c('0x38')],_0x36e305['filters']));if(_0x27d87b[_0x053c('0x38')][_0x053c('0x45')]){_0x312b95[_0x053c('0x42')]=_[_0x053c('0x46')](_0x312b95[_0x053c('0x42')],{'$or':_['map'](_0x312b95[_0x053c('0x3b')],function(_0x265026){var _0x4b9bbe={};_0x4b9bbe[_0x265026]={'$like':'%'+_0x27d87b['query'][_0x053c('0x45')]+'%'};return _0x4b9bbe;})});}_0x312b95=_[_0x053c('0x46')]({},_0x312b95,_0x27d87b[_0x053c('0x47')]);return _0x49c555['getApplications'](_0x312b95);}})[_0x053c('0x14')](function(_0x3e18d2){if(_0x3e18d2){_0x2ea465=_0x3e18d2['length'];if(!_0x27d87b[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x312b95[_0x053c('0x22')]=qs['limit'](_0x27d87b[_0x053c('0x38')][_0x053c('0x22')]);_0x312b95[_0x053c('0x20')]=qs['offset'](_0x27d87b[_0x053c('0x38')]['offset']);}return _0x49c555[_0x053c('0x115')](_0x312b95);}})[_0x053c('0x14')](function(_0x3fe8a0){if(_0x3fe8a0){return _0x3fe8a0?{'count':_0x2ea465,'rows':_0x3fe8a0}:null;}})['then'](respondWithResult(_0x5a571c,null))[_0x053c('0x1b')](handleError(_0x5a571c,null));};exports['addProactiveActions']=function(_0x46174c,_0x1b2c84){return db[_0x053c('0x116')][_0x053c('0x4d')]({'where':{'id':_0x46174c[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1b2c84,null))[_0x053c('0x14')](function(_0x115d1e){if(_0x115d1e){return _0x115d1e[_0x053c('0x117')](_0x46174c[_0x053c('0x4f')]['ids'],_[_0x053c('0xe4')](_0x46174c[_0x053c('0x4f')],['ids','id'])||{});}})[_0x053c('0x14')](respondWithResult(_0x1b2c84,null))[_0x053c('0x1b')](handleError(_0x1b2c84,null));};exports[_0x053c('0xfb')]=function(_0x1f7a54,_0x2e2f9f){var _0x19cf7e={};var _0x36fbde={};var _0x41e516;var _0x1b4cf2;return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x1f7a54['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x2e2f9f,null))['then'](function(_0x23ff76){if(_0x23ff76){_0x41e516=_0x23ff76;_0x36fbde[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x118')]['rawAttributes']);_0x36fbde[_0x053c('0x38')]=_['keys'](_0x1f7a54[_0x053c('0x38')]);_0x36fbde['filters']=_[_0x053c('0x3a')](_0x36fbde['model'],_0x36fbde[_0x053c('0x38')]);_0x19cf7e[_0x053c('0x3b')]=_['intersection'](_0x36fbde['model'],qs[_0x053c('0x3c')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x3c')]));_0x19cf7e[_0x053c('0x3b')]=_0x19cf7e[_0x053c('0x3b')]['length']?_0x19cf7e[_0x053c('0x3b')]:_0x36fbde[_0x053c('0x36')];_0x19cf7e['order']=qs[_0x053c('0x41')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x41')]);_0x19cf7e['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x1f7a54[_0x053c('0x38')],_0x36fbde[_0x053c('0x43')]));if(_0x1f7a54[_0x053c('0x38')]['filter']){_0x19cf7e[_0x053c('0x42')]=_['merge'](_0x19cf7e['where'],{'$or':_[_0x053c('0x37')](_0x19cf7e[_0x053c('0x3b')],function(_0x1ea165){var _0x6532b7={};_0x6532b7[_0x1ea165]={'$like':'%'+_0x1f7a54[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x6532b7;})});}_0x19cf7e=_[_0x053c('0x46')]({},_0x19cf7e,_0x1f7a54[_0x053c('0x47')]);return _0x41e516[_0x053c('0xfb')](_0x19cf7e);}})[_0x053c('0x14')](function(_0x3e0da3){if(_0x3e0da3){_0x1b4cf2=_0x3e0da3[_0x053c('0x3d')];if(!_0x1f7a54['query']['hasOwnProperty']('nolimit')){_0x19cf7e[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x22')]);_0x19cf7e[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x20')]);}return _0x41e516[_0x053c('0xfb')](_0x19cf7e);}})[_0x053c('0x14')](function(_0x184c78){if(_0x184c78){return _0x184c78?{'count':_0x1b4cf2,'rows':_0x184c78}:null;}})['then'](respondWithResult(_0x2e2f9f,null))[_0x053c('0x1b')](handleError(_0x2e2f9f,null));};exports[_0x053c('0x119')]=function(_0x14473c,_0x1bb00e){var _0x15db53=_0x14473c[_0x053c('0x38')][_0x053c('0x11a')]===_0x053c('0x11b')?_0x053c('0x11c'):_0x053c('0x11d');return db[_0x053c('0x31')][_0x053c('0x4d')]({'attributes':['id',_0x15db53],'where':{'id':_0x14473c['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1bb00e,null))[_0x053c('0x14')](function(_0x3f0b4e){if(_0x3f0b4e){var _0x5ab042=_0x3f0b4e[_0x15db53];var _0xff722e=_0x5ab042&&_0x5ab042[_0x053c('0x11e')]?_0x5ab042[_0x053c('0x11e')]:[];_0x1bb00e[_0x053c('0x2d')]({'fromKey':_['isNil'](_0x5ab042[_0x053c('0x11f')])?undefined:_0x5ab042['fromKey'],'count':_0xff722e['length'],'rows':_0xff722e});}})[_0x053c('0x1b')](handleError(_0x1bb00e,null));};exports['getOfflineMessages']=function(_0x4467a8,_0x57fd76){var _0x1d98fa={'raw':![],'where':{}};var _0x431bb7={};var _0xadae69={'count':0x0,'rows':[]};return db[_0x053c('0x31')]['findOne']({'where':{'id':_0x4467a8['params']['id']}})['then'](handleEntityNotFound(_0x57fd76,null))[_0x053c('0x14')](function(_0x417a3f){if(_0x417a3f){_0x431bb7[_0x053c('0x36')]=_[_0x053c('0x39')](db['ChatOfflineMessage']['rawAttributes']);_0x431bb7[_0x053c('0x38')]=_[_0x053c('0x39')](_0x4467a8[_0x053c('0x38')]);_0x431bb7['filters']=_[_0x053c('0x3a')](_0x431bb7['model'],_0x431bb7['query']);_0x1d98fa[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x431bb7[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x4467a8[_0x053c('0x38')]['fields']));_0x1d98fa['attributes']=_0x1d98fa[_0x053c('0x3b')][_0x053c('0x3d')]?_0x1d98fa['attributes']:_0x431bb7[_0x053c('0x36')];if(!_0x4467a8['query'][_0x053c('0x3e')]('nolimit')){_0x1d98fa[_0x053c('0x22')]=qs['limit'](_0x4467a8['query'][_0x053c('0x22')]);_0x1d98fa['offset']=qs[_0x053c('0x20')](_0x4467a8['query'][_0x053c('0x20')]);}_0x1d98fa['order']=qs[_0x053c('0x41')](_0x4467a8[_0x053c('0x38')][_0x053c('0x41')]);_0x1d98fa[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x4467a8[_0x053c('0x38')],_0x431bb7[_0x053c('0x43')]));_0x1d98fa[_0x053c('0x42')][_0x053c('0x59')]=_0x417a3f['id'];if(_0x4467a8['query'][_0x053c('0x45')]){_0x1d98fa['where']=_['merge'](_0x1d98fa['where'],{'$or':_[_0x053c('0x37')](_0x1d98fa[_0x053c('0x3b')],function(_0x351b9d){var _0x1e589a={};_0x1e589a[_0x351b9d]={'$like':'%'+_0x4467a8[_0x053c('0x38')]['filter']+'%'};return _0x1e589a;})});}_0x1d98fa=_[_0x053c('0x46')]({},_0x1d98fa,_0x4467a8[_0x053c('0x47')]);return db[_0x053c('0xc5')][_0x053c('0x23')]({'where':_0x1d98fa[_0x053c('0x42')]})[_0x053c('0x14')](function(_0x3affb0){_0xadae69[_0x053c('0x23')]=_0x3affb0;if(_0x4467a8[_0x053c('0x38')][_0x053c('0x4c')]){_0x1d98fa[_0x053c('0x48')]=[{'all':!![]}];}else{_0x1d98fa[_0x053c('0x48')]=[{'model':db['CmContact'],'as':_0x053c('0xe6'),'required':![]},{'model':db[_0x053c('0xce')],'as':_0x053c('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0x053c('0x49')](_0x1d98fa);})[_0x053c('0x14')](function(_0x156c51){_0xadae69[_0x053c('0x4a')]=_0x156c51;return _0xadae69;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x57fd76,_0x1d98fa))[_0x053c('0x1b')](handleError(_0x57fd76,null));};exports[_0x053c('0x121')]=function(_0x2ac09d,_0x4f231d){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x2ac09d[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4f231d,null))[_0x053c('0x14')](function(_0x232bda){if(_0x232bda){return _0x232bda[_0x053c('0x121')](_0x2ac09d[_0x053c('0x4f')][_0x053c('0x5c')],_['omit'](_0x2ac09d[_0x053c('0x4f')],[_0x053c('0x5c'),'id'])||{})[_0x053c('0x122')](function(_0x4619be){for(var _0x450657=0x0;_0x450657<_0x2ac09d['body'][_0x053c('0x5c')][_0x053c('0x3d')];_0x450657+=0x1){socket[_0x053c('0x123')](_0x053c('0x124'),{'UserId':Number(_0x2ac09d[_0x053c('0x4f')][_0x053c('0x5c')][_0x450657]),'ChatWebsiteId':Number(_0x2ac09d['params']['id'])});}return _0x4619be;});}})[_0x053c('0x14')](respondWithResult(_0x4f231d,null))['catch'](handleError(_0x4f231d,null));};exports['removeAgents']=function(_0xba05fb,_0x4a04ac){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0xba05fb['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4a04ac,null))[_0x053c('0x14')](function(_0x32c2f3){if(_0x32c2f3){return _0x32c2f3[_0x053c('0x125')](_0xba05fb['query'][_0x053c('0x5c')])[_0x053c('0x14')](function(){if(_[_0x053c('0x126')](_0xba05fb['query'][_0x053c('0x5c')])){for(var _0x242328=0x0;_0x242328<_0xba05fb[_0x053c('0x38')][_0x053c('0x5c')]['length'];_0x242328+=0x1){socket[_0x053c('0x123')](_0x053c('0x127'),{'UserId':Number(_0xba05fb[_0x053c('0x38')][_0x053c('0x5c')][_0x242328]),'ChatWebsiteId':Number(_0xba05fb[_0x053c('0x56')]['id'])});}}else{socket['emit'](_0x053c('0x127'),{'UserId':Number(_0xba05fb['query']['ids']),'ChatWebsiteId':Number(_0xba05fb[_0x053c('0x56')]['id'])});}});}})[_0x053c('0x14')](respondWithStatusCode(_0x4a04ac,null))['catch'](handleError(_0x4a04ac,null));};exports[_0x053c('0x128')]=function(_0x53f192,_0x4ce574){var _0x292cc2={};var _0x2092e0={};var _0x55fc43;var _0xbd08ad;return db['ChatWebsite'][_0x053c('0x60')]({'where':{'id':_0x53f192[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4ce574,null))[_0x053c('0x14')](function(_0x5cf81a){if(_0x5cf81a){_0x55fc43=_0x5cf81a;_0x2092e0[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0xe7')]['rawAttributes']);_0x2092e0[_0x053c('0x38')]=_[_0x053c('0x39')](_0x53f192[_0x053c('0x38')]);_0x2092e0[_0x053c('0x43')]=_[_0x053c('0x3a')](_0x2092e0[_0x053c('0x36')],_0x2092e0[_0x053c('0x38')]);_0x292cc2['attributes']=_['intersection'](_0x2092e0[_0x053c('0x36')],qs['fields'](_0x53f192[_0x053c('0x38')][_0x053c('0x3c')]));_0x292cc2[_0x053c('0x3b')]=_0x292cc2[_0x053c('0x3b')][_0x053c('0x3d')]?_0x292cc2[_0x053c('0x3b')]:_0x2092e0[_0x053c('0x36')];_0x292cc2['order']=qs[_0x053c('0x41')](_0x53f192[_0x053c('0x38')][_0x053c('0x41')]);_0x292cc2['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x53f192[_0x053c('0x38')],_0x2092e0[_0x053c('0x43')]));if(_0x53f192[_0x053c('0x38')][_0x053c('0x45')]){_0x292cc2[_0x053c('0x42')]=_['merge'](_0x292cc2[_0x053c('0x42')],{'$or':_['map'](_0x292cc2[_0x053c('0x3b')],function(_0x29e90c){var _0x288d6c={};_0x288d6c[_0x29e90c]={'$like':'%'+_0x53f192[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x288d6c;})});}_0x292cc2=_[_0x053c('0x46')]({},_0x292cc2,_0x53f192[_0x053c('0x47')]);return _0x55fc43[_0x053c('0x128')](_0x292cc2);}})[_0x053c('0x14')](function(_0x105071){if(_0x105071){_0xbd08ad=_0x105071[_0x053c('0x3d')];if(!_0x53f192['query']['hasOwnProperty'](_0x053c('0x3f'))){_0x292cc2[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x53f192[_0x053c('0x38')][_0x053c('0x22')]);_0x292cc2['offset']=qs[_0x053c('0x20')](_0x53f192[_0x053c('0x38')][_0x053c('0x20')]);}return _0x55fc43[_0x053c('0x128')](_0x292cc2);}})[_0x053c('0x14')](function(_0x1a9522){if(_0x1a9522){return _0x1a9522?{'count':_0xbd08ad,'rows':_0x1a9522}:null;}})[_0x053c('0x14')](respondWithResult(_0x4ce574,null))['catch'](handleError(_0x4ce574,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index af6501a..e1108f6 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 _0xf873=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatWebsite'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xf873,0xb2));var _0x3f87=function(_0x20dbbb,_0x4ee709){_0x20dbbb=_0x20dbbb-0x0;var _0x52aee3=_0xf873[_0x20dbbb];return _0x52aee3;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x3f87('0x0'))['db'][_0x3f87('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3f87('0x2')](0x0);var events={'afterCreate':_0x3f87('0x3'),'afterUpdate':_0x3f87('0x4'),'afterDestroy':_0x3f87('0x5')};function emitEvent(_0x2fbb4f){return function(_0x1d68dd,_0x3c80d6,_0x4a909e){ChatWebsiteEvents[_0x3f87('0x6')](_0x2fbb4f+':'+_0x1d68dd['id'],_0x1d68dd);ChatWebsiteEvents[_0x3f87('0x6')](_0x2fbb4f,_0x1d68dd);_0x4a909e(null);};}for(var e in events){if(events[_0x3f87('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3f87('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x09f4=['update','remove','emit','exports','ChatWebsite','setMaxListeners','save'];(function(_0x3da940,_0x4bbf14){var _0x2e6abf=function(_0x1eae06){while(--_0x1eae06){_0x3da940['push'](_0x3da940['shift']());}};_0x2e6abf(++_0x4bbf14);}(_0x09f4,0xe4));var _0x409f=function(_0x3eef0d,_0x38a38b){_0x3eef0d=_0x3eef0d-0x0;var _0x2c78fc=_0x09f4[_0x3eef0d];return _0x2c78fc;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x409f('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x409f('0x1')](0x0);var events={'afterCreate':_0x409f('0x2'),'afterUpdate':_0x409f('0x3'),'afterDestroy':_0x409f('0x4')};function emitEvent(_0x13f1a1){return function(_0x1d859b,_0x3c329a,_0x13f683){ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1+':'+_0x1d859b['id'],_0x1d859b);ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1,_0x1d859b);_0x13f683(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x409f('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 53c8ed6..dcecee1 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 _0xf5be=['api','moment','bluebird','request-promise','rimraf','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5be,0x13d));var _0xef5b=function(_0x1668d4,_0x4bd9dc){_0x1668d4=_0x1668d4-0x0;var _0x4e8393=_0xf5be[_0x1668d4];return _0x4e8393;};'use strict';var _=require(_0xef5b('0x0'));var util=require(_0xef5b('0x1'));var logger=require(_0xef5b('0x2'))(_0xef5b('0x3'));var moment=require(_0xef5b('0x4'));var BPromise=require(_0xef5b('0x5'));var rp=require(_0xef5b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef5b('0x7'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x329e32,_0x228b18){return _0x329e32[_0xef5b('0x8')](_0xef5b('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a1e=['chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define'];(function(_0x2f880a,_0x4551fb){var _0x5bef2a=function(_0x30f395){while(--_0x30f395){_0x2f880a['push'](_0x2f880a['shift']());}};_0x5bef2a(++_0x4551fb);}(_0x3a1e,0xc7));var _0xe3a1=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x3a1e[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0xe3a1('0x0'));var util=require(_0xe3a1('0x1'));var logger=require(_0xe3a1('0x2'))(_0xe3a1('0x3'));var moment=require('moment');var BPromise=require(_0xe3a1('0x4'));var rp=require(_0xe3a1('0x5'));var fs=require('fs');var path=require(_0xe3a1('0x6'));var rimraf=require('rimraf');var config=require(_0xe3a1('0x7'));var attributes=require(_0xe3a1('0x8'));module['exports']=function(_0xd69498,_0xec1ea4){return _0xd69498[_0xe3a1('0x9')]('ChatWebsite',attributes,{'tableName':_0xe3a1('0xa'),'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 21a0fb0..d41cee4 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 _0x3f83=['debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x3a9220,_0x99eca7){var _0x984447=function(_0x8b60d6){while(--_0x8b60d6){_0x3a9220['push'](_0x3a9220['shift']());}};_0x984447(++_0x99eca7);}(_0x3f83,0x1aa));var _0x33f8=function(_0x5ed7bc,_0x270b64){_0x5ed7bc=_0x5ed7bc-0x0;var _0xd37edc=_0x3f83[_0x5ed7bc];return _0xd37edc;};'use strict';var _=require(_0x33f8('0x0'));var util=require(_0x33f8('0x1'));var moment=require(_0x33f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x33f8('0x3'));var fs=require('fs');var Redis=require(_0x33f8('0x4'));var db=require(_0x33f8('0x5'))['db'];var utils=require(_0x33f8('0x6'));var logger=require(_0x33f8('0x7'))(_0x33f8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x33f8('0x9')][_0x33f8('0xa')]({'port':0x232a});config[_0x33f8('0xb')]=_[_0x33f8('0xc')](config[_0x33f8('0xb')],{'host':_0x33f8('0xd'),'port':0x18eb});var socket=require(_0x33f8('0xe'))(new Redis(config[_0x33f8('0xb')]));require(_0x33f8('0xf'))[_0x33f8('0x10')](socket);function respondWithRpcPromise(_0x20c104,_0x165214,_0x2ad8a1){return new BPromise(function(_0x827fc1,_0x4181bb){return client[_0x33f8('0x11')](_0x20c104,_0x2ad8a1)[_0x33f8('0x12')](function(_0x4d5e64){logger[_0x33f8('0x13')](_0x33f8('0x14'),_0x165214,_0x33f8('0x15'));logger[_0x33f8('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x165214,_0x33f8('0x15'),JSON[_0x33f8('0x17')](_0x4d5e64));if(_0x4d5e64[_0x33f8('0x18')]){if(_0x4d5e64[_0x33f8('0x18')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x165214,_0x4d5e64[_0x33f8('0x18')][_0x33f8('0x19')]);return _0x4181bb(_0x4d5e64[_0x33f8('0x18')][_0x33f8('0x19')]);}logger[_0x33f8('0x18')](_0x33f8('0x14'),_0x165214,_0x4d5e64['error']['message']);return _0x827fc1(_0x4d5e64[_0x33f8('0x18')][_0x33f8('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x165214,_0x33f8('0x15'));_0x827fc1(_0x4d5e64[_0x33f8('0x1a')]['message']);}})[_0x33f8('0x1b')](function(_0x4934de){logger[_0x33f8('0x18')](_0x33f8('0x14'),_0x165214,_0x4934de);_0x4181bb(_0x4934de);});});} \ No newline at end of file +var _0xa3ab=['localhost','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3ab,0x1ec));var _0xba3a=function(_0x2fa50a,_0xf02cd){_0x2fa50a=_0x2fa50a-0x0;var _0x47a58f=_0xa3ab[_0x2fa50a];return _0x47a58f;};'use strict';var _=require(_0xba3a('0x0'));var util=require(_0xba3a('0x1'));var moment=require(_0xba3a('0x2'));var BPromise=require(_0xba3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba3a('0x5'));var logger=require('../../config/logger')(_0xba3a('0x6'));var config=require(_0xba3a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3a('0x8')][_0xba3a('0x9')]({'port':0x232a});config[_0xba3a('0xa')]=_[_0xba3a('0xb')](config['redis'],{'host':_0xba3a('0xc'),'port':0x18eb});var socket=require(_0xba3a('0xd'))(new Redis(config[_0xba3a('0xa')]));require(_0xba3a('0xe'))['register'](socket);function respondWithRpcPromise(_0x460550,_0x170dd2,_0xff9490){return new BPromise(function(_0x31e8c2,_0x20bdae){return client['request'](_0x460550,_0xff9490)[_0xba3a('0xf')](function(_0x5680af){logger[_0xba3a('0x10')](_0xba3a('0x11'),_0x170dd2,_0xba3a('0x12'));logger['debug'](_0xba3a('0x13'),_0x170dd2,_0xba3a('0x12'),JSON[_0xba3a('0x14')](_0x5680af));if(_0x5680af[_0xba3a('0x15')]){if(_0x5680af['error']['code']===0x1f4){logger[_0xba3a('0x15')](_0xba3a('0x11'),_0x170dd2,_0x5680af[_0xba3a('0x15')][_0xba3a('0x16')]);return _0x20bdae(_0x5680af[_0xba3a('0x15')][_0xba3a('0x16')]);}logger['error'](_0xba3a('0x11'),_0x170dd2,_0x5680af[_0xba3a('0x15')]['message']);return _0x31e8c2(_0x5680af['error'][_0xba3a('0x16')]);}else{logger[_0xba3a('0x10')](_0xba3a('0x11'),_0x170dd2,_0xba3a('0x12'));_0x31e8c2(_0x5680af[_0xba3a('0x17')][_0xba3a('0x16')]);}})['catch'](function(_0x5b6c4b){logger[_0xba3a('0x15')](_0xba3a('0x11'),_0x170dd2,_0x5b6c4b);_0x20bdae(_0x5b6c4b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 26acd23..4b5de1f 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 _0xdc0a=['length','chatWebsite:','./chatWebsite.events','save','emit','removeListener','register'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xdc0a,0x1f3));var _0xadc0=function(_0x50a25c,_0x589d2a){_0x50a25c=_0x50a25c-0x0;var _0x4d0fc9=_0xdc0a[_0x50a25c];return _0x4d0fc9;};'use strict';var ChatWebsiteEvents=require(_0xadc0('0x0'));var events=[_0xadc0('0x1'),'remove','update'];function createListener(_0x5aaefb,_0x402f4d){return function(_0x56567b){_0x402f4d[_0xadc0('0x2')](_0x5aaefb,_0x56567b);};}function removeListener(_0x5ddbeb,_0x68e68b){return function(){ChatWebsiteEvents[_0xadc0('0x3')](_0x5ddbeb,_0x68e68b);};}exports[_0xadc0('0x4')]=function(_0x27adf5){for(var _0x4d70cc=0x0,_0x341a8c=events[_0xadc0('0x5')];_0x4d70cc<_0x341a8c;_0x4d70cc++){var _0x115194=events[_0x4d70cc];var _0x113ba0=createListener(_0xadc0('0x6')+_0x115194,_0x27adf5);ChatWebsiteEvents['on'](_0x115194,_0x113ba0);}}; \ No newline at end of file +var _0x5cb9=['emit','removeListener','register','length','save','remove','update'];(function(_0x2d2bbc,_0x2e5f03){var _0x4ec2e2=function(_0x520ddc){while(--_0x520ddc){_0x2d2bbc['push'](_0x2d2bbc['shift']());}};_0x4ec2e2(++_0x2e5f03);}(_0x5cb9,0x1d9));var _0x95cb=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5cb9[_0x5f0089];return _0x193892;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x95cb('0x0'),_0x95cb('0x1'),_0x95cb('0x2')];function createListener(_0x4baac6,_0x40f3b1){return function(_0x33f49a){_0x40f3b1[_0x95cb('0x3')](_0x4baac6,_0x33f49a);};}function removeListener(_0x37f3d6,_0x551e4b){return function(){ChatWebsiteEvents[_0x95cb('0x4')](_0x37f3d6,_0x551e4b);};}exports[_0x95cb('0x5')]=function(_0x2b021c){for(var _0xac6524=0x0,_0x4fe332=events[_0x95cb('0x6')];_0xac6524<_0x4fe332;_0xac6524++){var _0x21a77b=events[_0xac6524];var _0x3c2b5c=createListener('chatWebsite:'+_0x21a77b,_0x2b021c);ChatWebsiteEvents['on'](_0x21a77b,_0x3c2b5c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cb963cc..e35beef 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 _0x579a=['/:id/notify','server/files','offline-chat','ensureDir','extname','/:id/offline','any','/:id/applications','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','join','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar'];(function(_0x1f358d,_0x243b2f){var _0x53f2bf=function(_0x389b8a){while(--_0x389b8a){_0x1f358d['push'](_0x1f358d['shift']());}};_0x53f2bf(++_0x243b2f);}(_0x579a,0x9a));var _0xa579=function(_0x539fc5,_0x34ea87){_0x539fc5=_0x539fc5-0x0;var _0x41a99d=_0x579a[_0x539fc5];return _0x41a99d;};'use strict';var multer=require('multer');var util=require(_0xa579('0x0'));var path=require(_0xa579('0x1'));var timeout=require(_0xa579('0x2'));var express=require(_0xa579('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa579('0x4'));var interaction=require(_0xa579('0x5'));var config=require(_0xa579('0x6'));var controller=require(_0xa579('0x7'));router[_0xa579('0x8')]('/',auth[_0xa579('0x9')](),controller[_0xa579('0xa')]);router[_0xa579('0x8')](_0xa579('0xb'),auth[_0xa579('0x9')](),controller['describe']);router[_0xa579('0x8')]('/:id',auth[_0xa579('0x9')](),controller[_0xa579('0xc')]);router['get'](_0xa579('0xd'),auth[_0xa579('0x9')](),controller[_0xa579('0xe')]);router[_0xa579('0x8')](_0xa579('0xf'),auth[_0xa579('0x9')](),controller[_0xa579('0x10')]);router[_0xa579('0x8')](_0xa579('0x11'),controller['getLogo']);router[_0xa579('0x8')](_0xa579('0x12'),controller[_0xa579('0x13')]);router['get']('/:id/customer_avatar',controller[_0xa579('0x14')]);router[_0xa579('0x8')](_0xa579('0x15'),controller[_0xa579('0x16')]);router['get'](_0xa579('0x17'),auth[_0xa579('0x9')](),controller['getInteractions']);router[_0xa579('0x8')](_0xa579('0x18'),controller[_0xa579('0x19')]);router[_0xa579('0x8')]('/:id/applications',auth[_0xa579('0x9')](),controller[_0xa579('0x1a')]);router['get'](_0xa579('0x1b'),auth[_0xa579('0x9')](),controller[_0xa579('0x1c')]);router['get'](_0xa579('0x1d'),controller[_0xa579('0x1e')]);router['get'](_0xa579('0x1f'),auth['isAuthenticated'](),controller[_0xa579('0x20')]);router['get'](_0xa579('0x21'),auth[_0xa579('0x9')](),controller['getAgents']);router[_0xa579('0x22')]('/',auth[_0xa579('0x9')](),controller['create']);router[_0xa579('0x22')](_0xa579('0xd'),auth[_0xa579('0x9')](),controller[_0xa579('0x23')]);router['post'](_0xa579('0xf'),auth['isAuthenticated'](),controller[_0xa579('0x24')]);var upload=multer({'storage':multer[_0xa579('0x25')]({'destination':function(_0x343f43,_0x5d1ea4,_0x49b9cc){_0x49b9cc(null,path['join'](config[_0xa579('0x26')],_0xa579('0x27')));},'filename':function(_0x449e0c,_0x1638b5,_0x25b8a2){_0x25b8a2(null,util[_0xa579('0x28')](_0xa579('0x29'),Date[_0xa579('0x2a')](),_0x1638b5[_0xa579('0x2b')]));}})});router[_0xa579('0x22')](_0xa579('0x11'),upload[_0xa579('0x2c')](_0xa579('0x2d')),controller[_0xa579('0x2e')]);var upload=multer({'storage':multer[_0xa579('0x25')]({'destination':function(_0x4643ec,_0x4dafd8,_0x57ea69){_0x57ea69(null,path['join'](config[_0xa579('0x26')],_0xa579('0x2f')));},'filename':function(_0x338ae7,_0x43855c,_0x40eea7){_0x40eea7(null,util[_0xa579('0x28')](_0xa579('0x29'),Date['now'](),_0x43855c['originalname']));}})});router['post'](_0xa579('0x12'),upload[_0xa579('0x2c')]('file'),controller[_0xa579('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x668ec4,_0x3d006e,_0xe2a94b){_0xe2a94b(null,path[_0xa579('0x31')](config['root'],_0xa579('0x2f')));},'filename':function(_0x17b1fb,_0x56ac10,_0xfa7065){_0xfa7065(null,util[_0xa579('0x28')](_0xa579('0x29'),Date['now'](),_0x56ac10[_0xa579('0x2b')]));}})});router[_0xa579('0x22')](_0xa579('0x32'),upload['single'](_0xa579('0x2d')),controller[_0xa579('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x518254,_0x421a64,_0x178b7f){_0x178b7f(null,path[_0xa579('0x31')](config[_0xa579('0x26')],_0xa579('0x2f')));},'filename':function(_0x438e84,_0x22acf6,_0x3cc270){_0x3cc270(null,util['format'](_0xa579('0x29'),Date[_0xa579('0x2a')](),_0x22acf6[_0xa579('0x2b')]));}})});router[_0xa579('0x22')](_0xa579('0x15'),upload['single']('file'),controller[_0xa579('0x34')]);router[_0xa579('0x22')](_0xa579('0x35'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xa579('0x25')]({'destination':function(_0x1678fa,_0x1f1318,_0x962bab){const _0x569e86=path[_0xa579('0x31')](config['root'],_0xa579('0x36'),'attachments',_0xa579('0x37'));fs_extra[_0xa579('0x38')](_0x569e86,function(){_0x962bab(null,_0x569e86);});},'filename':function(_0x112998,_0x3d7d5e,_0x33cc14){const _0xd4661d=_0x3d7d5e[_0xa579('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x6ab6b4=path[_0xa579('0x39')](_0xd4661d);const _0x4da768=Date[_0xa579('0x2a')]()+'-'+_0xd4661d['replace'](_0x6ab6b4,'')+_0x6ab6b4;_0x33cc14(null,_0x4da768);}})});router[_0xa579('0x22')](_0xa579('0x3a'),offlineUploadMulter[_0xa579('0x3b')](),controller['offline']);router['post'](_0xa579('0x17'),auth[_0xa579('0x9')](),controller['addInteraction']);router[_0xa579('0x22')](_0xa579('0x3c'),auth[_0xa579('0x9')](),controller['addApplications']);router['post'](_0xa579('0x1b'),auth[_0xa579('0x9')](),controller['addProactiveActions']);router[_0xa579('0x22')]('/:id/users',auth[_0xa579('0x9')](),controller['addAgents']);router[_0xa579('0x3d')](_0xa579('0x3e'),auth[_0xa579('0x9')](),controller[_0xa579('0x3f')]);router[_0xa579('0x40')](_0xa579('0x3e'),auth[_0xa579('0x9')](),controller[_0xa579('0x41')]);router[_0xa579('0x40')](_0xa579('0xd'),auth['isAuthenticated'](),controller[_0xa579('0x42')]);router[_0xa579('0x40')](_0xa579('0xf'),auth[_0xa579('0x9')](),controller[_0xa579('0x43')]);router[_0xa579('0x40')](_0xa579('0x21'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa579('0x44')]=router; \ No newline at end of file +var _0xe5b6=['getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','now','format','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe5b6,0x10b));var _0x6e5b=function(_0x4bc2d7,_0x9f0153){_0x4bc2d7=_0x4bc2d7-0x0;var _0x4548dc=_0xe5b6[_0x4bc2d7];return _0x4548dc;};'use strict';var multer=require(_0x6e5b('0x0'));var util=require(_0x6e5b('0x1'));var path=require(_0x6e5b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e5b('0x3'));var auth=require(_0x6e5b('0x4'));var interaction=require(_0x6e5b('0x5'));var config=require('../../config/environment');var controller=require(_0x6e5b('0x6'));router[_0x6e5b('0x7')]('/',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x9')]);router[_0x6e5b('0x7')](_0x6e5b('0xa'),auth['isAuthenticated'](),controller[_0x6e5b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e5b('0xc')]);router[_0x6e5b('0x7')](_0x6e5b('0xd'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0xe')]);router['get']('/:id/canned_answers',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0xf')]);router['get']('/:id/logo',controller[_0x6e5b('0x10')]);router[_0x6e5b('0x7')](_0x6e5b('0x11'),controller[_0x6e5b('0x12')]);router['get'](_0x6e5b('0x13'),controller[_0x6e5b('0x14')]);router[_0x6e5b('0x7')](_0x6e5b('0x15'),controller[_0x6e5b('0x16')]);router['get'](_0x6e5b('0x17'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x18')]);router[_0x6e5b('0x7')]('/:id/snippet',controller[_0x6e5b('0x19')]);router[_0x6e5b('0x7')](_0x6e5b('0x1a'),auth['isAuthenticated'](),controller[_0x6e5b('0x1b')]);router['get']('/:id/proactive_actions',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x1c')]);router[_0x6e5b('0x7')]('/:id/fields',controller[_0x6e5b('0x1d')]);router['get'](_0x6e5b('0x1e'),auth[_0x6e5b('0x8')](),controller['getOfflineMessages']);router[_0x6e5b('0x7')](_0x6e5b('0x1f'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x20')]);router[_0x6e5b('0x21')](_0x6e5b('0xd'),auth['isAuthenticated'](),controller[_0x6e5b('0x22')]);router['post'](_0x6e5b('0x23'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x24')]);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x4bebae,_0x3c76dd,_0x1e312f){_0x1e312f(null,path['join'](config[_0x6e5b('0x26')],_0x6e5b('0x27')));},'filename':function(_0x3698bd,_0x3f65d9,_0x390310){_0x390310(null,util['format'](_0x6e5b('0x28'),Date['now'](),_0x3f65d9[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x2a'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x2d')]);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x49ca9a,_0x2618a7,_0x4733f3){_0x4733f3(null,path[_0x6e5b('0x2e')](config['root'],_0x6e5b('0x2f')));},'filename':function(_0x2f2783,_0x4ed8fe,_0x266c6e){_0x266c6e(null,util['format']('%s-%s',Date[_0x6e5b('0x30')](),_0x4ed8fe[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x11'),upload['single'](_0x6e5b('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x206426,_0x5914a9,_0x16394d){_0x16394d(null,path['join'](config[_0x6e5b('0x26')],_0x6e5b('0x2f')));},'filename':function(_0x2e5724,_0x398db7,_0xd89c61){_0xd89c61(null,util[_0x6e5b('0x31')](_0x6e5b('0x28'),Date['now'](),_0x398db7[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x13'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11ab13,_0x3b622c,_0x35c0fc){_0x35c0fc(null,path[_0x6e5b('0x2e')](config['root'],_0x6e5b('0x2f')));},'filename':function(_0x43ebc9,_0x15aab3,_0x4914d9){_0x4914d9(null,util[_0x6e5b('0x31')]('%s-%s',Date[_0x6e5b('0x30')](),_0x15aab3[_0x6e5b('0x29')]));}})});router['post'](_0x6e5b('0x15'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x33')]);router[_0x6e5b('0x21')](_0x6e5b('0x34'),controller[_0x6e5b('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x2a0ac8,_0x403532,_0x5b4572){const _0x4eb913=path[_0x6e5b('0x2e')](config[_0x6e5b('0x26')],_0x6e5b('0x36'),_0x6e5b('0x37'),_0x6e5b('0x38'));fs_extra[_0x6e5b('0x39')](_0x4eb913,function(){_0x5b4572(null,_0x4eb913);});},'filename':function(_0x31a137,_0x159551,_0x3a74f9){const _0x26d9ec=_0x159551['originalname'][_0x6e5b('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x902d9f=path[_0x6e5b('0x3b')](_0x26d9ec);const _0x1e7fc7=Date[_0x6e5b('0x30')]()+'-'+_0x26d9ec[_0x6e5b('0x3a')](_0x902d9f,'')+_0x902d9f;_0x3a74f9(null,_0x1e7fc7);}})});router[_0x6e5b('0x21')](_0x6e5b('0x3c'),offlineUploadMulter[_0x6e5b('0x3d')](),controller[_0x6e5b('0x3e')]);router[_0x6e5b('0x21')](_0x6e5b('0x17'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x3f')]);router['post'](_0x6e5b('0x1a'),auth['isAuthenticated'](),controller[_0x6e5b('0x40')]);router[_0x6e5b('0x21')]('/:id/proactive_actions',auth[_0x6e5b('0x8')](),controller['addProactiveActions']);router[_0x6e5b('0x21')](_0x6e5b('0x1f'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x41')]);router['put'](_0x6e5b('0x42'),auth['isAuthenticated'](),controller[_0x6e5b('0x43')]);router[_0x6e5b('0x44')](_0x6e5b('0x42'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x45')]);router[_0x6e5b('0x44')](_0x6e5b('0xd'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x46')]);router[_0x6e5b('0x44')]('/:id/canned_answers',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x47')]);router[_0x6e5b('0x44')](_0x6e5b('0x1f'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('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 e39e931..f1c196d 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 _0x7a57=['use','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a57,0x1d6));var _0x77a5=function(_0x1917ae,_0x4199fd){_0x1917ae=_0x1917ae-0x0;var _0x42fbc7=_0x7a57[_0x1917ae];return _0x42fbc7;};var beaverLogger=require(_0x77a5('0x0'));var express=require('express');var auth=require(_0x77a5('0x1'));var config=require(_0x77a5('0x2'));var router=express[_0x77a5('0x3')]();var isProduction=config[_0x77a5('0x4')]===_0x77a5('0x5')||![];function clientSideLogs(_0x1e5b49,_0x498d02,_0xc7cdd8){var _0xb4f1ef=_0x1e5b49[_0x77a5('0x6')][_0x77a5('0x7')](_0x77a5('0x8'));if(!_0xb4f1ef){throw new Error(_0x77a5('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x77a5('0xa'),'logger':_0xb4f1ef,'enableCors':!isProduction})(_0x1e5b49,_0x498d02,_0xc7cdd8);}router[_0x77a5('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x77a5('0xc')]=router; \ No newline at end of file +var _0xddf0=['expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x50d5f7,_0x1f531e){var _0x3bf4d4=function(_0x26f32d){while(--_0x26f32d){_0x50d5f7['push'](_0x50d5f7['shift']());}};_0x3bf4d4(++_0x1f531e);}(_0xddf0,0xac));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0x0ddf('0x0'));var express=require(_0x0ddf('0x1'));var auth=require(_0x0ddf('0x2'));var config=require(_0x0ddf('0x3'));var router=express[_0x0ddf('0x4')]();var isProduction=config[_0x0ddf('0x5')]===_0x0ddf('0x6')||![];function clientSideLogs(_0x448bf5,_0x3ac17f,_0x49a76c){var _0x1dfb7b=_0x448bf5['app'][_0x0ddf('0x7')](_0x0ddf('0x8'));if(!_0x1dfb7b){throw new Error(_0x0ddf('0x9'));}return beaverLogger[_0x0ddf('0xa')]({'uri':'/client-logs','logger':_0x1dfb7b,'enableCors':!isProduction})(_0x448bf5,_0x3ac17f,_0x49a76c);}router[_0x0ddf('0xb')](auth[_0x0ddf('0xc')](),clientSideLogs);module[_0x0ddf('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6ff32b3..4ddb0e9 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 _0x0d5b=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT'];(function(_0x1391ac,_0x54b306){var _0x2ff898=function(_0x264141){while(--_0x264141){_0x1391ac['push'](_0x1391ac['shift']());}};_0x2ff898(++_0x54b306);}(_0x0d5b,0x128));var _0xb0d5=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0d5b[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0xb0d5('0x0')]={'name':{'type':Sequelize[_0xb0d5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xb0d5('0x2'),_0xb0d5('0x3'),_0xb0d5('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb0d5('0x5')](_0xb0d5('0x6'),_0xb0d5('0x7'))},'data1':{'type':Sequelize[_0xb0d5('0x1')],'comment':_0xb0d5('0x8')},'data2':{'type':Sequelize[_0xb0d5('0x1')],'comment':_0xb0d5('0x9')},'data3':{'type':Sequelize[_0xb0d5('0x1')],'comment':_0xb0d5('0xa')},'data4':{'type':Sequelize[_0xb0d5('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xb0d5('0xb')],'comment':_0xb0d5('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xb0d5('0xd')},'data7':{'type':Sequelize[_0xb0d5('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x5186=['sequelize','STRING','ENUM','AmazonAWS','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x1ba22a,_0x2a568c){var _0x5ba115=function(_0x38ca3a){while(--_0x38ca3a){_0x1ba22a['push'](_0x1ba22a['shift']());}};_0x5ba115(++_0x2a568c);}(_0x5186,0x90));var _0x6518=function(_0xb74abd,_0x4ee757){_0xb74abd=_0xb74abd-0x0;var _0x1daf5f=_0x5186[_0xb74abd];return _0x1daf5f;};'use strict';var Sequelize=require(_0x6518('0x0'));module['exports']={'name':{'type':Sequelize[_0x6518('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6518('0x2')](_0x6518('0x3'),_0x6518('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x6518('0x5'))},'data1':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x6')},'data2':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x7')},'data3':{'type':Sequelize[_0x6518('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x8')},'data5':{'type':Sequelize[_0x6518('0x9')],'comment':_0x6518('0xa')},'data6':{'type':Sequelize[_0x6518('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x6518('0x9')],'comment':_0x6518('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 800bd4f..cbea991 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 _0x8e3c=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','count','then','include','findAll','MicrosoftAzure','data3','catch','params','includeAll','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','Content-Range','destroy','name','slice','index','map','CloudProvider','rawAttributes'];(function(_0x246499,_0x34ddcf){var _0x267fae=function(_0x58a8f4){while(--_0x58a8f4){_0x246499['push'](_0x246499['shift']());}};_0x267fae(++_0x34ddcf);}(_0x8e3c,0x104));var _0xc8e3=function(_0x36f3f3,_0xd4c1dd){_0x36f3f3=_0x36f3f3-0x0;var _0x45bd2e=_0x8e3c[_0x36f3f3];return _0x45bd2e;};'use strict';var _=require(_0xc8e3('0x0'));var Redis=require(_0xc8e3('0x1'));var qs=require(_0xc8e3('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xc8e3('0x3'));var logger=require('../../config/logger')(_0xc8e3('0x4'));var db=require(_0xc8e3('0x5'))['db'];var oauth=require(_0xc8e3('0x6'));config[_0xc8e3('0x7')]=_[_0xc8e3('0x8')](config['redis'],{'host':_0xc8e3('0x9'),'port':0x18eb});var socket=require(_0xc8e3('0xa'))(new Redis(config[_0xc8e3('0x7')]));var redis=new Redis(config[_0xc8e3('0x7')]);function respondWithStatusCode(_0x39e96e,_0x14cde0){_0x14cde0=_0x14cde0||0xcc;return function(_0x145c8e){if(_0x145c8e){return _0x39e96e[_0xc8e3('0xb')](_0x14cde0);}return _0x39e96e[_0xc8e3('0xc')](_0x14cde0)[_0xc8e3('0xd')]();};}function respondWithResult(_0x802cc,_0x51cbf9){_0x51cbf9=_0x51cbf9||0xc8;return function(_0x3af7a8){if(_0x3af7a8){return _0x802cc[_0xc8e3('0xc')](_0x51cbf9)[_0xc8e3('0xe')](_0x3af7a8);}};}function respondWithFilteredResult(_0x4e8255,_0x917f97){return function(_0x30fb70){if(_0x30fb70){var _0x2deee2=typeof _0x917f97[_0xc8e3('0xf')]===_0xc8e3('0x10')&&typeof _0x917f97['limit']===_0xc8e3('0x10');var _0x2e5d02=_0x30fb70['count'];var _0x5ab9ad=_0x2deee2?0x0:_0x917f97[_0xc8e3('0xf')];var _0x5d48a2=_0x2deee2?_0x30fb70['count']:_0x917f97[_0xc8e3('0xf')]+_0x917f97['limit'];var _0x32f59e;if(_0x5d48a2>=_0x2e5d02){_0x5d48a2=_0x2e5d02;_0x32f59e=0xc8;}else{_0x32f59e=0xce;}_0x4e8255[_0xc8e3('0xc')](_0x32f59e);return _0x4e8255['set'](_0xc8e3('0x11'),_0x5ab9ad+'-'+_0x5d48a2+'/'+_0x2e5d02)[_0xc8e3('0xe')](_0x30fb70);}return null;};}function saveUpdates(_0x632ae2){return function(_0x12b5c8){if(_0x12b5c8){return _0x12b5c8['update'](_0x632ae2)['then'](function(_0x3cc206){return _0x3cc206;});}return null;};}function removeEntity(_0x1f3ec6){return function(_0x54d3d0){if(_0x54d3d0){return _0x54d3d0[_0xc8e3('0x12')]()['then'](function(){_0x1f3ec6[_0xc8e3('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3396e1){return function(_0x29ab91){if(!_0x29ab91){_0x3396e1['sendStatus'](0x194);}return _0x29ab91;};}function handleError(_0x3a56c1,_0x216e08){_0x216e08=_0x216e08||0x1f4;return function(_0x12d9b2){logger['error'](_0x12d9b2['stack']);if(_0x12d9b2[_0xc8e3('0x13')]){delete _0x12d9b2['name'];}_0x3a56c1['status'](_0x216e08)['send'](_0x12d9b2);};}function maskClientSecret(_0x10f612){return _['padEnd'](_0x10f612[_0xc8e3('0x14')](0x0,0x3),0x14,'*');}exports[_0xc8e3('0x15')]=function(_0xac3046,_0x307817){var _0x2bf35c={},_0x5d13a4={},_0x316987={'count':0x0,'rows':[]};var _0xf7c46d=_[_0xc8e3('0x16')](db[_0xc8e3('0x17')][_0xc8e3('0x18')],function(_0x53fe1d){return{'name':_0x53fe1d[_0xc8e3('0x19')],'type':_0x53fe1d[_0xc8e3('0x1a')][_0xc8e3('0x1b')]};});_0x5d13a4[_0xc8e3('0x1c')]=_[_0xc8e3('0x16')](_0xf7c46d,_0xc8e3('0x13'));_0x5d13a4[_0xc8e3('0x1d')]=_[_0xc8e3('0x1e')](_0xac3046[_0xc8e3('0x1d')]);_0x5d13a4[_0xc8e3('0x1f')]=_[_0xc8e3('0x20')](_0x5d13a4[_0xc8e3('0x1c')],_0x5d13a4[_0xc8e3('0x1d')]);_0x2bf35c[_0xc8e3('0x21')]=_[_0xc8e3('0x20')](_0x5d13a4[_0xc8e3('0x1c')],qs[_0xc8e3('0x22')](_0xac3046['query']['fields']));_0x2bf35c[_0xc8e3('0x21')]=_0x2bf35c[_0xc8e3('0x21')][_0xc8e3('0x23')]?_0x2bf35c[_0xc8e3('0x21')]:_0x5d13a4[_0xc8e3('0x1c')];if(!_0xac3046[_0xc8e3('0x1d')][_0xc8e3('0x24')](_0xc8e3('0x25'))){_0x2bf35c[_0xc8e3('0x26')]=qs['limit'](_0xac3046['query'][_0xc8e3('0x26')]);_0x2bf35c['offset']=qs[_0xc8e3('0xf')](_0xac3046[_0xc8e3('0x1d')][_0xc8e3('0xf')]);}_0x2bf35c['order']=qs[_0xc8e3('0x27')](_0xac3046[_0xc8e3('0x1d')][_0xc8e3('0x27')]);_0x2bf35c['where']=qs[_0xc8e3('0x1f')](_[_0xc8e3('0x28')](_0xac3046[_0xc8e3('0x1d')],_0x5d13a4[_0xc8e3('0x1f')]),_0xf7c46d);if(_0xac3046[_0xc8e3('0x1d')]['filter']){_0x2bf35c[_0xc8e3('0x29')]=_[_0xc8e3('0x2a')](_0x2bf35c[_0xc8e3('0x29')],{'$or':_[_0xc8e3('0x16')](_0xf7c46d,function(_0x16ab6e){if(_0x16ab6e[_0xc8e3('0x1a')]!==_0xc8e3('0x2b')){var _0x2fb3fa={};_0x2fb3fa[_0x16ab6e['name']]={'$like':'%'+_0xac3046[_0xc8e3('0x1d')][_0xc8e3('0x2c')]+'%'};return _0x2fb3fa;}})});}_0x2bf35c=_[_0xc8e3('0x2a')]({},_0x2bf35c,_0xac3046[_0xc8e3('0x2d')]);var _0x69de43={'where':_0x2bf35c[_0xc8e3('0x29')]};return db['CloudProvider'][_0xc8e3('0x2e')](_0x69de43)[_0xc8e3('0x2f')](function(_0x448291){_0x316987[_0xc8e3('0x2e')]=_0x448291;if(_0xac3046[_0xc8e3('0x1d')]['includeAll']){_0x2bf35c[_0xc8e3('0x30')]=[{'all':!![]}];}return db[_0xc8e3('0x17')][_0xc8e3('0x31')](_0x2bf35c);})[_0xc8e3('0x2f')](function(_0x2f32d6){_0x316987['rows']=_[_0xc8e3('0x16')](_0x2f32d6,function(_0x51b651){if(_0x51b651['service']===_0xc8e3('0x32')){var _0x3473cb=encryptor['decryptString'](_0x51b651['data3']);_0x51b651[_0xc8e3('0x33')]=maskClientSecret(_0x3473cb);}return _0x51b651;});return _0x316987;})[_0xc8e3('0x2f')](respondWithFilteredResult(_0x307817,_0x2bf35c))[_0xc8e3('0x34')](handleError(_0x307817,null));};exports['show']=function(_0x27a1f5,_0x3291d7){var _0x35e97e={'raw':!![],'where':{'id':_0x27a1f5[_0xc8e3('0x35')]['id']}},_0xeabcec={};_0xeabcec[_0xc8e3('0x1c')]=_['keys'](db[_0xc8e3('0x17')][_0xc8e3('0x18')]);_0xeabcec[_0xc8e3('0x1d')]=_[_0xc8e3('0x1e')](_0x27a1f5['query']);_0xeabcec['filters']=_[_0xc8e3('0x20')](_0xeabcec[_0xc8e3('0x1c')],_0xeabcec[_0xc8e3('0x1d')]);_0x35e97e[_0xc8e3('0x21')]=_[_0xc8e3('0x20')](_0xeabcec[_0xc8e3('0x1c')],qs[_0xc8e3('0x22')](_0x27a1f5[_0xc8e3('0x1d')][_0xc8e3('0x22')]));_0x35e97e['attributes']=_0x35e97e[_0xc8e3('0x21')]['length']?_0x35e97e['attributes']:_0xeabcec['model'];if(_0x27a1f5[_0xc8e3('0x1d')][_0xc8e3('0x36')]){_0x35e97e[_0xc8e3('0x30')]=[{'all':!![]}];}_0x35e97e=_[_0xc8e3('0x2a')]({},_0x35e97e,_0x27a1f5[_0xc8e3('0x2d')]);return db[_0xc8e3('0x17')][_0xc8e3('0x37')](_0x35e97e)[_0xc8e3('0x2f')](handleEntityNotFound(_0x3291d7,null))[_0xc8e3('0x2f')](function(_0x4f30e6){if(_0x4f30e6[_0xc8e3('0x38')]==='MicrosoftAzure'){var _0x39de1a=encryptor['decryptString'](_0x4f30e6[_0xc8e3('0x33')]);_0x4f30e6[_0xc8e3('0x33')]=maskClientSecret(_0x39de1a);}return _0x4f30e6;})[_0xc8e3('0x2f')](respondWithResult(_0x3291d7,null))[_0xc8e3('0x34')](handleError(_0x3291d7,null));};exports[_0xc8e3('0x39')]=function(_0x306316,_0x27275b){if(!_0x306316[_0xc8e3('0x3a')][_0xc8e3('0x13')])throw new Error(_0xc8e3('0x3b'));if(!_0x306316['body'][_0xc8e3('0x38')])throw new Error(_0xc8e3('0x3c'));var _0x29ce92=db[_0xc8e3('0x17')][_0xc8e3('0x18')][_0xc8e3('0x38')][_0xc8e3('0x3d')];if(!_0x29ce92[_0xc8e3('0x3e')](_0x306316[_0xc8e3('0x3a')][_0xc8e3('0x38')]))throw new Error(_0xc8e3('0x3f')+_0x29ce92[_0xc8e3('0x40')](',\x20'));if(_0x306316[_0xc8e3('0x3a')][_0xc8e3('0x38')]==='MicrosoftAzure'&&_0x306316[_0xc8e3('0x3a')][_0xc8e3('0x33')]){_0x306316[_0xc8e3('0x3a')]['data3']=encryptor[_0xc8e3('0x41')](_0x306316[_0xc8e3('0x3a')][_0xc8e3('0x33')]);}return db[_0xc8e3('0x17')][_0xc8e3('0x39')](_0x306316[_0xc8e3('0x3a')],{})[_0xc8e3('0x2f')](respondWithResult(_0x27275b,0xc9))[_0xc8e3('0x34')](handleError(_0x27275b,null));};exports[_0xc8e3('0x42')]=function(_0x599396,_0x2648c5){if(_0x599396[_0xc8e3('0x3a')]['id']){delete _0x599396[_0xc8e3('0x3a')]['id'];}return db[_0xc8e3('0x17')][_0xc8e3('0x37')]({'where':{'id':_0x599396[_0xc8e3('0x35')]['id']}})[_0xc8e3('0x2f')](handleEntityNotFound(_0x2648c5,null))[_0xc8e3('0x2f')](function(_0x2dfd77){if(_0x2dfd77[_0xc8e3('0x38')]===_0xc8e3('0x32')&&_0x599396[_0xc8e3('0x3a')][_0xc8e3('0x33')]){_0x599396['body']['data3']=encryptor[_0xc8e3('0x41')](_0x599396['body'][_0xc8e3('0x33')]);}return _0x2dfd77;})[_0xc8e3('0x2f')](saveUpdates(_0x599396[_0xc8e3('0x3a')],null))[_0xc8e3('0x2f')](respondWithResult(_0x2648c5,null))[_0xc8e3('0x34')](handleError(_0x2648c5,null));};exports[_0xc8e3('0x12')]=function(_0x2df803,_0xddca70){return db[_0xc8e3('0x17')]['find']({'where':{'id':_0x2df803[_0xc8e3('0x35')]['id']}})[_0xc8e3('0x2f')](handleEntityNotFound(_0xddca70,null))[_0xc8e3('0x2f')](removeEntity(_0xddca70,null))['catch'](handleError(_0xddca70,null));};exports[_0xc8e3('0x43')]=function(_0x3cb83b,_0x153c96){return db[_0xc8e3('0x17')]['findOne']({'where':{'id':_0x3cb83b[_0xc8e3('0x35')]['id']},'raw':!![]})[_0xc8e3('0x2f')](function(_0x3c66a9){if(!_0x3c66a9)return _0x153c96[_0xc8e3('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3c66a9,_0x3cb83b[_0xc8e3('0x44')]['id'])};})[_0xc8e3('0x2f')](respondWithResult(_0x153c96,null))[_0xc8e3('0x34')](handleError(_0x153c96,null));};exports[_0xc8e3('0x45')]=function(_0x2d9f4b,_0x3bf8cb){var _0x7b89b=_0x2d9f4b[_0xc8e3('0x3a')];var _0x1af393;var _0x4fb96b;if(_0x7b89b['error'])throw _0x7b89b;redis[_0xc8e3('0x46')](_0x7b89b['state'])[_0xc8e3('0x2f')](function(_0xae717a){if(!_0xae717a)throw new Error(_0xc8e3('0x47'));_0x1af393=JSON[_0xc8e3('0x48')](_0xae717a);var _0x460855=Buffer[_0xc8e3('0x49')](_0x7b89b['state'],_0xc8e3('0x4a'))['toString'](_0xc8e3('0x4b'));_0x4fb96b=JSON[_0xc8e3('0x48')](_0x460855);if(!oauth['isValidIdToken'](_0x7b89b[_0xc8e3('0x4c')],_0x1af393[_0xc8e3('0x4d')]))throw new Error(_0xc8e3('0x4e'));redis[_0xc8e3('0x4f')](_0x7b89b[_0xc8e3('0x50')]);return oauth[_0xc8e3('0x51')](_0x7b89b[_0xc8e3('0x52')],_0x1af393);})[_0xc8e3('0x2f')](function(_0x2c8902){_0x1af393[_0xc8e3('0x53')]=_0x2c8902[_0xc8e3('0x54')];_0x1af393['data6']=_0x2c8902[_0xc8e3('0x55')];return db[_0xc8e3('0x17')][_0xc8e3('0x42')]({'data5':_0x1af393[_0xc8e3('0x53')],'data6':_0x1af393['data6']},{'where':{'id':_0x1af393['id']}});})[_0xc8e3('0x2f')](function(){oauth[_0xc8e3('0x56')](_0x1af393);socket[_0xc8e3('0x57')](_0xc8e3('0x58'),{'id':_0x4fb96b['id']});return;})['then'](respondWithStatusCode(_0x3bf8cb,null))[_0xc8e3('0x34')](function(_0x388fe9){if(_0x4fb96b){socket[_0xc8e3('0x57')](_0xc8e3('0x59'),{'id':_0x4fb96b['id']});}if(!_0x1af393){logger[_0xc8e3('0x5a')](_0xc8e3('0x5b'),_0x388fe9);return _0x3bf8cb[_0xc8e3('0xc')](0x1f4)[_0xc8e3('0x5c')](_0x388fe9['message']);}logger[_0xc8e3('0x5a')](_0xc8e3('0x5d'),_0x1af393['id'],JSON[_0xc8e3('0x5e')](_0x388fe9));});}; \ No newline at end of file +var _0x0d08=['name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','service','MicrosoftAzure','decryptString','data3','catch','params','length','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','update','find','oauth2MicrosoftAuthorize','findOne','sendStatus','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','id_token','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','data5','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','destroy','then'];(function(_0x166780,_0xb61508){var _0x3c4bcc=function(_0x504a51){while(--_0x504a51){_0x166780['push'](_0x166780['shift']());}};_0x3c4bcc(++_0xb61508);}(_0x0d08,0x14f));var _0x80d0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0d08[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x80d0('0x0'));var Redis=require(_0x80d0('0x1'));var qs=require(_0x80d0('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x80d0('0x3'))('api');var db=require(_0x80d0('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x80d0('0x5')]=_['defaults'](config[_0x80d0('0x5')],{'host':_0x80d0('0x6'),'port':0x18eb});var socket=require(_0x80d0('0x7'))(new Redis(config[_0x80d0('0x5')]));var redis=new Redis(config[_0x80d0('0x5')]);function respondWithStatusCode(_0x43decb,_0x3bb8ef){_0x3bb8ef=_0x3bb8ef||0xcc;return function(_0x38b0f3){if(_0x38b0f3){return _0x43decb['sendStatus'](_0x3bb8ef);}return _0x43decb[_0x80d0('0x8')](_0x3bb8ef)[_0x80d0('0x9')]();};}function respondWithResult(_0x4961c6,_0x102f9f){_0x102f9f=_0x102f9f||0xc8;return function(_0x140995){if(_0x140995){return _0x4961c6[_0x80d0('0x8')](_0x102f9f)[_0x80d0('0xa')](_0x140995);}};}function respondWithFilteredResult(_0x4be65e,_0x8c3c2c){return function(_0x3afc12){if(_0x3afc12){var _0x3429b0=typeof _0x8c3c2c[_0x80d0('0xb')]===_0x80d0('0xc')&&typeof _0x8c3c2c[_0x80d0('0xd')]===_0x80d0('0xc');var _0x994aae=_0x3afc12[_0x80d0('0xe')];var _0x500f5e=_0x3429b0?0x0:_0x8c3c2c[_0x80d0('0xb')];var _0x57fa22=_0x3429b0?_0x3afc12[_0x80d0('0xe')]:_0x8c3c2c['offset']+_0x8c3c2c[_0x80d0('0xd')];var _0x185af6;if(_0x57fa22>=_0x994aae){_0x57fa22=_0x994aae;_0x185af6=0xc8;}else{_0x185af6=0xce;}_0x4be65e[_0x80d0('0x8')](_0x185af6);return _0x4be65e['set']('Content-Range',_0x500f5e+'-'+_0x57fa22+'/'+_0x994aae)[_0x80d0('0xa')](_0x3afc12);}return null;};}function saveUpdates(_0x49238c){return function(_0x37aed7){if(_0x37aed7){return _0x37aed7['update'](_0x49238c)['then'](function(_0x427434){return _0x427434;});}return null;};}function removeEntity(_0x46c5b9){return function(_0x23495f){if(_0x23495f){return _0x23495f[_0x80d0('0xf')]()[_0x80d0('0x10')](function(){_0x46c5b9[_0x80d0('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32520e){return function(_0x338fb4){if(!_0x338fb4){_0x32520e['sendStatus'](0x194);}return _0x338fb4;};}function handleError(_0x35f2cf,_0x40941b){_0x40941b=_0x40941b||0x1f4;return function(_0x5359ab){logger['error'](_0x5359ab['stack']);if(_0x5359ab[_0x80d0('0x11')]){delete _0x5359ab[_0x80d0('0x11')];}_0x35f2cf[_0x80d0('0x8')](_0x40941b)[_0x80d0('0x12')](_0x5359ab);};}function maskClientSecret(_0x4bc5af){return _[_0x80d0('0x13')](_0x4bc5af[_0x80d0('0x14')](0x0,0x3),0x14,'*');}exports[_0x80d0('0x15')]=function(_0x1eb315,_0x174bcd){var _0x20a4fd={},_0x465921={},_0x2d80dd={'count':0x0,'rows':[]};var _0x18149b=_[_0x80d0('0x16')](db[_0x80d0('0x17')][_0x80d0('0x18')],function(_0x3d7681){return{'name':_0x3d7681[_0x80d0('0x19')],'type':_0x3d7681[_0x80d0('0x1a')][_0x80d0('0x1b')]};});_0x465921[_0x80d0('0x1c')]=_[_0x80d0('0x16')](_0x18149b,_0x80d0('0x11'));_0x465921[_0x80d0('0x1d')]=_['keys'](_0x1eb315['query']);_0x465921['filters']=_[_0x80d0('0x1e')](_0x465921[_0x80d0('0x1c')],_0x465921['query']);_0x20a4fd[_0x80d0('0x1f')]=_[_0x80d0('0x1e')](_0x465921[_0x80d0('0x1c')],qs[_0x80d0('0x20')](_0x1eb315['query']['fields']));_0x20a4fd[_0x80d0('0x1f')]=_0x20a4fd[_0x80d0('0x1f')]['length']?_0x20a4fd[_0x80d0('0x1f')]:_0x465921[_0x80d0('0x1c')];if(!_0x1eb315['query'][_0x80d0('0x21')](_0x80d0('0x22'))){_0x20a4fd[_0x80d0('0xd')]=qs[_0x80d0('0xd')](_0x1eb315['query'][_0x80d0('0xd')]);_0x20a4fd[_0x80d0('0xb')]=qs[_0x80d0('0xb')](_0x1eb315[_0x80d0('0x1d')]['offset']);}_0x20a4fd[_0x80d0('0x23')]=qs[_0x80d0('0x24')](_0x1eb315[_0x80d0('0x1d')]['sort']);_0x20a4fd[_0x80d0('0x25')]=qs[_0x80d0('0x26')](_['pick'](_0x1eb315[_0x80d0('0x1d')],_0x465921[_0x80d0('0x26')]),_0x18149b);if(_0x1eb315['query']['filter']){_0x20a4fd['where']=_['merge'](_0x20a4fd[_0x80d0('0x25')],{'$or':_[_0x80d0('0x16')](_0x18149b,function(_0x24bf71){if(_0x24bf71[_0x80d0('0x1a')]!==_0x80d0('0x27')){var _0x1c046e={};_0x1c046e[_0x24bf71[_0x80d0('0x11')]]={'$like':'%'+_0x1eb315['query'][_0x80d0('0x28')]+'%'};return _0x1c046e;}})});}_0x20a4fd=_[_0x80d0('0x29')]({},_0x20a4fd,_0x1eb315[_0x80d0('0x2a')]);var _0x3c4118={'where':_0x20a4fd[_0x80d0('0x25')]};return db['CloudProvider'][_0x80d0('0xe')](_0x3c4118)[_0x80d0('0x10')](function(_0x340d3c){_0x2d80dd[_0x80d0('0xe')]=_0x340d3c;if(_0x1eb315[_0x80d0('0x1d')][_0x80d0('0x2b')]){_0x20a4fd['include']=[{'all':!![]}];}return db[_0x80d0('0x17')]['findAll'](_0x20a4fd);})[_0x80d0('0x10')](function(_0x2cba23){_0x2d80dd['rows']=_['map'](_0x2cba23,function(_0x225b5a){if(_0x225b5a[_0x80d0('0x2c')]===_0x80d0('0x2d')){var _0x58ac22=encryptor[_0x80d0('0x2e')](_0x225b5a[_0x80d0('0x2f')]);_0x225b5a['data3']=maskClientSecret(_0x58ac22);}return _0x225b5a;});return _0x2d80dd;})[_0x80d0('0x10')](respondWithFilteredResult(_0x174bcd,_0x20a4fd))[_0x80d0('0x30')](handleError(_0x174bcd,null));};exports['show']=function(_0x4a8b4d,_0x27d4cf){var _0x475269={'raw':!![],'where':{'id':_0x4a8b4d[_0x80d0('0x31')]['id']}},_0x2218c3={};_0x2218c3[_0x80d0('0x1c')]=_['keys'](db[_0x80d0('0x17')][_0x80d0('0x18')]);_0x2218c3[_0x80d0('0x1d')]=_['keys'](_0x4a8b4d[_0x80d0('0x1d')]);_0x2218c3['filters']=_[_0x80d0('0x1e')](_0x2218c3[_0x80d0('0x1c')],_0x2218c3[_0x80d0('0x1d')]);_0x475269['attributes']=_['intersection'](_0x2218c3[_0x80d0('0x1c')],qs[_0x80d0('0x20')](_0x4a8b4d[_0x80d0('0x1d')][_0x80d0('0x20')]));_0x475269[_0x80d0('0x1f')]=_0x475269['attributes'][_0x80d0('0x32')]?_0x475269[_0x80d0('0x1f')]:_0x2218c3[_0x80d0('0x1c')];if(_0x4a8b4d[_0x80d0('0x1d')][_0x80d0('0x2b')]){_0x475269['include']=[{'all':!![]}];}_0x475269=_[_0x80d0('0x29')]({},_0x475269,_0x4a8b4d[_0x80d0('0x2a')]);return db[_0x80d0('0x17')]['find'](_0x475269)['then'](handleEntityNotFound(_0x27d4cf,null))[_0x80d0('0x10')](function(_0x30d148){if(_0x30d148[_0x80d0('0x2c')]==='MicrosoftAzure'){var _0x50e0be=encryptor[_0x80d0('0x2e')](_0x30d148[_0x80d0('0x2f')]);_0x30d148[_0x80d0('0x2f')]=maskClientSecret(_0x50e0be);}return _0x30d148;})['then'](respondWithResult(_0x27d4cf,null))['catch'](handleError(_0x27d4cf,null));};exports['create']=function(_0x6686d1,_0x2041cb){if(!_0x6686d1[_0x80d0('0x33')][_0x80d0('0x11')])throw new Error(_0x80d0('0x34'));if(!_0x6686d1['body'][_0x80d0('0x2c')])throw new Error(_0x80d0('0x35'));var _0x5f0136=db[_0x80d0('0x17')]['rawAttributes'][_0x80d0('0x2c')][_0x80d0('0x36')];if(!_0x5f0136['includes'](_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2c')]))throw new Error(_0x80d0('0x37')+_0x5f0136[_0x80d0('0x38')](',\x20'));if(_0x6686d1[_0x80d0('0x33')]['service']===_0x80d0('0x2d')&&_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]){_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]=encryptor[_0x80d0('0x39')](_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]);}return db['CloudProvider'][_0x80d0('0x3a')](_0x6686d1[_0x80d0('0x33')],{})['then'](respondWithResult(_0x2041cb,0xc9))[_0x80d0('0x30')](handleError(_0x2041cb,null));};exports[_0x80d0('0x3b')]=function(_0x3f97eb,_0xa0f6a){if(_0x3f97eb['body']['id']){delete _0x3f97eb[_0x80d0('0x33')]['id'];}return db[_0x80d0('0x17')][_0x80d0('0x3c')]({'where':{'id':_0x3f97eb[_0x80d0('0x31')]['id']}})['then'](handleEntityNotFound(_0xa0f6a,null))[_0x80d0('0x10')](function(_0x3c418e){if(_0x3c418e[_0x80d0('0x2c')]==='MicrosoftAzure'&&_0x3f97eb['body'][_0x80d0('0x2f')]){_0x3f97eb[_0x80d0('0x33')][_0x80d0('0x2f')]=encryptor[_0x80d0('0x39')](_0x3f97eb[_0x80d0('0x33')]['data3']);}return _0x3c418e;})[_0x80d0('0x10')](saveUpdates(_0x3f97eb[_0x80d0('0x33')],null))[_0x80d0('0x10')](respondWithResult(_0xa0f6a,null))['catch'](handleError(_0xa0f6a,null));};exports['destroy']=function(_0x314da2,_0x370804){return db[_0x80d0('0x17')][_0x80d0('0x3c')]({'where':{'id':_0x314da2[_0x80d0('0x31')]['id']}})['then'](handleEntityNotFound(_0x370804,null))[_0x80d0('0x10')](removeEntity(_0x370804,null))['catch'](handleError(_0x370804,null));};exports[_0x80d0('0x3d')]=function(_0x7aeb88,_0x4ba18b){return db[_0x80d0('0x17')][_0x80d0('0x3e')]({'where':{'id':_0x7aeb88[_0x80d0('0x31')]['id']},'raw':!![]})[_0x80d0('0x10')](function(_0x38e31f){if(!_0x38e31f)return _0x4ba18b[_0x80d0('0x3f')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x38e31f,_0x7aeb88['user']['id'])};})[_0x80d0('0x10')](respondWithResult(_0x4ba18b,null))[_0x80d0('0x30')](handleError(_0x4ba18b,null));};exports[_0x80d0('0x40')]=function(_0x222089,_0x215ba9){var _0x1adc12=_0x222089[_0x80d0('0x33')];var _0x476643;var _0x5d7474;if(_0x1adc12['error'])throw _0x1adc12;redis[_0x80d0('0x41')](_0x1adc12[_0x80d0('0x42')])[_0x80d0('0x10')](function(_0x3b3289){if(!_0x3b3289)throw new Error(_0x80d0('0x43'));_0x476643=JSON[_0x80d0('0x44')](_0x3b3289);var _0x5453a9=Buffer[_0x80d0('0x45')](_0x1adc12[_0x80d0('0x42')],_0x80d0('0x46'))[_0x80d0('0x47')]('ascii');_0x5d7474=JSON[_0x80d0('0x44')](_0x5453a9);if(!oauth['isValidIdToken'](_0x1adc12[_0x80d0('0x48')],_0x476643['oauth2Claims']))throw new Error(_0x80d0('0x49'));redis[_0x80d0('0x4a')](_0x1adc12[_0x80d0('0x42')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1adc12[_0x80d0('0x4b')],_0x476643);})[_0x80d0('0x10')](function(_0x428083){_0x476643['data5']=_0x428083[_0x80d0('0x4c')];_0x476643[_0x80d0('0x4d')]=_0x428083[_0x80d0('0x4e')];return db[_0x80d0('0x17')][_0x80d0('0x3b')]({'data5':_0x476643[_0x80d0('0x4f')],'data6':_0x476643[_0x80d0('0x4d')]},{'where':{'id':_0x476643['id']}});})[_0x80d0('0x10')](function(){oauth['startRefreshInterval'](_0x476643);socket['emit'](_0x80d0('0x50'),{'id':_0x5d7474['id']});return;})[_0x80d0('0x10')](respondWithStatusCode(_0x215ba9,null))[_0x80d0('0x30')](function(_0x17e10b){if(_0x5d7474){socket[_0x80d0('0x51')](_0x80d0('0x52'),{'id':_0x5d7474['id']});}if(!_0x476643){logger['error'](_0x80d0('0x53'),_0x17e10b);return _0x215ba9['status'](0x1f4)['send'](_0x17e10b[_0x80d0('0x54')]);}logger[_0x80d0('0x55')](_0x80d0('0x56'),_0x476643['id'],JSON[_0x80d0('0x57')](_0x17e10b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 31655ab..ac76ece 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 _0x1a62=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x3720e7,_0x1556fd){var _0x10e8fe=function(_0x53b4ab){while(--_0x53b4ab){_0x3720e7['push'](_0x3720e7['shift']());}};_0x10e8fe(++_0x1556fd);}(_0x1a62,0x10c));var _0x21a6=function(_0x42f24a,_0x3ee0bc){_0x42f24a=_0x42f24a-0x0;var _0x2e1354=_0x1a62[_0x42f24a];return _0x2e1354;};'use strict';var _=require(_0x21a6('0x0'));var util=require(_0x21a6('0x1'));var logger=require(_0x21a6('0x2'))(_0x21a6('0x3'));var moment=require(_0x21a6('0x4'));var BPromise=require(_0x21a6('0x5'));var rp=require(_0x21a6('0x6'));var fs=require('fs');var path=require(_0x21a6('0x7'));var rimraf=require(_0x21a6('0x8'));var config=require(_0x21a6('0x9'));var attributes=require(_0x21a6('0xa'));module['exports']=function(_0x19aa87,_0x2c0fe9){return _0x19aa87[_0x21a6('0xb')](_0x21a6('0xc'),attributes,{'tableName':_0x21a6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x136b=['bluebird','rimraf','../../config/environment','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x136b,0x1eb));var _0xb136=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x136b[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xb136('0x0'));var util=require('util');var logger=require(_0xb136('0x1'))(_0xb136('0x2'));var moment=require(_0xb136('0x3'));var BPromise=require(_0xb136('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb136('0x5'));var config=require(_0xb136('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x58c72e,_0x1c4a01){return _0x58c72e['define'](_0xb136('0x7'),attributes,{'tableName':_0xb136('0x8'),'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 32c7cd1..b7051a2 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 _0xb2cd=['data6','decryptString','POST','data5','access_token','update','catch','error','authorization_code','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','openid','profile','email','offline_access','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','/.default','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','form_post','state','login','key','value','join','oauth2Claims','oauth2/','set','stringify','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x16ec04,_0x55ecee){var _0x4e9077=function(_0x1ae80a){while(--_0x1ae80a){_0x16ec04['push'](_0x16ec04['shift']());}};_0x4e9077(++_0x55ecee);}(_0xb2cd,0xfe));var _0xdb2c=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb2cd[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xdb2c('0x0'));var crypto=require('crypto');var jwt=require(_0xdb2c('0x1'));var moment=require(_0xdb2c('0x2'));var Redis=require(_0xdb2c('0x3'));var rp=require(_0xdb2c('0x4'));var util=require(_0xdb2c('0x5'));var encryptor=require(_0xdb2c('0x6'));var config=require(_0xdb2c('0x7'));var logger=require(_0xdb2c('0x8'))(_0xdb2c('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xdb2c('0xa'))['db'];config['redis']=_['defaults'](config[_0xdb2c('0xb')],{'host':_0xdb2c('0xc'),'port':0x18eb});var redis=new Redis(config[_0xdb2c('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xdb2c('0xd'),_0xdb2c('0xe'),_0xdb2c('0xf'),_0xdb2c('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xdb2c('0x11')],'Dynamics365':[_0xdb2c('0xd'),_0xdb2c('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xdb2c('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xdb2c('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2268c5){var _0x16a11f=_[_0xdb2c('0x14')](AZURE_AUTH_SCOPES[_0x2268c5['type']]);if(_0x2268c5[_0xdb2c('0x15')]==='Dynamics365')_0x16a11f[_0xdb2c('0x16')](_0x2268c5[_0xdb2c('0x17')]+_0xdb2c('0x18'));return _0x16a11f['join']('\x20');}function getAccessTokenScope(_0x399b47){if(_0x399b47[_0xdb2c('0x15')]===_0xdb2c('0x19'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x399b47[_0xdb2c('0x15')]===_0xdb2c('0x1a'))return _0x399b47['data7']+_0xdb2c('0x18');}function generateMicrosoftAuthorizationUrl(_0x5112cd,_0x485fe7){var _0x13a4c1=MICROSOFT_AUTH_URL[_0xdb2c('0x1b')](_0xdb2c('0x1c'),_0x5112cd[_0xdb2c('0x1d')]);var _0x5af71c=[_0xdb2c('0x1e'),_0xdb2c('0x1f')];var _0x1b1c54=Buffer[_0xdb2c('0x20')](JSON['stringify']({'id':_0x485fe7}))[_0xdb2c('0x21')]('base64');var _0x355716=crypto[_0xdb2c('0x22')](0x10)['toString'](_0xdb2c('0x23'));var _0x4a09af=getAuthorizationScopes(_0x5112cd);var _0x1f2a7e=[{'key':_0xdb2c('0x24'),'value':_0x5112cd[_0xdb2c('0x25')]},{'key':_0xdb2c('0x26'),'value':encodeURIComponent(_0x5af71c['join']('\x20'))},{'key':_0xdb2c('0x27'),'value':_0x5112cd[_0xdb2c('0x28')]},{'key':'response_mode','value':_0xdb2c('0x29')},{'key':'scope','value':encodeURIComponent(_0x4a09af)},{'key':_0xdb2c('0x2a'),'value':_0x1b1c54},{'key':'nonce','value':_0x355716},{'key':'prompt','value':_0xdb2c('0x2b')}];var _0x10a487=_0x13a4c1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdb2c('0x14')](_0x1f2a7e,function(_0x13b4a0){return _0x13b4a0[_0xdb2c('0x2c')]+'='+_0x13b4a0[_0xdb2c('0x2d')];})[_0xdb2c('0x2e')]('&');_0x5112cd[_0xdb2c('0x2f')]={'issuer':_0x13a4c1[_0xdb2c('0x1b')](_0xdb2c('0x30'),''),'audience':_0x5112cd['data1'],'state':_0x1b1c54,'nonce':_0x355716};redis[_0xdb2c('0x31')](_0x1b1c54,JSON[_0xdb2c('0x32')](_0x5112cd));return _0x10a487;}function isValidIdToken(_0x40fdad,_0x25150b){try{var _0x2ddcca=jwt['decode'](_0x40fdad,{'complete':!![]});var _0x316328=_0x2ddcca[_0xdb2c('0x33')];if(_0x316328[_0xdb2c('0x34')]!==_0x25150b[_0xdb2c('0x35')])return![];if(_0x316328[_0xdb2c('0x36')]!==_0x25150b[_0xdb2c('0x37')])return![];if(_0x316328[_0xdb2c('0x38')]!==_0x25150b[_0xdb2c('0x38')])return![];if(moment()[_0xdb2c('0x39')](moment[_0xdb2c('0x3a')](_0x316328[_0xdb2c('0x3b')])))return![];return!![];}catch(_0x1bc0c7){throw _0x1bc0c7;}}function refreshOauth2MicrosoftAccessToken(_0xd36b1f){return Promise[_0xdb2c('0x3c')]()[_0xdb2c('0x3d')](function(){if(_0xd36b1f[_0xdb2c('0x3e')])return _0xd36b1f;return db[_0xdb2c('0x3f')][_0xdb2c('0x40')]({'where':{'id':_0xd36b1f['id']},'raw':!![]});})['then'](function(_0x2f68b3){var _0x8f16f8={'grant_type':_0xdb2c('0x41'),'refresh_token':_0x2f68b3[_0xdb2c('0x42')],'scope':getAccessTokenScope(_0x2f68b3),'redirect_uri':_0x2f68b3['data4'],'client_id':_0x2f68b3['data1'],'client_secret':encryptor[_0xdb2c('0x43')](_0x2f68b3['data3'])};var _0x24ce76={'method':_0xdb2c('0x44'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdb2c('0x1c'),_0x2f68b3[_0xdb2c('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x8f16f8,'json':!![]};return rp(_0x24ce76);})[_0xdb2c('0x3d')](function(_0x395109){_0xd36b1f[_0xdb2c('0x45')]=_0x395109[_0xdb2c('0x46')];_0xd36b1f[_0xdb2c('0x42')]=_0x395109['refresh_token'];return db[_0xdb2c('0x3f')][_0xdb2c('0x47')]({'data5':_0xd36b1f[_0xdb2c('0x45')],'data6':_0xd36b1f[_0xdb2c('0x42')]},{'where':{'id':_0xd36b1f['id']}});})[_0xdb2c('0x3d')](function(){return _0xd36b1f;})[_0xdb2c('0x48')](function(_0x3f4289){logger[_0xdb2c('0x49')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xd36b1f['id'],_0x3f4289);});}function getOauth2MicrosoftAccessToken(_0x4946f8,_0x520c56){var _0x5754d5={'grant_type':_0xdb2c('0x4a'),'code':_0x4946f8,'scope':getAccessTokenScope(_0x520c56),'redirect_uri':_0x520c56[_0xdb2c('0x28')],'client_id':_0x520c56[_0xdb2c('0x25')],'client_secret':encryptor[_0xdb2c('0x43')](_0x520c56['data3'])};var _0xfb52e7={'method':_0xdb2c('0x44'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdb2c('0x1c'),_0x520c56[_0xdb2c('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5754d5,'json':!![]};return rp(_0xfb52e7);}function startRefreshInterval(_0x19f972){var _0x6323ed=schedule[_0xdb2c('0x4b')];if(_0x6323ed[_0x19f972['id']])clearInterval(_0x6323ed[_0x19f972['id']]);_0x6323ed[_0x19f972['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x19f972['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x6323ed;}function startAllRefreshIntervals(){return db[_0xdb2c('0x3f')][_0xdb2c('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xdb2c('0x3d')](function(_0x446acb){var _0x3eb830=_0x446acb['map'](function(_0x411891){return refreshOauth2MicrosoftAccessToken(_0x411891)['then'](function(_0x5051eb){startRefreshInterval(_0x5051eb);});});return Promise[_0xdb2c('0x4d')](_0x3eb830);})[_0xdb2c('0x48')](function(_0x298cd2){var _0xc93fba=_0x298cd2?util['inspect'](_0x298cd2,{'showHidden':![],'depth':null}):'';logger[_0xdb2c('0x49')](_0xdb2c('0x4e'),_0xc93fba);});}module[_0xdb2c('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xfb7d=['data2','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','Dynamics365','push','data7','/.default','join','Outlook365','type','replace','code','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','set','payload','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}'];(function(_0x3f7396,_0x32395b){var _0x19fea7=function(_0x56d188){while(--_0x56d188){_0x3f7396['push'](_0x3f7396['shift']());}};_0x19fea7(++_0x32395b);}(_0xfb7d,0xa3));var _0xdfb7=function(_0x2fe46e,_0x5e041f){_0x2fe46e=_0x2fe46e-0x0;var _0x226f6=_0xfb7d[_0x2fe46e];return _0x226f6;};'use strict';var _=require(_0xdfb7('0x0'));var crypto=require('crypto');var jwt=require(_0xdfb7('0x1'));var moment=require(_0xdfb7('0x2'));var Redis=require(_0xdfb7('0x3'));var rp=require(_0xdfb7('0x4'));var util=require(_0xdfb7('0x5'));var encryptor=require(_0xdfb7('0x6'));var config=require('../../config/environment');var logger=require(_0xdfb7('0x7'))(_0xdfb7('0x8'));var schedule=require(_0xdfb7('0x9'));var db=require(_0xdfb7('0xa'))['db'];config[_0xdfb7('0xb')]=_['defaults'](config[_0xdfb7('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xdfb7('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xdfb7('0xd'),_0xdfb7('0xe'),'email',_0xdfb7('0xf'),_0xdfb7('0x10'),_0xdfb7('0x11'),_0xdfb7('0x12')],'Dynamics365':[_0xdfb7('0xd'),_0xdfb7('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2116cd){var _0x4777f3=_[_0xdfb7('0x13')](AZURE_AUTH_SCOPES[_0x2116cd['type']]);if(_0x2116cd['type']===_0xdfb7('0x14'))_0x4777f3[_0xdfb7('0x15')](_0x2116cd[_0xdfb7('0x16')]+_0xdfb7('0x17'));return _0x4777f3[_0xdfb7('0x18')]('\x20');}function getAccessTokenScope(_0x5ad687){if(_0x5ad687['type']===_0xdfb7('0x19'))return _0xdfb7('0x10');if(_0x5ad687[_0xdfb7('0x1a')]==='Dynamics365')return _0x5ad687[_0xdfb7('0x16')]+_0xdfb7('0x17');}function generateMicrosoftAuthorizationUrl(_0x39be36,_0x4f6af7){var _0x2783f7=MICROSOFT_AUTH_URL[_0xdfb7('0x1b')]('{TENANT_ID}',_0x39be36['data2']);var _0x4fdec5=[_0xdfb7('0x1c'),'id_token'];var _0x23b9e1=Buffer['from'](JSON[_0xdfb7('0x1d')]({'id':_0x4f6af7}))[_0xdfb7('0x1e')](_0xdfb7('0x1f'));var _0x479afc=crypto[_0xdfb7('0x20')](0x10)[_0xdfb7('0x1e')](_0xdfb7('0x21'));var _0xa07b50=getAuthorizationScopes(_0x39be36);var _0x468eec=[{'key':_0xdfb7('0x22'),'value':_0x39be36[_0xdfb7('0x23')]},{'key':_0xdfb7('0x24'),'value':encodeURIComponent(_0x4fdec5['join']('\x20'))},{'key':_0xdfb7('0x25'),'value':_0x39be36[_0xdfb7('0x26')]},{'key':_0xdfb7('0x27'),'value':'form_post'},{'key':_0xdfb7('0x28'),'value':encodeURIComponent(_0xa07b50)},{'key':_0xdfb7('0x29'),'value':_0x23b9e1},{'key':_0xdfb7('0x2a'),'value':_0x479afc},{'key':_0xdfb7('0x2b'),'value':_0xdfb7('0x2c')}];var _0x404f60=_0x2783f7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdfb7('0x13')](_0x468eec,function(_0x1be107){return _0x1be107[_0xdfb7('0x2d')]+'='+_0x1be107['value'];})[_0xdfb7('0x18')]('&');_0x39be36[_0xdfb7('0x2e')]={'issuer':_0x2783f7['replace'](_0xdfb7('0x2f'),''),'audience':_0x39be36[_0xdfb7('0x23')],'state':_0x23b9e1,'nonce':_0x479afc};redis[_0xdfb7('0x30')](_0x23b9e1,JSON[_0xdfb7('0x1d')](_0x39be36));return _0x404f60;}function isValidIdToken(_0x2a1e67,_0x36d11e){try{var _0xb8ccdb=jwt['decode'](_0x2a1e67,{'complete':!![]});var _0x55a462=_0xb8ccdb[_0xdfb7('0x31')];if(_0x55a462['iss']!==_0x36d11e['issuer'])return![];if(_0x55a462[_0xdfb7('0x32')]!==_0x36d11e[_0xdfb7('0x33')])return![];if(_0x55a462[_0xdfb7('0x2a')]!==_0x36d11e[_0xdfb7('0x2a')])return![];if(moment()[_0xdfb7('0x34')](moment[_0xdfb7('0x35')](_0x55a462[_0xdfb7('0x36')])))return![];return!![];}catch(_0x5cb3ec){throw _0x5cb3ec;}}function refreshOauth2MicrosoftAccessToken(_0x3a49fc){return Promise[_0xdfb7('0x37')]()[_0xdfb7('0x38')](function(){if(_0x3a49fc[_0xdfb7('0x39')])return _0x3a49fc;return db[_0xdfb7('0x3a')][_0xdfb7('0x3b')]({'where':{'id':_0x3a49fc['id']},'raw':!![]});})['then'](function(_0x3018e4){var _0x3468f2={'grant_type':_0xdfb7('0x3c'),'refresh_token':_0x3018e4[_0xdfb7('0x3d')],'scope':getAccessTokenScope(_0x3018e4),'redirect_uri':_0x3018e4[_0xdfb7('0x26')],'client_id':_0x3018e4[_0xdfb7('0x23')],'client_secret':encryptor[_0xdfb7('0x3e')](_0x3018e4[_0xdfb7('0x39')])};var _0xb8e1f5={'method':_0xdfb7('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdfb7('0x40'),_0x3018e4[_0xdfb7('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3468f2,'json':!![]};return rp(_0xb8e1f5);})['then'](function(_0x593626){_0x3a49fc['data5']=_0x593626['access_token'];_0x3a49fc[_0xdfb7('0x3d')]=_0x593626['refresh_token'];return db['CloudProvider']['update']({'data5':_0x3a49fc[_0xdfb7('0x42')],'data6':_0x3a49fc[_0xdfb7('0x3d')]},{'where':{'id':_0x3a49fc['id']}});})[_0xdfb7('0x38')](function(){return _0x3a49fc;})['catch'](function(_0x310b4f){logger[_0xdfb7('0x43')](_0xdfb7('0x44'),_0x3a49fc['id'],_0x310b4f);});}function getOauth2MicrosoftAccessToken(_0x29a9dc,_0x292e1e){var _0x27184a={'grant_type':_0xdfb7('0x45'),'code':_0x29a9dc,'scope':getAccessTokenScope(_0x292e1e),'redirect_uri':_0x292e1e['data4'],'client_id':_0x292e1e[_0xdfb7('0x23')],'client_secret':encryptor[_0xdfb7('0x3e')](_0x292e1e['data3'])};var _0x44521e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xdfb7('0x1b')]('{TENANT_ID}',_0x292e1e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x27184a,'json':!![]};return rp(_0x44521e);}function startRefreshInterval(_0x45c741){var _0x5c0a9d=schedule[_0xdfb7('0x46')];if(_0x5c0a9d[_0x45c741['id']])clearInterval(_0x5c0a9d[_0x45c741['id']]);_0x5c0a9d[_0x45c741['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdfb7('0x47')](this,{'id':_0x45c741['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5c0a9d;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xdfb7('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xdfb7('0x38')](function(_0x56d33b){var _0x4f41de=_0x56d33b['map'](function(_0x4bc4c7){return refreshOauth2MicrosoftAccessToken(_0x4bc4c7)[_0xdfb7('0x38')](function(_0x47e85a){startRefreshInterval(_0x47e85a);});});return Promise['all'](_0x4f41de);})[_0xdfb7('0x49')](function(_0x3e6046){var _0x3609cf=_0x3e6046?util['inspect'](_0x3e6046,{'showHidden':![],'depth':null}):'';logger[_0xdfb7('0x43')](_0xdfb7('0x4a'),_0x3609cf);});}module[_0xdfb7('0x4b')]={'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 46762c0..8c7c5cd 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 _0x3d3d=['info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5e1d73,_0x34e791){var _0x3f15cd=function(_0x15de48){while(--_0x15de48){_0x5e1d73['push'](_0x5e1d73['shift']());}};_0x3f15cd(++_0x34e791);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa421,_0x1f47fe,_0x263940){return new BPromise(function(_0x3fe58e,_0x2ed96f){return client['request'](_0x4aa421,_0x263940)[_0xd3d3('0xc')](function(_0x412054){logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x1f47fe,'request\x20sent');logger[_0xd3d3('0xf')](_0xd3d3('0x10'),_0x1f47fe,_0xd3d3('0x11'),JSON[_0xd3d3('0x12')](_0x412054));if(_0x412054[_0xd3d3('0x13')]){if(_0x412054[_0xd3d3('0x13')]['code']===0x1f4){logger[_0xd3d3('0x13')]('CloudProvider,\x20%s,\x20%s',_0x1f47fe,_0x412054['error']['message']);return _0x2ed96f(_0x412054[_0xd3d3('0x13')]['message']);}logger['error'](_0xd3d3('0xe'),_0x1f47fe,_0x412054[_0xd3d3('0x13')]['message']);return _0x3fe58e(_0x412054[_0xd3d3('0x13')]['message']);}else{logger['info'](_0xd3d3('0xe'),_0x1f47fe,_0xd3d3('0x11'));_0x3fe58e(_0x412054[_0xd3d3('0x14')][_0xd3d3('0x15')]);}})[_0xd3d3('0x16')](function(_0x5c3462){logger[_0xd3d3('0x13')](_0xd3d3('0xe'),_0x1f47fe,_0x5c3462);_0x2ed96f(_0x5c3462);});});} \ No newline at end of file +var _0x4b74=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x4b74,0x103));var _0x44b7=function(_0x54a9b7,_0x216841){_0x54a9b7=_0x54a9b7-0x0;var _0xc00ec4=_0x4b74[_0x54a9b7];return _0xc00ec4;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var moment=require(_0x44b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x44b7('0x3'));var fs=require('fs');var Redis=require(_0x44b7('0x4'));var db=require(_0x44b7('0x5'))['db'];var utils=require(_0x44b7('0x6'));var logger=require(_0x44b7('0x7'))(_0x44b7('0x8'));var config=require(_0x44b7('0x9'));var jayson=require(_0x44b7('0xa'));var client=jayson['client'][_0x44b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2174f2,_0x7b80e9,_0x4a582b){return new BPromise(function(_0x45dfbe,_0xabf05c){return client[_0x44b7('0xc')](_0x2174f2,_0x4a582b)['then'](function(_0x7d4b17){logger[_0x44b7('0xd')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'));logger[_0x44b7('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'),JSON[_0x44b7('0x10')](_0x7d4b17));if(_0x7d4b17[_0x44b7('0x11')]){if(_0x7d4b17['error'][_0x44b7('0x12')]===0x1f4){logger[_0x44b7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17[_0x44b7('0x11')]['message']);return _0xabf05c(_0x7d4b17[_0x44b7('0x11')][_0x44b7('0x13')]);}logger[_0x44b7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17['error'][_0x44b7('0x13')]);return _0x45dfbe(_0x7d4b17['error']['message']);}else{logger['info'](_0x44b7('0x14'),_0x7b80e9,_0x44b7('0xe'));_0x45dfbe(_0x7d4b17['result'][_0x44b7('0x13')]);}})[_0x44b7('0x15')](function(_0x3528c8){logger[_0x44b7('0x11')](_0x44b7('0x14'),_0x7b80e9,_0x3528c8);_0xabf05c(_0x3528c8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ec4eb2f..f7e897f 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x1261,0x144));var _0x1126=function(_0x1d7bc0,_0x50a455){_0x1d7bc0=_0x1d7bc0-0x0;var _0x15a179=_0x1261[_0x1d7bc0];return _0x15a179;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x1261,0x144));var _0x1126=function(_0x558615,_0x1eb496){_0x558615=_0x558615-0x0;var _0x1e032a=_0x1261[_0x558615];return _0x1e032a;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c8a8982..a500f4b 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 _0xb2bb=['sequelize','STRING','name'];(function(_0x32674c,_0x179fd4){var _0x940adc=function(_0x337a76){while(--_0x337a76){_0x32674c['push'](_0x32674c['shift']());}};_0x940adc(++_0x179fd4);}(_0xb2bb,0x198));var _0xbb2b=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xb2bb[_0x5a636f];return _0x6a8cfb;};'use strict';var Sequelize=require(_0xbb2b('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb2b('0x1')],'unique':_0xbb2b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbb2b('0x1')]},'companyId':{'type':Sequelize[_0xbb2b('0x1')]},'website':{'type':Sequelize[_0xbb2b('0x1')]},'phone':{'type':Sequelize[_0xbb2b('0x1')]},'fax':{'type':Sequelize[_0xbb2b('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbb2b('0x1')]},'postalCode':{'type':Sequelize[_0xbb2b('0x1')]},'city':{'type':Sequelize[_0xbb2b('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbb2b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbb2b('0x1')]},'sStreet':{'type':Sequelize[_0xbb2b('0x1')]},'sPostalCode':{'type':Sequelize[_0xbb2b('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xbb2b('0x1')]},'description':{'type':Sequelize[_0xbb2b('0x1')]}}; \ No newline at end of file +var _0xfe78=['name','exports','STRING'];(function(_0x564104,_0x74c357){var _0x6dabcd=function(_0x1b3d56){while(--_0x1b3d56){_0x564104['push'](_0x564104['shift']());}};_0x6dabcd(++_0x74c357);}(_0xfe78,0x70));var _0x8fe7=function(_0x4c2c04,_0x5e38cf){_0x4c2c04=_0x4c2c04-0x0;var _0x2e7e99=_0xfe78[_0x4c2c04];return _0x2e7e99;};'use strict';var Sequelize=require('sequelize');module[_0x8fe7('0x0')]={'name':{'type':Sequelize[_0x8fe7('0x1')],'unique':_0x8fe7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8fe7('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8fe7('0x1')]},'type':{'type':Sequelize[_0x8fe7('0x1')]},'street':{'type':Sequelize[_0x8fe7('0x1')]},'postalCode':{'type':Sequelize[_0x8fe7('0x1')]},'city':{'type':Sequelize[_0x8fe7('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8fe7('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8fe7('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8fe7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8a090a5..fea23ef 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 _0x6150=['catch','show','rawAttributes','fields','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','CmContact','addContacts','ids','omit','getContacts','findOne','map','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','get','Companies','destroy','then','end','sendStatus','error','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows'];(function(_0x5ebb78,_0x108363){var _0x748baf=function(_0x26b1a3){while(--_0x26b1a3){_0x5ebb78['push'](_0x5ebb78['shift']());}};_0x748baf(++_0x108363);}(_0x6150,0x1d2));var _0x0615=function(_0x4fffea,_0x5b89d2){_0x4fffea=_0x4fffea-0x0;var _0x1a891f=_0x6150[_0x4fffea];return _0x1a891f;};'use strict';var emlformat=require(_0x0615('0x0'));var rimraf=require(_0x0615('0x1'));var zipdir=require(_0x0615('0x2'));var jsonpatch=require(_0x0615('0x3'));var rp=require(_0x0615('0x4'));var moment=require(_0x0615('0x5'));var BPromise=require(_0x0615('0x6'));var Mustache=require(_0x0615('0x7'));var util=require(_0x0615('0x8'));var path=require(_0x0615('0x9'));var sox=require(_0x0615('0xa'));var csv=require(_0x0615('0xb'));var ejs=require(_0x0615('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0615('0xd'));var squel=require(_0x0615('0xe'));var crypto=require(_0x0615('0xf'));var jsforce=require(_0x0615('0x10'));var deskjs=require(_0x0615('0x11'));var toCsv=require(_0x0615('0xb'));var querystring=require(_0x0615('0x12'));var Papa=require('papaparse');var Redis=require(_0x0615('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0615('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0615('0x15'));var logger=require(_0x0615('0x16'))(_0x0615('0x17'));var utils=require(_0x0615('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0615('0x19'));var db=require(_0x0615('0x1a'))['db'];function respondWithStatusCode(_0x56ba6c,_0x404e29){_0x404e29=_0x404e29||0xcc;return function(_0x5d8c8c){if(_0x5d8c8c){return _0x56ba6c['sendStatus'](_0x404e29);}return _0x56ba6c[_0x0615('0x1b')](_0x404e29)['end']();};}function respondWithResult(_0x457a3e,_0x3304da){_0x3304da=_0x3304da||0xc8;return function(_0x5d8535){if(_0x5d8535){return _0x457a3e[_0x0615('0x1b')](_0x3304da)[_0x0615('0x1c')](_0x5d8535);}};}function respondWithFilteredResult(_0x60ec8,_0x44f464){return function(_0x5b631d){if(_0x5b631d){var _0x219ed5=typeof _0x44f464[_0x0615('0x1d')]===_0x0615('0x1e')&&typeof _0x44f464[_0x0615('0x1f')]===_0x0615('0x1e');var _0xa81a13=_0x5b631d['count'];var _0x16912b=_0x219ed5?0x0:_0x44f464[_0x0615('0x1d')];var _0x10f50f=_0x219ed5?_0x5b631d[_0x0615('0x20')]:_0x44f464['offset']+_0x44f464[_0x0615('0x1f')];var _0x174ba5;if(_0x10f50f>=_0xa81a13){_0x10f50f=_0xa81a13;_0x174ba5=0xc8;}else{_0x174ba5=0xce;}_0x60ec8[_0x0615('0x1b')](_0x174ba5);return _0x60ec8[_0x0615('0x21')](_0x0615('0x22'),_0x16912b+'-'+_0x10f50f+'/'+_0xa81a13)['json'](_0x5b631d);}return null;};}function patchUpdates(_0x62b0f9){return function(_0x541faf){try{jsonpatch[_0x0615('0x23')](_0x541faf,_0x62b0f9,!![]);}catch(_0x305063){return BPromise['reject'](_0x305063);}return _0x541faf[_0x0615('0x24')]();};}function saveUpdates(_0x1d73c1,_0x244bb5){return function(_0x5d9a59){if(_0x5d9a59){return _0x5d9a59['update'](_0x1d73c1)['then'](function(_0x5cf1a9){return _0x5cf1a9;});}return null;};}function removeEntity(_0x583928,_0x104cfa){return function(_0xe46621){if(_0xe46621){return _0xe46621['destroy']()['then'](function(){var _0x35f297=_0xe46621[_0x0615('0x25')]({'plain':!![]});var _0x4e5da8=_0x0615('0x26');return db['UserProfileResource'][_0x0615('0x27')]({'where':{'type':_0x4e5da8,'resourceId':_0x35f297['id']}})[_0x0615('0x28')](function(){return _0xe46621;});})[_0x0615('0x28')](function(){_0x583928['status'](0xcc)[_0x0615('0x29')]();});}};}function handleEntityNotFound(_0x4b9bb9,_0x14fae5){return function(_0x437f8c){if(!_0x437f8c){_0x4b9bb9[_0x0615('0x2a')](0x194);}return _0x437f8c;};}function handleError(_0x2644e2,_0x15b57c){_0x15b57c=_0x15b57c||0x1f4;return function(_0x26abe7){logger[_0x0615('0x2b')](_0x26abe7[_0x0615('0x2c')]);if(_0x26abe7[_0x0615('0x2d')]){delete _0x26abe7['name'];}_0x2644e2[_0x0615('0x1b')](_0x15b57c)[_0x0615('0x2e')](_0x26abe7);};}exports['index']=function(_0x1f1b9e,_0x36946d){var _0x3cf61c={},_0x28b319={},_0x5ad3ba={'count':0x0,'rows':[]};return db[_0x0615('0x2f')][_0x0615('0x30')]()[_0x0615('0x28')](function(_0xd87249){_0x28b319[_0x0615('0x31')]=_[_0x0615('0x32')](_0xd87249);_0x28b319[_0x0615('0x33')]=_['keys'](_0x1f1b9e[_0x0615('0x33')]);_0x28b319[_0x0615('0x34')]=_[_0x0615('0x35')](_0x28b319[_0x0615('0x31')],_0x28b319[_0x0615('0x33')]);_0x3cf61c[_0x0615('0x36')]=_[_0x0615('0x35')](_0x28b319[_0x0615('0x31')],qs['fields'](_0x1f1b9e[_0x0615('0x33')]['fields']));_0x3cf61c['attributes']=_0x3cf61c['attributes'][_0x0615('0x37')]?_0x3cf61c[_0x0615('0x36')]:_0x28b319[_0x0615('0x31')];if(!_0x1f1b9e[_0x0615('0x33')][_0x0615('0x38')](_0x0615('0x39'))){_0x3cf61c['limit']=qs[_0x0615('0x1f')](_0x1f1b9e['query'][_0x0615('0x1f')]);_0x3cf61c[_0x0615('0x1d')]=qs['offset'](_0x1f1b9e[_0x0615('0x33')][_0x0615('0x1d')]);}_0x3cf61c[_0x0615('0x3a')]=qs[_0x0615('0x3b')](_0x1f1b9e['query'][_0x0615('0x3b')]);_0x3cf61c[_0x0615('0x3c')]=qs[_0x0615('0x34')](_[_0x0615('0x3d')](_0x1f1b9e[_0x0615('0x33')],_0x28b319['filters']),_0xd87249);if(_0x1f1b9e[_0x0615('0x33')][_0x0615('0x3e')]){_0x3cf61c[_0x0615('0x3c')]=_[_0x0615('0x3f')](_0x3cf61c[_0x0615('0x3c')],{'$or':_['map'](_0x3cf61c['attributes'],function(_0x285e42){var _0x37d2e1={};_0x37d2e1[_0x285e42]={'$like':'%'+_0x1f1b9e['query']['filter']+'%'};return _0x37d2e1;})});}_0x3cf61c=_[_0x0615('0x3f')]({},_0x3cf61c,_0x1f1b9e[_0x0615('0x40')]);var _0x212cc4={'where':_0x3cf61c[_0x0615('0x3c')]};return db[_0x0615('0x2f')][_0x0615('0x20')](_0x212cc4)[_0x0615('0x28')](function(_0x838207){_0x5ad3ba['count']=_0x838207;if(_0x1f1b9e[_0x0615('0x33')]['includeAll']){_0x3cf61c[_0x0615('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x0615('0x42')](_0x3cf61c);})['then'](function(_0x122c8e){_0x5ad3ba[_0x0615('0x43')]=_0x122c8e;return _0x5ad3ba;})[_0x0615('0x28')](respondWithFilteredResult(_0x36946d,_0x3cf61c))[_0x0615('0x44')](handleError(_0x36946d,null));})[_0x0615('0x44')](handleError(_0x36946d,null));};exports[_0x0615('0x45')]=function(_0xcc0351,_0x3588aa){var _0x1005e6={'raw':![],'where':{'id':_0xcc0351['params']['id']}},_0x1ff4da={};_0x1ff4da[_0x0615('0x31')]=_['keys'](db[_0x0615('0x2f')][_0x0615('0x46')]);_0x1ff4da[_0x0615('0x33')]=_[_0x0615('0x32')](_0xcc0351[_0x0615('0x33')]);_0x1ff4da[_0x0615('0x34')]=_[_0x0615('0x35')](_0x1ff4da[_0x0615('0x31')],_0x1ff4da[_0x0615('0x33')]);_0x1005e6[_0x0615('0x36')]=_['intersection'](_0x1ff4da[_0x0615('0x31')],qs['fields'](_0xcc0351[_0x0615('0x33')][_0x0615('0x47')]));_0x1005e6[_0x0615('0x36')]=_0x1005e6[_0x0615('0x36')]['length']?_0x1005e6[_0x0615('0x36')]:_0x1ff4da[_0x0615('0x31')];if(_0xcc0351[_0x0615('0x33')][_0x0615('0x48')]){_0x1005e6[_0x0615('0x41')]=[{'all':!![]}];}_0x1005e6=_[_0x0615('0x3f')]({},_0x1005e6,_0xcc0351[_0x0615('0x40')]);return db[_0x0615('0x2f')][_0x0615('0x49')](_0x1005e6)[_0x0615('0x28')](handleEntityNotFound(_0x3588aa,null))[_0x0615('0x28')](respondWithResult(_0x3588aa,null))[_0x0615('0x44')](handleError(_0x3588aa,null));};exports[_0x0615('0x4a')]=function(_0x5d55b7,_0x844db8){return db[_0x0615('0x2f')][_0x0615('0x4a')](_0x5d55b7['body'],{})['then'](function(_0x5b545c){var _0xea4d7a=_0x5d55b7['user']['get']({'plain':!![]});if(!_0xea4d7a)throw new Error(_0x0615('0x4b'));if(_0xea4d7a['role']==='user'){var _0x22761c=_0x5b545c[_0x0615('0x25')]({'plain':!![]});var _0x4b957b=_0x0615('0x26');return db[_0x0615('0x4c')][_0x0615('0x49')]({'where':{'name':_0x4b957b,'userProfileId':_0xea4d7a['userProfileId']},'raw':!![]})[_0x0615('0x28')](function(_0x307345){if(_0x307345&&_0x307345['autoAssociation']===0x0){return db[_0x0615('0x4d')][_0x0615('0x4a')]({'name':_0x22761c[_0x0615('0x2d')],'resourceId':_0x22761c['id'],'type':_0x307345[_0x0615('0x2d')],'sectionId':_0x307345['id']},{})[_0x0615('0x28')](function(){return _0x5b545c;});}else{return _0x5b545c;}})['catch'](function(_0x3dfa4d){logger[_0x0615('0x2b')](_0x0615('0x4e'),_0x3dfa4d);throw _0x3dfa4d;});}return _0x5b545c;})['then'](respondWithResult(_0x844db8,0xc9))[_0x0615('0x44')](handleError(_0x844db8,null));};exports[_0x0615('0x4f')]=function(_0x49900a,_0x32d73e){if(_0x49900a['body']['id']){delete _0x49900a[_0x0615('0x50')]['id'];}return db['CmCompany'][_0x0615('0x49')]({'where':{'id':_0x49900a['params']['id']}})[_0x0615('0x28')](handleEntityNotFound(_0x32d73e,null))[_0x0615('0x28')](saveUpdates(_0x49900a[_0x0615('0x50')],null))['then'](respondWithResult(_0x32d73e,null))[_0x0615('0x44')](handleError(_0x32d73e,null));};exports[_0x0615('0x27')]=function(_0x4bd63c,_0x50bfde){return db['CmCompany']['find']({'where':{'id':_0x4bd63c[_0x0615('0x51')]['id']}})[_0x0615('0x28')](handleEntityNotFound(_0x50bfde,null))[_0x0615('0x28')](removeEntity(_0x50bfde,null))[_0x0615('0x44')](handleError(_0x50bfde,null));};exports['describe']=function(_0x3a09ed,_0x5c3e9a){return db['CmCompany'][_0x0615('0x30')]()[_0x0615('0x28')](respondWithResult(_0x5c3e9a,null))[_0x0615('0x44')](handleError(_0x5c3e9a,null));};exports['addContacts']=function(_0x5c386f,_0x136570,_0x2c394f){return db[_0x0615('0x52')][_0x0615('0x49')]({'where':{'id':_0x5c386f[_0x0615('0x51')]['id']}})[_0x0615('0x28')](handleEntityNotFound(_0x136570,null))[_0x0615('0x28')](function(_0xd3f255){if(_0xd3f255){return _0xd3f255[_0x0615('0x53')](_0x5c386f['body'][_0x0615('0x54')],_[_0x0615('0x55')](_0x5c386f['body'],[_0x0615('0x54'),'id'])||{});}})[_0x0615('0x28')](respondWithResult(_0x136570,null))[_0x0615('0x44')](handleError(_0x136570,null));};exports[_0x0615('0x56')]=function(_0x3d31cc,_0x250d8d,_0x4590d2){var _0x43625e={};var _0x361677={};var _0x1b43e4;var _0x5b658c;return db[_0x0615('0x2f')][_0x0615('0x57')]({'where':{'id':_0x3d31cc[_0x0615('0x51')]['id']}})['then'](handleEntityNotFound(_0x250d8d,null))[_0x0615('0x28')](function(_0x51f376){if(_0x51f376){_0x1b43e4=_0x51f376;_0x361677[_0x0615('0x31')]=_[_0x0615('0x32')](db[_0x0615('0x52')]['rawAttributes']);_0x361677[_0x0615('0x33')]=_['keys'](_0x3d31cc[_0x0615('0x33')]);_0x361677[_0x0615('0x34')]=_['intersection'](_0x361677[_0x0615('0x31')],_0x361677[_0x0615('0x33')]);_0x43625e[_0x0615('0x36')]=_[_0x0615('0x35')](_0x361677[_0x0615('0x31')],qs['fields'](_0x3d31cc[_0x0615('0x33')][_0x0615('0x47')]));_0x43625e[_0x0615('0x36')]=_0x43625e[_0x0615('0x36')][_0x0615('0x37')]?_0x43625e['attributes']:_0x361677['model'];_0x43625e[_0x0615('0x3a')]=qs[_0x0615('0x3b')](_0x3d31cc[_0x0615('0x33')]['sort']);_0x43625e[_0x0615('0x3c')]=qs[_0x0615('0x34')](_[_0x0615('0x3d')](_0x3d31cc['query'],_0x361677[_0x0615('0x34')]));if(_0x3d31cc[_0x0615('0x33')][_0x0615('0x3e')]){_0x43625e[_0x0615('0x3c')]=_[_0x0615('0x3f')](_0x43625e[_0x0615('0x3c')],{'$or':_[_0x0615('0x58')](_0x43625e['attributes'],function(_0x1b6e29){var _0x59a38b={};_0x59a38b[_0x1b6e29]={'$like':'%'+_0x3d31cc[_0x0615('0x33')][_0x0615('0x3e')]+'%'};return _0x59a38b;})});}_0x43625e=_[_0x0615('0x3f')]({},_0x43625e,_0x3d31cc['options']);return _0x1b43e4[_0x0615('0x56')](_0x43625e);}})[_0x0615('0x28')](function(_0x18af1f){if(_0x18af1f){_0x5b658c=_0x18af1f[_0x0615('0x37')];if(!_0x3d31cc[_0x0615('0x33')]['hasOwnProperty']('nolimit')){_0x43625e['limit']=qs[_0x0615('0x1f')](_0x3d31cc[_0x0615('0x33')]['limit']);_0x43625e[_0x0615('0x1d')]=qs[_0x0615('0x1d')](_0x3d31cc[_0x0615('0x33')]['offset']);}return _0x1b43e4[_0x0615('0x56')](_0x43625e);}})[_0x0615('0x28')](function(_0x5926d9){if(_0x5926d9){return _0x5926d9?{'count':_0x5b658c,'rows':_0x5926d9}:null;}})['then'](respondWithResult(_0x250d8d,null))[_0x0615('0x44')](handleError(_0x250d8d,null));}; \ No newline at end of file +var _0x92be=['getContacts','findOne','order','map','options','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','rows','catch','show','rawAttributes','keys','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids'];(function(_0x4c9ed,_0x4357e1){var _0x49427b=function(_0x7b6da6){while(--_0x7b6da6){_0x4c9ed['push'](_0x4c9ed['shift']());}};_0x49427b(++_0x4357e1);}(_0x92be,0x107));var _0xe92b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x92be[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xe92b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe92b('0x1'));var jsonpatch=require(_0xe92b('0x2'));var rp=require(_0xe92b('0x3'));var moment=require('moment');var BPromise=require(_0xe92b('0x4'));var Mustache=require(_0xe92b('0x5'));var util=require(_0xe92b('0x6'));var path=require(_0xe92b('0x7'));var sox=require(_0xe92b('0x8'));var csv=require(_0xe92b('0x9'));var ejs=require(_0xe92b('0xa'));var fs=require('fs');var fs_extra=require(_0xe92b('0xb'));var _=require(_0xe92b('0xc'));var squel=require(_0xe92b('0xd'));var crypto=require('crypto');var jsforce=require(_0xe92b('0xe'));var deskjs=require(_0xe92b('0xf'));var toCsv=require(_0xe92b('0x9'));var querystring=require('querystring');var Papa=require(_0xe92b('0x10'));var Redis=require(_0xe92b('0x11'));var authService=require(_0xe92b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe92b('0x13'));var logger=require('../../config/logger')(_0xe92b('0x14'));var utils=require(_0xe92b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe92b('0x16'));var db=require(_0xe92b('0x17'))['db'];function respondWithStatusCode(_0x31d5f4,_0x42b311){_0x42b311=_0x42b311||0xcc;return function(_0x5780f5){if(_0x5780f5){return _0x31d5f4[_0xe92b('0x18')](_0x42b311);}return _0x31d5f4[_0xe92b('0x19')](_0x42b311)['end']();};}function respondWithResult(_0x41c769,_0x4afeb1){_0x4afeb1=_0x4afeb1||0xc8;return function(_0x5f191e){if(_0x5f191e){return _0x41c769['status'](_0x4afeb1)[_0xe92b('0x1a')](_0x5f191e);}};}function respondWithFilteredResult(_0x17f6f6,_0x24d8b5){return function(_0x296ea6){if(_0x296ea6){var _0x424973=typeof _0x24d8b5['offset']==='undefined'&&typeof _0x24d8b5[_0xe92b('0x1b')]===_0xe92b('0x1c');var _0x19f84c=_0x296ea6[_0xe92b('0x1d')];var _0x58adba=_0x424973?0x0:_0x24d8b5[_0xe92b('0x1e')];var _0xe6d076=_0x424973?_0x296ea6[_0xe92b('0x1d')]:_0x24d8b5[_0xe92b('0x1e')]+_0x24d8b5[_0xe92b('0x1b')];var _0x133168;if(_0xe6d076>=_0x19f84c){_0xe6d076=_0x19f84c;_0x133168=0xc8;}else{_0x133168=0xce;}_0x17f6f6['status'](_0x133168);return _0x17f6f6[_0xe92b('0x1f')](_0xe92b('0x20'),_0x58adba+'-'+_0xe6d076+'/'+_0x19f84c)['json'](_0x296ea6);}return null;};}function patchUpdates(_0x5ecd53){return function(_0x250f8c){try{jsonpatch[_0xe92b('0x21')](_0x250f8c,_0x5ecd53,!![]);}catch(_0x280b7f){return BPromise[_0xe92b('0x22')](_0x280b7f);}return _0x250f8c['save']();};}function saveUpdates(_0x42d6f6,_0x395b01){return function(_0x477786){if(_0x477786){return _0x477786[_0xe92b('0x23')](_0x42d6f6)[_0xe92b('0x24')](function(_0x4ebd96){return _0x4ebd96;});}return null;};}function removeEntity(_0x518ae3,_0x26b6e9){return function(_0x291edc){if(_0x291edc){return _0x291edc[_0xe92b('0x25')]()[_0xe92b('0x24')](function(){var _0x176819=_0x291edc[_0xe92b('0x26')]({'plain':!![]});var _0x4aa530=_0xe92b('0x27');return db[_0xe92b('0x28')]['destroy']({'where':{'type':_0x4aa530,'resourceId':_0x176819['id']}})['then'](function(){return _0x291edc;});})[_0xe92b('0x24')](function(){_0x518ae3[_0xe92b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144ec5,_0x3ad8c1){return function(_0x7435f0){if(!_0x7435f0){_0x144ec5['sendStatus'](0x194);}return _0x7435f0;};}function handleError(_0x412bdc,_0x289cdd){_0x289cdd=_0x289cdd||0x1f4;return function(_0x296e12){logger[_0xe92b('0x29')](_0x296e12[_0xe92b('0x2a')]);if(_0x296e12[_0xe92b('0x2b')]){delete _0x296e12[_0xe92b('0x2b')];}_0x412bdc['status'](_0x289cdd)[_0xe92b('0x2c')](_0x296e12);};}exports['index']=function(_0x44175d,_0x4c23eb){var _0x28799a={},_0x5e1f2d={},_0x2633d1={'count':0x0,'rows':[]};return db[_0xe92b('0x2d')][_0xe92b('0x2e')]()[_0xe92b('0x24')](function(_0x45a8bf){_0x5e1f2d['model']=_['keys'](_0x45a8bf);_0x5e1f2d['query']=_['keys'](_0x44175d[_0xe92b('0x2f')]);_0x5e1f2d[_0xe92b('0x30')]=_['intersection'](_0x5e1f2d[_0xe92b('0x31')],_0x5e1f2d['query']);_0x28799a[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x5e1f2d[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x44175d[_0xe92b('0x2f')][_0xe92b('0x34')]));_0x28799a['attributes']=_0x28799a[_0xe92b('0x32')]['length']?_0x28799a[_0xe92b('0x32')]:_0x5e1f2d[_0xe92b('0x31')];if(!_0x44175d[_0xe92b('0x2f')][_0xe92b('0x35')](_0xe92b('0x36'))){_0x28799a[_0xe92b('0x1b')]=qs[_0xe92b('0x1b')](_0x44175d['query']['limit']);_0x28799a[_0xe92b('0x1e')]=qs['offset'](_0x44175d[_0xe92b('0x2f')]['offset']);}_0x28799a['order']=qs[_0xe92b('0x37')](_0x44175d['query']['sort']);_0x28799a['where']=qs[_0xe92b('0x30')](_[_0xe92b('0x38')](_0x44175d[_0xe92b('0x2f')],_0x5e1f2d[_0xe92b('0x30')]),_0x45a8bf);if(_0x44175d[_0xe92b('0x2f')][_0xe92b('0x39')]){_0x28799a[_0xe92b('0x3a')]=_[_0xe92b('0x3b')](_0x28799a['where'],{'$or':_['map'](_0x28799a[_0xe92b('0x32')],function(_0x2e7d4d){var _0x463552={};_0x463552[_0x2e7d4d]={'$like':'%'+_0x44175d[_0xe92b('0x2f')][_0xe92b('0x39')]+'%'};return _0x463552;})});}_0x28799a=_[_0xe92b('0x3b')]({},_0x28799a,_0x44175d['options']);var _0x35c35a={'where':_0x28799a[_0xe92b('0x3a')]};return db[_0xe92b('0x2d')][_0xe92b('0x1d')](_0x35c35a)[_0xe92b('0x24')](function(_0x4b7b98){_0x2633d1[_0xe92b('0x1d')]=_0x4b7b98;if(_0x44175d[_0xe92b('0x2f')][_0xe92b('0x3c')]){_0x28799a['include']=[{'all':!![]}];}return db[_0xe92b('0x2d')]['findAll'](_0x28799a);})[_0xe92b('0x24')](function(_0x30c89d){_0x2633d1[_0xe92b('0x3d')]=_0x30c89d;return _0x2633d1;})['then'](respondWithFilteredResult(_0x4c23eb,_0x28799a))[_0xe92b('0x3e')](handleError(_0x4c23eb,null));})['catch'](handleError(_0x4c23eb,null));};exports[_0xe92b('0x3f')]=function(_0x7bce32,_0x380ccb){var _0x5aa0c7={'raw':![],'where':{'id':_0x7bce32['params']['id']}},_0x4c3ac4={};_0x4c3ac4[_0xe92b('0x31')]=_['keys'](db[_0xe92b('0x2d')][_0xe92b('0x40')]);_0x4c3ac4[_0xe92b('0x2f')]=_[_0xe92b('0x41')](_0x7bce32['query']);_0x4c3ac4[_0xe92b('0x30')]=_[_0xe92b('0x33')](_0x4c3ac4[_0xe92b('0x31')],_0x4c3ac4['query']);_0x5aa0c7[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x4c3ac4[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x7bce32[_0xe92b('0x2f')][_0xe92b('0x34')]));_0x5aa0c7[_0xe92b('0x32')]=_0x5aa0c7[_0xe92b('0x32')][_0xe92b('0x42')]?_0x5aa0c7[_0xe92b('0x32')]:_0x4c3ac4['model'];if(_0x7bce32[_0xe92b('0x2f')][_0xe92b('0x3c')]){_0x5aa0c7[_0xe92b('0x43')]=[{'all':!![]}];}_0x5aa0c7=_[_0xe92b('0x3b')]({},_0x5aa0c7,_0x7bce32['options']);return db[_0xe92b('0x2d')][_0xe92b('0x44')](_0x5aa0c7)['then'](handleEntityNotFound(_0x380ccb,null))['then'](respondWithResult(_0x380ccb,null))[_0xe92b('0x3e')](handleError(_0x380ccb,null));};exports['create']=function(_0x8d38fb,_0x3f3760){return db[_0xe92b('0x2d')][_0xe92b('0x45')](_0x8d38fb['body'],{})[_0xe92b('0x24')](function(_0x210426){var _0x3c0c96=_0x8d38fb[_0xe92b('0x46')]['get']({'plain':!![]});if(!_0x3c0c96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c0c96[_0xe92b('0x47')]===_0xe92b('0x46')){var _0xd9cbf5=_0x210426[_0xe92b('0x26')]({'plain':!![]});var _0x164ad3=_0xe92b('0x27');return db[_0xe92b('0x48')][_0xe92b('0x44')]({'where':{'name':_0x164ad3,'userProfileId':_0x3c0c96[_0xe92b('0x49')]},'raw':!![]})[_0xe92b('0x24')](function(_0xbf1685){if(_0xbf1685&&_0xbf1685[_0xe92b('0x4a')]===0x0){return db[_0xe92b('0x28')]['create']({'name':_0xd9cbf5[_0xe92b('0x2b')],'resourceId':_0xd9cbf5['id'],'type':_0xbf1685[_0xe92b('0x2b')],'sectionId':_0xbf1685['id']},{})[_0xe92b('0x24')](function(){return _0x210426;});}else{return _0x210426;}})[_0xe92b('0x3e')](function(_0x13c5e1){logger[_0xe92b('0x29')](_0xe92b('0x4b'),_0x13c5e1);throw _0x13c5e1;});}return _0x210426;})[_0xe92b('0x24')](respondWithResult(_0x3f3760,0xc9))[_0xe92b('0x3e')](handleError(_0x3f3760,null));};exports[_0xe92b('0x23')]=function(_0x4212f3,_0x205bf5){if(_0x4212f3[_0xe92b('0x4c')]['id']){delete _0x4212f3[_0xe92b('0x4c')]['id'];}return db[_0xe92b('0x2d')][_0xe92b('0x44')]({'where':{'id':_0x4212f3[_0xe92b('0x4d')]['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x205bf5,null))[_0xe92b('0x24')](saveUpdates(_0x4212f3[_0xe92b('0x4c')],null))['then'](respondWithResult(_0x205bf5,null))[_0xe92b('0x3e')](handleError(_0x205bf5,null));};exports[_0xe92b('0x25')]=function(_0x288678,_0x14b593){return db[_0xe92b('0x2d')][_0xe92b('0x44')]({'where':{'id':_0x288678['params']['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x14b593,null))[_0xe92b('0x24')](removeEntity(_0x14b593,null))[_0xe92b('0x3e')](handleError(_0x14b593,null));};exports[_0xe92b('0x2e')]=function(_0x3eac60,_0x535f88){return db[_0xe92b('0x2d')]['describe']()[_0xe92b('0x24')](respondWithResult(_0x535f88,null))[_0xe92b('0x3e')](handleError(_0x535f88,null));};exports[_0xe92b('0x4e')]=function(_0x1bf1b2,_0x35c72b,_0x257d92){return db[_0xe92b('0x4f')]['find']({'where':{'id':_0x1bf1b2['params']['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x35c72b,null))[_0xe92b('0x24')](function(_0x109506){if(_0x109506){return _0x109506[_0xe92b('0x4e')](_0x1bf1b2[_0xe92b('0x4c')][_0xe92b('0x50')],_['omit'](_0x1bf1b2[_0xe92b('0x4c')],[_0xe92b('0x50'),'id'])||{});}})['then'](respondWithResult(_0x35c72b,null))['catch'](handleError(_0x35c72b,null));};exports[_0xe92b('0x51')]=function(_0x3884ae,_0x591ee2,_0x3f9c93){var _0x4c34ae={};var _0x10d909={};var _0x2ba4aa;var _0x3c069a;return db['CmCompany'][_0xe92b('0x52')]({'where':{'id':_0x3884ae[_0xe92b('0x4d')]['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x591ee2,null))['then'](function(_0x506009){if(_0x506009){_0x2ba4aa=_0x506009;_0x10d909[_0xe92b('0x31')]=_[_0xe92b('0x41')](db[_0xe92b('0x4f')][_0xe92b('0x40')]);_0x10d909[_0xe92b('0x2f')]=_[_0xe92b('0x41')](_0x3884ae[_0xe92b('0x2f')]);_0x10d909[_0xe92b('0x30')]=_[_0xe92b('0x33')](_0x10d909[_0xe92b('0x31')],_0x10d909[_0xe92b('0x2f')]);_0x4c34ae[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x10d909[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x3884ae['query']['fields']));_0x4c34ae['attributes']=_0x4c34ae[_0xe92b('0x32')]['length']?_0x4c34ae[_0xe92b('0x32')]:_0x10d909[_0xe92b('0x31')];_0x4c34ae[_0xe92b('0x53')]=qs['sort'](_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x37')]);_0x4c34ae[_0xe92b('0x3a')]=qs[_0xe92b('0x30')](_['pick'](_0x3884ae[_0xe92b('0x2f')],_0x10d909['filters']));if(_0x3884ae['query'][_0xe92b('0x39')]){_0x4c34ae[_0xe92b('0x3a')]=_[_0xe92b('0x3b')](_0x4c34ae['where'],{'$or':_[_0xe92b('0x54')](_0x4c34ae[_0xe92b('0x32')],function(_0x34627a){var _0x29b01b={};_0x29b01b[_0x34627a]={'$like':'%'+_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x39')]+'%'};return _0x29b01b;})});}_0x4c34ae=_['merge']({},_0x4c34ae,_0x3884ae[_0xe92b('0x55')]);return _0x2ba4aa[_0xe92b('0x51')](_0x4c34ae);}})[_0xe92b('0x24')](function(_0x147a86){if(_0x147a86){_0x3c069a=_0x147a86[_0xe92b('0x42')];if(!_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x35')]('nolimit')){_0x4c34ae[_0xe92b('0x1b')]=qs[_0xe92b('0x1b')](_0x3884ae['query'][_0xe92b('0x1b')]);_0x4c34ae[_0xe92b('0x1e')]=qs[_0xe92b('0x1e')](_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x1e')]);}return _0x2ba4aa[_0xe92b('0x51')](_0x4c34ae);}})[_0xe92b('0x24')](function(_0x12ee6c){if(_0x12ee6c){return _0x12ee6c?{'count':_0x3c069a,'rows':_0x12ee6c}:null;}})['then'](respondWithResult(_0x591ee2,null))['catch'](handleError(_0x591ee2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6f28871..e9c4454 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 _0x1f7b=['request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','bluebird'];(function(_0x4a8721,_0x143f8c){var _0x4ba00f=function(_0x2655d9){while(--_0x2655d9){_0x4a8721['push'](_0x4a8721['shift']());}};_0x4ba00f(++_0x143f8c);}(_0x1f7b,0x1d0));var _0xb1f7=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x1f7b[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0xb1f7('0x0'));var util=require(_0xb1f7('0x1'));var logger=require(_0xb1f7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb1f7('0x3'));var rp=require(_0xb1f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1f7('0x5'));var config=require(_0xb1f7('0x6'));var attributes=require('./cmCompany.attributes');module[_0xb1f7('0x7')]=function(_0x3e93c8,_0x409d67){return _0x3e93c8[_0xb1f7('0x8')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaba=['cm_companies','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x2f2763,_0x4d9637){var _0x442362=function(_0xaed4fa){while(--_0xaed4fa){_0x2f2763['push'](_0x2f2763['shift']());}};_0x442362(++_0x4d9637);}(_0xdaba,0x1c9));var _0xadab=function(_0x3729fc,_0x10a08e){_0x3729fc=_0x3729fc-0x0;var _0x1bab4f=_0xdaba[_0x3729fc];return _0x1bab4f;};'use strict';var _=require(_0xadab('0x0'));var util=require('util');var logger=require(_0xadab('0x1'))(_0xadab('0x2'));var moment=require('moment');var BPromise=require(_0xadab('0x3'));var rp=require(_0xadab('0x4'));var fs=require('fs');var path=require(_0xadab('0x5'));var rimraf=require(_0xadab('0x6'));var config=require('../../config/environment');var attributes=require(_0xadab('0x7'));module[_0xadab('0x8')]=function(_0x5913ef,_0x105895){return _0x5913ef[_0xadab('0x9')](_0xadab('0xa'),attributes,{'tableName':_0xadab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 70812a3..7037e72 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 _0x4b1c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4b1c,0xe9));var _0xc4b1=function(_0x18cc77,_0x41d313){_0x18cc77=_0x18cc77-0x0;var _0x34e801=_0x4b1c[_0x18cc77];return _0x34e801;};'use strict';var _=require(_0xc4b1('0x0'));var util=require(_0xc4b1('0x1'));var moment=require(_0xc4b1('0x2'));var BPromise=require(_0xc4b1('0x3'));var rs=require(_0xc4b1('0x4'));var fs=require('fs');var Redis=require(_0xc4b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4b1('0x6'));var logger=require(_0xc4b1('0x7'))(_0xc4b1('0x8'));var config=require(_0xc4b1('0x9'));var jayson=require(_0xc4b1('0xa'));var client=jayson[_0xc4b1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a48c,_0x479301,_0x7eb114){return new BPromise(function(_0x2a87c9,_0x32a012){return client['request'](_0x22a48c,_0x7eb114)[_0xc4b1('0xc')](function(_0x1c341e){logger['info'](_0xc4b1('0xd'),_0x479301,_0xc4b1('0xe'));logger[_0xc4b1('0xf')](_0xc4b1('0x10'),_0x479301,_0xc4b1('0xe'),JSON[_0xc4b1('0x11')](_0x1c341e));if(_0x1c341e[_0xc4b1('0x12')]){if(_0x1c341e[_0xc4b1('0x12')][_0xc4b1('0x13')]===0x1f4){logger[_0xc4b1('0x12')]('CmCompany,\x20%s,\x20%s',_0x479301,_0x1c341e['error']['message']);return _0x32a012(_0x1c341e[_0xc4b1('0x12')]['message']);}logger[_0xc4b1('0x12')](_0xc4b1('0xd'),_0x479301,_0x1c341e[_0xc4b1('0x12')][_0xc4b1('0x14')]);return _0x2a87c9(_0x1c341e['error'][_0xc4b1('0x14')]);}else{logger[_0xc4b1('0x15')](_0xc4b1('0xd'),_0x479301,_0xc4b1('0xe'));_0x2a87c9(_0x1c341e[_0xc4b1('0x16')][_0xc4b1('0x14')]);}})[_0xc4b1('0x17')](function(_0x186c3d){logger[_0xc4b1('0x12')](_0xc4b1('0xd'),_0x479301,_0x186c3d);_0x32a012(_0x186c3d);});});} \ No newline at end of file +var _0x3732=['result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x53b76e,_0x209fe3){var _0x311645=function(_0x314846){while(--_0x314846){_0x53b76e['push'](_0x53b76e['shift']());}};_0x311645(++_0x209fe3);}(_0x3732,0x19f));var _0x2373=function(_0xe2bf6f,_0x4a304f){_0xe2bf6f=_0xe2bf6f-0x0;var _0x1649ea=_0x3732[_0xe2bf6f];return _0x1649ea;};'use strict';var _=require(_0x2373('0x0'));var util=require(_0x2373('0x1'));var moment=require(_0x2373('0x2'));var BPromise=require('bluebird');var rs=require(_0x2373('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2373('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2373('0x5'))(_0x2373('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2373('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c6b6,_0x44e242,_0x6c17ea){return new BPromise(function(_0x5a1189,_0x53fe00){return client[_0x2373('0x8')](_0x14c6b6,_0x6c17ea)['then'](function(_0x512f9f){logger['info'](_0x2373('0x9'),_0x44e242,_0x2373('0xa'));logger[_0x2373('0xb')](_0x2373('0xc'),_0x44e242,_0x2373('0xa'),JSON[_0x2373('0xd')](_0x512f9f));if(_0x512f9f['error']){if(_0x512f9f[_0x2373('0xe')]['code']===0x1f4){logger['error'](_0x2373('0x9'),_0x44e242,_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);return _0x53fe00(_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);}logger['error'](_0x2373('0x9'),_0x44e242,_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);return _0x5a1189(_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);}else{logger[_0x2373('0x10')](_0x2373('0x9'),_0x44e242,_0x2373('0xa'));_0x5a1189(_0x512f9f[_0x2373('0x11')][_0x2373('0xf')]);}})['catch'](function(_0x4544ac){logger[_0x2373('0xe')](_0x2373('0x9'),_0x44e242,_0x4544ac);_0x53fe00(_0x4544ac);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 28131a5..cf281e3 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 _0x2787=['describe','/:id','show','getContacts','post','addContacts','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x2787,0x15e));var _0x7278=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2787[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x7278('0x0'));var util=require('util');var path=require(_0x7278('0x1'));var timeout=require('connect-timeout');var express=require(_0x7278('0x2'));var router=express[_0x7278('0x3')]();var fs_extra=require(_0x7278('0x4'));var auth=require(_0x7278('0x5'));var interaction=require(_0x7278('0x6'));var config=require(_0x7278('0x7'));var controller=require('./cmCompany.controller');router[_0x7278('0x8')]('/',auth[_0x7278('0x9')](),controller['index']);router[_0x7278('0x8')](_0x7278('0xa'),auth['isAuthenticated'](),controller[_0x7278('0xb')]);router[_0x7278('0x8')](_0x7278('0xc'),auth[_0x7278('0x9')](),controller[_0x7278('0xd')]);router[_0x7278('0x8')]('/:id/contacts',auth[_0x7278('0x9')](),controller[_0x7278('0xe')]);router[_0x7278('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7278('0xf')]('/:id/contacts',auth[_0x7278('0x9')](),controller[_0x7278('0x10')]);router['put'](_0x7278('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7278('0xc'),auth[_0x7278('0x9')](),controller[_0x7278('0x11')]);module[_0x7278('0x12')]=router; \ No newline at end of file +var _0x9ec7=['./cmCompany.controller','isAuthenticated','index','get','/describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x559178,_0x2734c0){var _0x455e7f=function(_0x14aa39){while(--_0x14aa39){_0x559178['push'](_0x559178['shift']());}};_0x455e7f(++_0x2734c0);}(_0x9ec7,0x161));var _0x79ec=function(_0x4027f3,_0x4aa861){_0x4027f3=_0x4027f3-0x0;var _0x589b13=_0x9ec7[_0x4027f3];return _0x589b13;};'use strict';var multer=require(_0x79ec('0x0'));var util=require('util');var path=require(_0x79ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x79ec('0x2'));var router=express['Router']();var fs_extra=require(_0x79ec('0x3'));var auth=require(_0x79ec('0x4'));var interaction=require(_0x79ec('0x5'));var config=require(_0x79ec('0x6'));var controller=require(_0x79ec('0x7'));router['get']('/',auth[_0x79ec('0x8')](),controller[_0x79ec('0x9')]);router[_0x79ec('0xa')](_0x79ec('0xb'),auth[_0x79ec('0x8')](),controller['describe']);router[_0x79ec('0xa')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0xd')]);router[_0x79ec('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x79ec('0xe')]);router[_0x79ec('0xf')]('/',auth['isAuthenticated'](),controller[_0x79ec('0x10')]);router[_0x79ec('0xf')](_0x79ec('0x11'),auth['isAuthenticated'](),controller[_0x79ec('0x12')]);router[_0x79ec('0x13')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0x14')]);router[_0x79ec('0x15')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0x16')]);module[_0x79ec('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 52ee9bd..f3c8003 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 _0x60c9=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x24a036,_0x47a5fd){var _0x1b614f=function(_0x2dbc3e){while(--_0x2dbc3e){_0x24a036['push'](_0x24a036['shift']());}};_0x1b614f(++_0x47a5fd);}(_0x60c9,0x190));var _0x960c=function(_0x27a8f2,_0x18da5d){_0x27a8f2=_0x27a8f2-0x0;var _0x2d98ab=_0x60c9[_0x27a8f2];return _0x2d98ab;};'use strict';var _=require(_0x960c('0x0'));var Sequelize=require(_0x960c('0x1'));module[_0x960c('0x2')]={'firstName':{'type':Sequelize[_0x960c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x960c('0x3')]},'street':{'type':Sequelize[_0x960c('0x3')]},'postalCode':{'type':Sequelize[_0x960c('0x3')]},'city':{'type':Sequelize[_0x960c('0x3')]},'country':{'type':Sequelize[_0x960c('0x3')]},'dateOfBirth':{'type':Sequelize[_0x960c('0x3')]},'description':{'type':Sequelize[_0x960c('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x960c('0x3')]},'fax':{'type':Sequelize[_0x960c('0x3')]},'email':{'type':Sequelize[_0x960c('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x960c('0x3')]},'fb_data':{'type':Sequelize[_0x960c('0x3')]},'twitter':{'type':Sequelize[_0x960c('0x3')]},'skype':{'type':Sequelize[_0x960c('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x960c('0x3')]},'line':{'type':Sequelize[_0x960c('0x3')]},'wechat':{'type':Sequelize[_0x960c('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x960c('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x960c('0x3')]},'priority':{'type':Sequelize[_0x960c('0x5')](0x2)[_0x960c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x960c('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x960c('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x90f3=['TEXT','UNSIGNED','DATE','NOW','INTEGER','lodash','sequelize','STRING'];(function(_0x35821c,_0x1c2c65){var _0x4ddf39=function(_0x47482d){while(--_0x47482d){_0x35821c['push'](_0x35821c['shift']());}};_0x4ddf39(++_0x1c2c65);}(_0x90f3,0x65));var _0x390f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x90f3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x390f('0x0'));var Sequelize=require(_0x390f('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x390f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x390f('0x2')]},'street':{'type':Sequelize[_0x390f('0x2')]},'postalCode':{'type':Sequelize[_0x390f('0x2')]},'city':{'type':Sequelize[_0x390f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x390f('0x2')]},'description':{'type':Sequelize[_0x390f('0x3')]},'phone':{'type':Sequelize[_0x390f('0x2')]},'mobile':{'type':Sequelize[_0x390f('0x2')]},'fax':{'type':Sequelize[_0x390f('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x390f('0x2')]},'facebook':{'type':Sequelize[_0x390f('0x2')]},'fb_data':{'type':Sequelize[_0x390f('0x2')]},'twitter':{'type':Sequelize[_0x390f('0x2')]},'skype':{'type':Sequelize[_0x390f('0x2')]},'teams':{'type':Sequelize[_0x390f('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x390f('0x2')]},'telegram':{'type':Sequelize[_0x390f('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x390f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x390f('0x5')],'defaultValue':Sequelize[_0x390f('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x390f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 57138ad..308e8d8 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 _0xb411=['callerid','starttime','userDisposition','userSecondDisposition','userThirdDisposition','UserId','range','createdAt','findAndCountAll','fullname','startCase','Website','Account','closed','note','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','substatus','externalUrl','threadId','flatten','sortBy','slice','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','json','limit','undefined','count','offset','set','Content-Range','then','end','sendStatus','error','stack','name','index','describe','keys','cf_','CmCustomField','trimStart','all','length','fieldType','type','model','query','filters','attributes','fields','hasOwnProperty','sort','where','pick','select','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','value','start','filter','isNil','Contact','push','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','split','getFullTextValue','isNumeric','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','order','DESC','having','t.id\x20IN\x20?','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','toString','keyBy','merge','CmContact','c.lastName','c.phone','c.mobile','c.fax','c.createdAt','c.CompanyId','TagIds','Tags','rows','catch','destroy','startsWith','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','tags','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','contact','show','params','Tag','CmContactHasItem','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','omit','format','pickBy','cf_%d','table','setFields','toParam','phone','findOne','rawAttributes','intersection','options','getTags','nolimit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','PHONE','CmHopperAdditionalPhone','item','ItemType','CmHopperId','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','includeAll','ContactId','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','status','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','socket_timestamp','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','Invalid\x20channel','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination'];(function(_0x37c47b,_0x8c23d9){var _0x31826a=function(_0x154871){while(--_0x154871){_0x37c47b['push'](_0x37c47b['shift']());}};_0x31826a(++_0x8c23d9);}(_0xb411,0x161));var _0x1b41=function(_0x4abda7,_0x613405){_0x4abda7=_0x4abda7-0x0;var _0x350751=_0xb411[_0x4abda7];return _0x350751;};'use strict';var moment=require(_0x1b41('0x0'));var BPromise=require(_0x1b41('0x1'));var util=require(_0x1b41('0x2'));var path=require(_0x1b41('0x3'));var fs=require('fs');var _=require(_0x1b41('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x1b41('0x5'));var qs=require('../../components/parsers/qs');var as=require(_0x1b41('0x6'));var logger=require(_0x1b41('0x7'))(_0x1b41('0x8'));var config=require(_0x1b41('0x9'));var shared=require(_0x1b41('0xa'));var db=require(_0x1b41('0xb'))['db'];config[_0x1b41('0xc')]=_[_0x1b41('0xd')](config['redis'],{'host':_0x1b41('0xe'),'port':0x18eb});var socket=require(_0x1b41('0xf'))(new Redis(config[_0x1b41('0xc')]));require(_0x1b41('0x10'))[_0x1b41('0x11')](socket);function respondWithResult(_0x404b01,_0x1216fc){_0x1216fc=_0x1216fc||0xc8;return function(_0x296aac){if(_0x296aac){return _0x404b01['status'](_0x1216fc)[_0x1b41('0x12')](_0x296aac);}};}function respondWithFilteredResult(_0x5c41e0,_0xf04fbc){return function(_0x44f15b){if(_0x44f15b){var _0x402a79=typeof _0xf04fbc['offset']==='undefined'&&typeof _0xf04fbc[_0x1b41('0x13')]===_0x1b41('0x14');var _0x57d8df=_0x44f15b[_0x1b41('0x15')];var _0x2d31dd=_0x402a79?0x0:_0xf04fbc[_0x1b41('0x16')];var _0xf1a6f1=_0x402a79?_0x44f15b[_0x1b41('0x15')]:_0xf04fbc['offset']+_0xf04fbc[_0x1b41('0x13')];var _0x504587;if(_0xf1a6f1>=_0x57d8df){_0xf1a6f1=_0x57d8df;_0x504587=0xc8;}else{_0x504587=0xce;}_0x5c41e0['status'](_0x504587);return _0x5c41e0[_0x1b41('0x17')](_0x1b41('0x18'),_0x2d31dd+'-'+_0xf1a6f1+'/'+_0x57d8df)[_0x1b41('0x12')](_0x44f15b);}return null;};}function saveUpdates(_0x28661e){return function(_0x27ae3d){if(_0x27ae3d){return _0x27ae3d['update'](_0x28661e)['then'](function(_0x105775){return _0x105775;});}return null;};}function removeEntity(_0x448c1c){return function(_0x36ad85){if(_0x36ad85){return _0x36ad85['destroy']()[_0x1b41('0x19')](function(){_0x448c1c['status'](0xcc)[_0x1b41('0x1a')]();});}};}function handleEntityNotFound(_0x52ccdb){return function(_0x454953){if(!_0x454953){_0x52ccdb[_0x1b41('0x1b')](0x194);}return _0x454953;};}function handleError(_0xb83393,_0x1deba9){_0x1deba9=_0x1deba9||0x1f4;return function(_0x19d6da){logger[_0x1b41('0x1c')](_0x19d6da[_0x1b41('0x1d')]);if(_0x19d6da[_0x1b41('0x1e')]){delete _0x19d6da[_0x1b41('0x1e')];}_0xb83393['status'](_0x1deba9)['send'](_0x19d6da);};}exports[_0x1b41('0x1f')]=function(_0x3d7665,_0x1c0351){var _0x5652c7={},_0xbcc95b={},_0x221ece={'count':0x0,'rows':[]};return db['CmContact'][_0x1b41('0x20')]()['then'](function(_0x4a3299){var _0x17d2f2=[];for(var _0x38c346=0x0;_0x38c3460x1){_0x50ad8e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1b41('0x5f')](_0x3285ad),null);}else{if(qs[_0x1b41('0x60')](_0x3285ad)){_0x50ad8e['or']('c.id\x20LIKE\x20?',_0x3285ad+'%');_0x50ad8e['or']('c.phone\x20LIKE\x20?',_0x3285ad+'%');_0x50ad8e['or']('c.mobile\x20LIKE\x20?',_0x3285ad+'%');_0x50ad8e['or'](_0x1b41('0x61'),_0x3285ad+'%');}else if(qs['isEmail'](_0x3285ad)){_0x50ad8e['or'](_0x1b41('0x62'),_0x3285ad+'%');}else{_0x50ad8e['or'](_0x1b41('0x63'),'%'+_0x3285ad+'%');_0x50ad8e['or'](_0x1b41('0x64'),'%'+_0x3285ad+'%');_0x50ad8e['or'](_0x1b41('0x62'),'%'+_0x3285ad+'%');}}}}_0x174ebe[_0x1b41('0x30')](_0x50ad8e);_0x174ebe[_0x1b41('0x65')]('c.id');var _0x142257={'type':db[_0x1b41('0x66')][_0x1b41('0x67')]['SELECT'],'raw':!![]};var _0x51965c=_0x174ebe[_0x1b41('0x68')]()[_0x1b41('0x33')](_0x1b41('0x69'));if(_0x5652c7[_0x1b41('0x6a')]){_0x5652c7[_0x1b41('0x6a')][_0x1b41('0x44')](function(_0x457f61){_0x174ebe[_0x1b41('0x6a')]('c.'+_0x457f61[0x0],_0x457f61[0x1]===_0x1b41('0x6b')?![]:!![]);});}if(!_['isEmpty'](_0x1bd210)){_0x174ebe[_0x1b41('0x6c')](_0x2a0dc8);_0x51965c[_0x1b41('0x30')](_0x1b41('0x6d'),_0x1bd210);}BPromise['resolve']()[_0x1b41('0x19')](function(){if(!_0x2daa93)return;if(_0x3d7665[_0x1b41('0x6e')][_0x1b41('0x6f')]!==_0x1b41('0x70'))return;if(!_[_0x1b41('0x71')](_0x2daa93['conditions'],[_0x1b41('0x33'),_0x1b41('0x47')])){return _0x3d7665['user'][_0x1b41('0x72')]({'attributes':['id'],'raw':!![]})[_0x1b41('0x19')](function(_0x549aeb){if(_[_0x1b41('0x56')](_0x549aeb)){_0x51965c['where'](_0x1b41('0x73'));_0x174ebe[_0x1b41('0x30')]('c.ListId\x20IS\x20NULL');}else{_0x51965c[_0x1b41('0x30')](_0x1b41('0x74'),_[_0x1b41('0x43')](_0x549aeb,'id'));_0x174ebe[_0x1b41('0x30')](_0x1b41('0x74'),_[_0x1b41('0x43')](_0x549aeb,'id'));}});}})[_0x1b41('0x19')](function(){if(_0x3d7665[_0x1b41('0x6e')]['role']==='agent'&&!_0x2daa93&&!_0x3d7665['query'][_0x1b41('0x57')])return[];return db['sequelize'][_0x1b41('0x2a')](_0x51965c[_0x1b41('0x75')](),_0x142257);})[_0x1b41('0x19')](function(_0x2cb900){_0x221ece[_0x1b41('0x15')]=_0x2cb900[_0x1b41('0x26')];if(_0x221ece[_0x1b41('0x15')]===0x0)return[];return db['sequelize']['query'](_0xf3e215[_0x1b41('0x75')](),_0x142257)[_0x1b41('0x19')](function(_0x14843c){_0x36c246=_[_0x1b41('0x76')](_0x14843c,'id');_0x142257=_[_0x1b41('0x77')](_0x142257,{'model':db[_0x1b41('0x78')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d7665['query'][_0x1b41('0x2d')]){_0x5652c7[_0x1b41('0x2c')][_0x1b41('0x44')](function(_0x221885){_0x174ebe[_0x1b41('0x33')]('c.'+_0x221885);});}else{_0x174ebe[_0x1b41('0x33')](_0x1b41('0x69'));_0x174ebe[_0x1b41('0x33')]('c.firstName');_0x174ebe[_0x1b41('0x33')](_0x1b41('0x79'));_0x174ebe['field'](_0x1b41('0x7a'));_0x174ebe[_0x1b41('0x33')](_0x1b41('0x7b'));_0x174ebe[_0x1b41('0x33')](_0x1b41('0x7c'));_0x174ebe['field']('c.email');_0x174ebe[_0x1b41('0x33')]('c.ListId');_0x174ebe[_0x1b41('0x33')](_0x1b41('0x7d'));_0x174ebe[_0x1b41('0x33')]('c.deletedAt');_0x174ebe[_0x1b41('0x33')](_0x1b41('0x7e'));_0x174ebe['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5652c7[_0x1b41('0x13')])_0x174ebe[_0x1b41('0x13')](_0x5652c7[_0x1b41('0x13')]);if(_0x5652c7['offset'])_0x174ebe[_0x1b41('0x16')](_0x5652c7[_0x1b41('0x16')]);return db['sequelize'][_0x1b41('0x2a')](_0x174ebe[_0x1b41('0x75')](),_0x142257);});})['then'](function(_0x5915ec){_0x5915ec['forEach'](function(_0x4f4d66){if(_0x4f4d66[_0x1b41('0x7f')]){_0x4f4d66[_0x1b41('0x80')]=[];_0x4f4d66[_0x1b41('0x7f')][_0x1b41('0x5e')](',')['forEach'](function(_0x53e536){_0x4f4d66[_0x1b41('0x80')][_0x1b41('0x55')](_0x36c246[_0x53e536]);});}delete _0x4f4d66[_0x1b41('0x7f')];});_0x221ece[_0x1b41('0x81')]=_0x5915ec;return _0x221ece;})[_0x1b41('0x19')](respondWithFilteredResult(_0x1c0351,_0x5652c7));})[_0x1b41('0x82')](handleError(_0x1c0351,null));};exports[_0x1b41('0x83')]=function(_0x3dd605,_0xb684bd){return db[_0x1b41('0x78')][_0x1b41('0x42')]({'where':{'id':_0x3dd605['params']['id']}})['then'](handleEntityNotFound(_0xb684bd,null))[_0x1b41('0x19')](removeEntity(_0xb684bd,null))[_0x1b41('0x82')](handleError(_0xb684bd,null));};exports[_0x1b41('0x20')]=function(_0x569bab,_0x306d03){return db[_0x1b41('0x78')][_0x1b41('0x20')]()[_0x1b41('0x19')](function(_0x5b20de){delete _0x5b20de['tags'];for(var _0x57b40a=0x0;_0x57b40a0x0){return new Promise(function(_0x45c028,_0x29bb9d){var _0x5b474f=[];for(var _0x2ab1ce=0x0;_0x2ab1ce<_0x3d42fa[_0x1b41('0x26')];_0x2ab1ce++){_0x5b474f[_0x1b41('0x55')](insertAdditionalPhones(_0x3d42fa[_0x2ab1ce][_0x1b41('0xb2')],_0x3d42fa[_0x2ab1ce][_0x1b41('0xad')]));}Promise[_0x1b41('0x25')](_0x5b474f)[_0x1b41('0x19')](function(){_0x45c028(0x1);});})[_0x1b41('0x19')](function(){return{'success':_0x56b321,'failure':_0xe984dd,'duplicates':_0x3687b1};});}else{return{'success':_0x56b321,'failure':_0xe984dd,'duplicates':_0x3687b1};}}})[_0x1b41('0x19')](respondWithResult(_0x2f50b1,0xc9))[_0x1b41('0x82')](handleError(_0x2f50b1,null));};exports[_0x1b41('0xb3')]=function(_0x3646a2,_0x5ba34a){var _0x455184;return db[_0x1b41('0x78')][_0x1b41('0x20')]()['then'](function(_0x518670){return db[_0x1b41('0x78')][_0x1b41('0x42')]({'where':{'id':_0x3646a2[_0x1b41('0xb4')]['id']},'include':[{'model':db[_0x1b41('0xb5')],'as':_0x1b41('0x80'),'attributes':['id','name',_0x1b41('0x34')],'required':_0x3646a2[_0x1b41('0x2a')][_0x1b41('0x5b')]?!![]:![]},{'model':db[_0x1b41('0xb6')],'as':_0x1b41('0xb7'),'where':{'CmContactId':_0x3646a2[_0x1b41('0xb4')]['id']},'required':![],'include':[{'model':db[_0x1b41('0xb8')],'as':'ItemType'}]}],'order':[db[_0x1b41('0xb9')][_0x1b41('0xba')](_0x1b41('0xbb'))],'attributes':_[_0x1b41('0x21')](_0x518670)});})[_0x1b41('0x19')](function(_0x44c102){if(!_[_0x1b41('0x53')](_0x44c102)){_0x455184=_0x44c102[_0x1b41('0x8d')]({'plain':!![]});var _0x3bb446={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x44c102&&_0x44c102[_0x1b41('0x57')]){if(_0x44c102[_0x1b41('0x57')]){_0x3bb446[_0x1b41('0x30')]['$and'][_0x1b41('0x55')]({'ListId':{'$ne':_0x44c102[_0x1b41('0x57')]}});}}return db['CmCustomField']['findAll'](_0x3bb446);}})[_0x1b41('0x19')](function(_0x2e71e0){if(!_[_0x1b41('0x53')](_0x2e71e0)){return _[_0x1b41('0xbc')](_0x455184,_[_0x1b41('0x43')](_0x2e71e0,function(_0x4039db){return util[_0x1b41('0xbd')]('cf_%d',_0x4039db['id']);}));}})['then'](handleEntityNotFound(_0x5ba34a,null))['then'](respondWithResult(_0x5ba34a,null))['catch'](handleError(_0x5ba34a,null));};exports[_0x1b41('0x95')]=function(_0x3ff108,_0x38e015){var _0x21ef15;if(_0x3ff108[_0x1b41('0x8c')]['id']){delete _0x3ff108[_0x1b41('0x8c')]['id'];}if(!_['isNil'](_0x3ff108[_0x1b41('0x8c')][_0x1b41('0xaa')])){var _0x1390bf=_0x3ff108[_0x1b41('0x8c')][_0x1b41('0xaa')];if(!_[_0x1b41('0x53')](shared[_0x1b41('0xab')][_0x1390bf]))_0x3ff108[_0x1b41('0x8c')][_0x1b41('0xac')]=shared[_0x1b41('0xab')][_0x1390bf]['utcOffset'];}return db[_0x1b41('0x78')]['find']({'where':{'id':_0x3ff108[_0x1b41('0xb4')]['id']}})[_0x1b41('0x19')](handleEntityNotFound(_0x38e015,null))[_0x1b41('0x19')](saveUpdates(_0x3ff108[_0x1b41('0x8c')],null))[_0x1b41('0x19')](function(_0x26c120){_0x21ef15=_0x26c120;var _0x35d2da={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x26c120&&_0x26c120['ListId']){if(_0x26c120[_0x1b41('0x57')]){_0x35d2da[_0x1b41('0x30')]['$and'][_0x1b41('0x55')]({'ListId':{'$ne':_0x26c120[_0x1b41('0x57')]}});}}return db[_0x1b41('0x23')]['findAll'](_0x35d2da);})[_0x1b41('0x19')](function(_0x176ea3){if(_0x176ea3){return _[_0x1b41('0xbc')](_[_0x1b41('0xbe')](_0x3ff108[_0x1b41('0x8c')],function(_0x2b3ec3,_0x56a489){return _[_0x1b41('0x84')](_0x56a489,'cf_');}),_[_0x1b41('0x43')](_0x176ea3,function(_0x1d701d){return util[_0x1b41('0xbd')](_0x1b41('0xbf'),_0x1d701d['id']);}));}})[_0x1b41('0x19')](function(_0x42b899){if(_0x42b899&&!_[_0x1b41('0x56')](_0x42b899)){var _0x5acd42=squel['update']()[_0x1b41('0xc0')](_0x1b41('0x37'))[_0x1b41('0xc1')](_0x42b899)['where']('id\x20=\x20?',_0x3ff108[_0x1b41('0xb4')]['id'])[_0x1b41('0xc2')]();return db[_0x1b41('0xb9')][_0x1b41('0x2a')](_0x5acd42[_0x1b41('0x4f')],{'replacements':_0x5acd42[_0x1b41('0x8b')]});}})[_0x1b41('0x19')](function(){if(_0x3ff108[_0x1b41('0x8c')][_0x1b41('0xc3')]&&_0x21ef15){return db[_0x1b41('0x92')]['update']({'phone':_0x3ff108['body'][_0x1b41('0xc3')],'OrderBy':0x0},{'where':{'ContactId':_0x21ef15['id']}});}})[_0x1b41('0x19')](function(){return _0x21ef15;})[_0x1b41('0x19')](respondWithResult(_0x38e015,null))[_0x1b41('0x82')](handleError(_0x38e015,null));};exports['getTags']=function(_0x45730,_0x4c9fad){var _0xd0829={};var _0x2b8ed7={};var _0x272c03;var _0x2c9348;return db[_0x1b41('0x78')][_0x1b41('0xc4')]({'where':{'id':_0x45730[_0x1b41('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4c9fad,null))[_0x1b41('0x19')](function(_0x46f6d2){if(_0x46f6d2){_0x272c03=_0x46f6d2;_0x2b8ed7[_0x1b41('0x29')]=_[_0x1b41('0x21')](db['Tag'][_0x1b41('0xc5')]);_0x2b8ed7[_0x1b41('0x2a')]=_[_0x1b41('0x21')](_0x45730[_0x1b41('0x2a')]);_0x2b8ed7[_0x1b41('0x2b')]=_[_0x1b41('0xc6')](_0x2b8ed7['model'],_0x2b8ed7['query']);_0xd0829[_0x1b41('0x2c')]=_[_0x1b41('0xc6')](_0x2b8ed7[_0x1b41('0x29')],qs[_0x1b41('0x2d')](_0x45730['query'][_0x1b41('0x2d')]));_0xd0829[_0x1b41('0x2c')]=_0xd0829[_0x1b41('0x2c')][_0x1b41('0x26')]?_0xd0829['attributes']:_0x2b8ed7[_0x1b41('0x29')];_0xd0829[_0x1b41('0x6a')]=qs[_0x1b41('0x2f')](_0x45730[_0x1b41('0x2a')][_0x1b41('0x2f')]);_0xd0829[_0x1b41('0x30')]=qs[_0x1b41('0x2b')](_[_0x1b41('0x31')](_0x45730['query'],_0x2b8ed7[_0x1b41('0x2b')]));if(_0x45730[_0x1b41('0x2a')]['filter']){_0xd0829[_0x1b41('0x30')]=_[_0x1b41('0x77')](_0xd0829[_0x1b41('0x30')],{'$or':_[_0x1b41('0x43')](_0xd0829[_0x1b41('0x2c')],function(_0x11b898){var _0x194396={};_0x194396[_0x11b898]={'$like':'%'+_0x45730['query']['filter']+'%'};return _0x194396;})});}_0xd0829=_[_0x1b41('0x77')]({},_0xd0829,_0x45730[_0x1b41('0xc7')]);return _0x272c03[_0x1b41('0xc8')](_0xd0829);}})[_0x1b41('0x19')](function(_0x252be2){if(_0x252be2){_0x2c9348=_0x252be2['length'];if(!_0x45730[_0x1b41('0x2a')][_0x1b41('0x2e')](_0x1b41('0xc9'))){_0xd0829[_0x1b41('0x13')]=qs[_0x1b41('0x13')](_0x45730[_0x1b41('0x2a')][_0x1b41('0x13')]);_0xd0829['offset']=qs[_0x1b41('0x16')](_0x45730[_0x1b41('0x2a')][_0x1b41('0x16')]);}return _0x272c03['getTags'](_0xd0829);}})[_0x1b41('0x19')](function(_0x16ac04){if(_0x16ac04){return _0x16ac04?{'count':_0x2c9348,'rows':_0x16ac04}:null;}})[_0x1b41('0x19')](respondWithResult(_0x4c9fad,null))['catch'](handleError(_0x4c9fad,null));};exports[_0x1b41('0xca')]=function(_0x1ba2b3,_0x72811){if(_0x1ba2b3[_0x1b41('0x8c')]['id']){delete _0x1ba2b3[_0x1b41('0x8c')]['id'];}return db[_0x1b41('0x78')]['findOne']({'where':{'id':_0x1ba2b3[_0x1b41('0xb4')]['id']}})[_0x1b41('0x19')](handleEntityNotFound(_0x72811,null))[_0x1b41('0x19')](function(_0x4c64ac){if(_0x4c64ac){return _0x4c64ac['setTags'](_0x1ba2b3['body'][_0x1b41('0xcb')]||[]);}return null;})['then'](respondWithResult(_0x72811,null))[_0x1b41('0x82')](handleError(_0x72811,null));};exports[_0x1b41('0xcc')]=function(_0x1ad6cd,_0xe3b119){var _0x3e165f=[];_0x3e165f[_0x1b41('0x55')](addAdditionalPhones(_0x1ad6cd['body']));Promise[_0x1b41('0x25')](_0x3e165f)[_0x1b41('0x19')](function(){_0x3e165f=[];_0x3e165f[_0x1b41('0x55')](deleteCmHopperPhones(_0x1ad6cd[_0x1b41('0x8c')]['id']));_0x3e165f[_0x1b41('0x55')](addCmHopperPhones(_0x1ad6cd[_0x1b41('0x8c')]['id']));Promise['all'](_0x3e165f)[_0x1b41('0x19')](function(){return[0x1];})[_0x1b41('0x19')](respondWithResult(_0xe3b119,null));});};function addAdditionalPhones(_0x1346f1){var _0x2df799;return new Promise(function(_0xf6c64e,_0x3218ce){return db[_0x1b41('0xb6')][_0x1b41('0x83')]({'where':{'CmContactId':_0x1346f1['id']}})['then'](function(){db[_0x1b41('0xb8')][_0x1b41('0x88')]({'raw':!![],'attributes':['id','OrderBy']})[_0x1b41('0x19')](function(_0x2a6760){var _0x1b35f3=[];for(var _0x4fb182=0x0;_0x4fb182<_0x1346f1[_0x1b41('0xcd')][_0x1b41('0x26')];_0x4fb182++){var _0x2d4d16=_0x1346f1[_0x1b41('0xce')]?_[_0x1b41('0x53')](_0x1346f1[_0x1b41('0xce')][_0x4fb182])?'':_0x1346f1[_0x1b41('0xce')][_0x4fb182]:_0x1346f1[_0x1b41('0xcd')][_0x4fb182][_0x1b41('0xcf')]?_0x1346f1[_0x1b41('0xcd')][_0x4fb182][_0x1b41('0xcf')]:'';var _0x15763e=_[_0x1b41('0x53')](_0x1346f1['items'][_0x4fb182][_0x1b41('0xd0')])?'':_0x1346f1[_0x1b41('0xcd')][_0x4fb182][_0x1b41('0xd0')];var _0x22e241=_0x2d4d16+':'+_0x1346f1[_0x1b41('0xcd')][_0x4fb182][_0x1b41('0xc3')]+'§'+_0x15763e;if(_[_0x1b41('0x53')](_0x2df799))_0x2df799=_0x22e241;else _0x2df799+=';'+_0x22e241;var _0x1733a7=null;if(_0x1346f1[_0x1b41('0xce')]){if(!_[_0x1b41('0x53')](_0x1346f1[_0x1b41('0xce')][_0x4fb182])){var _0x445f1b=_[_0x1b41('0x42')](_0x2a6760,function(_0x4b7077){return _0x4b7077['id']===_0x1346f1[_0x1b41('0xce')][_0x4fb182];});if(!_['isNil'](_0x445f1b)){_0x1733a7=_0x445f1b[_0x1b41('0xd1')];}}}else{if(!_[_0x1b41('0x53')](_0x1346f1[_0x1b41('0xcd')][_0x4fb182])){var _0x445f1b=_[_0x1b41('0x42')](_0x2a6760,function(_0x4ed69a){return _0x4ed69a['id']===_0x1346f1[_0x1b41('0xcd')][_0x4fb182]['ItemTypeId'];});if(!_[_0x1b41('0x53')](_0x445f1b)){_0x1733a7=_0x4fb182;}}}if(_[_0x1b41('0x53')](_0x1733a7)){_0x1733a7=0x64;}_0x1b35f3[_0x1b41('0x55')](addAdditionalPhone(_0x1346f1['id'],_0x1346f1['items'][_0x4fb182]['phone'],_0x1346f1[_0x1b41('0xce')]?_[_0x1b41('0x53')](_0x1346f1[_0x1b41('0xce')][_0x4fb182])?null:_0x1346f1[_0x1b41('0xce')][_0x4fb182]:_0x1346f1['items'][_0x4fb182][_0x1b41('0xcf')]?_0x1346f1[_0x1b41('0xcd')][_0x4fb182][_0x1b41('0xcf')]:null,_0x1733a7,_0x15763e));}Promise['all'](_0x1b35f3)[_0x1b41('0x19')](function(){db['CmContact']['update']({'AdditionalPhones':_0x2df799},{'where':{'id':_0x1346f1['id']}})[_0x1b41('0x19')](function(){_0xf6c64e(0x1);});});});});});}function addAdditionalPhone(_0x28cd35,_0xbca402,_0x411031,_0x1ca586,_0x4e3088){return db[_0x1b41('0xb6')][_0x1b41('0x42')]({'where':{'CmContactId':_0x28cd35,'item':_0xbca402}})['then'](function(_0x2927ff){if(_0x2927ff)logger[_0x1b41('0x91')]('contact\x20phone\x20exists',_0x2927ff);else{db[_0x1b41('0xb6')]['create']({'CmContactId':_0x28cd35,'item':_0xbca402,'ItemTypeId':_0x411031,'OrderBy':_0x1ca586,'ItemClass':_0x1b41('0xd2'),'description':_0x4e3088});}});}function deletePhones(_0x4afb60){return db[_0x1b41('0xb6')]['destroy']({'where':{'CmContactId':_0x4afb60}});}function deleteCmHopperPhones(_0x5d27a1){return new Promise(function(_0x44d19a,_0x5858b7){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5d27a1}})[_0x1b41('0x19')](function(_0x50f593){db[_0x1b41('0xd3')][_0x1b41('0x83')]({'where':{'CmHopperId':{'$in':_[_0x1b41('0x43')](_0x50f593,'id')}}});})[_0x1b41('0x19')](function(){_0x44d19a(0x1);});});}function addCmHopperPhones(_0x3b1f95){return new Promise(function(_0x11d82f,_0x3490a4){return db[_0x1b41('0x92')][_0x1b41('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3b1f95}})[_0x1b41('0x19')](function(_0xa163aa){var _0x3e2abd=[];_['map'](_0xa163aa,function(_0x135244){_0x3e2abd[_0x1b41('0x55')](createCmHopperPhone(_0x3b1f95,_0x135244['id']));});Promise[_0x1b41('0x25')](_0x3e2abd)['then'](function(){_0x11d82f(0x1);});});});}function createCmHopperPhone(_0x127f45,_0x1624c6){return new Promise(function(_0x20e64b,_0x582f8b){db[_0x1b41('0xb6')]['findAll']({'raw':!![],'attributes':[_0x1b41('0xd4'),'OrderBy'],'where':{'CmContactId':_0x127f45,'ItemClass':_0x1b41('0xd2')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x1b41('0xd5')}],'order':['OrderBy',db['sequelize']['literal']('`ItemType`.OrderBy')]})['then'](function(_0x4898cc){var _0x32ee78=0x1;var _0x1eec0c=_[_0x1b41('0x43')](_0x4898cc,function(_0x277916){_0x277916[_0x1b41('0xd6')]=_0x1624c6;_0x277916[_0x1b41('0xc3')]=_0x277916[_0x1b41('0xd4')];_0x277916[_0x1b41('0xd1')]=_0x32ee78;delete _0x277916['ItemType.OrderBy'];_0x32ee78=_0x32ee78+0x1;return _0x277916;});return db[_0x1b41('0xd3')][_0x1b41('0xae')](_0x1eec0c,{});})[_0x1b41('0x19')](function(){_0x20e64b(0x1);});});}function insertAdditionalPhones(_0x9bbd17,_0x1659a8){return new Promise(function(_0x162ac1,_0x5bf11e){var _0x2d1dd5=[];for(var _0x2e17a6=0x0;_0x2e17a6<_0x1659a8['length'];_0x2e17a6++){var _0x222b20=_0x1659a8[_0x2e17a6];_0x2d1dd5[_0x1b41('0x55')](parseContactItemType(_0x222b20));}Promise['all'](_0x2d1dd5)['then'](function(){var _0x3370f4={'id':_0x9bbd17['id'],'items':_0x1659a8};return addAdditionalPhones(_0x3370f4)[_0x1b41('0x19')](function(_0x4b7642){return addCmHopperPhones(_0x9bbd17['id']);});})[_0x1b41('0x19')](function(){_0x162ac1(_0x9bbd17);});});}function parseContactItemType(_0x5eac71){return new Promise(function(_0x29c739,_0x1b360a){if(_0x5eac71[_0x1b41('0x2e')](_0x1b41('0xcf'))){_0x29c739(_0x5eac71);}else{return db[_0x1b41('0xb8')][_0x1b41('0x42')]({'where':{'name':_0x5eac71[_0x1b41('0xd5')]}})[_0x1b41('0x19')](function(_0x5f25f6){if(_[_0x1b41('0x53')](_0x5f25f6))_0x5eac71[_0x1b41('0xcf')]=null;else _0x5eac71[_0x1b41('0xcf')]=_0x5f25f6['id'];_0x29c739(_0x5eac71);});}});}exports[_0x1b41('0xd7')]=function(_0x30e1e3,_0x155edc){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x30e1e3[_0x1b41('0xb4')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x1b41('0xb8')],'as':_0x1b41('0xd5')}],'order':[[_0x1b41('0xd1')],[db['sequelize'][_0x1b41('0xba')](_0x1b41('0xd8'))]]})[_0x1b41('0x19')](function(_0x475d4b){return _0x475d4b;})[_0x1b41('0x19')](respondWithResult(_0x155edc,null))['catch'](handleError(_0x155edc,null));};exports[_0x1b41('0xd9')]=function(_0x5d9a24,_0x2740e8){return db[_0x1b41('0xb6')][_0x1b41('0x88')]({'raw':!![],'where':{'CmContactId':_0x5d9a24[_0x1b41('0x8c')][_0x1b41('0xda')]}})[_0x1b41('0x19')](function(_0x27e051){var _0x53f2d4=_[_0x1b41('0x43')](_0x27e051,function(_0x5d8911){_0x5d8911[_0x1b41('0xdb')]=_0x5d9a24[_0x1b41('0x8c')][_0x1b41('0xdc')];return _0x5d8911;});return db[_0x1b41('0xb6')][_0x1b41('0xae')](_0x53f2d4,{});})['then'](function(_0xc737e3){return addCmHopperPhones(_0x5d9a24[_0x1b41('0x8c')]['toContactId']);})[_0x1b41('0x19')](function(_0x476c51){return['ok'];})[_0x1b41('0x19')](respondWithResult(_0x2740e8,null))[_0x1b41('0x82')](handleError(_0x2740e8,null));};exports[_0x1b41('0xdd')]=function(_0x40984c,_0x2ccfbd){var _0x53529c=[];_0x53529c[_0x1b41('0x55')](createCmHopperPhone(_0x40984c[_0x1b41('0x8c')]['id'],_0x40984c[_0x1b41('0x8c')]['hopperId']));Promise[_0x1b41('0x25')](_0x53529c)['then'](function(){return[0x1];})[_0x1b41('0x19')](respondWithResult(_0x2ccfbd,null));};exports[_0x1b41('0xde')]=function(_0x11305a,_0xc614bc){var _0x54c32d={'raw':![],'where':{}};var _0x1dabc4={};var _0x2db601={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x11305a[_0x1b41('0xb4')]['id']}})['then'](handleEntityNotFound(_0xc614bc,null))['then'](function(_0x3a0f45){if(_0x3a0f45){_0x1dabc4[_0x1b41('0x29')]=_[_0x1b41('0x21')](db[_0x1b41('0x92')]['rawAttributes']);_0x1dabc4[_0x1b41('0x2a')]=_['keys'](_0x11305a[_0x1b41('0x2a')]);_0x1dabc4[_0x1b41('0x2b')]=_[_0x1b41('0xc6')](_0x1dabc4['model'],_0x1dabc4[_0x1b41('0x2a')]);_0x54c32d[_0x1b41('0x2c')]=_[_0x1b41('0xc6')](_0x1dabc4[_0x1b41('0x29')],qs[_0x1b41('0x2d')](_0x11305a[_0x1b41('0x2a')][_0x1b41('0x2d')]));_0x54c32d[_0x1b41('0x2c')]=_0x54c32d[_0x1b41('0x2c')][_0x1b41('0x26')]?_0x54c32d['attributes']:_0x1dabc4[_0x1b41('0x29')];if(!_0x11305a[_0x1b41('0x2a')][_0x1b41('0x2e')](_0x1b41('0xc9'))){_0x54c32d[_0x1b41('0x13')]=qs[_0x1b41('0x13')](_0x11305a['query'][_0x1b41('0x13')]);_0x54c32d['offset']=qs['offset'](_0x11305a['query'][_0x1b41('0x16')]);}_0x54c32d[_0x1b41('0x6a')]=qs[_0x1b41('0x2f')](_0x11305a['query'][_0x1b41('0x2f')]);_0x54c32d[_0x1b41('0x30')]=qs['filters'](_[_0x1b41('0x31')](_0x11305a[_0x1b41('0x2a')],_0x1dabc4[_0x1b41('0x2b')]));_0x54c32d['where']['ContactId']=_0x3a0f45['id'];if(_0x11305a[_0x1b41('0x2a')][_0x1b41('0x52')]){_0x54c32d['where']=_['merge'](_0x54c32d[_0x1b41('0x30')],{'$or':_[_0x1b41('0x43')](_0x54c32d[_0x1b41('0x2c')],function(_0x43f65a){var _0x1adbbf={};_0x1adbbf[_0x43f65a]={'$like':'%'+_0x11305a[_0x1b41('0x2a')][_0x1b41('0x52')]+'%'};return _0x1adbbf;})});}_0x54c32d=_[_0x1b41('0x77')]({},_0x54c32d,_0x11305a['options']);return db[_0x1b41('0x92')][_0x1b41('0x15')]({'where':_0x54c32d['where']})[_0x1b41('0x19')](function(_0xf68b17){_0x2db601[_0x1b41('0x15')]=_0xf68b17;if(_0x11305a[_0x1b41('0x2a')][_0x1b41('0xdf')]){_0x54c32d['include']=[{'all':!![]}];}return db[_0x1b41('0x92')][_0x1b41('0x88')](_0x54c32d);})[_0x1b41('0x19')](function(_0x5aaf25){_0x2db601[_0x1b41('0x81')]=_0x5aaf25;return _0x2db601;});}})[_0x1b41('0x19')](respondWithFilteredResult(_0xc614bc,_0x54c32d))[_0x1b41('0x82')](handleError(_0xc614bc,null));};exports['getHopperHistories']=function(_0x281bb5,_0x4f6295){var _0x4f6289={'raw':!![],'where':{}};var _0x4e7bf7={};var _0x4201cd={'count':0x0,'rows':[]};return db['CmContact'][_0x1b41('0xc4')]({'where':{'id':_0x281bb5['params']['id']}})[_0x1b41('0x19')](handleEntityNotFound(_0x4f6295,null))[_0x1b41('0x19')](function(_0x46792c){if(_0x46792c){_0x4e7bf7[_0x1b41('0x29')]=_[_0x1b41('0x21')](db[_0x1b41('0xa1')][_0x1b41('0xc5')]);_0x4e7bf7[_0x1b41('0x2a')]=_[_0x1b41('0x21')](_0x281bb5['query']);_0x4e7bf7[_0x1b41('0x2b')]=_[_0x1b41('0xc6')](_0x4e7bf7[_0x1b41('0x29')],_0x4e7bf7['query']);_0x4f6289[_0x1b41('0x2c')]=_[_0x1b41('0xc6')](_0x4e7bf7['model'],qs[_0x1b41('0x2d')](_0x281bb5[_0x1b41('0x2a')][_0x1b41('0x2d')]));_0x4f6289[_0x1b41('0x2c')]=_0x4f6289[_0x1b41('0x2c')][_0x1b41('0x26')]?_0x4f6289['attributes']:_0x4e7bf7[_0x1b41('0x29')];if(!_0x281bb5[_0x1b41('0x2a')]['hasOwnProperty'](_0x1b41('0xc9'))){_0x4f6289['limit']=qs[_0x1b41('0x13')](_0x281bb5[_0x1b41('0x2a')][_0x1b41('0x13')]);_0x4f6289[_0x1b41('0x16')]=qs[_0x1b41('0x16')](_0x281bb5['query']['offset']);}_0x4f6289[_0x1b41('0x6a')]=qs[_0x1b41('0x2f')](_0x281bb5[_0x1b41('0x2a')][_0x1b41('0x2f')]);_0x4f6289[_0x1b41('0x30')]=qs['filters'](_[_0x1b41('0x31')](_0x281bb5[_0x1b41('0x2a')],_0x4e7bf7['filters']));_0x4f6289[_0x1b41('0x30')][_0x1b41('0xe0')]=_0x46792c['id'];if(_0x281bb5[_0x1b41('0x2a')][_0x1b41('0x52')]){_0x4f6289[_0x1b41('0x30')]=_[_0x1b41('0x77')](_0x4f6289[_0x1b41('0x30')],{'$or':_[_0x1b41('0x43')](_0x4f6289[_0x1b41('0x2c')],function(_0x14459b){var _0x269011={};_0x269011[_0x14459b]={'$like':'%'+_0x281bb5[_0x1b41('0x2a')][_0x1b41('0x52')]+'%'};return _0x269011;})});}_0x4f6289=_['merge']({},_0x4f6289,_0x281bb5[_0x1b41('0xc7')]);return db[_0x1b41('0xa1')]['count']({'where':_0x4f6289[_0x1b41('0x30')]})[_0x1b41('0x19')](function(_0x18f33e){_0x4201cd[_0x1b41('0x15')]=_0x18f33e;if(_0x281bb5[_0x1b41('0x2a')][_0x1b41('0xdf')]){_0x4f6289['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x1b41('0x88')](_0x4f6289);})['then'](function(_0x4e2e29){_0x4201cd['rows']=_0x4e2e29;return _0x4201cd;});}})[_0x1b41('0x19')](respondWithFilteredResult(_0x4f6295,_0x4f6289))['catch'](handleError(_0x4f6295,null));};exports['getHopperFinals']=function(_0x31e25f,_0x316b48){var _0x2275ab={'raw':!![],'where':{}};var _0x20b0a6={};var _0x5b5a7a={'count':0x0,'rows':[]};return db[_0x1b41('0x78')]['findOne']({'where':{'id':_0x31e25f[_0x1b41('0xb4')]['id']}})[_0x1b41('0x19')](handleEntityNotFound(_0x316b48,null))['then'](function(_0x30d114){if(_0x30d114){_0x20b0a6['model']=_[_0x1b41('0x21')](db['CmHopperFinal'][_0x1b41('0xc5')]);_0x20b0a6[_0x1b41('0x2a')]=_[_0x1b41('0x21')](_0x31e25f['query']);_0x20b0a6['filters']=_[_0x1b41('0xc6')](_0x20b0a6['model'],_0x20b0a6[_0x1b41('0x2a')]);_0x2275ab['attributes']=_[_0x1b41('0xc6')](_0x20b0a6[_0x1b41('0x29')],qs[_0x1b41('0x2d')](_0x31e25f[_0x1b41('0x2a')][_0x1b41('0x2d')]));_0x2275ab[_0x1b41('0x2c')]=_0x2275ab[_0x1b41('0x2c')]['length']?_0x2275ab[_0x1b41('0x2c')]:_0x20b0a6['model'];if(!_0x31e25f[_0x1b41('0x2a')]['hasOwnProperty'](_0x1b41('0xc9'))){_0x2275ab[_0x1b41('0x13')]=qs[_0x1b41('0x13')](_0x31e25f[_0x1b41('0x2a')][_0x1b41('0x13')]);_0x2275ab[_0x1b41('0x16')]=qs[_0x1b41('0x16')](_0x31e25f[_0x1b41('0x2a')]['offset']);}_0x2275ab[_0x1b41('0x6a')]=qs[_0x1b41('0x2f')](_0x31e25f[_0x1b41('0x2a')][_0x1b41('0x2f')]);_0x2275ab[_0x1b41('0x30')]=qs[_0x1b41('0x2b')](_['pick'](_0x31e25f[_0x1b41('0x2a')],_0x20b0a6[_0x1b41('0x2b')]));_0x2275ab[_0x1b41('0x30')][_0x1b41('0xe0')]=_0x30d114['id'];if(_0x31e25f[_0x1b41('0x2a')][_0x1b41('0x52')]){_0x2275ab[_0x1b41('0x30')]=_[_0x1b41('0x77')](_0x2275ab['where'],{'$or':_[_0x1b41('0x43')](_0x2275ab['attributes'],function(_0x22a151){var _0x41eb57={};_0x41eb57[_0x22a151]={'$like':'%'+_0x31e25f[_0x1b41('0x2a')][_0x1b41('0x52')]+'%'};return _0x41eb57;})});}_0x2275ab=_['merge']({},_0x2275ab,_0x31e25f[_0x1b41('0xc7')]);return db['CmHopperFinal']['count']({'where':_0x2275ab[_0x1b41('0x30')]})['then'](function(_0x39cede){_0x5b5a7a[_0x1b41('0x15')]=_0x39cede;if(_0x31e25f[_0x1b41('0x2a')][_0x1b41('0xdf')]){_0x2275ab[_0x1b41('0xe1')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1b41('0x88')](_0x2275ab);})[_0x1b41('0x19')](function(_0x443f8c){_0x5b5a7a['rows']=_0x443f8c;return _0x5b5a7a;});}})[_0x1b41('0x19')](respondWithFilteredResult(_0x316b48,_0x2275ab))[_0x1b41('0x82')](handleError(_0x316b48,null));};exports[_0x1b41('0xe2')]=function(_0x2f5c62,_0x3b4eff){var _0x3ea5b6={'raw':!![],'where':{}};var _0x420d74={};var _0x1b3bc1={'count':0x0,'rows':[]};return db[_0x1b41('0x78')]['findOne']({'where':{'id':_0x2f5c62[_0x1b41('0xb4')]['id']}})[_0x1b41('0x19')](handleEntityNotFound(_0x3b4eff,null))[_0x1b41('0x19')](function(_0x485422){if(_0x485422){_0x420d74['model']=_['keys'](db[_0x1b41('0xa7')][_0x1b41('0xc5')]);_0x420d74[_0x1b41('0x2a')]=_['keys'](_0x2f5c62[_0x1b41('0x2a')]);_0x420d74['filters']=_[_0x1b41('0xc6')](_0x420d74['model'],_0x420d74[_0x1b41('0x2a')]);_0x3ea5b6['attributes']=_['intersection'](_0x420d74['model'],qs[_0x1b41('0x2d')](_0x2f5c62['query'][_0x1b41('0x2d')]));_0x3ea5b6[_0x1b41('0x2c')]=_0x3ea5b6[_0x1b41('0x2c')][_0x1b41('0x26')]?_0x3ea5b6[_0x1b41('0x2c')]:_0x420d74[_0x1b41('0x29')];if(!_0x2f5c62[_0x1b41('0x2a')]['hasOwnProperty'](_0x1b41('0xc9'))){_0x3ea5b6[_0x1b41('0x13')]=qs[_0x1b41('0x13')](_0x2f5c62[_0x1b41('0x2a')][_0x1b41('0x13')]);_0x3ea5b6[_0x1b41('0x16')]=qs[_0x1b41('0x16')](_0x2f5c62[_0x1b41('0x2a')][_0x1b41('0x16')]);}_0x3ea5b6[_0x1b41('0x6a')]=qs[_0x1b41('0x2f')](_0x2f5c62['query'][_0x1b41('0x2f')]);_0x3ea5b6['where']=qs['filters'](_[_0x1b41('0x31')](_0x2f5c62[_0x1b41('0x2a')],_0x420d74[_0x1b41('0x2b')]));_0x3ea5b6[_0x1b41('0x30')][_0x1b41('0xe0')]=_0x485422['id'];if(_0x2f5c62['query']['filter']){_0x3ea5b6[_0x1b41('0x30')]=_[_0x1b41('0x77')](_0x3ea5b6[_0x1b41('0x30')],{'$or':_[_0x1b41('0x43')](_0x3ea5b6['attributes'],function(_0x234bb8){var _0x5be05e={};_0x5be05e[_0x234bb8]={'$like':'%'+_0x2f5c62['query'][_0x1b41('0x52')]+'%'};return _0x5be05e;})});}_0x3ea5b6=_['merge']({},_0x3ea5b6,_0x2f5c62[_0x1b41('0xc7')]);return db[_0x1b41('0xa7')]['count']({'where':_0x3ea5b6[_0x1b41('0x30')]})['then'](function(_0x50e210){_0x1b3bc1['count']=_0x50e210;if(_0x2f5c62[_0x1b41('0x2a')][_0x1b41('0xdf')]){_0x3ea5b6[_0x1b41('0xe1')]=[{'all':!![]}];}return db[_0x1b41('0xa7')]['findAll'](_0x3ea5b6);})[_0x1b41('0x19')](function(_0x32ce71){_0x1b3bc1[_0x1b41('0x81')]=_0x32ce71;return _0x1b3bc1;});}})[_0x1b41('0x19')](respondWithFilteredResult(_0x3b4eff,_0x3ea5b6))['catch'](handleError(_0x3b4eff,null));};exports[_0x1b41('0xe3')]=function(_0x2d44d0,_0x3f7a54){try{if(!_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0x57')]){throw new Error(_0x1b41('0xe4'));}if(!_0x2d44d0[_0x1b41('0x8c')]['binding_keys']){throw new Error(_0x1b41('0xe5'));}if(!_0x2d44d0['body']['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2d44d0['body']['socket_timestamp']){throw new Error(_0x1b41('0xe6'));}var _0x587dca=_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0xe7')]['split'](',');var _0x45f764=_0x2d44d0['body']['binding_values'][_0x1b41('0x5e')](',');if(!_0x587dca[_0x1b41('0x26')]||!_0x45f764[_0x1b41('0x26')]||_0x587dca['length']!==_0x45f764[_0x1b41('0x26')]){throw new Error(_0x1b41('0xe8'));}_0x2d44d0['body']['fields']=_[_0x1b41('0xe9')](_0x587dca,_0x45f764);if(!_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0x2d')][_0x1b41('0xc3')]){throw new Error(_0x1b41('0xea'));}if(!_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0x2d')][_0x1b41('0xeb')]){throw new Error(_0x1b41('0xec'));}var _0x4a8a4d=path['join'](config[_0x1b41('0xed')],_0x1b41('0xee'),_0x2d44d0[_0x1b41('0xef')][_0x1b41('0xf0')]);fs[_0x1b41('0xf1')](_0x4a8a4d,parseInt('0777',0x8));var _0x55dd7b=require(_0x1b41('0xf2'))[_0x1b41('0xf3')](path[_0x1b41('0x90')](__dirname,_0x1b41('0xf4')),[_0x4a8a4d,_0x2d44d0['body'][_0x1b41('0xe7')],_0x2d44d0[_0x1b41('0x8c')]['binding_values'],_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0x57')],_0x2d44d0[_0x1b41('0x8c')][_0x1b41('0xf5')],_0x2d44d0['body']['duplicates'],_0x2d44d0[_0x1b41('0x8c')]['socket_timestamp']]);return _0x3f7a54[_0x1b41('0xf6')](0xc8)[_0x1b41('0x12')]({'message':_0x1b41('0xf7'),'pid':_0x55dd7b[_0x1b41('0xf8')]});}catch(_0x2504a5){return _0x3f7a54['status'](0x1f4)[_0x1b41('0xf9')](_0x2504a5);}};exports[_0x1b41('0xfa')]=function(_0x4545a8,_0x10b8b7){var _0x37176b=fs[_0x1b41('0xfb')](_0x4545a8[_0x1b41('0xef')][_0x1b41('0x3')]);Papa['parse'](_0x37176b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2e49c6){return _0x10b8b7[_0x1b41('0xf6')](0xc8)[_0x1b41('0x12')]({'file':_0x4545a8['file'],'fields':_0x2e49c6[_0x1b41('0xfc')][_0x1b41('0x2d')]});}});};exports[_0x1b41('0xfd')]=function(_0x2f8f80,_0x455602){return db['User'][_0x1b41('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x1b41('0x19')](function(_0x4bcbba){var _0x455e2b=![];if(!_0x2f8f80['body'][_0x1b41('0x57')]){throw new Error(_0x1b41('0xe4'));}if(!_0x2f8f80[_0x1b41('0x8c')][_0x1b41('0xfe')]['phone']){throw new Error(_0x1b41('0xea'));}if(!_0x2f8f80[_0x1b41('0x8c')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x2f8f80[_0x1b41('0x8c')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5dd873=require('child_process')[_0x1b41('0xf3')](path[_0x1b41('0x90')](__dirname,_0x1b41('0xff')),[_0x2f8f80[_0x1b41('0xb4')]['id'],JSON[_0x1b41('0x100')](_0x2f8f80[_0x1b41('0x8c')]),JSON['stringify'](_0x4bcbba)]);_0x5dd873['on'](_0x1b41('0x101'),function(){_0x455e2b=!![];return _0x455602[_0x1b41('0xf6')](0xc8)[_0x1b41('0x12')]({'message':_0x1b41('0x102'),'pid':_0x5dd873[_0x1b41('0xf8')]});});_0x5dd873['on'](_0x1b41('0x103'),function(_0x44d40b){if(_0x44d40b&&!_0x455e2b){return _0x455602[_0x1b41('0xf6')](0x1f4)[_0x1b41('0x12')]({'message':_0x1b41('0x104'),'pid':_0x5dd873['pid']});}});})[_0x1b41('0x82')](handleError(_0x455602,null));};exports[_0x1b41('0x105')]=function(_0x57de38,_0x41bc07,_0x5f5126){return db[_0x1b41('0x47')][_0x1b41('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1b41('0x70')}})['then'](function(_0x2c439e){var _0x4c096a=![];if(!_0x57de38[_0x1b41('0x8c')][_0x1b41('0x57')]){throw new Error('No\x20ListId\x20specified');}if(!_0x57de38[_0x1b41('0x8c')][_0x1b41('0xfe')]['phone']){throw new Error(_0x1b41('0xea'));}if(!_0x57de38[_0x1b41('0x8c')][_0x1b41('0xfe')][_0x1b41('0xeb')]){throw new Error(_0x1b41('0xec'));}if(!_0x57de38[_0x1b41('0x8c')][_0x1b41('0x106')]){throw new Error(_0x1b41('0xe6'));}var _0x29c4b8=require(_0x1b41('0xf2'))[_0x1b41('0xf3')](path[_0x1b41('0x90')](__dirname,_0x1b41('0x107')),[_0x57de38[_0x1b41('0xb4')]['id'],JSON[_0x1b41('0x100')](_0x57de38[_0x1b41('0x8c')]),JSON['stringify'](_0x2c439e)]);_0x29c4b8['on'](_0x1b41('0x101'),function(_0x5dd27a){_0x4c096a=!![];return _0x41bc07[_0x1b41('0xf6')](0xc8)[_0x1b41('0x12')]({'message':_0x1b41('0x102'),'pid':_0x29c4b8['pid']});});_0x29c4b8['on'](_0x1b41('0x103'),function(_0x2984c3){if(_0x2984c3&&!_0x4c096a){return _0x41bc07[_0x1b41('0xf6')](0x1f4)[_0x1b41('0x12')]({'message':_0x1b41('0x104'),'pid':_0x29c4b8[_0x1b41('0xf8')]});}});})[_0x1b41('0x82')](handleError(_0x41bc07,null));};exports[_0x1b41('0x108')]=function(_0x10385d,_0x493cb6){var _0x2bdd49=['mail',_0x1b41('0x109'),_0x1b41('0x10a'),_0x1b41('0x10b'),_0x1b41('0x10c'),_0x1b41('0x10d'),_0x1b41('0x10e')];var _0x4ffee6={'offset':0x0,'order':qs['sort'](_0x1b41('0x10f'))},_0x3cb5c1={'count':0x0,'rows':[]};Promise[_0x1b41('0x110')]()[_0x1b41('0x19')](function(){if(_0x10385d[_0x1b41('0x2a')]['channel']){if(!_['includes'](_0x2bdd49,_0x10385d['query'][_0x1b41('0x111')]['toLowerCase']())){throw new Error(_0x1b41('0x112'));}_0x2bdd49=[_0x10385d['query'][_0x1b41('0x111')]['toLowerCase']()];}if(_0x10385d[_0x1b41('0x2a')]['range']){try{var _0x597929=JSON['parse'](_0x10385d[_0x1b41('0x2a')]['range']);if(!moment(_0x597929[_0x1b41('0x36')])['isValid']()){throw new Error(_0x1b41('0x113'));}if(!moment(_0x597929['to'])[_0x1b41('0x114')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x2e8a85){throw new Error(_0x1b41('0x115'));}}if(!_0x10385d[_0x1b41('0x2a')][_0x1b41('0x2e')]('nolimit')){_0x4ffee6[_0x1b41('0x13')]=qs['limit'](_0x10385d[_0x1b41('0x2a')][_0x1b41('0x13')]||0xa);_0x4ffee6[_0x1b41('0x16')]=qs['offset'](_0x10385d[_0x1b41('0x2a')][_0x1b41('0x16')]);}var _0x3ed65c=_0x2bdd49[_0x1b41('0x43')](function(_0x213fcc){if(_0x213fcc==='voice'){var _0x4d9417={'attributes':['id',_0x1b41('0x116'),_0x1b41('0x28'),_0x1b41('0x117'),_0x1b41('0x118'),_0x1b41('0x119'),_0x1b41('0x11a'),'endtime','duration','note','createdAt',_0x1b41('0x11b'),_0x1b41('0x11c'),_0x1b41('0x11d'),_0x1b41('0x11e')],'where':{'ContactId':_0x10385d[_0x1b41('0xb4')]['id']},'include':[{'model':db[_0x1b41('0x47')],'as':'User','attributes':['id',_0x1b41('0x1e'),'fullname',_0x1b41('0x89')]}],'order':[['createdAt',_0x1b41('0x6b')]]};if(_0x10385d['query'][_0x1b41('0x11f')]){_0x4d9417[_0x1b41('0x30')][_0x1b41('0x120')]={'$gte':_0x597929[_0x1b41('0x36')],'$lte':_0x597929['to']};}return db['VoiceCallReport'][_0x1b41('0x121')](_0x4d9417)[_0x1b41('0x19')](function(_0x1821ef){_0x3cb5c1[_0x1b41('0x15')]+=_0x1821ef[_0x1b41('0x15')];return _[_0x1b41('0x43')](_0x1821ef[_0x1b41('0x81')],function(_0x4ed540){var _0x5b0eec=_0x4ed540['get']({'plain':!![]});_0x5b0eec['channel']=_0x213fcc;if(_0x5b0eec[_0x1b41('0x47')]){_0x5b0eec[_0x1b41('0x47')]={'id':_0x5b0eec[_0x1b41('0x47')]['id'],'name':_0x5b0eec[_0x1b41('0x47')][_0x1b41('0x1e')],'fullname':_0x5b0eec[_0x1b41('0x47')][_0x1b41('0x122')],'alias':_0x5b0eec['User'][_0x1b41('0x89')]};}return _0x5b0eec;});});}else{var _0x4e1e7e=_[_0x1b41('0x123')](_0x213fcc)+(_0x213fcc===_0x1b41('0x109')?_0x1b41('0x124'):_0x1b41('0x125'));var _0x37af64={'attributes':['id',_0x1b41('0x126'),'closedAt',_0x1b41('0x120'),_0x1b41('0x127'),_0x1b41('0x128'),_0x1b41('0x129'),_0x1b41('0x12a'),_0x1b41('0x11e'),_0x4e1e7e+'Id'],'where':{'ContactId':_0x10385d[_0x1b41('0xb4')]['id']},'include':[{'model':db[_0x4e1e7e],'as':_0x1b41('0x125'),'attributes':['id','name',_0x1b41('0x12b')]},{'model':db['User'],'as':_0x1b41('0x12c'),'attributes':['id','name',_0x1b41('0x122')]},{'model':db[_0x1b41('0xb5')],'as':_0x1b41('0x80'),'attributes':['id','name',_0x1b41('0x34')],'through':{'attributes':[]}}],'order':[[_0x1b41('0x120'),_0x1b41('0x6b')]]};if(_0x10385d['query'][_0x1b41('0x11f')]){_0x37af64[_0x1b41('0x30')][_0x1b41('0x120')]={'$gte':_0x597929[_0x1b41('0x36')],'$lte':_0x597929['to']};}switch(_0x213fcc){case'chat':_0x37af64['attributes'][_0x1b41('0x55')](_0x1b41('0x12d'),_0x1b41('0x12e'),_0x1b41('0x12f'),_0x1b41('0x130'),_0x1b41('0x131'),_0x1b41('0x132'),_0x1b41('0x133'),_0x1b41('0x134'),_0x1b41('0x135'));break;case _0x1b41('0x136'):_0x37af64[_0x1b41('0x2c')][_0x1b41('0x55')]('subject',_0x1b41('0x137'));break;case _0x1b41('0x10b'):_0x37af64[_0x1b41('0x2c')]['push'](_0x1b41('0x138'),_0x1b41('0x139'));break;}return db[_[_0x1b41('0x123')](_0x213fcc)+'Interaction'][_0x1b41('0x121')](_0x37af64)[_0x1b41('0x19')](function(_0x794fbe){_0x3cb5c1['count']+=_0x794fbe[_0x1b41('0x15')];return _[_0x1b41('0x43')](_0x794fbe['rows'],function(_0x2aff7e){var _0x1852e6=_0x2aff7e['get']({'plain':!![]});_0x1852e6[_0x1b41('0x111')]=_0x213fcc;if(_0x1852e6['Owner']){_0x1852e6[_0x1b41('0x12c')]={'id':_0x1852e6[_0x1b41('0x12c')]['id'],'name':_0x1852e6['Owner'][_0x1b41('0x1e')],'fullname':_0x1852e6['Owner'][_0x1b41('0x122')]};}return _0x1852e6;});});}});return Promise[_0x1b41('0x25')](_0x3ed65c);})[_0x1b41('0x19')](function(_0x5a74d4){return _(_0x5a74d4)[_0x1b41('0x13a')]()[_0x1b41('0x13b')]('createdAt')['reverse']()[_0x1b41('0x50')]();})[_0x1b41('0x19')](function(_0x23ab09){_0x3cb5c1['rows']=_0x4ffee6[_0x1b41('0x13')]?_0x23ab09[_0x1b41('0x13c')](_0x4ffee6[_0x1b41('0x16')],_0x4ffee6['offset']+_0x4ffee6['limit']):_0x23ab09;return _0x3cb5c1;})[_0x1b41('0x19')](respondWithFilteredResult(_0x493cb6,_0x4ffee6))[_0x1b41('0x82')](handleError(_0x493cb6,null));}; \ No newline at end of file +var _0xf378=['MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','all','show','Tag','ContactItemType','ItemType','isNil','$and','omit','format','cf_%d','pickBy','isEmpty','table','id\x20=\x20?','toParam','phone','CmHopper','rawAttributes','pick','options','getTags','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','description','ItemTypeId','PHONE','item','literal','`ItemType`.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','include','getHopperHistories','includeAll','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','file','path','parse','meta','import','binding','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','importUpdates','start\x20child\x20process\x20correctly!','exit','mail','chat','sms','openchannel','voice','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','starttime','endtime','duration','note','createdAt','userDisposition','UserId','fullname','findAndCountAll','startCase','Website','closedAt','disposition','thirdDisposition','Account','key','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','Interaction','flatten','sortBy','reverse','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','length','fieldType','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','field','color','tools_tags','select','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','buildExpression','text','start','end','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','User','getLists','c.ListId\x20IS\x20NULL','map','ListId','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','tags','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction'];(function(_0x478643,_0x3a2230){var _0x483752=function(_0x1a14dc){while(--_0x1a14dc){_0x478643['push'](_0x478643['shift']());}};_0x483752(++_0x3a2230);}(_0xf378,0x1df));var _0x8f37=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf378[_0x88cd7b];return _0x56fcc8;};'use strict';var moment=require(_0x8f37('0x0'));var BPromise=require(_0x8f37('0x1'));var util=require(_0x8f37('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x8f37('0x3'));var squel=require(_0x8f37('0x4'));var Papa=require(_0x8f37('0x5'));var Redis=require(_0x8f37('0x6'));var qs=require(_0x8f37('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x8f37('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0x8f37('0x9'))['db'];config[_0x8f37('0xa')]=_['defaults'](config[_0x8f37('0xa')],{'host':_0x8f37('0xb'),'port':0x18eb});var socket=require(_0x8f37('0xc'))(new Redis(config[_0x8f37('0xa')]));require(_0x8f37('0xd'))[_0x8f37('0xe')](socket);function respondWithResult(_0x4a9ada,_0x1aedc5){_0x1aedc5=_0x1aedc5||0xc8;return function(_0x385da8){if(_0x385da8){return _0x4a9ada[_0x8f37('0xf')](_0x1aedc5)['json'](_0x385da8);}};}function respondWithFilteredResult(_0x439bb3,_0x56f9e5){return function(_0x45f44b){if(_0x45f44b){var _0x29f924=typeof _0x56f9e5['offset']===_0x8f37('0x10')&&typeof _0x56f9e5[_0x8f37('0x11')]==='undefined';var _0x379413=_0x45f44b[_0x8f37('0x12')];var _0x5cf473=_0x29f924?0x0:_0x56f9e5[_0x8f37('0x13')];var _0x4cd1ae=_0x29f924?_0x45f44b['count']:_0x56f9e5[_0x8f37('0x13')]+_0x56f9e5['limit'];var _0x3ff46c;if(_0x4cd1ae>=_0x379413){_0x4cd1ae=_0x379413;_0x3ff46c=0xc8;}else{_0x3ff46c=0xce;}_0x439bb3[_0x8f37('0xf')](_0x3ff46c);return _0x439bb3[_0x8f37('0x14')](_0x8f37('0x15'),_0x5cf473+'-'+_0x4cd1ae+'/'+_0x379413)[_0x8f37('0x16')](_0x45f44b);}return null;};}function saveUpdates(_0x2ca2d8){return function(_0x17e2bf){if(_0x17e2bf){return _0x17e2bf[_0x8f37('0x17')](_0x2ca2d8)[_0x8f37('0x18')](function(_0xf599f2){return _0xf599f2;});}return null;};}function removeEntity(_0x58fd8f){return function(_0xa8b629){if(_0xa8b629){return _0xa8b629[_0x8f37('0x19')]()[_0x8f37('0x18')](function(){_0x58fd8f[_0x8f37('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c8c9){return function(_0x219c8a){if(!_0x219c8a){_0x41c8c9[_0x8f37('0x1a')](0x194);}return _0x219c8a;};}function handleError(_0x1f3d3c,_0x1910b3){_0x1910b3=_0x1910b3||0x1f4;return function(_0x4ecb30){logger[_0x8f37('0x1b')](_0x4ecb30[_0x8f37('0x1c')]);if(_0x4ecb30['name']){delete _0x4ecb30[_0x8f37('0x1d')];}_0x1f3d3c['status'](_0x1910b3)['send'](_0x4ecb30);};}exports[_0x8f37('0x1e')]=function(_0x40b567,_0x5a5e8c){var _0x3bdf1c={},_0x481590={},_0x4a02dd={'count':0x0,'rows':[]};return db[_0x8f37('0x1f')][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x33e2ce){var _0x246253=[];for(var _0x5a0b74=0x0;_0x5a0b740x1){_0x2dc294['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x531ccc),null);}else{if(qs[_0x8f37('0x5c')](_0x531ccc)){_0x2dc294['or'](_0x8f37('0x5d'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x5e'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x5f'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x60'),_0x531ccc+'%');}else if(qs[_0x8f37('0x61')](_0x531ccc)){_0x2dc294['or'](_0x8f37('0x62'),_0x531ccc+'%');}else{_0x2dc294['or'](_0x8f37('0x63'),'%'+_0x531ccc+'%');_0x2dc294['or']('c.lastName\x20LIKE\x20?','%'+_0x531ccc+'%');_0x2dc294['or']('c.email\x20LIKE\x20?','%'+_0x531ccc+'%');}}}}_0x8abfdf['where'](_0x2dc294);_0x8abfdf[_0x8f37('0x64')](_0x8f37('0x65'));var _0x1c8641={'type':db[_0x8f37('0x66')][_0x8f37('0x67')]['SELECT'],'raw':!![]};var _0xe918c4=_0x8abfdf[_0x8f37('0x68')]()[_0x8f37('0x35')](_0x8f37('0x65'));if(_0x3bdf1c[_0x8f37('0x31')]){_0x3bdf1c[_0x8f37('0x31')][_0x8f37('0x48')](function(_0x209c2d){_0x8abfdf['order']('c.'+_0x209c2d[0x0],_0x209c2d[0x1]===_0x8f37('0x69')?![]:!![]);});}if(!_['isEmpty'](_0x118427)){_0x8abfdf[_0x8f37('0x6a')](_0x6fd0f9);_0xe918c4[_0x8f37('0x33')](_0x8f37('0x6b'),_0x118427);}BPromise[_0x8f37('0x6c')]()[_0x8f37('0x18')](function(){if(!_0x51ad1e)return;if(_0x40b567[_0x8f37('0x6d')]['role']!==_0x8f37('0x6e'))return;if(!_[_0x8f37('0x6f')](_0x51ad1e[_0x8f37('0x44')],[_0x8f37('0x35'),_0x8f37('0x70')])){return _0x40b567[_0x8f37('0x6d')][_0x8f37('0x71')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a7277){if(_['isEmpty'](_0x5a7277)){_0xe918c4[_0x8f37('0x33')]('c.ListId\x20IS\x20NULL');_0x8abfdf[_0x8f37('0x33')](_0x8f37('0x72'));}else{_0xe918c4[_0x8f37('0x33')](_0x8f37('0x55'),_[_0x8f37('0x73')](_0x5a7277,'id'));_0x8abfdf[_0x8f37('0x33')](_0x8f37('0x55'),_[_0x8f37('0x73')](_0x5a7277,'id'));}});}})[_0x8f37('0x18')](function(){if(_0x40b567[_0x8f37('0x6d')]['role']===_0x8f37('0x6e')&&!_0x51ad1e&&!_0x40b567[_0x8f37('0x2c')][_0x8f37('0x74')])return[];return db['sequelize'][_0x8f37('0x2c')](_0xe918c4['toString'](),_0x1c8641);})[_0x8f37('0x18')](function(_0x157384){_0x4a02dd['count']=_0x157384[_0x8f37('0x28')];if(_0x4a02dd[_0x8f37('0x12')]===0x0)return[];return db[_0x8f37('0x75')][_0x8f37('0x2c')](_0x196ad9[_0x8f37('0x76')](),_0x1c8641)[_0x8f37('0x18')](function(_0x354b81){_0x360b2c=_[_0x8f37('0x77')](_0x354b81,'id');_0x1c8641=_[_0x8f37('0x78')](_0x1c8641,{'model':db[_0x8f37('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40b567['query'][_0x8f37('0x2f')]){_0x3bdf1c[_0x8f37('0x2e')][_0x8f37('0x48')](function(_0x97ac3b){_0x8abfdf[_0x8f37('0x35')]('c.'+_0x97ac3b);});}else{_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x65'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x79'));_0x8abfdf[_0x8f37('0x35')]('c.lastName');_0x8abfdf['field'](_0x8f37('0x7a'));_0x8abfdf[_0x8f37('0x35')]('c.mobile');_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7b'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7c'));_0x8abfdf['field'](_0x8f37('0x7d'));_0x8abfdf['field'](_0x8f37('0x7e'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7f'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x80'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x81'),_0x8f37('0x82'));}if(_0x3bdf1c[_0x8f37('0x11')])_0x8abfdf[_0x8f37('0x11')](_0x3bdf1c['limit']);if(_0x3bdf1c['offset'])_0x8abfdf[_0x8f37('0x13')](_0x3bdf1c[_0x8f37('0x13')]);return db[_0x8f37('0x75')]['query'](_0x8abfdf[_0x8f37('0x76')](),_0x1c8641);});})['then'](function(_0x3a4ab0){_0x3a4ab0[_0x8f37('0x48')](function(_0x4dc4e1){if(_0x4dc4e1[_0x8f37('0x82')]){_0x4dc4e1[_0x8f37('0x83')]=[];_0x4dc4e1[_0x8f37('0x82')]['split'](',')['forEach'](function(_0x13a2ac){_0x4dc4e1[_0x8f37('0x83')][_0x8f37('0x24')](_0x360b2c[_0x13a2ac]);});}delete _0x4dc4e1[_0x8f37('0x82')];});_0x4a02dd[_0x8f37('0x84')]=_0x3a4ab0;return _0x4a02dd;})[_0x8f37('0x18')](respondWithFilteredResult(_0x5a5e8c,_0x3bdf1c));})['catch'](handleError(_0x5a5e8c,null));};exports['destroy']=function(_0x3ce77f,_0x33de20){return db[_0x8f37('0x1f')][_0x8f37('0x45')]({'where':{'id':_0x3ce77f[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x33de20,null))[_0x8f37('0x18')](removeEntity(_0x33de20,null))[_0x8f37('0x86')](handleError(_0x33de20,null));};exports['describe']=function(_0x20590f,_0x2c8004){return db[_0x8f37('0x1f')][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x4af56a){delete _0x4af56a[_0x8f37('0x87')];for(var _0x298c9e=0x0;_0x298c9e0x0){return new Promise(function(_0x834f32,_0x213787){var _0x5de421=[];for(var _0x1a821b=0x0;_0x1a821b<_0x214242[_0x8f37('0x28')];_0x1a821b++){_0x5de421[_0x8f37('0x24')](insertAdditionalPhones(_0x214242[_0x1a821b][_0x8f37('0xba')],_0x214242[_0x1a821b][_0x8f37('0xb3')]));}Promise[_0x8f37('0xbb')](_0x5de421)[_0x8f37('0x18')](function(){_0x834f32(0x1);});})['then'](function(){return{'success':_0x5a8039,'failure':_0x525918,'duplicates':_0x5cae98};});}else{return{'success':_0x5a8039,'failure':_0x525918,'duplicates':_0x5cae98};}}})[_0x8f37('0x18')](respondWithResult(_0x303666,0xc9))[_0x8f37('0x86')](handleError(_0x303666,null));};exports[_0x8f37('0xbc')]=function(_0x3cddb3,_0x271560){var _0x5cfb3c;return db['CmContact'][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x386e2e){return db[_0x8f37('0x1f')][_0x8f37('0x45')]({'where':{'id':_0x3cddb3[_0x8f37('0x85')]['id']},'include':[{'model':db[_0x8f37('0xbd')],'as':_0x8f37('0x83'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x36')],'required':_0x3cddb3['query']['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x3cddb3[_0x8f37('0x85')]['id']},'required':![],'include':[{'model':db[_0x8f37('0xbe')],'as':_0x8f37('0xbf')}]}],'order':[db['sequelize']['literal']('Phones.OrderBy')],'attributes':_[_0x8f37('0x21')](_0x386e2e)});})[_0x8f37('0x18')](function(_0x1b22ad){if(!_[_0x8f37('0xc0')](_0x1b22ad)){_0x5cfb3c=_0x1b22ad[_0x8f37('0x90')]({'plain':!![]});var _0x5b856c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b22ad&&_0x1b22ad[_0x8f37('0x74')]){if(_0x1b22ad['ListId']){_0x5b856c[_0x8f37('0x33')][_0x8f37('0xc1')][_0x8f37('0x24')]({'ListId':{'$ne':_0x1b22ad[_0x8f37('0x74')]}});}}return db[_0x8f37('0x25')][_0x8f37('0x8b')](_0x5b856c);}})[_0x8f37('0x18')](function(_0x40408e){if(!_[_0x8f37('0xc0')](_0x40408e)){return _[_0x8f37('0xc2')](_0x5cfb3c,_['map'](_0x40408e,function(_0x4cfa6a){return util[_0x8f37('0xc3')](_0x8f37('0xc4'),_0x4cfa6a['id']);}));}})['then'](handleEntityNotFound(_0x271560,null))[_0x8f37('0x18')](respondWithResult(_0x271560,null))[_0x8f37('0x86')](handleError(_0x271560,null));};exports[_0x8f37('0x17')]=function(_0x17a372,_0x483069){var _0x2f7b7a;if(_0x17a372[_0x8f37('0x8f')]['id']){delete _0x17a372[_0x8f37('0x8f')]['id'];}if(!_[_0x8f37('0xc0')](_0x17a372[_0x8f37('0x8f')][_0x8f37('0xb0')])){var _0x38bb21=_0x17a372[_0x8f37('0x8f')][_0x8f37('0xb0')];if(!_['isNil'](shared[_0x8f37('0xb1')][_0x38bb21]))_0x17a372['body'][_0x8f37('0xb2')]=shared['timezones'][_0x38bb21][_0x8f37('0xb2')];}return db[_0x8f37('0x1f')]['find']({'where':{'id':_0x17a372[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x483069,null))[_0x8f37('0x18')](saveUpdates(_0x17a372[_0x8f37('0x8f')],null))[_0x8f37('0x18')](function(_0x439334){_0x2f7b7a=_0x439334;var _0x5aa267={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x439334&&_0x439334['ListId']){if(_0x439334[_0x8f37('0x74')]){_0x5aa267[_0x8f37('0x33')][_0x8f37('0xc1')]['push']({'ListId':{'$ne':_0x439334[_0x8f37('0x74')]}});}}return db[_0x8f37('0x25')][_0x8f37('0x8b')](_0x5aa267);})[_0x8f37('0x18')](function(_0x408eab){if(_0x408eab){return _[_0x8f37('0xc2')](_[_0x8f37('0xc5')](_0x17a372[_0x8f37('0x8f')],function(_0x526fa4,_0x32bf2a){return _[_0x8f37('0x22')](_0x32bf2a,_0x8f37('0x23'));}),_[_0x8f37('0x73')](_0x408eab,function(_0x5eef4f){return util[_0x8f37('0xc3')]('cf_%d',_0x5eef4f['id']);}));}})[_0x8f37('0x18')](function(_0xdfd0a6){if(_0xdfd0a6&&!_[_0x8f37('0xc6')](_0xdfd0a6)){var _0x502da7=squel[_0x8f37('0x17')]()[_0x8f37('0xc7')](_0x8f37('0x3a'))['setFields'](_0xdfd0a6)[_0x8f37('0x33')](_0x8f37('0xc8'),_0x17a372[_0x8f37('0x85')]['id'])[_0x8f37('0xc9')]();return db[_0x8f37('0x75')][_0x8f37('0x2c')](_0x502da7[_0x8f37('0x51')],{'replacements':_0x502da7[_0x8f37('0x8e')]});}})[_0x8f37('0x18')](function(){if(_0x17a372['body'][_0x8f37('0xca')]&&_0x2f7b7a){return db[_0x8f37('0xcb')]['update']({'phone':_0x17a372[_0x8f37('0x8f')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2f7b7a['id']}});}})['then'](function(){return _0x2f7b7a;})['then'](respondWithResult(_0x483069,null))[_0x8f37('0x86')](handleError(_0x483069,null));};exports['getTags']=function(_0x22686d,_0x263027){var _0x193e71={};var _0x25331d={};var _0x4bb4e1;var _0x53819d;return db[_0x8f37('0x1f')][_0x8f37('0x26')]({'where':{'id':_0x22686d[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x263027,null))[_0x8f37('0x18')](function(_0x52014a){if(_0x52014a){_0x4bb4e1=_0x52014a;_0x25331d[_0x8f37('0x2b')]=_[_0x8f37('0x21')](db['Tag'][_0x8f37('0xcc')]);_0x25331d[_0x8f37('0x2c')]=_['keys'](_0x22686d[_0x8f37('0x2c')]);_0x25331d[_0x8f37('0x34')]=_['intersection'](_0x25331d[_0x8f37('0x2b')],_0x25331d[_0x8f37('0x2c')]);_0x193e71[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0x25331d[_0x8f37('0x2b')],qs['fields'](_0x22686d[_0x8f37('0x2c')]['fields']));_0x193e71[_0x8f37('0x2e')]=_0x193e71[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x193e71[_0x8f37('0x2e')]:_0x25331d[_0x8f37('0x2b')];_0x193e71[_0x8f37('0x31')]=qs['sort'](_0x22686d[_0x8f37('0x2c')][_0x8f37('0x32')]);_0x193e71['where']=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x22686d['query'],_0x25331d[_0x8f37('0x34')]));if(_0x22686d[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x193e71[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x193e71[_0x8f37('0x33')],{'$or':_['map'](_0x193e71['attributes'],function(_0x3f828c){var _0x262a9b={};_0x262a9b[_0x3f828c]={'$like':'%'+_0x22686d['query'][_0x8f37('0x5a')]+'%'};return _0x262a9b;})});}_0x193e71=_[_0x8f37('0x78')]({},_0x193e71,_0x22686d[_0x8f37('0xce')]);return _0x4bb4e1[_0x8f37('0xcf')](_0x193e71);}})[_0x8f37('0x18')](function(_0x4d2dad){if(_0x4d2dad){_0x53819d=_0x4d2dad[_0x8f37('0x28')];if(!_0x22686d[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x193e71['limit']=qs[_0x8f37('0x11')](_0x22686d['query'][_0x8f37('0x11')]);_0x193e71[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x22686d[_0x8f37('0x2c')][_0x8f37('0x13')]);}return _0x4bb4e1['getTags'](_0x193e71);}})[_0x8f37('0x18')](function(_0x323d60){if(_0x323d60){return _0x323d60?{'count':_0x53819d,'rows':_0x323d60}:null;}})[_0x8f37('0x18')](respondWithResult(_0x263027,null))[_0x8f37('0x86')](handleError(_0x263027,null));};exports[_0x8f37('0xd1')]=function(_0x229473,_0x41d046){if(_0x229473[_0x8f37('0x8f')]['id']){delete _0x229473[_0x8f37('0x8f')]['id'];}return db[_0x8f37('0x1f')][_0x8f37('0x26')]({'where':{'id':_0x229473[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x41d046,null))[_0x8f37('0x18')](function(_0x5a2194){if(_0x5a2194){return _0x5a2194[_0x8f37('0xd1')](_0x229473[_0x8f37('0x8f')][_0x8f37('0xd2')]||[]);}return null;})[_0x8f37('0x18')](respondWithResult(_0x41d046,null))[_0x8f37('0x86')](handleError(_0x41d046,null));};exports[_0x8f37('0xd3')]=function(_0x35804c,_0x422e16){var _0x4fc5ee=[];_0x4fc5ee[_0x8f37('0x24')](addAdditionalPhones(_0x35804c[_0x8f37('0x8f')]));Promise[_0x8f37('0xbb')](_0x4fc5ee)[_0x8f37('0x18')](function(){_0x4fc5ee=[];_0x4fc5ee[_0x8f37('0x24')](deleteCmHopperPhones(_0x35804c[_0x8f37('0x8f')]['id']));_0x4fc5ee[_0x8f37('0x24')](addCmHopperPhones(_0x35804c[_0x8f37('0x8f')]['id']));Promise['all'](_0x4fc5ee)[_0x8f37('0x18')](function(){return[0x1];})[_0x8f37('0x18')](respondWithResult(_0x422e16,null));});};function addAdditionalPhones(_0x5548af){var _0x51499d;return new Promise(function(_0x4cbc0,_0x41cc1a){return db[_0x8f37('0xa2')]['destroy']({'where':{'CmContactId':_0x5548af['id']}})[_0x8f37('0x18')](function(){db[_0x8f37('0xbe')][_0x8f37('0x8b')]({'raw':!![],'attributes':['id',_0x8f37('0xd4')]})[_0x8f37('0x18')](function(_0xeaf9bf){var _0x4ac416=[];for(var _0x579293=0x0;_0x579293<_0x5548af[_0x8f37('0xd5')]['length'];_0x579293++){var _0x4998e5=_0x5548af['item_types']?_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])?'':_0x5548af[_0x8f37('0xd6')][_0x579293]:_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']?_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']:'';var _0x13fa6f=_[_0x8f37('0xc0')](_0x5548af['items'][_0x579293][_0x8f37('0xd7')])?'':_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd7')];var _0x44f4a7=_0x4998e5+':'+_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xca')]+'§'+_0x13fa6f;if(_[_0x8f37('0xc0')](_0x51499d))_0x51499d=_0x44f4a7;else _0x51499d+=';'+_0x44f4a7;var _0x177010=null;if(_0x5548af[_0x8f37('0xd6')]){if(!_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])){var _0x23b452=_[_0x8f37('0x45')](_0xeaf9bf,function(_0x3c5ac3){return _0x3c5ac3['id']===_0x5548af[_0x8f37('0xd6')][_0x579293];});if(!_[_0x8f37('0xc0')](_0x23b452)){_0x177010=_0x23b452[_0x8f37('0xd4')];}}}else{if(!_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd5')][_0x579293])){var _0x23b452=_[_0x8f37('0x45')](_0xeaf9bf,function(_0x1c9300){return _0x1c9300['id']===_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd8')];});if(!_[_0x8f37('0xc0')](_0x23b452)){_0x177010=_0x579293;}}}if(_[_0x8f37('0xc0')](_0x177010)){_0x177010=0x64;}_0x4ac416[_0x8f37('0x24')](addAdditionalPhone(_0x5548af['id'],_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xca')],_0x5548af[_0x8f37('0xd6')]?_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])?null:_0x5548af[_0x8f37('0xd6')][_0x579293]:_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']?_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd8')]:null,_0x177010,_0x13fa6f));}Promise[_0x8f37('0xbb')](_0x4ac416)['then'](function(){db['CmContact'][_0x8f37('0x17')]({'AdditionalPhones':_0x51499d},{'where':{'id':_0x5548af['id']}})['then'](function(){_0x4cbc0(0x1);});});});});});}function addAdditionalPhone(_0x3f3db4,_0x493fc8,_0x21f1ef,_0x562208,_0x1a1a82){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x3f3db4,'item':_0x493fc8}})[_0x8f37('0x18')](function(_0x3737b1){if(_0x3737b1)logger[_0x8f37('0x94')]('contact\x20phone\x20exists',_0x3737b1);else{db[_0x8f37('0xa2')][_0x8f37('0x99')]({'CmContactId':_0x3f3db4,'item':_0x493fc8,'ItemTypeId':_0x21f1ef,'OrderBy':_0x562208,'ItemClass':_0x8f37('0xd9'),'description':_0x1a1a82});}});}function deletePhones(_0x28abb7){return db[_0x8f37('0xa2')][_0x8f37('0x19')]({'where':{'CmContactId':_0x28abb7}});}function deleteCmHopperPhones(_0x3b9a94){return new Promise(function(_0x15b2a9,_0x583a9b){return db['CmHopper'][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3b9a94}})[_0x8f37('0x18')](function(_0x1449db){db['CmHopperAdditionalPhone'][_0x8f37('0x19')]({'where':{'CmHopperId':{'$in':_[_0x8f37('0x73')](_0x1449db,'id')}}});})[_0x8f37('0x18')](function(){_0x15b2a9(0x1);});});}function addCmHopperPhones(_0x22a2a0){return new Promise(function(_0x17e8db,_0x1c70a4){return db[_0x8f37('0xcb')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x22a2a0}})[_0x8f37('0x18')](function(_0x1c6a07){var _0x40c449=[];_['map'](_0x1c6a07,function(_0x394c5d){_0x40c449[_0x8f37('0x24')](createCmHopperPhone(_0x22a2a0,_0x394c5d['id']));});Promise[_0x8f37('0xbb')](_0x40c449)[_0x8f37('0x18')](function(){_0x17e8db(0x1);});});});}function createCmHopperPhone(_0x8ae25b,_0x49dd82){return new Promise(function(_0x2483dc,_0x2579dc){db['CmContactHasItem'][_0x8f37('0x8b')]({'raw':!![],'attributes':[_0x8f37('0xda'),_0x8f37('0xd4')],'where':{'CmContactId':_0x8ae25b,'ItemClass':_0x8f37('0xd9')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x8f37('0xbf')}],'order':[_0x8f37('0xd4'),db[_0x8f37('0x75')][_0x8f37('0xdb')](_0x8f37('0xdc'))]})[_0x8f37('0x18')](function(_0x231861){var _0x4b48d0=0x1;var _0x9ae709=_[_0x8f37('0x73')](_0x231861,function(_0xa732b7){_0xa732b7['CmHopperId']=_0x49dd82;_0xa732b7[_0x8f37('0xca')]=_0xa732b7['item'];_0xa732b7[_0x8f37('0xd4')]=_0x4b48d0;delete _0xa732b7['ItemType.OrderBy'];_0x4b48d0=_0x4b48d0+0x1;return _0xa732b7;});return db[_0x8f37('0xdd')]['bulkCreate'](_0x9ae709,{});})['then'](function(){_0x2483dc(0x1);});});}function insertAdditionalPhones(_0x2a60f6,_0x299bb2){return new Promise(function(_0xe8b6,_0xd9eee0){var _0x399169=[];for(var _0x1e0b1b=0x0;_0x1e0b1b<_0x299bb2[_0x8f37('0x28')];_0x1e0b1b++){var _0x375270=_0x299bb2[_0x1e0b1b];_0x399169[_0x8f37('0x24')](parseContactItemType(_0x375270));}Promise[_0x8f37('0xbb')](_0x399169)[_0x8f37('0x18')](function(){var _0x5672c1={'id':_0x2a60f6['id'],'items':_0x299bb2};return addAdditionalPhones(_0x5672c1)[_0x8f37('0x18')](function(_0x533f8c){return addCmHopperPhones(_0x2a60f6['id']);});})[_0x8f37('0x18')](function(){_0xe8b6(_0x2a60f6);});});}function parseContactItemType(_0x16bdad){return new Promise(function(_0x3db266,_0x271b9d){if(_0x16bdad[_0x8f37('0x30')](_0x8f37('0xd8'))){_0x3db266(_0x16bdad);}else{return db[_0x8f37('0xbe')]['find']({'where':{'name':_0x16bdad[_0x8f37('0xbf')]}})['then'](function(_0x356f6c){if(_['isNil'](_0x356f6c))_0x16bdad[_0x8f37('0xd8')]=null;else _0x16bdad[_0x8f37('0xd8')]=_0x356f6c['id'];_0x3db266(_0x16bdad);});}});}exports[_0x8f37('0xde')]=function(_0x361078,_0x2c97e9){return db[_0x8f37('0xa2')][_0x8f37('0x8b')]({'raw':!![],'where':{'CmContactId':_0x361078[_0x8f37('0x85')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x8f37('0xbf')}],'order':[[_0x8f37('0xd4')],[db[_0x8f37('0x75')][_0x8f37('0xdb')](_0x8f37('0xdc'))]]})[_0x8f37('0x18')](function(_0x165364){return _0x165364;})[_0x8f37('0x18')](respondWithResult(_0x2c97e9,null))[_0x8f37('0x86')](handleError(_0x2c97e9,null));};exports[_0x8f37('0xdf')]=function(_0x2ea982,_0x3be29b){return db[_0x8f37('0xa2')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe0')]}})['then'](function(_0x2c886c){var _0x2d24b4=_[_0x8f37('0x73')](_0x2c886c,function(_0x151944){_0x151944[_0x8f37('0xe1')]=_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe2')];return _0x151944;});return db[_0x8f37('0xa2')][_0x8f37('0xb4')](_0x2d24b4,{});})[_0x8f37('0x18')](function(_0x496f05){return addCmHopperPhones(_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe2')]);})[_0x8f37('0x18')](function(_0x5a6cfa){return['ok'];})[_0x8f37('0x18')](respondWithResult(_0x3be29b,null))[_0x8f37('0x86')](handleError(_0x3be29b,null));};exports[_0x8f37('0xe3')]=function(_0x2e1a25,_0x27fbec){var _0x3e6dee=[];_0x3e6dee[_0x8f37('0x24')](createCmHopperPhone(_0x2e1a25[_0x8f37('0x8f')]['id'],_0x2e1a25[_0x8f37('0x8f')][_0x8f37('0xe4')]));Promise[_0x8f37('0xbb')](_0x3e6dee)[_0x8f37('0x18')](function(){return[0x1];})[_0x8f37('0x18')](respondWithResult(_0x27fbec,null));};exports[_0x8f37('0xe5')]=function(_0x31ef66,_0x535b0e){var _0x31113e={'raw':![],'where':{}};var _0xe89ed6={};var _0xf5af89={'count':0x0,'rows':[]};return db['CmContact'][_0x8f37('0x26')]({'where':{'id':_0x31ef66[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x535b0e,null))[_0x8f37('0x18')](function(_0x42d20f){if(_0x42d20f){_0xe89ed6[_0x8f37('0x2b')]=_['keys'](db['CmHopper']['rawAttributes']);_0xe89ed6['query']=_[_0x8f37('0x21')](_0x31ef66[_0x8f37('0x2c')]);_0xe89ed6[_0x8f37('0x34')]=_[_0x8f37('0x2d')](_0xe89ed6[_0x8f37('0x2b')],_0xe89ed6[_0x8f37('0x2c')]);_0x31113e[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0xe89ed6['model'],qs[_0x8f37('0x2f')](_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x31113e[_0x8f37('0x2e')]=_0x31113e[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x31113e[_0x8f37('0x2e')]:_0xe89ed6['model'];if(!_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x31113e[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x31ef66[_0x8f37('0x2c')]['limit']);_0x31113e['offset']=qs[_0x8f37('0x13')](_0x31ef66['query']['offset']);}_0x31113e[_0x8f37('0x31')]=qs[_0x8f37('0x32')](_0x31ef66['query'][_0x8f37('0x32')]);_0x31113e[_0x8f37('0x33')]=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x31ef66['query'],_0xe89ed6['filters']));_0x31113e[_0x8f37('0x33')][_0x8f37('0xe6')]=_0x42d20f['id'];if(_0x31ef66['query'][_0x8f37('0x5a')]){_0x31113e[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x31113e[_0x8f37('0x33')],{'$or':_['map'](_0x31113e[_0x8f37('0x2e')],function(_0xce7053){var _0x54f256={};_0x54f256[_0xce7053]={'$like':'%'+_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x54f256;})});}_0x31113e=_['merge']({},_0x31113e,_0x31ef66[_0x8f37('0xce')]);return db[_0x8f37('0xcb')][_0x8f37('0x12')]({'where':_0x31113e[_0x8f37('0x33')]})['then'](function(_0xf566d8){_0xf5af89[_0x8f37('0x12')]=_0xf566d8;if(_0x31ef66['query']['includeAll']){_0x31113e[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xcb')][_0x8f37('0x8b')](_0x31113e);})[_0x8f37('0x18')](function(_0x33c31d){_0xf5af89[_0x8f37('0x84')]=_0x33c31d;return _0xf5af89;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x535b0e,_0x31113e))['catch'](handleError(_0x535b0e,null));};exports[_0x8f37('0xe8')]=function(_0xa6fa9a,_0x4d7be4){var _0x367cd9={'raw':!![],'where':{}};var _0x3458c1={};var _0x3d9970={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa6fa9a[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x4d7be4,null))[_0x8f37('0x18')](function(_0x1c095f){if(_0x1c095f){_0x3458c1[_0x8f37('0x2b')]=_['keys'](db[_0x8f37('0xa4')][_0x8f37('0xcc')]);_0x3458c1[_0x8f37('0x2c')]=_[_0x8f37('0x21')](_0xa6fa9a[_0x8f37('0x2c')]);_0x3458c1['filters']=_[_0x8f37('0x2d')](_0x3458c1[_0x8f37('0x2b')],_0x3458c1['query']);_0x367cd9[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0x3458c1[_0x8f37('0x2b')],qs[_0x8f37('0x2f')](_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x367cd9[_0x8f37('0x2e')]=_0x367cd9[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x367cd9[_0x8f37('0x2e')]:_0x3458c1[_0x8f37('0x2b')];if(!_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x367cd9['limit']=qs['limit'](_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x11')]);_0x367cd9[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0xa6fa9a[_0x8f37('0x2c')]['offset']);}_0x367cd9[_0x8f37('0x31')]=qs['sort'](_0xa6fa9a[_0x8f37('0x2c')]['sort']);_0x367cd9[_0x8f37('0x33')]=qs['filters'](_[_0x8f37('0xcd')](_0xa6fa9a[_0x8f37('0x2c')],_0x3458c1[_0x8f37('0x34')]));_0x367cd9['where'][_0x8f37('0xe6')]=_0x1c095f['id'];if(_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x367cd9[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x367cd9[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x367cd9[_0x8f37('0x2e')],function(_0x508f3b){var _0x1ebe3e={};_0x1ebe3e[_0x508f3b]={'$like':'%'+_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x1ebe3e;})});}_0x367cd9=_['merge']({},_0x367cd9,_0xa6fa9a['options']);return db[_0x8f37('0xa4')][_0x8f37('0x12')]({'where':_0x367cd9[_0x8f37('0x33')]})[_0x8f37('0x18')](function(_0x201d3b){_0x3d9970[_0x8f37('0x12')]=_0x201d3b;if(_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x367cd9[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xa4')][_0x8f37('0x8b')](_0x367cd9);})['then'](function(_0x415ae2){_0x3d9970[_0x8f37('0x84')]=_0x415ae2;return _0x3d9970;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x4d7be4,_0x367cd9))[_0x8f37('0x86')](handleError(_0x4d7be4,null));};exports[_0x8f37('0xea')]=function(_0x589849,_0x1a70c9){var _0x51b3d0={'raw':!![],'where':{}};var _0x2a793f={};var _0x53a897={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x589849[_0x8f37('0x85')]['id']}})['then'](handleEntityNotFound(_0x1a70c9,null))[_0x8f37('0x18')](function(_0x215fac){if(_0x215fac){_0x2a793f['model']=_[_0x8f37('0x21')](db['CmHopperFinal'][_0x8f37('0xcc')]);_0x2a793f['query']=_[_0x8f37('0x21')](_0x589849[_0x8f37('0x2c')]);_0x2a793f['filters']=_[_0x8f37('0x2d')](_0x2a793f['model'],_0x2a793f[_0x8f37('0x2c')]);_0x51b3d0['attributes']=_['intersection'](_0x2a793f[_0x8f37('0x2b')],qs[_0x8f37('0x2f')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x51b3d0[_0x8f37('0x2e')]=_0x51b3d0[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x51b3d0[_0x8f37('0x2e')]:_0x2a793f['model'];if(!_0x589849[_0x8f37('0x2c')]['hasOwnProperty'](_0x8f37('0xd0'))){_0x51b3d0['limit']=qs[_0x8f37('0x11')](_0x589849['query']['limit']);_0x51b3d0[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x13')]);}_0x51b3d0[_0x8f37('0x31')]=qs[_0x8f37('0x32')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x32')]);_0x51b3d0['where']=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x589849[_0x8f37('0x2c')],_0x2a793f[_0x8f37('0x34')]));_0x51b3d0[_0x8f37('0x33')][_0x8f37('0xe6')]=_0x215fac['id'];if(_0x589849['query'][_0x8f37('0x5a')]){_0x51b3d0['where']=_[_0x8f37('0x78')](_0x51b3d0[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x51b3d0[_0x8f37('0x2e')],function(_0xcae272){var _0x192a1a={};_0x192a1a[_0xcae272]={'$like':'%'+_0x589849[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x192a1a;})});}_0x51b3d0=_[_0x8f37('0x78')]({},_0x51b3d0,_0x589849[_0x8f37('0xce')]);return db[_0x8f37('0xa3')][_0x8f37('0x12')]({'where':_0x51b3d0['where']})['then'](function(_0x8a6bc9){_0x53a897[_0x8f37('0x12')]=_0x8a6bc9;if(_0x589849[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x51b3d0[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xa3')]['findAll'](_0x51b3d0);})[_0x8f37('0x18')](function(_0x505a4a){_0x53a897[_0x8f37('0x84')]=_0x505a4a;return _0x53a897;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x1a70c9,_0x51b3d0))[_0x8f37('0x86')](handleError(_0x1a70c9,null));};exports[_0x8f37('0xeb')]=function(_0x462c81,_0x287706){var _0x350c4e={'raw':!![],'where':{}};var _0x33ebf6={};var _0x125cc0={'count':0x0,'rows':[]};return db['CmContact'][_0x8f37('0x26')]({'where':{'id':_0x462c81['params']['id']}})['then'](handleEntityNotFound(_0x287706,null))[_0x8f37('0x18')](function(_0x3b8549){if(_0x3b8549){_0x33ebf6[_0x8f37('0x2b')]=_[_0x8f37('0x21')](db[_0x8f37('0xac')][_0x8f37('0xcc')]);_0x33ebf6[_0x8f37('0x2c')]=_['keys'](_0x462c81[_0x8f37('0x2c')]);_0x33ebf6['filters']=_[_0x8f37('0x2d')](_0x33ebf6[_0x8f37('0x2b')],_0x33ebf6[_0x8f37('0x2c')]);_0x350c4e['attributes']=_[_0x8f37('0x2d')](_0x33ebf6['model'],qs[_0x8f37('0x2f')](_0x462c81[_0x8f37('0x2c')]['fields']));_0x350c4e['attributes']=_0x350c4e['attributes'][_0x8f37('0x28')]?_0x350c4e['attributes']:_0x33ebf6[_0x8f37('0x2b')];if(!_0x462c81['query']['hasOwnProperty'](_0x8f37('0xd0'))){_0x350c4e[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x462c81[_0x8f37('0x2c')]['limit']);_0x350c4e[_0x8f37('0x13')]=qs['offset'](_0x462c81[_0x8f37('0x2c')]['offset']);}_0x350c4e[_0x8f37('0x31')]=qs['sort'](_0x462c81['query']['sort']);_0x350c4e[_0x8f37('0x33')]=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x462c81[_0x8f37('0x2c')],_0x33ebf6[_0x8f37('0x34')]));_0x350c4e['where'][_0x8f37('0xe6')]=_0x3b8549['id'];if(_0x462c81[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x350c4e[_0x8f37('0x33')]=_['merge'](_0x350c4e[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x350c4e[_0x8f37('0x2e')],function(_0x26cfc7){var _0x5314dd={};_0x5314dd[_0x26cfc7]={'$like':'%'+_0x462c81[_0x8f37('0x2c')]['filter']+'%'};return _0x5314dd;})});}_0x350c4e=_['merge']({},_0x350c4e,_0x462c81[_0x8f37('0xce')]);return db[_0x8f37('0xac')][_0x8f37('0x12')]({'where':_0x350c4e[_0x8f37('0x33')]})[_0x8f37('0x18')](function(_0x1a4af9){_0x125cc0['count']=_0x1a4af9;if(_0x462c81[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x350c4e[_0x8f37('0xe7')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x350c4e);})['then'](function(_0x3abd46){_0x125cc0['rows']=_0x3abd46;return _0x125cc0;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x287706,_0x350c4e))['catch'](handleError(_0x287706,null));};exports[_0x8f37('0xec')]=function(_0x4c7ae5,_0x512e80){try{if(!_0x4c7ae5[_0x8f37('0x8f')]['ListId']){throw new Error(_0x8f37('0xed'));}if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')]){throw new Error(_0x8f37('0xef'));}if(!_0x4c7ae5['body'][_0x8f37('0xf0')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4c7ae5[_0x8f37('0x8f')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1c8b48=_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')][_0x8f37('0x47')](',');var _0x2832b0=_0x4c7ae5['body']['binding_values'][_0x8f37('0x47')](',');if(!_0x1c8b48[_0x8f37('0x28')]||!_0x2832b0[_0x8f37('0x28')]||_0x1c8b48[_0x8f37('0x28')]!==_0x2832b0[_0x8f37('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')]=_[_0x8f37('0xf1')](_0x1c8b48,_0x2832b0);if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')][_0x8f37('0xca')]){throw new Error(_0x8f37('0xf2'));}if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')][_0x8f37('0xf3')]){throw new Error(_0x8f37('0xf4'));}var _0xd6439a=path[_0x8f37('0x93')](config['root'],'server/files/tmp',_0x4c7ae5['file'][_0x8f37('0xf5')]);fs[_0x8f37('0xf6')](_0xd6439a,parseInt(_0x8f37('0xf7'),0x8));var _0x1f4437=require(_0x8f37('0xf8'))[_0x8f37('0xf9')](path[_0x8f37('0x93')](__dirname,_0x8f37('0xfa')),[_0xd6439a,_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xf0')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x74')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xfb')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xb6')],_0x4c7ae5[_0x8f37('0x8f')]['socket_timestamp']]);return _0x512e80['status'](0xc8)['json']({'message':_0x8f37('0xfc'),'pid':_0x1f4437[_0x8f37('0xfd')]});}catch(_0x3538f6){return _0x512e80[_0x8f37('0xf')](0x1f4)[_0x8f37('0xfe')](_0x3538f6);}};exports[_0x8f37('0xff')]=function(_0x1c4556,_0x4a74e0){var _0x36f291=fs[_0x8f37('0x100')](_0x1c4556[_0x8f37('0x101')][_0x8f37('0x102')]);Papa[_0x8f37('0x103')](_0x36f291,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x25f997){return _0x4a74e0[_0x8f37('0xf')](0xc8)[_0x8f37('0x16')]({'file':_0x1c4556[_0x8f37('0x101')],'fields':_0x25f997[_0x8f37('0x104')][_0x8f37('0x2f')]});}});};exports[_0x8f37('0x105')]=function(_0x49e3aa,_0x3d5e6a){return db[_0x8f37('0x70')][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8f37('0x6e')}})['then'](function(_0x35df49){var _0xbd8908=![];if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x74')]){throw new Error(_0x8f37('0xed'));}if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x106')]['phone']){throw new Error(_0x8f37('0xf2'));}if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x106')][_0x8f37('0xf3')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x49e3aa['body'][_0x8f37('0x107')]){throw new Error(_0x8f37('0x108'));}var _0x823444=require(_0x8f37('0xf8'))[_0x8f37('0xf9')](path[_0x8f37('0x93')](__dirname,_0x8f37('0x109')),[_0x49e3aa[_0x8f37('0x85')]['id'],JSON[_0x8f37('0x10a')](_0x49e3aa[_0x8f37('0x8f')]),JSON[_0x8f37('0x10a')](_0x35df49)]);_0x823444['on'](_0x8f37('0x10b'),function(){_0xbd8908=!![];return _0x3d5e6a['status'](0xc8)[_0x8f37('0x16')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x823444[_0x8f37('0xfd')]});});_0x823444['on']('exit',function(_0x5acb0a){if(_0x5acb0a&&!_0xbd8908){return _0x3d5e6a[_0x8f37('0xf')](0x1f4)[_0x8f37('0x16')]({'message':_0x8f37('0x10c'),'pid':_0x823444[_0x8f37('0xfd')]});}});})['catch'](handleError(_0x3d5e6a,null));};exports[_0x8f37('0x10d')]=function(_0x51de0c,_0x5c8c5c,_0x413511){return db['User'][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8f37('0x6e')}})[_0x8f37('0x18')](function(_0x36eb7f){var _0x3d933c=![];if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x74')]){throw new Error(_0x8f37('0xed'));}if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x106')][_0x8f37('0xca')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x106')]['firstName']){throw new Error(_0x8f37('0xf4'));}if(!_0x51de0c[_0x8f37('0x8f')]['socket_timestamp']){throw new Error(_0x8f37('0x108'));}var _0x4a7617=require(_0x8f37('0xf8'))['fork'](path[_0x8f37('0x93')](__dirname,'../../components/import/cm/csvUpdates'),[_0x51de0c[_0x8f37('0x85')]['id'],JSON[_0x8f37('0x10a')](_0x51de0c[_0x8f37('0x8f')]),JSON['stringify'](_0x36eb7f)]);_0x4a7617['on']('message',function(_0x549eba){_0x3d933c=!![];return _0x5c8c5c[_0x8f37('0xf')](0xc8)[_0x8f37('0x16')]({'message':_0x8f37('0x10e'),'pid':_0x4a7617[_0x8f37('0xfd')]});});_0x4a7617['on'](_0x8f37('0x10f'),function(_0x230c85){if(_0x230c85&&!_0x3d933c){return _0x5c8c5c[_0x8f37('0xf')](0x1f4)[_0x8f37('0x16')]({'message':_0x8f37('0x10c'),'pid':_0x4a7617[_0x8f37('0xfd')]});}});})[_0x8f37('0x86')](handleError(_0x5c8c5c,null));};exports['getJourney']=function(_0x40ea5b,_0x1af941){var _0x35b8ee=[_0x8f37('0x110'),_0x8f37('0x111'),_0x8f37('0x112'),_0x8f37('0x113'),'fax','whatsapp',_0x8f37('0x114')];var _0x1010e9={'offset':0x0,'order':qs[_0x8f37('0x32')]('-createdAt')},_0x584379={'count':0x0,'rows':[]};Promise[_0x8f37('0x6c')]()[_0x8f37('0x18')](function(){if(_0x40ea5b['query'][_0x8f37('0x115')]){if(!_['includes'](_0x35b8ee,_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x115')][_0x8f37('0x116')]())){throw new Error('Invalid\x20channel');}_0x35b8ee=[_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x115')][_0x8f37('0x116')]()];}if(_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x117')]){try{var _0x3421b7=JSON[_0x8f37('0x103')](_0x40ea5b[_0x8f37('0x2c')]['range']);if(!moment(_0x3421b7['from'])['isValid']()){throw new Error(_0x8f37('0x118'));}if(!moment(_0x3421b7['to'])[_0x8f37('0x119')]()){throw new Error(_0x8f37('0x11a'));}}catch(_0x3be0d3){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x1010e9[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x40ea5b['query']['limit']||0xa);_0x1010e9[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x13')]);}var _0x5c358d=_0x35b8ee[_0x8f37('0x73')](function(_0x3d30b6){if(_0x3d30b6===_0x8f37('0x114')){var _0x25aad4={'attributes':['id',_0x8f37('0x11b'),_0x8f37('0x2a'),_0x8f37('0x11c'),'destination','callerid',_0x8f37('0x11d'),_0x8f37('0x11e'),_0x8f37('0x11f'),_0x8f37('0x120'),_0x8f37('0x121'),_0x8f37('0x122'),'userSecondDisposition','userThirdDisposition',_0x8f37('0x123')],'where':{'ContactId':_0x40ea5b[_0x8f37('0x85')]['id']},'include':[{'model':db[_0x8f37('0x70')],'as':_0x8f37('0x70'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x124'),_0x8f37('0x8c')]}],'order':[[_0x8f37('0x121'),_0x8f37('0x69')]]};if(_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x117')]){_0x25aad4[_0x8f37('0x33')][_0x8f37('0x121')]={'$gte':_0x3421b7[_0x8f37('0x39')],'$lte':_0x3421b7['to']};}return db[_0x8f37('0xa6')][_0x8f37('0x125')](_0x25aad4)[_0x8f37('0x18')](function(_0x5b408c){_0x584379[_0x8f37('0x12')]+=_0x5b408c[_0x8f37('0x12')];return _[_0x8f37('0x73')](_0x5b408c[_0x8f37('0x84')],function(_0x20c732){var _0x273c91=_0x20c732['get']({'plain':!![]});_0x273c91[_0x8f37('0x115')]=_0x3d30b6;if(_0x273c91[_0x8f37('0x70')]){_0x273c91['User']={'id':_0x273c91[_0x8f37('0x70')]['id'],'name':_0x273c91[_0x8f37('0x70')][_0x8f37('0x1d')],'fullname':_0x273c91[_0x8f37('0x70')][_0x8f37('0x124')],'alias':_0x273c91['User'][_0x8f37('0x8c')]};}return _0x273c91;});});}else{var _0x2e46cc=_[_0x8f37('0x126')](_0x3d30b6)+(_0x3d30b6==='chat'?_0x8f37('0x127'):'Account');var _0x4d1afa={'attributes':['id','closed',_0x8f37('0x128'),_0x8f37('0x121'),_0x8f37('0x120'),_0x8f37('0x129'),'secondDisposition',_0x8f37('0x12a'),_0x8f37('0x123'),_0x2e46cc+'Id'],'where':{'ContactId':_0x40ea5b['params']['id']},'include':[{'model':db[_0x2e46cc],'as':_0x8f37('0x12b'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x12c')]},{'model':db[_0x8f37('0x70')],'as':_0x8f37('0x12d'),'attributes':['id',_0x8f37('0x1d'),'fullname']},{'model':db[_0x8f37('0xbd')],'as':_0x8f37('0x83'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x36')],'through':{'attributes':[]}}],'order':[['createdAt',_0x8f37('0x69')]]};if(_0x40ea5b['query'][_0x8f37('0x117')]){_0x4d1afa[_0x8f37('0x33')][_0x8f37('0x121')]={'$gte':_0x3421b7['from'],'$lte':_0x3421b7['to']};}switch(_0x3d30b6){case _0x8f37('0x111'):_0x4d1afa[_0x8f37('0x2e')][_0x8f37('0x24')](_0x8f37('0x12e'),_0x8f37('0x12f'),_0x8f37('0x130'),'deviceModel',_0x8f37('0x131'),_0x8f37('0x132'),_0x8f37('0x133'),_0x8f37('0x134'),_0x8f37('0x135'));break;case _0x8f37('0x110'):_0x4d1afa[_0x8f37('0x2e')]['push'](_0x8f37('0x136'),'substatus');break;case _0x8f37('0x113'):_0x4d1afa[_0x8f37('0x2e')][_0x8f37('0x24')](_0x8f37('0x137'),_0x8f37('0x138'));break;}return db[_[_0x8f37('0x126')](_0x3d30b6)+_0x8f37('0x139')]['findAndCountAll'](_0x4d1afa)['then'](function(_0x559b8c){_0x584379[_0x8f37('0x12')]+=_0x559b8c['count'];return _[_0x8f37('0x73')](_0x559b8c[_0x8f37('0x84')],function(_0x3d2c55){var _0x3282ed=_0x3d2c55[_0x8f37('0x90')]({'plain':!![]});_0x3282ed['channel']=_0x3d30b6;if(_0x3282ed[_0x8f37('0x12d')]){_0x3282ed['Owner']={'id':_0x3282ed['Owner']['id'],'name':_0x3282ed[_0x8f37('0x12d')][_0x8f37('0x1d')],'fullname':_0x3282ed['Owner'][_0x8f37('0x124')]};}return _0x3282ed;});});}});return Promise[_0x8f37('0xbb')](_0x5c358d);})[_0x8f37('0x18')](function(_0x221831){return _(_0x221831)[_0x8f37('0x13a')]()[_0x8f37('0x13b')](_0x8f37('0x121'))[_0x8f37('0x13c')]()['value']();})[_0x8f37('0x18')](function(_0xb0d5bc){_0x584379[_0x8f37('0x84')]=_0x1010e9['limit']?_0xb0d5bc['slice'](_0x1010e9[_0x8f37('0x13')],_0x1010e9[_0x8f37('0x13')]+_0x1010e9['limit']):_0xb0d5bc;return _0x584379;})[_0x8f37('0x18')](respondWithFilteredResult(_0x1af941,_0x1010e9))[_0x8f37('0x86')](handleError(_0x1af941,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 5274de8..be38cf8 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 _0xaf9c=['hasOwnProperty','events','../../mysqldb','update','remove','emit'];(function(_0x2cede3,_0x40a124){var _0x2f40f7=function(_0x1cdc0a){while(--_0x1cdc0a){_0x2cede3['push'](_0x2cede3['shift']());}};_0x2f40f7(++_0x40a124);}(_0xaf9c,0x199));var _0xcaf9=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0xaf9c[_0x540dcb];return _0x49353c;};'use strict';var EventEmitter=require(_0xcaf9('0x0'));var CmContact=require(_0xcaf9('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaf9('0x2'),'afterDestroy':_0xcaf9('0x3')};function emitEvent(_0x4f3b13){return function(_0x128ffc,_0x340f48,_0x33e909){CmContactEvents[_0xcaf9('0x4')](_0x4f3b13+':'+_0x128ffc['id'],_0x128ffc);CmContactEvents[_0xcaf9('0x4')](_0x4f3b13,_0x128ffc);_0x33e909(null);};}for(var e in events){if(events[_0xcaf9('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x9fd2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','CmContact'];(function(_0x4f47eb,_0x245b17){var _0x140dd5=function(_0x1c9669){while(--_0x1c9669){_0x4f47eb['push'](_0x4f47eb['shift']());}};_0x140dd5(++_0x245b17);}(_0x9fd2,0x15d));var _0x29fd=function(_0x458e55,_0xab3d13){_0x458e55=_0x458e55-0x0;var _0xdaed4c=_0x9fd2[_0x458e55];return _0xdaed4c;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x29fd('0x0'))['db'][_0x29fd('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x29fd('0x2')](0x0);var events={'afterCreate':_0x29fd('0x3'),'afterUpdate':_0x29fd('0x4'),'afterDestroy':_0x29fd('0x5')};function emitEvent(_0x5d786c){return function(_0x530869,_0x28ee5d,_0x32cda6){CmContactEvents[_0x29fd('0x6')](_0x5d786c+':'+_0x530869['id'],_0x530869);CmContactEvents[_0x29fd('0x6')](_0x5d786c,_0x530869);_0x32cda6(null);};}for(var e in events){if(events[_0x29fd('0x7')](e)){var event=events[e];CmContact[_0x29fd('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 90593d2..fc5250c 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 _0x8c98=['cmContact,\x20%s,\x20%s','models','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','format','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','message'];(function(_0x38b539,_0x2589f6){var _0x36425e=function(_0x1f984a){while(--_0x1f984a){_0x38b539['push'](_0x38b539['shift']());}};_0x36425e(++_0x2589f6);}(_0x8c98,0xe3));var _0x88c9=function(_0x1062f4,_0x200b41){_0x1062f4=_0x1062f4-0x0;var _0x3b26c2=_0x8c98[_0x1062f4];return _0x3b26c2;};'use strict';var _=require(_0x88c9('0x0'));var util=require(_0x88c9('0x1'));var logger=require(_0x88c9('0x2'))(_0x88c9('0x3'));var moment=require('moment');var BPromise=require(_0x88c9('0x4'));var rp=require(_0x88c9('0x5'));var fs=require('fs');var path=require(_0x88c9('0x6'));var rimraf=require(_0x88c9('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x88c9('0x8'));module[_0x88c9('0x9')]=function(_0x250e20,_0x1cda94){return _0x250e20['define'](_0x88c9('0xa'),attributes,{'tableName':_0x88c9('0xb'),'paranoid':!![],'indexes':[{'name':_0x88c9('0xc'),'fields':['phone']},{'name':_0x88c9('0xd'),'fields':[_0x88c9('0xe'),_0x88c9('0xf'),_0x88c9('0xc'),_0x88c9('0x10'),_0x88c9('0x11'),_0x88c9('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x88c9('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x1740cd,_0x23a525,_0x52c0aa){var _0x5187c3=_0x250e20['models'];var _0x509cd2=_0x1740cd[_0x88c9('0x14')]({'plain':!![]});function _0x570c4c(){return function(_0x2c0515){logger[_0x88c9('0x15')](_0x88c9('0x16'),_0x88c9('0x17'),util[_0x88c9('0x18')](_0x2c0515,{'showHidden':![],'depth':null}));};}function _0x9dc8fa(_0x13a37b,_0x1aa5ea){var _0x1cbe12=_0x1aa5ea[_0x88c9('0x19')]?_0x1aa5ea[_0x88c9('0x19')]:moment()['format'](_0x88c9('0x1a'));return new BPromise(function(_0x143b95,_0x3bd52f){if(_[_0x88c9('0x1b')](_0x1aa5ea[_0x88c9('0x1c')])){_0x143b95({'ret':_0x1cbe12});}else{_0x5187c3[_0x88c9('0x1d')][_0x88c9('0x1e')]({'where':{'id':_0x13a37b['id']}})[_0x88c9('0x1f')](function(_0x5e1d8a){if(!_[_0x88c9('0x1b')](_0x5e1d8a)){var _0x5d0f62=_0x5e1d8a['dialTimezone'];if(!_[_0x88c9('0x1b')](_0x5d0f62)){var _0x23d5e4=shared[_0x88c9('0x20')];var _0x18ded5=_0x23d5e4[_0x5d0f62];var _0x4bba53=_0x23d5e4[_0x1aa5ea['dialTimezone']];if(!_[_0x88c9('0x1b')](_0x18ded5)&&!_[_0x88c9('0x1b')](_0x4bba53)){var _0x4eb9bc=_0x18ded5[_0x88c9('0x21')]-_0x4bba53[_0x88c9('0x21')];_0x1cbe12=_0x1aa5ea['scheduledat']?_0x1aa5ea['scheduledat']:moment();var _0x2a3247=moment(_0x1cbe12)['add'](_0x4eb9bc,'minutes');_0x143b95({'ret':_0x2a3247[_0x88c9('0x22')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x143b95({'ret':_0x1cbe12});}else _0x143b95({'ret':_0x1cbe12});}else{_0x143b95({'ret':_0x1cbe12});}});}});return 0xa;}var _0x2746db=function(_0x5c74f4){return new BPromise(function(_0x2867d4,_0x3ac121){_0x9dc8fa(_0x5c74f4,_0x509cd2)[_0x88c9('0x1f')](function(_0x4b58bf){_0x509cd2['scheduledat']=_0x4b58bf[_0x88c9('0x23')];_0x5187c3[_0x88c9('0x24')][_0x88c9('0x1e')]({'where':{'phone':_0x509cd2[_0x88c9('0xc')],'VoiceQueueId':_0x5c74f4['id']}})[_0x88c9('0x1f')](function(_0x54efcc){if(!_[_0x88c9('0x1b')](_0x54efcc)){throw new Error(_0x88c9('0x25')+_0x509cd2[_0x88c9('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5c74f4['id']);}return _0x5187c3[_0x88c9('0x24')][_0x88c9('0x26')]({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'priority':_0x509cd2[_0x88c9('0x28')]?_0x509cd2[_0x88c9('0x28')]:0x2,'scheduledat':_0x509cd2[_0x88c9('0x19')]?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a')),'callback':_0x509cd2[_0x88c9('0x29')]?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2[_0x88c9('0x29')]:undefined,'callbackat':_0x509cd2[_0x88c9('0x29')]?moment()['format'](_0x88c9('0x1a')):undefined,'VoiceQueueId':_0x5c74f4['id']});})['catch'](function(_0x54726f){_0x3ac121(_0x54726f);});});});};var _0x52a22d=function(_0x1a037e){return new BPromise(function(_0x1ae012,_0x582acc){_0x9dc8fa(_0x1a037e,_0x509cd2)[_0x88c9('0x1f')](function(_0x125333){_0x509cd2[_0x88c9('0x19')]=_0x125333[_0x88c9('0x23')];_0x5187c3['CmHopper'][_0x88c9('0x1e')]({'where':{'phone':_0x509cd2[_0x88c9('0xc')],'VoiceQueueId':_0x1a037e['id']}})[_0x88c9('0x1f')](function(_0x25681a){if(!_[_0x88c9('0x1b')](_0x25681a)){throw new Error(_0x88c9('0x25')+_0x509cd2['phone']+_0x88c9('0x2a')+_0x1a037e['id']);}return _0x5187c3['CmHopperFinal'][_0x88c9('0x1e')]({'where':{'calleridnum':_0x509cd2[_0x88c9('0xc')],'VoiceQueueId':_0x1a037e['id']}});})['then'](function(_0x397fa8){if(!_['isNil'](_0x397fa8)){throw new Error(_0x88c9('0x2b')+_0x509cd2['phone']+_0x88c9('0x2c')+_0x1a037e['id']);}return _0x5187c3[_0x88c9('0x24')][_0x88c9('0x26')]({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'priority':_0x509cd2[_0x88c9('0x28')]?_0x509cd2[_0x88c9('0x28')]:0x2,'scheduledat':_0x509cd2[_0x88c9('0x19')]?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a')),'callback':_0x509cd2[_0x88c9('0x29')]?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2[_0x88c9('0x29')]:undefined,'callbackat':_0x509cd2['callbackUniqueid']?moment()[_0x88c9('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1a037e['id']});})[_0x88c9('0x2d')](function(_0x31f093){_0x582acc(_0x31f093);});});});};function _0x301e74(){return function(_0x4faa72){logger[_0x88c9('0x15')]('cmContact',_0x88c9('0x17'),util['inspect'](_0x4faa72,{'showHidden':![],'depth':null}));};}function _0x3914cc(_0x352372,_0x5c15bd){var _0x34fc20=_0x5c15bd['scheduledat']?_0x5c15bd[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a'));return new BPromise(function(_0x4906cc,_0x646b2){if(_[_0x88c9('0x1b')](_0x5c15bd[_0x88c9('0x1c')])){_0x4906cc({'ret':_0x34fc20});}else{_0x5187c3['Campaign'][_0x88c9('0x1e')]({'where':{'id':_0x352372['id']}})[_0x88c9('0x1f')](function(_0x2f43ae){if(!_['isNil'](_0x2f43ae)){var _0x187f42=_0x2f43ae[_0x88c9('0x1c')];if(!_['isNil'](_0x187f42)){var _0x3facf1=shared['timezones'];var _0x2818a1=_0x3facf1[_0x187f42];var _0x5d7d41=_0x3facf1[_0x5c15bd[_0x88c9('0x1c')]];if(!_['isNil'](_0x2818a1)&&!_[_0x88c9('0x1b')](_0x5d7d41)){var _0x168e3a=_0x2818a1['utcOffset']-_0x5d7d41[_0x88c9('0x21')];_0x34fc20=_0x5c15bd[_0x88c9('0x19')]?_0x5c15bd[_0x88c9('0x19')]:moment();var _0x78b0d9=moment(_0x34fc20)[_0x88c9('0x2e')](_0x168e3a,'minutes');_0x4906cc({'ret':_0x78b0d9[_0x88c9('0x22')](_0x88c9('0x1a'))});}else _0x4906cc({'ret':_0x34fc20});}else _0x4906cc({'ret':_0x34fc20});}else{_0x4906cc({'ret':_0x34fc20});}});}});return 0xa;}var _0x20879a=function(_0x1cbcda){return new BPromise(function(_0x4cb3e0,_0x438602){_0x3914cc(_0x1cbcda,_0x509cd2)[_0x88c9('0x1f')](function(_0x3e561a){_0x509cd2[_0x88c9('0x19')]=_0x3e561a['ret'];_0x5187c3[_0x88c9('0x24')][_0x88c9('0x1e')]({'where':{'phone':_0x509cd2[_0x88c9('0xc')],'CampaignId':_0x1cbcda['id']}})[_0x88c9('0x1f')](function(_0x337027){if(!_[_0x88c9('0x1b')](_0x337027)){throw new Error(_0x88c9('0x25')+_0x509cd2[_0x88c9('0xc')]+_0x88c9('0x2f')+_0x1cbcda['id']);}return _0x5187c3[_0x88c9('0x24')]['create']({'phone':_0x509cd2['phone'],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'priority':_0x509cd2[_0x88c9('0x28')]?_0x509cd2[_0x88c9('0x28')]:0x2,'scheduledat':_0x509cd2[_0x88c9('0x19')]?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a')),'callback':_0x509cd2[_0x88c9('0x29')]?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2[_0x88c9('0x29')]:undefined,'callbackat':_0x509cd2['callbackUniqueid']?moment()[_0x88c9('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1cbcda['id']});})['catch'](function(_0x47a861){_0x438602(_0x47a861);});});});};var _0x2e4f8c=function(_0x5a02d0){return new BPromise(function(_0x3b7a6b,_0x9b2c2d){_0x3914cc(_0x5a02d0,_0x509cd2)[_0x88c9('0x1f')](function(_0x7b2ee7){_0x509cd2[_0x88c9('0x19')]=_0x7b2ee7[_0x88c9('0x23')];_0x5187c3[_0x88c9('0x24')][_0x88c9('0x1e')]({'where':{'phone':_0x509cd2[_0x88c9('0xc')],'CampaignId':_0x5a02d0['id']}})[_0x88c9('0x1f')](function(_0x1be3d8){if(!_[_0x88c9('0x1b')](_0x1be3d8)){throw new Error(_0x88c9('0x25')+_0x509cd2['phone']+_0x88c9('0x30')+_0x5a02d0['id']);}return _0x5187c3['CmHopperFinal'][_0x88c9('0x1e')]({'where':{'calleridnum':_0x509cd2[_0x88c9('0xc')],'CampaignId':_0x5a02d0['id']}});})['then'](function(_0x3de2db){if(!_[_0x88c9('0x1b')](_0x3de2db)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x509cd2[_0x88c9('0xc')]+_0x88c9('0x31')+_0x5a02d0['id']);}return _0x5187c3[_0x88c9('0x24')]['create']({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'priority':_0x509cd2['priority']?_0x509cd2[_0x88c9('0x28')]:0x2,'scheduledat':_0x509cd2['scheduledat']?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x509cd2[_0x88c9('0x29')]?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2['callbackUniqueid']:undefined,'callbackat':_0x509cd2[_0x88c9('0x29')]?moment()[_0x88c9('0x22')](_0x88c9('0x1a')):undefined,'CampaignId':_0x5a02d0['id']});})[_0x88c9('0x2d')](function(_0x801aa1){_0x9b2c2d(_0x801aa1);});});});};if(_0x509cd2[_0x88c9('0x27')]){_0x5187c3[_0x88c9('0x1d')][_0x88c9('0x32')]({'where':{'type':_0x88c9('0x33')},'attributes':['id',_0x88c9('0x34'),_0x88c9('0x1c')],'include':[{'model':_0x5187c3[_0x88c9('0x35')],'as':_0x88c9('0x36'),'where':{'id':_0x509cd2['ListId']}}]})[_0x88c9('0x1f')](function(_0x372273){if(_0x372273){var _0x166011=[];for(var _0x5ae9d6=0x0,_0x304904;_0x5ae9d6<_0x372273[_0x88c9('0x37')];_0x5ae9d6+=0x1){_0x304904=_0x372273[_0x5ae9d6][_0x88c9('0x14')]({'plain':!![]});switch(_0x304904['dialCheckDuplicateType']){case _0x88c9('0x38'):_0x52a22d(_0x304904)['catch'](_0x570c4c());break;case _0x88c9('0x39'):_0x2746db(_0x304904)[_0x88c9('0x2d')](_0x570c4c());break;default:_0x3914cc(_0x304904,_0x509cd2)[_0x88c9('0x1f')](function(_0x28594a){_0x509cd2[_0x88c9('0x19')]=_0x28594a['ret'];_0x5187c3[_0x88c9('0x24')][_0x88c9('0x26')]({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'scheduledat':_0x509cd2[_0x88c9('0x19')]?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a')),'priority':_0x509cd2[_0x88c9('0x28')]?_0x509cd2[_0x88c9('0x28')]:0x2,'callback':_0x509cd2['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2[_0x88c9('0x29')]:undefined,'callbackat':_0x509cd2[_0x88c9('0x29')]?moment()['format'](_0x88c9('0x1a')):undefined,'VoiceQueueId':_0x304904['id']})[_0x88c9('0x2d')](_0x570c4c());});}}}})[_0x88c9('0x1f')](function(){return _0x5187c3['VoiceQueue'][_0x88c9('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5187c3['CmList'],'as':_0x88c9('0x3a'),'where':{'id':_0x509cd2[_0x88c9('0x27')]}}]})['then'](function(_0x16df64){if(_0x16df64){var _0xcd9b1a=[];for(var _0x575984=0x0,_0x586f1d;_0x575984<_0x16df64['length'];_0x575984+=0x1){_0x586f1d=_0x16df64[_0x575984][_0x88c9('0x14')]({'plain':!![]});_0x5187c3[_0x88c9('0x3b')][_0x88c9('0x26')]({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2['ListId'],'VoiceQueueId':_0x586f1d['id']})[_0x88c9('0x2d')](function(_0x37cd51){logger[_0x88c9('0x15')]('cmContact,\x20%s,\x20%s',_0x88c9('0x17'),_0x37cd51[_0x88c9('0x3c')]);});}}});})['then'](function(){return _0x5187c3['Campaign'][_0x88c9('0x32')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x5187c3['CmList'],'as':_0x88c9('0x36'),'where':{'id':_0x509cd2['ListId']}}]})['then'](function(_0x25d658){if(_0x25d658){var _0x71d03=[];for(var _0x3dee25=0x0,_0x3ba70c;_0x3dee25<_0x25d658[_0x88c9('0x37')];_0x3dee25+=0x1){_0x3ba70c=_0x25d658[_0x3dee25][_0x88c9('0x14')]({'plain':!![]});switch(_0x3ba70c[_0x88c9('0x34')]){case _0x88c9('0x38'):_0x2e4f8c(_0x3ba70c)[_0x88c9('0x2d')](_0x301e74());break;case _0x88c9('0x39'):_0x20879a(_0x3ba70c)[_0x88c9('0x2d')](_0x301e74());break;default:_0x5187c3[_0x88c9('0x24')]['create']({'phone':_0x509cd2['phone'],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'scheduledat':_0x509cd2['scheduledat']?_0x509cd2[_0x88c9('0x19')]:moment()[_0x88c9('0x22')](_0x88c9('0x1a')),'priority':_0x509cd2[_0x88c9('0x28')]?_0x509cd2[_0x88c9('0x28')]:0x2,'callback':_0x509cd2[_0x88c9('0x29')]?!![]:![],'callbackuniqueid':_0x509cd2[_0x88c9('0x29')]?_0x509cd2[_0x88c9('0x29')]:undefined,'callbackat':_0x509cd2['callbackUniqueid']?moment()[_0x88c9('0x22')](_0x88c9('0x1a')):undefined,'CampaignId':_0x3ba70c['id']})[_0x88c9('0x2d')](_0x301e74());}}}});})[_0x88c9('0x1f')](function(){return _0x5187c3['Campaign'][_0x88c9('0x32')]({'attributes':['id'],'include':[{'model':_0x5187c3[_0x88c9('0x35')],'as':_0x88c9('0x3a'),'where':{'id':_0x509cd2[_0x88c9('0x27')]}}]})[_0x88c9('0x1f')](function(_0x337916){if(_0x337916){var _0x36174c=[];for(var _0x1e7899=0x0,_0x1b503d;_0x1e7899<_0x337916['length'];_0x1e7899+=0x1){_0x1b503d=_0x337916[_0x1e7899]['get']({'plain':!![]});_0x5187c3[_0x88c9('0x3b')][_0x88c9('0x26')]({'phone':_0x509cd2[_0x88c9('0xc')],'ContactId':_0x509cd2['id'],'ListId':_0x509cd2[_0x88c9('0x27')],'CampaignId':_0x1b503d['id']})[_0x88c9('0x2d')](function(_0x5c0abd){logger[_0x88c9('0x15')](_0x88c9('0x3d'),_0x88c9('0x17'),_0x5c0abd[_0x88c9('0x3c')]);});}}});})[_0x88c9('0x1f')](function(){_0x52c0aa();})[_0x88c9('0x2d')](function(_0xab8b2){logger[_0x88c9('0x15')](_0x88c9('0x3d'),_0x88c9('0x17'),_0xab8b2[_0x88c9('0x3c')]);_0x52c0aa(_0xab8b2);});}else{_0x52c0aa(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x1d0025,_0x341672,_0xf37f58){var _0x19849e=_0x250e20[_0x88c9('0x3e')];var _0x269cd4=_0x1d0025['get']({'plain':!![]});return _0x19849e[_0x88c9('0x24')][_0x88c9('0x32')]({'raw':!![],'where':{'ListId':_0x269cd4['ListId'],'ContactId':_0x269cd4['id']}})[_0x88c9('0x1f')](function(_0xcb0e91){if(!_['isEmpty'](_0xcb0e91)){var _0x3ed926=[];for(var _0x137358=0x0;_0x137358<_0xcb0e91[_0x88c9('0x37')];_0x137358+=0x1){var _0x1832b0=_0x19849e[_0x88c9('0x24')][_0x88c9('0x3f')]({'where':{'ListId':_0xcb0e91[_0x137358]['ListId'],'ContactId':_0xcb0e91[_0x137358][_0x88c9('0x40')],'VoiceQueueId':_0xcb0e91[_0x137358][_0x88c9('0x41')],'CampaignId':_0xcb0e91[_0x137358][_0x88c9('0x42')]}});_0x3ed926[_0x88c9('0x43')](_0x1832b0);}return BPromise[_0x88c9('0x44')](_0x3ed926);}})[_0x88c9('0x1f')](function(_0x515313){logger[_0x88c9('0x45')](_0x88c9('0x46'),util[_0x88c9('0x18')](_0x515313,{'showHidden':![],'depth':null}));_0xf37f58();})['catch'](function(_0x535617){logger['error'](_0x88c9('0x47'),util[_0x88c9('0x18')](_0x535617,{'showHidden':![],'depth':null}));_0xf37f58(_0x535617);});}}});}; \ No newline at end of file +var _0x9f01=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','CmContact','phone','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','\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','create','catch','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','VoiceQueue','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9f01,0x123));var _0x19f0=function(_0x5d6993,_0x29374c){_0x5d6993=_0x5d6993-0x0;var _0x2f32e3=_0x9f01[_0x5d6993];return _0x2f32e3;};'use strict';var _=require(_0x19f0('0x0'));var util=require(_0x19f0('0x1'));var logger=require(_0x19f0('0x2'))(_0x19f0('0x3'));var moment=require(_0x19f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x19f0('0x5'));var fs=require('fs');var path=require(_0x19f0('0x6'));var rimraf=require('rimraf');var config=require(_0x19f0('0x7'));var shared=require(_0x19f0('0x8'));var attributes=require('./cmContact.attributes');module[_0x19f0('0x9')]=function(_0x355b42,_0x1ef90b){return _0x355b42[_0x19f0('0xa')](_0x19f0('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x19f0('0xc')]},{'name':'fti_cm_contacts','fields':['firstName',_0x19f0('0xd'),_0x19f0('0xc'),_0x19f0('0xe'),_0x19f0('0xf'),'email'],'type':_0x19f0('0x10')}],'timestamps':!![],'charset':_0x19f0('0x11'),'collate':_0x19f0('0x12'),'hooks':{'afterCreate':function(_0x14eac7,_0x53dffd,_0x39655f){var _0x5b53d1=_0x355b42[_0x19f0('0x13')];var _0x4ca327=_0x14eac7[_0x19f0('0x14')]({'plain':!![]});function _0x2a4721(){return function(_0x1d7119){logger[_0x19f0('0x15')](_0x19f0('0x16'),_0x19f0('0x17'),util[_0x19f0('0x18')](_0x1d7119,{'showHidden':![],'depth':null}));};}function _0x38dfa4(_0x3f4954,_0x1faa66){var _0x4c49dc=_0x1faa66[_0x19f0('0x19')]?_0x1faa66[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x56aaa6,_0x2514cf){if(_[_0x19f0('0x1b')](_0x1faa66[_0x19f0('0x1c')])){_0x56aaa6({'ret':_0x4c49dc});}else{_0x5b53d1['VoiceQueue'][_0x19f0('0x1d')]({'where':{'id':_0x3f4954['id']}})[_0x19f0('0x1e')](function(_0x2a0e5e){if(!_[_0x19f0('0x1b')](_0x2a0e5e)){var _0x204e59=_0x2a0e5e[_0x19f0('0x1c')];if(!_[_0x19f0('0x1b')](_0x204e59)){var _0x4439a7=shared[_0x19f0('0x1f')];var _0x43174d=_0x4439a7[_0x204e59];var _0x348fa0=_0x4439a7[_0x1faa66[_0x19f0('0x1c')]];if(!_[_0x19f0('0x1b')](_0x43174d)&&!_[_0x19f0('0x1b')](_0x348fa0)){var _0x304633=_0x43174d[_0x19f0('0x20')]-_0x348fa0[_0x19f0('0x20')];_0x4c49dc=_0x1faa66[_0x19f0('0x19')]?_0x1faa66[_0x19f0('0x19')]:moment();var _0x1e049c=moment(_0x4c49dc)[_0x19f0('0x21')](_0x304633,_0x19f0('0x22'));_0x56aaa6({'ret':_0x1e049c['format'](_0x19f0('0x23'))});}else _0x56aaa6({'ret':_0x4c49dc});}else _0x56aaa6({'ret':_0x4c49dc});}else{_0x56aaa6({'ret':_0x4c49dc});}});}});return 0xa;}var _0x118895=function(_0xea070f){return new BPromise(function(_0x575976,_0x19d37b){_0x38dfa4(_0xea070f,_0x4ca327)[_0x19f0('0x1e')](function(_0x1e619c){_0x4ca327[_0x19f0('0x19')]=_0x1e619c[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327['phone'],'VoiceQueueId':_0xea070f['id']}})[_0x19f0('0x1e')](function(_0x307c9f){if(!_[_0x19f0('0x1b')](_0x307c9f)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xea070f['id']);}return _0x5b53d1[_0x19f0('0x25')]['create']({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327['priority']:0x2,'scheduledat':_0x4ca327['scheduledat']?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327['callbackUniqueid']?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0xea070f['id']});})['catch'](function(_0x14b3c5){_0x19d37b(_0x14b3c5);});});});};var _0x1b2198=function(_0x2aee1d){return new BPromise(function(_0x5550a0,_0x43a1d8){_0x38dfa4(_0x2aee1d,_0x4ca327)[_0x19f0('0x1e')](function(_0xd94966){_0x4ca327['scheduledat']=_0xd94966[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327[_0x19f0('0xc')],'VoiceQueueId':_0x2aee1d['id']}})['then'](function(_0x224d21){if(!_[_0x19f0('0x1b')](_0x224d21)){throw new Error(_0x19f0('0x26')+_0x4ca327['phone']+_0x19f0('0x2a')+_0x2aee1d['id']);}return _0x5b53d1[_0x19f0('0x2b')][_0x19f0('0x1d')]({'where':{'calleridnum':_0x4ca327[_0x19f0('0xc')],'VoiceQueueId':_0x2aee1d['id']}});})['then'](function(_0x58db36){if(!_['isNil'](_0x58db36)){throw new Error(_0x19f0('0x2c')+_0x4ca327['phone']+_0x19f0('0x2d')+_0x2aee1d['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327['scheduledat']:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0x2aee1d['id']});})[_0x19f0('0x2f')](function(_0x4f0675){_0x43a1d8(_0x4f0675);});});});};function _0x4c2619(){return function(_0x44c56c){logger[_0x19f0('0x15')](_0x19f0('0x16'),_0x19f0('0x17'),util[_0x19f0('0x18')](_0x44c56c,{'showHidden':![],'depth':null}));};}function _0x29649e(_0x74e536,_0x96783f){var _0x333f46=_0x96783f[_0x19f0('0x19')]?_0x96783f[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5528a7,_0x2151c5){if(_[_0x19f0('0x1b')](_0x96783f[_0x19f0('0x1c')])){_0x5528a7({'ret':_0x333f46});}else{_0x5b53d1[_0x19f0('0x30')][_0x19f0('0x1d')]({'where':{'id':_0x74e536['id']}})[_0x19f0('0x1e')](function(_0x39e983){if(!_['isNil'](_0x39e983)){var _0x41e06c=_0x39e983[_0x19f0('0x1c')];if(!_[_0x19f0('0x1b')](_0x41e06c)){var _0x4ca47a=shared[_0x19f0('0x1f')];var _0x4df49e=_0x4ca47a[_0x41e06c];var _0x4b4bf3=_0x4ca47a[_0x96783f[_0x19f0('0x1c')]];if(!_[_0x19f0('0x1b')](_0x4df49e)&&!_[_0x19f0('0x1b')](_0x4b4bf3)){var _0x133516=_0x4df49e[_0x19f0('0x20')]-_0x4b4bf3[_0x19f0('0x20')];_0x333f46=_0x96783f[_0x19f0('0x19')]?_0x96783f[_0x19f0('0x19')]:moment();var _0x35e10d=moment(_0x333f46)[_0x19f0('0x21')](_0x133516,'minutes');_0x5528a7({'ret':_0x35e10d[_0x19f0('0x1a')](_0x19f0('0x23'))});}else _0x5528a7({'ret':_0x333f46});}else _0x5528a7({'ret':_0x333f46});}else{_0x5528a7({'ret':_0x333f46});}});}});return 0xa;}var _0x2e0e11=function(_0x434a95){return new BPromise(function(_0x4a9d6b,_0x1aef72){_0x29649e(_0x434a95,_0x4ca327)[_0x19f0('0x1e')](function(_0x135078){_0x4ca327['scheduledat']=_0x135078[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327[_0x19f0('0xc')],'CampaignId':_0x434a95['id']}})[_0x19f0('0x1e')](function(_0x472c63){if(!_['isNil'](_0x472c63)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x434a95['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327['priority']?_0x4ca327['priority']:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'callback':_0x4ca327['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()['format'](_0x19f0('0x23')):undefined,'CampaignId':_0x434a95['id']});})['catch'](function(_0x463fba){_0x1aef72(_0x463fba);});});});};var _0x129a28=function(_0x4ee0c8){return new BPromise(function(_0x1395cf,_0x2e9bef){_0x29649e(_0x4ee0c8,_0x4ca327)[_0x19f0('0x1e')](function(_0x4edd88){_0x4ca327[_0x19f0('0x19')]=_0x4edd88[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327['phone'],'CampaignId':_0x4ee0c8['id']}})[_0x19f0('0x1e')](function(_0x16e650){if(!_[_0x19f0('0x1b')](_0x16e650)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+_0x19f0('0x31')+_0x4ee0c8['id']);}return _0x5b53d1['CmHopperFinal'][_0x19f0('0x1d')]({'where':{'calleridnum':_0x4ca327[_0x19f0('0xc')],'CampaignId':_0x4ee0c8['id']}});})[_0x19f0('0x1e')](function(_0x49f2d9){if(!_[_0x19f0('0x1b')](_0x49f2d9)){throw new Error(_0x19f0('0x2c')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x4ee0c8['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327['ListId'],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()['format'](_0x19f0('0x23')),'callback':_0x4ca327['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327['callbackUniqueid']:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'CampaignId':_0x4ee0c8['id']});})[_0x19f0('0x2f')](function(_0xd3cc6f){_0x2e9bef(_0xd3cc6f);});});});};if(_0x4ca327[_0x19f0('0x27')]){_0x5b53d1['VoiceQueue'][_0x19f0('0x32')]({'where':{'type':_0x19f0('0x33')},'attributes':['id',_0x19f0('0x34'),'dialTimezone'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x36'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})['then'](function(_0x3aa189){if(_0x3aa189){var _0x2dd31d=[];for(var _0x5d4abf=0x0,_0x553079;_0x5d4abf<_0x3aa189[_0x19f0('0x37')];_0x5d4abf+=0x1){_0x553079=_0x3aa189[_0x5d4abf][_0x19f0('0x14')]({'plain':!![]});switch(_0x553079['dialCheckDuplicateType']){case _0x19f0('0x38'):_0x1b2198(_0x553079)[_0x19f0('0x2f')](_0x2a4721());break;case _0x19f0('0x39'):_0x118895(_0x553079)[_0x19f0('0x2f')](_0x2a4721());break;default:_0x29649e(_0x553079,_0x4ca327)[_0x19f0('0x1e')](function(_0x3badb2){_0x4ca327[_0x19f0('0x19')]=_0x3badb2[_0x19f0('0x24')];_0x5b53d1['CmHopper'][_0x19f0('0x2e')]({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327['ListId'],'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327['scheduledat']:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0x553079['id']})[_0x19f0('0x2f')](_0x2a4721());});}}}})[_0x19f0('0x1e')](function(){return _0x5b53d1[_0x19f0('0x3a')][_0x19f0('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x3b'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x22ca10){if(_0x22ca10){var _0x52a739=[];for(var _0x45cf4b=0x0,_0xea7973;_0x45cf4b<_0x22ca10[_0x19f0('0x37')];_0x45cf4b+=0x1){_0xea7973=_0x22ca10[_0x45cf4b][_0x19f0('0x14')]({'plain':!![]});_0x5b53d1[_0x19f0('0x3c')]['create']({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'VoiceQueueId':_0xea7973['id']})[_0x19f0('0x2f')](function(_0x3c7a7f){logger['error'](_0x19f0('0x3d'),_0x19f0('0x17'),_0x3c7a7f['message']);});}}});})[_0x19f0('0x1e')](function(){return _0x5b53d1[_0x19f0('0x30')][_0x19f0('0x32')]({'attributes':['id',_0x19f0('0x34'),_0x19f0('0x1c')],'include':[{'model':_0x5b53d1['CmList'],'as':_0x19f0('0x36'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x20b4e8){if(_0x20b4e8){var _0x4c5620=[];for(var _0x3f9413=0x0,_0x471613;_0x3f9413<_0x20b4e8[_0x19f0('0x37')];_0x3f9413+=0x1){_0x471613=_0x20b4e8[_0x3f9413][_0x19f0('0x14')]({'plain':!![]});switch(_0x471613[_0x19f0('0x34')]){case'always':_0x129a28(_0x471613)[_0x19f0('0x2f')](_0x4c2619());break;case _0x19f0('0x39'):_0x2e0e11(_0x471613)['catch'](_0x4c2619());break;default:_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327['priority']:0x2,'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'CampaignId':_0x471613['id']})[_0x19f0('0x2f')](_0x4c2619());}}}});})['then'](function(){return _0x5b53d1[_0x19f0('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x3b'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x59af84){if(_0x59af84){var _0xf73f84=[];for(var _0x31c4cd=0x0,_0xd83813;_0x31c4cd<_0x59af84[_0x19f0('0x37')];_0x31c4cd+=0x1){_0xd83813=_0x59af84[_0x31c4cd]['get']({'plain':!![]});_0x5b53d1['CmHopperBlack'][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'CampaignId':_0xd83813['id']})[_0x19f0('0x2f')](function(_0x287493){logger[_0x19f0('0x15')](_0x19f0('0x3d'),'afterCreate',_0x287493['message']);});}}});})['then'](function(){_0x39655f();})['catch'](function(_0x40e2b1){logger[_0x19f0('0x15')]('cmContact,\x20%s,\x20%s',_0x19f0('0x17'),_0x40e2b1[_0x19f0('0x3e')]);_0x39655f(_0x40e2b1);});}else{_0x39655f(new Error(_0x19f0('0x3f')));}},'afterDestroy':function(_0x413a73,_0xf98803,_0x10be48){var _0x184d0f=_0x355b42['models'];var _0x49bf6a=_0x413a73['get']({'plain':!![]});return _0x184d0f[_0x19f0('0x25')][_0x19f0('0x32')]({'raw':!![],'where':{'ListId':_0x49bf6a[_0x19f0('0x27')],'ContactId':_0x49bf6a['id']}})[_0x19f0('0x1e')](function(_0x48d350){if(!_[_0x19f0('0x40')](_0x48d350)){var _0x13972e=[];for(var _0x5d066b=0x0;_0x5d066b<_0x48d350[_0x19f0('0x37')];_0x5d066b+=0x1){var _0x47e2f0=_0x184d0f[_0x19f0('0x25')][_0x19f0('0x41')]({'where':{'ListId':_0x48d350[_0x5d066b][_0x19f0('0x27')],'ContactId':_0x48d350[_0x5d066b][_0x19f0('0x42')],'VoiceQueueId':_0x48d350[_0x5d066b][_0x19f0('0x43')],'CampaignId':_0x48d350[_0x5d066b]['CampaignId']}});_0x13972e[_0x19f0('0x44')](_0x47e2f0);}return BPromise[_0x19f0('0x45')](_0x13972e);}})[_0x19f0('0x1e')](function(_0x1c0ef3){logger[_0x19f0('0x46')](_0x19f0('0x47'),util[_0x19f0('0x18')](_0x1c0ef3,{'showHidden':![],'depth':null}));_0x10be48();})[_0x19f0('0x2f')](function(_0x2d4543){logger[_0x19f0('0x15')](_0x19f0('0x48'),util[_0x19f0('0x18')](_0x2d4543,{'showHidden':![],'depth':null}));_0x10be48(_0x2d4543);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 98b69f4..08b4cef 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x24ad9c,_0x10ea5b){var _0x2db47b=function(_0x4c27de){while(--_0x4c27de){_0x24ad9c['push'](_0x24ad9c['shift']());}};_0x2db47b(++_0x10ea5b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x549ef1,_0x11fd6b){var _0x34290c=function(_0x1a4859){while(--_0x1a4859){_0x549ef1['push'](_0x549ef1['shift']());}};_0x34290c(++_0x11fd6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 92bb4f5..427a12f 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 _0x5e14=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x5df49f,_0xd84bab){var _0x1bf207=function(_0x1fb9a3){while(--_0x1fb9a3){_0x5df49f['push'](_0x5df49f['shift']());}};_0x1bf207(++_0xd84bab);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module[_0x45e1('0x1')]={'CmContactId':{'type':Sequelize[_0x45e1('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x45e1('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x45e1('0x3')],'defaultValue':_0x45e1('0x4')},'OrderBy':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x45e1('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x0f69=['STRING','INTEGER'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x0f69,0x173));var _0x90f6=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0f69[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x90f6('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x90f6('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x90f6('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x90f6('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x90f6('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 030c24f..0747a6d 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 _0x570a=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','stack','name','index','map','CmContactHasItem','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x306be8,_0x45cadf){var _0x315422=function(_0x5f7465){while(--_0x5f7465){_0x306be8['push'](_0x306be8['shift']());}};_0x315422(++_0x45cadf);}(_0x570a,0x93));var _0xa570=function(_0x504990,_0x541238){_0x504990=_0x504990-0x0;var _0x1f13bf=_0x570a[_0x504990];return _0x1f13bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa570('0x0'));var jsonpatch=require(_0xa570('0x1'));var rp=require(_0xa570('0x2'));var moment=require(_0xa570('0x3'));var BPromise=require(_0xa570('0x4'));var Mustache=require(_0xa570('0x5'));var util=require(_0xa570('0x6'));var path=require(_0xa570('0x7'));var sox=require(_0xa570('0x8'));var csv=require(_0xa570('0x9'));var ejs=require(_0xa570('0xa'));var fs=require('fs');var fs_extra=require(_0xa570('0xb'));var _=require('lodash');var squel=require(_0xa570('0xc'));var crypto=require(_0xa570('0xd'));var jsforce=require(_0xa570('0xe'));var deskjs=require(_0xa570('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa570('0x10'));var Papa=require(_0xa570('0x11'));var Redis=require('ioredis');var authService=require(_0xa570('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa570('0x13'));var hardwareService=require(_0xa570('0x14'));var logger=require(_0xa570('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa570('0x16'));var licenseUtil=require(_0xa570('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3524c5,_0xe96594){_0xe96594=_0xe96594||0xcc;return function(_0x4864f6){if(_0x4864f6){return _0x3524c5['sendStatus'](_0xe96594);}return _0x3524c5[_0xa570('0x18')](_0xe96594)[_0xa570('0x19')]();};}function respondWithResult(_0x1fb5c9,_0x4dee8c){_0x4dee8c=_0x4dee8c||0xc8;return function(_0x4f37e8){if(_0x4f37e8){return _0x1fb5c9[_0xa570('0x18')](_0x4dee8c)[_0xa570('0x1a')](_0x4f37e8);}};}function respondWithFilteredResult(_0x212c9b,_0x1ff00){return function(_0x4a23dd){if(_0x4a23dd){var _0x5674b7=typeof _0x1ff00[_0xa570('0x1b')]===_0xa570('0x1c')&&typeof _0x1ff00[_0xa570('0x1d')]===_0xa570('0x1c');var _0x1f1e8c=_0x4a23dd[_0xa570('0x1e')];var _0x46cd39=_0x5674b7?0x0:_0x1ff00[_0xa570('0x1b')];var _0x3910e3=_0x5674b7?_0x4a23dd[_0xa570('0x1e')]:_0x1ff00[_0xa570('0x1b')]+_0x1ff00[_0xa570('0x1d')];var _0x144439;if(_0x3910e3>=_0x1f1e8c){_0x3910e3=_0x1f1e8c;_0x144439=0xc8;}else{_0x144439=0xce;}_0x212c9b[_0xa570('0x18')](_0x144439);return _0x212c9b['set'](_0xa570('0x1f'),_0x46cd39+'-'+_0x3910e3+'/'+_0x1f1e8c)['json'](_0x4a23dd);}return null;};}function patchUpdates(_0x49ac97){return function(_0x2c5f64){try{jsonpatch[_0xa570('0x20')](_0x2c5f64,_0x49ac97,!![]);}catch(_0x46d4b0){return BPromise['reject'](_0x46d4b0);}return _0x2c5f64['save']();};}function saveUpdates(_0x14e610,_0x118b8f){return function(_0x18bd7c){if(_0x18bd7c){return _0x18bd7c[_0xa570('0x21')](_0x14e610)['then'](function(_0x2507d3){return _0x2507d3;});}return null;};}function removeEntity(_0x33f001,_0x1b35ac){return function(_0x1c8594){if(_0x1c8594){return _0x1c8594[_0xa570('0x22')]()[_0xa570('0x23')](function(){var _0x195cba=_0x1c8594[_0xa570('0x24')]({'plain':!![]});var _0x422f92=_0xa570('0x25');return db[_0xa570('0x26')]['destroy']({'where':{'type':_0x422f92,'resourceId':_0x195cba['id']}})[_0xa570('0x23')](function(){return _0x1c8594;});})['then'](function(){_0x33f001[_0xa570('0x18')](0xcc)[_0xa570('0x19')]();});}};}function handleEntityNotFound(_0x7e357,_0x4f7dbc){return function(_0xab5a09){if(!_0xab5a09){_0x7e357[_0xa570('0x27')](0x194);}return _0xab5a09;};}function handleError(_0x394fc0,_0x317eb1){_0x317eb1=_0x317eb1||0x1f4;return function(_0x14e5da){logger['error'](_0x14e5da[_0xa570('0x28')]);if(_0x14e5da[_0xa570('0x29')]){delete _0x14e5da[_0xa570('0x29')];}_0x394fc0[_0xa570('0x18')](_0x317eb1)['send'](_0x14e5da);};}exports[_0xa570('0x2a')]=function(_0x231788,_0x1d1194){var _0xb91e06={},_0x4b4d69={},_0x59e50d={'count':0x0,'rows':[]};var _0xad0a99=_[_0xa570('0x2b')](db[_0xa570('0x2c')]['rawAttributes'],function(_0x501adc){return{'name':_0x501adc[_0xa570('0x2d')],'type':_0x501adc[_0xa570('0x2e')][_0xa570('0x2f')]};});_0x4b4d69['model']=_[_0xa570('0x2b')](_0xad0a99,'name');_0x4b4d69[_0xa570('0x30')]=_['keys'](_0x231788[_0xa570('0x30')]);_0x4b4d69[_0xa570('0x31')]=_[_0xa570('0x32')](_0x4b4d69[_0xa570('0x33')],_0x4b4d69[_0xa570('0x30')]);_0xb91e06[_0xa570('0x34')]=_[_0xa570('0x32')](_0x4b4d69[_0xa570('0x33')],qs[_0xa570('0x35')](_0x231788[_0xa570('0x30')][_0xa570('0x35')]));_0xb91e06[_0xa570('0x34')]=_0xb91e06[_0xa570('0x34')]['length']?_0xb91e06[_0xa570('0x34')]:_0x4b4d69[_0xa570('0x33')];if(!_0x231788[_0xa570('0x30')]['hasOwnProperty'](_0xa570('0x36'))){_0xb91e06['limit']=qs[_0xa570('0x1d')](_0x231788[_0xa570('0x30')][_0xa570('0x1d')]);_0xb91e06[_0xa570('0x1b')]=qs[_0xa570('0x1b')](_0x231788[_0xa570('0x30')]['offset']);}_0xb91e06[_0xa570('0x37')]=qs[_0xa570('0x38')](_0x231788['query'][_0xa570('0x38')]);_0xb91e06['where']=qs[_0xa570('0x31')](_['pick'](_0x231788[_0xa570('0x30')],_0x4b4d69[_0xa570('0x31')]),_0xad0a99);if(_0x231788[_0xa570('0x30')]['filter']){_0xb91e06[_0xa570('0x39')]=_[_0xa570('0x3a')](_0xb91e06[_0xa570('0x39')],{'$or':_['map'](_0xad0a99,function(_0x340699){if(_0x340699[_0xa570('0x2e')]!=='VIRTUAL'){var _0xed3e85={};_0xed3e85[_0x340699[_0xa570('0x29')]]={'$like':'%'+_0x231788[_0xa570('0x30')]['filter']+'%'};return _0xed3e85;}})});}_0xb91e06=_[_0xa570('0x3a')]({},_0xb91e06,_0x231788['options']);var _0x216af={'where':_0xb91e06[_0xa570('0x39')]};return db[_0xa570('0x2c')]['count'](_0x216af)[_0xa570('0x23')](function(_0x2dd4f1){_0x59e50d[_0xa570('0x1e')]=_0x2dd4f1;if(_0x231788[_0xa570('0x30')][_0xa570('0x3b')]){_0xb91e06[_0xa570('0x3c')]=[{'all':!![]}];}return db[_0xa570('0x2c')][_0xa570('0x3d')](_0xb91e06);})[_0xa570('0x23')](function(_0x156cc0){_0x59e50d['rows']=_0x156cc0;return _0x59e50d;})['then'](respondWithFilteredResult(_0x1d1194,_0xb91e06))[_0xa570('0x3e')](handleError(_0x1d1194,null));};exports[_0xa570('0x3f')]=function(_0x73c5e0,_0x586953){var _0x286104={'raw':!![],'where':{'id':_0x73c5e0[_0xa570('0x40')]['id']}},_0x2d7816={};_0x2d7816['model']=_['keys'](db['CmContactHasItem'][_0xa570('0x41')]);_0x2d7816[_0xa570('0x30')]=_[_0xa570('0x42')](_0x73c5e0['query']);_0x2d7816[_0xa570('0x31')]=_[_0xa570('0x32')](_0x2d7816[_0xa570('0x33')],_0x2d7816[_0xa570('0x30')]);_0x286104[_0xa570('0x34')]=_[_0xa570('0x32')](_0x2d7816['model'],qs[_0xa570('0x35')](_0x73c5e0[_0xa570('0x30')][_0xa570('0x35')]));_0x286104[_0xa570('0x34')]=_0x286104[_0xa570('0x34')][_0xa570('0x43')]?_0x286104[_0xa570('0x34')]:_0x2d7816['model'];if(_0x73c5e0[_0xa570('0x30')][_0xa570('0x3b')]){_0x286104[_0xa570('0x3c')]=[{'all':!![]}];}_0x286104=_[_0xa570('0x3a')]({},_0x286104,_0x73c5e0[_0xa570('0x44')]);return db[_0xa570('0x2c')][_0xa570('0x45')](_0x286104)[_0xa570('0x23')](handleEntityNotFound(_0x586953,null))[_0xa570('0x23')](respondWithResult(_0x586953,null))[_0xa570('0x3e')](handleError(_0x586953,null));};exports['create']=function(_0x308a67,_0x11d4be){return db[_0xa570('0x2c')][_0xa570('0x46')](_0x308a67[_0xa570('0x47')],{})[_0xa570('0x23')](function(_0x4ef58f){var _0x3b7491=_0x308a67[_0xa570('0x48')][_0xa570('0x24')]({'plain':!![]});if(!_0x3b7491)throw new Error(_0xa570('0x49'));if(_0x3b7491[_0xa570('0x4a')]===_0xa570('0x48')){var _0x4132aa=_0x4ef58f[_0xa570('0x24')]({'plain':!![]});var _0x2df3c3=_0xa570('0x25');return db[_0xa570('0x4b')][_0xa570('0x45')]({'where':{'name':_0x2df3c3,'userProfileId':_0x3b7491[_0xa570('0x4c')]},'raw':!![]})[_0xa570('0x23')](function(_0x5d2756){if(_0x5d2756&&_0x5d2756[_0xa570('0x4d')]===0x0){return db[_0xa570('0x26')][_0xa570('0x46')]({'name':_0x4132aa[_0xa570('0x29')],'resourceId':_0x4132aa['id'],'type':_0x5d2756['name'],'sectionId':_0x5d2756['id']},{})[_0xa570('0x23')](function(){return _0x4ef58f;});}else{return _0x4ef58f;}})[_0xa570('0x3e')](function(_0x3d2063){logger[_0xa570('0x4e')](_0xa570('0x4f'),_0x3d2063);throw _0x3d2063;});}return _0x4ef58f;})[_0xa570('0x23')](respondWithResult(_0x11d4be,0xc9))[_0xa570('0x3e')](handleError(_0x11d4be,null));};exports[_0xa570('0x21')]=function(_0x4c1a37,_0x2b08f7){if(_0x4c1a37['body']['id']){delete _0x4c1a37[_0xa570('0x47')]['id'];}return db[_0xa570('0x2c')][_0xa570('0x45')]({'where':{'id':_0x4c1a37[_0xa570('0x40')]['id']}})['then'](handleEntityNotFound(_0x2b08f7,null))[_0xa570('0x23')](saveUpdates(_0x4c1a37[_0xa570('0x47')],null))[_0xa570('0x23')](respondWithResult(_0x2b08f7,null))['catch'](handleError(_0x2b08f7,null));};exports[_0xa570('0x22')]=function(_0x184870,_0x3a28b9){return db['CmContactHasItem']['find']({'where':{'id':_0x184870[_0xa570('0x40')]['id']}})[_0xa570('0x23')](handleEntityNotFound(_0x3a28b9,null))[_0xa570('0x23')](removeEntity(_0x3a28b9,null))[_0xa570('0x3e')](handleError(_0x3a28b9,null));}; \ No newline at end of file +var _0x0b63=['sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','fields','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','update','then','destroy','UserProfileResource','error','stack','name','index','CmContactHasItem','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0b63,0x67));var _0x30b6=function(_0x5d5f14,_0x3f36c7){_0x5d5f14=_0x5d5f14-0x0;var _0x22859c=_0x0b63[_0x5d5f14];return _0x22859c;};'use strict';var emlformat=require(_0x30b6('0x0'));var rimraf=require(_0x30b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30b6('0x2'));var rp=require(_0x30b6('0x3'));var moment=require('moment');var BPromise=require(_0x30b6('0x4'));var Mustache=require(_0x30b6('0x5'));var util=require(_0x30b6('0x6'));var path=require('path');var sox=require(_0x30b6('0x7'));var csv=require(_0x30b6('0x8'));var ejs=require(_0x30b6('0x9'));var fs=require('fs');var fs_extra=require(_0x30b6('0xa'));var _=require(_0x30b6('0xb'));var squel=require(_0x30b6('0xc'));var crypto=require(_0x30b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x30b6('0xe'));var toCsv=require(_0x30b6('0x8'));var querystring=require(_0x30b6('0xf'));var Papa=require(_0x30b6('0x10'));var Redis=require('ioredis');var authService=require(_0x30b6('0x11'));var qs=require(_0x30b6('0x12'));var as=require(_0x30b6('0x13'));var hardwareService=require(_0x30b6('0x14'));var logger=require(_0x30b6('0x15'))(_0x30b6('0x16'));var utils=require(_0x30b6('0x17'));var config=require(_0x30b6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30b6('0x19'))['db'];function respondWithStatusCode(_0x5cfec4,_0xae0777){_0xae0777=_0xae0777||0xcc;return function(_0x270e33){if(_0x270e33){return _0x5cfec4[_0x30b6('0x1a')](_0xae0777);}return _0x5cfec4[_0x30b6('0x1b')](_0xae0777)[_0x30b6('0x1c')]();};}function respondWithResult(_0x141640,_0x41704c){_0x41704c=_0x41704c||0xc8;return function(_0x258ac9){if(_0x258ac9){return _0x141640[_0x30b6('0x1b')](_0x41704c)[_0x30b6('0x1d')](_0x258ac9);}};}function respondWithFilteredResult(_0x17ab28,_0x249c56){return function(_0x25b899){if(_0x25b899){var _0x160188=typeof _0x249c56[_0x30b6('0x1e')]==='undefined'&&typeof _0x249c56[_0x30b6('0x1f')]===_0x30b6('0x20');var _0x1d3628=_0x25b899[_0x30b6('0x21')];var _0x517cb1=_0x160188?0x0:_0x249c56[_0x30b6('0x1e')];var _0x3b94fe=_0x160188?_0x25b899[_0x30b6('0x21')]:_0x249c56[_0x30b6('0x1e')]+_0x249c56[_0x30b6('0x1f')];var _0x4712d5;if(_0x3b94fe>=_0x1d3628){_0x3b94fe=_0x1d3628;_0x4712d5=0xc8;}else{_0x4712d5=0xce;}_0x17ab28[_0x30b6('0x1b')](_0x4712d5);return _0x17ab28['set']('Content-Range',_0x517cb1+'-'+_0x3b94fe+'/'+_0x1d3628)[_0x30b6('0x1d')](_0x25b899);}return null;};}function patchUpdates(_0x52466e){return function(_0x59cf55){try{jsonpatch['apply'](_0x59cf55,_0x52466e,!![]);}catch(_0x24e713){return BPromise[_0x30b6('0x22')](_0x24e713);}return _0x59cf55['save']();};}function saveUpdates(_0x3e7488,_0x4c7038){return function(_0x367620){if(_0x367620){return _0x367620[_0x30b6('0x23')](_0x3e7488)[_0x30b6('0x24')](function(_0x544a14){return _0x544a14;});}return null;};}function removeEntity(_0x3d4d28,_0x3ab7fe){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0x30b6('0x25')]()[_0x30b6('0x24')](function(){var _0x5eae15=_0x1d3022['get']({'plain':!![]});var _0x38fd2e='CmContactHasItems';return db[_0x30b6('0x26')]['destroy']({'where':{'type':_0x38fd2e,'resourceId':_0x5eae15['id']}})[_0x30b6('0x24')](function(){return _0x1d3022;});})[_0x30b6('0x24')](function(){_0x3d4d28[_0x30b6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x289648,_0x2ee021){return function(_0x566c46){if(!_0x566c46){_0x289648['sendStatus'](0x194);}return _0x566c46;};}function handleError(_0x57e26d,_0x10a39c){_0x10a39c=_0x10a39c||0x1f4;return function(_0xab8b63){logger[_0x30b6('0x27')](_0xab8b63[_0x30b6('0x28')]);if(_0xab8b63[_0x30b6('0x29')]){delete _0xab8b63[_0x30b6('0x29')];}_0x57e26d[_0x30b6('0x1b')](_0x10a39c)['send'](_0xab8b63);};}exports[_0x30b6('0x2a')]=function(_0x127a03,_0x2eafe3){var _0x20cc81={},_0xc844be={},_0x2f834e={'count':0x0,'rows':[]};var _0x392f9c=_['map'](db[_0x30b6('0x2b')][_0x30b6('0x2c')],function(_0x33d5b1){return{'name':_0x33d5b1[_0x30b6('0x2d')],'type':_0x33d5b1['type']['key']};});_0xc844be[_0x30b6('0x2e')]=_[_0x30b6('0x2f')](_0x392f9c,_0x30b6('0x29'));_0xc844be[_0x30b6('0x30')]=_[_0x30b6('0x31')](_0x127a03[_0x30b6('0x30')]);_0xc844be[_0x30b6('0x32')]=_[_0x30b6('0x33')](_0xc844be[_0x30b6('0x2e')],_0xc844be['query']);_0x20cc81[_0x30b6('0x34')]=_[_0x30b6('0x33')](_0xc844be[_0x30b6('0x2e')],qs['fields'](_0x127a03[_0x30b6('0x30')]['fields']));_0x20cc81['attributes']=_0x20cc81[_0x30b6('0x34')][_0x30b6('0x35')]?_0x20cc81[_0x30b6('0x34')]:_0xc844be[_0x30b6('0x2e')];if(!_0x127a03[_0x30b6('0x30')][_0x30b6('0x36')]('nolimit')){_0x20cc81[_0x30b6('0x1f')]=qs[_0x30b6('0x1f')](_0x127a03[_0x30b6('0x30')][_0x30b6('0x1f')]);_0x20cc81[_0x30b6('0x1e')]=qs[_0x30b6('0x1e')](_0x127a03[_0x30b6('0x30')][_0x30b6('0x1e')]);}_0x20cc81['order']=qs[_0x30b6('0x37')](_0x127a03['query'][_0x30b6('0x37')]);_0x20cc81[_0x30b6('0x38')]=qs[_0x30b6('0x32')](_[_0x30b6('0x39')](_0x127a03[_0x30b6('0x30')],_0xc844be[_0x30b6('0x32')]),_0x392f9c);if(_0x127a03['query']['filter']){_0x20cc81['where']=_[_0x30b6('0x3a')](_0x20cc81[_0x30b6('0x38')],{'$or':_[_0x30b6('0x2f')](_0x392f9c,function(_0x533d14){if(_0x533d14['type']!==_0x30b6('0x3b')){var _0x516def={};_0x516def[_0x533d14[_0x30b6('0x29')]]={'$like':'%'+_0x127a03['query'][_0x30b6('0x3c')]+'%'};return _0x516def;}})});}_0x20cc81=_[_0x30b6('0x3a')]({},_0x20cc81,_0x127a03['options']);var _0x54bdf4={'where':_0x20cc81[_0x30b6('0x38')]};return db[_0x30b6('0x2b')]['count'](_0x54bdf4)['then'](function(_0x1902d4){_0x2f834e[_0x30b6('0x21')]=_0x1902d4;if(_0x127a03[_0x30b6('0x30')][_0x30b6('0x3d')]){_0x20cc81[_0x30b6('0x3e')]=[{'all':!![]}];}return db[_0x30b6('0x2b')][_0x30b6('0x3f')](_0x20cc81);})[_0x30b6('0x24')](function(_0x756215){_0x2f834e['rows']=_0x756215;return _0x2f834e;})[_0x30b6('0x24')](respondWithFilteredResult(_0x2eafe3,_0x20cc81))['catch'](handleError(_0x2eafe3,null));};exports[_0x30b6('0x40')]=function(_0x56a446,_0x589255){var _0x2ba608={'raw':!![],'where':{'id':_0x56a446[_0x30b6('0x41')]['id']}},_0x4ab889={};_0x4ab889['model']=_[_0x30b6('0x31')](db['CmContactHasItem']['rawAttributes']);_0x4ab889[_0x30b6('0x30')]=_[_0x30b6('0x31')](_0x56a446[_0x30b6('0x30')]);_0x4ab889[_0x30b6('0x32')]=_[_0x30b6('0x33')](_0x4ab889[_0x30b6('0x2e')],_0x4ab889['query']);_0x2ba608[_0x30b6('0x34')]=_[_0x30b6('0x33')](_0x4ab889['model'],qs[_0x30b6('0x42')](_0x56a446['query'][_0x30b6('0x42')]));_0x2ba608[_0x30b6('0x34')]=_0x2ba608['attributes']['length']?_0x2ba608[_0x30b6('0x34')]:_0x4ab889['model'];if(_0x56a446[_0x30b6('0x30')][_0x30b6('0x3d')]){_0x2ba608[_0x30b6('0x3e')]=[{'all':!![]}];}_0x2ba608=_[_0x30b6('0x3a')]({},_0x2ba608,_0x56a446[_0x30b6('0x43')]);return db['CmContactHasItem']['find'](_0x2ba608)['then'](handleEntityNotFound(_0x589255,null))[_0x30b6('0x24')](respondWithResult(_0x589255,null))[_0x30b6('0x44')](handleError(_0x589255,null));};exports[_0x30b6('0x45')]=function(_0x355720,_0x2f6199){return db['CmContactHasItem'][_0x30b6('0x45')](_0x355720[_0x30b6('0x46')],{})[_0x30b6('0x24')](function(_0x3b3036){var _0x3215fb=_0x355720['user']['get']({'plain':!![]});if(!_0x3215fb)throw new Error(_0x30b6('0x47'));if(_0x3215fb[_0x30b6('0x48')]===_0x30b6('0x49')){var _0x3f0438=_0x3b3036['get']({'plain':!![]});var _0x53488b='CmContactHasItems';return db[_0x30b6('0x4a')][_0x30b6('0x4b')]({'where':{'name':_0x53488b,'userProfileId':_0x3215fb[_0x30b6('0x4c')]},'raw':!![]})[_0x30b6('0x24')](function(_0x352837){if(_0x352837&&_0x352837[_0x30b6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f0438[_0x30b6('0x29')],'resourceId':_0x3f0438['id'],'type':_0x352837[_0x30b6('0x29')],'sectionId':_0x352837['id']},{})[_0x30b6('0x24')](function(){return _0x3b3036;});}else{return _0x3b3036;}})[_0x30b6('0x44')](function(_0x89b776){logger['error'](_0x30b6('0x4e'),_0x89b776);throw _0x89b776;});}return _0x3b3036;})[_0x30b6('0x24')](respondWithResult(_0x2f6199,0xc9))['catch'](handleError(_0x2f6199,null));};exports['update']=function(_0x3d7d30,_0x4322bb){if(_0x3d7d30[_0x30b6('0x46')]['id']){delete _0x3d7d30['body']['id'];}return db[_0x30b6('0x2b')][_0x30b6('0x4b')]({'where':{'id':_0x3d7d30['params']['id']}})[_0x30b6('0x24')](handleEntityNotFound(_0x4322bb,null))[_0x30b6('0x24')](saveUpdates(_0x3d7d30[_0x30b6('0x46')],null))[_0x30b6('0x24')](respondWithResult(_0x4322bb,null))['catch'](handleError(_0x4322bb,null));};exports[_0x30b6('0x25')]=function(_0x17a00f,_0x131316){return db[_0x30b6('0x2b')][_0x30b6('0x4b')]({'where':{'id':_0x17a00f[_0x30b6('0x41')]['id']}})[_0x30b6('0x24')](handleEntityNotFound(_0x131316,null))['then'](removeEntity(_0x131316,null))['catch'](handleError(_0x131316,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d26f0d8..e418c57 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 _0x34f6=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0xb0f273,_0x5db861){var _0x19b534=function(_0x56892f){while(--_0x56892f){_0xb0f273['push'](_0xb0f273['shift']());}};_0x19b534(++_0x5db861);}(_0x34f6,0x8e));var _0x634f=function(_0x214140,_0x273e62){_0x214140=_0x214140-0x0;var _0x1f45fa=_0x34f6[_0x214140];return _0x1f45fa;};'use strict';var _=require(_0x634f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x634f('0x1'));var moment=require(_0x634f('0x2'));var BPromise=require(_0x634f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x634f('0x4'));var rimraf=require(_0x634f('0x5'));var config=require(_0x634f('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x634f('0x7')]=function(_0xd1a187,_0x40abe4){return _0xd1a187[_0x634f('0x8')](_0x634f('0x9'),attributes,{'tableName':_0x634f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34be=['../../config/logger','bluebird','request-promise','path','exports','define','CmContactHasItem','lodash'];(function(_0x23def4,_0x52c2b5){var _0x62b53=function(_0x591e2b){while(--_0x591e2b){_0x23def4['push'](_0x23def4['shift']());}};_0x62b53(++_0x52c2b5);}(_0x34be,0x177));var _0xe34b=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x34be[_0x47e549];return _0x251374;};'use strict';var _=require(_0xe34b('0x0'));var util=require('util');var logger=require(_0xe34b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe34b('0x2'));var rp=require(_0xe34b('0x3'));var fs=require('fs');var path=require(_0xe34b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xe34b('0x5')]=function(_0x107414,_0x26ecdc){return _0x107414[_0xe34b('0x6')](_0xe34b('0x7'),attributes,{'tableName':'cm_contact_has_items','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 a10a8d9..be6e6b5 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 _0x5b0f=['moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x20cf60,_0x19e3a9){var _0x3b28e7=function(_0x22c132){while(--_0x22c132){_0x20cf60['push'](_0x20cf60['shift']());}};_0x3b28e7(++_0x19e3a9);}(_0x5b0f,0x1b8));var _0xf5b0=function(_0x1a0011,_0x32b202){_0x1a0011=_0x1a0011-0x0;var _0x49bfb2=_0x5b0f[_0x1a0011];return _0x49bfb2;};'use strict';var _=require('lodash');var util=require(_0xf5b0('0x0'));var moment=require(_0xf5b0('0x1'));var BPromise=require(_0xf5b0('0x2'));var rs=require(_0xf5b0('0x3'));var fs=require('fs');var Redis=require(_0xf5b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf5b0('0x5'))('rpc');var config=require(_0xf5b0('0x6'));var jayson=require(_0xf5b0('0x7'));var client=jayson[_0xf5b0('0x8')][_0xf5b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6534c8,_0x44fe77,_0x3e4e58){return new BPromise(function(_0x335300,_0x3de013){return client[_0xf5b0('0xa')](_0x6534c8,_0x3e4e58)['then'](function(_0x3aaf10){logger['info'](_0xf5b0('0xb'),_0x44fe77,_0xf5b0('0xc'));logger[_0xf5b0('0xd')](_0xf5b0('0xe'),_0x44fe77,'request\x20sent',JSON[_0xf5b0('0xf')](_0x3aaf10));if(_0x3aaf10[_0xf5b0('0x10')]){if(_0x3aaf10[_0xf5b0('0x10')][_0xf5b0('0x11')]===0x1f4){logger[_0xf5b0('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x44fe77,_0x3aaf10[_0xf5b0('0x10')]['message']);return _0x3de013(_0x3aaf10[_0xf5b0('0x10')][_0xf5b0('0x12')]);}logger[_0xf5b0('0x10')](_0xf5b0('0xb'),_0x44fe77,_0x3aaf10[_0xf5b0('0x10')][_0xf5b0('0x12')]);return _0x335300(_0x3aaf10[_0xf5b0('0x10')]['message']);}else{logger[_0xf5b0('0x13')](_0xf5b0('0xb'),_0x44fe77,'request\x20sent');_0x335300(_0x3aaf10['result'][_0xf5b0('0x12')]);}})[_0xf5b0('0x14')](function(_0x354a4b){logger[_0xf5b0('0x10')](_0xf5b0('0xb'),_0x44fe77,_0x354a4b);_0x3de013(_0x354a4b);});});} \ No newline at end of file +var _0x7b46=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','CmContactHasItem,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1108c4,_0x2ac837){var _0x5831ae=function(_0x119ec2){while(--_0x119ec2){_0x1108c4['push'](_0x1108c4['shift']());}};_0x5831ae(++_0x2ac837);}(_0x7b46,0x1c6));var _0x67b4=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7b46[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x67b4('0x0'));var util=require(_0x67b4('0x1'));var moment=require(_0x67b4('0x2'));var BPromise=require(_0x67b4('0x3'));var rs=require(_0x67b4('0x4'));var fs=require('fs');var Redis=require(_0x67b4('0x5'));var db=require(_0x67b4('0x6'))['db'];var utils=require(_0x67b4('0x7'));var logger=require(_0x67b4('0x8'))(_0x67b4('0x9'));var config=require(_0x67b4('0xa'));var jayson=require(_0x67b4('0xb'));var client=jayson['client'][_0x67b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b1908,_0x2d9079,_0x5e3d36){return new BPromise(function(_0x16a2fd,_0x11891c){return client[_0x67b4('0xd')](_0x4b1908,_0x5e3d36)['then'](function(_0x14b375){logger[_0x67b4('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2d9079,_0x67b4('0xf'));logger[_0x67b4('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2d9079,_0x67b4('0xf'),JSON['stringify'](_0x14b375));if(_0x14b375[_0x67b4('0x11')]){if(_0x14b375['error'][_0x67b4('0x12')]===0x1f4){logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x14b375[_0x67b4('0x11')][_0x67b4('0x14')]);return _0x11891c(_0x14b375[_0x67b4('0x11')]['message']);}logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x14b375[_0x67b4('0x11')][_0x67b4('0x14')]);return _0x16a2fd(_0x14b375[_0x67b4('0x11')]['message']);}else{logger['info'](_0x67b4('0x13'),_0x2d9079,'request\x20sent');_0x16a2fd(_0x14b375['result'][_0x67b4('0x14')]);}})['catch'](function(_0x1cb9fa){logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x1cb9fa);_0x11891c(_0x1cb9fa);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5147761..fb418cb 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 _0x1e50=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1e50,0xa6));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x01e5('0x0'));var path=require(_0x01e5('0x1'));var timeout=require(_0x01e5('0x2'));var express=require('express');var router=express[_0x01e5('0x3')]();var fs_extra=require(_0x01e5('0x4'));var auth=require(_0x01e5('0x5'));var interaction=require(_0x01e5('0x6'));var config=require(_0x01e5('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x01e5('0x8')]('/',auth[_0x01e5('0x9')](),controller['index']);router[_0x01e5('0x8')](_0x01e5('0xa'),auth[_0x01e5('0x9')](),controller[_0x01e5('0xb')]);router[_0x01e5('0xc')]('/',auth['isAuthenticated'](),controller[_0x01e5('0xd')]);router[_0x01e5('0xe')](_0x01e5('0xa'),auth[_0x01e5('0x9')](),controller[_0x01e5('0xf')]);router[_0x01e5('0x10')](_0x01e5('0xa'),auth[_0x01e5('0x9')](),controller[_0x01e5('0x11')]);module[_0x01e5('0x12')]=router; \ No newline at end of file +var _0x1a20=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x23f91e,_0x4eca56){var _0x4d0cb6=function(_0x413d19){while(--_0x413d19){_0x23f91e['push'](_0x23f91e['shift']());}};_0x4d0cb6(++_0x4eca56);}(_0x1a20,0x1d2));var _0x01a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1a20[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x01a2('0x0'));var path=require(_0x01a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x01a2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x01a2('0x3'));var interaction=require(_0x01a2('0x4'));var config=require(_0x01a2('0x5'));var controller=require(_0x01a2('0x6'));router[_0x01a2('0x7')]('/',auth[_0x01a2('0x8')](),controller[_0x01a2('0x9')]);router[_0x01a2('0x7')](_0x01a2('0xa'),auth[_0x01a2('0x8')](),controller[_0x01a2('0xb')]);router[_0x01a2('0xc')]('/',auth[_0x01a2('0x8')](),controller['create']);router['put']('/:id',auth[_0x01a2('0x8')](),controller[_0x01a2('0xd')]);router['delete'](_0x01a2('0xa'),auth[_0x01a2('0x8')](),controller['destroy']);module[_0x01a2('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b42f6f1..5962e8d 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 _0x215e=['lodash','exports','VIRTUAL','alias','STRING','TEXT','long','getDataValue','type','parse','values','isArray','stringify','setDataValue','sequelize'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x215e,0x167));var _0xe215=function(_0x2d262c,_0x3e2b5b){_0x2d262c=_0x2d262c-0x0;var _0x3b6a1a=_0x215e[_0x2d262c];return _0x3b6a1a;};'use strict';var Sequelize=require(_0xe215('0x0'));var _=require(_0xe215('0x1'));module[_0xe215('0x2')]={'name':{'type':Sequelize[_0xe215('0x3')],'get':function(_0x331487){return this['getDataValue'](_0xe215('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xdfa106){this['setDataValue']('alias',_0xdfa106?_0xdfa106:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xe215('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe215('0x6')](_0xe215('0x7')),'get':function(){if(this[_0xe215('0x8')](_0xe215('0x9'))==='select'){return JSON[_0xe215('0xa')](this[_0xe215('0x8')]('values'));}else{return this[_0xe215('0x8')](_0xe215('0xb'));}},'set':function(_0x4352f6){if(Array[_0xe215('0xc')](_0x4352f6)){this['setDataValue'](_0xe215('0xb'),JSON[_0xe215('0xd')](_0x4352f6));}else{this[_0xe215('0xe')](_0xe215('0xb'),_0x4352f6);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0xfe5f=['type','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe5f,0x19e));var _0xffe5=function(_0x4ed936,_0x53b8bf){_0x4ed936=_0x4ed936-0x0;var _0x3ce469=_0xfe5f[_0x4ed936];return _0x3ce469;};'use strict';var Sequelize=require(_0xffe5('0x0'));var _=require(_0xffe5('0x1'));module[_0xffe5('0x2')]={'name':{'type':Sequelize[_0xffe5('0x3')],'get':function(_0x18bc4c){return this[_0xffe5('0x4')](_0xffe5('0x5'));}},'alias':{'type':Sequelize[_0xffe5('0x6')],'allowNull':![],'set':function(_0x5688a1){this[_0xffe5('0x7')](_0xffe5('0x5'),_0x5688a1?_0x5688a1:this['getDataValue'](_0xffe5('0x8')));}},'type':{'type':Sequelize[_0xffe5('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xffe5('0x9')](_0xffe5('0xa')),'get':function(){if(this[_0xffe5('0x4')](_0xffe5('0xb'))==='select'){return JSON[_0xffe5('0xc')](this['getDataValue'](_0xffe5('0xd')));}else{return this[_0xffe5('0x4')](_0xffe5('0xd'));}},'set':function(_0x16c79b){if(Array[_0xffe5('0xe')](_0x16c79b)){this[_0xffe5('0x7')]('values',JSON[_0xffe5('0xf')](_0x16c79b));}else{this[_0xffe5('0x7')](_0xffe5('0xd'),_0x16c79b);}}},'required':{'type':Sequelize[_0xffe5('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xffe5('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cb2ec3f..68cd368 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 _0x2b00=['BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','body','params','create','transaction','Sequelize','number','INTEGER'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2b00,0x1b0));var _0x02b0=function(_0x4dc7f5,_0x312c14){_0x4dc7f5=_0x4dc7f5-0x0;var _0x3e37db=_0x2b00[_0x4dc7f5];return _0x3e37db;};'use strict';var emlformat=require(_0x02b0('0x0'));var rimraf=require(_0x02b0('0x1'));var zipdir=require(_0x02b0('0x2'));var jsonpatch=require(_0x02b0('0x3'));var rp=require('request-promise');var moment=require(_0x02b0('0x4'));var BPromise=require(_0x02b0('0x5'));var Mustache=require(_0x02b0('0x6'));var util=require(_0x02b0('0x7'));var path=require(_0x02b0('0x8'));var sox=require('sox');var csv=require(_0x02b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02b0('0xa'));var squel=require(_0x02b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x02b0('0xc'));var deskjs=require(_0x02b0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x02b0('0xe'));var Redis=require(_0x02b0('0xf'));var authService=require(_0x02b0('0x10'));var qs=require(_0x02b0('0x11'));var as=require(_0x02b0('0x12'));var hardwareService=require(_0x02b0('0x13'));var logger=require(_0x02b0('0x14'))('api');var utils=require(_0x02b0('0x15'));var config=require(_0x02b0('0x16'));var licenseUtil=require(_0x02b0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1217fa,_0x4f9c25){_0x4f9c25=_0x4f9c25||0xcc;return function(_0x3cd8e4){if(_0x3cd8e4){return _0x1217fa[_0x02b0('0x18')](_0x4f9c25);}return _0x1217fa[_0x02b0('0x19')](_0x4f9c25)[_0x02b0('0x1a')]();};}function respondWithResult(_0x3e7f1e,_0x5bda1e){_0x5bda1e=_0x5bda1e||0xc8;return function(_0x124237){if(_0x124237){return _0x3e7f1e[_0x02b0('0x19')](_0x5bda1e)[_0x02b0('0x1b')](_0x124237);}};}function respondWithFilteredResult(_0x255219,_0x2b0572){return function(_0x4239d0){if(_0x4239d0){var _0x2f9c26=typeof _0x2b0572[_0x02b0('0x1c')]===_0x02b0('0x1d')&&typeof _0x2b0572[_0x02b0('0x1e')]===_0x02b0('0x1d');var _0x4ac6ab=_0x4239d0[_0x02b0('0x1f')];var _0x37a0ca=_0x2f9c26?0x0:_0x2b0572[_0x02b0('0x1c')];var _0x3364ab=_0x2f9c26?_0x4239d0['count']:_0x2b0572[_0x02b0('0x1c')]+_0x2b0572[_0x02b0('0x1e')];var _0x3b0e84;if(_0x3364ab>=_0x4ac6ab){_0x3364ab=_0x4ac6ab;_0x3b0e84=0xc8;}else{_0x3b0e84=0xce;}_0x255219['status'](_0x3b0e84);return _0x255219[_0x02b0('0x20')](_0x02b0('0x21'),_0x37a0ca+'-'+_0x3364ab+'/'+_0x4ac6ab)['json'](_0x4239d0);}return null;};}function patchUpdates(_0x121db1){return function(_0x24e6cb){try{jsonpatch[_0x02b0('0x22')](_0x24e6cb,_0x121db1,!![]);}catch(_0x101536){return BPromise[_0x02b0('0x23')](_0x101536);}return _0x24e6cb['save']();};}function saveUpdates(_0x41b3d4,_0x5dbd95){return function(_0x137a67){if(_0x137a67){return _0x137a67['update'](_0x41b3d4)[_0x02b0('0x24')](function(_0x67c0e5){return _0x67c0e5;});}return null;};}function removeEntity(_0x478a0a,_0x55ff14){return function(_0x3f0905){if(_0x3f0905){return _0x3f0905[_0x02b0('0x25')]()[_0x02b0('0x24')](function(){_0x478a0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e523f,_0x14cb20){return function(_0xb7f037){if(!_0xb7f037){_0x3e523f['sendStatus'](0x194);}return _0xb7f037;};}function handleError(_0x5d37d8,_0x458f7d){_0x458f7d=_0x458f7d||0x1f4;return function(_0x2f06b){logger['error'](_0x2f06b[_0x02b0('0x26')]);if(_0x2f06b[_0x02b0('0x27')]){delete _0x2f06b[_0x02b0('0x27')];}_0x5d37d8[_0x02b0('0x19')](_0x458f7d)[_0x02b0('0x28')](_0x2f06b);};}exports['index']=function(_0x4fd056,_0x2a8f37){var _0x131b81={},_0x574ef6={},_0x31fccd={'count':0x0,'rows':[]};var _0x502536=_[_0x02b0('0x29')](db[_0x02b0('0x2a')][_0x02b0('0x2b')],function(_0x477f8e){return{'name':_0x477f8e['fieldName'],'type':_0x477f8e[_0x02b0('0x2c')][_0x02b0('0x2d')]};});_0x574ef6[_0x02b0('0x2e')]=_[_0x02b0('0x2f')](_[_0x02b0('0x29')](_0x502536,_0x02b0('0x27')),[_0x02b0('0x27')]);_0x574ef6[_0x02b0('0x30')]=_[_0x02b0('0x31')](_0x4fd056[_0x02b0('0x30')]);_0x574ef6[_0x02b0('0x32')]=_[_0x02b0('0x33')](_0x574ef6[_0x02b0('0x2e')],_0x574ef6[_0x02b0('0x30')]);_0x131b81[_0x02b0('0x34')]=_[_0x02b0('0x33')](_0x574ef6[_0x02b0('0x2e')],qs[_0x02b0('0x35')](_0x4fd056[_0x02b0('0x30')][_0x02b0('0x35')]));_0x131b81[_0x02b0('0x34')]=_0x131b81[_0x02b0('0x34')][_0x02b0('0x36')]?_0x131b81[_0x02b0('0x34')]:_0x574ef6[_0x02b0('0x2e')];if(!_0x4fd056[_0x02b0('0x30')][_0x02b0('0x37')](_0x02b0('0x38'))){_0x131b81[_0x02b0('0x1e')]=qs[_0x02b0('0x1e')](_0x4fd056[_0x02b0('0x30')][_0x02b0('0x1e')]);_0x131b81['offset']=qs[_0x02b0('0x1c')](_0x4fd056[_0x02b0('0x30')][_0x02b0('0x1c')]);}_0x131b81[_0x02b0('0x39')]=qs[_0x02b0('0x3a')](_0x4fd056[_0x02b0('0x30')]['sort']);_0x131b81[_0x02b0('0x3b')]=qs[_0x02b0('0x32')](_[_0x02b0('0x3c')](_0x4fd056[_0x02b0('0x30')],_0x574ef6[_0x02b0('0x32')]),_0x502536);if(_0x4fd056[_0x02b0('0x30')][_0x02b0('0x3d')]){_0x131b81[_0x02b0('0x3b')]=_[_0x02b0('0x3e')](_0x131b81['where'],{'$or':_[_0x02b0('0x29')](_0x502536,function(_0x26cc05){if(_0x26cc05[_0x02b0('0x2c')]!=='VIRTUAL'){var _0x143857={};_0x143857[_0x26cc05['name']]={'$like':'%'+_0x4fd056[_0x02b0('0x30')][_0x02b0('0x3d')]+'%'};return _0x143857;}})});}_0x131b81=_['merge']({},_0x131b81,_0x4fd056[_0x02b0('0x3f')]);var _0xaf6cf8={'where':_0x131b81[_0x02b0('0x3b')]};return db['CmCustomField']['count'](_0xaf6cf8)[_0x02b0('0x24')](function(_0x4e80ab){_0x31fccd[_0x02b0('0x1f')]=_0x4e80ab;if(_0x4fd056[_0x02b0('0x30')]['includeAll']){_0x131b81[_0x02b0('0x40')]=[{'all':!![]}];}return db[_0x02b0('0x2a')][_0x02b0('0x41')](_0x131b81);})['then'](function(_0x477c66){_0x31fccd[_0x02b0('0x42')]=_0x477c66;return _0x31fccd;})[_0x02b0('0x24')](respondWithFilteredResult(_0x2a8f37,_0x131b81))[_0x02b0('0x43')](handleError(_0x2a8f37,null));};exports[_0x02b0('0x44')]=function(_0x166619,_0x44eb2b){var _0x1d97b8={'raw':!![],'where':{'id':_0x166619['params']['id']}},_0x54ef42={};_0x54ef42[_0x02b0('0x2e')]=_['keys'](db['CmCustomField'][_0x02b0('0x2b')]);_0x54ef42[_0x02b0('0x30')]=_['keys'](_0x166619[_0x02b0('0x30')]);_0x54ef42[_0x02b0('0x32')]=_[_0x02b0('0x33')](_0x54ef42[_0x02b0('0x2e')],_0x54ef42[_0x02b0('0x30')]);_0x1d97b8['attributes']=_[_0x02b0('0x33')](_0x54ef42[_0x02b0('0x2e')],qs[_0x02b0('0x35')](_0x166619[_0x02b0('0x30')]['fields']));_0x1d97b8['attributes']=_0x1d97b8[_0x02b0('0x34')][_0x02b0('0x36')]?_0x1d97b8[_0x02b0('0x34')]:_0x54ef42[_0x02b0('0x2e')];if(_0x166619[_0x02b0('0x30')][_0x02b0('0x45')]){_0x1d97b8[_0x02b0('0x40')]=[{'all':!![]}];}_0x1d97b8=_[_0x02b0('0x3e')]({},_0x1d97b8,_0x166619['options']);return db[_0x02b0('0x2a')][_0x02b0('0x46')](_0x1d97b8)['then'](handleEntityNotFound(_0x44eb2b,null))[_0x02b0('0x24')](respondWithResult(_0x44eb2b,null))[_0x02b0('0x43')](handleError(_0x44eb2b,null));};exports['update']=function(_0x2e056a,_0x52e118){if(_0x2e056a[_0x02b0('0x47')]['id']){delete _0x2e056a[_0x02b0('0x47')]['id'];}return db['CmCustomField'][_0x02b0('0x46')]({'where':{'id':_0x2e056a[_0x02b0('0x48')]['id']}})[_0x02b0('0x24')](handleEntityNotFound(_0x52e118,null))['then'](saveUpdates(_0x2e056a[_0x02b0('0x47')],null))[_0x02b0('0x24')](respondWithResult(_0x52e118,null))[_0x02b0('0x43')](handleError(_0x52e118,null));};exports['destroy']=function(_0x148591,_0x55fe54){return db[_0x02b0('0x2a')]['find']({'where':{'id':_0x148591[_0x02b0('0x48')]['id']}})[_0x02b0('0x24')](handleEntityNotFound(_0x55fe54,null))[_0x02b0('0x24')](removeEntity(_0x55fe54,null))[_0x02b0('0x43')](handleError(_0x55fe54,null));};exports[_0x02b0('0x49')]=function(_0xd428f9,_0x3d9502){var _0xe263bb;return db['sequelize'][_0x02b0('0x4a')](function(_0x4aa102){return db['CmCustomField'][_0x02b0('0x49')](_0xd428f9[_0x02b0('0x47')],{'transaction':_0x4aa102})[_0x02b0('0x24')](function(_0x1636a5){_0xe263bb=_0x1636a5;var _0x282706={'type':db[_0x02b0('0x4b')]['TEXT'],'transaction':_0x4aa102};switch(_0xd428f9[_0x02b0('0x47')]['type']){case'text':_0x282706[_0x02b0('0x2c')]=db['Sequelize']['TEXT'];break;case _0x02b0('0x4c'):_0x282706[_0x02b0('0x2c')]=db[_0x02b0('0x4b')][_0x02b0('0x4d')];break;case'switch':_0x282706[_0x02b0('0x2c')]=db[_0x02b0('0x4b')][_0x02b0('0x4e')];_0x282706[_0x02b0('0x4f')]=![];break;default:}return db[_0x02b0('0x50')][_0x02b0('0x51')][_0x02b0('0x52')]('cm_contacts',util[_0x02b0('0x53')](_0x02b0('0x54'),_0xe263bb['id']),_0x282706);})[_0x02b0('0x24')](function(){return _0xe263bb;});})[_0x02b0('0x24')](respondWithResult(_0x3d9502,0xc9))[_0x02b0('0x43')](handleError(_0x3d9502,null));}; \ No newline at end of file +var _0xf318=['to-csv','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','create','sequelize','transaction','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1f1921,_0x4c6841){var _0x5d6f8d=function(_0x47fc64){while(--_0x47fc64){_0x1f1921['push'](_0x1f1921['shift']());}};_0x5d6f8d(++_0x4c6841);}(_0xf318,0x155));var _0x8f31=function(_0x211b21,_0x511d07){_0x211b21=_0x211b21-0x0;var _0x45a067=_0xf318[_0x211b21];return _0x45a067;};'use strict';var emlformat=require(_0x8f31('0x0'));var rimraf=require(_0x8f31('0x1'));var zipdir=require(_0x8f31('0x2'));var jsonpatch=require(_0x8f31('0x3'));var rp=require(_0x8f31('0x4'));var moment=require(_0x8f31('0x5'));var BPromise=require(_0x8f31('0x6'));var Mustache=require(_0x8f31('0x7'));var util=require(_0x8f31('0x8'));var path=require(_0x8f31('0x9'));var sox=require(_0x8f31('0xa'));var csv=require(_0x8f31('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f31('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8f31('0xd'));var deskjs=require(_0x8f31('0xe'));var toCsv=require(_0x8f31('0xb'));var querystring=require(_0x8f31('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f31('0x10'));var authService=require(_0x8f31('0x11'));var qs=require(_0x8f31('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f31('0x13'));var logger=require(_0x8f31('0x14'))(_0x8f31('0x15'));var utils=require('../../config/utils');var config=require(_0x8f31('0x16'));var licenseUtil=require(_0x8f31('0x17'));var db=require(_0x8f31('0x18'))['db'];function respondWithStatusCode(_0x599ff8,_0x1cc0c6){_0x1cc0c6=_0x1cc0c6||0xcc;return function(_0x267880){if(_0x267880){return _0x599ff8[_0x8f31('0x19')](_0x1cc0c6);}return _0x599ff8[_0x8f31('0x1a')](_0x1cc0c6)['end']();};}function respondWithResult(_0x5e816c,_0x4d26df){_0x4d26df=_0x4d26df||0xc8;return function(_0x3c35c4){if(_0x3c35c4){return _0x5e816c[_0x8f31('0x1a')](_0x4d26df)['json'](_0x3c35c4);}};}function respondWithFilteredResult(_0x55b8c3,_0x3efec6){return function(_0x3074d8){if(_0x3074d8){var _0x17a2d7=typeof _0x3efec6[_0x8f31('0x1b')]===_0x8f31('0x1c')&&typeof _0x3efec6[_0x8f31('0x1d')]===_0x8f31('0x1c');var _0x477378=_0x3074d8[_0x8f31('0x1e')];var _0x1198e3=_0x17a2d7?0x0:_0x3efec6[_0x8f31('0x1b')];var _0x47cae6=_0x17a2d7?_0x3074d8[_0x8f31('0x1e')]:_0x3efec6[_0x8f31('0x1b')]+_0x3efec6[_0x8f31('0x1d')];var _0x4f55f3;if(_0x47cae6>=_0x477378){_0x47cae6=_0x477378;_0x4f55f3=0xc8;}else{_0x4f55f3=0xce;}_0x55b8c3[_0x8f31('0x1a')](_0x4f55f3);return _0x55b8c3['set'](_0x8f31('0x1f'),_0x1198e3+'-'+_0x47cae6+'/'+_0x477378)[_0x8f31('0x20')](_0x3074d8);}return null;};}function patchUpdates(_0x34b17d){return function(_0xb8ed55){try{jsonpatch[_0x8f31('0x21')](_0xb8ed55,_0x34b17d,!![]);}catch(_0x58d149){return BPromise[_0x8f31('0x22')](_0x58d149);}return _0xb8ed55[_0x8f31('0x23')]();};}function saveUpdates(_0x3efabb,_0x50853f){return function(_0x1fa846){if(_0x1fa846){return _0x1fa846[_0x8f31('0x24')](_0x3efabb)[_0x8f31('0x25')](function(_0x766cc3){return _0x766cc3;});}return null;};}function removeEntity(_0x424574,_0x5089d1){return function(_0x5811c7){if(_0x5811c7){return _0x5811c7[_0x8f31('0x26')]()[_0x8f31('0x25')](function(){_0x424574[_0x8f31('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1694,_0xd1e4ac){return function(_0x3d8556){if(!_0x3d8556){_0x4d1694[_0x8f31('0x19')](0x194);}return _0x3d8556;};}function handleError(_0x496b67,_0x2e39da){_0x2e39da=_0x2e39da||0x1f4;return function(_0x5b87b8){logger[_0x8f31('0x27')](_0x5b87b8[_0x8f31('0x28')]);if(_0x5b87b8[_0x8f31('0x29')]){delete _0x5b87b8[_0x8f31('0x29')];}_0x496b67[_0x8f31('0x1a')](_0x2e39da)[_0x8f31('0x2a')](_0x5b87b8);};}exports[_0x8f31('0x2b')]=function(_0x5d7b39,_0x364d4c){var _0x1899fd={},_0x56a015={},_0x4170d7={'count':0x0,'rows':[]};var _0x330c1a=_[_0x8f31('0x2c')](db[_0x8f31('0x2d')][_0x8f31('0x2e')],function(_0x5b69c2){return{'name':_0x5b69c2[_0x8f31('0x2f')],'type':_0x5b69c2[_0x8f31('0x30')][_0x8f31('0x31')]};});_0x56a015[_0x8f31('0x32')]=_['differenceBy'](_[_0x8f31('0x2c')](_0x330c1a,_0x8f31('0x29')),['name']);_0x56a015['query']=_[_0x8f31('0x33')](_0x5d7b39[_0x8f31('0x34')]);_0x56a015[_0x8f31('0x35')]=_['intersection'](_0x56a015[_0x8f31('0x32')],_0x56a015['query']);_0x1899fd[_0x8f31('0x36')]=_[_0x8f31('0x37')](_0x56a015[_0x8f31('0x32')],qs['fields'](_0x5d7b39['query'][_0x8f31('0x38')]));_0x1899fd[_0x8f31('0x36')]=_0x1899fd[_0x8f31('0x36')][_0x8f31('0x39')]?_0x1899fd['attributes']:_0x56a015['model'];if(!_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x3a')](_0x8f31('0x3b'))){_0x1899fd[_0x8f31('0x1d')]=qs[_0x8f31('0x1d')](_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x1d')]);_0x1899fd[_0x8f31('0x1b')]=qs[_0x8f31('0x1b')](_0x5d7b39['query']['offset']);}_0x1899fd['order']=qs[_0x8f31('0x3c')](_0x5d7b39[_0x8f31('0x34')]['sort']);_0x1899fd[_0x8f31('0x3d')]=qs[_0x8f31('0x35')](_[_0x8f31('0x3e')](_0x5d7b39[_0x8f31('0x34')],_0x56a015[_0x8f31('0x35')]),_0x330c1a);if(_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x3f')]){_0x1899fd[_0x8f31('0x3d')]=_['merge'](_0x1899fd[_0x8f31('0x3d')],{'$or':_['map'](_0x330c1a,function(_0x11e2c0){if(_0x11e2c0['type']!==_0x8f31('0x40')){var _0xc8bee3={};_0xc8bee3[_0x11e2c0[_0x8f31('0x29')]]={'$like':'%'+_0x5d7b39['query'][_0x8f31('0x3f')]+'%'};return _0xc8bee3;}})});}_0x1899fd=_[_0x8f31('0x41')]({},_0x1899fd,_0x5d7b39[_0x8f31('0x42')]);var _0x3725b4={'where':_0x1899fd['where']};return db[_0x8f31('0x2d')][_0x8f31('0x1e')](_0x3725b4)[_0x8f31('0x25')](function(_0x16a1ae){_0x4170d7[_0x8f31('0x1e')]=_0x16a1ae;if(_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x43')]){_0x1899fd['include']=[{'all':!![]}];}return db['CmCustomField'][_0x8f31('0x44')](_0x1899fd);})[_0x8f31('0x25')](function(_0xab3d13){_0x4170d7[_0x8f31('0x45')]=_0xab3d13;return _0x4170d7;})[_0x8f31('0x25')](respondWithFilteredResult(_0x364d4c,_0x1899fd))[_0x8f31('0x46')](handleError(_0x364d4c,null));};exports[_0x8f31('0x47')]=function(_0xe765c1,_0x2056ce){var _0x4bb0b3={'raw':!![],'where':{'id':_0xe765c1[_0x8f31('0x48')]['id']}},_0x53129f={};_0x53129f[_0x8f31('0x32')]=_[_0x8f31('0x33')](db['CmCustomField']['rawAttributes']);_0x53129f[_0x8f31('0x34')]=_[_0x8f31('0x33')](_0xe765c1['query']);_0x53129f[_0x8f31('0x35')]=_['intersection'](_0x53129f[_0x8f31('0x32')],_0x53129f['query']);_0x4bb0b3[_0x8f31('0x36')]=_[_0x8f31('0x37')](_0x53129f[_0x8f31('0x32')],qs[_0x8f31('0x38')](_0xe765c1[_0x8f31('0x34')][_0x8f31('0x38')]));_0x4bb0b3[_0x8f31('0x36')]=_0x4bb0b3[_0x8f31('0x36')]['length']?_0x4bb0b3[_0x8f31('0x36')]:_0x53129f[_0x8f31('0x32')];if(_0xe765c1['query']['includeAll']){_0x4bb0b3[_0x8f31('0x49')]=[{'all':!![]}];}_0x4bb0b3=_['merge']({},_0x4bb0b3,_0xe765c1[_0x8f31('0x42')]);return db[_0x8f31('0x2d')][_0x8f31('0x4a')](_0x4bb0b3)[_0x8f31('0x25')](handleEntityNotFound(_0x2056ce,null))['then'](respondWithResult(_0x2056ce,null))['catch'](handleError(_0x2056ce,null));};exports[_0x8f31('0x24')]=function(_0x2c2ed5,_0x1ed263){if(_0x2c2ed5[_0x8f31('0x4b')]['id']){delete _0x2c2ed5[_0x8f31('0x4b')]['id'];}return db[_0x8f31('0x2d')][_0x8f31('0x4a')]({'where':{'id':_0x2c2ed5[_0x8f31('0x48')]['id']}})[_0x8f31('0x25')](handleEntityNotFound(_0x1ed263,null))[_0x8f31('0x25')](saveUpdates(_0x2c2ed5[_0x8f31('0x4b')],null))[_0x8f31('0x25')](respondWithResult(_0x1ed263,null))[_0x8f31('0x46')](handleError(_0x1ed263,null));};exports[_0x8f31('0x26')]=function(_0x184d9b,_0x2eed3c){return db[_0x8f31('0x2d')][_0x8f31('0x4a')]({'where':{'id':_0x184d9b[_0x8f31('0x48')]['id']}})[_0x8f31('0x25')](handleEntityNotFound(_0x2eed3c,null))['then'](removeEntity(_0x2eed3c,null))['catch'](handleError(_0x2eed3c,null));};exports[_0x8f31('0x4c')]=function(_0x47937f,_0x1442b6){var _0x3909ea;return db[_0x8f31('0x4d')][_0x8f31('0x4e')](function(_0x5e77c7){return db[_0x8f31('0x2d')][_0x8f31('0x4c')](_0x47937f['body'],{'transaction':_0x5e77c7})[_0x8f31('0x25')](function(_0x5a2e31){_0x3909ea=_0x5a2e31;var _0x492926={'type':db[_0x8f31('0x4f')]['TEXT'],'transaction':_0x5e77c7};switch(_0x47937f[_0x8f31('0x4b')]['type']){case'text':_0x492926['type']=db[_0x8f31('0x4f')][_0x8f31('0x50')];break;case _0x8f31('0x51'):_0x492926[_0x8f31('0x30')]=db[_0x8f31('0x4f')]['INTEGER'];break;case _0x8f31('0x52'):_0x492926[_0x8f31('0x30')]=db['Sequelize'][_0x8f31('0x53')];_0x492926[_0x8f31('0x54')]=![];break;default:}return db[_0x8f31('0x4d')][_0x8f31('0x55')]['addColumn'](_0x8f31('0x56'),util[_0x8f31('0x57')]('cf_%d',_0x3909ea['id']),_0x492926);})['then'](function(){return _0x3909ea;});})[_0x8f31('0x25')](respondWithResult(_0x1442b6,0xc9))[_0x8f31('0x46')](handleError(_0x1442b6,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8556d8a..fb0504e 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 _0x8b6f=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b6f,0x168));var _0xf8b6=function(_0xec9d5c,_0x3c0e38){_0xec9d5c=_0xec9d5c-0x0;var _0x49e9ba=_0x8b6f[_0xec9d5c];return _0x49e9ba;};'use strict';var _=require(_0xf8b6('0x0'));var util=require(_0xf8b6('0x1'));var logger=require('../../config/logger')(_0xf8b6('0x2'));var moment=require('moment');var BPromise=require(_0xf8b6('0x3'));var rp=require(_0xf8b6('0x4'));var fs=require('fs');var path=require(_0xf8b6('0x5'));var rimraf=require(_0xf8b6('0x6'));var config=require(_0xf8b6('0x7'));var attributes=require(_0xf8b6('0x8'));module[_0xf8b6('0x9')]=function(_0x36f181,_0x1a1b90){return _0x36f181[_0xf8b6('0xa')](_0xf8b6('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x820e=['../../config/environment','./cmCustomField.attributes','define','CmCustomField','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x820e,0x180));var _0xe820=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x820e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe820('0x0'));var moment=require(_0xe820('0x1'));var BPromise=require(_0xe820('0x2'));var rp=require(_0xe820('0x3'));var fs=require('fs');var path=require(_0xe820('0x4'));var rimraf=require(_0xe820('0x5'));var config=require(_0xe820('0x6'));var attributes=require(_0xe820('0x7'));module['exports']=function(_0x15360c,_0x32a3e6){return _0x15360c[_0xe820('0x8')](_0xe820('0x9'),attributes,{'tableName':'cm_custom_fields','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 38e7b81..1a24de4 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 _0x0f11=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0x0f11,0x190));var _0x10f1=function(_0x1f69e8,_0x14f1d7){_0x1f69e8=_0x1f69e8-0x0;var _0x3c7388=_0x0f11[_0x1f69e8];return _0x3c7388;};'use strict';var _=require(_0x10f1('0x0'));var util=require('util');var moment=require(_0x10f1('0x1'));var BPromise=require(_0x10f1('0x2'));var rs=require(_0x10f1('0x3'));var fs=require('fs');var Redis=require(_0x10f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x10f1('0x5'));var logger=require(_0x10f1('0x6'))(_0x10f1('0x7'));var config=require(_0x10f1('0x8'));var jayson=require(_0x10f1('0x9'));var client=jayson[_0x10f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x129c78,_0x5b3bb2,_0x3f76d8){return new BPromise(function(_0x3f7376,_0x5af3df){return client[_0x10f1('0xb')](_0x129c78,_0x3f76d8)[_0x10f1('0xc')](function(_0x245495){logger[_0x10f1('0xd')](_0x10f1('0xe'),_0x5b3bb2,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5b3bb2,_0x10f1('0xf'),JSON[_0x10f1('0x10')](_0x245495));if(_0x245495[_0x10f1('0x11')]){if(_0x245495[_0x10f1('0x11')][_0x10f1('0x12')]===0x1f4){logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x245495['error'][_0x10f1('0x13')]);return _0x5af3df(_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);}logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);return _0x3f7376(_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);}else{logger[_0x10f1('0xd')](_0x10f1('0xe'),_0x5b3bb2,_0x10f1('0xf'));_0x3f7376(_0x245495[_0x10f1('0x14')]['message']);}})[_0x10f1('0x15')](function(_0x2fc429){logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x2fc429);_0x5af3df(_0x2fc429);});});} \ No newline at end of file +var _0x1848=['../../config/environment','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','CmCustomField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19717d,_0x54123a){var _0x51234f=function(_0x266eb0){while(--_0x266eb0){_0x19717d['push'](_0x19717d['shift']());}};_0x51234f(++_0x54123a);}(_0x1848,0x147));var _0x8184=function(_0x1544b6,_0x599d4e){_0x1544b6=_0x1544b6-0x0;var _0x53c273=_0x1848[_0x1544b6];return _0x53c273;};'use strict';var _=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var moment=require('moment');var BPromise=require(_0x8184('0x2'));var rs=require(_0x8184('0x3'));var fs=require('fs');var Redis=require(_0x8184('0x4'));var db=require(_0x8184('0x5'))['db'];var utils=require(_0x8184('0x6'));var logger=require(_0x8184('0x7'))(_0x8184('0x8'));var config=require(_0x8184('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8184('0xa')][_0x8184('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1970db,_0x205001,_0x2ecad6){return new BPromise(function(_0x3405af,_0x4968ea){return client['request'](_0x1970db,_0x2ecad6)[_0x8184('0xc')](function(_0x25a6ee){logger[_0x8184('0xd')]('CmCustomField,\x20%s,\x20%s',_0x205001,_0x8184('0xe'));logger[_0x8184('0xf')](_0x8184('0x10'),_0x205001,_0x8184('0xe'),JSON['stringify'](_0x25a6ee));if(_0x25a6ee['error']){if(_0x25a6ee[_0x8184('0x11')]['code']===0x1f4){logger[_0x8184('0x11')](_0x8184('0x12'),_0x205001,_0x25a6ee[_0x8184('0x11')][_0x8184('0x13')]);return _0x4968ea(_0x25a6ee['error']['message']);}logger['error'](_0x8184('0x12'),_0x205001,_0x25a6ee['error'][_0x8184('0x13')]);return _0x3405af(_0x25a6ee[_0x8184('0x11')][_0x8184('0x13')]);}else{logger[_0x8184('0xd')](_0x8184('0x12'),_0x205001,_0x8184('0xe'));_0x3405af(_0x25a6ee['result'][_0x8184('0x13')]);}})[_0x8184('0x14')](function(_0x16c2ff){logger[_0x8184('0x11')](_0x8184('0x12'),_0x205001,_0x16c2ff);_0x4968ea(_0x16c2ff);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 45d7327..2d1e699 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 _0x6631=['index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6631,0x134));var _0x1663=function(_0x120d4e,_0x187ff7){_0x120d4e=_0x120d4e-0x0;var _0x4e7916=_0x6631[_0x120d4e];return _0x4e7916;};'use strict';var multer=require(_0x1663('0x0'));var util=require(_0x1663('0x1'));var path=require(_0x1663('0x2'));var timeout=require(_0x1663('0x3'));var express=require(_0x1663('0x4'));var router=express[_0x1663('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1663('0x6'));var interaction=require(_0x1663('0x7'));var config=require(_0x1663('0x8'));var controller=require(_0x1663('0x9'));router[_0x1663('0xa')]('/',auth[_0x1663('0xb')](),controller[_0x1663('0xc')]);router[_0x1663('0xa')](_0x1663('0xd'),auth[_0x1663('0xb')](),controller[_0x1663('0xe')]);router[_0x1663('0xf')]('/',auth[_0x1663('0xb')](),controller['create']);router[_0x1663('0x10')]('/:id',auth[_0x1663('0xb')](),controller['update']);router[_0x1663('0x11')]('/:id',auth[_0x1663('0xb')](),controller[_0x1663('0x12')]);module[_0x1663('0x13')]=router; \ No newline at end of file +var _0xd90b=['delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x502428,_0x347712){var _0x1081f7=function(_0x29303){while(--_0x29303){_0x502428['push'](_0x502428['shift']());}};_0x1081f7(++_0x347712);}(_0xd90b,0xbd));var _0xbd90=function(_0x2a4da7,_0x59fd72){_0x2a4da7=_0x2a4da7-0x0;var _0x5ae44c=_0xd90b[_0x2a4da7];return _0x5ae44c;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x3'));var config=require(_0xbd90('0x4'));var controller=require(_0xbd90('0x5'));router[_0xbd90('0x6')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0x8')]);router['get'](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xa')]);router[_0xbd90('0xb')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0xc')]);router[_0xbd90('0xd')](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xe')]);router[_0xbd90('0xf')]('/:id',auth[_0xbd90('0x7')](),controller[_0xbd90('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 51a98a5..93564a2 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 _0xcc68=['INTEGER','STRING','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1aac45,_0x1014fa){var _0x2af760=function(_0x3321a2){while(--_0x3321a2){_0x1aac45['push'](_0x1aac45['shift']());}};_0x2af760(++_0x1014fa);}(_0xcc68,0x90));var _0x8cc6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcc68[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0x8cc6('0x0'));var Sequelize=require('sequelize');module[_0x8cc6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8cc6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8cc6('0x3')],'defaultValue':moment()[_0x8cc6('0x4')](_0x8cc6('0x5'))},'countbusyretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8cc6('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8cc6('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x8cc6('0x6')](0x2)[_0x8cc6('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8cc6('0x6')],'unique':_0x8cc6('0x9')},'ListId':{'type':Sequelize[_0x8cc6('0x6')],'unique':_0x8cc6('0x9')},'UserId':{'type':Sequelize[_0x8cc6('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8cc6('0x6')],'unique':_0x8cc6('0x9')},'CampaignId':{'type':Sequelize[_0x8cc6('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8cc6('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8cc6('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8cc6('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8cc6('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x03ed=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN','DATE','format'];(function(_0x451bfc,_0x13d3eb){var _0x317b49=function(_0x30ab83){while(--_0x30ab83){_0x451bfc['push'](_0x451bfc['shift']());}};_0x317b49(++_0x13d3eb);}(_0x03ed,0x1c6));var _0xd03e=function(_0x52a1ef,_0x21e7c9){_0x52a1ef=_0x52a1ef-0x0;var _0x5ab751=_0x03ed[_0x52a1ef];return _0x5ab751;};'use strict';var moment=require(_0xd03e('0x0'));var Sequelize=require(_0xd03e('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd03e('0x3')],'defaultValue':moment()[_0xd03e('0x4')](_0xd03e('0x5'))},'countbusyretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd03e('0x3')]},'priority':{'type':Sequelize[_0xd03e('0x6')](0x2)[_0xd03e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd03e('0x6')],'unique':_0xd03e('0x8')},'ListId':{'type':Sequelize[_0xd03e('0x6')],'unique':_0xd03e('0x8')},'UserId':{'type':Sequelize[_0xd03e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xd03e('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xd03e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd03e('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xd03e('0x3')],'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 fb1207f..bc8254d 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 _0x5fc3=['CmHopperFinal','CmHopperAdditionalPhone','end','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','value','prev','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','getTimezone','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$or','$gt','$lt','$lte','$ne','$not','$notBetween','$in','$notLike','$notILike','$like','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','catch','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','campaign','user','deleted','deletedat','format','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally'];(function(_0x49801c,_0x329ccf){var _0x57d88f=function(_0x5a23af){while(--_0x5a23af){_0x49801c['push'](_0x49801c['shift']());}};_0x57d88f(++_0x329ccf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x5fc3[_0x376db5];return _0x304c17;};'use strict';var moment=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x35fc('0x2'))(_0x35fc('0x3'));var shared=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];function respondWithResult(_0xb4f9ce,_0x5e75e6){_0x5e75e6=_0x5e75e6||0xc8;return function(_0x2d1404){if(_0x2d1404){return _0xb4f9ce[_0x35fc('0x6')](_0x5e75e6)[_0x35fc('0x7')](_0x2d1404);}};}function respondWithFilteredResult(_0x5b85ad,_0x5754be){return function(_0x19a0d1){if(_0x19a0d1){var _0x508b32=typeof _0x5754be[_0x35fc('0x8')]===_0x35fc('0x9')&&typeof _0x5754be[_0x35fc('0xa')]===_0x35fc('0x9');var _0x34ff19=_0x19a0d1[_0x35fc('0xb')];var _0x2051ab=_0x508b32?0x0:_0x5754be['offset'];var _0x1083a9=_0x508b32?_0x19a0d1[_0x35fc('0xb')]:_0x5754be['offset']+_0x5754be[_0x35fc('0xa')];var _0x33f491;if(_0x1083a9>=_0x34ff19){_0x1083a9=_0x34ff19;_0x33f491=0xc8;}else{_0x33f491=0xce;}_0x5b85ad['status'](_0x33f491);return _0x5b85ad[_0x35fc('0xc')](_0x35fc('0xd'),_0x2051ab+'-'+_0x1083a9+'/'+_0x34ff19)['json'](_0x19a0d1);}return null;};}function saveUpdates(_0x4cbe74,_0x409357){return function(_0x5d462a){if(_0x5d462a){return _0x5d462a[_0x35fc('0xe')](_0x4cbe74)[_0x35fc('0xf')](function(_0x2a6ad2){return _0x2a6ad2;});}return null;};}function handleEntityNotFound(_0x29730f,_0x38d9f2){return function(_0x5cfe94){if(!_0x5cfe94){_0x29730f['sendStatus'](0x194);}return _0x5cfe94;};}function handleError(_0x5eac0f,_0x558364){_0x558364=_0x558364||0x1f4;return function(_0x398b67){logger[_0x35fc('0x10')](_0x398b67[_0x35fc('0x11')]);if(_0x398b67[_0x35fc('0x12')]){delete _0x398b67[_0x35fc('0x12')];}_0x5eac0f[_0x35fc('0x6')](_0x558364)['send'](_0x398b67);};}exports[_0x35fc('0x13')]=function(_0x45c8b7,_0x553677){var _0x41e165={},_0x363e47={},_0x2e513b={'count':0x0,'rows':[]};var _0x5f56c6=_[_0x35fc('0x14')](db[_0x35fc('0x15')][_0x35fc('0x16')],function(_0x488234){return{'name':_0x488234[_0x35fc('0x17')],'type':_0x488234[_0x35fc('0x18')][_0x35fc('0x19')]};});_0x363e47[_0x35fc('0x1a')]=_[_0x35fc('0x14')](_0x5f56c6,_0x35fc('0x12'));_0x363e47[_0x35fc('0x1b')]=_[_0x35fc('0x1c')](_0x45c8b7[_0x35fc('0x1b')]);_0x363e47[_0x35fc('0x1d')]=_['intersection'](_0x363e47[_0x35fc('0x1a')],_0x363e47[_0x35fc('0x1b')]);_0x363e47[_0x35fc('0x1d')]=_[_0x35fc('0x1e')](_0x363e47[_0x35fc('0x1d')],['$and',_0x35fc('0x1f'),_0x35fc('0x20'),'$gte',_0x35fc('0x21'),_0x35fc('0x22'),_0x35fc('0x23'),'$eq',_0x35fc('0x24'),'$between',_0x35fc('0x25'),_0x35fc('0x26'),'$notIn','$like',_0x35fc('0x27'),'$iLike',_0x35fc('0x28'),_0x35fc('0x29'),'$overlap',_0x35fc('0x2a'),_0x35fc('0x2b'),_0x35fc('0x2c')]);_0x41e165[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x363e47[_0x35fc('0x1a')],qs[_0x35fc('0x2f')](_0x45c8b7[_0x35fc('0x1b')]['fields']));_0x41e165[_0x35fc('0x2d')]=_0x41e165[_0x35fc('0x2d')][_0x35fc('0x30')]?_0x41e165['attributes']:_0x363e47[_0x35fc('0x1a')];if(!_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x31')](_0x35fc('0x32'))){_0x41e165[_0x35fc('0xa')]=qs[_0x35fc('0xa')](_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0xa')]);_0x41e165[_0x35fc('0x8')]=qs[_0x35fc('0x8')](_0x45c8b7['query']['offset']);}_0x41e165[_0x35fc('0x33')]=qs['sort'](_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x34')]);_0x41e165[_0x35fc('0x35')]=qs[_0x35fc('0x1d')](_[_0x35fc('0x36')](_0x45c8b7[_0x35fc('0x1b')],_0x363e47['filters']),_0x5f56c6);if(_0x45c8b7[_0x35fc('0x1b')][_0x35fc('0x37')]){_0x41e165[_0x35fc('0x35')]=_[_0x35fc('0x38')](_0x41e165[_0x35fc('0x35')],{'$or':_[_0x35fc('0x14')](_0x5f56c6,function(_0x553597){if(_0x553597[_0x35fc('0x18')]!==_0x35fc('0x39')){var _0x1fecdf={};_0x1fecdf[_0x553597['name']]={'$like':'%'+_0x45c8b7[_0x35fc('0x1b')]['filter']+'%'};return _0x1fecdf;}})});}_0x41e165=_[_0x35fc('0x38')]({},_0x41e165,_0x45c8b7[_0x35fc('0x3a')]);var _0x266a11={'where':_0x41e165[_0x35fc('0x35')]};return db['CmHopper']['count'](_0x266a11)['then'](function(_0x20f5fe){_0x2e513b['count']=_0x20f5fe;if(_0x45c8b7[_0x35fc('0x1b')]['includeAll']){_0x41e165[_0x35fc('0x3b')]=[{'all':!![]}];}return db[_0x35fc('0x15')][_0x35fc('0x3c')](_0x41e165);})[_0x35fc('0xf')](function(_0x1c10e0){_0x2e513b[_0x35fc('0x3d')]=_0x1c10e0;return _0x2e513b;})[_0x35fc('0xf')](respondWithFilteredResult(_0x553677,_0x41e165))['catch'](handleError(_0x553677,null));};exports[_0x35fc('0x3e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5={'raw':!![],'where':{'id':_0x16087d[_0x35fc('0x3f')]['id']}},_0x1ccc41={};_0x1ccc41[_0x35fc('0x1a')]=_[_0x35fc('0x1c')](db[_0x35fc('0x15')]['rawAttributes']);_0x1ccc41[_0x35fc('0x1b')]=_[_0x35fc('0x1c')](_0x16087d[_0x35fc('0x1b')]);_0x1ccc41['filters']=_[_0x35fc('0x2e')](_0x1ccc41[_0x35fc('0x1a')],_0x1ccc41['query']);_0x1feda5[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x1ccc41[_0x35fc('0x1a')],qs[_0x35fc('0x2f')](_0x16087d[_0x35fc('0x1b')][_0x35fc('0x2f')]));_0x1feda5[_0x35fc('0x2d')]=_0x1feda5[_0x35fc('0x2d')]['length']?_0x1feda5['attributes']:_0x1ccc41[_0x35fc('0x1a')];if(_0x16087d[_0x35fc('0x1b')]['includeAll']){_0x1feda5['include']=[{'all':!![]}];}_0x1feda5=_['merge']({},_0x1feda5,_0x16087d[_0x35fc('0x3a')]);return db[_0x35fc('0x15')]['find'](_0x1feda5)[_0x35fc('0xf')](handleEntityNotFound(_0x4e0ce3,null))[_0x35fc('0xf')](respondWithResult(_0x4e0ce3,null))[_0x35fc('0x40')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x41')]=function(_0x5c52be,_0x57105c){return db['CmHopper']['create'](_0x5c52be['body'],{})[_0x35fc('0xf')](respondWithResult(_0x57105c,0xc9))[_0x35fc('0x40')](handleError(_0x57105c,null));};exports['update']=function(_0x119925,_0x56cf1f){if(_0x119925[_0x35fc('0x42')]['id']){delete _0x119925[_0x35fc('0x42')]['id'];}return db[_0x35fc('0x15')][_0x35fc('0x43')]({'where':{'id':_0x119925[_0x35fc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0xf')](saveUpdates(_0x119925[_0x35fc('0x42')],null))['then'](respondWithResult(_0x56cf1f,null))[_0x35fc('0x40')](handleError(_0x56cf1f,null));};exports[_0x35fc('0x44')]=function(_0x2a8a09,_0x211746){return db['CmHopper'][_0x35fc('0x44')]()['then'](respondWithResult(_0x211746,null))['catch'](handleError(_0x211746,null));};exports[_0x35fc('0x45')]=function(_0x9db7e8,_0x18dc78){var _0xca8aef;var _0xf2ca20=_0x9db7e8[_0x35fc('0x3f')]['id'];return db[_0x35fc('0x15')][_0x35fc('0x43')]({'where':{'id':_0x9db7e8['params']['id']}})[_0x35fc('0xf')](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0xf')](function(_0xeca02e){if(_0xeca02e){return _0xeca02e[_0x35fc('0x45')]()[_0x35fc('0xf')](function(_0x1e3221){return _0x1e3221;});}})[_0x35fc('0xf')](function(_0x347a4a){_0xca8aef=_0x347a4a;if(_0x347a4a){if(_0x347a4a[_0x35fc('0x46')]||_0x347a4a[_0x35fc('0x47')]){return db[_0x347a4a[_0x35fc('0x46')]?_0x35fc('0x48'):_0x35fc('0x49')][_0x35fc('0x43')]({'where':{'id':_0x347a4a['VoiceQueueId']?_0x347a4a['VoiceQueueId']:_0x347a4a[_0x35fc('0x47')]},'attributes':['id',_0x35fc('0x12')],'raw':!![]});}}})[_0x35fc('0xf')](function(_0x2bf0b0){var _0x3ee296={};if(_0x2bf0b0){_[_0x35fc('0x38')](_0x3ee296,_['omit'](_0xca8aef['dataValues'],[_0x35fc('0x4a'),_0x35fc('0x4b'),'id']));_0x3ee296[_0x35fc('0x4c')]=0x15;_0x3ee296[_0x35fc('0x4d')]='deleted';_0x3ee296[_0x35fc('0x4e')]=_0x2bf0b0[_0x35fc('0x12')];_0x3ee296['membername']=_0x9db7e8[_0x35fc('0x4f')][_0x35fc('0x12')];_0x3ee296['UserId']=_0x9db7e8[_0x35fc('0x4f')]['id'];_0x3ee296[_0x35fc('0x50')]=!![];_0x3ee296[_0x35fc('0x51')]=moment()[_0x35fc('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ee296['calleridnum']=_0xca8aef['phone'];_0x3ee296[_0x35fc('0x53')]=_0xca8aef[_0x35fc('0x46')]?'queue':_0x35fc('0x54');return db[_0x35fc('0x55')][_0x35fc('0x43')]({'where':{'id':_0x3ee296[_0x35fc('0x56')]},'attributes':[_0x35fc('0x57'),'lastName']})[_0x35fc('0xf')](function(_0x757aa6){if(!_[_0x35fc('0x58')](_0x18dc78)&&!_['isNil'](_0x757aa6[_0x35fc('0x57')])){_0x3ee296[_0x35fc('0x59')]=_0x757aa6['firstName'];if(!_[_0x35fc('0x58')](_0x757aa6[_0x35fc('0x5a')])){_0x3ee296[_0x35fc('0x59')]+='\x20'+_0x757aa6[_0x35fc('0x5a')];}}})[_0x35fc('0x5b')](function(){return db[_0x35fc('0x5c')][_0x35fc('0x41')](_0x3ee296);});}})[_0x35fc('0xf')](function(_0x53a79d){return db[_0x35fc('0x5d')][_0x35fc('0x45')]({'where':{'CmHopperId':_0xf2ca20}});})[_0x35fc('0xf')](function(){return _0x18dc78['status'](0xcc)[_0x35fc('0x5e')]();})['catch'](handleError(_0x18dc78,null));};exports['getPreview']=function(_0x5d4a39,_0x23b54f){var _0xb1c68a=[];return db[_0x35fc('0x55')][_0x35fc('0x44')]()[_0x35fc('0xf')](function(_0x4bbea0){_0xb1c68a=_['keys'](_0x4bbea0);return _0x5d4a39['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x35fc('0x5f')},'attributes':['id',_0x35fc('0x60'),_0x35fc('0x61')],'raw':!![]});})[_0x35fc('0xf')](function(_0x511e8b){if(_0x511e8b&&_0x511e8b[_0x35fc('0x30')]){return db[_0x35fc('0x62')][_0x35fc('0x63')](function(_0x1b0063){var _0x37bea1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35fc('0x52')](_0x35fc('0x64'))},'VoiceQueueId':{'$in':_[_0x35fc('0x14')](_0x511e8b,'id')},'$or':[{'UserId':null},{'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']}]};var _0x4c3ace={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x511e8b)[_0x35fc('0x37')](['dialPreviewAutoRecallMe',0x0])[_0x35fc('0x14')]('id')[_0x35fc('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']}]};var _0x2bc76c={'$or':[_0x37bea1,_0x4c3ace]};var _0x4bdde7=[];if(_0x5d4a39[_0x35fc('0x42')]['direction']&&_0x5d4a39['body']['direction']===_0x35fc('0x66')){if(!_['isEmpty'](_0x5d4a39[_0x35fc('0x42')]['hopperIds'])){_0x2bc76c['id']={'$in':_0x5d4a39[_0x35fc('0x42')]['hopperIds']};}_0x4bdde7=[[_0x35fc('0x67'),_0x35fc('0x68')],[_0x35fc('0x69'),_0x511e8b[0x0][_0x35fc('0x60')]==='ASC'?_0x35fc('0x6a'):_0x35fc('0x68')],db[_0x35fc('0x62')]['literal'](_0x35fc('0x6b')),['id',_0x35fc('0x6a')]];}else{if(!_[_0x35fc('0x6c')](_0x5d4a39[_0x35fc('0x42')][_0x35fc('0x6d')])){_0x2bc76c['id']={'$notIn':_0x5d4a39[_0x35fc('0x42')][_0x35fc('0x6d')]};}_0x4bdde7=[[_0x35fc('0x67'),'DESC'],[_0x35fc('0x69'),_0x511e8b[0x0][_0x35fc('0x60')]],db[_0x35fc('0x62')]['literal'](_0x35fc('0x6e')),['id',_0x35fc('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x35fc('0x6f'),'phone',_0x35fc('0x70')],'where':_0x2bc76c,'order':_0x4bdde7,'transaction':_0x1b0063,'lock':_0x1b0063[_0x35fc('0x71')][_0x35fc('0x72')],'include':[{'model':db[_0x35fc('0x55')],'as':_0x35fc('0x73'),'attributes':_0xb1c68a,'include':[{'model':db[_0x35fc('0x74')],'as':_0x35fc('0x75'),'attributes':['id',_0x35fc('0x12')]}]},{'model':db[_0x35fc('0x76')],'as':_0x35fc('0x77'),'attributes':['id',_0x35fc('0x12')]},{'model':db[_0x35fc('0x48')],'as':_0x35fc('0x78'),'attributes':['id',_0x35fc('0x12'),_0x35fc('0x79')]}]})[_0x35fc('0xf')](function(_0x2d8219){if(_0x2d8219){return _0x2d8219[_0x35fc('0xe')]({'UserId':_0x5d4a39[_0x35fc('0x4f')]['id']},{'transaction':_0x1b0063});}});});}})[_0x35fc('0xf')](handleEntityNotFound(_0x23b54f,null))['then'](respondWithResult(_0x23b54f,null))[_0x35fc('0x40')](handleError(_0x23b54f,null));};exports['getPreviewRecall']=function(_0x88d681,_0x6c5ef,_0x2185ce){var _0x516b26=[];var _0x25af78=_0x88d681[_0x35fc('0x3f')]['id'];var _0x2913ba=_0x88d681[_0x35fc('0x4f')]['id'];return db[_0x35fc('0x55')][_0x35fc('0x44')]()[_0x35fc('0xf')](function(_0x580062){_0x516b26=_[_0x35fc('0x1c')](_0x580062);return db[_0x35fc('0x62')][_0x35fc('0x63')](function(_0x1ca01f){const _0x3a973d={'id':_0x25af78};return db[_0x35fc('0x15')]['findOne']({'attributes':['id',_0x35fc('0x6f'),_0x35fc('0x70')],'where':_0x3a973d,'transaction':_0x1ca01f,'lock':_0x1ca01f[_0x35fc('0x71')][_0x35fc('0x72')],'include':[{'model':db[_0x35fc('0x55')],'as':_0x35fc('0x73'),'attributes':_0x516b26,'include':[{'model':db[_0x35fc('0x74')],'as':_0x35fc('0x75'),'attributes':['id',_0x35fc('0x12')]}]},{'model':db['CmList'],'as':_0x35fc('0x77'),'attributes':['id','name']},{'model':db[_0x35fc('0x48')],'as':_0x35fc('0x78'),'attributes':['id','name',_0x35fc('0x79')]}]})[_0x35fc('0xf')](function(_0xcaa49){if(_0xcaa49){return _0xcaa49[_0x35fc('0xe')]({'UserId':_0x2913ba},{'transaction':_0x1ca01f});}});});})[_0x35fc('0xf')](handleEntityNotFound(_0x6c5ef,null))[_0x35fc('0xf')](respondWithResult(_0x6c5ef,null))[_0x35fc('0x40')](handleError(_0x6c5ef,null));};exports[_0x35fc('0x7a')]=function(_0x25ee61,_0x5806bf){return _0x25ee61['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x35fc('0x5f')},'attributes':['id'],'raw':!![]})[_0x35fc('0xf')](function(_0x8fc410){if(_0x8fc410&&_0x8fc410[_0x35fc('0x30')]){return db[_0x35fc('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35fc('0x52')](_0x35fc('0x64'))},'VoiceQueueId':{'$in':_[_0x35fc('0x14')](_0x8fc410,'id')},'$or':[{'UserId':null},{'UserId':_0x25ee61[_0x35fc('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x15e936){if(!_[_0x35fc('0x58')](_0x15e936)&&_[_0x35fc('0x7b')](_0x15e936)){return _0x5806bf['status'](0xc8)[_0x35fc('0x7')]({'contacts':_0x15e936});}else{logger[_0x35fc('0x10')](_0x35fc('0x7c'),_0x35fc('0x7a'),0x194,_0x35fc('0x7d'));_0x5806bf[_0x35fc('0x7e')](0x194);}})[_0x35fc('0x40')](handleError(_0x5806bf,null));};exports[_0x35fc('0x7f')]=function(_0x4b6c03,_0x2faff7){var _0xa2c5f8=shared[_0x35fc('0x80')];var _0x2799c8=[];_[_0x35fc('0x14')](_0xa2c5f8,function(_0x1fcd36){_0x2799c8['push']({'id':_0x1fcd36[_0x35fc('0x12')],'name':_0x1fcd36['name'],'utcOffset':_0x1fcd36['utcOffset']});});return _0x2faff7[_0x35fc('0x6')](0xc8)['json']({'tz':_0x2799c8});};exports[_0x35fc('0x81')]=function(_0x233b7d,_0x2885b9){var _0x54cbcb=shared[_0x35fc('0x80')];var _0x2b3edc={};if(!_[_0x35fc('0x58')](_0x54cbcb[_0x233b7d[_0x35fc('0x42')]['id']]))_0x2b3edc=_0x54cbcb[_0x233b7d[_0x35fc('0x42')]['id']];return _0x2885b9['status'](0xc8)['json'](_0x2b3edc);}; \ No newline at end of file +var _0x06f4=['CmHopperFinal','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','LOCK','CmCompany','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','index','map','CmHopper','fieldName','key','query','intersection','model','concat','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally'];(function(_0x171f56,_0x5cc378){var _0x54ad98=function(_0x5663e0){while(--_0x5663e0){_0x171f56['push'](_0x171f56['shift']());}};_0x54ad98(++_0x5cc378);}(_0x06f4,0x136));var _0x406f=function(_0x31c6c6,_0x31b802){_0x31c6c6=_0x31c6c6-0x0;var _0x22c13e=_0x06f4[_0x31c6c6];return _0x22c13e;};'use strict';var moment=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x406f('0x2'))(_0x406f('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3a4ff0,_0x5ed32f){_0x5ed32f=_0x5ed32f||0xc8;return function(_0x32abfd){if(_0x32abfd){return _0x3a4ff0[_0x406f('0x4')](_0x5ed32f)[_0x406f('0x5')](_0x32abfd);}};}function respondWithFilteredResult(_0x32b2bd,_0x59821c){return function(_0x1d2886){if(_0x1d2886){var _0x5bec4f=typeof _0x59821c[_0x406f('0x6')]===_0x406f('0x7')&&typeof _0x59821c[_0x406f('0x8')]==='undefined';var _0x407936=_0x1d2886['count'];var _0x5b46bf=_0x5bec4f?0x0:_0x59821c[_0x406f('0x6')];var _0x56edc2=_0x5bec4f?_0x1d2886[_0x406f('0x9')]:_0x59821c['offset']+_0x59821c[_0x406f('0x8')];var _0x5af7cd;if(_0x56edc2>=_0x407936){_0x56edc2=_0x407936;_0x5af7cd=0xc8;}else{_0x5af7cd=0xce;}_0x32b2bd[_0x406f('0x4')](_0x5af7cd);return _0x32b2bd[_0x406f('0xa')]('Content-Range',_0x5b46bf+'-'+_0x56edc2+'/'+_0x407936)[_0x406f('0x5')](_0x1d2886);}return null;};}function saveUpdates(_0x380382,_0x451592){return function(_0x163de4){if(_0x163de4){return _0x163de4[_0x406f('0xb')](_0x380382)[_0x406f('0xc')](function(_0x29aef9){return _0x29aef9;});}return null;};}function handleEntityNotFound(_0xcc1d6,_0x4522b2){return function(_0x5045e8){if(!_0x5045e8){_0xcc1d6[_0x406f('0xd')](0x194);}return _0x5045e8;};}function handleError(_0x489445,_0x1bf795){_0x1bf795=_0x1bf795||0x1f4;return function(_0x28fda6){logger[_0x406f('0xe')](_0x28fda6['stack']);if(_0x28fda6[_0x406f('0xf')]){delete _0x28fda6[_0x406f('0xf')];}_0x489445['status'](_0x1bf795)['send'](_0x28fda6);};}exports[_0x406f('0x10')]=function(_0x4357e3,_0x509bae){var _0x2e4409={},_0x57d93a={},_0xe186fb={'count':0x0,'rows':[]};var _0x3ad3fe=_[_0x406f('0x11')](db[_0x406f('0x12')]['rawAttributes'],function(_0x492c68){return{'name':_0x492c68[_0x406f('0x13')],'type':_0x492c68['type'][_0x406f('0x14')]};});_0x57d93a['model']=_[_0x406f('0x11')](_0x3ad3fe,_0x406f('0xf'));_0x57d93a[_0x406f('0x15')]=_['keys'](_0x4357e3['query']);_0x57d93a['filters']=_[_0x406f('0x16')](_0x57d93a[_0x406f('0x17')],_0x57d93a[_0x406f('0x15')]);_0x57d93a['filters']=_[_0x406f('0x18')](_0x57d93a['filters'],[_0x406f('0x19'),_0x406f('0x1a'),_0x406f('0x1b'),_0x406f('0x1c'),_0x406f('0x1d'),'$lte','$ne',_0x406f('0x1e'),'$not',_0x406f('0x1f'),_0x406f('0x20'),'$in','$notIn',_0x406f('0x21'),'$notLike',_0x406f('0x22'),_0x406f('0x23'),_0x406f('0x21'),_0x406f('0x24'),_0x406f('0x25'),_0x406f('0x26'),_0x406f('0x27')]);_0x2e4409[_0x406f('0x28')]=_['intersection'](_0x57d93a['model'],qs[_0x406f('0x29')](_0x4357e3[_0x406f('0x15')][_0x406f('0x29')]));_0x2e4409[_0x406f('0x28')]=_0x2e4409['attributes']['length']?_0x2e4409[_0x406f('0x28')]:_0x57d93a[_0x406f('0x17')];if(!_0x4357e3['query']['hasOwnProperty'](_0x406f('0x2a'))){_0x2e4409[_0x406f('0x8')]=qs[_0x406f('0x8')](_0x4357e3[_0x406f('0x15')][_0x406f('0x8')]);_0x2e4409[_0x406f('0x6')]=qs[_0x406f('0x6')](_0x4357e3[_0x406f('0x15')][_0x406f('0x6')]);}_0x2e4409[_0x406f('0x2b')]=qs[_0x406f('0x2c')](_0x4357e3[_0x406f('0x15')][_0x406f('0x2c')]);_0x2e4409['where']=qs[_0x406f('0x2d')](_[_0x406f('0x2e')](_0x4357e3[_0x406f('0x15')],_0x57d93a[_0x406f('0x2d')]),_0x3ad3fe);if(_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]){_0x2e4409[_0x406f('0x30')]=_[_0x406f('0x31')](_0x2e4409[_0x406f('0x30')],{'$or':_[_0x406f('0x11')](_0x3ad3fe,function(_0x52b465){if(_0x52b465[_0x406f('0x32')]!==_0x406f('0x33')){var _0x36a17a={};_0x36a17a[_0x52b465[_0x406f('0xf')]]={'$like':'%'+_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]+'%'};return _0x36a17a;}})});}_0x2e4409=_['merge']({},_0x2e4409,_0x4357e3['options']);var _0x44c63a={'where':_0x2e4409[_0x406f('0x30')]};return db['CmHopper'][_0x406f('0x9')](_0x44c63a)['then'](function(_0x43fb4f){_0xe186fb[_0x406f('0x9')]=_0x43fb4f;if(_0x4357e3[_0x406f('0x15')]['includeAll']){_0x2e4409[_0x406f('0x34')]=[{'all':!![]}];}return db[_0x406f('0x12')][_0x406f('0x35')](_0x2e4409);})[_0x406f('0xc')](function(_0x224e9d){_0xe186fb[_0x406f('0x36')]=_0x224e9d;return _0xe186fb;})[_0x406f('0xc')](respondWithFilteredResult(_0x509bae,_0x2e4409))[_0x406f('0x37')](handleError(_0x509bae,null));};exports[_0x406f('0x38')]=function(_0x14c27f,_0x17f217){var _0x37c4d2={'raw':!![],'where':{'id':_0x14c27f[_0x406f('0x39')]['id']}},_0x279e9e={};_0x279e9e[_0x406f('0x17')]=_['keys'](db['CmHopper']['rawAttributes']);_0x279e9e[_0x406f('0x15')]=_[_0x406f('0x3a')](_0x14c27f[_0x406f('0x15')]);_0x279e9e['filters']=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],_0x279e9e[_0x406f('0x15')]);_0x37c4d2[_0x406f('0x28')]=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],qs['fields'](_0x14c27f[_0x406f('0x15')][_0x406f('0x29')]));_0x37c4d2['attributes']=_0x37c4d2[_0x406f('0x28')]['length']?_0x37c4d2['attributes']:_0x279e9e[_0x406f('0x17')];if(_0x14c27f[_0x406f('0x15')][_0x406f('0x3b')]){_0x37c4d2[_0x406f('0x34')]=[{'all':!![]}];}_0x37c4d2=_[_0x406f('0x31')]({},_0x37c4d2,_0x14c27f[_0x406f('0x3c')]);return db['CmHopper']['find'](_0x37c4d2)[_0x406f('0xc')](handleEntityNotFound(_0x17f217,null))[_0x406f('0xc')](respondWithResult(_0x17f217,null))[_0x406f('0x37')](handleError(_0x17f217,null));};exports[_0x406f('0x3d')]=function(_0x453289,_0x2b226e){return db[_0x406f('0x12')]['create'](_0x453289[_0x406f('0x3e')],{})[_0x406f('0xc')](respondWithResult(_0x2b226e,0xc9))[_0x406f('0x37')](handleError(_0x2b226e,null));};exports[_0x406f('0xb')]=function(_0x792ac9,_0x17c499){if(_0x792ac9[_0x406f('0x3e')]['id']){delete _0x792ac9[_0x406f('0x3e')]['id'];}return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x792ac9[_0x406f('0x39')]['id']}})['then'](handleEntityNotFound(_0x17c499,null))[_0x406f('0xc')](saveUpdates(_0x792ac9[_0x406f('0x3e')],null))['then'](respondWithResult(_0x17c499,null))['catch'](handleError(_0x17c499,null));};exports[_0x406f('0x40')]=function(_0x3eb55b,_0x2a13c3){return db[_0x406f('0x12')]['describe']()[_0x406f('0xc')](respondWithResult(_0x2a13c3,null))['catch'](handleError(_0x2a13c3,null));};exports[_0x406f('0x41')]=function(_0x351d2f,_0x5b1143){var _0x5a91dd;var _0x1bdb59=_0x351d2f[_0x406f('0x39')]['id'];return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x351d2f['params']['id']}})[_0x406f('0xc')](handleEntityNotFound(_0x5b1143,null))[_0x406f('0xc')](function(_0x8ef14b){if(_0x8ef14b){return _0x8ef14b[_0x406f('0x41')]()['then'](function(_0x5d4041){return _0x5d4041;});}})[_0x406f('0xc')](function(_0x244fcf){_0x5a91dd=_0x244fcf;if(_0x244fcf){if(_0x244fcf[_0x406f('0x42')]||_0x244fcf[_0x406f('0x43')]){return db[_0x244fcf[_0x406f('0x42')]?'VoiceQueue':_0x406f('0x44')][_0x406f('0x3f')]({'where':{'id':_0x244fcf['VoiceQueueId']?_0x244fcf['VoiceQueueId']:_0x244fcf[_0x406f('0x43')]},'attributes':['id',_0x406f('0xf')],'raw':!![]});}}})[_0x406f('0xc')](function(_0x4b0b19){var _0x1a99b9={};if(_0x4b0b19){_[_0x406f('0x31')](_0x1a99b9,_[_0x406f('0x45')](_0x5a91dd[_0x406f('0x46')],[_0x406f('0x47'),_0x406f('0x48'),'id']));_0x1a99b9[_0x406f('0x49')]=0x15;_0x1a99b9[_0x406f('0x4a')]=_0x406f('0x4b');_0x1a99b9['campaign']=_0x4b0b19['name'];_0x1a99b9[_0x406f('0x4c')]=_0x351d2f[_0x406f('0x4d')][_0x406f('0xf')];_0x1a99b9[_0x406f('0x4e')]=_0x351d2f[_0x406f('0x4d')]['id'];_0x1a99b9[_0x406f('0x4b')]=!![];_0x1a99b9[_0x406f('0x4f')]=moment()[_0x406f('0x50')](_0x406f('0x51'));_0x1a99b9[_0x406f('0x52')]=_0x5a91dd['phone'];_0x1a99b9['campaigntype']=_0x5a91dd[_0x406f('0x42')]?_0x406f('0x53'):_0x406f('0x54');return db[_0x406f('0x55')][_0x406f('0x3f')]({'where':{'id':_0x1a99b9[_0x406f('0x56')]},'attributes':['firstName',_0x406f('0x57')]})[_0x406f('0xc')](function(_0x39f7f6){if(!_[_0x406f('0x58')](_0x5b1143)&&!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x59')])){_0x1a99b9[_0x406f('0x5a')]=_0x39f7f6[_0x406f('0x59')];if(!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x57')])){_0x1a99b9['calleridname']+='\x20'+_0x39f7f6[_0x406f('0x57')];}}})[_0x406f('0x5b')](function(){return db[_0x406f('0x5c')]['create'](_0x1a99b9);});}})[_0x406f('0xc')](function(_0x538517){return db['CmHopperAdditionalPhone'][_0x406f('0x41')]({'where':{'CmHopperId':_0x1bdb59}});})[_0x406f('0xc')](function(){return _0x5b1143['status'](0xcc)[_0x406f('0x5d')]();})['catch'](handleError(_0x5b1143,null));};exports[_0x406f('0x5e')]=function(_0x4a4bf8,_0x2c3881){var _0x48bca4=[];return db[_0x406f('0x55')][_0x406f('0x40')]()['then'](function(_0x5dd1e8){_0x48bca4=_[_0x406f('0x3a')](_0x5dd1e8);return _0x4a4bf8[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x406f('0x61'),_0x406f('0x62')],'raw':!![]});})[_0x406f('0xc')](function(_0x41839a){if(_0x41839a&&_0x41839a[_0x406f('0x63')]){return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x5c1a91){var _0x44297b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x406f('0x51'))},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x41839a,'id')},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x55cac0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x41839a)[_0x406f('0x2f')]([_0x406f('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x468e2b={'$or':[_0x44297b,_0x55cac0]};var _0x4a150b=[];if(_0x4a4bf8['body']['direction']&&_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x66')]===_0x406f('0x67')){if(!_['isEmpty'](_0x4a4bf8['body'][_0x406f('0x68')])){_0x468e2b['id']={'$in':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6a')],['scheduledAt',_0x41839a[0x0][_0x406f('0x61')]===_0x406f('0x6a')?_0x406f('0x6b'):_0x406f('0x6a')],db[_0x406f('0x64')][_0x406f('0x6c')](_0x406f('0x6d')),['id',_0x406f('0x6b')]];}else{if(!_[_0x406f('0x6e')](_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')])){_0x468e2b['id']={'$notIn':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6b')],[_0x406f('0x6f'),_0x41839a[0x0][_0x406f('0x61')]],db['sequelize'][_0x406f('0x6c')](_0x406f('0x70')),['id',_0x406f('0x6a')]];}return db['CmHopper'][_0x406f('0x71')]({'attributes':['id',_0x406f('0x72'),'phone',_0x406f('0x73')],'where':_0x468e2b,'order':_0x4a150b,'transaction':_0x5c1a91,'lock':_0x5c1a91['LOCK']['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x48bca4,'include':[{'model':db['CmCompany'],'as':_0x406f('0x75'),'attributes':['id','name']}]},{'model':db[_0x406f('0x76')],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x3e9e31){if(_0x3e9e31){return _0x3e9e31['update']({'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']},{'transaction':_0x5c1a91});}});});}})['then'](handleEntityNotFound(_0x2c3881,null))[_0x406f('0xc')](respondWithResult(_0x2c3881,null))['catch'](handleError(_0x2c3881,null));};exports['getPreviewRecall']=function(_0x519cd9,_0x14ce45,_0x3f0e29){var _0x2bb105=[];var _0x156fa5=_0x519cd9[_0x406f('0x39')]['id'];var _0x552db1=_0x519cd9['user']['id'];return db['CmContact'][_0x406f('0x40')]()['then'](function(_0x31212a){_0x2bb105=_[_0x406f('0x3a')](_0x31212a);return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x238912){const _0x1b2e3c={'id':_0x156fa5};return db['CmHopper']['findOne']({'attributes':['id',_0x406f('0x72'),_0x406f('0x73')],'where':_0x1b2e3c,'transaction':_0x238912,'lock':_0x238912[_0x406f('0x7b')]['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x2bb105,'include':[{'model':db[_0x406f('0x7c')],'as':_0x406f('0x75'),'attributes':['id',_0x406f('0xf')]}]},{'model':db['CmList'],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x23ae6b){if(_0x23ae6b){return _0x23ae6b['update']({'UserId':_0x552db1},{'transaction':_0x238912});}});});})['then'](handleEntityNotFound(_0x14ce45,null))['then'](respondWithResult(_0x14ce45,null))[_0x406f('0x37')](handleError(_0x14ce45,null));};exports['getOpenContacts']=function(_0x5ec137,_0x2c032b){return _0x5ec137[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':_0x406f('0x7d')},'attributes':['id'],'raw':!![]})['then'](function(_0x58206a){if(_0x58206a&&_0x58206a[_0x406f('0x63')]){return db[_0x406f('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x406f('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x58206a,'id')},'$or':[{'UserId':null},{'UserId':_0x5ec137[_0x406f('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x110072){if(!_[_0x406f('0x58')](_0x110072)&&_[_0x406f('0x7e')](_0x110072)){return _0x2c032b[_0x406f('0x4')](0xc8)[_0x406f('0x5')]({'contacts':_0x110072});}else{logger[_0x406f('0xe')](_0x406f('0x7f'),_0x406f('0x80'),0x194,_0x406f('0x81'));_0x2c032b[_0x406f('0xd')](0x194);}})[_0x406f('0x37')](handleError(_0x2c032b,null));};exports['getTimezones']=function(_0x35968c,_0x16791a){var _0x169662=shared[_0x406f('0x82')];var _0x2bf211=[];_[_0x406f('0x11')](_0x169662,function(_0x115736){_0x2bf211[_0x406f('0x83')]({'id':_0x115736[_0x406f('0xf')],'name':_0x115736['name'],'utcOffset':_0x115736[_0x406f('0x84')]});});return _0x16791a[_0x406f('0x4')](0xc8)['json']({'tz':_0x2bf211});};exports[_0x406f('0x85')]=function(_0x2213b4,_0x39fe38){var _0x42a297=shared[_0x406f('0x82')];var _0x2178ac={};if(!_['isNil'](_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']]))_0x2178ac=_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']];return _0x39fe38['status'](0xc8)[_0x406f('0x5')](_0x2178ac);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 77ff114..7e1dd2f 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x9fe7eb,_0x3c6f07){var _0x4f5902=function(_0x2bf9a1){while(--_0x2bf9a1){_0x9fe7eb['push'](_0x9fe7eb['shift']());}};_0x4f5902(++_0x3c6f07);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0xba34,0x119));var _0x4ba3=function(_0x234110,_0x488d95){_0x234110=_0x234110-0x0;var _0x4c9648=_0xba34[_0x234110];return _0x4c9648;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 31a2b35..4940ef4 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 _0x336d=['http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','update','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','LOCK','keys','Agent','name','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x437838,_0x478f8e){var _0x57dfda=function(_0x32156d){while(--_0x32156d){_0x437838['push'](_0x437838['shift']());}};_0x57dfda(++_0x478f8e);}(_0x336d,0xae));var _0xd336=function(_0x530fb0,_0x71240c){_0x530fb0=_0x530fb0-0x0;var _0x5174c5=_0x336d[_0x530fb0];return _0x5174c5;};'use strict';var _=require('lodash');var util=require(_0xd336('0x0'));var moment=require(_0xd336('0x1'));var BPromise=require(_0xd336('0x2'));var db=require(_0xd336('0x3'))['db'];var logger=require(_0xd336('0x4'))(_0xd336('0x5'));var jayson=require(_0xd336('0x6'));var client=jayson[_0xd336('0x7')][_0xd336('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa21198,_0x578a83,_0x5e202d){return new BPromise(function(_0x176983,_0x23c751){return client[_0xd336('0x9')](_0xa21198,_0x5e202d)['then'](function(_0x419f42){logger[_0xd336('0xa')](_0xd336('0xb'),_0x578a83,_0xd336('0xc'));logger[_0xd336('0xd')](_0xd336('0xe'),_0x578a83,_0xd336('0xc'),JSON[_0xd336('0xf')](_0x419f42));if(_0x419f42[_0xd336('0x10')]){if(_0x419f42[_0xd336('0x10')]['code']===0x1f4){logger['error'](_0xd336('0xb'),_0x578a83,_0x419f42[_0xd336('0x10')][_0xd336('0x11')]);return _0x23c751(_0x419f42[_0xd336('0x10')][_0xd336('0x11')]);}logger[_0xd336('0x10')](_0xd336('0xb'),_0x578a83,_0x419f42[_0xd336('0x10')][_0xd336('0x11')]);return _0x176983(_0x419f42[_0xd336('0x10')]['message']);}else{logger[_0xd336('0xa')]('CmHopper,\x20%s,\x20%s',_0x578a83,_0xd336('0xc'));_0x176983(_0x419f42[_0xd336('0x12')][_0xd336('0x11')]);}})[_0xd336('0x13')](function(_0x1e4716){logger[_0xd336('0x10')](_0xd336('0xb'),_0x578a83,_0x1e4716);_0x23c751(_0x1e4716);});});}exports[_0xd336('0x14')]=function(_0x46432f){var _0x3a6e60=this;return new Promise(function(_0x2171a2,_0x87b75b){return db[_0xd336('0x15')][_0xd336('0x16')]({'raw':_0x46432f[_0xd336('0x17')]?_0x46432f[_0xd336('0x17')][_0xd336('0x18')]===undefined?!![]:![]:!![],'where':_0x46432f['options']?_0x46432f[_0xd336('0x17')][_0xd336('0x19')]||null:null,'attributes':_0x46432f[_0xd336('0x17')]?_0x46432f['options'][_0xd336('0x1a')]||null:null,'limit':_0x46432f[_0xd336('0x17')]?_0x46432f['options'][_0xd336('0x1b')]||null:null,'include':_0x46432f[_0xd336('0x17')]?_0x46432f['options'][_0xd336('0x1c')]?_['map'](_0x46432f[_0xd336('0x17')][_0xd336('0x1c')],function(_0x180c5e){return{'model':db[_0x180c5e[_0xd336('0x1d')]],'as':_0x180c5e['as'],'attributes':_0x180c5e[_0xd336('0x1a')],'include':_0x180c5e[_0xd336('0x1c')]?_['map'](_0x180c5e[_0xd336('0x1c')],function(_0x45f5d5){return{'model':db[_0x45f5d5[_0xd336('0x1d')]],'as':_0x45f5d5['as'],'attributes':_0x45f5d5[_0xd336('0x1a')],'include':_0x45f5d5[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x45f5d5['include'],function(_0x379e4e){return{'model':db[_0x379e4e[_0xd336('0x1d')]],'as':_0x379e4e['as'],'attributes':_0x379e4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38ebd9){logger[_0xd336('0xa')](_0xd336('0x14'),_0x46432f);logger[_0xd336('0xd')](_0xd336('0x14'),_0x46432f,JSON[_0xd336('0xf')](_0x38ebd9));_0x2171a2(_0x38ebd9);})[_0xd336('0x13')](function(_0x21f288){logger[_0xd336('0x10')](_0xd336('0x14'),_0x21f288['message'],_0x46432f);_0x87b75b(_0x3a6e60['error'](0x1f4,_0x21f288[_0xd336('0x11')]));});});};exports[_0xd336('0x1f')]=function(_0x54421f){var _0x1d30ef=this;return new Promise(function(_0x337a90,_0x489dee){return db[_0xd336('0x15')][_0xd336('0x20')]({'raw':_0x54421f[_0xd336('0x17')]?_0x54421f[_0xd336('0x17')][_0xd336('0x18')]===undefined?!![]:![]:!![],'where':_0x54421f[_0xd336('0x17')]?_0x54421f[_0xd336('0x17')]['where']||null:null,'attributes':_0x54421f[_0xd336('0x17')]?_0x54421f['options'][_0xd336('0x1a')]||null:null,'include':_0x54421f[_0xd336('0x17')]?_0x54421f[_0xd336('0x17')][_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x54421f[_0xd336('0x17')][_0xd336('0x1c')],function(_0x15a9aa){return{'model':db[_0x15a9aa[_0xd336('0x1d')]],'as':_0x15a9aa['as'],'attributes':_0x15a9aa['attributes'],'include':_0x15a9aa[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x15a9aa[_0xd336('0x1c')],function(_0x4197dd){return{'model':db[_0x4197dd[_0xd336('0x1d')]],'as':_0x4197dd['as'],'attributes':_0x4197dd[_0xd336('0x1a')],'include':_0x4197dd['include']?_[_0xd336('0x1e')](_0x4197dd[_0xd336('0x1c')],function(_0x4b3125){return{'model':db[_0x4b3125[_0xd336('0x1d')]],'as':_0x4b3125['as'],'attributes':_0x4b3125['attributes']};}):[]};}):[]};}):[]:[]})[_0xd336('0x21')](function(_0x387522){logger[_0xd336('0xa')](_0xd336('0x1f'),_0x54421f);logger[_0xd336('0xd')](_0xd336('0x1f'),_0x54421f,JSON[_0xd336('0xf')](_0x387522));_0x337a90(_0x387522);})[_0xd336('0x13')](function(_0x124a6a){logger[_0xd336('0x10')](_0xd336('0x1f'),_0x124a6a[_0xd336('0x11')],_0x54421f);_0x489dee(_0x1d30ef['error'](0x1f4,_0x124a6a[_0xd336('0x11')]));});});};exports[_0xd336('0x22')]=function(_0x349505){var _0x115ce2=this;return new Promise(function(_0x102a7d,_0x47e372){return db[_0xd336('0x15')][_0xd336('0x23')](_0x349505[_0xd336('0x24')],{'raw':_0x349505[_0xd336('0x17')]?_0x349505[_0xd336('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd336('0x21')](function(_0x3c126c){logger[_0xd336('0xa')]('CreateCmHopper',_0x349505);logger[_0xd336('0xd')]('CreateCmHopper',_0x349505,JSON['stringify'](_0x3c126c));_0x102a7d(_0x3c126c);})['catch'](function(_0xbc13d6){logger['error'](_0xd336('0x22'),_0xbc13d6[_0xd336('0x11')],_0x349505);_0x47e372(_0x115ce2['error'](0x1f4,_0xbc13d6[_0xd336('0x11')]));});});};exports[_0xd336('0x25')]=function(_0x456c35){var _0x1b6f6e=this;return new Promise(function(_0xbb2f5a,_0x4706f7){return db[_0xd336('0x15')][_0xd336('0x26')](_0x456c35[_0xd336('0x24')],{'raw':_0x456c35[_0xd336('0x17')]?_0x456c35[_0xd336('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456c35['options']?_0x456c35[_0xd336('0x17')][_0xd336('0x19')]||null:null,'attributes':_0x456c35[_0xd336('0x17')]?_0x456c35['options'][_0xd336('0x1a')]||null:null,'limit':_0x456c35[_0xd336('0x17')]?_0x456c35[_0xd336('0x17')]['limit']||null:null})[_0xd336('0x21')](function(_0xe60a0){logger[_0xd336('0xa')]('UpdateCmHopper',_0x456c35);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd336('0xf')](_0x456c35[_0xd336('0x17')]['where']),_0x456c35[_0xd336('0x24')][_0xd336('0x27')]);logger[_0xd336('0xd')]('UpdateCmHopper',_0x456c35,JSON['stringify'](_0xe60a0));_0xbb2f5a(_0xe60a0);})[_0xd336('0x13')](function(_0x4ecf14){logger[_0xd336('0x10')](_0xd336('0x25'),_0x4ecf14[_0xd336('0x11')],_0x456c35);_0x4706f7(_0x1b6f6e[_0xd336('0x10')](0x1f4,_0x4ecf14[_0xd336('0x11')]));});});};exports['DestroyCmHopper']=function(_0x1586b3){var _0x2cde70=this;return new Promise(function(_0x573791,_0x113117){return db[_0xd336('0x15')][_0xd336('0x28')]({'where':_0x1586b3[_0xd336('0x17')]?_0x1586b3[_0xd336('0x17')]['where']||null:null})[_0xd336('0x21')](function(_0x163c36){logger[_0xd336('0xa')]('DestroyCmHopper',_0x1586b3);logger[_0xd336('0xd')](_0xd336('0x29'),_0x1586b3,JSON['stringify'](_0x163c36));_0x573791(_0x163c36);})[_0xd336('0x13')](function(_0x2388b7){logger[_0xd336('0x10')](_0xd336('0x29'),_0x2388b7[_0xd336('0x11')],_0x1586b3);_0x113117(_0x2cde70['error'](0x1f4,_0x2388b7[_0xd336('0x11')]));});});};exports[_0xd336('0x2a')]=function(_0x4e4fdb){var _0x4040ca=this;return new Promise(function(_0x53bf23,_0x5867f1){return db[_0xd336('0x2b')][_0xd336('0x2c')]()[_0xd336('0x21')](function(_0x12f414){return db[_0xd336('0x2d')]['transaction'](function(_0x179420){return db[_0xd336('0x15')][_0xd336('0x16')]({'where':_0x4e4fdb[_0xd336('0x17')]?_0x4e4fdb[_0xd336('0x17')]['where']||null:null,'attributes':_0x4e4fdb[_0xd336('0x17')]?_0x4e4fdb[_0xd336('0x17')]['attributes']||null:null,'limit':_0x4e4fdb[_0xd336('0x17')]?_0x4e4fdb[_0xd336('0x17')][_0xd336('0x1b')]||null:null,'order':_0x4e4fdb[_0xd336('0x17')]?_0x4e4fdb[_0xd336('0x17')][_0xd336('0x2e')]||null:null,'transaction':_0x179420,'lock':_0x179420[_0xd336('0x2f')]['UPDATE'],'include':[{'model':db[_0xd336('0x2b')],'as':'Contact','attributes':_[_0xd336('0x30')](_0x12f414)},{'model':db['User'],'as':_0xd336('0x31'),'attributes':['id',_0xd336('0x32'),_0xd336('0x33')]}]})[_0xd336('0x21')](function(_0x40de59){var _0x539760=[];var _0x2f291b=[];for(var _0x4a1f94=0x0;_0x4a1f94<_0x40de59[_0xd336('0x34')];_0x4a1f94+=0x1){var _0x3f36a9=_0x40de59[_0x4a1f94]['UserId'];if(_0x3f36a9===null){_0x539760[_0xd336('0x35')](_0x40de59[_0x4a1f94][_0xd336('0x26')](_0x4e4fdb[_0xd336('0x24')],{'transaction':_0x179420}));}else if(!_0x2f291b[_0xd336('0x36')](_0x3f36a9)){_0x2f291b['push'](_0x3f36a9);_0x539760[_0xd336('0x35')](_0x40de59[_0x4a1f94][_0xd336('0x26')](_0x4e4fdb['body'],{'transaction':_0x179420}));}}return BPromise[_0xd336('0x37')](_0x539760);});})[_0xd336('0x21')](function(_0x2d47f5){logger['info'](_0xd336('0x2a'),_0x4e4fdb);if(_0x2d47f5[_0xd336('0x34')]>0x0){logger[_0xd336('0xa')](_0xd336('0x38'),_0x2d47f5[0x0][_0xd336('0x39')]['id'],_0x2d47f5[0x0]['dataValues'][_0xd336('0x3a')],_0x2d47f5[0x0]['dataValues'][_0xd336('0x27')]);}logger['debug'](_0xd336('0x2a'),_0x4e4fdb,JSON[_0xd336('0xf')](_0x2d47f5));_0x53bf23(_0x2d47f5);})[_0xd336('0x13')](function(_0x5a42b1){logger[_0xd336('0x10')](_0xd336('0x2a'),_0x5a42b1[_0xd336('0x11')],_0x4e4fdb);_0x5867f1(_0x4040ca[_0xd336('0x10')](0x1f4,_0x5a42b1[_0xd336('0x11')]));});});});};exports[_0xd336('0x3b')]=function(_0x30d59c){var _0x3229c0=this;return new Promise(function(_0x55b8e3,_0x1709cb){return db[_0xd336('0x2d')][_0xd336('0x3c')](function(_0x83313d){return db[_0xd336('0x3d')][_0xd336('0x23')](_0x30d59c[_0xd336('0x24')],{'raw':_0x30d59c['options']?_0x30d59c[_0xd336('0x17')][_0xd336('0x18')]===undefined?!![]:![]:!![],'transaction':_0x83313d})['then'](function(){logger[_0xd336('0xa')](_0xd336('0x3e'),JSON[_0xd336('0xf')](_0x30d59c['options'][_0xd336('0x19')]),_0x30d59c[_0xd336('0x17')][_0xd336('0x19')][_0xd336('0x27')]);return db[_0xd336('0x15')]['destroy']({'where':_0x30d59c[_0xd336('0x17')]?_0x30d59c[_0xd336('0x17')][_0xd336('0x19')]||null:null,'transaction':_0x83313d});});})[_0xd336('0x21')](function(_0x20214f){logger[_0xd336('0xa')](_0xd336('0x3b'),_0x30d59c);logger[_0xd336('0xd')](_0xd336('0x3b'),_0x30d59c,JSON[_0xd336('0xf')](_0x20214f));_0x55b8e3(_0x20214f);})['catch'](function(_0x153410){logger['error'](_0xd336('0x3b'),_0x153410[_0xd336('0x11')],_0x30d59c);_0x1709cb(_0x3229c0[_0xd336('0x10')](0x1f4,_0x153410['message']));});});};exports[_0xd336('0x3f')]=function(_0x160f86){var _0x364333=this;return new Promise(function(_0x3a64dc,_0x434a29){return db[_0xd336('0x15')][_0xd336('0x16')]({'raw':_0x160f86[_0xd336('0x17')]?_0x160f86[_0xd336('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x160f86[_0xd336('0x17')]?_0x160f86[_0xd336('0x17')][_0xd336('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd336('0x40'),db[_0xd336('0x2d')]['fn']('IF',db[_0xd336('0x2d')][_0xd336('0x41')](_0xd336('0x42')+util[_0xd336('0x43')](_0xd336('0x44'),moment()[_0xd336('0x43')](_0xd336('0x45')))+_0xd336('0x46')))),_0xd336('0x47')]]})[_0xd336('0x21')](function(_0x34ab47){logger['info'](_0xd336('0x3f'),_0x160f86);logger[_0xd336('0xd')](_0xd336('0x3f'),_0x160f86,JSON[_0xd336('0xf')](_0x34ab47));_0x3a64dc(_0x34ab47);})[_0xd336('0x13')](function(_0x3b58ed){logger[_0xd336('0x10')](_0xd336('0x3f'),_0x3b58ed[_0xd336('0x11')],_0x160f86);_0x434a29(_0x364333[_0xd336('0x10')](0x1f4,_0x3b58ed['message']));});});};exports['GetContactRecallMe']=function(_0x12894a){var _0x27ce94=this;return new Promise(function(_0x1b47da,_0x24dad4){return db['CmContact'][_0xd336('0x2c')]()['then'](function(_0x434861){return db[_0xd336('0x2d')][_0xd336('0x3c')](function(_0x4e92ee){return db[_0xd336('0x15')][_0xd336('0x16')]({'where':_0x12894a[_0xd336('0x17')]?_0x12894a[_0xd336('0x17')][_0xd336('0x19')]||null:null,'attributes':_0x12894a[_0xd336('0x17')]?_0x12894a[_0xd336('0x17')][_0xd336('0x1a')]||null:null,'limit':0x1,'order':_0x12894a['options']?_0x12894a[_0xd336('0x17')]['order']||null:null,'group':db['CmHopper'][_0xd336('0x48')],'transaction':_0x4e92ee,'lock':_0x4e92ee[_0xd336('0x2f')]['UPDATE'],'include':_0x12894a[_0xd336('0x17')]?_0x12894a[_0xd336('0x17')][_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x12894a[_0xd336('0x17')]['include'],function(_0x594aea){return{'model':db[_0x594aea[_0xd336('0x1d')]],'as':_0x594aea['as'],'attributes':_0x594aea[_0xd336('0x1a')],'include':_0x594aea[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x594aea[_0xd336('0x1c')],function(_0x1d9809){return{'model':db[_0x1d9809['model']],'as':_0x1d9809['as'],'attributes':_0x1d9809[_0xd336('0x1a')],'include':_0x1d9809[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x1d9809[_0xd336('0x1c')],function(_0x54f14a){return{'model':db[_0x54f14a[_0xd336('0x1d')]],'as':_0x54f14a['as'],'attributes':_0x54f14a[_0xd336('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd336('0x21')](function(_0x376c1c){var _0x3b619e=[];for(var _0xca6ec4=0x0;_0xca6ec4<_0x376c1c[_0xd336('0x34')];_0xca6ec4+=0x1){_0x3b619e[_0xd336('0x35')](_0x376c1c[_0xca6ec4][_0xd336('0x26')](_0x12894a[_0xd336('0x24')],{'transaction':_0x4e92ee}));}return BPromise[_0xd336('0x37')](_0x3b619e);});})[_0xd336('0x21')](function(_0x16d9b3){logger[_0xd336('0xa')](_0xd336('0x49'),_0x12894a);logger[_0xd336('0xd')](_0xd336('0x49'),_0x12894a,JSON[_0xd336('0xf')](_0x16d9b3));_0x1b47da(_0x16d9b3);})[_0xd336('0x13')](function(_0x27d751){logger[_0xd336('0x10')](_0xd336('0x49'),_0x27d751[_0xd336('0x11')],_0x12894a);_0x24dad4(_0x27ce94[_0xd336('0x10')](0x1f4,_0x27d751[_0xd336('0x11')]));});});});};exports[_0xd336('0x4a')]=function(_0x19ef1f){var _0x32c792=this;return new Promise(function(_0x11b9ab,_0x4e9caa){db[_0xd336('0x2b')][_0xd336('0x2c')]()[_0xd336('0x21')](function(_0x1e3c4b){return db['CmHopper'][_0xd336('0x16')]({'raw':_0x19ef1f['options']?_0x19ef1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x19ef1f[_0xd336('0x17')]?_0x19ef1f[_0xd336('0x17')][_0xd336('0x19')]||null:null,'attributes':_0x19ef1f[_0xd336('0x17')]?_0x19ef1f[_0xd336('0x17')][_0xd336('0x1a')]||null:null,'limit':_0x19ef1f['options']?_0x19ef1f[_0xd336('0x17')][_0xd336('0x1b')]||null:null,'include':_0x19ef1f[_0xd336('0x17')]?_0x19ef1f['options'][_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x19ef1f[_0xd336('0x17')][_0xd336('0x1c')],function(_0x1b295c){return{'model':db[_0x1b295c[_0xd336('0x1d')]],'as':_0x1b295c['as'],'attributes':_0x1b295c['as']==='Contact'?_[_0xd336('0x30')](_0x1e3c4b):_0x1b295c['attributes'],'include':_0x1b295c[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x1b295c[_0xd336('0x1c')],function(_0x383c82){return{'model':db[_0x383c82[_0xd336('0x1d')]],'as':_0x383c82['as'],'attributes':_0x383c82[_0xd336('0x1a')],'include':_0x383c82[_0xd336('0x1c')]?_[_0xd336('0x1e')](_0x383c82[_0xd336('0x1c')],function(_0x24b2fd){return{'model':db[_0x24b2fd[_0xd336('0x1d')]],'as':_0x24b2fd['as'],'attributes':_0x24b2fd[_0xd336('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd336('0x21')](function(_0x112640){logger[_0xd336('0xa')]('GetCmHopper',_0x19ef1f);logger[_0xd336('0xd')]('GetCmHopper',_0x19ef1f,JSON[_0xd336('0xf')](_0x112640));_0x11b9ab(_0x112640);})[_0xd336('0x13')](function(_0x2af045){logger[_0xd336('0x10')](_0xd336('0x14'),_0x2af045['message'],_0x19ef1f);_0x4e9caa(_0x32c792[_0xd336('0x10')](0x1f4,_0x2af045[_0xd336('0x11')]));});});});};exports[_0xd336('0x4b')]=function(_0x1c761c){var _0xfe149=this;return new Promise(function(_0x2183e0,_0x482911){return db[_0xd336('0x2b')][_0xd336('0x4c')]({'raw':!![],'where':{'phone':_0x1c761c[_0xd336('0x17')]['where'][_0xd336('0x4d')]},'attributes':['id',_0xd336('0x4e')],'order':[['id',_0xd336('0x4f')]]})[_0xd336('0x21')](function(_0x22a30c){logger[_0xd336('0xa')](_0xd336('0x50'),_0x1c761c);logger[_0xd336('0xd')]('getContactByPhone',_0x1c761c,JSON[_0xd336('0xf')](_0x22a30c));_0x2183e0(_0x22a30c);})[_0xd336('0x13')](function(_0x1d029c){logger[_0xd336('0x10')]('getContactByPhone',_0x1d029c['message'],_0x1c761c);_0x482911(_0xfe149['error'](0x1f4,_0x1d029c[_0xd336('0x11')]));});});};exports[_0xd336('0x51')]=function(_0x45d44d){var _0x408a1e=this;return new Promise(function(_0x572768,_0x38fc3b){return db[_0xd336('0x2d')]['transaction'](function(_0x3ab1b0){return db[_0xd336('0x15')][_0xd336('0x26')]({'active':![]},{'where':{},'transaction':_0x3ab1b0})[_0xd336('0x21')](function(_0x5b23be){logger[_0xd336('0xa')](_0xd336('0x51'),_0x45d44d);logger[_0xd336('0xd')](_0xd336('0x51'),_0x45d44d,JSON['stringify'](_0x5b23be));_0x572768(_0x5b23be);})['catch'](function(_0x468ff5){logger[_0xd336('0x10')](_0xd336('0x51'),_0x468ff5['message'],_0x45d44d);_0x38fc3b(_0x408a1e[_0xd336('0x10')](0x1f4,_0x468ff5[_0xd336('0x11')]));});});});};exports[_0xd336('0x52')]=function(_0x1c9db7){var _0x130791=this;var _0x1491fa=_0x1c9db7[_0xd336('0x24')][_0xd336('0x19')][_0xd336('0x53')];var _0xe1ac7b=_0x1c9db7[_0xd336('0x24')][_0xd336('0x19')][_0xd336('0x54')];var _0xacdcc4=_0x1c9db7[_0xd336('0x24')]['where'][_0xd336('0x55')];return new Promise(function(_0x382303,_0xe401f){return db[_0xd336('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x1491fa},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xd336('0x41')](_0xd336('0x56')+_0xe1ac7b+_0xd336('0x57')),'$gt':db['sequelize'][_0xd336('0x41')](_0xd336('0x58'))}},'UserId':{'$in':_0xacdcc4}},'include':[{'model':db['CmContact'],'as':_0xd336('0x59')},{'model':db['User'],'as':_0xd336('0x31'),'attributes':['id','name',_0xd336('0x33')]},{'model':db[_0xd336('0x5a')],'as':'List'}]})[_0xd336('0x21')](function(_0x55fe46){if(_0x55fe46[_0xd336('0x34')]>0x0){return db[_0xd336('0x2d')][_0xd336('0x3c')](function(_0x1ee0ec){return db[_0xd336('0x15')][_0xd336('0x26')]({'recallmeNotifiedDate':db['sequelize'][_0xd336('0x41')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x55fe46,'id')}},'transaction':_0x1ee0ec})['then'](function(){_0x382303(_0x55fe46);})['catch'](function(_0xd01a47){logger['error']('CmHopperHandlePreviewRecallNotifications',_0xd01a47['message'],_0x1c9db7);_0xe401f(_0x130791[_0xd336('0x10')](0x1f4,_0xd01a47[_0xd336('0x11')]));});})['catch'](function(_0x4a0a1f){logger[_0xd336('0x10')](_0xd336('0x52'),_0x4a0a1f[_0xd336('0x11')],_0x1c9db7);_0xe401f(_0x130791[_0xd336('0x10')](0x1f4,_0x4a0a1f[_0xd336('0x11')]));});}else{_0x382303(_0x55fe46);}});});}; \ No newline at end of file +var _0xaa1b=['transaction','order','LOCK','UPDATE','Contact','Agent','name','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','GetCmHopperPreview','keys','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','moment','../../mysqldb','rpc','jayson/promise','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize'];(function(_0x33ccd1,_0x140b6b){var _0x35367e=function(_0x571e9c){while(--_0x571e9c){_0x33ccd1['push'](_0x33ccd1['shift']());}};_0x35367e(++_0x140b6b);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var moment=require(_0xbaa1('0x2'));var BPromise=require('bluebird');var db=require(_0xbaa1('0x3'))['db'];var logger=require('../../config/logger')(_0xbaa1('0x4'));var jayson=require(_0xbaa1('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ceeaa,_0xc14e75,_0x27b99c){return new BPromise(function(_0x4a5735,_0x22516a){return client['request'](_0x5ceeaa,_0x27b99c)[_0xbaa1('0x6')](function(_0x15b968){logger[_0xbaa1('0x7')](_0xbaa1('0x8'),_0xc14e75,_0xbaa1('0x9'));logger[_0xbaa1('0xa')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc14e75,_0xbaa1('0x9'),JSON[_0xbaa1('0xb')](_0x15b968));if(_0x15b968[_0xbaa1('0xc')]){if(_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xd')]===0x1f4){logger[_0xbaa1('0xc')](_0xbaa1('0x8'),_0xc14e75,_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xe')]);return _0x22516a(_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xe')]);}logger[_0xbaa1('0xc')]('CmHopper,\x20%s,\x20%s',_0xc14e75,_0x15b968['error']['message']);return _0x4a5735(_0x15b968['error'][_0xbaa1('0xe')]);}else{logger[_0xbaa1('0x7')](_0xbaa1('0x8'),_0xc14e75,_0xbaa1('0x9'));_0x4a5735(_0x15b968[_0xbaa1('0xf')][_0xbaa1('0xe')]);}})[_0xbaa1('0x10')](function(_0xdbaa8b){logger[_0xbaa1('0xc')](_0xbaa1('0x8'),_0xc14e75,_0xdbaa8b);_0x22516a(_0xdbaa8b);});});}exports[_0xbaa1('0x11')]=function(_0x42f360){var _0x449dfc=this;return new Promise(function(_0x16725c,_0xa9883f){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x42f360['options']?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null,'include':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x18')]?_['map'](_0x42f360['options'][_0xbaa1('0x18')],function(_0x24427a){return{'model':db[_0x24427a[_0xbaa1('0x19')]],'as':_0x24427a['as'],'attributes':_0x24427a[_0xbaa1('0x16')],'include':_0x24427a[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x24427a['include'],function(_0x243eeb){return{'model':db[_0x243eeb[_0xbaa1('0x19')]],'as':_0x243eeb['as'],'attributes':_0x243eeb[_0xbaa1('0x16')],'include':_0x243eeb[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x243eeb[_0xbaa1('0x18')],function(_0x39e3ce){return{'model':db[_0x39e3ce[_0xbaa1('0x19')]],'as':_0x39e3ce['as'],'attributes':_0x39e3ce[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b80a4){logger[_0xbaa1('0x7')](_0xbaa1('0x11'),_0x42f360);logger[_0xbaa1('0xa')](_0xbaa1('0x11'),_0x42f360,JSON[_0xbaa1('0xb')](_0x2b80a4));_0x16725c(_0x2b80a4);})['catch'](function(_0x49803c){logger[_0xbaa1('0xc')](_0xbaa1('0x11'),_0x49803c[_0xbaa1('0xe')],_0x42f360);_0xa9883f(_0x449dfc['error'](0x1f4,_0x49803c[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x1b')]=function(_0x4f3e27){var _0x1312d2=this;return new Promise(function(_0x57a4b4,_0x158437){return db[_0xbaa1('0x12')][_0xbaa1('0x1c')]({'raw':_0x4f3e27['options']?_0x4f3e27['options'][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')]['attributes']||null:null,'include':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')][_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x4f3e27['options'][_0xbaa1('0x18')],function(_0x584ca6){return{'model':db[_0x584ca6[_0xbaa1('0x19')]],'as':_0x584ca6['as'],'attributes':_0x584ca6[_0xbaa1('0x16')],'include':_0x584ca6[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x584ca6['include'],function(_0x2cf50a){return{'model':db[_0x2cf50a[_0xbaa1('0x19')]],'as':_0x2cf50a['as'],'attributes':_0x2cf50a[_0xbaa1('0x16')],'include':_0x2cf50a['include']?_[_0xbaa1('0x1a')](_0x2cf50a[_0xbaa1('0x18')],function(_0x5e093e){return{'model':db[_0x5e093e[_0xbaa1('0x19')]],'as':_0x5e093e['as'],'attributes':_0x5e093e[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0x4837cc){logger[_0xbaa1('0x7')]('ShowCmHopper',_0x4f3e27);logger['debug'](_0xbaa1('0x1b'),_0x4f3e27,JSON['stringify'](_0x4837cc));_0x57a4b4(_0x4837cc);})[_0xbaa1('0x10')](function(_0x19328f){logger[_0xbaa1('0xc')]('ShowCmHopper',_0x19328f[_0xbaa1('0xe')],_0x4f3e27);_0x158437(_0x1312d2[_0xbaa1('0xc')](0x1f4,_0x19328f['message']));});});};exports[_0xbaa1('0x1e')]=function(_0x46cff8){var _0x2ffe91=this;return new Promise(function(_0x314001,_0x203fb1){return db[_0xbaa1('0x12')][_0xbaa1('0x1f')](_0x46cff8[_0xbaa1('0x20')],{'raw':_0x46cff8['options']?_0x46cff8[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xbaa1('0x6')](function(_0x3ba6bf){logger[_0xbaa1('0x7')]('CreateCmHopper',_0x46cff8);logger[_0xbaa1('0xa')]('CreateCmHopper',_0x46cff8,JSON['stringify'](_0x3ba6bf));_0x314001(_0x3ba6bf);})[_0xbaa1('0x10')](function(_0x5245a9){logger[_0xbaa1('0xc')]('CreateCmHopper',_0x5245a9['message'],_0x46cff8);_0x203fb1(_0x2ffe91[_0xbaa1('0xc')](0x1f4,_0x5245a9[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x21')]=function(_0x2443e3){var _0x2c0984=this;return new Promise(function(_0x28cde4,_0x309950){return db[_0xbaa1('0x12')][_0xbaa1('0x22')](_0x2443e3[_0xbaa1('0x20')],{'raw':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3['options']['where']||null:null,'attributes':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null})[_0xbaa1('0x6')](function(_0xe83273){logger['info'](_0xbaa1('0x21'),_0x2443e3);logger[_0xbaa1('0x7')](_0xbaa1('0x23'),JSON[_0xbaa1('0xb')](_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x15')]),_0x2443e3['body']['active']);logger[_0xbaa1('0xa')]('UpdateCmHopper',_0x2443e3,JSON[_0xbaa1('0xb')](_0xe83273));_0x28cde4(_0xe83273);})[_0xbaa1('0x10')](function(_0x22f4db){logger['error'](_0xbaa1('0x21'),_0x22f4db[_0xbaa1('0xe')],_0x2443e3);_0x309950(_0x2c0984[_0xbaa1('0xc')](0x1f4,_0x22f4db[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x24')]=function(_0x5f54cf){var _0x550073=this;return new Promise(function(_0x32677a,_0x2627ae){return db[_0xbaa1('0x12')][_0xbaa1('0x25')]({'where':_0x5f54cf[_0xbaa1('0x14')]?_0x5f54cf[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null})[_0xbaa1('0x6')](function(_0xa4dd12){logger[_0xbaa1('0x7')](_0xbaa1('0x24'),_0x5f54cf);logger['debug'](_0xbaa1('0x24'),_0x5f54cf,JSON[_0xbaa1('0xb')](_0xa4dd12));_0x32677a(_0xa4dd12);})[_0xbaa1('0x10')](function(_0x216336){logger[_0xbaa1('0xc')](_0xbaa1('0x24'),_0x216336[_0xbaa1('0xe')],_0x5f54cf);_0x2627ae(_0x550073['error'](0x1f4,_0x216336[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x26')]=function(_0x56aeda){var _0x18e207=this;return new Promise(function(_0xbac747,_0x6e733a){return db[_0xbaa1('0x27')]['describe']()[_0xbaa1('0x6')](function(_0x4d70f1){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x5afdab){return db[_0xbaa1('0x12')]['findAll']({'where':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')]['limit']||null:null,'order':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x2a')]||null:null,'transaction':_0x5afdab,'lock':_0x5afdab[_0xbaa1('0x2b')][_0xbaa1('0x2c')],'include':[{'model':db[_0xbaa1('0x27')],'as':_0xbaa1('0x2d'),'attributes':_['keys'](_0x4d70f1)},{'model':db['User'],'as':_0xbaa1('0x2e'),'attributes':['id',_0xbaa1('0x2f'),'voicePause']}]})[_0xbaa1('0x6')](function(_0x2cea6b){var _0x3eca07=[];var _0x51097c=[];for(var _0x207b6f=0x0;_0x207b6f<_0x2cea6b[_0xbaa1('0x30')];_0x207b6f+=0x1){var _0x2dd2bd=_0x2cea6b[_0x207b6f][_0xbaa1('0x31')];if(_0x2dd2bd===null){_0x3eca07[_0xbaa1('0x32')](_0x2cea6b[_0x207b6f][_0xbaa1('0x22')](_0x56aeda['body'],{'transaction':_0x5afdab}));}else if(!_0x51097c[_0xbaa1('0x33')](_0x2dd2bd)){_0x51097c[_0xbaa1('0x32')](_0x2dd2bd);_0x3eca07['push'](_0x2cea6b[_0x207b6f]['update'](_0x56aeda[_0xbaa1('0x20')],{'transaction':_0x5afdab}));}}return BPromise['all'](_0x3eca07);});})[_0xbaa1('0x6')](function(_0x2c56ef){logger[_0xbaa1('0x7')]('GetContactDialer',_0x56aeda);if(_0x2c56ef[_0xbaa1('0x30')]>0x0){logger[_0xbaa1('0x7')](_0xbaa1('0x34'),_0x2c56ef[0x0][_0xbaa1('0x35')]['id'],_0x2c56ef[0x0]['dataValues'][_0xbaa1('0x36')],_0x2c56ef[0x0][_0xbaa1('0x35')][_0xbaa1('0x37')]);}logger[_0xbaa1('0xa')](_0xbaa1('0x26'),_0x56aeda,JSON[_0xbaa1('0xb')](_0x2c56ef));_0xbac747(_0x2c56ef);})[_0xbaa1('0x10')](function(_0x3585cf){logger[_0xbaa1('0xc')](_0xbaa1('0x26'),_0x3585cf[_0xbaa1('0xe')],_0x56aeda);_0x6e733a(_0x18e207[_0xbaa1('0xc')](0x1f4,_0x3585cf[_0xbaa1('0xe')]));});});});};exports['MoveContactManagedDialer']=function(_0x42e6af){var _0x1aa65a=this;return new Promise(function(_0x17675a,_0x5a1cb4){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x424b4e){return db[_0xbaa1('0x38')][_0xbaa1('0x1f')](_0x42e6af[_0xbaa1('0x20')],{'raw':_0x42e6af[_0xbaa1('0x14')]?_0x42e6af[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'transaction':_0x424b4e})[_0xbaa1('0x6')](function(){logger[_0xbaa1('0x7')](_0xbaa1('0x39'),JSON[_0xbaa1('0xb')](_0x42e6af['options']['where']),_0x42e6af[_0xbaa1('0x14')][_0xbaa1('0x15')][_0xbaa1('0x37')]);return db[_0xbaa1('0x12')][_0xbaa1('0x25')]({'where':_0x42e6af[_0xbaa1('0x14')]?_0x42e6af['options'][_0xbaa1('0x15')]||null:null,'transaction':_0x424b4e});});})[_0xbaa1('0x6')](function(_0x5b2c22){logger['info']('MoveContactManagedDialer',_0x42e6af);logger[_0xbaa1('0xa')]('MoveContactManagedDialer',_0x42e6af,JSON[_0xbaa1('0xb')](_0x5b2c22));_0x17675a(_0x5b2c22);})['catch'](function(_0x7c6f20){logger[_0xbaa1('0xc')](_0xbaa1('0x3a'),_0x7c6f20[_0xbaa1('0xe')],_0x42e6af);_0x5a1cb4(_0x1aa65a['error'](0x1f4,_0x7c6f20[_0xbaa1('0xe')]));});});};exports['CountReScheduled']=function(_0x3be487){var _0x455f54=this;return new Promise(function(_0x1432b9,_0x3ec6a5){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x3be487['options']?_0x3be487[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3be487[_0xbaa1('0x14')]?_0x3be487[_0xbaa1('0x14')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xbaa1('0x3b'),db[_0xbaa1('0x28')]['fn']('IF',db['sequelize'][_0xbaa1('0x3c')]('`scheduledat`\x20>=\x20'+util['format'](_0xbaa1('0x3d'),moment()[_0xbaa1('0x3e')](_0xbaa1('0x3f')))+_0xbaa1('0x40')))),'contactsRescheduled']]})['then'](function(_0x240716){logger['info'](_0xbaa1('0x41'),_0x3be487);logger[_0xbaa1('0xa')]('CountReScheduled',_0x3be487,JSON[_0xbaa1('0xb')](_0x240716));_0x1432b9(_0x240716);})[_0xbaa1('0x10')](function(_0xcc1022){logger[_0xbaa1('0xc')](_0xbaa1('0x41'),_0xcc1022['message'],_0x3be487);_0x3ec6a5(_0x455f54[_0xbaa1('0xc')](0x1f4,_0xcc1022['message']));});});};exports[_0xbaa1('0x42')]=function(_0x153628){var _0x456f3f=this;return new Promise(function(_0x209ee2,_0x55df63){return db[_0xbaa1('0x27')][_0xbaa1('0x43')]()[_0xbaa1('0x6')](function(_0x5686a8){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x41a41e){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'where':_0x153628['options']?_0x153628['options'][_0xbaa1('0x15')]||null:null,'attributes':_0x153628[_0xbaa1('0x14')]?_0x153628['options'][_0xbaa1('0x16')]||null:null,'limit':0x1,'order':_0x153628[_0xbaa1('0x14')]?_0x153628['options']['order']||null:null,'group':db[_0xbaa1('0x12')][_0xbaa1('0x31')],'transaction':_0x41a41e,'lock':_0x41a41e['LOCK'][_0xbaa1('0x2c')],'include':_0x153628[_0xbaa1('0x14')]?_0x153628['options']['include']?_[_0xbaa1('0x1a')](_0x153628[_0xbaa1('0x14')][_0xbaa1('0x18')],function(_0x306e66){return{'model':db[_0x306e66[_0xbaa1('0x19')]],'as':_0x306e66['as'],'attributes':_0x306e66[_0xbaa1('0x16')],'include':_0x306e66['include']?_['map'](_0x306e66['include'],function(_0x1989cf){return{'model':db[_0x1989cf[_0xbaa1('0x19')]],'as':_0x1989cf['as'],'attributes':_0x1989cf[_0xbaa1('0x16')],'include':_0x1989cf[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x1989cf['include'],function(_0x288b3b){return{'model':db[_0x288b3b[_0xbaa1('0x19')]],'as':_0x288b3b['as'],'attributes':_0x288b3b[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0x2212be){var _0x44b751=[];for(var _0x18ffe9=0x0;_0x18ffe9<_0x2212be[_0xbaa1('0x30')];_0x18ffe9+=0x1){_0x44b751['push'](_0x2212be[_0x18ffe9][_0xbaa1('0x22')](_0x153628[_0xbaa1('0x20')],{'transaction':_0x41a41e}));}return BPromise['all'](_0x44b751);});})[_0xbaa1('0x6')](function(_0x411e5a){logger[_0xbaa1('0x7')](_0xbaa1('0x42'),_0x153628);logger[_0xbaa1('0xa')](_0xbaa1('0x42'),_0x153628,JSON[_0xbaa1('0xb')](_0x411e5a));_0x209ee2(_0x411e5a);})['catch'](function(_0x82e9a5){logger[_0xbaa1('0xc')](_0xbaa1('0x42'),_0x82e9a5[_0xbaa1('0xe')],_0x153628);_0x55df63(_0x456f3f[_0xbaa1('0xc')](0x1f4,_0x82e9a5['message']));});});});};exports[_0xbaa1('0x44')]=function(_0x19327f){var _0x156997=this;return new Promise(function(_0x5068d8,_0x4fdc80){db['CmContact']['describe']()[_0xbaa1('0x6')](function(_0x510281){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'where':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x19327f['options']?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null,'include':_0x19327f[_0xbaa1('0x14')]?_0x19327f['options'][_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x19327f['options'][_0xbaa1('0x18')],function(_0x44737c){return{'model':db[_0x44737c['model']],'as':_0x44737c['as'],'attributes':_0x44737c['as']===_0xbaa1('0x2d')?_[_0xbaa1('0x45')](_0x510281):_0x44737c[_0xbaa1('0x16')],'include':_0x44737c[_0xbaa1('0x18')]?_['map'](_0x44737c[_0xbaa1('0x18')],function(_0x6e15d4){return{'model':db[_0x6e15d4['model']],'as':_0x6e15d4['as'],'attributes':_0x6e15d4['attributes'],'include':_0x6e15d4[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x6e15d4['include'],function(_0x49b4a2){return{'model':db[_0x49b4a2['model']],'as':_0x49b4a2['as'],'attributes':_0x49b4a2[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0xaa3603){logger['info']('GetCmHopper',_0x19327f);logger['debug'](_0xbaa1('0x11'),_0x19327f,JSON[_0xbaa1('0xb')](_0xaa3603));_0x5068d8(_0xaa3603);})['catch'](function(_0x505b21){logger[_0xbaa1('0xc')](_0xbaa1('0x11'),_0x505b21[_0xbaa1('0xe')],_0x19327f);_0x4fdc80(_0x156997[_0xbaa1('0xc')](0x1f4,_0x505b21[_0xbaa1('0xe')]));});});});};exports['GetContactByPhone']=function(_0x2619cd){var _0x3708b6=this;return new Promise(function(_0x4fc6da,_0x293458){return db[_0xbaa1('0x27')][_0xbaa1('0x46')]({'raw':!![],'where':{'phone':_0x2619cd[_0xbaa1('0x14')][_0xbaa1('0x15')]['phone']},'attributes':['id',_0xbaa1('0x47')],'order':[['id',_0xbaa1('0x48')]]})[_0xbaa1('0x6')](function(_0x3e9a91){logger['info'](_0xbaa1('0x49'),_0x2619cd);logger[_0xbaa1('0xa')](_0xbaa1('0x49'),_0x2619cd,JSON[_0xbaa1('0xb')](_0x3e9a91));_0x4fc6da(_0x3e9a91);})[_0xbaa1('0x10')](function(_0x15fb4d){logger[_0xbaa1('0xc')](_0xbaa1('0x49'),_0x15fb4d[_0xbaa1('0xe')],_0x2619cd);_0x293458(_0x3708b6[_0xbaa1('0xc')](0x1f4,_0x15fb4d[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x4a')]=function(_0x593c96){var _0xea8b67=this;return new Promise(function(_0x1f5351,_0x7f86e){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x479f39){return db[_0xbaa1('0x12')][_0xbaa1('0x22')]({'active':![]},{'where':{},'transaction':_0x479f39})[_0xbaa1('0x6')](function(_0x53515d){logger[_0xbaa1('0x7')](_0xbaa1('0x4a'),_0x593c96);logger[_0xbaa1('0xa')](_0xbaa1('0x4a'),_0x593c96,JSON[_0xbaa1('0xb')](_0x53515d));_0x1f5351(_0x53515d);})['catch'](function(_0x29fe90){logger[_0xbaa1('0xc')](_0xbaa1('0x4a'),_0x29fe90['message'],_0x593c96);_0x7f86e(_0xea8b67['error'](0x1f4,_0x29fe90[_0xbaa1('0xe')]));});});});};exports[_0xbaa1('0x4b')]=function(_0x35e555){var _0x1f3b72=this;var _0x561f25=_0x35e555['body'][_0xbaa1('0x15')][_0xbaa1('0x4c')];var _0x50de9d=_0x35e555['body'][_0xbaa1('0x15')]['interval'];var _0x31ab82=_0x35e555[_0xbaa1('0x20')][_0xbaa1('0x15')]['availableAgentsIds'];return new Promise(function(_0x3b9c15,_0x10a4dc){return db[_0xbaa1('0x12')]['findAll']({'where':{'voiceQueueId':{'$in':_0x561f25},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4d')+_0x50de9d+_0xbaa1('0x4e')),'$gt':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4f'))}},'UserId':{'$in':_0x31ab82}},'include':[{'model':db['CmContact'],'as':_0xbaa1('0x2d')},{'model':db[_0xbaa1('0x50')],'as':'Agent','attributes':['id',_0xbaa1('0x2f'),'voicePause']},{'model':db[_0xbaa1('0x51')],'as':_0xbaa1('0x52')}]})[_0xbaa1('0x6')](function(_0x118bf5){if(_0x118bf5[_0xbaa1('0x30')]>0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x49e25a){return db[_0xbaa1('0x12')]['update']({'recallmeNotifiedDate':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4f'))},{'where':{'id':{'$in':_[_0xbaa1('0x1a')](_0x118bf5,'id')}},'transaction':_0x49e25a})[_0xbaa1('0x6')](function(){_0x3b9c15(_0x118bf5);})[_0xbaa1('0x10')](function(_0x4f18c1){logger[_0xbaa1('0xc')]('CmHopperHandlePreviewRecallNotifications',_0x4f18c1[_0xbaa1('0xe')],_0x35e555);_0x10a4dc(_0x1f3b72[_0xbaa1('0xc')](0x1f4,_0x4f18c1['message']));});})[_0xbaa1('0x10')](function(_0x401667){logger[_0xbaa1('0xc')]('CmHopperHandlePreviewRecallNotifications',_0x401667[_0xbaa1('0xe')],_0x35e555);_0x10a4dc(_0x1f3b72[_0xbaa1('0xc')](0x1f4,_0x401667[_0xbaa1('0xe')]));});}else{_0x3b9c15(_0x118bf5);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 23e3b95..942dd8e 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 _0x6e58=['update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','put'];(function(_0x1774c9,_0x168d52){var _0x1f7db8=function(_0x1c8403){while(--_0x1c8403){_0x1774c9['push'](_0x1774c9['shift']());}};_0x1f7db8(++_0x168d52);}(_0x6e58,0x153));var _0x86e5=function(_0x162674,_0xe81d6c){_0x162674=_0x162674-0x0;var _0x3c802e=_0x6e58[_0x162674];return _0x3c802e;};'use strict';var express=require(_0x86e5('0x0'));var router=express[_0x86e5('0x1')]();var auth=require(_0x86e5('0x2'));var controller=require(_0x86e5('0x3'));router[_0x86e5('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x86e5('0x5'),auth[_0x86e5('0x6')](),controller[_0x86e5('0x7')]);router[_0x86e5('0x4')](_0x86e5('0x8'),auth[_0x86e5('0x6')](),controller[_0x86e5('0x9')]);router[_0x86e5('0x4')](_0x86e5('0xa'),auth[_0x86e5('0x6')](),controller[_0x86e5('0xb')]);router[_0x86e5('0x4')](_0x86e5('0xc'),auth[_0x86e5('0x6')](),controller[_0x86e5('0xd')]);router[_0x86e5('0x4')](_0x86e5('0xe'),auth['isAuthenticated'](),controller[_0x86e5('0xf')]);router[_0x86e5('0x10')]('/',auth[_0x86e5('0x6')](),controller['create']);router[_0x86e5('0x10')](_0x86e5('0x11'),auth[_0x86e5('0x6')](),controller[_0x86e5('0x12')]);router[_0x86e5('0x10')](_0x86e5('0x13'),auth[_0x86e5('0x6')](),controller['getTimezone']);router[_0x86e5('0x14')](_0x86e5('0xc'),auth['isAuthenticated'](),controller[_0x86e5('0x15')]);router[_0x86e5('0x16')](_0x86e5('0xc'),auth[_0x86e5('0x6')](),controller['destroy']);module[_0x86e5('0x17')]=router; \ No newline at end of file +var _0x87f8=['/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','/timezones','getTimezones','/:id','show'];(function(_0x94c271,_0x2a198f){var _0x5cad1e=function(_0x5eeca1){while(--_0x5eeca1){_0x94c271['push'](_0x94c271['shift']());}};_0x5cad1e(++_0x2a198f);}(_0x87f8,0x11f));var _0x887f=function(_0x51b707,_0xdd6c8c){_0x51b707=_0x51b707-0x0;var _0x2b679e=_0x87f8[_0x51b707];return _0x2b679e;};'use strict';var express=require(_0x887f('0x0'));var router=express[_0x887f('0x1')]();var auth=require(_0x887f('0x2'));var controller=require(_0x887f('0x3'));router[_0x887f('0x4')]('/',auth[_0x887f('0x5')](),controller[_0x887f('0x6')]);router[_0x887f('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x887f('0x4')](_0x887f('0x7'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x887f('0x8'),auth['isAuthenticated'](),controller[_0x887f('0x9')]);router[_0x887f('0x4')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller[_0x887f('0xb')]);router['get'](_0x887f('0xc'),auth['isAuthenticated'](),controller[_0x887f('0xd')]);router[_0x887f('0xe')]('/',auth[_0x887f('0x5')](),controller[_0x887f('0xf')]);router[_0x887f('0xe')](_0x887f('0x10'),auth['isAuthenticated'](),controller[_0x887f('0x11')]);router[_0x887f('0xe')]('/timezone',auth[_0x887f('0x5')](),controller[_0x887f('0x12')]);router[_0x887f('0x13')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller[_0x887f('0x14')]);router[_0x887f('0x15')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller['destroy']);module[_0x887f('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7491f0d..afd6250 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 _0x728e=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x728e,0x1c3));var _0xe728=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x728e[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xe728('0x0'));var Sequelize=require(_0xe728('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xe728('0x2')]},'phone':{'type':Sequelize[_0xe728('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xe728('0x4'))},'countbusyretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe728('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ca0=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x3e71f4,_0x243f07){var _0x3a144f=function(_0x5e8f7b){while(--_0x5e8f7b){_0x3e71f4['push'](_0x3e71f4['shift']());}};_0x3a144f(++_0x243f07);}(_0x7ca0,0x19d));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x07ca('0x0'));var Sequelize=require(_0x07ca('0x1'));module[_0x07ca('0x2')]={'CmHopperId':{'type':Sequelize[_0x07ca('0x3')]},'phone':{'type':Sequelize[_0x07ca('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x07ca('0x5')],'defaultValue':moment()[_0x07ca('0x6')](_0x07ca('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x07ca('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 6aed841..00cd282 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 _0xf990=['offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf990,0xce));var _0x0f99=function(_0x3e6a70,_0x3b5901){_0x3e6a70=_0x3e6a70-0x0;var _0x2614f6=_0xf990[_0x3e6a70];return _0x2614f6;};'use strict';var emlformat=require(_0x0f99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f99('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f99('0x2'));var moment=require('moment');var BPromise=require(_0x0f99('0x3'));var Mustache=require(_0x0f99('0x4'));var util=require('util');var path=require(_0x0f99('0x5'));var sox=require('sox');var csv=require(_0x0f99('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f99('0x7'));var _=require(_0x0f99('0x8'));var squel=require(_0x0f99('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f99('0x6'));var querystring=require('querystring');var Papa=require(_0x0f99('0xa'));var Redis=require(_0x0f99('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x0f99('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0f99('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0x0f99('0xe'));var db=require(_0x0f99('0xf'))['db'];function respondWithStatusCode(_0x6923f8,_0x4fcd3a){_0x4fcd3a=_0x4fcd3a||0xcc;return function(_0x3bd148){if(_0x3bd148){return _0x6923f8[_0x0f99('0x10')](_0x4fcd3a);}return _0x6923f8[_0x0f99('0x11')](_0x4fcd3a)[_0x0f99('0x12')]();};}function respondWithResult(_0x3f540d,_0xc1e95){_0xc1e95=_0xc1e95||0xc8;return function(_0x37fce4){if(_0x37fce4){return _0x3f540d[_0x0f99('0x11')](_0xc1e95)['json'](_0x37fce4);}};}function respondWithFilteredResult(_0x59546e,_0x53e67a){return function(_0x56ed5f){if(_0x56ed5f){var _0x3cfddb=typeof _0x53e67a[_0x0f99('0x13')]===_0x0f99('0x14')&&typeof _0x53e67a[_0x0f99('0x15')]===_0x0f99('0x14');var _0x22501c=_0x56ed5f[_0x0f99('0x16')];var _0x15e86b=_0x3cfddb?0x0:_0x53e67a[_0x0f99('0x13')];var _0x206e5e=_0x3cfddb?_0x56ed5f['count']:_0x53e67a[_0x0f99('0x13')]+_0x53e67a[_0x0f99('0x15')];var _0x35db86;if(_0x206e5e>=_0x22501c){_0x206e5e=_0x22501c;_0x35db86=0xc8;}else{_0x35db86=0xce;}_0x59546e[_0x0f99('0x11')](_0x35db86);return _0x59546e['set'](_0x0f99('0x17'),_0x15e86b+'-'+_0x206e5e+'/'+_0x22501c)[_0x0f99('0x18')](_0x56ed5f);}return null;};}function patchUpdates(_0x30689f){return function(_0x4bae38){try{jsonpatch[_0x0f99('0x19')](_0x4bae38,_0x30689f,!![]);}catch(_0x4e1691){return BPromise[_0x0f99('0x1a')](_0x4e1691);}return _0x4bae38[_0x0f99('0x1b')]();};}function saveUpdates(_0x1e9810,_0x34f8b6){return function(_0x197c22){if(_0x197c22){return _0x197c22[_0x0f99('0x1c')](_0x1e9810)[_0x0f99('0x1d')](function(_0x542623){return _0x542623;});}return null;};}function removeEntity(_0x374f59,_0x599e60){return function(_0x42d727){if(_0x42d727){return _0x42d727['destroy']()['then'](function(){var _0x55c2b5=_0x42d727[_0x0f99('0x1e')]({'plain':!![]});var _0x5534ec=_0x0f99('0x1f');return db[_0x0f99('0x20')][_0x0f99('0x21')]({'where':{'type':_0x5534ec,'resourceId':_0x55c2b5['id']}})[_0x0f99('0x1d')](function(){return _0x42d727;});})[_0x0f99('0x1d')](function(){_0x374f59[_0x0f99('0x11')](0xcc)[_0x0f99('0x12')]();});}};}function handleEntityNotFound(_0x2eedf4,_0x191974){return function(_0x2dd633){if(!_0x2dd633){_0x2eedf4[_0x0f99('0x10')](0x194);}return _0x2dd633;};}function handleError(_0x30e8f3,_0x1121ab){_0x1121ab=_0x1121ab||0x1f4;return function(_0x819121){logger[_0x0f99('0x22')](_0x819121[_0x0f99('0x23')]);if(_0x819121[_0x0f99('0x24')]){delete _0x819121[_0x0f99('0x24')];}_0x30e8f3[_0x0f99('0x11')](_0x1121ab)['send'](_0x819121);};}exports['index']=function(_0x1154e4,_0x3834de){var _0x10be07={},_0x3a815d={},_0x585f71={'count':0x0,'rows':[]};var _0x2cecc3=_[_0x0f99('0x25')](db[_0x0f99('0x26')][_0x0f99('0x27')],function(_0x28040a){return{'name':_0x28040a[_0x0f99('0x28')],'type':_0x28040a['type']['key']};});_0x3a815d[_0x0f99('0x29')]=_[_0x0f99('0x25')](_0x2cecc3,_0x0f99('0x24'));_0x3a815d[_0x0f99('0x2a')]=_[_0x0f99('0x2b')](_0x1154e4[_0x0f99('0x2a')]);_0x3a815d[_0x0f99('0x2c')]=_[_0x0f99('0x2d')](_0x3a815d['model'],_0x3a815d['query']);_0x10be07['attributes']=_[_0x0f99('0x2d')](_0x3a815d['model'],qs[_0x0f99('0x2e')](_0x1154e4[_0x0f99('0x2a')][_0x0f99('0x2e')]));_0x10be07[_0x0f99('0x2f')]=_0x10be07[_0x0f99('0x2f')][_0x0f99('0x30')]?_0x10be07[_0x0f99('0x2f')]:_0x3a815d['model'];if(!_0x1154e4[_0x0f99('0x2a')]['hasOwnProperty'](_0x0f99('0x31'))){_0x10be07[_0x0f99('0x15')]=qs[_0x0f99('0x15')](_0x1154e4[_0x0f99('0x2a')][_0x0f99('0x15')]);_0x10be07[_0x0f99('0x13')]=qs[_0x0f99('0x13')](_0x1154e4[_0x0f99('0x2a')]['offset']);}_0x10be07[_0x0f99('0x32')]=qs[_0x0f99('0x33')](_0x1154e4[_0x0f99('0x2a')][_0x0f99('0x33')]);_0x10be07[_0x0f99('0x34')]=qs['filters'](_[_0x0f99('0x35')](_0x1154e4[_0x0f99('0x2a')],_0x3a815d[_0x0f99('0x2c')]),_0x2cecc3);if(_0x1154e4[_0x0f99('0x2a')]['filter']){_0x10be07[_0x0f99('0x34')]=_[_0x0f99('0x36')](_0x10be07[_0x0f99('0x34')],{'$or':_[_0x0f99('0x25')](_0x2cecc3,function(_0x1595fc){if(_0x1595fc[_0x0f99('0x37')]!==_0x0f99('0x38')){var _0x3dceec={};_0x3dceec[_0x1595fc[_0x0f99('0x24')]]={'$like':'%'+_0x1154e4['query'][_0x0f99('0x39')]+'%'};return _0x3dceec;}})});}_0x10be07=_[_0x0f99('0x36')]({},_0x10be07,_0x1154e4['options']);var _0x57b4b2={'where':_0x10be07[_0x0f99('0x34')]};return db[_0x0f99('0x26')]['count'](_0x57b4b2)['then'](function(_0x5acaa0){_0x585f71[_0x0f99('0x16')]=_0x5acaa0;if(_0x1154e4[_0x0f99('0x2a')][_0x0f99('0x3a')]){_0x10be07[_0x0f99('0x3b')]=[{'all':!![]}];}return db[_0x0f99('0x26')][_0x0f99('0x3c')](_0x10be07);})[_0x0f99('0x1d')](function(_0x4a64cf){_0x585f71[_0x0f99('0x3d')]=_0x4a64cf;return _0x585f71;})[_0x0f99('0x1d')](respondWithFilteredResult(_0x3834de,_0x10be07))[_0x0f99('0x3e')](handleError(_0x3834de,null));};exports[_0x0f99('0x3f')]=function(_0x3e268c,_0x3e7e4f){var _0x1ad234={'raw':!![],'where':{'id':_0x3e268c[_0x0f99('0x40')]['id']}},_0x52e732={};_0x52e732[_0x0f99('0x29')]=_[_0x0f99('0x2b')](db[_0x0f99('0x26')][_0x0f99('0x27')]);_0x52e732[_0x0f99('0x2a')]=_[_0x0f99('0x2b')](_0x3e268c[_0x0f99('0x2a')]);_0x52e732[_0x0f99('0x2c')]=_[_0x0f99('0x2d')](_0x52e732[_0x0f99('0x29')],_0x52e732['query']);_0x1ad234[_0x0f99('0x2f')]=_[_0x0f99('0x2d')](_0x52e732[_0x0f99('0x29')],qs[_0x0f99('0x2e')](_0x3e268c[_0x0f99('0x2a')]['fields']));_0x1ad234[_0x0f99('0x2f')]=_0x1ad234['attributes'][_0x0f99('0x30')]?_0x1ad234[_0x0f99('0x2f')]:_0x52e732[_0x0f99('0x29')];if(_0x3e268c['query']['includeAll']){_0x1ad234[_0x0f99('0x3b')]=[{'all':!![]}];}_0x1ad234=_[_0x0f99('0x36')]({},_0x1ad234,_0x3e268c[_0x0f99('0x41')]);return db[_0x0f99('0x26')]['find'](_0x1ad234)['then'](handleEntityNotFound(_0x3e7e4f,null))[_0x0f99('0x1d')](respondWithResult(_0x3e7e4f,null))[_0x0f99('0x3e')](handleError(_0x3e7e4f,null));};exports['create']=function(_0x1d05cb,_0x130466){return db[_0x0f99('0x26')]['create'](_0x1d05cb[_0x0f99('0x42')],{})[_0x0f99('0x1d')](function(_0x3ca970){var _0x340e77=_0x1d05cb[_0x0f99('0x43')][_0x0f99('0x1e')]({'plain':!![]});if(!_0x340e77)throw new Error(_0x0f99('0x44'));if(_0x340e77[_0x0f99('0x45')]===_0x0f99('0x43')){var _0x2bb858=_0x3ca970[_0x0f99('0x1e')]({'plain':!![]});var _0x455983=_0x0f99('0x1f');return db[_0x0f99('0x46')][_0x0f99('0x47')]({'where':{'name':_0x455983,'userProfileId':_0x340e77[_0x0f99('0x48')]},'raw':!![]})[_0x0f99('0x1d')](function(_0x3cf231){if(_0x3cf231&&_0x3cf231[_0x0f99('0x49')]===0x0){return db[_0x0f99('0x20')][_0x0f99('0x4a')]({'name':_0x2bb858['name'],'resourceId':_0x2bb858['id'],'type':_0x3cf231[_0x0f99('0x24')],'sectionId':_0x3cf231['id']},{})[_0x0f99('0x1d')](function(){return _0x3ca970;});}else{return _0x3ca970;}})['catch'](function(_0x2fb17b){logger[_0x0f99('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fb17b);throw _0x2fb17b;});}return _0x3ca970;})[_0x0f99('0x1d')](respondWithResult(_0x130466,0xc9))[_0x0f99('0x3e')](handleError(_0x130466,null));};exports[_0x0f99('0x1c')]=function(_0x34c600,_0xded083){if(_0x34c600[_0x0f99('0x42')]['id']){delete _0x34c600[_0x0f99('0x42')]['id'];}return db[_0x0f99('0x26')]['find']({'where':{'id':_0x34c600[_0x0f99('0x40')]['id']}})[_0x0f99('0x1d')](handleEntityNotFound(_0xded083,null))['then'](saveUpdates(_0x34c600['body'],null))[_0x0f99('0x1d')](respondWithResult(_0xded083,null))[_0x0f99('0x3e')](handleError(_0xded083,null));};exports['destroy']=function(_0x5c072e,_0x12773b){return db[_0x0f99('0x26')][_0x0f99('0x47')]({'where':{'id':_0x5c072e[_0x0f99('0x40')]['id']}})[_0x0f99('0x1d')](handleEntityNotFound(_0x12773b,null))[_0x0f99('0x1d')](removeEntity(_0x12773b,null))['catch'](handleError(_0x12773b,null));}; \ No newline at end of file +var _0x8884=['index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','send'];(function(_0x390da7,_0x180e6b){var _0x38c027=function(_0x58d7b3){while(--_0x58d7b3){_0x390da7['push'](_0x390da7['shift']());}};_0x38c027(++_0x180e6b);}(_0x8884,0xcd));var _0x4888=function(_0x41c315,_0x247d26){_0x41c315=_0x41c315-0x0;var _0x4ebd35=_0x8884[_0x41c315];return _0x4ebd35;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4888('0x0'));var jsonpatch=require(_0x4888('0x1'));var rp=require(_0x4888('0x2'));var moment=require(_0x4888('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4888('0x4'));var util=require(_0x4888('0x5'));var path=require(_0x4888('0x6'));var sox=require(_0x4888('0x7'));var csv=require(_0x4888('0x8'));var ejs=require(_0x4888('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4888('0xa'));var squel=require(_0x4888('0xb'));var crypto=require('crypto');var jsforce=require(_0x4888('0xc'));var deskjs=require(_0x4888('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4888('0xe'));var Papa=require(_0x4888('0xf'));var Redis=require(_0x4888('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4888('0x11'));var as=require(_0x4888('0x12'));var hardwareService=require(_0x4888('0x13'));var logger=require(_0x4888('0x14'))(_0x4888('0x15'));var utils=require(_0x4888('0x16'));var config=require(_0x4888('0x17'));var licenseUtil=require(_0x4888('0x18'));var db=require(_0x4888('0x19'))['db'];function respondWithStatusCode(_0x2fc607,_0x1049ea){_0x1049ea=_0x1049ea||0xcc;return function(_0x9ab1fa){if(_0x9ab1fa){return _0x2fc607[_0x4888('0x1a')](_0x1049ea);}return _0x2fc607[_0x4888('0x1b')](_0x1049ea)[_0x4888('0x1c')]();};}function respondWithResult(_0x595384,_0x1f1990){_0x1f1990=_0x1f1990||0xc8;return function(_0x4831eb){if(_0x4831eb){return _0x595384['status'](_0x1f1990)[_0x4888('0x1d')](_0x4831eb);}};}function respondWithFilteredResult(_0x5d67e4,_0x269a00){return function(_0x4475b0){if(_0x4475b0){var _0x2552af=typeof _0x269a00[_0x4888('0x1e')]===_0x4888('0x1f')&&typeof _0x269a00[_0x4888('0x20')]===_0x4888('0x1f');var _0x49b6b9=_0x4475b0[_0x4888('0x21')];var _0x320e5c=_0x2552af?0x0:_0x269a00[_0x4888('0x1e')];var _0x5bd95a=_0x2552af?_0x4475b0['count']:_0x269a00[_0x4888('0x1e')]+_0x269a00[_0x4888('0x20')];var _0x16b772;if(_0x5bd95a>=_0x49b6b9){_0x5bd95a=_0x49b6b9;_0x16b772=0xc8;}else{_0x16b772=0xce;}_0x5d67e4['status'](_0x16b772);return _0x5d67e4[_0x4888('0x22')](_0x4888('0x23'),_0x320e5c+'-'+_0x5bd95a+'/'+_0x49b6b9)[_0x4888('0x1d')](_0x4475b0);}return null;};}function patchUpdates(_0x5ef57e){return function(_0x5725a2){try{jsonpatch[_0x4888('0x24')](_0x5725a2,_0x5ef57e,!![]);}catch(_0x378f06){return BPromise[_0x4888('0x25')](_0x378f06);}return _0x5725a2['save']();};}function saveUpdates(_0x15dcae,_0x20d2be){return function(_0x2e0f15){if(_0x2e0f15){return _0x2e0f15['update'](_0x15dcae)[_0x4888('0x26')](function(_0x315636){return _0x315636;});}return null;};}function removeEntity(_0x388cf0,_0x44b8d6){return function(_0x4bd62e){if(_0x4bd62e){return _0x4bd62e[_0x4888('0x27')]()[_0x4888('0x26')](function(){var _0x23ac19=_0x4bd62e[_0x4888('0x28')]({'plain':!![]});var _0x14acec='CmHopperAdditionalPhones';return db[_0x4888('0x29')][_0x4888('0x27')]({'where':{'type':_0x14acec,'resourceId':_0x23ac19['id']}})[_0x4888('0x26')](function(){return _0x4bd62e;});})[_0x4888('0x26')](function(){_0x388cf0[_0x4888('0x1b')](0xcc)[_0x4888('0x1c')]();});}};}function handleEntityNotFound(_0x18fe43,_0x4e4910){return function(_0x27f75a){if(!_0x27f75a){_0x18fe43['sendStatus'](0x194);}return _0x27f75a;};}function handleError(_0x2ddce9,_0x16ef5f){_0x16ef5f=_0x16ef5f||0x1f4;return function(_0x44e85d){logger[_0x4888('0x2a')](_0x44e85d['stack']);if(_0x44e85d['name']){delete _0x44e85d['name'];}_0x2ddce9['status'](_0x16ef5f)[_0x4888('0x2b')](_0x44e85d);};}exports[_0x4888('0x2c')]=function(_0x4e65f5,_0x499899){var _0x532e7e={},_0x362103={},_0x1d7d45={'count':0x0,'rows':[]};var _0x3d0c8e=_[_0x4888('0x2d')](db[_0x4888('0x2e')][_0x4888('0x2f')],function(_0x1697fb){return{'name':_0x1697fb[_0x4888('0x30')],'type':_0x1697fb['type']['key']};});_0x362103[_0x4888('0x31')]=_[_0x4888('0x2d')](_0x3d0c8e,'name');_0x362103[_0x4888('0x32')]=_[_0x4888('0x33')](_0x4e65f5[_0x4888('0x32')]);_0x362103[_0x4888('0x34')]=_[_0x4888('0x35')](_0x362103[_0x4888('0x31')],_0x362103[_0x4888('0x32')]);_0x532e7e[_0x4888('0x36')]=_[_0x4888('0x35')](_0x362103[_0x4888('0x31')],qs['fields'](_0x4e65f5['query']['fields']));_0x532e7e['attributes']=_0x532e7e[_0x4888('0x36')][_0x4888('0x37')]?_0x532e7e[_0x4888('0x36')]:_0x362103[_0x4888('0x31')];if(!_0x4e65f5['query'][_0x4888('0x38')]('nolimit')){_0x532e7e[_0x4888('0x20')]=qs[_0x4888('0x20')](_0x4e65f5[_0x4888('0x32')][_0x4888('0x20')]);_0x532e7e[_0x4888('0x1e')]=qs[_0x4888('0x1e')](_0x4e65f5[_0x4888('0x32')][_0x4888('0x1e')]);}_0x532e7e[_0x4888('0x39')]=qs['sort'](_0x4e65f5[_0x4888('0x32')][_0x4888('0x3a')]);_0x532e7e['where']=qs[_0x4888('0x34')](_[_0x4888('0x3b')](_0x4e65f5['query'],_0x362103[_0x4888('0x34')]),_0x3d0c8e);if(_0x4e65f5[_0x4888('0x32')][_0x4888('0x3c')]){_0x532e7e[_0x4888('0x3d')]=_[_0x4888('0x3e')](_0x532e7e[_0x4888('0x3d')],{'$or':_['map'](_0x3d0c8e,function(_0x46d67f){if(_0x46d67f['type']!==_0x4888('0x3f')){var _0x33d77e={};_0x33d77e[_0x46d67f['name']]={'$like':'%'+_0x4e65f5['query'][_0x4888('0x3c')]+'%'};return _0x33d77e;}})});}_0x532e7e=_[_0x4888('0x3e')]({},_0x532e7e,_0x4e65f5[_0x4888('0x40')]);var _0x4ce190={'where':_0x532e7e[_0x4888('0x3d')]};return db[_0x4888('0x2e')][_0x4888('0x21')](_0x4ce190)[_0x4888('0x26')](function(_0x4ec468){_0x1d7d45[_0x4888('0x21')]=_0x4ec468;if(_0x4e65f5[_0x4888('0x32')][_0x4888('0x41')]){_0x532e7e['include']=[{'all':!![]}];}return db[_0x4888('0x2e')][_0x4888('0x42')](_0x532e7e);})[_0x4888('0x26')](function(_0x354a7b){_0x1d7d45[_0x4888('0x43')]=_0x354a7b;return _0x1d7d45;})[_0x4888('0x26')](respondWithFilteredResult(_0x499899,_0x532e7e))[_0x4888('0x44')](handleError(_0x499899,null));};exports[_0x4888('0x45')]=function(_0x405d55,_0x2196c8){var _0x24fb17={'raw':!![],'where':{'id':_0x405d55[_0x4888('0x46')]['id']}},_0xbebf27={};_0xbebf27['model']=_[_0x4888('0x33')](db['CmHopperAdditionalPhone'][_0x4888('0x2f')]);_0xbebf27[_0x4888('0x32')]=_[_0x4888('0x33')](_0x405d55[_0x4888('0x32')]);_0xbebf27[_0x4888('0x34')]=_['intersection'](_0xbebf27[_0x4888('0x31')],_0xbebf27[_0x4888('0x32')]);_0x24fb17[_0x4888('0x36')]=_[_0x4888('0x35')](_0xbebf27['model'],qs[_0x4888('0x47')](_0x405d55['query'][_0x4888('0x47')]));_0x24fb17[_0x4888('0x36')]=_0x24fb17[_0x4888('0x36')][_0x4888('0x37')]?_0x24fb17[_0x4888('0x36')]:_0xbebf27[_0x4888('0x31')];if(_0x405d55[_0x4888('0x32')][_0x4888('0x41')]){_0x24fb17[_0x4888('0x48')]=[{'all':!![]}];}_0x24fb17=_[_0x4888('0x3e')]({},_0x24fb17,_0x405d55[_0x4888('0x40')]);return db[_0x4888('0x2e')][_0x4888('0x49')](_0x24fb17)[_0x4888('0x26')](handleEntityNotFound(_0x2196c8,null))['then'](respondWithResult(_0x2196c8,null))[_0x4888('0x44')](handleError(_0x2196c8,null));};exports[_0x4888('0x4a')]=function(_0x416478,_0x5dc26d){return db[_0x4888('0x2e')][_0x4888('0x4a')](_0x416478[_0x4888('0x4b')],{})[_0x4888('0x26')](function(_0x5c58a5){var _0x3cfa36=_0x416478['user'][_0x4888('0x28')]({'plain':!![]});if(!_0x3cfa36)throw new Error(_0x4888('0x4c'));if(_0x3cfa36[_0x4888('0x4d')]==='user'){var _0x25f8dc=_0x5c58a5['get']({'plain':!![]});var _0x4dd1fd='CmHopperAdditionalPhones';return db[_0x4888('0x4e')][_0x4888('0x49')]({'where':{'name':_0x4dd1fd,'userProfileId':_0x3cfa36[_0x4888('0x4f')]},'raw':!![]})[_0x4888('0x26')](function(_0x1268a4){if(_0x1268a4&&_0x1268a4['autoAssociation']===0x0){return db[_0x4888('0x29')][_0x4888('0x4a')]({'name':_0x25f8dc[_0x4888('0x50')],'resourceId':_0x25f8dc['id'],'type':_0x1268a4[_0x4888('0x50')],'sectionId':_0x1268a4['id']},{})[_0x4888('0x26')](function(){return _0x5c58a5;});}else{return _0x5c58a5;}})[_0x4888('0x44')](function(_0x25e0e1){logger[_0x4888('0x2a')](_0x4888('0x51'),_0x25e0e1);throw _0x25e0e1;});}return _0x5c58a5;})[_0x4888('0x26')](respondWithResult(_0x5dc26d,0xc9))[_0x4888('0x44')](handleError(_0x5dc26d,null));};exports[_0x4888('0x52')]=function(_0x4a722c,_0x3083e9){if(_0x4a722c[_0x4888('0x4b')]['id']){delete _0x4a722c[_0x4888('0x4b')]['id'];}return db[_0x4888('0x2e')]['find']({'where':{'id':_0x4a722c[_0x4888('0x46')]['id']}})[_0x4888('0x26')](handleEntityNotFound(_0x3083e9,null))[_0x4888('0x26')](saveUpdates(_0x4a722c[_0x4888('0x4b')],null))[_0x4888('0x26')](respondWithResult(_0x3083e9,null))[_0x4888('0x44')](handleError(_0x3083e9,null));};exports[_0x4888('0x27')]=function(_0x13843a,_0x3de4a7){return db[_0x4888('0x2e')]['find']({'where':{'id':_0x13843a['params']['id']}})[_0x4888('0x26')](handleEntityNotFound(_0x3de4a7,null))[_0x4888('0x26')](removeEntity(_0x3de4a7,null))['catch'](handleError(_0x3de4a7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 83f0543..2bf1338 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 _0xe7ef=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','../../config/logger','api','moment'];(function(_0x3e01ac,_0x1913d1){var _0x916bab=function(_0x5cb5a3){while(--_0x5cb5a3){_0x3e01ac['push'](_0x3e01ac['shift']());}};_0x916bab(++_0x1913d1);}(_0xe7ef,0x190));var _0xfe7e=function(_0x1621d2,_0x3899e8){_0x1621d2=_0x1621d2-0x0;var _0x208099=_0xe7ef[_0x1621d2];return _0x208099;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe7e('0x0'))(_0xfe7e('0x1'));var moment=require(_0xfe7e('0x2'));var BPromise=require(_0xfe7e('0x3'));var rp=require(_0xfe7e('0x4'));var fs=require('fs');var path=require(_0xfe7e('0x5'));var rimraf=require(_0xfe7e('0x6'));var config=require(_0xfe7e('0x7'));var attributes=require(_0xfe7e('0x8'));module[_0xfe7e('0x9')]=function(_0x423394,_0xd3bd55){return _0x423394[_0xfe7e('0xa')](_0xfe7e('0xb'),attributes,{'tableName':_0xfe7e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea2f=['moment','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','api'];(function(_0x57eb2d,_0x5e4918){var _0xd8e18=function(_0x189389){while(--_0x189389){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0xd8e18(++_0x5e4918);}(_0xea2f,0x165));var _0xfea2=function(_0x335835,_0x65f2ae){_0x335835=_0x335835-0x0;var _0x48fb7c=_0xea2f[_0x335835];return _0x48fb7c;};'use strict';var _=require(_0xfea2('0x0'));var util=require(_0xfea2('0x1'));var logger=require('../../config/logger')(_0xfea2('0x2'));var moment=require(_0xfea2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfea2('0x4'));var rimraf=require('rimraf');var config=require(_0xfea2('0x5'));var attributes=require(_0xfea2('0x6'));module[_0xfea2('0x7')]=function(_0x424cef,_0x44a27d){return _0x424cef[_0xfea2('0x8')](_0xfea2('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','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 c6f8f0e..31ea64d 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 _0x7357=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','ASC','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','ContactId','duration','waitTime','scheduledat','minutes','isNil','add','phone','countdropretry','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment'];(function(_0x10158e,_0x5cbe28){var _0x306d29=function(_0x10f9e4){while(--_0x10f9e4){_0x10158e['push'](_0x10158e['shift']());}};_0x306d29(++_0x5cbe28);}(_0x7357,0x18c));var _0x7735=function(_0x558d4a,_0x155ae8){_0x558d4a=_0x558d4a-0x0;var _0xb29914=_0x7357[_0x558d4a];return _0xb29914;};'use strict';var _=require(_0x7735('0x0'));var util=require(_0x7735('0x1'));var moment=require(_0x7735('0x2'));var BPromise=require(_0x7735('0x3'));var rs=require(_0x7735('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7735('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7735('0x6'))(_0x7735('0x7'));var config=require('../../config/environment');var jayson=require(_0x7735('0x8'));var client=jayson[_0x7735('0x9')][_0x7735('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b3220,_0x2e5d1d,_0x149de8){return new BPromise(function(_0x444bbb,_0x2f6a4e){return client['request'](_0x3b3220,_0x149de8)['then'](function(_0x48fc7b){logger[_0x7735('0xb')](_0x7735('0xc'),_0x2e5d1d,'request\x20sent');logger[_0x7735('0xd')](_0x7735('0xe'),_0x2e5d1d,'request\x20sent',JSON['stringify'](_0x48fc7b));if(_0x48fc7b[_0x7735('0xf')]){if(_0x48fc7b[_0x7735('0xf')][_0x7735('0x10')]===0x1f4){logger[_0x7735('0xf')](_0x7735('0xc'),_0x2e5d1d,_0x48fc7b[_0x7735('0xf')]['message']);return _0x2f6a4e(_0x48fc7b[_0x7735('0xf')][_0x7735('0x11')]);}logger[_0x7735('0xf')](_0x7735('0xc'),_0x2e5d1d,_0x48fc7b[_0x7735('0xf')][_0x7735('0x11')]);return _0x444bbb(_0x48fc7b[_0x7735('0xf')][_0x7735('0x11')]);}else{logger[_0x7735('0xb')](_0x7735('0xc'),_0x2e5d1d,'request\x20sent');_0x444bbb(_0x48fc7b[_0x7735('0x12')]['message']);}})[_0x7735('0x13')](function(_0x16bd22){logger['error'](_0x7735('0xc'),_0x2e5d1d,_0x16bd22);_0x2f6a4e(_0x16bd22);});});}exports['VerifyAdditionalPhones']=function(_0x42a916){var _0x18f12e=this;return new Promise(function(_0x25eb15,_0x7abcab){return db[_0x7735('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x42a916['body']['ContactId'],'ListId':_0x42a916[_0x7735('0x15')][_0x7735('0x16')],'VoiceQueueId':_0x42a916[_0x7735('0x15')][_0x7735('0x17')]===undefined?null:_0x42a916[_0x7735('0x15')][_0x7735('0x17')],'CampaignId':_0x42a916[_0x7735('0x15')]['CampaignId']===undefined?null:_0x42a916['body'][_0x7735('0x18')]}})[_0x7735('0x19')](function(_0x31de62){if(_0x31de62!=null){return db[_0x7735('0x1a')][_0x7735('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x31de62['id'],'OrderBy':{'$gt':_0x31de62['OrderBy']}},'order':[[_0x7735('0x1c'),'ASC']]})[_0x7735('0x19')](function(_0x369e47){var _0x42bc4f=0x0;if(_0x369e47){if(_0x369e47[_0x7735('0x1d')]+_0x369e47[_0x7735('0x1e')]+_0x369e47['countnoanswerretry']+_0x369e47['countnosuchnumberretry']+_0x369e47['countdropretry']+_0x369e47['countabandonedretry']+_0x369e47['countmachineretry']+_0x369e47[_0x7735('0x1f')]<_0x42a916['entity'][_0x7735('0x20')])_0x42bc4f=0x1;_0x25eb15({'additional':_0x42bc4f});}else{return db[_0x7735('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31de62['id']},'order':[[_0x7735('0x1c'),_0x7735('0x21')]]})[_0x7735('0x19')](function(_0x56e7a6){var _0x2bfa49=0x0;if(_0x56e7a6){if(_0x56e7a6[_0x7735('0x1d')]+_0x56e7a6['countcongestionretry']+_0x56e7a6[_0x7735('0x22')]+_0x56e7a6[_0x7735('0x23')]+_0x56e7a6['countdropretry']+_0x56e7a6[_0x7735('0x24')]+_0x56e7a6[_0x7735('0x25')]+_0x56e7a6['countagentrejectretry']<_0x42a916[_0x7735('0x26')]['dialGlobalMaxRetry'])_0x2bfa49=0x1;_0x25eb15({'additional':_0x2bfa49});}else{_0x25eb15({'additional':0x0});}})[_0x7735('0x13')](function(_0xa5be46){logger[_0x7735('0xf')](_0x7735('0x27'),_0xa5be46[_0x7735('0x11')]);_0x7abcab(_0x18f12e[_0x7735('0xf')](0x1f4,_0xa5be46[_0x7735('0x11')]));});}})[_0x7735('0x13')](function(_0x88180){logger[_0x7735('0xf')](_0x7735('0x27'),_0x88180[_0x7735('0x11')]);_0x7abcab(_0x18f12e[_0x7735('0xf')](0x1f4,_0x88180[_0x7735('0x11')]));});}else _0x25eb15({'additional':0x0});});});};exports[_0x7735('0x28')]=function(_0x55a120){var _0x305d4d=this;return new Promise(function(_0x516475,_0x19e553){return db[_0x7735('0x14')][_0x7735('0x1b')]({'raw':!![],'where':{'ContactId':_0x55a120[_0x7735('0x15')][_0x7735('0x29')],'ListId':_0x55a120[_0x7735('0x15')][_0x7735('0x16')],'VoiceQueueId':_0x55a120[_0x7735('0x15')][_0x7735('0x17')]===undefined?null:_0x55a120[_0x7735('0x15')]['VoiceQueueId'],'CampaignId':_0x55a120[_0x7735('0x15')][_0x7735('0x18')]===undefined?null:_0x55a120[_0x7735('0x15')]['CampaignId']}})[_0x7735('0x19')](function(_0xd642f1){if(_0xd642f1!=null){return db[_0x7735('0x1a')][_0x7735('0x1b')]({'raw':!![],'where':{'CmHopperId':_0xd642f1['id'],'OrderBy':{'$gte':_0xd642f1[_0x7735('0x1c')]}},'order':[[_0x7735('0x1c'),'ASC']]})['then'](function(_0xd4a6c6){if(_0xd4a6c6)return activateAdditionalPhone(_0xd642f1,_0x55a120[_0x7735('0x15')],_0xd4a6c6,_0x55a120[_0x7735('0x2a')],_0x55a120['waitTime'])[_0x7735('0x19')](function(_0x47a7a6){_0x516475(_0x47a7a6);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xd642f1['id']},'order':[[_0x7735('0x1c'),_0x7735('0x21')]]})['then'](function(_0x43c167){if(_0x43c167)return activateAdditionalPhone(_0xd642f1,_0x55a120[_0x7735('0x15')],_0x43c167,_0x55a120[_0x7735('0x2a')],_0x55a120[_0x7735('0x2b')])[_0x7735('0x19')](function(_0x4a4aba){_0x516475(_0x4a4aba);});else{_0x516475({'id':_0xd642f1['id'],'phone':''});}})[_0x7735('0x13')](function(_0x48c2ad){logger[_0x7735('0xf')](_0x7735('0x27'),_0x48c2ad['message']);_0x19e553(_0x305d4d[_0x7735('0xf')](0x1f4,_0x48c2ad[_0x7735('0x11')]));});}})[_0x7735('0x13')](function(_0x5a265a){logger[_0x7735('0xf')](_0x7735('0x27'),_0x5a265a[_0x7735('0x11')]);_0x19e553(_0x305d4d['error'](0x1f4,_0x5a265a[_0x7735('0x11')]));});}else _0x516475(0x1);});});};function activateAdditionalPhone(_0x20b7bb,_0x26c0b3,_0x599e71,_0x377785,_0x10efa7){return new Promise(function(_0x223f3f,_0x113f9d){var _0x2498f4;if(_['isNil'](_0x599e71['scheduledat'])){_0x599e71[_0x7735('0x2c')]=moment();}if(moment()>moment(_0x599e71[_0x7735('0x2c')])){_0x2498f4=moment()['add'](_0x10efa7||0x3,_0x7735('0x2d'));}else{if(_0x599e71[_0x7735('0x1c')]==0x0){_0x2498f4=moment(_0x599e71[_0x7735('0x2c')]);}else{_0x2498f4=moment()['add'](_0x10efa7||0x3,_0x7735('0x2d'));}}if(_[_0x7735('0x2e')](_0x2498f4)){_0x2498f4=moment()[_0x7735('0x2f')](_0x10efa7||0x3,'minutes');}var _0x4e47d7={'phone':_0x20b7bb[_0x7735('0x30')],'active':0x0,'OrderBy':_[_0x7735('0x2e')](_0x20b7bb[_0x7735('0x1c')])?0x0:_0x20b7bb[_0x7735('0x1c')],'scheduledat':moment()[_0x7735('0x2f')](_0x377785||0x1,_0x7735('0x2d')),'countbusyretry':_0x26c0b3[_0x7735('0x1d')],'countcongestionretry':_0x26c0b3['countcongestionretry'],'countnoanswerretry':_0x26c0b3[_0x7735('0x22')],'countnosuchnumberretry':_0x26c0b3[_0x7735('0x23')],'countdropretry':_0x26c0b3[_0x7735('0x31')],'countabandonedretry':_0x26c0b3[_0x7735('0x24')],'countmachineretry':_0x26c0b3['countmachineretry'],'countagentrejectretry':_0x26c0b3[_0x7735('0x1f')],'createdAt':_0x26c0b3[_0x7735('0x32')],'updatedAt':_0x26c0b3['updatedAt']};var _0x56fc21={'CmHopperId':_0x20b7bb['id'],'phone':_0x599e71[_0x7735('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x599e71[_0x7735('0x1c')])?0x0:_0x599e71[_0x7735('0x1c')],'scheduledat':_0x2498f4,'countbusyretry':_0x599e71[_0x7735('0x1d')],'countcongestionretry':_0x599e71[_0x7735('0x1e')],'countnoanswerretry':_0x599e71[_0x7735('0x22')],'countnosuchnumberretry':_0x599e71[_0x7735('0x23')],'countdropretry':_0x599e71['countdropretry'],'countabandonedretry':_0x599e71[_0x7735('0x24')],'countmachineretry':_0x599e71[_0x7735('0x25')],'countagentrejectretry':_0x599e71[_0x7735('0x1f')],'createdAt':_0x599e71[_0x7735('0x32')],'updatedAt':_0x599e71['updatedAt']};return db[_0x7735('0x33')][_0x7735('0x34')](function(_0x1855e5){return db['CmHopperAdditionalPhone'][_0x7735('0x35')](_0x4e47d7,{'where':{'id':_0x599e71['id']}},{'transaction':_0x1855e5})[_0x7735('0x19')](function(){return db[_0x7735('0x14')][_0x7735('0x35')](_0x56fc21,{'where':{'id':_0x20b7bb['id']}},{'transaction':_0x1855e5});});})['then'](function(_0x200e61){_0x223f3f({'id':_0x20b7bb['id'],'phone':_0x599e71[_0x7735('0x30')]});})[_0x7735('0x13')](function(_0x59a00c){logger[_0x7735('0xf')](_0x7735('0x36'),_0x59a00c[_0x7735('0x11')]);_0x113f9d({'error':_0x59a00c[_0x7735('0x11')]});});});}exports[_0x7735('0x37')]=function(_0x4b6387){var _0x55a8a0=this;return new Promise(function(_0x44f4e3,_0x2beef){return db['CmHopper'][_0x7735('0x35')](_0x4b6387['body'][_0x7735('0x38')],{'where':{'id':_0x4b6387[_0x7735('0x15')]['id']}})[_0x7735('0x19')](function(_0x58b35a){_0x44f4e3(_0x58b35a);})[_0x7735('0x13')](function(_0x5d364f){logger[_0x7735('0xf')](_0x7735('0x37'),_0x5d364f[_0x7735('0x11')]);_0x2beef(_0x55a8a0['error'](0x1f4,_0x5d364f[_0x7735('0x11')]));});});}; \ No newline at end of file +var _0xaa51=['countabandonedretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countnosuchnumberretry'];(function(_0x145c97,_0x2af644){var _0xe98349=function(_0x5e841e){while(--_0x5e841e){_0x145c97['push'](_0x145c97['shift']());}};_0xe98349(++_0x2af644);}(_0xaa51,0xf8));var _0x1aa5=function(_0x21319e,_0x4036fa){_0x21319e=_0x21319e-0x0;var _0x903915=_0xaa51[_0x21319e];return _0x903915;};'use strict';var _=require(_0x1aa5('0x0'));var util=require(_0x1aa5('0x1'));var moment=require('moment');var BPromise=require(_0x1aa5('0x2'));var rs=require(_0x1aa5('0x3'));var fs=require('fs');var Redis=require(_0x1aa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aa5('0x5'));var logger=require(_0x1aa5('0x6'))(_0x1aa5('0x7'));var config=require('../../config/environment');var jayson=require(_0x1aa5('0x8'));var client=jayson[_0x1aa5('0x9')][_0x1aa5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x62703e,_0x4ae37a,_0x158740){return new BPromise(function(_0x380abd,_0x11d9d6){return client['request'](_0x62703e,_0x158740)[_0x1aa5('0xb')](function(_0x45c1cd){logger[_0x1aa5('0xc')](_0x1aa5('0xd'),_0x4ae37a,'request\x20sent');logger['debug'](_0x1aa5('0xe'),_0x4ae37a,_0x1aa5('0xf'),JSON[_0x1aa5('0x10')](_0x45c1cd));if(_0x45c1cd[_0x1aa5('0x11')]){if(_0x45c1cd['error'][_0x1aa5('0x12')]===0x1f4){logger[_0x1aa5('0x11')](_0x1aa5('0xd'),_0x4ae37a,_0x45c1cd[_0x1aa5('0x11')]['message']);return _0x11d9d6(_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);}logger[_0x1aa5('0x11')](_0x1aa5('0xd'),_0x4ae37a,_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);return _0x380abd(_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);}else{logger['info'](_0x1aa5('0xd'),_0x4ae37a,_0x1aa5('0xf'));_0x380abd(_0x45c1cd[_0x1aa5('0x14')]['message']);}})[_0x1aa5('0x15')](function(_0xd412e5){logger['error'](_0x1aa5('0xd'),_0x4ae37a,_0xd412e5);_0x11d9d6(_0xd412e5);});});}exports[_0x1aa5('0x16')]=function(_0x425d08){var _0x14c1d8=this;return new Promise(function(_0x3b4e25,_0x2fe485){return db[_0x1aa5('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x19')],'ListId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1a')],'VoiceQueueId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1b')]===undefined?null:_0x425d08[_0x1aa5('0x18')]['VoiceQueueId'],'CampaignId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1c')]===undefined?null:_0x425d08[_0x1aa5('0x18')]['CampaignId']}})[_0x1aa5('0xb')](function(_0x4475e7){if(_0x4475e7!=null){return db[_0x1aa5('0x1d')][_0x1aa5('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4475e7['id'],'OrderBy':{'$gt':_0x4475e7[_0x1aa5('0x1f')]}},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x2bdd19){var _0x40739e=0x0;if(_0x2bdd19){if(_0x2bdd19['countbusyretry']+_0x2bdd19['countcongestionretry']+_0x2bdd19[_0x1aa5('0x21')]+_0x2bdd19['countnosuchnumberretry']+_0x2bdd19[_0x1aa5('0x22')]+_0x2bdd19['countabandonedretry']+_0x2bdd19[_0x1aa5('0x23')]+_0x2bdd19[_0x1aa5('0x24')]<_0x425d08[_0x1aa5('0x25')][_0x1aa5('0x26')])_0x40739e=0x1;_0x3b4e25({'additional':_0x40739e});}else{return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4475e7['id']},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x4a8efd){var _0x5683e8=0x0;if(_0x4a8efd){if(_0x4a8efd[_0x1aa5('0x27')]+_0x4a8efd[_0x1aa5('0x28')]+_0x4a8efd[_0x1aa5('0x21')]+_0x4a8efd[_0x1aa5('0x29')]+_0x4a8efd[_0x1aa5('0x22')]+_0x4a8efd[_0x1aa5('0x2a')]+_0x4a8efd['countmachineretry']+_0x4a8efd['countagentrejectretry']<_0x425d08[_0x1aa5('0x25')][_0x1aa5('0x26')])_0x5683e8=0x1;_0x3b4e25({'additional':_0x5683e8});}else{_0x3b4e25({'additional':0x0});}})[_0x1aa5('0x15')](function(_0x449f60){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x449f60[_0x1aa5('0x13')]);_0x2fe485(_0x14c1d8[_0x1aa5('0x11')](0x1f4,_0x449f60[_0x1aa5('0x13')]));});}})['catch'](function(_0x1f5a49){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x1f5a49[_0x1aa5('0x13')]);_0x2fe485(_0x14c1d8[_0x1aa5('0x11')](0x1f4,_0x1f5a49[_0x1aa5('0x13')]));});}else _0x3b4e25({'additional':0x0});});});};exports[_0x1aa5('0x2b')]=function(_0x29d903){var _0x189aff=this;return new Promise(function(_0x4c3d22,_0x93935d){return db[_0x1aa5('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x19')],'ListId':_0x29d903['body'][_0x1aa5('0x1a')],'VoiceQueueId':_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x1b')]===undefined?null:_0x29d903['body']['VoiceQueueId'],'CampaignId':_0x29d903['body'][_0x1aa5('0x1c')]===undefined?null:_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x1c')]}})[_0x1aa5('0xb')](function(_0x31a872){if(_0x31a872!=null){return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31a872['id'],'OrderBy':{'$gte':_0x31a872[_0x1aa5('0x1f')]}},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x4ebbd6){if(_0x4ebbd6)return activateAdditionalPhone(_0x31a872,_0x29d903[_0x1aa5('0x18')],_0x4ebbd6,_0x29d903[_0x1aa5('0x2c')],_0x29d903['waitTime'])[_0x1aa5('0xb')](function(_0x380b52){_0x4c3d22(_0x380b52);});else{return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31a872['id']},'order':[['OrderBy',_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x2b1668){if(_0x2b1668)return activateAdditionalPhone(_0x31a872,_0x29d903[_0x1aa5('0x18')],_0x2b1668,_0x29d903[_0x1aa5('0x2c')],_0x29d903[_0x1aa5('0x2d')])[_0x1aa5('0xb')](function(_0x12ad7a){_0x4c3d22(_0x12ad7a);});else{_0x4c3d22({'id':_0x31a872['id'],'phone':''});}})[_0x1aa5('0x15')](function(_0x4714e5){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x4714e5[_0x1aa5('0x13')]);_0x93935d(_0x189aff[_0x1aa5('0x11')](0x1f4,_0x4714e5[_0x1aa5('0x13')]));});}})[_0x1aa5('0x15')](function(_0x1bff11){logger[_0x1aa5('0x11')]('VerifyAdditionalPhones',_0x1bff11[_0x1aa5('0x13')]);_0x93935d(_0x189aff[_0x1aa5('0x11')](0x1f4,_0x1bff11[_0x1aa5('0x13')]));});}else _0x4c3d22(0x1);});});};function activateAdditionalPhone(_0x5bd65a,_0x4b3b6e,_0x1b333c,_0x490fe0,_0x5636c3){return new Promise(function(_0x31fcf6,_0x30588b){var _0x2f09ad;if(_[_0x1aa5('0x2e')](_0x1b333c[_0x1aa5('0x2f')])){_0x1b333c[_0x1aa5('0x2f')]=moment();}if(moment()>moment(_0x1b333c[_0x1aa5('0x2f')])){_0x2f09ad=moment()[_0x1aa5('0x30')](_0x5636c3||0x3,'minutes');}else{if(_0x1b333c[_0x1aa5('0x1f')]==0x0){_0x2f09ad=moment(_0x1b333c[_0x1aa5('0x2f')]);}else{_0x2f09ad=moment()[_0x1aa5('0x30')](_0x5636c3||0x3,'minutes');}}if(_[_0x1aa5('0x2e')](_0x2f09ad)){_0x2f09ad=moment()['add'](_0x5636c3||0x3,_0x1aa5('0x31'));}var _0xf3c0c8={'phone':_0x5bd65a['phone'],'active':0x0,'OrderBy':_[_0x1aa5('0x2e')](_0x5bd65a[_0x1aa5('0x1f')])?0x0:_0x5bd65a[_0x1aa5('0x1f')],'scheduledat':moment()[_0x1aa5('0x30')](_0x490fe0||0x1,_0x1aa5('0x31')),'countbusyretry':_0x4b3b6e['countbusyretry'],'countcongestionretry':_0x4b3b6e[_0x1aa5('0x28')],'countnoanswerretry':_0x4b3b6e['countnoanswerretry'],'countnosuchnumberretry':_0x4b3b6e[_0x1aa5('0x29')],'countdropretry':_0x4b3b6e[_0x1aa5('0x22')],'countabandonedretry':_0x4b3b6e[_0x1aa5('0x2a')],'countmachineretry':_0x4b3b6e['countmachineretry'],'countagentrejectretry':_0x4b3b6e[_0x1aa5('0x24')],'createdAt':_0x4b3b6e[_0x1aa5('0x32')],'updatedAt':_0x4b3b6e[_0x1aa5('0x33')]};var _0x4fa78d={'CmHopperId':_0x5bd65a['id'],'phone':_0x1b333c[_0x1aa5('0x34')],'active':0x0,'OrderBy':_[_0x1aa5('0x2e')](_0x1b333c['OrderBy'])?0x0:_0x1b333c[_0x1aa5('0x1f')],'scheduledat':_0x2f09ad,'countbusyretry':_0x1b333c[_0x1aa5('0x27')],'countcongestionretry':_0x1b333c['countcongestionretry'],'countnoanswerretry':_0x1b333c[_0x1aa5('0x21')],'countnosuchnumberretry':_0x1b333c[_0x1aa5('0x29')],'countdropretry':_0x1b333c[_0x1aa5('0x22')],'countabandonedretry':_0x1b333c[_0x1aa5('0x2a')],'countmachineretry':_0x1b333c[_0x1aa5('0x23')],'countagentrejectretry':_0x1b333c['countagentrejectretry'],'createdAt':_0x1b333c[_0x1aa5('0x32')],'updatedAt':_0x1b333c[_0x1aa5('0x33')]};return db[_0x1aa5('0x35')][_0x1aa5('0x36')](function(_0x59ae28){return db[_0x1aa5('0x1d')][_0x1aa5('0x37')](_0xf3c0c8,{'where':{'id':_0x1b333c['id']}},{'transaction':_0x59ae28})[_0x1aa5('0xb')](function(){return db[_0x1aa5('0x17')][_0x1aa5('0x37')](_0x4fa78d,{'where':{'id':_0x5bd65a['id']}},{'transaction':_0x59ae28});});})[_0x1aa5('0xb')](function(_0x2fdbb6){_0x31fcf6({'id':_0x5bd65a['id'],'phone':_0x1b333c[_0x1aa5('0x34')]});})['catch'](function(_0x195772){logger['error'](_0x1aa5('0x38'),_0x195772[_0x1aa5('0x13')]);_0x30588b({'error':_0x195772['message']});});});}exports[_0x1aa5('0x39')]=function(_0xc2f3ca){var _0x4115fe=this;return new Promise(function(_0x3caafd,_0x550c3b){return db[_0x1aa5('0x17')]['update'](_0xc2f3ca['body']['field'],{'where':{'id':_0xc2f3ca[_0x1aa5('0x18')]['id']}})[_0x1aa5('0xb')](function(_0x254d69){_0x3caafd(_0x254d69);})['catch'](function(_0x1e584e){logger[_0x1aa5('0x11')]('IncrementPreviewCounters',_0x1e584e['message']);_0x550c3b(_0x4115fe[_0x1aa5('0x11')](0x1f4,_0x1e584e[_0x1aa5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7214b92..024b8ac 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 _0x88fa=['isAuthenticated','index','/:id','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopperAdditionalPhone.controller','get'];(function(_0x3df234,_0x50cc39){var _0x5bcc5a=function(_0x508193){while(--_0x508193){_0x3df234['push'](_0x3df234['shift']());}};_0x5bcc5a(++_0x50cc39);}(_0x88fa,0x1d3));var _0xa88f=function(_0x1e0543,_0x4e200d){_0x1e0543=_0x1e0543-0x0;var _0x21a58e=_0x88fa[_0x1e0543];return _0x21a58e;};'use strict';var multer=require(_0xa88f('0x0'));var util=require('util');var path=require(_0xa88f('0x1'));var timeout=require(_0xa88f('0x2'));var express=require(_0xa88f('0x3'));var router=express[_0xa88f('0x4')]();var fs_extra=require(_0xa88f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa88f('0x6'));var controller=require(_0xa88f('0x7'));router[_0xa88f('0x8')]('/',auth[_0xa88f('0x9')](),controller[_0xa88f('0xa')]);router['get'](_0xa88f('0xb'),auth[_0xa88f('0x9')](),controller['show']);router['post']('/',auth[_0xa88f('0x9')](),controller[_0xa88f('0xc')]);router[_0xa88f('0xd')](_0xa88f('0xb'),auth['isAuthenticated'](),controller[_0xa88f('0xe')]);router[_0xa88f('0xf')]('/:id',auth[_0xa88f('0x9')](),controller['destroy']);module[_0xa88f('0x10')]=router; \ No newline at end of file +var _0x675c=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2914fd,_0x280d0c){var _0xbbf214=function(_0x45a22c){while(--_0x45a22c){_0x2914fd['push'](_0x2914fd['shift']());}};_0xbbf214(++_0x280d0c);}(_0x675c,0x72));var _0xc675=function(_0x5892fd,_0x1bd063){_0x5892fd=_0x5892fd-0x0;var _0x4a460b=_0x675c[_0x5892fd];return _0x4a460b;};'use strict';var multer=require(_0xc675('0x0'));var util=require(_0xc675('0x1'));var path=require(_0xc675('0x2'));var timeout=require(_0xc675('0x3'));var express=require('express');var router=express[_0xc675('0x4')]();var fs_extra=require(_0xc675('0x5'));var auth=require(_0xc675('0x6'));var interaction=require(_0xc675('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xc675('0x8')]('/',auth[_0xc675('0x9')](),controller[_0xc675('0xa')]);router['get'](_0xc675('0xb'),auth[_0xc675('0x9')](),controller[_0xc675('0xc')]);router[_0xc675('0xd')]('/',auth[_0xc675('0x9')](),controller[_0xc675('0xe')]);router['put'](_0xc675('0xb'),auth[_0xc675('0x9')](),controller[_0xc675('0xf')]);router[_0xc675('0x10')](_0xc675('0xb'),auth['isAuthenticated'](),controller[_0xc675('0x11')]);module[_0xc675('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cccf205..f03ed69 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 _0x22e3=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3ba9c0,_0x2db2d8){var _0x543daa=function(_0x51e436){while(--_0x51e436){_0x3ba9c0['push'](_0x3ba9c0['shift']());}};_0x543daa(++_0x2db2d8);}(_0x22e3,0xf3));var _0x322e=function(_0x123412,_0x304c3e){_0x123412=_0x123412-0x0;var _0x29db21=_0x22e3[_0x123412];return _0x29db21;};'use strict';var moment=require(_0x322e('0x0'));var Sequelize=require(_0x322e('0x1'));module[_0x322e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x322e('0x3')],'unique':_0x322e('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x322e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x322e('0x3')],'unique':_0x322e('0x4')}}; \ No newline at end of file +var _0x5687=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5687,0x1ce));var _0x7568=function(_0x3238df,_0x262443){_0x3238df=_0x3238df-0x0;var _0x427b84=_0x5687[_0x3238df];return _0x427b84;};'use strict';var moment=require(_0x7568('0x0'));var Sequelize=require(_0x7568('0x1'));module[_0x7568('0x2')]={'phone':{'type':Sequelize[_0x7568('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7568('0x4')],'unique':_0x7568('0x5')},'ListId':{'type':Sequelize[_0x7568('0x4')],'unique':_0x7568('0x5')},'VoiceQueueId':{'type':Sequelize[_0x7568('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c8a22be..944eea4 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 _0xe001=['lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','show','params','includeAll','catch','update','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0xe001,0x8f));var _0x1e00=function(_0x568442,_0x3ac6b5){_0x568442=_0x568442-0x0;var _0x372340=_0xe001[_0x568442];return _0x372340;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e00('0x0'));var zipdir=require(_0x1e00('0x1'));var jsonpatch=require(_0x1e00('0x2'));var rp=require(_0x1e00('0x3'));var moment=require('moment');var BPromise=require(_0x1e00('0x4'));var Mustache=require(_0x1e00('0x5'));var util=require(_0x1e00('0x6'));var path=require(_0x1e00('0x7'));var sox=require(_0x1e00('0x8'));var csv=require('to-csv');var ejs=require(_0x1e00('0x9'));var fs=require('fs');var fs_extra=require(_0x1e00('0xa'));var _=require(_0x1e00('0xb'));var squel=require(_0x1e00('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e00('0xd'));var deskjs=require(_0x1e00('0xe'));var toCsv=require(_0x1e00('0xf'));var querystring=require(_0x1e00('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e00('0x11'));var qs=require(_0x1e00('0x12'));var as=require(_0x1e00('0x13'));var hardwareService=require(_0x1e00('0x14'));var logger=require(_0x1e00('0x15'))(_0x1e00('0x16'));var utils=require(_0x1e00('0x17'));var config=require(_0x1e00('0x18'));var licenseUtil=require(_0x1e00('0x19'));var db=require(_0x1e00('0x1a'))['db'];function respondWithStatusCode(_0xde1bee,_0x24d9a3){_0x24d9a3=_0x24d9a3||0xcc;return function(_0x142333){if(_0x142333){return _0xde1bee[_0x1e00('0x1b')](_0x24d9a3);}return _0xde1bee['status'](_0x24d9a3)[_0x1e00('0x1c')]();};}function respondWithResult(_0x43a2c1,_0x384222){_0x384222=_0x384222||0xc8;return function(_0x55dfca){if(_0x55dfca){return _0x43a2c1[_0x1e00('0x1d')](_0x384222)['json'](_0x55dfca);}};}function respondWithFilteredResult(_0x34923c,_0x40f2e3){return function(_0x568e05){if(_0x568e05){var _0x4e9626=typeof _0x40f2e3[_0x1e00('0x1e')]==='undefined'&&typeof _0x40f2e3[_0x1e00('0x1f')]===_0x1e00('0x20');var _0x5454bc=_0x568e05[_0x1e00('0x21')];var _0x1e69b6=_0x4e9626?0x0:_0x40f2e3[_0x1e00('0x1e')];var _0x198bf9=_0x4e9626?_0x568e05[_0x1e00('0x21')]:_0x40f2e3[_0x1e00('0x1e')]+_0x40f2e3[_0x1e00('0x1f')];var _0x4b1194;if(_0x198bf9>=_0x5454bc){_0x198bf9=_0x5454bc;_0x4b1194=0xc8;}else{_0x4b1194=0xce;}_0x34923c[_0x1e00('0x1d')](_0x4b1194);return _0x34923c[_0x1e00('0x22')](_0x1e00('0x23'),_0x1e69b6+'-'+_0x198bf9+'/'+_0x5454bc)[_0x1e00('0x24')](_0x568e05);}return null;};}function patchUpdates(_0x1c1a1e){return function(_0x5b4880){try{jsonpatch[_0x1e00('0x25')](_0x5b4880,_0x1c1a1e,!![]);}catch(_0x5e9bad){return BPromise[_0x1e00('0x26')](_0x5e9bad);}return _0x5b4880[_0x1e00('0x27')]();};}function saveUpdates(_0x2df0cb,_0x10292b){return function(_0x4b611e){if(_0x4b611e){return _0x4b611e['update'](_0x2df0cb)[_0x1e00('0x28')](function(_0x1bf062){return _0x1bf062;});}return null;};}function removeEntity(_0x595fe4,_0x56f449){return function(_0x19af3c){if(_0x19af3c){return _0x19af3c[_0x1e00('0x29')]()[_0x1e00('0x28')](function(){_0x595fe4['status'](0xcc)[_0x1e00('0x1c')]();});}};}function handleEntityNotFound(_0x38618f,_0xd98a87){return function(_0x32fa5d){if(!_0x32fa5d){_0x38618f[_0x1e00('0x1b')](0x194);}return _0x32fa5d;};}function handleError(_0xcb94e,_0x4f5674){_0x4f5674=_0x4f5674||0x1f4;return function(_0x5f1475){logger[_0x1e00('0x2a')](_0x5f1475['stack']);if(_0x5f1475['name']){delete _0x5f1475[_0x1e00('0x2b')];}_0xcb94e['status'](_0x4f5674)[_0x1e00('0x2c')](_0x5f1475);};}exports[_0x1e00('0x2d')]=function(_0x423871,_0x50a95e){var _0x4056cb={},_0x491003={},_0xa82803={'count':0x0,'rows':[]};var _0x5826af=_['map'](db[_0x1e00('0x2e')][_0x1e00('0x2f')],function(_0x1e6093){return{'name':_0x1e6093['fieldName'],'type':_0x1e6093[_0x1e00('0x30')][_0x1e00('0x31')]};});_0x491003[_0x1e00('0x32')]=_['map'](_0x5826af,'name');_0x491003[_0x1e00('0x33')]=_[_0x1e00('0x34')](_0x423871['query']);_0x491003[_0x1e00('0x35')]=_[_0x1e00('0x36')](_0x491003['model'],_0x491003[_0x1e00('0x33')]);_0x4056cb[_0x1e00('0x37')]=_['intersection'](_0x491003[_0x1e00('0x32')],qs[_0x1e00('0x38')](_0x423871[_0x1e00('0x33')]['fields']));_0x4056cb['attributes']=_0x4056cb[_0x1e00('0x37')]['length']?_0x4056cb['attributes']:_0x491003[_0x1e00('0x32')];if(!_0x423871['query'][_0x1e00('0x39')](_0x1e00('0x3a'))){_0x4056cb['limit']=qs[_0x1e00('0x1f')](_0x423871[_0x1e00('0x33')][_0x1e00('0x1f')]);_0x4056cb['offset']=qs[_0x1e00('0x1e')](_0x423871[_0x1e00('0x33')][_0x1e00('0x1e')]);}_0x4056cb['order']=qs[_0x1e00('0x3b')](_0x423871[_0x1e00('0x33')][_0x1e00('0x3b')]);_0x4056cb[_0x1e00('0x3c')]=qs[_0x1e00('0x35')](_[_0x1e00('0x3d')](_0x423871['query'],_0x491003['filters']),_0x5826af);if(_0x423871['query'][_0x1e00('0x3e')]){_0x4056cb[_0x1e00('0x3c')]=_[_0x1e00('0x3f')](_0x4056cb['where'],{'$or':_[_0x1e00('0x40')](_0x5826af,function(_0x13560a){if(_0x13560a[_0x1e00('0x30')]!==_0x1e00('0x41')){var _0x2d1786={};_0x2d1786[_0x13560a[_0x1e00('0x2b')]]={'$like':'%'+_0x423871[_0x1e00('0x33')][_0x1e00('0x3e')]+'%'};return _0x2d1786;}})});}_0x4056cb=_[_0x1e00('0x3f')]({},_0x4056cb,_0x423871[_0x1e00('0x42')]);var _0x296166={'where':_0x4056cb[_0x1e00('0x3c')]};return db[_0x1e00('0x2e')][_0x1e00('0x21')](_0x296166)[_0x1e00('0x28')](function(_0x357e61){_0xa82803[_0x1e00('0x21')]=_0x357e61;if(_0x423871['query']['includeAll']){_0x4056cb[_0x1e00('0x43')]=[{'all':!![]}];}return db[_0x1e00('0x2e')]['findAll'](_0x4056cb);})['then'](function(_0x3ee78f){_0xa82803[_0x1e00('0x44')]=_0x3ee78f;return _0xa82803;})[_0x1e00('0x28')](respondWithFilteredResult(_0x50a95e,_0x4056cb))['catch'](handleError(_0x50a95e,null));};exports[_0x1e00('0x45')]=function(_0x3cea00,_0x48f84b){var _0x599d6d={'raw':!![],'where':{'id':_0x3cea00[_0x1e00('0x46')]['id']}},_0x1ac3d9={};_0x1ac3d9[_0x1e00('0x32')]=_['keys'](db[_0x1e00('0x2e')][_0x1e00('0x2f')]);_0x1ac3d9[_0x1e00('0x33')]=_['keys'](_0x3cea00[_0x1e00('0x33')]);_0x1ac3d9[_0x1e00('0x35')]=_[_0x1e00('0x36')](_0x1ac3d9[_0x1e00('0x32')],_0x1ac3d9[_0x1e00('0x33')]);_0x599d6d[_0x1e00('0x37')]=_[_0x1e00('0x36')](_0x1ac3d9['model'],qs[_0x1e00('0x38')](_0x3cea00[_0x1e00('0x33')][_0x1e00('0x38')]));_0x599d6d[_0x1e00('0x37')]=_0x599d6d[_0x1e00('0x37')]['length']?_0x599d6d[_0x1e00('0x37')]:_0x1ac3d9[_0x1e00('0x32')];if(_0x3cea00[_0x1e00('0x33')][_0x1e00('0x47')]){_0x599d6d[_0x1e00('0x43')]=[{'all':!![]}];}_0x599d6d=_[_0x1e00('0x3f')]({},_0x599d6d,_0x3cea00[_0x1e00('0x42')]);return db[_0x1e00('0x2e')]['find'](_0x599d6d)[_0x1e00('0x28')](handleEntityNotFound(_0x48f84b,null))[_0x1e00('0x28')](respondWithResult(_0x48f84b,null))[_0x1e00('0x48')](handleError(_0x48f84b,null));};exports[_0x1e00('0x49')]=function(_0x35f759,_0x5b7831){if(_0x35f759[_0x1e00('0x4a')]['id']){delete _0x35f759[_0x1e00('0x4a')]['id'];}return db[_0x1e00('0x2e')][_0x1e00('0x4b')]({'where':{'id':_0x35f759[_0x1e00('0x46')]['id']}})[_0x1e00('0x28')](handleEntityNotFound(_0x5b7831,null))[_0x1e00('0x28')](saveUpdates(_0x35f759[_0x1e00('0x4a')],null))[_0x1e00('0x28')](respondWithResult(_0x5b7831,null))[_0x1e00('0x48')](handleError(_0x5b7831,null));};exports[_0x1e00('0x29')]=function(_0x58ec24,_0x81426d){return db[_0x1e00('0x2e')][_0x1e00('0x4b')]({'where':{'id':_0x58ec24[_0x1e00('0x46')]['id']}})[_0x1e00('0x28')](handleEntityNotFound(_0x81426d,null))[_0x1e00('0x28')](removeEntity(_0x81426d,null))[_0x1e00('0x48')](handleError(_0x81426d,null));};exports[_0x1e00('0x4c')]=function(_0x228016,_0x11d503){return db[_0x1e00('0x2e')][_0x1e00('0x4c')]()[_0x1e00('0x28')](respondWithResult(_0x11d503,null))[_0x1e00('0x48')](handleError(_0x11d503,null));}; \ No newline at end of file +var _0x05e7=['fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','save','then','destroy','error','name','send','index','map','CmHopperBlack','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x12f7f7,_0x39895e){var _0xdc54b6=function(_0x4ad778){while(--_0x4ad778){_0x12f7f7['push'](_0x12f7f7['shift']());}};_0xdc54b6(++_0x39895e);}(_0x05e7,0x15f));var _0x705e=function(_0x15bab5,_0x150ed5){_0x15bab5=_0x15bab5-0x0;var _0x4cd7f0=_0x05e7[_0x15bab5];return _0x4cd7f0;};'use strict';var emlformat=require(_0x705e('0x0'));var rimraf=require(_0x705e('0x1'));var zipdir=require(_0x705e('0x2'));var jsonpatch=require(_0x705e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x705e('0x4'));var Mustache=require(_0x705e('0x5'));var util=require(_0x705e('0x6'));var path=require(_0x705e('0x7'));var sox=require(_0x705e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x705e('0x9'));var _=require('lodash');var squel=require(_0x705e('0xa'));var crypto=require('crypto');var jsforce=require(_0x705e('0xb'));var deskjs=require(_0x705e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x705e('0xd'));var Papa=require('papaparse');var Redis=require(_0x705e('0xe'));var authService=require(_0x705e('0xf'));var qs=require(_0x705e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x705e('0x11'));var logger=require(_0x705e('0x12'))(_0x705e('0x13'));var utils=require(_0x705e('0x14'));var config=require(_0x705e('0x15'));var licenseUtil=require(_0x705e('0x16'));var db=require(_0x705e('0x17'))['db'];function respondWithStatusCode(_0x4ba092,_0x11e81c){_0x11e81c=_0x11e81c||0xcc;return function(_0xecf137){if(_0xecf137){return _0x4ba092[_0x705e('0x18')](_0x11e81c);}return _0x4ba092[_0x705e('0x19')](_0x11e81c)[_0x705e('0x1a')]();};}function respondWithResult(_0x4c7fb8,_0x417d27){_0x417d27=_0x417d27||0xc8;return function(_0x3f2b0f){if(_0x3f2b0f){return _0x4c7fb8[_0x705e('0x19')](_0x417d27)[_0x705e('0x1b')](_0x3f2b0f);}};}function respondWithFilteredResult(_0x111324,_0x4b99bf){return function(_0x310f55){if(_0x310f55){var _0x644d47=typeof _0x4b99bf['offset']===_0x705e('0x1c')&&typeof _0x4b99bf['limit']===_0x705e('0x1c');var _0x212f49=_0x310f55[_0x705e('0x1d')];var _0x22ff1c=_0x644d47?0x0:_0x4b99bf[_0x705e('0x1e')];var _0x492b53=_0x644d47?_0x310f55['count']:_0x4b99bf[_0x705e('0x1e')]+_0x4b99bf['limit'];var _0x4c4f52;if(_0x492b53>=_0x212f49){_0x492b53=_0x212f49;_0x4c4f52=0xc8;}else{_0x4c4f52=0xce;}_0x111324['status'](_0x4c4f52);return _0x111324['set']('Content-Range',_0x22ff1c+'-'+_0x492b53+'/'+_0x212f49)[_0x705e('0x1b')](_0x310f55);}return null;};}function patchUpdates(_0xe967){return function(_0x124506){try{jsonpatch['apply'](_0x124506,_0xe967,!![]);}catch(_0x2cb851){return BPromise['reject'](_0x2cb851);}return _0x124506[_0x705e('0x1f')]();};}function saveUpdates(_0x47886d,_0x4abdee){return function(_0x1686b8){if(_0x1686b8){return _0x1686b8['update'](_0x47886d)[_0x705e('0x20')](function(_0x5a73ac){return _0x5a73ac;});}return null;};}function removeEntity(_0x551b7c,_0x37c894){return function(_0x39b2b5){if(_0x39b2b5){return _0x39b2b5[_0x705e('0x21')]()[_0x705e('0x20')](function(){_0x551b7c[_0x705e('0x19')](0xcc)[_0x705e('0x1a')]();});}};}function handleEntityNotFound(_0x4950cb,_0x1cd6df){return function(_0x3de241){if(!_0x3de241){_0x4950cb[_0x705e('0x18')](0x194);}return _0x3de241;};}function handleError(_0x29218f,_0x1c17af){_0x1c17af=_0x1c17af||0x1f4;return function(_0x19b9fc){logger[_0x705e('0x22')](_0x19b9fc['stack']);if(_0x19b9fc['name']){delete _0x19b9fc[_0x705e('0x23')];}_0x29218f[_0x705e('0x19')](_0x1c17af)[_0x705e('0x24')](_0x19b9fc);};}exports[_0x705e('0x25')]=function(_0x228356,_0x388624){var _0x3bc452={},_0x28cd2f={},_0x4b87a1={'count':0x0,'rows':[]};var _0x29e704=_[_0x705e('0x26')](db[_0x705e('0x27')]['rawAttributes'],function(_0x19ed5f){return{'name':_0x19ed5f[_0x705e('0x28')],'type':_0x19ed5f['type'][_0x705e('0x29')]};});_0x28cd2f[_0x705e('0x2a')]=_[_0x705e('0x26')](_0x29e704,_0x705e('0x23'));_0x28cd2f[_0x705e('0x2b')]=_['keys'](_0x228356[_0x705e('0x2b')]);_0x28cd2f[_0x705e('0x2c')]=_[_0x705e('0x2d')](_0x28cd2f[_0x705e('0x2a')],_0x28cd2f['query']);_0x3bc452[_0x705e('0x2e')]=_[_0x705e('0x2d')](_0x28cd2f[_0x705e('0x2a')],qs['fields'](_0x228356[_0x705e('0x2b')][_0x705e('0x2f')]));_0x3bc452['attributes']=_0x3bc452[_0x705e('0x2e')][_0x705e('0x30')]?_0x3bc452[_0x705e('0x2e')]:_0x28cd2f['model'];if(!_0x228356[_0x705e('0x2b')]['hasOwnProperty'](_0x705e('0x31'))){_0x3bc452[_0x705e('0x32')]=qs[_0x705e('0x32')](_0x228356[_0x705e('0x2b')][_0x705e('0x32')]);_0x3bc452['offset']=qs[_0x705e('0x1e')](_0x228356['query'][_0x705e('0x1e')]);}_0x3bc452[_0x705e('0x33')]=qs[_0x705e('0x34')](_0x228356[_0x705e('0x2b')]['sort']);_0x3bc452[_0x705e('0x35')]=qs[_0x705e('0x2c')](_[_0x705e('0x36')](_0x228356[_0x705e('0x2b')],_0x28cd2f[_0x705e('0x2c')]),_0x29e704);if(_0x228356[_0x705e('0x2b')]['filter']){_0x3bc452['where']=_[_0x705e('0x37')](_0x3bc452[_0x705e('0x35')],{'$or':_['map'](_0x29e704,function(_0x2edf93){if(_0x2edf93['type']!==_0x705e('0x38')){var _0x47dbbf={};_0x47dbbf[_0x2edf93['name']]={'$like':'%'+_0x228356[_0x705e('0x2b')][_0x705e('0x39')]+'%'};return _0x47dbbf;}})});}_0x3bc452=_[_0x705e('0x37')]({},_0x3bc452,_0x228356[_0x705e('0x3a')]);var _0x181555={'where':_0x3bc452[_0x705e('0x35')]};return db['CmHopperBlack'][_0x705e('0x1d')](_0x181555)['then'](function(_0x8e3bf1){_0x4b87a1['count']=_0x8e3bf1;if(_0x228356['query'][_0x705e('0x3b')]){_0x3bc452[_0x705e('0x3c')]=[{'all':!![]}];}return db[_0x705e('0x27')][_0x705e('0x3d')](_0x3bc452);})[_0x705e('0x20')](function(_0x50ace9){_0x4b87a1[_0x705e('0x3e')]=_0x50ace9;return _0x4b87a1;})['then'](respondWithFilteredResult(_0x388624,_0x3bc452))['catch'](handleError(_0x388624,null));};exports[_0x705e('0x3f')]=function(_0x5e5b2b,_0x3eacd2){var _0x242a4f={'raw':!![],'where':{'id':_0x5e5b2b[_0x705e('0x40')]['id']}},_0x1a9dce={};_0x1a9dce[_0x705e('0x2a')]=_[_0x705e('0x41')](db[_0x705e('0x27')][_0x705e('0x42')]);_0x1a9dce[_0x705e('0x2b')]=_[_0x705e('0x41')](_0x5e5b2b[_0x705e('0x2b')]);_0x1a9dce[_0x705e('0x2c')]=_[_0x705e('0x2d')](_0x1a9dce[_0x705e('0x2a')],_0x1a9dce[_0x705e('0x2b')]);_0x242a4f[_0x705e('0x2e')]=_[_0x705e('0x2d')](_0x1a9dce[_0x705e('0x2a')],qs[_0x705e('0x2f')](_0x5e5b2b[_0x705e('0x2b')][_0x705e('0x2f')]));_0x242a4f[_0x705e('0x2e')]=_0x242a4f[_0x705e('0x2e')][_0x705e('0x30')]?_0x242a4f['attributes']:_0x1a9dce['model'];if(_0x5e5b2b['query'][_0x705e('0x3b')]){_0x242a4f[_0x705e('0x3c')]=[{'all':!![]}];}_0x242a4f=_[_0x705e('0x37')]({},_0x242a4f,_0x5e5b2b[_0x705e('0x3a')]);return db['CmHopperBlack'][_0x705e('0x43')](_0x242a4f)[_0x705e('0x20')](handleEntityNotFound(_0x3eacd2,null))['then'](respondWithResult(_0x3eacd2,null))[_0x705e('0x44')](handleError(_0x3eacd2,null));};exports[_0x705e('0x45')]=function(_0x9a1a68,_0x408c37){if(_0x9a1a68[_0x705e('0x46')]['id']){delete _0x9a1a68['body']['id'];}return db[_0x705e('0x27')]['find']({'where':{'id':_0x9a1a68[_0x705e('0x40')]['id']}})[_0x705e('0x20')](handleEntityNotFound(_0x408c37,null))[_0x705e('0x20')](saveUpdates(_0x9a1a68[_0x705e('0x46')],null))[_0x705e('0x20')](respondWithResult(_0x408c37,null))['catch'](handleError(_0x408c37,null));};exports['destroy']=function(_0x1fea74,_0x4f175b){return db[_0x705e('0x27')][_0x705e('0x43')]({'where':{'id':_0x1fea74[_0x705e('0x40')]['id']}})[_0x705e('0x20')](handleEntityNotFound(_0x4f175b,null))[_0x705e('0x20')](removeEntity(_0x4f175b,null))[_0x705e('0x44')](handleError(_0x4f175b,null));};exports[_0x705e('0x47')]=function(_0x595c34,_0x2875b4){return db[_0x705e('0x27')][_0x705e('0x47')]()['then'](respondWithResult(_0x2875b4,null))[_0x705e('0x44')](handleError(_0x2875b4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f75c07f..50ae628 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 _0x0576=['exports','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x238427,_0xb6f427){var _0x29801d=function(_0x176146){while(--_0x176146){_0x238427['push'](_0x238427['shift']());}};_0x29801d(++_0xb6f427);}(_0x0576,0x16b));var _0x6057=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0576[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6057('0x0'));var util=require(_0x6057('0x1'));var logger=require(_0x6057('0x2'))(_0x6057('0x3'));var moment=require(_0x6057('0x4'));var BPromise=require(_0x6057('0x5'));var rp=require(_0x6057('0x6'));var fs=require('fs');var path=require(_0x6057('0x7'));var rimraf=require(_0x6057('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x6057('0x9')]=function(_0x17ec86,_0x4bda73){return _0x17ec86[_0x6057('0xa')](_0x6057('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef03=['cm_hopper_black','util','api','moment','bluebird','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef03,0xdd));var _0x3ef0=function(_0x1e0084,_0x2dd44b){_0x1e0084=_0x1e0084-0x0;var _0x2ed6e2=_0xef03[_0x1e0084];return _0x2ed6e2;};'use strict';var _=require('lodash');var util=require(_0x3ef0('0x0'));var logger=require('../../config/logger')(_0x3ef0('0x1'));var moment=require(_0x3ef0('0x2'));var BPromise=require(_0x3ef0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ef0('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ef0('0x5'));module[_0x3ef0('0x6')]=function(_0x22e3d4,_0x14dd3f){return _0x22e3d4[_0x3ef0('0x7')](_0x3ef0('0x8'),attributes,{'tableName':_0x3ef0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index b2a5a65..ff4b9fb 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 _0x9896=['attributes','limit','include','model','map','stringify','CmHopperBlack','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCmHopperBlack','findAll','options','raw'];(function(_0x5959b9,_0x5b9bd1){var _0x3eaab2=function(_0x42f0e8){while(--_0x42f0e8){_0x5959b9['push'](_0x5959b9['shift']());}};_0x3eaab2(++_0x5b9bd1);}(_0x9896,0x1af));var _0x6989=function(_0x249b66,_0x4c2101){_0x249b66=_0x249b66-0x0;var _0x23b006=_0x9896[_0x249b66];return _0x23b006;};'use strict';var _=require(_0x6989('0x0'));var util=require(_0x6989('0x1'));var moment=require(_0x6989('0x2'));var BPromise=require(_0x6989('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6989('0x4'));var db=require(_0x6989('0x5'))['db'];var utils=require(_0x6989('0x6'));var logger=require(_0x6989('0x7'))('rpc');var config=require(_0x6989('0x8'));var jayson=require(_0x6989('0x9'));var client=jayson[_0x6989('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430f5a,_0x1c21b3,_0x34115e){return new BPromise(function(_0x5e79e4,_0x2c0bc4){return client['request'](_0x430f5a,_0x34115e)[_0x6989('0xb')](function(_0x1cf4bb){logger[_0x6989('0xc')](_0x6989('0xd'),_0x1c21b3,_0x6989('0xe'));logger[_0x6989('0xf')](_0x6989('0x10'),_0x1c21b3,_0x6989('0xe'),JSON['stringify'](_0x1cf4bb));if(_0x1cf4bb[_0x6989('0x11')]){if(_0x1cf4bb['error']['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1c21b3,_0x1cf4bb['error'][_0x6989('0x12')]);return _0x2c0bc4(_0x1cf4bb['error'][_0x6989('0x12')]);}logger['error'](_0x6989('0xd'),_0x1c21b3,_0x1cf4bb[_0x6989('0x11')]['message']);return _0x5e79e4(_0x1cf4bb['error'][_0x6989('0x12')]);}else{logger['info'](_0x6989('0xd'),_0x1c21b3,_0x6989('0xe'));_0x5e79e4(_0x1cf4bb[_0x6989('0x13')][_0x6989('0x12')]);}})[_0x6989('0x14')](function(_0x1198ee){logger[_0x6989('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x1c21b3,_0x1198ee);_0x2c0bc4(_0x1198ee);});});}exports[_0x6989('0x15')]=function(_0x2c7ec1){var _0x2b928a=this;return new Promise(function(_0x287af1,_0x3b9806){return db['CmHopperBlack'][_0x6989('0x16')]({'raw':_0x2c7ec1[_0x6989('0x17')]?_0x2c7ec1[_0x6989('0x17')][_0x6989('0x18')]===undefined?!![]:![]:!![],'where':_0x2c7ec1[_0x6989('0x17')]?_0x2c7ec1[_0x6989('0x17')]['where']||null:null,'attributes':_0x2c7ec1[_0x6989('0x17')]?_0x2c7ec1['options'][_0x6989('0x19')]||null:null,'limit':_0x2c7ec1[_0x6989('0x17')]?_0x2c7ec1[_0x6989('0x17')][_0x6989('0x1a')]||null:null,'include':_0x2c7ec1['options']?_0x2c7ec1['options']['include']?_['map'](_0x2c7ec1[_0x6989('0x17')][_0x6989('0x1b')],function(_0x3f11e6){return{'model':db[_0x3f11e6[_0x6989('0x1c')]],'as':_0x3f11e6['as'],'attributes':_0x3f11e6[_0x6989('0x19')],'include':_0x3f11e6['include']?_[_0x6989('0x1d')](_0x3f11e6[_0x6989('0x1b')],function(_0x50ba2b){return{'model':db[_0x50ba2b[_0x6989('0x1c')]],'as':_0x50ba2b['as'],'attributes':_0x50ba2b[_0x6989('0x19')],'include':_0x50ba2b[_0x6989('0x1b')]?_[_0x6989('0x1d')](_0x50ba2b[_0x6989('0x1b')],function(_0x24f822){return{'model':db[_0x24f822[_0x6989('0x1c')]],'as':_0x24f822['as'],'attributes':_0x24f822[_0x6989('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6989('0xb')](function(_0x3a906c){logger[_0x6989('0xc')]('GetCmHopperBlack',_0x2c7ec1);logger[_0x6989('0xf')](_0x6989('0x15'),_0x2c7ec1,JSON[_0x6989('0x1e')](_0x3a906c));_0x287af1(_0x3a906c);})[_0x6989('0x14')](function(_0x49f31c){logger[_0x6989('0x11')](_0x6989('0x15'),_0x49f31c[_0x6989('0x12')],_0x2c7ec1);_0x3b9806(_0x2b928a[_0x6989('0x11')](0x1f4,_0x49f31c[_0x6989('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x56ece7){var _0x47f48e=this;return new Promise(function(_0x242e0b,_0x2217aa){return db[_0x6989('0x1f')][_0x6989('0x20')](_0x56ece7[_0x6989('0x21')],{'raw':_0x56ece7[_0x6989('0x17')]?_0x56ece7[_0x6989('0x17')][_0x6989('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ece7['options']?_0x56ece7[_0x6989('0x17')][_0x6989('0x22')]||null:null,'attributes':_0x56ece7[_0x6989('0x17')]?_0x56ece7[_0x6989('0x17')][_0x6989('0x19')]||null:null,'limit':_0x56ece7[_0x6989('0x17')]?_0x56ece7[_0x6989('0x17')][_0x6989('0x1a')]||null:null})[_0x6989('0xb')](function(_0x25c762){logger[_0x6989('0xc')](_0x6989('0x23'),_0x56ece7);logger[_0x6989('0xf')](_0x6989('0x23'),_0x56ece7,JSON[_0x6989('0x1e')](_0x25c762));_0x242e0b(_0x25c762);})[_0x6989('0x14')](function(_0x386113){logger['error'](_0x6989('0x23'),_0x386113['message'],_0x56ece7);_0x2217aa(_0x47f48e[_0x6989('0x11')](0x1f4,_0x386113[_0x6989('0x12')]));});});};exports[_0x6989('0x24')]=function(_0xbdec6c){var _0x16f4c3=this;return new Promise(function(_0x1f3a27,_0x4e6092){return db[_0x6989('0x1f')][_0x6989('0x25')]({'where':_0xbdec6c[_0x6989('0x17')]?_0xbdec6c['options'][_0x6989('0x22')]||null:null})[_0x6989('0xb')](function(_0x2e6e4a){logger['info'](_0x6989('0x24'),_0xbdec6c);logger['debug'](_0x6989('0x24'),_0xbdec6c,JSON['stringify'](_0x2e6e4a));_0x1f3a27(_0x2e6e4a);})[_0x6989('0x14')](function(_0x3a0dfa){logger[_0x6989('0x11')](_0x6989('0x24'),_0x3a0dfa[_0x6989('0x12')],_0xbdec6c);_0x4e6092(_0x16f4c3['error'](0x1f4,_0x3a0dfa['message']));});});}; \ No newline at end of file +var _0xb14e=['http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','request\x20sent','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x151835,_0x466f81){var _0x5219e0=function(_0x4d7a7e){while(--_0x4d7a7e){_0x151835['push'](_0x151835['shift']());}};_0x5219e0(++_0x466f81);}(_0xb14e,0xa7));var _0xeb14=function(_0xb67e18,_0xa04ef5){_0xb67e18=_0xb67e18-0x0;var _0x51ea80=_0xb14e[_0xb67e18];return _0x51ea80;};'use strict';var _=require('lodash');var util=require(_0xeb14('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb14('0x1'));var fs=require('fs');var Redis=require(_0xeb14('0x2'));var db=require(_0xeb14('0x3'))['db'];var utils=require(_0xeb14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xeb14('0x5'));var jayson=require(_0xeb14('0x6'));var client=jayson[_0xeb14('0x7')][_0xeb14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dc107,_0x4ef045,_0x48b73b){return new BPromise(function(_0x1a379f,_0x54c70b){return client[_0xeb14('0x9')](_0x5dc107,_0x48b73b)[_0xeb14('0xa')](function(_0x13463d){logger[_0xeb14('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,'request\x20sent');logger[_0xeb14('0xc')](_0xeb14('0xd'),_0x4ef045,'request\x20sent',JSON[_0xeb14('0xe')](_0x13463d));if(_0x13463d[_0xeb14('0xf')]){if(_0x13463d[_0xeb14('0xf')][_0xeb14('0x10')]===0x1f4){logger[_0xeb14('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,_0x13463d[_0xeb14('0xf')][_0xeb14('0x11')]);return _0x54c70b(_0x13463d['error'][_0xeb14('0x11')]);}logger[_0xeb14('0xf')](_0xeb14('0x12'),_0x4ef045,_0x13463d['error'][_0xeb14('0x11')]);return _0x1a379f(_0x13463d[_0xeb14('0xf')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,_0xeb14('0x13'));_0x1a379f(_0x13463d['result'][_0xeb14('0x11')]);}})[_0xeb14('0x14')](function(_0x4e483b){logger[_0xeb14('0xf')](_0xeb14('0x12'),_0x4ef045,_0x4e483b);_0x54c70b(_0x4e483b);});});}exports[_0xeb14('0x15')]=function(_0x297b79){var _0x1f6a3a=this;return new Promise(function(_0x67322f,_0x133182){return db[_0xeb14('0x16')][_0xeb14('0x17')]({'raw':_0x297b79['options']?_0x297b79['options']['raw']===undefined?!![]:![]:!![],'where':_0x297b79[_0xeb14('0x18')]?_0x297b79['options'][_0xeb14('0x19')]||null:null,'attributes':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')][_0xeb14('0x1a')]||null:null,'limit':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')]['limit']||null:null,'include':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')][_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0x297b79[_0xeb14('0x18')]['include'],function(_0xff6011){return{'model':db[_0xff6011[_0xeb14('0x1d')]],'as':_0xff6011['as'],'attributes':_0xff6011['attributes'],'include':_0xff6011[_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0xff6011[_0xeb14('0x1b')],function(_0x5d8736){return{'model':db[_0x5d8736[_0xeb14('0x1d')]],'as':_0x5d8736['as'],'attributes':_0x5d8736['attributes'],'include':_0x5d8736[_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0x5d8736['include'],function(_0x132db0){return{'model':db[_0x132db0['model']],'as':_0x132db0['as'],'attributes':_0x132db0[_0xeb14('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c549e){logger[_0xeb14('0xb')](_0xeb14('0x15'),_0x297b79);logger[_0xeb14('0xc')]('GetCmHopperBlack',_0x297b79,JSON[_0xeb14('0xe')](_0x3c549e));_0x67322f(_0x3c549e);})[_0xeb14('0x14')](function(_0x4b8dab){logger[_0xeb14('0xf')](_0xeb14('0x15'),_0x4b8dab[_0xeb14('0x11')],_0x297b79);_0x133182(_0x1f6a3a[_0xeb14('0xf')](0x1f4,_0x4b8dab['message']));});});};exports[_0xeb14('0x1e')]=function(_0x54c8da){var _0x29fa4b=this;return new Promise(function(_0x2c22c3,_0x52b2ee){return db[_0xeb14('0x16')][_0xeb14('0x1f')](_0x54c8da[_0xeb14('0x20')],{'raw':_0x54c8da[_0xeb14('0x18')]?_0x54c8da['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')][_0xeb14('0x19')]||null:null,'attributes':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')][_0xeb14('0x1a')]||null:null,'limit':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')]['limit']||null:null})[_0xeb14('0xa')](function(_0x56b968){logger[_0xeb14('0xb')](_0xeb14('0x1e'),_0x54c8da);logger[_0xeb14('0xc')](_0xeb14('0x1e'),_0x54c8da,JSON[_0xeb14('0xe')](_0x56b968));_0x2c22c3(_0x56b968);})[_0xeb14('0x14')](function(_0x1bc4aa){logger['error'](_0xeb14('0x1e'),_0x1bc4aa[_0xeb14('0x11')],_0x54c8da);_0x52b2ee(_0x29fa4b[_0xeb14('0xf')](0x1f4,_0x1bc4aa['message']));});});};exports['DestroyCmHopperBlack']=function(_0x193b9b){var _0x11c829=this;return new Promise(function(_0x30c87a,_0x2b2429){return db[_0xeb14('0x16')][_0xeb14('0x21')]({'where':_0x193b9b['options']?_0x193b9b[_0xeb14('0x18')][_0xeb14('0x19')]||null:null})[_0xeb14('0xa')](function(_0x17514d){logger[_0xeb14('0xb')](_0xeb14('0x22'),_0x193b9b);logger[_0xeb14('0xc')](_0xeb14('0x22'),_0x193b9b,JSON[_0xeb14('0xe')](_0x17514d));_0x30c87a(_0x17514d);})[_0xeb14('0x14')](function(_0x2893dc){logger['error'](_0xeb14('0x22'),_0x2893dc[_0xeb14('0x11')],_0x193b9b);_0x2b2429(_0x11c829[_0xeb14('0xf')](0x1f4,_0x2893dc[_0xeb14('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 532cf2e..2fa0f61 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 _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x17f0d3,_0x173573){var _0x432df1=function(_0x2a65eb){while(--_0x2a65eb){_0x17f0d3['push'](_0x17f0d3['shift']());}};_0x432df1(++_0x173573);}(_0x5334,0x84));var _0x4533=function(_0x17bb36,_0x11f4be){_0x17bb36=_0x17bb36-0x0;var _0x27c574=_0x5334[_0x17bb36];return _0x27c574;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('0x11')]=router; \ No newline at end of file +var _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c018e05..3ca7aa6 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 _0x9f1b=['sequelize','moment','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN'];(function(_0x656490,_0x5bca27){var _0x5649f3=function(_0x39f81e){while(--_0x39f81e){_0x656490['push'](_0x656490['shift']());}};_0x5649f3(++_0x5bca27);}(_0x9f1b,0x129));var _0xb9f1=function(_0x22f6f8,_0x460dff){_0x22f6f8=_0x22f6f8-0x0;var _0x1adab5=_0x9f1b[_0x22f6f8];return _0x1adab5;};'use strict';var Sequelize=require(_0xb9f1('0x0'));var moment=require(_0xb9f1('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb9f1('0x2')]},'scheduledat':{'type':Sequelize[_0xb9f1('0x3')]},'countbusyretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb9f1('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb9f1('0x2')]},'calleridnum':{'type':Sequelize[_0xb9f1('0x2')]},'calleridname':{'type':Sequelize[_0xb9f1('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb9f1('0x3')]},'answertime':{'type':Sequelize[_0xb9f1('0x3')]},'droptime':{'type':Sequelize[_0xb9f1('0x3')]},'endtime':{'type':Sequelize[_0xb9f1('0x3')]},'ringtime':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb9f1('0x2')]},'campaigntype':{'type':Sequelize[_0xb9f1('0x2')]},'membername':{'type':Sequelize[_0xb9f1('0x2')]},'reason':{'type':Sequelize[_0xb9f1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb9f1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb9f1('0x3')],'set':function(_0x141ad4){var _0x34a3d8=this[_0xb9f1('0x5')](_0xb9f1('0x6'));if(_0x34a3d8&&_0x141ad4){this[_0xb9f1('0x7')](_0xb9f1('0x8'),moment(_0x141ad4)['diff'](moment(_0x34a3d8),_0xb9f1('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb9f1('0x3')]},'callback':{'type':Sequelize[_0xb9f1('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb9f1('0x3')]},'deleted':{'type':Sequelize[_0xb9f1('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb9f1('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb9f1('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb9f1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd53=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x3451b2,_0x19cdb6){var _0x5c515a=function(_0x3e344c){while(--_0x3e344c){_0x3451b2['push'](_0x3451b2['shift']());}};_0x5c515a(++_0x19cdb6);}(_0xdd53,0x6c));var _0x3dd5=function(_0x232aa9,_0x1dc221){_0x232aa9=_0x232aa9-0x0;var _0x135acd=_0xdd53[_0x232aa9];return _0x135acd;};'use strict';var Sequelize=require(_0x3dd5('0x0'));var moment=require(_0x3dd5('0x1'));module['exports']={'state':{'type':Sequelize[_0x3dd5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3dd5('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3dd5('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x3dd5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3dd5('0x3')]},'starttime':{'type':Sequelize[_0x3dd5('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3dd5('0x4')]},'droptime':{'type':Sequelize[_0x3dd5('0x4')]},'endtime':{'type':Sequelize[_0x3dd5('0x4')]},'ringtime':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3dd5('0x3')]},'campaign':{'type':Sequelize[_0x3dd5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3dd5('0x3')]},'reason':{'type':Sequelize[_0x3dd5('0x3')]},'disposition':{'type':Sequelize[_0x3dd5('0x3')]},'secondDisposition':{'type':Sequelize[_0x3dd5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3dd5('0x3')]},'dispositionat':{'type':Sequelize[_0x3dd5('0x4')],'set':function(_0x5875a3){var _0x26bb47=this[_0x3dd5('0x5')](_0x3dd5('0x6'));if(_0x26bb47&&_0x5875a3){this[_0x3dd5('0x7')]('followuptime',moment(_0x5875a3)[_0x3dd5('0x8')](moment(_0x26bb47),_0x3dd5('0x9')));}}},'amd':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3dd5('0x4')]},'callback':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3dd5('0x4')]},'deleted':{'type':Sequelize[_0x3dd5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3dd5('0x4')]},'recallme':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3dd5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 92dc833..ce4214b 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 _0xf494=['find','describe','body','uniqueid','params','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','ANY_VALUE(calleridnum)','field','NOW()','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','catch','length'];(function(_0x22eae5,_0x10c9c2){var _0x3f1855=function(_0x332fa3){while(--_0x332fa3){_0x22eae5['push'](_0x22eae5['shift']());}};_0x3f1855(++_0x10c9c2);}(_0xf494,0x1c6));var _0x4f49=function(_0x5f450b,_0x343752){_0x5f450b=_0x5f450b-0x0;var _0x198a63=_0xf494[_0x5f450b];return _0x198a63;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['CmHopperFinal'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['CmHopperFinal'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['describe']()[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,null))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x973099,_0x3ec266){if(_0x973099[_0x4f49('0x48')][_0x4f49('0x49')]){delete _0x973099[_0x4f49('0x48')][_0x4f49('0x49')];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'uniqueid':_0x973099[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x3ec266,null))[_0x4f49('0x25')](saveUpdates(_0x973099[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x3ec266,null))['catch'](handleError(_0x3ec266,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xce5121,_0x197670,_0x36bcc2){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'VoiceQueueId':_0xce5121[_0x4f49('0x4a')]['id']},'attributes':[[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x4f')))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4f49('0x4b')]['literal'](_0x4f49('0x53')))),'congestionContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x54')))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x56')))),_0x4f49('0x57')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),'answeringMachine']]})[_0x4f49('0x25')](handleEntityNotFound(_0x197670,null))['then'](respondWithResult(_0x197670,null))[_0x4f49('0x44')](handleError(_0x197670,null));};exports[_0x4f49('0x5a')]=function(_0x2a2b0d,_0x4aae7c,_0x1dade6){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'CampaignId':_0x2a2b0d[_0x4f49('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x53')))),_0x4f49('0x5b')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x56')))),'abandonedContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x58')))),_0x4f49('0x5c')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),_0x4f49('0x5d')]]})[_0x4f49('0x25')](handleEntityNotFound(_0x4aae7c,null))[_0x4f49('0x25')](respondWithResult(_0x4aae7c,null))[_0x4f49('0x44')](handleError(_0x4aae7c,null));};exports[_0x4f49('0x5e')]=function(_0x1f9161,_0x1434ea,_0x2c3962){return db[_0x4f49('0x5f')][_0x4f49('0x46')]({'where':{'id':_0x1f9161[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x3e9460){var _0x4ff0c1;if(_0x3e9460){_0x4ff0c1=squel[_0x4f49('0x60')]()[_0x4f49('0x61')](_0x4f49('0x62'))[_0x4f49('0x63')]([_0x4f49('0x64'),_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x68'),'createdAt','updatedAt'],squel[_0x4f49('0x69')]()['field'](_0x4f49('0x6a'),_0x4f49('0x64'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x65'))['field']('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')]('ANY_VALUE(ListId)',_0x4f49('0x67'))[_0x4f49('0x6b')]('ANY_VALUE(VoiceQueueId)',_0x4f49('0x68'))['field'](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x71'),_0x1f9161['params']['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x73'),_0x1f9161['body'][_0x4f49('0x74')]['toString']())[_0x4f49('0x38')](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')]('phone')[_0x4f49('0x6f')]('cm_hopper')[_0x4f49('0x38')]('VoiceQueueId\x20=\x20?',_0x1f9161['params']['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')](_0x4f49('0x77'))['from']('cm_hopper_final')['where'](_0x4f49('0x71'),_0x1f9161[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x78')))['group'](_0x4f49('0x66')))[_0x4f49('0x72')]();return db[_0x4f49('0x4b')]['query'](_0x4ff0c1);}return[];})[_0x4f49('0x25')](respondWithResult(_0x1434ea,null))[_0x4f49('0x44')](handleError(_0x1434ea,null));};exports[_0x4f49('0x79')]=function(_0x2902a1,_0x5ea6b4,_0x249799){return db[_0x4f49('0x7a')][_0x4f49('0x46')]({'where':{'id':_0x2902a1[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x5ea6b4,null))['then'](function(_0x2409a8){var _0x32539c;if(_0x2409a8){_0x32539c=squel['insert']()[_0x4f49('0x61')]('cm_hopper')[_0x4f49('0x63')](['phone',_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x7b'),_0x4f49('0x6d'),'updatedAt'],squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x6a'),_0x4f49('0x64'))['field'](_0x4f49('0x6c'),'scheduledAt')[_0x4f49('0x6b')]('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')](_0x4f49('0x7c'),_0x4f49('0x67'))[_0x4f49('0x6b')](_0x4f49('0x7d'),_0x4f49('0x7b'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1['params']['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x73'),_0x2902a1[_0x4f49('0x48')]['state'][_0x4f49('0x72')]())['where'](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()['field'](_0x4f49('0x64'))[_0x4f49('0x6f')](_0x4f49('0x62'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x77'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x78')))[_0x4f49('0x7f')](_0x4f49('0x66')))[_0x4f49('0x72')]();return db['sequelize'][_0x4f49('0x2f')](_0x32539c);}return[];})[_0x4f49('0x25')](respondWithResult(_0x5ea6b4,null))['catch'](handleError(_0x5ea6b4,null));};exports[_0x4f49('0x80')]=function(_0x57c86c,_0xf6bc4c,_0x3bc245){return db[_0x4f49('0x81')][_0x4f49('0x82')]({'where':{'VoiceQueueId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x68')],'CampaignId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x7b')],'ContactId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x66')]}})['then'](handleEntityNotFound(_0xf6bc4c,null))['then'](function(_0x32b4b4){if(_0x32b4b4){return _0x32b4b4;}return null;})['then'](respondWithResult(_0xf6bc4c,null))[_0x4f49('0x44')](handleError(_0xf6bc4c,null));}; \ No newline at end of file +var _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x581cb5,_0xaf407b){var _0x1d31e8=function(_0x380985){while(--_0x380985){_0x581cb5['push'](_0x581cb5['shift']());}};_0x1d31e8(++_0xaf407b);}(_0x1883,0xab));var _0x3188=function(_0x5a1017,_0x4ca6bf){_0x5a1017=_0x5a1017-0x0;var _0x1fb1a4=_0x1883[_0x5a1017];return _0x1fb1a4;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 911f9c0..083228d 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 _0xc8df=['../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xc8df,0x77));var _0xfc8d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc8df[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xfc8d('0x0'));var util=require(_0xfc8d('0x1'));var logger=require(_0xfc8d('0x2'))(_0xfc8d('0x3'));var moment=require(_0xfc8d('0x4'));var BPromise=require(_0xfc8d('0x5'));var rp=require(_0xfc8d('0x6'));var fs=require('fs');var path=require(_0xfc8d('0x7'));var rimraf=require(_0xfc8d('0x8'));var config=require(_0xfc8d('0x9'));var attributes=require(_0xfc8d('0xa'));module[_0xfc8d('0xb')]=function(_0x36b8dc,_0x3a8239){return _0x36b8dc['define'](_0xfc8d('0xc'),attributes,{'tableName':_0xfc8d('0xd'),'paranoid':![],'indexes':[{'name':_0xfc8d('0xe'),'fields':[_0xfc8d('0xe')]},{'name':_0xfc8d('0xf'),'fields':[_0xfc8d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40c8=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x40c8,0x10f));var _0x840c=function(_0x24399a,_0x1deb50){_0x24399a=_0x24399a-0x0;var _0x5e58f2=_0x40c8[_0x24399a];return _0x5e58f2;};'use strict';var _=require(_0x840c('0x0'));var util=require(_0x840c('0x1'));var logger=require(_0x840c('0x2'))(_0x840c('0x3'));var moment=require(_0x840c('0x4'));var BPromise=require(_0x840c('0x5'));var rp=require(_0x840c('0x6'));var fs=require('fs');var path=require(_0x840c('0x7'));var rimraf=require('rimraf');var config=require(_0x840c('0x8'));var attributes=require(_0x840c('0x9'));module['exports']=function(_0x244a31,_0x288f5d){return _0x244a31[_0x840c('0xa')]('CmHopperFinal',attributes,{'tableName':_0x840c('0xb'),'paranoid':![],'indexes':[{'name':_0x840c('0xc'),'fields':[_0x840c('0xc')]},{'name':_0x840c('0xd'),'fields':[_0x840c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2c9f614..fbdad70 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(_0x4ab774,_0xc6cee1){var _0x169602=function(_0x10e081){while(--_0x10e081){_0x4ab774['push'](_0x4ab774['shift']());}};_0x169602(++_0xc6cee1);}(_0x7a54,0x106));var _0x47a5=function(_0x443b28,_0x2e3584){_0x443b28=_0x443b28-0x0;var _0x44d017=_0x7a54[_0x443b28];return _0x44d017;};'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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3eabc2,_0x2b981b){var _0x2e0863=function(_0x2ebafa){while(--_0x2ebafa){_0x3eabc2['push'](_0x3eabc2['shift']());}};_0x2e0863(++_0x2b981b);}(_0xb10b,0x12a));var _0xbb10=function(_0x15c23e,_0x162305){_0x15c23e=_0x15c23e-0x0;var _0x4ed7d1=_0xb10b[_0x15c23e];return _0x4ed7d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 7af1316..e787147 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 _0x689f=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x4af3eb,_0x48cca9){var _0x96ebba=function(_0x23e683){while(--_0x23e683){_0x4af3eb['push'](_0x4af3eb['shift']());}};_0x96ebba(++_0x48cca9);}(_0x689f,0x81));var _0xf689=function(_0x29105c,_0x1dd29f){_0x29105c=_0x29105c-0x0;var _0x16be8d=_0x689f[_0x29105c];return _0x16be8d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf689('0x0'));var express=require(_0xf689('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf689('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf689('0x3'));var controller=require('./cmHopperFinal.controller');router[_0xf689('0x4')]('/',auth[_0xf689('0x5')](),controller[_0xf689('0x6')]);router['get'](_0xf689('0x7'),auth[_0xf689('0x5')](),controller['describe']);router[_0xf689('0x4')](_0xf689('0x8'),auth['isAuthenticated'](),controller[_0xf689('0x9')]);router[_0xf689('0x4')](_0xf689('0xa'),auth[_0xf689('0x5')](),controller[_0xf689('0xb')]);router[_0xf689('0x4')](_0xf689('0xc'),auth['isAuthenticated'](),controller[_0xf689('0xd')]);router[_0xf689('0xe')](_0xf689('0xf'),auth[_0xf689('0x5')](),controller[_0xf689('0x10')]);router[_0xf689('0xe')](_0xf689('0x11'),auth[_0xf689('0x5')](),controller[_0xf689('0x12')]);router['post'](_0xf689('0x13'),auth[_0xf689('0x5')](),controller[_0xf689('0x14')]);router[_0xf689('0x15')]('/:id',auth[_0xf689('0x5')](),controller[_0xf689('0x16')]);module[_0xf689('0x17')]=router; \ No newline at end of file +var _0x3823=['../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e9aca,_0x1bfeeb){var _0x22b7c2=function(_0x3dfdbc){while(--_0x3dfdbc){_0x5e9aca['push'](_0x5e9aca['shift']());}};_0x22b7c2(++_0x1bfeeb);}(_0x3823,0xb0));var _0x3382=function(_0x570b17,_0x3e25d4){_0x570b17=_0x570b17-0x0;var _0x230b47=_0x3823[_0x570b17];return _0x230b47;};'use strict';var multer=require('multer');var util=require(_0x3382('0x0'));var path=require(_0x3382('0x1'));var timeout=require(_0x3382('0x2'));var express=require('express');var router=express[_0x3382('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3382('0x4'));var interaction=require(_0x3382('0x5'));var config=require(_0x3382('0x6'));var controller=require(_0x3382('0x7'));router['get']('/',auth[_0x3382('0x8')](),controller[_0x3382('0x9')]);router[_0x3382('0xa')](_0x3382('0xb'),auth[_0x3382('0x8')](),controller[_0x3382('0xc')]);router[_0x3382('0xa')](_0x3382('0xd'),auth[_0x3382('0x8')](),controller[_0x3382('0xe')]);router[_0x3382('0xa')](_0x3382('0xf'),auth[_0x3382('0x8')](),controller[_0x3382('0x10')]);router[_0x3382('0xa')](_0x3382('0x11'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3382('0x12')](_0x3382('0x13'),auth[_0x3382('0x8')](),controller[_0x3382('0x14')]);router[_0x3382('0x12')](_0x3382('0x15'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x3382('0x12')](_0x3382('0x16'),auth[_0x3382('0x8')](),controller[_0x3382('0x17')]);router[_0x3382('0x18')](_0x3382('0xd'),auth[_0x3382('0x8')](),controller['update']);module[_0x3382('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f83ea37..7fc6dab 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 _0xa1f9=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa1f9,0x16f));var _0x9a1f=function(_0x4da868,_0xa4684f){_0x4da868=_0x4da868-0x0;var _0x4a0440=_0xa1f9[_0x4da868];return _0x4a0440;};'use strict';var Sequelize=require(_0x9a1f('0x0'));module[_0x9a1f('0x1')]={'state':{'type':Sequelize[_0x9a1f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9a1f('0x3')]},'scheduledat':{'type':Sequelize[_0x9a1f('0x4')]},'countbusyretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9a1f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9a1f('0x3')]},'calleridname':{'type':Sequelize[_0x9a1f('0x3')]},'starttime':{'type':Sequelize[_0x9a1f('0x4')]},'responsetime':{'type':Sequelize[_0x9a1f('0x4')]},'answertime':{'type':Sequelize[_0x9a1f('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9a1f('0x3')]},'campaign':{'type':Sequelize[_0x9a1f('0x3')]},'campaigntype':{'type':Sequelize[_0x9a1f('0x3')]},'membername':{'type':Sequelize[_0x9a1f('0x3')]},'reason':{'type':Sequelize[_0x9a1f('0x3')]},'amd':{'type':Sequelize[_0x9a1f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9a1f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9a1f('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9a1f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9a1f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9a1f('0x4')]},'edited':{'type':Sequelize[_0x9a1f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9a1f('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9a1f('0x3')]}}; \ No newline at end of file +var _0xdb1c=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x42b324,_0x321cae){var _0x2896c3=function(_0x2018d4){while(--_0x2018d4){_0x42b324['push'](_0x42b324['shift']());}};_0x2896c3(++_0x321cae);}(_0xdb1c,0xcf));var _0xcdb1=function(_0xe6aba1,_0x4ff2b4){_0xe6aba1=_0xe6aba1-0x0;var _0x56482c=_0xdb1c[_0xe6aba1];return _0x56482c;};'use strict';var Sequelize=require(_0xcdb1('0x0'));module[_0xcdb1('0x1')]={'state':{'type':Sequelize[_0xcdb1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcdb1('0x3')]},'scheduledat':{'type':Sequelize[_0xcdb1('0x4')]},'countbusyretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcdb1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xcdb1('0x3')]},'originatecalleridname':{'type':Sequelize[_0xcdb1('0x3')]},'calleridnum':{'type':Sequelize[_0xcdb1('0x3')]},'calleridname':{'type':Sequelize[_0xcdb1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcdb1('0x4')]},'answertime':{'type':Sequelize[_0xcdb1('0x4')]},'droptime':{'type':Sequelize[_0xcdb1('0x4')]},'endtime':{'type':Sequelize[_0xcdb1('0x4')]},'ringtime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcdb1('0x3')]},'campaign':{'type':Sequelize[_0xcdb1('0x3')]},'campaigntype':{'type':Sequelize[_0xcdb1('0x3')]},'membername':{'type':Sequelize[_0xcdb1('0x3')]},'reason':{'type':Sequelize[_0xcdb1('0x3')]},'amd':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcdb1('0x4')]},'recallme':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcdb1('0x4')]},'edited':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d5d2d59..922e11c 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 _0x07e2=['params','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show'];(function(_0x3332c2,_0x59efee){var _0x85588=function(_0x1c9909){while(--_0x1c9909){_0x3332c2['push'](_0x3332c2['shift']());}};_0x85588(++_0x59efee);}(_0x07e2,0xfd));var _0x207e=function(_0x5e4465,_0x14cc59){_0x5e4465=_0x5e4465-0x0;var _0x44de9c=_0x07e2[_0x5e4465];return _0x44de9c;};'use strict';var emlformat=require(_0x207e('0x0'));var rimraf=require(_0x207e('0x1'));var zipdir=require(_0x207e('0x2'));var jsonpatch=require(_0x207e('0x3'));var rp=require('request-promise');var moment=require(_0x207e('0x4'));var BPromise=require(_0x207e('0x5'));var Mustache=require(_0x207e('0x6'));var util=require(_0x207e('0x7'));var path=require(_0x207e('0x8'));var sox=require(_0x207e('0x9'));var csv=require(_0x207e('0xa'));var ejs=require(_0x207e('0xb'));var fs=require('fs');var fs_extra=require(_0x207e('0xc'));var _=require(_0x207e('0xd'));var squel=require(_0x207e('0xe'));var crypto=require(_0x207e('0xf'));var jsforce=require(_0x207e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x207e('0xa'));var querystring=require(_0x207e('0x11'));var Papa=require(_0x207e('0x12'));var Redis=require(_0x207e('0x13'));var authService=require(_0x207e('0x14'));var qs=require(_0x207e('0x15'));var as=require(_0x207e('0x16'));var hardwareService=require(_0x207e('0x17'));var logger=require('../../config/logger')(_0x207e('0x18'));var utils=require('../../config/utils');var config=require(_0x207e('0x19'));var licenseUtil=require(_0x207e('0x1a'));var db=require(_0x207e('0x1b'))['db'];function respondWithStatusCode(_0x2c50ab,_0x2f7ba8){_0x2f7ba8=_0x2f7ba8||0xcc;return function(_0x18518c){if(_0x18518c){return _0x2c50ab[_0x207e('0x1c')](_0x2f7ba8);}return _0x2c50ab[_0x207e('0x1d')](_0x2f7ba8)[_0x207e('0x1e')]();};}function respondWithResult(_0x2dcf25,_0x310803){_0x310803=_0x310803||0xc8;return function(_0x4dc2f7){if(_0x4dc2f7){return _0x2dcf25[_0x207e('0x1d')](_0x310803)[_0x207e('0x1f')](_0x4dc2f7);}};}function respondWithFilteredResult(_0x5ad6bf,_0x42039e){return function(_0x5c9c40){if(_0x5c9c40){var _0x542652=typeof _0x42039e[_0x207e('0x20')]==='undefined'&&typeof _0x42039e[_0x207e('0x21')]===_0x207e('0x22');var _0x21cea4=_0x5c9c40[_0x207e('0x23')];var _0x39142d=_0x542652?0x0:_0x42039e[_0x207e('0x20')];var _0x1f8e63=_0x542652?_0x5c9c40[_0x207e('0x23')]:_0x42039e[_0x207e('0x20')]+_0x42039e[_0x207e('0x21')];var _0x55b46e;if(_0x1f8e63>=_0x21cea4){_0x1f8e63=_0x21cea4;_0x55b46e=0xc8;}else{_0x55b46e=0xce;}_0x5ad6bf[_0x207e('0x1d')](_0x55b46e);return _0x5ad6bf[_0x207e('0x24')](_0x207e('0x25'),_0x39142d+'-'+_0x1f8e63+'/'+_0x21cea4)[_0x207e('0x1f')](_0x5c9c40);}return null;};}function patchUpdates(_0x234f46){return function(_0x1d4cc4){try{jsonpatch[_0x207e('0x26')](_0x1d4cc4,_0x234f46,!![]);}catch(_0x433cb5){return BPromise['reject'](_0x433cb5);}return _0x1d4cc4[_0x207e('0x27')]();};}function saveUpdates(_0x32014e,_0x4ba9fd){return function(_0x3db879){if(_0x3db879){return _0x3db879['update'](_0x32014e)[_0x207e('0x28')](function(_0x59d43e){return _0x59d43e;});}return null;};}function removeEntity(_0x1c27c8,_0x32f95e){return function(_0x436d7a){if(_0x436d7a){return _0x436d7a['destroy']()[_0x207e('0x28')](function(){_0x1c27c8[_0x207e('0x1d')](0xcc)[_0x207e('0x1e')]();});}};}function handleEntityNotFound(_0x3bfe94,_0x3d22bb){return function(_0x1789c1){if(!_0x1789c1){_0x3bfe94['sendStatus'](0x194);}return _0x1789c1;};}function handleError(_0x4b00c1,_0x2d7f0d){_0x2d7f0d=_0x2d7f0d||0x1f4;return function(_0x54df6f){logger[_0x207e('0x29')](_0x54df6f[_0x207e('0x2a')]);if(_0x54df6f[_0x207e('0x2b')]){delete _0x54df6f[_0x207e('0x2b')];}_0x4b00c1[_0x207e('0x1d')](_0x2d7f0d)[_0x207e('0x2c')](_0x54df6f);};}exports['index']=function(_0x151f03,_0x119cde){var _0x2e2b9d={},_0x28408c={},_0x3a5d7a={'count':0x0,'rows':[]};var _0x2ffa18=_['map'](db['CmHopperHistory'][_0x207e('0x2d')],function(_0xa5bc94){return{'name':_0xa5bc94[_0x207e('0x2e')],'type':_0xa5bc94[_0x207e('0x2f')][_0x207e('0x30')]};});_0x28408c[_0x207e('0x31')]=_[_0x207e('0x32')](_0x2ffa18,_0x207e('0x2b'));_0x28408c[_0x207e('0x33')]=_[_0x207e('0x34')](_0x151f03[_0x207e('0x33')]);_0x28408c[_0x207e('0x35')]=_[_0x207e('0x36')](_0x28408c[_0x207e('0x31')],_0x28408c[_0x207e('0x33')]);_0x2e2b9d['attributes']=_[_0x207e('0x36')](_0x28408c[_0x207e('0x31')],qs[_0x207e('0x37')](_0x151f03[_0x207e('0x33')]['fields']));_0x2e2b9d[_0x207e('0x38')]=_0x2e2b9d[_0x207e('0x38')][_0x207e('0x39')]?_0x2e2b9d[_0x207e('0x38')]:_0x28408c[_0x207e('0x31')];if(!_0x151f03[_0x207e('0x33')][_0x207e('0x3a')](_0x207e('0x3b'))){_0x2e2b9d[_0x207e('0x21')]=qs[_0x207e('0x21')](_0x151f03[_0x207e('0x33')][_0x207e('0x21')]);_0x2e2b9d['offset']=qs['offset'](_0x151f03[_0x207e('0x33')][_0x207e('0x20')]);}_0x2e2b9d[_0x207e('0x3c')]=qs['sort'](_0x151f03[_0x207e('0x33')][_0x207e('0x3d')]);_0x2e2b9d[_0x207e('0x3e')]=qs[_0x207e('0x35')](_[_0x207e('0x3f')](_0x151f03[_0x207e('0x33')],_0x28408c[_0x207e('0x35')]),_0x2ffa18);if(_0x151f03['query'][_0x207e('0x40')]){_0x2e2b9d[_0x207e('0x3e')]=_[_0x207e('0x41')](_0x2e2b9d[_0x207e('0x3e')],{'$or':_[_0x207e('0x32')](_0x2ffa18,function(_0x5682d8){if(_0x5682d8[_0x207e('0x2f')]!==_0x207e('0x42')){var _0x10b696={};_0x10b696[_0x5682d8['name']]={'$like':'%'+_0x151f03[_0x207e('0x33')][_0x207e('0x40')]+'%'};return _0x10b696;}})});}_0x2e2b9d=_[_0x207e('0x41')]({},_0x2e2b9d,_0x151f03[_0x207e('0x43')]);var _0x40d242={'where':_0x2e2b9d[_0x207e('0x3e')]};return db[_0x207e('0x44')][_0x207e('0x23')](_0x40d242)['then'](function(_0x29ffcc){_0x3a5d7a[_0x207e('0x23')]=_0x29ffcc;if(_0x151f03[_0x207e('0x33')][_0x207e('0x45')]){_0x2e2b9d[_0x207e('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x207e('0x47')](_0x2e2b9d);})[_0x207e('0x28')](function(_0x521e03){_0x3a5d7a[_0x207e('0x48')]=_0x521e03;return _0x3a5d7a;})[_0x207e('0x28')](respondWithFilteredResult(_0x119cde,_0x2e2b9d))[_0x207e('0x49')](handleError(_0x119cde,null));};exports[_0x207e('0x4a')]=function(_0x1d3a9c,_0x4d18db){var _0x30be09={'raw':!![],'where':{'id':_0x1d3a9c[_0x207e('0x4b')]['id']}},_0x2bf88d={};_0x2bf88d[_0x207e('0x31')]=_['keys'](db['CmHopperHistory'][_0x207e('0x2d')]);_0x2bf88d['query']=_[_0x207e('0x34')](_0x1d3a9c['query']);_0x2bf88d[_0x207e('0x35')]=_['intersection'](_0x2bf88d[_0x207e('0x31')],_0x2bf88d[_0x207e('0x33')]);_0x30be09[_0x207e('0x38')]=_[_0x207e('0x36')](_0x2bf88d['model'],qs[_0x207e('0x37')](_0x1d3a9c[_0x207e('0x33')][_0x207e('0x37')]));_0x30be09[_0x207e('0x38')]=_0x30be09[_0x207e('0x38')][_0x207e('0x39')]?_0x30be09['attributes']:_0x2bf88d[_0x207e('0x31')];if(_0x1d3a9c['query'][_0x207e('0x45')]){_0x30be09[_0x207e('0x46')]=[{'all':!![]}];}_0x30be09=_[_0x207e('0x41')]({},_0x30be09,_0x1d3a9c['options']);return db[_0x207e('0x44')][_0x207e('0x4c')](_0x30be09)['then'](handleEntityNotFound(_0x4d18db,null))[_0x207e('0x28')](respondWithResult(_0x4d18db,null))['catch'](handleError(_0x4d18db,null));};exports[_0x207e('0x4d')]=function(_0x1530c8,_0x132f15){return db[_0x207e('0x44')]['create'](_0x1530c8[_0x207e('0x4e')],{})[_0x207e('0x28')](respondWithResult(_0x132f15,0xc9))[_0x207e('0x49')](handleError(_0x132f15,null));};exports[_0x207e('0x4f')]=function(_0x5dd94a,_0x1d9da1){return db[_0x207e('0x44')]['describe']()[_0x207e('0x28')](respondWithResult(_0x1d9da1,null))[_0x207e('0x49')](handleError(_0x1d9da1,null));};exports[_0x207e('0x50')]=function(_0x30214b,_0x539fbe){if(_0x30214b[_0x207e('0x4e')]['uniqueid']){delete _0x30214b[_0x207e('0x4e')][_0x207e('0x51')];}return db['CmHopperHistory'][_0x207e('0x4c')]({'where':{'uniqueid':_0x30214b[_0x207e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x539fbe,null))[_0x207e('0x28')](saveUpdates(_0x30214b[_0x207e('0x4e')],null))['then'](respondWithResult(_0x539fbe,null))['catch'](handleError(_0x539fbe,null));}; \ No newline at end of file +var _0xd7b6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','CmHopperHistory','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','rawAttributes','find','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x35c718,_0x33a696){var _0x5c3099=function(_0x2810cd){while(--_0x2810cd){_0x35c718['push'](_0x35c718['shift']());}};_0x5c3099(++_0x33a696);}(_0xd7b6,0xe1));var _0x6d7b=function(_0x9b2bb,_0x254d3c){_0x9b2bb=_0x9b2bb-0x0;var _0x402f9d=_0xd7b6[_0x9b2bb];return _0x402f9d;};'use strict';var emlformat=require(_0x6d7b('0x0'));var rimraf=require(_0x6d7b('0x1'));var zipdir=require(_0x6d7b('0x2'));var jsonpatch=require(_0x6d7b('0x3'));var rp=require('request-promise');var moment=require(_0x6d7b('0x4'));var BPromise=require(_0x6d7b('0x5'));var Mustache=require(_0x6d7b('0x6'));var util=require(_0x6d7b('0x7'));var path=require(_0x6d7b('0x8'));var sox=require(_0x6d7b('0x9'));var csv=require(_0x6d7b('0xa'));var ejs=require(_0x6d7b('0xb'));var fs=require('fs');var fs_extra=require(_0x6d7b('0xc'));var _=require(_0x6d7b('0xd'));var squel=require(_0x6d7b('0xe'));var crypto=require(_0x6d7b('0xf'));var jsforce=require(_0x6d7b('0x10'));var deskjs=require(_0x6d7b('0x11'));var toCsv=require(_0x6d7b('0xa'));var querystring=require(_0x6d7b('0x12'));var Papa=require(_0x6d7b('0x13'));var Redis=require(_0x6d7b('0x14'));var authService=require(_0x6d7b('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d7b('0x16'));var logger=require(_0x6d7b('0x17'))(_0x6d7b('0x18'));var utils=require('../../config/utils');var config=require(_0x6d7b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d7b('0x1a'))['db'];function respondWithStatusCode(_0x456bd9,_0x1e8ca8){_0x1e8ca8=_0x1e8ca8||0xcc;return function(_0x61cecc){if(_0x61cecc){return _0x456bd9[_0x6d7b('0x1b')](_0x1e8ca8);}return _0x456bd9[_0x6d7b('0x1c')](_0x1e8ca8)[_0x6d7b('0x1d')]();};}function respondWithResult(_0x3c8f10,_0x5eeb72){_0x5eeb72=_0x5eeb72||0xc8;return function(_0x4578d2){if(_0x4578d2){return _0x3c8f10['status'](_0x5eeb72)[_0x6d7b('0x1e')](_0x4578d2);}};}function respondWithFilteredResult(_0x4f1761,_0x6edc03){return function(_0x5b688a){if(_0x5b688a){var _0x308e69=typeof _0x6edc03['offset']===_0x6d7b('0x1f')&&typeof _0x6edc03[_0x6d7b('0x20')]===_0x6d7b('0x1f');var _0x4a5a2e=_0x5b688a[_0x6d7b('0x21')];var _0x5ead55=_0x308e69?0x0:_0x6edc03[_0x6d7b('0x22')];var _0x9474df=_0x308e69?_0x5b688a[_0x6d7b('0x21')]:_0x6edc03[_0x6d7b('0x22')]+_0x6edc03[_0x6d7b('0x20')];var _0x2c7dc6;if(_0x9474df>=_0x4a5a2e){_0x9474df=_0x4a5a2e;_0x2c7dc6=0xc8;}else{_0x2c7dc6=0xce;}_0x4f1761['status'](_0x2c7dc6);return _0x4f1761[_0x6d7b('0x23')](_0x6d7b('0x24'),_0x5ead55+'-'+_0x9474df+'/'+_0x4a5a2e)[_0x6d7b('0x1e')](_0x5b688a);}return null;};}function patchUpdates(_0x5c0ee1){return function(_0x274126){try{jsonpatch[_0x6d7b('0x25')](_0x274126,_0x5c0ee1,!![]);}catch(_0x31e5c7){return BPromise['reject'](_0x31e5c7);}return _0x274126[_0x6d7b('0x26')]();};}function saveUpdates(_0x4d1a52,_0x4f0475){return function(_0x5b3d84){if(_0x5b3d84){return _0x5b3d84[_0x6d7b('0x27')](_0x4d1a52)[_0x6d7b('0x28')](function(_0x54fa7e){return _0x54fa7e;});}return null;};}function removeEntity(_0x1237f2,_0x1cd7f9){return function(_0x22898d){if(_0x22898d){return _0x22898d['destroy']()[_0x6d7b('0x28')](function(){_0x1237f2[_0x6d7b('0x1c')](0xcc)[_0x6d7b('0x1d')]();});}};}function handleEntityNotFound(_0x1fbbec,_0x148118){return function(_0x3589b3){if(!_0x3589b3){_0x1fbbec[_0x6d7b('0x1b')](0x194);}return _0x3589b3;};}function handleError(_0x3ab218,_0x460543){_0x460543=_0x460543||0x1f4;return function(_0x32b7a6){logger[_0x6d7b('0x29')](_0x32b7a6[_0x6d7b('0x2a')]);if(_0x32b7a6[_0x6d7b('0x2b')]){delete _0x32b7a6['name'];}_0x3ab218[_0x6d7b('0x1c')](_0x460543)['send'](_0x32b7a6);};}exports[_0x6d7b('0x2c')]=function(_0x31915f,_0x5f4fb2){var _0x1e9433={},_0x21f4f7={},_0x3a7af4={'count':0x0,'rows':[]};var _0x22c3a9=_[_0x6d7b('0x2d')](db[_0x6d7b('0x2e')]['rawAttributes'],function(_0x4f5386){return{'name':_0x4f5386[_0x6d7b('0x2f')],'type':_0x4f5386[_0x6d7b('0x30')][_0x6d7b('0x31')]};});_0x21f4f7[_0x6d7b('0x32')]=_[_0x6d7b('0x2d')](_0x22c3a9,_0x6d7b('0x2b'));_0x21f4f7[_0x6d7b('0x33')]=_[_0x6d7b('0x34')](_0x31915f[_0x6d7b('0x33')]);_0x21f4f7['filters']=_[_0x6d7b('0x35')](_0x21f4f7[_0x6d7b('0x32')],_0x21f4f7[_0x6d7b('0x33')]);_0x1e9433[_0x6d7b('0x36')]=_[_0x6d7b('0x35')](_0x21f4f7[_0x6d7b('0x32')],qs[_0x6d7b('0x37')](_0x31915f['query'][_0x6d7b('0x37')]));_0x1e9433[_0x6d7b('0x36')]=_0x1e9433[_0x6d7b('0x36')][_0x6d7b('0x38')]?_0x1e9433['attributes']:_0x21f4f7[_0x6d7b('0x32')];if(!_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x39')](_0x6d7b('0x3a'))){_0x1e9433['limit']=qs[_0x6d7b('0x20')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x20')]);_0x1e9433['offset']=qs[_0x6d7b('0x22')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x22')]);}_0x1e9433[_0x6d7b('0x3b')]=qs[_0x6d7b('0x3c')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x3c')]);_0x1e9433[_0x6d7b('0x3d')]=qs[_0x6d7b('0x3e')](_[_0x6d7b('0x3f')](_0x31915f[_0x6d7b('0x33')],_0x21f4f7['filters']),_0x22c3a9);if(_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x40')]){_0x1e9433[_0x6d7b('0x3d')]=_['merge'](_0x1e9433[_0x6d7b('0x3d')],{'$or':_[_0x6d7b('0x2d')](_0x22c3a9,function(_0x22d905){if(_0x22d905['type']!==_0x6d7b('0x41')){var _0x2a40a2={};_0x2a40a2[_0x22d905[_0x6d7b('0x2b')]]={'$like':'%'+_0x31915f[_0x6d7b('0x33')]['filter']+'%'};return _0x2a40a2;}})});}_0x1e9433=_[_0x6d7b('0x42')]({},_0x1e9433,_0x31915f[_0x6d7b('0x43')]);var _0x7c4f6e={'where':_0x1e9433[_0x6d7b('0x3d')]};return db[_0x6d7b('0x2e')][_0x6d7b('0x21')](_0x7c4f6e)['then'](function(_0x2bfb95){_0x3a7af4[_0x6d7b('0x21')]=_0x2bfb95;if(_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x44')]){_0x1e9433[_0x6d7b('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6d7b('0x46')](_0x1e9433);})[_0x6d7b('0x28')](function(_0x4d3e49){_0x3a7af4['rows']=_0x4d3e49;return _0x3a7af4;})['then'](respondWithFilteredResult(_0x5f4fb2,_0x1e9433))[_0x6d7b('0x47')](handleError(_0x5f4fb2,null));};exports['show']=function(_0x382a20,_0x230435){var _0x21da2c={'raw':!![],'where':{'id':_0x382a20['params']['id']}},_0x3e6ec6={};_0x3e6ec6[_0x6d7b('0x32')]=_[_0x6d7b('0x34')](db['CmHopperHistory'][_0x6d7b('0x48')]);_0x3e6ec6['query']=_[_0x6d7b('0x34')](_0x382a20[_0x6d7b('0x33')]);_0x3e6ec6[_0x6d7b('0x3e')]=_[_0x6d7b('0x35')](_0x3e6ec6[_0x6d7b('0x32')],_0x3e6ec6['query']);_0x21da2c['attributes']=_['intersection'](_0x3e6ec6[_0x6d7b('0x32')],qs['fields'](_0x382a20[_0x6d7b('0x33')][_0x6d7b('0x37')]));_0x21da2c[_0x6d7b('0x36')]=_0x21da2c[_0x6d7b('0x36')][_0x6d7b('0x38')]?_0x21da2c[_0x6d7b('0x36')]:_0x3e6ec6[_0x6d7b('0x32')];if(_0x382a20[_0x6d7b('0x33')][_0x6d7b('0x44')]){_0x21da2c[_0x6d7b('0x45')]=[{'all':!![]}];}_0x21da2c=_['merge']({},_0x21da2c,_0x382a20[_0x6d7b('0x43')]);return db[_0x6d7b('0x2e')][_0x6d7b('0x49')](_0x21da2c)[_0x6d7b('0x28')](handleEntityNotFound(_0x230435,null))[_0x6d7b('0x28')](respondWithResult(_0x230435,null))[_0x6d7b('0x47')](handleError(_0x230435,null));};exports['create']=function(_0x37b3e2,_0xc1b81c){return db['CmHopperHistory']['create'](_0x37b3e2[_0x6d7b('0x4a')],{})[_0x6d7b('0x28')](respondWithResult(_0xc1b81c,0xc9))[_0x6d7b('0x47')](handleError(_0xc1b81c,null));};exports[_0x6d7b('0x4b')]=function(_0x533902,_0xd18daf){return db[_0x6d7b('0x2e')]['describe']()[_0x6d7b('0x28')](respondWithResult(_0xd18daf,null))[_0x6d7b('0x47')](handleError(_0xd18daf,null));};exports[_0x6d7b('0x27')]=function(_0x79aad6,_0x31a312){if(_0x79aad6[_0x6d7b('0x4a')]['uniqueid']){delete _0x79aad6[_0x6d7b('0x4a')][_0x6d7b('0x4c')];}return db[_0x6d7b('0x2e')][_0x6d7b('0x49')]({'where':{'uniqueid':_0x79aad6[_0x6d7b('0x4d')]['id']}})[_0x6d7b('0x28')](handleEntityNotFound(_0x31a312,null))[_0x6d7b('0x28')](saveUpdates(_0x79aad6['body'],null))['then'](respondWithResult(_0x31a312,null))[_0x6d7b('0x47')](handleError(_0x31a312,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 64192fc..3512887 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 _0x3cae=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0x9b0581,_0x5d123c){var _0x449969=function(_0x5c2436){while(--_0x5c2436){_0x9b0581['push'](_0x9b0581['shift']());}};_0x449969(++_0x5d123c);}(_0x3cae,0x117));var _0xe3ca=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x3cae[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var logger=require(_0xe3ca('0x2'))(_0xe3ca('0x3'));var moment=require(_0xe3ca('0x4'));var BPromise=require(_0xe3ca('0x5'));var rp=require(_0xe3ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3ca('0x7'));var config=require(_0xe3ca('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xe3ca('0x9')]=function(_0x48691a,_0x2f2632){return _0x48691a[_0xe3ca('0xa')](_0xe3ca('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xe3ca('0xc'),'fields':[_0xe3ca('0xc')]},{'name':_0xe3ca('0xd'),'fields':[_0xe3ca('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75dd=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x75dd,0x1c9));var _0xd75d=function(_0x4515f7,_0x5576a0){_0x4515f7=_0x4515f7-0x0;var _0xfc0b27=_0x75dd[_0x4515f7];return _0xfc0b27;};'use strict';var _=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var logger=require(_0xd75d('0x2'))(_0xd75d('0x3'));var moment=require(_0xd75d('0x4'));var BPromise=require(_0xd75d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd75d('0x6'));var rimraf=require(_0xd75d('0x7'));var config=require(_0xd75d('0x8'));var attributes=require(_0xd75d('0x9'));module[_0xd75d('0xa')]=function(_0xc3ab73,_0x272588){return _0xc3ab73[_0xd75d('0xb')]('CmHopperHistory',attributes,{'tableName':_0xd75d('0xc'),'paranoid':![],'indexes':[{'name':_0xd75d('0xd'),'fields':[_0xd75d('0xd')]},{'name':_0xd75d('0xe'),'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 1c1a6b0..b17c296 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 _0x1b73=['`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x19d37,_0xd84900){var _0x2ff24a=function(_0x4abcc2){while(--_0x4abcc2){_0x19d37['push'](_0x19d37['shift']());}};_0x2ff24a(++_0xd84900);}(_0x1b73,0x1d5));var _0x31b7=function(_0x3a88d7,_0xfe6972){_0x3a88d7=_0x3a88d7-0x0;var _0x5f1963=_0x1b73[_0x3a88d7];return _0x5f1963;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});}exports[_0x31b7('0x17')]=function(_0x5f3245){var _0x223f9f=this;return new Promise(function(_0x437eba,_0x1dc28c){return db[_0x31b7('0x18')][_0x31b7('0x19')](_0x5f3245['body'],{'raw':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1b')]===undefined?!![]:![]:!![]})[_0x31b7('0xb')](function(_0x5b56bc){logger[_0x31b7('0x14')](_0x31b7('0x17'),_0x5f3245);logger[_0x31b7('0xe')](_0x31b7('0x17'),_0x5f3245,JSON['stringify'](_0x5b56bc));_0x437eba(_0x5b56bc);})[_0x31b7('0x16')](function(_0x20cb03){logger[_0x31b7('0x11')](_0x31b7('0x17'),_0x20cb03[_0x31b7('0x13')],_0x5f3245);_0x1dc28c(_0x223f9f[_0x31b7('0x11')](0x1f4,_0x20cb03[_0x31b7('0x13')]));});});};exports[_0x31b7('0x1c')]=function(_0x3b0eff){var _0x499c39=this;return new Promise(function(_0x3ed48d,_0x35a51f){return db[_0x31b7('0x18')][_0x31b7('0x1d')]({'raw':_0x3b0eff['options']?_0x3b0eff[_0x31b7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b0eff[_0x31b7('0x1a')]?_0x3b0eff[_0x31b7('0x1a')][_0x31b7('0x1e')]||null:null,'attributes':[[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')][_0x31b7('0x21')]('id')),_0x31b7('0x22')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')]['literal'](_0x31b7('0x25')))),_0x31b7('0x26')],[db['sequelize']['fn']('COUNT',db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x31b7('0x28'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x29')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x31b7('0x28'),db[_0x31b7('0x1f')]['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0x31b7('0xb')](function(_0x1fa0ea){logger[_0x31b7('0x14')](_0x31b7('0x1c'),_0x3b0eff);logger[_0x31b7('0xe')](_0x31b7('0x1c'),_0x3b0eff,JSON[_0x31b7('0x10')](_0x1fa0ea));_0x3ed48d(_0x1fa0ea);})[_0x31b7('0x16')](function(_0x4257e2){logger[_0x31b7('0x11')](_0x31b7('0x1c'),_0x4257e2[_0x31b7('0x13')],_0x3b0eff);_0x35a51f(_0x499c39[_0x31b7('0x11')](0x1f4,_0x4257e2['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x292f61){var _0x470ada=this;return new Promise(function(_0x361f24,_0x33a050){return db[_0x31b7('0x18')][_0x31b7('0x1d')]({'raw':_0x292f61[_0x31b7('0x1a')]?_0x292f61[_0x31b7('0x1a')][_0x31b7('0x1b')]===undefined?!![]:![]:!![],'where':_0x292f61[_0x31b7('0x1a')]?_0x292f61['options'][_0x31b7('0x1e')]||null:null,'attributes':[[_0x31b7('0x2b'),_0x31b7('0x2c')],[db[_0x31b7('0x1f')]['fn']('COUNT',db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')]['literal'](_0x31b7('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x31b7('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x24')))),_0x31b7('0x2f')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db['sequelize']['fn']('IF',db[_0x31b7('0x1f')]['literal'](_0x31b7('0x30')))),_0x31b7('0x31')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db['sequelize']['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x32')))),'outboundCongestionCallsDay'],[db[_0x31b7('0x1f')]['fn']('COUNT',db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')]['literal'](_0x31b7('0x33')))),_0x31b7('0x34')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db['sequelize']['fn']('IF',db[_0x31b7('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x31b7('0x35')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x36')))),'outboundUnknownCallsDay'],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x37')))),_0x31b7('0x38')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x31b7('0x39')],[db['sequelize']['fn']('COUNT',db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')](_0x31b7('0x3a')))),'outboundRejectCallsDay'],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x3b')))),_0x31b7('0x3c')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')][_0x31b7('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')]['fn']('IF',db[_0x31b7('0x1f')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x31b7('0x3d')]],'group':[_0x31b7('0x2b')]})[_0x31b7('0xb')](function(_0x5ea605){logger[_0x31b7('0x14')](_0x31b7('0x3e'),_0x292f61);logger[_0x31b7('0xe')](_0x31b7('0x3e'),_0x292f61,JSON['stringify'](_0x5ea605));_0x361f24(_0x5ea605);})['catch'](function(_0x43c1ee){logger[_0x31b7('0x11')](_0x31b7('0x3e'),_0x43c1ee[_0x31b7('0x13')],_0x292f61);_0x33a050(_0x470ada[_0x31b7('0x11')](0x1f4,_0x43c1ee[_0x31b7('0x13')]));});});};exports[_0x31b7('0x3f')]=function(_0x3ca23d){var _0x1ec95f=this;return new Promise(function(_0x3e1c4f,_0x4ddf5f){return db['CmHopperHistory'][_0x31b7('0x1d')]({'raw':_0x3ca23d[_0x31b7('0x1a')]?_0x3ca23d[_0x31b7('0x1a')][_0x31b7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ca23d['options']?_0x3ca23d[_0x31b7('0x1a')][_0x31b7('0x1e')]||null:null,'attributes':[[_0x31b7('0x2b'),_0x31b7('0x2c')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db[_0x31b7('0x1f')][_0x31b7('0x21')]('id')),_0x31b7('0x40')],[db[_0x31b7('0x1f')]['fn'](_0x31b7('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x31b7('0x23')](_0x31b7('0x24')))),_0x31b7('0x41')]],'group':[_0x31b7('0x2b')]})[_0x31b7('0xb')](function(_0x1041b4){logger['info'](_0x31b7('0x3f'),_0x3ca23d);logger['debug']('GetCampaignHopperHistory',_0x3ca23d,JSON['stringify'](_0x1041b4));_0x3e1c4f(_0x1041b4);})[_0x31b7('0x16')](function(_0x348d82){logger[_0x31b7('0x11')](_0x31b7('0x3f'),_0x348d82[_0x31b7('0x13')],_0x3ca23d);_0x4ddf5f(_0x1ec95f[_0x31b7('0x11')](0x1f4,_0x348d82[_0x31b7('0x13')]));});});}; \ No newline at end of file +var _0x8ce3=['catch','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperHistory','create','body','options','raw','then','info','CreateCmHopperHistory'];(function(_0x4a95a9,_0x1a6241){var _0xb6c65=function(_0x10fe90){while(--_0x10fe90){_0x4a95a9['push'](_0x4a95a9['shift']());}};_0xb6c65(++_0x1a6241);}(_0x8ce3,0xc3));var _0x38ce=function(_0x9f897b,_0x2bc0f7){_0x9f897b=_0x9f897b-0x0;var _0x595177=_0x8ce3[_0x9f897b];return _0x595177;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});}exports['CreateCmHopperHistory']=function(_0xe4099a){var _0x2efd6f=this;return new Promise(function(_0x3df527,_0x311734){return db[_0x38ce('0x16')][_0x38ce('0x17')](_0xe4099a[_0x38ce('0x18')],{'raw':_0xe4099a['options']?_0xe4099a[_0x38ce('0x19')][_0x38ce('0x1a')]===undefined?!![]:![]:!![]})[_0x38ce('0x1b')](function(_0x303391){logger[_0x38ce('0x1c')](_0x38ce('0x1d'),_0xe4099a);logger[_0x38ce('0xf')](_0x38ce('0x1d'),_0xe4099a,JSON[_0x38ce('0x11')](_0x303391));_0x3df527(_0x303391);})[_0x38ce('0x1e')](function(_0x1aace7){logger['error'](_0x38ce('0x1d'),_0x1aace7[_0x38ce('0x14')],_0xe4099a);_0x311734(_0x2efd6f[_0x38ce('0x12')](0x1f4,_0x1aace7[_0x38ce('0x14')]));});});};exports['AvgHandleTime']=function(_0x2c85e6){var _0x1d192d=this;return new Promise(function(_0x5ae8f8,_0xe0af00){return db[_0x38ce('0x16')][_0x38ce('0x1f')]({'raw':_0x2c85e6['options']?_0x2c85e6['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c85e6[_0x38ce('0x19')]?_0x2c85e6[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')][_0x38ce('0x23')]('id')),_0x38ce('0x24')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x26')))),'predictiveIntervalAnsweredCalls'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2010,\x201,\x20null'))),_0x38ce('0x27')],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x28')))),_0x38ce('0x29')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x2a'),db['sequelize']['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x2b')))),_0x38ce('0x2c')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x2a'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x2d')))),_0x38ce('0x2e')]]})[_0x38ce('0x1b')](function(_0x231268){logger[_0x38ce('0x1c')]('AvgHandleTime',_0x2c85e6);logger[_0x38ce('0xf')](_0x38ce('0x2f'),_0x2c85e6,JSON['stringify'](_0x231268));_0x5ae8f8(_0x231268);})[_0x38ce('0x1e')](function(_0x190000){logger[_0x38ce('0x12')](_0x38ce('0x2f'),_0x190000[_0x38ce('0x14')],_0x2c85e6);_0xe0af00(_0x1d192d[_0x38ce('0x12')](0x1f4,_0x190000[_0x38ce('0x14')]));});});};exports[_0x38ce('0x30')]=function(_0x4b779b){var _0x3d2c8c=this;return new Promise(function(_0x185e8f,_0x2314a2){return db[_0x38ce('0x16')]['findAll']({'raw':_0x4b779b[_0x38ce('0x19')]?_0x4b779b['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b779b[_0x38ce('0x19')]?_0x4b779b[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[[_0x38ce('0x31'),_0x38ce('0x32')],[db['sequelize']['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x33')))),_0x38ce('0x34')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x35')))),_0x38ce('0x36')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x26')))),_0x38ce('0x37')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x38')))),_0x38ce('0x39')],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3a')))),_0x38ce('0x3b')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3c')))),_0x38ce('0x3d')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3e')))),_0x38ce('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x38ce('0x21')]['fn']('COUNT',db[_0x38ce('0x21')]['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x40')))),'outboundBlacklistCallsDay'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x41')))),_0x38ce('0x42')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x38ce('0x43')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x44')))),'outboundAnswerAgiCallsDay'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x45')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x46')))),_0x38ce('0x47')]],'group':['campaign']})['then'](function(_0x199c5b){logger['info']('GetVoiceQueueHopperHistory',_0x4b779b);logger[_0x38ce('0xf')](_0x38ce('0x30'),_0x4b779b,JSON[_0x38ce('0x11')](_0x199c5b));_0x185e8f(_0x199c5b);})[_0x38ce('0x1e')](function(_0xd031c0){logger['error'](_0x38ce('0x30'),_0xd031c0[_0x38ce('0x14')],_0x4b779b);_0x2314a2(_0x3d2c8c[_0x38ce('0x12')](0x1f4,_0xd031c0[_0x38ce('0x14')]));});});};exports[_0x38ce('0x48')]=function(_0x2c353a){var _0x1d7a6b=this;return new Promise(function(_0x1c26b9,_0xdc8304){return db[_0x38ce('0x16')][_0x38ce('0x1f')]({'raw':_0x2c353a['options']?_0x2c353a['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c353a[_0x38ce('0x19')]?_0x2c353a[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[['campaign',_0x38ce('0x32')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')][_0x38ce('0x23')]('id')),_0x38ce('0x49')],[db[_0x38ce('0x21')]['fn']('COUNT',db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x38ce('0x4a')]],'group':[_0x38ce('0x31')]})[_0x38ce('0x1b')](function(_0x55e7ea){logger['info'](_0x38ce('0x48'),_0x2c353a);logger['debug'](_0x38ce('0x48'),_0x2c353a,JSON[_0x38ce('0x11')](_0x55e7ea));_0x1c26b9(_0x55e7ea);})[_0x38ce('0x1e')](function(_0x2b3982){logger['error'](_0x38ce('0x48'),_0x2b3982[_0x38ce('0x14')],_0x2c353a);_0xdc8304(_0x1d7a6b[_0x38ce('0x12')](0x1f4,_0x2b3982['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5bee848..56e5277 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 _0x1c17=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','exports','multer','util','connect-timeout'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x1c17,0x19f));var _0x71c1=function(_0x4c986c,_0x4546b5){_0x4c986c=_0x4c986c-0x0;var _0x2b7c2b=_0x1c17[_0x4c986c];return _0x2b7c2b;};'use strict';var multer=require(_0x71c1('0x0'));var util=require(_0x71c1('0x1'));var path=require('path');var timeout=require(_0x71c1('0x2'));var express=require(_0x71c1('0x3'));var router=express[_0x71c1('0x4')]();var fs_extra=require(_0x71c1('0x5'));var auth=require(_0x71c1('0x6'));var interaction=require(_0x71c1('0x7'));var config=require('../../config/environment');var controller=require(_0x71c1('0x8'));router[_0x71c1('0x9')]('/',auth[_0x71c1('0xa')](),controller[_0x71c1('0xb')]);router[_0x71c1('0x9')]('/describe',auth[_0x71c1('0xa')](),controller[_0x71c1('0xc')]);router[_0x71c1('0x9')](_0x71c1('0xd'),auth[_0x71c1('0xa')](),controller[_0x71c1('0xe')]);router[_0x71c1('0xf')]('/',auth['isAuthenticated'](),controller[_0x71c1('0x10')]);router[_0x71c1('0x11')]('/:id',auth[_0x71c1('0xa')](),controller['update']);module[_0x71c1('0x12')]=router; \ No newline at end of file +var _0xbf9d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','describe','get','/:id','post','put','exports'];(function(_0x171a8a,_0x2c6407){var _0x178cbc=function(_0x17cec0){while(--_0x17cec0){_0x171a8a['push'](_0x171a8a['shift']());}};_0x178cbc(++_0x2c6407);}(_0xbf9d,0x170));var _0xdbf9=function(_0x3a5d40,_0x592d19){_0x3a5d40=_0x3a5d40-0x0;var _0x2021cd=_0xbf9d[_0x3a5d40];return _0x2021cd;};'use strict';var multer=require('multer');var util=require(_0xdbf9('0x0'));var path=require(_0xdbf9('0x1'));var timeout=require(_0xdbf9('0x2'));var express=require(_0xdbf9('0x3'));var router=express[_0xdbf9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbf9('0x5'));var interaction=require(_0xdbf9('0x6'));var config=require('../../config/environment');var controller=require(_0xdbf9('0x7'));router['get']('/',auth[_0xdbf9('0x8')](),controller[_0xdbf9('0x9')]);router['get']('/describe',auth[_0xdbf9('0x8')](),controller[_0xdbf9('0xa')]);router[_0xdbf9('0xb')](_0xdbf9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdbf9('0xd')]('/',auth[_0xdbf9('0x8')](),controller['create']);router[_0xdbf9('0xe')](_0xdbf9('0xc'),auth[_0xdbf9('0x8')](),controller['update']);module[_0xdbf9('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 47142ae..6442e47 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 _0x39a9=['sequelize','exports','STRING','name'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x39a9,0x1d0));var _0x939a=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x39a9[_0x40aaa4];return _0x4e21e5;};'use strict';var Sequelize=require(_0x939a('0x0'));module[_0x939a('0x1')]={'name':{'type':Sequelize[_0x939a('0x2')],'unique':_0x939a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x939a('0x2')]},'dialPrefix':{'type':Sequelize[_0x939a('0x2')]}}; \ No newline at end of file +var _0x078c=['name','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078c,0x19f));var _0xc078=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0x078c[_0x434783];return _0x13efcf;};'use strict';var Sequelize=require(_0xc078('0x0'));module['exports']={'name':{'type':Sequelize[_0xc078('0x1')],'unique':_0xc078('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xc078('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e7bee94..ec5e407 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 _0x7b7e=['getCustomFields','findAndCountAll','addAgents','spread','removeAgents','emit','userCmList:remove','User','getAgents','info','message','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmList','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','order','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','select','item','ItemTypeId\x20=\x20?','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','transaction','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','sequelize','addColumn'];(function(_0x5a5a41,_0x227a41){var _0x2943c3=function(_0x175ebe){while(--_0x175ebe){_0x5a5a41['push'](_0x5a5a41['shift']());}};_0x2943c3(++_0x227a41);}(_0x7b7e,0xae));var _0xe7b7=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x7b7e[_0x1af0e5];return _0x3c444a;};'use strict';var emlformat=require(_0xe7b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7b7('0x1'));var jsonpatch=require(_0xe7b7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe7b7('0x3'));var util=require(_0xe7b7('0x4'));var path=require(_0xe7b7('0x5'));var sox=require(_0xe7b7('0x6'));var csv=require('to-csv');var ejs=require(_0xe7b7('0x7'));var fs=require('fs');var fs_extra=require(_0xe7b7('0x8'));var _=require('lodash');var squel=require(_0xe7b7('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe7b7('0xa'));var toCsv=require(_0xe7b7('0xb'));var querystring=require(_0xe7b7('0xc'));var Papa=require(_0xe7b7('0xd'));var Redis=require(_0xe7b7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7b7('0xf'));var hardwareService=require(_0xe7b7('0x10'));var logger=require('../../config/logger')(_0xe7b7('0x11'));var utils=require(_0xe7b7('0x12'));var config=require(_0xe7b7('0x13'));var licenseUtil=require(_0xe7b7('0x14'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xe7b7('0x15')]=_[_0xe7b7('0x16')](config[_0xe7b7('0x15')],{'host':_0xe7b7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe7b7('0x18'))[_0xe7b7('0x19')](socket);function respondWithStatusCode(_0x5d15fe,_0x17425e){_0x17425e=_0x17425e||0xcc;return function(_0x4aed7f){if(_0x4aed7f){return _0x5d15fe[_0xe7b7('0x1a')](_0x17425e);}return _0x5d15fe[_0xe7b7('0x1b')](_0x17425e)[_0xe7b7('0x1c')]();};}function respondWithResult(_0x9d3ed6,_0x101ae1){_0x101ae1=_0x101ae1||0xc8;return function(_0x122002){if(_0x122002){return _0x9d3ed6['status'](_0x101ae1)[_0xe7b7('0x1d')](_0x122002);}};}function respondWithFilteredResult(_0xa64630,_0x424b0b){return function(_0x252772){if(_0x252772){var _0x2207b2=typeof _0x424b0b[_0xe7b7('0x1e')]==='undefined'&&typeof _0x424b0b[_0xe7b7('0x1f')]===_0xe7b7('0x20');var _0x1dedc0=_0x252772[_0xe7b7('0x21')];var _0x16045a=_0x2207b2?0x0:_0x424b0b['offset'];var _0x377c12=_0x2207b2?_0x252772[_0xe7b7('0x21')]:_0x424b0b[_0xe7b7('0x1e')]+_0x424b0b['limit'];var _0x540571;if(_0x377c12>=_0x1dedc0){_0x377c12=_0x1dedc0;_0x540571=0xc8;}else{_0x540571=0xce;}_0xa64630[_0xe7b7('0x1b')](_0x540571);return _0xa64630[_0xe7b7('0x22')](_0xe7b7('0x23'),_0x16045a+'-'+_0x377c12+'/'+_0x1dedc0)[_0xe7b7('0x1d')](_0x252772);}return null;};}function patchUpdates(_0x4d962b){return function(_0x45e3b7){try{jsonpatch[_0xe7b7('0x24')](_0x45e3b7,_0x4d962b,!![]);}catch(_0x3320c3){return BPromise[_0xe7b7('0x25')](_0x3320c3);}return _0x45e3b7[_0xe7b7('0x26')]();};}function saveUpdates(_0x3d8947,_0x3d37f9){return function(_0x57288f){if(_0x57288f){return _0x57288f[_0xe7b7('0x27')](_0x3d8947)[_0xe7b7('0x28')](function(_0x35c441){return _0x35c441;});}return null;};}function removeEntity(_0x1c9211,_0x5b21d2){return function(_0x150745){if(_0x150745){return _0x150745[_0xe7b7('0x29')]()[_0xe7b7('0x28')](function(){var _0x833652=_0x150745[_0xe7b7('0x2a')]({'plain':!![]});var _0x341417=_0xe7b7('0x2b');return db[_0xe7b7('0x2c')]['destroy']({'where':{'type':_0x341417,'resourceId':_0x833652['id']}})['then'](function(){return _0x150745;});})['then'](function(){_0x1c9211[_0xe7b7('0x1b')](0xcc)[_0xe7b7('0x1c')]();});}};}function handleEntityNotFound(_0x131e6c,_0x54039b){return function(_0x547445){if(!_0x547445){_0x131e6c['sendStatus'](0x194);}return _0x547445;};}function handleError(_0x2aa3fd,_0x1f81cb){_0x1f81cb=_0x1f81cb||0x1f4;return function(_0xa63c4c){logger[_0xe7b7('0x2d')](_0xa63c4c[_0xe7b7('0x2e')]);if(_0xa63c4c[_0xe7b7('0x2f')]){delete _0xa63c4c[_0xe7b7('0x2f')];}_0x2aa3fd[_0xe7b7('0x1b')](_0x1f81cb)[_0xe7b7('0x30')](_0xa63c4c);};}exports[_0xe7b7('0x31')]=function(_0x379b4d,_0x1d84b1){var _0xceb70a={},_0x13c2cd={},_0x3527fa={'count':0x0,'rows':[]};var _0x833e80=_[_0xe7b7('0x32')](db['CmList'][_0xe7b7('0x33')],function(_0x527b48){return{'name':_0x527b48[_0xe7b7('0x34')],'type':_0x527b48[_0xe7b7('0x35')][_0xe7b7('0x36')]};});_0x13c2cd[_0xe7b7('0x37')]=_['map'](_0x833e80,_0xe7b7('0x2f'));_0x13c2cd[_0xe7b7('0x38')]=_['keys'](_0x379b4d[_0xe7b7('0x38')]);_0x13c2cd[_0xe7b7('0x39')]=_[_0xe7b7('0x3a')](_0x13c2cd['model'],_0x13c2cd['query']);_0xceb70a['attributes']=_[_0xe7b7('0x3a')](_0x13c2cd['model'],qs[_0xe7b7('0x3b')](_0x379b4d[_0xe7b7('0x38')][_0xe7b7('0x3b')]));_0xceb70a['attributes']=_0xceb70a[_0xe7b7('0x3c')][_0xe7b7('0x3d')]?_0xceb70a[_0xe7b7('0x3c')]:_0x13c2cd[_0xe7b7('0x37')];if(!_0x379b4d[_0xe7b7('0x38')][_0xe7b7('0x3e')](_0xe7b7('0x3f'))){_0xceb70a[_0xe7b7('0x1f')]=qs[_0xe7b7('0x1f')](_0x379b4d['query'][_0xe7b7('0x1f')]);_0xceb70a[_0xe7b7('0x1e')]=qs[_0xe7b7('0x1e')](_0x379b4d[_0xe7b7('0x38')][_0xe7b7('0x1e')]);}_0xceb70a['order']=qs[_0xe7b7('0x40')](_0x379b4d[_0xe7b7('0x38')][_0xe7b7('0x40')]);_0xceb70a[_0xe7b7('0x41')]=qs[_0xe7b7('0x39')](_[_0xe7b7('0x42')](_0x379b4d[_0xe7b7('0x38')],_0x13c2cd[_0xe7b7('0x39')]),_0x833e80);if(_0x379b4d[_0xe7b7('0x38')]['filter']){_0xceb70a[_0xe7b7('0x41')]=_['merge'](_0xceb70a[_0xe7b7('0x41')],{'$or':_[_0xe7b7('0x32')](_0x833e80,function(_0xfcd498){if(_0xfcd498[_0xe7b7('0x35')]!=='VIRTUAL'){var _0x4d7147={};_0x4d7147[_0xfcd498[_0xe7b7('0x2f')]]={'$like':'%'+_0x379b4d[_0xe7b7('0x38')][_0xe7b7('0x43')]+'%'};return _0x4d7147;}})});}_0xceb70a=_[_0xe7b7('0x44')]({},_0xceb70a,_0x379b4d[_0xe7b7('0x45')]);var _0x2aa78b={'where':_0xceb70a['where']};return db[_0xe7b7('0x46')][_0xe7b7('0x21')](_0x2aa78b)[_0xe7b7('0x28')](function(_0x295d47){_0x3527fa[_0xe7b7('0x21')]=_0x295d47;if(_0x379b4d[_0xe7b7('0x38')]['includeAll']){_0xceb70a[_0xe7b7('0x47')]=[{'all':!![]}];}return db[_0xe7b7('0x46')][_0xe7b7('0x48')](_0xceb70a);})[_0xe7b7('0x28')](function(_0x2eb4c6){_0x3527fa[_0xe7b7('0x49')]=_0x2eb4c6;return _0x3527fa;})['then'](respondWithFilteredResult(_0x1d84b1,_0xceb70a))[_0xe7b7('0x4a')](handleError(_0x1d84b1,null));};exports[_0xe7b7('0x4b')]=function(_0x160625,_0x32207a){var _0x236a4b={'raw':![],'where':{'id':_0x160625[_0xe7b7('0x4c')]['id']}},_0x383125={};_0x383125[_0xe7b7('0x37')]=_[_0xe7b7('0x4d')](db['CmList'][_0xe7b7('0x33')]);_0x383125[_0xe7b7('0x38')]=_[_0xe7b7('0x4d')](_0x160625[_0xe7b7('0x38')]);_0x383125['filters']=_[_0xe7b7('0x3a')](_0x383125[_0xe7b7('0x37')],_0x383125[_0xe7b7('0x38')]);_0x236a4b[_0xe7b7('0x3c')]=_[_0xe7b7('0x3a')](_0x383125[_0xe7b7('0x37')],qs[_0xe7b7('0x3b')](_0x160625[_0xe7b7('0x38')][_0xe7b7('0x3b')]));_0x236a4b[_0xe7b7('0x3c')]=_0x236a4b['attributes'][_0xe7b7('0x3d')]?_0x236a4b[_0xe7b7('0x3c')]:_0x383125[_0xe7b7('0x37')];if(_0x160625[_0xe7b7('0x38')][_0xe7b7('0x4e')]){_0x236a4b[_0xe7b7('0x47')]=[{'all':!![]}];}_0x236a4b=_[_0xe7b7('0x44')]({},_0x236a4b,_0x160625['options']);return db['CmList'][_0xe7b7('0x4f')](_0x236a4b)[_0xe7b7('0x28')](handleEntityNotFound(_0x32207a,null))[_0xe7b7('0x28')](respondWithResult(_0x32207a,null))[_0xe7b7('0x4a')](handleError(_0x32207a,null));};exports[_0xe7b7('0x50')]=function(_0x3e817a,_0x46e706){return db[_0xe7b7('0x46')]['create'](_0x3e817a[_0xe7b7('0x51')],{})['then'](function(_0x58b999){var _0x5a237f=_0x3e817a['user'][_0xe7b7('0x2a')]({'plain':!![]});if(!_0x5a237f)throw new Error(_0xe7b7('0x52'));if(_0x5a237f['role']===_0xe7b7('0x53')){var _0x923b89=_0x58b999[_0xe7b7('0x2a')]({'plain':!![]});var _0x7b692f=_0xe7b7('0x2b');return db['UserProfileSection'][_0xe7b7('0x4f')]({'where':{'name':_0x7b692f,'userProfileId':_0x5a237f[_0xe7b7('0x54')]},'raw':!![]})['then'](function(_0x4765bc){if(_0x4765bc&&_0x4765bc[_0xe7b7('0x55')]===0x0){return db['UserProfileResource'][_0xe7b7('0x50')]({'name':_0x923b89[_0xe7b7('0x2f')],'resourceId':_0x923b89['id'],'type':_0x4765bc[_0xe7b7('0x2f')],'sectionId':_0x4765bc['id']},{})[_0xe7b7('0x28')](function(){return _0x58b999;});}else{return _0x58b999;}})[_0xe7b7('0x4a')](function(_0x4d6da5){logger[_0xe7b7('0x2d')](_0xe7b7('0x56'),_0x4d6da5);throw _0x4d6da5;});}return _0x58b999;})[_0xe7b7('0x28')](respondWithResult(_0x46e706,0xc9))[_0xe7b7('0x4a')](handleError(_0x46e706,null));};exports['update']=function(_0x110fb2,_0x615e58){if(_0x110fb2['body']['id']){delete _0x110fb2[_0xe7b7('0x51')]['id'];}return db[_0xe7b7('0x46')]['find']({'where':{'id':_0x110fb2[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x615e58,null))[_0xe7b7('0x28')](saveUpdates(_0x110fb2[_0xe7b7('0x51')],null))[_0xe7b7('0x28')](respondWithResult(_0x615e58,null))[_0xe7b7('0x4a')](handleError(_0x615e58,null));};exports[_0xe7b7('0x29')]=function(_0x361421,_0x219d36){return db['CmList'][_0xe7b7('0x4f')]({'where':{'id':_0x361421[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x219d36,null))[_0xe7b7('0x28')](removeEntity(_0x219d36,null))[_0xe7b7('0x4a')](handleError(_0x219d36,null));};exports['describe']=function(_0x4f2e60,_0x4d444c){return db[_0xe7b7('0x46')][_0xe7b7('0x57')]()[_0xe7b7('0x28')](respondWithResult(_0x4d444c,null))[_0xe7b7('0x4a')](handleError(_0x4d444c,null));};exports[_0xe7b7('0x58')]=function(_0x1b8648,_0x3fb115,_0x292535){if(_0x1b8648['body']['id']){delete _0x1b8648[_0xe7b7('0x51')]['id'];}return db[_0xe7b7('0x46')][_0xe7b7('0x4f')]({'where':{'id':_0x1b8648[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x3fb115,null))[_0xe7b7('0x28')](function(_0x14867f){if(_0x14867f){_0x1b8648[_0xe7b7('0x51')][_0xe7b7('0x59')]=_0x14867f['id'];return db['Disposition'][_0xe7b7('0x50')](_0x1b8648['body']);}})['then'](respondWithResult(_0x3fb115,null))['catch'](handleError(_0x3fb115,null));};exports[_0xe7b7('0x5a')]=function(_0x286e50,_0x16352f,_0xaea145){var _0x1b0f8e={'raw':![],'where':{}};var _0x3ba40d={};var _0x306939={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x286e50[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x16352f,null))[_0xe7b7('0x28')](function(_0x2ced69){if(_0x2ced69){_0x3ba40d['model']=_['keys'](db[_0xe7b7('0x5b')][_0xe7b7('0x33')]);_0x3ba40d[_0xe7b7('0x38')]=_[_0xe7b7('0x4d')](_0x286e50['query']);_0x3ba40d[_0xe7b7('0x39')]=_['intersection'](_0x3ba40d['model'],_0x3ba40d[_0xe7b7('0x38')]);_0x1b0f8e['attributes']=_[_0xe7b7('0x3a')](_0x3ba40d['model'],qs[_0xe7b7('0x3b')](_0x286e50['query']['fields']));_0x1b0f8e[_0xe7b7('0x3c')]=_0x1b0f8e['attributes']['length']?_0x1b0f8e[_0xe7b7('0x3c')]:_0x3ba40d[_0xe7b7('0x37')];if(!_0x286e50[_0xe7b7('0x38')]['hasOwnProperty'](_0xe7b7('0x3f'))){_0x1b0f8e[_0xe7b7('0x1f')]=qs[_0xe7b7('0x1f')](_0x286e50['query'][_0xe7b7('0x1f')]);_0x1b0f8e[_0xe7b7('0x1e')]=qs[_0xe7b7('0x1e')](_0x286e50[_0xe7b7('0x38')][_0xe7b7('0x1e')]);}_0x1b0f8e[_0xe7b7('0x5c')]=qs[_0xe7b7('0x40')](_0x286e50[_0xe7b7('0x38')]['sort']);_0x1b0f8e['where']=qs['filters'](_[_0xe7b7('0x42')](_0x286e50[_0xe7b7('0x38')],_0x3ba40d['filters']));_0x1b0f8e['where']['ListId']=_0x2ced69['id'];if(_0x286e50['query'][_0xe7b7('0x43')]){_0x1b0f8e[_0xe7b7('0x41')]=_[_0xe7b7('0x44')](_0x1b0f8e['where'],{'$or':_['map'](_0x1b0f8e[_0xe7b7('0x3c')],function(_0x361e7f){var _0x3d38f8={};_0x3d38f8[_0x361e7f]={'$like':'%'+_0x286e50[_0xe7b7('0x38')][_0xe7b7('0x43')]+'%'};return _0x3d38f8;})});}_0x1b0f8e=_[_0xe7b7('0x44')]({},_0x1b0f8e,_0x286e50[_0xe7b7('0x45')]);return db[_0xe7b7('0x5b')][_0xe7b7('0x21')]({'where':_0x1b0f8e['where']})[_0xe7b7('0x28')](function(_0x2d5bd7){_0x306939[_0xe7b7('0x21')]=_0x2d5bd7;if(_0x286e50['query'][_0xe7b7('0x4e')]){_0x1b0f8e[_0xe7b7('0x47')]=[{'all':!![]}];}return db[_0xe7b7('0x5b')][_0xe7b7('0x48')](_0x1b0f8e);})[_0xe7b7('0x28')](function(_0x355a06){_0x306939[_0xe7b7('0x49')]=_0x355a06;return _0x306939;});}})[_0xe7b7('0x28')](respondWithFilteredResult(_0x16352f,_0x1b0f8e))[_0xe7b7('0x4a')](handleError(_0x16352f,null));};exports[_0xe7b7('0x5d')]=function(_0x4ea483,_0x2cefb4,_0x1f12d7){return db['CmList'][_0xe7b7('0x4f')]({'where':{'id':_0x4ea483['params']['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x2cefb4,null))[_0xe7b7('0x28')](function(_0x260feb){if(_0x260feb){return _0x260feb[_0xe7b7('0x5d')](_0x4ea483[_0xe7b7('0x38')]['ids']);}})[_0xe7b7('0x28')](respondWithStatusCode(_0x2cefb4,null))[_0xe7b7('0x4a')](handleError(_0x2cefb4,null));};exports[_0xe7b7('0x5e')]=function(_0x272f5d,_0x1fee1d,_0x411b01){return db[_0xe7b7('0x46')][_0xe7b7('0x4f')]({'where':{'id':_0x272f5d[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x1fee1d,null))['then'](function(_0x30e56f){if(_0x30e56f){var _0x20c1fc=[];var _0x52d29b={'success':[],'errors':[]};return db[_0xe7b7('0x5f')]['describe']()['then'](function(_0x31f992){if(_0x272f5d[_0xe7b7('0x51')][_0xe7b7('0x60')]&&_[_0xe7b7('0x61')](_0x272f5d[_0xe7b7('0x51')]['tags'])){if(_0x272f5d[_0xe7b7('0x51')][_0xe7b7('0x60')][_0xe7b7('0x3d')]){_0x272f5d[_0xe7b7('0x51')][_0xe7b7('0x60')]=_0x272f5d[_0xe7b7('0x51')][_0xe7b7('0x60')][_0xe7b7('0x62')](';')+';';}else{_0x272f5d[_0xe7b7('0x51')]['tags']=null;}}else{_0x272f5d[_0xe7b7('0x51')][_0xe7b7('0x60')]=null;}if(_0x272f5d[_0xe7b7('0x51')]&&_[_0xe7b7('0x61')](_0x272f5d[_0xe7b7('0x51')])){for(var _0x54fda9=0x0;_0x54fda9<_0x272f5d[_0xe7b7('0x51')]['length'];_0x54fda9+=0x1){_0x272f5d[_0xe7b7('0x51')][_0x54fda9][_0xe7b7('0x59')]=_0x272f5d['params']['id'];_0x20c1fc[_0xe7b7('0x63')](_0x272f5d[_0xe7b7('0x51')][_0x54fda9]);}return BPromise[_0xe7b7('0x64')](_0x20c1fc,function(_0x32726b){return db[_0xe7b7('0x5f')]['create'](_[_0xe7b7('0x65')](_0x32726b,[_0xe7b7('0x66'),'id'])||{},{'fields':_[_0xe7b7('0x4d')](_0x31f992),'raw':!![]})[_0xe7b7('0x28')](function(_0x371423){_0x52d29b[_0xe7b7('0x67')][_0xe7b7('0x63')](_0x371423[_0xe7b7('0x68')]);})[_0xe7b7('0x4a')](function(_0x398c81){_0x52d29b[_0xe7b7('0x69')][_0xe7b7('0x63')]({'data':_0x32726b,'error':_0x398c81['message']});});})[_0xe7b7('0x28')](function(_0x276d35){return _0x52d29b;})['catch'](function(_0x4f6b73){return _0x4f6b73;});}else{_0x1fee1d[_0xe7b7('0x1b')](0x190)['json']({'message':_0xe7b7('0x6a')});}});}})['then'](respondWithResult(_0x1fee1d,null))['catch'](handleError(_0x1fee1d,null));};exports[_0xe7b7('0x6b')]=function(_0x31aa4b,_0x4a41da,_0x1b1ecb){var _0x1d75eb;return db[_0xe7b7('0x46')][_0xe7b7('0x4f')]({'where':{'id':_0x31aa4b['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xe7b7('0x6c')}]})[_0xe7b7('0x28')](handleEntityNotFound(_0x4a41da,null))[_0xe7b7('0x28')](function(_0x2cab2f){if(_0x2cab2f){_0x1d75eb=_0x2cab2f;return db[_0xe7b7('0x5f')][_0xe7b7('0x33')];}})[_0xe7b7('0x28')](function(_0x19c5fd){if(_0x19c5fd){var _0x2bfa9c={};var _0x13df18={};_0x13df18['model']=_['concat'](_['keys'](_0x19c5fd),_['map'](_0x1d75eb[_0xe7b7('0x6c')],function(_0x4425bc){return util[_0xe7b7('0x6d')](_0xe7b7('0x6e'),_0x4425bc['id']);}));_0x13df18[_0xe7b7('0x38')]=_[_0xe7b7('0x4d')](_0x31aa4b['query']);_0x13df18['filters']=_['intersection'](_0x13df18[_0xe7b7('0x37')],_0x13df18[_0xe7b7('0x38')]);_0x2bfa9c['attributes']=_[_0xe7b7('0x3a')](_0x13df18[_0xe7b7('0x37')],qs[_0xe7b7('0x3b')](_0x31aa4b['query'][_0xe7b7('0x3b')]));_0x2bfa9c[_0xe7b7('0x3c')]=_0x2bfa9c[_0xe7b7('0x3c')][_0xe7b7('0x3d')]?_0x2bfa9c[_0xe7b7('0x3c')]:_0x13df18[_0xe7b7('0x37')];if(!_0x31aa4b[_0xe7b7('0x38')][_0xe7b7('0x3e')](_0xe7b7('0x3f'))){_0x2bfa9c[_0xe7b7('0x1f')]=qs[_0xe7b7('0x1f')](_0x31aa4b[_0xe7b7('0x38')]['limit']);_0x2bfa9c[_0xe7b7('0x1e')]=qs[_0xe7b7('0x1e')](_0x31aa4b[_0xe7b7('0x38')][_0xe7b7('0x1e')]);}_0x2bfa9c['order']=qs[_0xe7b7('0x40')](_0x31aa4b[_0xe7b7('0x38')][_0xe7b7('0x40')]);_0x2bfa9c['where']=qs['filters'](_['pick'](_0x31aa4b[_0xe7b7('0x38')],_0x13df18[_0xe7b7('0x39')]));_0x2bfa9c[_0xe7b7('0x6f')]=!![];if(_0x31aa4b[_0xe7b7('0x38')]['filter']){_0x2bfa9c[_0xe7b7('0x41')]=_[_0xe7b7('0x44')](_0x2bfa9c['where'],{'$or':_[_0xe7b7('0x32')](_0x2bfa9c[_0xe7b7('0x3c')],function(_0x255213){var _0x198afe={};_0x198afe[_0x255213]={'$like':'%'+_0x31aa4b[_0xe7b7('0x38')][_0xe7b7('0x43')]+'%'};return _0x198afe;})});}_0x2bfa9c=_[_0xe7b7('0x44')]({},_0x2bfa9c,_0x31aa4b[_0xe7b7('0x45')]);return _0x1d75eb[_0xe7b7('0x6b')](_0x2bfa9c);}})[_0xe7b7('0x28')](respondWithResult(_0x4a41da,null))['catch'](handleError(_0x4a41da,null));};exports[_0xe7b7('0x70')]=function(_0x2d307,_0x4bd6b9,_0x4655af){var _0x51fef5;var _0x313fcf;var _0x1d3413;var _0x376805=_0x2d307[_0xe7b7('0x4c')]['id'];csv_results=[];return db[_0xe7b7('0x71')][_0xe7b7('0x48')]({'attributes':['id',_0xe7b7('0x2f')],'raw':!![],'order':[_0xe7b7('0x72')]})[_0xe7b7('0x28')](function(_0x2afd5e){_0x51fef5=_0x2afd5e;var _0x16c6b1=_[_0xe7b7('0x4d')](db[_0xe7b7('0x5f')][_0xe7b7('0x33')]);return db[_0xe7b7('0x73')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0xe7b7('0x28')](function(_0x596919){_0x313fcf=_0x596919;var _0x254c63=squel['select']()[_0xe7b7('0x3b')](_0x16c6b1)[_0xe7b7('0x74')](_0xe7b7('0x75'),'c')[_0xe7b7('0x41')](_0xe7b7('0x76'),_0x376805)['where'](_0xe7b7('0x77'))[_0xe7b7('0x78')]();for(var _0x3546aa=0x0;_0x3546aa<_0x313fcf[_0xe7b7('0x3d')];_0x3546aa++){_0x254c63[_0xe7b7('0x79')](_0xe7b7('0x7a')+_0x313fcf[_0x3546aa]['id'],_0xe7b7('0x7b')+_0x313fcf[_0x3546aa][_0xe7b7('0x7c')]);}for(var _0x3546aa=0x0;_0x3546aa<_0x51fef5['length'];_0x3546aa++){_0x254c63[_0xe7b7('0x79')](squel[_0xe7b7('0x7d')]()[_0xe7b7('0x79')](_0xe7b7('0x7e'))['from']('cm_contact_has_items')['where'](_0xe7b7('0x7f'),_0x51fef5[_0x3546aa]['id'])[_0xe7b7('0x41')]('CmContactId\x20=\x20c.id'),_0xe7b7('0x80')+_0x51fef5[_0x3546aa][_0xe7b7('0x2f')]);_0x254c63['field'](squel[_0xe7b7('0x7d')]()[_0xe7b7('0x79')](_0xe7b7('0x81'))[_0xe7b7('0x74')]('cm_contact_has_items')[_0xe7b7('0x41')](_0xe7b7('0x7f'),_0x51fef5[_0x3546aa]['id'])[_0xe7b7('0x41')]('CmContactId\x20=\x20c.id'),_0xe7b7('0x82')+_0x51fef5[_0x3546aa][_0xe7b7('0x2f')]);}var _0x3d2c05=[];_0x3d2c05[_0xe7b7('0x63')](_0x254c63[_0xe7b7('0x83')]());BPromise['each'](_0x3d2c05,handleQuery)[_0xe7b7('0x28')](function(_0x2e9328){handleQuery(_0x254c63[_0xe7b7('0x83')]());var _0x5cdb60=csv_results[0x0];if(!_[_0xe7b7('0x84')](_0x5cdb60)){var _0x5c9af0=toCsv(_0x5cdb60);var _0x407c84=Date[_0xe7b7('0x85')]();fs['writeFileSync'](util[_0xe7b7('0x6d')](_0xe7b7('0x86'),_0x376805,_0x407c84),_0x5c9af0);_0x4bd6b9[_0xe7b7('0x87')](_0xe7b7('0x88'),_0xe7b7('0x89')+util[_0xe7b7('0x6d')](_0xe7b7('0x8a'),_0x376805,_0x407c84));_0x4bd6b9['setHeader'](_0xe7b7('0x8b'),_0xe7b7('0x8c'));return _0x4bd6b9[_0xe7b7('0x8d')](util[_0xe7b7('0x6d')]('/tmp/list_%d_%s.csv',_0x376805,_0x407c84));}else{return _0x4bd6b9[_0xe7b7('0x1a')](0xcc);}});});});};exports['addCustomField']=function(_0x493133,_0x348a0c,_0x5c624a){var _0x1e916a;delete _0x493133[_0xe7b7('0x51')]['id'];return db[_0xe7b7('0x46')]['findOne']({'where':{'id':_0x493133['params']['id']}})['then'](handleEntityNotFound(_0x348a0c,null))[_0xe7b7('0x28')](function(_0x4b5c17){if(_0x4b5c17){return db['sequelize'][_0xe7b7('0x8e')](function(_0x25dc0f){return db[_0xe7b7('0x73')][_0xe7b7('0x50')](_0x493133[_0xe7b7('0x51')],{'transaction':_0x25dc0f})['then'](function(_0x260b03){_0x1e916a=_0x260b03;return _0x4b5c17['addCustomFields'](_0x260b03,{'transaction':_0x25dc0f});})[_0xe7b7('0x28')](function(){var _0x305cae={'type':db['Sequelize']['TEXT'],'transaction':_0x25dc0f};switch(_0x493133[_0xe7b7('0x51')][_0xe7b7('0x35')]){case _0xe7b7('0x8f'):_0x305cae[_0xe7b7('0x35')]=db[_0xe7b7('0x90')][_0xe7b7('0x91')];break;case _0xe7b7('0x92'):_0x305cae['type']=db['Sequelize'][_0xe7b7('0x93')];break;case _0xe7b7('0x94'):_0x305cae['type']=db['Sequelize'][_0xe7b7('0x95')];_0x305cae['defaultValue']=![];break;default:}return db[_0xe7b7('0x96')]['queryInterface'][_0xe7b7('0x97')](_0xe7b7('0x75'),util['format']('cf_%s',_0x1e916a['id']),_0x305cae);})[_0xe7b7('0x28')](function(){return _0x1e916a;});});}})[_0xe7b7('0x28')](respondWithResult(_0x348a0c,null))[_0xe7b7('0x4a')](handleError(_0x348a0c,null));};exports[_0xe7b7('0x98')]=function(_0x24df65,_0x2d1cb,_0x787c6b){var _0x8c01c0={};var _0x1536f0={};var _0x14c887;var _0x4db466;return db['CmList']['findOne']({'where':{'id':_0x24df65['params']['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x2d1cb,null))['then'](function(_0x4193da){if(_0x4193da){_0x14c887=_0x4193da;_0x1536f0[_0xe7b7('0x37')]=_['keys'](db[_0xe7b7('0x73')][_0xe7b7('0x33')]);_0x1536f0['query']=_[_0xe7b7('0x4d')](_0x24df65['query']);_0x1536f0[_0xe7b7('0x39')]=_['intersection'](_0x1536f0['model'],_0x1536f0[_0xe7b7('0x38')]);_0x8c01c0['attributes']=_[_0xe7b7('0x3a')](_0x1536f0[_0xe7b7('0x37')],qs[_0xe7b7('0x3b')](_0x24df65[_0xe7b7('0x38')]['fields']));_0x8c01c0['attributes']=_0x8c01c0[_0xe7b7('0x3c')][_0xe7b7('0x3d')]?_0x8c01c0[_0xe7b7('0x3c')]:_0x1536f0[_0xe7b7('0x37')];_0x8c01c0['order']=qs['sort'](_0x24df65['query'][_0xe7b7('0x40')]);_0x8c01c0[_0xe7b7('0x41')]=qs['filters'](_[_0xe7b7('0x42')](_0x24df65[_0xe7b7('0x38')],_0x1536f0[_0xe7b7('0x39')]));_0x8c01c0[_0xe7b7('0x41')]=_['merge'](_0x8c01c0[_0xe7b7('0x41')],{'$or':[{'ListId':_0x4193da['id']},{'ListId':null}]});if(_0x24df65[_0xe7b7('0x38')][_0xe7b7('0x43')]){_0x8c01c0[_0xe7b7('0x41')]=_[_0xe7b7('0x44')](_0x8c01c0['where'],{'$or':_[_0xe7b7('0x32')](_0x8c01c0['attributes'],function(_0x395001){var _0x24e6d5={};_0x24e6d5[_0x395001]={'$like':'%'+_0x24df65[_0xe7b7('0x38')][_0xe7b7('0x43')]+'%'};return _0x24e6d5;})});}_0x8c01c0=_['merge']({},_0x8c01c0,_0x24df65['options']);return db[_0xe7b7('0x73')][_0xe7b7('0x99')](_0x8c01c0);}})[_0xe7b7('0x28')](respondWithResult(_0x2d1cb,null))[_0xe7b7('0x4a')](handleError(_0x2d1cb,null));};exports['getGlobalCustomFields']=function(_0xa81281,_0x2620ef){return db[_0xe7b7('0x73')][_0xe7b7('0x99')]({'where':{'ListId':null}})[_0xe7b7('0x28')](handleEntityNotFound(_0x2620ef,null))['then'](function(_0x3e78ff){return _0x3e78ff;})['then'](respondWithResult(_0x2620ef,null))['catch'](handleError(_0x2620ef,null));};exports[_0xe7b7('0x9a')]=function(_0x2a6db9,_0x103087,_0x3bc050){return db[_0xe7b7('0x46')][_0xe7b7('0x4f')]({'where':{'id':_0x2a6db9['params']['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x103087,null))[_0xe7b7('0x28')](function(_0x50f7ca){if(_0x50f7ca){return _0x50f7ca[_0xe7b7('0x9a')](_0x2a6db9[_0xe7b7('0x51')][_0xe7b7('0x66')],_[_0xe7b7('0x65')](_0x2a6db9[_0xe7b7('0x51')],['ids','id'])||{})[_0xe7b7('0x9b')](function(_0x56ce27){for(var _0x265ace=0x0;_0x265ace<_0x2a6db9['body']['ids'][_0xe7b7('0x3d')];_0x265ace+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x2a6db9[_0xe7b7('0x51')][_0xe7b7('0x66')][_0x265ace]),'CmListId':Number(_0x2a6db9['params']['id'])});}return _0x56ce27;});}})[_0xe7b7('0x28')](respondWithResult(_0x103087,null))[_0xe7b7('0x4a')](handleError(_0x103087,null));};exports[_0xe7b7('0x9c')]=function(_0x10d43a,_0x45c20d,_0x5ab222){return db[_0xe7b7('0x46')][_0xe7b7('0x4f')]({'where':{'id':_0x10d43a[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x45c20d,null))[_0xe7b7('0x28')](function(_0x9a5cd0){if(_0x9a5cd0){return _0x9a5cd0['removeAgents'](_0x10d43a[_0xe7b7('0x38')][_0xe7b7('0x66')])[_0xe7b7('0x28')](function(){if(_['isArray'](_0x10d43a['query']['ids'])){for(var _0x2656a9=0x0;_0x2656a9<_0x10d43a[_0xe7b7('0x38')][_0xe7b7('0x66')][_0xe7b7('0x3d')];_0x2656a9+=0x1){socket[_0xe7b7('0x9d')](_0xe7b7('0x9e'),{'UserId':Number(_0x10d43a[_0xe7b7('0x38')][_0xe7b7('0x66')][_0x2656a9]),'CmListId':Number(_0x10d43a[_0xe7b7('0x4c')]['id'])});}}else{socket[_0xe7b7('0x9d')](_0xe7b7('0x9e'),{'UserId':Number(_0x10d43a['query'][_0xe7b7('0x66')]),'CmListId':Number(_0x10d43a[_0xe7b7('0x4c')]['id'])});}});}})[_0xe7b7('0x28')](respondWithStatusCode(_0x45c20d,null))[_0xe7b7('0x4a')](handleError(_0x45c20d,null));};exports['getAgents']=function(_0x4f259c,_0x3846c0,_0x1e1e29){var _0x1e0b54={};var _0x13e9dd={};var _0x5cd7ab;var _0x13c7ba;return db[_0xe7b7('0x46')]['findOne']({'where':{'id':_0x4f259c[_0xe7b7('0x4c')]['id']}})[_0xe7b7('0x28')](handleEntityNotFound(_0x3846c0,null))[_0xe7b7('0x28')](function(_0x3ca7cb){if(_0x3ca7cb){_0x5cd7ab=_0x3ca7cb;_0x13e9dd['model']=_['keys'](db[_0xe7b7('0x9f')][_0xe7b7('0x33')]);_0x13e9dd['query']=_['keys'](_0x4f259c[_0xe7b7('0x38')]);_0x13e9dd[_0xe7b7('0x39')]=_['intersection'](_0x13e9dd[_0xe7b7('0x37')],_0x13e9dd[_0xe7b7('0x38')]);_0x1e0b54[_0xe7b7('0x3c')]=_['intersection'](_0x13e9dd['model'],qs['fields'](_0x4f259c[_0xe7b7('0x38')][_0xe7b7('0x3b')]));_0x1e0b54[_0xe7b7('0x3c')]=_0x1e0b54[_0xe7b7('0x3c')][_0xe7b7('0x3d')]?_0x1e0b54['attributes']:_0x13e9dd['model'];_0x1e0b54[_0xe7b7('0x5c')]=qs[_0xe7b7('0x40')](_0x4f259c['query'][_0xe7b7('0x40')]);_0x1e0b54[_0xe7b7('0x41')]=qs[_0xe7b7('0x39')](_[_0xe7b7('0x42')](_0x4f259c[_0xe7b7('0x38')],_0x13e9dd[_0xe7b7('0x39')]));if(_0x4f259c[_0xe7b7('0x38')]['filter']){_0x1e0b54[_0xe7b7('0x41')]=_[_0xe7b7('0x44')](_0x1e0b54[_0xe7b7('0x41')],{'$or':_[_0xe7b7('0x32')](_0x1e0b54['attributes'],function(_0x5a098d){var _0x5d8f02={};_0x5d8f02[_0x5a098d]={'$like':'%'+_0x4f259c[_0xe7b7('0x38')][_0xe7b7('0x43')]+'%'};return _0x5d8f02;})});}_0x1e0b54=_[_0xe7b7('0x44')]({},_0x1e0b54,_0x4f259c['options']);return _0x5cd7ab[_0xe7b7('0xa0')](_0x1e0b54);}})['then'](function(_0x13868c){if(_0x13868c){_0x13c7ba=_0x13868c[_0xe7b7('0x3d')];if(!_0x4f259c[_0xe7b7('0x38')][_0xe7b7('0x3e')]('nolimit')){_0x1e0b54[_0xe7b7('0x1f')]=qs[_0xe7b7('0x1f')](_0x4f259c[_0xe7b7('0x38')][_0xe7b7('0x1f')]);_0x1e0b54[_0xe7b7('0x1e')]=qs[_0xe7b7('0x1e')](_0x4f259c[_0xe7b7('0x38')][_0xe7b7('0x1e')]);}return _0x5cd7ab[_0xe7b7('0xa0')](_0x1e0b54);}})[_0xe7b7('0x28')](function(_0xb38223){if(_0xb38223){return _0xb38223?{'count':_0x13c7ba,'rows':_0xb38223}:null;}})[_0xe7b7('0x28')](respondWithResult(_0x3846c0,null))[_0xe7b7('0x4a')](handleError(_0x3846c0,null));};function handleQuery(_0x197ff8){logger[_0xe7b7('0xa1')](_0x197ff8);return db[_0xe7b7('0x96')]['query'](_0x197ff8)['spread'](function(_0x5c0b95){csv_results['push'](_0x5c0b95);})[_0xe7b7('0x4a')](function(_0x3019fe){logger[_0xe7b7('0x2d')](_0x3019fe[_0xe7b7('0xa2')]);});} \ No newline at end of file +var _0x0aae=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','length','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','order','pick','findAll','rows','removeDispositions','ids','addContacts','isArray','tags','join','push','each','CmContact','omit','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','raw','getContacts','getContactsCsv','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','findOne','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0aae,0x139));var _0xe0aa=function(_0x20bfcf,_0x6c476d){_0x20bfcf=_0x20bfcf-0x0;var _0x27e303=_0x0aae[_0x20bfcf];return _0x27e303;};'use strict';var emlformat=require(_0xe0aa('0x0'));var rimraf=require(_0xe0aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0aa('0x2'));var rp=require(_0xe0aa('0x3'));var moment=require(_0xe0aa('0x4'));var BPromise=require(_0xe0aa('0x5'));var Mustache=require(_0xe0aa('0x6'));var util=require('util');var path=require(_0xe0aa('0x7'));var sox=require('sox');var csv=require(_0xe0aa('0x8'));var ejs=require(_0xe0aa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0aa('0xa'));var squel=require(_0xe0aa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe0aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0aa('0xd'));var Papa=require(_0xe0aa('0xe'));var Redis=require('ioredis');var authService=require(_0xe0aa('0xf'));var qs=require(_0xe0aa('0x10'));var as=require(_0xe0aa('0x11'));var hardwareService=require(_0xe0aa('0x12'));var logger=require('../../config/logger')(_0xe0aa('0x13'));var utils=require(_0xe0aa('0x14'));var config=require(_0xe0aa('0x15'));var licenseUtil=require(_0xe0aa('0x16'));var db=require(_0xe0aa('0x17'))['db'];var csv_results;config['redis']=_[_0xe0aa('0x18')](config[_0xe0aa('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0aa('0x1a'))(new Redis(config[_0xe0aa('0x19')]));require('./cmList.socket')[_0xe0aa('0x1b')](socket);function respondWithStatusCode(_0x39025b,_0x150284){_0x150284=_0x150284||0xcc;return function(_0x4086d9){if(_0x4086d9){return _0x39025b[_0xe0aa('0x1c')](_0x150284);}return _0x39025b[_0xe0aa('0x1d')](_0x150284)[_0xe0aa('0x1e')]();};}function respondWithResult(_0x576483,_0x20ecde){_0x20ecde=_0x20ecde||0xc8;return function(_0xace722){if(_0xace722){return _0x576483[_0xe0aa('0x1d')](_0x20ecde)[_0xe0aa('0x1f')](_0xace722);}};}function respondWithFilteredResult(_0x30b8a2,_0x46e1c5){return function(_0x539872){if(_0x539872){var _0x1a60de=typeof _0x46e1c5[_0xe0aa('0x20')]===_0xe0aa('0x21')&&typeof _0x46e1c5[_0xe0aa('0x22')]===_0xe0aa('0x21');var _0x2f43bb=_0x539872[_0xe0aa('0x23')];var _0xb5d5d9=_0x1a60de?0x0:_0x46e1c5[_0xe0aa('0x20')];var _0x27c124=_0x1a60de?_0x539872[_0xe0aa('0x23')]:_0x46e1c5[_0xe0aa('0x20')]+_0x46e1c5[_0xe0aa('0x22')];var _0x446f32;if(_0x27c124>=_0x2f43bb){_0x27c124=_0x2f43bb;_0x446f32=0xc8;}else{_0x446f32=0xce;}_0x30b8a2[_0xe0aa('0x1d')](_0x446f32);return _0x30b8a2[_0xe0aa('0x24')]('Content-Range',_0xb5d5d9+'-'+_0x27c124+'/'+_0x2f43bb)['json'](_0x539872);}return null;};}function patchUpdates(_0x7786a){return function(_0x3416bb){try{jsonpatch[_0xe0aa('0x25')](_0x3416bb,_0x7786a,!![]);}catch(_0x4ea23a){return BPromise[_0xe0aa('0x26')](_0x4ea23a);}return _0x3416bb[_0xe0aa('0x27')]();};}function saveUpdates(_0x46afbb,_0xcde337){return function(_0x25c83e){if(_0x25c83e){return _0x25c83e['update'](_0x46afbb)[_0xe0aa('0x28')](function(_0x479de2){return _0x479de2;});}return null;};}function removeEntity(_0x35c0b3,_0x159d7e){return function(_0x4a46db){if(_0x4a46db){return _0x4a46db[_0xe0aa('0x29')]()[_0xe0aa('0x28')](function(){var _0xe498e6=_0x4a46db['get']({'plain':!![]});var _0x5094be=_0xe0aa('0x2a');return db[_0xe0aa('0x2b')][_0xe0aa('0x29')]({'where':{'type':_0x5094be,'resourceId':_0xe498e6['id']}})[_0xe0aa('0x28')](function(){return _0x4a46db;});})['then'](function(){_0x35c0b3[_0xe0aa('0x1d')](0xcc)[_0xe0aa('0x1e')]();});}};}function handleEntityNotFound(_0x3d1bba,_0x20d847){return function(_0x143cc5){if(!_0x143cc5){_0x3d1bba['sendStatus'](0x194);}return _0x143cc5;};}function handleError(_0x176557,_0x4a1f17){_0x4a1f17=_0x4a1f17||0x1f4;return function(_0x4a9dd1){logger[_0xe0aa('0x2c')](_0x4a9dd1[_0xe0aa('0x2d')]);if(_0x4a9dd1[_0xe0aa('0x2e')]){delete _0x4a9dd1['name'];}_0x176557[_0xe0aa('0x1d')](_0x4a1f17)[_0xe0aa('0x2f')](_0x4a9dd1);};}exports[_0xe0aa('0x30')]=function(_0x5b86b2,_0x165e6b){var _0x3de205={},_0x1d6f90={},_0x2bb093={'count':0x0,'rows':[]};var _0x34048e=_[_0xe0aa('0x31')](db[_0xe0aa('0x32')][_0xe0aa('0x33')],function(_0x1974e5){return{'name':_0x1974e5[_0xe0aa('0x34')],'type':_0x1974e5['type'][_0xe0aa('0x35')]};});_0x1d6f90[_0xe0aa('0x36')]=_[_0xe0aa('0x31')](_0x34048e,_0xe0aa('0x2e'));_0x1d6f90['query']=_['keys'](_0x5b86b2[_0xe0aa('0x37')]);_0x1d6f90[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x1d6f90['model'],_0x1d6f90[_0xe0aa('0x37')]);_0x3de205[_0xe0aa('0x3a')]=_['intersection'](_0x1d6f90[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x3de205[_0xe0aa('0x3a')]=_0x3de205['attributes']['length']?_0x3de205[_0xe0aa('0x3a')]:_0x1d6f90[_0xe0aa('0x36')];if(!_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x3de205['limit']=qs['limit'](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x3de205[_0xe0aa('0x20')]=qs[_0xe0aa('0x20')](_0x5b86b2[_0xe0aa('0x37')]['offset']);}_0x3de205['order']=qs['sort'](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3e')]);_0x3de205[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_['pick'](_0x5b86b2['query'],_0x1d6f90[_0xe0aa('0x38')]),_0x34048e);if(_0x5b86b2['query'][_0xe0aa('0x40')]){_0x3de205[_0xe0aa('0x3f')]=_['merge'](_0x3de205['where'],{'$or':_[_0xe0aa('0x31')](_0x34048e,function(_0x23241d){if(_0x23241d[_0xe0aa('0x41')]!==_0xe0aa('0x42')){var _0x6d8c1d={};_0x6d8c1d[_0x23241d['name']]={'$like':'%'+_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x6d8c1d;}})});}_0x3de205=_[_0xe0aa('0x43')]({},_0x3de205,_0x5b86b2[_0xe0aa('0x44')]);var _0xc9ed8c={'where':_0x3de205[_0xe0aa('0x3f')]};return db[_0xe0aa('0x32')][_0xe0aa('0x23')](_0xc9ed8c)[_0xe0aa('0x28')](function(_0x16d88e){_0x2bb093[_0xe0aa('0x23')]=_0x16d88e;if(_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x3de205[_0xe0aa('0x46')]=[{'all':!![]}];}return db[_0xe0aa('0x32')]['findAll'](_0x3de205);})[_0xe0aa('0x28')](function(_0x1561a0){_0x2bb093['rows']=_0x1561a0;return _0x2bb093;})[_0xe0aa('0x28')](respondWithFilteredResult(_0x165e6b,_0x3de205))[_0xe0aa('0x47')](handleError(_0x165e6b,null));};exports[_0xe0aa('0x48')]=function(_0x56cc40,_0x10f240){var _0x43ec73={'raw':![],'where':{'id':_0x56cc40[_0xe0aa('0x49')]['id']}},_0x26e0b5={};_0x26e0b5[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0x32')][_0xe0aa('0x33')]);_0x26e0b5[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x56cc40['query']);_0x26e0b5[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x26e0b5['model'],_0x26e0b5[_0xe0aa('0x37')]);_0x43ec73[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x26e0b5[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x56cc40['query'][_0xe0aa('0x3b')]));_0x43ec73[_0xe0aa('0x3a')]=_0x43ec73[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x43ec73['attributes']:_0x26e0b5['model'];if(_0x56cc40[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x43ec73[_0xe0aa('0x46')]=[{'all':!![]}];}_0x43ec73=_[_0xe0aa('0x43')]({},_0x43ec73,_0x56cc40[_0xe0aa('0x44')]);return db[_0xe0aa('0x32')][_0xe0aa('0x4c')](_0x43ec73)[_0xe0aa('0x28')](handleEntityNotFound(_0x10f240,null))[_0xe0aa('0x28')](respondWithResult(_0x10f240,null))[_0xe0aa('0x47')](handleError(_0x10f240,null));};exports[_0xe0aa('0x4d')]=function(_0x45bdbd,_0x290684){return db[_0xe0aa('0x32')]['create'](_0x45bdbd[_0xe0aa('0x4e')],{})[_0xe0aa('0x28')](function(_0x1e9a12){var _0x491e05=_0x45bdbd['user'][_0xe0aa('0x4f')]({'plain':!![]});if(!_0x491e05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x491e05['role']===_0xe0aa('0x50')){var _0xf5dab5=_0x1e9a12['get']({'plain':!![]});var _0x474a7b=_0xe0aa('0x2a');return db[_0xe0aa('0x51')]['find']({'where':{'name':_0x474a7b,'userProfileId':_0x491e05[_0xe0aa('0x52')]},'raw':!![]})[_0xe0aa('0x28')](function(_0x133e6e){if(_0x133e6e&&_0x133e6e[_0xe0aa('0x53')]===0x0){return db[_0xe0aa('0x2b')][_0xe0aa('0x4d')]({'name':_0xf5dab5[_0xe0aa('0x2e')],'resourceId':_0xf5dab5['id'],'type':_0x133e6e[_0xe0aa('0x2e')],'sectionId':_0x133e6e['id']},{})[_0xe0aa('0x28')](function(){return _0x1e9a12;});}else{return _0x1e9a12;}})[_0xe0aa('0x47')](function(_0x24629b){logger['error'](_0xe0aa('0x54'),_0x24629b);throw _0x24629b;});}return _0x1e9a12;})[_0xe0aa('0x28')](respondWithResult(_0x290684,0xc9))[_0xe0aa('0x47')](handleError(_0x290684,null));};exports[_0xe0aa('0x55')]=function(_0x246b1b,_0x5915a3){if(_0x246b1b['body']['id']){delete _0x246b1b[_0xe0aa('0x4e')]['id'];}return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x246b1b['params']['id']}})['then'](handleEntityNotFound(_0x5915a3,null))[_0xe0aa('0x28')](saveUpdates(_0x246b1b['body'],null))[_0xe0aa('0x28')](respondWithResult(_0x5915a3,null))[_0xe0aa('0x47')](handleError(_0x5915a3,null));};exports['destroy']=function(_0x504515,_0x3c436e){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x504515[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3c436e,null))['then'](removeEntity(_0x3c436e,null))[_0xe0aa('0x47')](handleError(_0x3c436e,null));};exports['describe']=function(_0x17c3b8,_0x1fe23f){return db['CmList'][_0xe0aa('0x56')]()[_0xe0aa('0x28')](respondWithResult(_0x1fe23f,null))[_0xe0aa('0x47')](handleError(_0x1fe23f,null));};exports[_0xe0aa('0x57')]=function(_0x3c23f2,_0x1720e7,_0x4b4c19){if(_0x3c23f2[_0xe0aa('0x4e')]['id']){delete _0x3c23f2[_0xe0aa('0x4e')]['id'];}return db[_0xe0aa('0x32')]['find']({'where':{'id':_0x3c23f2[_0xe0aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x1720e7,null))[_0xe0aa('0x28')](function(_0x3a8f6b){if(_0x3a8f6b){_0x3c23f2['body'][_0xe0aa('0x58')]=_0x3a8f6b['id'];return db[_0xe0aa('0x59')][_0xe0aa('0x4d')](_0x3c23f2[_0xe0aa('0x4e')]);}})[_0xe0aa('0x28')](respondWithResult(_0x1720e7,null))[_0xe0aa('0x47')](handleError(_0x1720e7,null));};exports[_0xe0aa('0x5a')]=function(_0x585103,_0x5ddeab,_0x4607da){var _0x38b08b={'raw':![],'where':{}};var _0x1c7ced={};var _0x500e30={'count':0x0,'rows':[]};return db[_0xe0aa('0x32')]['findOne']({'where':{'id':_0x585103[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x5ddeab,null))[_0xe0aa('0x28')](function(_0x23f5a7){if(_0x23f5a7){_0x1c7ced[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db['Disposition'][_0xe0aa('0x33')]);_0x1c7ced[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x585103[_0xe0aa('0x37')]);_0x1c7ced['filters']=_[_0xe0aa('0x39')](_0x1c7ced[_0xe0aa('0x36')],_0x1c7ced['query']);_0x38b08b[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x1c7ced['model'],qs['fields'](_0x585103[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x38b08b[_0xe0aa('0x3a')]=_0x38b08b['attributes'][_0xe0aa('0x4b')]?_0x38b08b[_0xe0aa('0x3a')]:_0x1c7ced['model'];if(!_0x585103[_0xe0aa('0x37')][_0xe0aa('0x3c')]('nolimit')){_0x38b08b[_0xe0aa('0x22')]=qs['limit'](_0x585103[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x38b08b[_0xe0aa('0x20')]=qs[_0xe0aa('0x20')](_0x585103['query'][_0xe0aa('0x20')]);}_0x38b08b[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x585103[_0xe0aa('0x37')]['sort']);_0x38b08b[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_[_0xe0aa('0x5c')](_0x585103[_0xe0aa('0x37')],_0x1c7ced[_0xe0aa('0x38')]));_0x38b08b[_0xe0aa('0x3f')][_0xe0aa('0x58')]=_0x23f5a7['id'];if(_0x585103[_0xe0aa('0x37')]['filter']){_0x38b08b[_0xe0aa('0x3f')]=_['merge'](_0x38b08b['where'],{'$or':_[_0xe0aa('0x31')](_0x38b08b[_0xe0aa('0x3a')],function(_0x189080){var _0x40f039={};_0x40f039[_0x189080]={'$like':'%'+_0x585103['query'][_0xe0aa('0x40')]+'%'};return _0x40f039;})});}_0x38b08b=_[_0xe0aa('0x43')]({},_0x38b08b,_0x585103[_0xe0aa('0x44')]);return db[_0xe0aa('0x59')]['count']({'where':_0x38b08b['where']})['then'](function(_0x129ec4){_0x500e30[_0xe0aa('0x23')]=_0x129ec4;if(_0x585103[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x38b08b[_0xe0aa('0x46')]=[{'all':!![]}];}return db[_0xe0aa('0x59')][_0xe0aa('0x5d')](_0x38b08b);})[_0xe0aa('0x28')](function(_0x2e4143){_0x500e30[_0xe0aa('0x5e')]=_0x2e4143;return _0x500e30;});}})[_0xe0aa('0x28')](respondWithFilteredResult(_0x5ddeab,_0x38b08b))[_0xe0aa('0x47')](handleError(_0x5ddeab,null));};exports['removeDispositions']=function(_0xea3f45,_0x33727e,_0x1c3f59){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0xea3f45['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x33727e,null))['then'](function(_0x32a7e9){if(_0x32a7e9){return _0x32a7e9[_0xe0aa('0x5f')](_0xea3f45[_0xe0aa('0x37')][_0xe0aa('0x60')]);}})[_0xe0aa('0x28')](respondWithStatusCode(_0x33727e,null))['catch'](handleError(_0x33727e,null));};exports[_0xe0aa('0x61')]=function(_0x3cefb2,_0x35d9f7,_0x47d339){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x3cefb2[_0xe0aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x35d9f7,null))[_0xe0aa('0x28')](function(_0x36289e){if(_0x36289e){var _0x10a0b4=[];var _0x286d15={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xe0aa('0x28')](function(_0xc1131a){if(_0x3cefb2[_0xe0aa('0x4e')]['tags']&&_[_0xe0aa('0x62')](_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')])){if(_0x3cefb2[_0xe0aa('0x4e')]['tags'][_0xe0aa('0x4b')]){_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')]=_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')][_0xe0aa('0x64')](';')+';';}else{_0x3cefb2['body'][_0xe0aa('0x63')]=null;}}else{_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')]=null;}if(_0x3cefb2['body']&&_[_0xe0aa('0x62')](_0x3cefb2['body'])){for(var _0x4d307f=0x0;_0x4d307f<_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x4b')];_0x4d307f+=0x1){_0x3cefb2[_0xe0aa('0x4e')][_0x4d307f]['ListId']=_0x3cefb2[_0xe0aa('0x49')]['id'];_0x10a0b4[_0xe0aa('0x65')](_0x3cefb2[_0xe0aa('0x4e')][_0x4d307f]);}return BPromise[_0xe0aa('0x66')](_0x10a0b4,function(_0x2b2658){return db[_0xe0aa('0x67')][_0xe0aa('0x4d')](_[_0xe0aa('0x68')](_0x2b2658,[_0xe0aa('0x60'),'id'])||{},{'fields':_[_0xe0aa('0x4a')](_0xc1131a),'raw':!![]})[_0xe0aa('0x28')](function(_0x3a2d50){_0x286d15['success']['push'](_0x3a2d50[_0xe0aa('0x69')]);})['catch'](function(_0x562e53){_0x286d15[_0xe0aa('0x6a')]['push']({'data':_0x2b2658,'error':_0x562e53['message']});});})[_0xe0aa('0x28')](function(_0x946773){return _0x286d15;})['catch'](function(_0x4f9349){return _0x4f9349;});}else{_0x35d9f7[_0xe0aa('0x1d')](0x190)[_0xe0aa('0x1f')]({'message':_0xe0aa('0x6b')});}});}})[_0xe0aa('0x28')](respondWithResult(_0x35d9f7,null))[_0xe0aa('0x47')](handleError(_0x35d9f7,null));};exports['getContacts']=function(_0x34b8a1,_0x5d0f08,_0x2de68a){var _0x25c64c;return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x34b8a1['params']['id']},'include':[{'model':db[_0xe0aa('0x6c')],'as':_0xe0aa('0x6d')}]})[_0xe0aa('0x28')](handleEntityNotFound(_0x5d0f08,null))[_0xe0aa('0x28')](function(_0x4f5795){if(_0x4f5795){_0x25c64c=_0x4f5795;return db[_0xe0aa('0x67')]['rawAttributes'];}})[_0xe0aa('0x28')](function(_0x4546a2){if(_0x4546a2){var _0x1495ca={};var _0x23a234={};_0x23a234[_0xe0aa('0x36')]=_[_0xe0aa('0x6e')](_[_0xe0aa('0x4a')](_0x4546a2),_[_0xe0aa('0x31')](_0x25c64c[_0xe0aa('0x6d')],function(_0x56cbcf){return util[_0xe0aa('0x6f')]('cf_%d',_0x56cbcf['id']);}));_0x23a234[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x34b8a1[_0xe0aa('0x37')]);_0x23a234['filters']=_['intersection'](_0x23a234[_0xe0aa('0x36')],_0x23a234[_0xe0aa('0x37')]);_0x1495ca['attributes']=_[_0xe0aa('0x39')](_0x23a234['model'],qs[_0xe0aa('0x3b')](_0x34b8a1[_0xe0aa('0x37')]['fields']));_0x1495ca[_0xe0aa('0x3a')]=_0x1495ca[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x1495ca[_0xe0aa('0x3a')]:_0x23a234[_0xe0aa('0x36')];if(!_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x1495ca[_0xe0aa('0x22')]=qs[_0xe0aa('0x22')](_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x1495ca['offset']=qs[_0xe0aa('0x20')](_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x20')]);}_0x1495ca[_0xe0aa('0x5b')]=qs['sort'](_0x34b8a1[_0xe0aa('0x37')]['sort']);_0x1495ca[_0xe0aa('0x3f')]=qs['filters'](_['pick'](_0x34b8a1[_0xe0aa('0x37')],_0x23a234[_0xe0aa('0x38')]));_0x1495ca[_0xe0aa('0x70')]=!![];if(_0x34b8a1['query'][_0xe0aa('0x40')]){_0x1495ca['where']=_[_0xe0aa('0x43')](_0x1495ca[_0xe0aa('0x3f')],{'$or':_[_0xe0aa('0x31')](_0x1495ca[_0xe0aa('0x3a')],function(_0x52f76f){var _0x44c8a1={};_0x44c8a1[_0x52f76f]={'$like':'%'+_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x44c8a1;})});}_0x1495ca=_[_0xe0aa('0x43')]({},_0x1495ca,_0x34b8a1[_0xe0aa('0x44')]);return _0x25c64c[_0xe0aa('0x71')](_0x1495ca);}})[_0xe0aa('0x28')](respondWithResult(_0x5d0f08,null))[_0xe0aa('0x47')](handleError(_0x5d0f08,null));};exports[_0xe0aa('0x72')]=function(_0x2bbd77,_0x42361e,_0x273468){var _0xfaf17d;var _0x1d971c;var _0x225fff;var _0x23bf23=_0x2bbd77[_0xe0aa('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0xe0aa('0x5d')]({'attributes':['id',_0xe0aa('0x2e')],'raw':!![],'order':[_0xe0aa('0x73')]})['then'](function(_0x3ada06){_0xfaf17d=_0x3ada06;var _0x320eac=_['keys'](db[_0xe0aa('0x67')][_0xe0aa('0x33')]);return db['CmCustomField'][_0xe0aa('0x5d')]({'raw':!![],'attributes':['id','alias']})[_0xe0aa('0x28')](function(_0x39e773){_0x1d971c=_0x39e773;var _0x172e47=squel[_0xe0aa('0x74')]()['fields'](_0x320eac)[_0xe0aa('0x75')](_0xe0aa('0x76'),'c')['where']('c.ListId\x20=\x20?',_0x23bf23)[_0xe0aa('0x3f')](_0xe0aa('0x77'))[_0xe0aa('0x78')]();for(var _0x5262b8=0x0;_0x5262b8<_0x1d971c[_0xe0aa('0x4b')];_0x5262b8++){_0x172e47[_0xe0aa('0x79')](_0xe0aa('0x7a')+_0x1d971c[_0x5262b8]['id'],_0xe0aa('0x7b')+_0x1d971c[_0x5262b8]['alias']);}for(var _0x5262b8=0x0;_0x5262b8<_0xfaf17d[_0xe0aa('0x4b')];_0x5262b8++){_0x172e47[_0xe0aa('0x79')](squel['select']()[_0xe0aa('0x79')](_0xe0aa('0x7c'))[_0xe0aa('0x75')](_0xe0aa('0x7d'))[_0xe0aa('0x3f')](_0xe0aa('0x7e'),_0xfaf17d[_0x5262b8]['id'])[_0xe0aa('0x3f')](_0xe0aa('0x7f')),_0xe0aa('0x80')+_0xfaf17d[_0x5262b8][_0xe0aa('0x2e')]);_0x172e47['field'](squel['select']()[_0xe0aa('0x79')](_0xe0aa('0x81'))[_0xe0aa('0x75')]('cm_contact_has_items')['where'](_0xe0aa('0x7e'),_0xfaf17d[_0x5262b8]['id'])[_0xe0aa('0x3f')](_0xe0aa('0x7f')),_0xe0aa('0x82')+_0xfaf17d[_0x5262b8]['name']);}var _0x4d71c1=[];_0x4d71c1[_0xe0aa('0x65')](_0x172e47['toString']());BPromise[_0xe0aa('0x66')](_0x4d71c1,handleQuery)[_0xe0aa('0x28')](function(_0x17f4d9){handleQuery(_0x172e47[_0xe0aa('0x83')]());var _0x1d56cc=csv_results[0x0];if(!_[_0xe0aa('0x84')](_0x1d56cc)){var _0x2d3fce=toCsv(_0x1d56cc);var _0x45abce=Date['now']();fs[_0xe0aa('0x85')](util[_0xe0aa('0x6f')](_0xe0aa('0x86'),_0x23bf23,_0x45abce),_0x2d3fce);_0x42361e[_0xe0aa('0x87')](_0xe0aa('0x88'),'attachment;\x20filename='+util[_0xe0aa('0x6f')](_0xe0aa('0x89'),_0x23bf23,_0x45abce));_0x42361e[_0xe0aa('0x87')](_0xe0aa('0x8a'),_0xe0aa('0x8b'));return _0x42361e[_0xe0aa('0x8c')](util[_0xe0aa('0x6f')](_0xe0aa('0x86'),_0x23bf23,_0x45abce));}else{return _0x42361e[_0xe0aa('0x1c')](0xcc);}});});});};exports[_0xe0aa('0x8d')]=function(_0x306e4b,_0x4cd759,_0x2b984c){var _0xae5b10;delete _0x306e4b['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x306e4b[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x4cd759,null))[_0xe0aa('0x28')](function(_0x15268a){if(_0x15268a){return db['sequelize'][_0xe0aa('0x8e')](function(_0x38c8ab){return db[_0xe0aa('0x6c')]['create'](_0x306e4b[_0xe0aa('0x4e')],{'transaction':_0x38c8ab})['then'](function(_0x46c0d1){_0xae5b10=_0x46c0d1;return _0x15268a[_0xe0aa('0x8f')](_0x46c0d1,{'transaction':_0x38c8ab});})[_0xe0aa('0x28')](function(){var _0x2c26fc={'type':db[_0xe0aa('0x90')][_0xe0aa('0x91')],'transaction':_0x38c8ab};switch(_0x306e4b[_0xe0aa('0x4e')][_0xe0aa('0x41')]){case _0xe0aa('0x92'):_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x91')];break;case _0xe0aa('0x93'):_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x94')];break;case'switch':_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x95')];_0x2c26fc[_0xe0aa('0x96')]=![];break;default:}return db[_0xe0aa('0x97')][_0xe0aa('0x98')][_0xe0aa('0x99')](_0xe0aa('0x76'),util[_0xe0aa('0x6f')](_0xe0aa('0x9a'),_0xae5b10['id']),_0x2c26fc);})['then'](function(){return _0xae5b10;});});}})[_0xe0aa('0x28')](respondWithResult(_0x4cd759,null))[_0xe0aa('0x47')](handleError(_0x4cd759,null));};exports['getCustomFields']=function(_0x2ebcae,_0x3dd12f,_0x2d6b58){var _0x543a39={};var _0x4e0468={};var _0x2527f3;var _0x4490df;return db['CmList'][_0xe0aa('0x9b')]({'where':{'id':_0x2ebcae['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3dd12f,null))[_0xe0aa('0x28')](function(_0x2b14ec){if(_0x2b14ec){_0x2527f3=_0x2b14ec;_0x4e0468[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0x6c')][_0xe0aa('0x33')]);_0x4e0468[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x2ebcae[_0xe0aa('0x37')]);_0x4e0468[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x4e0468['model'],_0x4e0468['query']);_0x543a39[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x4e0468[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x2ebcae['query'][_0xe0aa('0x3b')]));_0x543a39[_0xe0aa('0x3a')]=_0x543a39[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x543a39[_0xe0aa('0x3a')]:_0x4e0468['model'];_0x543a39[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x2ebcae[_0xe0aa('0x37')][_0xe0aa('0x3e')]);_0x543a39[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_[_0xe0aa('0x5c')](_0x2ebcae[_0xe0aa('0x37')],_0x4e0468[_0xe0aa('0x38')]));_0x543a39[_0xe0aa('0x3f')]=_[_0xe0aa('0x43')](_0x543a39[_0xe0aa('0x3f')],{'$or':[{'ListId':_0x2b14ec['id']},{'ListId':null}]});if(_0x2ebcae[_0xe0aa('0x37')][_0xe0aa('0x40')]){_0x543a39['where']=_[_0xe0aa('0x43')](_0x543a39[_0xe0aa('0x3f')],{'$or':_['map'](_0x543a39[_0xe0aa('0x3a')],function(_0x4eaa87){var _0x576933={};_0x576933[_0x4eaa87]={'$like':'%'+_0x2ebcae['query'][_0xe0aa('0x40')]+'%'};return _0x576933;})});}_0x543a39=_['merge']({},_0x543a39,_0x2ebcae['options']);return db[_0xe0aa('0x6c')][_0xe0aa('0x9c')](_0x543a39);}})[_0xe0aa('0x28')](respondWithResult(_0x3dd12f,null))[_0xe0aa('0x47')](handleError(_0x3dd12f,null));};exports['getGlobalCustomFields']=function(_0x48b0dc,_0x91508c){return db[_0xe0aa('0x6c')][_0xe0aa('0x9c')]({'where':{'ListId':null}})[_0xe0aa('0x28')](handleEntityNotFound(_0x91508c,null))[_0xe0aa('0x28')](function(_0x4313a8){return _0x4313a8;})['then'](respondWithResult(_0x91508c,null))[_0xe0aa('0x47')](handleError(_0x91508c,null));};exports[_0xe0aa('0x9d')]=function(_0x13c38b,_0xf4c0a0,_0x4a5186){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x13c38b['params']['id']}})['then'](handleEntityNotFound(_0xf4c0a0,null))[_0xe0aa('0x28')](function(_0x2f90d9){if(_0x2f90d9){return _0x2f90d9[_0xe0aa('0x9d')](_0x13c38b['body'][_0xe0aa('0x60')],_[_0xe0aa('0x68')](_0x13c38b[_0xe0aa('0x4e')],[_0xe0aa('0x60'),'id'])||{})[_0xe0aa('0x9e')](function(_0x1d2b08){for(var _0x441857=0x0;_0x441857<_0x13c38b[_0xe0aa('0x4e')][_0xe0aa('0x60')][_0xe0aa('0x4b')];_0x441857+=0x1){socket[_0xe0aa('0x9f')]('userCmList:save',{'UserId':Number(_0x13c38b[_0xe0aa('0x4e')][_0xe0aa('0x60')][_0x441857]),'CmListId':Number(_0x13c38b[_0xe0aa('0x49')]['id'])});}return _0x1d2b08;});}})[_0xe0aa('0x28')](respondWithResult(_0xf4c0a0,null))['catch'](handleError(_0xf4c0a0,null));};exports[_0xe0aa('0xa0')]=function(_0x54bc3c,_0x3010b8,_0x5db630){return db['CmList'][_0xe0aa('0x4c')]({'where':{'id':_0x54bc3c['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3010b8,null))[_0xe0aa('0x28')](function(_0x51ff9e){if(_0x51ff9e){return _0x51ff9e[_0xe0aa('0xa0')](_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')])[_0xe0aa('0x28')](function(){if(_[_0xe0aa('0x62')](_0x54bc3c[_0xe0aa('0x37')]['ids'])){for(var _0x1b6778=0x0;_0x1b6778<_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')]['length'];_0x1b6778+=0x1){socket[_0xe0aa('0x9f')](_0xe0aa('0xa1'),{'UserId':Number(_0x54bc3c[_0xe0aa('0x37')]['ids'][_0x1b6778]),'CmListId':Number(_0x54bc3c[_0xe0aa('0x49')]['id'])});}}else{socket[_0xe0aa('0x9f')]('userCmList:remove',{'UserId':Number(_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')]),'CmListId':Number(_0x54bc3c[_0xe0aa('0x49')]['id'])});}});}})[_0xe0aa('0x28')](respondWithStatusCode(_0x3010b8,null))['catch'](handleError(_0x3010b8,null));};exports[_0xe0aa('0xa2')]=function(_0x2cc340,_0x17357e,_0x332947){var _0x3d3501={};var _0x35fb38={};var _0x239994;var _0x3516af;return db[_0xe0aa('0x32')]['findOne']({'where':{'id':_0x2cc340['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x17357e,null))[_0xe0aa('0x28')](function(_0x133a93){if(_0x133a93){_0x239994=_0x133a93;_0x35fb38[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0xa3')][_0xe0aa('0x33')]);_0x35fb38[_0xe0aa('0x37')]=_['keys'](_0x2cc340[_0xe0aa('0x37')]);_0x35fb38[_0xe0aa('0x38')]=_['intersection'](_0x35fb38['model'],_0x35fb38[_0xe0aa('0x37')]);_0x3d3501['attributes']=_[_0xe0aa('0x39')](_0x35fb38[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x3d3501[_0xe0aa('0x3a')]=_0x3d3501['attributes'][_0xe0aa('0x4b')]?_0x3d3501[_0xe0aa('0x3a')]:_0x35fb38[_0xe0aa('0x36')];_0x3d3501[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x2cc340['query'][_0xe0aa('0x3e')]);_0x3d3501[_0xe0aa('0x3f')]=qs['filters'](_[_0xe0aa('0x5c')](_0x2cc340[_0xe0aa('0x37')],_0x35fb38[_0xe0aa('0x38')]));if(_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x40')]){_0x3d3501[_0xe0aa('0x3f')]=_[_0xe0aa('0x43')](_0x3d3501[_0xe0aa('0x3f')],{'$or':_[_0xe0aa('0x31')](_0x3d3501[_0xe0aa('0x3a')],function(_0x2784fb){var _0x4a683c={};_0x4a683c[_0x2784fb]={'$like':'%'+_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x4a683c;})});}_0x3d3501=_[_0xe0aa('0x43')]({},_0x3d3501,_0x2cc340[_0xe0aa('0x44')]);return _0x239994[_0xe0aa('0xa2')](_0x3d3501);}})['then'](function(_0x39f243){if(_0x39f243){_0x3516af=_0x39f243[_0xe0aa('0x4b')];if(!_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x3d3501[_0xe0aa('0x22')]=qs['limit'](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x3d3501['offset']=qs[_0xe0aa('0x20')](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x20')]);}return _0x239994[_0xe0aa('0xa2')](_0x3d3501);}})['then'](function(_0x44c7e7){if(_0x44c7e7){return _0x44c7e7?{'count':_0x3516af,'rows':_0x44c7e7}:null;}})['then'](respondWithResult(_0x17357e,null))[_0xe0aa('0x47')](handleError(_0x17357e,null));};function handleQuery(_0x2528f4){logger[_0xe0aa('0xa4')](_0x2528f4);return db['sequelize'][_0xe0aa('0x37')](_0x2528f4)[_0xe0aa('0x9e')](function(_0x58b2d5){csv_results[_0xe0aa('0x65')](_0x58b2d5);})['catch'](function(_0x55bbb0){logger[_0xe0aa('0x2c')](_0x55bbb0['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f566ca4..a50ab7a 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x55ca,0x126));var _0xa55c=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x55ca[_0x7ad123];return _0x37d073;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x305787,_0x3ae1c2){_0x305787=_0x305787-0x0;var _0x163cc3=_0x3e74[_0x305787];return _0x163cc3;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e4e84dc..b66bd9d 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 _0x668b=['cm_lists','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','define','CmList'];(function(_0xfec81c,_0x3f7f63){var _0x5d21f6=function(_0x2a0813){while(--_0x2a0813){_0xfec81c['push'](_0xfec81c['shift']());}};_0x5d21f6(++_0x3f7f63);}(_0x668b,0x140));var _0xb668=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x668b[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x35ee6e,_0x34830b){var _0x277d36=function(_0x3abb36){while(--_0x3abb36){_0x35ee6e['push'](_0x35ee6e['shift']());}};_0x277d36(++_0x34830b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index d73040b..168b0fd 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 _0x1b6e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x49119d,_0x1544c3){var _0xba5009=function(_0x113225){while(--_0x113225){_0x49119d['push'](_0x49119d['shift']());}};_0xba5009(++_0x1544c3);}(_0x1b6e,0x186));var _0xe1b6=function(_0x52e615,_0x1670d4){_0x52e615=_0x52e615-0x0;var _0x40efe3=_0x1b6e[_0x52e615];return _0x40efe3;};'use strict';var _=require('lodash');var util=require(_0xe1b6('0x0'));var moment=require(_0xe1b6('0x1'));var BPromise=require(_0xe1b6('0x2'));var rs=require(_0xe1b6('0x3'));var fs=require('fs');var Redis=require(_0xe1b6('0x4'));var db=require(_0xe1b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe1b6('0x6'));var config=require(_0xe1b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1b6('0x8')]['http']({'port':0x232a});config[_0xe1b6('0x9')]=_[_0xe1b6('0xa')](config[_0xe1b6('0x9')],{'host':_0xe1b6('0xb'),'port':0x18eb});var socket=require(_0xe1b6('0xc'))(new Redis(config[_0xe1b6('0x9')]));require(_0xe1b6('0xd'))[_0xe1b6('0xe')](socket);function respondWithRpcPromise(_0x3a517b,_0x697625,_0x37f7d0){return new BPromise(function(_0x2dbc78,_0x1aff04){return client[_0xe1b6('0xf')](_0x3a517b,_0x37f7d0)['then'](function(_0x173fbe){logger['info'](_0xe1b6('0x10'),_0x697625,_0xe1b6('0x11'));logger[_0xe1b6('0x12')](_0xe1b6('0x13'),_0x697625,_0xe1b6('0x11'),JSON[_0xe1b6('0x14')](_0x173fbe));if(_0x173fbe['error']){if(_0x173fbe[_0xe1b6('0x15')][_0xe1b6('0x16')]===0x1f4){logger[_0xe1b6('0x15')](_0xe1b6('0x10'),_0x697625,_0x173fbe['error'][_0xe1b6('0x17')]);return _0x1aff04(_0x173fbe[_0xe1b6('0x15')]['message']);}logger['error'](_0xe1b6('0x10'),_0x697625,_0x173fbe[_0xe1b6('0x15')][_0xe1b6('0x17')]);return _0x2dbc78(_0x173fbe[_0xe1b6('0x15')][_0xe1b6('0x17')]);}else{logger['info'](_0xe1b6('0x10'),_0x697625,'request\x20sent');_0x2dbc78(_0x173fbe[_0xe1b6('0x18')]['message']);}})[_0xe1b6('0x19')](function(_0x21d9a5){logger[_0xe1b6('0x15')](_0xe1b6('0x10'),_0x697625,_0x21d9a5);_0x1aff04(_0x21d9a5);});});} \ No newline at end of file +var _0x2ae7=['request\x20sent','result','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','CmList,\x20%s,\x20%s'];(function(_0x3a869c,_0x2866e3){var _0x96f520=function(_0x2df05d){while(--_0x2df05d){_0x3a869c['push'](_0x3a869c['shift']());}};_0x96f520(++_0x2866e3);}(_0x2ae7,0x19b));var _0x72ae=function(_0x2a0d88,_0x248e33){_0x2a0d88=_0x2a0d88-0x0;var _0x5c09e0=_0x2ae7[_0x2a0d88];return _0x5c09e0;};'use strict';var _=require('lodash');var util=require(_0x72ae('0x0'));var moment=require(_0x72ae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72ae('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x72ae('0x3'));var logger=require('../../config/logger')(_0x72ae('0x4'));var config=require(_0x72ae('0x5'));var jayson=require(_0x72ae('0x6'));var client=jayson['client'][_0x72ae('0x7')]({'port':0x232a});config[_0x72ae('0x8')]=_[_0x72ae('0x9')](config[_0x72ae('0x8')],{'host':_0x72ae('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72ae('0x8')]));require(_0x72ae('0xb'))['register'](socket);function respondWithRpcPromise(_0x220f5d,_0x2e0641,_0x32a060){return new BPromise(function(_0x589524,_0x1d510a){return client[_0x72ae('0xc')](_0x220f5d,_0x32a060)[_0x72ae('0xd')](function(_0x4b6ca5){logger[_0x72ae('0xe')]('CmList,\x20%s,\x20%s',_0x2e0641,'request\x20sent');logger[_0x72ae('0xf')](_0x72ae('0x10'),_0x2e0641,'request\x20sent',JSON[_0x72ae('0x11')](_0x4b6ca5));if(_0x4b6ca5[_0x72ae('0x12')]){if(_0x4b6ca5['error']['code']===0x1f4){logger[_0x72ae('0x12')]('CmList,\x20%s,\x20%s',_0x2e0641,_0x4b6ca5[_0x72ae('0x12')][_0x72ae('0x13')]);return _0x1d510a(_0x4b6ca5['error'][_0x72ae('0x13')]);}logger[_0x72ae('0x12')](_0x72ae('0x14'),_0x2e0641,_0x4b6ca5[_0x72ae('0x12')][_0x72ae('0x13')]);return _0x589524(_0x4b6ca5['error'][_0x72ae('0x13')]);}else{logger[_0x72ae('0xe')](_0x72ae('0x14'),_0x2e0641,_0x72ae('0x15'));_0x589524(_0x4b6ca5[_0x72ae('0x16')][_0x72ae('0x13')]);}})[_0x72ae('0x17')](function(_0x59e9b3){logger[_0x72ae('0x12')](_0x72ae('0x14'),_0x2e0641,_0x59e9b3);_0x1d510a(_0x59e9b3);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 49401a7..84a14a8 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 _0x8e56=['register','length','./cmList.events','remove','emit','removeListener'];(function(_0x332d7d,_0x2e0cc3){var _0x4d16cb=function(_0x23139d){while(--_0x23139d){_0x332d7d['push'](_0x332d7d['shift']());}};_0x4d16cb(++_0x2e0cc3);}(_0x8e56,0xce));var _0x68e5=function(_0x47df97,_0x1f9f71){_0x47df97=_0x47df97-0x0;var _0x25b434=_0x8e56[_0x47df97];return _0x25b434;};'use strict';var CmListEvents=require(_0x68e5('0x0'));var events=['save',_0x68e5('0x1'),'update'];function createListener(_0x4e5931,_0x2b30ef){return function(_0x2d95ea){_0x2b30ef[_0x68e5('0x2')](_0x4e5931,_0x2d95ea);};}function removeListener(_0x37bf9a,_0x330a13){return function(){CmListEvents[_0x68e5('0x3')](_0x37bf9a,_0x330a13);};}exports[_0x68e5('0x4')]=function(_0x2c95f3){for(var _0xd4081e=0x0,_0x1a8957=events[_0x68e5('0x5')];_0xd4081e<_0x1a8957;_0xd4081e++){var _0x18875b=events[_0xd4081e];var _0x44c430=createListener('cmList:'+_0x18875b,_0x2c95f3);CmListEvents['on'](_0x18875b,_0x44c430);}}; \ No newline at end of file +var _0xbccd=['emit','removeListener','register','length','cmList:','./cmList.events','update'];(function(_0x4e1ac0,_0x17ce8d){var _0x2432a8=function(_0x4a3b20){while(--_0x4a3b20){_0x4e1ac0['push'](_0x4e1ac0['shift']());}};_0x2432a8(++_0x17ce8d);}(_0xbccd,0x1b0));var _0xdbcc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xbccd[_0xa1e3e3];return _0xc980e9;};'use strict';var CmListEvents=require(_0xdbcc('0x0'));var events=['save','remove',_0xdbcc('0x1')];function createListener(_0x1c6fb5,_0x39bff4){return function(_0x193088){_0x39bff4[_0xdbcc('0x2')](_0x1c6fb5,_0x193088);};}function removeListener(_0x33b260,_0x4bd11a){return function(){CmListEvents[_0xdbcc('0x3')](_0x33b260,_0x4bd11a);};}exports[_0xdbcc('0x4')]=function(_0x9cca7a){for(var _0x2997fd=0x0,_0x7fe600=events[_0xdbcc('0x5')];_0x2997fd<_0x7fe600;_0x2997fd++){var _0x216289=events[_0x2997fd];var _0x22d783=createListener(_0xdbcc('0x6')+_0x216289,_0x9cca7a);CmListEvents['on'](_0x216289,_0x22d783);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 93fc6e4..1f27396 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 _0xd404=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addCustomField','delete','removeAgents','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x108902,_0x7b318c){var _0x28271e=function(_0x4540bf){while(--_0x4540bf){_0x108902['push'](_0x108902['shift']());}};_0x28271e(++_0x7b318c);}(_0xd404,0x15b));var _0x4d40=function(_0x2fa82c,_0xe38704){_0x2fa82c=_0x2fa82c-0x0;var _0x60acca=_0xd404[_0x2fa82c];return _0x60acca;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x9')](_0x4d40('0x10'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x11')]);router[_0x4d40('0x9')](_0x4d40('0x12'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x13')]);router[_0x4d40('0x9')](_0x4d40('0x14'),auth['isAuthenticated'](),controller[_0x4d40('0x15')]);router[_0x4d40('0x9')](_0x4d40('0x16'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x17')]);router['get'](_0x4d40('0x18'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x19')]);router[_0x4d40('0x1a')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0x1b')]);router[_0x4d40('0x1a')](_0x4d40('0x10'),auth[_0x4d40('0xa')](),controller['addDisposition']);router['post'](_0x4d40('0x12'),auth[_0x4d40('0xa')](),controller['addContacts']);router[_0x4d40('0x1a')](_0x4d40('0x16'),auth['isAuthenticated'](),controller[_0x4d40('0x1c')]);router['post'](_0x4d40('0x18'),auth[_0x4d40('0xa')](),controller['addAgents']);router['put'](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller['update']);router[_0x4d40('0x1d')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller['destroy']);router[_0x4d40('0x1d')](_0x4d40('0x10'),auth[_0x4d40('0xa')](),controller['removeDispositions']);router['delete'](_0x4d40('0x18'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1e')]);module[_0x4d40('0x1f')]=router; \ No newline at end of file +var _0xe630=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','addDisposition','/:id/fields','addCustomField','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x3775ea,_0x46eed3){var _0x12c74d=function(_0x3af009){while(--_0x3af009){_0x3775ea['push'](_0x3775ea['shift']());}};_0x12c74d(++_0x46eed3);}(_0xe630,0x149));var _0x0e63=function(_0x18e8c8,_0x5b6b81){_0x18e8c8=_0x18e8c8-0x0;var _0x1fa76e=_0xe630[_0x18e8c8];return _0x1fa76e;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./cmList.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0x8')](_0x0e63('0xd'),auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0x8')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x8')](_0x0e63('0x11'),auth['isAuthenticated'](),controller[_0x0e63('0x12')]);router[_0x0e63('0x8')](_0x0e63('0x13'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x14')]);router[_0x0e63('0x8')](_0x0e63('0x15'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x16')]);router['get']('/:id/fields',auth[_0x0e63('0x9')](),controller[_0x0e63('0x17')]);router[_0x0e63('0x8')](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x19')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x1a')]);router['post']('/:id/contacts',auth[_0x0e63('0x9')](),controller['addContacts']);router['post'](_0x0e63('0x1b'),auth['isAuthenticated'](),controller[_0x0e63('0x1c')]);router[_0x0e63('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x0e63('0x1e')]);router[_0x0e63('0x1f')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x20')]);router[_0x0e63('0x21')]('/:id',auth[_0x0e63('0x9')](),controller[_0x0e63('0x22')]);router[_0x0e63('0x21')](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller['removeDispositions']);router['delete'](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x23')]);module[_0x0e63('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3f89af2..05e2b7c 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 _0xad09=['STRING'];(function(_0x39af65,_0x1d58db){var _0x111627=function(_0x2baa04){while(--_0x2baa04){_0x39af65['push'](_0x39af65['shift']());}};_0x111627(++_0x1d58db);}(_0xad09,0x184));var _0x9ad0=function(_0x72129f,_0x3d52e2){_0x72129f=_0x72129f-0x0;var _0xc0c836=_0xad09[_0x72129f];return _0xc0c836;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f90fb){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x9ad0('0x0')],'allowNull':![]},'operator':{'type':Sequelize[_0x9ad0('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x9ad0('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xd7f3=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xd7f3,0x1a9));var _0x3d7f=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0xd7f3[_0x371f33];return _0x246c96;};'use strict';var Sequelize=require(_0x3d7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d7f('0x1')],'get':function(_0x2ade8e){return this[_0x3d7f('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3d7f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3d7f('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a0e8378..5c9383b 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(_0x5d3c3f,_0x8bac1){var _0x5c52e9=function(_0x3cd13f){while(--_0x3cd13f){_0x5d3c3f['push'](_0x5d3c3f['shift']());}};_0x5c52e9(++_0x8bac1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0x688f88,_0x4275ec){var _0x162c4e=function(_0x47bf6b){while(--_0x47bf6b){_0x688f88['push'](_0x688f88['shift']());}};_0x162c4e(++_0x4275ec);}(_0x7a54,0x106));var _0x47a5=function(_0x56c2a9,_0x5e7e76){_0x56c2a9=_0x56c2a9-0x0;var _0x146023=_0x7a54[_0x56c2a9];return _0x146023;};'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 7eb349a..59d1721 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 _0x8b2e=['define','Condition','tools_conditions','lodash','../../config/logger','moment','request-promise','path','./condition.attributes'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x8b2e,0xc0));var _0xe8b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b2e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8b2('0x0'));var util=require('util');var logger=require(_0xe8b2('0x1'))('api');var moment=require(_0xe8b2('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8b2('0x3'));var fs=require('fs');var path=require(_0xe8b2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8b2('0x5'));module['exports']=function(_0x155f38,_0x18e10c){return _0x155f38[_0xe8b2('0x6')](_0xe8b2('0x7'),attributes,{'tableName':_0xe8b2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x402e=['request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x402e,0xcb));var _0xe402=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x402e[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xe402('0x0'));var util=require(_0xe402('0x1'));var logger=require('../../config/logger')(_0xe402('0x2'));var moment=require(_0xe402('0x3'));var BPromise=require(_0xe402('0x4'));var rp=require(_0xe402('0x5'));var fs=require('fs');var path=require(_0xe402('0x6'));var rimraf=require(_0xe402('0x7'));var config=require(_0xe402('0x8'));var attributes=require(_0xe402('0x9'));module[_0xe402('0xa')]=function(_0x5a6a89,_0x408e56){return _0x5a6a89[_0xe402('0xb')](_0xe402('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 41b4e92..ff5569b 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 _0xb2d8=['client','request','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb2d8,0x9f));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8b2d('0x1'));var rs=require(_0x8b2d('0x2'));var fs=require('fs');var Redis=require(_0x8b2d('0x3'));var db=require(_0x8b2d('0x4'))['db'];var utils=require(_0x8b2d('0x5'));var logger=require(_0x8b2d('0x6'))(_0x8b2d('0x7'));var config=require(_0x8b2d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b2d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x113396,_0xd0e764,_0x3af845){return new BPromise(function(_0x2246e5,_0x3a619d){return client[_0x8b2d('0xa')](_0x113396,_0x3af845)['then'](function(_0x1435a5){logger['info'](_0x8b2d('0xb'),_0xd0e764,'request\x20sent');logger[_0x8b2d('0xc')](_0x8b2d('0xd'),_0xd0e764,_0x8b2d('0xe'),JSON[_0x8b2d('0xf')](_0x1435a5));if(_0x1435a5[_0x8b2d('0x10')]){if(_0x1435a5['error'][_0x8b2d('0x11')]===0x1f4){logger[_0x8b2d('0x10')](_0x8b2d('0xb'),_0xd0e764,_0x1435a5[_0x8b2d('0x10')][_0x8b2d('0x12')]);return _0x3a619d(_0x1435a5['error'][_0x8b2d('0x12')]);}logger[_0x8b2d('0x10')](_0x8b2d('0xb'),_0xd0e764,_0x1435a5[_0x8b2d('0x10')][_0x8b2d('0x12')]);return _0x2246e5(_0x1435a5[_0x8b2d('0x10')][_0x8b2d('0x12')]);}else{logger['info'](_0x8b2d('0xb'),_0xd0e764,_0x8b2d('0xe'));_0x2246e5(_0x1435a5[_0x8b2d('0x13')]['message']);}})[_0x8b2d('0x14')](function(_0x5600a7){logger[_0x8b2d('0x10')](_0x8b2d('0xb'),_0xd0e764,_0x5600a7);_0x3a619d(_0x5600a7);});});} \ No newline at end of file +var _0x7f34=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc69530,_0x57c174){var _0x148a92=function(_0x409d97){while(--_0x409d97){_0xc69530['push'](_0xc69530['shift']());}};_0x148a92(++_0x57c174);}(_0x7f34,0x13f));var _0x47f3=function(_0x438d7f,_0x50fd81){_0x438d7f=_0x438d7f-0x0;var _0x5c7589=_0x7f34[_0x438d7f];return _0x5c7589;};'use strict';var _=require(_0x47f3('0x0'));var util=require('util');var moment=require(_0x47f3('0x1'));var BPromise=require(_0x47f3('0x2'));var rs=require(_0x47f3('0x3'));var fs=require('fs');var Redis=require(_0x47f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x47f3('0x5'))(_0x47f3('0x6'));var config=require(_0x47f3('0x7'));var jayson=require(_0x47f3('0x8'));var client=jayson[_0x47f3('0x9')][_0x47f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37cf99,_0x1a2890,_0x5263b2){return new BPromise(function(_0x5499a0,_0x93466b){return client['request'](_0x37cf99,_0x5263b2)['then'](function(_0x514143){logger['info'](_0x47f3('0xb'),_0x1a2890,_0x47f3('0xc'));logger[_0x47f3('0xd')](_0x47f3('0xe'),_0x1a2890,'request\x20sent',JSON[_0x47f3('0xf')](_0x514143));if(_0x514143['error']){if(_0x514143['error'][_0x47f3('0x10')]===0x1f4){logger['error'](_0x47f3('0xb'),_0x1a2890,_0x514143['error'][_0x47f3('0x11')]);return _0x93466b(_0x514143[_0x47f3('0x12')][_0x47f3('0x11')]);}logger[_0x47f3('0x12')](_0x47f3('0xb'),_0x1a2890,_0x514143[_0x47f3('0x12')][_0x47f3('0x11')]);return _0x5499a0(_0x514143['error'][_0x47f3('0x11')]);}else{logger[_0x47f3('0x13')](_0x47f3('0xb'),_0x1a2890,'request\x20sent');_0x5499a0(_0x514143[_0x47f3('0x14')][_0x47f3('0x11')]);}})[_0x47f3('0x15')](function(_0x30f83f){logger[_0x47f3('0x12')](_0x47f3('0xb'),_0x1a2890,_0x30f83f);_0x93466b(_0x30f83f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 39ffc3b..255d379 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 _0x6c66=['fs-extra','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x6c66,0x119));var _0x66c6=function(_0x8d958c,_0x2daab6){_0x8d958c=_0x8d958c-0x0;var _0x53ee54=_0x6c66[_0x8d958c];return _0x53ee54;};'use strict';var multer=require(_0x66c6('0x0'));var util=require(_0x66c6('0x1'));var path=require(_0x66c6('0x2'));var timeout=require(_0x66c6('0x3'));var express=require(_0x66c6('0x4'));var router=express['Router']();var fs_extra=require(_0x66c6('0x5'));var auth=require(_0x66c6('0x6'));var interaction=require(_0x66c6('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0x66c6('0x8'),auth[_0x66c6('0x9')](),controller['update']);router[_0x66c6('0xa')](_0x66c6('0x8'),auth['isAuthenticated'](),controller[_0x66c6('0xb')]);module[_0x66c6('0xc')]=router; \ No newline at end of file +var _0x6860=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x52ca63,_0x3b3267){var _0xa1126a=function(_0x20d45d){while(--_0x20d45d){_0x52ca63['push'](_0x52ca63['shift']());}};_0xa1126a(++_0x3b3267);}(_0x6860,0x179));var _0x0686=function(_0x2e140e,_0xcc1351){_0x2e140e=_0x2e140e-0x0;var _0x2c4c8c=_0x6860[_0x2e140e];return _0x2c4c8c;};'use strict';var multer=require(_0x0686('0x0'));var util=require(_0x0686('0x1'));var path=require(_0x0686('0x2'));var timeout=require(_0x0686('0x3'));var express=require(_0x0686('0x4'));var router=express[_0x0686('0x5')]();var fs_extra=require(_0x0686('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0686('0x7'));var config=require(_0x0686('0x8'));var controller=require('./condition.controller');router[_0x0686('0x9')](_0x0686('0xa'),auth[_0x0686('0xb')](),controller[_0x0686('0xc')]);router[_0x0686('0xd')]('/:id',auth[_0x0686('0xb')](),controller[_0x0686('0xe')]);module[_0x0686('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 76678d0..034caa1 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 _0xb75c=['exports','STRING','name','INTEGER'];(function(_0x1f79a6,_0x40085e){var _0x10e9ce=function(_0x1e15de){while(--_0x1e15de){_0x1f79a6['push'](_0x1f79a6['shift']());}};_0x10e9ce(++_0x40085e);}(_0xb75c,0x8c));var _0xcb75=function(_0x103079,_0x2d6640){_0x103079=_0x103079-0x0;var _0x562ee9=_0xb75c[_0x103079];return _0x562ee9;};'use strict';var Sequelize=require('sequelize');module[_0xcb75('0x0')]={'name':{'type':Sequelize[_0xcb75('0x1')],'allowNull':![],'unique':_0xcb75('0x2')},'OrderBy':{'type':Sequelize[_0xcb75('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8a6c=['STRING','sequelize','exports','name','INTEGER'];(function(_0x2a12e1,_0x17ba71){var _0x5723c1=function(_0x102e73){while(--_0x102e73){_0x2a12e1['push'](_0x2a12e1['shift']());}};_0x5723c1(++_0x17ba71);}(_0x8a6c,0x6f));var _0xc8a6=function(_0x3e1c59,_0x4eff25){_0x3e1c59=_0x3e1c59-0x0;var _0x42e558=_0x8a6c[_0x3e1c59];return _0x42e558;};'use strict';var Sequelize=require(_0xc8a6('0x0'));module[_0xc8a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc8a6('0x2')},'OrderBy':{'type':Sequelize[_0xc8a6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc8a6('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1e5beed..4eae219 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 _0x7d25=['limit','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','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','params','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d25,0x8a));var _0x57d2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7d25[_0x42bdad];return _0x122626;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='ContactItemTypes';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](db[_0x57d2('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5e3289[_0x57d2('0x52')]['id']}}))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));}; \ No newline at end of file +var _0xfff0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1b8a1d,_0x40c7dc){var _0x39ad6b=function(_0x1e3456){while(--_0x1e3456){_0x1b8a1d['push'](_0x1b8a1d['shift']());}};_0x39ad6b(++_0x40c7dc);}(_0xfff0,0x139));var _0x0fff=function(_0x4e4a4c,_0x2ba475){_0x4e4a4c=_0x4e4a4c-0x0;var _0x10ad62=_0xfff0[_0x4e4a4c];return _0x10ad62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x24cd18=_0x6a116c[_0x0fff('0x28')]({'plain':!![]});var _0x23d9f8='ContactItemTypes';return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x23d9f8,'resourceId':_0x24cd18['id']}})[_0x0fff('0x26')](function(){return _0x6a116c;});})[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x27bd76,_0x3e6fef){return function(_0x44e54a){if(!_0x44e54a){_0x27bd76[_0x0fff('0x2a')](0x194);}return _0x44e54a;};}function handleError(_0x40651c,_0x2c39e3){_0x2c39e3=_0x2c39e3||0x1f4;return function(_0x495734){logger[_0x0fff('0x2b')](_0x495734[_0x0fff('0x2c')]);if(_0x495734[_0x0fff('0x2d')]){delete _0x495734[_0x0fff('0x2d')];}_0x40651c[_0x0fff('0x19')](_0x2c39e3)[_0x0fff('0x2e')](_0x495734);};}exports['index']=function(_0x31f9a4,_0xa16c29){var _0x351102={},_0x48f1d1={},_0x1016fa={'count':0x0,'rows':[]};var _0x3fa6fc=_['map'](db[_0x0fff('0x2f')][_0x0fff('0x30')],function(_0x15bb46){return{'name':_0x15bb46[_0x0fff('0x31')],'type':_0x15bb46[_0x0fff('0x32')][_0x0fff('0x33')]};});_0x48f1d1[_0x0fff('0x34')]=_[_0x0fff('0x35')](_0x3fa6fc,_0x0fff('0x2d'));_0x48f1d1[_0x0fff('0x36')]=_['keys'](_0x31f9a4[_0x0fff('0x36')]);_0x48f1d1[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x48f1d1[_0x0fff('0x34')],_0x48f1d1[_0x0fff('0x36')]);_0x351102['attributes']=_['intersection'](_0x48f1d1[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x39')]));_0x351102['attributes']=_0x351102[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x351102[_0x0fff('0x3a')]:_0x48f1d1[_0x0fff('0x34')];if(!_0x31f9a4['query'][_0x0fff('0x3c')](_0x0fff('0x3d'))){_0x351102[_0x0fff('0x1d')]=qs[_0x0fff('0x1d')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1d')]);_0x351102[_0x0fff('0x1c')]=qs[_0x0fff('0x1c')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1c')]);}_0x351102[_0x0fff('0x3e')]=qs[_0x0fff('0x3f')](_0x31f9a4['query'][_0x0fff('0x3f')]);_0x351102[_0x0fff('0x40')]=qs[_0x0fff('0x37')](_[_0x0fff('0x41')](_0x31f9a4[_0x0fff('0x36')],_0x48f1d1[_0x0fff('0x37')]),_0x3fa6fc);if(_0x31f9a4['query'][_0x0fff('0x42')]){_0x351102[_0x0fff('0x40')]=_[_0x0fff('0x43')](_0x351102[_0x0fff('0x40')],{'$or':_[_0x0fff('0x35')](_0x3fa6fc,function(_0x101151){if(_0x101151[_0x0fff('0x32')]!==_0x0fff('0x44')){var _0x28e0aa={};_0x28e0aa[_0x101151['name']]={'$like':'%'+_0x31f9a4[_0x0fff('0x36')]['filter']+'%'};return _0x28e0aa;}})});}_0x351102=_[_0x0fff('0x43')]({},_0x351102,_0x31f9a4[_0x0fff('0x45')]);var _0x126f6a={'where':_0x351102['where']};return db['ContactItemType'][_0x0fff('0x1f')](_0x126f6a)[_0x0fff('0x26')](function(_0x311348){_0x1016fa['count']=_0x311348;if(_0x31f9a4['query'][_0x0fff('0x46')]){_0x351102['include']=[{'all':!![]}];}return db[_0x0fff('0x2f')][_0x0fff('0x47')](_0x351102);})[_0x0fff('0x26')](function(_0x309d75){_0x1016fa[_0x0fff('0x48')]=_0x309d75;return _0x1016fa;})[_0x0fff('0x26')](respondWithFilteredResult(_0xa16c29,_0x351102))['catch'](handleError(_0xa16c29,null));};exports[_0x0fff('0x49')]=function(_0x39b829,_0x2a8c5e){var _0x41b4d5={'raw':!![],'where':{'id':_0x39b829[_0x0fff('0x4a')]['id']}},_0x7157e5={};_0x7157e5[_0x0fff('0x34')]=_['keys'](db[_0x0fff('0x2f')][_0x0fff('0x30')]);_0x7157e5[_0x0fff('0x36')]=_['keys'](_0x39b829[_0x0fff('0x36')]);_0x7157e5[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],_0x7157e5[_0x0fff('0x36')]);_0x41b4d5[_0x0fff('0x3a')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x39b829[_0x0fff('0x36')][_0x0fff('0x39')]));_0x41b4d5['attributes']=_0x41b4d5[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x41b4d5['attributes']:_0x7157e5[_0x0fff('0x34')];if(_0x39b829[_0x0fff('0x36')][_0x0fff('0x46')]){_0x41b4d5['include']=[{'all':!![]}];}_0x41b4d5=_['merge']({},_0x41b4d5,_0x39b829[_0x0fff('0x45')]);return db['ContactItemType']['find'](_0x41b4d5)[_0x0fff('0x26')](handleEntityNotFound(_0x2a8c5e,null))[_0x0fff('0x26')](respondWithResult(_0x2a8c5e,null))[_0x0fff('0x4b')](handleError(_0x2a8c5e,null));};exports[_0x0fff('0x4c')]=function(_0x3b4b8e,_0x1a7677){return db['ContactItemType'][_0x0fff('0x4c')](_0x3b4b8e[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x32568a){var _0x30c4d6=_0x3b4b8e[_0x0fff('0x4e')]['get']({'plain':!![]});if(!_0x30c4d6)throw new Error(_0x0fff('0x4f'));if(_0x30c4d6[_0x0fff('0x50')]==='user'){var _0x1fc872=_0x32568a['get']({'plain':!![]});var _0x5f1943='ContactItemTypes';return db[_0x0fff('0x51')][_0x0fff('0x52')]({'where':{'name':_0x5f1943,'userProfileId':_0x30c4d6[_0x0fff('0x53')]},'raw':!![]})[_0x0fff('0x26')](function(_0x579291){if(_0x579291&&_0x579291['autoAssociation']===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x1fc872[_0x0fff('0x2d')],'resourceId':_0x1fc872['id'],'type':_0x579291[_0x0fff('0x2d')],'sectionId':_0x579291['id']},{})[_0x0fff('0x26')](function(){return _0x32568a;});}else{return _0x32568a;}})['catch'](function(_0x3b401c){logger[_0x0fff('0x2b')](_0x0fff('0x54'),_0x3b401c);throw _0x3b401c;});}return _0x32568a;})[_0x0fff('0x26')](respondWithResult(_0x1a7677,0xc9))[_0x0fff('0x4b')](handleError(_0x1a7677,null));};exports[_0x0fff('0x25')]=function(_0x1af59f,_0x236da3){if(_0x1af59f[_0x0fff('0x4d')]['id']){delete _0x1af59f[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x2f')][_0x0fff('0x52')]({'where':{'id':_0x1af59f[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x236da3,null))[_0x0fff('0x26')](saveUpdates(_0x1af59f[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x236da3,null))[_0x0fff('0x4b')](handleError(_0x236da3,null));};exports[_0x0fff('0x27')]=function(_0x398513,_0x18c853){return db['ContactItemType'][_0x0fff('0x52')]({'where':{'id':_0x398513[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x18c853,null))[_0x0fff('0x26')](db['CmContactHasItem'][_0x0fff('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x398513['params']['id']}}))[_0x0fff('0x26')](removeEntity(_0x18c853,null))[_0x0fff('0x4b')](handleError(_0x18c853,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2422ff2..2ead3d0 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 _0x9758=['moment','bluebird','request-promise','path','./contactItemType.attributes','exports','ContactItemType','lodash','../../config/logger','api'];(function(_0x5f4be0,_0x12792f){var _0x5abfbc=function(_0x3d79ad){while(--_0x3d79ad){_0x5f4be0['push'](_0x5f4be0['shift']());}};_0x5abfbc(++_0x12792f);}(_0x9758,0x1dd));var _0x8975=function(_0x408742,_0x1baca6){_0x408742=_0x408742-0x0;var _0x3de02a=_0x9758[_0x408742];return _0x3de02a;};'use strict';var _=require(_0x8975('0x0'));var util=require('util');var logger=require(_0x8975('0x1'))(_0x8975('0x2'));var moment=require(_0x8975('0x3'));var BPromise=require(_0x8975('0x4'));var rp=require(_0x8975('0x5'));var fs=require('fs');var path=require(_0x8975('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8975('0x7'));module[_0x8975('0x8')]=function(_0x2aee6c,_0x1fd5e5){return _0x2aee6c['define'](_0x8975('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2355=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','api'];(function(_0x31ea28,_0x2aae30){var _0x43f03d=function(_0x3241b0){while(--_0x3241b0){_0x31ea28['push'](_0x31ea28['shift']());}};_0x43f03d(++_0x2aae30);}(_0x2355,0x99));var _0x5235=function(_0x3d4983,_0x3abe3c){_0x3d4983=_0x3d4983-0x0;var _0x5077d6=_0x2355[_0x3d4983];return _0x5077d6;};'use strict';var _=require(_0x5235('0x0'));var util=require(_0x5235('0x1'));var logger=require('../../config/logger')(_0x5235('0x2'));var moment=require(_0x5235('0x3'));var BPromise=require(_0x5235('0x4'));var rp=require(_0x5235('0x5'));var fs=require('fs');var path=require(_0x5235('0x6'));var rimraf=require(_0x5235('0x7'));var config=require(_0x5235('0x8'));var attributes=require(_0x5235('0x9'));module[_0x5235('0xa')]=function(_0x3135eb,_0x11b707){return _0x3135eb['define'](_0x5235('0xb'),attributes,{'tableName':_0x5235('0xc'),'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 93146c7..47ecc7b 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 _0xb139=['catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xb139,0x1ba));var _0x9b13=function(_0x560b95,_0x46ed21){_0x560b95=_0x560b95-0x0;var _0x385938=_0xb139[_0x560b95];return _0x385938;};'use strict';var _=require(_0x9b13('0x0'));var util=require(_0x9b13('0x1'));var moment=require('moment');var BPromise=require(_0x9b13('0x2'));var rs=require(_0x9b13('0x3'));var fs=require('fs');var Redis=require(_0x9b13('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9b13('0x5'));var config=require(_0x9b13('0x6'));var jayson=require(_0x9b13('0x7'));var client=jayson['client'][_0x9b13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb8e3dc,_0xc1541c,_0x448fbe){return new BPromise(function(_0xacf7de,_0x98acc){return client[_0x9b13('0x9')](_0xb8e3dc,_0x448fbe)['then'](function(_0x329b2d){logger[_0x9b13('0xa')](_0x9b13('0xb'),_0xc1541c,_0x9b13('0xc'));logger[_0x9b13('0xd')](_0x9b13('0xe'),_0xc1541c,_0x9b13('0xc'),JSON[_0x9b13('0xf')](_0x329b2d));if(_0x329b2d[_0x9b13('0x10')]){if(_0x329b2d[_0x9b13('0x10')][_0x9b13('0x11')]===0x1f4){logger[_0x9b13('0x10')]('ContactItemType,\x20%s,\x20%s',_0xc1541c,_0x329b2d[_0x9b13('0x10')][_0x9b13('0x12')]);return _0x98acc(_0x329b2d[_0x9b13('0x10')][_0x9b13('0x12')]);}logger[_0x9b13('0x10')](_0x9b13('0xb'),_0xc1541c,_0x329b2d[_0x9b13('0x10')][_0x9b13('0x12')]);return _0xacf7de(_0x329b2d[_0x9b13('0x10')]['message']);}else{logger[_0x9b13('0xa')]('ContactItemType,\x20%s,\x20%s',_0xc1541c,_0x9b13('0xc'));_0xacf7de(_0x329b2d[_0x9b13('0x13')][_0x9b13('0x12')]);}})[_0x9b13('0x14')](function(_0x2c2f51){logger[_0x9b13('0x10')]('ContactItemType,\x20%s,\x20%s',_0xc1541c,_0x2c2f51);_0x98acc(_0x2c2f51);});});} \ No newline at end of file +var _0x79ea=['request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x79ea,0xbb));var _0xa79e=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0x79ea[_0x451735];return _0x41d1e2;};'use strict';var _=require(_0xa79e('0x0'));var util=require(_0xa79e('0x1'));var moment=require(_0xa79e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa79e('0x3'));var fs=require('fs');var Redis=require(_0xa79e('0x4'));var db=require(_0xa79e('0x5'))['db'];var utils=require(_0xa79e('0x6'));var logger=require(_0xa79e('0x7'))(_0xa79e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa79e('0x9')][_0xa79e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b017f,_0x197777,_0x6cc776){return new BPromise(function(_0xa88b0d,_0xb12a75){return client[_0xa79e('0xb')](_0x6b017f,_0x6cc776)[_0xa79e('0xc')](function(_0x59eb79){logger['info'](_0xa79e('0xd'),_0x197777,_0xa79e('0xe'));logger['debug'](_0xa79e('0xf'),_0x197777,_0xa79e('0xe'),JSON['stringify'](_0x59eb79));if(_0x59eb79[_0xa79e('0x10')]){if(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x11')]===0x1f4){logger['error'](_0xa79e('0xd'),_0x197777,_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);return _0xb12a75(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);}logger[_0xa79e('0x10')]('ContactItemType,\x20%s,\x20%s',_0x197777,_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);return _0xa88b0d(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);}else{logger[_0xa79e('0x13')](_0xa79e('0xd'),_0x197777,_0xa79e('0xe'));_0xa88b0d(_0x59eb79[_0xa79e('0x14')]['message']);}})[_0xa79e('0x15')](function(_0x2c7bee){logger[_0xa79e('0x10')]('ContactItemType,\x20%s,\x20%s',_0x197777,_0x2c7bee);_0xb12a75(_0x2c7bee);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c79cd2c..7b19ee2 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 _0x5794=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x95d6fb,_0x5b3f41){var _0x2a67d5=function(_0x956ce7){while(--_0x956ce7){_0x95d6fb['push'](_0x95d6fb['shift']());}};_0x2a67d5(++_0x5b3f41);}(_0x5794,0x1e3));var _0x4579=function(_0x316e35,_0x3b6ba5){_0x316e35=_0x316e35-0x0;var _0x4889e3=_0x5794[_0x316e35];return _0x4889e3;};'use strict';var multer=require(_0x4579('0x0'));var util=require(_0x4579('0x1'));var path=require(_0x4579('0x2'));var timeout=require(_0x4579('0x3'));var express=require(_0x4579('0x4'));var router=express[_0x4579('0x5')]();var fs_extra=require(_0x4579('0x6'));var auth=require(_0x4579('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4579('0x8'));var controller=require(_0x4579('0x9'));router[_0x4579('0xa')]('/',auth[_0x4579('0xb')](),controller[_0x4579('0xc')]);router['get'](_0x4579('0xd'),auth[_0x4579('0xb')](),controller[_0x4579('0xe')]);router[_0x4579('0xf')]('/',auth[_0x4579('0xb')](),controller[_0x4579('0x10')]);router[_0x4579('0x11')](_0x4579('0xd'),auth[_0x4579('0xb')](),controller[_0x4579('0x12')]);router[_0x4579('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4579('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3f20=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f20,0x1a4));var _0x03f2=function(_0x3cb789,_0x51fbf1){_0x3cb789=_0x3cb789-0x0;var _0x6aa6f=_0x3f20[_0x3cb789];return _0x6aa6f;};'use strict';var multer=require(_0x03f2('0x0'));var util=require(_0x03f2('0x1'));var path=require(_0x03f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x03f2('0x3'));var router=express[_0x03f2('0x4')]();var fs_extra=require(_0x03f2('0x5'));var auth=require(_0x03f2('0x6'));var interaction=require(_0x03f2('0x7'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth[_0x03f2('0x8')](),controller['index']);router[_0x03f2('0x9')](_0x03f2('0xa'),auth[_0x03f2('0x8')](),controller[_0x03f2('0xb')]);router[_0x03f2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x03f2('0xd')]('/:id',auth[_0x03f2('0x8')](),controller[_0x03f2('0xe')]);router[_0x03f2('0xf')](_0x03f2('0xa'),auth[_0x03f2('0x8')](),controller[_0x03f2('0x10')]);module[_0x03f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 38fc5ea..9039b8f 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(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x2300be,_0x63e837){var _0x27c6b8=function(_0x16d53b){while(--_0x16d53b){_0x2300be['push'](_0x2300be['shift']());}};_0x27c6b8(++_0x63e837);}(_0xb10b,0x12a));var _0xbb10=function(_0x372ee1,_0x45c637){_0x372ee1=_0x372ee1-0x0;var _0x31ea06=_0xb10b[_0x372ee1];return _0x31ea06;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4376283..e072f28 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 _0xeafe=['model','fields','attributes','length','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','autoAssociation','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','sort','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','type','key','query','keys','intersection'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xeafe,0xc8));var _0xeeaf=function(_0x23ee94,_0x1859c1){_0x23ee94=_0x23ee94-0x0;var _0x33ab56=_0xeafe[_0x23ee94];return _0x33ab56;};'use strict';var emlformat=require(_0xeeaf('0x0'));var rimraf=require(_0xeeaf('0x1'));var zipdir=require(_0xeeaf('0x2'));var jsonpatch=require(_0xeeaf('0x3'));var rp=require('request-promise');var moment=require(_0xeeaf('0x4'));var BPromise=require(_0xeeaf('0x5'));var Mustache=require(_0xeeaf('0x6'));var util=require(_0xeeaf('0x7'));var path=require(_0xeeaf('0x8'));var sox=require(_0xeeaf('0x9'));var csv=require(_0xeeaf('0xa'));var ejs=require(_0xeeaf('0xb'));var fs=require('fs');var fs_extra=require(_0xeeaf('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeeaf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeeaf('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeeaf('0xe'));var qs=require(_0xeeaf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeeaf('0x10'))(_0xeeaf('0x11'));var utils=require(_0xeeaf('0x12'));var config=require(_0xeeaf('0x13'));var licenseUtil=require(_0xeeaf('0x14'));var db=require(_0xeeaf('0x15'))['db'];config['redis']=_['defaults'](config[_0xeeaf('0x16')],{'host':_0xeeaf('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeeaf('0x16')]));require(_0xeeaf('0x18'))['register'](socket);function respondWithStatusCode(_0x190092,_0x246cc0){_0x246cc0=_0x246cc0||0xcc;return function(_0x347a50){if(_0x347a50){return _0x190092[_0xeeaf('0x19')](_0x246cc0);}return _0x190092[_0xeeaf('0x1a')](_0x246cc0)[_0xeeaf('0x1b')]();};}function respondWithResult(_0x101243,_0xbd8b47){_0xbd8b47=_0xbd8b47||0xc8;return function(_0x4e0338){if(_0x4e0338){return _0x101243[_0xeeaf('0x1a')](_0xbd8b47)[_0xeeaf('0x1c')](_0x4e0338);}};}function respondWithFilteredResult(_0x1c510a,_0xb5bc8){return function(_0x570eea){if(_0x570eea){var _0x5cc5ac=typeof _0xb5bc8[_0xeeaf('0x1d')]===_0xeeaf('0x1e')&&typeof _0xb5bc8[_0xeeaf('0x1f')]===_0xeeaf('0x1e');var _0x2375e2=_0x570eea['count'];var _0x45fa38=_0x5cc5ac?0x0:_0xb5bc8[_0xeeaf('0x1d')];var _0x545c6a=_0x5cc5ac?_0x570eea[_0xeeaf('0x20')]:_0xb5bc8[_0xeeaf('0x1d')]+_0xb5bc8[_0xeeaf('0x1f')];var _0x52f507;if(_0x545c6a>=_0x2375e2){_0x545c6a=_0x2375e2;_0x52f507=0xc8;}else{_0x52f507=0xce;}_0x1c510a['status'](_0x52f507);return _0x1c510a[_0xeeaf('0x21')](_0xeeaf('0x22'),_0x45fa38+'-'+_0x545c6a+'/'+_0x2375e2)[_0xeeaf('0x1c')](_0x570eea);}return null;};}function patchUpdates(_0x31c2bc){return function(_0x1c2934){try{jsonpatch[_0xeeaf('0x23')](_0x1c2934,_0x31c2bc,!![]);}catch(_0x2ad6c0){return BPromise[_0xeeaf('0x24')](_0x2ad6c0);}return _0x1c2934[_0xeeaf('0x25')]();};}function saveUpdates(_0x48b329,_0x2e5e16){return function(_0x2deb61){if(_0x2deb61){return _0x2deb61[_0xeeaf('0x26')](_0x48b329)[_0xeeaf('0x27')](function(_0x3a5b1d){return _0x3a5b1d;});}return null;};}function removeEntity(_0x5b77a9,_0x281434){return function(_0x58990b){if(_0x58990b){return _0x58990b[_0xeeaf('0x28')]()[_0xeeaf('0x27')](function(){var _0x42e645=_0x58990b[_0xeeaf('0x29')]({'plain':!![]});var _0x4c1496=_0xeeaf('0x2a');return db[_0xeeaf('0x2b')]['destroy']({'where':{'type':_0x4c1496,'resourceId':_0x42e645['id']}})[_0xeeaf('0x27')](function(){return _0x58990b;});})[_0xeeaf('0x27')](function(){_0x5b77a9[_0xeeaf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe37bca,_0x1fa756){return function(_0x14c038){if(!_0x14c038){_0xe37bca['sendStatus'](0x194);}return _0x14c038;};}function handleError(_0xd01601,_0x41a786){_0x41a786=_0x41a786||0x1f4;return function(_0x3dccb7){logger[_0xeeaf('0x2c')](_0x3dccb7[_0xeeaf('0x2d')]);if(_0x3dccb7[_0xeeaf('0x2e')]){delete _0x3dccb7[_0xeeaf('0x2e')];}_0xd01601[_0xeeaf('0x1a')](_0x41a786)[_0xeeaf('0x2f')](_0x3dccb7);};}exports['index']=function(_0x3ab4d2,_0x365612){var _0x2177b2={},_0x4ba017={},_0x2086e4={'count':0x0,'rows':[]};var _0x9e52d8=_[_0xeeaf('0x30')](db[_0xeeaf('0x31')][_0xeeaf('0x32')],function(_0x5e3720){return{'name':_0x5e3720['fieldName'],'type':_0x5e3720[_0xeeaf('0x33')][_0xeeaf('0x34')]};});_0x4ba017['model']=_[_0xeeaf('0x30')](_0x9e52d8,_0xeeaf('0x2e'));_0x4ba017[_0xeeaf('0x35')]=_[_0xeeaf('0x36')](_0x3ab4d2[_0xeeaf('0x35')]);_0x4ba017['filters']=_[_0xeeaf('0x37')](_0x4ba017[_0xeeaf('0x38')],_0x4ba017[_0xeeaf('0x35')]);_0x2177b2['attributes']=_[_0xeeaf('0x37')](_0x4ba017[_0xeeaf('0x38')],qs[_0xeeaf('0x39')](_0x3ab4d2[_0xeeaf('0x35')][_0xeeaf('0x39')]));_0x2177b2[_0xeeaf('0x3a')]=_0x2177b2[_0xeeaf('0x3a')][_0xeeaf('0x3b')]?_0x2177b2[_0xeeaf('0x3a')]:_0x4ba017[_0xeeaf('0x38')];if(!_0x3ab4d2[_0xeeaf('0x35')]['hasOwnProperty'](_0xeeaf('0x3c'))){_0x2177b2[_0xeeaf('0x1f')]=qs[_0xeeaf('0x1f')](_0x3ab4d2[_0xeeaf('0x35')][_0xeeaf('0x1f')]);_0x2177b2[_0xeeaf('0x1d')]=qs[_0xeeaf('0x1d')](_0x3ab4d2[_0xeeaf('0x35')][_0xeeaf('0x1d')]);}_0x2177b2[_0xeeaf('0x3d')]=qs['sort'](_0x3ab4d2['query']['sort']);_0x2177b2[_0xeeaf('0x3e')]=qs['filters'](_[_0xeeaf('0x3f')](_0x3ab4d2[_0xeeaf('0x35')],_0x4ba017['filters']),_0x9e52d8);if(_0x3ab4d2[_0xeeaf('0x35')]['filter']){_0x2177b2[_0xeeaf('0x3e')]=_['merge'](_0x2177b2[_0xeeaf('0x3e')],{'$or':_[_0xeeaf('0x30')](_0x9e52d8,function(_0x160c9f){if(_0x160c9f[_0xeeaf('0x33')]!==_0xeeaf('0x40')){var _0x3caec9={};_0x3caec9[_0x160c9f[_0xeeaf('0x2e')]]={'$like':'%'+_0x3ab4d2[_0xeeaf('0x35')][_0xeeaf('0x41')]+'%'};return _0x3caec9;}})});}_0x2177b2=_[_0xeeaf('0x42')]({},_0x2177b2,_0x3ab4d2[_0xeeaf('0x43')]);var _0x27d06d={'where':_0x2177b2[_0xeeaf('0x3e')]};return db[_0xeeaf('0x31')][_0xeeaf('0x20')](_0x27d06d)[_0xeeaf('0x27')](function(_0x4becd8){_0x2086e4[_0xeeaf('0x20')]=_0x4becd8;if(_0x3ab4d2[_0xeeaf('0x35')][_0xeeaf('0x44')]){_0x2177b2[_0xeeaf('0x45')]=[{'all':!![]}];}return db['Dashboard'][_0xeeaf('0x46')](_0x2177b2);})['then'](function(_0x574749){_0x2086e4[_0xeeaf('0x47')]=_0x574749;return _0x2086e4;})['then'](respondWithFilteredResult(_0x365612,_0x2177b2))[_0xeeaf('0x48')](handleError(_0x365612,null));};exports[_0xeeaf('0x49')]=function(_0x4c747f,_0x1ba4cd){var _0x475ae7={'raw':![],'where':{'id':_0x4c747f[_0xeeaf('0x4a')]['id']}},_0x5237a7={};_0x5237a7['model']=_[_0xeeaf('0x36')](db[_0xeeaf('0x31')][_0xeeaf('0x32')]);_0x5237a7['query']=_[_0xeeaf('0x36')](_0x4c747f['query']);_0x5237a7[_0xeeaf('0x4b')]=_[_0xeeaf('0x37')](_0x5237a7[_0xeeaf('0x38')],_0x5237a7[_0xeeaf('0x35')]);_0x475ae7[_0xeeaf('0x3a')]=_['intersection'](_0x5237a7[_0xeeaf('0x38')],qs[_0xeeaf('0x39')](_0x4c747f['query'][_0xeeaf('0x39')]));_0x475ae7[_0xeeaf('0x3a')]=_0x475ae7['attributes']['length']?_0x475ae7[_0xeeaf('0x3a')]:_0x5237a7[_0xeeaf('0x38')];if(_0x4c747f[_0xeeaf('0x35')][_0xeeaf('0x44')]){_0x475ae7[_0xeeaf('0x45')]=[{'all':!![]}];}_0x475ae7=_[_0xeeaf('0x42')]({},_0x475ae7,_0x4c747f['options']);return db[_0xeeaf('0x31')][_0xeeaf('0x4c')](_0x475ae7)[_0xeeaf('0x27')](handleEntityNotFound(_0x1ba4cd,null))[_0xeeaf('0x27')](respondWithResult(_0x1ba4cd,null))[_0xeeaf('0x48')](handleError(_0x1ba4cd,null));};exports[_0xeeaf('0x4d')]=function(_0xd1885d,_0x5950c4){return db[_0xeeaf('0x31')][_0xeeaf('0x4d')](_0xd1885d[_0xeeaf('0x4e')],{})[_0xeeaf('0x27')](function(_0x2ef057){var _0x1fb842=_0xd1885d[_0xeeaf('0x4f')]['get']({'plain':!![]});if(!_0x1fb842)throw new Error(_0xeeaf('0x50'));if(_0x1fb842['role']===_0xeeaf('0x4f')){var _0x507831=_0x2ef057[_0xeeaf('0x29')]({'plain':!![]});var _0x249fca=_0xeeaf('0x2a');return db[_0xeeaf('0x51')][_0xeeaf('0x4c')]({'where':{'name':_0x249fca,'userProfileId':_0x1fb842[_0xeeaf('0x52')]},'raw':!![]})[_0xeeaf('0x27')](function(_0x3f3067){if(_0x3f3067&&_0x3f3067['autoAssociation']===0x0){return db[_0xeeaf('0x2b')][_0xeeaf('0x4d')]({'name':_0x507831[_0xeeaf('0x2e')],'resourceId':_0x507831['id'],'type':_0x3f3067['name'],'sectionId':_0x3f3067['id']},{})[_0xeeaf('0x27')](function(){return _0x2ef057;});}else{return _0x2ef057;}})[_0xeeaf('0x48')](function(_0x40e224){logger[_0xeeaf('0x2c')](_0xeeaf('0x53'),_0x40e224);throw _0x40e224;});}return _0x2ef057;})['then'](respondWithResult(_0x5950c4,0xc9))[_0xeeaf('0x48')](handleError(_0x5950c4,null));};exports[_0xeeaf('0x54')]=function(_0x558af1,_0x3ca379){var _0x5dd826={'where':{'id':_0x558af1['params']['id']}},_0x2a2774={};_0x2a2774[_0xeeaf('0x38')]=_[_0xeeaf('0x36')](db[_0xeeaf('0x31')][_0xeeaf('0x32')]);_0x5dd826[_0xeeaf('0x3a')]=_[_0xeeaf('0x37')](_0x2a2774[_0xeeaf('0x38')],qs[_0xeeaf('0x39')](_0x558af1[_0xeeaf('0x35')][_0xeeaf('0x39')]));_0x5dd826[_0xeeaf('0x3a')]=_0x5dd826[_0xeeaf('0x3a')][_0xeeaf('0x3b')]?_0x5dd826[_0xeeaf('0x3a')]:_0x2a2774[_0xeeaf('0x38')];if(_0x558af1['query'][_0xeeaf('0x44')]){_0x5dd826[_0xeeaf('0x45')]=[{'all':!![]}];}_0x5dd826=_['merge']({},_0x5dd826,_0x558af1[_0xeeaf('0x43')]);return db[_0xeeaf('0x31')]['find'](_0x5dd826)[_0xeeaf('0x27')](handleEntityNotFound(_0x3ca379,null))[_0xeeaf('0x27')](function(_0x1b4273){if(_0x1b4273){var _0x5a6c0=_0x1b4273[_0xeeaf('0x29')]({'plain':!![]});_0x5a6c0=qs[_0xeeaf('0x55')](_0x5a6c0,['id',_0xeeaf('0x56'),_0xeeaf('0x57')]);_0x558af1[_0xeeaf('0x4e')]=_[_0xeeaf('0x55')](_0x558af1[_0xeeaf('0x4e')],['id',_0xeeaf('0x56'),'updatedAt']);return db[_0xeeaf('0x31')][_0xeeaf('0x4d')](_[_0xeeaf('0x42')](_0x5a6c0,_0x558af1[_0xeeaf('0x4e')]),{'include':_0x558af1[_0xeeaf('0x35')][_0xeeaf('0x44')]?[{'all':!![]}]:undefined})[_0xeeaf('0x27')](function(_0x3a27b0){var _0x501be7=_0x558af1[_0xeeaf('0x4f')][_0xeeaf('0x29')]({'plain':!![]});if(!_0x501be7)throw new Error(_0xeeaf('0x50'));if(_0x501be7[_0xeeaf('0x58')]===_0xeeaf('0x4f')){var _0x198ab1=_0x3a27b0[_0xeeaf('0x29')]({'plain':!![]});var _0x2cae0f='CustomDashboards';return db[_0xeeaf('0x51')][_0xeeaf('0x4c')]({'where':{'name':_0x2cae0f,'userProfileId':_0x501be7[_0xeeaf('0x52')]},'raw':!![]})[_0xeeaf('0x27')](function(_0xb6308f){if(_0xb6308f&&_0xb6308f[_0xeeaf('0x59')]===0x0){return db[_0xeeaf('0x2b')][_0xeeaf('0x4d')]({'name':_0x198ab1[_0xeeaf('0x2e')],'resourceId':_0x198ab1['id'],'type':_0xb6308f[_0xeeaf('0x2e')],'sectionId':_0xb6308f['id']},{})[_0xeeaf('0x27')](function(){return _0x3a27b0;});}else{return _0x3a27b0;}})[_0xeeaf('0x48')](function(_0x26b598){logger[_0xeeaf('0x2c')](_0xeeaf('0x53'),_0x26b598);throw _0x26b598;});}return _0x3a27b0;});}})[_0xeeaf('0x27')](respondWithResult(_0x3ca379,0xc9))[_0xeeaf('0x48')](handleError(_0x3ca379,null));};exports[_0xeeaf('0x26')]=function(_0x272fd3,_0x1db0f3){if(_0x272fd3[_0xeeaf('0x4e')]['id']){delete _0x272fd3[_0xeeaf('0x4e')]['id'];}return db['Dashboard'][_0xeeaf('0x4c')]({'where':{'id':_0x272fd3[_0xeeaf('0x4a')]['id']}})[_0xeeaf('0x27')](handleEntityNotFound(_0x1db0f3,null))['then'](saveUpdates(_0x272fd3[_0xeeaf('0x4e')],null))[_0xeeaf('0x27')](respondWithResult(_0x1db0f3,null))[_0xeeaf('0x48')](handleError(_0x1db0f3,null));};exports['destroy']=function(_0x5457ee,_0x3a095a){return db[_0xeeaf('0x31')][_0xeeaf('0x4c')]({'where':{'id':_0x5457ee[_0xeeaf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a095a,null))[_0xeeaf('0x27')](removeEntity(_0x3a095a,null))[_0xeeaf('0x48')](handleError(_0x3a095a,null));};function widgetAttributes(_0x3c208f){try{switch(_0x3c208f[_0xeeaf('0x33')]){case'iframe':return[{'name':'attrUrl','value':_0x3c208f[_0xeeaf('0x5a')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x0]?_0x3c208f['attrs'][0x0][_0xeeaf('0x5c')]:undefined)||_0xeeaf('0x5d')}];case _0xeeaf('0x5e'):return[{'name':_0xeeaf('0x5f'),'value':_0x3c208f[_0xeeaf('0x5f')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x0]?_0x3c208f[_0xeeaf('0x5b')][0x0][_0xeeaf('0x5c')]:undefined)||''}];case _0xeeaf('0x60'):return[{'name':_0xeeaf('0x61'),'value':_0x3c208f[_0xeeaf('0x61')]||(_0x3c208f['attrs']&&_0x3c208f['attrs'][0x0]?_0x3c208f[_0xeeaf('0x5b')][0x0][_0xeeaf('0x5c')]:undefined)||_0xeeaf('0x62')},{'name':_0xeeaf('0x63'),'value':_0x3c208f[_0xeeaf('0x63')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x1]?_0x3c208f[_0xeeaf('0x5b')][0x1]['value']:undefined)||_0xeeaf('0x64')},{'name':_0xeeaf('0x65'),'value':_0x3c208f['attrFontSize']||(_0x3c208f['attrs']&&_0x3c208f['attrs'][0x2]?_0x3c208f['attrs'][0x2][_0xeeaf('0x5c')]:undefined)||0xc}];case _0xeeaf('0x66'):return[{'name':'attrMetric','value':_0x3c208f[_0xeeaf('0x67')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x0]?_0x3c208f['attrs'][0x0][_0xeeaf('0x5c')]:undefined)||_0xeeaf('0x68')},{'name':'attrVoiceQueues','value':_0x3c208f[_0xeeaf('0x69')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x1]?_0x3c208f['attrs'][0x1][_0xeeaf('0x5c')]:undefined)||[]},{'name':_0xeeaf('0x65'),'value':_0x3c208f['attrFontSize']||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x2]?_0x3c208f[_0xeeaf('0x5b')][0x2][_0xeeaf('0x5c')]:undefined)||0x14},{'name':_0xeeaf('0x6a'),'value':_0x3c208f['attrChannel']||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x3]?_0x3c208f[_0xeeaf('0x5b')][0x3][_0xeeaf('0x5c')]:undefined)||_0xeeaf('0x6b')},{'name':_0xeeaf('0x6c'),'value':_0x3c208f[_0xeeaf('0x6c')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x4]?_0x3c208f[_0xeeaf('0x5b')][0x4][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x6d'),'value':_0x3c208f[_0xeeaf('0x6d')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x5]?_0x3c208f[_0xeeaf('0x5b')][0x5][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x6e'),'value':_0x3c208f[_0xeeaf('0x6e')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f['attrs'][0x6]?_0x3c208f[_0xeeaf('0x5b')][0x6][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x6f'),'value':_0x3c208f[_0xeeaf('0x6f')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x7]?_0x3c208f['attrs'][0x7][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x70'),'value':_0x3c208f[_0xeeaf('0x70')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x8]?_0x3c208f[_0xeeaf('0x5b')][0x8][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x71'),'value':_0x3c208f['attrChatWebsites']||(_0x3c208f['attrs']&&_0x3c208f['attrs'][0x9]?_0x3c208f[_0xeeaf('0x5b')][0x9]['value']:undefined)||''}];case _0xeeaf('0x72'):case _0xeeaf('0x73'):return[{'name':'attrSerie1','value':_0x3c208f['attrSerie1']||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x0]?_0x3c208f[_0xeeaf('0x5b')][0x0][_0xeeaf('0x5c')]:undefined)||'total'},{'name':_0xeeaf('0x74'),'value':_0x3c208f[_0xeeaf('0x74')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x1]?_0x3c208f[_0xeeaf('0x5b')][0x1][_0xeeaf('0x5c')]:undefined)||null},{'name':_0xeeaf('0x75'),'value':_0x3c208f['attrSerie3']||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f['attrs'][0x2]?_0x3c208f[_0xeeaf('0x5b')][0x2][_0xeeaf('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3c208f[_0xeeaf('0x69')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x3]?_0x3c208f['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x3c208f[_0xeeaf('0x6a')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x4]?_0x3c208f[_0xeeaf('0x5b')][0x4][_0xeeaf('0x5c')]:undefined)||_0xeeaf('0x6b')},{'name':_0xeeaf('0x6c'),'value':_0x3c208f[_0xeeaf('0x6c')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x5]?_0x3c208f['attrs'][0x5][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x6d'),'value':_0x3c208f[_0xeeaf('0x6d')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x6]?_0x3c208f[_0xeeaf('0x5b')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c208f[_0xeeaf('0x6e')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f['attrs'][0x7]?_0x3c208f[_0xeeaf('0x5b')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c208f[_0xeeaf('0x6f')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x8]?_0x3c208f[_0xeeaf('0x5b')][0x8][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x70'),'value':_0x3c208f[_0xeeaf('0x70')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x9]?_0x3c208f[_0xeeaf('0x5b')][0x9][_0xeeaf('0x5c')]:undefined)||''},{'name':_0xeeaf('0x71'),'value':_0x3c208f['attrChatWebsites']||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0xa]?_0x3c208f[_0xeeaf('0x5b')][0xa][_0xeeaf('0x5c')]:undefined)||''}];case _0xeeaf('0x76'):return[{'name':_0xeeaf('0x77'),'type':_0x3c208f[_0xeeaf('0x78')]||(_0x3c208f['attrs']&&_0x3c208f[_0xeeaf('0x5b')][0x0]?_0x3c208f[_0xeeaf('0x5b')][0x0][_0xeeaf('0x33')]:undefined)||null,'value':_0x3c208f['attrReport']||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f['attrs'][0x0]?_0x3c208f['attrs'][0x0][_0xeeaf('0x5c')]:undefined)||null},{'name':_0xeeaf('0x79'),'value':_0x3c208f[_0xeeaf('0x79')]||(_0x3c208f[_0xeeaf('0x5b')]&&_0x3c208f[_0xeeaf('0x5b')][0x1]?_0x3c208f[_0xeeaf('0x5b')][0x1][_0xeeaf('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x15c7dc){logger[_0xeeaf('0x2c')](_0xeeaf('0x7a'),JSON[_0xeeaf('0x7b')](_0x15c7dc));return[];}}exports['addItem']=function(_0x2810bc,_0x5eaa29,_0x5a6cda){if(_0x2810bc['body']['id']){delete _0x2810bc[_0xeeaf('0x4e')]['id'];}return db[_0xeeaf('0x31')]['find']({'where':{'id':_0x2810bc[_0xeeaf('0x4a')]['id']}})[_0xeeaf('0x27')](handleEntityNotFound(_0x5eaa29,null))[_0xeeaf('0x27')](function(_0x2fcc4a){if(_0x2fcc4a){_0x2810bc[_0xeeaf('0x4e')]['DashboardId']=_0x2fcc4a['id'];_0x2810bc[_0xeeaf('0x4e')][_0xeeaf('0x5b')]=widgetAttributes(_0x2810bc['body']);return db[_0xeeaf('0x7c')][_0xeeaf('0x4d')](_0x2810bc[_0xeeaf('0x4e')]);}})['then'](respondWithResult(_0x5eaa29,null))['catch'](handleError(_0x5eaa29,null));};exports['getItems']=function(_0x522a89,_0x155602,_0x223284){var _0x2f9be2={};var _0x4b1915={};var _0x161789;var _0xddcc41;return db[_0xeeaf('0x31')]['findOne']({'where':{'id':_0x522a89[_0xeeaf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x155602,null))['then'](function(_0x2586a6){if(_0x2586a6){_0x161789=_0x2586a6;_0x4b1915[_0xeeaf('0x38')]=_[_0xeeaf('0x36')](db[_0xeeaf('0x7c')][_0xeeaf('0x32')]);_0x4b1915[_0xeeaf('0x35')]=_[_0xeeaf('0x36')](_0x522a89[_0xeeaf('0x35')]);_0x4b1915[_0xeeaf('0x4b')]=_[_0xeeaf('0x37')](_0x4b1915[_0xeeaf('0x38')],_0x4b1915['query']);_0x2f9be2['attributes']=_[_0xeeaf('0x37')](_0x4b1915[_0xeeaf('0x38')],qs['fields'](_0x522a89[_0xeeaf('0x35')]['fields']));_0x2f9be2[_0xeeaf('0x3a')]=_0x2f9be2[_0xeeaf('0x3a')][_0xeeaf('0x3b')]?_0x2f9be2[_0xeeaf('0x3a')]:_0x4b1915[_0xeeaf('0x38')];_0x2f9be2[_0xeeaf('0x3d')]=qs[_0xeeaf('0x7d')](_0x522a89[_0xeeaf('0x35')]['sort']);_0x2f9be2[_0xeeaf('0x3e')]=qs[_0xeeaf('0x4b')](_[_0xeeaf('0x3f')](_0x522a89[_0xeeaf('0x35')],_0x4b1915[_0xeeaf('0x4b')]));if(_0x522a89[_0xeeaf('0x35')][_0xeeaf('0x41')]){_0x2f9be2[_0xeeaf('0x3e')]=_[_0xeeaf('0x42')](_0x2f9be2[_0xeeaf('0x3e')],{'$or':_[_0xeeaf('0x30')](_0x2f9be2['attributes'],function(_0x2aa6a0){var _0x2191da={};_0x2191da[_0x2aa6a0]={'$like':'%'+_0x522a89['query'][_0xeeaf('0x41')]+'%'};return _0x2191da;})});}_0x2f9be2=_['merge']({},_0x2f9be2,_0x522a89['options']);return _0x161789[_0xeeaf('0x7e')](_0x2f9be2);}})[_0xeeaf('0x27')](function(_0x9b5fac){if(_0x9b5fac){_0xddcc41=_0x9b5fac[_0xeeaf('0x3b')];if(!_0x522a89[_0xeeaf('0x35')][_0xeeaf('0x7f')](_0xeeaf('0x3c'))){_0x2f9be2[_0xeeaf('0x1f')]=qs[_0xeeaf('0x1f')](_0x522a89['query'][_0xeeaf('0x1f')]);_0x2f9be2['offset']=qs[_0xeeaf('0x1d')](_0x522a89['query']['offset']);}return _0x161789[_0xeeaf('0x7e')](_0x2f9be2);}})['then'](function(_0x5e1d5a){if(_0x5e1d5a){return _0x5e1d5a?{'count':_0xddcc41,'rows':_0x5e1d5a}:null;}})[_0xeeaf('0x27')](respondWithResult(_0x155602,null))[_0xeeaf('0x48')](handleError(_0x155602,null));}; \ No newline at end of file +var _0x4151=['redis','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','Dashboard','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','createdAt','updatedAt','omit','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4151,0xe8));var _0x1415=function(_0x5a07a2,_0x32f99c){_0x5a07a2=_0x5a07a2-0x0;var _0x2238fe=_0x4151[_0x5a07a2];return _0x2238fe;};'use strict';var emlformat=require(_0x1415('0x0'));var rimraf=require(_0x1415('0x1'));var zipdir=require(_0x1415('0x2'));var jsonpatch=require(_0x1415('0x3'));var rp=require(_0x1415('0x4'));var moment=require(_0x1415('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1415('0x6'));var sox=require(_0x1415('0x7'));var csv=require(_0x1415('0x8'));var ejs=require(_0x1415('0x9'));var fs=require('fs');var fs_extra=require(_0x1415('0xa'));var _=require(_0x1415('0xb'));var squel=require(_0x1415('0xc'));var crypto=require(_0x1415('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1415('0xe'));var toCsv=require(_0x1415('0x8'));var querystring=require(_0x1415('0xf'));var Papa=require(_0x1415('0x10'));var Redis=require(_0x1415('0x11'));var authService=require(_0x1415('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1415('0x13'));var logger=require(_0x1415('0x14'))('api');var utils=require(_0x1415('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1415('0x16'));var db=require(_0x1415('0x17'))['db'];config['redis']=_['defaults'](config[_0x1415('0x18')],{'host':_0x1415('0x19'),'port':0x18eb});var socket=require(_0x1415('0x1a'))(new Redis(config['redis']));require(_0x1415('0x1b'))[_0x1415('0x1c')](socket);function respondWithStatusCode(_0x1b06fe,_0x502364){_0x502364=_0x502364||0xcc;return function(_0x26ccea){if(_0x26ccea){return _0x1b06fe['sendStatus'](_0x502364);}return _0x1b06fe['status'](_0x502364)[_0x1415('0x1d')]();};}function respondWithResult(_0x5c252b,_0x46ce06){_0x46ce06=_0x46ce06||0xc8;return function(_0x3df99d){if(_0x3df99d){return _0x5c252b[_0x1415('0x1e')](_0x46ce06)[_0x1415('0x1f')](_0x3df99d);}};}function respondWithFilteredResult(_0x4123c7,_0xa1d210){return function(_0x187c96){if(_0x187c96){var _0x110483=typeof _0xa1d210[_0x1415('0x20')]===_0x1415('0x21')&&typeof _0xa1d210['limit']===_0x1415('0x21');var _0x3b5bd9=_0x187c96[_0x1415('0x22')];var _0x225e46=_0x110483?0x0:_0xa1d210[_0x1415('0x20')];var _0x10b202=_0x110483?_0x187c96[_0x1415('0x22')]:_0xa1d210[_0x1415('0x20')]+_0xa1d210[_0x1415('0x23')];var _0x373968;if(_0x10b202>=_0x3b5bd9){_0x10b202=_0x3b5bd9;_0x373968=0xc8;}else{_0x373968=0xce;}_0x4123c7[_0x1415('0x1e')](_0x373968);return _0x4123c7[_0x1415('0x24')](_0x1415('0x25'),_0x225e46+'-'+_0x10b202+'/'+_0x3b5bd9)['json'](_0x187c96);}return null;};}function patchUpdates(_0x57d0ea){return function(_0x1273a6){try{jsonpatch['apply'](_0x1273a6,_0x57d0ea,!![]);}catch(_0xe57652){return BPromise[_0x1415('0x26')](_0xe57652);}return _0x1273a6[_0x1415('0x27')]();};}function saveUpdates(_0x30a352,_0x3c3931){return function(_0x4a3617){if(_0x4a3617){return _0x4a3617[_0x1415('0x28')](_0x30a352)[_0x1415('0x29')](function(_0x49bacd){return _0x49bacd;});}return null;};}function removeEntity(_0x507dcc,_0x108b78){return function(_0x3b4e4b){if(_0x3b4e4b){return _0x3b4e4b[_0x1415('0x2a')]()[_0x1415('0x29')](function(){var _0x1274b9=_0x3b4e4b['get']({'plain':!![]});var _0x3e3f06=_0x1415('0x2b');return db[_0x1415('0x2c')]['destroy']({'where':{'type':_0x3e3f06,'resourceId':_0x1274b9['id']}})['then'](function(){return _0x3b4e4b;});})[_0x1415('0x29')](function(){_0x507dcc[_0x1415('0x1e')](0xcc)[_0x1415('0x1d')]();});}};}function handleEntityNotFound(_0x35dbfd,_0x349b07){return function(_0x2f5c26){if(!_0x2f5c26){_0x35dbfd[_0x1415('0x2d')](0x194);}return _0x2f5c26;};}function handleError(_0x219998,_0x18aeb3){_0x18aeb3=_0x18aeb3||0x1f4;return function(_0xe45d8e){logger[_0x1415('0x2e')](_0xe45d8e[_0x1415('0x2f')]);if(_0xe45d8e[_0x1415('0x30')]){delete _0xe45d8e[_0x1415('0x30')];}_0x219998[_0x1415('0x1e')](_0x18aeb3)[_0x1415('0x31')](_0xe45d8e);};}exports[_0x1415('0x32')]=function(_0x3d66e9,_0x393a8b){var _0x445d83={},_0x5c5105={},_0x391fda={'count':0x0,'rows':[]};var _0x155301=_['map'](db[_0x1415('0x33')][_0x1415('0x34')],function(_0x428e23){return{'name':_0x428e23['fieldName'],'type':_0x428e23[_0x1415('0x35')]['key']};});_0x5c5105[_0x1415('0x36')]=_[_0x1415('0x37')](_0x155301,_0x1415('0x30'));_0x5c5105['query']=_['keys'](_0x3d66e9[_0x1415('0x38')]);_0x5c5105[_0x1415('0x39')]=_[_0x1415('0x3a')](_0x5c5105[_0x1415('0x36')],_0x5c5105[_0x1415('0x38')]);_0x445d83[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0x5c5105[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x3d66e9[_0x1415('0x38')][_0x1415('0x3c')]));_0x445d83[_0x1415('0x3b')]=_0x445d83[_0x1415('0x3b')][_0x1415('0x3d')]?_0x445d83[_0x1415('0x3b')]:_0x5c5105['model'];if(!_0x3d66e9[_0x1415('0x38')]['hasOwnProperty']('nolimit')){_0x445d83[_0x1415('0x23')]=qs['limit'](_0x3d66e9[_0x1415('0x38')]['limit']);_0x445d83[_0x1415('0x20')]=qs[_0x1415('0x20')](_0x3d66e9['query'][_0x1415('0x20')]);}_0x445d83[_0x1415('0x3e')]=qs['sort'](_0x3d66e9['query'][_0x1415('0x3f')]);_0x445d83['where']=qs[_0x1415('0x39')](_[_0x1415('0x40')](_0x3d66e9[_0x1415('0x38')],_0x5c5105[_0x1415('0x39')]),_0x155301);if(_0x3d66e9[_0x1415('0x38')]['filter']){_0x445d83[_0x1415('0x41')]=_[_0x1415('0x42')](_0x445d83['where'],{'$or':_[_0x1415('0x37')](_0x155301,function(_0x70f8fe){if(_0x70f8fe['type']!=='VIRTUAL'){var _0x21b6b0={};_0x21b6b0[_0x70f8fe[_0x1415('0x30')]]={'$like':'%'+_0x3d66e9['query'][_0x1415('0x43')]+'%'};return _0x21b6b0;}})});}_0x445d83=_[_0x1415('0x42')]({},_0x445d83,_0x3d66e9[_0x1415('0x44')]);var _0x5345ba={'where':_0x445d83[_0x1415('0x41')]};return db[_0x1415('0x33')]['count'](_0x5345ba)[_0x1415('0x29')](function(_0x416035){_0x391fda[_0x1415('0x22')]=_0x416035;if(_0x3d66e9[_0x1415('0x38')][_0x1415('0x45')]){_0x445d83['include']=[{'all':!![]}];}return db[_0x1415('0x33')][_0x1415('0x46')](_0x445d83);})[_0x1415('0x29')](function(_0x2de498){_0x391fda[_0x1415('0x47')]=_0x2de498;return _0x391fda;})['then'](respondWithFilteredResult(_0x393a8b,_0x445d83))[_0x1415('0x48')](handleError(_0x393a8b,null));};exports[_0x1415('0x49')]=function(_0x12455a,_0x12ed3c){var _0x55d5b4={'raw':![],'where':{'id':_0x12455a['params']['id']}},_0xc18cbc={};_0xc18cbc[_0x1415('0x36')]=_[_0x1415('0x4a')](db[_0x1415('0x33')][_0x1415('0x34')]);_0xc18cbc[_0x1415('0x38')]=_['keys'](_0x12455a[_0x1415('0x38')]);_0xc18cbc[_0x1415('0x39')]=_[_0x1415('0x3a')](_0xc18cbc['model'],_0xc18cbc['query']);_0x55d5b4[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0xc18cbc[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x12455a[_0x1415('0x38')]['fields']));_0x55d5b4[_0x1415('0x3b')]=_0x55d5b4[_0x1415('0x3b')]['length']?_0x55d5b4[_0x1415('0x3b')]:_0xc18cbc[_0x1415('0x36')];if(_0x12455a[_0x1415('0x38')]['includeAll']){_0x55d5b4['include']=[{'all':!![]}];}_0x55d5b4=_['merge']({},_0x55d5b4,_0x12455a[_0x1415('0x44')]);return db['Dashboard'][_0x1415('0x4b')](_0x55d5b4)[_0x1415('0x29')](handleEntityNotFound(_0x12ed3c,null))[_0x1415('0x29')](respondWithResult(_0x12ed3c,null))[_0x1415('0x48')](handleError(_0x12ed3c,null));};exports[_0x1415('0x4c')]=function(_0x539c11,_0x55b31e){return db['Dashboard']['create'](_0x539c11[_0x1415('0x4d')],{})['then'](function(_0x18ebc9){var _0x15b039=_0x539c11['user'][_0x1415('0x4e')]({'plain':!![]});if(!_0x15b039)throw new Error(_0x1415('0x4f'));if(_0x15b039[_0x1415('0x50')]==='user'){var _0x2d5db5=_0x18ebc9[_0x1415('0x4e')]({'plain':!![]});var _0x4c3c7a=_0x1415('0x2b');return db[_0x1415('0x51')][_0x1415('0x4b')]({'where':{'name':_0x4c3c7a,'userProfileId':_0x15b039[_0x1415('0x52')]},'raw':!![]})[_0x1415('0x29')](function(_0x2ce760){if(_0x2ce760&&_0x2ce760[_0x1415('0x53')]===0x0){return db[_0x1415('0x2c')][_0x1415('0x4c')]({'name':_0x2d5db5['name'],'resourceId':_0x2d5db5['id'],'type':_0x2ce760['name'],'sectionId':_0x2ce760['id']},{})[_0x1415('0x29')](function(){return _0x18ebc9;});}else{return _0x18ebc9;}})[_0x1415('0x48')](function(_0x4026e4){logger['error'](_0x1415('0x54'),_0x4026e4);throw _0x4026e4;});}return _0x18ebc9;})[_0x1415('0x29')](respondWithResult(_0x55b31e,0xc9))['catch'](handleError(_0x55b31e,null));};exports[_0x1415('0x55')]=function(_0x4c48ef,_0x5372d6){var _0x2fcef4={'where':{'id':_0x4c48ef[_0x1415('0x56')]['id']}},_0xb7307e={};_0xb7307e[_0x1415('0x36')]=_[_0x1415('0x4a')](db[_0x1415('0x33')][_0x1415('0x34')]);_0x2fcef4['attributes']=_['intersection'](_0xb7307e['model'],qs['fields'](_0x4c48ef[_0x1415('0x38')][_0x1415('0x3c')]));_0x2fcef4[_0x1415('0x3b')]=_0x2fcef4['attributes'][_0x1415('0x3d')]?_0x2fcef4['attributes']:_0xb7307e[_0x1415('0x36')];if(_0x4c48ef['query'][_0x1415('0x45')]){_0x2fcef4[_0x1415('0x57')]=[{'all':!![]}];}_0x2fcef4=_['merge']({},_0x2fcef4,_0x4c48ef[_0x1415('0x44')]);return db[_0x1415('0x33')]['find'](_0x2fcef4)[_0x1415('0x29')](handleEntityNotFound(_0x5372d6,null))['then'](function(_0x4f93bc){if(_0x4f93bc){var _0xdbafe=_0x4f93bc['get']({'plain':!![]});_0xdbafe=qs['omit'](_0xdbafe,['id',_0x1415('0x58'),_0x1415('0x59')]);_0x4c48ef['body']=_[_0x1415('0x5a')](_0x4c48ef[_0x1415('0x4d')],['id',_0x1415('0x58'),_0x1415('0x59')]);return db[_0x1415('0x33')][_0x1415('0x4c')](_['merge'](_0xdbafe,_0x4c48ef['body']),{'include':_0x4c48ef[_0x1415('0x38')][_0x1415('0x45')]?[{'all':!![]}]:undefined})[_0x1415('0x29')](function(_0xce451a){var _0x223449=_0x4c48ef['user'][_0x1415('0x4e')]({'plain':!![]});if(!_0x223449)throw new Error(_0x1415('0x4f'));if(_0x223449[_0x1415('0x50')]==='user'){var _0x170371=_0xce451a[_0x1415('0x4e')]({'plain':!![]});var _0x509b0a=_0x1415('0x2b');return db[_0x1415('0x51')][_0x1415('0x4b')]({'where':{'name':_0x509b0a,'userProfileId':_0x223449[_0x1415('0x52')]},'raw':!![]})[_0x1415('0x29')](function(_0x38e6a3){if(_0x38e6a3&&_0x38e6a3['autoAssociation']===0x0){return db[_0x1415('0x2c')][_0x1415('0x4c')]({'name':_0x170371[_0x1415('0x30')],'resourceId':_0x170371['id'],'type':_0x38e6a3[_0x1415('0x30')],'sectionId':_0x38e6a3['id']},{})[_0x1415('0x29')](function(){return _0xce451a;});}else{return _0xce451a;}})[_0x1415('0x48')](function(_0x2a9882){logger[_0x1415('0x2e')](_0x1415('0x54'),_0x2a9882);throw _0x2a9882;});}return _0xce451a;});}})['then'](respondWithResult(_0x5372d6,0xc9))[_0x1415('0x48')](handleError(_0x5372d6,null));};exports['update']=function(_0x3f20af,_0x184cf5){if(_0x3f20af[_0x1415('0x4d')]['id']){delete _0x3f20af['body']['id'];}return db[_0x1415('0x33')][_0x1415('0x4b')]({'where':{'id':_0x3f20af['params']['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x184cf5,null))[_0x1415('0x29')](saveUpdates(_0x3f20af['body'],null))['then'](respondWithResult(_0x184cf5,null))['catch'](handleError(_0x184cf5,null));};exports[_0x1415('0x2a')]=function(_0x42bc13,_0x57f570){return db[_0x1415('0x33')]['find']({'where':{'id':_0x42bc13[_0x1415('0x56')]['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x57f570,null))['then'](removeEntity(_0x57f570,null))['catch'](handleError(_0x57f570,null));};function widgetAttributes(_0x5d0572){try{switch(_0x5d0572[_0x1415('0x35')]){case'iframe':return[{'name':_0x1415('0x5b'),'value':_0x5d0572[_0x1415('0x5b')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0]['value']:undefined)||_0x1415('0x5d')}];case'custom':return[{'name':'attrPath','value':_0x5d0572[_0x1415('0x5e')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||''}];case _0x1415('0x60'):return[{'name':'attrHourFormat','value':_0x5d0572[_0x1415('0x61')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x62')},{'name':_0x1415('0x63'),'value':_0x5d0572[_0x1415('0x63')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572[_0x1415('0x5c')][0x1][_0x1415('0x5f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5d0572[_0x1415('0x64')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||0xc}];case _0x1415('0x65'):return[{'name':_0x1415('0x66'),'value':_0x5d0572[_0x1415('0x66')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572['attrs'][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x67')},{'name':_0x1415('0x68'),'value':_0x5d0572[_0x1415('0x68')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572['attrs'][0x1][_0x1415('0x5f')]:undefined)||[]},{'name':_0x1415('0x64'),'value':_0x5d0572['attrFontSize']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||0x14},{'name':_0x1415('0x69'),'value':_0x5d0572[_0x1415('0x69')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x3]?_0x5d0572[_0x1415('0x5c')][0x3][_0x1415('0x5f')]:undefined)||_0x1415('0x6a')},{'name':_0x1415('0x6b'),'value':_0x5d0572['attrEmailAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x4]?_0x5d0572[_0x1415('0x5c')][0x4][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6c'),'value':_0x5d0572[_0x1415('0x6c')]||(_0x5d0572['attrs']&&_0x5d0572['attrs'][0x5]?_0x5d0572[_0x1415('0x5c')][0x5][_0x1415('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5d0572[_0x1415('0x6d')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x6]?_0x5d0572[_0x1415('0x5c')][0x6][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6e'),'value':_0x5d0572['attrOpenchannelAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x7]?_0x5d0572['attrs'][0x7][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6f'),'value':_0x5d0572[_0x1415('0x6f')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x8]?_0x5d0572['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5d0572[_0x1415('0x70')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x9]?_0x5d0572[_0x1415('0x5c')][0x9]['value']:undefined)||''}];case _0x1415('0x71'):case _0x1415('0x72'):return[{'name':_0x1415('0x73'),'value':_0x5d0572[_0x1415('0x73')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x67')},{'name':_0x1415('0x74'),'value':_0x5d0572[_0x1415('0x74')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5d0572[_0x1415('0x75')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||null},{'name':_0x1415('0x68'),'value':_0x5d0572[_0x1415('0x68')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x3]?_0x5d0572[_0x1415('0x5c')][0x3][_0x1415('0x5f')]:undefined)||[]},{'name':'attrChannel','value':_0x5d0572[_0x1415('0x69')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x4]?_0x5d0572[_0x1415('0x5c')][0x4][_0x1415('0x5f')]:undefined)||_0x1415('0x6a')},{'name':_0x1415('0x6b'),'value':_0x5d0572[_0x1415('0x6b')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x5]?_0x5d0572[_0x1415('0x5c')][0x5][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6c'),'value':_0x5d0572[_0x1415('0x6c')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x6]?_0x5d0572[_0x1415('0x5c')][0x6][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6d'),'value':_0x5d0572[_0x1415('0x6d')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x7]?_0x5d0572['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d0572['attrOpenchannelAccounts']||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x8]?_0x5d0572['attrs'][0x8][_0x1415('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d0572['attrWhatsappAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x9]?_0x5d0572[_0x1415('0x5c')][0x9][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x70'),'value':_0x5d0572['attrChatWebsites']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0xa]?_0x5d0572[_0x1415('0x5c')][0xa]['value']:undefined)||''}];case _0x1415('0x76'):return[{'name':'attrReport','type':_0x5d0572[_0x1415('0x77')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x0]?_0x5d0572['attrs'][0x0][_0x1415('0x35')]:undefined)||null,'value':_0x5d0572[_0x1415('0x78')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||null},{'name':_0x1415('0x79'),'value':_0x5d0572['attrRefresh']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572[_0x1415('0x5c')][0x1][_0x1415('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x5605b2){logger[_0x1415('0x2e')](_0x1415('0x7a'),JSON[_0x1415('0x7b')](_0x5605b2));return[];}}exports[_0x1415('0x7c')]=function(_0x672788,_0x37f223,_0x359408){if(_0x672788['body']['id']){delete _0x672788['body']['id'];}return db[_0x1415('0x33')][_0x1415('0x4b')]({'where':{'id':_0x672788[_0x1415('0x56')]['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x37f223,null))[_0x1415('0x29')](function(_0x192aea){if(_0x192aea){_0x672788[_0x1415('0x4d')]['DashboardId']=_0x192aea['id'];_0x672788[_0x1415('0x4d')][_0x1415('0x5c')]=widgetAttributes(_0x672788[_0x1415('0x4d')]);return db[_0x1415('0x7d')][_0x1415('0x4c')](_0x672788['body']);}})[_0x1415('0x29')](respondWithResult(_0x37f223,null))[_0x1415('0x48')](handleError(_0x37f223,null));};exports[_0x1415('0x7e')]=function(_0x158527,_0x1a4dae,_0x4efe4a){var _0x192d8f={};var _0x56ff6d={};var _0x4a10c1;var _0x51bfe4;return db['Dashboard']['findOne']({'where':{'id':_0x158527[_0x1415('0x56')]['id']}})['then'](handleEntityNotFound(_0x1a4dae,null))[_0x1415('0x29')](function(_0x23b0a4){if(_0x23b0a4){_0x4a10c1=_0x23b0a4;_0x56ff6d['model']=_['keys'](db[_0x1415('0x7d')]['rawAttributes']);_0x56ff6d[_0x1415('0x38')]=_['keys'](_0x158527[_0x1415('0x38')]);_0x56ff6d['filters']=_[_0x1415('0x3a')](_0x56ff6d['model'],_0x56ff6d[_0x1415('0x38')]);_0x192d8f[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0x56ff6d[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x158527[_0x1415('0x38')][_0x1415('0x3c')]));_0x192d8f[_0x1415('0x3b')]=_0x192d8f[_0x1415('0x3b')][_0x1415('0x3d')]?_0x192d8f[_0x1415('0x3b')]:_0x56ff6d['model'];_0x192d8f[_0x1415('0x3e')]=qs['sort'](_0x158527[_0x1415('0x38')][_0x1415('0x3f')]);_0x192d8f['where']=qs['filters'](_[_0x1415('0x40')](_0x158527[_0x1415('0x38')],_0x56ff6d['filters']));if(_0x158527[_0x1415('0x38')][_0x1415('0x43')]){_0x192d8f['where']=_[_0x1415('0x42')](_0x192d8f[_0x1415('0x41')],{'$or':_[_0x1415('0x37')](_0x192d8f[_0x1415('0x3b')],function(_0x5b77a5){var _0x1210ab={};_0x1210ab[_0x5b77a5]={'$like':'%'+_0x158527[_0x1415('0x38')]['filter']+'%'};return _0x1210ab;})});}_0x192d8f=_[_0x1415('0x42')]({},_0x192d8f,_0x158527['options']);return _0x4a10c1['getItems'](_0x192d8f);}})['then'](function(_0x38230e){if(_0x38230e){_0x51bfe4=_0x38230e[_0x1415('0x3d')];if(!_0x158527[_0x1415('0x38')]['hasOwnProperty'](_0x1415('0x7f'))){_0x192d8f[_0x1415('0x23')]=qs[_0x1415('0x23')](_0x158527[_0x1415('0x38')][_0x1415('0x23')]);_0x192d8f[_0x1415('0x20')]=qs[_0x1415('0x20')](_0x158527[_0x1415('0x38')][_0x1415('0x20')]);}return _0x4a10c1[_0x1415('0x7e')](_0x192d8f);}})[_0x1415('0x29')](function(_0x351d55){if(_0x351d55){return _0x351d55?{'count':_0x51bfe4,'rows':_0x351d55}:null;}})['then'](respondWithResult(_0x1a4dae,null))[_0x1415('0x48')](handleError(_0x1a4dae,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index f49e16d..da62bcc 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 _0xdc69=['update','remove','emit','hook','exports','events','Dashboard','setMaxListeners'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xdc69,0x165));var _0x9dc6=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xdc69[_0x11a962];return _0x55d423;};'use strict';var EventEmitter=require(_0x9dc6('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9dc6('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9dc6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9dc6('0x3'),'afterDestroy':_0x9dc6('0x4')};function emitEvent(_0xaf0443){return function(_0x4b5d86,_0x145f71,_0x5785a9){DashboardEvents[_0x9dc6('0x5')](_0xaf0443+':'+_0x4b5d86['id'],_0x4b5d86);DashboardEvents['emit'](_0xaf0443,_0x4b5d86);_0x5785a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9dc6('0x6')](e,emitEvent(event));}}module[_0x9dc6('0x7')]=DashboardEvents; \ No newline at end of file +var _0x397b=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','emit'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x397b,0x15b));var _0xb397=function(_0x2b20e2,_0x18f513){_0x2b20e2=_0x2b20e2-0x0;var _0xd90eae=_0x397b[_0x2b20e2];return _0xd90eae;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb397('0x0'))['db'][_0xb397('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb397('0x2')](0x0);var events={'afterCreate':_0xb397('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x119150){return function(_0x412060,_0x39ef6e,_0x57333f){DashboardEvents[_0xb397('0x4')](_0x119150+':'+_0x412060['id'],_0x412060);DashboardEvents[_0xb397('0x4')](_0x119150,_0x412060);_0x57333f(null);};}for(var e in events){if(events[_0xb397('0x5')](e)){var event=events[e];Dashboard[_0xb397('0x6')](e,emitEvent(event));}}module[_0xb397('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 8e108f6..df8d9bb 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 _0xdfe7=['util','api','request-promise','rimraf','./dashboard.attributes','define','dashboards'];(function(_0x2ad219,_0x370e47){var _0x4537ac=function(_0x523fc7){while(--_0x523fc7){_0x2ad219['push'](_0x2ad219['shift']());}};_0x4537ac(++_0x370e47);}(_0xdfe7,0x196));var _0x7dfe=function(_0x4f61aa,_0x5350e5){_0x4f61aa=_0x4f61aa-0x0;var _0x5a8796=_0xdfe7[_0x4f61aa];return _0x5a8796;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var logger=require('../../config/logger')(_0x7dfe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7dfe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7dfe('0x3'));var config=require('../../config/environment');var attributes=require(_0x7dfe('0x4'));module['exports']=function(_0x38f051,_0x215721){return _0x38f051[_0x7dfe('0x5')]('Dashboard',attributes,{'tableName':_0x7dfe('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d59=['rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','api','moment'];(function(_0x4f046a,_0x26972f){var _0x19b845=function(_0x44b1c8){while(--_0x44b1c8){_0x4f046a['push'](_0x4f046a['shift']());}};_0x19b845(++_0x26972f);}(_0x5d59,0xb0));var _0x95d5=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x5d59[_0x25d4e5];return _0x44d116;};'use strict';var _=require(_0x95d5('0x0'));var util=require(_0x95d5('0x1'));var logger=require('../../config/logger')(_0x95d5('0x2'));var moment=require(_0x95d5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95d5('0x4'));var config=require(_0x95d5('0x5'));var attributes=require(_0x95d5('0x6'));module[_0x95d5('0x7')]=function(_0x4bba73,_0x75eb1a){return _0x4bba73['define'](_0x95d5('0x8'),attributes,{'tableName':_0x95d5('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 1073167..935a20c 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 _0xed01=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','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','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x489f3c,_0x110a70){var _0x5456ba=function(_0x70088f){while(--_0x70088f){_0x489f3c['push'](_0x489f3c['shift']());}};_0x5456ba(++_0x110a70);}(_0xed01,0x111));var _0x1ed0=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0xed01[_0x4c9cc4];return _0x4384fb;};'use strict';var _=require(_0x1ed0('0x0'));var util=require(_0x1ed0('0x1'));var moment=require('moment');var BPromise=require(_0x1ed0('0x2'));var rs=require(_0x1ed0('0x3'));var fs=require('fs');var Redis=require(_0x1ed0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1ed0('0x5'))(_0x1ed0('0x6'));var config=require(_0x1ed0('0x7'));var jayson=require(_0x1ed0('0x8'));var client=jayson[_0x1ed0('0x9')][_0x1ed0('0xa')]({'port':0x232a});config[_0x1ed0('0xb')]=_[_0x1ed0('0xc')](config[_0x1ed0('0xb')],{'host':_0x1ed0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ed0('0xb')]));require(_0x1ed0('0xe'))[_0x1ed0('0xf')](socket);function respondWithRpcPromise(_0x5cb677,_0x5ec37d,_0x3c4173){return new BPromise(function(_0x44a2dd,_0x13eb13){return client['request'](_0x5cb677,_0x3c4173)[_0x1ed0('0x10')](function(_0x303312){logger[_0x1ed0('0x11')](_0x1ed0('0x12'),_0x5ec37d,_0x1ed0('0x13'));logger[_0x1ed0('0x14')](_0x1ed0('0x15'),_0x5ec37d,_0x1ed0('0x13'),JSON[_0x1ed0('0x16')](_0x303312));if(_0x303312[_0x1ed0('0x17')]){if(_0x303312[_0x1ed0('0x17')][_0x1ed0('0x18')]===0x1f4){logger['error'](_0x1ed0('0x12'),_0x5ec37d,_0x303312[_0x1ed0('0x17')]['message']);return _0x13eb13(_0x303312['error'][_0x1ed0('0x19')]);}logger[_0x1ed0('0x17')](_0x1ed0('0x12'),_0x5ec37d,_0x303312[_0x1ed0('0x17')][_0x1ed0('0x19')]);return _0x44a2dd(_0x303312[_0x1ed0('0x17')][_0x1ed0('0x19')]);}else{logger['info'](_0x1ed0('0x12'),_0x5ec37d,_0x1ed0('0x13'));_0x44a2dd(_0x303312[_0x1ed0('0x1a')][_0x1ed0('0x19')]);}})[_0x1ed0('0x1b')](function(_0x1c4287){logger['error'](_0x1ed0('0x12'),_0x5ec37d,_0x1c4287);_0x13eb13(_0x1c4287);});});} \ No newline at end of file +var _0xb77b=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./dashboard.socket','register','request'];(function(_0x1291ee,_0x2d9572){var _0x3a8ed3=function(_0x9ca443){while(--_0x9ca443){_0x1291ee['push'](_0x1291ee['shift']());}};_0x3a8ed3(++_0x2d9572);}(_0xb77b,0x81));var _0xbb77=function(_0x3f7e8b,_0x7291d1){_0x3f7e8b=_0x3f7e8b-0x0;var _0x4eb892=_0xb77b[_0x3f7e8b];return _0x4eb892;};'use strict';var _=require(_0xbb77('0x0'));var util=require('util');var moment=require(_0xbb77('0x1'));var BPromise=require(_0xbb77('0x2'));var rs=require(_0xbb77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb77('0x4'))['db'];var utils=require(_0xbb77('0x5'));var logger=require(_0xbb77('0x6'))(_0xbb77('0x7'));var config=require(_0xbb77('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb77('0x9')]['http']({'port':0x232a});config[_0xbb77('0xa')]=_[_0xbb77('0xb')](config[_0xbb77('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb77('0xa')]));require(_0xbb77('0xc'))[_0xbb77('0xd')](socket);function respondWithRpcPromise(_0xf3670b,_0x5bf9c4,_0x972730){return new BPromise(function(_0x52f1db,_0x554224){return client[_0xbb77('0xe')](_0xf3670b,_0x972730)[_0xbb77('0xf')](function(_0x32268d){logger[_0xbb77('0x10')](_0xbb77('0x11'),_0x5bf9c4,_0xbb77('0x12'));logger[_0xbb77('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5bf9c4,_0xbb77('0x12'),JSON[_0xbb77('0x14')](_0x32268d));if(_0x32268d['error']){if(_0x32268d[_0xbb77('0x15')]['code']===0x1f4){logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);return _0x554224(_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);}logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);return _0x52f1db(_0x32268d[_0xbb77('0x15')]['message']);}else{logger[_0xbb77('0x10')]('Dashboard,\x20%s,\x20%s',_0x5bf9c4,_0xbb77('0x12'));_0x52f1db(_0x32268d[_0xbb77('0x17')][_0xbb77('0x16')]);}})['catch'](function(_0x91624){logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x91624);_0x554224(_0x91624);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6d6f71e..0ef2bbf 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 _0xb06b=['dashboard:','./dashboard.events','save','remove','emit','register','length'];(function(_0x1f34ea,_0x41ffdb){var _0x1508b5=function(_0x3d38d2){while(--_0x3d38d2){_0x1f34ea['push'](_0x1f34ea['shift']());}};_0x1508b5(++_0x41ffdb);}(_0xb06b,0x15f));var _0xbb06=function(_0xe23a5,_0x581d14){_0xe23a5=_0xe23a5-0x0;var _0xd84639=_0xb06b[_0xe23a5];return _0xd84639;};'use strict';var DashboardEvents=require(_0xbb06('0x0'));var events=[_0xbb06('0x1'),_0xbb06('0x2'),'update'];function createListener(_0x2a8587,_0x79c36e){return function(_0x2951c2){_0x79c36e[_0xbb06('0x3')](_0x2a8587,_0x2951c2);};}function removeListener(_0x3ac2d5,_0x597be4){return function(){DashboardEvents['removeListener'](_0x3ac2d5,_0x597be4);};}exports[_0xbb06('0x4')]=function(_0x5bf573){for(var _0x460078=0x0,_0x14c2d0=events[_0xbb06('0x5')];_0x460078<_0x14c2d0;_0x460078++){var _0x3b5161=events[_0x460078];var _0x4467bf=createListener(_0xbb06('0x6')+_0x3b5161,_0x5bf573);DashboardEvents['on'](_0x3b5161,_0x4467bf);}}; \ No newline at end of file +var _0xaa76=['dashboard:','./dashboard.events','removeListener','length'];(function(_0x4ef0a1,_0x35e1a9){var _0x5f54c3=function(_0x14dbf2){while(--_0x14dbf2){_0x4ef0a1['push'](_0x4ef0a1['shift']());}};_0x5f54c3(++_0x35e1a9);}(_0xaa76,0x85));var _0x6aa7=function(_0x421867,_0x5c83c9){_0x421867=_0x421867-0x0;var _0x2ff3ee=_0xaa76[_0x421867];return _0x2ff3ee;};'use strict';var DashboardEvents=require(_0x6aa7('0x0'));var events=['save','remove','update'];function createListener(_0x1829bb,_0x2b99cc){return function(_0x4cc45b){_0x2b99cc['emit'](_0x1829bb,_0x4cc45b);};}function removeListener(_0xaded95,_0x38a8d4){return function(){DashboardEvents[_0x6aa7('0x1')](_0xaded95,_0x38a8d4);};}exports['register']=function(_0x326244){for(var _0x38eafc=0x0,_0xe56a6a=events[_0x6aa7('0x2')];_0x38eafc<_0xe56a6a;_0x38eafc++){var _0x1fe905=events[_0x38eafc];var _0x129bb5=createListener(_0x6aa7('0x3')+_0x1fe905,_0x326244);DashboardEvents['on'](_0x1fe905,_0x129bb5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3e7de72..2fa1654 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 _0x9c30=['addItem','put','update','delete','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x4b8f21,_0x5d3301){var _0x19a8e2=function(_0x2458cb){while(--_0x2458cb){_0x4b8f21['push'](_0x4b8f21['shift']());}};_0x19a8e2(++_0x5d3301);}(_0x9c30,0xe1));var _0x09c3=function(_0xe9b17b,_0x1c1681){_0xe9b17b=_0xe9b17b-0x0;var _0x4c295e=_0x9c30[_0xe9b17b];return _0x4c295e;};'use strict';var multer=require(_0x09c3('0x0'));var util=require(_0x09c3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09c3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x09c3('0x3'));var interaction=require(_0x09c3('0x4'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x09c3('0x5')]('/',auth[_0x09c3('0x6')](),controller['index']);router[_0x09c3('0x5')](_0x09c3('0x7'),auth['isAuthenticated'](),controller[_0x09c3('0x8')]);router[_0x09c3('0x5')](_0x09c3('0x9'),auth['isAuthenticated'](),controller[_0x09c3('0xa')]);router[_0x09c3('0xb')]('/',auth[_0x09c3('0x6')](),controller[_0x09c3('0xc')]);router[_0x09c3('0xb')](_0x09c3('0xd'),auth[_0x09c3('0x6')](),controller[_0x09c3('0xe')]);router['post']('/:id/items',auth[_0x09c3('0x6')](),controller[_0x09c3('0xf')]);router[_0x09c3('0x10')](_0x09c3('0x7'),auth['isAuthenticated'](),controller[_0x09c3('0x11')]);router[_0x09c3('0x12')](_0x09c3('0x7'),auth['isAuthenticated'](),controller[_0x09c3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x484b=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','/:id'];(function(_0xc34843,_0x28147e){var _0x56221d=function(_0x352c1d){while(--_0x352c1d){_0xc34843['push'](_0xc34843['shift']());}};_0x56221d(++_0x28147e);}(_0x484b,0x81));var _0xb484=function(_0x41f7c5,_0x57ef4c){_0x41f7c5=_0x41f7c5-0x0;var _0x57e18c=_0x484b[_0x41f7c5];return _0x57e18c;};'use strict';var multer=require(_0xb484('0x0'));var util=require(_0xb484('0x1'));var path=require(_0xb484('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb484('0x3')]();var fs_extra=require(_0xb484('0x4'));var auth=require(_0xb484('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb484('0x6'));var controller=require(_0xb484('0x7'));router[_0xb484('0x8')]('/',auth[_0xb484('0x9')](),controller['index']);router['get']('/:id',auth[_0xb484('0x9')](),controller[_0xb484('0xa')]);router[_0xb484('0x8')](_0xb484('0xb'),auth[_0xb484('0x9')](),controller[_0xb484('0xc')]);router[_0xb484('0xd')]('/',auth[_0xb484('0x9')](),controller[_0xb484('0xe')]);router['post'](_0xb484('0xf'),auth[_0xb484('0x9')](),controller['clone']);router[_0xb484('0xd')](_0xb484('0xb'),auth[_0xb484('0x9')](),controller[_0xb484('0x10')]);router['put'](_0xb484('0x11'),auth[_0xb484('0x9')](),controller[_0xb484('0x12')]);router[_0xb484('0x13')](_0xb484('0x11'),auth['isAuthenticated'](),controller[_0xb484('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e1ad68b..db45c32 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 _0x31f0=['INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x502f7c,_0x1dc83b){var _0x201c0e=function(_0x50488a){while(--_0x50488a){_0x502f7c['push'](_0x502f7c['shift']());}};_0x201c0e(++_0x1dc83b);}(_0x31f0,0xb7));var _0x031f=function(_0x29d2e2,_0x259dff){_0x29d2e2=_0x29d2e2-0x0;var _0x26018c=_0x31f0[_0x29d2e2];return _0x26018c;};'use strict';var Sequelize=require(_0x031f('0x0'));var squel=require('squel');var _=require(_0x031f('0x1'));module['exports']={'title':{'type':Sequelize[_0x031f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x031f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x031f('0x3')](_0x031f('0x4')),'get':function(){try{return JSON['parse'](this[_0x031f('0x5')](_0x031f('0x6')));}catch(_0x4f6059){return[];}},'set':function(_0x4c0f94){try{this['setDataValue'](_0x031f('0x6'),JSON['stringify'](_0x4c0f94));}catch(_0x365f59){this[_0x031f('0x7')](_0x031f('0x6'),JSON[_0x031f('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x031f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x031f('0x9')]},'col':{'type':Sequelize[_0x031f('0x9')]},'background':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x031f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5496,0x175));var _0x6549=function(_0x26e6c4,_0x163fc6){_0x26e6c4=_0x26e6c4-0x0;var _0x558868=_0x5496[_0x26e6c4];return _0x558868;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'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 cdaf28b..ffd0074 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 _0x4813=['rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','find','params','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrFontSize','attrMetric','attrVoiceQueues','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChannel','voice','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','status','error','name','show','model','keys','DashboardItem'];(function(_0x34e951,_0x5f5d14){var _0x2e9356=function(_0x3b0706){while(--_0x3b0706){_0x34e951['push'](_0x34e951['shift']());}};_0x2e9356(++_0x5f5d14);}(_0x4813,0x14e));var _0x3481=function(_0x1ec200,_0xa757cd){_0x1ec200=_0x1ec200-0x0;var _0x3cddc1=_0x4813[_0x1ec200];return _0x3cddc1;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];config[_0x3481('0x17')]=_[_0x3481('0x18')](config[_0x3481('0x17')],{'host':_0x3481('0x19'),'port':0x18eb});var socket=require(_0x3481('0x1a'))(new Redis(config['redis']));require(_0x3481('0x1b'))[_0x3481('0x1c')](socket);function respondWithStatusCode(_0x1bcfad,_0x3f5ef5){_0x3f5ef5=_0x3f5ef5||0xcc;return function(_0x6f1c9f){if(_0x6f1c9f){return _0x1bcfad[_0x3481('0x1d')](_0x3f5ef5);}return _0x1bcfad['status'](_0x3f5ef5)[_0x3481('0x1e')]();};}function respondWithResult(_0x41c2aa,_0x48cd2f){_0x48cd2f=_0x48cd2f||0xc8;return function(_0x4e0f68){if(_0x4e0f68){return _0x41c2aa['status'](_0x48cd2f)['json'](_0x4e0f68);}};}function respondWithFilteredResult(_0x4f5d1b,_0x5f158f){return function(_0x32a315){if(_0x32a315){var _0x35a12b=typeof _0x5f158f['offset']==='undefined'&&typeof _0x5f158f[_0x3481('0x1f')]===_0x3481('0x20');var _0x3b43dc=_0x32a315['count'];var _0x47a669=_0x35a12b?0x0:_0x5f158f[_0x3481('0x21')];var _0x3862eb=_0x35a12b?_0x32a315[_0x3481('0x22')]:_0x5f158f[_0x3481('0x21')]+_0x5f158f[_0x3481('0x1f')];var _0x4469d4;if(_0x3862eb>=_0x3b43dc){_0x3862eb=_0x3b43dc;_0x4469d4=0xc8;}else{_0x4469d4=0xce;}_0x4f5d1b['status'](_0x4469d4);return _0x4f5d1b[_0x3481('0x23')](_0x3481('0x24'),_0x47a669+'-'+_0x3862eb+'/'+_0x3b43dc)[_0x3481('0x25')](_0x32a315);}return null;};}function patchUpdates(_0xea1072){return function(_0x50663d){try{jsonpatch[_0x3481('0x26')](_0x50663d,_0xea1072,!![]);}catch(_0x48eb64){return BPromise[_0x3481('0x27')](_0x48eb64);}return _0x50663d[_0x3481('0x28')]();};}function saveUpdates(_0x418a7d,_0x40f919){return function(_0x5c96b7){if(_0x5c96b7){return _0x5c96b7['update'](_0x418a7d)[_0x3481('0x29')](function(_0x3e5963){return _0x3e5963;});}return null;};}function removeEntity(_0x249754,_0x405816){return function(_0x572418){if(_0x572418){return _0x572418[_0x3481('0x2a')]()[_0x3481('0x29')](function(){_0x249754[_0x3481('0x2b')](0xcc)[_0x3481('0x1e')]();});}};}function handleEntityNotFound(_0xe79636,_0x3942c7){return function(_0xc4a238){if(!_0xc4a238){_0xe79636[_0x3481('0x1d')](0x194);}return _0xc4a238;};}function handleError(_0x136718,_0x1fcfef){_0x1fcfef=_0x1fcfef||0x1f4;return function(_0x4a20d5){logger[_0x3481('0x2c')](_0x4a20d5['stack']);if(_0x4a20d5[_0x3481('0x2d')]){delete _0x4a20d5[_0x3481('0x2d')];}_0x136718[_0x3481('0x2b')](_0x1fcfef)['send'](_0x4a20d5);};}exports[_0x3481('0x2e')]=function(_0x1fa9cc,_0x2df894){var _0x28699f={'raw':![],'where':{'id':_0x1fa9cc['params']['id']}},_0x3e217b={};_0x3e217b[_0x3481('0x2f')]=_[_0x3481('0x30')](db[_0x3481('0x31')][_0x3481('0x32')]);_0x3e217b['query']=_[_0x3481('0x30')](_0x1fa9cc[_0x3481('0x33')]);_0x3e217b[_0x3481('0x34')]=_[_0x3481('0x35')](_0x3e217b[_0x3481('0x2f')],_0x3e217b[_0x3481('0x33')]);_0x28699f[_0x3481('0x36')]=_[_0x3481('0x35')](_0x3e217b['model'],qs[_0x3481('0x37')](_0x1fa9cc[_0x3481('0x33')][_0x3481('0x37')]));_0x28699f['attributes']=_0x28699f[_0x3481('0x36')]['length']?_0x28699f[_0x3481('0x36')]:_0x3e217b['model'];if(_0x1fa9cc[_0x3481('0x33')]['includeAll']){_0x28699f[_0x3481('0x38')]=[{'all':!![]}];}_0x28699f=_[_0x3481('0x39')]({},_0x28699f,_0x1fa9cc[_0x3481('0x3a')]);return db['DashboardItem'][_0x3481('0x3b')](_0x28699f)['then'](handleEntityNotFound(_0x2df894,null))[_0x3481('0x29')](respondWithResult(_0x2df894,null))['catch'](handleError(_0x2df894,null));};exports[_0x3481('0x2a')]=function(_0x3523f6,_0x1fc118){return db[_0x3481('0x31')][_0x3481('0x3b')]({'where':{'id':_0x3523f6[_0x3481('0x3c')]['id']}})[_0x3481('0x29')](handleEntityNotFound(_0x1fc118,null))[_0x3481('0x29')](removeEntity(_0x1fc118,null))[_0x3481('0x3d')](handleError(_0x1fc118,null));};function widgetAttributes(_0x5d1c15){try{switch(_0x5d1c15[_0x3481('0x3e')]){case'iframe':return[{'name':_0x3481('0x3f'),'value':_0x5d1c15[_0x3481('0x3f')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15['attrs'][0x0]['value']:undefined)||_0x3481('0x41')}];case _0x3481('0x42'):return[{'name':_0x3481('0x43'),'value':_0x5d1c15[_0x3481('0x43')]||(_0x5d1c15['attrs']&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15[_0x3481('0x40')][0x0][_0x3481('0x44')]:undefined)||''}];case _0x3481('0x45'):return[{'name':_0x3481('0x46'),'value':_0x5d1c15[_0x3481('0x46')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15['attrs'][0x0]?_0x5d1c15[_0x3481('0x40')][0x0][_0x3481('0x44')]:undefined)||_0x3481('0x47')},{'name':'attrTimezone','value':_0x5d1c15['attrTimezone']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x1]?_0x5d1c15[_0x3481('0x40')][0x1]['value']:undefined)||'0.00'},{'name':_0x3481('0x48'),'value':_0x5d1c15[_0x3481('0x48')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x2]?_0x5d1c15['attrs'][0x2][_0x3481('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0x3481('0x49'),'value':_0x5d1c15[_0x3481('0x49')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5d1c15[_0x3481('0x4a')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x1]?_0x5d1c15[_0x3481('0x40')][0x1][_0x3481('0x44')]:undefined)||[]},{'name':_0x3481('0x48'),'value':_0x5d1c15[_0x3481('0x48')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x2]?_0x5d1c15[_0x3481('0x40')][0x2][_0x3481('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x5d1c15['attrChannel']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x3]?_0x5d1c15[_0x3481('0x40')][0x3][_0x3481('0x44')]:undefined)||'voice'},{'name':_0x3481('0x4b'),'value':_0x5d1c15['attrEmailAccounts']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x4]?_0x5d1c15[_0x3481('0x40')][0x4][_0x3481('0x44')]:undefined)||''},{'name':_0x3481('0x4c'),'value':_0x5d1c15['attrFaxAccounts']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15['attrs'][0x5]?_0x5d1c15[_0x3481('0x40')][0x5][_0x3481('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5d1c15[_0x3481('0x4d')]||(_0x5d1c15['attrs']&&_0x5d1c15[_0x3481('0x40')][0x6]?_0x5d1c15[_0x3481('0x40')][0x6][_0x3481('0x44')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d1c15['attrOpenchannelAccounts']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x7]?_0x5d1c15[_0x3481('0x40')][0x7][_0x3481('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d1c15[_0x3481('0x4e')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x8]?_0x5d1c15['attrs'][0x8]['value']:undefined)||''},{'name':_0x3481('0x4f'),'value':_0x5d1c15[_0x3481('0x4f')]||(_0x5d1c15['attrs']&&_0x5d1c15[_0x3481('0x40')][0x9]?_0x5d1c15[_0x3481('0x40')][0x9][_0x3481('0x44')]:undefined)||''}];case _0x3481('0x50'):case _0x3481('0x51'):return[{'name':'attrSerie1','value':_0x5d1c15[_0x3481('0x52')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15['attrs'][0x0][_0x3481('0x44')]:undefined)||_0x3481('0x53')},{'name':_0x3481('0x54'),'value':_0x5d1c15['attrSerie2']||(_0x5d1c15['attrs']&&_0x5d1c15[_0x3481('0x40')][0x1]?_0x5d1c15[_0x3481('0x40')][0x1][_0x3481('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x5d1c15[_0x3481('0x55')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x2]?_0x5d1c15['attrs'][0x2][_0x3481('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5d1c15[_0x3481('0x4a')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15['attrs'][0x3]?_0x5d1c15['attrs'][0x3]['value']:undefined)||[]},{'name':_0x3481('0x56'),'value':_0x5d1c15[_0x3481('0x56')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x4]?_0x5d1c15[_0x3481('0x40')][0x4][_0x3481('0x44')]:undefined)||_0x3481('0x57')},{'name':_0x3481('0x4b'),'value':_0x5d1c15[_0x3481('0x4b')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x5]?_0x5d1c15['attrs'][0x5][_0x3481('0x44')]:undefined)||''},{'name':_0x3481('0x4c'),'value':_0x5d1c15['attrFaxAccounts']||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x6]?_0x5d1c15[_0x3481('0x40')][0x6]['value']:undefined)||''},{'name':_0x3481('0x4d'),'value':_0x5d1c15[_0x3481('0x4d')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x7]?_0x5d1c15['attrs'][0x7][_0x3481('0x44')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d1c15[_0x3481('0x58')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15['attrs'][0x8]?_0x5d1c15[_0x3481('0x40')][0x8][_0x3481('0x44')]:undefined)||''},{'name':_0x3481('0x4e'),'value':_0x5d1c15[_0x3481('0x4e')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x9]?_0x5d1c15[_0x3481('0x40')][0x9][_0x3481('0x44')]:undefined)||''},{'name':_0x3481('0x4f'),'value':_0x5d1c15[_0x3481('0x4f')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0xa]?_0x5d1c15[_0x3481('0x40')][0xa][_0x3481('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x3481('0x59'),'type':_0x5d1c15[_0x3481('0x5a')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15['attrs'][0x0][_0x3481('0x3e')]:undefined)||null,'value':_0x5d1c15[_0x3481('0x59')]||(_0x5d1c15['attrs']&&_0x5d1c15[_0x3481('0x40')][0x0]?_0x5d1c15[_0x3481('0x40')][0x0][_0x3481('0x44')]:undefined)||null},{'name':_0x3481('0x5b'),'value':_0x5d1c15[_0x3481('0x5b')]||(_0x5d1c15[_0x3481('0x40')]&&_0x5d1c15[_0x3481('0x40')][0x1]?_0x5d1c15['attrs'][0x1][_0x3481('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3a2d5d){logger[_0x3481('0x2c')](_0x3481('0x5c'),JSON['stringify'](_0x3a2d5d));return[];}}exports['create']=function(_0x4516d9,_0x24d4eb){if(_0x4516d9[_0x3481('0x5d')]){_0x4516d9[_0x3481('0x5d')][_0x3481('0x40')]=widgetAttributes(_0x4516d9[_0x3481('0x5d')]);}return db['DashboardItem'][_0x3481('0x5e')](_0x4516d9[_0x3481('0x5d')],{})['then'](respondWithResult(_0x24d4eb,0xc9))[_0x3481('0x3d')](handleError(_0x24d4eb,null));};exports[_0x3481('0x5f')]=function(_0x47b61c,_0x3a74db){if(_0x47b61c[_0x3481('0x5d')]['id']){delete _0x47b61c[_0x3481('0x5d')]['id'];}_0x47b61c[_0x3481('0x5d')][_0x3481('0x40')]=widgetAttributes(_0x47b61c[_0x3481('0x5d')]);return db[_0x3481('0x31')][_0x3481('0x3b')]({'where':{'id':_0x47b61c[_0x3481('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3a74db,null))[_0x3481('0x29')](saveUpdates(_0x47b61c['body'],null))['then'](respondWithResult(_0x3a74db,null))[_0x3481('0x3d')](handleError(_0x3a74db,null));}; \ No newline at end of file +var _0x5078=['attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','reportType','attrReport','attrRefresh','stringify','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','show','params','DashboardItem','query','keys','model','attributes','intersection','fields','length','includeAll','merge','options','catch','find','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5078,0x148));var _0x8507=function(_0x4c5708,_0x34b1f9){_0x4c5708=_0x4c5708-0x0;var _0x37fa9b=_0x5078[_0x4c5708];return _0x37fa9b;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];config[_0x8507('0x1c')]=_[_0x8507('0x1d')](config[_0x8507('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8507('0x1e'))(new Redis(config[_0x8507('0x1c')]));require(_0x8507('0x1f'))[_0x8507('0x20')](socket);function respondWithStatusCode(_0x2ea0e1,_0x4351b2){_0x4351b2=_0x4351b2||0xcc;return function(_0x5ae6af){if(_0x5ae6af){return _0x2ea0e1['sendStatus'](_0x4351b2);}return _0x2ea0e1[_0x8507('0x21')](_0x4351b2)[_0x8507('0x22')]();};}function respondWithResult(_0x3f1ed1,_0x565000){_0x565000=_0x565000||0xc8;return function(_0x3cb554){if(_0x3cb554){return _0x3f1ed1[_0x8507('0x21')](_0x565000)[_0x8507('0x23')](_0x3cb554);}};}function respondWithFilteredResult(_0x412aee,_0x38a1a7){return function(_0x13b285){if(_0x13b285){var _0x569632=typeof _0x38a1a7[_0x8507('0x24')]==='undefined'&&typeof _0x38a1a7['limit']===_0x8507('0x25');var _0xc556a4=_0x13b285[_0x8507('0x26')];var _0x45435c=_0x569632?0x0:_0x38a1a7[_0x8507('0x24')];var _0x5750fd=_0x569632?_0x13b285[_0x8507('0x26')]:_0x38a1a7[_0x8507('0x24')]+_0x38a1a7[_0x8507('0x27')];var _0x192f1c;if(_0x5750fd>=_0xc556a4){_0x5750fd=_0xc556a4;_0x192f1c=0xc8;}else{_0x192f1c=0xce;}_0x412aee[_0x8507('0x21')](_0x192f1c);return _0x412aee[_0x8507('0x28')](_0x8507('0x29'),_0x45435c+'-'+_0x5750fd+'/'+_0xc556a4)[_0x8507('0x23')](_0x13b285);}return null;};}function patchUpdates(_0x539cf9){return function(_0x60c651){try{jsonpatch[_0x8507('0x2a')](_0x60c651,_0x539cf9,!![]);}catch(_0x37fd9c){return BPromise[_0x8507('0x2b')](_0x37fd9c);}return _0x60c651[_0x8507('0x2c')]();};}function saveUpdates(_0x438001,_0xd2f703){return function(_0x358e50){if(_0x358e50){return _0x358e50['update'](_0x438001)[_0x8507('0x2d')](function(_0x24fc61){return _0x24fc61;});}return null;};}function removeEntity(_0x188ae0,_0x5a559e){return function(_0x6f5ab2){if(_0x6f5ab2){return _0x6f5ab2[_0x8507('0x2e')]()[_0x8507('0x2d')](function(){_0x188ae0[_0x8507('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc48bf5,_0xbf4337){return function(_0x2bd833){if(!_0x2bd833){_0xc48bf5[_0x8507('0x2f')](0x194);}return _0x2bd833;};}function handleError(_0x11c8d5,_0x5f0e81){_0x5f0e81=_0x5f0e81||0x1f4;return function(_0x23c6e1){logger[_0x8507('0x30')](_0x23c6e1[_0x8507('0x31')]);if(_0x23c6e1[_0x8507('0x32')]){delete _0x23c6e1[_0x8507('0x32')];}_0x11c8d5[_0x8507('0x21')](_0x5f0e81)[_0x8507('0x33')](_0x23c6e1);};}exports[_0x8507('0x34')]=function(_0xa3642,_0x6e9a38){var _0x25a7d1={'raw':![],'where':{'id':_0xa3642[_0x8507('0x35')]['id']}},_0x32f500={};_0x32f500['model']=_['keys'](db[_0x8507('0x36')]['rawAttributes']);_0x32f500[_0x8507('0x37')]=_[_0x8507('0x38')](_0xa3642['query']);_0x32f500['filters']=_['intersection'](_0x32f500[_0x8507('0x39')],_0x32f500[_0x8507('0x37')]);_0x25a7d1[_0x8507('0x3a')]=_[_0x8507('0x3b')](_0x32f500[_0x8507('0x39')],qs[_0x8507('0x3c')](_0xa3642['query']['fields']));_0x25a7d1[_0x8507('0x3a')]=_0x25a7d1[_0x8507('0x3a')][_0x8507('0x3d')]?_0x25a7d1['attributes']:_0x32f500['model'];if(_0xa3642[_0x8507('0x37')][_0x8507('0x3e')]){_0x25a7d1['include']=[{'all':!![]}];}_0x25a7d1=_[_0x8507('0x3f')]({},_0x25a7d1,_0xa3642[_0x8507('0x40')]);return db['DashboardItem']['find'](_0x25a7d1)['then'](handleEntityNotFound(_0x6e9a38,null))[_0x8507('0x2d')](respondWithResult(_0x6e9a38,null))[_0x8507('0x41')](handleError(_0x6e9a38,null));};exports[_0x8507('0x2e')]=function(_0x4225d7,_0x56c610){return db['DashboardItem'][_0x8507('0x42')]({'where':{'id':_0x4225d7[_0x8507('0x35')]['id']}})['then'](handleEntityNotFound(_0x56c610,null))[_0x8507('0x2d')](removeEntity(_0x56c610,null))[_0x8507('0x41')](handleError(_0x56c610,null));};function widgetAttributes(_0x38edbd){try{switch(_0x38edbd['type']){case _0x8507('0x43'):return[{'name':_0x8507('0x44'),'value':_0x38edbd[_0x8507('0x44')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||_0x8507('0x46')}];case _0x8507('0x47'):return[{'name':'attrPath','value':_0x38edbd[_0x8507('0x48')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||''}];case _0x8507('0x49'):return[{'name':_0x8507('0x4a'),'value':_0x38edbd['attrHourFormat']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x4c')},{'name':_0x8507('0x4d'),'value':_0x38edbd[_0x8507('0x4d')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x1]?_0x38edbd[_0x8507('0x45')][0x1][_0x8507('0x4b')]:undefined)||_0x8507('0x4e')},{'name':_0x8507('0x4f'),'value':_0x38edbd['attrFontSize']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd['attrs'][0x2][_0x8507('0x4b')]:undefined)||0xc}];case _0x8507('0x50'):return[{'name':_0x8507('0x51'),'value':_0x38edbd['attrMetric']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x52')},{'name':_0x8507('0x53'),'value':_0x38edbd['attrVoiceQueues']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x1]?_0x38edbd[_0x8507('0x45')][0x1][_0x8507('0x4b')]:undefined)||[]},{'name':'attrFontSize','value':_0x38edbd['attrFontSize']||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd[_0x8507('0x45')][0x2][_0x8507('0x4b')]:undefined)||0x14},{'name':_0x8507('0x54'),'value':_0x38edbd[_0x8507('0x54')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x3]?_0x38edbd[_0x8507('0x45')][0x3][_0x8507('0x4b')]:undefined)||'voice'},{'name':_0x8507('0x55'),'value':_0x38edbd[_0x8507('0x55')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x4]?_0x38edbd[_0x8507('0x45')][0x4][_0x8507('0x4b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38edbd['attrFaxAccounts']||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x5]?_0x38edbd[_0x8507('0x45')][0x5][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x56'),'value':_0x38edbd[_0x8507('0x56')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x6]?_0x38edbd[_0x8507('0x45')][0x6][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x57'),'value':_0x38edbd[_0x8507('0x57')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x7]?_0x38edbd['attrs'][0x7]['value']:undefined)||''},{'name':_0x8507('0x58'),'value':_0x38edbd[_0x8507('0x58')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x8]?_0x38edbd['attrs'][0x8][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x59'),'value':_0x38edbd['attrChatWebsites']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x9]?_0x38edbd['attrs'][0x9][_0x8507('0x4b')]:undefined)||''}];case _0x8507('0x5a'):case _0x8507('0x5b'):return[{'name':_0x8507('0x5c'),'value':_0x38edbd[_0x8507('0x5c')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd['attrs'][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x52')},{'name':_0x8507('0x5d'),'value':_0x38edbd['attrSerie2']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x1]?_0x38edbd['attrs'][0x1][_0x8507('0x4b')]:undefined)||null},{'name':'attrSerie3','value':_0x38edbd[_0x8507('0x5e')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd[_0x8507('0x45')][0x2][_0x8507('0x4b')]:undefined)||null},{'name':_0x8507('0x53'),'value':_0x38edbd[_0x8507('0x53')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x3]?_0x38edbd['attrs'][0x3][_0x8507('0x4b')]:undefined)||[]},{'name':_0x8507('0x54'),'value':_0x38edbd[_0x8507('0x54')]||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x4]?_0x38edbd[_0x8507('0x45')][0x4][_0x8507('0x4b')]:undefined)||_0x8507('0x5f')},{'name':_0x8507('0x55'),'value':_0x38edbd[_0x8507('0x55')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x5]?_0x38edbd['attrs'][0x5][_0x8507('0x4b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38edbd[_0x8507('0x60')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x6]?_0x38edbd[_0x8507('0x45')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x38edbd[_0x8507('0x56')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x7]?_0x38edbd[_0x8507('0x45')][0x7][_0x8507('0x4b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38edbd[_0x8507('0x57')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x8]?_0x38edbd[_0x8507('0x45')][0x8][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x58'),'value':_0x38edbd[_0x8507('0x58')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x9]?_0x38edbd[_0x8507('0x45')][0x9][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x59'),'value':_0x38edbd[_0x8507('0x59')]||(_0x38edbd['attrs']&&_0x38edbd['attrs'][0xa]?_0x38edbd[_0x8507('0x45')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x38edbd[_0x8507('0x61')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['type']:undefined)||null,'value':_0x38edbd[_0x8507('0x62')]||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||null},{'name':_0x8507('0x63'),'value':_0x38edbd[_0x8507('0x63')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x1]?_0x38edbd['attrs'][0x1][_0x8507('0x4b')]:undefined)||0x0}];default:return[];}}catch(_0x40497c){logger[_0x8507('0x30')]('widgetAttributes:\x20%s',JSON[_0x8507('0x64')](_0x40497c));return[];}}exports['create']=function(_0x325feb,_0xa7b882){if(_0x325feb[_0x8507('0x65')]){_0x325feb['body'][_0x8507('0x45')]=widgetAttributes(_0x325feb[_0x8507('0x65')]);}return db[_0x8507('0x36')][_0x8507('0x66')](_0x325feb[_0x8507('0x65')],{})['then'](respondWithResult(_0xa7b882,0xc9))[_0x8507('0x41')](handleError(_0xa7b882,null));};exports[_0x8507('0x67')]=function(_0x12bbf3,_0xfb5942){if(_0x12bbf3[_0x8507('0x65')]['id']){delete _0x12bbf3['body']['id'];}_0x12bbf3[_0x8507('0x65')][_0x8507('0x45')]=widgetAttributes(_0x12bbf3[_0x8507('0x65')]);return db[_0x8507('0x36')][_0x8507('0x42')]({'where':{'id':_0x12bbf3[_0x8507('0x35')]['id']}})[_0x8507('0x2d')](handleEntityNotFound(_0xfb5942,null))['then'](saveUpdates(_0x12bbf3[_0x8507('0x65')],null))[_0x8507('0x2d')](respondWithResult(_0xfb5942,null))['catch'](handleError(_0xfb5942,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 09ebd10..d311471 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 _0xe813=['hasOwnProperty','hook','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit'];(function(_0x16ae61,_0x177eca){var _0x589baf=function(_0x30feb1){while(--_0x30feb1){_0x16ae61['push'](_0x16ae61['shift']());}};_0x589baf(++_0x177eca);}(_0xe813,0x1b2));var _0x3e81=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0xe813[_0x137da3];return _0x1ac46c;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x3e81('0x0'))['db'][_0x3e81('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3e81('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e81('0x3'),'afterDestroy':_0x3e81('0x4')};function emitEvent(_0x332edf){return function(_0x24a40f,_0x13cdf6,_0x59821d){DashboardItemEvents[_0x3e81('0x5')](_0x332edf+':'+_0x24a40f['id'],_0x24a40f);DashboardItemEvents[_0x3e81('0x5')](_0x332edf,_0x24a40f);_0x59821d(null);};}for(var e in events){if(events[_0x3e81('0x6')](e)){var event=events[e];DashboardItem[_0x3e81('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x64ff=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x2093be,_0x44cf8f){var _0x5a609e=function(_0x59e247){while(--_0x59e247){_0x2093be['push'](_0x2093be['shift']());}};_0x5a609e(++_0x44cf8f);}(_0x64ff,0x9f));var _0xf64f=function(_0x4266a2,_0x2634de){_0x4266a2=_0x4266a2-0x0;var _0x2e5b45=_0x64ff[_0x4266a2];return _0x2e5b45;};'use strict';var EventEmitter=require(_0xf64f('0x0'));var DashboardItem=require(_0xf64f('0x1'))['db'][_0xf64f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf64f('0x3')](0x0);var events={'afterCreate':_0xf64f('0x4'),'afterUpdate':_0xf64f('0x5'),'afterDestroy':_0xf64f('0x6')};function emitEvent(_0x56228d){return function(_0x3ad83a,_0x4a1c6f,_0x13fbc6){DashboardItemEvents[_0xf64f('0x7')](_0x56228d+':'+_0x3ad83a['id'],_0x3ad83a);DashboardItemEvents[_0xf64f('0x7')](_0x56228d,_0x3ad83a);_0x13fbc6(null);};}for(var e in events){if(events[_0xf64f('0x8')](e)){var event=events[e];DashboardItem[_0xf64f('0x9')](e,emitEvent(event));}}module[_0xf64f('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c4ed540..58a16c5 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 _0x4385=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x2fbe94,_0x15281a){var _0x2f3338=function(_0x277f6e){while(--_0x277f6e){_0x2fbe94['push'](_0x2fbe94['shift']());}};_0x2f3338(++_0x15281a);}(_0x4385,0x168));var _0x5438=function(_0x47f958,_0x52b0f8){_0x47f958=_0x47f958-0x0;var _0x1e254e=_0x4385[_0x47f958];return _0x1e254e;};'use strict';var _=require(_0x5438('0x0'));var util=require(_0x5438('0x1'));var logger=require(_0x5438('0x2'))(_0x5438('0x3'));var moment=require('moment');var BPromise=require(_0x5438('0x4'));var rp=require(_0x5438('0x5'));var fs=require('fs');var path=require(_0x5438('0x6'));var rimraf=require(_0x5438('0x7'));var config=require(_0x5438('0x8'));var attributes=require(_0x5438('0x9'));module[_0x5438('0xa')]=function(_0x4ce1df,_0x46c7fa){return _0x4ce1df[_0x5438('0xb')](_0x5438('0xc'),attributes,{'tableName':_0x5438('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62dd=['exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4b6887,_0x96c4b7){var _0x2bf120=function(_0x9c70c){while(--_0x9c70c){_0x4b6887['push'](_0x4b6887['shift']());}};_0x2bf120(++_0x96c4b7);}(_0x62dd,0x6c));var _0xd62d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var logger=require(_0xd62d('0x2'))(_0xd62d('0x3'));var moment=require(_0xd62d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd62d('0x5'));var fs=require('fs');var path=require(_0xd62d('0x6'));var rimraf=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xd62d('0x9')]=function(_0x5326fa,_0x11adaf){return _0x5326fa[_0xd62d('0xa')](_0xd62d('0xb'),attributes,{'tableName':_0xd62d('0xc'),'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 da2215b..89f19f3 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 _0x31e4=['../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x31e4,0x187));var _0x431e=function(_0x3bfd9a,_0x5c5a47){_0x3bfd9a=_0x3bfd9a-0x0;var _0x34ae7c=_0x31e4[_0x3bfd9a];return _0x34ae7c;};'use strict';var _=require(_0x431e('0x0'));var util=require(_0x431e('0x1'));var moment=require(_0x431e('0x2'));var BPromise=require('bluebird');var rs=require(_0x431e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x431e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x431e('0x5'));var jayson=require(_0x431e('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x431e('0x7')]=_[_0x431e('0x8')](config['redis'],{'host':_0x431e('0x9'),'port':0x18eb});var socket=require(_0x431e('0xa'))(new Redis(config['redis']));require(_0x431e('0xb'))['register'](socket);function respondWithRpcPromise(_0x5de5e7,_0x4acdea,_0x36baac){return new BPromise(function(_0x5f16d3,_0xdd16e5){return client['request'](_0x5de5e7,_0x36baac)[_0x431e('0xc')](function(_0x462b87){logger[_0x431e('0xd')]('DashboardItem,\x20%s,\x20%s',_0x4acdea,_0x431e('0xe'));logger['debug'](_0x431e('0xf'),_0x4acdea,_0x431e('0xe'),JSON[_0x431e('0x10')](_0x462b87));if(_0x462b87[_0x431e('0x11')]){if(_0x462b87[_0x431e('0x11')][_0x431e('0x12')]===0x1f4){logger[_0x431e('0x11')](_0x431e('0x13'),_0x4acdea,_0x462b87[_0x431e('0x11')][_0x431e('0x14')]);return _0xdd16e5(_0x462b87[_0x431e('0x11')][_0x431e('0x14')]);}logger[_0x431e('0x11')](_0x431e('0x13'),_0x4acdea,_0x462b87[_0x431e('0x11')][_0x431e('0x14')]);return _0x5f16d3(_0x462b87[_0x431e('0x11')][_0x431e('0x14')]);}else{logger[_0x431e('0xd')]('DashboardItem,\x20%s,\x20%s',_0x4acdea,'request\x20sent');_0x5f16d3(_0x462b87['result'][_0x431e('0x14')]);}})[_0x431e('0x15')](function(_0x6bf557){logger['error'](_0x431e('0x13'),_0x4acdea,_0x6bf557);_0xdd16e5(_0x6bf557);});});} \ No newline at end of file +var _0x96ce=['socket.io-emitter','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x4b4eb5,_0xfa1419){var _0x12b8ad=function(_0x3e8dd5){while(--_0x3e8dd5){_0x4b4eb5['push'](_0x4b4eb5['shift']());}};_0x12b8ad(++_0xfa1419);}(_0x96ce,0x1a4));var _0xe96c=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x96ce[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0xe96c('0x0'));var util=require('util');var moment=require(_0xe96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe96c('0x2'));var fs=require('fs');var Redis=require(_0xe96c('0x3'));var db=require(_0xe96c('0x4'))['db'];var utils=require(_0xe96c('0x5'));var logger=require(_0xe96c('0x6'))(_0xe96c('0x7'));var config=require(_0xe96c('0x8'));var jayson=require(_0xe96c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe96c('0xa')]=_[_0xe96c('0xb')](config[_0xe96c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe96c('0xc'))(new Redis(config[_0xe96c('0xa')]));require(_0xe96c('0xd'))[_0xe96c('0xe')](socket);function respondWithRpcPromise(_0x1c6aff,_0x3b7b32,_0x38185e){return new BPromise(function(_0x51065c,_0x1dbd3c){return client['request'](_0x1c6aff,_0x38185e)[_0xe96c('0xf')](function(_0x56d19a){logger['info'](_0xe96c('0x10'),_0x3b7b32,'request\x20sent');logger[_0xe96c('0x11')](_0xe96c('0x12'),_0x3b7b32,'request\x20sent',JSON[_0xe96c('0x13')](_0x56d19a));if(_0x56d19a['error']){if(_0x56d19a[_0xe96c('0x14')]['code']===0x1f4){logger[_0xe96c('0x14')](_0xe96c('0x10'),_0x3b7b32,_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);return _0x1dbd3c(_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);}logger['error'](_0xe96c('0x10'),_0x3b7b32,_0x56d19a[_0xe96c('0x14')]['message']);return _0x51065c(_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);}else{logger['info'](_0xe96c('0x10'),_0x3b7b32,_0xe96c('0x16'));_0x51065c(_0x56d19a['result'][_0xe96c('0x15')]);}})[_0xe96c('0x17')](function(_0x230a25){logger['error'](_0xe96c('0x10'),_0x3b7b32,_0x230a25);_0x1dbd3c(_0x230a25);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index aea299a..2e02c16 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 _0x428a=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register','length'];(function(_0xf7f60a,_0x15f736){var _0x2567ad=function(_0x396850){while(--_0x396850){_0xf7f60a['push'](_0xf7f60a['shift']());}};_0x2567ad(++_0x15f736);}(_0x428a,0xb1));var _0xa428=function(_0x4d5795,_0x5dac3b){_0x4d5795=_0x4d5795-0x0;var _0x47ead9=_0x428a[_0x4d5795];return _0x47ead9;};'use strict';var DashboardItemEvents=require(_0xa428('0x0'));var events=[_0xa428('0x1'),_0xa428('0x2'),'update'];function createListener(_0x4d1bb2,_0x474d28){return function(_0x4d0b21){_0x474d28[_0xa428('0x3')](_0x4d1bb2,_0x4d0b21);};}function removeListener(_0x27e836,_0x5805fa){return function(){DashboardItemEvents[_0xa428('0x4')](_0x27e836,_0x5805fa);};}exports[_0xa428('0x5')]=function(_0x3608e0){for(var _0x3dca5b=0x0,_0x1af21e=events[_0xa428('0x6')];_0x3dca5b<_0x1af21e;_0x3dca5b++){var _0x428467=events[_0x3dca5b];var _0x579e82=createListener(_0xa428('0x7')+_0x428467,_0x3608e0);DashboardItemEvents['on'](_0x428467,_0x579e82);}}; \ No newline at end of file +var _0x7e3d=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x1dc708,_0x440805){var _0x8e7554=function(_0xa20f7){while(--_0xa20f7){_0x1dc708['push'](_0x1dc708['shift']());}};_0x8e7554(++_0x440805);}(_0x7e3d,0x1ab));var _0xd7e3=function(_0x22b64b,_0x5de02f){_0x22b64b=_0x22b64b-0x0;var _0x2b24de=_0x7e3d[_0x22b64b];return _0x2b24de;};'use strict';var DashboardItemEvents=require(_0xd7e3('0x0'));var events=[_0xd7e3('0x1'),_0xd7e3('0x2'),_0xd7e3('0x3')];function createListener(_0x48ed29,_0x3a1197){return function(_0x41b88f){_0x3a1197[_0xd7e3('0x4')](_0x48ed29,_0x41b88f);};}function removeListener(_0x2f5775,_0x4bc3bb){return function(){DashboardItemEvents[_0xd7e3('0x5')](_0x2f5775,_0x4bc3bb);};}exports[_0xd7e3('0x6')]=function(_0x4412fd){for(var _0x36b263=0x0,_0x311468=events[_0xd7e3('0x7')];_0x36b263<_0x311468;_0x36b263++){var _0x33c04f=events[_0x36b263];var _0x21b37b=createListener(_0xd7e3('0x8')+_0x33c04f,_0x4412fd);DashboardItemEvents['on'](_0x33c04f,_0x21b37b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 387a67b..8385375 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 _0x9d12=['post','create','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated'];(function(_0x2f490d,_0x14e67b){var _0x568817=function(_0x1f13b6){while(--_0x1f13b6){_0x2f490d['push'](_0x2f490d['shift']());}};_0x568817(++_0x14e67b);}(_0x9d12,0x122));var _0x29d1=function(_0x1f5102,_0x601f96){_0x1f5102=_0x1f5102-0x0;var _0x4f5545=_0x9d12[_0x1f5102];return _0x4f5545;};'use strict';var multer=require(_0x29d1('0x0'));var util=require(_0x29d1('0x1'));var path=require(_0x29d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x29d1('0x3'));var router=express['Router']();var fs_extra=require(_0x29d1('0x4'));var auth=require(_0x29d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29d1('0x6'));router[_0x29d1('0x7')](_0x29d1('0x8'),auth[_0x29d1('0x9')](),controller['show']);router[_0x29d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x29d1('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x29d1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x29d1('0xd')]);module[_0x29d1('0xe')]=router; \ No newline at end of file +var _0x8303=['../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x411f4a,_0x3a9c88){var _0x5a43ba=function(_0x22edd7){while(--_0x22edd7){_0x411f4a['push'](_0x411f4a['shift']());}};_0x5a43ba(++_0x3a9c88);}(_0x8303,0x160));var _0x3830=function(_0x10e44b,_0x4f791b){_0x10e44b=_0x10e44b-0x0;var _0x50e33d=_0x8303[_0x10e44b];return _0x50e33d;};'use strict';var multer=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var path=require(_0x3830('0x2'));var timeout=require(_0x3830('0x3'));var express=require(_0x3830('0x4'));var router=express['Router']();var fs_extra=require(_0x3830('0x5'));var auth=require(_0x3830('0x6'));var interaction=require(_0x3830('0x7'));var config=require(_0x3830('0x8'));var controller=require(_0x3830('0x9'));router[_0x3830('0xa')](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0xc')]);router[_0x3830('0xd')]('/',auth[_0x3830('0xe')](),controller[_0x3830('0xf')]);router[_0x3830('0x10')](_0x3830('0xb'),auth[_0x3830('0xe')](),controller[_0x3830('0x11')]);router['delete'](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0x12')]);module[_0x3830('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index beaf704..11b03de 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 _0x391e=['third','first','sequelize','STRING','ENUM','second'];(function(_0x23f58d,_0x22b11c){var _0x515d10=function(_0x18fe4a){while(--_0x18fe4a){_0x23f58d['push'](_0x23f58d['shift']());}};_0x515d10(++_0x22b11c);}(_0x391e,0x11c));var _0xe391=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x391e[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0xe391('0x0'));module['exports']={'name':{'type':Sequelize[_0xe391('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xe391('0x2')]('first',_0xe391('0x3'),_0xe391('0x4')),'allowNull':![],'defaultValue':_0xe391('0x5')},'description':{'type':Sequelize[_0xe391('0x1')]}}; \ No newline at end of file +var _0x7084=['first','second','third','STRING','exports'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7084,0xf4));var _0x4708=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x7084[_0x282320];return _0x271d54;};'use strict';var Sequelize=require('sequelize');module[_0x4708('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4708('0x1'),_0x4708('0x2'),_0x4708('0x3')),'allowNull':![],'defaultValue':_0x4708('0x1')},'description':{'type':Sequelize[_0x4708('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c4a6d37..1765f3e 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 _0x5ed3=['query','keys','filters','intersection','attributes','fields','limit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','rawAttributes','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','error','name','send','map','Disposition','fieldName','type','model'];(function(_0x382189,_0x4c38a9){var _0x36f350=function(_0x13e6a9){while(--_0x13e6a9){_0x382189['push'](_0x382189['shift']());}};_0x36f350(++_0x4c38a9);}(_0x5ed3,0x1f3));var _0x35ed=function(_0x12b458,_0x448876){_0x12b458=_0x12b458-0x0;var _0x39d99f=_0x5ed3[_0x12b458];return _0x39d99f;};'use strict';var emlformat=require(_0x35ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35ed('0x1'));var jsonpatch=require(_0x35ed('0x2'));var rp=require(_0x35ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x35ed('0x4'));var util=require(_0x35ed('0x5'));var path=require(_0x35ed('0x6'));var sox=require('sox');var csv=require(_0x35ed('0x7'));var ejs=require(_0x35ed('0x8'));var fs=require('fs');var fs_extra=require(_0x35ed('0x9'));var _=require(_0x35ed('0xa'));var squel=require('squel');var crypto=require(_0x35ed('0xb'));var jsforce=require(_0x35ed('0xc'));var deskjs=require(_0x35ed('0xd'));var toCsv=require(_0x35ed('0x7'));var querystring=require(_0x35ed('0xe'));var Papa=require(_0x35ed('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x35ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35ed('0x11'))(_0x35ed('0x12'));var utils=require(_0x35ed('0x13'));var config=require(_0x35ed('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x35ed('0x15'))['db'];function respondWithStatusCode(_0x7b2467,_0xd89531){_0xd89531=_0xd89531||0xcc;return function(_0x189ae6){if(_0x189ae6){return _0x7b2467[_0x35ed('0x16')](_0xd89531);}return _0x7b2467[_0x35ed('0x17')](_0xd89531)[_0x35ed('0x18')]();};}function respondWithResult(_0x4f3cec,_0x1d2da2){_0x1d2da2=_0x1d2da2||0xc8;return function(_0x4338a7){if(_0x4338a7){return _0x4f3cec[_0x35ed('0x17')](_0x1d2da2)[_0x35ed('0x19')](_0x4338a7);}};}function respondWithFilteredResult(_0x27f3ca,_0x6dd34e){return function(_0x5472d8){if(_0x5472d8){var _0x5a9505=typeof _0x6dd34e[_0x35ed('0x1a')]===_0x35ed('0x1b')&&typeof _0x6dd34e['limit']===_0x35ed('0x1b');var _0x1f43ec=_0x5472d8[_0x35ed('0x1c')];var _0x58405c=_0x5a9505?0x0:_0x6dd34e[_0x35ed('0x1a')];var _0x25f05b=_0x5a9505?_0x5472d8[_0x35ed('0x1c')]:_0x6dd34e[_0x35ed('0x1a')]+_0x6dd34e['limit'];var _0x5f4d09;if(_0x25f05b>=_0x1f43ec){_0x25f05b=_0x1f43ec;_0x5f4d09=0xc8;}else{_0x5f4d09=0xce;}_0x27f3ca['status'](_0x5f4d09);return _0x27f3ca[_0x35ed('0x1d')](_0x35ed('0x1e'),_0x58405c+'-'+_0x25f05b+'/'+_0x1f43ec)[_0x35ed('0x19')](_0x5472d8);}return null;};}function patchUpdates(_0x47bd4b){return function(_0x42fcf7){try{jsonpatch[_0x35ed('0x1f')](_0x42fcf7,_0x47bd4b,!![]);}catch(_0x5f4f2f){return BPromise[_0x35ed('0x20')](_0x5f4f2f);}return _0x42fcf7[_0x35ed('0x21')]();};}function saveUpdates(_0x520d13,_0x49bcab){return function(_0x234ffe){if(_0x234ffe){return _0x234ffe[_0x35ed('0x22')](_0x520d13)[_0x35ed('0x23')](function(_0x4f9001){return _0x4f9001;});}return null;};}function removeEntity(_0x3af8a2,_0x3fa61e){return function(_0x2c0a87){if(_0x2c0a87){return _0x2c0a87[_0x35ed('0x24')]()[_0x35ed('0x23')](function(){var _0x543305=_0x2c0a87[_0x35ed('0x25')]({'plain':!![]});var _0x5b71e6=_0x35ed('0x26');return db['UserProfileResource'][_0x35ed('0x24')]({'where':{'type':_0x5b71e6,'resourceId':_0x543305['id']}})[_0x35ed('0x23')](function(){return _0x2c0a87;});})[_0x35ed('0x23')](function(){_0x3af8a2[_0x35ed('0x17')](0xcc)[_0x35ed('0x18')]();});}};}function handleEntityNotFound(_0x499b99,_0x2ee501){return function(_0x446e70){if(!_0x446e70){_0x499b99[_0x35ed('0x16')](0x194);}return _0x446e70;};}function handleError(_0x497593,_0x11c65e){_0x11c65e=_0x11c65e||0x1f4;return function(_0x4d0d8e){logger[_0x35ed('0x27')](_0x4d0d8e['stack']);if(_0x4d0d8e[_0x35ed('0x28')]){delete _0x4d0d8e[_0x35ed('0x28')];}_0x497593['status'](_0x11c65e)[_0x35ed('0x29')](_0x4d0d8e);};}exports['index']=function(_0x1a9a3e,_0x277aad){var _0x3f7f06={},_0x58c04e={},_0x431280={'count':0x0,'rows':[]};var _0x2e15ac=_[_0x35ed('0x2a')](db[_0x35ed('0x2b')]['rawAttributes'],function(_0x3fd1b0){return{'name':_0x3fd1b0[_0x35ed('0x2c')],'type':_0x3fd1b0[_0x35ed('0x2d')]['key']};});_0x58c04e[_0x35ed('0x2e')]=_[_0x35ed('0x2a')](_0x2e15ac,_0x35ed('0x28'));_0x58c04e[_0x35ed('0x2f')]=_[_0x35ed('0x30')](_0x1a9a3e[_0x35ed('0x2f')]);_0x58c04e[_0x35ed('0x31')]=_[_0x35ed('0x32')](_0x58c04e[_0x35ed('0x2e')],_0x58c04e[_0x35ed('0x2f')]);_0x3f7f06[_0x35ed('0x33')]=_['intersection'](_0x58c04e[_0x35ed('0x2e')],qs[_0x35ed('0x34')](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x34')]));_0x3f7f06[_0x35ed('0x33')]=_0x3f7f06[_0x35ed('0x33')]['length']?_0x3f7f06[_0x35ed('0x33')]:_0x58c04e[_0x35ed('0x2e')];if(!_0x1a9a3e['query']['hasOwnProperty']('nolimit')){_0x3f7f06[_0x35ed('0x35')]=qs[_0x35ed('0x35')](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x35')]);_0x3f7f06[_0x35ed('0x1a')]=qs['offset'](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x1a')]);}_0x3f7f06['order']=qs['sort'](_0x1a9a3e[_0x35ed('0x2f')][_0x35ed('0x36')]);_0x3f7f06[_0x35ed('0x37')]=qs[_0x35ed('0x31')](_[_0x35ed('0x38')](_0x1a9a3e[_0x35ed('0x2f')],_0x58c04e[_0x35ed('0x31')]),_0x2e15ac);if(_0x1a9a3e[_0x35ed('0x2f')]['filter']){_0x3f7f06['where']=_[_0x35ed('0x39')](_0x3f7f06['where'],{'$or':_[_0x35ed('0x2a')](_0x2e15ac,function(_0x239e23){if(_0x239e23[_0x35ed('0x2d')]!==_0x35ed('0x3a')){var _0x1f682a={};_0x1f682a[_0x239e23[_0x35ed('0x28')]]={'$like':'%'+_0x1a9a3e['query'][_0x35ed('0x3b')]+'%'};return _0x1f682a;}})});}_0x3f7f06=_[_0x35ed('0x39')]({},_0x3f7f06,_0x1a9a3e[_0x35ed('0x3c')]);var _0x59302f={'where':_0x3f7f06['where']};return db['Disposition'][_0x35ed('0x1c')](_0x59302f)[_0x35ed('0x23')](function(_0x3dda0a){_0x431280[_0x35ed('0x1c')]=_0x3dda0a;if(_0x1a9a3e['query']['includeAll']){_0x3f7f06['include']=[{'all':!![]}];}return db[_0x35ed('0x2b')][_0x35ed('0x3d')](_0x3f7f06);})[_0x35ed('0x23')](function(_0x25a67b){_0x431280[_0x35ed('0x3e')]=_0x25a67b;return _0x431280;})[_0x35ed('0x23')](respondWithFilteredResult(_0x277aad,_0x3f7f06))[_0x35ed('0x3f')](handleError(_0x277aad,null));};exports['show']=function(_0x2168bf,_0xec327e){var _0x556700={'raw':!![],'where':{'id':_0x2168bf['params']['id']}},_0x20e5aa={};_0x20e5aa[_0x35ed('0x2e')]=_[_0x35ed('0x30')](db['Disposition'][_0x35ed('0x40')]);_0x20e5aa[_0x35ed('0x2f')]=_[_0x35ed('0x30')](_0x2168bf[_0x35ed('0x2f')]);_0x20e5aa[_0x35ed('0x31')]=_[_0x35ed('0x32')](_0x20e5aa['model'],_0x20e5aa[_0x35ed('0x2f')]);_0x556700[_0x35ed('0x33')]=_[_0x35ed('0x32')](_0x20e5aa[_0x35ed('0x2e')],qs[_0x35ed('0x34')](_0x2168bf['query'][_0x35ed('0x34')]));_0x556700[_0x35ed('0x33')]=_0x556700[_0x35ed('0x33')][_0x35ed('0x41')]?_0x556700[_0x35ed('0x33')]:_0x20e5aa['model'];if(_0x2168bf['query'][_0x35ed('0x42')]){_0x556700[_0x35ed('0x43')]=[{'all':!![]}];}_0x556700=_[_0x35ed('0x39')]({},_0x556700,_0x2168bf[_0x35ed('0x3c')]);return db['Disposition'][_0x35ed('0x44')](_0x556700)['then'](handleEntityNotFound(_0xec327e,null))['then'](respondWithResult(_0xec327e,null))[_0x35ed('0x3f')](handleError(_0xec327e,null));};exports[_0x35ed('0x45')]=function(_0xaffa79,_0x5adde1){return db[_0x35ed('0x2b')]['create'](_0xaffa79[_0x35ed('0x46')],{})[_0x35ed('0x23')](function(_0x13eda6){var _0x6f369f=_0xaffa79[_0x35ed('0x47')][_0x35ed('0x25')]({'plain':!![]});if(!_0x6f369f)throw new Error(_0x35ed('0x48'));if(_0x6f369f['role']===_0x35ed('0x47')){var _0x4afce4=_0x13eda6[_0x35ed('0x25')]({'plain':!![]});var _0x529631=_0x35ed('0x26');return db[_0x35ed('0x49')][_0x35ed('0x44')]({'where':{'name':_0x529631,'userProfileId':_0x6f369f[_0x35ed('0x4a')]},'raw':!![]})[_0x35ed('0x23')](function(_0x32a9fb){if(_0x32a9fb&&_0x32a9fb['autoAssociation']===0x0){return db[_0x35ed('0x4b')][_0x35ed('0x45')]({'name':_0x4afce4[_0x35ed('0x28')],'resourceId':_0x4afce4['id'],'type':_0x32a9fb[_0x35ed('0x28')],'sectionId':_0x32a9fb['id']},{})[_0x35ed('0x23')](function(){return _0x13eda6;});}else{return _0x13eda6;}})['catch'](function(_0x5c5595){logger[_0x35ed('0x27')](_0x35ed('0x4c'),_0x5c5595);throw _0x5c5595;});}return _0x13eda6;})[_0x35ed('0x23')](respondWithResult(_0x5adde1,0xc9))[_0x35ed('0x3f')](handleError(_0x5adde1,null));};exports[_0x35ed('0x22')]=function(_0x3b4c33,_0x53f9f4){if(_0x3b4c33[_0x35ed('0x46')]['id']){delete _0x3b4c33['body']['id'];}return db[_0x35ed('0x2b')][_0x35ed('0x44')]({'where':{'id':_0x3b4c33[_0x35ed('0x4d')]['id']}})[_0x35ed('0x23')](handleEntityNotFound(_0x53f9f4,null))['then'](saveUpdates(_0x3b4c33[_0x35ed('0x46')],null))[_0x35ed('0x23')](respondWithResult(_0x53f9f4,null))[_0x35ed('0x3f')](handleError(_0x53f9f4,null));};exports['destroy']=function(_0x7aeed4,_0x3e69e1){return db[_0x35ed('0x2b')][_0x35ed('0x44')]({'where':{'id':_0x7aeed4[_0x35ed('0x4d')]['id']}})[_0x35ed('0x23')](handleEntityNotFound(_0x3e69e1,null))['then'](removeEntity(_0x3e69e1,null))['catch'](handleError(_0x3e69e1,null));}; \ No newline at end of file +var _0x2cd3=['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','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','body','role','user','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x2d5934,_0x1acc4f){var _0x5807c8=function(_0x326cc5){while(--_0x326cc5){_0x2d5934['push'](_0x2d5934['shift']());}};_0x5807c8(++_0x1acc4f);}(_0x2cd3,0xf1));var _0x32cd=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x2cd3[_0x1e2321];return _0x1d346d;};'use strict';var emlformat=require(_0x32cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32cd('0x1'));var jsonpatch=require(_0x32cd('0x2'));var rp=require(_0x32cd('0x3'));var moment=require(_0x32cd('0x4'));var BPromise=require(_0x32cd('0x5'));var Mustache=require(_0x32cd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x32cd('0x7'));var csv=require(_0x32cd('0x8'));var ejs=require(_0x32cd('0x9'));var fs=require('fs');var fs_extra=require(_0x32cd('0xa'));var _=require(_0x32cd('0xb'));var squel=require(_0x32cd('0xc'));var crypto=require(_0x32cd('0xd'));var jsforce=require(_0x32cd('0xe'));var deskjs=require(_0x32cd('0xf'));var toCsv=require(_0x32cd('0x8'));var querystring=require(_0x32cd('0x10'));var Papa=require(_0x32cd('0x11'));var Redis=require(_0x32cd('0x12'));var authService=require(_0x32cd('0x13'));var qs=require(_0x32cd('0x14'));var as=require(_0x32cd('0x15'));var hardwareService=require(_0x32cd('0x16'));var logger=require(_0x32cd('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x32cd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27db2b,_0x4610ed){_0x4610ed=_0x4610ed||0xcc;return function(_0x459f80){if(_0x459f80){return _0x27db2b[_0x32cd('0x19')](_0x4610ed);}return _0x27db2b[_0x32cd('0x1a')](_0x4610ed)[_0x32cd('0x1b')]();};}function respondWithResult(_0x3ce589,_0x542a02){_0x542a02=_0x542a02||0xc8;return function(_0x51b452){if(_0x51b452){return _0x3ce589[_0x32cd('0x1a')](_0x542a02)[_0x32cd('0x1c')](_0x51b452);}};}function respondWithFilteredResult(_0x149448,_0x440984){return function(_0x4a14b5){if(_0x4a14b5){var _0x3a542b=typeof _0x440984['offset']==='undefined'&&typeof _0x440984[_0x32cd('0x1d')]===_0x32cd('0x1e');var _0x3f9c9c=_0x4a14b5[_0x32cd('0x1f')];var _0x4690c9=_0x3a542b?0x0:_0x440984[_0x32cd('0x20')];var _0x4bfabf=_0x3a542b?_0x4a14b5[_0x32cd('0x1f')]:_0x440984[_0x32cd('0x20')]+_0x440984[_0x32cd('0x1d')];var _0x5d36c9;if(_0x4bfabf>=_0x3f9c9c){_0x4bfabf=_0x3f9c9c;_0x5d36c9=0xc8;}else{_0x5d36c9=0xce;}_0x149448['status'](_0x5d36c9);return _0x149448[_0x32cd('0x21')](_0x32cd('0x22'),_0x4690c9+'-'+_0x4bfabf+'/'+_0x3f9c9c)[_0x32cd('0x1c')](_0x4a14b5);}return null;};}function patchUpdates(_0x19ab29){return function(_0x14b3fe){try{jsonpatch['apply'](_0x14b3fe,_0x19ab29,!![]);}catch(_0x4311cb){return BPromise[_0x32cd('0x23')](_0x4311cb);}return _0x14b3fe[_0x32cd('0x24')]();};}function saveUpdates(_0x1a50a6,_0x3bc9c8){return function(_0x192b1d){if(_0x192b1d){return _0x192b1d[_0x32cd('0x25')](_0x1a50a6)[_0x32cd('0x26')](function(_0x575f97){return _0x575f97;});}return null;};}function removeEntity(_0x3eb73c,_0x5ddfaa){return function(_0x4c7f55){if(_0x4c7f55){return _0x4c7f55[_0x32cd('0x27')]()['then'](function(){var _0x5c0dc1=_0x4c7f55[_0x32cd('0x28')]({'plain':!![]});var _0x57782c='Dispositions';return db['UserProfileResource'][_0x32cd('0x27')]({'where':{'type':_0x57782c,'resourceId':_0x5c0dc1['id']}})[_0x32cd('0x26')](function(){return _0x4c7f55;});})[_0x32cd('0x26')](function(){_0x3eb73c[_0x32cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a5c8,_0x4b9ee1){return function(_0x321d71){if(!_0x321d71){_0x58a5c8[_0x32cd('0x19')](0x194);}return _0x321d71;};}function handleError(_0x5ef889,_0x39fd04){_0x39fd04=_0x39fd04||0x1f4;return function(_0x35f798){logger[_0x32cd('0x29')](_0x35f798[_0x32cd('0x2a')]);if(_0x35f798[_0x32cd('0x2b')]){delete _0x35f798[_0x32cd('0x2b')];}_0x5ef889['status'](_0x39fd04)[_0x32cd('0x2c')](_0x35f798);};}exports[_0x32cd('0x2d')]=function(_0x9d4aaa,_0x20365c){var _0x387f2a={},_0x1232f1={},_0x5053ff={'count':0x0,'rows':[]};var _0x576cb2=_[_0x32cd('0x2e')](db[_0x32cd('0x2f')][_0x32cd('0x30')],function(_0x42385a){return{'name':_0x42385a[_0x32cd('0x31')],'type':_0x42385a['type'][_0x32cd('0x32')]};});_0x1232f1[_0x32cd('0x33')]=_['map'](_0x576cb2,_0x32cd('0x2b'));_0x1232f1[_0x32cd('0x34')]=_[_0x32cd('0x35')](_0x9d4aaa[_0x32cd('0x34')]);_0x1232f1[_0x32cd('0x36')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],_0x1232f1[_0x32cd('0x34')]);_0x387f2a[_0x32cd('0x38')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x9d4aaa[_0x32cd('0x34')]['fields']));_0x387f2a[_0x32cd('0x38')]=_0x387f2a[_0x32cd('0x38')][_0x32cd('0x3a')]?_0x387f2a[_0x32cd('0x38')]:_0x1232f1['model'];if(!_0x9d4aaa['query'][_0x32cd('0x3b')](_0x32cd('0x3c'))){_0x387f2a[_0x32cd('0x1d')]=qs['limit'](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x1d')]);_0x387f2a[_0x32cd('0x20')]=qs[_0x32cd('0x20')](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x20')]);}_0x387f2a[_0x32cd('0x3d')]=qs[_0x32cd('0x3e')](_0x9d4aaa[_0x32cd('0x34')]['sort']);_0x387f2a[_0x32cd('0x3f')]=qs['filters'](_[_0x32cd('0x40')](_0x9d4aaa[_0x32cd('0x34')],_0x1232f1[_0x32cd('0x36')]),_0x576cb2);if(_0x9d4aaa[_0x32cd('0x34')]['filter']){_0x387f2a[_0x32cd('0x3f')]=_[_0x32cd('0x41')](_0x387f2a[_0x32cd('0x3f')],{'$or':_[_0x32cd('0x2e')](_0x576cb2,function(_0x3a06e5){if(_0x3a06e5[_0x32cd('0x42')]!==_0x32cd('0x43')){var _0x7c62e0={};_0x7c62e0[_0x3a06e5[_0x32cd('0x2b')]]={'$like':'%'+_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x44')]+'%'};return _0x7c62e0;}})});}_0x387f2a=_[_0x32cd('0x41')]({},_0x387f2a,_0x9d4aaa[_0x32cd('0x45')]);var _0xdf4d2={'where':_0x387f2a[_0x32cd('0x3f')]};return db[_0x32cd('0x2f')][_0x32cd('0x1f')](_0xdf4d2)['then'](function(_0x285a48){_0x5053ff[_0x32cd('0x1f')]=_0x285a48;if(_0x9d4aaa['query'][_0x32cd('0x46')]){_0x387f2a[_0x32cd('0x47')]=[{'all':!![]}];}return db[_0x32cd('0x2f')]['findAll'](_0x387f2a);})['then'](function(_0x469fa2){_0x5053ff[_0x32cd('0x48')]=_0x469fa2;return _0x5053ff;})[_0x32cd('0x26')](respondWithFilteredResult(_0x20365c,_0x387f2a))[_0x32cd('0x49')](handleError(_0x20365c,null));};exports['show']=function(_0x2f1acd,_0x3c34b9){var _0x2f4eec={'raw':!![],'where':{'id':_0x2f1acd[_0x32cd('0x4a')]['id']}},_0x1d4f10={};_0x1d4f10[_0x32cd('0x33')]=_[_0x32cd('0x35')](db['Disposition'][_0x32cd('0x30')]);_0x1d4f10[_0x32cd('0x34')]=_['keys'](_0x2f1acd[_0x32cd('0x34')]);_0x1d4f10[_0x32cd('0x36')]=_['intersection'](_0x1d4f10[_0x32cd('0x33')],_0x1d4f10[_0x32cd('0x34')]);_0x2f4eec['attributes']=_[_0x32cd('0x37')](_0x1d4f10[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x2f1acd['query'][_0x32cd('0x39')]));_0x2f4eec[_0x32cd('0x38')]=_0x2f4eec[_0x32cd('0x38')]['length']?_0x2f4eec[_0x32cd('0x38')]:_0x1d4f10[_0x32cd('0x33')];if(_0x2f1acd[_0x32cd('0x34')][_0x32cd('0x46')]){_0x2f4eec[_0x32cd('0x47')]=[{'all':!![]}];}_0x2f4eec=_[_0x32cd('0x41')]({},_0x2f4eec,_0x2f1acd[_0x32cd('0x45')]);return db['Disposition'][_0x32cd('0x4b')](_0x2f4eec)['then'](handleEntityNotFound(_0x3c34b9,null))[_0x32cd('0x26')](respondWithResult(_0x3c34b9,null))[_0x32cd('0x49')](handleError(_0x3c34b9,null));};exports['create']=function(_0x88b34b,_0x27aabc){return db[_0x32cd('0x2f')][_0x32cd('0x4c')](_0x88b34b[_0x32cd('0x4d')],{})[_0x32cd('0x26')](function(_0x3360cb){var _0xa145df=_0x88b34b['user'][_0x32cd('0x28')]({'plain':!![]});if(!_0xa145df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa145df[_0x32cd('0x4e')]===_0x32cd('0x4f')){var _0x45f485=_0x3360cb[_0x32cd('0x28')]({'plain':!![]});var _0x31f5db=_0x32cd('0x50');return db[_0x32cd('0x51')][_0x32cd('0x4b')]({'where':{'name':_0x31f5db,'userProfileId':_0xa145df['userProfileId']},'raw':!![]})[_0x32cd('0x26')](function(_0xd5f7d9){if(_0xd5f7d9&&_0xd5f7d9[_0x32cd('0x52')]===0x0){return db['UserProfileResource'][_0x32cd('0x4c')]({'name':_0x45f485[_0x32cd('0x2b')],'resourceId':_0x45f485['id'],'type':_0xd5f7d9[_0x32cd('0x2b')],'sectionId':_0xd5f7d9['id']},{})['then'](function(){return _0x3360cb;});}else{return _0x3360cb;}})['catch'](function(_0x300baf){logger['error'](_0x32cd('0x53'),_0x300baf);throw _0x300baf;});}return _0x3360cb;})[_0x32cd('0x26')](respondWithResult(_0x27aabc,0xc9))['catch'](handleError(_0x27aabc,null));};exports['update']=function(_0x4a036f,_0x1c7b25){if(_0x4a036f['body']['id']){delete _0x4a036f['body']['id'];}return db[_0x32cd('0x2f')][_0x32cd('0x4b')]({'where':{'id':_0x4a036f[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x1c7b25,null))[_0x32cd('0x26')](saveUpdates(_0x4a036f[_0x32cd('0x4d')],null))[_0x32cd('0x26')](respondWithResult(_0x1c7b25,null))[_0x32cd('0x49')](handleError(_0x1c7b25,null));};exports['destroy']=function(_0x4d217e,_0x3bccbf){return db[_0x32cd('0x2f')]['find']({'where':{'id':_0x4d217e[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x3bccbf,null))['then'](removeEntity(_0x3bccbf,null))[_0x32cd('0x49')](handleError(_0x3bccbf,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e5ed5d9..c1f3861 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 _0x83cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_whatsapp','util','../../config/logger','api'];(function(_0x24106b,_0x4bdfcf){var _0x84419a=function(_0x1a29ec){while(--_0x1a29ec){_0x24106b['push'](_0x24106b['shift']());}};_0x84419a(++_0x4bdfcf);}(_0x83cc,0x19b));var _0xc83c=function(_0x3e2e82,_0x369bbe){_0x3e2e82=_0x3e2e82-0x0;var _0xba15aa=_0x83cc[_0x3e2e82];return _0xba15aa;};'use strict';var _=require('lodash');var util=require(_0xc83c('0x0'));var logger=require(_0xc83c('0x1'))(_0xc83c('0x2'));var moment=require(_0xc83c('0x3'));var BPromise=require(_0xc83c('0x4'));var rp=require(_0xc83c('0x5'));var fs=require('fs');var path=require(_0xc83c('0x6'));var rimraf=require(_0xc83c('0x7'));var config=require(_0xc83c('0x8'));var attributes=require('./disposition.attributes');module['exports']=function(_0x1bb8ba,_0x3adaf6){return _0x1bb8ba[_0xc83c('0x9')](_0xc83c('0xa'),attributes,{'tableName':_0xc83c('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc83c('0xc'),'fields':[_0xc83c('0xd'),'ListId']},{'unique':!![],'name':_0xc83c('0xe'),'fields':[_0xc83c('0xd'),_0xc83c('0xf')]},{'unique':!![],'name':_0xc83c('0x10'),'fields':[_0xc83c('0xd'),_0xc83c('0x11')]},{'unique':!![],'name':_0xc83c('0x12'),'fields':[_0xc83c('0xd'),_0xc83c('0x13')]},{'unique':!![],'name':_0xc83c('0x14'),'fields':['name',_0xc83c('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xc83c('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0xc83c('0x16'),'fields':[_0xc83c('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3e6=['name','ListId','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','Disposition','tools_dispositions','name_voice'];(function(_0x4d7ebe,_0xa00e2c){var _0x42e7f2=function(_0x3ca2d7){while(--_0x3ca2d7){_0x4d7ebe['push'](_0x4d7ebe['shift']());}};_0x42e7f2(++_0xa00e2c);}(_0xb3e6,0x73));var _0x6b3e=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xb3e6[_0x541a67];return _0x45da2a;};'use strict';var _=require('lodash');var util=require(_0x6b3e('0x0'));var logger=require(_0x6b3e('0x1'))(_0x6b3e('0x2'));var moment=require(_0x6b3e('0x3'));var BPromise=require(_0x6b3e('0x4'));var rp=require(_0x6b3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b3e('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x6b3e('0x7')]=function(_0x4137e5,_0x4f7403){return _0x4137e5['define'](_0x6b3e('0x8'),attributes,{'tableName':_0x6b3e('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6b3e('0xa'),'fields':[_0x6b3e('0xb'),_0x6b3e('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x6b3e('0xb'),_0x6b3e('0xd')]},{'unique':!![],'name':_0x6b3e('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x6b3e('0xb'),_0x6b3e('0xf')]},{'unique':!![],'name':_0x6b3e('0x10'),'fields':[_0x6b3e('0xb'),_0x6b3e('0x11')]},{'unique':!![],'name':_0x6b3e('0x12'),'fields':[_0x6b3e('0xb'),_0x6b3e('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x6b3e('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4dda37a..52d6a73 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(_0x58fc28,_0xa9d9e1){var _0x51f05c=function(_0x2fc252){while(--_0x2fc252){_0x58fc28['push'](_0x58fc28['shift']());}};_0x51f05c(++_0xa9d9e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _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(_0x2b93ce,_0x3d5674){var _0x12ac85=function(_0x36c51f){while(--_0x36c51f){_0x2b93ce['push'](_0x2b93ce['shift']());}};_0x12ac85(++_0x3d5674);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 15aba43..62c3db4 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 _0x13cd=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x13cd,0x163));var _0xd13c=function(_0x92a64c,_0x222d02){_0x92a64c=_0x92a64c-0x0;var _0x4ca556=_0x13cd[_0x92a64c];return _0x4ca556;};'use strict';var multer=require(_0xd13c('0x0'));var util=require(_0xd13c('0x1'));var path=require(_0xd13c('0x2'));var timeout=require(_0xd13c('0x3'));var express=require(_0xd13c('0x4'));var router=express[_0xd13c('0x5')]();var fs_extra=require(_0xd13c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd13c('0x7'));var config=require(_0xd13c('0x8'));var controller=require('./disposition.controller');router[_0xd13c('0x9')]('/',auth[_0xd13c('0xa')](),controller[_0xd13c('0xb')]);router[_0xd13c('0x9')](_0xd13c('0xc'),auth[_0xd13c('0xa')](),controller[_0xd13c('0xd')]);router[_0xd13c('0xe')]('/',auth['isAuthenticated'](),controller[_0xd13c('0xf')]);router['put'](_0xd13c('0xc'),auth['isAuthenticated'](),controller[_0xd13c('0x10')]);router[_0xd13c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd13c('0x12')]);module[_0xd13c('0x13')]=router; \ No newline at end of file +var _0x6cbe=['post','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6cbe,0x1aa));var _0xe6cb=function(_0x6fdef4,_0x8e3c05){_0x6fdef4=_0x6fdef4-0x0;var _0x478dda=_0x6cbe[_0x6fdef4];return _0x478dda;};'use strict';var multer=require(_0xe6cb('0x0'));var util=require('util');var path=require(_0xe6cb('0x1'));var timeout=require(_0xe6cb('0x2'));var express=require(_0xe6cb('0x3'));var router=express[_0xe6cb('0x4')]();var fs_extra=require(_0xe6cb('0x5'));var auth=require(_0xe6cb('0x6'));var interaction=require(_0xe6cb('0x7'));var config=require(_0xe6cb('0x8'));var controller=require(_0xe6cb('0x9'));router['get']('/',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xb')]);router[_0xe6cb('0xc')]('/:id',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xd')]);router[_0xe6cb('0xe')]('/',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xf')]);router[_0xe6cb('0x10')](_0xe6cb('0x11'),auth['isAuthenticated'](),controller[_0xe6cb('0x12')]);router['delete'](_0xe6cb('0x11'),auth['isAuthenticated'](),controller[_0xe6cb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dbf2c18..bfd7031 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 _0x24ae=['v17,v27,v29','INTEGER','SIP','IAX','DADHI','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','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x24ae,0xbc));var _0xe24a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x24ae[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require('sequelize');module[_0xe24a('0x0')]={'name':{'type':Sequelize[_0xe24a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe24a('0x1')]},'ecm':{'type':Sequelize[_0xe24a('0x2')](_0xe24a('0x3'),'no'),'defaultValue':_0xe24a('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xe24a('0x4')},'localstationid':{'type':Sequelize[_0xe24a('0x1')],'unique':_0xe24a('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xe24a('0x6'),_0xe24a('0x7'),_0xe24a('0x8'),_0xe24a('0x9'),_0xe24a('0xa'),_0xe24a('0xb')),'defaultValue':_0xe24a('0x7')},'maxrate':{'type':Sequelize[_0xe24a('0x2')]('2400','4800',_0xe24a('0x8'),_0xe24a('0x9'),_0xe24a('0xa'),_0xe24a('0xb')),'defaultValue':_0xe24a('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xe24a('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe24a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe24a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe24a('0x2')](_0xe24a('0xe'),_0xe24a('0xf'),_0xe24a('0x10'),_0xe24a('0x11')),'defaultValue':_0xe24a('0xe')},'key':{'type':Sequelize[_0xe24a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe24a('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe24a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe24a('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe24a('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xe24a('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xe24a('0x13')],'defaultValue':![],'comment':_0xe24a('0x15'),'set':function(_0x186e2f){if(!_0x186e2f)this[_0xe24a('0x16')](_0xe24a('0x17'),null);this[_0xe24a('0x16')](_0xe24a('0x18'),_0x186e2f);}}}; \ No newline at end of file +var _0xc0fc=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','BOOLEAN'];(function(_0x1868c7,_0x25f9a6){var _0x2c84eb=function(_0x3c1329){while(--_0x3c1329){_0x1868c7['push'](_0x1868c7['shift']());}};_0x2c84eb(++_0x25f9a6);}(_0xc0fc,0x146));var _0xcc0f=function(_0x2fa2ad,_0x103fe0){_0x2fa2ad=_0x2fa2ad-0x0;var _0x120c95=_0xc0fc[_0x2fa2ad];return _0x120c95;};'use strict';var Sequelize=require('sequelize');module[_0xcc0f('0x0')]={'name':{'type':Sequelize[_0xcc0f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc0f('0x1')]},'ecm':{'type':Sequelize[_0xcc0f('0x2')](_0xcc0f('0x3'),'no'),'defaultValue':_0xcc0f('0x3')},'headerinfo':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':_0xcc0f('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xcc0f('0x5')},'minrate':{'type':Sequelize[_0xcc0f('0x2')]('2400',_0xcc0f('0x6'),_0xcc0f('0x7'),_0xcc0f('0x8'),_0xcc0f('0x9'),_0xcc0f('0xa')),'defaultValue':_0xcc0f('0x6')},'maxrate':{'type':Sequelize[_0xcc0f('0x2')](_0xcc0f('0xb'),_0xcc0f('0x6'),_0xcc0f('0x7'),_0xcc0f('0x8'),_0xcc0f('0x9'),'14400'),'defaultValue':_0xcc0f('0xa')},'modem':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':_0xcc0f('0xc')},'gateway':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcc0f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xcc0f('0x2')]('SIP',_0xcc0f('0xe'),_0xcc0f('0xf'),_0xcc0f('0x10')),'defaultValue':_0xcc0f('0x11')},'key':{'type':Sequelize[_0xcc0f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcc0f('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xcc0f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![],'comment':_0xcc0f('0x14'),'set':function(_0x23f239){if(!_0x23f239)this[_0xcc0f('0x15')]('mandatoryDispositionPauseId',null);this[_0xcc0f('0x15')](_0xcc0f('0x16'),_0x23f239);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9b8d753..40cf095 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 _0xfbc8=['error','message','result','catch','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','name','send','index','Pause','map','FaxAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','rawAttributes','keys','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','order','findAll','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','ecm','gateway','maxrate','modem','t38timeout','push','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','omit','tech','key','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x29cb9b,_0x247dd1){var _0x544ff3=function(_0x5919b2){while(--_0x5919b2){_0x29cb9b['push'](_0x29cb9b['shift']());}};_0x544ff3(++_0x247dd1);}(_0xfbc8,0x9a));var _0x8fbc=function(_0x52b62b,_0x1100cd){_0x52b62b=_0x52b62b-0x0;var _0x3d14d0=_0xfbc8[_0x52b62b];return _0x3d14d0;};'use strict';var emlformat=require(_0x8fbc('0x0'));var rimraf=require(_0x8fbc('0x1'));var zipdir=require(_0x8fbc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8fbc('0x3'));var BPromise=require(_0x8fbc('0x4'));var Mustache=require(_0x8fbc('0x5'));var util=require(_0x8fbc('0x6'));var path=require(_0x8fbc('0x7'));var sox=require(_0x8fbc('0x8'));var csv=require('to-csv');var ejs=require(_0x8fbc('0x9'));var fs=require('fs');var fs_extra=require(_0x8fbc('0xa'));var _=require(_0x8fbc('0xb'));var squel=require(_0x8fbc('0xc'));var crypto=require(_0x8fbc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8fbc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8fbc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8fbc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fbc('0x11'));var logger=require(_0x8fbc('0x12'))(_0x8fbc('0x13'));var utils=require(_0x8fbc('0x14'));var config=require(_0x8fbc('0x15'));var licenseUtil=require(_0x8fbc('0x16'));var db=require(_0x8fbc('0x17'))['db'];config[_0x8fbc('0x18')]=_[_0x8fbc('0x19')](config[_0x8fbc('0x18')],{'host':_0x8fbc('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8fbc('0x18')]));require(_0x8fbc('0x1b'))['register'](socket);var jayson=require(_0x8fbc('0x1c'));var client=jayson[_0x8fbc('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x8fbc('0x1d')][_0x8fbc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x461b4b,_0x518a9e,_0x54b8dd,_0x427972){return new BPromise(function(_0x3b97cb,_0x15cbeb){var _0x2d435c=_0x427972||client;return _0x2d435c[_0x8fbc('0x1f')](_0x461b4b,_0x54b8dd)[_0x8fbc('0x20')](function(_0x5c7879){logger[_0x8fbc('0x21')](_0x8fbc('0x22'),_0x518a9e,_0x8fbc('0x23'));logger[_0x8fbc('0x24')](_0x8fbc('0x25'),_0x518a9e,_0x8fbc('0x23'),JSON[_0x8fbc('0x26')](_0x5c7879));if(_0x5c7879[_0x8fbc('0x27')]){if(_0x5c7879[_0x8fbc('0x27')]['code']===0x1f4){logger[_0x8fbc('0x27')](_0x8fbc('0x22'),_0x518a9e,_0x5c7879['error'][_0x8fbc('0x28')]);return _0x15cbeb(_0x5c7879[_0x8fbc('0x27')][_0x8fbc('0x28')]);}logger[_0x8fbc('0x27')](_0x8fbc('0x22'),_0x518a9e,_0x5c7879['error'][_0x8fbc('0x28')]);return _0x3b97cb(_0x5c7879['error'][_0x8fbc('0x28')]);}else{logger[_0x8fbc('0x21')](_0x8fbc('0x22'),_0x518a9e,_0x8fbc('0x23'));_0x3b97cb(_0x5c7879[_0x8fbc('0x29')][_0x8fbc('0x28')]);}})[_0x8fbc('0x2a')](function(_0x76bcc2){logger[_0x8fbc('0x27')](_0x8fbc('0x22'),_0x518a9e,_0x76bcc2);_0x15cbeb(_0x76bcc2);});});}function respondWithStatusCode(_0x1c6fc4,_0x105b09){_0x105b09=_0x105b09||0xcc;return function(_0x504c76){if(_0x504c76){return _0x1c6fc4[_0x8fbc('0x2b')](_0x105b09);}return _0x1c6fc4['status'](_0x105b09)[_0x8fbc('0x2c')]();};}function respondWithResult(_0x199256,_0x2905d7){_0x2905d7=_0x2905d7||0xc8;return function(_0x514603){if(_0x514603){return _0x199256[_0x8fbc('0x2d')](_0x2905d7)[_0x8fbc('0x2e')](_0x514603);}};}function respondWithFilteredResult(_0x2ca16e,_0x252371){return function(_0x3cb963){if(_0x3cb963){var _0x196cd1=typeof _0x252371[_0x8fbc('0x2f')]==='undefined'&&typeof _0x252371['limit']==='undefined';var _0xb20ac=_0x3cb963[_0x8fbc('0x30')];var _0x3f078e=_0x196cd1?0x0:_0x252371['offset'];var _0x64b342=_0x196cd1?_0x3cb963['count']:_0x252371[_0x8fbc('0x2f')]+_0x252371[_0x8fbc('0x31')];var _0x269fc1;if(_0x64b342>=_0xb20ac){_0x64b342=_0xb20ac;_0x269fc1=0xc8;}else{_0x269fc1=0xce;}_0x2ca16e[_0x8fbc('0x2d')](_0x269fc1);return _0x2ca16e[_0x8fbc('0x32')](_0x8fbc('0x33'),_0x3f078e+'-'+_0x64b342+'/'+_0xb20ac)[_0x8fbc('0x2e')](_0x3cb963);}return null;};}function patchUpdates(_0x43ed7c){return function(_0x2a2bf3){try{jsonpatch[_0x8fbc('0x34')](_0x2a2bf3,_0x43ed7c,!![]);}catch(_0x3243ad){return BPromise[_0x8fbc('0x35')](_0x3243ad);}return _0x2a2bf3[_0x8fbc('0x36')]();};}function saveUpdates(_0x22ab4c,_0x2fe6f9){return function(_0x51e22c){if(_0x51e22c){return _0x51e22c[_0x8fbc('0x37')](_0x22ab4c)[_0x8fbc('0x20')](function(_0x4844da){return _0x4844da;});}return null;};}function removeEntity(_0x16acce,_0x4950db){return function(_0x15c74b){if(_0x15c74b){return _0x15c74b[_0x8fbc('0x38')]()[_0x8fbc('0x20')](function(){var _0x499b72=_0x15c74b['get']({'plain':!![]});var _0x1876e4=_0x8fbc('0x39');return db[_0x8fbc('0x3a')][_0x8fbc('0x38')]({'where':{'type':_0x1876e4,'resourceId':_0x499b72['id']}})[_0x8fbc('0x20')](function(){return _0x15c74b;});})[_0x8fbc('0x20')](function(){_0x16acce[_0x8fbc('0x2d')](0xcc)[_0x8fbc('0x2c')]();});}};}function handleEntityNotFound(_0x2cece2,_0x43bf3e){return function(_0x4ead28){if(!_0x4ead28){_0x2cece2[_0x8fbc('0x2b')](0x194);}return _0x4ead28;};}function handleError(_0x12f7a4,_0x16af38){_0x16af38=_0x16af38||0x1f4;return function(_0x2e88ea){logger[_0x8fbc('0x27')](_0x2e88ea['stack']);if(_0x2e88ea[_0x8fbc('0x3b')]){delete _0x2e88ea['name'];}_0x12f7a4[_0x8fbc('0x2d')](_0x16af38)[_0x8fbc('0x3c')](_0x2e88ea);};}exports[_0x8fbc('0x3d')]=function(_0x302f49,_0x4da353){var _0x1dc4d2={'include':[{'model':db[_0x8fbc('0x3e')],'as':'mandatoryDispositionPause'}]},_0xc3aabb={},_0x4cfcbc={'count':0x0,'rows':[]};var _0x3b3102=_[_0x8fbc('0x3f')](db[_0x8fbc('0x40')]['rawAttributes'],function(_0x54d348){return{'name':_0x54d348[_0x8fbc('0x41')],'type':_0x54d348[_0x8fbc('0x42')]['key']};});_0xc3aabb[_0x8fbc('0x43')]=_['map'](_0x3b3102,_0x8fbc('0x3b'));_0xc3aabb[_0x8fbc('0x44')]=_['keys'](_0x302f49[_0x8fbc('0x44')]);_0xc3aabb[_0x8fbc('0x45')]=_[_0x8fbc('0x46')](_0xc3aabb[_0x8fbc('0x43')],_0xc3aabb[_0x8fbc('0x44')]);_0x1dc4d2[_0x8fbc('0x47')]=_[_0x8fbc('0x46')](_0xc3aabb[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x302f49['query'][_0x8fbc('0x48')]));_0x1dc4d2[_0x8fbc('0x47')]=_0x1dc4d2[_0x8fbc('0x47')][_0x8fbc('0x49')]?_0x1dc4d2['attributes']:_0xc3aabb[_0x8fbc('0x43')];if(!_0x302f49[_0x8fbc('0x44')][_0x8fbc('0x4a')](_0x8fbc('0x4b'))){_0x1dc4d2[_0x8fbc('0x31')]=qs[_0x8fbc('0x31')](_0x302f49['query'][_0x8fbc('0x31')]);_0x1dc4d2[_0x8fbc('0x2f')]=qs['offset'](_0x302f49[_0x8fbc('0x44')]['offset']);}_0x1dc4d2['order']=qs[_0x8fbc('0x4c')](_0x302f49[_0x8fbc('0x44')][_0x8fbc('0x4c')]);_0x1dc4d2[_0x8fbc('0x4d')]=qs[_0x8fbc('0x45')](_[_0x8fbc('0x4e')](_0x302f49[_0x8fbc('0x44')],_0xc3aabb[_0x8fbc('0x45')]),_0x3b3102);if(_0x302f49['query'][_0x8fbc('0x4f')]){_0x1dc4d2[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](_0x1dc4d2[_0x8fbc('0x4d')],{'$or':_[_0x8fbc('0x3f')](_0x3b3102,function(_0x5b6276){if(_0x5b6276[_0x8fbc('0x42')]!==_0x8fbc('0x51')){var _0x9488fc={};_0x9488fc[_0x5b6276['name']]={'$like':'%'+_0x302f49[_0x8fbc('0x44')][_0x8fbc('0x4f')]+'%'};return _0x9488fc;}})});}_0x1dc4d2=_[_0x8fbc('0x50')]({},_0x1dc4d2,_0x302f49[_0x8fbc('0x52')]);var _0x1c5ab5={'where':_0x1dc4d2['where']};return db[_0x8fbc('0x40')]['count'](_0x1c5ab5)[_0x8fbc('0x20')](function(_0x19752a){_0x4cfcbc[_0x8fbc('0x30')]=_0x19752a;if(_0x302f49[_0x8fbc('0x44')]['includeAll']){_0x1dc4d2[_0x8fbc('0x53')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x1dc4d2);})[_0x8fbc('0x20')](function(_0x46c05a){_0x4cfcbc['rows']=_0x46c05a;return _0x4cfcbc;})[_0x8fbc('0x20')](respondWithFilteredResult(_0x4da353,_0x1dc4d2))[_0x8fbc('0x2a')](handleError(_0x4da353,null));};exports[_0x8fbc('0x54')]=function(_0x494907,_0x344c4e){var _0xe744d={'raw':![],'where':{'id':_0x494907[_0x8fbc('0x55')]['id']},'include':[{'model':db[_0x8fbc('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4cfe23={};_0x4cfe23[_0x8fbc('0x43')]=_['keys'](db[_0x8fbc('0x40')][_0x8fbc('0x56')]);_0x4cfe23[_0x8fbc('0x44')]=_[_0x8fbc('0x57')](_0x494907['query']);_0x4cfe23[_0x8fbc('0x45')]=_[_0x8fbc('0x46')](_0x4cfe23[_0x8fbc('0x43')],_0x4cfe23[_0x8fbc('0x44')]);_0xe744d['attributes']=_['intersection'](_0x4cfe23[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x494907[_0x8fbc('0x44')][_0x8fbc('0x48')]));_0xe744d[_0x8fbc('0x47')]=_0xe744d['attributes'][_0x8fbc('0x49')]?_0xe744d[_0x8fbc('0x47')]:_0x4cfe23[_0x8fbc('0x43')];if(_0x494907['query'][_0x8fbc('0x58')]){_0xe744d[_0x8fbc('0x53')]=[{'all':!![]}];}_0xe744d=_[_0x8fbc('0x50')]({},_0xe744d,_0x494907[_0x8fbc('0x52')]);return db[_0x8fbc('0x40')]['find'](_0xe744d)[_0x8fbc('0x20')](handleEntityNotFound(_0x344c4e,null))[_0x8fbc('0x20')](respondWithResult(_0x344c4e,null))[_0x8fbc('0x2a')](handleError(_0x344c4e,null));};exports[_0x8fbc('0x59')]=function(_0x3bbed1,_0xac3f20){return db[_0x8fbc('0x40')][_0x8fbc('0x59')](_0x3bbed1[_0x8fbc('0x5a')],{})['then'](function(_0x1ac2ed){var _0x1e81c9=_0x3bbed1['user'][_0x8fbc('0x5b')]({'plain':!![]});if(!_0x1e81c9)throw new Error(_0x8fbc('0x5c'));if(_0x1e81c9[_0x8fbc('0x5d')]===_0x8fbc('0x5e')){var _0x4039b0=_0x1ac2ed[_0x8fbc('0x5b')]({'plain':!![]});var _0x34ec5b=_0x8fbc('0x39');return db[_0x8fbc('0x5f')][_0x8fbc('0x60')]({'where':{'name':_0x34ec5b,'userProfileId':_0x1e81c9['userProfileId']},'raw':!![]})[_0x8fbc('0x20')](function(_0xcb0840){if(_0xcb0840&&_0xcb0840['autoAssociation']===0x0){return db['UserProfileResource'][_0x8fbc('0x59')]({'name':_0x4039b0['name'],'resourceId':_0x4039b0['id'],'type':_0xcb0840[_0x8fbc('0x3b')],'sectionId':_0xcb0840['id']},{})[_0x8fbc('0x20')](function(){return _0x1ac2ed;});}else{return _0x1ac2ed;}})[_0x8fbc('0x2a')](function(_0x1acd50){logger['error'](_0x8fbc('0x61'),_0x1acd50);throw _0x1acd50;});}return _0x1ac2ed;})[_0x8fbc('0x20')](respondWithResult(_0xac3f20,0xc9))['catch'](handleError(_0xac3f20,null));};exports[_0x8fbc('0x37')]=function(_0x50e80c,_0x53ff67){if(_0x50e80c[_0x8fbc('0x5a')]['id']){delete _0x50e80c[_0x8fbc('0x5a')]['id'];}return db[_0x8fbc('0x40')]['find']({'where':{'id':_0x50e80c[_0x8fbc('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x8fbc('0x62')}]})['then'](handleEntityNotFound(_0x53ff67,null))[_0x8fbc('0x20')](saveUpdates(_0x50e80c[_0x8fbc('0x5a')],null))[_0x8fbc('0x20')](respondWithResult(_0x53ff67,null))[_0x8fbc('0x2a')](handleError(_0x53ff67,null));};exports[_0x8fbc('0x38')]=function(_0x5419e4,_0x17e614){return db[_0x8fbc('0x40')][_0x8fbc('0x60')]({'where':{'id':_0x5419e4[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x17e614,null))[_0x8fbc('0x20')](removeEntity(_0x17e614,null))['catch'](handleError(_0x17e614,null));};exports['describe']=function(_0x4f6463,_0x4f1cc2){return db[_0x8fbc('0x40')][_0x8fbc('0x63')]()[_0x8fbc('0x20')](respondWithResult(_0x4f1cc2,null))[_0x8fbc('0x2a')](handleError(_0x4f1cc2,null));};exports[_0x8fbc('0x64')]=function(_0x3f6660,_0x425f2f,_0x4fadef){if(_0x3f6660[_0x8fbc('0x5a')]['id']){delete _0x3f6660[_0x8fbc('0x5a')]['id'];}return db[_0x8fbc('0x40')][_0x8fbc('0x60')]({'where':{'id':_0x3f6660[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x425f2f,null))[_0x8fbc('0x20')](function(_0x395332){if(_0x395332){_0x3f6660[_0x8fbc('0x5a')][_0x8fbc('0x65')]=_0x395332['id'];return db[_0x8fbc('0x66')][_0x8fbc('0x59')](_0x3f6660['body']);}})[_0x8fbc('0x20')](respondWithResult(_0x425f2f,null))[_0x8fbc('0x2a')](handleError(_0x425f2f,null));};exports[_0x8fbc('0x67')]=function(_0x5047b0,_0x2d6e45,_0x5a0366){var _0x5190cf={'raw':![],'where':{}};var _0x360ea4={};var _0x29c45f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5047b0[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x2d6e45,null))[_0x8fbc('0x20')](function(_0x344570){if(_0x344570){_0x360ea4[_0x8fbc('0x43')]=_[_0x8fbc('0x57')](db[_0x8fbc('0x66')][_0x8fbc('0x56')]);_0x360ea4[_0x8fbc('0x44')]=_[_0x8fbc('0x57')](_0x5047b0[_0x8fbc('0x44')]);_0x360ea4[_0x8fbc('0x45')]=_[_0x8fbc('0x46')](_0x360ea4[_0x8fbc('0x43')],_0x360ea4[_0x8fbc('0x44')]);_0x5190cf['attributes']=_[_0x8fbc('0x46')](_0x360ea4[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x5047b0['query'][_0x8fbc('0x48')]));_0x5190cf[_0x8fbc('0x47')]=_0x5190cf['attributes'][_0x8fbc('0x49')]?_0x5190cf[_0x8fbc('0x47')]:_0x360ea4[_0x8fbc('0x43')];if(!_0x5047b0[_0x8fbc('0x44')][_0x8fbc('0x4a')](_0x8fbc('0x4b'))){_0x5190cf[_0x8fbc('0x31')]=qs[_0x8fbc('0x31')](_0x5047b0['query'][_0x8fbc('0x31')]);_0x5190cf[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0x5047b0[_0x8fbc('0x44')][_0x8fbc('0x2f')]);}_0x5190cf[_0x8fbc('0x68')]=qs[_0x8fbc('0x4c')](_0x5047b0[_0x8fbc('0x44')][_0x8fbc('0x4c')]);_0x5190cf['where']=qs[_0x8fbc('0x45')](_[_0x8fbc('0x4e')](_0x5047b0[_0x8fbc('0x44')],_0x360ea4[_0x8fbc('0x45')]));_0x5190cf[_0x8fbc('0x4d')]['FaxAccountId']=_0x344570['id'];if(_0x5047b0[_0x8fbc('0x44')]['filter']){_0x5190cf[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](_0x5190cf[_0x8fbc('0x4d')],{'$or':_['map'](_0x5190cf[_0x8fbc('0x47')],function(_0x3ca637){var _0x4c5dbb={};_0x4c5dbb[_0x3ca637]={'$like':'%'+_0x5047b0['query'][_0x8fbc('0x4f')]+'%'};return _0x4c5dbb;})});}_0x5190cf=_[_0x8fbc('0x50')]({},_0x5190cf,_0x5047b0['options']);return db[_0x8fbc('0x66')][_0x8fbc('0x30')]({'where':_0x5190cf[_0x8fbc('0x4d')]})[_0x8fbc('0x20')](function(_0x16a0a7){_0x29c45f[_0x8fbc('0x30')]=_0x16a0a7;if(_0x5047b0['query'][_0x8fbc('0x58')]){_0x5190cf[_0x8fbc('0x53')]=[{'all':!![]}];}return db[_0x8fbc('0x66')][_0x8fbc('0x69')](_0x5190cf);})[_0x8fbc('0x20')](function(_0x49df39){_0x29c45f[_0x8fbc('0x6a')]=_0x49df39;return _0x29c45f;});}})[_0x8fbc('0x20')](respondWithFilteredResult(_0x2d6e45,_0x5190cf))['catch'](handleError(_0x2d6e45,null));};exports[_0x8fbc('0x6b')]=function(_0x1cb619,_0x17f182,_0x1b4d71){return db['FaxAccount'][_0x8fbc('0x60')]({'where':{'id':_0x1cb619[_0x8fbc('0x55')]['id']}})['then'](handleEntityNotFound(_0x17f182,null))[_0x8fbc('0x20')](function(_0x5a29a3){if(_0x5a29a3){return _0x5a29a3[_0x8fbc('0x6b')](_0x1cb619['query'][_0x8fbc('0x6c')]);}})[_0x8fbc('0x20')](respondWithStatusCode(_0x17f182,null))[_0x8fbc('0x2a')](handleError(_0x17f182,null));};exports[_0x8fbc('0x6d')]=function(_0xfbf2f9,_0x3b0200,_0x2f163f){if(_0xfbf2f9[_0x8fbc('0x5a')]['id']){delete _0xfbf2f9['body']['id'];}return db['FaxAccount'][_0x8fbc('0x60')]({'where':{'id':_0xfbf2f9[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x3b0200,null))[_0x8fbc('0x20')](function(_0x30c876){if(_0x30c876){_0xfbf2f9[_0x8fbc('0x5a')]['FaxAccountId']=_0x30c876['id'];return db['CannedAnswer']['create'](_0xfbf2f9[_0x8fbc('0x5a')]);}})[_0x8fbc('0x20')](respondWithResult(_0x3b0200,null))[_0x8fbc('0x2a')](handleError(_0x3b0200,null));};exports['getAnswers']=function(_0x3427d7,_0x520abb,_0x30c95f){var _0x310500={'raw':![],'where':{}};var _0xfd77b4={};var _0x1fdc92={'count':0x0,'rows':[]};return db[_0x8fbc('0x40')][_0x8fbc('0x6e')]({'where':{'id':_0x3427d7[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x520abb,null))[_0x8fbc('0x20')](function(_0x3d1ca3){if(_0x3d1ca3){_0xfd77b4[_0x8fbc('0x43')]=_[_0x8fbc('0x57')](db['CannedAnswer'][_0x8fbc('0x56')]);_0xfd77b4['query']=_[_0x8fbc('0x57')](_0x3427d7[_0x8fbc('0x44')]);_0xfd77b4[_0x8fbc('0x45')]=_[_0x8fbc('0x46')](_0xfd77b4['model'],_0xfd77b4[_0x8fbc('0x44')]);_0x310500[_0x8fbc('0x47')]=_[_0x8fbc('0x46')](_0xfd77b4['model'],qs[_0x8fbc('0x48')](_0x3427d7[_0x8fbc('0x44')][_0x8fbc('0x48')]));_0x310500['attributes']=_0x310500[_0x8fbc('0x47')][_0x8fbc('0x49')]?_0x310500[_0x8fbc('0x47')]:_0xfd77b4[_0x8fbc('0x43')];if(!_0x3427d7[_0x8fbc('0x44')][_0x8fbc('0x4a')](_0x8fbc('0x4b'))){_0x310500['limit']=qs[_0x8fbc('0x31')](_0x3427d7[_0x8fbc('0x44')]['limit']);_0x310500[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0x3427d7[_0x8fbc('0x44')]['offset']);}_0x310500[_0x8fbc('0x68')]=qs['sort'](_0x3427d7[_0x8fbc('0x44')]['sort']);_0x310500[_0x8fbc('0x4d')]=qs[_0x8fbc('0x45')](_[_0x8fbc('0x4e')](_0x3427d7[_0x8fbc('0x44')],_0xfd77b4[_0x8fbc('0x45')]));_0x310500[_0x8fbc('0x4d')][_0x8fbc('0x65')]=_0x3d1ca3['id'];if(_0x3427d7[_0x8fbc('0x44')][_0x8fbc('0x4f')]){_0x310500['where']=_[_0x8fbc('0x50')](_0x310500[_0x8fbc('0x4d')],{'$or':_[_0x8fbc('0x3f')](_0x310500[_0x8fbc('0x47')],function(_0x3c17f2){var _0x2f4532={};_0x2f4532[_0x3c17f2]={'$like':'%'+_0x3427d7[_0x8fbc('0x44')][_0x8fbc('0x4f')]+'%'};return _0x2f4532;})});}_0x310500=_[_0x8fbc('0x50')]({},_0x310500,_0x3427d7[_0x8fbc('0x52')]);return db[_0x8fbc('0x6f')][_0x8fbc('0x30')]({'where':_0x310500[_0x8fbc('0x4d')]})[_0x8fbc('0x20')](function(_0x57d7a2){_0x1fdc92['count']=_0x57d7a2;if(_0x3427d7[_0x8fbc('0x44')][_0x8fbc('0x58')]){_0x310500[_0x8fbc('0x53')]=[{'all':!![]}];}return db[_0x8fbc('0x6f')][_0x8fbc('0x69')](_0x310500);})[_0x8fbc('0x20')](function(_0x288bac){_0x1fdc92['rows']=_0x288bac;return _0x1fdc92;});}})[_0x8fbc('0x20')](respondWithFilteredResult(_0x520abb,_0x310500))[_0x8fbc('0x2a')](handleError(_0x520abb,null));};exports[_0x8fbc('0x70')]=function(_0x28f330,_0x3accab,_0x3263b3){return db['FaxAccount'][_0x8fbc('0x60')]({'where':{'id':_0x28f330['params']['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x3accab,null))['then'](function(_0x8c790c){if(_0x8c790c){return _0x8c790c[_0x8fbc('0x70')](_0x28f330['query'][_0x8fbc('0x6c')]);}})['then'](respondWithStatusCode(_0x3accab,null))[_0x8fbc('0x2a')](handleError(_0x3accab,null));};exports[_0x8fbc('0x71')]=function(_0xcbedf5,_0x34d52e,_0x40376e){return db[_0x8fbc('0x72')][_0x8fbc('0x60')]({'where':{'id':_0xcbedf5[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x34d52e,null))['then'](function(_0x666134){if(_0x666134){return _0x666134[_0x8fbc('0x71')](_0xcbedf5[_0x8fbc('0x5a')][_0x8fbc('0x6c')],_['omit'](_0xcbedf5[_0x8fbc('0x5a')],[_0x8fbc('0x6c'),'id'])||{});}})[_0x8fbc('0x20')](respondWithResult(_0x34d52e,null))[_0x8fbc('0x2a')](handleError(_0x34d52e,null));};exports['getInteractions']=function(_0x33aa00,_0x308bb2,_0x48d408){var _0x4cca0b={'raw':![],'where':{}};var _0x5b3afe={};var _0x204faf={'count':0x0,'rows':[]};return db[_0x8fbc('0x40')][_0x8fbc('0x6e')]({'where':{'id':_0x33aa00[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x308bb2,null))[_0x8fbc('0x20')](function(_0x5904b4){if(_0x5904b4){_0x5b3afe[_0x8fbc('0x43')]=_[_0x8fbc('0x57')](db[_0x8fbc('0x72')]['rawAttributes']);_0x5b3afe['query']=_[_0x8fbc('0x57')](_0x33aa00[_0x8fbc('0x44')]);_0x5b3afe[_0x8fbc('0x45')]=_[_0x8fbc('0x46')](_0x5b3afe[_0x8fbc('0x43')],_0x5b3afe[_0x8fbc('0x44')]);_0x4cca0b[_0x8fbc('0x47')]=_['intersection'](_0x5b3afe[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x33aa00['query'][_0x8fbc('0x48')]));_0x4cca0b[_0x8fbc('0x47')]=_0x4cca0b[_0x8fbc('0x47')][_0x8fbc('0x49')]?_0x4cca0b[_0x8fbc('0x47')]:_0x5b3afe[_0x8fbc('0x43')];if(!_0x33aa00[_0x8fbc('0x44')]['hasOwnProperty'](_0x8fbc('0x4b'))){_0x4cca0b['limit']=qs['limit'](_0x33aa00['query'][_0x8fbc('0x31')]);_0x4cca0b[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0x33aa00['query'][_0x8fbc('0x2f')]);}_0x4cca0b[_0x8fbc('0x68')]=qs['sort'](_0x33aa00[_0x8fbc('0x44')]['sort']);_0x4cca0b[_0x8fbc('0x4d')]=qs[_0x8fbc('0x45')](_[_0x8fbc('0x4e')](_0x33aa00[_0x8fbc('0x44')],_0x5b3afe['filters']));_0x4cca0b[_0x8fbc('0x4d')][_0x8fbc('0x65')]=_0x5904b4['id'];if(_0x33aa00['query'][_0x8fbc('0x4f')]){_0x4cca0b[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](_0x4cca0b[_0x8fbc('0x4d')],{'$or':_[_0x8fbc('0x3f')](_0x4cca0b[_0x8fbc('0x47')],function(_0x1c2ccd){var _0x2c2a8a={};_0x2c2a8a[_0x1c2ccd]={'$like':'%'+_0x33aa00[_0x8fbc('0x44')][_0x8fbc('0x4f')]+'%'};return _0x2c2a8a;})});}_0x4cca0b=_[_0x8fbc('0x50')]({},_0x4cca0b,_0x33aa00[_0x8fbc('0x52')]);return db[_0x8fbc('0x72')]['count']({'where':_0x4cca0b[_0x8fbc('0x4d')]})[_0x8fbc('0x20')](function(_0x3a275b){_0x204faf[_0x8fbc('0x30')]=_0x3a275b;if(_0x33aa00[_0x8fbc('0x44')][_0x8fbc('0x58')]){_0x4cca0b[_0x8fbc('0x53')]=[{'model':db['CmContact'],'as':_0x8fbc('0x73'),'required':![]},{'model':db[_0x8fbc('0x74')],'as':'Owner','attributes':[_0x8fbc('0x3b'),_0x8fbc('0x75'),_0x8fbc('0x76')],'required':![]},{'model':db[_0x8fbc('0x77')],'as':_0x8fbc('0x78'),'attributes':['id',_0x8fbc('0x3b'),_0x8fbc('0x79')],'where':_0x33aa00[_0x8fbc('0x44')][_0x8fbc('0x7a')]?{'id':_0x33aa00[_0x8fbc('0x44')][_0x8fbc('0x7a')]}:undefined,'required':_0x33aa00[_0x8fbc('0x44')][_0x8fbc('0x7a')]?!![]:![]}];}return db[_0x8fbc('0x72')][_0x8fbc('0x69')](_0x4cca0b);})[_0x8fbc('0x20')](function(_0x1f5043){_0x204faf[_0x8fbc('0x6a')]=_0x1f5043;return _0x204faf;});}})[_0x8fbc('0x20')](respondWithFilteredResult(_0x308bb2,_0x4cca0b))[_0x8fbc('0x2a')](handleError(_0x308bb2,null));};exports[_0x8fbc('0x7b')]=function(_0x36b6c7,_0x3e8336){var _0x10c2c1=_0x36b6c7[_0x8fbc('0x55')]['id'];var _0x5f46c3=_0x36b6c7[_0x8fbc('0x5a')];var _0x408586=0xc8;var _0x3f7408=null;return db[_0x8fbc('0x7c')][_0x8fbc('0x7d')]({'isolationLevel':db[_0x8fbc('0x7c')][_0x8fbc('0x7e')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x31cbc7){return db['FaxAccount']['findOne']({'where':{'id':_0x10c2c1},'transaction':_0x31cbc7})[_0x8fbc('0x20')](function(_0x20cf58){if(_0x20cf58){return db[_0x8fbc('0x7f')]['destroy']({'where':{'FaxAccountId':_0x10c2c1},'transaction':_0x31cbc7})[_0x8fbc('0x20')](function(){var _0x58f176=_[_0x8fbc('0x3f')](_0x5f46c3,function(_0x37def8){_0x37def8[_0x8fbc('0x65')]=_0x10c2c1;return _0x37def8;});return db[_0x8fbc('0x7f')][_0x8fbc('0x80')](_0x58f176,{'transaction':_0x31cbc7});});}else{_0x408586=0x194;_0x3f7408=[];}});})['then'](function(){if(_0x408586!==0x194){return db[_0x8fbc('0x7f')][_0x8fbc('0x81')]({'where':{'FaxAccountId':_0x10c2c1},'order':_0x8fbc('0x82')})[_0x8fbc('0x20')](function(_0x22b9cb){_0x3f7408=_0x22b9cb;});}})[_0x8fbc('0x2a')](function(_0x17de35){_0x408586=0x1f4;logger['error'](_0x17de35[_0x8fbc('0x83')]);if(_0x17de35[_0x8fbc('0x3b')]){delete _0x17de35[_0x8fbc('0x3b')];}_0x3f7408=_0x17de35;})[_0x8fbc('0x84')](function(){if(_0x3f7408===null){_0x3e8336[_0x8fbc('0x2b')](_0x408586);}else{if(_0x408586===0x1f4){_0x3e8336[_0x8fbc('0x2d')](_0x408586)[_0x8fbc('0x3c')](_0x3f7408);}else{_0x3e8336[_0x8fbc('0x2d')](_0x408586)[_0x8fbc('0x2e')](_0x3f7408);}}});};exports[_0x8fbc('0x85')]=function(_0x302d54,_0x40e870,_0x5efd79){var _0x3520e1={};var _0x58bfc6={};var _0x1b6635;var _0x36b06c;return db['FaxAccount'][_0x8fbc('0x6e')]({'where':{'id':_0x302d54[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x40e870,null))[_0x8fbc('0x20')](function(_0xb7853f){if(_0xb7853f){_0x1b6635=_0xb7853f;_0x58bfc6[_0x8fbc('0x43')]=_[_0x8fbc('0x57')](db['FaxApplication'][_0x8fbc('0x56')]);_0x58bfc6['query']=_[_0x8fbc('0x57')](_0x302d54['query']);_0x58bfc6['filters']=_[_0x8fbc('0x46')](_0x58bfc6[_0x8fbc('0x43')],_0x58bfc6[_0x8fbc('0x44')]);_0x3520e1['attributes']=_[_0x8fbc('0x46')](_0x58bfc6[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x302d54[_0x8fbc('0x44')][_0x8fbc('0x48')]));_0x3520e1[_0x8fbc('0x47')]=_0x3520e1[_0x8fbc('0x47')][_0x8fbc('0x49')]?_0x3520e1[_0x8fbc('0x47')]:_0x58bfc6['model'];_0x3520e1['order']=qs['sort'](_0x302d54[_0x8fbc('0x44')][_0x8fbc('0x4c')]);_0x3520e1[_0x8fbc('0x4d')]=qs['filters'](_['pick'](_0x302d54['query'],_0x58bfc6['filters']));if(_0x302d54[_0x8fbc('0x44')]['filter']){_0x3520e1[_0x8fbc('0x4d')]=_['merge'](_0x3520e1[_0x8fbc('0x4d')],{'$or':_[_0x8fbc('0x3f')](_0x3520e1[_0x8fbc('0x47')],function(_0x41ebb0){var _0x593ffc={};_0x593ffc[_0x41ebb0]={'$like':'%'+_0x302d54['query']['filter']+'%'};return _0x593ffc;})});}_0x3520e1=_[_0x8fbc('0x50')]({},_0x3520e1,_0x302d54[_0x8fbc('0x52')]);return _0x1b6635[_0x8fbc('0x85')](_0x3520e1);}})[_0x8fbc('0x20')](function(_0x250109){if(_0x250109){_0x36b06c=_0x250109[_0x8fbc('0x49')];if(!_0x302d54[_0x8fbc('0x44')][_0x8fbc('0x4a')]('nolimit')){_0x3520e1[_0x8fbc('0x31')]=qs['limit'](_0x302d54[_0x8fbc('0x44')]['limit']);_0x3520e1[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0x302d54['query'][_0x8fbc('0x2f')]);}return _0x1b6635[_0x8fbc('0x85')](_0x3520e1);}})['then'](function(_0x2ed119){if(_0x2ed119){return _0x2ed119?{'count':_0x36b06c,'rows':_0x2ed119}:null;}})[_0x8fbc('0x20')](respondWithResult(_0x40e870,null))[_0x8fbc('0x2a')](handleError(_0x40e870,null));};function Extension(_0x121246,_0x55b617,_0x3b3e77,_0x531538){this[_0x8fbc('0x86')]='from-voip-provider';this[_0x8fbc('0x87')]=_0x121246[_0x8fbc('0x88')];this[_0x8fbc('0x89')]=_0x531538;this[_0x8fbc('0x42')]=_0x8fbc('0x8a');this[_0x8fbc('0x8b')]=_0x8fbc('0x8c');this[_0x8fbc('0x65')]=_0x121246['id'];this['priority']=_0x55b617;this[_0x8fbc('0x8d')]=_0x3b3e77;}function createExtensionsReciveFax(_0x42d610){var _0x3e760e=0x1;var _0x4f453f=[];_0x4f453f['push'](new Extension(_0x42d610,_0x3e760e,'',_0x8fbc('0x8e')));_0x3e760e+=0x1;_0x4f453f['push'](new Extension(_0x42d610,_0x3e760e,_0x8fbc('0x8f'),'Set'));_0x3e760e+=0x1;for(var _0x66cf1 in _0x42d610){if(_0x42d610['hasOwnProperty'](_0x66cf1)&&(_0x66cf1===_0x8fbc('0x90')||_0x66cf1===_0x8fbc('0x88')||_0x66cf1===_0x8fbc('0x91')||_0x66cf1==='faxdetect'||_0x66cf1==='headerinfo'||_0x66cf1===_0x8fbc('0x92')||_0x66cf1==='minrate'||_0x66cf1===_0x8fbc('0x93')||_0x66cf1===_0x8fbc('0x94'))){_0x4f453f[_0x8fbc('0x95')](new Extension(_0x42d610,_0x3e760e,_0x8fbc('0x96')+_0x66cf1+')='+_0x42d610[_0x66cf1],'Set'));_0x3e760e+=0x1;}}_0x4f453f[_0x8fbc('0x95')](new Extension(_0x42d610,_0x3e760e,'6',_0x8fbc('0x97')));_0x3e760e+=0x1;_0x4f453f[_0x8fbc('0x95')](new Extension(_0x42d610,_0x3e760e,_0x8fbc('0x98'),_0x8fbc('0x99')));_0x3e760e=0x0;return _0x4f453f;}exports[_0x8fbc('0x9a')]=function(_0x4818c3,_0x2eaf27,_0x3d24e7){var _0x536d73;return db['sequelize'][_0x8fbc('0x7d')](function(_0x1ab4a1){return db[_0x8fbc('0x40')][_0x8fbc('0x59')](_0x4818c3[_0x8fbc('0x5a')],{'transaction':_0x1ab4a1})[_0x8fbc('0x20')](function(_0x1092ed){_0x536d73=_0x1092ed[_0x8fbc('0x5b')]({'plain':!![]});return db[_0x8fbc('0x9b')][_0x8fbc('0x80')](createExtensionsReciveFax(_0x536d73),{'transaction':_0x1ab4a1});});})[_0x8fbc('0x20')](function(){return _0x536d73;})[_0x8fbc('0x20')](respondWithResult(_0x2eaf27,null))[_0x8fbc('0x2a')](handleError(_0x2eaf27,null));};exports['updateAccountApplications']=function(_0x452228,_0x2385d0,_0x8fd46e){var _0x1c9794;return db[_0x8fbc('0x7c')][_0x8fbc('0x7d')](function(_0x12e344){return db[_0x8fbc('0x40')]['update'](_0x452228[_0x8fbc('0x5a')],{'where':{'id':_0x452228['body']['id']},'transaction':_0x12e344})[_0x8fbc('0x20')](function(_0x5947d0){return db[_0x8fbc('0x9b')][_0x8fbc('0x38')]({'where':{'FaxAccountId':_0x452228[_0x8fbc('0x5a')]['id']},'transaction':_0x12e344})['then'](function(_0x5d1d0d){return db['VoiceExtension'][_0x8fbc('0x80')](createExtensionsReciveFax(_[_0x8fbc('0x9c')](_0x452228['body'],[_0x8fbc('0x9d'),_0x8fbc('0x9e'),'createdAt',_0x8fbc('0x9f'),_0x8fbc('0xa0'),_0x8fbc('0xa1')])),{'transaction':_0x12e344});});});})[_0x8fbc('0x20')](function(){return db['FaxAccount']['findById'](_0x452228[_0x8fbc('0x5a')]['id']);})[_0x8fbc('0x20')](respondWithResult(_0x2385d0,null))[_0x8fbc('0x2a')](handleError(_0x2385d0,null));};exports[_0x8fbc('0xa2')]=function(_0xe7cfd4,_0x43298d,_0x4ac295){var _0x49eea4={'raw':!![],'where':{}};var _0x5c0fbb={};var _0x49680f={'count':0x0,'rows':[]};return db[_0x8fbc('0x40')][_0x8fbc('0x6e')]({'where':{'id':_0xe7cfd4[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x43298d,null))[_0x8fbc('0x20')](function(_0xd3f843){if(_0xd3f843){_0x5c0fbb[_0x8fbc('0x43')]=_['keys'](db[_0x8fbc('0xa3')][_0x8fbc('0x56')]);_0x5c0fbb[_0x8fbc('0x44')]=_[_0x8fbc('0x57')](_0xe7cfd4[_0x8fbc('0x44')]);_0x5c0fbb['filters']=_[_0x8fbc('0x46')](_0x5c0fbb[_0x8fbc('0x43')],_0x5c0fbb[_0x8fbc('0x44')]);_0x49eea4['attributes']=_['intersection'](_0x5c0fbb[_0x8fbc('0x43')],qs['fields'](_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x48')]));_0x49eea4[_0x8fbc('0x47')]=_0x49eea4[_0x8fbc('0x47')]['length']?_0x49eea4[_0x8fbc('0x47')]:_0x5c0fbb[_0x8fbc('0x43')];if(!_0xe7cfd4['query'][_0x8fbc('0x4a')]('nolimit')){_0x49eea4[_0x8fbc('0x31')]=qs['limit'](_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x31')]);_0x49eea4[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x2f')]);}_0x49eea4['order']=qs[_0x8fbc('0x4c')](_0xe7cfd4[_0x8fbc('0x44')]['sort']);_0x49eea4[_0x8fbc('0x4d')]=qs[_0x8fbc('0x45')](_[_0x8fbc('0x4e')](_0xe7cfd4[_0x8fbc('0x44')],_0x5c0fbb['filters']));_0x49eea4[_0x8fbc('0x4d')][_0x8fbc('0x65')]=_0xd3f843['id'];if(_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x4f')]){_0x49eea4[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](_0x49eea4[_0x8fbc('0x4d')],{'$or':_['map'](_0x49eea4[_0x8fbc('0x47')],function(_0x5d9534){var _0x385fb7={};_0x385fb7[_0x5d9534]={'$like':'%'+_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x4f')]+'%'};return _0x385fb7;})});}if(_0xe7cfd4[_0x8fbc('0x44')]['$gte']){var _0x4e8f4c=_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0xa4')][_0x8fbc('0xa5')](',');var _0x2837de={};_0x2837de[_0x4e8f4c[0x0]]={'$gte':moment(_0x4e8f4c[0x1])[_0x8fbc('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49eea4['where']=_[_0x8fbc('0x50')](_0x49eea4[_0x8fbc('0x4d')],_0x2837de);}_0x49eea4=_['merge']({},_0x49eea4,_0xe7cfd4['options']);return db[_0x8fbc('0xa3')]['count']({'where':_0x49eea4[_0x8fbc('0x4d')]})[_0x8fbc('0x20')](function(_0x457498){_0x49680f[_0x8fbc('0x30')]=_0x457498;if(_0xe7cfd4[_0x8fbc('0x44')][_0x8fbc('0x58')]){_0x49eea4[_0x8fbc('0x53')]=[{'all':!![]}];}return db[_0x8fbc('0xa3')]['findAll'](_0x49eea4);})[_0x8fbc('0x20')](function(_0x58e04f){_0x49680f[_0x8fbc('0x6a')]=_0x58e04f;return _0x49680f;});}})[_0x8fbc('0x20')](respondWithFilteredResult(_0x43298d,_0x49eea4))['catch'](handleError(_0x43298d,null));};exports[_0x8fbc('0x3c')]=function(_0xa30458,_0x3cdeff,_0x38e5d3){var _0x575ac8,_0x2cb939={},_0x4a42a6;if(_0xa30458[_0x8fbc('0x5a')]['to']){_0x4a42a6=_0xa30458[_0x8fbc('0x5a')]['to'][0x0];}return db[_0x8fbc('0x40')]['find']({'where':{'id':_0xa30458[_0x8fbc('0x55')]['id']},'include':[{'model':db[_0x8fbc('0xa7')],'as':_0x8fbc('0xa8'),'include':[{'model':db[_0x8fbc('0xa9')],'as':_0x8fbc('0xaa'),'where':{'fax':_0x4a42a6},'limit':0x1,'order':[[_0x8fbc('0x9f'),_0x8fbc('0xab')]]}]}]})[_0x8fbc('0x20')](handleEntityNotFound(_0x3cdeff,null))['then'](function(_0x3d0d13){_0x575ac8=_0x3d0d13;if(_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')]&&_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x8fbc('0x49')]){for(var _0x3cb307=0x0;_0x3cb307<_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x8fbc('0x49')];_0x3cb307+=0x1){_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x3cb307]={'filename':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x3cb307][_0x8fbc('0x3b')],'id':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x3cb307]['id'],'path':path['join'](config[_0x8fbc('0xad')],'server/files/attachments',_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][_0x3cb307][_0x8fbc('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0x8fbc('0xaf'),{'FaxAccountId':_[_0x8fbc('0xb0')](_0xa30458[_0x8fbc('0x55')]['id'])?undefined:_0xa30458[_0x8fbc('0x55')]['id'],'path':_['isNil'](_0xa30458[_0x8fbc('0x5a')]['attachments'][0x0]['path'])?undefined:_0xa30458['body'][_0x8fbc('0xac')][0x0]['path'],'fax':_['isNil'](_0xa30458[_0x8fbc('0x5a')]['to'][0x0])?undefined:_0xa30458[_0x8fbc('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x575ac8){if(_[_0x8fbc('0xb0')](_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xb1')])){_0xa30458[_0x8fbc('0x5a')]['from']=util[_0x8fbc('0xa6')]('\x22%s\x22\x20<%s>',_0x575ac8[_0x8fbc('0x3b')],_0x575ac8[_0x8fbc('0xb2')]);}if(_0x575ac8[_0x8fbc('0xa8')]){if(_0x575ac8[_0x8fbc('0xa8')][_0x8fbc('0xaa')][_0x8fbc('0x49')]){return _0x575ac8[_0x8fbc('0xa8')][_0x8fbc('0xaa')][0x0];}else{return db['CmContact'][_0x8fbc('0x59')](_[_0x8fbc('0x19')](_0xa30458[_0x8fbc('0x5a')],{'firstName':_0xa30458[_0x8fbc('0x5a')]['to'][0x0],'phone':_0xa30458[_0x8fbc('0x5a')]['to'][0x0],'fax':_0xa30458[_0x8fbc('0x5a')]['to'][0x0],'ListId':_0x575ac8[_0x8fbc('0xa1')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8fbc('0xb3'));}})[_0x8fbc('0x20')](function(_0x3f1a46){if(_0x3f1a46){return db[_0x8fbc('0x72')][_0x8fbc('0x60')]({'where':{'ContactId':_0x3f1a46['id'],'closed':![],'FaxAccountId':_0x575ac8['id']}})[_0x8fbc('0x20')](function(_0x261a44){if(_0x261a44){return[_0x261a44,![]];}return db['FaxInteraction'][_0x8fbc('0x59')]({'UserId':_0xa30458[_0x8fbc('0x5e')]['id'],'ContactId':_0x3f1a46['id'],'FaxAccountId':_0x575ac8['id'],'fax':_0xa30458[_0x8fbc('0x5a')]['to'][0x0],'firstMsgDirection':_0x8fbc('0xb4'),'Messages':[_[_0x8fbc('0x50')](_0xa30458['body'],{'read':![],'body':_0xa30458['body'][_0x8fbc('0xac')][0x0]['filename'],'FaxAccountId':_0x575ac8['id'],'UserId':_0xa30458[_0x8fbc('0x5e')]['id'],'ContactId':_0x3f1a46['id'],'AttachmentId':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x8fbc('0xa3')],'as':_0x8fbc('0xb5')}]})[_0x8fbc('0x20')](function(_0x4356fa){return[_0x4356fa,!![]];});});}else{throw new Error(_0x8fbc('0xb6'));}})[_0x8fbc('0xb7')](function(_0x3c9fb6,_0x1bff63){if(_0x1bff63){return _0x3c9fb6;}return db[_0x8fbc('0xa3')][_0x8fbc('0x59')]({'direction':_0x8fbc('0xb4'),'read':![],'body':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][0x0]['filename'],'FaxAccountId':_0x575ac8['id'],'FaxInteractionId':_0x3c9fb6['id'],'UserId':_0xa30458[_0x8fbc('0x5e')]['id'],'ContactId':_0x3c9fb6['ContactId'],'AttachmentId':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][0x0]['id']})[_0x8fbc('0x20')](function(_0x561e45){_0x3c9fb6[_0x8fbc('0xb8')][_0x8fbc('0xb5')]=[];_0x3c9fb6[_0x8fbc('0xb8')][_0x8fbc('0xb5')][_0x8fbc('0x95')](_0x561e45[_0x8fbc('0xb8')]);return _0x3c9fb6;});})[_0x8fbc('0x20')](function(_0x2d4501){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x8fbc('0xb0')](_0xa30458[_0x8fbc('0x55')]['id'])?undefined:_0xa30458[_0x8fbc('0x55')]['id'],'path':_[_0x8fbc('0xb0')](_0xa30458[_0x8fbc('0x5a')]['attachments'][0x0][_0x8fbc('0x7')])?undefined:_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][0x0][_0x8fbc('0x7')],'fax':_[_0x8fbc('0xb0')](_0xa30458['body']['to'][0x0])?undefined:_0xa30458[_0x8fbc('0x5a')]['to'][0x0],'AttachmentId':_0xa30458[_0x8fbc('0x5a')][_0x8fbc('0xac')][0x0]['id']},client9002)[_0x8fbc('0x20')](function(_0x2219c0){logger[_0x8fbc('0x21')](_0x8fbc('0xb9'),_0x2219c0);})['catch'](function(_0x2673ee){logger[_0x8fbc('0x21')](_0x8fbc('0xb9'),_0x2673ee);});return _0x2d4501;})[_0x8fbc('0x20')](respondWithResult(_0x3cdeff,null))['catch'](handleError(_0x3cdeff,null));};exports[_0x8fbc('0xba')]=function(_0x2a06f0,_0x1e198f,_0x108af2){return db[_0x8fbc('0x40')]['find']({'where':{'id':_0x2a06f0[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x1e198f,null))[_0x8fbc('0x20')](function(_0x55abc8){if(_0x55abc8){return _0x55abc8[_0x8fbc('0xba')](_0x2a06f0[_0x8fbc('0x5a')][_0x8fbc('0x6c')],_['omit'](_0x2a06f0['body'],['ids','id'])||{})[_0x8fbc('0xb7')](function(_0x2bfb42){for(var _0x5def37=0x0;_0x5def37<_0x2a06f0[_0x8fbc('0x5a')][_0x8fbc('0x6c')]['length'];_0x5def37+=0x1){socket[_0x8fbc('0xbb')](_0x8fbc('0xbc'),{'UserId':Number(_0x2a06f0['body'][_0x8fbc('0x6c')][_0x5def37]),'FaxAccountId':Number(_0x2a06f0['params']['id'])});}return _0x2bfb42;});}})['then'](respondWithResult(_0x1e198f,null))['catch'](handleError(_0x1e198f,null));};exports[_0x8fbc('0xbd')]=function(_0x19b4e7,_0x25ae84,_0x2fa046){return db[_0x8fbc('0x40')]['find']({'where':{'id':_0x19b4e7[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x25ae84,null))[_0x8fbc('0x20')](function(_0x28f6cd){if(_0x28f6cd){return _0x28f6cd[_0x8fbc('0xbd')](_0x19b4e7['query'][_0x8fbc('0x6c')])[_0x8fbc('0x20')](function(){if(_[_0x8fbc('0xbe')](_0x19b4e7[_0x8fbc('0x44')][_0x8fbc('0x6c')])){for(var _0x283697=0x0;_0x283697<_0x19b4e7['query'][_0x8fbc('0x6c')]['length'];_0x283697+=0x1){socket[_0x8fbc('0xbb')](_0x8fbc('0xbf'),{'UserId':Number(_0x19b4e7[_0x8fbc('0x44')][_0x8fbc('0x6c')][_0x283697]),'FaxAccountId':Number(_0x19b4e7[_0x8fbc('0x55')]['id'])});}}else{socket['emit'](_0x8fbc('0xbf'),{'UserId':Number(_0x19b4e7[_0x8fbc('0x44')]['ids']),'FaxAccountId':Number(_0x19b4e7[_0x8fbc('0x55')]['id'])});}});}})[_0x8fbc('0x20')](respondWithStatusCode(_0x25ae84,null))[_0x8fbc('0x2a')](handleError(_0x25ae84,null));};exports[_0x8fbc('0xc0')]=function(_0x525948,_0x6140fe,_0x30c5b9){var _0x4a570e={};var _0x177124={};var _0xb17680;var _0x8eb667;return db['FaxAccount']['findOne']({'where':{'id':_0x525948[_0x8fbc('0x55')]['id']}})[_0x8fbc('0x20')](handleEntityNotFound(_0x6140fe,null))['then'](function(_0x515e5e){if(_0x515e5e){_0xb17680=_0x515e5e;_0x177124[_0x8fbc('0x43')]=_[_0x8fbc('0x57')](db[_0x8fbc('0x74')][_0x8fbc('0x56')]);_0x177124['query']=_[_0x8fbc('0x57')](_0x525948[_0x8fbc('0x44')]);_0x177124[_0x8fbc('0x45')]=_['intersection'](_0x177124[_0x8fbc('0x43')],_0x177124[_0x8fbc('0x44')]);_0x4a570e[_0x8fbc('0x47')]=_[_0x8fbc('0x46')](_0x177124[_0x8fbc('0x43')],qs[_0x8fbc('0x48')](_0x525948[_0x8fbc('0x44')][_0x8fbc('0x48')]));_0x4a570e[_0x8fbc('0x47')]=_0x4a570e[_0x8fbc('0x47')][_0x8fbc('0x49')]?_0x4a570e[_0x8fbc('0x47')]:_0x177124[_0x8fbc('0x43')];_0x4a570e[_0x8fbc('0x68')]=qs[_0x8fbc('0x4c')](_0x525948[_0x8fbc('0x44')][_0x8fbc('0x4c')]);_0x4a570e[_0x8fbc('0x4d')]=qs['filters'](_['pick'](_0x525948['query'],_0x177124[_0x8fbc('0x45')]));if(_0x525948[_0x8fbc('0x44')][_0x8fbc('0x4f')]){_0x4a570e[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](_0x4a570e[_0x8fbc('0x4d')],{'$or':_[_0x8fbc('0x3f')](_0x4a570e['attributes'],function(_0x4b5402){var _0x5e8002={};_0x5e8002[_0x4b5402]={'$like':'%'+_0x525948[_0x8fbc('0x44')][_0x8fbc('0x4f')]+'%'};return _0x5e8002;})});}_0x4a570e=_['merge']({},_0x4a570e,_0x525948['options']);return _0xb17680['getAgents'](_0x4a570e);}})[_0x8fbc('0x20')](function(_0x329f30){if(_0x329f30){_0x8eb667=_0x329f30[_0x8fbc('0x49')];if(!_0x525948[_0x8fbc('0x44')][_0x8fbc('0x4a')]('nolimit')){_0x4a570e[_0x8fbc('0x31')]=qs[_0x8fbc('0x31')](_0x525948['query'][_0x8fbc('0x31')]);_0x4a570e[_0x8fbc('0x2f')]=qs[_0x8fbc('0x2f')](_0x525948[_0x8fbc('0x44')][_0x8fbc('0x2f')]);}return _0xb17680[_0x8fbc('0xc0')](_0x4a570e);}})[_0x8fbc('0x20')](function(_0x23d7ef){if(_0x23d7ef){return _0x23d7ef?{'count':_0x8eb667,'rows':_0x23d7ef}:null;}})['then'](respondWithResult(_0x6140fe,null))[_0x8fbc('0x2a')](handleError(_0x6140fe,null));}; \ No newline at end of file +var _0x0618=['CannedAnswer','getAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','root','CheckAfterSend','isNil','from','format','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer'];(function(_0x57e300,_0x527935){var _0x9e16dc=function(_0x4d7344){while(--_0x4d7344){_0x57e300['push'](_0x57e300['shift']());}};_0x9e16dc(++_0x527935);}(_0x0618,0x1ee));var _0x8061=function(_0x1166d3,_0x5b8f38){_0x1166d3=_0x1166d3-0x0;var _0x2b0a5b=_0x0618[_0x1166d3];return _0x2b0a5b;};'use strict';var emlformat=require(_0x8061('0x0'));var rimraf=require(_0x8061('0x1'));var zipdir=require(_0x8061('0x2'));var jsonpatch=require(_0x8061('0x3'));var rp=require('request-promise');var moment=require(_0x8061('0x4'));var BPromise=require(_0x8061('0x5'));var Mustache=require(_0x8061('0x6'));var util=require(_0x8061('0x7'));var path=require(_0x8061('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8061('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8061('0xa'));var squel=require(_0x8061('0xb'));var crypto=require(_0x8061('0xc'));var jsforce=require(_0x8061('0xd'));var deskjs=require(_0x8061('0xe'));var toCsv=require(_0x8061('0xf'));var querystring=require(_0x8061('0x10'));var Papa=require(_0x8061('0x11'));var Redis=require(_0x8061('0x12'));var authService=require(_0x8061('0x13'));var qs=require(_0x8061('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8061('0x15'));var logger=require(_0x8061('0x16'))(_0x8061('0x17'));var utils=require(_0x8061('0x18'));var config=require(_0x8061('0x19'));var licenseUtil=require(_0x8061('0x1a'));var db=require(_0x8061('0x1b'))['db'];config[_0x8061('0x1c')]=_[_0x8061('0x1d')](config[_0x8061('0x1c')],{'host':_0x8061('0x1e'),'port':0x18eb});var socket=require(_0x8061('0x1f'))(new Redis(config['redis']));require(_0x8061('0x20'))['register'](socket);var jayson=require(_0x8061('0x21'));var client=jayson[_0x8061('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x8061('0x22')][_0x8061('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2974fc,_0x2936ee,_0x44fdd5,_0x4b1771){return new BPromise(function(_0x85c29c,_0x438ccb){var _0x2278af=_0x4b1771||client;return _0x2278af[_0x8061('0x24')](_0x2974fc,_0x44fdd5)[_0x8061('0x25')](function(_0x26a094){logger[_0x8061('0x26')]('FaxAccount,\x20%s,\x20%s',_0x2936ee,_0x8061('0x27'));logger[_0x8061('0x28')](_0x8061('0x29'),_0x2936ee,_0x8061('0x27'),JSON[_0x8061('0x2a')](_0x26a094));if(_0x26a094[_0x8061('0x2b')]){if(_0x26a094[_0x8061('0x2b')]['code']===0x1f4){logger['error'](_0x8061('0x2c'),_0x2936ee,_0x26a094[_0x8061('0x2b')]['message']);return _0x438ccb(_0x26a094['error'][_0x8061('0x2d')]);}logger[_0x8061('0x2b')](_0x8061('0x2c'),_0x2936ee,_0x26a094[_0x8061('0x2b')][_0x8061('0x2d')]);return _0x85c29c(_0x26a094['error'][_0x8061('0x2d')]);}else{logger[_0x8061('0x26')](_0x8061('0x2c'),_0x2936ee,'request\x20sent');_0x85c29c(_0x26a094[_0x8061('0x2e')][_0x8061('0x2d')]);}})['catch'](function(_0x53c312){logger[_0x8061('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x2936ee,_0x53c312);_0x438ccb(_0x53c312);});});}function respondWithStatusCode(_0x93832,_0x365d30){_0x365d30=_0x365d30||0xcc;return function(_0x3d19be){if(_0x3d19be){return _0x93832[_0x8061('0x2f')](_0x365d30);}return _0x93832[_0x8061('0x30')](_0x365d30)[_0x8061('0x31')]();};}function respondWithResult(_0x1978a5,_0x32bdef){_0x32bdef=_0x32bdef||0xc8;return function(_0x5ccd56){if(_0x5ccd56){return _0x1978a5[_0x8061('0x30')](_0x32bdef)[_0x8061('0x32')](_0x5ccd56);}};}function respondWithFilteredResult(_0xfa2988,_0x1e0c6a){return function(_0x8a4fa9){if(_0x8a4fa9){var _0x151a5a=typeof _0x1e0c6a[_0x8061('0x33')]===_0x8061('0x34')&&typeof _0x1e0c6a[_0x8061('0x35')]===_0x8061('0x34');var _0x3974d4=_0x8a4fa9['count'];var _0x3b4c62=_0x151a5a?0x0:_0x1e0c6a[_0x8061('0x33')];var _0x11f9c0=_0x151a5a?_0x8a4fa9[_0x8061('0x36')]:_0x1e0c6a[_0x8061('0x33')]+_0x1e0c6a[_0x8061('0x35')];var _0x12c334;if(_0x11f9c0>=_0x3974d4){_0x11f9c0=_0x3974d4;_0x12c334=0xc8;}else{_0x12c334=0xce;}_0xfa2988[_0x8061('0x30')](_0x12c334);return _0xfa2988[_0x8061('0x37')](_0x8061('0x38'),_0x3b4c62+'-'+_0x11f9c0+'/'+_0x3974d4)['json'](_0x8a4fa9);}return null;};}function patchUpdates(_0x569654){return function(_0x5c53c0){try{jsonpatch[_0x8061('0x39')](_0x5c53c0,_0x569654,!![]);}catch(_0x4a9014){return BPromise['reject'](_0x4a9014);}return _0x5c53c0[_0x8061('0x3a')]();};}function saveUpdates(_0x118235,_0x3c083b){return function(_0x4f5fca){if(_0x4f5fca){return _0x4f5fca[_0x8061('0x3b')](_0x118235)['then'](function(_0x3ed83f){return _0x3ed83f;});}return null;};}function removeEntity(_0x58fe49,_0x543878){return function(_0x4fbe6c){if(_0x4fbe6c){return _0x4fbe6c['destroy']()[_0x8061('0x25')](function(){var _0x18b0bc=_0x4fbe6c[_0x8061('0x3c')]({'plain':!![]});var _0x5058a7=_0x8061('0x3d');return db[_0x8061('0x3e')][_0x8061('0x3f')]({'where':{'type':_0x5058a7,'resourceId':_0x18b0bc['id']}})[_0x8061('0x25')](function(){return _0x4fbe6c;});})['then'](function(){_0x58fe49['status'](0xcc)[_0x8061('0x31')]();});}};}function handleEntityNotFound(_0xfb9c08,_0x593a1c){return function(_0x18c25a){if(!_0x18c25a){_0xfb9c08[_0x8061('0x2f')](0x194);}return _0x18c25a;};}function handleError(_0x428e8f,_0x1b2154){_0x1b2154=_0x1b2154||0x1f4;return function(_0x2270db){logger['error'](_0x2270db[_0x8061('0x40')]);if(_0x2270db[_0x8061('0x41')]){delete _0x2270db['name'];}_0x428e8f['status'](_0x1b2154)[_0x8061('0x42')](_0x2270db);};}exports[_0x8061('0x43')]=function(_0x3a73d2,_0x3143ab){var _0x551ed3={'include':[{'model':db[_0x8061('0x44')],'as':'mandatoryDispositionPause'}]},_0x357c93={},_0x32a089={'count':0x0,'rows':[]};var _0x527e3a=_['map'](db[_0x8061('0x45')][_0x8061('0x46')],function(_0x2c6839){return{'name':_0x2c6839[_0x8061('0x47')],'type':_0x2c6839[_0x8061('0x48')][_0x8061('0x49')]};});_0x357c93['model']=_[_0x8061('0x4a')](_0x527e3a,_0x8061('0x41'));_0x357c93[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x3a73d2[_0x8061('0x4b')]);_0x357c93['filters']=_[_0x8061('0x4d')](_0x357c93[_0x8061('0x4e')],_0x357c93[_0x8061('0x4b')]);_0x551ed3[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x357c93['model'],qs[_0x8061('0x50')](_0x3a73d2['query'][_0x8061('0x50')]));_0x551ed3[_0x8061('0x4f')]=_0x551ed3['attributes'][_0x8061('0x51')]?_0x551ed3[_0x8061('0x4f')]:_0x357c93[_0x8061('0x4e')];if(!_0x3a73d2[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x551ed3[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x3a73d2[_0x8061('0x4b')]['limit']);_0x551ed3[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x3a73d2[_0x8061('0x4b')][_0x8061('0x33')]);}_0x551ed3['order']=qs['sort'](_0x3a73d2[_0x8061('0x4b')]['sort']);_0x551ed3[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x3a73d2['query'],_0x357c93[_0x8061('0x55')]),_0x527e3a);if(_0x3a73d2[_0x8061('0x4b')]['filter']){_0x551ed3[_0x8061('0x54')]=_['merge'](_0x551ed3[_0x8061('0x54')],{'$or':_['map'](_0x527e3a,function(_0x5d6de0){if(_0x5d6de0[_0x8061('0x48')]!=='VIRTUAL'){var _0x46a7a0={};_0x46a7a0[_0x5d6de0[_0x8061('0x41')]]={'$like':'%'+_0x3a73d2['query'][_0x8061('0x57')]+'%'};return _0x46a7a0;}})});}_0x551ed3=_[_0x8061('0x58')]({},_0x551ed3,_0x3a73d2['options']);var _0x19dc95={'where':_0x551ed3[_0x8061('0x54')]};return db[_0x8061('0x45')]['count'](_0x19dc95)['then'](function(_0x589259){_0x32a089[_0x8061('0x36')]=_0x589259;if(_0x3a73d2['query'][_0x8061('0x59')]){_0x551ed3[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0x45')][_0x8061('0x5b')](_0x551ed3);})['then'](function(_0x53222c){_0x32a089['rows']=_0x53222c;return _0x32a089;})[_0x8061('0x25')](respondWithFilteredResult(_0x3143ab,_0x551ed3))[_0x8061('0x5c')](handleError(_0x3143ab,null));};exports[_0x8061('0x5d')]=function(_0xa2cbe,_0x5d7787){var _0x6a4cd2={'raw':![],'where':{'id':_0xa2cbe[_0x8061('0x5e')]['id']},'include':[{'model':db[_0x8061('0x44')],'as':_0x8061('0x5f')}]},_0x1f99dd={};_0x1f99dd['model']=_[_0x8061('0x4c')](db[_0x8061('0x45')]['rawAttributes']);_0x1f99dd['query']=_[_0x8061('0x4c')](_0xa2cbe[_0x8061('0x4b')]);_0x1f99dd[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x1f99dd[_0x8061('0x4e')],_0x1f99dd[_0x8061('0x4b')]);_0x6a4cd2['attributes']=_[_0x8061('0x4d')](_0x1f99dd[_0x8061('0x4e')],qs[_0x8061('0x50')](_0xa2cbe[_0x8061('0x4b')][_0x8061('0x50')]));_0x6a4cd2[_0x8061('0x4f')]=_0x6a4cd2[_0x8061('0x4f')][_0x8061('0x51')]?_0x6a4cd2['attributes']:_0x1f99dd['model'];if(_0xa2cbe[_0x8061('0x4b')][_0x8061('0x59')]){_0x6a4cd2[_0x8061('0x5a')]=[{'all':!![]}];}_0x6a4cd2=_[_0x8061('0x58')]({},_0x6a4cd2,_0xa2cbe[_0x8061('0x60')]);return db[_0x8061('0x45')][_0x8061('0x61')](_0x6a4cd2)[_0x8061('0x25')](handleEntityNotFound(_0x5d7787,null))[_0x8061('0x25')](respondWithResult(_0x5d7787,null))[_0x8061('0x5c')](handleError(_0x5d7787,null));};exports['create']=function(_0x5924c9,_0x3fb434){return db[_0x8061('0x45')][_0x8061('0x62')](_0x5924c9[_0x8061('0x63')],{})[_0x8061('0x25')](function(_0x31b7c4){var _0x1e3e0c=_0x5924c9[_0x8061('0x64')][_0x8061('0x3c')]({'plain':!![]});if(!_0x1e3e0c)throw new Error(_0x8061('0x65'));if(_0x1e3e0c[_0x8061('0x66')]===_0x8061('0x64')){var _0x3ffa9d=_0x31b7c4[_0x8061('0x3c')]({'plain':!![]});var _0x7893b6=_0x8061('0x3d');return db[_0x8061('0x67')][_0x8061('0x61')]({'where':{'name':_0x7893b6,'userProfileId':_0x1e3e0c['userProfileId']},'raw':!![]})[_0x8061('0x25')](function(_0x348bcc){if(_0x348bcc&&_0x348bcc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ffa9d[_0x8061('0x41')],'resourceId':_0x3ffa9d['id'],'type':_0x348bcc[_0x8061('0x41')],'sectionId':_0x348bcc['id']},{})[_0x8061('0x25')](function(){return _0x31b7c4;});}else{return _0x31b7c4;}})['catch'](function(_0x5a9906){logger[_0x8061('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a9906);throw _0x5a9906;});}return _0x31b7c4;})[_0x8061('0x25')](respondWithResult(_0x3fb434,0xc9))[_0x8061('0x5c')](handleError(_0x3fb434,null));};exports[_0x8061('0x3b')]=function(_0x2453d2,_0x4b9543){if(_0x2453d2[_0x8061('0x63')]['id']){delete _0x2453d2[_0x8061('0x63')]['id'];}return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x2453d2[_0x8061('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x8061('0x5f')}]})[_0x8061('0x25')](handleEntityNotFound(_0x4b9543,null))[_0x8061('0x25')](saveUpdates(_0x2453d2[_0x8061('0x63')],null))[_0x8061('0x25')](respondWithResult(_0x4b9543,null))[_0x8061('0x5c')](handleError(_0x4b9543,null));};exports[_0x8061('0x3f')]=function(_0x431d2b,_0x59c09e){return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x431d2b[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x59c09e,null))[_0x8061('0x25')](removeEntity(_0x59c09e,null))[_0x8061('0x5c')](handleError(_0x59c09e,null));};exports['describe']=function(_0x38657f,_0x465977){return db['FaxAccount'][_0x8061('0x68')]()[_0x8061('0x25')](respondWithResult(_0x465977,null))[_0x8061('0x5c')](handleError(_0x465977,null));};exports[_0x8061('0x69')]=function(_0x3160d8,_0x1fbd5c,_0x45a11a){if(_0x3160d8[_0x8061('0x63')]['id']){delete _0x3160d8['body']['id'];}return db['FaxAccount'][_0x8061('0x61')]({'where':{'id':_0x3160d8['params']['id']}})['then'](handleEntityNotFound(_0x1fbd5c,null))[_0x8061('0x25')](function(_0x554aac){if(_0x554aac){_0x3160d8[_0x8061('0x63')][_0x8061('0x6a')]=_0x554aac['id'];return db[_0x8061('0x6b')][_0x8061('0x62')](_0x3160d8[_0x8061('0x63')]);}})['then'](respondWithResult(_0x1fbd5c,null))['catch'](handleError(_0x1fbd5c,null));};exports[_0x8061('0x6c')]=function(_0x16988e,_0x17b571,_0x29814c){var _0x459f59={'raw':![],'where':{}};var _0x1e29f5={};var _0xbf0da1={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x16988e['params']['id']}})['then'](handleEntityNotFound(_0x17b571,null))[_0x8061('0x25')](function(_0xcb1f6f){if(_0xcb1f6f){_0x1e29f5[_0x8061('0x4e')]=_['keys'](db[_0x8061('0x6b')]['rawAttributes']);_0x1e29f5['query']=_[_0x8061('0x4c')](_0x16988e[_0x8061('0x4b')]);_0x1e29f5[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x1e29f5[_0x8061('0x4e')],_0x1e29f5['query']);_0x459f59['attributes']=_[_0x8061('0x4d')](_0x1e29f5['model'],qs[_0x8061('0x50')](_0x16988e[_0x8061('0x4b')][_0x8061('0x50')]));_0x459f59['attributes']=_0x459f59['attributes'][_0x8061('0x51')]?_0x459f59[_0x8061('0x4f')]:_0x1e29f5[_0x8061('0x4e')];if(!_0x16988e[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x459f59[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x16988e['query'][_0x8061('0x35')]);_0x459f59[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x16988e[_0x8061('0x4b')][_0x8061('0x33')]);}_0x459f59[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x16988e[_0x8061('0x4b')]['sort']);_0x459f59[_0x8061('0x54')]=qs[_0x8061('0x55')](_['pick'](_0x16988e['query'],_0x1e29f5['filters']));_0x459f59[_0x8061('0x54')]['FaxAccountId']=_0xcb1f6f['id'];if(_0x16988e[_0x8061('0x4b')][_0x8061('0x57')]){_0x459f59[_0x8061('0x54')]=_[_0x8061('0x58')](_0x459f59[_0x8061('0x54')],{'$or':_['map'](_0x459f59[_0x8061('0x4f')],function(_0x21d659){var _0x37d2a0={};_0x37d2a0[_0x21d659]={'$like':'%'+_0x16988e[_0x8061('0x4b')]['filter']+'%'};return _0x37d2a0;})});}_0x459f59=_[_0x8061('0x58')]({},_0x459f59,_0x16988e[_0x8061('0x60')]);return db['Disposition'][_0x8061('0x36')]({'where':_0x459f59['where']})['then'](function(_0x3fa077){_0xbf0da1['count']=_0x3fa077;if(_0x16988e[_0x8061('0x4b')]['includeAll']){_0x459f59['include']=[{'all':!![]}];}return db[_0x8061('0x6b')][_0x8061('0x5b')](_0x459f59);})[_0x8061('0x25')](function(_0x99888c){_0xbf0da1['rows']=_0x99888c;return _0xbf0da1;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x17b571,_0x459f59))[_0x8061('0x5c')](handleError(_0x17b571,null));};exports[_0x8061('0x70')]=function(_0x38e738,_0x104a3a,_0x183fef){return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x38e738[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x104a3a,null))['then'](function(_0x2274e7){if(_0x2274e7){return _0x2274e7['removeDispositions'](_0x38e738['query'][_0x8061('0x71')]);}})['then'](respondWithStatusCode(_0x104a3a,null))['catch'](handleError(_0x104a3a,null));};exports[_0x8061('0x72')]=function(_0x1ced8e,_0x4bbf39,_0x5e5d68){if(_0x1ced8e[_0x8061('0x63')]['id']){delete _0x1ced8e[_0x8061('0x63')]['id'];}return db[_0x8061('0x45')]['find']({'where':{'id':_0x1ced8e[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x4bbf39,null))[_0x8061('0x25')](function(_0x274f60){if(_0x274f60){_0x1ced8e[_0x8061('0x63')][_0x8061('0x6a')]=_0x274f60['id'];return db[_0x8061('0x73')][_0x8061('0x62')](_0x1ced8e[_0x8061('0x63')]);}})[_0x8061('0x25')](respondWithResult(_0x4bbf39,null))[_0x8061('0x5c')](handleError(_0x4bbf39,null));};exports[_0x8061('0x74')]=function(_0x235a64,_0x442084,_0x56a2f8){var _0x20a6c7={'raw':![],'where':{}};var _0x574732={};var _0x1c5ed1={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x235a64['params']['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x442084,null))['then'](function(_0x3ccd4a){if(_0x3ccd4a){_0x574732[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x73')]['rawAttributes']);_0x574732['query']=_['keys'](_0x235a64[_0x8061('0x4b')]);_0x574732[_0x8061('0x55')]=_['intersection'](_0x574732[_0x8061('0x4e')],_0x574732[_0x8061('0x4b')]);_0x20a6c7[_0x8061('0x4f')]=_['intersection'](_0x574732[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x235a64[_0x8061('0x4b')][_0x8061('0x50')]));_0x20a6c7[_0x8061('0x4f')]=_0x20a6c7[_0x8061('0x4f')][_0x8061('0x51')]?_0x20a6c7[_0x8061('0x4f')]:_0x574732['model'];if(!_0x235a64['query'][_0x8061('0x52')]('nolimit')){_0x20a6c7[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x235a64['query']['limit']);_0x20a6c7[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x235a64['query'][_0x8061('0x33')]);}_0x20a6c7[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x235a64[_0x8061('0x4b')]['sort']);_0x20a6c7[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x235a64[_0x8061('0x4b')],_0x574732[_0x8061('0x55')]));_0x20a6c7[_0x8061('0x54')][_0x8061('0x6a')]=_0x3ccd4a['id'];if(_0x235a64[_0x8061('0x4b')][_0x8061('0x57')]){_0x20a6c7['where']=_[_0x8061('0x58')](_0x20a6c7[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x20a6c7[_0x8061('0x4f')],function(_0x35a02e){var _0x396ee8={};_0x396ee8[_0x35a02e]={'$like':'%'+_0x235a64[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x396ee8;})});}_0x20a6c7=_[_0x8061('0x58')]({},_0x20a6c7,_0x235a64['options']);return db[_0x8061('0x73')][_0x8061('0x36')]({'where':_0x20a6c7[_0x8061('0x54')]})[_0x8061('0x25')](function(_0x1dda5a){_0x1c5ed1['count']=_0x1dda5a;if(_0x235a64[_0x8061('0x4b')][_0x8061('0x59')]){_0x20a6c7[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0x73')][_0x8061('0x5b')](_0x20a6c7);})[_0x8061('0x25')](function(_0x54a826){_0x1c5ed1['rows']=_0x54a826;return _0x1c5ed1;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x442084,_0x20a6c7))[_0x8061('0x5c')](handleError(_0x442084,null));};exports['removeAnswers']=function(_0xd71d2f,_0x5909b3,_0x34899f){return db[_0x8061('0x45')]['find']({'where':{'id':_0xd71d2f[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x5909b3,null))[_0x8061('0x25')](function(_0x19c901){if(_0x19c901){return _0x19c901['removeAnswers'](_0xd71d2f[_0x8061('0x4b')][_0x8061('0x71')]);}})[_0x8061('0x25')](respondWithStatusCode(_0x5909b3,null))[_0x8061('0x5c')](handleError(_0x5909b3,null));};exports[_0x8061('0x75')]=function(_0x40209f,_0x5bad0f,_0x131c33){return db[_0x8061('0x76')][_0x8061('0x61')]({'where':{'id':_0x40209f['params']['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x5bad0f,null))[_0x8061('0x25')](function(_0x1fb76d){if(_0x1fb76d){return _0x1fb76d[_0x8061('0x75')](_0x40209f['body'][_0x8061('0x71')],_[_0x8061('0x77')](_0x40209f['body'],[_0x8061('0x71'),'id'])||{});}})['then'](respondWithResult(_0x5bad0f,null))[_0x8061('0x5c')](handleError(_0x5bad0f,null));};exports[_0x8061('0x78')]=function(_0x125969,_0x6daafb,_0x2923d2){var _0x56081e={'raw':![],'where':{}};var _0x29bf50={};var _0x1d531c={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x125969['params']['id']}})['then'](handleEntityNotFound(_0x6daafb,null))[_0x8061('0x25')](function(_0x43fc62){if(_0x43fc62){_0x29bf50[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x76')][_0x8061('0x46')]);_0x29bf50[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x125969['query']);_0x29bf50[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x29bf50[_0x8061('0x4e')],_0x29bf50[_0x8061('0x4b')]);_0x56081e[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x29bf50[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x125969[_0x8061('0x4b')][_0x8061('0x50')]));_0x56081e['attributes']=_0x56081e[_0x8061('0x4f')][_0x8061('0x51')]?_0x56081e[_0x8061('0x4f')]:_0x29bf50['model'];if(!_0x125969[_0x8061('0x4b')][_0x8061('0x52')]('nolimit')){_0x56081e['limit']=qs[_0x8061('0x35')](_0x125969[_0x8061('0x4b')][_0x8061('0x35')]);_0x56081e[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x125969[_0x8061('0x4b')]['offset']);}_0x56081e[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x125969[_0x8061('0x4b')][_0x8061('0x6f')]);_0x56081e['where']=qs[_0x8061('0x55')](_['pick'](_0x125969[_0x8061('0x4b')],_0x29bf50[_0x8061('0x55')]));_0x56081e['where'][_0x8061('0x6a')]=_0x43fc62['id'];if(_0x125969[_0x8061('0x4b')][_0x8061('0x57')]){_0x56081e[_0x8061('0x54')]=_[_0x8061('0x58')](_0x56081e[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x56081e[_0x8061('0x4f')],function(_0xfd06b3){var _0x255a6f={};_0x255a6f[_0xfd06b3]={'$like':'%'+_0x125969[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x255a6f;})});}_0x56081e=_[_0x8061('0x58')]({},_0x56081e,_0x125969[_0x8061('0x60')]);return db['FaxInteraction'][_0x8061('0x36')]({'where':_0x56081e['where']})[_0x8061('0x25')](function(_0x37891f){_0x1d531c[_0x8061('0x36')]=_0x37891f;if(_0x125969[_0x8061('0x4b')][_0x8061('0x59')]){_0x56081e[_0x8061('0x5a')]=[{'model':db[_0x8061('0x79')],'as':'Contact','required':![]},{'model':db[_0x8061('0x7a')],'as':_0x8061('0x7b'),'attributes':['name',_0x8061('0x7c'),_0x8061('0x7d')],'required':![]},{'model':db[_0x8061('0x7e')],'as':_0x8061('0x7f'),'attributes':['id','name',_0x8061('0x80')],'where':_0x125969[_0x8061('0x4b')]['tag']?{'id':_0x125969[_0x8061('0x4b')][_0x8061('0x81')]}:undefined,'required':_0x125969[_0x8061('0x4b')]['tag']?!![]:![]}];}return db[_0x8061('0x76')][_0x8061('0x5b')](_0x56081e);})[_0x8061('0x25')](function(_0x4f1485){_0x1d531c['rows']=_0x4f1485;return _0x1d531c;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x6daafb,_0x56081e))['catch'](handleError(_0x6daafb,null));};exports[_0x8061('0x82')]=function(_0x5dc213,_0x407adc){var _0x47e036=_0x5dc213['params']['id'];var _0x25c636=_0x5dc213[_0x8061('0x63')];var _0x546965=0xc8;var _0x47728f=null;return db[_0x8061('0x83')][_0x8061('0x84')]({'isolationLevel':db[_0x8061('0x83')]['Transaction'][_0x8061('0x85')]['READ_COMMITTED']},function(_0x54c7bf){return db['FaxAccount']['findOne']({'where':{'id':_0x47e036},'transaction':_0x54c7bf})[_0x8061('0x25')](function(_0x3ab269){if(_0x3ab269){return db[_0x8061('0x86')][_0x8061('0x3f')]({'where':{'FaxAccountId':_0x47e036},'transaction':_0x54c7bf})['then'](function(){var _0x278a93=_[_0x8061('0x4a')](_0x25c636,function(_0x46fa99){_0x46fa99[_0x8061('0x6a')]=_0x47e036;return _0x46fa99;});return db[_0x8061('0x86')][_0x8061('0x87')](_0x278a93,{'transaction':_0x54c7bf});});}else{_0x546965=0x194;_0x47728f=[];}});})[_0x8061('0x25')](function(){if(_0x546965!==0x194){return db[_0x8061('0x86')][_0x8061('0x88')]({'where':{'FaxAccountId':_0x47e036},'order':_0x8061('0x89')})['then'](function(_0x1ee840){_0x47728f=_0x1ee840;});}})[_0x8061('0x5c')](function(_0x21b028){_0x546965=0x1f4;logger[_0x8061('0x2b')](_0x21b028[_0x8061('0x40')]);if(_0x21b028[_0x8061('0x41')]){delete _0x21b028[_0x8061('0x41')];}_0x47728f=_0x21b028;})[_0x8061('0x8a')](function(){if(_0x47728f===null){_0x407adc[_0x8061('0x2f')](_0x546965);}else{if(_0x546965===0x1f4){_0x407adc[_0x8061('0x30')](_0x546965)[_0x8061('0x42')](_0x47728f);}else{_0x407adc[_0x8061('0x30')](_0x546965)[_0x8061('0x32')](_0x47728f);}}});};exports[_0x8061('0x8b')]=function(_0x2ab4a9,_0x36b1a,_0x28b864){var _0x4ebcb0={};var _0x1b89ca={};var _0x1a49ca;var _0x4af02b;return db['FaxAccount']['findOne']({'where':{'id':_0x2ab4a9[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x36b1a,null))[_0x8061('0x25')](function(_0x593eae){if(_0x593eae){_0x1a49ca=_0x593eae;_0x1b89ca[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x86')][_0x8061('0x46')]);_0x1b89ca[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x2ab4a9[_0x8061('0x4b')]);_0x1b89ca['filters']=_['intersection'](_0x1b89ca[_0x8061('0x4e')],_0x1b89ca[_0x8061('0x4b')]);_0x4ebcb0['attributes']=_[_0x8061('0x4d')](_0x1b89ca[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x50')]));_0x4ebcb0[_0x8061('0x4f')]=_0x4ebcb0[_0x8061('0x4f')]['length']?_0x4ebcb0[_0x8061('0x4f')]:_0x1b89ca[_0x8061('0x4e')];_0x4ebcb0[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x6f')]);_0x4ebcb0[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x2ab4a9[_0x8061('0x4b')],_0x1b89ca['filters']));if(_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x57')]){_0x4ebcb0[_0x8061('0x54')]=_['merge'](_0x4ebcb0[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x4ebcb0[_0x8061('0x4f')],function(_0x3016f0){var _0x1a8de2={};_0x1a8de2[_0x3016f0]={'$like':'%'+_0x2ab4a9['query']['filter']+'%'};return _0x1a8de2;})});}_0x4ebcb0=_[_0x8061('0x58')]({},_0x4ebcb0,_0x2ab4a9[_0x8061('0x60')]);return _0x1a49ca[_0x8061('0x8b')](_0x4ebcb0);}})[_0x8061('0x25')](function(_0x24c8f1){if(_0x24c8f1){_0x4af02b=_0x24c8f1['length'];if(!_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x4ebcb0[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x35')]);_0x4ebcb0[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x33')]);}return _0x1a49ca['getApplications'](_0x4ebcb0);}})[_0x8061('0x25')](function(_0x21c54b){if(_0x21c54b){return _0x21c54b?{'count':_0x4af02b,'rows':_0x21c54b}:null;}})[_0x8061('0x25')](respondWithResult(_0x36b1a,null))[_0x8061('0x5c')](handleError(_0x36b1a,null));};function Extension(_0x121175,_0xcbc687,_0x13735a,_0x150baf){this[_0x8061('0x8c')]=_0x8061('0x8d');this[_0x8061('0x8e')]=_0x121175[_0x8061('0x8f')];this['app']=_0x150baf;this['type']='system';this[_0x8061('0x90')]=_0x8061('0x91');this[_0x8061('0x6a')]=_0x121175['id'];this[_0x8061('0x89')]=_0xcbc687;this[_0x8061('0x92')]=_0x13735a;}function createExtensionsReciveFax(_0x35240a){var _0x37eff4=0x1;var _0x5d3acc=[];_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'',_0x8061('0x94')));_0x37eff4+=0x1;_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'CDR(type)=inbound-fax',_0x8061('0x95')));_0x37eff4+=0x1;for(var _0x2ca6fe in _0x35240a){if(_0x35240a[_0x8061('0x52')](_0x2ca6fe)&&(_0x2ca6fe===_0x8061('0x96')||_0x2ca6fe===_0x8061('0x8f')||_0x2ca6fe===_0x8061('0x97')||_0x2ca6fe==='faxdetect'||_0x2ca6fe===_0x8061('0x98')||_0x2ca6fe===_0x8061('0x99')||_0x2ca6fe===_0x8061('0x9a')||_0x2ca6fe===_0x8061('0x9b')||_0x2ca6fe===_0x8061('0x9c'))){_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,_0x8061('0x9d')+_0x2ca6fe+')='+_0x35240a[_0x2ca6fe],_0x8061('0x95')));_0x37eff4+=0x1;}}_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'6',_0x8061('0x9e')));_0x37eff4+=0x1;_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,_0x8061('0x9f'),_0x8061('0xa0')));_0x37eff4=0x0;return _0x5d3acc;}exports[_0x8061('0xa1')]=function(_0x2132df,_0x4ffbaa,_0x3cf730){var _0x1de562;return db['sequelize']['transaction'](function(_0x58b08e){return db[_0x8061('0x45')][_0x8061('0x62')](_0x2132df[_0x8061('0x63')],{'transaction':_0x58b08e})[_0x8061('0x25')](function(_0x1e228d){_0x1de562=_0x1e228d[_0x8061('0x3c')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1de562),{'transaction':_0x58b08e});});})[_0x8061('0x25')](function(){return _0x1de562;})['then'](respondWithResult(_0x4ffbaa,null))[_0x8061('0x5c')](handleError(_0x4ffbaa,null));};exports[_0x8061('0xa2')]=function(_0x25db2c,_0x54ca38,_0x49d841){var _0x1a88dc;return db[_0x8061('0x83')]['transaction'](function(_0x2d2dad){return db[_0x8061('0x45')]['update'](_0x25db2c[_0x8061('0x63')],{'where':{'id':_0x25db2c[_0x8061('0x63')]['id']},'transaction':_0x2d2dad})['then'](function(_0x488ec9){return db[_0x8061('0xa3')][_0x8061('0x3f')]({'where':{'FaxAccountId':_0x25db2c[_0x8061('0x63')]['id']},'transaction':_0x2d2dad})[_0x8061('0x25')](function(_0x26c7dc){return db[_0x8061('0xa3')]['bulkCreate'](createExtensionsReciveFax(_[_0x8061('0x77')](_0x25db2c[_0x8061('0x63')],['tech','key',_0x8061('0xa4'),'updatedAt',_0x8061('0xa5'),_0x8061('0xa6')])),{'transaction':_0x2d2dad});});});})['then'](function(){return db[_0x8061('0x45')][_0x8061('0xa7')](_0x25db2c[_0x8061('0x63')]['id']);})[_0x8061('0x25')](respondWithResult(_0x54ca38,null))[_0x8061('0x5c')](handleError(_0x54ca38,null));};exports[_0x8061('0xa8')]=function(_0x5ced0b,_0xf1eb5c,_0x16aee3){var _0x549edb={'raw':!![],'where':{}};var _0x572169={};var _0x339d11={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x5ced0b[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0xf1eb5c,null))[_0x8061('0x25')](function(_0x4c56f3){if(_0x4c56f3){_0x572169['model']=_['keys'](db[_0x8061('0xa9')]['rawAttributes']);_0x572169[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x5ced0b['query']);_0x572169['filters']=_['intersection'](_0x572169[_0x8061('0x4e')],_0x572169[_0x8061('0x4b')]);_0x549edb[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x572169[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x5ced0b[_0x8061('0x4b')][_0x8061('0x50')]));_0x549edb[_0x8061('0x4f')]=_0x549edb['attributes']['length']?_0x549edb[_0x8061('0x4f')]:_0x572169[_0x8061('0x4e')];if(!_0x5ced0b[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x549edb[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x5ced0b[_0x8061('0x4b')][_0x8061('0x35')]);_0x549edb[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x5ced0b[_0x8061('0x4b')]['offset']);}_0x549edb[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x5ced0b[_0x8061('0x4b')]['sort']);_0x549edb[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x5ced0b[_0x8061('0x4b')],_0x572169[_0x8061('0x55')]));_0x549edb[_0x8061('0x54')][_0x8061('0x6a')]=_0x4c56f3['id'];if(_0x5ced0b[_0x8061('0x4b')][_0x8061('0x57')]){_0x549edb[_0x8061('0x54')]=_[_0x8061('0x58')](_0x549edb[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x549edb[_0x8061('0x4f')],function(_0x271873){var _0x2cd3d7={};_0x2cd3d7[_0x271873]={'$like':'%'+_0x5ced0b[_0x8061('0x4b')]['filter']+'%'};return _0x2cd3d7;})});}if(_0x5ced0b['query'][_0x8061('0xaa')]){var _0x185b19=_0x5ced0b[_0x8061('0x4b')][_0x8061('0xaa')][_0x8061('0xab')](',');var _0x19cd35={};_0x19cd35[_0x185b19[0x0]]={'$gte':moment(_0x185b19[0x1])['format'](_0x8061('0xac'))};_0x549edb[_0x8061('0x54')]=_[_0x8061('0x58')](_0x549edb[_0x8061('0x54')],_0x19cd35);}_0x549edb=_[_0x8061('0x58')]({},_0x549edb,_0x5ced0b[_0x8061('0x60')]);return db[_0x8061('0xa9')]['count']({'where':_0x549edb[_0x8061('0x54')]})[_0x8061('0x25')](function(_0x807bc0){_0x339d11[_0x8061('0x36')]=_0x807bc0;if(_0x5ced0b[_0x8061('0x4b')][_0x8061('0x59')]){_0x549edb[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0xa9')][_0x8061('0x5b')](_0x549edb);})[_0x8061('0x25')](function(_0x439c23){_0x339d11['rows']=_0x439c23;return _0x339d11;});}})[_0x8061('0x25')](respondWithFilteredResult(_0xf1eb5c,_0x549edb))[_0x8061('0x5c')](handleError(_0xf1eb5c,null));};exports['send']=function(_0x39186b,_0x5f3b9f,_0x3c6bb5){var _0xd43ee0,_0x534deb={},_0x4af2ec;if(_0x39186b[_0x8061('0x63')]['to']){_0x4af2ec=_0x39186b[_0x8061('0x63')]['to'][0x0];}return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x39186b['params']['id']},'include':[{'model':db[_0x8061('0xad')],'as':_0x8061('0xae'),'include':[{'model':db[_0x8061('0x79')],'as':'Contacts','where':{'fax':_0x4af2ec},'limit':0x1,'order':[[_0x8061('0xaf'),_0x8061('0xb0')]]}]}]})[_0x8061('0x25')](handleEntityNotFound(_0x5f3b9f,null))[_0x8061('0x25')](function(_0x12c74d){_0xd43ee0=_0x12c74d;if(_0x39186b['body'][_0x8061('0xb1')]&&_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x8061('0x51')]){for(var _0x4cea1c=0x0;_0x4cea1c<_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x8061('0x51')];_0x4cea1c+=0x1){_0x39186b[_0x8061('0x63')]['attachments'][_0x4cea1c]={'filename':_0x39186b['body'][_0x8061('0xb1')][_0x4cea1c][_0x8061('0x41')],'id':_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x4cea1c]['id'],'path':path[_0x8061('0xb2')](config[_0x8061('0xb3')],'server/files/attachments',_0x39186b[_0x8061('0x63')]['attachments'][_0x4cea1c]['basename'])};}}return respondWithRpcPromise(_0x8061('0xb4'),_0x8061('0xb4'),{'FaxAccountId':_['isNil'](_0x39186b['params']['id'])?undefined:_0x39186b[_0x8061('0x5e')]['id'],'path':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['attachments'][0x0][_0x8061('0x8')])?undefined:_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0][_0x8061('0x8')],'fax':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['to'][0x0])?undefined:_0x39186b[_0x8061('0x63')]['to'][0x0]},client9002);})[_0x8061('0x25')](function(){if(_0xd43ee0){if(_[_0x8061('0xb5')](_0x39186b['body'][_0x8061('0xb6')])){_0x39186b[_0x8061('0x63')]['from']=util[_0x8061('0xb7')]('\x22%s\x22\x20<%s>',_0xd43ee0[_0x8061('0x41')],_0xd43ee0[_0x8061('0xb8')]);}if(_0xd43ee0[_0x8061('0xae')]){if(_0xd43ee0['List'][_0x8061('0xb9')][_0x8061('0x51')]){return _0xd43ee0[_0x8061('0xae')][_0x8061('0xb9')][0x0];}else{return db['CmContact'][_0x8061('0x62')](_[_0x8061('0x1d')](_0x39186b[_0x8061('0x63')],{'firstName':_0x39186b[_0x8061('0x63')]['to'][0x0],'phone':_0x39186b[_0x8061('0x63')]['to'][0x0],'fax':_0x39186b[_0x8061('0x63')]['to'][0x0],'ListId':_0xd43ee0['ListId']}));}}else{throw new Error(_0x8061('0xba'));}}else{throw new Error(_0x8061('0xbb'));}})[_0x8061('0x25')](function(_0x51a302){if(_0x51a302){return db[_0x8061('0x76')]['find']({'where':{'ContactId':_0x51a302['id'],'closed':![],'FaxAccountId':_0xd43ee0['id']}})[_0x8061('0x25')](function(_0x373569){if(_0x373569){return[_0x373569,![]];}return db[_0x8061('0x76')][_0x8061('0x62')]({'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x51a302['id'],'FaxAccountId':_0xd43ee0['id'],'fax':_0x39186b[_0x8061('0x63')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x39186b['body'],{'read':![],'body':_0x39186b['body'][_0x8061('0xb1')][0x0][_0x8061('0xbc')],'FaxAccountId':_0xd43ee0['id'],'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x51a302['id'],'AttachmentId':_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0]['id']})]},{'include':[{'model':db[_0x8061('0xa9')],'as':'Messages'}]})[_0x8061('0x25')](function(_0x3e79e3){return[_0x3e79e3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8061('0xbd')](function(_0x42d0db,_0x6b9105){if(_0x6b9105){return _0x42d0db;}return db[_0x8061('0xa9')][_0x8061('0x62')]({'direction':_0x8061('0xbe'),'read':![],'body':_0x39186b['body'][_0x8061('0xb1')][0x0][_0x8061('0xbc')],'FaxAccountId':_0xd43ee0['id'],'FaxInteractionId':_0x42d0db['id'],'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x42d0db[_0x8061('0xbf')],'AttachmentId':_0x39186b['body']['attachments'][0x0]['id']})[_0x8061('0x25')](function(_0x445caa){_0x42d0db[_0x8061('0xc0')][_0x8061('0xc1')]=[];_0x42d0db[_0x8061('0xc0')][_0x8061('0xc1')][_0x8061('0x93')](_0x445caa[_0x8061('0xc0')]);return _0x42d0db;});})['then'](function(_0x286122){respondWithRpcPromise(_0x8061('0xc2'),_0x8061('0xc2'),{'FaxAccountId':_['isNil'](_0x39186b[_0x8061('0x5e')]['id'])?undefined:_0x39186b[_0x8061('0x5e')]['id'],'path':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0]['path'])?undefined:_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0][_0x8061('0x8')],'fax':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['to'][0x0])?undefined:_0x39186b['body']['to'][0x0],'AttachmentId':_0x39186b['body'][_0x8061('0xb1')][0x0]['id']},client9002)['then'](function(_0x18aca2){logger[_0x8061('0x26')](_0x8061('0xc3'),_0x18aca2);})['catch'](function(_0x2f2602){logger[_0x8061('0x26')]('SendFaxRpc,\x20%s',_0x2f2602);});return _0x286122;})[_0x8061('0x25')](respondWithResult(_0x5f3b9f,null))[_0x8061('0x5c')](handleError(_0x5f3b9f,null));};exports[_0x8061('0xc4')]=function(_0x466919,_0x511b7e,_0x109ae0){return db['FaxAccount']['find']({'where':{'id':_0x466919[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x511b7e,null))[_0x8061('0x25')](function(_0x1cec09){if(_0x1cec09){return _0x1cec09[_0x8061('0xc4')](_0x466919[_0x8061('0x63')][_0x8061('0x71')],_[_0x8061('0x77')](_0x466919[_0x8061('0x63')],[_0x8061('0x71'),'id'])||{})[_0x8061('0xbd')](function(_0x2d9e21){for(var _0x19ca26=0x0;_0x19ca26<_0x466919[_0x8061('0x63')][_0x8061('0x71')][_0x8061('0x51')];_0x19ca26+=0x1){socket[_0x8061('0xc5')](_0x8061('0xc6'),{'UserId':Number(_0x466919[_0x8061('0x63')]['ids'][_0x19ca26]),'FaxAccountId':Number(_0x466919[_0x8061('0x5e')]['id'])});}return _0x2d9e21;});}})['then'](respondWithResult(_0x511b7e,null))['catch'](handleError(_0x511b7e,null));};exports[_0x8061('0xc7')]=function(_0x36c340,_0x454f36,_0x10194c){return db[_0x8061('0x45')]['find']({'where':{'id':_0x36c340[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x454f36,null))['then'](function(_0x4f0418){if(_0x4f0418){return _0x4f0418[_0x8061('0xc7')](_0x36c340[_0x8061('0x4b')][_0x8061('0x71')])[_0x8061('0x25')](function(){if(_[_0x8061('0xc8')](_0x36c340[_0x8061('0x4b')][_0x8061('0x71')])){for(var _0x4eb5e4=0x0;_0x4eb5e4<_0x36c340['query'][_0x8061('0x71')][_0x8061('0x51')];_0x4eb5e4+=0x1){socket[_0x8061('0xc5')](_0x8061('0xc9'),{'UserId':Number(_0x36c340[_0x8061('0x4b')][_0x8061('0x71')][_0x4eb5e4]),'FaxAccountId':Number(_0x36c340[_0x8061('0x5e')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x36c340[_0x8061('0x4b')][_0x8061('0x71')]),'FaxAccountId':Number(_0x36c340[_0x8061('0x5e')]['id'])});}});}})[_0x8061('0x25')](respondWithStatusCode(_0x454f36,null))[_0x8061('0x5c')](handleError(_0x454f36,null));};exports[_0x8061('0xca')]=function(_0x733afa,_0x4b7f31,_0x527a47){var _0x152ed4={};var _0x129a85={};var _0xe84fff;var _0x7b3571;return db[_0x8061('0x45')]['findOne']({'where':{'id':_0x733afa[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4b7f31,null))[_0x8061('0x25')](function(_0x4454c8){if(_0x4454c8){_0xe84fff=_0x4454c8;_0x129a85[_0x8061('0x4e')]=_['keys'](db[_0x8061('0x7a')][_0x8061('0x46')]);_0x129a85[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x733afa[_0x8061('0x4b')]);_0x129a85['filters']=_[_0x8061('0x4d')](_0x129a85[_0x8061('0x4e')],_0x129a85[_0x8061('0x4b')]);_0x152ed4[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x129a85[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x733afa[_0x8061('0x4b')][_0x8061('0x50')]));_0x152ed4[_0x8061('0x4f')]=_0x152ed4[_0x8061('0x4f')][_0x8061('0x51')]?_0x152ed4['attributes']:_0x129a85[_0x8061('0x4e')];_0x152ed4[_0x8061('0x6e')]=qs['sort'](_0x733afa[_0x8061('0x4b')][_0x8061('0x6f')]);_0x152ed4[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x733afa[_0x8061('0x4b')],_0x129a85[_0x8061('0x55')]));if(_0x733afa[_0x8061('0x4b')]['filter']){_0x152ed4['where']=_[_0x8061('0x58')](_0x152ed4[_0x8061('0x54')],{'$or':_['map'](_0x152ed4[_0x8061('0x4f')],function(_0x3894f6){var _0x290fbb={};_0x290fbb[_0x3894f6]={'$like':'%'+_0x733afa[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x290fbb;})});}_0x152ed4=_[_0x8061('0x58')]({},_0x152ed4,_0x733afa[_0x8061('0x60')]);return _0xe84fff[_0x8061('0xca')](_0x152ed4);}})[_0x8061('0x25')](function(_0x286e7e){if(_0x286e7e){_0x7b3571=_0x286e7e['length'];if(!_0x733afa[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x152ed4[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x733afa[_0x8061('0x4b')]['limit']);_0x152ed4[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x733afa['query'][_0x8061('0x33')]);}return _0xe84fff[_0x8061('0xca')](_0x152ed4);}})[_0x8061('0x25')](function(_0x1d03e0){if(_0x1d03e0){return _0x1d03e0?{'count':_0x7b3571,'rows':_0x1d03e0}:null;}})[_0x8061('0x25')](respondWithResult(_0x4b7f31,null))[_0x8061('0x5c')](handleError(_0x4b7f31,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cd458d8..3624f23 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 _0xff9d=['hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x230aca,_0x35a2f7){var _0x43e3f6=function(_0x12c184){while(--_0x12c184){_0x230aca['push'](_0x230aca['shift']());}};_0x43e3f6(++_0x35a2f7);}(_0xff9d,0x16a));var _0xdff9=function(_0xf2d73c,_0x2a31c1){_0xf2d73c=_0xf2d73c-0x0;var _0x3660ce=_0xff9d[_0xf2d73c];return _0x3660ce;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xdff9('0x0'))['db'][_0xdff9('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdff9('0x2')](0x0);var events={'afterCreate':_0xdff9('0x3'),'afterUpdate':_0xdff9('0x4'),'afterDestroy':_0xdff9('0x5')};function emitEvent(_0x12ab42){return function(_0x117d3c,_0x878198,_0x622316){FaxAccountEvents[_0xdff9('0x6')](_0x12ab42+':'+_0x117d3c['id'],_0x117d3c);FaxAccountEvents[_0xdff9('0x6')](_0x12ab42,_0x117d3c);_0x622316(null);};}for(var e in events){if(events[_0xdff9('0x7')](e)){var event=events[e];FaxAccount[_0xdff9('0x8')](e,emitEvent(event));}}module[_0xdff9('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x8983=['events','../../mysqldb','FaxAccount','save','update','emit','hook'];(function(_0x3a124b,_0x5c6269){var _0x260616=function(_0x269f8a){while(--_0x269f8a){_0x3a124b['push'](_0x3a124b['shift']());}};_0x260616(++_0x5c6269);}(_0x8983,0x16c));var _0x3898=function(_0x3fec78,_0x409cfd){_0x3fec78=_0x3fec78-0x0;var _0x2407eb=_0x8983[_0x3fec78];return _0x2407eb;};'use strict';var EventEmitter=require(_0x3898('0x0'));var FaxAccount=require(_0x3898('0x1'))['db'][_0x3898('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3898('0x3'),'afterUpdate':_0x3898('0x4'),'afterDestroy':'remove'};function emitEvent(_0x154422){return function(_0xe3e69c,_0x556da3,_0x10c453){FaxAccountEvents[_0x3898('0x5')](_0x154422+':'+_0xe3e69c['id'],_0xe3e69c);FaxAccountEvents['emit'](_0x154422,_0xe3e69c);_0x10c453(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3898('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7e58076..176dc14 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 _0xf04e=['rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','bluebird','request-promise','path'];(function(_0x2722cb,_0x6c4b37){var _0x25f766=function(_0x363203){while(--_0x363203){_0x2722cb['push'](_0x2722cb['shift']());}};_0x25f766(++_0x6c4b37);}(_0xf04e,0x15b));var _0xef04=function(_0x27b655,_0x265bc3){_0x27b655=_0x27b655-0x0;var _0x3ddc11=_0xf04e[_0x27b655];return _0x3ddc11;};'use strict';var _=require(_0xef04('0x0'));var util=require(_0xef04('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef04('0x2'));var rp=require(_0xef04('0x3'));var fs=require('fs');var path=require(_0xef04('0x4'));var rimraf=require(_0xef04('0x5'));var config=require(_0xef04('0x6'));var attributes=require('./faxAccount.attributes');module[_0xef04('0x7')]=function(_0x458f22,_0x933f8b){return _0x458f22[_0xef04('0x8')](_0xef04('0x9'),attributes,{'tableName':_0xef04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fc3=['moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fc3,0xec));var _0x37fc=function(_0x1c3455,_0xf2c961){_0x1c3455=_0x1c3455-0x0;var _0x4fd855=_0x7fc3[_0x1c3455];return _0x4fd855;};'use strict';var _=require(_0x37fc('0x0'));var util=require(_0x37fc('0x1'));var logger=require(_0x37fc('0x2'))(_0x37fc('0x3'));var moment=require(_0x37fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x37fc('0x5'));var fs=require('fs');var path=require(_0x37fc('0x6'));var rimraf=require(_0x37fc('0x7'));var config=require(_0x37fc('0x8'));var attributes=require(_0x37fc('0x9'));module['exports']=function(_0x4be1f7,_0x54a60a){return _0x4be1f7[_0x37fc('0xa')]('FaxAccount',attributes,{'tableName':_0x37fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 03fc81e..3b302b2 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 _0x4acd=['debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','FaxApplication','Applications','applications','list','priority','asc','defaults','create','contact','FaxInteraction','spread','get','autoclose','push','length','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','User','find','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x195cc5,_0x3fdd39){var _0x3cb3eb=function(_0x52e8a2){while(--_0x52e8a2){_0x195cc5['push'](_0x195cc5['shift']());}};_0x3cb3eb(++_0x3fdd39);}(_0x4acd,0x155));var _0xd4ac=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x4acd[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xd4ac('0x0'));var util=require(_0xd4ac('0x1'));var moment=require(_0xd4ac('0x2'));var BPromise=require(_0xd4ac('0x3'));var rs=require(_0xd4ac('0x4'));var fs=require('fs');var Redis=require(_0xd4ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd4ac('0x6'))(_0xd4ac('0x7'));var config=require('../../config/environment');var jayson=require(_0xd4ac('0x8'));var client=jayson[_0xd4ac('0x9')][_0xd4ac('0xa')]({'port':0x232c});config[_0xd4ac('0xb')]=_['defaults'](config['redis'],{'host':_0xd4ac('0xc'),'port':0x18eb});var socket=require(_0xd4ac('0xd'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xd4ac('0xe')](socket);function respondWithRpcPromise(_0x5bfb33,_0x4a1c2b,_0x2ef078){return new BPromise(function(_0x11e602,_0xcd23f7){return client[_0xd4ac('0xf')](_0x5bfb33,_0x2ef078)[_0xd4ac('0x10')](function(_0x3e83d5){logger[_0xd4ac('0x11')]('FaxAccount,\x20%s,\x20%s',_0x4a1c2b,_0xd4ac('0x12'));logger[_0xd4ac('0x13')](_0xd4ac('0x14'),_0x4a1c2b,_0xd4ac('0x12'),JSON[_0xd4ac('0x15')](_0x3e83d5));if(_0x3e83d5[_0xd4ac('0x16')]){if(_0x3e83d5[_0xd4ac('0x16')][_0xd4ac('0x17')]===0x1f4){logger[_0xd4ac('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4a1c2b,_0x3e83d5[_0xd4ac('0x16')][_0xd4ac('0x18')]);return _0xcd23f7(_0x3e83d5[_0xd4ac('0x16')]['message']);}logger[_0xd4ac('0x16')](_0xd4ac('0x19'),_0x4a1c2b,_0x3e83d5[_0xd4ac('0x16')][_0xd4ac('0x18')]);return _0x11e602(_0x3e83d5['error'][_0xd4ac('0x18')]);}else{logger[_0xd4ac('0x11')](_0xd4ac('0x19'),_0x4a1c2b,'request\x20sent');_0x11e602(_0x3e83d5[_0xd4ac('0x1a')][_0xd4ac('0x18')]);}})[_0xd4ac('0x1b')](function(_0x5e9367){logger[_0xd4ac('0x16')](_0xd4ac('0x19'),_0x4a1c2b,_0x5e9367);_0xcd23f7(_0x5e9367);});});}exports[_0xd4ac('0x1c')]=function(_0x571e73){var _0x15fc28=this;return new Promise(function(_0x248b5b,_0x1e1896){return db[_0xd4ac('0x1d')]['findAll']({'raw':_0x571e73['options']?_0x571e73[_0xd4ac('0x1e')][_0xd4ac('0x1f')]===undefined?!![]:![]:!![],'where':_0x571e73[_0xd4ac('0x1e')]?_0x571e73[_0xd4ac('0x1e')][_0xd4ac('0x20')]||null:null,'attributes':_0x571e73[_0xd4ac('0x1e')]?_0x571e73['options'][_0xd4ac('0x21')]||null:null,'limit':_0x571e73['options']?_0x571e73['options'][_0xd4ac('0x22')]||null:null,'include':_0x571e73[_0xd4ac('0x1e')]?_0x571e73[_0xd4ac('0x1e')][_0xd4ac('0x23')]?_['map'](_0x571e73['options'][_0xd4ac('0x23')],function(_0x599894){return{'model':db[_0x599894['model']],'as':_0x599894['as'],'attributes':_0x599894[_0xd4ac('0x21')],'include':_0x599894[_0xd4ac('0x23')]?_[_0xd4ac('0x24')](_0x599894[_0xd4ac('0x23')],function(_0xf42e7f){return{'model':db[_0xf42e7f[_0xd4ac('0x25')]],'as':_0xf42e7f['as'],'attributes':_0xf42e7f[_0xd4ac('0x21')],'include':_0xf42e7f[_0xd4ac('0x23')]?_[_0xd4ac('0x24')](_0xf42e7f[_0xd4ac('0x23')],function(_0x296bac){return{'model':db[_0x296bac[_0xd4ac('0x25')]],'as':_0x296bac['as'],'attributes':_0x296bac[_0xd4ac('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4ac('0x10')](function(_0x1cf071){logger[_0xd4ac('0x11')]('GetFaxAccount',_0x571e73);logger[_0xd4ac('0x13')](_0xd4ac('0x1c'),_0x571e73,JSON[_0xd4ac('0x15')](_0x1cf071));_0x248b5b(_0x1cf071);})[_0xd4ac('0x1b')](function(_0x12600c){logger['error'](_0xd4ac('0x1c'),_0x12600c[_0xd4ac('0x18')],_0x571e73);_0x1e1896(_0x15fc28[_0xd4ac('0x16')](0x1f4,_0x12600c[_0xd4ac('0x18')]));});});};exports[_0xd4ac('0x26')]=function(_0x55ee9e,_0x40b198,_0x4bf9a5){var _0x59d6f9=this;return new Promise(function(_0x54a7fd,_0x16007d){var _0x119127={'body':_0x55ee9e[_0xd4ac('0x27')],'channel':_0xd4ac('0x28')};var _0x45372e=[];var _0xfc3d7b=[];var _0x175dfa={};return db[_0xd4ac('0x29')][_0xd4ac('0x2a')]()[_0xd4ac('0x10')](function(_0x361138){if(!_0x361138){throw new db['Sequelize'][(_0xd4ac('0x2b'))]('no\x20available\x20attributes');}_0x45372e=_[_0xd4ac('0x2c')](_['keys'](_0x361138),[_0xd4ac('0x2d'),_0xd4ac('0x2e')]);_0xfc3d7b=_['difference'](_[_0xd4ac('0x2f')](_0x361138),[_0xd4ac('0x2d'),_0xd4ac('0x2e'),_0xd4ac('0x30'),_0xd4ac('0x31')]);if(_0x55ee9e['body']['id']){delete _0x55ee9e[_0xd4ac('0x27')]['id'];}if(_[_0xd4ac('0x32')](_0x55ee9e[_0xd4ac('0x27')][_0xd4ac('0x33')])){throw new db['Sequelize'][(_0xd4ac('0x2b'))](_0xd4ac('0x34'));}if(_[_0xd4ac('0x32')](_0x55ee9e['body']['body'])||_0x55ee9e['body'][_0xd4ac('0x27')]===''){throw new db['Sequelize'][(_0xd4ac('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd4ac('0x32')](_0x55ee9e[_0xd4ac('0x27')]['mapKey'])){throw new db[(_0xd4ac('0x35'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfc3d7b);}if(!_[_0xd4ac('0x36')](_0xfc3d7b,_0x55ee9e[_0xd4ac('0x27')][_0xd4ac('0x37')])){throw new db[(_0xd4ac('0x35'))][(_0xd4ac('0x2b'))](_0xd4ac('0x38')+_0xfc3d7b);}_0x175dfa[_0x55ee9e[_0xd4ac('0x27')]['mapKey']]=_0x55ee9e['body'][_0xd4ac('0x33')];})[_0xd4ac('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x55ee9e[_0xd4ac('0x39')]['id']},'include':[{'model':db[_0xd4ac('0x3a')],'as':_0xd4ac('0x3b'),'include':[{'model':db[_0xd4ac('0x29')],'as':_0xd4ac('0x3c'),'where':_0x175dfa,'limit':0x1,'order':[[_0xd4ac('0x2e'),'DESC']]}]},{'model':db[_0xd4ac('0x3d')],'as':_0xd4ac('0x3e')}]});})['then'](function(_0x110b02){if(_0x110b02&&_0x110b02['List']){var _0x216e7c=_0x110b02['get']({'plain':!![]});_0x119127[_0xd4ac('0x39')]=_0x216e7c;_0x119127[_0xd4ac('0x3f')]=_0x216e7c['Applications'];_0x119127[_0xd4ac('0x40')]=_0x216e7c['List'];_0x119127[_0xd4ac('0x3f')]=_['orderBy'](_0x119127[_0xd4ac('0x3f')],[_0xd4ac('0x41')],[_0xd4ac('0x42')]);if(_0x119127['account'][_0xd4ac('0x3e')]){delete _0x119127[_0xd4ac('0x39')][_0xd4ac('0x3e')];}if(_0x119127[_0xd4ac('0x39')][_0xd4ac('0x3b')]&&_0x119127[_0xd4ac('0x39')]['List']['Contacts']['length']){return _0x119127['account'][_0xd4ac('0x3b')][_0xd4ac('0x3c')][0x0];}var _0x235d21=_[_0xd4ac('0x43')](_0x55ee9e['body'],{'firstName':_0x55ee9e[_0xd4ac('0x27')][_0xd4ac('0x33')],'ListId':_0x216e7c[_0xd4ac('0x31')]});_0x235d21[_0x55ee9e['body'][_0xd4ac('0x37')]]=_0x55ee9e[_0xd4ac('0x27')][_0xd4ac('0x33')];return db[_0xd4ac('0x29')][_0xd4ac('0x44')](_0x235d21,{'fields':_0x45372e,'raw':!![]});}})[_0xd4ac('0x10')](function(_0x680945){_0x119127[_0xd4ac('0x45')]=_0x680945;if(_0x680945){var _0x3a332a={'ContactId':_0x680945['id'],'FaxAccountId':_0x55ee9e[_0xd4ac('0x39')]['id'],'fax':_0x680945['fax']};return db[_0xd4ac('0x46')]['find']({'where':{'ContactId':_0x680945['id'],'closed':![],'FaxAccountId':_0x55ee9e[_0xd4ac('0x39')]['id']}})[_0xd4ac('0x10')](function(_0x18392f){if(_0x18392f){return[_0x18392f,![]];}return db['FaxInteraction']['create'](_0x3a332a)[_0xd4ac('0x10')](function(_0x42869c){return[_0x42869c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd4ac('0x47')](function(_0x4092bb,_0x59c80c){var _0x4051d0=_0x4092bb[_0xd4ac('0x48')]({'plain':!![]});if(_0x59c80c){if(_0x119127[_0xd4ac('0x39')][_0xd4ac('0x49')]){_0x119127[_0xd4ac('0x3f')][_0xd4ac('0x4a')]({'id':0x0,'priority':_0x119127[_0xd4ac('0x3f')][_0xd4ac('0x4b')]+0x1,'app':_0xd4ac('0x4c'),'appdata':_0xd4ac('0x4d'),'interval':_0xd4ac('0x4e')});}_0x4051d0[_0xd4ac('0x4f')]=!![];}else{_0x4051d0[_0xd4ac('0x4f')]=![];}_0x119127['interaction']=_0x4051d0;return db[_0xd4ac('0x50')]['create']({'body':_0x55ee9e[_0xd4ac('0x27')][_0xd4ac('0x27')],'FaxAccountId':_0x55ee9e['account']['id'],'FaxInteractionId':_0x4092bb['id'],'direction':'in','ContactId':_0x4092bb[_0xd4ac('0x51')],'AttachmentId':_0x55ee9e[_0xd4ac('0x27')]['AttachmentId']});})[_0xd4ac('0x10')](function(_0x350d0b){_0x119127[_0xd4ac('0x18')]=_0x350d0b;if(_0x119127[_0xd4ac('0x52')]['UserId']){return db[_0xd4ac('0x53')][_0xd4ac('0x54')]({'attributes':['id',_0xd4ac('0x55')],'where':{'id':_0x119127[_0xd4ac('0x52')]['UserId']}})[_0xd4ac('0x10')](function(_0x1a4eab){if(_0x1a4eab){_0x119127[_0xd4ac('0x3f')][_0xd4ac('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a4eab[_0xd4ac('0x55')]+','+(_0x119127[_0xd4ac('0x39')][_0xd4ac('0x57')]||0xa),'interval':_0xd4ac('0x4e')});}return respondWithRpcPromise(_0xd4ac('0x58'),_0xd4ac('0x59'),_0x119127);});}return respondWithRpcPromise(_0xd4ac('0x58'),_0xd4ac('0x59'),_0x119127);})[_0xd4ac('0x10')](function(_0x1c945b){_0x54a7fd(_0x1c945b);})[_0xd4ac('0x1b')](function(_0x300775){_0x16007d(_0x59d6f9[_0xd4ac('0x16')](0x1f4,_0x300775[_0xd4ac('0x18')]));});});}; \ No newline at end of file +var _0xa394=['FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc','defaults','contact','find','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa394,0x7e));var _0x4a39=function(_0x194d63,_0xc3b38a){_0x194d63=_0x194d63-0x0;var _0x1e6998=_0xa394[_0x194d63];return _0x1e6998;};'use strict';var _=require(_0x4a39('0x0'));var util=require(_0x4a39('0x1'));var moment=require(_0x4a39('0x2'));var BPromise=require(_0x4a39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a39('0x4'));var db=require(_0x4a39('0x5'))['db'];var utils=require(_0x4a39('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a39('0x8')][_0x4a39('0x9')]({'port':0x232c});config[_0x4a39('0xa')]=_['defaults'](config[_0x4a39('0xa')],{'host':_0x4a39('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a39('0xa')]));require(_0x4a39('0xc'))[_0x4a39('0xd')](socket);function respondWithRpcPromise(_0x33de87,_0x589709,_0x139860){return new BPromise(function(_0x441974,_0x3b6bb5){return client[_0x4a39('0xe')](_0x33de87,_0x139860)[_0x4a39('0xf')](function(_0x4dc8ad){logger[_0x4a39('0x10')](_0x4a39('0x11'),_0x589709,_0x4a39('0x12'));logger[_0x4a39('0x13')](_0x4a39('0x14'),_0x589709,_0x4a39('0x12'),JSON[_0x4a39('0x15')](_0x4dc8ad));if(_0x4dc8ad['error']){if(_0x4dc8ad['error'][_0x4a39('0x16')]===0x1f4){logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x4dc8ad[_0x4a39('0x17')]['message']);return _0x3b6bb5(_0x4dc8ad[_0x4a39('0x17')][_0x4a39('0x18')]);}logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x4dc8ad['error'][_0x4a39('0x18')]);return _0x441974(_0x4dc8ad[_0x4a39('0x17')][_0x4a39('0x18')]);}else{logger['info'](_0x4a39('0x11'),_0x589709,_0x4a39('0x12'));_0x441974(_0x4dc8ad[_0x4a39('0x19')][_0x4a39('0x18')]);}})[_0x4a39('0x1a')](function(_0x54fd2e){logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x54fd2e);_0x3b6bb5(_0x54fd2e);});});}exports[_0x4a39('0x1b')]=function(_0x2a95cf){var _0x3a9a1b=this;return new Promise(function(_0x844a2a,_0x29dd84){return db[_0x4a39('0x1c')]['findAll']({'raw':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a95cf['options']?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x1f')]||null:null,'attributes':_0x2a95cf['options']?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x20')]||null:null,'limit':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x21')]||null:null,'include':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf['options'][_0x4a39('0x22')]?_[_0x4a39('0x23')](_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x22')],function(_0x1f14bb){return{'model':db[_0x1f14bb[_0x4a39('0x24')]],'as':_0x1f14bb['as'],'attributes':_0x1f14bb[_0x4a39('0x20')],'include':_0x1f14bb[_0x4a39('0x22')]?_[_0x4a39('0x23')](_0x1f14bb[_0x4a39('0x22')],function(_0xf5843d){return{'model':db[_0xf5843d[_0x4a39('0x24')]],'as':_0xf5843d['as'],'attributes':_0xf5843d['attributes'],'include':_0xf5843d[_0x4a39('0x22')]?_[_0x4a39('0x23')](_0xf5843d[_0x4a39('0x22')],function(_0xbb71d0){return{'model':db[_0xbb71d0[_0x4a39('0x24')]],'as':_0xbb71d0['as'],'attributes':_0xbb71d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a39('0xf')](function(_0x29a841){logger[_0x4a39('0x10')](_0x4a39('0x1b'),_0x2a95cf);logger[_0x4a39('0x13')](_0x4a39('0x1b'),_0x2a95cf,JSON[_0x4a39('0x15')](_0x29a841));_0x844a2a(_0x29a841);})[_0x4a39('0x1a')](function(_0x577486){logger[_0x4a39('0x17')](_0x4a39('0x1b'),_0x577486['message'],_0x2a95cf);_0x29dd84(_0x3a9a1b[_0x4a39('0x17')](0x1f4,_0x577486[_0x4a39('0x18')]));});});};exports[_0x4a39('0x25')]=function(_0x2e8220,_0x32f577,_0x4ef687){var _0x417f66=this;return new Promise(function(_0x141d50,_0x1eb097){var _0x564a94={'body':_0x2e8220[_0x4a39('0x26')],'channel':_0x4a39('0x27')};var _0x20365b=[];var _0x3f1cb6=[];var _0xf5a5e7={};return db[_0x4a39('0x28')]['describe']()['then'](function(_0x3369f1){if(!_0x3369f1){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))](_0x4a39('0x2b'));}_0x20365b=_[_0x4a39('0x2c')](_[_0x4a39('0x2d')](_0x3369f1),[_0x4a39('0x2e'),_0x4a39('0x2f')]);_0x3f1cb6=_[_0x4a39('0x2c')](_[_0x4a39('0x2d')](_0x3369f1),[_0x4a39('0x2e'),'updatedAt',_0x4a39('0x30'),_0x4a39('0x31')]);if(_0x2e8220['body']['id']){delete _0x2e8220['body']['id'];}if(_['isNil'](_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')])){throw new db['Sequelize'][(_0x4a39('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x4a39('0x33')](_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')])||_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')]===''){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2e8220[_0x4a39('0x26')]['mapKey'])){throw new db[(_0x4a39('0x29'))]['ValidationError'](_0x4a39('0x34')+_0x3f1cb6);}if(!_[_0x4a39('0x35')](_0x3f1cb6,_0x2e8220[_0x4a39('0x26')][_0x4a39('0x36')])){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))](_0x4a39('0x37')+_0x3f1cb6);}_0xf5a5e7[_0x2e8220[_0x4a39('0x26')][_0x4a39('0x36')]]=_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')];})[_0x4a39('0xf')](function(){return db[_0x4a39('0x1c')]['find']({'where':{'id':_0x2e8220['account']['id']},'include':[{'model':db[_0x4a39('0x38')],'as':_0x4a39('0x39'),'include':[{'model':db[_0x4a39('0x28')],'as':_0x4a39('0x3a'),'where':_0xf5a5e7,'limit':0x1,'order':[[_0x4a39('0x2f'),_0x4a39('0x3b')]]}]},{'model':db[_0x4a39('0x3c')],'as':_0x4a39('0x3d')}]});})[_0x4a39('0xf')](function(_0x48d0c6){if(_0x48d0c6&&_0x48d0c6[_0x4a39('0x39')]){var _0x3568c0=_0x48d0c6[_0x4a39('0x3e')]({'plain':!![]});_0x564a94[_0x4a39('0x3f')]=_0x3568c0;_0x564a94[_0x4a39('0x40')]=_0x3568c0['Applications'];_0x564a94[_0x4a39('0x41')]=_0x3568c0[_0x4a39('0x39')];_0x564a94[_0x4a39('0x40')]=_[_0x4a39('0x42')](_0x564a94[_0x4a39('0x40')],[_0x4a39('0x43')],[_0x4a39('0x44')]);if(_0x564a94[_0x4a39('0x3f')][_0x4a39('0x3d')]){delete _0x564a94[_0x4a39('0x3f')][_0x4a39('0x3d')];}if(_0x564a94['account']['List']&&_0x564a94[_0x4a39('0x3f')][_0x4a39('0x39')][_0x4a39('0x3a')]['length']){return _0x564a94['account']['List'][_0x4a39('0x3a')][0x0];}var _0x382981=_[_0x4a39('0x45')](_0x2e8220[_0x4a39('0x26')],{'firstName':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')],'ListId':_0x3568c0[_0x4a39('0x31')]});_0x382981[_0x2e8220[_0x4a39('0x26')]['mapKey']]=_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')];return db[_0x4a39('0x28')]['create'](_0x382981,{'fields':_0x20365b,'raw':!![]});}})[_0x4a39('0xf')](function(_0x4137d2){_0x564a94[_0x4a39('0x46')]=_0x4137d2;if(_0x4137d2){var _0x45d6ec={'ContactId':_0x4137d2['id'],'FaxAccountId':_0x2e8220['account']['id'],'fax':_0x4137d2['fax']};return db['FaxInteraction'][_0x4a39('0x47')]({'where':{'ContactId':_0x4137d2['id'],'closed':![],'FaxAccountId':_0x2e8220['account']['id']}})[_0x4a39('0xf')](function(_0x2e5069){if(_0x2e5069){return[_0x2e5069,![]];}return db[_0x4a39('0x48')][_0x4a39('0x49')](_0x45d6ec)[_0x4a39('0xf')](function(_0x4ab802){return[_0x4ab802,!![]];});});}else{throw new Error(_0x4a39('0x4a'));}})['spread'](function(_0x36ad33,_0x48a440){var _0x402e68=_0x36ad33['get']({'plain':!![]});if(_0x48a440){if(_0x564a94[_0x4a39('0x3f')][_0x4a39('0x4b')]){_0x564a94[_0x4a39('0x40')][_0x4a39('0x4c')]({'id':0x0,'priority':_0x564a94[_0x4a39('0x40')][_0x4a39('0x4d')]+0x1,'app':_0x4a39('0x4e'),'appdata':_0x4a39('0x4f'),'interval':_0x4a39('0x50')});}_0x402e68['created']=!![];}else{_0x402e68[_0x4a39('0x51')]=![];}_0x564a94[_0x4a39('0x52')]=_0x402e68;return db[_0x4a39('0x53')][_0x4a39('0x49')]({'body':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')],'FaxAccountId':_0x2e8220[_0x4a39('0x3f')]['id'],'FaxInteractionId':_0x36ad33['id'],'direction':'in','ContactId':_0x36ad33[_0x4a39('0x54')],'AttachmentId':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x55')]});})['then'](function(_0x4f91d2){_0x564a94['message']=_0x4f91d2;if(_0x564a94[_0x4a39('0x52')][_0x4a39('0x56')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x564a94[_0x4a39('0x52')]['UserId']}})[_0x4a39('0xf')](function(_0xf18819){if(_0xf18819){_0x564a94['applications'][_0x4a39('0x57')]({'id':0x0,'priority':0x0,'app':_0x4a39('0x58'),'appdata':_0xf18819[_0x4a39('0x59')]+','+(_0x564a94['account'][_0x4a39('0x5a')]||0xa),'interval':_0x4a39('0x50')});}return respondWithRpcPromise(_0x4a39('0x5b'),_0x4a39('0x5c'),_0x564a94);});}return respondWithRpcPromise(_0x4a39('0x5b'),_0x4a39('0x5c'),_0x564a94);})[_0x4a39('0xf')](function(_0x36ec0d){_0x141d50(_0x36ec0d);})['catch'](function(_0x58ba4a){_0x1eb097(_0x417f66[_0x4a39('0x17')](0x1f4,_0x58ba4a[_0x4a39('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e3b7acb..5cf9344 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 _0xf92d=['./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf92d,0x178));var _0xdf92=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf92d[_0x2fc012];return _0x2891f9;};'use strict';var FaxAccountEvents=require(_0xdf92('0x0'));var events=[_0xdf92('0x1'),_0xdf92('0x2'),_0xdf92('0x3')];function createListener(_0x2d7e13,_0xf921f){return function(_0x5d8e4d){_0xf921f[_0xdf92('0x4')](_0x2d7e13,_0x5d8e4d);};}function removeListener(_0x5d81ba,_0x5a4284){return function(){FaxAccountEvents[_0xdf92('0x5')](_0x5d81ba,_0x5a4284);};}exports[_0xdf92('0x6')]=function(_0x2de6b9){for(var _0x254285=0x0,_0x3dedf6=events[_0xdf92('0x7')];_0x254285<_0x3dedf6;_0x254285++){var _0x370d48=events[_0x254285];var _0x1f239a=createListener('faxAccount:'+_0x370d48,_0x2de6b9);FaxAccountEvents['on'](_0x370d48,_0x1f239a);}}; \ No newline at end of file +var _0xb98b=['length','faxAccount:','save','remove','emit','register'];(function(_0x3f4948,_0x205e64){var _0x477033=function(_0x4fd305){while(--_0x4fd305){_0x3f4948['push'](_0x3f4948['shift']());}};_0x477033(++_0x205e64);}(_0xb98b,0x128));var _0xbb98=function(_0x185dfa,_0x153d72){_0x185dfa=_0x185dfa-0x0;var _0x538992=_0xb98b[_0x185dfa];return _0x538992;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xbb98('0x0'),_0xbb98('0x1'),'update'];function createListener(_0xa5af0f,_0x59a353){return function(_0x52ca36){_0x59a353[_0xbb98('0x2')](_0xa5af0f,_0x52ca36);};}function removeListener(_0x1bc4f3,_0x1763d5){return function(){FaxAccountEvents['removeListener'](_0x1bc4f3,_0x1763d5);};}exports[_0xbb98('0x3')]=function(_0x309503){for(var _0x2e8d1a=0x0,_0x35e329=events[_0xbb98('0x4')];_0x2e8d1a<_0x35e329;_0x2e8d1a++){var _0x174eca=events[_0x2e8d1a];var _0x5cbd9c=createListener(_0xbb98('0x5')+_0x174eca,_0x309503);FaxAccountEvents['on'](_0x174eca,_0x5cbd9c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 53f3a28..c420316 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(_0x40c601,_0x25997e){var _0x214a0=function(_0x1c2f19){while(--_0x1c2f19){_0x40c601['push'](_0x40c601['shift']());}};_0x214a0(++_0x25997e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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(_0x41b16f,_0x4afe01){var _0xb84a94=function(_0x43f03a){while(--_0x43f03a){_0x41b16f['push'](_0x41b16f['shift']());}};_0xb84a94(++_0x4afe01);}(_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/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 7645c17..df54b67 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 _0x5c34=['STRING','sequelize','exports','noop','TEXT'];(function(_0x5ebf78,_0x33fdce){var _0x3029ee=function(_0x52a18b){while(--_0x52a18b){_0x5ebf78['push'](_0x5ebf78['shift']());}};_0x3029ee(++_0x33fdce);}(_0x5c34,0x92));var _0x45c3=function(_0x1c4f18,_0x345e09){_0x1c4f18=_0x1c4f18-0x0;var _0x1f49e7=_0x5c34[_0x1c4f18];return _0x1f49e7;};'use strict';var Sequelize=require(_0x45c3('0x0'));module[_0x45c3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x45c3('0x2')},'appdata':{'type':Sequelize[_0x45c3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x45c3('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8bf0=['exports','INTEGER','noop','TEXT','sequelize'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0x8bf0,0x95));var _0x08bf=function(_0x386111,_0x13bc6e){_0x386111=_0x386111-0x0;var _0x52f3c2=_0x8bf0[_0x386111];return _0x52f3c2;};'use strict';var Sequelize=require(_0x08bf('0x0'));module[_0x08bf('0x1')]={'priority':{'type':Sequelize[_0x08bf('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x08bf('0x3')},'appdata':{'type':Sequelize[_0x08bf('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4b70c78..2d95120 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 _0xc97f=['findAll','catch','show','params','include','merge','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','FaxApplication','includeAll'];(function(_0x16110e,_0x46c8eb){var _0x4b7487=function(_0x1509be){while(--_0x1509be){_0x16110e['push'](_0x16110e['shift']());}};_0x4b7487(++_0x46c8eb);}(_0xc97f,0x9a));var _0xfc97=function(_0x1db2cc,_0xf8fff7){_0x1db2cc=_0x1db2cc-0x0;var _0x107a61=_0xc97f[_0x1db2cc];return _0x107a61;};'use strict';var emlformat=require(_0xfc97('0x0'));var rimraf=require(_0xfc97('0x1'));var zipdir=require(_0xfc97('0x2'));var jsonpatch=require(_0xfc97('0x3'));var rp=require(_0xfc97('0x4'));var moment=require(_0xfc97('0x5'));var BPromise=require(_0xfc97('0x6'));var Mustache=require(_0xfc97('0x7'));var util=require('util');var path=require(_0xfc97('0x8'));var sox=require(_0xfc97('0x9'));var csv=require(_0xfc97('0xa'));var ejs=require(_0xfc97('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc97('0xc'));var squel=require('squel');var crypto=require(_0xfc97('0xd'));var jsforce=require(_0xfc97('0xe'));var deskjs=require(_0xfc97('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc97('0x10'));var Redis=require(_0xfc97('0x11'));var authService=require(_0xfc97('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc97('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc97('0x14'))(_0xfc97('0x15'));var utils=require(_0xfc97('0x16'));var config=require(_0xfc97('0x17'));var licenseUtil=require(_0xfc97('0x18'));var db=require(_0xfc97('0x19'))['db'];function respondWithStatusCode(_0x223749,_0x4da847){_0x4da847=_0x4da847||0xcc;return function(_0x3d96a4){if(_0x3d96a4){return _0x223749[_0xfc97('0x1a')](_0x4da847);}return _0x223749[_0xfc97('0x1b')](_0x4da847)[_0xfc97('0x1c')]();};}function respondWithResult(_0x2da84d,_0x12069e){_0x12069e=_0x12069e||0xc8;return function(_0x352785){if(_0x352785){return _0x2da84d[_0xfc97('0x1b')](_0x12069e)[_0xfc97('0x1d')](_0x352785);}};}function respondWithFilteredResult(_0x5d3288,_0x40971e){return function(_0x42933c){if(_0x42933c){var _0x4920d8=typeof _0x40971e['offset']===_0xfc97('0x1e')&&typeof _0x40971e[_0xfc97('0x1f')]===_0xfc97('0x1e');var _0xc568bd=_0x42933c['count'];var _0x5e53bb=_0x4920d8?0x0:_0x40971e[_0xfc97('0x20')];var _0x1d012f=_0x4920d8?_0x42933c[_0xfc97('0x21')]:_0x40971e[_0xfc97('0x20')]+_0x40971e['limit'];var _0x578b3c;if(_0x1d012f>=_0xc568bd){_0x1d012f=_0xc568bd;_0x578b3c=0xc8;}else{_0x578b3c=0xce;}_0x5d3288['status'](_0x578b3c);return _0x5d3288[_0xfc97('0x22')](_0xfc97('0x23'),_0x5e53bb+'-'+_0x1d012f+'/'+_0xc568bd)['json'](_0x42933c);}return null;};}function patchUpdates(_0x5bbd2a){return function(_0x5a4d5c){try{jsonpatch['apply'](_0x5a4d5c,_0x5bbd2a,!![]);}catch(_0x15dfe1){return BPromise['reject'](_0x15dfe1);}return _0x5a4d5c[_0xfc97('0x24')]();};}function saveUpdates(_0x8b1d72,_0x5ce460){return function(_0x338010){if(_0x338010){return _0x338010[_0xfc97('0x25')](_0x8b1d72)[_0xfc97('0x26')](function(_0x697242){return _0x697242;});}return null;};}function removeEntity(_0x15b021,_0xa27263){return function(_0xa3c28b){if(_0xa3c28b){return _0xa3c28b[_0xfc97('0x27')]()[_0xfc97('0x26')](function(){_0x15b021['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d2ca,_0x5dc91e){return function(_0x2feac2){if(!_0x2feac2){_0x29d2ca[_0xfc97('0x1a')](0x194);}return _0x2feac2;};}function handleError(_0x15e594,_0x2eefdb){_0x2eefdb=_0x2eefdb||0x1f4;return function(_0x2ec97){logger[_0xfc97('0x28')](_0x2ec97[_0xfc97('0x29')]);if(_0x2ec97['name']){delete _0x2ec97[_0xfc97('0x2a')];}_0x15e594[_0xfc97('0x1b')](_0x2eefdb)['send'](_0x2ec97);};}exports[_0xfc97('0x2b')]=function(_0x5e1827,_0x519493){var _0xfc14={},_0x28c95a={},_0x324004={'count':0x0,'rows':[]};var _0x1b6217=_[_0xfc97('0x2c')](db['FaxApplication']['rawAttributes'],function(_0x351393){return{'name':_0x351393[_0xfc97('0x2d')],'type':_0x351393['type']['key']};});_0x28c95a[_0xfc97('0x2e')]=_[_0xfc97('0x2c')](_0x1b6217,'name');_0x28c95a[_0xfc97('0x2f')]=_[_0xfc97('0x30')](_0x5e1827['query']);_0x28c95a[_0xfc97('0x31')]=_[_0xfc97('0x32')](_0x28c95a[_0xfc97('0x2e')],_0x28c95a[_0xfc97('0x2f')]);_0xfc14[_0xfc97('0x33')]=_[_0xfc97('0x32')](_0x28c95a[_0xfc97('0x2e')],qs[_0xfc97('0x34')](_0x5e1827['query'][_0xfc97('0x34')]));_0xfc14[_0xfc97('0x33')]=_0xfc14[_0xfc97('0x33')][_0xfc97('0x35')]?_0xfc14['attributes']:_0x28c95a[_0xfc97('0x2e')];if(!_0x5e1827[_0xfc97('0x2f')][_0xfc97('0x36')](_0xfc97('0x37'))){_0xfc14['limit']=qs['limit'](_0x5e1827[_0xfc97('0x2f')]['limit']);_0xfc14[_0xfc97('0x20')]=qs['offset'](_0x5e1827[_0xfc97('0x2f')][_0xfc97('0x20')]);}_0xfc14[_0xfc97('0x38')]=qs[_0xfc97('0x39')](_0x5e1827[_0xfc97('0x2f')][_0xfc97('0x39')]);_0xfc14['where']=qs[_0xfc97('0x31')](_[_0xfc97('0x3a')](_0x5e1827['query'],_0x28c95a[_0xfc97('0x31')]),_0x1b6217);if(_0x5e1827[_0xfc97('0x2f')][_0xfc97('0x3b')]){_0xfc14['where']=_['merge'](_0xfc14['where'],{'$or':_['map'](_0x1b6217,function(_0x5a795c){if(_0x5a795c['type']!=='VIRTUAL'){var _0x4e549c={};_0x4e549c[_0x5a795c[_0xfc97('0x2a')]]={'$like':'%'+_0x5e1827['query']['filter']+'%'};return _0x4e549c;}})});}_0xfc14=_['merge']({},_0xfc14,_0x5e1827['options']);var _0x2ab93b={'where':_0xfc14['where']};return db[_0xfc97('0x3c')][_0xfc97('0x21')](_0x2ab93b)['then'](function(_0x306b16){_0x324004['count']=_0x306b16;if(_0x5e1827[_0xfc97('0x2f')][_0xfc97('0x3d')]){_0xfc14['include']=[{'all':!![]}];}return db[_0xfc97('0x3c')][_0xfc97('0x3e')](_0xfc14);})[_0xfc97('0x26')](function(_0xb116c5){_0x324004['rows']=_0xb116c5;return _0x324004;})[_0xfc97('0x26')](respondWithFilteredResult(_0x519493,_0xfc14))[_0xfc97('0x3f')](handleError(_0x519493,null));};exports[_0xfc97('0x40')]=function(_0x1f685b,_0x34fbe6){var _0x1b2a3d={'raw':!![],'where':{'id':_0x1f685b[_0xfc97('0x41')]['id']}},_0x1ec415={};_0x1ec415['model']=_[_0xfc97('0x30')](db[_0xfc97('0x3c')]['rawAttributes']);_0x1ec415[_0xfc97('0x2f')]=_['keys'](_0x1f685b[_0xfc97('0x2f')]);_0x1ec415['filters']=_['intersection'](_0x1ec415['model'],_0x1ec415['query']);_0x1b2a3d['attributes']=_[_0xfc97('0x32')](_0x1ec415['model'],qs[_0xfc97('0x34')](_0x1f685b[_0xfc97('0x2f')][_0xfc97('0x34')]));_0x1b2a3d['attributes']=_0x1b2a3d[_0xfc97('0x33')][_0xfc97('0x35')]?_0x1b2a3d['attributes']:_0x1ec415[_0xfc97('0x2e')];if(_0x1f685b[_0xfc97('0x2f')][_0xfc97('0x3d')]){_0x1b2a3d[_0xfc97('0x42')]=[{'all':!![]}];}_0x1b2a3d=_[_0xfc97('0x43')]({},_0x1b2a3d,_0x1f685b[_0xfc97('0x44')]);return db[_0xfc97('0x3c')][_0xfc97('0x45')](_0x1b2a3d)[_0xfc97('0x26')](handleEntityNotFound(_0x34fbe6,null))[_0xfc97('0x26')](respondWithResult(_0x34fbe6,null))[_0xfc97('0x3f')](handleError(_0x34fbe6,null));};exports[_0xfc97('0x46')]=function(_0x81c1bd,_0x50ce60){return db[_0xfc97('0x3c')][_0xfc97('0x46')](_0x81c1bd[_0xfc97('0x47')],{})['then'](respondWithResult(_0x50ce60,0xc9))['catch'](handleError(_0x50ce60,null));};exports['update']=function(_0x53ee83,_0x29bbd4){if(_0x53ee83[_0xfc97('0x47')]['id']){delete _0x53ee83['body']['id'];}return db[_0xfc97('0x3c')][_0xfc97('0x45')]({'where':{'id':_0x53ee83[_0xfc97('0x41')]['id']}})[_0xfc97('0x26')](handleEntityNotFound(_0x29bbd4,null))[_0xfc97('0x26')](saveUpdates(_0x53ee83[_0xfc97('0x47')],null))[_0xfc97('0x26')](respondWithResult(_0x29bbd4,null))['catch'](handleError(_0x29bbd4,null));};exports['destroy']=function(_0xd9f7b9,_0x370df7){return db[_0xfc97('0x3c')]['find']({'where':{'id':_0xd9f7b9[_0xfc97('0x41')]['id']}})['then'](handleEntityNotFound(_0x370df7,null))[_0xfc97('0x26')](removeEntity(_0x370df7,null))[_0xfc97('0x3f')](handleError(_0x370df7,null));}; \ No newline at end of file +var _0x4524=['set','Content-Range','reject','save','update','then','destroy','error','send','index','map','FaxApplication','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','keys','includeAll','include','find','catch','create','body','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4e681f,_0x295471){var _0x1f4d28=function(_0x1dfa4d){while(--_0x1dfa4d){_0x4e681f['push'](_0x4e681f['shift']());}};_0x1f4d28(++_0x295471);}(_0x4524,0x19f));var _0x4452=function(_0x629f6f,_0x4d0186){_0x629f6f=_0x629f6f-0x0;var _0x15c5a3=_0x4524[_0x629f6f];return _0x15c5a3;};'use strict';var emlformat=require(_0x4452('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4452('0x1'));var rp=require('request-promise');var moment=require(_0x4452('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4452('0x3'));var util=require(_0x4452('0x4'));var path=require('path');var sox=require(_0x4452('0x5'));var csv=require(_0x4452('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4452('0x7'));var _=require(_0x4452('0x8'));var squel=require(_0x4452('0x9'));var crypto=require(_0x4452('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4452('0xb'));var Redis=require(_0x4452('0xc'));var authService=require(_0x4452('0xd'));var qs=require(_0x4452('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4452('0xf'));var logger=require(_0x4452('0x10'))(_0x4452('0x11'));var utils=require(_0x4452('0x12'));var config=require(_0x4452('0x13'));var licenseUtil=require(_0x4452('0x14'));var db=require(_0x4452('0x15'))['db'];function respondWithStatusCode(_0x664681,_0x1cb560){_0x1cb560=_0x1cb560||0xcc;return function(_0x47828f){if(_0x47828f){return _0x664681[_0x4452('0x16')](_0x1cb560);}return _0x664681[_0x4452('0x17')](_0x1cb560)[_0x4452('0x18')]();};}function respondWithResult(_0x21442e,_0x1c61c8){_0x1c61c8=_0x1c61c8||0xc8;return function(_0xa9e0f1){if(_0xa9e0f1){return _0x21442e[_0x4452('0x17')](_0x1c61c8)[_0x4452('0x19')](_0xa9e0f1);}};}function respondWithFilteredResult(_0x2ef664,_0x3c7f0b){return function(_0x391279){if(_0x391279){var _0xdd28d0=typeof _0x3c7f0b[_0x4452('0x1a')]===_0x4452('0x1b')&&typeof _0x3c7f0b[_0x4452('0x1c')]===_0x4452('0x1b');var _0x481dca=_0x391279['count'];var _0x4f52ce=_0xdd28d0?0x0:_0x3c7f0b[_0x4452('0x1a')];var _0x3490fa=_0xdd28d0?_0x391279['count']:_0x3c7f0b[_0x4452('0x1a')]+_0x3c7f0b[_0x4452('0x1c')];var _0x3d7603;if(_0x3490fa>=_0x481dca){_0x3490fa=_0x481dca;_0x3d7603=0xc8;}else{_0x3d7603=0xce;}_0x2ef664['status'](_0x3d7603);return _0x2ef664[_0x4452('0x1d')](_0x4452('0x1e'),_0x4f52ce+'-'+_0x3490fa+'/'+_0x481dca)[_0x4452('0x19')](_0x391279);}return null;};}function patchUpdates(_0x4cc030){return function(_0x1e53e2){try{jsonpatch['apply'](_0x1e53e2,_0x4cc030,!![]);}catch(_0x3f2c42){return BPromise[_0x4452('0x1f')](_0x3f2c42);}return _0x1e53e2[_0x4452('0x20')]();};}function saveUpdates(_0x42f9e1,_0xbbaaeb){return function(_0x13506f){if(_0x13506f){return _0x13506f[_0x4452('0x21')](_0x42f9e1)[_0x4452('0x22')](function(_0xc356b2){return _0xc356b2;});}return null;};}function removeEntity(_0x4d474f,_0x23e779){return function(_0xb8cf14){if(_0xb8cf14){return _0xb8cf14[_0x4452('0x23')]()[_0x4452('0x22')](function(){_0x4d474f[_0x4452('0x17')](0xcc)[_0x4452('0x18')]();});}};}function handleEntityNotFound(_0xb3ce58,_0x49a033){return function(_0x15835b){if(!_0x15835b){_0xb3ce58[_0x4452('0x16')](0x194);}return _0x15835b;};}function handleError(_0x3c7f72,_0x4a94d7){_0x4a94d7=_0x4a94d7||0x1f4;return function(_0x4d9cdf){logger[_0x4452('0x24')](_0x4d9cdf['stack']);if(_0x4d9cdf['name']){delete _0x4d9cdf['name'];}_0x3c7f72['status'](_0x4a94d7)[_0x4452('0x25')](_0x4d9cdf);};}exports[_0x4452('0x26')]=function(_0x27f714,_0x234cea){var _0x40507d={},_0xfa06bc={},_0x3bd7f1={'count':0x0,'rows':[]};var _0xb02b32=_[_0x4452('0x27')](db[_0x4452('0x28')]['rawAttributes'],function(_0x1ce162){return{'name':_0x1ce162[_0x4452('0x29')],'type':_0x1ce162[_0x4452('0x2a')][_0x4452('0x2b')]};});_0xfa06bc[_0x4452('0x2c')]=_[_0x4452('0x27')](_0xb02b32,_0x4452('0x2d'));_0xfa06bc[_0x4452('0x2e')]=_['keys'](_0x27f714[_0x4452('0x2e')]);_0xfa06bc['filters']=_[_0x4452('0x2f')](_0xfa06bc[_0x4452('0x2c')],_0xfa06bc[_0x4452('0x2e')]);_0x40507d['attributes']=_[_0x4452('0x2f')](_0xfa06bc['model'],qs[_0x4452('0x30')](_0x27f714[_0x4452('0x2e')][_0x4452('0x30')]));_0x40507d[_0x4452('0x31')]=_0x40507d[_0x4452('0x31')][_0x4452('0x32')]?_0x40507d[_0x4452('0x31')]:_0xfa06bc[_0x4452('0x2c')];if(!_0x27f714[_0x4452('0x2e')][_0x4452('0x33')](_0x4452('0x34'))){_0x40507d[_0x4452('0x1c')]=qs['limit'](_0x27f714[_0x4452('0x2e')][_0x4452('0x1c')]);_0x40507d[_0x4452('0x1a')]=qs[_0x4452('0x1a')](_0x27f714[_0x4452('0x2e')][_0x4452('0x1a')]);}_0x40507d['order']=qs['sort'](_0x27f714[_0x4452('0x2e')][_0x4452('0x35')]);_0x40507d[_0x4452('0x36')]=qs['filters'](_[_0x4452('0x37')](_0x27f714[_0x4452('0x2e')],_0xfa06bc[_0x4452('0x38')]),_0xb02b32);if(_0x27f714[_0x4452('0x2e')][_0x4452('0x39')]){_0x40507d['where']=_[_0x4452('0x3a')](_0x40507d[_0x4452('0x36')],{'$or':_[_0x4452('0x27')](_0xb02b32,function(_0x29262b){if(_0x29262b['type']!==_0x4452('0x3b')){var _0x22a830={};_0x22a830[_0x29262b[_0x4452('0x2d')]]={'$like':'%'+_0x27f714[_0x4452('0x2e')]['filter']+'%'};return _0x22a830;}})});}_0x40507d=_[_0x4452('0x3a')]({},_0x40507d,_0x27f714[_0x4452('0x3c')]);var _0x2f0758={'where':_0x40507d[_0x4452('0x36')]};return db['FaxApplication'][_0x4452('0x3d')](_0x2f0758)[_0x4452('0x22')](function(_0x245855){_0x3bd7f1[_0x4452('0x3d')]=_0x245855;if(_0x27f714[_0x4452('0x2e')]['includeAll']){_0x40507d['include']=[{'all':!![]}];}return db[_0x4452('0x28')][_0x4452('0x3e')](_0x40507d);})[_0x4452('0x22')](function(_0xd3c43b){_0x3bd7f1[_0x4452('0x3f')]=_0xd3c43b;return _0x3bd7f1;})[_0x4452('0x22')](respondWithFilteredResult(_0x234cea,_0x40507d))['catch'](handleError(_0x234cea,null));};exports[_0x4452('0x40')]=function(_0x5b65c5,_0x35cbeb){var _0x478343={'raw':!![],'where':{'id':_0x5b65c5[_0x4452('0x41')]['id']}},_0x155a6b={};_0x155a6b['model']=_['keys'](db[_0x4452('0x28')][_0x4452('0x42')]);_0x155a6b['query']=_[_0x4452('0x43')](_0x5b65c5[_0x4452('0x2e')]);_0x155a6b['filters']=_[_0x4452('0x2f')](_0x155a6b[_0x4452('0x2c')],_0x155a6b[_0x4452('0x2e')]);_0x478343['attributes']=_[_0x4452('0x2f')](_0x155a6b[_0x4452('0x2c')],qs[_0x4452('0x30')](_0x5b65c5[_0x4452('0x2e')][_0x4452('0x30')]));_0x478343['attributes']=_0x478343[_0x4452('0x31')][_0x4452('0x32')]?_0x478343[_0x4452('0x31')]:_0x155a6b[_0x4452('0x2c')];if(_0x5b65c5[_0x4452('0x2e')][_0x4452('0x44')]){_0x478343[_0x4452('0x45')]=[{'all':!![]}];}_0x478343=_[_0x4452('0x3a')]({},_0x478343,_0x5b65c5[_0x4452('0x3c')]);return db['FaxApplication'][_0x4452('0x46')](_0x478343)[_0x4452('0x22')](handleEntityNotFound(_0x35cbeb,null))[_0x4452('0x22')](respondWithResult(_0x35cbeb,null))[_0x4452('0x47')](handleError(_0x35cbeb,null));};exports['create']=function(_0x438148,_0x221a63){return db[_0x4452('0x28')][_0x4452('0x48')](_0x438148[_0x4452('0x49')],{})[_0x4452('0x22')](respondWithResult(_0x221a63,0xc9))['catch'](handleError(_0x221a63,null));};exports[_0x4452('0x21')]=function(_0x14e94b,_0x35d420){if(_0x14e94b[_0x4452('0x49')]['id']){delete _0x14e94b[_0x4452('0x49')]['id'];}return db[_0x4452('0x28')][_0x4452('0x46')]({'where':{'id':_0x14e94b[_0x4452('0x41')]['id']}})[_0x4452('0x22')](handleEntityNotFound(_0x35d420,null))[_0x4452('0x22')](saveUpdates(_0x14e94b[_0x4452('0x49')],null))[_0x4452('0x22')](respondWithResult(_0x35d420,null))[_0x4452('0x47')](handleError(_0x35d420,null));};exports['destroy']=function(_0x570295,_0x1dd15c){return db[_0x4452('0x28')]['find']({'where':{'id':_0x570295[_0x4452('0x41')]['id']}})[_0x4452('0x22')](handleEntityNotFound(_0x1dd15c,null))[_0x4452('0x22')](removeEntity(_0x1dd15c,null))['catch'](handleError(_0x1dd15c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 54190d6..290a730 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 _0x8fdc=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4e70b3,_0x5871fb){var _0x5f5669=function(_0x8b6229){while(--_0x8b6229){_0x4e70b3['push'](_0x4e70b3['shift']());}};_0x5f5669(++_0x5871fb);}(_0x8fdc,0x1e4));var _0xc8fd=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x8fdc[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0xc8fd('0x0'));var util=require(_0xc8fd('0x1'));var logger=require('../../config/logger')(_0xc8fd('0x2'));var moment=require(_0xc8fd('0x3'));var BPromise=require(_0xc8fd('0x4'));var rp=require(_0xc8fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8fd('0x6'));var config=require(_0xc8fd('0x7'));var attributes=require(_0xc8fd('0x8'));module[_0xc8fd('0x9')]=function(_0x50ed61,_0x33f285){return _0x50ed61[_0xc8fd('0xa')](_0xc8fd('0xb'),attributes,{'tableName':_0xc8fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8fd('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe4e8=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x22ba97,_0x166d5a){var _0x10bebf=function(_0x5425c5){while(--_0x5425c5){_0x22ba97['push'](_0x22ba97['shift']());}};_0x10bebf(++_0x166d5a);}(_0xe4e8,0x121));var _0x8e4e=function(_0x137ade,_0x36e463){_0x137ade=_0x137ade-0x0;var _0x59f856=_0xe4e8[_0x137ade];return _0x59f856;};'use strict';var _=require(_0x8e4e('0x0'));var util=require('util');var logger=require(_0x8e4e('0x1'))(_0x8e4e('0x2'));var moment=require(_0x8e4e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e4e('0x4'));var rimraf=require('rimraf');var config=require(_0x8e4e('0x5'));var attributes=require(_0x8e4e('0x6'));module['exports']=function(_0x56e2d1,_0x21e9e1){return _0x56e2d1[_0x8e4e('0x7')](_0x8e4e('0x8'),attributes,{'tableName':_0x8e4e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e4e('0xa'),'collate':_0x8e4e('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index adb6ed8..0cbfad4 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 _0x745d=['../../config/logger','rpc','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','info','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3733e8,_0xdd55f6){var _0x2185f0=function(_0x67ab46){while(--_0x67ab46){_0x3733e8['push'](_0x3733e8['shift']());}};_0x2185f0(++_0xdd55f6);}(_0x745d,0x1cb));var _0xd745=function(_0x524727,_0x48334e){_0x524727=_0x524727-0x0;var _0x512426=_0x745d[_0x524727];return _0x512426;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd745('0x0'));var BPromise=require(_0xd745('0x1'));var rs=require(_0xd745('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd745('0x3'))['db'];var utils=require(_0xd745('0x4'));var logger=require(_0xd745('0x5'))(_0xd745('0x6'));var config=require('../../config/environment');var jayson=require(_0xd745('0x7'));var client=jayson[_0xd745('0x8')][_0xd745('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x227906,_0x1d975d,_0x2617e8){return new BPromise(function(_0x47c085,_0x525cd0){return client['request'](_0x227906,_0x2617e8)[_0xd745('0xa')](function(_0x82bc9a){logger['info'](_0xd745('0xb'),_0x1d975d,'request\x20sent');logger['debug'](_0xd745('0xc'),_0x1d975d,_0xd745('0xd'),JSON[_0xd745('0xe')](_0x82bc9a));if(_0x82bc9a[_0xd745('0xf')]){if(_0x82bc9a[_0xd745('0xf')]['code']===0x1f4){logger[_0xd745('0xf')](_0xd745('0xb'),_0x1d975d,_0x82bc9a['error'][_0xd745('0x10')]);return _0x525cd0(_0x82bc9a['error'][_0xd745('0x10')]);}logger[_0xd745('0xf')](_0xd745('0xb'),_0x1d975d,_0x82bc9a[_0xd745('0xf')][_0xd745('0x10')]);return _0x47c085(_0x82bc9a[_0xd745('0xf')][_0xd745('0x10')]);}else{logger['info'](_0xd745('0xb'),_0x1d975d,_0xd745('0xd'));_0x47c085(_0x82bc9a['result'][_0xd745('0x10')]);}})[_0xd745('0x11')](function(_0x2977bf){logger[_0xd745('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1d975d,_0x2977bf);_0x525cd0(_0x2977bf);});});}exports[_0xd745('0x12')]=function(_0x28f54e){var _0x4a96ba=this;return new Promise(function(_0x54bcc7,_0x2ee624){return db[_0xd745('0x13')][_0xd745('0x14')](_0x28f54e[_0xd745('0x15')],{'raw':_0x28f54e['options']?_0x28f54e[_0xd745('0x16')][_0xd745('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f54e[_0xd745('0x16')]?_0x28f54e[_0xd745('0x16')][_0xd745('0x18')]||null:null,'attributes':_0x28f54e['options']?_0x28f54e[_0xd745('0x16')][_0xd745('0x19')]||null:null,'limit':_0x28f54e[_0xd745('0x16')]?_0x28f54e[_0xd745('0x16')][_0xd745('0x1a')]||null:null})[_0xd745('0xa')](function(_0x393252){logger[_0xd745('0x1b')](_0xd745('0x12'),_0x28f54e);logger[_0xd745('0x1c')]('UpdateFaxApplication',_0x28f54e,JSON['stringify'](_0x393252));_0x54bcc7(_0x393252);})[_0xd745('0x11')](function(_0x4263da){logger[_0xd745('0xf')]('UpdateFaxApplication',_0x4263da[_0xd745('0x10')],_0x28f54e);_0x2ee624(_0x4a96ba[_0xd745('0xf')](0x1f4,_0x4263da['message']));});});}; \ No newline at end of file +var _0xc222=['request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1fe7c3,_0x2f7c6e){var _0x490542=function(_0x1f9859){while(--_0x1f9859){_0x1fe7c3['push'](_0x1fe7c3['shift']());}};_0x490542(++_0x2f7c6e);}(_0xc222,0x144));var _0x2c22=function(_0x1d8051,_0x32d218){_0x1d8051=_0x1d8051-0x0;var _0x16a680=_0xc222[_0x1d8051];return _0x16a680;};'use strict';var _=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var moment=require(_0x2c22('0x2'));var BPromise=require(_0x2c22('0x3'));var rs=require(_0x2c22('0x4'));var fs=require('fs');var Redis=require(_0x2c22('0x5'));var db=require(_0x2c22('0x6'))['db'];var utils=require(_0x2c22('0x7'));var logger=require(_0x2c22('0x8'))(_0x2c22('0x9'));var config=require('../../config/environment');var jayson=require(_0x2c22('0xa'));var client=jayson[_0x2c22('0xb')][_0x2c22('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x580c28,_0x5144a0,_0x1ad987){return new BPromise(function(_0x5e8253,_0x2da1c5){return client[_0x2c22('0xd')](_0x580c28,_0x1ad987)[_0x2c22('0xe')](function(_0x30548b){logger[_0x2c22('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'));logger[_0x2c22('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'),JSON[_0x2c22('0x12')](_0x30548b));if(_0x30548b[_0x2c22('0x13')]){if(_0x30548b[_0x2c22('0x13')][_0x2c22('0x14')]===0x1f4){logger[_0x2c22('0x13')](_0x2c22('0x15'),_0x5144a0,_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);return _0x2da1c5(_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);}logger[_0x2c22('0x13')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);return _0x5e8253(_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);}else{logger[_0x2c22('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'));_0x5e8253(_0x30548b[_0x2c22('0x17')][_0x2c22('0x16')]);}})[_0x2c22('0x18')](function(_0x470de4){logger[_0x2c22('0x13')](_0x2c22('0x15'),_0x5144a0,_0x470de4);_0x2da1c5(_0x470de4);});});}exports['UpdateFaxApplication']=function(_0x3f6858){var _0x42439e=this;return new Promise(function(_0x4db004,_0x4d7b05){return db[_0x2c22('0x19')][_0x2c22('0x1a')](_0x3f6858[_0x2c22('0x1b')],{'raw':_0x3f6858['options']?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1e')]||null:null,'attributes':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1f')]||null:null,'limit':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x20')]||null:null})['then'](function(_0x3e8796){logger['info'](_0x2c22('0x21'),_0x3f6858);logger[_0x2c22('0x11')](_0x2c22('0x21'),_0x3f6858,JSON[_0x2c22('0x12')](_0x3e8796));_0x4db004(_0x3e8796);})[_0x2c22('0x18')](function(_0x4e2e37){logger[_0x2c22('0x13')]('UpdateFaxApplication',_0x4e2e37[_0x2c22('0x16')],_0x3f6858);_0x4d7b05(_0x42439e['error'](0x1f4,_0x4e2e37[_0x2c22('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f1f96af..508cdbb 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x51a303,_0xe0cc5e){var _0x24f28d=function(_0x5ee8c5){while(--_0x5ee8c5){_0x51a303['push'](_0x51a303['shift']());}};_0x24f28d(++_0xe0cc5e);}(_0x2032,0xd9));var _0x2203=function(_0x51f992,_0x1f11a5){_0x51f992=_0x51f992-0x0;var _0xdd0952=_0x2032[_0x51f992];return _0xdd0952;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x15b516,_0x53b695){var _0x8a07eb=function(_0x255d6a){while(--_0x255d6a){_0x15b516['push'](_0x15b516['shift']());}};_0x8a07eb(++_0x53b695);}(_0x9348,0x10d));var _0x8934=function(_0x5aee68,_0x15d937){_0x5aee68=_0x5aee68-0x0;var _0x5bf097=_0x9348[_0x5aee68];return _0x5bf097;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 462bcfc..f8fde2e 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 _0x9b95=['ENUM','out','DATE','sequelize','exports','STRING'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x9b95,0x81));var _0x59b9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9b95[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x59b9('0x0'));module[_0x59b9('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x59b9('0x2')]},'secondDisposition':{'type':Sequelize[_0x59b9('0x2')]},'thirdDisposition':{'type':Sequelize[_0x59b9('0x2')]},'note':{'type':Sequelize[_0x59b9('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x59b9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x59b9('0x3')]('in',_0x59b9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x59b9('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x59b9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd9f1=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x563c0b,_0x391c64){var _0x2ed720=function(_0x4ed8d8){while(--_0x4ed8d8){_0x563c0b['push'](_0x563c0b['shift']());}};_0x2ed720(++_0x391c64);}(_0xd9f1,0xc9));var _0x1d9f=function(_0x265adb,_0x44ef5c){_0x265adb=_0x265adb-0x0;var _0x119773=_0xd9f1[_0x265adb];return _0x119773;};'use strict';var Sequelize=require(_0x1d9f('0x0'));module[_0x1d9f('0x1')]={'closed':{'type':Sequelize[_0x1d9f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1d9f('0x3')]},'disposition':{'type':Sequelize[_0x1d9f('0x4')]},'secondDisposition':{'type':Sequelize[_0x1d9f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1d9f('0x4')]},'note':{'type':Sequelize[_0x1d9f('0x4')]},'read1stAt':{'type':Sequelize[_0x1d9f('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1d9f('0x5')]('in',_0x1d9f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1d9f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1d9f('0x6')),'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 e46f460..ab837f1 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 _0x7fb9=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','offset','undefined','count','set','Content-Range','save','update','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','FaxInteraction','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','FaxAccountId','concat','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','contactName','DESC','having','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','rawAttributes','includeAll','include','merge','options','create','destroy','describe','FaxMessage','ids','$gte','format','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','pipe','basename','log','err','unlinkSync','eml-format','zip-dir'];(function(_0x46c2f8,_0x1d0181){var _0x22db82=function(_0x5e2197){while(--_0x5e2197){_0x46c2f8['push'](_0x46c2f8['shift']());}};_0x22db82(++_0x1d0181);}(_0x7fb9,0x1ae));var _0x97fb=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7fb9[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x97fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97fb('0x1'));var jsonpatch=require(_0x97fb('0x2'));var rp=require(_0x97fb('0x3'));var moment=require('moment');var BPromise=require(_0x97fb('0x4'));var Mustache=require(_0x97fb('0x5'));var util=require(_0x97fb('0x6'));var path=require(_0x97fb('0x7'));var sox=require(_0x97fb('0x8'));var csv=require(_0x97fb('0x9'));var ejs=require(_0x97fb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97fb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97fb('0xc'));var deskjs=require(_0x97fb('0xd'));var toCsv=require(_0x97fb('0x9'));var querystring=require(_0x97fb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x97fb('0xf'));var qs=require(_0x97fb('0x10'));var as=require(_0x97fb('0x11'));var hardwareService=require(_0x97fb('0x12'));var logger=require('../../config/logger')(_0x97fb('0x13'));var utils=require('../../config/utils');var config=require(_0x97fb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x97fb('0x15'))['db'];config[_0x97fb('0x16')]=_['defaults'](config[_0x97fb('0x16')],{'host':_0x97fb('0x17'),'port':0x18eb});var socket=require(_0x97fb('0x18'))(new Redis(config[_0x97fb('0x16')]));require(_0x97fb('0x19'))[_0x97fb('0x1a')](socket);function respondWithStatusCode(_0x37903f,_0x5089dc){_0x5089dc=_0x5089dc||0xcc;return function(_0x1a1830){if(_0x1a1830){return _0x37903f[_0x97fb('0x1b')](_0x5089dc);}return _0x37903f['status'](_0x5089dc)[_0x97fb('0x1c')]();};}function respondWithResult(_0x3d24ca,_0x2d9a15){_0x2d9a15=_0x2d9a15||0xc8;return function(_0x10704f){if(_0x10704f){return _0x3d24ca[_0x97fb('0x1d')](_0x2d9a15)['json'](_0x10704f);}};}function respondWithFilteredResult(_0x3d62ca,_0x587861){return function(_0x869adf){if(_0x869adf){var _0x62ded1=typeof _0x587861[_0x97fb('0x1e')]===_0x97fb('0x1f')&&typeof _0x587861['limit']===_0x97fb('0x1f');var _0x5b155a=_0x869adf[_0x97fb('0x20')];var _0x552d0b=_0x62ded1?0x0:_0x587861[_0x97fb('0x1e')];var _0x1e6068=_0x62ded1?_0x869adf[_0x97fb('0x20')]:_0x587861[_0x97fb('0x1e')]+_0x587861['limit'];var _0xcbcd08;if(_0x1e6068>=_0x5b155a){_0x1e6068=_0x5b155a;_0xcbcd08=0xc8;}else{_0xcbcd08=0xce;}_0x3d62ca[_0x97fb('0x1d')](_0xcbcd08);return _0x3d62ca[_0x97fb('0x21')](_0x97fb('0x22'),_0x552d0b+'-'+_0x1e6068+'/'+_0x5b155a)['json'](_0x869adf);}return null;};}function patchUpdates(_0x1de7f5){return function(_0x19a082){try{jsonpatch['apply'](_0x19a082,_0x1de7f5,!![]);}catch(_0x15c1f7){return BPromise['reject'](_0x15c1f7);}return _0x19a082[_0x97fb('0x23')]();};}function saveUpdates(_0x5d9cc9,_0x2455fe){return function(_0x11a9c3){if(_0x11a9c3){return _0x11a9c3[_0x97fb('0x24')](_0x5d9cc9)[_0x97fb('0x25')](function(_0x29609c){return _0x29609c;});}return null;};}function removeEntity(_0x55e467,_0x5a0b17){return function(_0x2c90af){if(_0x2c90af){return _0x2c90af['destroy']()[_0x97fb('0x25')](function(){_0x55e467[_0x97fb('0x1d')](0xcc)[_0x97fb('0x1c')]();});}};}function handleEntityNotFound(_0x5797f5,_0x5a4798){return function(_0xc7cd68){if(!_0xc7cd68){_0x5797f5[_0x97fb('0x1b')](0x194);}return _0xc7cd68;};}function handleError(_0x401bce,_0x10307f){_0x10307f=_0x10307f||0x1f4;return function(_0x4e119f){logger[_0x97fb('0x26')](_0x4e119f[_0x97fb('0x27')]);if(_0x4e119f[_0x97fb('0x28')]){delete _0x4e119f[_0x97fb('0x28')];}_0x401bce[_0x97fb('0x1d')](_0x10307f)[_0x97fb('0x29')](_0x4e119f);};}function getInteractionUsers(_0x5d53f9,_0x38f3d6){return new BPromise(function(_0x10df17,_0x4a3974){try{if(_0x38f3d6[_0x5d53f9['id']]){_0x5d53f9[_0x97fb('0x2a')]=_[_0x97fb('0x2b')](_0x38f3d6[_0x5d53f9['id']],function(_0x46e5c0){return{'id':_0x46e5c0['id'],'fullname':_0x46e5c0['fullname']};});}}catch(_0x89f80f){_0x4a3974(_0x89f80f);}_0x10df17(_0x5d53f9);});}function getInteractionTags(_0x19a32c,_0x32bdb4){return new BPromise(function(_0x1a6cbe,_0x577974){try{if(_0x19a32c[_0x97fb('0x2c')]){_0x19a32c[_0x97fb('0x2d')]=[];_0x19a32c['TagIds'][_0x97fb('0x2e')](',')[_0x97fb('0x2f')](function(_0xfb3ed6){_0x19a32c[_0x97fb('0x2d')][_0x97fb('0x30')](_0x32bdb4[_0xfb3ed6]);});}delete _0x19a32c[_0x97fb('0x2c')];}catch(_0x4263f4){_0x577974(_0x4263f4);}_0x1a6cbe(_0x19a32c);});}function updateFaxInteraction(_0x1e68dd,_0x4d6635,_0x516790){return new BPromise(function(_0x201a19,_0x4f439d){return getInteractionUsers(_0x1e68dd,_0x516790)[_0x97fb('0x25')](function(_0x370e27){return getInteractionTags(_0x370e27,_0x4d6635);})['then'](function(_0x54f53b){return getStateInteraction(_0x54f53b);})[_0x97fb('0x25')](function(_0x2a9ac9){_0x201a19(_0x2a9ac9);})[_0x97fb('0x31')](function(_0x4dcfc6){_0x4f439d(_0x4dcfc6);});});}function getStateInteraction(_0x3ecf99){return new BPromise(function(_0x559457){_0x3ecf99[_0x97fb('0x32')]=0x0;_0x3ecf99[_0x97fb('0x33')]=0x0;_0x3ecf99[_0x97fb('0x34')]=0x0;_0x3ecf99['unmanaged']=0x0;_0x3ecf99[_0x97fb('0x35')]=0x0;if(!_0x3ecf99[_0x97fb('0x36')]&&!_0x3ecf99['UserId']){_0x3ecf99[_0x97fb('0x32')]+=0x1;}if(!_0x3ecf99[_0x97fb('0x36')]&&_0x3ecf99[_0x97fb('0x37')]){_0x3ecf99['talking']+=0x1;if(_0x3ecf99[_0x97fb('0x32')]){_0x3ecf99[_0x97fb('0x32')]-=0x1;}}if(_0x3ecf99[_0x97fb('0x36')]&&_0x3ecf99[_0x97fb('0x37')]){_0x3ecf99[_0x97fb('0x34')]+=0x1;if(_0x3ecf99['talking']){_0x3ecf99[_0x97fb('0x33')]-=0x1;}}if(_0x3ecf99['closed']&&!_0x3ecf99[_0x97fb('0x37')]){_0x3ecf99[_0x97fb('0x38')]+=0x1;if(_0x3ecf99['waiting']){_0x3ecf99[_0x97fb('0x32')]-=0x1;}}_0x3ecf99['total']+=0x1;_0x559457(_0x3ecf99);});}exports[_0x97fb('0x39')]=function(_0xecf79f,_0x4c2889){var _0x57ca0f={},_0x16475b={},_0x1ace8d={'count':0x0,'rows':[]};var _0x3c1dcb=_[_0x97fb('0x2b')](db[_0x97fb('0x3a')]['rawAttributes'],function(_0x52c3be){return{'name':_0x52c3be['fieldName'],'type':_0x52c3be[_0x97fb('0x3b')][_0x97fb('0x3c')]};});_0x16475b[_0x97fb('0x3d')]=_[_0x97fb('0x2b')](_0x3c1dcb,'name');_0x16475b['query']=_[_0x97fb('0x3e')](_0xecf79f[_0x97fb('0x3f')]);_0x16475b[_0x97fb('0x40')]=_[_0x97fb('0x41')](_0x16475b[_0x97fb('0x3d')],_0x16475b[_0x97fb('0x3f')]);_0x57ca0f[_0x97fb('0x42')]=_['intersection'](_0x16475b[_0x97fb('0x3d')],qs[_0x97fb('0x43')](_0xecf79f['query'][_0x97fb('0x43')]));_0x57ca0f['attributes']=_0x57ca0f[_0x97fb('0x42')][_0x97fb('0x44')]?_0x57ca0f[_0x97fb('0x42')]:_0x16475b[_0x97fb('0x3d')];if(!_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x45')](_0x97fb('0x46'))){_0x57ca0f[_0x97fb('0x47')]=qs[_0x97fb('0x47')](_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x47')]);_0x57ca0f[_0x97fb('0x1e')]=qs[_0x97fb('0x1e')](_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x1e')]);}_0x57ca0f[_0x97fb('0x48')]=qs[_0x97fb('0x49')](_0xecf79f['query'][_0x97fb('0x49')]);_0x57ca0f[_0x97fb('0x4a')]=qs[_0x97fb('0x40')](_[_0x97fb('0x4b')](_0xecf79f[_0x97fb('0x3f')],_0x16475b['filters']),_0x3c1dcb);var _0x3047d0=[];var _0xe14ff2=squel['select']()[_0x97fb('0x4c')]('id')[_0x97fb('0x4c')](_0x97fb('0x28'))[_0x97fb('0x4c')](_0x97fb('0x4d'))[_0x97fb('0x4e')](_0x97fb('0x4f'));var _0x4ed5c7=squel[_0x97fb('0x50')]()[_0x97fb('0x4c')](_0x97fb('0x51'))[_0x97fb('0x4c')](_0x97fb('0x52'))[_0x97fb('0x4c')](_0x97fb('0x53'))['from']('user_has_fax_interactions','ui')[_0x97fb('0x54')](_0x97fb('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x30268a=squel[_0x97fb('0x50')]()[_0x97fb('0x4e')](_0x97fb('0x56'),'i')[_0x97fb('0x54')](_0x97fb('0x57'),'c',_0x97fb('0x58'))['left_join']('users','o',_0x97fb('0x59'))[_0x97fb('0x54')](_0x97fb('0x5a'),'a','a.id\x20=\x20i.FaxAccountId')[_0x97fb('0x54')](_0x97fb('0x5b'),'me',_0x97fb('0x5c'))[_0x97fb('0x54')]('fax_interaction_has_tags','it',_0x97fb('0x5d'))[_0x97fb('0x54')](_0x97fb('0x4f'),'t',_0x97fb('0x5e'));var _0x5d1e42=squel[_0x97fb('0x5f')]();var _0x461939=[];var _0x15d0e0=squel[_0x97fb('0x5f')]();var _0x487602;if(_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x60')]){_0x487602=as[_0x97fb('0x61')](_0xecf79f['query']['search']);var _0x4d7dbe=_0x487602['sqlOperator'];for(var _0x423846=0x0;_0x423846<_0x487602[_0x97fb('0x62')][_0x97fb('0x44')];_0x423846++){var _0x24119c=_0x487602[_0x97fb('0x62')][_0x423846];var _0x1ebc95='i';var _0xa1a23d=_[_0x97fb('0x63')](_0x3c1dcb,[_0x97fb('0x28'),_0x24119c[_0x97fb('0x4c')]]);if(!_0xa1a23d){switch(_0x24119c[_0x97fb('0x4c')]){case _0x97fb('0x64'):if(_0x24119c[_0x97fb('0x65')]==0x1){_0x30268a['having']('`'+_0x24119c['field']+_0x97fb('0x66'));}else{_0x30268a['having']('`'+_0x24119c[_0x97fb('0x4c')]+_0x97fb('0x67'));}break;case _0x97fb('0x68'):if(_0x24119c[_0x97fb('0x69')]===_0x97fb('0x6a')){if(_0x24119c[_0x97fb('0x65')][_0x97fb('0x2e')]('\x20')[_0x97fb('0x44')]>0x1){_0x5d1e42[_0x4d7dbe]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x97fb('0x6b')](_0x24119c[_0x97fb('0x65')]),null);}else{var _0x5413f4='%'+_0x24119c[_0x97fb('0x65')]+'%';_0x5d1e42[_0x4d7dbe](_0x97fb('0x6c'),_0x5413f4,_0x5413f4,_0x5413f4);}}else{_0xa1a23d=_[_0x97fb('0x63')](_0x3c1dcb,[_0x97fb('0x28'),'ContactId']);_0x24119c[_0x97fb('0x4c')]=_0x97fb('0x6d');_0x5e1c3e=as[_0x97fb('0x6e')](_0x1ebc95,_0xa1a23d[_0x97fb('0x3b')],_0x24119c);_0x5d1e42[_0x4d7dbe](_0x5e1c3e[_0x97fb('0x6f')],_0x5e1c3e[_0x97fb('0x65')]['start'],_0x5e1c3e[_0x97fb('0x65')][_0x97fb('0x1c')]);}break;case _0x97fb('0x70'):var _0x7dfb0c=_0x24119c['value'][_0x97fb('0x2e')](',')[_0x97fb('0x2b')](function(_0x4cd342){return Number(_0x4cd342);});_0x7dfb0c[_0x97fb('0x2f')](function(_0x3b1e25){_0x15d0e0['or'](_0x97fb('0x71'),'%,'+_0x3b1e25+',%');});_0x461939=_[_0x97fb('0x72')](_0x461939,_0x7dfb0c);break;case'User':if(_0x24119c[_0x97fb('0x69')]===_0x97fb('0x6a')){_0x5d1e42[_0x4d7dbe](_0x97fb('0x73'),'%'+_0x24119c['value']+'%',null);}else{_0xa1a23d=_['find'](_0x3c1dcb,['name',_0x97fb('0x37')]);_0x24119c['field']='UserId';_0x5e1c3e=as[_0x97fb('0x6e')](_0x1ebc95,_0xa1a23d[_0x97fb('0x3b')],_0x24119c);_0x5d1e42[_0x4d7dbe](_0x5e1c3e[_0x97fb('0x6f')],_0x5e1c3e['value'][_0x97fb('0x74')],_0x5e1c3e[_0x97fb('0x65')][_0x97fb('0x1c')]);}break;case _0x97fb('0x75'):_0x5e1c3e=as[_0x97fb('0x6e')]('me',null,_0x24119c);_0x5d1e42[_0x4d7dbe](_0x5e1c3e['text'],_0x5e1c3e['value'][_0x97fb('0x74')],_0x5e1c3e[_0x97fb('0x65')][_0x97fb('0x1c')]);break;}}else{var _0x5e1c3e=as[_0x97fb('0x6e')](_0x1ebc95,_0xa1a23d[_0x97fb('0x3b')],_0x24119c);_0x5d1e42[_0x4d7dbe](_0x5e1c3e[_0x97fb('0x6f')],_0x5e1c3e[_0x97fb('0x65')]['start'],_0x5e1c3e[_0x97fb('0x65')][_0x97fb('0x1c')]);}}}else{var _0x3ec037=_(_0xecf79f[_0x97fb('0x3f')])['keys']()[_0x97fb('0x2b')](function(_0x25a579){return _[_0x97fb('0x76')](_0x3c1dcb,['name',_0x25a579])?_0x25a579:undefined;})[_0x97fb('0x77')]()[_0x97fb('0x65')]();if(!_['isEmpty'](_0x3ec037)){_0x3ec037[_0x97fb('0x2f')](function(_0x15abbb){if(_0x15abbb===_0x97fb('0x78')){_0x30268a[_0x97fb('0x4a')]('i.FaxAccountId\x20IN\x20?',[][_0x97fb('0x79')](_0xecf79f[_0x97fb('0x3f')][_0x15abbb]));}else if(_0x15abbb==='createdAt'){var _0xc31ce=JSON['parse'](_0xecf79f['query'][_0x15abbb])['$gte'];var _0x294f14=JSON[_0x97fb('0x7a')](_0xecf79f['query'][_0x15abbb])[_0x97fb('0x7b')];_0x30268a[_0x97fb('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc31ce,_0x294f14);}else{if(_0xecf79f[_0x97fb('0x3f')][_0x15abbb]==='null'){_0x30268a['where']('i.'+_0x15abbb+_0x97fb('0x7c'));}else{_0x30268a[_0x97fb('0x4a')]('i.'+_0x15abbb+_0x97fb('0x7d'),_0xecf79f['query'][_0x15abbb]);}}});}if(_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x7e')]){if(_0xecf79f['query']['read']==0x1){_0x30268a['having'](_0x97fb('0x7f'));}else{_0x30268a['having']('`unreadMessages`\x20>\x200');}}if(_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x80')]){_0x461939=_[_0x97fb('0x81')](_0xecf79f['query'][_0x97fb('0x80')])?_0xecf79f[_0x97fb('0x3f')]['tag']:new Array(_0xecf79f[_0x97fb('0x3f')]['tag']);_0x461939['forEach'](function(_0x578a5b){_0x15d0e0['or'](_0x97fb('0x71'),'%,'+_0x578a5b+',%');});}if(_0xecf79f['query'][_0x97fb('0x82')]){var _0x17bc1b=_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x82')]['replace']('\x5c','\x5c\x5c')[_0x97fb('0x83')](/'/g,'\x27\x27');if(qs[_0x97fb('0x84')](_0x17bc1b)){_0x5d1e42['or'](_0x97fb('0x85'),_0x17bc1b+'%')['or'](_0x97fb('0x86'),_0x17bc1b+'%');}_0x5d1e42['or'](_0x97fb('0x87'),_0x17bc1b+'%');}}_0x30268a[_0x97fb('0x4a')](_0x5d1e42);_0x30268a[_0x97fb('0x88')]('i.id');var _0x50400f={'type':db[_0x97fb('0x89')]['QueryTypes'][_0x97fb('0x8a')],'raw':!![]};var _0x1a8e6b=_0x30268a[_0x97fb('0x8b')]();_0x1a8e6b['field'](_0x97fb('0x8c'));_0x1a8e6b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x97fb('0x64'));if(_0x57ca0f[_0x97fb('0x48')]){_0x57ca0f[_0x97fb('0x48')][_0x97fb('0x2f')](function(_0x4abd22){var _0x4df531=_0x4abd22[0x0]===_0x97fb('0x8d')?_0x4abd22[0x0]:'i.'+_0x4abd22[0x0];_0x30268a[_0x97fb('0x48')](_0x4df531,_0x4abd22[0x1]===_0x97fb('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x461939)){_0x30268a[_0x97fb('0x8f')](_0x15d0e0);_0x1a8e6b[_0x97fb('0x4a')](_0x97fb('0x90'),_0x461939);}BPromise[_0x97fb('0x91')]()[_0x97fb('0x25')](function(){if(!_0x487602){if(_0xecf79f['query']['FaxAccountId'])return;_0x1a8e6b[_0x97fb('0x4a')](_0x97fb('0x92'));_0x30268a[_0x97fb('0x4a')](_0x97fb('0x92'));return;}if(_0xecf79f[_0x97fb('0x93')][_0x97fb('0x94')]!=='agent')return;return _0xecf79f['user'][_0x97fb('0x95')]({'attributes':['id'],'raw':!![]})[_0x97fb('0x25')](function(_0x52f2e1){if(_[_0x97fb('0x96')](_0x52f2e1)){_0x1a8e6b['where'](_0x97fb('0x97'));_0x30268a[_0x97fb('0x4a')](_0x97fb('0x97'));}else{_0x1a8e6b[_0x97fb('0x4a')](_0x97fb('0x98'),_[_0x97fb('0x2b')](_0x52f2e1,'id'));_0x30268a[_0x97fb('0x4a')](_0x97fb('0x98'),_[_0x97fb('0x2b')](_0x52f2e1,'id'));}});})[_0x97fb('0x25')](function(){if(_0xecf79f['user'][_0x97fb('0x94')]===_0x97fb('0x99')&&!_0x487602&&!_0xecf79f[_0x97fb('0x3f')][_0x97fb('0x78')])return[];return db[_0x97fb('0x9a')]['query'](_0x1a8e6b[_0x97fb('0x9b')](),_0x50400f);})[_0x97fb('0x25')](function(_0x87dfa9){_0x1ace8d['count']=_0x87dfa9['length'];if(_0x1ace8d[_0x97fb('0x20')]===0x0)return[];return db[_0x97fb('0x9a')][_0x97fb('0x3f')](_0xe14ff2[_0x97fb('0x9b')](),_0x50400f)[_0x97fb('0x25')](function(_0x5bc04d){_0x3047d0=_[_0x97fb('0x9c')](_0x5bc04d,'id');_0x50400f=_['merge'](_0x50400f,{'model':db[_0x97fb('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xecf79f['query']['fields']){_0x57ca0f[_0x97fb('0x42')][_0x97fb('0x2f')](function(_0x217324){_0x30268a[_0x97fb('0x4c')]('i.'+_0x217324);});}else{_0x30268a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x30268a[_0x97fb('0x4c')](_0x97fb('0x9d'),'Account.key');_0x30268a[_0x97fb('0x4c')](_0x97fb('0x9e'),'Account.mandatoryDisposition');_0x30268a[_0x97fb('0x4c')](_0x97fb('0x9f'),_0x97fb('0x8d'));_0x30268a[_0x97fb('0x4c')](_0x97fb('0xa0'));_0x30268a[_0x97fb('0x4c')](_0x97fb('0xa1'),_0x97fb('0xa2'));_0x30268a[_0x97fb('0x4c')]('c.lastName',_0x97fb('0xa3'));_0x30268a['field'](_0x97fb('0xa4'),_0x97fb('0xa5'));_0x30268a['field'](_0x97fb('0xa6'),'Contact.phone');_0x30268a['field'](_0x97fb('0xa7'),_0x97fb('0xa8'));_0x30268a[_0x97fb('0x4c')](_0x97fb('0xa9'),'Contact.fax');_0x30268a[_0x97fb('0x4c')](_0x97fb('0xaa'),'Owner.fullname');_0x30268a['field'](_0x97fb('0xab'),_0x97fb('0xac'));_0x30268a[_0x97fb('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x97fb('0x2c'));}if(_0x57ca0f[_0x97fb('0x47')])_0x30268a[_0x97fb('0x47')](_0x57ca0f[_0x97fb('0x47')]);if(_0x57ca0f[_0x97fb('0x1e')])_0x30268a[_0x97fb('0x1e')](_0x57ca0f[_0x97fb('0x1e')]);return db[_0x97fb('0x9a')][_0x97fb('0x3f')](_0x30268a['toString'](),_0x50400f);})[_0x97fb('0x25')](function(_0x2e6036){if(_0x2e6036[_0x97fb('0x44')]>0x0)_0x4ed5c7['where'](_0x97fb('0xad'),_[_0x97fb('0x2b')](_0x2e6036,'id'));return db['sequelize'][_0x97fb('0x3f')](_0x4ed5c7[_0x97fb('0x9b')](),_0x50400f)['then'](function(_0xe55c76){var _0x2859a8=_[_0x97fb('0xae')](_0xe55c76,_0x97fb('0xaf'));var _0x5e7ffd=[];_0x2e6036[_0x97fb('0x2f')](function(_0x41b8af){_0x5e7ffd[_0x97fb('0x30')](updateFaxInteraction(_0x41b8af,_0x3047d0,_0x2859a8));});return BPromise['all'](_0x5e7ffd);});});})['then'](function(_0x546e3b){_0x1ace8d[_0x97fb('0xb0')]=_0x546e3b;return _0x1ace8d;})[_0x97fb('0x25')](respondWithFilteredResult(_0x4c2889,_0x57ca0f))[_0x97fb('0x31')](handleError(_0x4c2889,null));};exports[_0x97fb('0xb1')]=function(_0x577a45,_0x58278f){var _0x5d8ae5={'raw':![],'where':{'id':_0x577a45[_0x97fb('0xb2')]['id']}},_0xe39259={};_0xe39259[_0x97fb('0x3d')]=_[_0x97fb('0x3e')](db['FaxInteraction'][_0x97fb('0xb3')]);_0xe39259['query']=_[_0x97fb('0x3e')](_0x577a45[_0x97fb('0x3f')]);_0xe39259[_0x97fb('0x40')]=_['intersection'](_0xe39259[_0x97fb('0x3d')],_0xe39259[_0x97fb('0x3f')]);_0x5d8ae5[_0x97fb('0x42')]=_[_0x97fb('0x41')](_0xe39259[_0x97fb('0x3d')],qs[_0x97fb('0x43')](_0x577a45[_0x97fb('0x3f')][_0x97fb('0x43')]));_0x5d8ae5[_0x97fb('0x42')]=_0x5d8ae5[_0x97fb('0x42')][_0x97fb('0x44')]?_0x5d8ae5[_0x97fb('0x42')]:_0xe39259[_0x97fb('0x3d')];if(_0x577a45[_0x97fb('0x3f')][_0x97fb('0xb4')]){_0x5d8ae5[_0x97fb('0xb5')]=[{'all':!![]}];}_0x5d8ae5=_[_0x97fb('0xb6')]({},_0x5d8ae5,_0x577a45[_0x97fb('0xb7')]);return db['FaxInteraction'][_0x97fb('0x63')](_0x5d8ae5)['then'](handleEntityNotFound(_0x58278f,null))[_0x97fb('0x25')](respondWithResult(_0x58278f,null))['catch'](handleError(_0x58278f,null));};exports[_0x97fb('0xb8')]=function(_0x31ef97,_0x4a7828){return db[_0x97fb('0x3a')]['create'](_0x31ef97[_0x97fb('0x75')],{})[_0x97fb('0x25')](respondWithResult(_0x4a7828,0xc9))['catch'](handleError(_0x4a7828,null));};exports[_0x97fb('0x24')]=function(_0x30059f,_0x43b673){if(_0x30059f[_0x97fb('0x75')]['id']){delete _0x30059f['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x30059f['params']['id']}})[_0x97fb('0x25')](handleEntityNotFound(_0x43b673,null))['then'](saveUpdates(_0x30059f[_0x97fb('0x75')],null))[_0x97fb('0x25')](respondWithResult(_0x43b673,null))[_0x97fb('0x31')](handleError(_0x43b673,null));};exports[_0x97fb('0xb9')]=function(_0x34c7bd,_0x1fcfe7){return db[_0x97fb('0x3a')][_0x97fb('0x63')]({'where':{'id':_0x34c7bd[_0x97fb('0xb2')]['id']}})[_0x97fb('0x25')](handleEntityNotFound(_0x1fcfe7,null))[_0x97fb('0x25')](removeEntity(_0x1fcfe7,null))[_0x97fb('0x31')](handleError(_0x1fcfe7,null));};exports[_0x97fb('0xba')]=function(_0x2225e6,_0x5bc420){return db[_0x97fb('0x3a')][_0x97fb('0xba')]()[_0x97fb('0x25')](respondWithResult(_0x5bc420,null))[_0x97fb('0x31')](handleError(_0x5bc420,null));};exports['addMessage']=function(_0x438768,_0x26cb98,_0x55fbe5){return db[_0x97fb('0xbb')][_0x97fb('0x63')]({'where':{'id':_0x438768[_0x97fb('0xb2')]['id']}})['then'](handleEntityNotFound(_0x26cb98,null))[_0x97fb('0x25')](function(_0x45cf1a){if(_0x45cf1a){return _0x45cf1a['addMessage'](_0x438768[_0x97fb('0x75')]['ids'],_['omit'](_0x438768[_0x97fb('0x75')],[_0x97fb('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x26cb98,null))[_0x97fb('0x31')](handleError(_0x26cb98,null));};exports['getMessages']=function(_0x245c56,_0x312ba8,_0x2778ce){var _0x1a9cb8={'raw':![],'where':{}};var _0x15575d={};var _0x59bc3a={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x245c56['params']['id']}})[_0x97fb('0x25')](handleEntityNotFound(_0x312ba8,null))[_0x97fb('0x25')](function(_0x2f578d){if(_0x2f578d){_0x15575d['model']=_[_0x97fb('0x3e')](db[_0x97fb('0xbb')]['rawAttributes']);_0x15575d[_0x97fb('0x3f')]=_[_0x97fb('0x3e')](_0x245c56[_0x97fb('0x3f')]);_0x15575d['filters']=_['intersection'](_0x15575d[_0x97fb('0x3d')],_0x15575d[_0x97fb('0x3f')]);_0x1a9cb8[_0x97fb('0x42')]=_[_0x97fb('0x41')](_0x15575d[_0x97fb('0x3d')],qs[_0x97fb('0x43')](_0x245c56[_0x97fb('0x3f')]['fields']));_0x1a9cb8['attributes']=_0x1a9cb8[_0x97fb('0x42')][_0x97fb('0x44')]?_0x1a9cb8[_0x97fb('0x42')]:_0x15575d['model'];if(!_0x245c56['query'][_0x97fb('0x45')](_0x97fb('0x46'))){_0x1a9cb8[_0x97fb('0x47')]=qs[_0x97fb('0x47')](_0x245c56[_0x97fb('0x3f')][_0x97fb('0x47')]);_0x1a9cb8[_0x97fb('0x1e')]=qs[_0x97fb('0x1e')](_0x245c56[_0x97fb('0x3f')][_0x97fb('0x1e')]);}_0x1a9cb8[_0x97fb('0x48')]=qs[_0x97fb('0x49')](_0x245c56[_0x97fb('0x3f')][_0x97fb('0x49')]);_0x1a9cb8['where']=qs['filters'](_[_0x97fb('0x4b')](_0x245c56[_0x97fb('0x3f')],_0x15575d[_0x97fb('0x40')]));_0x1a9cb8[_0x97fb('0x4a')][_0x97fb('0xaf')]=_0x2f578d['id'];if(_0x245c56[_0x97fb('0x3f')][_0x97fb('0x82')]){_0x1a9cb8[_0x97fb('0x4a')]=_[_0x97fb('0xb6')](_0x1a9cb8[_0x97fb('0x4a')],{'$or':_[_0x97fb('0x2b')](_0x1a9cb8[_0x97fb('0x42')],function(_0x1d30cc){var _0x4c815f={};_0x4c815f[_0x1d30cc]={'$like':'%'+_0x245c56['query'][_0x97fb('0x82')]+'%'};return _0x4c815f;})});}if(_0x245c56[_0x97fb('0x3f')]['$gte']){var _0x543220=_0x245c56[_0x97fb('0x3f')][_0x97fb('0xbd')]['split'](',');var _0x1d0e17={};_0x1d0e17[_0x543220[0x0]]={'$gte':moment(_0x543220[0x1])[_0x97fb('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a9cb8[_0x97fb('0x4a')]=_['merge'](_0x1a9cb8[_0x97fb('0x4a')],_0x1d0e17);}_0x1a9cb8=_[_0x97fb('0xb6')]({},_0x1a9cb8,_0x245c56[_0x97fb('0xb7')]);return db[_0x97fb('0xbb')]['count']({'where':_0x1a9cb8[_0x97fb('0x4a')]})['then'](function(_0x1898b8){_0x59bc3a[_0x97fb('0x20')]=_0x1898b8;if(_0x245c56['query'][_0x97fb('0xb4')]){_0x1a9cb8['include']=[{'all':!![]}];}return db[_0x97fb('0xbb')][_0x97fb('0xbf')](_0x1a9cb8);})['then'](function(_0xe0aae){_0x59bc3a['rows']=_0xe0aae;return _0x59bc3a;});}})[_0x97fb('0x25')](respondWithFilteredResult(_0x312ba8,_0x1a9cb8))[_0x97fb('0x31')](handleError(_0x312ba8,null));};exports[_0x97fb('0xc0')]=function(_0x12254b,_0x14bf20,_0x4c321e){return db[_0x97fb('0x3a')]['find']({'where':{'id':_0x12254b[_0x97fb('0xb2')]['id']}})[_0x97fb('0x25')](handleEntityNotFound(_0x14bf20,null))[_0x97fb('0x25')](function(_0x1fc89e){if(_0x1fc89e){return _0x1fc89e[_0x97fb('0xc1')](_0x12254b[_0x97fb('0x75')][_0x97fb('0xbc')],_['omit'](_0x12254b[_0x97fb('0x75')],[_0x97fb('0xbc'),'id'])||{})[_0x97fb('0xc2')](function(){return db['Tag'][_0x97fb('0xbf')]({'attributes':['id',_0x97fb('0x28'),_0x97fb('0x4d')],'where':{'id':_0x12254b['body'][_0x97fb('0xbc')]}});})[_0x97fb('0x25')](function(_0x395de6){socket[_0x97fb('0xc3')](_0x97fb('0xc4'),{'id':Number(_0x12254b[_0x97fb('0xb2')]['id']),'tags':_0x395de6||[]});return{'id':Number(_0x12254b[_0x97fb('0xb2')]['id']),'tags':_0x395de6||[]};});}})[_0x97fb('0x25')](respondWithResult(_0x14bf20,null))[_0x97fb('0x31')](handleError(_0x14bf20,null));};exports['removeTags']=function(_0x51789b,_0x4591d4,_0x2513a8){return db[_0x97fb('0x3a')][_0x97fb('0x63')]({'where':{'id':_0x51789b[_0x97fb('0xb2')]['id']}})[_0x97fb('0x25')](handleEntityNotFound(_0x4591d4,null))[_0x97fb('0x25')](function(_0x5273ca){if(_0x5273ca){return _0x5273ca[_0x97fb('0xc5')](_0x51789b[_0x97fb('0x3f')][_0x97fb('0xbc')]);}})[_0x97fb('0x25')](respondWithStatusCode(_0x4591d4,null))[_0x97fb('0x31')](handleError(_0x4591d4,null));};exports[_0x97fb('0xc6')]=function(_0x14b29a,_0x531e76){var _0x42b087=moment()[_0x97fb('0xc7')]()[_0x97fb('0x9b')]();var _0x52bd0a=path[_0x97fb('0xc8')](config[_0x97fb('0xc9')],'server',_0x97fb('0xca'),_0x97fb('0xcb'));var _0x1a4f98=path[_0x97fb('0xc8')](config[_0x97fb('0xc9')],'server','files',_0x97fb('0xcc'));var _0x45c200=path[_0x97fb('0xc8')](_0x52bd0a,_0x42b087);var _0x8316f3=util[_0x97fb('0xbe')](_0x97fb('0xcd'),_0x14b29a['params']['id'],_0x42b087);var _0x1448d6=path[_0x97fb('0xc8')](_0x52bd0a,_0x8316f3);var _0x30fc05=[];_0x30fc05[_0x97fb('0x30')]({'model':db['Attachment'],'as':_0x97fb('0xce'),'raw':!![]});var _0x3a56af=[{'model':db[_0x97fb('0xbb')],'as':_0x97fb('0xcf'),'attributes':['id',_0x97fb('0x75'),'createdAt'],'include':_0x30fc05}];return db[_0x97fb('0x3a')][_0x97fb('0x63')]({'where':{'id':_0x14b29a[_0x97fb('0xb2')]['id']},'include':_0x3a56af})[_0x97fb('0x25')](handleEntityNotFound(_0x531e76,null))[_0x97fb('0x25')](function(_0x498e98){if(_0x498e98&&_0x498e98[_0x97fb('0xcf')]){var _0x34f38d=_0x498e98[_0x97fb('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x45c200);for(var _0x2c1e66=0x0;_0x2c1e66<_0x34f38d[_0x97fb('0xcf')][_0x97fb('0x44')];_0x2c1e66++){var _0x5aa3f6=_0x34f38d['Messages'][_0x2c1e66][_0x97fb('0xce')];if(_0x5aa3f6){var _0x46360c=path[_0x97fb('0xc8')](_0x1a4f98,_0x5aa3f6['basename']);if(fs[_0x97fb('0xd1')](_0x46360c)){fs[_0x97fb('0xd2')](_0x46360c)[_0x97fb('0xd3')](fs['createWriteStream'](path[_0x97fb('0xc8')](_0x45c200,_0x5aa3f6[_0x97fb('0xd4')])));}}}return BPromise[_0x97fb('0x91')]()[_0x97fb('0x25')](function(){return new BPromise(function(_0x28d0e3,_0x291ff2){zipdir(_0x45c200,{'saveTo':_0x1448d6},function(_0x29f232,_0x316798){if(_0x29f232)return _0x291ff2(_0x29f232);return _0x28d0e3(_0x316798);});})[_0x97fb('0x25')](function(){return new BPromise(function(_0x594ceb,_0x2960bd){rimraf(_0x45c200,function(_0x1b04e2){if(_0x1b04e2)_0x2960bd(_0x1b04e2);return _0x594ceb();});});})[_0x97fb('0x25')](function(){return _0x531e76[_0x97fb('0xc6')](_0x1448d6,_0x8316f3,function(_0x3e3a99){if(_0x3e3a99){console[_0x97fb('0xd5')](_0x97fb('0xd6'),_0x3e3a99);}else{fs[_0x97fb('0xd7')](_0x1448d6);}});});});}else{return _0x531e76['sendStatus'](0xc8);}})[_0x97fb('0x31')](handleError(_0x531e76,null));}; \ No newline at end of file +var _0xc297=['o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','start','body','keys','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','unreadMessages','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','Tag','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','UserId','closed','index','FaxInteraction','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL'];(function(_0xc8a16d,_0x313953){var _0x481cd7=function(_0x3f35f4){while(--_0x3f35f4){_0xc8a16d['push'](_0xc8a16d['shift']());}};_0x481cd7(++_0x313953);}(_0xc297,0x84));var _0x7c29=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xc297[_0x56e4e7];return _0x383618;};'use strict';var emlformat=require(_0x7c29('0x0'));var rimraf=require(_0x7c29('0x1'));var zipdir=require(_0x7c29('0x2'));var jsonpatch=require(_0x7c29('0x3'));var rp=require(_0x7c29('0x4'));var moment=require(_0x7c29('0x5'));var BPromise=require(_0x7c29('0x6'));var Mustache=require(_0x7c29('0x7'));var util=require(_0x7c29('0x8'));var path=require(_0x7c29('0x9'));var sox=require(_0x7c29('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c29('0xb'));var _=require(_0x7c29('0xc'));var squel=require('squel');var crypto=require(_0x7c29('0xd'));var jsforce=require(_0x7c29('0xe'));var deskjs=require(_0x7c29('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c29('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7c29('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c29('0x12'))(_0x7c29('0x13'));var utils=require(_0x7c29('0x14'));var config=require(_0x7c29('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7c29('0x16')](config[_0x7c29('0x17')],{'host':_0x7c29('0x18'),'port':0x18eb});var socket=require(_0x7c29('0x19'))(new Redis(config['redis']));require(_0x7c29('0x1a'))['register'](socket);function respondWithStatusCode(_0x47a82a,_0x107a81){_0x107a81=_0x107a81||0xcc;return function(_0x390e33){if(_0x390e33){return _0x47a82a['sendStatus'](_0x107a81);}return _0x47a82a['status'](_0x107a81)['end']();};}function respondWithResult(_0x2ae24a,_0x50dfe1){_0x50dfe1=_0x50dfe1||0xc8;return function(_0x72daa){if(_0x72daa){return _0x2ae24a[_0x7c29('0x1b')](_0x50dfe1)[_0x7c29('0x1c')](_0x72daa);}};}function respondWithFilteredResult(_0x5950d5,_0x229656){return function(_0x1edccb){if(_0x1edccb){var _0x2fd81b=typeof _0x229656[_0x7c29('0x1d')]==='undefined'&&typeof _0x229656[_0x7c29('0x1e')]==='undefined';var _0x3046aa=_0x1edccb[_0x7c29('0x1f')];var _0x48d222=_0x2fd81b?0x0:_0x229656[_0x7c29('0x1d')];var _0x2ec635=_0x2fd81b?_0x1edccb['count']:_0x229656[_0x7c29('0x1d')]+_0x229656[_0x7c29('0x1e')];var _0x1cabdb;if(_0x2ec635>=_0x3046aa){_0x2ec635=_0x3046aa;_0x1cabdb=0xc8;}else{_0x1cabdb=0xce;}_0x5950d5['status'](_0x1cabdb);return _0x5950d5[_0x7c29('0x20')](_0x7c29('0x21'),_0x48d222+'-'+_0x2ec635+'/'+_0x3046aa)[_0x7c29('0x1c')](_0x1edccb);}return null;};}function patchUpdates(_0x1fbc46){return function(_0x527bdb){try{jsonpatch[_0x7c29('0x22')](_0x527bdb,_0x1fbc46,!![]);}catch(_0xe9f125){return BPromise[_0x7c29('0x23')](_0xe9f125);}return _0x527bdb[_0x7c29('0x24')]();};}function saveUpdates(_0x1c9969,_0x4adf6b){return function(_0x1415e5){if(_0x1415e5){return _0x1415e5[_0x7c29('0x25')](_0x1c9969)[_0x7c29('0x26')](function(_0xf0b69a){return _0xf0b69a;});}return null;};}function removeEntity(_0x511cd2,_0x2182ce){return function(_0x4b2dd1){if(_0x4b2dd1){return _0x4b2dd1[_0x7c29('0x27')]()[_0x7c29('0x26')](function(){_0x511cd2['status'](0xcc)[_0x7c29('0x28')]();});}};}function handleEntityNotFound(_0x3293ff,_0x585106){return function(_0x4f75b2){if(!_0x4f75b2){_0x3293ff['sendStatus'](0x194);}return _0x4f75b2;};}function handleError(_0x49784c,_0x1fccba){_0x1fccba=_0x1fccba||0x1f4;return function(_0x5b9e5e){logger[_0x7c29('0x29')](_0x5b9e5e[_0x7c29('0x2a')]);if(_0x5b9e5e[_0x7c29('0x2b')]){delete _0x5b9e5e['name'];}_0x49784c[_0x7c29('0x1b')](_0x1fccba)[_0x7c29('0x2c')](_0x5b9e5e);};}function getInteractionUsers(_0x2a259e,_0xbfbd61){return new BPromise(function(_0x1c93d3,_0x550952){try{if(_0xbfbd61[_0x2a259e['id']]){_0x2a259e[_0x7c29('0x2d')]=_['map'](_0xbfbd61[_0x2a259e['id']],function(_0x276788){return{'id':_0x276788['id'],'fullname':_0x276788[_0x7c29('0x2e')]};});}}catch(_0x11e933){_0x550952(_0x11e933);}_0x1c93d3(_0x2a259e);});}function getInteractionTags(_0x34f46d,_0x37ba86){return new BPromise(function(_0x4e4d8c,_0x338287){try{if(_0x34f46d[_0x7c29('0x2f')]){_0x34f46d[_0x7c29('0x30')]=[];_0x34f46d['TagIds'][_0x7c29('0x31')](',')[_0x7c29('0x32')](function(_0x26fe3d){_0x34f46d[_0x7c29('0x30')][_0x7c29('0x33')](_0x37ba86[_0x26fe3d]);});}delete _0x34f46d[_0x7c29('0x2f')];}catch(_0x4b35b9){_0x338287(_0x4b35b9);}_0x4e4d8c(_0x34f46d);});}function updateFaxInteraction(_0x2bc3ee,_0x51d78b,_0x558b01){return new BPromise(function(_0x47eab8,_0x490741){return getInteractionUsers(_0x2bc3ee,_0x558b01)[_0x7c29('0x26')](function(_0x128370){return getInteractionTags(_0x128370,_0x51d78b);})[_0x7c29('0x26')](function(_0x6b85ff){return getStateInteraction(_0x6b85ff);})[_0x7c29('0x26')](function(_0x5243b4){_0x47eab8(_0x5243b4);})[_0x7c29('0x34')](function(_0x3241a1){_0x490741(_0x3241a1);});});}function getStateInteraction(_0x2d9b84){return new BPromise(function(_0x50229f){_0x2d9b84[_0x7c29('0x35')]=0x0;_0x2d9b84[_0x7c29('0x36')]=0x0;_0x2d9b84[_0x7c29('0x37')]=0x0;_0x2d9b84['unmanaged']=0x0;_0x2d9b84[_0x7c29('0x38')]=0x0;if(!_0x2d9b84['closed']&&!_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84[_0x7c29('0x35')]+=0x1;}if(!_0x2d9b84[_0x7c29('0x3a')]&&_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['talking']+=0x1;if(_0x2d9b84[_0x7c29('0x35')]){_0x2d9b84[_0x7c29('0x35')]-=0x1;}}if(_0x2d9b84['closed']&&_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['answered']+=0x1;if(_0x2d9b84['talking']){_0x2d9b84[_0x7c29('0x36')]-=0x1;}}if(_0x2d9b84[_0x7c29('0x3a')]&&!_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['unmanaged']+=0x1;if(_0x2d9b84[_0x7c29('0x35')]){_0x2d9b84[_0x7c29('0x35')]-=0x1;}}_0x2d9b84[_0x7c29('0x38')]+=0x1;_0x50229f(_0x2d9b84);});}exports[_0x7c29('0x3b')]=function(_0x11cee2,_0x349587){var _0x316aba={},_0x12efc8={},_0x2f1bc6={'count':0x0,'rows':[]};var _0x15a731=_['map'](db[_0x7c29('0x3c')]['rawAttributes'],function(_0x5bfa27){return{'name':_0x5bfa27['fieldName'],'type':_0x5bfa27['type'][_0x7c29('0x3d')]};});_0x12efc8[_0x7c29('0x3e')]=_[_0x7c29('0x3f')](_0x15a731,_0x7c29('0x2b'));_0x12efc8[_0x7c29('0x40')]=_['keys'](_0x11cee2[_0x7c29('0x40')]);_0x12efc8[_0x7c29('0x41')]=_[_0x7c29('0x42')](_0x12efc8[_0x7c29('0x3e')],_0x12efc8[_0x7c29('0x40')]);_0x316aba[_0x7c29('0x43')]=_['intersection'](_0x12efc8[_0x7c29('0x3e')],qs['fields'](_0x11cee2['query'][_0x7c29('0x44')]));_0x316aba['attributes']=_0x316aba[_0x7c29('0x43')][_0x7c29('0x45')]?_0x316aba[_0x7c29('0x43')]:_0x12efc8['model'];if(!_0x11cee2['query'][_0x7c29('0x46')](_0x7c29('0x47'))){_0x316aba['limit']=qs[_0x7c29('0x1e')](_0x11cee2[_0x7c29('0x40')]['limit']);_0x316aba[_0x7c29('0x1d')]=qs[_0x7c29('0x1d')](_0x11cee2[_0x7c29('0x40')][_0x7c29('0x1d')]);}_0x316aba[_0x7c29('0x48')]=qs[_0x7c29('0x49')](_0x11cee2['query'][_0x7c29('0x49')]);_0x316aba['where']=qs['filters'](_['pick'](_0x11cee2['query'],_0x12efc8[_0x7c29('0x41')]),_0x15a731);var _0x4f526a=[];var _0xddccb4=squel[_0x7c29('0x4a')]()[_0x7c29('0x4b')]('id')[_0x7c29('0x4b')](_0x7c29('0x2b'))[_0x7c29('0x4b')](_0x7c29('0x4c'))[_0x7c29('0x4d')](_0x7c29('0x4e'));var _0x4918ad=squel['select']()[_0x7c29('0x4b')](_0x7c29('0x4f'))['field'](_0x7c29('0x50'))['field'](_0x7c29('0x51'))[_0x7c29('0x4d')](_0x7c29('0x52'),'ui')[_0x7c29('0x53')](_0x7c29('0x54'),'u',_0x7c29('0x55'));var _0x4bf7f5=squel[_0x7c29('0x4a')]()[_0x7c29('0x4d')](_0x7c29('0x56'),'i')[_0x7c29('0x53')]('cm_contacts','c',_0x7c29('0x57'))[_0x7c29('0x53')](_0x7c29('0x54'),'o',_0x7c29('0x58'))['left_join'](_0x7c29('0x59'),'a','a.id\x20=\x20i.FaxAccountId')[_0x7c29('0x53')](_0x7c29('0x5a'),'me',_0x7c29('0x5b'))['left_join']('fax_interaction_has_tags','it',_0x7c29('0x5c'))[_0x7c29('0x53')](_0x7c29('0x4e'),'t',_0x7c29('0x5d'));var _0x532885=squel['expr']();var _0x5c7bbb=[];var _0x54d81a=squel['expr']();var _0x525614;if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x5e')]){_0x525614=as[_0x7c29('0x5f')](_0x11cee2['query'][_0x7c29('0x5e')]);var _0x4085de=_0x525614[_0x7c29('0x60')];for(var _0x2ff7fc=0x0;_0x2ff7fc<_0x525614['conditions']['length'];_0x2ff7fc++){var _0x5648e4=_0x525614[_0x7c29('0x61')][_0x2ff7fc];var _0x148b70='i';var _0x4aad13=_[_0x7c29('0x62')](_0x15a731,[_0x7c29('0x2b'),_0x5648e4[_0x7c29('0x4b')]]);if(!_0x4aad13){switch(_0x5648e4[_0x7c29('0x4b')]){case'unreadMessages':if(_0x5648e4[_0x7c29('0x63')]==0x1){_0x4bf7f5['having']('`'+_0x5648e4['field']+_0x7c29('0x64'));}else{_0x4bf7f5[_0x7c29('0x65')]('`'+_0x5648e4[_0x7c29('0x4b')]+_0x7c29('0x66'));}break;case _0x7c29('0x67'):if(_0x5648e4[_0x7c29('0x68')]===_0x7c29('0x69')){if(_0x5648e4[_0x7c29('0x63')][_0x7c29('0x31')]('\x20')[_0x7c29('0x45')]>0x1){_0x532885[_0x4085de](_0x7c29('0x6a'),qs[_0x7c29('0x6b')](_0x5648e4[_0x7c29('0x63')]),null);}else{var _0x46dba1='%'+_0x5648e4[_0x7c29('0x63')]+'%';_0x532885[_0x4085de](_0x7c29('0x6c'),_0x46dba1,_0x46dba1,_0x46dba1);}}else{_0x4aad13=_[_0x7c29('0x62')](_0x15a731,['name','ContactId']);_0x5648e4[_0x7c29('0x4b')]='ContactId';_0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc[_0x7c29('0x63')]['start'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);}break;case'Tag':var _0x3e12f1=_0x5648e4[_0x7c29('0x63')]['split'](',')['map'](function(_0x49af01){return Number(_0x49af01);});_0x3e12f1[_0x7c29('0x32')](function(_0x16db44){_0x54d81a['or'](_0x7c29('0x70'),'%,'+_0x16db44+',%');});_0x5c7bbb=_[_0x7c29('0x71')](_0x5c7bbb,_0x3e12f1);break;case'User':if(_0x5648e4['operator']===_0x7c29('0x69')){_0x532885[_0x4085de]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5648e4[_0x7c29('0x63')]+'%',null);}else{_0x4aad13=_[_0x7c29('0x62')](_0x15a731,[_0x7c29('0x2b'),_0x7c29('0x39')]);_0x5648e4[_0x7c29('0x4b')]=_0x7c29('0x39');_0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc['text'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x72')],_0x2570cc['value'][_0x7c29('0x28')]);}break;case _0x7c29('0x73'):_0x2570cc=as[_0x7c29('0x6d')]('me',null,_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x72')],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);break;}}else{var _0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc['value']['start'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);}}}else{var _0x3371ea=_(_0x11cee2[_0x7c29('0x40')])[_0x7c29('0x74')]()[_0x7c29('0x3f')](function(_0x18fa9d){return _[_0x7c29('0x75')](_0x15a731,['name',_0x18fa9d])?_0x18fa9d:undefined;})[_0x7c29('0x76')]()[_0x7c29('0x63')]();if(!_[_0x7c29('0x77')](_0x3371ea)){_0x3371ea[_0x7c29('0x32')](function(_0x3e86c2){if(_0x3e86c2===_0x7c29('0x78')){_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7a'),[][_0x7c29('0x7b')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2]));}else if(_0x3e86c2===_0x7c29('0x7c')){var _0x2a8e0b=JSON[_0x7c29('0x7d')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2])['$gte'];var _0x13d0eb=JSON[_0x7c29('0x7d')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2])['$lte'];_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7e'),_0x2a8e0b,_0x13d0eb);}else{if(_0x11cee2[_0x7c29('0x40')][_0x3e86c2]==='null'){_0x4bf7f5[_0x7c29('0x79')]('i.'+_0x3e86c2+_0x7c29('0x7f'));}else{_0x4bf7f5[_0x7c29('0x79')]('i.'+_0x3e86c2+_0x7c29('0x80'),_0x11cee2[_0x7c29('0x40')][_0x3e86c2]);}}});}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x81')]){if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x81')]==0x1){_0x4bf7f5[_0x7c29('0x65')]('`unreadMessages`\x20=\x200');}else{_0x4bf7f5[_0x7c29('0x65')](_0x7c29('0x82'));}}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')]){_0x5c7bbb=_[_0x7c29('0x84')](_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')])?_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')]:new Array(_0x11cee2['query']['tag']);_0x5c7bbb[_0x7c29('0x32')](function(_0x8bc62c){_0x54d81a['or'](_0x7c29('0x70'),'%,'+_0x8bc62c+',%');});}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x85')]){var _0x241e75=_0x11cee2[_0x7c29('0x40')]['filter']['replace']('\x5c','\x5c\x5c')[_0x7c29('0x86')](/'/g,'\x27\x27');if(qs[_0x7c29('0x87')](_0x241e75)){_0x532885['or'](_0x7c29('0x88'),_0x241e75+'%')['or']('i.fax\x20LIKE\x20?',_0x241e75+'%');}_0x532885['or'](_0x7c29('0x89'),_0x241e75+'%');}}_0x4bf7f5[_0x7c29('0x79')](_0x532885);_0x4bf7f5[_0x7c29('0x8a')]('i.id');var _0x2fd515={'type':db[_0x7c29('0x8b')][_0x7c29('0x8c')][_0x7c29('0x8d')],'raw':!![]};var _0x15ff99=_0x4bf7f5['clone']();_0x15ff99[_0x7c29('0x4b')](_0x7c29('0x8e'));_0x15ff99['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7c29('0x8f'));if(_0x316aba[_0x7c29('0x48')]){_0x316aba[_0x7c29('0x48')][_0x7c29('0x32')](function(_0x161df6){var _0x564ff1=_0x161df6[0x0]===_0x7c29('0x90')?_0x161df6[0x0]:'i.'+_0x161df6[0x0];_0x4bf7f5[_0x7c29('0x48')](_0x564ff1,_0x161df6[0x1]===_0x7c29('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x5c7bbb)){_0x4bf7f5['having'](_0x54d81a);_0x15ff99[_0x7c29('0x79')]('t.id\x20IN\x20?',_0x5c7bbb);}BPromise[_0x7c29('0x92')]()[_0x7c29('0x26')](function(){if(!_0x525614){if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x78')])return;_0x15ff99['where'](_0x7c29('0x93'));_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x93'));return;}if(_0x11cee2[_0x7c29('0x94')][_0x7c29('0x95')]!=='agent')return;return _0x11cee2[_0x7c29('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0275){if(_[_0x7c29('0x77')](_0x1c0275)){_0x15ff99[_0x7c29('0x79')]('i.FaxAccountId\x20IS\x20NULL');_0x4bf7f5['where'](_0x7c29('0x96'));}else{_0x15ff99[_0x7c29('0x79')](_0x7c29('0x7a'),_[_0x7c29('0x3f')](_0x1c0275,'id'));_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7a'),_[_0x7c29('0x3f')](_0x1c0275,'id'));}});})[_0x7c29('0x26')](function(){if(_0x11cee2[_0x7c29('0x94')][_0x7c29('0x95')]===_0x7c29('0x97')&&!_0x525614&&!_0x11cee2[_0x7c29('0x40')][_0x7c29('0x78')])return[];return db[_0x7c29('0x98')][_0x7c29('0x40')](_0x15ff99[_0x7c29('0x99')](),_0x2fd515);})['then'](function(_0x50a3ec){_0x2f1bc6[_0x7c29('0x1f')]=_0x50a3ec[_0x7c29('0x45')];if(_0x2f1bc6[_0x7c29('0x1f')]===0x0)return[];return db[_0x7c29('0x98')][_0x7c29('0x40')](_0xddccb4[_0x7c29('0x99')](),_0x2fd515)['then'](function(_0x356343){_0x4f526a=_[_0x7c29('0x9a')](_0x356343,'id');_0x2fd515=_[_0x7c29('0x9b')](_0x2fd515,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x44')]){_0x316aba[_0x7c29('0x43')][_0x7c29('0x32')](function(_0x15acd2){_0x4bf7f5[_0x7c29('0x4b')]('i.'+_0x15acd2);});}else{_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9c'),'unreadMessages');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9d'),_0x7c29('0x9e'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9f'),_0x7c29('0xa0'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa1'),'contactName');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa2'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa3'),'Contact.firstName');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa4'),_0x7c29('0xa5'));_0x4bf7f5[_0x7c29('0x4b')]('c.email',_0x7c29('0xa6'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa7'),'Contact.phone');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa8'),_0x7c29('0xa9'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xaa'),_0x7c29('0xab'));_0x4bf7f5['field']('o.fullname',_0x7c29('0xac'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xad'),_0x7c29('0xae'));_0x4bf7f5['field'](_0x7c29('0xaf'),_0x7c29('0x2f'));}if(_0x316aba[_0x7c29('0x1e')])_0x4bf7f5[_0x7c29('0x1e')](_0x316aba['limit']);if(_0x316aba[_0x7c29('0x1d')])_0x4bf7f5['offset'](_0x316aba[_0x7c29('0x1d')]);return db['sequelize'][_0x7c29('0x40')](_0x4bf7f5[_0x7c29('0x99')](),_0x2fd515);})[_0x7c29('0x26')](function(_0x316950){if(_0x316950[_0x7c29('0x45')]>0x0)_0x4918ad[_0x7c29('0x79')](_0x7c29('0xb0'),_[_0x7c29('0x3f')](_0x316950,'id'));return db[_0x7c29('0x98')][_0x7c29('0x40')](_0x4918ad['toString'](),_0x2fd515)[_0x7c29('0x26')](function(_0x43c405){var _0x3d9873=_['groupBy'](_0x43c405,'FaxInteractionId');var _0x4096f3=[];_0x316950[_0x7c29('0x32')](function(_0x5107f7){_0x4096f3['push'](updateFaxInteraction(_0x5107f7,_0x4f526a,_0x3d9873));});return BPromise['all'](_0x4096f3);});});})[_0x7c29('0x26')](function(_0xfb5fdd){_0x2f1bc6[_0x7c29('0xb1')]=_0xfb5fdd;return _0x2f1bc6;})[_0x7c29('0x26')](respondWithFilteredResult(_0x349587,_0x316aba))['catch'](handleError(_0x349587,null));};exports[_0x7c29('0xb2')]=function(_0x2eab39,_0x3fa747){var _0x2501f9={'raw':![],'where':{'id':_0x2eab39['params']['id']}},_0x32f1c7={};_0x32f1c7[_0x7c29('0x3e')]=_[_0x7c29('0x74')](db[_0x7c29('0x3c')][_0x7c29('0xb3')]);_0x32f1c7[_0x7c29('0x40')]=_[_0x7c29('0x74')](_0x2eab39[_0x7c29('0x40')]);_0x32f1c7[_0x7c29('0x41')]=_['intersection'](_0x32f1c7[_0x7c29('0x3e')],_0x32f1c7[_0x7c29('0x40')]);_0x2501f9[_0x7c29('0x43')]=_[_0x7c29('0x42')](_0x32f1c7[_0x7c29('0x3e')],qs['fields'](_0x2eab39[_0x7c29('0x40')][_0x7c29('0x44')]));_0x2501f9[_0x7c29('0x43')]=_0x2501f9[_0x7c29('0x43')]['length']?_0x2501f9[_0x7c29('0x43')]:_0x32f1c7[_0x7c29('0x3e')];if(_0x2eab39[_0x7c29('0x40')][_0x7c29('0xb4')]){_0x2501f9[_0x7c29('0xb5')]=[{'all':!![]}];}_0x2501f9=_['merge']({},_0x2501f9,_0x2eab39[_0x7c29('0xb6')]);return db[_0x7c29('0x3c')][_0x7c29('0x62')](_0x2501f9)[_0x7c29('0x26')](handleEntityNotFound(_0x3fa747,null))[_0x7c29('0x26')](respondWithResult(_0x3fa747,null))[_0x7c29('0x34')](handleError(_0x3fa747,null));};exports[_0x7c29('0xb7')]=function(_0x4db460,_0x5db364){return db[_0x7c29('0x3c')][_0x7c29('0xb7')](_0x4db460[_0x7c29('0x73')],{})[_0x7c29('0x26')](respondWithResult(_0x5db364,0xc9))[_0x7c29('0x34')](handleError(_0x5db364,null));};exports['update']=function(_0x512fa3,_0x11ec3a){if(_0x512fa3[_0x7c29('0x73')]['id']){delete _0x512fa3[_0x7c29('0x73')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x512fa3[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x11ec3a,null))[_0x7c29('0x26')](saveUpdates(_0x512fa3[_0x7c29('0x73')],null))[_0x7c29('0x26')](respondWithResult(_0x11ec3a,null))[_0x7c29('0x34')](handleError(_0x11ec3a,null));};exports['destroy']=function(_0x6a3efe,_0xe53118){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x6a3efe[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0xe53118,null))[_0x7c29('0x26')](removeEntity(_0xe53118,null))[_0x7c29('0x34')](handleError(_0xe53118,null));};exports[_0x7c29('0xb9')]=function(_0x41cd26,_0x39e0ab){return db[_0x7c29('0x3c')][_0x7c29('0xb9')]()['then'](respondWithResult(_0x39e0ab,null))['catch'](handleError(_0x39e0ab,null));};exports[_0x7c29('0xba')]=function(_0x411094,_0x50c4f,_0x4faeee){return db[_0x7c29('0xbb')][_0x7c29('0x62')]({'where':{'id':_0x411094[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x50c4f,null))[_0x7c29('0x26')](function(_0x354c90){if(_0x354c90){return _0x354c90[_0x7c29('0xba')](_0x411094[_0x7c29('0x73')][_0x7c29('0xbc')],_[_0x7c29('0xbd')](_0x411094['body'],[_0x7c29('0xbc'),'id'])||{});}})[_0x7c29('0x26')](respondWithResult(_0x50c4f,null))['catch'](handleError(_0x50c4f,null));};exports[_0x7c29('0xbe')]=function(_0x55462c,_0xec8737,_0x395072){var _0x13fb39={'raw':![],'where':{}};var _0x1a6365={};var _0x3185ab={'count':0x0,'rows':[]};return db[_0x7c29('0x3c')]['findOne']({'where':{'id':_0x55462c[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0xec8737,null))['then'](function(_0x4c5523){if(_0x4c5523){_0x1a6365[_0x7c29('0x3e')]=_[_0x7c29('0x74')](db[_0x7c29('0xbb')][_0x7c29('0xb3')]);_0x1a6365[_0x7c29('0x40')]=_['keys'](_0x55462c[_0x7c29('0x40')]);_0x1a6365['filters']=_[_0x7c29('0x42')](_0x1a6365[_0x7c29('0x3e')],_0x1a6365[_0x7c29('0x40')]);_0x13fb39[_0x7c29('0x43')]=_[_0x7c29('0x42')](_0x1a6365[_0x7c29('0x3e')],qs[_0x7c29('0x44')](_0x55462c[_0x7c29('0x40')][_0x7c29('0x44')]));_0x13fb39[_0x7c29('0x43')]=_0x13fb39['attributes'][_0x7c29('0x45')]?_0x13fb39['attributes']:_0x1a6365[_0x7c29('0x3e')];if(!_0x55462c[_0x7c29('0x40')][_0x7c29('0x46')]('nolimit')){_0x13fb39[_0x7c29('0x1e')]=qs[_0x7c29('0x1e')](_0x55462c['query'][_0x7c29('0x1e')]);_0x13fb39['offset']=qs[_0x7c29('0x1d')](_0x55462c[_0x7c29('0x40')][_0x7c29('0x1d')]);}_0x13fb39[_0x7c29('0x48')]=qs['sort'](_0x55462c['query'][_0x7c29('0x49')]);_0x13fb39['where']=qs[_0x7c29('0x41')](_[_0x7c29('0xbf')](_0x55462c['query'],_0x1a6365[_0x7c29('0x41')]));_0x13fb39['where']['FaxInteractionId']=_0x4c5523['id'];if(_0x55462c[_0x7c29('0x40')][_0x7c29('0x85')]){_0x13fb39[_0x7c29('0x79')]=_[_0x7c29('0x9b')](_0x13fb39[_0x7c29('0x79')],{'$or':_['map'](_0x13fb39[_0x7c29('0x43')],function(_0x2fb5df){var _0x2b29be={};_0x2b29be[_0x2fb5df]={'$like':'%'+_0x55462c['query'][_0x7c29('0x85')]+'%'};return _0x2b29be;})});}if(_0x55462c[_0x7c29('0x40')][_0x7c29('0xc0')]){var _0x57e4a5=_0x55462c['query'][_0x7c29('0xc0')][_0x7c29('0x31')](',');var _0x5257a6={};_0x5257a6[_0x57e4a5[0x0]]={'$gte':moment(_0x57e4a5[0x1])['format'](_0x7c29('0xc1'))};_0x13fb39[_0x7c29('0x79')]=_[_0x7c29('0x9b')](_0x13fb39[_0x7c29('0x79')],_0x5257a6);}_0x13fb39=_[_0x7c29('0x9b')]({},_0x13fb39,_0x55462c['options']);return db[_0x7c29('0xbb')]['count']({'where':_0x13fb39[_0x7c29('0x79')]})[_0x7c29('0x26')](function(_0x5b6f9a){_0x3185ab[_0x7c29('0x1f')]=_0x5b6f9a;if(_0x55462c['query'][_0x7c29('0xb4')]){_0x13fb39[_0x7c29('0xb5')]=[{'all':!![]}];}return db[_0x7c29('0xbb')][_0x7c29('0xc2')](_0x13fb39);})['then'](function(_0x585fbd){_0x3185ab[_0x7c29('0xb1')]=_0x585fbd;return _0x3185ab;});}})[_0x7c29('0x26')](respondWithFilteredResult(_0xec8737,_0x13fb39))[_0x7c29('0x34')](handleError(_0xec8737,null));};exports[_0x7c29('0xc3')]=function(_0x152ddf,_0x4f1884,_0x2234c7){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x152ddf[_0x7c29('0xb8')]['id']}})['then'](handleEntityNotFound(_0x4f1884,null))[_0x7c29('0x26')](function(_0x1523db){if(_0x1523db){return _0x1523db['setTags'](_0x152ddf[_0x7c29('0x73')][_0x7c29('0xbc')],_[_0x7c29('0xbd')](_0x152ddf[_0x7c29('0x73')],['ids','id'])||{})[_0x7c29('0xc4')](function(){return db[_0x7c29('0xc5')]['findAll']({'attributes':['id',_0x7c29('0x2b'),_0x7c29('0x4c')],'where':{'id':_0x152ddf[_0x7c29('0x73')]['ids']}});})['then'](function(_0x2274d8){socket[_0x7c29('0xc6')](_0x7c29('0xc7'),{'id':Number(_0x152ddf[_0x7c29('0xb8')]['id']),'tags':_0x2274d8||[]});return{'id':Number(_0x152ddf[_0x7c29('0xb8')]['id']),'tags':_0x2274d8||[]};});}})[_0x7c29('0x26')](respondWithResult(_0x4f1884,null))[_0x7c29('0x34')](handleError(_0x4f1884,null));};exports[_0x7c29('0xc8')]=function(_0x1d5a9a,_0x14de2f,_0x225737){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x1d5a9a[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x14de2f,null))[_0x7c29('0x26')](function(_0x433402){if(_0x433402){return _0x433402[_0x7c29('0xc8')](_0x1d5a9a[_0x7c29('0x40')][_0x7c29('0xbc')]);}})[_0x7c29('0x26')](respondWithStatusCode(_0x14de2f,null))[_0x7c29('0x34')](handleError(_0x14de2f,null));};exports['download']=function(_0x13f498,_0x4d13d3){var _0x447904=moment()[_0x7c29('0xc9')]()[_0x7c29('0x99')]();var _0x2356cc=path[_0x7c29('0xca')](config[_0x7c29('0xcb')],_0x7c29('0xcc'),_0x7c29('0xcd'),_0x7c29('0xce'));var _0x38c961=path[_0x7c29('0xca')](config['root'],_0x7c29('0xcc'),_0x7c29('0xcd'),'attachments');var _0x4f4959=path[_0x7c29('0xca')](_0x2356cc,_0x447904);var _0x507f42=util[_0x7c29('0xcf')](_0x7c29('0xd0'),_0x13f498['params']['id'],_0x447904);var _0x30dc5f=path[_0x7c29('0xca')](_0x2356cc,_0x507f42);var _0x2678ec=[];_0x2678ec['push']({'model':db[_0x7c29('0xd1')],'as':_0x7c29('0xd1'),'raw':!![]});var _0x225744=[{'model':db[_0x7c29('0xbb')],'as':_0x7c29('0xd2'),'attributes':['id','body',_0x7c29('0x7c')],'include':_0x2678ec}];return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x13f498[_0x7c29('0xb8')]['id']},'include':_0x225744})[_0x7c29('0x26')](handleEntityNotFound(_0x4d13d3,null))[_0x7c29('0x26')](function(_0x4a6897){if(_0x4a6897&&_0x4a6897['Messages']){var _0x786b2b=_0x4a6897[_0x7c29('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x4f4959);for(var _0x4f0cc0=0x0;_0x4f0cc0<_0x786b2b['Messages'][_0x7c29('0x45')];_0x4f0cc0++){var _0x5ac950=_0x786b2b[_0x7c29('0xd2')][_0x4f0cc0][_0x7c29('0xd1')];if(_0x5ac950){var _0xa64814=path[_0x7c29('0xca')](_0x38c961,_0x5ac950[_0x7c29('0xd4')]);if(fs[_0x7c29('0xd5')](_0xa64814)){fs['createReadStream'](_0xa64814)[_0x7c29('0xd6')](fs[_0x7c29('0xd7')](path[_0x7c29('0xca')](_0x4f4959,_0x5ac950[_0x7c29('0xd4')])));}}}return BPromise[_0x7c29('0x92')]()[_0x7c29('0x26')](function(){return new BPromise(function(_0x8f59f3,_0x1676af){zipdir(_0x4f4959,{'saveTo':_0x30dc5f},function(_0xe368fb,_0x29eda2){if(_0xe368fb)return _0x1676af(_0xe368fb);return _0x8f59f3(_0x29eda2);});})[_0x7c29('0x26')](function(){return new BPromise(function(_0x13ca3d,_0x14a89f){rimraf(_0x4f4959,function(_0x1d53c6){if(_0x1d53c6)_0x14a89f(_0x1d53c6);return _0x13ca3d();});});})[_0x7c29('0x26')](function(){return _0x4d13d3[_0x7c29('0xd8')](_0x30dc5f,_0x507f42,function(_0x4afe7b){if(_0x4afe7b){console[_0x7c29('0xd9')](_0x7c29('0xda'),_0x4afe7b);}else{fs[_0x7c29('0xdb')](_0x30dc5f);}});});});}else{return _0x4d13d3['sendStatus'](0xc8);}})[_0x7c29('0x34')](handleError(_0x4d13d3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 25921a6..59a8b3d 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 _0xcfec=['FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','catch','hasOwnProperty','hook','events'];(function(_0x3229a2,_0x35f905){var _0x21dcdc=function(_0x57ca89){while(--_0x57ca89){_0x3229a2['push'](_0x3229a2['shift']());}};_0x21dcdc(++_0x35f905);}(_0xcfec,0x6f));var _0xccfe=function(_0x434d68,_0xcbdfed){_0x434d68=_0x434d68-0x0;var _0x56f3ce=_0xcfec[_0x434d68];return _0x56f3ce;};'use strict';var EventEmitter=require(_0xccfe('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xccfe('0x1')];var FaxMessage=require(_0xccfe('0x2'))['db'][_0xccfe('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xccfe('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xccfe('0x5'),'afterDestroy':_0xccfe('0x6')};function emitEvent(_0x5a5a96){return function(_0x3502c2,_0xcda5de,_0x5c999d){_0x3502c2['getUsers']({'attributes':['id'],'raw':!![]})[_0xccfe('0x7')](function(_0x135d4d){_0x3502c2['setDataValue'](_0xccfe('0x8'),_0x135d4d[_0xccfe('0x9')](function(_0x661f01){return{'id':_0x661f01['id']};}));return FaxMessage[_0xccfe('0xa')]({'where':{'FaxInteractionId':_0x3502c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xccfe('0x7')](function(_0x44369b){_0x3502c2[_0xccfe('0xb')](_0xccfe('0xc'),_0x44369b['length']);FaxInteractionEvents['emit'](_0x5a5a96+':'+_0x3502c2['id'],_0x3502c2);FaxInteractionEvents['emit'](_0x5a5a96,_0x3502c2);_0x5c999d(null);})[_0xccfe('0xd')](_0x5c999d(null));};}for(var e in events){if(events[_0xccfe('0xe')](e)){var event=events[e];FaxInteraction[_0xccfe('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xa281=['hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x583955,_0x26969f){var _0xe53127=function(_0x371c3e){while(--_0x371c3e){_0x583955['push'](_0x583955['shift']());}};_0xe53127(++_0x26969f);}(_0xa281,0x123));var _0x1a28=function(_0x112130,_0x390676){_0x112130=_0x112130-0x0;var _0x2cef9b=_0xa281[_0x112130];return _0x2cef9b;};'use strict';var EventEmitter=require(_0x1a28('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x1a28('0x1')];var FaxMessage=require(_0x1a28('0x2'))['db'][_0x1a28('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1a28('0x4')](0x0);var events={'afterCreate':_0x1a28('0x5'),'afterUpdate':'update','afterDestroy':_0x1a28('0x6')};function emitEvent(_0x2161cb){return function(_0x570f14,_0x273b91,_0x2e23a3){_0x570f14[_0x1a28('0x7')]({'attributes':['id'],'raw':!![]})[_0x1a28('0x8')](function(_0x2ecad4){_0x570f14[_0x1a28('0x9')](_0x1a28('0xa'),_0x2ecad4[_0x1a28('0xb')](function(_0x3a377c){return{'id':_0x3a377c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x570f14['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a28('0x8')](function(_0xdd351c){_0x570f14[_0x1a28('0x9')](_0x1a28('0xc'),_0xdd351c['length']);FaxInteractionEvents[_0x1a28('0xd')](_0x2161cb+':'+_0x570f14['id'],_0x570f14);FaxInteractionEvents[_0x1a28('0xd')](_0x2161cb,_0x570f14);_0x2e23a3(null);})[_0x1a28('0xe')](_0x2e23a3(null));};}for(var e in events){if(events[_0x1a28('0xf')](e)){var event=events[e];FaxInteraction[_0x1a28('0x10')](e,emitEvent(event));}}module[_0x1a28('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 49f5795..c1b8318 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 _0x2752=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x28c2ed,_0x338fea){var _0x5eece7=function(_0x45df97){while(--_0x45df97){_0x28c2ed['push'](_0x28c2ed['shift']());}};_0x5eece7(++_0x338fea);}(_0x2752,0x12b));var _0x2275=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2752[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2275('0x0'));var util=require('util');var logger=require(_0x2275('0x1'))('api');var moment=require(_0x2275('0x2'));var BPromise=require(_0x2275('0x3'));var rp=require(_0x2275('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2275('0x5'));var config=require(_0x2275('0x6'));var attributes=require(_0x2275('0x7'));module[_0x2275('0x8')]=function(_0x19249d,_0x3bc1b9){return _0x19249d['define'](_0x2275('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x565af8,_0x275bdf,_0x4a658c){if(_0x565af8[_0x2275('0xa')](_0x2275('0xb'))){_0x565af8[_0x2275('0xc')]=moment()[_0x2275('0xd')](_0x2275('0xe'));}_0x4a658c(null,_0x565af8);}}});}; \ No newline at end of file +var _0x4f81=['format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed'];(function(_0x1a83c2,_0x28fbb9){var _0xd1a13d=function(_0x4f8df6){while(--_0x4f8df6){_0x1a83c2['push'](_0x1a83c2['shift']());}};_0xd1a13d(++_0x28fbb9);}(_0x4f81,0x1e3));var _0x14f8=function(_0x374bd1,_0x465eeb){_0x374bd1=_0x374bd1-0x0;var _0x3425c8=_0x4f81[_0x374bd1];return _0x3425c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14f8('0x0'))('api');var moment=require(_0x14f8('0x1'));var BPromise=require(_0x14f8('0x2'));var rp=require(_0x14f8('0x3'));var fs=require('fs');var path=require(_0x14f8('0x4'));var rimraf=require(_0x14f8('0x5'));var config=require(_0x14f8('0x6'));var attributes=require(_0x14f8('0x7'));module['exports']=function(_0x33baf0,_0x510822){return _0x33baf0[_0x14f8('0x8')](_0x14f8('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x429066,_0x4169c3,_0x501190){if(_0x429066[_0x14f8('0xa')]('closed')){_0x429066['closedAt']=moment()[_0x14f8('0xb')](_0x14f8('0xc'));}_0x501190(null,_0x429066);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f489549..f487299 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 _0x8786=['./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','where','attributes','limit','then','UpdateFaxInteraction','FaxInteraction','find','ids','omit','body','spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x41fb98,_0x470189){var _0x4b0044=function(_0xf8b2ec){while(--_0xf8b2ec){_0x41fb98['push'](_0x41fb98['shift']());}};_0x4b0044(++_0x470189);}(_0x8786,0x104));var _0x6878=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8786[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var moment=require('moment');var BPromise=require(_0x6878('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6878('0x3'))['db'];var utils=require(_0x6878('0x4'));var logger=require(_0x6878('0x5'))('rpc');var config=require(_0x6878('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6878('0x7')][_0x6878('0x8')]({'port':0x232a});config[_0x6878('0x9')]=_[_0x6878('0xa')](config[_0x6878('0x9')],{'host':_0x6878('0xb'),'port':0x18eb});var socket=require(_0x6878('0xc'))(new Redis(config[_0x6878('0x9')]));require(_0x6878('0xd'))[_0x6878('0xe')](socket);function respondWithRpcPromise(_0x691a3,_0x245b07,_0x39f4b1){return new BPromise(function(_0x19fb49,_0x348c58){return client[_0x6878('0xf')](_0x691a3,_0x39f4b1)['then'](function(_0x3cacd1){logger[_0x6878('0x10')](_0x6878('0x11'),_0x245b07,'request\x20sent');logger[_0x6878('0x12')](_0x6878('0x13'),_0x245b07,_0x6878('0x14'),JSON[_0x6878('0x15')](_0x3cacd1));if(_0x3cacd1[_0x6878('0x16')]){if(_0x3cacd1[_0x6878('0x16')][_0x6878('0x17')]===0x1f4){logger[_0x6878('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x245b07,_0x3cacd1[_0x6878('0x16')][_0x6878('0x18')]);return _0x348c58(_0x3cacd1[_0x6878('0x16')][_0x6878('0x18')]);}logger[_0x6878('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x245b07,_0x3cacd1[_0x6878('0x16')][_0x6878('0x18')]);return _0x19fb49(_0x3cacd1[_0x6878('0x16')][_0x6878('0x18')]);}else{logger[_0x6878('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x245b07,_0x6878('0x14'));_0x19fb49(_0x3cacd1['result'][_0x6878('0x18')]);}})[_0x6878('0x19')](function(_0x4e0f3b){logger['error'](_0x6878('0x11'),_0x245b07,_0x4e0f3b);_0x348c58(_0x4e0f3b);});});}exports['UpdateFaxInteraction']=function(_0x11c9ff){var _0x38c4ac=this;return new Promise(function(_0x364b95,_0x38967f){return db['FaxInteraction']['update'](_0x11c9ff['body'],{'raw':_0x11c9ff[_0x6878('0x1a')]?_0x11c9ff[_0x6878('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c9ff[_0x6878('0x1a')]?_0x11c9ff['options'][_0x6878('0x1b')]||null:null,'attributes':_0x11c9ff[_0x6878('0x1a')]?_0x11c9ff[_0x6878('0x1a')][_0x6878('0x1c')]||null:null,'limit':_0x11c9ff['options']?_0x11c9ff[_0x6878('0x1a')][_0x6878('0x1d')]||null:null})[_0x6878('0x1e')](function(_0x5b6c0d){logger['info']('UpdateFaxInteraction',_0x11c9ff);logger[_0x6878('0x12')](_0x6878('0x1f'),_0x11c9ff,JSON[_0x6878('0x15')](_0x5b6c0d));_0x364b95(_0x5b6c0d);})[_0x6878('0x19')](function(_0x4df4f2){logger[_0x6878('0x16')](_0x6878('0x1f'),_0x4df4f2[_0x6878('0x18')],_0x11c9ff);_0x38967f(_0x38c4ac[_0x6878('0x16')](0x1f4,_0x4df4f2['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x2ab9f4){return new Promise(function(_0x36eb8e,_0x833f45){return db[_0x6878('0x20')][_0x6878('0x21')]({'where':_0x2ab9f4[_0x6878('0x1a')]?_0x2ab9f4[_0x6878('0x1a')][_0x6878('0x1b')]||null:null})[_0x6878('0x1e')](function(_0x3446bf){if(_0x3446bf){return _0x3446bf['addTags'](_0x2ab9f4['body'][_0x6878('0x22')],_[_0x6878('0x23')](_0x2ab9f4[_0x6878('0x24')],[_0x6878('0x22'),'id'])||{});}})[_0x6878('0x25')](function(_0x4a6314){logger[_0x6878('0x10')]('AddTags',_0x2ab9f4);logger[_0x6878('0x12')](_0x6878('0x26'),_0x2ab9f4,JSON[_0x6878('0x15')](_0x4a6314));_0x36eb8e(_0x4a6314);})[_0x6878('0x19')](function(_0x349b87){logger['error'](_0x6878('0x26'),_0x349b87[_0x6878('0x18')],_0x2ab9f4);_0x833f45(_this[_0x6878('0x16')](0x1f4,_0x349b87[_0x6878('0x18')]));});});}; \ No newline at end of file +var _0x8d2b=['error','code','message','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','AddTagsToFaxInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x40fa1d,_0x27c0bb){var _0x4d56b2=function(_0x3a8645){while(--_0x3a8645){_0x40fa1d['push'](_0x40fa1d['shift']());}};_0x4d56b2(++_0x27c0bb);}(_0x8d2b,0x82));var _0xb8d2=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x8d2b[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var moment=require('moment');var BPromise=require(_0xb8d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8d2('0x3'));var db=require(_0xb8d2('0x4'))['db'];var utils=require(_0xb8d2('0x5'));var logger=require(_0xb8d2('0x6'))('rpc');var config=require(_0xb8d2('0x7'));var jayson=require(_0xb8d2('0x8'));var client=jayson[_0xb8d2('0x9')][_0xb8d2('0xa')]({'port':0x232a});config['redis']=_[_0xb8d2('0xb')](config[_0xb8d2('0xc')],{'host':_0xb8d2('0xd'),'port':0x18eb});var socket=require(_0xb8d2('0xe'))(new Redis(config[_0xb8d2('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x52a12b,_0x9555b0,_0xbb78ae){return new BPromise(function(_0x5b6fa8,_0x22a507){return client[_0xb8d2('0xf')](_0x52a12b,_0xbb78ae)[_0xb8d2('0x10')](function(_0x18732d){logger[_0xb8d2('0x11')](_0xb8d2('0x12'),_0x9555b0,_0xb8d2('0x13'));logger[_0xb8d2('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x9555b0,_0xb8d2('0x13'),JSON[_0xb8d2('0x15')](_0x18732d));if(_0x18732d[_0xb8d2('0x16')]){if(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x17')]===0x1f4){logger[_0xb8d2('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x9555b0,_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);return _0x22a507(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);}logger[_0xb8d2('0x16')](_0xb8d2('0x12'),_0x9555b0,_0x18732d['error']['message']);return _0x5b6fa8(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);}else{logger[_0xb8d2('0x11')](_0xb8d2('0x12'),_0x9555b0,'request\x20sent');_0x5b6fa8(_0x18732d['result'][_0xb8d2('0x18')]);}})['catch'](function(_0x47ff22){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x9555b0,_0x47ff22);_0x22a507(_0x47ff22);});});}exports[_0xb8d2('0x19')]=function(_0x58a942){var _0x23ba47=this;return new Promise(function(_0x54cf87,_0x25c07f){return db[_0xb8d2('0x1a')][_0xb8d2('0x1b')](_0x58a942[_0xb8d2('0x1c')],{'raw':_0x58a942['options']?_0x58a942['options'][_0xb8d2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a942['options']?_0x58a942[_0xb8d2('0x1e')]['where']||null:null,'attributes':_0x58a942[_0xb8d2('0x1e')]?_0x58a942['options']['attributes']||null:null,'limit':_0x58a942[_0xb8d2('0x1e')]?_0x58a942[_0xb8d2('0x1e')]['limit']||null:null})[_0xb8d2('0x10')](function(_0x3f3b43){logger[_0xb8d2('0x11')](_0xb8d2('0x19'),_0x58a942);logger[_0xb8d2('0x14')](_0xb8d2('0x19'),_0x58a942,JSON[_0xb8d2('0x15')](_0x3f3b43));_0x54cf87(_0x3f3b43);})['catch'](function(_0x5b878a){logger[_0xb8d2('0x16')](_0xb8d2('0x19'),_0x5b878a['message'],_0x58a942);_0x25c07f(_0x23ba47[_0xb8d2('0x16')](0x1f4,_0x5b878a[_0xb8d2('0x18')]));});});};exports[_0xb8d2('0x1f')]=function(_0x55bef2){return new Promise(function(_0x223949,_0x2511fe){return db[_0xb8d2('0x1a')]['find']({'where':_0x55bef2[_0xb8d2('0x1e')]?_0x55bef2[_0xb8d2('0x1e')][_0xb8d2('0x20')]||null:null})['then'](function(_0x230601){if(_0x230601){return _0x230601[_0xb8d2('0x21')](_0x55bef2[_0xb8d2('0x1c')][_0xb8d2('0x22')],_[_0xb8d2('0x23')](_0x55bef2['body'],[_0xb8d2('0x22'),'id'])||{});}})[_0xb8d2('0x24')](function(_0x1695ba){logger[_0xb8d2('0x11')](_0xb8d2('0x25'),_0x55bef2);logger['debug'](_0xb8d2('0x25'),_0x55bef2,JSON['stringify'](_0x1695ba));_0x223949(_0x1695ba);})['catch'](function(_0x177323){logger[_0xb8d2('0x16')](_0xb8d2('0x25'),_0x177323[_0xb8d2('0x18')],_0x55bef2);_0x2511fe(_this[_0xb8d2('0x16')](0x1f4,_0x177323[_0xb8d2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1f2f355..199ccc1 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 _0x80d6=['remove','emit','register','faxInteraction:','./faxInteraction.events','save'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x80d6,0x94));var _0x680d=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x80d6[_0x2dc7c9];return _0x3e6536;};'use strict';var FaxInteractionEvents=require(_0x680d('0x0'));var events=[_0x680d('0x1'),_0x680d('0x2'),'update'];function createListener(_0x526d3f,_0x158d4b){return function(_0x450adf){_0x158d4b[_0x680d('0x3')](_0x526d3f,_0x450adf);};}function removeListener(_0x42f290,_0x4d3942){return function(){FaxInteractionEvents['removeListener'](_0x42f290,_0x4d3942);};}exports[_0x680d('0x4')]=function(_0x5a4b8c){for(var _0x101764=0x0,_0x59e99f=events['length'];_0x101764<_0x59e99f;_0x101764++){var _0x109292=events[_0x101764];var _0x1f625d=createListener(_0x680d('0x5')+_0x109292,_0x5a4b8c);FaxInteractionEvents['on'](_0x109292,_0x1f625d);}}; \ No newline at end of file +var _0xb939=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x46eceb,_0x5acdba){var _0x20213c=function(_0x51e897){while(--_0x51e897){_0x46eceb['push'](_0x46eceb['shift']());}};_0x20213c(++_0x5acdba);}(_0xb939,0xc7));var _0x9b93=function(_0x4f83dc,_0x217adf){_0x4f83dc=_0x4f83dc-0x0;var _0x4a6883=_0xb939[_0x4f83dc];return _0x4a6883;};'use strict';var FaxInteractionEvents=require(_0x9b93('0x0'));var events=[_0x9b93('0x1'),_0x9b93('0x2'),_0x9b93('0x3')];function createListener(_0x390481,_0xcdca4b){return function(_0x5beb96){_0xcdca4b[_0x9b93('0x4')](_0x390481,_0x5beb96);};}function removeListener(_0x18082c,_0x14cfe8){return function(){FaxInteractionEvents[_0x9b93('0x5')](_0x18082c,_0x14cfe8);};}exports[_0x9b93('0x6')]=function(_0x2df3f1){for(var _0x1cdba5=0x0,_0x1854c0=events[_0x9b93('0x7')];_0x1cdba5<_0x1854c0;_0x1cdba5++){var _0x47e655=events[_0x1cdba5];var _0x439dc9=createListener(_0x9b93('0x8')+_0x47e655,_0x2df3f1);FaxInteractionEvents['on'](_0x47e655,_0x439dc9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 84b569c..28316cc 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 _0xbeea=['faxinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','delete'];(function(_0x36f243,_0x36f3d8){var _0x4df5b7=function(_0x68690c){while(--_0x68690c){_0x36f243['push'](_0x36f243['shift']());}};_0x4df5b7(++_0x36f3d8);}(_0xbeea,0xb1));var _0xabee=function(_0x586cb6,_0x2ac45e){_0x586cb6=_0x586cb6-0x0;var _0xddd6b0=_0xbeea[_0x586cb6];return _0xddd6b0;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0x8')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router['get'](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router['post']('/',auth[_0xabee('0x9')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x14')),controller[_0xabee('0x15')]);router['put'](_0xabee('0x16'),auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x17')),controller[_0xabee('0x18')]);router[_0xabee('0x19')]('/:id',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x1a')),controller[_0xabee('0x1b')]);router[_0xabee('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xabee('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8a3a=['./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','fax','addTags','put','faxinteraction:update','update','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x8a3a,0x10f));var _0xa8a3=function(_0x162ffe,_0x4a74d8){_0x162ffe=_0x162ffe-0x0;var _0x4f4842=_0x8a3a[_0x162ffe];return _0x4f4842;};'use strict';var multer=require(_0xa8a3('0x0'));var util=require(_0xa8a3('0x1'));var path=require(_0xa8a3('0x2'));var timeout=require(_0xa8a3('0x3'));var express=require(_0xa8a3('0x4'));var router=express['Router']();var fs_extra=require(_0xa8a3('0x5'));var auth=require(_0xa8a3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8a3('0x7'));var controller=require(_0xa8a3('0x8'));router[_0xa8a3('0x9')]('/',auth[_0xa8a3('0xa')](),controller['index']);router[_0xa8a3('0x9')](_0xa8a3('0xb'),auth['isAuthenticated'](),controller[_0xa8a3('0xc')]);router[_0xa8a3('0x9')](_0xa8a3('0xd'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0xe')]);router[_0xa8a3('0x9')](_0xa8a3('0xf'),auth[_0xa8a3('0xa')](),controller['getMessages']);router[_0xa8a3('0x9')](_0xa8a3('0x10'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x11')]);router[_0xa8a3('0x12')]('/',auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x13')]);router[_0xa8a3('0x12')](_0xa8a3('0xf'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x14')]);router[_0xa8a3('0x12')]('/:id/tags',auth[_0xa8a3('0xa')](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),'faxinteraction:addtags'),controller[_0xa8a3('0x17')]);router[_0xa8a3('0x18')](_0xa8a3('0xd'),auth['isAuthenticated'](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),_0xa8a3('0x19')),controller[_0xa8a3('0x1a')]);router['delete']('/:id',auth[_0xa8a3('0xa')](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),'faxinteraction:destroy'),controller[_0xa8a3('0x1b')]);router['delete'](_0xa8a3('0x1c'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x1d')]);module[_0xa8a3('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 78bdfcb..d0157d4 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 _0x1ef3=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x510fad,_0x283c39){var _0x249cc9=function(_0x5a9740){while(--_0x5a9740){_0x510fad['push'](_0x510fad['shift']());}};_0x249cc9(++_0x283c39);}(_0x1ef3,0x69));var _0x31ef=function(_0x26e4c5,_0x1256f6){_0x26e4c5=_0x26e4c5-0x0;var _0x2a4ef5=_0x1ef3[_0x26e4c5];return _0x2a4ef5;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x31ef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31ef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31ef('0x4')]('in','out'),'defaultValue':_0x31ef('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x31ef('0x6')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x4a2193,_0x312076){var _0x634e78=function(_0x35b0b7){while(--_0x35b0b7){_0x4a2193['push'](_0x4a2193['shift']());}};_0x634e78(++_0x312076);}(_0xb7cf,0xca));var _0xfb7c=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0xb7cf[_0x14e9f0];return _0xa63f7e;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1456256..c4331e5 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 _0x4f38=['count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','body','find','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','fax','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','interface','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4f38,0xf7));var _0x84f3=function(_0x4c981e,_0x5bd429){_0x4c981e=_0x4c981e-0x0;var _0x8afd0d=_0x4f38[_0x4c981e];return _0x8afd0d;};'use strict';var emlformat=require(_0x84f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84f3('0x1'));var jsonpatch=require(_0x84f3('0x2'));var rp=require(_0x84f3('0x3'));var moment=require(_0x84f3('0x4'));var BPromise=require(_0x84f3('0x5'));var Mustache=require(_0x84f3('0x6'));var util=require(_0x84f3('0x7'));var path=require('path');var sox=require(_0x84f3('0x8'));var csv=require(_0x84f3('0x9'));var ejs=require(_0x84f3('0xa'));var fs=require('fs');var fs_extra=require(_0x84f3('0xb'));var _=require(_0x84f3('0xc'));var squel=require(_0x84f3('0xd'));var crypto=require(_0x84f3('0xe'));var jsforce=require(_0x84f3('0xf'));var deskjs=require(_0x84f3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x84f3('0x11'));var Papa=require(_0x84f3('0x12'));var Redis=require(_0x84f3('0x13'));var authService=require(_0x84f3('0x14'));var qs=require(_0x84f3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84f3('0x16'));var logger=require(_0x84f3('0x17'))(_0x84f3('0x18'));var utils=require(_0x84f3('0x19'));var config=require(_0x84f3('0x1a'));var licenseUtil=require(_0x84f3('0x1b'));var db=require(_0x84f3('0x1c'))['db'];config['redis']=_[_0x84f3('0x1d')](config[_0x84f3('0x1e')],{'host':_0x84f3('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84f3('0x1e')]));require(_0x84f3('0x20'))[_0x84f3('0x21')](socket);var jayson=require(_0x84f3('0x22'));var client=jayson[_0x84f3('0x23')][_0x84f3('0x24')]({'port':0x232c});var client9002=jayson[_0x84f3('0x23')][_0x84f3('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x7cdedc,_0x45291f,_0x3ec11c,_0x5f4417){return new BPromise(function(_0x22e41f,_0x1131de){var _0x13f094=_0x5f4417||client;return _0x13f094[_0x84f3('0x25')](_0x7cdedc,_0x3ec11c)['then'](function(_0xdd3a8f){logger[_0x84f3('0x26')](_0x84f3('0x27'),_0x45291f,_0x84f3('0x28'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x45291f,'request\x20sent',JSON[_0x84f3('0x29')](_0xdd3a8f));if(_0xdd3a8f[_0x84f3('0x2a')]){if(_0xdd3a8f[_0x84f3('0x2a')][_0x84f3('0x2b')]===0x1f4){logger[_0x84f3('0x2a')](_0x84f3('0x27'),_0x45291f,_0xdd3a8f[_0x84f3('0x2a')][_0x84f3('0x2c')]);return _0x1131de(_0xdd3a8f[_0x84f3('0x2a')][_0x84f3('0x2c')]);}logger['error'](_0x84f3('0x27'),_0x45291f,_0xdd3a8f[_0x84f3('0x2a')]['message']);return _0x22e41f(_0xdd3a8f[_0x84f3('0x2a')][_0x84f3('0x2c')]);}else{logger[_0x84f3('0x26')](_0x84f3('0x27'),_0x45291f,_0x84f3('0x28'));_0x22e41f(_0xdd3a8f['result']['message']);}})[_0x84f3('0x2d')](function(_0x5c2bd6){logger[_0x84f3('0x2a')](_0x84f3('0x27'),_0x45291f,_0x5c2bd6);_0x1131de(_0x5c2bd6);});});}function respondWithStatusCode(_0x579aa9,_0x34d926){_0x34d926=_0x34d926||0xcc;return function(_0x312923){if(_0x312923){return _0x579aa9[_0x84f3('0x2e')](_0x34d926);}return _0x579aa9[_0x84f3('0x2f')](_0x34d926)[_0x84f3('0x30')]();};}function respondWithResult(_0x2d10aa,_0x96fc9c){_0x96fc9c=_0x96fc9c||0xc8;return function(_0x491a85){if(_0x491a85){return _0x2d10aa['status'](_0x96fc9c)[_0x84f3('0x31')](_0x491a85);}};}function respondWithFilteredResult(_0x507a35,_0x17a2f4){return function(_0x3c3bd4){if(_0x3c3bd4){var _0x58ddc6=typeof _0x17a2f4[_0x84f3('0x32')]===_0x84f3('0x33')&&typeof _0x17a2f4[_0x84f3('0x34')]===_0x84f3('0x33');var _0x2f506d=_0x3c3bd4[_0x84f3('0x35')];var _0x22a49a=_0x58ddc6?0x0:_0x17a2f4['offset'];var _0x32f8ff=_0x58ddc6?_0x3c3bd4['count']:_0x17a2f4[_0x84f3('0x32')]+_0x17a2f4['limit'];var _0x116874;if(_0x32f8ff>=_0x2f506d){_0x32f8ff=_0x2f506d;_0x116874=0xc8;}else{_0x116874=0xce;}_0x507a35['status'](_0x116874);return _0x507a35[_0x84f3('0x36')](_0x84f3('0x37'),_0x22a49a+'-'+_0x32f8ff+'/'+_0x2f506d)['json'](_0x3c3bd4);}return null;};}function patchUpdates(_0x2e48ba){return function(_0x272bce){try{jsonpatch[_0x84f3('0x38')](_0x272bce,_0x2e48ba,!![]);}catch(_0x5239a1){return BPromise[_0x84f3('0x39')](_0x5239a1);}return _0x272bce[_0x84f3('0x3a')]();};}function saveUpdates(_0x5e7708,_0x4ad0c1){return function(_0x2b1c10){if(_0x2b1c10){return _0x2b1c10[_0x84f3('0x3b')](_0x5e7708)[_0x84f3('0x3c')](function(_0x1227ab){return _0x1227ab;});}return null;};}function removeEntity(_0x1d7140,_0x5d7277){return function(_0x5156fc){if(_0x5156fc){return _0x5156fc[_0x84f3('0x3d')]()['then'](function(){_0x1d7140['status'](0xcc)[_0x84f3('0x30')]();});}};}function handleEntityNotFound(_0x494640,_0x14ff80){return function(_0x39b526){if(!_0x39b526){_0x494640[_0x84f3('0x2e')](0x194);}return _0x39b526;};}function handleError(_0x370fbf,_0x4cf618){_0x4cf618=_0x4cf618||0x1f4;return function(_0x486bbe){logger['error'](_0x486bbe[_0x84f3('0x3e')]);if(_0x486bbe[_0x84f3('0x3f')]){delete _0x486bbe[_0x84f3('0x3f')];}_0x370fbf[_0x84f3('0x2f')](_0x4cf618)[_0x84f3('0x40')](_0x486bbe);};}exports[_0x84f3('0x41')]=function(_0x24e67d,_0x56a3c5){var _0x28ee54={},_0x50451b={},_0x257e94={'count':0x0,'rows':[]};var _0x5dc5c6=_[_0x84f3('0x42')](db[_0x84f3('0x43')][_0x84f3('0x44')],function(_0x415429){return{'name':_0x415429['fieldName'],'type':_0x415429[_0x84f3('0x45')][_0x84f3('0x46')]};});_0x50451b[_0x84f3('0x47')]=_['map'](_0x5dc5c6,'name');_0x50451b[_0x84f3('0x48')]=_[_0x84f3('0x49')](_0x24e67d['query']);_0x50451b['filters']=_[_0x84f3('0x4a')](_0x50451b['model'],_0x50451b['query']);_0x28ee54[_0x84f3('0x4b')]=_[_0x84f3('0x4a')](_0x50451b['model'],qs[_0x84f3('0x4c')](_0x24e67d[_0x84f3('0x48')]['fields']));_0x28ee54[_0x84f3('0x4b')]=_0x28ee54[_0x84f3('0x4b')][_0x84f3('0x4d')]?_0x28ee54[_0x84f3('0x4b')]:_0x50451b[_0x84f3('0x47')];if(!_0x24e67d[_0x84f3('0x48')][_0x84f3('0x4e')](_0x84f3('0x4f'))){_0x28ee54[_0x84f3('0x34')]=qs[_0x84f3('0x34')](_0x24e67d[_0x84f3('0x48')]['limit']);_0x28ee54[_0x84f3('0x32')]=qs[_0x84f3('0x32')](_0x24e67d['query'][_0x84f3('0x32')]);}_0x28ee54['order']=qs[_0x84f3('0x50')](_0x24e67d[_0x84f3('0x48')][_0x84f3('0x50')]);_0x28ee54[_0x84f3('0x51')]=qs[_0x84f3('0x52')](_[_0x84f3('0x53')](_0x24e67d[_0x84f3('0x48')],_0x50451b[_0x84f3('0x52')]),_0x5dc5c6);if(_0x24e67d[_0x84f3('0x48')][_0x84f3('0x54')]){_0x28ee54[_0x84f3('0x51')]=_[_0x84f3('0x55')](_0x28ee54[_0x84f3('0x51')],{'$or':_[_0x84f3('0x42')](_0x5dc5c6,function(_0x300f7d){if(_0x300f7d[_0x84f3('0x45')]!=='VIRTUAL'){var _0x5959bc={};_0x5959bc[_0x300f7d[_0x84f3('0x3f')]]={'$like':'%'+_0x24e67d[_0x84f3('0x48')][_0x84f3('0x54')]+'%'};return _0x5959bc;}})});}_0x28ee54=_[_0x84f3('0x55')]({},_0x28ee54,_0x24e67d[_0x84f3('0x56')]);var _0x54c818={'where':_0x28ee54['where']};return db[_0x84f3('0x43')][_0x84f3('0x35')](_0x54c818)[_0x84f3('0x3c')](function(_0x1d38ac){_0x257e94['count']=_0x1d38ac;if(_0x24e67d[_0x84f3('0x48')][_0x84f3('0x57')]){_0x28ee54[_0x84f3('0x58')]=[{'all':!![]}];}return db[_0x84f3('0x43')][_0x84f3('0x59')](_0x28ee54);})[_0x84f3('0x3c')](function(_0x47693a){_0x257e94[_0x84f3('0x5a')]=_0x47693a;return _0x257e94;})[_0x84f3('0x3c')](respondWithFilteredResult(_0x56a3c5,_0x28ee54))[_0x84f3('0x2d')](handleError(_0x56a3c5,null));};exports[_0x84f3('0x5b')]=function(_0x570905,_0x47a4c1){var _0x3b29d2={'raw':!![],'where':{'id':_0x570905[_0x84f3('0x5c')]['id']}},_0x264a42={};_0x264a42[_0x84f3('0x47')]=_['keys'](db[_0x84f3('0x43')][_0x84f3('0x44')]);_0x264a42[_0x84f3('0x48')]=_[_0x84f3('0x49')](_0x570905['query']);_0x264a42[_0x84f3('0x52')]=_[_0x84f3('0x4a')](_0x264a42[_0x84f3('0x47')],_0x264a42[_0x84f3('0x48')]);_0x3b29d2[_0x84f3('0x4b')]=_[_0x84f3('0x4a')](_0x264a42[_0x84f3('0x47')],qs[_0x84f3('0x4c')](_0x570905[_0x84f3('0x48')][_0x84f3('0x4c')]));_0x3b29d2[_0x84f3('0x4b')]=_0x3b29d2[_0x84f3('0x4b')][_0x84f3('0x4d')]?_0x3b29d2[_0x84f3('0x4b')]:_0x264a42[_0x84f3('0x47')];if(_0x570905['query'][_0x84f3('0x57')]){_0x3b29d2[_0x84f3('0x58')]=[{'all':!![]}];}_0x3b29d2=_['merge']({},_0x3b29d2,_0x570905[_0x84f3('0x56')]);return db[_0x84f3('0x43')]['find'](_0x3b29d2)[_0x84f3('0x3c')](handleEntityNotFound(_0x47a4c1,null))[_0x84f3('0x3c')](respondWithResult(_0x47a4c1,null))['catch'](handleError(_0x47a4c1,null));};exports['update']=function(_0x398c14,_0x3f9fef){if(_0x398c14['body']['id']){delete _0x398c14[_0x84f3('0x5d')]['id'];}return db[_0x84f3('0x43')][_0x84f3('0x5e')]({'where':{'id':_0x398c14[_0x84f3('0x5c')]['id']}})[_0x84f3('0x3c')](handleEntityNotFound(_0x3f9fef,null))[_0x84f3('0x3c')](saveUpdates(_0x398c14[_0x84f3('0x5d')],null))[_0x84f3('0x3c')](respondWithResult(_0x3f9fef,null))[_0x84f3('0x2d')](handleError(_0x3f9fef,null));};exports[_0x84f3('0x3d')]=function(_0x2e1f5c,_0x143b00){return db['FaxMessage']['find']({'where':{'id':_0x2e1f5c[_0x84f3('0x5c')]['id']}})[_0x84f3('0x3c')](handleEntityNotFound(_0x143b00,null))[_0x84f3('0x3c')](removeEntity(_0x143b00,null))['catch'](handleError(_0x143b00,null));};exports[_0x84f3('0x5f')]=function(_0x3c70ca,_0x1c3be0){return db['FaxMessage'][_0x84f3('0x5f')]()[_0x84f3('0x3c')](respondWithResult(_0x1c3be0,null))[_0x84f3('0x2d')](handleError(_0x1c3be0,null));};var interaction_log=require('../../config/logger')(_0x84f3('0x60'));exports[_0x84f3('0x61')]=function(_0xfcd55,_0x244027,_0x2daf76){var _0x32db01={'agent':{},'channel':'fax'};if(_0xfcd55['body']['id']){delete _0xfcd55['body']['id'];}_0xfcd55[_0x84f3('0x5d')][_0x84f3('0x62')]=!![];_0xfcd55[_0x84f3('0x5d')][_0x84f3('0x63')]=moment()[_0x84f3('0x64')](_0x84f3('0x65'));_0xfcd55['body'][_0x84f3('0x66')]=_0xfcd55['body'][_0x84f3('0x66')]||_0xfcd55[_0x84f3('0x67')]['id'];_0x32db01['agent']['id']=_0xfcd55['body'][_0x84f3('0x66')];return db[_0x84f3('0x43')]['find']({'where':{'id':_0xfcd55[_0x84f3('0x5c')]['id'],'UserId':null}})[_0x84f3('0x3c')](handleEntityNotFound(_0x244027,null))[_0x84f3('0x3c')](saveUpdates(_0xfcd55[_0x84f3('0x5d')],null))[_0x84f3('0x3c')](function(_0x501d70){if(_0x501d70){_0x32db01[_0x84f3('0x2c')]=_0x501d70[_0x84f3('0x68')]({'plain':!![]});return db[_0x84f3('0x69')][_0x84f3('0x5e')]({'where':{'id':_0x501d70[_0x84f3('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x244027,null))[_0x84f3('0x3c')](function(_0x31029d){if(_0x31029d){return _0x31029d[_0x84f3('0x3b')]({'UserId':_0xfcd55[_0x84f3('0x5d')][_0x84f3('0x66')],'read1stAt':_[_0x84f3('0x6b')](_0x31029d['read1stAt'])?moment()[_0x84f3('0x64')](_0x84f3('0x65')):undefined});}return null;})[_0x84f3('0x3c')](function(_0x3b1d2f){if(_0x3b1d2f){_0x32db01['interaction']=_0x3b1d2f[_0x84f3('0x68')]({'plain':!![]});interaction_log['info'](_0x84f3('0x6c'),_0xfcd55[_0x84f3('0x67')]['id'],_0xfcd55[_0x84f3('0x67')][_0x84f3('0x3f')],_0xfcd55[_0x84f3('0x67')][_0x84f3('0x6d')],_0x32db01['interaction']['id'],_0xfcd55[_0x84f3('0x5d')]?JSON[_0x84f3('0x29')](_0xfcd55[_0x84f3('0x5d')]):_0x84f3('0x6e'));return respondWithRpcPromise(_0x84f3('0x6f'),_0x84f3('0x70'),_0x32db01);}return null;})[_0x84f3('0x3c')](function(_0x456a99){var _0x4053b2=_0x84f3('0x71')+_0x456a99[_0x84f3('0x2c')][_0x84f3('0x72')];return db[_0x84f3('0x73')][_0x84f3('0x48')](_0x4053b2,{'type':db[_0x84f3('0x74')][_0x84f3('0x75')][_0x84f3('0x76')],'raw':!![]})[_0x84f3('0x3c')](function(_0x894945){return _0x894945;});})[_0x84f3('0x3c')](function(_0x59a2c0){if(_0x59a2c0){_0x32db01[_0x84f3('0x2c')][_0x84f3('0x77')]=_0x59a2c0[0x0];if(!_0xfcd55[_0x84f3('0x5d')][_0x84f3('0x66')])return;return db[_0x84f3('0x78')][_0x84f3('0x5e')]({'where':{'id':_0xfcd55['body'][_0x84f3('0x66')],'role':_0x84f3('0x79')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x84f3('0x3c')](function(_0x8464cd){if(!_0x8464cd)return null;_0x32db01[_0x84f3('0x2c')]['agent']=_0x8464cd;return _0x32db01;})[_0x84f3('0x3c')](function(_0x91e361){if(_0x91e361){if(_0xfcd55[_0x84f3('0x5d')][_0x84f3('0x7a')]){_0x32db01[_0x84f3('0x2c')]['interface']=util['format'](_0x84f3('0x7b'),_0xfcd55['user'][_0x84f3('0x3f')]);_0x32db01[_0x84f3('0x2c')][_0x84f3('0x7c')]=_0x32db01[_0x84f3('0x7c')];_0x32db01[_0x84f3('0x2c')][_0x84f3('0x7d')]=_0x32db01['channel'];_0x32db01[_0x84f3('0x2c')][_0x84f3('0x7e')]=_0x84f3('0x61');return respondWithRpcPromise(_0x84f3('0x7f'),_0x84f3('0x7f'),{'event':'acceptmessage','message':_0x32db01[_0x84f3('0x2c')]},client9002)[_0x84f3('0x3c')](function(){return _0x32db01;});}return _0x32db01;}return null;})[_0x84f3('0x3c')](respondWithResult(_0x244027,null))[_0x84f3('0x2d')](handleError(_0x244027,null));};var interaction_log=require(_0x84f3('0x17'))('fax-interactions');exports[_0x84f3('0x39')]=function(_0x350d85,_0x402389,_0x32f426){var _0x5459a7={'agent':{},'channel':_0x84f3('0x80')};if(_0x350d85[_0x84f3('0x5d')]['id']){delete _0x350d85['body']['id'];}_0x350d85[_0x84f3('0x5d')][_0x84f3('0x66')]=_0x350d85[_0x84f3('0x5d')][_0x84f3('0x66')]||_0x350d85[_0x84f3('0x67')]['id'];_0x5459a7[_0x84f3('0x79')]['id']=_0x350d85[_0x84f3('0x5d')][_0x84f3('0x66')];return db[_0x84f3('0x43')][_0x84f3('0x5e')]({'where':{'id':_0x350d85[_0x84f3('0x5c')]['id'],'UserId':null}})[_0x84f3('0x3c')](handleEntityNotFound(_0x402389,null))[_0x84f3('0x3c')](function(_0x1cb515){if(_0x1cb515){_0x5459a7[_0x84f3('0x2c')]=_0x1cb515[_0x84f3('0x68')]({'plain':!![]});return db[_0x84f3('0x69')]['find']({'where':{'id':_0x1cb515[_0x84f3('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x402389,null))['then'](function(_0x5170a9){if(_0x5170a9){_0x5459a7[_0x84f3('0x81')]=_0x5170a9['get']({'plain':!![]});interaction_log['info'](_0x84f3('0x82'),_0x350d85[_0x84f3('0x67')]['id'],_0x350d85[_0x84f3('0x67')][_0x84f3('0x3f')],_0x350d85['user']['role'],_0x5459a7[_0x84f3('0x81')]['id'],_0x350d85[_0x84f3('0x5d')]?JSON['stringify'](_0x350d85['body']):'null');return respondWithRpcPromise(_0x84f3('0x83'),_0x84f3('0x84'),_0x5459a7);}return null;})[_0x84f3('0x3c')](function(_0x500167){var _0x4c593a=_0x84f3('0x71')+_0x500167['message']['ContactId'];return db[_0x84f3('0x73')][_0x84f3('0x48')](_0x4c593a,{'type':db[_0x84f3('0x74')][_0x84f3('0x75')][_0x84f3('0x76')],'raw':!![]})['then'](function(_0x53852f){return _0x53852f;});})[_0x84f3('0x3c')](function(_0x34c0ce){if(_0x34c0ce){_0x5459a7[_0x84f3('0x2c')][_0x84f3('0x77')]=_0x34c0ce[0x0];if(!_0x350d85[_0x84f3('0x5d')][_0x84f3('0x66')])return;return db['User'][_0x84f3('0x5e')]({'where':{'id':_0x350d85[_0x84f3('0x5d')]['UserId'],'role':'agent'},'attributes':['id',_0x84f3('0x3f'),'fullname',_0x84f3('0x85'),'internal'],'raw':!![]});}return null;})[_0x84f3('0x3c')](function(_0x1cea1c){if(!_0x1cea1c)return null;_0x5459a7[_0x84f3('0x2c')][_0x84f3('0x79')]=_0x1cea1c;return _0x5459a7;})[_0x84f3('0x3c')](function(_0x18fdd0){if(_0x18fdd0){_0x18fdd0[_0x84f3('0x2c')][_0x84f3('0x86')]=util[_0x84f3('0x64')](_0x84f3('0x7b'),_0x350d85[_0x84f3('0x67')][_0x84f3('0x3f')]);_0x18fdd0[_0x84f3('0x2c')][_0x84f3('0x7c')]=_0x5459a7['channel'];_0x18fdd0[_0x84f3('0x2c')][_0x84f3('0x7d')]=_0x5459a7['channel'];_0x18fdd0['message']['event']=_0x84f3('0x39');respondWithRpcPromise('EventManager',_0x84f3('0x7f'),{'event':_0x84f3('0x87'),'message':_0x18fdd0[_0x84f3('0x2c')]},client9002);return _0x5459a7;}return null;})[_0x84f3('0x3c')](respondWithResult(_0x402389,null))['catch'](handleError(_0x402389,null));};exports[_0x84f3('0x88')]=function(_0x2cf708,_0x46df8d){var _0x4e6bb7;return db[_0x84f3('0x43')]['create'](_0x2cf708[_0x84f3('0x5d')],{})['then'](function(_0x1b2a64){_0x4e6bb7=_0x1b2a64;return db[_0x84f3('0x89')]['findOne']({'where':{'id':_0x4e6bb7[_0x84f3('0x72')]}});})[_0x84f3('0x3c')](function(_0x2c3fd3){if(_[_0x84f3('0x6b')](_0x2c3fd3)){return;}else{_0x4e6bb7[_0x84f3('0x80')]=_0x2c3fd3[_0x84f3('0x80')];return db[_0x84f3('0x8a')][_0x84f3('0x8b')]({'where':{'id':_0x4e6bb7[_0x84f3('0x8c')]}});}})['then'](function(_0x416438){return respondWithRpcPromise(_0x84f3('0x8d'),'SendFax',{'FaxAccountId':_['isNil'](_0x2cf708[_0x84f3('0x5d')])?undefined:_0x2cf708[_0x84f3('0x5d')][_0x84f3('0x8e')],'path':_['isNil'](_0x416438)?undefined:util[_0x84f3('0x64')](_0x84f3('0x8f'),_0x416438[_0x84f3('0x90')]),'fax':_[_0x84f3('0x6b')](_0x4e6bb7['fax'])?undefined:_0x4e6bb7['fax'],'AttachmentId':_0x4e6bb7[_0x84f3('0x8c')]},client9002);})[_0x84f3('0x3c')](respondWithResult(_0x46df8d,0xc9))[_0x84f3('0x2d')](handleError(_0x46df8d,null));};exports['download']=function(_0x3a054a,_0x2763bf){var _0x5a493a=path[_0x84f3('0x91')](config['root'],_0x84f3('0x92'),_0x84f3('0x93'),_0x84f3('0x94'));return db[_0x84f3('0x43')]['find']({'where':{'id':_0x3a054a['params']['id']},'include':[{'model':db[_0x84f3('0x8a')],'as':_0x84f3('0x8a')}]})[_0x84f3('0x3c')](handleEntityNotFound(_0x2763bf,null))['then'](function(_0x395913){if(_0x395913){return _0x2763bf[_0x84f3('0x95')](path[_0x84f3('0x91')](_0x5a493a,_0x395913[_0x84f3('0x8a')][_0x84f3('0x90')]));}})[_0x84f3('0x2d')](handleError(_0x2763bf,null));}; \ No newline at end of file +var _0xb5c0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','params','intersection','options','find','update','body','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','fullname','email','internal','interface','motionChannel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','QueryTypes','contact','channel','rejectmessage','create','CmContact','findOne','ContactId','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','server','files','attachments','download','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x120427,_0x2fb0b1){var _0x2f320b=function(_0x17da4e){while(--_0x17da4e){_0x120427['push'](_0x120427['shift']());}};_0x2f320b(++_0x2fb0b1);}(_0xb5c0,0x84));var _0x0b5c=function(_0x17cb30,_0x51f68c){_0x17cb30=_0x17cb30-0x0;var _0x26a0d4=_0xb5c0[_0x17cb30];return _0x26a0d4;};'use strict';var emlformat=require(_0x0b5c('0x0'));var rimraf=require(_0x0b5c('0x1'));var zipdir=require(_0x0b5c('0x2'));var jsonpatch=require(_0x0b5c('0x3'));var rp=require(_0x0b5c('0x4'));var moment=require(_0x0b5c('0x5'));var BPromise=require(_0x0b5c('0x6'));var Mustache=require(_0x0b5c('0x7'));var util=require(_0x0b5c('0x8'));var path=require(_0x0b5c('0x9'));var sox=require(_0x0b5c('0xa'));var csv=require(_0x0b5c('0xb'));var ejs=require(_0x0b5c('0xc'));var fs=require('fs');var fs_extra=require(_0x0b5c('0xd'));var _=require(_0x0b5c('0xe'));var squel=require(_0x0b5c('0xf'));var crypto=require(_0x0b5c('0x10'));var jsforce=require(_0x0b5c('0x11'));var deskjs=require(_0x0b5c('0x12'));var toCsv=require(_0x0b5c('0xb'));var querystring=require(_0x0b5c('0x13'));var Papa=require(_0x0b5c('0x14'));var Redis=require(_0x0b5c('0x15'));var authService=require(_0x0b5c('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x0b5c('0x17'));var hardwareService=require(_0x0b5c('0x18'));var logger=require(_0x0b5c('0x19'))(_0x0b5c('0x1a'));var utils=require('../../config/utils');var config=require(_0x0b5c('0x1b'));var licenseUtil=require(_0x0b5c('0x1c'));var db=require(_0x0b5c('0x1d'))['db'];config[_0x0b5c('0x1e')]=_[_0x0b5c('0x1f')](config[_0x0b5c('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b5c('0x20'))(new Redis(config[_0x0b5c('0x1e')]));require(_0x0b5c('0x21'))[_0x0b5c('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b5c('0x23')][_0x0b5c('0x24')]({'port':0x232c});var client9002=jayson['client'][_0x0b5c('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x517024,_0xf513ea,_0xc44950,_0xcf1a54){return new BPromise(function(_0x1f7c5d,_0x32b7eb){var _0x45d1ac=_0xcf1a54||client;return _0x45d1ac[_0x0b5c('0x25')](_0x517024,_0xc44950)[_0x0b5c('0x26')](function(_0x5aff07){logger[_0x0b5c('0x27')](_0x0b5c('0x28'),_0xf513ea,_0x0b5c('0x29'));logger[_0x0b5c('0x2a')](_0x0b5c('0x2b'),_0xf513ea,_0x0b5c('0x29'),JSON[_0x0b5c('0x2c')](_0x5aff07));if(_0x5aff07['error']){if(_0x5aff07['error'][_0x0b5c('0x2d')]===0x1f4){logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);return _0x32b7eb(_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);}logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);return _0x1f7c5d(_0x5aff07['error'][_0x0b5c('0x2f')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0xf513ea,_0x0b5c('0x29'));_0x1f7c5d(_0x5aff07[_0x0b5c('0x30')][_0x0b5c('0x2f')]);}})[_0x0b5c('0x31')](function(_0x411dbd){logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x411dbd);_0x32b7eb(_0x411dbd);});});}function respondWithStatusCode(_0x3bd723,_0x15a5e8){_0x15a5e8=_0x15a5e8||0xcc;return function(_0xd17f40){if(_0xd17f40){return _0x3bd723['sendStatus'](_0x15a5e8);}return _0x3bd723[_0x0b5c('0x32')](_0x15a5e8)[_0x0b5c('0x33')]();};}function respondWithResult(_0x149ac8,_0x51996f){_0x51996f=_0x51996f||0xc8;return function(_0x37ce41){if(_0x37ce41){return _0x149ac8[_0x0b5c('0x32')](_0x51996f)[_0x0b5c('0x34')](_0x37ce41);}};}function respondWithFilteredResult(_0x25be83,_0x24a252){return function(_0x167042){if(_0x167042){var _0x4be337=typeof _0x24a252[_0x0b5c('0x35')]===_0x0b5c('0x36')&&typeof _0x24a252['limit']==='undefined';var _0x3d05ec=_0x167042[_0x0b5c('0x37')];var _0x51dfd6=_0x4be337?0x0:_0x24a252[_0x0b5c('0x35')];var _0xeaae95=_0x4be337?_0x167042[_0x0b5c('0x37')]:_0x24a252[_0x0b5c('0x35')]+_0x24a252[_0x0b5c('0x38')];var _0x333662;if(_0xeaae95>=_0x3d05ec){_0xeaae95=_0x3d05ec;_0x333662=0xc8;}else{_0x333662=0xce;}_0x25be83[_0x0b5c('0x32')](_0x333662);return _0x25be83[_0x0b5c('0x39')](_0x0b5c('0x3a'),_0x51dfd6+'-'+_0xeaae95+'/'+_0x3d05ec)['json'](_0x167042);}return null;};}function patchUpdates(_0x26daad){return function(_0x288c7f){try{jsonpatch[_0x0b5c('0x3b')](_0x288c7f,_0x26daad,!![]);}catch(_0x20ed45){return BPromise['reject'](_0x20ed45);}return _0x288c7f[_0x0b5c('0x3c')]();};}function saveUpdates(_0x14e28b,_0x459de3){return function(_0x3408b3){if(_0x3408b3){return _0x3408b3['update'](_0x14e28b)[_0x0b5c('0x26')](function(_0x54f48b){return _0x54f48b;});}return null;};}function removeEntity(_0x205186,_0x5d1cf6){return function(_0x2cc5f8){if(_0x2cc5f8){return _0x2cc5f8[_0x0b5c('0x3d')]()[_0x0b5c('0x26')](function(){_0x205186[_0x0b5c('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1d192,_0x2b65c9){return function(_0xa7f4e4){if(!_0xa7f4e4){_0xd1d192[_0x0b5c('0x3e')](0x194);}return _0xa7f4e4;};}function handleError(_0x6881f3,_0x422e25){_0x422e25=_0x422e25||0x1f4;return function(_0x1eae2d){logger['error'](_0x1eae2d[_0x0b5c('0x3f')]);if(_0x1eae2d[_0x0b5c('0x40')]){delete _0x1eae2d[_0x0b5c('0x40')];}_0x6881f3[_0x0b5c('0x32')](_0x422e25)[_0x0b5c('0x41')](_0x1eae2d);};}exports[_0x0b5c('0x42')]=function(_0x4b4e95,_0x3ae208){var _0x205d62={},_0x1ffb10={},_0x2c6155={'count':0x0,'rows':[]};var _0x1ebfad=_[_0x0b5c('0x43')](db[_0x0b5c('0x44')][_0x0b5c('0x45')],function(_0x379784){return{'name':_0x379784[_0x0b5c('0x46')],'type':_0x379784[_0x0b5c('0x47')]['key']};});_0x1ffb10[_0x0b5c('0x48')]=_['map'](_0x1ebfad,_0x0b5c('0x40'));_0x1ffb10[_0x0b5c('0x49')]=_[_0x0b5c('0x4a')](_0x4b4e95['query']);_0x1ffb10['filters']=_['intersection'](_0x1ffb10[_0x0b5c('0x48')],_0x1ffb10['query']);_0x205d62[_0x0b5c('0x4b')]=_['intersection'](_0x1ffb10[_0x0b5c('0x48')],qs[_0x0b5c('0x4c')](_0x4b4e95[_0x0b5c('0x49')]['fields']));_0x205d62['attributes']=_0x205d62[_0x0b5c('0x4b')][_0x0b5c('0x4d')]?_0x205d62['attributes']:_0x1ffb10[_0x0b5c('0x48')];if(!_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x4e')](_0x0b5c('0x4f'))){_0x205d62[_0x0b5c('0x38')]=qs[_0x0b5c('0x38')](_0x4b4e95['query'][_0x0b5c('0x38')]);_0x205d62[_0x0b5c('0x35')]=qs['offset'](_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x35')]);}_0x205d62['order']=qs[_0x0b5c('0x50')](_0x4b4e95['query'][_0x0b5c('0x50')]);_0x205d62[_0x0b5c('0x51')]=qs[_0x0b5c('0x52')](_[_0x0b5c('0x53')](_0x4b4e95[_0x0b5c('0x49')],_0x1ffb10[_0x0b5c('0x52')]),_0x1ebfad);if(_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x54')]){_0x205d62[_0x0b5c('0x51')]=_['merge'](_0x205d62[_0x0b5c('0x51')],{'$or':_[_0x0b5c('0x43')](_0x1ebfad,function(_0xa44a7a){if(_0xa44a7a[_0x0b5c('0x47')]!==_0x0b5c('0x55')){var _0x4740a6={};_0x4740a6[_0xa44a7a[_0x0b5c('0x40')]]={'$like':'%'+_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x54')]+'%'};return _0x4740a6;}})});}_0x205d62=_['merge']({},_0x205d62,_0x4b4e95['options']);var _0x122b7f={'where':_0x205d62['where']};return db[_0x0b5c('0x44')][_0x0b5c('0x37')](_0x122b7f)[_0x0b5c('0x26')](function(_0xda5f07){_0x2c6155[_0x0b5c('0x37')]=_0xda5f07;if(_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x56')]){_0x205d62[_0x0b5c('0x57')]=[{'all':!![]}];}return db[_0x0b5c('0x44')][_0x0b5c('0x58')](_0x205d62);})[_0x0b5c('0x26')](function(_0x2d9772){_0x2c6155[_0x0b5c('0x59')]=_0x2d9772;return _0x2c6155;})[_0x0b5c('0x26')](respondWithFilteredResult(_0x3ae208,_0x205d62))[_0x0b5c('0x31')](handleError(_0x3ae208,null));};exports['show']=function(_0x8ca21a,_0x588a79){var _0x29067b={'raw':!![],'where':{'id':_0x8ca21a[_0x0b5c('0x5a')]['id']}},_0xd4d26f={};_0xd4d26f[_0x0b5c('0x48')]=_[_0x0b5c('0x4a')](db[_0x0b5c('0x44')]['rawAttributes']);_0xd4d26f['query']=_[_0x0b5c('0x4a')](_0x8ca21a[_0x0b5c('0x49')]);_0xd4d26f[_0x0b5c('0x52')]=_[_0x0b5c('0x5b')](_0xd4d26f[_0x0b5c('0x48')],_0xd4d26f['query']);_0x29067b[_0x0b5c('0x4b')]=_[_0x0b5c('0x5b')](_0xd4d26f[_0x0b5c('0x48')],qs[_0x0b5c('0x4c')](_0x8ca21a[_0x0b5c('0x49')]['fields']));_0x29067b['attributes']=_0x29067b[_0x0b5c('0x4b')][_0x0b5c('0x4d')]?_0x29067b['attributes']:_0xd4d26f[_0x0b5c('0x48')];if(_0x8ca21a[_0x0b5c('0x49')]['includeAll']){_0x29067b[_0x0b5c('0x57')]=[{'all':!![]}];}_0x29067b=_['merge']({},_0x29067b,_0x8ca21a[_0x0b5c('0x5c')]);return db[_0x0b5c('0x44')][_0x0b5c('0x5d')](_0x29067b)[_0x0b5c('0x26')](handleEntityNotFound(_0x588a79,null))[_0x0b5c('0x26')](respondWithResult(_0x588a79,null))[_0x0b5c('0x31')](handleError(_0x588a79,null));};exports[_0x0b5c('0x5e')]=function(_0x86b8e6,_0x22cf7b){if(_0x86b8e6[_0x0b5c('0x5f')]['id']){delete _0x86b8e6[_0x0b5c('0x5f')]['id'];}return db[_0x0b5c('0x44')][_0x0b5c('0x5d')]({'where':{'id':_0x86b8e6[_0x0b5c('0x5a')]['id']}})[_0x0b5c('0x26')](handleEntityNotFound(_0x22cf7b,null))['then'](saveUpdates(_0x86b8e6[_0x0b5c('0x5f')],null))[_0x0b5c('0x26')](respondWithResult(_0x22cf7b,null))['catch'](handleError(_0x22cf7b,null));};exports['destroy']=function(_0x839cb5,_0x50171b){return db[_0x0b5c('0x44')]['find']({'where':{'id':_0x839cb5[_0x0b5c('0x5a')]['id']}})[_0x0b5c('0x26')](handleEntityNotFound(_0x50171b,null))[_0x0b5c('0x26')](removeEntity(_0x50171b,null))[_0x0b5c('0x31')](handleError(_0x50171b,null));};exports['describe']=function(_0x2eee21,_0x4474f4){return db[_0x0b5c('0x44')]['describe']()[_0x0b5c('0x26')](respondWithResult(_0x4474f4,null))[_0x0b5c('0x31')](handleError(_0x4474f4,null));};var interaction_log=require('../../config/logger')(_0x0b5c('0x60'));exports[_0x0b5c('0x61')]=function(_0x2a6d1d,_0x55b4f6,_0x4a6223){var _0x3eeb3f={'agent':{},'channel':_0x0b5c('0x62')};if(_0x2a6d1d[_0x0b5c('0x5f')]['id']){delete _0x2a6d1d[_0x0b5c('0x5f')]['id'];}_0x2a6d1d[_0x0b5c('0x5f')]['read']=!![];_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x63')]=moment()[_0x0b5c('0x64')](_0x0b5c('0x65'));_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')]=_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')]||_0x2a6d1d['user']['id'];_0x3eeb3f['agent']['id']=_0x2a6d1d['body'][_0x0b5c('0x66')];return db['FaxMessage']['find']({'where':{'id':_0x2a6d1d[_0x0b5c('0x5a')]['id'],'UserId':null}})[_0x0b5c('0x26')](handleEntityNotFound(_0x55b4f6,null))[_0x0b5c('0x26')](saveUpdates(_0x2a6d1d[_0x0b5c('0x5f')],null))[_0x0b5c('0x26')](function(_0x535568){if(_0x535568){_0x3eeb3f[_0x0b5c('0x2f')]=_0x535568[_0x0b5c('0x67')]({'plain':!![]});return db[_0x0b5c('0x68')][_0x0b5c('0x5d')]({'where':{'id':_0x535568[_0x0b5c('0x69')]}});}return null;})[_0x0b5c('0x26')](handleEntityNotFound(_0x55b4f6,null))[_0x0b5c('0x26')](function(_0x2bb1cc){if(_0x2bb1cc){return _0x2bb1cc[_0x0b5c('0x5e')]({'UserId':_0x2a6d1d[_0x0b5c('0x5f')]['UserId'],'read1stAt':_[_0x0b5c('0x6a')](_0x2bb1cc[_0x0b5c('0x6b')])?moment()[_0x0b5c('0x64')](_0x0b5c('0x65')):undefined});}return null;})[_0x0b5c('0x26')](function(_0xd84e06){if(_0xd84e06){_0x3eeb3f['interaction']=_0xd84e06[_0x0b5c('0x67')]({'plain':!![]});interaction_log[_0x0b5c('0x27')](_0x0b5c('0x6c'),_0x2a6d1d['user']['id'],_0x2a6d1d['user'][_0x0b5c('0x40')],_0x2a6d1d[_0x0b5c('0x6d')]['role'],_0x3eeb3f[_0x0b5c('0x6e')]['id'],_0x2a6d1d[_0x0b5c('0x5f')]?JSON[_0x0b5c('0x2c')](_0x2a6d1d[_0x0b5c('0x5f')]):_0x0b5c('0x6f'));return respondWithRpcPromise(_0x0b5c('0x70'),_0x0b5c('0x71'),_0x3eeb3f);}return null;})['then'](function(_0x38dc53){var _0x391552=_0x0b5c('0x72')+_0x38dc53['message']['ContactId'];return db['sequelize'][_0x0b5c('0x49')](_0x391552,{'type':db[_0x0b5c('0x73')]['QueryTypes'][_0x0b5c('0x74')],'raw':!![]})[_0x0b5c('0x26')](function(_0x31d454){return _0x31d454;});})[_0x0b5c('0x26')](function(_0xd13f73){if(_0xd13f73){_0x3eeb3f[_0x0b5c('0x2f')]['contact']=_0xd13f73[0x0];if(!_0x2a6d1d['body']['UserId'])return;return db[_0x0b5c('0x75')][_0x0b5c('0x5d')]({'where':{'id':_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')],'role':'agent'},'attributes':['id',_0x0b5c('0x40'),_0x0b5c('0x76'),_0x0b5c('0x77'),_0x0b5c('0x78')],'raw':!![]});}return null;})[_0x0b5c('0x26')](function(_0x35e2b4){if(!_0x35e2b4)return null;_0x3eeb3f['message']['agent']=_0x35e2b4;return _0x3eeb3f;})[_0x0b5c('0x26')](function(_0x4fce9b){if(_0x4fce9b){if(_0x2a6d1d[_0x0b5c('0x5f')]['manual']){_0x3eeb3f['message'][_0x0b5c('0x79')]=util[_0x0b5c('0x64')]('SIP/%s',_0x2a6d1d['user']['name']);_0x3eeb3f[_0x0b5c('0x2f')]['channel']=_0x3eeb3f['channel'];_0x3eeb3f[_0x0b5c('0x2f')][_0x0b5c('0x7a')]=_0x3eeb3f['channel'];_0x3eeb3f[_0x0b5c('0x2f')][_0x0b5c('0x7b')]=_0x0b5c('0x61');return respondWithRpcPromise(_0x0b5c('0x7c'),_0x0b5c('0x7c'),{'event':_0x0b5c('0x7d'),'message':_0x3eeb3f[_0x0b5c('0x2f')]},client9002)[_0x0b5c('0x26')](function(){return _0x3eeb3f;});}return _0x3eeb3f;}return null;})[_0x0b5c('0x26')](respondWithResult(_0x55b4f6,null))[_0x0b5c('0x31')](handleError(_0x55b4f6,null));};var interaction_log=require(_0x0b5c('0x19'))(_0x0b5c('0x60'));exports[_0x0b5c('0x7e')]=function(_0x180cc4,_0x5c6e2f,_0x2b9826){var _0x442da1={'agent':{},'channel':_0x0b5c('0x62')};if(_0x180cc4['body']['id']){delete _0x180cc4[_0x0b5c('0x5f')]['id'];}_0x180cc4[_0x0b5c('0x5f')][_0x0b5c('0x66')]=_0x180cc4['body']['UserId']||_0x180cc4[_0x0b5c('0x6d')]['id'];_0x442da1[_0x0b5c('0x7f')]['id']=_0x180cc4[_0x0b5c('0x5f')][_0x0b5c('0x66')];return db[_0x0b5c('0x44')][_0x0b5c('0x5d')]({'where':{'id':_0x180cc4[_0x0b5c('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c6e2f,null))[_0x0b5c('0x26')](function(_0x16f80b){if(_0x16f80b){_0x442da1[_0x0b5c('0x2f')]=_0x16f80b[_0x0b5c('0x67')]({'plain':!![]});return db[_0x0b5c('0x68')][_0x0b5c('0x5d')]({'where':{'id':_0x16f80b[_0x0b5c('0x69')]}});}return null;})[_0x0b5c('0x26')](handleEntityNotFound(_0x5c6e2f,null))['then'](function(_0x36064b){if(_0x36064b){_0x442da1[_0x0b5c('0x6e')]=_0x36064b[_0x0b5c('0x67')]({'plain':!![]});interaction_log[_0x0b5c('0x27')](_0x0b5c('0x80'),_0x180cc4[_0x0b5c('0x6d')]['id'],_0x180cc4[_0x0b5c('0x6d')][_0x0b5c('0x40')],_0x180cc4[_0x0b5c('0x6d')][_0x0b5c('0x81')],_0x442da1[_0x0b5c('0x6e')]['id'],_0x180cc4[_0x0b5c('0x5f')]?JSON['stringify'](_0x180cc4[_0x0b5c('0x5f')]):_0x0b5c('0x6f'));return respondWithRpcPromise(_0x0b5c('0x82'),'rejectMessage',_0x442da1);}return null;})[_0x0b5c('0x26')](function(_0x45c794){var _0x2d00f2=_0x0b5c('0x72')+_0x45c794[_0x0b5c('0x2f')]['ContactId'];return db[_0x0b5c('0x83')][_0x0b5c('0x49')](_0x2d00f2,{'type':db[_0x0b5c('0x73')][_0x0b5c('0x84')][_0x0b5c('0x74')],'raw':!![]})[_0x0b5c('0x26')](function(_0x2eab88){return _0x2eab88;});})[_0x0b5c('0x26')](function(_0x4eb03d){if(_0x4eb03d){_0x442da1[_0x0b5c('0x2f')][_0x0b5c('0x85')]=_0x4eb03d[0x0];if(!_0x180cc4['body'][_0x0b5c('0x66')])return;return db[_0x0b5c('0x75')][_0x0b5c('0x5d')]({'where':{'id':_0x180cc4[_0x0b5c('0x5f')]['UserId'],'role':'agent'},'attributes':['id',_0x0b5c('0x40'),_0x0b5c('0x76'),'email',_0x0b5c('0x78')],'raw':!![]});}return null;})[_0x0b5c('0x26')](function(_0x3386ab){if(!_0x3386ab)return null;_0x442da1[_0x0b5c('0x2f')][_0x0b5c('0x7f')]=_0x3386ab;return _0x442da1;})['then'](function(_0x547562){if(_0x547562){_0x547562[_0x0b5c('0x2f')]['interface']=util[_0x0b5c('0x64')]('SIP/%s',_0x180cc4[_0x0b5c('0x6d')]['name']);_0x547562[_0x0b5c('0x2f')][_0x0b5c('0x86')]=_0x442da1['channel'];_0x547562[_0x0b5c('0x2f')][_0x0b5c('0x7a')]=_0x442da1[_0x0b5c('0x86')];_0x547562[_0x0b5c('0x2f')]['event']=_0x0b5c('0x7e');respondWithRpcPromise(_0x0b5c('0x7c'),_0x0b5c('0x7c'),{'event':_0x0b5c('0x87'),'message':_0x547562[_0x0b5c('0x2f')]},client9002);return _0x442da1;}return null;})[_0x0b5c('0x26')](respondWithResult(_0x5c6e2f,null))[_0x0b5c('0x31')](handleError(_0x5c6e2f,null));};exports[_0x0b5c('0x88')]=function(_0x26da11,_0x1aae12){var _0x1ff6ab;return db[_0x0b5c('0x44')][_0x0b5c('0x88')](_0x26da11['body'],{})[_0x0b5c('0x26')](function(_0x436635){_0x1ff6ab=_0x436635;return db[_0x0b5c('0x89')][_0x0b5c('0x8a')]({'where':{'id':_0x1ff6ab[_0x0b5c('0x8b')]}});})[_0x0b5c('0x26')](function(_0x325c78){if(_['isNil'](_0x325c78)){return;}else{_0x1ff6ab['fax']=_0x325c78['fax'];return db[_0x0b5c('0x8c')][_0x0b5c('0x8a')]({'where':{'id':_0x1ff6ab['AttachmentId']}});}})[_0x0b5c('0x26')](function(_0x1d48b9){return respondWithRpcPromise('SendFax',_0x0b5c('0x8d'),{'FaxAccountId':_[_0x0b5c('0x6a')](_0x26da11[_0x0b5c('0x5f')])?undefined:_0x26da11[_0x0b5c('0x5f')][_0x0b5c('0x8e')],'path':_[_0x0b5c('0x6a')](_0x1d48b9)?undefined:util['format'](_0x0b5c('0x8f'),_0x1d48b9['basename']),'fax':_[_0x0b5c('0x6a')](_0x1ff6ab[_0x0b5c('0x62')])?undefined:_0x1ff6ab[_0x0b5c('0x62')],'AttachmentId':_0x1ff6ab[_0x0b5c('0x90')]},client9002);})[_0x0b5c('0x26')](respondWithResult(_0x1aae12,0xc9))[_0x0b5c('0x31')](handleError(_0x1aae12,null));};exports['download']=function(_0xbecf06,_0x136e3d){var _0x832e58=path[_0x0b5c('0x91')](config[_0x0b5c('0x92')],_0x0b5c('0x93'),_0x0b5c('0x94'),_0x0b5c('0x95'));return db[_0x0b5c('0x44')]['find']({'where':{'id':_0xbecf06[_0x0b5c('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x0b5c('0x26')](handleEntityNotFound(_0x136e3d,null))[_0x0b5c('0x26')](function(_0x1da94e){if(_0x1da94e){return _0x136e3d[_0x0b5c('0x96')](path[_0x0b5c('0x91')](_0x832e58,_0x1da94e[_0x0b5c('0x8c')][_0x0b5c('0x97')]));}})[_0x0b5c('0x31')](handleError(_0x136e3d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 53eb524..ad9e792 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 _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','FaxMessage','setMaxListeners','save'];(function(_0x5f1ef8,_0x60b102){var _0x5f4475=function(_0x399e09){while(--_0x399e09){_0x5f1ef8['push'](_0x5f1ef8['shift']());}};_0x5f4475(++_0x60b102);}(_0xacf4,0xe7));var _0x4acf=function(_0x1d874d,_0x4ec6d2){_0x1d874d=_0x1d874d-0x0;var _0x4fb9a8=_0xacf4[_0x1d874d];return _0x4fb9a8;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4acf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){FaxMessageEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);FaxMessageEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];FaxMessage[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x7fd6=['FaxMessage','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0xcb74e4,_0x478662){var _0x39b9f3=function(_0x50e7a3){while(--_0x50e7a3){_0xcb74e4['push'](_0xcb74e4['shift']());}};_0x39b9f3(++_0x478662);}(_0x7fd6,0x157));var _0x67fd=function(_0x1fbbda,_0x3049d7){_0x1fbbda=_0x1fbbda-0x0;var _0x55d989=_0x7fd6[_0x1fbbda];return _0x55d989;};'use strict';var EventEmitter=require(_0x67fd('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x67fd('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x67fd('0x2')](0x0);var events={'afterCreate':_0x67fd('0x3'),'afterUpdate':_0x67fd('0x4'),'afterDestroy':_0x67fd('0x5')};function emitEvent(_0xbdd0c0){return function(_0x4f52bc,_0x187f3e,_0x50238d){FaxMessageEvents['emit'](_0xbdd0c0+':'+_0x4f52bc['id'],_0x4f52bc);FaxMessageEvents['emit'](_0xbdd0c0,_0x4f52bc);_0x50238d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x67fd('0x6')](e,emitEvent(event));}}module[_0x67fd('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b77801e..1630af6 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 _0x593e=['then','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId'];(function(_0x204f92,_0x948176){var _0x2cc66b=function(_0x2f9e56){while(--_0x2f9e56){_0x204f92['push'](_0x204f92['shift']());}};_0x2cc66b(++_0x948176);}(_0x593e,0x17e));var _0xe593=function(_0x1a2a0f,_0x34ca48){_0x1a2a0f=_0x1a2a0f-0x0;var _0x1ac06b=_0x593e[_0x1a2a0f];return _0x1ac06b;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require('../../config/logger')(_0xe593('0x2'));var moment=require(_0xe593('0x3'));var BPromise=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe593('0x6'));var config=require(_0xe593('0x7'));var attributes=require(_0xe593('0x8'));module[_0xe593('0x9')]=function(_0x10e58c,_0x239c54){return _0x10e58c['define'](_0xe593('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xe593('0xb'),'fields':[_0xe593('0xc')],'type':_0xe593('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x91a309,_0x1db826,_0x4bd97d){var _0x277637=_0x10e58c['models'];var _0x4fab35=_0x91a309[_0xe593('0xe')]({'plain':!![]});if(_0x4fab35[_0xe593('0xf')]['toLowerCase']()==='in'||_0x4fab35[_0xe593('0xf')][_0xe593('0x10')]()===_0xe593('0x11')&&!_0x4fab35[_0xe593('0x12')]&&!_[_0xe593('0x13')](_0x4fab35[_0xe593('0x14')])){_0x277637['FaxInteraction'][_0xe593('0x15')]({'where':{'id':_0x4fab35[_0xe593('0x16')]}})[_0xe593('0x17')](function(_0x5574e2){if(_0x5574e2){_0x5574e2['update']({'lastMsgAt':_0x4fab35['createdAt'],'lastMsgDirection':_0x4fab35[_0xe593('0xf')][_0xe593('0x10')]()});}})[_0xe593('0x18')](function(_0xbee778){console[_0xe593('0x19')](_0xbee778);});}_0x4bd97d();}},'charset':_0xe593('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x468c=['FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x561f69,_0x1a6fd1){var _0x564eca=function(_0x4e37b1){while(--_0x4e37b1){_0x561f69['push'](_0x561f69['shift']());}};_0x564eca(++_0x1a6fd1);}(_0x468c,0x127));var _0xc468=function(_0x16ddd7,_0x382221){_0x16ddd7=_0x16ddd7-0x0;var _0x7b63d4=_0x468c[_0x16ddd7];return _0x7b63d4;};'use strict';var _=require(_0xc468('0x0'));var util=require(_0xc468('0x1'));var logger=require(_0xc468('0x2'))(_0xc468('0x3'));var moment=require(_0xc468('0x4'));var BPromise=require(_0xc468('0x5'));var rp=require(_0xc468('0x6'));var fs=require('fs');var path=require(_0xc468('0x7'));var rimraf=require(_0xc468('0x8'));var config=require(_0xc468('0x9'));var attributes=require(_0xc468('0xa'));module[_0xc468('0xb')]=function(_0x56243b,_0x57839c){return _0x56243b['define'](_0xc468('0xc'),attributes,{'tableName':_0xc468('0xd'),'paranoid':![],'indexes':[{'name':_0xc468('0xe'),'fields':[_0xc468('0xf')],'type':_0xc468('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33db27,_0x3a4f1f,_0x3703a3){var _0x54488e=_0x56243b['models'];var _0x35142e=_0x33db27[_0xc468('0x11')]({'plain':!![]});if(_0x35142e[_0xc468('0x12')]['toLowerCase']()==='in'||_0x35142e[_0xc468('0x12')][_0xc468('0x13')]()===_0xc468('0x14')&&!_0x35142e[_0xc468('0x15')]&&!_[_0xc468('0x16')](_0x35142e[_0xc468('0x17')])){_0x54488e['FaxInteraction'][_0xc468('0x18')]({'where':{'id':_0x35142e[_0xc468('0x19')]}})[_0xc468('0x1a')](function(_0x342c7a){if(_0x342c7a){_0x342c7a[_0xc468('0x1b')]({'lastMsgAt':_0x35142e['createdAt'],'lastMsgDirection':_0x35142e[_0xc468('0x12')][_0xc468('0x13')]()});}})[_0xc468('0x1c')](function(_0x1a98ed){console[_0xc468('0x1d')](_0x1a98ed);});}_0x3703a3();}},'charset':_0xc468('0x1e'),'collate':_0xc468('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c1cbed1..3bd483b 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 _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x15e666,_0x1f367a){var _0x2df9a3=function(_0x449062){while(--_0x449062){_0x15e666['push'](_0x15e666['shift']());}};_0x2df9a3(++_0x1f367a);}(_0xda55,0x6d));var _0x5da5=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0xda55[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file +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(_0x2b0fe2,_0x2ef9fa){var _0x3371e2=function(_0x353771){while(--_0x353771){_0x2b0fe2['push'](_0x2b0fe2['shift']());}};_0x3371e2(++_0x2ef9fa);}(_0xac9d,0x14d));var _0xdac9=function(_0x476c6c,_0x434db8){_0x476c6c=_0x476c6c-0x0;var _0xbb94db=_0xac9d[_0x476c6c];return _0xbb94db;};'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 diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7afe944..d5b8692 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 _0xb330=['length','save','update','emit','register'];(function(_0x9ee2d0,_0x100c31){var _0x2bf9ad=function(_0x28ddf9){while(--_0x28ddf9){_0x9ee2d0['push'](_0x9ee2d0['shift']());}};_0x2bf9ad(++_0x100c31);}(_0xb330,0x11e));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x0b33('0x0'),'remove',_0x0b33('0x1')];function createListener(_0x4ea419,_0x1b0959){return function(_0x52ce10){_0x1b0959[_0x0b33('0x2')](_0x4ea419,_0x52ce10);};}function removeListener(_0x3d84a9,_0x1180fd){return function(){FaxMessageEvents['removeListener'](_0x3d84a9,_0x1180fd);};}exports[_0x0b33('0x3')]=function(_0x32a7c8){for(var _0x489a5c=0x0,_0x586f69=events[_0x0b33('0x4')];_0x489a5c<_0x586f69;_0x489a5c++){var _0x10991d=events[_0x489a5c];var _0x5a73b7=createListener('faxMessage:'+_0x10991d,_0x32a7c8);FaxMessageEvents['on'](_0x10991d,_0x5a73b7);}}; \ No newline at end of file +var _0x87a7=['faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x146fa1,_0x92e55c){var _0x41217e=function(_0x4be890){while(--_0x4be890){_0x146fa1['push'](_0x146fa1['shift']());}};_0x41217e(++_0x92e55c);}(_0x87a7,0x151));var _0x787a=function(_0x49481d,_0xd95b74){_0x49481d=_0x49481d-0x0;var _0x27dd6e=_0x87a7[_0x49481d];return _0x27dd6e;};'use strict';var FaxMessageEvents=require(_0x787a('0x0'));var events=[_0x787a('0x1'),_0x787a('0x2'),_0x787a('0x3')];function createListener(_0xba229d,_0x126fbd){return function(_0x51b8aa){_0x126fbd[_0x787a('0x4')](_0xba229d,_0x51b8aa);};}function removeListener(_0x41c0c6,_0x25fc58){return function(){FaxMessageEvents['removeListener'](_0x41c0c6,_0x25fc58);};}exports['register']=function(_0x595c52){for(var _0x4e3819=0x0,_0x5b31b4=events['length'];_0x4e3819<_0x5b31b4;_0x4e3819++){var _0x65745c=events[_0x4e3819];var _0xa8da06=createListener(_0x787a('0x5')+_0x65745c,_0x595c52);FaxMessageEvents['on'](_0x65745c,_0xa8da06);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0f1917a..ecaaf34 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 _0xec56=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','reject','delete','exports','multer','connect-timeout','express'];(function(_0xd13908,_0x21e643){var _0x4be501=function(_0x514903){while(--_0x514903){_0xd13908['push'](_0xd13908['shift']());}};_0x4be501(++_0x21e643);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3e85b9,_0x459532){_0x3e85b9=_0x3e85b9-0x0;var _0x63b589=_0xec56[_0x3e85b9];return _0x63b589;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['get'](_0x6ec5('0x10'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')]('/',auth[_0x6ec5('0xa')](),interaction[_0x6ec5('0x13')](_0x6ec5('0x14'),'faxmessage:create'),controller[_0x6ec5('0x15')]);router[_0x6ec5('0x16')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x17')]);router[_0x6ec5('0x16')](_0x6ec5('0x18'),auth[_0x6ec5('0xa')](),controller['accept']);router[_0x6ec5('0x16')]('/:id/reject',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x19')]);router[_0x6ec5('0x1a')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller['destroy']);module[_0x6ec5('0x1b')]=router; \ No newline at end of file +var _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x0102,0x186));var _0x2010=function(_0x3b4038,_0x7ffba5){_0x3b4038=_0x3b4038-0x0;var _0x34d5a6=_0x0102[_0x3b4038];return _0x34d5a6;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c015a15..452dc8f 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 _0xe49a=['beepall','name','STRING','INTEGER','ENUM'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xe49a,0x6f));var _0xae49=function(_0xeaf529,_0x26c42a){_0xeaf529=_0xeaf529-0x0;var _0x402b5a=_0xe49a[_0xeaf529];return _0x402b5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xae49('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae49('0x1')]},'timeout':{'type':Sequelize[_0xae49('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xae49('0x3')]('rrmemory',_0xae49('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x598a=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x293a24,_0x2406e6){var _0x23d1cf=function(_0x1130d4){while(--_0x1130d4){_0x293a24['push'](_0x293a24['shift']());}};_0x23d1cf(++_0x2406e6);}(_0x598a,0x1c9));var _0xa598=function(_0x488918,_0x1ae69d){_0x488918=_0x488918-0x0;var _0x223529=_0x598a[_0x488918];return _0x223529;};'use strict';var Sequelize=require(_0xa598('0x0'));module[_0xa598('0x1')]={'name':{'type':Sequelize[_0xa598('0x2')],'unique':_0xa598('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa598('0x2')]},'timeout':{'type':Sequelize[_0xa598('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa598('0x5'),_0xa598('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa598('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9adddab..abfaa60 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 _0x58ee=['sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','order','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x271a42,_0x303b37){var _0x31c7fd=function(_0xe389c4){while(--_0xe389c4){_0x271a42['push'](_0x271a42['shift']());}};_0x31c7fd(++_0x303b37);}(_0x58ee,0x101));var _0xe58e=function(_0x2b7433,_0x57e7a1){_0x2b7433=_0x2b7433-0x0;var _0x4ae025=_0x58ee[_0x2b7433];return _0x4ae025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe58e('0x0'));var zipdir=require(_0xe58e('0x1'));var jsonpatch=require(_0xe58e('0x2'));var rp=require('request-promise');var moment=require(_0xe58e('0x3'));var BPromise=require(_0xe58e('0x4'));var Mustache=require('mustache');var util=require(_0xe58e('0x5'));var path=require(_0xe58e('0x6'));var sox=require(_0xe58e('0x7'));var csv=require(_0xe58e('0x8'));var ejs=require(_0xe58e('0x9'));var fs=require('fs');var fs_extra=require(_0xe58e('0xa'));var _=require(_0xe58e('0xb'));var squel=require(_0xe58e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe58e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe58e('0xe'));var Papa=require(_0xe58e('0xf'));var Redis=require(_0xe58e('0x10'));var authService=require(_0xe58e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe58e('0x12'));var hardwareService=require(_0xe58e('0x13'));var logger=require(_0xe58e('0x14'))(_0xe58e('0x15'));var utils=require(_0xe58e('0x16'));var config=require(_0xe58e('0x17'));var licenseUtil=require(_0xe58e('0x18'));var db=require('../../mysqldb')['db'];config[_0xe58e('0x19')]=_[_0xe58e('0x1a')](config[_0xe58e('0x19')],{'host':_0xe58e('0x1b'),'port':0x18eb});var socket=require(_0xe58e('0x1c'))(new Redis(config[_0xe58e('0x19')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x13528a,_0x27dfe6){_0x27dfe6=_0x27dfe6||0xcc;return function(_0x561e9b){if(_0x561e9b){return _0x13528a[_0xe58e('0x1d')](_0x27dfe6);}return _0x13528a['status'](_0x27dfe6)['end']();};}function respondWithResult(_0xbe47e2,_0x5b1faf){_0x5b1faf=_0x5b1faf||0xc8;return function(_0x14d692){if(_0x14d692){return _0xbe47e2[_0xe58e('0x1e')](_0x5b1faf)[_0xe58e('0x1f')](_0x14d692);}};}function respondWithFilteredResult(_0x4262cf,_0xa4b571){return function(_0x63d1a5){if(_0x63d1a5){var _0x5ebdc8=typeof _0xa4b571[_0xe58e('0x20')]==='undefined'&&typeof _0xa4b571[_0xe58e('0x21')]===_0xe58e('0x22');var _0x3cb5a9=_0x63d1a5[_0xe58e('0x23')];var _0x5b842c=_0x5ebdc8?0x0:_0xa4b571[_0xe58e('0x20')];var _0x2c33c3=_0x5ebdc8?_0x63d1a5[_0xe58e('0x23')]:_0xa4b571[_0xe58e('0x20')]+_0xa4b571['limit'];var _0xd90c09;if(_0x2c33c3>=_0x3cb5a9){_0x2c33c3=_0x3cb5a9;_0xd90c09=0xc8;}else{_0xd90c09=0xce;}_0x4262cf[_0xe58e('0x1e')](_0xd90c09);return _0x4262cf[_0xe58e('0x24')](_0xe58e('0x25'),_0x5b842c+'-'+_0x2c33c3+'/'+_0x3cb5a9)[_0xe58e('0x1f')](_0x63d1a5);}return null;};}function patchUpdates(_0x367f41){return function(_0x3f33f1){try{jsonpatch[_0xe58e('0x26')](_0x3f33f1,_0x367f41,!![]);}catch(_0x352cc6){return BPromise['reject'](_0x352cc6);}return _0x3f33f1[_0xe58e('0x27')]();};}function saveUpdates(_0x37879a,_0x3007f6){return function(_0x527cac){if(_0x527cac){return _0x527cac[_0xe58e('0x28')](_0x37879a)[_0xe58e('0x29')](function(_0x26e9d8){return _0x26e9d8;});}return null;};}function removeEntity(_0x294cce,_0x161982){return function(_0x51df8f){if(_0x51df8f){return _0x51df8f[_0xe58e('0x2a')]()[_0xe58e('0x29')](function(){var _0x59c011=_0x51df8f[_0xe58e('0x2b')]({'plain':!![]});var _0x58282b=_0xe58e('0x2c');return db[_0xe58e('0x2d')][_0xe58e('0x2a')]({'where':{'type':_0x58282b,'resourceId':_0x59c011['id']}})[_0xe58e('0x29')](function(){return _0x51df8f;});})['then'](function(){_0x294cce[_0xe58e('0x1e')](0xcc)[_0xe58e('0x2e')]();});}};}function handleEntityNotFound(_0x51028e,_0x4ae296){return function(_0x3d62d5){if(!_0x3d62d5){_0x51028e['sendStatus'](0x194);}return _0x3d62d5;};}function handleError(_0x2ca556,_0x3f6f58){_0x3f6f58=_0x3f6f58||0x1f4;return function(_0x50a0c9){logger[_0xe58e('0x2f')](_0x50a0c9[_0xe58e('0x30')]);if(_0x50a0c9[_0xe58e('0x31')]){delete _0x50a0c9['name'];}_0x2ca556[_0xe58e('0x1e')](_0x3f6f58)['send'](_0x50a0c9);};}exports[_0xe58e('0x32')]=function(_0xe01168,_0x4d08d8){var _0x54434a={},_0x214a10={},_0x1fd3b7={'count':0x0,'rows':[]};var _0x25350b=_[_0xe58e('0x33')](db[_0xe58e('0x34')][_0xe58e('0x35')],function(_0x43efdb){return{'name':_0x43efdb[_0xe58e('0x36')],'type':_0x43efdb[_0xe58e('0x37')]['key']};});_0x214a10[_0xe58e('0x38')]=_[_0xe58e('0x33')](_0x25350b,_0xe58e('0x31'));_0x214a10[_0xe58e('0x39')]=_[_0xe58e('0x3a')](_0xe01168[_0xe58e('0x39')]);_0x214a10['filters']=_[_0xe58e('0x3b')](_0x214a10[_0xe58e('0x38')],_0x214a10['query']);_0x54434a[_0xe58e('0x3c')]=_['intersection'](_0x214a10['model'],qs[_0xe58e('0x3d')](_0xe01168['query'][_0xe58e('0x3d')]));_0x54434a[_0xe58e('0x3c')]=_0x54434a[_0xe58e('0x3c')][_0xe58e('0x3e')]?_0x54434a[_0xe58e('0x3c')]:_0x214a10[_0xe58e('0x38')];if(!_0xe01168['query'][_0xe58e('0x3f')](_0xe58e('0x40'))){_0x54434a['limit']=qs[_0xe58e('0x21')](_0xe01168[_0xe58e('0x39')][_0xe58e('0x21')]);_0x54434a[_0xe58e('0x20')]=qs[_0xe58e('0x20')](_0xe01168['query'][_0xe58e('0x20')]);}_0x54434a['order']=qs[_0xe58e('0x41')](_0xe01168[_0xe58e('0x39')][_0xe58e('0x41')]);_0x54434a['where']=qs[_0xe58e('0x42')](_['pick'](_0xe01168['query'],_0x214a10[_0xe58e('0x42')]),_0x25350b);if(_0xe01168[_0xe58e('0x39')][_0xe58e('0x43')]){_0x54434a[_0xe58e('0x44')]=_[_0xe58e('0x45')](_0x54434a[_0xe58e('0x44')],{'$or':_['map'](_0x25350b,function(_0x567c5a){if(_0x567c5a['type']!==_0xe58e('0x46')){var _0xb16587={};_0xb16587[_0x567c5a[_0xe58e('0x31')]]={'$like':'%'+_0xe01168[_0xe58e('0x39')][_0xe58e('0x43')]+'%'};return _0xb16587;}})});}_0x54434a=_['merge']({},_0x54434a,_0xe01168[_0xe58e('0x47')]);var _0x3f4259={'where':_0x54434a[_0xe58e('0x44')]};return db['FaxQueue'][_0xe58e('0x23')](_0x3f4259)[_0xe58e('0x29')](function(_0x1aa43b){_0x1fd3b7[_0xe58e('0x23')]=_0x1aa43b;if(_0xe01168[_0xe58e('0x39')][_0xe58e('0x48')]){_0x54434a[_0xe58e('0x49')]=[{'all':!![]}];}return db['FaxQueue'][_0xe58e('0x4a')](_0x54434a);})[_0xe58e('0x29')](function(_0x184505){_0x1fd3b7[_0xe58e('0x4b')]=_0x184505;return _0x1fd3b7;})[_0xe58e('0x29')](respondWithFilteredResult(_0x4d08d8,_0x54434a))[_0xe58e('0x4c')](handleError(_0x4d08d8,null));};exports[_0xe58e('0x4d')]=function(_0x48e49e,_0x1fc5ef){var _0x4648ce={'raw':!![],'where':{'id':_0x48e49e[_0xe58e('0x4e')]['id']}},_0x765af6={};_0x765af6[_0xe58e('0x38')]=_[_0xe58e('0x3a')](db['FaxQueue'][_0xe58e('0x35')]);_0x765af6[_0xe58e('0x39')]=_[_0xe58e('0x3a')](_0x48e49e['query']);_0x765af6['filters']=_[_0xe58e('0x3b')](_0x765af6['model'],_0x765af6[_0xe58e('0x39')]);_0x4648ce[_0xe58e('0x3c')]=_[_0xe58e('0x3b')](_0x765af6[_0xe58e('0x38')],qs['fields'](_0x48e49e[_0xe58e('0x39')]['fields']));_0x4648ce[_0xe58e('0x3c')]=_0x4648ce[_0xe58e('0x3c')][_0xe58e('0x3e')]?_0x4648ce[_0xe58e('0x3c')]:_0x765af6[_0xe58e('0x38')];if(_0x48e49e[_0xe58e('0x39')]['includeAll']){_0x4648ce[_0xe58e('0x49')]=[{'all':!![]}];}_0x4648ce=_[_0xe58e('0x45')]({},_0x4648ce,_0x48e49e[_0xe58e('0x47')]);return db['FaxQueue'][_0xe58e('0x4f')](_0x4648ce)[_0xe58e('0x29')](handleEntityNotFound(_0x1fc5ef,null))[_0xe58e('0x29')](respondWithResult(_0x1fc5ef,null))[_0xe58e('0x4c')](handleError(_0x1fc5ef,null));};exports['create']=function(_0x23d9ec,_0x546b19){return db[_0xe58e('0x34')][_0xe58e('0x50')](_0x23d9ec[_0xe58e('0x51')],{})[_0xe58e('0x29')](function(_0x5e4e32){var _0x581680=_0x23d9ec['user'][_0xe58e('0x2b')]({'plain':!![]});if(!_0x581680)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x581680[_0xe58e('0x52')]==='user'){var _0x3afd91=_0x5e4e32[_0xe58e('0x2b')]({'plain':!![]});var _0x18d1fd=_0xe58e('0x2c');return db[_0xe58e('0x53')][_0xe58e('0x4f')]({'where':{'name':_0x18d1fd,'userProfileId':_0x581680[_0xe58e('0x54')]},'raw':!![]})[_0xe58e('0x29')](function(_0x1f47a8){if(_0x1f47a8&&_0x1f47a8[_0xe58e('0x55')]===0x0){return db[_0xe58e('0x2d')][_0xe58e('0x50')]({'name':_0x3afd91[_0xe58e('0x31')],'resourceId':_0x3afd91['id'],'type':_0x1f47a8['name'],'sectionId':_0x1f47a8['id']},{})[_0xe58e('0x29')](function(){return _0x5e4e32;});}else{return _0x5e4e32;}})['catch'](function(_0x12cc56){logger[_0xe58e('0x2f')](_0xe58e('0x56'),_0x12cc56);throw _0x12cc56;});}return _0x5e4e32;})[_0xe58e('0x29')](respondWithResult(_0x546b19,0xc9))[_0xe58e('0x4c')](handleError(_0x546b19,null));};exports[_0xe58e('0x28')]=function(_0x24ed5d,_0x560a47){if(_0x24ed5d['body']['id']){delete _0x24ed5d[_0xe58e('0x51')]['id'];}return db[_0xe58e('0x34')][_0xe58e('0x4f')]({'where':{'id':_0x24ed5d[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x560a47,null))['then'](saveUpdates(_0x24ed5d[_0xe58e('0x51')],null))['then'](respondWithResult(_0x560a47,null))[_0xe58e('0x4c')](handleError(_0x560a47,null));};exports['destroy']=function(_0x2b6816,_0x2c91a2){return db[_0xe58e('0x34')][_0xe58e('0x4f')]({'where':{'id':_0x2b6816[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x2c91a2,null))['then'](removeEntity(_0x2c91a2,null))[_0xe58e('0x4c')](handleError(_0x2c91a2,null));};exports[_0xe58e('0x57')]=function(_0x57ac18,_0x1526a2){return db[_0xe58e('0x34')][_0xe58e('0x57')]()['then'](respondWithResult(_0x1526a2,null))[_0xe58e('0x4c')](handleError(_0x1526a2,null));};exports[_0xe58e('0x58')]=function(_0xd98a75,_0x3fc149,_0x5dae0c){var _0x31603f={'raw':!![],'where':{}},_0x42d0be={},_0x1751c8;return db[_0xe58e('0x34')][_0xe58e('0x59')]({'where':{'id':_0xd98a75[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x3fc149,null))['then'](function(_0x51b9da){if(_0x51b9da){_0x1751c8=_0x51b9da[_0xe58e('0x2b')]({'plain':!![]});_0x42d0be[_0xe58e('0x38')]=_[_0xe58e('0x3a')](db[_0xe58e('0x5a')][_0xe58e('0x35')]);_0x42d0be[_0xe58e('0x39')]=_[_0xe58e('0x3a')](_0xd98a75[_0xe58e('0x39')]);_0x42d0be[_0xe58e('0x42')]=_['intersection'](_0x42d0be['model'],_0x42d0be['query']);_0x31603f[_0xe58e('0x3c')]=_['intersection'](_0x42d0be[_0xe58e('0x38')],qs[_0xe58e('0x3d')](_0xd98a75[_0xe58e('0x39')][_0xe58e('0x3d')]));_0x31603f[_0xe58e('0x3c')]=_0x31603f[_0xe58e('0x3c')][_0xe58e('0x3e')]?_0x31603f['attributes']:_0x42d0be[_0xe58e('0x38')];if(!_0xd98a75[_0xe58e('0x39')]['hasOwnProperty'](_0xe58e('0x40'))){_0x31603f[_0xe58e('0x21')]=qs[_0xe58e('0x21')](_0xd98a75['query'][_0xe58e('0x21')]);_0x31603f[_0xe58e('0x20')]=qs[_0xe58e('0x20')](_0xd98a75[_0xe58e('0x39')]['offset']);}_0x31603f[_0xe58e('0x5b')]=qs[_0xe58e('0x41')](_0xd98a75[_0xe58e('0x39')][_0xe58e('0x41')]);_0x31603f['where']=qs[_0xe58e('0x42')](_[_0xe58e('0x5c')](_0xd98a75[_0xe58e('0x39')],_0x42d0be[_0xe58e('0x42')]));_0x31603f[_0xe58e('0x44')][_0xe58e('0x5d')]=_0x51b9da['id'];if(_0xd98a75['query'][_0xe58e('0x43')]){_0x31603f[_0xe58e('0x44')]=_[_0xe58e('0x45')](_0x31603f[_0xe58e('0x44')],{'$or':_[_0xe58e('0x33')](_0x31603f[_0xe58e('0x3c')],function(_0x5af487){var _0x5dcfd0={};_0x5dcfd0[_0x5af487]={'$like':'%'+_0xd98a75[_0xe58e('0x39')][_0xe58e('0x43')]+'%'};return _0x5dcfd0;})});}_0x31603f=_[_0xe58e('0x45')]({},_0x31603f,_0xd98a75[_0xe58e('0x47')]);return db[_0xe58e('0x5a')][_0xe58e('0x4a')](_0x31603f);}})[_0xe58e('0x29')](function(_0x53e040){if(_0x53e040){return db[_0xe58e('0x5e')][_0xe58e('0x5f')]({'where':{'id':_['map'](_0x53e040,_0xe58e('0x60')),'role':'agent'},'attributes':['id',_0xe58e('0x31'),_0xe58e('0x61'),_0xe58e('0x62'),_0xe58e('0x63')]});}})['then'](function(_0xaf2cf2){if(_0xaf2cf2){return{'count':_0xaf2cf2['count'],'rows':_[_0xe58e('0x33')](_0xaf2cf2[_0xe58e('0x4b')],function(_0x4e034f){return{'membername':_0x4e034f[_0xe58e('0x31')],'UserId':_0x4e034f['id'],'queue_name':_0x1751c8[_0xe58e('0x31')],'FaxQueueId':_0x1751c8['id'],'interface':util[_0xe58e('0x64')](_0xe58e('0x65'),_0xe58e('0x66'),_0x4e034f[_0xe58e('0x31')]),'penalty':0x0,'paused':_0x4e034f[_0xe58e('0x61')],'createdAt':_0x4e034f[_0xe58e('0x63')],'updatedAt':_0x4e034f[_0xe58e('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe58e('0x29')](respondWithFilteredResult(_0x3fc149,_0x31603f))[_0xe58e('0x4c')](handleError(_0x3fc149,null));};exports[_0xe58e('0x67')]=function(_0x1693f9,_0x2dba91,_0x1a51d5){var _0x2e88b5={};var _0x20b72b={};var _0x860992;var _0x285dc8;return db[_0xe58e('0x34')][_0xe58e('0x59')]({'where':{'id':_0x1693f9['params']['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x2dba91,null))[_0xe58e('0x29')](function(_0x33e88e){if(_0x33e88e){_0x860992=_0x33e88e;_0x20b72b[_0xe58e('0x38')]=_[_0xe58e('0x3a')](db[_0xe58e('0x68')][_0xe58e('0x35')]);_0x20b72b[_0xe58e('0x39')]=_[_0xe58e('0x3a')](_0x1693f9['query']);_0x20b72b[_0xe58e('0x42')]=_[_0xe58e('0x3b')](_0x20b72b[_0xe58e('0x38')],_0x20b72b['query']);_0x2e88b5[_0xe58e('0x3c')]=_[_0xe58e('0x3b')](_0x20b72b[_0xe58e('0x38')],qs[_0xe58e('0x3d')](_0x1693f9['query']['fields']));_0x2e88b5[_0xe58e('0x3c')]=_0x2e88b5[_0xe58e('0x3c')][_0xe58e('0x3e')]?_0x2e88b5['attributes']:_0x20b72b[_0xe58e('0x38')];_0x2e88b5[_0xe58e('0x5b')]=qs[_0xe58e('0x41')](_0x1693f9['query']['sort']);_0x2e88b5[_0xe58e('0x44')]=qs['filters'](_['pick'](_0x1693f9[_0xe58e('0x39')],_0x20b72b[_0xe58e('0x42')]));if(_0x1693f9['query'][_0xe58e('0x43')]){_0x2e88b5[_0xe58e('0x44')]=_[_0xe58e('0x45')](_0x2e88b5[_0xe58e('0x44')],{'$or':_[_0xe58e('0x33')](_0x2e88b5[_0xe58e('0x3c')],function(_0x4fa720){var _0x580ffa={};_0x580ffa[_0x4fa720]={'$like':'%'+_0x1693f9['query']['filter']+'%'};return _0x580ffa;})});}_0x2e88b5=_['merge']({},_0x2e88b5,_0x1693f9[_0xe58e('0x47')]);return _0x860992[_0xe58e('0x67')](_0x2e88b5);}})[_0xe58e('0x29')](function(_0x4b79da){if(_0x4b79da){_0x285dc8=_0x4b79da[_0xe58e('0x3e')];if(!_0x1693f9[_0xe58e('0x39')][_0xe58e('0x3f')](_0xe58e('0x40'))){_0x2e88b5[_0xe58e('0x21')]=qs[_0xe58e('0x21')](_0x1693f9['query']['limit']);_0x2e88b5['offset']=qs['offset'](_0x1693f9[_0xe58e('0x39')][_0xe58e('0x20')]);}return _0x860992[_0xe58e('0x67')](_0x2e88b5);}})[_0xe58e('0x29')](function(_0x152e98){if(_0x152e98){return _0x152e98?{'count':_0x285dc8,'rows':_0x152e98}:null;}})[_0xe58e('0x29')](respondWithResult(_0x2dba91,null))[_0xe58e('0x4c')](handleError(_0x2dba91,null));};exports[_0xe58e('0x69')]=function(_0x435ee4,_0x423b2a,_0x4fa05b){var _0x273147=_0x435ee4['body']['ids'];return db[_0xe58e('0x68')][_0xe58e('0x4a')]({'where':{'id':_0x273147},'attributes':['id'],'include':[{'model':db[_0xe58e('0x5e')],'as':_0xe58e('0x6a'),'attributes':['id',_0xe58e('0x31'),_0xe58e('0x6b'),_0xe58e('0x6c'),_0xe58e('0x6d')],'raw':!![]}]})[_0xe58e('0x29')](function(_0xdbdd6a){if(_0xdbdd6a){var _0x506c7c=_['flatMap'](_0xdbdd6a,function(_0x4b4d45){var _0x252554=_0x4b4d45['get']({'plain':!![]});return _0x252554['Agents'];});return db[_0xe58e('0x34')]['find']({'where':{'id':_0x435ee4[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](function(_0x436bf7){return db[_0xe58e('0x6e')][_0xe58e('0x6f')](function(_0x471dd3){return _0x436bf7[_0xe58e('0x69')](_0x273147,{'transaction':_0x471dd3})[_0xe58e('0x29')](function(){return BPromise[_0xe58e('0x70')](_0x506c7c,function(_0x4fb78e){return db[_0xe58e('0x5a')]['findOrCreate']({'where':{'UserId':_0x4fb78e['id'],'FaxQueueId':_0x435ee4[_0xe58e('0x4e')]['id']},'transaction':_0x471dd3});});})[_0xe58e('0x29')](function(){_0x506c7c[_0xe58e('0x71')](function(_0x488276){socket[_0xe58e('0x72')]('userFaxQueue:save',{'UserId':_0x488276['id'],'FaxQueueId':_0x436bf7['id']});});});});});}})['then'](respondWithStatusCode(_0x423b2a,null))['catch'](handleError(_0x423b2a,null));};exports['removeTeams']=function(_0x99e661,_0x56305a,_0x4fa9fd){return db[_0xe58e('0x68')][_0xe58e('0x4a')]({'where':{'id':_0x99e661[_0xe58e('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe58e('0x5e')],'as':_0xe58e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xe58e('0x29')](handleEntityNotFound(_0x56305a,null))[_0xe58e('0x29')](function(_0x2a07db){var _0x372d38=_[_0xe58e('0x33')](_0x2a07db,'id');var _0x5f1b6b=[];var _0x6c024e=[];var _0x2efe93=squel[_0xe58e('0x73')]();_0x2efe93[_0xe58e('0x74')](_0xe58e('0x75'))[_0xe58e('0x76')](_0xe58e('0x77'),'tq')[_0xe58e('0x78')](_0xe58e('0x79'),'ut',_0xe58e('0x7a'))[_0xe58e('0x44')](_0xe58e('0x7b'),_0x99e661[_0xe58e('0x4e')]['id']);for(var _0x246854=0x0;_0x246854<_0x2a07db[_0xe58e('0x3e')];_0x246854+=0x1){let _0x10d30d=_0x2a07db[_0x246854];for(var _0x466cf4=0x0;_0x466cf4<_0x10d30d['Agents'][_0xe58e('0x3e')];_0x466cf4+=0x1){let _0x7358a8=_0x10d30d[_0xe58e('0x6a')][_0x466cf4];var _0x5bb752=_0x2efe93[_0xe58e('0x7c')]();_0x5bb752[_0xe58e('0x44')](_0xe58e('0x7d'),_0x7358a8['id']);_0x6c024e[_0xe58e('0x7e')](db['sequelize'][_0xe58e('0x39')](_0x5bb752['toString'](),{'type':db[_0xe58e('0x6e')][_0xe58e('0x7f')][_0xe58e('0x80')]})[_0xe58e('0x29')](function(_0x2a303a){if(_0x2a303a['length']===0x1){return _0x7358a8['id'];}else{var _0x48f137=_[_0xe58e('0x81')](_[_0xe58e('0x33')](_0x2a303a,_0xe58e('0x82')),function(_0x1f72cf){return _[_0xe58e('0x83')](_0x372d38,_0x1f72cf);});if(_0x48f137){return _0x7358a8['id'];}}}));}}return BPromise[_0xe58e('0x84')](_0x6c024e)[_0xe58e('0x29')](function(_0x196f8d){_0x5f1b6b=_(_0x5f1b6b)[_0xe58e('0x85')](_0x196f8d)['compact']()[_0xe58e('0x86')]();return db[_0xe58e('0x34')]['find']({'where':{'id':_0x99e661[_0xe58e('0x4e')]['id']}})['then'](function(_0x1af2f7){return db['sequelize']['transaction'](function(_0x1caa4a){return _0x1af2f7['removeTeams'](_0x99e661['query'][_0xe58e('0x87')],{'transaction':_0x1caa4a})[_0xe58e('0x29')](function(){if(!_[_0xe58e('0x88')](_0x5f1b6b)){return _0x1af2f7[_0xe58e('0x89')](_0x5f1b6b,{'transaction':_0x1caa4a});}})[_0xe58e('0x29')](function(){_0x5f1b6b[_0xe58e('0x71')](function(_0x19d303){socket[_0xe58e('0x72')](_0xe58e('0x8a'),{'UserId':_0x19d303,'FaxQueueId':_0x1af2f7['id']});});});});});});})['then'](respondWithStatusCode(_0x56305a,null))[_0xe58e('0x4c')](handleError(_0x56305a,null));};exports['addAgents']=function(_0x46043c,_0x3db051,_0x1e4d06){return db[_0xe58e('0x34')][_0xe58e('0x4f')]({'where':{'id':_0x46043c['params']['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x3db051,null))[_0xe58e('0x29')](function(_0x4a3a3a){if(_0x4a3a3a){return _0x4a3a3a[_0xe58e('0x8b')](_0x46043c[_0xe58e('0x51')][_0xe58e('0x87')],_[_0xe58e('0x8c')](_0x46043c[_0xe58e('0x51')],[_0xe58e('0x87'),'id'])||{})['spread'](function(_0xffc190){for(var _0xabb9fc=0x0;_0xabb9fc<_0x46043c['body'][_0xe58e('0x87')]['length'];_0xabb9fc+=0x1){socket[_0xe58e('0x72')]('userFaxQueue:save',{'UserId':Number(_0x46043c[_0xe58e('0x51')][_0xe58e('0x87')][_0xabb9fc]),'FaxQueueId':Number(_0x46043c[_0xe58e('0x4e')]['id'])});}return _0xffc190;});}})[_0xe58e('0x29')](respondWithResult(_0x3db051,null))[_0xe58e('0x4c')](handleError(_0x3db051,null));};exports[_0xe58e('0x89')]=function(_0x257dc0,_0x3a40d3,_0x47d98d){return db[_0xe58e('0x34')][_0xe58e('0x4f')]({'where':{'id':_0x257dc0[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x3a40d3,null))['then'](function(_0x21b4bc){if(_0x21b4bc){return _0x21b4bc['removeAgents'](_0x257dc0[_0xe58e('0x39')][_0xe58e('0x87')])[_0xe58e('0x29')](function(){if(_[_0xe58e('0x8d')](_0x257dc0[_0xe58e('0x39')]['ids'])){for(var _0x12979c=0x0;_0x12979c<_0x257dc0[_0xe58e('0x39')][_0xe58e('0x87')][_0xe58e('0x3e')];_0x12979c+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x257dc0[_0xe58e('0x39')]['ids'][_0x12979c]),'FaxQueueId':Number(_0x257dc0[_0xe58e('0x4e')]['id'])});}}else{socket[_0xe58e('0x72')](_0xe58e('0x8a'),{'UserId':Number(_0x257dc0[_0xe58e('0x39')][_0xe58e('0x87')]),'FaxQueueId':Number(_0x257dc0['params']['id'])});}});}})[_0xe58e('0x29')](respondWithStatusCode(_0x3a40d3,null))[_0xe58e('0x4c')](handleError(_0x3a40d3,null));};exports[_0xe58e('0x8e')]=function(_0x5a7b3e,_0x1f8f9c,_0x5d0019){var _0x2ee86e={};var _0x1eefb7={};var _0x26b80d;var _0x522b1d;return db[_0xe58e('0x34')]['findOne']({'where':{'id':_0x5a7b3e[_0xe58e('0x4e')]['id']}})[_0xe58e('0x29')](handleEntityNotFound(_0x1f8f9c,null))[_0xe58e('0x29')](function(_0x18e4cd){if(_0x18e4cd){_0x26b80d=_0x18e4cd;_0x1eefb7['model']=_[_0xe58e('0x3a')](db[_0xe58e('0x5e')][_0xe58e('0x35')]);_0x1eefb7[_0xe58e('0x39')]=_[_0xe58e('0x3a')](_0x5a7b3e['query']);_0x1eefb7[_0xe58e('0x42')]=_[_0xe58e('0x3b')](_0x1eefb7[_0xe58e('0x38')],_0x1eefb7[_0xe58e('0x39')]);_0x2ee86e['attributes']=_[_0xe58e('0x3b')](_0x1eefb7['model'],qs['fields'](_0x5a7b3e[_0xe58e('0x39')][_0xe58e('0x3d')]));_0x2ee86e[_0xe58e('0x3c')]=_0x2ee86e[_0xe58e('0x3c')][_0xe58e('0x3e')]?_0x2ee86e[_0xe58e('0x3c')]:_0x1eefb7[_0xe58e('0x38')];_0x2ee86e[_0xe58e('0x5b')]=qs[_0xe58e('0x41')](_0x5a7b3e[_0xe58e('0x39')]['sort']);_0x2ee86e['where']=qs[_0xe58e('0x42')](_[_0xe58e('0x5c')](_0x5a7b3e[_0xe58e('0x39')],_0x1eefb7[_0xe58e('0x42')]));if(_0x5a7b3e[_0xe58e('0x39')]['filter']){_0x2ee86e['where']=_['merge'](_0x2ee86e[_0xe58e('0x44')],{'$or':_[_0xe58e('0x33')](_0x2ee86e[_0xe58e('0x3c')],function(_0x2db392){var _0x3e8edd={};_0x3e8edd[_0x2db392]={'$like':'%'+_0x5a7b3e['query'][_0xe58e('0x43')]+'%'};return _0x3e8edd;})});}_0x2ee86e=_['merge']({},_0x2ee86e,_0x5a7b3e[_0xe58e('0x47')]);return _0x26b80d['getAgents'](_0x2ee86e);}})[_0xe58e('0x29')](function(_0x593adb){if(_0x593adb){_0x522b1d=_0x593adb[_0xe58e('0x3e')];if(!_0x5a7b3e[_0xe58e('0x39')][_0xe58e('0x3f')](_0xe58e('0x40'))){_0x2ee86e[_0xe58e('0x21')]=qs[_0xe58e('0x21')](_0x5a7b3e[_0xe58e('0x39')][_0xe58e('0x21')]);_0x2ee86e['offset']=qs[_0xe58e('0x20')](_0x5a7b3e[_0xe58e('0x39')]['offset']);}return _0x26b80d['getAgents'](_0x2ee86e);}})[_0xe58e('0x29')](function(_0x16c2ab){if(_0x16c2ab){return _0x16c2ab?{'count':_0x522b1d,'rows':_0x16c2ab}:null;}})['then'](respondWithResult(_0x1f8f9c,null))[_0xe58e('0x4c')](handleError(_0x1f8f9c,null));}; \ No newline at end of file +var _0x6e88=['ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','merge','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','interface','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams'];(function(_0x5243ce,_0x31b461){var _0x2121f2=function(_0x1623d7){while(--_0x1623d7){_0x5243ce['push'](_0x5243ce['shift']());}};_0x2121f2(++_0x31b461);}(_0x6e88,0x1c0));var _0x86e8=function(_0x3a67d9,_0x504bbb){_0x3a67d9=_0x3a67d9-0x0;var _0x16e06a=_0x6e88[_0x3a67d9];return _0x16e06a;};'use strict';var emlformat=require(_0x86e8('0x0'));var rimraf=require(_0x86e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86e8('0x2'));var rp=require('request-promise');var moment=require(_0x86e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86e8('0x4'));var path=require(_0x86e8('0x5'));var sox=require(_0x86e8('0x6'));var csv=require('to-csv');var ejs=require(_0x86e8('0x7'));var fs=require('fs');var fs_extra=require(_0x86e8('0x8'));var _=require(_0x86e8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86e8('0xa'));var deskjs=require(_0x86e8('0xb'));var toCsv=require(_0x86e8('0xc'));var querystring=require('querystring');var Papa=require(_0x86e8('0xd'));var Redis=require(_0x86e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x86e8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86e8('0x10'));var logger=require(_0x86e8('0x11'))(_0x86e8('0x12'));var utils=require('../../config/utils');var config=require(_0x86e8('0x13'));var licenseUtil=require(_0x86e8('0x14'));var db=require(_0x86e8('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x86e8('0x16'),'port':0x18eb});var socket=require(_0x86e8('0x17'))(new Redis(config[_0x86e8('0x18')]));require(_0x86e8('0x19'))['register'](socket);function respondWithStatusCode(_0x25a895,_0x3aaf5e){_0x3aaf5e=_0x3aaf5e||0xcc;return function(_0x39c087){if(_0x39c087){return _0x25a895[_0x86e8('0x1a')](_0x3aaf5e);}return _0x25a895[_0x86e8('0x1b')](_0x3aaf5e)[_0x86e8('0x1c')]();};}function respondWithResult(_0x201584,_0x332cc3){_0x332cc3=_0x332cc3||0xc8;return function(_0x3209e2){if(_0x3209e2){return _0x201584['status'](_0x332cc3)[_0x86e8('0x1d')](_0x3209e2);}};}function respondWithFilteredResult(_0x37df27,_0x205ba5){return function(_0x25117d){if(_0x25117d){var _0x3913de=typeof _0x205ba5[_0x86e8('0x1e')]===_0x86e8('0x1f')&&typeof _0x205ba5[_0x86e8('0x20')]==='undefined';var _0x260de2=_0x25117d['count'];var _0x59a363=_0x3913de?0x0:_0x205ba5[_0x86e8('0x1e')];var _0x20cd98=_0x3913de?_0x25117d['count']:_0x205ba5[_0x86e8('0x1e')]+_0x205ba5[_0x86e8('0x20')];var _0x4c1e17;if(_0x20cd98>=_0x260de2){_0x20cd98=_0x260de2;_0x4c1e17=0xc8;}else{_0x4c1e17=0xce;}_0x37df27[_0x86e8('0x1b')](_0x4c1e17);return _0x37df27['set'](_0x86e8('0x21'),_0x59a363+'-'+_0x20cd98+'/'+_0x260de2)['json'](_0x25117d);}return null;};}function patchUpdates(_0x3b786b){return function(_0x4db279){try{jsonpatch[_0x86e8('0x22')](_0x4db279,_0x3b786b,!![]);}catch(_0x3f541d){return BPromise[_0x86e8('0x23')](_0x3f541d);}return _0x4db279[_0x86e8('0x24')]();};}function saveUpdates(_0xeacad,_0x5eed79){return function(_0x44f3c3){if(_0x44f3c3){return _0x44f3c3[_0x86e8('0x25')](_0xeacad)[_0x86e8('0x26')](function(_0x5dbe6c){return _0x5dbe6c;});}return null;};}function removeEntity(_0x16458e,_0x3e7cd4){return function(_0x193a4f){if(_0x193a4f){return _0x193a4f['destroy']()[_0x86e8('0x26')](function(){var _0x290312=_0x193a4f[_0x86e8('0x27')]({'plain':!![]});var _0x24c68b=_0x86e8('0x28');return db[_0x86e8('0x29')][_0x86e8('0x2a')]({'where':{'type':_0x24c68b,'resourceId':_0x290312['id']}})[_0x86e8('0x26')](function(){return _0x193a4f;});})[_0x86e8('0x26')](function(){_0x16458e[_0x86e8('0x1b')](0xcc)[_0x86e8('0x1c')]();});}};}function handleEntityNotFound(_0x557b41,_0x17b122){return function(_0x44ef89){if(!_0x44ef89){_0x557b41[_0x86e8('0x1a')](0x194);}return _0x44ef89;};}function handleError(_0x3106e7,_0x24f2e9){_0x24f2e9=_0x24f2e9||0x1f4;return function(_0x3f2ee9){logger[_0x86e8('0x2b')](_0x3f2ee9[_0x86e8('0x2c')]);if(_0x3f2ee9['name']){delete _0x3f2ee9['name'];}_0x3106e7['status'](_0x24f2e9)[_0x86e8('0x2d')](_0x3f2ee9);};}exports[_0x86e8('0x2e')]=function(_0x433b5a,_0x4f8b21){var _0x3a0336={},_0x2f3e08={},_0x55022a={'count':0x0,'rows':[]};var _0x44ec91=_['map'](db[_0x86e8('0x2f')][_0x86e8('0x30')],function(_0x4f0fbb){return{'name':_0x4f0fbb[_0x86e8('0x31')],'type':_0x4f0fbb[_0x86e8('0x32')][_0x86e8('0x33')]};});_0x2f3e08[_0x86e8('0x34')]=_[_0x86e8('0x35')](_0x44ec91,_0x86e8('0x36'));_0x2f3e08['query']=_['keys'](_0x433b5a[_0x86e8('0x37')]);_0x2f3e08[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x2f3e08['model'],_0x2f3e08[_0x86e8('0x37')]);_0x3a0336[_0x86e8('0x3a')]=_[_0x86e8('0x39')](_0x2f3e08['model'],qs[_0x86e8('0x3b')](_0x433b5a[_0x86e8('0x37')]['fields']));_0x3a0336[_0x86e8('0x3a')]=_0x3a0336[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0x3a0336['attributes']:_0x2f3e08[_0x86e8('0x34')];if(!_0x433b5a[_0x86e8('0x37')][_0x86e8('0x3d')](_0x86e8('0x3e'))){_0x3a0336['limit']=qs[_0x86e8('0x20')](_0x433b5a[_0x86e8('0x37')][_0x86e8('0x20')]);_0x3a0336[_0x86e8('0x1e')]=qs[_0x86e8('0x1e')](_0x433b5a[_0x86e8('0x37')]['offset']);}_0x3a0336[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x433b5a[_0x86e8('0x37')][_0x86e8('0x40')]);_0x3a0336[_0x86e8('0x41')]=qs[_0x86e8('0x38')](_[_0x86e8('0x42')](_0x433b5a['query'],_0x2f3e08[_0x86e8('0x38')]),_0x44ec91);if(_0x433b5a[_0x86e8('0x37')][_0x86e8('0x43')]){_0x3a0336[_0x86e8('0x41')]=_['merge'](_0x3a0336[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0x44ec91,function(_0x162968){if(_0x162968[_0x86e8('0x32')]!==_0x86e8('0x44')){var _0x292eed={};_0x292eed[_0x162968['name']]={'$like':'%'+_0x433b5a['query'][_0x86e8('0x43')]+'%'};return _0x292eed;}})});}_0x3a0336=_['merge']({},_0x3a0336,_0x433b5a['options']);var _0x439088={'where':_0x3a0336[_0x86e8('0x41')]};return db[_0x86e8('0x2f')][_0x86e8('0x45')](_0x439088)[_0x86e8('0x26')](function(_0x329301){_0x55022a[_0x86e8('0x45')]=_0x329301;if(_0x433b5a['query'][_0x86e8('0x46')]){_0x3a0336[_0x86e8('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0x86e8('0x48')](_0x3a0336);})[_0x86e8('0x26')](function(_0x752705){_0x55022a[_0x86e8('0x49')]=_0x752705;return _0x55022a;})[_0x86e8('0x26')](respondWithFilteredResult(_0x4f8b21,_0x3a0336))[_0x86e8('0x4a')](handleError(_0x4f8b21,null));};exports[_0x86e8('0x4b')]=function(_0x255d8a,_0x2b7467){var _0x1046fb={'raw':!![],'where':{'id':_0x255d8a[_0x86e8('0x4c')]['id']}},_0x3b0deb={};_0x3b0deb['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x2f')][_0x86e8('0x30')]);_0x3b0deb[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x255d8a[_0x86e8('0x37')]);_0x3b0deb[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x3b0deb[_0x86e8('0x34')],_0x3b0deb[_0x86e8('0x37')]);_0x1046fb[_0x86e8('0x3a')]=_['intersection'](_0x3b0deb['model'],qs[_0x86e8('0x3b')](_0x255d8a[_0x86e8('0x37')][_0x86e8('0x3b')]));_0x1046fb[_0x86e8('0x3a')]=_0x1046fb[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0x1046fb[_0x86e8('0x3a')]:_0x3b0deb['model'];if(_0x255d8a[_0x86e8('0x37')][_0x86e8('0x46')]){_0x1046fb['include']=[{'all':!![]}];}_0x1046fb=_['merge']({},_0x1046fb,_0x255d8a[_0x86e8('0x4e')]);return db[_0x86e8('0x2f')][_0x86e8('0x4f')](_0x1046fb)[_0x86e8('0x26')](handleEntityNotFound(_0x2b7467,null))[_0x86e8('0x26')](respondWithResult(_0x2b7467,null))['catch'](handleError(_0x2b7467,null));};exports[_0x86e8('0x50')]=function(_0x45aa71,_0x8e1e05){return db['FaxQueue'][_0x86e8('0x50')](_0x45aa71[_0x86e8('0x51')],{})[_0x86e8('0x26')](function(_0x1cebba){var _0x317721=_0x45aa71[_0x86e8('0x52')][_0x86e8('0x27')]({'plain':!![]});if(!_0x317721)throw new Error(_0x86e8('0x53'));if(_0x317721['role']==='user'){var _0x4db2c6=_0x1cebba['get']({'plain':!![]});var _0x21084e=_0x86e8('0x28');return db[_0x86e8('0x54')][_0x86e8('0x4f')]({'where':{'name':_0x21084e,'userProfileId':_0x317721[_0x86e8('0x55')]},'raw':!![]})[_0x86e8('0x26')](function(_0x12fa9e){if(_0x12fa9e&&_0x12fa9e[_0x86e8('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x4db2c6['name'],'resourceId':_0x4db2c6['id'],'type':_0x12fa9e[_0x86e8('0x36')],'sectionId':_0x12fa9e['id']},{})[_0x86e8('0x26')](function(){return _0x1cebba;});}else{return _0x1cebba;}})[_0x86e8('0x4a')](function(_0x199df4){logger[_0x86e8('0x2b')](_0x86e8('0x57'),_0x199df4);throw _0x199df4;});}return _0x1cebba;})[_0x86e8('0x26')](respondWithResult(_0x8e1e05,0xc9))['catch'](handleError(_0x8e1e05,null));};exports['update']=function(_0x38d4fb,_0x55aa55){if(_0x38d4fb['body']['id']){delete _0x38d4fb[_0x86e8('0x51')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x38d4fb[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x55aa55,null))[_0x86e8('0x26')](saveUpdates(_0x38d4fb[_0x86e8('0x51')],null))['then'](respondWithResult(_0x55aa55,null))[_0x86e8('0x4a')](handleError(_0x55aa55,null));};exports['destroy']=function(_0x33522a,_0x3604bf){return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x33522a['params']['id']}})['then'](handleEntityNotFound(_0x3604bf,null))[_0x86e8('0x26')](removeEntity(_0x3604bf,null))['catch'](handleError(_0x3604bf,null));};exports['describe']=function(_0x1a356e,_0x27e48d){return db[_0x86e8('0x2f')][_0x86e8('0x58')]()[_0x86e8('0x26')](respondWithResult(_0x27e48d,null))[_0x86e8('0x4a')](handleError(_0x27e48d,null));};exports[_0x86e8('0x59')]=function(_0x1831cc,_0x5a4a3a,_0x2b9704){var _0xaa942b={'raw':!![],'where':{}},_0x42bd91={},_0x565079;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x1831cc[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x5a4a3a,null))['then'](function(_0x9434c3){if(_0x9434c3){_0x565079=_0x9434c3[_0x86e8('0x27')]({'plain':!![]});_0x42bd91[_0x86e8('0x34')]=_[_0x86e8('0x4d')](db['UserFaxQueue'][_0x86e8('0x30')]);_0x42bd91[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x1831cc[_0x86e8('0x37')]);_0x42bd91[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x42bd91[_0x86e8('0x34')],_0x42bd91[_0x86e8('0x37')]);_0xaa942b[_0x86e8('0x3a')]=_[_0x86e8('0x39')](_0x42bd91[_0x86e8('0x34')],qs[_0x86e8('0x3b')](_0x1831cc[_0x86e8('0x37')][_0x86e8('0x3b')]));_0xaa942b[_0x86e8('0x3a')]=_0xaa942b['attributes']['length']?_0xaa942b['attributes']:_0x42bd91[_0x86e8('0x34')];if(!_0x1831cc[_0x86e8('0x37')]['hasOwnProperty'](_0x86e8('0x3e'))){_0xaa942b[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x1831cc[_0x86e8('0x37')][_0x86e8('0x20')]);_0xaa942b[_0x86e8('0x1e')]=qs[_0x86e8('0x1e')](_0x1831cc[_0x86e8('0x37')]['offset']);}_0xaa942b[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x1831cc[_0x86e8('0x37')]['sort']);_0xaa942b[_0x86e8('0x41')]=qs['filters'](_['pick'](_0x1831cc['query'],_0x42bd91[_0x86e8('0x38')]));_0xaa942b[_0x86e8('0x41')]['FaxQueueId']=_0x9434c3['id'];if(_0x1831cc[_0x86e8('0x37')][_0x86e8('0x43')]){_0xaa942b[_0x86e8('0x41')]=_[_0x86e8('0x5a')](_0xaa942b[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0xaa942b[_0x86e8('0x3a')],function(_0x442f6b){var _0xdbb8b9={};_0xdbb8b9[_0x442f6b]={'$like':'%'+_0x1831cc[_0x86e8('0x37')][_0x86e8('0x43')]+'%'};return _0xdbb8b9;})});}_0xaa942b=_['merge']({},_0xaa942b,_0x1831cc[_0x86e8('0x4e')]);return db[_0x86e8('0x5b')]['findAll'](_0xaa942b);}})[_0x86e8('0x26')](function(_0xee1027){if(_0xee1027){return db[_0x86e8('0x5c')][_0x86e8('0x5d')]({'where':{'id':_[_0x86e8('0x35')](_0xee1027,_0x86e8('0x5e')),'role':'agent'},'attributes':['id',_0x86e8('0x36'),_0x86e8('0x5f'),_0x86e8('0x60'),_0x86e8('0x61')]});}})['then'](function(_0x40caf0){if(_0x40caf0){return{'count':_0x40caf0[_0x86e8('0x45')],'rows':_['map'](_0x40caf0[_0x86e8('0x49')],function(_0x186342){return{'membername':_0x186342['name'],'UserId':_0x186342['id'],'queue_name':_0x565079[_0x86e8('0x36')],'FaxQueueId':_0x565079['id'],'interface':util[_0x86e8('0x62')]('%s/%s',_0x86e8('0x63'),_0x186342[_0x86e8('0x36')]),'penalty':0x0,'paused':_0x186342['faxPause'],'createdAt':_0x186342[_0x86e8('0x61')],'updatedAt':_0x186342[_0x86e8('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x86e8('0x26')](respondWithFilteredResult(_0x5a4a3a,_0xaa942b))[_0x86e8('0x4a')](handleError(_0x5a4a3a,null));};exports['getTeams']=function(_0x148001,_0x4784ef,_0x31e288){var _0x232398={};var _0x414e16={};var _0x24e6a6;var _0x4efc75;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x148001[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x4784ef,null))['then'](function(_0x5b3f44){if(_0x5b3f44){_0x24e6a6=_0x5b3f44;_0x414e16['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x64')][_0x86e8('0x30')]);_0x414e16[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x148001['query']);_0x414e16[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x414e16['model'],_0x414e16[_0x86e8('0x37')]);_0x232398['attributes']=_[_0x86e8('0x39')](_0x414e16['model'],qs[_0x86e8('0x3b')](_0x148001[_0x86e8('0x37')][_0x86e8('0x3b')]));_0x232398['attributes']=_0x232398[_0x86e8('0x3a')]['length']?_0x232398['attributes']:_0x414e16[_0x86e8('0x34')];_0x232398['order']=qs[_0x86e8('0x40')](_0x148001['query']['sort']);_0x232398[_0x86e8('0x41')]=qs['filters'](_[_0x86e8('0x42')](_0x148001[_0x86e8('0x37')],_0x414e16[_0x86e8('0x38')]));if(_0x148001[_0x86e8('0x37')][_0x86e8('0x43')]){_0x232398[_0x86e8('0x41')]=_[_0x86e8('0x5a')](_0x232398[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0x232398['attributes'],function(_0x10f1c5){var _0x501257={};_0x501257[_0x10f1c5]={'$like':'%'+_0x148001['query'][_0x86e8('0x43')]+'%'};return _0x501257;})});}_0x232398=_[_0x86e8('0x5a')]({},_0x232398,_0x148001[_0x86e8('0x4e')]);return _0x24e6a6[_0x86e8('0x65')](_0x232398);}})[_0x86e8('0x26')](function(_0x3f915e){if(_0x3f915e){_0x4efc75=_0x3f915e['length'];if(!_0x148001[_0x86e8('0x37')][_0x86e8('0x3d')]('nolimit')){_0x232398[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x148001[_0x86e8('0x37')][_0x86e8('0x20')]);_0x232398[_0x86e8('0x1e')]=qs['offset'](_0x148001[_0x86e8('0x37')]['offset']);}return _0x24e6a6['getTeams'](_0x232398);}})['then'](function(_0x39a472){if(_0x39a472){return _0x39a472?{'count':_0x4efc75,'rows':_0x39a472}:null;}})[_0x86e8('0x26')](respondWithResult(_0x4784ef,null))[_0x86e8('0x4a')](handleError(_0x4784ef,null));};exports[_0x86e8('0x66')]=function(_0x1c4378,_0x378e0f,_0xb80922){var _0x50d5f0=_0x1c4378[_0x86e8('0x51')][_0x86e8('0x67')];return db[_0x86e8('0x64')][_0x86e8('0x48')]({'where':{'id':_0x50d5f0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x86e8('0x68'),'attributes':['id',_0x86e8('0x36'),'online','voicePause',_0x86e8('0x69')],'raw':!![]}]})[_0x86e8('0x26')](function(_0x416fc2){if(_0x416fc2){var _0x38ed35=_['flatMap'](_0x416fc2,function(_0x2b7f61){var _0x38cfc2=_0x2b7f61[_0x86e8('0x27')]({'plain':!![]});return _0x38cfc2['Agents'];});return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x1c4378[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](function(_0x5def7e){return db[_0x86e8('0x6a')]['transaction'](function(_0x3e88ef){return _0x5def7e[_0x86e8('0x66')](_0x50d5f0,{'transaction':_0x3e88ef})[_0x86e8('0x26')](function(){return BPromise[_0x86e8('0x6b')](_0x38ed35,function(_0x18a10d){return db[_0x86e8('0x5b')][_0x86e8('0x6c')]({'where':{'UserId':_0x18a10d['id'],'FaxQueueId':_0x1c4378[_0x86e8('0x4c')]['id']},'transaction':_0x3e88ef});});})['then'](function(){_0x38ed35[_0x86e8('0x6d')](function(_0x1a144f){socket[_0x86e8('0x6e')](_0x86e8('0x6f'),{'UserId':_0x1a144f['id'],'FaxQueueId':_0x5def7e['id']});});});});});}})[_0x86e8('0x26')](respondWithStatusCode(_0x378e0f,null))['catch'](handleError(_0x378e0f,null));};exports[_0x86e8('0x70')]=function(_0x5a1d54,_0x194ddc,_0x2a492f){return db[_0x86e8('0x64')][_0x86e8('0x48')]({'where':{'id':_0x5a1d54[_0x86e8('0x37')][_0x86e8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x86e8('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x194ddc,null))[_0x86e8('0x26')](function(_0x186c1c){var _0x30bba2=_['map'](_0x186c1c,'id');var _0x57f9f2=[];var _0x478bbe=[];var _0x218485=squel[_0x86e8('0x71')]();_0x218485[_0x86e8('0x72')](_0x86e8('0x73'))[_0x86e8('0x74')](_0x86e8('0x75'),'tq')[_0x86e8('0x76')](_0x86e8('0x77'),'ut',_0x86e8('0x78'))[_0x86e8('0x41')](_0x86e8('0x79'),_0x5a1d54[_0x86e8('0x4c')]['id']);for(var _0x284c71=0x0;_0x284c71<_0x186c1c[_0x86e8('0x3c')];_0x284c71+=0x1){let _0x593370=_0x186c1c[_0x284c71];for(var _0x7850dd=0x0;_0x7850dd<_0x593370[_0x86e8('0x68')][_0x86e8('0x3c')];_0x7850dd+=0x1){let _0x500b5d=_0x593370[_0x86e8('0x68')][_0x7850dd];var _0x3c180f=_0x218485['clone']();_0x3c180f[_0x86e8('0x41')](_0x86e8('0x7a'),_0x500b5d['id']);_0x478bbe[_0x86e8('0x7b')](db['sequelize'][_0x86e8('0x37')](_0x3c180f[_0x86e8('0x7c')](),{'type':db[_0x86e8('0x6a')][_0x86e8('0x7d')][_0x86e8('0x7e')]})[_0x86e8('0x26')](function(_0x1dbfbd){if(_0x1dbfbd[_0x86e8('0x3c')]===0x1){return _0x500b5d['id'];}else{var _0x26a7fd=_[_0x86e8('0x7f')](_[_0x86e8('0x35')](_0x1dbfbd,_0x86e8('0x80')),function(_0x2a18a8){return _[_0x86e8('0x81')](_0x30bba2,_0x2a18a8);});if(_0x26a7fd){return _0x500b5d['id'];}}}));}}return BPromise[_0x86e8('0x82')](_0x478bbe)[_0x86e8('0x26')](function(_0x5a9863){_0x57f9f2=_(_0x57f9f2)[_0x86e8('0x83')](_0x5a9863)[_0x86e8('0x84')]()[_0x86e8('0x85')]();return db[_0x86e8('0x2f')]['find']({'where':{'id':_0x5a1d54[_0x86e8('0x4c')]['id']}})['then'](function(_0x4fe971){return db['sequelize']['transaction'](function(_0x52af6c){return _0x4fe971['removeTeams'](_0x5a1d54[_0x86e8('0x37')][_0x86e8('0x67')],{'transaction':_0x52af6c})['then'](function(){if(!_[_0x86e8('0x86')](_0x57f9f2)){return _0x4fe971['removeAgents'](_0x57f9f2,{'transaction':_0x52af6c});}})[_0x86e8('0x26')](function(){_0x57f9f2[_0x86e8('0x6d')](function(_0x5e0c85){socket[_0x86e8('0x6e')](_0x86e8('0x87'),{'UserId':_0x5e0c85,'FaxQueueId':_0x4fe971['id']});});});});});});})[_0x86e8('0x26')](respondWithStatusCode(_0x194ddc,null))[_0x86e8('0x4a')](handleError(_0x194ddc,null));};exports[_0x86e8('0x88')]=function(_0x5dfe63,_0xffe9ef,_0x428de4){return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x5dfe63[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0xffe9ef,null))['then'](function(_0x157e96){if(_0x157e96){return _0x157e96['addAgents'](_0x5dfe63[_0x86e8('0x51')][_0x86e8('0x67')],_[_0x86e8('0x89')](_0x5dfe63[_0x86e8('0x51')],[_0x86e8('0x67'),'id'])||{})[_0x86e8('0x8a')](function(_0x15bafc){for(var _0x533b2b=0x0;_0x533b2b<_0x5dfe63[_0x86e8('0x51')]['ids'][_0x86e8('0x3c')];_0x533b2b+=0x1){socket[_0x86e8('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x5dfe63['body'][_0x86e8('0x67')][_0x533b2b]),'FaxQueueId':Number(_0x5dfe63[_0x86e8('0x4c')]['id'])});}return _0x15bafc;});}})[_0x86e8('0x26')](respondWithResult(_0xffe9ef,null))[_0x86e8('0x4a')](handleError(_0xffe9ef,null));};exports['removeAgents']=function(_0x280fba,_0xd6c361,_0x129c2e){return db[_0x86e8('0x2f')]['find']({'where':{'id':_0x280fba[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0xd6c361,null))[_0x86e8('0x26')](function(_0x4aa1f3){if(_0x4aa1f3){return _0x4aa1f3[_0x86e8('0x8b')](_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')])['then'](function(){if(_[_0x86e8('0x8c')](_0x280fba['query'][_0x86e8('0x67')])){for(var _0x1e83e2=0x0;_0x1e83e2<_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')][_0x86e8('0x3c')];_0x1e83e2+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x280fba['query'][_0x86e8('0x67')][_0x1e83e2]),'FaxQueueId':Number(_0x280fba[_0x86e8('0x4c')]['id'])});}}else{socket['emit'](_0x86e8('0x87'),{'UserId':Number(_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')]),'FaxQueueId':Number(_0x280fba[_0x86e8('0x4c')]['id'])});}});}})[_0x86e8('0x26')](respondWithStatusCode(_0xd6c361,null))[_0x86e8('0x4a')](handleError(_0xd6c361,null));};exports['getAgents']=function(_0x245f2b,_0x1af080,_0x170880){var _0xa8475d={};var _0x184047={};var _0xa56867;var _0x5b6696;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x245f2b['params']['id']}})['then'](handleEntityNotFound(_0x1af080,null))['then'](function(_0x1ca71a){if(_0x1ca71a){_0xa56867=_0x1ca71a;_0x184047['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x5c')][_0x86e8('0x30')]);_0x184047[_0x86e8('0x37')]=_['keys'](_0x245f2b[_0x86e8('0x37')]);_0x184047[_0x86e8('0x38')]=_['intersection'](_0x184047[_0x86e8('0x34')],_0x184047['query']);_0xa8475d['attributes']=_[_0x86e8('0x39')](_0x184047[_0x86e8('0x34')],qs['fields'](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x3b')]));_0xa8475d[_0x86e8('0x3a')]=_0xa8475d[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0xa8475d[_0x86e8('0x3a')]:_0x184047[_0x86e8('0x34')];_0xa8475d[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x40')]);_0xa8475d['where']=qs['filters'](_[_0x86e8('0x42')](_0x245f2b[_0x86e8('0x37')],_0x184047['filters']));if(_0x245f2b['query'][_0x86e8('0x43')]){_0xa8475d['where']=_[_0x86e8('0x5a')](_0xa8475d[_0x86e8('0x41')],{'$or':_['map'](_0xa8475d[_0x86e8('0x3a')],function(_0x457192){var _0x3490b0={};_0x3490b0[_0x457192]={'$like':'%'+_0x245f2b[_0x86e8('0x37')][_0x86e8('0x43')]+'%'};return _0x3490b0;})});}_0xa8475d=_['merge']({},_0xa8475d,_0x245f2b[_0x86e8('0x4e')]);return _0xa56867['getAgents'](_0xa8475d);}})['then'](function(_0x2d37fc){if(_0x2d37fc){_0x5b6696=_0x2d37fc[_0x86e8('0x3c')];if(!_0x245f2b[_0x86e8('0x37')][_0x86e8('0x3d')]('nolimit')){_0xa8475d[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x20')]);_0xa8475d['offset']=qs['offset'](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x1e')]);}return _0xa56867[_0x86e8('0x8d')](_0xa8475d);}})[_0x86e8('0x26')](function(_0x9148fe){if(_0x9148fe){return _0x9148fe?{'count':_0x5b6696,'rows':_0x9148fe}:null;}})[_0x86e8('0x26')](respondWithResult(_0x1af080,null))[_0x86e8('0x4a')](handleError(_0x1af080,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7395aec..5eb882b 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 _0x797c=['remove','emit','hasOwnProperty','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x2c2b0f,_0x12cffb){var _0x2ae04d=function(_0x192655){while(--_0x192655){_0x2c2b0f['push'](_0x2c2b0f['shift']());}};_0x2ae04d(++_0x12cffb);}(_0x797c,0x1cb));var _0xc797=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x797c[_0x4bcf38];return _0x4a89be;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xc797('0x0'))['db'][_0xc797('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc797('0x2')](0x0);var events={'afterCreate':_0xc797('0x3'),'afterUpdate':_0xc797('0x4'),'afterDestroy':_0xc797('0x5')};function emitEvent(_0x5d4cab){return function(_0x495de2,_0x1c8365,_0xa813ba){FaxQueueEvents['emit'](_0x5d4cab+':'+_0x495de2['id'],_0x495de2);FaxQueueEvents[_0xc797('0x6')](_0x5d4cab,_0x495de2);_0xa813ba(null);};}for(var e in events){if(events[_0xc797('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xf2a0=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0xf2a0,0x126));var _0x0f2a=function(_0x3e1a10,_0x6aeaf2){_0x3e1a10=_0x3e1a10-0x0;var _0x2fb8ee=_0xf2a0[_0x3e1a10];return _0x2fb8ee;};'use strict';var EventEmitter=require(_0x0f2a('0x0'));var FaxQueue=require(_0x0f2a('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0f2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0f2a('0x3')};function emitEvent(_0x11ae4f){return function(_0x471f75,_0x3f3b67,_0x5c3b99){FaxQueueEvents[_0x0f2a('0x4')](_0x11ae4f+':'+_0x471f75['id'],_0x471f75);FaxQueueEvents['emit'](_0x11ae4f,_0x471f75);_0x5c3b99(null);};}for(var e in events){if(events[_0x0f2a('0x5')](e)){var event=events[e];FaxQueue[_0x0f2a('0x6')](e,emitEvent(event));}}module[_0x0f2a('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1554f21..43fa3b5 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 _0xb405=['../../config/environment','exports','define','FaxQueue','fax_queues','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20262e,_0xcfb4fe){var _0x3ed371=function(_0x31687f){while(--_0x31687f){_0x20262e['push'](_0x20262e['shift']());}};_0x3ed371(++_0xcfb4fe);}(_0xb405,0x144));var _0x5b40=function(_0x5aa508,_0x42734d){_0x5aa508=_0x5aa508-0x0;var _0x17c015=_0xb405[_0x5aa508];return _0x17c015;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5b40('0x0'))(_0x5b40('0x1'));var moment=require(_0x5b40('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b40('0x3'));var fs=require('fs');var path=require(_0x5b40('0x4'));var rimraf=require(_0x5b40('0x5'));var config=require(_0x5b40('0x6'));var attributes=require('./faxQueue.attributes');module[_0x5b40('0x7')]=function(_0x4d8d83,_0x1e9e8b){return _0x4d8d83[_0x5b40('0x8')](_0x5b40('0x9'),attributes,{'tableName':_0x5b40('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe586=['api','moment','bluebird','request-promise','path','rimraf','exports','define','lodash','util'];(function(_0x4282aa,_0xe66504){var _0x5085f0=function(_0x73b59e){while(--_0x73b59e){_0x4282aa['push'](_0x4282aa['shift']());}};_0x5085f0(++_0xe66504);}(_0xe586,0xb2));var _0x6e58=function(_0x214994,_0x26ac5f){_0x214994=_0x214994-0x0;var _0x23be80=_0xe586[_0x214994];return _0x23be80;};'use strict';var _=require(_0x6e58('0x0'));var util=require(_0x6e58('0x1'));var logger=require('../../config/logger')(_0x6e58('0x2'));var moment=require(_0x6e58('0x3'));var BPromise=require(_0x6e58('0x4'));var rp=require(_0x6e58('0x5'));var fs=require('fs');var path=require(_0x6e58('0x6'));var rimraf=require(_0x6e58('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x6e58('0x8')]=function(_0x48be10,_0x4abe5e){return _0x48be10[_0x6e58('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ba3d629..ab6c46a 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 _0xdaec=['http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','where','limit','include','model','attributes','map','FaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x483cbe,_0x1832da){var _0x191c71=function(_0x2f812f){while(--_0x2f812f){_0x483cbe['push'](_0x483cbe['shift']());}};_0x191c71(++_0x1832da);}(_0xdaec,0x73));var _0xcdae=function(_0x48910d,_0xe8d0e1){_0x48910d=_0x48910d-0x0;var _0x1b4c22=_0xdaec[_0x48910d];return _0x1b4c22;};'use strict';var _=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var moment=require(_0xcdae('0x2'));var BPromise=require(_0xcdae('0x3'));var rs=require(_0xcdae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdae('0x5'))['db'];var utils=require(_0xcdae('0x6'));var logger=require('../../config/logger')(_0xcdae('0x7'));var config=require(_0xcdae('0x8'));var jayson=require(_0xcdae('0x9'));var client=jayson[_0xcdae('0xa')][_0xcdae('0xb')]({'port':0x232a});config[_0xcdae('0xc')]=_['defaults'](config[_0xcdae('0xc')],{'host':_0xcdae('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdae('0xc')]));require(_0xcdae('0xe'))[_0xcdae('0xf')](socket);function respondWithRpcPromise(_0x100575,_0x1fc1dd,_0x119b65){return new BPromise(function(_0x4787ac,_0x4ac9f2){return client[_0xcdae('0x10')](_0x100575,_0x119b65)[_0xcdae('0x11')](function(_0x13ebe3){logger[_0xcdae('0x12')](_0xcdae('0x13'),_0x1fc1dd,_0xcdae('0x14'));logger[_0xcdae('0x15')](_0xcdae('0x16'),_0x1fc1dd,_0xcdae('0x14'),JSON[_0xcdae('0x17')](_0x13ebe3));if(_0x13ebe3[_0xcdae('0x18')]){if(_0x13ebe3[_0xcdae('0x18')][_0xcdae('0x19')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x1fc1dd,_0x13ebe3[_0xcdae('0x18')][_0xcdae('0x1a')]);return _0x4ac9f2(_0x13ebe3[_0xcdae('0x18')][_0xcdae('0x1a')]);}logger['error'](_0xcdae('0x13'),_0x1fc1dd,_0x13ebe3[_0xcdae('0x18')][_0xcdae('0x1a')]);return _0x4787ac(_0x13ebe3[_0xcdae('0x18')]['message']);}else{logger[_0xcdae('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1fc1dd,_0xcdae('0x14'));_0x4787ac(_0x13ebe3[_0xcdae('0x1b')]['message']);}})[_0xcdae('0x1c')](function(_0x595b2a){logger[_0xcdae('0x18')](_0xcdae('0x13'),_0x1fc1dd,_0x595b2a);_0x4ac9f2(_0x595b2a);});});}exports[_0xcdae('0x1d')]=function(_0x59dba6){var _0x5966d2=this;return new Promise(function(_0x5cc917,_0x86c65){return db['FaxQueue'][_0xcdae('0x1e')]({'raw':_0x59dba6['options']?_0x59dba6[_0xcdae('0x1f')][_0xcdae('0x20')]===undefined?!![]:![]:!![],'where':_0x59dba6[_0xcdae('0x1f')]?_0x59dba6[_0xcdae('0x1f')][_0xcdae('0x21')]||null:null,'attributes':_0x59dba6['options']?_0x59dba6[_0xcdae('0x1f')]['attributes']||null:null,'limit':_0x59dba6[_0xcdae('0x1f')]?_0x59dba6[_0xcdae('0x1f')][_0xcdae('0x22')]||null:null,'include':_0x59dba6[_0xcdae('0x1f')]?_0x59dba6[_0xcdae('0x1f')]['include']?_['map'](_0x59dba6[_0xcdae('0x1f')][_0xcdae('0x23')],function(_0x58262f){return{'model':db[_0x58262f[_0xcdae('0x24')]],'as':_0x58262f['as'],'attributes':_0x58262f[_0xcdae('0x25')],'include':_0x58262f['include']?_[_0xcdae('0x26')](_0x58262f['include'],function(_0xe02d5d){return{'model':db[_0xe02d5d[_0xcdae('0x24')]],'as':_0xe02d5d['as'],'attributes':_0xe02d5d[_0xcdae('0x25')],'include':_0xe02d5d[_0xcdae('0x23')]?_[_0xcdae('0x26')](_0xe02d5d['include'],function(_0x58784d){return{'model':db[_0x58784d[_0xcdae('0x24')]],'as':_0x58784d['as'],'attributes':_0x58784d[_0xcdae('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37f6b0){logger[_0xcdae('0x12')](_0xcdae('0x1d'),_0x59dba6);logger[_0xcdae('0x15')](_0xcdae('0x1d'),_0x59dba6,JSON['stringify'](_0x37f6b0));_0x5cc917(_0x37f6b0);})[_0xcdae('0x1c')](function(_0x147763){logger[_0xcdae('0x18')](_0xcdae('0x1d'),_0x147763[_0xcdae('0x1a')],_0x59dba6);_0x86c65(_0x5966d2[_0xcdae('0x18')](0x1f4,_0x147763[_0xcdae('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x29eaa0){var _0x43dd38=this;return new Promise(function(_0x507c8d,_0x3ef26a){return db[_0xcdae('0x27')][_0xcdae('0x28')]({'raw':_0x29eaa0[_0xcdae('0x1f')]?_0x29eaa0[_0xcdae('0x1f')][_0xcdae('0x20')]===undefined?!![]:![]:!![],'where':_0x29eaa0[_0xcdae('0x1f')]?_0x29eaa0[_0xcdae('0x1f')][_0xcdae('0x21')]||null:null,'attributes':_0x29eaa0[_0xcdae('0x1f')]?_0x29eaa0[_0xcdae('0x1f')][_0xcdae('0x25')]||null:null,'include':_0x29eaa0[_0xcdae('0x1f')]?_0x29eaa0['options'][_0xcdae('0x23')]?_['map'](_0x29eaa0[_0xcdae('0x1f')][_0xcdae('0x23')],function(_0x37145b){return{'model':db[_0x37145b['model']],'as':_0x37145b['as'],'attributes':_0x37145b['attributes'],'include':_0x37145b[_0xcdae('0x23')]?_[_0xcdae('0x26')](_0x37145b[_0xcdae('0x23')],function(_0xa3201a){return{'model':db[_0xa3201a[_0xcdae('0x24')]],'as':_0xa3201a['as'],'attributes':_0xa3201a[_0xcdae('0x25')],'include':_0xa3201a[_0xcdae('0x23')]?_['map'](_0xa3201a[_0xcdae('0x23')],function(_0x506b9d){return{'model':db[_0x506b9d[_0xcdae('0x24')]],'as':_0x506b9d['as'],'attributes':_0x506b9d[_0xcdae('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cecdf){logger[_0xcdae('0x12')](_0xcdae('0x29'),_0x29eaa0);logger[_0xcdae('0x15')]('ShowFaxQueue',_0x29eaa0,JSON[_0xcdae('0x17')](_0x5cecdf));_0x507c8d(_0x5cecdf);})[_0xcdae('0x1c')](function(_0x34c74a){logger[_0xcdae('0x18')](_0xcdae('0x29'),_0x34c74a[_0xcdae('0x1a')],_0x29eaa0);_0x3ef26a(_0x43dd38[_0xcdae('0x18')](0x1f4,_0x34c74a['message']));});});}; \ No newline at end of file +var _0xaf27=['request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','map','include','model','info','stringify','find','raw','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaf27,0x6e));var _0x7af2=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xaf27[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require(_0x7af2('0x0'));var util=require(_0x7af2('0x1'));var moment=require(_0x7af2('0x2'));var BPromise=require(_0x7af2('0x3'));var rs=require(_0x7af2('0x4'));var fs=require('fs');var Redis=require(_0x7af2('0x5'));var db=require(_0x7af2('0x6'))['db'];var utils=require(_0x7af2('0x7'));var logger=require(_0x7af2('0x8'))(_0x7af2('0x9'));var config=require(_0x7af2('0xa'));var jayson=require(_0x7af2('0xb'));var client=jayson[_0x7af2('0xc')][_0x7af2('0xd')]({'port':0x232a});config['redis']=_[_0x7af2('0xe')](config[_0x7af2('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x7af2('0x10'))(new Redis(config[_0x7af2('0xf')]));require(_0x7af2('0x11'))[_0x7af2('0x12')](socket);function respondWithRpcPromise(_0x334445,_0x49b2e8,_0x4571da){return new BPromise(function(_0x351c05,_0x15295b){return client[_0x7af2('0x13')](_0x334445,_0x4571da)[_0x7af2('0x14')](function(_0x2af75c){logger['info'](_0x7af2('0x15'),_0x49b2e8,_0x7af2('0x16'));logger[_0x7af2('0x17')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x49b2e8,_0x7af2('0x16'),JSON['stringify'](_0x2af75c));if(_0x2af75c[_0x7af2('0x18')]){if(_0x2af75c[_0x7af2('0x18')][_0x7af2('0x19')]===0x1f4){logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x2af75c[_0x7af2('0x18')][_0x7af2('0x1a')]);return _0x15295b(_0x2af75c[_0x7af2('0x18')][_0x7af2('0x1a')]);}logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x2af75c['error']['message']);return _0x351c05(_0x2af75c['error'][_0x7af2('0x1a')]);}else{logger['info'](_0x7af2('0x15'),_0x49b2e8,'request\x20sent');_0x351c05(_0x2af75c[_0x7af2('0x1b')][_0x7af2('0x1a')]);}})[_0x7af2('0x1c')](function(_0x5ca9a4){logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x5ca9a4);_0x15295b(_0x5ca9a4);});});}exports[_0x7af2('0x1d')]=function(_0x5199a4){var _0x14d8f0=this;return new Promise(function(_0x42494e,_0x52307a){return db[_0x7af2('0x1e')][_0x7af2('0x1f')]({'raw':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options'][_0x7af2('0x21')]||null:null,'attributes':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options'][_0x7af2('0x22')]||null:null,'limit':_0x5199a4['options']?_0x5199a4[_0x7af2('0x20')]['limit']||null:null,'include':_0x5199a4['options']?_0x5199a4[_0x7af2('0x20')]['include']?_[_0x7af2('0x23')](_0x5199a4[_0x7af2('0x20')][_0x7af2('0x24')],function(_0x1a3684){return{'model':db[_0x1a3684['model']],'as':_0x1a3684['as'],'attributes':_0x1a3684[_0x7af2('0x22')],'include':_0x1a3684[_0x7af2('0x24')]?_[_0x7af2('0x23')](_0x1a3684['include'],function(_0x59b493){return{'model':db[_0x59b493[_0x7af2('0x25')]],'as':_0x59b493['as'],'attributes':_0x59b493[_0x7af2('0x22')],'include':_0x59b493[_0x7af2('0x24')]?_[_0x7af2('0x23')](_0x59b493[_0x7af2('0x24')],function(_0x5a46bb){return{'model':db[_0x5a46bb['model']],'as':_0x5a46bb['as'],'attributes':_0x5a46bb[_0x7af2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7af2('0x14')](function(_0x49fc4a){logger[_0x7af2('0x26')]('GetFaxQueue',_0x5199a4);logger[_0x7af2('0x17')]('GetFaxQueue',_0x5199a4,JSON[_0x7af2('0x27')](_0x49fc4a));_0x42494e(_0x49fc4a);})[_0x7af2('0x1c')](function(_0x4f3028){logger[_0x7af2('0x18')](_0x7af2('0x1d'),_0x4f3028[_0x7af2('0x1a')],_0x5199a4);_0x52307a(_0x14d8f0[_0x7af2('0x18')](0x1f4,_0x4f3028[_0x7af2('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x5b88ca){var _0x1728b0=this;return new Promise(function(_0x5a6d33,_0x83bfae){return db[_0x7af2('0x1e')][_0x7af2('0x28')]({'raw':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x29')]===undefined?!![]:![]:!![],'where':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x21')]||null:null,'attributes':_0x5b88ca['options']?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x22')]||null:null,'include':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')]['include']?_[_0x7af2('0x23')](_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x24')],function(_0x19f058){return{'model':db[_0x19f058[_0x7af2('0x25')]],'as':_0x19f058['as'],'attributes':_0x19f058[_0x7af2('0x22')],'include':_0x19f058[_0x7af2('0x24')]?_['map'](_0x19f058[_0x7af2('0x24')],function(_0x33b989){return{'model':db[_0x33b989[_0x7af2('0x25')]],'as':_0x33b989['as'],'attributes':_0x33b989[_0x7af2('0x22')],'include':_0x33b989['include']?_[_0x7af2('0x23')](_0x33b989['include'],function(_0x13eee8){return{'model':db[_0x13eee8[_0x7af2('0x25')]],'as':_0x13eee8['as'],'attributes':_0x13eee8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ab15){logger[_0x7af2('0x26')](_0x7af2('0x2a'),_0x5b88ca);logger[_0x7af2('0x17')](_0x7af2('0x2a'),_0x5b88ca,JSON[_0x7af2('0x27')](_0x19ab15));_0x5a6d33(_0x19ab15);})[_0x7af2('0x1c')](function(_0x8c3c5){logger['error'](_0x7af2('0x2a'),_0x8c3c5[_0x7af2('0x1a')],_0x5b88ca);_0x83bfae(_0x1728b0[_0x7af2('0x18')](0x1f4,_0x8c3c5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1931665..9fe2368 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 _0x6a88=['faxQueue:','./faxQueue.events','save','remove','update','register'];(function(_0xc628cc,_0x34f60e){var _0x20bce0=function(_0x276e08){while(--_0x276e08){_0xc628cc['push'](_0xc628cc['shift']());}};_0x20bce0(++_0x34f60e);}(_0x6a88,0xa9));var _0x86a8=function(_0x5ab6a5,_0x4977b1){_0x5ab6a5=_0x5ab6a5-0x0;var _0x3cb85c=_0x6a88[_0x5ab6a5];return _0x3cb85c;};'use strict';var FaxQueueEvents=require(_0x86a8('0x0'));var events=[_0x86a8('0x1'),_0x86a8('0x2'),_0x86a8('0x3')];function createListener(_0x69237e,_0x77fa60){return function(_0x1f00e4){_0x77fa60['emit'](_0x69237e,_0x1f00e4);};}function removeListener(_0x21afeb,_0x5aa681){return function(){FaxQueueEvents['removeListener'](_0x21afeb,_0x5aa681);};}exports[_0x86a8('0x4')]=function(_0x29a32a){for(var _0x4b4eb7=0x0,_0x3726f0=events['length'];_0x4b4eb7<_0x3726f0;_0x4b4eb7++){var _0x47bc1e=events[_0x4b4eb7];var _0xc5e910=createListener(_0x86a8('0x5')+_0x47bc1e,_0x29a32a);FaxQueueEvents['on'](_0x47bc1e,_0xc5e910);}}; \ No newline at end of file +var _0xf8db=['emit','removeListener','register','./faxQueue.events','remove','update'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xf8db,0x16b));var _0xbf8d=function(_0x40d897,_0x1ebe61){_0x40d897=_0x40d897-0x0;var _0x361118=_0xf8db[_0x40d897];return _0x361118;};'use strict';var FaxQueueEvents=require(_0xbf8d('0x0'));var events=['save',_0xbf8d('0x1'),_0xbf8d('0x2')];function createListener(_0xfb4d27,_0x202b30){return function(_0xc6e9d6){_0x202b30[_0xbf8d('0x3')](_0xfb4d27,_0xc6e9d6);};}function removeListener(_0x4a0446,_0x8c17d1){return function(){FaxQueueEvents[_0xbf8d('0x4')](_0x4a0446,_0x8c17d1);};}exports[_0xbf8d('0x5')]=function(_0x44c765){for(var _0x288269=0x0,_0x12f40d=events['length'];_0x288269<_0x12f40d;_0x288269++){var _0x3b5a99=events[_0x288269];var _0x4f9a83=createListener('faxQueue:'+_0x3b5a99,_0x44c765);FaxQueueEvents['on'](_0x3b5a99,_0x4f9a83);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 00234bd..26c68cd 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 _0x2a07=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated'];(function(_0x33ef9d,_0x5e6403){var _0x4dc253=function(_0x4f4a2b){while(--_0x4f4a2b){_0x33ef9d['push'](_0x33ef9d['shift']());}};_0x4dc253(++_0x5e6403);}(_0x2a07,0x74));var _0x72a0=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0x2a07[_0x5528c3];return _0x47ec1b;};'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['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getMembers']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0x15')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x15')](_0x72a0('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x72a0('0x15')](_0x72a0('0x17'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x19')](_0x72a0('0xf'),auth['isAuthenticated'](),controller[_0x72a0('0x1a')]);router[_0x72a0('0x1b')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['delete'](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1d')]);router['delete'](_0x72a0('0x17'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1e')]);module[_0x72a0('0x1f')]=router; \ No newline at end of file +var _0x741c=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1e0522,_0x2a41fa){var _0x2608cf=function(_0x3f855a){while(--_0x3f855a){_0x1e0522['push'](_0x1e0522['shift']());}};_0x2608cf(++_0x2a41fa);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['get']('/:id/members',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0x8')](_0xc741('0xf'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc741('0x11')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0x12')]);router[_0xc741('0x11')](_0xc741('0xf'),auth['isAuthenticated'](),controller[_0xc741('0x13')]);router[_0xc741('0x11')]('/:id/users',auth[_0xc741('0x9')](),controller[_0xc741('0x14')]);router[_0xc741('0x15')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller['update']);router['delete'](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0x16')]);router[_0xc741('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc741('0x18')]);router[_0xc741('0x17')](_0xc741('0x19'),auth['isAuthenticated'](),controller[_0xc741('0x1a')]);module[_0xc741('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 95eb018..567a838 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 _0x2f91=['exports','STRING','DATE','moment','sequelize'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2f91,0x1b6));var _0x12f9=function(_0x19835d,_0xead51){_0x19835d=_0x19835d-0x0;var _0x4e117c=_0x2f91[_0x19835d];return _0x4e117c;};'use strict';var moment=require(_0x12f9('0x0'));var Sequelize=require(_0x12f9('0x1'));module[_0x12f9('0x2')]={'uniqueid':{'type':Sequelize[_0x12f9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x12f9('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x12f9('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd3c=['sequelize','exports','STRING','DATE'];(function(_0x542dad,_0x358935){var _0x1e1488=function(_0x106f7b){while(--_0x106f7b){_0x542dad['push'](_0x542dad['shift']());}};_0x1e1488(++_0x358935);}(_0xbd3c,0x184));var _0xcbd3=function(_0x1b50cb,_0x3fcc5b){_0x1b50cb=_0x1b50cb-0x0;var _0x39ce00=_0xbd3c[_0x1b50cb];return _0x39ce00;};'use strict';var moment=require('moment');var Sequelize=require(_0xcbd3('0x0'));module[_0xcbd3('0x1')]={'uniqueid':{'type':Sequelize[_0xcbd3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcbd3('0x2')]},'joinAt':{'type':Sequelize[_0xcbd3('0x3')]},'leaveAt':{'type':Sequelize[_0xcbd3('0x3')]},'acceptAt':{'type':Sequelize[_0xcbd3('0x3')]},'exitAt':{'type':Sequelize[_0xcbd3('0x3')]},'reason':{'type':Sequelize[_0xcbd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 70f2569..e774d74 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 _0xcabc=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FaxQueueReport','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0xcabc,0x16a));var _0xccab=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcabc[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccab('0x0'));var zipdir=require(_0xccab('0x1'));var jsonpatch=require(_0xccab('0x2'));var rp=require(_0xccab('0x3'));var moment=require(_0xccab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccab('0x5'));var util=require(_0xccab('0x6'));var path=require('path');var sox=require(_0xccab('0x7'));var csv=require(_0xccab('0x8'));var ejs=require(_0xccab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccab('0xa'));var squel=require(_0xccab('0xb'));var crypto=require(_0xccab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xccab('0xd'));var toCsv=require(_0xccab('0x8'));var querystring=require('querystring');var Papa=require(_0xccab('0xe'));var Redis=require(_0xccab('0xf'));var authService=require(_0xccab('0x10'));var qs=require(_0xccab('0x11'));var as=require(_0xccab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xccab('0x13'));var utils=require(_0xccab('0x14'));var config=require(_0xccab('0x15'));var licenseUtil=require(_0xccab('0x16'));var db=require(_0xccab('0x17'))['db'];function respondWithStatusCode(_0x16f7d7,_0xe41548){_0xe41548=_0xe41548||0xcc;return function(_0x5a70ab){if(_0x5a70ab){return _0x16f7d7[_0xccab('0x18')](_0xe41548);}return _0x16f7d7[_0xccab('0x19')](_0xe41548)['end']();};}function respondWithResult(_0x3ad5c6,_0x4f0643){_0x4f0643=_0x4f0643||0xc8;return function(_0x55c22c){if(_0x55c22c){return _0x3ad5c6[_0xccab('0x19')](_0x4f0643)[_0xccab('0x1a')](_0x55c22c);}};}function respondWithFilteredResult(_0x2b571b,_0x48b567){return function(_0x3c3be9){if(_0x3c3be9){var _0x45bdec=typeof _0x48b567['offset']===_0xccab('0x1b')&&typeof _0x48b567[_0xccab('0x1c')]===_0xccab('0x1b');var _0x2aace1=_0x3c3be9[_0xccab('0x1d')];var _0x5157c6=_0x45bdec?0x0:_0x48b567['offset'];var _0x1960e7=_0x45bdec?_0x3c3be9['count']:_0x48b567[_0xccab('0x1e')]+_0x48b567[_0xccab('0x1c')];var _0x10c8fc;if(_0x1960e7>=_0x2aace1){_0x1960e7=_0x2aace1;_0x10c8fc=0xc8;}else{_0x10c8fc=0xce;}_0x2b571b['status'](_0x10c8fc);return _0x2b571b['set'](_0xccab('0x1f'),_0x5157c6+'-'+_0x1960e7+'/'+_0x2aace1)[_0xccab('0x1a')](_0x3c3be9);}return null;};}function patchUpdates(_0x459090){return function(_0x4bd8d4){try{jsonpatch[_0xccab('0x20')](_0x4bd8d4,_0x459090,!![]);}catch(_0x51a221){return BPromise[_0xccab('0x21')](_0x51a221);}return _0x4bd8d4[_0xccab('0x22')]();};}function saveUpdates(_0x54f5a3,_0x32c852){return function(_0x1fbb90){if(_0x1fbb90){return _0x1fbb90[_0xccab('0x23')](_0x54f5a3)[_0xccab('0x24')](function(_0xcce228){return _0xcce228;});}return null;};}function removeEntity(_0x111fde,_0x21c81d){return function(_0x427654){if(_0x427654){return _0x427654[_0xccab('0x25')]()[_0xccab('0x24')](function(){_0x111fde['status'](0xcc)[_0xccab('0x26')]();});}};}function handleEntityNotFound(_0x3532d4,_0x58e32b){return function(_0x41370b){if(!_0x41370b){_0x3532d4[_0xccab('0x18')](0x194);}return _0x41370b;};}function handleError(_0x1fcba7,_0x1a4e43){_0x1a4e43=_0x1a4e43||0x1f4;return function(_0x3a6b2e){logger[_0xccab('0x27')](_0x3a6b2e[_0xccab('0x28')]);if(_0x3a6b2e[_0xccab('0x29')]){delete _0x3a6b2e[_0xccab('0x29')];}_0x1fcba7[_0xccab('0x19')](_0x1a4e43)[_0xccab('0x2a')](_0x3a6b2e);};}exports[_0xccab('0x2b')]=function(_0x23912f,_0x381550){var _0x2edd0e={},_0x523ca8={},_0x164b7f={'count':0x0,'rows':[]};var _0x3bbed1=_['map'](db[_0xccab('0x2c')]['rawAttributes'],function(_0x272dcd){return{'name':_0x272dcd[_0xccab('0x2d')],'type':_0x272dcd[_0xccab('0x2e')][_0xccab('0x2f')]};});_0x523ca8['model']=_[_0xccab('0x30')](_0x3bbed1,_0xccab('0x29'));_0x523ca8[_0xccab('0x31')]=_[_0xccab('0x32')](_0x23912f['query']);_0x523ca8[_0xccab('0x33')]=_['intersection'](_0x523ca8['model'],_0x523ca8[_0xccab('0x31')]);_0x2edd0e['attributes']=_[_0xccab('0x34')](_0x523ca8['model'],qs[_0xccab('0x35')](_0x23912f['query'][_0xccab('0x35')]));_0x2edd0e[_0xccab('0x36')]=_0x2edd0e[_0xccab('0x36')][_0xccab('0x37')]?_0x2edd0e['attributes']:_0x523ca8[_0xccab('0x38')];if(!_0x23912f[_0xccab('0x31')][_0xccab('0x39')]('nolimit')){_0x2edd0e[_0xccab('0x1c')]=qs[_0xccab('0x1c')](_0x23912f[_0xccab('0x31')]['limit']);_0x2edd0e[_0xccab('0x1e')]=qs['offset'](_0x23912f[_0xccab('0x31')]['offset']);}_0x2edd0e[_0xccab('0x3a')]=qs[_0xccab('0x3b')](_0x23912f['query'][_0xccab('0x3b')]);_0x2edd0e[_0xccab('0x3c')]=qs[_0xccab('0x33')](_[_0xccab('0x3d')](_0x23912f[_0xccab('0x31')],_0x523ca8[_0xccab('0x33')]),_0x3bbed1);if(_0x23912f[_0xccab('0x31')]['filter']){_0x2edd0e[_0xccab('0x3c')]=_['merge'](_0x2edd0e['where'],{'$or':_['map'](_0x3bbed1,function(_0xf6e00b){if(_0xf6e00b[_0xccab('0x2e')]!==_0xccab('0x3e')){var _0x5546e2={};_0x5546e2[_0xf6e00b[_0xccab('0x29')]]={'$like':'%'+_0x23912f[_0xccab('0x31')][_0xccab('0x3f')]+'%'};return _0x5546e2;}})});}_0x2edd0e=_[_0xccab('0x40')]({},_0x2edd0e,_0x23912f[_0xccab('0x41')]);var _0x578943={'where':_0x2edd0e['where']};return db['FaxQueueReport'][_0xccab('0x1d')](_0x578943)[_0xccab('0x24')](function(_0x2a7b13){_0x164b7f[_0xccab('0x1d')]=_0x2a7b13;if(_0x23912f['query'][_0xccab('0x42')]){_0x2edd0e[_0xccab('0x43')]=[{'all':!![]}];}return db[_0xccab('0x2c')]['findAll'](_0x2edd0e);})[_0xccab('0x24')](function(_0x3fbc2){_0x164b7f[_0xccab('0x44')]=_0x3fbc2;return _0x164b7f;})[_0xccab('0x24')](respondWithFilteredResult(_0x381550,_0x2edd0e))[_0xccab('0x45')](handleError(_0x381550,null));};exports['show']=function(_0x4d7e4f,_0x488f2e){var _0x159d25={'raw':!![],'where':{'id':_0x4d7e4f['params']['id']}},_0xbb708c={};_0xbb708c[_0xccab('0x38')]=_[_0xccab('0x32')](db[_0xccab('0x2c')][_0xccab('0x46')]);_0xbb708c[_0xccab('0x31')]=_['keys'](_0x4d7e4f[_0xccab('0x31')]);_0xbb708c[_0xccab('0x33')]=_['intersection'](_0xbb708c[_0xccab('0x38')],_0xbb708c[_0xccab('0x31')]);_0x159d25['attributes']=_['intersection'](_0xbb708c[_0xccab('0x38')],qs[_0xccab('0x35')](_0x4d7e4f[_0xccab('0x31')][_0xccab('0x35')]));_0x159d25['attributes']=_0x159d25['attributes'][_0xccab('0x37')]?_0x159d25[_0xccab('0x36')]:_0xbb708c['model'];if(_0x4d7e4f['query']['includeAll']){_0x159d25[_0xccab('0x43')]=[{'all':!![]}];}_0x159d25=_[_0xccab('0x40')]({},_0x159d25,_0x4d7e4f['options']);return db[_0xccab('0x2c')][_0xccab('0x47')](_0x159d25)[_0xccab('0x24')](handleEntityNotFound(_0x488f2e,null))['then'](respondWithResult(_0x488f2e,null))[_0xccab('0x45')](handleError(_0x488f2e,null));};exports['create']=function(_0xc24b07,_0xe3a3b8){return db['FaxQueueReport'][_0xccab('0x48')](_0xc24b07[_0xccab('0x49')],{})['then'](respondWithResult(_0xe3a3b8,0xc9))[_0xccab('0x45')](handleError(_0xe3a3b8,null));};exports[_0xccab('0x23')]=function(_0x3b918c,_0x1c56fb){if(_0x3b918c[_0xccab('0x49')]['id']){delete _0x3b918c[_0xccab('0x49')]['id'];}return db['FaxQueueReport'][_0xccab('0x47')]({'where':{'id':_0x3b918c['params']['id']}})[_0xccab('0x24')](handleEntityNotFound(_0x1c56fb,null))[_0xccab('0x24')](saveUpdates(_0x3b918c[_0xccab('0x49')],null))[_0xccab('0x24')](respondWithResult(_0x1c56fb,null))[_0xccab('0x45')](handleError(_0x1c56fb,null));};exports[_0xccab('0x25')]=function(_0x5ac22d,_0x2ca8c6){return db[_0xccab('0x2c')]['find']({'where':{'id':_0x5ac22d[_0xccab('0x4a')]['id']}})[_0xccab('0x24')](handleEntityNotFound(_0x2ca8c6,null))[_0xccab('0x24')](removeEntity(_0x2ca8c6,null))['catch'](handleError(_0x2ca8c6,null));};exports['describe']=function(_0x5238e7,_0x1804f5){return db[_0xccab('0x2c')]['describe']()[_0xccab('0x24')](respondWithResult(_0x1804f5,null))['catch'](handleError(_0x1804f5,null));}; \ No newline at end of file +var _0xb16f=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','FaxQueueReport','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName'];(function(_0x3b0b2d,_0x4bdcb1){var _0x33dfdf=function(_0x2a83ff){while(--_0x2a83ff){_0x3b0b2d['push'](_0x3b0b2d['shift']());}};_0x33dfdf(++_0x4bdcb1);}(_0xb16f,0xf6));var _0xfb16=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0xb16f[_0x1c6efd];return _0x53a918;};'use strict';var emlformat=require(_0xfb16('0x0'));var rimraf=require(_0xfb16('0x1'));var zipdir=require(_0xfb16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb16('0x3'));var moment=require(_0xfb16('0x4'));var BPromise=require(_0xfb16('0x5'));var Mustache=require(_0xfb16('0x6'));var util=require('util');var path=require(_0xfb16('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb16('0x8'));var squel=require('squel');var crypto=require(_0xfb16('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfb16('0xa'));var toCsv=require(_0xfb16('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb16('0xc'));var qs=require(_0xfb16('0xd'));var as=require(_0xfb16('0xe'));var hardwareService=require(_0xfb16('0xf'));var logger=require(_0xfb16('0x10'))(_0xfb16('0x11'));var utils=require(_0xfb16('0x12'));var config=require(_0xfb16('0x13'));var licenseUtil=require(_0xfb16('0x14'));var db=require(_0xfb16('0x15'))['db'];function respondWithStatusCode(_0x3a8de2,_0x4f3a00){_0x4f3a00=_0x4f3a00||0xcc;return function(_0xd6eeee){if(_0xd6eeee){return _0x3a8de2['sendStatus'](_0x4f3a00);}return _0x3a8de2['status'](_0x4f3a00)[_0xfb16('0x16')]();};}function respondWithResult(_0x89a4b8,_0x4cdc87){_0x4cdc87=_0x4cdc87||0xc8;return function(_0x507bcc){if(_0x507bcc){return _0x89a4b8[_0xfb16('0x17')](_0x4cdc87)[_0xfb16('0x18')](_0x507bcc);}};}function respondWithFilteredResult(_0x4708c2,_0x1643cc){return function(_0x28cb87){if(_0x28cb87){var _0xcf5a5=typeof _0x1643cc[_0xfb16('0x19')]===_0xfb16('0x1a')&&typeof _0x1643cc[_0xfb16('0x1b')]===_0xfb16('0x1a');var _0x1748fb=_0x28cb87[_0xfb16('0x1c')];var _0x3b0064=_0xcf5a5?0x0:_0x1643cc[_0xfb16('0x19')];var _0x51078f=_0xcf5a5?_0x28cb87[_0xfb16('0x1c')]:_0x1643cc[_0xfb16('0x19')]+_0x1643cc[_0xfb16('0x1b')];var _0x5af84a;if(_0x51078f>=_0x1748fb){_0x51078f=_0x1748fb;_0x5af84a=0xc8;}else{_0x5af84a=0xce;}_0x4708c2['status'](_0x5af84a);return _0x4708c2[_0xfb16('0x1d')](_0xfb16('0x1e'),_0x3b0064+'-'+_0x51078f+'/'+_0x1748fb)[_0xfb16('0x18')](_0x28cb87);}return null;};}function patchUpdates(_0x5394a8){return function(_0x193162){try{jsonpatch[_0xfb16('0x1f')](_0x193162,_0x5394a8,!![]);}catch(_0x17bdd0){return BPromise['reject'](_0x17bdd0);}return _0x193162['save']();};}function saveUpdates(_0x544b4b,_0x27203c){return function(_0x354ef4){if(_0x354ef4){return _0x354ef4[_0xfb16('0x20')](_0x544b4b)[_0xfb16('0x21')](function(_0x502d60){return _0x502d60;});}return null;};}function removeEntity(_0x5814e9,_0x8ef26c){return function(_0x2aea90){if(_0x2aea90){return _0x2aea90[_0xfb16('0x22')]()[_0xfb16('0x21')](function(){_0x5814e9[_0xfb16('0x17')](0xcc)[_0xfb16('0x16')]();});}};}function handleEntityNotFound(_0x15b3b8,_0x239633){return function(_0x1335a3){if(!_0x1335a3){_0x15b3b8[_0xfb16('0x23')](0x194);}return _0x1335a3;};}function handleError(_0x177b67,_0x4c194a){_0x4c194a=_0x4c194a||0x1f4;return function(_0x1ca17b){logger[_0xfb16('0x24')](_0x1ca17b[_0xfb16('0x25')]);if(_0x1ca17b[_0xfb16('0x26')]){delete _0x1ca17b[_0xfb16('0x26')];}_0x177b67['status'](_0x4c194a)[_0xfb16('0x27')](_0x1ca17b);};}exports['index']=function(_0x407379,_0x21822b){var _0xe1a799={},_0x1a92ce={},_0x19fb63={'count':0x0,'rows':[]};var _0x49d03e=_[_0xfb16('0x28')](db['FaxQueueReport']['rawAttributes'],function(_0x4f40ce){return{'name':_0x4f40ce[_0xfb16('0x29')],'type':_0x4f40ce['type']['key']};});_0x1a92ce['model']=_[_0xfb16('0x28')](_0x49d03e,_0xfb16('0x26'));_0x1a92ce[_0xfb16('0x2a')]=_[_0xfb16('0x2b')](_0x407379[_0xfb16('0x2a')]);_0x1a92ce[_0xfb16('0x2c')]=_[_0xfb16('0x2d')](_0x1a92ce[_0xfb16('0x2e')],_0x1a92ce['query']);_0xe1a799[_0xfb16('0x2f')]=_[_0xfb16('0x2d')](_0x1a92ce[_0xfb16('0x2e')],qs['fields'](_0x407379[_0xfb16('0x2a')][_0xfb16('0x30')]));_0xe1a799[_0xfb16('0x2f')]=_0xe1a799[_0xfb16('0x2f')]['length']?_0xe1a799[_0xfb16('0x2f')]:_0x1a92ce['model'];if(!_0x407379[_0xfb16('0x2a')][_0xfb16('0x31')](_0xfb16('0x32'))){_0xe1a799['limit']=qs[_0xfb16('0x1b')](_0x407379[_0xfb16('0x2a')][_0xfb16('0x1b')]);_0xe1a799[_0xfb16('0x19')]=qs['offset'](_0x407379['query'][_0xfb16('0x19')]);}_0xe1a799['order']=qs[_0xfb16('0x33')](_0x407379[_0xfb16('0x2a')][_0xfb16('0x33')]);_0xe1a799[_0xfb16('0x34')]=qs['filters'](_[_0xfb16('0x35')](_0x407379['query'],_0x1a92ce[_0xfb16('0x2c')]),_0x49d03e);if(_0x407379[_0xfb16('0x2a')][_0xfb16('0x36')]){_0xe1a799[_0xfb16('0x34')]=_['merge'](_0xe1a799[_0xfb16('0x34')],{'$or':_[_0xfb16('0x28')](_0x49d03e,function(_0x48f23b){if(_0x48f23b[_0xfb16('0x37')]!=='VIRTUAL'){var _0x2191b0={};_0x2191b0[_0x48f23b[_0xfb16('0x26')]]={'$like':'%'+_0x407379[_0xfb16('0x2a')][_0xfb16('0x36')]+'%'};return _0x2191b0;}})});}_0xe1a799=_[_0xfb16('0x38')]({},_0xe1a799,_0x407379[_0xfb16('0x39')]);var _0x450e16={'where':_0xe1a799['where']};return db['FaxQueueReport'][_0xfb16('0x1c')](_0x450e16)['then'](function(_0x186e5a){_0x19fb63[_0xfb16('0x1c')]=_0x186e5a;if(_0x407379[_0xfb16('0x2a')]['includeAll']){_0xe1a799['include']=[{'all':!![]}];}return db[_0xfb16('0x3a')][_0xfb16('0x3b')](_0xe1a799);})[_0xfb16('0x21')](function(_0x52eafd){_0x19fb63[_0xfb16('0x3c')]=_0x52eafd;return _0x19fb63;})[_0xfb16('0x21')](respondWithFilteredResult(_0x21822b,_0xe1a799))[_0xfb16('0x3d')](handleError(_0x21822b,null));};exports[_0xfb16('0x3e')]=function(_0x33df7e,_0x37266a){var _0x554c5b={'raw':!![],'where':{'id':_0x33df7e[_0xfb16('0x3f')]['id']}},_0x223045={};_0x223045[_0xfb16('0x2e')]=_['keys'](db['FaxQueueReport'][_0xfb16('0x40')]);_0x223045[_0xfb16('0x2a')]=_['keys'](_0x33df7e[_0xfb16('0x2a')]);_0x223045['filters']=_[_0xfb16('0x2d')](_0x223045['model'],_0x223045[_0xfb16('0x2a')]);_0x554c5b['attributes']=_['intersection'](_0x223045[_0xfb16('0x2e')],qs[_0xfb16('0x30')](_0x33df7e[_0xfb16('0x2a')]['fields']));_0x554c5b['attributes']=_0x554c5b[_0xfb16('0x2f')][_0xfb16('0x41')]?_0x554c5b[_0xfb16('0x2f')]:_0x223045[_0xfb16('0x2e')];if(_0x33df7e[_0xfb16('0x2a')][_0xfb16('0x42')]){_0x554c5b[_0xfb16('0x43')]=[{'all':!![]}];}_0x554c5b=_['merge']({},_0x554c5b,_0x33df7e['options']);return db[_0xfb16('0x3a')][_0xfb16('0x44')](_0x554c5b)[_0xfb16('0x21')](handleEntityNotFound(_0x37266a,null))[_0xfb16('0x21')](respondWithResult(_0x37266a,null))['catch'](handleError(_0x37266a,null));};exports[_0xfb16('0x45')]=function(_0x7a90b6,_0x44a792){return db[_0xfb16('0x3a')]['create'](_0x7a90b6[_0xfb16('0x46')],{})[_0xfb16('0x21')](respondWithResult(_0x44a792,0xc9))[_0xfb16('0x3d')](handleError(_0x44a792,null));};exports[_0xfb16('0x20')]=function(_0x131e4d,_0x3820d6){if(_0x131e4d[_0xfb16('0x46')]['id']){delete _0x131e4d[_0xfb16('0x46')]['id'];}return db[_0xfb16('0x3a')][_0xfb16('0x44')]({'where':{'id':_0x131e4d[_0xfb16('0x3f')]['id']}})[_0xfb16('0x21')](handleEntityNotFound(_0x3820d6,null))['then'](saveUpdates(_0x131e4d[_0xfb16('0x46')],null))[_0xfb16('0x21')](respondWithResult(_0x3820d6,null))['catch'](handleError(_0x3820d6,null));};exports[_0xfb16('0x22')]=function(_0x279620,_0x3ac1f9){return db[_0xfb16('0x3a')][_0xfb16('0x44')]({'where':{'id':_0x279620[_0xfb16('0x3f')]['id']}})[_0xfb16('0x21')](handleEntityNotFound(_0x3ac1f9,null))[_0xfb16('0x21')](removeEntity(_0x3ac1f9,null))[_0xfb16('0x3d')](handleError(_0x3ac1f9,null));};exports[_0xfb16('0x47')]=function(_0x7ca35c,_0x260076){return db['FaxQueueReport'][_0xfb16('0x47')]()[_0xfb16('0x21')](respondWithResult(_0x260076,null))[_0xfb16('0x3d')](handleError(_0x260076,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b234e28..895bd57 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x21dab3,_0x567bdb){var _0x4ee96f=function(_0x243696){while(--_0x243696){_0x21dab3['push'](_0x21dab3['shift']());}};_0x4ee96f(++_0x567bdb);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31f5ee,_0x2b48dd){var _0x2c788a=function(_0x5db45e){while(--_0x5db45e){_0x31f5ee['push'](_0x31f5ee['shift']());}};_0x2c788a(++_0x2b48dd);}(_0x53ec,0x192));var _0xc53e=function(_0x40c6a7,_0x4fc99d){_0x40c6a7=_0x40c6a7-0x0;var _0x37f57d=_0x53ec[_0x40c6a7];return _0x37f57d;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6ab59fa..c4534f5 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 _0xd7eb=['update','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport'];(function(_0x2610f9,_0x531c0b){var _0x553bc1=function(_0x3a0fed){while(--_0x3a0fed){_0x2610f9['push'](_0x2610f9['shift']());}};_0x553bc1(++_0x531c0b);}(_0xd7eb,0x124));var _0xbd7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd7eb[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xbd7e('0x0'));var util=require(_0xbd7e('0x1'));var moment=require(_0xbd7e('0x2'));var BPromise=require(_0xbd7e('0x3'));var rs=require(_0xbd7e('0x4'));var fs=require('fs');var Redis=require(_0xbd7e('0x5'));var db=require(_0xbd7e('0x6'))['db'];var utils=require(_0xbd7e('0x7'));var logger=require(_0xbd7e('0x8'))('rpc');var config=require(_0xbd7e('0x9'));var jayson=require(_0xbd7e('0xa'));var client=jayson[_0xbd7e('0xb')][_0xbd7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43fb7c,_0x125647,_0x59b8e4){return new BPromise(function(_0x33ab7c,_0x51f857){return client[_0xbd7e('0xd')](_0x43fb7c,_0x59b8e4)[_0xbd7e('0xe')](function(_0x5571d3){logger[_0xbd7e('0xf')](_0xbd7e('0x10'),_0x125647,_0xbd7e('0x11'));logger[_0xbd7e('0x12')](_0xbd7e('0x13'),_0x125647,_0xbd7e('0x11'),JSON['stringify'](_0x5571d3));if(_0x5571d3[_0xbd7e('0x14')]){if(_0x5571d3[_0xbd7e('0x14')][_0xbd7e('0x15')]===0x1f4){logger[_0xbd7e('0x14')](_0xbd7e('0x10'),_0x125647,_0x5571d3[_0xbd7e('0x14')][_0xbd7e('0x16')]);return _0x51f857(_0x5571d3['error']['message']);}logger[_0xbd7e('0x14')](_0xbd7e('0x10'),_0x125647,_0x5571d3['error']['message']);return _0x33ab7c(_0x5571d3[_0xbd7e('0x14')][_0xbd7e('0x16')]);}else{logger[_0xbd7e('0xf')](_0xbd7e('0x10'),_0x125647,_0xbd7e('0x11'));_0x33ab7c(_0x5571d3[_0xbd7e('0x17')][_0xbd7e('0x16')]);}})[_0xbd7e('0x18')](function(_0x1f7104){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x125647,_0x1f7104);_0x51f857(_0x1f7104);});});}exports[_0xbd7e('0x19')]=function(_0x38dc66){var _0x7fd6bc=this;return new Promise(function(_0x27901e,_0x44df6c){return db['FaxQueueReport'][_0xbd7e('0x1a')](_0x38dc66[_0xbd7e('0x1b')],{'raw':_0x38dc66[_0xbd7e('0x1c')]?_0x38dc66[_0xbd7e('0x1c')][_0xbd7e('0x1d')]===undefined?!![]:![]:!![]})[_0xbd7e('0xe')](function(_0xc2a823){logger[_0xbd7e('0xf')](_0xbd7e('0x19'),_0x38dc66);logger[_0xbd7e('0x12')](_0xbd7e('0x19'),_0x38dc66,JSON['stringify'](_0xc2a823));_0x27901e(_0xc2a823);})[_0xbd7e('0x18')](function(_0x3edcc7){logger[_0xbd7e('0x14')](_0xbd7e('0x19'),_0x3edcc7[_0xbd7e('0x16')],_0x38dc66);_0x44df6c(_0x7fd6bc[_0xbd7e('0x14')](0x1f4,_0x3edcc7[_0xbd7e('0x16')]));});});};exports[_0xbd7e('0x1e')]=function(_0x4fbd13){var _0x31bebf=this;return new Promise(function(_0x6b8bfa,_0x2dc9a5){return db[_0xbd7e('0x1f')][_0xbd7e('0x20')](_0x4fbd13[_0xbd7e('0x1b')],{'raw':_0x4fbd13['options']?_0x4fbd13[_0xbd7e('0x1c')][_0xbd7e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fbd13[_0xbd7e('0x1c')]?_0x4fbd13[_0xbd7e('0x1c')][_0xbd7e('0x21')]||null:null,'attributes':_0x4fbd13[_0xbd7e('0x1c')]?_0x4fbd13[_0xbd7e('0x1c')][_0xbd7e('0x22')]||null:null,'limit':_0x4fbd13[_0xbd7e('0x1c')]?_0x4fbd13[_0xbd7e('0x1c')]['limit']||null:null})[_0xbd7e('0xe')](function(_0x432ee9){logger[_0xbd7e('0xf')](_0xbd7e('0x1e'),_0x4fbd13);logger[_0xbd7e('0x12')](_0xbd7e('0x1e'),_0x4fbd13,JSON[_0xbd7e('0x23')](_0x432ee9));_0x6b8bfa(_0x432ee9);})['catch'](function(_0x3afd79){logger['error'](_0xbd7e('0x1e'),_0x3afd79[_0xbd7e('0x16')],_0x4fbd13);_0x2dc9a5(_0x31bebf[_0xbd7e('0x14')](0x1f4,_0x3afd79[_0xbd7e('0x16')]));});});}; \ No newline at end of file +var _0x434f=['UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x434f,0x1d2));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf434('0x0'));var util=require(_0xf434('0x1'));var moment=require(_0xf434('0x2'));var BPromise=require(_0xf434('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf434('0x4'));var db=require(_0xf434('0x5'))['db'];var utils=require(_0xf434('0x6'));var logger=require(_0xf434('0x7'))(_0xf434('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf434('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1df1fa,_0x243d40,_0x416fbb){return new BPromise(function(_0x5ab108,_0xcdb129){return client[_0xf434('0xa')](_0x1df1fa,_0x416fbb)['then'](function(_0x24e222){logger[_0xf434('0xb')](_0xf434('0xc'),_0x243d40,_0xf434('0xd'));logger[_0xf434('0xe')](_0xf434('0xf'),_0x243d40,_0xf434('0xd'),JSON[_0xf434('0x10')](_0x24e222));if(_0x24e222['error']){if(_0x24e222['error'][_0xf434('0x11')]===0x1f4){logger[_0xf434('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x243d40,_0x24e222['error'][_0xf434('0x13')]);return _0xcdb129(_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);}logger[_0xf434('0x12')](_0xf434('0xc'),_0x243d40,_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);return _0x5ab108(_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);}else{logger['info'](_0xf434('0xc'),_0x243d40,_0xf434('0xd'));_0x5ab108(_0x24e222[_0xf434('0x14')][_0xf434('0x13')]);}})['catch'](function(_0x42324a){logger[_0xf434('0x12')](_0xf434('0xc'),_0x243d40,_0x42324a);_0xcdb129(_0x42324a);});});}exports[_0xf434('0x15')]=function(_0x81b65d){var _0x58d03c=this;return new Promise(function(_0x5e5641,_0x257a52){return db[_0xf434('0x16')][_0xf434('0x17')](_0x81b65d[_0xf434('0x18')],{'raw':_0x81b65d[_0xf434('0x19')]?_0x81b65d[_0xf434('0x19')][_0xf434('0x1a')]===undefined?!![]:![]:!![]})[_0xf434('0x1b')](function(_0x5d34c4){logger['info']('CreateFaxQueueReport',_0x81b65d);logger[_0xf434('0xe')](_0xf434('0x15'),_0x81b65d,JSON[_0xf434('0x10')](_0x5d34c4));_0x5e5641(_0x5d34c4);})[_0xf434('0x1c')](function(_0x2502b9){logger[_0xf434('0x12')](_0xf434('0x15'),_0x2502b9['message'],_0x81b65d);_0x257a52(_0x58d03c['error'](0x1f4,_0x2502b9[_0xf434('0x13')]));});});};exports[_0xf434('0x1d')]=function(_0x101fd0){var _0x2ff156=this;return new Promise(function(_0x4226d1,_0x4e6884){return db[_0xf434('0x16')]['update'](_0x101fd0[_0xf434('0x18')],{'raw':_0x101fd0[_0xf434('0x19')]?_0x101fd0[_0xf434('0x19')][_0xf434('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101fd0['options']?_0x101fd0[_0xf434('0x19')][_0xf434('0x1e')]||null:null,'attributes':_0x101fd0['options']?_0x101fd0[_0xf434('0x19')][_0xf434('0x1f')]||null:null,'limit':_0x101fd0[_0xf434('0x19')]?_0x101fd0[_0xf434('0x19')][_0xf434('0x20')]||null:null})[_0xf434('0x1b')](function(_0x2097d9){logger['info'](_0xf434('0x1d'),_0x101fd0);logger[_0xf434('0xe')](_0xf434('0x1d'),_0x101fd0,JSON[_0xf434('0x10')](_0x2097d9));_0x4226d1(_0x2097d9);})['catch'](function(_0x229273){logger[_0xf434('0x12')](_0xf434('0x1d'),_0x229273['message'],_0x101fd0);_0x4e6884(_0x2ff156[_0xf434('0x12')](0x1f4,_0x229273['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index d6cc635..0369726 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 _0x6228=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2c3a37,_0x49f86a){var _0x509da8=function(_0x503589){while(--_0x503589){_0x2c3a37['push'](_0x2c3a37['shift']());}};_0x509da8(++_0x49f86a);}(_0x6228,0xbc));var _0x8622=function(_0x5d88c6,_0x485585){_0x5d88c6=_0x5d88c6-0x0;var _0x189e81=_0x6228[_0x5d88c6];return _0x189e81;};'use strict';var multer=require(_0x8622('0x0'));var util=require(_0x8622('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8622('0x2')]();var fs_extra=require(_0x8622('0x3'));var auth=require(_0x8622('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8622('0x5'));var controller=require(_0x8622('0x6'));router[_0x8622('0x7')]('/',auth['isAuthenticated'](),controller[_0x8622('0x8')]);router[_0x8622('0x7')](_0x8622('0x9'),auth[_0x8622('0xa')](),controller[_0x8622('0xb')]);router[_0x8622('0x7')](_0x8622('0xc'),auth[_0x8622('0xa')](),controller['show']);router['post']('/',auth[_0x8622('0xa')](),controller[_0x8622('0xd')]);router[_0x8622('0xe')]('/:id',auth[_0x8622('0xa')](),controller[_0x8622('0xf')]);router[_0x8622('0x10')](_0x8622('0xc'),auth[_0x8622('0xa')](),controller[_0x8622('0x11')]);module[_0x8622('0x12')]=router; \ No newline at end of file +var _0x2927=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0x2927,0x192));var _0x7292=function(_0x5c5a34,_0x4207e2){_0x5c5a34=_0x5c5a34-0x0;var _0x5dabc1=_0x2927[_0x5c5a34];return _0x5dabc1;};'use strict';var multer=require('multer');var util=require(_0x7292('0x0'));var path=require(_0x7292('0x1'));var timeout=require(_0x7292('0x2'));var express=require(_0x7292('0x3'));var router=express[_0x7292('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7292('0x5'));var config=require(_0x7292('0x6'));var controller=require(_0x7292('0x7'));router[_0x7292('0x8')]('/',auth[_0x7292('0x9')](),controller['index']);router[_0x7292('0x8')]('/describe',auth[_0x7292('0x9')](),controller[_0x7292('0xa')]);router[_0x7292('0x8')](_0x7292('0xb'),auth['isAuthenticated'](),controller[_0x7292('0xc')]);router[_0x7292('0xd')]('/',auth[_0x7292('0x9')](),controller[_0x7292('0xe')]);router[_0x7292('0xf')](_0x7292('0xb'),auth[_0x7292('0x9')](),controller[_0x7292('0x10')]);router[_0x7292('0x11')](_0x7292('0xb'),auth[_0x7292('0x9')](),controller[_0x7292('0x12')]);module[_0x7292('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 69123a0..890f271 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x574dea,_0x4cf209){var _0x3ed444=function(_0x3423a2){while(--_0x3423a2){_0x574dea['push'](_0x574dea['shift']());}};_0x3ed444(++_0x4cf209);}(_0x008c,0x188));var _0xc008=function(_0xe2d14f,_0x49fd0e){_0xe2d14f=_0xe2d14f-0x0;var _0x4522d2=_0x008c[_0xe2d14f];return _0x4522d2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4eeca4,_0x5901c9){var _0x430031=function(_0x237ed7){while(--_0x237ed7){_0x4eeca4['push'](_0x4eeca4['shift']());}};_0x430031(++_0x5901c9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x4b84[_0x452968];return _0xb6f9ae;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0cf45a6..3d2b3cb 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 _0xf4f3=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf4f3,0x165));var _0x3f4f=function(_0x4e5552,_0x55be8c){_0x4e5552=_0x4e5552-0x0;var _0x1dcffa=_0xf4f3[_0x4e5552];return _0x1dcffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f4f('0x0'));var zipdir=require(_0x3f4f('0x1'));var jsonpatch=require(_0x3f4f('0x2'));var rp=require(_0x3f4f('0x3'));var moment=require(_0x3f4f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f4f('0x5'));var util=require('util');var path=require(_0x3f4f('0x6'));var sox=require(_0x3f4f('0x7'));var csv=require(_0x3f4f('0x8'));var ejs=require(_0x3f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x3f4f('0xa'));var _=require(_0x3f4f('0xb'));var squel=require(_0x3f4f('0xc'));var crypto=require(_0x3f4f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f4f('0xe'));var toCsv=require(_0x3f4f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f4f('0xf'));var authService=require(_0x3f4f('0x10'));var qs=require(_0x3f4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f4f('0x12'));var logger=require(_0x3f4f('0x13'))('api');var utils=require(_0x3f4f('0x14'));var config=require(_0x3f4f('0x15'));var licenseUtil=require(_0x3f4f('0x16'));var db=require(_0x3f4f('0x17'))['db'];function respondWithStatusCode(_0x4e8678,_0xfd924c){_0xfd924c=_0xfd924c||0xcc;return function(_0x40dad7){if(_0x40dad7){return _0x4e8678[_0x3f4f('0x18')](_0xfd924c);}return _0x4e8678['status'](_0xfd924c)[_0x3f4f('0x19')]();};}function respondWithResult(_0x3c7348,_0x36b33b){_0x36b33b=_0x36b33b||0xc8;return function(_0x1bb720){if(_0x1bb720){return _0x3c7348[_0x3f4f('0x1a')](_0x36b33b)[_0x3f4f('0x1b')](_0x1bb720);}};}function respondWithFilteredResult(_0x349800,_0x3bce89){return function(_0x1b4cd7){if(_0x1b4cd7){var _0x54f049=typeof _0x3bce89['offset']===_0x3f4f('0x1c')&&typeof _0x3bce89[_0x3f4f('0x1d')]===_0x3f4f('0x1c');var _0x3ec266=_0x1b4cd7['count'];var _0x4824f8=_0x54f049?0x0:_0x3bce89[_0x3f4f('0x1e')];var _0x405893=_0x54f049?_0x1b4cd7[_0x3f4f('0x1f')]:_0x3bce89[_0x3f4f('0x1e')]+_0x3bce89[_0x3f4f('0x1d')];var _0x14acf6;if(_0x405893>=_0x3ec266){_0x405893=_0x3ec266;_0x14acf6=0xc8;}else{_0x14acf6=0xce;}_0x349800['status'](_0x14acf6);return _0x349800[_0x3f4f('0x20')](_0x3f4f('0x21'),_0x4824f8+'-'+_0x405893+'/'+_0x3ec266)['json'](_0x1b4cd7);}return null;};}function patchUpdates(_0x1b0785){return function(_0x11e17c){try{jsonpatch[_0x3f4f('0x22')](_0x11e17c,_0x1b0785,!![]);}catch(_0x4edd4c){return BPromise[_0x3f4f('0x23')](_0x4edd4c);}return _0x11e17c['save']();};}function saveUpdates(_0x1dbc88,_0x153659){return function(_0x142440){if(_0x142440){return _0x142440[_0x3f4f('0x24')](_0x1dbc88)[_0x3f4f('0x25')](function(_0x30c8be){return _0x30c8be;});}return null;};}function removeEntity(_0x3f9948,_0x4a378b){return function(_0x5e51ae){if(_0x5e51ae){return _0x5e51ae['destroy']()['then'](function(){_0x3f9948[_0x3f4f('0x1a')](0xcc)[_0x3f4f('0x19')]();});}};}function handleEntityNotFound(_0x4d2b83,_0x4602da){return function(_0x4cc466){if(!_0x4cc466){_0x4d2b83[_0x3f4f('0x18')](0x194);}return _0x4cc466;};}function handleError(_0x2f8e15,_0x4e4be1){_0x4e4be1=_0x4e4be1||0x1f4;return function(_0x524af4){logger[_0x3f4f('0x26')](_0x524af4[_0x3f4f('0x27')]);if(_0x524af4[_0x3f4f('0x28')]){delete _0x524af4[_0x3f4f('0x28')];}_0x2f8e15['status'](_0x4e4be1)[_0x3f4f('0x29')](_0x524af4);};}exports['index']=function(_0x3b0efa,_0x4cfc99){var _0x588fd6={},_0x2a15b4={},_0xd4db2b={'count':0x0,'rows':[]};var _0x3730a9=_[_0x3f4f('0x2a')](db[_0x3f4f('0x2b')][_0x3f4f('0x2c')],function(_0x2ee7fd){return{'name':_0x2ee7fd[_0x3f4f('0x2d')],'type':_0x2ee7fd[_0x3f4f('0x2e')][_0x3f4f('0x2f')]};});_0x2a15b4['model']=_[_0x3f4f('0x2a')](_0x3730a9,_0x3f4f('0x28'));_0x2a15b4[_0x3f4f('0x30')]=_[_0x3f4f('0x31')](_0x3b0efa[_0x3f4f('0x30')]);_0x2a15b4[_0x3f4f('0x32')]=_[_0x3f4f('0x33')](_0x2a15b4['model'],_0x2a15b4['query']);_0x588fd6[_0x3f4f('0x34')]=_[_0x3f4f('0x33')](_0x2a15b4[_0x3f4f('0x35')],qs[_0x3f4f('0x36')](_0x3b0efa[_0x3f4f('0x30')]['fields']));_0x588fd6[_0x3f4f('0x34')]=_0x588fd6[_0x3f4f('0x34')][_0x3f4f('0x37')]?_0x588fd6[_0x3f4f('0x34')]:_0x2a15b4[_0x3f4f('0x35')];if(!_0x3b0efa[_0x3f4f('0x30')]['hasOwnProperty'](_0x3f4f('0x38'))){_0x588fd6['limit']=qs[_0x3f4f('0x1d')](_0x3b0efa['query'][_0x3f4f('0x1d')]);_0x588fd6[_0x3f4f('0x1e')]=qs[_0x3f4f('0x1e')](_0x3b0efa[_0x3f4f('0x30')][_0x3f4f('0x1e')]);}_0x588fd6[_0x3f4f('0x39')]=qs[_0x3f4f('0x3a')](_0x3b0efa['query'][_0x3f4f('0x3a')]);_0x588fd6[_0x3f4f('0x3b')]=qs[_0x3f4f('0x32')](_[_0x3f4f('0x3c')](_0x3b0efa['query'],_0x2a15b4[_0x3f4f('0x32')]),_0x3730a9);if(_0x3b0efa['query'][_0x3f4f('0x3d')]){_0x588fd6[_0x3f4f('0x3b')]=_[_0x3f4f('0x3e')](_0x588fd6[_0x3f4f('0x3b')],{'$or':_[_0x3f4f('0x2a')](_0x3730a9,function(_0x5ad4f3){if(_0x5ad4f3['type']!=='VIRTUAL'){var _0x2ad706={};_0x2ad706[_0x5ad4f3[_0x3f4f('0x28')]]={'$like':'%'+_0x3b0efa[_0x3f4f('0x30')][_0x3f4f('0x3d')]+'%'};return _0x2ad706;}})});}_0x588fd6=_['merge']({},_0x588fd6,_0x3b0efa[_0x3f4f('0x3f')]);var _0x4b1e90={'where':_0x588fd6['where']};return db['FaxTransferReport'][_0x3f4f('0x1f')](_0x4b1e90)['then'](function(_0x17d7dd){_0xd4db2b[_0x3f4f('0x1f')]=_0x17d7dd;if(_0x3b0efa['query'][_0x3f4f('0x40')]){_0x588fd6[_0x3f4f('0x41')]=[{'all':!![]}];}return db[_0x3f4f('0x2b')][_0x3f4f('0x42')](_0x588fd6);})[_0x3f4f('0x25')](function(_0x5d5cdb){_0xd4db2b[_0x3f4f('0x43')]=_0x5d5cdb;return _0xd4db2b;})[_0x3f4f('0x25')](respondWithFilteredResult(_0x4cfc99,_0x588fd6))['catch'](handleError(_0x4cfc99,null));};exports['show']=function(_0x4d0b21,_0x28ef7e){var _0x2b8aee={'raw':!![],'where':{'id':_0x4d0b21[_0x3f4f('0x44')]['id']}},_0x13a352={};_0x13a352[_0x3f4f('0x35')]=_['keys'](db[_0x3f4f('0x2b')]['rawAttributes']);_0x13a352[_0x3f4f('0x30')]=_['keys'](_0x4d0b21[_0x3f4f('0x30')]);_0x13a352[_0x3f4f('0x32')]=_['intersection'](_0x13a352[_0x3f4f('0x35')],_0x13a352[_0x3f4f('0x30')]);_0x2b8aee[_0x3f4f('0x34')]=_['intersection'](_0x13a352[_0x3f4f('0x35')],qs[_0x3f4f('0x36')](_0x4d0b21['query'][_0x3f4f('0x36')]));_0x2b8aee[_0x3f4f('0x34')]=_0x2b8aee[_0x3f4f('0x34')][_0x3f4f('0x37')]?_0x2b8aee[_0x3f4f('0x34')]:_0x13a352[_0x3f4f('0x35')];if(_0x4d0b21[_0x3f4f('0x30')][_0x3f4f('0x40')]){_0x2b8aee[_0x3f4f('0x41')]=[{'all':!![]}];}_0x2b8aee=_['merge']({},_0x2b8aee,_0x4d0b21[_0x3f4f('0x3f')]);return db[_0x3f4f('0x2b')][_0x3f4f('0x45')](_0x2b8aee)[_0x3f4f('0x25')](handleEntityNotFound(_0x28ef7e,null))[_0x3f4f('0x25')](respondWithResult(_0x28ef7e,null))[_0x3f4f('0x46')](handleError(_0x28ef7e,null));};exports[_0x3f4f('0x47')]=function(_0x3d99b7,_0x40b749){return db[_0x3f4f('0x2b')]['create'](_0x3d99b7[_0x3f4f('0x48')],{})[_0x3f4f('0x25')](respondWithResult(_0x40b749,0xc9))[_0x3f4f('0x46')](handleError(_0x40b749,null));};exports['update']=function(_0x2ca0c4,_0x3c66e9){if(_0x2ca0c4[_0x3f4f('0x48')]['id']){delete _0x2ca0c4['body']['id'];}return db['FaxTransferReport'][_0x3f4f('0x45')]({'where':{'id':_0x2ca0c4[_0x3f4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c66e9,null))[_0x3f4f('0x25')](saveUpdates(_0x2ca0c4[_0x3f4f('0x48')],null))[_0x3f4f('0x25')](respondWithResult(_0x3c66e9,null))['catch'](handleError(_0x3c66e9,null));};exports[_0x3f4f('0x49')]=function(_0x2cb45a,_0x55ce12){return db[_0x3f4f('0x2b')][_0x3f4f('0x45')]({'where':{'id':_0x2cb45a[_0x3f4f('0x44')]['id']}})[_0x3f4f('0x25')](handleEntityNotFound(_0x55ce12,null))[_0x3f4f('0x25')](removeEntity(_0x55ce12,null))[_0x3f4f('0x46')](handleError(_0x55ce12,null));};exports['describe']=function(_0x51d652,_0x44b450){return db['FaxTransferReport'][_0x3f4f('0x4a')]()[_0x3f4f('0x25')](respondWithResult(_0x44b450,null))[_0x3f4f('0x46')](handleError(_0x44b450,null));}; \ No newline at end of file +var _0xe0a0=['then','stack','name','send','index','map','FaxTransferReport','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update'];(function(_0xb4d1ca,_0x25d013){var _0x4e0986=function(_0x2d457e){while(--_0x2d457e){_0xb4d1ca['push'](_0xb4d1ca['shift']());}};_0x4e0986(++_0x25d013);}(_0xe0a0,0x1b8));var _0x0e0a=function(_0x1c23e0,_0x447fda){_0x1c23e0=_0x1c23e0-0x0;var _0x9c54c2=_0xe0a0[_0x1c23e0];return _0x9c54c2;};'use strict';var emlformat=require(_0x0e0a('0x0'));var rimraf=require(_0x0e0a('0x1'));var zipdir=require(_0x0e0a('0x2'));var jsonpatch=require(_0x0e0a('0x3'));var rp=require(_0x0e0a('0x4'));var moment=require(_0x0e0a('0x5'));var BPromise=require(_0x0e0a('0x6'));var Mustache=require(_0x0e0a('0x7'));var util=require(_0x0e0a('0x8'));var path=require(_0x0e0a('0x9'));var sox=require(_0x0e0a('0xa'));var csv=require(_0x0e0a('0xb'));var ejs=require(_0x0e0a('0xc'));var fs=require('fs');var fs_extra=require(_0x0e0a('0xd'));var _=require('lodash');var squel=require(_0x0e0a('0xe'));var crypto=require('crypto');var jsforce=require(_0x0e0a('0xf'));var deskjs=require(_0x0e0a('0x10'));var toCsv=require(_0x0e0a('0xb'));var querystring=require(_0x0e0a('0x11'));var Papa=require(_0x0e0a('0x12'));var Redis=require(_0x0e0a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0e0a('0x14'));var as=require(_0x0e0a('0x15'));var hardwareService=require(_0x0e0a('0x16'));var logger=require('../../config/logger')(_0x0e0a('0x17'));var utils=require(_0x0e0a('0x18'));var config=require(_0x0e0a('0x19'));var licenseUtil=require(_0x0e0a('0x1a'));var db=require(_0x0e0a('0x1b'))['db'];function respondWithStatusCode(_0x30e79a,_0xff46e){_0xff46e=_0xff46e||0xcc;return function(_0x30ded4){if(_0x30ded4){return _0x30e79a[_0x0e0a('0x1c')](_0xff46e);}return _0x30e79a[_0x0e0a('0x1d')](_0xff46e)[_0x0e0a('0x1e')]();};}function respondWithResult(_0x6f66b7,_0x247e29){_0x247e29=_0x247e29||0xc8;return function(_0x34958b){if(_0x34958b){return _0x6f66b7[_0x0e0a('0x1d')](_0x247e29)[_0x0e0a('0x1f')](_0x34958b);}};}function respondWithFilteredResult(_0x14eec1,_0x33ff68){return function(_0x75fb7a){if(_0x75fb7a){var _0x31ce45=typeof _0x33ff68[_0x0e0a('0x20')]==='undefined'&&typeof _0x33ff68[_0x0e0a('0x21')]===_0x0e0a('0x22');var _0xe548e1=_0x75fb7a[_0x0e0a('0x23')];var _0x39e642=_0x31ce45?0x0:_0x33ff68[_0x0e0a('0x20')];var _0x568ded=_0x31ce45?_0x75fb7a[_0x0e0a('0x23')]:_0x33ff68['offset']+_0x33ff68['limit'];var _0x466110;if(_0x568ded>=_0xe548e1){_0x568ded=_0xe548e1;_0x466110=0xc8;}else{_0x466110=0xce;}_0x14eec1[_0x0e0a('0x1d')](_0x466110);return _0x14eec1['set'](_0x0e0a('0x24'),_0x39e642+'-'+_0x568ded+'/'+_0xe548e1)['json'](_0x75fb7a);}return null;};}function patchUpdates(_0x452083){return function(_0x3e73e1){try{jsonpatch[_0x0e0a('0x25')](_0x3e73e1,_0x452083,!![]);}catch(_0x1dac6c){return BPromise[_0x0e0a('0x26')](_0x1dac6c);}return _0x3e73e1['save']();};}function saveUpdates(_0xb971a4,_0x2bfaf5){return function(_0x1bb9d3){if(_0x1bb9d3){return _0x1bb9d3[_0x0e0a('0x27')](_0xb971a4)[_0x0e0a('0x28')](function(_0x5eaf38){return _0x5eaf38;});}return null;};}function removeEntity(_0x199bfe,_0x28b8ae){return function(_0xbfc04e){if(_0xbfc04e){return _0xbfc04e['destroy']()[_0x0e0a('0x28')](function(){_0x199bfe[_0x0e0a('0x1d')](0xcc)[_0x0e0a('0x1e')]();});}};}function handleEntityNotFound(_0x3d16d7,_0x47f1be){return function(_0x436212){if(!_0x436212){_0x3d16d7[_0x0e0a('0x1c')](0x194);}return _0x436212;};}function handleError(_0x15646d,_0x8c4e96){_0x8c4e96=_0x8c4e96||0x1f4;return function(_0x3d1948){logger['error'](_0x3d1948[_0x0e0a('0x29')]);if(_0x3d1948[_0x0e0a('0x2a')]){delete _0x3d1948[_0x0e0a('0x2a')];}_0x15646d[_0x0e0a('0x1d')](_0x8c4e96)[_0x0e0a('0x2b')](_0x3d1948);};}exports[_0x0e0a('0x2c')]=function(_0x3447b3,_0x14bb42){var _0x15b028={},_0x18dad2={},_0x4bbea1={'count':0x0,'rows':[]};var _0x20eb9b=_[_0x0e0a('0x2d')](db[_0x0e0a('0x2e')][_0x0e0a('0x2f')],function(_0x24357f){return{'name':_0x24357f['fieldName'],'type':_0x24357f['type'][_0x0e0a('0x30')]};});_0x18dad2[_0x0e0a('0x31')]=_[_0x0e0a('0x2d')](_0x20eb9b,_0x0e0a('0x2a'));_0x18dad2[_0x0e0a('0x32')]=_[_0x0e0a('0x33')](_0x3447b3['query']);_0x18dad2['filters']=_['intersection'](_0x18dad2[_0x0e0a('0x31')],_0x18dad2[_0x0e0a('0x32')]);_0x15b028[_0x0e0a('0x34')]=_[_0x0e0a('0x35')](_0x18dad2[_0x0e0a('0x31')],qs[_0x0e0a('0x36')](_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x36')]));_0x15b028[_0x0e0a('0x34')]=_0x15b028['attributes'][_0x0e0a('0x37')]?_0x15b028[_0x0e0a('0x34')]:_0x18dad2[_0x0e0a('0x31')];if(!_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x38')](_0x0e0a('0x39'))){_0x15b028[_0x0e0a('0x21')]=qs[_0x0e0a('0x21')](_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x21')]);_0x15b028[_0x0e0a('0x20')]=qs[_0x0e0a('0x20')](_0x3447b3['query'][_0x0e0a('0x20')]);}_0x15b028[_0x0e0a('0x3a')]=qs['sort'](_0x3447b3['query'][_0x0e0a('0x3b')]);_0x15b028['where']=qs[_0x0e0a('0x3c')](_[_0x0e0a('0x3d')](_0x3447b3['query'],_0x18dad2[_0x0e0a('0x3c')]),_0x20eb9b);if(_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x3e')]){_0x15b028[_0x0e0a('0x3f')]=_[_0x0e0a('0x40')](_0x15b028[_0x0e0a('0x3f')],{'$or':_[_0x0e0a('0x2d')](_0x20eb9b,function(_0x197c5b){if(_0x197c5b[_0x0e0a('0x41')]!==_0x0e0a('0x42')){var _0x26995f={};_0x26995f[_0x197c5b[_0x0e0a('0x2a')]]={'$like':'%'+_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x3e')]+'%'};return _0x26995f;}})});}_0x15b028=_[_0x0e0a('0x40')]({},_0x15b028,_0x3447b3[_0x0e0a('0x43')]);var _0xd9f11e={'where':_0x15b028['where']};return db['FaxTransferReport'][_0x0e0a('0x23')](_0xd9f11e)[_0x0e0a('0x28')](function(_0x1b4a49){_0x4bbea1['count']=_0x1b4a49;if(_0x3447b3['query']['includeAll']){_0x15b028[_0x0e0a('0x44')]=[{'all':!![]}];}return db[_0x0e0a('0x2e')][_0x0e0a('0x45')](_0x15b028);})[_0x0e0a('0x28')](function(_0x21daff){_0x4bbea1[_0x0e0a('0x46')]=_0x21daff;return _0x4bbea1;})['then'](respondWithFilteredResult(_0x14bb42,_0x15b028))[_0x0e0a('0x47')](handleError(_0x14bb42,null));};exports[_0x0e0a('0x48')]=function(_0x3140f1,_0x5af7ad){var _0x5c3652={'raw':!![],'where':{'id':_0x3140f1[_0x0e0a('0x49')]['id']}},_0x4fe481={};_0x4fe481['model']=_[_0x0e0a('0x33')](db[_0x0e0a('0x2e')][_0x0e0a('0x2f')]);_0x4fe481['query']=_[_0x0e0a('0x33')](_0x3140f1[_0x0e0a('0x32')]);_0x4fe481['filters']=_[_0x0e0a('0x35')](_0x4fe481[_0x0e0a('0x31')],_0x4fe481[_0x0e0a('0x32')]);_0x5c3652[_0x0e0a('0x34')]=_[_0x0e0a('0x35')](_0x4fe481['model'],qs[_0x0e0a('0x36')](_0x3140f1[_0x0e0a('0x32')]['fields']));_0x5c3652['attributes']=_0x5c3652[_0x0e0a('0x34')][_0x0e0a('0x37')]?_0x5c3652[_0x0e0a('0x34')]:_0x4fe481['model'];if(_0x3140f1[_0x0e0a('0x32')][_0x0e0a('0x4a')]){_0x5c3652[_0x0e0a('0x44')]=[{'all':!![]}];}_0x5c3652=_[_0x0e0a('0x40')]({},_0x5c3652,_0x3140f1[_0x0e0a('0x43')]);return db['FaxTransferReport'][_0x0e0a('0x4b')](_0x5c3652)[_0x0e0a('0x28')](handleEntityNotFound(_0x5af7ad,null))[_0x0e0a('0x28')](respondWithResult(_0x5af7ad,null))['catch'](handleError(_0x5af7ad,null));};exports[_0x0e0a('0x4c')]=function(_0x33bdb1,_0x5c7257){return db[_0x0e0a('0x2e')][_0x0e0a('0x4c')](_0x33bdb1[_0x0e0a('0x4d')],{})[_0x0e0a('0x28')](respondWithResult(_0x5c7257,0xc9))[_0x0e0a('0x47')](handleError(_0x5c7257,null));};exports['update']=function(_0x8c8812,_0xf728d8){if(_0x8c8812['body']['id']){delete _0x8c8812[_0x0e0a('0x4d')]['id'];}return db[_0x0e0a('0x2e')]['find']({'where':{'id':_0x8c8812[_0x0e0a('0x49')]['id']}})[_0x0e0a('0x28')](handleEntityNotFound(_0xf728d8,null))[_0x0e0a('0x28')](saveUpdates(_0x8c8812['body'],null))[_0x0e0a('0x28')](respondWithResult(_0xf728d8,null))[_0x0e0a('0x47')](handleError(_0xf728d8,null));};exports[_0x0e0a('0x4e')]=function(_0x4e6be4,_0x4da279){return db[_0x0e0a('0x2e')]['find']({'where':{'id':_0x4e6be4[_0x0e0a('0x49')]['id']}})['then'](handleEntityNotFound(_0x4da279,null))[_0x0e0a('0x28')](removeEntity(_0x4da279,null))[_0x0e0a('0x47')](handleError(_0x4da279,null));};exports[_0x0e0a('0x4f')]=function(_0x2c3363,_0x4919ad){return db[_0x0e0a('0x2e')][_0x0e0a('0x4f')]()[_0x0e0a('0x28')](respondWithResult(_0x4919ad,null))[_0x0e0a('0x47')](handleError(_0x4919ad,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 20540b8..4874bdb 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 _0x6dcb=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x5a0cb2,_0x43a6e4){var _0x32b526=function(_0x47de3c){while(--_0x47de3c){_0x5a0cb2['push'](_0x5a0cb2['shift']());}};_0x32b526(++_0x43a6e4);}(_0x6dcb,0x6b));var _0xb6dc=function(_0x5b809d,_0x5c0153){_0x5b809d=_0x5b809d-0x0;var _0x305df0=_0x6dcb[_0x5b809d];return _0x305df0;};'use strict';var _=require(_0xb6dc('0x0'));var util=require(_0xb6dc('0x1'));var logger=require(_0xb6dc('0x2'))(_0xb6dc('0x3'));var moment=require(_0xb6dc('0x4'));var BPromise=require(_0xb6dc('0x5'));var rp=require(_0xb6dc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6dc('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xb6dc('0x8')]=function(_0x265c4f,_0xb00f7){return _0x265c4f[_0xb6dc('0x9')](_0xb6dc('0xa'),attributes,{'tableName':_0xb6dc('0xb'),'paranoid':![],'indexes':[{'name':_0xb6dc('0xc'),'fields':[_0xb6dc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47cb=['moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2e1738,_0x23644b){var _0xdd96f1=function(_0x5c9911){while(--_0x5c9911){_0x2e1738['push'](_0x2e1738['shift']());}};_0xdd96f1(++_0x23644b);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var logger=require(_0xb47c('0x2'))(_0xb47c('0x3'));var moment=require(_0xb47c('0x4'));var BPromise=require(_0xb47c('0x5'));var rp=require(_0xb47c('0x6'));var fs=require('fs');var path=require(_0xb47c('0x7'));var rimraf=require('rimraf');var config=require(_0xb47c('0x8'));var attributes=require(_0xb47c('0x9'));module[_0xb47c('0xa')]=function(_0x10891b,_0x325e36){return _0x10891b[_0xb47c('0xb')](_0xb47c('0xc'),attributes,{'tableName':_0xb47c('0xd'),'paranoid':![],'indexes':[{'name':_0xb47c('0xe'),'fields':[_0xb47c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7e4cc73..2eff624 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 _0x6a7c=['jayson/promise','client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x6a7c,0xea));var _0xc6a7=function(_0x34abef,_0x4b63db){_0x34abef=_0x34abef-0x0;var _0x59f66b=_0x6a7c[_0x34abef];return _0x59f66b;};'use strict';var _=require(_0xc6a7('0x0'));var util=require(_0xc6a7('0x1'));var moment=require(_0xc6a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6a7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6a7('0x5'))(_0xc6a7('0x6'));var config=require(_0xc6a7('0x7'));var jayson=require(_0xc6a7('0x8'));var client=jayson[_0xc6a7('0x9')][_0xc6a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49dc6c,_0x2419bf,_0x3d71b9){return new BPromise(function(_0x537ed3,_0x5880c3){return client[_0xc6a7('0xb')](_0x49dc6c,_0x3d71b9)[_0xc6a7('0xc')](function(_0x2c552e){logger[_0xc6a7('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2419bf,_0xc6a7('0xe'));logger['debug'](_0xc6a7('0xf'),_0x2419bf,'request\x20sent',JSON['stringify'](_0x2c552e));if(_0x2c552e[_0xc6a7('0x10')]){if(_0x2c552e['error'][_0xc6a7('0x11')]===0x1f4){logger[_0xc6a7('0x10')](_0xc6a7('0x12'),_0x2419bf,_0x2c552e[_0xc6a7('0x10')]['message']);return _0x5880c3(_0x2c552e['error']['message']);}logger[_0xc6a7('0x10')](_0xc6a7('0x12'),_0x2419bf,_0x2c552e[_0xc6a7('0x10')][_0xc6a7('0x13')]);return _0x537ed3(_0x2c552e[_0xc6a7('0x10')]['message']);}else{logger[_0xc6a7('0xd')](_0xc6a7('0x12'),_0x2419bf,_0xc6a7('0xe'));_0x537ed3(_0x2c552e[_0xc6a7('0x14')][_0xc6a7('0x13')]);}})[_0xc6a7('0x15')](function(_0x45a6ba){logger[_0xc6a7('0x10')](_0xc6a7('0x12'),_0x2419bf,_0x45a6ba);_0x5880c3(_0x45a6ba);});});} \ No newline at end of file +var _0x4bfb=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x49d6af,_0x26658c){var _0x32d499=function(_0xe23071){while(--_0xe23071){_0x49d6af['push'](_0x49d6af['shift']());}};_0x32d499(++_0x26658c);}(_0x4bfb,0x147));var _0xb4bf=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x4bfb[_0x4e170e];return _0x338291;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4bf('0x0'));var BPromise=require('bluebird');var rs=require(_0xb4bf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4bf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4bf('0x3'))(_0xb4bf('0x4'));var config=require(_0xb4bf('0x5'));var jayson=require(_0xb4bf('0x6'));var client=jayson[_0xb4bf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3f31,_0x1b1423,_0x4d1037){return new BPromise(function(_0x10f84b,_0x326e85){return client[_0xb4bf('0x8')](_0x2f3f31,_0x4d1037)['then'](function(_0x1086f2){logger['info'](_0xb4bf('0x9'),_0x1b1423,_0xb4bf('0xa'));logger[_0xb4bf('0xb')](_0xb4bf('0xc'),_0x1b1423,_0xb4bf('0xa'),JSON['stringify'](_0x1086f2));if(_0x1086f2['error']){if(_0x1086f2[_0xb4bf('0xd')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1b1423,_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);return _0x326e85(_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);}logger['error'](_0xb4bf('0x9'),_0x1b1423,_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);return _0x10f84b(_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);}else{logger['info'](_0xb4bf('0x9'),_0x1b1423,_0xb4bf('0xa'));_0x10f84b(_0x1086f2[_0xb4bf('0xf')][_0xb4bf('0xe')]);}})[_0xb4bf('0x10')](function(_0x5784f){logger[_0xb4bf('0xd')](_0xb4bf('0x9'),_0x1b1423,_0x5784f);_0x326e85(_0x5784f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e225ef4..795337c 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 _0x7c43=['/describe','show','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7c43,0x198));var _0x37c4=function(_0x1940cc,_0x36159d){_0x1940cc=_0x1940cc-0x0;var _0x4522cb=_0x7c43[_0x1940cc];return _0x4522cb;};'use strict';var multer=require(_0x37c4('0x0'));var util=require(_0x37c4('0x1'));var path=require('path');var timeout=require(_0x37c4('0x2'));var express=require('express');var router=express[_0x37c4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x37c4('0x4'));var interaction=require(_0x37c4('0x5'));var config=require(_0x37c4('0x6'));var controller=require('./faxTransferReport.controller');router[_0x37c4('0x7')]('/',auth[_0x37c4('0x8')](),controller[_0x37c4('0x9')]);router['get'](_0x37c4('0xa'),auth[_0x37c4('0x8')](),controller['describe']);router[_0x37c4('0x7')]('/:id',auth[_0x37c4('0x8')](),controller[_0x37c4('0xb')]);router[_0x37c4('0xc')]('/',auth[_0x37c4('0x8')](),controller[_0x37c4('0xd')]);router[_0x37c4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x37c4('0xf')]);router['delete'](_0x37c4('0x10'),auth['isAuthenticated'](),controller[_0x37c4('0x11')]);module[_0x37c4('0x12')]=router; \ No newline at end of file +var _0x4821=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x7fbfcf,_0x4ad4c8){var _0x1f9f9c=function(_0x6fd1f){while(--_0x6fd1f){_0x7fbfcf['push'](_0x7fbfcf['shift']());}};_0x1f9f9c(++_0x4ad4c8);}(_0x4821,0x165));var _0x1482=function(_0x1567a2,_0x534a3f){_0x1567a2=_0x1567a2-0x0;var _0x5b2e4e=_0x4821[_0x1567a2];return _0x5b2e4e;};'use strict';var multer=require(_0x1482('0x0'));var util=require('util');var path=require(_0x1482('0x1'));var timeout=require(_0x1482('0x2'));var express=require('express');var router=express[_0x1482('0x3')]();var fs_extra=require(_0x1482('0x4'));var auth=require(_0x1482('0x5'));var interaction=require(_0x1482('0x6'));var config=require(_0x1482('0x7'));var controller=require('./faxTransferReport.controller');router[_0x1482('0x8')]('/',auth['isAuthenticated'](),controller[_0x1482('0x9')]);router[_0x1482('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1482('0xa')]);router['get'](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0xd')]);router[_0x1482('0xe')]('/',auth[_0x1482('0xc')](),controller['create']);router[_0x1482('0xf')](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0x10')]);router[_0x1482('0x11')](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 82f843c..e5c7282 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 _0x8962=['getFields','post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x463af5,_0x58a6fa){var _0x1c2883=function(_0x5d75f9){while(--_0x5d75f9){_0x463af5['push'](_0x463af5['shift']());}};_0x1c2883(++_0x58a6fa);}(_0x8962,0x177));var _0x2896=function(_0x4437fa,_0x1b05bd){_0x4437fa=_0x4437fa-0x0;var _0x165ad4=_0x8962[_0x4437fa];return _0x165ad4;};'use strict';var multer=require(_0x2896('0x0'));var util=require(_0x2896('0x1'));var path=require('path');var timeout=require(_0x2896('0x2'));var express=require(_0x2896('0x3'));var router=express[_0x2896('0x4')]();var fs_extra=require(_0x2896('0x5'));var auth=require(_0x2896('0x6'));var interaction=require(_0x2896('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x2896('0x8')]('/',auth[_0x2896('0x9')](),controller[_0x2896('0xa')]);router[_0x2896('0x8')](_0x2896('0xb'),auth['isAuthenticated'](),controller[_0x2896('0xc')]);router[_0x2896('0x8')](_0x2896('0xd'),auth[_0x2896('0x9')](),controller[_0x2896('0xe')]);router[_0x2896('0x8')](_0x2896('0xf'),auth[_0x2896('0x9')](),controller[_0x2896('0x10')]);router[_0x2896('0x11')]('/',auth[_0x2896('0x9')](),controller['create']);router[_0x2896('0x11')]('/:id/configurations',auth[_0x2896('0x9')](),controller[_0x2896('0x12')]);router[_0x2896('0x13')](_0x2896('0xb'),auth[_0x2896('0x9')](),controller[_0x2896('0x14')]);router[_0x2896('0x15')](_0x2896('0xb'),auth[_0x2896('0x9')](),controller[_0x2896('0x16')]);module['exports']=router; \ No newline at end of file +var _0xc041=['isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id'];(function(_0x162b92,_0x579692){var _0x53bcc8=function(_0x45f90){while(--_0x45f90){_0x162b92['push'](_0x162b92['shift']());}};_0x53bcc8(++_0x579692);}(_0xc041,0xab));var _0x1c04=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0xc041[_0x1ea6eb];return _0x127200;};'use strict';var multer=require(_0x1c04('0x0'));var util=require('util');var path=require(_0x1c04('0x1'));var timeout=require(_0x1c04('0x2'));var express=require(_0x1c04('0x3'));var router=express[_0x1c04('0x4')]();var fs_extra=require(_0x1c04('0x5'));var auth=require(_0x1c04('0x6'));var interaction=require(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1c04('0x9')]);router['get'](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0xc')]);router[_0x1c04('0xd')](_0x1c04('0xe'),auth[_0x1c04('0xb')](),controller[_0x1c04('0xf')]);router[_0x1c04('0xd')](_0x1c04('0x10'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x11')]);router['post']('/',auth[_0x1c04('0xb')](),controller[_0x1c04('0x12')]);router[_0x1c04('0x13')]('/:id/configurations',auth[_0x1c04('0xb')](),controller[_0x1c04('0x14')]);router[_0x1c04('0x15')](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x16')]);router[_0x1c04('0x17')](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x18')]);module[_0x1c04('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 38d5838..364d74a 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 _0xc31f=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xc31f,0x8d));var _0xfc31=function(_0xdfdafd,_0x19713e){_0xdfdafd=_0xdfdafd-0x0;var _0x664ae1=_0xc31f[_0xdfdafd];return _0x664ae1;};'use strict';var Sequelize=require(_0xfc31('0x0'));module[_0xfc31('0x1')]={'name':{'type':Sequelize[_0xfc31('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfc31('0x2')]},'remoteUri':{'type':Sequelize[_0xfc31('0x2')]},'authType':{'type':Sequelize[_0xfc31('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xfc31('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xfc31('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xfc31('0x2')]},'serverUrl':{'type':Sequelize[_0xfc31('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfc31('0x3')](_0xfc31('0x4'),_0xfc31('0x5')),'defaultValue':_0xfc31('0x4')}}; \ No newline at end of file +var _0x87d8=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x87d8,0x9e));var _0x887d=function(_0xeead8a,_0x3d2400){_0xeead8a=_0xeead8a-0x0;var _0x24742c=_0x87d8[_0xeead8a];return _0x24742c;};'use strict';var Sequelize=require(_0x887d('0x0'));module[_0x887d('0x1')]={'name':{'type':Sequelize[_0x887d('0x2')]},'description':{'type':Sequelize[_0x887d('0x2')]},'username':{'type':Sequelize[_0x887d('0x2')]},'remoteUri':{'type':Sequelize[_0x887d('0x2')]},'authType':{'type':Sequelize[_0x887d('0x3')](_0x887d('0x4')),'defaultValue':_0x887d('0x4')},'password':{'type':Sequelize[_0x887d('0x2')]},'consumerKey':{'type':Sequelize[_0x887d('0x2')]},'consumerSecret':{'type':Sequelize[_0x887d('0x2')]},'token':{'type':Sequelize[_0x887d('0x2')]},'tokenSecret':{'type':Sequelize[_0x887d('0x2')]},'serverUrl':{'type':Sequelize[_0x887d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x887d('0x3')](_0x887d('0x5'),_0x887d('0x6')),'defaultValue':_0x887d('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 78b0c8d..b39eef3 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 _0xba04=['path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','json','apply','reject','save','update','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','keys','filters','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','authType','basic','Basic\x20%s','%s:%s','toString','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x273940,_0x56bc40){var _0x4cddde=function(_0x23eed4){while(--_0x23eed4){_0x273940['push'](_0x273940['shift']());}};_0x4cddde(++_0x56bc40);}(_0xba04,0xd8));var _0x4ba0=function(_0x4dab22,_0x59a530){_0x4dab22=_0x4dab22-0x0;var _0x515653=_0xba04[_0x4dab22];return _0x515653;};'use strict';var emlformat=require(_0x4ba0('0x0'));var rimraf=require(_0x4ba0('0x1'));var zipdir=require(_0x4ba0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ba0('0x3'));var moment=require(_0x4ba0('0x4'));var BPromise=require(_0x4ba0('0x5'));var Mustache=require(_0x4ba0('0x6'));var util=require(_0x4ba0('0x7'));var path=require(_0x4ba0('0x8'));var sox=require('sox');var csv=require(_0x4ba0('0x9'));var ejs=require(_0x4ba0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ba0('0xb'));var crypto=require(_0x4ba0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ba0('0xd'));var toCsv=require(_0x4ba0('0x9'));var querystring=require(_0x4ba0('0xe'));var Papa=require(_0x4ba0('0xf'));var Redis=require(_0x4ba0('0x10'));var authService=require(_0x4ba0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ba0('0x12'));var logger=require(_0x4ba0('0x13'))('api');var utils=require(_0x4ba0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba0('0x15'));var db=require(_0x4ba0('0x16'))['db'];var integrations=require(_0x4ba0('0x17'));function respondWithStatusCode(_0x1513ef,_0x2acc1c){_0x2acc1c=_0x2acc1c||0xcc;return function(_0x3d115f){if(_0x3d115f){return _0x1513ef[_0x4ba0('0x18')](_0x2acc1c);}return _0x1513ef[_0x4ba0('0x19')](_0x2acc1c)[_0x4ba0('0x1a')]();};}function respondWithResult(_0x45a3bd,_0x4e2a7b){_0x4e2a7b=_0x4e2a7b||0xc8;return function(_0x43facd){if(_0x43facd){return _0x45a3bd[_0x4ba0('0x19')](_0x4e2a7b)['json'](_0x43facd);}};}function respondWithFilteredResult(_0x566628,_0x5459e7){return function(_0x334330){if(_0x334330){var _0x3c9127=typeof _0x5459e7[_0x4ba0('0x1b')]===_0x4ba0('0x1c')&&typeof _0x5459e7[_0x4ba0('0x1d')]===_0x4ba0('0x1c');var _0x4850e7=_0x334330['count'];var _0xccb266=_0x3c9127?0x0:_0x5459e7[_0x4ba0('0x1b')];var _0x309bc6=_0x3c9127?_0x334330['count']:_0x5459e7['offset']+_0x5459e7[_0x4ba0('0x1d')];var _0x29ef47;if(_0x309bc6>=_0x4850e7){_0x309bc6=_0x4850e7;_0x29ef47=0xc8;}else{_0x29ef47=0xce;}_0x566628[_0x4ba0('0x19')](_0x29ef47);return _0x566628['set']('Content-Range',_0xccb266+'-'+_0x309bc6+'/'+_0x4850e7)[_0x4ba0('0x1e')](_0x334330);}return null;};}function patchUpdates(_0x50805d){return function(_0xe475ea){try{jsonpatch[_0x4ba0('0x1f')](_0xe475ea,_0x50805d,!![]);}catch(_0x4fe359){return BPromise[_0x4ba0('0x20')](_0x4fe359);}return _0xe475ea[_0x4ba0('0x21')]();};}function saveUpdates(_0x5f18d0,_0x1e25fa){return function(_0x32a829){if(_0x32a829){return _0x32a829[_0x4ba0('0x22')](_0x5f18d0)[_0x4ba0('0x23')](function(_0xc680d3){return _0xc680d3;});}return null;};}function removeEntity(_0xa4ae72,_0x26b6da){return function(_0x5685ed){if(_0x5685ed){return _0x5685ed['destroy']()[_0x4ba0('0x23')](function(){_0xa4ae72[_0x4ba0('0x19')](0xcc)[_0x4ba0('0x1a')]();});}};}function handleEntityNotFound(_0x2781bc,_0x557e38){return function(_0x47911e){if(!_0x47911e){_0x2781bc[_0x4ba0('0x18')](0x194);}return _0x47911e;};}function handleError(_0x50a300,_0xc237bb){_0xc237bb=_0xc237bb||0x1f4;return function(_0xf913f6){logger[_0x4ba0('0x24')](_0xf913f6[_0x4ba0('0x25')]);if(_0xf913f6['name']){delete _0xf913f6[_0x4ba0('0x26')];}_0x50a300['status'](_0xc237bb)[_0x4ba0('0x27')](_0xf913f6);};}exports['index']=function(_0x430e0c,_0x12de3b){var _0x1f1f2e={},_0x415f83={},_0x2d5fa0={'count':0x0,'rows':[]};var _0x1186ac=_[_0x4ba0('0x28')](db[_0x4ba0('0x29')][_0x4ba0('0x2a')],function(_0x4589bb){return{'name':_0x4589bb[_0x4ba0('0x2b')],'type':_0x4589bb[_0x4ba0('0x2c')][_0x4ba0('0x2d')]};});_0x415f83[_0x4ba0('0x2e')]=_[_0x4ba0('0x28')](_0x1186ac,'name');_0x415f83['query']=_['keys'](_0x430e0c['query']);_0x415f83['filters']=_[_0x4ba0('0x2f')](_0x415f83[_0x4ba0('0x2e')],_0x415f83['query']);_0x1f1f2e[_0x4ba0('0x30')]=_[_0x4ba0('0x2f')](_0x415f83[_0x4ba0('0x2e')],qs['fields'](_0x430e0c[_0x4ba0('0x31')][_0x4ba0('0x32')]));_0x1f1f2e[_0x4ba0('0x30')]=_0x1f1f2e['attributes'][_0x4ba0('0x33')]?_0x1f1f2e[_0x4ba0('0x30')]:_0x415f83[_0x4ba0('0x2e')];if(!_0x430e0c['query'][_0x4ba0('0x34')]('nolimit')){_0x1f1f2e[_0x4ba0('0x1d')]=qs[_0x4ba0('0x1d')](_0x430e0c['query'][_0x4ba0('0x1d')]);_0x1f1f2e[_0x4ba0('0x1b')]=qs[_0x4ba0('0x1b')](_0x430e0c[_0x4ba0('0x31')][_0x4ba0('0x1b')]);}_0x1f1f2e[_0x4ba0('0x35')]=qs[_0x4ba0('0x36')](_0x430e0c[_0x4ba0('0x31')][_0x4ba0('0x36')]);_0x1f1f2e[_0x4ba0('0x37')]=qs['filters'](_[_0x4ba0('0x38')](_0x430e0c[_0x4ba0('0x31')],_0x415f83['filters']),_0x1186ac);if(_0x430e0c['query'][_0x4ba0('0x39')]){_0x1f1f2e[_0x4ba0('0x37')]=_['merge'](_0x1f1f2e['where'],{'$or':_[_0x4ba0('0x28')](_0x1186ac,function(_0x5538c9){if(_0x5538c9[_0x4ba0('0x2c')]!=='VIRTUAL'){var _0x33e8aa={};_0x33e8aa[_0x5538c9[_0x4ba0('0x26')]]={'$like':'%'+_0x430e0c[_0x4ba0('0x31')][_0x4ba0('0x39')]+'%'};return _0x33e8aa;}})});}_0x1f1f2e=_[_0x4ba0('0x3a')]({},_0x1f1f2e,_0x430e0c[_0x4ba0('0x3b')]);var _0x5a19c9={'where':_0x1f1f2e['where']};return db['DeskAccount'][_0x4ba0('0x3c')](_0x5a19c9)['then'](function(_0x291b77){_0x2d5fa0[_0x4ba0('0x3c')]=_0x291b77;if(_0x430e0c[_0x4ba0('0x31')][_0x4ba0('0x3d')]){_0x1f1f2e[_0x4ba0('0x3e')]=[{'all':!![]}];}return db[_0x4ba0('0x29')]['findAll'](_0x1f1f2e);})[_0x4ba0('0x23')](function(_0x303732){_0x2d5fa0[_0x4ba0('0x3f')]=_0x303732;return _0x2d5fa0;})[_0x4ba0('0x23')](respondWithFilteredResult(_0x12de3b,_0x1f1f2e))[_0x4ba0('0x40')](handleError(_0x12de3b,null));};exports[_0x4ba0('0x41')]=function(_0x648863,_0x2cbe76){var _0x43276c={'raw':![],'where':{'id':_0x648863[_0x4ba0('0x42')]['id']}},_0x229aa2={};_0x229aa2[_0x4ba0('0x2e')]=_[_0x4ba0('0x43')](db[_0x4ba0('0x29')]['rawAttributes']);_0x229aa2[_0x4ba0('0x31')]=_[_0x4ba0('0x43')](_0x648863[_0x4ba0('0x31')]);_0x229aa2[_0x4ba0('0x44')]=_[_0x4ba0('0x2f')](_0x229aa2['model'],_0x229aa2['query']);_0x43276c['attributes']=_[_0x4ba0('0x2f')](_0x229aa2[_0x4ba0('0x2e')],qs[_0x4ba0('0x32')](_0x648863[_0x4ba0('0x31')]['fields']));_0x43276c[_0x4ba0('0x30')]=_0x43276c[_0x4ba0('0x30')][_0x4ba0('0x33')]?_0x43276c[_0x4ba0('0x30')]:_0x229aa2[_0x4ba0('0x2e')];if(_0x648863[_0x4ba0('0x31')][_0x4ba0('0x3d')]){_0x43276c[_0x4ba0('0x3e')]=[{'all':!![]}];}_0x43276c=_[_0x4ba0('0x3a')]({},_0x43276c,_0x648863[_0x4ba0('0x3b')]);return db[_0x4ba0('0x29')][_0x4ba0('0x45')](_0x43276c)[_0x4ba0('0x23')](handleEntityNotFound(_0x2cbe76,null))['then'](respondWithResult(_0x2cbe76,null))[_0x4ba0('0x40')](handleError(_0x2cbe76,null));};exports[_0x4ba0('0x46')]=function(_0x503e01,_0xff508d){return db[_0x4ba0('0x29')][_0x4ba0('0x46')](_0x503e01['body'],{})[_0x4ba0('0x23')](respondWithResult(_0xff508d,0xc9))[_0x4ba0('0x40')](handleError(_0xff508d,null));};exports[_0x4ba0('0x22')]=function(_0x581dd9,_0x264fea){if(_0x581dd9[_0x4ba0('0x47')]['id']){delete _0x581dd9[_0x4ba0('0x47')]['id'];}return db[_0x4ba0('0x29')][_0x4ba0('0x45')]({'where':{'id':_0x581dd9[_0x4ba0('0x42')]['id']}})[_0x4ba0('0x23')](handleEntityNotFound(_0x264fea,null))[_0x4ba0('0x23')](saveUpdates(_0x581dd9['body'],null))[_0x4ba0('0x23')](respondWithResult(_0x264fea,null))['catch'](handleError(_0x264fea,null));};exports[_0x4ba0('0x48')]=function(_0x2103c3,_0x40878f){return db[_0x4ba0('0x29')]['find']({'where':{'id':_0x2103c3[_0x4ba0('0x42')]['id']}})['then'](handleEntityNotFound(_0x40878f,null))[_0x4ba0('0x23')](removeEntity(_0x40878f,null))[_0x4ba0('0x40')](handleError(_0x40878f,null));};exports[_0x4ba0('0x49')]=function(_0x494452,_0x45e3c2,_0x2b09c0){var _0x3739c9={};var _0x3c83ba={};var _0x181752;var _0x4a7686;return db[_0x4ba0('0x29')][_0x4ba0('0x4a')]({'where':{'id':_0x494452['params']['id']}})[_0x4ba0('0x23')](handleEntityNotFound(_0x45e3c2,null))['then'](function(_0x2e7832){if(_0x2e7832){_0x181752=_0x2e7832;_0x3c83ba[_0x4ba0('0x2e')]=_[_0x4ba0('0x43')](db[_0x4ba0('0x4b')]['rawAttributes']);_0x3c83ba[_0x4ba0('0x31')]=_[_0x4ba0('0x43')](_0x494452[_0x4ba0('0x31')]);_0x3c83ba[_0x4ba0('0x44')]=_['intersection'](_0x3c83ba['model'],_0x3c83ba[_0x4ba0('0x31')]);_0x3739c9[_0x4ba0('0x30')]=_['intersection'](_0x3c83ba[_0x4ba0('0x2e')],qs[_0x4ba0('0x32')](_0x494452[_0x4ba0('0x31')][_0x4ba0('0x32')]));_0x3739c9[_0x4ba0('0x30')]=_0x3739c9[_0x4ba0('0x30')]['length']?_0x3739c9['attributes']:_0x3c83ba['model'];_0x3739c9[_0x4ba0('0x35')]=qs[_0x4ba0('0x36')](_0x494452[_0x4ba0('0x31')][_0x4ba0('0x36')]);_0x3739c9[_0x4ba0('0x37')]=qs[_0x4ba0('0x44')](_[_0x4ba0('0x38')](_0x494452[_0x4ba0('0x31')],_0x3c83ba[_0x4ba0('0x44')]));if(_0x494452[_0x4ba0('0x31')][_0x4ba0('0x39')]){_0x3739c9[_0x4ba0('0x37')]=_[_0x4ba0('0x3a')](_0x3739c9[_0x4ba0('0x37')],{'$or':_['map'](_0x3739c9[_0x4ba0('0x30')],function(_0x527f67){var _0x515cf4={};_0x515cf4[_0x527f67]={'$like':'%'+_0x494452[_0x4ba0('0x31')][_0x4ba0('0x39')]+'%'};return _0x515cf4;})});}_0x3739c9=_[_0x4ba0('0x3a')]({},_0x3739c9,_0x494452[_0x4ba0('0x3b')]);return _0x181752[_0x4ba0('0x49')](_0x3739c9);}})[_0x4ba0('0x23')](function(_0x4c3513){if(_0x4c3513){_0x4a7686=_0x4c3513[_0x4ba0('0x33')];if(!_0x494452['query'][_0x4ba0('0x34')](_0x4ba0('0x4c'))){_0x3739c9[_0x4ba0('0x1d')]=qs[_0x4ba0('0x1d')](_0x494452[_0x4ba0('0x31')][_0x4ba0('0x1d')]);_0x3739c9[_0x4ba0('0x1b')]=qs[_0x4ba0('0x1b')](_0x494452[_0x4ba0('0x31')][_0x4ba0('0x1b')]);}return _0x181752[_0x4ba0('0x49')](_0x3739c9);}})['then'](function(_0x2901b7){if(_0x2901b7){return _0x2901b7?{'count':_0x4a7686,'rows':_0x2901b7}:null;}})[_0x4ba0('0x23')](respondWithResult(_0x45e3c2,null))[_0x4ba0('0x40')](handleError(_0x45e3c2,null));};exports[_0x4ba0('0x4d')]=function(_0x4863e3,_0x11f8a6,_0x204fca){if(_0x4863e3['body']['id']){delete _0x4863e3[_0x4ba0('0x47')]['id'];}return db[_0x4ba0('0x29')]['findOne']({'where':{'id':_0x4863e3[_0x4ba0('0x42')]['id']}})[_0x4ba0('0x23')](handleEntityNotFound(_0x11f8a6,null))[_0x4ba0('0x23')](function(_0x33409f){if(_0x33409f){_0x4863e3[_0x4ba0('0x47')]['AccountId']=_0x33409f['id'];_0x4863e3['body'][_0x4ba0('0x4e')]=integrations[_0x4ba0('0x4f')](_0x4863e3[_0x4ba0('0x47')][_0x4ba0('0x50')],_0x4863e3['body']['type']);_0x4863e3[_0x4ba0('0x47')][_0x4ba0('0x51')]=integrations[_0x4ba0('0x52')](_0x4863e3[_0x4ba0('0x47')][_0x4ba0('0x50')],_0x4863e3[_0x4ba0('0x47')][_0x4ba0('0x2c')]);return db['DeskConfiguration'][_0x4ba0('0x46')](_0x4863e3[_0x4ba0('0x47')],{'include':[{'model':db[_0x4ba0('0x53')],'as':_0x4ba0('0x4e')},{'model':db[_0x4ba0('0x53')],'as':_0x4ba0('0x51')}]});}return null;})[_0x4ba0('0x23')](respondWithResult(_0x11f8a6,null))['catch'](handleError(_0x11f8a6,null));};exports[_0x4ba0('0x54')]=function(_0xb93e83,_0x201646,_0x13dea6){var _0x2fff05=[{'name':_0x4ba0('0x55'),'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 _0x23473d='';return db['DeskAccount'][_0x4ba0('0x4a')]({'where':{'id':_0xb93e83['params']['id']},'attributes':['id',_0x4ba0('0x56'),'authType',_0x4ba0('0x57'),_0x4ba0('0x58'),_0x4ba0('0x59'),_0x4ba0('0x5a'),_0x4ba0('0x5b'),_0x4ba0('0x5c')]})[_0x4ba0('0x23')](handleEntityNotFound(_0x201646,null))[_0x4ba0('0x23')](function(_0x23a330){if(_0x23a330){_0x23473d=_0x23a330[_0x4ba0('0x56')];var _0x1ebb67=_0x23473d[_0x4ba0('0x5d')](-0x1);if(_0x1ebb67==='/'){_0x23473d=_0x23473d['substring'](0x0,_0x23473d['lastIndexOf'](_0x1ebb67));}var _0x1e0ef1={'method':_0x4ba0('0x5e'),'uri':util[_0x4ba0('0x5f')](_0x4ba0('0x60'),_0x23473d),'headers':{'Content-Type':_0x4ba0('0x61'),'Accept':_0x4ba0('0x61')},'json':!![]};if(_0x23a330[_0x4ba0('0x62')]===_0x4ba0('0x63')){_0x1e0ef1['headers']['Authorization']=util[_0x4ba0('0x5f')](_0x4ba0('0x64'),new Buffer(util[_0x4ba0('0x5f')](_0x4ba0('0x65'),_0x23a330[_0x4ba0('0x57')],_0x23a330[_0x4ba0('0x58')]))[_0x4ba0('0x66')]('base64'));}return rp(_0x1e0ef1)[_0x4ba0('0x23')](function(_0x352452){return _0x2fff05[_0x4ba0('0x67')](_['map'](_0x352452[_0x4ba0('0x68')]['entries'],function(_0x5cbc76){return{'id':_0x5cbc76[_0x4ba0('0x26')],'name':_0x5cbc76[_0x4ba0('0x26')],'type':_0x5cbc76[_0x4ba0('0x2c')],'active':_0x5cbc76[_0x4ba0('0x69')],'label':_0x5cbc76[_0x4ba0('0x6a')],'custom':!![]};}));});}})['then'](function(_0x37fb01){return{'count':_0x37fb01[_0x4ba0('0x33')],'rows':_0x37fb01};})[_0x4ba0('0x23')](respondWithResult(_0x201646,null))[_0x4ba0('0x40')](function(_0x112391){var _0x149591=_0xb93e83[_0x4ba0('0x31')]['test']?0x1f4:_0x112391[_0x4ba0('0x6b')]||0x1f4;logger[_0x4ba0('0x24')](_0x4ba0('0x6c'),_0x4ba0('0x54'),_0x149591,JSON[_0x4ba0('0x6d')](_0x112391));delete _0x112391[_0x4ba0('0x26')];if(_0x149591===0x191){_0x149591=0x190;}_0x201646[_0x4ba0('0x19')](_0x149591)[_0x4ba0('0x27')](_0xb93e83['query'][_0x4ba0('0x6e')]?{'message':_0x4ba0('0x6f'),'statusCode':_0x112391['statusCode']}:_0x112391);});}; \ No newline at end of file +var _0x8408=['create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','options','find'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x8408,0x9d));var _0x8840=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x8408[_0x4e90e3];return _0x295e5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8840('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8840('0x1'));var rp=require(_0x8840('0x2'));var moment=require('moment');var BPromise=require(_0x8840('0x3'));var Mustache=require(_0x8840('0x4'));var util=require('util');var path=require(_0x8840('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8840('0x6'));var fs=require('fs');var fs_extra=require(_0x8840('0x7'));var _=require(_0x8840('0x8'));var squel=require(_0x8840('0x9'));var crypto=require(_0x8840('0xa'));var jsforce=require(_0x8840('0xb'));var deskjs=require(_0x8840('0xc'));var toCsv=require(_0x8840('0xd'));var querystring=require(_0x8840('0xe'));var Papa=require('papaparse');var Redis=require(_0x8840('0xf'));var authService=require(_0x8840('0x10'));var qs=require(_0x8840('0x11'));var as=require(_0x8840('0x12'));var hardwareService=require(_0x8840('0x13'));var logger=require(_0x8840('0x14'))(_0x8840('0x15'));var utils=require(_0x8840('0x16'));var config=require(_0x8840('0x17'));var licenseUtil=require(_0x8840('0x18'));var db=require(_0x8840('0x19'))['db'];var integrations=require(_0x8840('0x1a'));function respondWithStatusCode(_0x5d48ae,_0x5122be){_0x5122be=_0x5122be||0xcc;return function(_0x2e8459){if(_0x2e8459){return _0x5d48ae[_0x8840('0x1b')](_0x5122be);}return _0x5d48ae[_0x8840('0x1c')](_0x5122be)['end']();};}function respondWithResult(_0x503381,_0x572e38){_0x572e38=_0x572e38||0xc8;return function(_0xe05ce1){if(_0xe05ce1){return _0x503381[_0x8840('0x1c')](_0x572e38)[_0x8840('0x1d')](_0xe05ce1);}};}function respondWithFilteredResult(_0x365619,_0x38e387){return function(_0x14b19c){if(_0x14b19c){var _0x3779a5=typeof _0x38e387[_0x8840('0x1e')]===_0x8840('0x1f')&&typeof _0x38e387['limit']===_0x8840('0x1f');var _0x4798ba=_0x14b19c[_0x8840('0x20')];var _0x2bef3e=_0x3779a5?0x0:_0x38e387[_0x8840('0x1e')];var _0x21cee4=_0x3779a5?_0x14b19c[_0x8840('0x20')]:_0x38e387['offset']+_0x38e387['limit'];var _0x463a92;if(_0x21cee4>=_0x4798ba){_0x21cee4=_0x4798ba;_0x463a92=0xc8;}else{_0x463a92=0xce;}_0x365619[_0x8840('0x1c')](_0x463a92);return _0x365619[_0x8840('0x21')](_0x8840('0x22'),_0x2bef3e+'-'+_0x21cee4+'/'+_0x4798ba)[_0x8840('0x1d')](_0x14b19c);}return null;};}function patchUpdates(_0x1c36f7){return function(_0x386fb8){try{jsonpatch[_0x8840('0x23')](_0x386fb8,_0x1c36f7,!![]);}catch(_0x58d138){return BPromise['reject'](_0x58d138);}return _0x386fb8[_0x8840('0x24')]();};}function saveUpdates(_0x2f1c90,_0x615b96){return function(_0x42d2c8){if(_0x42d2c8){return _0x42d2c8[_0x8840('0x25')](_0x2f1c90)[_0x8840('0x26')](function(_0x378747){return _0x378747;});}return null;};}function removeEntity(_0x75477b,_0x20c211){return function(_0x2e7fa1){if(_0x2e7fa1){return _0x2e7fa1[_0x8840('0x27')]()[_0x8840('0x26')](function(){_0x75477b['status'](0xcc)[_0x8840('0x28')]();});}};}function handleEntityNotFound(_0x29b407,_0x4d8693){return function(_0x3dba9a){if(!_0x3dba9a){_0x29b407[_0x8840('0x1b')](0x194);}return _0x3dba9a;};}function handleError(_0x87e4c4,_0x44ef22){_0x44ef22=_0x44ef22||0x1f4;return function(_0xcf432a){logger[_0x8840('0x29')](_0xcf432a['stack']);if(_0xcf432a[_0x8840('0x2a')]){delete _0xcf432a['name'];}_0x87e4c4[_0x8840('0x1c')](_0x44ef22)[_0x8840('0x2b')](_0xcf432a);};}exports['index']=function(_0x5295e7,_0x5b9838){var _0x2b43d7={},_0x7027f6={},_0x1028df={'count':0x0,'rows':[]};var _0x41db0b=_[_0x8840('0x2c')](db[_0x8840('0x2d')][_0x8840('0x2e')],function(_0xf103ee){return{'name':_0xf103ee[_0x8840('0x2f')],'type':_0xf103ee[_0x8840('0x30')][_0x8840('0x31')]};});_0x7027f6[_0x8840('0x32')]=_[_0x8840('0x2c')](_0x41db0b,'name');_0x7027f6[_0x8840('0x33')]=_[_0x8840('0x34')](_0x5295e7[_0x8840('0x33')]);_0x7027f6[_0x8840('0x35')]=_[_0x8840('0x36')](_0x7027f6['model'],_0x7027f6[_0x8840('0x33')]);_0x2b43d7[_0x8840('0x37')]=_[_0x8840('0x36')](_0x7027f6[_0x8840('0x32')],qs[_0x8840('0x38')](_0x5295e7[_0x8840('0x33')][_0x8840('0x38')]));_0x2b43d7[_0x8840('0x37')]=_0x2b43d7['attributes']['length']?_0x2b43d7['attributes']:_0x7027f6[_0x8840('0x32')];if(!_0x5295e7[_0x8840('0x33')]['hasOwnProperty'](_0x8840('0x39'))){_0x2b43d7[_0x8840('0x3a')]=qs['limit'](_0x5295e7[_0x8840('0x33')][_0x8840('0x3a')]);_0x2b43d7['offset']=qs['offset'](_0x5295e7[_0x8840('0x33')][_0x8840('0x1e')]);}_0x2b43d7[_0x8840('0x3b')]=qs[_0x8840('0x3c')](_0x5295e7['query']['sort']);_0x2b43d7[_0x8840('0x3d')]=qs['filters'](_[_0x8840('0x3e')](_0x5295e7[_0x8840('0x33')],_0x7027f6['filters']),_0x41db0b);if(_0x5295e7[_0x8840('0x33')][_0x8840('0x3f')]){_0x2b43d7[_0x8840('0x3d')]=_[_0x8840('0x40')](_0x2b43d7['where'],{'$or':_[_0x8840('0x2c')](_0x41db0b,function(_0x281951){if(_0x281951[_0x8840('0x30')]!==_0x8840('0x41')){var _0x49b061={};_0x49b061[_0x281951[_0x8840('0x2a')]]={'$like':'%'+_0x5295e7[_0x8840('0x33')][_0x8840('0x3f')]+'%'};return _0x49b061;}})});}_0x2b43d7=_[_0x8840('0x40')]({},_0x2b43d7,_0x5295e7['options']);var _0x11ebe9={'where':_0x2b43d7['where']};return db[_0x8840('0x2d')][_0x8840('0x20')](_0x11ebe9)[_0x8840('0x26')](function(_0x5b2aba){_0x1028df['count']=_0x5b2aba;if(_0x5295e7[_0x8840('0x33')]['includeAll']){_0x2b43d7[_0x8840('0x42')]=[{'all':!![]}];}return db[_0x8840('0x2d')][_0x8840('0x43')](_0x2b43d7);})[_0x8840('0x26')](function(_0x1d194d){_0x1028df[_0x8840('0x44')]=_0x1d194d;return _0x1028df;})[_0x8840('0x26')](respondWithFilteredResult(_0x5b9838,_0x2b43d7))[_0x8840('0x45')](handleError(_0x5b9838,null));};exports[_0x8840('0x46')]=function(_0x5d87c5,_0x4951b6){var _0x489903={'raw':![],'where':{'id':_0x5d87c5[_0x8840('0x47')]['id']}},_0x2ab187={};_0x2ab187[_0x8840('0x32')]=_[_0x8840('0x34')](db[_0x8840('0x2d')][_0x8840('0x2e')]);_0x2ab187[_0x8840('0x33')]=_[_0x8840('0x34')](_0x5d87c5[_0x8840('0x33')]);_0x2ab187[_0x8840('0x35')]=_[_0x8840('0x36')](_0x2ab187[_0x8840('0x32')],_0x2ab187['query']);_0x489903['attributes']=_['intersection'](_0x2ab187[_0x8840('0x32')],qs['fields'](_0x5d87c5[_0x8840('0x33')][_0x8840('0x38')]));_0x489903[_0x8840('0x37')]=_0x489903['attributes'][_0x8840('0x48')]?_0x489903[_0x8840('0x37')]:_0x2ab187[_0x8840('0x32')];if(_0x5d87c5[_0x8840('0x33')]['includeAll']){_0x489903[_0x8840('0x42')]=[{'all':!![]}];}_0x489903=_['merge']({},_0x489903,_0x5d87c5[_0x8840('0x49')]);return db[_0x8840('0x2d')][_0x8840('0x4a')](_0x489903)[_0x8840('0x26')](handleEntityNotFound(_0x4951b6,null))[_0x8840('0x26')](respondWithResult(_0x4951b6,null))['catch'](handleError(_0x4951b6,null));};exports[_0x8840('0x4b')]=function(_0x20a40d,_0x3a5acf){return db[_0x8840('0x2d')][_0x8840('0x4b')](_0x20a40d[_0x8840('0x4c')],{})['then'](respondWithResult(_0x3a5acf,0xc9))[_0x8840('0x45')](handleError(_0x3a5acf,null));};exports[_0x8840('0x25')]=function(_0x2fda33,_0x4e75d1){if(_0x2fda33['body']['id']){delete _0x2fda33['body']['id'];}return db['DeskAccount'][_0x8840('0x4a')]({'where':{'id':_0x2fda33['params']['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x4e75d1,null))['then'](saveUpdates(_0x2fda33[_0x8840('0x4c')],null))[_0x8840('0x26')](respondWithResult(_0x4e75d1,null))[_0x8840('0x45')](handleError(_0x4e75d1,null));};exports['destroy']=function(_0x27669e,_0x4c44f0){return db[_0x8840('0x2d')][_0x8840('0x4a')]({'where':{'id':_0x27669e[_0x8840('0x47')]['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x4c44f0,null))[_0x8840('0x26')](removeEntity(_0x4c44f0,null))[_0x8840('0x45')](handleError(_0x4c44f0,null));};exports[_0x8840('0x4d')]=function(_0x148f60,_0x380878,_0x10a9b5){var _0x1e6b96={};var _0x5e13a7={};var _0x2372b4;var _0x2f6ad9;return db[_0x8840('0x2d')][_0x8840('0x4e')]({'where':{'id':_0x148f60[_0x8840('0x47')]['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x380878,null))['then'](function(_0x1ca3bd){if(_0x1ca3bd){_0x2372b4=_0x1ca3bd;_0x5e13a7[_0x8840('0x32')]=_[_0x8840('0x34')](db[_0x8840('0x4f')][_0x8840('0x2e')]);_0x5e13a7[_0x8840('0x33')]=_[_0x8840('0x34')](_0x148f60[_0x8840('0x33')]);_0x5e13a7[_0x8840('0x35')]=_[_0x8840('0x36')](_0x5e13a7[_0x8840('0x32')],_0x5e13a7[_0x8840('0x33')]);_0x1e6b96[_0x8840('0x37')]=_[_0x8840('0x36')](_0x5e13a7[_0x8840('0x32')],qs[_0x8840('0x38')](_0x148f60[_0x8840('0x33')][_0x8840('0x38')]));_0x1e6b96['attributes']=_0x1e6b96[_0x8840('0x37')][_0x8840('0x48')]?_0x1e6b96[_0x8840('0x37')]:_0x5e13a7[_0x8840('0x32')];_0x1e6b96[_0x8840('0x3b')]=qs[_0x8840('0x3c')](_0x148f60['query']['sort']);_0x1e6b96[_0x8840('0x3d')]=qs['filters'](_[_0x8840('0x3e')](_0x148f60[_0x8840('0x33')],_0x5e13a7[_0x8840('0x35')]));if(_0x148f60[_0x8840('0x33')][_0x8840('0x3f')]){_0x1e6b96[_0x8840('0x3d')]=_[_0x8840('0x40')](_0x1e6b96[_0x8840('0x3d')],{'$or':_['map'](_0x1e6b96[_0x8840('0x37')],function(_0x2b4a9a){var _0x42f640={};_0x42f640[_0x2b4a9a]={'$like':'%'+_0x148f60[_0x8840('0x33')][_0x8840('0x3f')]+'%'};return _0x42f640;})});}_0x1e6b96=_[_0x8840('0x40')]({},_0x1e6b96,_0x148f60[_0x8840('0x49')]);return _0x2372b4['getConfigurations'](_0x1e6b96);}})[_0x8840('0x26')](function(_0x190139){if(_0x190139){_0x2f6ad9=_0x190139[_0x8840('0x48')];if(!_0x148f60['query'][_0x8840('0x50')](_0x8840('0x39'))){_0x1e6b96[_0x8840('0x3a')]=qs['limit'](_0x148f60['query'][_0x8840('0x3a')]);_0x1e6b96[_0x8840('0x1e')]=qs['offset'](_0x148f60[_0x8840('0x33')]['offset']);}return _0x2372b4[_0x8840('0x4d')](_0x1e6b96);}})[_0x8840('0x26')](function(_0x1ed838){if(_0x1ed838){return _0x1ed838?{'count':_0x2f6ad9,'rows':_0x1ed838}:null;}})['then'](respondWithResult(_0x380878,null))['catch'](handleError(_0x380878,null));};exports['addConfiguration']=function(_0x6c5fe5,_0x25f866,_0x1df552){if(_0x6c5fe5[_0x8840('0x4c')]['id']){delete _0x6c5fe5[_0x8840('0x4c')]['id'];}return db[_0x8840('0x2d')][_0x8840('0x4e')]({'where':{'id':_0x6c5fe5['params']['id']}})['then'](handleEntityNotFound(_0x25f866,null))[_0x8840('0x26')](function(_0x673f90){if(_0x673f90){_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x51')]=_0x673f90['id'];_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x52')]=integrations[_0x8840('0x53')](_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x54')],_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x30')]);_0x6c5fe5[_0x8840('0x4c')]['Descriptions']=integrations[_0x8840('0x55')](_0x6c5fe5[_0x8840('0x4c')]['channel'],_0x6c5fe5['body'][_0x8840('0x30')]);return db['DeskConfiguration'][_0x8840('0x4b')](_0x6c5fe5[_0x8840('0x4c')],{'include':[{'model':db[_0x8840('0x56')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x8840('0x57')}]});}return null;})[_0x8840('0x26')](respondWithResult(_0x25f866,null))[_0x8840('0x45')](handleError(_0x25f866,null));};exports[_0x8840('0x58')]=function(_0xeb7b7e,_0x793989,_0x564804){var _0x3188fb=[{'name':'priority','label':_0x8840('0x59'),'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 _0x2fef6e='';return db['DeskAccount'][_0x8840('0x4e')]({'where':{'id':_0xeb7b7e['params']['id']},'attributes':['id','remoteUri',_0x8840('0x5a'),_0x8840('0x5b'),_0x8840('0x5c'),'consumerKey',_0x8840('0x5d'),_0x8840('0x5e'),_0x8840('0x5f')]})['then'](handleEntityNotFound(_0x793989,null))[_0x8840('0x26')](function(_0x110e55){if(_0x110e55){_0x2fef6e=_0x110e55['remoteUri'];var _0x34108c=_0x2fef6e[_0x8840('0x60')](-0x1);if(_0x34108c==='/'){_0x2fef6e=_0x2fef6e[_0x8840('0x61')](0x0,_0x2fef6e[_0x8840('0x62')](_0x34108c));}var _0x411413={'method':_0x8840('0x63'),'uri':util[_0x8840('0x64')](_0x8840('0x65'),_0x2fef6e),'headers':{'Content-Type':_0x8840('0x66'),'Accept':'application/json'},'json':!![]};if(_0x110e55['authType']===_0x8840('0x67')){_0x411413['headers'][_0x8840('0x68')]=util['format'](_0x8840('0x69'),new Buffer(util['format'](_0x8840('0x6a'),_0x110e55[_0x8840('0x5b')],_0x110e55[_0x8840('0x5c')]))[_0x8840('0x6b')]('base64'));}return rp(_0x411413)[_0x8840('0x26')](function(_0x2a77f7){return _0x3188fb['concat'](_[_0x8840('0x2c')](_0x2a77f7[_0x8840('0x6c')][_0x8840('0x6d')],function(_0x354f0b){return{'id':_0x354f0b[_0x8840('0x2a')],'name':_0x354f0b[_0x8840('0x2a')],'type':_0x354f0b[_0x8840('0x30')],'active':_0x354f0b[_0x8840('0x6e')],'label':_0x354f0b[_0x8840('0x6f')],'custom':!![]};}));});}})['then'](function(_0x554e47){return{'count':_0x554e47[_0x8840('0x48')],'rows':_0x554e47};})[_0x8840('0x26')](respondWithResult(_0x793989,null))[_0x8840('0x45')](function(_0x5ae6bb){var _0x4bde03=_0xeb7b7e[_0x8840('0x33')][_0x8840('0x70')]?0x1f4:_0x5ae6bb[_0x8840('0x71')]||0x1f4;logger[_0x8840('0x29')](_0x8840('0x72'),'getFields',_0x4bde03,JSON[_0x8840('0x73')](_0x5ae6bb));delete _0x5ae6bb[_0x8840('0x2a')];if(_0x4bde03===0x191){_0x4bde03=0x190;}_0x793989[_0x8840('0x1c')](_0x4bde03)[_0x8840('0x2b')](_0xeb7b7e[_0x8840('0x33')][_0x8840('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x5ae6bb[_0x8840('0x71')]}:_0x5ae6bb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 51fc804..4462154 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 _0xbd9b=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xbd9b,0x77));var _0xbbd9=function(_0x2e4a1c,_0x4bf96f){_0x2e4a1c=_0x2e4a1c-0x0;var _0x8c2c74=_0xbd9b[_0x2e4a1c];return _0x8c2c74;};'use strict';var _=require('lodash');var util=require(_0xbbd9('0x0'));var logger=require(_0xbbd9('0x1'))('api');var moment=require(_0xbbd9('0x2'));var BPromise=require(_0xbbd9('0x3'));var rp=require(_0xbbd9('0x4'));var fs=require('fs');var path=require(_0xbbd9('0x5'));var rimraf=require(_0xbbd9('0x6'));var config=require(_0xbbd9('0x7'));var attributes=require(_0xbbd9('0x8'));var integrations=require(_0xbbd9('0x9'));module[_0xbbd9('0xa')]=function(_0x2f88d2,_0x4c1376){return _0x2f88d2[_0xbbd9('0xb')](_0xbbd9('0xc'),attributes,{'tableName':_0xbbd9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabbf=['../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','request-promise','rimraf','./intDeskAccount.attributes'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xabbf,0x1d0));var _0xfabb=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xabbf[_0x5951e8];return _0x20a1f5;};'use strict';var _=require(_0xfabb('0x0'));var util=require('util');var logger=require(_0xfabb('0x1'))('api');var moment=require(_0xfabb('0x2'));var BPromise=require('bluebird');var rp=require(_0xfabb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfabb('0x4'));var config=require('../../config/environment');var attributes=require(_0xfabb('0x5'));var integrations=require(_0xfabb('0x6'));module[_0xfabb('0x7')]=function(_0x94550c,_0xec10c3){return _0x94550c['define'](_0xfabb('0x8'),attributes,{'tableName':_0xfabb('0x9'),'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 3e4ebb6..f97b6e9 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 _0xd2a4=['message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowDeskAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x246b17,_0x17f237){var _0x3cd550=function(_0x372d0a){while(--_0x372d0a){_0x246b17['push'](_0x246b17['shift']());}};_0x3cd550(++_0x17f237);}(_0xd2a4,0x83));var _0x4d2a=function(_0x3a028b,_0x43a9f5){_0x3a028b=_0x3a028b-0x0;var _0x162f94=_0xd2a4[_0x3a028b];return _0x162f94;};'use strict';var _=require('lodash');var util=require(_0x4d2a('0x0'));var moment=require(_0x4d2a('0x1'));var BPromise=require(_0x4d2a('0x2'));var rs=require(_0x4d2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d2a('0x4'))['db'];var utils=require(_0x4d2a('0x5'));var logger=require(_0x4d2a('0x6'))(_0x4d2a('0x7'));var config=require(_0x4d2a('0x8'));var jayson=require(_0x4d2a('0x9'));var client=jayson[_0x4d2a('0xa')][_0x4d2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x530510,_0x39a5a3,_0x23c830){return new BPromise(function(_0x40e122,_0x537261){return client[_0x4d2a('0xc')](_0x530510,_0x23c830)[_0x4d2a('0xd')](function(_0x1aa3cb){logger[_0x4d2a('0xe')](_0x4d2a('0xf'),_0x39a5a3,_0x4d2a('0x10'));logger['debug'](_0x4d2a('0x11'),_0x39a5a3,_0x4d2a('0x10'),JSON[_0x4d2a('0x12')](_0x1aa3cb));if(_0x1aa3cb[_0x4d2a('0x13')]){if(_0x1aa3cb[_0x4d2a('0x13')][_0x4d2a('0x14')]===0x1f4){logger[_0x4d2a('0x13')]('DeskAccount,\x20%s,\x20%s',_0x39a5a3,_0x1aa3cb['error'][_0x4d2a('0x15')]);return _0x537261(_0x1aa3cb['error']['message']);}logger['error'](_0x4d2a('0xf'),_0x39a5a3,_0x1aa3cb[_0x4d2a('0x13')]['message']);return _0x40e122(_0x1aa3cb[_0x4d2a('0x13')][_0x4d2a('0x15')]);}else{logger[_0x4d2a('0xe')](_0x4d2a('0xf'),_0x39a5a3,_0x4d2a('0x10'));_0x40e122(_0x1aa3cb[_0x4d2a('0x16')][_0x4d2a('0x15')]);}})[_0x4d2a('0x17')](function(_0x67db2a){logger[_0x4d2a('0x13')]('DeskAccount,\x20%s,\x20%s',_0x39a5a3,_0x67db2a);_0x537261(_0x67db2a);});});}exports[_0x4d2a('0x18')]=function(_0x56c1aa){var _0x16e345=this;return new Promise(function(_0x3ac168,_0x5e98b6){return db[_0x4d2a('0x19')][_0x4d2a('0x1a')]({'raw':_0x56c1aa[_0x4d2a('0x1b')]?_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x56c1aa[_0x4d2a('0x1b')]?_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x1d')]||null:null,'attributes':_0x56c1aa[_0x4d2a('0x1b')]?_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x1e')]||null:null,'limit':_0x56c1aa[_0x4d2a('0x1b')]?_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x1f')]||null:null,'include':_0x56c1aa['options']?_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x20')]?_[_0x4d2a('0x21')](_0x56c1aa[_0x4d2a('0x1b')][_0x4d2a('0x20')],function(_0x596b8e){return{'model':db[_0x596b8e[_0x4d2a('0x22')]],'as':_0x596b8e['as'],'attributes':_0x596b8e[_0x4d2a('0x1e')],'include':_0x596b8e[_0x4d2a('0x20')]?_[_0x4d2a('0x21')](_0x596b8e[_0x4d2a('0x20')],function(_0x3dd9ec){return{'model':db[_0x3dd9ec[_0x4d2a('0x22')]],'as':_0x3dd9ec['as'],'attributes':_0x3dd9ec[_0x4d2a('0x1e')],'include':_0x3dd9ec[_0x4d2a('0x20')]?_[_0x4d2a('0x21')](_0x3dd9ec[_0x4d2a('0x20')],function(_0x2e4097){return{'model':db[_0x2e4097[_0x4d2a('0x22')]],'as':_0x2e4097['as'],'attributes':_0x2e4097['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d2a('0xd')](function(_0x3cfa05){logger['info'](_0x4d2a('0x18'),_0x56c1aa);logger[_0x4d2a('0x23')](_0x4d2a('0x18'),_0x56c1aa,JSON[_0x4d2a('0x12')](_0x3cfa05));_0x3ac168(_0x3cfa05);})[_0x4d2a('0x17')](function(_0x3afe98){logger[_0x4d2a('0x13')](_0x4d2a('0x18'),_0x3afe98['message'],_0x56c1aa);_0x5e98b6(_0x16e345[_0x4d2a('0x13')](0x1f4,_0x3afe98[_0x4d2a('0x15')]));});});};exports['ShowDeskAccount']=function(_0x245c0c){var _0x34e647=this;return new Promise(function(_0x3b47e,_0x3a49c2){return db['DeskAccount'][_0x4d2a('0x24')]({'raw':_0x245c0c['options']?_0x245c0c['options'][_0x4d2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x245c0c['options']?_0x245c0c[_0x4d2a('0x1b')][_0x4d2a('0x1d')]||null:null,'attributes':_0x245c0c[_0x4d2a('0x1b')]?_0x245c0c[_0x4d2a('0x1b')]['attributes']||null:null,'include':_0x245c0c[_0x4d2a('0x1b')]?_0x245c0c[_0x4d2a('0x1b')]['include']?_[_0x4d2a('0x21')](_0x245c0c[_0x4d2a('0x1b')]['include'],function(_0x1e10ce){return{'model':db[_0x1e10ce[_0x4d2a('0x22')]],'as':_0x1e10ce['as'],'attributes':_0x1e10ce[_0x4d2a('0x1e')],'include':_0x1e10ce[_0x4d2a('0x20')]?_[_0x4d2a('0x21')](_0x1e10ce[_0x4d2a('0x20')],function(_0x4d7d8b){return{'model':db[_0x4d7d8b[_0x4d2a('0x22')]],'as':_0x4d7d8b['as'],'attributes':_0x4d7d8b['attributes'],'include':_0x4d7d8b[_0x4d2a('0x20')]?_['map'](_0x4d7d8b[_0x4d2a('0x20')],function(_0x24d8f0){return{'model':db[_0x24d8f0[_0x4d2a('0x22')]],'as':_0x24d8f0['as'],'attributes':_0x24d8f0[_0x4d2a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4d2a('0xd')](function(_0x21e1a5){logger[_0x4d2a('0xe')](_0x4d2a('0x25'),_0x245c0c);logger[_0x4d2a('0x23')](_0x4d2a('0x25'),_0x245c0c,JSON['stringify'](_0x21e1a5));_0x3b47e(_0x21e1a5);})[_0x4d2a('0x17')](function(_0x3f5ef7){logger['error'](_0x4d2a('0x25'),_0x3f5ef7[_0x4d2a('0x15')],_0x245c0c);_0x3a49c2(_0x34e647[_0x4d2a('0x13')](0x1f4,_0x3f5ef7[_0x4d2a('0x15')]));});});}; \ No newline at end of file +var _0x8c42=['code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x161494,_0x425de9){var _0x9eb2fc=function(_0x1de847){while(--_0x1de847){_0x161494['push'](_0x161494['shift']());}};_0x9eb2fc(++_0x425de9);}(_0x8c42,0x93));var _0x28c4=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x8c42[_0x1034ca];return _0x1a023a;};'use strict';var _=require(_0x28c4('0x0'));var util=require(_0x28c4('0x1'));var moment=require(_0x28c4('0x2'));var BPromise=require(_0x28c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28c4('0x4'));var db=require(_0x28c4('0x5'))['db'];var utils=require(_0x28c4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x28c4('0x7'));var jayson=require(_0x28c4('0x8'));var client=jayson[_0x28c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357ea7,_0x27b8dc,_0x16472c){return new BPromise(function(_0x41667b,_0x31a99b){return client[_0x28c4('0xa')](_0x357ea7,_0x16472c)[_0x28c4('0xb')](function(_0x4c60c0){logger[_0x28c4('0xc')]('DeskAccount,\x20%s,\x20%s',_0x27b8dc,_0x28c4('0xd'));logger[_0x28c4('0xe')](_0x28c4('0xf'),_0x27b8dc,'request\x20sent',JSON[_0x28c4('0x10')](_0x4c60c0));if(_0x4c60c0['error']){if(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x12')]===0x1f4){logger[_0x28c4('0x11')](_0x28c4('0x13'),_0x27b8dc,_0x4c60c0['error']['message']);return _0x31a99b(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);}logger[_0x28c4('0x11')]('DeskAccount,\x20%s,\x20%s',_0x27b8dc,_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);return _0x41667b(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);}else{logger[_0x28c4('0xc')](_0x28c4('0x13'),_0x27b8dc,_0x28c4('0xd'));_0x41667b(_0x4c60c0['result'][_0x28c4('0x14')]);}})[_0x28c4('0x15')](function(_0x214e47){logger[_0x28c4('0x11')](_0x28c4('0x13'),_0x27b8dc,_0x214e47);_0x31a99b(_0x214e47);});});}exports[_0x28c4('0x16')]=function(_0x572988){var _0x3a6eba=this;return new Promise(function(_0x4aa3a3,_0xd3e2f){return db['DeskAccount']['findAll']({'raw':_0x572988[_0x28c4('0x17')]?_0x572988['options'][_0x28c4('0x18')]===undefined?!![]:![]:!![],'where':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x19')]||null:null,'attributes':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x1a')]||null:null,'limit':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x1b')]||null:null,'include':_0x572988['options']?_0x572988[_0x28c4('0x17')][_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x572988[_0x28c4('0x17')][_0x28c4('0x1c')],function(_0x499f3d){return{'model':db[_0x499f3d[_0x28c4('0x1e')]],'as':_0x499f3d['as'],'attributes':_0x499f3d['attributes'],'include':_0x499f3d[_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x499f3d[_0x28c4('0x1c')],function(_0x1b1d41){return{'model':db[_0x1b1d41[_0x28c4('0x1e')]],'as':_0x1b1d41['as'],'attributes':_0x1b1d41[_0x28c4('0x1a')],'include':_0x1b1d41[_0x28c4('0x1c')]?_['map'](_0x1b1d41['include'],function(_0x562ad5){return{'model':db[_0x562ad5[_0x28c4('0x1e')]],'as':_0x562ad5['as'],'attributes':_0x562ad5['attributes']};}):[]};}):[]};}):[]:[]})[_0x28c4('0xb')](function(_0x10d87b){logger[_0x28c4('0xc')](_0x28c4('0x16'),_0x572988);logger[_0x28c4('0xe')](_0x28c4('0x16'),_0x572988,JSON[_0x28c4('0x10')](_0x10d87b));_0x4aa3a3(_0x10d87b);})['catch'](function(_0x23fa77){logger[_0x28c4('0x11')](_0x28c4('0x16'),_0x23fa77['message'],_0x572988);_0xd3e2f(_0x3a6eba[_0x28c4('0x11')](0x1f4,_0x23fa77[_0x28c4('0x14')]));});});};exports[_0x28c4('0x1f')]=function(_0x240706){var _0x3bf9d3=this;return new Promise(function(_0x8c1a50,_0x3a538d){return db[_0x28c4('0x20')]['find']({'raw':_0x240706[_0x28c4('0x17')]?_0x240706[_0x28c4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x240706['options']?_0x240706[_0x28c4('0x17')][_0x28c4('0x19')]||null:null,'attributes':_0x240706[_0x28c4('0x17')]?_0x240706['options'][_0x28c4('0x1a')]||null:null,'include':_0x240706[_0x28c4('0x17')]?_0x240706[_0x28c4('0x17')][_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x240706['options'][_0x28c4('0x1c')],function(_0x590dd7){return{'model':db[_0x590dd7[_0x28c4('0x1e')]],'as':_0x590dd7['as'],'attributes':_0x590dd7[_0x28c4('0x1a')],'include':_0x590dd7[_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x590dd7[_0x28c4('0x1c')],function(_0x20d43d){return{'model':db[_0x20d43d[_0x28c4('0x1e')]],'as':_0x20d43d['as'],'attributes':_0x20d43d[_0x28c4('0x1a')],'include':_0x20d43d['include']?_[_0x28c4('0x1d')](_0x20d43d[_0x28c4('0x1c')],function(_0x3f28ae){return{'model':db[_0x3f28ae[_0x28c4('0x1e')]],'as':_0x3f28ae['as'],'attributes':_0x3f28ae[_0x28c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a70d6){logger['info'](_0x28c4('0x1f'),_0x240706);logger[_0x28c4('0xe')](_0x28c4('0x1f'),_0x240706,JSON[_0x28c4('0x10')](_0x4a70d6));_0x8c1a50(_0x4a70d6);})[_0x28c4('0x15')](function(_0x2846b0){logger[_0x28c4('0x11')]('ShowDeskAccount',_0x2846b0['message'],_0x240706);_0x3a538d(_0x3bf9d3[_0x28c4('0x11')](0x1f4,_0x2846b0[_0x28c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 896ee09..95e586e 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x3ee5c9,_0x316097){var _0x2774a3=function(_0x3db5a0){while(--_0x3db5a0){_0x3ee5c9['push'](_0x3ee5c9['shift']());}};_0x2774a3(++_0x316097);}(_0xedd9,0xfc));var _0x9edd=function(_0x12b7b7,_0x2196c3){_0x12b7b7=_0x12b7b7-0x0;var _0x261741=_0xedd9[_0x12b7b7];return _0x261741;};'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');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x543c2f,_0x1a6849){var _0xdecbfd=function(_0xceecef){while(--_0xceecef){_0x543c2f['push'](_0x543c2f['shift']());}};_0xdecbfd(++_0x1a6849);}(_0xedd9,0xfc));var _0x9edd=function(_0x12cdf9,_0x4a00cc){_0x12cdf9=_0x12cdf9-0x0;var _0x516146=_0xedd9[_0x12cdf9];return _0x516146;};'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');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 34b691a..984de27 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 _0x6cfc=['STRING','sequelize','exports'];(function(_0x4f179c,_0x4e345b){var _0x2e8614=function(_0xf8868){while(--_0xf8868){_0x4f179c['push'](_0x4f179c['shift']());}};_0x2e8614(++_0x4e345b);}(_0x6cfc,0x14b));var _0xc6cf=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x6cfc[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0xc6cf('0x0'));module[_0xc6cf('0x1')]={'name':{'type':Sequelize[_0xc6cf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x813b=['STRING','sequelize','exports'];(function(_0x176cbe,_0xfbbda6){var _0x1490cc=function(_0x12e158){while(--_0x12e158){_0x176cbe['push'](_0x176cbe['shift']());}};_0x1490cc(++_0xfbbda6);}(_0x813b,0x1f0));var _0xb813=function(_0x243d9f,_0x1a81ec){_0x243d9f=_0x243d9f-0x0;var _0x34a46c=_0x813b[_0x243d9f];return _0x34a46c;};'use strict';var Sequelize=require(_0xb813('0x0'));module[_0xb813('0x1')]={'name':{'type':Sequelize[_0xb813('0x2')]},'description':{'type':Sequelize[_0xb813('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index d8bf16a..0e2c623 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 _0x4763=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','fields','includeAll','find','create','body','getFields','findOne','DeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x4763,0x8e));var _0x3476=function(_0x445779,_0x3a0eca){_0x445779=_0x445779-0x0;var _0x34ae82=_0x4763[_0x445779];return _0x34ae82;};'use strict';var emlformat=require(_0x3476('0x0'));var rimraf=require(_0x3476('0x1'));var zipdir=require(_0x3476('0x2'));var jsonpatch=require(_0x3476('0x3'));var rp=require(_0x3476('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3476('0x5'));var util=require(_0x3476('0x6'));var path=require('path');var sox=require(_0x3476('0x7'));var csv=require(_0x3476('0x8'));var ejs=require(_0x3476('0x9'));var fs=require('fs');var fs_extra=require(_0x3476('0xa'));var _=require(_0x3476('0xb'));var squel=require(_0x3476('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3476('0xd'));var toCsv=require(_0x3476('0x8'));var querystring=require(_0x3476('0xe'));var Papa=require(_0x3476('0xf'));var Redis=require(_0x3476('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3476('0x11'));var as=require(_0x3476('0x12'));var hardwareService=require(_0x3476('0x13'));var logger=require('../../config/logger')(_0x3476('0x14'));var utils=require('../../config/utils');var config=require(_0x3476('0x15'));var licenseUtil=require(_0x3476('0x16'));var db=require(_0x3476('0x17'))['db'];function respondWithStatusCode(_0x5015a2,_0x54dba0){_0x54dba0=_0x54dba0||0xcc;return function(_0x51b900){if(_0x51b900){return _0x5015a2[_0x3476('0x18')](_0x54dba0);}return _0x5015a2[_0x3476('0x19')](_0x54dba0)[_0x3476('0x1a')]();};}function respondWithResult(_0x13e4bb,_0x28540c){_0x28540c=_0x28540c||0xc8;return function(_0x4f9233){if(_0x4f9233){return _0x13e4bb[_0x3476('0x19')](_0x28540c)[_0x3476('0x1b')](_0x4f9233);}};}function respondWithFilteredResult(_0x41ae02,_0x598ec7){return function(_0x417f70){if(_0x417f70){var _0x363d39=typeof _0x598ec7[_0x3476('0x1c')]===_0x3476('0x1d')&&typeof _0x598ec7[_0x3476('0x1e')]===_0x3476('0x1d');var _0x29c0df=_0x417f70[_0x3476('0x1f')];var _0x1f9409=_0x363d39?0x0:_0x598ec7[_0x3476('0x1c')];var _0x41638d=_0x363d39?_0x417f70[_0x3476('0x1f')]:_0x598ec7['offset']+_0x598ec7[_0x3476('0x1e')];var _0x578037;if(_0x41638d>=_0x29c0df){_0x41638d=_0x29c0df;_0x578037=0xc8;}else{_0x578037=0xce;}_0x41ae02[_0x3476('0x19')](_0x578037);return _0x41ae02['set'](_0x3476('0x20'),_0x1f9409+'-'+_0x41638d+'/'+_0x29c0df)[_0x3476('0x1b')](_0x417f70);}return null;};}function patchUpdates(_0x303432){return function(_0x470697){try{jsonpatch['apply'](_0x470697,_0x303432,!![]);}catch(_0x4fb06c){return BPromise['reject'](_0x4fb06c);}return _0x470697[_0x3476('0x21')]();};}function saveUpdates(_0x4e5f57,_0x31ad0c){return function(_0x5eb165){if(_0x5eb165){return _0x5eb165[_0x3476('0x22')](_0x4e5f57)[_0x3476('0x23')](function(_0xe86cd3){return _0xe86cd3;});}return null;};}function removeEntity(_0x551261,_0x4a9758){return function(_0x8593c0){if(_0x8593c0){return _0x8593c0[_0x3476('0x24')]()[_0x3476('0x23')](function(){_0x551261[_0x3476('0x19')](0xcc)[_0x3476('0x1a')]();});}};}function handleEntityNotFound(_0x47f951,_0x4bdd71){return function(_0x50ef61){if(!_0x50ef61){_0x47f951[_0x3476('0x18')](0x194);}return _0x50ef61;};}function handleError(_0x43a503,_0x54a9e7){_0x54a9e7=_0x54a9e7||0x1f4;return function(_0x36c9e1){logger[_0x3476('0x25')](_0x36c9e1[_0x3476('0x26')]);if(_0x36c9e1[_0x3476('0x27')]){delete _0x36c9e1[_0x3476('0x27')];}_0x43a503['status'](_0x54a9e7)[_0x3476('0x28')](_0x36c9e1);};}exports['index']=function(_0x372997,_0x1f4386){var _0x4882e6={},_0x1f992a={},_0x34bfd6={'count':0x0,'rows':[]};var _0x1a382f=_[_0x3476('0x29')](db[_0x3476('0x2a')][_0x3476('0x2b')],function(_0x1df931){return{'name':_0x1df931[_0x3476('0x2c')],'type':_0x1df931[_0x3476('0x2d')]['key']};});_0x1f992a['model']=_[_0x3476('0x29')](_0x1a382f,_0x3476('0x27'));_0x1f992a[_0x3476('0x2e')]=_[_0x3476('0x2f')](_0x372997[_0x3476('0x2e')]);_0x1f992a[_0x3476('0x30')]=_[_0x3476('0x31')](_0x1f992a['model'],_0x1f992a[_0x3476('0x2e')]);_0x4882e6['attributes']=_['intersection'](_0x1f992a['model'],qs['fields'](_0x372997[_0x3476('0x2e')]['fields']));_0x4882e6[_0x3476('0x32')]=_0x4882e6[_0x3476('0x32')][_0x3476('0x33')]?_0x4882e6['attributes']:_0x1f992a[_0x3476('0x34')];if(!_0x372997[_0x3476('0x2e')][_0x3476('0x35')](_0x3476('0x36'))){_0x4882e6[_0x3476('0x1e')]=qs[_0x3476('0x1e')](_0x372997[_0x3476('0x2e')][_0x3476('0x1e')]);_0x4882e6[_0x3476('0x1c')]=qs[_0x3476('0x1c')](_0x372997['query'][_0x3476('0x1c')]);}_0x4882e6['order']=qs[_0x3476('0x37')](_0x372997[_0x3476('0x2e')][_0x3476('0x37')]);_0x4882e6[_0x3476('0x38')]=qs[_0x3476('0x30')](_[_0x3476('0x39')](_0x372997[_0x3476('0x2e')],_0x1f992a[_0x3476('0x30')]),_0x1a382f);if(_0x372997[_0x3476('0x2e')][_0x3476('0x3a')]){_0x4882e6['where']=_[_0x3476('0x3b')](_0x4882e6[_0x3476('0x38')],{'$or':_[_0x3476('0x29')](_0x1a382f,function(_0x227b35){if(_0x227b35['type']!==_0x3476('0x3c')){var _0x4bf22b={};_0x4bf22b[_0x227b35[_0x3476('0x27')]]={'$like':'%'+_0x372997[_0x3476('0x2e')][_0x3476('0x3a')]+'%'};return _0x4bf22b;}})});}_0x4882e6=_[_0x3476('0x3b')]({},_0x4882e6,_0x372997[_0x3476('0x3d')]);var _0x46865e={'where':_0x4882e6[_0x3476('0x38')]};return db[_0x3476('0x2a')][_0x3476('0x1f')](_0x46865e)[_0x3476('0x23')](function(_0x21e3e){_0x34bfd6[_0x3476('0x1f')]=_0x21e3e;if(_0x372997[_0x3476('0x2e')]['includeAll']){_0x4882e6[_0x3476('0x3e')]=[{'all':!![]}];}return db[_0x3476('0x2a')]['findAll'](_0x4882e6);})[_0x3476('0x23')](function(_0x24a25c){_0x34bfd6['rows']=_0x24a25c;return _0x34bfd6;})['then'](respondWithFilteredResult(_0x1f4386,_0x4882e6))[_0x3476('0x3f')](handleError(_0x1f4386,null));};exports[_0x3476('0x40')]=function(_0x53d208,_0x568f3b){var _0xc97508={'raw':![],'where':{'id':_0x53d208[_0x3476('0x41')]['id']}},_0xf671d8={};_0xf671d8[_0x3476('0x34')]=_[_0x3476('0x2f')](db[_0x3476('0x2a')][_0x3476('0x2b')]);_0xf671d8[_0x3476('0x2e')]=_['keys'](_0x53d208[_0x3476('0x2e')]);_0xf671d8[_0x3476('0x30')]=_[_0x3476('0x31')](_0xf671d8[_0x3476('0x34')],_0xf671d8[_0x3476('0x2e')]);_0xc97508[_0x3476('0x32')]=_['intersection'](_0xf671d8[_0x3476('0x34')],qs[_0x3476('0x42')](_0x53d208['query'][_0x3476('0x42')]));_0xc97508[_0x3476('0x32')]=_0xc97508[_0x3476('0x32')][_0x3476('0x33')]?_0xc97508[_0x3476('0x32')]:_0xf671d8[_0x3476('0x34')];if(_0x53d208[_0x3476('0x2e')][_0x3476('0x43')]){_0xc97508[_0x3476('0x3e')]=[{'all':!![]}];}_0xc97508=_[_0x3476('0x3b')]({},_0xc97508,_0x53d208[_0x3476('0x3d')]);return db[_0x3476('0x2a')][_0x3476('0x44')](_0xc97508)['then'](handleEntityNotFound(_0x568f3b,null))[_0x3476('0x23')](respondWithResult(_0x568f3b,null))['catch'](handleError(_0x568f3b,null));};exports[_0x3476('0x45')]=function(_0x3a4fd7,_0x1740dd){return db[_0x3476('0x2a')][_0x3476('0x45')](_0x3a4fd7[_0x3476('0x46')],{})[_0x3476('0x23')](respondWithResult(_0x1740dd,0xc9))['catch'](handleError(_0x1740dd,null));};exports[_0x3476('0x22')]=function(_0x5ab162,_0x46cade){if(_0x5ab162[_0x3476('0x46')]['id']){delete _0x5ab162[_0x3476('0x46')]['id'];}return db['DeskConfiguration'][_0x3476('0x44')]({'where':{'id':_0x5ab162[_0x3476('0x41')]['id']}})[_0x3476('0x23')](handleEntityNotFound(_0x46cade,null))[_0x3476('0x23')](saveUpdates(_0x5ab162[_0x3476('0x46')],null))[_0x3476('0x23')](respondWithResult(_0x46cade,null))[_0x3476('0x3f')](handleError(_0x46cade,null));};exports['destroy']=function(_0x307a4e,_0x5f0e80){return db[_0x3476('0x2a')][_0x3476('0x44')]({'where':{'id':_0x307a4e['params']['id']}})[_0x3476('0x23')](handleEntityNotFound(_0x5f0e80,null))[_0x3476('0x23')](removeEntity(_0x5f0e80,null))[_0x3476('0x3f')](handleError(_0x5f0e80,null));};exports[_0x3476('0x47')]=function(_0x4cbcec,_0x450bcc,_0x28b643){var _0x146284={};var _0x35dfd6={};var _0xb3ce81;var _0xd284b7;return db['DeskConfiguration'][_0x3476('0x48')]({'where':{'id':_0x4cbcec[_0x3476('0x41')]['id']}})['then'](handleEntityNotFound(_0x450bcc,null))['then'](function(_0x3f8e64){if(_0x3f8e64){_0xb3ce81=_0x3f8e64;_0x35dfd6[_0x3476('0x34')]=_[_0x3476('0x2f')](db[_0x3476('0x49')][_0x3476('0x2b')]);_0x35dfd6['query']=_[_0x3476('0x2f')](_0x4cbcec[_0x3476('0x2e')]);_0x35dfd6[_0x3476('0x30')]=_[_0x3476('0x31')](_0x35dfd6[_0x3476('0x34')],_0x35dfd6[_0x3476('0x2e')]);_0x146284[_0x3476('0x32')]=_[_0x3476('0x31')](_0x35dfd6[_0x3476('0x34')],qs[_0x3476('0x42')](_0x4cbcec[_0x3476('0x2e')]['fields']));_0x146284[_0x3476('0x32')]=_0x146284[_0x3476('0x32')][_0x3476('0x33')]?_0x146284['attributes']:_0x35dfd6[_0x3476('0x34')];_0x146284['order']=qs[_0x3476('0x37')](_0x4cbcec[_0x3476('0x2e')][_0x3476('0x37')]);_0x146284[_0x3476('0x38')]=qs['filters'](_[_0x3476('0x39')](_0x4cbcec['query'],_0x35dfd6[_0x3476('0x30')]));if(_0x4cbcec[_0x3476('0x2e')]['filter']){_0x146284[_0x3476('0x38')]=_[_0x3476('0x3b')](_0x146284[_0x3476('0x38')],{'$or':_[_0x3476('0x29')](_0x146284['attributes'],function(_0x15de02){var _0x584166={};_0x584166[_0x15de02]={'$like':'%'+_0x4cbcec[_0x3476('0x2e')][_0x3476('0x3a')]+'%'};return _0x584166;})});}_0x146284=_[_0x3476('0x3b')]({},_0x146284,_0x4cbcec[_0x3476('0x3d')]);return _0xb3ce81['getFields'](_0x146284);}})[_0x3476('0x23')](function(_0x512bd8){if(_0x512bd8){_0xd284b7=_0x512bd8[_0x3476('0x33')];if(!_0x4cbcec['query'][_0x3476('0x35')]('nolimit')){_0x146284[_0x3476('0x1e')]=qs[_0x3476('0x1e')](_0x4cbcec[_0x3476('0x2e')][_0x3476('0x1e')]);_0x146284['offset']=qs['offset'](_0x4cbcec[_0x3476('0x2e')][_0x3476('0x1c')]);}return _0xb3ce81[_0x3476('0x47')](_0x146284);}})['then'](function(_0x3edb5b){if(_0x3edb5b){return _0x3edb5b?{'count':_0xd284b7,'rows':_0x3edb5b}:null;}})['then'](respondWithResult(_0x450bcc,null))[_0x3476('0x3f')](handleError(_0x450bcc,null));};exports[_0x3476('0x4a')]=function(_0x2b3379,_0x17fc28,_0x99818b){var _0x1a49ec={};var _0x25b559={};var _0x2337ce;var _0x354cd6;return db[_0x3476('0x2a')][_0x3476('0x48')]({'where':{'id':_0x2b3379[_0x3476('0x41')]['id']}})['then'](handleEntityNotFound(_0x17fc28,null))[_0x3476('0x23')](function(_0x49d012){if(_0x49d012){_0x2337ce=_0x49d012;_0x25b559['model']=_['keys'](db[_0x3476('0x49')][_0x3476('0x2b')]);_0x25b559[_0x3476('0x2e')]=_[_0x3476('0x2f')](_0x2b3379[_0x3476('0x2e')]);_0x25b559['filters']=_[_0x3476('0x31')](_0x25b559[_0x3476('0x34')],_0x25b559[_0x3476('0x2e')]);_0x1a49ec[_0x3476('0x32')]=_[_0x3476('0x31')](_0x25b559[_0x3476('0x34')],qs[_0x3476('0x42')](_0x2b3379[_0x3476('0x2e')]['fields']));_0x1a49ec[_0x3476('0x32')]=_0x1a49ec[_0x3476('0x32')]['length']?_0x1a49ec['attributes']:_0x25b559[_0x3476('0x34')];_0x1a49ec['order']=qs['sort'](_0x2b3379[_0x3476('0x2e')]['sort']);_0x1a49ec[_0x3476('0x38')]=qs[_0x3476('0x30')](_[_0x3476('0x39')](_0x2b3379[_0x3476('0x2e')],_0x25b559[_0x3476('0x30')]));if(_0x2b3379[_0x3476('0x2e')]['filter']){_0x1a49ec[_0x3476('0x38')]=_['merge'](_0x1a49ec[_0x3476('0x38')],{'$or':_[_0x3476('0x29')](_0x1a49ec[_0x3476('0x32')],function(_0x29b71a){var _0x388c53={};_0x388c53[_0x29b71a]={'$like':'%'+_0x2b3379[_0x3476('0x2e')][_0x3476('0x3a')]+'%'};return _0x388c53;})});}_0x1a49ec=_[_0x3476('0x3b')]({},_0x1a49ec,_0x2b3379[_0x3476('0x3d')]);return _0x2337ce[_0x3476('0x4a')](_0x1a49ec);}})[_0x3476('0x23')](function(_0x12f193){if(_0x12f193){_0x354cd6=_0x12f193['length'];if(!_0x2b3379[_0x3476('0x2e')][_0x3476('0x35')](_0x3476('0x36'))){_0x1a49ec['limit']=qs['limit'](_0x2b3379[_0x3476('0x2e')][_0x3476('0x1e')]);_0x1a49ec[_0x3476('0x1c')]=qs[_0x3476('0x1c')](_0x2b3379['query']['offset']);}return _0x2337ce[_0x3476('0x4a')](_0x1a49ec);}})[_0x3476('0x23')](function(_0x51b891){if(_0x51b891){return _0x51b891?{'count':_0x354cd6,'rows':_0x51b891}:null;}})['then'](respondWithResult(_0x17fc28,null))[_0x3476('0x3f')](handleError(_0x17fc28,null));};exports['getDescriptions']=function(_0x95627a,_0x3a59a9,_0x3b5175){var _0x53947c={};var _0x31c2b4={};var _0x176d8d;var _0x58bb4a;return db[_0x3476('0x2a')][_0x3476('0x48')]({'where':{'id':_0x95627a[_0x3476('0x41')]['id']}})[_0x3476('0x23')](handleEntityNotFound(_0x3a59a9,null))[_0x3476('0x23')](function(_0x5328a1){if(_0x5328a1){_0x176d8d=_0x5328a1;_0x31c2b4[_0x3476('0x34')]=_[_0x3476('0x2f')](db['DeskField'][_0x3476('0x2b')]);_0x31c2b4[_0x3476('0x2e')]=_[_0x3476('0x2f')](_0x95627a[_0x3476('0x2e')]);_0x31c2b4['filters']=_[_0x3476('0x31')](_0x31c2b4[_0x3476('0x34')],_0x31c2b4[_0x3476('0x2e')]);_0x53947c[_0x3476('0x32')]=_[_0x3476('0x31')](_0x31c2b4['model'],qs[_0x3476('0x42')](_0x95627a[_0x3476('0x2e')]['fields']));_0x53947c[_0x3476('0x32')]=_0x53947c[_0x3476('0x32')][_0x3476('0x33')]?_0x53947c[_0x3476('0x32')]:_0x31c2b4[_0x3476('0x34')];_0x53947c[_0x3476('0x4b')]=qs['sort'](_0x95627a[_0x3476('0x2e')][_0x3476('0x37')]);_0x53947c[_0x3476('0x38')]=qs[_0x3476('0x30')](_[_0x3476('0x39')](_0x95627a[_0x3476('0x2e')],_0x31c2b4[_0x3476('0x30')]));if(_0x95627a[_0x3476('0x2e')][_0x3476('0x3a')]){_0x53947c['where']=_[_0x3476('0x3b')](_0x53947c[_0x3476('0x38')],{'$or':_[_0x3476('0x29')](_0x53947c['attributes'],function(_0x19419e){var _0x5b9eed={};_0x5b9eed[_0x19419e]={'$like':'%'+_0x95627a[_0x3476('0x2e')]['filter']+'%'};return _0x5b9eed;})});}_0x53947c=_['merge']({},_0x53947c,_0x95627a['options']);return _0x176d8d[_0x3476('0x4c')](_0x53947c);}})['then'](function(_0x61cdb2){if(_0x61cdb2){_0x58bb4a=_0x61cdb2[_0x3476('0x33')];if(!_0x95627a[_0x3476('0x2e')][_0x3476('0x35')]('nolimit')){_0x53947c[_0x3476('0x1e')]=qs['limit'](_0x95627a[_0x3476('0x2e')]['limit']);_0x53947c[_0x3476('0x1c')]=qs[_0x3476('0x1c')](_0x95627a[_0x3476('0x2e')][_0x3476('0x1c')]);}return _0x176d8d[_0x3476('0x4c')](_0x53947c);}})[_0x3476('0x23')](function(_0x18b8c8){if(_0x18b8c8){return _0x18b8c8?{'count':_0x58bb4a,'rows':_0x18b8c8}:null;}})[_0x3476('0x23')](respondWithResult(_0x3a59a9,null))[_0x3476('0x3f')](handleError(_0x3a59a9,null));};exports[_0x3476('0x4d')]=function(_0x41a8f9,_0x34acbc,_0xef9208){var _0x55b748={};var _0x3e417f={};var _0x135813;var _0x2ff4e9;return db[_0x3476('0x2a')]['findOne']({'where':{'id':_0x41a8f9[_0x3476('0x41')]['id']}})['then'](handleEntityNotFound(_0x34acbc,null))[_0x3476('0x23')](function(_0x1baf68){if(_0x1baf68){_0x135813=_0x1baf68;_0x3e417f[_0x3476('0x34')]=_['keys'](db[_0x3476('0x4e')][_0x3476('0x2b')]);_0x3e417f[_0x3476('0x2e')]=_['keys'](_0x41a8f9[_0x3476('0x2e')]);_0x3e417f[_0x3476('0x30')]=_['intersection'](_0x3e417f[_0x3476('0x34')],_0x3e417f['query']);_0x55b748['attributes']=_[_0x3476('0x31')](_0x3e417f[_0x3476('0x34')],qs[_0x3476('0x42')](_0x41a8f9[_0x3476('0x2e')][_0x3476('0x42')]));_0x55b748['attributes']=_0x55b748[_0x3476('0x32')]['length']?_0x55b748[_0x3476('0x32')]:_0x3e417f[_0x3476('0x34')];_0x55b748[_0x3476('0x4b')]=qs['sort'](_0x41a8f9['query']['sort']);_0x55b748['where']=qs[_0x3476('0x30')](_['pick'](_0x41a8f9[_0x3476('0x2e')],_0x3e417f[_0x3476('0x30')]));if(_0x41a8f9[_0x3476('0x2e')][_0x3476('0x3a')]){_0x55b748[_0x3476('0x38')]=_['merge'](_0x55b748['where'],{'$or':_['map'](_0x55b748[_0x3476('0x32')],function(_0x3a66e7){var _0x5cc890={};_0x5cc890[_0x3a66e7]={'$like':'%'+_0x41a8f9[_0x3476('0x2e')][_0x3476('0x3a')]+'%'};return _0x5cc890;})});}_0x55b748=_[_0x3476('0x3b')]({},_0x55b748,_0x41a8f9[_0x3476('0x3d')]);return _0x135813[_0x3476('0x4d')](_0x55b748);}})['then'](function(_0x3baaaa){if(_0x3baaaa){_0x2ff4e9=_0x3baaaa[_0x3476('0x33')];if(!_0x41a8f9[_0x3476('0x2e')][_0x3476('0x35')](_0x3476('0x36'))){_0x55b748[_0x3476('0x1e')]=qs[_0x3476('0x1e')](_0x41a8f9[_0x3476('0x2e')][_0x3476('0x1e')]);_0x55b748[_0x3476('0x1c')]=qs[_0x3476('0x1c')](_0x41a8f9[_0x3476('0x2e')]['offset']);}return _0x135813[_0x3476('0x4d')](_0x55b748);}})['then'](function(_0x281e28){if(_0x281e28){return _0x281e28?{'count':_0x2ff4e9,'rows':_0x281e28}:null;}})['then'](respondWithResult(_0x34acbc,null))[_0x3476('0x3f')](handleError(_0x34acbc,null));};exports['setTags']=function(_0x53794f,_0x4c5b8e,_0x53bb97){if(_0x53794f[_0x3476('0x46')]['id']){delete _0x53794f[_0x3476('0x46')]['id'];}return db[_0x3476('0x2a')]['findOne']({'where':{'id':_0x53794f['params']['id']}})['then'](handleEntityNotFound(_0x4c5b8e,null))[_0x3476('0x23')](function(_0x558fc3){if(_0x558fc3){return _0x558fc3[_0x3476('0x4f')](_0x53794f[_0x3476('0x46')]['ids']||[]);}return null;})[_0x3476('0x23')](respondWithResult(_0x4c5b8e,null))[_0x3476('0x3f')](handleError(_0x4c5b8e,null));}; \ No newline at end of file +var _0x1c92=['setTags','ids','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','send','index','map','DeskConfiguration','fieldName','type','key','name','keys','query','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','create','body','findOne','params','DeskField','pick','getFields','getSubjects','getDescriptions','getTags','Tag'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x1c92,0x104));var _0x21c9=function(_0x37ce45,_0xda6746){_0x37ce45=_0x37ce45-0x0;var _0x17d5f7=_0x1c92[_0x37ce45];return _0x17d5f7;};'use strict';var emlformat=require(_0x21c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21c9('0x2'));var moment=require(_0x21c9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21c9('0x4'));var path=require(_0x21c9('0x5'));var sox=require('sox');var csv=require(_0x21c9('0x6'));var ejs=require(_0x21c9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21c9('0x8'));var squel=require(_0x21c9('0x9'));var crypto=require(_0x21c9('0xa'));var jsforce=require(_0x21c9('0xb'));var deskjs=require(_0x21c9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21c9('0xd'));var Papa=require(_0x21c9('0xe'));var Redis=require(_0x21c9('0xf'));var authService=require(_0x21c9('0x10'));var qs=require(_0x21c9('0x11'));var as=require(_0x21c9('0x12'));var hardwareService=require(_0x21c9('0x13'));var logger=require(_0x21c9('0x14'))(_0x21c9('0x15'));var utils=require(_0x21c9('0x16'));var config=require(_0x21c9('0x17'));var licenseUtil=require(_0x21c9('0x18'));var db=require(_0x21c9('0x19'))['db'];function respondWithStatusCode(_0x179b46,_0x4009dc){_0x4009dc=_0x4009dc||0xcc;return function(_0xc50f7c){if(_0xc50f7c){return _0x179b46[_0x21c9('0x1a')](_0x4009dc);}return _0x179b46['status'](_0x4009dc)['end']();};}function respondWithResult(_0x2598f1,_0xa3602a){_0xa3602a=_0xa3602a||0xc8;return function(_0x275dd5){if(_0x275dd5){return _0x2598f1[_0x21c9('0x1b')](_0xa3602a)[_0x21c9('0x1c')](_0x275dd5);}};}function respondWithFilteredResult(_0x584bb3,_0x5a885e){return function(_0x5aa8fb){if(_0x5aa8fb){var _0x54df83=typeof _0x5a885e[_0x21c9('0x1d')]===_0x21c9('0x1e')&&typeof _0x5a885e['limit']===_0x21c9('0x1e');var _0x558d0e=_0x5aa8fb['count'];var _0x4a5be3=_0x54df83?0x0:_0x5a885e['offset'];var _0xb116ac=_0x54df83?_0x5aa8fb[_0x21c9('0x1f')]:_0x5a885e[_0x21c9('0x1d')]+_0x5a885e[_0x21c9('0x20')];var _0x11240f;if(_0xb116ac>=_0x558d0e){_0xb116ac=_0x558d0e;_0x11240f=0xc8;}else{_0x11240f=0xce;}_0x584bb3[_0x21c9('0x1b')](_0x11240f);return _0x584bb3[_0x21c9('0x21')](_0x21c9('0x22'),_0x4a5be3+'-'+_0xb116ac+'/'+_0x558d0e)[_0x21c9('0x1c')](_0x5aa8fb);}return null;};}function patchUpdates(_0x20b6aa){return function(_0x30c13d){try{jsonpatch[_0x21c9('0x23')](_0x30c13d,_0x20b6aa,!![]);}catch(_0x43a21f){return BPromise['reject'](_0x43a21f);}return _0x30c13d['save']();};}function saveUpdates(_0x26a928,_0x2b4a86){return function(_0x44aeb8){if(_0x44aeb8){return _0x44aeb8[_0x21c9('0x24')](_0x26a928)[_0x21c9('0x25')](function(_0x5b8713){return _0x5b8713;});}return null;};}function removeEntity(_0x34f5cc,_0x5a0caf){return function(_0x1c76d6){if(_0x1c76d6){return _0x1c76d6[_0x21c9('0x26')]()[_0x21c9('0x25')](function(){_0x34f5cc['status'](0xcc)[_0x21c9('0x27')]();});}};}function handleEntityNotFound(_0x3f1778,_0x5f1adf){return function(_0x4dfe17){if(!_0x4dfe17){_0x3f1778[_0x21c9('0x1a')](0x194);}return _0x4dfe17;};}function handleError(_0x4753e2,_0xb764d9){_0xb764d9=_0xb764d9||0x1f4;return function(_0x562413){logger[_0x21c9('0x28')](_0x562413['stack']);if(_0x562413['name']){delete _0x562413['name'];}_0x4753e2[_0x21c9('0x1b')](_0xb764d9)[_0x21c9('0x29')](_0x562413);};}exports[_0x21c9('0x2a')]=function(_0x405f9e,_0x2316a5){var _0x53f869={},_0x3d332f={},_0x18ba34={'count':0x0,'rows':[]};var _0x13a9ce=_[_0x21c9('0x2b')](db[_0x21c9('0x2c')]['rawAttributes'],function(_0x3716a9){return{'name':_0x3716a9[_0x21c9('0x2d')],'type':_0x3716a9[_0x21c9('0x2e')][_0x21c9('0x2f')]};});_0x3d332f['model']=_['map'](_0x13a9ce,_0x21c9('0x30'));_0x3d332f['query']=_[_0x21c9('0x31')](_0x405f9e[_0x21c9('0x32')]);_0x3d332f[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x3d332f['model'],_0x3d332f[_0x21c9('0x32')]);_0x53f869[_0x21c9('0x35')]=_['intersection'](_0x3d332f['model'],qs['fields'](_0x405f9e[_0x21c9('0x32')]['fields']));_0x53f869['attributes']=_0x53f869[_0x21c9('0x35')][_0x21c9('0x36')]?_0x53f869[_0x21c9('0x35')]:_0x3d332f[_0x21c9('0x37')];if(!_0x405f9e[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x53f869[_0x21c9('0x20')]=qs['limit'](_0x405f9e[_0x21c9('0x32')]['limit']);_0x53f869['offset']=qs['offset'](_0x405f9e['query'][_0x21c9('0x1d')]);}_0x53f869[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x405f9e[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x53f869[_0x21c9('0x3c')]=qs[_0x21c9('0x33')](_['pick'](_0x405f9e[_0x21c9('0x32')],_0x3d332f[_0x21c9('0x33')]),_0x13a9ce);if(_0x405f9e['query'][_0x21c9('0x3d')]){_0x53f869['where']=_[_0x21c9('0x3e')](_0x53f869['where'],{'$or':_['map'](_0x13a9ce,function(_0x215735){if(_0x215735['type']!==_0x21c9('0x3f')){var _0x1d8b03={};_0x1d8b03[_0x215735[_0x21c9('0x30')]]={'$like':'%'+_0x405f9e['query'][_0x21c9('0x3d')]+'%'};return _0x1d8b03;}})});}_0x53f869=_[_0x21c9('0x3e')]({},_0x53f869,_0x405f9e[_0x21c9('0x40')]);var _0x182ad7={'where':_0x53f869[_0x21c9('0x3c')]};return db['DeskConfiguration']['count'](_0x182ad7)[_0x21c9('0x25')](function(_0x3b815b){_0x18ba34['count']=_0x3b815b;if(_0x405f9e['query'][_0x21c9('0x41')]){_0x53f869[_0x21c9('0x42')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x53f869);})[_0x21c9('0x25')](function(_0x3b5687){_0x18ba34[_0x21c9('0x43')]=_0x3b5687;return _0x18ba34;})[_0x21c9('0x25')](respondWithFilteredResult(_0x2316a5,_0x53f869))[_0x21c9('0x44')](handleError(_0x2316a5,null));};exports[_0x21c9('0x45')]=function(_0xc54816,_0xae5195){var _0x527b8c={'raw':![],'where':{'id':_0xc54816['params']['id']}},_0x58ac2e={};_0x58ac2e['model']=_['keys'](db[_0x21c9('0x2c')][_0x21c9('0x46')]);_0x58ac2e[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0xc54816[_0x21c9('0x32')]);_0x58ac2e[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x58ac2e[_0x21c9('0x37')],_0x58ac2e[_0x21c9('0x32')]);_0x527b8c[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x58ac2e[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0xc54816[_0x21c9('0x32')]['fields']));_0x527b8c['attributes']=_0x527b8c[_0x21c9('0x35')][_0x21c9('0x36')]?_0x527b8c[_0x21c9('0x35')]:_0x58ac2e[_0x21c9('0x37')];if(_0xc54816[_0x21c9('0x32')]['includeAll']){_0x527b8c['include']=[{'all':!![]}];}_0x527b8c=_[_0x21c9('0x3e')]({},_0x527b8c,_0xc54816[_0x21c9('0x40')]);return db[_0x21c9('0x2c')][_0x21c9('0x48')](_0x527b8c)[_0x21c9('0x25')](handleEntityNotFound(_0xae5195,null))[_0x21c9('0x25')](respondWithResult(_0xae5195,null))[_0x21c9('0x44')](handleError(_0xae5195,null));};exports[_0x21c9('0x49')]=function(_0x51bb94,_0x5b6a6b){return db['DeskConfiguration']['create'](_0x51bb94[_0x21c9('0x4a')],{})[_0x21c9('0x25')](respondWithResult(_0x5b6a6b,0xc9))['catch'](handleError(_0x5b6a6b,null));};exports[_0x21c9('0x24')]=function(_0xb40410,_0x2746e8){if(_0xb40410[_0x21c9('0x4a')]['id']){delete _0xb40410[_0x21c9('0x4a')]['id'];}return db['DeskConfiguration'][_0x21c9('0x48')]({'where':{'id':_0xb40410['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x2746e8,null))[_0x21c9('0x25')](saveUpdates(_0xb40410[_0x21c9('0x4a')],null))[_0x21c9('0x25')](respondWithResult(_0x2746e8,null))['catch'](handleError(_0x2746e8,null));};exports[_0x21c9('0x26')]=function(_0x2d068a,_0x941f65){return db['DeskConfiguration'][_0x21c9('0x48')]({'where':{'id':_0x2d068a['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x941f65,null))[_0x21c9('0x25')](removeEntity(_0x941f65,null))[_0x21c9('0x44')](handleError(_0x941f65,null));};exports['getFields']=function(_0x4013d9,_0x361e08,_0x32c6d2){var _0x162f14={};var _0x197690={};var _0x1c3de2;var _0x58a018;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x4013d9[_0x21c9('0x4c')]['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x361e08,null))['then'](function(_0x4c76f5){if(_0x4c76f5){_0x1c3de2=_0x4c76f5;_0x197690[_0x21c9('0x37')]=_[_0x21c9('0x31')](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x197690[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0x4013d9[_0x21c9('0x32')]);_0x197690['filters']=_[_0x21c9('0x34')](_0x197690['model'],_0x197690['query']);_0x162f14[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x197690[_0x21c9('0x37')],qs['fields'](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x47')]));_0x162f14[_0x21c9('0x35')]=_0x162f14[_0x21c9('0x35')][_0x21c9('0x36')]?_0x162f14[_0x21c9('0x35')]:_0x197690[_0x21c9('0x37')];_0x162f14[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x162f14[_0x21c9('0x3c')]=qs['filters'](_[_0x21c9('0x4e')](_0x4013d9[_0x21c9('0x32')],_0x197690[_0x21c9('0x33')]));if(_0x4013d9[_0x21c9('0x32')][_0x21c9('0x3d')]){_0x162f14[_0x21c9('0x3c')]=_['merge'](_0x162f14[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x162f14[_0x21c9('0x35')],function(_0x2dcdb8){var _0x3eca5e={};_0x3eca5e[_0x2dcdb8]={'$like':'%'+_0x4013d9[_0x21c9('0x32')]['filter']+'%'};return _0x3eca5e;})});}_0x162f14=_[_0x21c9('0x3e')]({},_0x162f14,_0x4013d9[_0x21c9('0x40')]);return _0x1c3de2[_0x21c9('0x4f')](_0x162f14);}})['then'](function(_0x3ffcf5){if(_0x3ffcf5){_0x58a018=_0x3ffcf5[_0x21c9('0x36')];if(!_0x4013d9[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x162f14[_0x21c9('0x20')]=qs[_0x21c9('0x20')](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x20')]);_0x162f14[_0x21c9('0x1d')]=qs['offset'](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x1c3de2[_0x21c9('0x4f')](_0x162f14);}})[_0x21c9('0x25')](function(_0x502fd7){if(_0x502fd7){return _0x502fd7?{'count':_0x58a018,'rows':_0x502fd7}:null;}})[_0x21c9('0x25')](respondWithResult(_0x361e08,null))[_0x21c9('0x44')](handleError(_0x361e08,null));};exports[_0x21c9('0x50')]=function(_0x5c5a15,_0x55c5a8,_0x580887){var _0x31b878={};var _0x3b3ddc={};var _0x52f771;var _0x48e297;return db['DeskConfiguration'][_0x21c9('0x4b')]({'where':{'id':_0x5c5a15['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x55c5a8,null))[_0x21c9('0x25')](function(_0x100579){if(_0x100579){_0x52f771=_0x100579;_0x3b3ddc[_0x21c9('0x37')]=_['keys'](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x3b3ddc[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0x5c5a15[_0x21c9('0x32')]);_0x3b3ddc[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x3b3ddc[_0x21c9('0x37')],_0x3b3ddc[_0x21c9('0x32')]);_0x31b878[_0x21c9('0x35')]=_['intersection'](_0x3b3ddc[_0x21c9('0x37')],qs['fields'](_0x5c5a15[_0x21c9('0x32')][_0x21c9('0x47')]));_0x31b878['attributes']=_0x31b878['attributes'][_0x21c9('0x36')]?_0x31b878[_0x21c9('0x35')]:_0x3b3ddc[_0x21c9('0x37')];_0x31b878[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x5c5a15[_0x21c9('0x32')]['sort']);_0x31b878['where']=qs[_0x21c9('0x33')](_[_0x21c9('0x4e')](_0x5c5a15[_0x21c9('0x32')],_0x3b3ddc[_0x21c9('0x33')]));if(_0x5c5a15['query'][_0x21c9('0x3d')]){_0x31b878[_0x21c9('0x3c')]=_[_0x21c9('0x3e')](_0x31b878[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x31b878[_0x21c9('0x35')],function(_0x1f31b5){var _0x2e0f05={};_0x2e0f05[_0x1f31b5]={'$like':'%'+_0x5c5a15[_0x21c9('0x32')]['filter']+'%'};return _0x2e0f05;})});}_0x31b878=_[_0x21c9('0x3e')]({},_0x31b878,_0x5c5a15[_0x21c9('0x40')]);return _0x52f771[_0x21c9('0x50')](_0x31b878);}})[_0x21c9('0x25')](function(_0x3cc820){if(_0x3cc820){_0x48e297=_0x3cc820[_0x21c9('0x36')];if(!_0x5c5a15[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x31b878[_0x21c9('0x20')]=qs[_0x21c9('0x20')](_0x5c5a15[_0x21c9('0x32')]['limit']);_0x31b878[_0x21c9('0x1d')]=qs[_0x21c9('0x1d')](_0x5c5a15['query']['offset']);}return _0x52f771[_0x21c9('0x50')](_0x31b878);}})[_0x21c9('0x25')](function(_0x2819ed){if(_0x2819ed){return _0x2819ed?{'count':_0x48e297,'rows':_0x2819ed}:null;}})['then'](respondWithResult(_0x55c5a8,null))['catch'](handleError(_0x55c5a8,null));};exports[_0x21c9('0x51')]=function(_0x3eea46,_0x1cdd91,_0x2b0ef2){var _0x51adda={};var _0x18f3cc={};var _0x39a1f9;var _0x559e3b;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x3eea46[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cdd91,null))[_0x21c9('0x25')](function(_0x2924c1){if(_0x2924c1){_0x39a1f9=_0x2924c1;_0x18f3cc[_0x21c9('0x37')]=_[_0x21c9('0x31')](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x18f3cc['query']=_[_0x21c9('0x31')](_0x3eea46[_0x21c9('0x32')]);_0x18f3cc[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x18f3cc[_0x21c9('0x37')],_0x18f3cc[_0x21c9('0x32')]);_0x51adda[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x18f3cc[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x47')]));_0x51adda[_0x21c9('0x35')]=_0x51adda[_0x21c9('0x35')][_0x21c9('0x36')]?_0x51adda[_0x21c9('0x35')]:_0x18f3cc[_0x21c9('0x37')];_0x51adda[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x51adda[_0x21c9('0x3c')]=qs[_0x21c9('0x33')](_[_0x21c9('0x4e')](_0x3eea46[_0x21c9('0x32')],_0x18f3cc[_0x21c9('0x33')]));if(_0x3eea46['query']['filter']){_0x51adda[_0x21c9('0x3c')]=_[_0x21c9('0x3e')](_0x51adda[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x51adda['attributes'],function(_0x39bb51){var _0x5bc1fe={};_0x5bc1fe[_0x39bb51]={'$like':'%'+_0x3eea46['query'][_0x21c9('0x3d')]+'%'};return _0x5bc1fe;})});}_0x51adda=_['merge']({},_0x51adda,_0x3eea46[_0x21c9('0x40')]);return _0x39a1f9[_0x21c9('0x51')](_0x51adda);}})[_0x21c9('0x25')](function(_0x1364eb){if(_0x1364eb){_0x559e3b=_0x1364eb[_0x21c9('0x36')];if(!_0x3eea46[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x51adda['limit']=qs[_0x21c9('0x20')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x20')]);_0x51adda[_0x21c9('0x1d')]=qs[_0x21c9('0x1d')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x39a1f9[_0x21c9('0x51')](_0x51adda);}})[_0x21c9('0x25')](function(_0x30db69){if(_0x30db69){return _0x30db69?{'count':_0x559e3b,'rows':_0x30db69}:null;}})['then'](respondWithResult(_0x1cdd91,null))[_0x21c9('0x44')](handleError(_0x1cdd91,null));};exports[_0x21c9('0x52')]=function(_0xefc45c,_0x4a54df,_0x527e37){var _0x264cb0={};var _0x3c4b1e={};var _0x4b4e09;var _0x132940;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0xefc45c[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a54df,null))['then'](function(_0xb006bf){if(_0xb006bf){_0x4b4e09=_0xb006bf;_0x3c4b1e[_0x21c9('0x37')]=_['keys'](db[_0x21c9('0x53')]['rawAttributes']);_0x3c4b1e[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0xefc45c[_0x21c9('0x32')]);_0x3c4b1e[_0x21c9('0x33')]=_['intersection'](_0x3c4b1e[_0x21c9('0x37')],_0x3c4b1e['query']);_0x264cb0[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x3c4b1e[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x47')]));_0x264cb0['attributes']=_0x264cb0[_0x21c9('0x35')][_0x21c9('0x36')]?_0x264cb0[_0x21c9('0x35')]:_0x3c4b1e[_0x21c9('0x37')];_0x264cb0[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x264cb0[_0x21c9('0x3c')]=qs['filters'](_[_0x21c9('0x4e')](_0xefc45c['query'],_0x3c4b1e['filters']));if(_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3d')]){_0x264cb0[_0x21c9('0x3c')]=_['merge'](_0x264cb0[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x264cb0['attributes'],function(_0x136cb1){var _0x539351={};_0x539351[_0x136cb1]={'$like':'%'+_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3d')]+'%'};return _0x539351;})});}_0x264cb0=_[_0x21c9('0x3e')]({},_0x264cb0,_0xefc45c[_0x21c9('0x40')]);return _0x4b4e09[_0x21c9('0x52')](_0x264cb0);}})[_0x21c9('0x25')](function(_0x481aea){if(_0x481aea){_0x132940=_0x481aea[_0x21c9('0x36')];if(!_0xefc45c['query'][_0x21c9('0x38')](_0x21c9('0x39'))){_0x264cb0['limit']=qs[_0x21c9('0x20')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x20')]);_0x264cb0['offset']=qs[_0x21c9('0x1d')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x4b4e09['getTags'](_0x264cb0);}})[_0x21c9('0x25')](function(_0x4163cf){if(_0x4163cf){return _0x4163cf?{'count':_0x132940,'rows':_0x4163cf}:null;}})[_0x21c9('0x25')](respondWithResult(_0x4a54df,null))[_0x21c9('0x44')](handleError(_0x4a54df,null));};exports[_0x21c9('0x54')]=function(_0x4d315c,_0x20140c,_0x5b3df9){if(_0x4d315c[_0x21c9('0x4a')]['id']){delete _0x4d315c[_0x21c9('0x4a')]['id'];}return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x4d315c[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20140c,null))[_0x21c9('0x25')](function(_0x51fe63){if(_0x51fe63){return _0x51fe63['setTags'](_0x4d315c[_0x21c9('0x4a')][_0x21c9('0x55')]||[]);}return null;})[_0x21c9('0x25')](respondWithResult(_0x20140c,null))[_0x21c9('0x44')](handleError(_0x20140c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ba26c5c..ecdbba2 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 _0x7c88=['bluebird','request-promise','path','../../config/environment','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x2e52ec,_0x1e896e){var _0x3d5653=function(_0x1dc352){while(--_0x1dc352){_0x2e52ec['push'](_0x2e52ec['shift']());}};_0x3d5653(++_0x1e896e);}(_0x7c88,0x16e));var _0x87c8=function(_0x23083a,_0x4dd0fa){_0x23083a=_0x23083a-0x0;var _0x30186c=_0x7c88[_0x23083a];return _0x30186c;};'use strict';var _=require(_0x87c8('0x0'));var util=require(_0x87c8('0x1'));var logger=require(_0x87c8('0x2'))('api');var moment=require(_0x87c8('0x3'));var BPromise=require(_0x87c8('0x4'));var rp=require(_0x87c8('0x5'));var fs=require('fs');var path=require(_0x87c8('0x6'));var rimraf=require('rimraf');var config=require(_0x87c8('0x7'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x3469ab,_0x3d0098){return _0x3469ab['define'](_0x87c8('0x8'),attributes,{'tableName':_0x87c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd87b=['request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x10dad3,_0x37ac19){var _0x1ead0a=function(_0xb160da){while(--_0xb160da){_0x10dad3['push'](_0x10dad3['shift']());}};_0x1ead0a(++_0x37ac19);}(_0xd87b,0xa4));var _0xbd87=function(_0x1a3f0a,_0x2fa311){_0x1a3f0a=_0x1a3f0a-0x0;var _0x47368f=_0xd87b[_0x1a3f0a];return _0x47368f;};'use strict';var _=require('lodash');var util=require(_0xbd87('0x0'));var logger=require(_0xbd87('0x1'))(_0xbd87('0x2'));var moment=require(_0xbd87('0x3'));var BPromise=require(_0xbd87('0x4'));var rp=require(_0xbd87('0x5'));var fs=require('fs');var path=require(_0xbd87('0x6'));var rimraf=require(_0xbd87('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd87('0x8'));module[_0xbd87('0x9')]=function(_0x2d7805,_0x178970){return _0x2d7805[_0xbd87('0xa')](_0xbd87('0xb'),attributes,{'tableName':_0xbd87('0xc'),'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 6dd3dfe..4d2531c 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 _0xe139=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x487289,_0xced20b){var _0x2d6d1a=function(_0x3f888a){while(--_0x3f888a){_0x487289['push'](_0x487289['shift']());}};_0x2d6d1a(++_0xced20b);}(_0xe139,0x1eb));var _0x9e13=function(_0x118a13,_0x4020c9){_0x118a13=_0x118a13-0x0;var _0x48fd34=_0xe139[_0x118a13];return _0x48fd34;};'use strict';var _=require(_0x9e13('0x0'));var util=require('util');var moment=require(_0x9e13('0x1'));var BPromise=require(_0x9e13('0x2'));var rs=require(_0x9e13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e13('0x4'))['db'];var utils=require(_0x9e13('0x5'));var logger=require(_0x9e13('0x6'))(_0x9e13('0x7'));var config=require(_0x9e13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e13('0x9')][_0x9e13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431d00,_0x4b3aee,_0x48a2cd){return new BPromise(function(_0x2133a9,_0x16a0be){return client[_0x9e13('0xb')](_0x431d00,_0x48a2cd)[_0x9e13('0xc')](function(_0x2a0705){logger[_0x9e13('0xd')](_0x9e13('0xe'),_0x4b3aee,_0x9e13('0xf'));logger[_0x9e13('0x10')](_0x9e13('0x11'),_0x4b3aee,_0x9e13('0xf'),JSON[_0x9e13('0x12')](_0x2a0705));if(_0x2a0705[_0x9e13('0x13')]){if(_0x2a0705[_0x9e13('0x13')][_0x9e13('0x14')]===0x1f4){logger['error'](_0x9e13('0xe'),_0x4b3aee,_0x2a0705[_0x9e13('0x13')]['message']);return _0x16a0be(_0x2a0705['error']['message']);}logger['error'](_0x9e13('0xe'),_0x4b3aee,_0x2a0705[_0x9e13('0x13')]['message']);return _0x2133a9(_0x2a0705[_0x9e13('0x13')][_0x9e13('0x15')]);}else{logger[_0x9e13('0xd')](_0x9e13('0xe'),_0x4b3aee,_0x9e13('0xf'));_0x2133a9(_0x2a0705[_0x9e13('0x16')][_0x9e13('0x15')]);}})['catch'](function(_0x56897e){logger[_0x9e13('0x13')](_0x9e13('0xe'),_0x4b3aee,_0x56897e);_0x16a0be(_0x56897e);});});} \ No newline at end of file +var _0x26bd=['info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xe5bc6a,_0x1d794d){var _0x3c596a=function(_0x331a0f){while(--_0x331a0f){_0xe5bc6a['push'](_0xe5bc6a['shift']());}};_0x3c596a(++_0x1d794d);}(_0x26bd,0xaa));var _0xd26b=function(_0x296f0f,_0x4ce6cb){_0x296f0f=_0x296f0f-0x0;var _0x23a564=_0x26bd[_0x296f0f];return _0x23a564;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require(_0xd26b('0x2'));var BPromise=require(_0xd26b('0x3'));var rs=require(_0xd26b('0x4'));var fs=require('fs');var Redis=require(_0xd26b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd26b('0x6'));var logger=require(_0xd26b('0x7'))(_0xd26b('0x8'));var config=require(_0xd26b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd26b('0xa')][_0xd26b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x362214,_0xebc7c8,_0x5555f6){return new BPromise(function(_0xe77d9b,_0x245128){return client[_0xd26b('0xc')](_0x362214,_0x5555f6)[_0xd26b('0xd')](function(_0x363802){logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));logger['debug'](_0xd26b('0x10'),_0xebc7c8,_0xd26b('0xf'),JSON[_0xd26b('0x11')](_0x363802));if(_0x363802[_0xd26b('0x12')]){if(_0x363802[_0xd26b('0x12')][_0xd26b('0x13')]===0x1f4){logger[_0xd26b('0x12')](_0xd26b('0x14'),_0xebc7c8,_0x363802[_0xd26b('0x12')]['message']);return _0x245128(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);return _0xe77d9b(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}else{logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));_0xe77d9b(_0x363802['result'][_0xd26b('0x15')]);}})[_0xd26b('0x16')](function(_0x81ccdc){logger[_0xd26b('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x81ccdc);_0x245128(_0x81ccdc);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c0b1756..db4bf29 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 _0xceef=['create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceef,0xf6));var _0xfcee=function(_0x17e1f7,_0x2894ad){_0x17e1f7=_0x17e1f7-0x0;var _0x1ac7ea=_0xceef[_0x17e1f7];return _0x1ac7ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfcee('0x0'));var timeout=require(_0xfcee('0x1'));var express=require('express');var router=express[_0xfcee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfcee('0x3'));var interaction=require(_0xfcee('0x4'));var config=require('../../config/environment');var controller=require(_0xfcee('0x5'));router[_0xfcee('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfcee('0x6')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller['show']);router['post']('/',auth[_0xfcee('0x8')](),controller[_0xfcee('0x9')]);router[_0xfcee('0xa')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller[_0xfcee('0xb')]);router[_0xfcee('0xc')]('/:id',auth[_0xfcee('0x8')](),controller[_0xfcee('0xd')]);module[_0xfcee('0xe')]=router; \ No newline at end of file +var _0xbd37=['index','isAuthenticated','show','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x411069,_0x16ae05){var _0x68c645=function(_0x55d1c8){while(--_0x55d1c8){_0x411069['push'](_0x411069['shift']());}};_0x68c645(++_0x16ae05);}(_0xbd37,0x13a));var _0x7bd3=function(_0x5ea846,_0x292a04){_0x5ea846=_0x5ea846-0x0;var _0x208f04=_0xbd37[_0x5ea846];return _0x208f04;};'use strict';var multer=require('multer');var util=require(_0x7bd3('0x0'));var path=require(_0x7bd3('0x1'));var timeout=require(_0x7bd3('0x2'));var express=require(_0x7bd3('0x3'));var router=express[_0x7bd3('0x4')]();var fs_extra=require(_0x7bd3('0x5'));var auth=require(_0x7bd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bd3('0x7'));var controller=require('./intDeskField.controller');router[_0x7bd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x7bd3('0x9')]);router[_0x7bd3('0x8')]('/:id',auth[_0x7bd3('0xa')](),controller[_0x7bd3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7bd3('0xc')]);router[_0x7bd3('0xd')](_0x7bd3('0xe'),auth[_0x7bd3('0xa')](),controller['update']);router[_0x7bd3('0xf')](_0x7bd3('0xe'),auth[_0x7bd3('0xa')](),controller['destroy']);module[_0x7bd3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 559ed1c..3422583 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 _0xbe78=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe78,0x10d));var _0x8be7=function(_0x56e607,_0x1a834d){_0x56e607=_0x56e607-0x0;var _0x3a8c12=_0xbe78[_0x56e607];return _0x3a8c12;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8be7('0x0')](_0x8be7('0x1'),_0x8be7('0x2'),_0x8be7('0x3'),_0x8be7('0x4'),_0x8be7('0x5')),'defaultValue':_0x8be7('0x1')},'content':{'type':Sequelize[_0x8be7('0x6')]},'key':{'type':Sequelize[_0x8be7('0x6')]},'keyType':{'type':Sequelize[_0x8be7('0x0')](_0x8be7('0x1'),_0x8be7('0x2'),_0x8be7('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8be7('0x6')]},'nameField':{'type':Sequelize[_0x8be7('0x6')]},'customField':{'type':Sequelize[_0x8be7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8be7('0x6')]}}; \ No newline at end of file +var _0xe30c=['STRING','customVariable','sequelize','exports','ENUM','keyValue','string'];(function(_0x102c78,_0x58a29f){var _0x25beee=function(_0x227191){while(--_0x227191){_0x102c78['push'](_0x102c78['shift']());}};_0x25beee(++_0x58a29f);}(_0xe30c,0x16e));var _0xce30=function(_0x2f212b,_0x38c5ee){_0x2f212b=_0x2f212b-0x0;var _0x52e6c9=_0xe30c[_0x2f212b];return _0x52e6c9;};'use strict';var Sequelize=require(_0xce30('0x0'));module[_0xce30('0x1')]={'type':{'type':Sequelize[_0xce30('0x2')]('string','variable','customVariable',_0xce30('0x3'),'picklist'),'defaultValue':_0xce30('0x4')},'content':{'type':Sequelize[_0xce30('0x5')]},'key':{'type':Sequelize[_0xce30('0x5')]},'keyType':{'type':Sequelize[_0xce30('0x2')]('string','variable',_0xce30('0x6'))},'keyContent':{'type':Sequelize[_0xce30('0x5')]},'idField':{'type':Sequelize[_0xce30('0x5')]},'nameField':{'type':Sequelize[_0xce30('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce30('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d138170..7ecba06 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 _0x2014=['status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','rows','catch','show','params','include','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4369ef,_0x55cfbc){var _0x5b6913=function(_0x7a7436){while(--_0x7a7436){_0x4369ef['push'](_0x4369ef['shift']());}};_0x5b6913(++_0x55cfbc);}(_0x2014,0x103));var _0x4201=function(_0x4bd043,_0x2ae539){_0x4bd043=_0x4bd043-0x0;var _0x4333f0=_0x2014[_0x4bd043];return _0x4333f0;};'use strict';var emlformat=require(_0x4201('0x0'));var rimraf=require(_0x4201('0x1'));var zipdir=require(_0x4201('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4201('0x3'));var moment=require(_0x4201('0x4'));var BPromise=require(_0x4201('0x5'));var Mustache=require(_0x4201('0x6'));var util=require('util');var path=require(_0x4201('0x7'));var sox=require(_0x4201('0x8'));var csv=require('to-csv');var ejs=require(_0x4201('0x9'));var fs=require('fs');var fs_extra=require(_0x4201('0xa'));var _=require('lodash');var squel=require(_0x4201('0xb'));var crypto=require('crypto');var jsforce=require(_0x4201('0xc'));var deskjs=require(_0x4201('0xd'));var toCsv=require(_0x4201('0xe'));var querystring=require(_0x4201('0xf'));var Papa=require(_0x4201('0x10'));var Redis=require(_0x4201('0x11'));var authService=require(_0x4201('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4201('0x13'))(_0x4201('0x14'));var utils=require(_0x4201('0x15'));var config=require(_0x4201('0x16'));var licenseUtil=require(_0x4201('0x17'));var db=require(_0x4201('0x18'))['db'];function respondWithStatusCode(_0x1d69e8,_0x454d9a){_0x454d9a=_0x454d9a||0xcc;return function(_0x358533){if(_0x358533){return _0x1d69e8['sendStatus'](_0x454d9a);}return _0x1d69e8[_0x4201('0x19')](_0x454d9a)[_0x4201('0x1a')]();};}function respondWithResult(_0x529c3d,_0x5e53e4){_0x5e53e4=_0x5e53e4||0xc8;return function(_0x208fd2){if(_0x208fd2){return _0x529c3d[_0x4201('0x19')](_0x5e53e4)[_0x4201('0x1b')](_0x208fd2);}};}function respondWithFilteredResult(_0x1068c3,_0xbae307){return function(_0x137b2a){if(_0x137b2a){var _0x74b067=typeof _0xbae307['offset']==='undefined'&&typeof _0xbae307[_0x4201('0x1c')]===_0x4201('0x1d');var _0x3a3232=_0x137b2a[_0x4201('0x1e')];var _0x1f6fe9=_0x74b067?0x0:_0xbae307[_0x4201('0x1f')];var _0x5d4235=_0x74b067?_0x137b2a['count']:_0xbae307[_0x4201('0x1f')]+_0xbae307[_0x4201('0x1c')];var _0x43ce5d;if(_0x5d4235>=_0x3a3232){_0x5d4235=_0x3a3232;_0x43ce5d=0xc8;}else{_0x43ce5d=0xce;}_0x1068c3[_0x4201('0x19')](_0x43ce5d);return _0x1068c3[_0x4201('0x20')]('Content-Range',_0x1f6fe9+'-'+_0x5d4235+'/'+_0x3a3232)[_0x4201('0x1b')](_0x137b2a);}return null;};}function patchUpdates(_0x5a8989){return function(_0x105cac){try{jsonpatch[_0x4201('0x21')](_0x105cac,_0x5a8989,!![]);}catch(_0x278f0a){return BPromise[_0x4201('0x22')](_0x278f0a);}return _0x105cac[_0x4201('0x23')]();};}function saveUpdates(_0x1d658c,_0x112744){return function(_0x11562b){if(_0x11562b){return _0x11562b['update'](_0x1d658c)[_0x4201('0x24')](function(_0xd8d6e2){return _0xd8d6e2;});}return null;};}function removeEntity(_0x3aa1cd,_0x4c3f88){return function(_0x5c38e8){if(_0x5c38e8){return _0x5c38e8[_0x4201('0x25')]()['then'](function(){_0x3aa1cd[_0x4201('0x19')](0xcc)[_0x4201('0x1a')]();});}};}function handleEntityNotFound(_0x426d53,_0x4f8626){return function(_0x35eaae){if(!_0x35eaae){_0x426d53['sendStatus'](0x194);}return _0x35eaae;};}function handleError(_0xf76f63,_0x4b855e){_0x4b855e=_0x4b855e||0x1f4;return function(_0x408c99){logger[_0x4201('0x26')](_0x408c99['stack']);if(_0x408c99[_0x4201('0x27')]){delete _0x408c99[_0x4201('0x27')];}_0xf76f63[_0x4201('0x19')](_0x4b855e)[_0x4201('0x28')](_0x408c99);};}exports[_0x4201('0x29')]=function(_0x40e2d4,_0x31fb99){var _0x45bb3a={},_0xc6b8ab={},_0x56c03e={'count':0x0,'rows':[]};var _0x57bae4=_[_0x4201('0x2a')](db[_0x4201('0x2b')][_0x4201('0x2c')],function(_0x38cb6c){return{'name':_0x38cb6c[_0x4201('0x2d')],'type':_0x38cb6c['type'][_0x4201('0x2e')]};});_0xc6b8ab[_0x4201('0x2f')]=_['map'](_0x57bae4,_0x4201('0x27'));_0xc6b8ab[_0x4201('0x30')]=_[_0x4201('0x31')](_0x40e2d4[_0x4201('0x30')]);_0xc6b8ab['filters']=_[_0x4201('0x32')](_0xc6b8ab[_0x4201('0x2f')],_0xc6b8ab[_0x4201('0x30')]);_0x45bb3a[_0x4201('0x33')]=_[_0x4201('0x32')](_0xc6b8ab[_0x4201('0x2f')],qs[_0x4201('0x34')](_0x40e2d4[_0x4201('0x30')][_0x4201('0x34')]));_0x45bb3a['attributes']=_0x45bb3a[_0x4201('0x33')][_0x4201('0x35')]?_0x45bb3a['attributes']:_0xc6b8ab['model'];if(!_0x40e2d4[_0x4201('0x30')]['hasOwnProperty'](_0x4201('0x36'))){_0x45bb3a[_0x4201('0x1c')]=qs[_0x4201('0x1c')](_0x40e2d4[_0x4201('0x30')]['limit']);_0x45bb3a[_0x4201('0x1f')]=qs[_0x4201('0x1f')](_0x40e2d4[_0x4201('0x30')]['offset']);}_0x45bb3a['order']=qs[_0x4201('0x37')](_0x40e2d4[_0x4201('0x30')][_0x4201('0x37')]);_0x45bb3a['where']=qs['filters'](_['pick'](_0x40e2d4[_0x4201('0x30')],_0xc6b8ab[_0x4201('0x38')]),_0x57bae4);if(_0x40e2d4[_0x4201('0x30')][_0x4201('0x39')]){_0x45bb3a[_0x4201('0x3a')]=_[_0x4201('0x3b')](_0x45bb3a['where'],{'$or':_[_0x4201('0x2a')](_0x57bae4,function(_0x832c21){if(_0x832c21['type']!==_0x4201('0x3c')){var _0x467055={};_0x467055[_0x832c21[_0x4201('0x27')]]={'$like':'%'+_0x40e2d4[_0x4201('0x30')][_0x4201('0x39')]+'%'};return _0x467055;}})});}_0x45bb3a=_[_0x4201('0x3b')]({},_0x45bb3a,_0x40e2d4[_0x4201('0x3d')]);var _0x2d6876={'where':_0x45bb3a['where']};return db[_0x4201('0x2b')][_0x4201('0x1e')](_0x2d6876)[_0x4201('0x24')](function(_0x717c70){_0x56c03e[_0x4201('0x1e')]=_0x717c70;if(_0x40e2d4[_0x4201('0x30')]['includeAll']){_0x45bb3a['include']=[{'all':!![]}];}return db[_0x4201('0x2b')]['findAll'](_0x45bb3a);})[_0x4201('0x24')](function(_0x21f779){_0x56c03e[_0x4201('0x3e')]=_0x21f779;return _0x56c03e;})['then'](respondWithFilteredResult(_0x31fb99,_0x45bb3a))[_0x4201('0x3f')](handleError(_0x31fb99,null));};exports[_0x4201('0x40')]=function(_0x3b1ea1,_0x5d2ba1){var _0x49c15a={'raw':!![],'where':{'id':_0x3b1ea1[_0x4201('0x41')]['id']}},_0x53fe5a={};_0x53fe5a[_0x4201('0x2f')]=_[_0x4201('0x31')](db[_0x4201('0x2b')][_0x4201('0x2c')]);_0x53fe5a[_0x4201('0x30')]=_[_0x4201('0x31')](_0x3b1ea1['query']);_0x53fe5a[_0x4201('0x38')]=_[_0x4201('0x32')](_0x53fe5a[_0x4201('0x2f')],_0x53fe5a[_0x4201('0x30')]);_0x49c15a[_0x4201('0x33')]=_[_0x4201('0x32')](_0x53fe5a[_0x4201('0x2f')],qs[_0x4201('0x34')](_0x3b1ea1[_0x4201('0x30')][_0x4201('0x34')]));_0x49c15a['attributes']=_0x49c15a[_0x4201('0x33')][_0x4201('0x35')]?_0x49c15a[_0x4201('0x33')]:_0x53fe5a[_0x4201('0x2f')];if(_0x3b1ea1[_0x4201('0x30')]['includeAll']){_0x49c15a[_0x4201('0x42')]=[{'all':!![]}];}_0x49c15a=_[_0x4201('0x3b')]({},_0x49c15a,_0x3b1ea1[_0x4201('0x3d')]);return db[_0x4201('0x2b')][_0x4201('0x43')](_0x49c15a)['then'](handleEntityNotFound(_0x5d2ba1,null))[_0x4201('0x24')](respondWithResult(_0x5d2ba1,null))[_0x4201('0x3f')](handleError(_0x5d2ba1,null));};exports[_0x4201('0x44')]=function(_0x4355ca,_0x5ca73){return db['DeskField'][_0x4201('0x44')](_0x4355ca['body'],{})[_0x4201('0x24')](respondWithResult(_0x5ca73,0xc9))[_0x4201('0x3f')](handleError(_0x5ca73,null));};exports[_0x4201('0x45')]=function(_0x3dbbb5,_0x827bb4){if(_0x3dbbb5[_0x4201('0x46')]['id']){delete _0x3dbbb5[_0x4201('0x46')]['id'];}return db[_0x4201('0x2b')][_0x4201('0x43')]({'where':{'id':_0x3dbbb5[_0x4201('0x41')]['id']}})['then'](handleEntityNotFound(_0x827bb4,null))[_0x4201('0x24')](saveUpdates(_0x3dbbb5['body'],null))['then'](respondWithResult(_0x827bb4,null))[_0x4201('0x3f')](handleError(_0x827bb4,null));};exports[_0x4201('0x25')]=function(_0x3079e3,_0x380110){return db[_0x4201('0x2b')][_0x4201('0x43')]({'where':{'id':_0x3079e3[_0x4201('0x41')]['id']}})[_0x4201('0x24')](handleEntityNotFound(_0x380110,null))[_0x4201('0x24')](removeEntity(_0x380110,null))[_0x4201('0x3f')](handleError(_0x380110,null));}; \ No newline at end of file +var _0x31b9=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','limit','set'];(function(_0x5975e1,_0x272db4){var _0x188881=function(_0x794f2b){while(--_0x794f2b){_0x5975e1['push'](_0x5975e1['shift']());}};_0x188881(++_0x272db4);}(_0x31b9,0x7c));var _0x931b=function(_0x33051a,_0x25d8a0){_0x33051a=_0x33051a-0x0;var _0xa09328=_0x31b9[_0x33051a];return _0xa09328;};'use strict';var emlformat=require(_0x931b('0x0'));var rimraf=require(_0x931b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x931b('0x2'));var rp=require(_0x931b('0x3'));var moment=require(_0x931b('0x4'));var BPromise=require(_0x931b('0x5'));var Mustache=require(_0x931b('0x6'));var util=require(_0x931b('0x7'));var path=require('path');var sox=require(_0x931b('0x8'));var csv=require(_0x931b('0x9'));var ejs=require(_0x931b('0xa'));var fs=require('fs');var fs_extra=require(_0x931b('0xb'));var _=require(_0x931b('0xc'));var squel=require(_0x931b('0xd'));var crypto=require(_0x931b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x931b('0xf'));var toCsv=require(_0x931b('0x9'));var querystring=require(_0x931b('0x10'));var Papa=require(_0x931b('0x11'));var Redis=require(_0x931b('0x12'));var authService=require(_0x931b('0x13'));var qs=require(_0x931b('0x14'));var as=require(_0x931b('0x15'));var hardwareService=require(_0x931b('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x931b('0x17'));var licenseUtil=require(_0x931b('0x18'));var db=require(_0x931b('0x19'))['db'];function respondWithStatusCode(_0x2be239,_0x2bc4e1){_0x2bc4e1=_0x2bc4e1||0xcc;return function(_0x2aeff4){if(_0x2aeff4){return _0x2be239['sendStatus'](_0x2bc4e1);}return _0x2be239[_0x931b('0x1a')](_0x2bc4e1)[_0x931b('0x1b')]();};}function respondWithResult(_0x4bd95d,_0x187615){_0x187615=_0x187615||0xc8;return function(_0x3e2d93){if(_0x3e2d93){return _0x4bd95d[_0x931b('0x1a')](_0x187615)['json'](_0x3e2d93);}};}function respondWithFilteredResult(_0x49a4e8,_0x4ebdd2){return function(_0x54c14c){if(_0x54c14c){var _0x3a024d=typeof _0x4ebdd2['offset']==='undefined'&&typeof _0x4ebdd2['limit']===_0x931b('0x1c');var _0x1d2a70=_0x54c14c[_0x931b('0x1d')];var _0x5b7b50=_0x3a024d?0x0:_0x4ebdd2['offset'];var _0xc81f11=_0x3a024d?_0x54c14c[_0x931b('0x1d')]:_0x4ebdd2['offset']+_0x4ebdd2[_0x931b('0x1e')];var _0x29307d;if(_0xc81f11>=_0x1d2a70){_0xc81f11=_0x1d2a70;_0x29307d=0xc8;}else{_0x29307d=0xce;}_0x49a4e8[_0x931b('0x1a')](_0x29307d);return _0x49a4e8[_0x931b('0x1f')](_0x931b('0x20'),_0x5b7b50+'-'+_0xc81f11+'/'+_0x1d2a70)[_0x931b('0x21')](_0x54c14c);}return null;};}function patchUpdates(_0xca8528){return function(_0x53acec){try{jsonpatch[_0x931b('0x22')](_0x53acec,_0xca8528,!![]);}catch(_0x5db9f3){return BPromise[_0x931b('0x23')](_0x5db9f3);}return _0x53acec[_0x931b('0x24')]();};}function saveUpdates(_0x35f703,_0x5dc10b){return function(_0xd0cc68){if(_0xd0cc68){return _0xd0cc68[_0x931b('0x25')](_0x35f703)[_0x931b('0x26')](function(_0x371707){return _0x371707;});}return null;};}function removeEntity(_0x1fb228,_0x4bcda6){return function(_0x15ca7a){if(_0x15ca7a){return _0x15ca7a[_0x931b('0x27')]()[_0x931b('0x26')](function(){_0x1fb228[_0x931b('0x1a')](0xcc)[_0x931b('0x1b')]();});}};}function handleEntityNotFound(_0x562329,_0x4e56b0){return function(_0x54b067){if(!_0x54b067){_0x562329[_0x931b('0x28')](0x194);}return _0x54b067;};}function handleError(_0x1dc494,_0x2ff698){_0x2ff698=_0x2ff698||0x1f4;return function(_0x418917){logger[_0x931b('0x29')](_0x418917['stack']);if(_0x418917['name']){delete _0x418917[_0x931b('0x2a')];}_0x1dc494[_0x931b('0x1a')](_0x2ff698)['send'](_0x418917);};}exports['index']=function(_0x1b94bc,_0x40ba39){var _0x3b6f4a={},_0x189a2f={},_0x22a338={'count':0x0,'rows':[]};var _0x11c7de=_[_0x931b('0x2b')](db[_0x931b('0x2c')][_0x931b('0x2d')],function(_0x3ced31){return{'name':_0x3ced31[_0x931b('0x2e')],'type':_0x3ced31['type'][_0x931b('0x2f')]};});_0x189a2f[_0x931b('0x30')]=_['map'](_0x11c7de,_0x931b('0x2a'));_0x189a2f[_0x931b('0x31')]=_[_0x931b('0x32')](_0x1b94bc[_0x931b('0x31')]);_0x189a2f['filters']=_[_0x931b('0x33')](_0x189a2f[_0x931b('0x30')],_0x189a2f['query']);_0x3b6f4a['attributes']=_['intersection'](_0x189a2f['model'],qs['fields'](_0x1b94bc['query'][_0x931b('0x34')]));_0x3b6f4a[_0x931b('0x35')]=_0x3b6f4a[_0x931b('0x35')][_0x931b('0x36')]?_0x3b6f4a[_0x931b('0x35')]:_0x189a2f[_0x931b('0x30')];if(!_0x1b94bc[_0x931b('0x31')][_0x931b('0x37')](_0x931b('0x38'))){_0x3b6f4a['limit']=qs['limit'](_0x1b94bc['query'][_0x931b('0x1e')]);_0x3b6f4a[_0x931b('0x39')]=qs[_0x931b('0x39')](_0x1b94bc[_0x931b('0x31')]['offset']);}_0x3b6f4a[_0x931b('0x3a')]=qs[_0x931b('0x3b')](_0x1b94bc[_0x931b('0x31')][_0x931b('0x3b')]);_0x3b6f4a[_0x931b('0x3c')]=qs[_0x931b('0x3d')](_[_0x931b('0x3e')](_0x1b94bc[_0x931b('0x31')],_0x189a2f[_0x931b('0x3d')]),_0x11c7de);if(_0x1b94bc['query'][_0x931b('0x3f')]){_0x3b6f4a[_0x931b('0x3c')]=_[_0x931b('0x40')](_0x3b6f4a['where'],{'$or':_[_0x931b('0x2b')](_0x11c7de,function(_0xb9716){if(_0xb9716[_0x931b('0x41')]!==_0x931b('0x42')){var _0x21f5c7={};_0x21f5c7[_0xb9716['name']]={'$like':'%'+_0x1b94bc[_0x931b('0x31')][_0x931b('0x3f')]+'%'};return _0x21f5c7;}})});}_0x3b6f4a=_[_0x931b('0x40')]({},_0x3b6f4a,_0x1b94bc[_0x931b('0x43')]);var _0x586691={'where':_0x3b6f4a['where']};return db['DeskField'][_0x931b('0x1d')](_0x586691)['then'](function(_0x30d5d6){_0x22a338[_0x931b('0x1d')]=_0x30d5d6;if(_0x1b94bc[_0x931b('0x31')][_0x931b('0x44')]){_0x3b6f4a[_0x931b('0x45')]=[{'all':!![]}];}return db['DeskField'][_0x931b('0x46')](_0x3b6f4a);})['then'](function(_0x10ac3e){_0x22a338[_0x931b('0x47')]=_0x10ac3e;return _0x22a338;})[_0x931b('0x26')](respondWithFilteredResult(_0x40ba39,_0x3b6f4a))[_0x931b('0x48')](handleError(_0x40ba39,null));};exports[_0x931b('0x49')]=function(_0x3bf4b9,_0x2ef8fd){var _0x3a8e3b={'raw':!![],'where':{'id':_0x3bf4b9['params']['id']}},_0x578954={};_0x578954[_0x931b('0x30')]=_[_0x931b('0x32')](db[_0x931b('0x2c')][_0x931b('0x2d')]);_0x578954[_0x931b('0x31')]=_[_0x931b('0x32')](_0x3bf4b9[_0x931b('0x31')]);_0x578954[_0x931b('0x3d')]=_['intersection'](_0x578954[_0x931b('0x30')],_0x578954[_0x931b('0x31')]);_0x3a8e3b[_0x931b('0x35')]=_[_0x931b('0x33')](_0x578954[_0x931b('0x30')],qs[_0x931b('0x34')](_0x3bf4b9[_0x931b('0x31')][_0x931b('0x34')]));_0x3a8e3b['attributes']=_0x3a8e3b[_0x931b('0x35')]['length']?_0x3a8e3b[_0x931b('0x35')]:_0x578954['model'];if(_0x3bf4b9['query'][_0x931b('0x44')]){_0x3a8e3b[_0x931b('0x45')]=[{'all':!![]}];}_0x3a8e3b=_[_0x931b('0x40')]({},_0x3a8e3b,_0x3bf4b9[_0x931b('0x43')]);return db[_0x931b('0x2c')][_0x931b('0x4a')](_0x3a8e3b)['then'](handleEntityNotFound(_0x2ef8fd,null))[_0x931b('0x26')](respondWithResult(_0x2ef8fd,null))[_0x931b('0x48')](handleError(_0x2ef8fd,null));};exports[_0x931b('0x4b')]=function(_0x4e9867,_0x4f421c){return db[_0x931b('0x2c')][_0x931b('0x4b')](_0x4e9867[_0x931b('0x4c')],{})['then'](respondWithResult(_0x4f421c,0xc9))[_0x931b('0x48')](handleError(_0x4f421c,null));};exports['update']=function(_0x548415,_0x4ce48d){if(_0x548415[_0x931b('0x4c')]['id']){delete _0x548415[_0x931b('0x4c')]['id'];}return db[_0x931b('0x2c')]['find']({'where':{'id':_0x548415[_0x931b('0x4d')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0x4ce48d,null))[_0x931b('0x26')](saveUpdates(_0x548415[_0x931b('0x4c')],null))[_0x931b('0x26')](respondWithResult(_0x4ce48d,null))[_0x931b('0x48')](handleError(_0x4ce48d,null));};exports[_0x931b('0x27')]=function(_0xf6b1e9,_0x770033){return db['DeskField']['find']({'where':{'id':_0xf6b1e9[_0x931b('0x4d')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0x770033,null))[_0x931b('0x26')](removeEntity(_0x770033,null))[_0x931b('0x48')](handleError(_0x770033,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 95f81e8..d4ae131 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 _0x820f=['path','rimraf','../../config/environment','exports','define','DeskField','FieldId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x820f,0x19f));var _0xf820=function(_0x439aa2,_0x16f27c){_0x439aa2=_0x439aa2-0x0;var _0x110b71=_0x820f[_0x439aa2];return _0x110b71;};'use strict';var _=require(_0xf820('0x0'));var util=require(_0xf820('0x1'));var logger=require(_0xf820('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf820('0x3'));var rp=require(_0xf820('0x4'));var fs=require('fs');var path=require(_0xf820('0x5'));var rimraf=require(_0xf820('0x6'));var config=require(_0xf820('0x7'));var attributes=require('./intDeskField.attributes');module[_0xf820('0x8')]=function(_0x336616,_0x4e7ad4){return _0x336616[_0xf820('0x9')](_0xf820('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xf820('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe127=['DeskField','desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x5d4278,_0x53e712){var _0x23345a=function(_0x438955){while(--_0x438955){_0x5d4278['push'](_0x5d4278['shift']());}};_0x23345a(++_0x53e712);}(_0xe127,0x86));var _0x7e12=function(_0x45513e,_0xf19035){_0x45513e=_0x45513e-0x0;var _0x629da4=_0xe127[_0x45513e];return _0x629da4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e12('0x0'))(_0x7e12('0x1'));var moment=require(_0x7e12('0x2'));var BPromise=require(_0x7e12('0x3'));var rp=require(_0x7e12('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e12('0x5'));var attributes=require(_0x7e12('0x6'));module[_0x7e12('0x7')]=function(_0x3cd637,_0x552f43){return _0x3cd637[_0x7e12('0x8')](_0x7e12('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7e12('0xa'),'fields':[_0x7e12('0xb'),_0x7e12('0xc')],'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 c5dc662..93bac63 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 _0x58c9=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x58c9,0xad));var _0x958c=function(_0xbd8263,_0x48df8d){_0xbd8263=_0xbd8263-0x0;var _0x149bd6=_0x58c9[_0xbd8263];return _0x149bd6;};'use strict';var _=require(_0x958c('0x0'));var util=require('util');var moment=require(_0x958c('0x1'));var BPromise=require(_0x958c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x958c('0x3'));var db=require(_0x958c('0x4'))['db'];var utils=require(_0x958c('0x5'));var logger=require(_0x958c('0x6'))(_0x958c('0x7'));var config=require(_0x958c('0x8'));var jayson=require(_0x958c('0x9'));var client=jayson[_0x958c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33d3e2,_0x3be946,_0xfba7f8){return new BPromise(function(_0xe42cfc,_0x175bc2){return client[_0x958c('0xb')](_0x33d3e2,_0xfba7f8)[_0x958c('0xc')](function(_0x5098a4){logger[_0x958c('0xd')](_0x958c('0xe'),_0x3be946,_0x958c('0xf'));logger['debug'](_0x958c('0x10'),_0x3be946,_0x958c('0xf'),JSON[_0x958c('0x11')](_0x5098a4));if(_0x5098a4['error']){if(_0x5098a4[_0x958c('0x12')][_0x958c('0x13')]===0x1f4){logger[_0x958c('0x12')](_0x958c('0xe'),_0x3be946,_0x5098a4[_0x958c('0x12')][_0x958c('0x14')]);return _0x175bc2(_0x5098a4[_0x958c('0x12')][_0x958c('0x14')]);}logger[_0x958c('0x12')](_0x958c('0xe'),_0x3be946,_0x5098a4[_0x958c('0x12')][_0x958c('0x14')]);return _0xe42cfc(_0x5098a4['error'][_0x958c('0x14')]);}else{logger[_0x958c('0xd')](_0x958c('0xe'),_0x3be946,_0x958c('0xf'));_0xe42cfc(_0x5098a4[_0x958c('0x15')][_0x958c('0x14')]);}})[_0x958c('0x16')](function(_0x63d8cd){logger['error'](_0x958c('0xe'),_0x3be946,_0x63d8cd);_0x175bc2(_0x63d8cd);});});} \ No newline at end of file +var _0x12fd=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x39f745,_0x178dd4){var _0x449e0e=function(_0x2f8714){while(--_0x2f8714){_0x39f745['push'](_0x39f745['shift']());}};_0x449e0e(++_0x178dd4);}(_0x12fd,0x195));var _0xd12f=function(_0x4d3aec,_0x56e90c){_0x4d3aec=_0x4d3aec-0x0;var _0x9b4b23=_0x12fd[_0x4d3aec];return _0x9b4b23;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var moment=require(_0xd12f('0x2'));var BPromise=require(_0xd12f('0x3'));var rs=require(_0xd12f('0x4'));var fs=require('fs');var Redis=require(_0xd12f('0x5'));var db=require(_0xd12f('0x6'))['db'];var utils=require(_0xd12f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd12f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31963b,_0x3d9b38,_0x4847d1){return new BPromise(function(_0x182afc,_0x49caaa){return client[_0xd12f('0x9')](_0x31963b,_0x4847d1)[_0xd12f('0xa')](function(_0x1a0a63){logger[_0xd12f('0xb')](_0xd12f('0xc'),_0x3d9b38,_0xd12f('0xd'));logger['debug'](_0xd12f('0xe'),_0x3d9b38,_0xd12f('0xd'),JSON['stringify'](_0x1a0a63));if(_0x1a0a63[_0xd12f('0xf')]){if(_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x10')]===0x1f4){logger[_0xd12f('0xf')](_0xd12f('0xc'),_0x3d9b38,_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x11')]);return _0x49caaa(_0x1a0a63[_0xd12f('0xf')]['message']);}logger[_0xd12f('0xf')](_0xd12f('0xc'),_0x3d9b38,_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x11')]);return _0x182afc(_0x1a0a63['error'][_0xd12f('0x11')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x3d9b38,_0xd12f('0xd'));_0x182afc(_0x1a0a63[_0xd12f('0x12')][_0xd12f('0x11')]);}})[_0xd12f('0x13')](function(_0x60b2c){logger[_0xd12f('0xf')]('DeskField,\x20%s,\x20%s',_0x3d9b38,_0x60b2c);_0x49caaa(_0x60b2c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7aa1ee1..3327987 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 _0xed32=['isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','index','get'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0xed32,0x18c));var _0x2ed3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xed32[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x2ed3('0x0'));var util=require(_0x2ed3('0x1'));var path=require(_0x2ed3('0x2'));var timeout=require(_0x2ed3('0x3'));var express=require(_0x2ed3('0x4'));var router=express[_0x2ed3('0x5')]();var fs_extra=require(_0x2ed3('0x6'));var auth=require(_0x2ed3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2ed3('0x8'));var controller=require(_0x2ed3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ed3('0xa')]);router[_0x2ed3('0xb')]('/:id',auth[_0x2ed3('0xc')](),controller['show']);router['get'](_0x2ed3('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2ed3('0xb')](_0x2ed3('0xe'),auth[_0x2ed3('0xc')](),controller[_0x2ed3('0xf')]);router[_0x2ed3('0x10')]('/',auth['isAuthenticated'](),controller[_0x2ed3('0x11')]);router[_0x2ed3('0x10')](_0x2ed3('0xd'),auth[_0x2ed3('0xc')](),controller[_0x2ed3('0x12')]);router[_0x2ed3('0x13')](_0x2ed3('0x14'),auth['isAuthenticated'](),controller[_0x2ed3('0x15')]);router[_0x2ed3('0x16')](_0x2ed3('0x14'),auth[_0x2ed3('0xc')](),controller[_0x2ed3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x71bb=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20cff1,_0x393351){var _0x442423=function(_0x380c47){while(--_0x380c47){_0x20cff1['push'](_0x20cff1['shift']());}};_0x442423(++_0x393351);}(_0x71bb,0x10c));var _0xb71b=function(_0xf00260,_0x13af02){_0xf00260=_0xf00260-0x0;var _0xf0cc76=_0x71bb[_0xf00260];return _0xf0cc76;};'use strict';var multer=require(_0xb71b('0x0'));var util=require('util');var path=require(_0xb71b('0x1'));var timeout=require(_0xb71b('0x2'));var express=require(_0xb71b('0x3'));var router=express[_0xb71b('0x4')]();var fs_extra=require(_0xb71b('0x5'));var auth=require(_0xb71b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb71b('0x7'));router[_0xb71b('0x8')]('/',auth[_0xb71b('0x9')](),controller[_0xb71b('0xa')]);router[_0xb71b('0x8')](_0xb71b('0xb'),auth[_0xb71b('0x9')](),controller[_0xb71b('0xc')]);router[_0xb71b('0x8')](_0xb71b('0xd'),auth[_0xb71b('0x9')](),controller[_0xb71b('0xe')]);router[_0xb71b('0x8')](_0xb71b('0xf'),auth[_0xb71b('0x9')](),controller[_0xb71b('0x10')]);router[_0xb71b('0x11')]('/',auth[_0xb71b('0x9')](),controller[_0xb71b('0x12')]);router[_0xb71b('0x11')]('/:id/configurations',auth[_0xb71b('0x9')](),controller[_0xb71b('0x13')]);router[_0xb71b('0x14')]('/:id',auth[_0xb71b('0x9')](),controller[_0xb71b('0x15')]);router[_0xb71b('0x16')](_0xb71b('0xb'),auth[_0xb71b('0x9')](),controller[_0xb71b('0x17')]);module[_0xb71b('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 61cddf8..0372f5d 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 _0x86f4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x33ed49,_0x1377c4){var _0x49a13f=function(_0x4f6f2a){while(--_0x4f6f2a){_0x33ed49['push'](_0x33ed49['shift']());}};_0x49a13f(++_0x1377c4);}(_0x86f4,0x18a));var _0x486f=function(_0x2cbb7c,_0x13471b){_0x2cbb7c=_0x2cbb7c-0x0;var _0x50046d=_0x86f4[_0x2cbb7c];return _0x50046d;};'use strict';var Sequelize=require(_0x486f('0x0'));module[_0x486f('0x1')]={'name':{'type':Sequelize[_0x486f('0x2')]},'username':{'type':Sequelize[_0x486f('0x2')]},'password':{'type':Sequelize[_0x486f('0x2')]},'remoteUri':{'type':Sequelize[_0x486f('0x2')]},'tenantId':{'type':Sequelize[_0x486f('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x486f('0x2')]},'serverUrl':{'type':Sequelize[_0x486f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x486f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc1fa=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1c5968,_0x68d40c){var _0x290441=function(_0x5e2f4b){while(--_0x5e2f4b){_0x1c5968['push'](_0x1c5968['shift']());}};_0x290441(++_0x68d40c);}(_0xc1fa,0x83));var _0xac1f=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xc1fa[_0x142020];return _0x40da8f;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'name':{'type':Sequelize[_0xac1f('0x2')]},'username':{'type':Sequelize[_0xac1f('0x2')]},'password':{'type':Sequelize[_0xac1f('0x2')]},'remoteUri':{'type':Sequelize[_0xac1f('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xac1f('0x2')]},'clientSecret':{'type':Sequelize[_0xac1f('0x2')]},'serverUrl':{'type':Sequelize[_0xac1f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac1f('0x2')]},'modernAuthentication':{'type':Sequelize[_0xac1f('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 9de7ee5..91fe0df 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 _0x6c38=['findAll','rows','show','find','create','body','params','catch','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','clientId','modernAuthentication','CloudProvider','data7','access_token','remoteUri','POST','tenantId','/oauth2/token','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','substring','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','json','offset','limit','undefined','status','set','Content-Range','update','then','end','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x49eb06,_0x47d2b6){var _0x4b8d67=function(_0xe1161e){while(--_0xe1161e){_0x49eb06['push'](_0x49eb06['shift']());}};_0x4b8d67(++_0x47d2b6);}(_0x6c38,0x8f));var _0x86c3=function(_0xf018cb,_0x189731){_0xf018cb=_0xf018cb-0x0;var _0x22997f=_0x6c38[_0xf018cb];return _0x22997f;};'use strict';var rp=require(_0x86c3('0x0'));var util=require(_0x86c3('0x1'));var _=require(_0x86c3('0x2'));var qs=require(_0x86c3('0x3'));var logger=require(_0x86c3('0x4'))('api');var db=require(_0x86c3('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x503f44,_0x55bdeb){_0x55bdeb=_0x55bdeb||0xc8;return function(_0x40faa8){if(_0x40faa8){return _0x503f44['status'](_0x55bdeb)[_0x86c3('0x6')](_0x40faa8);}};}function respondWithFilteredResult(_0x5b38ae,_0x49ff58){return function(_0x3a8924){if(_0x3a8924){var _0xbde89c=typeof _0x49ff58[_0x86c3('0x7')]==='undefined'&&typeof _0x49ff58[_0x86c3('0x8')]===_0x86c3('0x9');var _0x4df76e=_0x3a8924['count'];var _0x56998f=_0xbde89c?0x0:_0x49ff58[_0x86c3('0x7')];var _0x2136c4=_0xbde89c?_0x3a8924['count']:_0x49ff58[_0x86c3('0x7')]+_0x49ff58['limit'];var _0x357f7e;if(_0x2136c4>=_0x4df76e){_0x2136c4=_0x4df76e;_0x357f7e=0xc8;}else{_0x357f7e=0xce;}_0x5b38ae[_0x86c3('0xa')](_0x357f7e);return _0x5b38ae[_0x86c3('0xb')](_0x86c3('0xc'),_0x56998f+'-'+_0x2136c4+'/'+_0x4df76e)[_0x86c3('0x6')](_0x3a8924);}return null;};}function saveUpdates(_0x15c28d){return function(_0x505d01){if(_0x505d01){return _0x505d01[_0x86c3('0xd')](_0x15c28d)[_0x86c3('0xe')](function(_0x5b184d){return _0x5b184d;});}return null;};}function removeEntity(_0x113f46){return function(_0x265983){if(_0x265983){return _0x265983['destroy']()[_0x86c3('0xe')](function(){_0x113f46['status'](0xcc)[_0x86c3('0xf')]();});}};}function handleEntityNotFound(_0x3044f1){return function(_0x15f782){if(!_0x15f782){_0x3044f1[_0x86c3('0x10')](0x194);}return _0x15f782;};}function handleError(_0x340386,_0xa36c57){_0xa36c57=_0xa36c57||0x1f4;return function(_0x2153dc){logger['error'](_0x2153dc[_0x86c3('0x11')]);if(_0x2153dc[_0x86c3('0x12')]){delete _0x2153dc[_0x86c3('0x12')];}_0x340386[_0x86c3('0xa')](_0xa36c57)['send'](_0x2153dc);};}exports[_0x86c3('0x13')]=function(_0x57b92e,_0x5e35af){var _0x389f35={},_0x12329e={},_0x5102cb={'count':0x0,'rows':[]};var _0x1ab2a3=_[_0x86c3('0x14')](db[_0x86c3('0x15')][_0x86c3('0x16')],function(_0x46ae19){return{'name':_0x46ae19['fieldName'],'type':_0x46ae19[_0x86c3('0x17')][_0x86c3('0x18')]};});_0x12329e['model']=_[_0x86c3('0x14')](_0x1ab2a3,_0x86c3('0x12'));_0x12329e['query']=_[_0x86c3('0x19')](_0x57b92e['query']);_0x12329e['filters']=_[_0x86c3('0x1a')](_0x12329e[_0x86c3('0x1b')],_0x12329e[_0x86c3('0x1c')]);_0x389f35[_0x86c3('0x1d')]=_[_0x86c3('0x1a')](_0x12329e['model'],qs[_0x86c3('0x1e')](_0x57b92e[_0x86c3('0x1c')]['fields']));_0x389f35[_0x86c3('0x1d')]=_0x389f35[_0x86c3('0x1d')][_0x86c3('0x1f')]?_0x389f35[_0x86c3('0x1d')]:_0x12329e[_0x86c3('0x1b')];if(!_0x57b92e['query'][_0x86c3('0x20')](_0x86c3('0x21'))){_0x389f35[_0x86c3('0x8')]=qs[_0x86c3('0x8')](_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x8')]);_0x389f35[_0x86c3('0x7')]=qs['offset'](_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x7')]);}_0x389f35[_0x86c3('0x22')]=qs[_0x86c3('0x23')](_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x23')]);_0x389f35[_0x86c3('0x24')]=qs[_0x86c3('0x25')](_[_0x86c3('0x26')](_0x57b92e[_0x86c3('0x1c')],_0x12329e[_0x86c3('0x25')]),_0x1ab2a3);if(_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x27')]){_0x389f35[_0x86c3('0x24')]=_[_0x86c3('0x28')](_0x389f35[_0x86c3('0x24')],{'$or':_['map'](_0x1ab2a3,function(_0x185945){if(_0x185945[_0x86c3('0x17')]!==_0x86c3('0x29')){var _0x15f728={};_0x15f728[_0x185945[_0x86c3('0x12')]]={'$like':'%'+_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x27')]+'%'};return _0x15f728;}})});}_0x389f35=_[_0x86c3('0x28')]({},_0x389f35,_0x57b92e[_0x86c3('0x2a')]);var _0x48c10={'where':_0x389f35[_0x86c3('0x24')]};return db['Dynamics365Account'][_0x86c3('0x2b')](_0x48c10)[_0x86c3('0xe')](function(_0x55e7f2){_0x5102cb[_0x86c3('0x2b')]=_0x55e7f2;if(_0x57b92e[_0x86c3('0x1c')][_0x86c3('0x2c')]){_0x389f35[_0x86c3('0x2d')]=[{'all':!![]}];}return db[_0x86c3('0x15')][_0x86c3('0x2e')](_0x389f35);})[_0x86c3('0xe')](function(_0x1f1172){_0x5102cb[_0x86c3('0x2f')]=_0x1f1172;return _0x5102cb;})[_0x86c3('0xe')](respondWithFilteredResult(_0x5e35af,_0x389f35))['catch'](handleError(_0x5e35af,null));};exports[_0x86c3('0x30')]=function(_0x16cfb1,_0x1a126c){var _0xc274b2={'raw':![],'where':{'id':_0x16cfb1['params']['id']}},_0x3f2184={};_0x3f2184[_0x86c3('0x1b')]=_[_0x86c3('0x19')](db['Dynamics365Account']['rawAttributes']);_0x3f2184['query']=_[_0x86c3('0x19')](_0x16cfb1[_0x86c3('0x1c')]);_0x3f2184[_0x86c3('0x25')]=_[_0x86c3('0x1a')](_0x3f2184[_0x86c3('0x1b')],_0x3f2184[_0x86c3('0x1c')]);_0xc274b2[_0x86c3('0x1d')]=_[_0x86c3('0x1a')](_0x3f2184['model'],qs[_0x86c3('0x1e')](_0x16cfb1[_0x86c3('0x1c')]['fields']));_0xc274b2[_0x86c3('0x1d')]=_0xc274b2['attributes']['length']?_0xc274b2['attributes']:_0x3f2184[_0x86c3('0x1b')];if(_0x16cfb1[_0x86c3('0x1c')][_0x86c3('0x2c')]){_0xc274b2[_0x86c3('0x2d')]=[{'all':!![]}];}_0xc274b2=_['merge']({},_0xc274b2,_0x16cfb1[_0x86c3('0x2a')]);return db[_0x86c3('0x15')][_0x86c3('0x31')](_0xc274b2)[_0x86c3('0xe')](handleEntityNotFound(_0x1a126c,null))[_0x86c3('0xe')](respondWithResult(_0x1a126c,null))['catch'](handleError(_0x1a126c,null));};exports['create']=function(_0x4e15e0,_0x419fe6){return db['Dynamics365Account'][_0x86c3('0x32')](_0x4e15e0[_0x86c3('0x33')],{})[_0x86c3('0xe')](respondWithResult(_0x419fe6,0xc9))['catch'](handleError(_0x419fe6,null));};exports[_0x86c3('0xd')]=function(_0x158cbd,_0x13640c){if(_0x158cbd['body']['id']){delete _0x158cbd[_0x86c3('0x33')]['id'];}return db[_0x86c3('0x15')]['find']({'where':{'id':_0x158cbd[_0x86c3('0x34')]['id']}})[_0x86c3('0xe')](handleEntityNotFound(_0x13640c,null))[_0x86c3('0xe')](saveUpdates(_0x158cbd[_0x86c3('0x33')],null))[_0x86c3('0xe')](respondWithResult(_0x13640c,null))[_0x86c3('0x35')](handleError(_0x13640c,null));};exports[_0x86c3('0x36')]=function(_0x3ea611,_0x566b4a){return db[_0x86c3('0x15')][_0x86c3('0x31')]({'where':{'id':_0x3ea611['params']['id']}})[_0x86c3('0xe')](handleEntityNotFound(_0x566b4a,null))[_0x86c3('0xe')](removeEntity(_0x566b4a,null))[_0x86c3('0x35')](handleError(_0x566b4a,null));};exports[_0x86c3('0x37')]=function(_0x2d49e7,_0x121584){var _0x2b237d={};var _0x10bae8={};var _0x40f70c;var _0x256cab;return db['Dynamics365Account'][_0x86c3('0x38')]({'where':{'id':_0x2d49e7['params']['id']}})[_0x86c3('0xe')](handleEntityNotFound(_0x121584,null))[_0x86c3('0xe')](function(_0x190a15){if(_0x190a15){_0x40f70c=_0x190a15;_0x10bae8[_0x86c3('0x1b')]=_[_0x86c3('0x19')](db[_0x86c3('0x39')][_0x86c3('0x16')]);_0x10bae8[_0x86c3('0x1c')]=_[_0x86c3('0x19')](_0x2d49e7[_0x86c3('0x1c')]);_0x10bae8[_0x86c3('0x25')]=_[_0x86c3('0x1a')](_0x10bae8['model'],_0x10bae8['query']);_0x2b237d[_0x86c3('0x1d')]=_[_0x86c3('0x1a')](_0x10bae8[_0x86c3('0x1b')],qs[_0x86c3('0x1e')](_0x2d49e7[_0x86c3('0x1c')][_0x86c3('0x1e')]));_0x2b237d[_0x86c3('0x1d')]=_0x2b237d[_0x86c3('0x1d')][_0x86c3('0x1f')]?_0x2b237d[_0x86c3('0x1d')]:_0x10bae8[_0x86c3('0x1b')];_0x2b237d[_0x86c3('0x22')]=qs[_0x86c3('0x23')](_0x2d49e7[_0x86c3('0x1c')][_0x86c3('0x23')]);_0x2b237d['where']=qs[_0x86c3('0x25')](_[_0x86c3('0x26')](_0x2d49e7['query'],_0x10bae8[_0x86c3('0x25')]));if(_0x2d49e7['query'][_0x86c3('0x27')]){_0x2b237d[_0x86c3('0x24')]=_[_0x86c3('0x28')](_0x2b237d[_0x86c3('0x24')],{'$or':_[_0x86c3('0x14')](_0x2b237d[_0x86c3('0x1d')],function(_0x1d07a1){var _0xa58f21={};_0xa58f21[_0x1d07a1]={'$like':'%'+_0x2d49e7[_0x86c3('0x1c')][_0x86c3('0x27')]+'%'};return _0xa58f21;})});}_0x2b237d=_['merge']({},_0x2b237d,_0x2d49e7[_0x86c3('0x2a')]);return _0x40f70c['getConfigurations'](_0x2b237d);}})[_0x86c3('0xe')](function(_0xc1eb4d){if(_0xc1eb4d){_0x256cab=_0xc1eb4d[_0x86c3('0x1f')];if(!_0x2d49e7[_0x86c3('0x1c')][_0x86c3('0x20')]('nolimit')){_0x2b237d['limit']=qs['limit'](_0x2d49e7[_0x86c3('0x1c')][_0x86c3('0x8')]);_0x2b237d['offset']=qs[_0x86c3('0x7')](_0x2d49e7['query'][_0x86c3('0x7')]);}return _0x40f70c[_0x86c3('0x37')](_0x2b237d);}})[_0x86c3('0xe')](function(_0x37edda){if(_0x37edda){return _0x37edda?{'count':_0x256cab,'rows':_0x37edda}:null;}})[_0x86c3('0xe')](respondWithResult(_0x121584,null))['catch'](handleError(_0x121584,null));};exports['addConfiguration']=function(_0x52a637,_0x1db19b){if(_0x52a637[_0x86c3('0x33')]['id']){delete _0x52a637['body']['id'];}return db[_0x86c3('0x15')][_0x86c3('0x38')]({'where':{'id':_0x52a637[_0x86c3('0x34')]['id']}})[_0x86c3('0xe')](handleEntityNotFound(_0x1db19b,null))[_0x86c3('0xe')](function(_0x16b5b0){if(_0x16b5b0){_0x52a637['body'][_0x86c3('0x3a')]=_0x16b5b0['id'];_0x52a637['body'][_0x86c3('0x3b')]=integrations[_0x86c3('0x3c')](_0x52a637[_0x86c3('0x33')][_0x86c3('0x3d')],_0x52a637[_0x86c3('0x33')][_0x86c3('0x17')]);_0x52a637[_0x86c3('0x33')][_0x86c3('0x3e')]=integrations[_0x86c3('0x3f')](_0x52a637[_0x86c3('0x33')]['channel'],_0x52a637[_0x86c3('0x33')]['type']);return db[_0x86c3('0x39')][_0x86c3('0x32')](_0x52a637[_0x86c3('0x33')],{'include':[{'model':db[_0x86c3('0x40')],'as':_0x86c3('0x3b')},{'model':db['Dynamics365Field'],'as':_0x86c3('0x3e')}]});}return null;})[_0x86c3('0xe')](respondWithResult(_0x1db19b,null))[_0x86c3('0x35')](handleError(_0x1db19b,null));};function sanitizeRemoteUri(_0x10937d){var _0x180075=_0x10937d[_0x86c3('0x41')](-0x1);if(_0x180075==='/')return _0x10937d['substring'](0x0,_0x10937d[_0x86c3('0x42')](_0x180075));return _0x10937d;}function getWebApiUrl(_0x47a19a){return util[_0x86c3('0x43')](_0x86c3('0x44'),_0x47a19a);}exports[_0x86c3('0x45')]=function(_0x5f50f8,_0x2b860e){var _0x4f3286=_0x5f50f8[_0x86c3('0x1c')][_0x86c3('0x46')];var _0x110362=_0x4f3286===_0x86c3('0x47')?_0x86c3('0x48'):_0x86c3('0x49');var _0x449f08='';var _0x1eedc1='';var _0xb09d75='';var _0x30ed0d='';var _0x364c71='';var _0x5f5a39='';var _0x3481f1='';var _0x3d3eb8='';var _0x4bad53=[_0x86c3('0x4a'),_0x86c3('0x4b'),_0x86c3('0x4c'),_0x86c3('0x4d'),_0x86c3('0x4e'),_0x86c3('0x4f'),_0x86c3('0x50'),_0x86c3('0x51'),_0x86c3('0x52'),'phonecall_activity_parties'];var _0x4ae50=['accountidname',_0x86c3('0x53'),'actualserviceunits',_0x86c3('0x54'),_0x86c3('0x55'),_0x86c3('0x56'),'contractdetailidname',_0x86c3('0x57'),_0x86c3('0x58'),_0x86c3('0x59'),_0x86c3('0x5a'),'createdbyyominame','createdon','createdonbehalfbyname',_0x86c3('0x5b'),_0x86c3('0x5c'),_0x86c3('0x5d'),'customeridyominame',_0x86c3('0x5e'),_0x86c3('0x5f'),'entityimage_timestamp',_0x86c3('0x60'),_0x86c3('0x61'),_0x86c3('0x62'),'firstresponsebykpiidname',_0x86c3('0x63'),'importsequencenumber',_0x86c3('0x64'),_0x86c3('0x65'),'lastonholdtime',_0x86c3('0x66'),_0x86c3('0x67'),_0x86c3('0x68'),_0x86c3('0x69'),_0x86c3('0x6a'),_0x86c3('0x6b'),_0x86c3('0x6c'),_0x86c3('0x6d'),'msdyn_incidenttypename',_0x86c3('0x6e'),_0x86c3('0x6f'),_0x86c3('0x70'),_0x86c3('0x71'),_0x86c3('0x72'),_0x86c3('0x73'),'owneridyominame',_0x86c3('0x74'),_0x86c3('0x75'),_0x86c3('0x76'),'prioritycodename',_0x86c3('0x77'),_0x86c3('0x78'),'resolveby',_0x86c3('0x79'),_0x86c3('0x7a'),_0x86c3('0x7b'),'responsiblecontactidyominame','sentimentvalue',_0x86c3('0x7c'),_0x86c3('0x7d'),_0x86c3('0x7e'),_0x86c3('0x7f'),_0x86c3('0x80'),_0x86c3('0x81'),_0x86c3('0x82'),'timezoneruleversionnumber',_0x86c3('0x83'),'traversedpath',_0x86c3('0x84'),_0x86c3('0x85')];var _0x5df837=_0x4bad53[_0x86c3('0x86')](_0x4ae50);return db[_0x86c3('0x15')][_0x86c3('0x38')]({'where':{'id':_0x5f50f8[_0x86c3('0x34')]['id']},'attributes':['id',_0x86c3('0x87'),'password','remoteUri','tenantId',_0x86c3('0x88'),'clientSecret',_0x86c3('0x89')],'include':[{'model':db[_0x86c3('0x8a')],'as':'CloudProvider','attributes':['id','data5',_0x86c3('0x8b')]}]})[_0x86c3('0xe')](handleEntityNotFound(_0x2b860e,null))[_0x86c3('0xe')](function(_0xe38121){if(_0xe38121){if(_0xe38121[_0x86c3('0x89')]){_0xe38121[_0x86c3('0x8c')]=_0xe38121['CloudProvider']['data5'];_0x3d3eb8=sanitizeRemoteUri(_0xe38121[_0x86c3('0x8a')][_0x86c3('0x8b')]);_0x3481f1=getWebApiUrl(_0x3d3eb8);return _0xe38121;}_0x3d3eb8=sanitizeRemoteUri(_0xe38121[_0x86c3('0x8d')]);_0x3481f1=getWebApiUrl(_0x3d3eb8);var _0x5b7918={'method':_0x86c3('0x8e'),'uri':'https://login.microsoftonline.com/'+_0xe38121[_0x86c3('0x8f')]+_0x86c3('0x90'),'form':{'client_id':_0xe38121[_0x86c3('0x88')],'resource':_0x3d3eb8,'username':_0xe38121[_0x86c3('0x87')],'password':_0xe38121[_0x86c3('0x91')],'grant_type':_0x86c3('0x91'),'client_secret':_0xe38121[_0x86c3('0x92')]},'json':!![]};return rp(_0x5b7918);}})[_0x86c3('0xe')](function(_0x739bb9){_0x5f5a39=_0x739bb9[_0x86c3('0x8c')];var _0x1f7609={'method':_0x86c3('0x93'),'uri':encodeURI(_0x3481f1+_0x86c3('0x94')+_0x110362+'\x27'),'headers':{'Authorization':_0x86c3('0x95')+_0x5f5a39,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1f7609);})[_0x86c3('0xe')](function(_0x3a7d06){var _0x2b658e=_0x3a7d06[_0x86c3('0x96')][0x0];var _0x4d521d=_0x2b658e[_0x86c3('0x97')];var _0x18f995={'method':_0x86c3('0x93'),'uri':_0x3481f1+_0x86c3('0x98')+_0x4d521d+_0x86c3('0x99'),'headers':{'Authorization':_0x86c3('0x95')+_0x5f5a39,'If-None-Match':null,'OData-Version':_0x86c3('0x9a')},'json':!![]};return rp(_0x18f995);})[_0x86c3('0xe')](function(_0x433fd1){_0x449f08=_0x433fd1;_0x1eedc1=_0x449f08[_0x86c3('0x9b')];_0x1eedc1=_[_0x86c3('0x9c')](_0x1eedc1,function(_0x408f6a){return!_0x5df837[_0x86c3('0x9d')](_0x408f6a['LogicalName']);});var _0x12392f=[];var _0x32b22e=[];_0x1eedc1[_0x86c3('0x9e')](function(_0x36c05e){if(_0x36c05e[_0x86c3('0x9f')]){var _0xa1f0d8=_0x36c05e['@odata.type']['substring'](_0x36c05e[_0x86c3('0x9f')]['lastIndexOf']('.')+0x1);if(_0xa1f0d8==='PicklistAttributeMetadata'){_0x12392f[_0x86c3('0xa0')](getSelectList(_0x3481f1,_0x4f3286,_0x32b22e,_0x449f08['MetadataId'],_0x36c05e['MetadataId'],_0x5f5a39));}}});return Promise[_0x86c3('0xa1')](_0x12392f);})[_0x86c3('0xe')](function(_0x48efd9){_0xb09d75=_0x48efd9[0x0];var _0x4be854=[];var _0x7276ef=[];_0x1eedc1[_0x86c3('0x9e')](function(_0x4be0ca){if(!_[_0x86c3('0xa2')](_0x4be0ca[_0x86c3('0x9f')])){var _0x2da700=_0x4be0ca[_0x86c3('0x9f')]['substring'](_0x4be0ca[_0x86c3('0x9f')][_0x86c3('0x42')]('.')+0x1);if(_0x2da700===_0x86c3('0xa3')){_0x4be854[_0x86c3('0xa0')](getBooleanList(_0x3481f1,_0x4f3286,_0x7276ef,_0x449f08[_0x86c3('0x97')],_0x4be0ca['MetadataId'],_0x5f5a39));}}});return Promise[_0x86c3('0xa1')](_0x4be854);})[_0x86c3('0xe')](function(_0x481bee){_0x30ed0d=_0x481bee[0x0];var _0x2a92ca=[];var _0x125c3a=[];_0x1eedc1[_0x86c3('0x9e')](function(_0x5e8b7e){if(_0x5e8b7e[_0x86c3('0x9f')]){var _0x5a1544=_0x5e8b7e[_0x86c3('0x9f')][_0x86c3('0xa4')](_0x5e8b7e[_0x86c3('0x9f')][_0x86c3('0x42')]('.')+0x1);if(_0x5a1544===_0x86c3('0xa5')||_0x5a1544===_0x86c3('0xa6')||_0x5a1544==='BigIntAttributeMetadata'||_0x5a1544==='IntegerAttributeMetadata'||_0x5a1544===_0x86c3('0xa7')||_0x5a1544==='DateTimeAttributeMetadata'||_0x5a1544===_0x86c3('0xa8')||_0x5a1544===_0x86c3('0xa9')||_0x5a1544==='StateAttributeMetadata'||_0x5a1544===_0x86c3('0xaa')){_0x2a92ca['push'](getInputList(_0x3481f1,_0x4f3286,_0x5a1544,_0x125c3a,_0x449f08[_0x86c3('0x97')],_0x5e8b7e[_0x86c3('0x97')],_0x5f5a39));}}});return Promise[_0x86c3('0xa1')](_0x2a92ca);})['then'](function(_0x5ddae9){_0x364c71=_0x5ddae9[0x0];var _0x1198db=_0xb09d75[_0x86c3('0x86')](_0x30ed0d)[_0x86c3('0x86')](_0x364c71);var _0x5169c9={'count':_0x1198db[_0x86c3('0x1f')],'rows':_0x1198db};return _0x5169c9;})['then'](respondWithResult(_0x2b860e,null))[_0x86c3('0x35')](function(_0x3dbb26){var _0x5c1963=_0x5f50f8[_0x86c3('0x1c')][_0x86c3('0xab')]?0x1f4:_0x3dbb26[_0x86c3('0xac')]||0x1f4;logger['error'](_0x3dbb26[_0x86c3('0x11')]);delete _0x3dbb26['name'];if(_0x5c1963===0x191){_0x5c1963=0x190;}_0x2b860e[_0x86c3('0xa')](_0x5c1963)['send'](_0x5f50f8['query'][_0x86c3('0xab')]?{'message':_0x86c3('0xad'),'statusCode':_0x3dbb26['statusCode']}:_0x3dbb26);});};function getSelectList(_0x40cb06,_0x19af32,_0x182852,_0x50998e,_0x36e2cb,_0x295cda){var _0x49f33c={'method':_0x86c3('0x93'),'uri':_0x40cb06+_0x86c3('0x98')+_0x50998e+')/Attributes('+_0x36e2cb+_0x86c3('0xae')+_0x86c3('0xaf'),'headers':{'Authorization':_0x86c3('0x95')+_0x295cda,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x49f33c)[_0x86c3('0xe')](function(_0x3525b1){var _0x5515b9=[];var _0x5e1530=_0x3525b1['OptionSet'][_0x86c3('0xb0')];_0x5e1530['forEach'](function(_0x4daca0){_0x5515b9[_0x86c3('0xa0')]({'name':_0x4daca0[_0x86c3('0xb1')][_0x86c3('0xb2')][_0x86c3('0xb1')],'value':String(_0x4daca0['Value'])});});var _0x2fbed3={'id':_0x19af32+'_'+_0x3525b1['LogicalName'],'name':_0x3525b1[_0x86c3('0xb3')][_0x86c3('0xb2')][_0x86c3('0xb1')],'custom':![],'options':_0x5515b9};_0x182852[_0x86c3('0xa0')](_0x2fbed3);return _0x182852;});}function getBooleanList(_0x48a886,_0x542494,_0x5460e1,_0x20e500,_0x57988e,_0x51af62){var _0x330e74={'method':_0x86c3('0x93'),'uri':_0x48a886+_0x86c3('0x98')+_0x20e500+_0x86c3('0xb4')+_0x57988e+_0x86c3('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x51af62,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x330e74)[_0x86c3('0xe')](function(_0x20a937){var _0x22f46f=[];_0x22f46f[_0x86c3('0xa0')]({'name':_0x20a937[_0x86c3('0xb6')][_0x86c3('0xb7')]['Label']['UserLocalizedLabel'][_0x86c3('0xb1')],'value':_0x86c3('0xb8')},{'name':_0x20a937[_0x86c3('0xb6')][_0x86c3('0xb9')][_0x86c3('0xb1')][_0x86c3('0xb2')]['Label'],'value':'false'});var _0xb69826={'id':_0x542494+'_'+_0x20a937[_0x86c3('0xba')],'name':_0x20a937[_0x86c3('0xb3')][_0x86c3('0xb2')][_0x86c3('0xb1')],'custom':![],'options':_0x22f46f};_0x5460e1[_0x86c3('0xa0')](_0xb69826);return _0x5460e1;});}function getInputList(_0x4a82f0,_0x3f165f,_0xa2b82f,_0x2a1a9b,_0x2de4ab,_0x5604d2,_0x210d3a){var _0x5dfdd7={'method':_0x86c3('0x93'),'uri':_0x4a82f0+_0x86c3('0x98')+_0x2de4ab+')/Attributes('+_0x5604d2+_0x86c3('0xbb')+_0xa2b82f+_0x86c3('0xbc'),'headers':{'Authorization':_0x86c3('0x95')+_0x210d3a,'If-None-Match':null,'OData-Version':_0x86c3('0x9a')},'json':!![]};return rp(_0x5dfdd7)['then'](function(_0x57b0ab){var _0x56337e={'id':_0x3f165f+'_'+_0x57b0ab[_0x86c3('0xba')],'name':_0x57b0ab[_0x86c3('0xb3')][_0x86c3('0xb2')]?_0x57b0ab[_0x86c3('0xb3')][_0x86c3('0xb2')]['Label']:_0x57b0ab['LogicalName'],'custom':![],'options':[]};_0x2a1a9b['push'](_0x56337e);return _0x2a1a9b;});} \ No newline at end of file +var _0xb477=['filter','where','merge','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','ticketType','incident','Incident','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','subjectidname','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','includes','forEach','@odata.type','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','LogicalName','DisplayName','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','update','then','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x592a1c,_0x4f773e){var _0x27a3bb=function(_0x6bcfff){while(--_0x6bcfff){_0x592a1c['push'](_0x592a1c['shift']());}};_0x27a3bb(++_0x4f773e);}(_0xb477,0x8f));var _0x7b47=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb477[_0xfae23b];return _0x200640;};'use strict';var rp=require('request-promise');var util=require(_0x7b47('0x0'));var _=require(_0x7b47('0x1'));var qs=require(_0x7b47('0x2'));var logger=require('../../config/logger')(_0x7b47('0x3'));var db=require(_0x7b47('0x4'))['db'];var integrations=require(_0x7b47('0x5'));function respondWithResult(_0x5ccfb5,_0x3fcae3){_0x3fcae3=_0x3fcae3||0xc8;return function(_0x1c3e88){if(_0x1c3e88){return _0x5ccfb5[_0x7b47('0x6')](_0x3fcae3)[_0x7b47('0x7')](_0x1c3e88);}};}function respondWithFilteredResult(_0x45fb67,_0x48e1fc){return function(_0x259a1e){if(_0x259a1e){var _0x439867=typeof _0x48e1fc['offset']===_0x7b47('0x8')&&typeof _0x48e1fc[_0x7b47('0x9')]===_0x7b47('0x8');var _0x306d6e=_0x259a1e[_0x7b47('0xa')];var _0x8121cc=_0x439867?0x0:_0x48e1fc[_0x7b47('0xb')];var _0x765ebb=_0x439867?_0x259a1e[_0x7b47('0xa')]:_0x48e1fc[_0x7b47('0xb')]+_0x48e1fc[_0x7b47('0x9')];var _0x1e4a8b;if(_0x765ebb>=_0x306d6e){_0x765ebb=_0x306d6e;_0x1e4a8b=0xc8;}else{_0x1e4a8b=0xce;}_0x45fb67['status'](_0x1e4a8b);return _0x45fb67[_0x7b47('0xc')]('Content-Range',_0x8121cc+'-'+_0x765ebb+'/'+_0x306d6e)['json'](_0x259a1e);}return null;};}function saveUpdates(_0x5ad505){return function(_0x1e4e3d){if(_0x1e4e3d){return _0x1e4e3d[_0x7b47('0xd')](_0x5ad505)[_0x7b47('0xe')](function(_0x36abe4){return _0x36abe4;});}return null;};}function removeEntity(_0x335416){return function(_0x128999){if(_0x128999){return _0x128999['destroy']()[_0x7b47('0xe')](function(){_0x335416[_0x7b47('0x6')](0xcc)[_0x7b47('0xf')]();});}};}function handleEntityNotFound(_0x56aaa8){return function(_0x11be4f){if(!_0x11be4f){_0x56aaa8[_0x7b47('0x10')](0x194);}return _0x11be4f;};}function handleError(_0x379182,_0x283cd2){_0x283cd2=_0x283cd2||0x1f4;return function(_0x5c72be){logger[_0x7b47('0x11')](_0x5c72be[_0x7b47('0x12')]);if(_0x5c72be[_0x7b47('0x13')]){delete _0x5c72be[_0x7b47('0x13')];}_0x379182['status'](_0x283cd2)[_0x7b47('0x14')](_0x5c72be);};}exports['index']=function(_0x13e959,_0x47a713){var _0x4dd8d5={},_0x57e939={},_0x13c673={'count':0x0,'rows':[]};var _0x5a293f=_[_0x7b47('0x15')](db['Dynamics365Account'][_0x7b47('0x16')],function(_0x443333){return{'name':_0x443333[_0x7b47('0x17')],'type':_0x443333[_0x7b47('0x18')][_0x7b47('0x19')]};});_0x57e939[_0x7b47('0x1a')]=_[_0x7b47('0x15')](_0x5a293f,_0x7b47('0x13'));_0x57e939[_0x7b47('0x1b')]=_[_0x7b47('0x1c')](_0x13e959[_0x7b47('0x1b')]);_0x57e939[_0x7b47('0x1d')]=_['intersection'](_0x57e939[_0x7b47('0x1a')],_0x57e939[_0x7b47('0x1b')]);_0x4dd8d5[_0x7b47('0x1e')]=_[_0x7b47('0x1f')](_0x57e939[_0x7b47('0x1a')],qs[_0x7b47('0x20')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0x20')]));_0x4dd8d5[_0x7b47('0x1e')]=_0x4dd8d5['attributes']['length']?_0x4dd8d5['attributes']:_0x57e939['model'];if(!_0x13e959[_0x7b47('0x1b')][_0x7b47('0x21')](_0x7b47('0x22'))){_0x4dd8d5[_0x7b47('0x9')]=qs[_0x7b47('0x9')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0x9')]);_0x4dd8d5[_0x7b47('0xb')]=qs[_0x7b47('0xb')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0xb')]);}_0x4dd8d5[_0x7b47('0x23')]=qs[_0x7b47('0x24')](_0x13e959[_0x7b47('0x1b')]['sort']);_0x4dd8d5['where']=qs['filters'](_[_0x7b47('0x25')](_0x13e959[_0x7b47('0x1b')],_0x57e939[_0x7b47('0x1d')]),_0x5a293f);if(_0x13e959[_0x7b47('0x1b')][_0x7b47('0x26')]){_0x4dd8d5[_0x7b47('0x27')]=_['merge'](_0x4dd8d5[_0x7b47('0x27')],{'$or':_[_0x7b47('0x15')](_0x5a293f,function(_0x1cf30c){if(_0x1cf30c[_0x7b47('0x18')]!=='VIRTUAL'){var _0x37f56b={};_0x37f56b[_0x1cf30c[_0x7b47('0x13')]]={'$like':'%'+_0x13e959['query'][_0x7b47('0x26')]+'%'};return _0x37f56b;}})});}_0x4dd8d5=_[_0x7b47('0x28')]({},_0x4dd8d5,_0x13e959[_0x7b47('0x29')]);var _0x30e968={'where':_0x4dd8d5[_0x7b47('0x27')]};return db[_0x7b47('0x2a')][_0x7b47('0xa')](_0x30e968)['then'](function(_0x4ddc08){_0x13c673[_0x7b47('0xa')]=_0x4ddc08;if(_0x13e959['query'][_0x7b47('0x2b')]){_0x4dd8d5[_0x7b47('0x2c')]=[{'all':!![]}];}return db[_0x7b47('0x2a')][_0x7b47('0x2d')](_0x4dd8d5);})[_0x7b47('0xe')](function(_0xc57f42){_0x13c673[_0x7b47('0x2e')]=_0xc57f42;return _0x13c673;})['then'](respondWithFilteredResult(_0x47a713,_0x4dd8d5))[_0x7b47('0x2f')](handleError(_0x47a713,null));};exports['show']=function(_0x4d45ae,_0x12a63d){var _0x365303={'raw':![],'where':{'id':_0x4d45ae[_0x7b47('0x30')]['id']}},_0x538bce={};_0x538bce[_0x7b47('0x1a')]=_[_0x7b47('0x1c')](db[_0x7b47('0x2a')][_0x7b47('0x16')]);_0x538bce[_0x7b47('0x1b')]=_[_0x7b47('0x1c')](_0x4d45ae[_0x7b47('0x1b')]);_0x538bce['filters']=_[_0x7b47('0x1f')](_0x538bce['model'],_0x538bce[_0x7b47('0x1b')]);_0x365303[_0x7b47('0x1e')]=_[_0x7b47('0x1f')](_0x538bce[_0x7b47('0x1a')],qs['fields'](_0x4d45ae[_0x7b47('0x1b')][_0x7b47('0x20')]));_0x365303[_0x7b47('0x1e')]=_0x365303[_0x7b47('0x1e')][_0x7b47('0x31')]?_0x365303['attributes']:_0x538bce[_0x7b47('0x1a')];if(_0x4d45ae['query']['includeAll']){_0x365303[_0x7b47('0x2c')]=[{'all':!![]}];}_0x365303=_[_0x7b47('0x28')]({},_0x365303,_0x4d45ae['options']);return db[_0x7b47('0x2a')][_0x7b47('0x32')](_0x365303)[_0x7b47('0xe')](handleEntityNotFound(_0x12a63d,null))[_0x7b47('0xe')](respondWithResult(_0x12a63d,null))[_0x7b47('0x2f')](handleError(_0x12a63d,null));};exports['create']=function(_0x340886,_0x544597){return db[_0x7b47('0x2a')][_0x7b47('0x33')](_0x340886[_0x7b47('0x34')],{})[_0x7b47('0xe')](respondWithResult(_0x544597,0xc9))[_0x7b47('0x2f')](handleError(_0x544597,null));};exports[_0x7b47('0xd')]=function(_0x2de261,_0x23804e){if(_0x2de261['body']['id']){delete _0x2de261[_0x7b47('0x34')]['id'];}return db[_0x7b47('0x2a')][_0x7b47('0x32')]({'where':{'id':_0x2de261['params']['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0x23804e,null))[_0x7b47('0xe')](saveUpdates(_0x2de261[_0x7b47('0x34')],null))[_0x7b47('0xe')](respondWithResult(_0x23804e,null))['catch'](handleError(_0x23804e,null));};exports[_0x7b47('0x35')]=function(_0x1a70d2,_0xd24c11){return db['Dynamics365Account'][_0x7b47('0x32')]({'where':{'id':_0x1a70d2[_0x7b47('0x30')]['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0xd24c11,null))['then'](removeEntity(_0xd24c11,null))[_0x7b47('0x2f')](handleError(_0xd24c11,null));};exports[_0x7b47('0x36')]=function(_0x7bad5f,_0x1ee886){var _0x76a30a={};var _0x5416aa={};var _0x3cc89e;var _0x590754;return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x7bad5f['params']['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0x1ee886,null))[_0x7b47('0xe')](function(_0x269aca){if(_0x269aca){_0x3cc89e=_0x269aca;_0x5416aa['model']=_[_0x7b47('0x1c')](db[_0x7b47('0x38')][_0x7b47('0x16')]);_0x5416aa['query']=_[_0x7b47('0x1c')](_0x7bad5f['query']);_0x5416aa[_0x7b47('0x1d')]=_[_0x7b47('0x1f')](_0x5416aa[_0x7b47('0x1a')],_0x5416aa[_0x7b47('0x1b')]);_0x76a30a['attributes']=_[_0x7b47('0x1f')](_0x5416aa['model'],qs[_0x7b47('0x20')](_0x7bad5f['query'][_0x7b47('0x20')]));_0x76a30a[_0x7b47('0x1e')]=_0x76a30a[_0x7b47('0x1e')]['length']?_0x76a30a[_0x7b47('0x1e')]:_0x5416aa[_0x7b47('0x1a')];_0x76a30a[_0x7b47('0x23')]=qs['sort'](_0x7bad5f['query']['sort']);_0x76a30a[_0x7b47('0x27')]=qs['filters'](_[_0x7b47('0x25')](_0x7bad5f[_0x7b47('0x1b')],_0x5416aa[_0x7b47('0x1d')]));if(_0x7bad5f[_0x7b47('0x1b')]['filter']){_0x76a30a['where']=_[_0x7b47('0x28')](_0x76a30a['where'],{'$or':_[_0x7b47('0x15')](_0x76a30a[_0x7b47('0x1e')],function(_0x202e64){var _0x3d3c57={};_0x3d3c57[_0x202e64]={'$like':'%'+_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x26')]+'%'};return _0x3d3c57;})});}_0x76a30a=_[_0x7b47('0x28')]({},_0x76a30a,_0x7bad5f[_0x7b47('0x29')]);return _0x3cc89e[_0x7b47('0x36')](_0x76a30a);}})['then'](function(_0x377079){if(_0x377079){_0x590754=_0x377079[_0x7b47('0x31')];if(!_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x21')](_0x7b47('0x22'))){_0x76a30a[_0x7b47('0x9')]=qs['limit'](_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x9')]);_0x76a30a[_0x7b47('0xb')]=qs[_0x7b47('0xb')](_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0xb')]);}return _0x3cc89e[_0x7b47('0x36')](_0x76a30a);}})[_0x7b47('0xe')](function(_0x5579c6){if(_0x5579c6){return _0x5579c6?{'count':_0x590754,'rows':_0x5579c6}:null;}})[_0x7b47('0xe')](respondWithResult(_0x1ee886,null))[_0x7b47('0x2f')](handleError(_0x1ee886,null));};exports['addConfiguration']=function(_0x483a13,_0x33449b){if(_0x483a13[_0x7b47('0x34')]['id']){delete _0x483a13[_0x7b47('0x34')]['id'];}return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x483a13[_0x7b47('0x30')]['id']}})['then'](handleEntityNotFound(_0x33449b,null))['then'](function(_0x16b701){if(_0x16b701){_0x483a13[_0x7b47('0x34')][_0x7b47('0x39')]=_0x16b701['id'];_0x483a13['body'][_0x7b47('0x3a')]=integrations['getSubjects'](_0x483a13['body'][_0x7b47('0x3b')],_0x483a13['body'][_0x7b47('0x18')]);_0x483a13[_0x7b47('0x34')][_0x7b47('0x3c')]=integrations[_0x7b47('0x3d')](_0x483a13[_0x7b47('0x34')][_0x7b47('0x3b')],_0x483a13[_0x7b47('0x34')]['type']);return db[_0x7b47('0x38')][_0x7b47('0x33')](_0x483a13['body'],{'include':[{'model':db[_0x7b47('0x3e')],'as':_0x7b47('0x3a')},{'model':db[_0x7b47('0x3e')],'as':'Descriptions'}]});}return null;})[_0x7b47('0xe')](respondWithResult(_0x33449b,null))[_0x7b47('0x2f')](handleError(_0x33449b,null));};function sanitizeRemoteUri(_0x120066){var _0x5d6458=_0x120066['slice'](-0x1);if(_0x5d6458==='/')return _0x120066[_0x7b47('0x3f')](0x0,_0x120066[_0x7b47('0x40')](_0x5d6458));return _0x120066;}function getWebApiUrl(_0x5ef85a){return util[_0x7b47('0x41')]('%s/api/data/v9.0/',_0x5ef85a);}exports['getFields']=function(_0x10a72a,_0x559527){var _0x14c023=_0x10a72a['query'][_0x7b47('0x42')];var _0x43ab36=_0x14c023===_0x7b47('0x43')?_0x7b47('0x44'):'PhoneCall';var _0x5b7537='';var _0x9b8b5e='';var _0x15c30a='';var _0x3b40bc='';var _0x54dfe5='';var _0x4bd0c7='';var _0x31f33d='';var _0x47013e='';var _0x38a32b=[_0x7b47('0x45'),_0x7b47('0x46'),'customerid',_0x7b47('0x47'),'caseorigincode',_0x7b47('0x48'),_0x7b47('0x49'),_0x7b47('0x4a'),_0x7b47('0x4b'),_0x7b47('0x4c')];var _0x1f2856=['accountidname',_0x7b47('0x4d'),_0x7b47('0x4e'),'billedserviceunits',_0x7b47('0x4f'),_0x7b47('0x50'),_0x7b47('0x51'),_0x7b47('0x52'),_0x7b47('0x53'),'createdbyexternalpartyyominame',_0x7b47('0x54'),_0x7b47('0x55'),'createdon','createdonbehalfbyname',_0x7b47('0x56'),_0x7b47('0x57'),_0x7b47('0x58'),_0x7b47('0x59'),_0x7b47('0x5a'),_0x7b47('0x5b'),_0x7b47('0x5c'),_0x7b47('0x5d'),'escalatedon',_0x7b47('0x5e'),_0x7b47('0x5f'),_0x7b47('0x60'),_0x7b47('0x61'),_0x7b47('0x62'),_0x7b47('0x63'),'lastonholdtime',_0x7b47('0x64'),_0x7b47('0x65'),_0x7b47('0x66'),'modifiedbyname','modifiedbyyominame',_0x7b47('0x67'),_0x7b47('0x68'),_0x7b47('0x69'),_0x7b47('0x6a'),_0x7b47('0x6b'),_0x7b47('0x6c'),_0x7b47('0x6d'),_0x7b47('0x6e'),_0x7b47('0x6f'),'owneridtype',_0x7b47('0x70'),_0x7b47('0x71'),_0x7b47('0x72'),'primarycontactidyominame',_0x7b47('0x73'),_0x7b47('0x74'),_0x7b47('0x75'),_0x7b47('0x76'),_0x7b47('0x77'),_0x7b47('0x78'),'responsiblecontactidname',_0x7b47('0x79'),_0x7b47('0x7a'),'slainvokedidname',_0x7b47('0x7b'),_0x7b47('0x7c'),'statecode','statuscode',_0x7b47('0x7d'),'ticketnumber','timezoneruleversionnumber',_0x7b47('0x7e'),'traversedpath',_0x7b47('0x7f'),_0x7b47('0x80')];var _0x234e17=_0x38a32b[_0x7b47('0x81')](_0x1f2856);return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x10a72a[_0x7b47('0x30')]['id']},'attributes':['id','username',_0x7b47('0x82'),_0x7b47('0x83'),_0x7b47('0x84'),_0x7b47('0x85'),_0x7b47('0x86'),_0x7b47('0x87')],'include':[{'model':db['CloudProvider'],'as':_0x7b47('0x88'),'attributes':['id',_0x7b47('0x89'),_0x7b47('0x8a')]}]})[_0x7b47('0xe')](handleEntityNotFound(_0x559527,null))[_0x7b47('0xe')](function(_0x2d8a08){if(_0x2d8a08){if(_0x2d8a08[_0x7b47('0x87')]){_0x2d8a08['access_token']=_0x2d8a08[_0x7b47('0x88')][_0x7b47('0x89')];_0x47013e=sanitizeRemoteUri(_0x2d8a08[_0x7b47('0x88')]['data7']);_0x31f33d=getWebApiUrl(_0x47013e);return _0x2d8a08;}_0x47013e=sanitizeRemoteUri(_0x2d8a08[_0x7b47('0x83')]);_0x31f33d=getWebApiUrl(_0x47013e);var _0x60ac23={'method':_0x7b47('0x8b'),'uri':_0x7b47('0x8c')+_0x2d8a08['tenantId']+_0x7b47('0x8d'),'form':{'client_id':_0x2d8a08['clientId'],'resource':_0x47013e,'username':_0x2d8a08['username'],'password':_0x2d8a08[_0x7b47('0x82')],'grant_type':_0x7b47('0x82'),'client_secret':_0x2d8a08[_0x7b47('0x86')]},'json':!![]};return rp(_0x60ac23);}})[_0x7b47('0xe')](function(_0x1054b8){_0x4bd0c7=_0x1054b8[_0x7b47('0x8e')];var _0x1fee6f={'method':_0x7b47('0x8f'),'uri':encodeURI(_0x31f33d+_0x7b47('0x90')+_0x43ab36+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4bd0c7,'If-None-Match':null,'OData-Version':_0x7b47('0x91')},'json':!![]};return rp(_0x1fee6f);})[_0x7b47('0xe')](function(_0x3b5809){var _0x5dca3a=_0x3b5809[_0x7b47('0x92')][0x0];var _0x19619d=_0x5dca3a[_0x7b47('0x93')];var _0x5a630f={'method':_0x7b47('0x8f'),'uri':_0x31f33d+_0x7b47('0x94')+_0x19619d+_0x7b47('0x95'),'headers':{'Authorization':_0x7b47('0x96')+_0x4bd0c7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5a630f);})['then'](function(_0x111f52){_0x5b7537=_0x111f52;_0x9b8b5e=_0x5b7537['Attributes'];_0x9b8b5e=_['remove'](_0x9b8b5e,function(_0x471196){return!_0x234e17[_0x7b47('0x97')](_0x471196['LogicalName']);});var _0x289bd7=[];var _0x44356a=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x55810e){if(_0x55810e[_0x7b47('0x99')]){var _0x58e458=_0x55810e[_0x7b47('0x99')]['substring'](_0x55810e['@odata.type'][_0x7b47('0x40')]('.')+0x1);if(_0x58e458==='PicklistAttributeMetadata'){_0x289bd7[_0x7b47('0x9a')](getSelectList(_0x31f33d,_0x14c023,_0x44356a,_0x5b7537[_0x7b47('0x93')],_0x55810e[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise[_0x7b47('0x9b')](_0x289bd7);})[_0x7b47('0xe')](function(_0x5bda28){_0x15c30a=_0x5bda28[0x0];var _0x33c457=[];var _0x32aff1=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x5eab8d){if(!_[_0x7b47('0x9c')](_0x5eab8d[_0x7b47('0x99')])){var _0x3fd93a=_0x5eab8d[_0x7b47('0x99')][_0x7b47('0x3f')](_0x5eab8d[_0x7b47('0x99')][_0x7b47('0x40')]('.')+0x1);if(_0x3fd93a==='BooleanAttributeMetadata'){_0x33c457[_0x7b47('0x9a')](getBooleanList(_0x31f33d,_0x14c023,_0x32aff1,_0x5b7537[_0x7b47('0x93')],_0x5eab8d[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise[_0x7b47('0x9b')](_0x33c457);})[_0x7b47('0xe')](function(_0x2a9f4c){_0x3b40bc=_0x2a9f4c[0x0];var _0x3d8650=[];var _0xc07226=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x5e5b92){if(_0x5e5b92[_0x7b47('0x99')]){var _0x4e8bf5=_0x5e5b92['@odata.type'][_0x7b47('0x3f')](_0x5e5b92[_0x7b47('0x99')]['lastIndexOf']('.')+0x1);if(_0x4e8bf5===_0x7b47('0x9d')||_0x4e8bf5===_0x7b47('0x9e')||_0x4e8bf5===_0x7b47('0x9f')||_0x4e8bf5===_0x7b47('0xa0')||_0x4e8bf5===_0x7b47('0xa1')||_0x4e8bf5==='DateTimeAttributeMetadata'||_0x4e8bf5===_0x7b47('0xa2')||_0x4e8bf5==='EntityNameAttributeMetadata'||_0x4e8bf5==='StateAttributeMetadata'||_0x4e8bf5===_0x7b47('0xa3')){_0x3d8650['push'](getInputList(_0x31f33d,_0x14c023,_0x4e8bf5,_0xc07226,_0x5b7537[_0x7b47('0x93')],_0x5e5b92[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise['all'](_0x3d8650);})[_0x7b47('0xe')](function(_0x537a95){_0x54dfe5=_0x537a95[0x0];var _0x1fdf30=_0x15c30a[_0x7b47('0x81')](_0x3b40bc)['concat'](_0x54dfe5);var _0x1fa9a9={'count':_0x1fdf30[_0x7b47('0x31')],'rows':_0x1fdf30};return _0x1fa9a9;})[_0x7b47('0xe')](respondWithResult(_0x559527,null))[_0x7b47('0x2f')](function(_0x5bac4b){var _0x105dca=_0x10a72a[_0x7b47('0x1b')][_0x7b47('0xa4')]?0x1f4:_0x5bac4b[_0x7b47('0xa5')]||0x1f4;logger['error'](_0x5bac4b[_0x7b47('0x12')]);delete _0x5bac4b[_0x7b47('0x13')];if(_0x105dca===0x191){_0x105dca=0x190;}_0x559527[_0x7b47('0x6')](_0x105dca)['send'](_0x10a72a[_0x7b47('0x1b')][_0x7b47('0xa4')]?{'message':_0x7b47('0xa6'),'statusCode':_0x5bac4b['statusCode']}:_0x5bac4b);});};function getSelectList(_0x4e0069,_0x353020,_0x31cc6e,_0x5a10bd,_0xf47561,_0x3e92c9){var _0x39fe85={'method':_0x7b47('0x8f'),'uri':_0x4e0069+_0x7b47('0x94')+_0x5a10bd+_0x7b47('0xa7')+_0xf47561+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x7b47('0x96')+_0x3e92c9,'If-None-Match':null,'OData-Version':_0x7b47('0x91')},'json':!![]};return rp(_0x39fe85)['then'](function(_0x4dcd07){var _0x35183f=[];var _0x1812e4=_0x4dcd07[_0x7b47('0xa8')][_0x7b47('0xa9')];_0x1812e4[_0x7b47('0x98')](function(_0x375f5f){_0x35183f['push']({'name':_0x375f5f[_0x7b47('0xaa')][_0x7b47('0xab')][_0x7b47('0xaa')],'value':String(_0x375f5f[_0x7b47('0xac')])});});var _0x10ed4d={'id':_0x353020+'_'+_0x4dcd07['LogicalName'],'name':_0x4dcd07['DisplayName'][_0x7b47('0xab')][_0x7b47('0xaa')],'custom':![],'options':_0x35183f};_0x31cc6e[_0x7b47('0x9a')](_0x10ed4d);return _0x31cc6e;});}function getBooleanList(_0x4ee544,_0x2fc366,_0x5e30bb,_0x3f2165,_0x5e16ec,_0x124f5a){var _0x353afa={'method':'GET','uri':_0x4ee544+_0x7b47('0x94')+_0x3f2165+_0x7b47('0xa7')+_0x5e16ec+_0x7b47('0xad'),'headers':{'Authorization':_0x7b47('0x96')+_0x124f5a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x353afa)[_0x7b47('0xe')](function(_0x75b7d7){var _0x2c941c=[];_0x2c941c[_0x7b47('0x9a')]({'name':_0x75b7d7[_0x7b47('0xa8')][_0x7b47('0xae')][_0x7b47('0xaa')][_0x7b47('0xab')][_0x7b47('0xaa')],'value':'true'},{'name':_0x75b7d7[_0x7b47('0xa8')][_0x7b47('0xaf')][_0x7b47('0xaa')]['UserLocalizedLabel'][_0x7b47('0xaa')],'value':_0x7b47('0xb0')});var _0x2f1e61={'id':_0x2fc366+'_'+_0x75b7d7['LogicalName'],'name':_0x75b7d7['DisplayName'][_0x7b47('0xab')][_0x7b47('0xaa')],'custom':![],'options':_0x2c941c};_0x5e30bb[_0x7b47('0x9a')](_0x2f1e61);return _0x5e30bb;});}function getInputList(_0x250a8a,_0x10e77a,_0x47a952,_0x3142ef,_0x506980,_0x55b7d6,_0x38f07a){var _0x26813e={'method':_0x7b47('0x8f'),'uri':_0x250a8a+'EntityDefinitions('+_0x506980+')/Attributes('+_0x55b7d6+_0x7b47('0xb1')+_0x47a952+_0x7b47('0xb2'),'headers':{'Authorization':_0x7b47('0x96')+_0x38f07a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26813e)[_0x7b47('0xe')](function(_0x3bf3a0){var _0x3c33ae={'id':_0x10e77a+'_'+_0x3bf3a0[_0x7b47('0xb3')],'name':_0x3bf3a0['DisplayName'][_0x7b47('0xab')]?_0x3bf3a0[_0x7b47('0xb4')][_0x7b47('0xab')][_0x7b47('0xaa')]:_0x3bf3a0[_0x7b47('0xb3')],'custom':![],'options':[]};_0x3142ef[_0x7b47('0x9a')](_0x3c33ae);return _0x3142ef;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2a6d7fc..71a70a8 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x375979,_0x17b3e6){var _0x4b7530=function(_0xf04ced){while(--_0xf04ced){_0x375979['push'](_0x375979['shift']());}};_0x4b7530(++_0x17b3e6);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0xf89afd,_0x5aa9db){var _0x3ffda6=function(_0x545b0d){while(--_0x545b0d){_0xf89afd['push'](_0xf89afd['shift']());}};_0x3ffda6(++_0x5aa9db);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xcb91[_0x5cb97e];return _0x1714b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0175552..2798fdc 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 _0xb07f=['include','map','model','attributes','debug','GetDynamics365Account','stringify','catch','ShowDynamics365Account','find','raw','where','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','Dynamics365Account','findAll','options'];(function(_0x3b51ac,_0x17ff22){var _0x25501a=function(_0x3f87be){while(--_0x3f87be){_0x3b51ac['push'](_0x3b51ac['shift']());}};_0x25501a(++_0x17ff22);}(_0xb07f,0x1ac));var _0xfb07=function(_0x11e9e6,_0x40b63c){_0x11e9e6=_0x11e9e6-0x0;var _0x5ebe60=_0xb07f[_0x11e9e6];return _0x5ebe60;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var moment=require(_0xfb07('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb07('0x3'));var fs=require('fs');var Redis=require(_0xfb07('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb07('0x5'));var logger=require('../../config/logger')(_0xfb07('0x6'));var config=require(_0xfb07('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3199fb,_0x426086,_0x14b524){return new BPromise(function(_0x2f05b4,_0x412795){return client[_0xfb07('0x8')](_0x3199fb,_0x14b524)[_0xfb07('0x9')](function(_0x4a8a41){logger[_0xfb07('0xa')](_0xfb07('0xb'),_0x426086,_0xfb07('0xc'));logger['debug'](_0xfb07('0xd'),_0x426086,'request\x20sent',JSON['stringify'](_0x4a8a41));if(_0x4a8a41[_0xfb07('0xe')]){if(_0x4a8a41[_0xfb07('0xe')]['code']===0x1f4){logger[_0xfb07('0xe')](_0xfb07('0xb'),_0x426086,_0x4a8a41[_0xfb07('0xe')]['message']);return _0x412795(_0x4a8a41['error'][_0xfb07('0xf')]);}logger[_0xfb07('0xe')](_0xfb07('0xb'),_0x426086,_0x4a8a41[_0xfb07('0xe')][_0xfb07('0xf')]);return _0x2f05b4(_0x4a8a41[_0xfb07('0xe')][_0xfb07('0xf')]);}else{logger[_0xfb07('0xa')](_0xfb07('0xb'),_0x426086,_0xfb07('0xc'));_0x2f05b4(_0x4a8a41[_0xfb07('0x10')]['message']);}})['catch'](function(_0x355467){logger['error'](_0xfb07('0xb'),_0x426086,_0x355467);_0x412795(_0x355467);});});}exports['GetDynamics365Account']=function(_0x2fd906){var _0x34573b=this;return new Promise(function(_0x6866a2,_0x12f7bb){return db[_0xfb07('0x11')][_0xfb07('0x12')]({'raw':_0x2fd906[_0xfb07('0x13')]?_0x2fd906[_0xfb07('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2fd906['options']?_0x2fd906[_0xfb07('0x13')]['where']||null:null,'attributes':_0x2fd906[_0xfb07('0x13')]?_0x2fd906['options']['attributes']||null:null,'limit':_0x2fd906['options']?_0x2fd906[_0xfb07('0x13')]['limit']||null:null,'include':_0x2fd906['options']?_0x2fd906[_0xfb07('0x13')][_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x2fd906['options']['include'],function(_0x869267){return{'model':db[_0x869267[_0xfb07('0x16')]],'as':_0x869267['as'],'attributes':_0x869267[_0xfb07('0x17')],'include':_0x869267[_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x869267[_0xfb07('0x14')],function(_0x540eda){return{'model':db[_0x540eda[_0xfb07('0x16')]],'as':_0x540eda['as'],'attributes':_0x540eda[_0xfb07('0x17')],'include':_0x540eda[_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x540eda['include'],function(_0x3c2b52){return{'model':db[_0x3c2b52[_0xfb07('0x16')]],'as':_0x3c2b52['as'],'attributes':_0x3c2b52['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb07('0x9')](function(_0x43df43){logger[_0xfb07('0xa')]('GetDynamics365Account',_0x2fd906);logger[_0xfb07('0x18')](_0xfb07('0x19'),_0x2fd906,JSON[_0xfb07('0x1a')](_0x43df43));_0x6866a2(_0x43df43);})[_0xfb07('0x1b')](function(_0x14a284){logger[_0xfb07('0xe')]('GetDynamics365Account',_0x14a284[_0xfb07('0xf')],_0x2fd906);_0x12f7bb(_0x34573b['error'](0x1f4,_0x14a284[_0xfb07('0xf')]));});});};exports[_0xfb07('0x1c')]=function(_0x3d0253){var _0x4ce353=this;return new Promise(function(_0x310616,_0x4879c8){return db[_0xfb07('0x11')][_0xfb07('0x1d')]({'raw':_0x3d0253[_0xfb07('0x13')]?_0x3d0253['options'][_0xfb07('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d0253[_0xfb07('0x13')]?_0x3d0253['options'][_0xfb07('0x1f')]||null:null,'attributes':_0x3d0253[_0xfb07('0x13')]?_0x3d0253[_0xfb07('0x13')][_0xfb07('0x17')]||null:null,'include':_0x3d0253[_0xfb07('0x13')]?_0x3d0253[_0xfb07('0x13')][_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x3d0253[_0xfb07('0x13')][_0xfb07('0x14')],function(_0x29253c){return{'model':db[_0x29253c[_0xfb07('0x16')]],'as':_0x29253c['as'],'attributes':_0x29253c[_0xfb07('0x17')],'include':_0x29253c[_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x29253c[_0xfb07('0x14')],function(_0x4527fd){return{'model':db[_0x4527fd[_0xfb07('0x16')]],'as':_0x4527fd['as'],'attributes':_0x4527fd[_0xfb07('0x17')],'include':_0x4527fd[_0xfb07('0x14')]?_[_0xfb07('0x15')](_0x4527fd[_0xfb07('0x14')],function(_0x189811){return{'model':db[_0x189811[_0xfb07('0x16')]],'as':_0x189811['as'],'attributes':_0x189811['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7086a2){logger[_0xfb07('0xa')]('ShowDynamics365Account',_0x3d0253);logger['debug'](_0xfb07('0x1c'),_0x3d0253,JSON['stringify'](_0x7086a2));_0x310616(_0x7086a2);})['catch'](function(_0x815934){logger[_0xfb07('0xe')](_0xfb07('0x1c'),_0x815934[_0xfb07('0xf')],_0x3d0253);_0x4879c8(_0x4ce353['error'](0x1f4,_0x815934[_0xfb07('0xf')]));});});}; \ No newline at end of file +var _0x0a66=['lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Dynamics365Account','options','where','attributes','limit','include','map','model','GetDynamics365Account','debug','ShowDynamics365Account','find'];(function(_0x58112f,_0x25fb5e){var _0xf53c38=function(_0x4cd3e0){while(--_0x4cd3e0){_0x58112f['push'](_0x58112f['shift']());}};_0xf53c38(++_0x25fb5e);}(_0x0a66,0x80));var _0x60a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0a66[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x60a6('0x0'));var util=require(_0x60a6('0x1'));var moment=require(_0x60a6('0x2'));var BPromise=require(_0x60a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60a6('0x5'));var config=require(_0x60a6('0x6'));var jayson=require(_0x60a6('0x7'));var client=jayson['client'][_0x60a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4caea6,_0x1d6ad2,_0x38d47f){return new BPromise(function(_0x1a030e,_0x2c4f1a){return client[_0x60a6('0x9')](_0x4caea6,_0x38d47f)[_0x60a6('0xa')](function(_0x517bf8){logger[_0x60a6('0xb')](_0x60a6('0xc'),_0x1d6ad2,_0x60a6('0xd'));logger['debug'](_0x60a6('0xe'),_0x1d6ad2,_0x60a6('0xd'),JSON['stringify'](_0x517bf8));if(_0x517bf8[_0x60a6('0xf')]){if(_0x517bf8['error'][_0x60a6('0x10')]===0x1f4){logger['error'](_0x60a6('0xc'),_0x1d6ad2,_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);return _0x2c4f1a(_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1d6ad2,_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);return _0x1a030e(_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);}else{logger[_0x60a6('0xb')](_0x60a6('0xc'),_0x1d6ad2,_0x60a6('0xd'));_0x1a030e(_0x517bf8[_0x60a6('0x12')][_0x60a6('0x11')]);}})[_0x60a6('0x13')](function(_0x343741){logger[_0x60a6('0xf')](_0x60a6('0xc'),_0x1d6ad2,_0x343741);_0x2c4f1a(_0x343741);});});}exports['GetDynamics365Account']=function(_0x329e68){var _0x4ef82a=this;return new Promise(function(_0x5cffa1,_0xabf102){return db[_0x60a6('0x14')]['findAll']({'raw':_0x329e68[_0x60a6('0x15')]?_0x329e68[_0x60a6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x329e68['options']?_0x329e68[_0x60a6('0x15')][_0x60a6('0x16')]||null:null,'attributes':_0x329e68[_0x60a6('0x15')]?_0x329e68[_0x60a6('0x15')][_0x60a6('0x17')]||null:null,'limit':_0x329e68[_0x60a6('0x15')]?_0x329e68['options'][_0x60a6('0x18')]||null:null,'include':_0x329e68[_0x60a6('0x15')]?_0x329e68['options'][_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0x329e68[_0x60a6('0x15')][_0x60a6('0x19')],function(_0x34b049){return{'model':db[_0x34b049[_0x60a6('0x1b')]],'as':_0x34b049['as'],'attributes':_0x34b049['attributes'],'include':_0x34b049[_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0x34b049[_0x60a6('0x19')],function(_0xb63008){return{'model':db[_0xb63008[_0x60a6('0x1b')]],'as':_0xb63008['as'],'attributes':_0xb63008['attributes'],'include':_0xb63008[_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0xb63008[_0x60a6('0x19')],function(_0x811cb9){return{'model':db[_0x811cb9[_0x60a6('0x1b')]],'as':_0x811cb9['as'],'attributes':_0x811cb9[_0x60a6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x60a6('0xa')](function(_0x43edf9){logger['info'](_0x60a6('0x1c'),_0x329e68);logger[_0x60a6('0x1d')](_0x60a6('0x1c'),_0x329e68,JSON['stringify'](_0x43edf9));_0x5cffa1(_0x43edf9);})[_0x60a6('0x13')](function(_0x463bcf){logger[_0x60a6('0xf')]('GetDynamics365Account',_0x463bcf[_0x60a6('0x11')],_0x329e68);_0xabf102(_0x4ef82a[_0x60a6('0xf')](0x1f4,_0x463bcf[_0x60a6('0x11')]));});});};exports[_0x60a6('0x1e')]=function(_0x4cbe86){var _0xe0c755=this;return new Promise(function(_0x1043fc,_0x194b8a){return db['Dynamics365Account'][_0x60a6('0x1f')]({'raw':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')]['where']||null:null,'attributes':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x17')]||null:null,'include':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x19')]?_['map'](_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x19')],function(_0x33b531){return{'model':db[_0x33b531[_0x60a6('0x1b')]],'as':_0x33b531['as'],'attributes':_0x33b531[_0x60a6('0x17')],'include':_0x33b531['include']?_[_0x60a6('0x1a')](_0x33b531[_0x60a6('0x19')],function(_0x2d1dfd){return{'model':db[_0x2d1dfd[_0x60a6('0x1b')]],'as':_0x2d1dfd['as'],'attributes':_0x2d1dfd['attributes'],'include':_0x2d1dfd['include']?_[_0x60a6('0x1a')](_0x2d1dfd[_0x60a6('0x19')],function(_0x5444ef){return{'model':db[_0x5444ef['model']],'as':_0x5444ef['as'],'attributes':_0x5444ef[_0x60a6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x60a6('0xa')](function(_0x49f861){logger[_0x60a6('0xb')](_0x60a6('0x1e'),_0x4cbe86);logger[_0x60a6('0x1d')](_0x60a6('0x1e'),_0x4cbe86,JSON['stringify'](_0x49f861));_0x1043fc(_0x49f861);})[_0x60a6('0x13')](function(_0xe43769){logger[_0x60a6('0xf')]('ShowDynamics365Account',_0xe43769[_0x60a6('0x11')],_0x4cbe86);_0x194b8a(_0xe0c755[_0x60a6('0xf')](0x1f4,_0xe43769[_0x60a6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8047f7c..0fd47e3 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 _0xe469=['/:id/descriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x134b84,_0x29e050){var _0x28b48a=function(_0x494ed0){while(--_0x494ed0){_0x134b84['push'](_0x134b84['shift']());}};_0x28b48a(++_0x29e050);}(_0xe469,0xef));var _0x9e46=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0xe469[_0x3e7bb8];return _0x160bf4;};'use strict';var multer=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var path=require(_0x9e46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e46('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e46('0x4'));var config=require(_0x9e46('0x5'));var controller=require(_0x9e46('0x6'));router[_0x9e46('0x7')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0x9')]);router[_0x9e46('0x7')]('/:id',auth[_0x9e46('0x8')](),controller[_0x9e46('0xa')]);router[_0x9e46('0x7')](_0x9e46('0xb'),auth[_0x9e46('0x8')](),controller[_0x9e46('0xc')]);router[_0x9e46('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x9e46('0x7')](_0x9e46('0xd'),auth[_0x9e46('0x8')](),controller['getDescriptions']);router[_0x9e46('0xe')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0xf')]);router[_0x9e46('0x10')](_0x9e46('0x11'),auth['isAuthenticated'](),controller[_0x9e46('0x12')]);router['delete']('/:id',auth[_0x9e46('0x8')](),controller[_0x9e46('0x13')]);module[_0x9e46('0x14')]=router; \ No newline at end of file +var _0x5eb8=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy'];(function(_0x5c9adf,_0x1ecf60){var _0x477fa8=function(_0xf4d13b){while(--_0xf4d13b){_0x5c9adf['push'](_0x5c9adf['shift']());}};_0x477fa8(++_0x1ecf60);}(_0x5eb8,0xb0));var _0x85eb=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0x5eb8[_0x237bf7];return _0x5928ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x16')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['update']);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);module[_0x85eb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 16ebb43..33a745e 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 _0x3748=['exports','STRING','ENUM','incident','contact','nothing','BOOLEAN'];(function(_0x1ae586,_0x1b6a8f){var _0x4faeaa=function(_0x306c0c){while(--_0x306c0c){_0x1ae586['push'](_0x1ae586['shift']());}};_0x4faeaa(++_0x1b6a8f);}(_0x3748,0xfc));var _0x8374=function(_0x1e9381,_0x5a1ad4){_0x1e9381=_0x1e9381-0x0;var _0x4c95ce=_0x3748[_0x1e9381];return _0x4c95ce;};'use strict';var Sequelize=require('sequelize');module[_0x8374('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8374('0x1')]},'ticketType':{'type':Sequelize[_0x8374('0x2')]('incident','phonecall'),'defaultValue':_0x8374('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x8374('0x4'),_0x8374('0x5')),'defaultValue':_0x8374('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8374('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8374('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf1ae=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x2d63ae,_0x2464bf){var _0xd22295=function(_0x46bf40){while(--_0x46bf40){_0x2d63ae['push'](_0x2d63ae['shift']());}};_0xd22295(++_0x2464bf);}(_0xf1ae,0xcd));var _0xef1a=function(_0x49f7f1,_0x168387){_0x49f7f1=_0x49f7f1-0x0;var _0x22ba5f=_0xf1ae[_0x49f7f1];return _0x22ba5f;};'use strict';var Sequelize=require(_0xef1a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef1a('0x1')]},'ticketType':{'type':Sequelize[_0xef1a('0x2')](_0xef1a('0x3'),_0xef1a('0x4')),'defaultValue':_0xef1a('0x3')},'moduleCreate':{'type':Sequelize[_0xef1a('0x2')](_0xef1a('0x5'),_0xef1a('0x6')),'defaultValue':_0xef1a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xef1a('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c37ca60..c90a356 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 _0xc677=['destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','filters','include','options','find','create','body','params','getFields','findOne','Dynamics365Field','order','hasOwnProperty','getSubjects','pick','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x5aa382,_0x29ae89){var _0x436279=function(_0x8e28f6){while(--_0x8e28f6){_0x5aa382['push'](_0x5aa382['shift']());}};_0x436279(++_0x29ae89);}(_0xc677,0x118));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c67('0x0'));var zipdir=require(_0x7c67('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c67('0x2'));var BPromise=require(_0x7c67('0x3'));var Mustache=require(_0x7c67('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7c67('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c67('0x6'));var _=require('lodash');var squel=require(_0x7c67('0x7'));var crypto=require(_0x7c67('0x8'));var jsforce=require(_0x7c67('0x9'));var deskjs=require(_0x7c67('0xa'));var toCsv=require(_0x7c67('0xb'));var querystring=require(_0x7c67('0xc'));var Papa=require(_0x7c67('0xd'));var Redis=require(_0x7c67('0xe'));var authService=require(_0x7c67('0xf'));var qs=require(_0x7c67('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c67('0x11'));var logger=require(_0x7c67('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7c67('0x13'));var licenseUtil=require(_0x7c67('0x14'));var db=require(_0x7c67('0x15'))['db'];function respondWithStatusCode(_0x5a91d2,_0xd52da1){_0xd52da1=_0xd52da1||0xcc;return function(_0x237589){if(_0x237589){return _0x5a91d2[_0x7c67('0x16')](_0xd52da1);}return _0x5a91d2[_0x7c67('0x17')](_0xd52da1)[_0x7c67('0x18')]();};}function respondWithResult(_0x3035ce,_0x324f71){_0x324f71=_0x324f71||0xc8;return function(_0x14e2d1){if(_0x14e2d1){return _0x3035ce[_0x7c67('0x17')](_0x324f71)['json'](_0x14e2d1);}};}function respondWithFilteredResult(_0x12b7ce,_0x526e6a){return function(_0x33b545){if(_0x33b545){var _0x8c3694=typeof _0x526e6a[_0x7c67('0x19')]===_0x7c67('0x1a')&&typeof _0x526e6a[_0x7c67('0x1b')]===_0x7c67('0x1a');var _0x29acdd=_0x33b545[_0x7c67('0x1c')];var _0x3ed022=_0x8c3694?0x0:_0x526e6a['offset'];var _0xb31fc2=_0x8c3694?_0x33b545['count']:_0x526e6a[_0x7c67('0x19')]+_0x526e6a[_0x7c67('0x1b')];var _0x75e1ec;if(_0xb31fc2>=_0x29acdd){_0xb31fc2=_0x29acdd;_0x75e1ec=0xc8;}else{_0x75e1ec=0xce;}_0x12b7ce[_0x7c67('0x17')](_0x75e1ec);return _0x12b7ce[_0x7c67('0x1d')](_0x7c67('0x1e'),_0x3ed022+'-'+_0xb31fc2+'/'+_0x29acdd)['json'](_0x33b545);}return null;};}function patchUpdates(_0x19b10d){return function(_0x2fc6fc){try{jsonpatch[_0x7c67('0x1f')](_0x2fc6fc,_0x19b10d,!![]);}catch(_0x82679b){return BPromise[_0x7c67('0x20')](_0x82679b);}return _0x2fc6fc[_0x7c67('0x21')]();};}function saveUpdates(_0x451765,_0x3f17f3){return function(_0x3d1506){if(_0x3d1506){return _0x3d1506[_0x7c67('0x22')](_0x451765)[_0x7c67('0x23')](function(_0x515db2){return _0x515db2;});}return null;};}function removeEntity(_0x329916,_0x39c638){return function(_0x3511b4){if(_0x3511b4){return _0x3511b4[_0x7c67('0x24')]()['then'](function(){_0x329916[_0x7c67('0x17')](0xcc)[_0x7c67('0x18')]();});}};}function handleEntityNotFound(_0x4f612e,_0x38616d){return function(_0x24ee31){if(!_0x24ee31){_0x4f612e[_0x7c67('0x16')](0x194);}return _0x24ee31;};}function handleError(_0x339cd6,_0x24a99a){_0x24a99a=_0x24a99a||0x1f4;return function(_0x5f3775){logger['error'](_0x5f3775[_0x7c67('0x25')]);if(_0x5f3775['name']){delete _0x5f3775[_0x7c67('0x26')];}_0x339cd6[_0x7c67('0x17')](_0x24a99a)[_0x7c67('0x27')](_0x5f3775);};}exports[_0x7c67('0x28')]=function(_0xa0a269,_0xfdde8){var _0x6e7899={},_0x4dd686={},_0x4003ea={'count':0x0,'rows':[]};var _0x5bb4fd=_[_0x7c67('0x29')](db[_0x7c67('0x2a')][_0x7c67('0x2b')],function(_0x35b4cb){return{'name':_0x35b4cb[_0x7c67('0x2c')],'type':_0x35b4cb[_0x7c67('0x2d')][_0x7c67('0x2e')]};});_0x4dd686['model']=_['map'](_0x5bb4fd,_0x7c67('0x26'));_0x4dd686[_0x7c67('0x2f')]=_[_0x7c67('0x30')](_0xa0a269['query']);_0x4dd686['filters']=_[_0x7c67('0x31')](_0x4dd686[_0x7c67('0x32')],_0x4dd686['query']);_0x6e7899[_0x7c67('0x33')]=_[_0x7c67('0x31')](_0x4dd686[_0x7c67('0x32')],qs[_0x7c67('0x34')](_0xa0a269[_0x7c67('0x2f')]['fields']));_0x6e7899[_0x7c67('0x33')]=_0x6e7899[_0x7c67('0x33')][_0x7c67('0x35')]?_0x6e7899[_0x7c67('0x33')]:_0x4dd686[_0x7c67('0x32')];if(!_0xa0a269[_0x7c67('0x2f')]['hasOwnProperty'](_0x7c67('0x36'))){_0x6e7899[_0x7c67('0x1b')]=qs['limit'](_0xa0a269[_0x7c67('0x2f')][_0x7c67('0x1b')]);_0x6e7899['offset']=qs[_0x7c67('0x19')](_0xa0a269[_0x7c67('0x2f')][_0x7c67('0x19')]);}_0x6e7899['order']=qs[_0x7c67('0x37')](_0xa0a269['query']['sort']);_0x6e7899[_0x7c67('0x38')]=qs['filters'](_['pick'](_0xa0a269[_0x7c67('0x2f')],_0x4dd686['filters']),_0x5bb4fd);if(_0xa0a269['query'][_0x7c67('0x39')]){_0x6e7899[_0x7c67('0x38')]=_['merge'](_0x6e7899[_0x7c67('0x38')],{'$or':_[_0x7c67('0x29')](_0x5bb4fd,function(_0x40b8ea){if(_0x40b8ea['type']!==_0x7c67('0x3a')){var _0x51a39d={};_0x51a39d[_0x40b8ea[_0x7c67('0x26')]]={'$like':'%'+_0xa0a269[_0x7c67('0x2f')][_0x7c67('0x39')]+'%'};return _0x51a39d;}})});}_0x6e7899=_[_0x7c67('0x3b')]({},_0x6e7899,_0xa0a269['options']);var _0x382ec6={'where':_0x6e7899[_0x7c67('0x38')]};return db['Dynamics365Configuration'][_0x7c67('0x1c')](_0x382ec6)[_0x7c67('0x23')](function(_0x1d48ce){_0x4003ea[_0x7c67('0x1c')]=_0x1d48ce;if(_0xa0a269[_0x7c67('0x2f')][_0x7c67('0x3c')]){_0x6e7899['include']=[{'all':!![]}];}return db[_0x7c67('0x2a')][_0x7c67('0x3d')](_0x6e7899);})[_0x7c67('0x23')](function(_0x4c2654){_0x4003ea[_0x7c67('0x3e')]=_0x4c2654;return _0x4003ea;})['then'](respondWithFilteredResult(_0xfdde8,_0x6e7899))[_0x7c67('0x3f')](handleError(_0xfdde8,null));};exports['show']=function(_0x247e83,_0x38b8a5){var _0x140103={'raw':![],'where':{'id':_0x247e83['params']['id']}},_0x58a24c={};_0x58a24c[_0x7c67('0x32')]=_[_0x7c67('0x30')](db[_0x7c67('0x2a')][_0x7c67('0x2b')]);_0x58a24c['query']=_['keys'](_0x247e83['query']);_0x58a24c[_0x7c67('0x40')]=_['intersection'](_0x58a24c[_0x7c67('0x32')],_0x58a24c[_0x7c67('0x2f')]);_0x140103['attributes']=_[_0x7c67('0x31')](_0x58a24c[_0x7c67('0x32')],qs[_0x7c67('0x34')](_0x247e83[_0x7c67('0x2f')][_0x7c67('0x34')]));_0x140103[_0x7c67('0x33')]=_0x140103['attributes'][_0x7c67('0x35')]?_0x140103[_0x7c67('0x33')]:_0x58a24c[_0x7c67('0x32')];if(_0x247e83[_0x7c67('0x2f')][_0x7c67('0x3c')]){_0x140103[_0x7c67('0x41')]=[{'all':!![]}];}_0x140103=_[_0x7c67('0x3b')]({},_0x140103,_0x247e83[_0x7c67('0x42')]);return db[_0x7c67('0x2a')][_0x7c67('0x43')](_0x140103)[_0x7c67('0x23')](handleEntityNotFound(_0x38b8a5,null))['then'](respondWithResult(_0x38b8a5,null))[_0x7c67('0x3f')](handleError(_0x38b8a5,null));};exports['create']=function(_0x2ad344,_0x30e9e7){return db[_0x7c67('0x2a')][_0x7c67('0x44')](_0x2ad344[_0x7c67('0x45')],{})[_0x7c67('0x23')](respondWithResult(_0x30e9e7,0xc9))[_0x7c67('0x3f')](handleError(_0x30e9e7,null));};exports[_0x7c67('0x22')]=function(_0x3fe07d,_0x56d81a){if(_0x3fe07d[_0x7c67('0x45')]['id']){delete _0x3fe07d[_0x7c67('0x45')]['id'];}return db[_0x7c67('0x2a')]['find']({'where':{'id':_0x3fe07d['params']['id']}})['then'](handleEntityNotFound(_0x56d81a,null))[_0x7c67('0x23')](saveUpdates(_0x3fe07d['body'],null))[_0x7c67('0x23')](respondWithResult(_0x56d81a,null))[_0x7c67('0x3f')](handleError(_0x56d81a,null));};exports[_0x7c67('0x24')]=function(_0x56d174,_0x319783){return db[_0x7c67('0x2a')][_0x7c67('0x43')]({'where':{'id':_0x56d174[_0x7c67('0x46')]['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0x319783,null))[_0x7c67('0x23')](removeEntity(_0x319783,null))[_0x7c67('0x3f')](handleError(_0x319783,null));};exports[_0x7c67('0x47')]=function(_0x597b5e,_0x25c8c8,_0x2fa7f6){var _0x4d12d0={};var _0xd4c62e={};var _0x1fdd4b;var _0x2c011f;return db[_0x7c67('0x2a')][_0x7c67('0x48')]({'where':{'id':_0x597b5e[_0x7c67('0x46')]['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0x25c8c8,null))[_0x7c67('0x23')](function(_0x4b0af9){if(_0x4b0af9){_0x1fdd4b=_0x4b0af9;_0xd4c62e[_0x7c67('0x32')]=_[_0x7c67('0x30')](db[_0x7c67('0x49')]['rawAttributes']);_0xd4c62e[_0x7c67('0x2f')]=_[_0x7c67('0x30')](_0x597b5e[_0x7c67('0x2f')]);_0xd4c62e[_0x7c67('0x40')]=_['intersection'](_0xd4c62e[_0x7c67('0x32')],_0xd4c62e[_0x7c67('0x2f')]);_0x4d12d0['attributes']=_[_0x7c67('0x31')](_0xd4c62e[_0x7c67('0x32')],qs[_0x7c67('0x34')](_0x597b5e[_0x7c67('0x2f')][_0x7c67('0x34')]));_0x4d12d0[_0x7c67('0x33')]=_0x4d12d0[_0x7c67('0x33')][_0x7c67('0x35')]?_0x4d12d0[_0x7c67('0x33')]:_0xd4c62e[_0x7c67('0x32')];_0x4d12d0[_0x7c67('0x4a')]=qs[_0x7c67('0x37')](_0x597b5e[_0x7c67('0x2f')][_0x7c67('0x37')]);_0x4d12d0['where']=qs[_0x7c67('0x40')](_['pick'](_0x597b5e[_0x7c67('0x2f')],_0xd4c62e['filters']));if(_0x597b5e[_0x7c67('0x2f')][_0x7c67('0x39')]){_0x4d12d0[_0x7c67('0x38')]=_[_0x7c67('0x3b')](_0x4d12d0[_0x7c67('0x38')],{'$or':_[_0x7c67('0x29')](_0x4d12d0[_0x7c67('0x33')],function(_0x54368a){var _0x545f01={};_0x545f01[_0x54368a]={'$like':'%'+_0x597b5e['query'][_0x7c67('0x39')]+'%'};return _0x545f01;})});}_0x4d12d0=_[_0x7c67('0x3b')]({},_0x4d12d0,_0x597b5e['options']);return _0x1fdd4b[_0x7c67('0x47')](_0x4d12d0);}})['then'](function(_0x3b4d5c){if(_0x3b4d5c){_0x2c011f=_0x3b4d5c['length'];if(!_0x597b5e[_0x7c67('0x2f')][_0x7c67('0x4b')](_0x7c67('0x36'))){_0x4d12d0[_0x7c67('0x1b')]=qs[_0x7c67('0x1b')](_0x597b5e[_0x7c67('0x2f')]['limit']);_0x4d12d0['offset']=qs[_0x7c67('0x19')](_0x597b5e[_0x7c67('0x2f')][_0x7c67('0x19')]);}return _0x1fdd4b[_0x7c67('0x47')](_0x4d12d0);}})[_0x7c67('0x23')](function(_0x456092){if(_0x456092){return _0x456092?{'count':_0x2c011f,'rows':_0x456092}:null;}})[_0x7c67('0x23')](respondWithResult(_0x25c8c8,null))[_0x7c67('0x3f')](handleError(_0x25c8c8,null));};exports[_0x7c67('0x4c')]=function(_0x493ec6,_0x3a549d,_0x4218ca){var _0x584670={};var _0x2fe0e7={};var _0x144aac;var _0x41f863;return db[_0x7c67('0x2a')][_0x7c67('0x48')]({'where':{'id':_0x493ec6[_0x7c67('0x46')]['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0x3a549d,null))[_0x7c67('0x23')](function(_0x16f03e){if(_0x16f03e){_0x144aac=_0x16f03e;_0x2fe0e7[_0x7c67('0x32')]=_[_0x7c67('0x30')](db[_0x7c67('0x49')][_0x7c67('0x2b')]);_0x2fe0e7[_0x7c67('0x2f')]=_[_0x7c67('0x30')](_0x493ec6['query']);_0x2fe0e7[_0x7c67('0x40')]=_['intersection'](_0x2fe0e7[_0x7c67('0x32')],_0x2fe0e7[_0x7c67('0x2f')]);_0x584670[_0x7c67('0x33')]=_[_0x7c67('0x31')](_0x2fe0e7[_0x7c67('0x32')],qs[_0x7c67('0x34')](_0x493ec6['query']['fields']));_0x584670[_0x7c67('0x33')]=_0x584670['attributes']['length']?_0x584670[_0x7c67('0x33')]:_0x2fe0e7[_0x7c67('0x32')];_0x584670[_0x7c67('0x4a')]=qs[_0x7c67('0x37')](_0x493ec6[_0x7c67('0x2f')]['sort']);_0x584670[_0x7c67('0x38')]=qs[_0x7c67('0x40')](_[_0x7c67('0x4d')](_0x493ec6[_0x7c67('0x2f')],_0x2fe0e7[_0x7c67('0x40')]));if(_0x493ec6[_0x7c67('0x2f')][_0x7c67('0x39')]){_0x584670['where']=_['merge'](_0x584670[_0x7c67('0x38')],{'$or':_['map'](_0x584670[_0x7c67('0x33')],function(_0x137038){var _0x3cd66c={};_0x3cd66c[_0x137038]={'$like':'%'+_0x493ec6[_0x7c67('0x2f')][_0x7c67('0x39')]+'%'};return _0x3cd66c;})});}_0x584670=_['merge']({},_0x584670,_0x493ec6[_0x7c67('0x42')]);return _0x144aac[_0x7c67('0x4c')](_0x584670);}})[_0x7c67('0x23')](function(_0x48ba26){if(_0x48ba26){_0x41f863=_0x48ba26[_0x7c67('0x35')];if(!_0x493ec6[_0x7c67('0x2f')][_0x7c67('0x4b')]('nolimit')){_0x584670[_0x7c67('0x1b')]=qs[_0x7c67('0x1b')](_0x493ec6[_0x7c67('0x2f')]['limit']);_0x584670[_0x7c67('0x19')]=qs[_0x7c67('0x19')](_0x493ec6[_0x7c67('0x2f')][_0x7c67('0x19')]);}return _0x144aac[_0x7c67('0x4c')](_0x584670);}})[_0x7c67('0x23')](function(_0x52bc8f){if(_0x52bc8f){return _0x52bc8f?{'count':_0x41f863,'rows':_0x52bc8f}:null;}})[_0x7c67('0x23')](respondWithResult(_0x3a549d,null))[_0x7c67('0x3f')](handleError(_0x3a549d,null));};exports[_0x7c67('0x4e')]=function(_0xc02dd3,_0x5b561c,_0x198ab2){var _0x843a4={};var _0x29db8d={};var _0x2e0684;var _0x10beab;return db[_0x7c67('0x2a')]['findOne']({'where':{'id':_0xc02dd3['params']['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0x5b561c,null))[_0x7c67('0x23')](function(_0x22c176){if(_0x22c176){_0x2e0684=_0x22c176;_0x29db8d[_0x7c67('0x32')]=_[_0x7c67('0x30')](db[_0x7c67('0x49')][_0x7c67('0x2b')]);_0x29db8d['query']=_[_0x7c67('0x30')](_0xc02dd3[_0x7c67('0x2f')]);_0x29db8d['filters']=_['intersection'](_0x29db8d[_0x7c67('0x32')],_0x29db8d['query']);_0x843a4[_0x7c67('0x33')]=_[_0x7c67('0x31')](_0x29db8d['model'],qs[_0x7c67('0x34')](_0xc02dd3[_0x7c67('0x2f')][_0x7c67('0x34')]));_0x843a4['attributes']=_0x843a4[_0x7c67('0x33')][_0x7c67('0x35')]?_0x843a4[_0x7c67('0x33')]:_0x29db8d[_0x7c67('0x32')];_0x843a4['order']=qs[_0x7c67('0x37')](_0xc02dd3[_0x7c67('0x2f')][_0x7c67('0x37')]);_0x843a4[_0x7c67('0x38')]=qs['filters'](_[_0x7c67('0x4d')](_0xc02dd3[_0x7c67('0x2f')],_0x29db8d[_0x7c67('0x40')]));if(_0xc02dd3[_0x7c67('0x2f')]['filter']){_0x843a4[_0x7c67('0x38')]=_[_0x7c67('0x3b')](_0x843a4[_0x7c67('0x38')],{'$or':_[_0x7c67('0x29')](_0x843a4[_0x7c67('0x33')],function(_0x16b049){var _0x34d892={};_0x34d892[_0x16b049]={'$like':'%'+_0xc02dd3['query'][_0x7c67('0x39')]+'%'};return _0x34d892;})});}_0x843a4=_[_0x7c67('0x3b')]({},_0x843a4,_0xc02dd3[_0x7c67('0x42')]);return _0x2e0684['getDescriptions'](_0x843a4);}})[_0x7c67('0x23')](function(_0x337691){if(_0x337691){_0x10beab=_0x337691[_0x7c67('0x35')];if(!_0xc02dd3[_0x7c67('0x2f')][_0x7c67('0x4b')](_0x7c67('0x36'))){_0x843a4[_0x7c67('0x1b')]=qs[_0x7c67('0x1b')](_0xc02dd3['query']['limit']);_0x843a4[_0x7c67('0x19')]=qs['offset'](_0xc02dd3[_0x7c67('0x2f')]['offset']);}return _0x2e0684['getDescriptions'](_0x843a4);}})[_0x7c67('0x23')](function(_0x583612){if(_0x583612){return _0x583612?{'count':_0x10beab,'rows':_0x583612}:null;}})[_0x7c67('0x23')](respondWithResult(_0x5b561c,null))[_0x7c67('0x3f')](handleError(_0x5b561c,null));}; \ No newline at end of file +var _0x4058=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','order','getFields','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x4058,0x9b));var _0x8405=function(_0x32aeac,_0x385aba){_0x32aeac=_0x32aeac-0x0;var _0x17b5a6=_0x4058[_0x32aeac];return _0x17b5a6;};'use strict';var emlformat=require(_0x8405('0x0'));var rimraf=require(_0x8405('0x1'));var zipdir=require(_0x8405('0x2'));var jsonpatch=require(_0x8405('0x3'));var rp=require('request-promise');var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var Mustache=require(_0x8405('0x6'));var util=require(_0x8405('0x7'));var path=require(_0x8405('0x8'));var sox=require(_0x8405('0x9'));var csv=require(_0x8405('0xa'));var ejs=require(_0x8405('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8405('0xc'));var squel=require(_0x8405('0xd'));var crypto=require('crypto');var jsforce=require(_0x8405('0xe'));var deskjs=require(_0x8405('0xf'));var toCsv=require(_0x8405('0xa'));var querystring=require(_0x8405('0x10'));var Papa=require(_0x8405('0x11'));var Redis=require(_0x8405('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x14'))('api');var utils=require(_0x8405('0x15'));var config=require(_0x8405('0x16'));var licenseUtil=require(_0x8405('0x17'));var db=require(_0x8405('0x18'))['db'];function respondWithStatusCode(_0x239ada,_0x2df92f){_0x2df92f=_0x2df92f||0xcc;return function(_0x45a658){if(_0x45a658){return _0x239ada[_0x8405('0x19')](_0x2df92f);}return _0x239ada[_0x8405('0x1a')](_0x2df92f)[_0x8405('0x1b')]();};}function respondWithResult(_0x453784,_0x2589ec){_0x2589ec=_0x2589ec||0xc8;return function(_0x36a760){if(_0x36a760){return _0x453784[_0x8405('0x1a')](_0x2589ec)['json'](_0x36a760);}};}function respondWithFilteredResult(_0x3a73d5,_0x176e98){return function(_0x17d8ab){if(_0x17d8ab){var _0x584599=typeof _0x176e98[_0x8405('0x1c')]===_0x8405('0x1d')&&typeof _0x176e98[_0x8405('0x1e')]===_0x8405('0x1d');var _0x4ef0df=_0x17d8ab[_0x8405('0x1f')];var _0x2d32d7=_0x584599?0x0:_0x176e98[_0x8405('0x1c')];var _0x385ccb=_0x584599?_0x17d8ab[_0x8405('0x1f')]:_0x176e98[_0x8405('0x1c')]+_0x176e98[_0x8405('0x1e')];var _0x132a8d;if(_0x385ccb>=_0x4ef0df){_0x385ccb=_0x4ef0df;_0x132a8d=0xc8;}else{_0x132a8d=0xce;}_0x3a73d5[_0x8405('0x1a')](_0x132a8d);return _0x3a73d5[_0x8405('0x20')](_0x8405('0x21'),_0x2d32d7+'-'+_0x385ccb+'/'+_0x4ef0df)['json'](_0x17d8ab);}return null;};}function patchUpdates(_0x1a03d1){return function(_0x2262d9){try{jsonpatch[_0x8405('0x22')](_0x2262d9,_0x1a03d1,!![]);}catch(_0x31f7cf){return BPromise[_0x8405('0x23')](_0x31f7cf);}return _0x2262d9[_0x8405('0x24')]();};}function saveUpdates(_0x476f76,_0x2cb5ec){return function(_0x492b06){if(_0x492b06){return _0x492b06[_0x8405('0x25')](_0x476f76)[_0x8405('0x26')](function(_0x4badb8){return _0x4badb8;});}return null;};}function removeEntity(_0x5ce42c,_0x4794fe){return function(_0x1d8216){if(_0x1d8216){return _0x1d8216[_0x8405('0x27')]()[_0x8405('0x26')](function(){_0x5ce42c[_0x8405('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2204f2,_0x1d512c){return function(_0x6b0fd5){if(!_0x6b0fd5){_0x2204f2[_0x8405('0x19')](0x194);}return _0x6b0fd5;};}function handleError(_0x23592f,_0x2cf279){_0x2cf279=_0x2cf279||0x1f4;return function(_0x4e6f5d){logger[_0x8405('0x28')](_0x4e6f5d['stack']);if(_0x4e6f5d[_0x8405('0x29')]){delete _0x4e6f5d[_0x8405('0x29')];}_0x23592f['status'](_0x2cf279)[_0x8405('0x2a')](_0x4e6f5d);};}exports[_0x8405('0x2b')]=function(_0x4f3c4d,_0x128d0c){var _0x360a6a={},_0x2e36a9={},_0x5f110e={'count':0x0,'rows':[]};var _0x16328c=_[_0x8405('0x2c')](db[_0x8405('0x2d')][_0x8405('0x2e')],function(_0x47979c){return{'name':_0x47979c[_0x8405('0x2f')],'type':_0x47979c[_0x8405('0x30')][_0x8405('0x31')]};});_0x2e36a9[_0x8405('0x32')]=_['map'](_0x16328c,'name');_0x2e36a9[_0x8405('0x33')]=_['keys'](_0x4f3c4d[_0x8405('0x33')]);_0x2e36a9[_0x8405('0x34')]=_[_0x8405('0x35')](_0x2e36a9[_0x8405('0x32')],_0x2e36a9[_0x8405('0x33')]);_0x360a6a[_0x8405('0x36')]=_[_0x8405('0x35')](_0x2e36a9[_0x8405('0x32')],qs[_0x8405('0x37')](_0x4f3c4d['query'][_0x8405('0x37')]));_0x360a6a[_0x8405('0x36')]=_0x360a6a[_0x8405('0x36')][_0x8405('0x38')]?_0x360a6a[_0x8405('0x36')]:_0x2e36a9[_0x8405('0x32')];if(!_0x4f3c4d[_0x8405('0x33')]['hasOwnProperty'](_0x8405('0x39'))){_0x360a6a[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x4f3c4d[_0x8405('0x33')][_0x8405('0x1e')]);_0x360a6a[_0x8405('0x1c')]=qs[_0x8405('0x1c')](_0x4f3c4d['query'][_0x8405('0x1c')]);}_0x360a6a['order']=qs['sort'](_0x4f3c4d['query'][_0x8405('0x3a')]);_0x360a6a[_0x8405('0x3b')]=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x4f3c4d['query'],_0x2e36a9[_0x8405('0x34')]),_0x16328c);if(_0x4f3c4d['query'][_0x8405('0x3d')]){_0x360a6a[_0x8405('0x3b')]=_['merge'](_0x360a6a['where'],{'$or':_[_0x8405('0x2c')](_0x16328c,function(_0xea7098){if(_0xea7098[_0x8405('0x30')]!==_0x8405('0x3e')){var _0x373c08={};_0x373c08[_0xea7098[_0x8405('0x29')]]={'$like':'%'+_0x4f3c4d[_0x8405('0x33')][_0x8405('0x3d')]+'%'};return _0x373c08;}})});}_0x360a6a=_[_0x8405('0x3f')]({},_0x360a6a,_0x4f3c4d[_0x8405('0x40')]);var _0x2ac302={'where':_0x360a6a[_0x8405('0x3b')]};return db[_0x8405('0x2d')][_0x8405('0x1f')](_0x2ac302)['then'](function(_0xe79b3b){_0x5f110e['count']=_0xe79b3b;if(_0x4f3c4d[_0x8405('0x33')][_0x8405('0x41')]){_0x360a6a[_0x8405('0x42')]=[{'all':!![]}];}return db[_0x8405('0x2d')]['findAll'](_0x360a6a);})[_0x8405('0x26')](function(_0x499eb5){_0x5f110e[_0x8405('0x43')]=_0x499eb5;return _0x5f110e;})[_0x8405('0x26')](respondWithFilteredResult(_0x128d0c,_0x360a6a))[_0x8405('0x44')](handleError(_0x128d0c,null));};exports[_0x8405('0x45')]=function(_0xabf5d3,_0x1de5e9){var _0x459fbf={'raw':![],'where':{'id':_0xabf5d3[_0x8405('0x46')]['id']}},_0x4433ce={};_0x4433ce['model']=_[_0x8405('0x47')](db['Dynamics365Configuration']['rawAttributes']);_0x4433ce[_0x8405('0x33')]=_['keys'](_0xabf5d3[_0x8405('0x33')]);_0x4433ce[_0x8405('0x34')]=_[_0x8405('0x35')](_0x4433ce['model'],_0x4433ce[_0x8405('0x33')]);_0x459fbf[_0x8405('0x36')]=_[_0x8405('0x35')](_0x4433ce[_0x8405('0x32')],qs[_0x8405('0x37')](_0xabf5d3[_0x8405('0x33')][_0x8405('0x37')]));_0x459fbf[_0x8405('0x36')]=_0x459fbf[_0x8405('0x36')][_0x8405('0x38')]?_0x459fbf['attributes']:_0x4433ce['model'];if(_0xabf5d3[_0x8405('0x33')]['includeAll']){_0x459fbf[_0x8405('0x42')]=[{'all':!![]}];}_0x459fbf=_['merge']({},_0x459fbf,_0xabf5d3[_0x8405('0x40')]);return db['Dynamics365Configuration'][_0x8405('0x48')](_0x459fbf)[_0x8405('0x26')](handleEntityNotFound(_0x1de5e9,null))['then'](respondWithResult(_0x1de5e9,null))['catch'](handleError(_0x1de5e9,null));};exports[_0x8405('0x49')]=function(_0x14383e,_0x3b4203){return db[_0x8405('0x2d')][_0x8405('0x49')](_0x14383e[_0x8405('0x4a')],{})['then'](respondWithResult(_0x3b4203,0xc9))[_0x8405('0x44')](handleError(_0x3b4203,null));};exports[_0x8405('0x25')]=function(_0x4fb0eb,_0x803de4){if(_0x4fb0eb[_0x8405('0x4a')]['id']){delete _0x4fb0eb[_0x8405('0x4a')]['id'];}return db[_0x8405('0x2d')][_0x8405('0x48')]({'where':{'id':_0x4fb0eb[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x803de4,null))[_0x8405('0x26')](saveUpdates(_0x4fb0eb[_0x8405('0x4a')],null))[_0x8405('0x26')](respondWithResult(_0x803de4,null))[_0x8405('0x44')](handleError(_0x803de4,null));};exports[_0x8405('0x27')]=function(_0x5f5711,_0x315498){return db[_0x8405('0x2d')][_0x8405('0x48')]({'where':{'id':_0x5f5711[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x315498,null))[_0x8405('0x26')](removeEntity(_0x315498,null))[_0x8405('0x44')](handleError(_0x315498,null));};exports['getFields']=function(_0x556afc,_0xa1a12f,_0x1c632b){var _0x3b145f={};var _0x4f2c42={};var _0xb0e87b;var _0x19cc96;return db[_0x8405('0x2d')][_0x8405('0x4b')]({'where':{'id':_0x556afc[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0xa1a12f,null))[_0x8405('0x26')](function(_0x36312a){if(_0x36312a){_0xb0e87b=_0x36312a;_0x4f2c42[_0x8405('0x32')]=_[_0x8405('0x47')](db['Dynamics365Field'][_0x8405('0x2e')]);_0x4f2c42['query']=_[_0x8405('0x47')](_0x556afc[_0x8405('0x33')]);_0x4f2c42['filters']=_['intersection'](_0x4f2c42[_0x8405('0x32')],_0x4f2c42[_0x8405('0x33')]);_0x3b145f[_0x8405('0x36')]=_[_0x8405('0x35')](_0x4f2c42[_0x8405('0x32')],qs[_0x8405('0x37')](_0x556afc['query'][_0x8405('0x37')]));_0x3b145f[_0x8405('0x36')]=_0x3b145f[_0x8405('0x36')][_0x8405('0x38')]?_0x3b145f['attributes']:_0x4f2c42[_0x8405('0x32')];_0x3b145f[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x556afc[_0x8405('0x33')][_0x8405('0x3a')]);_0x3b145f['where']=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x556afc[_0x8405('0x33')],_0x4f2c42[_0x8405('0x34')]));if(_0x556afc['query'][_0x8405('0x3d')]){_0x3b145f[_0x8405('0x3b')]=_[_0x8405('0x3f')](_0x3b145f[_0x8405('0x3b')],{'$or':_['map'](_0x3b145f[_0x8405('0x36')],function(_0x5c294d){var _0x3738a8={};_0x3738a8[_0x5c294d]={'$like':'%'+_0x556afc['query']['filter']+'%'};return _0x3738a8;})});}_0x3b145f=_[_0x8405('0x3f')]({},_0x3b145f,_0x556afc[_0x8405('0x40')]);return _0xb0e87b[_0x8405('0x4d')](_0x3b145f);}})[_0x8405('0x26')](function(_0x326be6){if(_0x326be6){_0x19cc96=_0x326be6[_0x8405('0x38')];if(!_0x556afc['query'][_0x8405('0x4e')](_0x8405('0x39'))){_0x3b145f[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x556afc[_0x8405('0x33')][_0x8405('0x1e')]);_0x3b145f['offset']=qs[_0x8405('0x1c')](_0x556afc['query'][_0x8405('0x1c')]);}return _0xb0e87b[_0x8405('0x4d')](_0x3b145f);}})[_0x8405('0x26')](function(_0x1fe36f){if(_0x1fe36f){return _0x1fe36f?{'count':_0x19cc96,'rows':_0x1fe36f}:null;}})[_0x8405('0x26')](respondWithResult(_0xa1a12f,null))[_0x8405('0x44')](handleError(_0xa1a12f,null));};exports['getSubjects']=function(_0x15c9f4,_0x1487e7,_0x21a258){var _0x518c6e={};var _0x14d203={};var _0x3b9d47;var _0x2e464a;return db[_0x8405('0x2d')]['findOne']({'where':{'id':_0x15c9f4[_0x8405('0x46')]['id']}})['then'](handleEntityNotFound(_0x1487e7,null))[_0x8405('0x26')](function(_0x1fdbcb){if(_0x1fdbcb){_0x3b9d47=_0x1fdbcb;_0x14d203['model']=_[_0x8405('0x47')](db[_0x8405('0x4f')][_0x8405('0x2e')]);_0x14d203[_0x8405('0x33')]=_[_0x8405('0x47')](_0x15c9f4['query']);_0x14d203[_0x8405('0x34')]=_[_0x8405('0x35')](_0x14d203[_0x8405('0x32')],_0x14d203[_0x8405('0x33')]);_0x518c6e[_0x8405('0x36')]=_[_0x8405('0x35')](_0x14d203[_0x8405('0x32')],qs['fields'](_0x15c9f4['query'][_0x8405('0x37')]));_0x518c6e[_0x8405('0x36')]=_0x518c6e[_0x8405('0x36')][_0x8405('0x38')]?_0x518c6e[_0x8405('0x36')]:_0x14d203[_0x8405('0x32')];_0x518c6e[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x15c9f4[_0x8405('0x33')][_0x8405('0x3a')]);_0x518c6e['where']=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x15c9f4[_0x8405('0x33')],_0x14d203[_0x8405('0x34')]));if(_0x15c9f4[_0x8405('0x33')][_0x8405('0x3d')]){_0x518c6e['where']=_['merge'](_0x518c6e['where'],{'$or':_[_0x8405('0x2c')](_0x518c6e[_0x8405('0x36')],function(_0x37410b){var _0x38507d={};_0x38507d[_0x37410b]={'$like':'%'+_0x15c9f4['query'][_0x8405('0x3d')]+'%'};return _0x38507d;})});}_0x518c6e=_[_0x8405('0x3f')]({},_0x518c6e,_0x15c9f4[_0x8405('0x40')]);return _0x3b9d47['getSubjects'](_0x518c6e);}})[_0x8405('0x26')](function(_0x28349a){if(_0x28349a){_0x2e464a=_0x28349a[_0x8405('0x38')];if(!_0x15c9f4['query']['hasOwnProperty'](_0x8405('0x39'))){_0x518c6e[_0x8405('0x1e')]=qs['limit'](_0x15c9f4[_0x8405('0x33')][_0x8405('0x1e')]);_0x518c6e['offset']=qs[_0x8405('0x1c')](_0x15c9f4[_0x8405('0x33')]['offset']);}return _0x3b9d47[_0x8405('0x50')](_0x518c6e);}})[_0x8405('0x26')](function(_0x4e4cd7){if(_0x4e4cd7){return _0x4e4cd7?{'count':_0x2e464a,'rows':_0x4e4cd7}:null;}})[_0x8405('0x26')](respondWithResult(_0x1487e7,null))[_0x8405('0x44')](handleError(_0x1487e7,null));};exports[_0x8405('0x51')]=function(_0x351165,_0x31e4c0,_0x18bdd7){var _0x173821={};var _0x156634={};var _0xbd82d4;var _0x5d1920;return db[_0x8405('0x2d')][_0x8405('0x4b')]({'where':{'id':_0x351165[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x31e4c0,null))['then'](function(_0x31c546){if(_0x31c546){_0xbd82d4=_0x31c546;_0x156634[_0x8405('0x32')]=_['keys'](db[_0x8405('0x4f')][_0x8405('0x2e')]);_0x156634[_0x8405('0x33')]=_[_0x8405('0x47')](_0x351165[_0x8405('0x33')]);_0x156634[_0x8405('0x34')]=_['intersection'](_0x156634[_0x8405('0x32')],_0x156634[_0x8405('0x33')]);_0x173821[_0x8405('0x36')]=_[_0x8405('0x35')](_0x156634[_0x8405('0x32')],qs[_0x8405('0x37')](_0x351165[_0x8405('0x33')]['fields']));_0x173821[_0x8405('0x36')]=_0x173821['attributes'][_0x8405('0x38')]?_0x173821[_0x8405('0x36')]:_0x156634[_0x8405('0x32')];_0x173821[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x351165['query'][_0x8405('0x3a')]);_0x173821[_0x8405('0x3b')]=qs[_0x8405('0x34')](_['pick'](_0x351165['query'],_0x156634['filters']));if(_0x351165[_0x8405('0x33')]['filter']){_0x173821[_0x8405('0x3b')]=_['merge'](_0x173821[_0x8405('0x3b')],{'$or':_['map'](_0x173821['attributes'],function(_0x389d93){var _0x239fcf={};_0x239fcf[_0x389d93]={'$like':'%'+_0x351165[_0x8405('0x33')][_0x8405('0x3d')]+'%'};return _0x239fcf;})});}_0x173821=_[_0x8405('0x3f')]({},_0x173821,_0x351165[_0x8405('0x40')]);return _0xbd82d4[_0x8405('0x51')](_0x173821);}})[_0x8405('0x26')](function(_0x1551d2){if(_0x1551d2){_0x5d1920=_0x1551d2[_0x8405('0x38')];if(!_0x351165[_0x8405('0x33')][_0x8405('0x4e')](_0x8405('0x39'))){_0x173821[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x351165['query'][_0x8405('0x1e')]);_0x173821[_0x8405('0x1c')]=qs['offset'](_0x351165[_0x8405('0x33')][_0x8405('0x1c')]);}return _0xbd82d4[_0x8405('0x51')](_0x173821);}})[_0x8405('0x26')](function(_0x4c9d2a){if(_0x4c9d2a){return _0x4c9d2a?{'count':_0x5d1920,'rows':_0x4c9d2a}:null;}})[_0x8405('0x26')](respondWithResult(_0x31e4c0,null))[_0x8405('0x44')](handleError(_0x31e4c0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d8d58c0..011a3dd 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 _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0xcf14b3,_0x4de965){var _0xdb96c6=function(_0xf36d20){while(--_0xf36d20){_0xcf14b3['push'](_0xcf14b3['shift']());}};_0xdb96c6(++_0x4de965);}(_0xbec5,0xe5));var _0x5bec=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xbec5[_0x1f27df];return _0x286ee2;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x393c55,_0x43b06c){var _0x4085fc=function(_0x541e20){while(--_0x541e20){_0x393c55['push'](_0x393c55['shift']());}};_0x4085fc(++_0x43b06c);}(_0x70e0,0x17b));var _0x070e=function(_0x3e8255,_0x2c1651){_0x3e8255=_0x3e8255-0x0;var _0x3c2c68=_0x70e0[_0x3e8255];return _0x3c2c68;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'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 263f7a5..adde0c0 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 _0x36f5=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x4101e5,_0x90fc22){var _0x3b3a6c=function(_0x27cfd2){while(--_0x27cfd2){_0x4101e5['push'](_0x4101e5['shift']());}};_0x3b3a6c(++_0x90fc22);}(_0x36f5,0x1bc));var _0x536f=function(_0x1ebc2f,_0x2dc74b){_0x1ebc2f=_0x1ebc2f-0x0;var _0x2e8b1b=_0x36f5[_0x1ebc2f];return _0x2e8b1b;};'use strict';var _=require(_0x536f('0x0'));var util=require('util');var moment=require(_0x536f('0x1'));var BPromise=require(_0x536f('0x2'));var rs=require(_0x536f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x536f('0x4'));var logger=require(_0x536f('0x5'))(_0x536f('0x6'));var config=require(_0x536f('0x7'));var jayson=require(_0x536f('0x8'));var client=jayson[_0x536f('0x9')][_0x536f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e4482,_0x5cfb1f,_0x510631){return new BPromise(function(_0x12590c,_0x5e4c38){return client[_0x536f('0xb')](_0x5e4482,_0x510631)[_0x536f('0xc')](function(_0x56f0cd){logger[_0x536f('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5cfb1f,_0x536f('0xe'));logger[_0x536f('0xf')](_0x536f('0x10'),_0x5cfb1f,'request\x20sent',JSON[_0x536f('0x11')](_0x56f0cd));if(_0x56f0cd[_0x536f('0x12')]){if(_0x56f0cd[_0x536f('0x12')][_0x536f('0x13')]===0x1f4){logger[_0x536f('0x12')](_0x536f('0x14'),_0x5cfb1f,_0x56f0cd[_0x536f('0x12')][_0x536f('0x15')]);return _0x5e4c38(_0x56f0cd[_0x536f('0x12')][_0x536f('0x15')]);}logger['error'](_0x536f('0x14'),_0x5cfb1f,_0x56f0cd[_0x536f('0x12')][_0x536f('0x15')]);return _0x12590c(_0x56f0cd[_0x536f('0x12')][_0x536f('0x15')]);}else{logger[_0x536f('0xd')](_0x536f('0x14'),_0x5cfb1f,_0x536f('0xe'));_0x12590c(_0x56f0cd['result']['message']);}})[_0x536f('0x16')](function(_0x574524){logger[_0x536f('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5cfb1f,_0x574524);_0x5e4c38(_0x574524);});});} \ No newline at end of file +var _0xdf84=['Dynamics365Configuration,\x20%s,\x20%s','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x36e4cd,_0x4fe25d){var _0x2a6b3a=function(_0x2c7d5a){while(--_0x2c7d5a){_0x36e4cd['push'](_0x36e4cd['shift']());}};_0x2a6b3a(++_0x4fe25d);}(_0xdf84,0xbf));var _0x4df8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xdf84[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x4df8('0x0'));var moment=require(_0x4df8('0x1'));var BPromise=require(_0x4df8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4df8('0x3'));var db=require(_0x4df8('0x4'))['db'];var utils=require(_0x4df8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4df8('0x6'));var jayson=require(_0x4df8('0x7'));var client=jayson[_0x4df8('0x8')][_0x4df8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x73d269,_0x4011c5,_0x2fea8f){return new BPromise(function(_0x45031a,_0x36f850){return client[_0x4df8('0xa')](_0x73d269,_0x2fea8f)[_0x4df8('0xb')](function(_0x576cbf){logger[_0x4df8('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4011c5,_0x4df8('0xd'));logger[_0x4df8('0xe')](_0x4df8('0xf'),_0x4011c5,'request\x20sent',JSON[_0x4df8('0x10')](_0x576cbf));if(_0x576cbf[_0x4df8('0x11')]){if(_0x576cbf['error']['code']===0x1f4){logger[_0x4df8('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4011c5,_0x576cbf[_0x4df8('0x11')][_0x4df8('0x12')]);return _0x36f850(_0x576cbf['error']['message']);}logger['error'](_0x4df8('0x13'),_0x4011c5,_0x576cbf[_0x4df8('0x11')][_0x4df8('0x12')]);return _0x45031a(_0x576cbf['error']['message']);}else{logger[_0x4df8('0xc')](_0x4df8('0x13'),_0x4011c5,_0x4df8('0xd'));_0x45031a(_0x576cbf[_0x4df8('0x14')][_0x4df8('0x12')]);}})['catch'](function(_0x42fd7a){logger[_0x4df8('0x11')](_0x4df8('0x13'),_0x4011c5,_0x42fd7a);_0x36f850(_0x42fd7a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index dcc13d1..05e5248 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 _0xcf97=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xcf97,0x1e8));var _0x7cf9=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xcf97[_0x544099];return _0x20ab09;};'use strict';var multer=require(_0x7cf9('0x0'));var util=require(_0x7cf9('0x1'));var path=require('path');var timeout=require(_0x7cf9('0x2'));var express=require(_0x7cf9('0x3'));var router=express[_0x7cf9('0x4')]();var fs_extra=require(_0x7cf9('0x5'));var auth=require(_0x7cf9('0x6'));var interaction=require(_0x7cf9('0x7'));var config=require(_0x7cf9('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x7cf9('0x9')]('/',auth[_0x7cf9('0xa')](),controller[_0x7cf9('0xb')]);router[_0x7cf9('0x9')](_0x7cf9('0xc'),auth[_0x7cf9('0xa')](),controller['show']);router[_0x7cf9('0xd')]('/',auth[_0x7cf9('0xa')](),controller[_0x7cf9('0xe')]);router[_0x7cf9('0xf')](_0x7cf9('0xc'),auth[_0x7cf9('0xa')](),controller['update']);router[_0x7cf9('0x10')](_0x7cf9('0xc'),auth[_0x7cf9('0xa')](),controller[_0x7cf9('0x11')]);module[_0x7cf9('0x12')]=router; \ No newline at end of file +var _0x5b4f=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post'];(function(_0x1cbecb,_0x505e33){var _0x4112c4=function(_0x1d1d36){while(--_0x1d1d36){_0x1cbecb['push'](_0x1cbecb['shift']());}};_0x4112c4(++_0x505e33);}(_0x5b4f,0x1be));var _0xf5b4=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x5b4f[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xf5b4('0x0'));var util=require(_0xf5b4('0x1'));var path=require('path');var timeout=require(_0xf5b4('0x2'));var express=require(_0xf5b4('0x3'));var router=express[_0xf5b4('0x4')]();var fs_extra=require(_0xf5b4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5b4('0x6'));var config=require(_0xf5b4('0x7'));var controller=require(_0xf5b4('0x8'));router[_0xf5b4('0x9')]('/',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0xb')]);router[_0xf5b4('0x9')]('/:id',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0xc')]);router[_0xf5b4('0xd')]('/',auth[_0xf5b4('0xa')](),controller['create']);router[_0xf5b4('0xe')](_0xf5b4('0xf'),auth[_0xf5b4('0xa')](),controller[_0xf5b4('0x10')]);router[_0xf5b4('0x11')]('/:id',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0x12')]);module[_0xf5b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ecbc229..87d058f 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 _0x768f=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x768f,0xcd));var _0xf768=function(_0x16eba8,_0x2834d2){_0x16eba8=_0x16eba8-0x0;var _0xf9b344=_0x768f[_0x16eba8];return _0xf9b344;};'use strict';var Sequelize=require(_0xf768('0x0'));module['exports']={'type':{'type':Sequelize[_0xf768('0x1')](_0xf768('0x2'),_0xf768('0x3'),_0xf768('0x4'),_0xf768('0x5'),_0xf768('0x6')),'defaultValue':_0xf768('0x2')},'content':{'type':Sequelize[_0xf768('0x7')]},'key':{'type':Sequelize[_0xf768('0x7')]},'keyType':{'type':Sequelize[_0xf768('0x1')](_0xf768('0x2'),'variable',_0xf768('0x4'))},'keyContent':{'type':Sequelize[_0xf768('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf768('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf768('0x7')]}}; \ No newline at end of file +var _0xaa21=['picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x3431d3,_0x12f839){var _0x64b334=function(_0x36ed77){while(--_0x36ed77){_0x3431d3['push'](_0x3431d3['shift']());}};_0x64b334(++_0x12f839);}(_0xaa21,0x144));var _0x1aa2=function(_0x305664,_0x1574f8){_0x305664=_0x305664-0x0;var _0x5cfec2=_0xaa21[_0x305664];return _0x5cfec2;};'use strict';var Sequelize=require('sequelize');module[_0x1aa2('0x0')]={'type':{'type':Sequelize[_0x1aa2('0x1')](_0x1aa2('0x2'),_0x1aa2('0x3'),_0x1aa2('0x4'),'keyValue',_0x1aa2('0x5')),'defaultValue':_0x1aa2('0x2')},'content':{'type':Sequelize[_0x1aa2('0x6')]},'key':{'type':Sequelize[_0x1aa2('0x6')]},'keyType':{'type':Sequelize[_0x1aa2('0x1')](_0x1aa2('0x2'),_0x1aa2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1aa2('0x6')]},'idField':{'type':Sequelize[_0x1aa2('0x6')]},'nameField':{'type':Sequelize[_0x1aa2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9e55641..87a7d43 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 _0xcd04=['status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','index','map','Dynamics365Field','rawAttributes','keys','filters','intersection','model','query','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','include','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus'];(function(_0x1779db,_0x45aeaf){var _0x1d80cf=function(_0x5efe35){while(--_0x5efe35){_0x1779db['push'](_0x1779db['shift']());}};_0x1d80cf(++_0x45aeaf);}(_0xcd04,0x127));var _0x4cd0=function(_0x25e05f,_0x1fa961){_0x25e05f=_0x25e05f-0x0;var _0x3cc91d=_0xcd04[_0x25e05f];return _0x3cc91d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4cd0('0x0'));var zipdir=require(_0x4cd0('0x1'));var jsonpatch=require(_0x4cd0('0x2'));var rp=require(_0x4cd0('0x3'));var moment=require(_0x4cd0('0x4'));var BPromise=require(_0x4cd0('0x5'));var Mustache=require('mustache');var util=require(_0x4cd0('0x6'));var path=require('path');var sox=require(_0x4cd0('0x7'));var csv=require(_0x4cd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cd0('0x9'));var _=require(_0x4cd0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4cd0('0xb'));var deskjs=require(_0x4cd0('0xc'));var toCsv=require(_0x4cd0('0x8'));var querystring=require('querystring');var Papa=require(_0x4cd0('0xd'));var Redis=require('ioredis');var authService=require(_0x4cd0('0xe'));var qs=require(_0x4cd0('0xf'));var as=require(_0x4cd0('0x10'));var hardwareService=require(_0x4cd0('0x11'));var logger=require(_0x4cd0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34ee41,_0x45e7dd){_0x45e7dd=_0x45e7dd||0xcc;return function(_0x1d6c35){if(_0x1d6c35){return _0x34ee41[_0x4cd0('0x13')](_0x45e7dd);}return _0x34ee41[_0x4cd0('0x14')](_0x45e7dd)[_0x4cd0('0x15')]();};}function respondWithResult(_0x29bab3,_0x2d86a7){_0x2d86a7=_0x2d86a7||0xc8;return function(_0x32ba2f){if(_0x32ba2f){return _0x29bab3[_0x4cd0('0x14')](_0x2d86a7)[_0x4cd0('0x16')](_0x32ba2f);}};}function respondWithFilteredResult(_0x7865b8,_0x4b6ab8){return function(_0x1e2b83){if(_0x1e2b83){var _0x473807=typeof _0x4b6ab8[_0x4cd0('0x17')]==='undefined'&&typeof _0x4b6ab8[_0x4cd0('0x18')]==='undefined';var _0x33de2d=_0x1e2b83[_0x4cd0('0x19')];var _0x337de9=_0x473807?0x0:_0x4b6ab8[_0x4cd0('0x17')];var _0x9ebf47=_0x473807?_0x1e2b83[_0x4cd0('0x19')]:_0x4b6ab8[_0x4cd0('0x17')]+_0x4b6ab8[_0x4cd0('0x18')];var _0x52f435;if(_0x9ebf47>=_0x33de2d){_0x9ebf47=_0x33de2d;_0x52f435=0xc8;}else{_0x52f435=0xce;}_0x7865b8[_0x4cd0('0x14')](_0x52f435);return _0x7865b8[_0x4cd0('0x1a')](_0x4cd0('0x1b'),_0x337de9+'-'+_0x9ebf47+'/'+_0x33de2d)[_0x4cd0('0x16')](_0x1e2b83);}return null;};}function patchUpdates(_0x53f9a2){return function(_0x348fa0){try{jsonpatch[_0x4cd0('0x1c')](_0x348fa0,_0x53f9a2,!![]);}catch(_0x321947){return BPromise[_0x4cd0('0x1d')](_0x321947);}return _0x348fa0['save']();};}function saveUpdates(_0x18fd08,_0x2b9965){return function(_0x4afd81){if(_0x4afd81){return _0x4afd81[_0x4cd0('0x1e')](_0x18fd08)['then'](function(_0x5af1a4){return _0x5af1a4;});}return null;};}function removeEntity(_0x3f546a,_0x242c01){return function(_0x12c1ca){if(_0x12c1ca){return _0x12c1ca[_0x4cd0('0x1f')]()[_0x4cd0('0x20')](function(){_0x3f546a[_0x4cd0('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c667,_0x561788){return function(_0x2dc2b9){if(!_0x2dc2b9){_0x34c667['sendStatus'](0x194);}return _0x2dc2b9;};}function handleError(_0x29fc72,_0x419401){_0x419401=_0x419401||0x1f4;return function(_0x166306){logger['error'](_0x166306[_0x4cd0('0x21')]);if(_0x166306['name']){delete _0x166306[_0x4cd0('0x22')];}_0x29fc72['status'](_0x419401)['send'](_0x166306);};}exports[_0x4cd0('0x23')]=function(_0x554d12,_0x3b18a0){var _0x56484f={},_0x139025={},_0x1df77f={'count':0x0,'rows':[]};var _0x23704b=_[_0x4cd0('0x24')](db[_0x4cd0('0x25')][_0x4cd0('0x26')],function(_0x11efc4){return{'name':_0x11efc4['fieldName'],'type':_0x11efc4['type']['key']};});_0x139025['model']=_[_0x4cd0('0x24')](_0x23704b,_0x4cd0('0x22'));_0x139025['query']=_[_0x4cd0('0x27')](_0x554d12['query']);_0x139025[_0x4cd0('0x28')]=_[_0x4cd0('0x29')](_0x139025[_0x4cd0('0x2a')],_0x139025[_0x4cd0('0x2b')]);_0x56484f['attributes']=_['intersection'](_0x139025[_0x4cd0('0x2a')],qs[_0x4cd0('0x2c')](_0x554d12[_0x4cd0('0x2b')][_0x4cd0('0x2c')]));_0x56484f[_0x4cd0('0x2d')]=_0x56484f[_0x4cd0('0x2d')][_0x4cd0('0x2e')]?_0x56484f[_0x4cd0('0x2d')]:_0x139025[_0x4cd0('0x2a')];if(!_0x554d12[_0x4cd0('0x2b')]['hasOwnProperty'](_0x4cd0('0x2f'))){_0x56484f[_0x4cd0('0x18')]=qs[_0x4cd0('0x18')](_0x554d12['query'][_0x4cd0('0x18')]);_0x56484f[_0x4cd0('0x17')]=qs[_0x4cd0('0x17')](_0x554d12[_0x4cd0('0x2b')][_0x4cd0('0x17')]);}_0x56484f['order']=qs[_0x4cd0('0x30')](_0x554d12['query'][_0x4cd0('0x30')]);_0x56484f[_0x4cd0('0x31')]=qs['filters'](_[_0x4cd0('0x32')](_0x554d12['query'],_0x139025['filters']),_0x23704b);if(_0x554d12['query'][_0x4cd0('0x33')]){_0x56484f[_0x4cd0('0x31')]=_[_0x4cd0('0x34')](_0x56484f['where'],{'$or':_[_0x4cd0('0x24')](_0x23704b,function(_0x376bd2){if(_0x376bd2['type']!=='VIRTUAL'){var _0x299f55={};_0x299f55[_0x376bd2[_0x4cd0('0x22')]]={'$like':'%'+_0x554d12[_0x4cd0('0x2b')]['filter']+'%'};return _0x299f55;}})});}_0x56484f=_[_0x4cd0('0x34')]({},_0x56484f,_0x554d12['options']);var _0x40de8f={'where':_0x56484f[_0x4cd0('0x31')]};return db[_0x4cd0('0x25')]['count'](_0x40de8f)['then'](function(_0x5c5e7e){_0x1df77f['count']=_0x5c5e7e;if(_0x554d12['query'][_0x4cd0('0x35')]){_0x56484f['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x56484f);})[_0x4cd0('0x20')](function(_0x1bb8f5){_0x1df77f[_0x4cd0('0x36')]=_0x1bb8f5;return _0x1df77f;})[_0x4cd0('0x20')](respondWithFilteredResult(_0x3b18a0,_0x56484f))[_0x4cd0('0x37')](handleError(_0x3b18a0,null));};exports[_0x4cd0('0x38')]=function(_0x5cc55f,_0x2b51f9){var _0x559aee={'raw':!![],'where':{'id':_0x5cc55f[_0x4cd0('0x39')]['id']}},_0xb841a3={};_0xb841a3[_0x4cd0('0x2a')]=_[_0x4cd0('0x27')](db[_0x4cd0('0x25')]['rawAttributes']);_0xb841a3[_0x4cd0('0x2b')]=_['keys'](_0x5cc55f[_0x4cd0('0x2b')]);_0xb841a3[_0x4cd0('0x28')]=_[_0x4cd0('0x29')](_0xb841a3[_0x4cd0('0x2a')],_0xb841a3[_0x4cd0('0x2b')]);_0x559aee[_0x4cd0('0x2d')]=_[_0x4cd0('0x29')](_0xb841a3[_0x4cd0('0x2a')],qs[_0x4cd0('0x2c')](_0x5cc55f[_0x4cd0('0x2b')]['fields']));_0x559aee[_0x4cd0('0x2d')]=_0x559aee[_0x4cd0('0x2d')][_0x4cd0('0x2e')]?_0x559aee[_0x4cd0('0x2d')]:_0xb841a3['model'];if(_0x5cc55f[_0x4cd0('0x2b')][_0x4cd0('0x35')]){_0x559aee[_0x4cd0('0x3a')]=[{'all':!![]}];}_0x559aee=_['merge']({},_0x559aee,_0x5cc55f[_0x4cd0('0x3b')]);return db[_0x4cd0('0x25')]['find'](_0x559aee)['then'](handleEntityNotFound(_0x2b51f9,null))[_0x4cd0('0x20')](respondWithResult(_0x2b51f9,null))[_0x4cd0('0x37')](handleError(_0x2b51f9,null));};exports[_0x4cd0('0x3c')]=function(_0x37c9ea,_0x2989f7){return db[_0x4cd0('0x25')][_0x4cd0('0x3c')](_0x37c9ea[_0x4cd0('0x3d')],{})[_0x4cd0('0x20')](respondWithResult(_0x2989f7,0xc9))[_0x4cd0('0x37')](handleError(_0x2989f7,null));};exports[_0x4cd0('0x1e')]=function(_0x2e7b72,_0x51239c){if(_0x2e7b72['body']['id']){delete _0x2e7b72[_0x4cd0('0x3d')]['id'];}return db['Dynamics365Field'][_0x4cd0('0x3e')]({'where':{'id':_0x2e7b72['params']['id']}})['then'](handleEntityNotFound(_0x51239c,null))[_0x4cd0('0x20')](saveUpdates(_0x2e7b72['body'],null))[_0x4cd0('0x20')](respondWithResult(_0x51239c,null))[_0x4cd0('0x37')](handleError(_0x51239c,null));};exports[_0x4cd0('0x1f')]=function(_0xe4e214,_0x5afada){return db[_0x4cd0('0x25')][_0x4cd0('0x3e')]({'where':{'id':_0xe4e214[_0x4cd0('0x39')]['id']}})['then'](handleEntityNotFound(_0x5afada,null))[_0x4cd0('0x20')](removeEntity(_0x5afada,null))[_0x4cd0('0x37')](handleError(_0x5afada,null));}; \ No newline at end of file +var _0x879a=['catch','show','params','includeAll','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','status','Content-Range','apply','reject','then','end','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','merge','options','Dynamics365Field','count','include','findAll'];(function(_0x2eb6e2,_0x972e4e){var _0xfcd369=function(_0x5ab95f){while(--_0x5ab95f){_0x2eb6e2['push'](_0x2eb6e2['shift']());}};_0xfcd369(++_0x972e4e);}(_0x879a,0x1dd));var _0xa879=function(_0x325bc4,_0x375b9a){_0x325bc4=_0x325bc4-0x0;var _0x4946ef=_0x879a[_0x325bc4];return _0x4946ef;};'use strict';var emlformat=require(_0xa879('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa879('0x1'));var jsonpatch=require(_0xa879('0x2'));var rp=require(_0xa879('0x3'));var moment=require(_0xa879('0x4'));var BPromise=require(_0xa879('0x5'));var Mustache=require(_0xa879('0x6'));var util=require(_0xa879('0x7'));var path=require(_0xa879('0x8'));var sox=require(_0xa879('0x9'));var csv=require(_0xa879('0xa'));var ejs=require(_0xa879('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa879('0xc'));var squel=require(_0xa879('0xd'));var crypto=require(_0xa879('0xe'));var jsforce=require(_0xa879('0xf'));var deskjs=require(_0xa879('0x10'));var toCsv=require(_0xa879('0xa'));var querystring=require(_0xa879('0x11'));var Papa=require(_0xa879('0x12'));var Redis=require(_0xa879('0x13'));var authService=require(_0xa879('0x14'));var qs=require(_0xa879('0x15'));var as=require(_0xa879('0x16'));var hardwareService=require(_0xa879('0x17'));var logger=require(_0xa879('0x18'))('api');var utils=require(_0xa879('0x19'));var config=require(_0xa879('0x1a'));var licenseUtil=require(_0xa879('0x1b'));var db=require(_0xa879('0x1c'))['db'];function respondWithStatusCode(_0x19703f,_0x2ce803){_0x2ce803=_0x2ce803||0xcc;return function(_0x315819){if(_0x315819){return _0x19703f[_0xa879('0x1d')](_0x2ce803);}return _0x19703f['status'](_0x2ce803)['end']();};}function respondWithResult(_0x2959d1,_0xeaa008){_0xeaa008=_0xeaa008||0xc8;return function(_0x9b76a0){if(_0x9b76a0){return _0x2959d1['status'](_0xeaa008)[_0xa879('0x1e')](_0x9b76a0);}};}function respondWithFilteredResult(_0x538bfb,_0x2f2437){return function(_0x4fe4c9){if(_0x4fe4c9){var _0x9cd45f=typeof _0x2f2437[_0xa879('0x1f')]==='undefined'&&typeof _0x2f2437[_0xa879('0x20')]===_0xa879('0x21');var _0x2f0bbc=_0x4fe4c9['count'];var _0x4b7e69=_0x9cd45f?0x0:_0x2f2437[_0xa879('0x1f')];var _0x5369db=_0x9cd45f?_0x4fe4c9['count']:_0x2f2437[_0xa879('0x1f')]+_0x2f2437[_0xa879('0x20')];var _0x511904;if(_0x5369db>=_0x2f0bbc){_0x5369db=_0x2f0bbc;_0x511904=0xc8;}else{_0x511904=0xce;}_0x538bfb[_0xa879('0x22')](_0x511904);return _0x538bfb['set'](_0xa879('0x23'),_0x4b7e69+'-'+_0x5369db+'/'+_0x2f0bbc)[_0xa879('0x1e')](_0x4fe4c9);}return null;};}function patchUpdates(_0x512e13){return function(_0x31e97a){try{jsonpatch[_0xa879('0x24')](_0x31e97a,_0x512e13,!![]);}catch(_0x36df39){return BPromise[_0xa879('0x25')](_0x36df39);}return _0x31e97a['save']();};}function saveUpdates(_0x48b176,_0x580592){return function(_0x3bbc1a){if(_0x3bbc1a){return _0x3bbc1a['update'](_0x48b176)[_0xa879('0x26')](function(_0x3f5976){return _0x3f5976;});}return null;};}function removeEntity(_0x1124c0,_0x39dd51){return function(_0x232aed){if(_0x232aed){return _0x232aed['destroy']()[_0xa879('0x26')](function(){_0x1124c0[_0xa879('0x22')](0xcc)[_0xa879('0x27')]();});}};}function handleEntityNotFound(_0x4900d2,_0x5d6521){return function(_0x13d96e){if(!_0x13d96e){_0x4900d2[_0xa879('0x1d')](0x194);}return _0x13d96e;};}function handleError(_0x34774d,_0x1da652){_0x1da652=_0x1da652||0x1f4;return function(_0x36107f){logger[_0xa879('0x28')](_0x36107f[_0xa879('0x29')]);if(_0x36107f[_0xa879('0x2a')]){delete _0x36107f['name'];}_0x34774d['status'](_0x1da652)[_0xa879('0x2b')](_0x36107f);};}exports[_0xa879('0x2c')]=function(_0x233e35,_0x41f7f6){var _0x198676={},_0x367571={},_0x30ea8d={'count':0x0,'rows':[]};var _0x5bf658=_['map'](db['Dynamics365Field'][_0xa879('0x2d')],function(_0x3dcfd7){return{'name':_0x3dcfd7[_0xa879('0x2e')],'type':_0x3dcfd7['type']['key']};});_0x367571[_0xa879('0x2f')]=_[_0xa879('0x30')](_0x5bf658,'name');_0x367571[_0xa879('0x31')]=_[_0xa879('0x32')](_0x233e35[_0xa879('0x31')]);_0x367571['filters']=_[_0xa879('0x33')](_0x367571[_0xa879('0x2f')],_0x367571['query']);_0x198676[_0xa879('0x34')]=_[_0xa879('0x33')](_0x367571[_0xa879('0x2f')],qs[_0xa879('0x35')](_0x233e35[_0xa879('0x31')][_0xa879('0x35')]));_0x198676[_0xa879('0x34')]=_0x198676[_0xa879('0x34')][_0xa879('0x36')]?_0x198676[_0xa879('0x34')]:_0x367571[_0xa879('0x2f')];if(!_0x233e35[_0xa879('0x31')][_0xa879('0x37')](_0xa879('0x38'))){_0x198676['limit']=qs[_0xa879('0x20')](_0x233e35[_0xa879('0x31')]['limit']);_0x198676[_0xa879('0x1f')]=qs[_0xa879('0x1f')](_0x233e35[_0xa879('0x31')][_0xa879('0x1f')]);}_0x198676[_0xa879('0x39')]=qs['sort'](_0x233e35[_0xa879('0x31')][_0xa879('0x3a')]);_0x198676['where']=qs[_0xa879('0x3b')](_['pick'](_0x233e35[_0xa879('0x31')],_0x367571['filters']),_0x5bf658);if(_0x233e35[_0xa879('0x31')][_0xa879('0x3c')]){_0x198676[_0xa879('0x3d')]=_['merge'](_0x198676['where'],{'$or':_[_0xa879('0x30')](_0x5bf658,function(_0x31704a){if(_0x31704a[_0xa879('0x3e')]!=='VIRTUAL'){var _0x472fe1={};_0x472fe1[_0x31704a[_0xa879('0x2a')]]={'$like':'%'+_0x233e35['query'][_0xa879('0x3c')]+'%'};return _0x472fe1;}})});}_0x198676=_[_0xa879('0x3f')]({},_0x198676,_0x233e35[_0xa879('0x40')]);var _0x5208bd={'where':_0x198676[_0xa879('0x3d')]};return db[_0xa879('0x41')]['count'](_0x5208bd)[_0xa879('0x26')](function(_0x1f97ff){_0x30ea8d[_0xa879('0x42')]=_0x1f97ff;if(_0x233e35[_0xa879('0x31')]['includeAll']){_0x198676[_0xa879('0x43')]=[{'all':!![]}];}return db[_0xa879('0x41')][_0xa879('0x44')](_0x198676);})[_0xa879('0x26')](function(_0x29900d){_0x30ea8d['rows']=_0x29900d;return _0x30ea8d;})['then'](respondWithFilteredResult(_0x41f7f6,_0x198676))[_0xa879('0x45')](handleError(_0x41f7f6,null));};exports[_0xa879('0x46')]=function(_0x37ee3e,_0x397e6d){var _0xaa45b7={'raw':!![],'where':{'id':_0x37ee3e[_0xa879('0x47')]['id']}},_0x3282b6={};_0x3282b6[_0xa879('0x2f')]=_[_0xa879('0x32')](db[_0xa879('0x41')][_0xa879('0x2d')]);_0x3282b6[_0xa879('0x31')]=_[_0xa879('0x32')](_0x37ee3e[_0xa879('0x31')]);_0x3282b6[_0xa879('0x3b')]=_[_0xa879('0x33')](_0x3282b6[_0xa879('0x2f')],_0x3282b6[_0xa879('0x31')]);_0xaa45b7['attributes']=_[_0xa879('0x33')](_0x3282b6[_0xa879('0x2f')],qs['fields'](_0x37ee3e[_0xa879('0x31')][_0xa879('0x35')]));_0xaa45b7[_0xa879('0x34')]=_0xaa45b7[_0xa879('0x34')][_0xa879('0x36')]?_0xaa45b7['attributes']:_0x3282b6[_0xa879('0x2f')];if(_0x37ee3e[_0xa879('0x31')][_0xa879('0x48')]){_0xaa45b7[_0xa879('0x43')]=[{'all':!![]}];}_0xaa45b7=_[_0xa879('0x3f')]({},_0xaa45b7,_0x37ee3e[_0xa879('0x40')]);return db['Dynamics365Field'][_0xa879('0x49')](_0xaa45b7)['then'](handleEntityNotFound(_0x397e6d,null))[_0xa879('0x26')](respondWithResult(_0x397e6d,null))[_0xa879('0x45')](handleError(_0x397e6d,null));};exports['create']=function(_0x1bb066,_0x40ac74){return db[_0xa879('0x41')][_0xa879('0x4a')](_0x1bb066['body'],{})[_0xa879('0x26')](respondWithResult(_0x40ac74,0xc9))[_0xa879('0x45')](handleError(_0x40ac74,null));};exports[_0xa879('0x4b')]=function(_0x2952ec,_0x168c5e){if(_0x2952ec['body']['id']){delete _0x2952ec['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x2952ec[_0xa879('0x47')]['id']}})[_0xa879('0x26')](handleEntityNotFound(_0x168c5e,null))[_0xa879('0x26')](saveUpdates(_0x2952ec[_0xa879('0x4c')],null))['then'](respondWithResult(_0x168c5e,null))[_0xa879('0x45')](handleError(_0x168c5e,null));};exports[_0xa879('0x4d')]=function(_0x4fcb54,_0x2842e6){return db[_0xa879('0x41')]['find']({'where':{'id':_0x4fcb54[_0xa879('0x47')]['id']}})[_0xa879('0x26')](handleEntityNotFound(_0x2842e6,null))[_0xa879('0x26')](removeEntity(_0x2842e6,null))[_0xa879('0x45')](handleError(_0x2842e6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d49cd28..ecf2480 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 _0xfde0=['bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','util','../../config/logger'];(function(_0x1e9773,_0xdb70d){var _0x1a7256=function(_0x101d7a){while(--_0x101d7a){_0x1e9773['push'](_0x1e9773['shift']());}};_0x1a7256(++_0xdb70d);}(_0xfde0,0xee));var _0x0fde=function(_0x54b591,_0x33a643){_0x54b591=_0x54b591-0x0;var _0x3b52b5=_0xfde0[_0x54b591];return _0x3b52b5;};'use strict';var _=require('lodash');var util=require(_0x0fde('0x0'));var logger=require(_0x0fde('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0fde('0x2'));var rp=require(_0x0fde('0x3'));var fs=require('fs');var path=require(_0x0fde('0x4'));var rimraf=require(_0x0fde('0x5'));var config=require('../../config/environment');var attributes=require(_0x0fde('0x6'));module[_0x0fde('0x7')]=function(_0x49c057,_0x571038){return _0x49c057[_0x0fde('0x8')](_0x0fde('0x9'),attributes,{'tableName':_0x0fde('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0fde('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8076=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util'];(function(_0x2646f6,_0x287adf){var _0x577237=function(_0x4d2d6f){while(--_0x4d2d6f){_0x2646f6['push'](_0x2646f6['shift']());}};_0x577237(++_0x287adf);}(_0x8076,0x14f));var _0x6807=function(_0x529208,_0x488ae5){_0x529208=_0x529208-0x0;var _0x3154f5=_0x8076[_0x529208];return _0x3154f5;};'use strict';var _=require('lodash');var util=require(_0x6807('0x0'));var logger=require('../../config/logger')(_0x6807('0x1'));var moment=require(_0x6807('0x2'));var BPromise=require(_0x6807('0x3'));var rp=require(_0x6807('0x4'));var fs=require('fs');var path=require(_0x6807('0x5'));var rimraf=require(_0x6807('0x6'));var config=require(_0x6807('0x7'));var attributes=require(_0x6807('0x8'));module[_0x6807('0x9')]=function(_0x235d91,_0x45e4d8){return _0x235d91[_0x6807('0xa')](_0x6807('0xb'),attributes,{'tableName':_0x6807('0xc'),'paranoid':![],'indexes':[{'name':_0x6807('0xd'),'fields':[_0x6807('0xe'),_0x6807('0xf')],'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 81dc35f..59115eb 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 _0x1a66=['request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x439df3,_0x44aeb7){var _0x302682=function(_0x2aa2de){while(--_0x2aa2de){_0x439df3['push'](_0x439df3['shift']());}};_0x302682(++_0x44aeb7);}(_0x1a66,0xc4));var _0x61a6=function(_0x130ccd,_0x3feed4){_0x130ccd=_0x130ccd-0x0;var _0x20ba25=_0x1a66[_0x130ccd];return _0x20ba25;};'use strict';var _=require(_0x61a6('0x0'));var util=require(_0x61a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61a6('0x2'));var fs=require('fs');var Redis=require(_0x61a6('0x3'));var db=require(_0x61a6('0x4'))['db'];var utils=require(_0x61a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x61a6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x61a6('0x7')][_0x61a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15d465,_0x28a7f3,_0x2aa820){return new BPromise(function(_0x1f621f,_0x526288){return client['request'](_0x15d465,_0x2aa820)[_0x61a6('0x9')](function(_0x2fd29d){logger[_0x61a6('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x28a7f3,'request\x20sent');logger[_0x61a6('0xb')](_0x61a6('0xc'),_0x28a7f3,_0x61a6('0xd'),JSON['stringify'](_0x2fd29d));if(_0x2fd29d[_0x61a6('0xe')]){if(_0x2fd29d[_0x61a6('0xe')][_0x61a6('0xf')]===0x1f4){logger['error'](_0x61a6('0x10'),_0x28a7f3,_0x2fd29d[_0x61a6('0xe')][_0x61a6('0x11')]);return _0x526288(_0x2fd29d['error'][_0x61a6('0x11')]);}logger['error'](_0x61a6('0x10'),_0x28a7f3,_0x2fd29d[_0x61a6('0xe')][_0x61a6('0x11')]);return _0x1f621f(_0x2fd29d['error'][_0x61a6('0x11')]);}else{logger['info'](_0x61a6('0x10'),_0x28a7f3,_0x61a6('0xd'));_0x1f621f(_0x2fd29d[_0x61a6('0x12')]['message']);}})['catch'](function(_0x445fe9){logger[_0x61a6('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x28a7f3,_0x445fe9);_0x526288(_0x445fe9);});});} \ No newline at end of file +var _0x699b=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x11bd8c,_0x51e776){var _0x5e5ff0=function(_0x2ed276){while(--_0x2ed276){_0x11bd8c['push'](_0x11bd8c['shift']());}};_0x5e5ff0(++_0x51e776);}(_0x699b,0x81));var _0xb699=function(_0x4e5577,_0x5d3979){_0x4e5577=_0x4e5577-0x0;var _0x24fbf2=_0x699b[_0x4e5577];return _0x24fbf2;};'use strict';var _=require(_0xb699('0x0'));var util=require(_0xb699('0x1'));var moment=require(_0xb699('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb699('0x3'))['db'];var utils=require(_0xb699('0x4'));var logger=require(_0xb699('0x5'))(_0xb699('0x6'));var config=require(_0xb699('0x7'));var jayson=require(_0xb699('0x8'));var client=jayson['client'][_0xb699('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41370d,_0x3b5884,_0x1ebe0c){return new BPromise(function(_0x4334c3,_0x1fe6cc){return client[_0xb699('0xa')](_0x41370d,_0x1ebe0c)[_0xb699('0xb')](function(_0x4ba75f){logger[_0xb699('0xc')](_0xb699('0xd'),_0x3b5884,_0xb699('0xe'));logger['debug'](_0xb699('0xf'),_0x3b5884,'request\x20sent',JSON['stringify'](_0x4ba75f));if(_0x4ba75f[_0xb699('0x10')]){if(_0x4ba75f[_0xb699('0x10')][_0xb699('0x11')]===0x1f4){logger['error'](_0xb699('0xd'),_0x3b5884,_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);return _0x1fe6cc(_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);}logger[_0xb699('0x10')](_0xb699('0xd'),_0x3b5884,_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);return _0x4334c3(_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);}else{logger[_0xb699('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x3b5884,'request\x20sent');_0x4334c3(_0x4ba75f[_0xb699('0x13')][_0xb699('0x12')]);}})[_0xb699('0x14')](function(_0x2be0a5){logger[_0xb699('0x10')](_0xb699('0xd'),_0x3b5884,_0x2be0a5);_0x1fe6cc(_0x2be0a5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ec0eb16..110cf1c 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 _0x7784=['index','get','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated'];(function(_0x3c4191,_0x18ed16){var _0x5d9986=function(_0x5dca1a){while(--_0x5dca1a){_0x3c4191['push'](_0x3c4191['shift']());}};_0x5d9986(++_0x18ed16);}(_0x7784,0x15f));var _0x4778=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7784[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x4778('0x0'));var path=require('path');var timeout=require(_0x4778('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4778('0x2'));var interaction=require(_0x4778('0x3'));var config=require('../../config/environment');var controller=require(_0x4778('0x4'));router['get']('/',auth[_0x4778('0x5')](),controller[_0x4778('0x6')]);router[_0x4778('0x7')](_0x4778('0x8'),auth[_0x4778('0x5')](),controller['show']);router[_0x4778('0x7')](_0x4778('0x9'),auth[_0x4778('0x5')](),controller['getConfigurations']);router[_0x4778('0x7')](_0x4778('0xa'),auth[_0x4778('0x5')](),controller[_0x4778('0xb')]);router[_0x4778('0xc')]('/',auth[_0x4778('0x5')](),controller['create']);router[_0x4778('0xc')](_0x4778('0x9'),auth[_0x4778('0x5')](),controller[_0x4778('0xd')]);router['put'](_0x4778('0x8'),auth[_0x4778('0x5')](),controller[_0x4778('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4778('0xf')]);module[_0x4778('0x10')]=router; \ No newline at end of file +var _0x9088=['getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2225ca,_0x121e86){var _0x1577a7=function(_0x6a79c3){while(--_0x6a79c3){_0x2225ca['push'](_0x2225ca['shift']());}};_0x1577a7(++_0x121e86);}(_0x9088,0x140));var _0x8908=function(_0x461ea7,_0x1ec19b){_0x461ea7=_0x461ea7-0x0;var _0x56cf81=_0x9088[_0x461ea7];return _0x56cf81;};'use strict';var multer=require(_0x8908('0x0'));var util=require(_0x8908('0x1'));var path=require(_0x8908('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8908('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8908('0x4'));var interaction=require(_0x8908('0x5'));var config=require(_0x8908('0x6'));var controller=require(_0x8908('0x7'));router['get']('/',auth[_0x8908('0x8')](),controller[_0x8908('0x9')]);router[_0x8908('0xa')](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0xc')]);router[_0x8908('0xa')](_0x8908('0xd'),auth[_0x8908('0x8')](),controller[_0x8908('0xe')]);router[_0x8908('0xa')](_0x8908('0xf'),auth['isAuthenticated'](),controller[_0x8908('0x10')]);router[_0x8908('0x11')]('/',auth['isAuthenticated'](),controller[_0x8908('0x12')]);router[_0x8908('0x11')](_0x8908('0xd'),auth[_0x8908('0x8')](),controller[_0x8908('0x13')]);router[_0x8908('0x14')](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0x15')]);router['delete'](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0x16')]);module[_0x8908('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5bb2985..e8ff6cd 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 _0x5f2f=['exports','STRING','username','sequelize'];(function(_0xba4233,_0x524921){var _0x6a06da=function(_0x5cb6d7){while(--_0x5cb6d7){_0xba4233['push'](_0xba4233['shift']());}};_0x6a06da(++_0x524921);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2308cb,_0x191ab2){_0x2308cb=_0x2308cb-0x0;var _0x103a2f=_0x5f2f[_0x2308cb];return _0x103a2f;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'apiKey':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0xf3b41,_0xa93b1f){var _0xbb9010=function(_0x5d3a48){while(--_0x5d3a48){_0xf3b41['push'](_0xf3b41['shift']());}};_0xbb9010(++_0xa93b1f);}(_0x7096,0x10c));var _0x6709=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7096[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2b79a8f..98de8c8 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 _0x1752=['name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','FreshdeskAccount','findAll','rows','catch','params','includeAll','include','create','body','find','getConfigurations','FreshdeskConfiguration','limit','addConfiguration','AccountId','Subjects','channel','FreshdeskField','findOne','apiKey','remoteUri','slice','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','agent','description','priority','group','ticket_type','remove','includes','custom_text','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','count','set','save','update','then','destroy','error','stack'];(function(_0x56f9a3,_0x105d93){var _0x1e5e50=function(_0xcbf530){while(--_0xcbf530){_0x56f9a3['push'](_0x56f9a3['shift']());}};_0x1e5e50(++_0x105d93);}(_0x1752,0xa5));var _0x2175=function(_0x598138,_0x2a3abd){_0x598138=_0x598138-0x0;var _0x5d72be=_0x1752[_0x598138];return _0x5d72be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43be3c,_0x393c02){_0x393c02=_0x393c02||0xcc;return function(_0x49522e){if(_0x49522e){return _0x43be3c[_0x2175('0x16')](_0x393c02);}return _0x43be3c[_0x2175('0x17')](_0x393c02)[_0x2175('0x18')]();};}function respondWithResult(_0x3bc01f,_0x21d4cd){_0x21d4cd=_0x21d4cd||0xc8;return function(_0xab5db9){if(_0xab5db9){return _0x3bc01f[_0x2175('0x17')](_0x21d4cd)[_0x2175('0x19')](_0xab5db9);}};}function respondWithFilteredResult(_0x5d84db,_0x55b798){return function(_0x371b42){if(_0x371b42){var _0x22cd42=typeof _0x55b798[_0x2175('0x1a')]==='undefined'&&typeof _0x55b798['limit']==='undefined';var _0x366e37=_0x371b42[_0x2175('0x1b')];var _0x4cb089=_0x22cd42?0x0:_0x55b798['offset'];var _0x405fb1=_0x22cd42?_0x371b42[_0x2175('0x1b')]:_0x55b798[_0x2175('0x1a')]+_0x55b798['limit'];var _0x10be1b;if(_0x405fb1>=_0x366e37){_0x405fb1=_0x366e37;_0x10be1b=0xc8;}else{_0x10be1b=0xce;}_0x5d84db['status'](_0x10be1b);return _0x5d84db[_0x2175('0x1c')]('Content-Range',_0x4cb089+'-'+_0x405fb1+'/'+_0x366e37)[_0x2175('0x19')](_0x371b42);}return null;};}function patchUpdates(_0x4ec36c){return function(_0x5366e3){try{jsonpatch['apply'](_0x5366e3,_0x4ec36c,!![]);}catch(_0x278851){return BPromise['reject'](_0x278851);}return _0x5366e3[_0x2175('0x1d')]();};}function saveUpdates(_0x46ea57,_0x2dd77b){return function(_0x428166){if(_0x428166){return _0x428166[_0x2175('0x1e')](_0x46ea57)[_0x2175('0x1f')](function(_0x5ac63e){return _0x5ac63e;});}return null;};}function removeEntity(_0x49d4b9,_0x3d849e){return function(_0xa6ef48){if(_0xa6ef48){return _0xa6ef48[_0x2175('0x20')]()['then'](function(){_0x49d4b9['status'](0xcc)[_0x2175('0x18')]();});}};}function handleEntityNotFound(_0xe252f0,_0x2204cd){return function(_0x542273){if(!_0x542273){_0xe252f0[_0x2175('0x16')](0x194);}return _0x542273;};}function handleError(_0x4d2120,_0x5e696c){_0x5e696c=_0x5e696c||0x1f4;return function(_0x3f0230){logger[_0x2175('0x21')](_0x3f0230[_0x2175('0x22')]);if(_0x3f0230[_0x2175('0x23')]){delete _0x3f0230[_0x2175('0x23')];}_0x4d2120[_0x2175('0x17')](_0x5e696c)[_0x2175('0x24')](_0x3f0230);};}exports[_0x2175('0x25')]=function(_0x1b807b,_0x1c721d){var _0x7b6edb={},_0x56dcf9={},_0x20fccf={'count':0x0,'rows':[]};var _0x1e91a6=_['map'](db['FreshdeskAccount'][_0x2175('0x26')],function(_0x58eef9){return{'name':_0x58eef9[_0x2175('0x27')],'type':_0x58eef9['type']['key']};});_0x56dcf9['model']=_[_0x2175('0x28')](_0x1e91a6,_0x2175('0x23'));_0x56dcf9[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x1b807b['query']);_0x56dcf9[_0x2175('0x2b')]=_[_0x2175('0x2c')](_0x56dcf9['model'],_0x56dcf9[_0x2175('0x29')]);_0x7b6edb[_0x2175('0x2d')]=_['intersection'](_0x56dcf9['model'],qs['fields'](_0x1b807b['query'][_0x2175('0x2e')]));_0x7b6edb[_0x2175('0x2d')]=_0x7b6edb[_0x2175('0x2d')][_0x2175('0x2f')]?_0x7b6edb[_0x2175('0x2d')]:_0x56dcf9[_0x2175('0x30')];if(!_0x1b807b[_0x2175('0x29')][_0x2175('0x31')]('nolimit')){_0x7b6edb['limit']=qs['limit'](_0x1b807b['query']['limit']);_0x7b6edb[_0x2175('0x1a')]=qs[_0x2175('0x1a')](_0x1b807b['query'][_0x2175('0x1a')]);}_0x7b6edb[_0x2175('0x32')]=qs[_0x2175('0x33')](_0x1b807b[_0x2175('0x29')][_0x2175('0x33')]);_0x7b6edb[_0x2175('0x34')]=qs['filters'](_[_0x2175('0x35')](_0x1b807b[_0x2175('0x29')],_0x56dcf9[_0x2175('0x2b')]),_0x1e91a6);if(_0x1b807b[_0x2175('0x29')][_0x2175('0x36')]){_0x7b6edb[_0x2175('0x34')]=_[_0x2175('0x37')](_0x7b6edb[_0x2175('0x34')],{'$or':_[_0x2175('0x28')](_0x1e91a6,function(_0x4367c9){if(_0x4367c9[_0x2175('0x38')]!=='VIRTUAL'){var _0x398015={};_0x398015[_0x4367c9[_0x2175('0x23')]]={'$like':'%'+_0x1b807b[_0x2175('0x29')]['filter']+'%'};return _0x398015;}})});}_0x7b6edb=_['merge']({},_0x7b6edb,_0x1b807b[_0x2175('0x39')]);var _0x55314c={'where':_0x7b6edb[_0x2175('0x34')]};return db[_0x2175('0x3a')][_0x2175('0x1b')](_0x55314c)['then'](function(_0x547421){_0x20fccf[_0x2175('0x1b')]=_0x547421;if(_0x1b807b[_0x2175('0x29')]['includeAll']){_0x7b6edb['include']=[{'all':!![]}];}return db[_0x2175('0x3a')][_0x2175('0x3b')](_0x7b6edb);})[_0x2175('0x1f')](function(_0x54eacf){_0x20fccf[_0x2175('0x3c')]=_0x54eacf;return _0x20fccf;})[_0x2175('0x1f')](respondWithFilteredResult(_0x1c721d,_0x7b6edb))[_0x2175('0x3d')](handleError(_0x1c721d,null));};exports['show']=function(_0x49cf7d,_0x459cee){var _0x47f60d={'raw':![],'where':{'id':_0x49cf7d[_0x2175('0x3e')]['id']}},_0x161444={};_0x161444['model']=_['keys'](db['FreshdeskAccount'][_0x2175('0x26')]);_0x161444['query']=_['keys'](_0x49cf7d[_0x2175('0x29')]);_0x161444['filters']=_[_0x2175('0x2c')](_0x161444[_0x2175('0x30')],_0x161444[_0x2175('0x29')]);_0x47f60d[_0x2175('0x2d')]=_[_0x2175('0x2c')](_0x161444[_0x2175('0x30')],qs['fields'](_0x49cf7d[_0x2175('0x29')][_0x2175('0x2e')]));_0x47f60d[_0x2175('0x2d')]=_0x47f60d[_0x2175('0x2d')][_0x2175('0x2f')]?_0x47f60d[_0x2175('0x2d')]:_0x161444['model'];if(_0x49cf7d[_0x2175('0x29')][_0x2175('0x3f')]){_0x47f60d[_0x2175('0x40')]=[{'all':!![]}];}_0x47f60d=_['merge']({},_0x47f60d,_0x49cf7d[_0x2175('0x39')]);return db['FreshdeskAccount']['find'](_0x47f60d)[_0x2175('0x1f')](handleEntityNotFound(_0x459cee,null))[_0x2175('0x1f')](respondWithResult(_0x459cee,null))[_0x2175('0x3d')](handleError(_0x459cee,null));};exports['create']=function(_0x32d6eb,_0x195c40){return db[_0x2175('0x3a')][_0x2175('0x41')](_0x32d6eb[_0x2175('0x42')],{})['then'](respondWithResult(_0x195c40,0xc9))['catch'](handleError(_0x195c40,null));};exports[_0x2175('0x1e')]=function(_0xeaabe3,_0x18c6ba){if(_0xeaabe3[_0x2175('0x42')]['id']){delete _0xeaabe3[_0x2175('0x42')]['id'];}return db['FreshdeskAccount'][_0x2175('0x43')]({'where':{'id':_0xeaabe3[_0x2175('0x3e')]['id']}})[_0x2175('0x1f')](handleEntityNotFound(_0x18c6ba,null))['then'](saveUpdates(_0xeaabe3['body'],null))[_0x2175('0x1f')](respondWithResult(_0x18c6ba,null))['catch'](handleError(_0x18c6ba,null));};exports['destroy']=function(_0x5bab81,_0x4dfe47){return db[_0x2175('0x3a')][_0x2175('0x43')]({'where':{'id':_0x5bab81['params']['id']}})['then'](handleEntityNotFound(_0x4dfe47,null))['then'](removeEntity(_0x4dfe47,null))['catch'](handleError(_0x4dfe47,null));};exports[_0x2175('0x44')]=function(_0x7c2c1f,_0x5d18c2,_0x5834b9){var _0x247b10={};var _0x17705c={};var _0x1be925;var _0xce807c;return db[_0x2175('0x3a')]['findOne']({'where':{'id':_0x7c2c1f[_0x2175('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d18c2,null))[_0x2175('0x1f')](function(_0x2dbed8){if(_0x2dbed8){_0x1be925=_0x2dbed8;_0x17705c[_0x2175('0x30')]=_[_0x2175('0x2a')](db[_0x2175('0x45')][_0x2175('0x26')]);_0x17705c[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x7c2c1f[_0x2175('0x29')]);_0x17705c[_0x2175('0x2b')]=_[_0x2175('0x2c')](_0x17705c[_0x2175('0x30')],_0x17705c[_0x2175('0x29')]);_0x247b10[_0x2175('0x2d')]=_[_0x2175('0x2c')](_0x17705c['model'],qs[_0x2175('0x2e')](_0x7c2c1f[_0x2175('0x29')][_0x2175('0x2e')]));_0x247b10[_0x2175('0x2d')]=_0x247b10['attributes'][_0x2175('0x2f')]?_0x247b10['attributes']:_0x17705c[_0x2175('0x30')];_0x247b10[_0x2175('0x32')]=qs[_0x2175('0x33')](_0x7c2c1f[_0x2175('0x29')][_0x2175('0x33')]);_0x247b10[_0x2175('0x34')]=qs[_0x2175('0x2b')](_[_0x2175('0x35')](_0x7c2c1f['query'],_0x17705c['filters']));if(_0x7c2c1f[_0x2175('0x29')][_0x2175('0x36')]){_0x247b10['where']=_['merge'](_0x247b10[_0x2175('0x34')],{'$or':_[_0x2175('0x28')](_0x247b10[_0x2175('0x2d')],function(_0x139778){var _0x480132={};_0x480132[_0x139778]={'$like':'%'+_0x7c2c1f[_0x2175('0x29')]['filter']+'%'};return _0x480132;})});}_0x247b10=_[_0x2175('0x37')]({},_0x247b10,_0x7c2c1f[_0x2175('0x39')]);return _0x1be925['getConfigurations'](_0x247b10);}})[_0x2175('0x1f')](function(_0x3dafea){if(_0x3dafea){_0xce807c=_0x3dafea[_0x2175('0x2f')];if(!_0x7c2c1f[_0x2175('0x29')][_0x2175('0x31')]('nolimit')){_0x247b10[_0x2175('0x46')]=qs[_0x2175('0x46')](_0x7c2c1f['query'][_0x2175('0x46')]);_0x247b10['offset']=qs[_0x2175('0x1a')](_0x7c2c1f['query'][_0x2175('0x1a')]);}return _0x1be925[_0x2175('0x44')](_0x247b10);}})[_0x2175('0x1f')](function(_0x2ba72f){if(_0x2ba72f){return _0x2ba72f?{'count':_0xce807c,'rows':_0x2ba72f}:null;}})[_0x2175('0x1f')](respondWithResult(_0x5d18c2,null))['catch'](handleError(_0x5d18c2,null));};exports[_0x2175('0x47')]=function(_0x367b5e,_0xf3b8ec,_0x4bdcd4){if(_0x367b5e[_0x2175('0x42')]['id']){delete _0x367b5e[_0x2175('0x42')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x367b5e[_0x2175('0x3e')]['id']}})[_0x2175('0x1f')](handleEntityNotFound(_0xf3b8ec,null))[_0x2175('0x1f')](function(_0x311235){if(_0x311235){_0x367b5e[_0x2175('0x42')][_0x2175('0x48')]=_0x311235['id'];_0x367b5e[_0x2175('0x42')][_0x2175('0x49')]=integrations['getSubjects'](_0x367b5e[_0x2175('0x42')][_0x2175('0x4a')],_0x367b5e[_0x2175('0x42')]['type']);_0x367b5e[_0x2175('0x42')]['Descriptions']=integrations['getDescriptions'](_0x367b5e[_0x2175('0x42')][_0x2175('0x4a')],_0x367b5e[_0x2175('0x42')][_0x2175('0x38')]);return db[_0x2175('0x45')][_0x2175('0x41')](_0x367b5e[_0x2175('0x42')],{'include':[{'model':db[_0x2175('0x4b')],'as':_0x2175('0x49')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x2175('0x1f')](respondWithResult(_0xf3b8ec,null))[_0x2175('0x3d')](handleError(_0xf3b8ec,null));};exports['getFields']=function(_0x1e0759,_0x13babb,_0x154964){var _0x542d8f='';return db['FreshdeskAccount'][_0x2175('0x4c')]({'where':{'id':_0x1e0759['params']['id']},'attributes':['id','remoteUri',_0x2175('0x4d')]})[_0x2175('0x1f')](handleEntityNotFound(_0x13babb,null))['then'](function(_0x572bea){if(_0x572bea){_0x542d8f=_0x572bea[_0x2175('0x4e')];var _0x26bf6d=_0x542d8f[_0x2175('0x4f')](-0x1);if(_0x26bf6d==='/'){_0x542d8f=_0x542d8f['substring'](0x0,_0x542d8f['lastIndexOf'](_0x26bf6d));}return rp({'method':'GET','uri':util[_0x2175('0x50')]('%s/%s',_0x542d8f,_0x2175('0x51')),'headers':{'Authorization':util['format'](_0x2175('0x52'),new Buffer(util['format']('%s:X',_0x572bea[_0x2175('0x4d')]))[_0x2175('0x53')](_0x2175('0x54')))},'json':!![]});}})['then'](function(_0x45ef25){if(_0x45ef25){var _0x5c228b=['requester','subject',_0x2175('0x55'),_0x2175('0x56'),'status',_0x2175('0x57'),_0x2175('0x58'),'source',_0x2175('0x59'),_0x2175('0x58'),'company'];_[_0x2175('0x5a')](_0x45ef25,function(_0x4fabdb){return _0x5c228b[_0x2175('0x5b')](_0x4fabdb[_0x2175('0x23')])||!_0x4fabdb['default']&&_0x4fabdb[_0x2175('0x38')]!==_0x2175('0x5c')&&_0x4fabdb[_0x2175('0x38')]!=='custom_dropdown';});return{'count':_0x45ef25[_0x2175('0x2f')],'rows':_[_0x2175('0x28')](_0x45ef25,function(_0x5119c6){return{'id':_0x5119c6['name'],'name':_0x5119c6['label'],'custom':!_0x5119c6[_0x2175('0x5d')],'options':_0x5119c6[_0x2175('0x5e')]?_[_0x2175('0x28')](_0x5119c6[_0x2175('0x5e')],function(_0x5de120){return{'name':_[_0x2175('0x5f')](_0x5de120),'value':_0x5de120};}):[]};})};}})[_0x2175('0x1f')](respondWithResult(_0x13babb,null))[_0x2175('0x3d')](function(_0x1c0f96){var _0x4550ab=_0x1e0759[_0x2175('0x29')]['test']?0x1f4:_0x1c0f96['statusCode']||0x1f4;logger['error'](_0x2175('0x60'),'getFields',_0x4550ab,JSON[_0x2175('0x61')](_0x1c0f96));delete _0x1c0f96[_0x2175('0x23')];if(_0x4550ab===0x191){_0x4550ab=0x190;}_0x13babb[_0x2175('0x17')](_0x4550ab)[_0x2175('0x24')](_0x1e0759['query'][_0x2175('0x62')]?{'message':_0x2175('0x63'),'statusCode':_0x1c0f96['statusCode']}:_0x1c0f96);});}; \ No newline at end of file +var _0xfc61=['default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','agent','description','priority','group','ticket_type','company','remove','custom_text','custom_dropdown'];(function(_0x2ec1c5,_0x120c94){var _0x4cd1de=function(_0x203af5){while(--_0x203af5){_0x2ec1c5['push'](_0x2ec1c5['shift']());}};_0x4cd1de(++_0x120c94);}(_0xfc61,0x78));var _0x1fc6=function(_0x49a15d,_0x48aedb){_0x49a15d=_0x49a15d-0x0;var _0x52f73e=_0xfc61[_0x49a15d];return _0x52f73e;};'use strict';var emlformat=require(_0x1fc6('0x0'));var rimraf=require(_0x1fc6('0x1'));var zipdir=require(_0x1fc6('0x2'));var jsonpatch=require(_0x1fc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fc6('0x4'));var util=require(_0x1fc6('0x5'));var path=require(_0x1fc6('0x6'));var sox=require(_0x1fc6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fc6('0x8'));var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc6('0x13'))(_0x1fc6('0x14'));var utils=require(_0x1fc6('0x15'));var config=require(_0x1fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1fc6('0x17'));function respondWithStatusCode(_0x475b16,_0xa08740){_0xa08740=_0xa08740||0xcc;return function(_0x5e694d){if(_0x5e694d){return _0x475b16['sendStatus'](_0xa08740);}return _0x475b16[_0x1fc6('0x18')](_0xa08740)['end']();};}function respondWithResult(_0x2833ef,_0x35ecb5){_0x35ecb5=_0x35ecb5||0xc8;return function(_0x2e43f1){if(_0x2e43f1){return _0x2833ef[_0x1fc6('0x18')](_0x35ecb5)[_0x1fc6('0x19')](_0x2e43f1);}};}function respondWithFilteredResult(_0x624be2,_0x324fa7){return function(_0x141d3e){if(_0x141d3e){var _0x578045=typeof _0x324fa7[_0x1fc6('0x1a')]===_0x1fc6('0x1b')&&typeof _0x324fa7[_0x1fc6('0x1c')]===_0x1fc6('0x1b');var _0x3a144b=_0x141d3e[_0x1fc6('0x1d')];var _0x3e9406=_0x578045?0x0:_0x324fa7['offset'];var _0x3e2996=_0x578045?_0x141d3e[_0x1fc6('0x1d')]:_0x324fa7[_0x1fc6('0x1a')]+_0x324fa7[_0x1fc6('0x1c')];var _0xbd94b;if(_0x3e2996>=_0x3a144b){_0x3e2996=_0x3a144b;_0xbd94b=0xc8;}else{_0xbd94b=0xce;}_0x624be2[_0x1fc6('0x18')](_0xbd94b);return _0x624be2[_0x1fc6('0x1e')]('Content-Range',_0x3e9406+'-'+_0x3e2996+'/'+_0x3a144b)['json'](_0x141d3e);}return null;};}function patchUpdates(_0x53b17d){return function(_0x37742e){try{jsonpatch[_0x1fc6('0x1f')](_0x37742e,_0x53b17d,!![]);}catch(_0x514766){return BPromise[_0x1fc6('0x20')](_0x514766);}return _0x37742e[_0x1fc6('0x21')]();};}function saveUpdates(_0x2d0fe0,_0x38a792){return function(_0xbd5b8){if(_0xbd5b8){return _0xbd5b8[_0x1fc6('0x22')](_0x2d0fe0)[_0x1fc6('0x23')](function(_0x3fc788){return _0x3fc788;});}return null;};}function removeEntity(_0x891eba,_0xc6965f){return function(_0x2465a4){if(_0x2465a4){return _0x2465a4[_0x1fc6('0x24')]()[_0x1fc6('0x23')](function(){_0x891eba['status'](0xcc)[_0x1fc6('0x25')]();});}};}function handleEntityNotFound(_0x46d93a,_0x202506){return function(_0x2e326f){if(!_0x2e326f){_0x46d93a[_0x1fc6('0x26')](0x194);}return _0x2e326f;};}function handleError(_0xac242c,_0x42bd0d){_0x42bd0d=_0x42bd0d||0x1f4;return function(_0x3cb114){logger[_0x1fc6('0x27')](_0x3cb114[_0x1fc6('0x28')]);if(_0x3cb114[_0x1fc6('0x29')]){delete _0x3cb114[_0x1fc6('0x29')];}_0xac242c[_0x1fc6('0x18')](_0x42bd0d)[_0x1fc6('0x2a')](_0x3cb114);};}exports['index']=function(_0x287c3e,_0x2996db){var _0xbce313={},_0x4a48bc={},_0x2f75e2={'count':0x0,'rows':[]};var _0x402b01=_[_0x1fc6('0x2b')](db[_0x1fc6('0x2c')][_0x1fc6('0x2d')],function(_0x41886c){return{'name':_0x41886c[_0x1fc6('0x2e')],'type':_0x41886c[_0x1fc6('0x2f')]['key']};});_0x4a48bc[_0x1fc6('0x30')]=_[_0x1fc6('0x2b')](_0x402b01,_0x1fc6('0x29'));_0x4a48bc[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x287c3e[_0x1fc6('0x31')]);_0x4a48bc[_0x1fc6('0x33')]=_['intersection'](_0x4a48bc[_0x1fc6('0x30')],_0x4a48bc[_0x1fc6('0x31')]);_0xbce313[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x4a48bc[_0x1fc6('0x30')],qs['fields'](_0x287c3e['query'][_0x1fc6('0x36')]));_0xbce313[_0x1fc6('0x34')]=_0xbce313[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0xbce313['attributes']:_0x4a48bc[_0x1fc6('0x30')];if(!_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x38')](_0x1fc6('0x39'))){_0xbce313[_0x1fc6('0x1c')]=qs['limit'](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x1c')]);_0xbce313[_0x1fc6('0x1a')]=qs[_0x1fc6('0x1a')](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x1a')]);}_0xbce313[_0x1fc6('0x3a')]=qs[_0x1fc6('0x3b')](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3b')]);_0xbce313[_0x1fc6('0x3c')]=qs[_0x1fc6('0x33')](_[_0x1fc6('0x3d')](_0x287c3e[_0x1fc6('0x31')],_0x4a48bc[_0x1fc6('0x33')]),_0x402b01);if(_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3e')]){_0xbce313[_0x1fc6('0x3c')]=_[_0x1fc6('0x3f')](_0xbce313['where'],{'$or':_[_0x1fc6('0x2b')](_0x402b01,function(_0x388b15){if(_0x388b15[_0x1fc6('0x2f')]!==_0x1fc6('0x40')){var _0x54976c={};_0x54976c[_0x388b15[_0x1fc6('0x29')]]={'$like':'%'+_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3e')]+'%'};return _0x54976c;}})});}_0xbce313=_[_0x1fc6('0x3f')]({},_0xbce313,_0x287c3e[_0x1fc6('0x41')]);var _0x1f6d6a={'where':_0xbce313['where']};return db[_0x1fc6('0x2c')]['count'](_0x1f6d6a)[_0x1fc6('0x23')](function(_0x1f495d){_0x2f75e2[_0x1fc6('0x1d')]=_0x1f495d;if(_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x42')]){_0xbce313['include']=[{'all':!![]}];}return db[_0x1fc6('0x2c')][_0x1fc6('0x43')](_0xbce313);})[_0x1fc6('0x23')](function(_0x3c20e1){_0x2f75e2[_0x1fc6('0x44')]=_0x3c20e1;return _0x2f75e2;})['then'](respondWithFilteredResult(_0x2996db,_0xbce313))[_0x1fc6('0x45')](handleError(_0x2996db,null));};exports[_0x1fc6('0x46')]=function(_0x1f9108,_0x2896e2){var _0x49f335={'raw':![],'where':{'id':_0x1f9108[_0x1fc6('0x47')]['id']}},_0x3e1dbc={};_0x3e1dbc[_0x1fc6('0x30')]=_[_0x1fc6('0x32')](db[_0x1fc6('0x2c')][_0x1fc6('0x2d')]);_0x3e1dbc[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x1f9108[_0x1fc6('0x31')]);_0x3e1dbc[_0x1fc6('0x33')]=_[_0x1fc6('0x35')](_0x3e1dbc['model'],_0x3e1dbc[_0x1fc6('0x31')]);_0x49f335[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x3e1dbc[_0x1fc6('0x30')],qs['fields'](_0x1f9108['query'][_0x1fc6('0x36')]));_0x49f335[_0x1fc6('0x34')]=_0x49f335[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0x49f335['attributes']:_0x3e1dbc['model'];if(_0x1f9108[_0x1fc6('0x31')]['includeAll']){_0x49f335[_0x1fc6('0x48')]=[{'all':!![]}];}_0x49f335=_[_0x1fc6('0x3f')]({},_0x49f335,_0x1f9108['options']);return db[_0x1fc6('0x2c')][_0x1fc6('0x49')](_0x49f335)['then'](handleEntityNotFound(_0x2896e2,null))['then'](respondWithResult(_0x2896e2,null))[_0x1fc6('0x45')](handleError(_0x2896e2,null));};exports['create']=function(_0x5f2e3f,_0x36200e){return db[_0x1fc6('0x2c')][_0x1fc6('0x4a')](_0x5f2e3f[_0x1fc6('0x4b')],{})['then'](respondWithResult(_0x36200e,0xc9))[_0x1fc6('0x45')](handleError(_0x36200e,null));};exports[_0x1fc6('0x22')]=function(_0x48062c,_0x5b59ab){if(_0x48062c[_0x1fc6('0x4b')]['id']){delete _0x48062c['body']['id'];}return db[_0x1fc6('0x2c')][_0x1fc6('0x49')]({'where':{'id':_0x48062c['params']['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5b59ab,null))[_0x1fc6('0x23')](saveUpdates(_0x48062c[_0x1fc6('0x4b')],null))[_0x1fc6('0x23')](respondWithResult(_0x5b59ab,null))['catch'](handleError(_0x5b59ab,null));};exports[_0x1fc6('0x24')]=function(_0x57d863,_0x7a66ba){return db['FreshdeskAccount'][_0x1fc6('0x49')]({'where':{'id':_0x57d863[_0x1fc6('0x47')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x7a66ba,null))['then'](removeEntity(_0x7a66ba,null))[_0x1fc6('0x45')](handleError(_0x7a66ba,null));};exports[_0x1fc6('0x4c')]=function(_0x28f94d,_0x592361,_0x136885){var _0x4a0876={};var _0xe1c5c6={};var _0x59d5e2;var _0x5790a9;return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x28f94d['params']['id']}})['then'](handleEntityNotFound(_0x592361,null))['then'](function(_0x2f203c){if(_0x2f203c){_0x59d5e2=_0x2f203c;_0xe1c5c6[_0x1fc6('0x30')]=_[_0x1fc6('0x32')](db[_0x1fc6('0x4e')][_0x1fc6('0x2d')]);_0xe1c5c6[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x28f94d[_0x1fc6('0x31')]);_0xe1c5c6[_0x1fc6('0x33')]=_[_0x1fc6('0x35')](_0xe1c5c6[_0x1fc6('0x30')],_0xe1c5c6['query']);_0x4a0876[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0xe1c5c6[_0x1fc6('0x30')],qs[_0x1fc6('0x36')](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x36')]));_0x4a0876[_0x1fc6('0x34')]=_0x4a0876[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0x4a0876[_0x1fc6('0x34')]:_0xe1c5c6[_0x1fc6('0x30')];_0x4a0876[_0x1fc6('0x3a')]=qs['sort'](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3b')]);_0x4a0876[_0x1fc6('0x3c')]=qs[_0x1fc6('0x33')](_['pick'](_0x28f94d[_0x1fc6('0x31')],_0xe1c5c6[_0x1fc6('0x33')]));if(_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3e')]){_0x4a0876[_0x1fc6('0x3c')]=_[_0x1fc6('0x3f')](_0x4a0876['where'],{'$or':_[_0x1fc6('0x2b')](_0x4a0876['attributes'],function(_0x21f125){var _0x1d00fc={};_0x1d00fc[_0x21f125]={'$like':'%'+_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3e')]+'%'};return _0x1d00fc;})});}_0x4a0876=_[_0x1fc6('0x3f')]({},_0x4a0876,_0x28f94d[_0x1fc6('0x41')]);return _0x59d5e2['getConfigurations'](_0x4a0876);}})[_0x1fc6('0x23')](function(_0x706f1f){if(_0x706f1f){_0x5790a9=_0x706f1f[_0x1fc6('0x37')];if(!_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x38')](_0x1fc6('0x39'))){_0x4a0876[_0x1fc6('0x1c')]=qs[_0x1fc6('0x1c')](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x1c')]);_0x4a0876[_0x1fc6('0x1a')]=qs[_0x1fc6('0x1a')](_0x28f94d['query'][_0x1fc6('0x1a')]);}return _0x59d5e2[_0x1fc6('0x4c')](_0x4a0876);}})[_0x1fc6('0x23')](function(_0x1c34ef){if(_0x1c34ef){return _0x1c34ef?{'count':_0x5790a9,'rows':_0x1c34ef}:null;}})['then'](respondWithResult(_0x592361,null))[_0x1fc6('0x45')](handleError(_0x592361,null));};exports[_0x1fc6('0x4f')]=function(_0x107708,_0x204b1c,_0xdf53f6){if(_0x107708[_0x1fc6('0x4b')]['id']){delete _0x107708[_0x1fc6('0x4b')]['id'];}return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x107708[_0x1fc6('0x47')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x204b1c,null))[_0x1fc6('0x23')](function(_0x52d8b0){if(_0x52d8b0){_0x107708['body'][_0x1fc6('0x50')]=_0x52d8b0['id'];_0x107708[_0x1fc6('0x4b')]['Subjects']=integrations[_0x1fc6('0x51')](_0x107708['body'][_0x1fc6('0x52')],_0x107708[_0x1fc6('0x4b')]['type']);_0x107708[_0x1fc6('0x4b')][_0x1fc6('0x53')]=integrations[_0x1fc6('0x54')](_0x107708[_0x1fc6('0x4b')]['channel'],_0x107708[_0x1fc6('0x4b')]['type']);return db[_0x1fc6('0x4e')][_0x1fc6('0x4a')](_0x107708['body'],{'include':[{'model':db[_0x1fc6('0x55')],'as':'Subjects'},{'model':db[_0x1fc6('0x55')],'as':'Descriptions'}]});}return null;})[_0x1fc6('0x23')](respondWithResult(_0x204b1c,null))[_0x1fc6('0x45')](handleError(_0x204b1c,null));};exports[_0x1fc6('0x56')]=function(_0x1abb38,_0x1f3675,_0x1163c9){var _0x157810='';return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x1abb38[_0x1fc6('0x47')]['id']},'attributes':['id','remoteUri',_0x1fc6('0x57')]})[_0x1fc6('0x23')](handleEntityNotFound(_0x1f3675,null))[_0x1fc6('0x23')](function(_0x136950){if(_0x136950){_0x157810=_0x136950['remoteUri'];var _0x4235ac=_0x157810[_0x1fc6('0x58')](-0x1);if(_0x4235ac==='/'){_0x157810=_0x157810[_0x1fc6('0x59')](0x0,_0x157810['lastIndexOf'](_0x4235ac));}return rp({'method':_0x1fc6('0x5a'),'uri':util[_0x1fc6('0x5b')](_0x1fc6('0x5c'),_0x157810,_0x1fc6('0x5d')),'headers':{'Authorization':util[_0x1fc6('0x5b')]('Basic\x20%s',new Buffer(util[_0x1fc6('0x5b')](_0x1fc6('0x5e'),_0x136950[_0x1fc6('0x57')]))[_0x1fc6('0x5f')](_0x1fc6('0x60')))},'json':!![]});}})[_0x1fc6('0x23')](function(_0x269e7d){if(_0x269e7d){var _0x44769d=['requester','subject',_0x1fc6('0x61'),_0x1fc6('0x62'),'status',_0x1fc6('0x63'),_0x1fc6('0x64'),'source',_0x1fc6('0x65'),_0x1fc6('0x64'),_0x1fc6('0x66')];_[_0x1fc6('0x67')](_0x269e7d,function(_0x224ba2){return _0x44769d['includes'](_0x224ba2[_0x1fc6('0x29')])||!_0x224ba2['default']&&_0x224ba2[_0x1fc6('0x2f')]!==_0x1fc6('0x68')&&_0x224ba2['type']!==_0x1fc6('0x69');});return{'count':_0x269e7d['length'],'rows':_[_0x1fc6('0x2b')](_0x269e7d,function(_0x260b75){return{'id':_0x260b75[_0x1fc6('0x29')],'name':_0x260b75['label'],'custom':!_0x260b75[_0x1fc6('0x6a')],'options':_0x260b75['choices']?_[_0x1fc6('0x2b')](_0x260b75[_0x1fc6('0x6b')],function(_0x582b16){return{'name':_[_0x1fc6('0x6c')](_0x582b16),'value':_0x582b16};}):[]};})};}})[_0x1fc6('0x23')](respondWithResult(_0x1f3675,null))[_0x1fc6('0x45')](function(_0x5044b4){var _0x5c44dd=_0x1abb38[_0x1fc6('0x31')][_0x1fc6('0x6d')]?0x1f4:_0x5044b4[_0x1fc6('0x6e')]||0x1f4;logger[_0x1fc6('0x27')](_0x1fc6('0x6f'),_0x1fc6('0x56'),_0x5c44dd,JSON[_0x1fc6('0x70')](_0x5044b4));delete _0x5044b4[_0x1fc6('0x29')];if(_0x5c44dd===0x191){_0x5c44dd=0x190;}_0x1f3675[_0x1fc6('0x18')](_0x5c44dd)['send'](_0x1abb38[_0x1fc6('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5044b4[_0x1fc6('0x6e')]}:_0x5044b4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d14ffa2..c943616 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 _0x6c58=['path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','request-promise'];(function(_0x531426,_0x5046ec){var _0x50e3a4=function(_0x2df794){while(--_0x2df794){_0x531426['push'](_0x531426['shift']());}};_0x50e3a4(++_0x5046ec);}(_0x6c58,0x133));var _0x86c5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6c58[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x86c5('0x0'));var util=require(_0x86c5('0x1'));var logger=require(_0x86c5('0x2'))(_0x86c5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86c5('0x4'));var fs=require('fs');var path=require(_0x86c5('0x5'));var rimraf=require('rimraf');var config=require(_0x86c5('0x6'));var attributes=require(_0x86c5('0x7'));var integrations=require(_0x86c5('0x8'));module[_0x86c5('0x9')]=function(_0x1cf780,_0x3aba94){return _0x1cf780[_0x86c5('0xa')](_0x86c5('0xb'),attributes,{'tableName':_0x86c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad89=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xad89,0xbd));var _0x9ad8=function(_0x1406c8,_0x40a801){_0x1406c8=_0x1406c8-0x0;var _0x3ec6f8=_0xad89[_0x1406c8];return _0x3ec6f8;};'use strict';var _=require('lodash');var util=require(_0x9ad8('0x0'));var logger=require(_0x9ad8('0x1'))(_0x9ad8('0x2'));var moment=require(_0x9ad8('0x3'));var BPromise=require(_0x9ad8('0x4'));var rp=require(_0x9ad8('0x5'));var fs=require('fs');var path=require(_0x9ad8('0x6'));var rimraf=require(_0x9ad8('0x7'));var config=require(_0x9ad8('0x8'));var attributes=require(_0x9ad8('0x9'));var integrations=require(_0x9ad8('0xa'));module['exports']=function(_0x122e4a,_0x49def4){return _0x122e4a['define'](_0x9ad8('0xb'),attributes,{'tableName':_0x9ad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 7ad7576..f8fae26 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 _0xb2e1=['options','raw','attributes','include','model','map','then','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0xb2e1,0xd4));var _0x1b2e=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0xb2e1[_0x43f489];return _0x4134b4;};'use strict';var _=require(_0x1b2e('0x0'));var util=require(_0x1b2e('0x1'));var moment=require(_0x1b2e('0x2'));var BPromise=require(_0x1b2e('0x3'));var rs=require(_0x1b2e('0x4'));var fs=require('fs');var Redis=require(_0x1b2e('0x5'));var db=require(_0x1b2e('0x6'))['db'];var utils=require(_0x1b2e('0x7'));var logger=require('../../config/logger')(_0x1b2e('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b2e('0x9'));var client=jayson[_0x1b2e('0xa')][_0x1b2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x251bf2,_0x59850c,_0x839d60){return new BPromise(function(_0x47766a,_0x8e9b28){return client[_0x1b2e('0xc')](_0x251bf2,_0x839d60)['then'](function(_0x5aaa85){logger[_0x1b2e('0xd')](_0x1b2e('0xe'),_0x59850c,_0x1b2e('0xf'));logger[_0x1b2e('0x10')](_0x1b2e('0x11'),_0x59850c,_0x1b2e('0xf'),JSON[_0x1b2e('0x12')](_0x5aaa85));if(_0x5aaa85['error']){if(_0x5aaa85[_0x1b2e('0x13')][_0x1b2e('0x14')]===0x1f4){logger['error'](_0x1b2e('0xe'),_0x59850c,_0x5aaa85[_0x1b2e('0x13')][_0x1b2e('0x15')]);return _0x8e9b28(_0x5aaa85[_0x1b2e('0x13')][_0x1b2e('0x15')]);}logger[_0x1b2e('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x59850c,_0x5aaa85[_0x1b2e('0x13')][_0x1b2e('0x15')]);return _0x47766a(_0x5aaa85[_0x1b2e('0x13')][_0x1b2e('0x15')]);}else{logger[_0x1b2e('0xd')](_0x1b2e('0xe'),_0x59850c,_0x1b2e('0xf'));_0x47766a(_0x5aaa85['result'][_0x1b2e('0x15')]);}})[_0x1b2e('0x16')](function(_0x4cb7a3){logger[_0x1b2e('0x13')](_0x1b2e('0xe'),_0x59850c,_0x4cb7a3);_0x8e9b28(_0x4cb7a3);});});}exports[_0x1b2e('0x17')]=function(_0x45f762){var _0x462c29=this;return new Promise(function(_0x47faed,_0x9d038d){return db[_0x1b2e('0x18')][_0x1b2e('0x19')]({'raw':_0x45f762[_0x1b2e('0x1a')]?_0x45f762['options'][_0x1b2e('0x1b')]===undefined?!![]:![]:!![],'where':_0x45f762[_0x1b2e('0x1a')]?_0x45f762[_0x1b2e('0x1a')]['where']||null:null,'attributes':_0x45f762[_0x1b2e('0x1a')]?_0x45f762[_0x1b2e('0x1a')][_0x1b2e('0x1c')]||null:null,'limit':_0x45f762['options']?_0x45f762['options']['limit']||null:null,'include':_0x45f762[_0x1b2e('0x1a')]?_0x45f762[_0x1b2e('0x1a')][_0x1b2e('0x1d')]?_['map'](_0x45f762[_0x1b2e('0x1a')][_0x1b2e('0x1d')],function(_0x5b7377){return{'model':db[_0x5b7377[_0x1b2e('0x1e')]],'as':_0x5b7377['as'],'attributes':_0x5b7377['attributes'],'include':_0x5b7377['include']?_[_0x1b2e('0x1f')](_0x5b7377['include'],function(_0x590405){return{'model':db[_0x590405[_0x1b2e('0x1e')]],'as':_0x590405['as'],'attributes':_0x590405[_0x1b2e('0x1c')],'include':_0x590405['include']?_[_0x1b2e('0x1f')](_0x590405[_0x1b2e('0x1d')],function(_0x28e2df){return{'model':db[_0x28e2df['model']],'as':_0x28e2df['as'],'attributes':_0x28e2df[_0x1b2e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b2e('0x20')](function(_0x55fcc3){logger[_0x1b2e('0xd')](_0x1b2e('0x17'),_0x45f762);logger[_0x1b2e('0x10')]('GetFreshdeskAccount',_0x45f762,JSON[_0x1b2e('0x12')](_0x55fcc3));_0x47faed(_0x55fcc3);})[_0x1b2e('0x16')](function(_0x5df416){logger[_0x1b2e('0x13')]('GetFreshdeskAccount',_0x5df416[_0x1b2e('0x15')],_0x45f762);_0x9d038d(_0x462c29[_0x1b2e('0x13')](0x1f4,_0x5df416['message']));});});};exports['ShowFreshdeskAccount']=function(_0x535bc6){var _0x4e540a=this;return new Promise(function(_0x318881,_0x467197){return db[_0x1b2e('0x18')]['find']({'raw':_0x535bc6[_0x1b2e('0x1a')]?_0x535bc6[_0x1b2e('0x1a')][_0x1b2e('0x1b')]===undefined?!![]:![]:!![],'where':_0x535bc6[_0x1b2e('0x1a')]?_0x535bc6[_0x1b2e('0x1a')]['where']||null:null,'attributes':_0x535bc6['options']?_0x535bc6[_0x1b2e('0x1a')]['attributes']||null:null,'include':_0x535bc6[_0x1b2e('0x1a')]?_0x535bc6[_0x1b2e('0x1a')]['include']?_[_0x1b2e('0x1f')](_0x535bc6['options'][_0x1b2e('0x1d')],function(_0x52348c){return{'model':db[_0x52348c['model']],'as':_0x52348c['as'],'attributes':_0x52348c[_0x1b2e('0x1c')],'include':_0x52348c['include']?_[_0x1b2e('0x1f')](_0x52348c['include'],function(_0x11eb54){return{'model':db[_0x11eb54[_0x1b2e('0x1e')]],'as':_0x11eb54['as'],'attributes':_0x11eb54[_0x1b2e('0x1c')],'include':_0x11eb54[_0x1b2e('0x1d')]?_[_0x1b2e('0x1f')](_0x11eb54['include'],function(_0xc62aa6){return{'model':db[_0xc62aa6[_0x1b2e('0x1e')]],'as':_0xc62aa6['as'],'attributes':_0xc62aa6[_0x1b2e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b2e('0x20')](function(_0x2c00b6){logger[_0x1b2e('0xd')]('ShowFreshdeskAccount',_0x535bc6);logger['debug']('ShowFreshdeskAccount',_0x535bc6,JSON[_0x1b2e('0x12')](_0x2c00b6));_0x318881(_0x2c00b6);})[_0x1b2e('0x16')](function(_0x304910){logger[_0x1b2e('0x13')](_0x1b2e('0x21'),_0x304910[_0x1b2e('0x15')],_0x535bc6);_0x467197(_0x4e540a[_0x1b2e('0x13')](0x1f4,_0x304910[_0x1b2e('0x15')]));});});}; \ No newline at end of file +var _0x4f80=['map','then','debug','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model'];(function(_0x45ab70,_0x46f754){var _0x4e93bb=function(_0x4e6a56){while(--_0x4e6a56){_0x45ab70['push'](_0x45ab70['shift']());}};_0x4e93bb(++_0x46f754);}(_0x4f80,0xcb));var _0x04f8=function(_0x168120,_0x4e19de){_0x168120=_0x168120-0x0;var _0x5c827e=_0x4f80[_0x168120];return _0x5c827e;};'use strict';var _=require(_0x04f8('0x0'));var util=require(_0x04f8('0x1'));var moment=require(_0x04f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x04f8('0x3'));var fs=require('fs');var Redis=require(_0x04f8('0x4'));var db=require(_0x04f8('0x5'))['db'];var utils=require(_0x04f8('0x6'));var logger=require(_0x04f8('0x7'))(_0x04f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x04f8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x255cd0,_0x5baa79,_0x201be1){return new BPromise(function(_0x3a77d6,_0x331679){return client['request'](_0x255cd0,_0x201be1)['then'](function(_0x3f7534){logger[_0x04f8('0xa')](_0x04f8('0xb'),_0x5baa79,_0x04f8('0xc'));logger['debug'](_0x04f8('0xd'),_0x5baa79,'request\x20sent',JSON['stringify'](_0x3f7534));if(_0x3f7534[_0x04f8('0xe')]){if(_0x3f7534[_0x04f8('0xe')][_0x04f8('0xf')]===0x1f4){logger['error'](_0x04f8('0xb'),_0x5baa79,_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);return _0x331679(_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);}logger['error'](_0x04f8('0xb'),_0x5baa79,_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);return _0x3a77d6(_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);}else{logger[_0x04f8('0xa')](_0x04f8('0xb'),_0x5baa79,_0x04f8('0xc'));_0x3a77d6(_0x3f7534[_0x04f8('0x11')][_0x04f8('0x10')]);}})[_0x04f8('0x12')](function(_0x3c73de){logger[_0x04f8('0xe')](_0x04f8('0xb'),_0x5baa79,_0x3c73de);_0x331679(_0x3c73de);});});}exports[_0x04f8('0x13')]=function(_0x1cd7c6){var _0x52c30d=this;return new Promise(function(_0x3a10d1,_0x400319){return db[_0x04f8('0x14')][_0x04f8('0x15')]({'raw':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6['options'][_0x04f8('0x17')]===undefined?!![]:![]:!![],'where':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6['options']['where']||null:null,'attributes':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x18')]||null:null,'limit':_0x1cd7c6['options']?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x19')]||null:null,'include':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x1a')]?_['map'](_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x1a')],function(_0x59cbec){return{'model':db[_0x59cbec[_0x04f8('0x1b')]],'as':_0x59cbec['as'],'attributes':_0x59cbec[_0x04f8('0x18')],'include':_0x59cbec[_0x04f8('0x1a')]?_[_0x04f8('0x1c')](_0x59cbec[_0x04f8('0x1a')],function(_0x7d8616){return{'model':db[_0x7d8616[_0x04f8('0x1b')]],'as':_0x7d8616['as'],'attributes':_0x7d8616[_0x04f8('0x18')],'include':_0x7d8616['include']?_[_0x04f8('0x1c')](_0x7d8616[_0x04f8('0x1a')],function(_0x18c6cf){return{'model':db[_0x18c6cf[_0x04f8('0x1b')]],'as':_0x18c6cf['as'],'attributes':_0x18c6cf[_0x04f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x04f8('0x1d')](function(_0x53ebe2){logger['info']('GetFreshdeskAccount',_0x1cd7c6);logger[_0x04f8('0x1e')](_0x04f8('0x13'),_0x1cd7c6,JSON['stringify'](_0x53ebe2));_0x3a10d1(_0x53ebe2);})['catch'](function(_0x273707){logger[_0x04f8('0xe')](_0x04f8('0x13'),_0x273707[_0x04f8('0x10')],_0x1cd7c6);_0x400319(_0x52c30d[_0x04f8('0xe')](0x1f4,_0x273707[_0x04f8('0x10')]));});});};exports[_0x04f8('0x1f')]=function(_0x12f706){var _0x5cb637=this;return new Promise(function(_0x59e7d7,_0x2e507d){return db[_0x04f8('0x14')][_0x04f8('0x20')]({'raw':_0x12f706['options']?_0x12f706[_0x04f8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')]['where']||null:null,'attributes':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')]['attributes']||null:null,'include':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')][_0x04f8('0x1a')]?_['map'](_0x12f706[_0x04f8('0x16')][_0x04f8('0x1a')],function(_0x293f63){return{'model':db[_0x293f63[_0x04f8('0x1b')]],'as':_0x293f63['as'],'attributes':_0x293f63[_0x04f8('0x18')],'include':_0x293f63[_0x04f8('0x1a')]?_[_0x04f8('0x1c')](_0x293f63[_0x04f8('0x1a')],function(_0x8922f0){return{'model':db[_0x8922f0[_0x04f8('0x1b')]],'as':_0x8922f0['as'],'attributes':_0x8922f0[_0x04f8('0x18')],'include':_0x8922f0[_0x04f8('0x1a')]?_['map'](_0x8922f0['include'],function(_0x40dd76){return{'model':db[_0x40dd76[_0x04f8('0x1b')]],'as':_0x40dd76['as'],'attributes':_0x40dd76[_0x04f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x04f8('0x1d')](function(_0x3a797c){logger[_0x04f8('0xa')]('ShowFreshdeskAccount',_0x12f706);logger['debug']('ShowFreshdeskAccount',_0x12f706,JSON['stringify'](_0x3a797c));_0x59e7d7(_0x3a797c);})[_0x04f8('0x12')](function(_0x2cf99a){logger[_0x04f8('0xe')](_0x04f8('0x1f'),_0x2cf99a[_0x04f8('0x10')],_0x12f706);_0x2e507d(_0x5cb637[_0x04f8('0xe')](0x1f4,_0x2cf99a[_0x04f8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f1dbee7..b89c878 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 _0x15bc=['show','get','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index'];(function(_0x1db284,_0x3b6700){var _0x517081=function(_0x2db2b3){while(--_0x2db2b3){_0x1db284['push'](_0x1db284['shift']());}};_0x517081(++_0x3b6700);}(_0x15bc,0x162));var _0xc15b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc15b('0x0'));var util=require(_0xc15b('0x1'));var path=require(_0xc15b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc15b('0x3'));var router=express[_0xc15b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc15b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc15b('0x6'));var controller=require(_0xc15b('0x7'));router['get']('/',auth[_0xc15b('0x8')](),controller[_0xc15b('0x9')]);router['get']('/:id',auth[_0xc15b('0x8')](),controller[_0xc15b('0xa')]);router[_0xc15b('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc15b('0xc')]);router[_0xc15b('0xb')](_0xc15b('0xd'),auth[_0xc15b('0x8')](),controller[_0xc15b('0xe')]);router['get'](_0xc15b('0xf'),auth[_0xc15b('0x8')](),controller[_0xc15b('0x10')]);router[_0xc15b('0xb')](_0xc15b('0x11'),auth[_0xc15b('0x8')](),controller['getTags']);router['post']('/',auth[_0xc15b('0x8')](),controller[_0xc15b('0x12')]);router[_0xc15b('0x13')](_0xc15b('0x11'),auth[_0xc15b('0x8')](),controller[_0xc15b('0x14')]);router[_0xc15b('0x15')](_0xc15b('0x16'),auth[_0xc15b('0x8')](),controller['update']);router[_0xc15b('0x17')](_0xc15b('0x16'),auth[_0xc15b('0x8')](),controller[_0xc15b('0x18')]);module[_0xc15b('0x19')]=router; \ No newline at end of file +var _0x35b7=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','destroy','exports'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x35b7,0x17a));var _0x735b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x35b7[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0x735b('0x0'));var util=require(_0x735b('0x1'));var path=require('path');var timeout=require(_0x735b('0x2'));var express=require(_0x735b('0x3'));var router=express['Router']();var fs_extra=require(_0x735b('0x4'));var auth=require(_0x735b('0x5'));var interaction=require(_0x735b('0x6'));var config=require('../../config/environment');var controller=require(_0x735b('0x7'));router['get']('/',auth[_0x735b('0x8')](),controller[_0x735b('0x9')]);router[_0x735b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x735b('0xb')]);router[_0x735b('0xa')](_0x735b('0xc'),auth[_0x735b('0x8')](),controller[_0x735b('0xd')]);router[_0x735b('0xa')]('/:id/subjects',auth[_0x735b('0x8')](),controller[_0x735b('0xe')]);router[_0x735b('0xa')](_0x735b('0xf'),auth['isAuthenticated'](),controller[_0x735b('0x10')]);router[_0x735b('0xa')](_0x735b('0x11'),auth[_0x735b('0x8')](),controller[_0x735b('0x12')]);router[_0x735b('0x13')]('/',auth[_0x735b('0x8')](),controller[_0x735b('0x14')]);router['post'](_0x735b('0x11'),auth['isAuthenticated'](),controller[_0x735b('0x15')]);router[_0x735b('0x16')](_0x735b('0x17'),auth[_0x735b('0x8')](),controller[_0x735b('0x18')]);router['delete'](_0x735b('0x17'),auth[_0x735b('0x8')](),controller[_0x735b('0x19')]);module[_0x735b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 44c3632..9cabb24 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 _0x98d8=['STRING','exports'];(function(_0x2a0046,_0x3e9d3d){var _0x23b163=function(_0x299104){while(--_0x299104){_0x2a0046['push'](_0x2a0046['shift']());}};_0x23b163(++_0x3e9d3d);}(_0x98d8,0x131));var _0x898d=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x98d8[_0x5447aa];return _0xb21e53;};'use strict';var Sequelize=require('sequelize');module[_0x898d('0x0')]={'name':{'type':Sequelize[_0x898d('0x1')]},'description':{'type':Sequelize[_0x898d('0x1')]}}; \ No newline at end of file +var _0x6419=['STRING','exports'];(function(_0x1338d8,_0x2537d0){var _0xe67cd5=function(_0x144ecc){while(--_0x144ecc){_0x1338d8['push'](_0x1338d8['shift']());}};_0xe67cd5(++_0x2537d0);}(_0x6419,0x1e5));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x9641('0x0')]={'name':{'type':Sequelize[_0x9641('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 77a74ba..f641978 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 _0xf3ad=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','create','body','destroy','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0xf3ad,0x19f));var _0xdf3a=function(_0x5a6fc6,_0x3fc5ea){_0x5a6fc6=_0x5a6fc6-0x0;var _0x16f4fc=_0xf3ad[_0x5a6fc6];return _0x16f4fc;};'use strict';var emlformat=require(_0xdf3a('0x0'));var rimraf=require(_0xdf3a('0x1'));var zipdir=require(_0xdf3a('0x2'));var jsonpatch=require(_0xdf3a('0x3'));var rp=require(_0xdf3a('0x4'));var moment=require(_0xdf3a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3a('0x6'));var util=require(_0xdf3a('0x7'));var path=require(_0xdf3a('0x8'));var sox=require(_0xdf3a('0x9'));var csv=require(_0xdf3a('0xa'));var ejs=require(_0xdf3a('0xb'));var fs=require('fs');var fs_extra=require(_0xdf3a('0xc'));var _=require(_0xdf3a('0xd'));var squel=require(_0xdf3a('0xe'));var crypto=require(_0xdf3a('0xf'));var jsforce=require(_0xdf3a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdf3a('0x11'));var Papa=require(_0xdf3a('0x12'));var Redis=require(_0xdf3a('0x13'));var authService=require(_0xdf3a('0x14'));var qs=require(_0xdf3a('0x15'));var as=require(_0xdf3a('0x16'));var hardwareService=require(_0xdf3a('0x17'));var logger=require(_0xdf3a('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xdf3a('0x19'));var licenseUtil=require(_0xdf3a('0x1a'));var db=require(_0xdf3a('0x1b'))['db'];function respondWithStatusCode(_0x5afb30,_0x402ade){_0x402ade=_0x402ade||0xcc;return function(_0x2c3449){if(_0x2c3449){return _0x5afb30[_0xdf3a('0x1c')](_0x402ade);}return _0x5afb30['status'](_0x402ade)['end']();};}function respondWithResult(_0x51bf9c,_0x588ff2){_0x588ff2=_0x588ff2||0xc8;return function(_0x3fed9e){if(_0x3fed9e){return _0x51bf9c[_0xdf3a('0x1d')](_0x588ff2)[_0xdf3a('0x1e')](_0x3fed9e);}};}function respondWithFilteredResult(_0x3d2a6a,_0x51910){return function(_0x3c6857){if(_0x3c6857){var _0x2c559e=typeof _0x51910[_0xdf3a('0x1f')]===_0xdf3a('0x20')&&typeof _0x51910['limit']===_0xdf3a('0x20');var _0x4811de=_0x3c6857['count'];var _0x5bc9e2=_0x2c559e?0x0:_0x51910[_0xdf3a('0x1f')];var _0x5de98d=_0x2c559e?_0x3c6857[_0xdf3a('0x21')]:_0x51910['offset']+_0x51910[_0xdf3a('0x22')];var _0x3fd0b2;if(_0x5de98d>=_0x4811de){_0x5de98d=_0x4811de;_0x3fd0b2=0xc8;}else{_0x3fd0b2=0xce;}_0x3d2a6a[_0xdf3a('0x1d')](_0x3fd0b2);return _0x3d2a6a['set'](_0xdf3a('0x23'),_0x5bc9e2+'-'+_0x5de98d+'/'+_0x4811de)[_0xdf3a('0x1e')](_0x3c6857);}return null;};}function patchUpdates(_0x480edb){return function(_0x2ba60b){try{jsonpatch[_0xdf3a('0x24')](_0x2ba60b,_0x480edb,!![]);}catch(_0x31913e){return BPromise[_0xdf3a('0x25')](_0x31913e);}return _0x2ba60b[_0xdf3a('0x26')]();};}function saveUpdates(_0x27c1f9,_0x1c6015){return function(_0x445981){if(_0x445981){return _0x445981[_0xdf3a('0x27')](_0x27c1f9)[_0xdf3a('0x28')](function(_0x4164f6){return _0x4164f6;});}return null;};}function removeEntity(_0x25a954,_0x2b5cb8){return function(_0x2f3850){if(_0x2f3850){return _0x2f3850['destroy']()[_0xdf3a('0x28')](function(){_0x25a954[_0xdf3a('0x1d')](0xcc)[_0xdf3a('0x29')]();});}};}function handleEntityNotFound(_0x23a270,_0x265c5e){return function(_0x497e1e){if(!_0x497e1e){_0x23a270[_0xdf3a('0x1c')](0x194);}return _0x497e1e;};}function handleError(_0x34fa67,_0x5c0d31){_0x5c0d31=_0x5c0d31||0x1f4;return function(_0x1f680c){logger['error'](_0x1f680c[_0xdf3a('0x2a')]);if(_0x1f680c[_0xdf3a('0x2b')]){delete _0x1f680c[_0xdf3a('0x2b')];}_0x34fa67[_0xdf3a('0x1d')](_0x5c0d31)[_0xdf3a('0x2c')](_0x1f680c);};}exports['index']=function(_0x1b5a1d,_0x3c9fa3){var _0x716b4={},_0x3270ef={},_0x20b1f2={'count':0x0,'rows':[]};var _0x1a6e96=_[_0xdf3a('0x2d')](db[_0xdf3a('0x2e')][_0xdf3a('0x2f')],function(_0x584d81){return{'name':_0x584d81[_0xdf3a('0x30')],'type':_0x584d81[_0xdf3a('0x31')][_0xdf3a('0x32')]};});_0x3270ef[_0xdf3a('0x33')]=_[_0xdf3a('0x2d')](_0x1a6e96,'name');_0x3270ef[_0xdf3a('0x34')]=_[_0xdf3a('0x35')](_0x1b5a1d['query']);_0x3270ef[_0xdf3a('0x36')]=_['intersection'](_0x3270ef[_0xdf3a('0x33')],_0x3270ef['query']);_0x716b4[_0xdf3a('0x37')]=_['intersection'](_0x3270ef[_0xdf3a('0x33')],qs[_0xdf3a('0x38')](_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x38')]));_0x716b4[_0xdf3a('0x37')]=_0x716b4[_0xdf3a('0x37')]['length']?_0x716b4[_0xdf3a('0x37')]:_0x3270ef['model'];if(!_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x39')](_0xdf3a('0x3a'))){_0x716b4[_0xdf3a('0x22')]=qs[_0xdf3a('0x22')](_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x22')]);_0x716b4[_0xdf3a('0x1f')]=qs[_0xdf3a('0x1f')](_0x1b5a1d[_0xdf3a('0x34')]['offset']);}_0x716b4[_0xdf3a('0x3b')]=qs[_0xdf3a('0x3c')](_0x1b5a1d['query'][_0xdf3a('0x3c')]);_0x716b4['where']=qs[_0xdf3a('0x36')](_[_0xdf3a('0x3d')](_0x1b5a1d[_0xdf3a('0x34')],_0x3270ef[_0xdf3a('0x36')]),_0x1a6e96);if(_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x3e')]){_0x716b4['where']=_[_0xdf3a('0x3f')](_0x716b4[_0xdf3a('0x40')],{'$or':_[_0xdf3a('0x2d')](_0x1a6e96,function(_0x17a4fe){if(_0x17a4fe[_0xdf3a('0x31')]!==_0xdf3a('0x41')){var _0x531f2e={};_0x531f2e[_0x17a4fe[_0xdf3a('0x2b')]]={'$like':'%'+_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x3e')]+'%'};return _0x531f2e;}})});}_0x716b4=_[_0xdf3a('0x3f')]({},_0x716b4,_0x1b5a1d[_0xdf3a('0x42')]);var _0x1bcae1={'where':_0x716b4[_0xdf3a('0x40')]};return db[_0xdf3a('0x2e')][_0xdf3a('0x21')](_0x1bcae1)[_0xdf3a('0x28')](function(_0x352183){_0x20b1f2[_0xdf3a('0x21')]=_0x352183;if(_0x1b5a1d[_0xdf3a('0x34')][_0xdf3a('0x43')]){_0x716b4['include']=[{'all':!![]}];}return db[_0xdf3a('0x2e')][_0xdf3a('0x44')](_0x716b4);})['then'](function(_0x5e3755){_0x20b1f2[_0xdf3a('0x45')]=_0x5e3755;return _0x20b1f2;})[_0xdf3a('0x28')](respondWithFilteredResult(_0x3c9fa3,_0x716b4))[_0xdf3a('0x46')](handleError(_0x3c9fa3,null));};exports[_0xdf3a('0x47')]=function(_0x106f1e,_0x5acf63){var _0x4b00fc={'raw':![],'where':{'id':_0x106f1e[_0xdf3a('0x48')]['id']}},_0x4ee68e={};_0x4ee68e['model']=_['keys'](db[_0xdf3a('0x2e')]['rawAttributes']);_0x4ee68e[_0xdf3a('0x34')]=_['keys'](_0x106f1e[_0xdf3a('0x34')]);_0x4ee68e[_0xdf3a('0x36')]=_['intersection'](_0x4ee68e[_0xdf3a('0x33')],_0x4ee68e[_0xdf3a('0x34')]);_0x4b00fc[_0xdf3a('0x37')]=_[_0xdf3a('0x49')](_0x4ee68e['model'],qs[_0xdf3a('0x38')](_0x106f1e[_0xdf3a('0x34')]['fields']));_0x4b00fc['attributes']=_0x4b00fc['attributes'][_0xdf3a('0x4a')]?_0x4b00fc['attributes']:_0x4ee68e[_0xdf3a('0x33')];if(_0x106f1e[_0xdf3a('0x34')][_0xdf3a('0x43')]){_0x4b00fc[_0xdf3a('0x4b')]=[{'all':!![]}];}_0x4b00fc=_[_0xdf3a('0x3f')]({},_0x4b00fc,_0x106f1e['options']);return db[_0xdf3a('0x2e')][_0xdf3a('0x4c')](_0x4b00fc)['then'](handleEntityNotFound(_0x5acf63,null))['then'](respondWithResult(_0x5acf63,null))['catch'](handleError(_0x5acf63,null));};exports[_0xdf3a('0x4d')]=function(_0x18389c,_0x21a787){return db[_0xdf3a('0x2e')][_0xdf3a('0x4d')](_0x18389c[_0xdf3a('0x4e')],{})['then'](respondWithResult(_0x21a787,0xc9))[_0xdf3a('0x46')](handleError(_0x21a787,null));};exports[_0xdf3a('0x27')]=function(_0xb8d92e,_0x1d9e97){if(_0xb8d92e['body']['id']){delete _0xb8d92e[_0xdf3a('0x4e')]['id'];}return db[_0xdf3a('0x2e')]['find']({'where':{'id':_0xb8d92e['params']['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x1d9e97,null))['then'](saveUpdates(_0xb8d92e['body'],null))[_0xdf3a('0x28')](respondWithResult(_0x1d9e97,null))[_0xdf3a('0x46')](handleError(_0x1d9e97,null));};exports[_0xdf3a('0x4f')]=function(_0x11fe11,_0x251b33){return db[_0xdf3a('0x2e')][_0xdf3a('0x4c')]({'where':{'id':_0x11fe11[_0xdf3a('0x48')]['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x251b33,null))[_0xdf3a('0x28')](removeEntity(_0x251b33,null))[_0xdf3a('0x46')](handleError(_0x251b33,null));};exports[_0xdf3a('0x50')]=function(_0x3cbef9,_0x346605,_0x4d017e){var _0x41c071={};var _0x3139f9={};var _0x4b3b06;var _0x24e0a8;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3cbef9[_0xdf3a('0x48')]['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x346605,null))[_0xdf3a('0x28')](function(_0x9c72b9){if(_0x9c72b9){_0x4b3b06=_0x9c72b9;_0x3139f9['model']=_[_0xdf3a('0x35')](db['FreshdeskField'][_0xdf3a('0x2f')]);_0x3139f9['query']=_[_0xdf3a('0x35')](_0x3cbef9[_0xdf3a('0x34')]);_0x3139f9[_0xdf3a('0x36')]=_[_0xdf3a('0x49')](_0x3139f9['model'],_0x3139f9[_0xdf3a('0x34')]);_0x41c071[_0xdf3a('0x37')]=_[_0xdf3a('0x49')](_0x3139f9[_0xdf3a('0x33')],qs['fields'](_0x3cbef9['query'][_0xdf3a('0x38')]));_0x41c071['attributes']=_0x41c071[_0xdf3a('0x37')][_0xdf3a('0x4a')]?_0x41c071[_0xdf3a('0x37')]:_0x3139f9[_0xdf3a('0x33')];_0x41c071[_0xdf3a('0x3b')]=qs['sort'](_0x3cbef9[_0xdf3a('0x34')][_0xdf3a('0x3c')]);_0x41c071[_0xdf3a('0x40')]=qs['filters'](_[_0xdf3a('0x3d')](_0x3cbef9[_0xdf3a('0x34')],_0x3139f9[_0xdf3a('0x36')]));if(_0x3cbef9[_0xdf3a('0x34')]['filter']){_0x41c071[_0xdf3a('0x40')]=_[_0xdf3a('0x3f')](_0x41c071[_0xdf3a('0x40')],{'$or':_[_0xdf3a('0x2d')](_0x41c071[_0xdf3a('0x37')],function(_0x1fbbcb){var _0x3f7ef2={};_0x3f7ef2[_0x1fbbcb]={'$like':'%'+_0x3cbef9[_0xdf3a('0x34')][_0xdf3a('0x3e')]+'%'};return _0x3f7ef2;})});}_0x41c071=_['merge']({},_0x41c071,_0x3cbef9['options']);return _0x4b3b06['getFields'](_0x41c071);}})[_0xdf3a('0x28')](function(_0x3c25cb){if(_0x3c25cb){_0x24e0a8=_0x3c25cb[_0xdf3a('0x4a')];if(!_0x3cbef9['query'][_0xdf3a('0x39')](_0xdf3a('0x3a'))){_0x41c071[_0xdf3a('0x22')]=qs['limit'](_0x3cbef9['query'][_0xdf3a('0x22')]);_0x41c071[_0xdf3a('0x1f')]=qs[_0xdf3a('0x1f')](_0x3cbef9['query'][_0xdf3a('0x1f')]);}return _0x4b3b06[_0xdf3a('0x50')](_0x41c071);}})[_0xdf3a('0x28')](function(_0x953101){if(_0x953101){return _0x953101?{'count':_0x24e0a8,'rows':_0x953101}:null;}})[_0xdf3a('0x28')](respondWithResult(_0x346605,null))['catch'](handleError(_0x346605,null));};exports[_0xdf3a('0x51')]=function(_0x4ab0af,_0x5a4fd4,_0x1ad820){var _0x71c004={};var _0x5da6d8={};var _0x18538d;var _0x35c7ca;return db['FreshdeskConfiguration'][_0xdf3a('0x52')]({'where':{'id':_0x4ab0af[_0xdf3a('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a4fd4,null))[_0xdf3a('0x28')](function(_0x17cd03){if(_0x17cd03){_0x18538d=_0x17cd03;_0x5da6d8[_0xdf3a('0x33')]=_['keys'](db['FreshdeskField'][_0xdf3a('0x2f')]);_0x5da6d8[_0xdf3a('0x34')]=_[_0xdf3a('0x35')](_0x4ab0af[_0xdf3a('0x34')]);_0x5da6d8[_0xdf3a('0x36')]=_[_0xdf3a('0x49')](_0x5da6d8[_0xdf3a('0x33')],_0x5da6d8['query']);_0x71c004[_0xdf3a('0x37')]=_[_0xdf3a('0x49')](_0x5da6d8['model'],qs['fields'](_0x4ab0af[_0xdf3a('0x34')][_0xdf3a('0x38')]));_0x71c004[_0xdf3a('0x37')]=_0x71c004['attributes']['length']?_0x71c004[_0xdf3a('0x37')]:_0x5da6d8['model'];_0x71c004[_0xdf3a('0x3b')]=qs['sort'](_0x4ab0af[_0xdf3a('0x34')][_0xdf3a('0x3c')]);_0x71c004[_0xdf3a('0x40')]=qs[_0xdf3a('0x36')](_[_0xdf3a('0x3d')](_0x4ab0af[_0xdf3a('0x34')],_0x5da6d8['filters']));if(_0x4ab0af[_0xdf3a('0x34')][_0xdf3a('0x3e')]){_0x71c004['where']=_[_0xdf3a('0x3f')](_0x71c004[_0xdf3a('0x40')],{'$or':_[_0xdf3a('0x2d')](_0x71c004[_0xdf3a('0x37')],function(_0x4fa58b){var _0x594800={};_0x594800[_0x4fa58b]={'$like':'%'+_0x4ab0af[_0xdf3a('0x34')][_0xdf3a('0x3e')]+'%'};return _0x594800;})});}_0x71c004=_[_0xdf3a('0x3f')]({},_0x71c004,_0x4ab0af[_0xdf3a('0x42')]);return _0x18538d['getSubjects'](_0x71c004);}})[_0xdf3a('0x28')](function(_0x26fb5f){if(_0x26fb5f){_0x35c7ca=_0x26fb5f[_0xdf3a('0x4a')];if(!_0x4ab0af[_0xdf3a('0x34')][_0xdf3a('0x39')]('nolimit')){_0x71c004[_0xdf3a('0x22')]=qs['limit'](_0x4ab0af['query'][_0xdf3a('0x22')]);_0x71c004[_0xdf3a('0x1f')]=qs[_0xdf3a('0x1f')](_0x4ab0af[_0xdf3a('0x34')]['offset']);}return _0x18538d[_0xdf3a('0x51')](_0x71c004);}})['then'](function(_0x60a63e){if(_0x60a63e){return _0x60a63e?{'count':_0x35c7ca,'rows':_0x60a63e}:null;}})[_0xdf3a('0x28')](respondWithResult(_0x5a4fd4,null))['catch'](handleError(_0x5a4fd4,null));};exports[_0xdf3a('0x53')]=function(_0x28f3e8,_0x3a70d0,_0x97646){var _0x4b9255={};var _0x3c08fc={};var _0x11e0fe;var _0x221f52;return db['FreshdeskConfiguration'][_0xdf3a('0x52')]({'where':{'id':_0x28f3e8['params']['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x3a70d0,null))[_0xdf3a('0x28')](function(_0x5c1d4f){if(_0x5c1d4f){_0x11e0fe=_0x5c1d4f;_0x3c08fc[_0xdf3a('0x33')]=_[_0xdf3a('0x35')](db['FreshdeskField'][_0xdf3a('0x2f')]);_0x3c08fc['query']=_[_0xdf3a('0x35')](_0x28f3e8[_0xdf3a('0x34')]);_0x3c08fc[_0xdf3a('0x36')]=_['intersection'](_0x3c08fc[_0xdf3a('0x33')],_0x3c08fc['query']);_0x4b9255[_0xdf3a('0x37')]=_[_0xdf3a('0x49')](_0x3c08fc[_0xdf3a('0x33')],qs[_0xdf3a('0x38')](_0x28f3e8[_0xdf3a('0x34')][_0xdf3a('0x38')]));_0x4b9255['attributes']=_0x4b9255[_0xdf3a('0x37')][_0xdf3a('0x4a')]?_0x4b9255['attributes']:_0x3c08fc[_0xdf3a('0x33')];_0x4b9255[_0xdf3a('0x3b')]=qs['sort'](_0x28f3e8[_0xdf3a('0x34')][_0xdf3a('0x3c')]);_0x4b9255['where']=qs[_0xdf3a('0x36')](_[_0xdf3a('0x3d')](_0x28f3e8[_0xdf3a('0x34')],_0x3c08fc['filters']));if(_0x28f3e8['query'][_0xdf3a('0x3e')]){_0x4b9255[_0xdf3a('0x40')]=_['merge'](_0x4b9255[_0xdf3a('0x40')],{'$or':_[_0xdf3a('0x2d')](_0x4b9255[_0xdf3a('0x37')],function(_0x1be7c8){var _0x554c9f={};_0x554c9f[_0x1be7c8]={'$like':'%'+_0x28f3e8['query']['filter']+'%'};return _0x554c9f;})});}_0x4b9255=_['merge']({},_0x4b9255,_0x28f3e8[_0xdf3a('0x42')]);return _0x11e0fe['getDescriptions'](_0x4b9255);}})[_0xdf3a('0x28')](function(_0x506a62){if(_0x506a62){_0x221f52=_0x506a62[_0xdf3a('0x4a')];if(!_0x28f3e8[_0xdf3a('0x34')][_0xdf3a('0x39')](_0xdf3a('0x3a'))){_0x4b9255[_0xdf3a('0x22')]=qs[_0xdf3a('0x22')](_0x28f3e8['query'][_0xdf3a('0x22')]);_0x4b9255[_0xdf3a('0x1f')]=qs[_0xdf3a('0x1f')](_0x28f3e8[_0xdf3a('0x34')][_0xdf3a('0x1f')]);}return _0x11e0fe['getDescriptions'](_0x4b9255);}})[_0xdf3a('0x28')](function(_0x50ffa0){if(_0x50ffa0){return _0x50ffa0?{'count':_0x221f52,'rows':_0x50ffa0}:null;}})[_0xdf3a('0x28')](respondWithResult(_0x3a70d0,null))[_0xdf3a('0x46')](handleError(_0x3a70d0,null));};exports[_0xdf3a('0x54')]=function(_0x4f522b,_0x1738e5,_0x2e8337){var _0x4f85d7={};var _0x5b398c={};var _0x508114;var _0x6bbfab;return db[_0xdf3a('0x2e')]['findOne']({'where':{'id':_0x4f522b[_0xdf3a('0x48')]['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x1738e5,null))[_0xdf3a('0x28')](function(_0x58f0f8){if(_0x58f0f8){_0x508114=_0x58f0f8;_0x5b398c[_0xdf3a('0x33')]=_['keys'](db['Tag'][_0xdf3a('0x2f')]);_0x5b398c['query']=_[_0xdf3a('0x35')](_0x4f522b[_0xdf3a('0x34')]);_0x5b398c[_0xdf3a('0x36')]=_[_0xdf3a('0x49')](_0x5b398c[_0xdf3a('0x33')],_0x5b398c[_0xdf3a('0x34')]);_0x4f85d7[_0xdf3a('0x37')]=_[_0xdf3a('0x49')](_0x5b398c[_0xdf3a('0x33')],qs[_0xdf3a('0x38')](_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x38')]));_0x4f85d7[_0xdf3a('0x37')]=_0x4f85d7[_0xdf3a('0x37')][_0xdf3a('0x4a')]?_0x4f85d7[_0xdf3a('0x37')]:_0x5b398c[_0xdf3a('0x33')];_0x4f85d7['order']=qs[_0xdf3a('0x3c')](_0x4f522b['query'][_0xdf3a('0x3c')]);_0x4f85d7['where']=qs[_0xdf3a('0x36')](_[_0xdf3a('0x3d')](_0x4f522b[_0xdf3a('0x34')],_0x5b398c[_0xdf3a('0x36')]));if(_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x3e')]){_0x4f85d7[_0xdf3a('0x40')]=_['merge'](_0x4f85d7[_0xdf3a('0x40')],{'$or':_[_0xdf3a('0x2d')](_0x4f85d7[_0xdf3a('0x37')],function(_0x4a65d4){var _0x268e65={};_0x268e65[_0x4a65d4]={'$like':'%'+_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x3e')]+'%'};return _0x268e65;})});}_0x4f85d7=_['merge']({},_0x4f85d7,_0x4f522b[_0xdf3a('0x42')]);return _0x508114['getTags'](_0x4f85d7);}})['then'](function(_0x24d5c4){if(_0x24d5c4){_0x6bbfab=_0x24d5c4[_0xdf3a('0x4a')];if(!_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x39')](_0xdf3a('0x3a'))){_0x4f85d7[_0xdf3a('0x22')]=qs[_0xdf3a('0x22')](_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x22')]);_0x4f85d7[_0xdf3a('0x1f')]=qs[_0xdf3a('0x1f')](_0x4f522b[_0xdf3a('0x34')][_0xdf3a('0x1f')]);}return _0x508114[_0xdf3a('0x54')](_0x4f85d7);}})[_0xdf3a('0x28')](function(_0x11d8c1){if(_0x11d8c1){return _0x11d8c1?{'count':_0x6bbfab,'rows':_0x11d8c1}:null;}})[_0xdf3a('0x28')](respondWithResult(_0x1738e5,null))['catch'](handleError(_0x1738e5,null));};exports[_0xdf3a('0x55')]=function(_0x4454fe,_0x339597,_0x577d13){if(_0x4454fe[_0xdf3a('0x4e')]['id']){delete _0x4454fe[_0xdf3a('0x4e')]['id'];}return db[_0xdf3a('0x2e')][_0xdf3a('0x52')]({'where':{'id':_0x4454fe[_0xdf3a('0x48')]['id']}})[_0xdf3a('0x28')](handleEntityNotFound(_0x339597,null))[_0xdf3a('0x28')](function(_0x111d3e){if(_0x111d3e){return _0x111d3e[_0xdf3a('0x55')](_0x4454fe['body']['ids']||[]);}return null;})[_0xdf3a('0x28')](respondWithResult(_0x339597,null))[_0xdf3a('0x46')](handleError(_0x339597,null));}; \ No newline at end of file +var _0x8b93=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','getFields','findOne','FreshdeskField','merge','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8b93,0xc5));var _0x38b9=function(_0x5c897d,_0x2c7b3f){_0x5c897d=_0x5c897d-0x0;var _0x3ccf42=_0x8b93[_0x5c897d];return _0x3ccf42;};'use strict';var emlformat=require(_0x38b9('0x0'));var rimraf=require(_0x38b9('0x1'));var zipdir=require(_0x38b9('0x2'));var jsonpatch=require(_0x38b9('0x3'));var rp=require(_0x38b9('0x4'));var moment=require(_0x38b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38b9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x38b9('0x7'));var csv=require(_0x38b9('0x8'));var ejs=require(_0x38b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38b9('0xa'));var squel=require(_0x38b9('0xb'));var crypto=require(_0x38b9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38b9('0x8'));var querystring=require('querystring');var Papa=require(_0x38b9('0xd'));var Redis=require('ioredis');var authService=require(_0x38b9('0xe'));var qs=require(_0x38b9('0xf'));var as=require(_0x38b9('0x10'));var hardwareService=require(_0x38b9('0x11'));var logger=require(_0x38b9('0x12'))('api');var utils=require(_0x38b9('0x13'));var config=require(_0x38b9('0x14'));var licenseUtil=require(_0x38b9('0x15'));var db=require(_0x38b9('0x16'))['db'];function respondWithStatusCode(_0x5a2b64,_0x1d09de){_0x1d09de=_0x1d09de||0xcc;return function(_0x2aca86){if(_0x2aca86){return _0x5a2b64[_0x38b9('0x17')](_0x1d09de);}return _0x5a2b64[_0x38b9('0x18')](_0x1d09de)[_0x38b9('0x19')]();};}function respondWithResult(_0x173865,_0x1d9188){_0x1d9188=_0x1d9188||0xc8;return function(_0x41852c){if(_0x41852c){return _0x173865[_0x38b9('0x18')](_0x1d9188)['json'](_0x41852c);}};}function respondWithFilteredResult(_0x4734ca,_0x4f829e){return function(_0x9abaea){if(_0x9abaea){var _0x3563ff=typeof _0x4f829e['offset']===_0x38b9('0x1a')&&typeof _0x4f829e[_0x38b9('0x1b')]===_0x38b9('0x1a');var _0x5a56d0=_0x9abaea[_0x38b9('0x1c')];var _0x171a36=_0x3563ff?0x0:_0x4f829e['offset'];var _0x371653=_0x3563ff?_0x9abaea[_0x38b9('0x1c')]:_0x4f829e[_0x38b9('0x1d')]+_0x4f829e[_0x38b9('0x1b')];var _0x2b9953;if(_0x371653>=_0x5a56d0){_0x371653=_0x5a56d0;_0x2b9953=0xc8;}else{_0x2b9953=0xce;}_0x4734ca['status'](_0x2b9953);return _0x4734ca[_0x38b9('0x1e')]('Content-Range',_0x171a36+'-'+_0x371653+'/'+_0x5a56d0)[_0x38b9('0x1f')](_0x9abaea);}return null;};}function patchUpdates(_0x40f1cb){return function(_0x3e5dd3){try{jsonpatch[_0x38b9('0x20')](_0x3e5dd3,_0x40f1cb,!![]);}catch(_0x24b572){return BPromise[_0x38b9('0x21')](_0x24b572);}return _0x3e5dd3[_0x38b9('0x22')]();};}function saveUpdates(_0x1d88c8,_0x42acd4){return function(_0xbef657){if(_0xbef657){return _0xbef657[_0x38b9('0x23')](_0x1d88c8)[_0x38b9('0x24')](function(_0x403a25){return _0x403a25;});}return null;};}function removeEntity(_0x3a98b0,_0xb2e17a){return function(_0x2b5f57){if(_0x2b5f57){return _0x2b5f57['destroy']()[_0x38b9('0x24')](function(){_0x3a98b0[_0x38b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cf23,_0x361b85){return function(_0x198a3f){if(!_0x198a3f){_0x16cf23[_0x38b9('0x17')](0x194);}return _0x198a3f;};}function handleError(_0x1d3ad6,_0x4b5e2e){_0x4b5e2e=_0x4b5e2e||0x1f4;return function(_0x4e4bb8){logger[_0x38b9('0x25')](_0x4e4bb8[_0x38b9('0x26')]);if(_0x4e4bb8['name']){delete _0x4e4bb8[_0x38b9('0x27')];}_0x1d3ad6[_0x38b9('0x18')](_0x4b5e2e)[_0x38b9('0x28')](_0x4e4bb8);};}exports['index']=function(_0x19fabd,_0x1859ce){var _0xd4b33b={},_0x30e13b={},_0x16ef52={'count':0x0,'rows':[]};var _0x16e95c=_[_0x38b9('0x29')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x158adb){return{'name':_0x158adb[_0x38b9('0x2a')],'type':_0x158adb[_0x38b9('0x2b')][_0x38b9('0x2c')]};});_0x30e13b[_0x38b9('0x2d')]=_[_0x38b9('0x29')](_0x16e95c,_0x38b9('0x27'));_0x30e13b[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x19fabd['query']);_0x30e13b[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x30e13b[_0x38b9('0x2d')],_0x30e13b[_0x38b9('0x2e')]);_0xd4b33b[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x30e13b[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x33')]));_0xd4b33b['attributes']=_0xd4b33b[_0x38b9('0x32')][_0x38b9('0x34')]?_0xd4b33b['attributes']:_0x30e13b['model'];if(!_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0xd4b33b[_0x38b9('0x1b')]=qs['limit'](_0x19fabd['query'][_0x38b9('0x1b')]);_0xd4b33b[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x19fabd[_0x38b9('0x2e')]['offset']);}_0xd4b33b[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x19fabd[_0x38b9('0x2e')]['sort']);_0xd4b33b[_0x38b9('0x39')]=qs['filters'](_[_0x38b9('0x3a')](_0x19fabd['query'],_0x30e13b['filters']),_0x16e95c);if(_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0xd4b33b['where']=_['merge'](_0xd4b33b[_0x38b9('0x39')],{'$or':_['map'](_0x16e95c,function(_0x2a7ee9){if(_0x2a7ee9[_0x38b9('0x2b')]!==_0x38b9('0x3c')){var _0x388b88={};_0x388b88[_0x2a7ee9['name']]={'$like':'%'+_0x19fabd[_0x38b9('0x2e')]['filter']+'%'};return _0x388b88;}})});}_0xd4b33b=_['merge']({},_0xd4b33b,_0x19fabd[_0x38b9('0x3d')]);var _0x26dfe7={'where':_0xd4b33b[_0x38b9('0x39')]};return db[_0x38b9('0x3e')][_0x38b9('0x1c')](_0x26dfe7)[_0x38b9('0x24')](function(_0x2ff9d8){_0x16ef52[_0x38b9('0x1c')]=_0x2ff9d8;if(_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x3f')]){_0xd4b33b[_0x38b9('0x40')]=[{'all':!![]}];}return db[_0x38b9('0x3e')][_0x38b9('0x41')](_0xd4b33b);})['then'](function(_0x383c8b){_0x16ef52[_0x38b9('0x42')]=_0x383c8b;return _0x16ef52;})[_0x38b9('0x24')](respondWithFilteredResult(_0x1859ce,_0xd4b33b))[_0x38b9('0x43')](handleError(_0x1859ce,null));};exports['show']=function(_0x3deda4,_0x213069){var _0x5b7f77={'raw':![],'where':{'id':_0x3deda4[_0x38b9('0x44')]['id']}},_0x15adf0={};_0x15adf0[_0x38b9('0x2d')]=_[_0x38b9('0x2f')](db[_0x38b9('0x3e')][_0x38b9('0x45')]);_0x15adf0['query']=_['keys'](_0x3deda4[_0x38b9('0x2e')]);_0x15adf0[_0x38b9('0x30')]=_['intersection'](_0x15adf0[_0x38b9('0x2d')],_0x15adf0[_0x38b9('0x2e')]);_0x5b7f77[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x15adf0[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x3deda4[_0x38b9('0x2e')][_0x38b9('0x33')]));_0x5b7f77[_0x38b9('0x32')]=_0x5b7f77['attributes'][_0x38b9('0x34')]?_0x5b7f77[_0x38b9('0x32')]:_0x15adf0[_0x38b9('0x2d')];if(_0x3deda4[_0x38b9('0x2e')][_0x38b9('0x3f')]){_0x5b7f77[_0x38b9('0x40')]=[{'all':!![]}];}_0x5b7f77=_['merge']({},_0x5b7f77,_0x3deda4[_0x38b9('0x3d')]);return db[_0x38b9('0x3e')][_0x38b9('0x46')](_0x5b7f77)[_0x38b9('0x24')](handleEntityNotFound(_0x213069,null))[_0x38b9('0x24')](respondWithResult(_0x213069,null))[_0x38b9('0x43')](handleError(_0x213069,null));};exports[_0x38b9('0x47')]=function(_0x2f5552,_0x2009a5){return db['FreshdeskConfiguration']['create'](_0x2f5552['body'],{})['then'](respondWithResult(_0x2009a5,0xc9))['catch'](handleError(_0x2009a5,null));};exports[_0x38b9('0x23')]=function(_0x3abf37,_0x4fb254){if(_0x3abf37['body']['id']){delete _0x3abf37[_0x38b9('0x48')]['id'];}return db[_0x38b9('0x3e')][_0x38b9('0x46')]({'where':{'id':_0x3abf37[_0x38b9('0x44')]['id']}})[_0x38b9('0x24')](handleEntityNotFound(_0x4fb254,null))[_0x38b9('0x24')](saveUpdates(_0x3abf37[_0x38b9('0x48')],null))[_0x38b9('0x24')](respondWithResult(_0x4fb254,null))[_0x38b9('0x43')](handleError(_0x4fb254,null));};exports[_0x38b9('0x49')]=function(_0x501d65,_0x35ff47){return db['FreshdeskConfiguration'][_0x38b9('0x46')]({'where':{'id':_0x501d65[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x35ff47,null))['then'](removeEntity(_0x35ff47,null))[_0x38b9('0x43')](handleError(_0x35ff47,null));};exports[_0x38b9('0x4a')]=function(_0x2e0b4e,_0x45bd70,_0x376643){var _0x589da5={};var _0x52510b={};var _0x36f5be;var _0x2d2e23;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x2e0b4e[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x45bd70,null))[_0x38b9('0x24')](function(_0x3ddcdb){if(_0x3ddcdb){_0x36f5be=_0x3ddcdb;_0x52510b['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x52510b['query']=_[_0x38b9('0x2f')](_0x2e0b4e['query']);_0x52510b[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x52510b['model'],_0x52510b['query']);_0x589da5[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x52510b[_0x38b9('0x2d')],qs['fields'](_0x2e0b4e[_0x38b9('0x2e')]['fields']));_0x589da5['attributes']=_0x589da5[_0x38b9('0x32')][_0x38b9('0x34')]?_0x589da5[_0x38b9('0x32')]:_0x52510b[_0x38b9('0x2d')];_0x589da5[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x38')]);_0x589da5[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x2e0b4e[_0x38b9('0x2e')],_0x52510b['filters']));if(_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0x589da5[_0x38b9('0x39')]=_['merge'](_0x589da5['where'],{'$or':_[_0x38b9('0x29')](_0x589da5[_0x38b9('0x32')],function(_0x105a11){var _0x3874e5={};_0x3874e5[_0x105a11]={'$like':'%'+_0x2e0b4e[_0x38b9('0x2e')]['filter']+'%'};return _0x3874e5;})});}_0x589da5=_[_0x38b9('0x4d')]({},_0x589da5,_0x2e0b4e[_0x38b9('0x3d')]);return _0x36f5be[_0x38b9('0x4a')](_0x589da5);}})[_0x38b9('0x24')](function(_0x4d0f18){if(_0x4d0f18){_0x2d2e23=_0x4d0f18[_0x38b9('0x34')];if(!_0x2e0b4e[_0x38b9('0x2e')]['hasOwnProperty'](_0x38b9('0x36'))){_0x589da5[_0x38b9('0x1b')]=qs['limit'](_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x1b')]);_0x589da5[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x2e0b4e[_0x38b9('0x2e')]['offset']);}return _0x36f5be[_0x38b9('0x4a')](_0x589da5);}})[_0x38b9('0x24')](function(_0x3d876d){if(_0x3d876d){return _0x3d876d?{'count':_0x2d2e23,'rows':_0x3d876d}:null;}})[_0x38b9('0x24')](respondWithResult(_0x45bd70,null))[_0x38b9('0x43')](handleError(_0x45bd70,null));};exports[_0x38b9('0x4e')]=function(_0x441e55,_0x114196,_0x487eec){var _0x5a3367={};var _0x1b6f7a={};var _0x542a6b;var _0x2256a6;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x441e55[_0x38b9('0x44')]['id']}})[_0x38b9('0x24')](handleEntityNotFound(_0x114196,null))[_0x38b9('0x24')](function(_0x1bd13a){if(_0x1bd13a){_0x542a6b=_0x1bd13a;_0x1b6f7a[_0x38b9('0x2d')]=_['keys'](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x1b6f7a[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x441e55[_0x38b9('0x2e')]);_0x1b6f7a[_0x38b9('0x30')]=_['intersection'](_0x1b6f7a['model'],_0x1b6f7a['query']);_0x5a3367[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x1b6f7a[_0x38b9('0x2d')],qs['fields'](_0x441e55[_0x38b9('0x2e')][_0x38b9('0x33')]));_0x5a3367['attributes']=_0x5a3367[_0x38b9('0x32')][_0x38b9('0x34')]?_0x5a3367[_0x38b9('0x32')]:_0x1b6f7a['model'];_0x5a3367['order']=qs[_0x38b9('0x38')](_0x441e55[_0x38b9('0x2e')]['sort']);_0x5a3367[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x441e55[_0x38b9('0x2e')],_0x1b6f7a[_0x38b9('0x30')]));if(_0x441e55[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0x5a3367[_0x38b9('0x39')]=_[_0x38b9('0x4d')](_0x5a3367[_0x38b9('0x39')],{'$or':_[_0x38b9('0x29')](_0x5a3367[_0x38b9('0x32')],function(_0x5ae02f){var _0x35c5a9={};_0x35c5a9[_0x5ae02f]={'$like':'%'+_0x441e55['query']['filter']+'%'};return _0x35c5a9;})});}_0x5a3367=_[_0x38b9('0x4d')]({},_0x5a3367,_0x441e55[_0x38b9('0x3d')]);return _0x542a6b[_0x38b9('0x4e')](_0x5a3367);}})['then'](function(_0x54201e){if(_0x54201e){_0x2256a6=_0x54201e[_0x38b9('0x34')];if(!_0x441e55[_0x38b9('0x2e')][_0x38b9('0x35')]('nolimit')){_0x5a3367[_0x38b9('0x1b')]=qs[_0x38b9('0x1b')](_0x441e55[_0x38b9('0x2e')]['limit']);_0x5a3367[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x441e55['query']['offset']);}return _0x542a6b['getSubjects'](_0x5a3367);}})[_0x38b9('0x24')](function(_0x32781d){if(_0x32781d){return _0x32781d?{'count':_0x2256a6,'rows':_0x32781d}:null;}})[_0x38b9('0x24')](respondWithResult(_0x114196,null))[_0x38b9('0x43')](handleError(_0x114196,null));};exports[_0x38b9('0x4f')]=function(_0x32a83e,_0x5a0e8d,_0x2d4669){var _0x4b1417={};var _0x432dfd={};var _0x5ee5b0;var _0x322fa6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x32a83e[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a0e8d,null))['then'](function(_0x13963a){if(_0x13963a){_0x5ee5b0=_0x13963a;_0x432dfd['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x432dfd[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x32a83e[_0x38b9('0x2e')]);_0x432dfd[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x432dfd[_0x38b9('0x2d')],_0x432dfd[_0x38b9('0x2e')]);_0x4b1417[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x432dfd[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x32a83e[_0x38b9('0x2e')]['fields']));_0x4b1417[_0x38b9('0x32')]=_0x4b1417['attributes'][_0x38b9('0x34')]?_0x4b1417[_0x38b9('0x32')]:_0x432dfd[_0x38b9('0x2d')];_0x4b1417[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x32a83e[_0x38b9('0x2e')]['sort']);_0x4b1417['where']=qs[_0x38b9('0x30')](_['pick'](_0x32a83e[_0x38b9('0x2e')],_0x432dfd[_0x38b9('0x30')]));if(_0x32a83e['query']['filter']){_0x4b1417['where']=_[_0x38b9('0x4d')](_0x4b1417['where'],{'$or':_[_0x38b9('0x29')](_0x4b1417[_0x38b9('0x32')],function(_0x1e8e0d){var _0x5dd767={};_0x5dd767[_0x1e8e0d]={'$like':'%'+_0x32a83e[_0x38b9('0x2e')]['filter']+'%'};return _0x5dd767;})});}_0x4b1417=_['merge']({},_0x4b1417,_0x32a83e[_0x38b9('0x3d')]);return _0x5ee5b0[_0x38b9('0x4f')](_0x4b1417);}})[_0x38b9('0x24')](function(_0x192a26){if(_0x192a26){_0x322fa6=_0x192a26[_0x38b9('0x34')];if(!_0x32a83e[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0x4b1417[_0x38b9('0x1b')]=qs['limit'](_0x32a83e['query'][_0x38b9('0x1b')]);_0x4b1417['offset']=qs[_0x38b9('0x1d')](_0x32a83e[_0x38b9('0x2e')]['offset']);}return _0x5ee5b0[_0x38b9('0x4f')](_0x4b1417);}})[_0x38b9('0x24')](function(_0x1bb098){if(_0x1bb098){return _0x1bb098?{'count':_0x322fa6,'rows':_0x1bb098}:null;}})[_0x38b9('0x24')](respondWithResult(_0x5a0e8d,null))[_0x38b9('0x43')](handleError(_0x5a0e8d,null));};exports[_0x38b9('0x50')]=function(_0x376c4f,_0x103056,_0x19abcd){var _0xdd050c={};var _0x1c7f14={};var _0x2ea2ec;var _0x265329;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x376c4f[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x103056,null))['then'](function(_0x4192a5){if(_0x4192a5){_0x2ea2ec=_0x4192a5;_0x1c7f14['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x51')][_0x38b9('0x45')]);_0x1c7f14['query']=_[_0x38b9('0x2f')](_0x376c4f[_0x38b9('0x2e')]);_0x1c7f14[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x1c7f14[_0x38b9('0x2d')],_0x1c7f14[_0x38b9('0x2e')]);_0xdd050c['attributes']=_[_0x38b9('0x31')](_0x1c7f14[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x33')]));_0xdd050c[_0x38b9('0x32')]=_0xdd050c[_0x38b9('0x32')][_0x38b9('0x34')]?_0xdd050c[_0x38b9('0x32')]:_0x1c7f14[_0x38b9('0x2d')];_0xdd050c[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x376c4f[_0x38b9('0x2e')]['sort']);_0xdd050c[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x376c4f[_0x38b9('0x2e')],_0x1c7f14['filters']));if(_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0xdd050c[_0x38b9('0x39')]=_[_0x38b9('0x4d')](_0xdd050c['where'],{'$or':_[_0x38b9('0x29')](_0xdd050c['attributes'],function(_0x47bac9){var _0x268ac3={};_0x268ac3[_0x47bac9]={'$like':'%'+_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x3b')]+'%'};return _0x268ac3;})});}_0xdd050c=_['merge']({},_0xdd050c,_0x376c4f[_0x38b9('0x3d')]);return _0x2ea2ec[_0x38b9('0x50')](_0xdd050c);}})['then'](function(_0x5069ae){if(_0x5069ae){_0x265329=_0x5069ae['length'];if(!_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0xdd050c[_0x38b9('0x1b')]=qs[_0x38b9('0x1b')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x1b')]);_0xdd050c[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x1d')]);}return _0x2ea2ec[_0x38b9('0x50')](_0xdd050c);}})['then'](function(_0x360db3){if(_0x360db3){return _0x360db3?{'count':_0x265329,'rows':_0x360db3}:null;}})[_0x38b9('0x24')](respondWithResult(_0x103056,null))[_0x38b9('0x43')](handleError(_0x103056,null));};exports['setTags']=function(_0x311845,_0x18af7e,_0x44c0f3){if(_0x311845[_0x38b9('0x48')]['id']){delete _0x311845[_0x38b9('0x48')]['id'];}return db[_0x38b9('0x3e')]['findOne']({'where':{'id':_0x311845[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x18af7e,null))[_0x38b9('0x24')](function(_0x1a06d6){if(_0x1a06d6){return _0x1a06d6['setTags'](_0x311845['body'][_0x38b9('0x52')]||[]);}return null;})[_0x38b9('0x24')](respondWithResult(_0x18af7e,null))[_0x38b9('0x43')](handleError(_0x18af7e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bcbade0..62039e9 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 _0x1638=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x2a670d,_0x36206f){var _0x411fe9=function(_0x23e06d){while(--_0x23e06d){_0x2a670d['push'](_0x2a670d['shift']());}};_0x411fe9(++_0x36206f);}(_0x1638,0x150));var _0x8163=function(_0x510912,_0x91f943){_0x510912=_0x510912-0x0;var _0x23f357=_0x1638[_0x510912];return _0x23f357;};'use strict';var _=require(_0x8163('0x0'));var util=require(_0x8163('0x1'));var logger=require(_0x8163('0x2'))('api');var moment=require(_0x8163('0x3'));var BPromise=require(_0x8163('0x4'));var rp=require(_0x8163('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8163('0x6'));var config=require(_0x8163('0x7'));var attributes=require(_0x8163('0x8'));module[_0x8163('0x9')]=function(_0x429b0c,_0x1fe4be){return _0x429b0c['define'](_0x8163('0xa'),attributes,{'tableName':_0x8163('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x655e=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','util','api','moment','request-promise','path'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x655e,0x1be));var _0xe655=function(_0x21652b,_0x4f5bea){_0x21652b=_0x21652b-0x0;var _0x2852e1=_0x655e[_0x21652b];return _0x2852e1;};'use strict';var _=require('lodash');var util=require(_0xe655('0x0'));var logger=require('../../config/logger')(_0xe655('0x1'));var moment=require(_0xe655('0x2'));var BPromise=require('bluebird');var rp=require(_0xe655('0x3'));var fs=require('fs');var path=require(_0xe655('0x4'));var rimraf=require(_0xe655('0x5'));var config=require(_0xe655('0x6'));var attributes=require(_0xe655('0x7'));module[_0xe655('0x8')]=function(_0x2bc82b,_0x27a51f){return _0x2bc82b[_0xe655('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0xe655('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 257f490..982b15b 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 _0xb1ba=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4fc1a8,_0x5ce6d7){var _0x4c5048=function(_0x543cfd){while(--_0x543cfd){_0x4fc1a8['push'](_0x4fc1a8['shift']());}};_0x4c5048(++_0x5ce6d7);}(_0xb1ba,0x137));var _0xab1b=function(_0x20ea36,_0x9b0140){_0x20ea36=_0x20ea36-0x0;var _0x580624=_0xb1ba[_0x20ea36];return _0x580624;};'use strict';var _=require(_0xab1b('0x0'));var util=require(_0xab1b('0x1'));var moment=require(_0xab1b('0x2'));var BPromise=require(_0xab1b('0x3'));var rs=require(_0xab1b('0x4'));var fs=require('fs');var Redis=require(_0xab1b('0x5'));var db=require(_0xab1b('0x6'))['db'];var utils=require(_0xab1b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xab1b('0x8'));var jayson=require(_0xab1b('0x9'));var client=jayson[_0xab1b('0xa')][_0xab1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x297dc8,_0xbd89f6,_0x557cde){return new BPromise(function(_0x241d91,_0x3c898c){return client[_0xab1b('0xc')](_0x297dc8,_0x557cde)[_0xab1b('0xd')](function(_0x49a5c4){logger[_0xab1b('0xe')](_0xab1b('0xf'),_0xbd89f6,'request\x20sent');logger['debug'](_0xab1b('0x10'),_0xbd89f6,_0xab1b('0x11'),JSON[_0xab1b('0x12')](_0x49a5c4));if(_0x49a5c4[_0xab1b('0x13')]){if(_0x49a5c4[_0xab1b('0x13')][_0xab1b('0x14')]===0x1f4){logger['error'](_0xab1b('0xf'),_0xbd89f6,_0x49a5c4['error'][_0xab1b('0x15')]);return _0x3c898c(_0x49a5c4['error']['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xbd89f6,_0x49a5c4[_0xab1b('0x13')][_0xab1b('0x15')]);return _0x241d91(_0x49a5c4[_0xab1b('0x13')][_0xab1b('0x15')]);}else{logger[_0xab1b('0xe')](_0xab1b('0xf'),_0xbd89f6,_0xab1b('0x11'));_0x241d91(_0x49a5c4[_0xab1b('0x16')][_0xab1b('0x15')]);}})[_0xab1b('0x17')](function(_0x2921dd){logger['error'](_0xab1b('0xf'),_0xbd89f6,_0x2921dd);_0x3c898c(_0x2921dd);});});} \ No newline at end of file +var _0x2f4b=['../../config/environment','jayson/promise','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x39f7ce,_0x19d17c){var _0x487f8d=function(_0x5a37d1){while(--_0x5a37d1){_0x39f7ce['push'](_0x39f7ce['shift']());}};_0x487f8d(++_0x19d17c);}(_0x2f4b,0x77));var _0xb2f4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2f4b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xb2f4('0x0'));var util=require(_0xb2f4('0x1'));var moment=require(_0xb2f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb2f4('0x3'));var fs=require('fs');var Redis=require(_0xb2f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb2f4('0x5'))(_0xb2f4('0x6'));var config=require(_0xb2f4('0x7'));var jayson=require(_0xb2f4('0x8'));var client=jayson['client'][_0xb2f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dfae5,_0x4154b8,_0x3963ff){return new BPromise(function(_0x40509b,_0xd1803b){return client[_0xb2f4('0xa')](_0x4dfae5,_0x3963ff)['then'](function(_0x5b4a38){logger['info'](_0xb2f4('0xb'),_0x4154b8,_0xb2f4('0xc'));logger[_0xb2f4('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4154b8,_0xb2f4('0xc'),JSON[_0xb2f4('0xe')](_0x5b4a38));if(_0x5b4a38[_0xb2f4('0xf')]){if(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x10')]===0x1f4){logger[_0xb2f4('0xf')](_0xb2f4('0xb'),_0x4154b8,_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);return _0xd1803b(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);}logger[_0xb2f4('0xf')](_0xb2f4('0xb'),_0x4154b8,_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);return _0x40509b(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);}else{logger[_0xb2f4('0x12')](_0xb2f4('0xb'),_0x4154b8,_0xb2f4('0xc'));_0x40509b(_0x5b4a38[_0xb2f4('0x13')][_0xb2f4('0x11')]);}})[_0xb2f4('0x14')](function(_0x209d88){logger['error'](_0xb2f4('0xb'),_0x4154b8,_0x209d88);_0xd1803b(_0x209d88);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c73aa89..3ca3d56 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 _0xa34b=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa34b,0xb5));var _0xba34=function(_0x127797,_0x478271){_0x127797=_0x127797-0x0;var _0x51a0a9=_0xa34b[_0x127797];return _0x51a0a9;};'use strict';var multer=require(_0xba34('0x0'));var util=require(_0xba34('0x1'));var path=require('path');var timeout=require(_0xba34('0x2'));var express=require(_0xba34('0x3'));var router=express[_0xba34('0x4')]();var fs_extra=require(_0xba34('0x5'));var auth=require(_0xba34('0x6'));var interaction=require(_0xba34('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xba34('0x8')]('/',auth['isAuthenticated'](),controller[_0xba34('0x9')]);router[_0xba34('0x8')](_0xba34('0xa'),auth[_0xba34('0xb')](),controller[_0xba34('0xc')]);router[_0xba34('0xd')]('/',auth[_0xba34('0xb')](),controller[_0xba34('0xe')]);router[_0xba34('0xf')](_0xba34('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xba34('0x10')](_0xba34('0xa'),auth[_0xba34('0xb')](),controller['destroy']);module[_0xba34('0x11')]=router; \ No newline at end of file +var _0xdfe3=['connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x54ad19,_0x2f3fc1){var _0x1330db=function(_0x3cb412){while(--_0x3cb412){_0x54ad19['push'](_0x54ad19['shift']());}};_0x1330db(++_0x2f3fc1);}(_0xdfe3,0x13d));var _0x3dfe=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xdfe3[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0x3dfe('0x0'));var util=require(_0x3dfe('0x1'));var path=require(_0x3dfe('0x2'));var timeout=require(_0x3dfe('0x3'));var express=require(_0x3dfe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3dfe('0x6'));var controller=require(_0x3dfe('0x7'));router['get']('/',auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x9')]);router[_0x3dfe('0xa')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0xc')]);router[_0x3dfe('0xd')]('/',auth['isAuthenticated'](),controller[_0x3dfe('0xe')]);router[_0x3dfe('0xf')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x10')]);router[_0x3dfe('0x11')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x12')]);module[_0x3dfe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 143607f..4414b39 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 _0x7a92=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','picklist'];(function(_0x5c12dd,_0x45bf34){var _0x3931bd=function(_0x119dbf){while(--_0x119dbf){_0x5c12dd['push'](_0x5c12dd['shift']());}};_0x3931bd(++_0x45bf34);}(_0x7a92,0x124));var _0x27a9=function(_0x2b0159,_0x511028){_0x2b0159=_0x2b0159-0x0;var _0x41e648=_0x7a92[_0x2b0159];return _0x41e648;};'use strict';var Sequelize=require(_0x27a9('0x0'));module[_0x27a9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x27a9('0x2'),_0x27a9('0x3'),'keyValue',_0x27a9('0x4')),'defaultValue':_0x27a9('0x5')},'content':{'type':Sequelize[_0x27a9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x27a9('0x7')](_0x27a9('0x5'),_0x27a9('0x2'),_0x27a9('0x3'))},'keyContent':{'type':Sequelize[_0x27a9('0x6')]},'idField':{'type':Sequelize[_0x27a9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x27a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x27a9('0x6')]}}; \ No newline at end of file +var _0xad8b=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x4505ff,_0x279eac){var _0x589f3f=function(_0x4dc73f){while(--_0x4dc73f){_0x4505ff['push'](_0x4505ff['shift']());}};_0x589f3f(++_0x279eac);}(_0xad8b,0xb8));var _0xbad8=function(_0x4f5633,_0x3ba792){_0x4f5633=_0x4f5633-0x0;var _0x1139d3=_0xad8b[_0x4f5633];return _0x1139d3;};'use strict';var Sequelize=require(_0xbad8('0x0'));module['exports']={'type':{'type':Sequelize[_0xbad8('0x1')](_0xbad8('0x2'),_0xbad8('0x3'),_0xbad8('0x4'),_0xbad8('0x5'),_0xbad8('0x6')),'defaultValue':_0xbad8('0x2')},'content':{'type':Sequelize[_0xbad8('0x7')]},'key':{'type':Sequelize[_0xbad8('0x7')]},'keyType':{'type':Sequelize[_0xbad8('0x1')](_0xbad8('0x2'),_0xbad8('0x3'),_0xbad8('0x4'))},'keyContent':{'type':Sequelize[_0xbad8('0x7')]},'idField':{'type':Sequelize[_0xbad8('0x7')]},'nameField':{'type':Sequelize[_0xbad8('0x7')]},'customField':{'type':Sequelize[_0xbad8('0x8')],'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 a0f99d7..55e2212 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 _0xaf80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x57b4dc,_0x3fbf56){var _0x19a18a=function(_0x31b596){while(--_0x31b596){_0x57b4dc['push'](_0x57b4dc['shift']());}};_0x19a18a(++_0x3fbf56);}(_0xaf80,0x1ef));var _0x0af8=function(_0xa44439,_0x89deb5){_0xa44439=_0xa44439-0x0;var _0x545dbc=_0xaf80[_0xa44439];return _0x545dbc;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){_0x300474['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6306,_0x3b2a80){return function(_0x359583){if(!_0x359583){_0x1c6306[_0x0af8('0x16')](0x194);}return _0x359583;};}function handleError(_0x510efc,_0x500fd5){_0x500fd5=_0x500fd5||0x1f4;return function(_0x315ad){logger[_0x0af8('0x23')](_0x315ad[_0x0af8('0x24')]);if(_0x315ad[_0x0af8('0x25')]){delete _0x315ad[_0x0af8('0x25')];}_0x510efc[_0x0af8('0x17')](_0x500fd5)[_0x0af8('0x26')](_0x315ad);};}exports['index']=function(_0x34aa8b,_0xf898cc){var _0x1a7fdf={},_0x20eab4={},_0x1b94cf={'count':0x0,'rows':[]};var _0x231230=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x270b49){return{'name':_0x270b49[_0x0af8('0x2a')],'type':_0x270b49['type'][_0x0af8('0x2b')]};});_0x20eab4['model']=_[_0x0af8('0x27')](_0x231230,'name');_0x20eab4[_0x0af8('0x2c')]=_[_0x0af8('0x2d')](_0x34aa8b['query']);_0x20eab4[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],_0x20eab4['query']);_0x1a7fdf[_0x0af8('0x31')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],qs['fields'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x32')]));_0x1a7fdf[_0x0af8('0x31')]=_0x1a7fdf[_0x0af8('0x31')][_0x0af8('0x33')]?_0x1a7fdf[_0x0af8('0x31')]:_0x20eab4['model'];if(!_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x34')](_0x0af8('0x35'))){_0x1a7fdf[_0x0af8('0x36')]=qs[_0x0af8('0x36')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x36')]);_0x1a7fdf[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x1a')]);}_0x1a7fdf[_0x0af8('0x37')]=qs['sort'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x38')]);_0x1a7fdf[_0x0af8('0x39')]=qs[_0x0af8('0x2e')](_[_0x0af8('0x3a')](_0x34aa8b[_0x0af8('0x2c')],_0x20eab4[_0x0af8('0x2e')]),_0x231230);if(_0x34aa8b['query'][_0x0af8('0x3b')]){_0x1a7fdf[_0x0af8('0x39')]=_[_0x0af8('0x3c')](_0x1a7fdf['where'],{'$or':_[_0x0af8('0x27')](_0x231230,function(_0x1082de){if(_0x1082de[_0x0af8('0x3d')]!=='VIRTUAL'){var _0x6781fe={};_0x6781fe[_0x1082de[_0x0af8('0x25')]]={'$like':'%'+_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x3b')]+'%'};return _0x6781fe;}})});}_0x1a7fdf=_[_0x0af8('0x3c')]({},_0x1a7fdf,_0x34aa8b[_0x0af8('0x3e')]);var _0x258872={'where':_0x1a7fdf['where']};return db['FreshdeskField'][_0x0af8('0x1b')](_0x258872)[_0x0af8('0x21')](function(_0x5bc8f5){_0x1b94cf[_0x0af8('0x1b')]=_0x5bc8f5;if(_0x34aa8b[_0x0af8('0x2c')]['includeAll']){_0x1a7fdf[_0x0af8('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x0af8('0x40')](_0x1a7fdf);})[_0x0af8('0x21')](function(_0x510bec){_0x1b94cf[_0x0af8('0x41')]=_0x510bec;return _0x1b94cf;})[_0x0af8('0x21')](respondWithFilteredResult(_0xf898cc,_0x1a7fdf))['catch'](handleError(_0xf898cc,null));};exports[_0x0af8('0x42')]=function(_0x496ea4,_0x2e15ec){var _0x423eee={'raw':!![],'where':{'id':_0x496ea4['params']['id']}},_0x141d2f={};_0x141d2f['model']=_[_0x0af8('0x2d')](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x141d2f[_0x0af8('0x2c')]=_['keys'](_0x496ea4[_0x0af8('0x2c')]);_0x141d2f[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x141d2f['model'],_0x141d2f[_0x0af8('0x2c')]);_0x423eee[_0x0af8('0x31')]=_['intersection'](_0x141d2f[_0x0af8('0x30')],qs['fields'](_0x496ea4[_0x0af8('0x2c')]['fields']));_0x423eee['attributes']=_0x423eee['attributes'][_0x0af8('0x33')]?_0x423eee['attributes']:_0x141d2f[_0x0af8('0x30')];if(_0x496ea4['query'][_0x0af8('0x43')]){_0x423eee[_0x0af8('0x3f')]=[{'all':!![]}];}_0x423eee=_[_0x0af8('0x3c')]({},_0x423eee,_0x496ea4[_0x0af8('0x3e')]);return db[_0x0af8('0x28')]['find'](_0x423eee)['then'](handleEntityNotFound(_0x2e15ec,null))[_0x0af8('0x21')](respondWithResult(_0x2e15ec,null))[_0x0af8('0x44')](handleError(_0x2e15ec,null));};exports[_0x0af8('0x45')]=function(_0x24a104,_0x3d86e2){return db[_0x0af8('0x28')][_0x0af8('0x45')](_0x24a104['body'],{})['then'](respondWithResult(_0x3d86e2,0xc9))[_0x0af8('0x44')](handleError(_0x3d86e2,null));};exports[_0x0af8('0x20')]=function(_0x394525,_0x3c57dd){if(_0x394525['body']['id']){delete _0x394525[_0x0af8('0x46')]['id'];}return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x394525[_0x0af8('0x48')]['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x21')](saveUpdates(_0x394525['body'],null))[_0x0af8('0x21')](respondWithResult(_0x3c57dd,null))['catch'](handleError(_0x3c57dd,null));};exports[_0x0af8('0x22')]=function(_0x4a43e3,_0xeddce9){return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x4a43e3['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0xeddce9,null))[_0x0af8('0x21')](removeEntity(_0xeddce9,null))['catch'](handleError(_0xeddce9,null));}; \ No newline at end of file +var _0xa25c=['map','FreshdeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x4f7c71,_0x32ce58){var _0xb7a7e8=function(_0x451ca3){while(--_0x451ca3){_0x4f7c71['push'](_0x4f7c71['shift']());}};_0xb7a7e8(++_0x32ce58);}(_0xa25c,0x13f));var _0xca25=function(_0x4c3ee2,_0x2221fa){_0x4c3ee2=_0x4c3ee2-0x0;var _0x5a5184=_0xa25c[_0x4c3ee2];return _0x5a5184;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={},_0x7b67f4={},_0x190f27={'count':0x0,'rows':[]};var _0x315f76=_[_0xca25('0x29')](db[_0xca25('0x2a')][_0xca25('0x2b')],function(_0x2433bb){return{'name':_0x2433bb[_0xca25('0x2c')],'type':_0x2433bb[_0xca25('0x2d')]['key']};});_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x29')](_0x315f76,_0xca25('0x26'));_0x7b67f4['query']=_[_0xca25('0x2f')](_0xfd888c[_0xca25('0x30')]);_0x7b67f4[_0xca25('0x31')]=_[_0xca25('0x32')](_0x7b67f4[_0xca25('0x2e')],_0x7b67f4[_0xca25('0x30')]);_0x3e72cb['attributes']=_[_0xca25('0x32')](_0x7b67f4['model'],qs[_0xca25('0x33')](_0xfd888c[_0xca25('0x30')][_0xca25('0x33')]));_0x3e72cb['attributes']=_0x3e72cb[_0xca25('0x34')][_0xca25('0x35')]?_0x3e72cb[_0xca25('0x34')]:_0x7b67f4[_0xca25('0x2e')];if(!_0xfd888c[_0xca25('0x30')]['hasOwnProperty'](_0xca25('0x36'))){_0x3e72cb[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0xfd888c[_0xca25('0x30')][_0xca25('0x1a')]);_0x3e72cb[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0xfd888c['query']['offset']);}_0x3e72cb[_0xca25('0x37')]=qs[_0xca25('0x38')](_0xfd888c['query']['sort']);_0x3e72cb[_0xca25('0x39')]=qs[_0xca25('0x31')](_[_0xca25('0x3a')](_0xfd888c['query'],_0x7b67f4[_0xca25('0x31')]),_0x315f76);if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]){_0x3e72cb[_0xca25('0x39')]=_[_0xca25('0x3c')](_0x3e72cb[_0xca25('0x39')],{'$or':_['map'](_0x315f76,function(_0x290537){if(_0x290537['type']!==_0xca25('0x3d')){var _0x25880f={};_0x25880f[_0x290537[_0xca25('0x26')]]={'$like':'%'+_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]+'%'};return _0x25880f;}})});}_0x3e72cb=_[_0xca25('0x3c')]({},_0x3e72cb,_0xfd888c[_0xca25('0x3e')]);var _0x19984f={'where':_0x3e72cb[_0xca25('0x39')]};return db['FreshdeskField'][_0xca25('0x1b')](_0x19984f)['then'](function(_0x2d6f27){_0x190f27['count']=_0x2d6f27;if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3f')]){_0x3e72cb[_0xca25('0x40')]=[{'all':!![]}];}return db[_0xca25('0x2a')]['findAll'](_0x3e72cb);})[_0xca25('0x22')](function(_0x5aafa5){_0x190f27[_0xca25('0x41')]=_0x5aafa5;return _0x190f27;})[_0xca25('0x22')](respondWithFilteredResult(_0x1660a5,_0x3e72cb))['catch'](handleError(_0x1660a5,null));};exports[_0xca25('0x42')]=function(_0x183135,_0x52799a){var _0x2ff9c2={'raw':!![],'where':{'id':_0x183135[_0xca25('0x43')]['id']}},_0x1068c9={};_0x1068c9[_0xca25('0x2e')]=_['keys'](db[_0xca25('0x2a')][_0xca25('0x2b')]);_0x1068c9['query']=_['keys'](_0x183135['query']);_0x1068c9['filters']=_[_0xca25('0x32')](_0x1068c9[_0xca25('0x2e')],_0x1068c9[_0xca25('0x30')]);_0x2ff9c2[_0xca25('0x34')]=_['intersection'](_0x1068c9[_0xca25('0x2e')],qs[_0xca25('0x33')](_0x183135[_0xca25('0x30')][_0xca25('0x33')]));_0x2ff9c2['attributes']=_0x2ff9c2[_0xca25('0x34')]['length']?_0x2ff9c2[_0xca25('0x34')]:_0x1068c9[_0xca25('0x2e')];if(_0x183135[_0xca25('0x30')][_0xca25('0x3f')]){_0x2ff9c2[_0xca25('0x40')]=[{'all':!![]}];}_0x2ff9c2=_[_0xca25('0x3c')]({},_0x2ff9c2,_0x183135['options']);return db[_0xca25('0x2a')][_0xca25('0x44')](_0x2ff9c2)[_0xca25('0x22')](handleEntityNotFound(_0x52799a,null))[_0xca25('0x22')](respondWithResult(_0x52799a,null))[_0xca25('0x45')](handleError(_0x52799a,null));};exports[_0xca25('0x46')]=function(_0x1ad2d0,_0x352a17){return db[_0xca25('0x2a')][_0xca25('0x46')](_0x1ad2d0[_0xca25('0x47')],{})[_0xca25('0x22')](respondWithResult(_0x352a17,0xc9))[_0xca25('0x45')](handleError(_0x352a17,null));};exports[_0xca25('0x21')]=function(_0x3279e0,_0x1fba32){if(_0x3279e0[_0xca25('0x47')]['id']){delete _0x3279e0[_0xca25('0x47')]['id'];}return db['FreshdeskField'][_0xca25('0x44')]({'where':{'id':_0x3279e0[_0xca25('0x43')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1fba32,null))[_0xca25('0x22')](saveUpdates(_0x3279e0['body'],null))[_0xca25('0x22')](respondWithResult(_0x1fba32,null))[_0xca25('0x45')](handleError(_0x1fba32,null));};exports['destroy']=function(_0x2bc528,_0x10692f){return db[_0xca25('0x2a')][_0xca25('0x44')]({'where':{'id':_0x2bc528['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x10692f,null))['then'](removeEntity(_0x10692f,null))[_0xca25('0x45')](handleError(_0x10692f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4b1ee49..d734d00 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 _0x57d4=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0x57d4,0x78));var _0x457d=function(_0x144b65,_0x2dd9fa){_0x144b65=_0x144b65-0x0;var _0x27d65d=_0x57d4[_0x144b65];return _0x27d65d;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x457d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['request-promise','path','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xed1c,0x7f));var _0xced1=function(_0x162419,_0x53310c){_0x162419=_0x162419-0x0;var _0xc3c9b6=_0xed1c[_0x162419];return _0xc3c9b6;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')(_0xced1('0x2'));var moment=require(_0xced1('0x3'));var BPromise=require(_0xced1('0x4'));var rp=require(_0xced1('0x5'));var fs=require('fs');var path=require(_0xced1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xced1('0x7')]=function(_0x4846c3,_0x39baa1){return _0x4846c3['define'](_0xced1('0x8'),attributes,{'tableName':_0xced1('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xced1('0xa'),_0xced1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c47a425..4457922 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 _0xb2f0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x5c6a11,_0x1c6689){var _0xe3fccf=function(_0x1cc007){while(--_0x1cc007){_0x5c6a11['push'](_0x5c6a11['shift']());}};_0xe3fccf(++_0x1c6689);}(_0xb2f0,0x14d));var _0x0b2f=function(_0x2a7781,_0x6feff8){_0x2a7781=_0x2a7781-0x0;var _0x44d749=_0xb2f0[_0x2a7781];return _0x44d749;};'use strict';var _=require(_0x0b2f('0x0'));var util=require(_0x0b2f('0x1'));var moment=require(_0x0b2f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b2f('0x3'));var fs=require('fs');var Redis=require(_0x0b2f('0x4'));var db=require(_0x0b2f('0x5'))['db'];var utils=require(_0x0b2f('0x6'));var logger=require(_0x0b2f('0x7'))(_0x0b2f('0x8'));var config=require(_0x0b2f('0x9'));var jayson=require(_0x0b2f('0xa'));var client=jayson[_0x0b2f('0xb')][_0x0b2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdcc9ed,_0x420177,_0x35dee6){return new BPromise(function(_0x11dc81,_0x17ae0e){return client['request'](_0xdcc9ed,_0x35dee6)[_0x0b2f('0xd')](function(_0x412fb2){logger[_0x0b2f('0xe')](_0x0b2f('0xf'),_0x420177,_0x0b2f('0x10'));logger[_0x0b2f('0x11')](_0x0b2f('0x12'),_0x420177,_0x0b2f('0x10'),JSON['stringify'](_0x412fb2));if(_0x412fb2[_0x0b2f('0x13')]){if(_0x412fb2[_0x0b2f('0x13')][_0x0b2f('0x14')]===0x1f4){logger[_0x0b2f('0x13')](_0x0b2f('0xf'),_0x420177,_0x412fb2[_0x0b2f('0x13')][_0x0b2f('0x15')]);return _0x17ae0e(_0x412fb2[_0x0b2f('0x13')][_0x0b2f('0x15')]);}logger['error'](_0x0b2f('0xf'),_0x420177,_0x412fb2['error']['message']);return _0x11dc81(_0x412fb2[_0x0b2f('0x13')][_0x0b2f('0x15')]);}else{logger[_0x0b2f('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x420177,'request\x20sent');_0x11dc81(_0x412fb2[_0x0b2f('0x16')]['message']);}})[_0x0b2f('0x17')](function(_0x44c145){logger[_0x0b2f('0x13')](_0x0b2f('0xf'),_0x420177,_0x44c145);_0x17ae0e(_0x44c145);});});} \ No newline at end of file +var _0x6f53=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x12ec39,_0x2cd90e){var _0x54c1ef=function(_0x2923b4){while(--_0x2923b4){_0x12ec39['push'](_0x12ec39['shift']());}};_0x54c1ef(++_0x2cd90e);}(_0x6f53,0x11c));var _0x36f5=function(_0x4199b4,_0x4c1a97){_0x4199b4=_0x4199b4-0x0;var _0x2f0342=_0x6f53[_0x4199b4];return _0x2f0342;};'use strict';var _=require('lodash');var util=require(_0x36f5('0x0'));var moment=require(_0x36f5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f5('0x2'));var db=require(_0x36f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36f5('0x4'));var config=require(_0x36f5('0x5'));var jayson=require(_0x36f5('0x6'));var client=jayson[_0x36f5('0x7')][_0x36f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31e1a3,_0xe62b76,_0x1182bd){return new BPromise(function(_0x3a0949,_0x13b6f9){return client['request'](_0x31e1a3,_0x1182bd)[_0x36f5('0x9')](function(_0x55f723){logger[_0x36f5('0xa')](_0x36f5('0xb'),_0xe62b76,_0x36f5('0xc'));logger[_0x36f5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xe62b76,'request\x20sent',JSON['stringify'](_0x55f723));if(_0x55f723[_0x36f5('0xe')]){if(_0x55f723[_0x36f5('0xe')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0xe62b76,_0x55f723[_0x36f5('0xe')]['message']);return _0x13b6f9(_0x55f723[_0x36f5('0xe')]['message']);}logger[_0x36f5('0xe')](_0x36f5('0xb'),_0xe62b76,_0x55f723['error'][_0x36f5('0xf')]);return _0x3a0949(_0x55f723[_0x36f5('0xe')][_0x36f5('0xf')]);}else{logger[_0x36f5('0xa')]('FreshdeskField,\x20%s,\x20%s',_0xe62b76,_0x36f5('0xc'));_0x3a0949(_0x55f723[_0x36f5('0x10')][_0x36f5('0xf')]);}})[_0x36f5('0x11')](function(_0x34e25f){logger[_0x36f5('0xe')](_0x36f5('0xb'),_0xe62b76,_0x34e25f);_0x13b6f9(_0x34e25f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 10a52d7..bc31270 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 _0xbaf0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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['show']);router[_0x0baf('0x9')]('/:id/configurations',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x10')](_0x0baf('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0baf('0x13')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['delete'](_0x0baf('0xc'),auth['isAuthenticated'](),controller[_0x0baf('0x15')]);module[_0x0baf('0x16')]=router; \ No newline at end of file +var _0x351d=['index','/:id','/:id/configurations','getFields','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x351d,0x90));var _0xd351=function(_0x34aa42,_0x3d6a77){_0x34aa42=_0x34aa42-0x0;var _0x149418=_0x351d[_0x34aa42];return _0x149418;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var fs_extra=require(_0xd351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xd351('0x7')]('/',auth[_0xd351('0x8')](),controller[_0xd351('0x9')]);router['get'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['show']);router[_0xd351('0x7')](_0xd351('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd351('0x7')]('/:id/fields',auth[_0xd351('0x8')](),controller[_0xd351('0xc')]);router['post']('/',auth[_0xd351('0x8')](),controller[_0xd351('0xd')]);router['post'](_0xd351('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd351('0xe')](_0xd351('0xa'),auth[_0xd351('0x8')](),controller[_0xd351('0xf')]);router['delete'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['destroy']);module[_0xd351('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 615e971..4c2330b 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 _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1d625c,_0x48d04d){var _0x25d3b0=function(_0x2ae510){while(--_0x2ae510){_0x1d625c['push'](_0x1d625c['shift']());}};_0x25d3b0(++_0x48d04d);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5b12,0xa3));var _0x25b1=function(_0x1a4c48,_0x2ec891){_0x1a4c48=_0x1a4c48-0x0;var _0x3a4aba=_0x5b12[_0x1a4c48];return _0x3a4aba;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 140e634..4f2c8ef 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 _0xd743=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','FreshsalesAccount','includeAll','include','findAll','catch','show','options','create','update','body','find','params','getConfigurations','findOne','FreshsalesConfiguration','map','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','remoteUri','slice','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch'];(function(_0x24d7ef,_0x525545){var _0x58cd2b=function(_0x2bae48){while(--_0x2bae48){_0x24d7ef['push'](_0x24d7ef['shift']());}};_0x58cd2b(++_0x525545);}(_0xd743,0xc2));var _0x3d74=function(_0xf49029,_0xacbe93){_0xf49029=_0xf49029-0x0;var _0x44d6df=_0xd743[_0xf49029];return _0x44d6df;};'use strict';var emlformat=require(_0x3d74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d74('0x1'));var rp=require('request-promise');var moment=require(_0x3d74('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3d74('0x3'));var util=require(_0x3d74('0x4'));var path=require(_0x3d74('0x5'));var sox=require(_0x3d74('0x6'));var csv=require(_0x3d74('0x7'));var ejs=require(_0x3d74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d74('0x9'));var squel=require(_0x3d74('0xa'));var crypto=require(_0x3d74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3d74('0xc'));var toCsv=require(_0x3d74('0x7'));var querystring=require(_0x3d74('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3d74('0xe'));var qs=require(_0x3d74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d74('0x10'))(_0x3d74('0x11'));var utils=require(_0x3d74('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3d74('0x13'));function respondWithStatusCode(_0x2cd9db,_0x309143){_0x309143=_0x309143||0xcc;return function(_0x397117){if(_0x397117){return _0x2cd9db[_0x3d74('0x14')](_0x309143);}return _0x2cd9db[_0x3d74('0x15')](_0x309143)[_0x3d74('0x16')]();};}function respondWithResult(_0x3771dc,_0x27f214){_0x27f214=_0x27f214||0xc8;return function(_0x1bbf24){if(_0x1bbf24){return _0x3771dc[_0x3d74('0x15')](_0x27f214)[_0x3d74('0x17')](_0x1bbf24);}};}function respondWithFilteredResult(_0x28a977,_0x2166d5){return function(_0x3816d6){if(_0x3816d6){var _0x4405ed=typeof _0x2166d5['offset']===_0x3d74('0x18')&&typeof _0x2166d5['limit']===_0x3d74('0x18');var _0x10d648=_0x3816d6[_0x3d74('0x19')];var _0x2237cc=_0x4405ed?0x0:_0x2166d5[_0x3d74('0x1a')];var _0x610225=_0x4405ed?_0x3816d6['count']:_0x2166d5[_0x3d74('0x1a')]+_0x2166d5[_0x3d74('0x1b')];var _0x478781;if(_0x610225>=_0x10d648){_0x610225=_0x10d648;_0x478781=0xc8;}else{_0x478781=0xce;}_0x28a977[_0x3d74('0x15')](_0x478781);return _0x28a977['set'](_0x3d74('0x1c'),_0x2237cc+'-'+_0x610225+'/'+_0x10d648)['json'](_0x3816d6);}return null;};}function patchUpdates(_0x52c56a){return function(_0x5e6d9b){try{jsonpatch[_0x3d74('0x1d')](_0x5e6d9b,_0x52c56a,!![]);}catch(_0x5442af){return BPromise[_0x3d74('0x1e')](_0x5442af);}return _0x5e6d9b[_0x3d74('0x1f')]();};}function saveUpdates(_0x14df6e,_0x279c4e){return function(_0xda8587){if(_0xda8587){return _0xda8587['update'](_0x14df6e)[_0x3d74('0x20')](function(_0x193f86){return _0x193f86;});}return null;};}function removeEntity(_0x448e3c,_0x43a861){return function(_0x2f2e82){if(_0x2f2e82){return _0x2f2e82[_0x3d74('0x21')]()[_0x3d74('0x20')](function(){_0x448e3c[_0x3d74('0x15')](0xcc)[_0x3d74('0x16')]();});}};}function handleEntityNotFound(_0x14d9e5,_0x4b0872){return function(_0x58dec5){if(!_0x58dec5){_0x14d9e5['sendStatus'](0x194);}return _0x58dec5;};}function handleError(_0x2c9ee9,_0x2a70dc){_0x2a70dc=_0x2a70dc||0x1f4;return function(_0x50a989){logger[_0x3d74('0x22')](_0x50a989['stack']);if(_0x50a989[_0x3d74('0x23')]){delete _0x50a989[_0x3d74('0x23')];}_0x2c9ee9[_0x3d74('0x15')](_0x2a70dc)[_0x3d74('0x24')](_0x50a989);};}exports[_0x3d74('0x25')]=function(_0x2a686f,_0x2875cf){var _0x2478ac={},_0x555a3d={},_0x46fc83={'count':0x0,'rows':[]};var _0x5e2b07=_['map'](db['FreshsalesAccount'][_0x3d74('0x26')],function(_0x4fa55e){return{'name':_0x4fa55e[_0x3d74('0x27')],'type':_0x4fa55e[_0x3d74('0x28')][_0x3d74('0x29')]};});_0x555a3d[_0x3d74('0x2a')]=_['map'](_0x5e2b07,_0x3d74('0x23'));_0x555a3d[_0x3d74('0x2b')]=_[_0x3d74('0x2c')](_0x2a686f['query']);_0x555a3d[_0x3d74('0x2d')]=_[_0x3d74('0x2e')](_0x555a3d[_0x3d74('0x2a')],_0x555a3d[_0x3d74('0x2b')]);_0x2478ac['attributes']=_[_0x3d74('0x2e')](_0x555a3d[_0x3d74('0x2a')],qs[_0x3d74('0x2f')](_0x2a686f[_0x3d74('0x2b')]['fields']));_0x2478ac[_0x3d74('0x30')]=_0x2478ac[_0x3d74('0x30')][_0x3d74('0x31')]?_0x2478ac[_0x3d74('0x30')]:_0x555a3d['model'];if(!_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x32')](_0x3d74('0x33'))){_0x2478ac['limit']=qs[_0x3d74('0x1b')](_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x1b')]);_0x2478ac[_0x3d74('0x1a')]=qs[_0x3d74('0x1a')](_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x1a')]);}_0x2478ac[_0x3d74('0x34')]=qs[_0x3d74('0x35')](_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x35')]);_0x2478ac[_0x3d74('0x36')]=qs[_0x3d74('0x2d')](_[_0x3d74('0x37')](_0x2a686f[_0x3d74('0x2b')],_0x555a3d[_0x3d74('0x2d')]),_0x5e2b07);if(_0x2a686f[_0x3d74('0x2b')]['filter']){_0x2478ac[_0x3d74('0x36')]=_[_0x3d74('0x38')](_0x2478ac[_0x3d74('0x36')],{'$or':_['map'](_0x5e2b07,function(_0x318f40){if(_0x318f40[_0x3d74('0x28')]!==_0x3d74('0x39')){var _0x41e826={};_0x41e826[_0x318f40[_0x3d74('0x23')]]={'$like':'%'+_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x3a')]+'%'};return _0x41e826;}})});}_0x2478ac=_[_0x3d74('0x38')]({},_0x2478ac,_0x2a686f['options']);var _0x53a139={'where':_0x2478ac['where']};return db[_0x3d74('0x3b')][_0x3d74('0x19')](_0x53a139)[_0x3d74('0x20')](function(_0x434297){_0x46fc83[_0x3d74('0x19')]=_0x434297;if(_0x2a686f[_0x3d74('0x2b')][_0x3d74('0x3c')]){_0x2478ac[_0x3d74('0x3d')]=[{'all':!![]}];}return db[_0x3d74('0x3b')][_0x3d74('0x3e')](_0x2478ac);})[_0x3d74('0x20')](function(_0x2779bb){_0x46fc83['rows']=_0x2779bb;return _0x46fc83;})[_0x3d74('0x20')](respondWithFilteredResult(_0x2875cf,_0x2478ac))[_0x3d74('0x3f')](handleError(_0x2875cf,null));};exports[_0x3d74('0x40')]=function(_0x36b746,_0x144a7b){var _0xf3f9a5={'raw':![],'where':{'id':_0x36b746['params']['id']}},_0x421fa2={};_0x421fa2[_0x3d74('0x2a')]=_[_0x3d74('0x2c')](db['FreshsalesAccount']['rawAttributes']);_0x421fa2['query']=_[_0x3d74('0x2c')](_0x36b746[_0x3d74('0x2b')]);_0x421fa2[_0x3d74('0x2d')]=_[_0x3d74('0x2e')](_0x421fa2[_0x3d74('0x2a')],_0x421fa2['query']);_0xf3f9a5[_0x3d74('0x30')]=_[_0x3d74('0x2e')](_0x421fa2[_0x3d74('0x2a')],qs[_0x3d74('0x2f')](_0x36b746[_0x3d74('0x2b')][_0x3d74('0x2f')]));_0xf3f9a5[_0x3d74('0x30')]=_0xf3f9a5[_0x3d74('0x30')]['length']?_0xf3f9a5[_0x3d74('0x30')]:_0x421fa2[_0x3d74('0x2a')];if(_0x36b746[_0x3d74('0x2b')][_0x3d74('0x3c')]){_0xf3f9a5[_0x3d74('0x3d')]=[{'all':!![]}];}_0xf3f9a5=_[_0x3d74('0x38')]({},_0xf3f9a5,_0x36b746[_0x3d74('0x41')]);return db['FreshsalesAccount']['find'](_0xf3f9a5)[_0x3d74('0x20')](handleEntityNotFound(_0x144a7b,null))[_0x3d74('0x20')](respondWithResult(_0x144a7b,null))[_0x3d74('0x3f')](handleError(_0x144a7b,null));};exports[_0x3d74('0x42')]=function(_0x4ef8f2,_0x3840df){return db[_0x3d74('0x3b')][_0x3d74('0x42')](_0x4ef8f2['body'],{})['then'](respondWithResult(_0x3840df,0xc9))['catch'](handleError(_0x3840df,null));};exports[_0x3d74('0x43')]=function(_0x5d93ab,_0x144bd5){if(_0x5d93ab['body']['id']){delete _0x5d93ab[_0x3d74('0x44')]['id'];}return db[_0x3d74('0x3b')][_0x3d74('0x45')]({'where':{'id':_0x5d93ab[_0x3d74('0x46')]['id']}})[_0x3d74('0x20')](handleEntityNotFound(_0x144bd5,null))[_0x3d74('0x20')](saveUpdates(_0x5d93ab[_0x3d74('0x44')],null))[_0x3d74('0x20')](respondWithResult(_0x144bd5,null))[_0x3d74('0x3f')](handleError(_0x144bd5,null));};exports[_0x3d74('0x21')]=function(_0x50255f,_0x2f5552){return db[_0x3d74('0x3b')][_0x3d74('0x45')]({'where':{'id':_0x50255f[_0x3d74('0x46')]['id']}})[_0x3d74('0x20')](handleEntityNotFound(_0x2f5552,null))[_0x3d74('0x20')](removeEntity(_0x2f5552,null))['catch'](handleError(_0x2f5552,null));};exports[_0x3d74('0x47')]=function(_0x1a39a3,_0x3add91,_0x372d59){var _0x3198b5={};var _0x14e5c6={};var _0x4ea90a;var _0x4295dd;return db[_0x3d74('0x3b')][_0x3d74('0x48')]({'where':{'id':_0x1a39a3[_0x3d74('0x46')]['id']}})[_0x3d74('0x20')](handleEntityNotFound(_0x3add91,null))['then'](function(_0x167144){if(_0x167144){_0x4ea90a=_0x167144;_0x14e5c6[_0x3d74('0x2a')]=_[_0x3d74('0x2c')](db[_0x3d74('0x49')][_0x3d74('0x26')]);_0x14e5c6[_0x3d74('0x2b')]=_[_0x3d74('0x2c')](_0x1a39a3[_0x3d74('0x2b')]);_0x14e5c6[_0x3d74('0x2d')]=_[_0x3d74('0x2e')](_0x14e5c6[_0x3d74('0x2a')],_0x14e5c6[_0x3d74('0x2b')]);_0x3198b5['attributes']=_[_0x3d74('0x2e')](_0x14e5c6[_0x3d74('0x2a')],qs['fields'](_0x1a39a3[_0x3d74('0x2b')]['fields']));_0x3198b5[_0x3d74('0x30')]=_0x3198b5[_0x3d74('0x30')][_0x3d74('0x31')]?_0x3198b5['attributes']:_0x14e5c6[_0x3d74('0x2a')];_0x3198b5[_0x3d74('0x34')]=qs[_0x3d74('0x35')](_0x1a39a3[_0x3d74('0x2b')]['sort']);_0x3198b5['where']=qs[_0x3d74('0x2d')](_[_0x3d74('0x37')](_0x1a39a3['query'],_0x14e5c6[_0x3d74('0x2d')]));if(_0x1a39a3[_0x3d74('0x2b')]['filter']){_0x3198b5[_0x3d74('0x36')]=_[_0x3d74('0x38')](_0x3198b5[_0x3d74('0x36')],{'$or':_[_0x3d74('0x4a')](_0x3198b5[_0x3d74('0x30')],function(_0x2ea0b8){var _0x5184f0={};_0x5184f0[_0x2ea0b8]={'$like':'%'+_0x1a39a3['query'][_0x3d74('0x3a')]+'%'};return _0x5184f0;})});}_0x3198b5=_[_0x3d74('0x38')]({},_0x3198b5,_0x1a39a3['options']);return _0x4ea90a[_0x3d74('0x47')](_0x3198b5);}})['then'](function(_0x432c14){if(_0x432c14){_0x4295dd=_0x432c14[_0x3d74('0x31')];if(!_0x1a39a3[_0x3d74('0x2b')]['hasOwnProperty'](_0x3d74('0x33'))){_0x3198b5['limit']=qs['limit'](_0x1a39a3[_0x3d74('0x2b')][_0x3d74('0x1b')]);_0x3198b5[_0x3d74('0x1a')]=qs[_0x3d74('0x1a')](_0x1a39a3[_0x3d74('0x2b')][_0x3d74('0x1a')]);}return _0x4ea90a[_0x3d74('0x47')](_0x3198b5);}})[_0x3d74('0x20')](function(_0x1ce75a){if(_0x1ce75a){return _0x1ce75a?{'count':_0x4295dd,'rows':_0x1ce75a}:null;}})[_0x3d74('0x20')](respondWithResult(_0x3add91,null))[_0x3d74('0x3f')](handleError(_0x3add91,null));};exports[_0x3d74('0x4b')]=function(_0x2b7eb7,_0x35fc1b,_0x22c978){if(_0x2b7eb7[_0x3d74('0x44')]['id']){delete _0x2b7eb7[_0x3d74('0x44')]['id'];}return db[_0x3d74('0x3b')][_0x3d74('0x48')]({'where':{'id':_0x2b7eb7[_0x3d74('0x46')]['id']}})[_0x3d74('0x20')](handleEntityNotFound(_0x35fc1b,null))[_0x3d74('0x20')](function(_0x2cf5bd){if(_0x2cf5bd){_0x2b7eb7[_0x3d74('0x44')]['AccountId']=_0x2cf5bd['id'];_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x4c')]=integrations['getSubjects'](_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x4d')],_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x28')]);_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x4e')]=integrations[_0x3d74('0x4f')](_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x4d')],_0x2b7eb7[_0x3d74('0x44')][_0x3d74('0x28')]);return db[_0x3d74('0x49')]['create'](_0x2b7eb7[_0x3d74('0x44')],{'include':[{'model':db[_0x3d74('0x50')],'as':'Subjects'},{'model':db[_0x3d74('0x50')],'as':_0x3d74('0x4e')}]});}return null;})[_0x3d74('0x20')](respondWithResult(_0x35fc1b,null))['catch'](handleError(_0x35fc1b,null));};exports[_0x3d74('0x51')]=function(_0x271db0,_0x27983c,_0x516c42){var _0x2968ff='';var _0x27f15f='';return db[_0x3d74('0x3b')]['findOne']({'where':{'id':_0x271db0[_0x3d74('0x46')]['id']},'attributes':['id','username','remoteUri',_0x3d74('0x52')]})[_0x3d74('0x20')](handleEntityNotFound(_0x27983c,null))[_0x3d74('0x20')](function(_0x39a619){if(_0x39a619){_0x27f15f=_0x39a619['username'];_0x2968ff=_0x39a619[_0x3d74('0x53')];var _0x232742=_0x39a619[_0x3d74('0x53')][_0x3d74('0x54')](-0x1);if(_0x232742==='/'){_0x2968ff=_0x2968ff['substring'](0x0,_0x2968ff[_0x3d74('0x55')](_0x232742));}return rp({'method':_0x3d74('0x56'),'uri':util[_0x3d74('0x57')](_0x3d74('0x58'),_0x2968ff,'/api/selector/owners'),'headers':{'Authorization':_0x3d74('0x59')+_0x39a619[_0x3d74('0x52')]},'json':!![]});}})[_0x3d74('0x20')](function(_0x1ea012){if(_0x1ea012){var _0xde5aa4=_0x1ea012[_0x3d74('0x5a')];var _0x24cd96=![];var _0xe77201=null;for(_0xe77201=0x0;_0xe77201<_0xde5aa4[_0x3d74('0x31')];_0xe77201++){if(_0xde5aa4[_0xe77201][_0x3d74('0x5b')]===_0x27f15f){_0x24cd96=!![];}}if(_0x24cd96){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3d74('0x5c')});}}})[_0x3d74('0x20')](respondWithResult(_0x27983c,null))[_0x3d74('0x3f')](function(_0x1e61e0){var _0x2e41de=_0x271db0['query'][_0x3d74('0x5d')]?0x1f4:_0x1e61e0[_0x3d74('0x5e')]||0x1f4;logger[_0x3d74('0x22')](_0x3d74('0x5f'),'getFields',_0x2e41de,JSON[_0x3d74('0x60')](_0x1e61e0));delete _0x1e61e0[_0x3d74('0x23')];if(_0x2e41de===0x191){_0x2e41de=0x190;}_0x27983c[_0x3d74('0x15')](_0x2e41de)[_0x3d74('0x24')](_0x271db0[_0x3d74('0x2b')][_0x3d74('0x5d')]?{'message':_0x3d74('0x61'),'statusCode':_0x1e61e0[_0x3d74('0x5e')]}:_0x1e61e0);});}; \ No newline at end of file +var _0xca8b=['limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','FreshsalesAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../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'];(function(_0x51f5a1,_0x5238d4){var _0x39215b=function(_0x43f9fa){while(--_0x43f9fa){_0x51f5a1['push'](_0x51f5a1['shift']());}};_0x39215b(++_0x5238d4);}(_0xca8b,0xb7));var _0xbca8=function(_0x3368e5,_0x473946){_0x3368e5=_0x3368e5-0x0;var _0x34f28c=_0xca8b[_0x3368e5];return _0x34f28c;};'use strict';var emlformat=require(_0xbca8('0x0'));var rimraf=require(_0xbca8('0x1'));var zipdir=require(_0xbca8('0x2'));var jsonpatch=require(_0xbca8('0x3'));var rp=require(_0xbca8('0x4'));var moment=require('moment');var BPromise=require(_0xbca8('0x5'));var Mustache=require(_0xbca8('0x6'));var util=require(_0xbca8('0x7'));var path=require(_0xbca8('0x8'));var sox=require(_0xbca8('0x9'));var csv=require('to-csv');var ejs=require(_0xbca8('0xa'));var fs=require('fs');var fs_extra=require(_0xbca8('0xb'));var _=require('lodash');var squel=require(_0xbca8('0xc'));var crypto=require(_0xbca8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbca8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbca8('0xf'));var Papa=require(_0xbca8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbca8('0x11'));var as=require(_0xbca8('0x12'));var hardwareService=require(_0xbca8('0x13'));var logger=require(_0xbca8('0x14'))(_0xbca8('0x15'));var utils=require(_0xbca8('0x16'));var config=require(_0xbca8('0x17'));var licenseUtil=require(_0xbca8('0x18'));var db=require(_0xbca8('0x19'))['db'];var integrations=require(_0xbca8('0x1a'));function respondWithStatusCode(_0x28c878,_0x2a152d){_0x2a152d=_0x2a152d||0xcc;return function(_0x2a815d){if(_0x2a815d){return _0x28c878[_0xbca8('0x1b')](_0x2a152d);}return _0x28c878[_0xbca8('0x1c')](_0x2a152d)[_0xbca8('0x1d')]();};}function respondWithResult(_0x557671,_0x2a6f36){_0x2a6f36=_0x2a6f36||0xc8;return function(_0x2f1321){if(_0x2f1321){return _0x557671[_0xbca8('0x1c')](_0x2a6f36)[_0xbca8('0x1e')](_0x2f1321);}};}function respondWithFilteredResult(_0x2285f5,_0x34b99e){return function(_0x4cb48c){if(_0x4cb48c){var _0x2ef1f8=typeof _0x34b99e[_0xbca8('0x1f')]===_0xbca8('0x20')&&typeof _0x34b99e[_0xbca8('0x21')]==='undefined';var _0x433cc7=_0x4cb48c[_0xbca8('0x22')];var _0xf873fb=_0x2ef1f8?0x0:_0x34b99e[_0xbca8('0x1f')];var _0x7f9053=_0x2ef1f8?_0x4cb48c['count']:_0x34b99e['offset']+_0x34b99e[_0xbca8('0x21')];var _0x428246;if(_0x7f9053>=_0x433cc7){_0x7f9053=_0x433cc7;_0x428246=0xc8;}else{_0x428246=0xce;}_0x2285f5[_0xbca8('0x1c')](_0x428246);return _0x2285f5[_0xbca8('0x23')](_0xbca8('0x24'),_0xf873fb+'-'+_0x7f9053+'/'+_0x433cc7)[_0xbca8('0x1e')](_0x4cb48c);}return null;};}function patchUpdates(_0xbbe06e){return function(_0x4f2f54){try{jsonpatch[_0xbca8('0x25')](_0x4f2f54,_0xbbe06e,!![]);}catch(_0xc672f4){return BPromise[_0xbca8('0x26')](_0xc672f4);}return _0x4f2f54['save']();};}function saveUpdates(_0x57b26a,_0x217f12){return function(_0x2e934d){if(_0x2e934d){return _0x2e934d['update'](_0x57b26a)[_0xbca8('0x27')](function(_0x14cf5b){return _0x14cf5b;});}return null;};}function removeEntity(_0x19bdb0,_0x3c2c22){return function(_0x1db152){if(_0x1db152){return _0x1db152[_0xbca8('0x28')]()['then'](function(){_0x19bdb0[_0xbca8('0x1c')](0xcc)[_0xbca8('0x1d')]();});}};}function handleEntityNotFound(_0xa082f4,_0x93eeab){return function(_0x146012){if(!_0x146012){_0xa082f4[_0xbca8('0x1b')](0x194);}return _0x146012;};}function handleError(_0x2ac8a8,_0xf693e5){_0xf693e5=_0xf693e5||0x1f4;return function(_0x625775){logger[_0xbca8('0x29')](_0x625775[_0xbca8('0x2a')]);if(_0x625775[_0xbca8('0x2b')]){delete _0x625775[_0xbca8('0x2b')];}_0x2ac8a8['status'](_0xf693e5)[_0xbca8('0x2c')](_0x625775);};}exports['index']=function(_0x1f16b6,_0x4241cc){var _0x5004f2={},_0x1161dd={},_0x1ae285={'count':0x0,'rows':[]};var _0x5e7841=_['map'](db['FreshsalesAccount'][_0xbca8('0x2d')],function(_0x33c0ba){return{'name':_0x33c0ba[_0xbca8('0x2e')],'type':_0x33c0ba['type'][_0xbca8('0x2f')]};});_0x1161dd[_0xbca8('0x30')]=_[_0xbca8('0x31')](_0x5e7841,_0xbca8('0x2b'));_0x1161dd['query']=_[_0xbca8('0x32')](_0x1f16b6[_0xbca8('0x33')]);_0x1161dd[_0xbca8('0x34')]=_[_0xbca8('0x35')](_0x1161dd['model'],_0x1161dd['query']);_0x5004f2[_0xbca8('0x36')]=_[_0xbca8('0x35')](_0x1161dd[_0xbca8('0x30')],qs[_0xbca8('0x37')](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x37')]));_0x5004f2[_0xbca8('0x36')]=_0x5004f2[_0xbca8('0x36')]['length']?_0x5004f2[_0xbca8('0x36')]:_0x1161dd[_0xbca8('0x30')];if(!_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x38')](_0xbca8('0x39'))){_0x5004f2[_0xbca8('0x21')]=qs['limit'](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x21')]);_0x5004f2[_0xbca8('0x1f')]=qs[_0xbca8('0x1f')](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x1f')]);}_0x5004f2[_0xbca8('0x3a')]=qs[_0xbca8('0x3b')](_0x1f16b6['query']['sort']);_0x5004f2[_0xbca8('0x3c')]=qs[_0xbca8('0x34')](_[_0xbca8('0x3d')](_0x1f16b6[_0xbca8('0x33')],_0x1161dd[_0xbca8('0x34')]),_0x5e7841);if(_0x1f16b6['query'][_0xbca8('0x3e')]){_0x5004f2[_0xbca8('0x3c')]=_[_0xbca8('0x3f')](_0x5004f2[_0xbca8('0x3c')],{'$or':_['map'](_0x5e7841,function(_0x44b28d){if(_0x44b28d[_0xbca8('0x40')]!=='VIRTUAL'){var _0x403f44={};_0x403f44[_0x44b28d[_0xbca8('0x2b')]]={'$like':'%'+_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x3e')]+'%'};return _0x403f44;}})});}_0x5004f2=_['merge']({},_0x5004f2,_0x1f16b6[_0xbca8('0x41')]);var _0x519963={'where':_0x5004f2['where']};return db[_0xbca8('0x42')][_0xbca8('0x22')](_0x519963)['then'](function(_0x576033){_0x1ae285[_0xbca8('0x22')]=_0x576033;if(_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x43')]){_0x5004f2['include']=[{'all':!![]}];}return db[_0xbca8('0x42')][_0xbca8('0x44')](_0x5004f2);})[_0xbca8('0x27')](function(_0x3e9836){_0x1ae285[_0xbca8('0x45')]=_0x3e9836;return _0x1ae285;})[_0xbca8('0x27')](respondWithFilteredResult(_0x4241cc,_0x5004f2))[_0xbca8('0x46')](handleError(_0x4241cc,null));};exports[_0xbca8('0x47')]=function(_0x5808,_0x2c96e0){var _0xe3e6ab={'raw':![],'where':{'id':_0x5808[_0xbca8('0x48')]['id']}},_0x20bcfa={};_0x20bcfa[_0xbca8('0x30')]=_[_0xbca8('0x32')](db[_0xbca8('0x42')][_0xbca8('0x2d')]);_0x20bcfa['query']=_['keys'](_0x5808[_0xbca8('0x33')]);_0x20bcfa['filters']=_[_0xbca8('0x35')](_0x20bcfa[_0xbca8('0x30')],_0x20bcfa[_0xbca8('0x33')]);_0xe3e6ab['attributes']=_[_0xbca8('0x35')](_0x20bcfa[_0xbca8('0x30')],qs['fields'](_0x5808[_0xbca8('0x33')][_0xbca8('0x37')]));_0xe3e6ab[_0xbca8('0x36')]=_0xe3e6ab[_0xbca8('0x36')][_0xbca8('0x49')]?_0xe3e6ab['attributes']:_0x20bcfa[_0xbca8('0x30')];if(_0x5808['query'][_0xbca8('0x43')]){_0xe3e6ab[_0xbca8('0x4a')]=[{'all':!![]}];}_0xe3e6ab=_[_0xbca8('0x3f')]({},_0xe3e6ab,_0x5808[_0xbca8('0x41')]);return db[_0xbca8('0x42')][_0xbca8('0x4b')](_0xe3e6ab)[_0xbca8('0x27')](handleEntityNotFound(_0x2c96e0,null))[_0xbca8('0x27')](respondWithResult(_0x2c96e0,null))[_0xbca8('0x46')](handleError(_0x2c96e0,null));};exports['create']=function(_0x33ef9b,_0x66f71d){return db['FreshsalesAccount'][_0xbca8('0x4c')](_0x33ef9b[_0xbca8('0x4d')],{})[_0xbca8('0x27')](respondWithResult(_0x66f71d,0xc9))[_0xbca8('0x46')](handleError(_0x66f71d,null));};exports[_0xbca8('0x4e')]=function(_0x5c62ed,_0x3beae6){if(_0x5c62ed[_0xbca8('0x4d')]['id']){delete _0x5c62ed[_0xbca8('0x4d')]['id'];}return db[_0xbca8('0x42')][_0xbca8('0x4b')]({'where':{'id':_0x5c62ed[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x3beae6,null))[_0xbca8('0x27')](saveUpdates(_0x5c62ed['body'],null))[_0xbca8('0x27')](respondWithResult(_0x3beae6,null))[_0xbca8('0x46')](handleError(_0x3beae6,null));};exports['destroy']=function(_0x56bcf9,_0x4a74cc){return db[_0xbca8('0x42')][_0xbca8('0x4b')]({'where':{'id':_0x56bcf9[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a74cc,null))[_0xbca8('0x27')](removeEntity(_0x4a74cc,null))[_0xbca8('0x46')](handleError(_0x4a74cc,null));};exports[_0xbca8('0x4f')]=function(_0x266e7a,_0x33674f,_0x35e016){var _0x306565={};var _0x39f2ec={};var _0x499060;var _0x479d08;return db['FreshsalesAccount'][_0xbca8('0x50')]({'where':{'id':_0x266e7a[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x33674f,null))['then'](function(_0x3065b9){if(_0x3065b9){_0x499060=_0x3065b9;_0x39f2ec[_0xbca8('0x30')]=_[_0xbca8('0x32')](db[_0xbca8('0x51')][_0xbca8('0x2d')]);_0x39f2ec[_0xbca8('0x33')]=_[_0xbca8('0x32')](_0x266e7a[_0xbca8('0x33')]);_0x39f2ec[_0xbca8('0x34')]=_[_0xbca8('0x35')](_0x39f2ec[_0xbca8('0x30')],_0x39f2ec[_0xbca8('0x33')]);_0x306565[_0xbca8('0x36')]=_['intersection'](_0x39f2ec[_0xbca8('0x30')],qs[_0xbca8('0x37')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x37')]));_0x306565['attributes']=_0x306565[_0xbca8('0x36')][_0xbca8('0x49')]?_0x306565['attributes']:_0x39f2ec['model'];_0x306565['order']=qs['sort'](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x3b')]);_0x306565[_0xbca8('0x3c')]=qs[_0xbca8('0x34')](_[_0xbca8('0x3d')](_0x266e7a[_0xbca8('0x33')],_0x39f2ec['filters']));if(_0x266e7a[_0xbca8('0x33')]['filter']){_0x306565[_0xbca8('0x3c')]=_[_0xbca8('0x3f')](_0x306565[_0xbca8('0x3c')],{'$or':_[_0xbca8('0x31')](_0x306565['attributes'],function(_0x3e0891){var _0x3e95b3={};_0x3e95b3[_0x3e0891]={'$like':'%'+_0x266e7a[_0xbca8('0x33')][_0xbca8('0x3e')]+'%'};return _0x3e95b3;})});}_0x306565=_[_0xbca8('0x3f')]({},_0x306565,_0x266e7a[_0xbca8('0x41')]);return _0x499060[_0xbca8('0x4f')](_0x306565);}})[_0xbca8('0x27')](function(_0x3811fb){if(_0x3811fb){_0x479d08=_0x3811fb['length'];if(!_0x266e7a[_0xbca8('0x33')][_0xbca8('0x38')]('nolimit')){_0x306565[_0xbca8('0x21')]=qs[_0xbca8('0x21')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x21')]);_0x306565[_0xbca8('0x1f')]=qs[_0xbca8('0x1f')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x1f')]);}return _0x499060[_0xbca8('0x4f')](_0x306565);}})[_0xbca8('0x27')](function(_0x57c5d3){if(_0x57c5d3){return _0x57c5d3?{'count':_0x479d08,'rows':_0x57c5d3}:null;}})[_0xbca8('0x27')](respondWithResult(_0x33674f,null))[_0xbca8('0x46')](handleError(_0x33674f,null));};exports[_0xbca8('0x52')]=function(_0x4d5c63,_0x417f64,_0x4cdec2){if(_0x4d5c63[_0xbca8('0x4d')]['id']){delete _0x4d5c63[_0xbca8('0x4d')]['id'];}return db[_0xbca8('0x42')][_0xbca8('0x50')]({'where':{'id':_0x4d5c63['params']['id']}})[_0xbca8('0x27')](handleEntityNotFound(_0x417f64,null))[_0xbca8('0x27')](function(_0x113931){if(_0x113931){_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x53')]=_0x113931['id'];_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x54')]=integrations[_0xbca8('0x55')](_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x56')],_0x4d5c63[_0xbca8('0x4d')]['type']);_0x4d5c63[_0xbca8('0x4d')]['Descriptions']=integrations[_0xbca8('0x57')](_0x4d5c63[_0xbca8('0x4d')]['channel'],_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x40')]);return db['FreshsalesConfiguration'][_0xbca8('0x4c')](_0x4d5c63[_0xbca8('0x4d')],{'include':[{'model':db[_0xbca8('0x58')],'as':'Subjects'},{'model':db[_0xbca8('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x417f64,null))['catch'](handleError(_0x417f64,null));};exports[_0xbca8('0x59')]=function(_0x4664b3,_0x5a7158,_0x2fdbcf){var _0x1b044b='';var _0x4c7bed='';return db['FreshsalesAccount'][_0xbca8('0x50')]({'where':{'id':_0x4664b3[_0xbca8('0x48')]['id']},'attributes':['id','username',_0xbca8('0x5a'),_0xbca8('0x5b')]})[_0xbca8('0x27')](handleEntityNotFound(_0x5a7158,null))['then'](function(_0x13892e){if(_0x13892e){_0x4c7bed=_0x13892e[_0xbca8('0x5c')];_0x1b044b=_0x13892e[_0xbca8('0x5a')];var _0x40cef4=_0x13892e[_0xbca8('0x5a')][_0xbca8('0x5d')](-0x1);if(_0x40cef4==='/'){_0x1b044b=_0x1b044b[_0xbca8('0x5e')](0x0,_0x1b044b[_0xbca8('0x5f')](_0x40cef4));}return rp({'method':_0xbca8('0x60'),'uri':util[_0xbca8('0x61')](_0xbca8('0x62'),_0x1b044b,_0xbca8('0x63')),'headers':{'Authorization':_0xbca8('0x64')+_0x13892e[_0xbca8('0x5b')]},'json':!![]});}})['then'](function(_0x3fe2ff){if(_0x3fe2ff){var _0x5055e4=_0x3fe2ff['users'];var _0xb5506d=![];var _0x1cc025=null;for(_0x1cc025=0x0;_0x1cc025<_0x5055e4[_0xbca8('0x49')];_0x1cc025++){if(_0x5055e4[_0x1cc025][_0xbca8('0x65')]===_0x4c7bed){_0xb5506d=!![];}}if(_0xb5506d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbca8('0x66')});}}})[_0xbca8('0x27')](respondWithResult(_0x5a7158,null))['catch'](function(_0x58248a){var _0xbc7e5f=_0x4664b3['query'][_0xbca8('0x67')]?0x1f4:_0x58248a[_0xbca8('0x68')]||0x1f4;logger[_0xbca8('0x29')](_0xbca8('0x69'),'getFields',_0xbc7e5f,JSON[_0xbca8('0x6a')](_0x58248a));delete _0x58248a[_0xbca8('0x2b')];if(_0xbc7e5f===0x191){_0xbc7e5f=0x190;}_0x5a7158[_0xbca8('0x1c')](_0xbc7e5f)[_0xbca8('0x2c')](_0x4664b3[_0xbca8('0x33')][_0xbca8('0x67')]?{'message':_0xbca8('0x6b'),'statusCode':_0x58248a[_0xbca8('0x68')]}:_0x58248a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 696cb3f..7e3ec36 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x46c562,_0x3e4c16){var _0x121ad8=function(_0x41f8a3){while(--_0x41f8a3){_0x46c562['push'](_0x46c562['shift']());}};_0x121ad8(++_0x3e4c16);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));var integrations=require(_0x6704('0x9'));module[_0x6704('0xa')]=function(_0x2917be,_0x4badf8){return _0x2917be[_0x6704('0xb')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x5430,0x10c));var _0x0543=function(_0x4e9713,_0x347c77){_0x4e9713=_0x4e9713-0x0;var _0x2aa7b6=_0x5430[_0x4e9713];return _0x2aa7b6;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 389120e..9b3f48c 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 _0x57ca=['then','debug','ShowFreshsalesAccount','find','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x13a190,_0x37b646){var _0x2bde13=function(_0x108ce2){while(--_0x108ce2){_0x13a190['push'](_0x13a190['shift']());}};_0x2bde13(++_0x37b646);}(_0x57ca,0x108));var _0xa57c=function(_0x511070,_0x219722){_0x511070=_0x511070-0x0;var _0x1f8cce=_0x57ca[_0x511070];return _0x1f8cce;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});}exports[_0xa57c('0x15')]=function(_0x3d781d){var _0x93462c=this;return new Promise(function(_0xe3d505,_0x1fd0d8){return db[_0xa57c('0x16')][_0xa57c('0x17')]({'raw':_0x3d781d[_0xa57c('0x18')]?_0x3d781d['options'][_0xa57c('0x19')]===undefined?!![]:![]:!![],'where':_0x3d781d['options']?_0x3d781d['options'][_0xa57c('0x1a')]||null:null,'attributes':_0x3d781d[_0xa57c('0x18')]?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1b')]||null:null,'limit':_0x3d781d['options']?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1c')]||null:null,'include':_0x3d781d[_0xa57c('0x18')]?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1d')],function(_0x2e99ed){return{'model':db[_0x2e99ed[_0xa57c('0x1f')]],'as':_0x2e99ed['as'],'attributes':_0x2e99ed[_0xa57c('0x1b')],'include':_0x2e99ed[_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x2e99ed[_0xa57c('0x1d')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1b')],'include':_0x431bec[_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x431bec[_0xa57c('0x1d')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x1f')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa57c('0x20')](function(_0x337f97){logger[_0xa57c('0xc')]('GetFreshsalesAccount',_0x3d781d);logger[_0xa57c('0x21')]('GetFreshsalesAccount',_0x3d781d,JSON['stringify'](_0x337f97));_0xe3d505(_0x337f97);})[_0xa57c('0x14')](function(_0x7d10ec){logger['error'](_0xa57c('0x15'),_0x7d10ec[_0xa57c('0x12')],_0x3d781d);_0x1fd0d8(_0x93462c[_0xa57c('0xf')](0x1f4,_0x7d10ec['message']));});});};exports[_0xa57c('0x22')]=function(_0x58d46f){var _0xf5f70c=this;return new Promise(function(_0x5464f2,_0x2a3bbe){return db['FreshsalesAccount'][_0xa57c('0x23')]({'raw':_0x58d46f['options']?_0x58d46f[_0xa57c('0x18')][_0xa57c('0x19')]===undefined?!![]:![]:!![],'where':_0x58d46f[_0xa57c('0x18')]?_0x58d46f[_0xa57c('0x18')][_0xa57c('0x1a')]||null:null,'attributes':_0x58d46f[_0xa57c('0x18')]?_0x58d46f[_0xa57c('0x18')]['attributes']||null:null,'include':_0x58d46f[_0xa57c('0x18')]?_0x58d46f['options'][_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x58d46f[_0xa57c('0x18')]['include'],function(_0x289174){return{'model':db[_0x289174['model']],'as':_0x289174['as'],'attributes':_0x289174[_0xa57c('0x1b')],'include':_0x289174['include']?_[_0xa57c('0x1e')](_0x289174['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x1f')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x1d')]?_['map'](_0x433116[_0xa57c('0x1d')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x1f')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa57c('0x20')](function(_0x62f697){logger[_0xa57c('0xc')](_0xa57c('0x22'),_0x58d46f);logger['debug']('ShowFreshsalesAccount',_0x58d46f,JSON[_0xa57c('0x24')](_0x62f697));_0x5464f2(_0x62f697);})[_0xa57c('0x14')](function(_0x2c70d6){logger['error'](_0xa57c('0x22'),_0x2c70d6['message'],_0x58d46f);_0x2a3bbe(_0xf5f70c[_0xa57c('0xf')](0x1f4,_0x2c70d6[_0xa57c('0x12')]));});});}; \ No newline at end of file +var _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x53cad4,_0xcf5021){_0x53cad4=_0x53cad4-0x0;var _0x56dad6=_0x4975[_0x53cad4];return _0x56dad6;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6dfbcb9..314056e 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 _0xd219=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','delete'];(function(_0x296094,_0x72a255){var _0x234788=function(_0x2aa0af){while(--_0x2aa0af){_0x296094['push'](_0x296094['shift']());}};_0x234788(++_0x72a255);}(_0xd219,0x1a3));var _0x9d21=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd219[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x9d21('0x0'));var util=require(_0x9d21('0x1'));var path=require(_0x9d21('0x2'));var timeout=require(_0x9d21('0x3'));var express=require('express');var router=express[_0x9d21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d21('0x5'));var interaction=require(_0x9d21('0x6'));var config=require(_0x9d21('0x7'));var controller=require(_0x9d21('0x8'));router[_0x9d21('0x9')]('/',auth[_0x9d21('0xa')](),controller[_0x9d21('0xb')]);router[_0x9d21('0x9')](_0x9d21('0xc'),auth[_0x9d21('0xa')](),controller['show']);router[_0x9d21('0x9')](_0x9d21('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9d21('0x9')](_0x9d21('0xe'),auth[_0x9d21('0xa')](),controller[_0x9d21('0xf')]);router[_0x9d21('0x9')](_0x9d21('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x9d21('0x11')]);router[_0x9d21('0x12')](_0x9d21('0xc'),auth['isAuthenticated'](),controller[_0x9d21('0x13')]);router[_0x9d21('0x14')](_0x9d21('0xc'),auth[_0x9d21('0xa')](),controller['destroy']);module[_0x9d21('0x15')]=router; \ No newline at end of file +var _0x2007=['getDescriptions','getFields','create','put','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2007,0x158));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7200('0x0'));var util=require(_0x7200('0x1'));var path=require(_0x7200('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7200('0x3')]();var fs_extra=require(_0x7200('0x4'));var auth=require(_0x7200('0x5'));var interaction=require(_0x7200('0x6'));var config=require(_0x7200('0x7'));var controller=require(_0x7200('0x8'));router[_0x7200('0x9')]('/',auth['isAuthenticated'](),controller[_0x7200('0xa')]);router[_0x7200('0x9')]('/:id',auth[_0x7200('0xb')](),controller[_0x7200('0xc')]);router[_0x7200('0x9')](_0x7200('0xd'),auth[_0x7200('0xb')](),controller[_0x7200('0xe')]);router[_0x7200('0x9')](_0x7200('0xf'),auth['isAuthenticated'](),controller[_0x7200('0x10')]);router[_0x7200('0x9')]('/:id/fields',auth[_0x7200('0xb')](),controller[_0x7200('0x11')]);router['post']('/',auth[_0x7200('0xb')](),controller[_0x7200('0x12')]);router[_0x7200('0x13')](_0x7200('0x14'),auth[_0x7200('0xb')](),controller[_0x7200('0x15')]);router[_0x7200('0x16')](_0x7200('0x14'),auth[_0x7200('0xb')](),controller[_0x7200('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 817b44e..ff33f80 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 _0x326c=['sequelize','STRING'];(function(_0x451ea8,_0x19846c){var _0x28a576=function(_0x4a46c6){while(--_0x4a46c6){_0x451ea8['push'](_0x451ea8['shift']());}};_0x28a576(++_0x19846c);}(_0x326c,0x1cc));var _0xc326=function(_0x4320a7,_0x239a92){_0x4320a7=_0x4320a7-0x0;var _0x3700bf=_0x326c[_0x4320a7];return _0x3700bf;};'use strict';var Sequelize=require(_0xc326('0x0'));module['exports']={'name':{'type':Sequelize[_0xc326('0x1')]},'description':{'type':Sequelize[_0xc326('0x1')]}}; \ No newline at end of file +var _0x6005=['exports','STRING','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x6005,0x65));var _0x5600=function(_0x4e0365,_0x9454c6){_0x4e0365=_0x4e0365-0x0;var _0x181b39=_0x6005[_0x4e0365];return _0x181b39;};'use strict';var Sequelize=require(_0x5600('0x0'));module[_0x5600('0x1')]={'name':{'type':Sequelize[_0x5600('0x2')]},'description':{'type':Sequelize[_0x5600('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7de44d6..3d54957 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 _0xb73c=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','include','findAll','catch','show','params','includeAll','merge','create','body','update','find','destroy','getSubjects','findOne','FreshsalesField','order','options','getDescriptions','getFields','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x50036f,_0x317540){var _0x1d4a69=function(_0x532fe2){while(--_0x532fe2){_0x50036f['push'](_0x50036f['shift']());}};_0x1d4a69(++_0x317540);}(_0xb73c,0x193));var _0xcb73=function(_0x596ed6,_0x3c80d9){_0x596ed6=_0x596ed6-0x0;var _0x529355=_0xb73c[_0x596ed6];return _0x529355;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb73('0x0'));var jsonpatch=require(_0xcb73('0x1'));var rp=require('request-promise');var moment=require(_0xcb73('0x2'));var BPromise=require(_0xcb73('0x3'));var Mustache=require(_0xcb73('0x4'));var util=require(_0xcb73('0x5'));var path=require(_0xcb73('0x6'));var sox=require(_0xcb73('0x7'));var csv=require(_0xcb73('0x8'));var ejs=require(_0xcb73('0x9'));var fs=require('fs');var fs_extra=require(_0xcb73('0xa'));var _=require(_0xcb73('0xb'));var squel=require(_0xcb73('0xc'));var crypto=require(_0xcb73('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcb73('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb73('0xf'));var Papa=require(_0xcb73('0x10'));var Redis=require(_0xcb73('0x11'));var authService=require(_0xcb73('0x12'));var qs=require(_0xcb73('0x13'));var as=require(_0xcb73('0x14'));var hardwareService=require(_0xcb73('0x15'));var logger=require(_0xcb73('0x16'))(_0xcb73('0x17'));var utils=require(_0xcb73('0x18'));var config=require(_0xcb73('0x19'));var licenseUtil=require(_0xcb73('0x1a'));var db=require(_0xcb73('0x1b'))['db'];function respondWithStatusCode(_0x3c6dd5,_0x9ffae8){_0x9ffae8=_0x9ffae8||0xcc;return function(_0x1d1563){if(_0x1d1563){return _0x3c6dd5[_0xcb73('0x1c')](_0x9ffae8);}return _0x3c6dd5[_0xcb73('0x1d')](_0x9ffae8)[_0xcb73('0x1e')]();};}function respondWithResult(_0xe7846,_0x467d18){_0x467d18=_0x467d18||0xc8;return function(_0x64c7df){if(_0x64c7df){return _0xe7846[_0xcb73('0x1d')](_0x467d18)[_0xcb73('0x1f')](_0x64c7df);}};}function respondWithFilteredResult(_0x25e7e8,_0x535bc1){return function(_0x45face){if(_0x45face){var _0x88ef19=typeof _0x535bc1['offset']==='undefined'&&typeof _0x535bc1[_0xcb73('0x20')]===_0xcb73('0x21');var _0x48430f=_0x45face[_0xcb73('0x22')];var _0x12b723=_0x88ef19?0x0:_0x535bc1[_0xcb73('0x23')];var _0x21826a=_0x88ef19?_0x45face['count']:_0x535bc1[_0xcb73('0x23')]+_0x535bc1[_0xcb73('0x20')];var _0x5c5b30;if(_0x21826a>=_0x48430f){_0x21826a=_0x48430f;_0x5c5b30=0xc8;}else{_0x5c5b30=0xce;}_0x25e7e8[_0xcb73('0x1d')](_0x5c5b30);return _0x25e7e8[_0xcb73('0x24')](_0xcb73('0x25'),_0x12b723+'-'+_0x21826a+'/'+_0x48430f)[_0xcb73('0x1f')](_0x45face);}return null;};}function patchUpdates(_0x3bd5b6){return function(_0x235e3f){try{jsonpatch[_0xcb73('0x26')](_0x235e3f,_0x3bd5b6,!![]);}catch(_0x246bb9){return BPromise[_0xcb73('0x27')](_0x246bb9);}return _0x235e3f[_0xcb73('0x28')]();};}function saveUpdates(_0x21f8cf,_0x49061f){return function(_0x173578){if(_0x173578){return _0x173578['update'](_0x21f8cf)[_0xcb73('0x29')](function(_0x3621ad){return _0x3621ad;});}return null;};}function removeEntity(_0x15277f,_0x22fe5e){return function(_0x1466cd){if(_0x1466cd){return _0x1466cd['destroy']()['then'](function(){_0x15277f['status'](0xcc)[_0xcb73('0x1e')]();});}};}function handleEntityNotFound(_0x24915a,_0x1c1e91){return function(_0x3387f6){if(!_0x3387f6){_0x24915a[_0xcb73('0x1c')](0x194);}return _0x3387f6;};}function handleError(_0x47adc2,_0x4eeb98){_0x4eeb98=_0x4eeb98||0x1f4;return function(_0x8a4b49){logger['error'](_0x8a4b49['stack']);if(_0x8a4b49[_0xcb73('0x2a')]){delete _0x8a4b49[_0xcb73('0x2a')];}_0x47adc2[_0xcb73('0x1d')](_0x4eeb98)[_0xcb73('0x2b')](_0x8a4b49);};}exports[_0xcb73('0x2c')]=function(_0x51e606,_0x54c1a5){var _0x5a8c4f={},_0x328a86={},_0x53237c={'count':0x0,'rows':[]};var _0x241a53=_[_0xcb73('0x2d')](db[_0xcb73('0x2e')][_0xcb73('0x2f')],function(_0x362d40){return{'name':_0x362d40[_0xcb73('0x30')],'type':_0x362d40['type'][_0xcb73('0x31')]};});_0x328a86[_0xcb73('0x32')]=_[_0xcb73('0x2d')](_0x241a53,_0xcb73('0x2a'));_0x328a86[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x51e606['query']);_0x328a86[_0xcb73('0x35')]=_['intersection'](_0x328a86['model'],_0x328a86[_0xcb73('0x33')]);_0x5a8c4f['attributes']=_[_0xcb73('0x36')](_0x328a86[_0xcb73('0x32')],qs[_0xcb73('0x37')](_0x51e606[_0xcb73('0x33')][_0xcb73('0x37')]));_0x5a8c4f[_0xcb73('0x38')]=_0x5a8c4f['attributes'][_0xcb73('0x39')]?_0x5a8c4f[_0xcb73('0x38')]:_0x328a86[_0xcb73('0x32')];if(!_0x51e606[_0xcb73('0x33')][_0xcb73('0x3a')](_0xcb73('0x3b'))){_0x5a8c4f[_0xcb73('0x20')]=qs[_0xcb73('0x20')](_0x51e606[_0xcb73('0x33')][_0xcb73('0x20')]);_0x5a8c4f[_0xcb73('0x23')]=qs['offset'](_0x51e606[_0xcb73('0x33')][_0xcb73('0x23')]);}_0x5a8c4f['order']=qs[_0xcb73('0x3c')](_0x51e606['query'][_0xcb73('0x3c')]);_0x5a8c4f[_0xcb73('0x3d')]=qs[_0xcb73('0x35')](_[_0xcb73('0x3e')](_0x51e606[_0xcb73('0x33')],_0x328a86['filters']),_0x241a53);if(_0x51e606[_0xcb73('0x33')][_0xcb73('0x3f')]){_0x5a8c4f[_0xcb73('0x3d')]=_['merge'](_0x5a8c4f['where'],{'$or':_[_0xcb73('0x2d')](_0x241a53,function(_0x1da407){if(_0x1da407[_0xcb73('0x40')]!==_0xcb73('0x41')){var _0x429f54={};_0x429f54[_0x1da407[_0xcb73('0x2a')]]={'$like':'%'+_0x51e606[_0xcb73('0x33')][_0xcb73('0x3f')]+'%'};return _0x429f54;}})});}_0x5a8c4f=_['merge']({},_0x5a8c4f,_0x51e606['options']);var _0x32ab00={'where':_0x5a8c4f[_0xcb73('0x3d')]};return db['FreshsalesConfiguration'][_0xcb73('0x22')](_0x32ab00)['then'](function(_0x455046){_0x53237c[_0xcb73('0x22')]=_0x455046;if(_0x51e606[_0xcb73('0x33')]['includeAll']){_0x5a8c4f[_0xcb73('0x42')]=[{'all':!![]}];}return db[_0xcb73('0x2e')][_0xcb73('0x43')](_0x5a8c4f);})[_0xcb73('0x29')](function(_0x485c62){_0x53237c['rows']=_0x485c62;return _0x53237c;})['then'](respondWithFilteredResult(_0x54c1a5,_0x5a8c4f))[_0xcb73('0x44')](handleError(_0x54c1a5,null));};exports[_0xcb73('0x45')]=function(_0x4255f1,_0x2942c7){var _0x2ef593={'raw':![],'where':{'id':_0x4255f1[_0xcb73('0x46')]['id']}},_0x497781={};_0x497781[_0xcb73('0x32')]=_[_0xcb73('0x34')](db[_0xcb73('0x2e')][_0xcb73('0x2f')]);_0x497781[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x4255f1[_0xcb73('0x33')]);_0x497781[_0xcb73('0x35')]=_['intersection'](_0x497781[_0xcb73('0x32')],_0x497781[_0xcb73('0x33')]);_0x2ef593[_0xcb73('0x38')]=_['intersection'](_0x497781[_0xcb73('0x32')],qs['fields'](_0x4255f1['query'][_0xcb73('0x37')]));_0x2ef593['attributes']=_0x2ef593[_0xcb73('0x38')][_0xcb73('0x39')]?_0x2ef593[_0xcb73('0x38')]:_0x497781[_0xcb73('0x32')];if(_0x4255f1['query'][_0xcb73('0x47')]){_0x2ef593[_0xcb73('0x42')]=[{'all':!![]}];}_0x2ef593=_[_0xcb73('0x48')]({},_0x2ef593,_0x4255f1['options']);return db[_0xcb73('0x2e')]['find'](_0x2ef593)[_0xcb73('0x29')](handleEntityNotFound(_0x2942c7,null))[_0xcb73('0x29')](respondWithResult(_0x2942c7,null))['catch'](handleError(_0x2942c7,null));};exports[_0xcb73('0x49')]=function(_0x4e4328,_0x51f703){return db[_0xcb73('0x2e')][_0xcb73('0x49')](_0x4e4328[_0xcb73('0x4a')],{})[_0xcb73('0x29')](respondWithResult(_0x51f703,0xc9))[_0xcb73('0x44')](handleError(_0x51f703,null));};exports[_0xcb73('0x4b')]=function(_0x3d3df5,_0x34624b){if(_0x3d3df5[_0xcb73('0x4a')]['id']){delete _0x3d3df5[_0xcb73('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0xcb73('0x4c')]({'where':{'id':_0x3d3df5[_0xcb73('0x46')]['id']}})[_0xcb73('0x29')](handleEntityNotFound(_0x34624b,null))[_0xcb73('0x29')](saveUpdates(_0x3d3df5[_0xcb73('0x4a')],null))[_0xcb73('0x29')](respondWithResult(_0x34624b,null))[_0xcb73('0x44')](handleError(_0x34624b,null));};exports[_0xcb73('0x4d')]=function(_0x2726c3,_0xe43d75){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2726c3[_0xcb73('0x46')]['id']}})['then'](handleEntityNotFound(_0xe43d75,null))['then'](removeEntity(_0xe43d75,null))['catch'](handleError(_0xe43d75,null));};exports[_0xcb73('0x4e')]=function(_0x46acd0,_0x3e0e65,_0x159232){var _0x2b25a4={};var _0x535d33={};var _0x2dedbd;var _0x4879c4;return db['FreshsalesConfiguration'][_0xcb73('0x4f')]({'where':{'id':_0x46acd0[_0xcb73('0x46')]['id']}})[_0xcb73('0x29')](handleEntityNotFound(_0x3e0e65,null))['then'](function(_0x548c7b){if(_0x548c7b){_0x2dedbd=_0x548c7b;_0x535d33[_0xcb73('0x32')]=_[_0xcb73('0x34')](db[_0xcb73('0x50')][_0xcb73('0x2f')]);_0x535d33[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x46acd0[_0xcb73('0x33')]);_0x535d33[_0xcb73('0x35')]=_[_0xcb73('0x36')](_0x535d33[_0xcb73('0x32')],_0x535d33[_0xcb73('0x33')]);_0x2b25a4[_0xcb73('0x38')]=_[_0xcb73('0x36')](_0x535d33[_0xcb73('0x32')],qs[_0xcb73('0x37')](_0x46acd0[_0xcb73('0x33')][_0xcb73('0x37')]));_0x2b25a4['attributes']=_0x2b25a4[_0xcb73('0x38')][_0xcb73('0x39')]?_0x2b25a4[_0xcb73('0x38')]:_0x535d33[_0xcb73('0x32')];_0x2b25a4[_0xcb73('0x51')]=qs[_0xcb73('0x3c')](_0x46acd0['query'][_0xcb73('0x3c')]);_0x2b25a4[_0xcb73('0x3d')]=qs[_0xcb73('0x35')](_[_0xcb73('0x3e')](_0x46acd0[_0xcb73('0x33')],_0x535d33['filters']));if(_0x46acd0[_0xcb73('0x33')][_0xcb73('0x3f')]){_0x2b25a4[_0xcb73('0x3d')]=_['merge'](_0x2b25a4[_0xcb73('0x3d')],{'$or':_[_0xcb73('0x2d')](_0x2b25a4[_0xcb73('0x38')],function(_0x5104b8){var _0x53e36a={};_0x53e36a[_0x5104b8]={'$like':'%'+_0x46acd0[_0xcb73('0x33')][_0xcb73('0x3f')]+'%'};return _0x53e36a;})});}_0x2b25a4=_[_0xcb73('0x48')]({},_0x2b25a4,_0x46acd0[_0xcb73('0x52')]);return _0x2dedbd[_0xcb73('0x4e')](_0x2b25a4);}})[_0xcb73('0x29')](function(_0x5db08d){if(_0x5db08d){_0x4879c4=_0x5db08d[_0xcb73('0x39')];if(!_0x46acd0[_0xcb73('0x33')]['hasOwnProperty'](_0xcb73('0x3b'))){_0x2b25a4[_0xcb73('0x20')]=qs[_0xcb73('0x20')](_0x46acd0[_0xcb73('0x33')][_0xcb73('0x20')]);_0x2b25a4[_0xcb73('0x23')]=qs['offset'](_0x46acd0['query'][_0xcb73('0x23')]);}return _0x2dedbd[_0xcb73('0x4e')](_0x2b25a4);}})['then'](function(_0x4d1a85){if(_0x4d1a85){return _0x4d1a85?{'count':_0x4879c4,'rows':_0x4d1a85}:null;}})[_0xcb73('0x29')](respondWithResult(_0x3e0e65,null))['catch'](handleError(_0x3e0e65,null));};exports[_0xcb73('0x53')]=function(_0x1e7e3f,_0x3c34bd,_0x3dc343){var _0x23a9a9={};var _0x694b41={};var _0xcc30c0;var _0x39e359;return db[_0xcb73('0x2e')][_0xcb73('0x4f')]({'where':{'id':_0x1e7e3f['params']['id']}})[_0xcb73('0x29')](handleEntityNotFound(_0x3c34bd,null))['then'](function(_0x5db7a4){if(_0x5db7a4){_0xcc30c0=_0x5db7a4;_0x694b41[_0xcb73('0x32')]=_[_0xcb73('0x34')](db[_0xcb73('0x50')]['rawAttributes']);_0x694b41['query']=_[_0xcb73('0x34')](_0x1e7e3f[_0xcb73('0x33')]);_0x694b41[_0xcb73('0x35')]=_[_0xcb73('0x36')](_0x694b41[_0xcb73('0x32')],_0x694b41['query']);_0x23a9a9[_0xcb73('0x38')]=_[_0xcb73('0x36')](_0x694b41['model'],qs[_0xcb73('0x37')](_0x1e7e3f[_0xcb73('0x33')][_0xcb73('0x37')]));_0x23a9a9[_0xcb73('0x38')]=_0x23a9a9[_0xcb73('0x38')][_0xcb73('0x39')]?_0x23a9a9[_0xcb73('0x38')]:_0x694b41['model'];_0x23a9a9[_0xcb73('0x51')]=qs[_0xcb73('0x3c')](_0x1e7e3f['query'][_0xcb73('0x3c')]);_0x23a9a9[_0xcb73('0x3d')]=qs[_0xcb73('0x35')](_[_0xcb73('0x3e')](_0x1e7e3f[_0xcb73('0x33')],_0x694b41[_0xcb73('0x35')]));if(_0x1e7e3f[_0xcb73('0x33')]['filter']){_0x23a9a9[_0xcb73('0x3d')]=_['merge'](_0x23a9a9[_0xcb73('0x3d')],{'$or':_[_0xcb73('0x2d')](_0x23a9a9[_0xcb73('0x38')],function(_0x18de85){var _0x1eb1eb={};_0x1eb1eb[_0x18de85]={'$like':'%'+_0x1e7e3f[_0xcb73('0x33')][_0xcb73('0x3f')]+'%'};return _0x1eb1eb;})});}_0x23a9a9=_[_0xcb73('0x48')]({},_0x23a9a9,_0x1e7e3f[_0xcb73('0x52')]);return _0xcc30c0[_0xcb73('0x53')](_0x23a9a9);}})['then'](function(_0x508c24){if(_0x508c24){_0x39e359=_0x508c24['length'];if(!_0x1e7e3f['query']['hasOwnProperty'](_0xcb73('0x3b'))){_0x23a9a9[_0xcb73('0x20')]=qs[_0xcb73('0x20')](_0x1e7e3f[_0xcb73('0x33')][_0xcb73('0x20')]);_0x23a9a9[_0xcb73('0x23')]=qs['offset'](_0x1e7e3f[_0xcb73('0x33')][_0xcb73('0x23')]);}return _0xcc30c0[_0xcb73('0x53')](_0x23a9a9);}})[_0xcb73('0x29')](function(_0x29557c){if(_0x29557c){return _0x29557c?{'count':_0x39e359,'rows':_0x29557c}:null;}})[_0xcb73('0x29')](respondWithResult(_0x3c34bd,null))[_0xcb73('0x44')](handleError(_0x3c34bd,null));};exports[_0xcb73('0x54')]=function(_0x207757,_0x2aaf12,_0x320a61){var _0x3077c3={};var _0x5da196={};var _0x3a5dc9;var _0x86dffc;return db['FreshsalesConfiguration'][_0xcb73('0x4f')]({'where':{'id':_0x207757[_0xcb73('0x46')]['id']}})['then'](handleEntityNotFound(_0x2aaf12,null))[_0xcb73('0x29')](function(_0x1db1ad){if(_0x1db1ad){_0x3a5dc9=_0x1db1ad;_0x5da196[_0xcb73('0x32')]=_[_0xcb73('0x34')](db[_0xcb73('0x50')]['rawAttributes']);_0x5da196[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x207757['query']);_0x5da196[_0xcb73('0x35')]=_['intersection'](_0x5da196[_0xcb73('0x32')],_0x5da196[_0xcb73('0x33')]);_0x3077c3[_0xcb73('0x38')]=_[_0xcb73('0x36')](_0x5da196[_0xcb73('0x32')],qs[_0xcb73('0x37')](_0x207757[_0xcb73('0x33')][_0xcb73('0x37')]));_0x3077c3[_0xcb73('0x38')]=_0x3077c3[_0xcb73('0x38')][_0xcb73('0x39')]?_0x3077c3[_0xcb73('0x38')]:_0x5da196[_0xcb73('0x32')];_0x3077c3[_0xcb73('0x51')]=qs['sort'](_0x207757['query']['sort']);_0x3077c3[_0xcb73('0x3d')]=qs[_0xcb73('0x35')](_[_0xcb73('0x3e')](_0x207757[_0xcb73('0x33')],_0x5da196[_0xcb73('0x35')]));if(_0x207757[_0xcb73('0x33')][_0xcb73('0x3f')]){_0x3077c3[_0xcb73('0x3d')]=_['merge'](_0x3077c3[_0xcb73('0x3d')],{'$or':_[_0xcb73('0x2d')](_0x3077c3[_0xcb73('0x38')],function(_0x55e0b8){var _0x4db677={};_0x4db677[_0x55e0b8]={'$like':'%'+_0x207757[_0xcb73('0x33')][_0xcb73('0x3f')]+'%'};return _0x4db677;})});}_0x3077c3=_[_0xcb73('0x48')]({},_0x3077c3,_0x207757[_0xcb73('0x52')]);return _0x3a5dc9[_0xcb73('0x54')](_0x3077c3);}})[_0xcb73('0x29')](function(_0xfa1777){if(_0xfa1777){_0x86dffc=_0xfa1777[_0xcb73('0x39')];if(!_0x207757[_0xcb73('0x33')][_0xcb73('0x3a')](_0xcb73('0x3b'))){_0x3077c3[_0xcb73('0x20')]=qs[_0xcb73('0x20')](_0x207757[_0xcb73('0x33')]['limit']);_0x3077c3[_0xcb73('0x23')]=qs[_0xcb73('0x23')](_0x207757[_0xcb73('0x33')][_0xcb73('0x23')]);}return _0x3a5dc9[_0xcb73('0x54')](_0x3077c3);}})['then'](function(_0xbb48f0){if(_0xbb48f0){return _0xbb48f0?{'count':_0x86dffc,'rows':_0xbb48f0}:null;}})[_0xcb73('0x29')](respondWithResult(_0x2aaf12,null))[_0xcb73('0x44')](handleError(_0x2aaf12,null));}; \ No newline at end of file +var _0xb1fc=['stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0x52325b,_0x32e7a7){var _0x5e1b4c=function(_0x3eca03){while(--_0x3eca03){_0x52325b['push'](_0x52325b['shift']());}};_0x5e1b4c(++_0x32e7a7);}(_0xb1fc,0x17b));var _0xcb1f=function(_0x367b5c,_0x5c6e12){_0x367b5c=_0x367b5c-0x0;var _0x16c76b=_0xb1fc[_0x367b5c];return _0x16c76b;};'use strict';var emlformat=require(_0xcb1f('0x0'));var rimraf=require(_0xcb1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb1f('0x2'));var rp=require(_0xcb1f('0x3'));var moment=require(_0xcb1f('0x4'));var BPromise=require(_0xcb1f('0x5'));var Mustache=require('mustache');var util=require(_0xcb1f('0x6'));var path=require('path');var sox=require(_0xcb1f('0x7'));var csv=require(_0xcb1f('0x8'));var ejs=require(_0xcb1f('0x9'));var fs=require('fs');var fs_extra=require(_0xcb1f('0xa'));var _=require('lodash');var squel=require(_0xcb1f('0xb'));var crypto=require(_0xcb1f('0xc'));var jsforce=require(_0xcb1f('0xd'));var deskjs=require(_0xcb1f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb1f('0xf'));var Papa=require('papaparse');var Redis=require(_0xcb1f('0x10'));var authService=require(_0xcb1f('0x11'));var qs=require(_0xcb1f('0x12'));var as=require(_0xcb1f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb1f('0x14'))(_0xcb1f('0x15'));var utils=require(_0xcb1f('0x16'));var config=require(_0xcb1f('0x17'));var licenseUtil=require(_0xcb1f('0x18'));var db=require(_0xcb1f('0x19'))['db'];function respondWithStatusCode(_0x211910,_0x19a7cf){_0x19a7cf=_0x19a7cf||0xcc;return function(_0x12dd5e){if(_0x12dd5e){return _0x211910[_0xcb1f('0x1a')](_0x19a7cf);}return _0x211910[_0xcb1f('0x1b')](_0x19a7cf)[_0xcb1f('0x1c')]();};}function respondWithResult(_0x51e587,_0x2b5846){_0x2b5846=_0x2b5846||0xc8;return function(_0x3a2805){if(_0x3a2805){return _0x51e587[_0xcb1f('0x1b')](_0x2b5846)[_0xcb1f('0x1d')](_0x3a2805);}};}function respondWithFilteredResult(_0x4cad7f,_0x3c07ad){return function(_0x5ba26d){if(_0x5ba26d){var _0x5dda4a=typeof _0x3c07ad[_0xcb1f('0x1e')]===_0xcb1f('0x1f')&&typeof _0x3c07ad[_0xcb1f('0x20')]===_0xcb1f('0x1f');var _0x2c242b=_0x5ba26d['count'];var _0x3be34f=_0x5dda4a?0x0:_0x3c07ad[_0xcb1f('0x1e')];var _0x55d3c2=_0x5dda4a?_0x5ba26d[_0xcb1f('0x21')]:_0x3c07ad['offset']+_0x3c07ad[_0xcb1f('0x20')];var _0x4933a4;if(_0x55d3c2>=_0x2c242b){_0x55d3c2=_0x2c242b;_0x4933a4=0xc8;}else{_0x4933a4=0xce;}_0x4cad7f[_0xcb1f('0x1b')](_0x4933a4);return _0x4cad7f[_0xcb1f('0x22')]('Content-Range',_0x3be34f+'-'+_0x55d3c2+'/'+_0x2c242b)[_0xcb1f('0x1d')](_0x5ba26d);}return null;};}function patchUpdates(_0x108d3c){return function(_0x5f415a){try{jsonpatch[_0xcb1f('0x23')](_0x5f415a,_0x108d3c,!![]);}catch(_0x122f39){return BPromise[_0xcb1f('0x24')](_0x122f39);}return _0x5f415a[_0xcb1f('0x25')]();};}function saveUpdates(_0x3011b3,_0x530994){return function(_0x58969b){if(_0x58969b){return _0x58969b[_0xcb1f('0x26')](_0x3011b3)[_0xcb1f('0x27')](function(_0x9bb860){return _0x9bb860;});}return null;};}function removeEntity(_0x481621,_0x3d4ea3){return function(_0xbbbcf5){if(_0xbbbcf5){return _0xbbbcf5['destroy']()['then'](function(){_0x481621['status'](0xcc)[_0xcb1f('0x1c')]();});}};}function handleEntityNotFound(_0x30c8f3,_0x6ae5f3){return function(_0x49fa85){if(!_0x49fa85){_0x30c8f3['sendStatus'](0x194);}return _0x49fa85;};}function handleError(_0x4c8edf,_0x572954){_0x572954=_0x572954||0x1f4;return function(_0x2d276e){logger[_0xcb1f('0x28')](_0x2d276e[_0xcb1f('0x29')]);if(_0x2d276e[_0xcb1f('0x2a')]){delete _0x2d276e[_0xcb1f('0x2a')];}_0x4c8edf[_0xcb1f('0x1b')](_0x572954)[_0xcb1f('0x2b')](_0x2d276e);};}exports[_0xcb1f('0x2c')]=function(_0x592a2f,_0x29021d){var _0x3843bb={},_0x20012a={},_0x2b8d5d={'count':0x0,'rows':[]};var _0x2a08a4=_[_0xcb1f('0x2d')](db[_0xcb1f('0x2e')][_0xcb1f('0x2f')],function(_0x17727c){return{'name':_0x17727c['fieldName'],'type':_0x17727c[_0xcb1f('0x30')][_0xcb1f('0x31')]};});_0x20012a[_0xcb1f('0x32')]=_[_0xcb1f('0x2d')](_0x2a08a4,_0xcb1f('0x2a'));_0x20012a[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x592a2f['query']);_0x20012a[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x20012a[_0xcb1f('0x32')],_0x20012a['query']);_0x3843bb['attributes']=_[_0xcb1f('0x36')](_0x20012a[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x592a2f['query']['fields']));_0x3843bb[_0xcb1f('0x38')]=_0x3843bb[_0xcb1f('0x38')]['length']?_0x3843bb[_0xcb1f('0x38')]:_0x20012a[_0xcb1f('0x32')];if(!_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x3843bb[_0xcb1f('0x20')]=qs[_0xcb1f('0x20')](_0x592a2f[_0xcb1f('0x33')]['limit']);_0x3843bb['offset']=qs[_0xcb1f('0x1e')](_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x1e')]);}_0x3843bb[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3c')]);_0x3843bb[_0xcb1f('0x3d')]=qs['filters'](_[_0xcb1f('0x3e')](_0x592a2f[_0xcb1f('0x33')],_0x20012a[_0xcb1f('0x35')]),_0x2a08a4);if(_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3f')]){_0x3843bb['where']=_[_0xcb1f('0x40')](_0x3843bb[_0xcb1f('0x3d')],{'$or':_['map'](_0x2a08a4,function(_0x13f9d5){if(_0x13f9d5[_0xcb1f('0x30')]!==_0xcb1f('0x41')){var _0x522836={};_0x522836[_0x13f9d5[_0xcb1f('0x2a')]]={'$like':'%'+_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x522836;}})});}_0x3843bb=_['merge']({},_0x3843bb,_0x592a2f[_0xcb1f('0x42')]);var _0x36951e={'where':_0x3843bb['where']};return db[_0xcb1f('0x2e')][_0xcb1f('0x21')](_0x36951e)[_0xcb1f('0x27')](function(_0xc5bb2d){_0x2b8d5d[_0xcb1f('0x21')]=_0xc5bb2d;if(_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x43')]){_0x3843bb[_0xcb1f('0x44')]=[{'all':!![]}];}return db[_0xcb1f('0x2e')][_0xcb1f('0x45')](_0x3843bb);})[_0xcb1f('0x27')](function(_0x3f352e){_0x2b8d5d[_0xcb1f('0x46')]=_0x3f352e;return _0x2b8d5d;})[_0xcb1f('0x27')](respondWithFilteredResult(_0x29021d,_0x3843bb))[_0xcb1f('0x47')](handleError(_0x29021d,null));};exports[_0xcb1f('0x48')]=function(_0x58b53f,_0x5ed15f){var _0x57b6ec={'raw':![],'where':{'id':_0x58b53f['params']['id']}},_0x16dbfb={};_0x16dbfb['model']=_['keys'](db[_0xcb1f('0x2e')]['rawAttributes']);_0x16dbfb[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x58b53f[_0xcb1f('0x33')]);_0x16dbfb[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x16dbfb['model'],_0x16dbfb['query']);_0x57b6ec[_0xcb1f('0x38')]=_['intersection'](_0x16dbfb['model'],qs[_0xcb1f('0x37')](_0x58b53f[_0xcb1f('0x33')]['fields']));_0x57b6ec['attributes']=_0x57b6ec[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x57b6ec[_0xcb1f('0x38')]:_0x16dbfb[_0xcb1f('0x32')];if(_0x58b53f[_0xcb1f('0x33')][_0xcb1f('0x43')]){_0x57b6ec['include']=[{'all':!![]}];}_0x57b6ec=_['merge']({},_0x57b6ec,_0x58b53f[_0xcb1f('0x42')]);return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')](_0x57b6ec)[_0xcb1f('0x27')](handleEntityNotFound(_0x5ed15f,null))[_0xcb1f('0x27')](respondWithResult(_0x5ed15f,null))[_0xcb1f('0x47')](handleError(_0x5ed15f,null));};exports['create']=function(_0x141144,_0x2197a9){return db[_0xcb1f('0x2e')][_0xcb1f('0x4b')](_0x141144[_0xcb1f('0x4c')],{})[_0xcb1f('0x27')](respondWithResult(_0x2197a9,0xc9))[_0xcb1f('0x47')](handleError(_0x2197a9,null));};exports[_0xcb1f('0x26')]=function(_0x83cdae,_0x565988){if(_0x83cdae['body']['id']){delete _0x83cdae['body']['id'];}return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')]({'where':{'id':_0x83cdae[_0xcb1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x565988,null))[_0xcb1f('0x27')](saveUpdates(_0x83cdae[_0xcb1f('0x4c')],null))['then'](respondWithResult(_0x565988,null))[_0xcb1f('0x47')](handleError(_0x565988,null));};exports[_0xcb1f('0x4e')]=function(_0x452f65,_0x19594c){return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')]({'where':{'id':_0x452f65[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x19594c,null))[_0xcb1f('0x27')](removeEntity(_0x19594c,null))[_0xcb1f('0x47')](handleError(_0x19594c,null));};exports['getSubjects']=function(_0x45e69c,_0x4d3c87,_0x190383){var _0x2216ab={};var _0x10d712={};var _0xcbfbc8;var _0x3b4160;return db['FreshsalesConfiguration'][_0xcb1f('0x4f')]({'where':{'id':_0x45e69c[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x4d3c87,null))['then'](function(_0x3aeece){if(_0x3aeece){_0xcbfbc8=_0x3aeece;_0x10d712['model']=_[_0xcb1f('0x34')](db[_0xcb1f('0x50')][_0xcb1f('0x2f')]);_0x10d712[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x45e69c[_0xcb1f('0x33')]);_0x10d712[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x10d712[_0xcb1f('0x32')],_0x10d712['query']);_0x2216ab[_0xcb1f('0x38')]=_['intersection'](_0x10d712[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x45e69c[_0xcb1f('0x33')]['fields']));_0x2216ab[_0xcb1f('0x38')]=_0x2216ab[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x2216ab[_0xcb1f('0x38')]:_0x10d712[_0xcb1f('0x32')];_0x2216ab[_0xcb1f('0x3b')]=qs['sort'](_0x45e69c[_0xcb1f('0x33')]['sort']);_0x2216ab[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_['pick'](_0x45e69c[_0xcb1f('0x33')],_0x10d712[_0xcb1f('0x35')]));if(_0x45e69c[_0xcb1f('0x33')]['filter']){_0x2216ab[_0xcb1f('0x3d')]=_['merge'](_0x2216ab[_0xcb1f('0x3d')],{'$or':_['map'](_0x2216ab[_0xcb1f('0x38')],function(_0x41a741){var _0x5c9dc9={};_0x5c9dc9[_0x41a741]={'$like':'%'+_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x5c9dc9;})});}_0x2216ab=_[_0xcb1f('0x40')]({},_0x2216ab,_0x45e69c['options']);return _0xcbfbc8['getSubjects'](_0x2216ab);}})[_0xcb1f('0x27')](function(_0x28c960){if(_0x28c960){_0x3b4160=_0x28c960[_0xcb1f('0x49')];if(!_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x2216ab[_0xcb1f('0x20')]=qs['limit'](_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x20')]);_0x2216ab['offset']=qs[_0xcb1f('0x1e')](_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x1e')]);}return _0xcbfbc8[_0xcb1f('0x51')](_0x2216ab);}})[_0xcb1f('0x27')](function(_0xa3ef90){if(_0xa3ef90){return _0xa3ef90?{'count':_0x3b4160,'rows':_0xa3ef90}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x4d3c87,null))['catch'](handleError(_0x4d3c87,null));};exports[_0xcb1f('0x52')]=function(_0x5a21d1,_0x352612,_0x117b99){var _0x92316a={};var _0x4b6362={};var _0x54a6ee;var _0x4439cc;return db[_0xcb1f('0x2e')]['findOne']({'where':{'id':_0x5a21d1[_0xcb1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x352612,null))[_0xcb1f('0x27')](function(_0x1a26af){if(_0x1a26af){_0x54a6ee=_0x1a26af;_0x4b6362[_0xcb1f('0x32')]=_['keys'](db[_0xcb1f('0x50')]['rawAttributes']);_0x4b6362['query']=_[_0xcb1f('0x34')](_0x5a21d1[_0xcb1f('0x33')]);_0x4b6362['filters']=_['intersection'](_0x4b6362[_0xcb1f('0x32')],_0x4b6362[_0xcb1f('0x33')]);_0x92316a['attributes']=_[_0xcb1f('0x36')](_0x4b6362['model'],qs[_0xcb1f('0x37')](_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x37')]));_0x92316a['attributes']=_0x92316a[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x92316a[_0xcb1f('0x38')]:_0x4b6362[_0xcb1f('0x32')];_0x92316a[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x5a21d1[_0xcb1f('0x33')]['sort']);_0x92316a[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_[_0xcb1f('0x3e')](_0x5a21d1[_0xcb1f('0x33')],_0x4b6362[_0xcb1f('0x35')]));if(_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x3f')]){_0x92316a['where']=_[_0xcb1f('0x40')](_0x92316a[_0xcb1f('0x3d')],{'$or':_[_0xcb1f('0x2d')](_0x92316a[_0xcb1f('0x38')],function(_0x5df024){var _0x2b9b3d={};_0x2b9b3d[_0x5df024]={'$like':'%'+_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x2b9b3d;})});}_0x92316a=_[_0xcb1f('0x40')]({},_0x92316a,_0x5a21d1['options']);return _0x54a6ee['getDescriptions'](_0x92316a);}})['then'](function(_0x5197bd){if(_0x5197bd){_0x4439cc=_0x5197bd['length'];if(!_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x92316a['limit']=qs['limit'](_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x20')]);_0x92316a[_0xcb1f('0x1e')]=qs[_0xcb1f('0x1e')](_0x5a21d1['query'][_0xcb1f('0x1e')]);}return _0x54a6ee[_0xcb1f('0x52')](_0x92316a);}})[_0xcb1f('0x27')](function(_0x36e546){if(_0x36e546){return _0x36e546?{'count':_0x4439cc,'rows':_0x36e546}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x352612,null))['catch'](handleError(_0x352612,null));};exports[_0xcb1f('0x53')]=function(_0x2dcf9d,_0x239fc2,_0x24bb56){var _0x4ad130={};var _0x37627a={};var _0x16a843;var _0x4b510e;return db['FreshsalesConfiguration'][_0xcb1f('0x4f')]({'where':{'id':_0x2dcf9d[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x239fc2,null))[_0xcb1f('0x27')](function(_0x4acf0c){if(_0x4acf0c){_0x16a843=_0x4acf0c;_0x37627a[_0xcb1f('0x32')]=_[_0xcb1f('0x34')](db[_0xcb1f('0x50')][_0xcb1f('0x2f')]);_0x37627a[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x2dcf9d[_0xcb1f('0x33')]);_0x37627a[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x37627a[_0xcb1f('0x32')],_0x37627a[_0xcb1f('0x33')]);_0x4ad130['attributes']=_[_0xcb1f('0x36')](_0x37627a[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x2dcf9d[_0xcb1f('0x33')][_0xcb1f('0x37')]));_0x4ad130[_0xcb1f('0x38')]=_0x4ad130[_0xcb1f('0x38')]['length']?_0x4ad130[_0xcb1f('0x38')]:_0x37627a[_0xcb1f('0x32')];_0x4ad130[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x2dcf9d[_0xcb1f('0x33')]['sort']);_0x4ad130[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_[_0xcb1f('0x3e')](_0x2dcf9d['query'],_0x37627a[_0xcb1f('0x35')]));if(_0x2dcf9d['query'][_0xcb1f('0x3f')]){_0x4ad130[_0xcb1f('0x3d')]=_[_0xcb1f('0x40')](_0x4ad130[_0xcb1f('0x3d')],{'$or':_[_0xcb1f('0x2d')](_0x4ad130[_0xcb1f('0x38')],function(_0x2f8d40){var _0xdd5295={};_0xdd5295[_0x2f8d40]={'$like':'%'+_0x2dcf9d[_0xcb1f('0x33')]['filter']+'%'};return _0xdd5295;})});}_0x4ad130=_['merge']({},_0x4ad130,_0x2dcf9d[_0xcb1f('0x42')]);return _0x16a843[_0xcb1f('0x53')](_0x4ad130);}})[_0xcb1f('0x27')](function(_0x13691e){if(_0x13691e){_0x4b510e=_0x13691e[_0xcb1f('0x49')];if(!_0x2dcf9d[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x4ad130['limit']=qs['limit'](_0x2dcf9d[_0xcb1f('0x33')]['limit']);_0x4ad130[_0xcb1f('0x1e')]=qs[_0xcb1f('0x1e')](_0x2dcf9d['query']['offset']);}return _0x16a843[_0xcb1f('0x53')](_0x4ad130);}})[_0xcb1f('0x27')](function(_0x28b811){if(_0x28b811){return _0x28b811?{'count':_0x4b510e,'rows':_0x28b811}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x239fc2,null))[_0xcb1f('0x47')](handleError(_0x239fc2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5651b7f..1739a4a 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 _0x6b19=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations'];(function(_0x120e85,_0x4ccbbe){var _0xfe578e=function(_0x2aea2e){while(--_0x2aea2e){_0x120e85['push'](_0x120e85['shift']());}};_0xfe578e(++_0x4ccbbe);}(_0x6b19,0x18c));var _0x96b1=function(_0x42de38,_0x21015d){_0x42de38=_0x42de38-0x0;var _0x2b55aa=_0x6b19[_0x42de38];return _0x2b55aa;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var logger=require(_0x96b1('0x2'))(_0x96b1('0x3'));var moment=require(_0x96b1('0x4'));var BPromise=require(_0x96b1('0x5'));var rp=require(_0x96b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x96b1('0x8'));module['exports']=function(_0x120ee5,_0xa748bb){return _0x120ee5[_0x96b1('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x96b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd56b=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x2760f1,_0x431f6b){var _0x175c71=function(_0x41f695){while(--_0x41f695){_0x2760f1['push'](_0x2760f1['shift']());}};_0x175c71(++_0x431f6b);}(_0xd56b,0x16f));var _0xbd56=function(_0x22077b,_0x5d75f1){_0x22077b=_0x22077b-0x0;var _0x50c8f9=_0xd56b[_0x22077b];return _0x50c8f9;};'use strict';var _=require(_0xbd56('0x0'));var util=require(_0xbd56('0x1'));var logger=require(_0xbd56('0x2'))(_0xbd56('0x3'));var moment=require(_0xbd56('0x4'));var BPromise=require(_0xbd56('0x5'));var rp=require(_0xbd56('0x6'));var fs=require('fs');var path=require(_0xbd56('0x7'));var rimraf=require(_0xbd56('0x8'));var config=require(_0xbd56('0x9'));var attributes=require(_0xbd56('0xa'));module[_0xbd56('0xb')]=function(_0x326c90,_0x25fa17){return _0x326c90['define'](_0xbd56('0xc'),attributes,{'tableName':_0xbd56('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index e74fc6b..156e249 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 _0x8117=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2dbcc8,_0x5e6b9a){var _0x4e0a07=function(_0x79cfc8){while(--_0x79cfc8){_0x2dbcc8['push'](_0x2dbcc8['shift']());}};_0x4e0a07(++_0x5e6b9a);}(_0x8117,0x88));var _0x7811=function(_0x2e729d,_0x1dab57){_0x2e729d=_0x2e729d-0x0;var _0x13d095=_0x8117[_0x2e729d];return _0x13d095;};'use strict';var _=require(_0x7811('0x0'));var util=require(_0x7811('0x1'));var moment=require(_0x7811('0x2'));var BPromise=require(_0x7811('0x3'));var rs=require(_0x7811('0x4'));var fs=require('fs');var Redis=require(_0x7811('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7811('0x6'));var logger=require(_0x7811('0x7'))('rpc');var config=require(_0x7811('0x8'));var jayson=require(_0x7811('0x9'));var client=jayson[_0x7811('0xa')][_0x7811('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b0110,_0x1a7e26,_0x1c26a6){return new BPromise(function(_0x1ea0f8,_0xbbff0f){return client[_0x7811('0xc')](_0x5b0110,_0x1c26a6)[_0x7811('0xd')](function(_0x2799d7){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a7e26,_0x7811('0xe'));logger[_0x7811('0xf')](_0x7811('0x10'),_0x1a7e26,_0x7811('0xe'),JSON['stringify'](_0x2799d7));if(_0x2799d7['error']){if(_0x2799d7['error'][_0x7811('0x11')]===0x1f4){logger[_0x7811('0x12')](_0x7811('0x13'),_0x1a7e26,_0x2799d7[_0x7811('0x12')][_0x7811('0x14')]);return _0xbbff0f(_0x2799d7[_0x7811('0x12')][_0x7811('0x14')]);}logger['error'](_0x7811('0x13'),_0x1a7e26,_0x2799d7[_0x7811('0x12')][_0x7811('0x14')]);return _0x1ea0f8(_0x2799d7[_0x7811('0x12')][_0x7811('0x14')]);}else{logger[_0x7811('0x15')](_0x7811('0x13'),_0x1a7e26,_0x7811('0xe'));_0x1ea0f8(_0x2799d7[_0x7811('0x16')]['message']);}})[_0x7811('0x17')](function(_0x546365){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a7e26,_0x546365);_0xbbff0f(_0x546365);});});} \ No newline at end of file +var _0x5483=['rpc','../../config/environment','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfba429,_0x17b844){var _0x36d40f=function(_0x141cc5){while(--_0x141cc5){_0xfba429['push'](_0xfba429['shift']());}};_0x36d40f(++_0x17b844);}(_0x5483,0x1a8));var _0x3548=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x5483[_0x32cf96];return _0x125cc1;};'use strict';var _=require(_0x3548('0x0'));var util=require(_0x3548('0x1'));var moment=require(_0x3548('0x2'));var BPromise=require(_0x3548('0x3'));var rs=require(_0x3548('0x4'));var fs=require('fs');var Redis=require(_0x3548('0x5'));var db=require(_0x3548('0x6'))['db'];var utils=require(_0x3548('0x7'));var logger=require('../../config/logger')(_0x3548('0x8'));var config=require(_0x3548('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3548('0xa')][_0x3548('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1987,_0x11f6d3,_0x496f49){return new BPromise(function(_0x3ddb6d,_0x24c179){return client['request'](_0x4e1987,_0x496f49)[_0x3548('0xc')](function(_0x2eafbf){logger['info'](_0x3548('0xd'),_0x11f6d3,_0x3548('0xe'));logger[_0x3548('0xf')](_0x3548('0x10'),_0x11f6d3,_0x3548('0xe'),JSON[_0x3548('0x11')](_0x2eafbf));if(_0x2eafbf[_0x3548('0x12')]){if(_0x2eafbf[_0x3548('0x12')][_0x3548('0x13')]===0x1f4){logger['error'](_0x3548('0xd'),_0x11f6d3,_0x2eafbf['error']['message']);return _0x24c179(_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);}logger[_0x3548('0x12')](_0x3548('0xd'),_0x11f6d3,_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);return _0x3ddb6d(_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);}else{logger[_0x3548('0x15')](_0x3548('0xd'),_0x11f6d3,_0x3548('0xe'));_0x3ddb6d(_0x2eafbf[_0x3548('0x16')][_0x3548('0x14')]);}})[_0x3548('0x17')](function(_0x1ad5b8){logger[_0x3548('0x12')](_0x3548('0xd'),_0x11f6d3,_0x1ad5b8);_0x24c179(_0x1ad5b8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 57577d6..164b6f4 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 _0x57d4=['/:id','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x5da416,_0x47b448){var _0x560fa5=function(_0x2ff855){while(--_0x2ff855){_0x5da416['push'](_0x5da416['shift']());}};_0x560fa5(++_0x47b448);}(_0x57d4,0x78));var _0x457d=function(_0x3b2ee7,_0x13804c){_0x3b2ee7=_0x3b2ee7-0x0;var _0x4bb4dc=_0x57d4[_0x3b2ee7];return _0x4bb4dc;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),auth[_0x457d('0xb')](),controller['show']);router['post']('/',auth[_0x457d('0xb')](),controller[_0x457d('0xe')]);router[_0x457d('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x457d('0x10')](_0x457d('0xd'),auth[_0x457d('0xb')](),controller[_0x457d('0x11')]);module[_0x457d('0x12')]=router; \ No newline at end of file +var _0x3c6d=['./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3c6d,0x199));var _0xd3c6=function(_0x402114,_0x18b963){_0x402114=_0x402114-0x0;var _0x1813a6=_0x3c6d[_0x402114];return _0x1813a6;};'use strict';var multer=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var path=require(_0xd3c6('0x2'));var timeout=require(_0xd3c6('0x3'));var express=require('express');var router=express[_0xd3c6('0x4')]();var fs_extra=require(_0xd3c6('0x5'));var auth=require(_0xd3c6('0x6'));var interaction=require(_0xd3c6('0x7'));var config=require(_0xd3c6('0x8'));var controller=require(_0xd3c6('0x9'));router['get']('/',auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xb')]);router[_0xd3c6('0xc')](_0xd3c6('0xd'),auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3c6('0xf')]);router[_0xd3c6('0x10')](_0xd3c6('0xd'),auth['isAuthenticated'](),controller[_0xd3c6('0x11')]);router['delete'](_0xd3c6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 20502d6..8d606ae 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 _0xa68d=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist'];(function(_0x1329bd,_0x1d2c7c){var _0x485d69=function(_0x49bfd8){while(--_0x49bfd8){_0x1329bd['push'](_0x1329bd['shift']());}};_0x485d69(++_0x1d2c7c);}(_0xa68d,0x9a));var _0xda68=function(_0x52103e,_0x56c62a){_0x52103e=_0x52103e-0x0;var _0x58b11a=_0xa68d[_0x52103e];return _0x58b11a;};'use strict';var Sequelize=require(_0xda68('0x0'));module[_0xda68('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xda68('0x2'),_0xda68('0x3'),_0xda68('0x4'),_0xda68('0x5')),'defaultValue':_0xda68('0x6')},'content':{'type':Sequelize[_0xda68('0x7')]},'key':{'type':Sequelize[_0xda68('0x7')]},'keyType':{'type':Sequelize[_0xda68('0x8')]('string',_0xda68('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xda68('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xda68('0x7')]},'customField':{'type':Sequelize[_0xda68('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e36=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x17ca23,_0x11c7d3){var _0x385e5c=function(_0x1d1d87){while(--_0x1d1d87){_0x17ca23['push'](_0x17ca23['shift']());}};_0x385e5c(++_0x11c7d3);}(_0x4e36,0x1b5));var _0x64e3=function(_0x4cc304,_0x33786f){_0x4cc304=_0x4cc304-0x0;var _0x98c06d=_0x4e36[_0x4cc304];return _0x98c06d;};'use strict';var Sequelize=require(_0x64e3('0x0'));module['exports']={'type':{'type':Sequelize[_0x64e3('0x1')](_0x64e3('0x2'),_0x64e3('0x3'),_0x64e3('0x4'),_0x64e3('0x5'),_0x64e3('0x6')),'defaultValue':_0x64e3('0x2')},'content':{'type':Sequelize[_0x64e3('0x7')]},'key':{'type':Sequelize[_0x64e3('0x7')]},'keyType':{'type':Sequelize[_0x64e3('0x1')](_0x64e3('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x64e3('0x7')]},'idField':{'type':Sequelize[_0x64e3('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x64e3('0x8')],'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 e7f08fb..e58af44 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 _0x1b17=['moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','FreshsalesField','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','rimraf','zip-dir','fast-json-patch'];(function(_0x40ff5f,_0x128f7b){var _0x3cac5b=function(_0x50cbd4){while(--_0x50cbd4){_0x40ff5f['push'](_0x40ff5f['shift']());}};_0x3cac5b(++_0x128f7b);}(_0x1b17,0xcc));var _0x71b1=function(_0x290201,_0x279632){_0x290201=_0x290201-0x0;var _0x3d5c08=_0x1b17[_0x290201];return _0x3d5c08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71b1('0x0'));var zipdir=require(_0x71b1('0x1'));var jsonpatch=require(_0x71b1('0x2'));var rp=require('request-promise');var moment=require(_0x71b1('0x3'));var BPromise=require(_0x71b1('0x4'));var Mustache=require('mustache');var util=require(_0x71b1('0x5'));var path=require(_0x71b1('0x6'));var sox=require(_0x71b1('0x7'));var csv=require('to-csv');var ejs=require(_0x71b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71b1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71b1('0xa'));var deskjs=require(_0x71b1('0xb'));var toCsv=require(_0x71b1('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71b1('0xd'));var authService=require(_0x71b1('0xe'));var qs=require(_0x71b1('0xf'));var as=require(_0x71b1('0x10'));var hardwareService=require(_0x71b1('0x11'));var logger=require('../../config/logger')(_0x71b1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x71b1('0x13'));var db=require(_0x71b1('0x14'))['db'];function respondWithStatusCode(_0x9b4077,_0xd7816d){_0xd7816d=_0xd7816d||0xcc;return function(_0xfc3bd6){if(_0xfc3bd6){return _0x9b4077[_0x71b1('0x15')](_0xd7816d);}return _0x9b4077['status'](_0xd7816d)[_0x71b1('0x16')]();};}function respondWithResult(_0x9cce4d,_0x19046c){_0x19046c=_0x19046c||0xc8;return function(_0x15c275){if(_0x15c275){return _0x9cce4d[_0x71b1('0x17')](_0x19046c)[_0x71b1('0x18')](_0x15c275);}};}function respondWithFilteredResult(_0xbd7bac,_0x280010){return function(_0x5c3c95){if(_0x5c3c95){var _0x48a6e2=typeof _0x280010[_0x71b1('0x19')]==='undefined'&&typeof _0x280010[_0x71b1('0x1a')]==='undefined';var _0x27e81d=_0x5c3c95[_0x71b1('0x1b')];var _0x29890d=_0x48a6e2?0x0:_0x280010[_0x71b1('0x19')];var _0x877420=_0x48a6e2?_0x5c3c95[_0x71b1('0x1b')]:_0x280010[_0x71b1('0x19')]+_0x280010['limit'];var _0x9c790c;if(_0x877420>=_0x27e81d){_0x877420=_0x27e81d;_0x9c790c=0xc8;}else{_0x9c790c=0xce;}_0xbd7bac[_0x71b1('0x17')](_0x9c790c);return _0xbd7bac[_0x71b1('0x1c')](_0x71b1('0x1d'),_0x29890d+'-'+_0x877420+'/'+_0x27e81d)[_0x71b1('0x18')](_0x5c3c95);}return null;};}function patchUpdates(_0x1971d4){return function(_0x1596e8){try{jsonpatch[_0x71b1('0x1e')](_0x1596e8,_0x1971d4,!![]);}catch(_0x2a07c8){return BPromise[_0x71b1('0x1f')](_0x2a07c8);}return _0x1596e8[_0x71b1('0x20')]();};}function saveUpdates(_0xc20191,_0x53e02c){return function(_0x3c3978){if(_0x3c3978){return _0x3c3978[_0x71b1('0x21')](_0xc20191)['then'](function(_0x10dad2){return _0x10dad2;});}return null;};}function removeEntity(_0x2924ac,_0x39a8be){return function(_0x3f1259){if(_0x3f1259){return _0x3f1259[_0x71b1('0x22')]()[_0x71b1('0x23')](function(){_0x2924ac['status'](0xcc)[_0x71b1('0x16')]();});}};}function handleEntityNotFound(_0xe31240,_0x5bfc5a){return function(_0x203c51){if(!_0x203c51){_0xe31240[_0x71b1('0x15')](0x194);}return _0x203c51;};}function handleError(_0x3d4185,_0x1e836e){_0x1e836e=_0x1e836e||0x1f4;return function(_0x338116){logger[_0x71b1('0x24')](_0x338116['stack']);if(_0x338116['name']){delete _0x338116[_0x71b1('0x25')];}_0x3d4185[_0x71b1('0x17')](_0x1e836e)[_0x71b1('0x26')](_0x338116);};}exports['index']=function(_0x3dc5af,_0x42e7d6){var _0x5b6a46={},_0x523ef2={},_0x145826={'count':0x0,'rows':[]};var _0x252bfa=_['map'](db[_0x71b1('0x27')][_0x71b1('0x28')],function(_0xc370e1){return{'name':_0xc370e1['fieldName'],'type':_0xc370e1[_0x71b1('0x29')][_0x71b1('0x2a')]};});_0x523ef2[_0x71b1('0x2b')]=_[_0x71b1('0x2c')](_0x252bfa,_0x71b1('0x25'));_0x523ef2[_0x71b1('0x2d')]=_[_0x71b1('0x2e')](_0x3dc5af[_0x71b1('0x2d')]);_0x523ef2['filters']=_['intersection'](_0x523ef2[_0x71b1('0x2b')],_0x523ef2[_0x71b1('0x2d')]);_0x5b6a46[_0x71b1('0x2f')]=_['intersection'](_0x523ef2[_0x71b1('0x2b')],qs[_0x71b1('0x30')](_0x3dc5af[_0x71b1('0x2d')][_0x71b1('0x30')]));_0x5b6a46[_0x71b1('0x2f')]=_0x5b6a46['attributes'][_0x71b1('0x31')]?_0x5b6a46['attributes']:_0x523ef2[_0x71b1('0x2b')];if(!_0x3dc5af[_0x71b1('0x2d')]['hasOwnProperty'](_0x71b1('0x32'))){_0x5b6a46[_0x71b1('0x1a')]=qs[_0x71b1('0x1a')](_0x3dc5af[_0x71b1('0x2d')]['limit']);_0x5b6a46[_0x71b1('0x19')]=qs[_0x71b1('0x19')](_0x3dc5af[_0x71b1('0x2d')]['offset']);}_0x5b6a46[_0x71b1('0x33')]=qs[_0x71b1('0x34')](_0x3dc5af['query']['sort']);_0x5b6a46[_0x71b1('0x35')]=qs[_0x71b1('0x36')](_[_0x71b1('0x37')](_0x3dc5af[_0x71b1('0x2d')],_0x523ef2[_0x71b1('0x36')]),_0x252bfa);if(_0x3dc5af[_0x71b1('0x2d')][_0x71b1('0x38')]){_0x5b6a46[_0x71b1('0x35')]=_[_0x71b1('0x39')](_0x5b6a46[_0x71b1('0x35')],{'$or':_['map'](_0x252bfa,function(_0x3bcd36){if(_0x3bcd36['type']!=='VIRTUAL'){var _0x55c10e={};_0x55c10e[_0x3bcd36['name']]={'$like':'%'+_0x3dc5af[_0x71b1('0x2d')]['filter']+'%'};return _0x55c10e;}})});}_0x5b6a46=_[_0x71b1('0x39')]({},_0x5b6a46,_0x3dc5af['options']);var _0x3ba927={'where':_0x5b6a46[_0x71b1('0x35')]};return db[_0x71b1('0x27')][_0x71b1('0x1b')](_0x3ba927)[_0x71b1('0x23')](function(_0xceaefb){_0x145826[_0x71b1('0x1b')]=_0xceaefb;if(_0x3dc5af['query'][_0x71b1('0x3a')]){_0x5b6a46[_0x71b1('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0x71b1('0x3c')](_0x5b6a46);})[_0x71b1('0x23')](function(_0x33e575){_0x145826[_0x71b1('0x3d')]=_0x33e575;return _0x145826;})[_0x71b1('0x23')](respondWithFilteredResult(_0x42e7d6,_0x5b6a46))['catch'](handleError(_0x42e7d6,null));};exports[_0x71b1('0x3e')]=function(_0x3bfd91,_0x103953){var _0x11abb9={'raw':!![],'where':{'id':_0x3bfd91[_0x71b1('0x3f')]['id']}},_0x2ba029={};_0x2ba029[_0x71b1('0x2b')]=_[_0x71b1('0x2e')](db[_0x71b1('0x27')][_0x71b1('0x28')]);_0x2ba029[_0x71b1('0x2d')]=_[_0x71b1('0x2e')](_0x3bfd91[_0x71b1('0x2d')]);_0x2ba029[_0x71b1('0x36')]=_[_0x71b1('0x40')](_0x2ba029[_0x71b1('0x2b')],_0x2ba029[_0x71b1('0x2d')]);_0x11abb9['attributes']=_['intersection'](_0x2ba029['model'],qs[_0x71b1('0x30')](_0x3bfd91[_0x71b1('0x2d')][_0x71b1('0x30')]));_0x11abb9[_0x71b1('0x2f')]=_0x11abb9[_0x71b1('0x2f')][_0x71b1('0x31')]?_0x11abb9[_0x71b1('0x2f')]:_0x2ba029['model'];if(_0x3bfd91[_0x71b1('0x2d')][_0x71b1('0x3a')]){_0x11abb9[_0x71b1('0x3b')]=[{'all':!![]}];}_0x11abb9=_[_0x71b1('0x39')]({},_0x11abb9,_0x3bfd91['options']);return db[_0x71b1('0x27')][_0x71b1('0x41')](_0x11abb9)['then'](handleEntityNotFound(_0x103953,null))[_0x71b1('0x23')](respondWithResult(_0x103953,null))['catch'](handleError(_0x103953,null));};exports[_0x71b1('0x42')]=function(_0x393dc3,_0x537352){return db[_0x71b1('0x27')][_0x71b1('0x42')](_0x393dc3[_0x71b1('0x43')],{})['then'](respondWithResult(_0x537352,0xc9))[_0x71b1('0x44')](handleError(_0x537352,null));};exports[_0x71b1('0x21')]=function(_0x5c66d2,_0x521779){if(_0x5c66d2[_0x71b1('0x43')]['id']){delete _0x5c66d2['body']['id'];}return db[_0x71b1('0x27')][_0x71b1('0x41')]({'where':{'id':_0x5c66d2[_0x71b1('0x3f')]['id']}})[_0x71b1('0x23')](handleEntityNotFound(_0x521779,null))[_0x71b1('0x23')](saveUpdates(_0x5c66d2[_0x71b1('0x43')],null))['then'](respondWithResult(_0x521779,null))['catch'](handleError(_0x521779,null));};exports[_0x71b1('0x22')]=function(_0x5571c0,_0x510270){return db[_0x71b1('0x27')]['find']({'where':{'id':_0x5571c0[_0x71b1('0x3f')]['id']}})[_0x71b1('0x23')](handleEntityNotFound(_0x510270,null))[_0x71b1('0x23')](removeEntity(_0x510270,null))[_0x71b1('0x44')](handleError(_0x510270,null));}; \ No newline at end of file +var _0x082b=['reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','options','where','FreshsalesField','count','includeAll','include','rows','show','find','create','body','catch','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','apply'];(function(_0x3b3178,_0x249501){var _0x1d0ee6=function(_0x23150b){while(--_0x23150b){_0x3b3178['push'](_0x3b3178['shift']());}};_0x1d0ee6(++_0x249501);}(_0x082b,0x140));var _0xb082=function(_0x211118,_0x47e09e){_0x211118=_0x211118-0x0;var _0x463d8c=_0x082b[_0x211118];return _0x463d8c;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb082('0x1'));var rp=require(_0xb082('0x2'));var moment=require(_0xb082('0x3'));var BPromise=require(_0xb082('0x4'));var Mustache=require(_0xb082('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb082('0x6'));var csv=require(_0xb082('0x7'));var ejs=require(_0xb082('0x8'));var fs=require('fs');var fs_extra=require(_0xb082('0x9'));var _=require(_0xb082('0xa'));var squel=require(_0xb082('0xb'));var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb082('0x7'));var querystring=require(_0xb082('0xe'));var Papa=require(_0xb082('0xf'));var Redis=require(_0xb082('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb082('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb082('0x12'));var logger=require('../../config/logger')(_0xb082('0x13'));var utils=require(_0xb082('0x14'));var config=require(_0xb082('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb082('0x16'))['db'];function respondWithStatusCode(_0x420308,_0x1e40ef){_0x1e40ef=_0x1e40ef||0xcc;return function(_0x541773){if(_0x541773){return _0x420308[_0xb082('0x17')](_0x1e40ef);}return _0x420308['status'](_0x1e40ef)['end']();};}function respondWithResult(_0x1d92f0,_0xffc692){_0xffc692=_0xffc692||0xc8;return function(_0x55088f){if(_0x55088f){return _0x1d92f0[_0xb082('0x18')](_0xffc692)[_0xb082('0x19')](_0x55088f);}};}function respondWithFilteredResult(_0x274e61,_0x175214){return function(_0x5ee137){if(_0x5ee137){var _0x9e6240=typeof _0x175214[_0xb082('0x1a')]==='undefined'&&typeof _0x175214[_0xb082('0x1b')]===_0xb082('0x1c');var _0x3242eb=_0x5ee137['count'];var _0x445049=_0x9e6240?0x0:_0x175214[_0xb082('0x1a')];var _0x485416=_0x9e6240?_0x5ee137['count']:_0x175214[_0xb082('0x1a')]+_0x175214[_0xb082('0x1b')];var _0x6cdcf5;if(_0x485416>=_0x3242eb){_0x485416=_0x3242eb;_0x6cdcf5=0xc8;}else{_0x6cdcf5=0xce;}_0x274e61[_0xb082('0x18')](_0x6cdcf5);return _0x274e61['set']('Content-Range',_0x445049+'-'+_0x485416+'/'+_0x3242eb)[_0xb082('0x19')](_0x5ee137);}return null;};}function patchUpdates(_0x26f644){return function(_0x4aaac0){try{jsonpatch[_0xb082('0x1d')](_0x4aaac0,_0x26f644,!![]);}catch(_0x5ecbfb){return BPromise[_0xb082('0x1e')](_0x5ecbfb);}return _0x4aaac0['save']();};}function saveUpdates(_0x4969af,_0x7dc4bc){return function(_0x7ffa66){if(_0x7ffa66){return _0x7ffa66[_0xb082('0x1f')](_0x4969af)[_0xb082('0x20')](function(_0x59826b){return _0x59826b;});}return null;};}function removeEntity(_0x48237f,_0x37d2a0){return function(_0x567240){if(_0x567240){return _0x567240[_0xb082('0x21')]()[_0xb082('0x20')](function(){_0x48237f[_0xb082('0x18')](0xcc)[_0xb082('0x22')]();});}};}function handleEntityNotFound(_0x373cfe,_0x599567){return function(_0x21b076){if(!_0x21b076){_0x373cfe[_0xb082('0x17')](0x194);}return _0x21b076;};}function handleError(_0x47a1c8,_0x2e646a){_0x2e646a=_0x2e646a||0x1f4;return function(_0x23e597){logger[_0xb082('0x23')](_0x23e597[_0xb082('0x24')]);if(_0x23e597['name']){delete _0x23e597[_0xb082('0x25')];}_0x47a1c8[_0xb082('0x18')](_0x2e646a)[_0xb082('0x26')](_0x23e597);};}exports[_0xb082('0x27')]=function(_0x53cccf,_0x36a19e){var _0x2fb55b={},_0x11a669={},_0x4c7e2c={'count':0x0,'rows':[]};var _0x123dd9=_[_0xb082('0x28')](db['FreshsalesField'][_0xb082('0x29')],function(_0x12516e){return{'name':_0x12516e['fieldName'],'type':_0x12516e['type']['key']};});_0x11a669[_0xb082('0x2a')]=_[_0xb082('0x28')](_0x123dd9,_0xb082('0x25'));_0x11a669[_0xb082('0x2b')]=_['keys'](_0x53cccf[_0xb082('0x2b')]);_0x11a669['filters']=_[_0xb082('0x2c')](_0x11a669['model'],_0x11a669['query']);_0x2fb55b[_0xb082('0x2d')]=_['intersection'](_0x11a669['model'],qs[_0xb082('0x2e')](_0x53cccf['query']['fields']));_0x2fb55b[_0xb082('0x2d')]=_0x2fb55b[_0xb082('0x2d')][_0xb082('0x2f')]?_0x2fb55b['attributes']:_0x11a669[_0xb082('0x2a')];if(!_0x53cccf[_0xb082('0x2b')][_0xb082('0x30')](_0xb082('0x31'))){_0x2fb55b[_0xb082('0x1b')]=qs[_0xb082('0x1b')](_0x53cccf[_0xb082('0x2b')]['limit']);_0x2fb55b[_0xb082('0x1a')]=qs['offset'](_0x53cccf[_0xb082('0x2b')]['offset']);}_0x2fb55b[_0xb082('0x32')]=qs[_0xb082('0x33')](_0x53cccf[_0xb082('0x2b')]['sort']);_0x2fb55b['where']=qs[_0xb082('0x34')](_[_0xb082('0x35')](_0x53cccf['query'],_0x11a669[_0xb082('0x34')]),_0x123dd9);if(_0x53cccf[_0xb082('0x2b')][_0xb082('0x36')]){_0x2fb55b['where']=_[_0xb082('0x37')](_0x2fb55b['where'],{'$or':_['map'](_0x123dd9,function(_0x513f8b){if(_0x513f8b[_0xb082('0x38')]!=='VIRTUAL'){var _0x3523c8={};_0x3523c8[_0x513f8b[_0xb082('0x25')]]={'$like':'%'+_0x53cccf['query'][_0xb082('0x36')]+'%'};return _0x3523c8;}})});}_0x2fb55b=_[_0xb082('0x37')]({},_0x2fb55b,_0x53cccf[_0xb082('0x39')]);var _0x46bc33={'where':_0x2fb55b[_0xb082('0x3a')]};return db[_0xb082('0x3b')][_0xb082('0x3c')](_0x46bc33)[_0xb082('0x20')](function(_0x16f45a){_0x4c7e2c[_0xb082('0x3c')]=_0x16f45a;if(_0x53cccf['query'][_0xb082('0x3d')]){_0x2fb55b[_0xb082('0x3e')]=[{'all':!![]}];}return db[_0xb082('0x3b')]['findAll'](_0x2fb55b);})['then'](function(_0x423c6d){_0x4c7e2c[_0xb082('0x3f')]=_0x423c6d;return _0x4c7e2c;})[_0xb082('0x20')](respondWithFilteredResult(_0x36a19e,_0x2fb55b))['catch'](handleError(_0x36a19e,null));};exports[_0xb082('0x40')]=function(_0x54b17b,_0x469582){var _0x4e71d2={'raw':!![],'where':{'id':_0x54b17b['params']['id']}},_0x2168d2={};_0x2168d2['model']=_['keys'](db[_0xb082('0x3b')][_0xb082('0x29')]);_0x2168d2[_0xb082('0x2b')]=_['keys'](_0x54b17b['query']);_0x2168d2['filters']=_['intersection'](_0x2168d2[_0xb082('0x2a')],_0x2168d2[_0xb082('0x2b')]);_0x4e71d2[_0xb082('0x2d')]=_[_0xb082('0x2c')](_0x2168d2[_0xb082('0x2a')],qs[_0xb082('0x2e')](_0x54b17b['query']['fields']));_0x4e71d2[_0xb082('0x2d')]=_0x4e71d2[_0xb082('0x2d')][_0xb082('0x2f')]?_0x4e71d2[_0xb082('0x2d')]:_0x2168d2['model'];if(_0x54b17b[_0xb082('0x2b')]['includeAll']){_0x4e71d2[_0xb082('0x3e')]=[{'all':!![]}];}_0x4e71d2=_['merge']({},_0x4e71d2,_0x54b17b[_0xb082('0x39')]);return db[_0xb082('0x3b')][_0xb082('0x41')](_0x4e71d2)[_0xb082('0x20')](handleEntityNotFound(_0x469582,null))['then'](respondWithResult(_0x469582,null))['catch'](handleError(_0x469582,null));};exports[_0xb082('0x42')]=function(_0xb3634f,_0x58535){return db[_0xb082('0x3b')][_0xb082('0x42')](_0xb3634f[_0xb082('0x43')],{})[_0xb082('0x20')](respondWithResult(_0x58535,0xc9))[_0xb082('0x44')](handleError(_0x58535,null));};exports['update']=function(_0x5edb37,_0x2b8d32){if(_0x5edb37[_0xb082('0x43')]['id']){delete _0x5edb37[_0xb082('0x43')]['id'];}return db[_0xb082('0x3b')][_0xb082('0x41')]({'where':{'id':_0x5edb37[_0xb082('0x45')]['id']}})[_0xb082('0x20')](handleEntityNotFound(_0x2b8d32,null))['then'](saveUpdates(_0x5edb37['body'],null))[_0xb082('0x20')](respondWithResult(_0x2b8d32,null))[_0xb082('0x44')](handleError(_0x2b8d32,null));};exports['destroy']=function(_0x5b568b,_0x10c31e){return db['FreshsalesField'][_0xb082('0x41')]({'where':{'id':_0x5b568b[_0xb082('0x45')]['id']}})[_0xb082('0x20')](handleEntityNotFound(_0x10c31e,null))[_0xb082('0x20')](removeEntity(_0x10c31e,null))['catch'](handleError(_0x10c31e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 65bf67c..35b3a2c 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 _0x9a18=['idField','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x4b2f69,_0x254b31){var _0x26fc23=function(_0x565b95){while(--_0x565b95){_0x4b2f69['push'](_0x4b2f69['shift']());}};_0x26fc23(++_0x254b31);}(_0x9a18,0x187));var _0x89a1=function(_0x172b90,_0x5482ab){_0x172b90=_0x172b90-0x0;var _0x2fa679=_0x9a18[_0x172b90];return _0x2fa679;};'use strict';var _=require(_0x89a1('0x0'));var util=require('util');var logger=require(_0x89a1('0x1'))(_0x89a1('0x2'));var moment=require(_0x89a1('0x3'));var BPromise=require(_0x89a1('0x4'));var rp=require(_0x89a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89a1('0x6'));var config=require(_0x89a1('0x7'));var attributes=require(_0x89a1('0x8'));module[_0x89a1('0x9')]=function(_0x3ce160,_0x216441){return _0x3ce160[_0x89a1('0xa')](_0x89a1('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x89a1('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb35=['idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index'];(function(_0x4cf2b6,_0x4d2485){var _0xd3c24f=function(_0x16ede5){while(--_0x16ede5){_0x4cf2b6['push'](_0x4cf2b6['shift']());}};_0xd3c24f(++_0x4d2485);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x305ba9,_0x42ce42){_0x305ba9=_0x305ba9-0x0;var _0x368966=_0xbb35[_0x305ba9];return _0x368966;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5bb3('0xc'),'fields':[_0x5bb3('0xd'),_0x5bb3('0xe')],'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 75d1945..9229763 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 _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xfcf0,0x138));var _0x0fcf=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xfcf0[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2a173d,_0x27ca7a){var _0x37f81e=function(_0x1a4ab0){while(--_0x1a4ab0){_0x2a173d['push'](_0x2a173d['shift']());}};_0x37f81e(++_0x27ca7a);}(_0x33af,0xec));var _0xf33a=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x33af[_0x2649e2];return _0x4797d4;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 958b4b8..4e263c4 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(_0x310eb1,_0x283149){var _0x3b145f=function(_0xcc1eb3){while(--_0xcc1eb3){_0x310eb1['push'](_0x310eb1['shift']());}};_0x3b145f(++_0x283149);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1093de,_0x2a2e36){var _0x75d610=function(_0x412e4d){while(--_0x412e4d){_0x1093de['push'](_0x1093de['shift']());}};_0x75d610(++_0x2a2e36);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e7362fb..7a9fbeb 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 _0xca6e=['exports','STRING','ENUM','integrationTab','sequelize'];(function(_0x13f2f6,_0x3a1094){var _0xb0417c=function(_0x4b07d7){while(--_0x4b07d7){_0x13f2f6['push'](_0x13f2f6['shift']());}};_0xb0417c(++_0x3a1094);}(_0xca6e,0x1c1));var _0xeca6=function(_0x4526ff,_0x5bc461){_0x4526ff=_0x4526ff-0x0;var _0x40c869=_0xca6e[_0x4526ff];return _0x40c869;};'use strict';var Sequelize=require(_0xeca6('0x0'));module[_0xeca6('0x1')]={'name':{'type':Sequelize[_0xeca6('0x2')]},'description':{'type':Sequelize[_0xeca6('0x2')]},'username':{'type':Sequelize[_0xeca6('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xeca6('0x2')]},'password':{'type':Sequelize[_0xeca6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xeca6('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xeca6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeca6('0x3')](_0xeca6('0x4'),'newTab'),'defaultValue':_0xeca6('0x4')}}; \ No newline at end of file +var _0x6888=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x6888,0xd2));var _0x8688=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6888[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x8688('0x0'));module['exports']={'name':{'type':Sequelize[_0x8688('0x1')]},'description':{'type':Sequelize[_0x8688('0x1')]},'username':{'type':Sequelize[_0x8688('0x1')],'unique':_0x8688('0x2')},'remoteUri':{'type':Sequelize[_0x8688('0x1')]},'password':{'type':Sequelize[_0x8688('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8688('0x1')]},'serverUrl':{'type':Sequelize[_0x8688('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8688('0x3')](_0x8688('0x4'),_0x8688('0x5')),'defaultValue':_0x8688('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0501b8d..c40e186 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 _0xdf26=['True','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','type','key','map','name','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','SalesforceAccount','create','body','find','params','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','securityToken','slice','substring','Connection','clientSecret','login','password','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','Description','string','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues'];(function(_0x4b1559,_0xdc4280){var _0xfbf328=function(_0x53795d){while(--_0x53795d){_0x4b1559['push'](_0x4b1559['shift']());}};_0xfbf328(++_0xdc4280);}(_0xdf26,0xf3));var _0x6df2=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xdf26[_0xec034];return _0x2c5a19;};'use strict';var emlformat=require(_0x6df2('0x0'));var rimraf=require(_0x6df2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6df2('0x2'));var rp=require(_0x6df2('0x3'));var moment=require(_0x6df2('0x4'));var BPromise=require(_0x6df2('0x5'));var Mustache=require('mustache');var util=require(_0x6df2('0x6'));var path=require('path');var sox=require(_0x6df2('0x7'));var csv=require(_0x6df2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6df2('0x9'));var _=require(_0x6df2('0xa'));var squel=require(_0x6df2('0xb'));var crypto=require(_0x6df2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6df2('0xd'));var toCsv=require(_0x6df2('0x8'));var querystring=require(_0x6df2('0xe'));var Papa=require(_0x6df2('0xf'));var Redis=require(_0x6df2('0x10'));var authService=require(_0x6df2('0x11'));var qs=require(_0x6df2('0x12'));var as=require(_0x6df2('0x13'));var hardwareService=require(_0x6df2('0x14'));var logger=require('../../config/logger')(_0x6df2('0x15'));var utils=require(_0x6df2('0x16'));var config=require(_0x6df2('0x17'));var licenseUtil=require(_0x6df2('0x18'));var db=require(_0x6df2('0x19'))['db'];var integrations=require(_0x6df2('0x1a'));function respondWithStatusCode(_0x58908c,_0x4d73d7){_0x4d73d7=_0x4d73d7||0xcc;return function(_0x3bac12){if(_0x3bac12){return _0x58908c[_0x6df2('0x1b')](_0x4d73d7);}return _0x58908c['status'](_0x4d73d7)[_0x6df2('0x1c')]();};}function respondWithResult(_0x259c2e,_0xcca415){_0xcca415=_0xcca415||0xc8;return function(_0x2cbb67){if(_0x2cbb67){return _0x259c2e[_0x6df2('0x1d')](_0xcca415)[_0x6df2('0x1e')](_0x2cbb67);}};}function respondWithFilteredResult(_0x41ca7f,_0x39e2a0){return function(_0xc88e88){if(_0xc88e88){var _0x9b4fdc=typeof _0x39e2a0[_0x6df2('0x1f')]==='undefined'&&typeof _0x39e2a0[_0x6df2('0x20')]===_0x6df2('0x21');var _0x43e3d0=_0xc88e88['count'];var _0xdf2b5=_0x9b4fdc?0x0:_0x39e2a0[_0x6df2('0x1f')];var _0x36371d=_0x9b4fdc?_0xc88e88[_0x6df2('0x22')]:_0x39e2a0[_0x6df2('0x1f')]+_0x39e2a0[_0x6df2('0x20')];var _0x428d66;if(_0x36371d>=_0x43e3d0){_0x36371d=_0x43e3d0;_0x428d66=0xc8;}else{_0x428d66=0xce;}_0x41ca7f[_0x6df2('0x1d')](_0x428d66);return _0x41ca7f['set'](_0x6df2('0x23'),_0xdf2b5+'-'+_0x36371d+'/'+_0x43e3d0)[_0x6df2('0x1e')](_0xc88e88);}return null;};}function patchUpdates(_0x2fee38){return function(_0x59c824){try{jsonpatch[_0x6df2('0x24')](_0x59c824,_0x2fee38,!![]);}catch(_0x1dd8bb){return BPromise[_0x6df2('0x25')](_0x1dd8bb);}return _0x59c824[_0x6df2('0x26')]();};}function saveUpdates(_0x2209f4,_0x5216b9){return function(_0x1a86cb){if(_0x1a86cb){return _0x1a86cb[_0x6df2('0x27')](_0x2209f4)['then'](function(_0x1a047f){return _0x1a047f;});}return null;};}function removeEntity(_0x215283,_0x434330){return function(_0x465921){if(_0x465921){return _0x465921[_0x6df2('0x28')]()[_0x6df2('0x29')](function(){_0x215283[_0x6df2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5bae,_0xd40470){return function(_0x12f2d5){if(!_0x12f2d5){_0x4e5bae['sendStatus'](0x194);}return _0x12f2d5;};}function handleError(_0x4ece26,_0x46eb89){_0x46eb89=_0x46eb89||0x1f4;return function(_0x5a8c25){logger[_0x6df2('0x2a')](_0x5a8c25[_0x6df2('0x2b')]);if(_0x5a8c25['name']){delete _0x5a8c25['name'];}_0x4ece26['status'](_0x46eb89)[_0x6df2('0x2c')](_0x5a8c25);};}exports[_0x6df2('0x2d')]=function(_0x131351,_0xe89ff6){var _0x58b811={},_0xd48af8={},_0x374e7e={'count':0x0,'rows':[]};var _0x58bc76=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x4a11a2){return{'name':_0x4a11a2['fieldName'],'type':_0x4a11a2[_0x6df2('0x2e')][_0x6df2('0x2f')]};});_0xd48af8['model']=_[_0x6df2('0x30')](_0x58bc76,_0x6df2('0x31'));_0xd48af8['query']=_[_0x6df2('0x32')](_0x131351['query']);_0xd48af8[_0x6df2('0x33')]=_[_0x6df2('0x34')](_0xd48af8[_0x6df2('0x35')],_0xd48af8[_0x6df2('0x36')]);_0x58b811[_0x6df2('0x37')]=_['intersection'](_0xd48af8[_0x6df2('0x35')],qs[_0x6df2('0x38')](_0x131351['query'][_0x6df2('0x38')]));_0x58b811['attributes']=_0x58b811[_0x6df2('0x37')][_0x6df2('0x39')]?_0x58b811[_0x6df2('0x37')]:_0xd48af8[_0x6df2('0x35')];if(!_0x131351[_0x6df2('0x36')][_0x6df2('0x3a')](_0x6df2('0x3b'))){_0x58b811[_0x6df2('0x20')]=qs[_0x6df2('0x20')](_0x131351[_0x6df2('0x36')][_0x6df2('0x20')]);_0x58b811[_0x6df2('0x1f')]=qs[_0x6df2('0x1f')](_0x131351[_0x6df2('0x36')][_0x6df2('0x1f')]);}_0x58b811[_0x6df2('0x3c')]=qs[_0x6df2('0x3d')](_0x131351['query'][_0x6df2('0x3d')]);_0x58b811['where']=qs['filters'](_[_0x6df2('0x3e')](_0x131351[_0x6df2('0x36')],_0xd48af8['filters']),_0x58bc76);if(_0x131351[_0x6df2('0x36')][_0x6df2('0x3f')]){_0x58b811[_0x6df2('0x40')]=_['merge'](_0x58b811[_0x6df2('0x40')],{'$or':_[_0x6df2('0x30')](_0x58bc76,function(_0x392fe7){if(_0x392fe7['type']!=='VIRTUAL'){var _0x2c8ccf={};_0x2c8ccf[_0x392fe7[_0x6df2('0x31')]]={'$like':'%'+_0x131351[_0x6df2('0x36')][_0x6df2('0x3f')]+'%'};return _0x2c8ccf;}})});}_0x58b811=_[_0x6df2('0x41')]({},_0x58b811,_0x131351[_0x6df2('0x42')]);var _0x1ce758={'where':_0x58b811[_0x6df2('0x40')]};return db['SalesforceAccount'][_0x6df2('0x22')](_0x1ce758)[_0x6df2('0x29')](function(_0x174ba8){_0x374e7e['count']=_0x174ba8;if(_0x131351[_0x6df2('0x36')][_0x6df2('0x43')]){_0x58b811[_0x6df2('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x6df2('0x45')](_0x58b811);})[_0x6df2('0x29')](function(_0x216514){_0x374e7e['rows']=_0x216514;return _0x374e7e;})['then'](respondWithFilteredResult(_0xe89ff6,_0x58b811))[_0x6df2('0x46')](handleError(_0xe89ff6,null));};exports[_0x6df2('0x47')]=function(_0x27ba23,_0x5daab8){var _0x54f7b1={'raw':![],'where':{'id':_0x27ba23['params']['id']}},_0x28824d={};_0x28824d[_0x6df2('0x35')]=_['keys'](db[_0x6df2('0x48')]['rawAttributes']);_0x28824d[_0x6df2('0x36')]=_[_0x6df2('0x32')](_0x27ba23['query']);_0x28824d[_0x6df2('0x33')]=_[_0x6df2('0x34')](_0x28824d[_0x6df2('0x35')],_0x28824d[_0x6df2('0x36')]);_0x54f7b1[_0x6df2('0x37')]=_['intersection'](_0x28824d[_0x6df2('0x35')],qs[_0x6df2('0x38')](_0x27ba23[_0x6df2('0x36')][_0x6df2('0x38')]));_0x54f7b1['attributes']=_0x54f7b1[_0x6df2('0x37')][_0x6df2('0x39')]?_0x54f7b1[_0x6df2('0x37')]:_0x28824d[_0x6df2('0x35')];if(_0x27ba23['query'][_0x6df2('0x43')]){_0x54f7b1[_0x6df2('0x44')]=[{'all':!![]}];}_0x54f7b1=_[_0x6df2('0x41')]({},_0x54f7b1,_0x27ba23[_0x6df2('0x42')]);return db['SalesforceAccount']['find'](_0x54f7b1)[_0x6df2('0x29')](handleEntityNotFound(_0x5daab8,null))[_0x6df2('0x29')](respondWithResult(_0x5daab8,null))['catch'](handleError(_0x5daab8,null));};exports[_0x6df2('0x49')]=function(_0x2bebf4,_0x193c4e){return db[_0x6df2('0x48')][_0x6df2('0x49')](_0x2bebf4[_0x6df2('0x4a')],{})[_0x6df2('0x29')](respondWithResult(_0x193c4e,0xc9))[_0x6df2('0x46')](handleError(_0x193c4e,null));};exports[_0x6df2('0x27')]=function(_0x3f2813,_0x18c3b6){if(_0x3f2813[_0x6df2('0x4a')]['id']){delete _0x3f2813[_0x6df2('0x4a')]['id'];}return db['SalesforceAccount'][_0x6df2('0x4b')]({'where':{'id':_0x3f2813['params']['id']}})[_0x6df2('0x29')](handleEntityNotFound(_0x18c3b6,null))['then'](saveUpdates(_0x3f2813['body'],null))[_0x6df2('0x29')](respondWithResult(_0x18c3b6,null))['catch'](handleError(_0x18c3b6,null));};exports['destroy']=function(_0x16c034,_0x4da882){return db[_0x6df2('0x48')]['find']({'where':{'id':_0x16c034[_0x6df2('0x4c')]['id']}})[_0x6df2('0x29')](handleEntityNotFound(_0x4da882,null))[_0x6df2('0x29')](removeEntity(_0x4da882,null))[_0x6df2('0x46')](handleError(_0x4da882,null));};exports[_0x6df2('0x4d')]=function(_0x42dc62,_0x190a38,_0x45fb2f){var _0x5dc2b3={};var _0x249a51={};var _0x80d1d9;var _0x4edea1;return db[_0x6df2('0x48')]['findOne']({'where':{'id':_0x42dc62[_0x6df2('0x4c')]['id']}})[_0x6df2('0x29')](handleEntityNotFound(_0x190a38,null))[_0x6df2('0x29')](function(_0x38fa5d){if(_0x38fa5d){_0x80d1d9=_0x38fa5d;_0x249a51[_0x6df2('0x35')]=_[_0x6df2('0x32')](db[_0x6df2('0x4e')]['rawAttributes']);_0x249a51[_0x6df2('0x36')]=_[_0x6df2('0x32')](_0x42dc62[_0x6df2('0x36')]);_0x249a51[_0x6df2('0x33')]=_['intersection'](_0x249a51[_0x6df2('0x35')],_0x249a51['query']);_0x5dc2b3['attributes']=_[_0x6df2('0x34')](_0x249a51[_0x6df2('0x35')],qs['fields'](_0x42dc62[_0x6df2('0x36')]['fields']));_0x5dc2b3['attributes']=_0x5dc2b3[_0x6df2('0x37')][_0x6df2('0x39')]?_0x5dc2b3[_0x6df2('0x37')]:_0x249a51['model'];_0x5dc2b3['order']=qs[_0x6df2('0x3d')](_0x42dc62[_0x6df2('0x36')]['sort']);_0x5dc2b3[_0x6df2('0x40')]=qs[_0x6df2('0x33')](_[_0x6df2('0x3e')](_0x42dc62[_0x6df2('0x36')],_0x249a51[_0x6df2('0x33')]));if(_0x42dc62[_0x6df2('0x36')][_0x6df2('0x3f')]){_0x5dc2b3['where']=_['merge'](_0x5dc2b3[_0x6df2('0x40')],{'$or':_[_0x6df2('0x30')](_0x5dc2b3[_0x6df2('0x37')],function(_0x9b4924){var _0x1360a5={};_0x1360a5[_0x9b4924]={'$like':'%'+_0x42dc62['query'][_0x6df2('0x3f')]+'%'};return _0x1360a5;})});}_0x5dc2b3=_[_0x6df2('0x41')]({},_0x5dc2b3,_0x42dc62['options']);return _0x80d1d9[_0x6df2('0x4d')](_0x5dc2b3);}})[_0x6df2('0x29')](function(_0x400bbd){if(_0x400bbd){_0x4edea1=_0x400bbd[_0x6df2('0x39')];if(!_0x42dc62[_0x6df2('0x36')]['hasOwnProperty']('nolimit')){_0x5dc2b3[_0x6df2('0x20')]=qs[_0x6df2('0x20')](_0x42dc62[_0x6df2('0x36')][_0x6df2('0x20')]);_0x5dc2b3[_0x6df2('0x1f')]=qs[_0x6df2('0x1f')](_0x42dc62[_0x6df2('0x36')][_0x6df2('0x1f')]);}return _0x80d1d9[_0x6df2('0x4d')](_0x5dc2b3);}})['then'](function(_0x5ca9ea){if(_0x5ca9ea){return _0x5ca9ea?{'count':_0x4edea1,'rows':_0x5ca9ea}:null;}})[_0x6df2('0x29')](respondWithResult(_0x190a38,null))[_0x6df2('0x46')](handleError(_0x190a38,null));};exports[_0x6df2('0x4f')]=function(_0x523db7,_0x25cbed,_0x18e9a8){if(_0x523db7[_0x6df2('0x4a')]['id']){delete _0x523db7[_0x6df2('0x4a')]['id'];}return db[_0x6df2('0x48')][_0x6df2('0x50')]({'where':{'id':_0x523db7[_0x6df2('0x4c')]['id']}})[_0x6df2('0x29')](handleEntityNotFound(_0x25cbed,null))[_0x6df2('0x29')](function(_0x46c1b1){if(_0x46c1b1){_0x523db7[_0x6df2('0x4a')][_0x6df2('0x51')]=_0x46c1b1['id'];_0x523db7['body'][_0x6df2('0x52')]=integrations['getSubjects'](_0x523db7[_0x6df2('0x4a')][_0x6df2('0x53')],_0x523db7['body'][_0x6df2('0x2e')]);_0x523db7['body'][_0x6df2('0x54')]=integrations[_0x6df2('0x55')](_0x523db7[_0x6df2('0x4a')][_0x6df2('0x53')],_0x523db7[_0x6df2('0x4a')][_0x6df2('0x2e')]);return db[_0x6df2('0x4e')][_0x6df2('0x49')](_0x523db7[_0x6df2('0x4a')],{'include':[{'model':db['SalesforceField'],'as':_0x6df2('0x52')},{'model':db[_0x6df2('0x56')],'as':_0x6df2('0x54')}]});}return null;})[_0x6df2('0x29')](respondWithResult(_0x25cbed,null))[_0x6df2('0x46')](handleError(_0x25cbed,null));};exports[_0x6df2('0x57')]=function(_0x4eec34,_0xaaa17,_0x99325c){var _0x4b9997;var _0x3c40e6='';var _0xbf0ceb=_0x6df2('0x58');return db['SalesforceAccount'][_0x6df2('0x50')]({'where':{'id':_0x4eec34['params']['id']},'attributes':['id',_0x6df2('0x59'),'clientId','clientSecret','username','password',_0x6df2('0x5a')]})[_0x6df2('0x29')](handleEntityNotFound(_0xaaa17,null))['then'](function(_0x5c6edb){if(_0x5c6edb){_0x3c40e6=_0x5c6edb[_0x6df2('0x59')];var _0x12cddf=_0x3c40e6[_0x6df2('0x5b')](-0x1);if(_0x12cddf==='/'){_0x3c40e6=_0x3c40e6[_0x6df2('0x5c')](0x0,_0x3c40e6['lastIndexOf'](_0x12cddf));}_0x4b9997=new jsforce[(_0x6df2('0x5d'))]({'oauth2':{'loginUrl':_0x3c40e6,'clientId':_0x5c6edb['clientId'],'clientSecret':_0x5c6edb[_0x6df2('0x5e')]}});return _0x4b9997[_0x6df2('0x5f')](_0x5c6edb['username'],_0x5c6edb[_0x6df2('0x60')]['concat'](_0x5c6edb[_0x6df2('0x5a')]));}})[_0x6df2('0x29')](function(_0x3f5971){if(_0x3f5971){if(!_['isNil'](_0x4eec34[_0x6df2('0x36')]['ticketType'])){_0xbf0ceb=_0x4eec34[_0x6df2('0x36')][_0x6df2('0x61')];}return _0x4b9997[_0x6df2('0x62')](_0xbf0ceb)[_0x6df2('0x63')]();}})['then'](function(_0x1ef0b3){var _0x499968=[_0x6df2('0x64'),'ActivityDate',_0x6df2('0x65'),'IsRecurrence',_0x6df2('0x66'),_0x6df2('0x67')];var _0x647631=[_0x6df2('0x68'),'int',_0x6df2('0x69'),_0x6df2('0x6a'),_0x6df2('0x6b'),_0x6df2('0x6c'),_0x6df2('0x6d')];if(_0x1ef0b3){_['remove'](_0x1ef0b3['fields'],function(_0x5e41da){return _0x499968[_0x6df2('0x6e')](_0x5e41da[_0x6df2('0x31')])||!_0x647631[_0x6df2('0x6e')](_0x5e41da[_0x6df2('0x2e')]);});return{'count':_0x1ef0b3['fields'][_0x6df2('0x39')],'rows':_['map'](_0x1ef0b3[_0x6df2('0x38')],function(_0xcd9d41){return{'id':_0xcd9d41[_0x6df2('0x31')],'name':_0xcd9d41[_0x6df2('0x6f')],'custom':_0xcd9d41[_0x6df2('0x70')],'options':_0xcd9d41[_0x6df2('0x71')]['length']>0x0?_[_0x6df2('0x30')](_0xcd9d41[_0x6df2('0x71')],function(_0x3a7f4f){return{'name':_0x3a7f4f[_0x6df2('0x6f')],'value':_0x3a7f4f['value']};}):_0xcd9d41[_0x6df2('0x2e')]==_0x6df2('0x6a')?[{'name':_0x6df2('0x72'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})[_0x6df2('0x29')](respondWithResult(_0xaaa17,null))['catch'](function(_0x8e7799){var _0x9c36c3=_0x4eec34[_0x6df2('0x36')][_0x6df2('0x73')]?0x1f4:_0x8e7799[_0x6df2('0x74')]||0x1f4;logger[_0x6df2('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x6df2('0x57'),_0x9c36c3,JSON[_0x6df2('0x75')](_0x8e7799));delete _0x8e7799['name'];if(_0x9c36c3===0x191){_0x9c36c3=0x190;}_0xaaa17[_0x6df2('0x1d')](_0x9c36c3)[_0x6df2('0x2c')](_0x4eec34[_0x6df2('0x36')][_0x6df2('0x73')]?{'message':_0x6df2('0x76'),'statusCode':_0x8e7799[_0x6df2('0x74')]}:_0x8e7799);});}; \ No newline at end of file +var _0x6277=['False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','create','body','catch','getConfigurations','SalesforceConfiguration','length','findOne','Subjects','getSubjects','Descriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','string','int','picklist','boolean','textarea','includes','label'];(function(_0x44921b,_0x32a201){var _0x4907f5=function(_0x209840){while(--_0x209840){_0x44921b['push'](_0x44921b['shift']());}};_0x4907f5(++_0x32a201);}(_0x6277,0x7d));var _0x7627=function(_0x4b13f6,_0x53acfc){_0x4b13f6=_0x4b13f6-0x0;var _0x427747=_0x6277[_0x4b13f6];return _0x427747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7627('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7627('0x1'));var rp=require(_0x7627('0x2'));var moment=require(_0x7627('0x3'));var BPromise=require(_0x7627('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7627('0x5'));var sox=require(_0x7627('0x6'));var csv=require(_0x7627('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7627('0x8'));var _=require(_0x7627('0x9'));var squel=require(_0x7627('0xa'));var crypto=require(_0x7627('0xb'));var jsforce=require(_0x7627('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7627('0xd'));var Papa=require(_0x7627('0xe'));var Redis=require(_0x7627('0xf'));var authService=require(_0x7627('0x10'));var qs=require(_0x7627('0x11'));var as=require(_0x7627('0x12'));var hardwareService=require(_0x7627('0x13'));var logger=require(_0x7627('0x14'))(_0x7627('0x15'));var utils=require('../../config/utils');var config=require(_0x7627('0x16'));var licenseUtil=require(_0x7627('0x17'));var db=require(_0x7627('0x18'))['db'];var integrations=require(_0x7627('0x19'));function respondWithStatusCode(_0x3ab290,_0x2701b2){_0x2701b2=_0x2701b2||0xcc;return function(_0x5a32a2){if(_0x5a32a2){return _0x3ab290['sendStatus'](_0x2701b2);}return _0x3ab290[_0x7627('0x1a')](_0x2701b2)[_0x7627('0x1b')]();};}function respondWithResult(_0x4dd6d1,_0x4d9735){_0x4d9735=_0x4d9735||0xc8;return function(_0x3315fd){if(_0x3315fd){return _0x4dd6d1[_0x7627('0x1a')](_0x4d9735)[_0x7627('0x1c')](_0x3315fd);}};}function respondWithFilteredResult(_0x1a5209,_0x111fd6){return function(_0xe4ae5b){if(_0xe4ae5b){var _0x47bac3=typeof _0x111fd6['offset']==='undefined'&&typeof _0x111fd6['limit']==='undefined';var _0x266af0=_0xe4ae5b['count'];var _0x2d68ed=_0x47bac3?0x0:_0x111fd6[_0x7627('0x1d')];var _0x504611=_0x47bac3?_0xe4ae5b[_0x7627('0x1e')]:_0x111fd6['offset']+_0x111fd6[_0x7627('0x1f')];var _0x3732b0;if(_0x504611>=_0x266af0){_0x504611=_0x266af0;_0x3732b0=0xc8;}else{_0x3732b0=0xce;}_0x1a5209['status'](_0x3732b0);return _0x1a5209[_0x7627('0x20')](_0x7627('0x21'),_0x2d68ed+'-'+_0x504611+'/'+_0x266af0)['json'](_0xe4ae5b);}return null;};}function patchUpdates(_0x260979){return function(_0x1d1714){try{jsonpatch[_0x7627('0x22')](_0x1d1714,_0x260979,!![]);}catch(_0x497017){return BPromise[_0x7627('0x23')](_0x497017);}return _0x1d1714[_0x7627('0x24')]();};}function saveUpdates(_0x3a9904,_0x5dd0b4){return function(_0x1359c1){if(_0x1359c1){return _0x1359c1[_0x7627('0x25')](_0x3a9904)[_0x7627('0x26')](function(_0x924c0){return _0x924c0;});}return null;};}function removeEntity(_0x34b9fa,_0x485181){return function(_0x25bfaa){if(_0x25bfaa){return _0x25bfaa[_0x7627('0x27')]()[_0x7627('0x26')](function(){_0x34b9fa[_0x7627('0x1a')](0xcc)[_0x7627('0x1b')]();});}};}function handleEntityNotFound(_0x59f123,_0x4dea9b){return function(_0x2b0ed2){if(!_0x2b0ed2){_0x59f123['sendStatus'](0x194);}return _0x2b0ed2;};}function handleError(_0x5f40a9,_0x4c09a5){_0x4c09a5=_0x4c09a5||0x1f4;return function(_0x537271){logger[_0x7627('0x28')](_0x537271[_0x7627('0x29')]);if(_0x537271[_0x7627('0x2a')]){delete _0x537271[_0x7627('0x2a')];}_0x5f40a9[_0x7627('0x1a')](_0x4c09a5)[_0x7627('0x2b')](_0x537271);};}exports[_0x7627('0x2c')]=function(_0x26c647,_0x253075){var _0x428127={},_0x10b927={},_0x35b1df={'count':0x0,'rows':[]};var _0x3af845=_['map'](db[_0x7627('0x2d')][_0x7627('0x2e')],function(_0x29891f){return{'name':_0x29891f[_0x7627('0x2f')],'type':_0x29891f[_0x7627('0x30')][_0x7627('0x31')]};});_0x10b927[_0x7627('0x32')]=_[_0x7627('0x33')](_0x3af845,'name');_0x10b927[_0x7627('0x34')]=_['keys'](_0x26c647['query']);_0x10b927[_0x7627('0x35')]=_[_0x7627('0x36')](_0x10b927[_0x7627('0x32')],_0x10b927['query']);_0x428127[_0x7627('0x37')]=_[_0x7627('0x36')](_0x10b927[_0x7627('0x32')],qs[_0x7627('0x38')](_0x26c647[_0x7627('0x34')][_0x7627('0x38')]));_0x428127[_0x7627('0x37')]=_0x428127[_0x7627('0x37')]['length']?_0x428127['attributes']:_0x10b927[_0x7627('0x32')];if(!_0x26c647[_0x7627('0x34')][_0x7627('0x39')](_0x7627('0x3a'))){_0x428127[_0x7627('0x1f')]=qs[_0x7627('0x1f')](_0x26c647['query'][_0x7627('0x1f')]);_0x428127['offset']=qs['offset'](_0x26c647['query'][_0x7627('0x1d')]);}_0x428127[_0x7627('0x3b')]=qs['sort'](_0x26c647[_0x7627('0x34')][_0x7627('0x3c')]);_0x428127[_0x7627('0x3d')]=qs[_0x7627('0x35')](_[_0x7627('0x3e')](_0x26c647[_0x7627('0x34')],_0x10b927[_0x7627('0x35')]),_0x3af845);if(_0x26c647[_0x7627('0x34')][_0x7627('0x3f')]){_0x428127[_0x7627('0x3d')]=_[_0x7627('0x40')](_0x428127['where'],{'$or':_['map'](_0x3af845,function(_0x548e90){if(_0x548e90['type']!=='VIRTUAL'){var _0x3780d6={};_0x3780d6[_0x548e90[_0x7627('0x2a')]]={'$like':'%'+_0x26c647['query'][_0x7627('0x3f')]+'%'};return _0x3780d6;}})});}_0x428127=_[_0x7627('0x40')]({},_0x428127,_0x26c647[_0x7627('0x41')]);var _0x3760b6={'where':_0x428127[_0x7627('0x3d')]};return db['SalesforceAccount'][_0x7627('0x1e')](_0x3760b6)[_0x7627('0x26')](function(_0x4ec73e){_0x35b1df[_0x7627('0x1e')]=_0x4ec73e;if(_0x26c647['query'][_0x7627('0x42')]){_0x428127[_0x7627('0x43')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x428127);})[_0x7627('0x26')](function(_0x272689){_0x35b1df[_0x7627('0x44')]=_0x272689;return _0x35b1df;})[_0x7627('0x26')](respondWithFilteredResult(_0x253075,_0x428127))['catch'](handleError(_0x253075,null));};exports[_0x7627('0x45')]=function(_0xd2084d,_0x29af93){var _0x71b958={'raw':![],'where':{'id':_0xd2084d[_0x7627('0x46')]['id']}},_0x501ef3={};_0x501ef3[_0x7627('0x32')]=_[_0x7627('0x47')](db[_0x7627('0x2d')]['rawAttributes']);_0x501ef3[_0x7627('0x34')]=_[_0x7627('0x47')](_0xd2084d[_0x7627('0x34')]);_0x501ef3[_0x7627('0x35')]=_[_0x7627('0x36')](_0x501ef3[_0x7627('0x32')],_0x501ef3[_0x7627('0x34')]);_0x71b958['attributes']=_[_0x7627('0x36')](_0x501ef3[_0x7627('0x32')],qs[_0x7627('0x38')](_0xd2084d[_0x7627('0x34')]['fields']));_0x71b958['attributes']=_0x71b958[_0x7627('0x37')]['length']?_0x71b958[_0x7627('0x37')]:_0x501ef3[_0x7627('0x32')];if(_0xd2084d[_0x7627('0x34')][_0x7627('0x42')]){_0x71b958[_0x7627('0x43')]=[{'all':!![]}];}_0x71b958=_[_0x7627('0x40')]({},_0x71b958,_0xd2084d[_0x7627('0x41')]);return db[_0x7627('0x2d')][_0x7627('0x48')](_0x71b958)[_0x7627('0x26')](handleEntityNotFound(_0x29af93,null))[_0x7627('0x26')](respondWithResult(_0x29af93,null))['catch'](handleError(_0x29af93,null));};exports['create']=function(_0x3f5d0e,_0x4b94f9){return db[_0x7627('0x2d')][_0x7627('0x49')](_0x3f5d0e[_0x7627('0x4a')],{})[_0x7627('0x26')](respondWithResult(_0x4b94f9,0xc9))[_0x7627('0x4b')](handleError(_0x4b94f9,null));};exports[_0x7627('0x25')]=function(_0x2d9fe0,_0x3abd14){if(_0x2d9fe0['body']['id']){delete _0x2d9fe0[_0x7627('0x4a')]['id'];}return db[_0x7627('0x2d')][_0x7627('0x48')]({'where':{'id':_0x2d9fe0['params']['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x3abd14,null))['then'](saveUpdates(_0x2d9fe0[_0x7627('0x4a')],null))[_0x7627('0x26')](respondWithResult(_0x3abd14,null))[_0x7627('0x4b')](handleError(_0x3abd14,null));};exports[_0x7627('0x27')]=function(_0x51e8fa,_0x3a910b){return db[_0x7627('0x2d')][_0x7627('0x48')]({'where':{'id':_0x51e8fa[_0x7627('0x46')]['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x3a910b,null))[_0x7627('0x26')](removeEntity(_0x3a910b,null))[_0x7627('0x4b')](handleError(_0x3a910b,null));};exports[_0x7627('0x4c')]=function(_0x1db91e,_0x5b884c,_0x59ddb6){var _0x1cba4b={};var _0x3a53a7={};var _0x4562b3;var _0x4bddc2;return db['SalesforceAccount']['findOne']({'where':{'id':_0x1db91e['params']['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x5b884c,null))['then'](function(_0x37c19a){if(_0x37c19a){_0x4562b3=_0x37c19a;_0x3a53a7[_0x7627('0x32')]=_[_0x7627('0x47')](db[_0x7627('0x4d')]['rawAttributes']);_0x3a53a7[_0x7627('0x34')]=_[_0x7627('0x47')](_0x1db91e[_0x7627('0x34')]);_0x3a53a7[_0x7627('0x35')]=_['intersection'](_0x3a53a7[_0x7627('0x32')],_0x3a53a7[_0x7627('0x34')]);_0x1cba4b[_0x7627('0x37')]=_['intersection'](_0x3a53a7['model'],qs[_0x7627('0x38')](_0x1db91e[_0x7627('0x34')][_0x7627('0x38')]));_0x1cba4b[_0x7627('0x37')]=_0x1cba4b['attributes'][_0x7627('0x4e')]?_0x1cba4b[_0x7627('0x37')]:_0x3a53a7[_0x7627('0x32')];_0x1cba4b[_0x7627('0x3b')]=qs[_0x7627('0x3c')](_0x1db91e[_0x7627('0x34')][_0x7627('0x3c')]);_0x1cba4b[_0x7627('0x3d')]=qs[_0x7627('0x35')](_[_0x7627('0x3e')](_0x1db91e[_0x7627('0x34')],_0x3a53a7[_0x7627('0x35')]));if(_0x1db91e[_0x7627('0x34')][_0x7627('0x3f')]){_0x1cba4b[_0x7627('0x3d')]=_[_0x7627('0x40')](_0x1cba4b[_0x7627('0x3d')],{'$or':_[_0x7627('0x33')](_0x1cba4b[_0x7627('0x37')],function(_0x4c15f0){var _0x75c98c={};_0x75c98c[_0x4c15f0]={'$like':'%'+_0x1db91e[_0x7627('0x34')][_0x7627('0x3f')]+'%'};return _0x75c98c;})});}_0x1cba4b=_['merge']({},_0x1cba4b,_0x1db91e[_0x7627('0x41')]);return _0x4562b3[_0x7627('0x4c')](_0x1cba4b);}})[_0x7627('0x26')](function(_0x53cc9e){if(_0x53cc9e){_0x4bddc2=_0x53cc9e[_0x7627('0x4e')];if(!_0x1db91e['query'][_0x7627('0x39')](_0x7627('0x3a'))){_0x1cba4b[_0x7627('0x1f')]=qs[_0x7627('0x1f')](_0x1db91e[_0x7627('0x34')]['limit']);_0x1cba4b[_0x7627('0x1d')]=qs['offset'](_0x1db91e[_0x7627('0x34')][_0x7627('0x1d')]);}return _0x4562b3[_0x7627('0x4c')](_0x1cba4b);}})[_0x7627('0x26')](function(_0x4cc4f6){if(_0x4cc4f6){return _0x4cc4f6?{'count':_0x4bddc2,'rows':_0x4cc4f6}:null;}})[_0x7627('0x26')](respondWithResult(_0x5b884c,null))['catch'](handleError(_0x5b884c,null));};exports['addConfiguration']=function(_0x53b604,_0x276389,_0x35aa7b){if(_0x53b604[_0x7627('0x4a')]['id']){delete _0x53b604[_0x7627('0x4a')]['id'];}return db[_0x7627('0x2d')][_0x7627('0x4f')]({'where':{'id':_0x53b604[_0x7627('0x46')]['id']}})['then'](handleEntityNotFound(_0x276389,null))[_0x7627('0x26')](function(_0x540018){if(_0x540018){_0x53b604[_0x7627('0x4a')]['AccountId']=_0x540018['id'];_0x53b604[_0x7627('0x4a')][_0x7627('0x50')]=integrations[_0x7627('0x51')](_0x53b604[_0x7627('0x4a')]['channel'],_0x53b604['body']['type']);_0x53b604[_0x7627('0x4a')][_0x7627('0x52')]=integrations['getDescriptions'](_0x53b604[_0x7627('0x4a')][_0x7627('0x53')],_0x53b604[_0x7627('0x4a')]['type']);return db[_0x7627('0x4d')][_0x7627('0x49')](_0x53b604[_0x7627('0x4a')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7627('0x54')],'as':_0x7627('0x52')}]});}return null;})['then'](respondWithResult(_0x276389,null))['catch'](handleError(_0x276389,null));};exports[_0x7627('0x55')]=function(_0x554f91,_0x28ba29,_0x24ccff){var _0xedb7a0;var _0x2d4426='';var _0x1f6363=_0x7627('0x56');return db[_0x7627('0x2d')][_0x7627('0x4f')]({'where':{'id':_0x554f91[_0x7627('0x46')]['id']},'attributes':['id',_0x7627('0x57'),_0x7627('0x58'),_0x7627('0x59'),_0x7627('0x5a'),_0x7627('0x5b'),_0x7627('0x5c')]})[_0x7627('0x26')](handleEntityNotFound(_0x28ba29,null))[_0x7627('0x26')](function(_0x419852){if(_0x419852){_0x2d4426=_0x419852['remoteUri'];var _0xe31613=_0x2d4426[_0x7627('0x5d')](-0x1);if(_0xe31613==='/'){_0x2d4426=_0x2d4426[_0x7627('0x5e')](0x0,_0x2d4426[_0x7627('0x5f')](_0xe31613));}_0xedb7a0=new jsforce[(_0x7627('0x60'))]({'oauth2':{'loginUrl':_0x2d4426,'clientId':_0x419852[_0x7627('0x58')],'clientSecret':_0x419852['clientSecret']}});return _0xedb7a0[_0x7627('0x61')](_0x419852['username'],_0x419852['password'][_0x7627('0x62')](_0x419852[_0x7627('0x5c')]));}})[_0x7627('0x26')](function(_0x1a663c){if(_0x1a663c){if(!_[_0x7627('0x63')](_0x554f91[_0x7627('0x34')][_0x7627('0x64')])){_0x1f6363=_0x554f91[_0x7627('0x34')]['ticketType'];}return _0xedb7a0[_0x7627('0x65')](_0x1f6363)[_0x7627('0x66')]();}})[_0x7627('0x26')](function(_0x2bdff4){var _0x3ec6a9=[_0x7627('0x67'),'ActivityDate',_0x7627('0x68'),_0x7627('0x69'),'Subject','Description'];var _0x132c4b=[_0x7627('0x6a'),_0x7627('0x6b'),_0x7627('0x6c'),_0x7627('0x6d'),'email',_0x7627('0x6e'),'phone'];if(_0x2bdff4){_['remove'](_0x2bdff4[_0x7627('0x38')],function(_0x51345a){return _0x3ec6a9[_0x7627('0x6f')](_0x51345a[_0x7627('0x2a')])||!_0x132c4b[_0x7627('0x6f')](_0x51345a['type']);});return{'count':_0x2bdff4[_0x7627('0x38')]['length'],'rows':_[_0x7627('0x33')](_0x2bdff4[_0x7627('0x38')],function(_0x14b7dd){return{'id':_0x14b7dd[_0x7627('0x2a')],'name':_0x14b7dd[_0x7627('0x70')],'custom':_0x14b7dd['custom'],'options':_0x14b7dd['picklistValues']['length']>0x0?_['map'](_0x14b7dd['picklistValues'],function(_0x5b3c61){return{'name':_0x5b3c61['label'],'value':_0x5b3c61['value']};}):_0x14b7dd[_0x7627('0x30')]==_0x7627('0x6d')?[{'name':'True','value':'true'},{'name':_0x7627('0x71'),'value':_0x7627('0x72')}]:[]};})};}})['then'](respondWithResult(_0x28ba29,null))[_0x7627('0x4b')](function(_0x45b8d3){var _0x3fc2c7=_0x554f91['query'][_0x7627('0x73')]?0x1f4:_0x45b8d3[_0x7627('0x74')]||0x1f4;logger[_0x7627('0x28')](_0x7627('0x75'),'getFields',_0x3fc2c7,JSON[_0x7627('0x76')](_0x45b8d3));delete _0x45b8d3['name'];if(_0x3fc2c7===0x191){_0x3fc2c7=0x190;}_0x28ba29['status'](_0x3fc2c7)[_0x7627('0x2b')](_0x554f91[_0x7627('0x34')][_0x7627('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x45b8d3[_0x7627('0x74')]}:_0x45b8d3);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9e451cc..ebed16b 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 _0x2750=['../../components/integrations/configuration','define','SalesforceAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x2b01ad,_0x100a22){var _0x3d363e=function(_0x2ccaab){while(--_0x2ccaab){_0x2b01ad['push'](_0x2b01ad['shift']());}};_0x3d363e(++_0x100a22);}(_0x2750,0x13b));var _0x0275=function(_0x46f861,_0x30716c){_0x46f861=_0x46f861-0x0;var _0x36f543=_0x2750[_0x46f861];return _0x36f543;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));var integrations=require(_0x0275('0xa'));module['exports']=function(_0x3f645f,_0x2421fd){return _0x3f645f[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6055=['../../config/logger','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','lodash','util'];(function(_0x1837d9,_0x5e0ec8){var _0x3e9233=function(_0x4d0d3d){while(--_0x4d0d3d){_0x1837d9['push'](_0x1837d9['shift']());}};_0x3e9233(++_0x5e0ec8);}(_0x6055,0x15e));var _0x5605=function(_0x4824ed,_0x2e4a1b){_0x4824ed=_0x4824ed-0x0;var _0x5114fe=_0x6055[_0x4824ed];return _0x5114fe;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5605('0x8'));module['exports']=function(_0x5c64fe,_0x40a85e){return _0x5c64fe[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 53b3052..5159861 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 _0x9e0e=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b9fed,_0x2f75b4){var _0x40fa2c=function(_0x4abec8){while(--_0x4abec8){_0x1b9fed['push'](_0x1b9fed['shift']());}};_0x40fa2c(++_0x2f75b4);}(_0x9e0e,0x12a));var _0xe9e0=function(_0x4bcc9e,_0x1cfb82){_0x4bcc9e=_0x4bcc9e-0x0;var _0x4f842e=_0x9e0e[_0x4bcc9e];return _0x4f842e;};'use strict';var _=require(_0xe9e0('0x0'));var util=require(_0xe9e0('0x1'));var moment=require(_0xe9e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e0('0x3'));var fs=require('fs');var Redis=require(_0xe9e0('0x4'));var db=require(_0xe9e0('0x5'))['db'];var utils=require(_0xe9e0('0x6'));var logger=require(_0xe9e0('0x7'))(_0xe9e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xe9e0('0x9'));var client=jayson[_0xe9e0('0xa')][_0xe9e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f5300,_0x3e39a4,_0x29c6a3){return new BPromise(function(_0x398164,_0xd004f1){return client[_0xe9e0('0xc')](_0x3f5300,_0x29c6a3)[_0xe9e0('0xd')](function(_0x111f1e){logger[_0xe9e0('0xe')](_0xe9e0('0xf'),_0x3e39a4,_0xe9e0('0x10'));logger[_0xe9e0('0x11')](_0xe9e0('0x12'),_0x3e39a4,_0xe9e0('0x10'),JSON[_0xe9e0('0x13')](_0x111f1e));if(_0x111f1e[_0xe9e0('0x14')]){if(_0x111f1e[_0xe9e0('0x14')][_0xe9e0('0x15')]===0x1f4){logger[_0xe9e0('0x14')](_0xe9e0('0xf'),_0x3e39a4,_0x111f1e[_0xe9e0('0x14')][_0xe9e0('0x16')]);return _0xd004f1(_0x111f1e['error'][_0xe9e0('0x16')]);}logger[_0xe9e0('0x14')](_0xe9e0('0xf'),_0x3e39a4,_0x111f1e[_0xe9e0('0x14')][_0xe9e0('0x16')]);return _0x398164(_0x111f1e[_0xe9e0('0x14')][_0xe9e0('0x16')]);}else{logger[_0xe9e0('0xe')](_0xe9e0('0xf'),_0x3e39a4,'request\x20sent');_0x398164(_0x111f1e[_0xe9e0('0x17')][_0xe9e0('0x16')]);}})[_0xe9e0('0x18')](function(_0x50f94c){logger[_0xe9e0('0x14')](_0xe9e0('0xf'),_0x3e39a4,_0x50f94c);_0xd004f1(_0x50f94c);});});}exports['GetSalesforceAccount']=function(_0x47d595){var _0x13b828=this;return new Promise(function(_0x487cdf,_0xb030d9){return db[_0xe9e0('0x19')][_0xe9e0('0x1a')]({'raw':_0x47d595[_0xe9e0('0x1b')]?_0x47d595[_0xe9e0('0x1b')][_0xe9e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x47d595['options']?_0x47d595['options'][_0xe9e0('0x1d')]||null:null,'attributes':_0x47d595[_0xe9e0('0x1b')]?_0x47d595['options'][_0xe9e0('0x1e')]||null:null,'limit':_0x47d595[_0xe9e0('0x1b')]?_0x47d595[_0xe9e0('0x1b')][_0xe9e0('0x1f')]||null:null,'include':_0x47d595[_0xe9e0('0x1b')]?_0x47d595[_0xe9e0('0x1b')][_0xe9e0('0x20')]?_[_0xe9e0('0x21')](_0x47d595[_0xe9e0('0x1b')]['include'],function(_0x20b4cd){return{'model':db[_0x20b4cd[_0xe9e0('0x22')]],'as':_0x20b4cd['as'],'attributes':_0x20b4cd[_0xe9e0('0x1e')],'include':_0x20b4cd['include']?_['map'](_0x20b4cd[_0xe9e0('0x20')],function(_0x5a33da){return{'model':db[_0x5a33da[_0xe9e0('0x22')]],'as':_0x5a33da['as'],'attributes':_0x5a33da['attributes'],'include':_0x5a33da[_0xe9e0('0x20')]?_[_0xe9e0('0x21')](_0x5a33da['include'],function(_0x513818){return{'model':db[_0x513818[_0xe9e0('0x22')]],'as':_0x513818['as'],'attributes':_0x513818[_0xe9e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe9e0('0xd')](function(_0x402138){logger['info']('GetSalesforceAccount',_0x47d595);logger[_0xe9e0('0x11')](_0xe9e0('0x23'),_0x47d595,JSON[_0xe9e0('0x13')](_0x402138));_0x487cdf(_0x402138);})['catch'](function(_0x54ce27){logger[_0xe9e0('0x14')](_0xe9e0('0x23'),_0x54ce27[_0xe9e0('0x16')],_0x47d595);_0xb030d9(_0x13b828[_0xe9e0('0x14')](0x1f4,_0x54ce27['message']));});});};exports['ShowSalesforceAccount']=function(_0x59df27){var _0x5e09f2=this;return new Promise(function(_0x4f19f5,_0x361b5d){return db['SalesforceAccount'][_0xe9e0('0x24')]({'raw':_0x59df27[_0xe9e0('0x1b')]?_0x59df27[_0xe9e0('0x1b')][_0xe9e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x59df27[_0xe9e0('0x1b')]?_0x59df27['options'][_0xe9e0('0x1d')]||null:null,'attributes':_0x59df27[_0xe9e0('0x1b')]?_0x59df27[_0xe9e0('0x1b')][_0xe9e0('0x1e')]||null:null,'include':_0x59df27['options']?_0x59df27[_0xe9e0('0x1b')]['include']?_[_0xe9e0('0x21')](_0x59df27[_0xe9e0('0x1b')]['include'],function(_0x3f971a){return{'model':db[_0x3f971a[_0xe9e0('0x22')]],'as':_0x3f971a['as'],'attributes':_0x3f971a['attributes'],'include':_0x3f971a['include']?_[_0xe9e0('0x21')](_0x3f971a[_0xe9e0('0x20')],function(_0x1a2d79){return{'model':db[_0x1a2d79[_0xe9e0('0x22')]],'as':_0x1a2d79['as'],'attributes':_0x1a2d79[_0xe9e0('0x1e')],'include':_0x1a2d79[_0xe9e0('0x20')]?_[_0xe9e0('0x21')](_0x1a2d79[_0xe9e0('0x20')],function(_0x95f70a){return{'model':db[_0x95f70a[_0xe9e0('0x22')]],'as':_0x95f70a['as'],'attributes':_0x95f70a[_0xe9e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe9e0('0xd')](function(_0x5188a1){logger[_0xe9e0('0xe')](_0xe9e0('0x25'),_0x59df27);logger[_0xe9e0('0x11')](_0xe9e0('0x25'),_0x59df27,JSON[_0xe9e0('0x13')](_0x5188a1));_0x4f19f5(_0x5188a1);})['catch'](function(_0x3afd86){logger[_0xe9e0('0x14')](_0xe9e0('0x25'),_0x3afd86[_0xe9e0('0x16')],_0x59df27);_0x361b5d(_0x5e09f2[_0xe9e0('0x14')](0x1f4,_0x3afd86[_0xe9e0('0x16')]));});});}; \ No newline at end of file +var _0xdeac=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','where','ShowSalesforceAccount','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdeac,0xfa));var _0xcdea=function(_0x217b49,_0x32a478){_0x217b49=_0x217b49-0x0;var _0x10f295=_0xdeac[_0x217b49];return _0x10f295;};'use strict';var _=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var moment=require(_0xcdea('0x2'));var BPromise=require(_0xcdea('0x3'));var rs=require(_0xcdea('0x4'));var fs=require('fs');var Redis=require(_0xcdea('0x5'));var db=require(_0xcdea('0x6'))['db'];var utils=require(_0xcdea('0x7'));var logger=require(_0xcdea('0x8'))(_0xcdea('0x9'));var config=require('../../config/environment');var jayson=require(_0xcdea('0xa'));var client=jayson[_0xcdea('0xb')][_0xcdea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50868e,_0x349b44,_0x4ab63e){return new BPromise(function(_0x2784a7,_0xcf86b9){return client['request'](_0x50868e,_0x4ab63e)[_0xcdea('0xd')](function(_0x2cfee7){logger[_0xcdea('0xe')](_0xcdea('0xf'),_0x349b44,'request\x20sent');logger[_0xcdea('0x10')](_0xcdea('0x11'),_0x349b44,'request\x20sent',JSON[_0xcdea('0x12')](_0x2cfee7));if(_0x2cfee7[_0xcdea('0x13')]){if(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x14')]===0x1f4){logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x2cfee7[_0xcdea('0x13')]['message']);return _0xcf86b9(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);}logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);return _0x2784a7(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);}else{logger['info'](_0xcdea('0xf'),_0x349b44,_0xcdea('0x16'));_0x2784a7(_0x2cfee7['result']['message']);}})[_0xcdea('0x17')](function(_0x4f43fe){logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x4f43fe);_0xcf86b9(_0x4f43fe);});});}exports[_0xcdea('0x18')]=function(_0x4f13f1){var _0x10e244=this;return new Promise(function(_0x4918eb,_0x16aa91){return db[_0xcdea('0x19')][_0xcdea('0x1a')]({'raw':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')]['where']||null:null,'attributes':_0x4f13f1['options']?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1d')]||null:null,'limit':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1e')]||null:null,'include':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1['options'][_0xcdea('0x1f')]?_['map'](_0x4f13f1['options'][_0xcdea('0x1f')],function(_0x1c372c){return{'model':db[_0x1c372c[_0xcdea('0x20')]],'as':_0x1c372c['as'],'attributes':_0x1c372c['attributes'],'include':_0x1c372c['include']?_['map'](_0x1c372c[_0xcdea('0x1f')],function(_0x39aa01){return{'model':db[_0x39aa01['model']],'as':_0x39aa01['as'],'attributes':_0x39aa01[_0xcdea('0x1d')],'include':_0x39aa01[_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x39aa01['include'],function(_0x15737b){return{'model':db[_0x15737b[_0xcdea('0x20')]],'as':_0x15737b['as'],'attributes':_0x15737b[_0xcdea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdea('0xd')](function(_0x44491c){logger[_0xcdea('0xe')](_0xcdea('0x18'),_0x4f13f1);logger[_0xcdea('0x10')](_0xcdea('0x18'),_0x4f13f1,JSON[_0xcdea('0x12')](_0x44491c));_0x4918eb(_0x44491c);})[_0xcdea('0x17')](function(_0x1535f7){logger[_0xcdea('0x13')](_0xcdea('0x18'),_0x1535f7['message'],_0x4f13f1);_0x16aa91(_0x10e244[_0xcdea('0x13')](0x1f4,_0x1535f7[_0xcdea('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x1b036d){var _0x19dd16=this;return new Promise(function(_0x113c7c,_0x4b2538){return db[_0xcdea('0x19')]['find']({'raw':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b036d['options']?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x22')]||null:null,'attributes':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')]['attributes']||null:null,'include':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1f')],function(_0x5dbe76){return{'model':db[_0x5dbe76[_0xcdea('0x20')]],'as':_0x5dbe76['as'],'attributes':_0x5dbe76[_0xcdea('0x1d')],'include':_0x5dbe76[_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x5dbe76['include'],function(_0x1ec84b){return{'model':db[_0x1ec84b[_0xcdea('0x20')]],'as':_0x1ec84b['as'],'attributes':_0x1ec84b[_0xcdea('0x1d')],'include':_0x1ec84b['include']?_[_0xcdea('0x21')](_0x1ec84b[_0xcdea('0x1f')],function(_0x45186f){return{'model':db[_0x45186f[_0xcdea('0x20')]],'as':_0x45186f['as'],'attributes':_0x45186f[_0xcdea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdea('0xd')](function(_0x4c90c9){logger[_0xcdea('0xe')]('ShowSalesforceAccount',_0x1b036d);logger[_0xcdea('0x10')](_0xcdea('0x23'),_0x1b036d,JSON[_0xcdea('0x12')](_0x4c90c9));_0x113c7c(_0x4c90c9);})['catch'](function(_0x38facd){logger['error'](_0xcdea('0x23'),_0x38facd[_0xcdea('0x15')],_0x1b036d);_0x4b2538(_0x19dd16[_0xcdea('0x13')](0x1f4,_0x38facd['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index def0f19..59898bc 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x37ea26,_0x351766){var _0x3899ed=function(_0x16d1ca){while(--_0x16d1ca){_0x37ea26['push'](_0x37ea26['shift']());}};_0x3899ed(++_0x351766);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4dc4ce,_0x33a9e){_0x4dc4ce=_0x4dc4ce-0x0;var _0x268bb6=_0x5f2f[_0x4dc4ce];return _0x268bb6;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x763f6b,_0xfc6fc3){var _0x4dc52d=function(_0x1f59f5){while(--_0x1f59f5){_0x763f6b['push'](_0x763f6b['shift']());}};_0x4dc52d(++_0xfc6fc3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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('./intSalesforceConfiguration.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['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7322058..58fd201 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 _0x1655=['STRING','ENUM','Task','Case','account','contact_lead','nothing','contact','lead','exports'];(function(_0x4ae327,_0x1ac7b6){var _0xc7d446=function(_0x457e7f){while(--_0x457e7f){_0x4ae327['push'](_0x4ae327['shift']());}};_0xc7d446(++_0x1ac7b6);}(_0x1655,0x95));var _0x5165=function(_0x1159b9,_0x5228c2){_0x1159b9=_0x1159b9-0x0;var _0x4ed4e3=_0x1655[_0x1159b9];return _0x4ed4e3;};'use strict';var Sequelize=require('sequelize');module[_0x5165('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5165('0x1')]},'ticketType':{'type':Sequelize[_0x5165('0x2')](_0x5165('0x3'),_0x5165('0x4')),'defaultValue':_0x5165('0x3')},'moduleSearch':{'type':Sequelize[_0x5165('0x2')]('contact_lead','contact','lead','account_contact_lead',_0x5165('0x5')),'defaultValue':_0x5165('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x5165('0x7'),_0x5165('0x8'),_0x5165('0x9'),_0x5165('0x5')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5165('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cae=['lead','account','contact_lead','sequelize','exports','STRING','ENUM','Task','Case','contact'];(function(_0x3c1163,_0x2adee7){var _0x257b42=function(_0x237088){while(--_0x237088){_0x3c1163['push'](_0x3c1163['shift']());}};_0x257b42(++_0x2adee7);}(_0x3cae,0x19d));var _0xe3ca=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x3cae[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'name':{'type':Sequelize[_0xe3ca('0x2')]},'description':{'type':Sequelize[_0xe3ca('0x2')]},'ticketType':{'type':Sequelize[_0xe3ca('0x3')](_0xe3ca('0x4'),_0xe3ca('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe3ca('0x3')]('contact_lead',_0xe3ca('0x6'),_0xe3ca('0x7'),'account_contact_lead',_0xe3ca('0x8')),'defaultValue':_0xe3ca('0x9')},'moduleCreate':{'type':Sequelize[_0xe3ca('0x3')]('nothing','contact',_0xe3ca('0x7'),_0xe3ca('0x8')),'defaultValue':_0xe3ca('0x7')},'leadId':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 46828aa..b2edfcf 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 _0x80ff=['save','then','end','sendStatus','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','update','body','find','destroy','findOne','SalesforceField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x4c71e5,_0x42ddd0){var _0x410826=function(_0x3c0e36){while(--_0x3c0e36){_0x4c71e5['push'](_0x4c71e5['shift']());}};_0x410826(++_0x42ddd0);}(_0x80ff,0x122));var _0xf80f=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x80ff[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0xf80f('0x0'));var rimraf=require(_0xf80f('0x1'));var zipdir=require(_0xf80f('0x2'));var jsonpatch=require(_0xf80f('0x3'));var rp=require('request-promise');var moment=require(_0xf80f('0x4'));var BPromise=require(_0xf80f('0x5'));var Mustache=require(_0xf80f('0x6'));var util=require(_0xf80f('0x7'));var path=require(_0xf80f('0x8'));var sox=require(_0xf80f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf80f('0xa'));var _=require(_0xf80f('0xb'));var squel=require(_0xf80f('0xc'));var crypto=require(_0xf80f('0xd'));var jsforce=require(_0xf80f('0xe'));var deskjs=require(_0xf80f('0xf'));var toCsv=require(_0xf80f('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf80f('0x11'));var authService=require(_0xf80f('0x12'));var qs=require(_0xf80f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf80f('0x14'));var utils=require('../../config/utils');var config=require(_0xf80f('0x15'));var licenseUtil=require(_0xf80f('0x16'));var db=require(_0xf80f('0x17'))['db'];function respondWithStatusCode(_0x41d557,_0x382c2f){_0x382c2f=_0x382c2f||0xcc;return function(_0x189426){if(_0x189426){return _0x41d557['sendStatus'](_0x382c2f);}return _0x41d557[_0xf80f('0x18')](_0x382c2f)['end']();};}function respondWithResult(_0x588587,_0x284109){_0x284109=_0x284109||0xc8;return function(_0x37dc69){if(_0x37dc69){return _0x588587[_0xf80f('0x18')](_0x284109)[_0xf80f('0x19')](_0x37dc69);}};}function respondWithFilteredResult(_0x468713,_0x283ad5){return function(_0x52268a){if(_0x52268a){var _0x5aec77=typeof _0x283ad5[_0xf80f('0x1a')]==='undefined'&&typeof _0x283ad5[_0xf80f('0x1b')]===_0xf80f('0x1c');var _0x389cfa=_0x52268a[_0xf80f('0x1d')];var _0x50f722=_0x5aec77?0x0:_0x283ad5['offset'];var _0x48fdc7=_0x5aec77?_0x52268a['count']:_0x283ad5[_0xf80f('0x1a')]+_0x283ad5['limit'];var _0x7ad7bf;if(_0x48fdc7>=_0x389cfa){_0x48fdc7=_0x389cfa;_0x7ad7bf=0xc8;}else{_0x7ad7bf=0xce;}_0x468713[_0xf80f('0x18')](_0x7ad7bf);return _0x468713[_0xf80f('0x1e')](_0xf80f('0x1f'),_0x50f722+'-'+_0x48fdc7+'/'+_0x389cfa)[_0xf80f('0x19')](_0x52268a);}return null;};}function patchUpdates(_0x159d44){return function(_0x4514b4){try{jsonpatch[_0xf80f('0x20')](_0x4514b4,_0x159d44,!![]);}catch(_0x4ab432){return BPromise[_0xf80f('0x21')](_0x4ab432);}return _0x4514b4[_0xf80f('0x22')]();};}function saveUpdates(_0x4a99b2,_0x2c7ee5){return function(_0x16952c){if(_0x16952c){return _0x16952c['update'](_0x4a99b2)[_0xf80f('0x23')](function(_0x153804){return _0x153804;});}return null;};}function removeEntity(_0x467cbe,_0x37d2bd){return function(_0x305b1a){if(_0x305b1a){return _0x305b1a['destroy']()[_0xf80f('0x23')](function(){_0x467cbe[_0xf80f('0x18')](0xcc)[_0xf80f('0x24')]();});}};}function handleEntityNotFound(_0x2cc4a2,_0x23ee6e){return function(_0x4c254d){if(!_0x4c254d){_0x2cc4a2[_0xf80f('0x25')](0x194);}return _0x4c254d;};}function handleError(_0x1badfd,_0x239d4d){_0x239d4d=_0x239d4d||0x1f4;return function(_0x30ae2e){logger[_0xf80f('0x26')](_0x30ae2e[_0xf80f('0x27')]);if(_0x30ae2e[_0xf80f('0x28')]){delete _0x30ae2e[_0xf80f('0x28')];}_0x1badfd['status'](_0x239d4d)['send'](_0x30ae2e);};}exports[_0xf80f('0x29')]=function(_0xefef55,_0x1f1f4b){var _0x4dd8b6={},_0x2464c3={},_0xfe2ae6={'count':0x0,'rows':[]};var _0xd846ab=_[_0xf80f('0x2a')](db[_0xf80f('0x2b')][_0xf80f('0x2c')],function(_0x2690e5){return{'name':_0x2690e5[_0xf80f('0x2d')],'type':_0x2690e5['type'][_0xf80f('0x2e')]};});_0x2464c3[_0xf80f('0x2f')]=_['map'](_0xd846ab,'name');_0x2464c3['query']=_[_0xf80f('0x30')](_0xefef55['query']);_0x2464c3['filters']=_[_0xf80f('0x31')](_0x2464c3['model'],_0x2464c3[_0xf80f('0x32')]);_0x4dd8b6[_0xf80f('0x33')]=_[_0xf80f('0x31')](_0x2464c3[_0xf80f('0x2f')],qs[_0xf80f('0x34')](_0xefef55[_0xf80f('0x32')][_0xf80f('0x34')]));_0x4dd8b6[_0xf80f('0x33')]=_0x4dd8b6['attributes'][_0xf80f('0x35')]?_0x4dd8b6[_0xf80f('0x33')]:_0x2464c3['model'];if(!_0xefef55[_0xf80f('0x32')][_0xf80f('0x36')](_0xf80f('0x37'))){_0x4dd8b6[_0xf80f('0x1b')]=qs[_0xf80f('0x1b')](_0xefef55[_0xf80f('0x32')][_0xf80f('0x1b')]);_0x4dd8b6[_0xf80f('0x1a')]=qs[_0xf80f('0x1a')](_0xefef55[_0xf80f('0x32')][_0xf80f('0x1a')]);}_0x4dd8b6[_0xf80f('0x38')]=qs[_0xf80f('0x39')](_0xefef55[_0xf80f('0x32')][_0xf80f('0x39')]);_0x4dd8b6[_0xf80f('0x3a')]=qs[_0xf80f('0x3b')](_[_0xf80f('0x3c')](_0xefef55[_0xf80f('0x32')],_0x2464c3['filters']),_0xd846ab);if(_0xefef55['query'][_0xf80f('0x3d')]){_0x4dd8b6[_0xf80f('0x3a')]=_[_0xf80f('0x3e')](_0x4dd8b6[_0xf80f('0x3a')],{'$or':_[_0xf80f('0x2a')](_0xd846ab,function(_0x2e8447){if(_0x2e8447['type']!==_0xf80f('0x3f')){var _0x3058f3={};_0x3058f3[_0x2e8447[_0xf80f('0x28')]]={'$like':'%'+_0xefef55['query'][_0xf80f('0x3d')]+'%'};return _0x3058f3;}})});}_0x4dd8b6=_[_0xf80f('0x3e')]({},_0x4dd8b6,_0xefef55[_0xf80f('0x40')]);var _0x35de08={'where':_0x4dd8b6[_0xf80f('0x3a')]};return db[_0xf80f('0x2b')][_0xf80f('0x1d')](_0x35de08)[_0xf80f('0x23')](function(_0x52e167){_0xfe2ae6[_0xf80f('0x1d')]=_0x52e167;if(_0xefef55[_0xf80f('0x32')][_0xf80f('0x41')]){_0x4dd8b6[_0xf80f('0x42')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xf80f('0x43')](_0x4dd8b6);})[_0xf80f('0x23')](function(_0x1df3c8){_0xfe2ae6[_0xf80f('0x44')]=_0x1df3c8;return _0xfe2ae6;})['then'](respondWithFilteredResult(_0x1f1f4b,_0x4dd8b6))[_0xf80f('0x45')](handleError(_0x1f1f4b,null));};exports['show']=function(_0x3fb66f,_0x32211c){var _0x59c0d7={'raw':![],'where':{'id':_0x3fb66f[_0xf80f('0x46')]['id']}},_0x29fca9={};_0x29fca9[_0xf80f('0x2f')]=_[_0xf80f('0x30')](db[_0xf80f('0x2b')]['rawAttributes']);_0x29fca9[_0xf80f('0x32')]=_['keys'](_0x3fb66f['query']);_0x29fca9[_0xf80f('0x3b')]=_[_0xf80f('0x31')](_0x29fca9['model'],_0x29fca9[_0xf80f('0x32')]);_0x59c0d7[_0xf80f('0x33')]=_[_0xf80f('0x31')](_0x29fca9[_0xf80f('0x2f')],qs[_0xf80f('0x34')](_0x3fb66f[_0xf80f('0x32')][_0xf80f('0x34')]));_0x59c0d7[_0xf80f('0x33')]=_0x59c0d7['attributes'][_0xf80f('0x35')]?_0x59c0d7['attributes']:_0x29fca9['model'];if(_0x3fb66f[_0xf80f('0x32')][_0xf80f('0x41')]){_0x59c0d7['include']=[{'all':!![]}];}_0x59c0d7=_[_0xf80f('0x3e')]({},_0x59c0d7,_0x3fb66f[_0xf80f('0x40')]);return db[_0xf80f('0x2b')]['find'](_0x59c0d7)[_0xf80f('0x23')](handleEntityNotFound(_0x32211c,null))[_0xf80f('0x23')](respondWithResult(_0x32211c,null))[_0xf80f('0x45')](handleError(_0x32211c,null));};exports['create']=function(_0x3d43c9,_0x504191){return db[_0xf80f('0x2b')][_0xf80f('0x47')](_0x3d43c9['body'],{})['then'](respondWithResult(_0x504191,0xc9))['catch'](handleError(_0x504191,null));};exports[_0xf80f('0x48')]=function(_0x1bf8f7,_0x1bf05c){if(_0x1bf8f7['body']['id']){delete _0x1bf8f7[_0xf80f('0x49')]['id'];}return db[_0xf80f('0x2b')][_0xf80f('0x4a')]({'where':{'id':_0x1bf8f7[_0xf80f('0x46')]['id']}})[_0xf80f('0x23')](handleEntityNotFound(_0x1bf05c,null))[_0xf80f('0x23')](saveUpdates(_0x1bf8f7['body'],null))['then'](respondWithResult(_0x1bf05c,null))[_0xf80f('0x45')](handleError(_0x1bf05c,null));};exports[_0xf80f('0x4b')]=function(_0x266499,_0x3c2abd){return db[_0xf80f('0x2b')][_0xf80f('0x4a')]({'where':{'id':_0x266499[_0xf80f('0x46')]['id']}})[_0xf80f('0x23')](handleEntityNotFound(_0x3c2abd,null))['then'](removeEntity(_0x3c2abd,null))[_0xf80f('0x45')](handleError(_0x3c2abd,null));};exports['getFields']=function(_0x508e5f,_0x888478,_0x195c21){var _0x320942={};var _0x3abbdf={};var _0x7a9c85;var _0x31a1;return db[_0xf80f('0x2b')][_0xf80f('0x4c')]({'where':{'id':_0x508e5f[_0xf80f('0x46')]['id']}})['then'](handleEntityNotFound(_0x888478,null))[_0xf80f('0x23')](function(_0x48bf16){if(_0x48bf16){_0x7a9c85=_0x48bf16;_0x3abbdf['model']=_['keys'](db[_0xf80f('0x4d')][_0xf80f('0x2c')]);_0x3abbdf[_0xf80f('0x32')]=_[_0xf80f('0x30')](_0x508e5f[_0xf80f('0x32')]);_0x3abbdf[_0xf80f('0x3b')]=_[_0xf80f('0x31')](_0x3abbdf[_0xf80f('0x2f')],_0x3abbdf[_0xf80f('0x32')]);_0x320942['attributes']=_[_0xf80f('0x31')](_0x3abbdf['model'],qs['fields'](_0x508e5f['query'][_0xf80f('0x34')]));_0x320942[_0xf80f('0x33')]=_0x320942['attributes'][_0xf80f('0x35')]?_0x320942['attributes']:_0x3abbdf[_0xf80f('0x2f')];_0x320942[_0xf80f('0x38')]=qs[_0xf80f('0x39')](_0x508e5f['query']['sort']);_0x320942[_0xf80f('0x3a')]=qs[_0xf80f('0x3b')](_[_0xf80f('0x3c')](_0x508e5f[_0xf80f('0x32')],_0x3abbdf[_0xf80f('0x3b')]));if(_0x508e5f[_0xf80f('0x32')][_0xf80f('0x3d')]){_0x320942[_0xf80f('0x3a')]=_[_0xf80f('0x3e')](_0x320942[_0xf80f('0x3a')],{'$or':_[_0xf80f('0x2a')](_0x320942[_0xf80f('0x33')],function(_0x4cbea3){var _0x336e31={};_0x336e31[_0x4cbea3]={'$like':'%'+_0x508e5f[_0xf80f('0x32')][_0xf80f('0x3d')]+'%'};return _0x336e31;})});}_0x320942=_['merge']({},_0x320942,_0x508e5f[_0xf80f('0x40')]);return _0x7a9c85[_0xf80f('0x4e')](_0x320942);}})[_0xf80f('0x23')](function(_0x1f2830){if(_0x1f2830){_0x31a1=_0x1f2830[_0xf80f('0x35')];if(!_0x508e5f[_0xf80f('0x32')]['hasOwnProperty'](_0xf80f('0x37'))){_0x320942[_0xf80f('0x1b')]=qs[_0xf80f('0x1b')](_0x508e5f['query'][_0xf80f('0x1b')]);_0x320942[_0xf80f('0x1a')]=qs[_0xf80f('0x1a')](_0x508e5f[_0xf80f('0x32')]['offset']);}return _0x7a9c85[_0xf80f('0x4e')](_0x320942);}})[_0xf80f('0x23')](function(_0x100109){if(_0x100109){return _0x100109?{'count':_0x31a1,'rows':_0x100109}:null;}})[_0xf80f('0x23')](respondWithResult(_0x888478,null))['catch'](handleError(_0x888478,null));};exports[_0xf80f('0x4f')]=function(_0x1c25a8,_0xba691a,_0x11cbad){var _0x285f76={};var _0x428e48={};var _0x5dc7b0;var _0x472b4b;return db['SalesforceConfiguration'][_0xf80f('0x4c')]({'where':{'id':_0x1c25a8[_0xf80f('0x46')]['id']}})[_0xf80f('0x23')](handleEntityNotFound(_0xba691a,null))[_0xf80f('0x23')](function(_0x2937f5){if(_0x2937f5){_0x5dc7b0=_0x2937f5;_0x428e48['model']=_[_0xf80f('0x30')](db['SalesforceField'][_0xf80f('0x2c')]);_0x428e48[_0xf80f('0x32')]=_['keys'](_0x1c25a8['query']);_0x428e48[_0xf80f('0x3b')]=_[_0xf80f('0x31')](_0x428e48['model'],_0x428e48[_0xf80f('0x32')]);_0x285f76[_0xf80f('0x33')]=_[_0xf80f('0x31')](_0x428e48[_0xf80f('0x2f')],qs[_0xf80f('0x34')](_0x1c25a8['query'][_0xf80f('0x34')]));_0x285f76['attributes']=_0x285f76[_0xf80f('0x33')]['length']?_0x285f76[_0xf80f('0x33')]:_0x428e48[_0xf80f('0x2f')];_0x285f76[_0xf80f('0x38')]=qs[_0xf80f('0x39')](_0x1c25a8['query']['sort']);_0x285f76[_0xf80f('0x3a')]=qs['filters'](_[_0xf80f('0x3c')](_0x1c25a8[_0xf80f('0x32')],_0x428e48[_0xf80f('0x3b')]));if(_0x1c25a8['query'][_0xf80f('0x3d')]){_0x285f76[_0xf80f('0x3a')]=_[_0xf80f('0x3e')](_0x285f76[_0xf80f('0x3a')],{'$or':_[_0xf80f('0x2a')](_0x285f76['attributes'],function(_0x17326d){var _0x3ae734={};_0x3ae734[_0x17326d]={'$like':'%'+_0x1c25a8['query']['filter']+'%'};return _0x3ae734;})});}_0x285f76=_[_0xf80f('0x3e')]({},_0x285f76,_0x1c25a8[_0xf80f('0x40')]);return _0x5dc7b0[_0xf80f('0x4f')](_0x285f76);}})['then'](function(_0x25943a){if(_0x25943a){_0x472b4b=_0x25943a[_0xf80f('0x35')];if(!_0x1c25a8[_0xf80f('0x32')][_0xf80f('0x36')](_0xf80f('0x37'))){_0x285f76[_0xf80f('0x1b')]=qs[_0xf80f('0x1b')](_0x1c25a8[_0xf80f('0x32')][_0xf80f('0x1b')]);_0x285f76[_0xf80f('0x1a')]=qs[_0xf80f('0x1a')](_0x1c25a8[_0xf80f('0x32')][_0xf80f('0x1a')]);}return _0x5dc7b0[_0xf80f('0x4f')](_0x285f76);}})[_0xf80f('0x23')](function(_0x50c92e){if(_0x50c92e){return _0x50c92e?{'count':_0x472b4b,'rows':_0x50c92e}:null;}})['then'](respondWithResult(_0xba691a,null))['catch'](handleError(_0xba691a,null));};exports[_0xf80f('0x50')]=function(_0x383b82,_0x2a62fd,_0x363868){var _0x19dd2c={};var _0x5c6c1b={};var _0x33daf3;var _0x250050;return db[_0xf80f('0x2b')][_0xf80f('0x4c')]({'where':{'id':_0x383b82['params']['id']}})[_0xf80f('0x23')](handleEntityNotFound(_0x2a62fd,null))['then'](function(_0x4d32c3){if(_0x4d32c3){_0x33daf3=_0x4d32c3;_0x5c6c1b[_0xf80f('0x2f')]=_[_0xf80f('0x30')](db[_0xf80f('0x4d')][_0xf80f('0x2c')]);_0x5c6c1b['query']=_[_0xf80f('0x30')](_0x383b82[_0xf80f('0x32')]);_0x5c6c1b['filters']=_[_0xf80f('0x31')](_0x5c6c1b[_0xf80f('0x2f')],_0x5c6c1b[_0xf80f('0x32')]);_0x19dd2c['attributes']=_[_0xf80f('0x31')](_0x5c6c1b['model'],qs[_0xf80f('0x34')](_0x383b82[_0xf80f('0x32')][_0xf80f('0x34')]));_0x19dd2c[_0xf80f('0x33')]=_0x19dd2c['attributes'][_0xf80f('0x35')]?_0x19dd2c[_0xf80f('0x33')]:_0x5c6c1b[_0xf80f('0x2f')];_0x19dd2c[_0xf80f('0x38')]=qs[_0xf80f('0x39')](_0x383b82[_0xf80f('0x32')][_0xf80f('0x39')]);_0x19dd2c[_0xf80f('0x3a')]=qs[_0xf80f('0x3b')](_['pick'](_0x383b82[_0xf80f('0x32')],_0x5c6c1b[_0xf80f('0x3b')]));if(_0x383b82['query'][_0xf80f('0x3d')]){_0x19dd2c[_0xf80f('0x3a')]=_[_0xf80f('0x3e')](_0x19dd2c[_0xf80f('0x3a')],{'$or':_[_0xf80f('0x2a')](_0x19dd2c['attributes'],function(_0x1bc947){var _0x8e5b86={};_0x8e5b86[_0x1bc947]={'$like':'%'+_0x383b82[_0xf80f('0x32')][_0xf80f('0x3d')]+'%'};return _0x8e5b86;})});}_0x19dd2c=_[_0xf80f('0x3e')]({},_0x19dd2c,_0x383b82[_0xf80f('0x40')]);return _0x33daf3['getDescriptions'](_0x19dd2c);}})[_0xf80f('0x23')](function(_0x3e478f){if(_0x3e478f){_0x250050=_0x3e478f['length'];if(!_0x383b82[_0xf80f('0x32')][_0xf80f('0x36')](_0xf80f('0x37'))){_0x19dd2c[_0xf80f('0x1b')]=qs[_0xf80f('0x1b')](_0x383b82[_0xf80f('0x32')][_0xf80f('0x1b')]);_0x19dd2c['offset']=qs[_0xf80f('0x1a')](_0x383b82['query'][_0xf80f('0x1a')]);}return _0x33daf3['getDescriptions'](_0x19dd2c);}})[_0xf80f('0x23')](function(_0x3612cf){if(_0x3612cf){return _0x3612cf?{'count':_0x250050,'rows':_0x3612cf}:null;}})[_0xf80f('0x23')](respondWithResult(_0x2a62fd,null))[_0xf80f('0x45')](handleError(_0x2a62fd,null));}; \ No newline at end of file +var _0xbac5=['merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4ad205,_0x5b636d){var _0x4db6c3=function(_0x4421a6){while(--_0x4421a6){_0x4ad205['push'](_0x4ad205['shift']());}};_0x4db6c3(++_0x5b636d);}(_0xbac5,0xa9));var _0x5bac=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0xbac5[_0xe69bf1];return _0x1259d1;};'use strict';var emlformat=require(_0x5bac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bac('0x1'));var moment=require(_0x5bac('0x2'));var BPromise=require(_0x5bac('0x3'));var Mustache=require(_0x5bac('0x4'));var util=require('util');var path=require(_0x5bac('0x5'));var sox=require('sox');var csv=require(_0x5bac('0x6'));var ejs=require(_0x5bac('0x7'));var fs=require('fs');var fs_extra=require(_0x5bac('0x8'));var _=require(_0x5bac('0x9'));var squel=require(_0x5bac('0xa'));var crypto=require(_0x5bac('0xb'));var jsforce=require(_0x5bac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5bac('0x6'));var querystring=require(_0x5bac('0xd'));var Papa=require('papaparse');var Redis=require(_0x5bac('0xe'));var authService=require(_0x5bac('0xf'));var qs=require(_0x5bac('0x10'));var as=require(_0x5bac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bac('0x12'));var utils=require('../../config/utils');var config=require(_0x5bac('0x13'));var licenseUtil=require(_0x5bac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3250,_0x296417){_0x296417=_0x296417||0xcc;return function(_0x14d911){if(_0x14d911){return _0x5a3250['sendStatus'](_0x296417);}return _0x5a3250[_0x5bac('0x15')](_0x296417)[_0x5bac('0x16')]();};}function respondWithResult(_0x404bb4,_0x4df684){_0x4df684=_0x4df684||0xc8;return function(_0x368aa3){if(_0x368aa3){return _0x404bb4[_0x5bac('0x15')](_0x4df684)[_0x5bac('0x17')](_0x368aa3);}};}function respondWithFilteredResult(_0xc86f96,_0xee253e){return function(_0x2ec91f){if(_0x2ec91f){var _0x225c8b=typeof _0xee253e[_0x5bac('0x18')]===_0x5bac('0x19')&&typeof _0xee253e['limit']===_0x5bac('0x19');var _0x133098=_0x2ec91f[_0x5bac('0x1a')];var _0x1b45a9=_0x225c8b?0x0:_0xee253e[_0x5bac('0x18')];var _0x544b6f=_0x225c8b?_0x2ec91f['count']:_0xee253e[_0x5bac('0x18')]+_0xee253e[_0x5bac('0x1b')];var _0x3e5a94;if(_0x544b6f>=_0x133098){_0x544b6f=_0x133098;_0x3e5a94=0xc8;}else{_0x3e5a94=0xce;}_0xc86f96[_0x5bac('0x15')](_0x3e5a94);return _0xc86f96[_0x5bac('0x1c')]('Content-Range',_0x1b45a9+'-'+_0x544b6f+'/'+_0x133098)[_0x5bac('0x17')](_0x2ec91f);}return null;};}function patchUpdates(_0x319f55){return function(_0x444975){try{jsonpatch[_0x5bac('0x1d')](_0x444975,_0x319f55,!![]);}catch(_0x27bb08){return BPromise[_0x5bac('0x1e')](_0x27bb08);}return _0x444975[_0x5bac('0x1f')]();};}function saveUpdates(_0x26f31c,_0x3f3e8d){return function(_0x24def9){if(_0x24def9){return _0x24def9[_0x5bac('0x20')](_0x26f31c)[_0x5bac('0x21')](function(_0x5242ce){return _0x5242ce;});}return null;};}function removeEntity(_0x340f1f,_0xfd1746){return function(_0x151938){if(_0x151938){return _0x151938[_0x5bac('0x22')]()[_0x5bac('0x21')](function(){_0x340f1f[_0x5bac('0x15')](0xcc)[_0x5bac('0x16')]();});}};}function handleEntityNotFound(_0x27c405,_0x19e5b2){return function(_0x2b7c3e){if(!_0x2b7c3e){_0x27c405[_0x5bac('0x23')](0x194);}return _0x2b7c3e;};}function handleError(_0x3f924e,_0x88e51c){_0x88e51c=_0x88e51c||0x1f4;return function(_0x1aad3a){logger['error'](_0x1aad3a[_0x5bac('0x24')]);if(_0x1aad3a[_0x5bac('0x25')]){delete _0x1aad3a['name'];}_0x3f924e['status'](_0x88e51c)['send'](_0x1aad3a);};}exports[_0x5bac('0x26')]=function(_0x12d611,_0x39b9e3){var _0x33abfa={},_0x45c7d4={},_0x4cdec0={'count':0x0,'rows':[]};var _0x15042b=_[_0x5bac('0x27')](db[_0x5bac('0x28')][_0x5bac('0x29')],function(_0x1ab295){return{'name':_0x1ab295[_0x5bac('0x2a')],'type':_0x1ab295[_0x5bac('0x2b')][_0x5bac('0x2c')]};});_0x45c7d4['model']=_[_0x5bac('0x27')](_0x15042b,_0x5bac('0x25'));_0x45c7d4[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x12d611[_0x5bac('0x2d')]);_0x45c7d4[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x45c7d4[_0x5bac('0x31')],_0x45c7d4['query']);_0x33abfa['attributes']=_[_0x5bac('0x30')](_0x45c7d4[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x12d611[_0x5bac('0x2d')]['fields']));_0x33abfa[_0x5bac('0x33')]=_0x33abfa['attributes'][_0x5bac('0x34')]?_0x33abfa[_0x5bac('0x33')]:_0x45c7d4['model'];if(!_0x12d611[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x33abfa[_0x5bac('0x1b')]=qs[_0x5bac('0x1b')](_0x12d611[_0x5bac('0x2d')]['limit']);_0x33abfa[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x12d611['query']['offset']);}_0x33abfa[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x12d611['query'][_0x5bac('0x38')]);_0x33abfa[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_[_0x5bac('0x3a')](_0x12d611[_0x5bac('0x2d')],_0x45c7d4[_0x5bac('0x2f')]),_0x15042b);if(_0x12d611[_0x5bac('0x2d')]['filter']){_0x33abfa[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x33abfa[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x15042b,function(_0x258b7b){if(_0x258b7b[_0x5bac('0x2b')]!=='VIRTUAL'){var _0x4965c8={};_0x4965c8[_0x258b7b[_0x5bac('0x25')]]={'$like':'%'+_0x12d611['query'][_0x5bac('0x3c')]+'%'};return _0x4965c8;}})});}_0x33abfa=_[_0x5bac('0x3b')]({},_0x33abfa,_0x12d611[_0x5bac('0x3d')]);var _0x44ff00={'where':_0x33abfa[_0x5bac('0x39')]};return db[_0x5bac('0x28')]['count'](_0x44ff00)[_0x5bac('0x21')](function(_0xa21928){_0x4cdec0['count']=_0xa21928;if(_0x12d611['query'][_0x5bac('0x3e')]){_0x33abfa[_0x5bac('0x3f')]=[{'all':!![]}];}return db[_0x5bac('0x28')][_0x5bac('0x40')](_0x33abfa);})['then'](function(_0x462e47){_0x4cdec0['rows']=_0x462e47;return _0x4cdec0;})[_0x5bac('0x21')](respondWithFilteredResult(_0x39b9e3,_0x33abfa))[_0x5bac('0x41')](handleError(_0x39b9e3,null));};exports[_0x5bac('0x42')]=function(_0x203ea3,_0x7fce50){var _0x133ee1={'raw':![],'where':{'id':_0x203ea3[_0x5bac('0x43')]['id']}},_0x56467e={};_0x56467e['model']=_[_0x5bac('0x2e')](db[_0x5bac('0x28')]['rawAttributes']);_0x56467e[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x203ea3[_0x5bac('0x2d')]);_0x56467e['filters']=_['intersection'](_0x56467e['model'],_0x56467e[_0x5bac('0x2d')]);_0x133ee1[_0x5bac('0x33')]=_['intersection'](_0x56467e[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x203ea3[_0x5bac('0x2d')][_0x5bac('0x32')]));_0x133ee1[_0x5bac('0x33')]=_0x133ee1['attributes'][_0x5bac('0x34')]?_0x133ee1[_0x5bac('0x33')]:_0x56467e['model'];if(_0x203ea3[_0x5bac('0x2d')][_0x5bac('0x3e')]){_0x133ee1['include']=[{'all':!![]}];}_0x133ee1=_[_0x5bac('0x3b')]({},_0x133ee1,_0x203ea3[_0x5bac('0x3d')]);return db[_0x5bac('0x28')][_0x5bac('0x44')](_0x133ee1)['then'](handleEntityNotFound(_0x7fce50,null))[_0x5bac('0x21')](respondWithResult(_0x7fce50,null))[_0x5bac('0x41')](handleError(_0x7fce50,null));};exports[_0x5bac('0x45')]=function(_0x1f9405,_0x2fdb3a){return db[_0x5bac('0x28')]['create'](_0x1f9405[_0x5bac('0x46')],{})[_0x5bac('0x21')](respondWithResult(_0x2fdb3a,0xc9))['catch'](handleError(_0x2fdb3a,null));};exports[_0x5bac('0x20')]=function(_0x110078,_0x368259){if(_0x110078[_0x5bac('0x46')]['id']){delete _0x110078[_0x5bac('0x46')]['id'];}return db[_0x5bac('0x28')][_0x5bac('0x44')]({'where':{'id':_0x110078[_0x5bac('0x43')]['id']}})['then'](handleEntityNotFound(_0x368259,null))[_0x5bac('0x21')](saveUpdates(_0x110078['body'],null))[_0x5bac('0x21')](respondWithResult(_0x368259,null))[_0x5bac('0x41')](handleError(_0x368259,null));};exports[_0x5bac('0x22')]=function(_0x2939dc,_0x3819e1){return db[_0x5bac('0x28')][_0x5bac('0x44')]({'where':{'id':_0x2939dc[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0x3819e1,null))[_0x5bac('0x21')](removeEntity(_0x3819e1,null))[_0x5bac('0x41')](handleError(_0x3819e1,null));};exports[_0x5bac('0x47')]=function(_0x2ccc39,_0xb9e60b,_0x3aad3c){var _0xc42d9c={};var _0x32b895={};var _0x5fb95e;var _0x2f5f6a;return db[_0x5bac('0x28')][_0x5bac('0x48')]({'where':{'id':_0x2ccc39[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0xb9e60b,null))[_0x5bac('0x21')](function(_0x2533da){if(_0x2533da){_0x5fb95e=_0x2533da;_0x32b895[_0x5bac('0x31')]=_['keys'](db[_0x5bac('0x49')]['rawAttributes']);_0x32b895[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x2ccc39[_0x5bac('0x2d')]);_0x32b895[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x32b895[_0x5bac('0x31')],_0x32b895[_0x5bac('0x2d')]);_0xc42d9c[_0x5bac('0x33')]=_['intersection'](_0x32b895[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x2ccc39['query'][_0x5bac('0x32')]));_0xc42d9c[_0x5bac('0x33')]=_0xc42d9c[_0x5bac('0x33')][_0x5bac('0x34')]?_0xc42d9c[_0x5bac('0x33')]:_0x32b895[_0x5bac('0x31')];_0xc42d9c[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x38')]);_0xc42d9c['where']=qs[_0x5bac('0x2f')](_['pick'](_0x2ccc39[_0x5bac('0x2d')],_0x32b895[_0x5bac('0x2f')]));if(_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x3c')]){_0xc42d9c['where']=_[_0x5bac('0x3b')](_0xc42d9c['where'],{'$or':_[_0x5bac('0x27')](_0xc42d9c[_0x5bac('0x33')],function(_0x9f2f52){var _0x5080ed={};_0x5080ed[_0x9f2f52]={'$like':'%'+_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x3c')]+'%'};return _0x5080ed;})});}_0xc42d9c=_[_0x5bac('0x3b')]({},_0xc42d9c,_0x2ccc39[_0x5bac('0x3d')]);return _0x5fb95e['getFields'](_0xc42d9c);}})[_0x5bac('0x21')](function(_0x194957){if(_0x194957){_0x2f5f6a=_0x194957[_0x5bac('0x34')];if(!_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0xc42d9c['limit']=qs[_0x5bac('0x1b')](_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x1b')]);_0xc42d9c[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x2ccc39[_0x5bac('0x2d')]['offset']);}return _0x5fb95e[_0x5bac('0x47')](_0xc42d9c);}})[_0x5bac('0x21')](function(_0x4c1bd0){if(_0x4c1bd0){return _0x4c1bd0?{'count':_0x2f5f6a,'rows':_0x4c1bd0}:null;}})[_0x5bac('0x21')](respondWithResult(_0xb9e60b,null))[_0x5bac('0x41')](handleError(_0xb9e60b,null));};exports[_0x5bac('0x4a')]=function(_0x2489d0,_0x2306f2,_0x2a94e4){var _0x3f3769={};var _0x28599c={};var _0x1c0cac;var _0x97112e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2489d0[_0x5bac('0x43')]['id']}})['then'](handleEntityNotFound(_0x2306f2,null))[_0x5bac('0x21')](function(_0xf09a73){if(_0xf09a73){_0x1c0cac=_0xf09a73;_0x28599c[_0x5bac('0x31')]=_[_0x5bac('0x2e')](db[_0x5bac('0x49')][_0x5bac('0x29')]);_0x28599c[_0x5bac('0x2d')]=_['keys'](_0x2489d0[_0x5bac('0x2d')]);_0x28599c[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x28599c[_0x5bac('0x31')],_0x28599c[_0x5bac('0x2d')]);_0x3f3769[_0x5bac('0x33')]=_[_0x5bac('0x30')](_0x28599c[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x32')]));_0x3f3769[_0x5bac('0x33')]=_0x3f3769[_0x5bac('0x33')][_0x5bac('0x34')]?_0x3f3769['attributes']:_0x28599c['model'];_0x3f3769[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x38')]);_0x3f3769[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_[_0x5bac('0x3a')](_0x2489d0[_0x5bac('0x2d')],_0x28599c[_0x5bac('0x2f')]));if(_0x2489d0['query']['filter']){_0x3f3769[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x3f3769[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x3f3769[_0x5bac('0x33')],function(_0x7658c1){var _0x41d2fe={};_0x41d2fe[_0x7658c1]={'$like':'%'+_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x3c')]+'%'};return _0x41d2fe;})});}_0x3f3769=_['merge']({},_0x3f3769,_0x2489d0[_0x5bac('0x3d')]);return _0x1c0cac['getSubjects'](_0x3f3769);}})[_0x5bac('0x21')](function(_0x4dadb9){if(_0x4dadb9){_0x97112e=_0x4dadb9[_0x5bac('0x34')];if(!_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x3f3769['limit']=qs[_0x5bac('0x1b')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x1b')]);_0x3f3769[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x2489d0[_0x5bac('0x2d')]['offset']);}return _0x1c0cac[_0x5bac('0x4a')](_0x3f3769);}})[_0x5bac('0x21')](function(_0x69e87f){if(_0x69e87f){return _0x69e87f?{'count':_0x97112e,'rows':_0x69e87f}:null;}})['then'](respondWithResult(_0x2306f2,null))['catch'](handleError(_0x2306f2,null));};exports[_0x5bac('0x4b')]=function(_0x28ab88,_0x50cdd5,_0x5945df){var _0x2e2f3e={};var _0x289d69={};var _0x3c0277;var _0x4cf686;return db[_0x5bac('0x28')][_0x5bac('0x48')]({'where':{'id':_0x28ab88[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0x50cdd5,null))[_0x5bac('0x21')](function(_0x2ade54){if(_0x2ade54){_0x3c0277=_0x2ade54;_0x289d69[_0x5bac('0x31')]=_[_0x5bac('0x2e')](db[_0x5bac('0x49')][_0x5bac('0x29')]);_0x289d69['query']=_[_0x5bac('0x2e')](_0x28ab88[_0x5bac('0x2d')]);_0x289d69[_0x5bac('0x2f')]=_['intersection'](_0x289d69[_0x5bac('0x31')],_0x289d69['query']);_0x2e2f3e[_0x5bac('0x33')]=_[_0x5bac('0x30')](_0x289d69[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x28ab88[_0x5bac('0x2d')]['fields']));_0x2e2f3e[_0x5bac('0x33')]=_0x2e2f3e['attributes']['length']?_0x2e2f3e['attributes']:_0x289d69[_0x5bac('0x31')];_0x2e2f3e[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x28ab88[_0x5bac('0x2d')]['sort']);_0x2e2f3e[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_['pick'](_0x28ab88[_0x5bac('0x2d')],_0x289d69[_0x5bac('0x2f')]));if(_0x28ab88[_0x5bac('0x2d')][_0x5bac('0x3c')]){_0x2e2f3e[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x2e2f3e[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x2e2f3e[_0x5bac('0x33')],function(_0x7ccee2){var _0x51be41={};_0x51be41[_0x7ccee2]={'$like':'%'+_0x28ab88[_0x5bac('0x2d')]['filter']+'%'};return _0x51be41;})});}_0x2e2f3e=_[_0x5bac('0x3b')]({},_0x2e2f3e,_0x28ab88[_0x5bac('0x3d')]);return _0x3c0277['getDescriptions'](_0x2e2f3e);}})[_0x5bac('0x21')](function(_0x15f72a){if(_0x15f72a){_0x4cf686=_0x15f72a['length'];if(!_0x28ab88[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x2e2f3e[_0x5bac('0x1b')]=qs[_0x5bac('0x1b')](_0x28ab88['query'][_0x5bac('0x1b')]);_0x2e2f3e['offset']=qs[_0x5bac('0x18')](_0x28ab88['query'][_0x5bac('0x18')]);}return _0x3c0277[_0x5bac('0x4b')](_0x2e2f3e);}})[_0x5bac('0x21')](function(_0x13c7ee){if(_0x13c7ee){return _0x13c7ee?{'count':_0x4cf686,'rows':_0x13c7ee}:null;}})['then'](respondWithResult(_0x50cdd5,null))[_0x5bac('0x41')](handleError(_0x50cdd5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4af5bb8..8c90be4 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 _0x4ff9=['SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x309449,_0x5300fd){var _0x16b34a=function(_0x555df9){while(--_0x555df9){_0x309449['push'](_0x309449['shift']());}};_0x16b34a(++_0x5300fd);}(_0x4ff9,0x17e));var _0x94ff=function(_0x5ebef7,_0x28563d){_0x5ebef7=_0x5ebef7-0x0;var _0x31a377=_0x4ff9[_0x5ebef7];return _0x31a377;};'use strict';var _=require(_0x94ff('0x0'));var util=require('util');var logger=require(_0x94ff('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x94ff('0x2'));var fs=require('fs');var path=require(_0x94ff('0x3'));var rimraf=require('rimraf');var config=require(_0x94ff('0x4'));var attributes=require(_0x94ff('0x5'));module[_0x94ff('0x6')]=function(_0xed63c7,_0x52c512){return _0xed63c7[_0x94ff('0x7')](_0x94ff('0x8'),attributes,{'tableName':_0x94ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b64=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x5b4d2c,_0x5d1623){var _0x529eea=function(_0x1db7c8){while(--_0x1db7c8){_0x5b4d2c['push'](_0x5b4d2c['shift']());}};_0x529eea(++_0x5d1623);}(_0x3b64,0xc5));var _0x43b6=function(_0x5bc0e0,_0x507608){_0x5bc0e0=_0x5bc0e0-0x0;var _0x2a577b=_0x3b64[_0x5bc0e0];return _0x2a577b;};'use strict';var _=require(_0x43b6('0x0'));var util=require('util');var logger=require(_0x43b6('0x1'))(_0x43b6('0x2'));var moment=require(_0x43b6('0x3'));var BPromise=require(_0x43b6('0x4'));var rp=require(_0x43b6('0x5'));var fs=require('fs');var path=require(_0x43b6('0x6'));var rimraf=require(_0x43b6('0x7'));var config=require(_0x43b6('0x8'));var attributes=require(_0x43b6('0x9'));module[_0x43b6('0xa')]=function(_0x55c178,_0x3ffcae){return _0x55c178[_0x43b6('0xb')](_0x43b6('0xc'),attributes,{'tableName':_0x43b6('0xd'),'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 2089098..e071e75 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 _0xf2e6=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b100f,_0x45993c){var _0x4a5c93=function(_0x2f2d05){while(--_0x2f2d05){_0x3b100f['push'](_0x3b100f['shift']());}};_0x4a5c93(++_0x45993c);}(_0xf2e6,0xf6));var _0x6f2e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xf2e6[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x6f2e('0x0'));var util=require('util');var moment=require(_0x6f2e('0x1'));var BPromise=require(_0x6f2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2e('0x3'))['db'];var utils=require(_0x6f2e('0x4'));var logger=require(_0x6f2e('0x5'))('rpc');var config=require(_0x6f2e('0x6'));var jayson=require(_0x6f2e('0x7'));var client=jayson['client'][_0x6f2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x131b1b,_0x1712ce,_0x395593){return new BPromise(function(_0x3d3269,_0x17c2d6){return client[_0x6f2e('0x9')](_0x131b1b,_0x395593)[_0x6f2e('0xa')](function(_0x14728d){logger['info'](_0x6f2e('0xb'),_0x1712ce,_0x6f2e('0xc'));logger[_0x6f2e('0xd')](_0x6f2e('0xe'),_0x1712ce,_0x6f2e('0xc'),JSON['stringify'](_0x14728d));if(_0x14728d[_0x6f2e('0xf')]){if(_0x14728d[_0x6f2e('0xf')]['code']===0x1f4){logger[_0x6f2e('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1712ce,_0x14728d[_0x6f2e('0xf')][_0x6f2e('0x10')]);return _0x17c2d6(_0x14728d[_0x6f2e('0xf')][_0x6f2e('0x10')]);}logger[_0x6f2e('0xf')](_0x6f2e('0xb'),_0x1712ce,_0x14728d[_0x6f2e('0xf')]['message']);return _0x3d3269(_0x14728d['error'][_0x6f2e('0x10')]);}else{logger[_0x6f2e('0x11')](_0x6f2e('0xb'),_0x1712ce,'request\x20sent');_0x3d3269(_0x14728d[_0x6f2e('0x12')][_0x6f2e('0x10')]);}})[_0x6f2e('0x13')](function(_0x13f66a){logger[_0x6f2e('0xf')](_0x6f2e('0xb'),_0x1712ce,_0x13f66a);_0x17c2d6(_0x13f66a);});});} \ No newline at end of file +var _0x969f=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5cd502,_0xd98fd2){var _0x43d8a5=function(_0x2acdd8){while(--_0x2acdd8){_0x5cd502['push'](_0x5cd502['shift']());}};_0x43d8a5(++_0xd98fd2);}(_0x969f,0x13c));var _0xf969=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x969f[_0x3ed95e];return _0x4ab531;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var moment=require(_0xf969('0x2'));var BPromise=require(_0xf969('0x3'));var rs=require(_0xf969('0x4'));var fs=require('fs');var Redis=require(_0xf969('0x5'));var db=require(_0xf969('0x6'))['db'];var utils=require(_0xf969('0x7'));var logger=require(_0xf969('0x8'))(_0xf969('0x9'));var config=require(_0xf969('0xa'));var jayson=require(_0xf969('0xb'));var client=jayson[_0xf969('0xc')][_0xf969('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e17af,_0x1b7893,_0x2258a3){return new BPromise(function(_0x4c113c,_0x378cd7){return client[_0xf969('0xe')](_0x1e17af,_0x2258a3)[_0xf969('0xf')](function(_0x2351b3){logger[_0xf969('0x10')](_0xf969('0x11'),_0x1b7893,_0xf969('0x12'));logger[_0xf969('0x13')](_0xf969('0x14'),_0x1b7893,_0xf969('0x12'),JSON[_0xf969('0x15')](_0x2351b3));if(_0x2351b3[_0xf969('0x16')]){if(_0x2351b3[_0xf969('0x16')]['code']===0x1f4){logger[_0xf969('0x16')](_0xf969('0x11'),_0x1b7893,_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);return _0x378cd7(_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);}logger['error'](_0xf969('0x11'),_0x1b7893,_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);return _0x4c113c(_0x2351b3['error'][_0xf969('0x17')]);}else{logger[_0xf969('0x10')](_0xf969('0x11'),_0x1b7893,_0xf969('0x12'));_0x4c113c(_0x2351b3[_0xf969('0x18')][_0xf969('0x17')]);}})[_0xf969('0x19')](function(_0x334d39){logger[_0xf969('0x16')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b7893,_0x334d39);_0x378cd7(_0x334d39);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6f8b6cd..7755b5e 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 _0x403e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','delete','destroy','exports','multer','util','path'];(function(_0x3adcbe,_0xd8ef51){var _0x2ef8b7=function(_0x1b8e9c){while(--_0x1b8e9c){_0x3adcbe['push'](_0x3adcbe['shift']());}};_0x2ef8b7(++_0xd8ef51);}(_0x403e,0x141));var _0xe403=function(_0x2d669d,_0x400119){_0x2d669d=_0x2d669d-0x0;var _0x589247=_0x403e[_0x2d669d];return _0x589247;};'use strict';var multer=require(_0xe403('0x0'));var util=require(_0xe403('0x1'));var path=require(_0xe403('0x2'));var timeout=require(_0xe403('0x3'));var express=require(_0xe403('0x4'));var router=express[_0xe403('0x5')]();var fs_extra=require(_0xe403('0x6'));var auth=require(_0xe403('0x7'));var interaction=require(_0xe403('0x8'));var config=require(_0xe403('0x9'));var controller=require(_0xe403('0xa'));router[_0xe403('0xb')]('/',auth[_0xe403('0xc')](),controller[_0xe403('0xd')]);router[_0xe403('0xb')](_0xe403('0xe'),auth[_0xe403('0xc')](),controller['show']);router['post']('/',auth[_0xe403('0xc')](),controller['create']);router['put'](_0xe403('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe403('0xf')](_0xe403('0xe'),auth[_0xe403('0xc')](),controller[_0xe403('0x10')]);module[_0xe403('0x11')]=router; \ No newline at end of file +var _0x9c95=['./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c95,0x1ce));var _0x59c9=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9c95[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x59c9('0x0'));var util=require(_0x59c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x59c9('0x2'));var router=express[_0x59c9('0x3')]();var fs_extra=require(_0x59c9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59c9('0x5'));var controller=require(_0x59c9('0x6'));router[_0x59c9('0x7')]('/',auth[_0x59c9('0x8')](),controller[_0x59c9('0x9')]);router[_0x59c9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x59c9('0xa')]);router[_0x59c9('0xb')]('/',auth[_0x59c9('0x8')](),controller[_0x59c9('0xc')]);router[_0x59c9('0xd')](_0x59c9('0xe'),auth[_0x59c9('0x8')](),controller['update']);router[_0x59c9('0xf')](_0x59c9('0xe'),auth[_0x59c9('0x8')](),controller[_0x59c9('0x10')]);module[_0x59c9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index be51839..4edd95f 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 _0x346c=['STRING','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x346c,0x1e4));var _0xc346=function(_0x211fc1,_0x2d77bc){_0x211fc1=_0x211fc1-0x0;var _0x4b0e06=_0x346c[_0x211fc1];return _0x4b0e06;};'use strict';var Sequelize=require(_0xc346('0x0'));module[_0xc346('0x1')]={'type':{'type':Sequelize[_0xc346('0x2')](_0xc346('0x3'),_0xc346('0x4'),'customVariable','keyValue',_0xc346('0x5')),'defaultValue':_0xc346('0x3')},'content':{'type':Sequelize[_0xc346('0x6')]},'key':{'type':Sequelize[_0xc346('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc346('0x3'),_0xc346('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f6c=['sequelize','ENUM','string','variable','customVariable','STRING'];(function(_0x256684,_0xff356e){var _0xe7e17d=function(_0x1ff250){while(--_0x1ff250){_0x256684['push'](_0x256684['shift']());}};_0xe7e17d(++_0xff356e);}(_0x6f6c,0xae));var _0xc6f6=function(_0xb59c89,_0x143196){_0xb59c89=_0xb59c89-0x0;var _0x779378=_0x6f6c[_0xb59c89];return _0x779378;};'use strict';var Sequelize=require(_0xc6f6('0x0'));module['exports']={'type':{'type':Sequelize[_0xc6f6('0x1')](_0xc6f6('0x2'),_0xc6f6('0x3'),_0xc6f6('0x4'),'keyValue','picklist'),'defaultValue':_0xc6f6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc6f6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6f6('0x5')]},'idField':{'type':Sequelize[_0xc6f6('0x5')]},'variableName':{'type':Sequelize[_0xc6f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 05eee1f..64d0452 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 _0x12bb=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs'];(function(_0x1387b9,_0x304cc0){var _0x103241=function(_0x2df133){while(--_0x2df133){_0x1387b9['push'](_0x1387b9['shift']());}};_0x103241(++_0x304cc0);}(_0x12bb,0x144));var _0xb12b=function(_0x313530,_0x3720cf){_0x313530=_0x313530-0x0;var _0x50c1f7=_0x12bb[_0x313530];return _0x50c1f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb12b('0x0'));var zipdir=require(_0xb12b('0x1'));var jsonpatch=require(_0xb12b('0x2'));var rp=require(_0xb12b('0x3'));var moment=require(_0xb12b('0x4'));var BPromise=require(_0xb12b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb12b('0x6'));var sox=require('sox');var csv=require(_0xb12b('0x7'));var ejs=require(_0xb12b('0x8'));var fs=require('fs');var fs_extra=require(_0xb12b('0x9'));var _=require(_0xb12b('0xa'));var squel=require(_0xb12b('0xb'));var crypto=require('crypto');var jsforce=require(_0xb12b('0xc'));var deskjs=require(_0xb12b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb12b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb12b('0xf'));var as=require(_0xb12b('0x10'));var hardwareService=require(_0xb12b('0x11'));var logger=require('../../config/logger')(_0xb12b('0x12'));var utils=require('../../config/utils');var config=require(_0xb12b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb12b('0x14'))['db'];function respondWithStatusCode(_0x1d9bda,_0x2ce8de){_0x2ce8de=_0x2ce8de||0xcc;return function(_0x5c1cb6){if(_0x5c1cb6){return _0x1d9bda[_0xb12b('0x15')](_0x2ce8de);}return _0x1d9bda[_0xb12b('0x16')](_0x2ce8de)['end']();};}function respondWithResult(_0x2f75cc,_0x21e2a7){_0x21e2a7=_0x21e2a7||0xc8;return function(_0x5a7161){if(_0x5a7161){return _0x2f75cc[_0xb12b('0x16')](_0x21e2a7)['json'](_0x5a7161);}};}function respondWithFilteredResult(_0x13ec21,_0xcdd6f){return function(_0x16f4bc){if(_0x16f4bc){var _0x5f071b=typeof _0xcdd6f[_0xb12b('0x17')]===_0xb12b('0x18')&&typeof _0xcdd6f[_0xb12b('0x19')]==='undefined';var _0x13de3c=_0x16f4bc[_0xb12b('0x1a')];var _0x532282=_0x5f071b?0x0:_0xcdd6f['offset'];var _0x4acfe7=_0x5f071b?_0x16f4bc[_0xb12b('0x1a')]:_0xcdd6f[_0xb12b('0x17')]+_0xcdd6f[_0xb12b('0x19')];var _0x4ea2b9;if(_0x4acfe7>=_0x13de3c){_0x4acfe7=_0x13de3c;_0x4ea2b9=0xc8;}else{_0x4ea2b9=0xce;}_0x13ec21[_0xb12b('0x16')](_0x4ea2b9);return _0x13ec21[_0xb12b('0x1b')](_0xb12b('0x1c'),_0x532282+'-'+_0x4acfe7+'/'+_0x13de3c)[_0xb12b('0x1d')](_0x16f4bc);}return null;};}function patchUpdates(_0x172db7){return function(_0x45479e){try{jsonpatch[_0xb12b('0x1e')](_0x45479e,_0x172db7,!![]);}catch(_0x19dcea){return BPromise['reject'](_0x19dcea);}return _0x45479e[_0xb12b('0x1f')]();};}function saveUpdates(_0x20e9f2,_0x44d918){return function(_0x2fd8bf){if(_0x2fd8bf){return _0x2fd8bf[_0xb12b('0x20')](_0x20e9f2)[_0xb12b('0x21')](function(_0x188f0e){return _0x188f0e;});}return null;};}function removeEntity(_0x44b085,_0x5c42cd){return function(_0x4acdcc){if(_0x4acdcc){return _0x4acdcc[_0xb12b('0x22')]()[_0xb12b('0x21')](function(){_0x44b085['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28caa0,_0x554bec){return function(_0x16ffce){if(!_0x16ffce){_0x28caa0['sendStatus'](0x194);}return _0x16ffce;};}function handleError(_0x3391d8,_0x1623e0){_0x1623e0=_0x1623e0||0x1f4;return function(_0x5ccccb){logger[_0xb12b('0x23')](_0x5ccccb['stack']);if(_0x5ccccb[_0xb12b('0x24')]){delete _0x5ccccb[_0xb12b('0x24')];}_0x3391d8['status'](_0x1623e0)[_0xb12b('0x25')](_0x5ccccb);};}exports[_0xb12b('0x26')]=function(_0x5bf394,_0x1c8bb6){var _0x26e33b={},_0x2d76ea={},_0x2e8226={'count':0x0,'rows':[]};var _0x133304=_[_0xb12b('0x27')](db[_0xb12b('0x28')][_0xb12b('0x29')],function(_0xa4f479){return{'name':_0xa4f479[_0xb12b('0x2a')],'type':_0xa4f479['type']['key']};});_0x2d76ea['model']=_[_0xb12b('0x27')](_0x133304,_0xb12b('0x24'));_0x2d76ea[_0xb12b('0x2b')]=_['keys'](_0x5bf394[_0xb12b('0x2b')]);_0x2d76ea[_0xb12b('0x2c')]=_[_0xb12b('0x2d')](_0x2d76ea[_0xb12b('0x2e')],_0x2d76ea[_0xb12b('0x2b')]);_0x26e33b[_0xb12b('0x2f')]=_[_0xb12b('0x2d')](_0x2d76ea['model'],qs[_0xb12b('0x30')](_0x5bf394['query'][_0xb12b('0x30')]));_0x26e33b['attributes']=_0x26e33b[_0xb12b('0x2f')][_0xb12b('0x31')]?_0x26e33b[_0xb12b('0x2f')]:_0x2d76ea[_0xb12b('0x2e')];if(!_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x32')]('nolimit')){_0x26e33b['limit']=qs[_0xb12b('0x19')](_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x19')]);_0x26e33b[_0xb12b('0x17')]=qs[_0xb12b('0x17')](_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x17')]);}_0x26e33b['order']=qs[_0xb12b('0x33')](_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x33')]);_0x26e33b['where']=qs['filters'](_[_0xb12b('0x34')](_0x5bf394[_0xb12b('0x2b')],_0x2d76ea[_0xb12b('0x2c')]),_0x133304);if(_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x35')]){_0x26e33b[_0xb12b('0x36')]=_[_0xb12b('0x37')](_0x26e33b[_0xb12b('0x36')],{'$or':_[_0xb12b('0x27')](_0x133304,function(_0x53a0c7){if(_0x53a0c7[_0xb12b('0x38')]!==_0xb12b('0x39')){var _0x101a26={};_0x101a26[_0x53a0c7[_0xb12b('0x24')]]={'$like':'%'+_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x35')]+'%'};return _0x101a26;}})});}_0x26e33b=_['merge']({},_0x26e33b,_0x5bf394[_0xb12b('0x3a')]);var _0x521df8={'where':_0x26e33b[_0xb12b('0x36')]};return db[_0xb12b('0x28')]['count'](_0x521df8)[_0xb12b('0x21')](function(_0x196e8c){_0x2e8226[_0xb12b('0x1a')]=_0x196e8c;if(_0x5bf394[_0xb12b('0x2b')][_0xb12b('0x3b')]){_0x26e33b['include']=[{'all':!![]}];}return db['SalesforceField'][_0xb12b('0x3c')](_0x26e33b);})[_0xb12b('0x21')](function(_0x40ffd7){_0x2e8226['rows']=_0x40ffd7;return _0x2e8226;})['then'](respondWithFilteredResult(_0x1c8bb6,_0x26e33b))[_0xb12b('0x3d')](handleError(_0x1c8bb6,null));};exports['show']=function(_0x39266e,_0x7c073b){var _0x42045f={'raw':!![],'where':{'id':_0x39266e[_0xb12b('0x3e')]['id']}},_0x56ea5b={};_0x56ea5b[_0xb12b('0x2e')]=_[_0xb12b('0x3f')](db[_0xb12b('0x28')][_0xb12b('0x29')]);_0x56ea5b[_0xb12b('0x2b')]=_['keys'](_0x39266e[_0xb12b('0x2b')]);_0x56ea5b['filters']=_[_0xb12b('0x2d')](_0x56ea5b['model'],_0x56ea5b[_0xb12b('0x2b')]);_0x42045f[_0xb12b('0x2f')]=_[_0xb12b('0x2d')](_0x56ea5b['model'],qs[_0xb12b('0x30')](_0x39266e[_0xb12b('0x2b')]['fields']));_0x42045f[_0xb12b('0x2f')]=_0x42045f[_0xb12b('0x2f')]['length']?_0x42045f[_0xb12b('0x2f')]:_0x56ea5b[_0xb12b('0x2e')];if(_0x39266e[_0xb12b('0x2b')][_0xb12b('0x3b')]){_0x42045f[_0xb12b('0x40')]=[{'all':!![]}];}_0x42045f=_[_0xb12b('0x37')]({},_0x42045f,_0x39266e[_0xb12b('0x3a')]);return db['SalesforceField'][_0xb12b('0x41')](_0x42045f)['then'](handleEntityNotFound(_0x7c073b,null))[_0xb12b('0x21')](respondWithResult(_0x7c073b,null))['catch'](handleError(_0x7c073b,null));};exports[_0xb12b('0x42')]=function(_0x3544e1,_0x436b69){return db[_0xb12b('0x28')][_0xb12b('0x42')](_0x3544e1[_0xb12b('0x43')],{})[_0xb12b('0x21')](respondWithResult(_0x436b69,0xc9))['catch'](handleError(_0x436b69,null));};exports[_0xb12b('0x20')]=function(_0x3b1c2a,_0x47c8fe){if(_0x3b1c2a[_0xb12b('0x43')]['id']){delete _0x3b1c2a[_0xb12b('0x43')]['id'];}return db[_0xb12b('0x28')][_0xb12b('0x41')]({'where':{'id':_0x3b1c2a[_0xb12b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x47c8fe,null))[_0xb12b('0x21')](saveUpdates(_0x3b1c2a[_0xb12b('0x43')],null))[_0xb12b('0x21')](respondWithResult(_0x47c8fe,null))['catch'](handleError(_0x47c8fe,null));};exports[_0xb12b('0x22')]=function(_0x3014d1,_0x30a64b){return db['SalesforceField']['find']({'where':{'id':_0x3014d1[_0xb12b('0x3e')]['id']}})[_0xb12b('0x21')](handleEntityNotFound(_0x30a64b,null))[_0xb12b('0x21')](removeEntity(_0x30a64b,null))[_0xb12b('0x3d')](handleError(_0x30a64b,null));}; \ No newline at end of file +var _0x19d3=['nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','options','create','body','catch','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xddc052,_0x234244){var _0x4886bc=function(_0x1f66f5){while(--_0x1f66f5){_0xddc052['push'](_0xddc052['shift']());}};_0x4886bc(++_0x234244);}(_0x19d3,0x195));var _0x319d=function(_0x43b0cb,_0x485044){_0x43b0cb=_0x43b0cb-0x0;var _0x4c3a07=_0x19d3[_0x43b0cb];return _0x4c3a07;};'use strict';var emlformat=require(_0x319d('0x0'));var rimraf=require(_0x319d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x319d('0x2'));var moment=require(_0x319d('0x3'));var BPromise=require(_0x319d('0x4'));var Mustache=require(_0x319d('0x5'));var util=require(_0x319d('0x6'));var path=require(_0x319d('0x7'));var sox=require('sox');var csv=require(_0x319d('0x8'));var ejs=require(_0x319d('0x9'));var fs=require('fs');var fs_extra=require(_0x319d('0xa'));var _=require(_0x319d('0xb'));var squel=require(_0x319d('0xc'));var crypto=require(_0x319d('0xd'));var jsforce=require(_0x319d('0xe'));var deskjs=require(_0x319d('0xf'));var toCsv=require(_0x319d('0x8'));var querystring=require('querystring');var Papa=require(_0x319d('0x10'));var Redis=require(_0x319d('0x11'));var authService=require(_0x319d('0x12'));var qs=require(_0x319d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x319d('0x14'));var logger=require(_0x319d('0x15'))('api');var utils=require(_0x319d('0x16'));var config=require(_0x319d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x319d('0x18'))['db'];function respondWithStatusCode(_0x4e5981,_0x11685c){_0x11685c=_0x11685c||0xcc;return function(_0x5ea9c1){if(_0x5ea9c1){return _0x4e5981[_0x319d('0x19')](_0x11685c);}return _0x4e5981[_0x319d('0x1a')](_0x11685c)[_0x319d('0x1b')]();};}function respondWithResult(_0x38e5db,_0x59f85f){_0x59f85f=_0x59f85f||0xc8;return function(_0x3d8987){if(_0x3d8987){return _0x38e5db[_0x319d('0x1a')](_0x59f85f)[_0x319d('0x1c')](_0x3d8987);}};}function respondWithFilteredResult(_0xa22daa,_0x4a5cb1){return function(_0x28ac69){if(_0x28ac69){var _0x2b0831=typeof _0x4a5cb1[_0x319d('0x1d')]===_0x319d('0x1e')&&typeof _0x4a5cb1[_0x319d('0x1f')]===_0x319d('0x1e');var _0x335530=_0x28ac69[_0x319d('0x20')];var _0x125c32=_0x2b0831?0x0:_0x4a5cb1[_0x319d('0x1d')];var _0x4ad6b2=_0x2b0831?_0x28ac69[_0x319d('0x20')]:_0x4a5cb1['offset']+_0x4a5cb1[_0x319d('0x1f')];var _0x333266;if(_0x4ad6b2>=_0x335530){_0x4ad6b2=_0x335530;_0x333266=0xc8;}else{_0x333266=0xce;}_0xa22daa[_0x319d('0x1a')](_0x333266);return _0xa22daa[_0x319d('0x21')](_0x319d('0x22'),_0x125c32+'-'+_0x4ad6b2+'/'+_0x335530)[_0x319d('0x1c')](_0x28ac69);}return null;};}function patchUpdates(_0x307886){return function(_0x41a822){try{jsonpatch[_0x319d('0x23')](_0x41a822,_0x307886,!![]);}catch(_0x461233){return BPromise[_0x319d('0x24')](_0x461233);}return _0x41a822['save']();};}function saveUpdates(_0x150b55,_0xead2d2){return function(_0x20602e){if(_0x20602e){return _0x20602e[_0x319d('0x25')](_0x150b55)['then'](function(_0xf286e){return _0xf286e;});}return null;};}function removeEntity(_0x5b13fa,_0x34c300){return function(_0x1ae630){if(_0x1ae630){return _0x1ae630[_0x319d('0x26')]()[_0x319d('0x27')](function(){_0x5b13fa['status'](0xcc)[_0x319d('0x1b')]();});}};}function handleEntityNotFound(_0x5e1b3e,_0xa1c654){return function(_0x1e5fa6){if(!_0x1e5fa6){_0x5e1b3e['sendStatus'](0x194);}return _0x1e5fa6;};}function handleError(_0x5e432f,_0x162b7e){_0x162b7e=_0x162b7e||0x1f4;return function(_0xba1682){logger[_0x319d('0x28')](_0xba1682[_0x319d('0x29')]);if(_0xba1682[_0x319d('0x2a')]){delete _0xba1682['name'];}_0x5e432f[_0x319d('0x1a')](_0x162b7e)[_0x319d('0x2b')](_0xba1682);};}exports[_0x319d('0x2c')]=function(_0x58a63e,_0x51b180){var _0x379501={},_0x43a44a={},_0x41d284={'count':0x0,'rows':[]};var _0x1eb9ee=_[_0x319d('0x2d')](db[_0x319d('0x2e')][_0x319d('0x2f')],function(_0x361b1b){return{'name':_0x361b1b[_0x319d('0x30')],'type':_0x361b1b[_0x319d('0x31')]['key']};});_0x43a44a[_0x319d('0x32')]=_[_0x319d('0x2d')](_0x1eb9ee,_0x319d('0x2a'));_0x43a44a[_0x319d('0x33')]=_['keys'](_0x58a63e[_0x319d('0x33')]);_0x43a44a['filters']=_[_0x319d('0x34')](_0x43a44a[_0x319d('0x32')],_0x43a44a[_0x319d('0x33')]);_0x379501[_0x319d('0x35')]=_[_0x319d('0x34')](_0x43a44a['model'],qs[_0x319d('0x36')](_0x58a63e['query'][_0x319d('0x36')]));_0x379501[_0x319d('0x35')]=_0x379501[_0x319d('0x35')][_0x319d('0x37')]?_0x379501[_0x319d('0x35')]:_0x43a44a[_0x319d('0x32')];if(!_0x58a63e[_0x319d('0x33')][_0x319d('0x38')](_0x319d('0x39'))){_0x379501['limit']=qs[_0x319d('0x1f')](_0x58a63e[_0x319d('0x33')]['limit']);_0x379501['offset']=qs['offset'](_0x58a63e[_0x319d('0x33')][_0x319d('0x1d')]);}_0x379501[_0x319d('0x3a')]=qs[_0x319d('0x3b')](_0x58a63e[_0x319d('0x33')][_0x319d('0x3b')]);_0x379501['where']=qs[_0x319d('0x3c')](_[_0x319d('0x3d')](_0x58a63e['query'],_0x43a44a['filters']),_0x1eb9ee);if(_0x58a63e[_0x319d('0x33')][_0x319d('0x3e')]){_0x379501[_0x319d('0x3f')]=_['merge'](_0x379501[_0x319d('0x3f')],{'$or':_[_0x319d('0x2d')](_0x1eb9ee,function(_0x40fc48){if(_0x40fc48[_0x319d('0x31')]!==_0x319d('0x40')){var _0x13bcb2={};_0x13bcb2[_0x40fc48[_0x319d('0x2a')]]={'$like':'%'+_0x58a63e[_0x319d('0x33')][_0x319d('0x3e')]+'%'};return _0x13bcb2;}})});}_0x379501=_[_0x319d('0x41')]({},_0x379501,_0x58a63e['options']);var _0x55514b={'where':_0x379501[_0x319d('0x3f')]};return db[_0x319d('0x2e')][_0x319d('0x20')](_0x55514b)[_0x319d('0x27')](function(_0x1f97f3){_0x41d284[_0x319d('0x20')]=_0x1f97f3;if(_0x58a63e[_0x319d('0x33')][_0x319d('0x42')]){_0x379501[_0x319d('0x43')]=[{'all':!![]}];}return db[_0x319d('0x2e')]['findAll'](_0x379501);})[_0x319d('0x27')](function(_0xacd662){_0x41d284[_0x319d('0x44')]=_0xacd662;return _0x41d284;})[_0x319d('0x27')](respondWithFilteredResult(_0x51b180,_0x379501))['catch'](handleError(_0x51b180,null));};exports[_0x319d('0x45')]=function(_0x5838fa,_0x3f21c6){var _0x44c9da={'raw':!![],'where':{'id':_0x5838fa[_0x319d('0x46')]['id']}},_0x45dc7d={};_0x45dc7d[_0x319d('0x32')]=_[_0x319d('0x47')](db[_0x319d('0x2e')][_0x319d('0x2f')]);_0x45dc7d[_0x319d('0x33')]=_[_0x319d('0x47')](_0x5838fa['query']);_0x45dc7d[_0x319d('0x3c')]=_[_0x319d('0x34')](_0x45dc7d[_0x319d('0x32')],_0x45dc7d[_0x319d('0x33')]);_0x44c9da[_0x319d('0x35')]=_['intersection'](_0x45dc7d[_0x319d('0x32')],qs[_0x319d('0x36')](_0x5838fa[_0x319d('0x33')][_0x319d('0x36')]));_0x44c9da['attributes']=_0x44c9da[_0x319d('0x35')][_0x319d('0x37')]?_0x44c9da[_0x319d('0x35')]:_0x45dc7d[_0x319d('0x32')];if(_0x5838fa['query'][_0x319d('0x42')]){_0x44c9da['include']=[{'all':!![]}];}_0x44c9da=_[_0x319d('0x41')]({},_0x44c9da,_0x5838fa[_0x319d('0x48')]);return db[_0x319d('0x2e')]['find'](_0x44c9da)[_0x319d('0x27')](handleEntityNotFound(_0x3f21c6,null))['then'](respondWithResult(_0x3f21c6,null))['catch'](handleError(_0x3f21c6,null));};exports[_0x319d('0x49')]=function(_0x511e5c,_0x478ddf){return db['SalesforceField'][_0x319d('0x49')](_0x511e5c[_0x319d('0x4a')],{})[_0x319d('0x27')](respondWithResult(_0x478ddf,0xc9))[_0x319d('0x4b')](handleError(_0x478ddf,null));};exports[_0x319d('0x25')]=function(_0x2dcf3b,_0x39fbb7){if(_0x2dcf3b[_0x319d('0x4a')]['id']){delete _0x2dcf3b[_0x319d('0x4a')]['id'];}return db[_0x319d('0x2e')]['find']({'where':{'id':_0x2dcf3b[_0x319d('0x46')]['id']}})[_0x319d('0x27')](handleEntityNotFound(_0x39fbb7,null))['then'](saveUpdates(_0x2dcf3b[_0x319d('0x4a')],null))[_0x319d('0x27')](respondWithResult(_0x39fbb7,null))['catch'](handleError(_0x39fbb7,null));};exports[_0x319d('0x26')]=function(_0x1cdbdb,_0x34485d){return db[_0x319d('0x2e')][_0x319d('0x4c')]({'where':{'id':_0x1cdbdb['params']['id']}})['then'](handleEntityNotFound(_0x34485d,null))[_0x319d('0x27')](removeEntity(_0x34485d,null))[_0x319d('0x4b')](handleError(_0x34485d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7e0bd1d..c7fd184 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 _0x405e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','FieldId'];(function(_0x5b2618,_0x57d45c){var _0x5cd269=function(_0x5d9d24){while(--_0x5d9d24){_0x5b2618['push'](_0x5b2618['shift']());}};_0x5cd269(++_0x57d45c);}(_0x405e,0x90));var _0xe405=function(_0x472f28,_0x240299){_0x472f28=_0x472f28-0x0;var _0xf5c412=_0x405e[_0x472f28];return _0xf5c412;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe405('0x0'))(_0xe405('0x1'));var moment=require(_0xe405('0x2'));var BPromise=require(_0xe405('0x3'));var rp=require(_0xe405('0x4'));var fs=require('fs');var path=require(_0xe405('0x5'));var rimraf=require(_0xe405('0x6'));var config=require('../../config/environment');var attributes=require(_0xe405('0x7'));module['exports']=function(_0xce6a68,_0x38f961){return _0xce6a68[_0xe405('0x8')](_0xe405('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xe405('0xa'),'fields':['idField',_0xe405('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9777=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','api','bluebird'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9777,0x8c));var _0x7977=function(_0x5de7fe,_0x147f0f){_0x5de7fe=_0x5de7fe-0x0;var _0x389a5b=_0x9777[_0x5de7fe];return _0x389a5b;};'use strict';var _=require('lodash');var util=require(_0x7977('0x0'));var logger=require('../../config/logger')(_0x7977('0x1'));var moment=require('moment');var BPromise=require(_0x7977('0x2'));var rp=require(_0x7977('0x3'));var fs=require('fs');var path=require(_0x7977('0x4'));var rimraf=require(_0x7977('0x5'));var config=require('../../config/environment');var attributes=require(_0x7977('0x6'));module[_0x7977('0x7')]=function(_0x41ae1a,_0x1d9aad){return _0x41ae1a[_0x7977('0x8')](_0x7977('0x9'),attributes,{'tableName':_0x7977('0xa'),'paranoid':![],'indexes':[{'name':_0x7977('0xb'),'fields':['idField',_0x7977('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index bf74935..edd8dd7 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 _0x3149=['error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x3149,0xcc));var _0x9314=function(_0x455cd2,_0x4e3835){_0x455cd2=_0x455cd2-0x0;var _0xa0d5ed=_0x3149[_0x455cd2];return _0xa0d5ed;};'use strict';var _=require(_0x9314('0x0'));var util=require('util');var moment=require(_0x9314('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9314('0x2'));var db=require(_0x9314('0x3'))['db'];var utils=require(_0x9314('0x4'));var logger=require(_0x9314('0x5'))(_0x9314('0x6'));var config=require('../../config/environment');var jayson=require(_0x9314('0x7'));var client=jayson[_0x9314('0x8')][_0x9314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2227a4,_0x295146,_0x42fba3){return new BPromise(function(_0xf0f613,_0x79e55a){return client['request'](_0x2227a4,_0x42fba3)[_0x9314('0xa')](function(_0x144e1f){logger['info'](_0x9314('0xb'),_0x295146,_0x9314('0xc'));logger[_0x9314('0xd')](_0x9314('0xe'),_0x295146,_0x9314('0xc'),JSON[_0x9314('0xf')](_0x144e1f));if(_0x144e1f[_0x9314('0x10')]){if(_0x144e1f[_0x9314('0x10')][_0x9314('0x11')]===0x1f4){logger[_0x9314('0x10')](_0x9314('0xb'),_0x295146,_0x144e1f[_0x9314('0x10')][_0x9314('0x12')]);return _0x79e55a(_0x144e1f[_0x9314('0x10')][_0x9314('0x12')]);}logger[_0x9314('0x10')](_0x9314('0xb'),_0x295146,_0x144e1f[_0x9314('0x10')][_0x9314('0x12')]);return _0xf0f613(_0x144e1f['error'][_0x9314('0x12')]);}else{logger[_0x9314('0x13')](_0x9314('0xb'),_0x295146,_0x9314('0xc'));_0xf0f613(_0x144e1f[_0x9314('0x14')]['message']);}})[_0x9314('0x15')](function(_0xd61b17){logger[_0x9314('0x10')](_0x9314('0xb'),_0x295146,_0xd61b17);_0x79e55a(_0xd61b17);});});} \ No newline at end of file +var _0x9cc3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x13609c,_0x460110){var _0x1dff06=function(_0x1fb7a0){while(--_0x1fb7a0){_0x13609c['push'](_0x13609c['shift']());}};_0x1dff06(++_0x460110);}(_0x9cc3,0x135));var _0x39cc=function(_0xea1caa,_0x29cc77){_0xea1caa=_0xea1caa-0x0;var _0x384ec8=_0x9cc3[_0xea1caa];return _0x384ec8;};'use strict';var _=require(_0x39cc('0x0'));var util=require(_0x39cc('0x1'));var moment=require('moment');var BPromise=require(_0x39cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39cc('0x3'));var db=require(_0x39cc('0x4'))['db'];var utils=require(_0x39cc('0x5'));var logger=require(_0x39cc('0x6'))(_0x39cc('0x7'));var config=require(_0x39cc('0x8'));var jayson=require(_0x39cc('0x9'));var client=jayson[_0x39cc('0xa')][_0x39cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1717be,_0x22cf94,_0x10edba){return new BPromise(function(_0x43e926,_0x304498){return client[_0x39cc('0xc')](_0x1717be,_0x10edba)[_0x39cc('0xd')](function(_0x37a9f4){logger[_0x39cc('0xe')](_0x39cc('0xf'),_0x22cf94,_0x39cc('0x10'));logger[_0x39cc('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x22cf94,_0x39cc('0x10'),JSON[_0x39cc('0x12')](_0x37a9f4));if(_0x37a9f4[_0x39cc('0x13')]){if(_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x14')]===0x1f4){logger[_0x39cc('0x13')](_0x39cc('0xf'),_0x22cf94,_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x15')]);return _0x304498(_0x37a9f4[_0x39cc('0x13')]['message']);}logger[_0x39cc('0x13')]('SalesforceField,\x20%s,\x20%s',_0x22cf94,_0x37a9f4['error']['message']);return _0x43e926(_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x15')]);}else{logger['info'](_0x39cc('0xf'),_0x22cf94,_0x39cc('0x10'));_0x43e926(_0x37a9f4[_0x39cc('0x16')]['message']);}})[_0x39cc('0x17')](function(_0x1bbe6e){logger[_0x39cc('0x13')](_0x39cc('0xf'),_0x22cf94,_0x1bbe6e);_0x304498(_0x1bbe6e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1d88dac..3e9c3a4 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 _0xa87e=['isAuthenticated','/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa87e,0x173));var _0xea87=function(_0x1567fb,_0x12b4ff){_0x1567fb=_0x1567fb-0x0;var _0x118203=_0xa87e[_0x1567fb];return _0x118203;};'use strict';var multer=require('multer');var util=require(_0xea87('0x0'));var path=require(_0xea87('0x1'));var timeout=require(_0xea87('0x2'));var express=require('express');var router=express[_0xea87('0x3')]();var fs_extra=require(_0xea87('0x4'));var auth=require(_0xea87('0x5'));var interaction=require(_0xea87('0x6'));var config=require(_0xea87('0x7'));var controller=require('./intServicenowAccount.controller');router[_0xea87('0x8')]('/',auth[_0xea87('0x9')](),controller['index']);router[_0xea87('0x8')](_0xea87('0xa'),auth[_0xea87('0x9')](),controller[_0xea87('0xb')]);router[_0xea87('0x8')]('/:id/configurations',auth[_0xea87('0x9')](),controller[_0xea87('0xc')]);router['get'](_0xea87('0xd'),auth[_0xea87('0x9')](),controller['getFields']);router['post']('/',auth[_0xea87('0x9')](),controller[_0xea87('0xe')]);router[_0xea87('0xf')](_0xea87('0x10'),auth[_0xea87('0x9')](),controller['addConfiguration']);router['put'](_0xea87('0xa'),auth[_0xea87('0x9')](),controller['update']);router[_0xea87('0x11')](_0xea87('0xa'),auth['isAuthenticated'](),controller[_0xea87('0x12')]);module[_0xea87('0x13')]=router; \ No newline at end of file +var _0xcd1a=['/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x2ac622,_0x5a31b9){var _0x500fce=function(_0x18b7ef){while(--_0x18b7ef){_0x2ac622['push'](_0x2ac622['shift']());}};_0x500fce(++_0x5a31b9);}(_0xcd1a,0x115));var _0xacd1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcd1a[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var path=require(_0xacd1('0x2'));var timeout=require('connect-timeout');var express=require(_0xacd1('0x3'));var router=express[_0xacd1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xacd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xacd1('0x6'));var controller=require(_0xacd1('0x7'));router[_0xacd1('0x8')]('/',auth[_0xacd1('0x9')](),controller[_0xacd1('0xa')]);router['get'](_0xacd1('0xb'),auth[_0xacd1('0x9')](),controller[_0xacd1('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xacd1('0xd'),auth[_0xacd1('0x9')](),controller[_0xacd1('0xe')]);router['post']('/',auth[_0xacd1('0x9')](),controller[_0xacd1('0xf')]);router[_0xacd1('0x10')](_0xacd1('0x11'),auth[_0xacd1('0x9')](),controller[_0xacd1('0x12')]);router[_0xacd1('0x13')](_0xacd1('0xb'),auth[_0xacd1('0x9')](),controller[_0xacd1('0x14')]);router[_0xacd1('0x15')]('/:id',auth[_0xacd1('0x9')](),controller[_0xacd1('0x16')]);module[_0xacd1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4cd06ed..01ebf08 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 _0xcd29=['STRING','username','exports'];(function(_0x543d62,_0x4c8e8e){var _0x1fe47b=function(_0x14991f){while(--_0x14991f){_0x543d62['push'](_0x543d62['shift']());}};_0x1fe47b(++_0x4c8e8e);}(_0xcd29,0x161));var _0x9cd2=function(_0x4a27d8,_0x1c8f65){_0x4a27d8=_0x4a27d8-0x0;var _0x5a0b4f=_0xcd29[_0x4a27d8];return _0x5a0b4f;};'use strict';var Sequelize=require('sequelize');module[_0x9cd2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9cd2('0x1')]},'username':{'type':Sequelize[_0x9cd2('0x1')],'unique':_0x9cd2('0x2')},'password':{'type':Sequelize[_0x9cd2('0x1')]},'email':{'type':Sequelize[_0x9cd2('0x1')]},'remoteUri':{'type':Sequelize[_0x9cd2('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x9cd2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa942=['sequelize','exports','STRING','remoteUri'];(function(_0x38192c,_0x231e41){var _0x31d64e=function(_0x579a6e){while(--_0x579a6e){_0x38192c['push'](_0x38192c['shift']());}};_0x31d64e(++_0x231e41);}(_0xa942,0x16c));var _0x2a94=function(_0x529fb3,_0x835195){_0x529fb3=_0x529fb3-0x0;var _0x311379=_0xa942[_0x529fb3];return _0x311379;};'use strict';var Sequelize=require(_0x2a94('0x0'));module[_0x2a94('0x1')]={'name':{'type':Sequelize[_0x2a94('0x2')]},'description':{'type':Sequelize[_0x2a94('0x2')]},'username':{'type':Sequelize[_0x2a94('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2a94('0x2')]},'email':{'type':Sequelize[_0x2a94('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2a94('0x3')},'serverUrl':{'type':Sequelize[_0x2a94('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 316eb05..f3b4d31 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 _0xd75a=['ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','made_sla','caused_by','watch_list','upon_reject','child_incidents','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','delivery_plan','impact','active','priority','rfc','time_worked','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','assignment_group','business_stc','description','calendar_duration','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','all','log','TCL:\x20_object','label','push','concat','ServiceNow\x20error:\x20','test','error','Wrong\x20credentials','statusCode','true','False','false','inactive','value','eml-format','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','status','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects'];(function(_0x302077,_0x42c344){var _0x169297=function(_0x37abb4){while(--_0x37abb4){_0x302077['push'](_0x302077['shift']());}};_0x169297(++_0x42c344);}(_0xd75a,0x112));var _0xad75=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd75a[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xad75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad75('0x1'));var rp=require('request-promise');var moment=require(_0xad75('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad75('0x3'));var path=require('path');var sox=require(_0xad75('0x4'));var csv=require(_0xad75('0x5'));var ejs=require(_0xad75('0x6'));var fs=require('fs');var fs_extra=require(_0xad75('0x7'));var _=require('lodash');var squel=require(_0xad75('0x8'));var crypto=require(_0xad75('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad75('0xa'));var toCsv=require(_0xad75('0x5'));var querystring=require('querystring');var Papa=require(_0xad75('0xb'));var Redis=require('ioredis');var authService=require(_0xad75('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xad75('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad75('0xe'))(_0xad75('0xf'));var utils=require(_0xad75('0x10'));var config=require(_0xad75('0x11'));var licenseUtil=require(_0xad75('0x12'));var db=require(_0xad75('0x13'))['db'];var integrations=require(_0xad75('0x14'));function respondWithStatusCode(_0x1c19fb,_0x179dce){_0x179dce=_0x179dce||0xcc;return function(_0x5f4251){if(_0x5f4251){return _0x1c19fb['sendStatus'](_0x179dce);}return _0x1c19fb['status'](_0x179dce)['end']();};}function respondWithResult(_0x3c85f0,_0x22b9ad){_0x22b9ad=_0x22b9ad||0xc8;return function(_0x3236ca){if(_0x3236ca){return _0x3c85f0['status'](_0x22b9ad)[_0xad75('0x15')](_0x3236ca);}};}function respondWithFilteredResult(_0x5bd06a,_0x3f6832){return function(_0xa8b77e){if(_0xa8b77e){var _0x4428dc=typeof _0x3f6832[_0xad75('0x16')]===_0xad75('0x17')&&typeof _0x3f6832[_0xad75('0x18')]===_0xad75('0x17');var _0xf4f36d=_0xa8b77e[_0xad75('0x19')];var _0x574061=_0x4428dc?0x0:_0x3f6832[_0xad75('0x16')];var _0x50a91d=_0x4428dc?_0xa8b77e['count']:_0x3f6832[_0xad75('0x16')]+_0x3f6832[_0xad75('0x18')];var _0x3b16aa;if(_0x50a91d>=_0xf4f36d){_0x50a91d=_0xf4f36d;_0x3b16aa=0xc8;}else{_0x3b16aa=0xce;}_0x5bd06a['status'](_0x3b16aa);return _0x5bd06a['set'](_0xad75('0x1a'),_0x574061+'-'+_0x50a91d+'/'+_0xf4f36d)['json'](_0xa8b77e);}return null;};}function patchUpdates(_0x58eace){return function(_0x4f7cc6){try{jsonpatch[_0xad75('0x1b')](_0x4f7cc6,_0x58eace,!![]);}catch(_0x2440b4){return BPromise[_0xad75('0x1c')](_0x2440b4);}return _0x4f7cc6['save']();};}function saveUpdates(_0x41d808,_0x234c0b){return function(_0x3aa525){if(_0x3aa525){return _0x3aa525[_0xad75('0x1d')](_0x41d808)[_0xad75('0x1e')](function(_0x244885){return _0x244885;});}return null;};}function removeEntity(_0x17cd2f,_0x33313f){return function(_0x5eefe5){if(_0x5eefe5){return _0x5eefe5['destroy']()['then'](function(){_0x17cd2f[_0xad75('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14dc4d,_0x29588e){return function(_0x4ff2e5){if(!_0x4ff2e5){_0x14dc4d[_0xad75('0x20')](0x194);}return _0x4ff2e5;};}function handleError(_0x5028ca,_0x130fb7){_0x130fb7=_0x130fb7||0x1f4;return function(_0x23b69e){logger['error'](_0x23b69e[_0xad75('0x21')]);if(_0x23b69e[_0xad75('0x22')]){delete _0x23b69e[_0xad75('0x22')];}_0x5028ca[_0xad75('0x1f')](_0x130fb7)[_0xad75('0x23')](_0x23b69e);};}exports[_0xad75('0x24')]=function(_0x2f0344,_0x4e6964){var _0x59d5b0={},_0x1b2d86={},_0x2d5dd7={'count':0x0,'rows':[]};var _0x3297f9=_[_0xad75('0x25')](db['ServicenowAccount'][_0xad75('0x26')],function(_0x953b99){return{'name':_0x953b99[_0xad75('0x27')],'type':_0x953b99['type']['key']};});_0x1b2d86['model']=_[_0xad75('0x25')](_0x3297f9,_0xad75('0x22'));_0x1b2d86[_0xad75('0x28')]=_['keys'](_0x2f0344[_0xad75('0x28')]);_0x1b2d86[_0xad75('0x29')]=_[_0xad75('0x2a')](_0x1b2d86['model'],_0x1b2d86[_0xad75('0x28')]);_0x59d5b0['attributes']=_['intersection'](_0x1b2d86[_0xad75('0x2b')],qs[_0xad75('0x2c')](_0x2f0344[_0xad75('0x28')][_0xad75('0x2c')]));_0x59d5b0['attributes']=_0x59d5b0[_0xad75('0x2d')][_0xad75('0x2e')]?_0x59d5b0[_0xad75('0x2d')]:_0x1b2d86[_0xad75('0x2b')];if(!_0x2f0344[_0xad75('0x28')][_0xad75('0x2f')](_0xad75('0x30'))){_0x59d5b0[_0xad75('0x18')]=qs[_0xad75('0x18')](_0x2f0344['query'][_0xad75('0x18')]);_0x59d5b0['offset']=qs[_0xad75('0x16')](_0x2f0344[_0xad75('0x28')][_0xad75('0x16')]);}_0x59d5b0[_0xad75('0x31')]=qs[_0xad75('0x32')](_0x2f0344['query'][_0xad75('0x32')]);_0x59d5b0['where']=qs['filters'](_['pick'](_0x2f0344[_0xad75('0x28')],_0x1b2d86[_0xad75('0x29')]),_0x3297f9);if(_0x2f0344[_0xad75('0x28')]['filter']){_0x59d5b0[_0xad75('0x33')]=_[_0xad75('0x34')](_0x59d5b0[_0xad75('0x33')],{'$or':_['map'](_0x3297f9,function(_0x484842){if(_0x484842[_0xad75('0x35')]!==_0xad75('0x36')){var _0x1fe8fc={};_0x1fe8fc[_0x484842[_0xad75('0x22')]]={'$like':'%'+_0x2f0344['query'][_0xad75('0x37')]+'%'};return _0x1fe8fc;}})});}_0x59d5b0=_[_0xad75('0x34')]({},_0x59d5b0,_0x2f0344[_0xad75('0x38')]);var _0x5eae0e={'where':_0x59d5b0[_0xad75('0x33')]};return db[_0xad75('0x39')][_0xad75('0x19')](_0x5eae0e)[_0xad75('0x1e')](function(_0x5bc3d7){_0x2d5dd7['count']=_0x5bc3d7;if(_0x2f0344['query'][_0xad75('0x3a')]){_0x59d5b0[_0xad75('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xad75('0x3c')](_0x59d5b0);})[_0xad75('0x1e')](function(_0x4f7932){_0x2d5dd7[_0xad75('0x3d')]=_0x4f7932;return _0x2d5dd7;})['then'](respondWithFilteredResult(_0x4e6964,_0x59d5b0))['catch'](handleError(_0x4e6964,null));};exports[_0xad75('0x3e')]=function(_0x12f61b,_0xe68f88){var _0x3bbfc4={'raw':![],'where':{'id':_0x12f61b[_0xad75('0x3f')]['id']}},_0x124344={};_0x124344[_0xad75('0x2b')]=_[_0xad75('0x40')](db['ServicenowAccount'][_0xad75('0x26')]);_0x124344[_0xad75('0x28')]=_[_0xad75('0x40')](_0x12f61b[_0xad75('0x28')]);_0x124344[_0xad75('0x29')]=_[_0xad75('0x2a')](_0x124344[_0xad75('0x2b')],_0x124344['query']);_0x3bbfc4[_0xad75('0x2d')]=_['intersection'](_0x124344[_0xad75('0x2b')],qs[_0xad75('0x2c')](_0x12f61b['query']['fields']));_0x3bbfc4[_0xad75('0x2d')]=_0x3bbfc4[_0xad75('0x2d')][_0xad75('0x2e')]?_0x3bbfc4['attributes']:_0x124344[_0xad75('0x2b')];if(_0x12f61b['query']['includeAll']){_0x3bbfc4[_0xad75('0x3b')]=[{'all':!![]}];}_0x3bbfc4=_[_0xad75('0x34')]({},_0x3bbfc4,_0x12f61b['options']);return db['ServicenowAccount'][_0xad75('0x41')](_0x3bbfc4)[_0xad75('0x1e')](handleEntityNotFound(_0xe68f88,null))[_0xad75('0x1e')](respondWithResult(_0xe68f88,null))[_0xad75('0x42')](handleError(_0xe68f88,null));};exports['create']=function(_0x6f318c,_0x305369){return db['ServicenowAccount'][_0xad75('0x43')](_0x6f318c[_0xad75('0x44')],{})[_0xad75('0x1e')](respondWithResult(_0x305369,0xc9))[_0xad75('0x42')](handleError(_0x305369,null));};exports[_0xad75('0x1d')]=function(_0x13440f,_0x44014a){if(_0x13440f[_0xad75('0x44')]['id']){delete _0x13440f[_0xad75('0x44')]['id'];}return db[_0xad75('0x39')][_0xad75('0x41')]({'where':{'id':_0x13440f[_0xad75('0x3f')]['id']}})[_0xad75('0x1e')](handleEntityNotFound(_0x44014a,null))[_0xad75('0x1e')](saveUpdates(_0x13440f[_0xad75('0x44')],null))['then'](respondWithResult(_0x44014a,null))[_0xad75('0x42')](handleError(_0x44014a,null));};exports[_0xad75('0x45')]=function(_0x284019,_0x2b72bf){return db[_0xad75('0x39')][_0xad75('0x41')]({'where':{'id':_0x284019[_0xad75('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2b72bf,null))[_0xad75('0x1e')](removeEntity(_0x2b72bf,null))['catch'](handleError(_0x2b72bf,null));};exports['getConfigurations']=function(_0x2cb10c,_0x5f2e88,_0x610cac){var _0x16f461={};var _0x2240ed={};var _0x4db1a9;var _0x515712;return db['ServicenowAccount'][_0xad75('0x46')]({'where':{'id':_0x2cb10c[_0xad75('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5f2e88,null))[_0xad75('0x1e')](function(_0x4e9b1d){if(_0x4e9b1d){_0x4db1a9=_0x4e9b1d;_0x2240ed[_0xad75('0x2b')]=_[_0xad75('0x40')](db[_0xad75('0x47')][_0xad75('0x26')]);_0x2240ed['query']=_[_0xad75('0x40')](_0x2cb10c['query']);_0x2240ed[_0xad75('0x29')]=_['intersection'](_0x2240ed['model'],_0x2240ed['query']);_0x16f461['attributes']=_[_0xad75('0x2a')](_0x2240ed[_0xad75('0x2b')],qs[_0xad75('0x2c')](_0x2cb10c[_0xad75('0x28')][_0xad75('0x2c')]));_0x16f461[_0xad75('0x2d')]=_0x16f461[_0xad75('0x2d')]['length']?_0x16f461['attributes']:_0x2240ed['model'];_0x16f461[_0xad75('0x31')]=qs[_0xad75('0x32')](_0x2cb10c[_0xad75('0x28')][_0xad75('0x32')]);_0x16f461[_0xad75('0x33')]=qs[_0xad75('0x29')](_[_0xad75('0x48')](_0x2cb10c[_0xad75('0x28')],_0x2240ed[_0xad75('0x29')]));if(_0x2cb10c[_0xad75('0x28')][_0xad75('0x37')]){_0x16f461[_0xad75('0x33')]=_[_0xad75('0x34')](_0x16f461[_0xad75('0x33')],{'$or':_[_0xad75('0x25')](_0x16f461[_0xad75('0x2d')],function(_0x1995e9){var _0x59e53b={};_0x59e53b[_0x1995e9]={'$like':'%'+_0x2cb10c['query'][_0xad75('0x37')]+'%'};return _0x59e53b;})});}_0x16f461=_['merge']({},_0x16f461,_0x2cb10c['options']);return _0x4db1a9[_0xad75('0x49')](_0x16f461);}})[_0xad75('0x1e')](function(_0x43c8a6){if(_0x43c8a6){_0x515712=_0x43c8a6[_0xad75('0x2e')];if(!_0x2cb10c[_0xad75('0x28')][_0xad75('0x2f')](_0xad75('0x30'))){_0x16f461['limit']=qs['limit'](_0x2cb10c[_0xad75('0x28')]['limit']);_0x16f461[_0xad75('0x16')]=qs['offset'](_0x2cb10c[_0xad75('0x28')][_0xad75('0x16')]);}return _0x4db1a9[_0xad75('0x49')](_0x16f461);}})[_0xad75('0x1e')](function(_0xe43d3e){if(_0xe43d3e){return _0xe43d3e?{'count':_0x515712,'rows':_0xe43d3e}:null;}})[_0xad75('0x1e')](respondWithResult(_0x5f2e88,null))['catch'](handleError(_0x5f2e88,null));};exports[_0xad75('0x4a')]=function(_0x3a18f7,_0x41efda,_0x598ce1){if(_0x3a18f7[_0xad75('0x44')]['id']){delete _0x3a18f7[_0xad75('0x44')]['id'];}return db[_0xad75('0x39')][_0xad75('0x46')]({'where':{'id':_0x3a18f7['params']['id']}})[_0xad75('0x1e')](handleEntityNotFound(_0x41efda,null))[_0xad75('0x1e')](function(_0x39ae26){if(_0x39ae26){_0x3a18f7[_0xad75('0x44')]['AccountId']=_0x39ae26['id'];_0x3a18f7[_0xad75('0x44')]['Subjects']=integrations[_0xad75('0x4b')](_0x3a18f7[_0xad75('0x44')][_0xad75('0x4c')],_0x3a18f7[_0xad75('0x44')][_0xad75('0x35')]);_0x3a18f7['body'][_0xad75('0x4d')]=integrations[_0xad75('0x4e')](_0x3a18f7[_0xad75('0x44')]['channel'],_0x3a18f7['body'][_0xad75('0x35')]);return db[_0xad75('0x47')][_0xad75('0x43')](_0x3a18f7[_0xad75('0x44')],{'include':[{'model':db['ServicenowField'],'as':_0xad75('0x4f')},{'model':db[_0xad75('0x50')],'as':_0xad75('0x4d')}]});}return null;})[_0xad75('0x1e')](respondWithResult(_0x41efda,null))['catch'](handleError(_0x41efda,null));};exports[_0xad75('0x51')]=function(_0x47b179,_0x59d2bc,_0x140c47){var _0x447b4c=['made_sla',_0xad75('0x52'),_0xad75('0x53'),_0xad75('0x54'),_0xad75('0x55'),_0xad75('0x56'),_0xad75('0x57'),_0xad75('0x58'),_0xad75('0x59')];var _0x330d9a=['parent',_0xad75('0x5a'),_0xad75('0x5b'),_0xad75('0x5c'),_0xad75('0x5d'),'sys_updated_on',_0xad75('0x5e'),_0xad75('0x52'),'approval_history','number',_0xad75('0x5f'),_0xad75('0x60'),'opened_by',_0xad75('0x61'),_0xad75('0x62'),_0xad75('0x63'),'state','sys_created_by',_0xad75('0x53'),_0xad75('0x31'),_0xad75('0x64'),_0xad75('0x65'),'cmdb_ci',_0xad75('0x66'),_0xad75('0x67'),_0xad75('0x68'),'work_notes_list','business_service',_0xad75('0x69'),'sys_domain_path',_0xad75('0x6a'),_0xad75('0x6b'),'expected_start','opened_at',_0xad75('0x6c'),_0xad75('0x6d'),_0xad75('0x6e'),'reopened_time',_0xad75('0x6f'),_0xad75('0x70'),_0xad75('0x71'),_0xad75('0x54'),_0xad75('0x72'),'short_description',_0xad75('0x55'),_0xad75('0x73'),'delivery_task',_0xad75('0x74'),_0xad75('0x75'),_0xad75('0x76'),'additional_assignee_list',_0xad75('0x77'),_0xad75('0x78'),_0xad75('0x56'),'sys_class_name',_0xad75('0x79'),'closed_by','follow_up',_0xad75('0x7a'),_0xad75('0x7b'),_0xad75('0x7c'),_0xad75('0x7d'),'incident_state',_0xad75('0x7e'),'problem_id',_0xad75('0x7f'),_0xad75('0x80'),_0xad75('0x81'),_0xad75('0x82'),_0xad75('0x58'),_0xad75('0x83'),'sla_due',_0xad75('0x84'),_0xad75('0x85'),_0xad75('0x86'),_0xad75('0x87'),_0xad75('0x88'),_0xad75('0x89'),_0xad75('0x8a'),_0xad75('0x8b'),'correlation_id',_0xad75('0x8c'),'category'];var _0x56827f='';var _0x300dc7='';var _0x622ff3=[];var _0x3b8dbc='';var _0x429c80='';var _0x43ddeb=[];var _0x1cd720='';var _0x4007ea='';var _0x2aa2f5={};var _0x145132='';return db[_0xad75('0x39')][_0xad75('0x46')]({'where':{'id':_0x47b179[_0xad75('0x3f')]['id']},'attributes':['id',_0xad75('0x8d'),_0xad75('0x8e'),_0xad75('0x8f'),_0xad75('0x90'),_0xad75('0x91')]})['then'](handleEntityNotFound(_0x59d2bc,null))[_0xad75('0x1e')](function(_0x12c791){if(_0x12c791){_0x145132=_0x12c791[_0xad75('0x90')];var _0x5e6549=_0x145132[_0xad75('0x92')](-0x1);if(_0x5e6549==='/'){_0x145132=_0x145132[_0xad75('0x93')](0x0,_0x145132[_0xad75('0x94')](_0x5e6549));}_0x4007ea=util[_0xad75('0x95')](_0xad75('0x96'),_0x145132);_0x1cd720=util[_0xad75('0x95')](_0xad75('0x97'),_0x145132);_0x2aa2f5={'user':_0x12c791[_0xad75('0x8d')],'pass':_0x12c791['password']};var _0x54bee5={'method':_0xad75('0x98'),'uri':_0x4007ea+_0xad75('0x99'),'auth':_0x2aa2f5,'json':!![]};return rp(_0x54bee5);}})[_0xad75('0x1e')](function(_0x1cd388){if(_0x1cd388[_0xad75('0x9a')][_0xad75('0x2e')]>0x0){_0x56827f=_0x1cd388[_0xad75('0x9a')];}console['log'](_0xad75('0x9b'),_0x56827f);_0x43ddeb=[];_0x300dc7=Object[_0xad75('0x9c')]([],_0x56827f);_[_0xad75('0x9d')](_0x300dc7,function(_0x2c1812){return!_0x447b4c[_0xad75('0x9e')](_0x2c1812[_0xad75('0x22')]);});_0x300dc7[_0xad75('0x9f')](function(_0x256d61){var _0x76ab28=createFieldObject(_0x1cd720,_0x2aa2f5,_0x256d61[_0xad75('0xa0')],_0x256d61[_0xad75('0x22')],_0x256d61['label'],![]);_0x43ddeb['push'](_0x76ab28);});return Promise[_0xad75('0xa1')](_0x43ddeb);})['then'](function(_0x29ffaf){_0x622ff3=_0x29ffaf;_0x3b8dbc=Object[_0xad75('0x9c')]([],_0x56827f);console[_0xad75('0xa2')](_0xad75('0xa3'),_0x56827f);_[_0xad75('0x9d')](_0x3b8dbc,function(_0x4d3c38){return _0x330d9a[_0xad75('0x9e')](_0x4d3c38[_0xad75('0x22')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3b8dbc);_0x43ddeb=[];_0x3b8dbc['forEach'](function(_0x33fdfb){var _0x5684a1=createFieldObject(_0x1cd720,_0x2aa2f5,_0x33fdfb[_0xad75('0xa0')],_0x33fdfb[_0xad75('0x22')],_0x33fdfb[_0xad75('0xa4')],!![]);_0x43ddeb[_0xad75('0xa5')](_0x5684a1);});return Promise[_0xad75('0xa1')](_0x43ddeb);})['then'](function(_0x3d80f6){_0x429c80=_0x3d80f6;var _0x117dae=_0x622ff3[_0xad75('0xa6')](_0x429c80);return{'count':_0x117dae[_0xad75('0x2e')],'rows':_0x117dae};})[_0xad75('0x1e')](respondWithResult(_0x59d2bc,null))[_0xad75('0x42')](function(_0x32d6b0){console[_0xad75('0xa2')](_0xad75('0xa7')+_0x32d6b0);var _0x3e10eb=_0x47b179[_0xad75('0x28')][_0xad75('0xa8')]?0x1f4:_0x32d6b0['statusCode']||0x1f4;logger[_0xad75('0xa9')](_0x32d6b0[_0xad75('0x21')]);delete _0x32d6b0[_0xad75('0x22')];if(_0x3e10eb===0x191){_0x3e10eb=0x190;}_0x59d2bc[_0xad75('0x1f')](_0x3e10eb)[_0xad75('0x23')](_0x47b179[_0xad75('0x28')][_0xad75('0xa8')]?{'message':_0xad75('0xaa'),'statusCode':_0x32d6b0[_0xad75('0xab')]}:_0x32d6b0);});};function createFieldObject(_0x3170a8,_0x5144ca,_0x4032de,_0x2a90f0,_0xf091b3,_0x3e7213){return new Promise(function(_0x21ea58,_0x5c2714){var _0x2c31db={'id':_0x2a90f0,'name':_0xf091b3,'custom':_0x3e7213};if(_0x4032de==='boolean'){_0x2c31db[_0xad75('0x38')]=[{'name':'True','value':_0xad75('0xac')},{'name':_0xad75('0xad'),'value':_0xad75('0xae')}];_0x21ea58(_0x2c31db);}else{var _0x7c3855={'method':'GET','uri':_0x3170a8+'sys_choice?sysparm_query=name=incident^element='+_0x2a90f0,'auth':_0x5144ca,'json':!![]};return rp(_0x7c3855)[_0xad75('0x1e')](function(_0x44b453){var _0x318651=[];if(_0x44b453[_0xad75('0x9a')]['length']>0x0){_0x44b453[_0xad75('0x9a')][_0xad75('0x9f')](function(_0x4f29ab){if(_0x4f29ab[_0xad75('0xaf')]===_0xad75('0xae')){var _0x55c9ed={'name':_0x4f29ab['label'],'value':_0x4f29ab[_0xad75('0xb0')]};_0x318651[_0xad75('0xa5')](_0x55c9ed);}});}_0x2c31db[_0xad75('0x38')]=_0x318651;if(_0x2c31db[_0xad75('0x38')][_0xad75('0x2e')]>0x0){_0x21ea58(_0x2c31db);}else{if(_0x3e7213==![]){_0x21ea58();}else{_0x21ea58(_0x2c31db);}}});}});} \ No newline at end of file +var _0xfcbf=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','ServicenowAccount','includeAll','include','rows','catch','show','params','create','body','update','find','findOne','ServicenowConfiguration','map','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','opened_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','location','username','password','email','slice','substring','lastIndexOf','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','label','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','ServiceNow\x20error:\x20','stack','test','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','name','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x177ac4,_0x62717){var _0x5c94af=function(_0x2bb2ab){while(--_0x2bb2ab){_0x177ac4['push'](_0x177ac4['shift']());}};_0x5c94af(++_0x62717);}(_0xfcbf,0x83));var _0xffcb=function(_0xe4aec9,_0x3000e9){_0xe4aec9=_0xe4aec9-0x0;var _0x5ba35f=_0xfcbf[_0xe4aec9];return _0x5ba35f;};'use strict';var emlformat=require(_0xffcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffcb('0x1'));var jsonpatch=require(_0xffcb('0x2'));var rp=require(_0xffcb('0x3'));var moment=require(_0xffcb('0x4'));var BPromise=require(_0xffcb('0x5'));var Mustache=require('mustache');var util=require(_0xffcb('0x6'));var path=require(_0xffcb('0x7'));var sox=require(_0xffcb('0x8'));var csv=require(_0xffcb('0x9'));var ejs=require(_0xffcb('0xa'));var fs=require('fs');var fs_extra=require(_0xffcb('0xb'));var _=require('lodash');var squel=require(_0xffcb('0xc'));var crypto=require(_0xffcb('0xd'));var jsforce=require(_0xffcb('0xe'));var deskjs=require(_0xffcb('0xf'));var toCsv=require(_0xffcb('0x9'));var querystring=require('querystring');var Papa=require(_0xffcb('0x10'));var Redis=require(_0xffcb('0x11'));var authService=require(_0xffcb('0x12'));var qs=require(_0xffcb('0x13'));var as=require(_0xffcb('0x14'));var hardwareService=require(_0xffcb('0x15'));var logger=require(_0xffcb('0x16'))(_0xffcb('0x17'));var utils=require(_0xffcb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xffcb('0x19'));var db=require(_0xffcb('0x1a'))['db'];var integrations=require(_0xffcb('0x1b'));function respondWithStatusCode(_0x280c2b,_0x143f3b){_0x143f3b=_0x143f3b||0xcc;return function(_0x22ef82){if(_0x22ef82){return _0x280c2b[_0xffcb('0x1c')](_0x143f3b);}return _0x280c2b[_0xffcb('0x1d')](_0x143f3b)[_0xffcb('0x1e')]();};}function respondWithResult(_0x244463,_0x1e757d){_0x1e757d=_0x1e757d||0xc8;return function(_0xb3e1e8){if(_0xb3e1e8){return _0x244463[_0xffcb('0x1d')](_0x1e757d)['json'](_0xb3e1e8);}};}function respondWithFilteredResult(_0x41f08c,_0x26c2a3){return function(_0x4bd55a){if(_0x4bd55a){var _0x37e755=typeof _0x26c2a3[_0xffcb('0x1f')]===_0xffcb('0x20')&&typeof _0x26c2a3[_0xffcb('0x21')]===_0xffcb('0x20');var _0x81cd8f=_0x4bd55a[_0xffcb('0x22')];var _0x4cab2a=_0x37e755?0x0:_0x26c2a3[_0xffcb('0x1f')];var _0x8186c3=_0x37e755?_0x4bd55a['count']:_0x26c2a3['offset']+_0x26c2a3[_0xffcb('0x21')];var _0xdf1e08;if(_0x8186c3>=_0x81cd8f){_0x8186c3=_0x81cd8f;_0xdf1e08=0xc8;}else{_0xdf1e08=0xce;}_0x41f08c['status'](_0xdf1e08);return _0x41f08c[_0xffcb('0x23')](_0xffcb('0x24'),_0x4cab2a+'-'+_0x8186c3+'/'+_0x81cd8f)[_0xffcb('0x25')](_0x4bd55a);}return null;};}function patchUpdates(_0x553a5c){return function(_0x21e990){try{jsonpatch['apply'](_0x21e990,_0x553a5c,!![]);}catch(_0x2f678c){return BPromise[_0xffcb('0x26')](_0x2f678c);}return _0x21e990[_0xffcb('0x27')]();};}function saveUpdates(_0x412e66,_0x10a74a){return function(_0x3c7822){if(_0x3c7822){return _0x3c7822['update'](_0x412e66)[_0xffcb('0x28')](function(_0x2810e7){return _0x2810e7;});}return null;};}function removeEntity(_0x3f2f7e,_0x24261c){return function(_0x7888d7){if(_0x7888d7){return _0x7888d7[_0xffcb('0x29')]()[_0xffcb('0x28')](function(){_0x3f2f7e[_0xffcb('0x1d')](0xcc)[_0xffcb('0x1e')]();});}};}function handleEntityNotFound(_0xeb7d39,_0x46cbc9){return function(_0x3bbc88){if(!_0x3bbc88){_0xeb7d39[_0xffcb('0x1c')](0x194);}return _0x3bbc88;};}function handleError(_0x43992b,_0x5d7641){_0x5d7641=_0x5d7641||0x1f4;return function(_0xad8607){logger[_0xffcb('0x2a')](_0xad8607['stack']);if(_0xad8607[_0xffcb('0x2b')]){delete _0xad8607[_0xffcb('0x2b')];}_0x43992b[_0xffcb('0x1d')](_0x5d7641)['send'](_0xad8607);};}exports[_0xffcb('0x2c')]=function(_0x232542,_0x4cb0e6){var _0x43fc83={},_0x508da3={},_0x2369bd={'count':0x0,'rows':[]};var _0x4af7f6=_['map'](db['ServicenowAccount'][_0xffcb('0x2d')],function(_0x44963b){return{'name':_0x44963b[_0xffcb('0x2e')],'type':_0x44963b[_0xffcb('0x2f')]['key']};});_0x508da3[_0xffcb('0x30')]=_['map'](_0x4af7f6,_0xffcb('0x2b'));_0x508da3[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x232542[_0xffcb('0x31')]);_0x508da3['filters']=_[_0xffcb('0x33')](_0x508da3[_0xffcb('0x30')],_0x508da3[_0xffcb('0x31')]);_0x43fc83[_0xffcb('0x34')]=_[_0xffcb('0x33')](_0x508da3[_0xffcb('0x30')],qs[_0xffcb('0x35')](_0x232542[_0xffcb('0x31')][_0xffcb('0x35')]));_0x43fc83[_0xffcb('0x34')]=_0x43fc83[_0xffcb('0x34')][_0xffcb('0x36')]?_0x43fc83[_0xffcb('0x34')]:_0x508da3[_0xffcb('0x30')];if(!_0x232542[_0xffcb('0x31')][_0xffcb('0x37')](_0xffcb('0x38'))){_0x43fc83['limit']=qs[_0xffcb('0x21')](_0x232542['query'][_0xffcb('0x21')]);_0x43fc83[_0xffcb('0x1f')]=qs[_0xffcb('0x1f')](_0x232542[_0xffcb('0x31')][_0xffcb('0x1f')]);}_0x43fc83[_0xffcb('0x39')]=qs[_0xffcb('0x3a')](_0x232542['query'][_0xffcb('0x3a')]);_0x43fc83['where']=qs[_0xffcb('0x3b')](_[_0xffcb('0x3c')](_0x232542[_0xffcb('0x31')],_0x508da3['filters']),_0x4af7f6);if(_0x232542['query'][_0xffcb('0x3d')]){_0x43fc83['where']=_[_0xffcb('0x3e')](_0x43fc83['where'],{'$or':_['map'](_0x4af7f6,function(_0x148014){if(_0x148014[_0xffcb('0x2f')]!==_0xffcb('0x3f')){var _0x19d836={};_0x19d836[_0x148014['name']]={'$like':'%'+_0x232542[_0xffcb('0x31')][_0xffcb('0x3d')]+'%'};return _0x19d836;}})});}_0x43fc83=_['merge']({},_0x43fc83,_0x232542[_0xffcb('0x40')]);var _0x2c24ad={'where':_0x43fc83[_0xffcb('0x41')]};return db[_0xffcb('0x42')][_0xffcb('0x22')](_0x2c24ad)['then'](function(_0x1ccf0c){_0x2369bd[_0xffcb('0x22')]=_0x1ccf0c;if(_0x232542[_0xffcb('0x31')][_0xffcb('0x43')]){_0x43fc83[_0xffcb('0x44')]=[{'all':!![]}];}return db[_0xffcb('0x42')]['findAll'](_0x43fc83);})[_0xffcb('0x28')](function(_0x15c82a){_0x2369bd[_0xffcb('0x45')]=_0x15c82a;return _0x2369bd;})['then'](respondWithFilteredResult(_0x4cb0e6,_0x43fc83))[_0xffcb('0x46')](handleError(_0x4cb0e6,null));};exports[_0xffcb('0x47')]=function(_0x4e2352,_0x49f4b3){var _0x19784f={'raw':![],'where':{'id':_0x4e2352[_0xffcb('0x48')]['id']}},_0x439a2f={};_0x439a2f[_0xffcb('0x30')]=_[_0xffcb('0x32')](db[_0xffcb('0x42')][_0xffcb('0x2d')]);_0x439a2f[_0xffcb('0x31')]=_['keys'](_0x4e2352[_0xffcb('0x31')]);_0x439a2f['filters']=_[_0xffcb('0x33')](_0x439a2f['model'],_0x439a2f[_0xffcb('0x31')]);_0x19784f['attributes']=_[_0xffcb('0x33')](_0x439a2f['model'],qs[_0xffcb('0x35')](_0x4e2352['query']['fields']));_0x19784f[_0xffcb('0x34')]=_0x19784f[_0xffcb('0x34')][_0xffcb('0x36')]?_0x19784f[_0xffcb('0x34')]:_0x439a2f[_0xffcb('0x30')];if(_0x4e2352[_0xffcb('0x31')]['includeAll']){_0x19784f[_0xffcb('0x44')]=[{'all':!![]}];}_0x19784f=_['merge']({},_0x19784f,_0x4e2352['options']);return db['ServicenowAccount']['find'](_0x19784f)[_0xffcb('0x28')](handleEntityNotFound(_0x49f4b3,null))[_0xffcb('0x28')](respondWithResult(_0x49f4b3,null))[_0xffcb('0x46')](handleError(_0x49f4b3,null));};exports[_0xffcb('0x49')]=function(_0xe8230d,_0x52859a){return db[_0xffcb('0x42')][_0xffcb('0x49')](_0xe8230d[_0xffcb('0x4a')],{})[_0xffcb('0x28')](respondWithResult(_0x52859a,0xc9))['catch'](handleError(_0x52859a,null));};exports[_0xffcb('0x4b')]=function(_0x292ce3,_0x5d6981){if(_0x292ce3[_0xffcb('0x4a')]['id']){delete _0x292ce3[_0xffcb('0x4a')]['id'];}return db['ServicenowAccount'][_0xffcb('0x4c')]({'where':{'id':_0x292ce3[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x5d6981,null))['then'](saveUpdates(_0x292ce3[_0xffcb('0x4a')],null))['then'](respondWithResult(_0x5d6981,null))[_0xffcb('0x46')](handleError(_0x5d6981,null));};exports['destroy']=function(_0x327aa0,_0x42c65e){return db[_0xffcb('0x42')][_0xffcb('0x4c')]({'where':{'id':_0x327aa0[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x42c65e,null))[_0xffcb('0x28')](removeEntity(_0x42c65e,null))[_0xffcb('0x46')](handleError(_0x42c65e,null));};exports['getConfigurations']=function(_0x4c6bb4,_0x49634a,_0x25ef51){var _0x52fee7={};var _0x205ec7={};var _0x49f1e4;var _0x2658bb;return db['ServicenowAccount'][_0xffcb('0x4d')]({'where':{'id':_0x4c6bb4[_0xffcb('0x48')]['id']}})['then'](handleEntityNotFound(_0x49634a,null))[_0xffcb('0x28')](function(_0x218418){if(_0x218418){_0x49f1e4=_0x218418;_0x205ec7[_0xffcb('0x30')]=_[_0xffcb('0x32')](db[_0xffcb('0x4e')]['rawAttributes']);_0x205ec7[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x4c6bb4[_0xffcb('0x31')]);_0x205ec7['filters']=_['intersection'](_0x205ec7[_0xffcb('0x30')],_0x205ec7[_0xffcb('0x31')]);_0x52fee7[_0xffcb('0x34')]=_['intersection'](_0x205ec7['model'],qs[_0xffcb('0x35')](_0x4c6bb4[_0xffcb('0x31')]['fields']));_0x52fee7[_0xffcb('0x34')]=_0x52fee7[_0xffcb('0x34')]['length']?_0x52fee7[_0xffcb('0x34')]:_0x205ec7[_0xffcb('0x30')];_0x52fee7[_0xffcb('0x39')]=qs[_0xffcb('0x3a')](_0x4c6bb4[_0xffcb('0x31')][_0xffcb('0x3a')]);_0x52fee7[_0xffcb('0x41')]=qs[_0xffcb('0x3b')](_[_0xffcb('0x3c')](_0x4c6bb4[_0xffcb('0x31')],_0x205ec7[_0xffcb('0x3b')]));if(_0x4c6bb4['query'][_0xffcb('0x3d')]){_0x52fee7['where']=_['merge'](_0x52fee7[_0xffcb('0x41')],{'$or':_[_0xffcb('0x4f')](_0x52fee7[_0xffcb('0x34')],function(_0xc6e3dd){var _0x14128f={};_0x14128f[_0xc6e3dd]={'$like':'%'+_0x4c6bb4[_0xffcb('0x31')]['filter']+'%'};return _0x14128f;})});}_0x52fee7=_['merge']({},_0x52fee7,_0x4c6bb4[_0xffcb('0x40')]);return _0x49f1e4[_0xffcb('0x50')](_0x52fee7);}})[_0xffcb('0x28')](function(_0x432088){if(_0x432088){_0x2658bb=_0x432088[_0xffcb('0x36')];if(!_0x4c6bb4['query'][_0xffcb('0x37')](_0xffcb('0x38'))){_0x52fee7[_0xffcb('0x21')]=qs['limit'](_0x4c6bb4[_0xffcb('0x31')][_0xffcb('0x21')]);_0x52fee7[_0xffcb('0x1f')]=qs[_0xffcb('0x1f')](_0x4c6bb4[_0xffcb('0x31')]['offset']);}return _0x49f1e4[_0xffcb('0x50')](_0x52fee7);}})['then'](function(_0x298c80){if(_0x298c80){return _0x298c80?{'count':_0x2658bb,'rows':_0x298c80}:null;}})[_0xffcb('0x28')](respondWithResult(_0x49634a,null))[_0xffcb('0x46')](handleError(_0x49634a,null));};exports[_0xffcb('0x51')]=function(_0xd9c379,_0x2f3277,_0x4a70aa){if(_0xd9c379['body']['id']){delete _0xd9c379['body']['id'];}return db[_0xffcb('0x42')][_0xffcb('0x4d')]({'where':{'id':_0xd9c379[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x2f3277,null))[_0xffcb('0x28')](function(_0x8d9860){if(_0x8d9860){_0xd9c379[_0xffcb('0x4a')]['AccountId']=_0x8d9860['id'];_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x52')]=integrations[_0xffcb('0x53')](_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x54')],_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x2f')]);_0xd9c379[_0xffcb('0x4a')]['Descriptions']=integrations[_0xffcb('0x55')](_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x54')],_0xd9c379[_0xffcb('0x4a')]['type']);return db['ServicenowConfiguration']['create'](_0xd9c379['body'],{'include':[{'model':db['ServicenowField'],'as':_0xffcb('0x52')},{'model':db[_0xffcb('0x56')],'as':_0xffcb('0x57')}]});}return null;})[_0xffcb('0x28')](respondWithResult(_0x2f3277,null))[_0xffcb('0x46')](handleError(_0x2f3277,null));};exports[_0xffcb('0x58')]=function(_0xee26ac,_0x5ceaf8,_0x19ecf8){var _0x46526b=['made_sla',_0xffcb('0x59'),_0xffcb('0x5a'),_0xffcb('0x5b'),_0xffcb('0x5c'),_0xffcb('0x5d'),'incident_state','severity',_0xffcb('0x5e')];var _0x30388d=[_0xffcb('0x5f'),_0xffcb('0x60'),_0xffcb('0x61'),_0xffcb('0x62'),_0xffcb('0x63'),_0xffcb('0x64'),_0xffcb('0x65'),_0xffcb('0x59'),_0xffcb('0x66'),_0xffcb('0x67'),'resolved_by','sys_updated_by',_0xffcb('0x68'),_0xffcb('0x69'),'sys_created_on','sys_domain',_0xffcb('0x6a'),_0xffcb('0x6b'),_0xffcb('0x5a'),_0xffcb('0x39'),_0xffcb('0x6c'),_0xffcb('0x6d'),_0xffcb('0x6e'),_0xffcb('0x6f'),_0xffcb('0x70'),_0xffcb('0x71'),_0xffcb('0x72'),_0xffcb('0x73'),_0xffcb('0x74'),'sys_domain_path',_0xffcb('0x75'),_0xffcb('0x76'),_0xffcb('0x77'),'opened_at',_0xffcb('0x78'),_0xffcb('0x79'),_0xffcb('0x7a'),'reopened_time',_0xffcb('0x7b'),_0xffcb('0x7c'),_0xffcb('0x7d'),'subcategory',_0xffcb('0x7e'),'short_description',_0xffcb('0x5c'),'correlation_display',_0xffcb('0x7f'),_0xffcb('0x80'),_0xffcb('0x81'),_0xffcb('0x82'),'additional_assignee_list',_0xffcb('0x83'),_0xffcb('0x84'),'notify',_0xffcb('0x85'),_0xffcb('0x86'),_0xffcb('0x87'),_0xffcb('0x88'),'parent_incident','sys_id','contact_type',_0xffcb('0x89'),_0xffcb('0x8a'),_0xffcb('0x8b'),_0xffcb('0x8c'),_0xffcb('0x8d'),'reassignment_count',_0xffcb('0x8e'),_0xffcb('0x8f'),_0xffcb('0x90'),_0xffcb('0x91'),'sla_due',_0xffcb('0x92'),_0xffcb('0x93'),_0xffcb('0x94'),'sys_mod_count','reopen_count',_0xffcb('0x95'),_0xffcb('0x96'),_0xffcb('0x97'),'correlation_id',_0xffcb('0x98'),_0xffcb('0x5e')];var _0x4ad487='';var _0x22d082='';var _0x259a77=[];var _0x3f179b='';var _0x330aa9='';var _0x2fde45=[];var _0x337a2c='';var _0x44a8d6='';var _0x5a387b={};var _0x1d952b='';return db[_0xffcb('0x42')][_0xffcb('0x4d')]({'where':{'id':_0xee26ac[_0xffcb('0x48')]['id']},'attributes':['id',_0xffcb('0x99'),_0xffcb('0x9a'),_0xffcb('0x9b'),'remoteUri','serverUrl']})[_0xffcb('0x28')](handleEntityNotFound(_0x5ceaf8,null))[_0xffcb('0x28')](function(_0x575757){if(_0x575757){_0x1d952b=_0x575757['remoteUri'];var _0x4a003e=_0x1d952b[_0xffcb('0x9c')](-0x1);if(_0x4a003e==='/'){_0x1d952b=_0x1d952b[_0xffcb('0x9d')](0x0,_0x1d952b[_0xffcb('0x9e')](_0x4a003e));}_0x44a8d6=util['format']('%s/api/now/doc/table/schema/',_0x1d952b);_0x337a2c=util['format'](_0xffcb('0x9f'),_0x1d952b);_0x5a387b={'user':_0x575757[_0xffcb('0x99')],'pass':_0x575757[_0xffcb('0x9a')]};var _0x5f5718={'method':_0xffcb('0xa0'),'uri':_0x44a8d6+_0xffcb('0xa1'),'auth':_0x5a387b,'json':!![]};return rp(_0x5f5718);}})['then'](function(_0x2656c0){if(_0x2656c0['result'][_0xffcb('0x36')]>0x0){_0x4ad487=_0x2656c0[_0xffcb('0xa2')];}console['log'](_0xffcb('0xa3'),_0x4ad487);_0x2fde45=[];_0x22d082=Object[_0xffcb('0xa4')]([],_0x4ad487);_['remove'](_0x22d082,function(_0x45d717){return!_0x46526b[_0xffcb('0xa5')](_0x45d717[_0xffcb('0x2b')]);});_0x22d082[_0xffcb('0xa6')](function(_0x250416){var _0xfa9d2e=createFieldObject(_0x337a2c,_0x5a387b,_0x250416['internalType'],_0x250416[_0xffcb('0x2b')],_0x250416[_0xffcb('0xa7')],![]);_0x2fde45['push'](_0xfa9d2e);});return Promise[_0xffcb('0xa8')](_0x2fde45);})[_0xffcb('0x28')](function(_0x18b37f){_0x259a77=_0x18b37f;_0x3f179b=Object[_0xffcb('0xa4')]([],_0x4ad487);console[_0xffcb('0xa9')](_0xffcb('0xaa'),_0x4ad487);_[_0xffcb('0xab')](_0x3f179b,function(_0x4959b6){return _0x30388d[_0xffcb('0xa5')](_0x4959b6[_0xffcb('0x2b')]);});console[_0xffcb('0xa9')](_0xffcb('0xac'),_0x3f179b);_0x2fde45=[];_0x3f179b['forEach'](function(_0x5c7ac2){var _0x367bca=createFieldObject(_0x337a2c,_0x5a387b,_0x5c7ac2[_0xffcb('0xad')],_0x5c7ac2[_0xffcb('0x2b')],_0x5c7ac2[_0xffcb('0xa7')],!![]);_0x2fde45[_0xffcb('0xae')](_0x367bca);});return Promise['all'](_0x2fde45);})[_0xffcb('0x28')](function(_0x4f2711){_0x330aa9=_0x4f2711;var _0x5ed5df=_0x259a77[_0xffcb('0xaf')](_0x330aa9);return{'count':_0x5ed5df[_0xffcb('0x36')],'rows':_0x5ed5df};})['then'](respondWithResult(_0x5ceaf8,null))[_0xffcb('0x46')](function(_0x3b7a6d){console[_0xffcb('0xa9')](_0xffcb('0xb0')+_0x3b7a6d);var _0x1fda9e=_0xee26ac[_0xffcb('0x31')]['test']?0x1f4:_0x3b7a6d['statusCode']||0x1f4;logger['error'](_0x3b7a6d[_0xffcb('0xb1')]);delete _0x3b7a6d[_0xffcb('0x2b')];if(_0x1fda9e===0x191){_0x1fda9e=0x190;}_0x5ceaf8[_0xffcb('0x1d')](_0x1fda9e)['send'](_0xee26ac[_0xffcb('0x31')][_0xffcb('0xb2')]?{'message':_0xffcb('0xb3'),'statusCode':_0x3b7a6d['statusCode']}:_0x3b7a6d);});};function createFieldObject(_0x46976f,_0x1cfee6,_0x47c0e7,_0x1404a6,_0x5730a3,_0x124385){return new Promise(function(_0x2b38df,_0x5937bc){var _0x4383aa={'id':_0x1404a6,'name':_0x5730a3,'custom':_0x124385};if(_0x47c0e7===_0xffcb('0xb4')){_0x4383aa[_0xffcb('0x40')]=[{'name':_0xffcb('0xb5'),'value':_0xffcb('0xb6')},{'name':'False','value':_0xffcb('0xb7')}];_0x2b38df(_0x4383aa);}else{var _0x4d3da5={'method':_0xffcb('0xa0'),'uri':_0x46976f+_0xffcb('0xb8')+_0x1404a6,'auth':_0x1cfee6,'json':!![]};return rp(_0x4d3da5)['then'](function(_0x11ce4e){var _0xd50ee8=[];if(_0x11ce4e[_0xffcb('0xa2')]['length']>0x0){_0x11ce4e[_0xffcb('0xa2')][_0xffcb('0xa6')](function(_0x40dbda){if(_0x40dbda[_0xffcb('0xb9')]===_0xffcb('0xb7')){var _0x38359a={'name':_0x40dbda[_0xffcb('0xa7')],'value':_0x40dbda['value']};_0xd50ee8[_0xffcb('0xae')](_0x38359a);}});}_0x4383aa[_0xffcb('0x40')]=_0xd50ee8;if(_0x4383aa[_0xffcb('0x40')][_0xffcb('0x36')]>0x0){_0x2b38df(_0x4383aa);}else{if(_0x124385==![]){_0x2b38df();}else{_0x2b38df(_0x4383aa);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index dc04cb4..ecae5f7 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x391d28,_0x4d7d2b){var _0x24ee2f=function(_0x268251){while(--_0x268251){_0x391d28['push'](_0x391d28['shift']());}};_0x24ee2f(++_0x4d7d2b);}(_0xba34,0x119));var _0x4ba3=function(_0x14728b,_0x4a8d4e){_0x14728b=_0x14728b-0x0;var _0x23db2d=_0xba34[_0x14728b];return _0x23db2d;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x450d2d,_0x197f8b){var _0x36fdb4=function(_0x192953){while(--_0x192953){_0x450d2d['push'](_0x450d2d['shift']());}};_0x36fdb4(++_0x197f8b);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x6a2898,_0x35e341){_0x6a2898=_0x6a2898-0x0;var _0x3a9612=_0xc1c6[_0x6a2898];return _0x3a9612;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f89dbb4..7156888 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 _0x1677=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','debug','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1677,0x16e));var _0x7167=function(_0x1549ae,_0x4ea436){_0x1549ae=_0x1549ae-0x0;var _0x141302=_0x1677[_0x1549ae];return _0x141302;};'use strict';var _=require(_0x7167('0x0'));var util=require('util');var moment=require(_0x7167('0x1'));var BPromise=require(_0x7167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7167('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7167('0x4'));var logger=require(_0x7167('0x5'))(_0x7167('0x6'));var config=require(_0x7167('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7167('0x8')][_0x7167('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x415b4d,_0x34eeec,_0x4322b2){return new BPromise(function(_0x38f647,_0x4be6ee){return client[_0x7167('0xa')](_0x415b4d,_0x4322b2)[_0x7167('0xb')](function(_0x80e827){logger[_0x7167('0xc')](_0x7167('0xd'),_0x34eeec,_0x7167('0xe'));logger['debug'](_0x7167('0xf'),_0x34eeec,_0x7167('0xe'),JSON[_0x7167('0x10')](_0x80e827));if(_0x80e827[_0x7167('0x11')]){if(_0x80e827['error']['code']===0x1f4){logger[_0x7167('0x11')](_0x7167('0xd'),_0x34eeec,_0x80e827[_0x7167('0x11')][_0x7167('0x12')]);return _0x4be6ee(_0x80e827[_0x7167('0x11')]['message']);}logger[_0x7167('0x11')](_0x7167('0xd'),_0x34eeec,_0x80e827[_0x7167('0x11')][_0x7167('0x12')]);return _0x38f647(_0x80e827[_0x7167('0x11')][_0x7167('0x12')]);}else{logger['info'](_0x7167('0xd'),_0x34eeec,'request\x20sent');_0x38f647(_0x80e827[_0x7167('0x13')]['message']);}})[_0x7167('0x14')](function(_0x3716e7){logger['error'](_0x7167('0xd'),_0x34eeec,_0x3716e7);_0x4be6ee(_0x3716e7);});});}exports['GetServicenowAccount']=function(_0x12abd4){var _0x1a3de0=this;return new Promise(function(_0x53250c,_0x5ea71e){return db['ServicenowAccount'][_0x7167('0x15')]({'raw':_0x12abd4[_0x7167('0x16')]?_0x12abd4['options'][_0x7167('0x17')]===undefined?!![]:![]:!![],'where':_0x12abd4[_0x7167('0x16')]?_0x12abd4[_0x7167('0x16')][_0x7167('0x18')]||null:null,'attributes':_0x12abd4[_0x7167('0x16')]?_0x12abd4['options'][_0x7167('0x19')]||null:null,'limit':_0x12abd4[_0x7167('0x16')]?_0x12abd4['options']['limit']||null:null,'include':_0x12abd4[_0x7167('0x16')]?_0x12abd4[_0x7167('0x16')][_0x7167('0x1a')]?_[_0x7167('0x1b')](_0x12abd4[_0x7167('0x16')][_0x7167('0x1a')],function(_0x1cbf98){return{'model':db[_0x1cbf98[_0x7167('0x1c')]],'as':_0x1cbf98['as'],'attributes':_0x1cbf98[_0x7167('0x19')],'include':_0x1cbf98[_0x7167('0x1a')]?_[_0x7167('0x1b')](_0x1cbf98[_0x7167('0x1a')],function(_0x5d8aaf){return{'model':db[_0x5d8aaf[_0x7167('0x1c')]],'as':_0x5d8aaf['as'],'attributes':_0x5d8aaf[_0x7167('0x19')],'include':_0x5d8aaf['include']?_[_0x7167('0x1b')](_0x5d8aaf[_0x7167('0x1a')],function(_0x144d98){return{'model':db[_0x144d98[_0x7167('0x1c')]],'as':_0x144d98['as'],'attributes':_0x144d98[_0x7167('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7167('0xb')](function(_0x3352d3){logger[_0x7167('0xc')]('GetServicenowAccount',_0x12abd4);logger[_0x7167('0x1d')](_0x7167('0x1e'),_0x12abd4,JSON['stringify'](_0x3352d3));_0x53250c(_0x3352d3);})[_0x7167('0x14')](function(_0x58ac39){logger[_0x7167('0x11')]('GetServicenowAccount',_0x58ac39['message'],_0x12abd4);_0x5ea71e(_0x1a3de0[_0x7167('0x11')](0x1f4,_0x58ac39[_0x7167('0x12')]));});});};exports[_0x7167('0x1f')]=function(_0x314ee0){var _0x1cb28f=this;return new Promise(function(_0x400ac5,_0x29c5cf){return db[_0x7167('0x20')][_0x7167('0x21')]({'raw':_0x314ee0['options']?_0x314ee0[_0x7167('0x16')][_0x7167('0x17')]===undefined?!![]:![]:!![],'where':_0x314ee0[_0x7167('0x16')]?_0x314ee0[_0x7167('0x16')][_0x7167('0x18')]||null:null,'attributes':_0x314ee0[_0x7167('0x16')]?_0x314ee0[_0x7167('0x16')][_0x7167('0x19')]||null:null,'include':_0x314ee0[_0x7167('0x16')]?_0x314ee0[_0x7167('0x16')][_0x7167('0x1a')]?_[_0x7167('0x1b')](_0x314ee0[_0x7167('0x16')]['include'],function(_0x3aa41b){return{'model':db[_0x3aa41b[_0x7167('0x1c')]],'as':_0x3aa41b['as'],'attributes':_0x3aa41b[_0x7167('0x19')],'include':_0x3aa41b[_0x7167('0x1a')]?_['map'](_0x3aa41b['include'],function(_0x4ce963){return{'model':db[_0x4ce963[_0x7167('0x1c')]],'as':_0x4ce963['as'],'attributes':_0x4ce963['attributes'],'include':_0x4ce963['include']?_['map'](_0x4ce963[_0x7167('0x1a')],function(_0x12db4d){return{'model':db[_0x12db4d[_0x7167('0x1c')]],'as':_0x12db4d['as'],'attributes':_0x12db4d[_0x7167('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7167('0xb')](function(_0x168341){logger['info'](_0x7167('0x1f'),_0x314ee0);logger[_0x7167('0x1d')]('ShowServicenowAccount',_0x314ee0,JSON[_0x7167('0x10')](_0x168341));_0x400ac5(_0x168341);})[_0x7167('0x14')](function(_0x3140da){logger[_0x7167('0x11')](_0x7167('0x1f'),_0x3140da['message'],_0x314ee0);_0x29c5cf(_0x1cb28f[_0x7167('0x11')](0x1f4,_0x3140da['message']));});});}; \ No newline at end of file +var _0xa464=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowServicenowAccount','lodash','moment','bluebird','randomstring'];(function(_0x1335c9,_0xfa13d6){var _0x527653=function(_0x4c61ef){while(--_0x4c61ef){_0x1335c9['push'](_0x1335c9['shift']());}};_0x527653(++_0xfa13d6);}(_0xa464,0xab));var _0x4a46=function(_0x4db561,_0x521d0d){_0x4db561=_0x4db561-0x0;var _0x299980=_0xa464[_0x4db561];return _0x299980;};'use strict';var _=require(_0x4a46('0x0'));var util=require('util');var moment=require(_0x4a46('0x1'));var BPromise=require(_0x4a46('0x2'));var rs=require(_0x4a46('0x3'));var fs=require('fs');var Redis=require(_0x4a46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a46('0x5'));var logger=require(_0x4a46('0x6'))(_0x4a46('0x7'));var config=require(_0x4a46('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4a46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54b32b,_0x104a29,_0xb3d72e){return new BPromise(function(_0x598714,_0x50ab15){return client[_0x4a46('0xa')](_0x54b32b,_0xb3d72e)[_0x4a46('0xb')](function(_0x304de4){logger[_0x4a46('0xc')](_0x4a46('0xd'),_0x104a29,_0x4a46('0xe'));logger[_0x4a46('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x104a29,_0x4a46('0xe'),JSON[_0x4a46('0x10')](_0x304de4));if(_0x304de4[_0x4a46('0x11')]){if(_0x304de4[_0x4a46('0x11')][_0x4a46('0x12')]===0x1f4){logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);return _0x50ab15(_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);}logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);return _0x598714(_0x304de4['error'][_0x4a46('0x13')]);}else{logger[_0x4a46('0xc')](_0x4a46('0xd'),_0x104a29,_0x4a46('0xe'));_0x598714(_0x304de4[_0x4a46('0x14')]['message']);}})['catch'](function(_0x41608b){logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x41608b);_0x50ab15(_0x41608b);});});}exports[_0x4a46('0x15')]=function(_0x485350){var _0x3a1f37=this;return new Promise(function(_0x2e4e60,_0x3fc1ea){return db[_0x4a46('0x16')][_0x4a46('0x17')]({'raw':_0x485350[_0x4a46('0x18')]?_0x485350['options'][_0x4a46('0x19')]===undefined?!![]:![]:!![],'where':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')]['where']||null:null,'attributes':_0x485350[_0x4a46('0x18')]?_0x485350['options'][_0x4a46('0x1a')]||null:null,'limit':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')][_0x4a46('0x1b')]||null:null,'include':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')][_0x4a46('0x1c')]?_[_0x4a46('0x1d')](_0x485350[_0x4a46('0x18')][_0x4a46('0x1c')],function(_0x27ee1b){return{'model':db[_0x27ee1b['model']],'as':_0x27ee1b['as'],'attributes':_0x27ee1b[_0x4a46('0x1a')],'include':_0x27ee1b['include']?_[_0x4a46('0x1d')](_0x27ee1b[_0x4a46('0x1c')],function(_0x3c0548){return{'model':db[_0x3c0548['model']],'as':_0x3c0548['as'],'attributes':_0x3c0548[_0x4a46('0x1a')],'include':_0x3c0548[_0x4a46('0x1c')]?_['map'](_0x3c0548[_0x4a46('0x1c')],function(_0x5a1a97){return{'model':db[_0x5a1a97[_0x4a46('0x1e')]],'as':_0x5a1a97['as'],'attributes':_0x5a1a97[_0x4a46('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4a46('0xb')](function(_0x2e38cb){logger['info'](_0x4a46('0x15'),_0x485350);logger[_0x4a46('0xf')](_0x4a46('0x15'),_0x485350,JSON['stringify'](_0x2e38cb));_0x2e4e60(_0x2e38cb);})[_0x4a46('0x1f')](function(_0x555d7e){logger[_0x4a46('0x11')](_0x4a46('0x15'),_0x555d7e['message'],_0x485350);_0x3fc1ea(_0x3a1f37[_0x4a46('0x11')](0x1f4,_0x555d7e[_0x4a46('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x588f47){var _0x5a9dde=this;return new Promise(function(_0x4d32ae,_0x92e03e){return db[_0x4a46('0x16')][_0x4a46('0x20')]({'raw':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')][_0x4a46('0x19')]===undefined?!![]:![]:!![],'where':_0x588f47['options']?_0x588f47[_0x4a46('0x18')][_0x4a46('0x21')]||null:null,'attributes':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')]['attributes']||null:null,'include':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')]['include']?_[_0x4a46('0x1d')](_0x588f47['options'][_0x4a46('0x1c')],function(_0x12995d){return{'model':db[_0x12995d[_0x4a46('0x1e')]],'as':_0x12995d['as'],'attributes':_0x12995d[_0x4a46('0x1a')],'include':_0x12995d[_0x4a46('0x1c')]?_['map'](_0x12995d[_0x4a46('0x1c')],function(_0x61d743){return{'model':db[_0x61d743[_0x4a46('0x1e')]],'as':_0x61d743['as'],'attributes':_0x61d743[_0x4a46('0x1a')],'include':_0x61d743[_0x4a46('0x1c')]?_[_0x4a46('0x1d')](_0x61d743[_0x4a46('0x1c')],function(_0x55e9f2){return{'model':db[_0x55e9f2[_0x4a46('0x1e')]],'as':_0x55e9f2['as'],'attributes':_0x55e9f2[_0x4a46('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4414bc){logger[_0x4a46('0xc')](_0x4a46('0x22'),_0x588f47);logger[_0x4a46('0xf')]('ShowServicenowAccount',_0x588f47,JSON[_0x4a46('0x10')](_0x4414bc));_0x4d32ae(_0x4414bc);})[_0x4a46('0x1f')](function(_0x351c23){logger[_0x4a46('0x11')](_0x4a46('0x22'),_0x351c23[_0x4a46('0x13')],_0x588f47);_0x92e03e(_0x5a9dde[_0x4a46('0x11')](0x1f4,_0x351c23[_0x4a46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5494e6c..266bf16 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 _0x153d=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x153d,0x72));var _0xd153=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x153d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd153('0x0'));var util=require(_0xd153('0x1'));var path=require(_0xd153('0x2'));var timeout=require(_0xd153('0x3'));var express=require('express');var router=express[_0xd153('0x4')]();var fs_extra=require(_0xd153('0x5'));var auth=require(_0xd153('0x6'));var interaction=require(_0xd153('0x7'));var config=require(_0xd153('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xd153('0x9')](),controller['index']);router[_0xd153('0xa')]('/:id',auth[_0xd153('0x9')](),controller[_0xd153('0xb')]);router['get'](_0xd153('0xc'),auth[_0xd153('0x9')](),controller[_0xd153('0xd')]);router[_0xd153('0xa')](_0xd153('0xe'),auth[_0xd153('0x9')](),controller[_0xd153('0xf')]);router['get'](_0xd153('0x10'),auth[_0xd153('0x9')](),controller[_0xd153('0x11')]);router[_0xd153('0x12')]('/',auth[_0xd153('0x9')](),controller[_0xd153('0x13')]);router[_0xd153('0x14')](_0xd153('0x15'),auth[_0xd153('0x9')](),controller[_0xd153('0x16')]);router[_0xd153('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xd153('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2851=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x7d1ccb,_0x2af43b){var _0x5a78af=function(_0x19daa4){while(--_0x19daa4){_0x7d1ccb['push'](_0x7d1ccb['shift']());}};_0x5a78af(++_0x2af43b);}(_0x2851,0x10a));var _0x1285=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2851[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x1285('0x0'));var util=require(_0x1285('0x1'));var path=require(_0x1285('0x2'));var timeout=require(_0x1285('0x3'));var express=require(_0x1285('0x4'));var router=express['Router']();var fs_extra=require(_0x1285('0x5'));var auth=require(_0x1285('0x6'));var interaction=require(_0x1285('0x7'));var config=require(_0x1285('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x1285('0x9')]('/',auth[_0x1285('0xa')](),controller[_0x1285('0xb')]);router['get'](_0x1285('0xc'),auth[_0x1285('0xa')](),controller['show']);router['get'](_0x1285('0xd'),auth[_0x1285('0xa')](),controller[_0x1285('0xe')]);router[_0x1285('0x9')]('/:id/subjects',auth[_0x1285('0xa')](),controller[_0x1285('0xf')]);router[_0x1285('0x9')](_0x1285('0x10'),auth[_0x1285('0xa')](),controller[_0x1285('0x11')]);router[_0x1285('0x12')]('/',auth[_0x1285('0xa')](),controller[_0x1285('0x13')]);router[_0x1285('0x14')]('/:id',auth[_0x1285('0xa')](),controller[_0x1285('0x15')]);router[_0x1285('0x16')]('/:id',auth[_0x1285('0xa')](),controller[_0x1285('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f473b40..5d0619f 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 _0x9a4f=['STRING','sequelize','exports'];(function(_0x42a550,_0x4f2565){var _0x352695=function(_0x44b4ea){while(--_0x44b4ea){_0x42a550['push'](_0x42a550['shift']());}};_0x352695(++_0x4f2565);}(_0x9a4f,0x1d5));var _0xf9a4=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x9a4f[_0x3b6648];return _0x5a0a0d;};'use strict';var Sequelize=require(_0xf9a4('0x0'));module[_0xf9a4('0x1')]={'name':{'type':Sequelize[_0xf9a4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa290=['exports','STRING'];(function(_0x1d3fa3,_0x491bac){var _0x222cda=function(_0x4389ae){while(--_0x4389ae){_0x1d3fa3['push'](_0x1d3fa3['shift']());}};_0x222cda(++_0x491bac);}(_0xa290,0xb0));var _0x0a29=function(_0x526440,_0x2d22c3){_0x526440=_0x526440-0x0;var _0x383f8c=_0xa290[_0x526440];return _0x383f8c;};'use strict';var Sequelize=require('sequelize');module[_0x0a29('0x0')]={'name':{'type':Sequelize[_0x0a29('0x1')]},'description':{'type':Sequelize[_0x0a29('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 88c6d8a..fb5d067 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 _0xc979=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc979,0x149));var _0x9c97=function(_0x414fc2,_0x53b18a){_0x414fc2=_0x414fc2-0x0;var _0x1be314=_0xc979[_0x414fc2];return _0x1be314;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c97('0x0'));var zipdir=require(_0x9c97('0x1'));var jsonpatch=require(_0x9c97('0x2'));var rp=require(_0x9c97('0x3'));var moment=require('moment');var BPromise=require(_0x9c97('0x4'));var Mustache=require(_0x9c97('0x5'));var util=require('util');var path=require(_0x9c97('0x6'));var sox=require(_0x9c97('0x7'));var csv=require(_0x9c97('0x8'));var ejs=require(_0x9c97('0x9'));var fs=require('fs');var fs_extra=require(_0x9c97('0xa'));var _=require(_0x9c97('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9c97('0x8'));var querystring=require(_0x9c97('0xd'));var Papa=require(_0x9c97('0xe'));var Redis=require(_0x9c97('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9c97('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c97('0x11'));var logger=require(_0x9c97('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9c97('0x13'));var licenseUtil=require(_0x9c97('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7670,_0x2839b1){_0x2839b1=_0x2839b1||0xcc;return function(_0x52edb8){if(_0x52edb8){return _0x2b7670[_0x9c97('0x15')](_0x2839b1);}return _0x2b7670[_0x9c97('0x16')](_0x2839b1)[_0x9c97('0x17')]();};}function respondWithResult(_0x32b3a2,_0x1dea38){_0x1dea38=_0x1dea38||0xc8;return function(_0x5896ff){if(_0x5896ff){return _0x32b3a2[_0x9c97('0x16')](_0x1dea38)[_0x9c97('0x18')](_0x5896ff);}};}function respondWithFilteredResult(_0x3647c9,_0x4c152f){return function(_0x1dd2d6){if(_0x1dd2d6){var _0x25608c=typeof _0x4c152f[_0x9c97('0x19')]===_0x9c97('0x1a')&&typeof _0x4c152f[_0x9c97('0x1b')]===_0x9c97('0x1a');var _0x113f6e=_0x1dd2d6[_0x9c97('0x1c')];var _0x1e3b44=_0x25608c?0x0:_0x4c152f[_0x9c97('0x19')];var _0x30c5fb=_0x25608c?_0x1dd2d6['count']:_0x4c152f[_0x9c97('0x19')]+_0x4c152f[_0x9c97('0x1b')];var _0x4184db;if(_0x30c5fb>=_0x113f6e){_0x30c5fb=_0x113f6e;_0x4184db=0xc8;}else{_0x4184db=0xce;}_0x3647c9[_0x9c97('0x16')](_0x4184db);return _0x3647c9['set']('Content-Range',_0x1e3b44+'-'+_0x30c5fb+'/'+_0x113f6e)[_0x9c97('0x18')](_0x1dd2d6);}return null;};}function patchUpdates(_0x1141f7){return function(_0x235dd7){try{jsonpatch[_0x9c97('0x1d')](_0x235dd7,_0x1141f7,!![]);}catch(_0x525130){return BPromise[_0x9c97('0x1e')](_0x525130);}return _0x235dd7[_0x9c97('0x1f')]();};}function saveUpdates(_0x70ab8d,_0x49f91d){return function(_0x5931ee){if(_0x5931ee){return _0x5931ee['update'](_0x70ab8d)[_0x9c97('0x20')](function(_0x1fa183){return _0x1fa183;});}return null;};}function removeEntity(_0x2b2c04,_0xf9f700){return function(_0x5a6512){if(_0x5a6512){return _0x5a6512['destroy']()[_0x9c97('0x20')](function(){_0x2b2c04[_0x9c97('0x16')](0xcc)[_0x9c97('0x17')]();});}};}function handleEntityNotFound(_0x4062c0,_0x152f2c){return function(_0x11f95e){if(!_0x11f95e){_0x4062c0[_0x9c97('0x15')](0x194);}return _0x11f95e;};}function handleError(_0x28547a,_0x20af0f){_0x20af0f=_0x20af0f||0x1f4;return function(_0x417267){logger['error'](_0x417267['stack']);if(_0x417267['name']){delete _0x417267[_0x9c97('0x21')];}_0x28547a[_0x9c97('0x16')](_0x20af0f)[_0x9c97('0x22')](_0x417267);};}exports[_0x9c97('0x23')]=function(_0x197bdb,_0x55f17a){var _0x229fdb={},_0x1b3d84={},_0x51c10c={'count':0x0,'rows':[]};var _0x1276d7=_[_0x9c97('0x24')](db[_0x9c97('0x25')][_0x9c97('0x26')],function(_0x5291ae){return{'name':_0x5291ae[_0x9c97('0x27')],'type':_0x5291ae[_0x9c97('0x28')][_0x9c97('0x29')]};});_0x1b3d84[_0x9c97('0x2a')]=_[_0x9c97('0x24')](_0x1276d7,'name');_0x1b3d84[_0x9c97('0x2b')]=_[_0x9c97('0x2c')](_0x197bdb[_0x9c97('0x2b')]);_0x1b3d84[_0x9c97('0x2d')]=_[_0x9c97('0x2e')](_0x1b3d84[_0x9c97('0x2a')],_0x1b3d84['query']);_0x229fdb[_0x9c97('0x2f')]=_[_0x9c97('0x2e')](_0x1b3d84['model'],qs[_0x9c97('0x30')](_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x30')]));_0x229fdb[_0x9c97('0x2f')]=_0x229fdb[_0x9c97('0x2f')][_0x9c97('0x31')]?_0x229fdb['attributes']:_0x1b3d84[_0x9c97('0x2a')];if(!_0x197bdb[_0x9c97('0x2b')]['hasOwnProperty'](_0x9c97('0x32'))){_0x229fdb[_0x9c97('0x1b')]=qs['limit'](_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x1b')]);_0x229fdb[_0x9c97('0x19')]=qs[_0x9c97('0x19')](_0x197bdb['query'][_0x9c97('0x19')]);}_0x229fdb[_0x9c97('0x33')]=qs[_0x9c97('0x34')](_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x34')]);_0x229fdb[_0x9c97('0x35')]=qs[_0x9c97('0x2d')](_[_0x9c97('0x36')](_0x197bdb[_0x9c97('0x2b')],_0x1b3d84['filters']),_0x1276d7);if(_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x37')]){_0x229fdb[_0x9c97('0x35')]=_[_0x9c97('0x38')](_0x229fdb[_0x9c97('0x35')],{'$or':_[_0x9c97('0x24')](_0x1276d7,function(_0x45c2c8){if(_0x45c2c8[_0x9c97('0x28')]!==_0x9c97('0x39')){var _0x28e604={};_0x28e604[_0x45c2c8[_0x9c97('0x21')]]={'$like':'%'+_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x37')]+'%'};return _0x28e604;}})});}_0x229fdb=_['merge']({},_0x229fdb,_0x197bdb[_0x9c97('0x3a')]);var _0x4a6dec={'where':_0x229fdb[_0x9c97('0x35')]};return db[_0x9c97('0x25')]['count'](_0x4a6dec)[_0x9c97('0x20')](function(_0x4e9c69){_0x51c10c[_0x9c97('0x1c')]=_0x4e9c69;if(_0x197bdb[_0x9c97('0x2b')][_0x9c97('0x3b')]){_0x229fdb[_0x9c97('0x3c')]=[{'all':!![]}];}return db[_0x9c97('0x25')][_0x9c97('0x3d')](_0x229fdb);})[_0x9c97('0x20')](function(_0x2c87e3){_0x51c10c[_0x9c97('0x3e')]=_0x2c87e3;return _0x51c10c;})['then'](respondWithFilteredResult(_0x55f17a,_0x229fdb))[_0x9c97('0x3f')](handleError(_0x55f17a,null));};exports['show']=function(_0x584aa7,_0x16b68c){var _0x9419c6={'raw':![],'where':{'id':_0x584aa7[_0x9c97('0x40')]['id']}},_0x1e5d39={};_0x1e5d39[_0x9c97('0x2a')]=_['keys'](db[_0x9c97('0x25')][_0x9c97('0x26')]);_0x1e5d39[_0x9c97('0x2b')]=_['keys'](_0x584aa7[_0x9c97('0x2b')]);_0x1e5d39['filters']=_['intersection'](_0x1e5d39[_0x9c97('0x2a')],_0x1e5d39[_0x9c97('0x2b')]);_0x9419c6[_0x9c97('0x2f')]=_['intersection'](_0x1e5d39[_0x9c97('0x2a')],qs[_0x9c97('0x30')](_0x584aa7[_0x9c97('0x2b')][_0x9c97('0x30')]));_0x9419c6[_0x9c97('0x2f')]=_0x9419c6[_0x9c97('0x2f')][_0x9c97('0x31')]?_0x9419c6[_0x9c97('0x2f')]:_0x1e5d39[_0x9c97('0x2a')];if(_0x584aa7['query'][_0x9c97('0x3b')]){_0x9419c6[_0x9c97('0x3c')]=[{'all':!![]}];}_0x9419c6=_[_0x9c97('0x38')]({},_0x9419c6,_0x584aa7[_0x9c97('0x3a')]);return db[_0x9c97('0x25')][_0x9c97('0x41')](_0x9419c6)[_0x9c97('0x20')](handleEntityNotFound(_0x16b68c,null))[_0x9c97('0x20')](respondWithResult(_0x16b68c,null))[_0x9c97('0x3f')](handleError(_0x16b68c,null));};exports[_0x9c97('0x42')]=function(_0x3ab39b,_0xa92699){return db[_0x9c97('0x25')][_0x9c97('0x42')](_0x3ab39b['body'],{})[_0x9c97('0x20')](respondWithResult(_0xa92699,0xc9))['catch'](handleError(_0xa92699,null));};exports[_0x9c97('0x43')]=function(_0x43b2a8,_0x1206ba){if(_0x43b2a8[_0x9c97('0x44')]['id']){delete _0x43b2a8[_0x9c97('0x44')]['id'];}return db[_0x9c97('0x25')][_0x9c97('0x41')]({'where':{'id':_0x43b2a8[_0x9c97('0x40')]['id']}})[_0x9c97('0x20')](handleEntityNotFound(_0x1206ba,null))[_0x9c97('0x20')](saveUpdates(_0x43b2a8[_0x9c97('0x44')],null))['then'](respondWithResult(_0x1206ba,null))[_0x9c97('0x3f')](handleError(_0x1206ba,null));};exports[_0x9c97('0x45')]=function(_0x1b6352,_0x48f632){return db[_0x9c97('0x25')][_0x9c97('0x41')]({'where':{'id':_0x1b6352[_0x9c97('0x40')]['id']}})[_0x9c97('0x20')](handleEntityNotFound(_0x48f632,null))['then'](removeEntity(_0x48f632,null))['catch'](handleError(_0x48f632,null));};exports[_0x9c97('0x46')]=function(_0x46035d,_0x31bb9e,_0x209143){var _0x94833a={};var _0x127755={};var _0x29040f;var _0x331c42;return db[_0x9c97('0x25')][_0x9c97('0x47')]({'where':{'id':_0x46035d[_0x9c97('0x40')]['id']}})['then'](handleEntityNotFound(_0x31bb9e,null))['then'](function(_0x4b7eb3){if(_0x4b7eb3){_0x29040f=_0x4b7eb3;_0x127755[_0x9c97('0x2a')]=_[_0x9c97('0x2c')](db[_0x9c97('0x48')][_0x9c97('0x26')]);_0x127755['query']=_[_0x9c97('0x2c')](_0x46035d[_0x9c97('0x2b')]);_0x127755[_0x9c97('0x2d')]=_[_0x9c97('0x2e')](_0x127755[_0x9c97('0x2a')],_0x127755[_0x9c97('0x2b')]);_0x94833a['attributes']=_[_0x9c97('0x2e')](_0x127755[_0x9c97('0x2a')],qs['fields'](_0x46035d[_0x9c97('0x2b')][_0x9c97('0x30')]));_0x94833a[_0x9c97('0x2f')]=_0x94833a[_0x9c97('0x2f')][_0x9c97('0x31')]?_0x94833a[_0x9c97('0x2f')]:_0x127755[_0x9c97('0x2a')];_0x94833a[_0x9c97('0x33')]=qs[_0x9c97('0x34')](_0x46035d['query'][_0x9c97('0x34')]);_0x94833a[_0x9c97('0x35')]=qs[_0x9c97('0x2d')](_[_0x9c97('0x36')](_0x46035d[_0x9c97('0x2b')],_0x127755[_0x9c97('0x2d')]));if(_0x46035d['query'][_0x9c97('0x37')]){_0x94833a[_0x9c97('0x35')]=_[_0x9c97('0x38')](_0x94833a[_0x9c97('0x35')],{'$or':_[_0x9c97('0x24')](_0x94833a['attributes'],function(_0x2a0170){var _0x404a9d={};_0x404a9d[_0x2a0170]={'$like':'%'+_0x46035d[_0x9c97('0x2b')][_0x9c97('0x37')]+'%'};return _0x404a9d;})});}_0x94833a=_[_0x9c97('0x38')]({},_0x94833a,_0x46035d['options']);return _0x29040f[_0x9c97('0x46')](_0x94833a);}})['then'](function(_0x2718d2){if(_0x2718d2){_0x331c42=_0x2718d2[_0x9c97('0x31')];if(!_0x46035d[_0x9c97('0x2b')][_0x9c97('0x49')]('nolimit')){_0x94833a[_0x9c97('0x1b')]=qs['limit'](_0x46035d[_0x9c97('0x2b')][_0x9c97('0x1b')]);_0x94833a[_0x9c97('0x19')]=qs[_0x9c97('0x19')](_0x46035d[_0x9c97('0x2b')][_0x9c97('0x19')]);}return _0x29040f[_0x9c97('0x46')](_0x94833a);}})['then'](function(_0x12bfa6){if(_0x12bfa6){return _0x12bfa6?{'count':_0x331c42,'rows':_0x12bfa6}:null;}})['then'](respondWithResult(_0x31bb9e,null))[_0x9c97('0x3f')](handleError(_0x31bb9e,null));};exports[_0x9c97('0x4a')]=function(_0x3eb6e8,_0x3018d2,_0x42b9ed){var _0x11c4c1={};var _0x16d0f2={};var _0x5b6fc2;var _0x5e6669;return db[_0x9c97('0x25')][_0x9c97('0x47')]({'where':{'id':_0x3eb6e8[_0x9c97('0x40')]['id']}})[_0x9c97('0x20')](handleEntityNotFound(_0x3018d2,null))[_0x9c97('0x20')](function(_0x235512){if(_0x235512){_0x5b6fc2=_0x235512;_0x16d0f2[_0x9c97('0x2a')]=_['keys'](db[_0x9c97('0x48')][_0x9c97('0x26')]);_0x16d0f2[_0x9c97('0x2b')]=_[_0x9c97('0x2c')](_0x3eb6e8[_0x9c97('0x2b')]);_0x16d0f2[_0x9c97('0x2d')]=_[_0x9c97('0x2e')](_0x16d0f2[_0x9c97('0x2a')],_0x16d0f2['query']);_0x11c4c1[_0x9c97('0x2f')]=_[_0x9c97('0x2e')](_0x16d0f2[_0x9c97('0x2a')],qs[_0x9c97('0x30')](_0x3eb6e8[_0x9c97('0x2b')]['fields']));_0x11c4c1['attributes']=_0x11c4c1[_0x9c97('0x2f')]['length']?_0x11c4c1[_0x9c97('0x2f')]:_0x16d0f2['model'];_0x11c4c1[_0x9c97('0x33')]=qs[_0x9c97('0x34')](_0x3eb6e8[_0x9c97('0x2b')][_0x9c97('0x34')]);_0x11c4c1[_0x9c97('0x35')]=qs[_0x9c97('0x2d')](_[_0x9c97('0x36')](_0x3eb6e8[_0x9c97('0x2b')],_0x16d0f2['filters']));if(_0x3eb6e8['query'][_0x9c97('0x37')]){_0x11c4c1[_0x9c97('0x35')]=_['merge'](_0x11c4c1['where'],{'$or':_[_0x9c97('0x24')](_0x11c4c1[_0x9c97('0x2f')],function(_0x1270d2){var _0x3d95ab={};_0x3d95ab[_0x1270d2]={'$like':'%'+_0x3eb6e8[_0x9c97('0x2b')][_0x9c97('0x37')]+'%'};return _0x3d95ab;})});}_0x11c4c1=_[_0x9c97('0x38')]({},_0x11c4c1,_0x3eb6e8[_0x9c97('0x3a')]);return _0x5b6fc2[_0x9c97('0x4a')](_0x11c4c1);}})[_0x9c97('0x20')](function(_0x359774){if(_0x359774){_0x5e6669=_0x359774[_0x9c97('0x31')];if(!_0x3eb6e8['query'][_0x9c97('0x49')](_0x9c97('0x32'))){_0x11c4c1['limit']=qs[_0x9c97('0x1b')](_0x3eb6e8['query'][_0x9c97('0x1b')]);_0x11c4c1[_0x9c97('0x19')]=qs[_0x9c97('0x19')](_0x3eb6e8[_0x9c97('0x2b')][_0x9c97('0x19')]);}return _0x5b6fc2[_0x9c97('0x4a')](_0x11c4c1);}})[_0x9c97('0x20')](function(_0x3535a3){if(_0x3535a3){return _0x3535a3?{'count':_0x5e6669,'rows':_0x3535a3}:null;}})[_0x9c97('0x20')](respondWithResult(_0x3018d2,null))[_0x9c97('0x3f')](handleError(_0x3018d2,null));};exports[_0x9c97('0x4b')]=function(_0x3d9a61,_0x19ae19,_0x12e4d3){var _0x944f9e={};var _0x913f22={};var _0x3d6e38;var _0x1b53c6;return db[_0x9c97('0x25')]['findOne']({'where':{'id':_0x3d9a61[_0x9c97('0x40')]['id']}})[_0x9c97('0x20')](handleEntityNotFound(_0x19ae19,null))[_0x9c97('0x20')](function(_0x598899){if(_0x598899){_0x3d6e38=_0x598899;_0x913f22[_0x9c97('0x2a')]=_[_0x9c97('0x2c')](db[_0x9c97('0x48')][_0x9c97('0x26')]);_0x913f22[_0x9c97('0x2b')]=_['keys'](_0x3d9a61[_0x9c97('0x2b')]);_0x913f22[_0x9c97('0x2d')]=_[_0x9c97('0x2e')](_0x913f22[_0x9c97('0x2a')],_0x913f22[_0x9c97('0x2b')]);_0x944f9e['attributes']=_['intersection'](_0x913f22[_0x9c97('0x2a')],qs[_0x9c97('0x30')](_0x3d9a61[_0x9c97('0x2b')][_0x9c97('0x30')]));_0x944f9e[_0x9c97('0x2f')]=_0x944f9e[_0x9c97('0x2f')][_0x9c97('0x31')]?_0x944f9e[_0x9c97('0x2f')]:_0x913f22['model'];_0x944f9e[_0x9c97('0x33')]=qs[_0x9c97('0x34')](_0x3d9a61['query'][_0x9c97('0x34')]);_0x944f9e['where']=qs[_0x9c97('0x2d')](_[_0x9c97('0x36')](_0x3d9a61[_0x9c97('0x2b')],_0x913f22[_0x9c97('0x2d')]));if(_0x3d9a61[_0x9c97('0x2b')][_0x9c97('0x37')]){_0x944f9e[_0x9c97('0x35')]=_['merge'](_0x944f9e[_0x9c97('0x35')],{'$or':_[_0x9c97('0x24')](_0x944f9e[_0x9c97('0x2f')],function(_0x10aefe){var _0x15ffb4={};_0x15ffb4[_0x10aefe]={'$like':'%'+_0x3d9a61['query'][_0x9c97('0x37')]+'%'};return _0x15ffb4;})});}_0x944f9e=_[_0x9c97('0x38')]({},_0x944f9e,_0x3d9a61[_0x9c97('0x3a')]);return _0x3d6e38['getDescriptions'](_0x944f9e);}})[_0x9c97('0x20')](function(_0x415fdc){if(_0x415fdc){_0x1b53c6=_0x415fdc[_0x9c97('0x31')];if(!_0x3d9a61['query']['hasOwnProperty'](_0x9c97('0x32'))){_0x944f9e[_0x9c97('0x1b')]=qs[_0x9c97('0x1b')](_0x3d9a61[_0x9c97('0x2b')][_0x9c97('0x1b')]);_0x944f9e[_0x9c97('0x19')]=qs[_0x9c97('0x19')](_0x3d9a61[_0x9c97('0x2b')][_0x9c97('0x19')]);}return _0x3d6e38[_0x9c97('0x4b')](_0x944f9e);}})[_0x9c97('0x20')](function(_0xa1e925){if(_0xa1e925){return _0xa1e925?{'count':_0x1b53c6,'rows':_0xa1e925}:null;}})[_0x9c97('0x20')](respondWithResult(_0x19ae19,null))['catch'](handleError(_0x19ae19,null));}; \ No newline at end of file +var _0xce4e=['ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration','includeAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne'];(function(_0x2630e6,_0x1bccdc){var _0x236599=function(_0x26a6e4){while(--_0x26a6e4){_0x2630e6['push'](_0x2630e6['shift']());}};_0x236599(++_0x1bccdc);}(_0xce4e,0x1e9));var _0xece4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xce4e[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xece4('0x0'));var rimraf=require(_0xece4('0x1'));var zipdir=require(_0xece4('0x2'));var jsonpatch=require(_0xece4('0x3'));var rp=require(_0xece4('0x4'));var moment=require(_0xece4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xece4('0x6'));var util=require(_0xece4('0x7'));var path=require(_0xece4('0x8'));var sox=require(_0xece4('0x9'));var csv=require(_0xece4('0xa'));var ejs=require(_0xece4('0xb'));var fs=require('fs');var fs_extra=require(_0xece4('0xc'));var _=require(_0xece4('0xd'));var squel=require(_0xece4('0xe'));var crypto=require(_0xece4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xece4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xece4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xece4('0x12'));var as=require(_0xece4('0x13'));var hardwareService=require(_0xece4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xece4('0x15'));var config=require(_0xece4('0x16'));var licenseUtil=require(_0xece4('0x17'));var db=require(_0xece4('0x18'))['db'];function respondWithStatusCode(_0x52cac2,_0x579f82){_0x579f82=_0x579f82||0xcc;return function(_0x42bb83){if(_0x42bb83){return _0x52cac2[_0xece4('0x19')](_0x579f82);}return _0x52cac2[_0xece4('0x1a')](_0x579f82)[_0xece4('0x1b')]();};}function respondWithResult(_0x2eaf2b,_0x591f25){_0x591f25=_0x591f25||0xc8;return function(_0xdcc37a){if(_0xdcc37a){return _0x2eaf2b['status'](_0x591f25)[_0xece4('0x1c')](_0xdcc37a);}};}function respondWithFilteredResult(_0x55cfe7,_0x2bb3e7){return function(_0x293755){if(_0x293755){var _0x215fc1=typeof _0x2bb3e7[_0xece4('0x1d')]===_0xece4('0x1e')&&typeof _0x2bb3e7[_0xece4('0x1f')]===_0xece4('0x1e');var _0x434fdc=_0x293755[_0xece4('0x20')];var _0x53cc8e=_0x215fc1?0x0:_0x2bb3e7[_0xece4('0x1d')];var _0x4fcc2f=_0x215fc1?_0x293755[_0xece4('0x20')]:_0x2bb3e7[_0xece4('0x1d')]+_0x2bb3e7['limit'];var _0x14ab69;if(_0x4fcc2f>=_0x434fdc){_0x4fcc2f=_0x434fdc;_0x14ab69=0xc8;}else{_0x14ab69=0xce;}_0x55cfe7[_0xece4('0x1a')](_0x14ab69);return _0x55cfe7[_0xece4('0x21')](_0xece4('0x22'),_0x53cc8e+'-'+_0x4fcc2f+'/'+_0x434fdc)[_0xece4('0x1c')](_0x293755);}return null;};}function patchUpdates(_0x935b90){return function(_0x235e9e){try{jsonpatch['apply'](_0x235e9e,_0x935b90,!![]);}catch(_0x40a7c9){return BPromise[_0xece4('0x23')](_0x40a7c9);}return _0x235e9e[_0xece4('0x24')]();};}function saveUpdates(_0x50e2ac,_0x331573){return function(_0x3deade){if(_0x3deade){return _0x3deade[_0xece4('0x25')](_0x50e2ac)[_0xece4('0x26')](function(_0x5bda02){return _0x5bda02;});}return null;};}function removeEntity(_0x591fff,_0x825bd7){return function(_0x4fdea2){if(_0x4fdea2){return _0x4fdea2[_0xece4('0x27')]()[_0xece4('0x26')](function(){_0x591fff['status'](0xcc)[_0xece4('0x1b')]();});}};}function handleEntityNotFound(_0x593b43,_0x5974ad){return function(_0x23997d){if(!_0x23997d){_0x593b43['sendStatus'](0x194);}return _0x23997d;};}function handleError(_0x2dc8f2,_0x3c4e61){_0x3c4e61=_0x3c4e61||0x1f4;return function(_0x5e6318){logger['error'](_0x5e6318[_0xece4('0x28')]);if(_0x5e6318[_0xece4('0x29')]){delete _0x5e6318['name'];}_0x2dc8f2[_0xece4('0x1a')](_0x3c4e61)[_0xece4('0x2a')](_0x5e6318);};}exports[_0xece4('0x2b')]=function(_0x414c27,_0x4d07de){var _0x11f896={},_0x216065={},_0x45f91f={'count':0x0,'rows':[]};var _0x5ae5f7=_[_0xece4('0x2c')](db['ServicenowConfiguration'][_0xece4('0x2d')],function(_0x521bc8){return{'name':_0x521bc8[_0xece4('0x2e')],'type':_0x521bc8['type'][_0xece4('0x2f')]};});_0x216065[_0xece4('0x30')]=_['map'](_0x5ae5f7,_0xece4('0x29'));_0x216065[_0xece4('0x31')]=_[_0xece4('0x32')](_0x414c27[_0xece4('0x31')]);_0x216065[_0xece4('0x33')]=_[_0xece4('0x34')](_0x216065[_0xece4('0x30')],_0x216065[_0xece4('0x31')]);_0x11f896['attributes']=_[_0xece4('0x34')](_0x216065[_0xece4('0x30')],qs[_0xece4('0x35')](_0x414c27[_0xece4('0x31')]['fields']));_0x11f896['attributes']=_0x11f896[_0xece4('0x36')]['length']?_0x11f896['attributes']:_0x216065[_0xece4('0x30')];if(!_0x414c27[_0xece4('0x31')][_0xece4('0x37')](_0xece4('0x38'))){_0x11f896[_0xece4('0x1f')]=qs[_0xece4('0x1f')](_0x414c27[_0xece4('0x31')]['limit']);_0x11f896[_0xece4('0x1d')]=qs['offset'](_0x414c27[_0xece4('0x31')][_0xece4('0x1d')]);}_0x11f896[_0xece4('0x39')]=qs[_0xece4('0x3a')](_0x414c27['query']['sort']);_0x11f896[_0xece4('0x3b')]=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x414c27[_0xece4('0x31')],_0x216065[_0xece4('0x33')]),_0x5ae5f7);if(_0x414c27[_0xece4('0x31')][_0xece4('0x3d')]){_0x11f896['where']=_['merge'](_0x11f896['where'],{'$or':_[_0xece4('0x2c')](_0x5ae5f7,function(_0x122f9b){if(_0x122f9b['type']!==_0xece4('0x3e')){var _0x2bb932={};_0x2bb932[_0x122f9b[_0xece4('0x29')]]={'$like':'%'+_0x414c27[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x2bb932;}})});}_0x11f896=_[_0xece4('0x3f')]({},_0x11f896,_0x414c27[_0xece4('0x40')]);var _0x625cb9={'where':_0x11f896[_0xece4('0x3b')]};return db[_0xece4('0x41')][_0xece4('0x20')](_0x625cb9)[_0xece4('0x26')](function(_0x437a08){_0x45f91f[_0xece4('0x20')]=_0x437a08;if(_0x414c27[_0xece4('0x31')][_0xece4('0x42')]){_0x11f896['include']=[{'all':!![]}];}return db[_0xece4('0x41')]['findAll'](_0x11f896);})[_0xece4('0x26')](function(_0x241edf){_0x45f91f[_0xece4('0x43')]=_0x241edf;return _0x45f91f;})[_0xece4('0x26')](respondWithFilteredResult(_0x4d07de,_0x11f896))[_0xece4('0x44')](handleError(_0x4d07de,null));};exports[_0xece4('0x45')]=function(_0xf43147,_0x5dcf08){var _0x1c61c5={'raw':![],'where':{'id':_0xf43147[_0xece4('0x46')]['id']}},_0x273326={};_0x273326[_0xece4('0x30')]=_[_0xece4('0x32')](db[_0xece4('0x41')][_0xece4('0x2d')]);_0x273326[_0xece4('0x31')]=_[_0xece4('0x32')](_0xf43147[_0xece4('0x31')]);_0x273326[_0xece4('0x33')]=_[_0xece4('0x34')](_0x273326[_0xece4('0x30')],_0x273326[_0xece4('0x31')]);_0x1c61c5[_0xece4('0x36')]=_['intersection'](_0x273326[_0xece4('0x30')],qs[_0xece4('0x35')](_0xf43147[_0xece4('0x31')][_0xece4('0x35')]));_0x1c61c5[_0xece4('0x36')]=_0x1c61c5[_0xece4('0x36')][_0xece4('0x47')]?_0x1c61c5[_0xece4('0x36')]:_0x273326[_0xece4('0x30')];if(_0xf43147[_0xece4('0x31')]['includeAll']){_0x1c61c5[_0xece4('0x48')]=[{'all':!![]}];}_0x1c61c5=_['merge']({},_0x1c61c5,_0xf43147[_0xece4('0x40')]);return db['ServicenowConfiguration'][_0xece4('0x49')](_0x1c61c5)[_0xece4('0x26')](handleEntityNotFound(_0x5dcf08,null))[_0xece4('0x26')](respondWithResult(_0x5dcf08,null))[_0xece4('0x44')](handleError(_0x5dcf08,null));};exports[_0xece4('0x4a')]=function(_0x1431dd,_0x4135e3){return db[_0xece4('0x41')][_0xece4('0x4a')](_0x1431dd[_0xece4('0x4b')],{})[_0xece4('0x26')](respondWithResult(_0x4135e3,0xc9))[_0xece4('0x44')](handleError(_0x4135e3,null));};exports[_0xece4('0x25')]=function(_0x3fe5ea,_0x39b44b){if(_0x3fe5ea[_0xece4('0x4b')]['id']){delete _0x3fe5ea[_0xece4('0x4b')]['id'];}return db[_0xece4('0x41')][_0xece4('0x49')]({'where':{'id':_0x3fe5ea[_0xece4('0x46')]['id']}})['then'](handleEntityNotFound(_0x39b44b,null))[_0xece4('0x26')](saveUpdates(_0x3fe5ea['body'],null))['then'](respondWithResult(_0x39b44b,null))[_0xece4('0x44')](handleError(_0x39b44b,null));};exports[_0xece4('0x27')]=function(_0x4bdb64,_0x35f2b6){return db[_0xece4('0x41')][_0xece4('0x49')]({'where':{'id':_0x4bdb64[_0xece4('0x46')]['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x35f2b6,null))['then'](removeEntity(_0x35f2b6,null))['catch'](handleError(_0x35f2b6,null));};exports[_0xece4('0x4c')]=function(_0x30183d,_0x3c3baf,_0x2d6aff){var _0x208728={};var _0x121850={};var _0x38d360;var _0x451b25;return db[_0xece4('0x41')][_0xece4('0x4d')]({'where':{'id':_0x30183d['params']['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x3c3baf,null))[_0xece4('0x26')](function(_0x5a4842){if(_0x5a4842){_0x38d360=_0x5a4842;_0x121850[_0xece4('0x30')]=_['keys'](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x121850[_0xece4('0x31')]=_[_0xece4('0x32')](_0x30183d[_0xece4('0x31')]);_0x121850[_0xece4('0x33')]=_[_0xece4('0x34')](_0x121850['model'],_0x121850[_0xece4('0x31')]);_0x208728['attributes']=_[_0xece4('0x34')](_0x121850[_0xece4('0x30')],qs[_0xece4('0x35')](_0x30183d[_0xece4('0x31')][_0xece4('0x35')]));_0x208728[_0xece4('0x36')]=_0x208728[_0xece4('0x36')][_0xece4('0x47')]?_0x208728[_0xece4('0x36')]:_0x121850[_0xece4('0x30')];_0x208728['order']=qs[_0xece4('0x3a')](_0x30183d[_0xece4('0x31')][_0xece4('0x3a')]);_0x208728[_0xece4('0x3b')]=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x30183d['query'],_0x121850[_0xece4('0x33')]));if(_0x30183d[_0xece4('0x31')][_0xece4('0x3d')]){_0x208728[_0xece4('0x3b')]=_['merge'](_0x208728[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0x208728[_0xece4('0x36')],function(_0x2d6b09){var _0x41d04e={};_0x41d04e[_0x2d6b09]={'$like':'%'+_0x30183d[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x41d04e;})});}_0x208728=_[_0xece4('0x3f')]({},_0x208728,_0x30183d['options']);return _0x38d360[_0xece4('0x4c')](_0x208728);}})[_0xece4('0x26')](function(_0x2b6b37){if(_0x2b6b37){_0x451b25=_0x2b6b37[_0xece4('0x47')];if(!_0x30183d[_0xece4('0x31')]['hasOwnProperty'](_0xece4('0x38'))){_0x208728['limit']=qs['limit'](_0x30183d['query']['limit']);_0x208728[_0xece4('0x1d')]=qs[_0xece4('0x1d')](_0x30183d[_0xece4('0x31')][_0xece4('0x1d')]);}return _0x38d360[_0xece4('0x4c')](_0x208728);}})['then'](function(_0x33e4cc){if(_0x33e4cc){return _0x33e4cc?{'count':_0x451b25,'rows':_0x33e4cc}:null;}})[_0xece4('0x26')](respondWithResult(_0x3c3baf,null))[_0xece4('0x44')](handleError(_0x3c3baf,null));};exports[_0xece4('0x4f')]=function(_0x19caa9,_0x49a383,_0x591030){var _0xe36cff={};var _0x1a85a3={};var _0x2f55b8;var _0x4c121d;return db[_0xece4('0x41')][_0xece4('0x4d')]({'where':{'id':_0x19caa9[_0xece4('0x46')]['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x49a383,null))[_0xece4('0x26')](function(_0x33e2bb){if(_0x33e2bb){_0x2f55b8=_0x33e2bb;_0x1a85a3['model']=_[_0xece4('0x32')](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x1a85a3['query']=_['keys'](_0x19caa9[_0xece4('0x31')]);_0x1a85a3['filters']=_[_0xece4('0x34')](_0x1a85a3[_0xece4('0x30')],_0x1a85a3[_0xece4('0x31')]);_0xe36cff[_0xece4('0x36')]=_[_0xece4('0x34')](_0x1a85a3['model'],qs[_0xece4('0x35')](_0x19caa9['query'][_0xece4('0x35')]));_0xe36cff[_0xece4('0x36')]=_0xe36cff['attributes'][_0xece4('0x47')]?_0xe36cff[_0xece4('0x36')]:_0x1a85a3[_0xece4('0x30')];_0xe36cff['order']=qs['sort'](_0x19caa9[_0xece4('0x31')][_0xece4('0x3a')]);_0xe36cff['where']=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x19caa9['query'],_0x1a85a3[_0xece4('0x33')]));if(_0x19caa9[_0xece4('0x31')][_0xece4('0x3d')]){_0xe36cff[_0xece4('0x3b')]=_[_0xece4('0x3f')](_0xe36cff[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0xe36cff[_0xece4('0x36')],function(_0x3db7ce){var _0x1503a9={};_0x1503a9[_0x3db7ce]={'$like':'%'+_0x19caa9[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x1503a9;})});}_0xe36cff=_[_0xece4('0x3f')]({},_0xe36cff,_0x19caa9[_0xece4('0x40')]);return _0x2f55b8[_0xece4('0x4f')](_0xe36cff);}})[_0xece4('0x26')](function(_0x4feb07){if(_0x4feb07){_0x4c121d=_0x4feb07[_0xece4('0x47')];if(!_0x19caa9['query'][_0xece4('0x37')](_0xece4('0x38'))){_0xe36cff[_0xece4('0x1f')]=qs[_0xece4('0x1f')](_0x19caa9[_0xece4('0x31')][_0xece4('0x1f')]);_0xe36cff['offset']=qs['offset'](_0x19caa9[_0xece4('0x31')]['offset']);}return _0x2f55b8['getSubjects'](_0xe36cff);}})[_0xece4('0x26')](function(_0x4437c4){if(_0x4437c4){return _0x4437c4?{'count':_0x4c121d,'rows':_0x4437c4}:null;}})[_0xece4('0x26')](respondWithResult(_0x49a383,null))['catch'](handleError(_0x49a383,null));};exports[_0xece4('0x50')]=function(_0x2ac1c8,_0xa38df8,_0x51409e){var _0x2cc58e={};var _0x5ca364={};var _0x1d7c0a;var _0x327ddb;return db[_0xece4('0x41')]['findOne']({'where':{'id':_0x2ac1c8['params']['id']}})[_0xece4('0x26')](handleEntityNotFound(_0xa38df8,null))[_0xece4('0x26')](function(_0xf9d93a){if(_0xf9d93a){_0x1d7c0a=_0xf9d93a;_0x5ca364[_0xece4('0x30')]=_['keys'](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x5ca364[_0xece4('0x31')]=_[_0xece4('0x32')](_0x2ac1c8[_0xece4('0x31')]);_0x5ca364[_0xece4('0x33')]=_[_0xece4('0x34')](_0x5ca364[_0xece4('0x30')],_0x5ca364[_0xece4('0x31')]);_0x2cc58e['attributes']=_[_0xece4('0x34')](_0x5ca364['model'],qs['fields'](_0x2ac1c8[_0xece4('0x31')]['fields']));_0x2cc58e['attributes']=_0x2cc58e[_0xece4('0x36')][_0xece4('0x47')]?_0x2cc58e[_0xece4('0x36')]:_0x5ca364['model'];_0x2cc58e['order']=qs['sort'](_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3a')]);_0x2cc58e['where']=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x2ac1c8['query'],_0x5ca364['filters']));if(_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3d')]){_0x2cc58e[_0xece4('0x3b')]=_['merge'](_0x2cc58e[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0x2cc58e[_0xece4('0x36')],function(_0x5abb04){var _0x4e2b5d={};_0x4e2b5d[_0x5abb04]={'$like':'%'+_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x4e2b5d;})});}_0x2cc58e=_[_0xece4('0x3f')]({},_0x2cc58e,_0x2ac1c8[_0xece4('0x40')]);return _0x1d7c0a['getDescriptions'](_0x2cc58e);}})[_0xece4('0x26')](function(_0x10c657){if(_0x10c657){_0x327ddb=_0x10c657[_0xece4('0x47')];if(!_0x2ac1c8[_0xece4('0x31')][_0xece4('0x37')](_0xece4('0x38'))){_0x2cc58e['limit']=qs[_0xece4('0x1f')](_0x2ac1c8[_0xece4('0x31')]['limit']);_0x2cc58e[_0xece4('0x1d')]=qs[_0xece4('0x1d')](_0x2ac1c8[_0xece4('0x31')][_0xece4('0x1d')]);}return _0x1d7c0a[_0xece4('0x50')](_0x2cc58e);}})['then'](function(_0x3e30c6){if(_0x3e30c6){return _0x3e30c6?{'count':_0x327ddb,'rows':_0x3e30c6}:null;}})['then'](respondWithResult(_0xa38df8,null))[_0xece4('0x44')](handleError(_0xa38df8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cf55ab8..b2e58bd 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 _0x9e63=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x475e51,_0x4d52e9){var _0x4e336c=function(_0x55c8c5){while(--_0x55c8c5){_0x475e51['push'](_0x475e51['shift']());}};_0x4e336c(++_0x4d52e9);}(_0x9e63,0x65));var _0x39e6=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9e63[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require(_0x39e6('0x2'))('api');var moment=require(_0x39e6('0x3'));var BPromise=require(_0x39e6('0x4'));var rp=require(_0x39e6('0x5'));var fs=require('fs');var path=require(_0x39e6('0x6'));var rimraf=require(_0x39e6('0x7'));var config=require(_0x39e6('0x8'));var attributes=require(_0x39e6('0x9'));module[_0x39e6('0xa')]=function(_0x48f3bb,_0x367e77){return _0x48f3bb[_0x39e6('0xb')](_0x39e6('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6257=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','../../config/logger'];(function(_0x5f3958,_0x5b1953){var _0x512fa1=function(_0x4a6034){while(--_0x4a6034){_0x5f3958['push'](_0x5f3958['shift']());}};_0x512fa1(++_0x5b1953);}(_0x6257,0x1d4));var _0x7625=function(_0x47a8ff,_0x1e65d1){_0x47a8ff=_0x47a8ff-0x0;var _0x10ba69=_0x6257[_0x47a8ff];return _0x10ba69;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var logger=require(_0x7625('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7625('0x2'));var rp=require(_0x7625('0x3'));var fs=require('fs');var path=require(_0x7625('0x4'));var rimraf=require(_0x7625('0x5'));var config=require(_0x7625('0x6'));var attributes=require(_0x7625('0x7'));module[_0x7625('0x8')]=function(_0x2ee215,_0x2340ab){return _0x2ee215[_0x7625('0x9')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index eda6b62..3789e90 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 _0xdf77=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird'];(function(_0x180763,_0x4b889d){var _0x991e0c=function(_0x2bef11){while(--_0x2bef11){_0x180763['push'](_0x180763['shift']());}};_0x991e0c(++_0x4b889d);}(_0xdf77,0x1a1));var _0x7df7=function(_0x25bb39,_0x15c0b7){_0x25bb39=_0x25bb39-0x0;var _0x4bea76=_0xdf77[_0x25bb39];return _0x4bea76;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var moment=require('moment');var BPromise=require(_0x7df7('0x2'));var rs=require(_0x7df7('0x3'));var fs=require('fs');var Redis=require(_0x7df7('0x4'));var db=require(_0x7df7('0x5'))['db'];var utils=require(_0x7df7('0x6'));var logger=require(_0x7df7('0x7'))(_0x7df7('0x8'));var config=require(_0x7df7('0x9'));var jayson=require(_0x7df7('0xa'));var client=jayson[_0x7df7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349f37,_0xb6912e,_0x28cf26){return new BPromise(function(_0x1f9e8e,_0x973f22){return client['request'](_0x349f37,_0x28cf26)['then'](function(_0xe6e22c){logger[_0x7df7('0xc')](_0x7df7('0xd'),_0xb6912e,_0x7df7('0xe'));logger[_0x7df7('0xf')](_0x7df7('0x10'),_0xb6912e,_0x7df7('0xe'),JSON['stringify'](_0xe6e22c));if(_0xe6e22c[_0x7df7('0x11')]){if(_0xe6e22c[_0x7df7('0x11')]['code']===0x1f4){logger[_0x7df7('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xb6912e,_0xe6e22c[_0x7df7('0x11')][_0x7df7('0x12')]);return _0x973f22(_0xe6e22c[_0x7df7('0x11')][_0x7df7('0x12')]);}logger[_0x7df7('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xb6912e,_0xe6e22c[_0x7df7('0x11')][_0x7df7('0x12')]);return _0x1f9e8e(_0xe6e22c[_0x7df7('0x11')]['message']);}else{logger[_0x7df7('0xc')](_0x7df7('0xd'),_0xb6912e,_0x7df7('0xe'));_0x1f9e8e(_0xe6e22c[_0x7df7('0x13')]['message']);}})[_0x7df7('0x14')](function(_0x222095){logger[_0x7df7('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xb6912e,_0x222095);_0x973f22(_0x222095);});});} \ No newline at end of file +var _0x5353=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x38665e,_0x111a0a){var _0x66dd90=function(_0x423513){while(--_0x423513){_0x38665e['push'](_0x38665e['shift']());}};_0x66dd90(++_0x111a0a);}(_0x5353,0x12f));var _0x3535=function(_0x3848e7,_0x20147a){_0x3848e7=_0x3848e7-0x0;var _0x2d21be=_0x5353[_0x3848e7];return _0x2d21be;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498868,_0x1c92fd,_0x268873){return new BPromise(function(_0x3e3500,_0x5437a2){return client[_0x3535('0xc')](_0x498868,_0x268873)[_0x3535('0xd')](function(_0x2da555){logger[_0x3535('0xe')](_0x3535('0xf'),_0x1c92fd,_0x3535('0x10'));logger['debug'](_0x3535('0x11'),_0x1c92fd,_0x3535('0x10'),JSON['stringify'](_0x2da555));if(_0x2da555[_0x3535('0x12')]){if(_0x2da555['error']['code']===0x1f4){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);return _0x5437a2(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}logger[_0x3535('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c92fd,_0x2da555[_0x3535('0x12')]['message']);return _0x3e3500(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}else{logger[_0x3535('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c92fd,_0x3535('0x10'));_0x3e3500(_0x2da555['result'][_0x3535('0x13')]);}})['catch'](function(_0x519c33){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x519c33);_0x5437a2(_0x519c33);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0d1e974..db12c86 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 _0x322f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x322f,0xb1));var _0xf322=function(_0x18b9bd,_0x43663f){_0x18b9bd=_0x18b9bd-0x0;var _0x1a9a03=_0x322f[_0x18b9bd];return _0x1a9a03;};'use strict';var multer=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var path=require(_0xf322('0x2'));var timeout=require(_0xf322('0x3'));var express=require('express');var router=express[_0xf322('0x4')]();var fs_extra=require(_0xf322('0x5'));var auth=require(_0xf322('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf322('0x7'));var controller=require(_0xf322('0x8'));router[_0xf322('0x9')]('/',auth['isAuthenticated'](),controller[_0xf322('0xa')]);router[_0xf322('0x9')](_0xf322('0xb'),auth[_0xf322('0xc')](),controller[_0xf322('0xd')]);router['post']('/',auth[_0xf322('0xc')](),controller[_0xf322('0xe')]);router[_0xf322('0xf')](_0xf322('0xb'),auth[_0xf322('0xc')](),controller[_0xf322('0x10')]);router[_0xf322('0x11')](_0xf322('0xb'),auth[_0xf322('0xc')](),controller[_0xf322('0x12')]);module[_0xf322('0x13')]=router; \ No newline at end of file +var _0x81af=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x81af,0xfa));var _0xf81a=function(_0x4a3df5,_0x2df3fb){_0x4a3df5=_0x4a3df5-0x0;var _0x54201d=_0x81af[_0x4a3df5];return _0x54201d;};'use strict';var multer=require('multer');var util=require(_0xf81a('0x0'));var path=require(_0xf81a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf81a('0x2')]();var fs_extra=require(_0xf81a('0x3'));var auth=require(_0xf81a('0x4'));var interaction=require(_0xf81a('0x5'));var config=require('../../config/environment');var controller=require(_0xf81a('0x6'));router[_0xf81a('0x7')]('/',auth[_0xf81a('0x8')](),controller[_0xf81a('0x9')]);router[_0xf81a('0x7')](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller['show']);router[_0xf81a('0xb')]('/',auth[_0xf81a('0x8')](),controller[_0xf81a('0xc')]);router['put'](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller[_0xf81a('0xd')]);router[_0xf81a('0xe')](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a7a2edf..3326cc9 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 _0x9253=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x8a917c,_0x19c5f6){var _0x2c704e=function(_0x342f3a){while(--_0x342f3a){_0x8a917c['push'](_0x8a917c['shift']());}};_0x2c704e(++_0x19c5f6);}(_0x9253,0x1c1));var _0x3925=function(_0x4bdb73,_0x2e6916){_0x4bdb73=_0x4bdb73-0x0;var _0x56a18a=_0x9253[_0x4bdb73];return _0x56a18a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3925('0x0')](_0x3925('0x1'),_0x3925('0x2'),_0x3925('0x3'),_0x3925('0x4'),_0x3925('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3925('0x6')]},'key':{'type':Sequelize[_0x3925('0x6')]},'keyType':{'type':Sequelize[_0x3925('0x0')]('string',_0x3925('0x2'),_0x3925('0x3'))},'keyContent':{'type':Sequelize[_0x3925('0x6')]},'idField':{'type':Sequelize[_0x3925('0x6')]},'nameField':{'type':Sequelize[_0x3925('0x6')]},'customField':{'type':Sequelize[_0x3925('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3925('0x6')]}}; \ No newline at end of file +var _0x2924=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x4b64f2,_0x1302a8){var _0x3fde4a=function(_0x507720){while(--_0x507720){_0x4b64f2['push'](_0x4b64f2['shift']());}};_0x3fde4a(++_0x1302a8);}(_0x2924,0xcd));var _0x4292=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0x2924[_0xcd26a9];return _0x3afcbc;};'use strict';var Sequelize=require(_0x4292('0x0'));module[_0x4292('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x4292('0x2'),_0x4292('0x3'),_0x4292('0x4'),_0x4292('0x5')),'defaultValue':_0x4292('0x6')},'content':{'type':Sequelize[_0x4292('0x7')]},'key':{'type':Sequelize[_0x4292('0x7')]},'keyType':{'type':Sequelize[_0x4292('0x8')](_0x4292('0x6'),_0x4292('0x2'),_0x4292('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4292('0x7')]},'nameField':{'type':Sequelize[_0x4292('0x7')]},'customField':{'type':Sequelize[_0x4292('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4292('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 84ffb7d..b7961ba 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 _0x13af=['intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x4ce08b,_0x16467d){var _0x372343=function(_0x40766a){while(--_0x40766a){_0x4ce08b['push'](_0x4ce08b['shift']());}};_0x372343(++_0x16467d);}(_0x13af,0x13d));var _0xf13a=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x13af[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf13a('0x0'));var zipdir=require(_0xf13a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf13a('0x2'));var Mustache=require(_0xf13a('0x3'));var util=require(_0xf13a('0x4'));var path=require('path');var sox=require(_0xf13a('0x5'));var csv=require('to-csv');var ejs=require(_0xf13a('0x6'));var fs=require('fs');var fs_extra=require(_0xf13a('0x7'));var _=require(_0xf13a('0x8'));var squel=require(_0xf13a('0x9'));var crypto=require(_0xf13a('0xa'));var jsforce=require(_0xf13a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf13a('0xc'));var querystring=require(_0xf13a('0xd'));var Papa=require(_0xf13a('0xe'));var Redis=require(_0xf13a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf13a('0x10'));var as=require(_0xf13a('0x11'));var hardwareService=require(_0xf13a('0x12'));var logger=require(_0xf13a('0x13'))(_0xf13a('0x14'));var utils=require(_0xf13a('0x15'));var config=require(_0xf13a('0x16'));var licenseUtil=require(_0xf13a('0x17'));var db=require(_0xf13a('0x18'))['db'];function respondWithStatusCode(_0x40aa22,_0xf25135){_0xf25135=_0xf25135||0xcc;return function(_0xb75d8e){if(_0xb75d8e){return _0x40aa22[_0xf13a('0x19')](_0xf25135);}return _0x40aa22[_0xf13a('0x1a')](_0xf25135)[_0xf13a('0x1b')]();};}function respondWithResult(_0x3f5986,_0x1795d9){_0x1795d9=_0x1795d9||0xc8;return function(_0x140669){if(_0x140669){return _0x3f5986[_0xf13a('0x1a')](_0x1795d9)['json'](_0x140669);}};}function respondWithFilteredResult(_0x4cf038,_0x56dd48){return function(_0xc14de8){if(_0xc14de8){var _0x706c9=typeof _0x56dd48['offset']==='undefined'&&typeof _0x56dd48[_0xf13a('0x1c')]===_0xf13a('0x1d');var _0x13ff03=_0xc14de8[_0xf13a('0x1e')];var _0x336761=_0x706c9?0x0:_0x56dd48[_0xf13a('0x1f')];var _0x2f10a0=_0x706c9?_0xc14de8['count']:_0x56dd48[_0xf13a('0x1f')]+_0x56dd48['limit'];var _0x35dce0;if(_0x2f10a0>=_0x13ff03){_0x2f10a0=_0x13ff03;_0x35dce0=0xc8;}else{_0x35dce0=0xce;}_0x4cf038[_0xf13a('0x1a')](_0x35dce0);return _0x4cf038[_0xf13a('0x20')](_0xf13a('0x21'),_0x336761+'-'+_0x2f10a0+'/'+_0x13ff03)['json'](_0xc14de8);}return null;};}function patchUpdates(_0x7126e5){return function(_0x311b18){try{jsonpatch[_0xf13a('0x22')](_0x311b18,_0x7126e5,!![]);}catch(_0x5abf1c){return BPromise[_0xf13a('0x23')](_0x5abf1c);}return _0x311b18[_0xf13a('0x24')]();};}function saveUpdates(_0x300f8a,_0x2c6368){return function(_0x2eb138){if(_0x2eb138){return _0x2eb138[_0xf13a('0x25')](_0x300f8a)[_0xf13a('0x26')](function(_0x327754){return _0x327754;});}return null;};}function removeEntity(_0xc9e080,_0x117986){return function(_0x5be6c9){if(_0x5be6c9){return _0x5be6c9[_0xf13a('0x27')]()['then'](function(){_0xc9e080['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18df14,_0x278ef5){return function(_0x3da088){if(!_0x3da088){_0x18df14[_0xf13a('0x19')](0x194);}return _0x3da088;};}function handleError(_0x4b0713,_0x499299){_0x499299=_0x499299||0x1f4;return function(_0x580de5){logger[_0xf13a('0x28')](_0x580de5[_0xf13a('0x29')]);if(_0x580de5[_0xf13a('0x2a')]){delete _0x580de5[_0xf13a('0x2a')];}_0x4b0713['status'](_0x499299)[_0xf13a('0x2b')](_0x580de5);};}exports[_0xf13a('0x2c')]=function(_0x1cc058,_0x3363ef){var _0x3e4acd={},_0x441c6d={},_0x294f09={'count':0x0,'rows':[]};var _0x9c23dc=_[_0xf13a('0x2d')](db[_0xf13a('0x2e')][_0xf13a('0x2f')],function(_0x39203e){return{'name':_0x39203e[_0xf13a('0x30')],'type':_0x39203e['type'][_0xf13a('0x31')]};});_0x441c6d['model']=_[_0xf13a('0x2d')](_0x9c23dc,_0xf13a('0x2a'));_0x441c6d[_0xf13a('0x32')]=_[_0xf13a('0x33')](_0x1cc058[_0xf13a('0x32')]);_0x441c6d[_0xf13a('0x34')]=_[_0xf13a('0x35')](_0x441c6d[_0xf13a('0x36')],_0x441c6d[_0xf13a('0x32')]);_0x3e4acd['attributes']=_[_0xf13a('0x35')](_0x441c6d[_0xf13a('0x36')],qs['fields'](_0x1cc058[_0xf13a('0x32')][_0xf13a('0x37')]));_0x3e4acd[_0xf13a('0x38')]=_0x3e4acd['attributes']['length']?_0x3e4acd[_0xf13a('0x38')]:_0x441c6d[_0xf13a('0x36')];if(!_0x1cc058['query'][_0xf13a('0x39')]('nolimit')){_0x3e4acd['limit']=qs[_0xf13a('0x1c')](_0x1cc058[_0xf13a('0x32')][_0xf13a('0x1c')]);_0x3e4acd['offset']=qs[_0xf13a('0x1f')](_0x1cc058[_0xf13a('0x32')][_0xf13a('0x1f')]);}_0x3e4acd[_0xf13a('0x3a')]=qs[_0xf13a('0x3b')](_0x1cc058[_0xf13a('0x32')][_0xf13a('0x3b')]);_0x3e4acd[_0xf13a('0x3c')]=qs[_0xf13a('0x34')](_[_0xf13a('0x3d')](_0x1cc058[_0xf13a('0x32')],_0x441c6d['filters']),_0x9c23dc);if(_0x1cc058[_0xf13a('0x32')]['filter']){_0x3e4acd['where']=_[_0xf13a('0x3e')](_0x3e4acd[_0xf13a('0x3c')],{'$or':_[_0xf13a('0x2d')](_0x9c23dc,function(_0x4c12a2){if(_0x4c12a2['type']!==_0xf13a('0x3f')){var _0x150a71={};_0x150a71[_0x4c12a2[_0xf13a('0x2a')]]={'$like':'%'+_0x1cc058[_0xf13a('0x32')]['filter']+'%'};return _0x150a71;}})});}_0x3e4acd=_[_0xf13a('0x3e')]({},_0x3e4acd,_0x1cc058[_0xf13a('0x40')]);var _0x23d81={'where':_0x3e4acd['where']};return db['ServicenowField'][_0xf13a('0x1e')](_0x23d81)[_0xf13a('0x26')](function(_0x5a4f83){_0x294f09[_0xf13a('0x1e')]=_0x5a4f83;if(_0x1cc058[_0xf13a('0x32')][_0xf13a('0x41')]){_0x3e4acd[_0xf13a('0x42')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3e4acd);})['then'](function(_0x1d7e7b){_0x294f09[_0xf13a('0x43')]=_0x1d7e7b;return _0x294f09;})[_0xf13a('0x26')](respondWithFilteredResult(_0x3363ef,_0x3e4acd))[_0xf13a('0x44')](handleError(_0x3363ef,null));};exports[_0xf13a('0x45')]=function(_0x4fc257,_0x27dbb6){var _0x5916e5={'raw':!![],'where':{'id':_0x4fc257[_0xf13a('0x46')]['id']}},_0x440c15={};_0x440c15[_0xf13a('0x36')]=_[_0xf13a('0x33')](db[_0xf13a('0x2e')][_0xf13a('0x2f')]);_0x440c15[_0xf13a('0x32')]=_[_0xf13a('0x33')](_0x4fc257[_0xf13a('0x32')]);_0x440c15[_0xf13a('0x34')]=_[_0xf13a('0x35')](_0x440c15[_0xf13a('0x36')],_0x440c15['query']);_0x5916e5[_0xf13a('0x38')]=_[_0xf13a('0x35')](_0x440c15[_0xf13a('0x36')],qs[_0xf13a('0x37')](_0x4fc257['query']['fields']));_0x5916e5[_0xf13a('0x38')]=_0x5916e5[_0xf13a('0x38')]['length']?_0x5916e5[_0xf13a('0x38')]:_0x440c15[_0xf13a('0x36')];if(_0x4fc257['query'][_0xf13a('0x41')]){_0x5916e5[_0xf13a('0x42')]=[{'all':!![]}];}_0x5916e5=_[_0xf13a('0x3e')]({},_0x5916e5,_0x4fc257['options']);return db[_0xf13a('0x2e')][_0xf13a('0x47')](_0x5916e5)['then'](handleEntityNotFound(_0x27dbb6,null))[_0xf13a('0x26')](respondWithResult(_0x27dbb6,null))[_0xf13a('0x44')](handleError(_0x27dbb6,null));};exports[_0xf13a('0x48')]=function(_0x4cae4a,_0x4812d4){return db[_0xf13a('0x2e')][_0xf13a('0x48')](_0x4cae4a[_0xf13a('0x49')],{})[_0xf13a('0x26')](respondWithResult(_0x4812d4,0xc9))[_0xf13a('0x44')](handleError(_0x4812d4,null));};exports[_0xf13a('0x25')]=function(_0x485e43,_0x62197a){if(_0x485e43['body']['id']){delete _0x485e43[_0xf13a('0x49')]['id'];}return db[_0xf13a('0x2e')]['find']({'where':{'id':_0x485e43[_0xf13a('0x46')]['id']}})[_0xf13a('0x26')](handleEntityNotFound(_0x62197a,null))[_0xf13a('0x26')](saveUpdates(_0x485e43['body'],null))[_0xf13a('0x26')](respondWithResult(_0x62197a,null))[_0xf13a('0x44')](handleError(_0x62197a,null));};exports['destroy']=function(_0x47b254,_0x125a04){return db['ServicenowField'][_0xf13a('0x47')]({'where':{'id':_0x47b254[_0xf13a('0x46')]['id']}})[_0xf13a('0x26')](handleEntityNotFound(_0x125a04,null))[_0xf13a('0x26')](removeEntity(_0x125a04,null))[_0xf13a('0x44')](handleError(_0x125a04,null));}; \ No newline at end of file +var _0x7178=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','ServicenowField','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x367995,_0x129ae2){var _0x22daa8=function(_0x4a2ceb){while(--_0x4a2ceb){_0x367995['push'](_0x367995['shift']());}};_0x22daa8(++_0x129ae2);}(_0x7178,0xe0));var _0x8717=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7178[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x8717('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8717('0x1'));var jsonpatch=require(_0x8717('0x2'));var rp=require(_0x8717('0x3'));var moment=require(_0x8717('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8717('0x5'));var util=require(_0x8717('0x6'));var path=require(_0x8717('0x7'));var sox=require(_0x8717('0x8'));var csv=require(_0x8717('0x9'));var ejs=require(_0x8717('0xa'));var fs=require('fs');var fs_extra=require(_0x8717('0xb'));var _=require(_0x8717('0xc'));var squel=require(_0x8717('0xd'));var crypto=require(_0x8717('0xe'));var jsforce=require(_0x8717('0xf'));var deskjs=require(_0x8717('0x10'));var toCsv=require(_0x8717('0x9'));var querystring=require('querystring');var Papa=require(_0x8717('0x11'));var Redis=require(_0x8717('0x12'));var authService=require(_0x8717('0x13'));var qs=require(_0x8717('0x14'));var as=require(_0x8717('0x15'));var hardwareService=require(_0x8717('0x16'));var logger=require(_0x8717('0x17'))(_0x8717('0x18'));var utils=require('../../config/utils');var config=require(_0x8717('0x19'));var licenseUtil=require(_0x8717('0x1a'));var db=require(_0x8717('0x1b'))['db'];function respondWithStatusCode(_0x17dbc6,_0x40fc7d){_0x40fc7d=_0x40fc7d||0xcc;return function(_0x243e8f){if(_0x243e8f){return _0x17dbc6[_0x8717('0x1c')](_0x40fc7d);}return _0x17dbc6[_0x8717('0x1d')](_0x40fc7d)[_0x8717('0x1e')]();};}function respondWithResult(_0x3cfee8,_0x143bd3){_0x143bd3=_0x143bd3||0xc8;return function(_0x123b37){if(_0x123b37){return _0x3cfee8['status'](_0x143bd3)[_0x8717('0x1f')](_0x123b37);}};}function respondWithFilteredResult(_0x3e1af8,_0x36240d){return function(_0xaf0b1c){if(_0xaf0b1c){var _0x462648=typeof _0x36240d[_0x8717('0x20')]===_0x8717('0x21')&&typeof _0x36240d['limit']==='undefined';var _0x3fe443=_0xaf0b1c[_0x8717('0x22')];var _0x539de4=_0x462648?0x0:_0x36240d['offset'];var _0x349c79=_0x462648?_0xaf0b1c[_0x8717('0x22')]:_0x36240d['offset']+_0x36240d[_0x8717('0x23')];var _0x168298;if(_0x349c79>=_0x3fe443){_0x349c79=_0x3fe443;_0x168298=0xc8;}else{_0x168298=0xce;}_0x3e1af8[_0x8717('0x1d')](_0x168298);return _0x3e1af8[_0x8717('0x24')](_0x8717('0x25'),_0x539de4+'-'+_0x349c79+'/'+_0x3fe443)[_0x8717('0x1f')](_0xaf0b1c);}return null;};}function patchUpdates(_0x36b7b6){return function(_0x31d2b1){try{jsonpatch[_0x8717('0x26')](_0x31d2b1,_0x36b7b6,!![]);}catch(_0x27b842){return BPromise[_0x8717('0x27')](_0x27b842);}return _0x31d2b1[_0x8717('0x28')]();};}function saveUpdates(_0x800a59,_0x33c812){return function(_0x50516){if(_0x50516){return _0x50516[_0x8717('0x29')](_0x800a59)[_0x8717('0x2a')](function(_0x39be4d){return _0x39be4d;});}return null;};}function removeEntity(_0x4fa949,_0x2083bc){return function(_0x7436c){if(_0x7436c){return _0x7436c[_0x8717('0x2b')]()['then'](function(){_0x4fa949[_0x8717('0x1d')](0xcc)[_0x8717('0x1e')]();});}};}function handleEntityNotFound(_0x552250,_0x577250){return function(_0x524b8b){if(!_0x524b8b){_0x552250[_0x8717('0x1c')](0x194);}return _0x524b8b;};}function handleError(_0x2535bf,_0x151091){_0x151091=_0x151091||0x1f4;return function(_0x298881){logger[_0x8717('0x2c')](_0x298881[_0x8717('0x2d')]);if(_0x298881[_0x8717('0x2e')]){delete _0x298881['name'];}_0x2535bf['status'](_0x151091)['send'](_0x298881);};}exports['index']=function(_0x4e9eeb,_0xaa1633){var _0x5a5cc6={},_0x36d01a={},_0x4ae469={'count':0x0,'rows':[]};var _0xbbfc9=_[_0x8717('0x2f')](db['ServicenowField']['rawAttributes'],function(_0x4821d4){return{'name':_0x4821d4[_0x8717('0x30')],'type':_0x4821d4[_0x8717('0x31')][_0x8717('0x32')]};});_0x36d01a[_0x8717('0x33')]=_[_0x8717('0x2f')](_0xbbfc9,_0x8717('0x2e'));_0x36d01a[_0x8717('0x34')]=_[_0x8717('0x35')](_0x4e9eeb[_0x8717('0x34')]);_0x36d01a['filters']=_[_0x8717('0x36')](_0x36d01a[_0x8717('0x33')],_0x36d01a[_0x8717('0x34')]);_0x5a5cc6[_0x8717('0x37')]=_[_0x8717('0x36')](_0x36d01a[_0x8717('0x33')],qs[_0x8717('0x38')](_0x4e9eeb[_0x8717('0x34')]['fields']));_0x5a5cc6[_0x8717('0x37')]=_0x5a5cc6[_0x8717('0x37')][_0x8717('0x39')]?_0x5a5cc6[_0x8717('0x37')]:_0x36d01a['model'];if(!_0x4e9eeb['query'][_0x8717('0x3a')](_0x8717('0x3b'))){_0x5a5cc6['limit']=qs['limit'](_0x4e9eeb[_0x8717('0x34')][_0x8717('0x23')]);_0x5a5cc6[_0x8717('0x20')]=qs[_0x8717('0x20')](_0x4e9eeb[_0x8717('0x34')][_0x8717('0x20')]);}_0x5a5cc6[_0x8717('0x3c')]=qs[_0x8717('0x3d')](_0x4e9eeb[_0x8717('0x34')]['sort']);_0x5a5cc6[_0x8717('0x3e')]=qs[_0x8717('0x3f')](_[_0x8717('0x40')](_0x4e9eeb[_0x8717('0x34')],_0x36d01a[_0x8717('0x3f')]),_0xbbfc9);if(_0x4e9eeb['query'][_0x8717('0x41')]){_0x5a5cc6['where']=_['merge'](_0x5a5cc6[_0x8717('0x3e')],{'$or':_[_0x8717('0x2f')](_0xbbfc9,function(_0x38a2cf){if(_0x38a2cf[_0x8717('0x31')]!==_0x8717('0x42')){var _0x515dc7={};_0x515dc7[_0x38a2cf['name']]={'$like':'%'+_0x4e9eeb[_0x8717('0x34')]['filter']+'%'};return _0x515dc7;}})});}_0x5a5cc6=_[_0x8717('0x43')]({},_0x5a5cc6,_0x4e9eeb['options']);var _0x42e372={'where':_0x5a5cc6[_0x8717('0x3e')]};return db[_0x8717('0x44')]['count'](_0x42e372)[_0x8717('0x2a')](function(_0x38198c){_0x4ae469[_0x8717('0x22')]=_0x38198c;if(_0x4e9eeb[_0x8717('0x34')][_0x8717('0x45')]){_0x5a5cc6[_0x8717('0x46')]=[{'all':!![]}];}return db[_0x8717('0x44')]['findAll'](_0x5a5cc6);})[_0x8717('0x2a')](function(_0x56bb8d){_0x4ae469[_0x8717('0x47')]=_0x56bb8d;return _0x4ae469;})['then'](respondWithFilteredResult(_0xaa1633,_0x5a5cc6))[_0x8717('0x48')](handleError(_0xaa1633,null));};exports[_0x8717('0x49')]=function(_0x137da5,_0x2bc20c){var _0xeb9aaa={'raw':!![],'where':{'id':_0x137da5[_0x8717('0x4a')]['id']}},_0x4fc856={};_0x4fc856[_0x8717('0x33')]=_[_0x8717('0x35')](db[_0x8717('0x44')]['rawAttributes']);_0x4fc856[_0x8717('0x34')]=_['keys'](_0x137da5[_0x8717('0x34')]);_0x4fc856[_0x8717('0x3f')]=_['intersection'](_0x4fc856[_0x8717('0x33')],_0x4fc856[_0x8717('0x34')]);_0xeb9aaa[_0x8717('0x37')]=_['intersection'](_0x4fc856['model'],qs[_0x8717('0x38')](_0x137da5[_0x8717('0x34')]['fields']));_0xeb9aaa['attributes']=_0xeb9aaa[_0x8717('0x37')]['length']?_0xeb9aaa[_0x8717('0x37')]:_0x4fc856['model'];if(_0x137da5[_0x8717('0x34')][_0x8717('0x45')]){_0xeb9aaa[_0x8717('0x46')]=[{'all':!![]}];}_0xeb9aaa=_[_0x8717('0x43')]({},_0xeb9aaa,_0x137da5[_0x8717('0x4b')]);return db[_0x8717('0x44')][_0x8717('0x4c')](_0xeb9aaa)[_0x8717('0x2a')](handleEntityNotFound(_0x2bc20c,null))['then'](respondWithResult(_0x2bc20c,null))[_0x8717('0x48')](handleError(_0x2bc20c,null));};exports[_0x8717('0x4d')]=function(_0x173d69,_0x5bca95){return db[_0x8717('0x44')][_0x8717('0x4d')](_0x173d69[_0x8717('0x4e')],{})[_0x8717('0x2a')](respondWithResult(_0x5bca95,0xc9))[_0x8717('0x48')](handleError(_0x5bca95,null));};exports[_0x8717('0x29')]=function(_0x3809a4,_0x191243){if(_0x3809a4[_0x8717('0x4e')]['id']){delete _0x3809a4['body']['id'];}return db[_0x8717('0x44')][_0x8717('0x4c')]({'where':{'id':_0x3809a4[_0x8717('0x4a')]['id']}})[_0x8717('0x2a')](handleEntityNotFound(_0x191243,null))[_0x8717('0x2a')](saveUpdates(_0x3809a4[_0x8717('0x4e')],null))[_0x8717('0x2a')](respondWithResult(_0x191243,null))[_0x8717('0x48')](handleError(_0x191243,null));};exports[_0x8717('0x2b')]=function(_0x524de8,_0x4c8e77){return db[_0x8717('0x44')][_0x8717('0x4c')]({'where':{'id':_0x524de8[_0x8717('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c8e77,null))[_0x8717('0x2a')](removeEntity(_0x4c8e77,null))[_0x8717('0x48')](handleError(_0x4c8e77,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2d4dbfd..5ffecc0 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 _0x999e=['./intServicenowField.attributes','int_servicenow_fields','idField','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x999e,0x111));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe999('0x0'));var moment=require(_0xe999('0x1'));var BPromise=require(_0xe999('0x2'));var rp=require(_0xe999('0x3'));var fs=require('fs');var path=require(_0xe999('0x4'));var rimraf=require(_0xe999('0x5'));var config=require(_0xe999('0x6'));var attributes=require(_0xe999('0x7'));module['exports']=function(_0x1ea1a3,_0x467593){return _0x1ea1a3['define']('ServicenowField',attributes,{'tableName':_0xe999('0x8'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xe999('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7870=['int_servicenow_fields','servicenow_unique_index','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0x7870,0xf9));var _0x0787=function(_0x327537,_0x588cb0){_0x327537=_0x327537-0x0;var _0x390167=_0x7870[_0x327537];return _0x390167;};'use strict';var _=require(_0x0787('0x0'));var util=require(_0x0787('0x1'));var logger=require('../../config/logger')(_0x0787('0x2'));var moment=require(_0x0787('0x3'));var BPromise=require(_0x0787('0x4'));var rp=require(_0x0787('0x5'));var fs=require('fs');var path=require(_0x0787('0x6'));var rimraf=require('rimraf');var config=require(_0x0787('0x7'));var attributes=require(_0x0787('0x8'));module['exports']=function(_0x420292,_0x3e3c2b){return _0x420292[_0x0787('0x9')](_0x0787('0xa'),attributes,{'tableName':_0x0787('0xb'),'paranoid':![],'indexes':[{'name':_0x0787('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e5dc47c..840ee94 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 _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(_0xee4a21,_0x487b9d){var _0x1579fd=function(_0x4ea1dd){while(--_0x4ea1dd){_0xee4a21['push'](_0xee4a21['shift']());}};_0x1579fd(++_0x487b9d);}(_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 +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe955d,_0x21334b){var _0x504b38=function(_0x1bdb02){while(--_0x1bdb02){_0xe955d['push'](_0xe955d['shift']());}};_0x504b38(++_0x21334b);}(_0xe706,0xa3));var _0x6e70=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xe706[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 70e04d7..d84ac92 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x25cdc3,_0x4d3b77){var _0x19065f=function(_0x95b754){while(--_0x95b754){_0x25cdc3['push'](_0x25cdc3['shift']());}};_0x19065f(++_0x4d3b77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _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(_0x5004ab,_0x2dbfaa){var _0x34ec4b=function(_0x4e38e8){while(--_0x4e38e8){_0x5004ab['push'](_0x5004ab['shift']());}};_0x34ec4b(++_0x2dbfaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 7787f59..483a062 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(_0x4fabc3,_0x2ff4cf){var _0x408f76=function(_0x61c287){while(--_0x61c287){_0x4fabc3['push'](_0x4fabc3['shift']());}};_0x408f76(++_0x2ff4cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4e7def,_0x3a507e){var _0x41ab8d=function(_0x5abbe6){while(--_0x5abbe6){_0x4e7def['push'](_0x4e7def['shift']());}};_0x41ab8d(++_0x3a507e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 3fa09d1..a5af6e2 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 _0xa3f1=['json','apply','reject','save','then','sendStatus','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','update','destroy','getConfigurations','findOne','SugarcrmConfiguration','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','parent_id','parent_type','direction','remoteUri','slice','lastIndexOf','POST','format','login','JSON','stringify','username','password','PLAIN','Invalid\x20Login','%s%s','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x576fe0,_0x29de93){var _0x524bf4=function(_0x30d42e){while(--_0x30d42e){_0x576fe0['push'](_0x576fe0['shift']());}};_0x524bf4(++_0x29de93);}(_0xa3f1,0x1c7));var _0x1a3f=function(_0x42bb6a,_0x4cff39){_0x42bb6a=_0x42bb6a-0x0;var _0x3fada4=_0xa3f1[_0x42bb6a];return _0x3fada4;};'use strict';var emlformat=require(_0x1a3f('0x0'));var rimraf=require(_0x1a3f('0x1'));var zipdir=require(_0x1a3f('0x2'));var jsonpatch=require(_0x1a3f('0x3'));var rp=require(_0x1a3f('0x4'));var moment=require(_0x1a3f('0x5'));var BPromise=require(_0x1a3f('0x6'));var Mustache=require(_0x1a3f('0x7'));var util=require(_0x1a3f('0x8'));var path=require(_0x1a3f('0x9'));var sox=require(_0x1a3f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a3f('0xb'));var _=require(_0x1a3f('0xc'));var squel=require(_0x1a3f('0xd'));var crypto=require(_0x1a3f('0xe'));var jsforce=require(_0x1a3f('0xf'));var deskjs=require(_0x1a3f('0x10'));var toCsv=require(_0x1a3f('0x11'));var querystring=require(_0x1a3f('0x12'));var Papa=require(_0x1a3f('0x13'));var Redis=require(_0x1a3f('0x14'));var authService=require(_0x1a3f('0x15'));var qs=require(_0x1a3f('0x16'));var as=require(_0x1a3f('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a3f('0x18'))(_0x1a3f('0x19'));var utils=require(_0x1a3f('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x1a3f('0x1b'));var db=require(_0x1a3f('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x17b523,_0x4aee21){_0x4aee21=_0x4aee21||0xcc;return function(_0x303f22){if(_0x303f22){return _0x17b523['sendStatus'](_0x4aee21);}return _0x17b523[_0x1a3f('0x1d')](_0x4aee21)[_0x1a3f('0x1e')]();};}function respondWithResult(_0x3c3e11,_0x545b57){_0x545b57=_0x545b57||0xc8;return function(_0x4d17b0){if(_0x4d17b0){return _0x3c3e11[_0x1a3f('0x1d')](_0x545b57)['json'](_0x4d17b0);}};}function respondWithFilteredResult(_0x514543,_0x2f78fd){return function(_0x286086){if(_0x286086){var _0x211c00=typeof _0x2f78fd[_0x1a3f('0x1f')]===_0x1a3f('0x20')&&typeof _0x2f78fd[_0x1a3f('0x21')]===_0x1a3f('0x20');var _0x37d60c=_0x286086[_0x1a3f('0x22')];var _0x5161fe=_0x211c00?0x0:_0x2f78fd[_0x1a3f('0x1f')];var _0x3cf421=_0x211c00?_0x286086[_0x1a3f('0x22')]:_0x2f78fd[_0x1a3f('0x1f')]+_0x2f78fd[_0x1a3f('0x21')];var _0x2d77fd;if(_0x3cf421>=_0x37d60c){_0x3cf421=_0x37d60c;_0x2d77fd=0xc8;}else{_0x2d77fd=0xce;}_0x514543[_0x1a3f('0x1d')](_0x2d77fd);return _0x514543[_0x1a3f('0x23')](_0x1a3f('0x24'),_0x5161fe+'-'+_0x3cf421+'/'+_0x37d60c)[_0x1a3f('0x25')](_0x286086);}return null;};}function patchUpdates(_0x37c00f){return function(_0x302a45){try{jsonpatch[_0x1a3f('0x26')](_0x302a45,_0x37c00f,!![]);}catch(_0x535dac){return BPromise[_0x1a3f('0x27')](_0x535dac);}return _0x302a45[_0x1a3f('0x28')]();};}function saveUpdates(_0x3e8aaa,_0x101b1a){return function(_0x122094){if(_0x122094){return _0x122094['update'](_0x3e8aaa)[_0x1a3f('0x29')](function(_0x18e0b6){return _0x18e0b6;});}return null;};}function removeEntity(_0x1a5f7a,_0x1fa5f5){return function(_0x2d82bf){if(_0x2d82bf){return _0x2d82bf['destroy']()['then'](function(){_0x1a5f7a['status'](0xcc)[_0x1a3f('0x1e')]();});}};}function handleEntityNotFound(_0xdab99d,_0x1473c9){return function(_0x47c88c){if(!_0x47c88c){_0xdab99d[_0x1a3f('0x2a')](0x194);}return _0x47c88c;};}function handleError(_0x5e7025,_0x4e7411){_0x4e7411=_0x4e7411||0x1f4;return function(_0x17e3fb){logger['error'](_0x17e3fb['stack']);if(_0x17e3fb[_0x1a3f('0x2b')]){delete _0x17e3fb['name'];}_0x5e7025[_0x1a3f('0x1d')](_0x4e7411)[_0x1a3f('0x2c')](_0x17e3fb);};}exports[_0x1a3f('0x2d')]=function(_0x54cf74,_0x1845f8){var _0x10460a={},_0x1147dd={},_0x437f3c={'count':0x0,'rows':[]};var _0x500936=_[_0x1a3f('0x2e')](db[_0x1a3f('0x2f')][_0x1a3f('0x30')],function(_0x18e36a){return{'name':_0x18e36a[_0x1a3f('0x31')],'type':_0x18e36a[_0x1a3f('0x32')][_0x1a3f('0x33')]};});_0x1147dd[_0x1a3f('0x34')]=_[_0x1a3f('0x2e')](_0x500936,'name');_0x1147dd[_0x1a3f('0x35')]=_[_0x1a3f('0x36')](_0x54cf74['query']);_0x1147dd[_0x1a3f('0x37')]=_[_0x1a3f('0x38')](_0x1147dd[_0x1a3f('0x34')],_0x1147dd[_0x1a3f('0x35')]);_0x10460a['attributes']=_[_0x1a3f('0x38')](_0x1147dd[_0x1a3f('0x34')],qs[_0x1a3f('0x39')](_0x54cf74[_0x1a3f('0x35')][_0x1a3f('0x39')]));_0x10460a[_0x1a3f('0x3a')]=_0x10460a[_0x1a3f('0x3a')]['length']?_0x10460a['attributes']:_0x1147dd[_0x1a3f('0x34')];if(!_0x54cf74[_0x1a3f('0x35')][_0x1a3f('0x3b')](_0x1a3f('0x3c'))){_0x10460a[_0x1a3f('0x21')]=qs[_0x1a3f('0x21')](_0x54cf74[_0x1a3f('0x35')][_0x1a3f('0x21')]);_0x10460a[_0x1a3f('0x1f')]=qs['offset'](_0x54cf74['query'][_0x1a3f('0x1f')]);}_0x10460a[_0x1a3f('0x3d')]=qs['sort'](_0x54cf74['query'][_0x1a3f('0x3e')]);_0x10460a[_0x1a3f('0x3f')]=qs['filters'](_[_0x1a3f('0x40')](_0x54cf74[_0x1a3f('0x35')],_0x1147dd['filters']),_0x500936);if(_0x54cf74['query'][_0x1a3f('0x41')]){_0x10460a[_0x1a3f('0x3f')]=_['merge'](_0x10460a['where'],{'$or':_[_0x1a3f('0x2e')](_0x500936,function(_0x30b841){if(_0x30b841[_0x1a3f('0x32')]!==_0x1a3f('0x42')){var _0x44b2b2={};_0x44b2b2[_0x30b841[_0x1a3f('0x2b')]]={'$like':'%'+_0x54cf74[_0x1a3f('0x35')]['filter']+'%'};return _0x44b2b2;}})});}_0x10460a=_[_0x1a3f('0x43')]({},_0x10460a,_0x54cf74[_0x1a3f('0x44')]);var _0x46839d={'where':_0x10460a[_0x1a3f('0x3f')]};return db[_0x1a3f('0x2f')][_0x1a3f('0x22')](_0x46839d)[_0x1a3f('0x29')](function(_0x2c5ce3){_0x437f3c['count']=_0x2c5ce3;if(_0x54cf74['query'][_0x1a3f('0x45')]){_0x10460a[_0x1a3f('0x46')]=[{'all':!![]}];}return db[_0x1a3f('0x2f')][_0x1a3f('0x47')](_0x10460a);})[_0x1a3f('0x29')](function(_0x55033f){_0x437f3c['rows']=_0x55033f;return _0x437f3c;})[_0x1a3f('0x29')](respondWithFilteredResult(_0x1845f8,_0x10460a))[_0x1a3f('0x48')](handleError(_0x1845f8,null));};exports[_0x1a3f('0x49')]=function(_0x2d2b9b,_0x32afec){var _0x4f4a9c={'raw':![],'where':{'id':_0x2d2b9b[_0x1a3f('0x4a')]['id']}},_0x1d2bb6={};_0x1d2bb6[_0x1a3f('0x34')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x1d2bb6[_0x1a3f('0x35')]=_[_0x1a3f('0x36')](_0x2d2b9b[_0x1a3f('0x35')]);_0x1d2bb6[_0x1a3f('0x37')]=_['intersection'](_0x1d2bb6[_0x1a3f('0x34')],_0x1d2bb6[_0x1a3f('0x35')]);_0x4f4a9c['attributes']=_[_0x1a3f('0x38')](_0x1d2bb6[_0x1a3f('0x34')],qs['fields'](_0x2d2b9b[_0x1a3f('0x35')]['fields']));_0x4f4a9c[_0x1a3f('0x3a')]=_0x4f4a9c[_0x1a3f('0x3a')][_0x1a3f('0x4b')]?_0x4f4a9c[_0x1a3f('0x3a')]:_0x1d2bb6[_0x1a3f('0x34')];if(_0x2d2b9b[_0x1a3f('0x35')][_0x1a3f('0x45')]){_0x4f4a9c[_0x1a3f('0x46')]=[{'all':!![]}];}_0x4f4a9c=_[_0x1a3f('0x43')]({},_0x4f4a9c,_0x2d2b9b[_0x1a3f('0x44')]);return db['SugarcrmAccount'][_0x1a3f('0x4c')](_0x4f4a9c)[_0x1a3f('0x29')](handleEntityNotFound(_0x32afec,null))[_0x1a3f('0x29')](respondWithResult(_0x32afec,null))['catch'](handleError(_0x32afec,null));};exports[_0x1a3f('0x4d')]=function(_0x33fac5,_0x770de3){return db[_0x1a3f('0x2f')][_0x1a3f('0x4d')](_0x33fac5[_0x1a3f('0x4e')],{})[_0x1a3f('0x29')](respondWithResult(_0x770de3,0xc9))[_0x1a3f('0x48')](handleError(_0x770de3,null));};exports[_0x1a3f('0x4f')]=function(_0x4d7c1e,_0x1dce79){if(_0x4d7c1e[_0x1a3f('0x4e')]['id']){delete _0x4d7c1e[_0x1a3f('0x4e')]['id'];}return db['SugarcrmAccount'][_0x1a3f('0x4c')]({'where':{'id':_0x4d7c1e['params']['id']}})['then'](handleEntityNotFound(_0x1dce79,null))['then'](saveUpdates(_0x4d7c1e['body'],null))[_0x1a3f('0x29')](respondWithResult(_0x1dce79,null))[_0x1a3f('0x48')](handleError(_0x1dce79,null));};exports[_0x1a3f('0x50')]=function(_0x4acb8c,_0x12a057){return db[_0x1a3f('0x2f')][_0x1a3f('0x4c')]({'where':{'id':_0x4acb8c['params']['id']}})[_0x1a3f('0x29')](handleEntityNotFound(_0x12a057,null))[_0x1a3f('0x29')](removeEntity(_0x12a057,null))[_0x1a3f('0x48')](handleError(_0x12a057,null));};exports[_0x1a3f('0x51')]=function(_0x2bce22,_0x23a282,_0x2b8d3d){var _0x3a8c34={};var _0x45bf3e={};var _0x5ed8ba;var _0x598d71;return db[_0x1a3f('0x2f')][_0x1a3f('0x52')]({'where':{'id':_0x2bce22[_0x1a3f('0x4a')]['id']}})[_0x1a3f('0x29')](handleEntityNotFound(_0x23a282,null))[_0x1a3f('0x29')](function(_0x48a746){if(_0x48a746){_0x5ed8ba=_0x48a746;_0x45bf3e[_0x1a3f('0x34')]=_[_0x1a3f('0x36')](db[_0x1a3f('0x53')][_0x1a3f('0x30')]);_0x45bf3e[_0x1a3f('0x35')]=_[_0x1a3f('0x36')](_0x2bce22[_0x1a3f('0x35')]);_0x45bf3e[_0x1a3f('0x37')]=_['intersection'](_0x45bf3e['model'],_0x45bf3e['query']);_0x3a8c34['attributes']=_[_0x1a3f('0x38')](_0x45bf3e[_0x1a3f('0x34')],qs[_0x1a3f('0x39')](_0x2bce22[_0x1a3f('0x35')]['fields']));_0x3a8c34[_0x1a3f('0x3a')]=_0x3a8c34['attributes'][_0x1a3f('0x4b')]?_0x3a8c34[_0x1a3f('0x3a')]:_0x45bf3e[_0x1a3f('0x34')];_0x3a8c34[_0x1a3f('0x3d')]=qs['sort'](_0x2bce22['query'][_0x1a3f('0x3e')]);_0x3a8c34[_0x1a3f('0x3f')]=qs[_0x1a3f('0x37')](_['pick'](_0x2bce22[_0x1a3f('0x35')],_0x45bf3e[_0x1a3f('0x37')]));if(_0x2bce22[_0x1a3f('0x35')][_0x1a3f('0x41')]){_0x3a8c34['where']=_[_0x1a3f('0x43')](_0x3a8c34['where'],{'$or':_[_0x1a3f('0x2e')](_0x3a8c34[_0x1a3f('0x3a')],function(_0x19676f){var _0x9bbb85={};_0x9bbb85[_0x19676f]={'$like':'%'+_0x2bce22[_0x1a3f('0x35')]['filter']+'%'};return _0x9bbb85;})});}_0x3a8c34=_[_0x1a3f('0x43')]({},_0x3a8c34,_0x2bce22[_0x1a3f('0x44')]);return _0x5ed8ba[_0x1a3f('0x51')](_0x3a8c34);}})[_0x1a3f('0x29')](function(_0x82c54b){if(_0x82c54b){_0x598d71=_0x82c54b[_0x1a3f('0x4b')];if(!_0x2bce22['query']['hasOwnProperty'](_0x1a3f('0x3c'))){_0x3a8c34[_0x1a3f('0x21')]=qs['limit'](_0x2bce22[_0x1a3f('0x35')][_0x1a3f('0x21')]);_0x3a8c34[_0x1a3f('0x1f')]=qs[_0x1a3f('0x1f')](_0x2bce22[_0x1a3f('0x35')][_0x1a3f('0x1f')]);}return _0x5ed8ba[_0x1a3f('0x51')](_0x3a8c34);}})[_0x1a3f('0x29')](function(_0x45a83f){if(_0x45a83f){return _0x45a83f?{'count':_0x598d71,'rows':_0x45a83f}:null;}})['then'](respondWithResult(_0x23a282,null))['catch'](handleError(_0x23a282,null));};exports['addConfiguration']=function(_0x20df81,_0x52291a,_0x1e26d2){if(_0x20df81[_0x1a3f('0x4e')]['id']){delete _0x20df81[_0x1a3f('0x4e')]['id'];}return db['SugarcrmAccount'][_0x1a3f('0x52')]({'where':{'id':_0x20df81[_0x1a3f('0x4a')]['id']}})[_0x1a3f('0x29')](handleEntityNotFound(_0x52291a,null))[_0x1a3f('0x29')](function(_0x44baf2){if(_0x44baf2){_0x20df81['body']['AccountId']=_0x44baf2['id'];_0x20df81[_0x1a3f('0x4e')][_0x1a3f('0x54')]=integrations[_0x1a3f('0x55')](_0x20df81[_0x1a3f('0x4e')][_0x1a3f('0x56')],_0x20df81[_0x1a3f('0x4e')][_0x1a3f('0x32')]);_0x20df81[_0x1a3f('0x4e')]['Descriptions']=integrations[_0x1a3f('0x57')](_0x20df81['body'][_0x1a3f('0x56')],_0x20df81[_0x1a3f('0x4e')][_0x1a3f('0x32')]);return db[_0x1a3f('0x53')]['create'](_0x20df81['body'],{'include':[{'model':db[_0x1a3f('0x58')],'as':_0x1a3f('0x54')},{'model':db[_0x1a3f('0x58')],'as':'Descriptions'}]});}return null;})[_0x1a3f('0x29')](respondWithResult(_0x52291a,null))[_0x1a3f('0x48')](handleError(_0x52291a,null));};exports[_0x1a3f('0x59')]=function(_0x5c3f19,_0x8c8c5e,_0xd62391){var _0x3bd62f='';var _0xe44872=['id','name','assigned_user_id',_0x1a3f('0x5a'),_0x1a3f('0x5b'),_0x1a3f('0x5c'),'duration_hours','duration_minutes',_0x1a3f('0x5d'),_0x1a3f('0x5e'),'parent_name',_0x1a3f('0x5f')];return db[_0x1a3f('0x2f')][_0x1a3f('0x52')]({'where':{'id':_0x5c3f19[_0x1a3f('0x4a')]['id']},'attributes':['id','username','password',_0x1a3f('0x60')]})['then'](handleEntityNotFound(_0x8c8c5e,null))[_0x1a3f('0x29')](function(_0x17f721){if(_0x17f721){_0x3bd62f=_0x17f721[_0x1a3f('0x60')];var _0x2fd389=_0x3bd62f[_0x1a3f('0x61')](-0x1);if(_0x2fd389==='/'){_0x3bd62f=_0x3bd62f['substring'](0x0,_0x3bd62f[_0x1a3f('0x62')](_0x2fd389));}return rp({'method':_0x1a3f('0x63'),'uri':util[_0x1a3f('0x64')]('%s%s',_0x3bd62f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1a3f('0x65'),'input_type':_0x1a3f('0x66'),'response_type':_0x1a3f('0x66'),'rest_data':JSON[_0x1a3f('0x67')]({'user_auth':{'user_name':_0x17f721[_0x1a3f('0x68')],'password':_0x17f721[_0x1a3f('0x69')],'encryption':_0x1a3f('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1a3f('0x29')](function(_0xde4cd2){if(_0xde4cd2&&_0xde4cd2['name']!==_0x1a3f('0x6b')&&_0xde4cd2[_0x1a3f('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x1a3f('0x63'),'uri':util[_0x1a3f('0x64')](_0x1a3f('0x6c'),_0x3bd62f,_0x1a3f('0x6d')),'json':!![],'form':{'method':_0x1a3f('0x6e'),'input_type':'JSON','response_type':_0x1a3f('0x66'),'rest_data':JSON[_0x1a3f('0x67')]({'session':_0xde4cd2['id'],'module_name':_0x1a3f('0x6f')})}})[_0x1a3f('0x29')](function(_0x9c6cf2){if(_0x9c6cf2){var _0x4ecb71=_[_0x1a3f('0x70')](_0x9c6cf2[_0x1a3f('0x71')]);_[_0x1a3f('0x72')](_0x4ecb71,function(_0x54b32a){return _0xe44872[_0x1a3f('0x73')](_0x54b32a['name']);});return{'count':_0x4ecb71[_0x1a3f('0x4b')],'rows':_[_0x1a3f('0x2e')](_0x4ecb71,function(_0x2b4440){return{'id':_0x2b4440[_0x1a3f('0x2b')],'name':_0x2b4440[_0x1a3f('0x74')],'custom':_[_0x1a3f('0x75')](_0x2b4440[_0x1a3f('0x2b')],'_c')?!![]:![],'options':_0x2b4440[_0x1a3f('0x44')]?_[_0x1a3f('0x2e')](_[_0x1a3f('0x70')](_0x2b4440[_0x1a3f('0x44')]),function(_0x537a07){return{'name':_0x537a07['value'],'value':_0x537a07['name']};}):[]};})};}})[_0x1a3f('0x29')](respondWithResult(_0x8c8c5e,null))[_0x1a3f('0x48')](function(_0x560af3){var _0x1e62c9=_0x5c3f19[_0x1a3f('0x35')][_0x1a3f('0x76')]?0x1f4:_0x560af3[_0x1a3f('0x77')]||0x1f4;logger[_0x1a3f('0x78')](_0x1a3f('0x79'),_0x1a3f('0x59'),_0x1e62c9,JSON[_0x1a3f('0x67')](_0x560af3));delete _0x560af3['name'];if(_0x1e62c9===0x191){_0x1e62c9=0x190;}_0x8c8c5e['status'](_0x1e62c9)[_0x1a3f('0x2c')](_0x5c3f19[_0x1a3f('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x560af3[_0x1a3f('0x77')]}:_0x560af3);});}else{var _0x19f57b=0x1f4;_0x8c8c5e[_0x1a3f('0x1d')](_0x19f57b)[_0x1a3f('0x2c')]({'message':_0x1a3f('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8886=['catch','show','params','fields','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','stringify','Calls','values','module_fields','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x430d57,_0x403601){var _0x2d4d55=function(_0x44d365){while(--_0x44d365){_0x430d57['push'](_0x430d57['shift']());}};_0x2d4d55(++_0x403601);}(_0x8886,0xa9));var _0x6888=function(_0x546de0,_0xa8df16){_0x546de0=_0x546de0-0x0;var _0x2c1990=_0x8886[_0x546de0];return _0x2c1990;};'use strict';var emlformat=require(_0x6888('0x0'));var rimraf=require(_0x6888('0x1'));var zipdir=require(_0x6888('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6888('0x3'));var BPromise=require(_0x6888('0x4'));var Mustache=require(_0x6888('0x5'));var util=require(_0x6888('0x6'));var path=require('path');var sox=require(_0x6888('0x7'));var csv=require(_0x6888('0x8'));var ejs=require(_0x6888('0x9'));var fs=require('fs');var fs_extra=require(_0x6888('0xa'));var _=require(_0x6888('0xb'));var squel=require('squel');var crypto=require(_0x6888('0xc'));var jsforce=require(_0x6888('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6888('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6888('0xe'));var qs=require(_0x6888('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6888('0x10'));var logger=require(_0x6888('0x11'))(_0x6888('0x12'));var utils=require(_0x6888('0x13'));var config=require(_0x6888('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6888('0x15'))['db'];var integrations=require(_0x6888('0x16'));function respondWithStatusCode(_0xc3e113,_0x4b446d){_0x4b446d=_0x4b446d||0xcc;return function(_0xdbad5e){if(_0xdbad5e){return _0xc3e113[_0x6888('0x17')](_0x4b446d);}return _0xc3e113[_0x6888('0x18')](_0x4b446d)[_0x6888('0x19')]();};}function respondWithResult(_0x31679c,_0x1f78ef){_0x1f78ef=_0x1f78ef||0xc8;return function(_0x144ee1){if(_0x144ee1){return _0x31679c[_0x6888('0x18')](_0x1f78ef)['json'](_0x144ee1);}};}function respondWithFilteredResult(_0x1384f8,_0x3bfd2b){return function(_0x475c97){if(_0x475c97){var _0x5d65f6=typeof _0x3bfd2b[_0x6888('0x1a')]===_0x6888('0x1b')&&typeof _0x3bfd2b[_0x6888('0x1c')]==='undefined';var _0x559e4e=_0x475c97['count'];var _0x264725=_0x5d65f6?0x0:_0x3bfd2b['offset'];var _0x5f2a79=_0x5d65f6?_0x475c97[_0x6888('0x1d')]:_0x3bfd2b[_0x6888('0x1a')]+_0x3bfd2b[_0x6888('0x1c')];var _0x51d8fa;if(_0x5f2a79>=_0x559e4e){_0x5f2a79=_0x559e4e;_0x51d8fa=0xc8;}else{_0x51d8fa=0xce;}_0x1384f8[_0x6888('0x18')](_0x51d8fa);return _0x1384f8[_0x6888('0x1e')](_0x6888('0x1f'),_0x264725+'-'+_0x5f2a79+'/'+_0x559e4e)['json'](_0x475c97);}return null;};}function patchUpdates(_0x4017cd){return function(_0x4f1bf1){try{jsonpatch['apply'](_0x4f1bf1,_0x4017cd,!![]);}catch(_0x3f78f4){return BPromise[_0x6888('0x20')](_0x3f78f4);}return _0x4f1bf1[_0x6888('0x21')]();};}function saveUpdates(_0x1a5ae8,_0x3de320){return function(_0x2c8527){if(_0x2c8527){return _0x2c8527[_0x6888('0x22')](_0x1a5ae8)[_0x6888('0x23')](function(_0x2b4ddd){return _0x2b4ddd;});}return null;};}function removeEntity(_0x56bbdf,_0xbb4876){return function(_0x42fd4c){if(_0x42fd4c){return _0x42fd4c[_0x6888('0x24')]()['then'](function(){_0x56bbdf[_0x6888('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585275,_0x348409){return function(_0x339323){if(!_0x339323){_0x585275[_0x6888('0x17')](0x194);}return _0x339323;};}function handleError(_0xb107ae,_0x5db6c2){_0x5db6c2=_0x5db6c2||0x1f4;return function(_0x391937){logger[_0x6888('0x25')](_0x391937[_0x6888('0x26')]);if(_0x391937['name']){delete _0x391937[_0x6888('0x27')];}_0xb107ae[_0x6888('0x18')](_0x5db6c2)[_0x6888('0x28')](_0x391937);};}exports['index']=function(_0x42ddda,_0x2ed404){var _0x5e7a72={},_0x50ff5a={},_0x12c4b7={'count':0x0,'rows':[]};var _0x11d9a3=_[_0x6888('0x29')](db[_0x6888('0x2a')][_0x6888('0x2b')],function(_0x38a630){return{'name':_0x38a630[_0x6888('0x2c')],'type':_0x38a630[_0x6888('0x2d')][_0x6888('0x2e')]};});_0x50ff5a[_0x6888('0x2f')]=_['map'](_0x11d9a3,_0x6888('0x27'));_0x50ff5a['query']=_[_0x6888('0x30')](_0x42ddda['query']);_0x50ff5a['filters']=_[_0x6888('0x31')](_0x50ff5a[_0x6888('0x2f')],_0x50ff5a[_0x6888('0x32')]);_0x5e7a72['attributes']=_['intersection'](_0x50ff5a[_0x6888('0x2f')],qs['fields'](_0x42ddda[_0x6888('0x32')]['fields']));_0x5e7a72[_0x6888('0x33')]=_0x5e7a72[_0x6888('0x33')][_0x6888('0x34')]?_0x5e7a72[_0x6888('0x33')]:_0x50ff5a[_0x6888('0x2f')];if(!_0x42ddda['query']['hasOwnProperty'](_0x6888('0x35'))){_0x5e7a72[_0x6888('0x1c')]=qs[_0x6888('0x1c')](_0x42ddda[_0x6888('0x32')][_0x6888('0x1c')]);_0x5e7a72[_0x6888('0x1a')]=qs[_0x6888('0x1a')](_0x42ddda[_0x6888('0x32')]['offset']);}_0x5e7a72[_0x6888('0x36')]=qs[_0x6888('0x37')](_0x42ddda[_0x6888('0x32')][_0x6888('0x37')]);_0x5e7a72[_0x6888('0x38')]=qs[_0x6888('0x39')](_[_0x6888('0x3a')](_0x42ddda[_0x6888('0x32')],_0x50ff5a[_0x6888('0x39')]),_0x11d9a3);if(_0x42ddda[_0x6888('0x32')][_0x6888('0x3b')]){_0x5e7a72[_0x6888('0x38')]=_[_0x6888('0x3c')](_0x5e7a72[_0x6888('0x38')],{'$or':_[_0x6888('0x29')](_0x11d9a3,function(_0x2e8b29){if(_0x2e8b29[_0x6888('0x2d')]!==_0x6888('0x3d')){var _0x247b51={};_0x247b51[_0x2e8b29['name']]={'$like':'%'+_0x42ddda['query'][_0x6888('0x3b')]+'%'};return _0x247b51;}})});}_0x5e7a72=_[_0x6888('0x3c')]({},_0x5e7a72,_0x42ddda[_0x6888('0x3e')]);var _0x36a02d={'where':_0x5e7a72[_0x6888('0x38')]};return db[_0x6888('0x2a')][_0x6888('0x1d')](_0x36a02d)['then'](function(_0x4be169){_0x12c4b7[_0x6888('0x1d')]=_0x4be169;if(_0x42ddda['query'][_0x6888('0x3f')]){_0x5e7a72[_0x6888('0x40')]=[{'all':!![]}];}return db[_0x6888('0x2a')][_0x6888('0x41')](_0x5e7a72);})['then'](function(_0x3a8b5c){_0x12c4b7[_0x6888('0x42')]=_0x3a8b5c;return _0x12c4b7;})[_0x6888('0x23')](respondWithFilteredResult(_0x2ed404,_0x5e7a72))[_0x6888('0x43')](handleError(_0x2ed404,null));};exports[_0x6888('0x44')]=function(_0x1efebf,_0x329881){var _0x59fa05={'raw':![],'where':{'id':_0x1efebf[_0x6888('0x45')]['id']}},_0x42d7f0={};_0x42d7f0[_0x6888('0x2f')]=_[_0x6888('0x30')](db[_0x6888('0x2a')][_0x6888('0x2b')]);_0x42d7f0[_0x6888('0x32')]=_[_0x6888('0x30')](_0x1efebf['query']);_0x42d7f0[_0x6888('0x39')]=_['intersection'](_0x42d7f0['model'],_0x42d7f0['query']);_0x59fa05[_0x6888('0x33')]=_['intersection'](_0x42d7f0[_0x6888('0x2f')],qs[_0x6888('0x46')](_0x1efebf[_0x6888('0x32')][_0x6888('0x46')]));_0x59fa05[_0x6888('0x33')]=_0x59fa05['attributes'][_0x6888('0x34')]?_0x59fa05[_0x6888('0x33')]:_0x42d7f0['model'];if(_0x1efebf['query'][_0x6888('0x3f')]){_0x59fa05['include']=[{'all':!![]}];}_0x59fa05=_[_0x6888('0x3c')]({},_0x59fa05,_0x1efebf[_0x6888('0x3e')]);return db[_0x6888('0x2a')]['find'](_0x59fa05)[_0x6888('0x23')](handleEntityNotFound(_0x329881,null))[_0x6888('0x23')](respondWithResult(_0x329881,null))[_0x6888('0x43')](handleError(_0x329881,null));};exports[_0x6888('0x47')]=function(_0x3cde89,_0x4216d7){return db['SugarcrmAccount'][_0x6888('0x47')](_0x3cde89['body'],{})[_0x6888('0x23')](respondWithResult(_0x4216d7,0xc9))[_0x6888('0x43')](handleError(_0x4216d7,null));};exports['update']=function(_0xfa654b,_0x3ccf5f){if(_0xfa654b[_0x6888('0x48')]['id']){delete _0xfa654b[_0x6888('0x48')]['id'];}return db[_0x6888('0x2a')][_0x6888('0x49')]({'where':{'id':_0xfa654b[_0x6888('0x45')]['id']}})[_0x6888('0x23')](handleEntityNotFound(_0x3ccf5f,null))[_0x6888('0x23')](saveUpdates(_0xfa654b['body'],null))['then'](respondWithResult(_0x3ccf5f,null))[_0x6888('0x43')](handleError(_0x3ccf5f,null));};exports[_0x6888('0x24')]=function(_0x261d7f,_0xdf48ed){return db[_0x6888('0x2a')][_0x6888('0x49')]({'where':{'id':_0x261d7f[_0x6888('0x45')]['id']}})['then'](handleEntityNotFound(_0xdf48ed,null))[_0x6888('0x23')](removeEntity(_0xdf48ed,null))[_0x6888('0x43')](handleError(_0xdf48ed,null));};exports[_0x6888('0x4a')]=function(_0x236cda,_0x5350fe,_0x46a555){var _0xc71172={};var _0x24b78b={};var _0x30939d;var _0x2dc8f2;return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x236cda[_0x6888('0x45')]['id']}})['then'](handleEntityNotFound(_0x5350fe,null))[_0x6888('0x23')](function(_0x189885){if(_0x189885){_0x30939d=_0x189885;_0x24b78b['model']=_[_0x6888('0x30')](db[_0x6888('0x4c')][_0x6888('0x2b')]);_0x24b78b[_0x6888('0x32')]=_[_0x6888('0x30')](_0x236cda['query']);_0x24b78b[_0x6888('0x39')]=_[_0x6888('0x31')](_0x24b78b['model'],_0x24b78b[_0x6888('0x32')]);_0xc71172[_0x6888('0x33')]=_['intersection'](_0x24b78b[_0x6888('0x2f')],qs['fields'](_0x236cda[_0x6888('0x32')][_0x6888('0x46')]));_0xc71172['attributes']=_0xc71172[_0x6888('0x33')][_0x6888('0x34')]?_0xc71172[_0x6888('0x33')]:_0x24b78b[_0x6888('0x2f')];_0xc71172['order']=qs['sort'](_0x236cda['query']['sort']);_0xc71172['where']=qs[_0x6888('0x39')](_[_0x6888('0x3a')](_0x236cda[_0x6888('0x32')],_0x24b78b[_0x6888('0x39')]));if(_0x236cda['query']['filter']){_0xc71172[_0x6888('0x38')]=_[_0x6888('0x3c')](_0xc71172[_0x6888('0x38')],{'$or':_[_0x6888('0x29')](_0xc71172[_0x6888('0x33')],function(_0x272106){var _0x3fc67b={};_0x3fc67b[_0x272106]={'$like':'%'+_0x236cda[_0x6888('0x32')][_0x6888('0x3b')]+'%'};return _0x3fc67b;})});}_0xc71172=_['merge']({},_0xc71172,_0x236cda['options']);return _0x30939d[_0x6888('0x4a')](_0xc71172);}})[_0x6888('0x23')](function(_0x391af1){if(_0x391af1){_0x2dc8f2=_0x391af1['length'];if(!_0x236cda['query']['hasOwnProperty'](_0x6888('0x35'))){_0xc71172[_0x6888('0x1c')]=qs[_0x6888('0x1c')](_0x236cda[_0x6888('0x32')][_0x6888('0x1c')]);_0xc71172[_0x6888('0x1a')]=qs[_0x6888('0x1a')](_0x236cda[_0x6888('0x32')][_0x6888('0x1a')]);}return _0x30939d[_0x6888('0x4a')](_0xc71172);}})['then'](function(_0x33383a){if(_0x33383a){return _0x33383a?{'count':_0x2dc8f2,'rows':_0x33383a}:null;}})[_0x6888('0x23')](respondWithResult(_0x5350fe,null))['catch'](handleError(_0x5350fe,null));};exports['addConfiguration']=function(_0x21b385,_0x41e6d4,_0xc8d8a){if(_0x21b385['body']['id']){delete _0x21b385[_0x6888('0x48')]['id'];}return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x21b385['params']['id']}})[_0x6888('0x23')](handleEntityNotFound(_0x41e6d4,null))[_0x6888('0x23')](function(_0x57e840){if(_0x57e840){_0x21b385[_0x6888('0x48')][_0x6888('0x4d')]=_0x57e840['id'];_0x21b385[_0x6888('0x48')][_0x6888('0x4e')]=integrations['getSubjects'](_0x21b385[_0x6888('0x48')][_0x6888('0x4f')],_0x21b385[_0x6888('0x48')][_0x6888('0x2d')]);_0x21b385[_0x6888('0x48')]['Descriptions']=integrations[_0x6888('0x50')](_0x21b385[_0x6888('0x48')][_0x6888('0x4f')],_0x21b385[_0x6888('0x48')]['type']);return db[_0x6888('0x4c')]['create'](_0x21b385[_0x6888('0x48')],{'include':[{'model':db[_0x6888('0x51')],'as':_0x6888('0x4e')},{'model':db['SugarcrmField'],'as':_0x6888('0x52')}]});}return null;})['then'](respondWithResult(_0x41e6d4,null))[_0x6888('0x43')](handleError(_0x41e6d4,null));};exports[_0x6888('0x53')]=function(_0x5539d2,_0x26b789,_0x564452){var _0x335742='';var _0x15216d=['id','name',_0x6888('0x54'),'created_by',_0x6888('0x55'),_0x6888('0x56'),_0x6888('0x57'),_0x6888('0x58'),_0x6888('0x59'),'parent_type',_0x6888('0x5a'),_0x6888('0x5b')];return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x5539d2[_0x6888('0x45')]['id']},'attributes':['id',_0x6888('0x5c'),_0x6888('0x5d'),_0x6888('0x5e')]})[_0x6888('0x23')](handleEntityNotFound(_0x26b789,null))['then'](function(_0x191837){if(_0x191837){_0x335742=_0x191837[_0x6888('0x5e')];var _0x41cfe4=_0x335742['slice'](-0x1);if(_0x41cfe4==='/'){_0x335742=_0x335742[_0x6888('0x5f')](0x0,_0x335742[_0x6888('0x60')](_0x41cfe4));}return rp({'method':_0x6888('0x61'),'uri':util[_0x6888('0x62')](_0x6888('0x63'),_0x335742,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6888('0x64'),'input_type':_0x6888('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x191837[_0x6888('0x5c')],'password':_0x191837['password'],'encryption':_0x6888('0x66')},'application':_0x6888('0x67')})}});}})['then'](function(_0x40c574){if(_0x40c574&&_0x40c574['name']!==_0x6888('0x68')&&_0x40c574[_0x6888('0x27')]!==_0x6888('0x69')){return rp({'method':_0x6888('0x61'),'uri':util['format'](_0x6888('0x63'),_0x335742,_0x6888('0x6a')),'json':!![],'form':{'method':_0x6888('0x6b'),'input_type':'JSON','response_type':_0x6888('0x65'),'rest_data':JSON[_0x6888('0x6c')]({'session':_0x40c574['id'],'module_name':_0x6888('0x6d')})}})[_0x6888('0x23')](function(_0x50b232){if(_0x50b232){var _0x56ed33=_[_0x6888('0x6e')](_0x50b232[_0x6888('0x6f')]);_['remove'](_0x56ed33,function(_0x43ba4e){return _0x15216d['includes'](_0x43ba4e[_0x6888('0x27')]);});return{'count':_0x56ed33[_0x6888('0x34')],'rows':_[_0x6888('0x29')](_0x56ed33,function(_0x2bd848){return{'id':_0x2bd848[_0x6888('0x27')],'name':_0x2bd848[_0x6888('0x70')],'custom':_['endsWith'](_0x2bd848[_0x6888('0x27')],'_c')?!![]:![],'options':_0x2bd848['options']?_[_0x6888('0x29')](_[_0x6888('0x6e')](_0x2bd848[_0x6888('0x3e')]),function(_0x47fe64){return{'name':_0x47fe64[_0x6888('0x71')],'value':_0x47fe64[_0x6888('0x27')]};}):[]};})};}})[_0x6888('0x23')](respondWithResult(_0x26b789,null))['catch'](function(_0x2ccace){var _0x35f031=_0x5539d2['query']['test']?0x1f4:_0x2ccace[_0x6888('0x72')]||0x1f4;logger['error'](_0x6888('0x73'),_0x6888('0x53'),_0x35f031,JSON[_0x6888('0x6c')](_0x2ccace));delete _0x2ccace['name'];if(_0x35f031===0x191){_0x35f031=0x190;}_0x26b789[_0x6888('0x18')](_0x35f031)[_0x6888('0x28')](_0x5539d2[_0x6888('0x32')][_0x6888('0x74')]?{'message':_0x6888('0x75'),'statusCode':_0x2ccace[_0x6888('0x72')]}:_0x2ccace);});}else{var _0x20585e=0x1f4;_0x26b789[_0x6888('0x18')](_0x20585e)[_0x6888('0x28')]({'message':_0x6888('0x75'),'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 6a80e27..16be83b 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 _0x7bf2=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x343fa5,_0x2ec341){var _0x4752b8=function(_0xcfc57){while(--_0xcfc57){_0x343fa5['push'](_0x343fa5['shift']());}};_0x4752b8(++_0x2ec341);}(_0x7bf2,0xc8));var _0x27bf=function(_0x108c3a,_0x2b0fcf){_0x108c3a=_0x108c3a-0x0;var _0x2b1601=_0x7bf2[_0x108c3a];return _0x2b1601;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var logger=require('../../config/logger')(_0x27bf('0x2'));var moment=require(_0x27bf('0x3'));var BPromise=require(_0x27bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27bf('0x5'));var rimraf=require('rimraf');var config=require(_0x27bf('0x6'));var attributes=require(_0x27bf('0x7'));var integrations=require(_0x27bf('0x8'));module[_0x27bf('0x9')]=function(_0x1beb9b,_0x374acd){return _0x1beb9b[_0x27bf('0xa')](_0x27bf('0xb'),attributes,{'tableName':_0x27bf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf60=['../../config/logger','bluebird','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xaf60,0x82));var _0x0af6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xaf60[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));var integrations=require(_0x0af6('0x7'));module[_0x0af6('0x8')]=function(_0x333ce1,_0x2eb218){return _0x333ce1['define'](_0x0af6('0x9'),attributes,{'tableName':_0x0af6('0xa'),'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 947fb82..46ce62e 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 _0xff4c=['stringify','error','code','message','info','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x472c4c,_0x31724d){var _0x405ea8=function(_0x557263){while(--_0x557263){_0x472c4c['push'](_0x472c4c['shift']());}};_0x405ea8(++_0x31724d);}(_0xff4c,0xeb));var _0xcff4=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xff4c[_0x254d9f];return _0x1eedb9;};'use strict';var _=require('lodash');var util=require(_0xcff4('0x0'));var moment=require('moment');var BPromise=require(_0xcff4('0x1'));var rs=require(_0xcff4('0x2'));var fs=require('fs');var Redis=require(_0xcff4('0x3'));var db=require(_0xcff4('0x4'))['db'];var utils=require(_0xcff4('0x5'));var logger=require(_0xcff4('0x6'))(_0xcff4('0x7'));var config=require(_0xcff4('0x8'));var jayson=require(_0xcff4('0x9'));var client=jayson[_0xcff4('0xa')][_0xcff4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aaa90,_0x54d31c,_0x37866d){return new BPromise(function(_0x2c3cf1,_0xea6b9c){return client[_0xcff4('0xc')](_0x5aaa90,_0x37866d)[_0xcff4('0xd')](function(_0x2afbc0){logger['info'](_0xcff4('0xe'),_0x54d31c,'request\x20sent');logger['debug'](_0xcff4('0xf'),_0x54d31c,_0xcff4('0x10'),JSON[_0xcff4('0x11')](_0x2afbc0));if(_0x2afbc0[_0xcff4('0x12')]){if(_0x2afbc0['error'][_0xcff4('0x13')]===0x1f4){logger[_0xcff4('0x12')](_0xcff4('0xe'),_0x54d31c,_0x2afbc0['error'][_0xcff4('0x14')]);return _0xea6b9c(_0x2afbc0[_0xcff4('0x12')][_0xcff4('0x14')]);}logger[_0xcff4('0x12')](_0xcff4('0xe'),_0x54d31c,_0x2afbc0[_0xcff4('0x12')][_0xcff4('0x14')]);return _0x2c3cf1(_0x2afbc0[_0xcff4('0x12')][_0xcff4('0x14')]);}else{logger[_0xcff4('0x15')](_0xcff4('0xe'),_0x54d31c,_0xcff4('0x10'));_0x2c3cf1(_0x2afbc0['result'][_0xcff4('0x14')]);}})['catch'](function(_0x57161d){logger[_0xcff4('0x12')](_0xcff4('0xe'),_0x54d31c,_0x57161d);_0xea6b9c(_0x57161d);});});}exports[_0xcff4('0x16')]=function(_0xca7f7f){var _0x4f2159=this;return new Promise(function(_0xb8d5fe,_0x3dcb1d){return db[_0xcff4('0x17')][_0xcff4('0x18')]({'raw':_0xca7f7f[_0xcff4('0x19')]?_0xca7f7f[_0xcff4('0x19')][_0xcff4('0x1a')]===undefined?!![]:![]:!![],'where':_0xca7f7f[_0xcff4('0x19')]?_0xca7f7f[_0xcff4('0x19')][_0xcff4('0x1b')]||null:null,'attributes':_0xca7f7f[_0xcff4('0x19')]?_0xca7f7f[_0xcff4('0x19')][_0xcff4('0x1c')]||null:null,'limit':_0xca7f7f[_0xcff4('0x19')]?_0xca7f7f['options'][_0xcff4('0x1d')]||null:null,'include':_0xca7f7f[_0xcff4('0x19')]?_0xca7f7f['options'][_0xcff4('0x1e')]?_[_0xcff4('0x1f')](_0xca7f7f[_0xcff4('0x19')]['include'],function(_0x329e43){return{'model':db[_0x329e43[_0xcff4('0x20')]],'as':_0x329e43['as'],'attributes':_0x329e43['attributes'],'include':_0x329e43['include']?_[_0xcff4('0x1f')](_0x329e43[_0xcff4('0x1e')],function(_0x92ac25){return{'model':db[_0x92ac25['model']],'as':_0x92ac25['as'],'attributes':_0x92ac25[_0xcff4('0x1c')],'include':_0x92ac25[_0xcff4('0x1e')]?_[_0xcff4('0x1f')](_0x92ac25[_0xcff4('0x1e')],function(_0x47c2b2){return{'model':db[_0x47c2b2['model']],'as':_0x47c2b2['as'],'attributes':_0x47c2b2[_0xcff4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcff4('0xd')](function(_0x53e67f){logger['info']('GetSugarcrmAccount',_0xca7f7f);logger[_0xcff4('0x21')](_0xcff4('0x16'),_0xca7f7f,JSON[_0xcff4('0x11')](_0x53e67f));_0xb8d5fe(_0x53e67f);})['catch'](function(_0x539c89){logger[_0xcff4('0x12')](_0xcff4('0x16'),_0x539c89[_0xcff4('0x14')],_0xca7f7f);_0x3dcb1d(_0x4f2159[_0xcff4('0x12')](0x1f4,_0x539c89[_0xcff4('0x14')]));});});};exports[_0xcff4('0x22')]=function(_0x104eda){var _0x4cb28c=this;return new Promise(function(_0x403582,_0x2e5e3d){return db[_0xcff4('0x17')]['find']({'raw':_0x104eda[_0xcff4('0x19')]?_0x104eda[_0xcff4('0x19')][_0xcff4('0x1a')]===undefined?!![]:![]:!![],'where':_0x104eda[_0xcff4('0x19')]?_0x104eda[_0xcff4('0x19')][_0xcff4('0x1b')]||null:null,'attributes':_0x104eda[_0xcff4('0x19')]?_0x104eda[_0xcff4('0x19')][_0xcff4('0x1c')]||null:null,'include':_0x104eda[_0xcff4('0x19')]?_0x104eda[_0xcff4('0x19')][_0xcff4('0x1e')]?_[_0xcff4('0x1f')](_0x104eda[_0xcff4('0x19')][_0xcff4('0x1e')],function(_0x806117){return{'model':db[_0x806117[_0xcff4('0x20')]],'as':_0x806117['as'],'attributes':_0x806117[_0xcff4('0x1c')],'include':_0x806117[_0xcff4('0x1e')]?_[_0xcff4('0x1f')](_0x806117[_0xcff4('0x1e')],function(_0x1cec12){return{'model':db[_0x1cec12[_0xcff4('0x20')]],'as':_0x1cec12['as'],'attributes':_0x1cec12[_0xcff4('0x1c')],'include':_0x1cec12[_0xcff4('0x1e')]?_['map'](_0x1cec12[_0xcff4('0x1e')],function(_0x3a0707){return{'model':db[_0x3a0707[_0xcff4('0x20')]],'as':_0x3a0707['as'],'attributes':_0x3a0707[_0xcff4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x182d19){logger[_0xcff4('0x15')]('ShowSugarcrmAccount',_0x104eda);logger[_0xcff4('0x21')](_0xcff4('0x22'),_0x104eda,JSON[_0xcff4('0x11')](_0x182d19));_0x403582(_0x182d19);})[_0xcff4('0x23')](function(_0x22214b){logger[_0xcff4('0x12')]('ShowSugarcrmAccount',_0x22214b[_0xcff4('0x14')],_0x104eda);_0x2e5e3d(_0x4cb28c['error'](0x1f4,_0x22214b[_0xcff4('0x14')]));});});}; \ No newline at end of file +var _0x8f2c=['debug','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3c11d6,_0xa9f933){var _0x6296fe=function(_0x3aeff2){while(--_0x3aeff2){_0x3c11d6['push'](_0x3c11d6['shift']());}};_0x6296fe(++_0xa9f933);}(_0x8f2c,0xbc));var _0xc8f2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8f2c[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xc8f2('0x0'));var util=require(_0xc8f2('0x1'));var moment=require(_0xc8f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8f2('0x3'));var fs=require('fs');var Redis=require(_0xc8f2('0x4'));var db=require(_0xc8f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f2('0x6'))(_0xc8f2('0x7'));var config=require(_0xc8f2('0x8'));var jayson=require(_0xc8f2('0x9'));var client=jayson[_0xc8f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f24da,_0x6506da,_0x43f70b){return new BPromise(function(_0x3f0bf7,_0x3eed1c){return client[_0xc8f2('0xb')](_0x5f24da,_0x43f70b)[_0xc8f2('0xc')](function(_0x18063d){logger[_0xc8f2('0xd')](_0xc8f2('0xe'),_0x6506da,_0xc8f2('0xf'));logger[_0xc8f2('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x6506da,_0xc8f2('0xf'),JSON[_0xc8f2('0x11')](_0x18063d));if(_0x18063d[_0xc8f2('0x12')]){if(_0x18063d[_0xc8f2('0x12')]['code']===0x1f4){logger[_0xc8f2('0x12')](_0xc8f2('0xe'),_0x6506da,_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);return _0x3eed1c(_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);}logger['error'](_0xc8f2('0xe'),_0x6506da,_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);return _0x3f0bf7(_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);}else{logger[_0xc8f2('0xd')](_0xc8f2('0xe'),_0x6506da,'request\x20sent');_0x3f0bf7(_0x18063d[_0xc8f2('0x14')][_0xc8f2('0x13')]);}})[_0xc8f2('0x15')](function(_0x1211ae){logger[_0xc8f2('0x12')](_0xc8f2('0xe'),_0x6506da,_0x1211ae);_0x3eed1c(_0x1211ae);});});}exports[_0xc8f2('0x16')]=function(_0x59ddd2){var _0x5801f3=this;return new Promise(function(_0x51cd4a,_0x524d18){return db['SugarcrmAccount'][_0xc8f2('0x17')]({'raw':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')]['where']||null:null,'attributes':_0x59ddd2[_0xc8f2('0x18')]?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'limit':_0x59ddd2[_0xc8f2('0x18')]?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1b')]||null:null,'include':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1c')],function(_0x55cf1b){return{'model':db[_0x55cf1b[_0xc8f2('0x1e')]],'as':_0x55cf1b['as'],'attributes':_0x55cf1b[_0xc8f2('0x1a')],'include':_0x55cf1b[_0xc8f2('0x1c')]?_['map'](_0x55cf1b[_0xc8f2('0x1c')],function(_0x1c05e2){return{'model':db[_0x1c05e2['model']],'as':_0x1c05e2['as'],'attributes':_0x1c05e2[_0xc8f2('0x1a')],'include':_0x1c05e2['include']?_['map'](_0x1c05e2[_0xc8f2('0x1c')],function(_0x5b5092){return{'model':db[_0x5b5092[_0xc8f2('0x1e')]],'as':_0x5b5092['as'],'attributes':_0x5b5092[_0xc8f2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550938){logger[_0xc8f2('0xd')]('GetSugarcrmAccount',_0x59ddd2);logger['debug'](_0xc8f2('0x16'),_0x59ddd2,JSON['stringify'](_0x550938));_0x51cd4a(_0x550938);})['catch'](function(_0x434a4a){logger[_0xc8f2('0x12')](_0xc8f2('0x16'),_0x434a4a[_0xc8f2('0x13')],_0x59ddd2);_0x524d18(_0x5801f3[_0xc8f2('0x12')](0x1f4,_0x434a4a[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x1f')]=function(_0x45a877){var _0x49ac32=this;return new Promise(function(_0x4eb2c8,_0x18698c){return db[_0xc8f2('0x20')][_0xc8f2('0x21')]({'raw':_0x45a877['options']?_0x45a877['options'][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x45a877[_0xc8f2('0x18')]?_0x45a877['options']['where']||null:null,'attributes':_0x45a877[_0xc8f2('0x18')]?_0x45a877['options'][_0xc8f2('0x1a')]||null:null,'include':_0x45a877['options']?_0x45a877[_0xc8f2('0x18')][_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x45a877['options']['include'],function(_0x5af665){return{'model':db[_0x5af665[_0xc8f2('0x1e')]],'as':_0x5af665['as'],'attributes':_0x5af665['attributes'],'include':_0x5af665['include']?_[_0xc8f2('0x1d')](_0x5af665[_0xc8f2('0x1c')],function(_0x41465b){return{'model':db[_0x41465b['model']],'as':_0x41465b['as'],'attributes':_0x41465b['attributes'],'include':_0x41465b[_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x41465b[_0xc8f2('0x1c')],function(_0x29b8cb){return{'model':db[_0x29b8cb['model']],'as':_0x29b8cb['as'],'attributes':_0x29b8cb[_0xc8f2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183482){logger[_0xc8f2('0xd')](_0xc8f2('0x1f'),_0x45a877);logger[_0xc8f2('0x10')](_0xc8f2('0x1f'),_0x45a877,JSON[_0xc8f2('0x11')](_0x183482));_0x4eb2c8(_0x183482);})['catch'](function(_0x448b8d){logger[_0xc8f2('0x12')](_0xc8f2('0x1f'),_0x448b8d['message'],_0x45a877);_0x18698c(_0x49ac32[_0xc8f2('0x12')](0x1f4,_0x448b8d[_0xc8f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ed5a2a5..24a95b7 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 _0xfc5a=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc5a,0x142));var _0xafc5=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xfc5a[_0x1abeb2];return _0x48da20;};'use strict';var multer=require('multer');var util=require(_0xafc5('0x0'));var path=require('path');var timeout=require(_0xafc5('0x1'));var express=require(_0xafc5('0x2'));var router=express[_0xafc5('0x3')]();var fs_extra=require(_0xafc5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xafc5('0x5'));var config=require(_0xafc5('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xafc5('0x7')]('/',auth[_0xafc5('0x8')](),controller[_0xafc5('0x9')]);router[_0xafc5('0x7')]('/:id',auth[_0xafc5('0x8')](),controller[_0xafc5('0xa')]);router['get'](_0xafc5('0xb'),auth[_0xafc5('0x8')](),controller[_0xafc5('0xc')]);router['get'](_0xafc5('0xd'),auth[_0xafc5('0x8')](),controller['getSubjects']);router['get'](_0xafc5('0xe'),auth['isAuthenticated'](),controller[_0xafc5('0xf')]);router[_0xafc5('0x10')]('/',auth['isAuthenticated'](),controller[_0xafc5('0x11')]);router[_0xafc5('0x12')](_0xafc5('0x13'),auth[_0xafc5('0x8')](),controller['update']);router[_0xafc5('0x14')](_0xafc5('0x13'),auth[_0xafc5('0x8')](),controller[_0xafc5('0x15')]);module[_0xafc5('0x16')]=router; \ No newline at end of file +var _0x3854=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x3854,0xca));var _0x4385=function(_0x476d64,_0x490172){_0x476d64=_0x476d64-0x0;var _0x5703f8=_0x3854[_0x476d64];return _0x5703f8;};'use strict';var multer=require(_0x4385('0x0'));var util=require('util');var path=require(_0x4385('0x1'));var timeout=require('connect-timeout');var express=require(_0x4385('0x2'));var router=express[_0x4385('0x3')]();var fs_extra=require(_0x4385('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4385('0x5'));var config=require(_0x4385('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x4385('0x7')]('/',auth[_0x4385('0x8')](),controller[_0x4385('0x9')]);router[_0x4385('0x7')](_0x4385('0xa'),auth['isAuthenticated'](),controller[_0x4385('0xb')]);router[_0x4385('0x7')]('/:id/fields',auth[_0x4385('0x8')](),controller[_0x4385('0xc')]);router['get'](_0x4385('0xd'),auth[_0x4385('0x8')](),controller[_0x4385('0xe')]);router[_0x4385('0x7')](_0x4385('0xf'),auth[_0x4385('0x8')](),controller['getDescriptions']);router[_0x4385('0x10')]('/',auth['isAuthenticated'](),controller[_0x4385('0x11')]);router[_0x4385('0x12')](_0x4385('0xa'),auth[_0x4385('0x8')](),controller[_0x4385('0x13')]);router['delete']('/:id',auth[_0x4385('0x8')](),controller[_0x4385('0x14')]);module[_0x4385('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e97aad8..e3e54fb 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 _0x0c0f=['STRING','exports'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x0c0f,0xb5));var _0xf0c0=function(_0x584244,_0x32b496){_0x584244=_0x584244-0x0;var _0x1a9112=_0x0c0f[_0x584244];return _0x1a9112;};'use strict';var Sequelize=require('sequelize');module[_0xf0c0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf0c0('0x1')]}}; \ No newline at end of file +var _0x230e=['exports','STRING','sequelize'];(function(_0xeec51d,_0x262da8){var _0x422afd=function(_0x3d1e7e){while(--_0x3d1e7e){_0xeec51d['push'](_0xeec51d['shift']());}};_0x422afd(++_0x262da8);}(_0x230e,0xfe));var _0xe230=function(_0x4de875,_0xa9cae0){_0x4de875=_0x4de875-0x0;var _0x16f50a=_0x230e[_0x4de875];return _0x16f50a;};'use strict';var Sequelize=require(_0xe230('0x0'));module[_0xe230('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe230('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5606fe4..63fdb08 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 _0x023b=['path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','where','merge','type','filter','options','includeAll','findAll','rows','length','include','find','catch','create','body','params','getFields','SugarcrmField','sort','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util'];(function(_0x50ffbb,_0x21a925){var _0x576a1c=function(_0x8e27e6){while(--_0x8e27e6){_0x50ffbb['push'](_0x50ffbb['shift']());}};_0x576a1c(++_0x21a925);}(_0x023b,0x13a));var _0xb023=function(_0x571227,_0xdc729c){_0x571227=_0x571227-0x0;var _0x7e8a51=_0x023b[_0x571227];return _0x7e8a51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb023('0x0'));var zipdir=require(_0xb023('0x1'));var jsonpatch=require(_0xb023('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb023('0x3'));var Mustache=require(_0xb023('0x4'));var util=require(_0xb023('0x5'));var path=require(_0xb023('0x6'));var sox=require(_0xb023('0x7'));var csv=require('to-csv');var ejs=require(_0xb023('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb023('0x9'));var jsforce=require(_0xb023('0xa'));var deskjs=require(_0xb023('0xb'));var toCsv=require(_0xb023('0xc'));var querystring=require('querystring');var Papa=require(_0xb023('0xd'));var Redis=require(_0xb023('0xe'));var authService=require(_0xb023('0xf'));var qs=require(_0xb023('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb023('0x11'));var logger=require('../../config/logger')(_0xb023('0x12'));var utils=require(_0xb023('0x13'));var config=require(_0xb023('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb023('0x15'))['db'];function respondWithStatusCode(_0x535c01,_0x4a0022){_0x4a0022=_0x4a0022||0xcc;return function(_0x212d45){if(_0x212d45){return _0x535c01['sendStatus'](_0x4a0022);}return _0x535c01['status'](_0x4a0022)[_0xb023('0x16')]();};}function respondWithResult(_0x21700a,_0x425483){_0x425483=_0x425483||0xc8;return function(_0x52a73f){if(_0x52a73f){return _0x21700a[_0xb023('0x17')](_0x425483)[_0xb023('0x18')](_0x52a73f);}};}function respondWithFilteredResult(_0x4e11b6,_0x5548bf){return function(_0x5754e2){if(_0x5754e2){var _0x1a701c=typeof _0x5548bf[_0xb023('0x19')]===_0xb023('0x1a')&&typeof _0x5548bf[_0xb023('0x1b')]===_0xb023('0x1a');var _0x14a2fe=_0x5754e2[_0xb023('0x1c')];var _0x366fa2=_0x1a701c?0x0:_0x5548bf[_0xb023('0x19')];var _0x40c60b=_0x1a701c?_0x5754e2['count']:_0x5548bf['offset']+_0x5548bf['limit'];var _0x24a21e;if(_0x40c60b>=_0x14a2fe){_0x40c60b=_0x14a2fe;_0x24a21e=0xc8;}else{_0x24a21e=0xce;}_0x4e11b6[_0xb023('0x17')](_0x24a21e);return _0x4e11b6[_0xb023('0x1d')](_0xb023('0x1e'),_0x366fa2+'-'+_0x40c60b+'/'+_0x14a2fe)['json'](_0x5754e2);}return null;};}function patchUpdates(_0x171022){return function(_0x1367d3){try{jsonpatch[_0xb023('0x1f')](_0x1367d3,_0x171022,!![]);}catch(_0x3dbb55){return BPromise[_0xb023('0x20')](_0x3dbb55);}return _0x1367d3[_0xb023('0x21')]();};}function saveUpdates(_0x519ccf,_0x117b1e){return function(_0x4f1c42){if(_0x4f1c42){return _0x4f1c42[_0xb023('0x22')](_0x519ccf)[_0xb023('0x23')](function(_0x386a08){return _0x386a08;});}return null;};}function removeEntity(_0x13caf2,_0x326844){return function(_0x40f0ed){if(_0x40f0ed){return _0x40f0ed[_0xb023('0x24')]()[_0xb023('0x23')](function(){_0x13caf2['status'](0xcc)[_0xb023('0x16')]();});}};}function handleEntityNotFound(_0x5a9aa6,_0x341d94){return function(_0x2061dc){if(!_0x2061dc){_0x5a9aa6[_0xb023('0x25')](0x194);}return _0x2061dc;};}function handleError(_0xd0020d,_0x459baa){_0x459baa=_0x459baa||0x1f4;return function(_0x548d0a){logger[_0xb023('0x26')](_0x548d0a[_0xb023('0x27')]);if(_0x548d0a['name']){delete _0x548d0a[_0xb023('0x28')];}_0xd0020d[_0xb023('0x17')](_0x459baa)[_0xb023('0x29')](_0x548d0a);};}exports[_0xb023('0x2a')]=function(_0x222708,_0x1301cf){var _0x2e8da9={},_0x36bafd={},_0x9051db={'count':0x0,'rows':[]};var _0xe5a997=_[_0xb023('0x2b')](db[_0xb023('0x2c')][_0xb023('0x2d')],function(_0x1feb24){return{'name':_0x1feb24[_0xb023('0x2e')],'type':_0x1feb24['type'][_0xb023('0x2f')]};});_0x36bafd[_0xb023('0x30')]=_[_0xb023('0x2b')](_0xe5a997,'name');_0x36bafd['query']=_[_0xb023('0x31')](_0x222708[_0xb023('0x32')]);_0x36bafd[_0xb023('0x33')]=_[_0xb023('0x34')](_0x36bafd['model'],_0x36bafd[_0xb023('0x32')]);_0x2e8da9['attributes']=_['intersection'](_0x36bafd[_0xb023('0x30')],qs[_0xb023('0x35')](_0x222708[_0xb023('0x32')][_0xb023('0x35')]));_0x2e8da9[_0xb023('0x36')]=_0x2e8da9['attributes']['length']?_0x2e8da9[_0xb023('0x36')]:_0x36bafd[_0xb023('0x30')];if(!_0x222708['query'][_0xb023('0x37')](_0xb023('0x38'))){_0x2e8da9[_0xb023('0x1b')]=qs[_0xb023('0x1b')](_0x222708[_0xb023('0x32')][_0xb023('0x1b')]);_0x2e8da9['offset']=qs[_0xb023('0x19')](_0x222708[_0xb023('0x32')][_0xb023('0x19')]);}_0x2e8da9[_0xb023('0x39')]=qs['sort'](_0x222708['query']['sort']);_0x2e8da9['where']=qs['filters'](_[_0xb023('0x3a')](_0x222708[_0xb023('0x32')],_0x36bafd[_0xb023('0x33')]),_0xe5a997);if(_0x222708[_0xb023('0x32')]['filter']){_0x2e8da9[_0xb023('0x3b')]=_[_0xb023('0x3c')](_0x2e8da9['where'],{'$or':_[_0xb023('0x2b')](_0xe5a997,function(_0x3e105a){if(_0x3e105a[_0xb023('0x3d')]!=='VIRTUAL'){var _0x5a3756={};_0x5a3756[_0x3e105a[_0xb023('0x28')]]={'$like':'%'+_0x222708['query'][_0xb023('0x3e')]+'%'};return _0x5a3756;}})});}_0x2e8da9=_[_0xb023('0x3c')]({},_0x2e8da9,_0x222708[_0xb023('0x3f')]);var _0x3dc60c={'where':_0x2e8da9[_0xb023('0x3b')]};return db[_0xb023('0x2c')][_0xb023('0x1c')](_0x3dc60c)[_0xb023('0x23')](function(_0x40bf48){_0x9051db['count']=_0x40bf48;if(_0x222708[_0xb023('0x32')][_0xb023('0x40')]){_0x2e8da9['include']=[{'all':!![]}];}return db[_0xb023('0x2c')][_0xb023('0x41')](_0x2e8da9);})[_0xb023('0x23')](function(_0x4c9cec){_0x9051db[_0xb023('0x42')]=_0x4c9cec;return _0x9051db;})['then'](respondWithFilteredResult(_0x1301cf,_0x2e8da9))['catch'](handleError(_0x1301cf,null));};exports['show']=function(_0x267e6f,_0x3ec8ac){var _0x1bec5c={'raw':![],'where':{'id':_0x267e6f['params']['id']}},_0x2bac0e={};_0x2bac0e[_0xb023('0x30')]=_[_0xb023('0x31')](db[_0xb023('0x2c')][_0xb023('0x2d')]);_0x2bac0e[_0xb023('0x32')]=_[_0xb023('0x31')](_0x267e6f[_0xb023('0x32')]);_0x2bac0e[_0xb023('0x33')]=_[_0xb023('0x34')](_0x2bac0e[_0xb023('0x30')],_0x2bac0e['query']);_0x1bec5c[_0xb023('0x36')]=_[_0xb023('0x34')](_0x2bac0e[_0xb023('0x30')],qs['fields'](_0x267e6f[_0xb023('0x32')][_0xb023('0x35')]));_0x1bec5c['attributes']=_0x1bec5c[_0xb023('0x36')][_0xb023('0x43')]?_0x1bec5c[_0xb023('0x36')]:_0x2bac0e[_0xb023('0x30')];if(_0x267e6f[_0xb023('0x32')][_0xb023('0x40')]){_0x1bec5c[_0xb023('0x44')]=[{'all':!![]}];}_0x1bec5c=_[_0xb023('0x3c')]({},_0x1bec5c,_0x267e6f[_0xb023('0x3f')]);return db['SugarcrmConfiguration'][_0xb023('0x45')](_0x1bec5c)[_0xb023('0x23')](handleEntityNotFound(_0x3ec8ac,null))[_0xb023('0x23')](respondWithResult(_0x3ec8ac,null))[_0xb023('0x46')](handleError(_0x3ec8ac,null));};exports[_0xb023('0x47')]=function(_0xb4149b,_0x14170b){return db[_0xb023('0x2c')][_0xb023('0x47')](_0xb4149b[_0xb023('0x48')],{})[_0xb023('0x23')](respondWithResult(_0x14170b,0xc9))['catch'](handleError(_0x14170b,null));};exports['update']=function(_0x228cc0,_0x2acddb){if(_0x228cc0[_0xb023('0x48')]['id']){delete _0x228cc0[_0xb023('0x48')]['id'];}return db[_0xb023('0x2c')][_0xb023('0x45')]({'where':{'id':_0x228cc0[_0xb023('0x49')]['id']}})[_0xb023('0x23')](handleEntityNotFound(_0x2acddb,null))[_0xb023('0x23')](saveUpdates(_0x228cc0[_0xb023('0x48')],null))[_0xb023('0x23')](respondWithResult(_0x2acddb,null))[_0xb023('0x46')](handleError(_0x2acddb,null));};exports[_0xb023('0x24')]=function(_0x2fb1b1,_0x4273c4){return db[_0xb023('0x2c')]['find']({'where':{'id':_0x2fb1b1[_0xb023('0x49')]['id']}})['then'](handleEntityNotFound(_0x4273c4,null))[_0xb023('0x23')](removeEntity(_0x4273c4,null))['catch'](handleError(_0x4273c4,null));};exports[_0xb023('0x4a')]=function(_0x4cbf5a,_0x2e4371,_0x12f504){var _0x498104={};var _0x4e28e6={};var _0x38b696;var _0x58da74;return db[_0xb023('0x2c')]['findOne']({'where':{'id':_0x4cbf5a[_0xb023('0x49')]['id']}})[_0xb023('0x23')](handleEntityNotFound(_0x2e4371,null))[_0xb023('0x23')](function(_0x1cfe30){if(_0x1cfe30){_0x38b696=_0x1cfe30;_0x4e28e6[_0xb023('0x30')]=_[_0xb023('0x31')](db[_0xb023('0x4b')]['rawAttributes']);_0x4e28e6[_0xb023('0x32')]=_['keys'](_0x4cbf5a[_0xb023('0x32')]);_0x4e28e6[_0xb023('0x33')]=_[_0xb023('0x34')](_0x4e28e6[_0xb023('0x30')],_0x4e28e6['query']);_0x498104[_0xb023('0x36')]=_[_0xb023('0x34')](_0x4e28e6[_0xb023('0x30')],qs[_0xb023('0x35')](_0x4cbf5a[_0xb023('0x32')]['fields']));_0x498104[_0xb023('0x36')]=_0x498104['attributes'][_0xb023('0x43')]?_0x498104[_0xb023('0x36')]:_0x4e28e6[_0xb023('0x30')];_0x498104[_0xb023('0x39')]=qs[_0xb023('0x4c')](_0x4cbf5a[_0xb023('0x32')][_0xb023('0x4c')]);_0x498104[_0xb023('0x3b')]=qs[_0xb023('0x33')](_[_0xb023('0x3a')](_0x4cbf5a[_0xb023('0x32')],_0x4e28e6['filters']));if(_0x4cbf5a['query'][_0xb023('0x3e')]){_0x498104[_0xb023('0x3b')]=_[_0xb023('0x3c')](_0x498104[_0xb023('0x3b')],{'$or':_['map'](_0x498104[_0xb023('0x36')],function(_0x3a112a){var _0x1546c0={};_0x1546c0[_0x3a112a]={'$like':'%'+_0x4cbf5a[_0xb023('0x32')][_0xb023('0x3e')]+'%'};return _0x1546c0;})});}_0x498104=_[_0xb023('0x3c')]({},_0x498104,_0x4cbf5a['options']);return _0x38b696['getFields'](_0x498104);}})[_0xb023('0x23')](function(_0x4597db){if(_0x4597db){_0x58da74=_0x4597db['length'];if(!_0x4cbf5a[_0xb023('0x32')][_0xb023('0x37')]('nolimit')){_0x498104[_0xb023('0x1b')]=qs['limit'](_0x4cbf5a[_0xb023('0x32')][_0xb023('0x1b')]);_0x498104[_0xb023('0x19')]=qs[_0xb023('0x19')](_0x4cbf5a[_0xb023('0x32')][_0xb023('0x19')]);}return _0x38b696[_0xb023('0x4a')](_0x498104);}})['then'](function(_0x308079){if(_0x308079){return _0x308079?{'count':_0x58da74,'rows':_0x308079}:null;}})['then'](respondWithResult(_0x2e4371,null))['catch'](handleError(_0x2e4371,null));};exports[_0xb023('0x4d')]=function(_0x4653b5,_0x1fe384,_0x5850aa){var _0x1b4f13={};var _0xcfafec={};var _0x2ac9f9;var _0x4c7412;return db[_0xb023('0x2c')][_0xb023('0x4e')]({'where':{'id':_0x4653b5['params']['id']}})['then'](handleEntityNotFound(_0x1fe384,null))[_0xb023('0x23')](function(_0x3342ee){if(_0x3342ee){_0x2ac9f9=_0x3342ee;_0xcfafec['model']=_[_0xb023('0x31')](db[_0xb023('0x4b')]['rawAttributes']);_0xcfafec[_0xb023('0x32')]=_[_0xb023('0x31')](_0x4653b5['query']);_0xcfafec[_0xb023('0x33')]=_[_0xb023('0x34')](_0xcfafec[_0xb023('0x30')],_0xcfafec[_0xb023('0x32')]);_0x1b4f13[_0xb023('0x36')]=_[_0xb023('0x34')](_0xcfafec['model'],qs[_0xb023('0x35')](_0x4653b5[_0xb023('0x32')][_0xb023('0x35')]));_0x1b4f13[_0xb023('0x36')]=_0x1b4f13[_0xb023('0x36')]['length']?_0x1b4f13[_0xb023('0x36')]:_0xcfafec[_0xb023('0x30')];_0x1b4f13[_0xb023('0x39')]=qs['sort'](_0x4653b5[_0xb023('0x32')][_0xb023('0x4c')]);_0x1b4f13[_0xb023('0x3b')]=qs[_0xb023('0x33')](_[_0xb023('0x3a')](_0x4653b5[_0xb023('0x32')],_0xcfafec[_0xb023('0x33')]));if(_0x4653b5['query'][_0xb023('0x3e')]){_0x1b4f13['where']=_['merge'](_0x1b4f13['where'],{'$or':_[_0xb023('0x2b')](_0x1b4f13[_0xb023('0x36')],function(_0x166cab){var _0x5d3d60={};_0x5d3d60[_0x166cab]={'$like':'%'+_0x4653b5[_0xb023('0x32')][_0xb023('0x3e')]+'%'};return _0x5d3d60;})});}_0x1b4f13=_['merge']({},_0x1b4f13,_0x4653b5[_0xb023('0x3f')]);return _0x2ac9f9['getSubjects'](_0x1b4f13);}})['then'](function(_0x577d18){if(_0x577d18){_0x4c7412=_0x577d18[_0xb023('0x43')];if(!_0x4653b5[_0xb023('0x32')][_0xb023('0x37')](_0xb023('0x38'))){_0x1b4f13[_0xb023('0x1b')]=qs['limit'](_0x4653b5[_0xb023('0x32')]['limit']);_0x1b4f13[_0xb023('0x19')]=qs[_0xb023('0x19')](_0x4653b5[_0xb023('0x32')][_0xb023('0x19')]);}return _0x2ac9f9[_0xb023('0x4d')](_0x1b4f13);}})[_0xb023('0x23')](function(_0x3f05a4){if(_0x3f05a4){return _0x3f05a4?{'count':_0x4c7412,'rows':_0x3f05a4}:null;}})[_0xb023('0x23')](respondWithResult(_0x1fe384,null))['catch'](handleError(_0x1fe384,null));};exports[_0xb023('0x4f')]=function(_0x36846e,_0x48b99a,_0x22ea27){var _0x432487={};var _0x228b0a={};var _0x2071db;var _0x290ad7;return db[_0xb023('0x2c')]['findOne']({'where':{'id':_0x36846e['params']['id']}})['then'](handleEntityNotFound(_0x48b99a,null))[_0xb023('0x23')](function(_0x202a29){if(_0x202a29){_0x2071db=_0x202a29;_0x228b0a[_0xb023('0x30')]=_[_0xb023('0x31')](db[_0xb023('0x4b')][_0xb023('0x2d')]);_0x228b0a[_0xb023('0x32')]=_['keys'](_0x36846e[_0xb023('0x32')]);_0x228b0a[_0xb023('0x33')]=_[_0xb023('0x34')](_0x228b0a['model'],_0x228b0a[_0xb023('0x32')]);_0x432487[_0xb023('0x36')]=_[_0xb023('0x34')](_0x228b0a[_0xb023('0x30')],qs[_0xb023('0x35')](_0x36846e[_0xb023('0x32')][_0xb023('0x35')]));_0x432487[_0xb023('0x36')]=_0x432487[_0xb023('0x36')][_0xb023('0x43')]?_0x432487[_0xb023('0x36')]:_0x228b0a[_0xb023('0x30')];_0x432487[_0xb023('0x39')]=qs[_0xb023('0x4c')](_0x36846e[_0xb023('0x32')][_0xb023('0x4c')]);_0x432487['where']=qs[_0xb023('0x33')](_[_0xb023('0x3a')](_0x36846e[_0xb023('0x32')],_0x228b0a[_0xb023('0x33')]));if(_0x36846e[_0xb023('0x32')]['filter']){_0x432487['where']=_[_0xb023('0x3c')](_0x432487[_0xb023('0x3b')],{'$or':_[_0xb023('0x2b')](_0x432487['attributes'],function(_0x5d6aab){var _0x269449={};_0x269449[_0x5d6aab]={'$like':'%'+_0x36846e[_0xb023('0x32')]['filter']+'%'};return _0x269449;})});}_0x432487=_[_0xb023('0x3c')]({},_0x432487,_0x36846e[_0xb023('0x3f')]);return _0x2071db[_0xb023('0x4f')](_0x432487);}})[_0xb023('0x23')](function(_0x28f1dd){if(_0x28f1dd){_0x290ad7=_0x28f1dd[_0xb023('0x43')];if(!_0x36846e[_0xb023('0x32')][_0xb023('0x37')]('nolimit')){_0x432487[_0xb023('0x1b')]=qs[_0xb023('0x1b')](_0x36846e[_0xb023('0x32')][_0xb023('0x1b')]);_0x432487[_0xb023('0x19')]=qs[_0xb023('0x19')](_0x36846e['query'][_0xb023('0x19')]);}return _0x2071db[_0xb023('0x4f')](_0x432487);}})[_0xb023('0x23')](function(_0x4eb6e9){if(_0x4eb6e9){return _0x4eb6e9?{'count':_0x290ad7,'rows':_0x4eb6e9}:null;}})[_0xb023('0x23')](respondWithResult(_0x48b99a,null))['catch'](handleError(_0x48b99a,null));}; \ No newline at end of file +var _0x5c9e=['update','then','error','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getFields','findOne','SugarcrmField','order','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x5c9e,0x11e));var _0xe5c9=function(_0x3204b6,_0x449180){_0x3204b6=_0x3204b6-0x0;var _0x162aa6=_0x5c9e[_0x3204b6];return _0x162aa6;};'use strict';var emlformat=require(_0xe5c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5c9('0x1'));var jsonpatch=require(_0xe5c9('0x2'));var rp=require(_0xe5c9('0x3'));var moment=require('moment');var BPromise=require(_0xe5c9('0x4'));var Mustache=require('mustache');var util=require(_0xe5c9('0x5'));var path=require(_0xe5c9('0x6'));var sox=require('sox');var csv=require(_0xe5c9('0x7'));var ejs=require(_0xe5c9('0x8'));var fs=require('fs');var fs_extra=require(_0xe5c9('0x9'));var _=require('lodash');var squel=require(_0xe5c9('0xa'));var crypto=require(_0xe5c9('0xb'));var jsforce=require(_0xe5c9('0xc'));var deskjs=require(_0xe5c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe5c9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5c9('0xf'));var qs=require(_0xe5c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5c9('0x11'));var utils=require(_0xe5c9('0x12'));var config=require(_0xe5c9('0x13'));var licenseUtil=require(_0xe5c9('0x14'));var db=require(_0xe5c9('0x15'))['db'];function respondWithStatusCode(_0x420d99,_0x51b074){_0x51b074=_0x51b074||0xcc;return function(_0x4bfd26){if(_0x4bfd26){return _0x420d99[_0xe5c9('0x16')](_0x51b074);}return _0x420d99[_0xe5c9('0x17')](_0x51b074)[_0xe5c9('0x18')]();};}function respondWithResult(_0xac953a,_0x31859d){_0x31859d=_0x31859d||0xc8;return function(_0x1d744c){if(_0x1d744c){return _0xac953a[_0xe5c9('0x17')](_0x31859d)['json'](_0x1d744c);}};}function respondWithFilteredResult(_0x35c2f6,_0x52ef26){return function(_0x2e4517){if(_0x2e4517){var _0x5c21ac=typeof _0x52ef26['offset']===_0xe5c9('0x19')&&typeof _0x52ef26[_0xe5c9('0x1a')]===_0xe5c9('0x19');var _0x5efe07=_0x2e4517[_0xe5c9('0x1b')];var _0x3d4db6=_0x5c21ac?0x0:_0x52ef26[_0xe5c9('0x1c')];var _0x4d6ed6=_0x5c21ac?_0x2e4517[_0xe5c9('0x1b')]:_0x52ef26[_0xe5c9('0x1c')]+_0x52ef26[_0xe5c9('0x1a')];var _0x128337;if(_0x4d6ed6>=_0x5efe07){_0x4d6ed6=_0x5efe07;_0x128337=0xc8;}else{_0x128337=0xce;}_0x35c2f6[_0xe5c9('0x17')](_0x128337);return _0x35c2f6[_0xe5c9('0x1d')](_0xe5c9('0x1e'),_0x3d4db6+'-'+_0x4d6ed6+'/'+_0x5efe07)[_0xe5c9('0x1f')](_0x2e4517);}return null;};}function patchUpdates(_0x51886d){return function(_0x812df9){try{jsonpatch[_0xe5c9('0x20')](_0x812df9,_0x51886d,!![]);}catch(_0x20e98b){return BPromise[_0xe5c9('0x21')](_0x20e98b);}return _0x812df9['save']();};}function saveUpdates(_0x577e2a,_0x4dbafb){return function(_0x4cc975){if(_0x4cc975){return _0x4cc975[_0xe5c9('0x22')](_0x577e2a)[_0xe5c9('0x23')](function(_0x1b1bfc){return _0x1b1bfc;});}return null;};}function removeEntity(_0x3c3b4f,_0x38f0ba){return function(_0x179839){if(_0x179839){return _0x179839['destroy']()[_0xe5c9('0x23')](function(){_0x3c3b4f['status'](0xcc)[_0xe5c9('0x18')]();});}};}function handleEntityNotFound(_0x17cf72,_0x40888e){return function(_0x48da23){if(!_0x48da23){_0x17cf72[_0xe5c9('0x16')](0x194);}return _0x48da23;};}function handleError(_0x44af56,_0x488ac0){_0x488ac0=_0x488ac0||0x1f4;return function(_0x41bb2e){logger[_0xe5c9('0x24')](_0x41bb2e[_0xe5c9('0x25')]);if(_0x41bb2e['name']){delete _0x41bb2e[_0xe5c9('0x26')];}_0x44af56[_0xe5c9('0x17')](_0x488ac0)[_0xe5c9('0x27')](_0x41bb2e);};}exports['index']=function(_0x52b0e2,_0x270f3d){var _0x41949c={},_0x469353={},_0x187016={'count':0x0,'rows':[]};var _0x7735a8=_[_0xe5c9('0x28')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x5c5143){return{'name':_0x5c5143[_0xe5c9('0x29')],'type':_0x5c5143[_0xe5c9('0x2a')][_0xe5c9('0x2b')]};});_0x469353['model']=_[_0xe5c9('0x28')](_0x7735a8,_0xe5c9('0x26'));_0x469353[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x52b0e2['query']);_0x469353['filters']=_[_0xe5c9('0x2e')](_0x469353[_0xe5c9('0x2f')],_0x469353[_0xe5c9('0x2c')]);_0x41949c[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x469353[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x52b0e2[_0xe5c9('0x2c')]['fields']));_0x41949c[_0xe5c9('0x30')]=_0x41949c[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x41949c[_0xe5c9('0x30')]:_0x469353[_0xe5c9('0x2f')];if(!_0x52b0e2[_0xe5c9('0x2c')][_0xe5c9('0x33')]('nolimit')){_0x41949c[_0xe5c9('0x1a')]=qs[_0xe5c9('0x1a')](_0x52b0e2['query'][_0xe5c9('0x1a')]);_0x41949c[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x52b0e2['query'][_0xe5c9('0x1c')]);}_0x41949c['order']=qs[_0xe5c9('0x34')](_0x52b0e2[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x41949c[_0xe5c9('0x35')]=qs['filters'](_[_0xe5c9('0x36')](_0x52b0e2['query'],_0x469353[_0xe5c9('0x37')]),_0x7735a8);if(_0x52b0e2['query'][_0xe5c9('0x38')]){_0x41949c['where']=_['merge'](_0x41949c['where'],{'$or':_[_0xe5c9('0x28')](_0x7735a8,function(_0x16351c){if(_0x16351c[_0xe5c9('0x2a')]!==_0xe5c9('0x39')){var _0x29785e={};_0x29785e[_0x16351c[_0xe5c9('0x26')]]={'$like':'%'+_0x52b0e2['query'][_0xe5c9('0x38')]+'%'};return _0x29785e;}})});}_0x41949c=_[_0xe5c9('0x3a')]({},_0x41949c,_0x52b0e2[_0xe5c9('0x3b')]);var _0x4c9ee7={'where':_0x41949c[_0xe5c9('0x35')]};return db[_0xe5c9('0x3c')][_0xe5c9('0x1b')](_0x4c9ee7)[_0xe5c9('0x23')](function(_0x1d01ba){_0x187016[_0xe5c9('0x1b')]=_0x1d01ba;if(_0x52b0e2['query'][_0xe5c9('0x3d')]){_0x41949c[_0xe5c9('0x3e')]=[{'all':!![]}];}return db[_0xe5c9('0x3c')][_0xe5c9('0x3f')](_0x41949c);})[_0xe5c9('0x23')](function(_0x33845f){_0x187016[_0xe5c9('0x40')]=_0x33845f;return _0x187016;})[_0xe5c9('0x23')](respondWithFilteredResult(_0x270f3d,_0x41949c))[_0xe5c9('0x41')](handleError(_0x270f3d,null));};exports[_0xe5c9('0x42')]=function(_0x2b2b2a,_0x2e79ea){var _0x319473={'raw':![],'where':{'id':_0x2b2b2a[_0xe5c9('0x43')]['id']}},_0x4fd9aa={};_0x4fd9aa[_0xe5c9('0x2f')]=_['keys'](db[_0xe5c9('0x3c')][_0xe5c9('0x44')]);_0x4fd9aa[_0xe5c9('0x2c')]=_['keys'](_0x2b2b2a[_0xe5c9('0x2c')]);_0x4fd9aa[_0xe5c9('0x37')]=_[_0xe5c9('0x2e')](_0x4fd9aa[_0xe5c9('0x2f')],_0x4fd9aa['query']);_0x319473[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x4fd9aa[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x2b2b2a['query']['fields']));_0x319473[_0xe5c9('0x30')]=_0x319473[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x319473[_0xe5c9('0x30')]:_0x4fd9aa[_0xe5c9('0x2f')];if(_0x2b2b2a[_0xe5c9('0x2c')][_0xe5c9('0x3d')]){_0x319473[_0xe5c9('0x3e')]=[{'all':!![]}];}_0x319473=_[_0xe5c9('0x3a')]({},_0x319473,_0x2b2b2a[_0xe5c9('0x3b')]);return db[_0xe5c9('0x3c')][_0xe5c9('0x45')](_0x319473)['then'](handleEntityNotFound(_0x2e79ea,null))[_0xe5c9('0x23')](respondWithResult(_0x2e79ea,null))[_0xe5c9('0x41')](handleError(_0x2e79ea,null));};exports[_0xe5c9('0x46')]=function(_0x51bd9a,_0x2d77fd){return db[_0xe5c9('0x3c')][_0xe5c9('0x46')](_0x51bd9a[_0xe5c9('0x47')],{})[_0xe5c9('0x23')](respondWithResult(_0x2d77fd,0xc9))['catch'](handleError(_0x2d77fd,null));};exports[_0xe5c9('0x22')]=function(_0x3ae393,_0x5cc370){if(_0x3ae393[_0xe5c9('0x47')]['id']){delete _0x3ae393[_0xe5c9('0x47')]['id'];}return db[_0xe5c9('0x3c')]['find']({'where':{'id':_0x3ae393[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x5cc370,null))[_0xe5c9('0x23')](saveUpdates(_0x3ae393[_0xe5c9('0x47')],null))['then'](respondWithResult(_0x5cc370,null))[_0xe5c9('0x41')](handleError(_0x5cc370,null));};exports[_0xe5c9('0x48')]=function(_0xdce651,_0x24b455){return db[_0xe5c9('0x3c')][_0xe5c9('0x45')]({'where':{'id':_0xdce651[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x24b455,null))[_0xe5c9('0x23')](removeEntity(_0x24b455,null))['catch'](handleError(_0x24b455,null));};exports[_0xe5c9('0x49')]=function(_0x5d7c1d,_0x46122e,_0x493c17){var _0xefe8a3={};var _0x441044={};var _0x31553b;var _0x5e884b;return db[_0xe5c9('0x3c')][_0xe5c9('0x4a')]({'where':{'id':_0x5d7c1d[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x46122e,null))[_0xe5c9('0x23')](function(_0x341219){if(_0x341219){_0x31553b=_0x341219;_0x441044[_0xe5c9('0x2f')]=_['keys'](db[_0xe5c9('0x4b')][_0xe5c9('0x44')]);_0x441044[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x5d7c1d['query']);_0x441044[_0xe5c9('0x37')]=_['intersection'](_0x441044[_0xe5c9('0x2f')],_0x441044[_0xe5c9('0x2c')]);_0xefe8a3[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x441044['model'],qs[_0xe5c9('0x31')](_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x31')]));_0xefe8a3[_0xe5c9('0x30')]=_0xefe8a3['attributes'][_0xe5c9('0x32')]?_0xefe8a3[_0xe5c9('0x30')]:_0x441044['model'];_0xefe8a3['order']=qs['sort'](_0x5d7c1d[_0xe5c9('0x2c')]['sort']);_0xefe8a3[_0xe5c9('0x35')]=qs[_0xe5c9('0x37')](_[_0xe5c9('0x36')](_0x5d7c1d['query'],_0x441044[_0xe5c9('0x37')]));if(_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x38')]){_0xefe8a3['where']=_[_0xe5c9('0x3a')](_0xefe8a3[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0xefe8a3['attributes'],function(_0x4dafa2){var _0x4a1bb6={};_0x4a1bb6[_0x4dafa2]={'$like':'%'+_0x5d7c1d[_0xe5c9('0x2c')]['filter']+'%'};return _0x4a1bb6;})});}_0xefe8a3=_[_0xe5c9('0x3a')]({},_0xefe8a3,_0x5d7c1d[_0xe5c9('0x3b')]);return _0x31553b['getFields'](_0xefe8a3);}})[_0xe5c9('0x23')](function(_0x33f025){if(_0x33f025){_0x5e884b=_0x33f025[_0xe5c9('0x32')];if(!_0x5d7c1d['query'][_0xe5c9('0x33')]('nolimit')){_0xefe8a3[_0xe5c9('0x1a')]=qs['limit'](_0x5d7c1d[_0xe5c9('0x2c')]['limit']);_0xefe8a3[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0x31553b[_0xe5c9('0x49')](_0xefe8a3);}})['then'](function(_0x38d06e){if(_0x38d06e){return _0x38d06e?{'count':_0x5e884b,'rows':_0x38d06e}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x46122e,null))[_0xe5c9('0x41')](handleError(_0x46122e,null));};exports['getSubjects']=function(_0x223730,_0x511ef5,_0x203172){var _0x4e803b={};var _0x1adb84={};var _0xf0e15a;var _0x35cd15;return db['SugarcrmConfiguration'][_0xe5c9('0x4a')]({'where':{'id':_0x223730[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x511ef5,null))[_0xe5c9('0x23')](function(_0x3c6f28){if(_0x3c6f28){_0xf0e15a=_0x3c6f28;_0x1adb84[_0xe5c9('0x2f')]=_[_0xe5c9('0x2d')](db[_0xe5c9('0x4b')]['rawAttributes']);_0x1adb84[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x223730[_0xe5c9('0x2c')]);_0x1adb84['filters']=_['intersection'](_0x1adb84[_0xe5c9('0x2f')],_0x1adb84['query']);_0x4e803b[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x1adb84['model'],qs[_0xe5c9('0x31')](_0x223730['query'][_0xe5c9('0x31')]));_0x4e803b[_0xe5c9('0x30')]=_0x4e803b[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x4e803b[_0xe5c9('0x30')]:_0x1adb84['model'];_0x4e803b[_0xe5c9('0x4c')]=qs['sort'](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x4e803b[_0xe5c9('0x35')]=qs[_0xe5c9('0x37')](_[_0xe5c9('0x36')](_0x223730['query'],_0x1adb84[_0xe5c9('0x37')]));if(_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x38')]){_0x4e803b[_0xe5c9('0x35')]=_['merge'](_0x4e803b[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0x4e803b[_0xe5c9('0x30')],function(_0x531b36){var _0x528af0={};_0x528af0[_0x531b36]={'$like':'%'+_0x223730['query'][_0xe5c9('0x38')]+'%'};return _0x528af0;})});}_0x4e803b=_[_0xe5c9('0x3a')]({},_0x4e803b,_0x223730['options']);return _0xf0e15a[_0xe5c9('0x4d')](_0x4e803b);}})[_0xe5c9('0x23')](function(_0x2dccba){if(_0x2dccba){_0x35cd15=_0x2dccba['length'];if(!_0x223730['query'][_0xe5c9('0x33')](_0xe5c9('0x4e'))){_0x4e803b[_0xe5c9('0x1a')]=qs['limit'](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x1a')]);_0x4e803b[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0xf0e15a['getSubjects'](_0x4e803b);}})[_0xe5c9('0x23')](function(_0x375a4c){if(_0x375a4c){return _0x375a4c?{'count':_0x35cd15,'rows':_0x375a4c}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x511ef5,null))[_0xe5c9('0x41')](handleError(_0x511ef5,null));};exports[_0xe5c9('0x4f')]=function(_0x514dbe,_0x427600,_0x2dca77){var _0x3994f5={};var _0x5b3845={};var _0x4cf402;var _0x4a69ae;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x514dbe[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x427600,null))[_0xe5c9('0x23')](function(_0x166c23){if(_0x166c23){_0x4cf402=_0x166c23;_0x5b3845[_0xe5c9('0x2f')]=_[_0xe5c9('0x2d')](db[_0xe5c9('0x4b')]['rawAttributes']);_0x5b3845[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x514dbe[_0xe5c9('0x2c')]);_0x5b3845[_0xe5c9('0x37')]=_[_0xe5c9('0x2e')](_0x5b3845[_0xe5c9('0x2f')],_0x5b3845['query']);_0x3994f5['attributes']=_['intersection'](_0x5b3845[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x514dbe[_0xe5c9('0x2c')]['fields']));_0x3994f5['attributes']=_0x3994f5[_0xe5c9('0x30')]['length']?_0x3994f5[_0xe5c9('0x30')]:_0x5b3845[_0xe5c9('0x2f')];_0x3994f5[_0xe5c9('0x4c')]=qs[_0xe5c9('0x34')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x3994f5[_0xe5c9('0x35')]=qs['filters'](_['pick'](_0x514dbe[_0xe5c9('0x2c')],_0x5b3845[_0xe5c9('0x37')]));if(_0x514dbe[_0xe5c9('0x2c')]['filter']){_0x3994f5[_0xe5c9('0x35')]=_['merge'](_0x3994f5[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0x3994f5['attributes'],function(_0x395057){var _0x2253d3={};_0x2253d3[_0x395057]={'$like':'%'+_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x38')]+'%'};return _0x2253d3;})});}_0x3994f5=_[_0xe5c9('0x3a')]({},_0x3994f5,_0x514dbe['options']);return _0x4cf402[_0xe5c9('0x4f')](_0x3994f5);}})[_0xe5c9('0x23')](function(_0x1f69fe){if(_0x1f69fe){_0x4a69ae=_0x1f69fe[_0xe5c9('0x32')];if(!_0x514dbe[_0xe5c9('0x2c')]['hasOwnProperty']('nolimit')){_0x3994f5[_0xe5c9('0x1a')]=qs[_0xe5c9('0x1a')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x1a')]);_0x3994f5[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0x4cf402[_0xe5c9('0x4f')](_0x3994f5);}})[_0xe5c9('0x23')](function(_0x12d019){if(_0x12d019){return _0x12d019?{'count':_0x4a69ae,'rows':_0x12d019}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x427600,null))[_0xe5c9('0x41')](handleError(_0x427600,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cbf5b35..2dd3ac6 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 _0xb614=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb614,0x6c));var _0x4b61=function(_0x2069c4,_0x4b0a57){_0x2069c4=_0x2069c4-0x0;var _0xd0008f=_0xb614[_0x2069c4];return _0xd0008f;};'use strict';var _=require('lodash');var util=require(_0x4b61('0x0'));var logger=require('../../config/logger')(_0x4b61('0x1'));var moment=require('moment');var BPromise=require(_0x4b61('0x2'));var rp=require(_0x4b61('0x3'));var fs=require('fs');var path=require(_0x4b61('0x4'));var rimraf=require(_0x4b61('0x5'));var config=require(_0x4b61('0x6'));var attributes=require(_0x4b61('0x7'));module[_0x4b61('0x8')]=function(_0xbb06ee,_0x1c0735){return _0xbb06ee['define'](_0x4b61('0x9'),attributes,{'tableName':_0x4b61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19d0=['moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0xe08925,_0x46ee17){var _0x17b36e=function(_0x36b162){while(--_0x36b162){_0xe08925['push'](_0xe08925['shift']());}};_0x17b36e(++_0x46ee17);}(_0x19d0,0xc2));var _0x019d=function(_0x29431d,_0x23d339){_0x29431d=_0x29431d-0x0;var _0x49f8ac=_0x19d0[_0x29431d];return _0x49f8ac;};'use strict';var _=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var logger=require(_0x019d('0x2'))(_0x019d('0x3'));var moment=require(_0x019d('0x4'));var BPromise=require(_0x019d('0x5'));var rp=require(_0x019d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x019d('0x7'));var config=require('../../config/environment');var attributes=require(_0x019d('0x8'));module['exports']=function(_0x382e18,_0x3a18eb){return _0x382e18['define'](_0x019d('0x9'),attributes,{'tableName':_0x019d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 3a822e8..9355442 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 _0xe8c1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3539f2,_0x3037dd){var _0x32c6c5=function(_0x559c89){while(--_0x559c89){_0x3539f2['push'](_0x3539f2['shift']());}};_0x32c6c5(++_0x3037dd);}(_0xe8c1,0x164));var _0x1e8c=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xe8c1[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x1e8c('0x0'));var util=require(_0x1e8c('0x1'));var moment=require(_0x1e8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e8c('0x3'));var fs=require('fs');var Redis=require(_0x1e8c('0x4'));var db=require(_0x1e8c('0x5'))['db'];var utils=require(_0x1e8c('0x6'));var logger=require(_0x1e8c('0x7'))(_0x1e8c('0x8'));var config=require('../../config/environment');var jayson=require(_0x1e8c('0x9'));var client=jayson[_0x1e8c('0xa')][_0x1e8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a5cf1,_0x596956,_0x403505){return new BPromise(function(_0x22bbb7,_0x101ce3){return client[_0x1e8c('0xc')](_0x4a5cf1,_0x403505)['then'](function(_0x2c3ae5){logger[_0x1e8c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x596956,_0x1e8c('0xe'));logger[_0x1e8c('0xf')](_0x1e8c('0x10'),_0x596956,'request\x20sent',JSON[_0x1e8c('0x11')](_0x2c3ae5));if(_0x2c3ae5[_0x1e8c('0x12')]){if(_0x2c3ae5[_0x1e8c('0x12')][_0x1e8c('0x13')]===0x1f4){logger[_0x1e8c('0x12')](_0x1e8c('0x14'),_0x596956,_0x2c3ae5['error'][_0x1e8c('0x15')]);return _0x101ce3(_0x2c3ae5['error'][_0x1e8c('0x15')]);}logger[_0x1e8c('0x12')](_0x1e8c('0x14'),_0x596956,_0x2c3ae5[_0x1e8c('0x12')][_0x1e8c('0x15')]);return _0x22bbb7(_0x2c3ae5['error'][_0x1e8c('0x15')]);}else{logger[_0x1e8c('0xd')](_0x1e8c('0x14'),_0x596956,_0x1e8c('0xe'));_0x22bbb7(_0x2c3ae5[_0x1e8c('0x16')]['message']);}})[_0x1e8c('0x17')](function(_0x185867){logger[_0x1e8c('0x12')](_0x1e8c('0x14'),_0x596956,_0x185867);_0x101ce3(_0x185867);});});} \ No newline at end of file +var _0x2641=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x2641,0x133));var _0x1264=function(_0x4bd700,_0x3e2348){_0x4bd700=_0x4bd700-0x0;var _0x12b765=_0x2641[_0x4bd700];return _0x12b765;};'use strict';var _=require(_0x1264('0x0'));var util=require(_0x1264('0x1'));var moment=require('moment');var BPromise=require(_0x1264('0x2'));var rs=require(_0x1264('0x3'));var fs=require('fs');var Redis=require(_0x1264('0x4'));var db=require(_0x1264('0x5'))['db'];var utils=require(_0x1264('0x6'));var logger=require(_0x1264('0x7'))('rpc');var config=require(_0x1264('0x8'));var jayson=require(_0x1264('0x9'));var client=jayson[_0x1264('0xa')][_0x1264('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb9e2,_0x47f23b,_0x52a232){return new BPromise(function(_0x234e09,_0x5c610f){return client['request'](_0x3eb9e2,_0x52a232)[_0x1264('0xc')](function(_0xb7c6ad){logger[_0x1264('0xd')](_0x1264('0xe'),_0x47f23b,'request\x20sent');logger[_0x1264('0xf')](_0x1264('0x10'),_0x47f23b,_0x1264('0x11'),JSON[_0x1264('0x12')](_0xb7c6ad));if(_0xb7c6ad[_0x1264('0x13')]){if(_0xb7c6ad[_0x1264('0x13')][_0x1264('0x14')]===0x1f4){logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0xb7c6ad[_0x1264('0x13')]['message']);return _0x5c610f(_0xb7c6ad[_0x1264('0x13')][_0x1264('0x15')]);}logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0xb7c6ad['error'][_0x1264('0x15')]);return _0x234e09(_0xb7c6ad[_0x1264('0x13')]['message']);}else{logger[_0x1264('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x47f23b,_0x1264('0x11'));_0x234e09(_0xb7c6ad[_0x1264('0x16')][_0x1264('0x15')]);}})[_0x1264('0x17')](function(_0x30dfe3){logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0x30dfe3);_0x5c610f(_0x30dfe3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1b4ad82..4060788 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 _0x3d4d=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2da8a5,_0x514e82){var _0x3d7a8e=function(_0x12cfbc){while(--_0x12cfbc){_0x2da8a5['push'](_0x2da8a5['shift']());}};_0x3d7a8e(++_0x514e82);}(_0x3d4d,0xf8));var _0xd3d4=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0x3d4d[_0x1e2072];return _0x22956b;};'use strict';var multer=require('multer');var util=require(_0xd3d4('0x0'));var path=require(_0xd3d4('0x1'));var timeout=require(_0xd3d4('0x2'));var express=require(_0xd3d4('0x3'));var router=express[_0xd3d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3d4('0x5'));var interaction=require(_0xd3d4('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xd3d4('0x7')]('/',auth[_0xd3d4('0x8')](),controller[_0xd3d4('0x9')]);router[_0xd3d4('0x7')](_0xd3d4('0xa'),auth[_0xd3d4('0x8')](),controller[_0xd3d4('0xb')]);router[_0xd3d4('0xc')]('/',auth[_0xd3d4('0x8')](),controller[_0xd3d4('0xd')]);router['put'](_0xd3d4('0xa'),auth[_0xd3d4('0x8')](),controller[_0xd3d4('0xe')]);router[_0xd3d4('0xf')](_0xd3d4('0xa'),auth['isAuthenticated'](),controller[_0xd3d4('0x10')]);module[_0xd3d4('0x11')]=router; \ No newline at end of file +var _0xb679=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x22499b,_0x3d5a5c){var _0x35cabe=function(_0x883037){while(--_0x883037){_0x22499b['push'](_0x22499b['shift']());}};_0x35cabe(++_0x3d5a5c);}(_0xb679,0xe5));var _0x9b67=function(_0xed0f75,_0x279c68){_0xed0f75=_0xed0f75-0x0;var _0x3abd22=_0xb679[_0xed0f75];return _0x3abd22;};'use strict';var multer=require(_0x9b67('0x0'));var util=require('util');var path=require(_0x9b67('0x1'));var timeout=require(_0x9b67('0x2'));var express=require(_0x9b67('0x3'));var router=express[_0x9b67('0x4')]();var fs_extra=require(_0x9b67('0x5'));var auth=require(_0x9b67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b67('0x7'));var controller=require(_0x9b67('0x8'));router[_0x9b67('0x9')]('/',auth[_0x9b67('0xa')](),controller[_0x9b67('0xb')]);router[_0x9b67('0x9')]('/:id',auth[_0x9b67('0xa')](),controller[_0x9b67('0xc')]);router[_0x9b67('0xd')]('/',auth[_0x9b67('0xa')](),controller[_0x9b67('0xe')]);router[_0x9b67('0xf')](_0x9b67('0x10'),auth['isAuthenticated'](),controller[_0x9b67('0x11')]);router[_0x9b67('0x12')](_0x9b67('0x10'),auth['isAuthenticated'](),controller[_0x9b67('0x13')]);module[_0x9b67('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0c0b338..9a289ef 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 _0xa21d=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x15682b,_0x2ee518){var _0x3b0f46=function(_0x2840b5){while(--_0x2840b5){_0x15682b['push'](_0x15682b['shift']());}};_0x3b0f46(++_0x2ee518);}(_0xa21d,0x1af));var _0xda21=function(_0x2afee1,_0x3faf03){_0x2afee1=_0x2afee1-0x0;var _0x208de2=_0xa21d[_0x2afee1];return _0x208de2;};'use strict';var Sequelize=require(_0xda21('0x0'));module[_0xda21('0x1')]={'type':{'type':Sequelize[_0xda21('0x2')](_0xda21('0x3'),_0xda21('0x4'),_0xda21('0x5'),_0xda21('0x6'),_0xda21('0x7')),'defaultValue':_0xda21('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xda21('0x2')](_0xda21('0x3'),_0xda21('0x4'),_0xda21('0x5'))},'keyContent':{'type':Sequelize[_0xda21('0x8')]},'idField':{'type':Sequelize[_0xda21('0x8')]},'nameField':{'type':Sequelize[_0xda21('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xceda=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x131cc,_0x157ea9){var _0x36e23b=function(_0x364bbf){while(--_0x364bbf){_0x131cc['push'](_0x131cc['shift']());}};_0x36e23b(++_0x157ea9);}(_0xceda,0x1ad));var _0xaced=function(_0x15ee54,_0x3908f1){_0x15ee54=_0x15ee54-0x0;var _0x59cc40=_0xceda[_0x15ee54];return _0x59cc40;};'use strict';var Sequelize=require(_0xaced('0x0'));module[_0xaced('0x1')]={'type':{'type':Sequelize[_0xaced('0x2')]('string','variable',_0xaced('0x3'),_0xaced('0x4'),_0xaced('0x5')),'defaultValue':_0xaced('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaced('0x7')]},'keyType':{'type':Sequelize[_0xaced('0x2')](_0xaced('0x6'),'variable',_0xaced('0x3'))},'keyContent':{'type':Sequelize[_0xaced('0x7')]},'idField':{'type':Sequelize[_0xaced('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaced('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaced('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 55f701c..6f32508 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 _0xc156=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','index','map','SugarcrmField','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x476f6d,_0x361ec6){var _0x1c6cb3=function(_0x2a33a5){while(--_0x2a33a5){_0x476f6d['push'](_0x476f6d['shift']());}};_0x1c6cb3(++_0x361ec6);}(_0xc156,0x89));var _0x6c15=function(_0x1df999,_0x49c69d){_0x1df999=_0x1df999-0x0;var _0x13b087=_0xc156[_0x1df999];return _0x13b087;};'use strict';var emlformat=require(_0x6c15('0x0'));var rimraf=require(_0x6c15('0x1'));var zipdir=require(_0x6c15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c15('0x3'));var moment=require(_0x6c15('0x4'));var BPromise=require(_0x6c15('0x5'));var Mustache=require('mustache');var util=require(_0x6c15('0x6'));var path=require(_0x6c15('0x7'));var sox=require(_0x6c15('0x8'));var csv=require(_0x6c15('0x9'));var ejs=require(_0x6c15('0xa'));var fs=require('fs');var fs_extra=require(_0x6c15('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c15('0xc'));var jsforce=require(_0x6c15('0xd'));var deskjs=require(_0x6c15('0xe'));var toCsv=require(_0x6c15('0x9'));var querystring=require(_0x6c15('0xf'));var Papa=require(_0x6c15('0x10'));var Redis=require(_0x6c15('0x11'));var authService=require(_0x6c15('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6c15('0x13'));var hardwareService=require(_0x6c15('0x14'));var logger=require(_0x6c15('0x15'))(_0x6c15('0x16'));var utils=require(_0x6c15('0x17'));var config=require(_0x6c15('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c15('0x19'))['db'];function respondWithStatusCode(_0x3a5f8b,_0x40d108){_0x40d108=_0x40d108||0xcc;return function(_0x1f2214){if(_0x1f2214){return _0x3a5f8b['sendStatus'](_0x40d108);}return _0x3a5f8b['status'](_0x40d108)[_0x6c15('0x1a')]();};}function respondWithResult(_0x26e82b,_0xaede5d){_0xaede5d=_0xaede5d||0xc8;return function(_0x3638b6){if(_0x3638b6){return _0x26e82b[_0x6c15('0x1b')](_0xaede5d)[_0x6c15('0x1c')](_0x3638b6);}};}function respondWithFilteredResult(_0x48ffb9,_0xa10f6d){return function(_0x1a28a0){if(_0x1a28a0){var _0x24d8a2=typeof _0xa10f6d[_0x6c15('0x1d')]==='undefined'&&typeof _0xa10f6d[_0x6c15('0x1e')]===_0x6c15('0x1f');var _0x32af03=_0x1a28a0[_0x6c15('0x20')];var _0x58c138=_0x24d8a2?0x0:_0xa10f6d[_0x6c15('0x1d')];var _0x597d58=_0x24d8a2?_0x1a28a0[_0x6c15('0x20')]:_0xa10f6d[_0x6c15('0x1d')]+_0xa10f6d['limit'];var _0x4d0992;if(_0x597d58>=_0x32af03){_0x597d58=_0x32af03;_0x4d0992=0xc8;}else{_0x4d0992=0xce;}_0x48ffb9[_0x6c15('0x1b')](_0x4d0992);return _0x48ffb9[_0x6c15('0x21')](_0x6c15('0x22'),_0x58c138+'-'+_0x597d58+'/'+_0x32af03)['json'](_0x1a28a0);}return null;};}function patchUpdates(_0x1c9e20){return function(_0x54854a){try{jsonpatch[_0x6c15('0x23')](_0x54854a,_0x1c9e20,!![]);}catch(_0x108474){return BPromise[_0x6c15('0x24')](_0x108474);}return _0x54854a['save']();};}function saveUpdates(_0x32c867,_0x487e1e){return function(_0xfdf317){if(_0xfdf317){return _0xfdf317['update'](_0x32c867)[_0x6c15('0x25')](function(_0xb26bda){return _0xb26bda;});}return null;};}function removeEntity(_0x3d05ad,_0x40288e){return function(_0x5e805c){if(_0x5e805c){return _0x5e805c[_0x6c15('0x26')]()['then'](function(){_0x3d05ad[_0x6c15('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8494,_0x4d9987){return function(_0x2d4759){if(!_0x2d4759){_0x1c8494[_0x6c15('0x27')](0x194);}return _0x2d4759;};}function handleError(_0x228132,_0x5991b8){_0x5991b8=_0x5991b8||0x1f4;return function(_0x1df804){logger[_0x6c15('0x28')](_0x1df804[_0x6c15('0x29')]);if(_0x1df804['name']){delete _0x1df804['name'];}_0x228132[_0x6c15('0x1b')](_0x5991b8)['send'](_0x1df804);};}exports[_0x6c15('0x2a')]=function(_0x194f40,_0x22ebdd){var _0x2558f2={},_0x866dcb={},_0x43f6c5={'count':0x0,'rows':[]};var _0x1cd29e=_[_0x6c15('0x2b')](db[_0x6c15('0x2c')][_0x6c15('0x2d')],function(_0x29608e){return{'name':_0x29608e['fieldName'],'type':_0x29608e[_0x6c15('0x2e')][_0x6c15('0x2f')]};});_0x866dcb[_0x6c15('0x30')]=_[_0x6c15('0x2b')](_0x1cd29e,_0x6c15('0x31'));_0x866dcb['query']=_['keys'](_0x194f40[_0x6c15('0x32')]);_0x866dcb[_0x6c15('0x33')]=_[_0x6c15('0x34')](_0x866dcb[_0x6c15('0x30')],_0x866dcb[_0x6c15('0x32')]);_0x2558f2['attributes']=_[_0x6c15('0x34')](_0x866dcb[_0x6c15('0x30')],qs[_0x6c15('0x35')](_0x194f40[_0x6c15('0x32')][_0x6c15('0x35')]));_0x2558f2[_0x6c15('0x36')]=_0x2558f2[_0x6c15('0x36')]['length']?_0x2558f2['attributes']:_0x866dcb[_0x6c15('0x30')];if(!_0x194f40[_0x6c15('0x32')][_0x6c15('0x37')](_0x6c15('0x38'))){_0x2558f2[_0x6c15('0x1e')]=qs[_0x6c15('0x1e')](_0x194f40[_0x6c15('0x32')][_0x6c15('0x1e')]);_0x2558f2['offset']=qs[_0x6c15('0x1d')](_0x194f40['query'][_0x6c15('0x1d')]);}_0x2558f2[_0x6c15('0x39')]=qs[_0x6c15('0x3a')](_0x194f40['query'][_0x6c15('0x3a')]);_0x2558f2['where']=qs['filters'](_[_0x6c15('0x3b')](_0x194f40[_0x6c15('0x32')],_0x866dcb[_0x6c15('0x33')]),_0x1cd29e);if(_0x194f40[_0x6c15('0x32')]['filter']){_0x2558f2['where']=_[_0x6c15('0x3c')](_0x2558f2[_0x6c15('0x3d')],{'$or':_['map'](_0x1cd29e,function(_0x1c7479){if(_0x1c7479[_0x6c15('0x2e')]!==_0x6c15('0x3e')){var _0x1bde99={};_0x1bde99[_0x1c7479['name']]={'$like':'%'+_0x194f40['query'][_0x6c15('0x3f')]+'%'};return _0x1bde99;}})});}_0x2558f2=_[_0x6c15('0x3c')]({},_0x2558f2,_0x194f40[_0x6c15('0x40')]);var _0x2cadca={'where':_0x2558f2[_0x6c15('0x3d')]};return db['SugarcrmField'][_0x6c15('0x20')](_0x2cadca)['then'](function(_0x125634){_0x43f6c5[_0x6c15('0x20')]=_0x125634;if(_0x194f40[_0x6c15('0x32')]['includeAll']){_0x2558f2[_0x6c15('0x41')]=[{'all':!![]}];}return db[_0x6c15('0x2c')][_0x6c15('0x42')](_0x2558f2);})[_0x6c15('0x25')](function(_0x14e04e){_0x43f6c5[_0x6c15('0x43')]=_0x14e04e;return _0x43f6c5;})[_0x6c15('0x25')](respondWithFilteredResult(_0x22ebdd,_0x2558f2))[_0x6c15('0x44')](handleError(_0x22ebdd,null));};exports[_0x6c15('0x45')]=function(_0xf5a35a,_0x204c42){var _0x15dab2={'raw':!![],'where':{'id':_0xf5a35a[_0x6c15('0x46')]['id']}},_0x151569={};_0x151569[_0x6c15('0x30')]=_[_0x6c15('0x47')](db[_0x6c15('0x2c')][_0x6c15('0x2d')]);_0x151569[_0x6c15('0x32')]=_[_0x6c15('0x47')](_0xf5a35a[_0x6c15('0x32')]);_0x151569[_0x6c15('0x33')]=_[_0x6c15('0x34')](_0x151569[_0x6c15('0x30')],_0x151569['query']);_0x15dab2[_0x6c15('0x36')]=_['intersection'](_0x151569[_0x6c15('0x30')],qs[_0x6c15('0x35')](_0xf5a35a[_0x6c15('0x32')][_0x6c15('0x35')]));_0x15dab2[_0x6c15('0x36')]=_0x15dab2[_0x6c15('0x36')][_0x6c15('0x48')]?_0x15dab2[_0x6c15('0x36')]:_0x151569[_0x6c15('0x30')];if(_0xf5a35a[_0x6c15('0x32')][_0x6c15('0x49')]){_0x15dab2[_0x6c15('0x41')]=[{'all':!![]}];}_0x15dab2=_[_0x6c15('0x3c')]({},_0x15dab2,_0xf5a35a[_0x6c15('0x40')]);return db[_0x6c15('0x2c')][_0x6c15('0x4a')](_0x15dab2)[_0x6c15('0x25')](handleEntityNotFound(_0x204c42,null))['then'](respondWithResult(_0x204c42,null))[_0x6c15('0x44')](handleError(_0x204c42,null));};exports[_0x6c15('0x4b')]=function(_0x4bc22a,_0x34d412){return db[_0x6c15('0x2c')]['create'](_0x4bc22a['body'],{})['then'](respondWithResult(_0x34d412,0xc9))[_0x6c15('0x44')](handleError(_0x34d412,null));};exports[_0x6c15('0x4c')]=function(_0x5e2c94,_0x4e4e8e){if(_0x5e2c94[_0x6c15('0x4d')]['id']){delete _0x5e2c94[_0x6c15('0x4d')]['id'];}return db[_0x6c15('0x2c')][_0x6c15('0x4a')]({'where':{'id':_0x5e2c94[_0x6c15('0x46')]['id']}})[_0x6c15('0x25')](handleEntityNotFound(_0x4e4e8e,null))[_0x6c15('0x25')](saveUpdates(_0x5e2c94['body'],null))['then'](respondWithResult(_0x4e4e8e,null))[_0x6c15('0x44')](handleError(_0x4e4e8e,null));};exports[_0x6c15('0x26')]=function(_0x3dfa2b,_0x58f8f1){return db['SugarcrmField']['find']({'where':{'id':_0x3dfa2b[_0x6c15('0x46')]['id']}})[_0x6c15('0x25')](handleEntityNotFound(_0x58f8f1,null))[_0x6c15('0x25')](removeEntity(_0x58f8f1,null))['catch'](handleError(_0x58f8f1,null));}; \ No newline at end of file +var _0xcbaa=['lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra'];(function(_0x10949d,_0x36325a){var _0x28f4e6=function(_0x105808){while(--_0x105808){_0x10949d['push'](_0x10949d['shift']());}};_0x28f4e6(++_0x36325a);}(_0xcbaa,0x196));var _0xacba=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xcbaa[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacba('0x1'));var rp=require('request-promise');var moment=require(_0xacba('0x2'));var BPromise=require(_0xacba('0x3'));var Mustache=require(_0xacba('0x4'));var util=require('util');var path=require(_0xacba('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacba('0x6'));var fs=require('fs');var fs_extra=require(_0xacba('0x7'));var _=require(_0xacba('0x8'));var squel=require(_0xacba('0x9'));var crypto=require(_0xacba('0xa'));var jsforce=require(_0xacba('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xacba('0xc'));var querystring=require(_0xacba('0xd'));var Papa=require(_0xacba('0xe'));var Redis=require('ioredis');var authService=require(_0xacba('0xf'));var qs=require(_0xacba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xacba('0x11'))('api');var utils=require(_0xacba('0x12'));var config=require(_0xacba('0x13'));var licenseUtil=require(_0xacba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d2aa,_0x2f6db8){_0x2f6db8=_0x2f6db8||0xcc;return function(_0x47b659){if(_0x47b659){return _0x42d2aa[_0xacba('0x15')](_0x2f6db8);}return _0x42d2aa[_0xacba('0x16')](_0x2f6db8)[_0xacba('0x17')]();};}function respondWithResult(_0x42e013,_0x1d6415){_0x1d6415=_0x1d6415||0xc8;return function(_0x28a2c6){if(_0x28a2c6){return _0x42e013[_0xacba('0x16')](_0x1d6415)[_0xacba('0x18')](_0x28a2c6);}};}function respondWithFilteredResult(_0x582687,_0x57e82b){return function(_0x318efb){if(_0x318efb){var _0x2f4a36=typeof _0x57e82b['offset']===_0xacba('0x19')&&typeof _0x57e82b[_0xacba('0x1a')]==='undefined';var _0x47528d=_0x318efb[_0xacba('0x1b')];var _0x5a7cd0=_0x2f4a36?0x0:_0x57e82b['offset'];var _0x3975a3=_0x2f4a36?_0x318efb['count']:_0x57e82b[_0xacba('0x1c')]+_0x57e82b['limit'];var _0x50620c;if(_0x3975a3>=_0x47528d){_0x3975a3=_0x47528d;_0x50620c=0xc8;}else{_0x50620c=0xce;}_0x582687[_0xacba('0x16')](_0x50620c);return _0x582687[_0xacba('0x1d')]('Content-Range',_0x5a7cd0+'-'+_0x3975a3+'/'+_0x47528d)['json'](_0x318efb);}return null;};}function patchUpdates(_0x368e05){return function(_0x49b3eb){try{jsonpatch[_0xacba('0x1e')](_0x49b3eb,_0x368e05,!![]);}catch(_0xb799f2){return BPromise[_0xacba('0x1f')](_0xb799f2);}return _0x49b3eb[_0xacba('0x20')]();};}function saveUpdates(_0x50a61b,_0x4cca61){return function(_0x1b87e3){if(_0x1b87e3){return _0x1b87e3[_0xacba('0x21')](_0x50a61b)[_0xacba('0x22')](function(_0x2039e4){return _0x2039e4;});}return null;};}function removeEntity(_0x135c75,_0x2f89a5){return function(_0x2d3662){if(_0x2d3662){return _0x2d3662[_0xacba('0x23')]()[_0xacba('0x22')](function(){_0x135c75['status'](0xcc)[_0xacba('0x17')]();});}};}function handleEntityNotFound(_0x494949,_0x5d434f){return function(_0x13fa12){if(!_0x13fa12){_0x494949[_0xacba('0x15')](0x194);}return _0x13fa12;};}function handleError(_0x19fa4c,_0xae6559){_0xae6559=_0xae6559||0x1f4;return function(_0x3c6253){logger[_0xacba('0x24')](_0x3c6253[_0xacba('0x25')]);if(_0x3c6253[_0xacba('0x26')]){delete _0x3c6253[_0xacba('0x26')];}_0x19fa4c[_0xacba('0x16')](_0xae6559)[_0xacba('0x27')](_0x3c6253);};}exports['index']=function(_0x3c7b2b,_0x3bea23){var _0x15a619={},_0x5e7ab4={},_0x42b0e2={'count':0x0,'rows':[]};var _0x3ac68b=_[_0xacba('0x28')](db[_0xacba('0x29')][_0xacba('0x2a')],function(_0x1f7d84){return{'name':_0x1f7d84['fieldName'],'type':_0x1f7d84[_0xacba('0x2b')]['key']};});_0x5e7ab4[_0xacba('0x2c')]=_[_0xacba('0x28')](_0x3ac68b,'name');_0x5e7ab4[_0xacba('0x2d')]=_['keys'](_0x3c7b2b[_0xacba('0x2d')]);_0x5e7ab4[_0xacba('0x2e')]=_['intersection'](_0x5e7ab4[_0xacba('0x2c')],_0x5e7ab4[_0xacba('0x2d')]);_0x15a619[_0xacba('0x2f')]=_[_0xacba('0x30')](_0x5e7ab4[_0xacba('0x2c')],qs[_0xacba('0x31')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x31')]));_0x15a619[_0xacba('0x2f')]=_0x15a619[_0xacba('0x2f')][_0xacba('0x32')]?_0x15a619[_0xacba('0x2f')]:_0x5e7ab4[_0xacba('0x2c')];if(!_0x3c7b2b[_0xacba('0x2d')]['hasOwnProperty'](_0xacba('0x33'))){_0x15a619[_0xacba('0x1a')]=qs[_0xacba('0x1a')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x1a')]);_0x15a619[_0xacba('0x1c')]=qs[_0xacba('0x1c')](_0x3c7b2b['query'][_0xacba('0x1c')]);}_0x15a619[_0xacba('0x34')]=qs[_0xacba('0x35')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x35')]);_0x15a619[_0xacba('0x36')]=qs[_0xacba('0x2e')](_['pick'](_0x3c7b2b['query'],_0x5e7ab4[_0xacba('0x2e')]),_0x3ac68b);if(_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x37')]){_0x15a619['where']=_[_0xacba('0x38')](_0x15a619[_0xacba('0x36')],{'$or':_[_0xacba('0x28')](_0x3ac68b,function(_0x574a7a){if(_0x574a7a[_0xacba('0x2b')]!==_0xacba('0x39')){var _0x15b2f8={};_0x15b2f8[_0x574a7a[_0xacba('0x26')]]={'$like':'%'+_0x3c7b2b['query'][_0xacba('0x37')]+'%'};return _0x15b2f8;}})});}_0x15a619=_['merge']({},_0x15a619,_0x3c7b2b[_0xacba('0x3a')]);var _0x56dbf0={'where':_0x15a619[_0xacba('0x36')]};return db[_0xacba('0x29')][_0xacba('0x1b')](_0x56dbf0)['then'](function(_0x405fcc){_0x42b0e2[_0xacba('0x1b')]=_0x405fcc;if(_0x3c7b2b['query'][_0xacba('0x3b')]){_0x15a619[_0xacba('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0xacba('0x3d')](_0x15a619);})[_0xacba('0x22')](function(_0x6d37c4){_0x42b0e2[_0xacba('0x3e')]=_0x6d37c4;return _0x42b0e2;})['then'](respondWithFilteredResult(_0x3bea23,_0x15a619))[_0xacba('0x3f')](handleError(_0x3bea23,null));};exports[_0xacba('0x40')]=function(_0x1d23a4,_0x19e288){var _0x4c16af={'raw':!![],'where':{'id':_0x1d23a4['params']['id']}},_0x5385d1={};_0x5385d1['model']=_['keys'](db[_0xacba('0x29')]['rawAttributes']);_0x5385d1[_0xacba('0x2d')]=_[_0xacba('0x41')](_0x1d23a4[_0xacba('0x2d')]);_0x5385d1['filters']=_['intersection'](_0x5385d1[_0xacba('0x2c')],_0x5385d1['query']);_0x4c16af['attributes']=_['intersection'](_0x5385d1['model'],qs[_0xacba('0x31')](_0x1d23a4[_0xacba('0x2d')]['fields']));_0x4c16af[_0xacba('0x2f')]=_0x4c16af[_0xacba('0x2f')][_0xacba('0x32')]?_0x4c16af[_0xacba('0x2f')]:_0x5385d1[_0xacba('0x2c')];if(_0x1d23a4[_0xacba('0x2d')]['includeAll']){_0x4c16af[_0xacba('0x3c')]=[{'all':!![]}];}_0x4c16af=_[_0xacba('0x38')]({},_0x4c16af,_0x1d23a4['options']);return db[_0xacba('0x29')][_0xacba('0x42')](_0x4c16af)[_0xacba('0x22')](handleEntityNotFound(_0x19e288,null))[_0xacba('0x22')](respondWithResult(_0x19e288,null))[_0xacba('0x3f')](handleError(_0x19e288,null));};exports[_0xacba('0x43')]=function(_0xe3a005,_0x40b6b1){return db['SugarcrmField'][_0xacba('0x43')](_0xe3a005['body'],{})['then'](respondWithResult(_0x40b6b1,0xc9))[_0xacba('0x3f')](handleError(_0x40b6b1,null));};exports[_0xacba('0x21')]=function(_0xb9d99,_0x3d6f9d){if(_0xb9d99[_0xacba('0x44')]['id']){delete _0xb9d99[_0xacba('0x44')]['id'];}return db[_0xacba('0x29')][_0xacba('0x42')]({'where':{'id':_0xb9d99['params']['id']}})[_0xacba('0x22')](handleEntityNotFound(_0x3d6f9d,null))[_0xacba('0x22')](saveUpdates(_0xb9d99[_0xacba('0x44')],null))[_0xacba('0x22')](respondWithResult(_0x3d6f9d,null))[_0xacba('0x3f')](handleError(_0x3d6f9d,null));};exports[_0xacba('0x23')]=function(_0x32af85,_0x56aba0){return db[_0xacba('0x29')][_0xacba('0x42')]({'where':{'id':_0x32af85['params']['id']}})['then'](handleEntityNotFound(_0x56aba0,null))['then'](removeEntity(_0x56aba0,null))[_0xacba('0x3f')](handleError(_0x56aba0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 03ffa4d..977a094 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 _0x83bb=['api','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0x83bb,0x107));var _0xb83b=function(_0x465d1a,_0x1de18b){_0x465d1a=_0x465d1a-0x0;var _0x3baea9=_0x83bb[_0x465d1a];return _0x3baea9;};'use strict';var _=require(_0xb83b('0x0'));var util=require(_0xb83b('0x1'));var logger=require(_0xb83b('0x2'))(_0xb83b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb83b('0x4'));var rimraf=require(_0xb83b('0x5'));var config=require(_0xb83b('0x6'));var attributes=require(_0xb83b('0x7'));module[_0xb83b('0x8')]=function(_0xe7844b,_0x1f82bf){return _0xe7844b[_0xb83b('0x9')](_0xb83b('0xa'),attributes,{'tableName':_0xb83b('0xb'),'paranoid':![],'indexes':[{'name':_0xb83b('0xc'),'fields':['idField',_0xb83b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8dd0=['exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x451e09,_0x17ae70){var _0x3c1be8=function(_0x76336a){while(--_0x76336a){_0x451e09['push'](_0x451e09['shift']());}};_0x3c1be8(++_0x17ae70);}(_0x8dd0,0x147));var _0x08dd=function(_0x8f4e81,_0x397d44){_0x8f4e81=_0x8f4e81-0x0;var _0x1cd790=_0x8dd0[_0x8f4e81];return _0x1cd790;};'use strict';var _=require(_0x08dd('0x0'));var util=require(_0x08dd('0x1'));var logger=require(_0x08dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x08dd('0x3'));var rp=require(_0x08dd('0x4'));var fs=require('fs');var path=require(_0x08dd('0x5'));var rimraf=require(_0x08dd('0x6'));var config=require(_0x08dd('0x7'));var attributes=require(_0x08dd('0x8'));module[_0x08dd('0x9')]=function(_0x5dcbca,_0x1a4b36){return _0x5dcbca['define'](_0x08dd('0xa'),attributes,{'tableName':_0x08dd('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x08dd('0xc'),_0x08dd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 2de2a8f..10921c9 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 _0x7bbb=['message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x1db547,_0x4a0861){var _0x5c9fc1=function(_0x4e38b8){while(--_0x4e38b8){_0x1db547['push'](_0x1db547['shift']());}};_0x5c9fc1(++_0x4a0861);}(_0x7bbb,0x101));var _0xb7bb=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7bbb[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xb7bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb7bb('0x1'));var rs=require(_0xb7bb('0x2'));var fs=require('fs');var Redis=require(_0xb7bb('0x3'));var db=require(_0xb7bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb7bb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb7bb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75b2cd,_0xe67524,_0x598cb2){return new BPromise(function(_0x35a76c,_0x3b705a){return client[_0xb7bb('0x7')](_0x75b2cd,_0x598cb2)[_0xb7bb('0x8')](function(_0x35d28c){logger[_0xb7bb('0x9')](_0xb7bb('0xa'),_0xe67524,'request\x20sent');logger[_0xb7bb('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xe67524,_0xb7bb('0xc'),JSON['stringify'](_0x35d28c));if(_0x35d28c[_0xb7bb('0xd')]){if(_0x35d28c[_0xb7bb('0xd')][_0xb7bb('0xe')]===0x1f4){logger[_0xb7bb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0xe67524,_0x35d28c['error']['message']);return _0x3b705a(_0x35d28c[_0xb7bb('0xd')]['message']);}logger['error'](_0xb7bb('0xa'),_0xe67524,_0x35d28c[_0xb7bb('0xd')][_0xb7bb('0xf')]);return _0x35a76c(_0x35d28c[_0xb7bb('0xd')][_0xb7bb('0xf')]);}else{logger[_0xb7bb('0x9')]('SugarcrmField,\x20%s,\x20%s',_0xe67524,'request\x20sent');_0x35a76c(_0x35d28c[_0xb7bb('0x10')][_0xb7bb('0xf')]);}})['catch'](function(_0x5daa7a){logger[_0xb7bb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0xe67524,_0x5daa7a);_0x3b705a(_0x5daa7a);});});} \ No newline at end of file +var _0xf0c8=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0x458c4c,_0xb3540){var _0x4fa73d=function(_0x34551d){while(--_0x34551d){_0x458c4c['push'](_0x458c4c['shift']());}};_0x4fa73d(++_0xb3540);}(_0xf0c8,0x111));var _0x8f0c=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0xf0c8[_0x459335];return _0x50f00b;};'use strict';var _=require(_0x8f0c('0x0'));var util=require(_0x8f0c('0x1'));var moment=require(_0x8f0c('0x2'));var BPromise=require(_0x8f0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f0c('0x4'));var db=require(_0x8f0c('0x5'))['db'];var utils=require(_0x8f0c('0x6'));var logger=require(_0x8f0c('0x7'))(_0x8f0c('0x8'));var config=require(_0x8f0c('0x9'));var jayson=require(_0x8f0c('0xa'));var client=jayson[_0x8f0c('0xb')][_0x8f0c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23eba5,_0x372a6a,_0x311a16){return new BPromise(function(_0xae0206,_0x3f4d21){return client['request'](_0x23eba5,_0x311a16)[_0x8f0c('0xd')](function(_0x45b2e7){logger['info'](_0x8f0c('0xe'),_0x372a6a,_0x8f0c('0xf'));logger[_0x8f0c('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x372a6a,'request\x20sent',JSON[_0x8f0c('0x11')](_0x45b2e7));if(_0x45b2e7[_0x8f0c('0x12')]){if(_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x13')]===0x1f4){logger[_0x8f0c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x372a6a,_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);return _0x3f4d21(_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);}logger[_0x8f0c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x372a6a,_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);return _0xae0206(_0x45b2e7['error'][_0x8f0c('0x14')]);}else{logger[_0x8f0c('0x15')](_0x8f0c('0xe'),_0x372a6a,_0x8f0c('0xf'));_0xae0206(_0x45b2e7[_0x8f0c('0x16')]['message']);}})['catch'](function(_0x35404f){logger[_0x8f0c('0x12')](_0x8f0c('0xe'),_0x372a6a,_0x35404f);_0x3f4d21(_0x35404f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index dc4df35..2e39e0c 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 _0x48fb=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x40514c,_0x387dc3){var _0x48f285=function(_0x8145ee){while(--_0x8145ee){_0x40514c['push'](_0x40514c['shift']());}};_0x48f285(++_0x387dc3);}(_0x48fb,0x114));var _0xb48f=function(_0x5795cf,_0x85114d){_0x5795cf=_0x5795cf-0x0;var _0x482106=_0x48fb[_0x5795cf];return _0x482106;};'use strict';var multer=require(_0xb48f('0x0'));var util=require(_0xb48f('0x1'));var path=require(_0xb48f('0x2'));var timeout=require(_0xb48f('0x3'));var express=require(_0xb48f('0x4'));var router=express[_0xb48f('0x5')]();var fs_extra=require(_0xb48f('0x6'));var auth=require(_0xb48f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb48f('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xb48f('0x9')]('/',auth[_0xb48f('0xa')](),controller[_0xb48f('0xb')]);router[_0xb48f('0x9')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0xd')]);router[_0xb48f('0x9')](_0xb48f('0xe'),auth[_0xb48f('0xa')](),controller[_0xb48f('0xf')]);router[_0xb48f('0x9')](_0xb48f('0x10'),auth['isAuthenticated'](),controller[_0xb48f('0x11')]);router['post']('/',auth[_0xb48f('0xa')](),controller[_0xb48f('0x12')]);router[_0xb48f('0x13')](_0xb48f('0xe'),auth[_0xb48f('0xa')](),controller['addConfiguration']);router[_0xb48f('0x14')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0x15')]);router[_0xb48f('0x16')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x481a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x481a,0xbb));var _0xa481=function(_0xe0342,_0x7114a9){_0xe0342=_0xe0342-0x0;var _0xed9810=_0x481a[_0xe0342];return _0xed9810;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require(_0xa481('0x2'));var timeout=require(_0xa481('0x3'));var express=require(_0xa481('0x4'));var router=express['Router']();var fs_extra=require(_0xa481('0x5'));var auth=require(_0xa481('0x6'));var interaction=require(_0xa481('0x7'));var config=require(_0xa481('0x8'));var controller=require(_0xa481('0x9'));router[_0xa481('0xa')]('/',auth['isAuthenticated'](),controller[_0xa481('0xb')]);router[_0xa481('0xa')](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0xe')]);router[_0xa481('0xa')](_0xa481('0xf'),auth[_0xa481('0xd')](),controller['getConfigurations']);router[_0xa481('0xa')](_0xa481('0x10'),auth[_0xa481('0xd')](),controller['getFields']);router[_0xa481('0x11')]('/',auth[_0xa481('0xd')](),controller[_0xa481('0x12')]);router[_0xa481('0x11')](_0xa481('0xf'),auth[_0xa481('0xd')](),controller[_0xa481('0x13')]);router[_0xa481('0x14')](_0xa481('0xc'),auth['isAuthenticated'](),controller[_0xa481('0x15')]);router['delete'](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0x16')]);module[_0xa481('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1933e61..c87ab99 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 _0x9013=['sequelize','exports','STRING'];(function(_0x455913,_0x2b7a92){var _0x3025b8=function(_0x3d754d){while(--_0x3d754d){_0x455913['push'](_0x455913['shift']());}};_0x3025b8(++_0x2b7a92);}(_0x9013,0x1a4));var _0x3901=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9013[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3901('0x0'));module[_0x3901('0x1')]={'name':{'type':Sequelize[_0x3901('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3901('0x2')]},'username':{'type':Sequelize[_0x3901('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3901('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3901('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3901('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x77a1=['HelpDesk','exports','STRING'];(function(_0x5060e4,_0x3c3efa){var _0x2bab36=function(_0x48c823){while(--_0x48c823){_0x5060e4['push'](_0x5060e4['shift']());}};_0x2bab36(++_0x3c3efa);}(_0x77a1,0x15d));var _0x177a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x77a1[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x177a('0x0')]={'name':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x177a('0x1')],'allowNull':![],'defaultValue':_0x177a('0x2')},'remoteUri':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 858744e..d2aa0d0 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 _0xb082=['limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','include','merge','find','create','body','update','getConfigurations','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','findOne','moduleName','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','autogenerated','owner','remove','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count'];(function(_0xa201ee,_0x37da32){var _0x3e104d=function(_0x4cd637){while(--_0x4cd637){_0xa201ee['push'](_0xa201ee['shift']());}};_0x3e104d(++_0x37da32);}(_0xb082,0x1be));var _0x2b08=function(_0x177d7b,_0xf677e0){_0x177d7b=_0x177d7b-0x0;var _0x19341c=_0xb082[_0x177d7b];return _0x19341c;};'use strict';var emlformat=require(_0x2b08('0x0'));var rimraf=require(_0x2b08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b08('0x2'));var rp=require(_0x2b08('0x3'));var moment=require(_0x2b08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b08('0x5'));var util=require(_0x2b08('0x6'));var path=require('path');var sox=require(_0x2b08('0x7'));var csv=require(_0x2b08('0x8'));var ejs=require(_0x2b08('0x9'));var fs=require('fs');var fs_extra=require(_0x2b08('0xa'));var _=require(_0x2b08('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b08('0xc'));var toCsv=require(_0x2b08('0x8'));var querystring=require(_0x2b08('0xd'));var Papa=require(_0x2b08('0xe'));var Redis=require(_0x2b08('0xf'));var authService=require(_0x2b08('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b08('0x11'));var logger=require(_0x2b08('0x12'))(_0x2b08('0x13'));var utils=require(_0x2b08('0x14'));var config=require(_0x2b08('0x15'));var licenseUtil=require(_0x2b08('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x89bd0f,_0x577616){_0x577616=_0x577616||0xcc;return function(_0x31d503){if(_0x31d503){return _0x89bd0f[_0x2b08('0x17')](_0x577616);}return _0x89bd0f[_0x2b08('0x18')](_0x577616)[_0x2b08('0x19')]();};}function respondWithResult(_0x192ed2,_0x3a64db){_0x3a64db=_0x3a64db||0xc8;return function(_0x2b0e1a){if(_0x2b0e1a){return _0x192ed2[_0x2b08('0x18')](_0x3a64db)[_0x2b08('0x1a')](_0x2b0e1a);}};}function respondWithFilteredResult(_0x17eda5,_0x232ec2){return function(_0x35044b){if(_0x35044b){var _0x4bad36=typeof _0x232ec2[_0x2b08('0x1b')]==='undefined'&&typeof _0x232ec2['limit']===_0x2b08('0x1c');var _0x1821f7=_0x35044b[_0x2b08('0x1d')];var _0x47e8e=_0x4bad36?0x0:_0x232ec2[_0x2b08('0x1b')];var _0xe856f3=_0x4bad36?_0x35044b['count']:_0x232ec2['offset']+_0x232ec2[_0x2b08('0x1e')];var _0x1919c8;if(_0xe856f3>=_0x1821f7){_0xe856f3=_0x1821f7;_0x1919c8=0xc8;}else{_0x1919c8=0xce;}_0x17eda5[_0x2b08('0x18')](_0x1919c8);return _0x17eda5[_0x2b08('0x1f')](_0x2b08('0x20'),_0x47e8e+'-'+_0xe856f3+'/'+_0x1821f7)['json'](_0x35044b);}return null;};}function patchUpdates(_0x4713b9){return function(_0x45569e){try{jsonpatch[_0x2b08('0x21')](_0x45569e,_0x4713b9,!![]);}catch(_0x599f96){return BPromise['reject'](_0x599f96);}return _0x45569e[_0x2b08('0x22')]();};}function saveUpdates(_0x3e2128,_0x15ea1d){return function(_0x47eacb){if(_0x47eacb){return _0x47eacb['update'](_0x3e2128)[_0x2b08('0x23')](function(_0x3d352b){return _0x3d352b;});}return null;};}function removeEntity(_0x2db1a4,_0x2c8f26){return function(_0x133c46){if(_0x133c46){return _0x133c46[_0x2b08('0x24')]()[_0x2b08('0x23')](function(){_0x2db1a4[_0x2b08('0x18')](0xcc)[_0x2b08('0x19')]();});}};}function handleEntityNotFound(_0xb6602f,_0x1709ff){return function(_0x5cc709){if(!_0x5cc709){_0xb6602f[_0x2b08('0x17')](0x194);}return _0x5cc709;};}function handleError(_0x4b1418,_0x4cc4b6){_0x4cc4b6=_0x4cc4b6||0x1f4;return function(_0x110925){logger[_0x2b08('0x25')](_0x110925[_0x2b08('0x26')]);if(_0x110925[_0x2b08('0x27')]){delete _0x110925[_0x2b08('0x27')];}_0x4b1418[_0x2b08('0x18')](_0x4cc4b6)[_0x2b08('0x28')](_0x110925);};}exports[_0x2b08('0x29')]=function(_0xd27251,_0x5e426d){var _0x3539b7={},_0x134e0d={},_0x5d6893={'count':0x0,'rows':[]};var _0x4c6cea=_[_0x2b08('0x2a')](db[_0x2b08('0x2b')][_0x2b08('0x2c')],function(_0x394d66){return{'name':_0x394d66['fieldName'],'type':_0x394d66[_0x2b08('0x2d')][_0x2b08('0x2e')]};});_0x134e0d[_0x2b08('0x2f')]=_[_0x2b08('0x2a')](_0x4c6cea,_0x2b08('0x27'));_0x134e0d[_0x2b08('0x30')]=_[_0x2b08('0x31')](_0xd27251[_0x2b08('0x30')]);_0x134e0d[_0x2b08('0x32')]=_[_0x2b08('0x33')](_0x134e0d['model'],_0x134e0d[_0x2b08('0x30')]);_0x3539b7[_0x2b08('0x34')]=_['intersection'](_0x134e0d[_0x2b08('0x2f')],qs['fields'](_0xd27251['query'][_0x2b08('0x35')]));_0x3539b7[_0x2b08('0x34')]=_0x3539b7['attributes']['length']?_0x3539b7['attributes']:_0x134e0d[_0x2b08('0x2f')];if(!_0xd27251['query'][_0x2b08('0x36')]('nolimit')){_0x3539b7[_0x2b08('0x1e')]=qs['limit'](_0xd27251[_0x2b08('0x30')]['limit']);_0x3539b7[_0x2b08('0x1b')]=qs['offset'](_0xd27251['query']['offset']);}_0x3539b7[_0x2b08('0x37')]=qs[_0x2b08('0x38')](_0xd27251[_0x2b08('0x30')]['sort']);_0x3539b7[_0x2b08('0x39')]=qs[_0x2b08('0x32')](_[_0x2b08('0x3a')](_0xd27251[_0x2b08('0x30')],_0x134e0d[_0x2b08('0x32')]),_0x4c6cea);if(_0xd27251[_0x2b08('0x30')]['filter']){_0x3539b7[_0x2b08('0x39')]=_['merge'](_0x3539b7[_0x2b08('0x39')],{'$or':_[_0x2b08('0x2a')](_0x4c6cea,function(_0xdf9eb7){if(_0xdf9eb7[_0x2b08('0x2d')]!==_0x2b08('0x3b')){var _0x5f2c92={};_0x5f2c92[_0xdf9eb7['name']]={'$like':'%'+_0xd27251[_0x2b08('0x30')][_0x2b08('0x3c')]+'%'};return _0x5f2c92;}})});}_0x3539b7=_['merge']({},_0x3539b7,_0xd27251[_0x2b08('0x3d')]);var _0x3b1ea1={'where':_0x3539b7[_0x2b08('0x39')]};return db[_0x2b08('0x2b')][_0x2b08('0x1d')](_0x3b1ea1)['then'](function(_0x68b977){_0x5d6893['count']=_0x68b977;if(_0xd27251[_0x2b08('0x30')]['includeAll']){_0x3539b7['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x2b08('0x3e')](_0x3539b7);})['then'](function(_0x196aad){_0x5d6893[_0x2b08('0x3f')]=_0x196aad;return _0x5d6893;})[_0x2b08('0x23')](respondWithFilteredResult(_0x5e426d,_0x3539b7))[_0x2b08('0x40')](handleError(_0x5e426d,null));};exports[_0x2b08('0x41')]=function(_0x247152,_0x11d4a3){var _0x2fdf5d={'raw':![],'where':{'id':_0x247152[_0x2b08('0x42')]['id']}},_0x41880a={};_0x41880a[_0x2b08('0x2f')]=_[_0x2b08('0x31')](db['VtigerAccount'][_0x2b08('0x2c')]);_0x41880a[_0x2b08('0x30')]=_[_0x2b08('0x31')](_0x247152['query']);_0x41880a[_0x2b08('0x32')]=_['intersection'](_0x41880a[_0x2b08('0x2f')],_0x41880a[_0x2b08('0x30')]);_0x2fdf5d[_0x2b08('0x34')]=_[_0x2b08('0x33')](_0x41880a[_0x2b08('0x2f')],qs[_0x2b08('0x35')](_0x247152[_0x2b08('0x30')][_0x2b08('0x35')]));_0x2fdf5d[_0x2b08('0x34')]=_0x2fdf5d[_0x2b08('0x34')][_0x2b08('0x43')]?_0x2fdf5d['attributes']:_0x41880a[_0x2b08('0x2f')];if(_0x247152[_0x2b08('0x30')][_0x2b08('0x44')]){_0x2fdf5d[_0x2b08('0x45')]=[{'all':!![]}];}_0x2fdf5d=_[_0x2b08('0x46')]({},_0x2fdf5d,_0x247152[_0x2b08('0x3d')]);return db['VtigerAccount'][_0x2b08('0x47')](_0x2fdf5d)[_0x2b08('0x23')](handleEntityNotFound(_0x11d4a3,null))[_0x2b08('0x23')](respondWithResult(_0x11d4a3,null))[_0x2b08('0x40')](handleError(_0x11d4a3,null));};exports['create']=function(_0xafa1cf,_0x4e3cce){return db[_0x2b08('0x2b')][_0x2b08('0x48')](_0xafa1cf[_0x2b08('0x49')],{})['then'](respondWithResult(_0x4e3cce,0xc9))[_0x2b08('0x40')](handleError(_0x4e3cce,null));};exports[_0x2b08('0x4a')]=function(_0x51fbf6,_0x4275d8){if(_0x51fbf6['body']['id']){delete _0x51fbf6[_0x2b08('0x49')]['id'];}return db['VtigerAccount'][_0x2b08('0x47')]({'where':{'id':_0x51fbf6[_0x2b08('0x42')]['id']}})[_0x2b08('0x23')](handleEntityNotFound(_0x4275d8,null))[_0x2b08('0x23')](saveUpdates(_0x51fbf6[_0x2b08('0x49')],null))[_0x2b08('0x23')](respondWithResult(_0x4275d8,null))[_0x2b08('0x40')](handleError(_0x4275d8,null));};exports[_0x2b08('0x24')]=function(_0x2f6844,_0xeee8d8){return db['VtigerAccount'][_0x2b08('0x47')]({'where':{'id':_0x2f6844[_0x2b08('0x42')]['id']}})['then'](handleEntityNotFound(_0xeee8d8,null))[_0x2b08('0x23')](removeEntity(_0xeee8d8,null))['catch'](handleError(_0xeee8d8,null));};exports[_0x2b08('0x4b')]=function(_0x290fa7,_0x29c097,_0x222fba){var _0x17837f={};var _0x3b9484={};var _0x8abe68;var _0x33293e;return db['VtigerAccount']['findOne']({'where':{'id':_0x290fa7[_0x2b08('0x42')]['id']}})[_0x2b08('0x23')](handleEntityNotFound(_0x29c097,null))[_0x2b08('0x23')](function(_0x1c934e){if(_0x1c934e){_0x8abe68=_0x1c934e;_0x3b9484[_0x2b08('0x2f')]=_[_0x2b08('0x31')](db[_0x2b08('0x4c')][_0x2b08('0x2c')]);_0x3b9484[_0x2b08('0x30')]=_[_0x2b08('0x31')](_0x290fa7['query']);_0x3b9484[_0x2b08('0x32')]=_[_0x2b08('0x33')](_0x3b9484['model'],_0x3b9484[_0x2b08('0x30')]);_0x17837f[_0x2b08('0x34')]=_[_0x2b08('0x33')](_0x3b9484[_0x2b08('0x2f')],qs[_0x2b08('0x35')](_0x290fa7[_0x2b08('0x30')][_0x2b08('0x35')]));_0x17837f[_0x2b08('0x34')]=_0x17837f[_0x2b08('0x34')][_0x2b08('0x43')]?_0x17837f[_0x2b08('0x34')]:_0x3b9484[_0x2b08('0x2f')];_0x17837f[_0x2b08('0x37')]=qs[_0x2b08('0x38')](_0x290fa7[_0x2b08('0x30')][_0x2b08('0x38')]);_0x17837f[_0x2b08('0x39')]=qs[_0x2b08('0x32')](_['pick'](_0x290fa7[_0x2b08('0x30')],_0x3b9484[_0x2b08('0x32')]));if(_0x290fa7[_0x2b08('0x30')][_0x2b08('0x3c')]){_0x17837f['where']=_[_0x2b08('0x46')](_0x17837f[_0x2b08('0x39')],{'$or':_[_0x2b08('0x2a')](_0x17837f[_0x2b08('0x34')],function(_0x2e8a9c){var _0xd597e0={};_0xd597e0[_0x2e8a9c]={'$like':'%'+_0x290fa7[_0x2b08('0x30')][_0x2b08('0x3c')]+'%'};return _0xd597e0;})});}_0x17837f=_['merge']({},_0x17837f,_0x290fa7[_0x2b08('0x3d')]);return _0x8abe68[_0x2b08('0x4b')](_0x17837f);}})['then'](function(_0x322645){if(_0x322645){_0x33293e=_0x322645[_0x2b08('0x43')];if(!_0x290fa7[_0x2b08('0x30')][_0x2b08('0x36')](_0x2b08('0x4d'))){_0x17837f[_0x2b08('0x1e')]=qs[_0x2b08('0x1e')](_0x290fa7['query']['limit']);_0x17837f[_0x2b08('0x1b')]=qs[_0x2b08('0x1b')](_0x290fa7[_0x2b08('0x30')][_0x2b08('0x1b')]);}return _0x8abe68[_0x2b08('0x4b')](_0x17837f);}})[_0x2b08('0x23')](function(_0x31bfe1){if(_0x31bfe1){return _0x31bfe1?{'count':_0x33293e,'rows':_0x31bfe1}:null;}})['then'](respondWithResult(_0x29c097,null))[_0x2b08('0x40')](handleError(_0x29c097,null));};exports[_0x2b08('0x4e')]=function(_0x5c20bc,_0x59f6d3,_0x2eb7e2){if(_0x5c20bc[_0x2b08('0x49')]['id']){delete _0x5c20bc[_0x2b08('0x49')]['id'];}return db[_0x2b08('0x2b')]['findOne']({'where':{'id':_0x5c20bc[_0x2b08('0x42')]['id']}})[_0x2b08('0x23')](handleEntityNotFound(_0x59f6d3,null))[_0x2b08('0x23')](function(_0x3f184c){if(_0x3f184c){_0x5c20bc['body'][_0x2b08('0x4f')]=_0x3f184c['id'];_0x5c20bc['body'][_0x2b08('0x50')]=integrations[_0x2b08('0x51')](_0x5c20bc[_0x2b08('0x49')]['channel'],_0x5c20bc['body']['type']);_0x5c20bc[_0x2b08('0x49')][_0x2b08('0x52')]=integrations[_0x2b08('0x53')](_0x5c20bc[_0x2b08('0x49')]['channel'],_0x5c20bc[_0x2b08('0x49')][_0x2b08('0x2d')]);return db['VtigerConfiguration'][_0x2b08('0x48')](_0x5c20bc[_0x2b08('0x49')],{'include':[{'model':db[_0x2b08('0x54')],'as':_0x2b08('0x50')},{'model':db[_0x2b08('0x54')],'as':_0x2b08('0x52')}]});}return null;})[_0x2b08('0x23')](respondWithResult(_0x59f6d3,null))['catch'](handleError(_0x59f6d3,null));};var md5=require('md5');exports[_0x2b08('0x55')]=function(_0x2c65db,_0xa3556,_0x3e145f){var _0x233616=null;var _0x1971e1=null;var _0x5bd7bf=null;var _0xe67c33=null;var _0x852f5c='';return db[_0x2b08('0x2b')][_0x2b08('0x56')]({'where':{'id':_0x2c65db['params']['id']},'attributes':['id','name','username','description',_0x2b08('0x57'),'remoteUri',_0x2b08('0x58'),_0x2b08('0x59')]})[_0x2b08('0x23')](handleEntityNotFound(_0xa3556,null))['then'](function(_0x5b6e1a){if(_0x5b6e1a){_0x233616=_0x5b6e1a[_0x2b08('0x5a')];_0x1971e1=_0x5b6e1a['accessKey'];_0x5bd7bf=_0x5b6e1a[_0x2b08('0x57')];_0x852f5c=_0x5b6e1a['remoteUri'];var _0x292b33=_0x852f5c[_0x2b08('0x5b')](-0x1);if(_0x292b33==='/'){_0x852f5c=_0x852f5c[_0x2b08('0x5c')](0x0,_0x852f5c[_0x2b08('0x5d')](_0x292b33));}_0xe67c33=util[_0x2b08('0x5e')](_0x2b08('0x5f'),_0x852f5c);var _0x40e631={'method':_0x2b08('0x60'),'uri':_0xe67c33,'qs':{'operation':_0x2b08('0x61'),'username':_0x5b6e1a[_0x2b08('0x5a')]},'json':!![]};return rp(_0x40e631);}})[_0x2b08('0x23')](function(_0x3fbbfc){if(_0x3fbbfc[_0x2b08('0x62')]){var _0x49cd9a={'method':_0x2b08('0x63'),'uri':_0xe67c33,'form':{'operation':'login','username':_0x233616,'accessKey':md5(_0x3fbbfc[_0x2b08('0x64')][_0x2b08('0x65')]+_0x1971e1)},'json':!![]};return rp(_0x49cd9a);}})[_0x2b08('0x23')](function(_0x4d6b1e){if(_0x4d6b1e[_0x2b08('0x62')]){var _0x44360e={'method':_0x2b08('0x60'),'uri':_0xe67c33,'qs':{'operation':_0x2b08('0x66'),'username':_0x233616,'sessionName':_0x4d6b1e[_0x2b08('0x64')]['sessionName'],'elementType':_0x5bd7bf},'json':!![]};return rp(_0x44360e);}})['then'](function(_0x44c0c2){if(_0x44c0c2[_0x2b08('0x62')]){var _0x2793c5=[_0x2b08('0x67'),'reference',_0x2b08('0x68')];_[_0x2b08('0x69')](_0x44c0c2['result'][_0x2b08('0x35')],function(_0x1a46df){return _0x2793c5['includes'](_0x1a46df[_0x2b08('0x2d')]['name']);});_[_0x2b08('0x69')](_0x44c0c2['result'][_0x2b08('0x35')],function(_0x232225){return _0x232225[_0x2b08('0x6a')]===_0x2b08('0x6b');});return{'count':_0x44c0c2[_0x2b08('0x64')]['fields'][_0x2b08('0x43')],'rows':_[_0x2b08('0x2a')](_0x44c0c2['result'][_0x2b08('0x35')],function(_0x556f06){return{'id':_0x556f06[_0x2b08('0x27')],'name':_0x556f06[_0x2b08('0x6c')],'custom':_['startsWith'](_0x556f06[_0x2b08('0x27')],_0x2b08('0x6d'))?!![]:![],'options':_0x556f06[_0x2b08('0x2d')]['name']===_0x2b08('0x6e')&&_0x556f06[_0x2b08('0x2d')][_0x2b08('0x6f')]['length']>0x0?_[_0x2b08('0x2a')](_0x556f06['type']['picklistValues'],function(_0x1c2143){return{'name':_0x1c2143[_0x2b08('0x6c')],'value':_0x1c2143[_0x2b08('0x70')]};}):[]};})};}})[_0x2b08('0x23')](respondWithResult(_0xa3556,null))[_0x2b08('0x40')](function(_0x168f7b){console[_0x2b08('0x71')](_0x2b08('0x72')+_0x168f7b);var _0x5d67cf=_0x2c65db[_0x2b08('0x30')][_0x2b08('0x73')]?0x1f4:_0x168f7b[_0x2b08('0x74')]||0x1f4;logger[_0x2b08('0x25')](_0x2b08('0x75'),_0x2b08('0x55'),_0x5d67cf,JSON['stringify'](_0x168f7b));delete _0x168f7b[_0x2b08('0x27')];if(_0x5d67cf===0x191){_0x5d67cf=0x190;}_0xa3556[_0x2b08('0x18')](_0x5d67cf)[_0x2b08('0x28')](_0x2c65db[_0x2b08('0x30')][_0x2b08('0x73')]?{'message':_0x2b08('0x76'),'statusCode':_0x168f7b[_0x2b08('0x74')]}:_0x168f7b);});}; \ No newline at end of file +var _0x202b=['username','description','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','VtigerConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields'];(function(_0x340b70,_0xdcf02){var _0x17879b=function(_0x2049aa){while(--_0x2049aa){_0x340b70['push'](_0x340b70['shift']());}};_0x17879b(++_0xdcf02);}(_0x202b,0x118));var _0xb202=function(_0x3f4ba8,_0x5ab00c){_0x3f4ba8=_0x3f4ba8-0x0;var _0x1243de=_0x202b[_0x3f4ba8];return _0x1243de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb202('0x0'));var zipdir=require(_0xb202('0x1'));var jsonpatch=require(_0xb202('0x2'));var rp=require('request-promise');var moment=require(_0xb202('0x3'));var BPromise=require(_0xb202('0x4'));var Mustache=require(_0xb202('0x5'));var util=require(_0xb202('0x6'));var path=require('path');var sox=require(_0xb202('0x7'));var csv=require('to-csv');var ejs=require(_0xb202('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb202('0x9'));var squel=require(_0xb202('0xa'));var crypto=require(_0xb202('0xb'));var jsforce=require(_0xb202('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb202('0xd'));var Papa=require(_0xb202('0xe'));var Redis=require(_0xb202('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb202('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb202('0x11'))(_0xb202('0x12'));var utils=require(_0xb202('0x13'));var config=require(_0xb202('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb202('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ec8e4,_0x31df76){_0x31df76=_0x31df76||0xcc;return function(_0x57af11){if(_0x57af11){return _0x2ec8e4[_0xb202('0x16')](_0x31df76);}return _0x2ec8e4[_0xb202('0x17')](_0x31df76)[_0xb202('0x18')]();};}function respondWithResult(_0x46dbbb,_0xabd2c1){_0xabd2c1=_0xabd2c1||0xc8;return function(_0x3e42d2){if(_0x3e42d2){return _0x46dbbb['status'](_0xabd2c1)[_0xb202('0x19')](_0x3e42d2);}};}function respondWithFilteredResult(_0x5d3c8d,_0x2cf50c){return function(_0x1515b7){if(_0x1515b7){var _0x500b6c=typeof _0x2cf50c[_0xb202('0x1a')]===_0xb202('0x1b')&&typeof _0x2cf50c['limit']===_0xb202('0x1b');var _0x5e3490=_0x1515b7[_0xb202('0x1c')];var _0x1d2af=_0x500b6c?0x0:_0x2cf50c['offset'];var _0x2a70f7=_0x500b6c?_0x1515b7[_0xb202('0x1c')]:_0x2cf50c[_0xb202('0x1a')]+_0x2cf50c['limit'];var _0x3d9fcd;if(_0x2a70f7>=_0x5e3490){_0x2a70f7=_0x5e3490;_0x3d9fcd=0xc8;}else{_0x3d9fcd=0xce;}_0x5d3c8d[_0xb202('0x17')](_0x3d9fcd);return _0x5d3c8d[_0xb202('0x1d')](_0xb202('0x1e'),_0x1d2af+'-'+_0x2a70f7+'/'+_0x5e3490)[_0xb202('0x19')](_0x1515b7);}return null;};}function patchUpdates(_0x28d527){return function(_0x15486e){try{jsonpatch[_0xb202('0x1f')](_0x15486e,_0x28d527,!![]);}catch(_0x3ee9e9){return BPromise[_0xb202('0x20')](_0x3ee9e9);}return _0x15486e[_0xb202('0x21')]();};}function saveUpdates(_0x12a6d5,_0x24eebd){return function(_0x463935){if(_0x463935){return _0x463935[_0xb202('0x22')](_0x12a6d5)[_0xb202('0x23')](function(_0x340296){return _0x340296;});}return null;};}function removeEntity(_0x564fcd,_0x3851b6){return function(_0x3e9234){if(_0x3e9234){return _0x3e9234[_0xb202('0x24')]()[_0xb202('0x23')](function(){_0x564fcd[_0xb202('0x17')](0xcc)[_0xb202('0x18')]();});}};}function handleEntityNotFound(_0x969703,_0x4415ed){return function(_0x4607b5){if(!_0x4607b5){_0x969703[_0xb202('0x16')](0x194);}return _0x4607b5;};}function handleError(_0xbf3b3e,_0x11660e){_0x11660e=_0x11660e||0x1f4;return function(_0x2e04ce){logger[_0xb202('0x25')](_0x2e04ce[_0xb202('0x26')]);if(_0x2e04ce['name']){delete _0x2e04ce['name'];}_0xbf3b3e[_0xb202('0x17')](_0x11660e)[_0xb202('0x27')](_0x2e04ce);};}exports[_0xb202('0x28')]=function(_0x657ce1,_0xbab2e2){var _0x32f671={},_0x343fa2={},_0x2f3610={'count':0x0,'rows':[]};var _0x2d216d=_[_0xb202('0x29')](db[_0xb202('0x2a')][_0xb202('0x2b')],function(_0x1beb67){return{'name':_0x1beb67[_0xb202('0x2c')],'type':_0x1beb67[_0xb202('0x2d')][_0xb202('0x2e')]};});_0x343fa2[_0xb202('0x2f')]=_[_0xb202('0x29')](_0x2d216d,_0xb202('0x30'));_0x343fa2[_0xb202('0x31')]=_[_0xb202('0x32')](_0x657ce1['query']);_0x343fa2[_0xb202('0x33')]=_['intersection'](_0x343fa2[_0xb202('0x2f')],_0x343fa2[_0xb202('0x31')]);_0x32f671[_0xb202('0x34')]=_[_0xb202('0x35')](_0x343fa2['model'],qs[_0xb202('0x36')](_0x657ce1['query'][_0xb202('0x36')]));_0x32f671[_0xb202('0x34')]=_0x32f671[_0xb202('0x34')][_0xb202('0x37')]?_0x32f671['attributes']:_0x343fa2['model'];if(!_0x657ce1['query']['hasOwnProperty'](_0xb202('0x38'))){_0x32f671[_0xb202('0x39')]=qs['limit'](_0x657ce1['query']['limit']);_0x32f671[_0xb202('0x1a')]=qs[_0xb202('0x1a')](_0x657ce1[_0xb202('0x31')][_0xb202('0x1a')]);}_0x32f671['order']=qs[_0xb202('0x3a')](_0x657ce1[_0xb202('0x31')][_0xb202('0x3a')]);_0x32f671[_0xb202('0x3b')]=qs[_0xb202('0x33')](_[_0xb202('0x3c')](_0x657ce1[_0xb202('0x31')],_0x343fa2[_0xb202('0x33')]),_0x2d216d);if(_0x657ce1['query'][_0xb202('0x3d')]){_0x32f671[_0xb202('0x3b')]=_[_0xb202('0x3e')](_0x32f671[_0xb202('0x3b')],{'$or':_[_0xb202('0x29')](_0x2d216d,function(_0x4b48cd){if(_0x4b48cd[_0xb202('0x2d')]!=='VIRTUAL'){var _0x5cb676={};_0x5cb676[_0x4b48cd[_0xb202('0x30')]]={'$like':'%'+_0x657ce1[_0xb202('0x31')][_0xb202('0x3d')]+'%'};return _0x5cb676;}})});}_0x32f671=_[_0xb202('0x3e')]({},_0x32f671,_0x657ce1[_0xb202('0x3f')]);var _0x5f16e5={'where':_0x32f671[_0xb202('0x3b')]};return db[_0xb202('0x2a')][_0xb202('0x1c')](_0x5f16e5)['then'](function(_0x3d29f6){_0x2f3610['count']=_0x3d29f6;if(_0x657ce1['query'][_0xb202('0x40')]){_0x32f671['include']=[{'all':!![]}];}return db[_0xb202('0x2a')][_0xb202('0x41')](_0x32f671);})[_0xb202('0x23')](function(_0x198fb9){_0x2f3610[_0xb202('0x42')]=_0x198fb9;return _0x2f3610;})[_0xb202('0x23')](respondWithFilteredResult(_0xbab2e2,_0x32f671))['catch'](handleError(_0xbab2e2,null));};exports['show']=function(_0x120934,_0x4eb469){var _0x459c02={'raw':![],'where':{'id':_0x120934[_0xb202('0x43')]['id']}},_0x3e3601={};_0x3e3601['model']=_[_0xb202('0x32')](db['VtigerAccount'][_0xb202('0x2b')]);_0x3e3601[_0xb202('0x31')]=_['keys'](_0x120934[_0xb202('0x31')]);_0x3e3601[_0xb202('0x33')]=_['intersection'](_0x3e3601[_0xb202('0x2f')],_0x3e3601[_0xb202('0x31')]);_0x459c02['attributes']=_[_0xb202('0x35')](_0x3e3601[_0xb202('0x2f')],qs[_0xb202('0x36')](_0x120934[_0xb202('0x31')][_0xb202('0x36')]));_0x459c02[_0xb202('0x34')]=_0x459c02[_0xb202('0x34')][_0xb202('0x37')]?_0x459c02[_0xb202('0x34')]:_0x3e3601[_0xb202('0x2f')];if(_0x120934['query'][_0xb202('0x40')]){_0x459c02[_0xb202('0x44')]=[{'all':!![]}];}_0x459c02=_[_0xb202('0x3e')]({},_0x459c02,_0x120934[_0xb202('0x3f')]);return db[_0xb202('0x2a')][_0xb202('0x45')](_0x459c02)[_0xb202('0x23')](handleEntityNotFound(_0x4eb469,null))[_0xb202('0x23')](respondWithResult(_0x4eb469,null))[_0xb202('0x46')](handleError(_0x4eb469,null));};exports[_0xb202('0x47')]=function(_0x449f6b,_0x5d4269){return db[_0xb202('0x2a')][_0xb202('0x47')](_0x449f6b[_0xb202('0x48')],{})[_0xb202('0x23')](respondWithResult(_0x5d4269,0xc9))[_0xb202('0x46')](handleError(_0x5d4269,null));};exports[_0xb202('0x22')]=function(_0x55a8a6,_0x1ed002){if(_0x55a8a6[_0xb202('0x48')]['id']){delete _0x55a8a6[_0xb202('0x48')]['id'];}return db['VtigerAccount'][_0xb202('0x45')]({'where':{'id':_0x55a8a6[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x1ed002,null))[_0xb202('0x23')](saveUpdates(_0x55a8a6['body'],null))['then'](respondWithResult(_0x1ed002,null))['catch'](handleError(_0x1ed002,null));};exports[_0xb202('0x24')]=function(_0x24245c,_0x45477c){return db[_0xb202('0x2a')][_0xb202('0x45')]({'where':{'id':_0x24245c[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x45477c,null))[_0xb202('0x23')](removeEntity(_0x45477c,null))[_0xb202('0x46')](handleError(_0x45477c,null));};exports['getConfigurations']=function(_0x46fc3d,_0x4e999a,_0x5d947e){var _0x3b5242={};var _0x4934ea={};var _0x1ea5ea;var _0x4df5da;return db[_0xb202('0x2a')]['findOne']({'where':{'id':_0x46fc3d[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x4e999a,null))[_0xb202('0x23')](function(_0x5edf8){if(_0x5edf8){_0x1ea5ea=_0x5edf8;_0x4934ea[_0xb202('0x2f')]=_[_0xb202('0x32')](db[_0xb202('0x49')]['rawAttributes']);_0x4934ea[_0xb202('0x31')]=_[_0xb202('0x32')](_0x46fc3d[_0xb202('0x31')]);_0x4934ea[_0xb202('0x33')]=_[_0xb202('0x35')](_0x4934ea[_0xb202('0x2f')],_0x4934ea['query']);_0x3b5242['attributes']=_[_0xb202('0x35')](_0x4934ea[_0xb202('0x2f')],qs['fields'](_0x46fc3d[_0xb202('0x31')]['fields']));_0x3b5242['attributes']=_0x3b5242[_0xb202('0x34')][_0xb202('0x37')]?_0x3b5242[_0xb202('0x34')]:_0x4934ea[_0xb202('0x2f')];_0x3b5242[_0xb202('0x4a')]=qs[_0xb202('0x3a')](_0x46fc3d[_0xb202('0x31')]['sort']);_0x3b5242['where']=qs[_0xb202('0x33')](_['pick'](_0x46fc3d[_0xb202('0x31')],_0x4934ea[_0xb202('0x33')]));if(_0x46fc3d[_0xb202('0x31')]['filter']){_0x3b5242[_0xb202('0x3b')]=_['merge'](_0x3b5242['where'],{'$or':_[_0xb202('0x29')](_0x3b5242[_0xb202('0x34')],function(_0x5b2492){var _0xab9150={};_0xab9150[_0x5b2492]={'$like':'%'+_0x46fc3d[_0xb202('0x31')][_0xb202('0x3d')]+'%'};return _0xab9150;})});}_0x3b5242=_['merge']({},_0x3b5242,_0x46fc3d[_0xb202('0x3f')]);return _0x1ea5ea[_0xb202('0x4b')](_0x3b5242);}})['then'](function(_0x1899e2){if(_0x1899e2){_0x4df5da=_0x1899e2[_0xb202('0x37')];if(!_0x46fc3d[_0xb202('0x31')]['hasOwnProperty']('nolimit')){_0x3b5242[_0xb202('0x39')]=qs['limit'](_0x46fc3d[_0xb202('0x31')][_0xb202('0x39')]);_0x3b5242[_0xb202('0x1a')]=qs['offset'](_0x46fc3d[_0xb202('0x31')][_0xb202('0x1a')]);}return _0x1ea5ea['getConfigurations'](_0x3b5242);}})[_0xb202('0x23')](function(_0x371736){if(_0x371736){return _0x371736?{'count':_0x4df5da,'rows':_0x371736}:null;}})[_0xb202('0x23')](respondWithResult(_0x4e999a,null))[_0xb202('0x46')](handleError(_0x4e999a,null));};exports[_0xb202('0x4c')]=function(_0x40580b,_0x9ec5a,_0x3477ca){if(_0x40580b['body']['id']){delete _0x40580b[_0xb202('0x48')]['id'];}return db[_0xb202('0x2a')][_0xb202('0x4d')]({'where':{'id':_0x40580b['params']['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x9ec5a,null))[_0xb202('0x23')](function(_0x30fe52){if(_0x30fe52){_0x40580b['body'][_0xb202('0x4e')]=_0x30fe52['id'];_0x40580b[_0xb202('0x48')][_0xb202('0x4f')]=integrations[_0xb202('0x50')](_0x40580b[_0xb202('0x48')][_0xb202('0x51')],_0x40580b[_0xb202('0x48')][_0xb202('0x2d')]);_0x40580b['body'][_0xb202('0x52')]=integrations[_0xb202('0x53')](_0x40580b[_0xb202('0x48')][_0xb202('0x51')],_0x40580b[_0xb202('0x48')][_0xb202('0x2d')]);return db[_0xb202('0x49')][_0xb202('0x47')](_0x40580b[_0xb202('0x48')],{'include':[{'model':db[_0xb202('0x54')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0xb202('0x52')}]});}return null;})[_0xb202('0x23')](respondWithResult(_0x9ec5a,null))['catch'](handleError(_0x9ec5a,null));};var md5=require('md5');exports[_0xb202('0x55')]=function(_0x5cd9f4,_0xbb44c7,_0x789568){var _0x637e00=null;var _0x3ca6b6=null;var _0xbd94b7=null;var _0x561a1f=null;var _0x331b3f='';return db[_0xb202('0x2a')]['findOne']({'where':{'id':_0x5cd9f4[_0xb202('0x43')]['id']},'attributes':['id',_0xb202('0x30'),_0xb202('0x56'),_0xb202('0x57'),'moduleName','remoteUri',_0xb202('0x58'),_0xb202('0x59')]})[_0xb202('0x23')](handleEntityNotFound(_0xbb44c7,null))[_0xb202('0x23')](function(_0xf8cdb6){if(_0xf8cdb6){_0x637e00=_0xf8cdb6[_0xb202('0x56')];_0x3ca6b6=_0xf8cdb6[_0xb202('0x59')];_0xbd94b7=_0xf8cdb6['moduleName'];_0x331b3f=_0xf8cdb6['remoteUri'];var _0x366ddb=_0x331b3f[_0xb202('0x5a')](-0x1);if(_0x366ddb==='/'){_0x331b3f=_0x331b3f[_0xb202('0x5b')](0x0,_0x331b3f[_0xb202('0x5c')](_0x366ddb));}_0x561a1f=util[_0xb202('0x5d')](_0xb202('0x5e'),_0x331b3f);var _0xa563ed={'method':_0xb202('0x5f'),'uri':_0x561a1f,'qs':{'operation':_0xb202('0x60'),'username':_0xf8cdb6[_0xb202('0x56')]},'json':!![]};return rp(_0xa563ed);}})[_0xb202('0x23')](function(_0x2ba045){if(_0x2ba045[_0xb202('0x61')]){var _0x5822d6={'method':_0xb202('0x62'),'uri':_0x561a1f,'form':{'operation':_0xb202('0x63'),'username':_0x637e00,'accessKey':md5(_0x2ba045[_0xb202('0x64')][_0xb202('0x65')]+_0x3ca6b6)},'json':!![]};return rp(_0x5822d6);}})[_0xb202('0x23')](function(_0x5c1ffa){if(_0x5c1ffa[_0xb202('0x61')]){var _0x2bfd36={'method':_0xb202('0x5f'),'uri':_0x561a1f,'qs':{'operation':_0xb202('0x66'),'username':_0x637e00,'sessionName':_0x5c1ffa[_0xb202('0x64')][_0xb202('0x67')],'elementType':_0xbd94b7},'json':!![]};return rp(_0x2bfd36);}})[_0xb202('0x23')](function(_0x3738ac){if(_0x3738ac[_0xb202('0x61')]){var _0x245296=[_0xb202('0x68'),_0xb202('0x69'),'owner'];_[_0xb202('0x6a')](_0x3738ac[_0xb202('0x64')][_0xb202('0x36')],function(_0x4b7eae){return _0x245296[_0xb202('0x6b')](_0x4b7eae['type'][_0xb202('0x30')]);});_[_0xb202('0x6a')](_0x3738ac[_0xb202('0x64')]['fields'],function(_0xb5cfd4){return _0xb5cfd4[_0xb202('0x6c')]===_0xb202('0x6d');});return{'count':_0x3738ac[_0xb202('0x64')][_0xb202('0x36')][_0xb202('0x37')],'rows':_[_0xb202('0x29')](_0x3738ac[_0xb202('0x64')][_0xb202('0x36')],function(_0x3117d4){return{'id':_0x3117d4[_0xb202('0x30')],'name':_0x3117d4[_0xb202('0x6e')],'custom':_[_0xb202('0x6f')](_0x3117d4[_0xb202('0x30')],_0xb202('0x70'))?!![]:![],'options':_0x3117d4[_0xb202('0x2d')][_0xb202('0x30')]===_0xb202('0x71')&&_0x3117d4[_0xb202('0x2d')][_0xb202('0x72')][_0xb202('0x37')]>0x0?_[_0xb202('0x29')](_0x3117d4[_0xb202('0x2d')][_0xb202('0x72')],function(_0xb95cd2){return{'name':_0xb95cd2[_0xb202('0x6e')],'value':_0xb95cd2['value']};}):[]};})};}})[_0xb202('0x23')](respondWithResult(_0xbb44c7,null))[_0xb202('0x46')](function(_0x180613){console[_0xb202('0x73')](_0xb202('0x74')+_0x180613);var _0xc25968=_0x5cd9f4[_0xb202('0x31')][_0xb202('0x75')]?0x1f4:_0x180613['statusCode']||0x1f4;logger['error'](_0xb202('0x76'),_0xb202('0x55'),_0xc25968,JSON[_0xb202('0x77')](_0x180613));delete _0x180613[_0xb202('0x30')];if(_0xc25968===0x191){_0xc25968=0x190;}_0xbb44c7[_0xb202('0x17')](_0xc25968)['send'](_0x5cd9f4[_0xb202('0x31')][_0xb202('0x75')]?{'message':_0xb202('0x78'),'statusCode':_0x180613[_0xb202('0x79')]}:_0x180613);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 685b5d8..385c2c5 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 _0xf42a=['moment','bluebird','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','lodash','util','../../config/logger','api'];(function(_0x4cdd5f,_0x25a6a3){var _0x3bfc7b=function(_0x446b81){while(--_0x446b81){_0x4cdd5f['push'](_0x4cdd5f['shift']());}};_0x3bfc7b(++_0x25a6a3);}(_0xf42a,0x188));var _0xaf42=function(_0x4042d2,_0x387ffc){_0x4042d2=_0x4042d2-0x0;var _0x5cf06c=_0xf42a[_0x4042d2];return _0x5cf06c;};'use strict';var _=require(_0xaf42('0x0'));var util=require(_0xaf42('0x1'));var logger=require(_0xaf42('0x2'))(_0xaf42('0x3'));var moment=require(_0xaf42('0x4'));var BPromise=require(_0xaf42('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf42('0x6'));var rimraf=require(_0xaf42('0x7'));var config=require('../../config/environment');var attributes=require(_0xaf42('0x8'));var integrations=require(_0xaf42('0x9'));module[_0xaf42('0xa')]=function(_0x30b488,_0x44535e){return _0x30b488['define'](_0xaf42('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c23=['../../config/logger','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x31c04d,_0x59a5d5){var _0x3fd81b=function(_0x4c05dc){while(--_0x4c05dc){_0x31c04d['push'](_0x31c04d['shift']());}};_0x3fd81b(++_0x59a5d5);}(_0x3c23,0x13e));var _0x33c2=function(_0x22f98b,_0x57edc7){_0x22f98b=_0x22f98b-0x0;var _0x4e0b5a=_0x3c23[_0x22f98b];return _0x4e0b5a;};'use strict';var _=require(_0x33c2('0x0'));var util=require('util');var logger=require(_0x33c2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x33c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33c2('0x3'));var rimraf=require(_0x33c2('0x4'));var config=require(_0x33c2('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x33c2('0x6'));module[_0x33c2('0x7')]=function(_0x3d5ffb,_0xfd2f6c){return _0x3d5ffb[_0x33c2('0x8')](_0x33c2('0x9'),attributes,{'tableName':_0x33c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6f6faab..7b5cd31 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 _0x6f7a=['then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','VtigerAccount','options','raw','where','attributes','include','model','map','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x33ba78,_0xbcaa2d){var _0x24a8a8=function(_0x2c25f5){while(--_0x2c25f5){_0x33ba78['push'](_0x33ba78['shift']());}};_0x24a8a8(++_0xbcaa2d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2c6264,_0x509652){_0x2c6264=_0x2c6264-0x0;var _0x3796f2=_0x6f7a[_0x2c6264];return _0x3796f2;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});}exports['GetVtigerAccount']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['findAll']({'raw':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1d')]||null:null,'attributes':_0x4a8827['options']?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1e')]||null:null,'limit':_0x4a8827['options']?_0x4a8827['options']['limit']||null:null,'include':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')]['include']?_['map'](_0x4a8827['options'][_0xa6f7('0x1f')],function(_0xc77e8e){return{'model':db[_0xc77e8e[_0xa6f7('0x20')]],'as':_0xc77e8e['as'],'attributes':_0xc77e8e['attributes'],'include':_0xc77e8e['include']?_[_0xa6f7('0x21')](_0xc77e8e['include'],function(_0x47ef97){return{'model':db[_0x47ef97[_0xa6f7('0x20')]],'as':_0x47ef97['as'],'attributes':_0x47ef97['attributes'],'include':_0x47ef97[_0xa6f7('0x1f')]?_[_0xa6f7('0x21')](_0x47ef97[_0xa6f7('0x1f')],function(_0x2b4c6c){return{'model':db[_0x2b4c6c[_0xa6f7('0x20')]],'as':_0x2b4c6c['as'],'attributes':_0x2b4c6c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c419b){logger[_0xa6f7('0xf')]('GetVtigerAccount',_0x4a8827);logger[_0xa6f7('0x10')](_0xa6f7('0x22'),_0x4a8827,JSON[_0xa6f7('0x12')](_0x1c419b));_0x5298ba(_0x1c419b);})[_0xa6f7('0x19')](function(_0x224f5a){logger[_0xa6f7('0x13')](_0xa6f7('0x22'),_0x224f5a[_0xa6f7('0x16')],_0x4a8827);_0x378967(_0xba7755[_0xa6f7('0x13')](0x1f4,_0x224f5a[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x23')]=function(_0x278bad){var _0x52f9c1=this;return new Promise(function(_0x442ccf,_0x42dc49){return db['VtigerAccount'][_0xa6f7('0x24')]({'raw':_0x278bad[_0xa6f7('0x1b')]?_0x278bad['options']['raw']===undefined?!![]:![]:!![],'where':_0x278bad[_0xa6f7('0x1b')]?_0x278bad[_0xa6f7('0x1b')][_0xa6f7('0x1d')]||null:null,'attributes':_0x278bad[_0xa6f7('0x1b')]?_0x278bad[_0xa6f7('0x1b')]['attributes']||null:null,'include':_0x278bad['options']?_0x278bad[_0xa6f7('0x1b')]['include']?_[_0xa6f7('0x21')](_0x278bad[_0xa6f7('0x1b')][_0xa6f7('0x1f')],function(_0x237e5d){return{'model':db[_0x237e5d[_0xa6f7('0x20')]],'as':_0x237e5d['as'],'attributes':_0x237e5d[_0xa6f7('0x1e')],'include':_0x237e5d['include']?_[_0xa6f7('0x21')](_0x237e5d[_0xa6f7('0x1f')],function(_0x1a5de5){return{'model':db[_0x1a5de5['model']],'as':_0x1a5de5['as'],'attributes':_0x1a5de5[_0xa6f7('0x1e')],'include':_0x1a5de5['include']?_[_0xa6f7('0x21')](_0x1a5de5[_0xa6f7('0x1f')],function(_0x45837c){return{'model':db[_0x45837c['model']],'as':_0x45837c['as'],'attributes':_0x45837c[_0xa6f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6f7('0xe')](function(_0x3b3bc2){logger[_0xa6f7('0xf')](_0xa6f7('0x23'),_0x278bad);logger[_0xa6f7('0x10')]('ShowVtigerAccount',_0x278bad,JSON[_0xa6f7('0x12')](_0x3b3bc2));_0x442ccf(_0x3b3bc2);})[_0xa6f7('0x19')](function(_0xc25a1b){logger[_0xa6f7('0x13')](_0xa6f7('0x23'),_0xc25a1b[_0xa6f7('0x16')],_0x278bad);_0x42dc49(_0x52f9c1[_0xa6f7('0x13')](0x1f4,_0xc25a1b[_0xa6f7('0x16')]));});});}; \ No newline at end of file +var _0x80ed=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVtigerAccount','VtigerAccount','find','raw','debug','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x80ed,0x11c));var _0xd80e=function(_0x22deb9,_0x482ff){_0x22deb9=_0x22deb9-0x0;var _0x4cbbe6=_0x80ed[_0x22deb9];return _0x4cbbe6;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetVtigerAccount']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['VtigerAccount'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowVtigerAccount']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowVtigerAccount',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowVtigerAccount',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 58308f5..87f99ba 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 _0xe113=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe113,0x185));var _0x3e11=function(_0x365bea,_0x1e5933){_0x365bea=_0x365bea-0x0;var _0x5383fa=_0xe113[_0x365bea];return _0x5383fa;};'use strict';var multer=require(_0x3e11('0x0'));var util=require(_0x3e11('0x1'));var path=require(_0x3e11('0x2'));var timeout=require(_0x3e11('0x3'));var express=require(_0x3e11('0x4'));var router=express[_0x3e11('0x5')]();var fs_extra=require(_0x3e11('0x6'));var auth=require(_0x3e11('0x7'));var interaction=require(_0x3e11('0x8'));var config=require(_0x3e11('0x9'));var controller=require('./intVtigerConfiguration.controller');router[_0x3e11('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e11('0xa')](_0x3e11('0xb'),auth[_0x3e11('0xc')](),controller[_0x3e11('0xd')]);router[_0x3e11('0xa')](_0x3e11('0xe'),auth['isAuthenticated'](),controller[_0x3e11('0xf')]);router[_0x3e11('0xa')](_0x3e11('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3e11('0xa')](_0x3e11('0x11'),auth[_0x3e11('0xc')](),controller['getDescriptions']);router[_0x3e11('0x12')]('/',auth['isAuthenticated'](),controller[_0x3e11('0x13')]);router[_0x3e11('0x14')](_0x3e11('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3e11('0xb'),auth['isAuthenticated'](),controller[_0x3e11('0x15')]);module[_0x3e11('0x16')]=router; \ No newline at end of file +var _0x7010=['get','isAuthenticated','index','show','/:id/subjects','getDescriptions','post','create','put','/:id','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x202af9,_0x247c3a){var _0x1e15de=function(_0x279dba){while(--_0x279dba){_0x202af9['push'](_0x202af9['shift']());}};_0x1e15de(++_0x247c3a);}(_0x7010,0x138));var _0x0701=function(_0x17ec8c,_0x34eb4b){_0x17ec8c=_0x17ec8c-0x0;var _0x2dc485=_0x7010[_0x17ec8c];return _0x2dc485;};'use strict';var multer=require(_0x0701('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0701('0x1'));var express=require(_0x0701('0x2'));var router=express['Router']();var fs_extra=require(_0x0701('0x3'));var auth=require(_0x0701('0x4'));var interaction=require(_0x0701('0x5'));var config=require(_0x0701('0x6'));var controller=require(_0x0701('0x7'));router[_0x0701('0x8')]('/',auth[_0x0701('0x9')](),controller[_0x0701('0xa')]);router[_0x0701('0x8')]('/:id',auth[_0x0701('0x9')](),controller[_0x0701('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0701('0x8')](_0x0701('0xc'),auth[_0x0701('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x0701('0x9')](),controller[_0x0701('0xd')]);router[_0x0701('0xe')]('/',auth[_0x0701('0x9')](),controller[_0x0701('0xf')]);router[_0x0701('0x10')](_0x0701('0x11'),auth[_0x0701('0x9')](),controller[_0x0701('0x12')]);router['delete'](_0x0701('0x11'),auth[_0x0701('0x9')](),controller['destroy']);module[_0x0701('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 a61478b..01a0a2a 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 _0x11ee=['STRING','sequelize','exports'];(function(_0x21c09f,_0x6ce866){var _0x164d58=function(_0x3f94c1){while(--_0x3f94c1){_0x21c09f['push'](_0x21c09f['shift']());}};_0x164d58(++_0x6ce866);}(_0x11ee,0xb8));var _0xe11e=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x11ee[_0x32b30c];return _0xcfc212;};'use strict';var Sequelize=require(_0xe11e('0x0'));module[_0xe11e('0x1')]={'name':{'type':Sequelize[_0xe11e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7f33=['STRING','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7f33,0x71));var _0x37f3=function(_0x36c015,_0x1b8bc6){_0x36c015=_0x36c015-0x0;var _0x20db27=_0x7f33[_0x36c015];return _0x20db27;};'use strict';var Sequelize=require(_0x37f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x37f3('0x1')]},'description':{'type':Sequelize[_0x37f3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8a0395e..7f9dbdf 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 _0x6d0b=['filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','findAll','show','params','keys','length','includeAll','include','find','create','body','catch','destroy','getFields','findOne','VtigerField','merge','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','reject','update','then','sendStatus','error','stack','name','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6d0b,0x71));var _0xb6d0=function(_0x4d360a,_0x297e97){_0x4d360a=_0x4d360a-0x0;var _0x5af438=_0x6d0b[_0x4d360a];return _0x5af438;};'use strict';var emlformat=require(_0xb6d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d0('0x2'));var moment=require(_0xb6d0('0x3'));var BPromise=require(_0xb6d0('0x4'));var Mustache=require(_0xb6d0('0x5'));var util=require(_0xb6d0('0x6'));var path=require(_0xb6d0('0x7'));var sox=require(_0xb6d0('0x8'));var csv=require('to-csv');var ejs=require(_0xb6d0('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d0('0xa'));var _=require(_0xb6d0('0xb'));var squel=require(_0xb6d0('0xc'));var crypto=require(_0xb6d0('0xd'));var jsforce=require(_0xb6d0('0xe'));var deskjs=require(_0xb6d0('0xf'));var toCsv=require(_0xb6d0('0x10'));var querystring=require(_0xb6d0('0x11'));var Papa=require(_0xb6d0('0x12'));var Redis=require(_0xb6d0('0x13'));var authService=require(_0xb6d0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb6d0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6d0('0x16'))(_0xb6d0('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb6d0('0x18'))['db'];function respondWithStatusCode(_0x596077,_0x510d9d){_0x510d9d=_0x510d9d||0xcc;return function(_0x59cff0){if(_0x59cff0){return _0x596077['sendStatus'](_0x510d9d);}return _0x596077[_0xb6d0('0x19')](_0x510d9d)[_0xb6d0('0x1a')]();};}function respondWithResult(_0x15928a,_0x86a98a){_0x86a98a=_0x86a98a||0xc8;return function(_0x43e1c7){if(_0x43e1c7){return _0x15928a['status'](_0x86a98a)['json'](_0x43e1c7);}};}function respondWithFilteredResult(_0xcaeff1,_0x3869f2){return function(_0x510157){if(_0x510157){var _0x3e637f=typeof _0x3869f2[_0xb6d0('0x1b')]===_0xb6d0('0x1c')&&typeof _0x3869f2[_0xb6d0('0x1d')]===_0xb6d0('0x1c');var _0x5e28c3=_0x510157['count'];var _0x74bae4=_0x3e637f?0x0:_0x3869f2[_0xb6d0('0x1b')];var _0x13448e=_0x3e637f?_0x510157['count']:_0x3869f2[_0xb6d0('0x1b')]+_0x3869f2[_0xb6d0('0x1d')];var _0x2bc1d5;if(_0x13448e>=_0x5e28c3){_0x13448e=_0x5e28c3;_0x2bc1d5=0xc8;}else{_0x2bc1d5=0xce;}_0xcaeff1[_0xb6d0('0x19')](_0x2bc1d5);return _0xcaeff1[_0xb6d0('0x1e')](_0xb6d0('0x1f'),_0x74bae4+'-'+_0x13448e+'/'+_0x5e28c3)[_0xb6d0('0x20')](_0x510157);}return null;};}function patchUpdates(_0xb855cb){return function(_0x51ad79){try{jsonpatch['apply'](_0x51ad79,_0xb855cb,!![]);}catch(_0x12585d){return BPromise[_0xb6d0('0x21')](_0x12585d);}return _0x51ad79['save']();};}function saveUpdates(_0x12aefb,_0x565e9f){return function(_0x34606){if(_0x34606){return _0x34606[_0xb6d0('0x22')](_0x12aefb)[_0xb6d0('0x23')](function(_0x1a2e4d){return _0x1a2e4d;});}return null;};}function removeEntity(_0x46d7b8,_0x566e5c){return function(_0x5753d1){if(_0x5753d1){return _0x5753d1['destroy']()['then'](function(){_0x46d7b8[_0xb6d0('0x19')](0xcc)[_0xb6d0('0x1a')]();});}};}function handleEntityNotFound(_0x21a64d,_0x448f0d){return function(_0x1a91af){if(!_0x1a91af){_0x21a64d[_0xb6d0('0x24')](0x194);}return _0x1a91af;};}function handleError(_0x9bc4fa,_0x37440f){_0x37440f=_0x37440f||0x1f4;return function(_0x5107ab){logger[_0xb6d0('0x25')](_0x5107ab[_0xb6d0('0x26')]);if(_0x5107ab['name']){delete _0x5107ab[_0xb6d0('0x27')];}_0x9bc4fa['status'](_0x37440f)['send'](_0x5107ab);};}exports['index']=function(_0xe2bb15,_0x3175b9){var _0x5cfc78={},_0x45598c={},_0x4adcf2={'count':0x0,'rows':[]};var _0x519b43=_['map'](db[_0xb6d0('0x28')][_0xb6d0('0x29')],function(_0x156f29){return{'name':_0x156f29[_0xb6d0('0x2a')],'type':_0x156f29[_0xb6d0('0x2b')][_0xb6d0('0x2c')]};});_0x45598c['model']=_[_0xb6d0('0x2d')](_0x519b43,_0xb6d0('0x27'));_0x45598c[_0xb6d0('0x2e')]=_['keys'](_0xe2bb15[_0xb6d0('0x2e')]);_0x45598c[_0xb6d0('0x2f')]=_[_0xb6d0('0x30')](_0x45598c['model'],_0x45598c['query']);_0x5cfc78['attributes']=_[_0xb6d0('0x30')](_0x45598c[_0xb6d0('0x31')],qs[_0xb6d0('0x32')](_0xe2bb15[_0xb6d0('0x2e')]['fields']));_0x5cfc78[_0xb6d0('0x33')]=_0x5cfc78[_0xb6d0('0x33')]['length']?_0x5cfc78['attributes']:_0x45598c[_0xb6d0('0x31')];if(!_0xe2bb15[_0xb6d0('0x2e')]['hasOwnProperty'](_0xb6d0('0x34'))){_0x5cfc78[_0xb6d0('0x1d')]=qs[_0xb6d0('0x1d')](_0xe2bb15[_0xb6d0('0x2e')]['limit']);_0x5cfc78[_0xb6d0('0x1b')]=qs[_0xb6d0('0x1b')](_0xe2bb15[_0xb6d0('0x2e')][_0xb6d0('0x1b')]);}_0x5cfc78[_0xb6d0('0x35')]=qs[_0xb6d0('0x36')](_0xe2bb15[_0xb6d0('0x2e')][_0xb6d0('0x36')]);_0x5cfc78['where']=qs[_0xb6d0('0x2f')](_[_0xb6d0('0x37')](_0xe2bb15[_0xb6d0('0x2e')],_0x45598c[_0xb6d0('0x2f')]),_0x519b43);if(_0xe2bb15[_0xb6d0('0x2e')][_0xb6d0('0x38')]){_0x5cfc78[_0xb6d0('0x39')]=_['merge'](_0x5cfc78[_0xb6d0('0x39')],{'$or':_['map'](_0x519b43,function(_0x4c66d6){if(_0x4c66d6['type']!==_0xb6d0('0x3a')){var _0x133170={};_0x133170[_0x4c66d6[_0xb6d0('0x27')]]={'$like':'%'+_0xe2bb15['query'][_0xb6d0('0x38')]+'%'};return _0x133170;}})});}_0x5cfc78=_['merge']({},_0x5cfc78,_0xe2bb15[_0xb6d0('0x3b')]);var _0x104ff6={'where':_0x5cfc78['where']};return db[_0xb6d0('0x28')][_0xb6d0('0x3c')](_0x104ff6)['then'](function(_0x2e6514){_0x4adcf2[_0xb6d0('0x3c')]=_0x2e6514;if(_0xe2bb15[_0xb6d0('0x2e')]['includeAll']){_0x5cfc78['include']=[{'all':!![]}];}return db[_0xb6d0('0x28')][_0xb6d0('0x3d')](_0x5cfc78);})[_0xb6d0('0x23')](function(_0x47cc58){_0x4adcf2['rows']=_0x47cc58;return _0x4adcf2;})['then'](respondWithFilteredResult(_0x3175b9,_0x5cfc78))['catch'](handleError(_0x3175b9,null));};exports[_0xb6d0('0x3e')]=function(_0x5cbb62,_0x11f5ef){var _0x581098={'raw':![],'where':{'id':_0x5cbb62[_0xb6d0('0x3f')]['id']}},_0x28e0c9={};_0x28e0c9[_0xb6d0('0x31')]=_[_0xb6d0('0x40')](db[_0xb6d0('0x28')]['rawAttributes']);_0x28e0c9[_0xb6d0('0x2e')]=_[_0xb6d0('0x40')](_0x5cbb62[_0xb6d0('0x2e')]);_0x28e0c9[_0xb6d0('0x2f')]=_['intersection'](_0x28e0c9[_0xb6d0('0x31')],_0x28e0c9[_0xb6d0('0x2e')]);_0x581098[_0xb6d0('0x33')]=_[_0xb6d0('0x30')](_0x28e0c9[_0xb6d0('0x31')],qs['fields'](_0x5cbb62[_0xb6d0('0x2e')][_0xb6d0('0x32')]));_0x581098['attributes']=_0x581098[_0xb6d0('0x33')][_0xb6d0('0x41')]?_0x581098[_0xb6d0('0x33')]:_0x28e0c9[_0xb6d0('0x31')];if(_0x5cbb62['query'][_0xb6d0('0x42')]){_0x581098[_0xb6d0('0x43')]=[{'all':!![]}];}_0x581098=_['merge']({},_0x581098,_0x5cbb62[_0xb6d0('0x3b')]);return db[_0xb6d0('0x28')][_0xb6d0('0x44')](_0x581098)['then'](handleEntityNotFound(_0x11f5ef,null))[_0xb6d0('0x23')](respondWithResult(_0x11f5ef,null))['catch'](handleError(_0x11f5ef,null));};exports['create']=function(_0x417c6d,_0x17a76d){return db[_0xb6d0('0x28')][_0xb6d0('0x45')](_0x417c6d[_0xb6d0('0x46')],{})[_0xb6d0('0x23')](respondWithResult(_0x17a76d,0xc9))[_0xb6d0('0x47')](handleError(_0x17a76d,null));};exports[_0xb6d0('0x22')]=function(_0x3f33e7,_0x3273aa){if(_0x3f33e7[_0xb6d0('0x46')]['id']){delete _0x3f33e7['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x3f33e7[_0xb6d0('0x3f')]['id']}})[_0xb6d0('0x23')](handleEntityNotFound(_0x3273aa,null))[_0xb6d0('0x23')](saveUpdates(_0x3f33e7['body'],null))[_0xb6d0('0x23')](respondWithResult(_0x3273aa,null))[_0xb6d0('0x47')](handleError(_0x3273aa,null));};exports[_0xb6d0('0x48')]=function(_0x121f01,_0x45b509){return db['VtigerConfiguration'][_0xb6d0('0x44')]({'where':{'id':_0x121f01[_0xb6d0('0x3f')]['id']}})[_0xb6d0('0x23')](handleEntityNotFound(_0x45b509,null))[_0xb6d0('0x23')](removeEntity(_0x45b509,null))[_0xb6d0('0x47')](handleError(_0x45b509,null));};exports[_0xb6d0('0x49')]=function(_0x1b9cff,_0xbadbef,_0x923211){var _0x2e3e6a={};var _0x20378a={};var _0x298a01;var _0x213591;return db['VtigerConfiguration'][_0xb6d0('0x4a')]({'where':{'id':_0x1b9cff[_0xb6d0('0x3f')]['id']}})[_0xb6d0('0x23')](handleEntityNotFound(_0xbadbef,null))[_0xb6d0('0x23')](function(_0x3ea37a){if(_0x3ea37a){_0x298a01=_0x3ea37a;_0x20378a[_0xb6d0('0x31')]=_[_0xb6d0('0x40')](db[_0xb6d0('0x4b')][_0xb6d0('0x29')]);_0x20378a[_0xb6d0('0x2e')]=_[_0xb6d0('0x40')](_0x1b9cff['query']);_0x20378a['filters']=_[_0xb6d0('0x30')](_0x20378a[_0xb6d0('0x31')],_0x20378a['query']);_0x2e3e6a[_0xb6d0('0x33')]=_[_0xb6d0('0x30')](_0x20378a['model'],qs['fields'](_0x1b9cff['query'][_0xb6d0('0x32')]));_0x2e3e6a[_0xb6d0('0x33')]=_0x2e3e6a[_0xb6d0('0x33')]['length']?_0x2e3e6a[_0xb6d0('0x33')]:_0x20378a[_0xb6d0('0x31')];_0x2e3e6a[_0xb6d0('0x35')]=qs[_0xb6d0('0x36')](_0x1b9cff[_0xb6d0('0x2e')]['sort']);_0x2e3e6a['where']=qs[_0xb6d0('0x2f')](_[_0xb6d0('0x37')](_0x1b9cff[_0xb6d0('0x2e')],_0x20378a[_0xb6d0('0x2f')]));if(_0x1b9cff[_0xb6d0('0x2e')][_0xb6d0('0x38')]){_0x2e3e6a[_0xb6d0('0x39')]=_[_0xb6d0('0x4c')](_0x2e3e6a[_0xb6d0('0x39')],{'$or':_['map'](_0x2e3e6a['attributes'],function(_0x578765){var _0x37fc4b={};_0x37fc4b[_0x578765]={'$like':'%'+_0x1b9cff[_0xb6d0('0x2e')][_0xb6d0('0x38')]+'%'};return _0x37fc4b;})});}_0x2e3e6a=_[_0xb6d0('0x4c')]({},_0x2e3e6a,_0x1b9cff[_0xb6d0('0x3b')]);return _0x298a01[_0xb6d0('0x49')](_0x2e3e6a);}})[_0xb6d0('0x23')](function(_0x33fddf){if(_0x33fddf){_0x213591=_0x33fddf['length'];if(!_0x1b9cff['query'][_0xb6d0('0x4d')]('nolimit')){_0x2e3e6a[_0xb6d0('0x1d')]=qs['limit'](_0x1b9cff[_0xb6d0('0x2e')][_0xb6d0('0x1d')]);_0x2e3e6a[_0xb6d0('0x1b')]=qs['offset'](_0x1b9cff['query'][_0xb6d0('0x1b')]);}return _0x298a01['getFields'](_0x2e3e6a);}})[_0xb6d0('0x23')](function(_0x55bf60){if(_0x55bf60){return _0x55bf60?{'count':_0x213591,'rows':_0x55bf60}:null;}})[_0xb6d0('0x23')](respondWithResult(_0xbadbef,null))[_0xb6d0('0x47')](handleError(_0xbadbef,null));};exports[_0xb6d0('0x4e')]=function(_0x1d59d7,_0x591b01,_0x95c30d){var _0x5895dc={};var _0x52f40b={};var _0x436045;var _0x3d31ca;return db[_0xb6d0('0x28')]['findOne']({'where':{'id':_0x1d59d7[_0xb6d0('0x3f')]['id']}})[_0xb6d0('0x23')](handleEntityNotFound(_0x591b01,null))[_0xb6d0('0x23')](function(_0x2828a4){if(_0x2828a4){_0x436045=_0x2828a4;_0x52f40b[_0xb6d0('0x31')]=_['keys'](db[_0xb6d0('0x4b')][_0xb6d0('0x29')]);_0x52f40b['query']=_[_0xb6d0('0x40')](_0x1d59d7[_0xb6d0('0x2e')]);_0x52f40b[_0xb6d0('0x2f')]=_[_0xb6d0('0x30')](_0x52f40b[_0xb6d0('0x31')],_0x52f40b[_0xb6d0('0x2e')]);_0x5895dc[_0xb6d0('0x33')]=_[_0xb6d0('0x30')](_0x52f40b[_0xb6d0('0x31')],qs[_0xb6d0('0x32')](_0x1d59d7[_0xb6d0('0x2e')][_0xb6d0('0x32')]));_0x5895dc['attributes']=_0x5895dc['attributes'][_0xb6d0('0x41')]?_0x5895dc['attributes']:_0x52f40b[_0xb6d0('0x31')];_0x5895dc[_0xb6d0('0x35')]=qs['sort'](_0x1d59d7['query'][_0xb6d0('0x36')]);_0x5895dc[_0xb6d0('0x39')]=qs[_0xb6d0('0x2f')](_[_0xb6d0('0x37')](_0x1d59d7[_0xb6d0('0x2e')],_0x52f40b[_0xb6d0('0x2f')]));if(_0x1d59d7[_0xb6d0('0x2e')]['filter']){_0x5895dc['where']=_[_0xb6d0('0x4c')](_0x5895dc['where'],{'$or':_[_0xb6d0('0x2d')](_0x5895dc[_0xb6d0('0x33')],function(_0xe50d35){var _0x1eaeec={};_0x1eaeec[_0xe50d35]={'$like':'%'+_0x1d59d7['query']['filter']+'%'};return _0x1eaeec;})});}_0x5895dc=_[_0xb6d0('0x4c')]({},_0x5895dc,_0x1d59d7[_0xb6d0('0x3b')]);return _0x436045[_0xb6d0('0x4e')](_0x5895dc);}})[_0xb6d0('0x23')](function(_0x5b033e){if(_0x5b033e){_0x3d31ca=_0x5b033e[_0xb6d0('0x41')];if(!_0x1d59d7[_0xb6d0('0x2e')]['hasOwnProperty'](_0xb6d0('0x34'))){_0x5895dc[_0xb6d0('0x1d')]=qs[_0xb6d0('0x1d')](_0x1d59d7[_0xb6d0('0x2e')]['limit']);_0x5895dc[_0xb6d0('0x1b')]=qs[_0xb6d0('0x1b')](_0x1d59d7['query'][_0xb6d0('0x1b')]);}return _0x436045['getSubjects'](_0x5895dc);}})[_0xb6d0('0x23')](function(_0x423441){if(_0x423441){return _0x423441?{'count':_0x3d31ca,'rows':_0x423441}:null;}})[_0xb6d0('0x23')](respondWithResult(_0x591b01,null))[_0xb6d0('0x47')](handleError(_0x591b01,null));};exports[_0xb6d0('0x4f')]=function(_0x28b4f1,_0x3671e7,_0x50484e){var _0x4fde11={};var _0x21def4={};var _0x4341a2;var _0x5e8453;return db[_0xb6d0('0x28')][_0xb6d0('0x4a')]({'where':{'id':_0x28b4f1[_0xb6d0('0x3f')]['id']}})[_0xb6d0('0x23')](handleEntityNotFound(_0x3671e7,null))['then'](function(_0x5ebd37){if(_0x5ebd37){_0x4341a2=_0x5ebd37;_0x21def4[_0xb6d0('0x31')]=_[_0xb6d0('0x40')](db[_0xb6d0('0x4b')][_0xb6d0('0x29')]);_0x21def4[_0xb6d0('0x2e')]=_[_0xb6d0('0x40')](_0x28b4f1[_0xb6d0('0x2e')]);_0x21def4[_0xb6d0('0x2f')]=_[_0xb6d0('0x30')](_0x21def4[_0xb6d0('0x31')],_0x21def4[_0xb6d0('0x2e')]);_0x4fde11[_0xb6d0('0x33')]=_[_0xb6d0('0x30')](_0x21def4['model'],qs[_0xb6d0('0x32')](_0x28b4f1[_0xb6d0('0x2e')][_0xb6d0('0x32')]));_0x4fde11[_0xb6d0('0x33')]=_0x4fde11['attributes'][_0xb6d0('0x41')]?_0x4fde11[_0xb6d0('0x33')]:_0x21def4[_0xb6d0('0x31')];_0x4fde11[_0xb6d0('0x35')]=qs['sort'](_0x28b4f1[_0xb6d0('0x2e')][_0xb6d0('0x36')]);_0x4fde11[_0xb6d0('0x39')]=qs['filters'](_[_0xb6d0('0x37')](_0x28b4f1['query'],_0x21def4[_0xb6d0('0x2f')]));if(_0x28b4f1[_0xb6d0('0x2e')]['filter']){_0x4fde11[_0xb6d0('0x39')]=_['merge'](_0x4fde11[_0xb6d0('0x39')],{'$or':_[_0xb6d0('0x2d')](_0x4fde11[_0xb6d0('0x33')],function(_0x133f30){var _0x2b7538={};_0x2b7538[_0x133f30]={'$like':'%'+_0x28b4f1[_0xb6d0('0x2e')]['filter']+'%'};return _0x2b7538;})});}_0x4fde11=_[_0xb6d0('0x4c')]({},_0x4fde11,_0x28b4f1[_0xb6d0('0x3b')]);return _0x4341a2[_0xb6d0('0x4f')](_0x4fde11);}})[_0xb6d0('0x23')](function(_0x4a3be8){if(_0x4a3be8){_0x5e8453=_0x4a3be8[_0xb6d0('0x41')];if(!_0x28b4f1['query']['hasOwnProperty'](_0xb6d0('0x34'))){_0x4fde11['limit']=qs[_0xb6d0('0x1d')](_0x28b4f1[_0xb6d0('0x2e')][_0xb6d0('0x1d')]);_0x4fde11[_0xb6d0('0x1b')]=qs[_0xb6d0('0x1b')](_0x28b4f1[_0xb6d0('0x2e')][_0xb6d0('0x1b')]);}return _0x4341a2['getDescriptions'](_0x4fde11);}})[_0xb6d0('0x23')](function(_0x214c4){if(_0x214c4){return _0x214c4?{'count':_0x5e8453,'rows':_0x214c4}:null;}})[_0xb6d0('0x23')](respondWithResult(_0x3671e7,null))[_0xb6d0('0x47')](handleError(_0x3671e7,null));}; \ No newline at end of file +var _0x537f=['end','status','offset','limit','count','Content-Range','json','save','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','includeAll','include','rows','catch','params','options','find','create','update','body','getFields','findOne','VtigerField','nolimit','getSubjects','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x537f,0x1c4));var _0xf537=function(_0x3f4cf5,_0x4167ad){_0x3f4cf5=_0x3f4cf5-0x0;var _0x33fd4e=_0x537f[_0x3f4cf5];return _0x33fd4e;};'use strict';var emlformat=require(_0xf537('0x0'));var rimraf=require(_0xf537('0x1'));var zipdir=require(_0xf537('0x2'));var jsonpatch=require(_0xf537('0x3'));var rp=require(_0xf537('0x4'));var moment=require('moment');var BPromise=require(_0xf537('0x5'));var Mustache=require(_0xf537('0x6'));var util=require(_0xf537('0x7'));var path=require('path');var sox=require(_0xf537('0x8'));var csv=require('to-csv');var ejs=require(_0xf537('0x9'));var fs=require('fs');var fs_extra=require(_0xf537('0xa'));var _=require(_0xf537('0xb'));var squel=require(_0xf537('0xc'));var crypto=require(_0xf537('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf537('0xe'));var querystring=require(_0xf537('0xf'));var Papa=require(_0xf537('0x10'));var Redis=require(_0xf537('0x11'));var authService=require(_0xf537('0x12'));var qs=require(_0xf537('0x13'));var as=require(_0xf537('0x14'));var hardwareService=require(_0xf537('0x15'));var logger=require(_0xf537('0x16'))(_0xf537('0x17'));var utils=require(_0xf537('0x18'));var config=require(_0xf537('0x19'));var licenseUtil=require(_0xf537('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372a41,_0x292c54){_0x292c54=_0x292c54||0xcc;return function(_0x4cd458){if(_0x4cd458){return _0x372a41[_0xf537('0x1b')](_0x292c54);}return _0x372a41['status'](_0x292c54)[_0xf537('0x1c')]();};}function respondWithResult(_0x1671c4,_0x18f190){_0x18f190=_0x18f190||0xc8;return function(_0x1eca98){if(_0x1eca98){return _0x1671c4[_0xf537('0x1d')](_0x18f190)['json'](_0x1eca98);}};}function respondWithFilteredResult(_0x14a917,_0x53595b){return function(_0x121c2c){if(_0x121c2c){var _0x3060d2=typeof _0x53595b[_0xf537('0x1e')]==='undefined'&&typeof _0x53595b[_0xf537('0x1f')]==='undefined';var _0x315a25=_0x121c2c[_0xf537('0x20')];var _0x561a3c=_0x3060d2?0x0:_0x53595b[_0xf537('0x1e')];var _0xa45756=_0x3060d2?_0x121c2c['count']:_0x53595b[_0xf537('0x1e')]+_0x53595b[_0xf537('0x1f')];var _0x58088f;if(_0xa45756>=_0x315a25){_0xa45756=_0x315a25;_0x58088f=0xc8;}else{_0x58088f=0xce;}_0x14a917[_0xf537('0x1d')](_0x58088f);return _0x14a917['set'](_0xf537('0x21'),_0x561a3c+'-'+_0xa45756+'/'+_0x315a25)[_0xf537('0x22')](_0x121c2c);}return null;};}function patchUpdates(_0xc52263){return function(_0x500e08){try{jsonpatch['apply'](_0x500e08,_0xc52263,!![]);}catch(_0x1b551a){return BPromise['reject'](_0x1b551a);}return _0x500e08[_0xf537('0x23')]();};}function saveUpdates(_0x26ee59,_0x1c67a6){return function(_0x20c637){if(_0x20c637){return _0x20c637['update'](_0x26ee59)['then'](function(_0x207a8b){return _0x207a8b;});}return null;};}function removeEntity(_0x18a422,_0x2044f1){return function(_0x14a323){if(_0x14a323){return _0x14a323[_0xf537('0x24')]()[_0xf537('0x25')](function(){_0x18a422[_0xf537('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69017c,_0x2c15f6){return function(_0x406c31){if(!_0x406c31){_0x69017c[_0xf537('0x1b')](0x194);}return _0x406c31;};}function handleError(_0x4f3baa,_0x3fcf7f){_0x3fcf7f=_0x3fcf7f||0x1f4;return function(_0x3567a0){logger[_0xf537('0x26')](_0x3567a0[_0xf537('0x27')]);if(_0x3567a0[_0xf537('0x28')]){delete _0x3567a0['name'];}_0x4f3baa[_0xf537('0x1d')](_0x3fcf7f)[_0xf537('0x29')](_0x3567a0);};}exports[_0xf537('0x2a')]=function(_0x4ed682,_0x5d6b38){var _0x251de2={},_0x2efc09={},_0x21e9c7={'count':0x0,'rows':[]};var _0x180d57=_[_0xf537('0x2b')](db[_0xf537('0x2c')][_0xf537('0x2d')],function(_0x457c09){return{'name':_0x457c09[_0xf537('0x2e')],'type':_0x457c09['type'][_0xf537('0x2f')]};});_0x2efc09[_0xf537('0x30')]=_[_0xf537('0x2b')](_0x180d57,_0xf537('0x28'));_0x2efc09['query']=_[_0xf537('0x31')](_0x4ed682['query']);_0x2efc09[_0xf537('0x32')]=_[_0xf537('0x33')](_0x2efc09['model'],_0x2efc09[_0xf537('0x34')]);_0x251de2[_0xf537('0x35')]=_[_0xf537('0x33')](_0x2efc09[_0xf537('0x30')],qs[_0xf537('0x36')](_0x4ed682[_0xf537('0x34')][_0xf537('0x36')]));_0x251de2[_0xf537('0x35')]=_0x251de2[_0xf537('0x35')][_0xf537('0x37')]?_0x251de2[_0xf537('0x35')]:_0x2efc09[_0xf537('0x30')];if(!_0x4ed682['query'][_0xf537('0x38')]('nolimit')){_0x251de2[_0xf537('0x1f')]=qs['limit'](_0x4ed682['query'][_0xf537('0x1f')]);_0x251de2['offset']=qs['offset'](_0x4ed682[_0xf537('0x34')]['offset']);}_0x251de2[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x4ed682['query'][_0xf537('0x3a')]);_0x251de2['where']=qs['filters'](_[_0xf537('0x3b')](_0x4ed682[_0xf537('0x34')],_0x2efc09[_0xf537('0x32')]),_0x180d57);if(_0x4ed682[_0xf537('0x34')]['filter']){_0x251de2[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x251de2[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x180d57,function(_0x6a6bdd){if(_0x6a6bdd[_0xf537('0x3e')]!=='VIRTUAL'){var _0x4331a9={};_0x4331a9[_0x6a6bdd[_0xf537('0x28')]]={'$like':'%'+_0x4ed682[_0xf537('0x34')]['filter']+'%'};return _0x4331a9;}})});}_0x251de2=_[_0xf537('0x3d')]({},_0x251de2,_0x4ed682['options']);var _0x4502e4={'where':_0x251de2[_0xf537('0x3c')]};return db[_0xf537('0x2c')][_0xf537('0x20')](_0x4502e4)[_0xf537('0x25')](function(_0x1e0d59){_0x21e9c7[_0xf537('0x20')]=_0x1e0d59;if(_0x4ed682[_0xf537('0x34')][_0xf537('0x3f')]){_0x251de2[_0xf537('0x40')]=[{'all':!![]}];}return db[_0xf537('0x2c')]['findAll'](_0x251de2);})['then'](function(_0x115c5a){_0x21e9c7[_0xf537('0x41')]=_0x115c5a;return _0x21e9c7;})['then'](respondWithFilteredResult(_0x5d6b38,_0x251de2))[_0xf537('0x42')](handleError(_0x5d6b38,null));};exports['show']=function(_0x4cabf3,_0x356bcc){var _0x434630={'raw':![],'where':{'id':_0x4cabf3[_0xf537('0x43')]['id']}},_0x307785={};_0x307785['model']=_[_0xf537('0x31')](db[_0xf537('0x2c')][_0xf537('0x2d')]);_0x307785[_0xf537('0x34')]=_[_0xf537('0x31')](_0x4cabf3[_0xf537('0x34')]);_0x307785[_0xf537('0x32')]=_[_0xf537('0x33')](_0x307785[_0xf537('0x30')],_0x307785[_0xf537('0x34')]);_0x434630[_0xf537('0x35')]=_[_0xf537('0x33')](_0x307785['model'],qs[_0xf537('0x36')](_0x4cabf3[_0xf537('0x34')]['fields']));_0x434630[_0xf537('0x35')]=_0x434630['attributes']['length']?_0x434630[_0xf537('0x35')]:_0x307785[_0xf537('0x30')];if(_0x4cabf3[_0xf537('0x34')][_0xf537('0x3f')]){_0x434630[_0xf537('0x40')]=[{'all':!![]}];}_0x434630=_[_0xf537('0x3d')]({},_0x434630,_0x4cabf3[_0xf537('0x44')]);return db[_0xf537('0x2c')][_0xf537('0x45')](_0x434630)[_0xf537('0x25')](handleEntityNotFound(_0x356bcc,null))[_0xf537('0x25')](respondWithResult(_0x356bcc,null))[_0xf537('0x42')](handleError(_0x356bcc,null));};exports['create']=function(_0x5dd709,_0x2d31b8){return db[_0xf537('0x2c')][_0xf537('0x46')](_0x5dd709['body'],{})[_0xf537('0x25')](respondWithResult(_0x2d31b8,0xc9))[_0xf537('0x42')](handleError(_0x2d31b8,null));};exports[_0xf537('0x47')]=function(_0x4b014f,_0x34efe9){if(_0x4b014f[_0xf537('0x48')]['id']){delete _0x4b014f[_0xf537('0x48')]['id'];}return db[_0xf537('0x2c')][_0xf537('0x45')]({'where':{'id':_0x4b014f[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0x34efe9,null))[_0xf537('0x25')](saveUpdates(_0x4b014f[_0xf537('0x48')],null))[_0xf537('0x25')](respondWithResult(_0x34efe9,null))[_0xf537('0x42')](handleError(_0x34efe9,null));};exports['destroy']=function(_0x2a91dc,_0x1d1dec){return db[_0xf537('0x2c')]['find']({'where':{'id':_0x2a91dc[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0x1d1dec,null))['then'](removeEntity(_0x1d1dec,null))[_0xf537('0x42')](handleError(_0x1d1dec,null));};exports[_0xf537('0x49')]=function(_0x275e34,_0xc9a14f,_0x5f329c){var _0x46f130={};var _0x3ab64c={};var _0x59d7cd;var _0x4cc4af;return db[_0xf537('0x2c')][_0xf537('0x4a')]({'where':{'id':_0x275e34[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0xc9a14f,null))[_0xf537('0x25')](function(_0x15e6f9){if(_0x15e6f9){_0x59d7cd=_0x15e6f9;_0x3ab64c['model']=_['keys'](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x3ab64c['query']=_['keys'](_0x275e34[_0xf537('0x34')]);_0x3ab64c[_0xf537('0x32')]=_['intersection'](_0x3ab64c[_0xf537('0x30')],_0x3ab64c['query']);_0x46f130[_0xf537('0x35')]=_['intersection'](_0x3ab64c[_0xf537('0x30')],qs[_0xf537('0x36')](_0x275e34[_0xf537('0x34')][_0xf537('0x36')]));_0x46f130[_0xf537('0x35')]=_0x46f130[_0xf537('0x35')][_0xf537('0x37')]?_0x46f130[_0xf537('0x35')]:_0x3ab64c[_0xf537('0x30')];_0x46f130[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x275e34[_0xf537('0x34')][_0xf537('0x3a')]);_0x46f130[_0xf537('0x3c')]=qs['filters'](_[_0xf537('0x3b')](_0x275e34[_0xf537('0x34')],_0x3ab64c[_0xf537('0x32')]));if(_0x275e34[_0xf537('0x34')]['filter']){_0x46f130[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x46f130[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x46f130['attributes'],function(_0x1815d5){var _0x5d33c0={};_0x5d33c0[_0x1815d5]={'$like':'%'+_0x275e34[_0xf537('0x34')]['filter']+'%'};return _0x5d33c0;})});}_0x46f130=_['merge']({},_0x46f130,_0x275e34[_0xf537('0x44')]);return _0x59d7cd[_0xf537('0x49')](_0x46f130);}})[_0xf537('0x25')](function(_0x21a71f){if(_0x21a71f){_0x4cc4af=_0x21a71f[_0xf537('0x37')];if(!_0x275e34[_0xf537('0x34')][_0xf537('0x38')](_0xf537('0x4c'))){_0x46f130[_0xf537('0x1f')]=qs[_0xf537('0x1f')](_0x275e34[_0xf537('0x34')][_0xf537('0x1f')]);_0x46f130[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x275e34['query'][_0xf537('0x1e')]);}return _0x59d7cd['getFields'](_0x46f130);}})[_0xf537('0x25')](function(_0x202daa){if(_0x202daa){return _0x202daa?{'count':_0x4cc4af,'rows':_0x202daa}:null;}})[_0xf537('0x25')](respondWithResult(_0xc9a14f,null))[_0xf537('0x42')](handleError(_0xc9a14f,null));};exports[_0xf537('0x4d')]=function(_0x124bba,_0xab4062,_0x10980b){var _0x4594aa={};var _0x1b9297={};var _0x2baf53;var _0x2e28bf;return db[_0xf537('0x2c')]['findOne']({'where':{'id':_0x124bba[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0xab4062,null))[_0xf537('0x25')](function(_0x21b049){if(_0x21b049){_0x2baf53=_0x21b049;_0x1b9297[_0xf537('0x30')]=_[_0xf537('0x31')](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x1b9297[_0xf537('0x34')]=_[_0xf537('0x31')](_0x124bba['query']);_0x1b9297[_0xf537('0x32')]=_[_0xf537('0x33')](_0x1b9297[_0xf537('0x30')],_0x1b9297[_0xf537('0x34')]);_0x4594aa['attributes']=_['intersection'](_0x1b9297[_0xf537('0x30')],qs[_0xf537('0x36')](_0x124bba[_0xf537('0x34')][_0xf537('0x36')]));_0x4594aa[_0xf537('0x35')]=_0x4594aa[_0xf537('0x35')][_0xf537('0x37')]?_0x4594aa[_0xf537('0x35')]:_0x1b9297['model'];_0x4594aa[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x124bba[_0xf537('0x34')][_0xf537('0x3a')]);_0x4594aa[_0xf537('0x3c')]=qs[_0xf537('0x32')](_['pick'](_0x124bba[_0xf537('0x34')],_0x1b9297[_0xf537('0x32')]));if(_0x124bba[_0xf537('0x34')][_0xf537('0x4e')]){_0x4594aa[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x4594aa[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x4594aa['attributes'],function(_0x276e1f){var _0x4fb549={};_0x4fb549[_0x276e1f]={'$like':'%'+_0x124bba[_0xf537('0x34')]['filter']+'%'};return _0x4fb549;})});}_0x4594aa=_[_0xf537('0x3d')]({},_0x4594aa,_0x124bba[_0xf537('0x44')]);return _0x2baf53[_0xf537('0x4d')](_0x4594aa);}})[_0xf537('0x25')](function(_0x302ca1){if(_0x302ca1){_0x2e28bf=_0x302ca1[_0xf537('0x37')];if(!_0x124bba[_0xf537('0x34')]['hasOwnProperty'](_0xf537('0x4c'))){_0x4594aa[_0xf537('0x1f')]=qs[_0xf537('0x1f')](_0x124bba['query']['limit']);_0x4594aa[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x124bba['query'][_0xf537('0x1e')]);}return _0x2baf53[_0xf537('0x4d')](_0x4594aa);}})[_0xf537('0x25')](function(_0x4512bd){if(_0x4512bd){return _0x4512bd?{'count':_0x2e28bf,'rows':_0x4512bd}:null;}})[_0xf537('0x25')](respondWithResult(_0xab4062,null))['catch'](handleError(_0xab4062,null));};exports[_0xf537('0x4f')]=function(_0x170d5c,_0x1a57ed,_0x447882){var _0x245beb={};var _0x14f1fe={};var _0x1bfd11;var _0x153a5d;return db[_0xf537('0x2c')][_0xf537('0x4a')]({'where':{'id':_0x170d5c[_0xf537('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a57ed,null))[_0xf537('0x25')](function(_0x5dbdfd){if(_0x5dbdfd){_0x1bfd11=_0x5dbdfd;_0x14f1fe[_0xf537('0x30')]=_[_0xf537('0x31')](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x14f1fe[_0xf537('0x34')]=_[_0xf537('0x31')](_0x170d5c[_0xf537('0x34')]);_0x14f1fe[_0xf537('0x32')]=_[_0xf537('0x33')](_0x14f1fe[_0xf537('0x30')],_0x14f1fe[_0xf537('0x34')]);_0x245beb[_0xf537('0x35')]=_[_0xf537('0x33')](_0x14f1fe[_0xf537('0x30')],qs[_0xf537('0x36')](_0x170d5c[_0xf537('0x34')]['fields']));_0x245beb['attributes']=_0x245beb[_0xf537('0x35')][_0xf537('0x37')]?_0x245beb[_0xf537('0x35')]:_0x14f1fe[_0xf537('0x30')];_0x245beb[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x170d5c['query']['sort']);_0x245beb['where']=qs[_0xf537('0x32')](_[_0xf537('0x3b')](_0x170d5c[_0xf537('0x34')],_0x14f1fe[_0xf537('0x32')]));if(_0x170d5c[_0xf537('0x34')][_0xf537('0x4e')]){_0x245beb[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x245beb[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x245beb[_0xf537('0x35')],function(_0x1e3e5c){var _0x45261a={};_0x45261a[_0x1e3e5c]={'$like':'%'+_0x170d5c['query'][_0xf537('0x4e')]+'%'};return _0x45261a;})});}_0x245beb=_[_0xf537('0x3d')]({},_0x245beb,_0x170d5c['options']);return _0x1bfd11[_0xf537('0x4f')](_0x245beb);}})[_0xf537('0x25')](function(_0x5ee0f1){if(_0x5ee0f1){_0x153a5d=_0x5ee0f1[_0xf537('0x37')];if(!_0x170d5c[_0xf537('0x34')]['hasOwnProperty']('nolimit')){_0x245beb['limit']=qs[_0xf537('0x1f')](_0x170d5c[_0xf537('0x34')][_0xf537('0x1f')]);_0x245beb[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x170d5c[_0xf537('0x34')][_0xf537('0x1e')]);}return _0x1bfd11['getDescriptions'](_0x245beb);}})[_0xf537('0x25')](function(_0x1369ac){if(_0x1369ac){return _0x1369ac?{'count':_0x153a5d,'rows':_0x1369ac}:null;}})['then'](respondWithResult(_0x1a57ed,null))[_0xf537('0x42')](handleError(_0x1a57ed,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index cfd033d..2f7aa7b 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 _0x1ff9=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment','request-promise','path'];(function(_0x3d8e50,_0xc4f461){var _0x430a60=function(_0x2450c5){while(--_0x2450c5){_0x3d8e50['push'](_0x3d8e50['shift']());}};_0x430a60(++_0xc4f461);}(_0x1ff9,0xff));var _0x91ff=function(_0xcafb2b,_0x2cc85e){_0xcafb2b=_0xcafb2b-0x0;var _0x539f9a=_0x1ff9[_0xcafb2b];return _0x539f9a;};'use strict';var _=require(_0x91ff('0x0'));var util=require('util');var logger=require(_0x91ff('0x1'))('api');var moment=require(_0x91ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x91ff('0x3'));var fs=require('fs');var path=require(_0x91ff('0x4'));var rimraf=require(_0x91ff('0x5'));var config=require(_0x91ff('0x6'));var attributes=require(_0x91ff('0x7'));module['exports']=function(_0x535243,_0x1e3bfc){return _0x535243['define'](_0x91ff('0x8'),attributes,{'tableName':_0x91ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8484=['define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x218386,_0x140a12){var _0x24252b=function(_0xebd1f8){while(--_0xebd1f8){_0x218386['push'](_0x218386['shift']());}};_0x24252b(++_0x140a12);}(_0x8484,0x199));var _0x4848=function(_0x256b67,_0x14e47b){_0x256b67=_0x256b67-0x0;var _0x3e2d99=_0x8484[_0x256b67];return _0x3e2d99;};'use strict';var _=require(_0x4848('0x0'));var util=require('util');var logger=require(_0x4848('0x1'))(_0x4848('0x2'));var moment=require(_0x4848('0x3'));var BPromise=require(_0x4848('0x4'));var rp=require(_0x4848('0x5'));var fs=require('fs');var path=require(_0x4848('0x6'));var rimraf=require(_0x4848('0x7'));var config=require(_0x4848('0x8'));var attributes=require(_0x4848('0x9'));module[_0x4848('0xa')]=function(_0x2c9e64,_0x262a14){return _0x2c9e64[_0x4848('0xb')](_0x4848('0xc'),attributes,{'tableName':_0x4848('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 b753f4c..c83d624 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 _0xa2a0=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring'];(function(_0x228e68,_0x1a34d0){var _0x13be83=function(_0x38ac28){while(--_0x38ac28){_0x228e68['push'](_0x228e68['shift']());}};_0x13be83(++_0x1a34d0);}(_0xa2a0,0x146));var _0x0a2a=function(_0x4a7f4e,_0xf570d0){_0x4a7f4e=_0x4a7f4e-0x0;var _0x5829bd=_0xa2a0[_0x4a7f4e];return _0x5829bd;};'use strict';var _=require(_0x0a2a('0x0'));var util=require(_0x0a2a('0x1'));var moment=require('moment');var BPromise=require(_0x0a2a('0x2'));var rs=require(_0x0a2a('0x3'));var fs=require('fs');var Redis=require(_0x0a2a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a2a('0x5'));var logger=require(_0x0a2a('0x6'))(_0x0a2a('0x7'));var config=require(_0x0a2a('0x8'));var jayson=require(_0x0a2a('0x9'));var client=jayson[_0x0a2a('0xa')][_0x0a2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x505e01,_0xd20f9,_0x5704f8){return new BPromise(function(_0x180884,_0x2521e){return client['request'](_0x505e01,_0x5704f8)[_0x0a2a('0xc')](function(_0x3ebedf){logger[_0x0a2a('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xd20f9,'request\x20sent');logger[_0x0a2a('0xe')](_0x0a2a('0xf'),_0xd20f9,'request\x20sent',JSON[_0x0a2a('0x10')](_0x3ebedf));if(_0x3ebedf[_0x0a2a('0x11')]){if(_0x3ebedf['error'][_0x0a2a('0x12')]===0x1f4){logger[_0x0a2a('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0xd20f9,_0x3ebedf['error'][_0x0a2a('0x13')]);return _0x2521e(_0x3ebedf[_0x0a2a('0x11')]['message']);}logger[_0x0a2a('0x11')](_0x0a2a('0x14'),_0xd20f9,_0x3ebedf[_0x0a2a('0x11')][_0x0a2a('0x13')]);return _0x180884(_0x3ebedf[_0x0a2a('0x11')][_0x0a2a('0x13')]);}else{logger[_0x0a2a('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xd20f9,'request\x20sent');_0x180884(_0x3ebedf['result'][_0x0a2a('0x13')]);}})[_0x0a2a('0x15')](function(_0x193435){logger[_0x0a2a('0x11')](_0x0a2a('0x14'),_0xd20f9,_0x193435);_0x2521e(_0x193435);});});} \ No newline at end of file +var _0xea8f=['VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x300d32,_0x56023a){var _0x3f890f=function(_0x413838){while(--_0x413838){_0x300d32['push'](_0x300d32['shift']());}};_0x3f890f(++_0x56023a);}(_0xea8f,0x14f));var _0xfea8=function(_0x3e1130,_0x46aa43){_0x3e1130=_0x3e1130-0x0;var _0x4222ec=_0xea8f[_0x3e1130];return _0x4222ec;};'use strict';var _=require(_0xfea8('0x0'));var util=require(_0xfea8('0x1'));var moment=require(_0xfea8('0x2'));var BPromise=require(_0xfea8('0x3'));var rs=require(_0xfea8('0x4'));var fs=require('fs');var Redis=require(_0xfea8('0x5'));var db=require(_0xfea8('0x6'))['db'];var utils=require(_0xfea8('0x7'));var logger=require(_0xfea8('0x8'))(_0xfea8('0x9'));var config=require('../../config/environment');var jayson=require(_0xfea8('0xa'));var client=jayson[_0xfea8('0xb')][_0xfea8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e4162,_0x4607fa,_0x39a7b3){return new BPromise(function(_0x52e480,_0x5c2196){return client['request'](_0x1e4162,_0x39a7b3)[_0xfea8('0xd')](function(_0x116bc0){logger[_0xfea8('0xe')](_0xfea8('0xf'),_0x4607fa,'request\x20sent');logger[_0xfea8('0x10')](_0xfea8('0x11'),_0x4607fa,_0xfea8('0x12'),JSON[_0xfea8('0x13')](_0x116bc0));if(_0x116bc0[_0xfea8('0x14')]){if(_0x116bc0[_0xfea8('0x14')][_0xfea8('0x15')]===0x1f4){logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0x116bc0[_0xfea8('0x14')][_0xfea8('0x16')]);return _0x5c2196(_0x116bc0[_0xfea8('0x14')]['message']);}logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0x116bc0[_0xfea8('0x14')][_0xfea8('0x16')]);return _0x52e480(_0x116bc0['error'][_0xfea8('0x16')]);}else{logger[_0xfea8('0xe')](_0xfea8('0xf'),_0x4607fa,_0xfea8('0x12'));_0x52e480(_0x116bc0[_0xfea8('0x17')]['message']);}})[_0xfea8('0x18')](function(_0xc231f9){logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0xc231f9);_0x5c2196(_0xc231f9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4574327..0630e6e 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 _0x85f8=['post','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x397aec,_0x1a75eb){var _0x252c93=function(_0x5bc871){while(--_0x5bc871){_0x397aec['push'](_0x397aec['shift']());}};_0x252c93(++_0x1a75eb);}(_0x85f8,0xa6));var _0x885f=function(_0x5823ed,_0x4eb390){_0x5823ed=_0x5823ed-0x0;var _0x466939=_0x85f8[_0x5823ed];return _0x466939;};'use strict';var multer=require(_0x885f('0x0'));var util=require(_0x885f('0x1'));var path=require(_0x885f('0x2'));var timeout=require('connect-timeout');var express=require(_0x885f('0x3'));var router=express[_0x885f('0x4')]();var fs_extra=require(_0x885f('0x5'));var auth=require(_0x885f('0x6'));var interaction=require(_0x885f('0x7'));var config=require('../../config/environment');var controller=require(_0x885f('0x8'));router[_0x885f('0x9')]('/',auth[_0x885f('0xa')](),controller[_0x885f('0xb')]);router[_0x885f('0x9')](_0x885f('0xc'),auth[_0x885f('0xa')](),controller[_0x885f('0xd')]);router[_0x885f('0xe')]('/',auth[_0x885f('0xa')](),controller['create']);router[_0x885f('0xf')]('/:id',auth[_0x885f('0xa')](),controller[_0x885f('0x10')]);router[_0x885f('0x11')](_0x885f('0xc'),auth[_0x885f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa56f=['post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4b33be,_0x3b7d64){var _0x5992f1=function(_0x2825f3){while(--_0x2825f3){_0x4b33be['push'](_0x4b33be['shift']());}};_0x5992f1(++_0x3b7d64);}(_0xa56f,0x1a9));var _0xfa56=function(_0x3c7936,_0x4bf3ec){_0x3c7936=_0x3c7936-0x0;var _0x56df6c=_0xa56f[_0x3c7936];return _0x56df6c;};'use strict';var multer=require(_0xfa56('0x0'));var util=require(_0xfa56('0x1'));var path=require('path');var timeout=require(_0xfa56('0x2'));var express=require(_0xfa56('0x3'));var router=express[_0xfa56('0x4')]();var fs_extra=require(_0xfa56('0x5'));var auth=require(_0xfa56('0x6'));var interaction=require(_0xfa56('0x7'));var config=require(_0xfa56('0x8'));var controller=require(_0xfa56('0x9'));router['get']('/',auth[_0xfa56('0xa')](),controller[_0xfa56('0xb')]);router[_0xfa56('0xc')](_0xfa56('0xd'),auth[_0xfa56('0xa')](),controller[_0xfa56('0xe')]);router[_0xfa56('0xf')]('/',auth[_0xfa56('0xa')](),controller['create']);router[_0xfa56('0x10')](_0xfa56('0xd'),auth[_0xfa56('0xa')](),controller[_0xfa56('0x11')]);router[_0xfa56('0x12')]('/:id',auth[_0xfa56('0xa')](),controller['destroy']);module[_0xfa56('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a55077d..3aca292 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 _0x545b=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x3912cf,_0x297add){var _0x104e59=function(_0x32a693){while(--_0x32a693){_0x3912cf['push'](_0x3912cf['shift']());}};_0x104e59(++_0x297add);}(_0x545b,0x1bd));var _0xb545=function(_0x8fee0f,_0x118ab0){_0x8fee0f=_0x8fee0f-0x0;var _0xa5e569=_0x545b[_0x8fee0f];return _0xa5e569;};'use strict';var Sequelize=require(_0xb545('0x0'));module['exports']={'type':{'type':Sequelize[_0xb545('0x1')](_0xb545('0x2'),_0xb545('0x3'),_0xb545('0x4'),_0xb545('0x5'),_0xb545('0x6')),'defaultValue':_0xb545('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb545('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb545('0x2'),'variable',_0xb545('0x4'))},'keyContent':{'type':Sequelize[_0xb545('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb545('0x7')]},'customField':{'type':Sequelize[_0xb545('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb545('0x7')]}}; \ No newline at end of file +var _0x04c9=['exports','ENUM','variable','keyValue','STRING','string','customVariable','BOOLEAN','sequelize'];(function(_0x7a4a0d,_0x3c5633){var _0x36d06a=function(_0x370d51){while(--_0x370d51){_0x7a4a0d['push'](_0x7a4a0d['shift']());}};_0x36d06a(++_0x3c5633);}(_0x04c9,0xc5));var _0x904c=function(_0x4e114c,_0x4023d0){_0x4e114c=_0x4e114c-0x0;var _0x23e87b=_0x04c9[_0x4e114c];return _0x23e87b;};'use strict';var Sequelize=require(_0x904c('0x0'));module[_0x904c('0x1')]={'type':{'type':Sequelize[_0x904c('0x2')]('string',_0x904c('0x3'),'customVariable',_0x904c('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x904c('0x5')]},'key':{'type':Sequelize[_0x904c('0x5')]},'keyType':{'type':Sequelize[_0x904c('0x2')](_0x904c('0x6'),_0x904c('0x3'),_0x904c('0x7'))},'keyContent':{'type':Sequelize[_0x904c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x904c('0x5')]},'customField':{'type':Sequelize[_0x904c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x904c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5c3b79c..2484085 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 _0xa918=['options','find','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','VtigerField','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','catch','params'];(function(_0x309449,_0x5300fd){var _0x16b34a=function(_0x555df9){while(--_0x555df9){_0x309449['push'](_0x309449['shift']());}};_0x16b34a(++_0x5300fd);}(_0xa918,0x16b));var _0x8a91=function(_0x14715d,_0x22f1fa){_0x14715d=_0x14715d-0x0;var _0x3c721f=_0xa918[_0x14715d];return _0x3c721f;};'use strict';var emlformat=require(_0x8a91('0x0'));var rimraf=require(_0x8a91('0x1'));var zipdir=require(_0x8a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a91('0x3'));var moment=require('moment');var BPromise=require(_0x8a91('0x4'));var Mustache=require(_0x8a91('0x5'));var util=require('util');var path=require(_0x8a91('0x6'));var sox=require('sox');var csv=require(_0x8a91('0x7'));var ejs=require(_0x8a91('0x8'));var fs=require('fs');var fs_extra=require(_0x8a91('0x9'));var _=require(_0x8a91('0xa'));var squel=require('squel');var crypto=require(_0x8a91('0xb'));var jsforce=require(_0x8a91('0xc'));var deskjs=require(_0x8a91('0xd'));var toCsv=require(_0x8a91('0x7'));var querystring=require(_0x8a91('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a91('0xf'));var authService=require(_0x8a91('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a91('0x11'));var hardwareService=require(_0x8a91('0x12'));var logger=require(_0x8a91('0x13'))(_0x8a91('0x14'));var utils=require(_0x8a91('0x15'));var config=require(_0x8a91('0x16'));var licenseUtil=require(_0x8a91('0x17'));var db=require(_0x8a91('0x18'))['db'];function respondWithStatusCode(_0x1a2324,_0x3558f2){_0x3558f2=_0x3558f2||0xcc;return function(_0x46301d){if(_0x46301d){return _0x1a2324[_0x8a91('0x19')](_0x3558f2);}return _0x1a2324[_0x8a91('0x1a')](_0x3558f2)[_0x8a91('0x1b')]();};}function respondWithResult(_0x2918fb,_0xdef296){_0xdef296=_0xdef296||0xc8;return function(_0x1bccae){if(_0x1bccae){return _0x2918fb['status'](_0xdef296)[_0x8a91('0x1c')](_0x1bccae);}};}function respondWithFilteredResult(_0xb2191b,_0xb31068){return function(_0x385842){if(_0x385842){var _0x2d024a=typeof _0xb31068[_0x8a91('0x1d')]===_0x8a91('0x1e')&&typeof _0xb31068[_0x8a91('0x1f')]===_0x8a91('0x1e');var _0x1baa84=_0x385842['count'];var _0x375c68=_0x2d024a?0x0:_0xb31068[_0x8a91('0x1d')];var _0x3962f1=_0x2d024a?_0x385842[_0x8a91('0x20')]:_0xb31068[_0x8a91('0x1d')]+_0xb31068['limit'];var _0x45f47b;if(_0x3962f1>=_0x1baa84){_0x3962f1=_0x1baa84;_0x45f47b=0xc8;}else{_0x45f47b=0xce;}_0xb2191b[_0x8a91('0x1a')](_0x45f47b);return _0xb2191b[_0x8a91('0x21')](_0x8a91('0x22'),_0x375c68+'-'+_0x3962f1+'/'+_0x1baa84)[_0x8a91('0x1c')](_0x385842);}return null;};}function patchUpdates(_0x29ca4c){return function(_0x1f2404){try{jsonpatch[_0x8a91('0x23')](_0x1f2404,_0x29ca4c,!![]);}catch(_0x3b819f){return BPromise['reject'](_0x3b819f);}return _0x1f2404[_0x8a91('0x24')]();};}function saveUpdates(_0x425500,_0x2546ae){return function(_0x3b73e7){if(_0x3b73e7){return _0x3b73e7[_0x8a91('0x25')](_0x425500)['then'](function(_0x369594){return _0x369594;});}return null;};}function removeEntity(_0x475e65,_0x30c51b){return function(_0x1eac1e){if(_0x1eac1e){return _0x1eac1e[_0x8a91('0x26')]()[_0x8a91('0x27')](function(){_0x475e65[_0x8a91('0x1a')](0xcc)[_0x8a91('0x1b')]();});}};}function handleEntityNotFound(_0x1e9134,_0x4a87a7){return function(_0x54418d){if(!_0x54418d){_0x1e9134[_0x8a91('0x19')](0x194);}return _0x54418d;};}function handleError(_0x709ad,_0x265322){_0x265322=_0x265322||0x1f4;return function(_0x52145d){logger[_0x8a91('0x28')](_0x52145d['stack']);if(_0x52145d[_0x8a91('0x29')]){delete _0x52145d[_0x8a91('0x29')];}_0x709ad[_0x8a91('0x1a')](_0x265322)[_0x8a91('0x2a')](_0x52145d);};}exports[_0x8a91('0x2b')]=function(_0x182083,_0x3e261d){var _0x1ac01a={},_0x5ecf19={},_0x57e903={'count':0x0,'rows':[]};var _0xc875f3=_['map'](db[_0x8a91('0x2c')][_0x8a91('0x2d')],function(_0x555a95){return{'name':_0x555a95['fieldName'],'type':_0x555a95[_0x8a91('0x2e')]['key']};});_0x5ecf19[_0x8a91('0x2f')]=_[_0x8a91('0x30')](_0xc875f3,_0x8a91('0x29'));_0x5ecf19[_0x8a91('0x31')]=_[_0x8a91('0x32')](_0x182083['query']);_0x5ecf19['filters']=_[_0x8a91('0x33')](_0x5ecf19['model'],_0x5ecf19[_0x8a91('0x31')]);_0x1ac01a[_0x8a91('0x34')]=_[_0x8a91('0x33')](_0x5ecf19[_0x8a91('0x2f')],qs[_0x8a91('0x35')](_0x182083[_0x8a91('0x31')][_0x8a91('0x35')]));_0x1ac01a[_0x8a91('0x34')]=_0x1ac01a['attributes'][_0x8a91('0x36')]?_0x1ac01a['attributes']:_0x5ecf19[_0x8a91('0x2f')];if(!_0x182083[_0x8a91('0x31')][_0x8a91('0x37')](_0x8a91('0x38'))){_0x1ac01a['limit']=qs[_0x8a91('0x1f')](_0x182083['query'][_0x8a91('0x1f')]);_0x1ac01a['offset']=qs[_0x8a91('0x1d')](_0x182083['query'][_0x8a91('0x1d')]);}_0x1ac01a[_0x8a91('0x39')]=qs[_0x8a91('0x3a')](_0x182083[_0x8a91('0x31')][_0x8a91('0x3a')]);_0x1ac01a['where']=qs[_0x8a91('0x3b')](_[_0x8a91('0x3c')](_0x182083['query'],_0x5ecf19[_0x8a91('0x3b')]),_0xc875f3);if(_0x182083[_0x8a91('0x31')][_0x8a91('0x3d')]){_0x1ac01a[_0x8a91('0x3e')]=_[_0x8a91('0x3f')](_0x1ac01a[_0x8a91('0x3e')],{'$or':_[_0x8a91('0x30')](_0xc875f3,function(_0x507fe7){if(_0x507fe7[_0x8a91('0x2e')]!==_0x8a91('0x40')){var _0x5a2518={};_0x5a2518[_0x507fe7[_0x8a91('0x29')]]={'$like':'%'+_0x182083[_0x8a91('0x31')]['filter']+'%'};return _0x5a2518;}})});}_0x1ac01a=_[_0x8a91('0x3f')]({},_0x1ac01a,_0x182083['options']);var _0x27eecc={'where':_0x1ac01a[_0x8a91('0x3e')]};return db[_0x8a91('0x2c')][_0x8a91('0x20')](_0x27eecc)[_0x8a91('0x27')](function(_0x1c62c4){_0x57e903['count']=_0x1c62c4;if(_0x182083[_0x8a91('0x31')]['includeAll']){_0x1ac01a[_0x8a91('0x41')]=[{'all':!![]}];}return db[_0x8a91('0x2c')]['findAll'](_0x1ac01a);})[_0x8a91('0x27')](function(_0x128a71){_0x57e903[_0x8a91('0x42')]=_0x128a71;return _0x57e903;})[_0x8a91('0x27')](respondWithFilteredResult(_0x3e261d,_0x1ac01a))[_0x8a91('0x43')](handleError(_0x3e261d,null));};exports['show']=function(_0x2f5ae8,_0x4a0069){var _0x537941={'raw':!![],'where':{'id':_0x2f5ae8[_0x8a91('0x44')]['id']}},_0x19e9da={};_0x19e9da[_0x8a91('0x2f')]=_['keys'](db[_0x8a91('0x2c')][_0x8a91('0x2d')]);_0x19e9da[_0x8a91('0x31')]=_[_0x8a91('0x32')](_0x2f5ae8[_0x8a91('0x31')]);_0x19e9da['filters']=_[_0x8a91('0x33')](_0x19e9da[_0x8a91('0x2f')],_0x19e9da[_0x8a91('0x31')]);_0x537941['attributes']=_[_0x8a91('0x33')](_0x19e9da[_0x8a91('0x2f')],qs[_0x8a91('0x35')](_0x2f5ae8[_0x8a91('0x31')][_0x8a91('0x35')]));_0x537941[_0x8a91('0x34')]=_0x537941['attributes']['length']?_0x537941[_0x8a91('0x34')]:_0x19e9da[_0x8a91('0x2f')];if(_0x2f5ae8[_0x8a91('0x31')]['includeAll']){_0x537941['include']=[{'all':!![]}];}_0x537941=_[_0x8a91('0x3f')]({},_0x537941,_0x2f5ae8[_0x8a91('0x45')]);return db[_0x8a91('0x2c')][_0x8a91('0x46')](_0x537941)['then'](handleEntityNotFound(_0x4a0069,null))[_0x8a91('0x27')](respondWithResult(_0x4a0069,null))[_0x8a91('0x43')](handleError(_0x4a0069,null));};exports['create']=function(_0x1b8083,_0x18befe){return db['VtigerField']['create'](_0x1b8083[_0x8a91('0x47')],{})[_0x8a91('0x27')](respondWithResult(_0x18befe,0xc9))['catch'](handleError(_0x18befe,null));};exports[_0x8a91('0x25')]=function(_0xc66b91,_0x2db4dd){if(_0xc66b91[_0x8a91('0x47')]['id']){delete _0xc66b91['body']['id'];}return db[_0x8a91('0x2c')][_0x8a91('0x46')]({'where':{'id':_0xc66b91[_0x8a91('0x44')]['id']}})['then'](handleEntityNotFound(_0x2db4dd,null))[_0x8a91('0x27')](saveUpdates(_0xc66b91['body'],null))['then'](respondWithResult(_0x2db4dd,null))[_0x8a91('0x43')](handleError(_0x2db4dd,null));};exports[_0x8a91('0x26')]=function(_0x5cd221,_0x546414){return db['VtigerField'][_0x8a91('0x46')]({'where':{'id':_0x5cd221['params']['id']}})[_0x8a91('0x27')](handleEntityNotFound(_0x546414,null))[_0x8a91('0x27')](removeEntity(_0x546414,null))['catch'](handleError(_0x546414,null));}; \ No newline at end of file +var _0x6b3e=['destroy','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6b3e,0x199));var _0xe6b3=function(_0x22b0ce,_0xa756f7){_0x22b0ce=_0x22b0ce-0x0;var _0x40aa6f=_0x6b3e[_0x22b0ce];return _0x40aa6f;};'use strict';var emlformat=require(_0xe6b3('0x0'));var rimraf=require(_0xe6b3('0x1'));var zipdir=require(_0xe6b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6b3('0x3'));var BPromise=require(_0xe6b3('0x4'));var Mustache=require('mustache');var util=require(_0xe6b3('0x5'));var path=require(_0xe6b3('0x6'));var sox=require(_0xe6b3('0x7'));var csv=require('to-csv');var ejs=require(_0xe6b3('0x8'));var fs=require('fs');var fs_extra=require(_0xe6b3('0x9'));var _=require('lodash');var squel=require(_0xe6b3('0xa'));var crypto=require(_0xe6b3('0xb'));var jsforce=require(_0xe6b3('0xc'));var deskjs=require(_0xe6b3('0xd'));var toCsv=require(_0xe6b3('0xe'));var querystring=require(_0xe6b3('0xf'));var Papa=require(_0xe6b3('0x10'));var Redis=require('ioredis');var authService=require(_0xe6b3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe6b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe6b3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9950,_0x44d2cd){_0x44d2cd=_0x44d2cd||0xcc;return function(_0x3970b0){if(_0x3970b0){return _0x3d9950[_0xe6b3('0x14')](_0x44d2cd);}return _0x3d9950[_0xe6b3('0x15')](_0x44d2cd)[_0xe6b3('0x16')]();};}function respondWithResult(_0xdeca9b,_0x4c13a0){_0x4c13a0=_0x4c13a0||0xc8;return function(_0xe6a34e){if(_0xe6a34e){return _0xdeca9b[_0xe6b3('0x15')](_0x4c13a0)[_0xe6b3('0x17')](_0xe6a34e);}};}function respondWithFilteredResult(_0x27560c,_0x546227){return function(_0x3dd960){if(_0x3dd960){var _0x46952c=typeof _0x546227[_0xe6b3('0x18')]==='undefined'&&typeof _0x546227['limit']===_0xe6b3('0x19');var _0x33d0bd=_0x3dd960[_0xe6b3('0x1a')];var _0x4cc5a6=_0x46952c?0x0:_0x546227['offset'];var _0x26e944=_0x46952c?_0x3dd960[_0xe6b3('0x1a')]:_0x546227[_0xe6b3('0x18')]+_0x546227[_0xe6b3('0x1b')];var _0x18becb;if(_0x26e944>=_0x33d0bd){_0x26e944=_0x33d0bd;_0x18becb=0xc8;}else{_0x18becb=0xce;}_0x27560c[_0xe6b3('0x15')](_0x18becb);return _0x27560c[_0xe6b3('0x1c')]('Content-Range',_0x4cc5a6+'-'+_0x26e944+'/'+_0x33d0bd)[_0xe6b3('0x17')](_0x3dd960);}return null;};}function patchUpdates(_0xe1cc3a){return function(_0xd63729){try{jsonpatch[_0xe6b3('0x1d')](_0xd63729,_0xe1cc3a,!![]);}catch(_0xc9cb5c){return BPromise['reject'](_0xc9cb5c);}return _0xd63729[_0xe6b3('0x1e')]();};}function saveUpdates(_0x326c00,_0x2e637c){return function(_0x5d4c12){if(_0x5d4c12){return _0x5d4c12[_0xe6b3('0x1f')](_0x326c00)[_0xe6b3('0x20')](function(_0x4c7b35){return _0x4c7b35;});}return null;};}function removeEntity(_0x8132b0,_0x4bb8c2){return function(_0x1fecf0){if(_0x1fecf0){return _0x1fecf0['destroy']()['then'](function(){_0x8132b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x261573,_0xb44607){return function(_0x598c9c){if(!_0x598c9c){_0x261573[_0xe6b3('0x14')](0x194);}return _0x598c9c;};}function handleError(_0x37c925,_0x3b4359){_0x3b4359=_0x3b4359||0x1f4;return function(_0x42f410){logger['error'](_0x42f410['stack']);if(_0x42f410[_0xe6b3('0x21')]){delete _0x42f410[_0xe6b3('0x21')];}_0x37c925[_0xe6b3('0x15')](_0x3b4359)[_0xe6b3('0x22')](_0x42f410);};}exports[_0xe6b3('0x23')]=function(_0x5209ab,_0x5cfc28){var _0xbeef7c={},_0xa8a699={},_0x21575d={'count':0x0,'rows':[]};var _0x568886=_[_0xe6b3('0x24')](db[_0xe6b3('0x25')]['rawAttributes'],function(_0x4aa3be){return{'name':_0x4aa3be[_0xe6b3('0x26')],'type':_0x4aa3be[_0xe6b3('0x27')][_0xe6b3('0x28')]};});_0xa8a699[_0xe6b3('0x29')]=_[_0xe6b3('0x24')](_0x568886,'name');_0xa8a699[_0xe6b3('0x2a')]=_[_0xe6b3('0x2b')](_0x5209ab[_0xe6b3('0x2a')]);_0xa8a699['filters']=_[_0xe6b3('0x2c')](_0xa8a699[_0xe6b3('0x29')],_0xa8a699[_0xe6b3('0x2a')]);_0xbeef7c[_0xe6b3('0x2d')]=_['intersection'](_0xa8a699[_0xe6b3('0x29')],qs['fields'](_0x5209ab['query'][_0xe6b3('0x2e')]));_0xbeef7c[_0xe6b3('0x2d')]=_0xbeef7c[_0xe6b3('0x2d')]['length']?_0xbeef7c[_0xe6b3('0x2d')]:_0xa8a699[_0xe6b3('0x29')];if(!_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x2f')]('nolimit')){_0xbeef7c['limit']=qs[_0xe6b3('0x1b')](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x1b')]);_0xbeef7c[_0xe6b3('0x18')]=qs[_0xe6b3('0x18')](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x18')]);}_0xbeef7c['order']=qs['sort'](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x30')]);_0xbeef7c['where']=qs['filters'](_['pick'](_0x5209ab[_0xe6b3('0x2a')],_0xa8a699[_0xe6b3('0x31')]),_0x568886);if(_0x5209ab['query'][_0xe6b3('0x32')]){_0xbeef7c[_0xe6b3('0x33')]=_[_0xe6b3('0x34')](_0xbeef7c[_0xe6b3('0x33')],{'$or':_[_0xe6b3('0x24')](_0x568886,function(_0x360053){if(_0x360053['type']!==_0xe6b3('0x35')){var _0x2033d4={};_0x2033d4[_0x360053[_0xe6b3('0x21')]]={'$like':'%'+_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x32')]+'%'};return _0x2033d4;}})});}_0xbeef7c=_[_0xe6b3('0x34')]({},_0xbeef7c,_0x5209ab[_0xe6b3('0x36')]);var _0x438eae={'where':_0xbeef7c[_0xe6b3('0x33')]};return db[_0xe6b3('0x25')][_0xe6b3('0x1a')](_0x438eae)[_0xe6b3('0x20')](function(_0x445769){_0x21575d[_0xe6b3('0x1a')]=_0x445769;if(_0x5209ab['query'][_0xe6b3('0x37')]){_0xbeef7c[_0xe6b3('0x38')]=[{'all':!![]}];}return db[_0xe6b3('0x25')][_0xe6b3('0x39')](_0xbeef7c);})[_0xe6b3('0x20')](function(_0xbbc0a0){_0x21575d[_0xe6b3('0x3a')]=_0xbbc0a0;return _0x21575d;})[_0xe6b3('0x20')](respondWithFilteredResult(_0x5cfc28,_0xbeef7c))[_0xe6b3('0x3b')](handleError(_0x5cfc28,null));};exports[_0xe6b3('0x3c')]=function(_0x51887c,_0x468acf){var _0x37839b={'raw':!![],'where':{'id':_0x51887c[_0xe6b3('0x3d')]['id']}},_0x558acc={};_0x558acc[_0xe6b3('0x29')]=_[_0xe6b3('0x2b')](db[_0xe6b3('0x25')][_0xe6b3('0x3e')]);_0x558acc[_0xe6b3('0x2a')]=_[_0xe6b3('0x2b')](_0x51887c[_0xe6b3('0x2a')]);_0x558acc['filters']=_[_0xe6b3('0x2c')](_0x558acc['model'],_0x558acc[_0xe6b3('0x2a')]);_0x37839b[_0xe6b3('0x2d')]=_[_0xe6b3('0x2c')](_0x558acc[_0xe6b3('0x29')],qs[_0xe6b3('0x2e')](_0x51887c[_0xe6b3('0x2a')][_0xe6b3('0x2e')]));_0x37839b[_0xe6b3('0x2d')]=_0x37839b[_0xe6b3('0x2d')][_0xe6b3('0x3f')]?_0x37839b[_0xe6b3('0x2d')]:_0x558acc[_0xe6b3('0x29')];if(_0x51887c[_0xe6b3('0x2a')][_0xe6b3('0x37')]){_0x37839b['include']=[{'all':!![]}];}_0x37839b=_['merge']({},_0x37839b,_0x51887c[_0xe6b3('0x36')]);return db[_0xe6b3('0x25')][_0xe6b3('0x40')](_0x37839b)[_0xe6b3('0x20')](handleEntityNotFound(_0x468acf,null))[_0xe6b3('0x20')](respondWithResult(_0x468acf,null))[_0xe6b3('0x3b')](handleError(_0x468acf,null));};exports[_0xe6b3('0x41')]=function(_0x34b691,_0x509cd1){return db[_0xe6b3('0x25')]['create'](_0x34b691[_0xe6b3('0x42')],{})[_0xe6b3('0x20')](respondWithResult(_0x509cd1,0xc9))[_0xe6b3('0x3b')](handleError(_0x509cd1,null));};exports['update']=function(_0x265691,_0x152fae){if(_0x265691[_0xe6b3('0x42')]['id']){delete _0x265691['body']['id'];}return db[_0xe6b3('0x25')][_0xe6b3('0x40')]({'where':{'id':_0x265691['params']['id']}})[_0xe6b3('0x20')](handleEntityNotFound(_0x152fae,null))[_0xe6b3('0x20')](saveUpdates(_0x265691[_0xe6b3('0x42')],null))[_0xe6b3('0x20')](respondWithResult(_0x152fae,null))[_0xe6b3('0x3b')](handleError(_0x152fae,null));};exports[_0xe6b3('0x43')]=function(_0x4d17aa,_0x48c120){return db['VtigerField'][_0xe6b3('0x40')]({'where':{'id':_0x4d17aa[_0xe6b3('0x3d')]['id']}})[_0xe6b3('0x20')](handleEntityNotFound(_0x48c120,null))['then'](removeEntity(_0x48c120,null))[_0xe6b3('0x3b')](handleError(_0x48c120,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 094b985..55bb5ff 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 _0xd16c=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x12a32a,_0x200871){var _0x45c462=function(_0x49f34d){while(--_0x49f34d){_0x12a32a['push'](_0x12a32a['shift']());}};_0x45c462(++_0x200871);}(_0xd16c,0xfc));var _0xcd16=function(_0x44d186,_0x3972f1){_0x44d186=_0x44d186-0x0;var _0x30049e=_0xd16c[_0x44d186];return _0x30049e;};'use strict';var _=require(_0xcd16('0x0'));var util=require(_0xcd16('0x1'));var logger=require(_0xcd16('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcd16('0x3'));var rp=require(_0xcd16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd16('0x5'));var config=require(_0xcd16('0x6'));var attributes=require(_0xcd16('0x7'));module[_0xcd16('0x8')]=function(_0x2066e3,_0x473c32){return _0x2066e3[_0xcd16('0x9')](_0xcd16('0xa'),attributes,{'tableName':_0xcd16('0xb'),'paranoid':![],'indexes':[{'name':_0xcd16('0xc'),'fields':[_0xcd16('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f1=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x8d9fd,_0x205365){var _0x29bb46=function(_0x46c4b2){while(--_0x46c4b2){_0x8d9fd['push'](_0x8d9fd['shift']());}};_0x29bb46(++_0x205365);}(_0xd4f1,0xf0));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d4f('0x0'));var util=require(_0x1d4f('0x1'));var logger=require(_0x1d4f('0x2'))(_0x1d4f('0x3'));var moment=require(_0x1d4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4f('0x5'));var fs=require('fs');var path=require(_0x1d4f('0x6'));var rimraf=require(_0x1d4f('0x7'));var config=require('../../config/environment');var attributes=require(_0x1d4f('0x8'));module[_0x1d4f('0x9')]=function(_0x1a2986,_0x41b925){return _0x1a2986[_0x1d4f('0xa')](_0x1d4f('0xb'),attributes,{'tableName':_0x1d4f('0xc'),'paranoid':![],'indexes':[{'name':_0x1d4f('0xd'),'fields':[_0x1d4f('0xe'),_0x1d4f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index d80f4d4..beefd44 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 _0x64ea=['../../mysqldb','rpc','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3446ff,_0x2946d1){var _0x4fec7b=function(_0x2c228d){while(--_0x2c228d){_0x3446ff['push'](_0x3446ff['shift']());}};_0x4fec7b(++_0x2946d1);}(_0x64ea,0x127));var _0xa64e=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x64ea[_0x1fd5eb];return _0x102365;};'use strict';var _=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var moment=require(_0xa64e('0x2'));var BPromise=require(_0xa64e('0x3'));var rs=require(_0xa64e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa64e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa64e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa64e('0x7')][_0xa64e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd64c6f,_0x534916,_0x5cf6d7){return new BPromise(function(_0x149332,_0x33b1ab){return client['request'](_0xd64c6f,_0x5cf6d7)[_0xa64e('0x9')](function(_0xb3c32a){logger[_0xa64e('0xa')](_0xa64e('0xb'),_0x534916,_0xa64e('0xc'));logger[_0xa64e('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x534916,_0xa64e('0xc'),JSON[_0xa64e('0xe')](_0xb3c32a));if(_0xb3c32a['error']){if(_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x10')]===0x1f4){logger[_0xa64e('0xf')](_0xa64e('0xb'),_0x534916,_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x11')]);return _0x33b1ab(_0xb3c32a['error'][_0xa64e('0x11')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x534916,_0xb3c32a['error']['message']);return _0x149332(_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x11')]);}else{logger[_0xa64e('0xa')](_0xa64e('0xb'),_0x534916,_0xa64e('0xc'));_0x149332(_0xb3c32a[_0xa64e('0x12')][_0xa64e('0x11')]);}})[_0xa64e('0x13')](function(_0x578043){logger['error']('VtigerField,\x20%s,\x20%s',_0x534916,_0x578043);_0x33b1ab(_0x578043);});});} \ No newline at end of file +var _0x23d7=['rpc','../../config/environment','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x23d7,0x1dc));var _0x723d=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x23d7[_0x57408b];return _0x31a897;};'use strict';var _=require(_0x723d('0x0'));var util=require(_0x723d('0x1'));var moment=require(_0x723d('0x2'));var BPromise=require('bluebird');var rs=require(_0x723d('0x3'));var fs=require('fs');var Redis=require(_0x723d('0x4'));var db=require(_0x723d('0x5'))['db'];var utils=require(_0x723d('0x6'));var logger=require(_0x723d('0x7'))(_0x723d('0x8'));var config=require(_0x723d('0x9'));var jayson=require(_0x723d('0xa'));var client=jayson[_0x723d('0xb')][_0x723d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15b654,_0x4f7416,_0x3dd0b1){return new BPromise(function(_0x83b603,_0x44f6f2){return client['request'](_0x15b654,_0x3dd0b1)['then'](function(_0x1e5052){logger[_0x723d('0xd')](_0x723d('0xe'),_0x4f7416,_0x723d('0xf'));logger[_0x723d('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4f7416,_0x723d('0xf'),JSON[_0x723d('0x11')](_0x1e5052));if(_0x1e5052[_0x723d('0x12')]){if(_0x1e5052[_0x723d('0x12')]['code']===0x1f4){logger[_0x723d('0x12')]('VtigerField,\x20%s,\x20%s',_0x4f7416,_0x1e5052[_0x723d('0x12')]['message']);return _0x44f6f2(_0x1e5052['error'][_0x723d('0x13')]);}logger[_0x723d('0x12')]('VtigerField,\x20%s,\x20%s',_0x4f7416,_0x1e5052[_0x723d('0x12')][_0x723d('0x13')]);return _0x83b603(_0x1e5052[_0x723d('0x12')][_0x723d('0x13')]);}else{logger[_0x723d('0xd')](_0x723d('0xe'),_0x4f7416,_0x723d('0xf'));_0x83b603(_0x1e5052[_0x723d('0x14')][_0x723d('0x13')]);}})[_0x723d('0x15')](function(_0x2b9b54){logger['error'](_0x723d('0xe'),_0x4f7416,_0x2b9b54);_0x44f6f2(_0x2b9b54);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2ec7ed6..5e2d155 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 _0x5941=['Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','addConfiguration','/:id','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x32f71d,_0x4983b2){var _0x1da964=function(_0x5d0073){while(--_0x5d0073){_0x32f71d['push'](_0x32f71d['shift']());}};_0x1da964(++_0x4983b2);}(_0x5941,0x74));var _0x1594=function(_0x19e13e,_0x385d47){_0x19e13e=_0x19e13e-0x0;var _0x3f1e27=_0x5941[_0x19e13e];return _0x3f1e27;};'use strict';var multer=require(_0x1594('0x0'));var util=require(_0x1594('0x1'));var path=require('path');var timeout=require(_0x1594('0x2'));var express=require(_0x1594('0x3'));var router=express[_0x1594('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1594('0x5'));var interaction=require(_0x1594('0x6'));var config=require('../../config/environment');var controller=require(_0x1594('0x7'));router[_0x1594('0x8')]('/',auth['isAuthenticated'](),controller[_0x1594('0x9')]);router[_0x1594('0x8')]('/:id',auth[_0x1594('0xa')](),controller[_0x1594('0xb')]);router[_0x1594('0x8')](_0x1594('0xc'),auth[_0x1594('0xa')](),controller['getConfigurations']);router[_0x1594('0x8')](_0x1594('0xd'),auth[_0x1594('0xa')](),controller['getFields']);router[_0x1594('0xe')]('/',auth[_0x1594('0xa')](),controller['create']);router[_0x1594('0xe')](_0x1594('0xc'),auth[_0x1594('0xa')](),controller[_0x1594('0xf')]);router['put'](_0x1594('0x10'),auth[_0x1594('0xa')](),controller[_0x1594('0x11')]);router['delete'](_0x1594('0x10'),auth[_0x1594('0xa')](),controller[_0x1594('0x12')]);module[_0x1594('0x13')]=router; \ No newline at end of file +var _0xc96a=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','getConfigurations','getFields','create','post','put','/:id','update','destroy','exports'];(function(_0x5676dd,_0x57febd){var _0x4c711b=function(_0x577161){while(--_0x577161){_0x5676dd['push'](_0x5676dd['shift']());}};_0x4c711b(++_0x57febd);}(_0xc96a,0x14a));var _0xac96=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc96a[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xac96('0x0'));var util=require(_0xac96('0x1'));var path=require(_0xac96('0x2'));var timeout=require(_0xac96('0x3'));var express=require(_0xac96('0x4'));var router=express['Router']();var fs_extra=require(_0xac96('0x5'));var auth=require(_0xac96('0x6'));var interaction=require(_0xac96('0x7'));var config=require(_0xac96('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xac96('0x9')]('/',auth['isAuthenticated'](),controller[_0xac96('0xa')]);router[_0xac96('0x9')]('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0xc')]);router[_0xac96('0x9')]('/:id/configurations',auth[_0xac96('0xb')](),controller[_0xac96('0xd')]);router['get']('/:id/fields',auth[_0xac96('0xb')](),controller[_0xac96('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac96('0xf')]);router[_0xac96('0x10')]('/:id/configurations',auth[_0xac96('0xb')](),controller['addConfiguration']);router[_0xac96('0x11')](_0xac96('0x12'),auth[_0xac96('0xb')](),controller[_0xac96('0x13')]);router['delete']('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0x14')]);module[_0xac96('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ead0229..7f29b07 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 _0x5b47=['sequelize','exports','STRING','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x580005,_0x55e402){var _0x12defc=function(_0xb57f09){while(--_0xb57f09){_0x580005['push'](_0x580005['shift']());}};_0x12defc(++_0x55e402);}(_0x5b47,0x120));var _0x75b4=function(_0x4d2640,_0x5cfde3){_0x4d2640=_0x4d2640-0x0;var _0x3c6716=_0x5b47[_0x4d2640];return _0x3c6716;};'use strict';var Sequelize=require(_0x75b4('0x0'));module[_0x75b4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x75b4('0x2')]},'remoteUri':{'type':Sequelize[_0x75b4('0x2')],'unique':_0x75b4('0x3')},'authType':{'type':Sequelize[_0x75b4('0x4')](_0x75b4('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x75b4('0x4')]('integrationTab',_0x75b4('0x6')),'defaultValue':_0x75b4('0x7')}}; \ No newline at end of file +var _0x524e=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x412f5b,_0x259457){var _0x46ca14=function(_0x4cd676){while(--_0x4cd676){_0x412f5b['push'](_0x412f5b['shift']());}};_0x46ca14(++_0x259457);}(_0x524e,0x15e));var _0xe524=function(_0x18a792,_0xfb7505){_0x18a792=_0x18a792-0x0;var _0x26f877=_0x524e[_0x18a792];return _0x26f877;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'password':{'type':Sequelize[_0xe524('0x0')]},'token':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'authType':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4'),'token'),'defaultValue':_0xe524('0x4')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x3')]('integrationTab',_0xe524('0x5')),'defaultValue':_0xe524('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 014c673..8bcb6ad 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 _0x757a=['rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x757a,0xde));var _0xa757=function(_0x2e8cc3,_0x54657f){_0x2e8cc3=_0x2e8cc3-0x0;var _0x3072d7=_0x757a[_0x2e8cc3];return _0x3072d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x421040,_0x544b45){_0x544b45=_0x544b45||0xcc;return function(_0x564187){if(_0x564187){return _0x421040[_0xa757('0x15')](_0x544b45);}return _0x421040['status'](_0x544b45)['end']();};}function respondWithResult(_0x32112b,_0x1b670e){_0x1b670e=_0x1b670e||0xc8;return function(_0x355f0a){if(_0x355f0a){return _0x32112b[_0xa757('0x16')](_0x1b670e)[_0xa757('0x17')](_0x355f0a);}};}function respondWithFilteredResult(_0x31cfd2,_0xf12b68){return function(_0x2f7947){if(_0x2f7947){var _0x185011=typeof _0xf12b68[_0xa757('0x18')]==='undefined'&&typeof _0xf12b68[_0xa757('0x19')]===_0xa757('0x1a');var _0xde8248=_0x2f7947['count'];var _0x54b305=_0x185011?0x0:_0xf12b68[_0xa757('0x18')];var _0x468d45=_0x185011?_0x2f7947[_0xa757('0x1b')]:_0xf12b68[_0xa757('0x18')]+_0xf12b68[_0xa757('0x19')];var _0xe2d567;if(_0x468d45>=_0xde8248){_0x468d45=_0xde8248;_0xe2d567=0xc8;}else{_0xe2d567=0xce;}_0x31cfd2['status'](_0xe2d567);return _0x31cfd2[_0xa757('0x1c')]('Content-Range',_0x54b305+'-'+_0x468d45+'/'+_0xde8248)[_0xa757('0x17')](_0x2f7947);}return null;};}function patchUpdates(_0x167640){return function(_0x14014c){try{jsonpatch[_0xa757('0x1d')](_0x14014c,_0x167640,!![]);}catch(_0x4d598c){return BPromise['reject'](_0x4d598c);}return _0x14014c[_0xa757('0x1e')]();};}function saveUpdates(_0x2159cf,_0x2ba923){return function(_0x8d121f){if(_0x8d121f){return _0x8d121f[_0xa757('0x1f')](_0x2159cf)[_0xa757('0x20')](function(_0x2ca10d){return _0x2ca10d;});}return null;};}function removeEntity(_0x21f1af,_0x2bf276){return function(_0x59fae6){if(_0x59fae6){return _0x59fae6[_0xa757('0x21')]()['then'](function(){_0x21f1af[_0xa757('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(!_0x37c7e6){_0x40551d['sendStatus'](0x194);}return _0x37c7e6;};}function handleError(_0x2b19d5,_0xcd98bd){_0xcd98bd=_0xcd98bd||0x1f4;return function(_0x471e84){logger[_0xa757('0x22')](_0x471e84['stack']);if(_0x471e84[_0xa757('0x23')]){delete _0x471e84['name'];}_0x2b19d5['status'](_0xcd98bd)['send'](_0x471e84);};}exports['index']=function(_0xfdf69d,_0x596ae2){var _0x2208f9={},_0x3bc24c={},_0x55c5f8={'count':0x0,'rows':[]};var _0x2a0c9a=_['map'](db[_0xa757('0x24')][_0xa757('0x25')],function(_0x5307c3){return{'name':_0x5307c3[_0xa757('0x26')],'type':_0x5307c3['type'][_0xa757('0x27')]};});_0x3bc24c[_0xa757('0x28')]=_[_0xa757('0x29')](_0x2a0c9a,_0xa757('0x23'));_0x3bc24c[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0xfdf69d[_0xa757('0x2a')]);_0x3bc24c[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],_0x3bc24c[_0xa757('0x2a')]);_0x2208f9[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],qs[_0xa757('0x2f')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x2f')]));_0x2208f9[_0xa757('0x2e')]=_0x2208f9[_0xa757('0x2e')][_0xa757('0x30')]?_0x2208f9[_0xa757('0x2e')]:_0x3bc24c[_0xa757('0x28')];if(!_0xfdf69d[_0xa757('0x2a')][_0xa757('0x31')]('nolimit')){_0x2208f9[_0xa757('0x19')]=qs[_0xa757('0x19')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x19')]);_0x2208f9[_0xa757('0x18')]=qs['offset'](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x18')]);}_0x2208f9[_0xa757('0x32')]=qs[_0xa757('0x33')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x33')]);_0x2208f9['where']=qs[_0xa757('0x2c')](_[_0xa757('0x34')](_0xfdf69d[_0xa757('0x2a')],_0x3bc24c[_0xa757('0x2c')]),_0x2a0c9a);if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x35')]){_0x2208f9[_0xa757('0x36')]=_[_0xa757('0x37')](_0x2208f9[_0xa757('0x36')],{'$or':_['map'](_0x2a0c9a,function(_0x300be4){if(_0x300be4[_0xa757('0x38')]!==_0xa757('0x39')){var _0x35c15a={};_0x35c15a[_0x300be4[_0xa757('0x23')]]={'$like':'%'+_0xfdf69d[_0xa757('0x2a')]['filter']+'%'};return _0x35c15a;}})});}_0x2208f9=_[_0xa757('0x37')]({},_0x2208f9,_0xfdf69d[_0xa757('0x3a')]);var _0x48cde9={'where':_0x2208f9['where']};return db[_0xa757('0x24')][_0xa757('0x1b')](_0x48cde9)['then'](function(_0x51c3d1){_0x55c5f8[_0xa757('0x1b')]=_0x51c3d1;if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x3b')]){_0x2208f9['include']=[{'all':!![]}];}return db[_0xa757('0x24')][_0xa757('0x3c')](_0x2208f9);})[_0xa757('0x20')](function(_0x1ba399){_0x55c5f8[_0xa757('0x3d')]=_0x1ba399;return _0x55c5f8;})['then'](respondWithFilteredResult(_0x596ae2,_0x2208f9))[_0xa757('0x3e')](handleError(_0x596ae2,null));};exports['show']=function(_0x564d40,_0x43329c){var _0x57298b={'raw':![],'where':{'id':_0x564d40[_0xa757('0x3f')]['id']}},_0x373747={};_0x373747[_0xa757('0x28')]=_['keys'](db['ZendeskAccount'][_0xa757('0x25')]);_0x373747[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x564d40[_0xa757('0x2a')]);_0x373747[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x373747['model'],_0x373747[_0xa757('0x2a')]);_0x57298b[_0xa757('0x2e')]=_['intersection'](_0x373747[_0xa757('0x28')],qs['fields'](_0x564d40[_0xa757('0x2a')][_0xa757('0x2f')]));_0x57298b['attributes']=_0x57298b[_0xa757('0x2e')][_0xa757('0x30')]?_0x57298b['attributes']:_0x373747[_0xa757('0x28')];if(_0x564d40[_0xa757('0x2a')][_0xa757('0x3b')]){_0x57298b[_0xa757('0x40')]=[{'all':!![]}];}_0x57298b=_['merge']({},_0x57298b,_0x564d40[_0xa757('0x3a')]);return db[_0xa757('0x24')][_0xa757('0x41')](_0x57298b)[_0xa757('0x20')](handleEntityNotFound(_0x43329c,null))['then'](respondWithResult(_0x43329c,null))[_0xa757('0x3e')](handleError(_0x43329c,null));};exports['create']=function(_0x50c131,_0x2acf88){return db[_0xa757('0x24')][_0xa757('0x42')](_0x50c131['body'],{})[_0xa757('0x20')](respondWithResult(_0x2acf88,0xc9))['catch'](handleError(_0x2acf88,null));};exports[_0xa757('0x1f')]=function(_0x151cc3,_0x265793){if(_0x151cc3[_0xa757('0x43')]['id']){delete _0x151cc3[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x151cc3[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265793,null))[_0xa757('0x20')](saveUpdates(_0x151cc3[_0xa757('0x43')],null))[_0xa757('0x20')](respondWithResult(_0x265793,null))[_0xa757('0x3e')](handleError(_0x265793,null));};exports[_0xa757('0x21')]=function(_0x1f10cf,_0x15bad7){return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x1f10cf[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x15bad7,null))[_0xa757('0x20')](removeEntity(_0x15bad7,null))[_0xa757('0x3e')](handleError(_0x15bad7,null));};exports[_0xa757('0x44')]=function(_0x388573,_0x23caca,_0x492e7e){var _0x3b5116={};var _0x51157e={};var _0x48af6e;var _0x311c25;return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x388573['params']['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x23caca,null))[_0xa757('0x20')](function(_0x8614f9){if(_0x8614f9){_0x48af6e=_0x8614f9;_0x51157e[_0xa757('0x28')]=_['keys'](db[_0xa757('0x46')][_0xa757('0x25')]);_0x51157e[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x388573[_0xa757('0x2a')]);_0x51157e[_0xa757('0x2c')]=_['intersection'](_0x51157e['model'],_0x51157e['query']);_0x3b5116['attributes']=_[_0xa757('0x2d')](_0x51157e[_0xa757('0x28')],qs[_0xa757('0x2f')](_0x388573[_0xa757('0x2a')][_0xa757('0x2f')]));_0x3b5116[_0xa757('0x2e')]=_0x3b5116['attributes'][_0xa757('0x30')]?_0x3b5116[_0xa757('0x2e')]:_0x51157e[_0xa757('0x28')];_0x3b5116[_0xa757('0x32')]=qs['sort'](_0x388573[_0xa757('0x2a')][_0xa757('0x33')]);_0x3b5116['where']=qs[_0xa757('0x2c')](_['pick'](_0x388573[_0xa757('0x2a')],_0x51157e['filters']));if(_0x388573[_0xa757('0x2a')]['filter']){_0x3b5116['where']=_[_0xa757('0x37')](_0x3b5116[_0xa757('0x36')],{'$or':_[_0xa757('0x29')](_0x3b5116[_0xa757('0x2e')],function(_0x14e226){var _0xc5ae37={};_0xc5ae37[_0x14e226]={'$like':'%'+_0x388573['query']['filter']+'%'};return _0xc5ae37;})});}_0x3b5116=_[_0xa757('0x37')]({},_0x3b5116,_0x388573[_0xa757('0x3a')]);return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})['then'](function(_0x55a7d2){if(_0x55a7d2){_0x311c25=_0x55a7d2[_0xa757('0x30')];if(!_0x388573[_0xa757('0x2a')][_0xa757('0x31')](_0xa757('0x47'))){_0x3b5116[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x388573['query'][_0xa757('0x19')]);_0x3b5116[_0xa757('0x18')]=qs[_0xa757('0x18')](_0x388573[_0xa757('0x2a')][_0xa757('0x18')]);}return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})[_0xa757('0x20')](function(_0x13dd81){if(_0x13dd81){return _0x13dd81?{'count':_0x311c25,'rows':_0x13dd81}:null;}})[_0xa757('0x20')](respondWithResult(_0x23caca,null))[_0xa757('0x3e')](handleError(_0x23caca,null));};exports['addConfiguration']=function(_0x9e96e6,_0x5c803a,_0x5851fd){if(_0x9e96e6[_0xa757('0x43')]['id']){delete _0x9e96e6[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x9e96e6[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x20')](function(_0x32e0b9){if(_0x32e0b9){_0x9e96e6[_0xa757('0x43')][_0xa757('0x48')]=_0x32e0b9['id'];_0x9e96e6[_0xa757('0x43')]['Subjects']=integrations[_0xa757('0x49')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')][_0xa757('0x38')]);_0x9e96e6[_0xa757('0x43')][_0xa757('0x4a')]=integrations[_0xa757('0x4b')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')]['type']);return db[_0xa757('0x46')][_0xa757('0x42')](_0x9e96e6[_0xa757('0x43')],{'include':[{'model':db[_0xa757('0x4c')],'as':_0xa757('0x4d')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xa757('0x20')](respondWithResult(_0x5c803a,null))[_0xa757('0x3e')](handleError(_0x5c803a,null));};exports[_0xa757('0x4e')]=function(_0x5f450f,_0x115a94,_0x55bc0f){var _0x34982a='';return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x5f450f[_0xa757('0x3f')]['id']},'attributes':['id',_0xa757('0x4f'),_0xa757('0x50'),'token',_0xa757('0x51'),_0xa757('0x52')]})[_0xa757('0x20')](handleEntityNotFound(_0x115a94,null))[_0xa757('0x20')](function(_0x1c35bc){if(_0x1c35bc){_0x34982a=_0x1c35bc['remoteUri'];var _0x2586f9=_0x34982a[_0xa757('0x53')](-0x1);if(_0x2586f9==='/'){_0x34982a=_0x34982a[_0xa757('0x54')](0x0,_0x34982a[_0xa757('0x55')](_0x2586f9));}var _0x43cc0a={'method':'GET','uri':util[_0xa757('0x56')](_0xa757('0x57'),_0x34982a,_0xa757('0x58')),'json':!![]};switch(_0x1c35bc['authType']){case _0xa757('0x50'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util[_0xa757('0x56')](_0xa757('0x5b'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc[_0xa757('0x50')]))[_0xa757('0x5c')](_0xa757('0x5d')))};break;case _0xa757('0x5e'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util['format'](_0xa757('0x5f'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc['token']))[_0xa757('0x5c')](_0xa757('0x5d')))};break;default:throw new db['Sequelize'][(_0xa757('0x60'))](_0xa757('0x61'));}return rp(_0x43cc0a);}})[_0xa757('0x20')](function(_0x2e1198){if(_0x2e1198){var _0x3a00ef=[_0xa757('0x62'),_0xa757('0x63'),_0xa757('0x64'),_0xa757('0x65')];_[_0xa757('0x66')](_0x2e1198[_0xa757('0x58')],function(_0x189195){return _0x3a00ef[_0xa757('0x67')](_0x189195[_0xa757('0x38')]);});return{'count':_0x2e1198[_0xa757('0x58')][_0xa757('0x30')],'rows':_['map'](_0x2e1198[_0xa757('0x58')],function(_0x56ba75){return{'id':_0x56ba75['id'],'name':_0x56ba75[_0xa757('0x68')]>0x7?_0x56ba75[_0xa757('0x69')]:_0x56ba75[_0xa757('0x38')],'custom':_0x56ba75[_0xa757('0x68')]>0x7?!![]:![],'options':_0x56ba75[_0xa757('0x6a')]?_0x56ba75['system_field_options']:_0x56ba75[_0xa757('0x6b')]?_0x56ba75[_0xa757('0x6b')]:[]};})};}})[_0xa757('0x20')](respondWithResult(_0x115a94,null))['catch'](function(_0x3317d8){var _0x3619ec=_0x5f450f[_0xa757('0x2a')]['test']?0x1f4:_0x3317d8['statusCode']||0x1f4;logger[_0xa757('0x22')](_0xa757('0x6c'),_0xa757('0x4e'),_0x3619ec,JSON['stringify'](_0x3317d8));delete _0x3317d8[_0xa757('0x23')];if(_0x3619ec===0x191){_0x3619ec=0x190;}_0x115a94['status'](_0x3619ec)['send'](_0x5f450f[_0xa757('0x2a')][_0xa757('0x6d')]?{'message':_0xa757('0x6e'),'statusCode':_0x3317d8['statusCode']}:_0x3317d8);});}; \ No newline at end of file +var _0x3de3=['token','%s/token:%s','base64','ValidationError','subject','description','assignee','includes','position','title','system_field_options','statusCode','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','status','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Descriptions','channel','ZendeskField','Subjects','getFields','findOne','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','headers','%s:%s','toString'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0x3de3,0x1ce));var _0x33de=function(_0x26479e,_0xfdd13f){_0x26479e=_0x26479e-0x0;var _0x26fa40=_0x3de3[_0x26479e];return _0x26fa40;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];var integrations=require(_0x33de('0x19'));function respondWithStatusCode(_0x5170ad,_0x6b1a4c){_0x6b1a4c=_0x6b1a4c||0xcc;return function(_0x25d069){if(_0x25d069){return _0x5170ad['sendStatus'](_0x6b1a4c);}return _0x5170ad['status'](_0x6b1a4c)[_0x33de('0x1a')]();};}function respondWithResult(_0x22bda8,_0x2b3748){_0x2b3748=_0x2b3748||0xc8;return function(_0x57a2a1){if(_0x57a2a1){return _0x22bda8['status'](_0x2b3748)[_0x33de('0x1b')](_0x57a2a1);}};}function respondWithFilteredResult(_0x1b1166,_0x522ba0){return function(_0x4ff69f){if(_0x4ff69f){var _0x185849=typeof _0x522ba0[_0x33de('0x1c')]===_0x33de('0x1d')&&typeof _0x522ba0['limit']===_0x33de('0x1d');var _0x1203cf=_0x4ff69f['count'];var _0x2815a7=_0x185849?0x0:_0x522ba0[_0x33de('0x1c')];var _0x482667=_0x185849?_0x4ff69f['count']:_0x522ba0[_0x33de('0x1c')]+_0x522ba0['limit'];var _0x16255f;if(_0x482667>=_0x1203cf){_0x482667=_0x1203cf;_0x16255f=0xc8;}else{_0x16255f=0xce;}_0x1b1166[_0x33de('0x1e')](_0x16255f);return _0x1b1166[_0x33de('0x1f')](_0x33de('0x20'),_0x2815a7+'-'+_0x482667+'/'+_0x1203cf)[_0x33de('0x1b')](_0x4ff69f);}return null;};}function patchUpdates(_0x40a8e6){return function(_0x6cdc4f){try{jsonpatch['apply'](_0x6cdc4f,_0x40a8e6,!![]);}catch(_0x571086){return BPromise[_0x33de('0x21')](_0x571086);}return _0x6cdc4f['save']();};}function saveUpdates(_0x8acd8d,_0x4cd8db){return function(_0x28ed17){if(_0x28ed17){return _0x28ed17[_0x33de('0x22')](_0x8acd8d)['then'](function(_0x2dbcf2){return _0x2dbcf2;});}return null;};}function removeEntity(_0x5cd77e,_0x67d040){return function(_0x5c602d){if(_0x5c602d){return _0x5c602d[_0x33de('0x23')]()[_0x33de('0x24')](function(){_0x5cd77e[_0x33de('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdba4,_0x2d206b){return function(_0x140979){if(!_0x140979){_0x3bdba4['sendStatus'](0x194);}return _0x140979;};}function handleError(_0x34fba3,_0x5585a2){_0x5585a2=_0x5585a2||0x1f4;return function(_0x566373){logger[_0x33de('0x25')](_0x566373[_0x33de('0x26')]);if(_0x566373[_0x33de('0x27')]){delete _0x566373[_0x33de('0x27')];}_0x34fba3[_0x33de('0x1e')](_0x5585a2)[_0x33de('0x28')](_0x566373);};}exports[_0x33de('0x29')]=function(_0x1b4703,_0x59bc3b){var _0x5ae0e8={},_0x2755e6={},_0x1420d2={'count':0x0,'rows':[]};var _0xaeaec5=_[_0x33de('0x2a')](db[_0x33de('0x2b')][_0x33de('0x2c')],function(_0x427e82){return{'name':_0x427e82['fieldName'],'type':_0x427e82[_0x33de('0x2d')][_0x33de('0x2e')]};});_0x2755e6[_0x33de('0x2f')]=_[_0x33de('0x2a')](_0xaeaec5,'name');_0x2755e6[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1b4703['query']);_0x2755e6['filters']=_['intersection'](_0x2755e6[_0x33de('0x2f')],_0x2755e6[_0x33de('0x30')]);_0x5ae0e8['attributes']=_[_0x33de('0x32')](_0x2755e6['model'],qs['fields'](_0x1b4703[_0x33de('0x30')][_0x33de('0x33')]));_0x5ae0e8[_0x33de('0x34')]=_0x5ae0e8[_0x33de('0x34')][_0x33de('0x35')]?_0x5ae0e8[_0x33de('0x34')]:_0x2755e6[_0x33de('0x2f')];if(!_0x1b4703[_0x33de('0x30')]['hasOwnProperty'](_0x33de('0x36'))){_0x5ae0e8['limit']=qs[_0x33de('0x37')](_0x1b4703['query']['limit']);_0x5ae0e8[_0x33de('0x1c')]=qs[_0x33de('0x1c')](_0x1b4703[_0x33de('0x30')][_0x33de('0x1c')]);}_0x5ae0e8[_0x33de('0x38')]=qs[_0x33de('0x39')](_0x1b4703['query'][_0x33de('0x39')]);_0x5ae0e8[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_[_0x33de('0x3c')](_0x1b4703[_0x33de('0x30')],_0x2755e6[_0x33de('0x3b')]),_0xaeaec5);if(_0x1b4703[_0x33de('0x30')]['filter']){_0x5ae0e8[_0x33de('0x3a')]=_[_0x33de('0x3d')](_0x5ae0e8[_0x33de('0x3a')],{'$or':_[_0x33de('0x2a')](_0xaeaec5,function(_0x46ddfe){if(_0x46ddfe[_0x33de('0x2d')]!==_0x33de('0x3e')){var _0x511691={};_0x511691[_0x46ddfe[_0x33de('0x27')]]={'$like':'%'+_0x1b4703[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x511691;}})});}_0x5ae0e8=_[_0x33de('0x3d')]({},_0x5ae0e8,_0x1b4703[_0x33de('0x40')]);var _0x640136={'where':_0x5ae0e8['where']};return db[_0x33de('0x2b')]['count'](_0x640136)[_0x33de('0x24')](function(_0x66897c){_0x1420d2['count']=_0x66897c;if(_0x1b4703[_0x33de('0x30')][_0x33de('0x41')]){_0x5ae0e8[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2b')][_0x33de('0x43')](_0x5ae0e8);})[_0x33de('0x24')](function(_0x22518d){_0x1420d2[_0x33de('0x44')]=_0x22518d;return _0x1420d2;})[_0x33de('0x24')](respondWithFilteredResult(_0x59bc3b,_0x5ae0e8))['catch'](handleError(_0x59bc3b,null));};exports['show']=function(_0x417d9b,_0x1f75f7){var _0x20d04f={'raw':![],'where':{'id':_0x417d9b['params']['id']}},_0x376c55={};_0x376c55[_0x33de('0x2f')]=_['keys'](db['ZendeskAccount'][_0x33de('0x2c')]);_0x376c55[_0x33de('0x30')]=_[_0x33de('0x31')](_0x417d9b[_0x33de('0x30')]);_0x376c55[_0x33de('0x3b')]=_[_0x33de('0x32')](_0x376c55[_0x33de('0x2f')],_0x376c55['query']);_0x20d04f[_0x33de('0x34')]=_['intersection'](_0x376c55[_0x33de('0x2f')],qs['fields'](_0x417d9b[_0x33de('0x30')][_0x33de('0x33')]));_0x20d04f['attributes']=_0x20d04f[_0x33de('0x34')][_0x33de('0x35')]?_0x20d04f[_0x33de('0x34')]:_0x376c55['model'];if(_0x417d9b['query'][_0x33de('0x41')]){_0x20d04f[_0x33de('0x42')]=[{'all':!![]}];}_0x20d04f=_['merge']({},_0x20d04f,_0x417d9b['options']);return db[_0x33de('0x2b')]['find'](_0x20d04f)['then'](handleEntityNotFound(_0x1f75f7,null))['then'](respondWithResult(_0x1f75f7,null))[_0x33de('0x45')](handleError(_0x1f75f7,null));};exports[_0x33de('0x46')]=function(_0x9a816c,_0xce6079){return db['ZendeskAccount']['create'](_0x9a816c[_0x33de('0x47')],{})[_0x33de('0x24')](respondWithResult(_0xce6079,0xc9))['catch'](handleError(_0xce6079,null));};exports[_0x33de('0x22')]=function(_0xc23633,_0x23a5e7){if(_0xc23633[_0x33de('0x47')]['id']){delete _0xc23633[_0x33de('0x47')]['id'];}return db['ZendeskAccount'][_0x33de('0x48')]({'where':{'id':_0xc23633[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a5e7,null))[_0x33de('0x24')](saveUpdates(_0xc23633[_0x33de('0x47')],null))[_0x33de('0x24')](respondWithResult(_0x23a5e7,null))[_0x33de('0x45')](handleError(_0x23a5e7,null));};exports[_0x33de('0x23')]=function(_0x40f1b7,_0x3d6424){return db[_0x33de('0x2b')][_0x33de('0x48')]({'where':{'id':_0x40f1b7[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d6424,null))[_0x33de('0x24')](removeEntity(_0x3d6424,null))[_0x33de('0x45')](handleError(_0x3d6424,null));};exports[_0x33de('0x4a')]=function(_0x464502,_0xe6d59,_0x3fe65d){var _0x5c91e7={};var _0x49e1d9={};var _0x109ec5;var _0x32042e;return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x464502[_0x33de('0x49')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xe6d59,null))[_0x33de('0x24')](function(_0x303f72){if(_0x303f72){_0x109ec5=_0x303f72;_0x49e1d9['model']=_['keys'](db[_0x33de('0x4b')][_0x33de('0x2c')]);_0x49e1d9[_0x33de('0x30')]=_[_0x33de('0x31')](_0x464502[_0x33de('0x30')]);_0x49e1d9['filters']=_['intersection'](_0x49e1d9[_0x33de('0x2f')],_0x49e1d9[_0x33de('0x30')]);_0x5c91e7[_0x33de('0x34')]=_[_0x33de('0x32')](_0x49e1d9[_0x33de('0x2f')],qs[_0x33de('0x33')](_0x464502[_0x33de('0x30')][_0x33de('0x33')]));_0x5c91e7[_0x33de('0x34')]=_0x5c91e7['attributes'][_0x33de('0x35')]?_0x5c91e7[_0x33de('0x34')]:_0x49e1d9[_0x33de('0x2f')];_0x5c91e7['order']=qs[_0x33de('0x39')](_0x464502['query']['sort']);_0x5c91e7['where']=qs['filters'](_[_0x33de('0x3c')](_0x464502[_0x33de('0x30')],_0x49e1d9['filters']));if(_0x464502[_0x33de('0x30')][_0x33de('0x3f')]){_0x5c91e7['where']=_[_0x33de('0x3d')](_0x5c91e7[_0x33de('0x3a')],{'$or':_['map'](_0x5c91e7[_0x33de('0x34')],function(_0x2bd687){var _0x277bb7={};_0x277bb7[_0x2bd687]={'$like':'%'+_0x464502[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x277bb7;})});}_0x5c91e7=_[_0x33de('0x3d')]({},_0x5c91e7,_0x464502[_0x33de('0x40')]);return _0x109ec5['getConfigurations'](_0x5c91e7);}})['then'](function(_0x409e2e){if(_0x409e2e){_0x32042e=_0x409e2e['length'];if(!_0x464502[_0x33de('0x30')][_0x33de('0x4c')]('nolimit')){_0x5c91e7[_0x33de('0x37')]=qs['limit'](_0x464502[_0x33de('0x30')][_0x33de('0x37')]);_0x5c91e7['offset']=qs['offset'](_0x464502[_0x33de('0x30')][_0x33de('0x1c')]);}return _0x109ec5[_0x33de('0x4a')](_0x5c91e7);}})[_0x33de('0x24')](function(_0x24d936){if(_0x24d936){return _0x24d936?{'count':_0x32042e,'rows':_0x24d936}:null;}})['then'](respondWithResult(_0xe6d59,null))[_0x33de('0x45')](handleError(_0xe6d59,null));};exports[_0x33de('0x4d')]=function(_0x5d4ffd,_0xa10291,_0x375bda){if(_0x5d4ffd['body']['id']){delete _0x5d4ffd[_0x33de('0x47')]['id'];}return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x5d4ffd['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xa10291,null))['then'](function(_0x31a511){if(_0x31a511){_0x5d4ffd['body'][_0x33de('0x4e')]=_0x31a511['id'];_0x5d4ffd['body']['Subjects']=integrations['getSubjects'](_0x5d4ffd['body']['channel'],_0x5d4ffd['body'][_0x33de('0x2d')]);_0x5d4ffd['body'][_0x33de('0x4f')]=integrations['getDescriptions'](_0x5d4ffd['body'][_0x33de('0x50')],_0x5d4ffd[_0x33de('0x47')][_0x33de('0x2d')]);return db[_0x33de('0x4b')][_0x33de('0x46')](_0x5d4ffd[_0x33de('0x47')],{'include':[{'model':db[_0x33de('0x51')],'as':_0x33de('0x52')},{'model':db['ZendeskField'],'as':_0x33de('0x4f')}]});}return null;})['then'](respondWithResult(_0xa10291,null))[_0x33de('0x45')](handleError(_0xa10291,null));};exports[_0x33de('0x53')]=function(_0x2cbf20,_0x3a8d6b,_0x8a9729){var _0x3f5d52='';return db[_0x33de('0x2b')][_0x33de('0x54')]({'where':{'id':_0x2cbf20[_0x33de('0x49')]['id']},'attributes':['id',_0x33de('0x55'),_0x33de('0x56'),'token','authType',_0x33de('0x57')]})[_0x33de('0x24')](handleEntityNotFound(_0x3a8d6b,null))[_0x33de('0x24')](function(_0xbf482f){if(_0xbf482f){_0x3f5d52=_0xbf482f[_0x33de('0x57')];var _0x21a3ec=_0x3f5d52[_0x33de('0x58')](-0x1);if(_0x21a3ec==='/'){_0x3f5d52=_0x3f5d52[_0x33de('0x59')](0x0,_0x3f5d52[_0x33de('0x5a')](_0x21a3ec));}var _0x39e8c9={'method':'GET','uri':util[_0x33de('0x5b')](_0x33de('0x5c'),_0x3f5d52,_0x33de('0x5d')),'json':!![]};switch(_0xbf482f[_0x33de('0x5e')]){case _0x33de('0x56'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x60'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x56')]))[_0x33de('0x61')]('base64'))};break;case _0x33de('0x62'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x63'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x62')]))[_0x33de('0x61')](_0x33de('0x64')))};break;default:throw new db['Sequelize'][(_0x33de('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x39e8c9);}})[_0x33de('0x24')](function(_0x20e8ce){if(_0x20e8ce){var _0x50587b=[_0x33de('0x66'),_0x33de('0x67'),'group',_0x33de('0x68')];_['remove'](_0x20e8ce['ticket_fields'],function(_0x2b6729){return _0x50587b[_0x33de('0x69')](_0x2b6729[_0x33de('0x2d')]);});return{'count':_0x20e8ce[_0x33de('0x5d')][_0x33de('0x35')],'rows':_['map'](_0x20e8ce[_0x33de('0x5d')],function(_0x3bda5e){return{'id':_0x3bda5e['id'],'name':_0x3bda5e[_0x33de('0x6a')]>0x7?_0x3bda5e[_0x33de('0x6b')]:_0x3bda5e['type'],'custom':_0x3bda5e[_0x33de('0x6a')]>0x7?!![]:![],'options':_0x3bda5e[_0x33de('0x6c')]?_0x3bda5e[_0x33de('0x6c')]:_0x3bda5e['custom_field_options']?_0x3bda5e['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3a8d6b,null))['catch'](function(_0x5769f7){var _0x1f0e87=_0x2cbf20[_0x33de('0x30')]['test']?0x1f4:_0x5769f7[_0x33de('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33de('0x53'),_0x1f0e87,JSON[_0x33de('0x6e')](_0x5769f7));delete _0x5769f7['name'];if(_0x1f0e87===0x191){_0x1f0e87=0x190;}_0x3a8d6b[_0x33de('0x1e')](_0x1f0e87)[_0x33de('0x28')](_0x2cbf20['query'][_0x33de('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x5769f7[_0x33de('0x6d')]}:_0x5769f7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 707e628..92ad07d 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 _0x1139=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x2a9a97,_0x325cdf){var _0x13b0c=function(_0x3ae952){while(--_0x3ae952){_0x2a9a97['push'](_0x2a9a97['shift']());}};_0x13b0c(++_0x325cdf);}(_0x1139,0x1b6));var _0x9113=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1139[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x9113('0x0'));var util=require(_0x9113('0x1'));var logger=require(_0x9113('0x2'))(_0x9113('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9113('0x4'));var fs=require('fs');var path=require(_0x9113('0x5'));var rimraf=require(_0x9113('0x6'));var config=require(_0x9113('0x7'));var attributes=require(_0x9113('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x9113('0x9')]=function(_0x33d1be,_0x4c10f2){return _0x33d1be[_0x9113('0xa')](_0x9113('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d20=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','util','api','moment','bluebird'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6d20,0x80));var _0x06d2=function(_0x32fb8d,_0x567a64){_0x32fb8d=_0x32fb8d-0x0;var _0x37cf13=_0x6d20[_0x32fb8d];return _0x37cf13;};'use strict';var _=require('lodash');var util=require(_0x06d2('0x0'));var logger=require('../../config/logger')(_0x06d2('0x1'));var moment=require(_0x06d2('0x2'));var BPromise=require(_0x06d2('0x3'));var rp=require(_0x06d2('0x4'));var fs=require('fs');var path=require(_0x06d2('0x5'));var rimraf=require(_0x06d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x06d2('0x7'));var integrations=require(_0x06d2('0x8'));module[_0x06d2('0x9')]=function(_0x153995,_0x589513){return _0x153995['define'](_0x06d2('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index d13a0c7..4849b41 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 _0x2e15=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x40fad8,_0x1bc73c){var _0x4626f8=function(_0x5b40e5){while(--_0x5b40e5){_0x40fad8['push'](_0x40fad8['shift']());}};_0x4626f8(++_0x1bc73c);}(_0x2e15,0x174));var _0x52e1=function(_0xcbd7ae,_0x60d37d){_0xcbd7ae=_0xcbd7ae-0x0;var _0x334d47=_0x2e15[_0xcbd7ae];return _0x334d47;};'use strict';var _=require('lodash');var util=require(_0x52e1('0x0'));var moment=require(_0x52e1('0x1'));var BPromise=require(_0x52e1('0x2'));var rs=require(_0x52e1('0x3'));var fs=require('fs');var Redis=require(_0x52e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52e1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x52e1('0x6'));var client=jayson[_0x52e1('0x7')][_0x52e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cdf38,_0x4f5834,_0x5d2f61){return new BPromise(function(_0x47ce52,_0x387982){return client[_0x52e1('0x9')](_0x1cdf38,_0x5d2f61)[_0x52e1('0xa')](function(_0x3aa36d){logger[_0x52e1('0xb')](_0x52e1('0xc'),_0x4f5834,'request\x20sent');logger[_0x52e1('0xd')](_0x52e1('0xe'),_0x4f5834,_0x52e1('0xf'),JSON[_0x52e1('0x10')](_0x3aa36d));if(_0x3aa36d[_0x52e1('0x11')]){if(_0x3aa36d[_0x52e1('0x11')][_0x52e1('0x12')]===0x1f4){logger[_0x52e1('0x11')](_0x52e1('0xc'),_0x4f5834,_0x3aa36d[_0x52e1('0x11')][_0x52e1('0x13')]);return _0x387982(_0x3aa36d[_0x52e1('0x11')]['message']);}logger[_0x52e1('0x11')](_0x52e1('0xc'),_0x4f5834,_0x3aa36d['error'][_0x52e1('0x13')]);return _0x47ce52(_0x3aa36d['error'][_0x52e1('0x13')]);}else{logger[_0x52e1('0xb')](_0x52e1('0xc'),_0x4f5834,_0x52e1('0xf'));_0x47ce52(_0x3aa36d[_0x52e1('0x14')][_0x52e1('0x13')]);}})[_0x52e1('0x15')](function(_0x59ceb9){logger[_0x52e1('0x11')](_0x52e1('0xc'),_0x4f5834,_0x59ceb9);_0x387982(_0x59ceb9);});});}exports[_0x52e1('0x16')]=function(_0x73dee0){var _0x5b2bfe=this;return new Promise(function(_0x52ab1b,_0x2ad510){return db[_0x52e1('0x17')][_0x52e1('0x18')]({'raw':_0x73dee0['options']?_0x73dee0[_0x52e1('0x19')][_0x52e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x73dee0[_0x52e1('0x19')]?_0x73dee0[_0x52e1('0x19')][_0x52e1('0x1b')]||null:null,'attributes':_0x73dee0['options']?_0x73dee0[_0x52e1('0x19')][_0x52e1('0x1c')]||null:null,'limit':_0x73dee0['options']?_0x73dee0[_0x52e1('0x19')][_0x52e1('0x1d')]||null:null,'include':_0x73dee0['options']?_0x73dee0['options'][_0x52e1('0x1e')]?_[_0x52e1('0x1f')](_0x73dee0[_0x52e1('0x19')][_0x52e1('0x1e')],function(_0x378a1f){return{'model':db[_0x378a1f[_0x52e1('0x20')]],'as':_0x378a1f['as'],'attributes':_0x378a1f['attributes'],'include':_0x378a1f['include']?_[_0x52e1('0x1f')](_0x378a1f[_0x52e1('0x1e')],function(_0x528de7){return{'model':db[_0x528de7[_0x52e1('0x20')]],'as':_0x528de7['as'],'attributes':_0x528de7[_0x52e1('0x1c')],'include':_0x528de7[_0x52e1('0x1e')]?_[_0x52e1('0x1f')](_0x528de7[_0x52e1('0x1e')],function(_0x1ea854){return{'model':db[_0x1ea854['model']],'as':_0x1ea854['as'],'attributes':_0x1ea854[_0x52e1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x52e1('0xa')](function(_0x4a80b6){logger[_0x52e1('0xb')](_0x52e1('0x16'),_0x73dee0);logger['debug']('GetZendeskAccount',_0x73dee0,JSON['stringify'](_0x4a80b6));_0x52ab1b(_0x4a80b6);})[_0x52e1('0x15')](function(_0x32f893){logger['error'](_0x52e1('0x16'),_0x32f893['message'],_0x73dee0);_0x2ad510(_0x5b2bfe[_0x52e1('0x11')](0x1f4,_0x32f893[_0x52e1('0x13')]));});});};exports[_0x52e1('0x21')]=function(_0x4db9bd){var _0x3d9e5d=this;return new Promise(function(_0x401952,_0x1ff9b2){return db[_0x52e1('0x17')][_0x52e1('0x22')]({'raw':_0x4db9bd[_0x52e1('0x19')]?_0x4db9bd['options'][_0x52e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4db9bd[_0x52e1('0x19')]?_0x4db9bd['options'][_0x52e1('0x1b')]||null:null,'attributes':_0x4db9bd[_0x52e1('0x19')]?_0x4db9bd['options'][_0x52e1('0x1c')]||null:null,'include':_0x4db9bd['options']?_0x4db9bd[_0x52e1('0x19')]['include']?_[_0x52e1('0x1f')](_0x4db9bd['options'][_0x52e1('0x1e')],function(_0x2d3e85){return{'model':db[_0x2d3e85[_0x52e1('0x20')]],'as':_0x2d3e85['as'],'attributes':_0x2d3e85[_0x52e1('0x1c')],'include':_0x2d3e85[_0x52e1('0x1e')]?_[_0x52e1('0x1f')](_0x2d3e85['include'],function(_0x3cc825){return{'model':db[_0x3cc825['model']],'as':_0x3cc825['as'],'attributes':_0x3cc825['attributes'],'include':_0x3cc825[_0x52e1('0x1e')]?_['map'](_0x3cc825['include'],function(_0x35251a){return{'model':db[_0x35251a[_0x52e1('0x20')]],'as':_0x35251a['as'],'attributes':_0x35251a[_0x52e1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x52e1('0xa')](function(_0x5d39da){logger[_0x52e1('0xb')]('ShowZendeskAccount',_0x4db9bd);logger['debug']('ShowZendeskAccount',_0x4db9bd,JSON['stringify'](_0x5d39da));_0x401952(_0x5d39da);})['catch'](function(_0x163608){logger[_0x52e1('0x11')](_0x52e1('0x21'),_0x163608[_0x52e1('0x13')],_0x4db9bd);_0x1ff9b2(_0x3d9e5d[_0x52e1('0x11')](0x1f4,_0x163608[_0x52e1('0x13')]));});});}; \ No newline at end of file +var _0x7613=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ZendeskAccount','options','raw','limit','include','attributes','map','model','GetZendeskAccount','ShowZendeskAccount','find','where','lodash','moment','randomstring'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0x7613,0x190));var _0x3761=function(_0x390ef6,_0x1d401c){_0x390ef6=_0x390ef6-0x0;var _0x2fdaac=_0x7613[_0x390ef6];return _0x2fdaac;};'use strict';var _=require(_0x3761('0x0'));var util=require('util');var moment=require(_0x3761('0x1'));var BPromise=require('bluebird');var rs=require(_0x3761('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3761('0x3'))['db'];var utils=require(_0x3761('0x4'));var logger=require('../../config/logger')(_0x3761('0x5'));var config=require('../../config/environment');var jayson=require(_0x3761('0x6'));var client=jayson[_0x3761('0x7')][_0x3761('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x262c56,_0x482464,_0x17eabd){return new BPromise(function(_0x160f2f,_0x152652){return client[_0x3761('0x9')](_0x262c56,_0x17eabd)[_0x3761('0xa')](function(_0x1e530b){logger[_0x3761('0xb')](_0x3761('0xc'),_0x482464,_0x3761('0xd'));logger[_0x3761('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x482464,'request\x20sent',JSON['stringify'](_0x1e530b));if(_0x1e530b[_0x3761('0xf')]){if(_0x1e530b['error']['code']===0x1f4){logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x1e530b['error'][_0x3761('0x10')]);return _0x152652(_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);}logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);return _0x160f2f(_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);}else{logger[_0x3761('0xb')](_0x3761('0xc'),_0x482464,'request\x20sent');_0x160f2f(_0x1e530b[_0x3761('0x11')]['message']);}})[_0x3761('0x12')](function(_0x45b6be){logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x45b6be);_0x152652(_0x45b6be);});});}exports['GetZendeskAccount']=function(_0x47b5c7){var _0x3c397e=this;return new Promise(function(_0x3d9a86,_0x2913e9){return db[_0x3761('0x13')]['findAll']({'raw':_0x47b5c7['options']?_0x47b5c7[_0x3761('0x14')][_0x3761('0x15')]===undefined?!![]:![]:!![],'where':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')]['where']||null:null,'attributes':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')]['attributes']||null:null,'limit':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7['options'][_0x3761('0x16')]||null:null,'include':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')][_0x3761('0x17')]?_['map'](_0x47b5c7[_0x3761('0x14')][_0x3761('0x17')],function(_0xb955d0){return{'model':db[_0xb955d0['model']],'as':_0xb955d0['as'],'attributes':_0xb955d0[_0x3761('0x18')],'include':_0xb955d0[_0x3761('0x17')]?_[_0x3761('0x19')](_0xb955d0[_0x3761('0x17')],function(_0x2f308a){return{'model':db[_0x2f308a[_0x3761('0x1a')]],'as':_0x2f308a['as'],'attributes':_0x2f308a[_0x3761('0x18')],'include':_0x2f308a[_0x3761('0x17')]?_[_0x3761('0x19')](_0x2f308a[_0x3761('0x17')],function(_0x1dca25){return{'model':db[_0x1dca25[_0x3761('0x1a')]],'as':_0x1dca25['as'],'attributes':_0x1dca25[_0x3761('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487abb){logger[_0x3761('0xb')](_0x3761('0x1b'),_0x47b5c7);logger[_0x3761('0xe')](_0x3761('0x1b'),_0x47b5c7,JSON['stringify'](_0x487abb));_0x3d9a86(_0x487abb);})[_0x3761('0x12')](function(_0x31f70e){logger['error'](_0x3761('0x1b'),_0x31f70e[_0x3761('0x10')],_0x47b5c7);_0x2913e9(_0x3c397e[_0x3761('0xf')](0x1f4,_0x31f70e['message']));});});};exports[_0x3761('0x1c')]=function(_0x104900){var _0x36261a=this;return new Promise(function(_0xaac26f,_0x228f07){return db[_0x3761('0x13')][_0x3761('0x1d')]({'raw':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x15')]===undefined?!![]:![]:!![],'where':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x1e')]||null:null,'attributes':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x18')]||null:null,'include':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x17')]?_[_0x3761('0x19')](_0x104900['options'][_0x3761('0x17')],function(_0x329bd7){return{'model':db[_0x329bd7[_0x3761('0x1a')]],'as':_0x329bd7['as'],'attributes':_0x329bd7[_0x3761('0x18')],'include':_0x329bd7[_0x3761('0x17')]?_[_0x3761('0x19')](_0x329bd7[_0x3761('0x17')],function(_0x338923){return{'model':db[_0x338923['model']],'as':_0x338923['as'],'attributes':_0x338923['attributes'],'include':_0x338923[_0x3761('0x17')]?_[_0x3761('0x19')](_0x338923[_0x3761('0x17')],function(_0x39bd90){return{'model':db[_0x39bd90[_0x3761('0x1a')]],'as':_0x39bd90['as'],'attributes':_0x39bd90[_0x3761('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3761('0xa')](function(_0x2af75a){logger['info']('ShowZendeskAccount',_0x104900);logger[_0x3761('0xe')](_0x3761('0x1c'),_0x104900,JSON['stringify'](_0x2af75a));_0xaac26f(_0x2af75a);})[_0x3761('0x12')](function(_0x56100a){logger[_0x3761('0xf')]('ShowZendeskAccount',_0x56100a[_0x3761('0x10')],_0x104900);_0x228f07(_0x36261a['error'](0x1f4,_0x56100a[_0x3761('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b7b9636..68e8025 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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0xd1f341,_0x6d341){var _0x67c619=function(_0xc57b29){while(--_0xc57b29){_0xd1f341['push'](_0xd1f341['shift']());}};_0x67c619(++_0x6d341);}(_0x5eb8,0xb0));var _0x85eb=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x5eb8[_0x20aadb];return _0x520018;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=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(_0x4217ee,_0x17b42b){var _0x4b6183=function(_0x223296){while(--_0x223296){_0x4217ee['push'](_0x4217ee['shift']());}};_0x4b6183(++_0x17b42b);}(_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 25846e7..3ad3723 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 _0xde86=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde86,0x142));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6de8('0x0'));module[_0x6de8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6de8('0x2')]}}; \ No newline at end of file +var _0x7777=['STRING'];(function(_0x3d328a,_0xf4dba5){var _0x50ba88=function(_0x233fdb){while(--_0x233fdb){_0x3d328a['push'](_0x3d328a['shift']());}};_0x50ba88(++_0xf4dba5);}(_0x7777,0x1ce));var _0x7777=function(_0x1eecf2,_0x5eddc2){_0x1eecf2=_0x1eecf2-0x0;var _0x3e3d86=_0x7777[_0x1eecf2];return _0x3e3d86;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7777('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 9c2fc2f..a2066a3 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 _0xf022=['ZendeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields','ZendeskField','order','filter','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map'];(function(_0x52cfa4,_0x1089da){var _0x10b9c7=function(_0x30fa1e){while(--_0x30fa1e){_0x52cfa4['push'](_0x52cfa4['shift']());}};_0x10b9c7(++_0x1089da);}(_0xf022,0x7b));var _0x2f02=function(_0x4adc6d,_0x11275c){_0x4adc6d=_0x4adc6d-0x0;var _0x4d42e5=_0xf022[_0x4adc6d];return _0x4d42e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f02('0x0'));var jsonpatch=require(_0x2f02('0x1'));var rp=require(_0x2f02('0x2'));var moment=require(_0x2f02('0x3'));var BPromise=require(_0x2f02('0x4'));var Mustache=require(_0x2f02('0x5'));var util=require(_0x2f02('0x6'));var path=require(_0x2f02('0x7'));var sox=require(_0x2f02('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f02('0x9'));var _=require(_0x2f02('0xa'));var squel=require(_0x2f02('0xb'));var crypto=require(_0x2f02('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2f02('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f02('0xe'));var Redis=require(_0x2f02('0xf'));var authService=require(_0x2f02('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2f02('0x11'));var hardwareService=require(_0x2f02('0x12'));var logger=require(_0x2f02('0x13'))(_0x2f02('0x14'));var utils=require(_0x2f02('0x15'));var config=require(_0x2f02('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd10f1c,_0x48df5a){_0x48df5a=_0x48df5a||0xcc;return function(_0x5bbbfe){if(_0x5bbbfe){return _0xd10f1c['sendStatus'](_0x48df5a);}return _0xd10f1c[_0x2f02('0x17')](_0x48df5a)[_0x2f02('0x18')]();};}function respondWithResult(_0x3e7b6a,_0x61d136){_0x61d136=_0x61d136||0xc8;return function(_0x481d90){if(_0x481d90){return _0x3e7b6a[_0x2f02('0x17')](_0x61d136)['json'](_0x481d90);}};}function respondWithFilteredResult(_0x404259,_0x480546){return function(_0x5cc990){if(_0x5cc990){var _0x57ddca=typeof _0x480546['offset']==='undefined'&&typeof _0x480546[_0x2f02('0x19')]===_0x2f02('0x1a');var _0x20d418=_0x5cc990[_0x2f02('0x1b')];var _0x1aac45=_0x57ddca?0x0:_0x480546[_0x2f02('0x1c')];var _0x6a10be=_0x57ddca?_0x5cc990['count']:_0x480546[_0x2f02('0x1c')]+_0x480546[_0x2f02('0x19')];var _0x2a73f5;if(_0x6a10be>=_0x20d418){_0x6a10be=_0x20d418;_0x2a73f5=0xc8;}else{_0x2a73f5=0xce;}_0x404259['status'](_0x2a73f5);return _0x404259[_0x2f02('0x1d')](_0x2f02('0x1e'),_0x1aac45+'-'+_0x6a10be+'/'+_0x20d418)[_0x2f02('0x1f')](_0x5cc990);}return null;};}function patchUpdates(_0x2ab83c){return function(_0x4c29c3){try{jsonpatch[_0x2f02('0x20')](_0x4c29c3,_0x2ab83c,!![]);}catch(_0x316ae9){return BPromise[_0x2f02('0x21')](_0x316ae9);}return _0x4c29c3[_0x2f02('0x22')]();};}function saveUpdates(_0x1ab7c9,_0x2cbecb){return function(_0x6a270e){if(_0x6a270e){return _0x6a270e[_0x2f02('0x23')](_0x1ab7c9)[_0x2f02('0x24')](function(_0x64df32){return _0x64df32;});}return null;};}function removeEntity(_0x4946a0,_0x3e591f){return function(_0x52e80b){if(_0x52e80b){return _0x52e80b[_0x2f02('0x25')]()[_0x2f02('0x24')](function(){_0x4946a0[_0x2f02('0x17')](0xcc)[_0x2f02('0x18')]();});}};}function handleEntityNotFound(_0x55cb21,_0x45eda1){return function(_0x18cead){if(!_0x18cead){_0x55cb21['sendStatus'](0x194);}return _0x18cead;};}function handleError(_0x20d9e3,_0x293b2d){_0x293b2d=_0x293b2d||0x1f4;return function(_0xdde7e){logger['error'](_0xdde7e[_0x2f02('0x26')]);if(_0xdde7e['name']){delete _0xdde7e[_0x2f02('0x27')];}_0x20d9e3[_0x2f02('0x17')](_0x293b2d)[_0x2f02('0x28')](_0xdde7e);};}exports[_0x2f02('0x29')]=function(_0x10ba55,_0x6d1c74){var _0x5cac9f={},_0x441b18={},_0x2f8b63={'count':0x0,'rows':[]};var _0x4d88b6=_[_0x2f02('0x2a')](db[_0x2f02('0x2b')][_0x2f02('0x2c')],function(_0x5778ee){return{'name':_0x5778ee['fieldName'],'type':_0x5778ee[_0x2f02('0x2d')][_0x2f02('0x2e')]};});_0x441b18[_0x2f02('0x2f')]=_[_0x2f02('0x2a')](_0x4d88b6,_0x2f02('0x27'));_0x441b18['query']=_[_0x2f02('0x30')](_0x10ba55[_0x2f02('0x31')]);_0x441b18[_0x2f02('0x32')]=_[_0x2f02('0x33')](_0x441b18[_0x2f02('0x2f')],_0x441b18[_0x2f02('0x31')]);_0x5cac9f['attributes']=_[_0x2f02('0x33')](_0x441b18[_0x2f02('0x2f')],qs['fields'](_0x10ba55['query'][_0x2f02('0x34')]));_0x5cac9f[_0x2f02('0x35')]=_0x5cac9f['attributes']['length']?_0x5cac9f[_0x2f02('0x35')]:_0x441b18[_0x2f02('0x2f')];if(!_0x10ba55[_0x2f02('0x31')][_0x2f02('0x36')](_0x2f02('0x37'))){_0x5cac9f[_0x2f02('0x19')]=qs[_0x2f02('0x19')](_0x10ba55['query'][_0x2f02('0x19')]);_0x5cac9f['offset']=qs[_0x2f02('0x1c')](_0x10ba55[_0x2f02('0x31')][_0x2f02('0x1c')]);}_0x5cac9f['order']=qs['sort'](_0x10ba55[_0x2f02('0x31')][_0x2f02('0x38')]);_0x5cac9f[_0x2f02('0x39')]=qs[_0x2f02('0x32')](_[_0x2f02('0x3a')](_0x10ba55['query'],_0x441b18[_0x2f02('0x32')]),_0x4d88b6);if(_0x10ba55['query']['filter']){_0x5cac9f['where']=_[_0x2f02('0x3b')](_0x5cac9f['where'],{'$or':_['map'](_0x4d88b6,function(_0x4ba5af){if(_0x4ba5af[_0x2f02('0x2d')]!==_0x2f02('0x3c')){var _0x5d9e0f={};_0x5d9e0f[_0x4ba5af[_0x2f02('0x27')]]={'$like':'%'+_0x10ba55[_0x2f02('0x31')]['filter']+'%'};return _0x5d9e0f;}})});}_0x5cac9f=_[_0x2f02('0x3b')]({},_0x5cac9f,_0x10ba55[_0x2f02('0x3d')]);var _0x4d5d70={'where':_0x5cac9f[_0x2f02('0x39')]};return db[_0x2f02('0x2b')]['count'](_0x4d5d70)[_0x2f02('0x24')](function(_0x1efa02){_0x2f8b63[_0x2f02('0x1b')]=_0x1efa02;if(_0x10ba55['query'][_0x2f02('0x3e')]){_0x5cac9f[_0x2f02('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x2f02('0x40')](_0x5cac9f);})[_0x2f02('0x24')](function(_0x3df5a0){_0x2f8b63[_0x2f02('0x41')]=_0x3df5a0;return _0x2f8b63;})['then'](respondWithFilteredResult(_0x6d1c74,_0x5cac9f))[_0x2f02('0x42')](handleError(_0x6d1c74,null));};exports['show']=function(_0x3187b0,_0x21b95b){var _0x5ca85={'raw':![],'where':{'id':_0x3187b0[_0x2f02('0x43')]['id']}},_0x2c68d3={};_0x2c68d3[_0x2f02('0x2f')]=_['keys'](db[_0x2f02('0x2b')]['rawAttributes']);_0x2c68d3[_0x2f02('0x31')]=_[_0x2f02('0x30')](_0x3187b0[_0x2f02('0x31')]);_0x2c68d3[_0x2f02('0x32')]=_[_0x2f02('0x33')](_0x2c68d3[_0x2f02('0x2f')],_0x2c68d3[_0x2f02('0x31')]);_0x5ca85['attributes']=_[_0x2f02('0x33')](_0x2c68d3[_0x2f02('0x2f')],qs['fields'](_0x3187b0[_0x2f02('0x31')][_0x2f02('0x34')]));_0x5ca85[_0x2f02('0x35')]=_0x5ca85[_0x2f02('0x35')][_0x2f02('0x44')]?_0x5ca85[_0x2f02('0x35')]:_0x2c68d3[_0x2f02('0x2f')];if(_0x3187b0[_0x2f02('0x31')][_0x2f02('0x3e')]){_0x5ca85[_0x2f02('0x3f')]=[{'all':!![]}];}_0x5ca85=_['merge']({},_0x5ca85,_0x3187b0[_0x2f02('0x3d')]);return db['ZendeskConfiguration'][_0x2f02('0x45')](_0x5ca85)[_0x2f02('0x24')](handleEntityNotFound(_0x21b95b,null))[_0x2f02('0x24')](respondWithResult(_0x21b95b,null))[_0x2f02('0x42')](handleError(_0x21b95b,null));};exports[_0x2f02('0x46')]=function(_0x2a76b6,_0x906f3a){return db['ZendeskConfiguration'][_0x2f02('0x46')](_0x2a76b6[_0x2f02('0x47')],{})[_0x2f02('0x24')](respondWithResult(_0x906f3a,0xc9))[_0x2f02('0x42')](handleError(_0x906f3a,null));};exports[_0x2f02('0x23')]=function(_0xc676a9,_0x349e98){if(_0xc676a9[_0x2f02('0x47')]['id']){delete _0xc676a9[_0x2f02('0x47')]['id'];}return db[_0x2f02('0x2b')][_0x2f02('0x45')]({'where':{'id':_0xc676a9[_0x2f02('0x43')]['id']}})[_0x2f02('0x24')](handleEntityNotFound(_0x349e98,null))[_0x2f02('0x24')](saveUpdates(_0xc676a9[_0x2f02('0x47')],null))[_0x2f02('0x24')](respondWithResult(_0x349e98,null))[_0x2f02('0x42')](handleError(_0x349e98,null));};exports[_0x2f02('0x25')]=function(_0xd1d455,_0x58b078){return db[_0x2f02('0x2b')][_0x2f02('0x45')]({'where':{'id':_0xd1d455[_0x2f02('0x43')]['id']}})['then'](handleEntityNotFound(_0x58b078,null))[_0x2f02('0x24')](removeEntity(_0x58b078,null))[_0x2f02('0x42')](handleError(_0x58b078,null));};exports[_0x2f02('0x48')]=function(_0x23e72a,_0x83fecf,_0x1286e8){var _0x360357={};var _0x566974={};var _0x1bdf9e;var _0x15ff04;return db[_0x2f02('0x2b')]['findOne']({'where':{'id':_0x23e72a[_0x2f02('0x43')]['id']}})['then'](handleEntityNotFound(_0x83fecf,null))[_0x2f02('0x24')](function(_0x172fb7){if(_0x172fb7){_0x1bdf9e=_0x172fb7;_0x566974[_0x2f02('0x2f')]=_[_0x2f02('0x30')](db[_0x2f02('0x49')][_0x2f02('0x2c')]);_0x566974[_0x2f02('0x31')]=_[_0x2f02('0x30')](_0x23e72a[_0x2f02('0x31')]);_0x566974[_0x2f02('0x32')]=_[_0x2f02('0x33')](_0x566974[_0x2f02('0x2f')],_0x566974[_0x2f02('0x31')]);_0x360357[_0x2f02('0x35')]=_[_0x2f02('0x33')](_0x566974[_0x2f02('0x2f')],qs['fields'](_0x23e72a['query'][_0x2f02('0x34')]));_0x360357[_0x2f02('0x35')]=_0x360357[_0x2f02('0x35')][_0x2f02('0x44')]?_0x360357[_0x2f02('0x35')]:_0x566974[_0x2f02('0x2f')];_0x360357[_0x2f02('0x4a')]=qs['sort'](_0x23e72a[_0x2f02('0x31')][_0x2f02('0x38')]);_0x360357[_0x2f02('0x39')]=qs[_0x2f02('0x32')](_['pick'](_0x23e72a[_0x2f02('0x31')],_0x566974[_0x2f02('0x32')]));if(_0x23e72a[_0x2f02('0x31')][_0x2f02('0x4b')]){_0x360357[_0x2f02('0x39')]=_[_0x2f02('0x3b')](_0x360357[_0x2f02('0x39')],{'$or':_[_0x2f02('0x2a')](_0x360357['attributes'],function(_0x3423e1){var _0x3c291d={};_0x3c291d[_0x3423e1]={'$like':'%'+_0x23e72a[_0x2f02('0x31')]['filter']+'%'};return _0x3c291d;})});}_0x360357=_[_0x2f02('0x3b')]({},_0x360357,_0x23e72a[_0x2f02('0x3d')]);return _0x1bdf9e[_0x2f02('0x48')](_0x360357);}})[_0x2f02('0x24')](function(_0x16214a){if(_0x16214a){_0x15ff04=_0x16214a[_0x2f02('0x44')];if(!_0x23e72a[_0x2f02('0x31')][_0x2f02('0x36')](_0x2f02('0x37'))){_0x360357[_0x2f02('0x19')]=qs[_0x2f02('0x19')](_0x23e72a['query'][_0x2f02('0x19')]);_0x360357[_0x2f02('0x1c')]=qs['offset'](_0x23e72a[_0x2f02('0x31')][_0x2f02('0x1c')]);}return _0x1bdf9e[_0x2f02('0x48')](_0x360357);}})['then'](function(_0x4a86c1){if(_0x4a86c1){return _0x4a86c1?{'count':_0x15ff04,'rows':_0x4a86c1}:null;}})[_0x2f02('0x24')](respondWithResult(_0x83fecf,null))[_0x2f02('0x42')](handleError(_0x83fecf,null));};exports['getSubjects']=function(_0x2eadca,_0x1c41b3,_0x3d0390){var _0x16302c={};var _0x3c7477={};var _0x440d88;var _0xd89dba;return db[_0x2f02('0x2b')][_0x2f02('0x4c')]({'where':{'id':_0x2eadca[_0x2f02('0x43')]['id']}})[_0x2f02('0x24')](handleEntityNotFound(_0x1c41b3,null))['then'](function(_0x3e806f){if(_0x3e806f){_0x440d88=_0x3e806f;_0x3c7477[_0x2f02('0x2f')]=_[_0x2f02('0x30')](db['ZendeskField']['rawAttributes']);_0x3c7477[_0x2f02('0x31')]=_[_0x2f02('0x30')](_0x2eadca[_0x2f02('0x31')]);_0x3c7477[_0x2f02('0x32')]=_['intersection'](_0x3c7477[_0x2f02('0x2f')],_0x3c7477['query']);_0x16302c[_0x2f02('0x35')]=_[_0x2f02('0x33')](_0x3c7477['model'],qs['fields'](_0x2eadca[_0x2f02('0x31')][_0x2f02('0x34')]));_0x16302c[_0x2f02('0x35')]=_0x16302c[_0x2f02('0x35')][_0x2f02('0x44')]?_0x16302c[_0x2f02('0x35')]:_0x3c7477[_0x2f02('0x2f')];_0x16302c[_0x2f02('0x4a')]=qs[_0x2f02('0x38')](_0x2eadca[_0x2f02('0x31')][_0x2f02('0x38')]);_0x16302c['where']=qs[_0x2f02('0x32')](_['pick'](_0x2eadca[_0x2f02('0x31')],_0x3c7477[_0x2f02('0x32')]));if(_0x2eadca[_0x2f02('0x31')][_0x2f02('0x4b')]){_0x16302c[_0x2f02('0x39')]=_[_0x2f02('0x3b')](_0x16302c[_0x2f02('0x39')],{'$or':_[_0x2f02('0x2a')](_0x16302c[_0x2f02('0x35')],function(_0x5e97be){var _0x407edd={};_0x407edd[_0x5e97be]={'$like':'%'+_0x2eadca['query']['filter']+'%'};return _0x407edd;})});}_0x16302c=_[_0x2f02('0x3b')]({},_0x16302c,_0x2eadca[_0x2f02('0x3d')]);return _0x440d88[_0x2f02('0x4d')](_0x16302c);}})['then'](function(_0x524bde){if(_0x524bde){_0xd89dba=_0x524bde[_0x2f02('0x44')];if(!_0x2eadca[_0x2f02('0x31')][_0x2f02('0x36')](_0x2f02('0x37'))){_0x16302c[_0x2f02('0x19')]=qs[_0x2f02('0x19')](_0x2eadca[_0x2f02('0x31')]['limit']);_0x16302c[_0x2f02('0x1c')]=qs[_0x2f02('0x1c')](_0x2eadca['query'][_0x2f02('0x1c')]);}return _0x440d88[_0x2f02('0x4d')](_0x16302c);}})[_0x2f02('0x24')](function(_0x49572d){if(_0x49572d){return _0x49572d?{'count':_0xd89dba,'rows':_0x49572d}:null;}})[_0x2f02('0x24')](respondWithResult(_0x1c41b3,null))['catch'](handleError(_0x1c41b3,null));};exports[_0x2f02('0x4e')]=function(_0x2770ae,_0x86d7c3,_0x1a9684){var _0x2ef8dc={};var _0xb6f278={};var _0x465a5f;var _0x3eb76e;return db[_0x2f02('0x2b')][_0x2f02('0x4c')]({'where':{'id':_0x2770ae[_0x2f02('0x43')]['id']}})[_0x2f02('0x24')](handleEntityNotFound(_0x86d7c3,null))[_0x2f02('0x24')](function(_0x2fda87){if(_0x2fda87){_0x465a5f=_0x2fda87;_0xb6f278[_0x2f02('0x2f')]=_[_0x2f02('0x30')](db[_0x2f02('0x49')][_0x2f02('0x2c')]);_0xb6f278[_0x2f02('0x31')]=_['keys'](_0x2770ae['query']);_0xb6f278[_0x2f02('0x32')]=_[_0x2f02('0x33')](_0xb6f278['model'],_0xb6f278[_0x2f02('0x31')]);_0x2ef8dc[_0x2f02('0x35')]=_[_0x2f02('0x33')](_0xb6f278[_0x2f02('0x2f')],qs['fields'](_0x2770ae[_0x2f02('0x31')][_0x2f02('0x34')]));_0x2ef8dc[_0x2f02('0x35')]=_0x2ef8dc[_0x2f02('0x35')]['length']?_0x2ef8dc[_0x2f02('0x35')]:_0xb6f278[_0x2f02('0x2f')];_0x2ef8dc[_0x2f02('0x4a')]=qs[_0x2f02('0x38')](_0x2770ae[_0x2f02('0x31')][_0x2f02('0x38')]);_0x2ef8dc['where']=qs[_0x2f02('0x32')](_['pick'](_0x2770ae[_0x2f02('0x31')],_0xb6f278[_0x2f02('0x32')]));if(_0x2770ae[_0x2f02('0x31')]['filter']){_0x2ef8dc['where']=_[_0x2f02('0x3b')](_0x2ef8dc['where'],{'$or':_[_0x2f02('0x2a')](_0x2ef8dc[_0x2f02('0x35')],function(_0x3fe227){var _0x1b6548={};_0x1b6548[_0x3fe227]={'$like':'%'+_0x2770ae[_0x2f02('0x31')][_0x2f02('0x4b')]+'%'};return _0x1b6548;})});}_0x2ef8dc=_['merge']({},_0x2ef8dc,_0x2770ae[_0x2f02('0x3d')]);return _0x465a5f['getDescriptions'](_0x2ef8dc);}})[_0x2f02('0x24')](function(_0x359020){if(_0x359020){_0x3eb76e=_0x359020[_0x2f02('0x44')];if(!_0x2770ae[_0x2f02('0x31')][_0x2f02('0x36')](_0x2f02('0x37'))){_0x2ef8dc[_0x2f02('0x19')]=qs[_0x2f02('0x19')](_0x2770ae[_0x2f02('0x31')][_0x2f02('0x19')]);_0x2ef8dc[_0x2f02('0x1c')]=qs['offset'](_0x2770ae[_0x2f02('0x31')][_0x2f02('0x1c')]);}return _0x465a5f[_0x2f02('0x4e')](_0x2ef8dc);}})['then'](function(_0x460621){if(_0x460621){return _0x460621?{'count':_0x3eb76e,'rows':_0x460621}:null;}})['then'](respondWithResult(_0x86d7c3,null))['catch'](handleError(_0x86d7c3,null));};exports[_0x2f02('0x4f')]=function(_0x2841d3,_0xd024cf,_0x457bc6){var _0x189cf0={};var _0x1ca632={};var _0x445500;var _0x37894c;return db[_0x2f02('0x2b')]['findOne']({'where':{'id':_0x2841d3[_0x2f02('0x43')]['id']}})[_0x2f02('0x24')](handleEntityNotFound(_0xd024cf,null))[_0x2f02('0x24')](function(_0x1fd9e8){if(_0x1fd9e8){_0x445500=_0x1fd9e8;_0x1ca632[_0x2f02('0x2f')]=_[_0x2f02('0x30')](db[_0x2f02('0x50')][_0x2f02('0x2c')]);_0x1ca632[_0x2f02('0x31')]=_[_0x2f02('0x30')](_0x2841d3[_0x2f02('0x31')]);_0x1ca632[_0x2f02('0x32')]=_[_0x2f02('0x33')](_0x1ca632[_0x2f02('0x2f')],_0x1ca632[_0x2f02('0x31')]);_0x189cf0[_0x2f02('0x35')]=_[_0x2f02('0x33')](_0x1ca632[_0x2f02('0x2f')],qs[_0x2f02('0x34')](_0x2841d3['query'][_0x2f02('0x34')]));_0x189cf0['attributes']=_0x189cf0[_0x2f02('0x35')][_0x2f02('0x44')]?_0x189cf0[_0x2f02('0x35')]:_0x1ca632['model'];_0x189cf0['order']=qs[_0x2f02('0x38')](_0x2841d3[_0x2f02('0x31')][_0x2f02('0x38')]);_0x189cf0[_0x2f02('0x39')]=qs[_0x2f02('0x32')](_['pick'](_0x2841d3[_0x2f02('0x31')],_0x1ca632['filters']));if(_0x2841d3[_0x2f02('0x31')]['filter']){_0x189cf0['where']=_['merge'](_0x189cf0['where'],{'$or':_[_0x2f02('0x2a')](_0x189cf0[_0x2f02('0x35')],function(_0x3d8d14){var _0x5ed18d={};_0x5ed18d[_0x3d8d14]={'$like':'%'+_0x2841d3[_0x2f02('0x31')][_0x2f02('0x4b')]+'%'};return _0x5ed18d;})});}_0x189cf0=_['merge']({},_0x189cf0,_0x2841d3[_0x2f02('0x3d')]);return _0x445500[_0x2f02('0x4f')](_0x189cf0);}})[_0x2f02('0x24')](function(_0xd4786f){if(_0xd4786f){_0x37894c=_0xd4786f[_0x2f02('0x44')];if(!_0x2841d3[_0x2f02('0x31')][_0x2f02('0x36')](_0x2f02('0x37'))){_0x189cf0[_0x2f02('0x19')]=qs[_0x2f02('0x19')](_0x2841d3[_0x2f02('0x31')]['limit']);_0x189cf0[_0x2f02('0x1c')]=qs['offset'](_0x2841d3['query'][_0x2f02('0x1c')]);}return _0x445500[_0x2f02('0x4f')](_0x189cf0);}})[_0x2f02('0x24')](function(_0x1e9291){if(_0x1e9291){return _0x1e9291?{'count':_0x37894c,'rows':_0x1e9291}:null;}})['then'](respondWithResult(_0xd024cf,null))[_0x2f02('0x42')](handleError(_0xd024cf,null));};exports[_0x2f02('0x51')]=function(_0x2a3293,_0x134efb,_0x6599c){if(_0x2a3293['body']['id']){delete _0x2a3293[_0x2f02('0x47')]['id'];}return db[_0x2f02('0x2b')][_0x2f02('0x4c')]({'where':{'id':_0x2a3293[_0x2f02('0x43')]['id']}})[_0x2f02('0x24')](handleEntityNotFound(_0x134efb,null))[_0x2f02('0x24')](function(_0x53f289){if(_0x53f289){return _0x53f289[_0x2f02('0x51')](_0x2a3293[_0x2f02('0x47')][_0x2f02('0x52')]||[]);}return null;})[_0x2f02('0x24')](respondWithResult(_0x134efb,null))['catch'](handleError(_0x134efb,null));}; \ No newline at end of file +var _0x4539=['save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','ZendeskConfiguration','findAll','rows','show','catch','create','body','find','params','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0xf40d11,_0xb4dd63){var _0x2c21c8=function(_0x14a2cc){while(--_0x14a2cc){_0xf40d11['push'](_0xf40d11['shift']());}};_0x2c21c8(++_0xb4dd63);}(_0x4539,0x197));var _0x9453=function(_0x2bcd37,_0x5ed333){_0x2bcd37=_0x2bcd37-0x0;var _0x2cd0dd=_0x4539[_0x2bcd37];return _0x2cd0dd;};'use strict';var emlformat=require(_0x9453('0x0'));var rimraf=require(_0x9453('0x1'));var zipdir=require(_0x9453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9453('0x3'));var moment=require(_0x9453('0x4'));var BPromise=require(_0x9453('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9453('0x6'));var sox=require('sox');var csv=require(_0x9453('0x7'));var ejs=require(_0x9453('0x8'));var fs=require('fs');var fs_extra=require(_0x9453('0x9'));var _=require(_0x9453('0xa'));var squel=require(_0x9453('0xb'));var crypto=require(_0x9453('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9453('0xd'));var toCsv=require(_0x9453('0x7'));var querystring=require(_0x9453('0xe'));var Papa=require(_0x9453('0xf'));var Redis=require(_0x9453('0x10'));var authService=require(_0x9453('0x11'));var qs=require(_0x9453('0x12'));var as=require(_0x9453('0x13'));var hardwareService=require(_0x9453('0x14'));var logger=require(_0x9453('0x15'))(_0x9453('0x16'));var utils=require(_0x9453('0x17'));var config=require(_0x9453('0x18'));var licenseUtil=require(_0x9453('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cea9f,_0x321fe7){_0x321fe7=_0x321fe7||0xcc;return function(_0x25a7a1){if(_0x25a7a1){return _0x3cea9f[_0x9453('0x1a')](_0x321fe7);}return _0x3cea9f[_0x9453('0x1b')](_0x321fe7)[_0x9453('0x1c')]();};}function respondWithResult(_0x3eae6a,_0x541aaa){_0x541aaa=_0x541aaa||0xc8;return function(_0x31afd7){if(_0x31afd7){return _0x3eae6a[_0x9453('0x1b')](_0x541aaa)[_0x9453('0x1d')](_0x31afd7);}};}function respondWithFilteredResult(_0x3e33b9,_0x492b6f){return function(_0x23e46d){if(_0x23e46d){var _0x555bac=typeof _0x492b6f[_0x9453('0x1e')]===_0x9453('0x1f')&&typeof _0x492b6f['limit']===_0x9453('0x1f');var _0x1c9ffb=_0x23e46d[_0x9453('0x20')];var _0x542701=_0x555bac?0x0:_0x492b6f[_0x9453('0x1e')];var _0xf67d05=_0x555bac?_0x23e46d[_0x9453('0x20')]:_0x492b6f[_0x9453('0x1e')]+_0x492b6f[_0x9453('0x21')];var _0x1b74c2;if(_0xf67d05>=_0x1c9ffb){_0xf67d05=_0x1c9ffb;_0x1b74c2=0xc8;}else{_0x1b74c2=0xce;}_0x3e33b9[_0x9453('0x1b')](_0x1b74c2);return _0x3e33b9[_0x9453('0x22')](_0x9453('0x23'),_0x542701+'-'+_0xf67d05+'/'+_0x1c9ffb)['json'](_0x23e46d);}return null;};}function patchUpdates(_0x2a7801){return function(_0x3961c4){try{jsonpatch[_0x9453('0x24')](_0x3961c4,_0x2a7801,!![]);}catch(_0x1da68c){return BPromise[_0x9453('0x25')](_0x1da68c);}return _0x3961c4[_0x9453('0x26')]();};}function saveUpdates(_0x3d1c29,_0x2b02dd){return function(_0x2e0321){if(_0x2e0321){return _0x2e0321[_0x9453('0x27')](_0x3d1c29)['then'](function(_0x3b12d3){return _0x3b12d3;});}return null;};}function removeEntity(_0x10f323,_0x20f003){return function(_0x3353f7){if(_0x3353f7){return _0x3353f7['destroy']()[_0x9453('0x28')](function(){_0x10f323['status'](0xcc)[_0x9453('0x1c')]();});}};}function handleEntityNotFound(_0x560bde,_0x2f6bc2){return function(_0x27242f){if(!_0x27242f){_0x560bde[_0x9453('0x1a')](0x194);}return _0x27242f;};}function handleError(_0x43807a,_0x1bf400){_0x1bf400=_0x1bf400||0x1f4;return function(_0x1c1117){logger[_0x9453('0x29')](_0x1c1117[_0x9453('0x2a')]);if(_0x1c1117[_0x9453('0x2b')]){delete _0x1c1117[_0x9453('0x2b')];}_0x43807a['status'](_0x1bf400)[_0x9453('0x2c')](_0x1c1117);};}exports[_0x9453('0x2d')]=function(_0x4959c8,_0x837d73){var _0x3a3635={},_0x4419c0={},_0xce7c25={'count':0x0,'rows':[]};var _0x4b8fb9=_['map'](db['ZendeskConfiguration'][_0x9453('0x2e')],function(_0x10371c){return{'name':_0x10371c[_0x9453('0x2f')],'type':_0x10371c[_0x9453('0x30')][_0x9453('0x31')]};});_0x4419c0[_0x9453('0x32')]=_['map'](_0x4b8fb9,_0x9453('0x2b'));_0x4419c0[_0x9453('0x33')]=_[_0x9453('0x34')](_0x4959c8['query']);_0x4419c0[_0x9453('0x35')]=_[_0x9453('0x36')](_0x4419c0[_0x9453('0x32')],_0x4419c0[_0x9453('0x33')]);_0x3a3635['attributes']=_[_0x9453('0x36')](_0x4419c0[_0x9453('0x32')],qs[_0x9453('0x37')](_0x4959c8[_0x9453('0x33')][_0x9453('0x37')]));_0x3a3635[_0x9453('0x38')]=_0x3a3635[_0x9453('0x38')][_0x9453('0x39')]?_0x3a3635['attributes']:_0x4419c0[_0x9453('0x32')];if(!_0x4959c8[_0x9453('0x33')]['hasOwnProperty'](_0x9453('0x3a'))){_0x3a3635[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x4959c8[_0x9453('0x33')][_0x9453('0x21')]);_0x3a3635[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x4959c8[_0x9453('0x33')][_0x9453('0x1e')]);}_0x3a3635[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x4959c8[_0x9453('0x33')][_0x9453('0x3c')]);_0x3a3635['where']=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x4959c8[_0x9453('0x33')],_0x4419c0['filters']),_0x4b8fb9);if(_0x4959c8[_0x9453('0x33')][_0x9453('0x3e')]){_0x3a3635[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x3a3635[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x4b8fb9,function(_0x84799f){if(_0x84799f[_0x9453('0x30')]!==_0x9453('0x42')){var _0x35bb47={};_0x35bb47[_0x84799f[_0x9453('0x2b')]]={'$like':'%'+_0x4959c8[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x35bb47;}})});}_0x3a3635=_[_0x9453('0x40')]({},_0x3a3635,_0x4959c8[_0x9453('0x43')]);var _0x5a0f74={'where':_0x3a3635[_0x9453('0x3f')]};return db['ZendeskConfiguration']['count'](_0x5a0f74)[_0x9453('0x28')](function(_0x504649){_0xce7c25[_0x9453('0x20')]=_0x504649;if(_0x4959c8[_0x9453('0x33')][_0x9453('0x44')]){_0x3a3635[_0x9453('0x45')]=[{'all':!![]}];}return db[_0x9453('0x46')][_0x9453('0x47')](_0x3a3635);})['then'](function(_0x3c6979){_0xce7c25[_0x9453('0x48')]=_0x3c6979;return _0xce7c25;})[_0x9453('0x28')](respondWithFilteredResult(_0x837d73,_0x3a3635))['catch'](handleError(_0x837d73,null));};exports[_0x9453('0x49')]=function(_0x52efb3,_0x5cedff){var _0x219ed0={'raw':![],'where':{'id':_0x52efb3['params']['id']}},_0x4fe278={};_0x4fe278[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x46')][_0x9453('0x2e')]);_0x4fe278[_0x9453('0x33')]=_[_0x9453('0x34')](_0x52efb3[_0x9453('0x33')]);_0x4fe278[_0x9453('0x35')]=_['intersection'](_0x4fe278['model'],_0x4fe278[_0x9453('0x33')]);_0x219ed0[_0x9453('0x38')]=_[_0x9453('0x36')](_0x4fe278[_0x9453('0x32')],qs['fields'](_0x52efb3['query'][_0x9453('0x37')]));_0x219ed0[_0x9453('0x38')]=_0x219ed0[_0x9453('0x38')][_0x9453('0x39')]?_0x219ed0[_0x9453('0x38')]:_0x4fe278[_0x9453('0x32')];if(_0x52efb3[_0x9453('0x33')][_0x9453('0x44')]){_0x219ed0['include']=[{'all':!![]}];}_0x219ed0=_[_0x9453('0x40')]({},_0x219ed0,_0x52efb3[_0x9453('0x43')]);return db[_0x9453('0x46')]['find'](_0x219ed0)['then'](handleEntityNotFound(_0x5cedff,null))[_0x9453('0x28')](respondWithResult(_0x5cedff,null))[_0x9453('0x4a')](handleError(_0x5cedff,null));};exports[_0x9453('0x4b')]=function(_0x2748ff,_0x1a513f){return db[_0x9453('0x46')][_0x9453('0x4b')](_0x2748ff[_0x9453('0x4c')],{})[_0x9453('0x28')](respondWithResult(_0x1a513f,0xc9))['catch'](handleError(_0x1a513f,null));};exports['update']=function(_0x46143a,_0x1018c6){if(_0x46143a[_0x9453('0x4c')]['id']){delete _0x46143a[_0x9453('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x9453('0x4d')]({'where':{'id':_0x46143a[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x1018c6,null))[_0x9453('0x28')](saveUpdates(_0x46143a[_0x9453('0x4c')],null))['then'](respondWithResult(_0x1018c6,null))[_0x9453('0x4a')](handleError(_0x1018c6,null));};exports['destroy']=function(_0x3ede82,_0x222037){return db['ZendeskConfiguration'][_0x9453('0x4d')]({'where':{'id':_0x3ede82['params']['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x222037,null))[_0x9453('0x28')](removeEntity(_0x222037,null))[_0x9453('0x4a')](handleError(_0x222037,null));};exports['getFields']=function(_0x4fcee1,_0x3a62d2,_0x14c565){var _0x2d687a={};var _0x7a019f={};var _0x15e23f;var _0x5edb9b;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x4fcee1[_0x9453('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a62d2,null))[_0x9453('0x28')](function(_0x354a05){if(_0x354a05){_0x15e23f=_0x354a05;_0x7a019f[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x50')][_0x9453('0x2e')]);_0x7a019f['query']=_[_0x9453('0x34')](_0x4fcee1[_0x9453('0x33')]);_0x7a019f[_0x9453('0x35')]=_[_0x9453('0x36')](_0x7a019f[_0x9453('0x32')],_0x7a019f['query']);_0x2d687a[_0x9453('0x38')]=_[_0x9453('0x36')](_0x7a019f[_0x9453('0x32')],qs[_0x9453('0x37')](_0x4fcee1['query'][_0x9453('0x37')]));_0x2d687a[_0x9453('0x38')]=_0x2d687a[_0x9453('0x38')]['length']?_0x2d687a[_0x9453('0x38')]:_0x7a019f[_0x9453('0x32')];_0x2d687a[_0x9453('0x3b')]=qs['sort'](_0x4fcee1['query'][_0x9453('0x3c')]);_0x2d687a[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x4fcee1[_0x9453('0x33')],_0x7a019f[_0x9453('0x35')]));if(_0x4fcee1[_0x9453('0x33')][_0x9453('0x3e')]){_0x2d687a[_0x9453('0x3f')]=_['merge'](_0x2d687a[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x2d687a[_0x9453('0x38')],function(_0x41df60){var _0x588c3e={};_0x588c3e[_0x41df60]={'$like':'%'+_0x4fcee1[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x588c3e;})});}_0x2d687a=_[_0x9453('0x40')]({},_0x2d687a,_0x4fcee1['options']);return _0x15e23f[_0x9453('0x51')](_0x2d687a);}})[_0x9453('0x28')](function(_0x55e617){if(_0x55e617){_0x5edb9b=_0x55e617[_0x9453('0x39')];if(!_0x4fcee1[_0x9453('0x33')][_0x9453('0x52')]('nolimit')){_0x2d687a[_0x9453('0x21')]=qs['limit'](_0x4fcee1[_0x9453('0x33')][_0x9453('0x21')]);_0x2d687a[_0x9453('0x1e')]=qs['offset'](_0x4fcee1[_0x9453('0x33')][_0x9453('0x1e')]);}return _0x15e23f['getFields'](_0x2d687a);}})[_0x9453('0x28')](function(_0x587e81){if(_0x587e81){return _0x587e81?{'count':_0x5edb9b,'rows':_0x587e81}:null;}})[_0x9453('0x28')](respondWithResult(_0x3a62d2,null))[_0x9453('0x4a')](handleError(_0x3a62d2,null));};exports[_0x9453('0x53')]=function(_0x3fd9b9,_0x11e635,_0x7517d6){var _0x27ab72={};var _0x3a75e9={};var _0x4e6b67;var _0x4af379;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x3fd9b9['params']['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x11e635,null))[_0x9453('0x28')](function(_0x2f4288){if(_0x2f4288){_0x4e6b67=_0x2f4288;_0x3a75e9[_0x9453('0x32')]=_['keys'](db['ZendeskField'][_0x9453('0x2e')]);_0x3a75e9[_0x9453('0x33')]=_['keys'](_0x3fd9b9['query']);_0x3a75e9['filters']=_[_0x9453('0x36')](_0x3a75e9[_0x9453('0x32')],_0x3a75e9[_0x9453('0x33')]);_0x27ab72[_0x9453('0x38')]=_[_0x9453('0x36')](_0x3a75e9[_0x9453('0x32')],qs[_0x9453('0x37')](_0x3fd9b9[_0x9453('0x33')]['fields']));_0x27ab72['attributes']=_0x27ab72[_0x9453('0x38')][_0x9453('0x39')]?_0x27ab72[_0x9453('0x38')]:_0x3a75e9[_0x9453('0x32')];_0x27ab72[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3c')]);_0x27ab72[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x3fd9b9[_0x9453('0x33')],_0x3a75e9[_0x9453('0x35')]));if(_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3e')]){_0x27ab72[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x27ab72[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x27ab72['attributes'],function(_0x48c7a0){var _0x1d2f8e={};_0x1d2f8e[_0x48c7a0]={'$like':'%'+_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x1d2f8e;})});}_0x27ab72=_[_0x9453('0x40')]({},_0x27ab72,_0x3fd9b9[_0x9453('0x43')]);return _0x4e6b67[_0x9453('0x53')](_0x27ab72);}})[_0x9453('0x28')](function(_0x5c3bb3){if(_0x5c3bb3){_0x4af379=_0x5c3bb3['length'];if(!_0x3fd9b9[_0x9453('0x33')][_0x9453('0x52')]('nolimit')){_0x27ab72[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x21')]);_0x27ab72[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x1e')]);}return _0x4e6b67[_0x9453('0x53')](_0x27ab72);}})[_0x9453('0x28')](function(_0x43acc0){if(_0x43acc0){return _0x43acc0?{'count':_0x4af379,'rows':_0x43acc0}:null;}})[_0x9453('0x28')](respondWithResult(_0x11e635,null))[_0x9453('0x4a')](handleError(_0x11e635,null));};exports['getDescriptions']=function(_0x17107d,_0x21c7cb,_0x215ac6){var _0x5986d7={};var _0x39a4e5={};var _0x465260;var _0x492a82;return db[_0x9453('0x46')]['findOne']({'where':{'id':_0x17107d[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x21c7cb,null))[_0x9453('0x28')](function(_0x1ead4f){if(_0x1ead4f){_0x465260=_0x1ead4f;_0x39a4e5[_0x9453('0x32')]=_[_0x9453('0x34')](db['ZendeskField'][_0x9453('0x2e')]);_0x39a4e5[_0x9453('0x33')]=_[_0x9453('0x34')](_0x17107d[_0x9453('0x33')]);_0x39a4e5['filters']=_['intersection'](_0x39a4e5[_0x9453('0x32')],_0x39a4e5['query']);_0x5986d7[_0x9453('0x38')]=_[_0x9453('0x36')](_0x39a4e5[_0x9453('0x32')],qs[_0x9453('0x37')](_0x17107d[_0x9453('0x33')][_0x9453('0x37')]));_0x5986d7[_0x9453('0x38')]=_0x5986d7[_0x9453('0x38')][_0x9453('0x39')]?_0x5986d7['attributes']:_0x39a4e5[_0x9453('0x32')];_0x5986d7['order']=qs[_0x9453('0x3c')](_0x17107d[_0x9453('0x33')][_0x9453('0x3c')]);_0x5986d7['where']=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x17107d[_0x9453('0x33')],_0x39a4e5[_0x9453('0x35')]));if(_0x17107d[_0x9453('0x33')]['filter']){_0x5986d7[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x5986d7[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x5986d7[_0x9453('0x38')],function(_0x2d1019){var _0x5bbc62={};_0x5bbc62[_0x2d1019]={'$like':'%'+_0x17107d[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x5bbc62;})});}_0x5986d7=_[_0x9453('0x40')]({},_0x5986d7,_0x17107d[_0x9453('0x43')]);return _0x465260[_0x9453('0x54')](_0x5986d7);}})['then'](function(_0x3ba654){if(_0x3ba654){_0x492a82=_0x3ba654[_0x9453('0x39')];if(!_0x17107d[_0x9453('0x33')][_0x9453('0x52')](_0x9453('0x3a'))){_0x5986d7[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x17107d[_0x9453('0x33')][_0x9453('0x21')]);_0x5986d7[_0x9453('0x1e')]=qs['offset'](_0x17107d[_0x9453('0x33')]['offset']);}return _0x465260[_0x9453('0x54')](_0x5986d7);}})[_0x9453('0x28')](function(_0x55a7d0){if(_0x55a7d0){return _0x55a7d0?{'count':_0x492a82,'rows':_0x55a7d0}:null;}})[_0x9453('0x28')](respondWithResult(_0x21c7cb,null))['catch'](handleError(_0x21c7cb,null));};exports[_0x9453('0x55')]=function(_0x38c556,_0x469982,_0x210f69){var _0x105719={};var _0x8e317f={};var _0x4dfa2f;var _0x3a2a95;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x38c556['params']['id']}})['then'](handleEntityNotFound(_0x469982,null))[_0x9453('0x28')](function(_0x39d8d7){if(_0x39d8d7){_0x4dfa2f=_0x39d8d7;_0x8e317f[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x56')]['rawAttributes']);_0x8e317f[_0x9453('0x33')]=_[_0x9453('0x34')](_0x38c556['query']);_0x8e317f[_0x9453('0x35')]=_[_0x9453('0x36')](_0x8e317f['model'],_0x8e317f[_0x9453('0x33')]);_0x105719[_0x9453('0x38')]=_[_0x9453('0x36')](_0x8e317f[_0x9453('0x32')],qs['fields'](_0x38c556[_0x9453('0x33')][_0x9453('0x37')]));_0x105719[_0x9453('0x38')]=_0x105719[_0x9453('0x38')]['length']?_0x105719[_0x9453('0x38')]:_0x8e317f[_0x9453('0x32')];_0x105719[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x38c556[_0x9453('0x33')]['sort']);_0x105719[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x38c556[_0x9453('0x33')],_0x8e317f[_0x9453('0x35')]));if(_0x38c556[_0x9453('0x33')][_0x9453('0x3e')]){_0x105719['where']=_[_0x9453('0x40')](_0x105719[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x105719['attributes'],function(_0x1826bd){var _0x24da59={};_0x24da59[_0x1826bd]={'$like':'%'+_0x38c556[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x24da59;})});}_0x105719=_[_0x9453('0x40')]({},_0x105719,_0x38c556[_0x9453('0x43')]);return _0x4dfa2f[_0x9453('0x55')](_0x105719);}})[_0x9453('0x28')](function(_0x105053){if(_0x105053){_0x3a2a95=_0x105053['length'];if(!_0x38c556[_0x9453('0x33')]['hasOwnProperty'](_0x9453('0x3a'))){_0x105719[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x38c556[_0x9453('0x33')][_0x9453('0x21')]);_0x105719[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x38c556['query'][_0x9453('0x1e')]);}return _0x4dfa2f['getTags'](_0x105719);}})[_0x9453('0x28')](function(_0x5bb9e0){if(_0x5bb9e0){return _0x5bb9e0?{'count':_0x3a2a95,'rows':_0x5bb9e0}:null;}})[_0x9453('0x28')](respondWithResult(_0x469982,null))[_0x9453('0x4a')](handleError(_0x469982,null));};exports[_0x9453('0x57')]=function(_0x2ae3d5,_0x2561bd,_0x551eb0){if(_0x2ae3d5[_0x9453('0x4c')]['id']){delete _0x2ae3d5[_0x9453('0x4c')]['id'];}return db[_0x9453('0x46')]['findOne']({'where':{'id':_0x2ae3d5[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x2561bd,null))[_0x9453('0x28')](function(_0x47694c){if(_0x47694c){return _0x47694c[_0x9453('0x57')](_0x2ae3d5['body'][_0x9453('0x58')]||[]);}return null;})[_0x9453('0x28')](respondWithResult(_0x2561bd,null))[_0x9453('0x4a')](handleError(_0x2561bd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f7b6b8e..b14bcce 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 _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x168c8e,_0x5187fa){_0x168c8e=_0x168c8e-0x0;var _0x16f740=_0xe1e3[_0x168c8e];return _0x16f740;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x21deb4,_0xf0afcc){var _0x2b3858=function(_0x2224a7){while(--_0x2224a7){_0x21deb4['push'](_0x21deb4['shift']());}};_0x2b3858(++_0xf0afcc);}(_0xefda,0x96));var _0xaefd=function(_0xddf898,_0x505284){_0xddf898=_0xddf898-0x0;var _0x1017c3=_0xefda[_0xddf898];return _0x1017c3;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 5c8b1ed..881bdf9 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 _0x981d=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x981d,0xc4));var _0xd981=function(_0x25ea94,_0x5ddc2a){_0x25ea94=_0x25ea94-0x0;var _0x10a151=_0x981d[_0x25ea94];return _0x10a151;};'use strict';var _=require(_0xd981('0x0'));var util=require('util');var moment=require(_0xd981('0x1'));var BPromise=require(_0xd981('0x2'));var rs=require(_0xd981('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd981('0x4'));var logger=require(_0xd981('0x5'))(_0xd981('0x6'));var config=require(_0xd981('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd981('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42be34,_0x55da1d,_0x4998d6){return new BPromise(function(_0x34a39f,_0x2accc3){return client['request'](_0x42be34,_0x4998d6)[_0xd981('0x9')](function(_0x37879e){logger['info'](_0xd981('0xa'),_0x55da1d,_0xd981('0xb'));logger[_0xd981('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x55da1d,_0xd981('0xb'),JSON['stringify'](_0x37879e));if(_0x37879e[_0xd981('0xd')]){if(_0x37879e[_0xd981('0xd')][_0xd981('0xe')]===0x1f4){logger[_0xd981('0xd')](_0xd981('0xa'),_0x55da1d,_0x37879e[_0xd981('0xd')][_0xd981('0xf')]);return _0x2accc3(_0x37879e['error'][_0xd981('0xf')]);}logger[_0xd981('0xd')](_0xd981('0xa'),_0x55da1d,_0x37879e[_0xd981('0xd')][_0xd981('0xf')]);return _0x34a39f(_0x37879e[_0xd981('0xd')][_0xd981('0xf')]);}else{logger[_0xd981('0x10')](_0xd981('0xa'),_0x55da1d,_0xd981('0xb'));_0x34a39f(_0x37879e[_0xd981('0x11')][_0xd981('0xf')]);}})[_0xd981('0x12')](function(_0x5462e7){logger[_0xd981('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x55da1d,_0x5462e7);_0x2accc3(_0x5462e7);});});} \ No newline at end of file +var _0xf921=['request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32ee89,_0x2ba492){var _0x10e742=function(_0x192335){while(--_0x192335){_0x32ee89['push'](_0x32ee89['shift']());}};_0x10e742(++_0x2ba492);}(_0xf921,0xfd));var _0x1f92=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xf921[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x1f92('0x0'));var util=require(_0x1f92('0x1'));var moment=require(_0x1f92('0x2'));var BPromise=require(_0x1f92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f92('0x4'));var db=require(_0x1f92('0x5'))['db'];var utils=require(_0x1f92('0x6'));var logger=require(_0x1f92('0x7'))(_0x1f92('0x8'));var config=require(_0x1f92('0x9'));var jayson=require(_0x1f92('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x241bbe,_0x36904b,_0xd77eb4){return new BPromise(function(_0x221004,_0x494461){return client[_0x1f92('0xb')](_0x241bbe,_0xd77eb4)['then'](function(_0x565be9){logger[_0x1f92('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,'request\x20sent');logger[_0x1f92('0xd')](_0x1f92('0xe'),_0x36904b,_0x1f92('0xf'),JSON[_0x1f92('0x10')](_0x565be9));if(_0x565be9[_0x1f92('0x11')]){if(_0x565be9[_0x1f92('0x11')][_0x1f92('0x12')]===0x1f4){logger['error'](_0x1f92('0x13'),_0x36904b,_0x565be9['error'][_0x1f92('0x14')]);return _0x494461(_0x565be9[_0x1f92('0x11')]['message']);}logger['error'](_0x1f92('0x13'),_0x36904b,_0x565be9[_0x1f92('0x11')][_0x1f92('0x14')]);return _0x221004(_0x565be9[_0x1f92('0x11')][_0x1f92('0x14')]);}else{logger[_0x1f92('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,_0x1f92('0xf'));_0x221004(_0x565be9['result']['message']);}})[_0x1f92('0x15')](function(_0x44fc58){logger[_0x1f92('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,_0x44fc58);_0x494461(_0x44fc58);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 38bb283..eab2688 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 _0xc8e5=['put','update','delete','destroy','exports','path','express','Router','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3ec5ff,_0x47eaab){var _0x2d0c97=function(_0x5f3013){while(--_0x5f3013){_0x3ec5ff['push'](_0x3ec5ff['shift']());}};_0x2d0c97(++_0x47eaab);}(_0xc8e5,0x1e5));var _0x5c8e=function(_0xf71f56,_0x565452){_0xf71f56=_0xf71f56-0x0;var _0x852cc3=_0xc8e5[_0xf71f56];return _0x852cc3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c8e('0x0'));var timeout=require('connect-timeout');var express=require(_0x5c8e('0x1'));var router=express[_0x5c8e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5c8e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c8e('0x4'));router[_0x5c8e('0x5')]('/',auth[_0x5c8e('0x6')](),controller[_0x5c8e('0x7')]);router[_0x5c8e('0x5')](_0x5c8e('0x8'),auth[_0x5c8e('0x6')](),controller[_0x5c8e('0x9')]);router['post']('/',auth[_0x5c8e('0x6')](),controller[_0x5c8e('0xa')]);router[_0x5c8e('0xb')](_0x5c8e('0x8'),auth['isAuthenticated'](),controller[_0x5c8e('0xc')]);router[_0x5c8e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5c8e('0xe')]);module[_0x5c8e('0xf')]=router; \ No newline at end of file +var _0x2a30=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x5ad512,_0x16aec4){var _0x34180a=function(_0x1c1ab6){while(--_0x1c1ab6){_0x5ad512['push'](_0x5ad512['shift']());}};_0x34180a(++_0x16aec4);}(_0x2a30,0x1dd));var _0x02a3=function(_0x52852c,_0x27f53a){_0x52852c=_0x52852c-0x0;var _0x245a12=_0x2a30[_0x52852c];return _0x245a12;};'use strict';var multer=require(_0x02a3('0x0'));var util=require(_0x02a3('0x1'));var path=require(_0x02a3('0x2'));var timeout=require(_0x02a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02a3('0x4'));var interaction=require(_0x02a3('0x5'));var config=require(_0x02a3('0x6'));var controller=require('./intZendeskField.controller');router[_0x02a3('0x7')]('/',auth[_0x02a3('0x8')](),controller[_0x02a3('0x9')]);router[_0x02a3('0x7')](_0x02a3('0xa'),auth[_0x02a3('0x8')](),controller['show']);router['post']('/',auth[_0x02a3('0x8')](),controller[_0x02a3('0xb')]);router[_0x02a3('0xc')](_0x02a3('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x02a3('0xd')](_0x02a3('0xa'),auth[_0x02a3('0x8')](),controller[_0x02a3('0xe')]);module[_0x02a3('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 feae7aa..efea63f 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 _0xe641=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0xe1bc41,_0x542c9c){var _0x412094=function(_0x5559f1){while(--_0x5559f1){_0xe1bc41['push'](_0xe1bc41['shift']());}};_0x412094(++_0x542c9c);}(_0xe641,0x1e3));var _0x1e64=function(_0x3111f0,_0x572cfc){_0x3111f0=_0x3111f0-0x0;var _0x405fa0=_0xe641[_0x3111f0];return _0x405fa0;};'use strict';var Sequelize=require(_0x1e64('0x0'));module[_0x1e64('0x1')]={'type':{'type':Sequelize[_0x1e64('0x2')](_0x1e64('0x3'),_0x1e64('0x4'),_0x1e64('0x5'),'keyValue',_0x1e64('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1e64('0x7')]},'key':{'type':Sequelize[_0x1e64('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1e64('0x7')]},'nameField':{'type':Sequelize[_0x1e64('0x7')]},'customField':{'type':Sequelize[_0x1e64('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed61=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed61,0x162));var _0x1ed6=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0xed61[_0xeaba4b];return _0x32f4fd;};'use strict';var Sequelize=require(_0x1ed6('0x0'));module['exports']={'type':{'type':Sequelize[_0x1ed6('0x1')](_0x1ed6('0x2'),_0x1ed6('0x3'),_0x1ed6('0x4'),'keyValue','picklist'),'defaultValue':_0x1ed6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1ed6('0x5')]},'keyType':{'type':Sequelize[_0x1ed6('0x1')]('string',_0x1ed6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1ed6('0x5')]},'idField':{'type':Sequelize[_0x1ed6('0x5')]},'nameField':{'type':Sequelize[_0x1ed6('0x5')]},'customField':{'type':Sequelize[_0x1ed6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ed6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9d12e72..3ace852 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 _0x72e3=['include','ZendeskField','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','end','error','stack','name','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options'];(function(_0x4f0f86,_0x41b0ec){var _0x1747c3=function(_0x155d04){while(--_0x155d04){_0x4f0f86['push'](_0x4f0f86['shift']());}};_0x1747c3(++_0x41b0ec);}(_0x72e3,0x1b7));var _0x372e=function(_0x46a315,_0x349379){_0x46a315=_0x46a315-0x0;var _0x222760=_0x72e3[_0x46a315];return _0x222760;};'use strict';var emlformat=require(_0x372e('0x0'));var rimraf=require(_0x372e('0x1'));var zipdir=require(_0x372e('0x2'));var jsonpatch=require(_0x372e('0x3'));var rp=require(_0x372e('0x4'));var moment=require(_0x372e('0x5'));var BPromise=require(_0x372e('0x6'));var Mustache=require(_0x372e('0x7'));var util=require('util');var path=require(_0x372e('0x8'));var sox=require('sox');var csv=require(_0x372e('0x9'));var ejs=require(_0x372e('0xa'));var fs=require('fs');var fs_extra=require(_0x372e('0xb'));var _=require(_0x372e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x372e('0xd'));var deskjs=require(_0x372e('0xe'));var toCsv=require(_0x372e('0x9'));var querystring=require(_0x372e('0xf'));var Papa=require('papaparse');var Redis=require(_0x372e('0x10'));var authService=require(_0x372e('0x11'));var qs=require(_0x372e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x372e('0x13'));var utils=require(_0x372e('0x14'));var config=require(_0x372e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103c9c,_0x3a7e07){_0x3a7e07=_0x3a7e07||0xcc;return function(_0x355760){if(_0x355760){return _0x103c9c[_0x372e('0x16')](_0x3a7e07);}return _0x103c9c[_0x372e('0x17')](_0x3a7e07)['end']();};}function respondWithResult(_0xa1ef5f,_0x21c0bd){_0x21c0bd=_0x21c0bd||0xc8;return function(_0xe5fff){if(_0xe5fff){return _0xa1ef5f[_0x372e('0x17')](_0x21c0bd)[_0x372e('0x18')](_0xe5fff);}};}function respondWithFilteredResult(_0x54e64a,_0x161b45){return function(_0x97ab89){if(_0x97ab89){var _0x559e0b=typeof _0x161b45[_0x372e('0x19')]==='undefined'&&typeof _0x161b45[_0x372e('0x1a')]===_0x372e('0x1b');var _0x471de0=_0x97ab89[_0x372e('0x1c')];var _0x3c2f81=_0x559e0b?0x0:_0x161b45[_0x372e('0x19')];var _0xf2b941=_0x559e0b?_0x97ab89[_0x372e('0x1c')]:_0x161b45[_0x372e('0x19')]+_0x161b45['limit'];var _0x1f81e3;if(_0xf2b941>=_0x471de0){_0xf2b941=_0x471de0;_0x1f81e3=0xc8;}else{_0x1f81e3=0xce;}_0x54e64a[_0x372e('0x17')](_0x1f81e3);return _0x54e64a['set']('Content-Range',_0x3c2f81+'-'+_0xf2b941+'/'+_0x471de0)[_0x372e('0x18')](_0x97ab89);}return null;};}function patchUpdates(_0xe28082){return function(_0x400a68){try{jsonpatch[_0x372e('0x1d')](_0x400a68,_0xe28082,!![]);}catch(_0x4ae02a){return BPromise[_0x372e('0x1e')](_0x4ae02a);}return _0x400a68[_0x372e('0x1f')]();};}function saveUpdates(_0x59931a,_0x675cd3){return function(_0x46102a){if(_0x46102a){return _0x46102a[_0x372e('0x20')](_0x59931a)[_0x372e('0x21')](function(_0x1d3be9){return _0x1d3be9;});}return null;};}function removeEntity(_0x34af21,_0x3d9e78){return function(_0x44ab92){if(_0x44ab92){return _0x44ab92[_0x372e('0x22')]()[_0x372e('0x21')](function(){_0x34af21[_0x372e('0x17')](0xcc)[_0x372e('0x23')]();});}};}function handleEntityNotFound(_0x139b53,_0x57852d){return function(_0x44d19e){if(!_0x44d19e){_0x139b53['sendStatus'](0x194);}return _0x44d19e;};}function handleError(_0x4eee56,_0x13e9cc){_0x13e9cc=_0x13e9cc||0x1f4;return function(_0x4b7321){logger[_0x372e('0x24')](_0x4b7321[_0x372e('0x25')]);if(_0x4b7321[_0x372e('0x26')]){delete _0x4b7321[_0x372e('0x26')];}_0x4eee56[_0x372e('0x17')](_0x13e9cc)['send'](_0x4b7321);};}exports[_0x372e('0x27')]=function(_0x24e524,_0x595b78){var _0x2cdde3={},_0x42ca8f={},_0x453ed4={'count':0x0,'rows':[]};var _0x52e93c=_['map'](db['ZendeskField']['rawAttributes'],function(_0xee8dde){return{'name':_0xee8dde[_0x372e('0x28')],'type':_0xee8dde[_0x372e('0x29')][_0x372e('0x2a')]};});_0x42ca8f[_0x372e('0x2b')]=_[_0x372e('0x2c')](_0x52e93c,_0x372e('0x26'));_0x42ca8f[_0x372e('0x2d')]=_['keys'](_0x24e524[_0x372e('0x2d')]);_0x42ca8f[_0x372e('0x2e')]=_[_0x372e('0x2f')](_0x42ca8f[_0x372e('0x2b')],_0x42ca8f[_0x372e('0x2d')]);_0x2cdde3['attributes']=_[_0x372e('0x2f')](_0x42ca8f[_0x372e('0x2b')],qs[_0x372e('0x30')](_0x24e524[_0x372e('0x2d')][_0x372e('0x30')]));_0x2cdde3[_0x372e('0x31')]=_0x2cdde3[_0x372e('0x31')]['length']?_0x2cdde3[_0x372e('0x31')]:_0x42ca8f[_0x372e('0x2b')];if(!_0x24e524[_0x372e('0x2d')][_0x372e('0x32')](_0x372e('0x33'))){_0x2cdde3[_0x372e('0x1a')]=qs[_0x372e('0x1a')](_0x24e524[_0x372e('0x2d')]['limit']);_0x2cdde3['offset']=qs[_0x372e('0x19')](_0x24e524[_0x372e('0x2d')][_0x372e('0x19')]);}_0x2cdde3[_0x372e('0x34')]=qs['sort'](_0x24e524[_0x372e('0x2d')]['sort']);_0x2cdde3[_0x372e('0x35')]=qs['filters'](_[_0x372e('0x36')](_0x24e524[_0x372e('0x2d')],_0x42ca8f[_0x372e('0x2e')]),_0x52e93c);if(_0x24e524[_0x372e('0x2d')]['filter']){_0x2cdde3[_0x372e('0x35')]=_[_0x372e('0x37')](_0x2cdde3[_0x372e('0x35')],{'$or':_['map'](_0x52e93c,function(_0x21e977){if(_0x21e977[_0x372e('0x29')]!==_0x372e('0x38')){var _0x3f7adc={};_0x3f7adc[_0x21e977[_0x372e('0x26')]]={'$like':'%'+_0x24e524[_0x372e('0x2d')]['filter']+'%'};return _0x3f7adc;}})});}_0x2cdde3=_[_0x372e('0x37')]({},_0x2cdde3,_0x24e524[_0x372e('0x39')]);var _0x50c042={'where':_0x2cdde3[_0x372e('0x35')]};return db['ZendeskField']['count'](_0x50c042)[_0x372e('0x21')](function(_0x44fc77){_0x453ed4[_0x372e('0x1c')]=_0x44fc77;if(_0x24e524['query']['includeAll']){_0x2cdde3[_0x372e('0x3a')]=[{'all':!![]}];}return db[_0x372e('0x3b')][_0x372e('0x3c')](_0x2cdde3);})[_0x372e('0x21')](function(_0x96e129){_0x453ed4[_0x372e('0x3d')]=_0x96e129;return _0x453ed4;})['then'](respondWithFilteredResult(_0x595b78,_0x2cdde3))[_0x372e('0x3e')](handleError(_0x595b78,null));};exports[_0x372e('0x3f')]=function(_0x291023,_0x3768c2){var _0x57765a={'raw':!![],'where':{'id':_0x291023['params']['id']}},_0x2edeeb={};_0x2edeeb[_0x372e('0x2b')]=_[_0x372e('0x40')](db[_0x372e('0x3b')][_0x372e('0x41')]);_0x2edeeb[_0x372e('0x2d')]=_['keys'](_0x291023[_0x372e('0x2d')]);_0x2edeeb[_0x372e('0x2e')]=_['intersection'](_0x2edeeb[_0x372e('0x2b')],_0x2edeeb[_0x372e('0x2d')]);_0x57765a[_0x372e('0x31')]=_[_0x372e('0x2f')](_0x2edeeb['model'],qs['fields'](_0x291023[_0x372e('0x2d')]['fields']));_0x57765a[_0x372e('0x31')]=_0x57765a['attributes']['length']?_0x57765a[_0x372e('0x31')]:_0x2edeeb[_0x372e('0x2b')];if(_0x291023[_0x372e('0x2d')][_0x372e('0x42')]){_0x57765a['include']=[{'all':!![]}];}_0x57765a=_['merge']({},_0x57765a,_0x291023[_0x372e('0x39')]);return db[_0x372e('0x3b')][_0x372e('0x43')](_0x57765a)['then'](handleEntityNotFound(_0x3768c2,null))[_0x372e('0x21')](respondWithResult(_0x3768c2,null))['catch'](handleError(_0x3768c2,null));};exports['create']=function(_0x299a60,_0x1d696d){return db[_0x372e('0x3b')][_0x372e('0x44')](_0x299a60[_0x372e('0x45')],{})[_0x372e('0x21')](respondWithResult(_0x1d696d,0xc9))[_0x372e('0x3e')](handleError(_0x1d696d,null));};exports[_0x372e('0x20')]=function(_0x117627,_0x3e651e){if(_0x117627[_0x372e('0x45')]['id']){delete _0x117627[_0x372e('0x45')]['id'];}return db[_0x372e('0x3b')][_0x372e('0x43')]({'where':{'id':_0x117627[_0x372e('0x46')]['id']}})[_0x372e('0x21')](handleEntityNotFound(_0x3e651e,null))[_0x372e('0x21')](saveUpdates(_0x117627[_0x372e('0x45')],null))[_0x372e('0x21')](respondWithResult(_0x3e651e,null))[_0x372e('0x3e')](handleError(_0x3e651e,null));};exports['destroy']=function(_0x4ee5fe,_0x525111){return db[_0x372e('0x3b')]['find']({'where':{'id':_0x4ee5fe['params']['id']}})[_0x372e('0x21')](handleEntityNotFound(_0x525111,null))[_0x372e('0x21')](removeEntity(_0x525111,null))[_0x372e('0x3e')](handleError(_0x525111,null));}; \ No newline at end of file +var _0xf0da=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0xf0da,0xe4));var _0xaf0d=function(_0x25cdfc,_0x4531c8){_0x25cdfc=_0x25cdfc-0x0;var _0x10e740=_0xf0da[_0x25cdfc];return _0x10e740;};'use strict';var emlformat=require(_0xaf0d('0x0'));var rimraf=require(_0xaf0d('0x1'));var zipdir=require(_0xaf0d('0x2'));var jsonpatch=require(_0xaf0d('0x3'));var rp=require(_0xaf0d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf0d('0x5'));var util=require(_0xaf0d('0x6'));var path=require(_0xaf0d('0x7'));var sox=require(_0xaf0d('0x8'));var csv=require('to-csv');var ejs=require(_0xaf0d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf0d('0xa'));var squel=require(_0xaf0d('0xb'));var crypto=require(_0xaf0d('0xc'));var jsforce=require(_0xaf0d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaf0d('0xe'));var querystring=require('querystring');var Papa=require(_0xaf0d('0xf'));var Redis=require(_0xaf0d('0x10'));var authService=require(_0xaf0d('0x11'));var qs=require(_0xaf0d('0x12'));var as=require(_0xaf0d('0x13'));var hardwareService=require(_0xaf0d('0x14'));var logger=require('../../config/logger')(_0xaf0d('0x15'));var utils=require(_0xaf0d('0x16'));var config=require(_0xaf0d('0x17'));var licenseUtil=require(_0xaf0d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3819b3,_0x4e0456){_0x4e0456=_0x4e0456||0xcc;return function(_0x362aaf){if(_0x362aaf){return _0x3819b3['sendStatus'](_0x4e0456);}return _0x3819b3[_0xaf0d('0x19')](_0x4e0456)[_0xaf0d('0x1a')]();};}function respondWithResult(_0x2fd3dd,_0x19e09a){_0x19e09a=_0x19e09a||0xc8;return function(_0x13d696){if(_0x13d696){return _0x2fd3dd[_0xaf0d('0x19')](_0x19e09a)[_0xaf0d('0x1b')](_0x13d696);}};}function respondWithFilteredResult(_0x35fba6,_0x30de1d){return function(_0x384193){if(_0x384193){var _0x3309f8=typeof _0x30de1d[_0xaf0d('0x1c')]===_0xaf0d('0x1d')&&typeof _0x30de1d[_0xaf0d('0x1e')]==='undefined';var _0x48fd51=_0x384193[_0xaf0d('0x1f')];var _0x3d17d0=_0x3309f8?0x0:_0x30de1d[_0xaf0d('0x1c')];var _0x11405c=_0x3309f8?_0x384193[_0xaf0d('0x1f')]:_0x30de1d[_0xaf0d('0x1c')]+_0x30de1d['limit'];var _0x2ef1c7;if(_0x11405c>=_0x48fd51){_0x11405c=_0x48fd51;_0x2ef1c7=0xc8;}else{_0x2ef1c7=0xce;}_0x35fba6[_0xaf0d('0x19')](_0x2ef1c7);return _0x35fba6[_0xaf0d('0x20')]('Content-Range',_0x3d17d0+'-'+_0x11405c+'/'+_0x48fd51)['json'](_0x384193);}return null;};}function patchUpdates(_0x1afe72){return function(_0x56754a){try{jsonpatch[_0xaf0d('0x21')](_0x56754a,_0x1afe72,!![]);}catch(_0x19163b){return BPromise[_0xaf0d('0x22')](_0x19163b);}return _0x56754a[_0xaf0d('0x23')]();};}function saveUpdates(_0x1d8504,_0x55675d){return function(_0x4a9454){if(_0x4a9454){return _0x4a9454[_0xaf0d('0x24')](_0x1d8504)['then'](function(_0x2a3954){return _0x2a3954;});}return null;};}function removeEntity(_0x393424,_0xb3498){return function(_0x27fac2){if(_0x27fac2){return _0x27fac2[_0xaf0d('0x25')]()[_0xaf0d('0x26')](function(){_0x393424[_0xaf0d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c463d,_0x41fa6b){return function(_0x416638){if(!_0x416638){_0x2c463d[_0xaf0d('0x27')](0x194);}return _0x416638;};}function handleError(_0x635105,_0x4f3aa5){_0x4f3aa5=_0x4f3aa5||0x1f4;return function(_0x208637){logger[_0xaf0d('0x28')](_0x208637['stack']);if(_0x208637[_0xaf0d('0x29')]){delete _0x208637['name'];}_0x635105[_0xaf0d('0x19')](_0x4f3aa5)[_0xaf0d('0x2a')](_0x208637);};}exports['index']=function(_0x1c036e,_0x2ba067){var _0xeb2690={},_0x3f7e7c={},_0x30498e={'count':0x0,'rows':[]};var _0x514bd2=_[_0xaf0d('0x2b')](db[_0xaf0d('0x2c')][_0xaf0d('0x2d')],function(_0x156d49){return{'name':_0x156d49[_0xaf0d('0x2e')],'type':_0x156d49[_0xaf0d('0x2f')][_0xaf0d('0x30')]};});_0x3f7e7c[_0xaf0d('0x31')]=_[_0xaf0d('0x2b')](_0x514bd2,_0xaf0d('0x29'));_0x3f7e7c[_0xaf0d('0x32')]=_['keys'](_0x1c036e[_0xaf0d('0x32')]);_0x3f7e7c['filters']=_[_0xaf0d('0x33')](_0x3f7e7c[_0xaf0d('0x31')],_0x3f7e7c[_0xaf0d('0x32')]);_0xeb2690[_0xaf0d('0x34')]=_[_0xaf0d('0x33')](_0x3f7e7c[_0xaf0d('0x31')],qs[_0xaf0d('0x35')](_0x1c036e['query']['fields']));_0xeb2690['attributes']=_0xeb2690[_0xaf0d('0x34')][_0xaf0d('0x36')]?_0xeb2690['attributes']:_0x3f7e7c[_0xaf0d('0x31')];if(!_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x37')](_0xaf0d('0x38'))){_0xeb2690[_0xaf0d('0x1e')]=qs[_0xaf0d('0x1e')](_0x1c036e['query'][_0xaf0d('0x1e')]);_0xeb2690[_0xaf0d('0x1c')]=qs[_0xaf0d('0x1c')](_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x1c')]);}_0xeb2690[_0xaf0d('0x39')]=qs['sort'](_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x3a')]);_0xeb2690[_0xaf0d('0x3b')]=qs['filters'](_[_0xaf0d('0x3c')](_0x1c036e['query'],_0x3f7e7c[_0xaf0d('0x3d')]),_0x514bd2);if(_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x3e')]){_0xeb2690[_0xaf0d('0x3b')]=_[_0xaf0d('0x3f')](_0xeb2690['where'],{'$or':_['map'](_0x514bd2,function(_0x219c25){if(_0x219c25[_0xaf0d('0x2f')]!==_0xaf0d('0x40')){var _0x34135a={};_0x34135a[_0x219c25[_0xaf0d('0x29')]]={'$like':'%'+_0x1c036e['query'][_0xaf0d('0x3e')]+'%'};return _0x34135a;}})});}_0xeb2690=_['merge']({},_0xeb2690,_0x1c036e[_0xaf0d('0x41')]);var _0x309a14={'where':_0xeb2690[_0xaf0d('0x3b')]};return db[_0xaf0d('0x2c')][_0xaf0d('0x1f')](_0x309a14)[_0xaf0d('0x26')](function(_0x570900){_0x30498e[_0xaf0d('0x1f')]=_0x570900;if(_0x1c036e[_0xaf0d('0x32')]['includeAll']){_0xeb2690['include']=[{'all':!![]}];}return db[_0xaf0d('0x2c')][_0xaf0d('0x42')](_0xeb2690);})[_0xaf0d('0x26')](function(_0x22e9fd){_0x30498e[_0xaf0d('0x43')]=_0x22e9fd;return _0x30498e;})['then'](respondWithFilteredResult(_0x2ba067,_0xeb2690))[_0xaf0d('0x44')](handleError(_0x2ba067,null));};exports[_0xaf0d('0x45')]=function(_0x1667c6,_0x5bb6e4){var _0x3d8e54={'raw':!![],'where':{'id':_0x1667c6[_0xaf0d('0x46')]['id']}},_0x2e705e={};_0x2e705e[_0xaf0d('0x31')]=_['keys'](db['ZendeskField'][_0xaf0d('0x2d')]);_0x2e705e[_0xaf0d('0x32')]=_[_0xaf0d('0x47')](_0x1667c6[_0xaf0d('0x32')]);_0x2e705e[_0xaf0d('0x3d')]=_[_0xaf0d('0x33')](_0x2e705e[_0xaf0d('0x31')],_0x2e705e[_0xaf0d('0x32')]);_0x3d8e54['attributes']=_[_0xaf0d('0x33')](_0x2e705e[_0xaf0d('0x31')],qs[_0xaf0d('0x35')](_0x1667c6['query'][_0xaf0d('0x35')]));_0x3d8e54[_0xaf0d('0x34')]=_0x3d8e54[_0xaf0d('0x34')][_0xaf0d('0x36')]?_0x3d8e54[_0xaf0d('0x34')]:_0x2e705e[_0xaf0d('0x31')];if(_0x1667c6[_0xaf0d('0x32')][_0xaf0d('0x48')]){_0x3d8e54[_0xaf0d('0x49')]=[{'all':!![]}];}_0x3d8e54=_[_0xaf0d('0x3f')]({},_0x3d8e54,_0x1667c6[_0xaf0d('0x41')]);return db[_0xaf0d('0x2c')]['find'](_0x3d8e54)[_0xaf0d('0x26')](handleEntityNotFound(_0x5bb6e4,null))[_0xaf0d('0x26')](respondWithResult(_0x5bb6e4,null))[_0xaf0d('0x44')](handleError(_0x5bb6e4,null));};exports[_0xaf0d('0x4a')]=function(_0x5328a2,_0x1e5352){return db[_0xaf0d('0x2c')][_0xaf0d('0x4a')](_0x5328a2[_0xaf0d('0x4b')],{})[_0xaf0d('0x26')](respondWithResult(_0x1e5352,0xc9))[_0xaf0d('0x44')](handleError(_0x1e5352,null));};exports[_0xaf0d('0x24')]=function(_0x376460,_0x3bad38){if(_0x376460[_0xaf0d('0x4b')]['id']){delete _0x376460['body']['id'];}return db[_0xaf0d('0x2c')]['find']({'where':{'id':_0x376460['params']['id']}})[_0xaf0d('0x26')](handleEntityNotFound(_0x3bad38,null))[_0xaf0d('0x26')](saveUpdates(_0x376460[_0xaf0d('0x4b')],null))[_0xaf0d('0x26')](respondWithResult(_0x3bad38,null))[_0xaf0d('0x44')](handleError(_0x3bad38,null));};exports[_0xaf0d('0x25')]=function(_0x101e4a,_0x36b394){return db[_0xaf0d('0x2c')]['find']({'where':{'id':_0x101e4a[_0xaf0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x36b394,null))['then'](removeEntity(_0x36b394,null))[_0xaf0d('0x44')](handleError(_0x36b394,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index ee1cb0e..38d8c8a 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 _0x9170=['int_zendesk_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x1625d5,_0x2cb18b){var _0x5f0d99=function(_0x23cbb8){while(--_0x23cbb8){_0x1625d5['push'](_0x1625d5['shift']());}};_0x5f0d99(++_0x2cb18b);}(_0x9170,0x162));var _0x0917=function(_0x3cef5f,_0x3e71b2){_0x3cef5f=_0x3cef5f-0x0;var _0x26f6f1=_0x9170[_0x3cef5f];return _0x26f6f1;};'use strict';var _=require(_0x0917('0x0'));var util=require(_0x0917('0x1'));var logger=require(_0x0917('0x2'))('api');var moment=require(_0x0917('0x3'));var BPromise=require(_0x0917('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0917('0x5'));var rimraf=require(_0x0917('0x6'));var config=require(_0x0917('0x7'));var attributes=require(_0x0917('0x8'));module['exports']=function(_0x5ada04,_0x19890f){return _0x5ada04['define']('ZendeskField',attributes,{'tableName':_0x0917('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x0917('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa19=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaa19,0x14e));var _0x9aa1=function(_0x1ce8f7,_0x43ed1d){_0x1ce8f7=_0x1ce8f7-0x0;var _0x5cc47c=_0xaa19[_0x1ce8f7];return _0x5cc47c;};'use strict';var _=require(_0x9aa1('0x0'));var util=require('util');var logger=require(_0x9aa1('0x1'))('api');var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rp=require(_0x9aa1('0x4'));var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require(_0x9aa1('0x6'));var config=require('../../config/environment');var attributes=require(_0x9aa1('0x7'));module[_0x9aa1('0x8')]=function(_0x5e1733,_0x53ada5){return _0x5e1733[_0x9aa1('0x9')](_0x9aa1('0xa'),attributes,{'tableName':_0x9aa1('0xb'),'paranoid':![],'indexes':[{'name':_0x9aa1('0xc'),'fields':[_0x9aa1('0xd'),_0x9aa1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 328e0ca..d2b2184 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 _0x7410=['client','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7410,0xaf));var _0x0741=function(_0x5b526c,_0x46c064){_0x5b526c=_0x5b526c-0x0;var _0x46f721=_0x7410[_0x5b526c];return _0x46f721;};'use strict';var _=require('lodash');var util=require(_0x0741('0x0'));var moment=require(_0x0741('0x1'));var BPromise=require(_0x0741('0x2'));var rs=require(_0x0741('0x3'));var fs=require('fs');var Redis=require(_0x0741('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0741('0x5'));var logger=require(_0x0741('0x6'))(_0x0741('0x7'));var config=require('../../config/environment');var jayson=require(_0x0741('0x8'));var client=jayson[_0x0741('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f91cc,_0xf1f10b,_0x4d861e){return new BPromise(function(_0x2353ae,_0xf4fa46){return client[_0x0741('0xa')](_0x1f91cc,_0x4d861e)[_0x0741('0xb')](function(_0x4dfa24){logger[_0x0741('0xc')](_0x0741('0xd'),_0xf1f10b,'request\x20sent');logger[_0x0741('0xe')](_0x0741('0xf'),_0xf1f10b,_0x0741('0x10'),JSON[_0x0741('0x11')](_0x4dfa24));if(_0x4dfa24[_0x0741('0x12')]){if(_0x4dfa24[_0x0741('0x12')][_0x0741('0x13')]===0x1f4){logger[_0x0741('0x12')](_0x0741('0xd'),_0xf1f10b,_0x4dfa24[_0x0741('0x12')][_0x0741('0x14')]);return _0xf4fa46(_0x4dfa24[_0x0741('0x12')][_0x0741('0x14')]);}logger[_0x0741('0x12')]('ZendeskField,\x20%s,\x20%s',_0xf1f10b,_0x4dfa24[_0x0741('0x12')][_0x0741('0x14')]);return _0x2353ae(_0x4dfa24[_0x0741('0x12')][_0x0741('0x14')]);}else{logger[_0x0741('0xc')](_0x0741('0xd'),_0xf1f10b,_0x0741('0x10'));_0x2353ae(_0x4dfa24[_0x0741('0x15')][_0x0741('0x14')]);}})[_0x0741('0x16')](function(_0x131e3b){logger[_0x0741('0x12')](_0x0741('0xd'),_0xf1f10b,_0x131e3b);_0xf4fa46(_0x131e3b);});});} \ No newline at end of file +var _0x09ce=['client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3126c9,_0x14fd9d){var _0x2fd6d5=function(_0x49c145){while(--_0x49c145){_0x3126c9['push'](_0x3126c9['shift']());}};_0x2fd6d5(++_0x14fd9d);}(_0x09ce,0x1ad));var _0xe09c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x09ce[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe09c('0x0'));var util=require(_0xe09c('0x1'));var moment=require(_0xe09c('0x2'));var BPromise=require(_0xe09c('0x3'));var rs=require(_0xe09c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe09c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe09c('0x6'));var jayson=require(_0xe09c('0x7'));var client=jayson[_0xe09c('0x8')][_0xe09c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xab7e6e,_0x5f5a85,_0x48fd9d){return new BPromise(function(_0x3eb97f,_0x2f8344){return client[_0xe09c('0xa')](_0xab7e6e,_0x48fd9d)[_0xe09c('0xb')](function(_0x13ba4d){logger['info'](_0xe09c('0xc'),_0x5f5a85,_0xe09c('0xd'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5f5a85,_0xe09c('0xd'),JSON['stringify'](_0x13ba4d));if(_0x13ba4d[_0xe09c('0xe')]){if(_0x13ba4d[_0xe09c('0xe')][_0xe09c('0xf')]===0x1f4){logger[_0xe09c('0xe')]('ZendeskField,\x20%s,\x20%s',_0x5f5a85,_0x13ba4d[_0xe09c('0xe')][_0xe09c('0x10')]);return _0x2f8344(_0x13ba4d[_0xe09c('0xe')][_0xe09c('0x10')]);}logger[_0xe09c('0xe')](_0xe09c('0xc'),_0x5f5a85,_0x13ba4d['error'][_0xe09c('0x10')]);return _0x3eb97f(_0x13ba4d['error'][_0xe09c('0x10')]);}else{logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x5f5a85,_0xe09c('0xd'));_0x3eb97f(_0x13ba4d['result'][_0xe09c('0x10')]);}})[_0xe09c('0x12')](function(_0x7fc36a){logger[_0xe09c('0xe')]('ZendeskField,\x20%s,\x20%s',_0x5f5a85,_0x7fc36a);_0x2f8344(_0x7fc36a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 16ea146..efa27aa 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 _0x32bf=['express','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','delete','multer','util','path','connect-timeout'];(function(_0xaa2879,_0x4ee69d){var _0x46c394=function(_0x586242){while(--_0x586242){_0xaa2879['push'](_0xaa2879['shift']());}};_0x46c394(++_0x4ee69d);}(_0x32bf,0x1c8));var _0xf32b=function(_0x123b4a,_0x3e483b){_0x123b4a=_0x123b4a-0x0;var _0x1a1c19=_0x32bf[_0x123b4a];return _0x1a1c19;};'use strict';var multer=require(_0xf32b('0x0'));var util=require(_0xf32b('0x1'));var path=require(_0xf32b('0x2'));var timeout=require(_0xf32b('0x3'));var express=require(_0xf32b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf32b('0x5'));var interaction=require(_0xf32b('0x6'));var config=require('../../config/environment');var controller=require(_0xf32b('0x7'));router[_0xf32b('0x8')]('/',auth[_0xf32b('0x9')](),controller[_0xf32b('0xa')]);router[_0xf32b('0x8')](_0xf32b('0xb'),auth[_0xf32b('0x9')](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xf32b('0xc')]);router[_0xf32b('0x8')](_0xf32b('0xd'),auth[_0xf32b('0x9')](),controller[_0xf32b('0xe')]);router[_0xf32b('0xf')]('/',auth[_0xf32b('0x9')](),controller[_0xf32b('0x10')]);router[_0xf32b('0xf')](_0xf32b('0x11'),auth[_0xf32b('0x9')](),controller['addConfiguration']);router['put'](_0xf32b('0xb'),auth[_0xf32b('0x9')](),controller[_0xf32b('0x12')]);router[_0xf32b('0x13')](_0xf32b('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1a3d=['Router','fs-extra','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','connect-timeout','express'];(function(_0x56bad1,_0x2af2e6){var _0x53bab9=function(_0x4fff6e){while(--_0x4fff6e){_0x56bad1['push'](_0x56bad1['shift']());}};_0x53bab9(++_0x2af2e6);}(_0x1a3d,0xce));var _0xd1a3=function(_0x2f808d,_0x55fa16){_0x2f808d=_0x2f808d-0x0;var _0x447df1=_0x1a3d[_0x2f808d];return _0x447df1;};'use strict';var multer=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var path=require('path');var timeout=require(_0xd1a3('0x2'));var express=require(_0xd1a3('0x3'));var router=express[_0xd1a3('0x4')]();var fs_extra=require(_0xd1a3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1a3('0x6'));router[_0xd1a3('0x7')]('/',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x9')]);router['get']('/:id',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0xa')]);router[_0xd1a3('0x7')](_0xd1a3('0xb'),auth['isAuthenticated'](),controller[_0xd1a3('0xc')]);router['get'](_0xd1a3('0xd'),auth[_0xd1a3('0x8')](),controller[_0xd1a3('0xe')]);router[_0xd1a3('0xf')]('/',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x10')]);router[_0xd1a3('0xf')](_0xd1a3('0xb'),auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x11')]);router[_0xd1a3('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x13')]);module[_0xd1a3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 2563d09..fb753c9 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 _0x99e9=['exports','STRING'];(function(_0x24f389,_0x45fcff){var _0x772e99=function(_0xed89e2){while(--_0xed89e2){_0x24f389['push'](_0x24f389['shift']());}};_0x772e99(++_0x45fcff);}(_0x99e9,0xb4));var _0x999e=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x99e9[_0x264b9b];return _0x4c7a0e;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0x5636=['sequelize','exports','STRING'];(function(_0x4a7966,_0x452594){var _0x4c61ed=function(_0x3a89db){while(--_0x3a89db){_0x4a7966['push'](_0x4a7966['shift']());}};_0x4c61ed(++_0x452594);}(_0x5636,0x102));var _0x6563=function(_0x50f1c1,_0x15eb5e){_0x50f1c1=_0x50f1c1-0x0;var _0x7614f5=_0x5636[_0x50f1c1];return _0x7614f5;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3b4b164..9bd4997 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 _0x80fd=['error','name','index','map','ZohoAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','destroy','params','getConfigurations','ZohoConfiguration','order','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','code','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x80fd,0x1ce));var _0xd80f=function(_0x20a859,_0x4f826d){_0x20a859=_0x20a859-0x0;var _0x581ada=_0x80fd[_0x20a859];return _0x581ada;};'use strict';var emlformat=require(_0xd80f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd80f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd80f('0x3'));var path=require(_0xd80f('0x4'));var sox=require(_0xd80f('0x5'));var csv=require(_0xd80f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd80f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd80f('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd80f('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd80f('0xa'));var Redis=require(_0xd80f('0xb'));var authService=require(_0xd80f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd80f('0xd'));var hardwareService=require(_0xd80f('0xe'));var logger=require(_0xd80f('0xf'))(_0xd80f('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd80f('0x11'));var db=require(_0xd80f('0x12'))['db'];var integrations=require(_0xd80f('0x13'));function respondWithStatusCode(_0x33ee4c,_0x36f1a4){_0x36f1a4=_0x36f1a4||0xcc;return function(_0x42fb33){if(_0x42fb33){return _0x33ee4c[_0xd80f('0x14')](_0x36f1a4);}return _0x33ee4c[_0xd80f('0x15')](_0x36f1a4)[_0xd80f('0x16')]();};}function respondWithResult(_0x4dda38,_0x5c9165){_0x5c9165=_0x5c9165||0xc8;return function(_0x18359b){if(_0x18359b){return _0x4dda38['status'](_0x5c9165)[_0xd80f('0x17')](_0x18359b);}};}function respondWithFilteredResult(_0xda9105,_0x5e96c8){return function(_0x231338){if(_0x231338){var _0x2c0e85=typeof _0x5e96c8[_0xd80f('0x18')]==='undefined'&&typeof _0x5e96c8[_0xd80f('0x19')]===_0xd80f('0x1a');var _0x3624c7=_0x231338[_0xd80f('0x1b')];var _0x484997=_0x2c0e85?0x0:_0x5e96c8[_0xd80f('0x18')];var _0x1270ed=_0x2c0e85?_0x231338[_0xd80f('0x1b')]:_0x5e96c8['offset']+_0x5e96c8[_0xd80f('0x19')];var _0x50c527;if(_0x1270ed>=_0x3624c7){_0x1270ed=_0x3624c7;_0x50c527=0xc8;}else{_0x50c527=0xce;}_0xda9105[_0xd80f('0x15')](_0x50c527);return _0xda9105[_0xd80f('0x1c')](_0xd80f('0x1d'),_0x484997+'-'+_0x1270ed+'/'+_0x3624c7)[_0xd80f('0x17')](_0x231338);}return null;};}function patchUpdates(_0x2df496){return function(_0x3e2860){try{jsonpatch[_0xd80f('0x1e')](_0x3e2860,_0x2df496,!![]);}catch(_0x313ab3){return BPromise[_0xd80f('0x1f')](_0x313ab3);}return _0x3e2860['save']();};}function saveUpdates(_0x116b26,_0x42a005){return function(_0x562d8a){if(_0x562d8a){return _0x562d8a[_0xd80f('0x20')](_0x116b26)[_0xd80f('0x21')](function(_0x41e599){return _0x41e599;});}return null;};}function removeEntity(_0x289b30,_0x268f46){return function(_0xefd830){if(_0xefd830){return _0xefd830['destroy']()[_0xd80f('0x21')](function(){_0x289b30[_0xd80f('0x15')](0xcc)[_0xd80f('0x16')]();});}};}function handleEntityNotFound(_0x4062b4,_0x38b672){return function(_0x2ecac9){if(!_0x2ecac9){_0x4062b4['sendStatus'](0x194);}return _0x2ecac9;};}function handleError(_0x357d01,_0x59e2d9){_0x59e2d9=_0x59e2d9||0x1f4;return function(_0x382261){logger[_0xd80f('0x22')](_0x382261['stack']);if(_0x382261['name']){delete _0x382261[_0xd80f('0x23')];}_0x357d01[_0xd80f('0x15')](_0x59e2d9)['send'](_0x382261);};}exports[_0xd80f('0x24')]=function(_0x2f2261,_0x2c0d97){var _0x3a8216={},_0x514946={},_0x133390={'count':0x0,'rows':[]};var _0x3c5468=_[_0xd80f('0x25')](db[_0xd80f('0x26')][_0xd80f('0x27')],function(_0x28d3b5){return{'name':_0x28d3b5['fieldName'],'type':_0x28d3b5['type'][_0xd80f('0x28')]};});_0x514946[_0xd80f('0x29')]=_[_0xd80f('0x25')](_0x3c5468,'name');_0x514946[_0xd80f('0x2a')]=_['keys'](_0x2f2261['query']);_0x514946[_0xd80f('0x2b')]=_[_0xd80f('0x2c')](_0x514946[_0xd80f('0x29')],_0x514946['query']);_0x3a8216[_0xd80f('0x2d')]=_['intersection'](_0x514946[_0xd80f('0x29')],qs['fields'](_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x2e')]));_0x3a8216['attributes']=_0x3a8216[_0xd80f('0x2d')][_0xd80f('0x2f')]?_0x3a8216[_0xd80f('0x2d')]:_0x514946[_0xd80f('0x29')];if(!_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x30')]('nolimit')){_0x3a8216['limit']=qs['limit'](_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x19')]);_0x3a8216['offset']=qs['offset'](_0x2f2261[_0xd80f('0x2a')]['offset']);}_0x3a8216['order']=qs[_0xd80f('0x31')](_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x31')]);_0x3a8216[_0xd80f('0x32')]=qs['filters'](_['pick'](_0x2f2261[_0xd80f('0x2a')],_0x514946[_0xd80f('0x2b')]),_0x3c5468);if(_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x33')]){_0x3a8216[_0xd80f('0x32')]=_['merge'](_0x3a8216[_0xd80f('0x32')],{'$or':_[_0xd80f('0x25')](_0x3c5468,function(_0x29ddf3){if(_0x29ddf3['type']!=='VIRTUAL'){var _0x239a86={};_0x239a86[_0x29ddf3['name']]={'$like':'%'+_0x2f2261['query'][_0xd80f('0x33')]+'%'};return _0x239a86;}})});}_0x3a8216=_[_0xd80f('0x34')]({},_0x3a8216,_0x2f2261[_0xd80f('0x35')]);var _0x646b64={'where':_0x3a8216['where']};return db[_0xd80f('0x26')][_0xd80f('0x1b')](_0x646b64)[_0xd80f('0x21')](function(_0x26a052){_0x133390[_0xd80f('0x1b')]=_0x26a052;if(_0x2f2261[_0xd80f('0x2a')][_0xd80f('0x36')]){_0x3a8216[_0xd80f('0x37')]=[{'all':!![]}];}return db[_0xd80f('0x26')][_0xd80f('0x38')](_0x3a8216);})[_0xd80f('0x21')](function(_0x32c7e5){_0x133390[_0xd80f('0x39')]=_0x32c7e5;return _0x133390;})[_0xd80f('0x21')](respondWithFilteredResult(_0x2c0d97,_0x3a8216))['catch'](handleError(_0x2c0d97,null));};exports[_0xd80f('0x3a')]=function(_0x19e97a,_0x12e223){var _0x25f1ac={'raw':![],'where':{'id':_0x19e97a['params']['id']}},_0x55144f={};_0x55144f[_0xd80f('0x29')]=_['keys'](db[_0xd80f('0x26')][_0xd80f('0x27')]);_0x55144f['query']=_[_0xd80f('0x3b')](_0x19e97a['query']);_0x55144f[_0xd80f('0x2b')]=_[_0xd80f('0x2c')](_0x55144f[_0xd80f('0x29')],_0x55144f[_0xd80f('0x2a')]);_0x25f1ac[_0xd80f('0x2d')]=_[_0xd80f('0x2c')](_0x55144f[_0xd80f('0x29')],qs['fields'](_0x19e97a[_0xd80f('0x2a')][_0xd80f('0x2e')]));_0x25f1ac[_0xd80f('0x2d')]=_0x25f1ac[_0xd80f('0x2d')][_0xd80f('0x2f')]?_0x25f1ac[_0xd80f('0x2d')]:_0x55144f[_0xd80f('0x29')];if(_0x19e97a[_0xd80f('0x2a')][_0xd80f('0x36')]){_0x25f1ac['include']=[{'all':!![]}];}_0x25f1ac=_[_0xd80f('0x34')]({},_0x25f1ac,_0x19e97a[_0xd80f('0x35')]);return db[_0xd80f('0x26')][_0xd80f('0x3c')](_0x25f1ac)['then'](handleEntityNotFound(_0x12e223,null))[_0xd80f('0x21')](respondWithResult(_0x12e223,null))[_0xd80f('0x3d')](handleError(_0x12e223,null));};exports[_0xd80f('0x3e')]=function(_0x3595d9,_0x16bbbb){return db[_0xd80f('0x26')][_0xd80f('0x3e')](_0x3595d9['body'],{})[_0xd80f('0x21')](respondWithResult(_0x16bbbb,0xc9))[_0xd80f('0x3d')](handleError(_0x16bbbb,null));};exports[_0xd80f('0x20')]=function(_0x662e20,_0x16c759){if(_0x662e20['body']['id']){delete _0x662e20['body']['id'];}return db[_0xd80f('0x26')][_0xd80f('0x3c')]({'where':{'id':_0x662e20['params']['id']}})[_0xd80f('0x21')](handleEntityNotFound(_0x16c759,null))['then'](saveUpdates(_0x662e20[_0xd80f('0x3f')],null))[_0xd80f('0x21')](respondWithResult(_0x16c759,null))['catch'](handleError(_0x16c759,null));};exports[_0xd80f('0x40')]=function(_0x4f779,_0x4f1f61){return db['ZohoAccount']['find']({'where':{'id':_0x4f779[_0xd80f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f1f61,null))[_0xd80f('0x21')](removeEntity(_0x4f1f61,null))['catch'](handleError(_0x4f1f61,null));};exports[_0xd80f('0x42')]=function(_0x5b09b8,_0xd26663,_0x235903){var _0x188bd0={};var _0x9616a8={};var _0x2f4c6d;var _0x111948;return db[_0xd80f('0x26')]['findOne']({'where':{'id':_0x5b09b8[_0xd80f('0x41')]['id']}})[_0xd80f('0x21')](handleEntityNotFound(_0xd26663,null))[_0xd80f('0x21')](function(_0xdf2571){if(_0xdf2571){_0x2f4c6d=_0xdf2571;_0x9616a8[_0xd80f('0x29')]=_[_0xd80f('0x3b')](db[_0xd80f('0x43')][_0xd80f('0x27')]);_0x9616a8[_0xd80f('0x2a')]=_[_0xd80f('0x3b')](_0x5b09b8['query']);_0x9616a8[_0xd80f('0x2b')]=_[_0xd80f('0x2c')](_0x9616a8[_0xd80f('0x29')],_0x9616a8[_0xd80f('0x2a')]);_0x188bd0['attributes']=_[_0xd80f('0x2c')](_0x9616a8[_0xd80f('0x29')],qs[_0xd80f('0x2e')](_0x5b09b8[_0xd80f('0x2a')][_0xd80f('0x2e')]));_0x188bd0[_0xd80f('0x2d')]=_0x188bd0[_0xd80f('0x2d')][_0xd80f('0x2f')]?_0x188bd0[_0xd80f('0x2d')]:_0x9616a8[_0xd80f('0x29')];_0x188bd0[_0xd80f('0x44')]=qs[_0xd80f('0x31')](_0x5b09b8['query'][_0xd80f('0x31')]);_0x188bd0['where']=qs[_0xd80f('0x2b')](_['pick'](_0x5b09b8[_0xd80f('0x2a')],_0x9616a8[_0xd80f('0x2b')]));if(_0x5b09b8[_0xd80f('0x2a')][_0xd80f('0x33')]){_0x188bd0[_0xd80f('0x32')]=_[_0xd80f('0x34')](_0x188bd0['where'],{'$or':_['map'](_0x188bd0[_0xd80f('0x2d')],function(_0x267800){var _0x435dcb={};_0x435dcb[_0x267800]={'$like':'%'+_0x5b09b8['query']['filter']+'%'};return _0x435dcb;})});}_0x188bd0=_[_0xd80f('0x34')]({},_0x188bd0,_0x5b09b8[_0xd80f('0x35')]);return _0x2f4c6d[_0xd80f('0x42')](_0x188bd0);}})[_0xd80f('0x21')](function(_0x3d35a1){if(_0x3d35a1){_0x111948=_0x3d35a1[_0xd80f('0x2f')];if(!_0x5b09b8[_0xd80f('0x2a')][_0xd80f('0x30')](_0xd80f('0x45'))){_0x188bd0['limit']=qs[_0xd80f('0x19')](_0x5b09b8[_0xd80f('0x2a')][_0xd80f('0x19')]);_0x188bd0['offset']=qs[_0xd80f('0x18')](_0x5b09b8[_0xd80f('0x2a')][_0xd80f('0x18')]);}return _0x2f4c6d[_0xd80f('0x42')](_0x188bd0);}})[_0xd80f('0x21')](function(_0x15db4e){if(_0x15db4e){return _0x15db4e?{'count':_0x111948,'rows':_0x15db4e}:null;}})[_0xd80f('0x21')](respondWithResult(_0xd26663,null))[_0xd80f('0x3d')](handleError(_0xd26663,null));};exports[_0xd80f('0x46')]=function(_0x2091bd,_0x213a4f,_0x3fdd23){if(_0x2091bd[_0xd80f('0x3f')]['id']){delete _0x2091bd[_0xd80f('0x3f')]['id'];}return db['ZohoAccount'][_0xd80f('0x47')]({'where':{'id':_0x2091bd[_0xd80f('0x41')]['id']}})[_0xd80f('0x21')](handleEntityNotFound(_0x213a4f,null))['then'](function(_0x5752f9){if(_0x5752f9){_0x2091bd[_0xd80f('0x3f')][_0xd80f('0x48')]=_0x5752f9['id'];_0x2091bd[_0xd80f('0x3f')][_0xd80f('0x49')]=integrations['getSubjects'](_0x2091bd[_0xd80f('0x3f')][_0xd80f('0x4a')],_0x2091bd[_0xd80f('0x3f')][_0xd80f('0x4b')]);_0x2091bd['body'][_0xd80f('0x4c')]=integrations[_0xd80f('0x4d')](_0x2091bd[_0xd80f('0x3f')][_0xd80f('0x4a')],_0x2091bd[_0xd80f('0x3f')]['type']);return db['ZohoConfiguration']['create'](_0x2091bd['body'],{'include':[{'model':db['ZohoField'],'as':_0xd80f('0x49')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xd80f('0x21')](respondWithResult(_0x213a4f,null))['catch'](handleError(_0x213a4f,null));};function getAccessToken(_0x29900e){return new Promise(function(_0x183bbe,_0x328aeb){var _0x237042;switch(_0x29900e[_0xd80f('0x4e')]){case'US':_0x237042=_0xd80f('0x4f');break;case'AU':_0x237042=_0xd80f('0x50');break;case'EU':_0x237042='https://accounts.zoho.eu';break;case'IN':_0x237042=_0xd80f('0x51');break;case'CN':_0x237042=_0xd80f('0x52');break;default:_0x237042=_0xd80f('0x53');break;}var _0xcb1db6={'method':_0xd80f('0x54'),'uri':_0x237042+_0xd80f('0x55'),'qs':{'refresh_token':_0x29900e[_0xd80f('0x56')],'client_id':_0x29900e[_0xd80f('0x57')],'client_secret':_0x29900e[_0xd80f('0x58')],'grant_type':_0xd80f('0x59')},'json':!![]};return rp(_0xcb1db6)[_0xd80f('0x21')](function(_0x24d6e1){if(_0x24d6e1[_0xd80f('0x5a')]){_0x183bbe(_0x24d6e1[_0xd80f('0x5a')]);}else{_0x328aeb('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd80f('0x3d')](function(_0x548dbe){_0x328aeb(_0x548dbe);});});}exports[_0xd80f('0x5b')]=function(_0x420bbf,_0x150436,_0x1000d8){var _0x265c30,_0x3dd11a,_0x4cd265,_0x9ab3b7,_0x3d3088;return db[_0xd80f('0x26')]['findOne']({'where':{'id':_0x420bbf['params']['id']},'attributes':['id','host','zone',_0xd80f('0x57'),'clientSecret',_0xd80f('0x5c'),_0xd80f('0x5d'),_0xd80f('0x56')]})[_0xd80f('0x21')](handleEntityNotFound(_0x150436,null))[_0xd80f('0x21')](function(_0x3fe019){_0x3d3088=_0x3fe019;_0x265c30=_0x3d3088[_0xd80f('0x5e')];_0x3dd11a=_0x265c30==='zoho.eu'?'eu':_0xd80f('0x5f');_0x4cd265=_0x3d3088['serverUrl'];var _0x3bea3=_0x4cd265[_0xd80f('0x60')](-0x1);if(_0x3bea3==='/'||_0x3bea3==='\x5c'||_0x3bea3===':'){_0x4cd265=_0x4cd265[_0xd80f('0x61')](0x0,_0x4cd265[_0xd80f('0x62')](_0x3bea3));}if(!_0x3d3088[_0xd80f('0x56')]){throw new Error(_0xd80f('0x63'));}return getAccessToken(_0x3d3088);})[_0xd80f('0x21')](function(_0x1d6b5a){if(_0x1d6b5a){return rp({'method':_0xd80f('0x64'),'uri':util[_0xd80f('0x65')](_0xd80f('0x66'),_0x3dd11a),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd80f('0x67')+_0x1d6b5a},'json':!![]});}})['then'](function(_0x18d90f){if(_0x18d90f){if(_0x18d90f[_0xd80f('0x68')]&&_0x18d90f[_0xd80f('0x68')][_0xd80f('0x22')]){throw new Error(_0x18d90f['response']['error'][_0xd80f('0x69')]);}var _0x122538=[];var _0x44912d=[];var _0x4647f3=[_0xd80f('0x6a'),_0xd80f('0x6b'),_0xd80f('0x6c'),_0xd80f('0x6d'),'Call_Duration',_0xd80f('0x6e'),'Call_Start_Time',_0xd80f('0x6f')];_0x44912d=_[_0xd80f('0x70')](_0x18d90f['fields'],function(_0x561068){return _0x4647f3[_0xd80f('0x71')](_0x561068[_0xd80f('0x72')]);});for(var _0xd8ee4e=0x0;_0xd8ee4e<_0x44912d[_0xd80f('0x2f')];_0xd8ee4e++){if(_0x44912d[_0xd8ee4e][_0xd80f('0x73')]===![]){_0x122538['push']({'id':_0x44912d[_0xd8ee4e]['id'],'name':_0x44912d[_0xd8ee4e][_0xd80f('0x74')],'custom':_0x44912d[_0xd8ee4e]['custom_field'],'options':_0x44912d[_0xd8ee4e][_0xd80f('0x75')]==='picklist'&&_0x44912d[_0xd8ee4e]['pick_list_values'][_0xd80f('0x2f')]>-0x1?_[_0xd80f('0x25')](_0x44912d[_0xd8ee4e][_0xd80f('0x76')],function(_0x3912d4){return{'name':_0x3912d4,'value':_0x3912d4};}):[]});}}return{'count':_0x122538[_0xd80f('0x2f')],'rows':_0x122538};}else{return{'count':0x0,'rows':[]};}})[_0xd80f('0x21')](respondWithResult(_0x150436,null))[_0xd80f('0x3d')](function(_0xab219){var _0x323dbf=_0x420bbf[_0xd80f('0x2a')][_0xd80f('0x77')]?0x1f4:_0xab219[_0xd80f('0x78')]||0x1f4;logger[_0xd80f('0x22')](_0xd80f('0x79'),_0xd80f('0x5b'),_0x323dbf,JSON['stringify'](_0xab219));delete _0xab219[_0xd80f('0x23')];if(_0x323dbf===0x191){_0x323dbf=0x190;}_0x150436[_0xd80f('0x15')](_0x323dbf)[_0xd80f('0x7a')](_0x420bbf[_0xd80f('0x2a')][_0xd80f('0x77')]?{'message':_0xd80f('0x7b'),'statusCode':_0xab219['statusCode']}:_0xab219);});}; \ No newline at end of file +var _0x93b0=['clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','WhoId','Call_Result','includes','api_name','system_mandatory','push','custom_field','picklist','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','count','offset','set','Content-Range','json','reject','save','then','end','sendStatus','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken'];(function(_0x2c2a50,_0x86b25b){var _0x3f88f0=function(_0x347dd1){while(--_0x347dd1){_0x2c2a50['push'](_0x2c2a50['shift']());}};_0x3f88f0(++_0x86b25b);}(_0x93b0,0x196));var _0x093b=function(_0x28c342,_0x9ab475){_0x28c342=_0x28c342-0x0;var _0x1b0ae0=_0x93b0[_0x28c342];return _0x1b0ae0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x093b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x093b('0x1'));var rp=require('request-promise');var moment=require(_0x093b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x093b('0x3'));var path=require(_0x093b('0x4'));var sox=require(_0x093b('0x5'));var csv=require('to-csv');var ejs=require(_0x093b('0x6'));var fs=require('fs');var fs_extra=require(_0x093b('0x7'));var _=require(_0x093b('0x8'));var squel=require(_0x093b('0x9'));var crypto=require(_0x093b('0xa'));var jsforce=require(_0x093b('0xb'));var deskjs=require(_0x093b('0xc'));var toCsv=require(_0x093b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x093b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x093b('0xf'));var as=require(_0x093b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x093b('0x11'));var utils=require(_0x093b('0x12'));var config=require(_0x093b('0x13'));var licenseUtil=require(_0x093b('0x14'));var db=require(_0x093b('0x15'))['db'];var integrations=require(_0x093b('0x16'));function respondWithStatusCode(_0x2885b4,_0x18d17e){_0x18d17e=_0x18d17e||0xcc;return function(_0x39a696){if(_0x39a696){return _0x2885b4['sendStatus'](_0x18d17e);}return _0x2885b4[_0x093b('0x17')](_0x18d17e)['end']();};}function respondWithResult(_0x384127,_0x5aefe7){_0x5aefe7=_0x5aefe7||0xc8;return function(_0x5d7bab){if(_0x5d7bab){return _0x384127[_0x093b('0x17')](_0x5aefe7)['json'](_0x5d7bab);}};}function respondWithFilteredResult(_0x527966,_0xef7c8d){return function(_0x4e920b){if(_0x4e920b){var _0x578e6b=typeof _0xef7c8d['offset']===_0x093b('0x18')&&typeof _0xef7c8d['limit']==='undefined';var _0x4f454d=_0x4e920b[_0x093b('0x19')];var _0x506d50=_0x578e6b?0x0:_0xef7c8d['offset'];var _0x2725fa=_0x578e6b?_0x4e920b[_0x093b('0x19')]:_0xef7c8d[_0x093b('0x1a')]+_0xef7c8d['limit'];var _0x2e0f81;if(_0x2725fa>=_0x4f454d){_0x2725fa=_0x4f454d;_0x2e0f81=0xc8;}else{_0x2e0f81=0xce;}_0x527966[_0x093b('0x17')](_0x2e0f81);return _0x527966[_0x093b('0x1b')](_0x093b('0x1c'),_0x506d50+'-'+_0x2725fa+'/'+_0x4f454d)[_0x093b('0x1d')](_0x4e920b);}return null;};}function patchUpdates(_0x580873){return function(_0x519dae){try{jsonpatch['apply'](_0x519dae,_0x580873,!![]);}catch(_0x55bb7d){return BPromise[_0x093b('0x1e')](_0x55bb7d);}return _0x519dae[_0x093b('0x1f')]();};}function saveUpdates(_0x207e78,_0x11052b){return function(_0x11cc7d){if(_0x11cc7d){return _0x11cc7d['update'](_0x207e78)[_0x093b('0x20')](function(_0x3d9b34){return _0x3d9b34;});}return null;};}function removeEntity(_0x53bf29,_0x4ae7af){return function(_0x458dfb){if(_0x458dfb){return _0x458dfb['destroy']()['then'](function(){_0x53bf29['status'](0xcc)[_0x093b('0x21')]();});}};}function handleEntityNotFound(_0x2f737c,_0x2b81a3){return function(_0x319eef){if(!_0x319eef){_0x2f737c[_0x093b('0x22')](0x194);}return _0x319eef;};}function handleError(_0x3d9403,_0xfed10){_0xfed10=_0xfed10||0x1f4;return function(_0x36728d){logger['error'](_0x36728d['stack']);if(_0x36728d[_0x093b('0x23')]){delete _0x36728d[_0x093b('0x23')];}_0x3d9403[_0x093b('0x17')](_0xfed10)[_0x093b('0x24')](_0x36728d);};}exports[_0x093b('0x25')]=function(_0x1f3d2e,_0x490ebb){var _0x7d4f73={},_0x670d1c={},_0xb30645={'count':0x0,'rows':[]};var _0x49ffb7=_[_0x093b('0x26')](db[_0x093b('0x27')][_0x093b('0x28')],function(_0x134351){return{'name':_0x134351[_0x093b('0x29')],'type':_0x134351[_0x093b('0x2a')][_0x093b('0x2b')]};});_0x670d1c[_0x093b('0x2c')]=_[_0x093b('0x26')](_0x49ffb7,_0x093b('0x23'));_0x670d1c['query']=_[_0x093b('0x2d')](_0x1f3d2e['query']);_0x670d1c[_0x093b('0x2e')]=_[_0x093b('0x2f')](_0x670d1c[_0x093b('0x2c')],_0x670d1c[_0x093b('0x30')]);_0x7d4f73[_0x093b('0x31')]=_[_0x093b('0x2f')](_0x670d1c[_0x093b('0x2c')],qs[_0x093b('0x32')](_0x1f3d2e['query'][_0x093b('0x32')]));_0x7d4f73[_0x093b('0x31')]=_0x7d4f73[_0x093b('0x31')][_0x093b('0x33')]?_0x7d4f73[_0x093b('0x31')]:_0x670d1c[_0x093b('0x2c')];if(!_0x1f3d2e['query'][_0x093b('0x34')]('nolimit')){_0x7d4f73['limit']=qs[_0x093b('0x35')](_0x1f3d2e['query'][_0x093b('0x35')]);_0x7d4f73[_0x093b('0x1a')]=qs[_0x093b('0x1a')](_0x1f3d2e[_0x093b('0x30')]['offset']);}_0x7d4f73[_0x093b('0x36')]=qs[_0x093b('0x37')](_0x1f3d2e[_0x093b('0x30')][_0x093b('0x37')]);_0x7d4f73[_0x093b('0x38')]=qs[_0x093b('0x2e')](_[_0x093b('0x39')](_0x1f3d2e[_0x093b('0x30')],_0x670d1c[_0x093b('0x2e')]),_0x49ffb7);if(_0x1f3d2e[_0x093b('0x30')][_0x093b('0x3a')]){_0x7d4f73['where']=_[_0x093b('0x3b')](_0x7d4f73[_0x093b('0x38')],{'$or':_[_0x093b('0x26')](_0x49ffb7,function(_0xb8a874){if(_0xb8a874[_0x093b('0x2a')]!==_0x093b('0x3c')){var _0x22c757={};_0x22c757[_0xb8a874['name']]={'$like':'%'+_0x1f3d2e[_0x093b('0x30')]['filter']+'%'};return _0x22c757;}})});}_0x7d4f73=_[_0x093b('0x3b')]({},_0x7d4f73,_0x1f3d2e[_0x093b('0x3d')]);var _0x3fce26={'where':_0x7d4f73[_0x093b('0x38')]};return db[_0x093b('0x27')]['count'](_0x3fce26)[_0x093b('0x20')](function(_0x1bd7f8){_0xb30645['count']=_0x1bd7f8;if(_0x1f3d2e[_0x093b('0x30')][_0x093b('0x3e')]){_0x7d4f73[_0x093b('0x3f')]=[{'all':!![]}];}return db[_0x093b('0x27')][_0x093b('0x40')](_0x7d4f73);})['then'](function(_0x163936){_0xb30645[_0x093b('0x41')]=_0x163936;return _0xb30645;})['then'](respondWithFilteredResult(_0x490ebb,_0x7d4f73))[_0x093b('0x42')](handleError(_0x490ebb,null));};exports['show']=function(_0x261cc6,_0x576ba7){var _0x228e86={'raw':![],'where':{'id':_0x261cc6[_0x093b('0x43')]['id']}},_0x46ea87={};_0x46ea87[_0x093b('0x2c')]=_[_0x093b('0x2d')](db[_0x093b('0x27')][_0x093b('0x28')]);_0x46ea87[_0x093b('0x30')]=_['keys'](_0x261cc6['query']);_0x46ea87[_0x093b('0x2e')]=_['intersection'](_0x46ea87[_0x093b('0x2c')],_0x46ea87[_0x093b('0x30')]);_0x228e86[_0x093b('0x31')]=_[_0x093b('0x2f')](_0x46ea87['model'],qs['fields'](_0x261cc6[_0x093b('0x30')][_0x093b('0x32')]));_0x228e86[_0x093b('0x31')]=_0x228e86[_0x093b('0x31')][_0x093b('0x33')]?_0x228e86[_0x093b('0x31')]:_0x46ea87[_0x093b('0x2c')];if(_0x261cc6[_0x093b('0x30')][_0x093b('0x3e')]){_0x228e86['include']=[{'all':!![]}];}_0x228e86=_[_0x093b('0x3b')]({},_0x228e86,_0x261cc6[_0x093b('0x3d')]);return db[_0x093b('0x27')][_0x093b('0x44')](_0x228e86)[_0x093b('0x20')](handleEntityNotFound(_0x576ba7,null))[_0x093b('0x20')](respondWithResult(_0x576ba7,null))[_0x093b('0x42')](handleError(_0x576ba7,null));};exports[_0x093b('0x45')]=function(_0x1b53dd,_0x4056f5){return db['ZohoAccount']['create'](_0x1b53dd[_0x093b('0x46')],{})['then'](respondWithResult(_0x4056f5,0xc9))['catch'](handleError(_0x4056f5,null));};exports[_0x093b('0x47')]=function(_0x2a09db,_0x3e89c9){if(_0x2a09db[_0x093b('0x46')]['id']){delete _0x2a09db[_0x093b('0x46')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2a09db[_0x093b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e89c9,null))[_0x093b('0x20')](saveUpdates(_0x2a09db[_0x093b('0x46')],null))['then'](respondWithResult(_0x3e89c9,null))['catch'](handleError(_0x3e89c9,null));};exports['destroy']=function(_0x4bef40,_0x35dd7a){return db[_0x093b('0x27')][_0x093b('0x44')]({'where':{'id':_0x4bef40[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x35dd7a,null))[_0x093b('0x20')](removeEntity(_0x35dd7a,null))[_0x093b('0x42')](handleError(_0x35dd7a,null));};exports[_0x093b('0x48')]=function(_0x4f2515,_0x37f0d1,_0x16fb6c){var _0x19671f={};var _0x561392={};var _0x41c3f3;var _0x3689fe;return db['ZohoAccount'][_0x093b('0x49')]({'where':{'id':_0x4f2515[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x37f0d1,null))[_0x093b('0x20')](function(_0xcf4728){if(_0xcf4728){_0x41c3f3=_0xcf4728;_0x561392['model']=_[_0x093b('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x561392[_0x093b('0x30')]=_['keys'](_0x4f2515['query']);_0x561392[_0x093b('0x2e')]=_['intersection'](_0x561392[_0x093b('0x2c')],_0x561392['query']);_0x19671f['attributes']=_[_0x093b('0x2f')](_0x561392[_0x093b('0x2c')],qs['fields'](_0x4f2515[_0x093b('0x30')][_0x093b('0x32')]));_0x19671f[_0x093b('0x31')]=_0x19671f[_0x093b('0x31')][_0x093b('0x33')]?_0x19671f[_0x093b('0x31')]:_0x561392[_0x093b('0x2c')];_0x19671f[_0x093b('0x36')]=qs['sort'](_0x4f2515['query']['sort']);_0x19671f['where']=qs[_0x093b('0x2e')](_[_0x093b('0x39')](_0x4f2515[_0x093b('0x30')],_0x561392['filters']));if(_0x4f2515['query'][_0x093b('0x3a')]){_0x19671f[_0x093b('0x38')]=_[_0x093b('0x3b')](_0x19671f[_0x093b('0x38')],{'$or':_[_0x093b('0x26')](_0x19671f['attributes'],function(_0x4eb431){var _0x1f81a4={};_0x1f81a4[_0x4eb431]={'$like':'%'+_0x4f2515[_0x093b('0x30')][_0x093b('0x3a')]+'%'};return _0x1f81a4;})});}_0x19671f=_[_0x093b('0x3b')]({},_0x19671f,_0x4f2515[_0x093b('0x3d')]);return _0x41c3f3[_0x093b('0x48')](_0x19671f);}})[_0x093b('0x20')](function(_0x194c38){if(_0x194c38){_0x3689fe=_0x194c38[_0x093b('0x33')];if(!_0x4f2515[_0x093b('0x30')][_0x093b('0x34')](_0x093b('0x4a'))){_0x19671f[_0x093b('0x35')]=qs[_0x093b('0x35')](_0x4f2515[_0x093b('0x30')]['limit']);_0x19671f[_0x093b('0x1a')]=qs[_0x093b('0x1a')](_0x4f2515[_0x093b('0x30')][_0x093b('0x1a')]);}return _0x41c3f3[_0x093b('0x48')](_0x19671f);}})['then'](function(_0xa8d60b){if(_0xa8d60b){return _0xa8d60b?{'count':_0x3689fe,'rows':_0xa8d60b}:null;}})[_0x093b('0x20')](respondWithResult(_0x37f0d1,null))[_0x093b('0x42')](handleError(_0x37f0d1,null));};exports[_0x093b('0x4b')]=function(_0x2b88ee,_0x5df29b,_0x681050){if(_0x2b88ee[_0x093b('0x46')]['id']){delete _0x2b88ee[_0x093b('0x46')]['id'];}return db[_0x093b('0x27')][_0x093b('0x49')]({'where':{'id':_0x2b88ee[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x5df29b,null))[_0x093b('0x20')](function(_0xd29f93){if(_0xd29f93){_0x2b88ee[_0x093b('0x46')][_0x093b('0x4c')]=_0xd29f93['id'];_0x2b88ee[_0x093b('0x46')][_0x093b('0x4d')]=integrations['getSubjects'](_0x2b88ee[_0x093b('0x46')][_0x093b('0x4e')],_0x2b88ee[_0x093b('0x46')][_0x093b('0x2a')]);_0x2b88ee[_0x093b('0x46')][_0x093b('0x4f')]=integrations[_0x093b('0x50')](_0x2b88ee['body'][_0x093b('0x4e')],_0x2b88ee[_0x093b('0x46')][_0x093b('0x2a')]);return db['ZohoConfiguration'][_0x093b('0x45')](_0x2b88ee['body'],{'include':[{'model':db[_0x093b('0x51')],'as':_0x093b('0x4d')},{'model':db[_0x093b('0x51')],'as':_0x093b('0x4f')}]});}return null;})['then'](respondWithResult(_0x5df29b,null))[_0x093b('0x42')](handleError(_0x5df29b,null));};function getAccessToken(_0x4713e5){return new Promise(function(_0x277350,_0x3ec786){var _0x7a45bb;switch(_0x4713e5[_0x093b('0x52')]){case'US':_0x7a45bb=_0x093b('0x53');break;case'AU':_0x7a45bb=_0x093b('0x54');break;case'EU':_0x7a45bb='https://accounts.zoho.eu';break;case'IN':_0x7a45bb=_0x093b('0x55');break;case'CN':_0x7a45bb=_0x093b('0x56');break;default:_0x7a45bb='https://accounts.zoho.eu';break;}var _0x3a626d={'method':_0x093b('0x57'),'uri':_0x7a45bb+_0x093b('0x58'),'qs':{'refresh_token':_0x4713e5[_0x093b('0x59')],'client_id':_0x4713e5[_0x093b('0x5a')],'client_secret':_0x4713e5[_0x093b('0x5b')],'grant_type':_0x093b('0x5c')},'json':!![]};return rp(_0x3a626d)[_0x093b('0x20')](function(_0x499cb6){if(_0x499cb6[_0x093b('0x5d')]){_0x277350(_0x499cb6[_0x093b('0x5d')]);}else{_0x3ec786(_0x093b('0x5e'));}})[_0x093b('0x42')](function(_0x235abc){_0x3ec786(_0x235abc);});});}exports[_0x093b('0x5f')]=function(_0x3855cb,_0x2a83a9,_0x4a3408){var _0x3b1105,_0x4e3f49,_0x10d55a,_0x4b08a7,_0x31e25c;return db[_0x093b('0x27')][_0x093b('0x49')]({'where':{'id':_0x3855cb['params']['id']},'attributes':['id',_0x093b('0x60'),'zone',_0x093b('0x5a'),_0x093b('0x5b'),_0x093b('0x61'),_0x093b('0x62'),'refreshToken']})[_0x093b('0x20')](handleEntityNotFound(_0x2a83a9,null))['then'](function(_0x344f0b){_0x31e25c=_0x344f0b;_0x3b1105=_0x31e25c['host'];_0x4e3f49=_0x3b1105===_0x093b('0x63')?'eu':'com';_0x10d55a=_0x31e25c[_0x093b('0x61')];var _0x3d8fdf=_0x10d55a[_0x093b('0x64')](-0x1);if(_0x3d8fdf==='/'||_0x3d8fdf==='\x5c'||_0x3d8fdf===':'){_0x10d55a=_0x10d55a[_0x093b('0x65')](0x0,_0x10d55a[_0x093b('0x66')](_0x3d8fdf));}if(!_0x31e25c[_0x093b('0x59')]){throw new Error(_0x093b('0x67'));}return getAccessToken(_0x31e25c);})['then'](function(_0x561977){if(_0x561977){return rp({'method':_0x093b('0x68'),'uri':util[_0x093b('0x69')](_0x093b('0x6a'),_0x4e3f49),'qs':{'module':_0x093b('0x6b')},'headers':{'Authorization':_0x093b('0x6c')+_0x561977},'json':!![]});}})['then'](function(_0x5da777){if(_0x5da777){if(_0x5da777[_0x093b('0x6d')]&&_0x5da777[_0x093b('0x6d')][_0x093b('0x6e')]){throw new Error(_0x5da777[_0x093b('0x6d')][_0x093b('0x6e')][_0x093b('0x6f')]);}var _0x44a5b7=[];var _0x57a146=[];var _0x2c231b=['Owner',_0x093b('0x70'),'Description',_0x093b('0x71'),'Call_Duration',_0x093b('0x72'),'Call_Start_Time','Call_Type'];_0x57a146=_['remove'](_0x5da777[_0x093b('0x32')],function(_0x4f0c36){return _0x2c231b[_0x093b('0x73')](_0x4f0c36[_0x093b('0x74')]);});for(var _0x33fab=0x0;_0x33fab<_0x57a146['length'];_0x33fab++){if(_0x57a146[_0x33fab][_0x093b('0x75')]===![]){_0x44a5b7[_0x093b('0x76')]({'id':_0x57a146[_0x33fab]['id'],'name':_0x57a146[_0x33fab]['display_label'],'custom':_0x57a146[_0x33fab][_0x093b('0x77')],'options':_0x57a146[_0x33fab]['data_type']===_0x093b('0x78')&&_0x57a146[_0x33fab]['pick_list_values'][_0x093b('0x33')]>-0x1?_['map'](_0x57a146[_0x33fab]['pick_list_values'],function(_0x153a8d){return{'name':_0x153a8d,'value':_0x153a8d};}):[]});}}return{'count':_0x44a5b7[_0x093b('0x33')],'rows':_0x44a5b7};}else{return{'count':0x0,'rows':[]};}})[_0x093b('0x20')](respondWithResult(_0x2a83a9,null))[_0x093b('0x42')](function(_0x206956){var _0x44752b=_0x3855cb[_0x093b('0x30')][_0x093b('0x79')]?0x1f4:_0x206956[_0x093b('0x7a')]||0x1f4;logger[_0x093b('0x6e')]('getFields,\x20%s,\x20%s,\x20%s',_0x093b('0x5f'),_0x44752b,JSON['stringify'](_0x206956));delete _0x206956['name'];if(_0x44752b===0x191){_0x44752b=0x190;}_0x2a83a9[_0x093b('0x17')](_0x44752b)[_0x093b('0x24')](_0x3855cb['query'][_0x093b('0x79')]?{'message':_0x093b('0x7b'),'statusCode':_0x206956['statusCode']}:_0x206956);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4723820..98519bf 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 _0xaa42=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','code','host','authorization_code','util','../../config/logger','api','path','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaa42,0xd4));var _0x2aa4=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xaa42[_0x307d86];return _0x361745;};'use strict';var _=require('lodash');var util=require(_0x2aa4('0x0'));var logger=require(_0x2aa4('0x1'))(_0x2aa4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aa4('0x3'));var rimraf=require('rimraf');var config=require(_0x2aa4('0x4'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2aa4('0x5'));module[_0x2aa4('0x6')]=function(_0xf1271a,_0x2bd7dc){return _0xf1271a[_0x2aa4('0x7')](_0x2aa4('0x8'),attributes,{'tableName':_0x2aa4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5ed803,_0xca32c2,_0x143163){if(_0x5ed803['changed'](_0x2aa4('0xa'))||_0x5ed803[_0x2aa4('0xb')](_0x2aa4('0xc'))||_0x5ed803['changed']('clientId')||_0x5ed803[_0x2aa4('0xb')](_0x2aa4('0xd'))||_0x5ed803['changed']('code')||_0x5ed803['changed']('host')){var _0x4c15b3,_0x862456;_0x4c15b3=_0x5ed803[_0x2aa4('0xc')];var _0x2275d5=_0x4c15b3[_0x2aa4('0xe')](-0x1);if(_0x2275d5==='/'||_0x2275d5==='\x5c'||_0x2275d5===':'){_0x4c15b3=_0x4c15b3[_0x2aa4('0xf')](0x0,_0x4c15b3[_0x2aa4('0x10')](_0x2275d5));}switch(_0x5ed803['zone']){case'US':_0x862456=_0x2aa4('0x11');break;case'AU':_0x862456=_0x2aa4('0x12');break;case'IN':_0x862456=_0x2aa4('0x13');break;case'CN':_0x862456=_0x2aa4('0x14');break;default:_0x862456=_0x2aa4('0x15');break;}var _0x2550e6={'method':_0x2aa4('0x16'),'uri':_0x862456+_0x2aa4('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x5ed803[_0x2aa4('0x18')],'client_secret':_0x5ed803[_0x2aa4('0xd')],'redirect_uri':_0x5ed803['serverUrl'],'code':_0x5ed803['code']},'headers':{'Content-Type':_0x2aa4('0x19')}};return rp(_0x2550e6)[_0x2aa4('0x1a')](function(_0x418ad4){var _0x9a4cfa=JSON[_0x2aa4('0x1b')](_0x418ad4);if(_0x9a4cfa[_0x2aa4('0x1c')]){_0x5ed803[_0x2aa4('0x1d')]=_0x9a4cfa['refresh_token'];logger[_0x2aa4('0x1e')](util[_0x2aa4('0x1f')](_0x2aa4('0x20'),_0x5ed803['name'],_0x5ed803['id']));}else{logger[_0x2aa4('0x21')](util[_0x2aa4('0x1f')](_0x2aa4('0x22'),_0x5ed803[_0x2aa4('0x23')],_0x5ed803['id']),util[_0x2aa4('0x24')](_0x9a4cfa,{'showHidden':![],'depth':null}));}return _0x143163(null,_0xca32c2);})[_0x2aa4('0x25')](function(_0x36c984){logger[_0x2aa4('0x21')](util['format'](_0x2aa4('0x22'),_0x5ed803['name'],_0x5ed803['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x143163(_0x36c984);});}else{return _0x143163(null,_0xca32c2);}},'beforeUpdate':function(_0x3a3c0f,_0x12e4fe,_0x1c23f8){if(_0x3a3c0f[_0x2aa4('0xb')](_0x2aa4('0xa'))||_0x3a3c0f[_0x2aa4('0xb')](_0x2aa4('0xc'))||_0x3a3c0f[_0x2aa4('0xb')]('clientId')||_0x3a3c0f[_0x2aa4('0xb')](_0x2aa4('0xd'))||_0x3a3c0f[_0x2aa4('0xb')](_0x2aa4('0x26'))||_0x3a3c0f[_0x2aa4('0xb')](_0x2aa4('0x27'))){var _0x397b42,_0x1f4d61;_0x397b42=_0x3a3c0f[_0x2aa4('0xc')];var _0x3851bf=_0x397b42[_0x2aa4('0xe')](-0x1);if(_0x3851bf==='/'||_0x3851bf==='\x5c'||_0x3851bf===':'){_0x397b42=_0x397b42[_0x2aa4('0xf')](0x0,_0x397b42['lastIndexOf'](_0x3851bf));}switch(_0x3a3c0f[_0x2aa4('0xa')]){case'US':_0x1f4d61='https://accounts.zoho.com';break;case'AU':_0x1f4d61=_0x2aa4('0x12');break;case'IN':_0x1f4d61=_0x2aa4('0x13');break;case'CN':_0x1f4d61='https://accounts.zoho.com.cn';break;default:_0x1f4d61=_0x2aa4('0x15');break;}var _0x50c9d2={'method':_0x2aa4('0x16'),'uri':_0x1f4d61+_0x2aa4('0x17'),'form':{'grant_type':_0x2aa4('0x28'),'client_id':_0x3a3c0f[_0x2aa4('0x18')],'client_secret':_0x3a3c0f[_0x2aa4('0xd')],'redirect_uri':_0x3a3c0f[_0x2aa4('0xc')],'code':_0x3a3c0f[_0x2aa4('0x26')]},'headers':{'Content-Type':_0x2aa4('0x19')}};return rp(_0x50c9d2)['then'](function(_0x287f02){var _0xcee8f3=JSON['parse'](_0x287f02);if(_0xcee8f3[_0x2aa4('0x1c')]){_0x3a3c0f[_0x2aa4('0x1d')]=_0xcee8f3[_0x2aa4('0x1c')];logger[_0x2aa4('0x1e')](util[_0x2aa4('0x1f')](_0x2aa4('0x20'),_0x3a3c0f[_0x2aa4('0x23')],_0x3a3c0f['id']));}else{logger[_0x2aa4('0x21')](util['format'](_0x2aa4('0x22'),_0x3a3c0f['name'],_0x3a3c0f['id']),util[_0x2aa4('0x24')](_0xcee8f3,{'showHidden':![],'depth':null}));}return _0x1c23f8(null,_0x12e4fe);})[_0x2aa4('0x25')](function(_0xa744d0){logger[_0x2aa4('0x21')](util['format'](_0x2aa4('0x22'),_0x3a3c0f[_0x2aa4('0x23')],_0x3a3c0f['id']),util[_0x2aa4('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c23f8(_0xa744d0);});}else{return _0x1c23f8(null,_0x12e4fe);}}}});}; \ No newline at end of file +var _0x5bee=['refresh_token','refreshToken','info','format','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','https://accounts.zoho.eu','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','int_zoho_accounts','changed','clientId','code','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then'];(function(_0x305e55,_0x2b0d8a){var _0x364570=function(_0x299d66){while(--_0x299d66){_0x305e55['push'](_0x305e55['shift']());}};_0x364570(++_0x2b0d8a);}(_0x5bee,0xe0));var _0xe5be=function(_0x115f40,_0x10c346){_0x115f40=_0x115f40-0x0;var _0x22c0ed=_0x5bee[_0x115f40];return _0x22c0ed;};'use strict';var _=require(_0xe5be('0x0'));var util=require(_0xe5be('0x1'));var logger=require(_0xe5be('0x2'))(_0xe5be('0x3'));var moment=require(_0xe5be('0x4'));var BPromise=require('bluebird');var rp=require(_0xe5be('0x5'));var fs=require('fs');var path=require(_0xe5be('0x6'));var rimraf=require(_0xe5be('0x7'));var config=require(_0xe5be('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe5be('0x9')]=function(_0x27efb6,_0x3f70de){return _0x27efb6['define']('ZohoAccount',attributes,{'tableName':_0xe5be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe0d94f,_0x1ac203,_0x51c6cc){if(_0xe0d94f[_0xe5be('0xb')]('zone')||_0xe0d94f['changed']('serverUrl')||_0xe0d94f[_0xe5be('0xb')](_0xe5be('0xc'))||_0xe0d94f[_0xe5be('0xb')]('clientSecret')||_0xe0d94f[_0xe5be('0xb')](_0xe5be('0xd'))||_0xe0d94f[_0xe5be('0xb')]('host')){var _0x49f5fe,_0x3971f8;_0x49f5fe=_0xe0d94f[_0xe5be('0xe')];var _0x18f93e=_0x49f5fe[_0xe5be('0xf')](-0x1);if(_0x18f93e==='/'||_0x18f93e==='\x5c'||_0x18f93e===':'){_0x49f5fe=_0x49f5fe[_0xe5be('0x10')](0x0,_0x49f5fe[_0xe5be('0x11')](_0x18f93e));}switch(_0xe0d94f[_0xe5be('0x12')]){case'US':_0x3971f8=_0xe5be('0x13');break;case'AU':_0x3971f8=_0xe5be('0x14');break;case'IN':_0x3971f8='https://accounts.zoho.in';break;case'CN':_0x3971f8=_0xe5be('0x15');break;default:_0x3971f8='https://accounts.zoho.eu';break;}var _0x45b34c={'method':_0xe5be('0x16'),'uri':_0x3971f8+_0xe5be('0x17'),'form':{'grant_type':_0xe5be('0x18'),'client_id':_0xe0d94f[_0xe5be('0xc')],'client_secret':_0xe0d94f[_0xe5be('0x19')],'redirect_uri':_0xe0d94f[_0xe5be('0xe')],'code':_0xe0d94f[_0xe5be('0xd')]},'headers':{'Content-Type':_0xe5be('0x1a')}};return rp(_0x45b34c)[_0xe5be('0x1b')](function(_0x5a41b6){var _0x481d4e=JSON['parse'](_0x5a41b6);if(_0x481d4e[_0xe5be('0x1c')]){_0xe0d94f[_0xe5be('0x1d')]=_0x481d4e['refresh_token'];logger[_0xe5be('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe0d94f['name'],_0xe0d94f['id']));}else{logger['error'](util[_0xe5be('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe0d94f[_0xe5be('0x20')],_0xe0d94f['id']),util[_0xe5be('0x21')](_0x481d4e,{'showHidden':![],'depth':null}));}return _0x51c6cc(null,_0x1ac203);})[_0xe5be('0x22')](function(_0x43ad98){logger[_0xe5be('0x23')](util[_0xe5be('0x1f')](_0xe5be('0x24'),_0xe0d94f[_0xe5be('0x20')],_0xe0d94f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x51c6cc(_0x43ad98);});}else{return _0x51c6cc(null,_0x1ac203);}},'beforeUpdate':function(_0x374161,_0x418806,_0x273b6f){if(_0x374161['changed'](_0xe5be('0x12'))||_0x374161[_0xe5be('0xb')](_0xe5be('0xe'))||_0x374161[_0xe5be('0xb')]('clientId')||_0x374161[_0xe5be('0xb')](_0xe5be('0x19'))||_0x374161['changed'](_0xe5be('0xd'))||_0x374161[_0xe5be('0xb')](_0xe5be('0x25'))){var _0x441abe,_0x55440c;_0x441abe=_0x374161[_0xe5be('0xe')];var _0x1bf94a=_0x441abe[_0xe5be('0xf')](-0x1);if(_0x1bf94a==='/'||_0x1bf94a==='\x5c'||_0x1bf94a===':'){_0x441abe=_0x441abe[_0xe5be('0x10')](0x0,_0x441abe[_0xe5be('0x11')](_0x1bf94a));}switch(_0x374161['zone']){case'US':_0x55440c='https://accounts.zoho.com';break;case'AU':_0x55440c=_0xe5be('0x14');break;case'IN':_0x55440c=_0xe5be('0x26');break;case'CN':_0x55440c='https://accounts.zoho.com.cn';break;default:_0x55440c=_0xe5be('0x27');break;}var _0x2838b2={'method':'POST','uri':_0x55440c+_0xe5be('0x17'),'form':{'grant_type':_0xe5be('0x18'),'client_id':_0x374161[_0xe5be('0xc')],'client_secret':_0x374161[_0xe5be('0x19')],'redirect_uri':_0x374161['serverUrl'],'code':_0x374161[_0xe5be('0xd')]},'headers':{'Content-Type':_0xe5be('0x1a')}};return rp(_0x2838b2)[_0xe5be('0x1b')](function(_0x3803a4){var _0x4db09f=JSON[_0xe5be('0x28')](_0x3803a4);if(_0x4db09f['refresh_token']){_0x374161[_0xe5be('0x1d')]=_0x4db09f[_0xe5be('0x1c')];logger[_0xe5be('0x1e')](util[_0xe5be('0x1f')](_0xe5be('0x29'),_0x374161[_0xe5be('0x20')],_0x374161['id']));}else{logger[_0xe5be('0x23')](util[_0xe5be('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x374161['name'],_0x374161['id']),util['inspect'](_0x4db09f,{'showHidden':![],'depth':null}));}return _0x273b6f(null,_0x418806);})[_0xe5be('0x22')](function(_0x4f802b){logger[_0xe5be('0x23')](util[_0xe5be('0x1f')](_0xe5be('0x24'),_0x374161[_0xe5be('0x20')],_0x374161['id']),util[_0xe5be('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x273b6f(_0x4f802b);});}else{return _0x273b6f(null,_0x418806);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3fbbead..7d61282 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 _0xf02c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ZohoAccount','findAll','options','attributes','limit','include','map','model','GetZohoAccount','stringify','ShowZohoAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x317203,_0x24b6c2){var _0x1e6cdd=function(_0x5c59ba){while(--_0x5c59ba){_0x317203['push'](_0x317203['shift']());}};_0x1e6cdd(++_0x24b6c2);}(_0xf02c,0x92));var _0xcf02=function(_0x3351ed,_0x58482b){_0x3351ed=_0x3351ed-0x0;var _0x40f2c2=_0xf02c[_0x3351ed];return _0x40f2c2;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3569a1,_0x49ad8e,_0x45745e){return new BPromise(function(_0x56c3db,_0x5a255f){return client['request'](_0x3569a1,_0x45745e)[_0xcf02('0xe')](function(_0x2f1633){logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,'request\x20sent');logger[_0xcf02('0x11')](_0xcf02('0x12'),_0x49ad8e,_0xcf02('0x13'),JSON['stringify'](_0x2f1633));if(_0x2f1633['error']){if(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x15')]===0x1f4){logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')]['message']);return _0x5a255f(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);}logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);return _0x56c3db(_0x2f1633[_0xcf02('0x14')]['message']);}else{logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,_0xcf02('0x13'));_0x56c3db(_0x2f1633['result'][_0xcf02('0x16')]);}})[_0xcf02('0x17')](function(_0x59f337){logger[_0xcf02('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x49ad8e,_0x59f337);_0x5a255f(_0x59f337);});});}exports['GetZohoAccount']=function(_0x4f3829){var _0x2860fd=this;return new Promise(function(_0x53a97e,_0x29615d){return db[_0xcf02('0x18')][_0xcf02('0x19')]({'raw':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')]['where']||null:null,'attributes':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1b')]||null:null,'limit':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options'][_0xcf02('0x1c')]||null:null,'include':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')],function(_0x2926b9){return{'model':db[_0x2926b9['model']],'as':_0x2926b9['as'],'attributes':_0x2926b9['attributes'],'include':_0x2926b9['include']?_[_0xcf02('0x1e')](_0x2926b9[_0xcf02('0x1d')],function(_0x2fd260){return{'model':db[_0x2fd260[_0xcf02('0x1f')]],'as':_0x2fd260['as'],'attributes':_0x2fd260[_0xcf02('0x1b')],'include':_0x2fd260[_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x2fd260[_0xcf02('0x1d')],function(_0x4ee2b9){return{'model':db[_0x4ee2b9[_0xcf02('0x1f')]],'as':_0x4ee2b9['as'],'attributes':_0x4ee2b9[_0xcf02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54716d){logger[_0xcf02('0xf')](_0xcf02('0x20'),_0x4f3829);logger[_0xcf02('0x11')](_0xcf02('0x20'),_0x4f3829,JSON[_0xcf02('0x21')](_0x54716d));_0x53a97e(_0x54716d);})[_0xcf02('0x17')](function(_0x2b8bc6){logger[_0xcf02('0x14')](_0xcf02('0x20'),_0x2b8bc6['message'],_0x4f3829);_0x29615d(_0x2860fd[_0xcf02('0x14')](0x1f4,_0x2b8bc6[_0xcf02('0x16')]));});});};exports[_0xcf02('0x22')]=function(_0x5af4c3){var _0x2bef8e=this;return new Promise(function(_0x320d89,_0x47b633){return db[_0xcf02('0x18')][_0xcf02('0x23')]({'raw':_0x5af4c3['options']?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x24')]===undefined?!![]:![]:!![],'where':_0x5af4c3[_0xcf02('0x1a')]?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x25')]||null:null,'attributes':_0x5af4c3['options']?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x1b')]||null:null,'include':_0x5af4c3[_0xcf02('0x1a')]?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x1d')]?_['map'](_0x5af4c3['options'][_0xcf02('0x1d')],function(_0x8c5158){return{'model':db[_0x8c5158[_0xcf02('0x1f')]],'as':_0x8c5158['as'],'attributes':_0x8c5158['attributes'],'include':_0x8c5158['include']?_[_0xcf02('0x1e')](_0x8c5158[_0xcf02('0x1d')],function(_0x259577){return{'model':db[_0x259577[_0xcf02('0x1f')]],'as':_0x259577['as'],'attributes':_0x259577[_0xcf02('0x1b')],'include':_0x259577['include']?_[_0xcf02('0x1e')](_0x259577[_0xcf02('0x1d')],function(_0x11ead1){return{'model':db[_0x11ead1['model']],'as':_0x11ead1['as'],'attributes':_0x11ead1[_0xcf02('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcf02('0xe')](function(_0xaaab0a){logger[_0xcf02('0xf')](_0xcf02('0x22'),_0x5af4c3);logger['debug'](_0xcf02('0x22'),_0x5af4c3,JSON[_0xcf02('0x21')](_0xaaab0a));_0x320d89(_0xaaab0a);})['catch'](function(_0x3bb89a){logger[_0xcf02('0x14')](_0xcf02('0x22'),_0x3bb89a[_0xcf02('0x16')],_0x5af4c3);_0x47b633(_0x2bef8e['error'](0x1f4,_0x3bb89a[_0xcf02('0x16')]));});});}; \ No newline at end of file +var _0x762e=['raw','then','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','options','where','attributes','limit','include','model','map','ShowZohoAccount','ZohoAccount','find'];(function(_0x37bcb7,_0x4cc150){var _0x40d7ef=function(_0x4a5e97){while(--_0x4a5e97){_0x37bcb7['push'](_0x37bcb7['shift']());}};_0x40d7ef(++_0x4cc150);}(_0x762e,0xea));var _0xe762=function(_0x5c4d9b,_0x18d583){_0x5c4d9b=_0x5c4d9b-0x0;var _0x371c1b=_0x762e[_0x5c4d9b];return _0x371c1b;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4726,_0x7a1740,_0x2511ad){return new BPromise(function(_0xf20548,_0x26a4fc){return client[_0xe762('0x8')](_0x1f4726,_0x2511ad)['then'](function(_0x50dd96){logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));logger[_0xe762('0xc')](_0xe762('0xd'),_0x7a1740,_0xe762('0xb'),JSON['stringify'](_0x50dd96));if(_0x50dd96[_0xe762('0xe')]){if(_0x50dd96[_0xe762('0xe')][_0xe762('0xf')]===0x1f4){logger['error'](_0xe762('0xa'),_0x7a1740,_0x50dd96['error'][_0xe762('0x10')]);return _0x26a4fc(_0x50dd96['error'][_0xe762('0x10')]);}logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x50dd96['error']['message']);return _0xf20548(_0x50dd96[_0xe762('0xe')][_0xe762('0x10')]);}else{logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));_0xf20548(_0x50dd96[_0xe762('0x11')][_0xe762('0x10')]);}})[_0xe762('0x12')](function(_0x531587){logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x531587);_0x26a4fc(_0x531587);});});}exports[_0xe762('0x13')]=function(_0x27c2cf){var _0x57850f=this;return new Promise(function(_0xd2cb26,_0x157de2){return db['ZohoAccount']['findAll']({'raw':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf['options'][_0xe762('0x15')]||null:null,'attributes':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')][_0xe762('0x16')]||null:null,'limit':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf[_0xe762('0x14')][_0xe762('0x17')]||null:null,'include':_0x27c2cf['options']?_0x27c2cf['options']['include']?_['map'](_0x27c2cf[_0xe762('0x14')][_0xe762('0x18')],function(_0x31ac1a){return{'model':db[_0x31ac1a[_0xe762('0x19')]],'as':_0x31ac1a['as'],'attributes':_0x31ac1a[_0xe762('0x16')],'include':_0x31ac1a['include']?_[_0xe762('0x1a')](_0x31ac1a[_0xe762('0x18')],function(_0x407d1e){return{'model':db[_0x407d1e[_0xe762('0x19')]],'as':_0x407d1e['as'],'attributes':_0x407d1e[_0xe762('0x16')],'include':_0x407d1e[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x407d1e[_0xe762('0x18')],function(_0xc05eb8){return{'model':db[_0xc05eb8[_0xe762('0x19')]],'as':_0xc05eb8['as'],'attributes':_0xc05eb8[_0xe762('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bfe46){logger[_0xe762('0x9')]('GetZohoAccount',_0x27c2cf);logger[_0xe762('0xc')](_0xe762('0x13'),_0x27c2cf,JSON['stringify'](_0x5bfe46));_0xd2cb26(_0x5bfe46);})[_0xe762('0x12')](function(_0xa39b64){logger[_0xe762('0xe')](_0xe762('0x13'),_0xa39b64[_0xe762('0x10')],_0x27c2cf);_0x157de2(_0x57850f[_0xe762('0xe')](0x1f4,_0xa39b64[_0xe762('0x10')]));});});};exports[_0xe762('0x1b')]=function(_0x26dbd3){var _0x79604b=this;return new Promise(function(_0x5f135b,_0x3bf093){return db[_0xe762('0x1c')][_0xe762('0x1d')]({'raw':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x1e')]===undefined?!![]:![]:!![],'where':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')]['where']||null:null,'attributes':_0x26dbd3['options']?_0x26dbd3[_0xe762('0x14')][_0xe762('0x16')]||null:null,'include':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x18')]?_[_0xe762('0x1a')](_0x26dbd3[_0xe762('0x14')]['include'],function(_0x40eedf){return{'model':db[_0x40eedf[_0xe762('0x19')]],'as':_0x40eedf['as'],'attributes':_0x40eedf[_0xe762('0x16')],'include':_0x40eedf['include']?_[_0xe762('0x1a')](_0x40eedf[_0xe762('0x18')],function(_0x249d01){return{'model':db[_0x249d01[_0xe762('0x19')]],'as':_0x249d01['as'],'attributes':_0x249d01[_0xe762('0x16')],'include':_0x249d01[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x249d01[_0xe762('0x18')],function(_0x37cc8b){return{'model':db[_0x37cc8b[_0xe762('0x19')]],'as':_0x37cc8b['as'],'attributes':_0x37cc8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe762('0x1f')](function(_0x25ec08){logger[_0xe762('0x9')](_0xe762('0x1b'),_0x26dbd3);logger[_0xe762('0xc')](_0xe762('0x1b'),_0x26dbd3,JSON[_0xe762('0x20')](_0x25ec08));_0x5f135b(_0x25ec08);})[_0xe762('0x12')](function(_0x3e17d9){logger[_0xe762('0xe')](_0xe762('0x1b'),_0x3e17d9[_0xe762('0x10')],_0x26dbd3);_0x3bf093(_0x79604b[_0xe762('0xe')](0x1f4,_0x3e17d9[_0xe762('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ba0dae3..6617c07 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 _0xef3e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x143735,_0x4f3d49){var _0x32c404=function(_0x1296d8){while(--_0x1296d8){_0x143735['push'](_0x143735['shift']());}};_0x32c404(++_0x4f3d49);}(_0xef3e,0x143));var _0xeef3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xef3e[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xeef3('0x0'));var util=require(_0xeef3('0x1'));var path=require('path');var timeout=require(_0xeef3('0x2'));var express=require(_0xeef3('0x3'));var router=express[_0xeef3('0x4')]();var fs_extra=require(_0xeef3('0x5'));var auth=require(_0xeef3('0x6'));var interaction=require(_0xeef3('0x7'));var config=require(_0xeef3('0x8'));var controller=require(_0xeef3('0x9'));router[_0xeef3('0xa')]('/',auth['isAuthenticated'](),controller[_0xeef3('0xb')]);router[_0xeef3('0xa')]('/:id',auth[_0xeef3('0xc')](),controller['show']);router[_0xeef3('0xa')](_0xeef3('0xd'),auth[_0xeef3('0xc')](),controller[_0xeef3('0xe')]);router[_0xeef3('0xa')](_0xeef3('0xf'),auth['isAuthenticated'](),controller[_0xeef3('0x10')]);router[_0xeef3('0xa')]('/:id/descriptions',auth[_0xeef3('0xc')](),controller[_0xeef3('0x11')]);router[_0xeef3('0x12')]('/',auth[_0xeef3('0xc')](),controller['create']);router[_0xeef3('0x13')](_0xeef3('0x14'),auth['isAuthenticated'](),controller[_0xeef3('0x15')]);router[_0xeef3('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xeef3('0x17')]);module[_0xeef3('0x18')]=router; \ No newline at end of file +var _0xa926=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x42676a,_0xc50993){var _0x545a4e=function(_0x208903){while(--_0x208903){_0x42676a['push'](_0x42676a['shift']());}};_0x545a4e(++_0xc50993);}(_0xa926,0x166));var _0x6a92=function(_0x4ba043,_0x9cd2de){_0x4ba043=_0x4ba043-0x0;var _0x1d6188=_0xa926[_0x4ba043];return _0x1d6188;};'use strict';var multer=require(_0x6a92('0x0'));var util=require(_0x6a92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a92('0x2'));var router=express[_0x6a92('0x3')]();var fs_extra=require(_0x6a92('0x4'));var auth=require(_0x6a92('0x5'));var interaction=require(_0x6a92('0x6'));var config=require('../../config/environment');var controller=require(_0x6a92('0x7'));router[_0x6a92('0x8')]('/',auth[_0x6a92('0x9')](),controller[_0x6a92('0xa')]);router[_0x6a92('0x8')](_0x6a92('0xb'),auth['isAuthenticated'](),controller[_0x6a92('0xc')]);router[_0x6a92('0x8')](_0x6a92('0xd'),auth['isAuthenticated'](),controller[_0x6a92('0xe')]);router[_0x6a92('0x8')](_0x6a92('0xf'),auth[_0x6a92('0x9')](),controller[_0x6a92('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6a92('0x11')]);router[_0x6a92('0x12')]('/',auth[_0x6a92('0x9')](),controller[_0x6a92('0x13')]);router[_0x6a92('0x14')](_0x6a92('0xb'),auth[_0x6a92('0x9')](),controller[_0x6a92('0x15')]);router[_0x6a92('0x16')]('/:id',auth[_0x6a92('0x9')](),controller[_0x6a92('0x17')]);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 ae39233..2eddfd1 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 _0x1c1d=['STRING','lead','contact','sequelize'];(function(_0x3f68dc,_0x3ae2f8){var _0x8c9e6f=function(_0x32b1cd){while(--_0x32b1cd){_0x3f68dc['push'](_0x3f68dc['shift']());}};_0x8c9e6f(++_0x3ae2f8);}(_0x1c1d,0x143));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1c1('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd1c1('0x2'),_0xd1c1('0x3'),'nothing'),'defaultValue':_0xd1c1('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xd1c1('0x3'),_0xd1c1('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd1c1('0x1')]}}; \ No newline at end of file +var _0x9622=['contact_lead','sequelize','exports','STRING','lead','contact','nothing'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0x9622,0x8d));var _0x2962=function(_0x380a3f,_0x2807c7){_0x380a3f=_0x380a3f-0x0;var _0x1f4b10=_0x9622[_0x380a3f];return _0x1f4b10;};'use strict';var Sequelize=require(_0x2962('0x0'));module[_0x2962('0x1')]={'name':{'type':Sequelize[_0x2962('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x2962('0x3'),_0x2962('0x4'),_0x2962('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x2962('0x3')),'defaultValue':_0x2962('0x6')},'description':{'type':Sequelize[_0x2962('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 78fe923..100eb56 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 _0x4648=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','index','map','ZohoConfiguration','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','options','count','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','getFields','findOne','order','getSubjects','ZohoField','pick','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5e8f53,_0x1ef479){var _0x1e2b08=function(_0x5efdf2){while(--_0x5efdf2){_0x5e8f53['push'](_0x5e8f53['shift']());}};_0x1e2b08(++_0x1ef479);}(_0x4648,0x1c3));var _0x8464=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x4648[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require(_0x8464('0x0'));var rimraf=require(_0x8464('0x1'));var zipdir=require(_0x8464('0x2'));var jsonpatch=require(_0x8464('0x3'));var rp=require(_0x8464('0x4'));var moment=require(_0x8464('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8464('0x6'));var path=require(_0x8464('0x7'));var sox=require(_0x8464('0x8'));var csv=require(_0x8464('0x9'));var ejs=require(_0x8464('0xa'));var fs=require('fs');var fs_extra=require(_0x8464('0xb'));var _=require(_0x8464('0xc'));var squel=require(_0x8464('0xd'));var crypto=require(_0x8464('0xe'));var jsforce=require(_0x8464('0xf'));var deskjs=require(_0x8464('0x10'));var toCsv=require(_0x8464('0x9'));var querystring=require(_0x8464('0x11'));var Papa=require(_0x8464('0x12'));var Redis=require('ioredis');var authService=require(_0x8464('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8464('0x14'));var hardwareService=require(_0x8464('0x15'));var logger=require(_0x8464('0x16'))(_0x8464('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8464('0x18'));var db=require(_0x8464('0x19'))['db'];function respondWithStatusCode(_0x4d3a63,_0x3c70db){_0x3c70db=_0x3c70db||0xcc;return function(_0x1cc9ae){if(_0x1cc9ae){return _0x4d3a63['sendStatus'](_0x3c70db);}return _0x4d3a63[_0x8464('0x1a')](_0x3c70db)[_0x8464('0x1b')]();};}function respondWithResult(_0x588a19,_0x46ce45){_0x46ce45=_0x46ce45||0xc8;return function(_0x5608cd){if(_0x5608cd){return _0x588a19[_0x8464('0x1a')](_0x46ce45)[_0x8464('0x1c')](_0x5608cd);}};}function respondWithFilteredResult(_0x27631b,_0xeb3aac){return function(_0x20e9bb){if(_0x20e9bb){var _0x4f8cab=typeof _0xeb3aac[_0x8464('0x1d')]==='undefined'&&typeof _0xeb3aac['limit']==='undefined';var _0x361713=_0x20e9bb['count'];var _0x23827e=_0x4f8cab?0x0:_0xeb3aac[_0x8464('0x1d')];var _0x28708e=_0x4f8cab?_0x20e9bb['count']:_0xeb3aac[_0x8464('0x1d')]+_0xeb3aac[_0x8464('0x1e')];var _0x1d22d2;if(_0x28708e>=_0x361713){_0x28708e=_0x361713;_0x1d22d2=0xc8;}else{_0x1d22d2=0xce;}_0x27631b[_0x8464('0x1a')](_0x1d22d2);return _0x27631b[_0x8464('0x1f')](_0x8464('0x20'),_0x23827e+'-'+_0x28708e+'/'+_0x361713)[_0x8464('0x1c')](_0x20e9bb);}return null;};}function patchUpdates(_0x17e918){return function(_0x3dd261){try{jsonpatch['apply'](_0x3dd261,_0x17e918,!![]);}catch(_0x52dd55){return BPromise[_0x8464('0x21')](_0x52dd55);}return _0x3dd261[_0x8464('0x22')]();};}function saveUpdates(_0x1c9745,_0x22463b){return function(_0x164d93){if(_0x164d93){return _0x164d93[_0x8464('0x23')](_0x1c9745)[_0x8464('0x24')](function(_0x37f1ff){return _0x37f1ff;});}return null;};}function removeEntity(_0x137df4,_0x46dea3){return function(_0x31850d){if(_0x31850d){return _0x31850d[_0x8464('0x25')]()[_0x8464('0x24')](function(){_0x137df4[_0x8464('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c934e,_0x494dbf){return function(_0x337173){if(!_0x337173){_0x1c934e[_0x8464('0x26')](0x194);}return _0x337173;};}function handleError(_0x4a2406,_0x1b4535){_0x1b4535=_0x1b4535||0x1f4;return function(_0x582803){logger['error'](_0x582803['stack']);if(_0x582803['name']){delete _0x582803[_0x8464('0x27')];}_0x4a2406['status'](_0x1b4535)[_0x8464('0x28')](_0x582803);};}exports[_0x8464('0x29')]=function(_0x4dfc39,_0x4a473a){var _0x3ef502={},_0x542926={},_0x4822eb={'count':0x0,'rows':[]};var _0x33870a=_[_0x8464('0x2a')](db[_0x8464('0x2b')]['rawAttributes'],function(_0x2dd877){return{'name':_0x2dd877['fieldName'],'type':_0x2dd877['type'][_0x8464('0x2c')]};});_0x542926[_0x8464('0x2d')]=_[_0x8464('0x2a')](_0x33870a,_0x8464('0x27'));_0x542926[_0x8464('0x2e')]=_[_0x8464('0x2f')](_0x4dfc39['query']);_0x542926['filters']=_[_0x8464('0x30')](_0x542926[_0x8464('0x2d')],_0x542926[_0x8464('0x2e')]);_0x3ef502[_0x8464('0x31')]=_['intersection'](_0x542926[_0x8464('0x2d')],qs[_0x8464('0x32')](_0x4dfc39['query'][_0x8464('0x32')]));_0x3ef502[_0x8464('0x31')]=_0x3ef502['attributes'][_0x8464('0x33')]?_0x3ef502[_0x8464('0x31')]:_0x542926[_0x8464('0x2d')];if(!_0x4dfc39[_0x8464('0x2e')][_0x8464('0x34')]('nolimit')){_0x3ef502[_0x8464('0x1e')]=qs[_0x8464('0x1e')](_0x4dfc39[_0x8464('0x2e')][_0x8464('0x1e')]);_0x3ef502[_0x8464('0x1d')]=qs[_0x8464('0x1d')](_0x4dfc39[_0x8464('0x2e')][_0x8464('0x1d')]);}_0x3ef502['order']=qs[_0x8464('0x35')](_0x4dfc39[_0x8464('0x2e')][_0x8464('0x35')]);_0x3ef502[_0x8464('0x36')]=qs[_0x8464('0x37')](_['pick'](_0x4dfc39[_0x8464('0x2e')],_0x542926[_0x8464('0x37')]),_0x33870a);if(_0x4dfc39['query'][_0x8464('0x38')]){_0x3ef502['where']=_[_0x8464('0x39')](_0x3ef502[_0x8464('0x36')],{'$or':_[_0x8464('0x2a')](_0x33870a,function(_0x3c6db5){if(_0x3c6db5[_0x8464('0x3a')]!=='VIRTUAL'){var _0x2a2600={};_0x2a2600[_0x3c6db5['name']]={'$like':'%'+_0x4dfc39[_0x8464('0x2e')][_0x8464('0x38')]+'%'};return _0x2a2600;}})});}_0x3ef502=_['merge']({},_0x3ef502,_0x4dfc39[_0x8464('0x3b')]);var _0x507b8f={'where':_0x3ef502[_0x8464('0x36')]};return db[_0x8464('0x2b')][_0x8464('0x3c')](_0x507b8f)[_0x8464('0x24')](function(_0x8cd10b){_0x4822eb[_0x8464('0x3c')]=_0x8cd10b;if(_0x4dfc39['query'][_0x8464('0x3d')]){_0x3ef502[_0x8464('0x3e')]=[{'all':!![]}];}return db[_0x8464('0x2b')][_0x8464('0x3f')](_0x3ef502);})[_0x8464('0x24')](function(_0x1422bd){_0x4822eb['rows']=_0x1422bd;return _0x4822eb;})[_0x8464('0x24')](respondWithFilteredResult(_0x4a473a,_0x3ef502))[_0x8464('0x40')](handleError(_0x4a473a,null));};exports['show']=function(_0x43e4d5,_0x4b8715){var _0x268f00={'raw':![],'where':{'id':_0x43e4d5[_0x8464('0x41')]['id']}},_0x1994ac={};_0x1994ac['model']=_['keys'](db[_0x8464('0x2b')][_0x8464('0x42')]);_0x1994ac['query']=_[_0x8464('0x2f')](_0x43e4d5['query']);_0x1994ac[_0x8464('0x37')]=_[_0x8464('0x30')](_0x1994ac[_0x8464('0x2d')],_0x1994ac['query']);_0x268f00['attributes']=_[_0x8464('0x30')](_0x1994ac[_0x8464('0x2d')],qs[_0x8464('0x32')](_0x43e4d5[_0x8464('0x2e')][_0x8464('0x32')]));_0x268f00[_0x8464('0x31')]=_0x268f00[_0x8464('0x31')]['length']?_0x268f00['attributes']:_0x1994ac['model'];if(_0x43e4d5[_0x8464('0x2e')]['includeAll']){_0x268f00[_0x8464('0x3e')]=[{'all':!![]}];}_0x268f00=_[_0x8464('0x39')]({},_0x268f00,_0x43e4d5[_0x8464('0x3b')]);return db[_0x8464('0x2b')]['find'](_0x268f00)[_0x8464('0x24')](handleEntityNotFound(_0x4b8715,null))['then'](respondWithResult(_0x4b8715,null))[_0x8464('0x40')](handleError(_0x4b8715,null));};exports[_0x8464('0x43')]=function(_0x6920e7,_0x129951){return db[_0x8464('0x2b')][_0x8464('0x43')](_0x6920e7[_0x8464('0x44')],{})[_0x8464('0x24')](respondWithResult(_0x129951,0xc9))['catch'](handleError(_0x129951,null));};exports['update']=function(_0x2bcd14,_0x25dbe6){if(_0x2bcd14[_0x8464('0x44')]['id']){delete _0x2bcd14[_0x8464('0x44')]['id'];}return db[_0x8464('0x2b')]['find']({'where':{'id':_0x2bcd14[_0x8464('0x41')]['id']}})['then'](handleEntityNotFound(_0x25dbe6,null))[_0x8464('0x24')](saveUpdates(_0x2bcd14['body'],null))[_0x8464('0x24')](respondWithResult(_0x25dbe6,null))[_0x8464('0x40')](handleError(_0x25dbe6,null));};exports['destroy']=function(_0x1124fa,_0x1423f9){return db['ZohoConfiguration'][_0x8464('0x45')]({'where':{'id':_0x1124fa['params']['id']}})[_0x8464('0x24')](handleEntityNotFound(_0x1423f9,null))[_0x8464('0x24')](removeEntity(_0x1423f9,null))[_0x8464('0x40')](handleError(_0x1423f9,null));};exports[_0x8464('0x46')]=function(_0x24c123,_0x54e242,_0xdee987){var _0x5e4fc1={};var _0x150338={};var _0x118e65;var _0x4b40b8;return db['ZohoConfiguration'][_0x8464('0x47')]({'where':{'id':_0x24c123[_0x8464('0x41')]['id']}})[_0x8464('0x24')](handleEntityNotFound(_0x54e242,null))[_0x8464('0x24')](function(_0x5201e3){if(_0x5201e3){_0x118e65=_0x5201e3;_0x150338['model']=_[_0x8464('0x2f')](db['ZohoField'][_0x8464('0x42')]);_0x150338[_0x8464('0x2e')]=_[_0x8464('0x2f')](_0x24c123[_0x8464('0x2e')]);_0x150338[_0x8464('0x37')]=_['intersection'](_0x150338[_0x8464('0x2d')],_0x150338[_0x8464('0x2e')]);_0x5e4fc1[_0x8464('0x31')]=_['intersection'](_0x150338[_0x8464('0x2d')],qs['fields'](_0x24c123['query'][_0x8464('0x32')]));_0x5e4fc1[_0x8464('0x31')]=_0x5e4fc1[_0x8464('0x31')][_0x8464('0x33')]?_0x5e4fc1[_0x8464('0x31')]:_0x150338[_0x8464('0x2d')];_0x5e4fc1[_0x8464('0x48')]=qs['sort'](_0x24c123['query']['sort']);_0x5e4fc1['where']=qs[_0x8464('0x37')](_['pick'](_0x24c123[_0x8464('0x2e')],_0x150338[_0x8464('0x37')]));if(_0x24c123[_0x8464('0x2e')][_0x8464('0x38')]){_0x5e4fc1[_0x8464('0x36')]=_[_0x8464('0x39')](_0x5e4fc1['where'],{'$or':_[_0x8464('0x2a')](_0x5e4fc1[_0x8464('0x31')],function(_0x428c25){var _0x3570bc={};_0x3570bc[_0x428c25]={'$like':'%'+_0x24c123[_0x8464('0x2e')][_0x8464('0x38')]+'%'};return _0x3570bc;})});}_0x5e4fc1=_['merge']({},_0x5e4fc1,_0x24c123[_0x8464('0x3b')]);return _0x118e65[_0x8464('0x46')](_0x5e4fc1);}})[_0x8464('0x24')](function(_0x4fc9e8){if(_0x4fc9e8){_0x4b40b8=_0x4fc9e8[_0x8464('0x33')];if(!_0x24c123[_0x8464('0x2e')]['hasOwnProperty']('nolimit')){_0x5e4fc1['limit']=qs[_0x8464('0x1e')](_0x24c123[_0x8464('0x2e')][_0x8464('0x1e')]);_0x5e4fc1[_0x8464('0x1d')]=qs[_0x8464('0x1d')](_0x24c123[_0x8464('0x2e')][_0x8464('0x1d')]);}return _0x118e65[_0x8464('0x46')](_0x5e4fc1);}})[_0x8464('0x24')](function(_0x317c2c){if(_0x317c2c){return _0x317c2c?{'count':_0x4b40b8,'rows':_0x317c2c}:null;}})['then'](respondWithResult(_0x54e242,null))[_0x8464('0x40')](handleError(_0x54e242,null));};exports[_0x8464('0x49')]=function(_0xab961a,_0x2c5e21,_0x13c6d8){var _0x3c30a6={};var _0x263e2a={};var _0x5926fe;var _0x2bfe00;return db[_0x8464('0x2b')][_0x8464('0x47')]({'where':{'id':_0xab961a[_0x8464('0x41')]['id']}})[_0x8464('0x24')](handleEntityNotFound(_0x2c5e21,null))[_0x8464('0x24')](function(_0x41ca39){if(_0x41ca39){_0x5926fe=_0x41ca39;_0x263e2a['model']=_[_0x8464('0x2f')](db[_0x8464('0x4a')][_0x8464('0x42')]);_0x263e2a[_0x8464('0x2e')]=_[_0x8464('0x2f')](_0xab961a[_0x8464('0x2e')]);_0x263e2a[_0x8464('0x37')]=_[_0x8464('0x30')](_0x263e2a['model'],_0x263e2a[_0x8464('0x2e')]);_0x3c30a6['attributes']=_['intersection'](_0x263e2a['model'],qs[_0x8464('0x32')](_0xab961a[_0x8464('0x2e')]['fields']));_0x3c30a6[_0x8464('0x31')]=_0x3c30a6[_0x8464('0x31')][_0x8464('0x33')]?_0x3c30a6[_0x8464('0x31')]:_0x263e2a['model'];_0x3c30a6[_0x8464('0x48')]=qs[_0x8464('0x35')](_0xab961a[_0x8464('0x2e')][_0x8464('0x35')]);_0x3c30a6['where']=qs[_0x8464('0x37')](_[_0x8464('0x4b')](_0xab961a[_0x8464('0x2e')],_0x263e2a[_0x8464('0x37')]));if(_0xab961a['query'][_0x8464('0x38')]){_0x3c30a6[_0x8464('0x36')]=_[_0x8464('0x39')](_0x3c30a6[_0x8464('0x36')],{'$or':_[_0x8464('0x2a')](_0x3c30a6[_0x8464('0x31')],function(_0x46a2ae){var _0x2639b6={};_0x2639b6[_0x46a2ae]={'$like':'%'+_0xab961a[_0x8464('0x2e')][_0x8464('0x38')]+'%'};return _0x2639b6;})});}_0x3c30a6=_[_0x8464('0x39')]({},_0x3c30a6,_0xab961a[_0x8464('0x3b')]);return _0x5926fe[_0x8464('0x49')](_0x3c30a6);}})['then'](function(_0x5c4016){if(_0x5c4016){_0x2bfe00=_0x5c4016['length'];if(!_0xab961a[_0x8464('0x2e')][_0x8464('0x34')](_0x8464('0x4c'))){_0x3c30a6[_0x8464('0x1e')]=qs[_0x8464('0x1e')](_0xab961a[_0x8464('0x2e')][_0x8464('0x1e')]);_0x3c30a6[_0x8464('0x1d')]=qs[_0x8464('0x1d')](_0xab961a[_0x8464('0x2e')]['offset']);}return _0x5926fe['getSubjects'](_0x3c30a6);}})[_0x8464('0x24')](function(_0x531c13){if(_0x531c13){return _0x531c13?{'count':_0x2bfe00,'rows':_0x531c13}:null;}})[_0x8464('0x24')](respondWithResult(_0x2c5e21,null))[_0x8464('0x40')](handleError(_0x2c5e21,null));};exports[_0x8464('0x4d')]=function(_0x340386,_0x2324bd,_0xe42e60){var _0x4902c2={};var _0x59e99b={};var _0x348d2d;var _0x5de1d2;return db[_0x8464('0x2b')][_0x8464('0x47')]({'where':{'id':_0x340386['params']['id']}})[_0x8464('0x24')](handleEntityNotFound(_0x2324bd,null))[_0x8464('0x24')](function(_0x54679a){if(_0x54679a){_0x348d2d=_0x54679a;_0x59e99b[_0x8464('0x2d')]=_[_0x8464('0x2f')](db['ZohoField'][_0x8464('0x42')]);_0x59e99b[_0x8464('0x2e')]=_['keys'](_0x340386[_0x8464('0x2e')]);_0x59e99b['filters']=_[_0x8464('0x30')](_0x59e99b[_0x8464('0x2d')],_0x59e99b[_0x8464('0x2e')]);_0x4902c2['attributes']=_[_0x8464('0x30')](_0x59e99b[_0x8464('0x2d')],qs[_0x8464('0x32')](_0x340386[_0x8464('0x2e')]['fields']));_0x4902c2[_0x8464('0x31')]=_0x4902c2['attributes'][_0x8464('0x33')]?_0x4902c2['attributes']:_0x59e99b[_0x8464('0x2d')];_0x4902c2[_0x8464('0x48')]=qs[_0x8464('0x35')](_0x340386[_0x8464('0x2e')][_0x8464('0x35')]);_0x4902c2[_0x8464('0x36')]=qs['filters'](_['pick'](_0x340386[_0x8464('0x2e')],_0x59e99b[_0x8464('0x37')]));if(_0x340386['query'][_0x8464('0x38')]){_0x4902c2[_0x8464('0x36')]=_[_0x8464('0x39')](_0x4902c2[_0x8464('0x36')],{'$or':_[_0x8464('0x2a')](_0x4902c2[_0x8464('0x31')],function(_0xe24361){var _0x585c49={};_0x585c49[_0xe24361]={'$like':'%'+_0x340386[_0x8464('0x2e')][_0x8464('0x38')]+'%'};return _0x585c49;})});}_0x4902c2=_['merge']({},_0x4902c2,_0x340386[_0x8464('0x3b')]);return _0x348d2d[_0x8464('0x4d')](_0x4902c2);}})[_0x8464('0x24')](function(_0x25eff7){if(_0x25eff7){_0x5de1d2=_0x25eff7[_0x8464('0x33')];if(!_0x340386[_0x8464('0x2e')][_0x8464('0x34')]('nolimit')){_0x4902c2['limit']=qs['limit'](_0x340386['query'][_0x8464('0x1e')]);_0x4902c2[_0x8464('0x1d')]=qs[_0x8464('0x1d')](_0x340386[_0x8464('0x2e')]['offset']);}return _0x348d2d[_0x8464('0x4d')](_0x4902c2);}})[_0x8464('0x24')](function(_0x25301b){if(_0x25301b){return _0x25301b?{'count':_0x5de1d2,'rows':_0x25301b}:null;}})[_0x8464('0x24')](respondWithResult(_0x2324bd,null))[_0x8464('0x40')](handleError(_0x2324bd,null));}; \ No newline at end of file +var _0xffa3=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','ZohoConfiguration','includeAll','findAll','rows','show','params','include','create','body','catch','find','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c8282,_0x26279b){var _0x2bbf2f=function(_0x467dbd){while(--_0x467dbd){_0x4c8282['push'](_0x4c8282['shift']());}};_0x2bbf2f(++_0x26279b);}(_0xffa3,0x88));var _0x3ffa=function(_0x2e34f8,_0x53a191){_0x2e34f8=_0x2e34f8-0x0;var _0x2b147a=_0xffa3[_0x2e34f8];return _0x2b147a;};'use strict';var emlformat=require(_0x3ffa('0x0'));var rimraf=require(_0x3ffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ffa('0x2'));var rp=require(_0x3ffa('0x3'));var moment=require(_0x3ffa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ffa('0x5'));var util=require(_0x3ffa('0x6'));var path=require(_0x3ffa('0x7'));var sox=require('sox');var csv=require(_0x3ffa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ffa('0x9'));var squel=require(_0x3ffa('0xa'));var crypto=require(_0x3ffa('0xb'));var jsforce=require(_0x3ffa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ffa('0x8'));var querystring=require(_0x3ffa('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ffa('0xe'));var authService=require(_0x3ffa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3ffa('0x10'));var hardwareService=require(_0x3ffa('0x11'));var logger=require(_0x3ffa('0x12'))('api');var utils=require(_0x3ffa('0x13'));var config=require(_0x3ffa('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ffa('0x15'))['db'];function respondWithStatusCode(_0x51e142,_0x43731f){_0x43731f=_0x43731f||0xcc;return function(_0x557d26){if(_0x557d26){return _0x51e142[_0x3ffa('0x16')](_0x43731f);}return _0x51e142[_0x3ffa('0x17')](_0x43731f)[_0x3ffa('0x18')]();};}function respondWithResult(_0x4e822c,_0x310a57){_0x310a57=_0x310a57||0xc8;return function(_0x524695){if(_0x524695){return _0x4e822c[_0x3ffa('0x17')](_0x310a57)[_0x3ffa('0x19')](_0x524695);}};}function respondWithFilteredResult(_0x1e9bf2,_0x4fbf42){return function(_0xb77f5b){if(_0xb77f5b){var _0x51876d=typeof _0x4fbf42[_0x3ffa('0x1a')]==='undefined'&&typeof _0x4fbf42['limit']==='undefined';var _0x4679f5=_0xb77f5b[_0x3ffa('0x1b')];var _0x571177=_0x51876d?0x0:_0x4fbf42[_0x3ffa('0x1a')];var _0x34198a=_0x51876d?_0xb77f5b['count']:_0x4fbf42[_0x3ffa('0x1a')]+_0x4fbf42[_0x3ffa('0x1c')];var _0x5c0593;if(_0x34198a>=_0x4679f5){_0x34198a=_0x4679f5;_0x5c0593=0xc8;}else{_0x5c0593=0xce;}_0x1e9bf2['status'](_0x5c0593);return _0x1e9bf2[_0x3ffa('0x1d')]('Content-Range',_0x571177+'-'+_0x34198a+'/'+_0x4679f5)[_0x3ffa('0x19')](_0xb77f5b);}return null;};}function patchUpdates(_0x6fa1c9){return function(_0x30dc58){try{jsonpatch[_0x3ffa('0x1e')](_0x30dc58,_0x6fa1c9,!![]);}catch(_0x5deaee){return BPromise[_0x3ffa('0x1f')](_0x5deaee);}return _0x30dc58[_0x3ffa('0x20')]();};}function saveUpdates(_0x2ecf18,_0x20b8bb){return function(_0x5a8adb){if(_0x5a8adb){return _0x5a8adb[_0x3ffa('0x21')](_0x2ecf18)[_0x3ffa('0x22')](function(_0x14f410){return _0x14f410;});}return null;};}function removeEntity(_0x21095a,_0x138705){return function(_0x412f5d){if(_0x412f5d){return _0x412f5d[_0x3ffa('0x23')]()['then'](function(){_0x21095a[_0x3ffa('0x17')](0xcc)[_0x3ffa('0x18')]();});}};}function handleEntityNotFound(_0x4a81f2,_0x210d1e){return function(_0x2a0181){if(!_0x2a0181){_0x4a81f2[_0x3ffa('0x16')](0x194);}return _0x2a0181;};}function handleError(_0x19180b,_0x45adb5){_0x45adb5=_0x45adb5||0x1f4;return function(_0x4e2f4c){logger[_0x3ffa('0x24')](_0x4e2f4c['stack']);if(_0x4e2f4c[_0x3ffa('0x25')]){delete _0x4e2f4c['name'];}_0x19180b[_0x3ffa('0x17')](_0x45adb5)['send'](_0x4e2f4c);};}exports[_0x3ffa('0x26')]=function(_0x4c514f,_0x24a2bd){var _0x1f08c4={},_0x4f3fbf={},_0x47a1df={'count':0x0,'rows':[]};var _0x1a22c4=_[_0x3ffa('0x27')](db['ZohoConfiguration'][_0x3ffa('0x28')],function(_0x50ff08){return{'name':_0x50ff08[_0x3ffa('0x29')],'type':_0x50ff08[_0x3ffa('0x2a')]['key']};});_0x4f3fbf[_0x3ffa('0x2b')]=_['map'](_0x1a22c4,_0x3ffa('0x25'));_0x4f3fbf[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x4c514f['query']);_0x4f3fbf[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0x4f3fbf['model'],_0x4f3fbf[_0x3ffa('0x2c')]);_0x1f08c4[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x4f3fbf['model'],qs[_0x3ffa('0x31')](_0x4c514f['query']['fields']));_0x1f08c4[_0x3ffa('0x30')]=_0x1f08c4[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0x1f08c4[_0x3ffa('0x30')]:_0x4f3fbf[_0x3ffa('0x2b')];if(!_0x4c514f[_0x3ffa('0x2c')]['hasOwnProperty'](_0x3ffa('0x33'))){_0x1f08c4[_0x3ffa('0x1c')]=qs[_0x3ffa('0x1c')](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0x1f08c4[_0x3ffa('0x1a')]=qs['offset'](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x1a')]);}_0x1f08c4[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x35')]);_0x1f08c4['where']=qs[_0x3ffa('0x2e')](_['pick'](_0x4c514f['query'],_0x4f3fbf[_0x3ffa('0x2e')]),_0x1a22c4);if(_0x4c514f['query'][_0x3ffa('0x36')]){_0x1f08c4[_0x3ffa('0x37')]=_['merge'](_0x1f08c4[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x1a22c4,function(_0x19ef57){if(_0x19ef57[_0x3ffa('0x2a')]!==_0x3ffa('0x38')){var _0x32e339={};_0x32e339[_0x19ef57[_0x3ffa('0x25')]]={'$like':'%'+_0x4c514f[_0x3ffa('0x2c')]['filter']+'%'};return _0x32e339;}})});}_0x1f08c4=_[_0x3ffa('0x39')]({},_0x1f08c4,_0x4c514f[_0x3ffa('0x3a')]);var _0x58fbb0={'where':_0x1f08c4[_0x3ffa('0x37')]};return db[_0x3ffa('0x3b')][_0x3ffa('0x1b')](_0x58fbb0)[_0x3ffa('0x22')](function(_0x1dd42c){_0x47a1df[_0x3ffa('0x1b')]=_0x1dd42c;if(_0x4c514f['query'][_0x3ffa('0x3c')]){_0x1f08c4['include']=[{'all':!![]}];}return db[_0x3ffa('0x3b')][_0x3ffa('0x3d')](_0x1f08c4);})['then'](function(_0x4a0420){_0x47a1df[_0x3ffa('0x3e')]=_0x4a0420;return _0x47a1df;})['then'](respondWithFilteredResult(_0x24a2bd,_0x1f08c4))['catch'](handleError(_0x24a2bd,null));};exports[_0x3ffa('0x3f')]=function(_0x58e8ce,_0x2a056a){var _0x59891a={'raw':![],'where':{'id':_0x58e8ce[_0x3ffa('0x40')]['id']}},_0x40d4a6={};_0x40d4a6['model']=_['keys'](db[_0x3ffa('0x3b')][_0x3ffa('0x28')]);_0x40d4a6[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x58e8ce[_0x3ffa('0x2c')]);_0x40d4a6[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0x40d4a6[_0x3ffa('0x2b')],_0x40d4a6[_0x3ffa('0x2c')]);_0x59891a[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x40d4a6['model'],qs[_0x3ffa('0x31')](_0x58e8ce[_0x3ffa('0x2c')]['fields']));_0x59891a[_0x3ffa('0x30')]=_0x59891a[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0x59891a[_0x3ffa('0x30')]:_0x40d4a6[_0x3ffa('0x2b')];if(_0x58e8ce['query'][_0x3ffa('0x3c')]){_0x59891a[_0x3ffa('0x41')]=[{'all':!![]}];}_0x59891a=_[_0x3ffa('0x39')]({},_0x59891a,_0x58e8ce[_0x3ffa('0x3a')]);return db[_0x3ffa('0x3b')]['find'](_0x59891a)[_0x3ffa('0x22')](handleEntityNotFound(_0x2a056a,null))[_0x3ffa('0x22')](respondWithResult(_0x2a056a,null))['catch'](handleError(_0x2a056a,null));};exports[_0x3ffa('0x42')]=function(_0x3524d9,_0x3ecd20){return db[_0x3ffa('0x3b')][_0x3ffa('0x42')](_0x3524d9[_0x3ffa('0x43')],{})['then'](respondWithResult(_0x3ecd20,0xc9))[_0x3ffa('0x44')](handleError(_0x3ecd20,null));};exports[_0x3ffa('0x21')]=function(_0x2ee581,_0x2d46be){if(_0x2ee581[_0x3ffa('0x43')]['id']){delete _0x2ee581[_0x3ffa('0x43')]['id'];}return db['ZohoConfiguration'][_0x3ffa('0x45')]({'where':{'id':_0x2ee581[_0x3ffa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2d46be,null))[_0x3ffa('0x22')](saveUpdates(_0x2ee581[_0x3ffa('0x43')],null))[_0x3ffa('0x22')](respondWithResult(_0x2d46be,null))[_0x3ffa('0x44')](handleError(_0x2d46be,null));};exports[_0x3ffa('0x23')]=function(_0x5d7229,_0x42c5c7){return db[_0x3ffa('0x3b')][_0x3ffa('0x45')]({'where':{'id':_0x5d7229['params']['id']}})['then'](handleEntityNotFound(_0x42c5c7,null))['then'](removeEntity(_0x42c5c7,null))[_0x3ffa('0x44')](handleError(_0x42c5c7,null));};exports[_0x3ffa('0x46')]=function(_0x5d2330,_0x5f6111,_0x4009c3){var _0x371772={};var _0xb2d767={};var _0x4bfb2e;var _0x5df2f7;return db['ZohoConfiguration'][_0x3ffa('0x47')]({'where':{'id':_0x5d2330['params']['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x5f6111,null))[_0x3ffa('0x22')](function(_0xefd7fb){if(_0xefd7fb){_0x4bfb2e=_0xefd7fb;_0xb2d767[_0x3ffa('0x2b')]=_['keys'](db[_0x3ffa('0x48')]['rawAttributes']);_0xb2d767['query']=_[_0x3ffa('0x2d')](_0x5d2330['query']);_0xb2d767[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0xb2d767[_0x3ffa('0x2b')],_0xb2d767['query']);_0x371772[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0xb2d767[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x5d2330['query'][_0x3ffa('0x31')]));_0x371772['attributes']=_0x371772['attributes'][_0x3ffa('0x32')]?_0x371772['attributes']:_0xb2d767[_0x3ffa('0x2b')];_0x371772[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x5d2330['query']['sort']);_0x371772[_0x3ffa('0x37')]=qs[_0x3ffa('0x2e')](_['pick'](_0x5d2330[_0x3ffa('0x2c')],_0xb2d767['filters']));if(_0x5d2330[_0x3ffa('0x2c')][_0x3ffa('0x36')]){_0x371772['where']=_['merge'](_0x371772[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x371772[_0x3ffa('0x30')],function(_0x240106){var _0x2a305b={};_0x2a305b[_0x240106]={'$like':'%'+_0x5d2330[_0x3ffa('0x2c')]['filter']+'%'};return _0x2a305b;})});}_0x371772=_['merge']({},_0x371772,_0x5d2330[_0x3ffa('0x3a')]);return _0x4bfb2e['getFields'](_0x371772);}})[_0x3ffa('0x22')](function(_0x17d891){if(_0x17d891){_0x5df2f7=_0x17d891[_0x3ffa('0x32')];if(!_0x5d2330[_0x3ffa('0x2c')][_0x3ffa('0x49')]('nolimit')){_0x371772[_0x3ffa('0x1c')]=qs[_0x3ffa('0x1c')](_0x5d2330['query'][_0x3ffa('0x1c')]);_0x371772[_0x3ffa('0x1a')]=qs[_0x3ffa('0x1a')](_0x5d2330['query'][_0x3ffa('0x1a')]);}return _0x4bfb2e[_0x3ffa('0x46')](_0x371772);}})[_0x3ffa('0x22')](function(_0x34ca8a){if(_0x34ca8a){return _0x34ca8a?{'count':_0x5df2f7,'rows':_0x34ca8a}:null;}})['then'](respondWithResult(_0x5f6111,null))[_0x3ffa('0x44')](handleError(_0x5f6111,null));};exports[_0x3ffa('0x4a')]=function(_0x33bc01,_0x1c259a,_0x45a5c5){var _0xf66c47={};var _0x502aff={};var _0x39d044;var _0x1ddd8f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x33bc01[_0x3ffa('0x40')]['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x1c259a,null))[_0x3ffa('0x22')](function(_0x4f6260){if(_0x4f6260){_0x39d044=_0x4f6260;_0x502aff['model']=_[_0x3ffa('0x2d')](db[_0x3ffa('0x48')]['rawAttributes']);_0x502aff[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x33bc01[_0x3ffa('0x2c')]);_0x502aff[_0x3ffa('0x2e')]=_['intersection'](_0x502aff[_0x3ffa('0x2b')],_0x502aff[_0x3ffa('0x2c')]);_0xf66c47[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x502aff[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x33bc01[_0x3ffa('0x2c')]['fields']));_0xf66c47[_0x3ffa('0x30')]=_0xf66c47[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0xf66c47[_0x3ffa('0x30')]:_0x502aff[_0x3ffa('0x2b')];_0xf66c47[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x35')]);_0xf66c47[_0x3ffa('0x37')]=qs['filters'](_[_0x3ffa('0x4b')](_0x33bc01[_0x3ffa('0x2c')],_0x502aff[_0x3ffa('0x2e')]));if(_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x36')]){_0xf66c47[_0x3ffa('0x37')]=_[_0x3ffa('0x39')](_0xf66c47[_0x3ffa('0x37')],{'$or':_['map'](_0xf66c47[_0x3ffa('0x30')],function(_0x4c7e1b){var _0x3dac45={};_0x3dac45[_0x4c7e1b]={'$like':'%'+_0x33bc01[_0x3ffa('0x2c')]['filter']+'%'};return _0x3dac45;})});}_0xf66c47=_[_0x3ffa('0x39')]({},_0xf66c47,_0x33bc01[_0x3ffa('0x3a')]);return _0x39d044['getSubjects'](_0xf66c47);}})['then'](function(_0x1a2a27){if(_0x1a2a27){_0x1ddd8f=_0x1a2a27[_0x3ffa('0x32')];if(!_0x33bc01[_0x3ffa('0x2c')]['hasOwnProperty'](_0x3ffa('0x33'))){_0xf66c47[_0x3ffa('0x1c')]=qs['limit'](_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0xf66c47['offset']=qs[_0x3ffa('0x1a')](_0x33bc01['query'][_0x3ffa('0x1a')]);}return _0x39d044['getSubjects'](_0xf66c47);}})[_0x3ffa('0x22')](function(_0x453e87){if(_0x453e87){return _0x453e87?{'count':_0x1ddd8f,'rows':_0x453e87}:null;}})[_0x3ffa('0x22')](respondWithResult(_0x1c259a,null))['catch'](handleError(_0x1c259a,null));};exports[_0x3ffa('0x4c')]=function(_0x44b1a6,_0x435a0c,_0x27bfd2){var _0x3fa4fb={};var _0x57e751={};var _0x1e04bb;var _0x399134;return db['ZohoConfiguration'][_0x3ffa('0x47')]({'where':{'id':_0x44b1a6['params']['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x435a0c,null))[_0x3ffa('0x22')](function(_0x4134c2){if(_0x4134c2){_0x1e04bb=_0x4134c2;_0x57e751[_0x3ffa('0x2b')]=_['keys'](db[_0x3ffa('0x48')][_0x3ffa('0x28')]);_0x57e751[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x44b1a6[_0x3ffa('0x2c')]);_0x57e751['filters']=_[_0x3ffa('0x2f')](_0x57e751[_0x3ffa('0x2b')],_0x57e751[_0x3ffa('0x2c')]);_0x3fa4fb[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x57e751[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x31')]));_0x3fa4fb[_0x3ffa('0x30')]=_0x3fa4fb[_0x3ffa('0x30')]['length']?_0x3fa4fb[_0x3ffa('0x30')]:_0x57e751[_0x3ffa('0x2b')];_0x3fa4fb[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x44b1a6['query'][_0x3ffa('0x35')]);_0x3fa4fb[_0x3ffa('0x37')]=qs['filters'](_['pick'](_0x44b1a6['query'],_0x57e751['filters']));if(_0x44b1a6[_0x3ffa('0x2c')]['filter']){_0x3fa4fb[_0x3ffa('0x37')]=_[_0x3ffa('0x39')](_0x3fa4fb[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x3fa4fb[_0x3ffa('0x30')],function(_0x3c2967){var _0x106cf9={};_0x106cf9[_0x3c2967]={'$like':'%'+_0x44b1a6['query']['filter']+'%'};return _0x106cf9;})});}_0x3fa4fb=_[_0x3ffa('0x39')]({},_0x3fa4fb,_0x44b1a6[_0x3ffa('0x3a')]);return _0x1e04bb[_0x3ffa('0x4c')](_0x3fa4fb);}})[_0x3ffa('0x22')](function(_0x1f787f){if(_0x1f787f){_0x399134=_0x1f787f['length'];if(!_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x49')](_0x3ffa('0x33'))){_0x3fa4fb[_0x3ffa('0x1c')]=qs['limit'](_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0x3fa4fb[_0x3ffa('0x1a')]=qs[_0x3ffa('0x1a')](_0x44b1a6['query'][_0x3ffa('0x1a')]);}return _0x1e04bb[_0x3ffa('0x4c')](_0x3fa4fb);}})['then'](function(_0xbbd29e){if(_0xbbd29e){return _0xbbd29e?{'count':_0x399134,'rows':_0xbbd29e}:null;}})[_0x3ffa('0x22')](respondWithResult(_0x435a0c,null))[_0x3ffa('0x44')](handleError(_0x435a0c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c95e05e..357018a 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 _0x96be=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','lodash'];(function(_0x3323dc,_0x3e6f92){var _0x54d561=function(_0x1b002d){while(--_0x1b002d){_0x3323dc['push'](_0x3323dc['shift']());}};_0x54d561(++_0x3e6f92);}(_0x96be,0xf2));var _0xe96b=function(_0xb1f331,_0x2bb8be){_0xb1f331=_0xb1f331-0x0;var _0x5da118=_0x96be[_0xb1f331];return _0x5da118;};'use strict';var _=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var logger=require(_0xe96b('0x2'))(_0xe96b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe96b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe96b('0x5'));var config=require(_0xe96b('0x6'));var attributes=require(_0xe96b('0x7'));module[_0xe96b('0x8')]=function(_0x5d2ee4,_0x153d3b){return _0x5d2ee4['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05cb=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','lodash'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0x05cb,0x95));var _0xb05c=function(_0x14de5f,_0x4714b0){_0x14de5f=_0x14de5f-0x0;var _0x36c96d=_0x05cb[_0x14de5f];return _0x36c96d;};'use strict';var _=require(_0xb05c('0x0'));var util=require('util');var logger=require(_0xb05c('0x1'))(_0xb05c('0x2'));var moment=require(_0xb05c('0x3'));var BPromise=require(_0xb05c('0x4'));var rp=require(_0xb05c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb05c('0x6'));var config=require(_0xb05c('0x7'));var attributes=require(_0xb05c('0x8'));module[_0xb05c('0x9')]=function(_0x17773f,_0x397f41){return _0x17773f['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 99ab2b2..193e80c 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 _0xaf79=['jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x392164,_0x53d0e5){var _0x1b2bca=function(_0x277d83){while(--_0x277d83){_0x392164['push'](_0x392164['shift']());}};_0x1b2bca(++_0x53d0e5);}(_0xaf79,0x1af));var _0x9af7=function(_0x1d8990,_0x4382b5){_0x1d8990=_0x1d8990-0x0;var _0x5ce380=_0xaf79[_0x1d8990];return _0x5ce380;};'use strict';var _=require(_0x9af7('0x0'));var util=require(_0x9af7('0x1'));var moment=require(_0x9af7('0x2'));var BPromise=require('bluebird');var rs=require(_0x9af7('0x3'));var fs=require('fs');var Redis=require(_0x9af7('0x4'));var db=require(_0x9af7('0x5'))['db'];var utils=require(_0x9af7('0x6'));var logger=require('../../config/logger')(_0x9af7('0x7'));var config=require(_0x9af7('0x8'));var jayson=require(_0x9af7('0x9'));var client=jayson[_0x9af7('0xa')][_0x9af7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337e4e,_0x695e7b,_0x104719){return new BPromise(function(_0x161ab9,_0x54bd2c){return client['request'](_0x337e4e,_0x104719)['then'](function(_0x1c416b){logger[_0x9af7('0xc')](_0x9af7('0xd'),_0x695e7b,'request\x20sent');logger[_0x9af7('0xe')](_0x9af7('0xf'),_0x695e7b,'request\x20sent',JSON[_0x9af7('0x10')](_0x1c416b));if(_0x1c416b['error']){if(_0x1c416b[_0x9af7('0x11')][_0x9af7('0x12')]===0x1f4){logger[_0x9af7('0x11')](_0x9af7('0xd'),_0x695e7b,_0x1c416b[_0x9af7('0x11')][_0x9af7('0x13')]);return _0x54bd2c(_0x1c416b[_0x9af7('0x11')][_0x9af7('0x13')]);}logger[_0x9af7('0x11')](_0x9af7('0xd'),_0x695e7b,_0x1c416b[_0x9af7('0x11')][_0x9af7('0x13')]);return _0x161ab9(_0x1c416b['error']['message']);}else{logger[_0x9af7('0xc')](_0x9af7('0xd'),_0x695e7b,_0x9af7('0x14'));_0x161ab9(_0x1c416b[_0x9af7('0x15')][_0x9af7('0x13')]);}})['catch'](function(_0x3e321c){logger[_0x9af7('0x11')](_0x9af7('0xd'),_0x695e7b,_0x3e321c);_0x54bd2c(_0x3e321c);});});} \ No newline at end of file +var _0x8b06=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x533edf,_0x408bef){var _0x504d54=function(_0x5f4b81){while(--_0x5f4b81){_0x533edf['push'](_0x533edf['shift']());}};_0x504d54(++_0x408bef);}(_0x8b06,0x1ee));var _0x68b0=function(_0xb1aadf,_0xba8308){_0xb1aadf=_0xb1aadf-0x0;var _0x5b7be6=_0x8b06[_0xb1aadf];return _0x5b7be6;};'use strict';var _=require('lodash');var util=require(_0x68b0('0x0'));var moment=require(_0x68b0('0x1'));var BPromise=require(_0x68b0('0x2'));var rs=require(_0x68b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68b0('0x4'))['db'];var utils=require(_0x68b0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x68b0('0x6'));var jayson=require(_0x68b0('0x7'));var client=jayson[_0x68b0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1170,_0x17b826,_0x216522){return new BPromise(function(_0x4934bb,_0x1c2abd){return client[_0x68b0('0x9')](_0x3e1170,_0x216522)[_0x68b0('0xa')](function(_0x144fa8){logger[_0x68b0('0xb')](_0x68b0('0xc'),_0x17b826,_0x68b0('0xd'));logger[_0x68b0('0xe')](_0x68b0('0xf'),_0x17b826,'request\x20sent',JSON[_0x68b0('0x10')](_0x144fa8));if(_0x144fa8['error']){if(_0x144fa8['error'][_0x68b0('0x11')]===0x1f4){logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x144fa8['error'][_0x68b0('0x13')]);return _0x1c2abd(_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);}logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);return _0x4934bb(_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x17b826,'request\x20sent');_0x4934bb(_0x144fa8[_0x68b0('0x14')]['message']);}})[_0x68b0('0x15')](function(_0x58d450){logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x58d450);_0x1c2abd(_0x58d450);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8d08b34..eeeb6de 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 _0x1598=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x5a3212,_0x48e701){var _0x2b3f8d=function(_0x4bf56c){while(--_0x4bf56c){_0x5a3212['push'](_0x5a3212['shift']());}};_0x2b3f8d(++_0x48e701);}(_0x1598,0x90));var _0x8159=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1598[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8159('0x0'));var util=require(_0x8159('0x1'));var path=require(_0x8159('0x2'));var timeout=require('connect-timeout');var express=require(_0x8159('0x3'));var router=express[_0x8159('0x4')]();var fs_extra=require(_0x8159('0x5'));var auth=require(_0x8159('0x6'));var interaction=require(_0x8159('0x7'));var config=require(_0x8159('0x8'));var controller=require(_0x8159('0x9'));router[_0x8159('0xa')]('/',auth[_0x8159('0xb')](),controller[_0x8159('0xc')]);router[_0x8159('0xa')](_0x8159('0xd'),auth[_0x8159('0xb')](),controller[_0x8159('0xe')]);router[_0x8159('0xf')]('/',auth[_0x8159('0xb')](),controller[_0x8159('0x10')]);router[_0x8159('0x11')](_0x8159('0xd'),auth[_0x8159('0xb')](),controller[_0x8159('0x12')]);router[_0x8159('0x13')](_0x8159('0xd'),auth['isAuthenticated'](),controller[_0x8159('0x14')]);module[_0x8159('0x15')]=router; \ No newline at end of file +var _0x263e=['create','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4a4369,_0xeda22b){var _0x2f66fe=function(_0x4dfe21){while(--_0x4dfe21){_0x4a4369['push'](_0x4a4369['shift']());}};_0x2f66fe(++_0xeda22b);}(_0x263e,0x110));var _0xe263=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x263e[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xe263('0x0'));var util=require(_0xe263('0x1'));var path=require(_0xe263('0x2'));var timeout=require(_0xe263('0x3'));var express=require(_0xe263('0x4'));var router=express[_0xe263('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe263('0x6'));var config=require('../../config/environment');var controller=require(_0xe263('0x7'));router['get']('/',auth[_0xe263('0x8')](),controller[_0xe263('0x9')]);router[_0xe263('0xa')](_0xe263('0xb'),auth[_0xe263('0x8')](),controller[_0xe263('0xc')]);router['post']('/',auth[_0xe263('0x8')](),controller[_0xe263('0xd')]);router['put'](_0xe263('0xb'),auth[_0xe263('0x8')](),controller['update']);router['delete'](_0xe263('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe263('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ff04a94..6972321 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 _0x0cab=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x19b91f,_0x4b78f8){var _0x4767fa=function(_0x35893d){while(--_0x35893d){_0x19b91f['push'](_0x19b91f['shift']());}};_0x4767fa(++_0x4b78f8);}(_0x0cab,0x9d));var _0xb0ca=function(_0x1746a6,_0x441a6f){_0x1746a6=_0x1746a6-0x0;var _0xa7115d=_0x0cab[_0x1746a6];return _0xa7115d;};'use strict';var Sequelize=require(_0xb0ca('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb0ca('0x1'),_0xb0ca('0x2'),_0xb0ca('0x3'),_0xb0ca('0x4'),'picklist'),'defaultValue':_0xb0ca('0x1')},'content':{'type':Sequelize[_0xb0ca('0x5')]},'key':{'type':Sequelize[_0xb0ca('0x5')]},'keyType':{'type':Sequelize[_0xb0ca('0x6')](_0xb0ca('0x1'),'variable',_0xb0ca('0x3'))},'keyContent':{'type':Sequelize[_0xb0ca('0x5')]},'idField':{'type':Sequelize[_0xb0ca('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb0ca('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0ca('0x5')]}}; \ No newline at end of file +var _0x664a=['variable','customVariable','keyValue','picklist','STRING','string','exports','ENUM'];(function(_0x2f3782,_0x150f14){var _0x40a8c4=function(_0x1cdc87){while(--_0x1cdc87){_0x2f3782['push'](_0x2f3782['shift']());}};_0x40a8c4(++_0x150f14);}(_0x664a,0x9e));var _0xa664=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x664a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0xa664('0x0')]={'type':{'type':Sequelize[_0xa664('0x1')]('string',_0xa664('0x2'),_0xa664('0x3'),_0xa664('0x4'),_0xa664('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa664('0x6')]},'keyType':{'type':Sequelize[_0xa664('0x1')](_0xa664('0x7'),_0xa664('0x2'),_0xa664('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa664('0x6')]},'nameField':{'type':Sequelize[_0xa664('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa664('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 95424df..2678dfb 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 _0xd96d=['body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZohoField','fieldName','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','keys','rawAttributes','fields','length','find','create'];(function(_0x3c28c0,_0x1cb29d){var _0x12cc9f=function(_0x33d0f7){while(--_0x33d0f7){_0x3c28c0['push'](_0x3c28c0['shift']());}};_0x12cc9f(++_0x1cb29d);}(_0xd96d,0xe3));var _0xdd96=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xd96d[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xdd96('0x0'));var rimraf=require(_0xdd96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd96('0x2'));var rp=require(_0xdd96('0x3'));var moment=require(_0xdd96('0x4'));var BPromise=require(_0xdd96('0x5'));var Mustache=require('mustache');var util=require(_0xdd96('0x6'));var path=require(_0xdd96('0x7'));var sox=require(_0xdd96('0x8'));var csv=require(_0xdd96('0x9'));var ejs=require(_0xdd96('0xa'));var fs=require('fs');var fs_extra=require(_0xdd96('0xb'));var _=require(_0xdd96('0xc'));var squel=require(_0xdd96('0xd'));var crypto=require(_0xdd96('0xe'));var jsforce=require(_0xdd96('0xf'));var deskjs=require(_0xdd96('0x10'));var toCsv=require(_0xdd96('0x9'));var querystring=require(_0xdd96('0x11'));var Papa=require(_0xdd96('0x12'));var Redis=require(_0xdd96('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xdd96('0x14'));var as=require(_0xdd96('0x15'));var hardwareService=require(_0xdd96('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd96('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452457,_0xde70ca){_0xde70ca=_0xde70ca||0xcc;return function(_0x7ab776){if(_0x7ab776){return _0x452457['sendStatus'](_0xde70ca);}return _0x452457[_0xdd96('0x18')](_0xde70ca)['end']();};}function respondWithResult(_0x5a8c7f,_0xdc16cb){_0xdc16cb=_0xdc16cb||0xc8;return function(_0x1e22d0){if(_0x1e22d0){return _0x5a8c7f[_0xdd96('0x18')](_0xdc16cb)[_0xdd96('0x19')](_0x1e22d0);}};}function respondWithFilteredResult(_0x1f408d,_0x299d5c){return function(_0x1f869c){if(_0x1f869c){var _0x89bc29=typeof _0x299d5c[_0xdd96('0x1a')]==='undefined'&&typeof _0x299d5c['limit']===_0xdd96('0x1b');var _0x2440d3=_0x1f869c[_0xdd96('0x1c')];var _0x10f3a7=_0x89bc29?0x0:_0x299d5c[_0xdd96('0x1a')];var _0x195a99=_0x89bc29?_0x1f869c[_0xdd96('0x1c')]:_0x299d5c[_0xdd96('0x1a')]+_0x299d5c[_0xdd96('0x1d')];var _0x3d4043;if(_0x195a99>=_0x2440d3){_0x195a99=_0x2440d3;_0x3d4043=0xc8;}else{_0x3d4043=0xce;}_0x1f408d[_0xdd96('0x18')](_0x3d4043);return _0x1f408d['set'](_0xdd96('0x1e'),_0x10f3a7+'-'+_0x195a99+'/'+_0x2440d3)[_0xdd96('0x19')](_0x1f869c);}return null;};}function patchUpdates(_0x5f04a2){return function(_0x2abbff){try{jsonpatch[_0xdd96('0x1f')](_0x2abbff,_0x5f04a2,!![]);}catch(_0x12fd3b){return BPromise[_0xdd96('0x20')](_0x12fd3b);}return _0x2abbff[_0xdd96('0x21')]();};}function saveUpdates(_0x5d90a4,_0x5905be){return function(_0x544e17){if(_0x544e17){return _0x544e17[_0xdd96('0x22')](_0x5d90a4)[_0xdd96('0x23')](function(_0x2b2818){return _0x2b2818;});}return null;};}function removeEntity(_0x22359b,_0x38d87a){return function(_0x1e628e){if(_0x1e628e){return _0x1e628e[_0xdd96('0x24')]()[_0xdd96('0x23')](function(){_0x22359b[_0xdd96('0x18')](0xcc)[_0xdd96('0x25')]();});}};}function handleEntityNotFound(_0x4e3e86,_0x38bca9){return function(_0x24deb7){if(!_0x24deb7){_0x4e3e86[_0xdd96('0x26')](0x194);}return _0x24deb7;};}function handleError(_0x4e33bf,_0x369960){_0x369960=_0x369960||0x1f4;return function(_0x496ab4){logger[_0xdd96('0x27')](_0x496ab4[_0xdd96('0x28')]);if(_0x496ab4[_0xdd96('0x29')]){delete _0x496ab4[_0xdd96('0x29')];}_0x4e33bf['status'](_0x369960)[_0xdd96('0x2a')](_0x496ab4);};}exports[_0xdd96('0x2b')]=function(_0x38a911,_0x423593){var _0xd92c63={},_0x132483={},_0x3e2626={'count':0x0,'rows':[]};var _0x11e224=_[_0xdd96('0x2c')](db[_0xdd96('0x2d')]['rawAttributes'],function(_0x4f0044){return{'name':_0x4f0044[_0xdd96('0x2e')],'type':_0x4f0044['type'][_0xdd96('0x2f')]};});_0x132483[_0xdd96('0x30')]=_[_0xdd96('0x2c')](_0x11e224,_0xdd96('0x29'));_0x132483[_0xdd96('0x31')]=_['keys'](_0x38a911['query']);_0x132483['filters']=_[_0xdd96('0x32')](_0x132483[_0xdd96('0x30')],_0x132483[_0xdd96('0x31')]);_0xd92c63[_0xdd96('0x33')]=_[_0xdd96('0x32')](_0x132483[_0xdd96('0x30')],qs['fields'](_0x38a911[_0xdd96('0x31')]['fields']));_0xd92c63['attributes']=_0xd92c63[_0xdd96('0x33')]['length']?_0xd92c63[_0xdd96('0x33')]:_0x132483[_0xdd96('0x30')];if(!_0x38a911[_0xdd96('0x31')][_0xdd96('0x34')](_0xdd96('0x35'))){_0xd92c63[_0xdd96('0x1d')]=qs[_0xdd96('0x1d')](_0x38a911[_0xdd96('0x31')][_0xdd96('0x1d')]);_0xd92c63[_0xdd96('0x1a')]=qs['offset'](_0x38a911['query'][_0xdd96('0x1a')]);}_0xd92c63[_0xdd96('0x36')]=qs[_0xdd96('0x37')](_0x38a911[_0xdd96('0x31')][_0xdd96('0x37')]);_0xd92c63[_0xdd96('0x38')]=qs[_0xdd96('0x39')](_[_0xdd96('0x3a')](_0x38a911[_0xdd96('0x31')],_0x132483[_0xdd96('0x39')]),_0x11e224);if(_0x38a911['query'][_0xdd96('0x3b')]){_0xd92c63['where']=_['merge'](_0xd92c63['where'],{'$or':_['map'](_0x11e224,function(_0x419517){if(_0x419517['type']!==_0xdd96('0x3c')){var _0x2d396b={};_0x2d396b[_0x419517[_0xdd96('0x29')]]={'$like':'%'+_0x38a911[_0xdd96('0x31')]['filter']+'%'};return _0x2d396b;}})});}_0xd92c63=_[_0xdd96('0x3d')]({},_0xd92c63,_0x38a911[_0xdd96('0x3e')]);var _0x43432b={'where':_0xd92c63[_0xdd96('0x38')]};return db[_0xdd96('0x2d')][_0xdd96('0x1c')](_0x43432b)[_0xdd96('0x23')](function(_0x11866d){_0x3e2626[_0xdd96('0x1c')]=_0x11866d;if(_0x38a911[_0xdd96('0x31')][_0xdd96('0x3f')]){_0xd92c63[_0xdd96('0x40')]=[{'all':!![]}];}return db[_0xdd96('0x2d')]['findAll'](_0xd92c63);})[_0xdd96('0x23')](function(_0xc78352){_0x3e2626[_0xdd96('0x41')]=_0xc78352;return _0x3e2626;})[_0xdd96('0x23')](respondWithFilteredResult(_0x423593,_0xd92c63))[_0xdd96('0x42')](handleError(_0x423593,null));};exports['show']=function(_0x460554,_0x429fba){var _0x1f688a={'raw':!![],'where':{'id':_0x460554['params']['id']}},_0x51778f={};_0x51778f[_0xdd96('0x30')]=_[_0xdd96('0x43')](db[_0xdd96('0x2d')][_0xdd96('0x44')]);_0x51778f['query']=_[_0xdd96('0x43')](_0x460554['query']);_0x51778f[_0xdd96('0x39')]=_[_0xdd96('0x32')](_0x51778f['model'],_0x51778f['query']);_0x1f688a[_0xdd96('0x33')]=_[_0xdd96('0x32')](_0x51778f[_0xdd96('0x30')],qs[_0xdd96('0x45')](_0x460554['query'][_0xdd96('0x45')]));_0x1f688a[_0xdd96('0x33')]=_0x1f688a[_0xdd96('0x33')][_0xdd96('0x46')]?_0x1f688a[_0xdd96('0x33')]:_0x51778f[_0xdd96('0x30')];if(_0x460554[_0xdd96('0x31')][_0xdd96('0x3f')]){_0x1f688a[_0xdd96('0x40')]=[{'all':!![]}];}_0x1f688a=_['merge']({},_0x1f688a,_0x460554[_0xdd96('0x3e')]);return db[_0xdd96('0x2d')][_0xdd96('0x47')](_0x1f688a)['then'](handleEntityNotFound(_0x429fba,null))[_0xdd96('0x23')](respondWithResult(_0x429fba,null))[_0xdd96('0x42')](handleError(_0x429fba,null));};exports[_0xdd96('0x48')]=function(_0x185ca0,_0x4b116d){return db[_0xdd96('0x2d')][_0xdd96('0x48')](_0x185ca0[_0xdd96('0x49')],{})['then'](respondWithResult(_0x4b116d,0xc9))[_0xdd96('0x42')](handleError(_0x4b116d,null));};exports[_0xdd96('0x22')]=function(_0x347e36,_0x161a42){if(_0x347e36[_0xdd96('0x49')]['id']){delete _0x347e36[_0xdd96('0x49')]['id'];}return db[_0xdd96('0x2d')][_0xdd96('0x47')]({'where':{'id':_0x347e36[_0xdd96('0x4a')]['id']}})[_0xdd96('0x23')](handleEntityNotFound(_0x161a42,null))[_0xdd96('0x23')](saveUpdates(_0x347e36['body'],null))[_0xdd96('0x23')](respondWithResult(_0x161a42,null))[_0xdd96('0x42')](handleError(_0x161a42,null));};exports[_0xdd96('0x24')]=function(_0x4f4ef0,_0x45dda4){return db[_0xdd96('0x2d')][_0xdd96('0x47')]({'where':{'id':_0x4f4ef0[_0xdd96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45dda4,null))[_0xdd96('0x23')](removeEntity(_0x45dda4,null))[_0xdd96('0x42')](handleError(_0x45dda4,null));}; \ No newline at end of file +var _0x3fc4=['index','map','ZohoField','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x19bc11,_0x59c8e6){var _0x579c65=function(_0x237370){while(--_0x237370){_0x19bc11['push'](_0x19bc11['shift']());}};_0x579c65(++_0x59c8e6);}(_0x3fc4,0x6a));var _0x43fc=function(_0x220bd5,_0x318f24){_0x220bd5=_0x220bd5-0x0;var _0x3f9dc7=_0x3fc4[_0x220bd5];return _0x3f9dc7;};'use strict';var emlformat=require(_0x43fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43fc('0x2'));var moment=require(_0x43fc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43fc('0x4'));var util=require('util');var path=require(_0x43fc('0x5'));var sox=require(_0x43fc('0x6'));var csv=require(_0x43fc('0x7'));var ejs=require(_0x43fc('0x8'));var fs=require('fs');var fs_extra=require(_0x43fc('0x9'));var _=require(_0x43fc('0xa'));var squel=require(_0x43fc('0xb'));var crypto=require(_0x43fc('0xc'));var jsforce=require(_0x43fc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x43fc('0x7'));var querystring=require('querystring');var Papa=require(_0x43fc('0xe'));var Redis=require(_0x43fc('0xf'));var authService=require(_0x43fc('0x10'));var qs=require(_0x43fc('0x11'));var as=require(_0x43fc('0x12'));var hardwareService=require(_0x43fc('0x13'));var logger=require(_0x43fc('0x14'))(_0x43fc('0x15'));var utils=require(_0x43fc('0x16'));var config=require(_0x43fc('0x17'));var licenseUtil=require(_0x43fc('0x18'));var db=require(_0x43fc('0x19'))['db'];function respondWithStatusCode(_0x49e99e,_0x31fad6){_0x31fad6=_0x31fad6||0xcc;return function(_0x521199){if(_0x521199){return _0x49e99e[_0x43fc('0x1a')](_0x31fad6);}return _0x49e99e[_0x43fc('0x1b')](_0x31fad6)['end']();};}function respondWithResult(_0x3b2ef9,_0x4b3ccd){_0x4b3ccd=_0x4b3ccd||0xc8;return function(_0x30b087){if(_0x30b087){return _0x3b2ef9[_0x43fc('0x1b')](_0x4b3ccd)[_0x43fc('0x1c')](_0x30b087);}};}function respondWithFilteredResult(_0x53701e,_0x5e2c71){return function(_0x9a8b9d){if(_0x9a8b9d){var _0x43d7aa=typeof _0x5e2c71[_0x43fc('0x1d')]==='undefined'&&typeof _0x5e2c71['limit']==='undefined';var _0x43b860=_0x9a8b9d[_0x43fc('0x1e')];var _0xc8744e=_0x43d7aa?0x0:_0x5e2c71[_0x43fc('0x1d')];var _0x37f256=_0x43d7aa?_0x9a8b9d['count']:_0x5e2c71[_0x43fc('0x1d')]+_0x5e2c71[_0x43fc('0x1f')];var _0x582db0;if(_0x37f256>=_0x43b860){_0x37f256=_0x43b860;_0x582db0=0xc8;}else{_0x582db0=0xce;}_0x53701e[_0x43fc('0x1b')](_0x582db0);return _0x53701e[_0x43fc('0x20')](_0x43fc('0x21'),_0xc8744e+'-'+_0x37f256+'/'+_0x43b860)['json'](_0x9a8b9d);}return null;};}function patchUpdates(_0x57421b){return function(_0x2746d2){try{jsonpatch['apply'](_0x2746d2,_0x57421b,!![]);}catch(_0xd4fa71){return BPromise[_0x43fc('0x22')](_0xd4fa71);}return _0x2746d2[_0x43fc('0x23')]();};}function saveUpdates(_0x368cf0,_0x52be47){return function(_0xcdefbb){if(_0xcdefbb){return _0xcdefbb[_0x43fc('0x24')](_0x368cf0)[_0x43fc('0x25')](function(_0x253321){return _0x253321;});}return null;};}function removeEntity(_0x541820,_0x598258){return function(_0x49f3e8){if(_0x49f3e8){return _0x49f3e8[_0x43fc('0x26')]()['then'](function(){_0x541820[_0x43fc('0x1b')](0xcc)[_0x43fc('0x27')]();});}};}function handleEntityNotFound(_0x513805,_0x4e638a){return function(_0x55aaec){if(!_0x55aaec){_0x513805[_0x43fc('0x1a')](0x194);}return _0x55aaec;};}function handleError(_0x365644,_0x55f3f1){_0x55f3f1=_0x55f3f1||0x1f4;return function(_0x34d776){logger[_0x43fc('0x28')](_0x34d776[_0x43fc('0x29')]);if(_0x34d776['name']){delete _0x34d776[_0x43fc('0x2a')];}_0x365644['status'](_0x55f3f1)[_0x43fc('0x2b')](_0x34d776);};}exports[_0x43fc('0x2c')]=function(_0x13b11a,_0x544ef1){var _0x2d21c7={},_0x30b832={},_0x24c375={'count':0x0,'rows':[]};var _0x56c34f=_[_0x43fc('0x2d')](db[_0x43fc('0x2e')][_0x43fc('0x2f')],function(_0x231d8c){return{'name':_0x231d8c[_0x43fc('0x30')],'type':_0x231d8c[_0x43fc('0x31')]['key']};});_0x30b832[_0x43fc('0x32')]=_[_0x43fc('0x2d')](_0x56c34f,_0x43fc('0x2a'));_0x30b832['query']=_['keys'](_0x13b11a[_0x43fc('0x33')]);_0x30b832['filters']=_['intersection'](_0x30b832['model'],_0x30b832[_0x43fc('0x33')]);_0x2d21c7[_0x43fc('0x34')]=_[_0x43fc('0x35')](_0x30b832[_0x43fc('0x32')],qs[_0x43fc('0x36')](_0x13b11a[_0x43fc('0x33')]['fields']));_0x2d21c7[_0x43fc('0x34')]=_0x2d21c7[_0x43fc('0x34')]['length']?_0x2d21c7[_0x43fc('0x34')]:_0x30b832[_0x43fc('0x32')];if(!_0x13b11a[_0x43fc('0x33')]['hasOwnProperty'](_0x43fc('0x37'))){_0x2d21c7['limit']=qs[_0x43fc('0x1f')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x1f')]);_0x2d21c7['offset']=qs[_0x43fc('0x1d')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x1d')]);}_0x2d21c7['order']=qs[_0x43fc('0x38')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x38')]);_0x2d21c7[_0x43fc('0x39')]=qs[_0x43fc('0x3a')](_[_0x43fc('0x3b')](_0x13b11a[_0x43fc('0x33')],_0x30b832[_0x43fc('0x3a')]),_0x56c34f);if(_0x13b11a[_0x43fc('0x33')][_0x43fc('0x3c')]){_0x2d21c7[_0x43fc('0x39')]=_[_0x43fc('0x3d')](_0x2d21c7[_0x43fc('0x39')],{'$or':_[_0x43fc('0x2d')](_0x56c34f,function(_0x2e61b9){if(_0x2e61b9['type']!==_0x43fc('0x3e')){var _0x5ba140={};_0x5ba140[_0x2e61b9[_0x43fc('0x2a')]]={'$like':'%'+_0x13b11a[_0x43fc('0x33')][_0x43fc('0x3c')]+'%'};return _0x5ba140;}})});}_0x2d21c7=_[_0x43fc('0x3d')]({},_0x2d21c7,_0x13b11a[_0x43fc('0x3f')]);var _0x1a61a5={'where':_0x2d21c7[_0x43fc('0x39')]};return db['ZohoField'][_0x43fc('0x1e')](_0x1a61a5)['then'](function(_0x4c04a0){_0x24c375[_0x43fc('0x1e')]=_0x4c04a0;if(_0x13b11a[_0x43fc('0x33')][_0x43fc('0x40')]){_0x2d21c7[_0x43fc('0x41')]=[{'all':!![]}];}return db[_0x43fc('0x2e')][_0x43fc('0x42')](_0x2d21c7);})[_0x43fc('0x25')](function(_0x5f593c){_0x24c375[_0x43fc('0x43')]=_0x5f593c;return _0x24c375;})[_0x43fc('0x25')](respondWithFilteredResult(_0x544ef1,_0x2d21c7))[_0x43fc('0x44')](handleError(_0x544ef1,null));};exports[_0x43fc('0x45')]=function(_0x1ddc40,_0x538be2){var _0x227253={'raw':!![],'where':{'id':_0x1ddc40['params']['id']}},_0x3d626f={};_0x3d626f[_0x43fc('0x32')]=_[_0x43fc('0x46')](db[_0x43fc('0x2e')]['rawAttributes']);_0x3d626f[_0x43fc('0x33')]=_['keys'](_0x1ddc40['query']);_0x3d626f[_0x43fc('0x3a')]=_[_0x43fc('0x35')](_0x3d626f[_0x43fc('0x32')],_0x3d626f[_0x43fc('0x33')]);_0x227253[_0x43fc('0x34')]=_[_0x43fc('0x35')](_0x3d626f['model'],qs[_0x43fc('0x36')](_0x1ddc40[_0x43fc('0x33')][_0x43fc('0x36')]));_0x227253['attributes']=_0x227253['attributes'][_0x43fc('0x47')]?_0x227253['attributes']:_0x3d626f[_0x43fc('0x32')];if(_0x1ddc40[_0x43fc('0x33')]['includeAll']){_0x227253[_0x43fc('0x41')]=[{'all':!![]}];}_0x227253=_[_0x43fc('0x3d')]({},_0x227253,_0x1ddc40[_0x43fc('0x3f')]);return db[_0x43fc('0x2e')][_0x43fc('0x48')](_0x227253)[_0x43fc('0x25')](handleEntityNotFound(_0x538be2,null))[_0x43fc('0x25')](respondWithResult(_0x538be2,null))[_0x43fc('0x44')](handleError(_0x538be2,null));};exports[_0x43fc('0x49')]=function(_0x48a1c0,_0x495fb7){return db[_0x43fc('0x2e')][_0x43fc('0x49')](_0x48a1c0[_0x43fc('0x4a')],{})[_0x43fc('0x25')](respondWithResult(_0x495fb7,0xc9))[_0x43fc('0x44')](handleError(_0x495fb7,null));};exports['update']=function(_0x178a69,_0x319e5e){if(_0x178a69[_0x43fc('0x4a')]['id']){delete _0x178a69[_0x43fc('0x4a')]['id'];}return db[_0x43fc('0x2e')]['find']({'where':{'id':_0x178a69['params']['id']}})[_0x43fc('0x25')](handleEntityNotFound(_0x319e5e,null))[_0x43fc('0x25')](saveUpdates(_0x178a69[_0x43fc('0x4a')],null))[_0x43fc('0x25')](respondWithResult(_0x319e5e,null))['catch'](handleError(_0x319e5e,null));};exports[_0x43fc('0x26')]=function(_0x204787,_0x31dfca){return db[_0x43fc('0x2e')][_0x43fc('0x48')]({'where':{'id':_0x204787['params']['id']}})[_0x43fc('0x25')](handleEntityNotFound(_0x31dfca,null))[_0x43fc('0x25')](removeEntity(_0x31dfca,null))[_0x43fc('0x44')](handleError(_0x31dfca,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index bed47bf..acc3abf 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 _0x1967=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger','api','moment'];(function(_0x2e5be3,_0x37da27){var _0x5eda7e=function(_0x47c801){while(--_0x47c801){_0x2e5be3['push'](_0x2e5be3['shift']());}};_0x5eda7e(++_0x37da27);}(_0x1967,0x173));var _0x7196=function(_0x17378d,_0x5e58ac){_0x17378d=_0x17378d-0x0;var _0x966081=_0x1967[_0x17378d];return _0x966081;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['idField',_0x7196('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x6455,0x97));var _0x5645=function(_0x34ef4a,_0x9689be){_0x34ef4a=_0x34ef4a-0x0;var _0xc9c562=_0x6455[_0x34ef4a];return _0xc9c562;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9cd04d4..231d593 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 _0x7b46=['rpc','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','code','message','ZohoField,\x20%s,\x20%s','catch','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x68fdb0,_0x1229f4){var _0x35881d=function(_0x4d07fe){while(--_0x4d07fe){_0x68fdb0['push'](_0x68fdb0['shift']());}};_0x35881d(++_0x1229f4);}(_0x7b46,0x109));var _0x67b4=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7b46[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x67b4('0x0'));var util=require('util');var moment=require(_0x67b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x67b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x67b4('0x3'));var logger=require(_0x67b4('0x4'))(_0x67b4('0x5'));var config=require(_0x67b4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x67b4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab9dd,_0xaba485,_0x30f91b){return new BPromise(function(_0x235245,_0x38d031){return client[_0x67b4('0x8')](_0x1ab9dd,_0x30f91b)['then'](function(_0x29d577){logger[_0x67b4('0x9')]('ZohoField,\x20%s,\x20%s',_0xaba485,_0x67b4('0xa'));logger[_0x67b4('0xb')]('ZohoField,\x20%s,\x20%s,\x20%s',_0xaba485,_0x67b4('0xa'),JSON[_0x67b4('0xc')](_0x29d577));if(_0x29d577['error']){if(_0x29d577[_0x67b4('0xd')][_0x67b4('0xe')]===0x1f4){logger[_0x67b4('0xd')]('ZohoField,\x20%s,\x20%s',_0xaba485,_0x29d577['error'][_0x67b4('0xf')]);return _0x38d031(_0x29d577[_0x67b4('0xd')][_0x67b4('0xf')]);}logger['error'](_0x67b4('0x10'),_0xaba485,_0x29d577['error'][_0x67b4('0xf')]);return _0x235245(_0x29d577[_0x67b4('0xd')]['message']);}else{logger['info'](_0x67b4('0x10'),_0xaba485,_0x67b4('0xa'));_0x235245(_0x29d577['result']['message']);}})[_0x67b4('0x11')](function(_0x4dba29){logger['error'](_0x67b4('0x10'),_0xaba485,_0x4dba29);_0x38d031(_0x4dba29);});});} \ No newline at end of file +var _0x7177=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash'];(function(_0x5a0683,_0x49fba2){var _0x1ac947=function(_0x111af7){while(--_0x111af7){_0x5a0683['push'](_0x5a0683['shift']());}};_0x1ac947(++_0x49fba2);}(_0x7177,0x11d));var _0x7717=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x7177[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x7717('0x0'));var util=require(_0x7717('0x1'));var moment=require(_0x7717('0x2'));var BPromise=require(_0x7717('0x3'));var rs=require(_0x7717('0x4'));var fs=require('fs');var Redis=require(_0x7717('0x5'));var db=require(_0x7717('0x6'))['db'];var utils=require(_0x7717('0x7'));var logger=require(_0x7717('0x8'))(_0x7717('0x9'));var config=require(_0x7717('0xa'));var jayson=require(_0x7717('0xb'));var client=jayson[_0x7717('0xc')][_0x7717('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b0952,_0x5a88e2,_0xeca92){return new BPromise(function(_0x2a6278,_0x227261){return client[_0x7717('0xe')](_0x2b0952,_0xeca92)[_0x7717('0xf')](function(_0x316826){logger[_0x7717('0x10')](_0x7717('0x11'),_0x5a88e2,'request\x20sent');logger[_0x7717('0x12')](_0x7717('0x13'),_0x5a88e2,'request\x20sent',JSON[_0x7717('0x14')](_0x316826));if(_0x316826[_0x7717('0x15')]){if(_0x316826[_0x7717('0x15')][_0x7717('0x16')]===0x1f4){logger[_0x7717('0x15')]('ZohoField,\x20%s,\x20%s',_0x5a88e2,_0x316826[_0x7717('0x15')][_0x7717('0x17')]);return _0x227261(_0x316826['error']['message']);}logger[_0x7717('0x15')](_0x7717('0x11'),_0x5a88e2,_0x316826[_0x7717('0x15')][_0x7717('0x17')]);return _0x2a6278(_0x316826[_0x7717('0x15')][_0x7717('0x17')]);}else{logger['info'](_0x7717('0x11'),_0x5a88e2,_0x7717('0x18'));_0x2a6278(_0x316826[_0x7717('0x19')][_0x7717('0x17')]);}})['catch'](function(_0x2ebf9e){logger[_0x7717('0x15')](_0x7717('0x11'),_0x5a88e2,_0x2ebf9e);_0x227261(_0x2ebf9e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 98a4773..1ec242d 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x16fb70,_0x3e97f1){var _0x2e1aa1=function(_0x194373){while(--_0x194373){_0x16fb70['push'](_0x16fb70['shift']());}};_0x2e1aa1(++_0x3e97f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x533a7c,_0x2b39ed){var _0x3b6cbf=function(_0x45fe6a){while(--_0x45fe6a){_0x533a7c['push'](_0x533a7c['shift']());}};_0x3b6cbf(++_0x2b39ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x30fc68,_0x76a7b6){_0x30fc68=_0x30fc68-0x0;var _0x31be0d=_0xedd9[_0x30fc68];return _0x31be0d;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9fb4497..bd2ce59 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 _0x2369=['BOOLEAN','exports','STRING','app.js','INTEGER'];(function(_0x42d1f8,_0x22e529){var _0x40d234=function(_0xd59b57){while(--_0xd59b57){_0x42d1f8['push'](_0x42d1f8['shift']());}};_0x40d234(++_0x22e529);}(_0x2369,0x1e6));var _0x9236=function(_0x9ae1e,_0x251d11){_0x9ae1e=_0x9ae1e-0x0;var _0x5bd8f3=_0x2369[_0x9ae1e];return _0x5bd8f3;};'use strict';var Sequelize=require('sequelize');module[_0x9236('0x0')]={'name':{'type':Sequelize[_0x9236('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x9236('0x2')},'filename':{'type':Sequelize[_0x9236('0x1')]},'path':{'type':Sequelize[_0x9236('0x1')]},'type':{'type':Sequelize[_0x9236('0x1')]},'size':{'type':Sequelize[_0x9236('0x3')]},'active':{'type':Sequelize[_0x9236('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9236('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x9236('0x1')]},'title':{'type':Sequelize[_0x9236('0x1')]},'remoteUri':{'type':Sequelize[_0x9236('0x1')]},'link':{'type':Sequelize[_0x9236('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9366=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x358d7a,_0x1fa749){var _0x4df57=function(_0x371e2f){while(--_0x371e2f){_0x358d7a['push'](_0x358d7a['shift']());}};_0x4df57(++_0x1fa749);}(_0x9366,0x7a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6936('0x0'));module[_0x6936('0x1')]={'name':{'type':Sequelize[_0x6936('0x2')],'allowNull':![],'unique':_0x6936('0x3')},'version':{'type':Sequelize[_0x6936('0x2')],'allowNull':![],'unique':_0x6936('0x3')},'main':{'type':Sequelize[_0x6936('0x2')],'defaultValue':_0x6936('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6936('0x2')]},'type':{'type':Sequelize[_0x6936('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x6936('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x6936('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x6936('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6936('0x2')]},'link':{'type':Sequelize[_0x6936('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 c64efc0..0176208 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 _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1623,0xab));var _0x3162=function(_0x46eccf,_0x470642){_0x46eccf=_0x46eccf-0x0;var _0x4e4b21=_0x1623[_0x46eccf];return _0x4e4b21;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Integration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1f9f73,_0x36c448){var _0x5cecbc=function(_0x3af6a7){while(--_0x3af6a7){_0x1f9f73['push'](_0x1f9f73['shift']());}};_0x5cecbc(++_0x36c448);}(_0x7a54,0x106));var _0x47a5=function(_0x2d14cd,_0x1ce389){_0x2d14cd=_0x2d14cd-0x0;var _0x1cfcd9=_0x7a54[_0x2d14cd];return _0x1cfcd9;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['Integration'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['Integration']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['Integration']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7aef8da..1c1debc 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 _0x6bdc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6bdc,0x14f));var _0xc6bd=function(_0x705898,_0x117085){_0x705898=_0x705898-0x0;var _0x69424=_0x6bdc[_0x705898];return _0x69424;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6bd('0x7'));var config=require(_0xc6bd('0x8'));var attributes=require('./integration.attributes');module[_0xc6bd('0x9')]=function(_0x510333,_0x36c3c2){return _0x510333[_0xc6bd('0xa')](_0xc6bd('0xb'),attributes,{'tableName':_0xc6bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1324=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./integration.attributes','Integration','integrations'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x1324,0x11e));var _0x4132=function(_0x2c45d9,_0x1f0758){_0x2c45d9=_0x2c45d9-0x0;var _0x25043c=_0x1324[_0x2c45d9];return _0x25043c;};'use strict';var _=require(_0x4132('0x0'));var util=require(_0x4132('0x1'));var logger=require(_0x4132('0x2'))(_0x4132('0x3'));var moment=require('moment');var BPromise=require(_0x4132('0x4'));var rp=require(_0x4132('0x5'));var fs=require('fs');var path=require(_0x4132('0x6'));var rimraf=require(_0x4132('0x7'));var config=require('../../config/environment');var attributes=require(_0x4132('0x8'));module['exports']=function(_0xe13b2b,_0x1f87bd){return _0xe13b2b['define'](_0x4132('0x9'),attributes,{'tableName':_0x4132('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 098bc0d..53acacf 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x357c41,_0x533e94){var _0x5aa4c3=function(_0x5854e3){while(--_0x5854e3){_0x357c41['push'](_0x357c41['shift']());}};_0x5aa4c3(++_0x533e94);}(_0x57ca,0x108));var _0xa57c=function(_0x134353,_0x599b37){_0x134353=_0x134353-0x0;var _0x3ef328=_0x57ca[_0x134353];return _0x3ef328;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3d600b,_0x59c036){var _0x3c0e86=function(_0x1685d9){while(--_0x1685d9){_0x3d600b['push'](_0x3d600b['shift']());}};_0x3c0e86(++_0x59c036);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 91220e5..3f313c8 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x1fb506,_0x30ebff){var _0x147172=function(_0x34370e){while(--_0x34370e){_0x1fb506['push'](_0x1fb506['shift']());}};_0x147172(++_0x30ebff);}(_0x7a54,0x106));var _0x47a5=function(_0x14c74e,_0x36112e){_0x14c74e=_0x14c74e-0x0;var _0xf6535c=_0x7a54[_0x14c74e];return _0xf6535c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x53088e,_0x4e8f93){var _0x4827fe=function(_0x283fe9){while(--_0x283fe9){_0x53088e['push'](_0x53088e['shift']());}};_0x4827fe(++_0x4e8f93);}(_0x1261,0x144));var _0x1126=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x1261[_0x2bd1ec];return _0x2f7577;};'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')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 02b3139..65b6707 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 _0xa3c6=['DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','exports','STRING'];(function(_0x2739d4,_0x4017d1){var _0xa73181=function(_0x4f91d9){while(--_0x4f91d9){_0x2739d4['push'](_0x2739d4['shift']());}};_0xa73181(++_0x4017d1);}(_0xa3c6,0x1ca));var _0x6a3c=function(_0x5ad6b0,_0x34a832){_0x5ad6b0=_0x5ad6b0-0x0;var _0x29bb20=_0xa3c6[_0x5ad6b0];return _0x29bb20;};'use strict';var Sequelize=require('sequelize');module[_0x6a3c('0x0')]={'integration':{'type':Sequelize[_0x6a3c('0x1')]},'eventChannel':{'type':Sequelize[_0x6a3c('0x1')]},'exitStatus':{'type':Sequelize[_0x6a3c('0x1')]},'ticketId':{'type':Sequelize[_0x6a3c('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x6a3c('0x1')]},'uniqueid':{'type':Sequelize[_0x6a3c('0x1')]},'calleridnum':{'type':Sequelize[_0x6a3c('0x1')]},'calleridname':{'type':Sequelize[_0x6a3c('0x1')]},'queue':{'type':Sequelize[_0x6a3c('0x1')]},'interface':{'type':Sequelize[_0x6a3c('0x1')]},'membername':{'type':Sequelize[_0x6a3c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6a3c('0x2')]},'holdtime':{'type':Sequelize[_0x6a3c('0x3')]},'agentcomplete':{'type':Sequelize[_0x6a3c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6a3c('0x2')]},'talktime':{'type':Sequelize[_0x6a3c('0x3')]},'agentacw':{'type':Sequelize[_0x6a3c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a3c('0x3')]},'reason':{'type':Sequelize[_0x6a3c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x6a3c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6a3c('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6a3c('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6a3c('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6a3c('0x1')]},'connectedlinename':{'type':Sequelize[_0x6a3c('0x1')]},'language':{'type':Sequelize[_0x6a3c('0x1')]},'accountcode':{'type':Sequelize[_0x6a3c('0x1')]},'context':{'type':Sequelize[_0x6a3c('0x1')]},'exten':{'type':Sequelize[_0x6a3c('0x1')]},'priority':{'type':Sequelize[_0x6a3c('0x1')]},'destchannel':{'type':Sequelize[_0x6a3c('0x1')]},'destchannelstate':{'type':Sequelize[_0x6a3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x6a3c('0x1')]},'destcalleridname':{'type':Sequelize[_0x6a3c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x6a3c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6a3c('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6a3c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6a3c('0x1')]},'destpriority':{'type':Sequelize[_0x6a3c('0x1')]},'destuniqueid':{'type':Sequelize[_0x6a3c('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6a3c('0x1')]},'subject':{'type':Sequelize[_0x6a3c('0x1')]},'from':{'type':Sequelize[_0x6a3c('0x1')]},'to':{'type':Sequelize[_0x6a3c('0x1')]},'cc':{'type':Sequelize[_0x6a3c('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6a3c('0x5')]},'status':{'type':Sequelize[_0x6a3c('0x6')](_0x6a3c('0x7'),_0x6a3c('0x8'),'RECEIVED',_0x6a3c('0x9'))},'url':{'type':Sequelize[_0x6a3c('0x1')]},'app':{'type':Sequelize[_0x6a3c('0x1')]},'appdata':{'type':Sequelize[_0x6a3c('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa783=['TEXT','ENUM','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x34e97a,_0x2279fa){var _0x5602b9=function(_0x3e7f8e){while(--_0x3e7f8e){_0x34e97a['push'](_0x34e97a['shift']());}};_0x5602b9(++_0x2279fa);}(_0xa783,0x18a));var _0x3a78=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa783[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x3a78('0x0'));module[_0x3a78('0x1')]={'integration':{'type':Sequelize[_0x3a78('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3a78('0x2')]},'integrationId':{'type':Sequelize[_0x3a78('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a78('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3a78('0x2')]},'membername':{'type':Sequelize[_0x3a78('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3a78('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3a78('0x4')]},'talktime':{'type':Sequelize[_0x3a78('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3a78('0x3')]},'reason':{'type':Sequelize[_0x3a78('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3a78('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3a78('0x4')]},'agentdump':{'type':Sequelize[_0x3a78('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3a78('0x4')]},'lastevent':{'type':Sequelize[_0x3a78('0x2')]},'channel':{'type':Sequelize[_0x3a78('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3a78('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a78('0x2')]},'connectedlinename':{'type':Sequelize[_0x3a78('0x2')]},'language':{'type':Sequelize[_0x3a78('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3a78('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3a78('0x2')]},'destchannelstate':{'type':Sequelize[_0x3a78('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x3a78('0x2')]},'destcalleridname':{'type':Sequelize[_0x3a78('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3a78('0x2')]},'destlanguage':{'type':Sequelize[_0x3a78('0x2')]},'destaccountcode':{'type':Sequelize[_0x3a78('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3a78('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3a78('0x2')]},'messageId':{'type':Sequelize[_0x3a78('0x2')]},'inReplyTo':{'type':Sequelize[_0x3a78('0x2')]},'subject':{'type':Sequelize[_0x3a78('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3a78('0x2')]},'cc':{'type':Sequelize[_0x3a78('0x2')]},'attachment':{'type':Sequelize[_0x3a78('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3a78('0x6')]},'status':{'type':Sequelize[_0x3a78('0x7')]('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x3a78('0x2')]},'app':{'type':Sequelize[_0x3a78('0x2')]},'appdata':{'type':Sequelize[_0x3a78('0x2')]},'projectId':{'type':Sequelize[_0x3a78('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8892448..a45071e 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 _0xf435=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','then','error','name','map','IntegrationReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x535409,_0x4ff033){var _0x5b990f=function(_0xe3944){while(--_0xe3944){_0x535409['push'](_0x535409['shift']());}};_0x5b990f(++_0x4ff033);}(_0xf435,0x85));var _0x5f43=function(_0x4e9654,_0x59efa5){_0x4e9654=_0x4e9654-0x0;var _0x431994=_0xf435[_0x4e9654];return _0x431994;};'use strict';var emlformat=require(_0x5f43('0x0'));var rimraf=require(_0x5f43('0x1'));var zipdir=require(_0x5f43('0x2'));var jsonpatch=require(_0x5f43('0x3'));var rp=require(_0x5f43('0x4'));var moment=require(_0x5f43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f43('0x6'));var util=require(_0x5f43('0x7'));var path=require(_0x5f43('0x8'));var sox=require('sox');var csv=require(_0x5f43('0x9'));var ejs=require(_0x5f43('0xa'));var fs=require('fs');var fs_extra=require(_0x5f43('0xb'));var _=require('lodash');var squel=require(_0x5f43('0xc'));var crypto=require(_0x5f43('0xd'));var jsforce=require(_0x5f43('0xe'));var deskjs=require(_0x5f43('0xf'));var toCsv=require(_0x5f43('0x9'));var querystring=require(_0x5f43('0x10'));var Papa=require(_0x5f43('0x11'));var Redis=require(_0x5f43('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5f43('0x13'));var as=require(_0x5f43('0x14'));var hardwareService=require(_0x5f43('0x15'));var logger=require(_0x5f43('0x16'))(_0x5f43('0x17'));var utils=require('../../config/utils');var config=require(_0x5f43('0x18'));var licenseUtil=require(_0x5f43('0x19'));var db=require(_0x5f43('0x1a'))['db'];function respondWithStatusCode(_0x417ef8,_0x4fc79f){_0x4fc79f=_0x4fc79f||0xcc;return function(_0x46207d){if(_0x46207d){return _0x417ef8[_0x5f43('0x1b')](_0x4fc79f);}return _0x417ef8[_0x5f43('0x1c')](_0x4fc79f)[_0x5f43('0x1d')]();};}function respondWithResult(_0xf22c4d,_0x99504a){_0x99504a=_0x99504a||0xc8;return function(_0x408ad5){if(_0x408ad5){return _0xf22c4d[_0x5f43('0x1c')](_0x99504a)[_0x5f43('0x1e')](_0x408ad5);}};}function respondWithFilteredResult(_0x12413c,_0x5e98f1){return function(_0x4e22a7){if(_0x4e22a7){var _0x430b44=typeof _0x5e98f1[_0x5f43('0x1f')]==='undefined'&&typeof _0x5e98f1['limit']===_0x5f43('0x20');var _0x326c00=_0x4e22a7[_0x5f43('0x21')];var _0x19f2bc=_0x430b44?0x0:_0x5e98f1[_0x5f43('0x1f')];var _0x31c71d=_0x430b44?_0x4e22a7['count']:_0x5e98f1[_0x5f43('0x1f')]+_0x5e98f1['limit'];var _0x408c8f;if(_0x31c71d>=_0x326c00){_0x31c71d=_0x326c00;_0x408c8f=0xc8;}else{_0x408c8f=0xce;}_0x12413c[_0x5f43('0x1c')](_0x408c8f);return _0x12413c['set'](_0x5f43('0x22'),_0x19f2bc+'-'+_0x31c71d+'/'+_0x326c00)['json'](_0x4e22a7);}return null;};}function patchUpdates(_0x1759c0){return function(_0x1a6a1f){try{jsonpatch[_0x5f43('0x23')](_0x1a6a1f,_0x1759c0,!![]);}catch(_0x2d9b70){return BPromise[_0x5f43('0x24')](_0x2d9b70);}return _0x1a6a1f['save']();};}function saveUpdates(_0x2f343d,_0x127a0c){return function(_0xcc5fca){if(_0xcc5fca){return _0xcc5fca['update'](_0x2f343d)[_0x5f43('0x25')](function(_0x209257){return _0x209257;});}return null;};}function removeEntity(_0x3308b1,_0x19904c){return function(_0x3f0ae3){if(_0x3f0ae3){return _0x3f0ae3['destroy']()[_0x5f43('0x25')](function(){_0x3308b1[_0x5f43('0x1c')](0xcc)[_0x5f43('0x1d')]();});}};}function handleEntityNotFound(_0x5d7775,_0x31139e){return function(_0x1656b1){if(!_0x1656b1){_0x5d7775['sendStatus'](0x194);}return _0x1656b1;};}function handleError(_0x358115,_0x32ba4a){_0x32ba4a=_0x32ba4a||0x1f4;return function(_0x3ba885){logger[_0x5f43('0x26')](_0x3ba885['stack']);if(_0x3ba885[_0x5f43('0x27')]){delete _0x3ba885['name'];}_0x358115[_0x5f43('0x1c')](_0x32ba4a)['send'](_0x3ba885);};}exports['index']=function(_0x5c5765,_0x393212){var _0x17c156={},_0x38cba7={},_0x10d376={'count':0x0,'rows':[]};var _0x51809d=_[_0x5f43('0x28')](db[_0x5f43('0x29')][_0x5f43('0x2a')],function(_0x2ac0b1){return{'name':_0x2ac0b1['fieldName'],'type':_0x2ac0b1[_0x5f43('0x2b')][_0x5f43('0x2c')]};});_0x38cba7[_0x5f43('0x2d')]=_[_0x5f43('0x28')](_0x51809d,_0x5f43('0x27'));_0x38cba7[_0x5f43('0x2e')]=_['keys'](_0x5c5765[_0x5f43('0x2e')]);_0x38cba7['filters']=_[_0x5f43('0x2f')](_0x38cba7['model'],_0x38cba7['query']);_0x17c156[_0x5f43('0x30')]=_['intersection'](_0x38cba7['model'],qs[_0x5f43('0x31')](_0x5c5765['query'][_0x5f43('0x31')]));_0x17c156[_0x5f43('0x30')]=_0x17c156[_0x5f43('0x30')][_0x5f43('0x32')]?_0x17c156[_0x5f43('0x30')]:_0x38cba7[_0x5f43('0x2d')];if(!_0x5c5765[_0x5f43('0x2e')][_0x5f43('0x33')]('nolimit')){_0x17c156[_0x5f43('0x34')]=qs[_0x5f43('0x34')](_0x5c5765['query']['limit']);_0x17c156[_0x5f43('0x1f')]=qs[_0x5f43('0x1f')](_0x5c5765['query'][_0x5f43('0x1f')]);}_0x17c156[_0x5f43('0x35')]=qs[_0x5f43('0x36')](_0x5c5765[_0x5f43('0x2e')][_0x5f43('0x36')]);_0x17c156[_0x5f43('0x37')]=qs[_0x5f43('0x38')](_[_0x5f43('0x39')](_0x5c5765[_0x5f43('0x2e')],_0x38cba7[_0x5f43('0x38')]),_0x51809d);if(_0x5c5765[_0x5f43('0x2e')][_0x5f43('0x3a')]){_0x17c156[_0x5f43('0x37')]=_[_0x5f43('0x3b')](_0x17c156[_0x5f43('0x37')],{'$or':_['map'](_0x51809d,function(_0x4f2c30){if(_0x4f2c30[_0x5f43('0x2b')]!==_0x5f43('0x3c')){var _0x4dee42={};_0x4dee42[_0x4f2c30[_0x5f43('0x27')]]={'$like':'%'+_0x5c5765[_0x5f43('0x2e')][_0x5f43('0x3a')]+'%'};return _0x4dee42;}})});}_0x17c156=_[_0x5f43('0x3b')]({},_0x17c156,_0x5c5765['options']);var _0x19a5fb={'where':_0x17c156[_0x5f43('0x37')]};return db[_0x5f43('0x29')][_0x5f43('0x21')](_0x19a5fb)[_0x5f43('0x25')](function(_0x3e8103){_0x10d376['count']=_0x3e8103;if(_0x5c5765[_0x5f43('0x2e')][_0x5f43('0x3d')]){_0x17c156[_0x5f43('0x3e')]=[{'all':!![]}];}return db[_0x5f43('0x29')][_0x5f43('0x3f')](_0x17c156);})[_0x5f43('0x25')](function(_0x1e2891){_0x10d376['rows']=_0x1e2891;return _0x10d376;})[_0x5f43('0x25')](respondWithFilteredResult(_0x393212,_0x17c156))[_0x5f43('0x40')](handleError(_0x393212,null));};exports[_0x5f43('0x41')]=function(_0x564305,_0x19455b){var _0x2c189b={'raw':![],'where':{'id':_0x564305[_0x5f43('0x42')]['id']}},_0x625e50={};_0x625e50[_0x5f43('0x2d')]=_[_0x5f43('0x43')](db[_0x5f43('0x29')][_0x5f43('0x2a')]);_0x625e50[_0x5f43('0x2e')]=_[_0x5f43('0x43')](_0x564305[_0x5f43('0x2e')]);_0x625e50['filters']=_[_0x5f43('0x2f')](_0x625e50['model'],_0x625e50[_0x5f43('0x2e')]);_0x2c189b[_0x5f43('0x30')]=_[_0x5f43('0x2f')](_0x625e50[_0x5f43('0x2d')],qs['fields'](_0x564305['query'][_0x5f43('0x31')]));_0x2c189b[_0x5f43('0x30')]=_0x2c189b[_0x5f43('0x30')]['length']?_0x2c189b[_0x5f43('0x30')]:_0x625e50['model'];if(_0x564305['query']['includeAll']){_0x2c189b[_0x5f43('0x3e')]=[{'all':!![]}];}_0x2c189b=_['merge']({},_0x2c189b,_0x564305[_0x5f43('0x44')]);return db[_0x5f43('0x29')][_0x5f43('0x45')](_0x2c189b)[_0x5f43('0x25')](handleEntityNotFound(_0x19455b,null))[_0x5f43('0x25')](respondWithResult(_0x19455b,null))[_0x5f43('0x40')](handleError(_0x19455b,null));};exports[_0x5f43('0x46')]=function(_0x5cff67,_0x413120){return db[_0x5f43('0x29')]['create'](_0x5cff67[_0x5f43('0x47')],{})[_0x5f43('0x25')](respondWithResult(_0x413120,0xc9))[_0x5f43('0x40')](handleError(_0x413120,null));};exports['update']=function(_0xc0de82,_0x3a9c71){if(_0xc0de82[_0x5f43('0x47')]['id']){delete _0xc0de82[_0x5f43('0x47')]['id'];}return db[_0x5f43('0x29')][_0x5f43('0x45')]({'where':{'id':_0xc0de82[_0x5f43('0x42')]['id']}})[_0x5f43('0x25')](handleEntityNotFound(_0x3a9c71,null))[_0x5f43('0x25')](saveUpdates(_0xc0de82[_0x5f43('0x47')],null))[_0x5f43('0x25')](respondWithResult(_0x3a9c71,null))['catch'](handleError(_0x3a9c71,null));};exports[_0x5f43('0x48')]=function(_0x48452c,_0x1fca96){return db['IntegrationReport'][_0x5f43('0x45')]({'where':{'id':_0x48452c[_0x5f43('0x42')]['id']}})[_0x5f43('0x25')](handleEntityNotFound(_0x1fca96,null))['then'](removeEntity(_0x1fca96,null))['catch'](handleError(_0x1fca96,null));};exports[_0x5f43('0x49')]=function(_0x3adadd,_0x418af2){return db[_0x5f43('0x29')][_0x5f43('0x49')]()[_0x5f43('0x25')](respondWithResult(_0x418af2,null))[_0x5f43('0x40')](handleError(_0x418af2,null));}; \ No newline at end of file +var _0x97f4=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send'];(function(_0x22c907,_0x499099){var _0x20ebd0=function(_0x4ec82d){while(--_0x4ec82d){_0x22c907['push'](_0x22c907['shift']());}};_0x20ebd0(++_0x499099);}(_0x97f4,0x1e8));var _0x497f=function(_0x1c1f21,_0x3dc7de){_0x1c1f21=_0x1c1f21-0x0;var _0x131282=_0x97f4[_0x1c1f21];return _0x131282;};'use strict';var emlformat=require(_0x497f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x497f('0x1'));var jsonpatch=require(_0x497f('0x2'));var rp=require(_0x497f('0x3'));var moment=require(_0x497f('0x4'));var BPromise=require(_0x497f('0x5'));var Mustache=require('mustache');var util=require(_0x497f('0x6'));var path=require(_0x497f('0x7'));var sox=require('sox');var csv=require(_0x497f('0x8'));var ejs=require(_0x497f('0x9'));var fs=require('fs');var fs_extra=require(_0x497f('0xa'));var _=require(_0x497f('0xb'));var squel=require('squel');var crypto=require(_0x497f('0xc'));var jsforce=require(_0x497f('0xd'));var deskjs=require(_0x497f('0xe'));var toCsv=require(_0x497f('0x8'));var querystring=require(_0x497f('0xf'));var Papa=require(_0x497f('0x10'));var Redis=require(_0x497f('0x11'));var authService=require(_0x497f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x497f('0x13'));var logger=require(_0x497f('0x14'))(_0x497f('0x15'));var utils=require(_0x497f('0x16'));var config=require(_0x497f('0x17'));var licenseUtil=require(_0x497f('0x18'));var db=require(_0x497f('0x19'))['db'];function respondWithStatusCode(_0x266d67,_0x4707ec){_0x4707ec=_0x4707ec||0xcc;return function(_0x3e6992){if(_0x3e6992){return _0x266d67[_0x497f('0x1a')](_0x4707ec);}return _0x266d67['status'](_0x4707ec)['end']();};}function respondWithResult(_0x2b71bf,_0x5410ec){_0x5410ec=_0x5410ec||0xc8;return function(_0x3eed35){if(_0x3eed35){return _0x2b71bf[_0x497f('0x1b')](_0x5410ec)['json'](_0x3eed35);}};}function respondWithFilteredResult(_0xa548b,_0x40301a){return function(_0x4c7ce3){if(_0x4c7ce3){var _0x59f642=typeof _0x40301a['offset']==='undefined'&&typeof _0x40301a[_0x497f('0x1c')]===_0x497f('0x1d');var _0x4362bd=_0x4c7ce3['count'];var _0x24f7d0=_0x59f642?0x0:_0x40301a[_0x497f('0x1e')];var _0x4803ae=_0x59f642?_0x4c7ce3[_0x497f('0x1f')]:_0x40301a[_0x497f('0x1e')]+_0x40301a[_0x497f('0x1c')];var _0xd1ed0e;if(_0x4803ae>=_0x4362bd){_0x4803ae=_0x4362bd;_0xd1ed0e=0xc8;}else{_0xd1ed0e=0xce;}_0xa548b['status'](_0xd1ed0e);return _0xa548b['set'](_0x497f('0x20'),_0x24f7d0+'-'+_0x4803ae+'/'+_0x4362bd)[_0x497f('0x21')](_0x4c7ce3);}return null;};}function patchUpdates(_0x47af21){return function(_0xd3abf1){try{jsonpatch[_0x497f('0x22')](_0xd3abf1,_0x47af21,!![]);}catch(_0x3dbcf7){return BPromise[_0x497f('0x23')](_0x3dbcf7);}return _0xd3abf1['save']();};}function saveUpdates(_0x5f1b3b,_0x3d89cb){return function(_0x7f7cae){if(_0x7f7cae){return _0x7f7cae[_0x497f('0x24')](_0x5f1b3b)['then'](function(_0x30c330){return _0x30c330;});}return null;};}function removeEntity(_0x3d81ae,_0x3a51c4){return function(_0x52e219){if(_0x52e219){return _0x52e219[_0x497f('0x25')]()[_0x497f('0x26')](function(){_0x3d81ae[_0x497f('0x1b')](0xcc)[_0x497f('0x27')]();});}};}function handleEntityNotFound(_0x2b02dd,_0x146309){return function(_0x44746b){if(!_0x44746b){_0x2b02dd[_0x497f('0x1a')](0x194);}return _0x44746b;};}function handleError(_0x5bd35a,_0x56e8a7){_0x56e8a7=_0x56e8a7||0x1f4;return function(_0x37b8d9){logger[_0x497f('0x28')](_0x37b8d9[_0x497f('0x29')]);if(_0x37b8d9[_0x497f('0x2a')]){delete _0x37b8d9['name'];}_0x5bd35a[_0x497f('0x1b')](_0x56e8a7)[_0x497f('0x2b')](_0x37b8d9);};}exports[_0x497f('0x2c')]=function(_0x5a957b,_0x4538b9){var _0xa54c9f={},_0x66e2fc={},_0x4ff8ae={'count':0x0,'rows':[]};var _0x4a43d7=_[_0x497f('0x2d')](db[_0x497f('0x2e')][_0x497f('0x2f')],function(_0x463e14){return{'name':_0x463e14[_0x497f('0x30')],'type':_0x463e14[_0x497f('0x31')][_0x497f('0x32')]};});_0x66e2fc[_0x497f('0x33')]=_[_0x497f('0x2d')](_0x4a43d7,'name');_0x66e2fc[_0x497f('0x34')]=_[_0x497f('0x35')](_0x5a957b[_0x497f('0x34')]);_0x66e2fc[_0x497f('0x36')]=_['intersection'](_0x66e2fc[_0x497f('0x33')],_0x66e2fc[_0x497f('0x34')]);_0xa54c9f['attributes']=_[_0x497f('0x37')](_0x66e2fc[_0x497f('0x33')],qs[_0x497f('0x38')](_0x5a957b[_0x497f('0x34')]['fields']));_0xa54c9f[_0x497f('0x39')]=_0xa54c9f['attributes'][_0x497f('0x3a')]?_0xa54c9f[_0x497f('0x39')]:_0x66e2fc['model'];if(!_0x5a957b[_0x497f('0x34')]['hasOwnProperty'](_0x497f('0x3b'))){_0xa54c9f[_0x497f('0x1c')]=qs[_0x497f('0x1c')](_0x5a957b['query'][_0x497f('0x1c')]);_0xa54c9f[_0x497f('0x1e')]=qs[_0x497f('0x1e')](_0x5a957b[_0x497f('0x34')]['offset']);}_0xa54c9f['order']=qs[_0x497f('0x3c')](_0x5a957b['query'][_0x497f('0x3c')]);_0xa54c9f[_0x497f('0x3d')]=qs[_0x497f('0x36')](_['pick'](_0x5a957b['query'],_0x66e2fc[_0x497f('0x36')]),_0x4a43d7);if(_0x5a957b[_0x497f('0x34')][_0x497f('0x3e')]){_0xa54c9f[_0x497f('0x3d')]=_[_0x497f('0x3f')](_0xa54c9f['where'],{'$or':_[_0x497f('0x2d')](_0x4a43d7,function(_0x4faae8){if(_0x4faae8['type']!==_0x497f('0x40')){var _0x1b3615={};_0x1b3615[_0x4faae8[_0x497f('0x2a')]]={'$like':'%'+_0x5a957b[_0x497f('0x34')][_0x497f('0x3e')]+'%'};return _0x1b3615;}})});}_0xa54c9f=_[_0x497f('0x3f')]({},_0xa54c9f,_0x5a957b[_0x497f('0x41')]);var _0x5713da={'where':_0xa54c9f['where']};return db['IntegrationReport']['count'](_0x5713da)[_0x497f('0x26')](function(_0x2d1322){_0x4ff8ae[_0x497f('0x1f')]=_0x2d1322;if(_0x5a957b[_0x497f('0x34')][_0x497f('0x42')]){_0xa54c9f['include']=[{'all':!![]}];}return db[_0x497f('0x2e')][_0x497f('0x43')](_0xa54c9f);})[_0x497f('0x26')](function(_0x5bddcf){_0x4ff8ae[_0x497f('0x44')]=_0x5bddcf;return _0x4ff8ae;})[_0x497f('0x26')](respondWithFilteredResult(_0x4538b9,_0xa54c9f))[_0x497f('0x45')](handleError(_0x4538b9,null));};exports[_0x497f('0x46')]=function(_0x351227,_0x37084a){var _0x20f2b9={'raw':![],'where':{'id':_0x351227[_0x497f('0x47')]['id']}},_0x1f3ffd={};_0x1f3ffd[_0x497f('0x33')]=_['keys'](db[_0x497f('0x2e')][_0x497f('0x2f')]);_0x1f3ffd['query']=_[_0x497f('0x35')](_0x351227[_0x497f('0x34')]);_0x1f3ffd[_0x497f('0x36')]=_[_0x497f('0x37')](_0x1f3ffd[_0x497f('0x33')],_0x1f3ffd[_0x497f('0x34')]);_0x20f2b9[_0x497f('0x39')]=_['intersection'](_0x1f3ffd[_0x497f('0x33')],qs['fields'](_0x351227[_0x497f('0x34')]['fields']));_0x20f2b9[_0x497f('0x39')]=_0x20f2b9[_0x497f('0x39')][_0x497f('0x3a')]?_0x20f2b9[_0x497f('0x39')]:_0x1f3ffd['model'];if(_0x351227[_0x497f('0x34')][_0x497f('0x42')]){_0x20f2b9[_0x497f('0x48')]=[{'all':!![]}];}_0x20f2b9=_['merge']({},_0x20f2b9,_0x351227[_0x497f('0x41')]);return db[_0x497f('0x2e')][_0x497f('0x49')](_0x20f2b9)['then'](handleEntityNotFound(_0x37084a,null))[_0x497f('0x26')](respondWithResult(_0x37084a,null))[_0x497f('0x45')](handleError(_0x37084a,null));};exports['create']=function(_0x3e0f45,_0x5f48f2){return db[_0x497f('0x2e')]['create'](_0x3e0f45['body'],{})['then'](respondWithResult(_0x5f48f2,0xc9))[_0x497f('0x45')](handleError(_0x5f48f2,null));};exports[_0x497f('0x24')]=function(_0x21f74e,_0x5ed8f3){if(_0x21f74e[_0x497f('0x4a')]['id']){delete _0x21f74e['body']['id'];}return db[_0x497f('0x2e')][_0x497f('0x49')]({'where':{'id':_0x21f74e[_0x497f('0x47')]['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x5ed8f3,null))[_0x497f('0x26')](saveUpdates(_0x21f74e[_0x497f('0x4a')],null))[_0x497f('0x26')](respondWithResult(_0x5ed8f3,null))[_0x497f('0x45')](handleError(_0x5ed8f3,null));};exports[_0x497f('0x25')]=function(_0x34a7d6,_0x47c4fa){return db[_0x497f('0x2e')][_0x497f('0x49')]({'where':{'id':_0x34a7d6['params']['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x47c4fa,null))[_0x497f('0x26')](removeEntity(_0x47c4fa,null))[_0x497f('0x45')](handleError(_0x47c4fa,null));};exports[_0x497f('0x4b')]=function(_0x4dd047,_0x4634dc){return db[_0x497f('0x2e')]['describe']()[_0x497f('0x26')](respondWithResult(_0x4634dc,null))[_0x497f('0x45')](handleError(_0x4634dc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d0ce072..9359ec9 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 _0xd8d2=['exports','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x2c4d9b,_0x474c61){var _0x1007f6=function(_0x1c708a){while(--_0x1c708a){_0x2c4d9b['push'](_0x2c4d9b['shift']());}};_0x1007f6(++_0x474c61);}(_0xd8d2,0x1e2));var _0x2d8d=function(_0x1338d6,_0x49be65){_0x1338d6=_0x1338d6-0x0;var _0x4db601=_0xd8d2[_0x1338d6];return _0x4db601;};'use strict';var _=require(_0x2d8d('0x0'));var util=require(_0x2d8d('0x1'));var logger=require(_0x2d8d('0x2'))(_0x2d8d('0x3'));var moment=require(_0x2d8d('0x4'));var BPromise=require(_0x2d8d('0x5'));var rp=require(_0x2d8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d8d('0x7'));var config=require(_0x2d8d('0x8'));var attributes=require(_0x2d8d('0x9'));module[_0x2d8d('0xa')]=function(_0x1163c6,_0x1df070){return _0x1163c6['define'](_0x2d8d('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcc0=['api','moment','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','../../config/logger'];(function(_0x41bd12,_0xb8a5e0){var _0x5a614f=function(_0x3f5898){while(--_0x3f5898){_0x41bd12['push'](_0x41bd12['shift']());}};_0x5a614f(++_0xb8a5e0);}(_0xdcc0,0x94));var _0x0dcc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcc0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0dcc('0x0'));var util=require('util');var logger=require(_0x0dcc('0x1'))(_0x0dcc('0x2'));var moment=require(_0x0dcc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0dcc('0x4'));var config=require(_0x0dcc('0x5'));var attributes=require(_0x0dcc('0x6'));module[_0x0dcc('0x7')]=function(_0x2a64ee,_0x3cdd42){return _0x2a64ee[_0x0dcc('0x8')](_0x0dcc('0x9'),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 105f6d0..5b64822 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xf494,0x1c6));var _0x4f49=function(_0x5673f2,_0x74fc53){_0x5673f2=_0x5673f2-0x0;var _0x1d457d=_0xf494[_0x5673f2];return _0x1d457d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x4975,0x86));var _0x5497=function(_0x5f3cbd,_0x26a517){_0x5f3cbd=_0x5f3cbd-0x0;var _0x14eb16=_0x4975[_0x5f3cbd];return _0x14eb16;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e996437..efce59a 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 _0x4e3e=['isAuthenticated','get','/:id/sub_intervals','getIntervals','addInterval','/:id/sub_intervals/create_many','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id'];(function(_0x152998,_0x673cc5){var _0x348f90=function(_0x2c1054){while(--_0x2c1054){_0x152998['push'](_0x152998['shift']());}};_0x348f90(++_0x673cc5);}(_0x4e3e,0x139));var _0xe4e3=function(_0x226212,_0x3471a3){_0x226212=_0x226212-0x0;var _0x37e7bf=_0x4e3e[_0x226212];return _0x37e7bf;};'use strict';var multer=require(_0xe4e3('0x0'));var util=require('util');var path=require(_0xe4e3('0x1'));var timeout=require(_0xe4e3('0x2'));var express=require(_0xe4e3('0x3'));var router=express[_0xe4e3('0x4')]();var fs_extra=require(_0xe4e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe4e3('0x6'));var config=require(_0xe4e3('0x7'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe4e3('0x8')]);router['get'](_0xe4e3('0x9'),auth[_0xe4e3('0xa')](),controller['show']);router[_0xe4e3('0xb')](_0xe4e3('0xc'),auth[_0xe4e3('0xa')](),controller[_0xe4e3('0xd')]);router['post']('/',auth[_0xe4e3('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xe4e3('0xa')](),controller[_0xe4e3('0xe')]);router['post'](_0xe4e3('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xe4e3('0x10')](_0xe4e3('0x9'),auth[_0xe4e3('0xa')](),controller[_0xe4e3('0x11')]);router['delete'](_0xe4e3('0x9'),auth[_0xe4e3('0xa')](),controller['destroy']);module[_0xe4e3('0x12')]=router; \ No newline at end of file +var _0x7ed1=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals'];(function(_0x380fac,_0x133494){var _0xdddfe4=function(_0x1dbb98){while(--_0x1dbb98){_0x380fac['push'](_0x380fac['shift']());}};_0xdddfe4(++_0x133494);}(_0x7ed1,0xca));var _0x17ed=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x7ed1[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x17ed('0x0'));var util=require('util');var path=require(_0x17ed('0x1'));var timeout=require(_0x17ed('0x2'));var express=require(_0x17ed('0x3'));var router=express[_0x17ed('0x4')]();var fs_extra=require(_0x17ed('0x5'));var auth=require(_0x17ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x17ed('0x7'));var controller=require(_0x17ed('0x8'));router[_0x17ed('0x9')]('/',auth[_0x17ed('0xa')](),controller['index']);router['get'](_0x17ed('0xb'),auth[_0x17ed('0xa')](),controller[_0x17ed('0xc')]);router[_0x17ed('0x9')]('/:id/sub_intervals',auth[_0x17ed('0xa')](),controller[_0x17ed('0xd')]);router[_0x17ed('0xe')]('/',auth[_0x17ed('0xa')](),controller[_0x17ed('0xf')]);router[_0x17ed('0xe')]('/:id/sub_intervals',auth[_0x17ed('0xa')](),controller['addInterval']);router['post'](_0x17ed('0x10'),auth[_0x17ed('0xa')](),controller[_0x17ed('0x11')]);router[_0x17ed('0x12')](_0x17ed('0xb'),auth['isAuthenticated'](),controller[_0x17ed('0x13')]);router[_0x17ed('0x14')](_0x17ed('0xb'),auth['isAuthenticated'](),controller[_0x17ed('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3a6618c..e2f42bf 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 _0xc3ef=['STRING','exports'];(function(_0x2d6245,_0x1e5d99){var _0x3ff703=function(_0x58c5e0){while(--_0x58c5e0){_0x2d6245['push'](_0x2d6245['shift']());}};_0x3ff703(++_0x1e5d99);}(_0xc3ef,0x17d));var _0xfc3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc3ef[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xfc3e('0x0')]={'name':{'type':Sequelize[_0xfc3e('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfc3e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xe94d=['sequelize','exports','STRING'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe94d,0x144));var _0xde94=function(_0x2c6189,_0x41ce2a){_0x2c6189=_0x2c6189-0x0;var _0x46b94a=_0xe94d[_0x2c6189];return _0x46b94a;};'use strict';var Sequelize=require(_0xde94('0x0'));module[_0xde94('0x1')]={'name':{'type':Sequelize[_0xde94('0x2')]},'description':{'type':Sequelize[_0xde94('0x2')]},'interval':{'type':Sequelize[_0xde94('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 958612c..5b8e434 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 _0x6908=['role','find','userProfileId','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','transaction','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','end','json','undefined','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','stack','name','Interval','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','length','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2c6cfd,_0x5b8d9f){var _0x4c86f8=function(_0x38ad07){while(--_0x38ad07){_0x2c6cfd['push'](_0x2c6cfd['shift']());}};_0x4c86f8(++_0x5b8d9f);}(_0x6908,0x15a));var _0x8690=function(_0x172b39,_0x52bbb1){_0x172b39=_0x172b39-0x0;var _0x3baad7=_0x6908[_0x172b39];return _0x3baad7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8690('0x0'));var rp=require(_0x8690('0x1'));var moment=require(_0x8690('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8690('0x3'));var util=require(_0x8690('0x4'));var path=require(_0x8690('0x5'));var sox=require(_0x8690('0x6'));var csv=require(_0x8690('0x7'));var ejs=require(_0x8690('0x8'));var fs=require('fs');var fs_extra=require(_0x8690('0x9'));var _=require(_0x8690('0xa'));var squel=require(_0x8690('0xb'));var crypto=require(_0x8690('0xc'));var jsforce=require(_0x8690('0xd'));var deskjs=require(_0x8690('0xe'));var toCsv=require(_0x8690('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8690('0xf'));var qs=require(_0x8690('0x10'));var as=require(_0x8690('0x11'));var hardwareService=require(_0x8690('0x12'));var logger=require(_0x8690('0x13'))(_0x8690('0x14'));var utils=require(_0x8690('0x15'));var config=require(_0x8690('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x8690('0x17'));function respondWithStatusCode(_0x1fb40d,_0xc47ad0){_0xc47ad0=_0xc47ad0||0xcc;return function(_0x3fbc13){if(_0x3fbc13){return _0x1fb40d[_0x8690('0x18')](_0xc47ad0);}return _0x1fb40d['status'](_0xc47ad0)[_0x8690('0x19')]();};}function respondWithResult(_0x5036a1,_0x1b70d6){_0x1b70d6=_0x1b70d6||0xc8;return function(_0x4e0817){if(_0x4e0817){return _0x5036a1['status'](_0x1b70d6)[_0x8690('0x1a')](_0x4e0817);}};}function respondWithFilteredResult(_0x4fcc01,_0x5ee7c0){return function(_0x5b2190){if(_0x5b2190){var _0x488ce1=typeof _0x5ee7c0['offset']===_0x8690('0x1b')&&typeof _0x5ee7c0['limit']==='undefined';var _0x43de20=_0x5b2190[_0x8690('0x1c')];var _0x59393c=_0x488ce1?0x0:_0x5ee7c0['offset'];var _0x18069f=_0x488ce1?_0x5b2190[_0x8690('0x1c')]:_0x5ee7c0[_0x8690('0x1d')]+_0x5ee7c0[_0x8690('0x1e')];var _0x4edd79;if(_0x18069f>=_0x43de20){_0x18069f=_0x43de20;_0x4edd79=0xc8;}else{_0x4edd79=0xce;}_0x4fcc01[_0x8690('0x1f')](_0x4edd79);return _0x4fcc01['set'](_0x8690('0x20'),_0x59393c+'-'+_0x18069f+'/'+_0x43de20)['json'](_0x5b2190);}return null;};}function patchUpdates(_0x339e27){return function(_0x330124){try{jsonpatch[_0x8690('0x21')](_0x330124,_0x339e27,!![]);}catch(_0x57cbf4){return BPromise[_0x8690('0x22')](_0x57cbf4);}return _0x330124[_0x8690('0x23')]();};}function saveUpdates(_0x74a4f2,_0x467160){return function(_0x1373eb){if(_0x1373eb){return _0x1373eb[_0x8690('0x24')](_0x74a4f2)[_0x8690('0x25')](function(_0x265540){return _0x265540;});}return null;};}function removeEntity(_0x33e129,_0x3252b9){return function(_0x1a8c05){if(_0x1a8c05){return _0x1a8c05[_0x8690('0x26')]()[_0x8690('0x25')](function(){var _0x141d65=_0x1a8c05['get']({'plain':!![]});var _0x1f3186=_0x8690('0x27');return db[_0x8690('0x28')][_0x8690('0x26')]({'where':{'type':_0x1f3186,'resourceId':_0x141d65['id']}})[_0x8690('0x25')](function(){return _0x1a8c05;});})['then'](function(){_0x33e129['status'](0xcc)[_0x8690('0x19')]();});}};}function handleEntityNotFound(_0x23c746,_0x35c29a){return function(_0x7eeaa4){if(!_0x7eeaa4){_0x23c746[_0x8690('0x18')](0x194);}return _0x7eeaa4;};}function handleError(_0x2eabcd,_0x465ca8){_0x465ca8=_0x465ca8||0x1f4;return function(_0x3a2321){logger['error'](_0x3a2321[_0x8690('0x29')]);if(_0x3a2321['name']){delete _0x3a2321[_0x8690('0x2a')];}_0x2eabcd['status'](_0x465ca8)['send'](_0x3a2321);};}exports['index']=function(_0x3f2fb8,_0x4e7f5c){var _0x5a2bc3={},_0x4d27d0={},_0x39ca6f={'count':0x0,'rows':[]};var _0x1da1d5=_['map'](db[_0x8690('0x2b')][_0x8690('0x2c')],function(_0x2ca96b){return{'name':_0x2ca96b['fieldName'],'type':_0x2ca96b[_0x8690('0x2d')]['key']};});_0x4d27d0[_0x8690('0x2e')]=_[_0x8690('0x2f')](_0x1da1d5,_0x8690('0x2a'));_0x4d27d0['query']=_['keys'](_0x3f2fb8[_0x8690('0x30')]);_0x4d27d0[_0x8690('0x31')]=_[_0x8690('0x32')](_0x4d27d0[_0x8690('0x2e')],_0x4d27d0[_0x8690('0x30')]);_0x5a2bc3['attributes']=_[_0x8690('0x32')](_0x4d27d0[_0x8690('0x2e')],qs[_0x8690('0x33')](_0x3f2fb8[_0x8690('0x30')][_0x8690('0x33')]));_0x5a2bc3[_0x8690('0x34')]=_0x5a2bc3[_0x8690('0x34')]['length']?_0x5a2bc3[_0x8690('0x34')]:_0x4d27d0[_0x8690('0x2e')];if(!_0x3f2fb8[_0x8690('0x30')]['hasOwnProperty'](_0x8690('0x35'))){_0x5a2bc3[_0x8690('0x1e')]=qs['limit'](_0x3f2fb8['query']['limit']);_0x5a2bc3['offset']=qs[_0x8690('0x1d')](_0x3f2fb8['query'][_0x8690('0x1d')]);}_0x5a2bc3[_0x8690('0x36')]=qs[_0x8690('0x37')](_0x3f2fb8['query'][_0x8690('0x37')]);_0x5a2bc3[_0x8690('0x38')]=qs[_0x8690('0x31')](_[_0x8690('0x39')](_0x3f2fb8['query'],_0x4d27d0[_0x8690('0x31')]),_0x1da1d5);if(_0x3f2fb8[_0x8690('0x30')][_0x8690('0x3a')]){_0x5a2bc3[_0x8690('0x38')]=_['merge'](_0x5a2bc3[_0x8690('0x38')],{'$or':_[_0x8690('0x2f')](_0x1da1d5,function(_0xefba95){if(_0xefba95[_0x8690('0x2d')]!==_0x8690('0x3b')){var _0x3d1a09={};_0x3d1a09[_0xefba95['name']]={'$like':'%'+_0x3f2fb8[_0x8690('0x30')][_0x8690('0x3a')]+'%'};return _0x3d1a09;}})});}_0x5a2bc3=_[_0x8690('0x3c')]({},_0x5a2bc3,_0x3f2fb8[_0x8690('0x3d')]);var _0x52cace={'where':_0x5a2bc3['where']};return db[_0x8690('0x2b')][_0x8690('0x1c')](_0x52cace)[_0x8690('0x25')](function(_0xa2a9de){_0x39ca6f[_0x8690('0x1c')]=_0xa2a9de;if(_0x3f2fb8['query'][_0x8690('0x3e')]){_0x5a2bc3['include']=[{'all':!![]}];}return db[_0x8690('0x2b')][_0x8690('0x3f')](_0x5a2bc3);})['then'](function(_0xe31681){_0x39ca6f['rows']=_0xe31681;return _0x39ca6f;})[_0x8690('0x25')](respondWithFilteredResult(_0x4e7f5c,_0x5a2bc3))[_0x8690('0x40')](handleError(_0x4e7f5c,null));};exports['show']=function(_0x41a47f,_0x5807b1){var _0x4ad246={'raw':!![],'where':{'id':_0x41a47f[_0x8690('0x41')]['id']}},_0x555900={};_0x555900[_0x8690('0x2e')]=_['keys'](db[_0x8690('0x2b')][_0x8690('0x2c')]);_0x555900[_0x8690('0x30')]=_[_0x8690('0x42')](_0x41a47f[_0x8690('0x30')]);_0x555900[_0x8690('0x31')]=_['intersection'](_0x555900[_0x8690('0x2e')],_0x555900[_0x8690('0x30')]);_0x4ad246[_0x8690('0x34')]=_[_0x8690('0x32')](_0x555900['model'],qs[_0x8690('0x33')](_0x41a47f[_0x8690('0x30')][_0x8690('0x33')]));_0x4ad246[_0x8690('0x34')]=_0x4ad246['attributes'][_0x8690('0x43')]?_0x4ad246[_0x8690('0x34')]:_0x555900[_0x8690('0x2e')];if(_0x41a47f[_0x8690('0x30')][_0x8690('0x3e')]){_0x4ad246[_0x8690('0x44')]=[{'all':!![]}];}_0x4ad246=_[_0x8690('0x3c')]({},_0x4ad246,_0x41a47f['options']);return db[_0x8690('0x2b')]['find'](_0x4ad246)['then'](handleEntityNotFound(_0x5807b1,null))[_0x8690('0x25')](respondWithResult(_0x5807b1,null))['catch'](handleError(_0x5807b1,null));};exports[_0x8690('0x45')]=function(_0x319a89,_0x4ab22a){return db[_0x8690('0x2b')][_0x8690('0x45')](_0x319a89[_0x8690('0x46')],{})[_0x8690('0x25')](function(_0xadd75f){var _0x54d274=_0x319a89[_0x8690('0x47')][_0x8690('0x48')]({'plain':!![]});if(!_0x54d274)throw new Error(_0x8690('0x49'));if(_0x54d274[_0x8690('0x4a')]===_0x8690('0x47')){var _0x1c16df=_0xadd75f[_0x8690('0x48')]({'plain':!![]});var _0x228884=_0x8690('0x27');return db['UserProfileSection'][_0x8690('0x4b')]({'where':{'name':_0x228884,'userProfileId':_0x54d274[_0x8690('0x4c')]},'raw':!![]})[_0x8690('0x25')](function(_0x969b79){if(_0x969b79&&_0x969b79['autoAssociation']===0x0){return db[_0x8690('0x28')][_0x8690('0x45')]({'name':_0x1c16df[_0x8690('0x2a')],'resourceId':_0x1c16df['id'],'type':_0x969b79['name'],'sectionId':_0x969b79['id']},{})[_0x8690('0x25')](function(){return _0xadd75f;});}else{return _0xadd75f;}})['catch'](function(_0x126188){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x126188);throw _0x126188;});}return _0xadd75f;})['then'](respondWithResult(_0x4ab22a,0xc9))['catch'](handleError(_0x4ab22a,null));};exports[_0x8690('0x24')]=function(_0x41c82c,_0x50f609){if(_0x41c82c['body']['id']){delete _0x41c82c[_0x8690('0x46')]['id'];}return db[_0x8690('0x2b')][_0x8690('0x4b')]({'where':{'id':_0x41c82c['params']['id']}})[_0x8690('0x25')](handleEntityNotFound(_0x50f609,null))['then'](saveUpdates(_0x41c82c[_0x8690('0x46')],null))['then'](respondWithResult(_0x50f609,null))[_0x8690('0x40')](handleError(_0x50f609,null));};exports['destroy']=function(_0x439a1a,_0x55c47d){return db[_0x8690('0x2b')][_0x8690('0x4b')]({'where':{'id':_0x439a1a[_0x8690('0x41')]['id']}})[_0x8690('0x25')](handleEntityNotFound(_0x55c47d,null))[_0x8690('0x25')](removeEntity(_0x55c47d,null))[_0x8690('0x40')](handleError(_0x55c47d,null));};exports['addInterval']=function(_0x528216,_0x43c292,_0x3b2fa7){if(_0x528216[_0x8690('0x46')]['id']){delete _0x528216[_0x8690('0x46')]['id'];}return db[_0x8690('0x2b')][_0x8690('0x4b')]({'where':{'id':_0x528216[_0x8690('0x41')]['id']}})[_0x8690('0x25')](handleEntityNotFound(_0x43c292,null))[_0x8690('0x25')](function(_0x527f5){if(_0x527f5){_0x528216['body'][_0x8690('0x4d')]=_0x527f5['id'];return db[_0x8690('0x2b')][_0x8690('0x45')](_0x528216['body']);}})[_0x8690('0x25')](respondWithResult(_0x43c292,null))[_0x8690('0x40')](handleError(_0x43c292,null));};exports[_0x8690('0x4e')]=function(_0x5f1257,_0x5795f6,_0x541ab5){var _0xad12dd={};var _0x507eab={};var _0x4481be;var _0x2f92cd;return db['Interval'][_0x8690('0x4f')]({'where':{'id':_0x5f1257[_0x8690('0x41')]['id']}})[_0x8690('0x25')](handleEntityNotFound(_0x5795f6,null))[_0x8690('0x25')](function(_0x54e4ca){if(_0x54e4ca){_0x4481be=_0x54e4ca;_0x507eab[_0x8690('0x2e')]=_[_0x8690('0x42')](db[_0x8690('0x2b')][_0x8690('0x2c')]);_0x507eab[_0x8690('0x30')]=_[_0x8690('0x42')](_0x5f1257['query']);_0x507eab['filters']=_[_0x8690('0x32')](_0x507eab['model'],_0x507eab[_0x8690('0x30')]);_0xad12dd[_0x8690('0x34')]=_[_0x8690('0x32')](_0x507eab[_0x8690('0x2e')],qs[_0x8690('0x33')](_0x5f1257[_0x8690('0x30')][_0x8690('0x33')]));_0xad12dd['attributes']=_0xad12dd[_0x8690('0x34')][_0x8690('0x43')]?_0xad12dd[_0x8690('0x34')]:_0x507eab[_0x8690('0x2e')];_0xad12dd[_0x8690('0x36')]=qs[_0x8690('0x37')](_0x5f1257[_0x8690('0x30')]['sort']);_0xad12dd['where']=qs[_0x8690('0x31')](_[_0x8690('0x39')](_0x5f1257[_0x8690('0x30')],_0x507eab[_0x8690('0x31')]));if(_0x5f1257['query'][_0x8690('0x3a')]){_0xad12dd['where']=_[_0x8690('0x3c')](_0xad12dd[_0x8690('0x38')],{'$or':_[_0x8690('0x2f')](_0xad12dd['attributes'],function(_0x86e65e){var _0x126b5d={};_0x126b5d[_0x86e65e]={'$like':'%'+_0x5f1257['query'][_0x8690('0x3a')]+'%'};return _0x126b5d;})});}_0xad12dd=_['merge']({},_0xad12dd,_0x5f1257['options']);return _0x4481be[_0x8690('0x4e')](_0xad12dd);}})[_0x8690('0x25')](function(_0x2abccd){if(_0x2abccd){_0x2f92cd=_0x2abccd['length'];if(!_0x5f1257[_0x8690('0x30')][_0x8690('0x50')](_0x8690('0x35'))){_0xad12dd[_0x8690('0x1e')]=qs['limit'](_0x5f1257['query']['limit']);_0xad12dd[_0x8690('0x1d')]=qs[_0x8690('0x1d')](_0x5f1257[_0x8690('0x30')][_0x8690('0x1d')]);}return _0x4481be['getIntervals'](_0xad12dd);}})['then'](function(_0x1efb28){if(_0x1efb28){return _0x1efb28?{'count':_0x2f92cd,'rows':_0x1efb28}:null;}})[_0x8690('0x25')](respondWithResult(_0x5795f6,null))['catch'](handleError(_0x5795f6,null));};exports[_0x8690('0x51')]=function(_0x4f33bc,_0x3129db,_0x5ccba9){return db[_0x8690('0x2b')][_0x8690('0x4f')]({'where':{'id':_0x4f33bc[_0x8690('0x41')]['id']}})[_0x8690('0x25')](handleEntityNotFound(_0x3129db,null))[_0x8690('0x25')](function(_0x16df47){if(_0x16df47){return db[_0x8690('0x52')][_0x8690('0x53')](function(_0x4db730){return db[_0x8690('0x2b')][_0x8690('0x26')]({'where':{'IntervalId':_0x4f33bc[_0x8690('0x41')]['id']},'transaction':_0x4db730})[_0x8690('0x25')](function(_0x496a6a){var _0xc0a1d9=_[_0x8690('0x2f')](_0x4f33bc[_0x8690('0x46')],function(_0x5472dd){delete _0x5472dd['id'];_0x5472dd[_0x8690('0x4d')]=_0x4f33bc[_0x8690('0x41')]['id'];return _0x5472dd;});return db[_0x8690('0x2b')]['bulkCreate'](_0xc0a1d9,{'transaction':_0x4db730});});})[_0x8690('0x25')](function(){return db[_0x8690('0x2b')][_0x8690('0x3f')]({'where':{'IntervalId':_0x4f33bc[_0x8690('0x41')]['id']}});});}})[_0x8690('0x25')](respondWithResult(_0x3129db,null))[_0x8690('0x40')](handleError(_0x3129db,null));}; \ No newline at end of file +var _0x9139=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','Intervals','UserProfileResource','then','error','name','send','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','findOne','pick','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x9139,0xa3));var _0x9913=function(_0x3a480f,_0x315fa7){_0x3a480f=_0x3a480f-0x0;var _0x427864=_0x9139[_0x3a480f];return _0x427864;};'use strict';var emlformat=require(_0x9913('0x0'));var rimraf=require(_0x9913('0x1'));var zipdir=require(_0x9913('0x2'));var jsonpatch=require(_0x9913('0x3'));var rp=require(_0x9913('0x4'));var moment=require('moment');var BPromise=require(_0x9913('0x5'));var Mustache=require(_0x9913('0x6'));var util=require(_0x9913('0x7'));var path=require('path');var sox=require(_0x9913('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9913('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9913('0xa'));var jsforce=require(_0x9913('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9913('0xc'));var Papa=require(_0x9913('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9913('0xe'));var as=require(_0x9913('0xf'));var hardwareService=require(_0x9913('0x10'));var logger=require(_0x9913('0x11'))(_0x9913('0x12'));var utils=require(_0x9913('0x13'));var config=require(_0x9913('0x14'));var licenseUtil=require(_0x9913('0x15'));var db=require(_0x9913('0x16'))['db'];var extensions=require(_0x9913('0x17'));function respondWithStatusCode(_0x196a42,_0x2c4a63){_0x2c4a63=_0x2c4a63||0xcc;return function(_0x226c8c){if(_0x226c8c){return _0x196a42[_0x9913('0x18')](_0x2c4a63);}return _0x196a42[_0x9913('0x19')](_0x2c4a63)[_0x9913('0x1a')]();};}function respondWithResult(_0x3fdc55,_0x576f94){_0x576f94=_0x576f94||0xc8;return function(_0x1289e6){if(_0x1289e6){return _0x3fdc55[_0x9913('0x19')](_0x576f94)[_0x9913('0x1b')](_0x1289e6);}};}function respondWithFilteredResult(_0x54d49c,_0x3a3b33){return function(_0x336de8){if(_0x336de8){var _0xa3c710=typeof _0x3a3b33['offset']===_0x9913('0x1c')&&typeof _0x3a3b33[_0x9913('0x1d')]===_0x9913('0x1c');var _0x476b8d=_0x336de8[_0x9913('0x1e')];var _0x41cbb6=_0xa3c710?0x0:_0x3a3b33['offset'];var _0x4daa21=_0xa3c710?_0x336de8[_0x9913('0x1e')]:_0x3a3b33[_0x9913('0x1f')]+_0x3a3b33[_0x9913('0x1d')];var _0x2260b6;if(_0x4daa21>=_0x476b8d){_0x4daa21=_0x476b8d;_0x2260b6=0xc8;}else{_0x2260b6=0xce;}_0x54d49c[_0x9913('0x19')](_0x2260b6);return _0x54d49c['set'](_0x9913('0x20'),_0x41cbb6+'-'+_0x4daa21+'/'+_0x476b8d)[_0x9913('0x1b')](_0x336de8);}return null;};}function patchUpdates(_0x5cb360){return function(_0x14bcea){try{jsonpatch[_0x9913('0x21')](_0x14bcea,_0x5cb360,!![]);}catch(_0x51f6ed){return BPromise[_0x9913('0x22')](_0x51f6ed);}return _0x14bcea[_0x9913('0x23')]();};}function saveUpdates(_0x254462,_0x2482f1){return function(_0x3bd020){if(_0x3bd020){return _0x3bd020[_0x9913('0x24')](_0x254462)['then'](function(_0x5a5082){return _0x5a5082;});}return null;};}function removeEntity(_0x1cea8c,_0x48c28d){return function(_0x45dadd){if(_0x45dadd){return _0x45dadd[_0x9913('0x25')]()['then'](function(){var _0x4c0c73=_0x45dadd['get']({'plain':!![]});var _0x2567b2=_0x9913('0x26');return db[_0x9913('0x27')]['destroy']({'where':{'type':_0x2567b2,'resourceId':_0x4c0c73['id']}})[_0x9913('0x28')](function(){return _0x45dadd;});})['then'](function(){_0x1cea8c[_0x9913('0x19')](0xcc)[_0x9913('0x1a')]();});}};}function handleEntityNotFound(_0x4c6e9a,_0xb38978){return function(_0x3553f3){if(!_0x3553f3){_0x4c6e9a[_0x9913('0x18')](0x194);}return _0x3553f3;};}function handleError(_0x4364d5,_0x176441){_0x176441=_0x176441||0x1f4;return function(_0x3b1799){logger[_0x9913('0x29')](_0x3b1799['stack']);if(_0x3b1799['name']){delete _0x3b1799[_0x9913('0x2a')];}_0x4364d5[_0x9913('0x19')](_0x176441)[_0x9913('0x2b')](_0x3b1799);};}exports[_0x9913('0x2c')]=function(_0x1d96c5,_0x187a1a){var _0x3f25dc={},_0x1d71e1={},_0x5d3369={'count':0x0,'rows':[]};var _0x3d5fb6=_[_0x9913('0x2d')](db[_0x9913('0x2e')][_0x9913('0x2f')],function(_0x422749){return{'name':_0x422749['fieldName'],'type':_0x422749[_0x9913('0x30')]['key']};});_0x1d71e1[_0x9913('0x31')]=_[_0x9913('0x2d')](_0x3d5fb6,_0x9913('0x2a'));_0x1d71e1[_0x9913('0x32')]=_[_0x9913('0x33')](_0x1d96c5[_0x9913('0x32')]);_0x1d71e1[_0x9913('0x34')]=_[_0x9913('0x35')](_0x1d71e1[_0x9913('0x31')],_0x1d71e1[_0x9913('0x32')]);_0x3f25dc[_0x9913('0x36')]=_[_0x9913('0x35')](_0x1d71e1[_0x9913('0x31')],qs['fields'](_0x1d96c5[_0x9913('0x32')][_0x9913('0x37')]));_0x3f25dc['attributes']=_0x3f25dc[_0x9913('0x36')][_0x9913('0x38')]?_0x3f25dc[_0x9913('0x36')]:_0x1d71e1[_0x9913('0x31')];if(!_0x1d96c5[_0x9913('0x32')][_0x9913('0x39')](_0x9913('0x3a'))){_0x3f25dc[_0x9913('0x1d')]=qs[_0x9913('0x1d')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x1d')]);_0x3f25dc['offset']=qs[_0x9913('0x1f')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x1f')]);}_0x3f25dc['order']=qs[_0x9913('0x3b')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x3b')]);_0x3f25dc[_0x9913('0x3c')]=qs[_0x9913('0x34')](_['pick'](_0x1d96c5[_0x9913('0x32')],_0x1d71e1[_0x9913('0x34')]),_0x3d5fb6);if(_0x1d96c5[_0x9913('0x32')][_0x9913('0x3d')]){_0x3f25dc['where']=_['merge'](_0x3f25dc[_0x9913('0x3c')],{'$or':_[_0x9913('0x2d')](_0x3d5fb6,function(_0x2485c8){if(_0x2485c8[_0x9913('0x30')]!=='VIRTUAL'){var _0x4b612a={};_0x4b612a[_0x2485c8[_0x9913('0x2a')]]={'$like':'%'+_0x1d96c5[_0x9913('0x32')][_0x9913('0x3d')]+'%'};return _0x4b612a;}})});}_0x3f25dc=_[_0x9913('0x3e')]({},_0x3f25dc,_0x1d96c5[_0x9913('0x3f')]);var _0x3f4b8c={'where':_0x3f25dc[_0x9913('0x3c')]};return db[_0x9913('0x2e')]['count'](_0x3f4b8c)[_0x9913('0x28')](function(_0x356636){_0x5d3369[_0x9913('0x1e')]=_0x356636;if(_0x1d96c5[_0x9913('0x32')][_0x9913('0x40')]){_0x3f25dc[_0x9913('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9913('0x42')](_0x3f25dc);})[_0x9913('0x28')](function(_0x48c5e4){_0x5d3369[_0x9913('0x43')]=_0x48c5e4;return _0x5d3369;})['then'](respondWithFilteredResult(_0x187a1a,_0x3f25dc))[_0x9913('0x44')](handleError(_0x187a1a,null));};exports[_0x9913('0x45')]=function(_0x2c4ae0,_0x2f805e){var _0x43578b={'raw':!![],'where':{'id':_0x2c4ae0[_0x9913('0x46')]['id']}},_0x31fb0b={};_0x31fb0b[_0x9913('0x31')]=_['keys'](db[_0x9913('0x2e')]['rawAttributes']);_0x31fb0b[_0x9913('0x32')]=_[_0x9913('0x33')](_0x2c4ae0[_0x9913('0x32')]);_0x31fb0b[_0x9913('0x34')]=_['intersection'](_0x31fb0b[_0x9913('0x31')],_0x31fb0b[_0x9913('0x32')]);_0x43578b[_0x9913('0x36')]=_['intersection'](_0x31fb0b[_0x9913('0x31')],qs[_0x9913('0x37')](_0x2c4ae0[_0x9913('0x32')][_0x9913('0x37')]));_0x43578b[_0x9913('0x36')]=_0x43578b[_0x9913('0x36')]['length']?_0x43578b[_0x9913('0x36')]:_0x31fb0b[_0x9913('0x31')];if(_0x2c4ae0['query'][_0x9913('0x40')]){_0x43578b['include']=[{'all':!![]}];}_0x43578b=_['merge']({},_0x43578b,_0x2c4ae0[_0x9913('0x3f')]);return db[_0x9913('0x2e')]['find'](_0x43578b)['then'](handleEntityNotFound(_0x2f805e,null))[_0x9913('0x28')](respondWithResult(_0x2f805e,null))[_0x9913('0x44')](handleError(_0x2f805e,null));};exports['create']=function(_0x957604,_0x65f87c){return db[_0x9913('0x2e')][_0x9913('0x47')](_0x957604[_0x9913('0x48')],{})[_0x9913('0x28')](function(_0x183ed1){var _0x5bef6a=_0x957604[_0x9913('0x49')][_0x9913('0x4a')]({'plain':!![]});if(!_0x5bef6a)throw new Error(_0x9913('0x4b'));if(_0x5bef6a[_0x9913('0x4c')]===_0x9913('0x49')){var _0x52f179=_0x183ed1['get']({'plain':!![]});var _0x355a8f=_0x9913('0x26');return db[_0x9913('0x4d')]['find']({'where':{'name':_0x355a8f,'userProfileId':_0x5bef6a[_0x9913('0x4e')]},'raw':!![]})[_0x9913('0x28')](function(_0x566d70){if(_0x566d70&&_0x566d70['autoAssociation']===0x0){return db[_0x9913('0x27')][_0x9913('0x47')]({'name':_0x52f179[_0x9913('0x2a')],'resourceId':_0x52f179['id'],'type':_0x566d70[_0x9913('0x2a')],'sectionId':_0x566d70['id']},{})[_0x9913('0x28')](function(){return _0x183ed1;});}else{return _0x183ed1;}})['catch'](function(_0x4e9fcb){logger[_0x9913('0x29')](_0x9913('0x4f'),_0x4e9fcb);throw _0x4e9fcb;});}return _0x183ed1;})[_0x9913('0x28')](respondWithResult(_0x65f87c,0xc9))[_0x9913('0x44')](handleError(_0x65f87c,null));};exports[_0x9913('0x24')]=function(_0x285b44,_0x35abeb){if(_0x285b44[_0x9913('0x48')]['id']){delete _0x285b44[_0x9913('0x48')]['id'];}return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x285b44['params']['id']}})['then'](handleEntityNotFound(_0x35abeb,null))[_0x9913('0x28')](saveUpdates(_0x285b44[_0x9913('0x48')],null))[_0x9913('0x28')](respondWithResult(_0x35abeb,null))['catch'](handleError(_0x35abeb,null));};exports[_0x9913('0x25')]=function(_0x1b9e24,_0x476c55){return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x1b9e24[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x476c55,null))[_0x9913('0x28')](removeEntity(_0x476c55,null))[_0x9913('0x44')](handleError(_0x476c55,null));};exports[_0x9913('0x51')]=function(_0x44f1a0,_0x1fe977,_0x543c92){if(_0x44f1a0[_0x9913('0x48')]['id']){delete _0x44f1a0['body']['id'];}return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x44f1a0[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x1fe977,null))['then'](function(_0x26fde3){if(_0x26fde3){_0x44f1a0[_0x9913('0x48')][_0x9913('0x52')]=_0x26fde3['id'];return db[_0x9913('0x2e')][_0x9913('0x47')](_0x44f1a0[_0x9913('0x48')]);}})[_0x9913('0x28')](respondWithResult(_0x1fe977,null))[_0x9913('0x44')](handleError(_0x1fe977,null));};exports['getIntervals']=function(_0x2b8150,_0x10dcab,_0x3e8612){var _0x3cc1e2={};var _0xe4e42c={};var _0x69293c;var _0x40718a;return db[_0x9913('0x2e')][_0x9913('0x53')]({'where':{'id':_0x2b8150[_0x9913('0x46')]['id']}})['then'](handleEntityNotFound(_0x10dcab,null))[_0x9913('0x28')](function(_0x14e6f6){if(_0x14e6f6){_0x69293c=_0x14e6f6;_0xe4e42c['model']=_[_0x9913('0x33')](db[_0x9913('0x2e')][_0x9913('0x2f')]);_0xe4e42c[_0x9913('0x32')]=_[_0x9913('0x33')](_0x2b8150[_0x9913('0x32')]);_0xe4e42c[_0x9913('0x34')]=_[_0x9913('0x35')](_0xe4e42c[_0x9913('0x31')],_0xe4e42c[_0x9913('0x32')]);_0x3cc1e2[_0x9913('0x36')]=_[_0x9913('0x35')](_0xe4e42c[_0x9913('0x31')],qs[_0x9913('0x37')](_0x2b8150[_0x9913('0x32')][_0x9913('0x37')]));_0x3cc1e2['attributes']=_0x3cc1e2[_0x9913('0x36')][_0x9913('0x38')]?_0x3cc1e2['attributes']:_0xe4e42c[_0x9913('0x31')];_0x3cc1e2['order']=qs['sort'](_0x2b8150[_0x9913('0x32')][_0x9913('0x3b')]);_0x3cc1e2['where']=qs[_0x9913('0x34')](_[_0x9913('0x54')](_0x2b8150[_0x9913('0x32')],_0xe4e42c[_0x9913('0x34')]));if(_0x2b8150['query'][_0x9913('0x3d')]){_0x3cc1e2[_0x9913('0x3c')]=_[_0x9913('0x3e')](_0x3cc1e2['where'],{'$or':_[_0x9913('0x2d')](_0x3cc1e2[_0x9913('0x36')],function(_0x49a6d4){var _0x403699={};_0x403699[_0x49a6d4]={'$like':'%'+_0x2b8150[_0x9913('0x32')][_0x9913('0x3d')]+'%'};return _0x403699;})});}_0x3cc1e2=_[_0x9913('0x3e')]({},_0x3cc1e2,_0x2b8150[_0x9913('0x3f')]);return _0x69293c[_0x9913('0x55')](_0x3cc1e2);}})[_0x9913('0x28')](function(_0xe9d158){if(_0xe9d158){_0x40718a=_0xe9d158[_0x9913('0x38')];if(!_0x2b8150[_0x9913('0x32')]['hasOwnProperty']('nolimit')){_0x3cc1e2[_0x9913('0x1d')]=qs[_0x9913('0x1d')](_0x2b8150[_0x9913('0x32')][_0x9913('0x1d')]);_0x3cc1e2[_0x9913('0x1f')]=qs[_0x9913('0x1f')](_0x2b8150[_0x9913('0x32')][_0x9913('0x1f')]);}return _0x69293c[_0x9913('0x55')](_0x3cc1e2);}})[_0x9913('0x28')](function(_0x5ec8bb){if(_0x5ec8bb){return _0x5ec8bb?{'count':_0x40718a,'rows':_0x5ec8bb}:null;}})[_0x9913('0x28')](respondWithResult(_0x10dcab,null))['catch'](handleError(_0x10dcab,null));};exports[_0x9913('0x56')]=function(_0x1eda12,_0x2092b6,_0x5cc507){return db[_0x9913('0x2e')]['findOne']({'where':{'id':_0x1eda12[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x2092b6,null))[_0x9913('0x28')](function(_0x858e){if(_0x858e){return db[_0x9913('0x57')][_0x9913('0x58')](function(_0x202d5a){return db[_0x9913('0x2e')][_0x9913('0x25')]({'where':{'IntervalId':_0x1eda12['params']['id']},'transaction':_0x202d5a})['then'](function(_0x374033){var _0x4d96a5=_[_0x9913('0x2d')](_0x1eda12[_0x9913('0x48')],function(_0x17c943){delete _0x17c943['id'];_0x17c943[_0x9913('0x52')]=_0x1eda12[_0x9913('0x46')]['id'];return _0x17c943;});return db[_0x9913('0x2e')][_0x9913('0x59')](_0x4d96a5,{'transaction':_0x202d5a});});})[_0x9913('0x28')](function(){return db[_0x9913('0x2e')][_0x9913('0x42')]({'where':{'IntervalId':_0x1eda12['params']['id']}});});}})[_0x9913('0x28')](respondWithResult(_0x2092b6,null))['catch'](handleError(_0x2092b6,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8ecccb3..19545b0 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 _0xeb1b=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3f2770,_0x462590){var _0x589199=function(_0x3d422e){while(--_0x3d422e){_0x3f2770['push'](_0x3f2770['shift']());}};_0x589199(++_0x462590);}(_0xeb1b,0x16a));var _0xbeb1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb1b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbeb1('0x0'));var util=require(_0xbeb1('0x1'));var logger=require(_0xbeb1('0x2'))(_0xbeb1('0x3'));var moment=require(_0xbeb1('0x4'));var BPromise=require(_0xbeb1('0x5'));var rp=require(_0xbeb1('0x6'));var fs=require('fs');var path=require(_0xbeb1('0x7'));var rimraf=require(_0xbeb1('0x8'));var config=require(_0xbeb1('0x9'));var attributes=require(_0xbeb1('0xa'));var extensions=require(_0xbeb1('0xb'));module[_0xbeb1('0xc')]=function(_0x2c363a,_0x1011d){return _0x2c363a[_0xbeb1('0xd')]('Interval',attributes,{'tableName':_0xbeb1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b15a8,_0x5614e1){extensions[_0xbeb1('0xf')](_0x2c363a,_0x5b15a8);},'afterBulkCreate':function(_0x52a0c1,_0x5ed133,_0x22eaf4){_0x22eaf4();extensions['rewrite'](_0x2c363a,_0x52a0c1[0x0]);},'afterUpdate':function(_0x5c3ef1,_0x25977f){extensions[_0xbeb1('0xf')](_0x2c363a,_0x5c3ef1);},'afterDestroy':function(_0x5823a9,_0x3d577d){extensions['rewrite'](_0x2c363a,_0x5823a9);}}});}; \ No newline at end of file +var _0x655e=['Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../components/extensions/rewrite','exports','define'];(function(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0x655e,0x199));var _0xe655=function(_0x5e8a89,_0x52dc7c){_0x5e8a89=_0x5e8a89-0x0;var _0x345562=_0x655e[_0x5e8a89];return _0x345562;};'use strict';var _=require(_0xe655('0x0'));var util=require(_0xe655('0x1'));var logger=require(_0xe655('0x2'))('api');var moment=require(_0xe655('0x3'));var BPromise=require(_0xe655('0x4'));var rp=require(_0xe655('0x5'));var fs=require('fs');var path=require(_0xe655('0x6'));var rimraf=require(_0xe655('0x7'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xe655('0x8'));module[_0xe655('0x9')]=function(_0x18b4c3,_0x305a4b){return _0x18b4c3[_0xe655('0xa')](_0xe655('0xb'),attributes,{'tableName':_0xe655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c96f,_0x4c706){extensions['rewrite'](_0x18b4c3,_0x28c96f);},'afterBulkCreate':function(_0x29e25d,_0x33dbb5,_0x50ea8a){_0x50ea8a();extensions[_0xe655('0xd')](_0x18b4c3,_0x29e25d[0x0]);},'afterUpdate':function(_0x41ecba,_0x49a4f4){extensions['rewrite'](_0x18b4c3,_0x41ecba);},'afterDestroy':function(_0x373ac0,_0x5537a9){extensions['rewrite'](_0x18b4c3,_0x373ac0);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5530730..b718c96 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 7b16b79..f1e047a 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb10b,0x12a));var _0xbb10=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0xb10b[_0xd1f854];return _0x548294;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 12561fc..4f78fd8 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 _0x53b6=['customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','Bug','fields','customfield_11500','customfield_11501','oldToken'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x53b6,0x79));var _0x653b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53b6[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0x653b('0x0'));var logger=require(_0x653b('0x1'))(_0x653b('0x2'));var USERNAME=_0x653b('0x3');var PASSWORD=_0x653b('0x4');function openIssue(_0x57edfd,_0xff52c0){var _0x162a20={'fields':{'project':{'key':_0x57edfd[_0x653b('0x5')]||_0x653b('0x6')},'summary':(_0x57edfd['summary']||'Report')+_0x653b('0x7')+_0x57edfd['ip'],'description':_0x57edfd[_0x653b('0x8')]||JSON['stringify'](_0x57edfd),'issuetype':{'name':_0x57edfd['issuetype']||_0x653b('0x9')}}};_0x162a20[_0x653b('0xa')][_0x653b('0xb')]=_0x57edfd['email'];_0x162a20[_0x653b('0xa')][_0x653b('0xc')]=_0x57edfd[_0x653b('0xd')];_0x162a20[_0x653b('0xa')][_0x653b('0xe')]=_0x57edfd['newToken'];_0x162a20['fields'][_0x653b('0xf')]=_0x57edfd[_0x653b('0x10')];_0x162a20['fields'][_0x653b('0x11')]=_0x57edfd[_0x653b('0x12')];_0x162a20[_0x653b('0xa')][_0x653b('0x13')]=_0x57edfd['ip'];var _0xd265a2={'host':_0x653b('0x14'),'port':0x1bb,'path':_0x653b('0x15'),'method':_0x653b('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x653b('0x17'),'Authorization':_0x653b('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x653b('0x19')](_0x653b('0x1a'))}};var _0x217a16=JSON[_0x653b('0x1b')](_0x162a20);var _0x8cf09b=https[_0x653b('0x1c')](_0xd265a2,function(_0x25c7dd){_0x25c7dd[_0x653b('0x1d')](_0x653b('0x1e'));var _0xfe0e04='';_0x25c7dd['on'](_0x653b('0x1f'),function(_0x22e3a2){_0xfe0e04+=_0x22e3a2;});_0x25c7dd['on']('end',function(){if(_0xff52c0){return _0xff52c0[_0x653b('0x20')](_0x25c7dd['statusCode'])[_0x653b('0x21')](JSON[_0x653b('0x22')](_0xfe0e04));}});});_0x8cf09b['on'](_0x653b('0x23'),function(_0x121390){if(_0xff52c0){return _0xff52c0[_0x653b('0x20')](0x1f4)[_0x653b('0x21')]({'errors':[{'message':_0x653b('0x24'),'type':_0x653b('0x25')}]});}});_0x8cf09b['write'](_0x217a16);_0x8cf09b['end']();}exports['openIssue']=openIssue;exports[_0x653b('0x26')]=function(_0x353628,_0x5c4d2b){_0x353628[_0x653b('0x27')]['ip']=_0x353628[_0x653b('0x28')][_0x653b('0x29')]||_0x353628[_0x653b('0x2a')][_0x653b('0x2b')]||_0x353628[_0x653b('0x2c')][_0x653b('0x2b')]||_0x353628[_0x653b('0x2a')][_0x653b('0x2c')][_0x653b('0x2b')];return openIssue(_0x353628['body'],_0x5c4d2b);}; \ No newline at end of file +var _0x2515=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','fields','customfield_11501','newToken','customfield_11504','reason'];(function(_0x239ec2,_0xb83dea){var _0x4984f1=function(_0x386df6){while(--_0x386df6){_0x239ec2['push'](_0x239ec2['shift']());}};_0x4984f1(++_0xb83dea);}(_0x2515,0x116));var _0x5251=function(_0x467e61,_0x387c3d){_0x467e61=_0x467e61-0x0;var _0x2eab8f=_0x2515[_0x467e61];return _0x2eab8f;};'use strict';var BPromise=require(_0x5251('0x0'));var https=require(_0x5251('0x1'));var logger=require(_0x5251('0x2'))(_0x5251('0x3'));var USERNAME=_0x5251('0x4');var PASSWORD=_0x5251('0x5');function openIssue(_0x593ec6,_0x547b0b){var _0x1cdf10={'fields':{'project':{'key':_0x593ec6[_0x5251('0x6')]||_0x5251('0x7')},'summary':(_0x593ec6['summary']||'Report')+_0x5251('0x8')+_0x593ec6['ip'],'description':_0x593ec6[_0x5251('0x9')]||JSON[_0x5251('0xa')](_0x593ec6),'issuetype':{'name':_0x593ec6['issuetype']||'Bug'}}};_0x1cdf10[_0x5251('0xb')]['customfield_11500']=_0x593ec6['email'];_0x1cdf10[_0x5251('0xb')][_0x5251('0xc')]=_0x593ec6['oldToken'];_0x1cdf10[_0x5251('0xb')]['customfield_11502']=_0x593ec6[_0x5251('0xd')];_0x1cdf10[_0x5251('0xb')]['customfield_11503']=_0x593ec6['name'];_0x1cdf10[_0x5251('0xb')][_0x5251('0xe')]=_0x593ec6[_0x5251('0xf')];_0x1cdf10[_0x5251('0xb')][_0x5251('0x10')]=_0x593ec6['ip'];var _0x1903e5={'host':_0x5251('0x11'),'port':0x1bb,'path':_0x5251('0x12'),'method':_0x5251('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x5251('0x14'),'Authorization':_0x5251('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2980b5=JSON['stringify'](_0x1cdf10);var _0xfd6722=https[_0x5251('0x16')](_0x1903e5,function(_0x5045c5){_0x5045c5[_0x5251('0x17')](_0x5251('0x18'));var _0x374921='';_0x5045c5['on'](_0x5251('0x19'),function(_0x3b215c){_0x374921+=_0x3b215c;});_0x5045c5['on'](_0x5251('0x1a'),function(){if(_0x547b0b){return _0x547b0b[_0x5251('0x1b')](_0x5045c5[_0x5251('0x1c')])[_0x5251('0x1d')](JSON[_0x5251('0x1e')](_0x374921));}});});_0xfd6722['on'](_0x5251('0x1f'),function(_0x4c64b0){if(_0x547b0b){return _0x547b0b[_0x5251('0x1b')](0x1f4)[_0x5251('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x5251('0x20')}]});}});_0xfd6722[_0x5251('0x21')](_0x2980b5);_0xfd6722[_0x5251('0x1a')]();}exports[_0x5251('0x22')]=openIssue;exports[_0x5251('0x23')]=function(_0x385d3d,_0x2dbdd6){_0x385d3d[_0x5251('0x24')]['ip']=_0x385d3d[_0x5251('0x25')][_0x5251('0x26')]||_0x385d3d['connection'][_0x5251('0x27')]||_0x385d3d['socket'][_0x5251('0x27')]||_0x385d3d[_0x5251('0x28')][_0x5251('0x29')][_0x5251('0x27')];return openIssue(_0x385d3d[_0x5251('0x24')],_0x2dbdd6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 044c42e..ef49d67 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 _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xda55,0x6d));var _0x5da5=function(_0x448cb3,_0x203c7b){_0x448cb3=_0x448cb3-0x0;var _0x1df8a7=_0xda55[_0x448cb3];return _0x1df8a7;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x21e895,_0x4fef7f){var _0x43c312=function(_0x53e092){while(--_0x53e092){_0x21e895['push'](_0x21e895['shift']());}};_0x43c312(++_0x4fef7f);}(_0xa75b,0x170));var _0xba75=function(_0x57afbb,_0x52f55f){_0x57afbb=_0x57afbb-0x0;var _0x38d4e2=_0xa75b[_0x57afbb];return _0x38d4e2;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 28bf930..461c561 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x5d5a49,_0x21bd73){_0x5d5a49=_0x5d5a49-0x0;var _0x4b7e0f=_0x7a54[_0x5d5a49];return _0x4b7e0f;};'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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x2d4699,_0x37177d){_0x2d4699=_0x2d4699-0x0;var _0x5a8b26=_0x7a54[_0x2d4699];return _0x5a8b26;};'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 15082bc..a0d8bf2 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 _0xed1f=['where','pick','filter','merge','options','includeAll','include','findAll','rows','then','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','index','map','JscriptyAnswerReport','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x1e231c,_0x196db1){var _0x29bd63=function(_0x396032){while(--_0x396032){_0x1e231c['push'](_0x1e231c['shift']());}};_0x29bd63(++_0x196db1);}(_0xed1f,0x170));var _0xfed1=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xed1f[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfed1('0x2'));var moment=require('moment');var BPromise=require(_0xfed1('0x3'));var Mustache=require('mustache');var util=require(_0xfed1('0x4'));var path=require(_0xfed1('0x5'));var sox=require(_0xfed1('0x6'));var csv=require(_0xfed1('0x7'));var ejs=require(_0xfed1('0x8'));var fs=require('fs');var fs_extra=require(_0xfed1('0x9'));var _=require(_0xfed1('0xa'));var squel=require(_0xfed1('0xb'));var crypto=require(_0xfed1('0xc'));var jsforce=require(_0xfed1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0x7'));var querystring=require(_0xfed1('0xe'));var Papa=require(_0xfed1('0xf'));var Redis=require('ioredis');var authService=require(_0xfed1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfed1('0x11'));var logger=require(_0xfed1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfed1('0x13'));var licenseUtil=require(_0xfed1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56555a,_0x4e2e26){_0x4e2e26=_0x4e2e26||0xcc;return function(_0x250eb5){if(_0x250eb5){return _0x56555a[_0xfed1('0x15')](_0x4e2e26);}return _0x56555a[_0xfed1('0x16')](_0x4e2e26)[_0xfed1('0x17')]();};}function respondWithResult(_0x58277d,_0x3bb8f7){_0x3bb8f7=_0x3bb8f7||0xc8;return function(_0x3754c2){if(_0x3754c2){return _0x58277d['status'](_0x3bb8f7)['json'](_0x3754c2);}};}function respondWithFilteredResult(_0x176227,_0x38f652){return function(_0x306567){if(_0x306567){var _0x5ed220=typeof _0x38f652[_0xfed1('0x18')]===_0xfed1('0x19')&&typeof _0x38f652[_0xfed1('0x1a')]===_0xfed1('0x19');var _0x5ab809=_0x306567[_0xfed1('0x1b')];var _0x4c492e=_0x5ed220?0x0:_0x38f652[_0xfed1('0x18')];var _0x2b4cd7=_0x5ed220?_0x306567[_0xfed1('0x1b')]:_0x38f652[_0xfed1('0x18')]+_0x38f652[_0xfed1('0x1a')];var _0x2926ac;if(_0x2b4cd7>=_0x5ab809){_0x2b4cd7=_0x5ab809;_0x2926ac=0xc8;}else{_0x2926ac=0xce;}_0x176227[_0xfed1('0x16')](_0x2926ac);return _0x176227[_0xfed1('0x1c')](_0xfed1('0x1d'),_0x4c492e+'-'+_0x2b4cd7+'/'+_0x5ab809)['json'](_0x306567);}return null;};}function patchUpdates(_0xd7bfb7){return function(_0x491497){try{jsonpatch[_0xfed1('0x1e')](_0x491497,_0xd7bfb7,!![]);}catch(_0x3e5ada){return BPromise[_0xfed1('0x1f')](_0x3e5ada);}return _0x491497[_0xfed1('0x20')]();};}function saveUpdates(_0x1eb9cd,_0x4610fd){return function(_0x1748f5){if(_0x1748f5){return _0x1748f5[_0xfed1('0x21')](_0x1eb9cd)['then'](function(_0x578aaa){return _0x578aaa;});}return null;};}function removeEntity(_0xa6d6cf,_0x5c9385){return function(_0x36a818){if(_0x36a818){return _0x36a818[_0xfed1('0x22')]()['then'](function(){_0xa6d6cf[_0xfed1('0x16')](0xcc)[_0xfed1('0x17')]();});}};}function handleEntityNotFound(_0x472dbc,_0x5bce5d){return function(_0x1e8c3e){if(!_0x1e8c3e){_0x472dbc[_0xfed1('0x15')](0x194);}return _0x1e8c3e;};}function handleError(_0x5ec9c4,_0xa04122){_0xa04122=_0xa04122||0x1f4;return function(_0x40da7f){logger[_0xfed1('0x23')](_0x40da7f['stack']);if(_0x40da7f[_0xfed1('0x24')]){delete _0x40da7f[_0xfed1('0x24')];}_0x5ec9c4[_0xfed1('0x16')](_0xa04122)['send'](_0x40da7f);};}exports[_0xfed1('0x25')]=function(_0x46cf02,_0x411182){var _0x1867f6={},_0x221bf7={},_0x27635f={'count':0x0,'rows':[]};var _0x57e741=_[_0xfed1('0x26')](db[_0xfed1('0x27')]['rawAttributes'],function(_0x34e47b){return{'name':_0x34e47b[_0xfed1('0x28')],'type':_0x34e47b[_0xfed1('0x29')]['key']};});_0x221bf7[_0xfed1('0x2a')]=_[_0xfed1('0x26')](_0x57e741,_0xfed1('0x24'));_0x221bf7[_0xfed1('0x2b')]=_['keys'](_0x46cf02[_0xfed1('0x2b')]);_0x221bf7[_0xfed1('0x2c')]=_[_0xfed1('0x2d')](_0x221bf7[_0xfed1('0x2a')],_0x221bf7[_0xfed1('0x2b')]);_0x1867f6['attributes']=_[_0xfed1('0x2d')](_0x221bf7[_0xfed1('0x2a')],qs[_0xfed1('0x2e')](_0x46cf02[_0xfed1('0x2b')][_0xfed1('0x2e')]));_0x1867f6[_0xfed1('0x2f')]=_0x1867f6[_0xfed1('0x2f')][_0xfed1('0x30')]?_0x1867f6['attributes']:_0x221bf7['model'];if(!_0x46cf02['query'][_0xfed1('0x31')](_0xfed1('0x32'))){_0x1867f6['limit']=qs[_0xfed1('0x1a')](_0x46cf02['query']['limit']);_0x1867f6['offset']=qs[_0xfed1('0x18')](_0x46cf02[_0xfed1('0x2b')][_0xfed1('0x18')]);}_0x1867f6['order']=qs['sort'](_0x46cf02[_0xfed1('0x2b')][_0xfed1('0x33')]);_0x1867f6[_0xfed1('0x34')]=qs[_0xfed1('0x2c')](_[_0xfed1('0x35')](_0x46cf02[_0xfed1('0x2b')],_0x221bf7[_0xfed1('0x2c')]),_0x57e741);if(_0x46cf02['query'][_0xfed1('0x36')]){_0x1867f6['where']=_[_0xfed1('0x37')](_0x1867f6[_0xfed1('0x34')],{'$or':_['map'](_0x57e741,function(_0x3adf16){if(_0x3adf16[_0xfed1('0x29')]!=='VIRTUAL'){var _0x32e493={};_0x32e493[_0x3adf16[_0xfed1('0x24')]]={'$like':'%'+_0x46cf02['query']['filter']+'%'};return _0x32e493;}})});}_0x1867f6=_[_0xfed1('0x37')]({},_0x1867f6,_0x46cf02[_0xfed1('0x38')]);var _0x3ec842={'where':_0x1867f6[_0xfed1('0x34')]};return db['JscriptyAnswerReport'][_0xfed1('0x1b')](_0x3ec842)['then'](function(_0x44ef72){_0x27635f['count']=_0x44ef72;if(_0x46cf02[_0xfed1('0x2b')][_0xfed1('0x39')]){_0x1867f6[_0xfed1('0x3a')]=[{'all':!![]}];}return db[_0xfed1('0x27')][_0xfed1('0x3b')](_0x1867f6);})['then'](function(_0x3edf0d){_0x27635f[_0xfed1('0x3c')]=_0x3edf0d;return _0x27635f;})[_0xfed1('0x3d')](respondWithFilteredResult(_0x411182,_0x1867f6))[_0xfed1('0x3e')](handleError(_0x411182,null));};exports[_0xfed1('0x3f')]=function(_0x5bff16,_0x2bc41f){var _0x1bac62={'raw':!![],'where':{'id':_0x5bff16[_0xfed1('0x40')]['id']}},_0x799206={};_0x799206[_0xfed1('0x2a')]=_[_0xfed1('0x41')](db[_0xfed1('0x27')]['rawAttributes']);_0x799206[_0xfed1('0x2b')]=_['keys'](_0x5bff16[_0xfed1('0x2b')]);_0x799206[_0xfed1('0x2c')]=_[_0xfed1('0x2d')](_0x799206[_0xfed1('0x2a')],_0x799206[_0xfed1('0x2b')]);_0x1bac62[_0xfed1('0x2f')]=_[_0xfed1('0x2d')](_0x799206['model'],qs[_0xfed1('0x2e')](_0x5bff16[_0xfed1('0x2b')]['fields']));_0x1bac62[_0xfed1('0x2f')]=_0x1bac62[_0xfed1('0x2f')][_0xfed1('0x30')]?_0x1bac62[_0xfed1('0x2f')]:_0x799206['model'];if(_0x5bff16[_0xfed1('0x2b')][_0xfed1('0x39')]){_0x1bac62[_0xfed1('0x3a')]=[{'all':!![]}];}_0x1bac62=_['merge']({},_0x1bac62,_0x5bff16['options']);return db['JscriptyAnswerReport']['find'](_0x1bac62)[_0xfed1('0x3d')](handleEntityNotFound(_0x2bc41f,null))[_0xfed1('0x3d')](respondWithResult(_0x2bc41f,null))[_0xfed1('0x3e')](handleError(_0x2bc41f,null));};exports[_0xfed1('0x42')]=function(_0x94bf5c,_0x5c9aab){return db['JscriptyAnswerReport'][_0xfed1('0x42')](_0x94bf5c[_0xfed1('0x43')],{})[_0xfed1('0x3d')](respondWithResult(_0x5c9aab,0xc9))['catch'](handleError(_0x5c9aab,null));};exports['update']=function(_0x6c2337,_0x181063){if(_0x6c2337[_0xfed1('0x43')]['id']){delete _0x6c2337[_0xfed1('0x43')]['id'];}return db[_0xfed1('0x27')][_0xfed1('0x44')]({'where':{'id':_0x6c2337['params']['id']}})[_0xfed1('0x3d')](handleEntityNotFound(_0x181063,null))['then'](saveUpdates(_0x6c2337[_0xfed1('0x43')],null))[_0xfed1('0x3d')](respondWithResult(_0x181063,null))['catch'](handleError(_0x181063,null));};exports['destroy']=function(_0x3c4d59,_0x47d49b){return db[_0xfed1('0x27')][_0xfed1('0x44')]({'where':{'id':_0x3c4d59['params']['id']}})[_0xfed1('0x3d')](handleEntityNotFound(_0x47d49b,null))[_0xfed1('0x3d')](removeEntity(_0x47d49b,null))['catch'](handleError(_0x47d49b,null));};exports[_0xfed1('0x45')]=function(_0x4683e7,_0x5120cd){return db['JscriptyAnswerReport'][_0xfed1('0x45')]()[_0xfed1('0x3d')](respondWithResult(_0x5120cd,null))[_0xfed1('0x3e')](handleError(_0x5120cd,null));}; \ No newline at end of file +var _0x0734=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','set'];(function(_0x205c8a,_0x2c685b){var _0x336fd6=function(_0x17672a){while(--_0x17672a){_0x205c8a['push'](_0x205c8a['shift']());}};_0x336fd6(++_0x2c685b);}(_0x0734,0xba));var _0x4073=function(_0x37ef1a,_0x4f9479){_0x37ef1a=_0x37ef1a-0x0;var _0x180380=_0x0734[_0x37ef1a];return _0x180380;};'use strict';var emlformat=require(_0x4073('0x0'));var rimraf=require(_0x4073('0x1'));var zipdir=require(_0x4073('0x2'));var jsonpatch=require(_0x4073('0x3'));var rp=require(_0x4073('0x4'));var moment=require('moment');var BPromise=require(_0x4073('0x5'));var Mustache=require(_0x4073('0x6'));var util=require(_0x4073('0x7'));var path=require(_0x4073('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4073('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4073('0xa'));var squel=require(_0x4073('0xb'));var crypto=require(_0x4073('0xc'));var jsforce=require(_0x4073('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4073('0xe'));var querystring=require('querystring');var Papa=require(_0x4073('0xf'));var Redis=require(_0x4073('0x10'));var authService=require(_0x4073('0x11'));var qs=require(_0x4073('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4073('0x13'))(_0x4073('0x14'));var utils=require('../../config/utils');var config=require(_0x4073('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4073('0x16'))['db'];function respondWithStatusCode(_0x4c496c,_0x1778d8){_0x1778d8=_0x1778d8||0xcc;return function(_0x48e6eb){if(_0x48e6eb){return _0x4c496c['sendStatus'](_0x1778d8);}return _0x4c496c[_0x4073('0x17')](_0x1778d8)[_0x4073('0x18')]();};}function respondWithResult(_0x565576,_0x416322){_0x416322=_0x416322||0xc8;return function(_0x1355f5){if(_0x1355f5){return _0x565576[_0x4073('0x17')](_0x416322)[_0x4073('0x19')](_0x1355f5);}};}function respondWithFilteredResult(_0x3e29e9,_0x45238f){return function(_0x592c8c){if(_0x592c8c){var _0x2bc7c5=typeof _0x45238f['offset']===_0x4073('0x1a')&&typeof _0x45238f[_0x4073('0x1b')]==='undefined';var _0x1339b2=_0x592c8c[_0x4073('0x1c')];var _0x7a6e37=_0x2bc7c5?0x0:_0x45238f['offset'];var _0x35e397=_0x2bc7c5?_0x592c8c[_0x4073('0x1c')]:_0x45238f['offset']+_0x45238f['limit'];var _0x44aa71;if(_0x35e397>=_0x1339b2){_0x35e397=_0x1339b2;_0x44aa71=0xc8;}else{_0x44aa71=0xce;}_0x3e29e9['status'](_0x44aa71);return _0x3e29e9[_0x4073('0x1d')](_0x4073('0x1e'),_0x7a6e37+'-'+_0x35e397+'/'+_0x1339b2)[_0x4073('0x19')](_0x592c8c);}return null;};}function patchUpdates(_0x56d196){return function(_0xa87289){try{jsonpatch[_0x4073('0x1f')](_0xa87289,_0x56d196,!![]);}catch(_0x37b4f3){return BPromise[_0x4073('0x20')](_0x37b4f3);}return _0xa87289[_0x4073('0x21')]();};}function saveUpdates(_0x523c11,_0x1b36b7){return function(_0x5b5977){if(_0x5b5977){return _0x5b5977['update'](_0x523c11)[_0x4073('0x22')](function(_0x3dfed2){return _0x3dfed2;});}return null;};}function removeEntity(_0x37fd2d,_0x531bf4){return function(_0x48c8eb){if(_0x48c8eb){return _0x48c8eb[_0x4073('0x23')]()[_0x4073('0x22')](function(){_0x37fd2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x765754,_0x477cf6){return function(_0x259234){if(!_0x259234){_0x765754[_0x4073('0x24')](0x194);}return _0x259234;};}function handleError(_0x19a118,_0x20d4a8){_0x20d4a8=_0x20d4a8||0x1f4;return function(_0xf3faf4){logger[_0x4073('0x25')](_0xf3faf4['stack']);if(_0xf3faf4[_0x4073('0x26')]){delete _0xf3faf4[_0x4073('0x26')];}_0x19a118[_0x4073('0x17')](_0x20d4a8)['send'](_0xf3faf4);};}exports[_0x4073('0x27')]=function(_0x35b8d5,_0x512f69){var _0x57fcfd={},_0x465c67={},_0x429f8d={'count':0x0,'rows':[]};var _0x5e958d=_[_0x4073('0x28')](db[_0x4073('0x29')][_0x4073('0x2a')],function(_0x45a36e){return{'name':_0x45a36e['fieldName'],'type':_0x45a36e[_0x4073('0x2b')][_0x4073('0x2c')]};});_0x465c67[_0x4073('0x2d')]=_['map'](_0x5e958d,_0x4073('0x26'));_0x465c67[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x35b8d5[_0x4073('0x2e')]);_0x465c67[_0x4073('0x30')]=_['intersection'](_0x465c67[_0x4073('0x2d')],_0x465c67[_0x4073('0x2e')]);_0x57fcfd[_0x4073('0x31')]=_[_0x4073('0x32')](_0x465c67[_0x4073('0x2d')],qs['fields'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x33')]));_0x57fcfd[_0x4073('0x31')]=_0x57fcfd[_0x4073('0x31')][_0x4073('0x34')]?_0x57fcfd[_0x4073('0x31')]:_0x465c67[_0x4073('0x2d')];if(!_0x35b8d5['query'][_0x4073('0x35')](_0x4073('0x36'))){_0x57fcfd[_0x4073('0x1b')]=qs[_0x4073('0x1b')](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x1b')]);_0x57fcfd['offset']=qs['offset'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x37')]);}_0x57fcfd['order']=qs['sort'](_0x35b8d5['query'][_0x4073('0x38')]);_0x57fcfd[_0x4073('0x39')]=qs['filters'](_[_0x4073('0x3a')](_0x35b8d5[_0x4073('0x2e')],_0x465c67[_0x4073('0x30')]),_0x5e958d);if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3b')]){_0x57fcfd[_0x4073('0x39')]=_[_0x4073('0x3c')](_0x57fcfd[_0x4073('0x39')],{'$or':_[_0x4073('0x28')](_0x5e958d,function(_0x4e93a6){if(_0x4e93a6[_0x4073('0x2b')]!==_0x4073('0x3d')){var _0xce192c={};_0xce192c[_0x4e93a6['name']]={'$like':'%'+_0x35b8d5['query'][_0x4073('0x3b')]+'%'};return _0xce192c;}})});}_0x57fcfd=_[_0x4073('0x3c')]({},_0x57fcfd,_0x35b8d5['options']);var _0x5eb108={'where':_0x57fcfd[_0x4073('0x39')]};return db['JscriptyAnswerReport'][_0x4073('0x1c')](_0x5eb108)[_0x4073('0x22')](function(_0x4499ad){_0x429f8d[_0x4073('0x1c')]=_0x4499ad;if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3e')]){_0x57fcfd[_0x4073('0x3f')]=[{'all':!![]}];}return db[_0x4073('0x29')][_0x4073('0x40')](_0x57fcfd);})[_0x4073('0x22')](function(_0x214635){_0x429f8d['rows']=_0x214635;return _0x429f8d;})[_0x4073('0x22')](respondWithFilteredResult(_0x512f69,_0x57fcfd))[_0x4073('0x41')](handleError(_0x512f69,null));};exports[_0x4073('0x42')]=function(_0x288055,_0x4d026c){var _0x4d4baf={'raw':!![],'where':{'id':_0x288055[_0x4073('0x43')]['id']}},_0x2d577e={};_0x2d577e[_0x4073('0x2d')]=_[_0x4073('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0x2d577e[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x288055[_0x4073('0x2e')]);_0x2d577e[_0x4073('0x30')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],_0x2d577e[_0x4073('0x2e')]);_0x4d4baf[_0x4073('0x31')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],qs['fields'](_0x288055[_0x4073('0x2e')][_0x4073('0x33')]));_0x4d4baf[_0x4073('0x31')]=_0x4d4baf[_0x4073('0x31')][_0x4073('0x34')]?_0x4d4baf['attributes']:_0x2d577e[_0x4073('0x2d')];if(_0x288055[_0x4073('0x2e')][_0x4073('0x3e')]){_0x4d4baf[_0x4073('0x3f')]=[{'all':!![]}];}_0x4d4baf=_[_0x4073('0x3c')]({},_0x4d4baf,_0x288055['options']);return db[_0x4073('0x29')]['find'](_0x4d4baf)[_0x4073('0x22')](handleEntityNotFound(_0x4d026c,null))[_0x4073('0x22')](respondWithResult(_0x4d026c,null))[_0x4073('0x41')](handleError(_0x4d026c,null));};exports[_0x4073('0x44')]=function(_0x51093e,_0x5a0143){return db['JscriptyAnswerReport'][_0x4073('0x44')](_0x51093e[_0x4073('0x45')],{})[_0x4073('0x22')](respondWithResult(_0x5a0143,0xc9))[_0x4073('0x41')](handleError(_0x5a0143,null));};exports['update']=function(_0x4deee7,_0x49b366){if(_0x4deee7[_0x4073('0x45')]['id']){delete _0x4deee7[_0x4073('0x45')]['id'];}return db[_0x4073('0x29')]['find']({'where':{'id':_0x4deee7[_0x4073('0x43')]['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x49b366,null))[_0x4073('0x22')](saveUpdates(_0x4deee7[_0x4073('0x45')],null))[_0x4073('0x22')](respondWithResult(_0x49b366,null))['catch'](handleError(_0x49b366,null));};exports['destroy']=function(_0x45fd98,_0x104983){return db[_0x4073('0x29')][_0x4073('0x46')]({'where':{'id':_0x45fd98['params']['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x104983,null))[_0x4073('0x22')](removeEntity(_0x104983,null))[_0x4073('0x41')](handleError(_0x104983,null));};exports[_0x4073('0x47')]=function(_0x4ad4ee,_0x58588c){return db['JscriptyAnswerReport'][_0x4073('0x47')]()[_0x4073('0x22')](respondWithResult(_0x58588c,null))[_0x4073('0x41')](handleError(_0x58588c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 91ccaa3..66881b9 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 _0x43b7=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b7,0x162));var _0x743b=function(_0x377067,_0x457ab7){_0x377067=_0x377067-0x0;var _0x31a8e5=_0x43b7[_0x377067];return _0x31a8e5;};'use strict';var _=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x743b('0x2'));var BPromise=require(_0x743b('0x3'));var rp=require(_0x743b('0x4'));var fs=require('fs');var path=require(_0x743b('0x5'));var rimraf=require(_0x743b('0x6'));var config=require(_0x743b('0x7'));var attributes=require(_0x743b('0x8'));module['exports']=function(_0x445d24,_0x4ff73b){return _0x445d24['define'](_0x743b('0x9'),attributes,{'tableName':_0x743b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94d6=['lodash','util','api','moment','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x35e42e,_0x338536){var _0x46be96=function(_0x318ff2){while(--_0x318ff2){_0x35e42e['push'](_0x35e42e['shift']());}};_0x46be96(++_0x338536);}(_0x94d6,0x1a2));var _0x694d=function(_0xa5120a,_0x19467f){_0xa5120a=_0xa5120a-0x0;var _0x381c19=_0x94d6[_0xa5120a];return _0x381c19;};'use strict';var _=require(_0x694d('0x0'));var util=require(_0x694d('0x1'));var logger=require('../../config/logger')(_0x694d('0x2'));var moment=require(_0x694d('0x3'));var BPromise=require('bluebird');var rp=require(_0x694d('0x4'));var fs=require('fs');var path=require(_0x694d('0x5'));var rimraf=require(_0x694d('0x6'));var config=require('../../config/environment');var attributes=require(_0x694d('0x7'));module[_0x694d('0x8')]=function(_0x295a66,_0x2cabc3){return _0x295a66['define'](_0x694d('0x9'),attributes,{'tableName':_0x694d('0xa'),'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 b112dc7..0d91633 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 _0x910d=['request\x20sent','debug','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x46a3b0,_0x468156){var _0x257018=function(_0x4ebdd8){while(--_0x4ebdd8){_0x46a3b0['push'](_0x46a3b0['shift']());}};_0x257018(++_0x468156);}(_0x910d,0x141));var _0xd910=function(_0x51a9ab,_0x73c171){_0x51a9ab=_0x51a9ab-0x0;var _0x542c09=_0x910d[_0x51a9ab];return _0x542c09;};'use strict';var _=require(_0xd910('0x0'));var util=require(_0xd910('0x1'));var moment=require(_0xd910('0x2'));var BPromise=require(_0xd910('0x3'));var rs=require(_0xd910('0x4'));var fs=require('fs');var Redis=require(_0xd910('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd910('0x6'));var logger=require(_0xd910('0x7'))('rpc');var config=require(_0xd910('0x8'));var jayson=require(_0xd910('0x9'));var client=jayson[_0xd910('0xa')][_0xd910('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53d79a,_0x277c00,_0x53bbfd){return new BPromise(function(_0x4834df,_0x472b70){return client[_0xd910('0xc')](_0x53d79a,_0x53bbfd)[_0xd910('0xd')](function(_0xf69d00){logger[_0xd910('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x277c00,_0xd910('0xf'));logger[_0xd910('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x277c00,'request\x20sent',JSON[_0xd910('0x11')](_0xf69d00));if(_0xf69d00[_0xd910('0x12')]){if(_0xf69d00[_0xd910('0x12')][_0xd910('0x13')]===0x1f4){logger[_0xd910('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x277c00,_0xf69d00['error']['message']);return _0x472b70(_0xf69d00[_0xd910('0x12')][_0xd910('0x14')]);}logger[_0xd910('0x12')](_0xd910('0x15'),_0x277c00,_0xf69d00[_0xd910('0x12')][_0xd910('0x14')]);return _0x4834df(_0xf69d00['error']['message']);}else{logger[_0xd910('0xe')](_0xd910('0x15'),_0x277c00,_0xd910('0xf'));_0x4834df(_0xf69d00[_0xd910('0x16')][_0xd910('0x14')]);}})[_0xd910('0x17')](function(_0x57868e){logger['error'](_0xd910('0x15'),_0x277c00,_0x57868e);_0x472b70(_0x57868e);});});} \ No newline at end of file +var _0xcd3d=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ae949,_0x2715ba){var _0x333dc0=function(_0x325412){while(--_0x325412){_0x3ae949['push'](_0x3ae949['shift']());}};_0x333dc0(++_0x2715ba);}(_0xcd3d,0x1c4));var _0xdcd3=function(_0x4cc447,_0x2265f9){_0x4cc447=_0x4cc447-0x0;var _0x45d8ea=_0xcd3d[_0x4cc447];return _0x45d8ea;};'use strict';var _=require('lodash');var util=require(_0xdcd3('0x0'));var moment=require(_0xdcd3('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcd3('0x2'));var fs=require('fs');var Redis=require(_0xdcd3('0x3'));var db=require(_0xdcd3('0x4'))['db'];var utils=require(_0xdcd3('0x5'));var logger=require(_0xdcd3('0x6'))(_0xdcd3('0x7'));var config=require(_0xdcd3('0x8'));var jayson=require(_0xdcd3('0x9'));var client=jayson['client'][_0xdcd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5adf06,_0x42224e,_0xde1b98){return new BPromise(function(_0x5dc18e,_0x33dfee){return client[_0xdcd3('0xb')](_0x5adf06,_0xde1b98)[_0xdcd3('0xc')](function(_0x2725c2){logger[_0xdcd3('0xd')](_0xdcd3('0xe'),_0x42224e,_0xdcd3('0xf'));logger['debug'](_0xdcd3('0x10'),_0x42224e,_0xdcd3('0xf'),JSON[_0xdcd3('0x11')](_0x2725c2));if(_0x2725c2[_0xdcd3('0x12')]){if(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x13')]===0x1f4){logger[_0xdcd3('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42224e,_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);return _0x33dfee(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);}logger[_0xdcd3('0x12')](_0xdcd3('0xe'),_0x42224e,_0x2725c2['error'][_0xdcd3('0x14')]);return _0x5dc18e(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);}else{logger[_0xdcd3('0xd')](_0xdcd3('0xe'),_0x42224e,_0xdcd3('0xf'));_0x5dc18e(_0x2725c2[_0xdcd3('0x15')]['message']);}})['catch'](function(_0x4438d0){logger[_0xdcd3('0x12')](_0xdcd3('0xe'),_0x42224e,_0x4438d0);_0x33dfee(_0x4438d0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 050a681..f071ff2 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 _0xde18=['/:id/answers','/:id/summary','30s','getSummary','create','post','/:id/clone','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions'];(function(_0x359ee5,_0x70bf27){var _0x2d5644=function(_0x4a50c0){while(--_0x4a50c0){_0x359ee5['push'](_0x359ee5['shift']());}};_0x2d5644(++_0x70bf27);}(_0xde18,0x17e));var _0x8de1=function(_0x33cbd1,_0x42587b){_0x33cbd1=_0x33cbd1-0x0;var _0xd0f562=_0xde18[_0x33cbd1];return _0xd0f562;};'use strict';var multer=require(_0x8de1('0x0'));var util=require(_0x8de1('0x1'));var path=require(_0x8de1('0x2'));var timeout=require(_0x8de1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8de1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8de1('0x5'));var config=require(_0x8de1('0x6'));var controller=require(_0x8de1('0x7'));router[_0x8de1('0x8')]('/',auth[_0x8de1('0x9')](),controller[_0x8de1('0xa')]);router[_0x8de1('0x8')](_0x8de1('0xb'),auth[_0x8de1('0x9')](),controller[_0x8de1('0xc')]);router[_0x8de1('0x8')]('/:id/sessions',auth[_0x8de1('0x9')](),controller[_0x8de1('0xd')]);router['get'](_0x8de1('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x8de1('0x8')](_0x8de1('0xf'),auth[_0x8de1('0x9')](),timeout(_0x8de1('0x10')),controller[_0x8de1('0x11')]);router['post']('/',auth[_0x8de1('0x9')](),controller[_0x8de1('0x12')]);router[_0x8de1('0x13')](_0x8de1('0x14'),auth[_0x8de1('0x9')](),controller['clone']);router['put']('/:id',auth[_0x8de1('0x9')](),controller['update']);router[_0x8de1('0x15')](_0x8de1('0xb'),auth[_0x8de1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fee=['destroy','util','path','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','index','get','show','/:id/sessions','getSessions','/:id/summary','getSummary','post','isAuthenticated','create','/:id/clone','put','/:id','delete'];(function(_0x630e58,_0x2cd7a5){var _0x2dca0a=function(_0x36cf76){while(--_0x36cf76){_0x630e58['push'](_0x630e58['shift']());}};_0x2dca0a(++_0x2cd7a5);}(_0x8fee,0x13c));var _0xe8fe=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x8fee[_0x420d8d];return _0x4865d7;};'use strict';var multer=require('multer');var util=require(_0xe8fe('0x0'));var path=require(_0xe8fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8fe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8fe('0x3'));var interaction=require(_0xe8fe('0x4'));var config=require('../../config/environment');var controller=require(_0xe8fe('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8fe('0x6')]);router[_0xe8fe('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe8fe('0x8')]);router[_0xe8fe('0x7')](_0xe8fe('0x9'),auth['isAuthenticated'](),controller[_0xe8fe('0xa')]);router[_0xe8fe('0x7')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe8fe('0xb'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe8fe('0xc')]);router[_0xe8fe('0xd')]('/',auth[_0xe8fe('0xe')](),controller[_0xe8fe('0xf')]);router[_0xe8fe('0xd')](_0xe8fe('0x10'),auth[_0xe8fe('0xe')](),controller['clone']);router[_0xe8fe('0x11')](_0xe8fe('0x12'),auth[_0xe8fe('0xe')](),controller['update']);router[_0xe8fe('0x13')](_0xe8fe('0x12'),auth[_0xe8fe('0xe')](),controller[_0xe8fe('0x14')]);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 42b5d16..84d8d6d 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 _0xcb8f=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','name','isObjectLike','setDataValue','formData'];(function(_0x40568d,_0x3c2a93){var _0x220504=function(_0x3528d0){while(--_0x3528d0){_0x40568d['push'](_0x40568d['shift']());}};_0x220504(++_0x3c2a93);}(_0xcb8f,0x72));var _0xfcb8=function(_0x405128,_0x98fb13){_0x405128=_0x405128-0x0;var _0x3f763f=_0xcb8f[_0x405128];return _0x3f763f;};'use strict';var Sequelize=require(_0xfcb8('0x0'));var _=require('lodash');var util=require('util');module[_0xfcb8('0x1')]={'name':{'type':Sequelize[_0xfcb8('0x2')],'unique':_0xfcb8('0x3')},'description':{'type':Sequelize[_0xfcb8('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x4f203a){if(_[_0xfcb8('0x4')](_0x4f203a)){this[_0xfcb8('0x5')](_0xfcb8('0x6'),JSON['stringify'](_0x4f203a));}else if(_['isString'](_0x4f203a)){this[_0xfcb8('0x5')](_0xfcb8('0x6'),_0x4f203a);}else{this[_0xfcb8('0x5')]('formData',util['format'](_0xfcb8('0x7'),this['getDataValue']('name')||'',this[_0xfcb8('0x8')](_0xfcb8('0x9'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfcb8('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfcb8('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x0713=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format'];(function(_0xaee9b2,_0x4f74cf){var _0x8c26c1=function(_0x252b5a){while(--_0x252b5a){_0xaee9b2['push'](_0xaee9b2['shift']());}};_0x8c26c1(++_0x4f74cf);}(_0x0713,0x83));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3071('0x0'));var _=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));module['exports']={'name':{'type':Sequelize[_0x3071('0x3')],'unique':_0x3071('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3071('0x5')](_0x3071('0x6')),'set':function(_0x468150){if(_[_0x3071('0x7')](_0x468150)){this[_0x3071('0x8')]('formData',JSON[_0x3071('0x9')](_0x468150));}else if(_[_0x3071('0xa')](_0x468150)){this[_0x3071('0x8')](_0x3071('0xb'),_0x468150);}else{this[_0x3071('0x8')](_0x3071('0xb'),util[_0x3071('0xc')](_0x3071('0xd'),this['getDataValue'](_0x3071('0x4'))||'',this[_0x3071('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3071('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3071('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c29a9e4..b2ab29e 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 _0xa19c=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','where','options','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getSessions','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2044fb,_0x230828){var _0x25eaa0=function(_0x58c8f1){while(--_0x58c8f1){_0x2044fb['push'](_0x2044fb['shift']());}};_0x25eaa0(++_0x230828);}(_0xa19c,0xce));var _0xca19=function(_0x3a8b1a,_0x1e21d4){_0x3a8b1a=_0x3a8b1a-0x0;var _0x35af04=_0xa19c[_0x3a8b1a];return _0x35af04;};'use strict';var emlformat=require(_0xca19('0x0'));var rimraf=require(_0xca19('0x1'));var zipdir=require(_0xca19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xca19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xca19('0x4'));var util=require(_0xca19('0x5'));var path=require(_0xca19('0x6'));var sox=require(_0xca19('0x7'));var csv=require('to-csv');var ejs=require(_0xca19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca19('0x9'));var squel=require('squel');var crypto=require(_0xca19('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xca19('0xb'));var toCsv=require(_0xca19('0xc'));var querystring=require(_0xca19('0xd'));var Papa=require(_0xca19('0xe'));var Redis=require(_0xca19('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca19('0x10'));var as=require(_0xca19('0x11'));var hardwareService=require(_0xca19('0x12'));var logger=require(_0xca19('0x13'))(_0xca19('0x14'));var utils=require(_0xca19('0x15'));var config=require(_0xca19('0x16'));var licenseUtil=require(_0xca19('0x17'));var db=require(_0xca19('0x18'))['db'];function respondWithStatusCode(_0x1389ce,_0x274a91){_0x274a91=_0x274a91||0xcc;return function(_0x5d9081){if(_0x5d9081){return _0x1389ce[_0xca19('0x19')](_0x274a91);}return _0x1389ce[_0xca19('0x1a')](_0x274a91)[_0xca19('0x1b')]();};}function respondWithResult(_0x209146,_0x2af11c){_0x2af11c=_0x2af11c||0xc8;return function(_0x3dad52){if(_0x3dad52){return _0x209146[_0xca19('0x1a')](_0x2af11c)[_0xca19('0x1c')](_0x3dad52);}};}function respondWithFilteredResult(_0x19cae1,_0x36e5ec){return function(_0x3410b0){if(_0x3410b0){var _0x28c04e=typeof _0x36e5ec[_0xca19('0x1d')]==='undefined'&&typeof _0x36e5ec[_0xca19('0x1e')]===_0xca19('0x1f');var _0x1e7779=_0x3410b0[_0xca19('0x20')];var _0xc81f09=_0x28c04e?0x0:_0x36e5ec['offset'];var _0x4a2904=_0x28c04e?_0x3410b0[_0xca19('0x20')]:_0x36e5ec[_0xca19('0x1d')]+_0x36e5ec[_0xca19('0x1e')];var _0x4ae911;if(_0x4a2904>=_0x1e7779){_0x4a2904=_0x1e7779;_0x4ae911=0xc8;}else{_0x4ae911=0xce;}_0x19cae1[_0xca19('0x1a')](_0x4ae911);return _0x19cae1[_0xca19('0x21')]('Content-Range',_0xc81f09+'-'+_0x4a2904+'/'+_0x1e7779)[_0xca19('0x1c')](_0x3410b0);}return null;};}function patchUpdates(_0x8ae4f1){return function(_0x3797e3){try{jsonpatch[_0xca19('0x22')](_0x3797e3,_0x8ae4f1,!![]);}catch(_0x393b8f){return BPromise[_0xca19('0x23')](_0x393b8f);}return _0x3797e3[_0xca19('0x24')]();};}function saveUpdates(_0x30aca5,_0x4527e4){return function(_0x32af14){if(_0x32af14){return _0x32af14[_0xca19('0x25')](_0x30aca5)[_0xca19('0x26')](function(_0x407e1b){return _0x407e1b;});}return null;};}function removeEntity(_0x1c59de,_0x3928a5){return function(_0xbec3ec){if(_0xbec3ec){return _0xbec3ec[_0xca19('0x27')]()[_0xca19('0x26')](function(){var _0x9d545c=_0xbec3ec[_0xca19('0x28')]({'plain':!![]});var _0x321b23=_0xca19('0x29');return db[_0xca19('0x2a')]['destroy']({'where':{'type':_0x321b23,'resourceId':_0x9d545c['id']}})[_0xca19('0x26')](function(){return _0xbec3ec;});})[_0xca19('0x26')](function(){_0x1c59de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x517086,_0x2f710a){return function(_0x50e504){if(!_0x50e504){_0x517086[_0xca19('0x19')](0x194);}return _0x50e504;};}function handleError(_0x237dd9,_0x1b48cb){_0x1b48cb=_0x1b48cb||0x1f4;return function(_0x2fabbe){logger[_0xca19('0x2b')](_0x2fabbe['stack']);if(_0x2fabbe[_0xca19('0x2c')]){delete _0x2fabbe[_0xca19('0x2c')];}_0x237dd9['status'](_0x1b48cb)[_0xca19('0x2d')](_0x2fabbe);};}exports['index']=function(_0x5c5dbc,_0x4fa472){var _0x3a3e89={},_0x378f67={},_0x5b44e0={'count':0x0,'rows':[]};var _0x1666ef=_[_0xca19('0x2e')](db['JscriptyProject'][_0xca19('0x2f')],function(_0x32751f){return{'name':_0x32751f['fieldName'],'type':_0x32751f[_0xca19('0x30')]['key']};});_0x378f67[_0xca19('0x31')]=_[_0xca19('0x2e')](_0x1666ef,_0xca19('0x2c'));_0x378f67[_0xca19('0x32')]=_['keys'](_0x5c5dbc[_0xca19('0x32')]);_0x378f67[_0xca19('0x33')]=_['intersection'](_0x378f67[_0xca19('0x31')],_0x378f67[_0xca19('0x32')]);_0x3a3e89[_0xca19('0x34')]=_[_0xca19('0x35')](_0x378f67['model'],qs[_0xca19('0x36')](_0x5c5dbc[_0xca19('0x32')][_0xca19('0x36')]));_0x3a3e89['attributes']=_0x3a3e89[_0xca19('0x34')][_0xca19('0x37')]?_0x3a3e89[_0xca19('0x34')]:_0x378f67['model'];if(!_0x5c5dbc[_0xca19('0x32')]['hasOwnProperty'](_0xca19('0x38'))){_0x3a3e89[_0xca19('0x1e')]=qs[_0xca19('0x1e')](_0x5c5dbc[_0xca19('0x32')]['limit']);_0x3a3e89[_0xca19('0x1d')]=qs[_0xca19('0x1d')](_0x5c5dbc[_0xca19('0x32')]['offset']);}_0x3a3e89[_0xca19('0x39')]=qs['sort'](_0x5c5dbc[_0xca19('0x32')][_0xca19('0x3a')]);_0x3a3e89['where']=qs[_0xca19('0x33')](_[_0xca19('0x3b')](_0x5c5dbc[_0xca19('0x32')],_0x378f67[_0xca19('0x33')]),_0x1666ef);if(_0x5c5dbc[_0xca19('0x32')][_0xca19('0x3c')]){_0x3a3e89['where']=_[_0xca19('0x3d')](_0x3a3e89[_0xca19('0x3e')],{'$or':_[_0xca19('0x2e')](_0x1666ef,function(_0x52908c){if(_0x52908c[_0xca19('0x30')]!=='VIRTUAL'){var _0x30b83f={};_0x30b83f[_0x52908c[_0xca19('0x2c')]]={'$like':'%'+_0x5c5dbc[_0xca19('0x32')]['filter']+'%'};return _0x30b83f;}})});}_0x3a3e89=_['merge']({},_0x3a3e89,_0x5c5dbc[_0xca19('0x3f')]);var _0x42982d={'where':_0x3a3e89[_0xca19('0x3e')]};return db[_0xca19('0x40')][_0xca19('0x20')](_0x42982d)['then'](function(_0x8fab86){_0x5b44e0[_0xca19('0x20')]=_0x8fab86;if(_0x5c5dbc['query'][_0xca19('0x41')]){_0x3a3e89[_0xca19('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0xca19('0x43')](_0x3a3e89);})[_0xca19('0x26')](function(_0x102791){_0x5b44e0[_0xca19('0x44')]=_0x102791;return _0x5b44e0;})[_0xca19('0x26')](respondWithFilteredResult(_0x4fa472,_0x3a3e89))[_0xca19('0x45')](handleError(_0x4fa472,null));};exports[_0xca19('0x46')]=function(_0x3b445f,_0x4d22d1){var _0x54b064={'raw':![],'where':{'id':_0x3b445f[_0xca19('0x47')]['id']}},_0x7535c3={};_0x7535c3[_0xca19('0x31')]=_[_0xca19('0x48')](db[_0xca19('0x40')][_0xca19('0x2f')]);_0x7535c3[_0xca19('0x32')]=_[_0xca19('0x48')](_0x3b445f['query']);_0x7535c3[_0xca19('0x33')]=_['intersection'](_0x7535c3[_0xca19('0x31')],_0x7535c3[_0xca19('0x32')]);_0x54b064[_0xca19('0x34')]=_[_0xca19('0x35')](_0x7535c3[_0xca19('0x31')],qs[_0xca19('0x36')](_0x3b445f[_0xca19('0x32')][_0xca19('0x36')]));_0x54b064['attributes']=_0x54b064[_0xca19('0x34')][_0xca19('0x37')]?_0x54b064[_0xca19('0x34')]:_0x7535c3['model'];if(_0x3b445f['query'][_0xca19('0x41')]){_0x54b064[_0xca19('0x42')]=[{'all':!![]}];}_0x54b064=_[_0xca19('0x3d')]({},_0x54b064,_0x3b445f[_0xca19('0x3f')]);return db[_0xca19('0x40')][_0xca19('0x49')](_0x54b064)['then'](handleEntityNotFound(_0x4d22d1,null))[_0xca19('0x26')](respondWithResult(_0x4d22d1,null))[_0xca19('0x45')](handleError(_0x4d22d1,null));};exports[_0xca19('0x4a')]=function(_0x172e04,_0x486416){return db['JscriptyProject'][_0xca19('0x4a')](_0x172e04[_0xca19('0x4b')],{})[_0xca19('0x26')](function(_0x294959){var _0x284752=_0x172e04[_0xca19('0x4c')]['get']({'plain':!![]});if(!_0x284752)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x284752['role']===_0xca19('0x4c')){var _0x42e4d8=_0x294959[_0xca19('0x28')]({'plain':!![]});var _0x5e7792=_0xca19('0x29');return db[_0xca19('0x4d')]['find']({'where':{'name':_0x5e7792,'userProfileId':_0x284752['userProfileId']},'raw':!![]})['then'](function(_0x23b4d9){if(_0x23b4d9&&_0x23b4d9[_0xca19('0x4e')]===0x0){return db[_0xca19('0x2a')][_0xca19('0x4a')]({'name':_0x42e4d8[_0xca19('0x2c')],'resourceId':_0x42e4d8['id'],'type':_0x23b4d9['name'],'sectionId':_0x23b4d9['id']},{})[_0xca19('0x26')](function(){return _0x294959;});}else{return _0x294959;}})['catch'](function(_0x3f4e92){logger[_0xca19('0x2b')](_0xca19('0x4f'),_0x3f4e92);throw _0x3f4e92;});}return _0x294959;})[_0xca19('0x26')](respondWithResult(_0x486416,0xc9))[_0xca19('0x45')](handleError(_0x486416,null));};exports['clone']=function(_0x48fc59,_0x4bc69d){var _0x3ca273={'where':{'id':_0x48fc59[_0xca19('0x47')]['id']}},_0x1b879b={};_0x1b879b['model']=_[_0xca19('0x48')](db[_0xca19('0x40')][_0xca19('0x2f')]);_0x3ca273['attributes']=_[_0xca19('0x35')](_0x1b879b[_0xca19('0x31')],qs[_0xca19('0x36')](_0x48fc59[_0xca19('0x32')][_0xca19('0x36')]));_0x3ca273[_0xca19('0x34')]=_0x3ca273['attributes'][_0xca19('0x37')]?_0x3ca273[_0xca19('0x34')]:_0x1b879b['model'];if(_0x48fc59['query'][_0xca19('0x41')]){_0x3ca273['include']=[{'all':!![]}];}_0x3ca273=_[_0xca19('0x3d')]({},_0x3ca273,_0x48fc59[_0xca19('0x3f')]);return db[_0xca19('0x40')][_0xca19('0x49')](_0x3ca273)['then'](handleEntityNotFound(_0x4bc69d,null))['then'](function(_0x5d8355){if(_0x5d8355){var _0x5663f3=_0x5d8355[_0xca19('0x28')]({'plain':!![]});_0x5663f3=qs[_0xca19('0x50')](_0x5663f3,['id',_0xca19('0x51'),'updatedAt']);_0x48fc59[_0xca19('0x4b')]=_[_0xca19('0x50')](_0x48fc59[_0xca19('0x4b')],['id',_0xca19('0x51'),_0xca19('0x52')]);return db['JscriptyProject']['create'](_[_0xca19('0x3d')](_0x5663f3,_0x48fc59[_0xca19('0x4b')]),{'include':_0x48fc59[_0xca19('0x32')][_0xca19('0x41')]?[{'all':!![]}]:undefined})[_0xca19('0x26')](function(_0x3537e9){var _0x5f50fe=_0x48fc59['user'][_0xca19('0x28')]({'plain':!![]});if(!_0x5f50fe)throw new Error(_0xca19('0x53'));if(_0x5f50fe[_0xca19('0x54')]==='user'){var _0x47ecc5=_0x3537e9[_0xca19('0x28')]({'plain':!![]});var _0x44c361=_0xca19('0x29');return db[_0xca19('0x4d')][_0xca19('0x49')]({'where':{'name':_0x44c361,'userProfileId':_0x5f50fe[_0xca19('0x55')]},'raw':!![]})[_0xca19('0x26')](function(_0x182d21){if(_0x182d21&&_0x182d21['autoAssociation']===0x0){return db[_0xca19('0x2a')][_0xca19('0x4a')]({'name':_0x47ecc5[_0xca19('0x2c')],'resourceId':_0x47ecc5['id'],'type':_0x182d21[_0xca19('0x2c')],'sectionId':_0x182d21['id']},{})[_0xca19('0x26')](function(){return _0x3537e9;});}else{return _0x3537e9;}})[_0xca19('0x45')](function(_0x4e38c0){logger[_0xca19('0x2b')](_0xca19('0x4f'),_0x4e38c0);throw _0x4e38c0;});}return _0x3537e9;});}})[_0xca19('0x26')](respondWithResult(_0x4bc69d,0xc9))['catch'](handleError(_0x4bc69d,null));};exports[_0xca19('0x25')]=function(_0x426bd1,_0xdd6940){if(_0x426bd1['body']['id']){delete _0x426bd1[_0xca19('0x4b')]['id'];}return db[_0xca19('0x40')]['find']({'where':{'id':_0x426bd1[_0xca19('0x47')]['id']}})[_0xca19('0x26')](handleEntityNotFound(_0xdd6940,null))[_0xca19('0x26')](saveUpdates(_0x426bd1[_0xca19('0x4b')],null))[_0xca19('0x26')](respondWithResult(_0xdd6940,null))[_0xca19('0x45')](handleError(_0xdd6940,null));};exports['destroy']=function(_0x17106f,_0x27eb05){return db['JscriptyProject'][_0xca19('0x49')]({'where':{'id':_0x17106f['params']['id']}})[_0xca19('0x26')](handleEntityNotFound(_0x27eb05,null))[_0xca19('0x26')](removeEntity(_0x27eb05,null))[_0xca19('0x45')](handleError(_0x27eb05,null));};exports[_0xca19('0x56')]=function(_0x56d410,_0x5d1005,_0x43d40c){var _0x3ca50d={'raw':!![],'where':{}};var _0x1dc374={};var _0x276481={'count':0x0,'rows':[]};return db[_0xca19('0x40')]['findOne']({'where':{'id':_0x56d410[_0xca19('0x47')]['id']}})[_0xca19('0x26')](handleEntityNotFound(_0x5d1005,null))[_0xca19('0x26')](function(_0x45f9bf){if(_0x45f9bf){_0x1dc374[_0xca19('0x31')]=_[_0xca19('0x48')](db['JscriptySessionReport'][_0xca19('0x2f')]);_0x1dc374[_0xca19('0x32')]=_[_0xca19('0x48')](_0x56d410['query']);_0x1dc374[_0xca19('0x33')]=_[_0xca19('0x35')](_0x1dc374[_0xca19('0x31')],_0x1dc374[_0xca19('0x32')]);_0x3ca50d['attributes']=_[_0xca19('0x35')](_0x1dc374[_0xca19('0x31')],qs['fields'](_0x56d410[_0xca19('0x32')][_0xca19('0x36')]));_0x3ca50d[_0xca19('0x34')]=_0x3ca50d[_0xca19('0x34')]['length']?_0x3ca50d[_0xca19('0x34')]:_0x1dc374[_0xca19('0x31')];if(!_0x56d410[_0xca19('0x32')][_0xca19('0x57')]('nolimit')){_0x3ca50d[_0xca19('0x1e')]=qs['limit'](_0x56d410['query'][_0xca19('0x1e')]);_0x3ca50d['offset']=qs[_0xca19('0x1d')](_0x56d410[_0xca19('0x32')][_0xca19('0x1d')]);}_0x3ca50d['order']=qs[_0xca19('0x3a')](_0x56d410[_0xca19('0x32')][_0xca19('0x3a')]);_0x3ca50d[_0xca19('0x3e')]=qs[_0xca19('0x33')](_['pick'](_0x56d410['query'],_0x1dc374['filters']));_0x3ca50d[_0xca19('0x3e')][_0xca19('0x58')]=_0x45f9bf['id'];if(_0x56d410['query'][_0xca19('0x3c')]){_0x3ca50d[_0xca19('0x3e')]=_[_0xca19('0x3d')](_0x3ca50d[_0xca19('0x3e')],{'$or':_[_0xca19('0x2e')](_0x3ca50d[_0xca19('0x34')],function(_0x27fec4){var _0x2084e3={};_0x2084e3[_0x27fec4]={'$like':'%'+_0x56d410[_0xca19('0x32')][_0xca19('0x3c')]+'%'};return _0x2084e3;})});}_0x3ca50d=_[_0xca19('0x3d')]({},_0x3ca50d,_0x56d410[_0xca19('0x3f')]);return db[_0xca19('0x59')][_0xca19('0x20')]({'where':_0x3ca50d[_0xca19('0x3e')]})[_0xca19('0x26')](function(_0x13799c){_0x276481['count']=_0x13799c;if(_0x56d410[_0xca19('0x32')]['includeAll']){_0x3ca50d[_0xca19('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xca19('0x43')](_0x3ca50d);})[_0xca19('0x26')](function(_0x9d4f44){_0x276481['rows']=_0x9d4f44;return _0x276481;});}})[_0xca19('0x26')](respondWithFilteredResult(_0x5d1005,_0x3ca50d))[_0xca19('0x45')](handleError(_0x5d1005,null));};exports[_0xca19('0x5a')]=function(_0x5ef122,_0x166df7,_0x43b3d3){var _0x2c18de={'raw':!![],'where':{}};var _0x82c6d5={};var _0x41cb53={'count':0x0,'rows':[]};return db[_0xca19('0x40')]['findOne']({'where':{'id':_0x5ef122[_0xca19('0x47')]['id']}})[_0xca19('0x26')](handleEntityNotFound(_0x166df7,null))['then'](function(_0x4d3b7f){if(_0x4d3b7f){_0x82c6d5[_0xca19('0x31')]=_[_0xca19('0x48')](db['JscriptyAnswerReport'][_0xca19('0x2f')]);_0x82c6d5[_0xca19('0x32')]=_[_0xca19('0x48')](_0x5ef122[_0xca19('0x32')]);_0x82c6d5[_0xca19('0x33')]=_[_0xca19('0x35')](_0x82c6d5[_0xca19('0x31')],_0x82c6d5[_0xca19('0x32')]);_0x2c18de[_0xca19('0x34')]=_[_0xca19('0x35')](_0x82c6d5[_0xca19('0x31')],qs[_0xca19('0x36')](_0x5ef122['query'][_0xca19('0x36')]));_0x2c18de[_0xca19('0x34')]=_0x2c18de['attributes']['length']?_0x2c18de[_0xca19('0x34')]:_0x82c6d5[_0xca19('0x31')];if(!_0x5ef122[_0xca19('0x32')][_0xca19('0x57')](_0xca19('0x38'))){_0x2c18de[_0xca19('0x1e')]=qs[_0xca19('0x1e')](_0x5ef122[_0xca19('0x32')][_0xca19('0x1e')]);_0x2c18de[_0xca19('0x1d')]=qs[_0xca19('0x1d')](_0x5ef122['query']['offset']);}_0x2c18de[_0xca19('0x39')]=qs['sort'](_0x5ef122[_0xca19('0x32')][_0xca19('0x3a')]);_0x2c18de['where']=qs['filters'](_['pick'](_0x5ef122[_0xca19('0x32')],_0x82c6d5[_0xca19('0x33')]));_0x2c18de[_0xca19('0x3e')][_0xca19('0x58')]=_0x4d3b7f['id'];if(_0x5ef122[_0xca19('0x32')][_0xca19('0x3c')]){_0x2c18de['where']=_[_0xca19('0x3d')](_0x2c18de['where'],{'$or':_[_0xca19('0x2e')](_0x2c18de[_0xca19('0x34')],function(_0x2a5948){var _0xf97762={};_0xf97762[_0x2a5948]={'$like':'%'+_0x5ef122[_0xca19('0x32')][_0xca19('0x3c')]+'%'};return _0xf97762;})});}_0x2c18de=_[_0xca19('0x3d')]({},_0x2c18de,_0x5ef122[_0xca19('0x3f')]);return db[_0xca19('0x5b')]['count']({'where':_0x2c18de['where']})[_0xca19('0x26')](function(_0x4eca5a){_0x41cb53['count']=_0x4eca5a;if(_0x5ef122['query'][_0xca19('0x41')]){_0x2c18de[_0xca19('0x42')]=[{'all':!![]}];}return db[_0xca19('0x5b')][_0xca19('0x43')](_0x2c18de);})['then'](function(_0x136dfe){_0x41cb53[_0xca19('0x44')]=_0x136dfe;return _0x41cb53;});}})[_0xca19('0x26')](respondWithFilteredResult(_0x166df7,_0x2c18de))[_0xca19('0x45')](handleError(_0x166df7,null));};function char(_0x34b73d){return _0xca19('0x5c')===typeof _0x34b73d?String[_0xca19('0x5d')][_0xca19('0x22')](null,arguments):_0x34b73d;}function needsEncapsulation(_0x2c35cf){return!!_0x2c35cf&&(_0x2c35cf[_0xca19('0x5e')]()[_0xca19('0x5f')](char(0xd))>=0x0||_0x2c35cf[_0xca19('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x2c35cf[_0xca19('0x5e')]()[_0xca19('0x5f')](char(0x2c))>=0x0||_0x2c35cf[_0xca19('0x5e')]()[_0xca19('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3dd22a){var _0x32683d=char(0x22),_0x53af79='\x5c'+char(0x22),_0x23481d=_0x3dd22a['toString']()[_0xca19('0x60')](new RegExp(_0x32683d,'g'),_0x53af79);return _0x32683d+_0x23481d+_0x32683d;}exports[_0xca19('0x61')]=function(_0x4b2007,_0x235e1e,_0x2865e3){var _0x2fea14,_0x4af3e0;var _0xadccb8={'where':{'ProjectId':_0x4b2007[_0xca19('0x47')]['id']}};if(_0x4b2007['query'][_0xca19('0x62')]){_0xadccb8['where'][_0xca19('0x63')]=JSON[_0xca19('0x64')](_0x4b2007['query'][_0xca19('0x62')]);}return db[_0xca19('0x59')][_0xca19('0x43')](_0xadccb8)[_0xca19('0x26')](handleEntityNotFound(_0x235e1e,null))[_0xca19('0x26')](function(_0x582309){if(_0x582309){_0x2fea14=_0x582309;return db[_0xca19('0x65')][_0xca19('0x43')]({'where':{'SessionId':{'$in':_[_0xca19('0x2e')](_0x2fea14,'id')},'ProjectId':_0x4b2007['params']['id']},'order':_0xca19('0x66')});}})[_0xca19('0x26')](handleEntityNotFound(_0x235e1e,null))[_0xca19('0x26')](function(_0x47d238){if(_0x47d238){_0x4af3e0=_0x47d238;var _0x36fc17={};for(var _0x2c7fa6=0x0,_0x2dcf23=_0x4af3e0[_0xca19('0x37')];_0x2c7fa6<_0x2dcf23;_0x2c7fa6++){if(!_0x36fc17[_0xca19('0x57')](_0x4af3e0[_0x2c7fa6][_0xca19('0x67')])){_0x36fc17[_0x4af3e0[_0x2c7fa6][_0xca19('0x67')]]=needsEncapsulation(_0x4af3e0[_0x2c7fa6][_0xca19('0x68')])?encapsulate(_0x4af3e0[_0x2c7fa6]['question']):_0x4af3e0[_0x2c7fa6]['question'];}}var _0x5d0776=[],_0x304198={};for(var _0x220f52=0x0,_0x30701d=_0x2fea14[_0xca19('0x37')];_0x220f52<_0x30701d;_0x220f52++){_0x304198={'ProjectId':_0x4b2007['params']['id'],'SessionId':_0x2fea14[_0x220f52]['id'],'StartTime':moment(_0x2fea14[_0x220f52]['starttime'])[_0xca19('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x53fa80=0x0,_0x2a7d90=_0x4af3e0[_0xca19('0x37')];_0x53fa80<_0x2a7d90;_0x53fa80++){if(_0x4af3e0[_0x53fa80][_0xca19('0x6a')]==_0x2fea14[_0x220f52]['id']&&_0x36fc17['hasOwnProperty'](_0x4af3e0[_0x53fa80][_0xca19('0x67')])){_0x304198[_0x36fc17[_0x4af3e0[_0x53fa80][_0xca19('0x67')]]]=_0x4af3e0[_0x53fa80][_0xca19('0x6b')];}}for(var _0x3a0df5 in _0x36fc17){if(!_0x304198[_0xca19('0x57')](_0x36fc17[_0x3a0df5])){_0x304198[_0x36fc17[_0x3a0df5]]=null;}}_0x5d0776['push'](_0x304198);}return _0x5d0776;}})['then'](function(_0x173a39){if(!_['isEmpty'](_0x173a39)){var _0x3f0781=toCsv(_0x173a39);var _0x454e98=Date[_0xca19('0x6c')]();fs[_0xca19('0x6d')](util[_0xca19('0x69')](_0xca19('0x6e'),_0x4b2007[_0xca19('0x47')]['id'],_0x454e98),_0x3f0781);_0x235e1e[_0xca19('0x6f')]('Content-disposition',_0xca19('0x70')+util[_0xca19('0x69')](_0xca19('0x71'),_0x4b2007[_0xca19('0x47')]['id'],_0x454e98));_0x235e1e[_0xca19('0x6f')](_0xca19('0x72'),_0xca19('0x73'));return _0x235e1e['download'](util[_0xca19('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4b2007['params']['id'],_0x454e98));}else{return _0x235e1e[_0xca19('0x19')](0xcc);}})[_0xca19('0x45')](handleError(_0x235e1e,null));}; \ No newline at end of file +var _0x1cf6=['order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','length','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','nolimit','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','get','Projects','UserProfileResource','sendStatus','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x375010,_0x34c626){var _0x2690a8=function(_0x330022){while(--_0x330022){_0x375010['push'](_0x375010['shift']());}};_0x2690a8(++_0x34c626);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x4b5bf7,_0xae9467){_0x4b5bf7=_0x4b5bf7-0x0;var _0x52a09b=_0x1cf6[_0x4b5bf7];return _0x52a09b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61cf('0x0'));var zipdir=require(_0x61cf('0x1'));var jsonpatch=require(_0x61cf('0x2'));var rp=require(_0x61cf('0x3'));var moment=require(_0x61cf('0x4'));var BPromise=require(_0x61cf('0x5'));var Mustache=require('mustache');var util=require(_0x61cf('0x6'));var path=require(_0x61cf('0x7'));var sox=require(_0x61cf('0x8'));var csv=require(_0x61cf('0x9'));var ejs=require(_0x61cf('0xa'));var fs=require('fs');var fs_extra=require(_0x61cf('0xb'));var _=require(_0x61cf('0xc'));var squel=require(_0x61cf('0xd'));var crypto=require(_0x61cf('0xe'));var jsforce=require(_0x61cf('0xf'));var deskjs=require(_0x61cf('0x10'));var toCsv=require(_0x61cf('0x9'));var querystring=require(_0x61cf('0x11'));var Papa=require(_0x61cf('0x12'));var Redis=require(_0x61cf('0x13'));var authService=require(_0x61cf('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x61cf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61cf('0x16'))(_0x61cf('0x17'));var utils=require('../../config/utils');var config=require(_0x61cf('0x18'));var licenseUtil=require(_0x61cf('0x19'));var db=require(_0x61cf('0x1a'))['db'];function respondWithStatusCode(_0x18b674,_0x24a4e8){_0x24a4e8=_0x24a4e8||0xcc;return function(_0x54e56f){if(_0x54e56f){return _0x18b674['sendStatus'](_0x24a4e8);}return _0x18b674[_0x61cf('0x1b')](_0x24a4e8)[_0x61cf('0x1c')]();};}function respondWithResult(_0x290dd5,_0x10cbc3){_0x10cbc3=_0x10cbc3||0xc8;return function(_0x2426e5){if(_0x2426e5){return _0x290dd5[_0x61cf('0x1b')](_0x10cbc3)[_0x61cf('0x1d')](_0x2426e5);}};}function respondWithFilteredResult(_0x4cc012,_0x3c3083){return function(_0xd01df5){if(_0xd01df5){var _0x41ad26=typeof _0x3c3083[_0x61cf('0x1e')]===_0x61cf('0x1f')&&typeof _0x3c3083['limit']===_0x61cf('0x1f');var _0x22dc46=_0xd01df5[_0x61cf('0x20')];var _0x36f2d6=_0x41ad26?0x0:_0x3c3083[_0x61cf('0x1e')];var _0x239b91=_0x41ad26?_0xd01df5[_0x61cf('0x20')]:_0x3c3083['offset']+_0x3c3083['limit'];var _0x2908b0;if(_0x239b91>=_0x22dc46){_0x239b91=_0x22dc46;_0x2908b0=0xc8;}else{_0x2908b0=0xce;}_0x4cc012[_0x61cf('0x1b')](_0x2908b0);return _0x4cc012['set'](_0x61cf('0x21'),_0x36f2d6+'-'+_0x239b91+'/'+_0x22dc46)['json'](_0xd01df5);}return null;};}function patchUpdates(_0x508617){return function(_0x2f4314){try{jsonpatch[_0x61cf('0x22')](_0x2f4314,_0x508617,!![]);}catch(_0x59f0f9){return BPromise['reject'](_0x59f0f9);}return _0x2f4314[_0x61cf('0x23')]();};}function saveUpdates(_0x59b50f,_0x320042){return function(_0x58b6f5){if(_0x58b6f5){return _0x58b6f5['update'](_0x59b50f)[_0x61cf('0x24')](function(_0xf1fa7d){return _0xf1fa7d;});}return null;};}function removeEntity(_0x44eb29,_0x2f9d2b){return function(_0x469a90){if(_0x469a90){return _0x469a90[_0x61cf('0x25')]()['then'](function(){var _0x540c70=_0x469a90[_0x61cf('0x26')]({'plain':!![]});var _0x3916e6=_0x61cf('0x27');return db[_0x61cf('0x28')]['destroy']({'where':{'type':_0x3916e6,'resourceId':_0x540c70['id']}})[_0x61cf('0x24')](function(){return _0x469a90;});})[_0x61cf('0x24')](function(){_0x44eb29[_0x61cf('0x1b')](0xcc)[_0x61cf('0x1c')]();});}};}function handleEntityNotFound(_0x533aa1,_0x5603ad){return function(_0x2e2df3){if(!_0x2e2df3){_0x533aa1[_0x61cf('0x29')](0x194);}return _0x2e2df3;};}function handleError(_0x27a132,_0x16c3d1){_0x16c3d1=_0x16c3d1||0x1f4;return function(_0x5368ba){logger['error'](_0x5368ba['stack']);if(_0x5368ba['name']){delete _0x5368ba[_0x61cf('0x2a')];}_0x27a132[_0x61cf('0x1b')](_0x16c3d1)[_0x61cf('0x2b')](_0x5368ba);};}exports[_0x61cf('0x2c')]=function(_0x51343c,_0x23d0ee){var _0x3188d3={},_0x133e9f={},_0x533fe6={'count':0x0,'rows':[]};var _0x21edb3=_[_0x61cf('0x2d')](db[_0x61cf('0x2e')][_0x61cf('0x2f')],function(_0x5efb8a){return{'name':_0x5efb8a[_0x61cf('0x30')],'type':_0x5efb8a[_0x61cf('0x31')][_0x61cf('0x32')]};});_0x133e9f[_0x61cf('0x33')]=_[_0x61cf('0x2d')](_0x21edb3,_0x61cf('0x2a'));_0x133e9f[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x51343c['query']);_0x133e9f[_0x61cf('0x36')]=_[_0x61cf('0x37')](_0x133e9f[_0x61cf('0x33')],_0x133e9f[_0x61cf('0x34')]);_0x3188d3[_0x61cf('0x38')]=_[_0x61cf('0x37')](_0x133e9f['model'],qs[_0x61cf('0x39')](_0x51343c[_0x61cf('0x34')]['fields']));_0x3188d3[_0x61cf('0x38')]=_0x3188d3['attributes']['length']?_0x3188d3['attributes']:_0x133e9f[_0x61cf('0x33')];if(!_0x51343c[_0x61cf('0x34')][_0x61cf('0x3a')]('nolimit')){_0x3188d3[_0x61cf('0x3b')]=qs[_0x61cf('0x3b')](_0x51343c['query'][_0x61cf('0x3b')]);_0x3188d3[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x51343c[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x3188d3[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x51343c[_0x61cf('0x34')]['sort']);_0x3188d3['where']=qs['filters'](_['pick'](_0x51343c[_0x61cf('0x34')],_0x133e9f[_0x61cf('0x36')]),_0x21edb3);if(_0x51343c['query'][_0x61cf('0x3e')]){_0x3188d3[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x3188d3[_0x61cf('0x3f')],{'$or':_[_0x61cf('0x2d')](_0x21edb3,function(_0xd99df8){if(_0xd99df8[_0x61cf('0x31')]!==_0x61cf('0x41')){var _0x364899={};_0x364899[_0xd99df8[_0x61cf('0x2a')]]={'$like':'%'+_0x51343c[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x364899;}})});}_0x3188d3=_[_0x61cf('0x40')]({},_0x3188d3,_0x51343c[_0x61cf('0x42')]);var _0x31922a={'where':_0x3188d3[_0x61cf('0x3f')]};return db[_0x61cf('0x2e')][_0x61cf('0x20')](_0x31922a)[_0x61cf('0x24')](function(_0x2e6002){_0x533fe6['count']=_0x2e6002;if(_0x51343c[_0x61cf('0x34')][_0x61cf('0x43')]){_0x3188d3[_0x61cf('0x44')]=[{'all':!![]}];}return db[_0x61cf('0x2e')][_0x61cf('0x45')](_0x3188d3);})[_0x61cf('0x24')](function(_0x1be7a2){_0x533fe6[_0x61cf('0x46')]=_0x1be7a2;return _0x533fe6;})[_0x61cf('0x24')](respondWithFilteredResult(_0x23d0ee,_0x3188d3))[_0x61cf('0x47')](handleError(_0x23d0ee,null));};exports[_0x61cf('0x48')]=function(_0x100442,_0x489766){var _0x2c2d00={'raw':![],'where':{'id':_0x100442['params']['id']}},_0x49497e={};_0x49497e['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x49497e[_0x61cf('0x34')]=_['keys'](_0x100442['query']);_0x49497e['filters']=_[_0x61cf('0x37')](_0x49497e[_0x61cf('0x33')],_0x49497e[_0x61cf('0x34')]);_0x2c2d00[_0x61cf('0x38')]=_['intersection'](_0x49497e['model'],qs[_0x61cf('0x39')](_0x100442[_0x61cf('0x34')]['fields']));_0x2c2d00['attributes']=_0x2c2d00[_0x61cf('0x38')]['length']?_0x2c2d00[_0x61cf('0x38')]:_0x49497e[_0x61cf('0x33')];if(_0x100442['query']['includeAll']){_0x2c2d00['include']=[{'all':!![]}];}_0x2c2d00=_[_0x61cf('0x40')]({},_0x2c2d00,_0x100442[_0x61cf('0x42')]);return db[_0x61cf('0x2e')]['find'](_0x2c2d00)['then'](handleEntityNotFound(_0x489766,null))['then'](respondWithResult(_0x489766,null))['catch'](handleError(_0x489766,null));};exports['create']=function(_0x228c53,_0x53421b){return db[_0x61cf('0x2e')][_0x61cf('0x49')](_0x228c53[_0x61cf('0x4a')],{})[_0x61cf('0x24')](function(_0x22610f){var _0x5523fa=_0x228c53[_0x61cf('0x4b')][_0x61cf('0x26')]({'plain':!![]});if(!_0x5523fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5523fa[_0x61cf('0x4c')]===_0x61cf('0x4b')){var _0xb0ef60=_0x22610f[_0x61cf('0x26')]({'plain':!![]});var _0x2e741f=_0x61cf('0x27');return db[_0x61cf('0x4d')]['find']({'where':{'name':_0x2e741f,'userProfileId':_0x5523fa[_0x61cf('0x4e')]},'raw':!![]})[_0x61cf('0x24')](function(_0x4707d8){if(_0x4707d8&&_0x4707d8[_0x61cf('0x4f')]===0x0){return db[_0x61cf('0x28')][_0x61cf('0x49')]({'name':_0xb0ef60[_0x61cf('0x2a')],'resourceId':_0xb0ef60['id'],'type':_0x4707d8['name'],'sectionId':_0x4707d8['id']},{})[_0x61cf('0x24')](function(){return _0x22610f;});}else{return _0x22610f;}})['catch'](function(_0x20a960){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20a960);throw _0x20a960;});}return _0x22610f;})[_0x61cf('0x24')](respondWithResult(_0x53421b,0xc9))[_0x61cf('0x47')](handleError(_0x53421b,null));};exports[_0x61cf('0x50')]=function(_0x1ecf2e,_0x59dc29){var _0x3b39f2={'where':{'id':_0x1ecf2e[_0x61cf('0x51')]['id']}},_0x3d3942={};_0x3d3942[_0x61cf('0x33')]=_[_0x61cf('0x35')](db[_0x61cf('0x2e')][_0x61cf('0x2f')]);_0x3b39f2['attributes']=_[_0x61cf('0x37')](_0x3d3942[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x1ecf2e[_0x61cf('0x34')]['fields']));_0x3b39f2[_0x61cf('0x38')]=_0x3b39f2[_0x61cf('0x38')][_0x61cf('0x52')]?_0x3b39f2[_0x61cf('0x38')]:_0x3d3942[_0x61cf('0x33')];if(_0x1ecf2e['query']['includeAll']){_0x3b39f2[_0x61cf('0x44')]=[{'all':!![]}];}_0x3b39f2=_[_0x61cf('0x40')]({},_0x3b39f2,_0x1ecf2e[_0x61cf('0x42')]);return db[_0x61cf('0x2e')][_0x61cf('0x53')](_0x3b39f2)[_0x61cf('0x24')](handleEntityNotFound(_0x59dc29,null))[_0x61cf('0x24')](function(_0x5a6a45){if(_0x5a6a45){var _0x4cdcbe=_0x5a6a45[_0x61cf('0x26')]({'plain':!![]});_0x4cdcbe=qs[_0x61cf('0x54')](_0x4cdcbe,['id',_0x61cf('0x55'),_0x61cf('0x56')]);_0x1ecf2e['body']=_[_0x61cf('0x54')](_0x1ecf2e['body'],['id','createdAt','updatedAt']);return db[_0x61cf('0x2e')][_0x61cf('0x49')](_[_0x61cf('0x40')](_0x4cdcbe,_0x1ecf2e[_0x61cf('0x4a')]),{'include':_0x1ecf2e[_0x61cf('0x34')][_0x61cf('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x368171){var _0x21ee4b=_0x1ecf2e[_0x61cf('0x4b')][_0x61cf('0x26')]({'plain':!![]});if(!_0x21ee4b)throw new Error(_0x61cf('0x57'));if(_0x21ee4b[_0x61cf('0x4c')]===_0x61cf('0x4b')){var _0xd63b69=_0x368171[_0x61cf('0x26')]({'plain':!![]});var _0x107bd8='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x107bd8,'userProfileId':_0x21ee4b[_0x61cf('0x4e')]},'raw':!![]})['then'](function(_0x56c006){if(_0x56c006&&_0x56c006[_0x61cf('0x4f')]===0x0){return db[_0x61cf('0x28')]['create']({'name':_0xd63b69[_0x61cf('0x2a')],'resourceId':_0xd63b69['id'],'type':_0x56c006[_0x61cf('0x2a')],'sectionId':_0x56c006['id']},{})['then'](function(){return _0x368171;});}else{return _0x368171;}})[_0x61cf('0x47')](function(_0x2cd425){logger[_0x61cf('0x58')](_0x61cf('0x59'),_0x2cd425);throw _0x2cd425;});}return _0x368171;});}})['then'](respondWithResult(_0x59dc29,0xc9))[_0x61cf('0x47')](handleError(_0x59dc29,null));};exports[_0x61cf('0x5a')]=function(_0x429609,_0x2afeee){if(_0x429609[_0x61cf('0x4a')]['id']){delete _0x429609[_0x61cf('0x4a')]['id'];}return db[_0x61cf('0x2e')][_0x61cf('0x53')]({'where':{'id':_0x429609['params']['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x2afeee,null))['then'](saveUpdates(_0x429609[_0x61cf('0x4a')],null))[_0x61cf('0x24')](respondWithResult(_0x2afeee,null))[_0x61cf('0x47')](handleError(_0x2afeee,null));};exports['destroy']=function(_0x1d6740,_0x5ce912){return db['JscriptyProject'][_0x61cf('0x53')]({'where':{'id':_0x1d6740[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x5ce912,null))['then'](removeEntity(_0x5ce912,null))['catch'](handleError(_0x5ce912,null));};exports[_0x61cf('0x5b')]=function(_0x537390,_0x6a66c2,_0x21bbbf){var _0x16d00e={'raw':!![],'where':{}};var _0x21fb59={};var _0x4b01c0={'count':0x0,'rows':[]};return db[_0x61cf('0x2e')][_0x61cf('0x5c')]({'where':{'id':_0x537390[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x6a66c2,null))[_0x61cf('0x24')](function(_0x293d5d){if(_0x293d5d){_0x21fb59[_0x61cf('0x33')]=_['keys'](db[_0x61cf('0x5d')][_0x61cf('0x2f')]);_0x21fb59[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x537390[_0x61cf('0x34')]);_0x21fb59[_0x61cf('0x36')]=_['intersection'](_0x21fb59[_0x61cf('0x33')],_0x21fb59[_0x61cf('0x34')]);_0x16d00e['attributes']=_[_0x61cf('0x37')](_0x21fb59[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x537390[_0x61cf('0x34')][_0x61cf('0x39')]));_0x16d00e['attributes']=_0x16d00e['attributes'][_0x61cf('0x52')]?_0x16d00e[_0x61cf('0x38')]:_0x21fb59[_0x61cf('0x33')];if(!_0x537390[_0x61cf('0x34')][_0x61cf('0x3a')](_0x61cf('0x5e'))){_0x16d00e[_0x61cf('0x3b')]=qs['limit'](_0x537390[_0x61cf('0x34')][_0x61cf('0x3b')]);_0x16d00e[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x537390[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x16d00e[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x537390[_0x61cf('0x34')]['sort']);_0x16d00e['where']=qs[_0x61cf('0x36')](_[_0x61cf('0x5f')](_0x537390[_0x61cf('0x34')],_0x21fb59[_0x61cf('0x36')]));_0x16d00e[_0x61cf('0x3f')][_0x61cf('0x60')]=_0x293d5d['id'];if(_0x537390[_0x61cf('0x34')][_0x61cf('0x3e')]){_0x16d00e[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x16d00e[_0x61cf('0x3f')],{'$or':_[_0x61cf('0x2d')](_0x16d00e[_0x61cf('0x38')],function(_0x466860){var _0x5490c4={};_0x5490c4[_0x466860]={'$like':'%'+_0x537390[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x5490c4;})});}_0x16d00e=_[_0x61cf('0x40')]({},_0x16d00e,_0x537390[_0x61cf('0x42')]);return db[_0x61cf('0x5d')][_0x61cf('0x20')]({'where':_0x16d00e[_0x61cf('0x3f')]})['then'](function(_0x53db34){_0x4b01c0[_0x61cf('0x20')]=_0x53db34;if(_0x537390[_0x61cf('0x34')]['includeAll']){_0x16d00e['include']=[{'all':!![]}];}return db[_0x61cf('0x5d')]['findAll'](_0x16d00e);})[_0x61cf('0x24')](function(_0x23a9fe){_0x4b01c0[_0x61cf('0x46')]=_0x23a9fe;return _0x4b01c0;});}})['then'](respondWithFilteredResult(_0x6a66c2,_0x16d00e))['catch'](handleError(_0x6a66c2,null));};exports[_0x61cf('0x61')]=function(_0x5af841,_0x4e71cf,_0x5b85da){var _0x21dfa2={'raw':!![],'where':{}};var _0x45cfb9={};var _0x11b112={'count':0x0,'rows':[]};return db[_0x61cf('0x2e')][_0x61cf('0x5c')]({'where':{'id':_0x5af841[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x4e71cf,null))[_0x61cf('0x24')](function(_0x19574a){if(_0x19574a){_0x45cfb9[_0x61cf('0x33')]=_[_0x61cf('0x35')](db[_0x61cf('0x62')][_0x61cf('0x2f')]);_0x45cfb9[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x5af841[_0x61cf('0x34')]);_0x45cfb9[_0x61cf('0x36')]=_[_0x61cf('0x37')](_0x45cfb9[_0x61cf('0x33')],_0x45cfb9[_0x61cf('0x34')]);_0x21dfa2[_0x61cf('0x38')]=_[_0x61cf('0x37')](_0x45cfb9[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x5af841[_0x61cf('0x34')]['fields']));_0x21dfa2[_0x61cf('0x38')]=_0x21dfa2[_0x61cf('0x38')][_0x61cf('0x52')]?_0x21dfa2[_0x61cf('0x38')]:_0x45cfb9[_0x61cf('0x33')];if(!_0x5af841[_0x61cf('0x34')][_0x61cf('0x3a')](_0x61cf('0x5e'))){_0x21dfa2[_0x61cf('0x3b')]=qs[_0x61cf('0x3b')](_0x5af841[_0x61cf('0x34')]['limit']);_0x21dfa2[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x5af841[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x21dfa2[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x5af841[_0x61cf('0x34')]['sort']);_0x21dfa2[_0x61cf('0x3f')]=qs[_0x61cf('0x36')](_[_0x61cf('0x5f')](_0x5af841[_0x61cf('0x34')],_0x45cfb9[_0x61cf('0x36')]));_0x21dfa2[_0x61cf('0x3f')][_0x61cf('0x60')]=_0x19574a['id'];if(_0x5af841[_0x61cf('0x34')][_0x61cf('0x3e')]){_0x21dfa2[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x21dfa2['where'],{'$or':_[_0x61cf('0x2d')](_0x21dfa2[_0x61cf('0x38')],function(_0x364cc3){var _0x22e414={};_0x22e414[_0x364cc3]={'$like':'%'+_0x5af841[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x22e414;})});}_0x21dfa2=_[_0x61cf('0x40')]({},_0x21dfa2,_0x5af841[_0x61cf('0x42')]);return db['JscriptyAnswerReport'][_0x61cf('0x20')]({'where':_0x21dfa2['where']})[_0x61cf('0x24')](function(_0x102c9d){_0x11b112[_0x61cf('0x20')]=_0x102c9d;if(_0x5af841[_0x61cf('0x34')]['includeAll']){_0x21dfa2[_0x61cf('0x44')]=[{'all':!![]}];}return db[_0x61cf('0x62')][_0x61cf('0x45')](_0x21dfa2);})[_0x61cf('0x24')](function(_0x3769c4){_0x11b112[_0x61cf('0x46')]=_0x3769c4;return _0x11b112;});}})['then'](respondWithFilteredResult(_0x4e71cf,_0x21dfa2))['catch'](handleError(_0x4e71cf,null));};function char(_0x1b3700){return _0x61cf('0x63')===typeof _0x1b3700?String[_0x61cf('0x64')]['apply'](null,arguments):_0x1b3700;}function needsEncapsulation(_0x1012dd){return!!_0x1012dd&&(_0x1012dd[_0x61cf('0x65')]()[_0x61cf('0x66')](char(0xd))>=0x0||_0x1012dd[_0x61cf('0x65')]()['indexOf'](char(0xa))>=0x0||_0x1012dd['toString']()[_0x61cf('0x66')](char(0x2c))>=0x0||_0x1012dd[_0x61cf('0x65')]()[_0x61cf('0x66')](char(0x22))>=0x0);}function encapsulate(_0x5cf19e){var _0x538c23=char(0x22),_0x42ef1e='\x5c'+char(0x22),_0x33d6f6=_0x5cf19e[_0x61cf('0x65')]()[_0x61cf('0x67')](new RegExp(_0x538c23,'g'),_0x42ef1e);return _0x538c23+_0x33d6f6+_0x538c23;}exports[_0x61cf('0x68')]=function(_0xcdd286,_0x3726f6,_0x5cf579){var _0x4e7958,_0x2a363d;var _0x17cd6d={'where':{'ProjectId':_0xcdd286[_0x61cf('0x51')]['id']}};if(_0xcdd286[_0x61cf('0x34')][_0x61cf('0x69')]){_0x17cd6d['where'][_0x61cf('0x6a')]=JSON['parse'](_0xcdd286[_0x61cf('0x34')]['startTime']);}return db['JscriptySessionReport'][_0x61cf('0x45')](_0x17cd6d)[_0x61cf('0x24')](handleEntityNotFound(_0x3726f6,null))[_0x61cf('0x24')](function(_0x5cdb66){if(_0x5cdb66){_0x4e7958=_0x5cdb66;return db[_0x61cf('0x6b')][_0x61cf('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x4e7958,'id')},'ProjectId':_0xcdd286[_0x61cf('0x51')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x3726f6,null))[_0x61cf('0x24')](function(_0x45a5b7){if(_0x45a5b7){_0x2a363d=_0x45a5b7;var _0x111fef={};for(var _0xfe212e=0x0,_0x477932=_0x2a363d['length'];_0xfe212e<_0x477932;_0xfe212e++){if(!_0x111fef[_0x61cf('0x3a')](_0x2a363d[_0xfe212e][_0x61cf('0x6c')])){_0x111fef[_0x2a363d[_0xfe212e][_0x61cf('0x6c')]]=needsEncapsulation(_0x2a363d[_0xfe212e]['question'])?encapsulate(_0x2a363d[_0xfe212e]['question']):_0x2a363d[_0xfe212e]['question'];}}var _0x3b63a0=[],_0x53b9a0={};for(var _0x5e1fea=0x0,_0x5383ad=_0x4e7958[_0x61cf('0x52')];_0x5e1fea<_0x5383ad;_0x5e1fea++){_0x53b9a0={'ProjectId':_0xcdd286[_0x61cf('0x51')]['id'],'SessionId':_0x4e7958[_0x5e1fea]['id'],'StartTime':moment(_0x4e7958[_0x5e1fea][_0x61cf('0x6a')])[_0x61cf('0x6d')](_0x61cf('0x6e'))};for(var _0x404baa=0x0,_0x5ce7b4=_0x2a363d[_0x61cf('0x52')];_0x404baa<_0x5ce7b4;_0x404baa++){if(_0x2a363d[_0x404baa]['SessionId']==_0x4e7958[_0x5e1fea]['id']&&_0x111fef[_0x61cf('0x3a')](_0x2a363d[_0x404baa][_0x61cf('0x6c')])){_0x53b9a0[_0x111fef[_0x2a363d[_0x404baa][_0x61cf('0x6c')]]]=_0x2a363d[_0x404baa]['answer'];}}for(var _0x3027d2 in _0x111fef){if(!_0x53b9a0[_0x61cf('0x3a')](_0x111fef[_0x3027d2])){_0x53b9a0[_0x111fef[_0x3027d2]]=null;}}_0x3b63a0[_0x61cf('0x6f')](_0x53b9a0);}return _0x3b63a0;}})[_0x61cf('0x24')](function(_0x4e6802){if(!_[_0x61cf('0x70')](_0x4e6802)){var _0x8184ef=toCsv(_0x4e6802);var _0x2c1466=Date[_0x61cf('0x71')]();fs[_0x61cf('0x72')](util['format'](_0x61cf('0x73'),_0xcdd286[_0x61cf('0x51')]['id'],_0x2c1466),_0x8184ef);_0x3726f6['setHeader'](_0x61cf('0x74'),'attachment;\x20filename='+util[_0x61cf('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0xcdd286[_0x61cf('0x51')]['id'],_0x2c1466));_0x3726f6[_0x61cf('0x75')]('Content-type',_0x61cf('0x76'));return _0x3726f6[_0x61cf('0x77')](util[_0x61cf('0x6d')](_0x61cf('0x73'),_0xcdd286['params']['id'],_0x2c1466));}else{return _0x3726f6[_0x61cf('0x29')](0xcc);}})[_0x61cf('0x47')](handleError(_0x3726f6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index d7c2462..cc195a1 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 _0x5c91=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','lodash','util','../../config/logger'];(function(_0x283fea,_0x59a81e){var _0x12c518=function(_0x149535){while(--_0x149535){_0x283fea['push'](_0x283fea['shift']());}};_0x12c518(++_0x59a81e);}(_0x5c91,0x1e9));var _0x15c9=function(_0x53864d,_0x4c307d){_0x53864d=_0x53864d-0x0;var _0x2e022d=_0x5c91[_0x53864d];return _0x2e022d;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var logger=require(_0x15c9('0x2'))('api');var moment=require(_0x15c9('0x3'));var BPromise=require(_0x15c9('0x4'));var rp=require(_0x15c9('0x5'));var fs=require('fs');var path=require(_0x15c9('0x6'));var rimraf=require(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x15c9('0x9')]=function(_0x216469,_0x1ce11a){return _0x216469[_0x15c9('0xa')](_0x15c9('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2208=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x2740ae,_0x40ddda){var _0x3a640c=function(_0x2a29e6){while(--_0x2a29e6){_0x2740ae['push'](_0x2740ae['shift']());}};_0x3a640c(++_0x40ddda);}(_0x2208,0x11e));var _0x8220=function(_0x182256,_0x181956){_0x182256=_0x182256-0x0;var _0x1b9cfd=_0x2208[_0x182256];return _0x1b9cfd;};'use strict';var _=require('lodash');var util=require(_0x8220('0x0'));var logger=require('../../config/logger')(_0x8220('0x1'));var moment=require('moment');var BPromise=require(_0x8220('0x2'));var rp=require(_0x8220('0x3'));var fs=require('fs');var path=require(_0x8220('0x4'));var rimraf=require(_0x8220('0x5'));var config=require(_0x8220('0x6'));var attributes=require(_0x8220('0x7'));module['exports']=function(_0x31a112,_0x4dd1a0){return _0x31a112[_0x8220('0x8')](_0x8220('0x9'),attributes,{'tableName':_0x8220('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 1104c52..99efa58 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3b23e1,_0x472631){var _0xc04fd6=function(_0xb12422){while(--_0xb12422){_0x3b23e1['push'](_0x3b23e1['shift']());}};_0xc04fd6(++_0x472631);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xaa88[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xda3f,0xec));var _0xfda3=function(_0x267858,_0x1268dc){_0x267858=_0x267858-0x0;var _0x580259=_0xda3f[_0x267858];return _0x580259;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6545748..28b64c0 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 _0x4229=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x3a1697,_0x17260d){var _0xffb33d=function(_0xa75564){while(--_0xa75564){_0x3a1697['push'](_0x3a1697['shift']());}};_0xffb33d(++_0x17260d);}(_0x4229,0xab));var _0x9422=function(_0x5abe5c,_0x4f05f1){_0x5abe5c=_0x5abe5c-0x0;var _0x5b72f2=_0x4229[_0x5abe5c];return _0x5b72f2;};'use strict';var multer=require(_0x9422('0x0'));var util=require(_0x9422('0x1'));var path=require(_0x9422('0x2'));var timeout=require('connect-timeout');var express=require(_0x9422('0x3'));var router=express[_0x9422('0x4')]();var fs_extra=require(_0x9422('0x5'));var auth=require(_0x9422('0x6'));var interaction=require(_0x9422('0x7'));var config=require(_0x9422('0x8'));var controller=require(_0x9422('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9422('0xa')]);router[_0x9422('0xb')](_0x9422('0xc'),auth[_0x9422('0xd')](),controller[_0x9422('0xe')]);router[_0x9422('0xb')](_0x9422('0xf'),auth[_0x9422('0xd')](),controller[_0x9422('0x10')]);router[_0x9422('0x11')]('/',auth['isAuthenticated'](),controller[_0x9422('0x12')]);router[_0x9422('0x13')]('/:id',auth[_0x9422('0xd')](),controller[_0x9422('0x14')]);router[_0x9422('0x15')]('/:id',auth[_0x9422('0xd')](),controller[_0x9422('0x16')]);module[_0x9422('0x17')]=router; \ No newline at end of file +var _0x0a00=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','/:id','show','post','create','update','destroy'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x0a00,0x105));var _0x00a0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x0a00[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x00a0('0x0'));var util=require(_0x00a0('0x1'));var path=require(_0x00a0('0x2'));var timeout=require(_0x00a0('0x3'));var express=require(_0x00a0('0x4'));var router=express[_0x00a0('0x5')]();var fs_extra=require(_0x00a0('0x6'));var auth=require(_0x00a0('0x7'));var interaction=require(_0x00a0('0x8'));var config=require('../../config/environment');var controller=require(_0x00a0('0x9'));router[_0x00a0('0xa')]('/',auth['isAuthenticated'](),controller[_0x00a0('0xb')]);router[_0x00a0('0xa')]('/describe',auth[_0x00a0('0xc')](),controller['describe']);router[_0x00a0('0xa')](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0xe')]);router[_0x00a0('0xf')]('/',auth[_0x00a0('0xc')](),controller[_0x00a0('0x10')]);router['put'](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0x11')]);router['delete'](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0x12')]);module[_0x00a0('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 5f891b2..fb73c57 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0xf80339,_0x2897b9){_0xf80339=_0xf80339-0x0;var _0x18abb6=_0x7a54[_0xf80339];return _0x18abb6;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xc82342,_0x5837bd){_0xc82342=_0xc82342-0x0;var _0x2f73e4=_0x7a54[_0xc82342];return _0x2f73e4;};'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 d3ba352..5c3f440 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 _0xe23b=['merge','type','JscriptyQuestionReport','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','fieldName','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','where','pick'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xe23b,0x181));var _0xbe23=function(_0x36bc8c,_0x470cfd){_0x36bc8c=_0x36bc8c-0x0;var _0x262fb1=_0xe23b[_0x36bc8c];return _0x262fb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe23('0x0'));var zipdir=require(_0xbe23('0x1'));var jsonpatch=require(_0xbe23('0x2'));var rp=require(_0xbe23('0x3'));var moment=require('moment');var BPromise=require(_0xbe23('0x4'));var Mustache=require(_0xbe23('0x5'));var util=require(_0xbe23('0x6'));var path=require(_0xbe23('0x7'));var sox=require(_0xbe23('0x8'));var csv=require(_0xbe23('0x9'));var ejs=require(_0xbe23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbe23('0xb'));var crypto=require(_0xbe23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe23('0xd'));var toCsv=require(_0xbe23('0x9'));var querystring=require(_0xbe23('0xe'));var Papa=require(_0xbe23('0xf'));var Redis=require(_0xbe23('0x10'));var authService=require(_0xbe23('0x11'));var qs=require(_0xbe23('0x12'));var as=require(_0xbe23('0x13'));var hardwareService=require(_0xbe23('0x14'));var logger=require('../../config/logger')(_0xbe23('0x15'));var utils=require(_0xbe23('0x16'));var config=require(_0xbe23('0x17'));var licenseUtil=require(_0xbe23('0x18'));var db=require(_0xbe23('0x19'))['db'];function respondWithStatusCode(_0x25b636,_0x14d293){_0x14d293=_0x14d293||0xcc;return function(_0x4bad51){if(_0x4bad51){return _0x25b636[_0xbe23('0x1a')](_0x14d293);}return _0x25b636[_0xbe23('0x1b')](_0x14d293)['end']();};}function respondWithResult(_0x103ca2,_0x12a4aa){_0x12a4aa=_0x12a4aa||0xc8;return function(_0x5e91d1){if(_0x5e91d1){return _0x103ca2[_0xbe23('0x1b')](_0x12a4aa)[_0xbe23('0x1c')](_0x5e91d1);}};}function respondWithFilteredResult(_0x5ae51a,_0x211e6b){return function(_0x40bee3){if(_0x40bee3){var _0x5b8556=typeof _0x211e6b[_0xbe23('0x1d')]==='undefined'&&typeof _0x211e6b[_0xbe23('0x1e')]===_0xbe23('0x1f');var _0x511f04=_0x40bee3[_0xbe23('0x20')];var _0x1e8ffc=_0x5b8556?0x0:_0x211e6b[_0xbe23('0x1d')];var _0x4d39d4=_0x5b8556?_0x40bee3[_0xbe23('0x20')]:_0x211e6b['offset']+_0x211e6b[_0xbe23('0x1e')];var _0x8471e;if(_0x4d39d4>=_0x511f04){_0x4d39d4=_0x511f04;_0x8471e=0xc8;}else{_0x8471e=0xce;}_0x5ae51a[_0xbe23('0x1b')](_0x8471e);return _0x5ae51a['set'](_0xbe23('0x21'),_0x1e8ffc+'-'+_0x4d39d4+'/'+_0x511f04)[_0xbe23('0x1c')](_0x40bee3);}return null;};}function patchUpdates(_0x2d83bf){return function(_0x5b5c28){try{jsonpatch[_0xbe23('0x22')](_0x5b5c28,_0x2d83bf,!![]);}catch(_0x58c14a){return BPromise[_0xbe23('0x23')](_0x58c14a);}return _0x5b5c28[_0xbe23('0x24')]();};}function saveUpdates(_0xc9a7a9,_0x491e54){return function(_0x495df7){if(_0x495df7){return _0x495df7[_0xbe23('0x25')](_0xc9a7a9)[_0xbe23('0x26')](function(_0x5179f4){return _0x5179f4;});}return null;};}function removeEntity(_0x3cb25c,_0x24999d){return function(_0x588496){if(_0x588496){return _0x588496[_0xbe23('0x27')]()[_0xbe23('0x26')](function(){_0x3cb25c[_0xbe23('0x1b')](0xcc)[_0xbe23('0x28')]();});}};}function handleEntityNotFound(_0xd8dfa8,_0xb481be){return function(_0x4d59a4){if(!_0x4d59a4){_0xd8dfa8[_0xbe23('0x1a')](0x194);}return _0x4d59a4;};}function handleError(_0x28d96c,_0x2a7d7d){_0x2a7d7d=_0x2a7d7d||0x1f4;return function(_0x545077){logger[_0xbe23('0x29')](_0x545077[_0xbe23('0x2a')]);if(_0x545077[_0xbe23('0x2b')]){delete _0x545077['name'];}_0x28d96c[_0xbe23('0x1b')](_0x2a7d7d)[_0xbe23('0x2c')](_0x545077);};}exports[_0xbe23('0x2d')]=function(_0x46198c,_0x366ecc){var _0x2db9f0={},_0x4fac0d={},_0x10f825={'count':0x0,'rows':[]};var _0x3089ce=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x2b245a){return{'name':_0x2b245a[_0xbe23('0x2e')],'type':_0x2b245a['type']['key']};});_0x4fac0d[_0xbe23('0x2f')]=_[_0xbe23('0x30')](_0x3089ce,'name');_0x4fac0d[_0xbe23('0x31')]=_[_0xbe23('0x32')](_0x46198c[_0xbe23('0x31')]);_0x4fac0d[_0xbe23('0x33')]=_['intersection'](_0x4fac0d[_0xbe23('0x2f')],_0x4fac0d['query']);_0x2db9f0[_0xbe23('0x34')]=_[_0xbe23('0x35')](_0x4fac0d[_0xbe23('0x2f')],qs[_0xbe23('0x36')](_0x46198c[_0xbe23('0x31')][_0xbe23('0x36')]));_0x2db9f0[_0xbe23('0x34')]=_0x2db9f0[_0xbe23('0x34')]['length']?_0x2db9f0['attributes']:_0x4fac0d['model'];if(!_0x46198c[_0xbe23('0x31')]['hasOwnProperty'](_0xbe23('0x37'))){_0x2db9f0[_0xbe23('0x1e')]=qs[_0xbe23('0x1e')](_0x46198c[_0xbe23('0x31')][_0xbe23('0x1e')]);_0x2db9f0[_0xbe23('0x1d')]=qs[_0xbe23('0x1d')](_0x46198c['query'][_0xbe23('0x1d')]);}_0x2db9f0[_0xbe23('0x38')]=qs['sort'](_0x46198c[_0xbe23('0x31')]['sort']);_0x2db9f0[_0xbe23('0x39')]=qs[_0xbe23('0x33')](_[_0xbe23('0x3a')](_0x46198c[_0xbe23('0x31')],_0x4fac0d['filters']),_0x3089ce);if(_0x46198c[_0xbe23('0x31')]['filter']){_0x2db9f0[_0xbe23('0x39')]=_[_0xbe23('0x3b')](_0x2db9f0[_0xbe23('0x39')],{'$or':_['map'](_0x3089ce,function(_0x4eeffb){if(_0x4eeffb[_0xbe23('0x3c')]!=='VIRTUAL'){var _0x26053a={};_0x26053a[_0x4eeffb[_0xbe23('0x2b')]]={'$like':'%'+_0x46198c[_0xbe23('0x31')]['filter']+'%'};return _0x26053a;}})});}_0x2db9f0=_[_0xbe23('0x3b')]({},_0x2db9f0,_0x46198c['options']);var _0x4c6e27={'where':_0x2db9f0[_0xbe23('0x39')]};return db[_0xbe23('0x3d')][_0xbe23('0x20')](_0x4c6e27)[_0xbe23('0x26')](function(_0x313e97){_0x10f825['count']=_0x313e97;if(_0x46198c[_0xbe23('0x31')]['includeAll']){_0x2db9f0[_0xbe23('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbe23('0x3f')](_0x2db9f0);})['then'](function(_0x5f0bb7){_0x10f825[_0xbe23('0x40')]=_0x5f0bb7;return _0x10f825;})[_0xbe23('0x26')](respondWithFilteredResult(_0x366ecc,_0x2db9f0))[_0xbe23('0x41')](handleError(_0x366ecc,null));};exports['show']=function(_0x26b3f0,_0x1b659a){var _0x246cf9={'raw':!![],'where':{'id':_0x26b3f0[_0xbe23('0x42')]['id']}},_0x5b3291={};_0x5b3291['model']=_['keys'](db[_0xbe23('0x3d')][_0xbe23('0x43')]);_0x5b3291[_0xbe23('0x31')]=_[_0xbe23('0x32')](_0x26b3f0['query']);_0x5b3291[_0xbe23('0x33')]=_[_0xbe23('0x35')](_0x5b3291['model'],_0x5b3291[_0xbe23('0x31')]);_0x246cf9[_0xbe23('0x34')]=_[_0xbe23('0x35')](_0x5b3291[_0xbe23('0x2f')],qs['fields'](_0x26b3f0[_0xbe23('0x31')][_0xbe23('0x36')]));_0x246cf9['attributes']=_0x246cf9[_0xbe23('0x34')][_0xbe23('0x44')]?_0x246cf9['attributes']:_0x5b3291[_0xbe23('0x2f')];if(_0x26b3f0[_0xbe23('0x31')]['includeAll']){_0x246cf9['include']=[{'all':!![]}];}_0x246cf9=_[_0xbe23('0x3b')]({},_0x246cf9,_0x26b3f0[_0xbe23('0x45')]);return db[_0xbe23('0x3d')][_0xbe23('0x46')](_0x246cf9)[_0xbe23('0x26')](handleEntityNotFound(_0x1b659a,null))[_0xbe23('0x26')](respondWithResult(_0x1b659a,null))['catch'](handleError(_0x1b659a,null));};exports[_0xbe23('0x47')]=function(_0x12e9ef,_0x3159e5){return db[_0xbe23('0x3d')][_0xbe23('0x47')](_0x12e9ef[_0xbe23('0x48')],{})[_0xbe23('0x26')](respondWithResult(_0x3159e5,0xc9))[_0xbe23('0x41')](handleError(_0x3159e5,null));};exports['update']=function(_0x53f0ae,_0xfe5817){if(_0x53f0ae[_0xbe23('0x48')]['id']){delete _0x53f0ae[_0xbe23('0x48')]['id'];}return db[_0xbe23('0x3d')]['find']({'where':{'id':_0x53f0ae[_0xbe23('0x42')]['id']}})[_0xbe23('0x26')](handleEntityNotFound(_0xfe5817,null))[_0xbe23('0x26')](saveUpdates(_0x53f0ae[_0xbe23('0x48')],null))[_0xbe23('0x26')](respondWithResult(_0xfe5817,null))[_0xbe23('0x41')](handleError(_0xfe5817,null));};exports['destroy']=function(_0x27272c,_0x3e453f){return db[_0xbe23('0x3d')][_0xbe23('0x46')]({'where':{'id':_0x27272c[_0xbe23('0x42')]['id']}})[_0xbe23('0x26')](handleEntityNotFound(_0x3e453f,null))['then'](removeEntity(_0x3e453f,null))[_0xbe23('0x41')](handleError(_0x3e453f,null));};exports[_0xbe23('0x49')]=function(_0x44f4a3,_0x500a2a){return db['JscriptyQuestionReport']['describe']()[_0xbe23('0x26')](respondWithResult(_0x500a2a,null))['catch'](handleError(_0x500a2a,null));}; \ No newline at end of file +var _0x4328=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5c61cd,_0x3604d1){var _0x5bcae2=function(_0x3cc095){while(--_0x3cc095){_0x5c61cd['push'](_0x5c61cd['shift']());}};_0x5bcae2(++_0x3604d1);}(_0x4328,0xc0));var _0x8432=function(_0x15b44a,_0x243f93){_0x15b44a=_0x15b44a-0x0;var _0x2ea275=_0x4328[_0x15b44a];return _0x2ea275;};'use strict';var emlformat=require(_0x8432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8432('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8432('0x2'));var moment=require(_0x8432('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8432('0x4'));var util=require('util');var path=require(_0x8432('0x5'));var sox=require(_0x8432('0x6'));var csv=require('to-csv');var ejs=require(_0x8432('0x7'));var fs=require('fs');var fs_extra=require(_0x8432('0x8'));var _=require(_0x8432('0x9'));var squel=require(_0x8432('0xa'));var crypto=require(_0x8432('0xb'));var jsforce=require(_0x8432('0xc'));var deskjs=require(_0x8432('0xd'));var toCsv=require(_0x8432('0xe'));var querystring=require(_0x8432('0xf'));var Papa=require(_0x8432('0x10'));var Redis=require(_0x8432('0x11'));var authService=require(_0x8432('0x12'));var qs=require(_0x8432('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8432('0x14'));var utils=require('../../config/utils');var config=require(_0x8432('0x15'));var licenseUtil=require(_0x8432('0x16'));var db=require(_0x8432('0x17'))['db'];function respondWithStatusCode(_0x1ce033,_0x21120f){_0x21120f=_0x21120f||0xcc;return function(_0x48e73d){if(_0x48e73d){return _0x1ce033[_0x8432('0x18')](_0x21120f);}return _0x1ce033[_0x8432('0x19')](_0x21120f)['end']();};}function respondWithResult(_0x1b4d5f,_0x4ee9e4){_0x4ee9e4=_0x4ee9e4||0xc8;return function(_0x4fc64b){if(_0x4fc64b){return _0x1b4d5f[_0x8432('0x19')](_0x4ee9e4)[_0x8432('0x1a')](_0x4fc64b);}};}function respondWithFilteredResult(_0x256655,_0x5e6a37){return function(_0x409330){if(_0x409330){var _0x110eb4=typeof _0x5e6a37[_0x8432('0x1b')]===_0x8432('0x1c')&&typeof _0x5e6a37[_0x8432('0x1d')]===_0x8432('0x1c');var _0x1d95b7=_0x409330[_0x8432('0x1e')];var _0x594731=_0x110eb4?0x0:_0x5e6a37[_0x8432('0x1b')];var _0x5737b7=_0x110eb4?_0x409330[_0x8432('0x1e')]:_0x5e6a37[_0x8432('0x1b')]+_0x5e6a37[_0x8432('0x1d')];var _0x46fc0d;if(_0x5737b7>=_0x1d95b7){_0x5737b7=_0x1d95b7;_0x46fc0d=0xc8;}else{_0x46fc0d=0xce;}_0x256655[_0x8432('0x19')](_0x46fc0d);return _0x256655[_0x8432('0x1f')](_0x8432('0x20'),_0x594731+'-'+_0x5737b7+'/'+_0x1d95b7)[_0x8432('0x1a')](_0x409330);}return null;};}function patchUpdates(_0x62a05c){return function(_0x1ec30a){try{jsonpatch[_0x8432('0x21')](_0x1ec30a,_0x62a05c,!![]);}catch(_0x457bde){return BPromise['reject'](_0x457bde);}return _0x1ec30a[_0x8432('0x22')]();};}function saveUpdates(_0x40d08d,_0x2800f0){return function(_0x56c029){if(_0x56c029){return _0x56c029[_0x8432('0x23')](_0x40d08d)['then'](function(_0x49b026){return _0x49b026;});}return null;};}function removeEntity(_0x2286ad,_0x5f179f){return function(_0x3f7f46){if(_0x3f7f46){return _0x3f7f46[_0x8432('0x24')]()[_0x8432('0x25')](function(){_0x2286ad[_0x8432('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3858c7,_0x1c931c){return function(_0x411008){if(!_0x411008){_0x3858c7[_0x8432('0x18')](0x194);}return _0x411008;};}function handleError(_0x5a968e,_0x4a9590){_0x4a9590=_0x4a9590||0x1f4;return function(_0x4fe69a){logger[_0x8432('0x26')](_0x4fe69a['stack']);if(_0x4fe69a[_0x8432('0x27')]){delete _0x4fe69a[_0x8432('0x27')];}_0x5a968e[_0x8432('0x19')](_0x4a9590)['send'](_0x4fe69a);};}exports[_0x8432('0x28')]=function(_0x9990e3,_0x119079){var _0x393212={},_0x5bc2a0={},_0x2e4ef3={'count':0x0,'rows':[]};var _0x372bae=_[_0x8432('0x29')](db[_0x8432('0x2a')][_0x8432('0x2b')],function(_0x4ff4aa){return{'name':_0x4ff4aa[_0x8432('0x2c')],'type':_0x4ff4aa[_0x8432('0x2d')][_0x8432('0x2e')]};});_0x5bc2a0[_0x8432('0x2f')]=_[_0x8432('0x29')](_0x372bae,_0x8432('0x27'));_0x5bc2a0[_0x8432('0x30')]=_[_0x8432('0x31')](_0x9990e3[_0x8432('0x30')]);_0x5bc2a0[_0x8432('0x32')]=_[_0x8432('0x33')](_0x5bc2a0[_0x8432('0x2f')],_0x5bc2a0['query']);_0x393212[_0x8432('0x34')]=_['intersection'](_0x5bc2a0[_0x8432('0x2f')],qs[_0x8432('0x35')](_0x9990e3[_0x8432('0x30')]['fields']));_0x393212[_0x8432('0x34')]=_0x393212[_0x8432('0x34')]['length']?_0x393212['attributes']:_0x5bc2a0[_0x8432('0x2f')];if(!_0x9990e3[_0x8432('0x30')][_0x8432('0x36')](_0x8432('0x37'))){_0x393212[_0x8432('0x1d')]=qs[_0x8432('0x1d')](_0x9990e3[_0x8432('0x30')][_0x8432('0x1d')]);_0x393212[_0x8432('0x1b')]=qs[_0x8432('0x1b')](_0x9990e3[_0x8432('0x30')][_0x8432('0x1b')]);}_0x393212[_0x8432('0x38')]=qs[_0x8432('0x39')](_0x9990e3[_0x8432('0x30')]['sort']);_0x393212[_0x8432('0x3a')]=qs[_0x8432('0x32')](_[_0x8432('0x3b')](_0x9990e3['query'],_0x5bc2a0[_0x8432('0x32')]),_0x372bae);if(_0x9990e3[_0x8432('0x30')][_0x8432('0x3c')]){_0x393212[_0x8432('0x3a')]=_[_0x8432('0x3d')](_0x393212[_0x8432('0x3a')],{'$or':_[_0x8432('0x29')](_0x372bae,function(_0x3713f7){if(_0x3713f7[_0x8432('0x2d')]!=='VIRTUAL'){var _0x4e531b={};_0x4e531b[_0x3713f7['name']]={'$like':'%'+_0x9990e3['query']['filter']+'%'};return _0x4e531b;}})});}_0x393212=_['merge']({},_0x393212,_0x9990e3['options']);var _0x499a84={'where':_0x393212[_0x8432('0x3a')]};return db['JscriptyQuestionReport'][_0x8432('0x1e')](_0x499a84)['then'](function(_0x527304){_0x2e4ef3[_0x8432('0x1e')]=_0x527304;if(_0x9990e3['query'][_0x8432('0x3e')]){_0x393212[_0x8432('0x3f')]=[{'all':!![]}];}return db[_0x8432('0x2a')][_0x8432('0x40')](_0x393212);})[_0x8432('0x25')](function(_0x2d5715){_0x2e4ef3[_0x8432('0x41')]=_0x2d5715;return _0x2e4ef3;})[_0x8432('0x25')](respondWithFilteredResult(_0x119079,_0x393212))[_0x8432('0x42')](handleError(_0x119079,null));};exports['show']=function(_0x239067,_0x1c2f68){var _0x27950f={'raw':!![],'where':{'id':_0x239067[_0x8432('0x43')]['id']}},_0x46392c={};_0x46392c[_0x8432('0x2f')]=_[_0x8432('0x31')](db[_0x8432('0x2a')][_0x8432('0x2b')]);_0x46392c[_0x8432('0x30')]=_[_0x8432('0x31')](_0x239067['query']);_0x46392c[_0x8432('0x32')]=_['intersection'](_0x46392c[_0x8432('0x2f')],_0x46392c['query']);_0x27950f['attributes']=_[_0x8432('0x33')](_0x46392c[_0x8432('0x2f')],qs[_0x8432('0x35')](_0x239067[_0x8432('0x30')][_0x8432('0x35')]));_0x27950f[_0x8432('0x34')]=_0x27950f['attributes'][_0x8432('0x44')]?_0x27950f[_0x8432('0x34')]:_0x46392c[_0x8432('0x2f')];if(_0x239067[_0x8432('0x30')][_0x8432('0x3e')]){_0x27950f['include']=[{'all':!![]}];}_0x27950f=_[_0x8432('0x3d')]({},_0x27950f,_0x239067['options']);return db[_0x8432('0x2a')][_0x8432('0x45')](_0x27950f)['then'](handleEntityNotFound(_0x1c2f68,null))[_0x8432('0x25')](respondWithResult(_0x1c2f68,null))[_0x8432('0x42')](handleError(_0x1c2f68,null));};exports[_0x8432('0x46')]=function(_0x2f2d55,_0x5dc2bc){return db[_0x8432('0x2a')][_0x8432('0x46')](_0x2f2d55[_0x8432('0x47')],{})[_0x8432('0x25')](respondWithResult(_0x5dc2bc,0xc9))[_0x8432('0x42')](handleError(_0x5dc2bc,null));};exports[_0x8432('0x23')]=function(_0x3a5343,_0x261fb2){if(_0x3a5343[_0x8432('0x47')]['id']){delete _0x3a5343[_0x8432('0x47')]['id'];}return db[_0x8432('0x2a')][_0x8432('0x45')]({'where':{'id':_0x3a5343[_0x8432('0x43')]['id']}})[_0x8432('0x25')](handleEntityNotFound(_0x261fb2,null))['then'](saveUpdates(_0x3a5343[_0x8432('0x47')],null))[_0x8432('0x25')](respondWithResult(_0x261fb2,null))['catch'](handleError(_0x261fb2,null));};exports['destroy']=function(_0x1956b6,_0x5b6a45){return db['JscriptyQuestionReport'][_0x8432('0x45')]({'where':{'id':_0x1956b6['params']['id']}})[_0x8432('0x25')](handleEntityNotFound(_0x5b6a45,null))['then'](removeEntity(_0x5b6a45,null))[_0x8432('0x42')](handleError(_0x5b6a45,null));};exports[_0x8432('0x48')]=function(_0x1a77c8,_0x5ef01b){return db[_0x8432('0x2a')]['describe']()[_0x8432('0x25')](respondWithResult(_0x5ef01b,null))['catch'](handleError(_0x5ef01b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5aa8b03..7e77a1c 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 _0xbcbd=['bluebird','path','rimraf','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger','moment'];(function(_0x537c4f,_0x47b88b){var _0x306e74=function(_0x3a5ec9){while(--_0x3a5ec9){_0x537c4f['push'](_0x537c4f['shift']());}};_0x306e74(++_0x47b88b);}(_0xbcbd,0x1f0));var _0xdbcb=function(_0x544700,_0x37f134){_0x544700=_0x544700-0x0;var _0x39260b=_0xbcbd[_0x544700];return _0x39260b;};'use strict';var _=require(_0xdbcb('0x0'));var util=require(_0xdbcb('0x1'));var logger=require(_0xdbcb('0x2'))('api');var moment=require(_0xdbcb('0x3'));var BPromise=require(_0xdbcb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbcb('0x5'));var rimraf=require(_0xdbcb('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbcb('0x7'));module['exports']=function(_0x4492b2,_0x3e085e){return _0x4492b2[_0xdbcb('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0xdbcb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60d7=['JscriptyQuestionReport','lodash','../../config/logger','api','bluebird','path','rimraf','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x195570,_0x241fcc){var _0x252084=function(_0x3498a2){while(--_0x3498a2){_0x195570['push'](_0x195570['shift']());}};_0x252084(++_0x241fcc);}(_0x60d7,0x19b));var _0x760d=function(_0x573c86,_0x4c4337){_0x573c86=_0x573c86-0x0;var _0x2d1478=_0x60d7[_0x573c86];return _0x2d1478;};'use strict';var _=require(_0x760d('0x0'));var util=require('util');var logger=require(_0x760d('0x1'))(_0x760d('0x2'));var moment=require('moment');var BPromise=require(_0x760d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x760d('0x4'));var rimraf=require(_0x760d('0x5'));var config=require('../../config/environment');var attributes=require(_0x760d('0x6'));module[_0x760d('0x7')]=function(_0x3b8497,_0x29961f){return _0x3b8497[_0x760d('0x8')](_0x760d('0x9'),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 74390d6..48b0b77 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 _0x5dde=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4deac4,_0x1ea4d5){var _0x28e4a1=function(_0x3a68fa){while(--_0x3a68fa){_0x4deac4['push'](_0x4deac4['shift']());}};_0x28e4a1(++_0x1ea4d5);}(_0x5dde,0x1f4));var _0xe5dd=function(_0x5948c6,_0x4de8ac){_0x5948c6=_0x5948c6-0x0;var _0x30059e=_0x5dde[_0x5948c6];return _0x30059e;};'use strict';var _=require(_0xe5dd('0x0'));var util=require(_0xe5dd('0x1'));var moment=require(_0xe5dd('0x2'));var BPromise=require(_0xe5dd('0x3'));var rs=require(_0xe5dd('0x4'));var fs=require('fs');var Redis=require(_0xe5dd('0x5'));var db=require(_0xe5dd('0x6'))['db'];var utils=require(_0xe5dd('0x7'));var logger=require(_0xe5dd('0x8'))(_0xe5dd('0x9'));var config=require('../../config/environment');var jayson=require(_0xe5dd('0xa'));var client=jayson[_0xe5dd('0xb')][_0xe5dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19de9e,_0x3b0eb1,_0x13dd51){return new BPromise(function(_0x30e1aa,_0x1cc12f){return client[_0xe5dd('0xd')](_0x19de9e,_0x13dd51)['then'](function(_0x219123){logger[_0xe5dd('0xe')](_0xe5dd('0xf'),_0x3b0eb1,'request\x20sent');logger[_0xe5dd('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3b0eb1,_0xe5dd('0x11'),JSON[_0xe5dd('0x12')](_0x219123));if(_0x219123[_0xe5dd('0x13')]){if(_0x219123[_0xe5dd('0x13')][_0xe5dd('0x14')]===0x1f4){logger[_0xe5dd('0x13')](_0xe5dd('0xf'),_0x3b0eb1,_0x219123['error'][_0xe5dd('0x15')]);return _0x1cc12f(_0x219123[_0xe5dd('0x13')][_0xe5dd('0x15')]);}logger[_0xe5dd('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3b0eb1,_0x219123[_0xe5dd('0x13')][_0xe5dd('0x15')]);return _0x30e1aa(_0x219123['error'][_0xe5dd('0x15')]);}else{logger[_0xe5dd('0xe')](_0xe5dd('0xf'),_0x3b0eb1,_0xe5dd('0x11'));_0x30e1aa(_0x219123['result'][_0xe5dd('0x15')]);}})['catch'](function(_0x5f3aa7){logger[_0xe5dd('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3b0eb1,_0x5f3aa7);_0x1cc12f(_0x5f3aa7);});});} \ No newline at end of file +var _0xb7a8=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xb7a8,0x95));var _0x8b7a=function(_0x3438f7,_0x58b2fd){_0x3438f7=_0x3438f7-0x0;var _0x1fb83e=_0xb7a8[_0x3438f7];return _0x1fb83e;};'use strict';var _=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rs=require(_0x8b7a('0x4'));var fs=require('fs');var Redis=require(_0x8b7a('0x5'));var db=require(_0x8b7a('0x6'))['db'];var utils=require(_0x8b7a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b7a('0x8'));var jayson=require(_0x8b7a('0x9'));var client=jayson[_0x8b7a('0xa')][_0x8b7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x449a7e,_0x6fdc0b,_0x1ed692){return new BPromise(function(_0x5d509f,_0x5168d2){return client[_0x8b7a('0xc')](_0x449a7e,_0x1ed692)[_0x8b7a('0xd')](function(_0x9fb1ce){logger[_0x8b7a('0xe')](_0x8b7a('0xf'),_0x6fdc0b,_0x8b7a('0x10'));logger[_0x8b7a('0x11')](_0x8b7a('0x12'),_0x6fdc0b,_0x8b7a('0x10'),JSON[_0x8b7a('0x13')](_0x9fb1ce));if(_0x9fb1ce[_0x8b7a('0x14')]){if(_0x9fb1ce[_0x8b7a('0x14')]['code']===0x1f4){logger[_0x8b7a('0x14')](_0x8b7a('0xf'),_0x6fdc0b,_0x9fb1ce[_0x8b7a('0x14')][_0x8b7a('0x15')]);return _0x5168d2(_0x9fb1ce['error']['message']);}logger[_0x8b7a('0x14')](_0x8b7a('0xf'),_0x6fdc0b,_0x9fb1ce['error'][_0x8b7a('0x15')]);return _0x5d509f(_0x9fb1ce['error'][_0x8b7a('0x15')]);}else{logger['info'](_0x8b7a('0xf'),_0x6fdc0b,_0x8b7a('0x10'));_0x5d509f(_0x9fb1ce[_0x8b7a('0x16')][_0x8b7a('0x15')]);}})['catch'](function(_0xff2e59){logger['error'](_0x8b7a('0xf'),_0x6fdc0b,_0xff2e59);_0x5168d2(_0xff2e59);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ff1ea7c..98dded3 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 _0xd56d=['update','/:id','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','create','put'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xd56d,0x16c));var _0xdd56=function(_0x56c5c0,_0x2901e6){_0x56c5c0=_0x56c5c0-0x0;var _0x3610b8=_0xd56d[_0x56c5c0];return _0x3610b8;};'use strict';var multer=require('multer');var util=require(_0xdd56('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd56('0x1'));var router=express[_0xdd56('0x2')]();var fs_extra=require(_0xdd56('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd56('0x4'));var config=require(_0xdd56('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0xdd56('0x6')]('/',auth[_0xdd56('0x7')](),controller[_0xdd56('0x8')]);router[_0xdd56('0x6')](_0xdd56('0x9'),auth[_0xdd56('0x7')](),controller[_0xdd56('0xa')]);router[_0xdd56('0x6')]('/:id',auth[_0xdd56('0x7')](),controller[_0xdd56('0xb')]);router[_0xdd56('0x6')](_0xdd56('0xc'),auth[_0xdd56('0x7')](),controller[_0xdd56('0xd')]);router['post']('/',auth[_0xdd56('0x7')](),controller[_0xdd56('0xe')]);router[_0xdd56('0xf')]('/:id',auth[_0xdd56('0x7')](),controller[_0xdd56('0x10')]);router['delete'](_0xdd56('0x11'),auth[_0xdd56('0x7')](),controller[_0xdd56('0x12')]);module[_0xdd56('0x13')]=router; \ No newline at end of file +var _0x736e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x736e,0x14d));var _0xe736=function(_0x104628,_0x1a007e){_0x104628=_0x104628-0x0;var _0x56550b=_0x736e[_0x104628];return _0x56550b;};'use strict';var multer=require(_0xe736('0x0'));var util=require(_0xe736('0x1'));var path=require(_0xe736('0x2'));var timeout=require(_0xe736('0x3'));var express=require('express');var router=express[_0xe736('0x4')]();var fs_extra=require(_0xe736('0x5'));var auth=require(_0xe736('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe736('0x7'));var controller=require(_0xe736('0x8'));router[_0xe736('0x9')]('/',auth[_0xe736('0xa')](),controller['index']);router['get'](_0xe736('0xb'),auth[_0xe736('0xa')](),controller[_0xe736('0xc')]);router['get'](_0xe736('0xd'),auth[_0xe736('0xa')](),controller[_0xe736('0xe')]);router[_0xe736('0x9')](_0xe736('0xf'),auth[_0xe736('0xa')](),controller[_0xe736('0x10')]);router[_0xe736('0x11')]('/',auth[_0xe736('0xa')](),controller[_0xe736('0x12')]);router[_0xe736('0x13')](_0xe736('0xd'),auth['isAuthenticated'](),controller[_0xe736('0x14')]);router[_0xe736('0x15')](_0xe736('0xd'),auth[_0xe736('0xa')](),controller[_0xe736('0x16')]);module[_0xe736('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0939fe3..565c1ff 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 _0xbff5=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x159384,_0x1b1d38){var _0x594d6f=function(_0x552d17){while(--_0x552d17){_0x159384['push'](_0x159384['shift']());}};_0x594d6f(++_0x1b1d38);}(_0xbff5,0x86));var _0x5bff=function(_0x4eaa65,_0x58f7bd){_0x4eaa65=_0x4eaa65-0x0;var _0x14d71d=_0xbff5[_0x4eaa65];return _0x14d71d;};'use strict';var moment=require(_0x5bff('0x0'));var Sequelize=require(_0x5bff('0x1'));module[_0x5bff('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3753f1){this[_0x5bff('0x3')](_0x5bff('0x4'),_0x3753f1);this['setDataValue'](_0x5bff('0x5'),moment()[_0x5bff('0x6')](_0x5bff('0x7')));}},'endtime':{'type':Sequelize[_0x5bff('0x8')]},'membername':{'type':Sequelize[_0x5bff('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5bff('0x9')]},'uniqueid':{'type':Sequelize[_0x5bff('0x9')]},'calleridname':{'type':Sequelize[_0x5bff('0x9')]},'calleridnum':{'type':Sequelize[_0x5bff('0x9')]},'completed':{'type':Sequelize[_0x5bff('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8cd=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue','format'];(function(_0x2ed0a4,_0xb9c275){var _0x1cfd37=function(_0x3ecc20){while(--_0x3ecc20){_0x2ed0a4['push'](_0x2ed0a4['shift']());}};_0x1cfd37(++_0xb9c275);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x335844,_0x3470e0){_0x335844=_0x335844-0x0;var _0x227991=_0xb8cd[_0x335844];return _0x227991;};'use strict';var moment=require(_0xdb8c('0x0'));var Sequelize=require(_0xdb8c('0x1'));module[_0xdb8c('0x2')]={'starttime':{'type':Sequelize[_0xdb8c('0x3')],'set':function(_0x10354b){this['setDataValue'](_0xdb8c('0x4'),_0x10354b);this[_0xdb8c('0x5')]('endtime',moment()[_0xdb8c('0x6')](_0xdb8c('0x7')));}},'endtime':{'type':Sequelize[_0xdb8c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb8c('0x8')]},'queue':{'type':Sequelize[_0xdb8c('0x8')]},'uniqueid':{'type':Sequelize[_0xdb8c('0x8')]},'calleridname':{'type':Sequelize[_0xdb8c('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xdb8c('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 724d39d..ac9dca1 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 _0x86ae=['catch','params','includeAll','create','body','find','describe','getQuestions','JscriptyQuestionReport','SessionId','options','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','JscriptySessionReport','include','rows'];(function(_0x4dccf2,_0x5cfcd7){var _0x12640e=function(_0x1fb2c7){while(--_0x1fb2c7){_0x4dccf2['push'](_0x4dccf2['shift']());}};_0x12640e(++_0x5cfcd7);}(_0x86ae,0x154));var _0xe86a=function(_0x2de826,_0x18d3ab){_0x2de826=_0x2de826-0x0;var _0x43d2c9=_0x86ae[_0x2de826];return _0x43d2c9;};'use strict';var emlformat=require(_0xe86a('0x0'));var rimraf=require(_0xe86a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe86a('0x2'));var rp=require(_0xe86a('0x3'));var moment=require(_0xe86a('0x4'));var BPromise=require(_0xe86a('0x5'));var Mustache=require('mustache');var util=require(_0xe86a('0x6'));var path=require(_0xe86a('0x7'));var sox=require(_0xe86a('0x8'));var csv=require(_0xe86a('0x9'));var ejs=require(_0xe86a('0xa'));var fs=require('fs');var fs_extra=require(_0xe86a('0xb'));var _=require(_0xe86a('0xc'));var squel=require(_0xe86a('0xd'));var crypto=require(_0xe86a('0xe'));var jsforce=require(_0xe86a('0xf'));var deskjs=require(_0xe86a('0x10'));var toCsv=require(_0xe86a('0x9'));var querystring=require(_0xe86a('0x11'));var Papa=require(_0xe86a('0x12'));var Redis=require(_0xe86a('0x13'));var authService=require(_0xe86a('0x14'));var qs=require(_0xe86a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe86a('0x16'));var logger=require(_0xe86a('0x17'))(_0xe86a('0x18'));var utils=require(_0xe86a('0x19'));var config=require(_0xe86a('0x1a'));var licenseUtil=require(_0xe86a('0x1b'));var db=require(_0xe86a('0x1c'))['db'];function respondWithStatusCode(_0x5949d,_0x52b41c){_0x52b41c=_0x52b41c||0xcc;return function(_0x86d086){if(_0x86d086){return _0x5949d[_0xe86a('0x1d')](_0x52b41c);}return _0x5949d[_0xe86a('0x1e')](_0x52b41c)[_0xe86a('0x1f')]();};}function respondWithResult(_0x1c34b2,_0x8821cc){_0x8821cc=_0x8821cc||0xc8;return function(_0x514ba9){if(_0x514ba9){return _0x1c34b2['status'](_0x8821cc)[_0xe86a('0x20')](_0x514ba9);}};}function respondWithFilteredResult(_0x53003b,_0x19fc2d){return function(_0x2c700d){if(_0x2c700d){var _0x2c88fa=typeof _0x19fc2d[_0xe86a('0x21')]===_0xe86a('0x22')&&typeof _0x19fc2d[_0xe86a('0x23')]===_0xe86a('0x22');var _0x2b6aac=_0x2c700d[_0xe86a('0x24')];var _0x5f4402=_0x2c88fa?0x0:_0x19fc2d['offset'];var _0x25908d=_0x2c88fa?_0x2c700d[_0xe86a('0x24')]:_0x19fc2d[_0xe86a('0x21')]+_0x19fc2d[_0xe86a('0x23')];var _0x4e8a52;if(_0x25908d>=_0x2b6aac){_0x25908d=_0x2b6aac;_0x4e8a52=0xc8;}else{_0x4e8a52=0xce;}_0x53003b['status'](_0x4e8a52);return _0x53003b[_0xe86a('0x25')](_0xe86a('0x26'),_0x5f4402+'-'+_0x25908d+'/'+_0x2b6aac)[_0xe86a('0x20')](_0x2c700d);}return null;};}function patchUpdates(_0x4f519d){return function(_0x30a402){try{jsonpatch[_0xe86a('0x27')](_0x30a402,_0x4f519d,!![]);}catch(_0x3893b6){return BPromise['reject'](_0x3893b6);}return _0x30a402['save']();};}function saveUpdates(_0x3f5811,_0x4ca74e){return function(_0x342be3){if(_0x342be3){return _0x342be3[_0xe86a('0x28')](_0x3f5811)['then'](function(_0xe6d347){return _0xe6d347;});}return null;};}function removeEntity(_0x169604,_0x3be83d){return function(_0x535a3e){if(_0x535a3e){return _0x535a3e[_0xe86a('0x29')]()[_0xe86a('0x2a')](function(){_0x169604['status'](0xcc)[_0xe86a('0x1f')]();});}};}function handleEntityNotFound(_0x1bd61e,_0x3d371b){return function(_0x3688d9){if(!_0x3688d9){_0x1bd61e['sendStatus'](0x194);}return _0x3688d9;};}function handleError(_0x45379d,_0x5bd4f6){_0x5bd4f6=_0x5bd4f6||0x1f4;return function(_0x1fe3a4){logger[_0xe86a('0x2b')](_0x1fe3a4[_0xe86a('0x2c')]);if(_0x1fe3a4[_0xe86a('0x2d')]){delete _0x1fe3a4['name'];}_0x45379d[_0xe86a('0x1e')](_0x5bd4f6)[_0xe86a('0x2e')](_0x1fe3a4);};}exports['index']=function(_0x2491b5,_0x26bb27){var _0x492197={},_0x4ec74d={},_0x290ca5={'count':0x0,'rows':[]};var _0x75468a=_['map'](db['JscriptySessionReport'][_0xe86a('0x2f')],function(_0x31ac84){return{'name':_0x31ac84[_0xe86a('0x30')],'type':_0x31ac84[_0xe86a('0x31')][_0xe86a('0x32')]};});_0x4ec74d['model']=_[_0xe86a('0x33')](_0x75468a,_0xe86a('0x2d'));_0x4ec74d['query']=_[_0xe86a('0x34')](_0x2491b5[_0xe86a('0x35')]);_0x4ec74d[_0xe86a('0x36')]=_[_0xe86a('0x37')](_0x4ec74d['model'],_0x4ec74d[_0xe86a('0x35')]);_0x492197[_0xe86a('0x38')]=_[_0xe86a('0x37')](_0x4ec74d[_0xe86a('0x39')],qs[_0xe86a('0x3a')](_0x2491b5['query'][_0xe86a('0x3a')]));_0x492197['attributes']=_0x492197[_0xe86a('0x38')][_0xe86a('0x3b')]?_0x492197[_0xe86a('0x38')]:_0x4ec74d['model'];if(!_0x2491b5['query'][_0xe86a('0x3c')](_0xe86a('0x3d'))){_0x492197[_0xe86a('0x23')]=qs[_0xe86a('0x23')](_0x2491b5[_0xe86a('0x35')][_0xe86a('0x23')]);_0x492197[_0xe86a('0x21')]=qs['offset'](_0x2491b5[_0xe86a('0x35')]['offset']);}_0x492197['order']=qs['sort'](_0x2491b5[_0xe86a('0x35')][_0xe86a('0x3e')]);_0x492197[_0xe86a('0x3f')]=qs[_0xe86a('0x36')](_[_0xe86a('0x40')](_0x2491b5[_0xe86a('0x35')],_0x4ec74d[_0xe86a('0x36')]),_0x75468a);if(_0x2491b5[_0xe86a('0x35')]['filter']){_0x492197[_0xe86a('0x3f')]=_[_0xe86a('0x41')](_0x492197['where'],{'$or':_[_0xe86a('0x33')](_0x75468a,function(_0x505c4b){if(_0x505c4b[_0xe86a('0x31')]!=='VIRTUAL'){var _0x2e3842={};_0x2e3842[_0x505c4b['name']]={'$like':'%'+_0x2491b5['query'][_0xe86a('0x42')]+'%'};return _0x2e3842;}})});}_0x492197=_[_0xe86a('0x41')]({},_0x492197,_0x2491b5['options']);var _0x2f875d={'where':_0x492197[_0xe86a('0x3f')]};return db[_0xe86a('0x43')][_0xe86a('0x24')](_0x2f875d)['then'](function(_0x497303){_0x290ca5['count']=_0x497303;if(_0x2491b5[_0xe86a('0x35')]['includeAll']){_0x492197[_0xe86a('0x44')]=[{'all':!![]}];}return db[_0xe86a('0x43')]['findAll'](_0x492197);})[_0xe86a('0x2a')](function(_0x5281ea){_0x290ca5[_0xe86a('0x45')]=_0x5281ea;return _0x290ca5;})['then'](respondWithFilteredResult(_0x26bb27,_0x492197))[_0xe86a('0x46')](handleError(_0x26bb27,null));};exports['show']=function(_0x304dff,_0x1e3b77){var _0x16b39f={'raw':!![],'where':{'id':_0x304dff[_0xe86a('0x47')]['id']}},_0x21be79={};_0x21be79[_0xe86a('0x39')]=_[_0xe86a('0x34')](db[_0xe86a('0x43')][_0xe86a('0x2f')]);_0x21be79[_0xe86a('0x35')]=_['keys'](_0x304dff[_0xe86a('0x35')]);_0x21be79[_0xe86a('0x36')]=_[_0xe86a('0x37')](_0x21be79[_0xe86a('0x39')],_0x21be79[_0xe86a('0x35')]);_0x16b39f[_0xe86a('0x38')]=_[_0xe86a('0x37')](_0x21be79[_0xe86a('0x39')],qs['fields'](_0x304dff['query'][_0xe86a('0x3a')]));_0x16b39f[_0xe86a('0x38')]=_0x16b39f[_0xe86a('0x38')]['length']?_0x16b39f[_0xe86a('0x38')]:_0x21be79[_0xe86a('0x39')];if(_0x304dff['query'][_0xe86a('0x48')]){_0x16b39f[_0xe86a('0x44')]=[{'all':!![]}];}_0x16b39f=_[_0xe86a('0x41')]({},_0x16b39f,_0x304dff['options']);return db[_0xe86a('0x43')]['find'](_0x16b39f)['then'](handleEntityNotFound(_0x1e3b77,null))['then'](respondWithResult(_0x1e3b77,null))[_0xe86a('0x46')](handleError(_0x1e3b77,null));};exports[_0xe86a('0x49')]=function(_0x490fd3,_0x30a3bc){return db[_0xe86a('0x43')][_0xe86a('0x49')](_0x490fd3[_0xe86a('0x4a')],{})[_0xe86a('0x2a')](respondWithResult(_0x30a3bc,0xc9))['catch'](handleError(_0x30a3bc,null));};exports[_0xe86a('0x28')]=function(_0xfca57e,_0x447463){if(_0xfca57e[_0xe86a('0x4a')]['id']){delete _0xfca57e[_0xe86a('0x4a')]['id'];}return db['JscriptySessionReport'][_0xe86a('0x4b')]({'where':{'id':_0xfca57e['params']['id']}})[_0xe86a('0x2a')](handleEntityNotFound(_0x447463,null))[_0xe86a('0x2a')](saveUpdates(_0xfca57e[_0xe86a('0x4a')],null))[_0xe86a('0x2a')](respondWithResult(_0x447463,null))[_0xe86a('0x46')](handleError(_0x447463,null));};exports[_0xe86a('0x29')]=function(_0x2868e8,_0x25c10b){return db[_0xe86a('0x43')][_0xe86a('0x4b')]({'where':{'id':_0x2868e8['params']['id']}})[_0xe86a('0x2a')](handleEntityNotFound(_0x25c10b,null))['then'](removeEntity(_0x25c10b,null))[_0xe86a('0x46')](handleError(_0x25c10b,null));};exports[_0xe86a('0x4c')]=function(_0x3738f2,_0x288ec5){return db[_0xe86a('0x43')][_0xe86a('0x4c')]()['then'](respondWithResult(_0x288ec5,null))[_0xe86a('0x46')](handleError(_0x288ec5,null));};exports[_0xe86a('0x4d')]=function(_0x58dd0e,_0x26529f,_0x2fcb82){var _0x33e6e8={'raw':!![],'where':{}};var _0x5609fe={};var _0x14653c={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x58dd0e[_0xe86a('0x47')]['id']}})['then'](handleEntityNotFound(_0x26529f,null))[_0xe86a('0x2a')](function(_0x799371){if(_0x799371){_0x5609fe[_0xe86a('0x39')]=_[_0xe86a('0x34')](db[_0xe86a('0x4e')]['rawAttributes']);_0x5609fe[_0xe86a('0x35')]=_[_0xe86a('0x34')](_0x58dd0e[_0xe86a('0x35')]);_0x5609fe['filters']=_[_0xe86a('0x37')](_0x5609fe['model'],_0x5609fe[_0xe86a('0x35')]);_0x33e6e8[_0xe86a('0x38')]=_[_0xe86a('0x37')](_0x5609fe[_0xe86a('0x39')],qs[_0xe86a('0x3a')](_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x3a')]));_0x33e6e8[_0xe86a('0x38')]=_0x33e6e8[_0xe86a('0x38')][_0xe86a('0x3b')]?_0x33e6e8[_0xe86a('0x38')]:_0x5609fe[_0xe86a('0x39')];if(!_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x3c')](_0xe86a('0x3d'))){_0x33e6e8[_0xe86a('0x23')]=qs[_0xe86a('0x23')](_0x58dd0e['query'][_0xe86a('0x23')]);_0x33e6e8[_0xe86a('0x21')]=qs[_0xe86a('0x21')](_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x21')]);}_0x33e6e8['order']=qs[_0xe86a('0x3e')](_0x58dd0e[_0xe86a('0x35')]['sort']);_0x33e6e8[_0xe86a('0x3f')]=qs[_0xe86a('0x36')](_['pick'](_0x58dd0e['query'],_0x5609fe[_0xe86a('0x36')]));_0x33e6e8[_0xe86a('0x3f')][_0xe86a('0x4f')]=_0x799371['id'];if(_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x42')]){_0x33e6e8[_0xe86a('0x3f')]=_[_0xe86a('0x41')](_0x33e6e8['where'],{'$or':_['map'](_0x33e6e8[_0xe86a('0x38')],function(_0xfe91a4){var _0x5c0d06={};_0x5c0d06[_0xfe91a4]={'$like':'%'+_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x42')]+'%'};return _0x5c0d06;})});}_0x33e6e8=_[_0xe86a('0x41')]({},_0x33e6e8,_0x58dd0e[_0xe86a('0x50')]);return db['JscriptyQuestionReport'][_0xe86a('0x24')]({'where':_0x33e6e8[_0xe86a('0x3f')]})[_0xe86a('0x2a')](function(_0x381e47){_0x14653c['count']=_0x381e47;if(_0x58dd0e[_0xe86a('0x35')][_0xe86a('0x48')]){_0x33e6e8[_0xe86a('0x44')]=[{'all':!![]}];}return db[_0xe86a('0x4e')][_0xe86a('0x51')](_0x33e6e8);})[_0xe86a('0x2a')](function(_0x2e95d3){_0x14653c[_0xe86a('0x45')]=_0x2e95d3;return _0x14653c;});}})[_0xe86a('0x2a')](respondWithFilteredResult(_0x26529f,_0x33e6e8))[_0xe86a('0x46')](handleError(_0x26529f,null));}; \ No newline at end of file +var _0xffe9=['sort','where','pick','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','find','create','body','params','describe','findOne','JscriptyQuestionReport','order','SessionId','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xffe9,0x197));var _0x9ffe=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xffe9[_0x49d280];return _0x25274a;};'use strict';var emlformat=require(_0x9ffe('0x0'));var rimraf=require(_0x9ffe('0x1'));var zipdir=require(_0x9ffe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ffe('0x3'));var moment=require(_0x9ffe('0x4'));var BPromise=require(_0x9ffe('0x5'));var Mustache=require('mustache');var util=require(_0x9ffe('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ffe('0x7'));var _=require(_0x9ffe('0x8'));var squel=require(_0x9ffe('0x9'));var crypto=require(_0x9ffe('0xa'));var jsforce=require(_0x9ffe('0xb'));var deskjs=require(_0x9ffe('0xc'));var toCsv=require(_0x9ffe('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9ffe('0xe'));var authService=require(_0x9ffe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9ffe('0x10'));var hardwareService=require(_0x9ffe('0x11'));var logger=require(_0x9ffe('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9ffe('0x13'));var licenseUtil=require(_0x9ffe('0x14'));var db=require(_0x9ffe('0x15'))['db'];function respondWithStatusCode(_0x7992f9,_0x5c72dd){_0x5c72dd=_0x5c72dd||0xcc;return function(_0xc01ce4){if(_0xc01ce4){return _0x7992f9[_0x9ffe('0x16')](_0x5c72dd);}return _0x7992f9[_0x9ffe('0x17')](_0x5c72dd)['end']();};}function respondWithResult(_0x1841c5,_0x5bb543){_0x5bb543=_0x5bb543||0xc8;return function(_0x5645a7){if(_0x5645a7){return _0x1841c5['status'](_0x5bb543)[_0x9ffe('0x18')](_0x5645a7);}};}function respondWithFilteredResult(_0x8f2505,_0x3c5d4b){return function(_0x2c02e7){if(_0x2c02e7){var _0x1cfa2c=typeof _0x3c5d4b[_0x9ffe('0x19')]==='undefined'&&typeof _0x3c5d4b['limit']===_0x9ffe('0x1a');var _0x3f3c42=_0x2c02e7[_0x9ffe('0x1b')];var _0x338936=_0x1cfa2c?0x0:_0x3c5d4b[_0x9ffe('0x19')];var _0x4cc151=_0x1cfa2c?_0x2c02e7['count']:_0x3c5d4b['offset']+_0x3c5d4b[_0x9ffe('0x1c')];var _0x230299;if(_0x4cc151>=_0x3f3c42){_0x4cc151=_0x3f3c42;_0x230299=0xc8;}else{_0x230299=0xce;}_0x8f2505[_0x9ffe('0x17')](_0x230299);return _0x8f2505[_0x9ffe('0x1d')]('Content-Range',_0x338936+'-'+_0x4cc151+'/'+_0x3f3c42)[_0x9ffe('0x18')](_0x2c02e7);}return null;};}function patchUpdates(_0x4abbf1){return function(_0x14b3e3){try{jsonpatch[_0x9ffe('0x1e')](_0x14b3e3,_0x4abbf1,!![]);}catch(_0x4e2de3){return BPromise[_0x9ffe('0x1f')](_0x4e2de3);}return _0x14b3e3['save']();};}function saveUpdates(_0x18592b,_0x558781){return function(_0x2bc20b){if(_0x2bc20b){return _0x2bc20b[_0x9ffe('0x20')](_0x18592b)[_0x9ffe('0x21')](function(_0x5bfe08){return _0x5bfe08;});}return null;};}function removeEntity(_0x1d7c88,_0x2d4361){return function(_0x3e8793){if(_0x3e8793){return _0x3e8793[_0x9ffe('0x22')]()['then'](function(){_0x1d7c88['status'](0xcc)[_0x9ffe('0x23')]();});}};}function handleEntityNotFound(_0x53fd00,_0x4e8524){return function(_0x1ad4b3){if(!_0x1ad4b3){_0x53fd00[_0x9ffe('0x16')](0x194);}return _0x1ad4b3;};}function handleError(_0x31342d,_0x388d65){_0x388d65=_0x388d65||0x1f4;return function(_0x54fd47){logger[_0x9ffe('0x24')](_0x54fd47['stack']);if(_0x54fd47[_0x9ffe('0x25')]){delete _0x54fd47[_0x9ffe('0x25')];}_0x31342d['status'](_0x388d65)[_0x9ffe('0x26')](_0x54fd47);};}exports[_0x9ffe('0x27')]=function(_0x5aa12e,_0x1fb15b){var _0x1e7fcc={},_0x2bfb90={},_0x90b229={'count':0x0,'rows':[]};var _0x289eb2=_[_0x9ffe('0x28')](db['JscriptySessionReport'][_0x9ffe('0x29')],function(_0x149426){return{'name':_0x149426[_0x9ffe('0x2a')],'type':_0x149426[_0x9ffe('0x2b')][_0x9ffe('0x2c')]};});_0x2bfb90['model']=_[_0x9ffe('0x28')](_0x289eb2,_0x9ffe('0x25'));_0x2bfb90[_0x9ffe('0x2d')]=_[_0x9ffe('0x2e')](_0x5aa12e[_0x9ffe('0x2d')]);_0x2bfb90[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x2bfb90[_0x9ffe('0x31')],_0x2bfb90['query']);_0x1e7fcc[_0x9ffe('0x32')]=_[_0x9ffe('0x30')](_0x2bfb90['model'],qs['fields'](_0x5aa12e['query'][_0x9ffe('0x33')]));_0x1e7fcc[_0x9ffe('0x32')]=_0x1e7fcc[_0x9ffe('0x32')][_0x9ffe('0x34')]?_0x1e7fcc[_0x9ffe('0x32')]:_0x2bfb90[_0x9ffe('0x31')];if(!_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x35')](_0x9ffe('0x36'))){_0x1e7fcc['limit']=qs['limit'](_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x1c')]);_0x1e7fcc[_0x9ffe('0x19')]=qs['offset'](_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x19')]);}_0x1e7fcc['order']=qs[_0x9ffe('0x37')](_0x5aa12e['query']['sort']);_0x1e7fcc[_0x9ffe('0x38')]=qs[_0x9ffe('0x2f')](_[_0x9ffe('0x39')](_0x5aa12e['query'],_0x2bfb90['filters']),_0x289eb2);if(_0x5aa12e[_0x9ffe('0x2d')]['filter']){_0x1e7fcc[_0x9ffe('0x38')]=_[_0x9ffe('0x3a')](_0x1e7fcc[_0x9ffe('0x38')],{'$or':_[_0x9ffe('0x28')](_0x289eb2,function(_0x252aa0){if(_0x252aa0[_0x9ffe('0x2b')]!==_0x9ffe('0x3b')){var _0x27ab4b={};_0x27ab4b[_0x252aa0['name']]={'$like':'%'+_0x5aa12e[_0x9ffe('0x2d')]['filter']+'%'};return _0x27ab4b;}})});}_0x1e7fcc=_[_0x9ffe('0x3a')]({},_0x1e7fcc,_0x5aa12e[_0x9ffe('0x3c')]);var _0x285b35={'where':_0x1e7fcc['where']};return db[_0x9ffe('0x3d')][_0x9ffe('0x1b')](_0x285b35)[_0x9ffe('0x21')](function(_0x2f35ae){_0x90b229[_0x9ffe('0x1b')]=_0x2f35ae;if(_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x3e')]){_0x1e7fcc[_0x9ffe('0x3f')]=[{'all':!![]}];}return db[_0x9ffe('0x3d')][_0x9ffe('0x40')](_0x1e7fcc);})[_0x9ffe('0x21')](function(_0x298149){_0x90b229[_0x9ffe('0x41')]=_0x298149;return _0x90b229;})[_0x9ffe('0x21')](respondWithFilteredResult(_0x1fb15b,_0x1e7fcc))[_0x9ffe('0x42')](handleError(_0x1fb15b,null));};exports['show']=function(_0x578cfd,_0x5c8137){var _0x3f1c2a={'raw':!![],'where':{'id':_0x578cfd['params']['id']}},_0x120b8e={};_0x120b8e[_0x9ffe('0x31')]=_['keys'](db[_0x9ffe('0x3d')][_0x9ffe('0x29')]);_0x120b8e['query']=_[_0x9ffe('0x2e')](_0x578cfd[_0x9ffe('0x2d')]);_0x120b8e[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x120b8e['model'],_0x120b8e[_0x9ffe('0x2d')]);_0x3f1c2a[_0x9ffe('0x32')]=_[_0x9ffe('0x30')](_0x120b8e[_0x9ffe('0x31')],qs[_0x9ffe('0x33')](_0x578cfd[_0x9ffe('0x2d')]['fields']));_0x3f1c2a[_0x9ffe('0x32')]=_0x3f1c2a[_0x9ffe('0x32')]['length']?_0x3f1c2a[_0x9ffe('0x32')]:_0x120b8e[_0x9ffe('0x31')];if(_0x578cfd[_0x9ffe('0x2d')][_0x9ffe('0x3e')]){_0x3f1c2a[_0x9ffe('0x3f')]=[{'all':!![]}];}_0x3f1c2a=_[_0x9ffe('0x3a')]({},_0x3f1c2a,_0x578cfd['options']);return db['JscriptySessionReport'][_0x9ffe('0x43')](_0x3f1c2a)['then'](handleEntityNotFound(_0x5c8137,null))['then'](respondWithResult(_0x5c8137,null))['catch'](handleError(_0x5c8137,null));};exports[_0x9ffe('0x44')]=function(_0x30a87c,_0x104ab7){return db[_0x9ffe('0x3d')][_0x9ffe('0x44')](_0x30a87c[_0x9ffe('0x45')],{})[_0x9ffe('0x21')](respondWithResult(_0x104ab7,0xc9))[_0x9ffe('0x42')](handleError(_0x104ab7,null));};exports[_0x9ffe('0x20')]=function(_0x24f40,_0x7cf503){if(_0x24f40[_0x9ffe('0x45')]['id']){delete _0x24f40['body']['id'];}return db[_0x9ffe('0x3d')][_0x9ffe('0x43')]({'where':{'id':_0x24f40['params']['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x7cf503,null))['then'](saveUpdates(_0x24f40[_0x9ffe('0x45')],null))[_0x9ffe('0x21')](respondWithResult(_0x7cf503,null))[_0x9ffe('0x42')](handleError(_0x7cf503,null));};exports[_0x9ffe('0x22')]=function(_0x513d2f,_0x4d9090){return db[_0x9ffe('0x3d')][_0x9ffe('0x43')]({'where':{'id':_0x513d2f[_0x9ffe('0x46')]['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x4d9090,null))[_0x9ffe('0x21')](removeEntity(_0x4d9090,null))[_0x9ffe('0x42')](handleError(_0x4d9090,null));};exports['describe']=function(_0x4ae061,_0x152b7a){return db['JscriptySessionReport'][_0x9ffe('0x47')]()[_0x9ffe('0x21')](respondWithResult(_0x152b7a,null))[_0x9ffe('0x42')](handleError(_0x152b7a,null));};exports['getQuestions']=function(_0x1af817,_0x272b2e,_0x46a1ca){var _0x1a27f8={'raw':!![],'where':{}};var _0x167889={};var _0x587fd6={'count':0x0,'rows':[]};return db[_0x9ffe('0x3d')][_0x9ffe('0x48')]({'where':{'id':_0x1af817[_0x9ffe('0x46')]['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x272b2e,null))['then'](function(_0x5c85c1){if(_0x5c85c1){_0x167889['model']=_[_0x9ffe('0x2e')](db[_0x9ffe('0x49')][_0x9ffe('0x29')]);_0x167889[_0x9ffe('0x2d')]=_[_0x9ffe('0x2e')](_0x1af817['query']);_0x167889[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x167889[_0x9ffe('0x31')],_0x167889['query']);_0x1a27f8[_0x9ffe('0x32')]=_['intersection'](_0x167889[_0x9ffe('0x31')],qs[_0x9ffe('0x33')](_0x1af817['query'][_0x9ffe('0x33')]));_0x1a27f8[_0x9ffe('0x32')]=_0x1a27f8[_0x9ffe('0x32')][_0x9ffe('0x34')]?_0x1a27f8[_0x9ffe('0x32')]:_0x167889[_0x9ffe('0x31')];if(!_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x35')](_0x9ffe('0x36'))){_0x1a27f8[_0x9ffe('0x1c')]=qs[_0x9ffe('0x1c')](_0x1af817['query'][_0x9ffe('0x1c')]);_0x1a27f8[_0x9ffe('0x19')]=qs['offset'](_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x19')]);}_0x1a27f8[_0x9ffe('0x4a')]=qs['sort'](_0x1af817[_0x9ffe('0x2d')]['sort']);_0x1a27f8[_0x9ffe('0x38')]=qs[_0x9ffe('0x2f')](_['pick'](_0x1af817['query'],_0x167889['filters']));_0x1a27f8['where'][_0x9ffe('0x4b')]=_0x5c85c1['id'];if(_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x4c')]){_0x1a27f8[_0x9ffe('0x38')]=_['merge'](_0x1a27f8[_0x9ffe('0x38')],{'$or':_[_0x9ffe('0x28')](_0x1a27f8[_0x9ffe('0x32')],function(_0x45eb22){var _0x1a48f4={};_0x1a48f4[_0x45eb22]={'$like':'%'+_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x4c')]+'%'};return _0x1a48f4;})});}_0x1a27f8=_[_0x9ffe('0x3a')]({},_0x1a27f8,_0x1af817[_0x9ffe('0x3c')]);return db[_0x9ffe('0x49')][_0x9ffe('0x1b')]({'where':_0x1a27f8[_0x9ffe('0x38')]})[_0x9ffe('0x21')](function(_0x599224){_0x587fd6[_0x9ffe('0x1b')]=_0x599224;if(_0x1af817['query'][_0x9ffe('0x3e')]){_0x1a27f8[_0x9ffe('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9ffe('0x40')](_0x1a27f8);})[_0x9ffe('0x21')](function(_0x2e7243){_0x587fd6[_0x9ffe('0x41')]=_0x2e7243;return _0x587fd6;});}})['then'](respondWithFilteredResult(_0x272b2e,_0x1a27f8))['catch'](handleError(_0x272b2e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5739148..5c1b573 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 _0xeda8=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeda8,0x104));var _0x8eda=function(_0x21929d,_0x88bdfa){_0x21929d=_0x21929d-0x0;var _0x151a2f=_0xeda8[_0x21929d];return _0x151a2f;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('JscriptySessionReport',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['moment','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x2b250c,_0x3d223b){var _0x43c013=function(_0x473da9){while(--_0x473da9){_0x2b250c['push'](_0x2b250c['shift']());}};_0x43c013(++_0x3d223b);}(_0xb091,0x16e));var _0x1b09=function(_0x5af324,_0x276ac8){_0x5af324=_0x5af324-0x0;var _0x152629=_0xb091[_0x5af324];return _0x152629;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 09317ed..0dc7b6b 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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x292e74,_0x42ce31){var _0x262764=function(_0x50bc46){while(--_0x50bc46){_0x292e74['push'](_0x292e74['shift']());}};_0x262764(++_0x42ce31);}(_0x90b1,0x1bb));var _0x190b=function(_0x54af0d,_0x3e5db0){_0x54af0d=_0x54af0d-0x0;var _0x57b08d=_0x90b1[_0x54af0d];return _0x57b08d;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file +var _0x9536=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x3feb0c,_0x5c57b7){var _0x46c8f1=function(_0x49b1f1){while(--_0x49b1f1){_0x3feb0c['push'](_0x3feb0c['shift']());}};_0x46c8f1(++_0x5c57b7);}(_0x9536,0x179));var _0x6953=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x9536[_0xcda377];return _0x1c024f;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 02888cb..1bef2a5 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 _0x57e1=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0xb3453e,_0xdfbbe4){var _0x435a94=function(_0x434634){while(--_0x434634){_0xb3453e['push'](_0xb3453e['shift']());}};_0x435a94(++_0xdfbbe4);}(_0x57e1,0x1d1));var _0x157e=function(_0x188832,_0x49101d){_0x188832=_0x188832-0x0;var _0x2b990f=_0x57e1[_0x188832];return _0x2b990f;};'use strict';var multer=require('multer');var util=require(_0x157e('0x0'));var path=require(_0x157e('0x1'));var timeout=require(_0x157e('0x2'));var express=require('express');var router=express[_0x157e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x157e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x157e('0x5'));var controller=require(_0x157e('0x6'));router[_0x157e('0x7')]('/',controller[_0x157e('0x8')]);router[_0x157e('0x9')](_0x157e('0xa'),auth[_0x157e('0xb')](),controller[_0x157e('0xc')]);router[_0x157e('0x7')](_0x157e('0xd'),auth[_0x157e('0xb')](),controller[_0x157e('0xe')]);module[_0x157e('0xf')]=router; \ No newline at end of file +var _0xb048=['isAuthenticated','update','/download_log_file','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x421526,_0x1d5f80){var _0x56148e=function(_0x379904){while(--_0x379904){_0x421526['push'](_0x421526['shift']());}};_0x56148e(++_0x1d5f80);}(_0xb048,0xa4));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8b04('0x0'));var util=require('util');var path=require(_0x8b04('0x1'));var timeout=require(_0x8b04('0x2'));var express=require(_0x8b04('0x3'));var router=express[_0x8b04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b04('0x6'));var controller=require(_0x8b04('0x7'));router[_0x8b04('0x8')]('/',controller[_0x8b04('0x9')]);router[_0x8b04('0xa')](_0x8b04('0xb'),auth[_0x8b04('0xc')](),controller[_0x8b04('0xd')]);router['get'](_0x8b04('0xe'),auth[_0x8b04('0xc')](),controller['downloadLogFile']);module[_0x8b04('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1c239db..0fb29d6 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 _0x1c69=['INTEGER','exports','STRING'];(function(_0x5ef78c,_0x1e55b7){var _0x43c897=function(_0x5763b0){while(--_0x5763b0){_0x5ef78c['push'](_0x5ef78c['shift']());}};_0x43c897(++_0x1e55b7);}(_0x1c69,0xa3));var _0x91c6=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1c69[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module[_0x91c6('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x91c6('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x91c6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1e4=['STRING','INTEGER','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc1e4,0x1ce));var _0x4c1e=function(_0x65693e,_0x49a9f1){_0x65693e=_0x65693e-0x0;var _0xd0460a=_0xc1e4[_0x65693e];return _0xd0460a;};'use strict';var Sequelize=require(_0x4c1e('0x0'));module[_0x4c1e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x4c1e('0x2')]},'data2':{'type':Sequelize[_0x4c1e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x4c1e('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 9bc3321..ec2f1ba 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 _0x4e03=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','merge','options','getLicense','catch','update','body','params','get','checkLicense','demo','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format'];(function(_0x5aa00a,_0x232fae){var _0x55e766=function(_0x1e5944){while(--_0x1e5944){_0x5aa00a['push'](_0x5aa00a['shift']());}};_0x55e766(++_0x232fae);}(_0x4e03,0xc8));var _0x34e0=function(_0x3978ab,_0x483856){_0x3978ab=_0x3978ab-0x0;var _0x384056=_0x4e03[_0x3978ab];return _0x384056;};'use strict';var emlformat=require(_0x34e0('0x0'));var rimraf=require(_0x34e0('0x1'));var zipdir=require(_0x34e0('0x2'));var jsonpatch=require(_0x34e0('0x3'));var rp=require('request-promise');var moment=require(_0x34e0('0x4'));var BPromise=require(_0x34e0('0x5'));var Mustache=require(_0x34e0('0x6'));var util=require(_0x34e0('0x7'));var path=require('path');var sox=require(_0x34e0('0x8'));var csv=require(_0x34e0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34e0('0xa'));var _=require(_0x34e0('0xb'));var squel=require('squel');var crypto=require(_0x34e0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34e0('0xd'));var toCsv=require(_0x34e0('0x9'));var querystring=require('querystring');var Papa=require(_0x34e0('0xe'));var Redis=require(_0x34e0('0xf'));var authService=require(_0x34e0('0x10'));var qs=require(_0x34e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x34e0('0x12'));var config=require(_0x34e0('0x13'));var licenseUtil=require(_0x34e0('0x14'));var db=require(_0x34e0('0x15'))['db'];function respondWithStatusCode(_0x355818,_0x64f591){_0x64f591=_0x64f591||0xcc;return function(_0x15e005){if(_0x15e005){return _0x355818[_0x34e0('0x16')](_0x64f591);}return _0x355818[_0x34e0('0x17')](_0x64f591)[_0x34e0('0x18')]();};}function respondWithResult(_0x1ee504,_0x246697){_0x246697=_0x246697||0xc8;return function(_0x5a4a37){if(_0x5a4a37){return _0x1ee504[_0x34e0('0x17')](_0x246697)[_0x34e0('0x19')](_0x5a4a37);}};}function respondWithFilteredResult(_0x2a1dea,_0x515416){return function(_0x480685){if(_0x480685){var _0x26a581=typeof _0x515416[_0x34e0('0x1a')]===_0x34e0('0x1b')&&typeof _0x515416[_0x34e0('0x1c')]==='undefined';var _0x1a472b=_0x480685[_0x34e0('0x1d')];var _0x562cb2=_0x26a581?0x0:_0x515416['offset'];var _0x5aefcc=_0x26a581?_0x480685[_0x34e0('0x1d')]:_0x515416['offset']+_0x515416[_0x34e0('0x1c')];var _0x4ffcf1;if(_0x5aefcc>=_0x1a472b){_0x5aefcc=_0x1a472b;_0x4ffcf1=0xc8;}else{_0x4ffcf1=0xce;}_0x2a1dea[_0x34e0('0x17')](_0x4ffcf1);return _0x2a1dea[_0x34e0('0x1e')]('Content-Range',_0x562cb2+'-'+_0x5aefcc+'/'+_0x1a472b)[_0x34e0('0x19')](_0x480685);}return null;};}function patchUpdates(_0x48ec98){return function(_0x48acd6){try{jsonpatch[_0x34e0('0x1f')](_0x48acd6,_0x48ec98,!![]);}catch(_0x2f1577){return BPromise['reject'](_0x2f1577);}return _0x48acd6[_0x34e0('0x20')]();};}function saveUpdates(_0x3648b0,_0x233d82){return function(_0x2b5bf3){if(_0x2b5bf3){return _0x2b5bf3['update'](_0x3648b0)[_0x34e0('0x21')](function(_0x3f3736){return _0x3f3736;});}return null;};}function removeEntity(_0x591c42,_0xd4f23c){return function(_0x28d0c4){if(_0x28d0c4){return _0x28d0c4['destroy']()['then'](function(){_0x591c42[_0x34e0('0x17')](0xcc)[_0x34e0('0x18')]();});}};}function handleEntityNotFound(_0x440fde,_0x2034a9){return function(_0x12b257){if(!_0x12b257){_0x440fde['sendStatus'](0x194);}return _0x12b257;};}function handleError(_0x1aea61,_0x416ac3){_0x416ac3=_0x416ac3||0x1f4;return function(_0x3c75e1){logger[_0x34e0('0x22')](_0x3c75e1[_0x34e0('0x23')]);if(_0x3c75e1[_0x34e0('0x24')]){delete _0x3c75e1['name'];}_0x1aea61[_0x34e0('0x17')](_0x416ac3)['send'](_0x3c75e1);};}var utilLicense=require(_0x34e0('0x14'));exports[_0x34e0('0x25')]=function(_0x2cdeb3,_0x3cec69){var _0x465905={'raw':!![],'where':{'id':0x1}},_0x1ba4f0={};_0x1ba4f0['model']=_[_0x34e0('0x26')](db[_0x34e0('0x27')][_0x34e0('0x28')]);_0x1ba4f0[_0x34e0('0x29')]=_['keys'](_0x2cdeb3[_0x34e0('0x29')]);_0x1ba4f0[_0x34e0('0x2a')]=_[_0x34e0('0x2b')](_0x1ba4f0[_0x34e0('0x2c')],_0x1ba4f0[_0x34e0('0x29')]);_0x465905[_0x34e0('0x2d')]=_[_0x34e0('0x2b')](_0x1ba4f0[_0x34e0('0x2c')],qs['fields'](_0x2cdeb3['query'][_0x34e0('0x2e')]));_0x465905[_0x34e0('0x2d')]=_0x465905[_0x34e0('0x2d')]['length']?_0x465905['attributes']:_0x1ba4f0[_0x34e0('0x2c')];_0x465905=_[_0x34e0('0x2f')]({},_0x465905,_0x2cdeb3[_0x34e0('0x30')]);return utilLicense[_0x34e0('0x31')](_0x465905)[_0x34e0('0x21')](respondWithResult(_0x3cec69,null))[_0x34e0('0x32')](handleError(_0x3cec69,null));};exports[_0x34e0('0x33')]=function(_0x384a5b,_0x1869fb){if(_0x384a5b['body']['id']){delete _0x384a5b[_0x34e0('0x34')]['id'];}return db[_0x34e0('0x27')]['find']({'where':{'id':_0x384a5b[_0x34e0('0x35')]['id']}})[_0x34e0('0x21')](handleEntityNotFound(_0x1869fb,null))[_0x34e0('0x21')](function(_0x3231c0){var _0x4efbd4=_0x3231c0[_0x34e0('0x36')]({'plain':!![]});return utilLicense[_0x34e0('0x37')](_0x4efbd4,_0x384a5b[_0x34e0('0x34')]['key']);})[_0x34e0('0x21')](function(_0x1931da){if(!_0x1931da[_0x34e0('0x38')]){return saveUpdates(_0x384a5b[_0x34e0('0x34')],null);}return _0x1931da;})['then'](respondWithResult(_0x1869fb,null))[_0x34e0('0x32')](handleError(_0x1869fb,null));};exports['downloadLogFile']=function(_0x2b9136,_0x15ddca){var _0x5e3368=_0x34e0('0x39');var _0x45c38c=path[_0x34e0('0x3a')](_0x34e0('0x3b'),_0x34e0('0x3c'),'xcally',_0x5e3368);_0x15ddca[_0x34e0('0x3d')](_0x34e0('0x3e'),_0x34e0('0x3f')+_0x5e3368);_0x15ddca['set'](_0x34e0('0x40'),_0x34e0('0x41'));_0x15ddca[_0x34e0('0x42')](_0x45c38c);}; \ No newline at end of file +var _0x1fd8=['Content-Type','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','sendStatus','error','stack','name','send','../../config/license/util','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','getLicense','catch','find','params','then','get','checkLicense','body','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition'];(function(_0x58197a,_0x289ca2){var _0x21e74e=function(_0x3bb8a6){while(--_0x3bb8a6){_0x58197a['push'](_0x58197a['shift']());}};_0x21e74e(++_0x289ca2);}(_0x1fd8,0x14c));var _0x81fd=function(_0x60d3b8,_0x2ed654){_0x60d3b8=_0x60d3b8-0x0;var _0x210f34=_0x1fd8[_0x60d3b8];return _0x210f34;};'use strict';var emlformat=require(_0x81fd('0x0'));var rimraf=require(_0x81fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81fd('0x2'));var rp=require(_0x81fd('0x3'));var moment=require('moment');var BPromise=require(_0x81fd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x81fd('0x5'));var sox=require(_0x81fd('0x6'));var csv=require('to-csv');var ejs=require(_0x81fd('0x7'));var fs=require('fs');var fs_extra=require(_0x81fd('0x8'));var _=require(_0x81fd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81fd('0xa'));var toCsv=require(_0x81fd('0xb'));var querystring=require('querystring');var Papa=require(_0x81fd('0xc'));var Redis=require('ioredis');var authService=require(_0x81fd('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x81fd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81fd('0xf'))('api');var utils=require(_0x81fd('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81fd('0x11'))['db'];function respondWithStatusCode(_0x340478,_0x4e6971){_0x4e6971=_0x4e6971||0xcc;return function(_0x2342fd){if(_0x2342fd){return _0x340478['sendStatus'](_0x4e6971);}return _0x340478[_0x81fd('0x12')](_0x4e6971)[_0x81fd('0x13')]();};}function respondWithResult(_0x2039ed,_0x1c722a){_0x1c722a=_0x1c722a||0xc8;return function(_0x2b5834){if(_0x2b5834){return _0x2039ed[_0x81fd('0x12')](_0x1c722a)[_0x81fd('0x14')](_0x2b5834);}};}function respondWithFilteredResult(_0x1dde78,_0x489078){return function(_0x30a326){if(_0x30a326){var _0x175231=typeof _0x489078[_0x81fd('0x15')]===_0x81fd('0x16')&&typeof _0x489078[_0x81fd('0x17')]===_0x81fd('0x16');var _0xe1a93e=_0x30a326['count'];var _0x4cc46b=_0x175231?0x0:_0x489078['offset'];var _0x4e294a=_0x175231?_0x30a326[_0x81fd('0x18')]:_0x489078[_0x81fd('0x15')]+_0x489078['limit'];var _0x4f7610;if(_0x4e294a>=_0xe1a93e){_0x4e294a=_0xe1a93e;_0x4f7610=0xc8;}else{_0x4f7610=0xce;}_0x1dde78['status'](_0x4f7610);return _0x1dde78[_0x81fd('0x19')](_0x81fd('0x1a'),_0x4cc46b+'-'+_0x4e294a+'/'+_0xe1a93e)[_0x81fd('0x14')](_0x30a326);}return null;};}function patchUpdates(_0x3602e7){return function(_0x2d082d){try{jsonpatch['apply'](_0x2d082d,_0x3602e7,!![]);}catch(_0x2fa6ba){return BPromise[_0x81fd('0x1b')](_0x2fa6ba);}return _0x2d082d['save']();};}function saveUpdates(_0x4734fb,_0x58c3b5){return function(_0x7481a6){if(_0x7481a6){return _0x7481a6[_0x81fd('0x1c')](_0x4734fb)['then'](function(_0xe55fe5){return _0xe55fe5;});}return null;};}function removeEntity(_0x133ab5,_0x5e060d){return function(_0x35c4c1){if(_0x35c4c1){return _0x35c4c1[_0x81fd('0x1d')]()['then'](function(){_0x133ab5[_0x81fd('0x12')](0xcc)[_0x81fd('0x13')]();});}};}function handleEntityNotFound(_0x312629,_0x548438){return function(_0x4d02c2){if(!_0x4d02c2){_0x312629[_0x81fd('0x1e')](0x194);}return _0x4d02c2;};}function handleError(_0x4c7d74,_0xe5034){_0xe5034=_0xe5034||0x1f4;return function(_0x2f3d79){logger[_0x81fd('0x1f')](_0x2f3d79[_0x81fd('0x20')]);if(_0x2f3d79[_0x81fd('0x21')]){delete _0x2f3d79[_0x81fd('0x21')];}_0x4c7d74[_0x81fd('0x12')](_0xe5034)[_0x81fd('0x22')](_0x2f3d79);};}var utilLicense=require(_0x81fd('0x23'));exports['index']=function(_0x28b802,_0xf75b1b){var _0x26194b={'raw':!![],'where':{'id':0x1}},_0x307734={};_0x307734['model']=_[_0x81fd('0x24')](db['License'][_0x81fd('0x25')]);_0x307734[_0x81fd('0x26')]=_[_0x81fd('0x24')](_0x28b802[_0x81fd('0x26')]);_0x307734[_0x81fd('0x27')]=_[_0x81fd('0x28')](_0x307734[_0x81fd('0x29')],_0x307734[_0x81fd('0x26')]);_0x26194b[_0x81fd('0x2a')]=_[_0x81fd('0x28')](_0x307734['model'],qs['fields'](_0x28b802[_0x81fd('0x26')][_0x81fd('0x2b')]));_0x26194b[_0x81fd('0x2a')]=_0x26194b[_0x81fd('0x2a')][_0x81fd('0x2c')]?_0x26194b[_0x81fd('0x2a')]:_0x307734[_0x81fd('0x29')];_0x26194b=_['merge']({},_0x26194b,_0x28b802[_0x81fd('0x2d')]);return utilLicense[_0x81fd('0x2e')](_0x26194b)['then'](respondWithResult(_0xf75b1b,null))[_0x81fd('0x2f')](handleError(_0xf75b1b,null));};exports[_0x81fd('0x1c')]=function(_0x3789a8,_0x50a5f6){if(_0x3789a8['body']['id']){delete _0x3789a8['body']['id'];}return db['License'][_0x81fd('0x30')]({'where':{'id':_0x3789a8[_0x81fd('0x31')]['id']}})[_0x81fd('0x32')](handleEntityNotFound(_0x50a5f6,null))[_0x81fd('0x32')](function(_0x39a994){var _0x2c2549=_0x39a994[_0x81fd('0x33')]({'plain':!![]});return utilLicense[_0x81fd('0x34')](_0x2c2549,_0x3789a8[_0x81fd('0x35')][_0x81fd('0x36')]);})[_0x81fd('0x32')](function(_0x19be0a){if(!_0x19be0a[_0x81fd('0x37')]){return saveUpdates(_0x3789a8[_0x81fd('0x35')],null);}return _0x19be0a;})[_0x81fd('0x32')](respondWithResult(_0x50a5f6,null))['catch'](handleError(_0x50a5f6,null));};exports[_0x81fd('0x38')]=function(_0x57a93d,_0x26f0da){var _0x3ca1ad=_0x81fd('0x39');var _0x58ebe6=path[_0x81fd('0x3a')](_0x81fd('0x3b'),_0x81fd('0x3c'),_0x81fd('0x3d'),_0x3ca1ad);_0x26f0da[_0x81fd('0x3e')](_0x81fd('0x3f'),'attachment;\x20filename='+_0x3ca1ad);_0x26f0da[_0x81fd('0x19')](_0x81fd('0x40'),'text/plain');_0x26f0da[_0x81fd('0x41')](_0x58ebe6);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c7cb708..f9d709e 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 _0x9bac=['exports','define','license','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x17d090,_0x4fc0c7){var _0x1c89b8=function(_0x22b90a){while(--_0x22b90a){_0x17d090['push'](_0x17d090['shift']());}};_0x1c89b8(++_0x4fc0c7);}(_0x9bac,0x1e7));var _0xc9ba=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9bac[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc9ba('0x0'));var util=require('util');var logger=require(_0xc9ba('0x1'))('api');var moment=require(_0xc9ba('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9ba('0x3'));var fs=require('fs');var path=require(_0xc9ba('0x4'));var rimraf=require(_0xc9ba('0x5'));var config=require(_0xc9ba('0x6'));var attributes=require(_0xc9ba('0x7'));module[_0xc9ba('0x8')]=function(_0x4ade1e,_0x42153b){return _0x4ade1e[_0xc9ba('0x9')]('License',attributes,{'tableName':_0xc9ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eca=['./license.attributes','exports','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x5eca,0x138));var _0xa5ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5eca[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa5ec('0x0'));var util=require(_0xa5ec('0x1'));var logger=require(_0xa5ec('0x2'))(_0xa5ec('0x3'));var moment=require('moment');var BPromise=require(_0xa5ec('0x4'));var rp=require(_0xa5ec('0x5'));var fs=require('fs');var path=require(_0xa5ec('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5ec('0x7'));module[_0xa5ec('0x8')]=function(_0x120bac,_0x2f3887){return _0x120bac['define'](_0xa5ec('0x9'),attributes,{'tableName':_0xa5ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 262788a..a849be9 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 _0x574d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x574d,0x1a4));var _0xd574=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x574d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var moment=require('moment');var BPromise=require(_0xd574('0x2'));var rs=require(_0xd574('0x3'));var fs=require('fs');var Redis=require(_0xd574('0x4'));var db=require(_0xd574('0x5'))['db'];var utils=require(_0xd574('0x6'));var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd574('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a363f,_0x5165b0,_0x55649a){return new BPromise(function(_0x2ca032,_0x476e48){return client[_0xd574('0xa')](_0x2a363f,_0x55649a)[_0xd574('0xb')](function(_0x3e9dce){logger[_0xd574('0xc')](_0xd574('0xd'),_0x5165b0,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x5165b0,_0xd574('0xe'),JSON[_0xd574('0xf')](_0x3e9dce));if(_0x3e9dce[_0xd574('0x10')]){if(_0x3e9dce['error'][_0xd574('0x11')]===0x1f4){logger[_0xd574('0x10')]('License,\x20%s,\x20%s',_0x5165b0,_0x3e9dce[_0xd574('0x10')][_0xd574('0x12')]);return _0x476e48(_0x3e9dce['error']['message']);}logger['error'](_0xd574('0xd'),_0x5165b0,_0x3e9dce[_0xd574('0x10')]['message']);return _0x2ca032(_0x3e9dce[_0xd574('0x10')]['message']);}else{logger[_0xd574('0xc')](_0xd574('0xd'),_0x5165b0,_0xd574('0xe'));_0x2ca032(_0x3e9dce['result'][_0xd574('0x12')]);}})[_0xd574('0x13')](function(_0xe090d1){logger['error'](_0xd574('0xd'),_0x5165b0,_0xe090d1);_0x476e48(_0xe090d1);});});} \ No newline at end of file +var _0xc572=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent'];(function(_0x333195,_0x366608){var _0x2e44de=function(_0x5c1dd7){while(--_0x5c1dd7){_0x333195['push'](_0x333195['shift']());}};_0x2e44de(++_0x366608);}(_0xc572,0xe5));var _0x2c57=function(_0x937506,_0x32072c){_0x937506=_0x937506-0x0;var _0x5d6d09=_0xc572[_0x937506];return _0x5d6d09;};'use strict';var _=require(_0x2c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c57('0x1'));var fs=require('fs');var Redis=require(_0x2c57('0x2'));var db=require(_0x2c57('0x3'))['db'];var utils=require(_0x2c57('0x4'));var logger=require(_0x2c57('0x5'))(_0x2c57('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c57('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a322d,_0x142d12,_0xfcc5da){return new BPromise(function(_0xcec0f3,_0x5b1322){return client['request'](_0x3a322d,_0xfcc5da)[_0x2c57('0x8')](function(_0x4f0dff){logger[_0x2c57('0x9')]('License,\x20%s,\x20%s',_0x142d12,_0x2c57('0xa'));logger[_0x2c57('0xb')](_0x2c57('0xc'),_0x142d12,_0x2c57('0xa'),JSON[_0x2c57('0xd')](_0x4f0dff));if(_0x4f0dff[_0x2c57('0xe')]){if(_0x4f0dff[_0x2c57('0xe')][_0x2c57('0xf')]===0x1f4){logger['error'](_0x2c57('0x10'),_0x142d12,_0x4f0dff[_0x2c57('0xe')]['message']);return _0x5b1322(_0x4f0dff['error'][_0x2c57('0x11')]);}logger[_0x2c57('0xe')](_0x2c57('0x10'),_0x142d12,_0x4f0dff[_0x2c57('0xe')]['message']);return _0xcec0f3(_0x4f0dff['error']['message']);}else{logger[_0x2c57('0x9')](_0x2c57('0x10'),_0x142d12,_0x2c57('0xa'));_0xcec0f3(_0x4f0dff[_0x2c57('0x12')]['message']);}})[_0x2c57('0x13')](function(_0x5484f7){logger[_0x2c57('0xe')]('License,\x20%s,\x20%s',_0x142d12,_0x5484f7);_0x5b1322(_0x5484f7);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b38084f..887d9d4 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 _0xc2ce=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','create','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','/:id','update','removeDispositions','delete','removeImap','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x2d19b1,_0x19cde7){var _0x4adf28=function(_0x13e531){while(--_0x13e531){_0x2d19b1['push'](_0x2d19b1['shift']());}};_0x4adf28(++_0x19cde7);}(_0xc2ce,0x10c));var _0xec2c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc2ce[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xec2c('0x0'));var util=require(_0xec2c('0x1'));var path=require(_0xec2c('0x2'));var timeout=require(_0xec2c('0x3'));var express=require(_0xec2c('0x4'));var router=express[_0xec2c('0x5')]();var fs_extra=require(_0xec2c('0x6'));var auth=require(_0xec2c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xec2c('0x8'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xec2c('0x9')](),controller[_0xec2c('0xa')]);router[_0xec2c('0xb')](_0xec2c('0xc'),auth[_0xec2c('0x9')](),controller[_0xec2c('0xd')]);router[_0xec2c('0xb')]('/:id',auth[_0xec2c('0x9')](),controller[_0xec2c('0xe')]);router[_0xec2c('0xb')](_0xec2c('0xf'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x10')]);router[_0xec2c('0xb')](_0xec2c('0x11'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x12')]);router[_0xec2c('0xb')](_0xec2c('0x13'),auth[_0xec2c('0x9')](),controller['getImap']);router[_0xec2c('0xb')]('/:id/out_servers',auth[_0xec2c('0x9')](),controller[_0xec2c('0x14')]);router[_0xec2c('0xb')](_0xec2c('0x15'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x16')]);router[_0xec2c('0xb')](_0xec2c('0x17'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x18')]);router['get'](_0xec2c('0x19'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x1a')]);router['get'](_0xec2c('0x1b'),auth[_0xec2c('0x9')](),controller['verifySmtp']);router[_0xec2c('0xb')](_0xec2c('0x1c'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x1d')]);router['post'](_0xec2c('0xf'),auth['isAuthenticated'](),controller[_0xec2c('0x1e')]);router[_0xec2c('0x1f')](_0xec2c('0x11'),auth[_0xec2c('0x9')](),controller['addAnswer']);router[_0xec2c('0x1f')]('/',auth['isAuthenticated'](),controller[_0xec2c('0x20')]);router[_0xec2c('0x1f')](_0xec2c('0x13'),auth[_0xec2c('0x9')](),controller['addImap']);router[_0xec2c('0x1f')](_0xec2c('0x21'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x22')]);router[_0xec2c('0x1f')](_0xec2c('0x15'),auth['isAuthenticated'](),controller[_0xec2c('0x23')]);router[_0xec2c('0x1f')](_0xec2c('0x17'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x24')]);router[_0xec2c('0x1f')](_0xec2c('0x25'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x26')]);router['post'](_0xec2c('0x1c'),auth['isAuthenticated'](),controller[_0xec2c('0x27')]);router['put'](_0xec2c('0x28'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x29')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xec2c('0x2a')]);router['delete'](_0xec2c('0x11'),auth[_0xec2c('0x9')](),controller['removeAnswers']);router[_0xec2c('0x2b')](_0xec2c('0x13'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x2c')]);router['delete'](_0xec2c('0x21'),auth[_0xec2c('0x9')](),controller['removeSmtp']);router[_0xec2c('0x2b')](_0xec2c('0x28'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x2d')]);router['delete'](_0xec2c('0x1c'),auth[_0xec2c('0x9')](),controller[_0xec2c('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x083b=['/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','destroy','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers'];(function(_0xd79240,_0x5c9f09){var _0x4645dc=function(_0x41cfbc){while(--_0x41cfbc){_0xd79240['push'](_0xd79240['shift']());}};_0x4645dc(++_0x5c9f09);}(_0x083b,0x194));var _0xb083=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x083b[_0x57486e];return _0x5f110b;};'use strict';var multer=require(_0xb083('0x0'));var util=require(_0xb083('0x1'));var path=require(_0xb083('0x2'));var timeout=require('connect-timeout');var express=require(_0xb083('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb083('0x4'));var interaction=require(_0xb083('0x5'));var config=require(_0xb083('0x6'));var controller=require(_0xb083('0x7'));router[_0xb083('0x8')]('/',auth['isAuthenticated'](),controller[_0xb083('0x9')]);router[_0xb083('0x8')](_0xb083('0xa'),auth[_0xb083('0xb')](),controller[_0xb083('0xc')]);router[_0xb083('0x8')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller['show']);router[_0xb083('0x8')](_0xb083('0xe'),auth[_0xb083('0xb')](),controller[_0xb083('0xf')]);router[_0xb083('0x8')](_0xb083('0x10'),auth['isAuthenticated'](),controller[_0xb083('0x11')]);router['get'](_0xb083('0x12'),auth[_0xb083('0xb')](),controller['getImap']);router[_0xb083('0x8')](_0xb083('0x13'),auth[_0xb083('0xb')](),controller[_0xb083('0x14')]);router[_0xb083('0x8')](_0xb083('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb083('0x8')](_0xb083('0x16'),auth['isAuthenticated'](),controller[_0xb083('0x17')]);router['get'](_0xb083('0x18'),auth[_0xb083('0xb')](),controller[_0xb083('0x19')]);router[_0xb083('0x8')](_0xb083('0x1a'),auth[_0xb083('0xb')](),controller[_0xb083('0x1b')]);router[_0xb083('0x8')](_0xb083('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb083('0x1d')](_0xb083('0xe'),auth['isAuthenticated'](),controller[_0xb083('0x1e')]);router[_0xb083('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xb083('0x1d')]('/',auth[_0xb083('0xb')](),controller[_0xb083('0x1f')]);router[_0xb083('0x1d')](_0xb083('0x12'),auth['isAuthenticated'](),controller[_0xb083('0x20')]);router[_0xb083('0x1d')](_0xb083('0x13'),auth[_0xb083('0xb')](),controller[_0xb083('0x21')]);router[_0xb083('0x1d')]('/:id/interactions',auth[_0xb083('0xb')](),controller[_0xb083('0x22')]);router[_0xb083('0x1d')](_0xb083('0x16'),auth[_0xb083('0xb')](),controller[_0xb083('0x23')]);router[_0xb083('0x1d')](_0xb083('0x24'),auth[_0xb083('0xb')](),controller[_0xb083('0x25')]);router['post'](_0xb083('0x1c'),auth[_0xb083('0xb')](),controller[_0xb083('0x26')]);router[_0xb083('0x27')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller[_0xb083('0x28')]);router['delete']('/:id/dispositions',auth[_0xb083('0xb')](),controller[_0xb083('0x29')]);router[_0xb083('0x2a')]('/:id/canned_answers',auth[_0xb083('0xb')](),controller[_0xb083('0x2b')]);router[_0xb083('0x2a')](_0xb083('0x12'),auth[_0xb083('0xb')](),controller[_0xb083('0x2c')]);router['delete'](_0xb083('0x13'),auth[_0xb083('0xb')](),controller['removeSmtp']);router[_0xb083('0x2a')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller[_0xb083('0x2d')]);router[_0xb083('0x2a')](_0xb083('0x1c'),auth[_0xb083('0xb')](),controller[_0xb083('0x2e')]);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 503ce5f..90412ac 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 _0xbe59=['mandatoryDispositionPauseId','mandatoryDisposition','gmail','yahoo','outlook365','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x2676cf,_0x509894){var _0x5263b6=function(_0x1a516b){while(--_0x1a516b){_0x2676cf['push'](_0x2676cf['shift']());}};_0x5263b6(++_0x509894);}(_0xbe59,0x15c));var _0x9be5=function(_0x2307e9,_0x322f88){_0x2307e9=_0x2307e9-0x0;var _0x26ea20=_0xbe59[_0x2307e9];return _0x26ea20;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9be5('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9be5('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x9be5('0x2')]},'markAsUnread':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9be5('0x3')},'fontSize':{'type':Sequelize[_0x9be5('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9be5('0x2')],'defaultValue':function(){return _0x9be5('0x5');}},'notificationSound':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9be5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9be5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9be5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9be5('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x9be5('0x1')],'defaultValue':![],'comment':_0x9be5('0x7'),'set':function(_0x958101){if(!_0x958101)this[_0x9be5('0x8')](_0x9be5('0x9'),null);this[_0x9be5('0x8')](_0x9be5('0xa'),_0x958101);}},'provider':{'type':Sequelize['ENUM'](_0x9be5('0xb'),'hotmail',_0x9be5('0xc'),_0x9be5('0xd')),'defaultValue':null,'get':function(){if(!this[_0x9be5('0xe')](_0x9be5('0xf')))return _0x9be5('0x10');return this[_0x9be5('0xe')](_0x9be5('0xf'));},'set':function(_0x532ca7){if(_0x532ca7==='custom')_0x532ca7=null;return this[_0x9be5('0x8')](_0x9be5('0xf'),_0x532ca7);}}}; \ No newline at end of file +var _0x7ac2=['STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x1d4588,_0x62252a){var _0x196081=function(_0x2d3c6b){while(--_0x2d3c6b){_0x1d4588['push'](_0x1d4588['shift']());}};_0x196081(++_0x62252a);}(_0x7ac2,0x142));var _0x27ac=function(_0x2dd9b3,_0x1a705a){_0x2dd9b3=_0x2dd9b3-0x0;var _0x16db12=_0x7ac2[_0x2dd9b3];return _0x16db12;};'use strict';var Sequelize=require(_0x27ac('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x27ac('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x27ac('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x27ac('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x27ac('0x3')],'defaultValue':function(){return _0x27ac('0x4');}},'notificationSound':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x27ac('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x27ac('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![],'comment':_0x27ac('0x7'),'set':function(_0x4425d8){if(!_0x4425d8)this['setDataValue'](_0x27ac('0x8'),null);this[_0x27ac('0x9')]('mandatoryDisposition',_0x4425d8);}},'provider':{'type':Sequelize[_0x27ac('0xa')](_0x27ac('0xb'),'hotmail',_0x27ac('0xc'),_0x27ac('0xd')),'defaultValue':null,'get':function(){if(!this[_0x27ac('0xe')](_0x27ac('0xf')))return _0x27ac('0x10');return this[_0x27ac('0xe')](_0x27ac('0xf'));},'set':function(_0x5dddac){if(_0x5dddac==='custom')_0x5dddac=null;return this['setDataValue']('provider',_0x5dddac);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 49527bd..5ae5566 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 _0xc8c5=['redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','debug','stringify','error','code','message','MailAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','pass','Imap','Smtp','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','MailServerIn','Pause','keys','include','find','update','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','create','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','emit','removeAgents','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults'];(function(_0x735aed,_0x360ce4){var _0x368895=function(_0x5478b6){while(--_0x5478b6){_0x735aed['push'](_0x735aed['shift']());}};_0x368895(++_0x360ce4);}(_0xc8c5,0xb1));var _0x5c8c=function(_0x12e073,_0x2a6387){_0x12e073=_0x12e073-0x0;var _0x17e67b=_0xc8c5[_0x12e073];return _0x17e67b;};'use strict';var moment=require('moment');var BPromise=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var path=require(_0x5c8c('0x2'));var _=require(_0x5c8c('0x3'));var juice=require(_0x5c8c('0x4'));var Redis=require(_0x5c8c('0x5'));var qs=require(_0x5c8c('0x6'));var logger=require('../../config/logger')(_0x5c8c('0x7'));var config=require('../../config/environment');var db=require(_0x5c8c('0x8'))['db'];config['redis']=_[_0x5c8c('0x9')](config[_0x5c8c('0xa')],{'host':_0x5c8c('0xb'),'port':0x18eb});var socket=require(_0x5c8c('0xc'))(new Redis(config[_0x5c8c('0xa')]));require(_0x5c8c('0xd'))[_0x5c8c('0xe')](socket);var jayson=require(_0x5c8c('0xf'));var client=jayson[_0x5c8c('0x10')][_0x5c8c('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x2b2346,_0x5645df,_0x4fa0a2,_0x1cbe04){return new BPromise(function(_0x30a249,_0x2675a3){var _0x483d65=_0x1cbe04||client;return _0x483d65[_0x5c8c('0x12')](_0x2b2346,_0x4fa0a2)[_0x5c8c('0x13')](function(_0x105446){logger['info']('MailAccount,\x20%s,\x20%s',_0x5645df,'request\x20sent');logger[_0x5c8c('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5645df,'request\x20sent',JSON[_0x5c8c('0x15')](_0x105446));if(_0x105446[_0x5c8c('0x16')]){if(_0x105446[_0x5c8c('0x16')][_0x5c8c('0x17')]===0x1f4){logger[_0x5c8c('0x16')]('MailAccount,\x20%s,\x20%s',_0x5645df,_0x105446[_0x5c8c('0x16')][_0x5c8c('0x18')]);return _0x2675a3(_0x105446['error'][_0x5c8c('0x18')]);}logger[_0x5c8c('0x16')](_0x5c8c('0x19'),_0x5645df,_0x105446[_0x5c8c('0x16')][_0x5c8c('0x18')]);return _0x30a249(_0x105446[_0x5c8c('0x16')]['message']);}else{logger[_0x5c8c('0x1a')](_0x5c8c('0x19'),_0x5645df,_0x5c8c('0x1b'));_0x30a249(_0x105446[_0x5c8c('0x1c')][_0x5c8c('0x18')]);}})[_0x5c8c('0x1d')](function(_0x18f95){logger[_0x5c8c('0x16')]('MailAccount,\x20%s,\x20%s',_0x5645df,_0x18f95);_0x2675a3(_0x18f95);});});}function respondWithStatusCode(_0x586713,_0x5a0b8c){_0x5a0b8c=_0x5a0b8c||0xcc;return function(_0x36b1dc){if(_0x36b1dc){return _0x586713[_0x5c8c('0x1e')](_0x5a0b8c);}return _0x586713[_0x5c8c('0x1f')](_0x5a0b8c)[_0x5c8c('0x20')]();};}function respondWithResult(_0xd0cb4,_0x31a37f){_0x31a37f=_0x31a37f||0xc8;return function(_0x38e828){if(_0x38e828){return _0xd0cb4[_0x5c8c('0x1f')](_0x31a37f)[_0x5c8c('0x21')](_0x38e828);}};}function respondWithFilteredResult(_0x2a84cc,_0x58a466){return function(_0x348903){if(_0x348903){var _0x4e3be3=typeof _0x58a466[_0x5c8c('0x22')]===_0x5c8c('0x23')&&typeof _0x58a466[_0x5c8c('0x24')]===_0x5c8c('0x23');var _0x2d3bb3=_0x348903[_0x5c8c('0x25')];var _0xcc0819=_0x4e3be3?0x0:_0x58a466[_0x5c8c('0x22')];var _0x46fd59=_0x4e3be3?_0x348903[_0x5c8c('0x25')]:_0x58a466[_0x5c8c('0x22')]+_0x58a466['limit'];var _0x4750d4;if(_0x46fd59>=_0x2d3bb3){_0x46fd59=_0x2d3bb3;_0x4750d4=0xc8;}else{_0x4750d4=0xce;}_0x2a84cc['status'](_0x4750d4);return _0x2a84cc['set']('Content-Range',_0xcc0819+'-'+_0x46fd59+'/'+_0x2d3bb3)[_0x5c8c('0x21')](_0x348903);}return null;};}function saveUpdates(_0x2f28f5){return function(_0x490761){if(_0x490761){return _0x490761['update'](_0x2f28f5)[_0x5c8c('0x13')](function(_0x537241){return _0x537241;});}return null;};}function removeEntity(_0x282744){return function(_0x9a1022){if(_0x9a1022){return _0x9a1022[_0x5c8c('0x26')]()[_0x5c8c('0x13')](function(){var _0x2aa23c=_0x9a1022[_0x5c8c('0x27')]({'plain':!![]});var _0x403b02=_0x5c8c('0x28');return db[_0x5c8c('0x29')][_0x5c8c('0x26')]({'where':{'type':_0x403b02,'resourceId':_0x2aa23c['id']}})[_0x5c8c('0x13')](function(){return _0x9a1022;});})[_0x5c8c('0x13')](function(){_0x282744['status'](0xcc)[_0x5c8c('0x20')]();});}};}function handleEntityNotFound(_0x5ddc85){return function(_0x41850b){if(!_0x41850b){_0x5ddc85[_0x5c8c('0x1e')](0x194);}return _0x41850b;};}function handleError(_0x3ccab4,_0x2cc341){_0x2cc341=_0x2cc341||0x1f4;return function(_0x2b335e){logger[_0x5c8c('0x16')](_0x2b335e[_0x5c8c('0x2a')]);if(_0x2b335e[_0x5c8c('0x2b')]){delete _0x2b335e['name'];}_0x3ccab4['status'](_0x2cc341)[_0x5c8c('0x2c')](_0x2b335e);};}function getImapHost(_0x45a3ff){switch(_0x45a3ff){case _0x5c8c('0x2d'):return'imap.gmail.com';case _0x5c8c('0x2e'):return _0x5c8c('0x2f');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x45a3ff);}function getSmtpHost(_0x19773e){switch(_0x19773e){case _0x5c8c('0x2d'):return _0x5c8c('0x30');case _0x5c8c('0x2e'):return _0x5c8c('0x31');case _0x5c8c('0x32'):return _0x5c8c('0x33');case _0x5c8c('0x34'):return _0x5c8c('0x35');}throw new Error(_0x5c8c('0x36'),_0x19773e);}function getAuthenticationOptions(_0x3b7920,_0x1733fb){var _0x3714ea={};var _0xcaaa84={};if(_0x3b7920){_0x3714ea['user']=_0xcaaa84[_0x5c8c('0x37')]=_0x1733fb['username'];_0x3714ea['password']=_0xcaaa84['pass']=_0x1733fb[_0x5c8c('0x38')];if(_0x1733fb[_0x5c8c('0x39')]){_0x3714ea[_0x5c8c('0x39')]=_0xcaaa84[_0x5c8c('0x39')]=!![];_0x3714ea['CloudProviderId']=_0xcaaa84[_0x5c8c('0x3a')]=_0x1733fb['CloudProviderId'];_0x3714ea[_0x5c8c('0x38')]=_0xcaaa84['pass']=null;}else{_0x3714ea['CloudProviderId']=_0xcaaa84[_0x5c8c('0x3a')]=null;}_0x3714ea[_0x5c8c('0x3b')]=getImapHost(_0x3b7920);_0x3714ea['port']=0x3e1;_0xcaaa84[_0x5c8c('0x3b')]=getSmtpHost(_0x3b7920);_0xcaaa84[_0x5c8c('0x3c')]=0x24b;_0xcaaa84[_0x5c8c('0x3d')]=![];_0x3714ea[_0x5c8c('0x3e')]=_0xcaaa84[_0x5c8c('0x3e')]=null;}else{if(_0x1733fb[_0x5c8c('0x3f')]){_0x3714ea[_0x5c8c('0x37')]=_0xcaaa84[_0x5c8c('0x37')]=_0x1733fb[_0x5c8c('0x40')];_0x3714ea[_0x5c8c('0x38')]=_0xcaaa84['pass']=_0x1733fb[_0x5c8c('0x38')];}else{_0x3714ea['authentication']=_0xcaaa84[_0x5c8c('0x3f')]=![];_0x3714ea[_0x5c8c('0x37')]=_0xcaaa84[_0x5c8c('0x37')]=null;_0x3714ea[_0x5c8c('0x38')]=_0xcaaa84[_0x5c8c('0x41')]=null;}_0x3714ea[_0x5c8c('0x3b')]=_0x1733fb[_0x5c8c('0x42')][_0x5c8c('0x3b')];_0x3714ea[_0x5c8c('0x3c')]=_0x1733fb['Imap'][_0x5c8c('0x3c')];_0xcaaa84[_0x5c8c('0x3b')]=_0x1733fb[_0x5c8c('0x43')]['host'];_0xcaaa84[_0x5c8c('0x3c')]=_0x1733fb[_0x5c8c('0x43')][_0x5c8c('0x3c')];}return{'Imap':_0x3714ea,'Smtp':_0xcaaa84};}exports['index']=function(_0xfe2c93,_0x47b366){var _0x28d3a7={'include':[{'model':db['MailServerIn'],'as':_0x5c8c('0x42')},{'model':db[_0x5c8c('0x44')],'as':_0x5c8c('0x43')},{'model':db['Pause'],'as':_0x5c8c('0x45')}]},_0x4336ad={},_0x561c9d={'count':0x0,'rows':[]};var _0x5c7eda=_[_0x5c8c('0x46')](db[_0x5c8c('0x47')][_0x5c8c('0x48')],function(_0x35ff0a){return{'name':_0x35ff0a[_0x5c8c('0x49')],'type':_0x35ff0a[_0x5c8c('0x4a')][_0x5c8c('0x4b')]};});_0x4336ad[_0x5c8c('0x4c')]=_[_0x5c8c('0x46')](_0x5c7eda,_0x5c8c('0x2b'));_0x4336ad[_0x5c8c('0x4d')]=_['keys'](_0xfe2c93[_0x5c8c('0x4d')]);_0x4336ad[_0x5c8c('0x4e')]=_[_0x5c8c('0x4f')](_0x4336ad[_0x5c8c('0x4c')],_0x4336ad['query']);_0x28d3a7[_0x5c8c('0x50')]=_[_0x5c8c('0x4f')](_0x4336ad[_0x5c8c('0x4c')],qs[_0x5c8c('0x51')](_0xfe2c93[_0x5c8c('0x4d')][_0x5c8c('0x51')]));_0x28d3a7[_0x5c8c('0x50')]=_0x28d3a7[_0x5c8c('0x50')][_0x5c8c('0x52')]?_0x28d3a7['attributes']:_0x4336ad[_0x5c8c('0x4c')];if(!_0xfe2c93[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x28d3a7[_0x5c8c('0x24')]=qs['limit'](_0xfe2c93[_0x5c8c('0x4d')]['limit']);_0x28d3a7[_0x5c8c('0x22')]=qs['offset'](_0xfe2c93[_0x5c8c('0x4d')]['offset']);}_0x28d3a7[_0x5c8c('0x55')]=qs['sort'](_0xfe2c93['query'][_0x5c8c('0x56')]);_0x28d3a7['where']=qs[_0x5c8c('0x4e')](_[_0x5c8c('0x57')](_0xfe2c93['query'],_0x4336ad['filters']),_0x5c7eda);if(_0xfe2c93[_0x5c8c('0x4d')][_0x5c8c('0x58')]){_0x28d3a7[_0x5c8c('0x59')]=_[_0x5c8c('0x5a')](_0x28d3a7[_0x5c8c('0x59')],{'$or':_[_0x5c8c('0x46')](_0x5c7eda,function(_0x2c1071){if(_0x2c1071[_0x5c8c('0x4a')]!==_0x5c8c('0x5b')){var _0x130ba5={};_0x130ba5[_0x2c1071['name']]={'$like':'%'+_0xfe2c93[_0x5c8c('0x4d')][_0x5c8c('0x58')]+'%'};return _0x130ba5;}})});}_0x28d3a7=_[_0x5c8c('0x5a')]({},_0x28d3a7,_0xfe2c93[_0x5c8c('0x5c')]);var _0x54e4c5={'where':_0x28d3a7[_0x5c8c('0x59')]};return db[_0x5c8c('0x47')][_0x5c8c('0x25')](_0x54e4c5)[_0x5c8c('0x13')](function(_0xca434c){_0x561c9d[_0x5c8c('0x25')]=_0xca434c;if(_0xfe2c93[_0x5c8c('0x4d')][_0x5c8c('0x5d')]){_0x28d3a7['include']=[{'all':!![]}];}return db[_0x5c8c('0x47')][_0x5c8c('0x5e')](_0x28d3a7);})['then'](function(_0x5df5b2){_0x561c9d[_0x5c8c('0x5f')]=_0x5df5b2;return _0x561c9d;})[_0x5c8c('0x13')](respondWithFilteredResult(_0x47b366,_0x28d3a7))[_0x5c8c('0x1d')](handleError(_0x47b366,null));};exports[_0x5c8c('0x60')]=function(_0x41ac81,_0x360b6d){var _0x1490b8={'raw':![],'where':{'id':_0x41ac81['params']['id']},'include':[{'model':db[_0x5c8c('0x61')],'as':_0x5c8c('0x42')},{'model':db[_0x5c8c('0x44')],'as':'Smtp'},{'model':db[_0x5c8c('0x62')],'as':_0x5c8c('0x45')}]},_0x3596c1={};_0x3596c1['model']=_[_0x5c8c('0x63')](db[_0x5c8c('0x47')][_0x5c8c('0x48')]);_0x3596c1['query']=_['keys'](_0x41ac81[_0x5c8c('0x4d')]);_0x3596c1['filters']=_[_0x5c8c('0x4f')](_0x3596c1['model'],_0x3596c1[_0x5c8c('0x4d')]);_0x1490b8[_0x5c8c('0x50')]=_['intersection'](_0x3596c1[_0x5c8c('0x4c')],qs[_0x5c8c('0x51')](_0x41ac81[_0x5c8c('0x4d')][_0x5c8c('0x51')]));_0x1490b8['attributes']=_0x1490b8[_0x5c8c('0x50')][_0x5c8c('0x52')]?_0x1490b8['attributes']:_0x3596c1[_0x5c8c('0x4c')];if(_0x41ac81[_0x5c8c('0x4d')]['includeAll']){_0x1490b8[_0x5c8c('0x64')]=[{'all':!![]}];}_0x1490b8=_[_0x5c8c('0x5a')]({},_0x1490b8,_0x41ac81['options']);return db['MailAccount'][_0x5c8c('0x65')](_0x1490b8)[_0x5c8c('0x13')](handleEntityNotFound(_0x360b6d,null))[_0x5c8c('0x13')](respondWithResult(_0x360b6d,null))['catch'](handleError(_0x360b6d,null));};exports[_0x5c8c('0x66')]=function(_0x40e899,_0x2dc10a){if(_0x40e899[_0x5c8c('0x67')]['id']){delete _0x40e899[_0x5c8c('0x67')]['id'];}var _0x3ff52c=_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x68')]===_0x5c8c('0x69')?null:_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x68')];var _0xaf32fb=_0x40e899['body'][_0x5c8c('0x42')]||{};var _0x2da69b=_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x43')]||{};if(_0x3ff52c){_0xaf32fb[_0x5c8c('0x3b')]=getImapHost(_0x3ff52c);_0xaf32fb['port']=0x3e1;_0x2da69b['host']=getSmtpHost(_0x3ff52c);_0x2da69b[_0x5c8c('0x3c')]=0x24b;_0x2da69b[_0x5c8c('0x3d')]=![];}if(_0x2da69b[_0x5c8c('0x39')]){_0x2da69b[_0x5c8c('0x3d')]=![];}else{_0x2da69b[_0x5c8c('0x3a')]=null;}if(!_0xaf32fb[_0x5c8c('0x39')])_0xaf32fb[_0x5c8c('0x3a')]=null;_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x42')]=_0xaf32fb;_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x43')]=_0x2da69b;return db[_0x5c8c('0x47')][_0x5c8c('0x65')]({'where':{'id':_0x40e899[_0x5c8c('0x6a')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x5c8c('0x44')],'as':_0x5c8c('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x5c8c('0x13')](handleEntityNotFound(_0x2dc10a,null))['then'](function(_0x33b224){if(!_0x33b224)throw new Error(_0x5c8c('0x6b'));if(_0x33b224[_0x5c8c('0x3e')])delete _0x40e899[_0x5c8c('0x67')]['Imap'];return _0x33b224;})[_0x5c8c('0x13')](saveUpdates(_0x40e899['body'],null))['then'](function(_0x5cb899){if(!_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x42')])return _0x5cb899;return db['MailServerIn'][_0x5c8c('0x66')](_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x42')],{'where':{'MailAccountId':_0x5cb899['id']}})[_0x5c8c('0x13')](function(){return _0x5cb899;});})[_0x5c8c('0x13')](function(_0x54fbb0){if(!_0x40e899[_0x5c8c('0x67')][_0x5c8c('0x43')])return _0x54fbb0;return db['MailServerOut'][_0x5c8c('0x66')](_0x40e899[_0x5c8c('0x67')]['Smtp'],{'where':{'MailAccountId':_0x54fbb0['id']}})[_0x5c8c('0x13')](function(){return _0x54fbb0;});})[_0x5c8c('0x13')](respondWithResult(_0x2dc10a,null))[_0x5c8c('0x1d')](handleError(_0x2dc10a,null));};exports[_0x5c8c('0x6c')]=function(_0x7e9f2,_0x4a9c0e){return db[_0x5c8c('0x47')][_0x5c8c('0x6c')]()[_0x5c8c('0x13')](respondWithResult(_0x4a9c0e,null))[_0x5c8c('0x1d')](handleError(_0x4a9c0e,null));};exports[_0x5c8c('0x6d')]=function(_0xa53b3,_0x2c2cdc){if(_0xa53b3[_0x5c8c('0x67')]['id']){delete _0xa53b3[_0x5c8c('0x67')]['id'];}return db[_0x5c8c('0x47')][_0x5c8c('0x65')]({'where':{'id':_0xa53b3[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x2c2cdc,null))['then'](function(_0x5f1e41){if(_0x5f1e41){_0xa53b3[_0x5c8c('0x67')][_0x5c8c('0x6e')]=_0x5f1e41['id'];return db['Disposition']['create'](_0xa53b3['body']);}})[_0x5c8c('0x13')](respondWithResult(_0x2c2cdc,null))[_0x5c8c('0x1d')](handleError(_0x2c2cdc,null));};exports[_0x5c8c('0x6f')]=function(_0x3674d1,_0x3a75a1){var _0x14ea2a={'raw':![],'where':{}};var _0x4b53c3={};var _0x50fa20={'count':0x0,'rows':[]};return db[_0x5c8c('0x47')][_0x5c8c('0x70')]({'where':{'id':_0x3674d1['params']['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x3a75a1,null))['then'](function(_0x175410){if(_0x175410){_0x4b53c3[_0x5c8c('0x4c')]=_[_0x5c8c('0x63')](db[_0x5c8c('0x71')][_0x5c8c('0x48')]);_0x4b53c3['query']=_[_0x5c8c('0x63')](_0x3674d1[_0x5c8c('0x4d')]);_0x4b53c3['filters']=_['intersection'](_0x4b53c3[_0x5c8c('0x4c')],_0x4b53c3[_0x5c8c('0x4d')]);_0x14ea2a['attributes']=_['intersection'](_0x4b53c3['model'],qs[_0x5c8c('0x51')](_0x3674d1[_0x5c8c('0x4d')]['fields']));_0x14ea2a['attributes']=_0x14ea2a[_0x5c8c('0x50')][_0x5c8c('0x52')]?_0x14ea2a[_0x5c8c('0x50')]:_0x4b53c3[_0x5c8c('0x4c')];if(!_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x14ea2a['limit']=qs[_0x5c8c('0x24')](_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x24')]);_0x14ea2a[_0x5c8c('0x22')]=qs['offset'](_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x22')]);}_0x14ea2a[_0x5c8c('0x55')]=qs['sort'](_0x3674d1['query'][_0x5c8c('0x56')]);_0x14ea2a[_0x5c8c('0x59')]=qs['filters'](_[_0x5c8c('0x57')](_0x3674d1[_0x5c8c('0x4d')],_0x4b53c3[_0x5c8c('0x4e')]));_0x14ea2a['where']['MailAccountId']=_0x175410['id'];if(_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x58')]){_0x14ea2a['where']=_[_0x5c8c('0x5a')](_0x14ea2a[_0x5c8c('0x59')],{'$or':_['map'](_0x14ea2a[_0x5c8c('0x50')],function(_0x4356d6){var _0x336597={};_0x336597[_0x4356d6]={'$like':'%'+_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x58')]+'%'};return _0x336597;})});}_0x14ea2a=_[_0x5c8c('0x5a')]({},_0x14ea2a,_0x3674d1[_0x5c8c('0x5c')]);return db[_0x5c8c('0x71')][_0x5c8c('0x25')]({'where':_0x14ea2a[_0x5c8c('0x59')]})['then'](function(_0x183dc8){_0x50fa20['count']=_0x183dc8;if(_0x3674d1[_0x5c8c('0x4d')][_0x5c8c('0x5d')]){_0x14ea2a[_0x5c8c('0x64')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x14ea2a);})[_0x5c8c('0x13')](function(_0x5db576){_0x50fa20[_0x5c8c('0x5f')]=_0x5db576;return _0x50fa20;});}})[_0x5c8c('0x13')](respondWithFilteredResult(_0x3a75a1,_0x14ea2a))[_0x5c8c('0x1d')](handleError(_0x3a75a1,null));};exports[_0x5c8c('0x72')]=function(_0x2b0b06,_0x3026f3){return db[_0x5c8c('0x47')][_0x5c8c('0x65')]({'where':{'id':_0x2b0b06[_0x5c8c('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3026f3,null))[_0x5c8c('0x13')](function(_0x34d968){if(_0x34d968){return _0x34d968[_0x5c8c('0x72')](_0x2b0b06[_0x5c8c('0x4d')][_0x5c8c('0x73')]);}})['then'](respondWithStatusCode(_0x3026f3,null))[_0x5c8c('0x1d')](handleError(_0x3026f3,null));};exports['addAnswer']=function(_0x3bdfa4,_0x2b6a86){if(_0x3bdfa4[_0x5c8c('0x67')]['id']){delete _0x3bdfa4[_0x5c8c('0x67')]['id'];}return db['MailAccount'][_0x5c8c('0x65')]({'where':{'id':_0x3bdfa4['params']['id']}})['then'](handleEntityNotFound(_0x2b6a86,null))['then'](function(_0x2eeca8){if(_0x2eeca8){_0x3bdfa4[_0x5c8c('0x67')]['MailAccountId']=_0x2eeca8['id'];return db['CannedAnswer'][_0x5c8c('0x74')](_0x3bdfa4[_0x5c8c('0x67')]);}})[_0x5c8c('0x13')](respondWithResult(_0x2b6a86,null))['catch'](handleError(_0x2b6a86,null));};exports[_0x5c8c('0x75')]=function(_0x3693ad,_0x2a5730){var _0x5851c8={'raw':![],'where':{}};var _0x16caef={};var _0x17c5c5={'count':0x0,'rows':[]};return db[_0x5c8c('0x47')][_0x5c8c('0x70')]({'where':{'id':_0x3693ad[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x2a5730,null))[_0x5c8c('0x13')](function(_0x13bd70){if(_0x13bd70){_0x16caef[_0x5c8c('0x4c')]=_[_0x5c8c('0x63')](db[_0x5c8c('0x76')][_0x5c8c('0x48')]);_0x16caef[_0x5c8c('0x4d')]=_[_0x5c8c('0x63')](_0x3693ad[_0x5c8c('0x4d')]);_0x16caef[_0x5c8c('0x4e')]=_[_0x5c8c('0x4f')](_0x16caef[_0x5c8c('0x4c')],_0x16caef[_0x5c8c('0x4d')]);_0x5851c8[_0x5c8c('0x50')]=_['intersection'](_0x16caef[_0x5c8c('0x4c')],qs[_0x5c8c('0x51')](_0x3693ad['query'][_0x5c8c('0x51')]));_0x5851c8[_0x5c8c('0x50')]=_0x5851c8['attributes'][_0x5c8c('0x52')]?_0x5851c8[_0x5c8c('0x50')]:_0x16caef['model'];if(!_0x3693ad[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x5851c8[_0x5c8c('0x24')]=qs['limit'](_0x3693ad['query'][_0x5c8c('0x24')]);_0x5851c8[_0x5c8c('0x22')]=qs[_0x5c8c('0x22')](_0x3693ad[_0x5c8c('0x4d')][_0x5c8c('0x22')]);}_0x5851c8[_0x5c8c('0x55')]=qs[_0x5c8c('0x56')](_0x3693ad[_0x5c8c('0x4d')][_0x5c8c('0x56')]);_0x5851c8[_0x5c8c('0x59')]=qs['filters'](_[_0x5c8c('0x57')](_0x3693ad['query'],_0x16caef['filters']));_0x5851c8[_0x5c8c('0x59')][_0x5c8c('0x6e')]=_0x13bd70['id'];if(_0x3693ad[_0x5c8c('0x4d')]['filter']){_0x5851c8['where']=_[_0x5c8c('0x5a')](_0x5851c8[_0x5c8c('0x59')],{'$or':_[_0x5c8c('0x46')](_0x5851c8['attributes'],function(_0x3df7c2){var _0x4047f7={};_0x4047f7[_0x3df7c2]={'$like':'%'+_0x3693ad[_0x5c8c('0x4d')]['filter']+'%'};return _0x4047f7;})});}_0x5851c8=_[_0x5c8c('0x5a')]({},_0x5851c8,_0x3693ad[_0x5c8c('0x5c')]);return db[_0x5c8c('0x76')][_0x5c8c('0x25')]({'where':_0x5851c8[_0x5c8c('0x59')]})[_0x5c8c('0x13')](function(_0x3bcad7){_0x17c5c5[_0x5c8c('0x25')]=_0x3bcad7;if(_0x3693ad[_0x5c8c('0x4d')][_0x5c8c('0x5d')]){_0x5851c8[_0x5c8c('0x64')]=[{'all':!![]}];}return db[_0x5c8c('0x76')][_0x5c8c('0x5e')](_0x5851c8);})[_0x5c8c('0x13')](function(_0x26f052){_0x17c5c5[_0x5c8c('0x5f')]=_0x26f052;return _0x17c5c5;});}})[_0x5c8c('0x13')](respondWithFilteredResult(_0x2a5730,_0x5851c8))[_0x5c8c('0x1d')](handleError(_0x2a5730,null));};exports[_0x5c8c('0x77')]=function(_0x45ef50,_0x5959e9){return db['MailAccount'][_0x5c8c('0x65')]({'where':{'id':_0x45ef50[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x5959e9,null))['then'](function(_0x3cd3ac){if(_0x3cd3ac){return _0x3cd3ac['removeAnswers'](_0x45ef50[_0x5c8c('0x4d')][_0x5c8c('0x73')]);}})[_0x5c8c('0x13')](respondWithStatusCode(_0x5959e9,null))[_0x5c8c('0x1d')](handleError(_0x5959e9,null));};exports['create']=function(_0x5e17f3,_0x59c82d){var _0x3f6ab6={'name':_0x5e17f3['body'][_0x5c8c('0x2b')],'key':_0x5e17f3[_0x5c8c('0x67')][_0x5c8c('0x4b')],'provider':_0x5e17f3[_0x5c8c('0x67')][_0x5c8c('0x68')]==='custom'?null:_0x5e17f3[_0x5c8c('0x67')]['provider'],'email':_0x5e17f3['body'][_0x5c8c('0x78')],'ListId':_0x5e17f3[_0x5c8c('0x67')][_0x5c8c('0x79')],'active':!_[_0x5c8c('0x7a')](_0x5e17f3['body'][_0x5c8c('0x7b')])?_0x5e17f3[_0x5c8c('0x67')][_0x5c8c('0x7b')]:!![],'description':_0x5e17f3['body'][_0x5c8c('0x7c')]||null};var _0x4b5fd7=getAuthenticationOptions(_0x3f6ab6[_0x5c8c('0x68')],_0x5e17f3[_0x5c8c('0x67')]);_0x3f6ab6[_0x5c8c('0x42')]=_0x4b5fd7[_0x5c8c('0x42')];_0x3f6ab6[_0x5c8c('0x43')]=_0x4b5fd7['Smtp'];return db[_0x5c8c('0x47')][_0x5c8c('0x74')](_0x3f6ab6,{'include':[{'model':db[_0x5c8c('0x44')],'as':_0x5c8c('0x43')},{'model':db[_0x5c8c('0x61')],'as':'Imap'}]})[_0x5c8c('0x13')](function(_0x5428f8){var _0x7158d4=_0x5e17f3[_0x5c8c('0x37')]['get']({'plain':!![]});if(!_0x7158d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7158d4[_0x5c8c('0x7d')]===_0x5c8c('0x37')){var _0x2cdb9b=_0x5428f8[_0x5c8c('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x5c8c('0x65')]({'where':{'name':_0x5c8c('0x28'),'userProfileId':_0x7158d4[_0x5c8c('0x7e')]},'raw':!![]})[_0x5c8c('0x13')](function(_0x13e130){if(_0x13e130&&_0x13e130[_0x5c8c('0x7f')]===0x0){return db[_0x5c8c('0x29')][_0x5c8c('0x74')]({'name':_0x2cdb9b['name'],'resourceId':_0x2cdb9b['id'],'type':_0x13e130['name'],'sectionId':_0x13e130['id']},{})['then'](function(){return _0x5428f8;});}else{return _0x5428f8;}})[_0x5c8c('0x1d')](function(_0x38fbc7){logger[_0x5c8c('0x16')](_0x5c8c('0x80'),_0x38fbc7);throw _0x38fbc7;});}return _0x5428f8;})[_0x5c8c('0x13')](respondWithResult(_0x59c82d,0xc9))[_0x5c8c('0x1d')](handleError(_0x59c82d,null));};exports[_0x5c8c('0x81')]=function(_0x3f132d,_0xe11f8b){return db['MailAccount'][_0x5c8c('0x70')]({'where':{'id':_0x3f132d[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0xe11f8b,null))[_0x5c8c('0x13')](function(_0x492252){if(_0x492252){return _0x492252['getImap']();}return null;})[_0x5c8c('0x13')](respondWithResult(_0xe11f8b,null))[_0x5c8c('0x1d')](handleError(_0xe11f8b,null));};exports[_0x5c8c('0x82')]=function(_0x49c1f1,_0x18081b){if(_0x49c1f1['body']['id']){delete _0x49c1f1[_0x5c8c('0x67')]['id'];}return db[_0x5c8c('0x47')]['find']({'where':{'id':_0x49c1f1[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x18081b,null))[_0x5c8c('0x13')](function(_0x5121a3){if(_0x5121a3){_0x49c1f1[_0x5c8c('0x67')][_0x5c8c('0x6e')]=_0x5121a3['id'];return db[_0x5c8c('0x61')][_0x5c8c('0x74')](_0x49c1f1[_0x5c8c('0x67')]);}})[_0x5c8c('0x13')](respondWithResult(_0x18081b,null))[_0x5c8c('0x1d')](handleError(_0x18081b,null));};exports[_0x5c8c('0x83')]=function(_0x437881,_0x4a3f65){return db['MailAccount']['findOne']({'where':{'id':_0x437881[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x4a3f65,null))[_0x5c8c('0x13')](function(_0x23a870){if(_0x23a870){return _0x23a870['setImap'](null);}return null;})[_0x5c8c('0x13')](respondWithStatusCode(_0x4a3f65,null))[_0x5c8c('0x1d')](handleError(_0x4a3f65,null));};exports[_0x5c8c('0x84')]=function(_0x1fde0b,_0x1db1b3){return db[_0x5c8c('0x47')][_0x5c8c('0x70')]({'where':{'id':_0x1fde0b[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x1db1b3,null))['then'](function(_0x261a59){if(_0x261a59){return _0x261a59[_0x5c8c('0x84')]();}return null;})[_0x5c8c('0x13')](respondWithResult(_0x1db1b3,null))['catch'](handleError(_0x1db1b3,null));};exports['addSmtp']=function(_0x389f6f,_0x3b2466){if(_0x389f6f[_0x5c8c('0x67')]['id']){delete _0x389f6f[_0x5c8c('0x67')]['id'];}return db['MailAccount'][_0x5c8c('0x65')]({'where':{'id':_0x389f6f['params']['id']}})['then'](handleEntityNotFound(_0x3b2466,null))[_0x5c8c('0x13')](function(_0x541d28){if(_0x541d28){_0x389f6f[_0x5c8c('0x67')][_0x5c8c('0x6e')]=_0x541d28['id'];return db[_0x5c8c('0x44')][_0x5c8c('0x74')](_0x389f6f['body']);}})['then'](respondWithResult(_0x3b2466,null))[_0x5c8c('0x1d')](handleError(_0x3b2466,null));};exports[_0x5c8c('0x85')]=function(_0xc866d3,_0x30cfcc){return db[_0x5c8c('0x47')]['findOne']({'where':{'id':_0xc866d3[_0x5c8c('0x6a')]['id']}})['then'](handleEntityNotFound(_0x30cfcc,null))[_0x5c8c('0x13')](function(_0x4765d0){if(_0x4765d0){return _0x4765d0['setSmtp'](null);}return null;})[_0x5c8c('0x13')](respondWithStatusCode(_0x30cfcc,null))[_0x5c8c('0x1d')](handleError(_0x30cfcc,null));};exports['addInteraction']=function(_0x283e8d,_0x2d1696){return db[_0x5c8c('0x86')][_0x5c8c('0x65')]({'where':{'id':_0x283e8d[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x2d1696,null))[_0x5c8c('0x13')](function(_0x1ac2dc){if(_0x1ac2dc){return _0x1ac2dc[_0x5c8c('0x87')](_0x283e8d[_0x5c8c('0x67')][_0x5c8c('0x73')],_[_0x5c8c('0x88')](_0x283e8d[_0x5c8c('0x67')],['ids','id'])||{});}})[_0x5c8c('0x13')](respondWithResult(_0x2d1696,null))[_0x5c8c('0x1d')](handleError(_0x2d1696,null));};exports[_0x5c8c('0x89')]=function(_0x2bbd6c,_0x486658){var _0x5bcd59={'raw':![],'where':{}};var _0x4df79a={};var _0x4aee9a={'count':0x0,'rows':[]};return db[_0x5c8c('0x47')][_0x5c8c('0x70')]({'where':{'id':_0x2bbd6c[_0x5c8c('0x6a')]['id']}})['then'](handleEntityNotFound(_0x486658,null))[_0x5c8c('0x13')](function(_0x4c4d56){if(_0x4c4d56){_0x4df79a['model']=_['keys'](db[_0x5c8c('0x86')][_0x5c8c('0x48')]);_0x4df79a[_0x5c8c('0x4d')]=_[_0x5c8c('0x63')](_0x2bbd6c[_0x5c8c('0x4d')]);_0x4df79a[_0x5c8c('0x4e')]=_[_0x5c8c('0x4f')](_0x4df79a[_0x5c8c('0x4c')],_0x4df79a[_0x5c8c('0x4d')]);_0x5bcd59[_0x5c8c('0x50')]=_[_0x5c8c('0x4f')](_0x4df79a[_0x5c8c('0x4c')],qs[_0x5c8c('0x51')](_0x2bbd6c[_0x5c8c('0x4d')]['fields']));_0x5bcd59[_0x5c8c('0x50')]=_0x5bcd59[_0x5c8c('0x50')]['length']?_0x5bcd59[_0x5c8c('0x50')]:_0x4df79a[_0x5c8c('0x4c')];if(!_0x2bbd6c[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x5bcd59[_0x5c8c('0x24')]=qs['limit'](_0x2bbd6c['query'][_0x5c8c('0x24')]);_0x5bcd59[_0x5c8c('0x22')]=qs[_0x5c8c('0x22')](_0x2bbd6c[_0x5c8c('0x4d')][_0x5c8c('0x22')]);}_0x5bcd59[_0x5c8c('0x55')]=qs['sort'](_0x2bbd6c[_0x5c8c('0x4d')][_0x5c8c('0x56')]);_0x5bcd59[_0x5c8c('0x59')]=qs['filters'](_[_0x5c8c('0x57')](_0x2bbd6c[_0x5c8c('0x4d')],_0x4df79a[_0x5c8c('0x4e')]));_0x5bcd59[_0x5c8c('0x59')][_0x5c8c('0x6e')]=_0x4c4d56['id'];if(_0x2bbd6c[_0x5c8c('0x4d')][_0x5c8c('0x58')]){_0x5bcd59[_0x5c8c('0x59')]=_[_0x5c8c('0x5a')](_0x5bcd59[_0x5c8c('0x59')],{'$or':_[_0x5c8c('0x46')](_0x5bcd59[_0x5c8c('0x50')],function(_0x2a9128){var _0x19ac9f={};_0x19ac9f[_0x2a9128]={'$like':'%'+_0x2bbd6c[_0x5c8c('0x4d')]['filter']+'%'};return _0x19ac9f;})});}_0x5bcd59=_[_0x5c8c('0x5a')]({},_0x5bcd59,_0x2bbd6c[_0x5c8c('0x5c')]);return db[_0x5c8c('0x86')][_0x5c8c('0x25')]({'where':_0x5bcd59[_0x5c8c('0x59')]})[_0x5c8c('0x13')](function(_0x2b9d60){_0x4aee9a[_0x5c8c('0x25')]=_0x2b9d60;if(_0x2bbd6c['query'][_0x5c8c('0x5d')]){_0x5bcd59[_0x5c8c('0x64')]=[{'model':db[_0x5c8c('0x8a')],'as':_0x5c8c('0x8b'),'required':![]},{'model':db[_0x5c8c('0x8c')],'as':_0x5c8c('0x8d'),'attributes':[_0x5c8c('0x2b'),_0x5c8c('0x8e'),_0x5c8c('0x8f')],'required':![]},{'model':db[_0x5c8c('0x90')],'as':_0x5c8c('0x91'),'attributes':['id','name',_0x5c8c('0x92')],'where':_0x2bbd6c[_0x5c8c('0x4d')]['tag']?{'id':_0x2bbd6c['query'][_0x5c8c('0x93')]}:undefined,'required':_0x2bbd6c[_0x5c8c('0x4d')][_0x5c8c('0x93')]?!![]:![]}];}return db[_0x5c8c('0x86')]['findAll'](_0x5bcd59);})[_0x5c8c('0x13')](function(_0x56bc5a){_0x4aee9a['rows']=_0x56bc5a;return _0x4aee9a;});}})[_0x5c8c('0x13')](respondWithFilteredResult(_0x486658,_0x5bcd59))['catch'](handleError(_0x486658,null));};exports['addApplications']=function addApplications(_0x492590,_0x39118e){var _0x34d30b=_0x492590['params']['id'];var _0x54802a=_0x492590[_0x5c8c('0x67')];var _0x54da6e=0xc8;var _0x3e669a=null;return db[_0x5c8c('0x94')][_0x5c8c('0x95')]({'isolationLevel':db[_0x5c8c('0x94')][_0x5c8c('0x96')][_0x5c8c('0x97')]['READ_COMMITTED']},function(_0x16caf1){return db['MailAccount']['findOne']({'where':{'id':_0x34d30b},'transaction':_0x16caf1})['then'](function(_0x349981){if(_0x349981){return db[_0x5c8c('0x98')][_0x5c8c('0x26')]({'where':{'MailAccountId':_0x34d30b},'transaction':_0x16caf1})[_0x5c8c('0x13')](function(){var _0x3dfbda=_[_0x5c8c('0x46')](_0x54802a,function(_0x32260b){_0x32260b[_0x5c8c('0x6e')]=_0x34d30b;return _0x32260b;});return db[_0x5c8c('0x98')][_0x5c8c('0x99')](_0x3dfbda,{'transaction':_0x16caf1});});}else{_0x54da6e=0x194;_0x3e669a=[];}});})['then'](function(){if(_0x54da6e!==0x194){return db[_0x5c8c('0x98')][_0x5c8c('0x9a')]({'where':{'MailAccountId':_0x34d30b},'order':_0x5c8c('0x9b')})[_0x5c8c('0x13')](function(_0x22e1f7){_0x3e669a=_0x22e1f7;});}})[_0x5c8c('0x1d')](function(_0x4ce410){_0x54da6e=0x1f4;logger['error'](_0x4ce410[_0x5c8c('0x2a')]);if(_0x4ce410[_0x5c8c('0x2b')]){delete _0x4ce410['name'];}_0x3e669a=_0x4ce410;})['finally'](function(){if(_0x3e669a===null){_0x39118e['sendStatus'](_0x54da6e);}else{if(_0x54da6e===0x1f4){_0x39118e[_0x5c8c('0x1f')](_0x54da6e)[_0x5c8c('0x2c')](_0x3e669a);}else{_0x39118e['status'](_0x54da6e)[_0x5c8c('0x21')](_0x3e669a);}}});};exports[_0x5c8c('0x9c')]=function(_0x18d885,_0xd0950){var _0x2253a1={};var _0x4e4ec5={};var _0x403b32;var _0x266a98;return db[_0x5c8c('0x47')]['findOne']({'where':{'id':_0x18d885[_0x5c8c('0x6a')]['id']}})['then'](handleEntityNotFound(_0xd0950,null))['then'](function(_0x269313){if(_0x269313){_0x403b32=_0x269313;_0x4e4ec5['model']=_[_0x5c8c('0x63')](db[_0x5c8c('0x98')][_0x5c8c('0x48')]);_0x4e4ec5['query']=_[_0x5c8c('0x63')](_0x18d885[_0x5c8c('0x4d')]);_0x4e4ec5[_0x5c8c('0x4e')]=_[_0x5c8c('0x4f')](_0x4e4ec5[_0x5c8c('0x4c')],_0x4e4ec5['query']);_0x2253a1[_0x5c8c('0x50')]=_[_0x5c8c('0x4f')](_0x4e4ec5[_0x5c8c('0x4c')],qs['fields'](_0x18d885[_0x5c8c('0x4d')][_0x5c8c('0x51')]));_0x2253a1[_0x5c8c('0x50')]=_0x2253a1[_0x5c8c('0x50')]['length']?_0x2253a1[_0x5c8c('0x50')]:_0x4e4ec5[_0x5c8c('0x4c')];_0x2253a1[_0x5c8c('0x55')]=qs[_0x5c8c('0x56')](_0x18d885[_0x5c8c('0x4d')][_0x5c8c('0x56')]);_0x2253a1[_0x5c8c('0x59')]=qs['filters'](_[_0x5c8c('0x57')](_0x18d885['query'],_0x4e4ec5[_0x5c8c('0x4e')]));if(_0x18d885['query'][_0x5c8c('0x58')]){_0x2253a1['where']=_[_0x5c8c('0x5a')](_0x2253a1[_0x5c8c('0x59')],{'$or':_[_0x5c8c('0x46')](_0x2253a1['attributes'],function(_0xb8b99c){var _0x2b97ab={};_0x2b97ab[_0xb8b99c]={'$like':'%'+_0x18d885[_0x5c8c('0x4d')]['filter']+'%'};return _0x2b97ab;})});}_0x2253a1=_['merge']({},_0x2253a1,_0x18d885['options']);return _0x403b32[_0x5c8c('0x9c')](_0x2253a1);}})['then'](function(_0x41ee2a){if(_0x41ee2a){_0x266a98=_0x41ee2a['length'];if(!_0x18d885[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x2253a1[_0x5c8c('0x24')]=qs[_0x5c8c('0x24')](_0x18d885[_0x5c8c('0x4d')]['limit']);_0x2253a1['offset']=qs['offset'](_0x18d885[_0x5c8c('0x4d')][_0x5c8c('0x22')]);}return _0x403b32[_0x5c8c('0x9c')](_0x2253a1);}})[_0x5c8c('0x13')](function(_0x35edec){if(_0x35edec){return _0x35edec?{'count':_0x266a98,'rows':_0x35edec}:null;}})['then'](respondWithResult(_0xd0950,null))[_0x5c8c('0x1d')](handleError(_0xd0950,null));};exports['getMessages']=function(_0x449432,_0x400e2b){var _0x2cc081={'raw':!![],'where':{}};var _0x6d16f6={};var _0x355466={'count':0x0,'rows':[]};return db[_0x5c8c('0x47')]['findOne']({'where':{'id':_0x449432[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x400e2b,null))[_0x5c8c('0x13')](function(_0x3245ab){if(_0x3245ab){_0x6d16f6['model']=_[_0x5c8c('0x63')](db['MailMessage'][_0x5c8c('0x48')]);_0x6d16f6[_0x5c8c('0x4d')]=_[_0x5c8c('0x63')](_0x449432[_0x5c8c('0x4d')]);_0x6d16f6[_0x5c8c('0x4e')]=_['intersection'](_0x6d16f6[_0x5c8c('0x4c')],_0x6d16f6[_0x5c8c('0x4d')]);_0x2cc081['attributes']=_[_0x5c8c('0x4f')](_0x6d16f6[_0x5c8c('0x4c')],qs['fields'](_0x449432[_0x5c8c('0x4d')]['fields']));_0x2cc081['attributes']=_0x2cc081[_0x5c8c('0x50')]['length']?_0x2cc081[_0x5c8c('0x50')]:_0x6d16f6[_0x5c8c('0x4c')];if(!_0x449432['query'][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x2cc081[_0x5c8c('0x24')]=qs[_0x5c8c('0x24')](_0x449432[_0x5c8c('0x4d')][_0x5c8c('0x24')]);_0x2cc081[_0x5c8c('0x22')]=qs[_0x5c8c('0x22')](_0x449432['query'][_0x5c8c('0x22')]);}_0x2cc081['order']=qs[_0x5c8c('0x56')](_0x449432[_0x5c8c('0x4d')]['sort']);_0x2cc081[_0x5c8c('0x59')]=qs[_0x5c8c('0x4e')](_['pick'](_0x449432['query'],_0x6d16f6['filters']));_0x2cc081[_0x5c8c('0x59')][_0x5c8c('0x6e')]=_0x3245ab['id'];if(_0x449432[_0x5c8c('0x4d')][_0x5c8c('0x58')]){_0x2cc081['where']=_[_0x5c8c('0x5a')](_0x2cc081['where'],{'$or':_[_0x5c8c('0x46')](_0x2cc081[_0x5c8c('0x50')],function(_0x7acc5d){var _0x239d1c={};_0x239d1c[_0x7acc5d]={'$like':'%'+_0x449432[_0x5c8c('0x4d')][_0x5c8c('0x58')]+'%'};return _0x239d1c;})});}if(_0x449432[_0x5c8c('0x4d')]['$gte']){var _0x1646b9=_0x449432[_0x5c8c('0x4d')][_0x5c8c('0x9d')]['split'](',');var _0x343af4={};_0x343af4[_0x1646b9[0x0]]={'$gte':moment(_0x1646b9[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2cc081['where']=_[_0x5c8c('0x5a')](_0x2cc081[_0x5c8c('0x59')],_0x343af4);}_0x2cc081=_[_0x5c8c('0x5a')]({},_0x2cc081,_0x449432[_0x5c8c('0x5c')]);return db['MailMessage']['count']({'where':_0x2cc081['where']})[_0x5c8c('0x13')](function(_0x56ec4e){_0x355466['count']=_0x56ec4e;if(_0x449432[_0x5c8c('0x4d')]['includeAll']){_0x2cc081[_0x5c8c('0x64')]=[{'all':!![]}];}return db[_0x5c8c('0x9e')][_0x5c8c('0x5e')](_0x2cc081);})['then'](function(_0x4b010f){if(_0x449432[_0x5c8c('0x4d')][_0x5c8c('0x9f')]===_0x5c8c('0xa0')){for(var _0x203a9e=0x0;_0x203a9e<_0x4b010f['length'];_0x203a9e++){_0x4b010f[_0x203a9e][_0x5c8c('0x67')]=juice(_0x4b010f[_0x203a9e]['body']);}}_0x355466[_0x5c8c('0x5f')]=_0x4b010f;return _0x355466;});}})['then'](respondWithFilteredResult(_0x400e2b,_0x2cc081))[_0x5c8c('0x1d')](handleError(_0x400e2b,null));};exports[_0x5c8c('0x2c')]=function(_0x90374c,_0xac203c){var _0x25e646,_0x11cf75={},_0x50d22b;if(_0x90374c[_0x5c8c('0x67')]['to']){_0x50d22b=_0x90374c[_0x5c8c('0x67')]['to']['split'](',')[0x0];}return db[_0x5c8c('0x47')][_0x5c8c('0x65')]({'where':{'id':_0x90374c['params']['id']},'include':[{'model':db[_0x5c8c('0xa1')],'as':_0x5c8c('0xa2'),'include':[{'model':db[_0x5c8c('0x8a')],'as':_0x5c8c('0xa3'),'where':{'email':_0x50d22b},'limit':0x1,'order':[[_0x5c8c('0xa4'),_0x5c8c('0xa5')]]}]},{'model':db[_0x5c8c('0x44')],'as':_0x5c8c('0x43'),'raw':!![],'include':[{'model':db[_0x5c8c('0xa6')],'as':_0x5c8c('0xa6'),'raw':!![]}]}]})[_0x5c8c('0x13')](handleEntityNotFound(_0xac203c,null))['then'](function(_0x3d6a6b){if(!_0x3d6a6b)return;_0x25e646=_0x3d6a6b;if(!_0x3d6a6b['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x5c8c('0x7a')](_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xa7')])){_0x90374c['body']['from']=util[_0x5c8c('0xa8')](_0x5c8c('0xa9'),_0x3d6a6b['name'],_0x3d6a6b['email']||_0x3d6a6b[_0x5c8c('0x43')][_0x5c8c('0x37')]);}if(_0x90374c['body'][_0x5c8c('0xaa')]&&_0x90374c['body'][_0x5c8c('0xaa')]['length']){for(var _0x315841=0x0;_0x315841<_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xaa')]['length'];_0x315841+=0x1){_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xaa')][_0x315841]={'filename':_0x90374c[_0x5c8c('0x67')]['attachments'][_0x315841][_0x5c8c('0x2b')],'path':path['join'](config['root'],_0x5c8c('0xab'),_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xaa')][_0x315841][_0x5c8c('0xac')])};}}var _0x388b1c=_0x3d6a6b[_0x5c8c('0xad')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x388b1c,'message':_0x90374c[_0x5c8c('0x67')]});})[_0x5c8c('0x13')](function(_0x4500f6){if(!_0x4500f6)return;_0x11cf75=_0x4500f6;if(!_0x25e646['List'])throw new Error(_0x5c8c('0xae'));if(_0x25e646['List'][_0x5c8c('0xa3')]['length'])return _0x25e646[_0x5c8c('0xa2')][_0x5c8c('0xa3')][0x0];return db['CmContact'][_0x5c8c('0x74')](_['defaults'](_0x90374c['body'],{'firstName':_0x90374c[_0x5c8c('0x67')]['to'],'email':_0x90374c[_0x5c8c('0x67')]['to'],'phone':_0x90374c[_0x5c8c('0x67')]['to'],'ListId':_0x25e646[_0x5c8c('0x79')]}));})['then'](function(_0x5cbce3){if(!_0x5cbce3)return;var _0xb9f44a={'UserId':_0x90374c[_0x5c8c('0x37')]['id'],'ContactId':_0x5cbce3['id'],'MailAccountId':_0x25e646['id'],'inReplyTo':_0x11cf75[_0x5c8c('0xaf')],'to':_0x90374c[_0x5c8c('0x67')]['from'],'cc':_0x90374c[_0x5c8c('0x67')]['cc'],'subject':_0x90374c['body']['subject'],'attach':_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xb0')],'firstMsgDirection':_0x5c8c('0xb1'),'lastMsgAt':moment()[_0x5c8c('0xa8')](_0x5c8c('0xb2')),'lastMsgDirection':'out','Messages':[_[_0x5c8c('0x5a')](_0x90374c['body'],{'messageId':_0x11cf75['messageId'],'sentAt':moment()['format'](_0x5c8c('0xb2')),'read':!![],'MailAccountId':_0x25e646['id'],'UserId':_0x90374c['user']['id'],'ContactId':_0x5cbce3['id']})]};if(_0x90374c['body'][_0x5c8c('0xb3')]){_0xb9f44a=_['merge'](_0xb9f44a,_0x90374c[_0x5c8c('0x67')][_0x5c8c('0xb3')]);}return db[_0x5c8c('0x86')][_0x5c8c('0x74')](_0xb9f44a,{'include':[{'model':db[_0x5c8c('0x9e')],'as':'Messages'}]});})[_0x5c8c('0x13')](respondWithResult(_0xac203c,null))[_0x5c8c('0x1d')](handleError(_0xac203c,null));};exports[_0x5c8c('0xb4')]=function(_0x4b9978,_0x1994d8){return db[_0x5c8c('0x47')][_0x5c8c('0x65')]({'where':{'id':_0x4b9978[_0x5c8c('0x6a')]['id']},'include':[{'model':db[_0x5c8c('0x44')],'as':_0x5c8c('0x43'),'raw':!![],'include':[{'model':db[_0x5c8c('0xa6')],'as':_0x5c8c('0xa6'),'raw':!![]}]}]})[_0x5c8c('0x13')](handleEntityNotFound(_0x1994d8,null))['then'](function(_0x1e426f){if(!_0x1e426f[_0x5c8c('0x43')])return;var _0x27f670=_0x1e426f[_0x5c8c('0xad')]();return respondWithRpcPromise(_0x5c8c('0xb5'),'verifySmtp',{'account':_0x27f670});})['then'](respondWithResult(_0x1994d8,null))[_0x5c8c('0x1d')](handleError(_0x1994d8,null));};exports[_0x5c8c('0x26')]=function(_0x2def92,_0x16a469){return db[_0x5c8c('0x47')]['find']({'where':{'id':_0x2def92['params']['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x16a469,null))[_0x5c8c('0x13')](function(_0x3bc616){if(_0x3bc616&&_0x3bc616[_0x5c8c('0x3e')]){throw new db[(_0x5c8c('0xb6'))][(_0x5c8c('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3bc616;})[_0x5c8c('0x13')](removeEntity(_0x16a469,null))[_0x5c8c('0x1d')](handleError(_0x16a469,null));};exports['addAgents']=function(_0xacda73,_0x7e693d){return db['MailAccount'][_0x5c8c('0x65')]({'where':{'id':_0xacda73[_0x5c8c('0x6a')]['id']}})[_0x5c8c('0x13')](handleEntityNotFound(_0x7e693d,null))[_0x5c8c('0x13')](function(_0x3a8d5a){if(_0x3a8d5a){return _0x3a8d5a['addAgents'](_0xacda73['body'][_0x5c8c('0x73')],_[_0x5c8c('0x88')](_0xacda73[_0x5c8c('0x67')],[_0x5c8c('0x73'),'id'])||{})['spread'](function(_0x35fe0e){for(var _0x6a2881=0x0;_0x6a2881<_0xacda73[_0x5c8c('0x67')][_0x5c8c('0x73')][_0x5c8c('0x52')];_0x6a2881+=0x1){socket[_0x5c8c('0xb8')]('userMailAccount:save',{'UserId':Number(_0xacda73[_0x5c8c('0x67')][_0x5c8c('0x73')][_0x6a2881]),'MailAccountId':Number(_0xacda73[_0x5c8c('0x6a')]['id'])});}return _0x35fe0e;});}})[_0x5c8c('0x13')](respondWithResult(_0x7e693d,null))[_0x5c8c('0x1d')](handleError(_0x7e693d,null));};exports[_0x5c8c('0xb9')]=function(_0xf0b6d2,_0x37929c){return db['MailAccount'][_0x5c8c('0x65')]({'where':{'id':_0xf0b6d2['params']['id']}})['then'](handleEntityNotFound(_0x37929c,null))[_0x5c8c('0x13')](function(_0x57ebff){if(_0x57ebff){return _0x57ebff['removeAgents'](_0xf0b6d2[_0x5c8c('0x4d')][_0x5c8c('0x73')])[_0x5c8c('0x13')](function(){if(_['isArray'](_0xf0b6d2[_0x5c8c('0x4d')][_0x5c8c('0x73')])){for(var _0x104ab8=0x0;_0x104ab8<_0xf0b6d2['query'][_0x5c8c('0x73')]['length'];_0x104ab8+=0x1){socket[_0x5c8c('0xb8')]('userMailAccount:remove',{'UserId':Number(_0xf0b6d2[_0x5c8c('0x4d')][_0x5c8c('0x73')][_0x104ab8]),'MailAccountId':Number(_0xf0b6d2[_0x5c8c('0x6a')]['id'])});}}else{socket[_0x5c8c('0xb8')]('userMailAccount:remove',{'UserId':Number(_0xf0b6d2['query']['ids']),'MailAccountId':Number(_0xf0b6d2[_0x5c8c('0x6a')]['id'])});}});}})[_0x5c8c('0x13')](respondWithStatusCode(_0x37929c,null))[_0x5c8c('0x1d')](handleError(_0x37929c,null));};exports['getAgents']=function(_0x5e6ccd,_0x56e775){var _0x15c634={};var _0xd15a76={};var _0x21b5ca;var _0x1fe182;return db[_0x5c8c('0x47')][_0x5c8c('0x70')]({'where':{'id':_0x5e6ccd[_0x5c8c('0x6a')]['id']}})['then'](handleEntityNotFound(_0x56e775,null))['then'](function(_0x5e93bf){if(_0x5e93bf){_0x21b5ca=_0x5e93bf;_0xd15a76['model']=_['keys'](db[_0x5c8c('0x8c')][_0x5c8c('0x48')]);_0xd15a76[_0x5c8c('0x4d')]=_[_0x5c8c('0x63')](_0x5e6ccd[_0x5c8c('0x4d')]);_0xd15a76[_0x5c8c('0x4e')]=_['intersection'](_0xd15a76[_0x5c8c('0x4c')],_0xd15a76['query']);_0x15c634['attributes']=_[_0x5c8c('0x4f')](_0xd15a76[_0x5c8c('0x4c')],qs[_0x5c8c('0x51')](_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x51')]));_0x15c634[_0x5c8c('0x50')]=_0x15c634[_0x5c8c('0x50')][_0x5c8c('0x52')]?_0x15c634[_0x5c8c('0x50')]:_0xd15a76[_0x5c8c('0x4c')];_0x15c634[_0x5c8c('0x55')]=qs[_0x5c8c('0x56')](_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x56')]);_0x15c634[_0x5c8c('0x59')]=qs[_0x5c8c('0x4e')](_[_0x5c8c('0x57')](_0x5e6ccd[_0x5c8c('0x4d')],_0xd15a76[_0x5c8c('0x4e')]));if(_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x58')]){_0x15c634[_0x5c8c('0x59')]=_[_0x5c8c('0x5a')](_0x15c634[_0x5c8c('0x59')],{'$or':_[_0x5c8c('0x46')](_0x15c634[_0x5c8c('0x50')],function(_0x22a410){var _0x4c743a={};_0x4c743a[_0x22a410]={'$like':'%'+_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x58')]+'%'};return _0x4c743a;})});}_0x15c634=_['merge']({},_0x15c634,_0x5e6ccd['options']);return _0x21b5ca[_0x5c8c('0xba')](_0x15c634);}})['then'](function(_0x2a5d04){if(_0x2a5d04){_0x1fe182=_0x2a5d04[_0x5c8c('0x52')];if(!_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x53')](_0x5c8c('0x54'))){_0x15c634[_0x5c8c('0x24')]=qs[_0x5c8c('0x24')](_0x5e6ccd[_0x5c8c('0x4d')]['limit']);_0x15c634['offset']=qs[_0x5c8c('0x22')](_0x5e6ccd[_0x5c8c('0x4d')][_0x5c8c('0x22')]);}return _0x21b5ca[_0x5c8c('0xba')](_0x15c634);}})[_0x5c8c('0x13')](function(_0x32ee5c){if(_0x32ee5c){return _0x32ee5c?{'count':_0x1fe182,'rows':_0x32ee5c}:null;}})[_0x5c8c('0x13')](respondWithResult(_0x56e775,null))[_0x5c8c('0x1d')](handleError(_0x56e775,null));}; \ No newline at end of file +var _0x8a8b=['then','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','Pause','fields','merge','update','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','custom','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','Contacts','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','json','destroy','MailAccounts','UserProfileResource'];(function(_0x27f493,_0x173006){var _0x777a3b=function(_0x1bd40e){while(--_0x1bd40e){_0x27f493['push'](_0x27f493['shift']());}};_0x777a3b(++_0x173006);}(_0x8a8b,0xa3));var _0xb8a8=function(_0xa8229b,_0x37fdae){_0xa8229b=_0xa8229b-0x0;var _0x37880f=_0x8a8b[_0xa8229b];return _0x37880f;};'use strict';var moment=require(_0xb8a8('0x0'));var BPromise=require(_0xb8a8('0x1'));var util=require(_0xb8a8('0x2'));var path=require(_0xb8a8('0x3'));var _=require('lodash');var juice=require(_0xb8a8('0x4'));var Redis=require(_0xb8a8('0x5'));var qs=require(_0xb8a8('0x6'));var logger=require(_0xb8a8('0x7'))(_0xb8a8('0x8'));var config=require(_0xb8a8('0x9'));var db=require('../../mysqldb')['db'];config[_0xb8a8('0xa')]=_[_0xb8a8('0xb')](config[_0xb8a8('0xa')],{'host':_0xb8a8('0xc'),'port':0x18eb});var socket=require(_0xb8a8('0xd'))(new Redis(config['redis']));require(_0xb8a8('0xe'))[_0xb8a8('0xf')](socket);var jayson=require(_0xb8a8('0x10'));var client=jayson[_0xb8a8('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x456ea2,_0x4cb5f5,_0x59b2c7,_0x10beb3){return new BPromise(function(_0x50a923,_0xbdbc7d){var _0x6e4956=_0x10beb3||client;return _0x6e4956[_0xb8a8('0x12')](_0x456ea2,_0x59b2c7)['then'](function(_0x5af3eb){logger[_0xb8a8('0x13')](_0xb8a8('0x14'),_0x4cb5f5,_0xb8a8('0x15'));logger[_0xb8a8('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4cb5f5,_0xb8a8('0x15'),JSON[_0xb8a8('0x17')](_0x5af3eb));if(_0x5af3eb[_0xb8a8('0x18')]){if(_0x5af3eb[_0xb8a8('0x18')][_0xb8a8('0x19')]===0x1f4){logger[_0xb8a8('0x18')](_0xb8a8('0x14'),_0x4cb5f5,_0x5af3eb['error'][_0xb8a8('0x1a')]);return _0xbdbc7d(_0x5af3eb[_0xb8a8('0x18')][_0xb8a8('0x1a')]);}logger['error'](_0xb8a8('0x14'),_0x4cb5f5,_0x5af3eb[_0xb8a8('0x18')]['message']);return _0x50a923(_0x5af3eb['error'][_0xb8a8('0x1a')]);}else{logger[_0xb8a8('0x13')](_0xb8a8('0x14'),_0x4cb5f5,_0xb8a8('0x15'));_0x50a923(_0x5af3eb[_0xb8a8('0x1b')][_0xb8a8('0x1a')]);}})[_0xb8a8('0x1c')](function(_0x279b3c){logger[_0xb8a8('0x18')](_0xb8a8('0x14'),_0x4cb5f5,_0x279b3c);_0xbdbc7d(_0x279b3c);});});}function respondWithStatusCode(_0x383353,_0xc6f258){_0xc6f258=_0xc6f258||0xcc;return function(_0x1e3a91){if(_0x1e3a91){return _0x383353[_0xb8a8('0x1d')](_0xc6f258);}return _0x383353[_0xb8a8('0x1e')](_0xc6f258)[_0xb8a8('0x1f')]();};}function respondWithResult(_0x59d18d,_0x29af13){_0x29af13=_0x29af13||0xc8;return function(_0x5e3f07){if(_0x5e3f07){return _0x59d18d[_0xb8a8('0x1e')](_0x29af13)['json'](_0x5e3f07);}};}function respondWithFilteredResult(_0x97b721,_0x3b156b){return function(_0x5db9fa){if(_0x5db9fa){var _0x179fef=typeof _0x3b156b[_0xb8a8('0x20')]==='undefined'&&typeof _0x3b156b[_0xb8a8('0x21')]===_0xb8a8('0x22');var _0x928a92=_0x5db9fa[_0xb8a8('0x23')];var _0x4e19ac=_0x179fef?0x0:_0x3b156b['offset'];var _0x20d05b=_0x179fef?_0x5db9fa[_0xb8a8('0x23')]:_0x3b156b['offset']+_0x3b156b[_0xb8a8('0x21')];var _0x2ee24f;if(_0x20d05b>=_0x928a92){_0x20d05b=_0x928a92;_0x2ee24f=0xc8;}else{_0x2ee24f=0xce;}_0x97b721[_0xb8a8('0x1e')](_0x2ee24f);return _0x97b721['set']('Content-Range',_0x4e19ac+'-'+_0x20d05b+'/'+_0x928a92)[_0xb8a8('0x24')](_0x5db9fa);}return null;};}function saveUpdates(_0x17b3c4){return function(_0x52f52d){if(_0x52f52d){return _0x52f52d['update'](_0x17b3c4)['then'](function(_0x3d8813){return _0x3d8813;});}return null;};}function removeEntity(_0x451f5e){return function(_0x4adfa9){if(_0x4adfa9){return _0x4adfa9[_0xb8a8('0x25')]()['then'](function(){var _0x5fa761=_0x4adfa9['get']({'plain':!![]});var _0x35553d=_0xb8a8('0x26');return db[_0xb8a8('0x27')]['destroy']({'where':{'type':_0x35553d,'resourceId':_0x5fa761['id']}})[_0xb8a8('0x28')](function(){return _0x4adfa9;});})[_0xb8a8('0x28')](function(){_0x451f5e[_0xb8a8('0x1e')](0xcc)[_0xb8a8('0x1f')]();});}};}function handleEntityNotFound(_0x199f33){return function(_0x422a6a){if(!_0x422a6a){_0x199f33[_0xb8a8('0x1d')](0x194);}return _0x422a6a;};}function handleError(_0x237b74,_0x11eebb){_0x11eebb=_0x11eebb||0x1f4;return function(_0x52374a){logger[_0xb8a8('0x18')](_0x52374a[_0xb8a8('0x29')]);if(_0x52374a[_0xb8a8('0x2a')]){delete _0x52374a[_0xb8a8('0x2a')];}_0x237b74[_0xb8a8('0x1e')](_0x11eebb)[_0xb8a8('0x2b')](_0x52374a);};}function getImapHost(_0x26b596){switch(_0x26b596){case _0xb8a8('0x2c'):return _0xb8a8('0x2d');case _0xb8a8('0x2e'):return _0xb8a8('0x2f');case _0xb8a8('0x30'):return _0xb8a8('0x31');case _0xb8a8('0x32'):return _0xb8a8('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x26b596);}function getSmtpHost(_0x3d746d){switch(_0x3d746d){case _0xb8a8('0x2c'):return'smtp.gmail.com';case _0xb8a8('0x2e'):return _0xb8a8('0x34');case _0xb8a8('0x30'):return _0xb8a8('0x35');case _0xb8a8('0x32'):return _0xb8a8('0x36');}throw new Error(_0xb8a8('0x37'),_0x3d746d);}function getAuthenticationOptions(_0x173706,_0x4caca5){var _0x52bca6={};var _0x5496cb={};if(_0x173706){_0x52bca6[_0xb8a8('0x38')]=_0x5496cb[_0xb8a8('0x38')]=_0x4caca5['username'];_0x52bca6['password']=_0x5496cb[_0xb8a8('0x39')]=_0x4caca5['password'];if(_0x4caca5['modernAuthentication']){_0x52bca6[_0xb8a8('0x3a')]=_0x5496cb['modernAuthentication']=!![];_0x52bca6[_0xb8a8('0x3b')]=_0x5496cb[_0xb8a8('0x3b')]=_0x4caca5[_0xb8a8('0x3b')];_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=null;}else{_0x52bca6['CloudProviderId']=_0x5496cb[_0xb8a8('0x3b')]=null;}_0x52bca6[_0xb8a8('0x3d')]=getImapHost(_0x173706);_0x52bca6[_0xb8a8('0x3e')]=0x3e1;_0x5496cb['host']=getSmtpHost(_0x173706);_0x5496cb[_0xb8a8('0x3e')]=0x24b;_0x5496cb[_0xb8a8('0x3f')]=![];_0x52bca6['service']=_0x5496cb[_0xb8a8('0x40')]=null;}else{if(_0x4caca5[_0xb8a8('0x41')]){_0x52bca6[_0xb8a8('0x38')]=_0x5496cb[_0xb8a8('0x38')]=_0x4caca5[_0xb8a8('0x42')];_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=_0x4caca5['password'];}else{_0x52bca6['authentication']=_0x5496cb[_0xb8a8('0x41')]=![];_0x52bca6[_0xb8a8('0x38')]=_0x5496cb['user']=null;_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=null;}_0x52bca6['host']=_0x4caca5[_0xb8a8('0x43')][_0xb8a8('0x3d')];_0x52bca6[_0xb8a8('0x3e')]=_0x4caca5[_0xb8a8('0x43')][_0xb8a8('0x3e')];_0x5496cb[_0xb8a8('0x3d')]=_0x4caca5[_0xb8a8('0x44')][_0xb8a8('0x3d')];_0x5496cb['port']=_0x4caca5[_0xb8a8('0x44')][_0xb8a8('0x3e')];}return{'Imap':_0x52bca6,'Smtp':_0x5496cb};}exports[_0xb8a8('0x45')]=function(_0x23400e,_0x5c2755){var _0x378ecd={'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44')},{'model':db['Pause'],'as':_0xb8a8('0x48')}]},_0x3b0aec={},_0x4a17a8={'count':0x0,'rows':[]};var _0xf65d8=_[_0xb8a8('0x49')](db[_0xb8a8('0x4a')][_0xb8a8('0x4b')],function(_0x51e0fa){return{'name':_0x51e0fa[_0xb8a8('0x4c')],'type':_0x51e0fa['type'][_0xb8a8('0x4d')]};});_0x3b0aec[_0xb8a8('0x4e')]=_[_0xb8a8('0x49')](_0xf65d8,_0xb8a8('0x2a'));_0x3b0aec[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x23400e[_0xb8a8('0x4f')]);_0x3b0aec[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x3b0aec[_0xb8a8('0x4e')],_0x3b0aec['query']);_0x378ecd['attributes']=_[_0xb8a8('0x52')](_0x3b0aec[_0xb8a8('0x4e')],qs['fields'](_0x23400e['query']['fields']));_0x378ecd['attributes']=_0x378ecd['attributes'][_0xb8a8('0x53')]?_0x378ecd[_0xb8a8('0x54')]:_0x3b0aec[_0xb8a8('0x4e')];if(!_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x378ecd[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x378ecd['offset']=qs['offset'](_0x23400e[_0xb8a8('0x4f')]['offset']);}_0x378ecd[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0x378ecd['where']=qs[_0xb8a8('0x51')](_['pick'](_0x23400e[_0xb8a8('0x4f')],_0x3b0aec[_0xb8a8('0x51')]),_0xf65d8);if(_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x378ecd['where']=_['merge'](_0x378ecd['where'],{'$or':_['map'](_0xf65d8,function(_0x1db32d){if(_0x1db32d[_0xb8a8('0x5a')]!==_0xb8a8('0x5b')){var _0x51c4fe={};_0x51c4fe[_0x1db32d[_0xb8a8('0x2a')]]={'$like':'%'+_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x59')]+'%'};return _0x51c4fe;}})});}_0x378ecd=_['merge']({},_0x378ecd,_0x23400e[_0xb8a8('0x5c')]);var _0x2bd559={'where':_0x378ecd[_0xb8a8('0x5d')]};return db[_0xb8a8('0x4a')][_0xb8a8('0x23')](_0x2bd559)[_0xb8a8('0x28')](function(_0x85d7ce){_0x4a17a8[_0xb8a8('0x23')]=_0x85d7ce;if(_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x378ecd[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x4a')][_0xb8a8('0x60')](_0x378ecd);})[_0xb8a8('0x28')](function(_0x5b256d){_0x4a17a8[_0xb8a8('0x61')]=_0x5b256d;return _0x4a17a8;})[_0xb8a8('0x28')](respondWithFilteredResult(_0x5c2755,_0x378ecd))['catch'](handleError(_0x5c2755,null));};exports[_0xb8a8('0x62')]=function(_0x9c2531,_0x19858c){var _0x346e0e={'raw':![],'where':{'id':_0x9c2531[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db['MailServerOut'],'as':_0xb8a8('0x44')},{'model':db[_0xb8a8('0x64')],'as':_0xb8a8('0x48')}]},_0x1e7e9c={};_0x1e7e9c[_0xb8a8('0x4e')]=_['keys'](db[_0xb8a8('0x4a')]['rawAttributes']);_0x1e7e9c['query']=_[_0xb8a8('0x50')](_0x9c2531[_0xb8a8('0x4f')]);_0x1e7e9c['filters']=_[_0xb8a8('0x52')](_0x1e7e9c[_0xb8a8('0x4e')],_0x1e7e9c[_0xb8a8('0x4f')]);_0x346e0e[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x1e7e9c[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x9c2531[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x346e0e['attributes']=_0x346e0e[_0xb8a8('0x54')]['length']?_0x346e0e['attributes']:_0x1e7e9c[_0xb8a8('0x4e')];if(_0x9c2531[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x346e0e[_0xb8a8('0x5f')]=[{'all':!![]}];}_0x346e0e=_[_0xb8a8('0x66')]({},_0x346e0e,_0x9c2531['options']);return db[_0xb8a8('0x4a')]['find'](_0x346e0e)[_0xb8a8('0x28')](handleEntityNotFound(_0x19858c,null))[_0xb8a8('0x28')](respondWithResult(_0x19858c,null))[_0xb8a8('0x1c')](handleError(_0x19858c,null));};exports[_0xb8a8('0x67')]=function(_0x55a338,_0x17bf5e){if(_0x55a338[_0xb8a8('0x68')]['id']){delete _0x55a338[_0xb8a8('0x68')]['id'];}var _0x521724=_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x69')]==='custom'?null:_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x69')];var _0x3a49e4=_0x55a338[_0xb8a8('0x68')]['Imap']||{};var _0x1cd562=_0x55a338[_0xb8a8('0x68')]['Smtp']||{};if(_0x521724){_0x3a49e4[_0xb8a8('0x3d')]=getImapHost(_0x521724);_0x3a49e4[_0xb8a8('0x3e')]=0x3e1;_0x1cd562[_0xb8a8('0x3d')]=getSmtpHost(_0x521724);_0x1cd562[_0xb8a8('0x3e')]=0x24b;_0x1cd562['secure']=![];}if(_0x1cd562[_0xb8a8('0x3a')]){_0x1cd562[_0xb8a8('0x3f')]=![];}else{_0x1cd562[_0xb8a8('0x3b')]=null;}if(!_0x3a49e4[_0xb8a8('0x3a')])_0x3a49e4[_0xb8a8('0x3b')]=null;_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x43')]=_0x3a49e4;_0x55a338[_0xb8a8('0x68')]['Smtp']=_0x1cd562;return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x55a338[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db[_0xb8a8('0x47')],'as':'Smtp'},{'model':db[_0xb8a8('0x64')],'as':_0xb8a8('0x48')}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x17bf5e,null))[_0xb8a8('0x28')](function(_0x1b50c5){if(!_0x1b50c5)throw new Error(_0xb8a8('0x6b'));if(_0x1b50c5[_0xb8a8('0x40')])delete _0x55a338['body'][_0xb8a8('0x43')];return _0x1b50c5;})[_0xb8a8('0x28')](saveUpdates(_0x55a338[_0xb8a8('0x68')],null))[_0xb8a8('0x28')](function(_0xfd0116){if(!_0x55a338[_0xb8a8('0x68')]['Imap'])return _0xfd0116;return db[_0xb8a8('0x46')][_0xb8a8('0x67')](_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x43')],{'where':{'MailAccountId':_0xfd0116['id']}})[_0xb8a8('0x28')](function(){return _0xfd0116;});})['then'](function(_0x2d4f7a){if(!_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x44')])return _0x2d4f7a;return db['MailServerOut'][_0xb8a8('0x67')](_0x55a338['body'][_0xb8a8('0x44')],{'where':{'MailAccountId':_0x2d4f7a['id']}})[_0xb8a8('0x28')](function(){return _0x2d4f7a;});})['then'](respondWithResult(_0x17bf5e,null))[_0xb8a8('0x1c')](handleError(_0x17bf5e,null));};exports[_0xb8a8('0x6c')]=function(_0x40bf19,_0x412e82){return db[_0xb8a8('0x4a')][_0xb8a8('0x6c')]()[_0xb8a8('0x28')](respondWithResult(_0x412e82,null))['catch'](handleError(_0x412e82,null));};exports[_0xb8a8('0x6d')]=function(_0x23865a,_0x453ad9){if(_0x23865a[_0xb8a8('0x68')]['id']){delete _0x23865a['body']['id'];}return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x23865a[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x453ad9,null))[_0xb8a8('0x28')](function(_0x25966b){if(_0x25966b){_0x23865a['body']['MailAccountId']=_0x25966b['id'];return db[_0xb8a8('0x6e')][_0xb8a8('0x6f')](_0x23865a[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x453ad9,null))[_0xb8a8('0x1c')](handleError(_0x453ad9,null));};exports[_0xb8a8('0x70')]=function(_0x37e579,_0x11f737){var _0x49fefa={'raw':![],'where':{}};var _0x26daf6={};var _0x4a5b8f={'count':0x0,'rows':[]};return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x37e579['params']['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x11f737,null))[_0xb8a8('0x28')](function(_0x2d08b0){if(_0x2d08b0){_0x26daf6[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0x6e')]['rawAttributes']);_0x26daf6[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x37e579[_0xb8a8('0x4f')]);_0x26daf6['filters']=_[_0xb8a8('0x52')](_0x26daf6[_0xb8a8('0x4e')],_0x26daf6[_0xb8a8('0x4f')]);_0x49fefa['attributes']=_[_0xb8a8('0x52')](_0x26daf6[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x49fefa[_0xb8a8('0x54')]=_0x49fefa['attributes'][_0xb8a8('0x53')]?_0x49fefa['attributes']:_0x26daf6[_0xb8a8('0x4e')];if(!_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x55')]('nolimit')){_0x49fefa[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x49fefa['offset']=qs['offset'](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x49fefa[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x37e579['query'][_0xb8a8('0x58')]);_0x49fefa[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x37e579[_0xb8a8('0x4f')],_0x26daf6['filters']));_0x49fefa[_0xb8a8('0x5d')]['MailAccountId']=_0x2d08b0['id'];if(_0x37e579[_0xb8a8('0x4f')]['filter']){_0x49fefa[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x49fefa[_0xb8a8('0x5d')],{'$or':_[_0xb8a8('0x49')](_0x49fefa[_0xb8a8('0x54')],function(_0x48a1a4){var _0x23733c={};_0x23733c[_0x48a1a4]={'$like':'%'+_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x59')]+'%'};return _0x23733c;})});}_0x49fefa=_[_0xb8a8('0x66')]({},_0x49fefa,_0x37e579[_0xb8a8('0x5c')]);return db[_0xb8a8('0x6e')][_0xb8a8('0x23')]({'where':_0x49fefa[_0xb8a8('0x5d')]})['then'](function(_0x55b919){_0x4a5b8f[_0xb8a8('0x23')]=_0x55b919;if(_0x37e579['query'][_0xb8a8('0x5e')]){_0x49fefa[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x6e')][_0xb8a8('0x60')](_0x49fefa);})[_0xb8a8('0x28')](function(_0x23e703){_0x4a5b8f[_0xb8a8('0x61')]=_0x23e703;return _0x4a5b8f;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x11f737,_0x49fefa))[_0xb8a8('0x1c')](handleError(_0x11f737,null));};exports[_0xb8a8('0x73')]=function(_0x38f25d,_0x93272){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x38f25d[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x93272,null))[_0xb8a8('0x28')](function(_0x341cbe){if(_0x341cbe){return _0x341cbe[_0xb8a8('0x73')](_0x38f25d[_0xb8a8('0x4f')][_0xb8a8('0x74')]);}})[_0xb8a8('0x28')](respondWithStatusCode(_0x93272,null))[_0xb8a8('0x1c')](handleError(_0x93272,null));};exports[_0xb8a8('0x75')]=function(_0x343727,_0x83bf99){if(_0x343727[_0xb8a8('0x68')]['id']){delete _0x343727[_0xb8a8('0x68')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x343727[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x83bf99,null))[_0xb8a8('0x28')](function(_0x297d43){if(_0x297d43){_0x343727[_0xb8a8('0x68')][_0xb8a8('0x76')]=_0x297d43['id'];return db[_0xb8a8('0x77')][_0xb8a8('0x6f')](_0x343727[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x83bf99,null))[_0xb8a8('0x1c')](handleError(_0x83bf99,null));};exports[_0xb8a8('0x78')]=function(_0x4ee4c3,_0x1fda9a){var _0x300b81={'raw':![],'where':{}};var _0x1c582c={};var _0x38e375={'count':0x0,'rows':[]};return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x4ee4c3[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x1fda9a,null))[_0xb8a8('0x28')](function(_0x306b35){if(_0x306b35){_0x1c582c[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db['CannedAnswer'][_0xb8a8('0x4b')]);_0x1c582c['query']=_['keys'](_0x4ee4c3['query']);_0x1c582c[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x1c582c[_0xb8a8('0x4e')],_0x1c582c['query']);_0x300b81['attributes']=_['intersection'](_0x1c582c['model'],qs[_0xb8a8('0x65')](_0x4ee4c3[_0xb8a8('0x4f')]['fields']));_0x300b81[_0xb8a8('0x54')]=_0x300b81[_0xb8a8('0x54')][_0xb8a8('0x53')]?_0x300b81['attributes']:_0x1c582c[_0xb8a8('0x4e')];if(!_0x4ee4c3[_0xb8a8('0x4f')]['hasOwnProperty'](_0xb8a8('0x56'))){_0x300b81[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x4ee4c3['query'][_0xb8a8('0x21')]);_0x300b81[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x300b81[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x4ee4c3['query']['sort']);_0x300b81['where']=qs[_0xb8a8('0x51')](_['pick'](_0x4ee4c3[_0xb8a8('0x4f')],_0x1c582c['filters']));_0x300b81[_0xb8a8('0x5d')][_0xb8a8('0x76')]=_0x306b35['id'];if(_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x300b81[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x300b81[_0xb8a8('0x5d')],{'$or':_['map'](_0x300b81['attributes'],function(_0x58fe35){var _0x3a8c9f={};_0x3a8c9f[_0x58fe35]={'$like':'%'+_0x4ee4c3[_0xb8a8('0x4f')]['filter']+'%'};return _0x3a8c9f;})});}_0x300b81=_['merge']({},_0x300b81,_0x4ee4c3['options']);return db[_0xb8a8('0x77')][_0xb8a8('0x23')]({'where':_0x300b81[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x8d49a5){_0x38e375[_0xb8a8('0x23')]=_0x8d49a5;if(_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x300b81[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x77')][_0xb8a8('0x60')](_0x300b81);})[_0xb8a8('0x28')](function(_0x44a66f){_0x38e375['rows']=_0x44a66f;return _0x38e375;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x1fda9a,_0x300b81))['catch'](handleError(_0x1fda9a,null));};exports[_0xb8a8('0x79')]=function(_0x5f2d1e,_0x3bb237){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x5f2d1e[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x3bb237,null))[_0xb8a8('0x28')](function(_0x2218d3){if(_0x2218d3){return _0x2218d3['removeAnswers'](_0x5f2d1e[_0xb8a8('0x4f')][_0xb8a8('0x74')]);}})[_0xb8a8('0x28')](respondWithStatusCode(_0x3bb237,null))[_0xb8a8('0x1c')](handleError(_0x3bb237,null));};exports[_0xb8a8('0x6f')]=function(_0x2220aa,_0x5d225a){var _0x168dc8={'name':_0x2220aa['body'][_0xb8a8('0x2a')],'key':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x4d')],'provider':_0x2220aa[_0xb8a8('0x68')]['provider']===_0xb8a8('0x7a')?null:_0x2220aa['body'][_0xb8a8('0x69')],'email':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7b')],'ListId':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7c')],'active':!_[_0xb8a8('0x7d')](_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7e')])?_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7e')]:!![],'description':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7f')]||null};var _0x3ae807=getAuthenticationOptions(_0x168dc8[_0xb8a8('0x69')],_0x2220aa['body']);_0x168dc8[_0xb8a8('0x43')]=_0x3ae807[_0xb8a8('0x43')];_0x168dc8[_0xb8a8('0x44')]=_0x3ae807[_0xb8a8('0x44')];return db['MailAccount']['create'](_0x168dc8,{'include':[{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44')},{'model':db['MailServerIn'],'as':_0xb8a8('0x43')}]})[_0xb8a8('0x28')](function(_0x25bb03){var _0x275f19=_0x2220aa[_0xb8a8('0x38')][_0xb8a8('0x80')]({'plain':!![]});if(!_0x275f19)throw new Error(_0xb8a8('0x81'));if(_0x275f19[_0xb8a8('0x82')]==='user'){var _0x553c8c=_0x25bb03[_0xb8a8('0x80')]({'plain':!![]});return db[_0xb8a8('0x83')][_0xb8a8('0x6a')]({'where':{'name':_0xb8a8('0x26'),'userProfileId':_0x275f19['userProfileId']},'raw':!![]})[_0xb8a8('0x28')](function(_0xc124b3){if(_0xc124b3&&_0xc124b3['autoAssociation']===0x0){return db[_0xb8a8('0x27')][_0xb8a8('0x6f')]({'name':_0x553c8c[_0xb8a8('0x2a')],'resourceId':_0x553c8c['id'],'type':_0xc124b3[_0xb8a8('0x2a')],'sectionId':_0xc124b3['id']},{})[_0xb8a8('0x28')](function(){return _0x25bb03;});}else{return _0x25bb03;}})[_0xb8a8('0x1c')](function(_0xdc357c){logger[_0xb8a8('0x18')](_0xb8a8('0x84'),_0xdc357c);throw _0xdc357c;});}return _0x25bb03;})['then'](respondWithResult(_0x5d225a,0xc9))[_0xb8a8('0x1c')](handleError(_0x5d225a,null));};exports[_0xb8a8('0x85')]=function(_0x55b2ea,_0x42b923){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x55b2ea[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x42b923,null))[_0xb8a8('0x28')](function(_0x303357){if(_0x303357){return _0x303357[_0xb8a8('0x85')]();}return null;})[_0xb8a8('0x28')](respondWithResult(_0x42b923,null))['catch'](handleError(_0x42b923,null));};exports[_0xb8a8('0x86')]=function(_0x38abf8,_0x4eb97c){if(_0x38abf8[_0xb8a8('0x68')]['id']){delete _0x38abf8['body']['id'];}return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x38abf8[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x4eb97c,null))[_0xb8a8('0x28')](function(_0x2a7466){if(_0x2a7466){_0x38abf8[_0xb8a8('0x68')][_0xb8a8('0x76')]=_0x2a7466['id'];return db['MailServerIn'][_0xb8a8('0x6f')](_0x38abf8['body']);}})['then'](respondWithResult(_0x4eb97c,null))['catch'](handleError(_0x4eb97c,null));};exports[_0xb8a8('0x87')]=function(_0x36f8e0,_0x27b018){return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x36f8e0[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x27b018,null))[_0xb8a8('0x28')](function(_0x5e79f9){if(_0x5e79f9){return _0x5e79f9['setImap'](null);}return null;})[_0xb8a8('0x28')](respondWithStatusCode(_0x27b018,null))['catch'](handleError(_0x27b018,null));};exports[_0xb8a8('0x88')]=function(_0x2f7ae0,_0xcf53d2){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x2f7ae0[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xcf53d2,null))['then'](function(_0x2a67e8){if(_0x2a67e8){return _0x2a67e8['getSmtp']();}return null;})['then'](respondWithResult(_0xcf53d2,null))['catch'](handleError(_0xcf53d2,null));};exports[_0xb8a8('0x89')]=function(_0x243736,_0x2a3790){if(_0x243736[_0xb8a8('0x68')]['id']){delete _0x243736[_0xb8a8('0x68')]['id'];}return db[_0xb8a8('0x4a')]['find']({'where':{'id':_0x243736[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x2a3790,null))[_0xb8a8('0x28')](function(_0x282a3f){if(_0x282a3f){_0x243736['body'][_0xb8a8('0x76')]=_0x282a3f['id'];return db[_0xb8a8('0x47')][_0xb8a8('0x6f')](_0x243736[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x2a3790,null))[_0xb8a8('0x1c')](handleError(_0x2a3790,null));};exports[_0xb8a8('0x8a')]=function(_0x4442b0,_0x43d4c1){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x4442b0[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x43d4c1,null))[_0xb8a8('0x28')](function(_0x1c6371){if(_0x1c6371){return _0x1c6371[_0xb8a8('0x8b')](null);}return null;})['then'](respondWithStatusCode(_0x43d4c1,null))[_0xb8a8('0x1c')](handleError(_0x43d4c1,null));};exports[_0xb8a8('0x8c')]=function(_0x2acc65,_0x266002){return db['MailInteraction'][_0xb8a8('0x6a')]({'where':{'id':_0x2acc65['params']['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x266002,null))[_0xb8a8('0x28')](function(_0x49ca00){if(_0x49ca00){return _0x49ca00[_0xb8a8('0x8c')](_0x2acc65[_0xb8a8('0x68')]['ids'],_[_0xb8a8('0x8d')](_0x2acc65[_0xb8a8('0x68')],[_0xb8a8('0x74'),'id'])||{});}})[_0xb8a8('0x28')](respondWithResult(_0x266002,null))[_0xb8a8('0x1c')](handleError(_0x266002,null));};exports[_0xb8a8('0x8e')]=function(_0x46018a,_0x2a14ab){var _0x493135={'raw':![],'where':{}};var _0x264fe7={};var _0x46cf8d={'count':0x0,'rows':[]};return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x46018a[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x2a14ab,null))['then'](function(_0x278a22){if(_0x278a22){_0x264fe7[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0x8f')][_0xb8a8('0x4b')]);_0x264fe7[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x46018a[_0xb8a8('0x4f')]);_0x264fe7[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x264fe7[_0xb8a8('0x4e')],_0x264fe7[_0xb8a8('0x4f')]);_0x493135['attributes']=_[_0xb8a8('0x52')](_0x264fe7['model'],qs[_0xb8a8('0x65')](_0x46018a['query'][_0xb8a8('0x65')]));_0x493135[_0xb8a8('0x54')]=_0x493135[_0xb8a8('0x54')]['length']?_0x493135[_0xb8a8('0x54')]:_0x264fe7['model'];if(!_0x46018a['query'][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x493135['limit']=qs[_0xb8a8('0x21')](_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x493135['offset']=qs[_0xb8a8('0x20')](_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x493135['order']=qs['sort'](_0x46018a[_0xb8a8('0x4f')]['sort']);_0x493135[_0xb8a8('0x5d')]=qs['filters'](_[_0xb8a8('0x72')](_0x46018a['query'],_0x264fe7[_0xb8a8('0x51')]));_0x493135['where'][_0xb8a8('0x76')]=_0x278a22['id'];if(_0x46018a[_0xb8a8('0x4f')]['filter']){_0x493135['where']=_['merge'](_0x493135['where'],{'$or':_[_0xb8a8('0x49')](_0x493135[_0xb8a8('0x54')],function(_0x11715d){var _0x11fd3c={};_0x11fd3c[_0x11715d]={'$like':'%'+_0x46018a[_0xb8a8('0x4f')]['filter']+'%'};return _0x11fd3c;})});}_0x493135=_[_0xb8a8('0x66')]({},_0x493135,_0x46018a[_0xb8a8('0x5c')]);return db[_0xb8a8('0x8f')]['count']({'where':_0x493135[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x545924){_0x46cf8d[_0xb8a8('0x23')]=_0x545924;if(_0x46018a[_0xb8a8('0x4f')]['includeAll']){_0x493135[_0xb8a8('0x5f')]=[{'model':db[_0xb8a8('0x90')],'as':_0xb8a8('0x91'),'required':![]},{'model':db['User'],'as':_0xb8a8('0x92'),'attributes':[_0xb8a8('0x2a'),_0xb8a8('0x93'),'internal'],'required':![]},{'model':db[_0xb8a8('0x94')],'as':_0xb8a8('0x95'),'attributes':['id','name','color'],'where':_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x96')]?{'id':_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x96')]}:undefined,'required':_0x46018a[_0xb8a8('0x4f')]['tag']?!![]:![]}];}return db[_0xb8a8('0x8f')][_0xb8a8('0x60')](_0x493135);})[_0xb8a8('0x28')](function(_0x19f697){_0x46cf8d['rows']=_0x19f697;return _0x46cf8d;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x2a14ab,_0x493135))['catch'](handleError(_0x2a14ab,null));};exports['addApplications']=function addApplications(_0x3b38c4,_0xb71317){var _0x40bf28=_0x3b38c4[_0xb8a8('0x63')]['id'];var _0x321086=_0x3b38c4[_0xb8a8('0x68')];var _0x472ed2=0xc8;var _0x1f0220=null;return db[_0xb8a8('0x97')][_0xb8a8('0x98')]({'isolationLevel':db[_0xb8a8('0x97')][_0xb8a8('0x99')][_0xb8a8('0x9a')]['READ_COMMITTED']},function(_0x3815fd){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x40bf28},'transaction':_0x3815fd})[_0xb8a8('0x28')](function(_0x5f39c0){if(_0x5f39c0){return db[_0xb8a8('0x9b')][_0xb8a8('0x25')]({'where':{'MailAccountId':_0x40bf28},'transaction':_0x3815fd})[_0xb8a8('0x28')](function(){var _0x107c60=_[_0xb8a8('0x49')](_0x321086,function(_0x507946){_0x507946[_0xb8a8('0x76')]=_0x40bf28;return _0x507946;});return db['MailApplication'][_0xb8a8('0x9c')](_0x107c60,{'transaction':_0x3815fd});});}else{_0x472ed2=0x194;_0x1f0220=[];}});})[_0xb8a8('0x28')](function(){if(_0x472ed2!==0x194){return db[_0xb8a8('0x9b')]['findAndCountAll']({'where':{'MailAccountId':_0x40bf28},'order':'priority'})[_0xb8a8('0x28')](function(_0xf761c9){_0x1f0220=_0xf761c9;});}})['catch'](function(_0x12eb91){_0x472ed2=0x1f4;logger['error'](_0x12eb91['stack']);if(_0x12eb91[_0xb8a8('0x2a')]){delete _0x12eb91[_0xb8a8('0x2a')];}_0x1f0220=_0x12eb91;})[_0xb8a8('0x9d')](function(){if(_0x1f0220===null){_0xb71317['sendStatus'](_0x472ed2);}else{if(_0x472ed2===0x1f4){_0xb71317['status'](_0x472ed2)[_0xb8a8('0x2b')](_0x1f0220);}else{_0xb71317[_0xb8a8('0x1e')](_0x472ed2)['json'](_0x1f0220);}}});};exports[_0xb8a8('0x9e')]=function(_0x1a42c4,_0xfadeae){var _0xd512a9={};var _0x9220b4={};var _0x5202f3;var _0x1a1bf7;return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x1a42c4[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xfadeae,null))[_0xb8a8('0x28')](function(_0x10f740){if(_0x10f740){_0x5202f3=_0x10f740;_0x9220b4[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db['MailApplication'][_0xb8a8('0x4b')]);_0x9220b4[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x1a42c4[_0xb8a8('0x4f')]);_0x9220b4[_0xb8a8('0x51')]=_['intersection'](_0x9220b4[_0xb8a8('0x4e')],_0x9220b4['query']);_0xd512a9[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x9220b4['model'],qs[_0xb8a8('0x65')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0xd512a9[_0xb8a8('0x54')]=_0xd512a9[_0xb8a8('0x54')]['length']?_0xd512a9[_0xb8a8('0x54')]:_0x9220b4[_0xb8a8('0x4e')];_0xd512a9[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0xd512a9[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x1a42c4[_0xb8a8('0x4f')],_0x9220b4[_0xb8a8('0x51')]));if(_0x1a42c4[_0xb8a8('0x4f')]['filter']){_0xd512a9['where']=_[_0xb8a8('0x66')](_0xd512a9[_0xb8a8('0x5d')],{'$or':_['map'](_0xd512a9[_0xb8a8('0x54')],function(_0x490b9e){var _0x224b85={};_0x224b85[_0x490b9e]={'$like':'%'+_0x1a42c4['query'][_0xb8a8('0x59')]+'%'};return _0x224b85;})});}_0xd512a9=_['merge']({},_0xd512a9,_0x1a42c4[_0xb8a8('0x5c')]);return _0x5202f3[_0xb8a8('0x9e')](_0xd512a9);}})[_0xb8a8('0x28')](function(_0x4ce25a){if(_0x4ce25a){_0x1a1bf7=_0x4ce25a['length'];if(!_0x1a42c4[_0xb8a8('0x4f')]['hasOwnProperty'](_0xb8a8('0x56'))){_0xd512a9[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x1a42c4['query'][_0xb8a8('0x21')]);_0xd512a9[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}return _0x5202f3[_0xb8a8('0x9e')](_0xd512a9);}})[_0xb8a8('0x28')](function(_0x570520){if(_0x570520){return _0x570520?{'count':_0x1a1bf7,'rows':_0x570520}:null;}})['then'](respondWithResult(_0xfadeae,null))[_0xb8a8('0x1c')](handleError(_0xfadeae,null));};exports[_0xb8a8('0x9f')]=function(_0x225e9d,_0x33dc44){var _0x1353db={'raw':!![],'where':{}};var _0x541653={};var _0x134734={'count':0x0,'rows':[]};return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x225e9d[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x33dc44,null))[_0xb8a8('0x28')](function(_0x1d82e2){if(_0x1d82e2){_0x541653[_0xb8a8('0x4e')]=_['keys'](db['MailMessage'][_0xb8a8('0x4b')]);_0x541653[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x225e9d[_0xb8a8('0x4f')]);_0x541653[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x541653[_0xb8a8('0x4e')],_0x541653[_0xb8a8('0x4f')]);_0x1353db[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x541653[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x1353db['attributes']=_0x1353db['attributes'][_0xb8a8('0x53')]?_0x1353db[_0xb8a8('0x54')]:_0x541653['model'];if(!_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x1353db[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x225e9d[_0xb8a8('0x4f')]['limit']);_0x1353db[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x225e9d['query']['offset']);}_0x1353db[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x225e9d[_0xb8a8('0x4f')]['sort']);_0x1353db[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x225e9d[_0xb8a8('0x4f')],_0x541653[_0xb8a8('0x51')]));_0x1353db[_0xb8a8('0x5d')][_0xb8a8('0x76')]=_0x1d82e2['id'];if(_0x225e9d['query'][_0xb8a8('0x59')]){_0x1353db[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x1353db[_0xb8a8('0x5d')],{'$or':_[_0xb8a8('0x49')](_0x1353db['attributes'],function(_0x5bcfe2){var _0x1659d3={};_0x1659d3[_0x5bcfe2]={'$like':'%'+_0x225e9d[_0xb8a8('0x4f')]['filter']+'%'};return _0x1659d3;})});}if(_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0xa0')]){var _0x4752ac=_0x225e9d['query'][_0xb8a8('0xa0')][_0xb8a8('0xa1')](',');var _0x47b517={};_0x47b517[_0x4752ac[0x0]]={'$gte':moment(_0x4752ac[0x1])['format'](_0xb8a8('0xa2'))};_0x1353db[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x1353db[_0xb8a8('0x5d')],_0x47b517);}_0x1353db=_[_0xb8a8('0x66')]({},_0x1353db,_0x225e9d[_0xb8a8('0x5c')]);return db[_0xb8a8('0xa3')]['count']({'where':_0x1353db[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x5f10a8){_0x134734[_0xb8a8('0x23')]=_0x5f10a8;if(_0x225e9d['query'][_0xb8a8('0x5e')]){_0x1353db['include']=[{'all':!![]}];}return db[_0xb8a8('0xa3')][_0xb8a8('0x60')](_0x1353db);})['then'](function(_0x306aa6){if(_0x225e9d['query'][_0xb8a8('0xa4')]===_0xb8a8('0xa5')){for(var _0x22b003=0x0;_0x22b003<_0x306aa6[_0xb8a8('0x53')];_0x22b003++){_0x306aa6[_0x22b003][_0xb8a8('0x68')]=juice(_0x306aa6[_0x22b003]['body']);}}_0x134734[_0xb8a8('0x61')]=_0x306aa6;return _0x134734;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x33dc44,_0x1353db))[_0xb8a8('0x1c')](handleError(_0x33dc44,null));};exports[_0xb8a8('0x2b')]=function(_0x1b63e5,_0x4da97d){var _0x465e12,_0x531a77={},_0x48acb8;if(_0x1b63e5['body']['to']){_0x48acb8=_0x1b63e5[_0xb8a8('0x68')]['to']['split'](',')[0x0];}return db[_0xb8a8('0x4a')]['find']({'where':{'id':_0x1b63e5[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0xa6')],'as':'List','include':[{'model':db[_0xb8a8('0x90')],'as':'Contacts','where':{'email':_0x48acb8},'limit':0x1,'order':[[_0xb8a8('0xa7'),_0xb8a8('0xa8')]]}]},{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44'),'raw':!![],'include':[{'model':db[_0xb8a8('0xa9')],'as':_0xb8a8('0xa9'),'raw':!![]}]}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x4da97d,null))[_0xb8a8('0x28')](function(_0x4ab2e5){if(!_0x4ab2e5)return;_0x465e12=_0x4ab2e5;if(!_0x4ab2e5[_0xb8a8('0x44')])throw new Error(_0xb8a8('0xaa'));if(_[_0xb8a8('0x7d')](_0x1b63e5[_0xb8a8('0x68')]['from'])){_0x1b63e5['body'][_0xb8a8('0xab')]=util[_0xb8a8('0xac')](_0xb8a8('0xad'),_0x4ab2e5[_0xb8a8('0x2a')],_0x4ab2e5[_0xb8a8('0x7b')]||_0x4ab2e5[_0xb8a8('0x44')][_0xb8a8('0x38')]);}if(_0x1b63e5['body'][_0xb8a8('0xae')]&&_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')]['length']){for(var _0x86c563=0x0;_0x86c563<_0x1b63e5[_0xb8a8('0x68')]['attachments'][_0xb8a8('0x53')];_0x86c563+=0x1){_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')][_0x86c563]={'filename':_0x1b63e5[_0xb8a8('0x68')]['attachments'][_0x86c563][_0xb8a8('0x2a')],'path':path[_0xb8a8('0xaf')](config[_0xb8a8('0xb0')],_0xb8a8('0xb1'),_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')][_0x86c563][_0xb8a8('0xb2')])};}}var _0x560eb1=_0x4ab2e5[_0xb8a8('0xb3')]();return respondWithRpcPromise(_0xb8a8('0xb4'),'sendMail',{'account':_0x560eb1,'message':_0x1b63e5[_0xb8a8('0x68')]});})[_0xb8a8('0x28')](function(_0x4233d0){if(!_0x4233d0)return;_0x531a77=_0x4233d0;if(!_0x465e12[_0xb8a8('0xb5')])throw new Error(_0xb8a8('0xb6'));if(_0x465e12['List'][_0xb8a8('0xb7')]['length'])return _0x465e12[_0xb8a8('0xb5')][_0xb8a8('0xb7')][0x0];return db[_0xb8a8('0x90')][_0xb8a8('0x6f')](_['defaults'](_0x1b63e5[_0xb8a8('0x68')],{'firstName':_0x1b63e5['body']['to'],'email':_0x1b63e5['body']['to'],'phone':_0x1b63e5['body']['to'],'ListId':_0x465e12[_0xb8a8('0x7c')]}));})[_0xb8a8('0x28')](function(_0x99fea5){if(!_0x99fea5)return;var _0x342e99={'UserId':_0x1b63e5[_0xb8a8('0x38')]['id'],'ContactId':_0x99fea5['id'],'MailAccountId':_0x465e12['id'],'inReplyTo':_0x531a77['messageId'],'to':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xab')],'cc':_0x1b63e5['body']['cc'],'subject':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xb8')],'attach':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xb9')],'firstMsgDirection':_0xb8a8('0xba'),'lastMsgAt':moment()[_0xb8a8('0xac')](_0xb8a8('0xa2')),'lastMsgDirection':'out','Messages':[_[_0xb8a8('0x66')](_0x1b63e5[_0xb8a8('0x68')],{'messageId':_0x531a77['messageId'],'sentAt':moment()[_0xb8a8('0xac')](_0xb8a8('0xa2')),'read':!![],'MailAccountId':_0x465e12['id'],'UserId':_0x1b63e5[_0xb8a8('0x38')]['id'],'ContactId':_0x99fea5['id']})]};if(_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xbb')]){_0x342e99=_[_0xb8a8('0x66')](_0x342e99,_0x1b63e5['body'][_0xb8a8('0xbb')]);}return db[_0xb8a8('0x8f')][_0xb8a8('0x6f')](_0x342e99,{'include':[{'model':db[_0xb8a8('0xa3')],'as':_0xb8a8('0xbc')}]});})['then'](respondWithResult(_0x4da97d,null))['catch'](handleError(_0x4da97d,null));};exports[_0xb8a8('0xbd')]=function(_0x3ac7a8,_0x575a0d){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x3ac7a8[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44'),'raw':!![],'include':[{'model':db[_0xb8a8('0xa9')],'as':_0xb8a8('0xa9'),'raw':!![]}]}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x575a0d,null))[_0xb8a8('0x28')](function(_0xad5112){if(!_0xad5112[_0xb8a8('0x44')])return;var _0x3dd1df=_0xad5112[_0xb8a8('0xb3')]();return respondWithRpcPromise(_0xb8a8('0xbe'),_0xb8a8('0xbd'),{'account':_0x3dd1df});})[_0xb8a8('0x28')](respondWithResult(_0x575a0d,null))[_0xb8a8('0x1c')](handleError(_0x575a0d,null));};exports[_0xb8a8('0x25')]=function(_0x331fea,_0x58fdea){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x331fea[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x58fdea,null))[_0xb8a8('0x28')](function(_0x404839){if(_0x404839&&_0x404839['service']){throw new db[(_0xb8a8('0xbf'))][(_0xb8a8('0xc0'))](_0xb8a8('0xc1'));}return _0x404839;})[_0xb8a8('0x28')](removeEntity(_0x58fdea,null))[_0xb8a8('0x1c')](handleError(_0x58fdea,null));};exports[_0xb8a8('0xc2')]=function(_0x29a374,_0x203dcf){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x29a374[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x203dcf,null))[_0xb8a8('0x28')](function(_0xa49bc7){if(_0xa49bc7){return _0xa49bc7[_0xb8a8('0xc2')](_0x29a374['body'][_0xb8a8('0x74')],_['omit'](_0x29a374[_0xb8a8('0x68')],[_0xb8a8('0x74'),'id'])||{})[_0xb8a8('0xc3')](function(_0x33f119){for(var _0x13a47d=0x0;_0x13a47d<_0x29a374[_0xb8a8('0x68')][_0xb8a8('0x74')][_0xb8a8('0x53')];_0x13a47d+=0x1){socket[_0xb8a8('0xc4')](_0xb8a8('0xc5'),{'UserId':Number(_0x29a374['body'][_0xb8a8('0x74')][_0x13a47d]),'MailAccountId':Number(_0x29a374['params']['id'])});}return _0x33f119;});}})[_0xb8a8('0x28')](respondWithResult(_0x203dcf,null))[_0xb8a8('0x1c')](handleError(_0x203dcf,null));};exports['removeAgents']=function(_0x2ae458,_0xf86e63){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x2ae458[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xf86e63,null))[_0xb8a8('0x28')](function(_0x9f8979){if(_0x9f8979){return _0x9f8979[_0xb8a8('0xc6')](_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')])['then'](function(){if(_[_0xb8a8('0xc7')](_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')])){for(var _0x57ecb9=0x0;_0x57ecb9<_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')][_0xb8a8('0x53')];_0x57ecb9+=0x1){socket[_0xb8a8('0xc4')](_0xb8a8('0xc8'),{'UserId':Number(_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')][_0x57ecb9]),'MailAccountId':Number(_0x2ae458[_0xb8a8('0x63')]['id'])});}}else{socket['emit'](_0xb8a8('0xc8'),{'UserId':Number(_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')]),'MailAccountId':Number(_0x2ae458[_0xb8a8('0x63')]['id'])});}});}})[_0xb8a8('0x28')](respondWithStatusCode(_0xf86e63,null))['catch'](handleError(_0xf86e63,null));};exports[_0xb8a8('0xc9')]=function(_0x444f5f,_0x19372b){var _0x3dcf9d={};var _0xa2344d={};var _0x385919;var _0x4ffd21;return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x444f5f[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x19372b,null))[_0xb8a8('0x28')](function(_0x158147){if(_0x158147){_0x385919=_0x158147;_0xa2344d[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0xca')][_0xb8a8('0x4b')]);_0xa2344d[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x444f5f[_0xb8a8('0x4f')]);_0xa2344d[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0xa2344d[_0xb8a8('0x4e')],_0xa2344d[_0xb8a8('0x4f')]);_0x3dcf9d[_0xb8a8('0x54')]=_['intersection'](_0xa2344d[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x444f5f['query'][_0xb8a8('0x65')]));_0x3dcf9d[_0xb8a8('0x54')]=_0x3dcf9d[_0xb8a8('0x54')][_0xb8a8('0x53')]?_0x3dcf9d[_0xb8a8('0x54')]:_0xa2344d[_0xb8a8('0x4e')];_0x3dcf9d['order']=qs[_0xb8a8('0x58')](_0x444f5f[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0x3dcf9d[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x444f5f[_0xb8a8('0x4f')],_0xa2344d[_0xb8a8('0x51')]));if(_0x444f5f[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x3dcf9d[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x3dcf9d[_0xb8a8('0x5d')],{'$or':_['map'](_0x3dcf9d[_0xb8a8('0x54')],function(_0x4ac84a){var _0x4e249a={};_0x4e249a[_0x4ac84a]={'$like':'%'+_0x444f5f['query']['filter']+'%'};return _0x4e249a;})});}_0x3dcf9d=_[_0xb8a8('0x66')]({},_0x3dcf9d,_0x444f5f[_0xb8a8('0x5c')]);return _0x385919[_0xb8a8('0xc9')](_0x3dcf9d);}})[_0xb8a8('0x28')](function(_0x1e8691){if(_0x1e8691){_0x4ffd21=_0x1e8691[_0xb8a8('0x53')];if(!_0x444f5f['query'][_0xb8a8('0x55')]('nolimit')){_0x3dcf9d[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x444f5f['query']['limit']);_0x3dcf9d['offset']=qs[_0xb8a8('0x20')](_0x444f5f[_0xb8a8('0x4f')]['offset']);}return _0x385919[_0xb8a8('0xc9')](_0x3dcf9d);}})[_0xb8a8('0x28')](function(_0x522325){if(_0x522325){return _0x522325?{'count':_0x4ffd21,'rows':_0x522325}:null;}})[_0xb8a8('0x28')](respondWithResult(_0x19372b,null))[_0xb8a8('0x1c')](handleError(_0x19372b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3c9c600..295aed3 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 _0x10ad=['update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x585dfb,_0x4e10fb){var _0x5292cd=function(_0x54e41e){while(--_0x54e41e){_0x585dfb['push'](_0x585dfb['shift']());}};_0x5292cd(++_0x4e10fb);}(_0x10ad,0xf4));var _0xd10a=function(_0x255a75,_0x161115){_0x255a75=_0x255a75-0x0;var _0x53ce5f=_0x10ad[_0x255a75];return _0x53ce5f;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd10a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd10a('0x1'),'afterDestroy':_0xd10a('0x2')};function emitEvent(_0xafc871){return function(_0x156625,_0x52fb77,_0x2af9a9){MailAccountEvents[_0xd10a('0x3')](_0xafc871+':'+_0x156625['id'],_0x156625);MailAccountEvents[_0xd10a('0x3')](_0xafc871,_0x156625);_0x2af9a9(null);};}for(var e in events){if(events[_0xd10a('0x4')](e)){var event=events[e];MailAccount[_0xd10a('0x5')](e,emitEvent(event));}}module[_0xd10a('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xb1f7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x2f76b7,_0x27ed34){var _0x23c611=function(_0x40ebbf){while(--_0x40ebbf){_0x2f76b7['push'](_0x2f76b7['shift']());}};_0x23c611(++_0x27ed34);}(_0xb1f7,0x19d));var _0x7b1f=function(_0x3b72a8,_0x228ed6){_0x3b72a8=_0x3b72a8-0x0;var _0x5c4edd=_0xb1f7[_0x3b72a8];return _0x5c4edd;};'use strict';var EventEmitter=require(_0x7b1f('0x0'));var MailAccount=require(_0x7b1f('0x1'))['db'][_0x7b1f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7b1f('0x3')](0x0);var events={'afterCreate':_0x7b1f('0x4'),'afterUpdate':_0x7b1f('0x5'),'afterDestroy':_0x7b1f('0x6')};function emitEvent(_0x86aff){return function(_0x2d1f14,_0x2941cc,_0x23838f){MailAccountEvents[_0x7b1f('0x7')](_0x86aff+':'+_0x2d1f14['id'],_0x2d1f14);MailAccountEvents[_0x7b1f('0x7')](_0x86aff,_0x2d1f14);_0x23838f(null);};}for(var e in events){if(events[_0x7b1f('0x8')](e)){var event=events[e];MailAccount[_0x7b1f('0x9')](e,emitEvent(event));}}module[_0x7b1f('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9f3b15f..eafc2d1 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 _0x94f4=['user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','Smtp','host','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','data5','auth'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x94f4,0x1ef));var _0x494f=function(_0x3a444d,_0xa99a4d){_0x3a444d=_0x3a444d-0x0;var _0x1e6f23=_0x94f4[_0x3a444d];return _0x1e6f23;};'use strict';var attributes=require(_0x494f('0x0'));module['exports']=function(_0x4aa6c5){return _0x4aa6c5[_0x494f('0x1')](_0x494f('0x2'),attributes,{'tableName':_0x494f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x42fac8=this;var _0x3f65b6={'id':_0x42fac8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x42fac8[_0x494f('0x4')]!==_0x494f('0x5')){_0x3f65b6['service']=_0x42fac8[_0x494f('0x4')];}else{_0x3f65b6['host']=_0x42fac8[_0x494f('0x6')][_0x494f('0x7')];_0x3f65b6[_0x494f('0x8')]=_0x42fac8[_0x494f('0x6')][_0x494f('0x8')];_0x3f65b6[_0x494f('0x9')]=_0x42fac8[_0x494f('0x6')][_0x494f('0x9')];}if(_0x42fac8[_0x494f('0x6')]['authentication']){if(_0x42fac8['Smtp'][_0x494f('0xa')]){if(!_0x42fac8[_0x494f('0x6')][_0x494f('0xb')])throw new Error(_0x494f('0xc'));_0x3f65b6['auth']={'type':'OAuth2','user':_0x42fac8[_0x494f('0x6')]['user'],'accessToken':_0x42fac8[_0x494f('0x6')][_0x494f('0xb')][_0x494f('0xd')]};}else{_0x3f65b6[_0x494f('0xe')]={'user':_0x42fac8[_0x494f('0x6')][_0x494f('0xf')],'pass':_0x42fac8[_0x494f('0x6')][_0x494f('0x10')]};}}return _0x3f65b6;}}});}; \ No newline at end of file +var _0x0057=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider'];(function(_0x26c7c9,_0x7b7d35){var _0x4fd423=function(_0x116abf){while(--_0x116abf){_0x26c7c9['push'](_0x26c7c9['shift']());}};_0x4fd423(++_0x7b7d35);}(_0x0057,0x145));var _0x7005=function(_0x509c4d,_0x50717e){_0x509c4d=_0x509c4d-0x0;var _0x29b6c6=_0x0057[_0x509c4d];return _0x29b6c6;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x46f931){return _0x46f931[_0x7005('0x0')]('MailAccount',attributes,{'tableName':_0x7005('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x261e82=this;var _0x1093f1={'id':_0x261e82['id'],'tls':{'rejectUnauthorized':![]}};if(_0x261e82[_0x7005('0x2')]!==_0x7005('0x3')){_0x1093f1[_0x7005('0x4')]=_0x261e82[_0x7005('0x2')];}else{_0x1093f1[_0x7005('0x5')]=_0x261e82[_0x7005('0x6')][_0x7005('0x5')];_0x1093f1['port']=_0x261e82[_0x7005('0x6')][_0x7005('0x7')];_0x1093f1['secure']=_0x261e82[_0x7005('0x6')][_0x7005('0x8')];}if(_0x261e82[_0x7005('0x6')][_0x7005('0x9')]){if(_0x261e82[_0x7005('0x6')]['modernAuthentication']){if(!_0x261e82[_0x7005('0x6')][_0x7005('0xa')])throw new Error(_0x7005('0xb'));_0x1093f1[_0x7005('0xc')]={'type':'OAuth2','user':_0x261e82[_0x7005('0x6')][_0x7005('0xd')],'accessToken':_0x261e82[_0x7005('0x6')][_0x7005('0xa')][_0x7005('0xe')]};}else{_0x1093f1[_0x7005('0xc')]={'user':_0x261e82[_0x7005('0x6')]['user'],'pass':_0x261e82[_0x7005('0x6')][_0x7005('0xf')]};}}return _0x1093f1;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9118291..e2cb3d8 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 _0x57ca=['setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','List','omit','applications','list','orderBy','asc','push','length','close','*,*,*,*','ListId','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','get','created','originCc','bcc','Email','Attachment','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','MailAccount','find'];(function(_0x4726b2,_0x3b8841){var _0x411c40=function(_0x22031b){while(--_0x22031b){_0x4726b2['push'](_0x4726b2['shift']());}};_0x411c40(++_0x3b8841);}(_0x57ca,0x108));var _0xa57c=function(_0x378ed7,_0x3fabf2){_0x378ed7=_0x378ed7-0x0;var _0x382657=_0x57ca[_0x378ed7];return _0x382657;};'use strict';var _=require('lodash');var moment=require(_0xa57c('0x0'));var BPromise=require(_0xa57c('0x1'));var rs=require('randomstring');var Redis=require(_0xa57c('0x2'));var db=require(_0xa57c('0x3'))['db'];var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa57c('0x7')][_0xa57c('0x8')]({'port':0x232c});config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));require('./mailAccount.socket')[_0xa57c('0xd')](socket);function respondWithRpcPromise(_0x4b51d8,_0x46ba92,_0x932dcc){return new BPromise(function(_0x4fa5ed,_0x156bca){return client['request'](_0x4b51d8,_0x932dcc)[_0xa57c('0xe')](function(_0x44b221){logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');logger[_0xa57c('0x10')](_0xa57c('0x11'),_0x46ba92,_0xa57c('0x12'),JSON[_0xa57c('0x13')](_0x44b221));if(_0x44b221[_0xa57c('0x14')]){if(_0x44b221['error'][_0xa57c('0x15')]===0x1f4){logger['error'](_0xa57c('0xf'),_0x46ba92,_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x156bca(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0x44b221['error'][_0xa57c('0x16')]);return _0x4fa5ed(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');_0x4fa5ed(_0x44b221[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0xe3d505){logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0xe3d505);_0x156bca(_0xe3d505);});});}exports[_0xa57c('0x19')]=function(_0x595c7a){var _0x4e4399=this;return new Promise(function(_0x8a8856,_0x4a53ab){return db['MailAccount'][_0xa57c('0x1a')]({'raw':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1c')]===undefined?!![]:![]:!![],'where':_0x595c7a['options']?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1d')]||null:null,'attributes':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1e')]||null:null,'limit':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1f')]||null:null,'include':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1e')],'include':_0x431bec[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x431bec[_0xa57c('0x20')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x22')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1e')],'include':_0x315ad7[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x315ad7[_0xa57c('0x20')],function(_0x57ebe0){return{'model':db[_0x57ebe0[_0xa57c('0x22')]],'as':_0x57ebe0['as'],'attributes':_0x57ebe0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257661){logger[_0xa57c('0x23')]('GetMailAccount',_0x595c7a);logger[_0xa57c('0x10')](_0xa57c('0x19'),_0x595c7a,JSON[_0xa57c('0x13')](_0x257661));_0x8a8856(_0x257661);})['catch'](function(_0xd779f1){logger['error'](_0xa57c('0x19'),_0xd779f1['message'],_0x595c7a);_0x4a53ab(_0x4e4399[_0xa57c('0x14')](0x1f4,_0xd779f1['message']));});});};exports[_0xa57c('0x24')]=function(_0x532164){var _0x9e02bb=this;return new Promise(function(_0x1d82d9,_0x43c8f3){return db[_0xa57c('0x25')][_0xa57c('0x26')]({'raw':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x1d')]||null:null,'attributes':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['attributes']||null:null,'include':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x20')]?_['map'](_0x532164[_0xa57c('0x1b')]['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x22')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x20')]?_['map'](_0x433116[_0xa57c('0x20')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x22')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1e')],'include':_0x5c56d3[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x5c56d3[_0xa57c('0x20')],function(_0x44350f){return{'model':db[_0x44350f['model']],'as':_0x44350f['as'],'attributes':_0x44350f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa57c('0xe')](function(_0x13e390){if(_0x532164[_0xa57c('0x1b')]['smtp']===!![])_0x13e390[_0xa57c('0x27')]('smtpOptions',_0x13e390[_0xa57c('0x28')]());logger[_0xa57c('0x23')]('ShowMailAccount',_0x532164);logger['debug']('ShowMailAccount',_0x532164,JSON[_0xa57c('0x13')](_0x13e390));_0x1d82d9(_0x13e390);})[_0xa57c('0x18')](function(_0x269a19){logger[_0xa57c('0x14')](_0xa57c('0x24'),_0x269a19[_0xa57c('0x16')],_0x532164);_0x43c8f3(_0x9e02bb['error'](0x1f4,_0x269a19[_0xa57c('0x16')]));});});};exports[_0xa57c('0x29')]=function(_0x5a5490){var _0x5ed42d=this;return new Promise(function(_0x5e10b,_0x203375){var _0x5af5e9={'body':_0x5a5490[_0xa57c('0x2a')],'channel':_0xa57c('0x2b')};var _0x2112b7=_[_0xa57c('0x2c')](_[_0xa57c('0x2d')](db[_0xa57c('0x2e')]['rawAttributes']),[_0xa57c('0x2f'),'updatedAt','CompanyId','ListId']);var _0x520383=![];if(_0x5a5490['body']['id']){delete _0x5a5490[_0xa57c('0x2a')]['id'];}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')]['from'])){return _0x203375(_0x5ed42d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')])||_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')]===''){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x32')+_0x2112b7));}if(!_[_0xa57c('0x33')](_0x2112b7,_0x5a5490['body'][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x34')+_0x2112b7));}var _0x14e943={};_0x14e943[_0x5a5490[_0xa57c('0x2a')]['mapKey']]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x25')][_0xa57c('0x26')]({'where':{'id':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x37')],'as':'List','include':[{'model':db[_0xa57c('0x2e')],'as':_0xa57c('0x38'),'where':_0x14e943,'limit':0x1,'order':[[_0xa57c('0x39'),_0xa57c('0x3a')]]}]},{'model':db[_0xa57c('0x3b')],'as':_0xa57c('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xa57c('0xe')](function(_0x49492f){if(_0x49492f&&_0x49492f[_0xa57c('0x3d')]){var _0xae87=_0x49492f['get']({'plain':!![]});_0x5af5e9[_0xa57c('0x36')]=_[_0xa57c('0x3e')](_0xae87,[_0xa57c('0x3c'),_0xa57c('0x3d')]);_0x5af5e9[_0xa57c('0x36')]['smtpOptions']=_0x49492f[_0xa57c('0x28')]();_0x5af5e9[_0xa57c('0x3f')]=_0xae87[_0xa57c('0x3c')];_0x5af5e9[_0xa57c('0x40')]=_0xae87[_0xa57c('0x3d')];_0x5af5e9['applications']=_[_0xa57c('0x41')](_0x5af5e9['applications'],['priority'],[_0xa57c('0x42')]);if(_0x5af5e9[_0xa57c('0x36')]&&_0x5af5e9[_0xa57c('0x36')]['autoclose']){_0x5af5e9['applications'][_0xa57c('0x43')]({'id':0x0,'priority':_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x44')]+0x1,'app':_0xa57c('0x45'),'appdata':'autoclose','interval':_0xa57c('0x46')});}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3c')]){delete _0x5af5e9['account']['Applications'];}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3d')]){delete _0x5af5e9['account'][_0xa57c('0x3d')];}if(_0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][_0xa57c('0x44')]){return _0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][0x0];}var _0x4fc413=_['defaults'](_0x5a5490['body'],{'firstName':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')],'ListId':_0xae87[_0xa57c('0x47')]});_0x4fc413[_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')]]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x2e')]['create'](_0x4fc413);}else{throw new Error('List\x20not\x20found');}})[_0xa57c('0xe')](function(_0x4e18ad){_0x5af5e9[_0xa57c('0x48')]=_0x4e18ad;if(_0x4e18ad){if(!_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['messageId']){_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x49')]=rs['generate']()+'\x20'+_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x35')];}var _0x26a8e1={'ContactId':_0x4e18ad['id'],'MailAccountId':_0x5a5490['account']['id'],'inReplyTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'to':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['from'],'cc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa57c('0x26')]({'where':{'closed':![],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x4e')],'as':_0xa57c('0x4f'),'attributes':[_0xa57c('0x49')],'where':{'messageId':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x50')]}}]})[_0xa57c('0xe')](function(_0x521acc){if(_0x521acc){return[_0x521acc,![]];}return db[_0xa57c('0x51')][_0xa57c('0x52')](_0x26a8e1)[_0xa57c('0xe')](function(_0xa78a75){return[_0xa78a75,!![]];});});}else{throw new Error(_0xa57c('0x53'));}})[_0xa57c('0x54')](function(_0x24efa0,_0x5e1103){if(_0x24efa0){_0x520383=_0x5e1103;if(!_0x5e1103){return _0x24efa0[_0xa57c('0x55')]({'inReplyTo':_0x5a5490['body'][_0xa57c('0x16')]['messageId'],'to':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x35')],'cc':_0x5a5490[_0xa57c('0x2a')]['message']['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x24efa0[_0xa57c('0x4b')]?_0x24efa0['attach']:_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'substatus':null,'substatusAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'});}else{return _0x24efa0;}}})[_0xa57c('0xe')](function(_0x11c13e){_0x5af5e9[_0xa57c('0x56')]=_0x11c13e[_0xa57c('0x57')]({'plain':!![]});_0x5af5e9[_0xa57c('0x56')][_0xa57c('0x58')]=_0x520383;return db[_0xa57c('0x4e')][_0xa57c('0x52')]({'body':_0x5a5490[_0xa57c('0x2a')]['body'],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id'],'MailInteractionId':_0x11c13e['id'],'direction':'in','ContactId':_0x5af5e9['contact']['id'],'messageId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'from':_0x5a5490['body'][_0xa57c('0x16')][_0xa57c('0x35')],'to':_0x5a5490[_0xa57c('0x2a')]['message']['to'],'cc':_0x5a5490['body'][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'Attachments':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['attachments'],'originTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originTo'],'originCc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x59')],'bcc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x5a')],'ChatWebsiteId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['ChatWebsiteId']||null,'originChannel':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originChannel']||_0xa57c('0x5b'),'ChatOfflineMessageId':_0x5a5490[_0xa57c('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5d')}]});})[_0xa57c('0xe')](function(_0x1604d6){_0x5af5e9[_0xa57c('0x16')]=_0x1604d6;if(_0x5af5e9['interaction'][_0xa57c('0x5e')]){return db[_0xa57c('0x5f')][_0xa57c('0x26')]({'attributes':['id','name'],'where':{'id':_0x5af5e9[_0xa57c('0x56')]['UserId']}})[_0xa57c('0xe')](function(_0x2963cb){if(_0x2963cb){_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2963cb[_0xa57c('0x61')]+','+(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x62')]||0xa),'interval':_0xa57c('0x46')});}return respondWithRpcPromise('Start',_0xa57c('0x63'),_0x5af5e9);});}return respondWithRpcPromise(_0xa57c('0x64'),_0xa57c('0x63'),_0x5af5e9);})['then'](function(_0x3da413){_0x5e10b(_0x3da413);})[_0xa57c('0x18')](function(_0x2ed4f4){_0x203375(_0x5ed42d['error'](0x1f4,_0x2ed4f4[_0xa57c('0x16')]));});});}; \ No newline at end of file +var _0x687b=['originTo','originCc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','body','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','CloudProvider','List','omit','applications','list','orderBy','asc','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','spread','update','interaction','get','created','contact'];(function(_0x5a7f23,_0x47b655){var _0x3cc78d=function(_0x25ee96){while(--_0x25ee96){_0x5a7f23['push'](_0x5a7f23['shift']());}};_0x3cc78d(++_0x47b655);}(_0x687b,0x14a));var _0xb687=function(_0x47ee00,_0x256539){_0x47ee00=_0x47ee00-0x0;var _0x3d35f9=_0x687b[_0x47ee00];return _0x3d35f9;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var BPromise=require(_0xb687('0x2'));var rs=require(_0xb687('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xb687('0x4'))(_0xb687('0x5'));var config=require(_0xb687('0x6'));var jayson=require(_0xb687('0x7'));var client=jayson[_0xb687('0x8')][_0xb687('0x9')]({'port':0x232c});config[_0xb687('0xa')]=_[_0xb687('0xb')](config[_0xb687('0xa')],{'host':_0xb687('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb687('0xa')]));require(_0xb687('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a99c5,_0x21e3ab,_0x825ad){return new BPromise(function(_0x15dc9a,_0x404fdb){return client[_0xb687('0xe')](_0x1a99c5,_0x825ad)[_0xb687('0xf')](function(_0xaf4727){logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));logger[_0xb687('0x12')](_0xb687('0x13'),_0x21e3ab,_0xb687('0x11'),JSON['stringify'](_0xaf4727));if(_0xaf4727['error']){if(_0xaf4727[_0xb687('0x14')][_0xb687('0x15')]===0x1f4){logger['error'](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x404fdb(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x15dc9a(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}else{logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));_0x15dc9a(_0xaf4727[_0xb687('0x18')][_0xb687('0x17')]);}})['catch'](function(_0x48958d){logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0x48958d);_0x404fdb(_0x48958d);});});}exports[_0xb687('0x19')]=function(_0x4b593b){var _0x42cdd2=this;return new Promise(function(_0x481f1d,_0x1bd2bf){return db[_0xb687('0x1a')][_0xb687('0x1b')]({'raw':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b593b['options']?_0x4b593b[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1f')]||null:null,'limit':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x20')]||null:null,'include':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x21')]?_[_0xb687('0x22')](_0x4b593b['options'][_0xb687('0x21')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x23')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1f')],'include':_0x129347[_0xb687('0x21')]?_[_0xb687('0x22')](_0x129347[_0xb687('0x21')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x23')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1f')],'include':_0x3cb2f2['include']?_[_0xb687('0x22')](_0x3cb2f2[_0xb687('0x21')],function(_0x392721){return{'model':db[_0x392721[_0xb687('0x23')]],'as':_0x392721['as'],'attributes':_0x392721[_0xb687('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x4e9a06){logger[_0xb687('0x10')]('GetMailAccount',_0x4b593b);logger[_0xb687('0x12')](_0xb687('0x19'),_0x4b593b,JSON[_0xb687('0x24')](_0x4e9a06));_0x481f1d(_0x4e9a06);})[_0xb687('0x25')](function(_0x1ad3ef){logger[_0xb687('0x14')](_0xb687('0x19'),_0x1ad3ef['message'],_0x4b593b);_0x1bd2bf(_0x42cdd2[_0xb687('0x14')](0x1f4,_0x1ad3ef[_0xb687('0x17')]));});});};exports[_0xb687('0x26')]=function(_0x22cd1d){var _0xa18fec=this;return new Promise(function(_0x263834,_0x44be88){return db[_0xb687('0x1a')][_0xb687('0x27')]({'raw':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['attributes']||null:null,'include':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')]?_['map'](_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')],function(_0x548b83){return{'model':db[_0x548b83[_0xb687('0x23')]],'as':_0x548b83['as'],'attributes':_0x548b83['attributes'],'include':_0x548b83[_0xb687('0x21')]?_[_0xb687('0x22')](_0x548b83[_0xb687('0x21')],function(_0x3e146a){return{'model':db[_0x3e146a[_0xb687('0x23')]],'as':_0x3e146a['as'],'attributes':_0x3e146a[_0xb687('0x1f')],'include':_0x3e146a['include']?_[_0xb687('0x22')](_0x3e146a[_0xb687('0x21')],function(_0x2a73df){return{'model':db[_0x2a73df[_0xb687('0x23')]],'as':_0x2a73df['as'],'attributes':_0x2a73df['attributes']};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x100f4a){if(_0x22cd1d[_0xb687('0x1c')][_0xb687('0x28')]===!![])_0x100f4a[_0xb687('0x29')]('smtpOptions',_0x100f4a[_0xb687('0x2a')]());logger[_0xb687('0x10')](_0xb687('0x26'),_0x22cd1d);logger[_0xb687('0x12')](_0xb687('0x26'),_0x22cd1d,JSON[_0xb687('0x24')](_0x100f4a));_0x263834(_0x100f4a);})['catch'](function(_0x5ad577){logger[_0xb687('0x14')]('ShowMailAccount',_0x5ad577[_0xb687('0x17')],_0x22cd1d);_0x44be88(_0xa18fec[_0xb687('0x14')](0x1f4,_0x5ad577['message']));});});};exports[_0xb687('0x2b')]=function(_0x2ce07a){var _0x57776b=this;return new Promise(function(_0x394b56,_0x28031e){var _0x127b25={'body':_0x2ce07a['body'],'channel':_0xb687('0x2c')};var _0x9cffb2=_[_0xb687('0x2d')](_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')]),[_0xb687('0x31'),'updatedAt',_0xb687('0x32'),'ListId']);var _0x50fdb7=![];if(_0x2ce07a[_0xb687('0x33')]['id']){delete _0x2ce07a[_0xb687('0x33')]['id'];}if(_['isNil'](_0x2ce07a[_0xb687('0x33')]['from'])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x34')));}if(_['isNil'](_0x2ce07a[_0xb687('0x33')][_0xb687('0x33')])||_0x2ce07a['body'][_0xb687('0x33')]===''){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x35')));}if(_[_0xb687('0x36')](_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x38')+_0x9cffb2));}if(!_[_0xb687('0x39')](_0x9cffb2,_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cffb2));}var _0x1ac373={};_0x1ac373[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')];return db[_0xb687('0x1a')][_0xb687('0x27')]({'where':{'id':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb687('0x2f')],'as':_0xb687('0x3c'),'where':_0x1ac373,'limit':0x1,'order':[[_0xb687('0x3d'),_0xb687('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xb687('0x3f')},{'model':db[_0xb687('0x40')],'as':_0xb687('0x41'),'include':[{'model':db[_0xb687('0x42')],'as':'CloudProvider'}]}]})[_0xb687('0xf')](function(_0xfc4c5f){if(_0xfc4c5f&&_0xfc4c5f[_0xb687('0x43')]){var _0x401b99=_0xfc4c5f['get']({'plain':!![]});_0x127b25['account']=_[_0xb687('0x44')](_0x401b99,[_0xb687('0x3f'),_0xb687('0x43')]);_0x127b25['account']['smtpOptions']=_0xfc4c5f[_0xb687('0x2a')]();_0x127b25[_0xb687('0x45')]=_0x401b99[_0xb687('0x3f')];_0x127b25[_0xb687('0x46')]=_0x401b99[_0xb687('0x43')];_0x127b25[_0xb687('0x45')]=_[_0xb687('0x47')](_0x127b25[_0xb687('0x45')],['priority'],[_0xb687('0x48')]);if(_0x127b25[_0xb687('0x3b')]&&_0x127b25[_0xb687('0x3b')]['autoclose']){_0x127b25['applications']['push']({'id':0x0,'priority':_0x127b25['applications'][_0xb687('0x49')]+0x1,'app':_0xb687('0x4a'),'appdata':_0xb687('0x4b'),'interval':_0xb687('0x4c')});}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x3f')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x3f')];}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x43')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x43')];}if(_0x401b99[_0xb687('0x43')][_0xb687('0x3c')][_0xb687('0x49')]){return _0x401b99[_0xb687('0x43')][_0xb687('0x3c')][0x0];}var _0x4dca01=_['defaults'](_0x2ce07a[_0xb687('0x33')],{'firstName':_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')],'ListId':_0x401b99[_0xb687('0x4d')]});_0x4dca01[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')]['from'];return db[_0xb687('0x2f')]['create'](_0x4dca01);}else{throw new Error(_0xb687('0x4e'));}})[_0xb687('0xf')](function(_0x50fb31){_0x127b25['contact']=_0x50fb31;if(_0x50fb31){if(!_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId']){_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')]=rs['generate']()+'\x20'+_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')];}var _0x1a31f6={'ContactId':_0x50fb31['id'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId'],'to':_0x2ce07a['body'][_0xb687('0x17')]['from'],'cc':_0x2ce07a['body']['message']['cc'],'subject':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x50')],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'};return db[_0xb687('0x54')][_0xb687('0x27')]({'where':{'closed':![],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db[_0xb687('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x56')]}}]})[_0xb687('0xf')](function(_0x1c031f){if(_0x1c031f){return[_0x1c031f,![]];}return db[_0xb687('0x54')][_0xb687('0x57')](_0x1a31f6)['then'](function(_0x22da49){return[_0x22da49,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb687('0x58')](function(_0x293281,_0x18993a){if(_0x293281){_0x50fdb7=_0x18993a;if(!_0x18993a){return _0x293281[_0xb687('0x59')]({'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')],'to':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x3a')],'cc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['cc'],'subject':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x50')],'attach':_0x293281[_0xb687('0x51')]?_0x293281[_0xb687('0x51')]:_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'substatus':null,'substatusAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'});}else{return _0x293281;}}})[_0xb687('0xf')](function(_0x48838a){_0x127b25[_0xb687('0x5a')]=_0x48838a[_0xb687('0x5b')]({'plain':!![]});_0x127b25[_0xb687('0x5a')][_0xb687('0x5c')]=_0x50fdb7;return db['MailMessage'][_0xb687('0x57')]({'body':_0x2ce07a[_0xb687('0x33')]['body'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'MailInteractionId':_0x48838a['id'],'direction':'in','ContactId':_0x127b25[_0xb687('0x5d')]['id'],'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x4f')],'from':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')],'to':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['to'],'cc':_0x2ce07a[_0xb687('0x33')]['message']['cc'],'subject':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['subject'],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['attach'],'Attachments':_0x2ce07a['body'][_0xb687('0x17')]['attachments'],'originTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5e')],'originCc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5f')],'bcc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['bcc'],'ChatWebsiteId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x60')]||null,'originChannel':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x61')]||'Email','ChatOfflineMessageId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb687('0x62')],'as':_0xb687('0x63')}]});})[_0xb687('0xf')](function(_0x1227fe){_0x127b25['message']=_0x1227fe;if(_0x127b25[_0xb687('0x5a')]['UserId']){return db['User'][_0xb687('0x27')]({'attributes':['id','name'],'where':{'id':_0x127b25['interaction'][_0xb687('0x64')]}})['then'](function(_0x137631){if(_0x137631){_0x127b25[_0xb687('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb687('0x65'),'appdata':_0x137631[_0xb687('0x66')]+','+(_0x127b25['account'][_0xb687('0x67')]||0xa),'interval':_0xb687('0x4c')});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);})[_0xb687('0xf')](function(_0x2ce516){_0x394b56(_0x2ce516);})[_0xb687('0x25')](function(_0x4092a0){_0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0x4092a0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 168ef67..aaf9d5b 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 _0xc59f=['remove','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x23008a,_0x2c0d8e){var _0x5e17a5=function(_0x20dcf7){while(--_0x20dcf7){_0x23008a['push'](_0x23008a['shift']());}};_0x5e17a5(++_0x2c0d8e);}(_0xc59f,0x6f));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xfc59('0x0'));var events=['save',_0xfc59('0x1'),'update'];function createListener(_0x538e91,_0x1f3f73){return function(_0x4cb052){_0x1f3f73[_0xfc59('0x2')](_0x538e91,_0x4cb052);};}function removeListener(_0x51f799,_0x5804e1){return function(){MailAccountEvents[_0xfc59('0x3')](_0x51f799,_0x5804e1);};}exports[_0xfc59('0x4')]=function(_0x1939ce){for(var _0x1a1ce1=0x0,_0x38e8fa=events[_0xfc59('0x5')];_0x1a1ce1<_0x38e8fa;_0x1a1ce1++){var _0x1d83cf=events[_0x1a1ce1];var _0x4b7343=createListener(_0xfc59('0x6')+_0x1d83cf,_0x1939ce);MailAccountEvents['on'](_0x1d83cf,_0x4b7343);}}; \ No newline at end of file +var _0xa057=['emit','removeListener','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x39e23a,_0x17845e){var _0x40eda6=function(_0x5edec6){while(--_0x5edec6){_0x39e23a['push'](_0x39e23a['shift']());}};_0x40eda6(++_0x17845e);}(_0xa057,0x123));var _0x7a05=function(_0x901120,_0x2218ba){_0x901120=_0x901120-0x0;var _0x57bb0d=_0xa057[_0x901120];return _0x57bb0d;};'use strict';var MailAccountEvents=require(_0x7a05('0x0'));var events=[_0x7a05('0x1'),'remove',_0x7a05('0x2')];function createListener(_0x28ebf8,_0x195e2c){return function(_0x5a394a){_0x195e2c[_0x7a05('0x3')](_0x28ebf8,_0x5a394a);};}function removeListener(_0x3d346d,_0x5404f2){return function(){MailAccountEvents[_0x7a05('0x4')](_0x3d346d,_0x5404f2);};}exports['register']=function(_0x599a35){for(var _0x1f3b61=0x0,_0x19e056=events[_0x7a05('0x5')];_0x1f3b61<_0x19e056;_0x1f3b61++){var _0x560067=events[_0x1f3b61];var _0x32d32f=createListener(_0x7a05('0x6')+_0x560067,_0x599a35);MailAccountEvents['on'](_0x560067,_0x32d32f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 16a0346..c45367d 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 _0x81a0=['isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','/:id','show','put'];(function(_0xebbce2,_0x5bbae7){var _0x3cb5c3=function(_0x4d3ad1){while(--_0x4d3ad1){_0xebbce2['push'](_0xebbce2['shift']());}};_0x3cb5c3(++_0x5bbae7);}(_0x81a0,0x9e));var _0x081a=function(_0x2a808c,_0x361bcd){_0x2a808c=_0x2a808c-0x0;var _0x29fb32=_0x81a0[_0x2a808c];return _0x29fb32;};'use strict';var multer=require(_0x081a('0x0'));var util=require(_0x081a('0x1'));var path=require(_0x081a('0x2'));var timeout=require(_0x081a('0x3'));var express=require('express');var router=express[_0x081a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x081a('0x5'));var interaction=require(_0x081a('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0x081a('0x7'),auth['isAuthenticated'](),controller[_0x081a('0x8')]);router[_0x081a('0x9')](_0x081a('0x7'),auth[_0x081a('0xa')](),controller['update']);router[_0x081a('0xb')](_0x081a('0x7'),auth[_0x081a('0xa')](),controller[_0x081a('0xc')]);module[_0x081a('0xd')]=router; \ No newline at end of file +var _0x1517=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','delete','destroy','multer','path','Router','../../components/auth/service'];(function(_0x480435,_0x2ddfdd){var _0x5056b3=function(_0x42126d){while(--_0x42126d){_0x480435['push'](_0x480435['shift']());}};_0x5056b3(++_0x2ddfdd);}(_0x1517,0x71));var _0x7151=function(_0xace5bb,_0x4322f6){_0xace5bb=_0xace5bb-0x0;var _0x37bd48=_0x1517[_0xace5bb];return _0x37bd48;};'use strict';var multer=require(_0x7151('0x0'));var util=require('util');var path=require(_0x7151('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7151('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7151('0x3'));var interaction=require(_0x7151('0x4'));var config=require(_0x7151('0x5'));var controller=require('./mailApplication.controller');router[_0x7151('0x6')]('/:id',auth[_0x7151('0x7')](),controller[_0x7151('0x8')]);router[_0x7151('0x9')](_0x7151('0xa'),auth[_0x7151('0x7')](),controller['update']);router[_0x7151('0xb')](_0x7151('0xa'),auth['isAuthenticated'](),controller[_0x7151('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4d84fa1..2245ead 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 _0xc4e1=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xc4e1,0x10d));var _0x1c4e=function(_0x5925ca,_0x283353){_0x5925ca=_0x5925ca-0x0;var _0x1d1030=_0xc4e1[_0x5925ca];return _0x1d1030;};'use strict';var Sequelize=require(_0x1c4e('0x0'));module[_0x1c4e('0x1')]={'priority':{'type':Sequelize[_0x1c4e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1c4e('0x3')],'allowNull':![],'defaultValue':_0x1c4e('0x4')},'appdata':{'type':Sequelize[_0x1c4e('0x5')]()},'description':{'type':Sequelize[_0x1c4e('0x3')]},'interval':{'type':Sequelize[_0x1c4e('0x3')],'defaultValue':_0x1c4e('0x6')}}; \ No newline at end of file +var _0xc60a=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1f4361,_0x520dce){var _0x5cfd53=function(_0xd72018){while(--_0xd72018){_0x1f4361['push'](_0x1f4361['shift']());}};_0x5cfd53(++_0x520dce);}(_0xc60a,0x1b3));var _0xac60=function(_0x462b48,_0x5379bf){_0x462b48=_0x462b48-0x0;var _0x2a4e55=_0xc60a[_0x462b48];return _0x2a4e55;};'use strict';var Sequelize=require(_0xac60('0x0'));module[_0xac60('0x1')]={'priority':{'type':Sequelize[_0xac60('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xac60('0x3')],'allowNull':![],'defaultValue':_0xac60('0x4')},'appdata':{'type':Sequelize[_0xac60('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xac60('0x3')],'defaultValue':_0xac60('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index de70828..b6fec8c 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0xbdb7[_0x3a441a];return _0x3128a2;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x5954dd,_0x23eedc){var _0x32fbab=function(_0x1f5781){while(--_0x1f5781){_0x5954dd['push'](_0x5954dd['shift']());}};_0x32fbab(++_0x23eedc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 6a87d89..9c9cad3 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 _0x6f5b=['utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','./mailApplication.attributes','define','mail_applications'];(function(_0x9ef720,_0x4d1f35){var _0x4ec6cc=function(_0x4db584){while(--_0x4db584){_0x9ef720['push'](_0x9ef720['shift']());}};_0x4ec6cc(++_0x4d1f35);}(_0x6f5b,0x1c5));var _0xb6f5=function(_0x42f91f,_0xe00cba){_0x42f91f=_0x42f91f-0x0;var _0x158c92=_0x6f5b[_0x42f91f];return _0x158c92;};'use strict';var _=require(_0xb6f5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb6f5('0x1'));var moment=require('moment');var BPromise=require(_0xb6f5('0x2'));var rp=require(_0xb6f5('0x3'));var fs=require('fs');var path=require(_0xb6f5('0x4'));var rimraf=require(_0xb6f5('0x5'));var config=require('../../config/environment');var attributes=require(_0xb6f5('0x6'));module['exports']=function(_0x2a9d7e,_0x566de4){return _0x2a9d7e[_0xb6f5('0x7')]('MailApplication',attributes,{'tableName':_0xb6f5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6f5('0x9'),'collate':_0xb6f5('0xa')});}; \ No newline at end of file +var _0x73b2=['path','rimraf','exports','define','mail_applications','lodash','util','bluebird','request-promise'];(function(_0x1c3a14,_0x100f3f){var _0x33ea86=function(_0x4fc20a){while(--_0x4fc20a){_0x1c3a14['push'](_0x1c3a14['shift']());}};_0x33ea86(++_0x100f3f);}(_0x73b2,0x1c7));var _0x273b=function(_0x473a91,_0x1db371){_0x473a91=_0x473a91-0x0;var _0x775747=_0x73b2[_0x473a91];return _0x775747;};'use strict';var _=require(_0x273b('0x0'));var util=require(_0x273b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x273b('0x2'));var rp=require(_0x273b('0x3'));var fs=require('fs');var path=require(_0x273b('0x4'));var rimraf=require(_0x273b('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x273b('0x6')]=function(_0x2e75e8,_0x1a5d1a){return _0x2e75e8[_0x273b('0x7')]('MailApplication',attributes,{'tableName':_0x273b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4775c56..0f275a7 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 _0x653b=['attributes','limit','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailApplication','MailApplication','body','options','raw','where'];(function(_0x66ec03,_0xddc48b){var _0xb8574c=function(_0x167204){while(--_0x167204){_0x66ec03['push'](_0x66ec03['shift']());}};_0xb8574c(++_0xddc48b);}(_0x653b,0xf4));var _0xb653=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x653b[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0xb653('0x0'));var util=require(_0xb653('0x1'));var moment=require(_0xb653('0x2'));var BPromise=require(_0xb653('0x3'));var rs=require(_0xb653('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb653('0x5'))['db'];var utils=require(_0xb653('0x6'));var logger=require(_0xb653('0x7'))(_0xb653('0x8'));var config=require('../../config/environment');var jayson=require(_0xb653('0x9'));var client=jayson[_0xb653('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3147e6,_0x2e0fe4,_0xcc5bbd){return new BPromise(function(_0x53dcd9,_0x69a0b6){return client['request'](_0x3147e6,_0xcc5bbd)['then'](function(_0x2b84f2){logger[_0xb653('0xb')](_0xb653('0xc'),_0x2e0fe4,_0xb653('0xd'));logger[_0xb653('0xe')](_0xb653('0xf'),_0x2e0fe4,_0xb653('0xd'),JSON['stringify'](_0x2b84f2));if(_0x2b84f2[_0xb653('0x10')]){if(_0x2b84f2[_0xb653('0x10')][_0xb653('0x11')]===0x1f4){logger[_0xb653('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e0fe4,_0x2b84f2[_0xb653('0x10')][_0xb653('0x12')]);return _0x69a0b6(_0x2b84f2[_0xb653('0x10')]['message']);}logger[_0xb653('0x10')](_0xb653('0xc'),_0x2e0fe4,_0x2b84f2[_0xb653('0x10')][_0xb653('0x12')]);return _0x53dcd9(_0x2b84f2[_0xb653('0x10')][_0xb653('0x12')]);}else{logger[_0xb653('0xb')](_0xb653('0xc'),_0x2e0fe4,_0xb653('0xd'));_0x53dcd9(_0x2b84f2['result'][_0xb653('0x12')]);}})[_0xb653('0x13')](function(_0x3beeb8){logger['error'](_0xb653('0xc'),_0x2e0fe4,_0x3beeb8);_0x69a0b6(_0x3beeb8);});});}exports[_0xb653('0x14')]=function(_0x1be387){var _0x2636e4=this;return new Promise(function(_0x1b4f52,_0x183f32){return db[_0xb653('0x15')]['update'](_0x1be387[_0xb653('0x16')],{'raw':_0x1be387[_0xb653('0x17')]?_0x1be387['options'][_0xb653('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1be387[_0xb653('0x17')]?_0x1be387[_0xb653('0x17')][_0xb653('0x19')]||null:null,'attributes':_0x1be387[_0xb653('0x17')]?_0x1be387[_0xb653('0x17')][_0xb653('0x1a')]||null:null,'limit':_0x1be387[_0xb653('0x17')]?_0x1be387[_0xb653('0x17')][_0xb653('0x1b')]||null:null})[_0xb653('0x1c')](function(_0x5e8cb8){logger[_0xb653('0xb')]('UpdateMailApplication',_0x1be387);logger[_0xb653('0xe')](_0xb653('0x14'),_0x1be387,JSON[_0xb653('0x1d')](_0x5e8cb8));_0x1b4f52(_0x5e8cb8);})[_0xb653('0x13')](function(_0x13c419){logger['error']('UpdateMailApplication',_0x13c419[_0xb653('0x12')],_0x1be387);_0x183f32(_0x2636e4[_0xb653('0x10')](0x1f4,_0x13c419['message']));});});}; \ No newline at end of file +var _0xc060=['info','MailApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailApplication','update','body','options','where','attributes','UpdateMailApplication','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xc060,0x165));var _0x0c06=function(_0x24ab7b,_0x2c9f19){_0x24ab7b=_0x24ab7b-0x0;var _0x5e3e25=_0xc060[_0x24ab7b];return _0x5e3e25;};'use strict';var _=require(_0x0c06('0x0'));var util=require(_0x0c06('0x1'));var moment=require(_0x0c06('0x2'));var BPromise=require(_0x0c06('0x3'));var rs=require(_0x0c06('0x4'));var fs=require('fs');var Redis=require(_0x0c06('0x5'));var db=require(_0x0c06('0x6'))['db'];var utils=require(_0x0c06('0x7'));var logger=require('../../config/logger')(_0x0c06('0x8'));var config=require(_0x0c06('0x9'));var jayson=require(_0x0c06('0xa'));var client=jayson[_0x0c06('0xb')][_0x0c06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x209f21,_0xd8275d,_0x48ca39){return new BPromise(function(_0x468a93,_0x5bb6c1){return client[_0x0c06('0xd')](_0x209f21,_0x48ca39)[_0x0c06('0xe')](function(_0xf27fd9){logger[_0x0c06('0xf')](_0x0c06('0x10'),_0xd8275d,_0x0c06('0x11'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0xd8275d,_0x0c06('0x11'),JSON['stringify'](_0xf27fd9));if(_0xf27fd9[_0x0c06('0x12')]){if(_0xf27fd9['error'][_0x0c06('0x13')]===0x1f4){logger[_0x0c06('0x12')]('MailApplication,\x20%s,\x20%s',_0xd8275d,_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);return _0x5bb6c1(_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);}logger['error'](_0x0c06('0x10'),_0xd8275d,_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);return _0x468a93(_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);}else{logger['info'](_0x0c06('0x10'),_0xd8275d,_0x0c06('0x11'));_0x468a93(_0xf27fd9[_0x0c06('0x15')][_0x0c06('0x14')]);}})[_0x0c06('0x16')](function(_0x5a529d){logger[_0x0c06('0x12')](_0x0c06('0x10'),_0xd8275d,_0x5a529d);_0x5bb6c1(_0x5a529d);});});}exports['UpdateMailApplication']=function(_0xc6f041){var _0x2a1bdb=this;return new Promise(function(_0x14ce84,_0x28c5bc){return db[_0x0c06('0x17')][_0x0c06('0x18')](_0xc6f041[_0x0c06('0x19')],{'raw':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041['options'][_0x0c06('0x1b')]||null:null,'attributes':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')][_0x0c06('0x1c')]||null:null,'limit':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')]['limit']||null:null})['then'](function(_0x1f81db){logger[_0x0c06('0xf')](_0x0c06('0x1d'),_0xc6f041);logger['debug'](_0x0c06('0x1d'),_0xc6f041,JSON[_0x0c06('0x1e')](_0x1f81db));_0x14ce84(_0x1f81db);})[_0x0c06('0x16')](function(_0x3a31f4){logger['error'](_0x0c06('0x1d'),_0x3a31f4[_0x0c06('0x14')],_0xc6f041);_0x28c5bc(_0x2a1bdb[_0x0c06('0x12')](0x1f4,_0x3a31f4[_0x0c06('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5886f37..ef5b034 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 _0x6ce1=['getMessages','/:id/download','download','post','create','/:id/tags','mail','addTags','put','tracked','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','../../components/interaction/service','index','get','isAuthenticated','describe','/:id','show','/:id/messages'];(function(_0x8f62f7,_0xb6c101){var _0x5ebd1a=function(_0x243a4d){while(--_0x243a4d){_0x8f62f7['push'](_0x8f62f7['shift']());}};_0x5ebd1a(++_0xb6c101);}(_0x6ce1,0xde));var _0x16ce=function(_0x5b5e9b,_0xe289fa){_0x5b5e9b=_0x5b5e9b-0x0;var _0x4ab979=_0x6ce1[_0x5b5e9b];return _0x4ab979;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x16ce('0x0'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x16ce('0x1')]);router[_0x16ce('0x2')]('/describe',auth[_0x16ce('0x3')](),controller[_0x16ce('0x4')]);router[_0x16ce('0x2')](_0x16ce('0x5'),auth['isAuthenticated'](),controller[_0x16ce('0x6')]);router[_0x16ce('0x2')](_0x16ce('0x7'),auth[_0x16ce('0x3')](),controller[_0x16ce('0x8')]);router['get'](_0x16ce('0x9'),auth[_0x16ce('0x3')](),controller[_0x16ce('0xa')]);router[_0x16ce('0xb')]('/',auth[_0x16ce('0x3')](),controller[_0x16ce('0xc')]);router[_0x16ce('0xb')](_0x16ce('0x7'),auth[_0x16ce('0x3')](),controller['addMessage']);router[_0x16ce('0xb')](_0x16ce('0xd'),auth[_0x16ce('0x3')](),interaction['tracked'](_0x16ce('0xe'),'mailinteraction:addtags'),controller[_0x16ce('0xf')]);router[_0x16ce('0x10')](_0x16ce('0x5'),auth['isAuthenticated'](),interaction[_0x16ce('0x11')](_0x16ce('0xe'),_0x16ce('0x12')),controller['update']);router[_0x16ce('0x13')]('/:id',auth[_0x16ce('0x3')](),interaction[_0x16ce('0x11')](_0x16ce('0xe'),_0x16ce('0x14')),controller[_0x16ce('0x15')]);router['delete'](_0x16ce('0xd'),auth[_0x16ce('0x3')](),controller[_0x16ce('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdcfc=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2410db,_0x272e40){var _0xbc0013=function(_0x90e766){while(--_0x90e766){_0x2410db['push'](_0x2410db['shift']());}};_0xbc0013(++_0x272e40);}(_0xdcfc,0x74));var _0xcdcf=function(_0x2960f4,_0x421609){_0x2960f4=_0x2960f4-0x0;var _0x497125=_0xdcfc[_0x2960f4];return _0x497125;};'use strict';var express=require(_0xcdcf('0x0'));var router=express[_0xcdcf('0x1')]();var auth=require(_0xcdcf('0x2'));var interaction=require(_0xcdcf('0x3'));var controller=require(_0xcdcf('0x4'));router[_0xcdcf('0x5')]('/',auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x7')]);router['get'](_0xcdcf('0x8'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x9')]);router[_0xcdcf('0x5')](_0xcdcf('0xa'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0xb')]);router[_0xcdcf('0x5')](_0xcdcf('0xc'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0xd')]);router[_0xcdcf('0x5')](_0xcdcf('0xe'),auth['isAuthenticated'](),controller[_0xcdcf('0xf')]);router[_0xcdcf('0x10')]('/',auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x11')]);router[_0xcdcf('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xcdcf('0x12')]);router['post']('/:id/tags',auth[_0xcdcf('0x6')](),interaction[_0xcdcf('0x13')](_0xcdcf('0x14'),_0xcdcf('0x15')),controller['addTags']);router[_0xcdcf('0x16')](_0xcdcf('0xa'),auth['isAuthenticated'](),interaction[_0xcdcf('0x13')](_0xcdcf('0x14'),_0xcdcf('0x17')),controller[_0xcdcf('0x18')]);router[_0xcdcf('0x19')]('/:id',auth[_0xcdcf('0x6')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xcdcf('0x1a')]);router[_0xcdcf('0x19')](_0xcdcf('0x1b'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x1c')]);module[_0xcdcf('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 850a631..aaca6f7 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 _0xf962=['sequelize','iconv','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xf962,0x70));var _0x2f96=function(_0x155a50,_0x11d8b6){_0x155a50=_0x155a50-0x0;var _0x42ddb9=_0xf962[_0x155a50];return _0x42ddb9;};'use strict';var Sequelize=require(_0x2f96('0x0'));var iconv=require(_0x2f96('0x1'));module[_0x2f96('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2f96('0x3')]},'disposition':{'type':Sequelize[_0x2f96('0x4')]},'secondDisposition':{'type':Sequelize[_0x2f96('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2f96('0x4')]},'note':{'type':Sequelize[_0x2f96('0x4')]},'inReplyTo':{'type':Sequelize[_0x2f96('0x4')](0x1fe)},'to':{'type':Sequelize[_0x2f96('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x2f96('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2f96('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2f96('0x5')]('in',_0x2f96('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2f96('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2f96('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2f96('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x8864=['TEXT','DATE','out','ENUM','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8864,0x145));var _0x4886=function(_0xf7c93e,_0x586f4b){_0xf7c93e=_0xf7c93e-0x0;var _0x2e3b2a=_0x8864[_0xf7c93e];return _0x2e3b2a;};'use strict';var Sequelize=require(_0x4886('0x0'));var iconv=require('iconv');module[_0x4886('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4886('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4886('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4886('0x2')](0x1fe)},'to':{'type':Sequelize[_0x4886('0x2')]},'cc':{'type':Sequelize[_0x4886('0x3')]('long')},'subject':{'type':Sequelize[_0x4886('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4886('0x4')]},'substatus':{'type':Sequelize[_0x4886('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x4886('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4886('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4886('0x6')]('in',_0x4886('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4886('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d9c3a7e..104254d 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 _0x5565=['removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','message%d.eml','rimraf','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','closed','UserId','total','index','map','MailInteraction','rawAttributes','fieldName','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.email','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','rows','params','includeAll','include','options','create','body','describe','addMessage','omit','ids','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','spread','emit','mailInteractionTags:save'];(function(_0x154474,_0x874e69){var _0x3337bf=function(_0x2cea25){while(--_0x2cea25){_0x154474['push'](_0x154474['shift']());}};_0x3337bf(++_0x874e69);}(_0x5565,0x104));var _0x5556=function(_0x1bbe79,_0x1707f5){_0x1bbe79=_0x1bbe79-0x0;var _0x4da933=_0x5565[_0x1bbe79];return _0x4da933;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5556('0x0'));var zipdir=require('zip-dir');var moment=require(_0x5556('0x1'));var BPromise=require('bluebird');var util=require(_0x5556('0x2'));var path=require(_0x5556('0x3'));var fs=require('fs');var _=require(_0x5556('0x4'));var squel=require(_0x5556('0x5'));var juice=require('juice');var Redis=require(_0x5556('0x6'));var qs=require(_0x5556('0x7'));var as=require(_0x5556('0x8'));var logger=require('../../config/logger')(_0x5556('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x5556('0xa'));config[_0x5556('0xb')]=_[_0x5556('0xc')](config[_0x5556('0xb')],{'host':_0x5556('0xd'),'port':0x18eb});var socket=require(_0x5556('0xe'))(new Redis(config[_0x5556('0xb')]));require(_0x5556('0xf'))[_0x5556('0x10')](socket);function respondWithStatusCode(_0x705dcb,_0x39c27e){_0x39c27e=_0x39c27e||0xcc;return function(_0x97a21a){if(_0x97a21a){return _0x705dcb[_0x5556('0x11')](_0x39c27e);}return _0x705dcb[_0x5556('0x12')](_0x39c27e)[_0x5556('0x13')]();};}function respondWithResult(_0x340e67,_0x53d3cd){_0x53d3cd=_0x53d3cd||0xc8;return function(_0x30bde4){if(_0x30bde4){return _0x340e67[_0x5556('0x12')](_0x53d3cd)[_0x5556('0x14')](_0x30bde4);}};}function respondWithFilteredResult(_0x45faa3,_0x300be1){return function(_0x106aac){if(_0x106aac){var _0x53050d=typeof _0x300be1['offset']==='undefined'&&typeof _0x300be1[_0x5556('0x15')]==='undefined';var _0x37207e=_0x106aac[_0x5556('0x16')];var _0x3592fe=_0x53050d?0x0:_0x300be1[_0x5556('0x17')];var _0x471b21=_0x53050d?_0x106aac[_0x5556('0x16')]:_0x300be1[_0x5556('0x17')]+_0x300be1[_0x5556('0x15')];var _0x5e02bd;if(_0x471b21>=_0x37207e){_0x471b21=_0x37207e;_0x5e02bd=0xc8;}else{_0x5e02bd=0xce;}_0x45faa3[_0x5556('0x12')](_0x5e02bd);return _0x45faa3[_0x5556('0x18')](_0x5556('0x19'),_0x3592fe+'-'+_0x471b21+'/'+_0x37207e)[_0x5556('0x14')](_0x106aac);}return null;};}function saveUpdates(_0x1eb016){return function(_0x439576){if(_0x439576){return _0x439576[_0x5556('0x1a')](_0x1eb016)[_0x5556('0x1b')](function(_0x2ae013){return _0x2ae013;});}return null;};}function removeEntity(_0x41e018){return function(_0x9559df){if(_0x9559df){return _0x9559df[_0x5556('0x1c')]()[_0x5556('0x1b')](function(){_0x41e018[_0x5556('0x12')](0xcc)[_0x5556('0x13')]();});}};}function handleEntityNotFound(_0x36f13e){return function(_0x150cb1){if(!_0x150cb1){_0x36f13e[_0x5556('0x11')](0x194);}return _0x150cb1;};}function handleError(_0x47e131,_0x149d10){_0x149d10=_0x149d10||0x1f4;return function(_0x41c26b){logger[_0x5556('0x1d')](_0x41c26b[_0x5556('0x1e')]);if(_0x41c26b[_0x5556('0x1f')]){delete _0x41c26b[_0x5556('0x1f')];}_0x47e131[_0x5556('0x12')](_0x149d10)[_0x5556('0x20')](_0x41c26b);};}function getInteractionUsers(_0x597626,_0x163de9){return new BPromise(function(_0xb86fa1,_0x41d152){try{if(_0x163de9[_0x597626['id']]){_0x597626[_0x5556('0x21')]=_['map'](_0x163de9[_0x597626['id']],function(_0x2132b7){return{'id':_0x2132b7['id'],'fullname':_0x2132b7[_0x5556('0x22')]};});}}catch(_0x2b950a){_0x41d152(_0x2b950a);}_0xb86fa1(_0x597626);});}function getInteractionTags(_0xbebaf8,_0x4a361f){return new BPromise(function(_0x2054ac,_0x36dc00){try{if(_0xbebaf8[_0x5556('0x23')]){_0xbebaf8[_0x5556('0x24')]=[];_0xbebaf8[_0x5556('0x23')][_0x5556('0x25')](',')[_0x5556('0x26')](function(_0x1caef3){_0xbebaf8[_0x5556('0x24')][_0x5556('0x27')](_0x4a361f[_0x1caef3]);});}delete _0xbebaf8['TagIds'];}catch(_0x44a950){_0x36dc00(_0x44a950);}_0x2054ac(_0xbebaf8);});}function getLastMessageText(_0x3defb7){return new BPromise(function(_0x27087a,_0x1d299e){return db[_0x5556('0x28')][_0x5556('0x29')]({'where':{'$and':[{'MailInteractionId':_0x3defb7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5556('0x2a')],'order':_0x5556('0x2b'),'raw':!![]})[_0x5556('0x1b')](function(_0xb1ffb1){if(_0xb1ffb1&&_0xb1ffb1[_0x5556('0x2a')]){_0x3defb7[_0x5556('0x2c')]=_[_0x5556('0x2d')](_0xb1ffb1[_0x5556('0x2a')]);}_0x27087a(_0x3defb7);})['catch'](function(_0x3d5dad){_0x1d299e(_0x3d5dad);});});}function updateMailInteraction(_0x5d8ebc,_0x1125ca,_0x20491b,_0x67996f){return new BPromise(function(_0x252fec,_0xda7e1a){return getInteractionUsers(_0x5d8ebc,_0x20491b)['then'](function(_0x197139){return getInteractionTags(_0x197139,_0x1125ca);})[_0x5556('0x1b')](function(_0x560dff){return getStateInteraction(_0x560dff);})[_0x5556('0x1b')](function(_0x442166){if(_0x67996f){_0x252fec(getLastMessageText(_0x442166));}else{_0x252fec(_0x442166);}})[_0x5556('0x2e')](function(_0x4c0752){_0xda7e1a(_0x4c0752);});});}function getStateInteraction(_0x357fe3){return new BPromise(function(_0x2914a1){_0x357fe3[_0x5556('0x2f')]=0x0;_0x357fe3[_0x5556('0x30')]=0x0;_0x357fe3[_0x5556('0x31')]=0x0;_0x357fe3['unmanaged']=0x0;_0x357fe3['total']=0x0;if(!_0x357fe3[_0x5556('0x32')]&&!_0x357fe3[_0x5556('0x33')]){_0x357fe3[_0x5556('0x2f')]+=0x1;}if(!_0x357fe3[_0x5556('0x32')]&&_0x357fe3[_0x5556('0x33')]){_0x357fe3[_0x5556('0x30')]+=0x1;if(_0x357fe3[_0x5556('0x2f')]){_0x357fe3[_0x5556('0x2f')]-=0x1;}}if(_0x357fe3[_0x5556('0x32')]&&_0x357fe3[_0x5556('0x33')]){_0x357fe3['answered']+=0x1;if(_0x357fe3[_0x5556('0x30')]){_0x357fe3[_0x5556('0x30')]-=0x1;}}if(_0x357fe3[_0x5556('0x32')]&&!_0x357fe3[_0x5556('0x33')]){_0x357fe3['unmanaged']+=0x1;if(_0x357fe3[_0x5556('0x2f')]){_0x357fe3[_0x5556('0x2f')]-=0x1;}}_0x357fe3[_0x5556('0x34')]+=0x1;_0x2914a1(_0x357fe3);});}exports[_0x5556('0x35')]=function(_0x44b57f,_0x76f5f5){var _0x410666={},_0x1647c5={},_0x31e278={'count':0x0,'rows':[]};var _0x3a909e=_[_0x5556('0x36')](db[_0x5556('0x37')][_0x5556('0x38')],function(_0x453ad9){return{'name':_0x453ad9[_0x5556('0x39')],'type':_0x453ad9[_0x5556('0x3a')]['key']};});_0x1647c5['model']=_['map'](_0x3a909e,_0x5556('0x1f'));_0x1647c5['query']=_[_0x5556('0x3b')](_0x44b57f['query']);_0x1647c5['filters']=_[_0x5556('0x3c')](_0x1647c5[_0x5556('0x3d')],_0x1647c5[_0x5556('0x3e')]);_0x410666[_0x5556('0x3f')]=_[_0x5556('0x3c')](_0x1647c5['model'],qs[_0x5556('0x40')](_0x44b57f['query'][_0x5556('0x40')]));_0x410666[_0x5556('0x3f')]=_0x410666['attributes'][_0x5556('0x41')]?_0x410666['attributes']:_0x1647c5[_0x5556('0x3d')];if(!_0x44b57f[_0x5556('0x3e')][_0x5556('0x42')](_0x5556('0x43'))){_0x410666[_0x5556('0x15')]=qs['limit'](_0x44b57f['query'][_0x5556('0x15')]);_0x410666['offset']=qs[_0x5556('0x17')](_0x44b57f['query'][_0x5556('0x17')]);}_0x410666[_0x5556('0x44')]=qs['sort'](_0x44b57f[_0x5556('0x3e')][_0x5556('0x45')]);_0x410666[_0x5556('0x46')]=qs['filters'](_[_0x5556('0x47')](_0x44b57f[_0x5556('0x3e')],_0x1647c5[_0x5556('0x48')]),_0x3a909e);var _0x139fe5=[];var _0x157646=squel[_0x5556('0x49')]()[_0x5556('0x4a')]('id')['field']('name')['field'](_0x5556('0x4b'))[_0x5556('0x4c')](_0x5556('0x4d'));var _0x40dbd9=squel[_0x5556('0x49')]()['field']('u.id')[_0x5556('0x4a')](_0x5556('0x4e'))[_0x5556('0x4a')](_0x5556('0x4f'))[_0x5556('0x4c')](_0x5556('0x50'),'ui')['left_join'](_0x5556('0x51'),'u',_0x5556('0x52'));var _0x538263=squel[_0x5556('0x49')]()[_0x5556('0x4c')](_0x5556('0x53'),'i')[_0x5556('0x54')]('cm_contacts','c',_0x5556('0x55'))[_0x5556('0x54')]('users','o',_0x5556('0x56'))[_0x5556('0x54')]('mail_accounts','a',_0x5556('0x57'))[_0x5556('0x54')]('mail_messages','me',_0x5556('0x58'))[_0x5556('0x54')](_0x5556('0x59'),'it',_0x5556('0x5a'))[_0x5556('0x54')](_0x5556('0x4d'),'t',_0x5556('0x5b'));var _0x7d6418=squel[_0x5556('0x5c')]();var _0xfec1e=[];var _0x3b551d=squel[_0x5556('0x5c')]();var _0x3dd390;if(_0x44b57f['query'][_0x5556('0x5d')]){_0x3dd390=as[_0x5556('0x5e')](_0x44b57f['query'][_0x5556('0x5d')]);var _0x537507=_0x3dd390[_0x5556('0x5f')];for(var _0x16ca90=0x0;_0x16ca90<_0x3dd390[_0x5556('0x60')]['length'];_0x16ca90++){var _0x17880f=_0x3dd390[_0x5556('0x60')][_0x16ca90];var _0x2c3f19='i';var _0x57031c=_['find'](_0x3a909e,[_0x5556('0x1f'),_0x17880f[_0x5556('0x4a')]]);if(!_0x57031c){switch(_0x17880f[_0x5556('0x4a')]){case _0x5556('0x61'):if(_0x17880f['value']==0x1){_0x538263['having']('`'+_0x17880f['field']+_0x5556('0x62'));}else{_0x538263[_0x5556('0x63')]('`'+_0x17880f[_0x5556('0x4a')]+'`\x20>\x200');}break;case'Contact':if(_0x17880f[_0x5556('0x64')]===_0x5556('0x65')){if(_0x17880f[_0x5556('0x66')][_0x5556('0x25')]('\x20')[_0x5556('0x41')]>0x1){_0x7d6418[_0x537507](_0x5556('0x67'),qs[_0x5556('0x68')](_0x17880f['value']),null);}else{var _0x5469cb='%'+_0x17880f[_0x5556('0x66')]+'%';_0x7d6418[_0x537507](_0x5556('0x69'),_0x5469cb,_0x5469cb,_0x5469cb);}}else{_0x57031c=_[_0x5556('0x6a')](_0x3a909e,['name','ContactId']);_0x17880f['field']=_0x5556('0x6b');_0x126655=as[_0x5556('0x6c')](_0x2c3f19,_0x57031c[_0x5556('0x3a')],_0x17880f);_0x7d6418[_0x537507](_0x126655[_0x5556('0x6d')],_0x126655['value']['start'],_0x126655[_0x5556('0x66')]['end']);}break;case _0x5556('0x6e'):var _0x299530=_0x17880f[_0x5556('0x66')][_0x5556('0x25')](',')[_0x5556('0x36')](function(_0x2e54f2){return Number(_0x2e54f2);});_0x299530[_0x5556('0x26')](function(_0x102314){_0x3b551d['or'](_0x5556('0x6f'),'%,'+_0x102314+',%');});_0xfec1e=_[_0x5556('0x70')](_0xfec1e,_0x299530);break;case'User':if(_0x17880f[_0x5556('0x64')]==='$substring'){_0x7d6418[_0x537507](_0x5556('0x71'),'%'+_0x17880f[_0x5556('0x66')]+'%',null);}else{_0x57031c=_['find'](_0x3a909e,[_0x5556('0x1f'),'UserId']);_0x17880f[_0x5556('0x4a')]=_0x5556('0x33');_0x126655=as['buildExpression'](_0x2c3f19,_0x57031c[_0x5556('0x3a')],_0x17880f);_0x7d6418[_0x537507](_0x126655[_0x5556('0x6d')],_0x126655[_0x5556('0x66')][_0x5556('0x72')],_0x126655[_0x5556('0x66')][_0x5556('0x13')]);}break;case _0x5556('0x2a'):_0x126655=as[_0x5556('0x6c')]('me',null,_0x17880f);_0x7d6418[_0x537507](_0x126655[_0x5556('0x6d')],_0x126655[_0x5556('0x66')]['start'],_0x126655[_0x5556('0x66')][_0x5556('0x13')]);break;}}else{var _0x126655=as[_0x5556('0x6c')](_0x2c3f19,_0x57031c[_0x5556('0x3a')],_0x17880f);_0x7d6418[_0x537507](_0x126655[_0x5556('0x6d')],_0x126655['value'][_0x5556('0x72')],_0x126655[_0x5556('0x66')][_0x5556('0x13')]);}}}else{var _0x10870a=_(_0x44b57f[_0x5556('0x3e')])[_0x5556('0x3b')]()[_0x5556('0x36')](function(_0x538e7c){return _[_0x5556('0x73')](_0x3a909e,[_0x5556('0x1f'),_0x538e7c])?_0x538e7c:undefined;})['compact']()[_0x5556('0x66')]();if(!_['isEmpty'](_0x10870a)){_0x10870a[_0x5556('0x26')](function(_0x28980d){if(_0x28980d===_0x5556('0x74')){_0x538263[_0x5556('0x46')](_0x5556('0x75'),[][_0x5556('0x76')](_0x44b57f[_0x5556('0x3e')][_0x28980d]));}else if(_0x28980d===_0x5556('0x77')){var _0x39e0d4=JSON[_0x5556('0x78')](_0x44b57f[_0x5556('0x3e')][_0x28980d])['$gte'];var _0xb017d7=JSON[_0x5556('0x78')](_0x44b57f['query'][_0x28980d])['$lte'];_0x538263[_0x5556('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39e0d4,_0xb017d7);}else{if(_0x44b57f[_0x5556('0x3e')][_0x28980d]===_0x5556('0x79')){_0x538263[_0x5556('0x46')]('i.'+_0x28980d+'\x20IS\x20NULL');}else{_0x538263['where']('i.'+_0x28980d+_0x5556('0x7a'),_0x44b57f[_0x5556('0x3e')][_0x28980d]);}}});}if(_0x44b57f[_0x5556('0x3e')][_0x5556('0x7b')]){if(_0x44b57f['query'][_0x5556('0x7b')]==0x1){_0x538263[_0x5556('0x63')](_0x5556('0x7c'));}else{_0x538263[_0x5556('0x63')](_0x5556('0x7d'));}}if(_0x44b57f[_0x5556('0x3e')][_0x5556('0x7e')]){_0xfec1e=_[_0x5556('0x7f')](_0x44b57f['query'][_0x5556('0x7e')])?_0x44b57f['query'][_0x5556('0x7e')]:new Array(_0x44b57f[_0x5556('0x3e')]['tag']);_0xfec1e[_0x5556('0x26')](function(_0xccf98a){_0x3b551d['or'](_0x5556('0x6f'),'%,'+_0xccf98a+',%');});}if(_0x44b57f['query'][_0x5556('0x80')]){var _0x35c4e9=_0x44b57f[_0x5556('0x3e')][_0x5556('0x80')]['replace']('\x5c','\x5c\x5c')[_0x5556('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x35c4e9)){_0x7d6418['or'](_0x5556('0x82'),_0x35c4e9+'%');}else if(qs['isEmail'](_0x35c4e9)){_0x7d6418['or'](_0x5556('0x83'),_0x35c4e9+'%');}else{_0x7d6418['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5556('0x68')](_0x35c4e9))['or'](_0x5556('0x84'),qs['getFullTextValue'](_0x35c4e9));}}}_0x538263['where'](_0x7d6418);_0x538263[_0x5556('0x85')](_0x5556('0x86'));var _0xf18ca={'type':db[_0x5556('0x87')][_0x5556('0x88')][_0x5556('0x89')],'raw':!![]};var _0x125dde=_0x538263[_0x5556('0x8a')]();_0x125dde[_0x5556('0x4a')]('i.id');_0x125dde[_0x5556('0x4a')](_0x5556('0x8b'),_0x5556('0x61'));if(_0x410666[_0x5556('0x44')]){_0x410666[_0x5556('0x44')][_0x5556('0x26')](function(_0x34d1b4){var _0x52c07f=_0x34d1b4[0x0]===_0x5556('0x8c')?_0x34d1b4[0x0]:'i.'+_0x34d1b4[0x0];_0x538263['order'](_0x52c07f,_0x34d1b4[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xfec1e)){_0x538263[_0x5556('0x63')](_0x3b551d);_0x125dde[_0x5556('0x46')](_0x5556('0x8d'),_0xfec1e);}BPromise[_0x5556('0x8e')]()[_0x5556('0x1b')](function(){if(!_0x3dd390){if(_0x44b57f['query']['MailAccountId'])return;_0x125dde[_0x5556('0x46')](_0x5556('0x8f'));_0x538263[_0x5556('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x44b57f[_0x5556('0x90')][_0x5556('0x91')]!==_0x5556('0x92'))return;return _0x44b57f[_0x5556('0x90')][_0x5556('0x93')]({'attributes':['id'],'raw':!![]})[_0x5556('0x1b')](function(_0x1637f9){if(_[_0x5556('0x94')](_0x1637f9)){_0x125dde['where'](_0x5556('0x95'));_0x538263[_0x5556('0x46')](_0x5556('0x95'));}else{_0x125dde[_0x5556('0x46')](_0x5556('0x75'),_[_0x5556('0x36')](_0x1637f9,'id'));_0x538263[_0x5556('0x46')](_0x5556('0x75'),_['map'](_0x1637f9,'id'));}});})[_0x5556('0x1b')](function(){if(_0x44b57f[_0x5556('0x90')][_0x5556('0x91')]===_0x5556('0x92')&&!_0x3dd390&&!_0x44b57f['query']['MailAccountId'])return[];return db[_0x5556('0x96')][_0x5556('0x3e')](_0x125dde[_0x5556('0x97')](),_0xf18ca);})[_0x5556('0x1b')](function(_0x4481b4){_0x31e278[_0x5556('0x16')]=_0x4481b4[_0x5556('0x41')];if(_0x31e278['count']===0x0)return[];return db[_0x5556('0x96')][_0x5556('0x3e')](_0x157646[_0x5556('0x97')](),_0xf18ca)['then'](function(_0x4e093c){_0x139fe5=_['keyBy'](_0x4e093c,'id');_0xf18ca=_[_0x5556('0x98')](_0xf18ca,{'model':db[_0x5556('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44b57f[_0x5556('0x3e')][_0x5556('0x40')]){_0x410666['attributes'][_0x5556('0x26')](function(_0xf05769){_0x538263['field']('i.'+_0xf05769);});}else{_0x538263[_0x5556('0x4a')](_0x5556('0x8b'),_0x5556('0x61'));_0x538263['field'](_0x5556('0x99'),_0x5556('0x9a'));_0x538263[_0x5556('0x4a')](_0x5556('0x9b'),'Account.mandatoryDisposition');_0x538263[_0x5556('0x4a')]('a.email',_0x5556('0x9c'));_0x538263['field']('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',_0x5556('0x8c'));_0x538263[_0x5556('0x4a')](_0x5556('0x86'));_0x538263[_0x5556('0x4a')](_0x5556('0x9d'));_0x538263['field'](_0x5556('0x9e'));_0x538263[_0x5556('0x4a')](_0x5556('0x9f'));_0x538263[_0x5556('0x4a')](_0x5556('0xa0'));_0x538263[_0x5556('0x4a')]('i.attach');_0x538263['field'](_0x5556('0xa1'));_0x538263[_0x5556('0x4a')](_0x5556('0xa2'));_0x538263['field'](_0x5556('0xa3'));_0x538263[_0x5556('0x4a')](_0x5556('0xa4'));_0x538263['field'](_0x5556('0xa5'));_0x538263[_0x5556('0x4a')](_0x5556('0xa6'));_0x538263[_0x5556('0x4a')](_0x5556('0xa7'));_0x538263[_0x5556('0x4a')](_0x5556('0xa8'));_0x538263[_0x5556('0x4a')](_0x5556('0xa9'));_0x538263[_0x5556('0x4a')]('i.MailAccountId');_0x538263['field']('i.UserId');_0x538263['field'](_0x5556('0xaa'),'Contact.firstName');_0x538263[_0x5556('0x4a')](_0x5556('0xab'),_0x5556('0xac'));_0x538263[_0x5556('0x4a')](_0x5556('0xad'),_0x5556('0xae'));_0x538263[_0x5556('0x4a')]('c.phone',_0x5556('0xaf'));_0x538263[_0x5556('0x4a')](_0x5556('0xb0'),_0x5556('0xb1'));_0x538263[_0x5556('0x4a')](_0x5556('0xb2'),_0x5556('0xb3'));_0x538263[_0x5556('0x4a')](_0x5556('0xb4'),'Owner.fullname');_0x538263['field']('o.internal','Owner.internal');_0x538263['field'](_0x5556('0xb5'),_0x5556('0x23'));}if(_0x410666[_0x5556('0x15')])_0x538263['limit'](_0x410666[_0x5556('0x15')]);if(_0x410666[_0x5556('0x17')])_0x538263[_0x5556('0x17')](_0x410666['offset']);return db[_0x5556('0x96')][_0x5556('0x3e')](_0x538263[_0x5556('0x97')](),_0xf18ca);})[_0x5556('0x1b')](function(_0x577b7e){if(_0x577b7e['length']>0x0)_0x40dbd9[_0x5556('0x46')](_0x5556('0xb6'),_[_0x5556('0x36')](_0x577b7e,'id'));return db[_0x5556('0x96')][_0x5556('0x3e')](_0x40dbd9[_0x5556('0x97')](),_0xf18ca)[_0x5556('0x1b')](function(_0x1f6727){var _0x39b4bf=_[_0x5556('0xb7')](_0x1f6727,'MailInteractionId');var _0x4e2d47=[];return db[_0x5556('0xb8')]['findOne']({'attributes':[_0x5556('0xb9')],'raw':!![]})[_0x5556('0x1b')](function(_0x889eef){var _0x1e74ff=_0x889eef[_0x5556('0xb9')];_0x577b7e[_0x5556('0x26')](function(_0x336b09){_0x4e2d47[_0x5556('0x27')](updateMailInteraction(_0x336b09,_0x139fe5,_0x39b4bf,_0x1e74ff));});return BPromise['all'](_0x4e2d47);});});});})[_0x5556('0x1b')](function(_0x5297b6){_0x31e278[_0x5556('0xba')]=_0x5297b6;return _0x31e278;})[_0x5556('0x1b')](respondWithFilteredResult(_0x76f5f5,_0x410666))[_0x5556('0x2e')](handleError(_0x76f5f5,null));};exports['show']=function(_0x3afab5,_0x4581d6){var _0x2b2793={'raw':![],'where':{'id':_0x3afab5[_0x5556('0xbb')]['id']}},_0x572072={};_0x572072[_0x5556('0x3d')]=_['keys'](db[_0x5556('0x37')][_0x5556('0x38')]);_0x572072[_0x5556('0x3e')]=_[_0x5556('0x3b')](_0x3afab5[_0x5556('0x3e')]);_0x572072['filters']=_[_0x5556('0x3c')](_0x572072[_0x5556('0x3d')],_0x572072[_0x5556('0x3e')]);_0x2b2793[_0x5556('0x3f')]=_[_0x5556('0x3c')](_0x572072[_0x5556('0x3d')],qs[_0x5556('0x40')](_0x3afab5[_0x5556('0x3e')]['fields']));_0x2b2793[_0x5556('0x3f')]=_0x2b2793['attributes'][_0x5556('0x41')]?_0x2b2793[_0x5556('0x3f')]:_0x572072[_0x5556('0x3d')];if(_0x3afab5[_0x5556('0x3e')][_0x5556('0xbc')]){_0x2b2793[_0x5556('0xbd')]=[{'all':!![]}];}_0x2b2793=_[_0x5556('0x98')]({},_0x2b2793,_0x3afab5[_0x5556('0xbe')]);return db[_0x5556('0x37')][_0x5556('0x6a')](_0x2b2793)[_0x5556('0x1b')](handleEntityNotFound(_0x4581d6,null))[_0x5556('0x1b')](respondWithResult(_0x4581d6,null))[_0x5556('0x2e')](handleError(_0x4581d6,null));};exports[_0x5556('0xbf')]=function(_0x124f05,_0x4b06de){return db[_0x5556('0x37')][_0x5556('0xbf')](_0x124f05[_0x5556('0xc0')],{})[_0x5556('0x1b')](respondWithResult(_0x4b06de,0xc9))[_0x5556('0x2e')](handleError(_0x4b06de,null));};exports[_0x5556('0x1a')]=function(_0x298836,_0x21dba8){if(_0x298836[_0x5556('0xc0')]['id']){delete _0x298836[_0x5556('0xc0')]['id'];}return db[_0x5556('0x37')][_0x5556('0x6a')]({'where':{'id':_0x298836[_0x5556('0xbb')]['id']}})[_0x5556('0x1b')](handleEntityNotFound(_0x21dba8,null))[_0x5556('0x1b')](saveUpdates(_0x298836[_0x5556('0xc0')],null))['then'](respondWithResult(_0x21dba8,null))[_0x5556('0x2e')](handleError(_0x21dba8,null));};exports['destroy']=function(_0xeadd1e,_0x1547df){return db['MailInteraction'][_0x5556('0x6a')]({'where':{'id':_0xeadd1e[_0x5556('0xbb')]['id']}})['then'](handleEntityNotFound(_0x1547df,null))[_0x5556('0x1b')](removeEntity(_0x1547df,null))['catch'](handleError(_0x1547df,null));};exports[_0x5556('0xc1')]=function(_0x2b6652,_0x177314){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x177314,null))[_0x5556('0x2e')](handleError(_0x177314,null));};exports['addMessage']=function(_0x471de5,_0x4e810e){return db['MailMessage'][_0x5556('0x6a')]({'where':{'id':_0x471de5['params']['id']}})['then'](handleEntityNotFound(_0x4e810e,null))[_0x5556('0x1b')](function(_0x4a2486){if(_0x4a2486){return _0x4a2486[_0x5556('0xc2')](_0x471de5['body']['ids'],_[_0x5556('0xc3')](_0x471de5[_0x5556('0xc0')],[_0x5556('0xc4'),'id'])||{});}})[_0x5556('0x1b')](respondWithResult(_0x4e810e,null))[_0x5556('0x2e')](handleError(_0x4e810e,null));};exports['getMessages']=function(_0x18bce4,_0x328a21){var _0x3252a4={'raw':![],'where':{}};var _0x1c89e={};var _0x4b17c4={'count':0x0,'rows':[]};return db[_0x5556('0x37')][_0x5556('0x29')]({'where':{'id':_0x18bce4[_0x5556('0xbb')]['id']}})[_0x5556('0x1b')](handleEntityNotFound(_0x328a21,null))[_0x5556('0x1b')](function(_0x5371c7){if(_0x5371c7){_0x1c89e[_0x5556('0x3d')]=_[_0x5556('0x3b')](db[_0x5556('0x28')][_0x5556('0x38')]);_0x1c89e[_0x5556('0x3e')]=_[_0x5556('0x3b')](_0x18bce4['query']);_0x1c89e[_0x5556('0x48')]=_[_0x5556('0x3c')](_0x1c89e[_0x5556('0x3d')],_0x1c89e[_0x5556('0x3e')]);_0x3252a4[_0x5556('0x3f')]=_[_0x5556('0x3c')](_0x1c89e['model'],qs['fields'](_0x18bce4[_0x5556('0x3e')]['fields']));_0x3252a4[_0x5556('0x3f')]=_0x3252a4[_0x5556('0x3f')][_0x5556('0x41')]?_0x3252a4['attributes']:_0x1c89e[_0x5556('0x3d')];if(!_0x18bce4[_0x5556('0x3e')]['hasOwnProperty'](_0x5556('0x43'))){_0x3252a4[_0x5556('0x15')]=qs[_0x5556('0x15')](_0x18bce4[_0x5556('0x3e')][_0x5556('0x15')]);_0x3252a4[_0x5556('0x17')]=qs[_0x5556('0x17')](_0x18bce4[_0x5556('0x3e')][_0x5556('0x17')]);}_0x3252a4[_0x5556('0x44')]=qs['sort'](_0x18bce4[_0x5556('0x3e')][_0x5556('0x45')]);_0x3252a4[_0x5556('0x46')]=qs[_0x5556('0x48')](_[_0x5556('0x47')](_0x18bce4[_0x5556('0x3e')],_0x1c89e['filters']));_0x3252a4[_0x5556('0x46')][_0x5556('0xc5')]=_0x5371c7['id'];if(_0x18bce4[_0x5556('0x3e')][_0x5556('0x80')]){_0x3252a4[_0x5556('0x46')]=_['merge'](_0x3252a4[_0x5556('0x46')],{'$or':_[_0x5556('0x36')](_0x3252a4['attributes'],function(_0x560a22){var _0x574821={};_0x574821[_0x560a22]={'$like':'%'+_0x18bce4[_0x5556('0x3e')][_0x5556('0x80')]+'%'};return _0x574821;})});}if(_0x18bce4[_0x5556('0x3e')][_0x5556('0xc6')]){var _0x580eb7=_0x18bce4['query'][_0x5556('0xc6')][_0x5556('0x25')](',');var _0x1fa94f={};_0x1fa94f[_0x580eb7[0x0]]={'$gte':moment(_0x580eb7[0x1])[_0x5556('0xc7')](_0x5556('0xc8'))};_0x3252a4[_0x5556('0x46')]=_[_0x5556('0x98')](_0x3252a4[_0x5556('0x46')],_0x1fa94f);}_0x3252a4=_[_0x5556('0x98')]({},_0x3252a4,_0x18bce4[_0x5556('0xbe')]);return db[_0x5556('0x28')][_0x5556('0x16')]({'where':_0x3252a4[_0x5556('0x46')]})['then'](function(_0x372513){_0x4b17c4[_0x5556('0x16')]=_0x372513;if(_0x18bce4[_0x5556('0x3e')]['includeAll']){_0x3252a4['include']=[{'all':!![]}];}return db[_0x5556('0x28')][_0x5556('0xc9')](_0x3252a4);})[_0x5556('0x1b')](function(_0xa46b23){if(_0x18bce4[_0x5556('0x3e')][_0x5556('0xca')]===_0x5556('0xcb')){for(var _0x6bdd4e=0x0;_0x6bdd4e<_0xa46b23[_0x5556('0x41')];_0x6bdd4e++){_0xa46b23[_0x6bdd4e][_0x5556('0xc0')]=juice(_0xa46b23[_0x6bdd4e][_0x5556('0xc0')]);}}_0x4b17c4[_0x5556('0xba')]=_0xa46b23;return _0x4b17c4;});}})[_0x5556('0x1b')](respondWithFilteredResult(_0x328a21,_0x3252a4))['catch'](handleError(_0x328a21,null));};exports[_0x5556('0xcc')]=function(_0xfe049,_0x1a1b11){return db[_0x5556('0x37')][_0x5556('0x6a')]({'where':{'id':_0xfe049[_0x5556('0xbb')]['id']}})[_0x5556('0x1b')](handleEntityNotFound(_0x1a1b11,null))[_0x5556('0x1b')](function(_0x58be20){if(_0x58be20){return _0x58be20['setTags'](_0xfe049[_0x5556('0xc0')]['ids'],_[_0x5556('0xc3')](_0xfe049[_0x5556('0xc0')],[_0x5556('0xc4'),'id'])||{})[_0x5556('0xcd')](function(){return db[_0x5556('0x6e')]['findAll']({'attributes':['id',_0x5556('0x1f'),_0x5556('0x4b')],'where':{'id':_0xfe049['body']['ids']}});})[_0x5556('0x1b')](function(_0x5a9fb3){socket[_0x5556('0xce')](_0x5556('0xcf'),{'id':Number(_0xfe049[_0x5556('0xbb')]['id']),'tags':_0x5a9fb3||[]});return{'id':Number(_0xfe049[_0x5556('0xbb')]['id']),'tags':_0x5a9fb3||[]};});}})[_0x5556('0x1b')](respondWithResult(_0x1a1b11,null))[_0x5556('0x2e')](handleError(_0x1a1b11,null));};exports[_0x5556('0xd0')]=function(_0x25bc14,_0x36cf1){return db[_0x5556('0x37')][_0x5556('0x6a')]({'where':{'id':_0x25bc14[_0x5556('0xbb')]['id']}})[_0x5556('0x1b')](handleEntityNotFound(_0x36cf1,null))[_0x5556('0x1b')](function(_0x56401d){if(_0x56401d){return _0x56401d[_0x5556('0xd0')](_0x25bc14[_0x5556('0x3e')]['ids']);}})[_0x5556('0x1b')](respondWithStatusCode(_0x36cf1,null))[_0x5556('0x2e')](handleError(_0x36cf1,null));};exports[_0x5556('0xd1')]=function(_0x1f015e,_0x5a030b){var _0x2d33c8=moment()[_0x5556('0xd2')]()[_0x5556('0x97')]();var _0x4f7096=path['join'](config[_0x5556('0xd3')],_0x5556('0xd4'),_0x5556('0xd5'),_0x5556('0xd6'));var _0x746a5c=path[_0x5556('0xd7')](config[_0x5556('0xd3')],_0x5556('0xd4'),'files',_0x5556('0xd8'));var _0x2c8f6d=path[_0x5556('0xd7')](_0x4f7096,_0x2d33c8);var _0x2f5c00=util[_0x5556('0xc7')](_0x5556('0xd9'),_0x1f015e['params']['id'],_0x2d33c8);var _0x2763f5=path['join'](_0x4f7096,_0x2f5c00);var _0x44a1f1=[];if(_0x1f015e[_0x5556('0x3e')][_0x5556('0xd8')]){_0x44a1f1[_0x5556('0x27')]({'model':db[_0x5556('0xda')],'as':'Attachments','raw':!![]});}var _0x53ed9d=[{'model':db[_0x5556('0x28')],'as':_0x5556('0xdb'),'attributes':['id',_0x5556('0xc0'),_0x5556('0x4c'),'to','cc',_0x5556('0xdc'),'subject',_0x5556('0x77')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x44a1f1}];return db[_0x5556('0x37')][_0x5556('0x6a')]({'where':{'id':_0x1f015e[_0x5556('0xbb')]['id']},'include':_0x53ed9d})[_0x5556('0x1b')](handleEntityNotFound(_0x5a030b,null))[_0x5556('0x1b')](function(_0x3d3b6e){if(_0x3d3b6e&&_0x3d3b6e['Messages']){var _0x1f42f9=_0x3d3b6e[_0x5556('0xdd')]({'plain':!![]});fs[_0x5556('0xde')](_0x2c8f6d);return BPromise[_0x5556('0xdf')](_0x1f42f9[_0x5556('0xdb')],function(_0x5e3850,_0x33ec6e){var _0x5c4fa8={'from':_0x5e3850[_0x5556('0x4c')],'to':_0x5e3850['to'],'subject':_0x5e3850[_0x5556('0xe0')],'html':htmlEntities[_0x5556('0xe1')](_0x5e3850[_0x5556('0xc0')]),'headers':{'Date':moment(_0x5e3850['createdAt'])[_0x5556('0xc7')](_0x5556('0xe2'))},'attachments':[]};if(_0x5e3850['cc']){_0x5c4fa8[_0x5556('0xe3')]['Cc']=_0x5e3850['cc'];}if(_0x5e3850[_0x5556('0xdc')]){_0x5c4fa8[_0x5556('0xe3')][_0x5556('0xe4')]=_0x5e3850[_0x5556('0xdc')];}return new BPromise(function(_0x30b763,_0x4957af){if(_0x5e3850[_0x5556('0xe5')]){for(var _0x46bdc9=0x0;_0x46bdc9<_0x5e3850[_0x5556('0xe5')][_0x5556('0x41')];_0x46bdc9++){var _0x3ac4b9=_0x5e3850[_0x5556('0xe5')][_0x46bdc9];var _0x1088f2=path[_0x5556('0xd7')](_0x746a5c,_0x3ac4b9[_0x5556('0xe6')]);if(fs[_0x5556('0xe7')](_0x1088f2)){_0x5c4fa8[_0x5556('0xd8')][_0x5556('0x27')]({'name':_0x3ac4b9[_0x5556('0x1f')],'contentType':_0x3ac4b9['type'],'data':fs[_0x5556('0xe8')](_0x1088f2)});}}}emlformat['build'](_0x5c4fa8,function(_0x1f88d8,_0x5ed948){if(_0x1f88d8)return _0x4957af(_0x1f88d8);fs['writeFileSync'](path[_0x5556('0xd7')](_0x2c8f6d,util[_0x5556('0xc7')](_0x5556('0xe9'),_0x33ec6e)),_0x5ed948);return _0x30b763(_0x5ed948);});});})[_0x5556('0x1b')](function(){return new BPromise(function(_0x25aef1,_0x610c82){zipdir(_0x2c8f6d,{'saveTo':_0x2763f5},function(_0x2401bf,_0x4da7e6){if(_0x2401bf)return _0x610c82(_0x2401bf);return _0x25aef1(_0x4da7e6);});})[_0x5556('0x1b')](function(){return new BPromise(function(_0x40a944,_0x483e40){rimraf(_0x2c8f6d,function(_0x2c68dd){if(_0x2c68dd)_0x483e40(_0x2c68dd);return _0x40a944();});});})[_0x5556('0x1b')](function(){return _0x5a030b[_0x5556('0xd1')](_0x2763f5,_0x2f5c00,function(_0x3fd8da){if(!_0x3fd8da)fs['unlinkSync'](_0x2763f5);});});});}else{return _0x5a030b[_0x5556('0x11')](0xc8);}})[_0x5556('0x2e')](handleError(_0x5a030b,null));}; \ No newline at end of file +var _0xc284=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','message%d.eml','unlinkSync','sendStatus','zip-dir','moment','bluebird','util','path','squel','juice','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','findOne','out','-id','lastMsgText','catch','waiting','talking','total','closed','UserId','unmanaged','index','MailInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','ui.MailInteractionId','user_has_mail_interactions','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','unreadMessages','value','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','plainBody','buildExpression','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','includeAll','include','create','body','params','describe','addMessage','ids','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','true','addTags','setTags','omit','emit','mailInteractionTags:save','removeTags','download','unix','join','server','root','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','each','decode'];(function(_0x2ba7b,_0x5c47e9){var _0x1f3036=function(_0x1847a9){while(--_0x1847a9){_0x2ba7b['push'](_0x2ba7b['shift']());}};_0x1f3036(++_0x5c47e9);}(_0xc284,0xf8));var _0x4c28=function(_0x289a76,_0xd5b36b){_0x289a76=_0x289a76-0x0;var _0x57dc3f=_0xc284[_0x289a76];return _0x57dc3f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c28('0x0'));var moment=require(_0x4c28('0x1'));var BPromise=require(_0x4c28('0x2'));var util=require(_0x4c28('0x3'));var path=require(_0x4c28('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4c28('0x5'));var juice=require(_0x4c28('0x6'));var Redis=require(_0x4c28('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0x4c28('0x8'));var logger=require('../../config/logger')(_0x4c28('0x9'));var config=require(_0x4c28('0xa'));var db=require(_0x4c28('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x4c28('0xc')]=_[_0x4c28('0xd')](config[_0x4c28('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c28('0xe'))(new Redis(config[_0x4c28('0xc')]));require(_0x4c28('0xf'))[_0x4c28('0x10')](socket);function respondWithStatusCode(_0x541339,_0x558300){_0x558300=_0x558300||0xcc;return function(_0x22bbce){if(_0x22bbce){return _0x541339['sendStatus'](_0x558300);}return _0x541339[_0x4c28('0x11')](_0x558300)[_0x4c28('0x12')]();};}function respondWithResult(_0x2a49db,_0x56e19a){_0x56e19a=_0x56e19a||0xc8;return function(_0x3ef086){if(_0x3ef086){return _0x2a49db[_0x4c28('0x11')](_0x56e19a)[_0x4c28('0x13')](_0x3ef086);}};}function respondWithFilteredResult(_0x5ef129,_0x2a43d2){return function(_0x4ba929){if(_0x4ba929){var _0x27201a=typeof _0x2a43d2[_0x4c28('0x14')]===_0x4c28('0x15')&&typeof _0x2a43d2[_0x4c28('0x16')]===_0x4c28('0x15');var _0x557c9c=_0x4ba929['count'];var _0x4a701f=_0x27201a?0x0:_0x2a43d2['offset'];var _0x221741=_0x27201a?_0x4ba929['count']:_0x2a43d2[_0x4c28('0x14')]+_0x2a43d2[_0x4c28('0x16')];var _0x100625;if(_0x221741>=_0x557c9c){_0x221741=_0x557c9c;_0x100625=0xc8;}else{_0x100625=0xce;}_0x5ef129[_0x4c28('0x11')](_0x100625);return _0x5ef129[_0x4c28('0x17')](_0x4c28('0x18'),_0x4a701f+'-'+_0x221741+'/'+_0x557c9c)['json'](_0x4ba929);}return null;};}function saveUpdates(_0x1f93b9){return function(_0x2572bf){if(_0x2572bf){return _0x2572bf[_0x4c28('0x19')](_0x1f93b9)[_0x4c28('0x1a')](function(_0x50b71b){return _0x50b71b;});}return null;};}function removeEntity(_0x5ed4b4){return function(_0x2acbb8){if(_0x2acbb8){return _0x2acbb8[_0x4c28('0x1b')]()[_0x4c28('0x1a')](function(){_0x5ed4b4[_0x4c28('0x11')](0xcc)[_0x4c28('0x12')]();});}};}function handleEntityNotFound(_0x5d8b30){return function(_0x3e92f3){if(!_0x3e92f3){_0x5d8b30['sendStatus'](0x194);}return _0x3e92f3;};}function handleError(_0x1c369f,_0x41475d){_0x41475d=_0x41475d||0x1f4;return function(_0xe9bd13){logger['error'](_0xe9bd13[_0x4c28('0x1c')]);if(_0xe9bd13[_0x4c28('0x1d')]){delete _0xe9bd13[_0x4c28('0x1d')];}_0x1c369f[_0x4c28('0x11')](_0x41475d)[_0x4c28('0x1e')](_0xe9bd13);};}function getInteractionUsers(_0x11ea81,_0x207b7b){return new BPromise(function(_0x4f9570,_0xe05345){try{if(_0x207b7b[_0x11ea81['id']]){_0x11ea81[_0x4c28('0x1f')]=_[_0x4c28('0x20')](_0x207b7b[_0x11ea81['id']],function(_0x20d031){return{'id':_0x20d031['id'],'fullname':_0x20d031['fullname']};});}}catch(_0x2e09b4){_0xe05345(_0x2e09b4);}_0x4f9570(_0x11ea81);});}function getInteractionTags(_0x13ea7c,_0xcfd21){return new BPromise(function(_0x1c0bbb,_0x2b8792){try{if(_0x13ea7c[_0x4c28('0x21')]){_0x13ea7c['Tags']=[];_0x13ea7c[_0x4c28('0x21')][_0x4c28('0x22')](',')[_0x4c28('0x23')](function(_0x89b02f){_0x13ea7c[_0x4c28('0x24')][_0x4c28('0x25')](_0xcfd21[_0x89b02f]);});}delete _0x13ea7c['TagIds'];}catch(_0x408fec){_0x2b8792(_0x408fec);}_0x1c0bbb(_0x13ea7c);});}function getLastMessageText(_0x5a6c4f){return new BPromise(function(_0x17b40a,_0x55a765){return db['MailMessage'][_0x4c28('0x26')]({'where':{'$and':[{'MailInteractionId':_0x5a6c4f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4c28('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x4c28('0x28'),'raw':!![]})[_0x4c28('0x1a')](function(_0x4c2235){if(_0x4c2235&&_0x4c2235['plainBody']){_0x5a6c4f[_0x4c28('0x29')]=_['trimStart'](_0x4c2235['plainBody']);}_0x17b40a(_0x5a6c4f);})[_0x4c28('0x2a')](function(_0x1a5163){_0x55a765(_0x1a5163);});});}function updateMailInteraction(_0x10584c,_0x141b0b,_0x4539bd,_0x47fb65){return new BPromise(function(_0xd53fd2,_0x3ad4b6){return getInteractionUsers(_0x10584c,_0x4539bd)[_0x4c28('0x1a')](function(_0x2d4e0d){return getInteractionTags(_0x2d4e0d,_0x141b0b);})[_0x4c28('0x1a')](function(_0x18873e){return getStateInteraction(_0x18873e);})[_0x4c28('0x1a')](function(_0x98350d){if(_0x47fb65){_0xd53fd2(getLastMessageText(_0x98350d));}else{_0xd53fd2(_0x98350d);}})['catch'](function(_0x15fde8){_0x3ad4b6(_0x15fde8);});});}function getStateInteraction(_0x5cad38){return new BPromise(function(_0x5e4548){_0x5cad38[_0x4c28('0x2b')]=0x0;_0x5cad38[_0x4c28('0x2c')]=0x0;_0x5cad38['answered']=0x0;_0x5cad38['unmanaged']=0x0;_0x5cad38[_0x4c28('0x2d')]=0x0;if(!_0x5cad38[_0x4c28('0x2e')]&&!_0x5cad38[_0x4c28('0x2f')]){_0x5cad38[_0x4c28('0x2b')]+=0x1;}if(!_0x5cad38[_0x4c28('0x2e')]&&_0x5cad38['UserId']){_0x5cad38[_0x4c28('0x2c')]+=0x1;if(_0x5cad38[_0x4c28('0x2b')]){_0x5cad38['waiting']-=0x1;}}if(_0x5cad38[_0x4c28('0x2e')]&&_0x5cad38[_0x4c28('0x2f')]){_0x5cad38['answered']+=0x1;if(_0x5cad38[_0x4c28('0x2c')]){_0x5cad38['talking']-=0x1;}}if(_0x5cad38['closed']&&!_0x5cad38['UserId']){_0x5cad38[_0x4c28('0x30')]+=0x1;if(_0x5cad38['waiting']){_0x5cad38['waiting']-=0x1;}}_0x5cad38['total']+=0x1;_0x5e4548(_0x5cad38);});}exports[_0x4c28('0x31')]=function(_0x28de50,_0x510bc1){var _0x307ac0={},_0x275c60={},_0x13c4aa={'count':0x0,'rows':[]};var _0x50d7ce=_[_0x4c28('0x20')](db[_0x4c28('0x32')][_0x4c28('0x33')],function(_0x2dd5f5){return{'name':_0x2dd5f5['fieldName'],'type':_0x2dd5f5[_0x4c28('0x34')][_0x4c28('0x35')]};});_0x275c60[_0x4c28('0x36')]=_[_0x4c28('0x20')](_0x50d7ce,_0x4c28('0x1d'));_0x275c60[_0x4c28('0x37')]=_[_0x4c28('0x38')](_0x28de50[_0x4c28('0x37')]);_0x275c60[_0x4c28('0x39')]=_[_0x4c28('0x3a')](_0x275c60[_0x4c28('0x36')],_0x275c60[_0x4c28('0x37')]);_0x307ac0[_0x4c28('0x3b')]=_[_0x4c28('0x3a')](_0x275c60[_0x4c28('0x36')],qs[_0x4c28('0x3c')](_0x28de50[_0x4c28('0x37')]['fields']));_0x307ac0[_0x4c28('0x3b')]=_0x307ac0[_0x4c28('0x3b')]['length']?_0x307ac0[_0x4c28('0x3b')]:_0x275c60[_0x4c28('0x36')];if(!_0x28de50[_0x4c28('0x37')][_0x4c28('0x3d')](_0x4c28('0x3e'))){_0x307ac0[_0x4c28('0x16')]=qs[_0x4c28('0x16')](_0x28de50['query']['limit']);_0x307ac0[_0x4c28('0x14')]=qs[_0x4c28('0x14')](_0x28de50['query'][_0x4c28('0x14')]);}_0x307ac0[_0x4c28('0x3f')]=qs[_0x4c28('0x40')](_0x28de50[_0x4c28('0x37')][_0x4c28('0x40')]);_0x307ac0[_0x4c28('0x41')]=qs[_0x4c28('0x39')](_[_0x4c28('0x42')](_0x28de50[_0x4c28('0x37')],_0x275c60[_0x4c28('0x39')]),_0x50d7ce);var _0x2e02bf=[];var _0xe31f55=squel[_0x4c28('0x43')]()[_0x4c28('0x44')]('id')[_0x4c28('0x44')]('name')['field'](_0x4c28('0x45'))[_0x4c28('0x46')]('tools_tags');var _0x4a9485=squel['select']()[_0x4c28('0x44')](_0x4c28('0x47'))[_0x4c28('0x44')]('u.fullname')[_0x4c28('0x44')](_0x4c28('0x48'))[_0x4c28('0x46')](_0x4c28('0x49'),'ui')['left_join']('users','u',_0x4c28('0x4a'));var _0xe23eb0=squel['select']()[_0x4c28('0x46')](_0x4c28('0x4b'),'i')['left_join'](_0x4c28('0x4c'),'c',_0x4c28('0x4d'))[_0x4c28('0x4e')](_0x4c28('0x4f'),'o',_0x4c28('0x50'))[_0x4c28('0x4e')](_0x4c28('0x51'),'a','a.id\x20=\x20i.MailAccountId')[_0x4c28('0x4e')]('mail_messages','me',_0x4c28('0x52'))[_0x4c28('0x4e')](_0x4c28('0x53'),'it',_0x4c28('0x54'))['left_join'](_0x4c28('0x55'),'t',_0x4c28('0x56'));var _0x47f807=squel[_0x4c28('0x57')]();var _0x381d3b=[];var _0x5d7297=squel['expr']();var _0x1ce347;if(_0x28de50[_0x4c28('0x37')]['search']){_0x1ce347=as[_0x4c28('0x58')](_0x28de50[_0x4c28('0x37')][_0x4c28('0x59')]);var _0x1e4949=_0x1ce347[_0x4c28('0x5a')];for(var _0x28b555=0x0;_0x28b555<_0x1ce347['conditions'][_0x4c28('0x5b')];_0x28b555++){var _0x139da5=_0x1ce347['conditions'][_0x28b555];var _0x3fb1bb='i';var _0x1f5775=_['find'](_0x50d7ce,[_0x4c28('0x1d'),_0x139da5[_0x4c28('0x44')]]);if(!_0x1f5775){switch(_0x139da5[_0x4c28('0x44')]){case _0x4c28('0x5c'):if(_0x139da5[_0x4c28('0x5d')]==0x1){_0xe23eb0['having']('`'+_0x139da5[_0x4c28('0x44')]+'`\x20=\x200');}else{_0xe23eb0[_0x4c28('0x5e')]('`'+_0x139da5[_0x4c28('0x44')]+_0x4c28('0x5f'));}break;case'Contact':if(_0x139da5['operator']===_0x4c28('0x60')){if(_0x139da5[_0x4c28('0x5d')][_0x4c28('0x22')]('\x20')['length']>0x1){_0x47f807[_0x1e4949](_0x4c28('0x61'),qs['getFullTextValue'](_0x139da5[_0x4c28('0x5d')]),null);}else{var _0x4afa25='%'+_0x139da5['value']+'%';_0x47f807[_0x1e4949](_0x4c28('0x62'),_0x4afa25,_0x4afa25,_0x4afa25);}}else{_0x1f5775=_['find'](_0x50d7ce,[_0x4c28('0x1d'),_0x4c28('0x63')]);_0x139da5[_0x4c28('0x44')]=_0x4c28('0x63');_0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775['type'],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x12')]);}break;case _0x4c28('0x66'):var _0x57e20f=_0x139da5[_0x4c28('0x5d')][_0x4c28('0x22')](',')['map'](function(_0x2df9cf){return Number(_0x2df9cf);});_0x57e20f[_0x4c28('0x23')](function(_0x2c049b){_0x5d7297['or'](_0x4c28('0x67'),'%,'+_0x2c049b+',%');});_0x381d3b=_['union'](_0x381d3b,_0x57e20f);break;case'User':if(_0x139da5[_0x4c28('0x68')]===_0x4c28('0x60')){_0x47f807[_0x1e4949](_0x4c28('0x69'),'%'+_0x139da5[_0x4c28('0x5d')]+'%',null);}else{_0x1f5775=_[_0x4c28('0x6a')](_0x50d7ce,[_0x4c28('0x1d'),'UserId']);_0x139da5[_0x4c28('0x44')]=_0x4c28('0x2f');_0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775[_0x4c28('0x34')],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f['text'],_0x541a4f[_0x4c28('0x5d')]['start'],_0x541a4f['value'][_0x4c28('0x12')]);}break;case _0x4c28('0x6b'):_0x541a4f=as[_0x4c28('0x6c')]('me',null,_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x12')]);break;}}else{var _0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775[_0x4c28('0x34')],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')]['end']);}}}else{var _0x2e093e=_(_0x28de50[_0x4c28('0x37')])[_0x4c28('0x38')]()[_0x4c28('0x20')](function(_0x50e01b){return _[_0x4c28('0x6d')](_0x50d7ce,[_0x4c28('0x1d'),_0x50e01b])?_0x50e01b:undefined;})[_0x4c28('0x6e')]()['value']();if(!_['isEmpty'](_0x2e093e)){_0x2e093e['forEach'](function(_0x38ce45){if(_0x38ce45===_0x4c28('0x6f')){_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x70'),[][_0x4c28('0x71')](_0x28de50[_0x4c28('0x37')][_0x38ce45]));}else if(_0x38ce45===_0x4c28('0x72')){var _0x4b1b8d=JSON[_0x4c28('0x73')](_0x28de50[_0x4c28('0x37')][_0x38ce45])['$gte'];var _0x4fcf35=JSON[_0x4c28('0x73')](_0x28de50['query'][_0x38ce45])[_0x4c28('0x74')];_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x75'),_0x4b1b8d,_0x4fcf35);}else{if(_0x28de50['query'][_0x38ce45]===_0x4c28('0x76')){_0xe23eb0[_0x4c28('0x41')]('i.'+_0x38ce45+_0x4c28('0x77'));}else{_0xe23eb0[_0x4c28('0x41')]('i.'+_0x38ce45+'\x20=\x20?',_0x28de50['query'][_0x38ce45]);}}});}if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x78')]){if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x78')]==0x1){_0xe23eb0[_0x4c28('0x5e')](_0x4c28('0x79'));}else{_0xe23eb0['having'](_0x4c28('0x7a'));}}if(_0x28de50['query'][_0x4c28('0x7b')]){_0x381d3b=_[_0x4c28('0x7c')](_0x28de50[_0x4c28('0x37')]['tag'])?_0x28de50[_0x4c28('0x37')][_0x4c28('0x7b')]:new Array(_0x28de50[_0x4c28('0x37')]['tag']);_0x381d3b[_0x4c28('0x23')](function(_0x5ee464){_0x5d7297['or'](_0x4c28('0x67'),'%,'+_0x5ee464+',%');});}if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x7d')]){var _0x4d76e9=_0x28de50[_0x4c28('0x37')][_0x4c28('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x4c28('0x7e')](/'/g,'\x27\x27');if(qs[_0x4c28('0x7f')](_0x4d76e9)){_0x47f807['or'](_0x4c28('0x80'),_0x4d76e9+'%');}else if(qs[_0x4c28('0x81')](_0x4d76e9)){_0x47f807['or']('c.email\x20LIKE\x20?',_0x4d76e9+'%');}else{_0x47f807['or'](_0x4c28('0x82'),qs[_0x4c28('0x83')](_0x4d76e9))['or'](_0x4c28('0x84'),qs['getFullTextValue'](_0x4d76e9));}}}_0xe23eb0[_0x4c28('0x41')](_0x47f807);_0xe23eb0[_0x4c28('0x85')](_0x4c28('0x86'));var _0x310297={'type':db[_0x4c28('0x87')][_0x4c28('0x88')][_0x4c28('0x89')],'raw':!![]};var _0x253c1b=_0xe23eb0[_0x4c28('0x8a')]();_0x253c1b['field'](_0x4c28('0x86'));_0x253c1b[_0x4c28('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x307ac0[_0x4c28('0x3f')]){_0x307ac0['order'][_0x4c28('0x23')](function(_0x529c3f){var _0x862b1c=_0x529c3f[0x0]===_0x4c28('0x8b')?_0x529c3f[0x0]:'i.'+_0x529c3f[0x0];_0xe23eb0[_0x4c28('0x3f')](_0x862b1c,_0x529c3f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4c28('0x8c')](_0x381d3b)){_0xe23eb0[_0x4c28('0x5e')](_0x5d7297);_0x253c1b[_0x4c28('0x41')]('t.id\x20IN\x20?',_0x381d3b);}BPromise[_0x4c28('0x8d')]()[_0x4c28('0x1a')](function(){if(!_0x1ce347){if(_0x28de50[_0x4c28('0x37')]['MailAccountId'])return;_0x253c1b[_0x4c28('0x41')](_0x4c28('0x8e'));_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x8e'));return;}if(_0x28de50[_0x4c28('0x8f')][_0x4c28('0x90')]!==_0x4c28('0x91'))return;return _0x28de50['user'][_0x4c28('0x92')]({'attributes':['id'],'raw':!![]})[_0x4c28('0x1a')](function(_0x4d245b){if(_[_0x4c28('0x8c')](_0x4d245b)){_0x253c1b[_0x4c28('0x41')]('i.MailAccountId\x20IS\x20NULL');_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x93'));}else{_0x253c1b['where'](_0x4c28('0x70'),_[_0x4c28('0x20')](_0x4d245b,'id'));_0xe23eb0['where'](_0x4c28('0x70'),_[_0x4c28('0x20')](_0x4d245b,'id'));}});})['then'](function(){if(_0x28de50[_0x4c28('0x8f')][_0x4c28('0x90')]==='agent'&&!_0x1ce347&&!_0x28de50['query'][_0x4c28('0x6f')])return[];return db[_0x4c28('0x94')][_0x4c28('0x37')](_0x253c1b[_0x4c28('0x95')](),_0x310297);})['then'](function(_0xd7ae8a){_0x13c4aa['count']=_0xd7ae8a[_0x4c28('0x5b')];if(_0x13c4aa[_0x4c28('0x96')]===0x0)return[];return db['sequelize'][_0x4c28('0x37')](_0xe31f55['toString'](),_0x310297)[_0x4c28('0x1a')](function(_0x5a5438){_0x2e02bf=_[_0x4c28('0x97')](_0x5a5438,'id');_0x310297=_[_0x4c28('0x98')](_0x310297,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28de50['query']['fields']){_0x307ac0[_0x4c28('0x3b')][_0x4c28('0x23')](function(_0x970a47){_0xe23eb0[_0x4c28('0x44')]('i.'+_0x970a47);});}else{_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x99'),_0x4c28('0x5c'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x9a'),_0x4c28('0x9b'));_0xe23eb0['field'](_0x4c28('0x9c'),_0x4c28('0x9d'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x9e'),_0x4c28('0x9f'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa0'),_0x4c28('0x8b'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x86'));_0xe23eb0[_0x4c28('0x44')]('i.createdAt');_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa1'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa2'));_0xe23eb0['field'](_0x4c28('0xa3'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa4'));_0xe23eb0[_0x4c28('0x44')]('i.lastMsgAt');_0xe23eb0[_0x4c28('0x44')]('i.lastMsgDirection');_0xe23eb0['field'](_0x4c28('0xa5'));_0xe23eb0['field'](_0x4c28('0xa6'));_0xe23eb0['field'](_0x4c28('0xa7'));_0xe23eb0['field'](_0x4c28('0xa8'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa9'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xaa'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xab'));_0xe23eb0['field'](_0x4c28('0xac'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xad'));_0xe23eb0[_0x4c28('0x44')]('c.firstName',_0x4c28('0xae'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xaf'),_0x4c28('0xb0'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb1'),_0x4c28('0xb2'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb3'),_0x4c28('0xb4'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb5'),_0x4c28('0xb6'));_0xe23eb0['field']('c.fax','Contact.fax');_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb7'),_0x4c28('0xb8'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb9'),_0x4c28('0xba'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xbb'),_0x4c28('0x21'));}if(_0x307ac0['limit'])_0xe23eb0[_0x4c28('0x16')](_0x307ac0[_0x4c28('0x16')]);if(_0x307ac0['offset'])_0xe23eb0['offset'](_0x307ac0['offset']);return db[_0x4c28('0x94')][_0x4c28('0x37')](_0xe23eb0[_0x4c28('0x95')](),_0x310297);})[_0x4c28('0x1a')](function(_0x54b6e0){if(_0x54b6e0['length']>0x0)_0x4a9485[_0x4c28('0x41')](_0x4c28('0xbc'),_[_0x4c28('0x20')](_0x54b6e0,'id'));return db[_0x4c28('0x94')][_0x4c28('0x37')](_0x4a9485[_0x4c28('0x95')](),_0x310297)['then'](function(_0x4163d1){var _0x3de3a7=_[_0x4c28('0xbd')](_0x4163d1,_0x4c28('0xbe'));var _0x3bf062=[];return db[_0x4c28('0xbf')][_0x4c28('0x26')]({'attributes':[_0x4c28('0xc0')],'raw':!![]})[_0x4c28('0x1a')](function(_0x162110){var _0x479566=_0x162110[_0x4c28('0xc0')];_0x54b6e0[_0x4c28('0x23')](function(_0xad23dc){_0x3bf062[_0x4c28('0x25')](updateMailInteraction(_0xad23dc,_0x2e02bf,_0x3de3a7,_0x479566));});return BPromise[_0x4c28('0xc1')](_0x3bf062);});});});})['then'](function(_0x1487e8){_0x13c4aa[_0x4c28('0xc2')]=_0x1487e8;return _0x13c4aa;})[_0x4c28('0x1a')](respondWithFilteredResult(_0x510bc1,_0x307ac0))[_0x4c28('0x2a')](handleError(_0x510bc1,null));};exports['show']=function(_0x3ced67,_0x550b83){var _0x1f78ce={'raw':![],'where':{'id':_0x3ced67['params']['id']}},_0x20895d={};_0x20895d['model']=_[_0x4c28('0x38')](db[_0x4c28('0x32')][_0x4c28('0x33')]);_0x20895d[_0x4c28('0x37')]=_['keys'](_0x3ced67[_0x4c28('0x37')]);_0x20895d[_0x4c28('0x39')]=_[_0x4c28('0x3a')](_0x20895d[_0x4c28('0x36')],_0x20895d['query']);_0x1f78ce[_0x4c28('0x3b')]=_[_0x4c28('0x3a')](_0x20895d[_0x4c28('0x36')],qs[_0x4c28('0x3c')](_0x3ced67[_0x4c28('0x37')][_0x4c28('0x3c')]));_0x1f78ce[_0x4c28('0x3b')]=_0x1f78ce[_0x4c28('0x3b')][_0x4c28('0x5b')]?_0x1f78ce[_0x4c28('0x3b')]:_0x20895d[_0x4c28('0x36')];if(_0x3ced67[_0x4c28('0x37')][_0x4c28('0xc3')]){_0x1f78ce[_0x4c28('0xc4')]=[{'all':!![]}];}_0x1f78ce=_[_0x4c28('0x98')]({},_0x1f78ce,_0x3ced67['options']);return db[_0x4c28('0x32')][_0x4c28('0x6a')](_0x1f78ce)['then'](handleEntityNotFound(_0x550b83,null))[_0x4c28('0x1a')](respondWithResult(_0x550b83,null))[_0x4c28('0x2a')](handleError(_0x550b83,null));};exports[_0x4c28('0xc5')]=function(_0xfc3131,_0x5e2c43){return db[_0x4c28('0x32')][_0x4c28('0xc5')](_0xfc3131[_0x4c28('0xc6')],{})[_0x4c28('0x1a')](respondWithResult(_0x5e2c43,0xc9))[_0x4c28('0x2a')](handleError(_0x5e2c43,null));};exports['update']=function(_0x33f79e,_0x30b1dd){if(_0x33f79e['body']['id']){delete _0x33f79e[_0x4c28('0xc6')]['id'];}return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x33f79e[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x30b1dd,null))[_0x4c28('0x1a')](saveUpdates(_0x33f79e['body'],null))[_0x4c28('0x1a')](respondWithResult(_0x30b1dd,null))[_0x4c28('0x2a')](handleError(_0x30b1dd,null));};exports[_0x4c28('0x1b')]=function(_0x363241,_0x333e94){return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x363241['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x333e94,null))[_0x4c28('0x1a')](removeEntity(_0x333e94,null))['catch'](handleError(_0x333e94,null));};exports['describe']=function(_0xb32609,_0x347ec8){return db[_0x4c28('0x32')][_0x4c28('0xc8')]()[_0x4c28('0x1a')](respondWithResult(_0x347ec8,null))[_0x4c28('0x2a')](handleError(_0x347ec8,null));};exports['addMessage']=function(_0x1f74df,_0x50c427){return db['MailMessage'][_0x4c28('0x6a')]({'where':{'id':_0x1f74df[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x50c427,null))[_0x4c28('0x1a')](function(_0x36daaa){if(_0x36daaa){return _0x36daaa[_0x4c28('0xc9')](_0x1f74df[_0x4c28('0xc6')][_0x4c28('0xca')],_['omit'](_0x1f74df['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x50c427,null))['catch'](handleError(_0x50c427,null));};exports[_0x4c28('0xcb')]=function(_0x5e19e1,_0x4e18a8){var _0x1d75f3={'raw':![],'where':{}};var _0x4ba926={};var _0x4ad4df={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4c28('0x26')]({'where':{'id':_0x5e19e1['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x4e18a8,null))['then'](function(_0x3afc73){if(_0x3afc73){_0x4ba926[_0x4c28('0x36')]=_[_0x4c28('0x38')](db[_0x4c28('0xcc')]['rawAttributes']);_0x4ba926[_0x4c28('0x37')]=_[_0x4c28('0x38')](_0x5e19e1['query']);_0x4ba926['filters']=_['intersection'](_0x4ba926[_0x4c28('0x36')],_0x4ba926[_0x4c28('0x37')]);_0x1d75f3['attributes']=_[_0x4c28('0x3a')](_0x4ba926['model'],qs[_0x4c28('0x3c')](_0x5e19e1[_0x4c28('0x37')]['fields']));_0x1d75f3[_0x4c28('0x3b')]=_0x1d75f3[_0x4c28('0x3b')][_0x4c28('0x5b')]?_0x1d75f3[_0x4c28('0x3b')]:_0x4ba926[_0x4c28('0x36')];if(!_0x5e19e1[_0x4c28('0x37')]['hasOwnProperty'](_0x4c28('0x3e'))){_0x1d75f3[_0x4c28('0x16')]=qs[_0x4c28('0x16')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x16')]);_0x1d75f3[_0x4c28('0x14')]=qs[_0x4c28('0x14')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x14')]);}_0x1d75f3['order']=qs[_0x4c28('0x40')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x40')]);_0x1d75f3[_0x4c28('0x41')]=qs['filters'](_[_0x4c28('0x42')](_0x5e19e1['query'],_0x4ba926[_0x4c28('0x39')]));_0x1d75f3[_0x4c28('0x41')][_0x4c28('0xbe')]=_0x3afc73['id'];if(_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x7d')]){_0x1d75f3['where']=_['merge'](_0x1d75f3[_0x4c28('0x41')],{'$or':_['map'](_0x1d75f3[_0x4c28('0x3b')],function(_0x3dd3b3){var _0x29435f={};_0x29435f[_0x3dd3b3]={'$like':'%'+_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x7d')]+'%'};return _0x29435f;})});}if(_0x5e19e1[_0x4c28('0x37')][_0x4c28('0xcd')]){var _0x42eea7=_0x5e19e1[_0x4c28('0x37')][_0x4c28('0xcd')]['split'](',');var _0x58a2de={};_0x58a2de[_0x42eea7[0x0]]={'$gte':moment(_0x42eea7[0x1])[_0x4c28('0xce')](_0x4c28('0xcf'))};_0x1d75f3['where']=_[_0x4c28('0x98')](_0x1d75f3[_0x4c28('0x41')],_0x58a2de);}_0x1d75f3=_[_0x4c28('0x98')]({},_0x1d75f3,_0x5e19e1[_0x4c28('0xd0')]);return db[_0x4c28('0xcc')]['count']({'where':_0x1d75f3[_0x4c28('0x41')]})[_0x4c28('0x1a')](function(_0x250534){_0x4ad4df[_0x4c28('0x96')]=_0x250534;if(_0x5e19e1['query'][_0x4c28('0xc3')]){_0x1d75f3[_0x4c28('0xc4')]=[{'all':!![]}];}return db[_0x4c28('0xcc')][_0x4c28('0xd1')](_0x1d75f3);})[_0x4c28('0x1a')](function(_0x20376f){if(_0x5e19e1[_0x4c28('0x37')]['inlineCss']===_0x4c28('0xd2')){for(var _0x183d22=0x0;_0x183d22<_0x20376f[_0x4c28('0x5b')];_0x183d22++){_0x20376f[_0x183d22][_0x4c28('0xc6')]=juice(_0x20376f[_0x183d22][_0x4c28('0xc6')]);}}_0x4ad4df[_0x4c28('0xc2')]=_0x20376f;return _0x4ad4df;});}})[_0x4c28('0x1a')](respondWithFilteredResult(_0x4e18a8,_0x1d75f3))[_0x4c28('0x2a')](handleError(_0x4e18a8,null));};exports[_0x4c28('0xd3')]=function(_0x217d02,_0x486bd5){return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x217d02[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x486bd5,null))[_0x4c28('0x1a')](function(_0x1be43c){if(_0x1be43c){return _0x1be43c[_0x4c28('0xd4')](_0x217d02[_0x4c28('0xc6')][_0x4c28('0xca')],_[_0x4c28('0xd5')](_0x217d02[_0x4c28('0xc6')],[_0x4c28('0xca'),'id'])||{})['spread'](function(){return db['Tag'][_0x4c28('0xd1')]({'attributes':['id','name',_0x4c28('0x45')],'where':{'id':_0x217d02[_0x4c28('0xc6')]['ids']}});})[_0x4c28('0x1a')](function(_0x261451){socket[_0x4c28('0xd6')](_0x4c28('0xd7'),{'id':Number(_0x217d02['params']['id']),'tags':_0x261451||[]});return{'id':Number(_0x217d02[_0x4c28('0xc7')]['id']),'tags':_0x261451||[]};});}})['then'](respondWithResult(_0x486bd5,null))['catch'](handleError(_0x486bd5,null));};exports[_0x4c28('0xd8')]=function(_0x4beb0e,_0x36f2e0){return db['MailInteraction']['find']({'where':{'id':_0x4beb0e['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x36f2e0,null))[_0x4c28('0x1a')](function(_0x28ec21){if(_0x28ec21){return _0x28ec21[_0x4c28('0xd8')](_0x4beb0e[_0x4c28('0x37')][_0x4c28('0xca')]);}})['then'](respondWithStatusCode(_0x36f2e0,null))[_0x4c28('0x2a')](handleError(_0x36f2e0,null));};exports[_0x4c28('0xd9')]=function(_0x4373d8,_0x46543c){var _0x5bb014=moment()[_0x4c28('0xda')]()['toString']();var _0x385d23=path[_0x4c28('0xdb')](config['root'],_0x4c28('0xdc'),'files','tmp');var _0x144d90=path[_0x4c28('0xdb')](config[_0x4c28('0xdd')],_0x4c28('0xdc'),'files','attachments');var _0x57c125=path['join'](_0x385d23,_0x5bb014);var _0x1dbe52=util[_0x4c28('0xce')](_0x4c28('0xde'),_0x4373d8['params']['id'],_0x5bb014);var _0x1e2b1e=path['join'](_0x385d23,_0x1dbe52);var _0x280b97=[];if(_0x4373d8[_0x4c28('0x37')][_0x4c28('0xdf')]){_0x280b97[_0x4c28('0x25')]({'model':db[_0x4c28('0xe0')],'as':_0x4c28('0xe1'),'raw':!![]});}var _0x2d4436=[{'model':db[_0x4c28('0xcc')],'as':_0x4c28('0xe2'),'attributes':['id',_0x4c28('0xc6'),_0x4c28('0x46'),'to','cc',_0x4c28('0xe3'),_0x4c28('0xe4'),'createdAt'],'where':{'secret':![]},'order':qs[_0x4c28('0x40')]('id'),'include':_0x280b97}];return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x4373d8[_0x4c28('0xc7')]['id']},'include':_0x2d4436})[_0x4c28('0x1a')](handleEntityNotFound(_0x46543c,null))[_0x4c28('0x1a')](function(_0x4c048f){if(_0x4c048f&&_0x4c048f['Messages']){var _0x4d5592=_0x4c048f[_0x4c28('0xe5')]({'plain':!![]});fs['mkdirSync'](_0x57c125);return BPromise[_0x4c28('0xe6')](_0x4d5592[_0x4c28('0xe2')],function(_0x4cf392,_0x2a3bfc){var _0x4105a7={'from':_0x4cf392['from'],'to':_0x4cf392['to'],'subject':_0x4cf392[_0x4c28('0xe4')],'html':htmlEntities[_0x4c28('0xe7')](_0x4cf392[_0x4c28('0xc6')]),'headers':{'Date':moment(_0x4cf392['createdAt'])['format'](_0x4c28('0xe8'))},'attachments':[]};if(_0x4cf392['cc']){_0x4105a7[_0x4c28('0xe9')]['Cc']=_0x4cf392['cc'];}if(_0x4cf392[_0x4c28('0xe3')]){_0x4105a7[_0x4c28('0xe9')][_0x4c28('0xea')]=_0x4cf392[_0x4c28('0xe3')];}return new BPromise(function(_0x119068,_0xfca151){if(_0x4cf392[_0x4c28('0xe1')]){for(var _0x3afee7=0x0;_0x3afee7<_0x4cf392['Attachments'][_0x4c28('0x5b')];_0x3afee7++){var _0x3f9571=_0x4cf392[_0x4c28('0xe1')][_0x3afee7];var _0x388693=path[_0x4c28('0xdb')](_0x144d90,_0x3f9571['basename']);if(fs[_0x4c28('0xeb')](_0x388693)){_0x4105a7[_0x4c28('0xdf')][_0x4c28('0x25')]({'name':_0x3f9571[_0x4c28('0x1d')],'contentType':_0x3f9571[_0x4c28('0x34')],'data':fs[_0x4c28('0xec')](_0x388693)});}}}emlformat['build'](_0x4105a7,function(_0x46def7,_0x57c36b){if(_0x46def7)return _0xfca151(_0x46def7);fs['writeFileSync'](path[_0x4c28('0xdb')](_0x57c125,util[_0x4c28('0xce')](_0x4c28('0xed'),_0x2a3bfc)),_0x57c36b);return _0x119068(_0x57c36b);});});})['then'](function(){return new BPromise(function(_0x4f8519,_0x520026){zipdir(_0x57c125,{'saveTo':_0x1e2b1e},function(_0x4de081,_0xd44aea){if(_0x4de081)return _0x520026(_0x4de081);return _0x4f8519(_0xd44aea);});})[_0x4c28('0x1a')](function(){return new BPromise(function(_0x3c3b81,_0x264e39){rimraf(_0x57c125,function(_0x54639e){if(_0x54639e)_0x264e39(_0x54639e);return _0x3c3b81();});});})['then'](function(){return _0x46543c['download'](_0x1e2b1e,_0x1dbe52,function(_0x371eda){if(!_0x371eda)fs[_0x4c28('0xee')](_0x1e2b1e);});});});}else{return _0x46543c[_0x4c28('0xef')](0xc8);}})['catch'](handleError(_0x46543c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 686e372..62fa120 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 _0xb6d7=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x51c842,_0x2c47a8){var _0x3977a0=function(_0x521917){while(--_0x521917){_0x51c842['push'](_0x51c842['shift']());}};_0x3977a0(++_0x2c47a8);}(_0xb6d7,0x1dc));var _0x7b6d=function(_0x4b8826,_0x5f2a08){_0x4b8826=_0x4b8826-0x0;var _0x13f767=_0xb6d7[_0x4b8826];return _0x13f767;};'use strict';var EventEmitter=require(_0x7b6d('0x0'));var MailInteraction=require(_0x7b6d('0x1'))['db'][_0x7b6d('0x2')];var MailMessage=require(_0x7b6d('0x1'))['db'][_0x7b6d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7b6d('0x4')](0x0);var events={'afterCreate':_0x7b6d('0x5'),'afterUpdate':_0x7b6d('0x6'),'afterDestroy':_0x7b6d('0x7')};function emitEvent(_0x34b24c){return function(_0x24acd3,_0x68065d,_0x321da2){_0x24acd3[_0x7b6d('0x8')]({'attributes':['id'],'raw':!![]})[_0x7b6d('0x9')](function(_0x49354e){_0x24acd3['setDataValue'](_0x7b6d('0xa'),_0x49354e[_0x7b6d('0xb')](function(_0x5d64df){return{'id':_0x5d64df['id']};}));return MailMessage[_0x7b6d('0xc')]({'where':{'MailInteractionId':_0x24acd3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b6d('0x9')](function(_0x53c18b){_0x24acd3['setDataValue'](_0x7b6d('0xd'),_0x53c18b[_0x7b6d('0xe')]);MailInteractionEvents[_0x7b6d('0xf')](_0x34b24c+':'+_0x24acd3['id'],_0x24acd3);MailInteractionEvents[_0x7b6d('0xf')](_0x34b24c,_0x24acd3);_0x321da2(null);})['catch'](_0x321da2(null));};}for(var e in events){if(events[_0x7b6d('0x10')](e)){var event=events[e];MailInteraction[_0x7b6d('0x11')](e,emitEvent(event));}}module[_0x7b6d('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xfd41=['remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xfd41,0xb6));var _0x1fd4=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0xfd41[_0x38e177];return _0x1faf15;};'use strict';var EventEmitter=require(_0x1fd4('0x0'));var MailInteraction=require(_0x1fd4('0x1'))['db'][_0x1fd4('0x2')];var MailMessage=require(_0x1fd4('0x1'))['db'][_0x1fd4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1fd4('0x4'),'afterUpdate':'update','afterDestroy':_0x1fd4('0x5')};function emitEvent(_0x419c9f){return function(_0x51b225,_0x128b64,_0x2dda6b){_0x51b225[_0x1fd4('0x6')]({'attributes':['id'],'raw':!![]})[_0x1fd4('0x7')](function(_0xe7f15e){_0x51b225[_0x1fd4('0x8')](_0x1fd4('0x9'),_0xe7f15e[_0x1fd4('0xa')](function(_0x1f3acd){return{'id':_0x1f3acd['id']};}));return MailMessage[_0x1fd4('0xb')]({'where':{'MailInteractionId':_0x51b225['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fd4('0x7')](function(_0x1cf4bc){_0x51b225[_0x1fd4('0x8')]('unreadMessages',_0x1cf4bc[_0x1fd4('0xc')]);MailInteractionEvents[_0x1fd4('0xd')](_0x419c9f+':'+_0x51b225['id'],_0x51b225);MailInteractionEvents[_0x1fd4('0xd')](_0x419c9f,_0x51b225);_0x2dda6b(null);})['catch'](_0x2dda6b(null));};}for(var e in events){if(events[_0x1fd4('0xe')](e)){var event=events[e];MailInteraction[_0x1fd4('0xf')](e,emitEvent(event));}}module[_0x1fd4('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e3df958..bb9146e 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 _0x6319=['FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6319,0x12b));var _0x9631=function(_0x75e035,_0x55adf4){_0x75e035=_0x75e035-0x0;var _0x12b020=_0x6319[_0x75e035];return _0x12b020;};'use strict';var _=require(_0x9631('0x0'));var util=require(_0x9631('0x1'));var logger=require('../../config/logger')(_0x9631('0x2'));var moment=require(_0x9631('0x3'));var BPromise=require(_0x9631('0x4'));var rp=require(_0x9631('0x5'));var fs=require('fs');var path=require(_0x9631('0x6'));var rimraf=require(_0x9631('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x9631('0x8')]=function(_0x506dc7,_0x1d25e3){return _0x506dc7[_0x9631('0x9')](_0x9631('0xa'),attributes,{'tableName':_0x9631('0xb'),'paranoid':![],'indexes':[{'name':_0x9631('0xc'),'fields':['subject','to'],'type':_0x9631('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c5d92,_0x59ac54,_0x35b63b){if(_0x3c5d92[_0x9631('0xe')]){_0x3c5d92[_0x9631('0xf')]=moment()[_0x9631('0x10')](_0x9631('0x11'));}if(_0x3c5d92[_0x9631('0x12')]){_0x3c5d92[_0x9631('0x13')]=moment()[_0x9631('0x10')](_0x9631('0x11'));}_0x35b63b(null,_0x59ac54);},'beforeUpdate':function(_0x2309ce,_0x20e181,_0x2a7be4){if(_0x2309ce[_0x9631('0x14')](_0x9631('0xe'))){_0x2309ce[_0x9631('0xf')]=_0x2309ce[_0x9631('0xe')]?moment()[_0x9631('0x10')](_0x9631('0x11')):null;}if(_0x2309ce[_0x9631('0x14')]('closed')){_0x2309ce[_0x9631('0x13')]=moment()[_0x9631('0x10')](_0x9631('0x11'));_0x2309ce[_0x9631('0xe')]=null;_0x2309ce[_0x9631('0xf')]=null;}_0x2a7be4(null,_0x2309ce);},'afterUpdate':function(_0x5d5975,_0x91b31e,_0x1cf7f4){var _0x440f13=_0x506dc7['models'];var _0x4a81c5=_0x5d5975['get']({'plain':!![]});if(_0x4a81c5['closed']){return _0x440f13[_0x9631('0x15')][_0x9631('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4a81c5['id']}})[_0x9631('0x17')](function(){_0x1cf7f4();})['catch'](function(_0x4dba72){_0x1cf7f4(_0x4dba72);});}else{_0x1cf7f4();}}},'charset':_0x9631('0x18'),'collate':_0x9631('0x19')});}; \ No newline at end of file +var _0x339d=['path','rimraf','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0xbd069d,_0x1a46e9){var _0x3107aa=function(_0x23a81d){while(--_0x23a81d){_0xbd069d['push'](_0xbd069d['shift']());}};_0x3107aa(++_0x1a46e9);}(_0x339d,0x91));var _0xd339=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x339d[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xd339('0x0'));var util=require(_0xd339('0x1'));var logger=require(_0xd339('0x2'))('api');var moment=require(_0xd339('0x3'));var BPromise=require(_0xd339('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd339('0x5'));var rimraf=require(_0xd339('0x6'));var config=require('../../config/environment');var attributes=require(_0xd339('0x7'));module[_0xd339('0x8')]=function(_0x3c32b7,_0x2a9c69){return _0x3c32b7['define']('MailInteraction',attributes,{'tableName':_0xd339('0x9'),'paranoid':![],'indexes':[{'name':_0xd339('0xa'),'fields':[_0xd339('0xb'),'to'],'type':_0xd339('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f6257,_0x12574d,_0x350050){if(_0x4f6257['substatus']){_0x4f6257[_0xd339('0xd')]=moment()[_0xd339('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f6257[_0xd339('0xf')]){_0x4f6257[_0xd339('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x350050(null,_0x12574d);},'beforeUpdate':function(_0x1627d1,_0xf3f457,_0x54563a){if(_0x1627d1[_0xd339('0x11')]('substatus')){_0x1627d1['substatusAt']=_0x1627d1[_0xd339('0x12')]?moment()[_0xd339('0xe')](_0xd339('0x13')):null;}if(_0x1627d1['changed']('closed')){_0x1627d1['closedAt']=moment()[_0xd339('0xe')](_0xd339('0x13'));_0x1627d1[_0xd339('0x12')]=null;_0x1627d1[_0xd339('0xd')]=null;}_0x54563a(null,_0x1627d1);},'afterUpdate':function(_0x5c16e0,_0x241b96,_0x111ca7){var _0x525ece=_0x3c32b7[_0xd339('0x14')];var _0x309c1c=_0x5c16e0[_0xd339('0x15')]({'plain':!![]});if(_0x309c1c[_0xd339('0xf')]){return _0x525ece[_0xd339('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x309c1c['id']}})[_0xd339('0x17')](function(){_0x111ca7();})['catch'](function(_0x470f46){_0x111ca7(_0x470f46);});}else{_0x111ca7();}}},'charset':'utf8mb4','collate':_0xd339('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 618702d..51360d6 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 _0x1a54=['limit','AddTagsToMailInteraction','addTags','body','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','raw','options','where','attributes'];(function(_0x597716,_0x19f360){var _0x58bac5=function(_0x510ff3){while(--_0x510ff3){_0x597716['push'](_0x597716['shift']());}};_0x58bac5(++_0x19f360);}(_0x1a54,0x12e));var _0x41a5=function(_0x149c01,_0x5a74c2){_0x149c01=_0x149c01-0x0;var _0x18d57e=_0x1a54[_0x149c01];return _0x18d57e;};'use strict';var _=require(_0x41a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x41a5('0x1'));var rs=require(_0x41a5('0x2'));var fs=require('fs');var Redis=require(_0x41a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x41a5('0x4'));var logger=require(_0x41a5('0x5'))(_0x41a5('0x6'));var config=require(_0x41a5('0x7'));var jayson=require(_0x41a5('0x8'));var client=jayson['client'][_0x41a5('0x9')]({'port':0x232a});config[_0x41a5('0xa')]=_[_0x41a5('0xb')](config[_0x41a5('0xa')],{'host':_0x41a5('0xc'),'port':0x18eb});var socket=require(_0x41a5('0xd'))(new Redis(config[_0x41a5('0xa')]));require(_0x41a5('0xe'))[_0x41a5('0xf')](socket);function respondWithRpcPromise(_0x25ada3,_0x29eb80,_0x21e6fe){return new BPromise(function(_0xe08b7c,_0x1287a8){return client[_0x41a5('0x10')](_0x25ada3,_0x21e6fe)[_0x41a5('0x11')](function(_0x5e07c6){logger['info'](_0x41a5('0x12'),_0x29eb80,_0x41a5('0x13'));logger['debug'](_0x41a5('0x14'),_0x29eb80,_0x41a5('0x13'),JSON[_0x41a5('0x15')](_0x5e07c6));if(_0x5e07c6[_0x41a5('0x16')]){if(_0x5e07c6[_0x41a5('0x16')][_0x41a5('0x17')]===0x1f4){logger[_0x41a5('0x16')]('MailInteraction,\x20%s,\x20%s',_0x29eb80,_0x5e07c6['error']['message']);return _0x1287a8(_0x5e07c6[_0x41a5('0x16')][_0x41a5('0x18')]);}logger[_0x41a5('0x16')](_0x41a5('0x12'),_0x29eb80,_0x5e07c6[_0x41a5('0x16')][_0x41a5('0x18')]);return _0xe08b7c(_0x5e07c6[_0x41a5('0x16')][_0x41a5('0x18')]);}else{logger[_0x41a5('0x19')](_0x41a5('0x12'),_0x29eb80,_0x41a5('0x13'));_0xe08b7c(_0x5e07c6['result'][_0x41a5('0x18')]);}})[_0x41a5('0x1a')](function(_0x29ae41){logger[_0x41a5('0x16')](_0x41a5('0x12'),_0x29eb80,_0x29ae41);_0x1287a8(_0x29ae41);});});}exports[_0x41a5('0x1b')]=function(_0x4e4d63){var _0x39c369=this;return new Promise(function(_0x16f5ea,_0x1d042d){return db[_0x41a5('0x1c')][_0x41a5('0x1d')](_0x4e4d63['body'],{'raw':_0x4e4d63['options']?_0x4e4d63['options'][_0x41a5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e4d63[_0x41a5('0x1f')]?_0x4e4d63['options'][_0x41a5('0x20')]||null:null,'attributes':_0x4e4d63[_0x41a5('0x1f')]?_0x4e4d63[_0x41a5('0x1f')][_0x41a5('0x21')]||null:null,'limit':_0x4e4d63['options']?_0x4e4d63[_0x41a5('0x1f')][_0x41a5('0x22')]||null:null})[_0x41a5('0x11')](function(_0x14b105){logger[_0x41a5('0x19')](_0x41a5('0x1b'),_0x4e4d63);logger['debug'](_0x41a5('0x1b'),_0x4e4d63,JSON[_0x41a5('0x15')](_0x14b105));_0x16f5ea(_0x14b105);})[_0x41a5('0x1a')](function(_0x44db75){logger['error'](_0x41a5('0x1b'),_0x44db75[_0x41a5('0x18')],_0x4e4d63);_0x1d042d(_0x39c369['error'](0x1f4,_0x44db75[_0x41a5('0x18')]));});});};exports[_0x41a5('0x23')]=function(_0x1de411){return new Promise(function(_0x13cc1a,_0x42b8d9){return db[_0x41a5('0x1c')]['find']({'where':_0x1de411[_0x41a5('0x1f')]?_0x1de411[_0x41a5('0x1f')][_0x41a5('0x20')]||null:null})[_0x41a5('0x11')](function(_0x5c7db6){if(_0x5c7db6){return _0x5c7db6[_0x41a5('0x24')](_0x1de411[_0x41a5('0x25')][_0x41a5('0x26')],_[_0x41a5('0x27')](_0x1de411['body'],['ids','id'])||{});}})[_0x41a5('0x28')](function(_0x2de08c){logger[_0x41a5('0x19')](_0x41a5('0x29'),_0x1de411);logger['debug']('AddTags',_0x1de411,JSON[_0x41a5('0x15')](_0x2de08c));_0x13cc1a(_0x2de08c);})[_0x41a5('0x1a')](function(_0x15f8d7){logger[_0x41a5('0x16')](_0x41a5('0x29'),_0x15f8d7[_0x41a5('0x18')],_0x1de411);_0x42b8d9(_this['error'](0x1f4,_0x15f8d7[_0x41a5('0x18')]));});});}; \ No newline at end of file +var _0x99e8=['options','attributes','limit','AddTagsToMailInteraction','find','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','raw'];(function(_0x5eded0,_0x369a44){var _0xb62cc3=function(_0x4fff35){while(--_0x4fff35){_0x5eded0['push'](_0x5eded0['shift']());}};_0xb62cc3(++_0x369a44);}(_0x99e8,0x148));var _0x899e=function(_0x76b420,_0x349df4){_0x76b420=_0x76b420-0x0;var _0x202cf1=_0x99e8[_0x76b420];return _0x202cf1;};'use strict';var _=require('lodash');var util=require(_0x899e('0x0'));var moment=require('moment');var BPromise=require(_0x899e('0x1'));var rs=require(_0x899e('0x2'));var fs=require('fs');var Redis=require(_0x899e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x899e('0x4'));var logger=require(_0x899e('0x5'))(_0x899e('0x6'));var config=require(_0x899e('0x7'));var jayson=require(_0x899e('0x8'));var client=jayson[_0x899e('0x9')][_0x899e('0xa')]({'port':0x232a});config[_0x899e('0xb')]=_[_0x899e('0xc')](config[_0x899e('0xb')],{'host':_0x899e('0xd'),'port':0x18eb});var socket=require(_0x899e('0xe'))(new Redis(config[_0x899e('0xb')]));require(_0x899e('0xf'))['register'](socket);function respondWithRpcPromise(_0x50b17c,_0x3d9c8a,_0x799552){return new BPromise(function(_0xc62d2e,_0x14c0c0){return client[_0x899e('0x10')](_0x50b17c,_0x799552)[_0x899e('0x11')](function(_0x206476){logger[_0x899e('0x12')](_0x899e('0x13'),_0x3d9c8a,_0x899e('0x14'));logger[_0x899e('0x15')](_0x899e('0x16'),_0x3d9c8a,_0x899e('0x14'),JSON[_0x899e('0x17')](_0x206476));if(_0x206476[_0x899e('0x18')]){if(_0x206476[_0x899e('0x18')]['code']===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3d9c8a,_0x206476[_0x899e('0x18')][_0x899e('0x19')]);return _0x14c0c0(_0x206476[_0x899e('0x18')][_0x899e('0x19')]);}logger[_0x899e('0x18')](_0x899e('0x13'),_0x3d9c8a,_0x206476[_0x899e('0x18')][_0x899e('0x19')]);return _0xc62d2e(_0x206476[_0x899e('0x18')][_0x899e('0x19')]);}else{logger['info'](_0x899e('0x13'),_0x3d9c8a,'request\x20sent');_0xc62d2e(_0x206476['result'][_0x899e('0x19')]);}})[_0x899e('0x1a')](function(_0x3c0cb1){logger['error'](_0x899e('0x13'),_0x3d9c8a,_0x3c0cb1);_0x14c0c0(_0x3c0cb1);});});}exports[_0x899e('0x1b')]=function(_0x459755){var _0x31fc23=this;return new Promise(function(_0x1416df,_0x287ac7){return db[_0x899e('0x1c')][_0x899e('0x1d')](_0x459755[_0x899e('0x1e')],{'raw':_0x459755['options']?_0x459755['options'][_0x899e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459755[_0x899e('0x20')]?_0x459755[_0x899e('0x20')]['where']||null:null,'attributes':_0x459755[_0x899e('0x20')]?_0x459755[_0x899e('0x20')][_0x899e('0x21')]||null:null,'limit':_0x459755[_0x899e('0x20')]?_0x459755['options'][_0x899e('0x22')]||null:null})['then'](function(_0xc55e36){logger[_0x899e('0x12')]('UpdateMailInteraction',_0x459755);logger[_0x899e('0x15')](_0x899e('0x1b'),_0x459755,JSON['stringify'](_0xc55e36));_0x1416df(_0xc55e36);})[_0x899e('0x1a')](function(_0x446909){logger[_0x899e('0x18')]('UpdateMailInteraction',_0x446909[_0x899e('0x19')],_0x459755);_0x287ac7(_0x31fc23['error'](0x1f4,_0x446909[_0x899e('0x19')]));});});};exports[_0x899e('0x23')]=function(_0x39ddae){return new Promise(function(_0x305e72,_0x47100e){return db[_0x899e('0x1c')][_0x899e('0x24')]({'where':_0x39ddae[_0x899e('0x20')]?_0x39ddae[_0x899e('0x20')]['where']||null:null})[_0x899e('0x11')](function(_0x2c4170){if(_0x2c4170){return _0x2c4170['addTags'](_0x39ddae[_0x899e('0x1e')][_0x899e('0x25')],_['omit'](_0x39ddae[_0x899e('0x1e')],['ids','id'])||{});}})[_0x899e('0x26')](function(_0x117c07){logger['info'](_0x899e('0x27'),_0x39ddae);logger['debug'](_0x899e('0x27'),_0x39ddae,JSON[_0x899e('0x17')](_0x117c07));_0x305e72(_0x117c07);})['catch'](function(_0xa6d773){logger[_0x899e('0x18')](_0x899e('0x27'),_0xa6d773['message'],_0x39ddae);_0x47100e(_this['error'](0x1f4,_0xa6d773[_0x899e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b58dcd2..427be28 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 _0x7d04=['save','remove','emit','removeListener','./mailInteraction.events'];(function(_0x1ad135,_0xd066b3){var _0x4c5639=function(_0x11dd21){while(--_0x11dd21){_0x1ad135['push'](_0x1ad135['shift']());}};_0x4c5639(++_0xd066b3);}(_0x7d04,0x1c6));var _0x47d0=function(_0x5b769b,_0x4343c2){_0x5b769b=_0x5b769b-0x0;var _0x10b4aa=_0x7d04[_0x5b769b];return _0x10b4aa;};'use strict';var MailInteractionEvents=require(_0x47d0('0x0'));var events=[_0x47d0('0x1'),_0x47d0('0x2'),'update'];function createListener(_0x31b506,_0x235b9d){return function(_0x40ee35){_0x235b9d[_0x47d0('0x3')](_0x31b506,_0x40ee35);};}function removeListener(_0x1dd5da,_0x1ffed8){return function(){MailInteractionEvents[_0x47d0('0x4')](_0x1dd5da,_0x1ffed8);};}exports['register']=function(_0xd330f4){for(var _0x4bcbba=0x0,_0x2bd70c=events['length'];_0x4bcbba<_0x2bd70c;_0x4bcbba++){var _0x23f947=events[_0x4bcbba];var _0x12652a=createListener('mailInteraction:'+_0x23f947,_0xd330f4);MailInteractionEvents['on'](_0x23f947,_0x12652a);}}; \ No newline at end of file +var _0xbe2b=['./mailInteraction.events','save','update','removeListener','register'];(function(_0x39e5a8,_0x367273){var _0x5c9feb=function(_0x5a372e){while(--_0x5a372e){_0x39e5a8['push'](_0x39e5a8['shift']());}};_0x5c9feb(++_0x367273);}(_0xbe2b,0xe1));var _0xbbe2=function(_0x940dd1,_0x121111){_0x940dd1=_0x940dd1-0x0;var _0x57e7ce=_0xbe2b[_0x940dd1];return _0x57e7ce;};'use strict';var MailInteractionEvents=require(_0xbbe2('0x0'));var events=[_0xbbe2('0x1'),'remove',_0xbbe2('0x2')];function createListener(_0x1c76ec,_0x49d8f2){return function(_0x2ba5aa){_0x49d8f2['emit'](_0x1c76ec,_0x2ba5aa);};}function removeListener(_0x1be9e4,_0x49385a){return function(){MailInteractionEvents[_0xbbe2('0x3')](_0x1be9e4,_0x49385a);};}exports[_0xbbe2('0x4')]=function(_0x4376d3){for(var _0x2aebb8=0x0,_0x40b7f0=events['length'];_0x2aebb8<_0x40b7f0;_0x2aebb8++){var _0x53c768=events[_0x2aebb8];var _0x347313=createListener('mailInteraction:'+_0x53c768,_0x4376d3);MailInteractionEvents['on'](_0x53c768,_0x347313);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 58e07fe..cc0494f 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 _0xa5fa=['accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','mailmessage:create','create','put'];(function(_0x498ce3,_0x5cbd71){var _0x150f24=function(_0xd6bd00){while(--_0xd6bd00){_0x498ce3['push'](_0x498ce3['shift']());}};_0x150f24(++_0x5cbd71);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0xa5fa[_0x17dcd1];return _0x12af77;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xaa5f('0x10')]('mail',_0xaa5f('0x11')),controller[_0xaa5f('0x12')]);router[_0xaa5f('0x13')](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller['update']);router[_0xaa5f('0x13')]('/:id/accept',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);router[_0xaa5f('0x13')](_0xaa5f('0x15'),auth[_0xaa5f('0x9')](),controller['reject']);router['delete'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x16')]);module[_0xaa5f('0x17')]=router; \ No newline at end of file +var _0xc882=['show','download','post','tracked','mail','create','put','update','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xc882,0xff));var _0x2c88=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc882[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var path=require(_0x2c88('0x2'));var timeout=require(_0x2c88('0x3'));var express=require(_0x2c88('0x4'));var router=express[_0x2c88('0x5')]();var fs_extra=require(_0x2c88('0x6'));var auth=require(_0x2c88('0x7'));var interaction=require(_0x2c88('0x8'));var config=require(_0x2c88('0x9'));var controller=require(_0x2c88('0xa'));router[_0x2c88('0xb')]('/',auth[_0x2c88('0xc')](),controller[_0x2c88('0xd')]);router[_0x2c88('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2c88('0xb')](_0x2c88('0xe'),auth['isAuthenticated'](),controller[_0x2c88('0xf')]);router[_0x2c88('0xb')]('/:id/download',auth[_0x2c88('0xc')](),controller[_0x2c88('0x10')]);router[_0x2c88('0x11')]('/',auth['isAuthenticated'](),interaction[_0x2c88('0x12')](_0x2c88('0x13'),'mailmessage:create'),controller[_0x2c88('0x14')]);router[_0x2c88('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2c88('0x16')]);router[_0x2c88('0x15')](_0x2c88('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x2c88('0x15')]('/:id/reject',auth[_0x2c88('0xc')](),controller[_0x2c88('0x18')]);router[_0x2c88('0x19')](_0x2c88('0xe'),auth[_0x2c88('0xc')](),controller[_0x2c88('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2ae698d..9c99cff 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 _0xf77e=['STRING','long','DATE','INTEGER','Email','Chat','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x49fb35,_0x121edc){var _0xd05ed7=function(_0x593b7d){while(--_0x593b7d){_0x49fb35['push'](_0x49fb35['shift']());}};_0xd05ed7(++_0x121edc);}(_0xf77e,0x7e));var _0xef77=function(_0x4990ba,_0x106217){_0x4990ba=_0x4990ba-0x0;var _0x4dd83f=_0xf77e[_0x4990ba];return _0x4dd83f;};'use strict';var Sequelize=require(_0xef77('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xef77('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xef77('0x1')](_0xef77('0x2'))},'read':{'type':Sequelize[_0xef77('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xef77('0x4')]('in',_0xef77('0x5')),'defaultValue':_0xef77('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xef77('0x6')](0x1fe)},'from':{'type':Sequelize[_0xef77('0x6')]},'to':{'type':Sequelize[_0xef77('0x1')](_0xef77('0x7'))},'cc':{'type':Sequelize[_0xef77('0x1')]('long')},'bcc':{'type':Sequelize[_0xef77('0x1')](_0xef77('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xef77('0x8')]},'attach':{'type':Sequelize[_0xef77('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xef77('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xef77('0x8')]},'originTo':{'type':Sequelize[_0xef77('0x1')](_0xef77('0x7'))},'originCc':{'type':Sequelize[_0xef77('0x1')]('long')},'originChannel':{'type':Sequelize[_0xef77('0x4')](_0xef77('0xa'),_0xef77('0xb')),'defaultValue':_0xef77('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xf0b0=['ENUM','Email','Chat','lodash','exports','TEXT','BOOLEAN','out','STRING','long'];(function(_0x58701f,_0x16037c){var _0x11ec45=function(_0x5143a5){while(--_0x5143a5){_0x58701f['push'](_0x58701f['shift']());}};_0x11ec45(++_0x16037c);}(_0xf0b0,0x143));var _0x0f0b=function(_0x26121b,_0x1247ca){_0x26121b=_0x26121b-0x0;var _0x3407d3=_0xf0b0[_0x26121b];return _0x3407d3;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0f0b('0x0'));module[_0x0f0b('0x1')]={'body':{'type':Sequelize[_0x0f0b('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0f0b('0x2')]('medium')},'read':{'type':Sequelize[_0x0f0b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0f0b('0x4')),'defaultValue':_0x0f0b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0f0b('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'cc':{'type':Sequelize['TEXT'](_0x0f0b('0x6'))},'bcc':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'subject':{'type':Sequelize[_0x0f0b('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x0f0b('0x7')](_0x0f0b('0x8'),_0x0f0b('0x9')),'defaultValue':_0x0f0b('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f2bada9..4ee54ff 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 _0xd031=['fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','fullname','SIP/%s','motionChannel','rejectmessage','download','unix','join','root','server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','mail-interactions','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','update','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','server/files/attachments','basename','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','read','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','event'];(function(_0x423962,_0x51f067){var _0x562972=function(_0xf63b9f){while(--_0xf63b9f){_0x423962['push'](_0x423962['shift']());}};_0x562972(++_0x51f067);}(_0xd031,0x15a));var _0x1d03=function(_0x13cd7f,_0x140225){_0x13cd7f=_0x13cd7f-0x0;var _0xb78b69=_0xd031[_0x13cd7f];return _0xb78b69;};'use strict';var emlformat=require(_0x1d03('0x0'));var moment=require(_0x1d03('0x1'));var BPromise=require(_0x1d03('0x2'));var util=require(_0x1d03('0x3'));var path=require(_0x1d03('0x4'));var fs=require('fs');var _=require(_0x1d03('0x5'));var Redis=require(_0x1d03('0x6'));var htmlToText=require('html-to-text');var qs=require(_0x1d03('0x7'));var logger=require('../../config/logger')(_0x1d03('0x8'));var interaction_log=require('../../config/logger')(_0x1d03('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1d03('0xa')]=_[_0x1d03('0xb')](config[_0x1d03('0xa')],{'host':_0x1d03('0xc'),'port':0x18eb});var socket=require(_0x1d03('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x1d03('0xe'));require('./mailMessage.socket')[_0x1d03('0xf')](socket);var jayson=require(_0x1d03('0x10'));var client=jayson[_0x1d03('0x11')][_0x1d03('0x12')]({'port':0x232c});var client9003=jayson[_0x1d03('0x11')][_0x1d03('0x12')]({'port':0x232b});var client9002=jayson[_0x1d03('0x11')][_0x1d03('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xdbcc7a,_0x610e87,_0x3f3211,_0x3ac143){return new BPromise(function(_0x12f27f,_0x5ee416){var _0x4a6055=_0x3ac143||client;return _0x4a6055[_0x1d03('0x13')](_0xdbcc7a,_0x3f3211)[_0x1d03('0x14')](function(_0x3ab8af){logger[_0x1d03('0x15')](_0x1d03('0x16'),_0x610e87,_0x1d03('0x17'));logger[_0x1d03('0x18')](_0x1d03('0x19'),_0x610e87,'request\x20sent',JSON['stringify'](_0x3ab8af));if(_0x3ab8af[_0x1d03('0x1a')]){if(_0x3ab8af['error'][_0x1d03('0x1b')]===0x1f4){logger[_0x1d03('0x1a')](_0x1d03('0x16'),_0x610e87,_0x3ab8af[_0x1d03('0x1a')]['message']);return _0x5ee416(_0x3ab8af['error'][_0x1d03('0x1c')]);}logger[_0x1d03('0x1a')](_0x1d03('0x16'),_0x610e87,_0x3ab8af[_0x1d03('0x1a')]['message']);return _0x12f27f(_0x3ab8af[_0x1d03('0x1a')][_0x1d03('0x1c')]);}else{logger[_0x1d03('0x15')](_0x1d03('0x16'),_0x610e87,_0x1d03('0x17'));_0x12f27f(_0x3ab8af[_0x1d03('0x1d')][_0x1d03('0x1c')]);}})[_0x1d03('0x1e')](function(_0x4ac111){logger[_0x1d03('0x1a')](_0x1d03('0x16'),_0x610e87,_0x4ac111);_0x5ee416(_0x4ac111);});});}function respondWithResult(_0x16991c,_0x43e5dc){_0x43e5dc=_0x43e5dc||0xc8;return function(_0x57b191){if(_0x57b191){return _0x16991c[_0x1d03('0x1f')](_0x43e5dc)['json'](_0x57b191);}};}function respondWithFilteredResult(_0x38605b,_0x2d112c){return function(_0x514e91){if(_0x514e91){var _0x5856ab=typeof _0x2d112c[_0x1d03('0x20')]===_0x1d03('0x21')&&typeof _0x2d112c[_0x1d03('0x22')]==='undefined';var _0x3fe346=_0x514e91['count'];var _0x373e33=_0x5856ab?0x0:_0x2d112c[_0x1d03('0x20')];var _0x5b9d9b=_0x5856ab?_0x514e91[_0x1d03('0x23')]:_0x2d112c[_0x1d03('0x20')]+_0x2d112c[_0x1d03('0x22')];var _0x273c2b;if(_0x5b9d9b>=_0x3fe346){_0x5b9d9b=_0x3fe346;_0x273c2b=0xc8;}else{_0x273c2b=0xce;}_0x38605b['status'](_0x273c2b);return _0x38605b['set']('Content-Range',_0x373e33+'-'+_0x5b9d9b+'/'+_0x3fe346)['json'](_0x514e91);}return null;};}function saveUpdates(_0x381daf){return function(_0x551e32){if(_0x551e32){return _0x551e32[_0x1d03('0x24')](_0x381daf)[_0x1d03('0x14')](function(_0x447d46){return _0x447d46;});}return null;};}function removeEntity(_0x1b8b90){return function(_0x2ac7b1){if(_0x2ac7b1){return _0x2ac7b1[_0x1d03('0x25')]()['then'](function(){_0x1b8b90[_0x1d03('0x1f')](0xcc)[_0x1d03('0x26')]();});}};}function handleEntityNotFound(_0x12a3cf){return function(_0x5b25ae){if(!_0x5b25ae){_0x12a3cf[_0x1d03('0x27')](0x194);}return _0x5b25ae;};}function handleError(_0x3641a0,_0x4c8d03){_0x4c8d03=_0x4c8d03||0x1f4;return function(_0x5e6c28){logger[_0x1d03('0x1a')](_0x5e6c28['stack']);if(_0x5e6c28[_0x1d03('0x28')]){delete _0x5e6c28[_0x1d03('0x28')];}_0x3641a0[_0x1d03('0x1f')](_0x4c8d03)[_0x1d03('0x29')](_0x5e6c28);};}exports[_0x1d03('0x2a')]=function(_0x51c62a,_0x3076db){var _0x459cbd={},_0x4aeedc={},_0x3119ee={'count':0x0,'rows':[]};var _0x1bac76=_[_0x1d03('0x2b')](db[_0x1d03('0x2c')][_0x1d03('0x2d')],function(_0x598462){return{'name':_0x598462[_0x1d03('0x2e')],'type':_0x598462[_0x1d03('0x2f')]['key']};});_0x4aeedc['model']=_[_0x1d03('0x2b')](_0x1bac76,_0x1d03('0x28'));_0x4aeedc['query']=_[_0x1d03('0x30')](_0x51c62a[_0x1d03('0x31')]);_0x4aeedc['filters']=_[_0x1d03('0x32')](_0x4aeedc['model'],_0x4aeedc[_0x1d03('0x31')]);_0x459cbd[_0x1d03('0x33')]=_[_0x1d03('0x32')](_0x4aeedc[_0x1d03('0x34')],qs[_0x1d03('0x35')](_0x51c62a[_0x1d03('0x31')][_0x1d03('0x35')]));_0x459cbd['attributes']=_0x459cbd[_0x1d03('0x33')][_0x1d03('0x36')]?_0x459cbd[_0x1d03('0x33')]:_0x4aeedc[_0x1d03('0x34')];if(!_0x51c62a[_0x1d03('0x31')]['hasOwnProperty'](_0x1d03('0x37'))){_0x459cbd[_0x1d03('0x22')]=qs[_0x1d03('0x22')](_0x51c62a[_0x1d03('0x31')]['limit']);_0x459cbd[_0x1d03('0x20')]=qs['offset'](_0x51c62a['query'][_0x1d03('0x20')]);}_0x459cbd[_0x1d03('0x38')]=qs[_0x1d03('0x39')](_0x51c62a[_0x1d03('0x31')]['sort']);_0x459cbd[_0x1d03('0x3a')]=qs[_0x1d03('0x3b')](_[_0x1d03('0x3c')](_0x51c62a[_0x1d03('0x31')],_0x4aeedc['filters']),_0x1bac76);if(_0x51c62a[_0x1d03('0x31')][_0x1d03('0x3d')]){_0x459cbd[_0x1d03('0x3a')]=_['merge'](_0x459cbd[_0x1d03('0x3a')],{'$or':_['map'](_0x1bac76,function(_0x570074){if(_0x570074[_0x1d03('0x2f')]!=='VIRTUAL'){var _0x17d6d8={};_0x17d6d8[_0x570074['name']]={'$like':'%'+_0x51c62a['query'][_0x1d03('0x3d')]+'%'};return _0x17d6d8;}})});}_0x459cbd=_[_0x1d03('0x3e')]({},_0x459cbd,_0x51c62a[_0x1d03('0x3f')]);var _0x32b39d={'where':_0x459cbd['where']};return db['MailMessage'][_0x1d03('0x23')](_0x32b39d)['then'](function(_0x24bdcd){_0x3119ee[_0x1d03('0x23')]=_0x24bdcd;if(_0x51c62a[_0x1d03('0x31')][_0x1d03('0x40')]){_0x459cbd[_0x1d03('0x41')]=[{'all':!![]}];}return db[_0x1d03('0x2c')][_0x1d03('0x42')](_0x459cbd);})[_0x1d03('0x14')](function(_0x4f6c43){_0x3119ee[_0x1d03('0x43')]=_0x4f6c43;return _0x3119ee;})['then'](respondWithFilteredResult(_0x3076db,_0x459cbd))[_0x1d03('0x1e')](handleError(_0x3076db,null));};exports[_0x1d03('0x44')]=function(_0x334a36,_0x5cddd0){var _0x5732e3={'raw':!![],'where':{'id':_0x334a36[_0x1d03('0x45')]['id']}},_0x50ce1c={};_0x50ce1c['model']=_['keys'](db['MailMessage'][_0x1d03('0x2d')]);_0x50ce1c['query']=_[_0x1d03('0x30')](_0x334a36['query']);_0x50ce1c[_0x1d03('0x3b')]=_[_0x1d03('0x32')](_0x50ce1c[_0x1d03('0x34')],_0x50ce1c[_0x1d03('0x31')]);_0x5732e3['attributes']=_[_0x1d03('0x32')](_0x50ce1c[_0x1d03('0x34')],qs[_0x1d03('0x35')](_0x334a36['query'][_0x1d03('0x35')]));_0x5732e3[_0x1d03('0x33')]=_0x5732e3['attributes'][_0x1d03('0x36')]?_0x5732e3[_0x1d03('0x33')]:_0x50ce1c[_0x1d03('0x34')];if(_0x334a36[_0x1d03('0x31')][_0x1d03('0x40')]){_0x5732e3[_0x1d03('0x41')]=[{'all':!![]}];}_0x5732e3=_[_0x1d03('0x3e')]({},_0x5732e3,_0x334a36[_0x1d03('0x3f')]);return db[_0x1d03('0x2c')][_0x1d03('0x46')](_0x5732e3)[_0x1d03('0x14')](handleEntityNotFound(_0x5cddd0,null))[_0x1d03('0x14')](respondWithResult(_0x5cddd0,null))[_0x1d03('0x1e')](handleError(_0x5cddd0,null));};exports[_0x1d03('0x24')]=function(_0xec3eb8,_0x324d48){if(_0xec3eb8[_0x1d03('0x47')]['id']){delete _0xec3eb8[_0x1d03('0x47')]['id'];}return db[_0x1d03('0x2c')][_0x1d03('0x46')]({'where':{'id':_0xec3eb8[_0x1d03('0x45')]['id']}})[_0x1d03('0x14')](handleEntityNotFound(_0x324d48,null))[_0x1d03('0x14')](saveUpdates(_0xec3eb8['body'],null))[_0x1d03('0x14')](respondWithResult(_0x324d48,null))[_0x1d03('0x1e')](handleError(_0x324d48,null));};exports['destroy']=function(_0x1fffec,_0x38751d){return db[_0x1d03('0x2c')][_0x1d03('0x46')]({'where':{'id':_0x1fffec[_0x1d03('0x45')]['id']}})['then'](handleEntityNotFound(_0x38751d,null))[_0x1d03('0x14')](removeEntity(_0x38751d,null))[_0x1d03('0x1e')](handleError(_0x38751d,null));};exports[_0x1d03('0x48')]=function(_0x1d4962,_0x1146e3){return db['MailMessage'][_0x1d03('0x48')]()[_0x1d03('0x14')](respondWithResult(_0x1146e3,null))['catch'](handleError(_0x1146e3,null));};exports[_0x1d03('0x49')]=function(_0x245d89,_0x28120f){return db['MailMessage'][_0x1d03('0x49')](_0x245d89['body'])['then'](function(_0x38fdab){if(_0x38fdab){if(_0x38fdab[_0x1d03('0x4a')]==='out'&&!_0x38fdab['secret']){var _0x11671f,_0x48795c,_0x1d8c08;if(_0x245d89[_0x1d03('0x47')]['to']){_0x48795c=_0x245d89[_0x1d03('0x47')]['to'][_0x1d03('0x4b')](',')[0x0];}return db[_0x1d03('0x4c')][_0x1d03('0x4d')]({'where':{'id':_0x38fdab[_0x1d03('0x4e')]},'include':[{'model':db['CmList'],'as':_0x1d03('0x4f'),'include':[{'model':db[_0x1d03('0x50')],'as':_0x1d03('0x51'),'where':{'email':_0x48795c},'limit':0x1,'order':[[_0x1d03('0x52'),_0x1d03('0x53')]]}]},{'model':db[_0x1d03('0x54')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1d03('0x55'),'raw':!![]}]}]})[_0x1d03('0x14')](function(_0x5f1ef6){_0x11671f=_0x5f1ef6;if(!_0x11671f||!_0x11671f[_0x1d03('0x56')])return;var _0x31fcad=_0x11671f[_0x1d03('0x57')]();if(_0x245d89['body']['attachments']&&_0x245d89[_0x1d03('0x47')]['attachments']['length']){for(var _0x483baa=0x0;_0x483baa<_0x245d89[_0x1d03('0x47')][_0x1d03('0x58')]['length'];_0x483baa+=0x1){_0x245d89[_0x1d03('0x47')]['attachments'][_0x483baa]={'filename':_0x245d89[_0x1d03('0x47')][_0x1d03('0x58')][_0x483baa][_0x1d03('0x28')],'path':path['join'](config['root'],_0x1d03('0x59'),_0x245d89['body'][_0x1d03('0x58')][_0x483baa][_0x1d03('0x5a')])};}}_0x1d8c08={'account':_0x31fcad,'message':_0x245d89['body']};return;})['then'](function(){if(_0x11671f[_0x1d03('0x4f')]){if(_0x11671f[_0x1d03('0x4f')][_0x1d03('0x51')][_0x1d03('0x36')]){return _0x11671f['List'][_0x1d03('0x51')][0x0];}else{return db[_0x1d03('0x50')]['create'](_[_0x1d03('0xb')](_0x245d89[_0x1d03('0x47')],{'firstName':_0x245d89[_0x1d03('0x47')]['to'],'email':_0x245d89[_0x1d03('0x47')]['to'],'phone':_0x245d89['body']['to'],'ListId':_0x11671f[_0x1d03('0x5b')]}));}}else{throw new Error(_0x1d03('0x5c'));}})[_0x1d03('0x14')](function(){if(_0x1d8c08){return respondWithRpcPromise('SendMail','sendMail',_0x1d8c08,client9003)[_0x1d03('0x14')](function(_0x7d9caf){return _0x38fdab[_0x1d03('0x24')]({'read':!![],'messageId':_0x7d9caf[_0x1d03('0x5d')],'sentAt':moment()[_0x1d03('0x5e')](_0x1d03('0x5f'))});})['catch'](function(_0x207fbc){logger[_0x1d03('0x1a')]('%s',JSON[_0x1d03('0x60')](_0x207fbc));return _0x38fdab;});}return _0x38fdab;});}return _0x38fdab;}})[_0x1d03('0x14')](respondWithResult(_0x28120f,0xc9))[_0x1d03('0x1e')](handleError(_0x28120f,null));};exports[_0x1d03('0x61')]=function(_0x4dd7b0,_0x259216){var _0x1e2319={'agent':{},'channel':'mail'};if(_0x4dd7b0[_0x1d03('0x47')]['id']){delete _0x4dd7b0[_0x1d03('0x47')]['id'];}_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x62')]=!![];_0x4dd7b0[_0x1d03('0x47')]['readAt']=moment()[_0x1d03('0x5e')](_0x1d03('0x5f'));_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x63')]=_0x4dd7b0[_0x1d03('0x47')]['UserId']||_0x4dd7b0[_0x1d03('0x64')]['id'];_0x1e2319[_0x1d03('0x65')]['id']=_0x4dd7b0[_0x1d03('0x47')]['UserId'];return db[_0x1d03('0x2c')][_0x1d03('0x46')]({'where':{'id':_0x4dd7b0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x259216,null))[_0x1d03('0x14')](saveUpdates(_0x4dd7b0[_0x1d03('0x47')],null))[_0x1d03('0x14')](function(_0x1e0ed3){if(_0x1e0ed3){_0x1e2319[_0x1d03('0x1c')]=_0x1e0ed3[_0x1d03('0x66')]({'plain':!![]});return db[_0x1d03('0x67')][_0x1d03('0x46')]({'where':{'id':_0x1e0ed3[_0x1d03('0x68')]}});}return null;})[_0x1d03('0x14')](handleEntityNotFound(_0x259216,null))[_0x1d03('0x14')](function(_0x11570e){if(_0x11570e){return _0x11570e[_0x1d03('0x24')]({'UserId':_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x63')],'read1stAt':_['isNil'](_0x11570e[_0x1d03('0x69')])?moment()['format'](_0x1d03('0x5f')):undefined});}return null;})[_0x1d03('0x14')](function(_0x49d982){if(_0x49d982){_0x1e2319[_0x1d03('0x6a')]=_0x49d982[_0x1d03('0x66')]({'plain':!![]});interaction_log[_0x1d03('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dd7b0[_0x1d03('0x64')]['id'],_0x4dd7b0[_0x1d03('0x64')][_0x1d03('0x28')],_0x4dd7b0[_0x1d03('0x64')]['role'],_0x1e2319[_0x1d03('0x6a')]['id'],_0x4dd7b0['body']?JSON[_0x1d03('0x60')](_0x4dd7b0[_0x1d03('0x47')]):_0x1d03('0x6b'));return respondWithRpcPromise(_0x1d03('0x6c'),_0x1d03('0x6d'),_0x1e2319);}return null;})['then'](function(_0x513dc3){var _0x147dd9=_0x1d03('0x6e')+_0x513dc3['message']['ContactId'];return db['sequelize'][_0x1d03('0x31')](_0x147dd9,{'type':db[_0x1d03('0x6f')][_0x1d03('0x70')][_0x1d03('0x71')],'raw':!![]})['then'](function(_0x12710c){return _0x12710c;});})[_0x1d03('0x14')](function(_0x4c2572){if(_0x4c2572){_0x1e2319[_0x1d03('0x1c')][_0x1d03('0x72')]=_0x4c2572[0x0];if(!_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x63')])return;return db[_0x1d03('0x73')][_0x1d03('0x46')]({'where':{'id':_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x63')],'role':_0x1d03('0x65')},'attributes':['id',_0x1d03('0x28'),'fullname',_0x1d03('0x74'),_0x1d03('0x75')],'raw':!![]});}return null;})[_0x1d03('0x14')](function(_0x3645db){if(!_0x3645db)return null;_0x1e2319[_0x1d03('0x1c')]['agent']=_0x3645db;return _0x1e2319;})['then'](function(_0x43e430){if(_0x43e430){if(_0x4dd7b0[_0x1d03('0x47')][_0x1d03('0x76')]){_0x1e2319[_0x1d03('0x1c')][_0x1d03('0x77')]=util['format']('SIP/%s',_0x4dd7b0['user']['name']);_0x1e2319[_0x1d03('0x1c')][_0x1d03('0x78')]=_0x1e2319[_0x1d03('0x78')];_0x1e2319[_0x1d03('0x1c')]['motionChannel']=_0x1e2319[_0x1d03('0x78')];_0x1e2319[_0x1d03('0x1c')][_0x1d03('0x79')]=_0x1d03('0x61');_0x1e2319['message'][_0x1d03('0x47')]=htmlToText[_0x1d03('0x7a')](_0x1e2319[_0x1d03('0x1c')]['body']);return respondWithRpcPromise(_0x1d03('0x7b'),_0x1d03('0x7b'),{'event':_0x1d03('0x7c'),'message':_0x1e2319['message']},client9002)[_0x1d03('0x14')](function(){return _0x1e2319;});}return _0x1e2319;}return null;})[_0x1d03('0x14')](respondWithResult(_0x259216,null))[_0x1d03('0x1e')](handleError(_0x259216,null));};exports[_0x1d03('0x7d')]=function(_0x5af103,_0x221d7e){var _0x1c600b={'agent':{},'channel':_0x1d03('0x7e')};if(_0x5af103[_0x1d03('0x47')]['id']){delete _0x5af103['body']['id'];}_0x5af103[_0x1d03('0x47')][_0x1d03('0x63')]=_0x5af103[_0x1d03('0x47')][_0x1d03('0x63')]||_0x5af103[_0x1d03('0x64')]['id'];_0x1c600b[_0x1d03('0x65')]['id']=_0x5af103[_0x1d03('0x47')][_0x1d03('0x63')];return db[_0x1d03('0x2c')][_0x1d03('0x46')]({'where':{'id':_0x5af103[_0x1d03('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x221d7e,null))[_0x1d03('0x14')](function(_0x2911d3){if(_0x2911d3){_0x1c600b[_0x1d03('0x1c')]=_0x2911d3['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x2911d3['MailInteractionId']}});}return null;})[_0x1d03('0x14')](handleEntityNotFound(_0x221d7e,null))['then'](function(_0x1a1582){if(_0x1a1582){_0x1c600b[_0x1d03('0x6a')]=_0x1a1582[_0x1d03('0x66')]({'plain':!![]});interaction_log[_0x1d03('0x15')](_0x1d03('0x7f'),_0x5af103[_0x1d03('0x64')]['id'],_0x5af103['user'][_0x1d03('0x28')],_0x5af103[_0x1d03('0x64')][_0x1d03('0x80')],_0x1c600b[_0x1d03('0x6a')]['id'],_0x5af103[_0x1d03('0x47')]?JSON[_0x1d03('0x60')](_0x5af103[_0x1d03('0x47')]):_0x1d03('0x6b'));return respondWithRpcPromise(_0x1d03('0x81'),_0x1d03('0x82'),_0x1c600b);}return null;})[_0x1d03('0x14')](function(_0x497238){var _0x44d73d=_0x1d03('0x6e')+_0x497238['message'][_0x1d03('0x83')];return db['sequelize'][_0x1d03('0x31')](_0x44d73d,{'type':db[_0x1d03('0x6f')][_0x1d03('0x70')][_0x1d03('0x71')],'raw':!![]})[_0x1d03('0x14')](function(_0x222d35){return _0x222d35;});})[_0x1d03('0x14')](function(_0x340353){if(_0x340353){_0x1c600b[_0x1d03('0x1c')][_0x1d03('0x72')]=_0x340353[0x0];if(!_0x5af103[_0x1d03('0x47')][_0x1d03('0x63')])return;return db['User'][_0x1d03('0x46')]({'where':{'id':_0x5af103[_0x1d03('0x47')][_0x1d03('0x63')],'role':_0x1d03('0x65')},'attributes':['id',_0x1d03('0x28'),_0x1d03('0x84'),_0x1d03('0x74'),_0x1d03('0x75')],'raw':!![]});}return null;})[_0x1d03('0x14')](function(_0xdf353a){if(!_0xdf353a)return null;_0x1c600b[_0x1d03('0x1c')][_0x1d03('0x65')]=_0xdf353a;return _0x1c600b;})[_0x1d03('0x14')](function(_0x5447e4){if(_0x5447e4){_0x5447e4[_0x1d03('0x1c')][_0x1d03('0x77')]=util[_0x1d03('0x5e')](_0x1d03('0x85'),_0x5af103[_0x1d03('0x64')]['name']);_0x5447e4[_0x1d03('0x1c')][_0x1d03('0x78')]=_0x1c600b['channel'];_0x5447e4[_0x1d03('0x1c')][_0x1d03('0x86')]=_0x1c600b[_0x1d03('0x78')];_0x5447e4[_0x1d03('0x1c')][_0x1d03('0x79')]=_0x1d03('0x7d');_0x5447e4[_0x1d03('0x1c')][_0x1d03('0x47')]=htmlToText[_0x1d03('0x7a')](_0x1c600b[_0x1d03('0x1c')][_0x1d03('0x47')]);respondWithRpcPromise('EventManager',_0x1d03('0x7b'),{'event':_0x1d03('0x87'),'message':_0x5447e4[_0x1d03('0x1c')]},client9002);return _0x1c600b;}return null;})[_0x1d03('0x14')](respondWithResult(_0x221d7e,null))[_0x1d03('0x1e')](handleError(_0x221d7e,null));};exports[_0x1d03('0x88')]=function(_0x41af05,_0x4d09c1){var _0xeb2704=moment()[_0x1d03('0x89')]()['toString']();var _0x1f4ed1=path[_0x1d03('0x8a')](config[_0x1d03('0x8b')],_0x1d03('0x8c'),_0x1d03('0x8d'),_0x1d03('0x8e'));var _0x7c0be0=path[_0x1d03('0x8a')](config['root'],'server',_0x1d03('0x8d'),_0x1d03('0x58'));var _0x142d96=util[_0x1d03('0x5e')](_0x1d03('0x8f'),_0xeb2704);return db[_0x1d03('0x2c')][_0x1d03('0x46')]({'where':{'id':_0x41af05[_0x1d03('0x45')]['id']},'attributes':['id','body','from','to','cc','bcc',_0x1d03('0x90'),_0x1d03('0x91')],'include':_0x41af05[_0x1d03('0x31')][_0x1d03('0x58')]?[{'model':db[_0x1d03('0x92')],'as':_0x1d03('0x93')}]:undefined})[_0x1d03('0x14')](handleEntityNotFound(_0x4d09c1,null))[_0x1d03('0x14')](function(_0x469307){if(_0x469307){var _0x5da0dd=_0x469307;var _0x203d79={'from':_0x5da0dd['from'],'to':_0x5da0dd['to'],'subject':_0x5da0dd['subject'],'html':htmlEntities[_0x1d03('0x94')](_0x5da0dd[_0x1d03('0x47')]),'headers':{'Date':moment(_0x5da0dd['createdAt'])[_0x1d03('0x5e')](_0x1d03('0x95'))},'attachments':[]};if(_0x469307['cc']){_0x203d79['headers']['Cc']=_0x469307['cc'];}if(_0x469307[_0x1d03('0x96')]){_0x203d79[_0x1d03('0x97')]['Bcc']=_0x469307[_0x1d03('0x96')];}return new BPromise(function(_0x523415,_0x5cf541){if(_0x469307[_0x1d03('0x93')]){for(var _0x550279=0x0;_0x550279<_0x469307[_0x1d03('0x93')][_0x1d03('0x36')];_0x550279++){var _0x1dfa8e=_0x469307[_0x1d03('0x93')][_0x550279];var _0x211fd9=path[_0x1d03('0x8a')](_0x7c0be0,_0x1dfa8e[_0x1d03('0x5a')]);if(fs[_0x1d03('0x98')](_0x211fd9)){_0x203d79[_0x1d03('0x58')][_0x1d03('0x99')]({'name':_0x1dfa8e[_0x1d03('0x28')],'contentType':_0x1dfa8e[_0x1d03('0x2f')],'data':fs['readFileSync'](_0x211fd9)});}}}emlformat['build'](_0x203d79,function(_0x4d2e5c,_0x23eef1){if(_0x4d2e5c)return _0x5cf541(_0x4d2e5c);fs[_0x1d03('0x9a')](path[_0x1d03('0x8a')](_0x1f4ed1,_0x142d96),_0x23eef1);return _0x523415(_0x23eef1);});});}})[_0x1d03('0x14')](function(_0x466737){if(_0x466737){return _0x4d09c1[_0x1d03('0x88')](path[_0x1d03('0x8a')](_0x1f4ed1,_0x142d96),_0x142d96,function(_0x124fd3){if(!_0x124fd3)fs[_0x1d03('0x9b')](path['join'](_0x1f4ed1,_0x142d96));});}})[_0x1d03('0x1e')](handleError(_0x4d09c1,null));}; \ No newline at end of file +var _0x1369=['api','../../config/logger','mail-interactions','redis','socket.io-emitter','html-entities','./mailMessage.socket','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','limit','undefined','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailMessage','includeAll','findAll','rows','show','params','keys','include','find','body','describe','create','direction','secret','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','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','event','accept','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','fromString','download','unix','root','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs'];(function(_0x4d0375,_0x1178f1){var _0x14b1fa=function(_0x4fc937){while(--_0x4fc937){_0x4d0375['push'](_0x4d0375['shift']());}};_0x14b1fa(++_0x1178f1);}(_0x1369,0x99));var _0x9136=function(_0x1e8520,_0x5daed2){_0x1e8520=_0x1e8520-0x0;var _0x4ac3d1=_0x1369[_0x1e8520];return _0x4ac3d1;};'use strict';var emlformat=require(_0x9136('0x0'));var moment=require(_0x9136('0x1'));var BPromise=require(_0x9136('0x2'));var util=require(_0x9136('0x3'));var path=require(_0x9136('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x9136('0x5'));var htmlToText=require(_0x9136('0x6'));var qs=require(_0x9136('0x7'));var logger=require('../../config/logger')(_0x9136('0x8'));var interaction_log=require(_0x9136('0x9'))(_0x9136('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9136('0xb')]=_['defaults'](config[_0x9136('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9136('0xc'))(new Redis(config[_0x9136('0xb')]));var htmlEntities=require(_0x9136('0xd'));require(_0x9136('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9136('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x9136('0xf')]({'port':0x232b});var client9002=jayson[_0x9136('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2705b2,_0x59fed9,_0x35babf,_0x11e862){return new BPromise(function(_0x4f4e41,_0xff08ab){var _0x1d9cb1=_0x11e862||client;return _0x1d9cb1[_0x9136('0x11')](_0x2705b2,_0x35babf)[_0x9136('0x12')](function(_0x588a69){logger[_0x9136('0x13')](_0x9136('0x14'),_0x59fed9,_0x9136('0x15'));logger[_0x9136('0x16')](_0x9136('0x17'),_0x59fed9,_0x9136('0x15'),JSON['stringify'](_0x588a69));if(_0x588a69[_0x9136('0x18')]){if(_0x588a69[_0x9136('0x18')][_0x9136('0x19')]===0x1f4){logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x588a69['error'][_0x9136('0x1a')]);return _0xff08ab(_0x588a69[_0x9136('0x18')][_0x9136('0x1a')]);}logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x588a69['error'][_0x9136('0x1a')]);return _0x4f4e41(_0x588a69[_0x9136('0x18')][_0x9136('0x1a')]);}else{logger[_0x9136('0x13')]('MailMessage,\x20%s,\x20%s',_0x59fed9,_0x9136('0x15'));_0x4f4e41(_0x588a69[_0x9136('0x1b')][_0x9136('0x1a')]);}})[_0x9136('0x1c')](function(_0x5d1a82){logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x5d1a82);_0xff08ab(_0x5d1a82);});});}function respondWithResult(_0x177322,_0x5089f1){_0x5089f1=_0x5089f1||0xc8;return function(_0x294989){if(_0x294989){return _0x177322[_0x9136('0x1d')](_0x5089f1)[_0x9136('0x1e')](_0x294989);}};}function respondWithFilteredResult(_0x2db507,_0x315d05){return function(_0x5b5d5b){if(_0x5b5d5b){var _0x40ef91=typeof _0x315d05[_0x9136('0x1f')]==='undefined'&&typeof _0x315d05[_0x9136('0x20')]===_0x9136('0x21');var _0x5ad3f6=_0x5b5d5b['count'];var _0x2954f3=_0x40ef91?0x0:_0x315d05[_0x9136('0x1f')];var _0x413c13=_0x40ef91?_0x5b5d5b['count']:_0x315d05[_0x9136('0x1f')]+_0x315d05[_0x9136('0x20')];var _0x20d2a9;if(_0x413c13>=_0x5ad3f6){_0x413c13=_0x5ad3f6;_0x20d2a9=0xc8;}else{_0x20d2a9=0xce;}_0x2db507['status'](_0x20d2a9);return _0x2db507['set']('Content-Range',_0x2954f3+'-'+_0x413c13+'/'+_0x5ad3f6)[_0x9136('0x1e')](_0x5b5d5b);}return null;};}function saveUpdates(_0x5ec091){return function(_0x333eba){if(_0x333eba){return _0x333eba['update'](_0x5ec091)[_0x9136('0x12')](function(_0x2e4840){return _0x2e4840;});}return null;};}function removeEntity(_0xd301f5){return function(_0x244b98){if(_0x244b98){return _0x244b98[_0x9136('0x22')]()[_0x9136('0x12')](function(){_0xd301f5[_0x9136('0x1d')](0xcc)[_0x9136('0x23')]();});}};}function handleEntityNotFound(_0x51589a){return function(_0x54603a){if(!_0x54603a){_0x51589a[_0x9136('0x24')](0x194);}return _0x54603a;};}function handleError(_0x35be70,_0x553e46){_0x553e46=_0x553e46||0x1f4;return function(_0x383e29){logger[_0x9136('0x18')](_0x383e29[_0x9136('0x25')]);if(_0x383e29[_0x9136('0x26')]){delete _0x383e29[_0x9136('0x26')];}_0x35be70[_0x9136('0x1d')](_0x553e46)[_0x9136('0x27')](_0x383e29);};}exports[_0x9136('0x28')]=function(_0x2266cf,_0x1c9059){var _0x2bd978={},_0x1f7db0={},_0x29fa81={'count':0x0,'rows':[]};var _0x53abc6=_['map'](db['MailMessage'][_0x9136('0x29')],function(_0x6a23e2){return{'name':_0x6a23e2[_0x9136('0x2a')],'type':_0x6a23e2[_0x9136('0x2b')]['key']};});_0x1f7db0[_0x9136('0x2c')]=_[_0x9136('0x2d')](_0x53abc6,'name');_0x1f7db0['query']=_['keys'](_0x2266cf['query']);_0x1f7db0[_0x9136('0x2e')]=_[_0x9136('0x2f')](_0x1f7db0['model'],_0x1f7db0[_0x9136('0x30')]);_0x2bd978[_0x9136('0x31')]=_[_0x9136('0x2f')](_0x1f7db0[_0x9136('0x2c')],qs[_0x9136('0x32')](_0x2266cf[_0x9136('0x30')]['fields']));_0x2bd978['attributes']=_0x2bd978[_0x9136('0x31')][_0x9136('0x33')]?_0x2bd978['attributes']:_0x1f7db0[_0x9136('0x2c')];if(!_0x2266cf[_0x9136('0x30')][_0x9136('0x34')](_0x9136('0x35'))){_0x2bd978['limit']=qs[_0x9136('0x20')](_0x2266cf[_0x9136('0x30')][_0x9136('0x20')]);_0x2bd978[_0x9136('0x1f')]=qs['offset'](_0x2266cf['query']['offset']);}_0x2bd978[_0x9136('0x36')]=qs['sort'](_0x2266cf[_0x9136('0x30')][_0x9136('0x37')]);_0x2bd978[_0x9136('0x38')]=qs[_0x9136('0x2e')](_['pick'](_0x2266cf[_0x9136('0x30')],_0x1f7db0[_0x9136('0x2e')]),_0x53abc6);if(_0x2266cf['query']['filter']){_0x2bd978[_0x9136('0x38')]=_[_0x9136('0x39')](_0x2bd978[_0x9136('0x38')],{'$or':_[_0x9136('0x2d')](_0x53abc6,function(_0x17c715){if(_0x17c715[_0x9136('0x2b')]!==_0x9136('0x3a')){var _0x5c48be={};_0x5c48be[_0x17c715['name']]={'$like':'%'+_0x2266cf[_0x9136('0x30')][_0x9136('0x3b')]+'%'};return _0x5c48be;}})});}_0x2bd978=_['merge']({},_0x2bd978,_0x2266cf[_0x9136('0x3c')]);var _0x591e9f={'where':_0x2bd978['where']};return db[_0x9136('0x3d')]['count'](_0x591e9f)[_0x9136('0x12')](function(_0x2b9068){_0x29fa81['count']=_0x2b9068;if(_0x2266cf[_0x9136('0x30')][_0x9136('0x3e')]){_0x2bd978['include']=[{'all':!![]}];}return db[_0x9136('0x3d')][_0x9136('0x3f')](_0x2bd978);})[_0x9136('0x12')](function(_0x443076){_0x29fa81[_0x9136('0x40')]=_0x443076;return _0x29fa81;})['then'](respondWithFilteredResult(_0x1c9059,_0x2bd978))[_0x9136('0x1c')](handleError(_0x1c9059,null));};exports[_0x9136('0x41')]=function(_0xd8edf0,_0x5005ea){var _0x51c32d={'raw':!![],'where':{'id':_0xd8edf0[_0x9136('0x42')]['id']}},_0x1c2920={};_0x1c2920['model']=_['keys'](db['MailMessage'][_0x9136('0x29')]);_0x1c2920[_0x9136('0x30')]=_[_0x9136('0x43')](_0xd8edf0[_0x9136('0x30')]);_0x1c2920['filters']=_[_0x9136('0x2f')](_0x1c2920[_0x9136('0x2c')],_0x1c2920['query']);_0x51c32d[_0x9136('0x31')]=_['intersection'](_0x1c2920[_0x9136('0x2c')],qs[_0x9136('0x32')](_0xd8edf0[_0x9136('0x30')]['fields']));_0x51c32d[_0x9136('0x31')]=_0x51c32d[_0x9136('0x31')][_0x9136('0x33')]?_0x51c32d['attributes']:_0x1c2920[_0x9136('0x2c')];if(_0xd8edf0[_0x9136('0x30')]['includeAll']){_0x51c32d[_0x9136('0x44')]=[{'all':!![]}];}_0x51c32d=_[_0x9136('0x39')]({},_0x51c32d,_0xd8edf0[_0x9136('0x3c')]);return db[_0x9136('0x3d')][_0x9136('0x45')](_0x51c32d)[_0x9136('0x12')](handleEntityNotFound(_0x5005ea,null))['then'](respondWithResult(_0x5005ea,null))[_0x9136('0x1c')](handleError(_0x5005ea,null));};exports['update']=function(_0x38a8e4,_0x48d670){if(_0x38a8e4['body']['id']){delete _0x38a8e4[_0x9136('0x46')]['id'];}return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x38a8e4[_0x9136('0x42')]['id']}})[_0x9136('0x12')](handleEntityNotFound(_0x48d670,null))[_0x9136('0x12')](saveUpdates(_0x38a8e4[_0x9136('0x46')],null))[_0x9136('0x12')](respondWithResult(_0x48d670,null))['catch'](handleError(_0x48d670,null));};exports[_0x9136('0x22')]=function(_0x1254bd,_0xd5fd8a){return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x1254bd[_0x9136('0x42')]['id']}})[_0x9136('0x12')](handleEntityNotFound(_0xd5fd8a,null))[_0x9136('0x12')](removeEntity(_0xd5fd8a,null))[_0x9136('0x1c')](handleError(_0xd5fd8a,null));};exports['describe']=function(_0x2cea71,_0x5afb13){return db[_0x9136('0x3d')][_0x9136('0x47')]()[_0x9136('0x12')](respondWithResult(_0x5afb13,null))[_0x9136('0x1c')](handleError(_0x5afb13,null));};exports[_0x9136('0x48')]=function(_0x391d38,_0x17a128){return db[_0x9136('0x3d')][_0x9136('0x48')](_0x391d38['body'])[_0x9136('0x12')](function(_0x3fc13a){if(_0x3fc13a){if(_0x3fc13a[_0x9136('0x49')]==='out'&&!_0x3fc13a[_0x9136('0x4a')]){var _0x53166e,_0x3a7c36,_0xc4a50f;if(_0x391d38['body']['to']){_0x3a7c36=_0x391d38[_0x9136('0x46')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x3fc13a[_0x9136('0x4b')]},'include':[{'model':db[_0x9136('0x4c')],'as':_0x9136('0x4d'),'include':[{'model':db[_0x9136('0x4e')],'as':_0x9136('0x4f'),'where':{'email':_0x3a7c36},'limit':0x1,'order':[[_0x9136('0x50'),_0x9136('0x51')]]}]},{'model':db[_0x9136('0x52')],'as':_0x9136('0x53'),'raw':!![],'include':[{'model':db[_0x9136('0x54')],'as':_0x9136('0x54'),'raw':!![]}]}]})[_0x9136('0x12')](function(_0x3b818f){_0x53166e=_0x3b818f;if(!_0x53166e||!_0x53166e[_0x9136('0x53')])return;var _0x1bc704=_0x53166e[_0x9136('0x55')]();if(_0x391d38['body'][_0x9136('0x56')]&&_0x391d38[_0x9136('0x46')][_0x9136('0x56')][_0x9136('0x33')]){for(var _0x354f20=0x0;_0x354f20<_0x391d38[_0x9136('0x46')][_0x9136('0x56')]['length'];_0x354f20+=0x1){_0x391d38[_0x9136('0x46')]['attachments'][_0x354f20]={'filename':_0x391d38['body'][_0x9136('0x56')][_0x354f20][_0x9136('0x26')],'path':path[_0x9136('0x57')](config['root'],_0x9136('0x58'),_0x391d38[_0x9136('0x46')][_0x9136('0x56')][_0x354f20][_0x9136('0x59')])};}}_0xc4a50f={'account':_0x1bc704,'message':_0x391d38[_0x9136('0x46')]};return;})[_0x9136('0x12')](function(){if(_0x53166e[_0x9136('0x4d')]){if(_0x53166e[_0x9136('0x4d')]['Contacts']['length']){return _0x53166e[_0x9136('0x4d')]['Contacts'][0x0];}else{return db[_0x9136('0x4e')][_0x9136('0x48')](_[_0x9136('0x5a')](_0x391d38[_0x9136('0x46')],{'firstName':_0x391d38[_0x9136('0x46')]['to'],'email':_0x391d38['body']['to'],'phone':_0x391d38[_0x9136('0x46')]['to'],'ListId':_0x53166e[_0x9136('0x5b')]}));}}else{throw new Error(_0x9136('0x5c'));}})[_0x9136('0x12')](function(){if(_0xc4a50f){return respondWithRpcPromise(_0x9136('0x5d'),_0x9136('0x5e'),_0xc4a50f,client9003)[_0x9136('0x12')](function(_0x55603a){return _0x3fc13a[_0x9136('0x5f')]({'read':!![],'messageId':_0x55603a[_0x9136('0x60')],'sentAt':moment()[_0x9136('0x61')](_0x9136('0x62'))});})['catch'](function(_0x2a0b65){logger[_0x9136('0x18')]('%s',JSON['stringify'](_0x2a0b65));return _0x3fc13a;});}return _0x3fc13a;});}return _0x3fc13a;}})['then'](respondWithResult(_0x17a128,0xc9))[_0x9136('0x1c')](handleError(_0x17a128,null));};exports['accept']=function(_0x40c69b,_0x1247fb){var _0x4a85e3={'agent':{},'channel':_0x9136('0x63')};if(_0x40c69b[_0x9136('0x46')]['id']){delete _0x40c69b[_0x9136('0x46')]['id'];}_0x40c69b[_0x9136('0x46')][_0x9136('0x64')]=!![];_0x40c69b[_0x9136('0x46')][_0x9136('0x65')]=moment()[_0x9136('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x40c69b[_0x9136('0x46')]['UserId']=_0x40c69b[_0x9136('0x46')][_0x9136('0x66')]||_0x40c69b['user']['id'];_0x4a85e3[_0x9136('0x67')]['id']=_0x40c69b[_0x9136('0x46')][_0x9136('0x66')];return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x40c69b[_0x9136('0x42')]['id'],'UserId':null}})[_0x9136('0x12')](handleEntityNotFound(_0x1247fb,null))[_0x9136('0x12')](saveUpdates(_0x40c69b[_0x9136('0x46')],null))[_0x9136('0x12')](function(_0x4fb6e1){if(_0x4fb6e1){_0x4a85e3['message']=_0x4fb6e1[_0x9136('0x68')]({'plain':!![]});return db[_0x9136('0x69')][_0x9136('0x45')]({'where':{'id':_0x4fb6e1[_0x9136('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x1247fb,null))[_0x9136('0x12')](function(_0x5e7648){if(_0x5e7648){return _0x5e7648[_0x9136('0x5f')]({'UserId':_0x40c69b['body'][_0x9136('0x66')],'read1stAt':_[_0x9136('0x6b')](_0x5e7648['read1stAt'])?moment()[_0x9136('0x61')](_0x9136('0x62')):undefined});}return null;})['then'](function(_0x51f0e7){if(_0x51f0e7){_0x4a85e3['interaction']=_0x51f0e7[_0x9136('0x68')]({'plain':!![]});interaction_log[_0x9136('0x13')](_0x9136('0x6c'),_0x40c69b[_0x9136('0x6d')]['id'],_0x40c69b[_0x9136('0x6d')][_0x9136('0x26')],_0x40c69b[_0x9136('0x6d')][_0x9136('0x6e')],_0x4a85e3[_0x9136('0x6f')]['id'],_0x40c69b[_0x9136('0x46')]?JSON[_0x9136('0x70')](_0x40c69b[_0x9136('0x46')]):_0x9136('0x71'));return respondWithRpcPromise('AcceptMessage',_0x9136('0x72'),_0x4a85e3);}return null;})[_0x9136('0x12')](function(_0x7feaf5){var _0x2115df=_0x9136('0x73')+_0x7feaf5[_0x9136('0x1a')][_0x9136('0x74')];return db[_0x9136('0x75')][_0x9136('0x30')](_0x2115df,{'type':db[_0x9136('0x76')][_0x9136('0x77')][_0x9136('0x78')],'raw':!![]})['then'](function(_0x208b61){return _0x208b61;});})[_0x9136('0x12')](function(_0x2a84d1){if(_0x2a84d1){_0x4a85e3[_0x9136('0x1a')][_0x9136('0x79')]=_0x2a84d1[0x0];if(!_0x40c69b['body'][_0x9136('0x66')])return;return db[_0x9136('0x7a')]['find']({'where':{'id':_0x40c69b['body'][_0x9136('0x66')],'role':'agent'},'attributes':['id','name',_0x9136('0x7b'),_0x9136('0x7c'),_0x9136('0x7d')],'raw':!![]});}return null;})['then'](function(_0x322823){if(!_0x322823)return null;_0x4a85e3[_0x9136('0x1a')][_0x9136('0x67')]=_0x322823;return _0x4a85e3;})[_0x9136('0x12')](function(_0x220041){if(_0x220041){if(_0x40c69b[_0x9136('0x46')][_0x9136('0x7e')]){_0x4a85e3[_0x9136('0x1a')][_0x9136('0x7f')]=util['format'](_0x9136('0x80'),_0x40c69b[_0x9136('0x6d')][_0x9136('0x26')]);_0x4a85e3[_0x9136('0x1a')][_0x9136('0x81')]=_0x4a85e3['channel'];_0x4a85e3[_0x9136('0x1a')]['motionChannel']=_0x4a85e3['channel'];_0x4a85e3[_0x9136('0x1a')][_0x9136('0x82')]=_0x9136('0x83');_0x4a85e3[_0x9136('0x1a')]['body']=htmlToText['fromString'](_0x4a85e3[_0x9136('0x1a')][_0x9136('0x46')]);return respondWithRpcPromise(_0x9136('0x84'),'EventManager',{'event':_0x9136('0x85'),'message':_0x4a85e3[_0x9136('0x1a')]},client9002)[_0x9136('0x12')](function(){return _0x4a85e3;});}return _0x4a85e3;}return null;})[_0x9136('0x12')](respondWithResult(_0x1247fb,null))[_0x9136('0x1c')](handleError(_0x1247fb,null));};exports[_0x9136('0x86')]=function(_0x2b7e3e,_0x107e15){var _0x1b5d61={'agent':{},'channel':_0x9136('0x63')};if(_0x2b7e3e['body']['id']){delete _0x2b7e3e[_0x9136('0x46')]['id'];}_0x2b7e3e[_0x9136('0x46')][_0x9136('0x66')]=_0x2b7e3e[_0x9136('0x46')][_0x9136('0x66')]||_0x2b7e3e[_0x9136('0x6d')]['id'];_0x1b5d61[_0x9136('0x67')]['id']=_0x2b7e3e[_0x9136('0x46')]['UserId'];return db[_0x9136('0x3d')]['find']({'where':{'id':_0x2b7e3e[_0x9136('0x42')]['id'],'UserId':null}})[_0x9136('0x12')](handleEntityNotFound(_0x107e15,null))[_0x9136('0x12')](function(_0x35311d){if(_0x35311d){_0x1b5d61[_0x9136('0x1a')]=_0x35311d[_0x9136('0x68')]({'plain':!![]});return db[_0x9136('0x69')]['find']({'where':{'id':_0x35311d[_0x9136('0x6a')]}});}return null;})[_0x9136('0x12')](handleEntityNotFound(_0x107e15,null))[_0x9136('0x12')](function(_0x4add1d){if(_0x4add1d){_0x1b5d61[_0x9136('0x6f')]=_0x4add1d[_0x9136('0x68')]({'plain':!![]});interaction_log[_0x9136('0x13')](_0x9136('0x87'),_0x2b7e3e[_0x9136('0x6d')]['id'],_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x26')],_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x6e')],_0x1b5d61[_0x9136('0x6f')]['id'],_0x2b7e3e['body']?JSON[_0x9136('0x70')](_0x2b7e3e[_0x9136('0x46')]):_0x9136('0x71'));return respondWithRpcPromise(_0x9136('0x88'),_0x9136('0x89'),_0x1b5d61);}return null;})[_0x9136('0x12')](function(_0x1ab5de){var _0x4e97d7=_0x9136('0x73')+_0x1ab5de['message'][_0x9136('0x74')];return db[_0x9136('0x75')]['query'](_0x4e97d7,{'type':db[_0x9136('0x76')]['QueryTypes'][_0x9136('0x78')],'raw':!![]})['then'](function(_0x474e17){return _0x474e17;});})['then'](function(_0x1c6a23){if(_0x1c6a23){_0x1b5d61[_0x9136('0x1a')][_0x9136('0x79')]=_0x1c6a23[0x0];if(!_0x2b7e3e['body'][_0x9136('0x66')])return;return db[_0x9136('0x7a')][_0x9136('0x45')]({'where':{'id':_0x2b7e3e['body'][_0x9136('0x66')],'role':_0x9136('0x67')},'attributes':['id','name',_0x9136('0x7b'),'email',_0x9136('0x7d')],'raw':!![]});}return null;})['then'](function(_0x452efc){if(!_0x452efc)return null;_0x1b5d61[_0x9136('0x1a')][_0x9136('0x67')]=_0x452efc;return _0x1b5d61;})[_0x9136('0x12')](function(_0x1f9674){if(_0x1f9674){_0x1f9674[_0x9136('0x1a')][_0x9136('0x7f')]=util[_0x9136('0x61')]('SIP/%s',_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x26')]);_0x1f9674[_0x9136('0x1a')][_0x9136('0x81')]=_0x1b5d61[_0x9136('0x81')];_0x1f9674[_0x9136('0x1a')][_0x9136('0x8a')]=_0x1b5d61['channel'];_0x1f9674[_0x9136('0x1a')][_0x9136('0x82')]=_0x9136('0x86');_0x1f9674[_0x9136('0x1a')][_0x9136('0x46')]=htmlToText[_0x9136('0x8b')](_0x1b5d61[_0x9136('0x1a')][_0x9136('0x46')]);respondWithRpcPromise(_0x9136('0x84'),_0x9136('0x84'),{'event':'rejectmessage','message':_0x1f9674['message']},client9002);return _0x1b5d61;}return null;})['then'](respondWithResult(_0x107e15,null))['catch'](handleError(_0x107e15,null));};exports[_0x9136('0x8c')]=function(_0x50cf66,_0x2c5e51){var _0x2dc90b=moment()[_0x9136('0x8d')]()['toString']();var _0x22b460=path[_0x9136('0x57')](config[_0x9136('0x8e')],_0x9136('0x8f'),_0x9136('0x90'),_0x9136('0x91'));var _0x452112=path['join'](config['root'],_0x9136('0x8f'),_0x9136('0x90'),'attachments');var _0x44c3b2=util['format'](_0x9136('0x92'),_0x2dc90b);return db['MailMessage'][_0x9136('0x45')]({'where':{'id':_0x50cf66[_0x9136('0x42')]['id']},'attributes':['id',_0x9136('0x46'),_0x9136('0x93'),'to','cc',_0x9136('0x94'),'subject',_0x9136('0x95')],'include':_0x50cf66[_0x9136('0x30')][_0x9136('0x56')]?[{'model':db[_0x9136('0x96')],'as':_0x9136('0x97')}]:undefined})[_0x9136('0x12')](handleEntityNotFound(_0x2c5e51,null))[_0x9136('0x12')](function(_0x540eb8){if(_0x540eb8){var _0x37b085=_0x540eb8;var _0x336ad7={'from':_0x37b085[_0x9136('0x93')],'to':_0x37b085['to'],'subject':_0x37b085[_0x9136('0x98')],'html':htmlEntities[_0x9136('0x99')](_0x37b085[_0x9136('0x46')]),'headers':{'Date':moment(_0x37b085[_0x9136('0x95')])[_0x9136('0x61')](_0x9136('0x9a'))},'attachments':[]};if(_0x540eb8['cc']){_0x336ad7[_0x9136('0x9b')]['Cc']=_0x540eb8['cc'];}if(_0x540eb8[_0x9136('0x94')]){_0x336ad7[_0x9136('0x9b')][_0x9136('0x9c')]=_0x540eb8[_0x9136('0x94')];}return new BPromise(function(_0x1c1a7e,_0x23fdb0){if(_0x540eb8[_0x9136('0x97')]){for(var _0x25e8dd=0x0;_0x25e8dd<_0x540eb8[_0x9136('0x97')][_0x9136('0x33')];_0x25e8dd++){var _0x476a44=_0x540eb8[_0x9136('0x97')][_0x25e8dd];var _0x19b64e=path[_0x9136('0x57')](_0x452112,_0x476a44['basename']);if(fs[_0x9136('0x9d')](_0x19b64e)){_0x336ad7[_0x9136('0x56')][_0x9136('0x9e')]({'name':_0x476a44[_0x9136('0x26')],'contentType':_0x476a44[_0x9136('0x2b')],'data':fs['readFileSync'](_0x19b64e)});}}}emlformat[_0x9136('0x9f')](_0x336ad7,function(_0x49190a,_0x4a644d){if(_0x49190a)return _0x23fdb0(_0x49190a);fs[_0x9136('0xa0')](path[_0x9136('0x57')](_0x22b460,_0x44c3b2),_0x4a644d);return _0x1c1a7e(_0x4a644d);});});}})[_0x9136('0x12')](function(_0x128da6){if(_0x128da6){return _0x2c5e51['download'](path[_0x9136('0x57')](_0x22b460,_0x44c3b2),_0x44c3b2,function(_0x51af7f){if(!_0x51af7f)fs['unlinkSync'](path['join'](_0x22b460,_0x44c3b2));});}})[_0x9136('0x1c')](handleError(_0x2c5e51,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 528e697..561d2a4 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 _0xa828=['emit','hasOwnProperty','exports','events','../../mysqldb','save','update','remove'];(function(_0x47199b,_0x16e824){var _0x390911=function(_0x2f874d){while(--_0x2f874d){_0x47199b['push'](_0x47199b['shift']());}};_0x390911(++_0x16e824);}(_0xa828,0x173));var _0x8a82=function(_0x57712d,_0x199bab){_0x57712d=_0x57712d-0x0;var _0x17c8ba=_0xa828[_0x57712d];return _0x17c8ba;};'use strict';var EventEmitter=require(_0x8a82('0x0'));var MailMessage=require(_0x8a82('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a82('0x2'),'afterUpdate':_0x8a82('0x3'),'afterDestroy':_0x8a82('0x4')};function emitEvent(_0x12bc7e){return function(_0x2f292f,_0x413939,_0x2d8c5b){MailMessageEvents[_0x8a82('0x5')](_0x12bc7e+':'+_0x2f292f['id'],_0x2f292f);MailMessageEvents[_0x8a82('0x5')](_0x12bc7e,_0x2f292f);_0x2d8c5b(null);};}for(var e in events){if(events[_0x8a82('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x8a82('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xf091=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3d8778,_0x1fa476){var _0x2cdc24=function(_0x4d2c2b){while(--_0x4d2c2b){_0x3d8778['push'](_0x3d8778['shift']());}};_0x2cdc24(++_0x1fa476);}(_0xf091,0x1b3));var _0x1f09=function(_0x1815e5,_0x58fc74){_0x1815e5=_0x1815e5-0x0;var _0x2d212b=_0xf091[_0x1815e5];return _0x2d212b;};'use strict';var EventEmitter=require(_0x1f09('0x0'));var MailMessage=require(_0x1f09('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1f09('0x2')](0x0);var events={'afterCreate':_0x1f09('0x3'),'afterUpdate':_0x1f09('0x4'),'afterDestroy':_0x1f09('0x5')};function emitEvent(_0x704889){return function(_0x47d934,_0x49b889,_0x34746d){MailMessageEvents['emit'](_0x704889+':'+_0x47d934['id'],_0x47d934);MailMessageEvents[_0x1f09('0x6')](_0x704889,_0x47d934);_0x34746d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1f09('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 5751bf6..9021c05 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 _0xf081=['secret','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','body','fromString','models','get','direction','toLowerCase','out'];(function(_0xa72223,_0x1a49bd){var _0x10919c=function(_0x50751b){while(--_0x50751b){_0xa72223['push'](_0xa72223['shift']());}};_0x10919c(++_0x1a49bd);}(_0xf081,0x175));var _0x1f08=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf081[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x1f08('0x0'));var util=require(_0x1f08('0x1'));var logger=require(_0x1f08('0x2'))(_0x1f08('0x3'));var moment=require('moment');var BPromise=require(_0x1f08('0x4'));var rp=require(_0x1f08('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1f08('0x6'));var rimraf=require(_0x1f08('0x7'));var config=require(_0x1f08('0x8'));var attributes=require(_0x1f08('0x9'));module[_0x1f08('0xa')]=function(_0x15013c,_0xad7dfc){return _0x15013c['define'](_0x1f08('0xb'),attributes,{'tableName':_0x1f08('0xc'),'paranoid':![],'indexes':[{'name':_0x1f08('0xd'),'fields':[_0x1f08('0xd')]},{'name':_0x1f08('0xe'),'fields':[_0x1f08('0xf'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x212388,_0x526c46,_0x5cb6e5){if(_0x212388[_0x1f08('0x10')]){_0x212388[_0x1f08('0xf')]=htmlToText[_0x1f08('0x11')](_0x212388['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5cb6e5(null,_0x526c46);},'afterCreate':function(_0x9af472,_0x4d21ca,_0xbc5efd){var _0x27ac17=_0x15013c[_0x1f08('0x12')];var _0xd25ef7=_0x9af472[_0x1f08('0x13')]({'plain':!![]});if(_0xd25ef7[_0x1f08('0x14')][_0x1f08('0x15')]()==='in'||_0xd25ef7[_0x1f08('0x14')]['toLowerCase']()===_0x1f08('0x16')&&!_0xd25ef7[_0x1f08('0x17')]&&!_['isNil'](_0xd25ef7[_0x1f08('0x18')])){_0x27ac17[_0x1f08('0x19')][_0x1f08('0x1a')]({'where':{'id':_0xd25ef7[_0x1f08('0x1b')]}})['then'](function(_0xc7cc8d){if(_0xc7cc8d){_0xc7cc8d[_0x1f08('0x1c')]({'lastMsgAt':_0xd25ef7[_0x1f08('0x1d')],'lastMsgDirection':_0xd25ef7[_0x1f08('0x14')][_0x1f08('0x15')]()});}})[_0x1f08('0x1e')](function(_0x1a6fb5){console[_0x1f08('0x1f')](_0x1a6fb5);});}_0xbc5efd();}},'charset':'utf8mb4','collate':_0x1f08('0x20')});}; \ No newline at end of file +var _0x1836=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','toLowerCase','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4'];(function(_0x4b7bad,_0x135acf){var _0x4da111=function(_0x28650c){while(--_0x28650c){_0x4b7bad['push'](_0x4b7bad['shift']());}};_0x4da111(++_0x135acf);}(_0x1836,0x1ae));var _0x6183=function(_0x26573c,_0x75f467){_0x26573c=_0x26573c-0x0;var _0x175f6e=_0x1836[_0x26573c];return _0x175f6e;};'use strict';var _=require(_0x6183('0x0'));var util=require(_0x6183('0x1'));var logger=require(_0x6183('0x2'))('api');var moment=require(_0x6183('0x3'));var BPromise=require(_0x6183('0x4'));var rp=require(_0x6183('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6183('0x6'));var rimraf=require('rimraf');var config=require(_0x6183('0x7'));var attributes=require(_0x6183('0x8'));module[_0x6183('0x9')]=function(_0x3703e8,_0x2bed83){return _0x3703e8[_0x6183('0xa')](_0x6183('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6183('0xc'),'fields':[_0x6183('0xc')]},{'name':_0x6183('0xd'),'fields':[_0x6183('0xe'),_0x6183('0xf')],'type':_0x6183('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x228c22,_0x29f806,_0x5506f8){if(_0x228c22[_0x6183('0x11')]){_0x228c22[_0x6183('0xe')]=htmlToText[_0x6183('0x12')](_0x228c22[_0x6183('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5506f8(null,_0x29f806);},'afterCreate':function(_0x12488b,_0x9bc124,_0x593471){var _0x194631=_0x3703e8['models'];var _0x35fe49=_0x12488b['get']({'plain':!![]});if(_0x35fe49['direction'][_0x6183('0x13')]()==='in'||_0x35fe49['direction'][_0x6183('0x13')]()==='out'&&!_0x35fe49[_0x6183('0x14')]&&!_[_0x6183('0x15')](_0x35fe49[_0x6183('0x16')])){_0x194631[_0x6183('0x17')]['findOne']({'where':{'id':_0x35fe49[_0x6183('0x18')]}})[_0x6183('0x19')](function(_0xa411a5){if(_0xa411a5){_0xa411a5[_0x6183('0x1a')]({'lastMsgAt':_0x35fe49[_0x6183('0x1b')],'lastMsgDirection':_0x35fe49[_0x6183('0x1c')][_0x6183('0x13')]()});}})[_0x6183('0x1d')](function(_0x21fa1f){console[_0x6183('0x1e')](_0x21fa1f);});}_0x593471();}},'charset':_0x6183('0x1f'),'collate':_0x6183('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 74b60ca..0982b24 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 _0xe511=['localhost','socket.io-emitter','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','CreateMailMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x9c0a71,_0x204b45){var _0x53e8bf=function(_0x588ac0){while(--_0x588ac0){_0x9c0a71['push'](_0x9c0a71['shift']());}};_0x53e8bf(++_0x204b45);}(_0xe511,0x16f));var _0x1e51=function(_0xc71f27,_0x1c9acc){_0xc71f27=_0xc71f27-0x0;var _0x737ed1=_0xe511[_0xc71f27];return _0x737ed1;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});config[_0x1e51('0xa')]=_['defaults'](config['redis'],{'host':_0x1e51('0xb'),'port':0x18eb});var socket=require(_0x1e51('0xc'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x1e51('0xd')](socket);function respondWithRpcPromise(_0x2712e0,_0x29da1f,_0x706e60){return new BPromise(function(_0x4241a6,_0x141e2e){return client['request'](_0x2712e0,_0x706e60)[_0x1e51('0xe')](function(_0xcdfa5d){logger[_0x1e51('0xf')](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));logger[_0x1e51('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x29da1f,_0x1e51('0x11'),JSON[_0x1e51('0x13')](_0xcdfa5d));if(_0xcdfa5d[_0x1e51('0x14')]){if(_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x15')]===0x1f4){logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x16')]);return _0x141e2e(_0xcdfa5d[_0x1e51('0x14')]['message']);}logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')]['message']);return _0x4241a6(_0xcdfa5d[_0x1e51('0x14')]['message']);}else{logger['info'](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));_0x4241a6(_0xcdfa5d[_0x1e51('0x17')][_0x1e51('0x16')]);}})[_0x1e51('0x18')](function(_0x3e4234){logger['error'](_0x1e51('0x10'),_0x29da1f,_0x3e4234);_0x141e2e(_0x3e4234);});});}exports['CreateMailMessage']=function(_0xea581d){var _0x1cbd1c=this;return new Promise(function(_0x309a87,_0x183a95){return db['MailMessage']['create'](_0xea581d['body'],{'raw':_0xea581d['options']?_0xea581d[_0x1e51('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x1e51('0xe')](function(_0x28aacb){logger[_0x1e51('0xf')](_0x1e51('0x1a'),_0xea581d);logger[_0x1e51('0x12')](_0x1e51('0x1a'),_0xea581d,JSON[_0x1e51('0x13')](_0x28aacb));_0x309a87(_0x28aacb);})[_0x1e51('0x18')](function(_0x4bcdd3){logger['error'](_0x1e51('0x1a'),_0x4bcdd3[_0x1e51('0x16')],_0xea581d);_0x183a95(_0x1cbd1c[_0x1e51('0x14')](0x1f4,_0x4bcdd3[_0x1e51('0x16')]));});});}; \ No newline at end of file +var _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x3a802d,_0x119cfc){var _0x2fd218=function(_0x46bb78){while(--_0x46bb78){_0x3a802d['push'](_0x3a802d['shift']());}};_0x2fd218(++_0x119cfc);}(_0x6a95,0x1db));var _0x56a9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x6a95[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 13cff08..6259871 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 _0x86b6=['save','remove','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x86b6,0x6b));var _0x686b=function(_0xb6c185,_0x1fba89){_0xb6c185=_0xb6c185-0x0;var _0x18717b=_0x86b6[_0xb6c185];return _0x18717b;};'use strict';var MailMessageEvents=require(_0x686b('0x0'));var events=[_0x686b('0x1'),_0x686b('0x2'),_0x686b('0x3')];function createListener(_0x56bbb6,_0x50232e){return function(_0xc283e2){_0x50232e[_0x686b('0x4')](_0x56bbb6,_0xc283e2);};}function removeListener(_0x2cdd42,_0x3d7a8f){return function(){MailMessageEvents[_0x686b('0x5')](_0x2cdd42,_0x3d7a8f);};}exports[_0x686b('0x6')]=function(_0x4c7aa7){for(var _0x599ba1=0x0,_0x2e0fb0=events[_0x686b('0x7')];_0x599ba1<_0x2e0fb0;_0x599ba1++){var _0x1a0c1a=events[_0x599ba1];var _0x474570=createListener(_0x686b('0x8')+_0x1a0c1a,_0x4c7aa7);MailMessageEvents['on'](_0x1a0c1a,_0x474570);}}; \ No newline at end of file +var _0x2608=['length','./mailMessage.events','remove','update','register'];(function(_0x4679b6,_0x4d50b8){var _0x647869=function(_0x468717){while(--_0x468717){_0x4679b6['push'](_0x4679b6['shift']());}};_0x647869(++_0x4d50b8);}(_0x2608,0x1c8));var _0x8260=function(_0x174635,_0x2ea064){_0x174635=_0x174635-0x0;var _0x3fb4ab=_0x2608[_0x174635];return _0x3fb4ab;};'use strict';var MailMessageEvents=require(_0x8260('0x0'));var events=['save',_0x8260('0x1'),_0x8260('0x2')];function createListener(_0x649ff7,_0x4d1712){return function(_0x43294a){_0x4d1712['emit'](_0x649ff7,_0x43294a);};}function removeListener(_0x147695,_0x265ab4){return function(){MailMessageEvents['removeListener'](_0x147695,_0x265ab4);};}exports[_0x8260('0x3')]=function(_0x215b03){for(var _0x1cfd83=0x0,_0x2541e7=events[_0x8260('0x4')];_0x1cfd83<_0x2541e7;_0x1cfd83++){var _0x45954d=events[_0x1cfd83];var _0x491e4b=createListener('mailMessage:'+_0x45954d,_0x215b03);MailMessageEvents['on'](_0x45954d,_0x491e4b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 973ff92..1e7ecfa 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 _0x991b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','/:id/users','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x454233,_0x4f592c){var _0x16dfbc=function(_0x4eeb40){while(--_0x4eeb40){_0x454233['push'](_0x454233['shift']());}};_0x16dfbc(++_0x4f592c);}(_0x991b,0xc7));var _0xb991=function(_0x1da9b5,_0x5d81c9){_0x1da9b5=_0x1da9b5-0x0;var _0x1f7e34=_0x991b[_0x1da9b5];return _0x1f7e34;};'use strict';var multer=require(_0xb991('0x0'));var util=require(_0xb991('0x1'));var path=require(_0xb991('0x2'));var timeout=require(_0xb991('0x3'));var express=require(_0xb991('0x4'));var router=express[_0xb991('0x5')]();var fs_extra=require(_0xb991('0x6'));var auth=require(_0xb991('0x7'));var interaction=require(_0xb991('0x8'));var config=require(_0xb991('0x9'));var controller=require(_0xb991('0xa'));router[_0xb991('0xb')]('/',auth[_0xb991('0xc')](),controller[_0xb991('0xd')]);router[_0xb991('0xb')](_0xb991('0xe'),auth[_0xb991('0xc')](),controller[_0xb991('0xf')]);router['get'](_0xb991('0x10'),auth['isAuthenticated'](),controller[_0xb991('0x11')]);router[_0xb991('0xb')](_0xb991('0x12'),auth[_0xb991('0xc')](),controller[_0xb991('0x13')]);router[_0xb991('0xb')](_0xb991('0x14'),auth[_0xb991('0xc')](),controller['getTeams']);router[_0xb991('0xb')]('/:id/users',auth[_0xb991('0xc')](),controller[_0xb991('0x15')]);router[_0xb991('0x16')]('/',auth[_0xb991('0xc')](),controller['create']);router['post'](_0xb991('0x14'),auth[_0xb991('0xc')](),controller['addTeams']);router[_0xb991('0x16')](_0xb991('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb991('0x18')](_0xb991('0x10'),auth[_0xb991('0xc')](),controller[_0xb991('0x19')]);router[_0xb991('0x1a')](_0xb991('0x10'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb991('0x14'),auth[_0xb991('0xc')](),controller[_0xb991('0x1b')]);router[_0xb991('0x1a')](_0xb991('0x17'),auth[_0xb991('0xc')](),controller['removeAgents']);module[_0xb991('0x1c')]=router; \ No newline at end of file +var _0x07d0=['../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x07d0,0xd2));var _0x007d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x07d0[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x007d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x007d('0x1'));var express=require(_0x007d('0x2'));var router=express[_0x007d('0x3')]();var fs_extra=require(_0x007d('0x4'));var auth=require(_0x007d('0x5'));var interaction=require(_0x007d('0x6'));var config=require(_0x007d('0x7'));var controller=require(_0x007d('0x8'));router[_0x007d('0x9')]('/',auth['isAuthenticated'](),controller[_0x007d('0xa')]);router[_0x007d('0x9')](_0x007d('0xb'),auth[_0x007d('0xc')](),controller[_0x007d('0xd')]);router[_0x007d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x007d('0xe')]);router[_0x007d('0x9')](_0x007d('0xf'),auth[_0x007d('0xc')](),controller[_0x007d('0x10')]);router[_0x007d('0x9')](_0x007d('0x11'),auth['isAuthenticated'](),controller[_0x007d('0x12')]);router['get'](_0x007d('0x13'),auth[_0x007d('0xc')](),controller[_0x007d('0x14')]);router[_0x007d('0x15')]('/',auth[_0x007d('0xc')](),controller['create']);router[_0x007d('0x15')](_0x007d('0x11'),auth['isAuthenticated'](),controller[_0x007d('0x16')]);router[_0x007d('0x15')](_0x007d('0x13'),auth[_0x007d('0xc')](),controller[_0x007d('0x17')]);router[_0x007d('0x18')](_0x007d('0x19'),auth[_0x007d('0xc')](),controller[_0x007d('0x1a')]);router[_0x007d('0x1b')](_0x007d('0x19'),auth[_0x007d('0xc')](),controller[_0x007d('0x1c')]);router[_0x007d('0x1b')](_0x007d('0x11'),auth[_0x007d('0xc')](),controller[_0x007d('0x1d')]);router['delete'](_0x007d('0x13'),auth[_0x007d('0xc')](),controller['removeAgents']);module[_0x007d('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 3078b42..cceb9cf 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 _0x337e=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x4d68c5,_0x5e816c){var _0x399408=function(_0x2b6254){while(--_0x2b6254){_0x4d68c5['push'](_0x4d68c5['shift']());}};_0x399408(++_0x5e816c);}(_0x337e,0xe7));var _0xe337=function(_0x20ca6f,_0x34ce91){_0x20ca6f=_0x20ca6f-0x0;var _0x2e1bf3=_0x337e[_0x20ca6f];return _0x2e1bf3;};'use strict';var Sequelize=require('sequelize');module[_0xe337('0x0')]={'name':{'type':Sequelize[_0xe337('0x1')],'unique':_0xe337('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe337('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe337('0x4')](_0xe337('0x5'),'beepall',_0xe337('0x6'))}}; \ No newline at end of file +var _0x7841=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x39c895,_0x560502){var _0x440998=function(_0xd1198c){while(--_0xd1198c){_0x39c895['push'](_0x39c895['shift']());}};_0x440998(++_0x560502);}(_0x7841,0x13b));var _0x1784=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0x7841[_0x295583];return _0x4c2ae6;};'use strict';var Sequelize=require(_0x1784('0x0'));module[_0x1784('0x1')]={'name':{'type':Sequelize[_0x1784('0x2')],'unique':_0x1784('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1784('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1784('0x5'),'beepall',_0x1784('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 27fde50..7be947e 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 _0xef38=['fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','get','MailQueues','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','keys','filters','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','findAll','catch','show','intersection','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','agent','mailPause','createdAt','rows','format','SIP','updatedAt','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir'];(function(_0x47eb27,_0x22d4fc){var _0xe8cae8=function(_0x2fd189){while(--_0x2fd189){_0x47eb27['push'](_0x47eb27['shift']());}};_0xe8cae8(++_0x22d4fc);}(_0xef38,0x122));var _0x8ef3=function(_0x551073,_0x468efd){_0x551073=_0x551073-0x0;var _0x53f83a=_0xef38[_0x551073];return _0x53f83a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef3('0x0'));var zipdir=require(_0x8ef3('0x1'));var jsonpatch=require(_0x8ef3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ef3('0x3'));var Mustache=require(_0x8ef3('0x4'));var util=require(_0x8ef3('0x5'));var path=require(_0x8ef3('0x6'));var sox=require(_0x8ef3('0x7'));var csv=require('to-csv');var ejs=require(_0x8ef3('0x8'));var fs=require('fs');var fs_extra=require(_0x8ef3('0x9'));var _=require('lodash');var squel=require(_0x8ef3('0xa'));var crypto=require(_0x8ef3('0xb'));var jsforce=require(_0x8ef3('0xc'));var deskjs=require(_0x8ef3('0xd'));var toCsv=require(_0x8ef3('0xe'));var querystring=require(_0x8ef3('0xf'));var Papa=require(_0x8ef3('0x10'));var Redis=require('ioredis');var authService=require(_0x8ef3('0x11'));var qs=require(_0x8ef3('0x12'));var as=require(_0x8ef3('0x13'));var hardwareService=require(_0x8ef3('0x14'));var logger=require(_0x8ef3('0x15'))(_0x8ef3('0x16'));var utils=require(_0x8ef3('0x17'));var config=require(_0x8ef3('0x18'));var licenseUtil=require(_0x8ef3('0x19'));var db=require(_0x8ef3('0x1a'))['db'];config[_0x8ef3('0x1b')]=_[_0x8ef3('0x1c')](config[_0x8ef3('0x1b')],{'host':_0x8ef3('0x1d'),'port':0x18eb});var socket=require(_0x8ef3('0x1e'))(new Redis(config[_0x8ef3('0x1b')]));require(_0x8ef3('0x1f'))[_0x8ef3('0x20')](socket);function respondWithStatusCode(_0x398c30,_0x4972d9){_0x4972d9=_0x4972d9||0xcc;return function(_0x15c106){if(_0x15c106){return _0x398c30['sendStatus'](_0x4972d9);}return _0x398c30[_0x8ef3('0x21')](_0x4972d9)['end']();};}function respondWithResult(_0x22feec,_0x40739c){_0x40739c=_0x40739c||0xc8;return function(_0x51d134){if(_0x51d134){return _0x22feec['status'](_0x40739c)[_0x8ef3('0x22')](_0x51d134);}};}function respondWithFilteredResult(_0x2bc37a,_0x25041a){return function(_0x434aa9){if(_0x434aa9){var _0x5296f2=typeof _0x25041a['offset']===_0x8ef3('0x23')&&typeof _0x25041a[_0x8ef3('0x24')]===_0x8ef3('0x23');var _0x4163a4=_0x434aa9['count'];var _0xf6a763=_0x5296f2?0x0:_0x25041a[_0x8ef3('0x25')];var _0x2a3e8c=_0x5296f2?_0x434aa9['count']:_0x25041a['offset']+_0x25041a[_0x8ef3('0x24')];var _0xbe957b;if(_0x2a3e8c>=_0x4163a4){_0x2a3e8c=_0x4163a4;_0xbe957b=0xc8;}else{_0xbe957b=0xce;}_0x2bc37a[_0x8ef3('0x21')](_0xbe957b);return _0x2bc37a[_0x8ef3('0x26')](_0x8ef3('0x27'),_0xf6a763+'-'+_0x2a3e8c+'/'+_0x4163a4)[_0x8ef3('0x22')](_0x434aa9);}return null;};}function patchUpdates(_0x1231e8){return function(_0x547e6a){try{jsonpatch[_0x8ef3('0x28')](_0x547e6a,_0x1231e8,!![]);}catch(_0x1b3357){return BPromise['reject'](_0x1b3357);}return _0x547e6a[_0x8ef3('0x29')]();};}function saveUpdates(_0x431e8c,_0x2cd940){return function(_0x2947b9){if(_0x2947b9){return _0x2947b9[_0x8ef3('0x2a')](_0x431e8c)['then'](function(_0x18ef45){return _0x18ef45;});}return null;};}function removeEntity(_0x3c4581,_0x33f885){return function(_0x46f2cb){if(_0x46f2cb){return _0x46f2cb['destroy']()[_0x8ef3('0x2b')](function(){var _0x28637a=_0x46f2cb[_0x8ef3('0x2c')]({'plain':!![]});var _0x2b4752=_0x8ef3('0x2d');return db[_0x8ef3('0x2e')][_0x8ef3('0x2f')]({'where':{'type':_0x2b4752,'resourceId':_0x28637a['id']}})[_0x8ef3('0x2b')](function(){return _0x46f2cb;});})[_0x8ef3('0x2b')](function(){_0x3c4581[_0x8ef3('0x21')](0xcc)[_0x8ef3('0x30')]();});}};}function handleEntityNotFound(_0x594a25,_0x4408f9){return function(_0x1c34d5){if(!_0x1c34d5){_0x594a25[_0x8ef3('0x31')](0x194);}return _0x1c34d5;};}function handleError(_0x2b33af,_0x3b9d3a){_0x3b9d3a=_0x3b9d3a||0x1f4;return function(_0x451027){logger[_0x8ef3('0x32')](_0x451027['stack']);if(_0x451027['name']){delete _0x451027[_0x8ef3('0x33')];}_0x2b33af['status'](_0x3b9d3a)[_0x8ef3('0x34')](_0x451027);};}exports[_0x8ef3('0x35')]=function(_0x442ed2,_0x58c80c){var _0x4ff1b6={},_0x5465f6={},_0x51c094={'count':0x0,'rows':[]};var _0x5d88ab=_[_0x8ef3('0x36')](db[_0x8ef3('0x37')][_0x8ef3('0x38')],function(_0x58432b){return{'name':_0x58432b[_0x8ef3('0x39')],'type':_0x58432b[_0x8ef3('0x3a')]['key']};});_0x5465f6[_0x8ef3('0x3b')]=_[_0x8ef3('0x36')](_0x5d88ab,_0x8ef3('0x33'));_0x5465f6['query']=_[_0x8ef3('0x3c')](_0x442ed2['query']);_0x5465f6[_0x8ef3('0x3d')]=_['intersection'](_0x5465f6['model'],_0x5465f6['query']);_0x4ff1b6['attributes']=_['intersection'](_0x5465f6[_0x8ef3('0x3b')],qs['fields'](_0x442ed2[_0x8ef3('0x3e')]['fields']));_0x4ff1b6[_0x8ef3('0x3f')]=_0x4ff1b6[_0x8ef3('0x3f')][_0x8ef3('0x40')]?_0x4ff1b6['attributes']:_0x5465f6['model'];if(!_0x442ed2[_0x8ef3('0x3e')][_0x8ef3('0x41')](_0x8ef3('0x42'))){_0x4ff1b6[_0x8ef3('0x24')]=qs[_0x8ef3('0x24')](_0x442ed2['query'][_0x8ef3('0x24')]);_0x4ff1b6[_0x8ef3('0x25')]=qs[_0x8ef3('0x25')](_0x442ed2['query'][_0x8ef3('0x25')]);}_0x4ff1b6['order']=qs[_0x8ef3('0x43')](_0x442ed2[_0x8ef3('0x3e')][_0x8ef3('0x43')]);_0x4ff1b6[_0x8ef3('0x44')]=qs['filters'](_[_0x8ef3('0x45')](_0x442ed2[_0x8ef3('0x3e')],_0x5465f6['filters']),_0x5d88ab);if(_0x442ed2[_0x8ef3('0x3e')][_0x8ef3('0x46')]){_0x4ff1b6[_0x8ef3('0x44')]=_[_0x8ef3('0x47')](_0x4ff1b6[_0x8ef3('0x44')],{'$or':_[_0x8ef3('0x36')](_0x5d88ab,function(_0x158c29){if(_0x158c29[_0x8ef3('0x3a')]!=='VIRTUAL'){var _0x221040={};_0x221040[_0x158c29[_0x8ef3('0x33')]]={'$like':'%'+_0x442ed2[_0x8ef3('0x3e')][_0x8ef3('0x46')]+'%'};return _0x221040;}})});}_0x4ff1b6=_[_0x8ef3('0x47')]({},_0x4ff1b6,_0x442ed2['options']);var _0x454beb={'where':_0x4ff1b6['where']};return db[_0x8ef3('0x37')][_0x8ef3('0x48')](_0x454beb)[_0x8ef3('0x2b')](function(_0x1b30f8){_0x51c094['count']=_0x1b30f8;if(_0x442ed2['query'][_0x8ef3('0x49')]){_0x4ff1b6['include']=[{'all':!![]}];}return db[_0x8ef3('0x37')][_0x8ef3('0x4a')](_0x4ff1b6);})[_0x8ef3('0x2b')](function(_0x3eb20b){_0x51c094['rows']=_0x3eb20b;return _0x51c094;})[_0x8ef3('0x2b')](respondWithFilteredResult(_0x58c80c,_0x4ff1b6))[_0x8ef3('0x4b')](handleError(_0x58c80c,null));};exports[_0x8ef3('0x4c')]=function(_0x1ac8d2,_0x3e4940){var _0x4a3d37={'raw':!![],'where':{'id':_0x1ac8d2['params']['id']}},_0x126066={};_0x126066[_0x8ef3('0x3b')]=_[_0x8ef3('0x3c')](db[_0x8ef3('0x37')]['rawAttributes']);_0x126066[_0x8ef3('0x3e')]=_[_0x8ef3('0x3c')](_0x1ac8d2[_0x8ef3('0x3e')]);_0x126066['filters']=_[_0x8ef3('0x4d')](_0x126066[_0x8ef3('0x3b')],_0x126066[_0x8ef3('0x3e')]);_0x4a3d37['attributes']=_[_0x8ef3('0x4d')](_0x126066[_0x8ef3('0x3b')],qs['fields'](_0x1ac8d2['query'][_0x8ef3('0x4e')]));_0x4a3d37[_0x8ef3('0x3f')]=_0x4a3d37[_0x8ef3('0x3f')][_0x8ef3('0x40')]?_0x4a3d37['attributes']:_0x126066[_0x8ef3('0x3b')];if(_0x1ac8d2[_0x8ef3('0x3e')][_0x8ef3('0x49')]){_0x4a3d37['include']=[{'all':!![]}];}_0x4a3d37=_[_0x8ef3('0x47')]({},_0x4a3d37,_0x1ac8d2[_0x8ef3('0x4f')]);return db[_0x8ef3('0x37')][_0x8ef3('0x50')](_0x4a3d37)[_0x8ef3('0x2b')](handleEntityNotFound(_0x3e4940,null))[_0x8ef3('0x2b')](respondWithResult(_0x3e4940,null))[_0x8ef3('0x4b')](handleError(_0x3e4940,null));};exports[_0x8ef3('0x51')]=function(_0x131740,_0x3be8e0){return db[_0x8ef3('0x37')][_0x8ef3('0x51')](_0x131740['body'],{})[_0x8ef3('0x2b')](function(_0x131e6b){var _0x2a7a56=_0x131740[_0x8ef3('0x52')]['get']({'plain':!![]});if(!_0x2a7a56)throw new Error(_0x8ef3('0x53'));if(_0x2a7a56['role']==='user'){var _0x334e5=_0x131e6b[_0x8ef3('0x2c')]({'plain':!![]});var _0x4322cc=_0x8ef3('0x2d');return db[_0x8ef3('0x54')][_0x8ef3('0x50')]({'where':{'name':_0x4322cc,'userProfileId':_0x2a7a56[_0x8ef3('0x55')]},'raw':!![]})[_0x8ef3('0x2b')](function(_0x344d74){if(_0x344d74&&_0x344d74[_0x8ef3('0x56')]===0x0){return db[_0x8ef3('0x2e')][_0x8ef3('0x51')]({'name':_0x334e5[_0x8ef3('0x33')],'resourceId':_0x334e5['id'],'type':_0x344d74[_0x8ef3('0x33')],'sectionId':_0x344d74['id']},{})[_0x8ef3('0x2b')](function(){return _0x131e6b;});}else{return _0x131e6b;}})['catch'](function(_0x122d6f){logger['error'](_0x8ef3('0x57'),_0x122d6f);throw _0x122d6f;});}return _0x131e6b;})[_0x8ef3('0x2b')](respondWithResult(_0x3be8e0,0xc9))[_0x8ef3('0x4b')](handleError(_0x3be8e0,null));};exports[_0x8ef3('0x2a')]=function(_0x565b46,_0x3d6055){if(_0x565b46[_0x8ef3('0x58')]['id']){delete _0x565b46[_0x8ef3('0x58')]['id'];}return db[_0x8ef3('0x37')][_0x8ef3('0x50')]({'where':{'id':_0x565b46[_0x8ef3('0x59')]['id']}})['then'](handleEntityNotFound(_0x3d6055,null))[_0x8ef3('0x2b')](saveUpdates(_0x565b46['body'],null))[_0x8ef3('0x2b')](respondWithResult(_0x3d6055,null))[_0x8ef3('0x4b')](handleError(_0x3d6055,null));};exports[_0x8ef3('0x2f')]=function(_0x28dd8d,_0x2291a3){return db['MailQueue']['find']({'where':{'id':_0x28dd8d[_0x8ef3('0x59')]['id']}})['then'](handleEntityNotFound(_0x2291a3,null))['then'](removeEntity(_0x2291a3,null))['catch'](handleError(_0x2291a3,null));};exports[_0x8ef3('0x5a')]=function(_0x138fa3,_0x25ee2e){return db['MailQueue'][_0x8ef3('0x5a')]()['then'](respondWithResult(_0x25ee2e,null))[_0x8ef3('0x4b')](handleError(_0x25ee2e,null));};exports['getMembers']=function(_0x503669,_0x197b4b,_0x380c11){var _0x7cc32c={'raw':!![],'where':{}},_0x17bbab={},_0x4b44dd;return db[_0x8ef3('0x37')][_0x8ef3('0x5b')]({'where':{'id':_0x503669['params']['id']}})[_0x8ef3('0x2b')](handleEntityNotFound(_0x197b4b,null))['then'](function(_0x3ee440){if(_0x3ee440){_0x4b44dd=_0x3ee440[_0x8ef3('0x2c')]({'plain':!![]});_0x17bbab[_0x8ef3('0x3b')]=_[_0x8ef3('0x3c')](db[_0x8ef3('0x5c')][_0x8ef3('0x38')]);_0x17bbab[_0x8ef3('0x3e')]=_[_0x8ef3('0x3c')](_0x503669[_0x8ef3('0x3e')]);_0x17bbab[_0x8ef3('0x3d')]=_[_0x8ef3('0x4d')](_0x17bbab[_0x8ef3('0x3b')],_0x17bbab['query']);_0x7cc32c[_0x8ef3('0x3f')]=_[_0x8ef3('0x4d')](_0x17bbab[_0x8ef3('0x3b')],qs[_0x8ef3('0x4e')](_0x503669[_0x8ef3('0x3e')][_0x8ef3('0x4e')]));_0x7cc32c[_0x8ef3('0x3f')]=_0x7cc32c[_0x8ef3('0x3f')]['length']?_0x7cc32c[_0x8ef3('0x3f')]:_0x17bbab[_0x8ef3('0x3b')];if(!_0x503669[_0x8ef3('0x3e')]['hasOwnProperty'](_0x8ef3('0x42'))){_0x7cc32c[_0x8ef3('0x24')]=qs['limit'](_0x503669[_0x8ef3('0x3e')][_0x8ef3('0x24')]);_0x7cc32c['offset']=qs[_0x8ef3('0x25')](_0x503669[_0x8ef3('0x3e')]['offset']);}_0x7cc32c['order']=qs[_0x8ef3('0x43')](_0x503669[_0x8ef3('0x3e')][_0x8ef3('0x43')]);_0x7cc32c[_0x8ef3('0x44')]=qs[_0x8ef3('0x3d')](_[_0x8ef3('0x45')](_0x503669[_0x8ef3('0x3e')],_0x17bbab[_0x8ef3('0x3d')]));_0x7cc32c['where'][_0x8ef3('0x5d')]=_0x3ee440['id'];if(_0x503669[_0x8ef3('0x3e')][_0x8ef3('0x46')]){_0x7cc32c[_0x8ef3('0x44')]=_[_0x8ef3('0x47')](_0x7cc32c[_0x8ef3('0x44')],{'$or':_[_0x8ef3('0x36')](_0x7cc32c['attributes'],function(_0x782a7e){var _0x438780={};_0x438780[_0x782a7e]={'$like':'%'+_0x503669[_0x8ef3('0x3e')]['filter']+'%'};return _0x438780;})});}_0x7cc32c=_[_0x8ef3('0x47')]({},_0x7cc32c,_0x503669[_0x8ef3('0x4f')]);return db[_0x8ef3('0x5c')][_0x8ef3('0x4a')](_0x7cc32c);}})['then'](function(_0x464d4d){if(_0x464d4d){return db[_0x8ef3('0x5e')][_0x8ef3('0x5f')]({'where':{'id':_[_0x8ef3('0x36')](_0x464d4d,'UserId'),'role':_0x8ef3('0x60')},'attributes':['id',_0x8ef3('0x33'),_0x8ef3('0x61'),'updatedAt',_0x8ef3('0x62')]});}})[_0x8ef3('0x2b')](function(_0x299a27){if(_0x299a27){return{'count':_0x299a27[_0x8ef3('0x48')],'rows':_['map'](_0x299a27[_0x8ef3('0x63')],function(_0x535c35){return{'membername':_0x535c35[_0x8ef3('0x33')],'UserId':_0x535c35['id'],'queue_name':_0x4b44dd[_0x8ef3('0x33')],'MailQueueId':_0x4b44dd['id'],'interface':util[_0x8ef3('0x64')]('%s/%s',_0x8ef3('0x65'),_0x535c35[_0x8ef3('0x33')]),'penalty':0x0,'paused':_0x535c35[_0x8ef3('0x61')],'createdAt':_0x535c35[_0x8ef3('0x62')],'updatedAt':_0x535c35[_0x8ef3('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ef3('0x2b')](respondWithFilteredResult(_0x197b4b,_0x7cc32c))[_0x8ef3('0x4b')](handleError(_0x197b4b,null));};exports['getTeams']=function(_0x2ecf1d,_0x29a9d3,_0x3f962b){var _0x1b4e17={};var _0x52c717={};var _0x364b15;var _0x6ac2cb;return db[_0x8ef3('0x37')]['findOne']({'where':{'id':_0x2ecf1d['params']['id']}})['then'](handleEntityNotFound(_0x29a9d3,null))[_0x8ef3('0x2b')](function(_0x4b4926){if(_0x4b4926){_0x364b15=_0x4b4926;_0x52c717[_0x8ef3('0x3b')]=_[_0x8ef3('0x3c')](db[_0x8ef3('0x67')][_0x8ef3('0x38')]);_0x52c717[_0x8ef3('0x3e')]=_[_0x8ef3('0x3c')](_0x2ecf1d[_0x8ef3('0x3e')]);_0x52c717[_0x8ef3('0x3d')]=_['intersection'](_0x52c717[_0x8ef3('0x3b')],_0x52c717[_0x8ef3('0x3e')]);_0x1b4e17[_0x8ef3('0x3f')]=_[_0x8ef3('0x4d')](_0x52c717[_0x8ef3('0x3b')],qs[_0x8ef3('0x4e')](_0x2ecf1d[_0x8ef3('0x3e')][_0x8ef3('0x4e')]));_0x1b4e17[_0x8ef3('0x3f')]=_0x1b4e17[_0x8ef3('0x3f')][_0x8ef3('0x40')]?_0x1b4e17[_0x8ef3('0x3f')]:_0x52c717[_0x8ef3('0x3b')];_0x1b4e17[_0x8ef3('0x68')]=qs['sort'](_0x2ecf1d['query']['sort']);_0x1b4e17[_0x8ef3('0x44')]=qs[_0x8ef3('0x3d')](_[_0x8ef3('0x45')](_0x2ecf1d[_0x8ef3('0x3e')],_0x52c717[_0x8ef3('0x3d')]));if(_0x2ecf1d[_0x8ef3('0x3e')]['filter']){_0x1b4e17[_0x8ef3('0x44')]=_[_0x8ef3('0x47')](_0x1b4e17[_0x8ef3('0x44')],{'$or':_[_0x8ef3('0x36')](_0x1b4e17[_0x8ef3('0x3f')],function(_0x361e28){var _0xfe8789={};_0xfe8789[_0x361e28]={'$like':'%'+_0x2ecf1d[_0x8ef3('0x3e')][_0x8ef3('0x46')]+'%'};return _0xfe8789;})});}_0x1b4e17=_[_0x8ef3('0x47')]({},_0x1b4e17,_0x2ecf1d['options']);return _0x364b15['getTeams'](_0x1b4e17);}})[_0x8ef3('0x2b')](function(_0x3c527e){if(_0x3c527e){_0x6ac2cb=_0x3c527e[_0x8ef3('0x40')];if(!_0x2ecf1d[_0x8ef3('0x3e')]['hasOwnProperty'](_0x8ef3('0x42'))){_0x1b4e17[_0x8ef3('0x24')]=qs[_0x8ef3('0x24')](_0x2ecf1d['query'][_0x8ef3('0x24')]);_0x1b4e17[_0x8ef3('0x25')]=qs[_0x8ef3('0x25')](_0x2ecf1d[_0x8ef3('0x3e')][_0x8ef3('0x25')]);}return _0x364b15['getTeams'](_0x1b4e17);}})['then'](function(_0x335c10){if(_0x335c10){return _0x335c10?{'count':_0x6ac2cb,'rows':_0x335c10}:null;}})[_0x8ef3('0x2b')](respondWithResult(_0x29a9d3,null))[_0x8ef3('0x4b')](handleError(_0x29a9d3,null));};exports[_0x8ef3('0x69')]=function(_0x6e7452,_0x1b3414,_0x515ce2){var _0x50a202=_0x6e7452[_0x8ef3('0x58')][_0x8ef3('0x6a')];return db[_0x8ef3('0x67')]['findAll']({'where':{'id':_0x50a202},'attributes':['id'],'include':[{'model':db[_0x8ef3('0x5e')],'as':_0x8ef3('0x6b'),'attributes':['id',_0x8ef3('0x33'),_0x8ef3('0x6c'),_0x8ef3('0x6d'),_0x8ef3('0x6e')],'raw':!![]}]})[_0x8ef3('0x2b')](function(_0xb4f35f){if(_0xb4f35f){var _0x4796ef=_['flatMap'](_0xb4f35f,function(_0x293138){var _0x50087c=_0x293138[_0x8ef3('0x2c')]({'plain':!![]});return _0x50087c[_0x8ef3('0x6b')];});return db[_0x8ef3('0x37')]['find']({'where':{'id':_0x6e7452[_0x8ef3('0x59')]['id']}})[_0x8ef3('0x2b')](function(_0xb25880){return db[_0x8ef3('0x6f')][_0x8ef3('0x70')](function(_0x53dc0d){return _0xb25880[_0x8ef3('0x69')](_0x50a202,{'transaction':_0x53dc0d})['then'](function(){return BPromise[_0x8ef3('0x71')](_0x4796ef,function(_0xf98d94){return db[_0x8ef3('0x5c')][_0x8ef3('0x72')]({'where':{'UserId':_0xf98d94['id'],'MailQueueId':_0x6e7452[_0x8ef3('0x59')]['id']},'transaction':_0x53dc0d});});})[_0x8ef3('0x2b')](function(){_0x4796ef[_0x8ef3('0x73')](function(_0x1362d3){socket['emit']('userMailQueue:save',{'UserId':_0x1362d3['id'],'MailQueueId':_0xb25880['id']});});});});});}})['then'](respondWithStatusCode(_0x1b3414,null))[_0x8ef3('0x4b')](handleError(_0x1b3414,null));};exports[_0x8ef3('0x74')]=function(_0xfe8c97,_0x58d7e0,_0x3f990e){return db[_0x8ef3('0x67')][_0x8ef3('0x4a')]({'where':{'id':_0xfe8c97[_0x8ef3('0x3e')][_0x8ef3('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8ef3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8ef3('0x2b')](handleEntityNotFound(_0x58d7e0,null))[_0x8ef3('0x2b')](function(_0x39ae11){var _0xcbc2b6=_['map'](_0x39ae11,'id');var _0xf4deb1=[];var _0x43a9ef=[];var _0x4091dd=squel[_0x8ef3('0x75')]();_0x4091dd[_0x8ef3('0x76')](_0x8ef3('0x77'))[_0x8ef3('0x78')](_0x8ef3('0x79'),'tq')[_0x8ef3('0x7a')](_0x8ef3('0x7b'),'ut',_0x8ef3('0x7c'))['where'](_0x8ef3('0x7d'),_0xfe8c97[_0x8ef3('0x59')]['id']);for(var _0x409981=0x0;_0x409981<_0x39ae11[_0x8ef3('0x40')];_0x409981+=0x1){let _0x189e93=_0x39ae11[_0x409981];for(var _0x392209=0x0;_0x392209<_0x189e93[_0x8ef3('0x6b')][_0x8ef3('0x40')];_0x392209+=0x1){let _0x2a5a7a=_0x189e93['Agents'][_0x392209];var _0x33090d=_0x4091dd[_0x8ef3('0x7e')]();_0x33090d[_0x8ef3('0x44')](_0x8ef3('0x7f'),_0x2a5a7a['id']);_0x43a9ef[_0x8ef3('0x80')](db[_0x8ef3('0x6f')][_0x8ef3('0x3e')](_0x33090d['toString'](),{'type':db[_0x8ef3('0x6f')][_0x8ef3('0x81')][_0x8ef3('0x82')]})[_0x8ef3('0x2b')](function(_0xb4b066){if(_0xb4b066[_0x8ef3('0x40')]===0x1){return _0x2a5a7a['id'];}else{var _0x3c9088=_[_0x8ef3('0x83')](_[_0x8ef3('0x36')](_0xb4b066,_0x8ef3('0x84')),function(_0x4fbe54){return _[_0x8ef3('0x85')](_0xcbc2b6,_0x4fbe54);});if(_0x3c9088){return _0x2a5a7a['id'];}}}));}}return BPromise[_0x8ef3('0x86')](_0x43a9ef)[_0x8ef3('0x2b')](function(_0x39bb48){_0xf4deb1=_(_0xf4deb1)['union'](_0x39bb48)[_0x8ef3('0x87')]()[_0x8ef3('0x88')]();return db[_0x8ef3('0x37')][_0x8ef3('0x50')]({'where':{'id':_0xfe8c97[_0x8ef3('0x59')]['id']}})[_0x8ef3('0x2b')](function(_0xdb0fcd){return db['sequelize']['transaction'](function(_0x50e354){return _0xdb0fcd[_0x8ef3('0x74')](_0xfe8c97[_0x8ef3('0x3e')][_0x8ef3('0x6a')],{'transaction':_0x50e354})[_0x8ef3('0x2b')](function(){if(!_[_0x8ef3('0x89')](_0xf4deb1)){return _0xdb0fcd[_0x8ef3('0x8a')](_0xf4deb1,{'transaction':_0x50e354});}})[_0x8ef3('0x2b')](function(){_0xf4deb1[_0x8ef3('0x73')](function(_0x34ba23){socket[_0x8ef3('0x8b')](_0x8ef3('0x8c'),{'UserId':_0x34ba23,'MailQueueId':_0xdb0fcd['id']});});});});});});})[_0x8ef3('0x2b')](respondWithStatusCode(_0x58d7e0,null))['catch'](handleError(_0x58d7e0,null));};exports[_0x8ef3('0x8d')]=function(_0x51bf0d,_0x3773c5,_0x267f42){return db[_0x8ef3('0x37')]['find']({'where':{'id':_0x51bf0d['params']['id']}})[_0x8ef3('0x2b')](handleEntityNotFound(_0x3773c5,null))['then'](function(_0x5caea0){if(_0x5caea0){return _0x5caea0[_0x8ef3('0x8d')](_0x51bf0d['body']['ids'],_[_0x8ef3('0x8e')](_0x51bf0d[_0x8ef3('0x58')],[_0x8ef3('0x6a'),'id'])||{})[_0x8ef3('0x8f')](function(_0x2ce73c){for(var _0x4d60e4=0x0;_0x4d60e4<_0x51bf0d[_0x8ef3('0x58')][_0x8ef3('0x6a')]['length'];_0x4d60e4+=0x1){socket[_0x8ef3('0x8b')]('userMailQueue:save',{'UserId':Number(_0x51bf0d['body'][_0x8ef3('0x6a')][_0x4d60e4]),'MailQueueId':Number(_0x51bf0d[_0x8ef3('0x59')]['id'])});}return _0x2ce73c;});}})[_0x8ef3('0x2b')](respondWithResult(_0x3773c5,null))[_0x8ef3('0x4b')](handleError(_0x3773c5,null));};exports[_0x8ef3('0x8a')]=function(_0x3d47f3,_0x19e655,_0x3080bc){return db['MailQueue'][_0x8ef3('0x50')]({'where':{'id':_0x3d47f3['params']['id']}})['then'](handleEntityNotFound(_0x19e655,null))['then'](function(_0x1ad7ac){if(_0x1ad7ac){return _0x1ad7ac[_0x8ef3('0x8a')](_0x3d47f3['query'][_0x8ef3('0x6a')])[_0x8ef3('0x2b')](function(){if(_[_0x8ef3('0x90')](_0x3d47f3[_0x8ef3('0x3e')]['ids'])){for(var _0x116752=0x0;_0x116752<_0x3d47f3[_0x8ef3('0x3e')][_0x8ef3('0x6a')][_0x8ef3('0x40')];_0x116752+=0x1){socket[_0x8ef3('0x8b')](_0x8ef3('0x8c'),{'UserId':Number(_0x3d47f3['query'][_0x8ef3('0x6a')][_0x116752]),'MailQueueId':Number(_0x3d47f3[_0x8ef3('0x59')]['id'])});}}else{socket[_0x8ef3('0x8b')](_0x8ef3('0x8c'),{'UserId':Number(_0x3d47f3['query'][_0x8ef3('0x6a')]),'MailQueueId':Number(_0x3d47f3[_0x8ef3('0x59')]['id'])});}});}})[_0x8ef3('0x2b')](respondWithStatusCode(_0x19e655,null))[_0x8ef3('0x4b')](handleError(_0x19e655,null));};exports[_0x8ef3('0x91')]=function(_0x557f98,_0x1d047c,_0x5cd1ff){var _0xa2b1f3={};var _0xaa7296={};var _0x384f0c;var _0x6070a;return db[_0x8ef3('0x37')]['findOne']({'where':{'id':_0x557f98[_0x8ef3('0x59')]['id']}})[_0x8ef3('0x2b')](handleEntityNotFound(_0x1d047c,null))[_0x8ef3('0x2b')](function(_0x4714be){if(_0x4714be){_0x384f0c=_0x4714be;_0xaa7296[_0x8ef3('0x3b')]=_[_0x8ef3('0x3c')](db['User'][_0x8ef3('0x38')]);_0xaa7296[_0x8ef3('0x3e')]=_[_0x8ef3('0x3c')](_0x557f98[_0x8ef3('0x3e')]);_0xaa7296[_0x8ef3('0x3d')]=_[_0x8ef3('0x4d')](_0xaa7296[_0x8ef3('0x3b')],_0xaa7296[_0x8ef3('0x3e')]);_0xa2b1f3[_0x8ef3('0x3f')]=_[_0x8ef3('0x4d')](_0xaa7296['model'],qs[_0x8ef3('0x4e')](_0x557f98[_0x8ef3('0x3e')]['fields']));_0xa2b1f3[_0x8ef3('0x3f')]=_0xa2b1f3[_0x8ef3('0x3f')][_0x8ef3('0x40')]?_0xa2b1f3[_0x8ef3('0x3f')]:_0xaa7296[_0x8ef3('0x3b')];_0xa2b1f3['order']=qs[_0x8ef3('0x43')](_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x43')]);_0xa2b1f3[_0x8ef3('0x44')]=qs[_0x8ef3('0x3d')](_[_0x8ef3('0x45')](_0x557f98[_0x8ef3('0x3e')],_0xaa7296[_0x8ef3('0x3d')]));if(_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x46')]){_0xa2b1f3[_0x8ef3('0x44')]=_[_0x8ef3('0x47')](_0xa2b1f3[_0x8ef3('0x44')],{'$or':_['map'](_0xa2b1f3[_0x8ef3('0x3f')],function(_0x3b0b25){var _0x5c88e1={};_0x5c88e1[_0x3b0b25]={'$like':'%'+_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x46')]+'%'};return _0x5c88e1;})});}_0xa2b1f3=_[_0x8ef3('0x47')]({},_0xa2b1f3,_0x557f98['options']);return _0x384f0c['getAgents'](_0xa2b1f3);}})[_0x8ef3('0x2b')](function(_0x1ab2cb){if(_0x1ab2cb){_0x6070a=_0x1ab2cb[_0x8ef3('0x40')];if(!_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x41')](_0x8ef3('0x42'))){_0xa2b1f3[_0x8ef3('0x24')]=qs['limit'](_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x24')]);_0xa2b1f3[_0x8ef3('0x25')]=qs[_0x8ef3('0x25')](_0x557f98[_0x8ef3('0x3e')][_0x8ef3('0x25')]);}return _0x384f0c[_0x8ef3('0x91')](_0xa2b1f3);}})[_0x8ef3('0x2b')](function(_0x3712bc){if(_0x3712bc){return _0x3712bc?{'count':_0x6070a,'rows':_0x3712bc}:null;}})[_0x8ef3('0x2b')](respondWithResult(_0x1d047c,null))[_0x8ef3('0x4b')](handleError(_0x1d047c,null));}; \ No newline at end of file +var _0xfb00=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','sort','UserId','mailPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','query','filters'];(function(_0x5f442c,_0x1b1f0c){var _0x4efe84=function(_0x3df02f){while(--_0x3df02f){_0x5f442c['push'](_0x5f442c['shift']());}};_0x4efe84(++_0x1b1f0c);}(_0xfb00,0x167));var _0x0fb0=function(_0x214e65,_0xf94da6){_0x214e65=_0x214e65-0x0;var _0x4dd397=_0xfb00[_0x214e65];return _0x4dd397;};'use strict';var emlformat=require(_0x0fb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fb0('0x1'));var jsonpatch=require(_0x0fb0('0x2'));var rp=require(_0x0fb0('0x3'));var moment=require(_0x0fb0('0x4'));var BPromise=require(_0x0fb0('0x5'));var Mustache=require(_0x0fb0('0x6'));var util=require('util');var path=require(_0x0fb0('0x7'));var sox=require(_0x0fb0('0x8'));var csv=require('to-csv');var ejs=require(_0x0fb0('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fb0('0xb'));var toCsv=require(_0x0fb0('0xc'));var querystring=require('querystring');var Papa=require(_0x0fb0('0xd'));var Redis=require(_0x0fb0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fb0('0xf'));var hardwareService=require(_0x0fb0('0x10'));var logger=require(_0x0fb0('0x11'))(_0x0fb0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fb0('0x13'))['db'];config[_0x0fb0('0x14')]=_[_0x0fb0('0x15')](config[_0x0fb0('0x14')],{'host':_0x0fb0('0x16'),'port':0x18eb});var socket=require(_0x0fb0('0x17'))(new Redis(config['redis']));require(_0x0fb0('0x18'))[_0x0fb0('0x19')](socket);function respondWithStatusCode(_0x152bd8,_0x210a73){_0x210a73=_0x210a73||0xcc;return function(_0x156ba2){if(_0x156ba2){return _0x152bd8[_0x0fb0('0x1a')](_0x210a73);}return _0x152bd8[_0x0fb0('0x1b')](_0x210a73)[_0x0fb0('0x1c')]();};}function respondWithResult(_0x3a0248,_0x4747e9){_0x4747e9=_0x4747e9||0xc8;return function(_0x2febef){if(_0x2febef){return _0x3a0248['status'](_0x4747e9)[_0x0fb0('0x1d')](_0x2febef);}};}function respondWithFilteredResult(_0x158397,_0x11c529){return function(_0x2d911a){if(_0x2d911a){var _0x266334=typeof _0x11c529[_0x0fb0('0x1e')]===_0x0fb0('0x1f')&&typeof _0x11c529['limit']===_0x0fb0('0x1f');var _0x55512e=_0x2d911a[_0x0fb0('0x20')];var _0x352587=_0x266334?0x0:_0x11c529[_0x0fb0('0x1e')];var _0x48a360=_0x266334?_0x2d911a['count']:_0x11c529[_0x0fb0('0x1e')]+_0x11c529[_0x0fb0('0x21')];var _0x50f93d;if(_0x48a360>=_0x55512e){_0x48a360=_0x55512e;_0x50f93d=0xc8;}else{_0x50f93d=0xce;}_0x158397[_0x0fb0('0x1b')](_0x50f93d);return _0x158397[_0x0fb0('0x22')](_0x0fb0('0x23'),_0x352587+'-'+_0x48a360+'/'+_0x55512e)[_0x0fb0('0x1d')](_0x2d911a);}return null;};}function patchUpdates(_0x1ac214){return function(_0x8980c){try{jsonpatch[_0x0fb0('0x24')](_0x8980c,_0x1ac214,!![]);}catch(_0x8358ef){return BPromise[_0x0fb0('0x25')](_0x8358ef);}return _0x8980c[_0x0fb0('0x26')]();};}function saveUpdates(_0x47994a,_0x3b2e0a){return function(_0x222081){if(_0x222081){return _0x222081[_0x0fb0('0x27')](_0x47994a)[_0x0fb0('0x28')](function(_0x25f4cd){return _0x25f4cd;});}return null;};}function removeEntity(_0x2ec1f7,_0xed5a56){return function(_0x29e849){if(_0x29e849){return _0x29e849[_0x0fb0('0x29')]()['then'](function(){var _0x21cb89=_0x29e849['get']({'plain':!![]});var _0xa2619a=_0x0fb0('0x2a');return db[_0x0fb0('0x2b')][_0x0fb0('0x29')]({'where':{'type':_0xa2619a,'resourceId':_0x21cb89['id']}})[_0x0fb0('0x28')](function(){return _0x29e849;});})[_0x0fb0('0x28')](function(){_0x2ec1f7['status'](0xcc)[_0x0fb0('0x1c')]();});}};}function handleEntityNotFound(_0x2a5873,_0xd3caf1){return function(_0x21a76d){if(!_0x21a76d){_0x2a5873[_0x0fb0('0x1a')](0x194);}return _0x21a76d;};}function handleError(_0x49b493,_0x496982){_0x496982=_0x496982||0x1f4;return function(_0x5f0b44){logger[_0x0fb0('0x2c')](_0x5f0b44[_0x0fb0('0x2d')]);if(_0x5f0b44[_0x0fb0('0x2e')]){delete _0x5f0b44[_0x0fb0('0x2e')];}_0x49b493['status'](_0x496982)['send'](_0x5f0b44);};}exports[_0x0fb0('0x2f')]=function(_0xa2714c,_0x3e8fd5){var _0x5dc42b={},_0xff2b9a={},_0x1ed651={'count':0x0,'rows':[]};var _0xca48f8=_['map'](db[_0x0fb0('0x30')][_0x0fb0('0x31')],function(_0x43d61d){return{'name':_0x43d61d[_0x0fb0('0x32')],'type':_0x43d61d[_0x0fb0('0x33')][_0x0fb0('0x34')]};});_0xff2b9a['model']=_['map'](_0xca48f8,'name');_0xff2b9a[_0x0fb0('0x35')]=_['keys'](_0xa2714c['query']);_0xff2b9a[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],_0xff2b9a['query']);_0x5dc42b[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5dc42b['attributes']=_0x5dc42b[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5dc42b[_0x0fb0('0x39')]:_0xff2b9a[_0x0fb0('0x38')];if(!_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3c')](_0x0fb0('0x3d'))){_0x5dc42b[_0x0fb0('0x21')]=qs['limit'](_0xa2714c['query'][_0x0fb0('0x21')]);_0x5dc42b[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0xa2714c['query'][_0x0fb0('0x1e')]);}_0x5dc42b[_0x0fb0('0x3e')]=qs['sort'](_0xa2714c[_0x0fb0('0x35')]['sort']);_0x5dc42b[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0xa2714c[_0x0fb0('0x35')],_0xff2b9a[_0x0fb0('0x36')]),_0xca48f8);if(_0xa2714c['query'][_0x0fb0('0x41')]){_0x5dc42b['where']=_[_0x0fb0('0x42')](_0x5dc42b[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0xca48f8,function(_0x57461c){if(_0x57461c[_0x0fb0('0x33')]!==_0x0fb0('0x44')){var _0x3e102f={};_0x3e102f[_0x57461c[_0x0fb0('0x2e')]]={'$like':'%'+_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0x3e102f;}})});}_0x5dc42b=_[_0x0fb0('0x42')]({},_0x5dc42b,_0xa2714c[_0x0fb0('0x45')]);var _0x4bf6df={'where':_0x5dc42b['where']};return db[_0x0fb0('0x30')][_0x0fb0('0x20')](_0x4bf6df)['then'](function(_0x430e53){_0x1ed651['count']=_0x430e53;if(_0xa2714c[_0x0fb0('0x35')]['includeAll']){_0x5dc42b[_0x0fb0('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x0fb0('0x47')](_0x5dc42b);})[_0x0fb0('0x28')](function(_0x10680a){_0x1ed651['rows']=_0x10680a;return _0x1ed651;})[_0x0fb0('0x28')](respondWithFilteredResult(_0x3e8fd5,_0x5dc42b))[_0x0fb0('0x48')](handleError(_0x3e8fd5,null));};exports[_0x0fb0('0x49')]=function(_0x757b7d,_0x26ea0c){var _0x5553d2={'raw':!![],'where':{'id':_0x757b7d[_0x0fb0('0x4a')]['id']}},_0x1ae094={};_0x1ae094[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x30')][_0x0fb0('0x31')]);_0x1ae094[_0x0fb0('0x35')]=_['keys'](_0x757b7d[_0x0fb0('0x35')]);_0x1ae094['filters']=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],_0x1ae094[_0x0fb0('0x35')]);_0x5553d2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x757b7d[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5553d2[_0x0fb0('0x39')]=_0x5553d2['attributes'][_0x0fb0('0x3b')]?_0x5553d2['attributes']:_0x1ae094[_0x0fb0('0x38')];if(_0x757b7d[_0x0fb0('0x35')]['includeAll']){_0x5553d2[_0x0fb0('0x46')]=[{'all':!![]}];}_0x5553d2=_['merge']({},_0x5553d2,_0x757b7d[_0x0fb0('0x45')]);return db['MailQueue'][_0x0fb0('0x4c')](_0x5553d2)[_0x0fb0('0x28')](handleEntityNotFound(_0x26ea0c,null))[_0x0fb0('0x28')](respondWithResult(_0x26ea0c,null))[_0x0fb0('0x48')](handleError(_0x26ea0c,null));};exports[_0x0fb0('0x4d')]=function(_0x37b8cf,_0x5ad8e5){return db['MailQueue']['create'](_0x37b8cf['body'],{})[_0x0fb0('0x28')](function(_0x5b2671){var _0x58afd0=_0x37b8cf[_0x0fb0('0x4e')][_0x0fb0('0x4f')]({'plain':!![]});if(!_0x58afd0)throw new Error(_0x0fb0('0x50'));if(_0x58afd0[_0x0fb0('0x51')]===_0x0fb0('0x4e')){var _0x5bbf56=_0x5b2671[_0x0fb0('0x4f')]({'plain':!![]});var _0x172e62=_0x0fb0('0x2a');return db['UserProfileSection'][_0x0fb0('0x4c')]({'where':{'name':_0x172e62,'userProfileId':_0x58afd0['userProfileId']},'raw':!![]})[_0x0fb0('0x28')](function(_0x23e16c){if(_0x23e16c&&_0x23e16c['autoAssociation']===0x0){return db[_0x0fb0('0x2b')]['create']({'name':_0x5bbf56[_0x0fb0('0x2e')],'resourceId':_0x5bbf56['id'],'type':_0x23e16c[_0x0fb0('0x2e')],'sectionId':_0x23e16c['id']},{})[_0x0fb0('0x28')](function(){return _0x5b2671;});}else{return _0x5b2671;}})[_0x0fb0('0x48')](function(_0x53fd34){logger[_0x0fb0('0x2c')](_0x0fb0('0x52'),_0x53fd34);throw _0x53fd34;});}return _0x5b2671;})[_0x0fb0('0x28')](respondWithResult(_0x5ad8e5,0xc9))[_0x0fb0('0x48')](handleError(_0x5ad8e5,null));};exports[_0x0fb0('0x27')]=function(_0x305d6b,_0x33e878){if(_0x305d6b[_0x0fb0('0x53')]['id']){delete _0x305d6b[_0x0fb0('0x53')]['id'];}return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x305d6b[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x33e878,null))['then'](saveUpdates(_0x305d6b[_0x0fb0('0x53')],null))['then'](respondWithResult(_0x33e878,null))['catch'](handleError(_0x33e878,null));};exports['destroy']=function(_0x136cd5,_0x3e0f61){return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x136cd5[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x3e0f61,null))[_0x0fb0('0x28')](removeEntity(_0x3e0f61,null))[_0x0fb0('0x48')](handleError(_0x3e0f61,null));};exports['describe']=function(_0x577727,_0x33802f){return db[_0x0fb0('0x30')][_0x0fb0('0x54')]()[_0x0fb0('0x28')](respondWithResult(_0x33802f,null))[_0x0fb0('0x48')](handleError(_0x33802f,null));};exports[_0x0fb0('0x55')]=function(_0x3fa17c,_0x59b32a,_0x1f53f4){var _0x5b967d={'raw':!![],'where':{}},_0x90d475={},_0x2ab6d6;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3fa17c['params']['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x59b32a,null))[_0x0fb0('0x28')](function(_0x2b0b38){if(_0x2b0b38){_0x2ab6d6=_0x2b0b38[_0x0fb0('0x4f')]({'plain':!![]});_0x90d475[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x57')][_0x0fb0('0x31')]);_0x90d475['query']=_[_0x0fb0('0x4b')](_0x3fa17c['query']);_0x90d475[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x90d475[_0x0fb0('0x38')],_0x90d475[_0x0fb0('0x35')]);_0x5b967d['attributes']=_[_0x0fb0('0x37')](_0x90d475['model'],qs[_0x0fb0('0x3a')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5b967d['attributes']=_0x5b967d[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5b967d[_0x0fb0('0x39')]:_0x90d475[_0x0fb0('0x38')];if(!_0x3fa17c[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x5b967d[_0x0fb0('0x21')]=qs[_0x0fb0('0x21')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x5b967d['offset']=qs[_0x0fb0('0x1e')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}_0x5b967d[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x3fa17c[_0x0fb0('0x35')]['sort']);_0x5b967d[_0x0fb0('0x3f')]=qs['filters'](_[_0x0fb0('0x40')](_0x3fa17c[_0x0fb0('0x35')],_0x90d475[_0x0fb0('0x36')]));_0x5b967d[_0x0fb0('0x3f')]['MailQueueId']=_0x2b0b38['id'];if(_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x5b967d[_0x0fb0('0x3f')]=_['merge'](_0x5b967d[_0x0fb0('0x3f')],{'$or':_['map'](_0x5b967d[_0x0fb0('0x39')],function(_0x797700){var _0x3ebec8={};_0x3ebec8[_0x797700]={'$like':'%'+_0x3fa17c['query'][_0x0fb0('0x41')]+'%'};return _0x3ebec8;})});}_0x5b967d=_[_0x0fb0('0x42')]({},_0x5b967d,_0x3fa17c['options']);return db[_0x0fb0('0x57')][_0x0fb0('0x47')](_0x5b967d);}})[_0x0fb0('0x28')](function(_0x3e9c9e){if(_0x3e9c9e){return db['User']['findAndCountAll']({'where':{'id':_[_0x0fb0('0x43')](_0x3e9c9e,_0x0fb0('0x59')),'role':'agent'},'attributes':['id','name',_0x0fb0('0x5a'),_0x0fb0('0x5b'),'createdAt']});}})['then'](function(_0x190c82){if(_0x190c82){return{'count':_0x190c82[_0x0fb0('0x20')],'rows':_[_0x0fb0('0x43')](_0x190c82[_0x0fb0('0x5c')],function(_0x132ffb){return{'membername':_0x132ffb[_0x0fb0('0x2e')],'UserId':_0x132ffb['id'],'queue_name':_0x2ab6d6[_0x0fb0('0x2e')],'MailQueueId':_0x2ab6d6['id'],'interface':util[_0x0fb0('0x5d')](_0x0fb0('0x5e'),_0x0fb0('0x5f'),_0x132ffb['name']),'penalty':0x0,'paused':_0x132ffb[_0x0fb0('0x5a')],'createdAt':_0x132ffb[_0x0fb0('0x60')],'updatedAt':_0x132ffb[_0x0fb0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fb0('0x28')](respondWithFilteredResult(_0x59b32a,_0x5b967d))[_0x0fb0('0x48')](handleError(_0x59b32a,null));};exports[_0x0fb0('0x61')]=function(_0x46612c,_0x3a6238,_0x1a65c1){var _0x213aa2={};var _0x2c1d93={};var _0x1e6ac0;var _0x12301a;return db['MailQueue'][_0x0fb0('0x56')]({'where':{'id':_0x46612c[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a6238,null))[_0x0fb0('0x28')](function(_0x27ce75){if(_0x27ce75){_0x1e6ac0=_0x27ce75;_0x2c1d93['model']=_[_0x0fb0('0x4b')](db[_0x0fb0('0x62')]['rawAttributes']);_0x2c1d93['query']=_[_0x0fb0('0x4b')](_0x46612c['query']);_0x2c1d93[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],_0x2c1d93['query']);_0x213aa2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x213aa2[_0x0fb0('0x39')]=_0x213aa2[_0x0fb0('0x39')]['length']?_0x213aa2[_0x0fb0('0x39')]:_0x2c1d93[_0x0fb0('0x38')];_0x213aa2[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x46612c['query'][_0x0fb0('0x58')]);_0x213aa2['where']=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0x46612c['query'],_0x2c1d93['filters']));if(_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x213aa2[_0x0fb0('0x3f')]=_['merge'](_0x213aa2['where'],{'$or':_[_0x0fb0('0x43')](_0x213aa2[_0x0fb0('0x39')],function(_0x264146){var _0xe5dff5={};_0xe5dff5[_0x264146]={'$like':'%'+_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0xe5dff5;})});}_0x213aa2=_['merge']({},_0x213aa2,_0x46612c[_0x0fb0('0x45')]);return _0x1e6ac0['getTeams'](_0x213aa2);}})[_0x0fb0('0x28')](function(_0x5a5bad){if(_0x5a5bad){_0x12301a=_0x5a5bad[_0x0fb0('0x3b')];if(!_0x46612c['query']['hasOwnProperty']('nolimit')){_0x213aa2['limit']=qs[_0x0fb0('0x21')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x213aa2[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0x46612c['query'][_0x0fb0('0x1e')]);}return _0x1e6ac0['getTeams'](_0x213aa2);}})['then'](function(_0x4f4e67){if(_0x4f4e67){return _0x4f4e67?{'count':_0x12301a,'rows':_0x4f4e67}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x3a6238,null))[_0x0fb0('0x48')](handleError(_0x3a6238,null));};exports[_0x0fb0('0x63')]=function(_0x494ac8,_0x587e1e,_0x5e9643){var _0x2783b7=_0x494ac8['body'][_0x0fb0('0x64')];return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x2783b7},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':_0x0fb0('0x66'),'attributes':['id',_0x0fb0('0x2e'),_0x0fb0('0x67'),_0x0fb0('0x68'),'interface'],'raw':!![]}]})[_0x0fb0('0x28')](function(_0x110fb0){if(_0x110fb0){var _0x3a87ca=_[_0x0fb0('0x69')](_0x110fb0,function(_0x6aa9f4){var _0x3ba0d6=_0x6aa9f4['get']({'plain':!![]});return _0x3ba0d6[_0x0fb0('0x66')];});return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x494ac8[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0x4d3bb0){return db[_0x0fb0('0x6a')][_0x0fb0('0x6b')](function(_0x4f25ee){return _0x4d3bb0[_0x0fb0('0x63')](_0x2783b7,{'transaction':_0x4f25ee})[_0x0fb0('0x28')](function(){return BPromise[_0x0fb0('0x6c')](_0x3a87ca,function(_0x19160a){return db[_0x0fb0('0x57')][_0x0fb0('0x6d')]({'where':{'UserId':_0x19160a['id'],'MailQueueId':_0x494ac8[_0x0fb0('0x4a')]['id']},'transaction':_0x4f25ee});});})['then'](function(){_0x3a87ca['forEach'](function(_0x5b8d6a){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':_0x5b8d6a['id'],'MailQueueId':_0x4d3bb0['id']});});});});});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x587e1e,null))[_0x0fb0('0x48')](handleError(_0x587e1e,null));};exports[_0x0fb0('0x70')]=function(_0x23836a,_0x59fb58,_0x24b6df){return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x23836a[_0x0fb0('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fb0('0x28')](handleEntityNotFound(_0x59fb58,null))['then'](function(_0x2c037d){var _0x3b5317=_[_0x0fb0('0x43')](_0x2c037d,'id');var _0x3c49e2=[];var _0x10f750=[];var _0x2c0803=squel[_0x0fb0('0x71')]();_0x2c0803[_0x0fb0('0x72')](_0x0fb0('0x73'))[_0x0fb0('0x74')]('team_has_mail_queues','tq')[_0x0fb0('0x75')]('user_has_teams','ut',_0x0fb0('0x76'))[_0x0fb0('0x3f')]('MailQueueId\x20=\x20?',_0x23836a[_0x0fb0('0x4a')]['id']);for(var _0xbf6ad=0x0;_0xbf6ad<_0x2c037d[_0x0fb0('0x3b')];_0xbf6ad+=0x1){let _0x1683b1=_0x2c037d[_0xbf6ad];for(var _0x2247ea=0x0;_0x2247ea<_0x1683b1[_0x0fb0('0x66')]['length'];_0x2247ea+=0x1){let _0x38c28e=_0x1683b1[_0x0fb0('0x66')][_0x2247ea];var _0x75c2ca=_0x2c0803[_0x0fb0('0x77')]();_0x75c2ca[_0x0fb0('0x3f')](_0x0fb0('0x78'),_0x38c28e['id']);_0x10f750[_0x0fb0('0x79')](db[_0x0fb0('0x6a')][_0x0fb0('0x35')](_0x75c2ca[_0x0fb0('0x7a')](),{'type':db[_0x0fb0('0x6a')][_0x0fb0('0x7b')][_0x0fb0('0x7c')]})['then'](function(_0x15ad7c){if(_0x15ad7c[_0x0fb0('0x3b')]===0x1){return _0x38c28e['id'];}else{var _0x2da8b3=_[_0x0fb0('0x7d')](_[_0x0fb0('0x43')](_0x15ad7c,'TeamId'),function(_0x46ae85){return _[_0x0fb0('0x7e')](_0x3b5317,_0x46ae85);});if(_0x2da8b3){return _0x38c28e['id'];}}}));}}return BPromise['all'](_0x10f750)[_0x0fb0('0x28')](function(_0x405563){_0x3c49e2=_(_0x3c49e2)[_0x0fb0('0x7f')](_0x405563)[_0x0fb0('0x80')]()['value']();return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x23836a[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0xb809ec){return db['sequelize']['transaction'](function(_0xf3c23e){return _0xb809ec[_0x0fb0('0x70')](_0x23836a[_0x0fb0('0x35')][_0x0fb0('0x64')],{'transaction':_0xf3c23e})[_0x0fb0('0x28')](function(){if(!_[_0x0fb0('0x81')](_0x3c49e2)){return _0xb809ec['removeAgents'](_0x3c49e2,{'transaction':_0xf3c23e});}})['then'](function(){_0x3c49e2[_0x0fb0('0x82')](function(_0x2b1c05){socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':_0x2b1c05,'MailQueueId':_0xb809ec['id']});});});});});});})[_0x0fb0('0x28')](respondWithStatusCode(_0x59fb58,null))['catch'](handleError(_0x59fb58,null));};exports[_0x0fb0('0x83')]=function(_0x3da85d,_0x2166ef,_0x2fd147){return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x3da85d[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2166ef,null))[_0x0fb0('0x28')](function(_0x51a595){if(_0x51a595){return _0x51a595[_0x0fb0('0x83')](_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')],_[_0x0fb0('0x84')](_0x3da85d[_0x0fb0('0x53')],[_0x0fb0('0x64'),'id'])||{})[_0x0fb0('0x85')](function(_0x3fa8dd){for(var _0x4710d2=0x0;_0x4710d2<_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x4710d2+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':Number(_0x3da85d[_0x0fb0('0x53')]['ids'][_0x4710d2]),'MailQueueId':Number(_0x3da85d[_0x0fb0('0x4a')]['id'])});}return _0x3fa8dd;});}})['then'](respondWithResult(_0x2166ef,null))[_0x0fb0('0x48')](handleError(_0x2166ef,null));};exports[_0x0fb0('0x86')]=function(_0x5f2d08,_0x50c810,_0x3ab885){return db[_0x0fb0('0x30')]['find']({'where':{'id':_0x5f2d08[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x50c810,null))['then'](function(_0x20fc41){if(_0x20fc41){return _0x20fc41[_0x0fb0('0x86')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])[_0x0fb0('0x28')](function(){if(_[_0x0fb0('0x87')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])){for(var _0x1841c0=0x0;_0x1841c0<_0x5f2d08['query'][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x1841c0+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x88'),{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')][_0x1841c0]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}}else{socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x50c810,null))[_0x0fb0('0x48')](handleError(_0x50c810,null));};exports[_0x0fb0('0x89')]=function(_0x3c6597,_0x5ce294,_0x893d70){var _0x9832f9={};var _0x194068={};var _0x16b1b6;var _0x252026;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3c6597[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ce294,null))[_0x0fb0('0x28')](function(_0x34c5eb){if(_0x34c5eb){_0x16b1b6=_0x34c5eb;_0x194068['model']=_['keys'](db[_0x0fb0('0x65')][_0x0fb0('0x31')]);_0x194068[_0x0fb0('0x35')]=_[_0x0fb0('0x4b')](_0x3c6597[_0x0fb0('0x35')]);_0x194068['filters']=_[_0x0fb0('0x37')](_0x194068[_0x0fb0('0x38')],_0x194068[_0x0fb0('0x35')]);_0x9832f9[_0x0fb0('0x39')]=_['intersection'](_0x194068['model'],qs[_0x0fb0('0x3a')](_0x3c6597[_0x0fb0('0x35')]['fields']));_0x9832f9[_0x0fb0('0x39')]=_0x9832f9[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x9832f9[_0x0fb0('0x39')]:_0x194068[_0x0fb0('0x38')];_0x9832f9['order']=qs[_0x0fb0('0x58')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x58')]);_0x9832f9[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_['pick'](_0x3c6597[_0x0fb0('0x35')],_0x194068[_0x0fb0('0x36')]));if(_0x3c6597[_0x0fb0('0x35')]['filter']){_0x9832f9['where']=_[_0x0fb0('0x42')](_0x9832f9[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0x9832f9['attributes'],function(_0x6e0d02){var _0x43752c={};_0x43752c[_0x6e0d02]={'$like':'%'+_0x3c6597[_0x0fb0('0x35')]['filter']+'%'};return _0x43752c;})});}_0x9832f9=_['merge']({},_0x9832f9,_0x3c6597[_0x0fb0('0x45')]);return _0x16b1b6['getAgents'](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x255322){if(_0x255322){_0x252026=_0x255322[_0x0fb0('0x3b')];if(!_0x3c6597[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x9832f9['limit']=qs['limit'](_0x3c6597['query']['limit']);_0x9832f9['offset']=qs[_0x0fb0('0x1e')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}return _0x16b1b6[_0x0fb0('0x89')](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x310c97){if(_0x310c97){return _0x310c97?{'count':_0x252026,'rows':_0x310c97}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x5ce294,null))['catch'](handleError(_0x5ce294,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 819f75a..19a451d 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 _0x8187=['hook','exports','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x12f50d,_0x11ceae){var _0x173346=function(_0x245da9){while(--_0x245da9){_0x12f50d['push'](_0x12f50d['shift']());}};_0x173346(++_0x11ceae);}(_0x8187,0x15a));var _0x7818=function(_0x41467e,_0x5264c6){_0x41467e=_0x41467e-0x0;var _0x12f6ba=_0x8187[_0x41467e];return _0x12f6ba;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x7818('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7818('0x1')](0x0);var events={'afterCreate':_0x7818('0x2'),'afterUpdate':'update','afterDestroy':_0x7818('0x3')};function emitEvent(_0x44aee6){return function(_0x1be54b,_0x1542dc,_0x13bd8c){MailQueueEvents[_0x7818('0x4')](_0x44aee6+':'+_0x1be54b['id'],_0x1be54b);MailQueueEvents[_0x7818('0x4')](_0x44aee6,_0x1be54b);_0x13bd8c(null);};}for(var e in events){if(events[_0x7818('0x5')](e)){var event=events[e];MailQueue[_0x7818('0x6')](e,emitEvent(event));}}module[_0x7818('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x293d=['hook','exports','events','MailQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x4e0897,_0x130f05){var _0x26e327=function(_0xfe536e){while(--_0xfe536e){_0x4e0897['push'](_0x4e0897['shift']());}};_0x26e327(++_0x130f05);}(_0x293d,0x119));var _0xd293=function(_0x59f99f,_0x1d6ed3){_0x59f99f=_0x59f99f-0x0;var _0x1e6165=_0x293d[_0x59f99f];return _0x1e6165;};'use strict';var EventEmitter=require(_0xd293('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xd293('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd293('0x2'),'afterUpdate':_0xd293('0x3'),'afterDestroy':_0xd293('0x4')};function emitEvent(_0x1238f5){return function(_0x58ed5f,_0x51f416,_0x2981ae){MailQueueEvents[_0xd293('0x5')](_0x1238f5+':'+_0x58ed5f['id'],_0x58ed5f);MailQueueEvents['emit'](_0x1238f5,_0x58ed5f);_0x2981ae(null);};}for(var e in events){if(events[_0xd293('0x6')](e)){var event=events[e];MailQueue[_0xd293('0x7')](e,emitEvent(event));}}module[_0xd293('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 220a5b3..6711fda 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 _0xa293=['mail_queues','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue'];(function(_0x2923c6,_0x338804){var _0x362d5d=function(_0x1448d7){while(--_0x1448d7){_0x2923c6['push'](_0x2923c6['shift']());}};_0x362d5d(++_0x338804);}(_0xa293,0x1af));var _0x3a29=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa293[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3a29('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3a29('0x1'));var rp=require(_0x3a29('0x2'));var fs=require('fs');var path=require(_0x3a29('0x3'));var rimraf=require(_0x3a29('0x4'));var config=require(_0x3a29('0x5'));var attributes=require(_0x3a29('0x6'));module['exports']=function(_0x5bc741,_0x37277b){return _0x5bc741[_0x3a29('0x7')](_0x3a29('0x8'),attributes,{'tableName':_0x3a29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9c=['MailQueue','mail_queues','api','moment','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x2aeffc,_0x4ec534){var _0x2a0d1f=function(_0x4fd7bb){while(--_0x4fd7bb){_0x2aeffc['push'](_0x2aeffc['shift']());}};_0x2a0d1f(++_0x4ec534);}(_0x9d9c,0x7a));var _0xc9d9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9d9c[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc9d9('0x0'));var moment=require(_0xc9d9('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9d9('0x2'));var rimraf=require(_0xc9d9('0x3'));var config=require(_0xc9d9('0x4'));var attributes=require(_0xc9d9('0x5'));module[_0xc9d9('0x6')]=function(_0x331e91,_0x1ae5bf){return _0x331e91[_0xc9d9('0x7')](_0xc9d9('0x8'),attributes,{'tableName':_0xc9d9('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 9775129..ea31a12 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 _0xb5f8=['code','message','result','catch','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetMailQueue','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49e385,_0x2dea80){var _0x1e049a=function(_0x1f6dca){while(--_0x1f6dca){_0x49e385['push'](_0x49e385['shift']());}};_0x1e049a(++_0x2dea80);}(_0xb5f8,0x88));var _0x8b5f=function(_0x3f6e9c,_0x2d453a){_0x3f6e9c=_0x3f6e9c-0x0;var _0xac0552=_0xb5f8[_0x3f6e9c];return _0xac0552;};'use strict';var _=require(_0x8b5f('0x0'));var util=require(_0x8b5f('0x1'));var moment=require(_0x8b5f('0x2'));var BPromise=require(_0x8b5f('0x3'));var rs=require(_0x8b5f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b5f('0x5'))['db'];var utils=require(_0x8b5f('0x6'));var logger=require('../../config/logger')(_0x8b5f('0x7'));var config=require(_0x8b5f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b5f('0x9')][_0x8b5f('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8b5f('0xb')],{'host':_0x8b5f('0xc'),'port':0x18eb});var socket=require(_0x8b5f('0xd'))(new Redis(config[_0x8b5f('0xb')]));require(_0x8b5f('0xe'))['register'](socket);function respondWithRpcPromise(_0x3a0cb2,_0x499e38,_0x3033cd){return new BPromise(function(_0x54b392,_0x420178){return client[_0x8b5f('0xf')](_0x3a0cb2,_0x3033cd)[_0x8b5f('0x10')](function(_0x32af1e){logger[_0x8b5f('0x11')](_0x8b5f('0x12'),_0x499e38,_0x8b5f('0x13'));logger[_0x8b5f('0x14')](_0x8b5f('0x15'),_0x499e38,_0x8b5f('0x13'),JSON[_0x8b5f('0x16')](_0x32af1e));if(_0x32af1e['error']){if(_0x32af1e[_0x8b5f('0x17')][_0x8b5f('0x18')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x499e38,_0x32af1e[_0x8b5f('0x17')][_0x8b5f('0x19')]);return _0x420178(_0x32af1e[_0x8b5f('0x17')][_0x8b5f('0x19')]);}logger['error'](_0x8b5f('0x12'),_0x499e38,_0x32af1e[_0x8b5f('0x17')][_0x8b5f('0x19')]);return _0x54b392(_0x32af1e['error']['message']);}else{logger[_0x8b5f('0x11')](_0x8b5f('0x12'),_0x499e38,_0x8b5f('0x13'));_0x54b392(_0x32af1e[_0x8b5f('0x1a')][_0x8b5f('0x19')]);}})[_0x8b5f('0x1b')](function(_0x2279a8){logger[_0x8b5f('0x17')]('MailQueue,\x20%s,\x20%s',_0x499e38,_0x2279a8);_0x420178(_0x2279a8);});});}exports['GetMailQueue']=function(_0x3ee049){var _0x5c3763=this;return new Promise(function(_0x4ab3bc,_0x4436d7){return db[_0x8b5f('0x1c')][_0x8b5f('0x1d')]({'raw':_0x3ee049[_0x8b5f('0x1e')]?_0x3ee049[_0x8b5f('0x1e')][_0x8b5f('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ee049[_0x8b5f('0x1e')]?_0x3ee049[_0x8b5f('0x1e')][_0x8b5f('0x20')]||null:null,'attributes':_0x3ee049[_0x8b5f('0x1e')]?_0x3ee049[_0x8b5f('0x1e')]['attributes']||null:null,'limit':_0x3ee049[_0x8b5f('0x1e')]?_0x3ee049[_0x8b5f('0x1e')][_0x8b5f('0x21')]||null:null,'include':_0x3ee049[_0x8b5f('0x1e')]?_0x3ee049[_0x8b5f('0x1e')][_0x8b5f('0x22')]?_[_0x8b5f('0x23')](_0x3ee049[_0x8b5f('0x1e')][_0x8b5f('0x22')],function(_0x4eabae){return{'model':db[_0x4eabae[_0x8b5f('0x24')]],'as':_0x4eabae['as'],'attributes':_0x4eabae[_0x8b5f('0x25')],'include':_0x4eabae[_0x8b5f('0x22')]?_[_0x8b5f('0x23')](_0x4eabae['include'],function(_0x1837d2){return{'model':db[_0x1837d2[_0x8b5f('0x24')]],'as':_0x1837d2['as'],'attributes':_0x1837d2[_0x8b5f('0x25')],'include':_0x1837d2[_0x8b5f('0x22')]?_[_0x8b5f('0x23')](_0x1837d2[_0x8b5f('0x22')],function(_0x218e25){return{'model':db[_0x218e25[_0x8b5f('0x24')]],'as':_0x218e25['as'],'attributes':_0x218e25[_0x8b5f('0x25')]};}):[]};}):[]};}):[]:[]})[_0x8b5f('0x10')](function(_0xb5b3ac){logger[_0x8b5f('0x11')](_0x8b5f('0x26'),_0x3ee049);logger[_0x8b5f('0x14')](_0x8b5f('0x26'),_0x3ee049,JSON[_0x8b5f('0x16')](_0xb5b3ac));_0x4ab3bc(_0xb5b3ac);})[_0x8b5f('0x1b')](function(_0x27ff33){logger[_0x8b5f('0x17')](_0x8b5f('0x26'),_0x27ff33[_0x8b5f('0x19')],_0x3ee049);_0x4436d7(_0x5c3763[_0x8b5f('0x17')](0x1f4,_0x27ff33[_0x8b5f('0x19')]));});});};exports[_0x8b5f('0x27')]=function(_0x382cb6){var _0x3a8de6=this;return new Promise(function(_0x5583fa,_0x17237a){return db[_0x8b5f('0x1c')]['find']({'raw':_0x382cb6[_0x8b5f('0x1e')]?_0x382cb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x382cb6[_0x8b5f('0x1e')]?_0x382cb6[_0x8b5f('0x1e')][_0x8b5f('0x20')]||null:null,'attributes':_0x382cb6['options']?_0x382cb6[_0x8b5f('0x1e')][_0x8b5f('0x25')]||null:null,'include':_0x382cb6[_0x8b5f('0x1e')]?_0x382cb6[_0x8b5f('0x1e')]['include']?_[_0x8b5f('0x23')](_0x382cb6['options'][_0x8b5f('0x22')],function(_0x53a606){return{'model':db[_0x53a606[_0x8b5f('0x24')]],'as':_0x53a606['as'],'attributes':_0x53a606[_0x8b5f('0x25')],'include':_0x53a606[_0x8b5f('0x22')]?_[_0x8b5f('0x23')](_0x53a606[_0x8b5f('0x22')],function(_0x45adf2){return{'model':db[_0x45adf2['model']],'as':_0x45adf2['as'],'attributes':_0x45adf2['attributes'],'include':_0x45adf2[_0x8b5f('0x22')]?_[_0x8b5f('0x23')](_0x45adf2['include'],function(_0x3ccb39){return{'model':db[_0x3ccb39['model']],'as':_0x3ccb39['as'],'attributes':_0x3ccb39['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b5f('0x10')](function(_0x23f4f9){logger[_0x8b5f('0x11')](_0x8b5f('0x27'),_0x382cb6);logger[_0x8b5f('0x14')](_0x8b5f('0x27'),_0x382cb6,JSON['stringify'](_0x23f4f9));_0x5583fa(_0x23f4f9);})['catch'](function(_0x1b8a9a){logger[_0x8b5f('0x17')]('ShowMailQueue',_0x1b8a9a[_0x8b5f('0x19')],_0x382cb6);_0x17237a(_0x3a8de6[_0x8b5f('0x17')](0x1f4,_0x1b8a9a[_0x8b5f('0x19')]));});});}; \ No newline at end of file +var _0x6ed3=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailQueue','findAll','options','raw','where','include','map','model','attributes','GetMailQueue','catch','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','request','then','info'];(function(_0x246a9c,_0x4df087){var _0x4bd0b3=function(_0x4558c6){while(--_0x4558c6){_0x246a9c['push'](_0x246a9c['shift']());}};_0x4bd0b3(++_0x4df087);}(_0x6ed3,0x1d9));var _0x36ed=function(_0x5d937c,_0x52963a){_0x5d937c=_0x5d937c-0x0;var _0x680f0a=_0x6ed3[_0x5d937c];return _0x680f0a;};'use strict';var _=require(_0x36ed('0x0'));var util=require('util');var moment=require(_0x36ed('0x1'));var BPromise=require(_0x36ed('0x2'));var rs=require(_0x36ed('0x3'));var fs=require('fs');var Redis=require(_0x36ed('0x4'));var db=require(_0x36ed('0x5'))['db'];var utils=require(_0x36ed('0x6'));var logger=require(_0x36ed('0x7'))(_0x36ed('0x8'));var config=require(_0x36ed('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x36ed('0xa')]['http']({'port':0x232a});config[_0x36ed('0xb')]=_[_0x36ed('0xc')](config[_0x36ed('0xb')],{'host':_0x36ed('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36ed('0xb')]));require(_0x36ed('0xe'))[_0x36ed('0xf')](socket);function respondWithRpcPromise(_0x2583b8,_0x5cdbb8,_0x5520d9){return new BPromise(function(_0x242745,_0x20d250){return client[_0x36ed('0x10')](_0x2583b8,_0x5520d9)[_0x36ed('0x11')](function(_0x4187fe){logger[_0x36ed('0x12')](_0x36ed('0x13'),_0x5cdbb8,_0x36ed('0x14'));logger[_0x36ed('0x15')](_0x36ed('0x16'),_0x5cdbb8,_0x36ed('0x14'),JSON[_0x36ed('0x17')](_0x4187fe));if(_0x4187fe[_0x36ed('0x18')]){if(_0x4187fe[_0x36ed('0x18')][_0x36ed('0x19')]===0x1f4){logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x4187fe['error'][_0x36ed('0x1a')]);return _0x20d250(_0x4187fe[_0x36ed('0x18')]['message']);}logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x4187fe[_0x36ed('0x18')][_0x36ed('0x1a')]);return _0x242745(_0x4187fe['error']['message']);}else{logger[_0x36ed('0x12')](_0x36ed('0x13'),_0x5cdbb8,_0x36ed('0x14'));_0x242745(_0x4187fe[_0x36ed('0x1b')]['message']);}})['catch'](function(_0x3abf89){logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x3abf89);_0x20d250(_0x3abf89);});});}exports['GetMailQueue']=function(_0x2d33cb){var _0x1d0647=this;return new Promise(function(_0x288c8f,_0x420db2){return db[_0x36ed('0x1c')][_0x36ed('0x1d')]({'raw':_0x2d33cb['options']?_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options'][_0x36ed('0x20')]||null:null,'attributes':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options']['attributes']||null:null,'limit':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options']['limit']||null:null,'include':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x21')],function(_0x36b4ca){return{'model':db[_0x36b4ca[_0x36ed('0x23')]],'as':_0x36b4ca['as'],'attributes':_0x36b4ca[_0x36ed('0x24')],'include':_0x36b4ca['include']?_[_0x36ed('0x22')](_0x36b4ca['include'],function(_0x2e76d8){return{'model':db[_0x2e76d8[_0x36ed('0x23')]],'as':_0x2e76d8['as'],'attributes':_0x2e76d8['attributes'],'include':_0x2e76d8[_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x2e76d8[_0x36ed('0x21')],function(_0x211069){return{'model':db[_0x211069['model']],'as':_0x211069['as'],'attributes':_0x211069[_0x36ed('0x24')]};}):[]};}):[]};}):[]:[]})[_0x36ed('0x11')](function(_0xd8dfe4){logger[_0x36ed('0x12')]('GetMailQueue',_0x2d33cb);logger[_0x36ed('0x15')](_0x36ed('0x25'),_0x2d33cb,JSON[_0x36ed('0x17')](_0xd8dfe4));_0x288c8f(_0xd8dfe4);})[_0x36ed('0x26')](function(_0x57f8bd){logger[_0x36ed('0x18')](_0x36ed('0x25'),_0x57f8bd[_0x36ed('0x1a')],_0x2d33cb);_0x420db2(_0x1d0647['error'](0x1f4,_0x57f8bd[_0x36ed('0x1a')]));});});};exports[_0x36ed('0x27')]=function(_0x3674b0){var _0x5df32b=this;return new Promise(function(_0x3fb728,_0x560ddf){return db['MailQueue'][_0x36ed('0x28')]({'raw':_0x3674b0[_0x36ed('0x1e')]?_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x3674b0['options']?_0x3674b0['options'][_0x36ed('0x20')]||null:null,'attributes':_0x3674b0['options']?_0x3674b0['options'][_0x36ed('0x24')]||null:null,'include':_0x3674b0[_0x36ed('0x1e')]?_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x21')],function(_0x17e827){return{'model':db[_0x17e827['model']],'as':_0x17e827['as'],'attributes':_0x17e827[_0x36ed('0x24')],'include':_0x17e827['include']?_[_0x36ed('0x22')](_0x17e827[_0x36ed('0x21')],function(_0x31cb40){return{'model':db[_0x31cb40[_0x36ed('0x23')]],'as':_0x31cb40['as'],'attributes':_0x31cb40[_0x36ed('0x24')],'include':_0x31cb40[_0x36ed('0x21')]?_['map'](_0x31cb40[_0x36ed('0x21')],function(_0xcb13a2){return{'model':db[_0xcb13a2[_0x36ed('0x23')]],'as':_0xcb13a2['as'],'attributes':_0xcb13a2[_0x36ed('0x24')]};}):[]};}):[]};}):[]:[]})[_0x36ed('0x11')](function(_0x399de6){logger[_0x36ed('0x12')](_0x36ed('0x27'),_0x3674b0);logger[_0x36ed('0x15')](_0x36ed('0x27'),_0x3674b0,JSON[_0x36ed('0x17')](_0x399de6));_0x3fb728(_0x399de6);})[_0x36ed('0x26')](function(_0x596961){logger['error'](_0x36ed('0x27'),_0x596961['message'],_0x3674b0);_0x560ddf(_0x5df32b[_0x36ed('0x18')](0x1f4,_0x596961[_0x36ed('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6666e6c..b19a716 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 _0x6826=['update','emit','removeListener','register','length','./mailQueue.events','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6826,0x75));var _0x6682=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x6826[_0x338f73];return _0x163fdf;};'use strict';var MailQueueEvents=require(_0x6682('0x0'));var events=['save',_0x6682('0x1'),_0x6682('0x2')];function createListener(_0x1cc116,_0x2158c2){return function(_0x21b39c){_0x2158c2[_0x6682('0x3')](_0x1cc116,_0x21b39c);};}function removeListener(_0x55c3b5,_0x5adb0b){return function(){MailQueueEvents[_0x6682('0x4')](_0x55c3b5,_0x5adb0b);};}exports[_0x6682('0x5')]=function(_0x45d511){for(var _0x4c20b5=0x0,_0x47bbf=events[_0x6682('0x6')];_0x4c20b5<_0x47bbf;_0x4c20b5++){var _0x8decb4=events[_0x4c20b5];var _0x1498b5=createListener('mailQueue:'+_0x8decb4,_0x45d511);MailQueueEvents['on'](_0x8decb4,_0x1498b5);}}; \ No newline at end of file +var _0xa8d7=['./mailQueue.events','save','remove','emit','mailQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8d7,0x1b8));var _0x7a8d=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xa8d7[_0x15cdcb];return _0x37b069;};'use strict';var MailQueueEvents=require(_0x7a8d('0x0'));var events=[_0x7a8d('0x1'),_0x7a8d('0x2'),'update'];function createListener(_0x46011e,_0x2119f5){return function(_0x14b272){_0x2119f5[_0x7a8d('0x3')](_0x46011e,_0x14b272);};}function removeListener(_0x31333e,_0x1b5efa){return function(){MailQueueEvents['removeListener'](_0x31333e,_0x1b5efa);};}exports['register']=function(_0x105da1){for(var _0x59b715=0x0,_0x464b56=events['length'];_0x59b715<_0x464b56;_0x59b715++){var _0x55a22e=events[_0x59b715];var _0x369d57=createListener(_0x7a8d('0x4')+_0x55a22e,_0x105da1);MailQueueEvents['on'](_0x55a22e,_0x369d57);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4dfb972..58594a3 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 _0xdcd8=['isAuthenticated','index','get','/describe','describe','/:id','post','create','put','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xdcd8,0x1e6));var _0x8dcd=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0xdcd8[_0x1a3e23];return _0x5ee0d8;};'use strict';var multer=require('multer');var util=require(_0x8dcd('0x0'));var path=require('path');var timeout=require(_0x8dcd('0x1'));var express=require(_0x8dcd('0x2'));var router=express[_0x8dcd('0x3')]();var fs_extra=require(_0x8dcd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8dcd('0x5'));var config=require(_0x8dcd('0x6'));var controller=require(_0x8dcd('0x7'));router['get']('/',auth[_0x8dcd('0x8')](),controller[_0x8dcd('0x9')]);router[_0x8dcd('0xa')](_0x8dcd('0xb'),auth[_0x8dcd('0x8')](),controller[_0x8dcd('0xc')]);router['get'](_0x8dcd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8dcd('0xe')]('/',auth[_0x8dcd('0x8')](),controller[_0x8dcd('0xf')]);router[_0x8dcd('0x10')](_0x8dcd('0xd'),auth[_0x8dcd('0x8')](),controller['update']);router['delete'](_0x8dcd('0xd'),auth[_0x8dcd('0x8')](),controller[_0x8dcd('0x11')]);module[_0x8dcd('0x12')]=router; \ No newline at end of file +var _0xaea8=['update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put'];(function(_0x5e4e4a,_0xf6ef74){var _0x4bec11=function(_0x54dd7c){while(--_0x54dd7c){_0x5e4e4a['push'](_0x5e4e4a['shift']());}};_0x4bec11(++_0xf6ef74);}(_0xaea8,0xdf));var _0x8aea=function(_0x2d4490,_0xa2e671){_0x2d4490=_0x2d4490-0x0;var _0x3f98df=_0xaea8[_0x2d4490];return _0x3f98df;};'use strict';var multer=require(_0x8aea('0x0'));var util=require(_0x8aea('0x1'));var path=require('path');var timeout=require(_0x8aea('0x2'));var express=require(_0x8aea('0x3'));var router=express['Router']();var fs_extra=require(_0x8aea('0x4'));var auth=require(_0x8aea('0x5'));var interaction=require(_0x8aea('0x6'));var config=require(_0x8aea('0x7'));var controller=require(_0x8aea('0x8'));router[_0x8aea('0x9')]('/',auth[_0x8aea('0xa')](),controller[_0x8aea('0xb')]);router[_0x8aea('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8aea('0xc')]);router['get'](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('0xe')]);router['post']('/',auth[_0x8aea('0xa')](),controller[_0x8aea('0xf')]);router[_0x8aea('0x10')](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('0x11')]);router[_0x8aea('0x12')](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('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 a825631..d9284b1 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 _0x74b1=['moment','exports','STRING','DATE'];(function(_0x56d4b2,_0x1b2d75){var _0x237d9d=function(_0x153da2){while(--_0x153da2){_0x56d4b2['push'](_0x56d4b2['shift']());}};_0x237d9d(++_0x1b2d75);}(_0x74b1,0x134));var _0x174b=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x74b1[_0x173f10];return _0x53142d;};'use strict';var moment=require(_0x174b('0x0'));var Sequelize=require('sequelize');module[_0x174b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x174b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x174b('0x3')]},'exitAt':{'type':Sequelize[_0x174b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc3a1=['STRING','DATE','moment','exports'];(function(_0x240dce,_0x2b293c){var _0x371546=function(_0x2d32e5){while(--_0x2d32e5){_0x240dce['push'](_0x240dce['shift']());}};_0x371546(++_0x2b293c);}(_0xc3a1,0x102));var _0x1c3a=function(_0x4d16d2,_0x322c9a){_0x4d16d2=_0x4d16d2-0x0;var _0x277186=_0xc3a1[_0x4d16d2];return _0x277186;};'use strict';var moment=require(_0x1c3a('0x0'));var Sequelize=require('sequelize');module[_0x1c3a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1c3a('0x2')]},'joinAt':{'type':Sequelize[_0x1c3a('0x3')]},'leaveAt':{'type':Sequelize[_0x1c3a('0x3')]},'acceptAt':{'type':Sequelize[_0x1c3a('0x3')]},'exitAt':{'type':Sequelize[_0x1c3a('0x3')]},'reason':{'type':Sequelize[_0x1c3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1d4bb65..efd54cf 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 _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0598,0x92));var _0x8059=function(_0x2e363a,_0x1b4217){_0x2e363a=_0x2e363a-0x0;var _0x23ea6e=_0x0598[_0x2e363a];return _0x23ea6e;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['MailQueueReport']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['MailQueueReport'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file +var _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','MailQueueReport','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x896e,0x1e9));var _0xe896=function(_0x17a531,_0x5d2dd7){_0x17a531=_0x17a531-0x0;var _0xc8c23=_0x896e[_0x17a531];return _0xc8c23;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['MailQueueReport'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':!![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['MailQueueReport'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f96f1ec..2159e14 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 _0x94c1=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0xdb95cd,_0x15baee){var _0x328185=function(_0x3ce925){while(--_0x3ce925){_0xdb95cd['push'](_0xdb95cd['shift']());}};_0x328185(++_0x15baee);}(_0x94c1,0x8d));var _0x194c=function(_0x3f50e3,_0x5009bd){_0x3f50e3=_0x3f50e3-0x0;var _0x1839e0=_0x94c1[_0x3f50e3];return _0x1839e0;};'use strict';var _=require(_0x194c('0x0'));var util=require(_0x194c('0x1'));var logger=require(_0x194c('0x2'))(_0x194c('0x3'));var moment=require(_0x194c('0x4'));var BPromise=require(_0x194c('0x5'));var rp=require(_0x194c('0x6'));var fs=require('fs');var path=require(_0x194c('0x7'));var rimraf=require(_0x194c('0x8'));var config=require('../../config/environment');var attributes=require(_0x194c('0x9'));module[_0x194c('0xa')]=function(_0x5f52da,_0x205948){return _0x5f52da[_0x194c('0xb')](_0x194c('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x194c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7f7=['rimraf','../../config/environment','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf7f7,0x192));var _0x7f7f=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xf7f7[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var logger=require(_0x7f7f('0x2'))(_0x7f7f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f7f('0x4'));var fs=require('fs');var path=require(_0x7f7f('0x5'));var rimraf=require(_0x7f7f('0x6'));var config=require(_0x7f7f('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x7f7f('0x8')]=function(_0x899994,_0x1d0310){return _0x899994[_0x7f7f('0x9')]('MailQueueReport',attributes,{'tableName':_0x7f7f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f7f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 26a055c..6403800 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x209fd5,_0x2035a8){var _0x1f8f75=function(_0x5a0f92){while(--_0x5a0f92){_0x209fd5['push'](_0x209fd5['shift']());}};_0x1f8f75(++_0x2035a8);}(_0xdb28,0x106));var _0x8db2=function(_0x580389,_0xe0136b){_0x580389=_0x580389-0x0;var _0x33f862=_0xdb28[_0x580389];return _0x33f862;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0xee8d9e,_0x87d380){var _0x558642=function(_0x591a92){while(--_0x591a92){_0xee8d9e['push'](_0xee8d9e['shift']());}};_0x558642(++_0x87d380);}(_0x7a54,0x106));var _0x47a5=function(_0x43701d,_0x3a0880){_0x43701d=_0x43701d-0x0;var _0x59e5b8=_0x7a54[_0x43701d];return _0x59e5b8;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4bc2ed6..c601beb 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38192c,_0x231e41){var _0x31d64e=function(_0x579a6e){while(--_0x579a6e){_0x38192c['push'](_0x38192c['shift']());}};_0x31d64e(++_0x231e41);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1bbe0f,_0x511de8){var _0x3ce083=function(_0xf4f7ab){while(--_0xf4f7ab){_0x1bbe0f['push'](_0x1bbe0f['shift']());}};_0x3ce083(++_0x511de8);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ee336,_0x21bfbe){_0x5ee336=_0x5ee336-0x0;var _0x4ff51d=_0xedd9[_0x5ee336];return _0x4ff51d;};'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 0f03a3b..0298a7c 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 _0xd874=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x2636ea,_0x2222c5){var _0x27a5ee=function(_0x361cf5){while(--_0x361cf5){_0x2636ea['push'](_0x2636ea['shift']());}};_0x27a5ee(++_0x2222c5);}(_0xd874,0x7c));var _0x4d87=function(_0x5001c4,_0x3b525c){_0x5001c4=_0x5001c4-0x0;var _0x3c558a=_0xd874[_0x5001c4];return _0x3c558a;};'use strict';var Sequelize=require(_0x4d87('0x0'));module['exports']={'description':{'type':Sequelize[_0x4d87('0x1')]},'host':{'type':Sequelize[_0x4d87('0x1')]},'authentication':{'type':Sequelize[_0x4d87('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4d87('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4d87('0x3')]},'tls':{'type':Sequelize[_0x4d87('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4d87('0x1')],'defaultValue':_0x4d87('0x4')},'connTimeout':{'type':Sequelize[_0x4d87('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4d87('0x1')]},'modernAuthentication':{'type':Sequelize[_0x4d87('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x708a=['exports','BOOLEAN','INTEGER','STRING','INBOX','sequelize'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x708a,0xa1));var _0xa708=function(_0x182e45,_0x3bdd0d){_0x182e45=_0x182e45-0x0;var _0x5ddda2=_0x708a[_0x182e45];return _0x5ddda2;};'use strict';var Sequelize=require(_0xa708('0x0'));module[_0xa708('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa708('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa708('0x3')]},'tls':{'type':Sequelize[_0xa708('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa708('0x4')],'defaultValue':_0xa708('0x5')},'connTimeout':{'type':Sequelize[_0xa708('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa708('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa708('0x4')]},'modernAuthentication':{'type':Sequelize[_0xa708('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8cea61f..5b423c6 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 _0xf302=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf302,0x17d));var _0x2f30=function(_0x3964ec,_0x11cd78){_0x3964ec=_0x3964ec-0x0;var _0x1c3953=_0xf302[_0x3964ec];return _0x1c3953;};'use strict';var _=require(_0x2f30('0x0'));var util=require(_0x2f30('0x1'));var logger=require(_0x2f30('0x2'))(_0x2f30('0x3'));var moment=require(_0x2f30('0x4'));var BPromise=require(_0x2f30('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f30('0x6'));var rimraf=require(_0x2f30('0x7'));var config=require(_0x2f30('0x8'));var attributes=require(_0x2f30('0x9'));module[_0x2f30('0xa')]=function(_0x2f20da,_0x10ad4c){return _0x2f20da[_0x2f30('0xb')](_0x2f30('0xc'),attributes,{'tableName':_0x2f30('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb079=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xb079,0x180));var _0x9b07=function(_0xae53d0,_0x4df51f){_0xae53d0=_0xae53d0-0x0;var _0x3c2f15=_0xb079[_0xae53d0];return _0x3c2f15;};'use strict';var _=require(_0x9b07('0x0'));var util=require(_0x9b07('0x1'));var logger=require(_0x9b07('0x2'))(_0x9b07('0x3'));var moment=require(_0x9b07('0x4'));var BPromise=require(_0x9b07('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b07('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x9b07('0x7')]=function(_0x572ce8,_0x27fb81){return _0x572ce8[_0x9b07('0x8')](_0x9b07('0x9'),attributes,{'tableName':_0x9b07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5b384ae..feddf27 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 _0xbaa9=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map','model','attributes','stringify','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x43ad57,_0x463504){var _0x38c75f=function(_0x4c0185){while(--_0x4c0185){_0x43ad57['push'](_0x43ad57['shift']());}};_0x38c75f(++_0x463504);}(_0xbaa9,0x188));var _0x9baa=function(_0x56202c,_0x486a38){_0x56202c=_0x56202c-0x0;var _0x5f1f15=_0xbaa9[_0x56202c];return _0x5f1f15;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var moment=require(_0x9baa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9baa('0x2'));var db=require(_0x9baa('0x3'))['db'];var utils=require(_0x9baa('0x4'));var logger=require(_0x9baa('0x5'))(_0x9baa('0x6'));var config=require(_0x9baa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9baa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102c4d,_0x25abea,_0x32bcf0){return new BPromise(function(_0x1be8a7,_0x3a3a36){return client['request'](_0x102c4d,_0x32bcf0)[_0x9baa('0x9')](function(_0x292612){logger[_0x9baa('0xa')](_0x9baa('0xb'),_0x25abea,_0x9baa('0xc'));logger[_0x9baa('0xd')](_0x9baa('0xe'),_0x25abea,_0x9baa('0xc'),JSON['stringify'](_0x292612));if(_0x292612[_0x9baa('0xf')]){if(_0x292612[_0x9baa('0xf')][_0x9baa('0x10')]===0x1f4){logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);return _0x3a3a36(_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);}logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x292612[_0x9baa('0xf')]['message']);return _0x1be8a7(_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);}else{logger[_0x9baa('0xa')](_0x9baa('0xb'),_0x25abea,_0x9baa('0xc'));_0x1be8a7(_0x292612[_0x9baa('0x12')]['message']);}})['catch'](function(_0x41a661){logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x41a661);_0x3a3a36(_0x41a661);});});}exports[_0x9baa('0x13')]=function(_0xd18640){var _0x4e583c=this;return new Promise(function(_0x4e806e,_0x4587f0){return db[_0x9baa('0x14')][_0x9baa('0x15')]({'raw':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')][_0x9baa('0x17')]===undefined?!![]:![]:!![],'where':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')][_0x9baa('0x18')]||null:null,'attributes':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')]['attributes']||null:null,'limit':_0xd18640['options']?_0xd18640['options']['limit']||null:null,'include':_0xd18640[_0x9baa('0x16')]?_0xd18640['options'][_0x9baa('0x19')]?_[_0x9baa('0x1a')](_0xd18640[_0x9baa('0x16')][_0x9baa('0x19')],function(_0x1478ac){return{'model':db[_0x1478ac[_0x9baa('0x1b')]],'as':_0x1478ac['as'],'attributes':_0x1478ac[_0x9baa('0x1c')],'include':_0x1478ac[_0x9baa('0x19')]?_['map'](_0x1478ac[_0x9baa('0x19')],function(_0x4efa7d){return{'model':db[_0x4efa7d[_0x9baa('0x1b')]],'as':_0x4efa7d['as'],'attributes':_0x4efa7d['attributes'],'include':_0x4efa7d[_0x9baa('0x19')]?_[_0x9baa('0x1a')](_0x4efa7d['include'],function(_0x59ceb9){return{'model':db[_0x59ceb9[_0x9baa('0x1b')]],'as':_0x59ceb9['as'],'attributes':_0x59ceb9[_0x9baa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9baa('0x9')](function(_0x9a2d5d){logger[_0x9baa('0xa')](_0x9baa('0x13'),_0xd18640);logger[_0x9baa('0xd')](_0x9baa('0x13'),_0xd18640,JSON[_0x9baa('0x1d')](_0x9a2d5d));_0x4e806e(_0x9a2d5d);})[_0x9baa('0x1e')](function(_0x5923d7){logger[_0x9baa('0xf')]('GetMailServerIn',_0x5923d7['message'],_0xd18640);_0x4587f0(_0x4e583c[_0x9baa('0xf')](0x1f4,_0x5923d7[_0x9baa('0x11')]));});});}; \ No newline at end of file +var _0xf31a=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','debug','util','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then'];(function(_0x408ca8,_0x1be575){var _0x2ebcf6=function(_0x541318){while(--_0x541318){_0x408ca8['push'](_0x408ca8['shift']());}};_0x2ebcf6(++_0x1be575);}(_0xf31a,0xaa));var _0xaf31=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf31a[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xaf31('0x0'));var moment=require(_0xaf31('0x1'));var BPromise=require(_0xaf31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf31('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf31('0x4'))(_0xaf31('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf31('0x6')][_0xaf31('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2da3,_0x1ce3bf,_0xc89c79){return new BPromise(function(_0x501641,_0x1efd02){return client[_0xaf31('0x8')](_0x3f2da3,_0xc89c79)[_0xaf31('0x9')](function(_0x1949f7){logger[_0xaf31('0xa')](_0xaf31('0xb'),_0x1ce3bf,_0xaf31('0xc'));logger['debug'](_0xaf31('0xd'),_0x1ce3bf,_0xaf31('0xc'),JSON[_0xaf31('0xe')](_0x1949f7));if(_0x1949f7[_0xaf31('0xf')]){if(_0x1949f7['error'][_0xaf31('0x10')]===0x1f4){logger[_0xaf31('0xf')]('MailServerIn,\x20%s,\x20%s',_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x1efd02(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}logger[_0xaf31('0xf')](_0xaf31('0xb'),_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x501641(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}else{logger[_0xaf31('0xa')]('MailServerIn,\x20%s,\x20%s',_0x1ce3bf,_0xaf31('0xc'));_0x501641(_0x1949f7[_0xaf31('0x12')][_0xaf31('0x11')]);}})[_0xaf31('0x13')](function(_0x2b3e42){logger['error'](_0xaf31('0xb'),_0x1ce3bf,_0x2b3e42);_0x1efd02(_0x2b3e42);});});}exports[_0xaf31('0x14')]=function(_0x1c55e8){var _0x49da39=this;return new Promise(function(_0x362995,_0x2a3e3b){return db[_0xaf31('0x15')][_0xaf31('0x16')]({'raw':_0x1c55e8['options']?_0x1c55e8[_0xaf31('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c55e8['options']?_0x1c55e8[_0xaf31('0x17')]['where']||null:null,'attributes':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8['options'][_0xaf31('0x18')]||null:null,'limit':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8[_0xaf31('0x17')][_0xaf31('0x19')]||null:null,'include':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8[_0xaf31('0x17')][_0xaf31('0x1a')]?_[_0xaf31('0x1b')](_0x1c55e8[_0xaf31('0x17')]['include'],function(_0x2e54e7){return{'model':db[_0x2e54e7[_0xaf31('0x1c')]],'as':_0x2e54e7['as'],'attributes':_0x2e54e7['attributes'],'include':_0x2e54e7[_0xaf31('0x1a')]?_['map'](_0x2e54e7[_0xaf31('0x1a')],function(_0x4e3802){return{'model':db[_0x4e3802[_0xaf31('0x1c')]],'as':_0x4e3802['as'],'attributes':_0x4e3802['attributes'],'include':_0x4e3802['include']?_[_0xaf31('0x1b')](_0x4e3802[_0xaf31('0x1a')],function(_0x4e1a30){return{'model':db[_0x4e1a30[_0xaf31('0x1c')]],'as':_0x4e1a30['as'],'attributes':_0x4e1a30[_0xaf31('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf31('0x9')](function(_0xa63481){logger['info'](_0xaf31('0x14'),_0x1c55e8);logger[_0xaf31('0x1d')](_0xaf31('0x14'),_0x1c55e8,JSON['stringify'](_0xa63481));_0x362995(_0xa63481);})[_0xaf31('0x13')](function(_0x34ea25){logger[_0xaf31('0xf')](_0xaf31('0x14'),_0x34ea25[_0xaf31('0x11')],_0x1c55e8);_0x2a3e3b(_0x49da39[_0xaf31('0xf')](0x1f4,_0x34ea25[_0xaf31('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6d49112..3cee179 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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x313917,_0x1c228d){_0x313917=_0x313917-0x0;var _0x28acac=_0x7a54[_0x313917];return _0x28acac;};'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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x5bbed4,_0x26b4d0){_0x5bbed4=_0x5bbed4-0x0;var _0x58d7e3=_0x7a54[_0x5bbed4];return _0x58d7e3;};'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 4fdbeaf..18a3ba3 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 _0x36ee=['BOOLEAN','STRING','INTEGER'];(function(_0x3f3825,_0xc1fa97){var _0x59d8be=function(_0x2ee1d1){while(--_0x2ee1d1){_0x3f3825['push'](_0x3f3825['shift']());}};_0x59d8be(++_0xc1fa97);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe36e('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe36e('0x0')]},'pass':{'type':Sequelize[_0xe36e('0x0')]},'port':{'type':Sequelize[_0xe36e('0x1')]},'secure':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xe36e('0x0')]},'authentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x18de19,_0x55bd8b){var _0xb7186=function(_0x2462de){while(--_0x2462de){_0x18de19['push'](_0x18de19['shift']());}};_0xb7186(++_0x55bd8b);}(_0x63a5,0x18e));var _0x563a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x63a5[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'description':{'type':Sequelize[_0x563a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x563a('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x563a('0x3')]},'secure':{'type':Sequelize[_0x563a('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x563a('0x2')]},'authentication':{'type':Sequelize[_0x563a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9b0cf0f..c454422 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 _0x92a0=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','end','name','index','map','MailServerOut','rawAttributes','fieldName','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','find','destroy','eml-format','rimraf','zip-dir','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x92a0,0x15f));var _0x092a=function(_0x1bc42b,_0x5f38c0){_0x1bc42b=_0x1bc42b-0x0;var _0x193af5=_0x92a0[_0x1bc42b];return _0x193af5;};'use strict';var emlformat=require(_0x092a('0x0'));var rimraf=require(_0x092a('0x1'));var zipdir=require(_0x092a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x092a('0x3'));var Mustache=require(_0x092a('0x4'));var util=require(_0x092a('0x5'));var path=require(_0x092a('0x6'));var sox=require(_0x092a('0x7'));var csv=require(_0x092a('0x8'));var ejs=require(_0x092a('0x9'));var fs=require('fs');var fs_extra=require(_0x092a('0xa'));var _=require(_0x092a('0xb'));var squel=require(_0x092a('0xc'));var crypto=require(_0x092a('0xd'));var jsforce=require(_0x092a('0xe'));var deskjs=require(_0x092a('0xf'));var toCsv=require(_0x092a('0x8'));var querystring=require(_0x092a('0x10'));var Papa=require(_0x092a('0x11'));var Redis=require(_0x092a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x092a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x092a('0x14'))(_0x092a('0x15'));var utils=require(_0x092a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x092a('0x17'))['db'];function respondWithStatusCode(_0x323a7a,_0x50ec73){_0x50ec73=_0x50ec73||0xcc;return function(_0x2393f9){if(_0x2393f9){return _0x323a7a[_0x092a('0x18')](_0x50ec73);}return _0x323a7a[_0x092a('0x19')](_0x50ec73)['end']();};}function respondWithResult(_0x1250ed,_0x4ec10a){_0x4ec10a=_0x4ec10a||0xc8;return function(_0x209cd7){if(_0x209cd7){return _0x1250ed['status'](_0x4ec10a)['json'](_0x209cd7);}};}function respondWithFilteredResult(_0x36b82e,_0x3678cd){return function(_0x51db38){if(_0x51db38){var _0x49d4c7=typeof _0x3678cd['offset']===_0x092a('0x1a')&&typeof _0x3678cd[_0x092a('0x1b')]===_0x092a('0x1a');var _0x4327c7=_0x51db38[_0x092a('0x1c')];var _0x20313c=_0x49d4c7?0x0:_0x3678cd[_0x092a('0x1d')];var _0x3b52f2=_0x49d4c7?_0x51db38[_0x092a('0x1c')]:_0x3678cd[_0x092a('0x1d')]+_0x3678cd[_0x092a('0x1b')];var _0x1e0780;if(_0x3b52f2>=_0x4327c7){_0x3b52f2=_0x4327c7;_0x1e0780=0xc8;}else{_0x1e0780=0xce;}_0x36b82e[_0x092a('0x19')](_0x1e0780);return _0x36b82e[_0x092a('0x1e')](_0x092a('0x1f'),_0x20313c+'-'+_0x3b52f2+'/'+_0x4327c7)[_0x092a('0x20')](_0x51db38);}return null;};}function patchUpdates(_0x5b895a){return function(_0x1c9948){try{jsonpatch['apply'](_0x1c9948,_0x5b895a,!![]);}catch(_0x4b7a20){return BPromise[_0x092a('0x21')](_0x4b7a20);}return _0x1c9948[_0x092a('0x22')]();};}function saveUpdates(_0x67af80,_0x21cf53){return function(_0x2e61db){if(_0x2e61db){return _0x2e61db[_0x092a('0x23')](_0x67af80)['then'](function(_0x456947){return _0x456947;});}return null;};}function removeEntity(_0x5c9971,_0x14ee2b){return function(_0x518d63){if(_0x518d63){return _0x518d63['destroy']()[_0x092a('0x24')](function(){_0x5c9971[_0x092a('0x19')](0xcc)[_0x092a('0x25')]();});}};}function handleEntityNotFound(_0x39f9ff,_0x472400){return function(_0x1ffa67){if(!_0x1ffa67){_0x39f9ff[_0x092a('0x18')](0x194);}return _0x1ffa67;};}function handleError(_0x3f58b6,_0x4bf5a5){_0x4bf5a5=_0x4bf5a5||0x1f4;return function(_0x33ea2c){logger['error'](_0x33ea2c['stack']);if(_0x33ea2c[_0x092a('0x26')]){delete _0x33ea2c[_0x092a('0x26')];}_0x3f58b6[_0x092a('0x19')](_0x4bf5a5)['send'](_0x33ea2c);};}exports[_0x092a('0x27')]=function(_0x233833,_0x3d619b){var _0x13397a={},_0x7b98bb={},_0x41db5f={'count':0x0,'rows':[]};var _0x6010b2=_[_0x092a('0x28')](db[_0x092a('0x29')][_0x092a('0x2a')],function(_0x4c24b0){return{'name':_0x4c24b0[_0x092a('0x2b')],'type':_0x4c24b0['type']['key']};});_0x7b98bb['model']=_[_0x092a('0x28')](_0x6010b2,_0x092a('0x26'));_0x7b98bb[_0x092a('0x2c')]=_['keys'](_0x233833['query']);_0x7b98bb[_0x092a('0x2d')]=_['intersection'](_0x7b98bb[_0x092a('0x2e')],_0x7b98bb['query']);_0x13397a[_0x092a('0x2f')]=_['intersection'](_0x7b98bb[_0x092a('0x2e')],qs[_0x092a('0x30')](_0x233833[_0x092a('0x2c')][_0x092a('0x30')]));_0x13397a['attributes']=_0x13397a[_0x092a('0x2f')][_0x092a('0x31')]?_0x13397a[_0x092a('0x2f')]:_0x7b98bb[_0x092a('0x2e')];if(!_0x233833[_0x092a('0x2c')][_0x092a('0x32')](_0x092a('0x33'))){_0x13397a[_0x092a('0x1b')]=qs[_0x092a('0x1b')](_0x233833['query']['limit']);_0x13397a[_0x092a('0x1d')]=qs[_0x092a('0x1d')](_0x233833[_0x092a('0x2c')]['offset']);}_0x13397a[_0x092a('0x34')]=qs['sort'](_0x233833[_0x092a('0x2c')]['sort']);_0x13397a[_0x092a('0x35')]=qs[_0x092a('0x2d')](_[_0x092a('0x36')](_0x233833['query'],_0x7b98bb[_0x092a('0x2d')]),_0x6010b2);if(_0x233833[_0x092a('0x2c')]['filter']){_0x13397a[_0x092a('0x35')]=_['merge'](_0x13397a[_0x092a('0x35')],{'$or':_['map'](_0x6010b2,function(_0x96dbd4){if(_0x96dbd4['type']!==_0x092a('0x37')){var _0x7a527d={};_0x7a527d[_0x96dbd4['name']]={'$like':'%'+_0x233833[_0x092a('0x2c')]['filter']+'%'};return _0x7a527d;}})});}_0x13397a=_[_0x092a('0x38')]({},_0x13397a,_0x233833[_0x092a('0x39')]);var _0x26d79b={'where':_0x13397a[_0x092a('0x35')]};return db['MailServerOut'][_0x092a('0x1c')](_0x26d79b)['then'](function(_0x2264fc){_0x41db5f['count']=_0x2264fc;if(_0x233833['query'][_0x092a('0x3a')]){_0x13397a[_0x092a('0x3b')]=[{'all':!![]}];}return db['MailServerOut'][_0x092a('0x3c')](_0x13397a);})[_0x092a('0x24')](function(_0x4f7ec1){_0x41db5f[_0x092a('0x3d')]=_0x4f7ec1;return _0x41db5f;})['then'](respondWithFilteredResult(_0x3d619b,_0x13397a))[_0x092a('0x3e')](handleError(_0x3d619b,null));};exports[_0x092a('0x3f')]=function(_0x4d4361,_0x414fda){var _0x5f2b2e={'raw':!![],'where':{'id':_0x4d4361[_0x092a('0x40')]['id']}},_0x1de029={};_0x1de029['model']=_[_0x092a('0x41')](db[_0x092a('0x29')][_0x092a('0x2a')]);_0x1de029[_0x092a('0x2c')]=_[_0x092a('0x41')](_0x4d4361[_0x092a('0x2c')]);_0x1de029['filters']=_[_0x092a('0x42')](_0x1de029[_0x092a('0x2e')],_0x1de029[_0x092a('0x2c')]);_0x5f2b2e['attributes']=_[_0x092a('0x42')](_0x1de029[_0x092a('0x2e')],qs[_0x092a('0x30')](_0x4d4361[_0x092a('0x2c')]['fields']));_0x5f2b2e[_0x092a('0x2f')]=_0x5f2b2e[_0x092a('0x2f')][_0x092a('0x31')]?_0x5f2b2e[_0x092a('0x2f')]:_0x1de029[_0x092a('0x2e')];if(_0x4d4361[_0x092a('0x2c')][_0x092a('0x3a')]){_0x5f2b2e[_0x092a('0x3b')]=[{'all':!![]}];}_0x5f2b2e=_[_0x092a('0x38')]({},_0x5f2b2e,_0x4d4361[_0x092a('0x39')]);return db[_0x092a('0x29')]['find'](_0x5f2b2e)['then'](handleEntityNotFound(_0x414fda,null))[_0x092a('0x24')](respondWithResult(_0x414fda,null))['catch'](handleError(_0x414fda,null));};exports['create']=function(_0x18582c,_0x12cfe6){return db[_0x092a('0x29')][_0x092a('0x43')](_0x18582c[_0x092a('0x44')],{})[_0x092a('0x24')](respondWithResult(_0x12cfe6,0xc9))[_0x092a('0x3e')](handleError(_0x12cfe6,null));};exports[_0x092a('0x23')]=function(_0x18ee91,_0xde5185){if(_0x18ee91[_0x092a('0x44')]['id']){delete _0x18ee91[_0x092a('0x44')]['id'];}return db[_0x092a('0x29')][_0x092a('0x45')]({'where':{'id':_0x18ee91['params']['id']}})['then'](handleEntityNotFound(_0xde5185,null))['then'](saveUpdates(_0x18ee91[_0x092a('0x44')],null))[_0x092a('0x24')](respondWithResult(_0xde5185,null))[_0x092a('0x3e')](handleError(_0xde5185,null));};exports[_0x092a('0x46')]=function(_0x317d43,_0x2b61ea){return db[_0x092a('0x29')][_0x092a('0x45')]({'where':{'id':_0x317d43['params']['id']}})['then'](handleEntityNotFound(_0x2b61ea,null))[_0x092a('0x24')](removeEntity(_0x2b61ea,null))['catch'](handleError(_0x2b61ea,null));}; \ No newline at end of file +var _0x2fb4=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','../../config/utils'];(function(_0x5d0e5c,_0x1eb95f){var _0x2c4bd4=function(_0x5528dd){while(--_0x5528dd){_0x5d0e5c['push'](_0x5d0e5c['shift']());}};_0x2c4bd4(++_0x1eb95f);}(_0x2fb4,0x17f));var _0x42fb=function(_0x56b0a4,_0x371593){_0x56b0a4=_0x56b0a4-0x0;var _0xf4a34a=_0x2fb4[_0x56b0a4];return _0xf4a34a;};'use strict';var emlformat=require(_0x42fb('0x0'));var rimraf=require(_0x42fb('0x1'));var zipdir=require(_0x42fb('0x2'));var jsonpatch=require(_0x42fb('0x3'));var rp=require(_0x42fb('0x4'));var moment=require(_0x42fb('0x5'));var BPromise=require(_0x42fb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x42fb('0x7'));var sox=require('sox');var csv=require(_0x42fb('0x8'));var ejs=require(_0x42fb('0x9'));var fs=require('fs');var fs_extra=require(_0x42fb('0xa'));var _=require(_0x42fb('0xb'));var squel=require(_0x42fb('0xc'));var crypto=require(_0x42fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x42fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x42fb('0xf'));var Papa=require(_0x42fb('0x10'));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(_0x42fb('0x11'))('api');var utils=require(_0x42fb('0x12'));var config=require(_0x42fb('0x13'));var licenseUtil=require(_0x42fb('0x14'));var db=require(_0x42fb('0x15'))['db'];function respondWithStatusCode(_0x16c2d2,_0x1c90d4){_0x1c90d4=_0x1c90d4||0xcc;return function(_0x157446){if(_0x157446){return _0x16c2d2[_0x42fb('0x16')](_0x1c90d4);}return _0x16c2d2[_0x42fb('0x17')](_0x1c90d4)[_0x42fb('0x18')]();};}function respondWithResult(_0x665a39,_0x1e4039){_0x1e4039=_0x1e4039||0xc8;return function(_0x26715e){if(_0x26715e){return _0x665a39['status'](_0x1e4039)[_0x42fb('0x19')](_0x26715e);}};}function respondWithFilteredResult(_0x5cba71,_0xb07f89){return function(_0x190f81){if(_0x190f81){var _0xadc59b=typeof _0xb07f89[_0x42fb('0x1a')]===_0x42fb('0x1b')&&typeof _0xb07f89[_0x42fb('0x1c')]===_0x42fb('0x1b');var _0x4d88b5=_0x190f81[_0x42fb('0x1d')];var _0x38b7f1=_0xadc59b?0x0:_0xb07f89[_0x42fb('0x1a')];var _0x302b3a=_0xadc59b?_0x190f81['count']:_0xb07f89[_0x42fb('0x1a')]+_0xb07f89[_0x42fb('0x1c')];var _0x3ed0ba;if(_0x302b3a>=_0x4d88b5){_0x302b3a=_0x4d88b5;_0x3ed0ba=0xc8;}else{_0x3ed0ba=0xce;}_0x5cba71[_0x42fb('0x17')](_0x3ed0ba);return _0x5cba71['set'](_0x42fb('0x1e'),_0x38b7f1+'-'+_0x302b3a+'/'+_0x4d88b5)[_0x42fb('0x19')](_0x190f81);}return null;};}function patchUpdates(_0x5f03f3){return function(_0x647325){try{jsonpatch['apply'](_0x647325,_0x5f03f3,!![]);}catch(_0x5a7009){return BPromise['reject'](_0x5a7009);}return _0x647325['save']();};}function saveUpdates(_0x133371,_0x5df443){return function(_0x1fcb46){if(_0x1fcb46){return _0x1fcb46[_0x42fb('0x1f')](_0x133371)[_0x42fb('0x20')](function(_0xd303e3){return _0xd303e3;});}return null;};}function removeEntity(_0x5221e3,_0x67d903){return function(_0x20d5c1){if(_0x20d5c1){return _0x20d5c1['destroy']()['then'](function(){_0x5221e3[_0x42fb('0x17')](0xcc)[_0x42fb('0x18')]();});}};}function handleEntityNotFound(_0x365f22,_0x3a363e){return function(_0x42a42e){if(!_0x42a42e){_0x365f22[_0x42fb('0x16')](0x194);}return _0x42a42e;};}function handleError(_0x56dc63,_0x3f43a8){_0x3f43a8=_0x3f43a8||0x1f4;return function(_0x2c1cf3){logger['error'](_0x2c1cf3[_0x42fb('0x21')]);if(_0x2c1cf3[_0x42fb('0x22')]){delete _0x2c1cf3[_0x42fb('0x22')];}_0x56dc63['status'](_0x3f43a8)['send'](_0x2c1cf3);};}exports['index']=function(_0x4864b3,_0x13f091){var _0x50b454={},_0x3ae0c9={},_0x11d63d={'count':0x0,'rows':[]};var _0x238f14=_[_0x42fb('0x23')](db['MailServerOut'][_0x42fb('0x24')],function(_0x329a89){return{'name':_0x329a89['fieldName'],'type':_0x329a89[_0x42fb('0x25')][_0x42fb('0x26')]};});_0x3ae0c9['model']=_[_0x42fb('0x23')](_0x238f14,'name');_0x3ae0c9[_0x42fb('0x27')]=_[_0x42fb('0x28')](_0x4864b3[_0x42fb('0x27')]);_0x3ae0c9['filters']=_[_0x42fb('0x29')](_0x3ae0c9[_0x42fb('0x2a')],_0x3ae0c9[_0x42fb('0x27')]);_0x50b454[_0x42fb('0x2b')]=_[_0x42fb('0x29')](_0x3ae0c9[_0x42fb('0x2a')],qs[_0x42fb('0x2c')](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2c')]));_0x50b454['attributes']=_0x50b454[_0x42fb('0x2b')]['length']?_0x50b454['attributes']:_0x3ae0c9[_0x42fb('0x2a')];if(!_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2d')](_0x42fb('0x2e'))){_0x50b454[_0x42fb('0x1c')]=qs['limit'](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x1c')]);_0x50b454['offset']=qs[_0x42fb('0x1a')](_0x4864b3['query']['offset']);}_0x50b454['order']=qs[_0x42fb('0x2f')](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2f')]);_0x50b454[_0x42fb('0x30')]=qs['filters'](_[_0x42fb('0x31')](_0x4864b3[_0x42fb('0x27')],_0x3ae0c9[_0x42fb('0x32')]),_0x238f14);if(_0x4864b3[_0x42fb('0x27')]['filter']){_0x50b454['where']=_[_0x42fb('0x33')](_0x50b454['where'],{'$or':_['map'](_0x238f14,function(_0x5dfc6d){if(_0x5dfc6d['type']!==_0x42fb('0x34')){var _0x5e5001={};_0x5e5001[_0x5dfc6d[_0x42fb('0x22')]]={'$like':'%'+_0x4864b3[_0x42fb('0x27')][_0x42fb('0x35')]+'%'};return _0x5e5001;}})});}_0x50b454=_[_0x42fb('0x33')]({},_0x50b454,_0x4864b3[_0x42fb('0x36')]);var _0x540a08={'where':_0x50b454[_0x42fb('0x30')]};return db[_0x42fb('0x37')]['count'](_0x540a08)[_0x42fb('0x20')](function(_0x3533b2){_0x11d63d[_0x42fb('0x1d')]=_0x3533b2;if(_0x4864b3[_0x42fb('0x27')][_0x42fb('0x38')]){_0x50b454[_0x42fb('0x39')]=[{'all':!![]}];}return db['MailServerOut'][_0x42fb('0x3a')](_0x50b454);})[_0x42fb('0x20')](function(_0xfccea4){_0x11d63d['rows']=_0xfccea4;return _0x11d63d;})[_0x42fb('0x20')](respondWithFilteredResult(_0x13f091,_0x50b454))[_0x42fb('0x3b')](handleError(_0x13f091,null));};exports[_0x42fb('0x3c')]=function(_0x4ec613,_0x2f930c){var _0x277f92={'raw':!![],'where':{'id':_0x4ec613['params']['id']}},_0xc944ad={};_0xc944ad[_0x42fb('0x2a')]=_[_0x42fb('0x28')](db[_0x42fb('0x37')]['rawAttributes']);_0xc944ad[_0x42fb('0x27')]=_[_0x42fb('0x28')](_0x4ec613[_0x42fb('0x27')]);_0xc944ad[_0x42fb('0x32')]=_[_0x42fb('0x29')](_0xc944ad[_0x42fb('0x2a')],_0xc944ad['query']);_0x277f92['attributes']=_[_0x42fb('0x29')](_0xc944ad[_0x42fb('0x2a')],qs['fields'](_0x4ec613[_0x42fb('0x27')]['fields']));_0x277f92[_0x42fb('0x2b')]=_0x277f92[_0x42fb('0x2b')][_0x42fb('0x3d')]?_0x277f92[_0x42fb('0x2b')]:_0xc944ad[_0x42fb('0x2a')];if(_0x4ec613[_0x42fb('0x27')]['includeAll']){_0x277f92[_0x42fb('0x39')]=[{'all':!![]}];}_0x277f92=_[_0x42fb('0x33')]({},_0x277f92,_0x4ec613[_0x42fb('0x36')]);return db['MailServerOut'][_0x42fb('0x3e')](_0x277f92)[_0x42fb('0x20')](handleEntityNotFound(_0x2f930c,null))[_0x42fb('0x20')](respondWithResult(_0x2f930c,null))['catch'](handleError(_0x2f930c,null));};exports[_0x42fb('0x3f')]=function(_0x5c3f39,_0x52edad){return db[_0x42fb('0x37')]['create'](_0x5c3f39['body'],{})[_0x42fb('0x20')](respondWithResult(_0x52edad,0xc9))[_0x42fb('0x3b')](handleError(_0x52edad,null));};exports[_0x42fb('0x1f')]=function(_0x5cd999,_0x2c6bf0){if(_0x5cd999['body']['id']){delete _0x5cd999[_0x42fb('0x40')]['id'];}return db[_0x42fb('0x37')][_0x42fb('0x3e')]({'where':{'id':_0x5cd999[_0x42fb('0x41')]['id']}})[_0x42fb('0x20')](handleEntityNotFound(_0x2c6bf0,null))[_0x42fb('0x20')](saveUpdates(_0x5cd999[_0x42fb('0x40')],null))[_0x42fb('0x20')](respondWithResult(_0x2c6bf0,null))['catch'](handleError(_0x2c6bf0,null));};exports[_0x42fb('0x42')]=function(_0x59bb93,_0x67806e){return db[_0x42fb('0x37')][_0x42fb('0x3e')]({'where':{'id':_0x59bb93['params']['id']}})[_0x42fb('0x20')](handleEntityNotFound(_0x67806e,null))[_0x42fb('0x20')](removeEntity(_0x67806e,null))[_0x42fb('0x3b')](handleError(_0x67806e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8f2fae3..956dd09 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 _0x7146=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7146,0x1c8));var _0x6714=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x7146[_0x414655];return _0x237884;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var logger=require(_0x6714('0x2'))(_0x6714('0x3'));var moment=require(_0x6714('0x4'));var BPromise=require(_0x6714('0x5'));var rp=require(_0x6714('0x6'));var fs=require('fs');var path=require(_0x6714('0x7'));var rimraf=require(_0x6714('0x8'));var config=require(_0x6714('0x9'));var attributes=require(_0x6714('0xa'));module['exports']=function(_0x7c2776,_0xe0e2f5){return _0x7c2776[_0x6714('0xb')](_0x6714('0xc'),attributes,{'tableName':_0x6714('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48da=['api','rimraf','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x46c073,_0x4ca7fc){var _0x4e377f=function(_0x1d7c36){while(--_0x1d7c36){_0x46c073['push'](_0x46c073['shift']());}};_0x4e377f(++_0x4ca7fc);}(_0x48da,0xad));var _0xa48d=function(_0x559523,_0x52d6d1){_0x559523=_0x559523-0x0;var _0xeb4688=_0x48da[_0x559523];return _0xeb4688;};'use strict';var _=require(_0xa48d('0x0'));var util=require(_0xa48d('0x1'));var logger=require(_0xa48d('0x2'))(_0xa48d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa48d('0x4'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x4cf475,_0x439a01){return _0x4cf475[_0xa48d('0x5')](_0xa48d('0x6'),attributes,{'tableName':_0xa48d('0x7'),'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 59e4d56..76bd414 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xe9e5eb,_0xef2e19){var _0x53709f=function(_0x5da543){while(--_0x5da543){_0xe9e5eb['push'](_0xe9e5eb['shift']());}};_0x53709f(++_0xef2e19);}(_0x1261,0x144));var _0x1126=function(_0x2fa393,_0x57e26d){_0x2fa393=_0x2fa393-0x0;var _0x15a4fb=_0x1261[_0x2fa393];return _0x15a4fb;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x54a2be,_0x448e7){var _0x48d32a=function(_0x18bbff){while(--_0x18bbff){_0x54a2be['push'](_0x54a2be['shift']());}};_0x48d32a(++_0x448e7);}(_0xdb28,0x106));var _0x8db2=function(_0x453904,_0x5522c9){_0x453904=_0x453904-0x0;var _0x796840=_0xdb28[_0x453904];return _0x796840;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a0654a5..060b28b 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 _0x8b10=['get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0xb053,_0x92ad){var _0x127acb=function(_0x4eca9b){while(--_0x4eca9b){_0xb053['push'](_0xb053['shift']());}};_0x127acb(++_0x92ad);}(_0x8b10,0xd1));var _0x08b1=function(_0x5e4219,_0x29381f){_0x5e4219=_0x5e4219-0x0;var _0x131763=_0x8b10[_0x5e4219];return _0x131763;};'use strict';var multer=require(_0x08b1('0x0'));var util=require(_0x08b1('0x1'));var path=require(_0x08b1('0x2'));var timeout=require(_0x08b1('0x3'));var express=require(_0x08b1('0x4'));var router=express[_0x08b1('0x5')]();var fs_extra=require(_0x08b1('0x6'));var auth=require(_0x08b1('0x7'));var interaction=require(_0x08b1('0x8'));var config=require(_0x08b1('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x08b1('0xa')]);router[_0x08b1('0xb')](_0x08b1('0xc'),auth[_0x08b1('0xd')](),controller['describe']);router[_0x08b1('0xb')](_0x08b1('0xe'),auth[_0x08b1('0xd')](),controller[_0x08b1('0xf')]);router[_0x08b1('0x10')]('/',auth[_0x08b1('0xd')](),controller[_0x08b1('0x11')]);router[_0x08b1('0x12')](_0x08b1('0xe'),auth[_0x08b1('0xd')](),controller[_0x08b1('0x13')]);router[_0x08b1('0x14')](_0x08b1('0xe'),auth[_0x08b1('0xd')](),controller['destroy']);module[_0x08b1('0x15')]=router; \ No newline at end of file +var _0x8204=['get','index','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x2ad076,_0x57abf1){var _0x43ea81=function(_0x3e8d75){while(--_0x3e8d75){_0x2ad076['push'](_0x2ad076['shift']());}};_0x43ea81(++_0x57abf1);}(_0x8204,0x1d7));var _0x4820=function(_0x48e67e,_0x3c9d04){_0x48e67e=_0x48e67e-0x0;var _0x1a404c=_0x8204[_0x48e67e];return _0x1a404c;};'use strict';var multer=require(_0x4820('0x0'));var util=require(_0x4820('0x1'));var path=require(_0x4820('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4820('0x3')]();var fs_extra=require(_0x4820('0x4'));var auth=require(_0x4820('0x5'));var interaction=require(_0x4820('0x6'));var config=require(_0x4820('0x7'));var controller=require(_0x4820('0x8'));router[_0x4820('0x9')]('/',auth['isAuthenticated'](),controller[_0x4820('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4820('0x9')]('/:id',auth[_0x4820('0xb')](),controller[_0x4820('0xc')]);router[_0x4820('0xd')]('/',auth[_0x4820('0xb')](),controller[_0x4820('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4820('0xf')]);router[_0x4820('0x10')](_0x4820('0x11'),auth[_0x4820('0xb')](),controller[_0x4820('0x12')]);module[_0x4820('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4bfa088..ca81bd4 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 _0xb138=['name','sequelize','exports','STRING'];(function(_0x12ec05,_0x4dbb11){var _0x1c17e0=function(_0x4320ac){while(--_0x4320ac){_0x12ec05['push'](_0x12ec05['shift']());}};_0x1c17e0(++_0x4dbb11);}(_0xb138,0x1dd));var _0x8b13=function(_0x43ee5f,_0x38285d){_0x43ee5f=_0x43ee5f-0x0;var _0xe856e9=_0xb138[_0x43ee5f];return _0xe856e9;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'unique':_0x8b13('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8b13('0x2')]}}; \ No newline at end of file +var _0x446c=['STRING','name','sequelize','exports'];(function(_0x16ae36,_0x4f2e57){var _0x3473be=function(_0x426274){while(--_0x426274){_0x16ae36['push'](_0x16ae36['shift']());}};_0x3473be(++_0x4f2e57);}(_0x446c,0x156));var _0xc446=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x446c[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'unique':_0xc446('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 bce6f37..92d2489 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 _0x3079=['mustache','path','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','MailSubstatus','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','map','filter','options','includeAll','findAll','rows','params','rawAttributes','intersection','include','find','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1cecef,_0x1a217e){var _0x1a994d=function(_0xb9b9cb){while(--_0xb9b9cb){_0x1cecef['push'](_0x1cecef['shift']());}};_0x1a994d(++_0x1a217e);}(_0x3079,0x112));var _0x9307=function(_0x25c28c,_0x5d134a){_0x25c28c=_0x25c28c-0x0;var _0x3c71c4=_0x3079[_0x25c28c];return _0x3c71c4;};'use strict';var emlformat=require(_0x9307('0x0'));var rimraf=require(_0x9307('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9307('0x2'));var rp=require(_0x9307('0x3'));var moment=require(_0x9307('0x4'));var BPromise=require(_0x9307('0x5'));var Mustache=require(_0x9307('0x6'));var util=require('util');var path=require(_0x9307('0x7'));var sox=require(_0x9307('0x8'));var csv=require(_0x9307('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9307('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9307('0xb'));var toCsv=require(_0x9307('0x9'));var querystring=require(_0x9307('0xc'));var Papa=require(_0x9307('0xd'));var Redis=require(_0x9307('0xe'));var authService=require(_0x9307('0xf'));var qs=require(_0x9307('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9307('0x11'));var logger=require(_0x9307('0x12'))('api');var utils=require(_0x9307('0x13'));var config=require(_0x9307('0x14'));var licenseUtil=require(_0x9307('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b1d5,_0x28e402){_0x28e402=_0x28e402||0xcc;return function(_0x35fe8f){if(_0x35fe8f){return _0x23b1d5[_0x9307('0x16')](_0x28e402);}return _0x23b1d5[_0x9307('0x17')](_0x28e402)[_0x9307('0x18')]();};}function respondWithResult(_0x1f3379,_0x3eb96a){_0x3eb96a=_0x3eb96a||0xc8;return function(_0x4d9eab){if(_0x4d9eab){return _0x1f3379[_0x9307('0x17')](_0x3eb96a)[_0x9307('0x19')](_0x4d9eab);}};}function respondWithFilteredResult(_0x95aeaa,_0x4b1ee5){return function(_0x48e363){if(_0x48e363){var _0x62dc8c=typeof _0x4b1ee5[_0x9307('0x1a')]===_0x9307('0x1b')&&typeof _0x4b1ee5['limit']==='undefined';var _0x402044=_0x48e363['count'];var _0x2173d1=_0x62dc8c?0x0:_0x4b1ee5['offset'];var _0x5c727c=_0x62dc8c?_0x48e363[_0x9307('0x1c')]:_0x4b1ee5['offset']+_0x4b1ee5[_0x9307('0x1d')];var _0x497aeb;if(_0x5c727c>=_0x402044){_0x5c727c=_0x402044;_0x497aeb=0xc8;}else{_0x497aeb=0xce;}_0x95aeaa[_0x9307('0x17')](_0x497aeb);return _0x95aeaa[_0x9307('0x1e')](_0x9307('0x1f'),_0x2173d1+'-'+_0x5c727c+'/'+_0x402044)[_0x9307('0x19')](_0x48e363);}return null;};}function patchUpdates(_0x5f4dbf){return function(_0xda3c18){try{jsonpatch['apply'](_0xda3c18,_0x5f4dbf,!![]);}catch(_0x35cc4c){return BPromise[_0x9307('0x20')](_0x35cc4c);}return _0xda3c18[_0x9307('0x21')]();};}function saveUpdates(_0x3f9396,_0x284418){return function(_0x33bf2c){if(_0x33bf2c){return _0x33bf2c[_0x9307('0x22')](_0x3f9396)[_0x9307('0x23')](function(_0xf6164f){return _0xf6164f;});}return null;};}function removeEntity(_0x4eb88d,_0x58a0a9){return function(_0x31ecfe){if(_0x31ecfe){return _0x31ecfe[_0x9307('0x24')]()[_0x9307('0x23')](function(){_0x4eb88d['status'](0xcc)[_0x9307('0x18')]();});}};}function handleEntityNotFound(_0x3eebde,_0x8eb5b4){return function(_0x990d08){if(!_0x990d08){_0x3eebde['sendStatus'](0x194);}return _0x990d08;};}function handleError(_0x44429f,_0x467680){_0x467680=_0x467680||0x1f4;return function(_0x19b79a){logger['error'](_0x19b79a['stack']);if(_0x19b79a[_0x9307('0x25')]){delete _0x19b79a['name'];}_0x44429f[_0x9307('0x17')](_0x467680)[_0x9307('0x26')](_0x19b79a);};}exports[_0x9307('0x27')]=function(_0x3dc010,_0x44384f){var _0x430570={},_0x397855={},_0x4bca19={'count':0x0,'rows':[]};var _0x24190b=_['map'](db[_0x9307('0x28')]['rawAttributes'],function(_0x598c6b){return{'name':_0x598c6b[_0x9307('0x29')],'type':_0x598c6b[_0x9307('0x2a')][_0x9307('0x2b')]};});_0x397855[_0x9307('0x2c')]=_['map'](_0x24190b,_0x9307('0x25'));_0x397855['query']=_[_0x9307('0x2d')](_0x3dc010[_0x9307('0x2e')]);_0x397855[_0x9307('0x2f')]=_['intersection'](_0x397855[_0x9307('0x2c')],_0x397855['query']);_0x430570['attributes']=_['intersection'](_0x397855[_0x9307('0x2c')],qs[_0x9307('0x30')](_0x3dc010[_0x9307('0x2e')][_0x9307('0x30')]));_0x430570[_0x9307('0x31')]=_0x430570[_0x9307('0x31')][_0x9307('0x32')]?_0x430570[_0x9307('0x31')]:_0x397855['model'];if(!_0x3dc010[_0x9307('0x2e')][_0x9307('0x33')]('nolimit')){_0x430570[_0x9307('0x1d')]=qs['limit'](_0x3dc010[_0x9307('0x2e')][_0x9307('0x1d')]);_0x430570[_0x9307('0x1a')]=qs['offset'](_0x3dc010['query']['offset']);}_0x430570['order']=qs[_0x9307('0x34')](_0x3dc010[_0x9307('0x2e')][_0x9307('0x34')]);_0x430570[_0x9307('0x35')]=qs[_0x9307('0x2f')](_[_0x9307('0x36')](_0x3dc010[_0x9307('0x2e')],_0x397855[_0x9307('0x2f')]),_0x24190b);if(_0x3dc010[_0x9307('0x2e')]['filter']){_0x430570['where']=_[_0x9307('0x37')](_0x430570[_0x9307('0x35')],{'$or':_[_0x9307('0x38')](_0x24190b,function(_0x56a0a8){if(_0x56a0a8[_0x9307('0x2a')]!=='VIRTUAL'){var _0x270388={};_0x270388[_0x56a0a8[_0x9307('0x25')]]={'$like':'%'+_0x3dc010['query'][_0x9307('0x39')]+'%'};return _0x270388;}})});}_0x430570=_['merge']({},_0x430570,_0x3dc010[_0x9307('0x3a')]);var _0x5e2fc0={'where':_0x430570['where']};return db[_0x9307('0x28')][_0x9307('0x1c')](_0x5e2fc0)[_0x9307('0x23')](function(_0x5ad365){_0x4bca19[_0x9307('0x1c')]=_0x5ad365;if(_0x3dc010[_0x9307('0x2e')][_0x9307('0x3b')]){_0x430570['include']=[{'all':!![]}];}return db[_0x9307('0x28')][_0x9307('0x3c')](_0x430570);})[_0x9307('0x23')](function(_0x273b42){_0x4bca19[_0x9307('0x3d')]=_0x273b42;return _0x4bca19;})[_0x9307('0x23')](respondWithFilteredResult(_0x44384f,_0x430570))['catch'](handleError(_0x44384f,null));};exports['show']=function(_0x199a7d,_0x4dc905){var _0x2b2085={'raw':!![],'where':{'id':_0x199a7d[_0x9307('0x3e')]['id']}},_0x8ea05={};_0x8ea05[_0x9307('0x2c')]=_[_0x9307('0x2d')](db[_0x9307('0x28')][_0x9307('0x3f')]);_0x8ea05[_0x9307('0x2e')]=_[_0x9307('0x2d')](_0x199a7d[_0x9307('0x2e')]);_0x8ea05[_0x9307('0x2f')]=_[_0x9307('0x40')](_0x8ea05['model'],_0x8ea05[_0x9307('0x2e')]);_0x2b2085[_0x9307('0x31')]=_[_0x9307('0x40')](_0x8ea05[_0x9307('0x2c')],qs[_0x9307('0x30')](_0x199a7d[_0x9307('0x2e')][_0x9307('0x30')]));_0x2b2085[_0x9307('0x31')]=_0x2b2085[_0x9307('0x31')][_0x9307('0x32')]?_0x2b2085[_0x9307('0x31')]:_0x8ea05['model'];if(_0x199a7d[_0x9307('0x2e')][_0x9307('0x3b')]){_0x2b2085[_0x9307('0x41')]=[{'all':!![]}];}_0x2b2085=_['merge']({},_0x2b2085,_0x199a7d[_0x9307('0x3a')]);return db['MailSubstatus'][_0x9307('0x42')](_0x2b2085)[_0x9307('0x23')](handleEntityNotFound(_0x4dc905,null))[_0x9307('0x23')](respondWithResult(_0x4dc905,null))[_0x9307('0x43')](handleError(_0x4dc905,null));};exports['create']=function(_0x59a3d9,_0xab6884){return db[_0x9307('0x28')]['create'](_0x59a3d9[_0x9307('0x44')],{})['then'](respondWithResult(_0xab6884,0xc9))['catch'](handleError(_0xab6884,null));};exports[_0x9307('0x22')]=function(_0x367ae5,_0x31e331){if(_0x367ae5[_0x9307('0x44')]['id']){delete _0x367ae5[_0x9307('0x44')]['id'];}return db[_0x9307('0x28')]['find']({'where':{'id':_0x367ae5[_0x9307('0x3e')]['id']}})[_0x9307('0x23')](handleEntityNotFound(_0x31e331,null))[_0x9307('0x23')](saveUpdates(_0x367ae5[_0x9307('0x44')],null))[_0x9307('0x23')](respondWithResult(_0x31e331,null))[_0x9307('0x43')](handleError(_0x31e331,null));};exports[_0x9307('0x24')]=function(_0x8877c9,_0x5dadc7){return db[_0x9307('0x28')][_0x9307('0x42')]({'where':{'id':_0x8877c9[_0x9307('0x3e')]['id']}})[_0x9307('0x23')](handleEntityNotFound(_0x5dadc7,null))[_0x9307('0x23')](removeEntity(_0x5dadc7,null))[_0x9307('0x43')](handleError(_0x5dadc7,null));};exports[_0x9307('0x45')]=function(_0x295fde,_0x10634b){return db[_0x9307('0x28')][_0x9307('0x45')]()[_0x9307('0x23')](respondWithResult(_0x10634b,null))[_0x9307('0x43')](handleError(_0x10634b,null));}; \ No newline at end of file +var _0xc714=['merge','VIRTUAL','options','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x570db0,_0x5c0a32){var _0x340990=function(_0x52d1ea){while(--_0x52d1ea){_0x570db0['push'](_0x570db0['shift']());}};_0x340990(++_0x5c0a32);}(_0xc714,0x13a));var _0x4c71=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc714[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4c71('0x0'));var rimraf=require(_0x4c71('0x1'));var zipdir=require(_0x4c71('0x2'));var jsonpatch=require(_0x4c71('0x3'));var rp=require(_0x4c71('0x4'));var moment=require(_0x4c71('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4c71('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4c71('0x7'));var csv=require(_0x4c71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c71('0x9'));var _=require(_0x4c71('0xa'));var squel=require('squel');var crypto=require(_0x4c71('0xb'));var jsforce=require(_0x4c71('0xc'));var deskjs=require(_0x4c71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4c71('0xe'));var Papa=require(_0x4c71('0xf'));var Redis=require('ioredis');var authService=require(_0x4c71('0x10'));var qs=require(_0x4c71('0x11'));var as=require(_0x4c71('0x12'));var hardwareService=require(_0x4c71('0x13'));var logger=require(_0x4c71('0x14'))(_0x4c71('0x15'));var utils=require(_0x4c71('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4c71('0x17'));var db=require(_0x4c71('0x18'))['db'];function respondWithStatusCode(_0x4e589b,_0x2743b2){_0x2743b2=_0x2743b2||0xcc;return function(_0x43adb){if(_0x43adb){return _0x4e589b[_0x4c71('0x19')](_0x2743b2);}return _0x4e589b[_0x4c71('0x1a')](_0x2743b2)[_0x4c71('0x1b')]();};}function respondWithResult(_0x2b7755,_0x20e1e5){_0x20e1e5=_0x20e1e5||0xc8;return function(_0x14c396){if(_0x14c396){return _0x2b7755[_0x4c71('0x1a')](_0x20e1e5)[_0x4c71('0x1c')](_0x14c396);}};}function respondWithFilteredResult(_0x57ce27,_0x1fa573){return function(_0x2c7081){if(_0x2c7081){var _0x130095=typeof _0x1fa573[_0x4c71('0x1d')]===_0x4c71('0x1e')&&typeof _0x1fa573['limit']===_0x4c71('0x1e');var _0x443e94=_0x2c7081[_0x4c71('0x1f')];var _0x26c4a5=_0x130095?0x0:_0x1fa573[_0x4c71('0x1d')];var _0x24b7af=_0x130095?_0x2c7081[_0x4c71('0x1f')]:_0x1fa573[_0x4c71('0x1d')]+_0x1fa573[_0x4c71('0x20')];var _0x20e255;if(_0x24b7af>=_0x443e94){_0x24b7af=_0x443e94;_0x20e255=0xc8;}else{_0x20e255=0xce;}_0x57ce27['status'](_0x20e255);return _0x57ce27[_0x4c71('0x21')]('Content-Range',_0x26c4a5+'-'+_0x24b7af+'/'+_0x443e94)[_0x4c71('0x1c')](_0x2c7081);}return null;};}function patchUpdates(_0x5155d6){return function(_0x3baf76){try{jsonpatch['apply'](_0x3baf76,_0x5155d6,!![]);}catch(_0x5c5ed9){return BPromise[_0x4c71('0x22')](_0x5c5ed9);}return _0x3baf76[_0x4c71('0x23')]();};}function saveUpdates(_0x93fdb1,_0x34e3c3){return function(_0x18a6dc){if(_0x18a6dc){return _0x18a6dc[_0x4c71('0x24')](_0x93fdb1)[_0x4c71('0x25')](function(_0x340fa0){return _0x340fa0;});}return null;};}function removeEntity(_0x368b50,_0x489d9b){return function(_0x4085d0){if(_0x4085d0){return _0x4085d0['destroy']()['then'](function(){_0x368b50[_0x4c71('0x1a')](0xcc)[_0x4c71('0x1b')]();});}};}function handleEntityNotFound(_0x52b0e5,_0x41dc38){return function(_0x1d9259){if(!_0x1d9259){_0x52b0e5[_0x4c71('0x19')](0x194);}return _0x1d9259;};}function handleError(_0x5b9ff6,_0x2187d5){_0x2187d5=_0x2187d5||0x1f4;return function(_0x513f6b){logger[_0x4c71('0x26')](_0x513f6b[_0x4c71('0x27')]);if(_0x513f6b[_0x4c71('0x28')]){delete _0x513f6b[_0x4c71('0x28')];}_0x5b9ff6[_0x4c71('0x1a')](_0x2187d5)['send'](_0x513f6b);};}exports[_0x4c71('0x29')]=function(_0x864646,_0x5a66b5){var _0x1eac09={},_0x4516c2={},_0x1a341d={'count':0x0,'rows':[]};var _0x1b5647=_[_0x4c71('0x2a')](db[_0x4c71('0x2b')]['rawAttributes'],function(_0x304a00){return{'name':_0x304a00[_0x4c71('0x2c')],'type':_0x304a00[_0x4c71('0x2d')][_0x4c71('0x2e')]};});_0x4516c2[_0x4c71('0x2f')]=_['map'](_0x1b5647,'name');_0x4516c2[_0x4c71('0x30')]=_[_0x4c71('0x31')](_0x864646[_0x4c71('0x30')]);_0x4516c2[_0x4c71('0x32')]=_[_0x4c71('0x33')](_0x4516c2[_0x4c71('0x2f')],_0x4516c2[_0x4c71('0x30')]);_0x1eac09[_0x4c71('0x34')]=_[_0x4c71('0x33')](_0x4516c2[_0x4c71('0x2f')],qs[_0x4c71('0x35')](_0x864646[_0x4c71('0x30')][_0x4c71('0x35')]));_0x1eac09['attributes']=_0x1eac09['attributes'][_0x4c71('0x36')]?_0x1eac09['attributes']:_0x4516c2[_0x4c71('0x2f')];if(!_0x864646['query'][_0x4c71('0x37')](_0x4c71('0x38'))){_0x1eac09[_0x4c71('0x20')]=qs[_0x4c71('0x20')](_0x864646[_0x4c71('0x30')][_0x4c71('0x20')]);_0x1eac09['offset']=qs[_0x4c71('0x1d')](_0x864646[_0x4c71('0x30')][_0x4c71('0x1d')]);}_0x1eac09[_0x4c71('0x39')]=qs[_0x4c71('0x3a')](_0x864646[_0x4c71('0x30')][_0x4c71('0x3a')]);_0x1eac09[_0x4c71('0x3b')]=qs[_0x4c71('0x32')](_[_0x4c71('0x3c')](_0x864646[_0x4c71('0x30')],_0x4516c2['filters']),_0x1b5647);if(_0x864646[_0x4c71('0x30')]['filter']){_0x1eac09[_0x4c71('0x3b')]=_[_0x4c71('0x3d')](_0x1eac09[_0x4c71('0x3b')],{'$or':_[_0x4c71('0x2a')](_0x1b5647,function(_0x564144){if(_0x564144[_0x4c71('0x2d')]!==_0x4c71('0x3e')){var _0x5533ae={};_0x5533ae[_0x564144[_0x4c71('0x28')]]={'$like':'%'+_0x864646[_0x4c71('0x30')]['filter']+'%'};return _0x5533ae;}})});}_0x1eac09=_[_0x4c71('0x3d')]({},_0x1eac09,_0x864646[_0x4c71('0x3f')]);var _0x1ecbde={'where':_0x1eac09[_0x4c71('0x3b')]};return db[_0x4c71('0x2b')][_0x4c71('0x1f')](_0x1ecbde)['then'](function(_0x1551c9){_0x1a341d['count']=_0x1551c9;if(_0x864646['query']['includeAll']){_0x1eac09[_0x4c71('0x40')]=[{'all':!![]}];}return db['MailSubstatus'][_0x4c71('0x41')](_0x1eac09);})[_0x4c71('0x25')](function(_0x528770){_0x1a341d[_0x4c71('0x42')]=_0x528770;return _0x1a341d;})[_0x4c71('0x25')](respondWithFilteredResult(_0x5a66b5,_0x1eac09))['catch'](handleError(_0x5a66b5,null));};exports[_0x4c71('0x43')]=function(_0x2244c6,_0x5b4702){var _0x299e7d={'raw':!![],'where':{'id':_0x2244c6['params']['id']}},_0x5a9542={};_0x5a9542['model']=_['keys'](db[_0x4c71('0x2b')]['rawAttributes']);_0x5a9542['query']=_[_0x4c71('0x31')](_0x2244c6[_0x4c71('0x30')]);_0x5a9542[_0x4c71('0x32')]=_[_0x4c71('0x33')](_0x5a9542[_0x4c71('0x2f')],_0x5a9542['query']);_0x299e7d[_0x4c71('0x34')]=_[_0x4c71('0x33')](_0x5a9542[_0x4c71('0x2f')],qs[_0x4c71('0x35')](_0x2244c6['query']['fields']));_0x299e7d[_0x4c71('0x34')]=_0x299e7d[_0x4c71('0x34')]['length']?_0x299e7d['attributes']:_0x5a9542[_0x4c71('0x2f')];if(_0x2244c6[_0x4c71('0x30')]['includeAll']){_0x299e7d[_0x4c71('0x40')]=[{'all':!![]}];}_0x299e7d=_[_0x4c71('0x3d')]({},_0x299e7d,_0x2244c6[_0x4c71('0x3f')]);return db[_0x4c71('0x2b')][_0x4c71('0x44')](_0x299e7d)[_0x4c71('0x25')](handleEntityNotFound(_0x5b4702,null))[_0x4c71('0x25')](respondWithResult(_0x5b4702,null))[_0x4c71('0x45')](handleError(_0x5b4702,null));};exports['create']=function(_0x1d9b65,_0x2d54ba){return db[_0x4c71('0x2b')][_0x4c71('0x46')](_0x1d9b65[_0x4c71('0x47')],{})[_0x4c71('0x25')](respondWithResult(_0x2d54ba,0xc9))[_0x4c71('0x45')](handleError(_0x2d54ba,null));};exports[_0x4c71('0x24')]=function(_0x49aa15,_0x4e7bd5){if(_0x49aa15[_0x4c71('0x47')]['id']){delete _0x49aa15['body']['id'];}return db[_0x4c71('0x2b')][_0x4c71('0x44')]({'where':{'id':_0x49aa15[_0x4c71('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e7bd5,null))['then'](saveUpdates(_0x49aa15[_0x4c71('0x47')],null))[_0x4c71('0x25')](respondWithResult(_0x4e7bd5,null))[_0x4c71('0x45')](handleError(_0x4e7bd5,null));};exports[_0x4c71('0x49')]=function(_0x1fee3c,_0x5a64b4){return db[_0x4c71('0x2b')]['find']({'where':{'id':_0x1fee3c[_0x4c71('0x48')]['id']}})[_0x4c71('0x25')](handleEntityNotFound(_0x5a64b4,null))[_0x4c71('0x25')](removeEntity(_0x5a64b4,null))[_0x4c71('0x45')](handleError(_0x5a64b4,null));};exports[_0x4c71('0x4a')]=function(_0x19c2a3,_0x2cd2e7){return db[_0x4c71('0x2b')][_0x4c71('0x4a')]()[_0x4c71('0x25')](respondWithResult(_0x2cd2e7,null))[_0x4c71('0x45')](handleError(_0x2cd2e7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 48a98c5..4ef9bcf 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 _0x79d4=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x1629f4,_0x3d2dac){var _0x410532=function(_0x14c0a6){while(--_0x14c0a6){_0x1629f4['push'](_0x1629f4['shift']());}};_0x410532(++_0x3d2dac);}(_0x79d4,0x153));var _0x479d=function(_0x10aa5c,_0x195355){_0x10aa5c=_0x10aa5c-0x0;var _0x3bd038=_0x79d4[_0x10aa5c];return _0x3bd038;};'use strict';var EventEmitter=require(_0x479d('0x0'));var MailSubstatus=require(_0x479d('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x479d('0x2')](0x0);var events={'afterUpdate':_0x479d('0x3')};function emitEvent(_0x53eb37){return function(_0x27a29b,_0x2a3aa1,_0x4020fd){MailSubstatusEvents[_0x479d('0x4')](_0x53eb37+':'+_0x27a29b['id'],_0x27a29b);MailSubstatusEvents[_0x479d('0x4')](_0x53eb37,_0x27a29b);_0x4020fd(null);};}for(var e in events){if(events[_0x479d('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x479d('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0xb812=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x46dcf9,_0x31fac7){var _0x11e6f1=function(_0x358b5f){while(--_0x358b5f){_0x46dcf9['push'](_0x46dcf9['shift']());}};_0x11e6f1(++_0x31fac7);}(_0xb812,0x1ea));var _0x2b81=function(_0x3b36c9,_0x46c4e4){_0x3b36c9=_0x3b36c9-0x0;var _0x343d81=_0xb812[_0x3b36c9];return _0x343d81;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x2b81('0x0'))['db'][_0x2b81('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2b81('0x2')](0x0);var events={'afterUpdate':_0x2b81('0x3')};function emitEvent(_0x292eeb){return function(_0x5a1029,_0x4a34cb,_0x45c36c){MailSubstatusEvents[_0x2b81('0x4')](_0x292eeb+':'+_0x5a1029['id'],_0x5a1029);MailSubstatusEvents[_0x2b81('0x4')](_0x292eeb,_0x5a1029);_0x45c36c(null);};}for(var e in events){if(events[_0x2b81('0x5')](e)){var event=events[e];MailSubstatus[_0x2b81('0x6')](e,emitEvent(event));}}module[_0x2b81('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7e874fa..76c33c3 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 _0x1a9e=['catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','update','name','mailSubstatus','_previousDataValues','then'];(function(_0x1a1932,_0x29b372){var _0x23fdb9=function(_0x3d05e2){while(--_0x3d05e2){_0x1a1932['push'](_0x1a1932['shift']());}};_0x23fdb9(++_0x29b372);}(_0x1a9e,0xfd));var _0xe1a9=function(_0x38d8a3,_0x4f4041){_0x38d8a3=_0x38d8a3-0x0;var _0x40e581=_0x1a9e[_0x38d8a3];return _0x40e581;};'use strict';var attributes=require(_0xe1a9('0x0'));module[_0xe1a9('0x1')]=function(_0x9f6f8b){var _0x383162=_0x9f6f8b[_0xe1a9('0x2')];return _0x9f6f8b[_0xe1a9('0x3')](_0xe1a9('0x4'),attributes,{'tableName':_0xe1a9('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x27851d,_0x1cf361,_0x5a31a4){return _0x383162['Condition'][_0xe1a9('0x6')]({'value':_0x27851d[_0xe1a9('0x7')]},{'where':{'field':_0xe1a9('0x8'),'value':_0x27851d[_0xe1a9('0x9')]['name']}})[_0xe1a9('0xa')](function(){_0x5a31a4();})[_0xe1a9('0xb')](function(_0x417485){_0x5a31a4(_0x417485);});}}});}; \ No newline at end of file +var _0xc7c7=['mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','name'];(function(_0x14f8c4,_0x3c1bfc){var _0x39b8b8=function(_0x25ce4a){while(--_0x25ce4a){_0x14f8c4['push'](_0x14f8c4['shift']());}};_0x39b8b8(++_0x3c1bfc);}(_0xc7c7,0x71));var _0x7c7c=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xc7c7[_0x4fde08];return _0x12e725;};'use strict';var attributes=require(_0x7c7c('0x0'));module[_0x7c7c('0x1')]=function(_0x35e567){var _0x23c2e3=_0x35e567[_0x7c7c('0x2')];return _0x35e567[_0x7c7c('0x3')](_0x7c7c('0x4'),attributes,{'tableName':_0x7c7c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3ef5a3,_0x349cd7,_0x586c43){return _0x23c2e3[_0x7c7c('0x6')]['update']({'value':_0x3ef5a3[_0x7c7c('0x7')]},{'where':{'field':_0x7c7c('0x8'),'value':_0x3ef5a3[_0x7c7c('0x9')][_0x7c7c('0x7')]}})[_0x7c7c('0xa')](function(){_0x586c43();})['catch'](function(_0x53b467){_0x586c43(_0x53b467);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d4a3b69..4325a04 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 _0x4ac2=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c0dff,_0x259ec5){var _0x382af1=function(_0x2bfe6d){while(--_0x2bfe6d){_0x1c0dff['push'](_0x1c0dff['shift']());}};_0x382af1(++_0x259ec5);}(_0x4ac2,0x14f));var _0x24ac=function(_0x1fa1c8,_0x4961da){_0x1fa1c8=_0x1fa1c8-0x0;var _0x4ab673=_0x4ac2[_0x1fa1c8];return _0x4ab673;};'use strict';var _=require(_0x24ac('0x0'));var util=require(_0x24ac('0x1'));var moment=require(_0x24ac('0x2'));var BPromise=require(_0x24ac('0x3'));var rs=require(_0x24ac('0x4'));var fs=require('fs');var Redis=require(_0x24ac('0x5'));var db=require(_0x24ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ac('0x7'))('rpc');var config=require(_0x24ac('0x8'));var jayson=require(_0x24ac('0x9'));var client=jayson[_0x24ac('0xa')][_0x24ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x335dbb,_0x416317,_0xf0b3ce){return new BPromise(function(_0x44fd4d,_0x3d5684){return client['request'](_0x335dbb,_0xf0b3ce)[_0x24ac('0xc')](function(_0x48febb){logger[_0x24ac('0xd')](_0x24ac('0xe'),_0x416317,'request\x20sent');logger['debug'](_0x24ac('0xf'),_0x416317,_0x24ac('0x10'),JSON[_0x24ac('0x11')](_0x48febb));if(_0x48febb[_0x24ac('0x12')]){if(_0x48febb[_0x24ac('0x12')][_0x24ac('0x13')]===0x1f4){logger[_0x24ac('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x416317,_0x48febb[_0x24ac('0x12')]['message']);return _0x3d5684(_0x48febb[_0x24ac('0x12')][_0x24ac('0x14')]);}logger[_0x24ac('0x12')](_0x24ac('0xe'),_0x416317,_0x48febb[_0x24ac('0x12')][_0x24ac('0x14')]);return _0x44fd4d(_0x48febb[_0x24ac('0x12')][_0x24ac('0x14')]);}else{logger[_0x24ac('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x416317,_0x24ac('0x10'));_0x44fd4d(_0x48febb['result']['message']);}})[_0x24ac('0x15')](function(_0x3542c9){logger['error'](_0x24ac('0xe'),_0x416317,_0x3542c9);_0x3d5684(_0x3542c9);});});} \ No newline at end of file +var _0x0a16=['message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x10202e,_0x5ec307){var _0x48832c=function(_0x51a983){while(--_0x51a983){_0x10202e['push'](_0x10202e['shift']());}};_0x48832c(++_0x5ec307);}(_0x0a16,0x17e));var _0x60a1=function(_0x27370e,_0x52563e){_0x27370e=_0x27370e-0x0;var _0x128247=_0x0a16[_0x27370e];return _0x128247;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60a1('0x0'));var BPromise=require(_0x60a1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60a1('0x2'));var db=require(_0x60a1('0x3'))['db'];var utils=require(_0x60a1('0x4'));var logger=require(_0x60a1('0x5'))('rpc');var config=require(_0x60a1('0x6'));var jayson=require(_0x60a1('0x7'));var client=jayson['client'][_0x60a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3811a5,_0x1e27ad,_0x30d020){return new BPromise(function(_0xfa944b,_0x48e188){return client[_0x60a1('0x9')](_0x3811a5,_0x30d020)['then'](function(_0x438b65){logger[_0x60a1('0xa')](_0x60a1('0xb'),_0x1e27ad,_0x60a1('0xc'));logger[_0x60a1('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1e27ad,_0x60a1('0xc'),JSON[_0x60a1('0xe')](_0x438b65));if(_0x438b65[_0x60a1('0xf')]){if(_0x438b65[_0x60a1('0xf')][_0x60a1('0x10')]===0x1f4){logger[_0x60a1('0xf')](_0x60a1('0xb'),_0x1e27ad,_0x438b65['error'][_0x60a1('0x11')]);return _0x48e188(_0x438b65[_0x60a1('0xf')][_0x60a1('0x11')]);}logger['error'](_0x60a1('0xb'),_0x1e27ad,_0x438b65['error'][_0x60a1('0x11')]);return _0xfa944b(_0x438b65['error']['message']);}else{logger[_0x60a1('0xa')](_0x60a1('0xb'),_0x1e27ad,'request\x20sent');_0xfa944b(_0x438b65[_0x60a1('0x12')][_0x60a1('0x11')]);}})['catch'](function(_0x4ea193){logger[_0x60a1('0xf')](_0x60a1('0xb'),_0x1e27ad,_0x4ea193);_0x48e188(_0x4ea193);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5ef900e..f12d6fe 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 _0x2ffc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','put','update','delete','exports','multer','util','path'];(function(_0xb91000,_0x3bc242){var _0x2d0803=function(_0x2701da){while(--_0x2701da){_0xb91000['push'](_0xb91000['shift']());}};_0x2d0803(++_0x3bc242);}(_0x2ffc,0xa8));var _0xc2ff=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2ffc[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xc2ff('0x0'));var util=require(_0xc2ff('0x1'));var path=require(_0xc2ff('0x2'));var timeout=require(_0xc2ff('0x3'));var express=require(_0xc2ff('0x4'));var router=express[_0xc2ff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc2ff('0x6'));var interaction=require(_0xc2ff('0x7'));var config=require(_0xc2ff('0x8'));var controller=require(_0xc2ff('0x9'));router[_0xc2ff('0xa')]('/',auth[_0xc2ff('0xb')](),controller['index']);router['get'](_0xc2ff('0xc'),auth[_0xc2ff('0xb')](),controller[_0xc2ff('0xd')]);router[_0xc2ff('0xa')](_0xc2ff('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc2ff('0xb')](),controller['create']);router[_0xc2ff('0xf')]('/:id',auth[_0xc2ff('0xb')](),controller[_0xc2ff('0x10')]);router[_0xc2ff('0x11')](_0xc2ff('0xe'),auth[_0xc2ff('0xb')](),controller['destroy']);module[_0xc2ff('0x12')]=router; \ No newline at end of file +var _0x4cb7=['/:id','show','post','put','update','exports','path','connect-timeout','Router','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3e2ea1,_0x473055){var _0x4f830d=function(_0x22949d){while(--_0x22949d){_0x3e2ea1['push'](_0x3e2ea1['shift']());}};_0x4f830d(++_0x473055);}(_0x4cb7,0x86));var _0x74cb=function(_0x63de01,_0x140a1b){_0x63de01=_0x63de01-0x0;var _0x17d66f=_0x4cb7[_0x63de01];return _0x17d66f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x74cb('0x0'));var timeout=require(_0x74cb('0x1'));var express=require('express');var router=express[_0x74cb('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74cb('0x3'));var config=require('../../config/environment');var controller=require(_0x74cb('0x4'));router[_0x74cb('0x5')]('/',auth['isAuthenticated'](),controller[_0x74cb('0x6')]);router[_0x74cb('0x5')](_0x74cb('0x7'),auth[_0x74cb('0x8')](),controller[_0x74cb('0x9')]);router[_0x74cb('0x5')](_0x74cb('0xa'),auth[_0x74cb('0x8')](),controller[_0x74cb('0xb')]);router[_0x74cb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74cb('0xd')]('/:id',auth[_0x74cb('0x8')](),controller[_0x74cb('0xe')]);router['delete'](_0x74cb('0xa'),auth[_0x74cb('0x8')](),controller['destroy']);module[_0x74cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6c6565c..493cd65 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5ef39f,_0x356643){var _0xb61f5=function(_0x53a4a9){while(--_0x53a4a9){_0x5ef39f['push'](_0x5ef39f['shift']());}};_0xb61f5(++_0x356643);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xf3cd[_0x380e75];return _0x444d96;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x9bde,0xe1));var _0xe9bd=function(_0x51bce2,_0x4e7124){_0x51bce2=_0x51bce2-0x0;var _0x5b955e=_0x9bde[_0x51bce2];return _0x5b955e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6365dde..afeea64 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 _0xb228=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailTransferReport','rows','catch','params','keys','create','body','update','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','key','query'];(function(_0x3d5e4a,_0x1e7acd){var _0x542881=function(_0x329e36){while(--_0x329e36){_0x3d5e4a['push'](_0x3d5e4a['shift']());}};_0x542881(++_0x1e7acd);}(_0xb228,0x13c));var _0x8b22=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb228[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x8b22('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b22('0x1'));var jsonpatch=require(_0x8b22('0x2'));var rp=require('request-promise');var moment=require(_0x8b22('0x3'));var BPromise=require(_0x8b22('0x4'));var Mustache=require(_0x8b22('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8b22('0x6'));var csv=require('to-csv');var ejs=require(_0x8b22('0x7'));var fs=require('fs');var fs_extra=require(_0x8b22('0x8'));var _=require(_0x8b22('0x9'));var squel=require(_0x8b22('0xa'));var crypto=require(_0x8b22('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b22('0xc'));var toCsv=require(_0x8b22('0xd'));var querystring=require(_0x8b22('0xe'));var Papa=require(_0x8b22('0xf'));var Redis=require(_0x8b22('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b22('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b22('0x12'));var logger=require('../../config/logger')(_0x8b22('0x13'));var utils=require(_0x8b22('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8b22('0x15'));var db=require(_0x8b22('0x16'))['db'];function respondWithStatusCode(_0x7b204,_0x352f51){_0x352f51=_0x352f51||0xcc;return function(_0x12dd4d){if(_0x12dd4d){return _0x7b204[_0x8b22('0x17')](_0x352f51);}return _0x7b204[_0x8b22('0x18')](_0x352f51)[_0x8b22('0x19')]();};}function respondWithResult(_0x2abf73,_0x990e72){_0x990e72=_0x990e72||0xc8;return function(_0xd0be92){if(_0xd0be92){return _0x2abf73['status'](_0x990e72)[_0x8b22('0x1a')](_0xd0be92);}};}function respondWithFilteredResult(_0x4c4854,_0x284027){return function(_0x5a4ed5){if(_0x5a4ed5){var _0x3977d2=typeof _0x284027[_0x8b22('0x1b')]===_0x8b22('0x1c')&&typeof _0x284027['limit']===_0x8b22('0x1c');var _0x1deb7d=_0x5a4ed5[_0x8b22('0x1d')];var _0x107eee=_0x3977d2?0x0:_0x284027[_0x8b22('0x1b')];var _0x6a484c=_0x3977d2?_0x5a4ed5[_0x8b22('0x1d')]:_0x284027[_0x8b22('0x1b')]+_0x284027['limit'];var _0x454462;if(_0x6a484c>=_0x1deb7d){_0x6a484c=_0x1deb7d;_0x454462=0xc8;}else{_0x454462=0xce;}_0x4c4854['status'](_0x454462);return _0x4c4854[_0x8b22('0x1e')]('Content-Range',_0x107eee+'-'+_0x6a484c+'/'+_0x1deb7d)[_0x8b22('0x1a')](_0x5a4ed5);}return null;};}function patchUpdates(_0x591994){return function(_0x16d270){try{jsonpatch[_0x8b22('0x1f')](_0x16d270,_0x591994,!![]);}catch(_0x445128){return BPromise[_0x8b22('0x20')](_0x445128);}return _0x16d270[_0x8b22('0x21')]();};}function saveUpdates(_0x42074b,_0x510745){return function(_0x4e8901){if(_0x4e8901){return _0x4e8901['update'](_0x42074b)[_0x8b22('0x22')](function(_0x406341){return _0x406341;});}return null;};}function removeEntity(_0x324047,_0xa59d95){return function(_0x4a8fe7){if(_0x4a8fe7){return _0x4a8fe7[_0x8b22('0x23')]()[_0x8b22('0x22')](function(){_0x324047[_0x8b22('0x18')](0xcc)[_0x8b22('0x19')]();});}};}function handleEntityNotFound(_0xf29b26,_0x1a7631){return function(_0x45d1d0){if(!_0x45d1d0){_0xf29b26['sendStatus'](0x194);}return _0x45d1d0;};}function handleError(_0x3063a4,_0x45286e){_0x45286e=_0x45286e||0x1f4;return function(_0x29f196){logger[_0x8b22('0x24')](_0x29f196['stack']);if(_0x29f196[_0x8b22('0x25')]){delete _0x29f196[_0x8b22('0x25')];}_0x3063a4['status'](_0x45286e)['send'](_0x29f196);};}exports[_0x8b22('0x26')]=function(_0x45dc12,_0x30cf31){var _0x2ded33={},_0xedea50={},_0x142859={'count':0x0,'rows':[]};var _0xb44a9e=_[_0x8b22('0x27')](db['MailTransferReport'][_0x8b22('0x28')],function(_0x5eff28){return{'name':_0x5eff28[_0x8b22('0x29')],'type':_0x5eff28['type'][_0x8b22('0x2a')]};});_0xedea50['model']=_[_0x8b22('0x27')](_0xb44a9e,'name');_0xedea50[_0x8b22('0x2b')]=_['keys'](_0x45dc12[_0x8b22('0x2b')]);_0xedea50[_0x8b22('0x2c')]=_[_0x8b22('0x2d')](_0xedea50[_0x8b22('0x2e')],_0xedea50['query']);_0x2ded33[_0x8b22('0x2f')]=_[_0x8b22('0x2d')](_0xedea50['model'],qs[_0x8b22('0x30')](_0x45dc12[_0x8b22('0x2b')][_0x8b22('0x30')]));_0x2ded33[_0x8b22('0x2f')]=_0x2ded33[_0x8b22('0x2f')][_0x8b22('0x31')]?_0x2ded33[_0x8b22('0x2f')]:_0xedea50[_0x8b22('0x2e')];if(!_0x45dc12['query'][_0x8b22('0x32')](_0x8b22('0x33'))){_0x2ded33[_0x8b22('0x34')]=qs[_0x8b22('0x34')](_0x45dc12['query'][_0x8b22('0x34')]);_0x2ded33[_0x8b22('0x1b')]=qs[_0x8b22('0x1b')](_0x45dc12[_0x8b22('0x2b')][_0x8b22('0x1b')]);}_0x2ded33[_0x8b22('0x35')]=qs['sort'](_0x45dc12[_0x8b22('0x2b')][_0x8b22('0x36')]);_0x2ded33[_0x8b22('0x37')]=qs[_0x8b22('0x2c')](_[_0x8b22('0x38')](_0x45dc12[_0x8b22('0x2b')],_0xedea50[_0x8b22('0x2c')]),_0xb44a9e);if(_0x45dc12[_0x8b22('0x2b')][_0x8b22('0x39')]){_0x2ded33[_0x8b22('0x37')]=_[_0x8b22('0x3a')](_0x2ded33[_0x8b22('0x37')],{'$or':_[_0x8b22('0x27')](_0xb44a9e,function(_0x43ef92){if(_0x43ef92['type']!==_0x8b22('0x3b')){var _0x90206f={};_0x90206f[_0x43ef92[_0x8b22('0x25')]]={'$like':'%'+_0x45dc12[_0x8b22('0x2b')][_0x8b22('0x39')]+'%'};return _0x90206f;}})});}_0x2ded33=_[_0x8b22('0x3a')]({},_0x2ded33,_0x45dc12[_0x8b22('0x3c')]);var _0x3391c8={'where':_0x2ded33['where']};return db['MailTransferReport']['count'](_0x3391c8)[_0x8b22('0x22')](function(_0x11a97b){_0x142859[_0x8b22('0x1d')]=_0x11a97b;if(_0x45dc12['query'][_0x8b22('0x3d')]){_0x2ded33[_0x8b22('0x3e')]=[{'all':!![]}];}return db[_0x8b22('0x3f')]['findAll'](_0x2ded33);})[_0x8b22('0x22')](function(_0x38901f){_0x142859[_0x8b22('0x40')]=_0x38901f;return _0x142859;})[_0x8b22('0x22')](respondWithFilteredResult(_0x30cf31,_0x2ded33))[_0x8b22('0x41')](handleError(_0x30cf31,null));};exports['show']=function(_0x1eb281,_0xfa4f34){var _0x9bf11a={'raw':!![],'where':{'id':_0x1eb281[_0x8b22('0x42')]['id']}},_0x32a578={};_0x32a578[_0x8b22('0x2e')]=_[_0x8b22('0x43')](db[_0x8b22('0x3f')]['rawAttributes']);_0x32a578[_0x8b22('0x2b')]=_[_0x8b22('0x43')](_0x1eb281['query']);_0x32a578[_0x8b22('0x2c')]=_['intersection'](_0x32a578['model'],_0x32a578[_0x8b22('0x2b')]);_0x9bf11a['attributes']=_[_0x8b22('0x2d')](_0x32a578[_0x8b22('0x2e')],qs['fields'](_0x1eb281[_0x8b22('0x2b')][_0x8b22('0x30')]));_0x9bf11a['attributes']=_0x9bf11a['attributes']['length']?_0x9bf11a[_0x8b22('0x2f')]:_0x32a578[_0x8b22('0x2e')];if(_0x1eb281[_0x8b22('0x2b')]['includeAll']){_0x9bf11a[_0x8b22('0x3e')]=[{'all':!![]}];}_0x9bf11a=_[_0x8b22('0x3a')]({},_0x9bf11a,_0x1eb281[_0x8b22('0x3c')]);return db[_0x8b22('0x3f')]['find'](_0x9bf11a)[_0x8b22('0x22')](handleEntityNotFound(_0xfa4f34,null))[_0x8b22('0x22')](respondWithResult(_0xfa4f34,null))[_0x8b22('0x41')](handleError(_0xfa4f34,null));};exports[_0x8b22('0x44')]=function(_0x2edf16,_0xd9cf19){return db[_0x8b22('0x3f')][_0x8b22('0x44')](_0x2edf16[_0x8b22('0x45')],{})['then'](respondWithResult(_0xd9cf19,0xc9))[_0x8b22('0x41')](handleError(_0xd9cf19,null));};exports[_0x8b22('0x46')]=function(_0x4f4be7,_0x4ecf75){if(_0x4f4be7['body']['id']){delete _0x4f4be7[_0x8b22('0x45')]['id'];}return db[_0x8b22('0x3f')][_0x8b22('0x47')]({'where':{'id':_0x4f4be7[_0x8b22('0x42')]['id']}})[_0x8b22('0x22')](handleEntityNotFound(_0x4ecf75,null))[_0x8b22('0x22')](saveUpdates(_0x4f4be7[_0x8b22('0x45')],null))[_0x8b22('0x22')](respondWithResult(_0x4ecf75,null))[_0x8b22('0x41')](handleError(_0x4ecf75,null));};exports['destroy']=function(_0x422c07,_0x465511){return db[_0x8b22('0x3f')]['find']({'where':{'id':_0x422c07[_0x8b22('0x42')]['id']}})[_0x8b22('0x22')](handleEntityNotFound(_0x465511,null))['then'](removeEntity(_0x465511,null))['catch'](handleError(_0x465511,null));};exports['describe']=function(_0x2775a0,_0x558589){return db[_0x8b22('0x3f')]['describe']()['then'](respondWithResult(_0x558589,null))[_0x8b22('0x41')](handleError(_0x558589,null));}; \ No newline at end of file +var _0xd7ca=['include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ca,0xe8));var _0xad7c=function(_0x2841f9,_0x50fdcd){_0x2841f9=_0x2841f9-0x0;var _0x25fc99=_0xd7ca[_0x2841f9];return _0x25fc99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad7c('0x0'));var zipdir=require(_0xad7c('0x1'));var jsonpatch=require(_0xad7c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad7c('0x3'));var Mustache=require(_0xad7c('0x4'));var util=require(_0xad7c('0x5'));var path=require('path');var sox=require(_0xad7c('0x6'));var csv=require(_0xad7c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad7c('0x8'));var _=require(_0xad7c('0x9'));var squel=require(_0xad7c('0xa'));var crypto=require('crypto');var jsforce=require(_0xad7c('0xb'));var deskjs=require(_0xad7c('0xc'));var toCsv=require(_0xad7c('0x7'));var querystring=require(_0xad7c('0xd'));var Papa=require('papaparse');var Redis=require(_0xad7c('0xe'));var authService=require(_0xad7c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xad7c('0x10'));var hardwareService=require(_0xad7c('0x11'));var logger=require(_0xad7c('0x12'))(_0xad7c('0x13'));var utils=require(_0xad7c('0x14'));var config=require(_0xad7c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad7c('0x16'))['db'];function respondWithStatusCode(_0x23f805,_0x241e45){_0x241e45=_0x241e45||0xcc;return function(_0x4bc343){if(_0x4bc343){return _0x23f805[_0xad7c('0x17')](_0x241e45);}return _0x23f805['status'](_0x241e45)[_0xad7c('0x18')]();};}function respondWithResult(_0x2f5a47,_0xbc6e63){_0xbc6e63=_0xbc6e63||0xc8;return function(_0x21cacc){if(_0x21cacc){return _0x2f5a47['status'](_0xbc6e63)[_0xad7c('0x19')](_0x21cacc);}};}function respondWithFilteredResult(_0x49afd7,_0x95f069){return function(_0x5261c6){if(_0x5261c6){var _0x10e1c2=typeof _0x95f069[_0xad7c('0x1a')]===_0xad7c('0x1b')&&typeof _0x95f069[_0xad7c('0x1c')]===_0xad7c('0x1b');var _0x5cc157=_0x5261c6['count'];var _0x554e90=_0x10e1c2?0x0:_0x95f069[_0xad7c('0x1a')];var _0x491312=_0x10e1c2?_0x5261c6[_0xad7c('0x1d')]:_0x95f069[_0xad7c('0x1a')]+_0x95f069['limit'];var _0x2e61c1;if(_0x491312>=_0x5cc157){_0x491312=_0x5cc157;_0x2e61c1=0xc8;}else{_0x2e61c1=0xce;}_0x49afd7[_0xad7c('0x1e')](_0x2e61c1);return _0x49afd7[_0xad7c('0x1f')](_0xad7c('0x20'),_0x554e90+'-'+_0x491312+'/'+_0x5cc157)[_0xad7c('0x19')](_0x5261c6);}return null;};}function patchUpdates(_0x41ff89){return function(_0x3e32cb){try{jsonpatch['apply'](_0x3e32cb,_0x41ff89,!![]);}catch(_0x547596){return BPromise[_0xad7c('0x21')](_0x547596);}return _0x3e32cb['save']();};}function saveUpdates(_0x22740c,_0x2f96c0){return function(_0x3c8f77){if(_0x3c8f77){return _0x3c8f77[_0xad7c('0x22')](_0x22740c)[_0xad7c('0x23')](function(_0x47e9ec){return _0x47e9ec;});}return null;};}function removeEntity(_0xe35156,_0x37efbf){return function(_0x38a500){if(_0x38a500){return _0x38a500[_0xad7c('0x24')]()['then'](function(){_0xe35156['status'](0xcc)[_0xad7c('0x18')]();});}};}function handleEntityNotFound(_0x44a485,_0x488e36){return function(_0x26f214){if(!_0x26f214){_0x44a485[_0xad7c('0x17')](0x194);}return _0x26f214;};}function handleError(_0x53fc18,_0x37df0a){_0x37df0a=_0x37df0a||0x1f4;return function(_0x43aee6){logger[_0xad7c('0x25')](_0x43aee6[_0xad7c('0x26')]);if(_0x43aee6[_0xad7c('0x27')]){delete _0x43aee6['name'];}_0x53fc18[_0xad7c('0x1e')](_0x37df0a)[_0xad7c('0x28')](_0x43aee6);};}exports['index']=function(_0x2d0c0e,_0x382b6d){var _0xe1f53d={},_0x2ee1e0={},_0x4d28f6={'count':0x0,'rows':[]};var _0x4d03d8=_[_0xad7c('0x29')](db[_0xad7c('0x2a')]['rawAttributes'],function(_0x12e109){return{'name':_0x12e109[_0xad7c('0x2b')],'type':_0x12e109[_0xad7c('0x2c')][_0xad7c('0x2d')]};});_0x2ee1e0[_0xad7c('0x2e')]=_['map'](_0x4d03d8,'name');_0x2ee1e0[_0xad7c('0x2f')]=_[_0xad7c('0x30')](_0x2d0c0e[_0xad7c('0x2f')]);_0x2ee1e0[_0xad7c('0x31')]=_['intersection'](_0x2ee1e0[_0xad7c('0x2e')],_0x2ee1e0[_0xad7c('0x2f')]);_0xe1f53d[_0xad7c('0x32')]=_['intersection'](_0x2ee1e0[_0xad7c('0x2e')],qs[_0xad7c('0x33')](_0x2d0c0e['query'][_0xad7c('0x33')]));_0xe1f53d[_0xad7c('0x32')]=_0xe1f53d[_0xad7c('0x32')]['length']?_0xe1f53d[_0xad7c('0x32')]:_0x2ee1e0[_0xad7c('0x2e')];if(!_0x2d0c0e[_0xad7c('0x2f')]['hasOwnProperty'](_0xad7c('0x34'))){_0xe1f53d[_0xad7c('0x1c')]=qs[_0xad7c('0x1c')](_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x1c')]);_0xe1f53d[_0xad7c('0x1a')]=qs[_0xad7c('0x1a')](_0x2d0c0e['query'][_0xad7c('0x1a')]);}_0xe1f53d['order']=qs['sort'](_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x35')]);_0xe1f53d[_0xad7c('0x36')]=qs[_0xad7c('0x31')](_[_0xad7c('0x37')](_0x2d0c0e[_0xad7c('0x2f')],_0x2ee1e0[_0xad7c('0x31')]),_0x4d03d8);if(_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x38')]){_0xe1f53d[_0xad7c('0x36')]=_[_0xad7c('0x39')](_0xe1f53d[_0xad7c('0x36')],{'$or':_['map'](_0x4d03d8,function(_0x2aa800){if(_0x2aa800['type']!==_0xad7c('0x3a')){var _0x1a6d46={};_0x1a6d46[_0x2aa800[_0xad7c('0x27')]]={'$like':'%'+_0x2d0c0e[_0xad7c('0x2f')]['filter']+'%'};return _0x1a6d46;}})});}_0xe1f53d=_[_0xad7c('0x39')]({},_0xe1f53d,_0x2d0c0e['options']);var _0x563348={'where':_0xe1f53d[_0xad7c('0x36')]};return db[_0xad7c('0x2a')]['count'](_0x563348)[_0xad7c('0x23')](function(_0x1ac035){_0x4d28f6[_0xad7c('0x1d')]=_0x1ac035;if(_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x3b')]){_0xe1f53d[_0xad7c('0x3c')]=[{'all':!![]}];}return db[_0xad7c('0x2a')][_0xad7c('0x3d')](_0xe1f53d);})['then'](function(_0x34c3bd){_0x4d28f6[_0xad7c('0x3e')]=_0x34c3bd;return _0x4d28f6;})[_0xad7c('0x23')](respondWithFilteredResult(_0x382b6d,_0xe1f53d))['catch'](handleError(_0x382b6d,null));};exports[_0xad7c('0x3f')]=function(_0xb3243b,_0x155d36){var _0x321dcc={'raw':!![],'where':{'id':_0xb3243b[_0xad7c('0x40')]['id']}},_0xdef7ac={};_0xdef7ac[_0xad7c('0x2e')]=_[_0xad7c('0x30')](db[_0xad7c('0x2a')][_0xad7c('0x41')]);_0xdef7ac['query']=_[_0xad7c('0x30')](_0xb3243b['query']);_0xdef7ac[_0xad7c('0x31')]=_[_0xad7c('0x42')](_0xdef7ac[_0xad7c('0x2e')],_0xdef7ac['query']);_0x321dcc[_0xad7c('0x32')]=_[_0xad7c('0x42')](_0xdef7ac[_0xad7c('0x2e')],qs[_0xad7c('0x33')](_0xb3243b['query'][_0xad7c('0x33')]));_0x321dcc[_0xad7c('0x32')]=_0x321dcc[_0xad7c('0x32')][_0xad7c('0x43')]?_0x321dcc[_0xad7c('0x32')]:_0xdef7ac[_0xad7c('0x2e')];if(_0xb3243b[_0xad7c('0x2f')][_0xad7c('0x3b')]){_0x321dcc['include']=[{'all':!![]}];}_0x321dcc=_['merge']({},_0x321dcc,_0xb3243b['options']);return db['MailTransferReport'][_0xad7c('0x44')](_0x321dcc)[_0xad7c('0x23')](handleEntityNotFound(_0x155d36,null))[_0xad7c('0x23')](respondWithResult(_0x155d36,null))[_0xad7c('0x45')](handleError(_0x155d36,null));};exports[_0xad7c('0x46')]=function(_0x18a46b,_0x17b300){return db['MailTransferReport'][_0xad7c('0x46')](_0x18a46b['body'],{})[_0xad7c('0x23')](respondWithResult(_0x17b300,0xc9))['catch'](handleError(_0x17b300,null));};exports['update']=function(_0x1497ac,_0x21c443){if(_0x1497ac[_0xad7c('0x47')]['id']){delete _0x1497ac['body']['id'];}return db[_0xad7c('0x2a')][_0xad7c('0x44')]({'where':{'id':_0x1497ac[_0xad7c('0x40')]['id']}})[_0xad7c('0x23')](handleEntityNotFound(_0x21c443,null))['then'](saveUpdates(_0x1497ac[_0xad7c('0x47')],null))['then'](respondWithResult(_0x21c443,null))[_0xad7c('0x45')](handleError(_0x21c443,null));};exports['destroy']=function(_0x189a0d,_0x4cd909){return db[_0xad7c('0x2a')][_0xad7c('0x44')]({'where':{'id':_0x189a0d[_0xad7c('0x40')]['id']}})[_0xad7c('0x23')](handleEntityNotFound(_0x4cd909,null))[_0xad7c('0x23')](removeEntity(_0x4cd909,null))[_0xad7c('0x45')](handleError(_0x4cd909,null));};exports[_0xad7c('0x48')]=function(_0x30fd69,_0x52b3f2){return db['MailTransferReport'][_0xad7c('0x48')]()[_0xad7c('0x23')](respondWithResult(_0x52b3f2,null))[_0xad7c('0x45')](handleError(_0x52b3f2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 35b09df..a3f2a81 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 _0x15a9=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15a9,0x18a));var _0x915a=function(_0x2ec953,_0x2c8c15){_0x2ec953=_0x2ec953-0x0;var _0x43771b=_0x15a9[_0x2ec953];return _0x43771b;};'use strict';var _=require(_0x915a('0x0'));var util=require(_0x915a('0x1'));var logger=require(_0x915a('0x2'))(_0x915a('0x3'));var moment=require('moment');var BPromise=require(_0x915a('0x4'));var rp=require(_0x915a('0x5'));var fs=require('fs');var path=require(_0x915a('0x6'));var rimraf=require(_0x915a('0x7'));var config=require(_0x915a('0x8'));var attributes=require(_0x915a('0x9'));module[_0x915a('0xa')]=function(_0x40c3a7,_0x39e6ea){return _0x40c3a7[_0x915a('0xb')](_0x915a('0xc'),attributes,{'tableName':_0x915a('0xd'),'paranoid':![],'indexes':[{'name':_0x915a('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffb=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xfa775,_0xac95e0){var _0x515801=function(_0xf9c694){while(--_0xf9c694){_0xfa775['push'](_0xfa775['shift']());}};_0x515801(++_0xac95e0);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x225d9c,_0x15ae60){_0x225d9c=_0x225d9c-0x0;var _0x5af39d=_0x3ffb[_0x225d9c];return _0x5af39d;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require(_0xb3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x45d514,_0x59bcb3){return _0x45d514[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[{'name':_0xb3ff('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5b3fe11..35071ff 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 _0xa308=['request','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0xa308,0xf1));var _0x8a30=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa308[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x8a30('0x0'));var util=require(_0x8a30('0x1'));var moment=require(_0x8a30('0x2'));var BPromise=require(_0x8a30('0x3'));var rs=require(_0x8a30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a30('0x5'))['db'];var utils=require(_0x8a30('0x6'));var logger=require(_0x8a30('0x7'))(_0x8a30('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a30('0x9'));var client=jayson[_0x8a30('0xa')][_0x8a30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fe2e5,_0x551458,_0x1a4dac){return new BPromise(function(_0x4dd256,_0x484969){return client[_0x8a30('0xc')](_0x3fe2e5,_0x1a4dac)['then'](function(_0x525d91){logger[_0x8a30('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x551458,'request\x20sent');logger[_0x8a30('0xe')](_0x8a30('0xf'),_0x551458,_0x8a30('0x10'),JSON['stringify'](_0x525d91));if(_0x525d91[_0x8a30('0x11')]){if(_0x525d91[_0x8a30('0x11')][_0x8a30('0x12')]===0x1f4){logger['error'](_0x8a30('0x13'),_0x551458,_0x525d91[_0x8a30('0x11')][_0x8a30('0x14')]);return _0x484969(_0x525d91[_0x8a30('0x11')][_0x8a30('0x14')]);}logger[_0x8a30('0x11')](_0x8a30('0x13'),_0x551458,_0x525d91[_0x8a30('0x11')][_0x8a30('0x14')]);return _0x4dd256(_0x525d91[_0x8a30('0x11')][_0x8a30('0x14')]);}else{logger[_0x8a30('0xd')](_0x8a30('0x13'),_0x551458,_0x8a30('0x10'));_0x4dd256(_0x525d91[_0x8a30('0x15')][_0x8a30('0x14')]);}})[_0x8a30('0x16')](function(_0x15e0c2){logger[_0x8a30('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x551458,_0x15e0c2);_0x484969(_0x15e0c2);});});} \ No newline at end of file +var _0xf557=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x1ad04e,_0xf269b6){var _0xc1a78a=function(_0x410c64){while(--_0x410c64){_0x1ad04e['push'](_0x1ad04e['shift']());}};_0xc1a78a(++_0xf269b6);}(_0xf557,0x18f));var _0x7f55=function(_0x14af7c,_0x5d3c02){_0x14af7c=_0x14af7c-0x0;var _0x540da0=_0xf557[_0x14af7c];return _0x540da0;};'use strict';var _=require(_0x7f55('0x0'));var util=require(_0x7f55('0x1'));var moment=require(_0x7f55('0x2'));var BPromise=require(_0x7f55('0x3'));var rs=require(_0x7f55('0x4'));var fs=require('fs');var Redis=require(_0x7f55('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f55('0x6'));var logger=require(_0x7f55('0x7'))(_0x7f55('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f55('0x9'));var client=jayson[_0x7f55('0xa')][_0x7f55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11faab,_0x54a3f5,_0x1ed7d9){return new BPromise(function(_0x522d75,_0x246eae){return client[_0x7f55('0xc')](_0x11faab,_0x1ed7d9)['then'](function(_0x22aa95){logger[_0x7f55('0xd')](_0x7f55('0xe'),_0x54a3f5,_0x7f55('0xf'));logger[_0x7f55('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x54a3f5,_0x7f55('0xf'),JSON[_0x7f55('0x11')](_0x22aa95));if(_0x22aa95[_0x7f55('0x12')]){if(_0x22aa95['error'][_0x7f55('0x13')]===0x1f4){logger[_0x7f55('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x54a3f5,_0x22aa95[_0x7f55('0x12')]['message']);return _0x246eae(_0x22aa95[_0x7f55('0x12')][_0x7f55('0x14')]);}logger[_0x7f55('0x12')](_0x7f55('0xe'),_0x54a3f5,_0x22aa95[_0x7f55('0x12')][_0x7f55('0x14')]);return _0x522d75(_0x22aa95['error'][_0x7f55('0x14')]);}else{logger['info'](_0x7f55('0xe'),_0x54a3f5,_0x7f55('0xf'));_0x522d75(_0x22aa95[_0x7f55('0x15')][_0x7f55('0x14')]);}})[_0x7f55('0x16')](function(_0x461403){logger['error'](_0x7f55('0xe'),_0x54a3f5,_0x461403);_0x246eae(_0x461403);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5b62c3e..eb4312c 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 _0x4513=['index','get','/describe','isAuthenticated','describe','/:id','show','post','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller'];(function(_0x42448c,_0x2279e7){var _0x549e54=function(_0x5c15bf){while(--_0x5c15bf){_0x42448c['push'](_0x42448c['shift']());}};_0x549e54(++_0x2279e7);}(_0x4513,0x1e6));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x3451('0x0'));var path=require(_0x3451('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3451('0x2')]();var fs_extra=require(_0x3451('0x3'));var auth=require(_0x3451('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3451('0x5'));var controller=require(_0x3451('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3451('0x7')]);router[_0x3451('0x8')](_0x3451('0x9'),auth[_0x3451('0xa')](),controller[_0x3451('0xb')]);router[_0x3451('0x8')](_0x3451('0xc'),auth[_0x3451('0xa')](),controller[_0x3451('0xd')]);router[_0x3451('0xe')]('/',auth[_0x3451('0xa')](),controller['create']);router['put'](_0x3451('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3451('0xc'),auth[_0x3451('0xa')](),controller[_0x3451('0xf')]);module[_0x3451('0x10')]=router; \ No newline at end of file +var _0xa8da=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8da,0x16c));var _0xaa8d=function(_0x5210f8,_0x3f5fad){_0x5210f8=_0x5210f8-0x0;var _0x29dc51=_0xa8da[_0x5210f8];return _0x29dc51;};'use strict';var multer=require(_0xaa8d('0x0'));var util=require(_0xaa8d('0x1'));var path=require(_0xaa8d('0x2'));var timeout=require(_0xaa8d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa8d('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xaa8d('0x5')]('/',auth['isAuthenticated'](),controller[_0xaa8d('0x6')]);router[_0xaa8d('0x5')](_0xaa8d('0x7'),auth[_0xaa8d('0x8')](),controller[_0xaa8d('0x9')]);router[_0xaa8d('0x5')](_0xaa8d('0xa'),auth['isAuthenticated'](),controller[_0xaa8d('0xb')]);router[_0xaa8d('0xc')]('/',auth[_0xaa8d('0x8')](),controller[_0xaa8d('0xd')]);router[_0xaa8d('0xe')]('/:id',auth[_0xaa8d('0x8')](),controller[_0xaa8d('0xf')]);router[_0xaa8d('0x10')](_0xaa8d('0xa'),auth[_0xaa8d('0x8')](),controller[_0xaa8d('0x11')]);module[_0xaa8d('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 39facb2..9c48617 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 _0x01ad=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','duration'];(function(_0x40c1a7,_0x2384a3){var _0x60c87e=function(_0x158008){while(--_0x158008){_0x40c1a7['push'](_0x40c1a7['shift']());}};_0x60c87e(++_0x2384a3);}(_0x01ad,0xfa));var _0xd01a=function(_0x3cd9ca,_0x37f8b8){_0x3cd9ca=_0x3cd9ca-0x0;var _0x19b9c6=_0x01ad[_0x3cd9ca];return _0x19b9c6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd01a('0x0')]={'channel':{'type':Sequelize[_0xd01a('0x1')]},'membername':{'type':Sequelize[_0xd01a('0x1')]},'interface':{'type':Sequelize[_0xd01a('0x1')]},'type':{'type':Sequelize[_0xd01a('0x1')],'defaultValue':_0xd01a('0x2'),'comment':_0xd01a('0x3')},'duration':{'type':Sequelize[_0xd01a('0x4')]},'enterAt':{'type':Sequelize[_0xd01a('0x5')]},'exitAt':{'type':Sequelize[_0xd01a('0x5')],'set':function(_0xd6980e){var _0x261904=moment(_0xd6980e);var _0x2e011d=moment(this[_0xd01a('0x6')](_0xd01a('0x7')));var _0x16aeef=_0x261904['diff'](_0x2e011d,'seconds');this[_0xd01a('0x8')]('exitAt',_0xd6980e);this[_0xd01a('0x8')](_0xd01a('0x9'),_0x16aeef>=0x0?_0x16aeef:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xd01a('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0xd01a('0xb')},'data3':{'type':Sequelize[_0xd01a('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xd01a('0x1')],'comment':_0xd01a('0xc')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xd01a('0x4')]},'uniqueid':{'type':Sequelize[_0xd01a('0x1')]}}; \ No newline at end of file +var _0x323f=['talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x323f,0x191));var _0xf323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x323f[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf323('0x0'));module[_0xf323('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf323('0x2')]},'interface':{'type':Sequelize[_0xf323('0x2')]},'type':{'type':Sequelize[_0xf323('0x2')],'defaultValue':_0xf323('0x3'),'comment':_0xf323('0x4')},'duration':{'type':Sequelize[_0xf323('0x5')]},'enterAt':{'type':Sequelize[_0xf323('0x6')]},'exitAt':{'type':Sequelize[_0xf323('0x6')],'set':function(_0x5c0958){var _0x3a27cd=moment(_0x5c0958);var _0x4c8dce=moment(this[_0xf323('0x7')](_0xf323('0x8')));var _0x31c168=_0x3a27cd[_0xf323('0x9')](_0x4c8dce,_0xf323('0xa'));this[_0xf323('0xb')](_0xf323('0xc'),_0x5c0958);this['setDataValue'](_0xf323('0xd'),_0x31c168>=0x0?_0x31c168:null);}},'data1':{'type':Sequelize[_0xf323('0x2')],'comment':_0xf323('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xf323('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xf323('0x10')},'data4':{'type':Sequelize[_0xf323('0x2')],'comment':_0xf323('0x11')},'data5':{'type':Sequelize['STRING'],'comment':_0xf323('0x12')},'role':{'type':Sequelize[_0xf323('0x2')]},'internal':{'type':Sequelize[_0xf323('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index caf99a1..8102f9a 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x1fce3f,_0x2a95b3){var _0x3a11ad=function(_0x55281e){while(--_0x55281e){_0x1fce3f['push'](_0x1fce3f['shift']());}};_0x3a11ad(++_0x2a95b3);}(_0x008c,0x188));var _0xc008=function(_0x5e4a6a,_0x287632){_0x5e4a6a=_0x5e4a6a-0x0;var _0xc8879f=_0x008c[_0x5e4a6a];return _0xc8879f;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x2a1dd1,_0x3794df){_0x2a1dd1=_0x2a1dd1-0x0;var _0x132c45=_0x55ca[_0x2a1dd1];return _0x132c45;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 5cecfce..c230d8a 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 _0xaa36=['membername','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','MemberReport','membername_interface'];(function(_0xdb6398,_0x2d07b3){var _0x5dd76b=function(_0x40136a){while(--_0x40136a){_0xdb6398['push'](_0xdb6398['shift']());}};_0x5dd76b(++_0x2d07b3);}(_0xaa36,0xc7));var _0x6aa3=function(_0x9dd92f,_0x1d341c){_0x9dd92f=_0x9dd92f-0x0;var _0x4534d3=_0xaa36[_0x9dd92f];return _0x4534d3;};'use strict';var _=require('lodash');var util=require(_0x6aa3('0x0'));var logger=require(_0x6aa3('0x1'))(_0x6aa3('0x2'));var moment=require(_0x6aa3('0x3'));var BPromise=require(_0x6aa3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aa3('0x5'));var rimraf=require('rimraf');var config=require(_0x6aa3('0x6'));var attributes=require('./memberReport.attributes');module[_0x6aa3('0x7')]=function(_0x34ee0f,_0xfd494b){return _0x34ee0f['define'](_0x6aa3('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6aa3('0x9'),'fields':[_0x6aa3('0xa'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c4b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member'];(function(_0x2eea34,_0x34f8ef){var _0x461c8f=function(_0x10f642){while(--_0x10f642){_0x2eea34['push'](_0x2eea34['shift']());}};_0x461c8f(++_0x34f8ef);}(_0x9c4b,0x14a));var _0xb9c4=function(_0x243e95,_0x1321ec){_0x243e95=_0x243e95-0x0;var _0x25ae15=_0x9c4b[_0x243e95];return _0x25ae15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb9c4('0x0'))(_0xb9c4('0x1'));var moment=require(_0xb9c4('0x2'));var BPromise=require(_0xb9c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c4('0x4'));var rimraf=require(_0xb9c4('0x5'));var config=require(_0xb9c4('0x6'));var attributes=require(_0xb9c4('0x7'));module[_0xb9c4('0x8')]=function(_0x2433e6,_0x4b96f8){return _0x2433e6['define'](_0xb9c4('0x9'),attributes,{'tableName':_0xb9c4('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 22ca942..98a74a7 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 _0x9fd4=['UpdateMemberReport','update','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','options','limit','include','attributes','map','model','CreateMemberReport','create','body'];(function(_0x46b6a5,_0x2ce150){var _0x54861b=function(_0x13e93c){while(--_0x13e93c){_0x46b6a5['push'](_0x46b6a5['shift']());}};_0x54861b(++_0x2ce150);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3d4a1b,_0x198962){_0x3d4a1b=_0x3d4a1b-0x0;var _0x2ed213=_0x9fd4[_0x3d4a1b];return _0x2ed213;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var moment=require(_0x49fd('0x2'));var BPromise=require(_0x49fd('0x3'));var rs=require(_0x49fd('0x4'));var fs=require('fs');var Redis=require(_0x49fd('0x5'));var db=require(_0x49fd('0x6'))['db'];var utils=require(_0x49fd('0x7'));var logger=require(_0x49fd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x49fd('0x9'));var client=jayson[_0x49fd('0xa')][_0x49fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9353cd,_0x48b999,_0x14bb94){return new BPromise(function(_0x461ac1,_0x36f605){return client[_0x49fd('0xc')](_0x9353cd,_0x14bb94)[_0x49fd('0xd')](function(_0x4a1c47){logger[_0x49fd('0xe')](_0x49fd('0xf'),_0x48b999,_0x49fd('0x10'));logger[_0x49fd('0x11')](_0x49fd('0x12'),_0x48b999,_0x49fd('0x10'),JSON[_0x49fd('0x13')](_0x4a1c47));if(_0x4a1c47['error']){if(_0x4a1c47[_0x49fd('0x14')][_0x49fd('0x15')]===0x1f4){logger[_0x49fd('0x14')](_0x49fd('0xf'),_0x48b999,_0x4a1c47[_0x49fd('0x14')][_0x49fd('0x16')]);return _0x36f605(_0x4a1c47[_0x49fd('0x14')][_0x49fd('0x16')]);}logger[_0x49fd('0x14')](_0x49fd('0xf'),_0x48b999,_0x4a1c47[_0x49fd('0x14')][_0x49fd('0x16')]);return _0x461ac1(_0x4a1c47[_0x49fd('0x14')][_0x49fd('0x16')]);}else{logger[_0x49fd('0xe')](_0x49fd('0xf'),_0x48b999,_0x49fd('0x10'));_0x461ac1(_0x4a1c47[_0x49fd('0x17')][_0x49fd('0x16')]);}})[_0x49fd('0x18')](function(_0x14c34f){logger[_0x49fd('0x14')](_0x49fd('0xf'),_0x48b999,_0x14c34f);_0x36f605(_0x14c34f);});});}exports[_0x49fd('0x19')]=function(_0xb55d24){var _0x5d568d=this;return new Promise(function(_0x598793,_0x2dc611){return db[_0x49fd('0x1a')]['findAll']({'raw':_0xb55d24['options']?_0xb55d24[_0x49fd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xb55d24[_0x49fd('0x1b')]?_0xb55d24[_0x49fd('0x1b')]['where']||null:null,'attributes':_0xb55d24[_0x49fd('0x1b')]?_0xb55d24[_0x49fd('0x1b')]['attributes']||null:null,'limit':_0xb55d24[_0x49fd('0x1b')]?_0xb55d24[_0x49fd('0x1b')][_0x49fd('0x1c')]||null:null,'include':_0xb55d24[_0x49fd('0x1b')]?_0xb55d24[_0x49fd('0x1b')][_0x49fd('0x1d')]?_['map'](_0xb55d24[_0x49fd('0x1b')][_0x49fd('0x1d')],function(_0x8f202b){return{'model':db[_0x8f202b['model']],'as':_0x8f202b['as'],'attributes':_0x8f202b[_0x49fd('0x1e')],'include':_0x8f202b[_0x49fd('0x1d')]?_[_0x49fd('0x1f')](_0x8f202b['include'],function(_0x597161){return{'model':db[_0x597161['model']],'as':_0x597161['as'],'attributes':_0x597161[_0x49fd('0x1e')],'include':_0x597161[_0x49fd('0x1d')]?_[_0x49fd('0x1f')](_0x597161[_0x49fd('0x1d')],function(_0x9587b9){return{'model':db[_0x9587b9[_0x49fd('0x20')]],'as':_0x9587b9['as'],'attributes':_0x9587b9[_0x49fd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x49fd('0xd')](function(_0x54c8bb){logger[_0x49fd('0xe')]('GetMemberReport',_0xb55d24);logger[_0x49fd('0x11')](_0x49fd('0x19'),_0xb55d24,JSON['stringify'](_0x54c8bb));_0x598793(_0x54c8bb);})[_0x49fd('0x18')](function(_0x2c8568){logger[_0x49fd('0x14')](_0x49fd('0x19'),_0x2c8568[_0x49fd('0x16')],_0xb55d24);_0x2dc611(_0x5d568d[_0x49fd('0x14')](0x1f4,_0x2c8568[_0x49fd('0x16')]));});});};exports[_0x49fd('0x21')]=function(_0x4ae11b){var _0x42181b=this;return new Promise(function(_0x4869fc,_0x1952d0){return db['MemberReport'][_0x49fd('0x22')](_0x4ae11b[_0x49fd('0x23')],{'raw':_0x4ae11b[_0x49fd('0x1b')]?_0x4ae11b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x340cbf){logger[_0x49fd('0xe')]('CreateMemberReport',_0x4ae11b);logger[_0x49fd('0x11')]('CreateMemberReport',_0x4ae11b,JSON['stringify'](_0x340cbf));_0x4869fc(_0x340cbf);})[_0x49fd('0x18')](function(_0x175f70){logger[_0x49fd('0x14')](_0x49fd('0x21'),_0x175f70[_0x49fd('0x16')],_0x4ae11b);_0x1952d0(_0x42181b['error'](0x1f4,_0x175f70['message']));});});};exports[_0x49fd('0x24')]=function(_0x13d03b){var _0xaf7bbf=this;return new Promise(function(_0x28f88f,_0x5a9592){return db[_0x49fd('0x1a')][_0x49fd('0x25')](_0x13d03b[_0x49fd('0x23')],{'raw':_0x13d03b[_0x49fd('0x1b')]?_0x13d03b[_0x49fd('0x1b')][_0x49fd('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d03b[_0x49fd('0x1b')]?_0x13d03b[_0x49fd('0x1b')][_0x49fd('0x27')]||null:null,'attributes':_0x13d03b[_0x49fd('0x1b')]?_0x13d03b[_0x49fd('0x1b')]['attributes']||null:null,'limit':_0x13d03b[_0x49fd('0x1b')]?_0x13d03b[_0x49fd('0x1b')][_0x49fd('0x1c')]||null:null})[_0x49fd('0xd')](function(_0x3f3f44){logger[_0x49fd('0xe')](_0x49fd('0x24'),_0x13d03b);logger[_0x49fd('0x11')](_0x49fd('0x24'),_0x13d03b,JSON['stringify'](_0x3f3f44));_0x28f88f(_0x3f3f44);})[_0x49fd('0x18')](function(_0x5878a8){logger[_0x49fd('0x14')](_0x49fd('0x24'),_0x5878a8['message'],_0x13d03b);_0x5a9592(_0xaf7bbf[_0x49fd('0x14')](0x1f4,_0x5878a8[_0x49fd('0x16')]));});});}; \ No newline at end of file +var _0xd101=['request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','raw','options','attributes','include','map','model','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd101,0xc1));var _0x1d10=function(_0x425dfe,_0x58ac74){_0x425dfe=_0x425dfe-0x0;var _0x46b8cf=_0xd101[_0x425dfe];return _0x46b8cf;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var rs=require(_0x1d10('0x3'));var fs=require('fs');var Redis=require(_0x1d10('0x4'));var db=require(_0x1d10('0x5'))['db'];var utils=require(_0x1d10('0x6'));var logger=require(_0x1d10('0x7'))(_0x1d10('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d10('0x9'));var client=jayson[_0x1d10('0xa')][_0x1d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d569,_0xb9e08,_0x36335e){return new BPromise(function(_0x6d6def,_0x43df2c){return client[_0x1d10('0xc')](_0x27d569,_0x36335e)[_0x1d10('0xd')](function(_0xf7926b){logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,_0x1d10('0x10'));logger[_0x1d10('0x11')](_0x1d10('0x12'),_0xb9e08,_0x1d10('0x10'),JSON['stringify'](_0xf7926b));if(_0xf7926b[_0x1d10('0x13')]){if(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x14')]===0x1f4){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b['error'][_0x1d10('0x15')]);return _0x43df2c(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b[_0x1d10('0x13')]['message']);return _0x6d6def(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}else{logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,'request\x20sent');_0x6d6def(_0xf7926b[_0x1d10('0x16')][_0x1d10('0x15')]);}})[_0x1d10('0x17')](function(_0x3f2f2b){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0x3f2f2b);_0x43df2c(_0x3f2f2b);});});}exports[_0x1d10('0x18')]=function(_0x4f3e2a){var _0x23d604=this;return new Promise(function(_0x1163dd,_0x4ca1e8){return db[_0x1d10('0x19')][_0x1d10('0x1a')]({'raw':_0x4f3e2a['options']?_0x4f3e2a['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3e2a['options']?_0x4f3e2a['options']['where']||null:null,'attributes':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1d')]||null:null,'limit':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options']['limit']||null:null,'include':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options'][_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1e')],function(_0x127b37){return{'model':db[_0x127b37[_0x1d10('0x20')]],'as':_0x127b37['as'],'attributes':_0x127b37[_0x1d10('0x1d')],'include':_0x127b37[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x127b37[_0x1d10('0x1e')],function(_0xf1e4c8){return{'model':db[_0xf1e4c8['model']],'as':_0xf1e4c8['as'],'attributes':_0xf1e4c8[_0x1d10('0x1d')],'include':_0xf1e4c8[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0xf1e4c8[_0x1d10('0x1e')],function(_0x18e7d9){return{'model':db[_0x18e7d9[_0x1d10('0x20')]],'as':_0x18e7d9['as'],'attributes':_0x18e7d9[_0x1d10('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d10('0xd')](function(_0x4f7837){logger[_0x1d10('0xe')](_0x1d10('0x18'),_0x4f3e2a);logger['debug'](_0x1d10('0x18'),_0x4f3e2a,JSON['stringify'](_0x4f7837));_0x1163dd(_0x4f7837);})['catch'](function(_0x41b5b8){logger['error'](_0x1d10('0x18'),_0x41b5b8[_0x1d10('0x15')],_0x4f3e2a);_0x4ca1e8(_0x23d604[_0x1d10('0x13')](0x1f4,_0x41b5b8[_0x1d10('0x15')]));});});};exports[_0x1d10('0x21')]=function(_0x9c6cb9){var _0x4b5400=this;return new Promise(function(_0x4e30b2,_0x1ada44){return db[_0x1d10('0x19')][_0x1d10('0x22')](_0x9c6cb9[_0x1d10('0x23')],{'raw':_0x9c6cb9[_0x1d10('0x1c')]?_0x9c6cb9[_0x1d10('0x1c')][_0x1d10('0x1b')]===undefined?!![]:![]:!![]})[_0x1d10('0xd')](function(_0x8f4818){logger[_0x1d10('0xe')]('CreateMemberReport',_0x9c6cb9);logger[_0x1d10('0x11')]('CreateMemberReport',_0x9c6cb9,JSON[_0x1d10('0x24')](_0x8f4818));_0x4e30b2(_0x8f4818);})[_0x1d10('0x17')](function(_0x5d446b){logger[_0x1d10('0x13')]('CreateMemberReport',_0x5d446b[_0x1d10('0x15')],_0x9c6cb9);_0x1ada44(_0x4b5400[_0x1d10('0x13')](0x1f4,_0x5d446b[_0x1d10('0x15')]));});});};exports[_0x1d10('0x25')]=function(_0xd50250){var _0x5eb413=this;return new Promise(function(_0x4c3ef6,_0x35025e){return db[_0x1d10('0x19')][_0x1d10('0x26')](_0xd50250['body'],{'raw':_0xd50250['options']?_0xd50250['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x27')]||null:null,'attributes':_0xd50250[_0x1d10('0x1c')]?_0xd50250[_0x1d10('0x1c')]['attributes']||null:null,'limit':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x28')]||null:null})[_0x1d10('0xd')](function(_0x230c19){logger['info'](_0x1d10('0x25'),_0xd50250);logger['debug'](_0x1d10('0x25'),_0xd50250,JSON[_0x1d10('0x24')](_0x230c19));_0x4c3ef6(_0x230c19);})[_0x1d10('0x17')](function(_0x8d8405){logger[_0x1d10('0x13')](_0x1d10('0x25'),_0x8d8405[_0x1d10('0x15')],_0xd50250);_0x35025e(_0x5eb413[_0x1d10('0x13')](0x1f4,_0x8d8405[_0x1d10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4938220..66ff496 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 _0x5dc4=['index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x9ecec2,_0x37dbee){var _0x12a2a6=function(_0x3f49c1){while(--_0x3f49c1){_0x9ecec2['push'](_0x9ecec2['shift']());}};_0x12a2a6(++_0x37dbee);}(_0x5dc4,0x154));var _0x45dc=function(_0x71afad,_0x269826){_0x71afad=_0x71afad-0x0;var _0x46f29d=_0x5dc4[_0x71afad];return _0x46f29d;};'use strict';var multer=require(_0x45dc('0x0'));var util=require(_0x45dc('0x1'));var path=require(_0x45dc('0x2'));var timeout=require(_0x45dc('0x3'));var express=require(_0x45dc('0x4'));var router=express[_0x45dc('0x5')]();var fs_extra=require(_0x45dc('0x6'));var auth=require(_0x45dc('0x7'));var interaction=require(_0x45dc('0x8'));var config=require('../../config/environment');var controller=require(_0x45dc('0x9'));router[_0x45dc('0xa')]('/',controller[_0x45dc('0xb')]);module[_0x45dc('0xc')]=router; \ No newline at end of file +var _0xf130=['../../components/auth/service','../../config/environment','./migration.controller','get','index','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3571da,_0x1c4562){var _0x4b1988=function(_0x5a2ec3){while(--_0x5a2ec3){_0x3571da['push'](_0x3571da['shift']());}};_0x4b1988(++_0x1c4562);}(_0xf130,0x149));var _0x0f13=function(_0x3127fb,_0x1d4232){_0x3127fb=_0x3127fb-0x0;var _0x40a2df=_0xf130[_0x3127fb];return _0x40a2df;};'use strict';var multer=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var path=require(_0x0f13('0x2'));var timeout=require(_0x0f13('0x3'));var express=require(_0x0f13('0x4'));var router=express[_0x0f13('0x5')]();var fs_extra=require(_0x0f13('0x6'));var auth=require(_0x0f13('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0f13('0x8'));var controller=require(_0x0f13('0x9'));router[_0x0f13('0xa')]('/',controller[_0x0f13('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 544b381..05d59ed 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 _0xf10f=['STRING'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xf10f,0x1db));var _0xff10=function(_0x4c9f11,_0x507c10){_0x4c9f11=_0x4c9f11-0x0;var _0x3ffd7d=_0xf10f[_0x4c9f11];return _0x3ffd7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xff10('0x0')],'unique':'version'}}; \ No newline at end of file +var _0xa12d=['sequelize','STRING','version'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xa12d,0x19e));var _0xda12=function(_0x3fc61f,_0xe629eb){_0x3fc61f=_0x3fc61f-0x0;var _0x449df9=_0xa12d[_0x3fc61f];return _0x449df9;};'use strict';var Sequelize=require(_0xda12('0x0'));module['exports']={'version':{'type':Sequelize[_0xda12('0x1')],'unique':_0xda12('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4a250f9..790c7c5 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 _0x4c8f=['fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','then','destroy','error','name','send','map','Migration','rawAttributes'];(function(_0x1e52d2,_0x24d840){var _0x2e4f46=function(_0x4f001d){while(--_0x4f001d){_0x1e52d2['push'](_0x1e52d2['shift']());}};_0x2e4f46(++_0x24d840);}(_0x4c8f,0x10b));var _0xf4c8=function(_0x45baa9,_0x2ac992){_0x45baa9=_0x45baa9-0x0;var _0x24828d=_0x4c8f[_0x45baa9];return _0x24828d;};'use strict';var emlformat=require(_0xf4c8('0x0'));var rimraf=require(_0xf4c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4c8('0x2'));var rp=require('request-promise');var moment=require(_0xf4c8('0x3'));var BPromise=require(_0xf4c8('0x4'));var Mustache=require(_0xf4c8('0x5'));var util=require(_0xf4c8('0x6'));var path=require(_0xf4c8('0x7'));var sox=require(_0xf4c8('0x8'));var csv=require(_0xf4c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4c8('0xa'));var squel=require(_0xf4c8('0xb'));var crypto=require(_0xf4c8('0xc'));var jsforce=require(_0xf4c8('0xd'));var deskjs=require(_0xf4c8('0xe'));var toCsv=require(_0xf4c8('0x9'));var querystring=require('querystring');var Papa=require(_0xf4c8('0xf'));var Redis=require('ioredis');var authService=require(_0xf4c8('0x10'));var qs=require(_0xf4c8('0x11'));var as=require(_0xf4c8('0x12'));var hardwareService=require(_0xf4c8('0x13'));var logger=require('../../config/logger')(_0xf4c8('0x14'));var utils=require(_0xf4c8('0x15'));var config=require(_0xf4c8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4c8('0x17'))['db'];function respondWithStatusCode(_0x5484fa,_0x46b5ed){_0x46b5ed=_0x46b5ed||0xcc;return function(_0x5dcc89){if(_0x5dcc89){return _0x5484fa[_0xf4c8('0x18')](_0x46b5ed);}return _0x5484fa[_0xf4c8('0x19')](_0x46b5ed)[_0xf4c8('0x1a')]();};}function respondWithResult(_0xb6aad3,_0x4e1bb2){_0x4e1bb2=_0x4e1bb2||0xc8;return function(_0x2c8b12){if(_0x2c8b12){return _0xb6aad3[_0xf4c8('0x19')](_0x4e1bb2)['json'](_0x2c8b12);}};}function respondWithFilteredResult(_0x576583,_0x30831a){return function(_0x40d53a){if(_0x40d53a){var _0x39e3ea=typeof _0x30831a[_0xf4c8('0x1b')]===_0xf4c8('0x1c')&&typeof _0x30831a[_0xf4c8('0x1d')]===_0xf4c8('0x1c');var _0x49c24b=_0x40d53a[_0xf4c8('0x1e')];var _0x43ab67=_0x39e3ea?0x0:_0x30831a[_0xf4c8('0x1b')];var _0x24e225=_0x39e3ea?_0x40d53a[_0xf4c8('0x1e')]:_0x30831a[_0xf4c8('0x1b')]+_0x30831a[_0xf4c8('0x1d')];var _0x3b1ebc;if(_0x24e225>=_0x49c24b){_0x24e225=_0x49c24b;_0x3b1ebc=0xc8;}else{_0x3b1ebc=0xce;}_0x576583['status'](_0x3b1ebc);return _0x576583[_0xf4c8('0x1f')](_0xf4c8('0x20'),_0x43ab67+'-'+_0x24e225+'/'+_0x49c24b)[_0xf4c8('0x21')](_0x40d53a);}return null;};}function patchUpdates(_0x340889){return function(_0x376e86){try{jsonpatch['apply'](_0x376e86,_0x340889,!![]);}catch(_0x5abaf3){return BPromise[_0xf4c8('0x22')](_0x5abaf3);}return _0x376e86['save']();};}function saveUpdates(_0xbf8c36,_0x56a77c){return function(_0x5d364a){if(_0x5d364a){return _0x5d364a['update'](_0xbf8c36)[_0xf4c8('0x23')](function(_0x3b0ed0){return _0x3b0ed0;});}return null;};}function removeEntity(_0x1fc453,_0xb1d32d){return function(_0x375048){if(_0x375048){return _0x375048[_0xf4c8('0x24')]()[_0xf4c8('0x23')](function(){_0x1fc453[_0xf4c8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e54a1,_0x14b0f9){return function(_0x52a443){if(!_0x52a443){_0x4e54a1[_0xf4c8('0x18')](0x194);}return _0x52a443;};}function handleError(_0x12649a,_0xb624d0){_0xb624d0=_0xb624d0||0x1f4;return function(_0x54a436){logger[_0xf4c8('0x25')](_0x54a436['stack']);if(_0x54a436[_0xf4c8('0x26')]){delete _0x54a436[_0xf4c8('0x26')];}_0x12649a[_0xf4c8('0x19')](_0xb624d0)[_0xf4c8('0x27')](_0x54a436);};}exports['index']=function(_0x21dcb9,_0x2be0ce){var _0x3378d9={},_0x4caa77={},_0x13e34d={'count':0x0,'rows':[]};var _0xf5b5b5=_[_0xf4c8('0x28')](db[_0xf4c8('0x29')][_0xf4c8('0x2a')],function(_0x1e67fc){return{'name':_0x1e67fc[_0xf4c8('0x2b')],'type':_0x1e67fc['type'][_0xf4c8('0x2c')]};});_0x4caa77[_0xf4c8('0x2d')]=_['map'](_0xf5b5b5,_0xf4c8('0x26'));_0x4caa77[_0xf4c8('0x2e')]=_[_0xf4c8('0x2f')](_0x21dcb9[_0xf4c8('0x2e')]);_0x4caa77[_0xf4c8('0x30')]=_['intersection'](_0x4caa77['model'],_0x4caa77[_0xf4c8('0x2e')]);_0x3378d9[_0xf4c8('0x31')]=_[_0xf4c8('0x32')](_0x4caa77[_0xf4c8('0x2d')],qs[_0xf4c8('0x33')](_0x21dcb9[_0xf4c8('0x2e')][_0xf4c8('0x33')]));_0x3378d9[_0xf4c8('0x31')]=_0x3378d9[_0xf4c8('0x31')][_0xf4c8('0x34')]?_0x3378d9['attributes']:_0x4caa77['model'];if(!_0x21dcb9['query']['hasOwnProperty'](_0xf4c8('0x35'))){_0x3378d9[_0xf4c8('0x1d')]=qs[_0xf4c8('0x1d')](_0x21dcb9['query'][_0xf4c8('0x1d')]);_0x3378d9[_0xf4c8('0x1b')]=qs[_0xf4c8('0x1b')](_0x21dcb9[_0xf4c8('0x2e')][_0xf4c8('0x1b')]);}_0x3378d9[_0xf4c8('0x36')]=qs[_0xf4c8('0x37')](_0x21dcb9[_0xf4c8('0x2e')][_0xf4c8('0x37')]);_0x3378d9[_0xf4c8('0x38')]=qs[_0xf4c8('0x30')](_[_0xf4c8('0x39')](_0x21dcb9[_0xf4c8('0x2e')],_0x4caa77[_0xf4c8('0x30')]),_0xf5b5b5);if(_0x21dcb9['query'][_0xf4c8('0x3a')]){_0x3378d9['where']=_[_0xf4c8('0x3b')](_0x3378d9[_0xf4c8('0x38')],{'$or':_[_0xf4c8('0x28')](_0xf5b5b5,function(_0x4da8c9){if(_0x4da8c9[_0xf4c8('0x3c')]!=='VIRTUAL'){var _0x371e7d={};_0x371e7d[_0x4da8c9['name']]={'$like':'%'+_0x21dcb9[_0xf4c8('0x2e')][_0xf4c8('0x3a')]+'%'};return _0x371e7d;}})});}_0x3378d9=_[_0xf4c8('0x3b')]({},_0x3378d9,_0x21dcb9['options']);var _0x2b3ad3={'where':_0x3378d9[_0xf4c8('0x38')]};return db['Migration'][_0xf4c8('0x1e')](_0x2b3ad3)[_0xf4c8('0x23')](function(_0x50ca06){_0x13e34d['count']=_0x50ca06;if(_0x21dcb9['query'][_0xf4c8('0x3d')]){_0x3378d9['include']=[{'all':!![]}];}return db[_0xf4c8('0x29')]['findAll'](_0x3378d9);})[_0xf4c8('0x23')](function(_0x2f5874){_0x13e34d['rows']=_0x2f5874;return _0x13e34d;})['then'](respondWithFilteredResult(_0x2be0ce,_0x3378d9))['catch'](handleError(_0x2be0ce,null));}; \ No newline at end of file +var _0xb892=['include','findAll','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb892,0x189));var _0x2b89=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xb892[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x2b89('0x0'));var rimraf=require(_0x2b89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b89('0x2'));var rp=require('request-promise');var moment=require(_0x2b89('0x3'));var BPromise=require(_0x2b89('0x4'));var Mustache=require('mustache');var util=require(_0x2b89('0x5'));var path=require(_0x2b89('0x6'));var sox=require(_0x2b89('0x7'));var csv=require(_0x2b89('0x8'));var ejs=require(_0x2b89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b89('0xa'));var squel=require(_0x2b89('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2b89('0x8'));var querystring=require(_0x2b89('0xc'));var Papa=require(_0x2b89('0xd'));var Redis=require(_0x2b89('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2b89('0xf'));var as=require(_0x2b89('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b89('0x11'))(_0x2b89('0x12'));var utils=require(_0x2b89('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b89('0x14'))['db'];function respondWithStatusCode(_0x5256d5,_0x3103c7){_0x3103c7=_0x3103c7||0xcc;return function(_0x3f1ce){if(_0x3f1ce){return _0x5256d5[_0x2b89('0x15')](_0x3103c7);}return _0x5256d5[_0x2b89('0x16')](_0x3103c7)[_0x2b89('0x17')]();};}function respondWithResult(_0x32f472,_0x251f6f){_0x251f6f=_0x251f6f||0xc8;return function(_0x5c63da){if(_0x5c63da){return _0x32f472[_0x2b89('0x16')](_0x251f6f)[_0x2b89('0x18')](_0x5c63da);}};}function respondWithFilteredResult(_0xa2880,_0x54dd7c){return function(_0x2b7da0){if(_0x2b7da0){var _0x406efa=typeof _0x54dd7c[_0x2b89('0x19')]===_0x2b89('0x1a')&&typeof _0x54dd7c[_0x2b89('0x1b')]===_0x2b89('0x1a');var _0x1e3834=_0x2b7da0[_0x2b89('0x1c')];var _0x12f99b=_0x406efa?0x0:_0x54dd7c[_0x2b89('0x19')];var _0x5eac65=_0x406efa?_0x2b7da0[_0x2b89('0x1c')]:_0x54dd7c[_0x2b89('0x19')]+_0x54dd7c[_0x2b89('0x1b')];var _0x40182d;if(_0x5eac65>=_0x1e3834){_0x5eac65=_0x1e3834;_0x40182d=0xc8;}else{_0x40182d=0xce;}_0xa2880[_0x2b89('0x16')](_0x40182d);return _0xa2880[_0x2b89('0x1d')](_0x2b89('0x1e'),_0x12f99b+'-'+_0x5eac65+'/'+_0x1e3834)[_0x2b89('0x18')](_0x2b7da0);}return null;};}function patchUpdates(_0x2a3295){return function(_0x1f8374){try{jsonpatch['apply'](_0x1f8374,_0x2a3295,!![]);}catch(_0x2fd2ae){return BPromise['reject'](_0x2fd2ae);}return _0x1f8374['save']();};}function saveUpdates(_0x1e773d,_0x565f6a){return function(_0x40fdfb){if(_0x40fdfb){return _0x40fdfb['update'](_0x1e773d)[_0x2b89('0x1f')](function(_0x50fc65){return _0x50fc65;});}return null;};}function removeEntity(_0x54d907,_0x57aeac){return function(_0xf840ba){if(_0xf840ba){return _0xf840ba[_0x2b89('0x20')]()['then'](function(){_0x54d907[_0x2b89('0x16')](0xcc)[_0x2b89('0x17')]();});}};}function handleEntityNotFound(_0x2f40dc,_0x59d649){return function(_0x2aa2fd){if(!_0x2aa2fd){_0x2f40dc[_0x2b89('0x15')](0x194);}return _0x2aa2fd;};}function handleError(_0x4f256b,_0x1a0aa4){_0x1a0aa4=_0x1a0aa4||0x1f4;return function(_0x757e76){logger[_0x2b89('0x21')](_0x757e76[_0x2b89('0x22')]);if(_0x757e76['name']){delete _0x757e76[_0x2b89('0x23')];}_0x4f256b[_0x2b89('0x16')](_0x1a0aa4)[_0x2b89('0x24')](_0x757e76);};}exports[_0x2b89('0x25')]=function(_0x1aae8b,_0xd51855){var _0x379a3d={},_0x532b26={},_0x4f28b1={'count':0x0,'rows':[]};var _0x452954=_[_0x2b89('0x26')](db[_0x2b89('0x27')][_0x2b89('0x28')],function(_0x2efad8){return{'name':_0x2efad8[_0x2b89('0x29')],'type':_0x2efad8[_0x2b89('0x2a')][_0x2b89('0x2b')]};});_0x532b26[_0x2b89('0x2c')]=_['map'](_0x452954,_0x2b89('0x23'));_0x532b26[_0x2b89('0x2d')]=_[_0x2b89('0x2e')](_0x1aae8b[_0x2b89('0x2d')]);_0x532b26[_0x2b89('0x2f')]=_[_0x2b89('0x30')](_0x532b26[_0x2b89('0x2c')],_0x532b26[_0x2b89('0x2d')]);_0x379a3d[_0x2b89('0x31')]=_[_0x2b89('0x30')](_0x532b26[_0x2b89('0x2c')],qs['fields'](_0x1aae8b['query'][_0x2b89('0x32')]));_0x379a3d[_0x2b89('0x31')]=_0x379a3d[_0x2b89('0x31')][_0x2b89('0x33')]?_0x379a3d['attributes']:_0x532b26['model'];if(!_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x34')](_0x2b89('0x35'))){_0x379a3d[_0x2b89('0x1b')]=qs[_0x2b89('0x1b')](_0x1aae8b['query'][_0x2b89('0x1b')]);_0x379a3d[_0x2b89('0x19')]=qs['offset'](_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x19')]);}_0x379a3d[_0x2b89('0x36')]=qs[_0x2b89('0x37')](_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x37')]);_0x379a3d[_0x2b89('0x38')]=qs[_0x2b89('0x2f')](_[_0x2b89('0x39')](_0x1aae8b[_0x2b89('0x2d')],_0x532b26[_0x2b89('0x2f')]),_0x452954);if(_0x1aae8b['query']['filter']){_0x379a3d['where']=_[_0x2b89('0x3a')](_0x379a3d[_0x2b89('0x38')],{'$or':_[_0x2b89('0x26')](_0x452954,function(_0x132b6b){if(_0x132b6b[_0x2b89('0x2a')]!=='VIRTUAL'){var _0x5299d0={};_0x5299d0[_0x132b6b[_0x2b89('0x23')]]={'$like':'%'+_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x3b')]+'%'};return _0x5299d0;}})});}_0x379a3d=_[_0x2b89('0x3a')]({},_0x379a3d,_0x1aae8b[_0x2b89('0x3c')]);var _0xb5713b={'where':_0x379a3d['where']};return db[_0x2b89('0x27')]['count'](_0xb5713b)[_0x2b89('0x1f')](function(_0x47ce52){_0x4f28b1[_0x2b89('0x1c')]=_0x47ce52;if(_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x3d')]){_0x379a3d[_0x2b89('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x2b89('0x3f')](_0x379a3d);})[_0x2b89('0x1f')](function(_0x3757fb){_0x4f28b1[_0x2b89('0x40')]=_0x3757fb;return _0x4f28b1;})[_0x2b89('0x1f')](respondWithFilteredResult(_0xd51855,_0x379a3d))['catch'](handleError(_0xd51855,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3261d9a..0566cfa 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 _0xcc84=['api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0xcc84,0x11b));var _0x4cc8=function(_0x20e79f,_0x1633b6){_0x20e79f=_0x20e79f-0x0;var _0x1a846b=_0xcc84[_0x20e79f];return _0x1a846b;};'use strict';var _=require(_0x4cc8('0x0'));var util=require(_0x4cc8('0x1'));var logger=require(_0x4cc8('0x2'))(_0x4cc8('0x3'));var moment=require(_0x4cc8('0x4'));var BPromise=require(_0x4cc8('0x5'));var rp=require(_0x4cc8('0x6'));var fs=require('fs');var path=require(_0x4cc8('0x7'));var rimraf=require(_0x4cc8('0x8'));var config=require('../../config/environment');var attributes=require(_0x4cc8('0x9'));module[_0x4cc8('0xa')]=function(_0x49f532,_0x2ed6c5){return _0x49f532['define'](_0x4cc8('0xb'),attributes,{'tableName':_0x4cc8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x681d=['migrations','util','../../config/logger','api','moment','rimraf','exports','define','Migration'];(function(_0x237bfe,_0x842795){var _0x3a6167=function(_0x360e15){while(--_0x360e15){_0x237bfe['push'](_0x237bfe['shift']());}};_0x3a6167(++_0x842795);}(_0x681d,0xeb));var _0xd681=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x681d[_0x311909];return _0x8d3163;};'use strict';var _=require('lodash');var util=require(_0xd681('0x0'));var logger=require(_0xd681('0x1'))(_0xd681('0x2'));var moment=require(_0xd681('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd681('0x4'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xd681('0x5')]=function(_0x4c96b4,_0x55d00f){return _0x4c96b4[_0xd681('0x6')](_0xd681('0x7'),attributes,{'tableName':_0xd681('0x8'),'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 555fc7d..acd4344 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 _0x402f=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','message','error','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x3b4206,_0x2bc8c5){var _0x2ca6d9=function(_0x5a1107){while(--_0x5a1107){_0x3b4206['push'](_0x3b4206['shift']());}};_0x2ca6d9(++_0x2bc8c5);}(_0x402f,0x6f));var _0xf402=function(_0x1ecd55,_0x1fa109){_0x1ecd55=_0x1ecd55-0x0;var _0x5630ca=_0x402f[_0x1ecd55];return _0x5630ca;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Migration,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});} \ No newline at end of file +var _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd13a49,_0x42ae60){var _0x11b592=function(_0x4e712e){while(--_0x4e712e){_0xd13a49['push'](_0xd13a49['shift']());}};_0x11b592(++_0x42ae60);}(_0x3a79,0xca));var _0x93a7=function(_0x1d8e0a,_0x1bbfcf){_0x1d8e0a=_0x1d8e0a-0x0;var _0x4d2545=_0x3a79[_0x1d8e0a];return _0x4d2545;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('Migration,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 651b6f1..7609399 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 _0x9a3d=['./network.controller','get','index','/:id','isAuthenticated','show','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3bf601,_0xc34cd1){var _0x144ea7=function(_0x4f018f){while(--_0x4f018f){_0x3bf601['push'](_0x3bf601['shift']());}};_0x144ea7(++_0xc34cd1);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x1c2700,_0x454469){_0x1c2700=_0x1c2700-0x0;var _0x41c508=_0x9a3d[_0x1c2700];return _0x41c508;};'use strict';var multer=require('multer');var util=require(_0xd9a3('0x0'));var path=require(_0xd9a3('0x1'));var timeout=require(_0xd9a3('0x2'));var express=require(_0xd9a3('0x3'));var router=express[_0xd9a3('0x4')]();var fs_extra=require(_0xd9a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd9a3('0x6'));var config=require(_0xd9a3('0x7'));var controller=require(_0xd9a3('0x8'));router[_0xd9a3('0x9')]('/',auth['isAuthenticated'](),controller[_0xd9a3('0xa')]);router[_0xd9a3('0x9')](_0xd9a3('0xb'),auth[_0xd9a3('0xc')](),controller[_0xd9a3('0xd')]);router[_0xd9a3('0xe')]('/',auth[_0xd9a3('0xc')](),controller[_0xd9a3('0xf')]);router['put'](_0xd9a3('0xb'),auth[_0xd9a3('0xc')](),controller[_0xd9a3('0x10')]);router['delete'](_0xd9a3('0xb'),auth[_0xd9a3('0xc')](),controller['destroy']);module[_0xd9a3('0x11')]=router; \ No newline at end of file +var _0xf319=['../../config/environment','./network.controller','isAuthenticated','get','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x594565,_0xeda9a1){var _0x5f24de=function(_0x2d82b7){while(--_0x2d82b7){_0x594565['push'](_0x594565['shift']());}};_0x5f24de(++_0xeda9a1);}(_0xf319,0xe8));var _0x9f31=function(_0x800545,_0x33573a){_0x800545=_0x800545-0x0;var _0x1afb06=_0xf319[_0x800545];return _0x1afb06;};'use strict';var multer=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var path=require(_0x9f31('0x2'));var timeout=require(_0x9f31('0x3'));var express=require(_0x9f31('0x4'));var router=express[_0x9f31('0x5')]();var fs_extra=require(_0x9f31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f31('0x7'));var config=require(_0x9f31('0x8'));var controller=require(_0x9f31('0x9'));router['get']('/',auth[_0x9f31('0xa')](),controller['index']);router[_0x9f31('0xb')]('/:id',auth[_0x9f31('0xa')](),controller[_0x9f31('0xc')]);router[_0x9f31('0xd')]('/',auth[_0x9f31('0xa')](),controller[_0x9f31('0xe')]);router['put'](_0x9f31('0xf'),auth[_0x9f31('0xa')](),controller[_0x9f31('0x10')]);router[_0x9f31('0x11')](_0x9f31('0xf'),auth[_0x9f31('0xa')](),controller[_0x9f31('0x12')]);module[_0x9f31('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2cbef7d..a6c3b2c 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 _0x889f=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x2779d1,_0x331d1c){var _0x235741=function(_0x516dd4){while(--_0x516dd4){_0x2779d1['push'](_0x2779d1['shift']());}};_0x235741(++_0x331d1c);}(_0x889f,0xe4));var _0xf889=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x889f[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0xf889('0x0'));module[_0xf889('0x1')]={'type':{'type':Sequelize[_0xf889('0x2')](_0xf889('0x3'),_0xf889('0x4'),_0xf889('0x5'),_0xf889('0x6'))},'value':{'type':Sequelize[_0xf889('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf889('0x7')]}}; \ No newline at end of file +var _0xd7c4=['STRING','sequelize','ENUM','localnet','externip','turn'];(function(_0x33a495,_0x2e32a2){var _0x4c2b29=function(_0x5e81d3){while(--_0x5e81d3){_0x33a495['push'](_0x33a495['shift']());}};_0x4c2b29(++_0x2e32a2);}(_0xd7c4,0xeb));var _0x4d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4d7c('0x0'));module['exports']={'type':{'type':Sequelize[_0x4d7c('0x1')](_0x4d7c('0x2'),_0x4d7c('0x3'),'stun',_0x4d7c('0x4'))},'value':{'type':Sequelize[_0x4d7c('0x5')]},'username':{'type':Sequelize[_0x4d7c('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3934f88..fa1a4a0 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 _0x7c19=['fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','rawAttributes','length','options','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','render','writeFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','TURN','/etc/asterisk/turn_xcally.conf','chan_sip.so','util','path','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','Network','type','key','model','map','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c19,0xd8));var _0x97c1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7c19[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x97c1('0x0'));var path=require(_0x97c1('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97c1('0x2'));var qs=require(_0x97c1('0x3'));var logger=require('../../config/logger')(_0x97c1('0x4'));var config=require('../../config/environment');var db=require(_0x97c1('0x5'))['db'];var jayson=require(_0x97c1('0x6'));var client=jayson[_0x97c1('0x7')][_0x97c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59a170,_0x28685a,_0x1d9866,_0x46a143){return new Promise(function(_0x431c08,_0x175c3c){var _0x37b65d=_0x46a143||client;return _0x37b65d[_0x97c1('0x9')](_0x59a170,_0x1d9866)[_0x97c1('0xa')](function(_0x30db0b){logger['info'](_0x97c1('0xb'),_0x28685a,'request\x20sent');logger[_0x97c1('0xc')](_0x97c1('0xd'),_0x28685a,'request\x20sent',JSON[_0x97c1('0xe')](_0x30db0b));if(_0x30db0b['error']){if(_0x30db0b['error'][_0x97c1('0xf')]===0x1f4){logger[_0x97c1('0x10')](_0x97c1('0xb'),_0x28685a,_0x30db0b[_0x97c1('0x10')][_0x97c1('0x11')]);return _0x175c3c(_0x30db0b['error'][_0x97c1('0x11')]);}logger[_0x97c1('0x10')](_0x97c1('0xb'),_0x28685a,_0x30db0b[_0x97c1('0x10')][_0x97c1('0x11')]);return _0x431c08(_0x30db0b[_0x97c1('0x10')]['message']);}else{logger[_0x97c1('0x12')]('Network,\x20%s,\x20%s',_0x28685a,'request\x20sent');_0x431c08(_0x30db0b[_0x97c1('0x13')][_0x97c1('0x11')]);}})[_0x97c1('0x14')](function(_0x145012){logger[_0x97c1('0x10')](_0x97c1('0xb'),_0x28685a,_0x145012);_0x175c3c(_0x145012);});});}function respondWithResult(_0x16eba6,_0x2f923a){_0x2f923a=_0x2f923a||0xc8;return function(_0x14da0b){if(_0x14da0b){return _0x16eba6['status'](_0x2f923a)[_0x97c1('0x15')](_0x14da0b);}};}function respondWithFilteredResult(_0x4fe17e,_0x431a0c){return function(_0x4e4ff8){if(_0x4e4ff8){var _0x421abe=typeof _0x431a0c[_0x97c1('0x16')]===_0x97c1('0x17')&&typeof _0x431a0c[_0x97c1('0x18')]===_0x97c1('0x17');var _0x54c9ac=_0x4e4ff8[_0x97c1('0x19')];var _0xfdfff9=_0x421abe?0x0:_0x431a0c[_0x97c1('0x16')];var _0x2593f5=_0x421abe?_0x4e4ff8[_0x97c1('0x19')]:_0x431a0c[_0x97c1('0x16')]+_0x431a0c[_0x97c1('0x18')];var _0x20df3d;if(_0x2593f5>=_0x54c9ac){_0x2593f5=_0x54c9ac;_0x20df3d=0xc8;}else{_0x20df3d=0xce;}_0x4fe17e[_0x97c1('0x1a')](_0x20df3d);return _0x4fe17e[_0x97c1('0x1b')](_0x97c1('0x1c'),_0xfdfff9+'-'+_0x2593f5+'/'+_0x54c9ac)['json'](_0x4e4ff8);}return null;};}function saveUpdates(_0x335fdd){return function(_0x867203){if(_0x867203){return _0x867203[_0x97c1('0x1d')](_0x335fdd)['then'](function(_0x256431){return _0x256431;});}return null;};}function removeEntity(_0x55d0cc){return function(_0x29d05d){if(_0x29d05d){return _0x29d05d[_0x97c1('0x1e')]()[_0x97c1('0xa')](function(){_0x55d0cc[_0x97c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe26d2f){return function(_0x1eb76d){if(!_0x1eb76d){_0xe26d2f[_0x97c1('0x1f')](0x194);}return _0x1eb76d;};}function handleError(_0x1ca1b7,_0x145ef6){_0x145ef6=_0x145ef6||0x1f4;return function(_0x280c11){logger[_0x97c1('0x10')](_0x280c11[_0x97c1('0x20')]);if(_0x280c11['name']){delete _0x280c11[_0x97c1('0x21')];}_0x1ca1b7[_0x97c1('0x1a')](_0x145ef6)[_0x97c1('0x22')](_0x280c11);};}exports[_0x97c1('0x23')]=function(_0x557e07,_0x6b9bb4){var _0x18fb06={},_0x174c97={},_0x4ed426={'count':0x0,'rows':[]};var _0xda53d=_['map'](db[_0x97c1('0x24')]['rawAttributes'],function(_0x3d5086){return{'name':_0x3d5086['fieldName'],'type':_0x3d5086[_0x97c1('0x25')][_0x97c1('0x26')]};});_0x174c97[_0x97c1('0x27')]=_[_0x97c1('0x28')](_0xda53d,_0x97c1('0x21'));_0x174c97[_0x97c1('0x29')]=_[_0x97c1('0x2a')](_0x557e07[_0x97c1('0x29')]);_0x174c97[_0x97c1('0x2b')]=_[_0x97c1('0x2c')](_0x174c97['model'],_0x174c97[_0x97c1('0x29')]);_0x18fb06['attributes']=_['intersection'](_0x174c97[_0x97c1('0x27')],qs[_0x97c1('0x2d')](_0x557e07['query']['fields']));_0x18fb06[_0x97c1('0x2e')]=_0x18fb06['attributes']['length']?_0x18fb06['attributes']:_0x174c97[_0x97c1('0x27')];if(!_0x557e07[_0x97c1('0x29')][_0x97c1('0x2f')](_0x97c1('0x30'))){_0x18fb06[_0x97c1('0x18')]=qs[_0x97c1('0x18')](_0x557e07[_0x97c1('0x29')][_0x97c1('0x18')]);_0x18fb06[_0x97c1('0x16')]=qs[_0x97c1('0x16')](_0x557e07['query'][_0x97c1('0x16')]);}_0x18fb06[_0x97c1('0x31')]=qs[_0x97c1('0x32')](_0x557e07[_0x97c1('0x29')][_0x97c1('0x32')]);_0x18fb06['where']=qs[_0x97c1('0x2b')](_[_0x97c1('0x33')](_0x557e07[_0x97c1('0x29')],_0x174c97['filters']),_0xda53d);if(_0x557e07[_0x97c1('0x29')]['filter']){_0x18fb06[_0x97c1('0x34')]=_[_0x97c1('0x35')](_0x18fb06['where'],{'$or':_[_0x97c1('0x28')](_0xda53d,function(_0x30fc1c){if(_0x30fc1c[_0x97c1('0x25')]!==_0x97c1('0x36')){var _0x27438b={};_0x27438b[_0x30fc1c[_0x97c1('0x21')]]={'$like':'%'+_0x557e07[_0x97c1('0x29')][_0x97c1('0x37')]+'%'};return _0x27438b;}})});}_0x18fb06=_[_0x97c1('0x35')]({},_0x18fb06,_0x557e07['options']);var _0x2256bd={'where':_0x18fb06[_0x97c1('0x34')]};return db[_0x97c1('0x24')]['count'](_0x2256bd)['then'](function(_0x495be9){_0x4ed426['count']=_0x495be9;if(_0x557e07[_0x97c1('0x29')][_0x97c1('0x38')]){_0x18fb06[_0x97c1('0x39')]=[{'all':!![]}];}return db['Network'][_0x97c1('0x3a')](_0x18fb06);})[_0x97c1('0xa')](function(_0x41725f){_0x4ed426['rows']=_0x41725f;return _0x4ed426;})[_0x97c1('0xa')](respondWithFilteredResult(_0x6b9bb4,_0x18fb06))[_0x97c1('0x14')](handleError(_0x6b9bb4,null));};exports[_0x97c1('0x3b')]=function(_0x2d20d4,_0xa7db17){var _0x26d309={'raw':!![],'where':{'id':_0x2d20d4['params']['id']}},_0x297e71={};_0x297e71['model']=_[_0x97c1('0x2a')](db[_0x97c1('0x24')][_0x97c1('0x3c')]);_0x297e71[_0x97c1('0x29')]=_['keys'](_0x2d20d4[_0x97c1('0x29')]);_0x297e71['filters']=_[_0x97c1('0x2c')](_0x297e71[_0x97c1('0x27')],_0x297e71[_0x97c1('0x29')]);_0x26d309[_0x97c1('0x2e')]=_[_0x97c1('0x2c')](_0x297e71[_0x97c1('0x27')],qs['fields'](_0x2d20d4[_0x97c1('0x29')]['fields']));_0x26d309[_0x97c1('0x2e')]=_0x26d309['attributes'][_0x97c1('0x3d')]?_0x26d309[_0x97c1('0x2e')]:_0x297e71['model'];if(_0x2d20d4['query'][_0x97c1('0x38')]){_0x26d309[_0x97c1('0x39')]=[{'all':!![]}];}_0x26d309=_['merge']({},_0x26d309,_0x2d20d4[_0x97c1('0x3e')]);return db[_0x97c1('0x24')][_0x97c1('0x3f')](_0x26d309)[_0x97c1('0xa')](handleEntityNotFound(_0xa7db17,null))[_0x97c1('0xa')](respondWithResult(_0xa7db17,null))[_0x97c1('0x14')](handleError(_0xa7db17,null));};exports[_0x97c1('0x40')]=function(_0x1b5313,_0x4b1085){var _0x49aa36;return db[_0x97c1('0x24')][_0x97c1('0x40')](_0x1b5313['body'],{'raw':!![]})[_0x97c1('0xa')](function(_0x39c635){_0x49aa36=_0x39c635;return db[_0x97c1('0x24')][_0x97c1('0x3a')]({'where':{'type':_0x1b5313[_0x97c1('0x41')]['type']},'raw':!![]});})[_0x97c1('0xa')](function(_0x3d39ee){if(_0x49aa36[_0x97c1('0x25')][_0x97c1('0x42')]()==_0x97c1('0x43')){var _0x597a4c=fs[_0x97c1('0x44')](path[_0x97c1('0x45')](config['root'],_0x97c1('0x46')),_0x97c1('0x47'));var _0x5f225e=ejs['render'](_0x597a4c,{'networks':_0x3d39ee||[]});fs['writeFileSync'](_0x97c1('0x48'),_0x5f225e);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x40'),{'module':_0x97c1('0x4a')});}else if(_0x49aa36['type'][_0x97c1('0x42')]()=='TURN'){var _0x2147c2=fs['readFileSync'](path[_0x97c1('0x45')](config[_0x97c1('0x4b')],_0x97c1('0x4c')),_0x97c1('0x47'));var _0x565b96=ejs[_0x97c1('0x4d')](_0x2147c2,{'networks':_0x3d39ee||[]});fs[_0x97c1('0x4e')]('/etc/asterisk/turn_xcally.conf',_0x565b96);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x40'),{'module':_0x97c1('0x4a')});}else{var _0x27317e=fs[_0x97c1('0x44')](path[_0x97c1('0x45')](config[_0x97c1('0x4b')],_0x97c1('0x4f')),'utf8');var _0x4dc7ac=ejs[_0x97c1('0x4d')](_0x27317e,{'networks':_0x3d39ee||[]});fs[_0x97c1('0x4e')](util[_0x97c1('0x50')](_0x97c1('0x51'),_0x1b5313[_0x97c1('0x41')][_0x97c1('0x25')][_0x97c1('0x52')]()),_0x4dc7ac);return respondWithRpcPromise('Reload',_0x97c1('0x40'),{'module':'chan_sip.so'});}})['then'](function(){return _0x49aa36;})[_0x97c1('0xa')](respondWithResult(_0x4b1085,0xc9))['catch'](handleError(_0x4b1085,null));};exports[_0x97c1('0x1d')]=function(_0x9cb14c,_0x19ab08){var _0x318320;return db[_0x97c1('0x24')][_0x97c1('0x3f')]({'where':{'id':_0x9cb14c[_0x97c1('0x53')]['id']}})[_0x97c1('0xa')](handleEntityNotFound(_0x19ab08,null))[_0x97c1('0xa')](saveUpdates(_0x9cb14c[_0x97c1('0x41')],null))[_0x97c1('0xa')](function(_0x572df9){if(_0x572df9){_0x318320=_0x572df9;return db[_0x97c1('0x24')][_0x97c1('0x3a')]({'where':{'type':_0x318320[_0x97c1('0x25')]},'raw':!![]});}return null;})[_0x97c1('0xa')](function(_0x2661cf){if(_0x318320[_0x97c1('0x25')][_0x97c1('0x42')]()=='STUN'){var _0x5d30e6=fs[_0x97c1('0x44')](path[_0x97c1('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x97c1('0x47'));var _0x5efd3e=ejs['render'](_0x5d30e6,{'networks':_0x2661cf||[]});fs[_0x97c1('0x4e')](_0x97c1('0x48'),_0x5efd3e);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x318320[_0x97c1('0x25')][_0x97c1('0x42')]()==_0x97c1('0x54')){var _0x34a5e3=fs[_0x97c1('0x44')](path['join'](config[_0x97c1('0x4b')],_0x97c1('0x4c')),_0x97c1('0x47'));var _0x450950=ejs[_0x97c1('0x4d')](_0x34a5e3,{'networks':_0x2661cf||[]});fs['writeFileSync'](_0x97c1('0x55'),_0x450950);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1d'),{'module':_0x97c1('0x4a')});}else{var _0x1cac01=fs[_0x97c1('0x44')](path[_0x97c1('0x45')](config[_0x97c1('0x4b')],_0x97c1('0x4f')),_0x97c1('0x47'));var _0x3bdb2b=ejs['render'](_0x1cac01,{'networks':_0x2661cf||[]});fs['writeFileSync'](util['format'](_0x97c1('0x51'),_0x9cb14c[_0x97c1('0x41')][_0x97c1('0x25')]['toLowerCase']()),_0x3bdb2b);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1d'),{'module':_0x97c1('0x56')});}})[_0x97c1('0xa')](function(_0x4b9076){if(_0x4b9076){return _0x318320;}return null;})['then'](respondWithResult(_0x19ab08,null))['catch'](handleError(_0x19ab08,null));};exports[_0x97c1('0x1e')]=function(_0x294af1,_0x27a59c){var _0x515501;return db[_0x97c1('0x24')][_0x97c1('0x3f')]({'where':{'id':_0x294af1['params']['id']}})['then'](function(_0x298aba){_0x515501=_0x298aba;return _0x298aba;})[_0x97c1('0xa')](handleEntityNotFound(_0x27a59c,null))['then'](removeEntity(_0x27a59c,null))[_0x97c1('0xa')](function(){if(_0x515501){return db[_0x97c1('0x24')][_0x97c1('0x3a')]({'where':{'type':_0x515501[_0x97c1('0x25')]},'raw':!![]});}})['then'](function(_0x52bf8f){if(_0x515501[_0x97c1('0x25')][_0x97c1('0x42')]()=='STUN'){var _0x5460b2=fs['readFileSync'](path[_0x97c1('0x45')](config['root'],_0x97c1('0x46')),'utf8');var _0x18195e=ejs[_0x97c1('0x4d')](_0x5460b2,{'networks':_0x52bf8f||[]});fs[_0x97c1('0x4e')](_0x97c1('0x48'),_0x18195e);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x515501[_0x97c1('0x25')][_0x97c1('0x42')]()=='TURN'){var _0x47ee6f=fs[_0x97c1('0x44')](path[_0x97c1('0x45')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3169d2=ejs[_0x97c1('0x4d')](_0x47ee6f,{'networks':_0x52bf8f||[]});fs[_0x97c1('0x4e')](_0x97c1('0x55'),_0x3169d2);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1e'),{'module':_0x97c1('0x4a')});}else{var _0x115b0d=fs['readFileSync'](path[_0x97c1('0x45')](config['root'],_0x97c1('0x4f')),_0x97c1('0x47'));var _0x5aa723=ejs[_0x97c1('0x4d')](_0x115b0d,{'networks':_0x52bf8f||[]});fs[_0x97c1('0x4e')](util['format'](_0x97c1('0x51'),_0x515501[_0x97c1('0x25')][_0x97c1('0x52')]()),_0x5aa723);return respondWithRpcPromise(_0x97c1('0x49'),_0x97c1('0x1e'),{'module':_0x97c1('0x56')});}})[_0x97c1('0x14')](handleError(_0x27a59c,null));}; \ No newline at end of file +var _0x5c0d=['join','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','STUN','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','count','limit','status','set','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','findAll','params','include','options','create','body','toUpperCase','readFileSync','root','render','/etc/asterisk/stun_xcally.conf','Reload','TURN'];(function(_0x4527df,_0x15d888){var _0x24bc42=function(_0x2554bb){while(--_0x2554bb){_0x4527df['push'](_0x4527df['shift']());}};_0x24bc42(++_0x15d888);}(_0x5c0d,0x168));var _0xd5c0=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x5c0d[_0x26d6d9];return _0x1b4875;};'use strict';var util=require(_0xd5c0('0x0'));var path=require(_0xd5c0('0x1'));var ejs=require(_0xd5c0('0x2'));var fs=require('fs');var _=require(_0xd5c0('0x3'));var qs=require(_0xd5c0('0x4'));var logger=require(_0xd5c0('0x5'))(_0xd5c0('0x6'));var config=require('../../config/environment');var db=require(_0xd5c0('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd5c0('0x8')][_0xd5c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x265cb5,_0x1b920f,_0x1ffc65,_0x3de547){return new Promise(function(_0xb3f0cf,_0x4f5574){var _0x59a711=_0x3de547||client;return _0x59a711[_0xd5c0('0xa')](_0x265cb5,_0x1ffc65)[_0xd5c0('0xb')](function(_0x40a2cb){logger['info'](_0xd5c0('0xc'),_0x1b920f,_0xd5c0('0xd'));logger[_0xd5c0('0xe')](_0xd5c0('0xf'),_0x1b920f,_0xd5c0('0xd'),JSON[_0xd5c0('0x10')](_0x40a2cb));if(_0x40a2cb[_0xd5c0('0x11')]){if(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x12')]===0x1f4){logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);return _0x4f5574(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);}logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);return _0xb3f0cf(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);}else{logger[_0xd5c0('0x14')]('Network,\x20%s,\x20%s',_0x1b920f,_0xd5c0('0xd'));_0xb3f0cf(_0x40a2cb[_0xd5c0('0x15')][_0xd5c0('0x13')]);}})[_0xd5c0('0x16')](function(_0x567986){logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x567986);_0x4f5574(_0x567986);});});}function respondWithResult(_0x2a5e89,_0x1fd759){_0x1fd759=_0x1fd759||0xc8;return function(_0xb2d97c){if(_0xb2d97c){return _0x2a5e89['status'](_0x1fd759)[_0xd5c0('0x17')](_0xb2d97c);}};}function respondWithFilteredResult(_0x33fddc,_0x5a11d6){return function(_0x146906){if(_0x146906){var _0x149e19=typeof _0x5a11d6[_0xd5c0('0x18')]==='undefined'&&typeof _0x5a11d6['limit']===_0xd5c0('0x19');var _0x35819d=_0x146906[_0xd5c0('0x1a')];var _0x4ee996=_0x149e19?0x0:_0x5a11d6[_0xd5c0('0x18')];var _0x19ff43=_0x149e19?_0x146906[_0xd5c0('0x1a')]:_0x5a11d6[_0xd5c0('0x18')]+_0x5a11d6[_0xd5c0('0x1b')];var _0x2f3a91;if(_0x19ff43>=_0x35819d){_0x19ff43=_0x35819d;_0x2f3a91=0xc8;}else{_0x2f3a91=0xce;}_0x33fddc[_0xd5c0('0x1c')](_0x2f3a91);return _0x33fddc[_0xd5c0('0x1d')]('Content-Range',_0x4ee996+'-'+_0x19ff43+'/'+_0x35819d)[_0xd5c0('0x17')](_0x146906);}return null;};}function saveUpdates(_0x1b9080){return function(_0x3351a6){if(_0x3351a6){return _0x3351a6['update'](_0x1b9080)[_0xd5c0('0xb')](function(_0x424254){return _0x424254;});}return null;};}function removeEntity(_0x38d5b6){return function(_0x2a90e7){if(_0x2a90e7){return _0x2a90e7['destroy']()[_0xd5c0('0xb')](function(){_0x38d5b6[_0xd5c0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bc25){return function(_0x1cf37c){if(!_0x1cf37c){_0x23bc25[_0xd5c0('0x1e')](0x194);}return _0x1cf37c;};}function handleError(_0x84ee35,_0x190724){_0x190724=_0x190724||0x1f4;return function(_0x37a103){logger['error'](_0x37a103[_0xd5c0('0x1f')]);if(_0x37a103[_0xd5c0('0x20')]){delete _0x37a103[_0xd5c0('0x20')];}_0x84ee35[_0xd5c0('0x1c')](_0x190724)['send'](_0x37a103);};}exports[_0xd5c0('0x21')]=function(_0xc95187,_0x6db7d9){var _0x4e9a2c={},_0x1e8253={},_0x4e14fe={'count':0x0,'rows':[]};var _0x523e28=_[_0xd5c0('0x22')](db[_0xd5c0('0x23')][_0xd5c0('0x24')],function(_0x75f3f7){return{'name':_0x75f3f7[_0xd5c0('0x25')],'type':_0x75f3f7['type'][_0xd5c0('0x26')]};});_0x1e8253[_0xd5c0('0x27')]=_[_0xd5c0('0x22')](_0x523e28,_0xd5c0('0x20'));_0x1e8253[_0xd5c0('0x28')]=_[_0xd5c0('0x29')](_0xc95187[_0xd5c0('0x28')]);_0x1e8253[_0xd5c0('0x2a')]=_[_0xd5c0('0x2b')](_0x1e8253[_0xd5c0('0x27')],_0x1e8253[_0xd5c0('0x28')]);_0x4e9a2c[_0xd5c0('0x2c')]=_['intersection'](_0x1e8253['model'],qs['fields'](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x2d')]));_0x4e9a2c[_0xd5c0('0x2c')]=_0x4e9a2c[_0xd5c0('0x2c')][_0xd5c0('0x2e')]?_0x4e9a2c[_0xd5c0('0x2c')]:_0x1e8253[_0xd5c0('0x27')];if(!_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x2f')](_0xd5c0('0x30'))){_0x4e9a2c[_0xd5c0('0x1b')]=qs[_0xd5c0('0x1b')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x1b')]);_0x4e9a2c['offset']=qs[_0xd5c0('0x18')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x18')]);}_0x4e9a2c[_0xd5c0('0x31')]=qs[_0xd5c0('0x32')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x32')]);_0x4e9a2c['where']=qs['filters'](_['pick'](_0xc95187[_0xd5c0('0x28')],_0x1e8253[_0xd5c0('0x2a')]),_0x523e28);if(_0xc95187['query'][_0xd5c0('0x33')]){_0x4e9a2c[_0xd5c0('0x34')]=_['merge'](_0x4e9a2c['where'],{'$or':_[_0xd5c0('0x22')](_0x523e28,function(_0x122a8f){if(_0x122a8f[_0xd5c0('0x35')]!==_0xd5c0('0x36')){var _0x59eb43={};_0x59eb43[_0x122a8f[_0xd5c0('0x20')]]={'$like':'%'+_0xc95187[_0xd5c0('0x28')]['filter']+'%'};return _0x59eb43;}})});}_0x4e9a2c=_[_0xd5c0('0x37')]({},_0x4e9a2c,_0xc95187['options']);var _0x1a4837={'where':_0x4e9a2c[_0xd5c0('0x34')]};return db['Network']['count'](_0x1a4837)[_0xd5c0('0xb')](function(_0x157273){_0x4e14fe[_0xd5c0('0x1a')]=_0x157273;if(_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x38')]){_0x4e9a2c['include']=[{'all':!![]}];}return db['Network'][_0xd5c0('0x39')](_0x4e9a2c);})['then'](function(_0x571aca){_0x4e14fe['rows']=_0x571aca;return _0x4e14fe;})['then'](respondWithFilteredResult(_0x6db7d9,_0x4e9a2c))['catch'](handleError(_0x6db7d9,null));};exports['show']=function(_0x5d1edf,_0x2e36e3){var _0x546311={'raw':!![],'where':{'id':_0x5d1edf[_0xd5c0('0x3a')]['id']}},_0x5afa3b={};_0x5afa3b['model']=_[_0xd5c0('0x29')](db[_0xd5c0('0x23')][_0xd5c0('0x24')]);_0x5afa3b['query']=_[_0xd5c0('0x29')](_0x5d1edf[_0xd5c0('0x28')]);_0x5afa3b[_0xd5c0('0x2a')]=_[_0xd5c0('0x2b')](_0x5afa3b[_0xd5c0('0x27')],_0x5afa3b['query']);_0x546311[_0xd5c0('0x2c')]=_[_0xd5c0('0x2b')](_0x5afa3b['model'],qs['fields'](_0x5d1edf[_0xd5c0('0x28')][_0xd5c0('0x2d')]));_0x546311['attributes']=_0x546311[_0xd5c0('0x2c')][_0xd5c0('0x2e')]?_0x546311[_0xd5c0('0x2c')]:_0x5afa3b[_0xd5c0('0x27')];if(_0x5d1edf[_0xd5c0('0x28')]['includeAll']){_0x546311[_0xd5c0('0x3b')]=[{'all':!![]}];}_0x546311=_[_0xd5c0('0x37')]({},_0x546311,_0x5d1edf[_0xd5c0('0x3c')]);return db[_0xd5c0('0x23')]['find'](_0x546311)[_0xd5c0('0xb')](handleEntityNotFound(_0x2e36e3,null))[_0xd5c0('0xb')](respondWithResult(_0x2e36e3,null))[_0xd5c0('0x16')](handleError(_0x2e36e3,null));};exports[_0xd5c0('0x3d')]=function(_0x3d6c18,_0x5d6a96){var _0x451896;return db[_0xd5c0('0x23')][_0xd5c0('0x3d')](_0x3d6c18[_0xd5c0('0x3e')],{'raw':!![]})[_0xd5c0('0xb')](function(_0x5b980c){_0x451896=_0x5b980c;return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x3d6c18['body'][_0xd5c0('0x35')]},'raw':!![]});})['then'](function(_0xae15ab){if(_0x451896[_0xd5c0('0x35')][_0xd5c0('0x3f')]()=='STUN'){var _0x37b597=fs[_0xd5c0('0x40')](path['join'](config[_0xd5c0('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x29dbb0=ejs[_0xd5c0('0x42')](_0x37b597,{'networks':_0xae15ab||[]});fs['writeFileSync'](_0xd5c0('0x43'),_0x29dbb0);return respondWithRpcPromise(_0xd5c0('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x451896[_0xd5c0('0x35')][_0xd5c0('0x3f')]()==_0xd5c0('0x45')){var _0x310bdb=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],'server/files/templates/turn_multiple.ejs'),_0xd5c0('0x47'));var _0xa28aaf=ejs[_0xd5c0('0x42')](_0x310bdb,{'networks':_0xae15ab||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x49'),_0xa28aaf);return respondWithRpcPromise(_0xd5c0('0x44'),'create',{'module':'res_stun_monitor.so'});}else{var _0x1d7635=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],'server/files/templates/network.ejs'),'utf8');var _0x449edf=ejs[_0xd5c0('0x42')](_0x1d7635,{'networks':_0xae15ab||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')](_0xd5c0('0x4b'),_0x3d6c18[_0xd5c0('0x3e')][_0xd5c0('0x35')][_0xd5c0('0x4c')]()),_0x449edf);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x3d'),{'module':_0xd5c0('0x4d')});}})['then'](function(){return _0x451896;})[_0xd5c0('0xb')](respondWithResult(_0x5d6a96,0xc9))[_0xd5c0('0x16')](handleError(_0x5d6a96,null));};exports[_0xd5c0('0x4e')]=function(_0x300a3c,_0x501c58){var _0x33afa3;return db['Network'][_0xd5c0('0x4f')]({'where':{'id':_0x300a3c['params']['id']}})[_0xd5c0('0xb')](handleEntityNotFound(_0x501c58,null))[_0xd5c0('0xb')](saveUpdates(_0x300a3c['body'],null))[_0xd5c0('0xb')](function(_0x91185a){if(_0x91185a){_0x33afa3=_0x91185a;return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x33afa3['type']},'raw':!![]});}return null;})[_0xd5c0('0xb')](function(_0x42292d){if(_0x33afa3[_0xd5c0('0x35')]['toUpperCase']()==_0xd5c0('0x50')){var _0x1570aa=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x51')),_0xd5c0('0x47'));var _0x7501cb=ejs['render'](_0x1570aa,{'networks':_0x42292d||[]});fs[_0xd5c0('0x48')]('/etc/asterisk/stun_xcally.conf',_0x7501cb);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x4e'),{'module':_0xd5c0('0x52')});}else if(_0x33afa3[_0xd5c0('0x35')][_0xd5c0('0x3f')]()==_0xd5c0('0x45')){var _0x33429e=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x53')),_0xd5c0('0x47'));var _0xd1da4e=ejs[_0xd5c0('0x42')](_0x33429e,{'networks':_0x42292d||[]});fs['writeFileSync'](_0xd5c0('0x49'),_0xd1da4e);return respondWithRpcPromise('Reload',_0xd5c0('0x4e'),{'module':_0xd5c0('0x52')});}else{var _0x669837=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x54')),_0xd5c0('0x47'));var _0x296620=ejs[_0xd5c0('0x42')](_0x669837,{'networks':_0x42292d||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x300a3c[_0xd5c0('0x3e')][_0xd5c0('0x35')][_0xd5c0('0x4c')]()),_0x296620);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x4e'),{'module':_0xd5c0('0x4d')});}})['then'](function(_0x3c0f09){if(_0x3c0f09){return _0x33afa3;}return null;})['then'](respondWithResult(_0x501c58,null))[_0xd5c0('0x16')](handleError(_0x501c58,null));};exports['destroy']=function(_0x14a11e,_0x3db17e){var _0x4f3f5a;return db[_0xd5c0('0x23')][_0xd5c0('0x4f')]({'where':{'id':_0x14a11e[_0xd5c0('0x3a')]['id']}})[_0xd5c0('0xb')](function(_0x3265ba){_0x4f3f5a=_0x3265ba;return _0x3265ba;})[_0xd5c0('0xb')](handleEntityNotFound(_0x3db17e,null))[_0xd5c0('0xb')](removeEntity(_0x3db17e,null))[_0xd5c0('0xb')](function(){if(_0x4f3f5a){return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x4f3f5a[_0xd5c0('0x35')]},'raw':!![]});}})[_0xd5c0('0xb')](function(_0xf1b44e){if(_0x4f3f5a[_0xd5c0('0x35')]['toUpperCase']()==_0xd5c0('0x50')){var _0x412082=fs[_0xd5c0('0x40')](path['join'](config[_0xd5c0('0x41')],_0xd5c0('0x51')),_0xd5c0('0x47'));var _0xd6af27=ejs[_0xd5c0('0x42')](_0x412082,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x43'),_0xd6af27);return respondWithRpcPromise('Reload',_0xd5c0('0x55'),{'module':_0xd5c0('0x52')});}else if(_0x4f3f5a['type']['toUpperCase']()==_0xd5c0('0x45')){var _0x2aec1f=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config['root'],_0xd5c0('0x53')),_0xd5c0('0x47'));var _0x3a2106=ejs[_0xd5c0('0x42')](_0x2aec1f,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x49'),_0x3a2106);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x55'),{'module':_0xd5c0('0x52')});}else{var _0x1d69cf=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x54')),_0xd5c0('0x47'));var _0xfb7cdb=ejs['render'](_0x1d69cf,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')](_0xd5c0('0x4b'),_0x4f3f5a[_0xd5c0('0x35')]['toLowerCase']()),_0xfb7cdb);return respondWithRpcPromise(_0xd5c0('0x44'),'destroy',{'module':_0xd5c0('0x4d')});}})[_0xd5c0('0x16')](handleError(_0x3db17e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3fb371b..bf7f371 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','lodash','api','moment'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2ac03b,_0x31c12d){_0x2ac03b=_0x2ac03b-0x0;var _0x6277ef=_0x2e54[_0x2ac03b];return _0x6277ef;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require(_0x42e5('0x5'));var rimraf=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var attributes=require('./network.attributes');module[_0x42e5('0x8')]=function(_0x455f48,_0x38cb1b){return _0x455f48['define'](_0x42e5('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x315f4d,_0xfb6f14){var _0x11e364=function(_0x61812a){while(--_0x61812a){_0x315f4d['push'](_0x315f4d['shift']());}};_0x11e364(++_0xfb6f14);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xcb91[_0x623e7];return _0x121131;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ac57b5b..8648955 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(_0x3d58a7,_0x1c3bb0){var _0xb0ebe=function(_0x51159f){while(--_0x51159f){_0x3d58a7['push'](_0x3d58a7['shift']());}};_0xb0ebe(++_0x1c3bb0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x17829d,_0x2b6871){var _0x209074=function(_0x3d74ea){while(--_0x3d74ea){_0x17829d['push'](_0x17829d['shift']());}};_0x209074(++_0x2b6871);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 36b3723..62845c8 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 _0xecf9=['/:id/send','send','put','update','delete','removeAnswers','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','describe','/:id','isAuthenticated','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify','addApplications','addAgents'];(function(_0x16079b,_0x52fe99){var _0xcd68fa=function(_0x5a9ae){while(--_0x5a9ae){_0x16079b['push'](_0x16079b['shift']());}};_0xcd68fa(++_0x52fe99);}(_0xecf9,0x1e6));var _0x9ecf=function(_0x5de5b5,_0x78b559){_0x5de5b5=_0x5de5b5-0x0;var _0x49c73c=_0xecf9[_0x5de5b5];return _0x49c73c;};'use strict';var multer=require(_0x9ecf('0x0'));var util=require('util');var path=require(_0x9ecf('0x1'));var timeout=require(_0x9ecf('0x2'));var express=require('express');var router=express[_0x9ecf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ecf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9ecf('0x5'));var controller=require(_0x9ecf('0x6'));router[_0x9ecf('0x7')]('/',auth['isAuthenticated'](),controller[_0x9ecf('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9ecf('0x9')]);router[_0x9ecf('0x7')](_0x9ecf('0xa'),auth[_0x9ecf('0xb')](),controller['show']);router[_0x9ecf('0x7')](_0x9ecf('0xc'),auth[_0x9ecf('0xb')](),controller['getDispositions']);router[_0x9ecf('0x7')](_0x9ecf('0xd'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0xe')]);router['get'](_0x9ecf('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x9ecf('0x7')](_0x9ecf('0x10'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x11')]);router[_0x9ecf('0x7')](_0x9ecf('0x12'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x13')]);router[_0x9ecf('0x14')]('/',auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x15')]);router[_0x9ecf('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x9ecf('0xd'),auth[_0x9ecf('0xb')](),controller['addAnswer']);router[_0x9ecf('0x14')](_0x9ecf('0x16'),controller[_0x9ecf('0x17')]);router[_0x9ecf('0x14')](_0x9ecf('0xf'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x18')]);router['post'](_0x9ecf('0x12'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x19')]);router['post'](_0x9ecf('0x1a'),auth['isAuthenticated'](),controller[_0x9ecf('0x1b')]);router[_0x9ecf('0x1c')](_0x9ecf('0xa'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x1d')]);router['delete']('/:id',auth[_0x9ecf('0xb')](),controller['destroy']);router['delete'](_0x9ecf('0xc'),auth[_0x9ecf('0xb')](),controller['removeDispositions']);router[_0x9ecf('0x1e')](_0x9ecf('0xd'),auth[_0x9ecf('0xb')](),controller[_0x9ecf('0x1f')]);router[_0x9ecf('0x1e')](_0x9ecf('0x12'),auth[_0x9ecf('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x60e5=['removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers'];(function(_0x956be9,_0x19d2be){var _0x3e39e0=function(_0x24be58){while(--_0x24be58){_0x956be9['push'](_0x956be9['shift']());}};_0x3e39e0(++_0x19d2be);}(_0x60e5,0x1af));var _0x560e=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x60e5[_0x57fa7e];return _0x320671;};'use strict';var multer=require('multer');var util=require(_0x560e('0x0'));var path=require(_0x560e('0x1'));var timeout=require(_0x560e('0x2'));var express=require(_0x560e('0x3'));var router=express[_0x560e('0x4')]();var fs_extra=require(_0x560e('0x5'));var auth=require(_0x560e('0x6'));var interaction=require(_0x560e('0x7'));var config=require(_0x560e('0x8'));var controller=require(_0x560e('0x9'));router[_0x560e('0xa')]('/',auth['isAuthenticated'](),controller[_0x560e('0xb')]);router[_0x560e('0xa')](_0x560e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x560e('0xa')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['show']);router['get'](_0x560e('0xf'),auth['isAuthenticated'](),controller[_0x560e('0x10')]);router['get'](_0x560e('0x11'),auth[_0x560e('0xe')](),controller[_0x560e('0x12')]);router['get'](_0x560e('0x13'),auth[_0x560e('0xe')](),controller['getApplications']);router['get'](_0x560e('0x14'),auth[_0x560e('0xe')](),controller[_0x560e('0x15')]);router[_0x560e('0xa')](_0x560e('0x16'),auth[_0x560e('0xe')](),controller[_0x560e('0x17')]);router[_0x560e('0x18')]('/',auth[_0x560e('0xe')](),controller[_0x560e('0x19')]);router[_0x560e('0x18')](_0x560e('0xf'),auth['isAuthenticated'](),controller[_0x560e('0x1a')]);router[_0x560e('0x18')]('/:id/canned_answers',auth[_0x560e('0xe')](),controller[_0x560e('0x1b')]);router['post'](_0x560e('0x1c'),controller[_0x560e('0x1d')]);router[_0x560e('0x18')]('/:id/applications',auth[_0x560e('0xe')](),controller[_0x560e('0x1e')]);router['post']('/:id/users',auth[_0x560e('0xe')](),controller['addAgents']);router[_0x560e('0x18')](_0x560e('0x1f'),auth[_0x560e('0xe')](),controller[_0x560e('0x20')]);router[_0x560e('0x21')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['update']);router[_0x560e('0x22')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['destroy']);router[_0x560e('0x22')]('/:id/dispositions',auth[_0x560e('0xe')](),controller[_0x560e('0x23')]);router[_0x560e('0x22')](_0x560e('0x11'),auth[_0x560e('0xe')](),controller[_0x560e('0x24')]);router[_0x560e('0x22')](_0x560e('0x16'),auth[_0x560e('0xe')](),controller[_0x560e('0x25')]);module[_0x560e('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 17c9df7..76629d6 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 _0xcfd7=['mandatoryDisposition','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x4085d0,_0x596f71){var _0x13d9fc=function(_0x4dd5a4){while(--_0x4dd5a4){_0x4085d0['push'](_0x4085d0['shift']());}};_0x13d9fc(++_0x596f71);}(_0xcfd7,0x12d));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7cfd('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cfd('0x1')],'unique':_0x7cfd('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7cfd('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7cfd('0x3')]();}},'replyUri':{'type':Sequelize[_0x7cfd('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7cfd('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7cfd('0x4');}},'notificationSound':{'type':Sequelize[_0x7cfd('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7cfd('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7cfd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7cfd('0x1')]},'queueTransfer':{'type':Sequelize[_0x7cfd('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7cfd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7cfd('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7cfd('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7cfd('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7cfd('0x8'),'set':function(_0x2f2a07){if(!_0x2f2a07)this[_0x7cfd('0x9')](_0x7cfd('0xa'),null);this[_0x7cfd('0x9')](_0x7cfd('0xb'),_0x2f2a07);}}}; \ No newline at end of file +var _0xd4bf=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xd4bf,0x8c));var _0xfd4b=function(_0x4d56c7,_0x24f382){_0x4d56c7=_0x4d56c7-0x0;var _0x39cee4=_0xd4bf[_0x4d56c7];return _0x39cee4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfd4b('0x0'));module[_0xfd4b('0x1')]={'name':{'type':Sequelize[_0xfd4b('0x2')],'unique':_0xfd4b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfd4b('0x2')],'defaultValue':function(){return rs[_0xfd4b('0x4')]();}},'replyUri':{'type':Sequelize[_0xfd4b('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfd4b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfd4b('0x5')],'defaultValue':function(){return _0xfd4b('0x6');}},'notificationSound':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfd4b('0x2')]},'queueTransfer':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd4b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfd4b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfd4b('0xa'),'set':function(_0x41315e){if(!_0x41315e)this[_0xfd4b('0xb')](_0xfd4b('0xc'),null);this['setDataValue'](_0xfd4b('0xd'),_0x41315e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6d49346..2034453 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 _0xdd1b=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','OpenchannelApplication','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','internal','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xdd1b,0x11f));var _0xbdd1=function(_0x4bae1a,_0x5b0916){_0x4bae1a=_0x4bae1a-0x0;var _0x27f6d2=_0xdd1b[_0x4bae1a];return _0x27f6d2;};'use strict';var emlformat=require(_0xbdd1('0x0'));var rimraf=require(_0xbdd1('0x1'));var zipdir=require(_0xbdd1('0x2'));var jsonpatch=require(_0xbdd1('0x3'));var rp=require(_0xbdd1('0x4'));var moment=require(_0xbdd1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbdd1('0x6'));var path=require('path');var sox=require(_0xbdd1('0x7'));var csv=require(_0xbdd1('0x8'));var ejs=require(_0xbdd1('0x9'));var fs=require('fs');var fs_extra=require(_0xbdd1('0xa'));var _=require(_0xbdd1('0xb'));var squel=require(_0xbdd1('0xc'));var crypto=require(_0xbdd1('0xd'));var jsforce=require(_0xbdd1('0xe'));var deskjs=require(_0xbdd1('0xf'));var toCsv=require(_0xbdd1('0x8'));var querystring=require(_0xbdd1('0x10'));var Papa=require(_0xbdd1('0x11'));var Redis=require(_0xbdd1('0x12'));var authService=require(_0xbdd1('0x13'));var qs=require(_0xbdd1('0x14'));var as=require(_0xbdd1('0x15'));var hardwareService=require(_0xbdd1('0x16'));var logger=require(_0xbdd1('0x17'))(_0xbdd1('0x18'));var utils=require('../../config/utils');var config=require(_0xbdd1('0x19'));var licenseUtil=require(_0xbdd1('0x1a'));var db=require('../../mysqldb')['db'];config[_0xbdd1('0x1b')]=_[_0xbdd1('0x1c')](config['redis'],{'host':_0xbdd1('0x1d'),'port':0x18eb});var socket=require(_0xbdd1('0x1e'))(new Redis(config['redis']));require(_0xbdd1('0x1f'))['register'](socket);var jayson=require(_0xbdd1('0x20'));var client=jayson[_0xbdd1('0x21')][_0xbdd1('0x22')]({'port':0x232c});var client9002=jayson[_0xbdd1('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3746,_0x4c486a,_0x2138e2,_0x35c392){return new BPromise(function(_0x372201,_0x5b7c67){var _0x2e9989=_0x35c392||client;return _0x2e9989[_0xbdd1('0x23')](_0x3b3746,_0x2138e2)[_0xbdd1('0x24')](function(_0x29ca93){logger[_0xbdd1('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c486a,'request\x20sent');logger['debug'](_0xbdd1('0x26'),_0x4c486a,'request\x20sent',JSON['stringify'](_0x29ca93));if(_0x29ca93[_0xbdd1('0x27')]){if(_0x29ca93['error'][_0xbdd1('0x28')]===0x1f4){logger[_0xbdd1('0x27')](_0xbdd1('0x29'),_0x4c486a,_0x29ca93[_0xbdd1('0x27')][_0xbdd1('0x2a')]);return _0x5b7c67(_0x29ca93[_0xbdd1('0x27')][_0xbdd1('0x2a')]);}logger[_0xbdd1('0x27')](_0xbdd1('0x29'),_0x4c486a,_0x29ca93[_0xbdd1('0x27')][_0xbdd1('0x2a')]);return _0x372201(_0x29ca93[_0xbdd1('0x27')][_0xbdd1('0x2a')]);}else{logger[_0xbdd1('0x25')](_0xbdd1('0x29'),_0x4c486a,'request\x20sent');_0x372201(_0x29ca93[_0xbdd1('0x2b')]['message']);}})[_0xbdd1('0x2c')](function(_0x324c96){logger['error'](_0xbdd1('0x29'),_0x4c486a,_0x324c96);_0x5b7c67(_0x324c96);});});}function respondWithStatusCode(_0x1db0f2,_0x25e7b1){_0x25e7b1=_0x25e7b1||0xcc;return function(_0x1d729d){if(_0x1d729d){return _0x1db0f2[_0xbdd1('0x2d')](_0x25e7b1);}return _0x1db0f2[_0xbdd1('0x2e')](_0x25e7b1)[_0xbdd1('0x2f')]();};}function respondWithResult(_0x3c9360,_0x1a80ce){_0x1a80ce=_0x1a80ce||0xc8;return function(_0x42c5db){if(_0x42c5db){return _0x3c9360['status'](_0x1a80ce)['json'](_0x42c5db);}};}function respondWithFilteredResult(_0x1ce867,_0x2814aa){return function(_0x49eb9d){if(_0x49eb9d){var _0x1699f4=typeof _0x2814aa[_0xbdd1('0x30')]===_0xbdd1('0x31')&&typeof _0x2814aa[_0xbdd1('0x32')]==='undefined';var _0x21f45b=_0x49eb9d[_0xbdd1('0x33')];var _0x4f8047=_0x1699f4?0x0:_0x2814aa[_0xbdd1('0x30')];var _0x28bfe3=_0x1699f4?_0x49eb9d['count']:_0x2814aa[_0xbdd1('0x30')]+_0x2814aa['limit'];var _0xf63ce2;if(_0x28bfe3>=_0x21f45b){_0x28bfe3=_0x21f45b;_0xf63ce2=0xc8;}else{_0xf63ce2=0xce;}_0x1ce867[_0xbdd1('0x2e')](_0xf63ce2);return _0x1ce867[_0xbdd1('0x34')](_0xbdd1('0x35'),_0x4f8047+'-'+_0x28bfe3+'/'+_0x21f45b)['json'](_0x49eb9d);}return null;};}function patchUpdates(_0x49a38f){return function(_0xe7ad10){try{jsonpatch['apply'](_0xe7ad10,_0x49a38f,!![]);}catch(_0x5ea479){return BPromise[_0xbdd1('0x36')](_0x5ea479);}return _0xe7ad10['save']();};}function saveUpdates(_0x566b10,_0x3a8d0e){return function(_0x495294){if(_0x495294){return _0x495294[_0xbdd1('0x37')](_0x566b10)[_0xbdd1('0x24')](function(_0x1db66f){return _0x1db66f;});}return null;};}function removeEntity(_0x3aa08e,_0x1e779b){return function(_0x51f184){if(_0x51f184){return _0x51f184[_0xbdd1('0x38')]()[_0xbdd1('0x24')](function(){var _0x403e72=_0x51f184['get']({'plain':!![]});var _0x8595ed=_0xbdd1('0x39');return db[_0xbdd1('0x3a')]['destroy']({'where':{'type':_0x8595ed,'resourceId':_0x403e72['id']}})[_0xbdd1('0x24')](function(){return _0x51f184;});})[_0xbdd1('0x24')](function(){_0x3aa08e[_0xbdd1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4396,_0x2d1d33){return function(_0x29b803){if(!_0x29b803){_0x4f4396[_0xbdd1('0x2d')](0x194);}return _0x29b803;};}function handleError(_0x5b9f2f,_0x2e4996){_0x2e4996=_0x2e4996||0x1f4;return function(_0x42e271){logger[_0xbdd1('0x27')](_0x42e271[_0xbdd1('0x3b')]);if(_0x42e271[_0xbdd1('0x3c')]){delete _0x42e271['name'];}_0x5b9f2f[_0xbdd1('0x2e')](_0x2e4996)[_0xbdd1('0x3d')](_0x42e271);};}exports['index']=function(_0x4cc666,_0x21f27a){var _0x116a22={'include':[{'model':db[_0xbdd1('0x3e')],'as':_0xbdd1('0x3f')}]},_0x3b234b={},_0x393ca5={'count':0x0,'rows':[]};var _0xc808c7=_[_0xbdd1('0x40')](db[_0xbdd1('0x41')]['rawAttributes'],function(_0xcca00c){return{'name':_0xcca00c[_0xbdd1('0x42')],'type':_0xcca00c[_0xbdd1('0x43')][_0xbdd1('0x44')]};});_0x3b234b[_0xbdd1('0x45')]=_['map'](_0xc808c7,_0xbdd1('0x3c'));_0x3b234b['query']=_[_0xbdd1('0x46')](_0x4cc666[_0xbdd1('0x47')]);_0x3b234b[_0xbdd1('0x48')]=_[_0xbdd1('0x49')](_0x3b234b['model'],_0x3b234b[_0xbdd1('0x47')]);_0x116a22[_0xbdd1('0x4a')]=_['intersection'](_0x3b234b[_0xbdd1('0x45')],qs['fields'](_0x4cc666['query'][_0xbdd1('0x4b')]));_0x116a22[_0xbdd1('0x4a')]=_0x116a22[_0xbdd1('0x4a')][_0xbdd1('0x4c')]?_0x116a22[_0xbdd1('0x4a')]:_0x3b234b['model'];if(!_0x4cc666['query'][_0xbdd1('0x4d')](_0xbdd1('0x4e'))){_0x116a22['limit']=qs[_0xbdd1('0x32')](_0x4cc666[_0xbdd1('0x47')][_0xbdd1('0x32')]);_0x116a22['offset']=qs[_0xbdd1('0x30')](_0x4cc666[_0xbdd1('0x47')][_0xbdd1('0x30')]);}_0x116a22[_0xbdd1('0x4f')]=qs[_0xbdd1('0x50')](_0x4cc666[_0xbdd1('0x47')]['sort']);_0x116a22[_0xbdd1('0x51')]=qs['filters'](_[_0xbdd1('0x52')](_0x4cc666[_0xbdd1('0x47')],_0x3b234b['filters']),_0xc808c7);if(_0x4cc666['query'][_0xbdd1('0x53')]){_0x116a22[_0xbdd1('0x51')]=_[_0xbdd1('0x54')](_0x116a22[_0xbdd1('0x51')],{'$or':_[_0xbdd1('0x40')](_0xc808c7,function(_0x47a9cb){if(_0x47a9cb[_0xbdd1('0x43')]!==_0xbdd1('0x55')){var _0x2b06de={};_0x2b06de[_0x47a9cb[_0xbdd1('0x3c')]]={'$like':'%'+_0x4cc666['query'][_0xbdd1('0x53')]+'%'};return _0x2b06de;}})});}_0x116a22=_[_0xbdd1('0x54')]({},_0x116a22,_0x4cc666[_0xbdd1('0x56')]);var _0x251098={'where':_0x116a22[_0xbdd1('0x51')]};return db[_0xbdd1('0x41')][_0xbdd1('0x33')](_0x251098)[_0xbdd1('0x24')](function(_0x2f9774){_0x393ca5[_0xbdd1('0x33')]=_0x2f9774;if(_0x4cc666[_0xbdd1('0x47')][_0xbdd1('0x57')]){_0x116a22[_0xbdd1('0x58')]=[{'all':!![]}];}return db[_0xbdd1('0x41')][_0xbdd1('0x59')](_0x116a22);})[_0xbdd1('0x24')](function(_0x52b2d1){_0x393ca5[_0xbdd1('0x5a')]=_0x52b2d1;return _0x393ca5;})['then'](respondWithFilteredResult(_0x21f27a,_0x116a22))[_0xbdd1('0x2c')](handleError(_0x21f27a,null));};exports[_0xbdd1('0x5b')]=function(_0x38e9a0,_0x5c45ad){var _0x812f64={'raw':![],'where':{'id':_0x38e9a0[_0xbdd1('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xbdd1('0x3f')}]},_0x27847b={};_0x27847b[_0xbdd1('0x45')]=_['keys'](db[_0xbdd1('0x41')][_0xbdd1('0x5d')]);_0x27847b[_0xbdd1('0x47')]=_[_0xbdd1('0x46')](_0x38e9a0[_0xbdd1('0x47')]);_0x27847b[_0xbdd1('0x48')]=_[_0xbdd1('0x49')](_0x27847b[_0xbdd1('0x45')],_0x27847b[_0xbdd1('0x47')]);_0x812f64['attributes']=_['intersection'](_0x27847b['model'],qs[_0xbdd1('0x4b')](_0x38e9a0[_0xbdd1('0x47')][_0xbdd1('0x4b')]));_0x812f64['attributes']=_0x812f64[_0xbdd1('0x4a')][_0xbdd1('0x4c')]?_0x812f64[_0xbdd1('0x4a')]:_0x27847b[_0xbdd1('0x45')];if(_0x38e9a0['query']['includeAll']){_0x812f64[_0xbdd1('0x58')]=[{'all':!![]}];}_0x812f64=_[_0xbdd1('0x54')]({},_0x812f64,_0x38e9a0[_0xbdd1('0x56')]);return db['OpenchannelAccount'][_0xbdd1('0x5e')](_0x812f64)['then'](handleEntityNotFound(_0x5c45ad,null))['then'](respondWithResult(_0x5c45ad,null))[_0xbdd1('0x2c')](handleError(_0x5c45ad,null));};exports['create']=function(_0x1c563f,_0x5dddff){return db[_0xbdd1('0x41')][_0xbdd1('0x5f')](_0x1c563f[_0xbdd1('0x60')],{})['then'](function(_0x17596f){var _0x2c213b=_0x1c563f[_0xbdd1('0x61')][_0xbdd1('0x62')]({'plain':!![]});if(!_0x2c213b)throw new Error(_0xbdd1('0x63'));if(_0x2c213b[_0xbdd1('0x64')]===_0xbdd1('0x61')){var _0x25447b=_0x17596f[_0xbdd1('0x62')]({'plain':!![]});var _0x3c88e6=_0xbdd1('0x39');return db['UserProfileSection'][_0xbdd1('0x5e')]({'where':{'name':_0x3c88e6,'userProfileId':_0x2c213b['userProfileId']},'raw':!![]})[_0xbdd1('0x24')](function(_0x183b67){if(_0x183b67&&_0x183b67[_0xbdd1('0x65')]===0x0){return db[_0xbdd1('0x3a')]['create']({'name':_0x25447b[_0xbdd1('0x3c')],'resourceId':_0x25447b['id'],'type':_0x183b67[_0xbdd1('0x3c')],'sectionId':_0x183b67['id']},{})['then'](function(){return _0x17596f;});}else{return _0x17596f;}})[_0xbdd1('0x2c')](function(_0x30752a){logger[_0xbdd1('0x27')](_0xbdd1('0x66'),_0x30752a);throw _0x30752a;});}return _0x17596f;})['then'](respondWithResult(_0x5dddff,0xc9))[_0xbdd1('0x2c')](handleError(_0x5dddff,null));};exports['update']=function(_0xcb9d6e,_0x29e800){if(_0xcb9d6e[_0xbdd1('0x60')]['id']){delete _0xcb9d6e[_0xbdd1('0x60')]['id'];}return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0xcb9d6e['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x29e800,null))[_0xbdd1('0x24')](saveUpdates(_0xcb9d6e[_0xbdd1('0x60')],null))[_0xbdd1('0x24')](respondWithResult(_0x29e800,null))[_0xbdd1('0x2c')](handleError(_0x29e800,null));};exports[_0xbdd1('0x38')]=function(_0x2f1141,_0x32307){return db[_0xbdd1('0x41')]['find']({'where':{'id':_0x2f1141[_0xbdd1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x32307,null))['then'](removeEntity(_0x32307,null))[_0xbdd1('0x2c')](handleError(_0x32307,null));};exports['describe']=function(_0x2806da,_0x47269d){return db[_0xbdd1('0x41')][_0xbdd1('0x67')]()['then'](respondWithResult(_0x47269d,null))[_0xbdd1('0x2c')](handleError(_0x47269d,null));};exports['addDisposition']=function(_0x225ec0,_0x5bb45a,_0x425fff){if(_0x225ec0[_0xbdd1('0x60')]['id']){delete _0x225ec0[_0xbdd1('0x60')]['id'];}return db[_0xbdd1('0x41')]['find']({'where':{'id':_0x225ec0[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x5bb45a,null))[_0xbdd1('0x24')](function(_0x5bd243){if(_0x5bd243){_0x225ec0[_0xbdd1('0x60')][_0xbdd1('0x68')]=_0x5bd243['id'];return db[_0xbdd1('0x69')][_0xbdd1('0x5f')](_0x225ec0[_0xbdd1('0x60')]);}})[_0xbdd1('0x24')](respondWithResult(_0x5bb45a,null))[_0xbdd1('0x2c')](handleError(_0x5bb45a,null));};exports['getDispositions']=function(_0x47f9fc,_0x29169d,_0x5eaaca){var _0x3cf6f7={'raw':![],'where':{}};var _0x3556c0={};var _0x4092c4={'count':0x0,'rows':[]};return db[_0xbdd1('0x41')]['findOne']({'where':{'id':_0x47f9fc[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x29169d,null))[_0xbdd1('0x24')](function(_0x40f055){if(_0x40f055){_0x3556c0[_0xbdd1('0x45')]=_[_0xbdd1('0x46')](db[_0xbdd1('0x69')][_0xbdd1('0x5d')]);_0x3556c0[_0xbdd1('0x47')]=_[_0xbdd1('0x46')](_0x47f9fc['query']);_0x3556c0[_0xbdd1('0x48')]=_['intersection'](_0x3556c0['model'],_0x3556c0[_0xbdd1('0x47')]);_0x3cf6f7[_0xbdd1('0x4a')]=_['intersection'](_0x3556c0[_0xbdd1('0x45')],qs[_0xbdd1('0x4b')](_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x4b')]));_0x3cf6f7[_0xbdd1('0x4a')]=_0x3cf6f7['attributes'][_0xbdd1('0x4c')]?_0x3cf6f7[_0xbdd1('0x4a')]:_0x3556c0[_0xbdd1('0x45')];if(!_0x47f9fc['query'][_0xbdd1('0x4d')](_0xbdd1('0x4e'))){_0x3cf6f7[_0xbdd1('0x32')]=qs[_0xbdd1('0x32')](_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x32')]);_0x3cf6f7['offset']=qs[_0xbdd1('0x30')](_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x30')]);}_0x3cf6f7['order']=qs['sort'](_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x50')]);_0x3cf6f7['where']=qs[_0xbdd1('0x48')](_['pick'](_0x47f9fc[_0xbdd1('0x47')],_0x3556c0['filters']));_0x3cf6f7[_0xbdd1('0x51')]['OpenchannelAccountId']=_0x40f055['id'];if(_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x53')]){_0x3cf6f7[_0xbdd1('0x51')]=_['merge'](_0x3cf6f7[_0xbdd1('0x51')],{'$or':_['map'](_0x3cf6f7[_0xbdd1('0x4a')],function(_0x4e14aa){var _0x2cf65d={};_0x2cf65d[_0x4e14aa]={'$like':'%'+_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x53')]+'%'};return _0x2cf65d;})});}_0x3cf6f7=_[_0xbdd1('0x54')]({},_0x3cf6f7,_0x47f9fc['options']);return db[_0xbdd1('0x69')][_0xbdd1('0x33')]({'where':_0x3cf6f7['where']})['then'](function(_0x27cd59){_0x4092c4[_0xbdd1('0x33')]=_0x27cd59;if(_0x47f9fc[_0xbdd1('0x47')][_0xbdd1('0x57')]){_0x3cf6f7['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3cf6f7);})['then'](function(_0x55d110){_0x4092c4['rows']=_0x55d110;return _0x4092c4;});}})[_0xbdd1('0x24')](respondWithFilteredResult(_0x29169d,_0x3cf6f7))[_0xbdd1('0x2c')](handleError(_0x29169d,null));};exports[_0xbdd1('0x6a')]=function(_0x966e61,_0x2d6c20,_0x26dc08){return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0x966e61['params']['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x2d6c20,null))[_0xbdd1('0x24')](function(_0x54fa11){if(_0x54fa11){return _0x54fa11['removeDispositions'](_0x966e61['query'][_0xbdd1('0x6b')]);}})['then'](respondWithStatusCode(_0x2d6c20,null))[_0xbdd1('0x2c')](handleError(_0x2d6c20,null));};exports[_0xbdd1('0x6c')]=function(_0x2a85a7,_0x2cbb5e,_0x36b639){if(_0x2a85a7[_0xbdd1('0x60')]['id']){delete _0x2a85a7[_0xbdd1('0x60')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2a85a7[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x2cbb5e,null))[_0xbdd1('0x24')](function(_0x562132){if(_0x562132){_0x2a85a7[_0xbdd1('0x60')][_0xbdd1('0x68')]=_0x562132['id'];return db[_0xbdd1('0x6d')][_0xbdd1('0x5f')](_0x2a85a7[_0xbdd1('0x60')]);}})[_0xbdd1('0x24')](respondWithResult(_0x2cbb5e,null))[_0xbdd1('0x2c')](handleError(_0x2cbb5e,null));};exports[_0xbdd1('0x6e')]=function(_0x57ab38,_0x41afaa,_0x93119c){var _0x1dd46c={'raw':![],'where':{}};var _0x24db47={};var _0x7bc8c1={'count':0x0,'rows':[]};return db[_0xbdd1('0x41')][_0xbdd1('0x6f')]({'where':{'id':_0x57ab38[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x41afaa,null))[_0xbdd1('0x24')](function(_0x4ea88f){if(_0x4ea88f){_0x24db47[_0xbdd1('0x45')]=_[_0xbdd1('0x46')](db[_0xbdd1('0x6d')][_0xbdd1('0x5d')]);_0x24db47[_0xbdd1('0x47')]=_[_0xbdd1('0x46')](_0x57ab38[_0xbdd1('0x47')]);_0x24db47[_0xbdd1('0x48')]=_['intersection'](_0x24db47[_0xbdd1('0x45')],_0x24db47['query']);_0x1dd46c['attributes']=_[_0xbdd1('0x49')](_0x24db47['model'],qs[_0xbdd1('0x4b')](_0x57ab38[_0xbdd1('0x47')]['fields']));_0x1dd46c['attributes']=_0x1dd46c[_0xbdd1('0x4a')][_0xbdd1('0x4c')]?_0x1dd46c['attributes']:_0x24db47[_0xbdd1('0x45')];if(!_0x57ab38[_0xbdd1('0x47')][_0xbdd1('0x4d')](_0xbdd1('0x4e'))){_0x1dd46c['limit']=qs[_0xbdd1('0x32')](_0x57ab38[_0xbdd1('0x47')][_0xbdd1('0x32')]);_0x1dd46c['offset']=qs['offset'](_0x57ab38['query'][_0xbdd1('0x30')]);}_0x1dd46c[_0xbdd1('0x4f')]=qs[_0xbdd1('0x50')](_0x57ab38[_0xbdd1('0x47')][_0xbdd1('0x50')]);_0x1dd46c['where']=qs[_0xbdd1('0x48')](_[_0xbdd1('0x52')](_0x57ab38[_0xbdd1('0x47')],_0x24db47[_0xbdd1('0x48')]));_0x1dd46c[_0xbdd1('0x51')][_0xbdd1('0x68')]=_0x4ea88f['id'];if(_0x57ab38[_0xbdd1('0x47')]['filter']){_0x1dd46c[_0xbdd1('0x51')]=_[_0xbdd1('0x54')](_0x1dd46c[_0xbdd1('0x51')],{'$or':_[_0xbdd1('0x40')](_0x1dd46c[_0xbdd1('0x4a')],function(_0x595549){var _0x445efe={};_0x445efe[_0x595549]={'$like':'%'+_0x57ab38['query'][_0xbdd1('0x53')]+'%'};return _0x445efe;})});}_0x1dd46c=_[_0xbdd1('0x54')]({},_0x1dd46c,_0x57ab38['options']);return db[_0xbdd1('0x6d')][_0xbdd1('0x33')]({'where':_0x1dd46c[_0xbdd1('0x51')]})['then'](function(_0x5b01ba){_0x7bc8c1[_0xbdd1('0x33')]=_0x5b01ba;if(_0x57ab38['query']['includeAll']){_0x1dd46c[_0xbdd1('0x58')]=[{'all':!![]}];}return db[_0xbdd1('0x6d')][_0xbdd1('0x59')](_0x1dd46c);})[_0xbdd1('0x24')](function(_0x1a4cd1){_0x7bc8c1['rows']=_0x1a4cd1;return _0x7bc8c1;});}})[_0xbdd1('0x24')](respondWithFilteredResult(_0x41afaa,_0x1dd46c))['catch'](handleError(_0x41afaa,null));};exports['removeAnswers']=function(_0x423b5c,_0x1c1408,_0x4d4209){return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0x423b5c[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x1c1408,null))[_0xbdd1('0x24')](function(_0xf19a1){if(_0xf19a1){return _0xf19a1['removeAnswers'](_0x423b5c[_0xbdd1('0x47')][_0xbdd1('0x6b')]);}})[_0xbdd1('0x24')](respondWithStatusCode(_0x1c1408,null))[_0xbdd1('0x2c')](handleError(_0x1c1408,null));};exports['notify']=function(_0x3238c9,_0x55f4a6,_0x5aa5bb){var _0x53d619={'body':_0x3238c9[_0xbdd1('0x60')],'channel':'openchannel'};var _0x12e332=[];var _0x5838cd=[];var _0x3d8c00={};var _0x130452=![];return db[_0xbdd1('0x70')][_0xbdd1('0x67')]()[_0xbdd1('0x24')](function(_0x3fe6fc){if(!_0x3fe6fc){throw new db[(_0xbdd1('0x71'))][(_0xbdd1('0x72'))](_0xbdd1('0x73'));}_0x12e332=_[_0xbdd1('0x74')](_[_0xbdd1('0x46')](_0x3fe6fc),[_0xbdd1('0x75'),'updatedAt']);_0x5838cd=_['difference'](_[_0xbdd1('0x46')](_0x3fe6fc),[_0xbdd1('0x75'),_0xbdd1('0x76'),'CompanyId',_0xbdd1('0x77')]);if(_0x3238c9[_0xbdd1('0x60')]['id']){delete _0x3238c9['body']['id'];}if(_[_0xbdd1('0x78')](_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x79')])){throw new db['Sequelize'][(_0xbdd1('0x72'))](_0xbdd1('0x7a'));}if(_['isNil'](_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x60')])||_0x3238c9[_0xbdd1('0x60')]['body']===''){throw new db[(_0xbdd1('0x71'))][(_0xbdd1('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbdd1('0x78')](_0x3238c9['body'][_0xbdd1('0x7b')])){throw new db[(_0xbdd1('0x71'))]['ValidationError'](_0xbdd1('0x7c')+_0x5838cd);}if(!_[_0xbdd1('0x7d')](_0x5838cd,_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x7b')])){throw new db[(_0xbdd1('0x71'))][(_0xbdd1('0x72'))](_0xbdd1('0x7e')+_0x5838cd);}_0x3d8c00[_0x3238c9[_0xbdd1('0x60')]['mapKey']]=_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x79')];})[_0xbdd1('0x24')](function(){return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0x3238c9[_0xbdd1('0x5c')]['id']},'include':[{'model':db[_0xbdd1('0x7f')],'as':_0xbdd1('0x80'),'include':[{'model':db['CmContact'],'as':_0xbdd1('0x81'),'where':_0x3d8c00,'limit':0x1,'order':[[_0xbdd1('0x76'),_0xbdd1('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xbdd1('0x83')}]});})[_0xbdd1('0x24')](handleEntityNotFound(_0x55f4a6,null))[_0xbdd1('0x24')](function(_0x35179d){if(_0x35179d&&_0x35179d[_0xbdd1('0x80')]){_0x53d619[_0xbdd1('0x84')]=_0x35179d;_0x53d619[_0xbdd1('0x85')]=_0x35179d[_0xbdd1('0x83')];_0x53d619['list']=_0x35179d[_0xbdd1('0x80')];_0x53d619[_0xbdd1('0x85')]=_[_0xbdd1('0x86')](_0x53d619[_0xbdd1('0x85')],[_0xbdd1('0x87')],[_0xbdd1('0x88')]);if(_0x53d619[_0xbdd1('0x84')][_0xbdd1('0x83')]){delete _0x53d619['account'][_0xbdd1('0x83')];}if(_0x53d619[_0xbdd1('0x84')][_0xbdd1('0x80')]&&_0x53d619[_0xbdd1('0x84')][_0xbdd1('0x80')][_0xbdd1('0x81')][_0xbdd1('0x4c')]){return _0x53d619[_0xbdd1('0x84')][_0xbdd1('0x80')][_0xbdd1('0x81')][0x0];}var _0xb835ff=_[_0xbdd1('0x1c')](_0x3238c9[_0xbdd1('0x60')],{'firstName':_0x3238c9['body'][_0xbdd1('0x79')],'ListId':_0x35179d[_0xbdd1('0x77')]});_0xb835ff[_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x7b')]]=_0x3238c9['body'][_0xbdd1('0x79')];return db['CmContact'][_0xbdd1('0x5f')](_0xb835ff,{'fields':_0x12e332,'raw':!![]});}})[_0xbdd1('0x24')](handleEntityNotFound(_0x55f4a6,null))['then'](function(_0x34ef40){_0x53d619[_0xbdd1('0x89')]=_0x34ef40;if(_0x34ef40){var _0x1e8f36={'ContactId':_0x34ef40['id'],'OpenchannelAccountId':_0x3238c9[_0xbdd1('0x5c')]['id'],'from':(_0x34ef40[_0xbdd1('0x8a')]||'')+'\x20'+(_0x34ef40[_0xbdd1('0x8b')]||'')};var _0x2d9a14={'OpenchannelAccountId':_0x3238c9[_0xbdd1('0x5c')]['id'],'closed':![]};if(_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x8c')]){_0x2d9a14[_0xbdd1('0x8c')]=_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x8c')];return db[_0xbdd1('0x8d')][_0xbdd1('0x5e')]({'where':_0x2d9a14})[_0xbdd1('0x24')](function(_0x14abc8){if(_0x14abc8){return[_0x14abc8,![]];}_0x1e8f36[_0xbdd1('0x8c')]=_0x3238c9[_0xbdd1('0x60')]['threadId'];_0x1e8f36[_0xbdd1('0x8e')]=_0x3238c9[_0xbdd1('0x60')]['externalUrl'];return db[_0xbdd1('0x8d')][_0xbdd1('0x5f')](_0x1e8f36)[_0xbdd1('0x24')](function(_0x1a3520){return[_0x1a3520,!![]];});});}else{_0x2d9a14[_0xbdd1('0x8c')]=null;}_0x2d9a14[_0xbdd1('0x8f')]=_0x34ef40['id'];return db[_0xbdd1('0x8d')][_0xbdd1('0x5e')]({'where':_0x2d9a14})['then'](function(_0x224fcd){if(_0x224fcd){return[_0x224fcd,![]];}return db[_0xbdd1('0x8d')][_0xbdd1('0x5f')](_0x1e8f36)['then'](function(_0x59fb35){return[_0x59fb35,!![]];});});}})[_0xbdd1('0x90')](function(_0x526c51,_0x26d81c){if(_0x526c51){_0x130452=_0x26d81c;if(!_0x26d81c){var _0x45bb38={'from':(_0x53d619[_0xbdd1('0x89')]['firstName']||'')+'\x20'+(_0x53d619[_0xbdd1('0x89')]['lastName']||'')};if(_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x8c')]&&_0x3238c9['body'][_0xbdd1('0x91')]&&_0x3238c9[_0xbdd1('0x60')]['threadId']!=_0x3238c9[_0xbdd1('0x60')]['messageId']){_0x45bb38[_0xbdd1('0x8c')]=_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x91')];}return _0x526c51['update'](_0x45bb38);}else{return _0x526c51;}}})['then'](function(_0x35478d){_0x53d619['interaction']=_0x35478d[_0xbdd1('0x62')]({'plain':!![]});_0x53d619[_0xbdd1('0x92')]['created']=_0x130452;if(_0x53d619[_0xbdd1('0x92')][_0xbdd1('0x93')]){if(_0x53d619[_0xbdd1('0x84')]['autoclose']){_0x53d619[_0xbdd1('0x85')]['push']({'id':0x0,'priority':_0x53d619[_0xbdd1('0x85')][_0xbdd1('0x4c')]+0x1,'app':_0xbdd1('0x94'),'appdata':_0xbdd1('0x95'),'interval':_0xbdd1('0x96')});}}return db[_0xbdd1('0x97')][_0xbdd1('0x5f')]({'body':_0x3238c9[_0xbdd1('0x60')][_0xbdd1('0x60')],'OpenchannelAccountId':_0x3238c9[_0xbdd1('0x5c')]['id'],'OpenchannelInteractionId':_0x35478d['id'],'direction':'in','ContactId':_0x53d619['contact']['id'],'AttachmentId':_0x3238c9[_0xbdd1('0x60')]['AttachmentId']});})['then'](function(_0x371593){_0x53d619[_0xbdd1('0x2a')]=_0x371593;if(_0x53d619[_0xbdd1('0x92')][_0xbdd1('0x98')]){return db['User'][_0xbdd1('0x5e')]({'attributes':['id',_0xbdd1('0x3c')],'where':{'id':_0x53d619['interaction']['UserId']}})[_0xbdd1('0x24')](function(_0x5419f1){if(_0x5419f1){_0x53d619[_0xbdd1('0x85')][_0xbdd1('0x99')]({'id':0x0,'priority':0x0,'app':_0xbdd1('0x9a'),'appdata':_0x5419f1['name']+','+(_0x53d619['account'][_0xbdd1('0x9b')]||0xa),'interval':_0xbdd1('0x96')});_0x53d619[_0xbdd1('0x9c')]=![];}return respondWithRpcPromise(_0xbdd1('0x9d'),_0xbdd1('0x9e'),_0x53d619);});}return respondWithRpcPromise(_0xbdd1('0x9d'),'startRouting',_0x53d619);})['then'](function(_0x314a09){respondWithRpcPromise(_0xbdd1('0x9f'),_0xbdd1('0x9f'),{'event':_0xbdd1('0xa0'),'message':_0x314a09},client9002);return _0x314a09;})[_0xbdd1('0x24')](respondWithResult(_0x55f4a6,null))['catch'](handleError(_0x55f4a6,null));};exports[_0xbdd1('0xa1')]=function(_0x2afc69,_0x1ece2f){var _0x1c6dfa=_0x2afc69[_0xbdd1('0x5c')]['id'];var _0x38f1af=_0x2afc69[_0xbdd1('0x60')];var _0x4969f2=0xc8;var _0x33b4d3=null;return db[_0xbdd1('0xa2')]['transaction']({'isolationLevel':db[_0xbdd1('0xa2')][_0xbdd1('0xa3')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4d59fb){return db[_0xbdd1('0x41')]['findOne']({'where':{'id':_0x1c6dfa},'transaction':_0x4d59fb})[_0xbdd1('0x24')](function(_0x3d1c9c){if(_0x3d1c9c){return db[_0xbdd1('0xa4')][_0xbdd1('0x38')]({'where':{'OpenchannelAccountId':_0x1c6dfa},'transaction':_0x4d59fb})[_0xbdd1('0x24')](function(){var _0x26a9f9=_[_0xbdd1('0x40')](_0x38f1af,function(_0x43153c){_0x43153c[_0xbdd1('0x68')]=_0x1c6dfa;return _0x43153c;});return db[_0xbdd1('0xa4')][_0xbdd1('0xa5')](_0x26a9f9,{'transaction':_0x4d59fb});});}else{_0x4969f2=0x194;_0x33b4d3=[];}});})[_0xbdd1('0x24')](function(){if(_0x4969f2!==0x194){return db[_0xbdd1('0xa4')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1c6dfa},'order':_0xbdd1('0x87')})[_0xbdd1('0x24')](function(_0x195464){_0x33b4d3=_0x195464;});}})[_0xbdd1('0x2c')](function(_0x564acd){_0x4969f2=0x1f4;logger[_0xbdd1('0x27')](_0x564acd[_0xbdd1('0x3b')]);if(_0x564acd['name']){delete _0x564acd[_0xbdd1('0x3c')];}_0x33b4d3=_0x564acd;})[_0xbdd1('0xa6')](function(){if(_0x33b4d3===null){_0x1ece2f[_0xbdd1('0x2d')](_0x4969f2);}else{if(_0x4969f2===0x1f4){_0x1ece2f[_0xbdd1('0x2e')](_0x4969f2)[_0xbdd1('0x3d')](_0x33b4d3);}else{_0x1ece2f[_0xbdd1('0x2e')](_0x4969f2)['json'](_0x33b4d3);}}});};exports[_0xbdd1('0xa7')]=function(_0x50cb95,_0x32d4bf,_0x18cbaf){var _0x365d77={};var _0x776921={};var _0x82b6bf;var _0xf2ac6a;return db['OpenchannelAccount'][_0xbdd1('0x6f')]({'where':{'id':_0x50cb95[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x32d4bf,null))['then'](function(_0x37e90b){if(_0x37e90b){_0x82b6bf=_0x37e90b;_0x776921[_0xbdd1('0x45')]=_[_0xbdd1('0x46')](db[_0xbdd1('0xa4')][_0xbdd1('0x5d')]);_0x776921[_0xbdd1('0x47')]=_['keys'](_0x50cb95[_0xbdd1('0x47')]);_0x776921['filters']=_[_0xbdd1('0x49')](_0x776921[_0xbdd1('0x45')],_0x776921[_0xbdd1('0x47')]);_0x365d77['attributes']=_[_0xbdd1('0x49')](_0x776921[_0xbdd1('0x45')],qs['fields'](_0x50cb95[_0xbdd1('0x47')][_0xbdd1('0x4b')]));_0x365d77['attributes']=_0x365d77['attributes'][_0xbdd1('0x4c')]?_0x365d77['attributes']:_0x776921[_0xbdd1('0x45')];_0x365d77[_0xbdd1('0x4f')]=qs[_0xbdd1('0x50')](_0x50cb95[_0xbdd1('0x47')][_0xbdd1('0x50')]);_0x365d77[_0xbdd1('0x51')]=qs[_0xbdd1('0x48')](_[_0xbdd1('0x52')](_0x50cb95['query'],_0x776921[_0xbdd1('0x48')]));if(_0x50cb95['query'][_0xbdd1('0x53')]){_0x365d77[_0xbdd1('0x51')]=_[_0xbdd1('0x54')](_0x365d77[_0xbdd1('0x51')],{'$or':_[_0xbdd1('0x40')](_0x365d77[_0xbdd1('0x4a')],function(_0x2b0f94){var _0x256f5a={};_0x256f5a[_0x2b0f94]={'$like':'%'+_0x50cb95[_0xbdd1('0x47')]['filter']+'%'};return _0x256f5a;})});}_0x365d77=_[_0xbdd1('0x54')]({},_0x365d77,_0x50cb95[_0xbdd1('0x56')]);return _0x82b6bf[_0xbdd1('0xa7')](_0x365d77);}})[_0xbdd1('0x24')](function(_0x214c14){if(_0x214c14){_0xf2ac6a=_0x214c14[_0xbdd1('0x4c')];if(!_0x50cb95['query']['hasOwnProperty']('nolimit')){_0x365d77[_0xbdd1('0x32')]=qs[_0xbdd1('0x32')](_0x50cb95[_0xbdd1('0x47')][_0xbdd1('0x32')]);_0x365d77[_0xbdd1('0x30')]=qs['offset'](_0x50cb95[_0xbdd1('0x47')][_0xbdd1('0x30')]);}return _0x82b6bf[_0xbdd1('0xa7')](_0x365d77);}})['then'](function(_0x340f3a){if(_0x340f3a){return _0x340f3a?{'count':_0xf2ac6a,'rows':_0x340f3a}:null;}})[_0xbdd1('0x24')](respondWithResult(_0x32d4bf,null))['catch'](handleError(_0x32d4bf,null));};exports[_0xbdd1('0xa8')]=function(_0x41b2a1,_0x1f9544,_0x4eada2){var _0x62460d={'raw':![],'where':{}};var _0x315365={};var _0x969685={'count':0x0,'rows':[]};return db[_0xbdd1('0x41')][_0xbdd1('0x6f')]({'where':{'id':_0x41b2a1[_0xbdd1('0x5c')]['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x1f9544,null))['then'](function(_0x153fad){if(_0x153fad){_0x315365[_0xbdd1('0x45')]=_[_0xbdd1('0x46')](db['OpenchannelInteraction'][_0xbdd1('0x5d')]);_0x315365[_0xbdd1('0x47')]=_['keys'](_0x41b2a1[_0xbdd1('0x47')]);_0x315365[_0xbdd1('0x48')]=_[_0xbdd1('0x49')](_0x315365['model'],_0x315365[_0xbdd1('0x47')]);_0x62460d['attributes']=_[_0xbdd1('0x49')](_0x315365[_0xbdd1('0x45')],qs[_0xbdd1('0x4b')](_0x41b2a1['query'][_0xbdd1('0x4b')]));_0x62460d[_0xbdd1('0x4a')]=_0x62460d[_0xbdd1('0x4a')][_0xbdd1('0x4c')]?_0x62460d['attributes']:_0x315365[_0xbdd1('0x45')];if(!_0x41b2a1[_0xbdd1('0x47')][_0xbdd1('0x4d')](_0xbdd1('0x4e'))){_0x62460d[_0xbdd1('0x32')]=qs[_0xbdd1('0x32')](_0x41b2a1['query'][_0xbdd1('0x32')]);_0x62460d[_0xbdd1('0x30')]=qs[_0xbdd1('0x30')](_0x41b2a1[_0xbdd1('0x47')][_0xbdd1('0x30')]);}_0x62460d['order']=qs['sort'](_0x41b2a1[_0xbdd1('0x47')][_0xbdd1('0x50')]);_0x62460d['where']=qs['filters'](_[_0xbdd1('0x52')](_0x41b2a1[_0xbdd1('0x47')],_0x315365[_0xbdd1('0x48')]));_0x62460d[_0xbdd1('0x51')]['OpenchannelAccountId']=_0x153fad['id'];if(_0x41b2a1['query'][_0xbdd1('0x53')]){_0x62460d[_0xbdd1('0x51')]=_[_0xbdd1('0x54')](_0x62460d['where'],{'$or':_[_0xbdd1('0x40')](_0x62460d['attributes'],function(_0x190fff){var _0x5e0ba3={};_0x5e0ba3[_0x190fff]={'$like':'%'+_0x41b2a1['query'][_0xbdd1('0x53')]+'%'};return _0x5e0ba3;})});}_0x62460d=_[_0xbdd1('0x54')]({},_0x62460d,_0x41b2a1[_0xbdd1('0x56')]);return db[_0xbdd1('0x8d')][_0xbdd1('0x33')]({'where':_0x62460d[_0xbdd1('0x51')]})[_0xbdd1('0x24')](function(_0x1cbcf9){_0x969685['count']=_0x1cbcf9;if(_0x41b2a1[_0xbdd1('0x47')][_0xbdd1('0x57')]){_0x62460d[_0xbdd1('0x58')]=[{'model':db['CmContact'],'as':_0xbdd1('0xa9'),'required':![]},{'model':db['User'],'as':_0xbdd1('0xaa'),'attributes':[_0xbdd1('0x3c'),'fullname',_0xbdd1('0xab')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x41b2a1[_0xbdd1('0x47')]['tag']?{'id':_0x41b2a1[_0xbdd1('0x47')]['tag']}:undefined,'required':_0x41b2a1[_0xbdd1('0x47')][_0xbdd1('0xac')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x62460d);})[_0xbdd1('0x24')](function(_0x863c7){_0x969685[_0xbdd1('0x5a')]=_0x863c7;return _0x969685;});}})[_0xbdd1('0x24')](respondWithFilteredResult(_0x1f9544,_0x62460d))[_0xbdd1('0x2c')](handleError(_0x1f9544,null));};exports[_0xbdd1('0xad')]=function(_0x3270b5,_0x44c782,_0x5ba4fa){return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0x3270b5['params']['id']}})[_0xbdd1('0x24')](handleEntityNotFound(_0x44c782,null))[_0xbdd1('0x24')](function(_0x33a5fd){if(_0x33a5fd){return _0x33a5fd[_0xbdd1('0xad')](_0x3270b5[_0xbdd1('0x60')][_0xbdd1('0x6b')],_['omit'](_0x3270b5[_0xbdd1('0x60')],[_0xbdd1('0x6b'),'id'])||{})[_0xbdd1('0x90')](function(_0x44d506){for(var _0x5d8fed=0x0;_0x5d8fed<_0x3270b5['body'][_0xbdd1('0x6b')][_0xbdd1('0x4c')];_0x5d8fed+=0x1){socket['emit'](_0xbdd1('0xae'),{'UserId':Number(_0x3270b5['body'][_0xbdd1('0x6b')][_0x5d8fed]),'OpenchannelAccountId':Number(_0x3270b5['params']['id'])});}return _0x44d506;});}})[_0xbdd1('0x24')](respondWithResult(_0x44c782,null))[_0xbdd1('0x2c')](handleError(_0x44c782,null));};exports[_0xbdd1('0xaf')]=function(_0x2076e2,_0x12556a,_0x2420f2){return db[_0xbdd1('0x41')]['find']({'where':{'id':_0x2076e2[_0xbdd1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x12556a,null))[_0xbdd1('0x24')](function(_0x2d8726){if(_0x2d8726){return _0x2d8726[_0xbdd1('0xaf')](_0x2076e2[_0xbdd1('0x47')][_0xbdd1('0x6b')])[_0xbdd1('0x24')](function(){if(_[_0xbdd1('0xb0')](_0x2076e2[_0xbdd1('0x47')][_0xbdd1('0x6b')])){for(var _0x14d3a5=0x0;_0x14d3a5<_0x2076e2[_0xbdd1('0x47')][_0xbdd1('0x6b')]['length'];_0x14d3a5+=0x1){socket[_0xbdd1('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2076e2[_0xbdd1('0x47')][_0xbdd1('0x6b')][_0x14d3a5]),'OpenchannelAccountId':Number(_0x2076e2[_0xbdd1('0x5c')]['id'])});}}else{socket['emit'](_0xbdd1('0xb2'),{'UserId':Number(_0x2076e2['query'][_0xbdd1('0x6b')]),'OpenchannelAccountId':Number(_0x2076e2[_0xbdd1('0x5c')]['id'])});}});}})[_0xbdd1('0x24')](respondWithStatusCode(_0x12556a,null))[_0xbdd1('0x2c')](handleError(_0x12556a,null));};exports[_0xbdd1('0xb3')]=function(_0x6aea78,_0x1d0626,_0xae9f37){var _0x12ad93={};var _0x3ac60e={};var _0x26a371;var _0x3708f1;return db[_0xbdd1('0x41')][_0xbdd1('0x6f')]({'where':{'id':_0x6aea78[_0xbdd1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d0626,null))[_0xbdd1('0x24')](function(_0x3fdda3){if(_0x3fdda3){_0x26a371=_0x3fdda3;_0x3ac60e[_0xbdd1('0x45')]=_[_0xbdd1('0x46')](db['User'][_0xbdd1('0x5d')]);_0x3ac60e['query']=_[_0xbdd1('0x46')](_0x6aea78['query']);_0x3ac60e['filters']=_[_0xbdd1('0x49')](_0x3ac60e[_0xbdd1('0x45')],_0x3ac60e[_0xbdd1('0x47')]);_0x12ad93[_0xbdd1('0x4a')]=_[_0xbdd1('0x49')](_0x3ac60e[_0xbdd1('0x45')],qs[_0xbdd1('0x4b')](_0x6aea78[_0xbdd1('0x47')][_0xbdd1('0x4b')]));_0x12ad93[_0xbdd1('0x4a')]=_0x12ad93[_0xbdd1('0x4a')][_0xbdd1('0x4c')]?_0x12ad93[_0xbdd1('0x4a')]:_0x3ac60e[_0xbdd1('0x45')];_0x12ad93['order']=qs[_0xbdd1('0x50')](_0x6aea78['query'][_0xbdd1('0x50')]);_0x12ad93[_0xbdd1('0x51')]=qs[_0xbdd1('0x48')](_[_0xbdd1('0x52')](_0x6aea78[_0xbdd1('0x47')],_0x3ac60e[_0xbdd1('0x48')]));if(_0x6aea78[_0xbdd1('0x47')][_0xbdd1('0x53')]){_0x12ad93['where']=_[_0xbdd1('0x54')](_0x12ad93[_0xbdd1('0x51')],{'$or':_[_0xbdd1('0x40')](_0x12ad93[_0xbdd1('0x4a')],function(_0x42d3e9){var _0x25d01d={};_0x25d01d[_0x42d3e9]={'$like':'%'+_0x6aea78['query']['filter']+'%'};return _0x25d01d;})});}_0x12ad93=_[_0xbdd1('0x54')]({},_0x12ad93,_0x6aea78[_0xbdd1('0x56')]);return _0x26a371[_0xbdd1('0xb3')](_0x12ad93);}})[_0xbdd1('0x24')](function(_0x475176){if(_0x475176){_0x3708f1=_0x475176[_0xbdd1('0x4c')];if(!_0x6aea78[_0xbdd1('0x47')][_0xbdd1('0x4d')]('nolimit')){_0x12ad93[_0xbdd1('0x32')]=qs[_0xbdd1('0x32')](_0x6aea78[_0xbdd1('0x47')]['limit']);_0x12ad93['offset']=qs[_0xbdd1('0x30')](_0x6aea78[_0xbdd1('0x47')]['offset']);}return _0x26a371['getAgents'](_0x12ad93);}})[_0xbdd1('0x24')](function(_0x22750a){if(_0x22750a){return _0x22750a?{'count':_0x3708f1,'rows':_0x22750a}:null;}})['then'](respondWithResult(_0x1d0626,null))['catch'](handleError(_0x1d0626,null));};exports[_0xbdd1('0x3d')]=function(_0x31fa7b,_0x33cac4,_0x397076){var _0x375e2b,_0x3396f5,_0x471ed6;if(_['isNil'](_0x31fa7b['body'][_0xbdd1('0x60')])||_0x31fa7b[_0xbdd1('0x60')][_0xbdd1('0x60')]===''){throw new db['Sequelize'][(_0xbdd1('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbdd1('0x78')](_0x31fa7b[_0xbdd1('0x60')]['to'])){}_0x375e2b=_0x31fa7b[_0xbdd1('0x60')]['to'];return db['OpenchannelAccount'][_0xbdd1('0x6f')]({'where':{'id':_0x31fa7b[_0xbdd1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33cac4,null))[_0xbdd1('0x24')](function(_0x357eb4){if(_0x357eb4){return db[_0xbdd1('0x41')][_0xbdd1('0x5e')]({'where':{'id':_0x357eb4['id']},'include':[{'model':db[_0xbdd1('0x7f')],'as':_0xbdd1('0x80'),'include':[{'model':db[_0xbdd1('0x70')],'as':_0xbdd1('0x81'),'where':{[_0x357eb4[_0xbdd1('0x7b')]]:_0x375e2b},'limit':0x1,'order':[['updatedAt',_0xbdd1('0x82')]]}]}]})[_0xbdd1('0x24')](handleEntityNotFound(_0x33cac4,null))[_0xbdd1('0x24')](function(_0x1727ca){if(_0x1727ca&&_0x1727ca[_0xbdd1('0x80')]){_0x3396f5=_0x1727ca[_0xbdd1('0x62')]({'plain':!![]});if(_0x3396f5['List']&&_0x3396f5[_0xbdd1('0x80')]['Contacts'][_0xbdd1('0x4c')]){return _0x3396f5[_0xbdd1('0x80')][_0xbdd1('0x81')][0x0];}return db[_0xbdd1('0x70')][_0xbdd1('0x5f')](_[_0xbdd1('0x1c')](_0x31fa7b['body'],{'firstName':_0x375e2b,[_0x1727ca[_0xbdd1('0x7b')]]:_0x375e2b,'phone':_0x375e2b,'ListId':_0x3396f5[_0xbdd1('0x77')]}));}})['then'](handleEntityNotFound(_0x33cac4,null))['then'](function(_0x4e4d93){if(_0x4e4d93){_0x471ed6=_0x4e4d93;return db['OpenchannelInteraction'][_0xbdd1('0x5e')]({'where':{'ContactId':_0x471ed6['id'],'closed':![],'OpenchannelAccountId':_0x3396f5['id']}})[_0xbdd1('0x24')](function(_0x3652f3){if(_0x3652f3){return[_0x3652f3,![]];}return db['OpenchannelInteraction'][_0xbdd1('0x5f')]({'UserId':_0x31fa7b[_0xbdd1('0x61')]['id'],'ContactId':_0x471ed6['id'],'OpenchannelAccountId':_0x3396f5['id'],'lastMsgDirection':'out','firstMsgDirection':_0xbdd1('0xb4'),'Messages':[_[_0xbdd1('0x54')](_0x31fa7b[_0xbdd1('0x60')],{'read':![],'body':_0x31fa7b[_0xbdd1('0x60')][_0xbdd1('0x60')],'OpenchannelAccountId':_0x3396f5['id'],'UserId':_0x31fa7b[_0xbdd1('0x61')]['id'],'ContactId':_0x471ed6['id']})]},{'include':[{'model':db[_0xbdd1('0x97')],'as':_0xbdd1('0xb5')}]})[_0xbdd1('0x24')](function(_0x320b38){return[_0x320b38,!![]];});});}})[_0xbdd1('0x90')](function(_0x3ec93a,_0x1b0c3d){if(_0x1b0c3d){return _0x3ec93a;}return db[_0xbdd1('0x97')]['create'](_[_0xbdd1('0x54')](_0x31fa7b[_0xbdd1('0x60')],{'read':![],'body':_0x31fa7b[_0xbdd1('0x60')]['body'],'OpenchannelAccountId':_0x3396f5['id'],'OpenchannelInteractionId':_0x3ec93a['id'],'UserId':_0x31fa7b[_0xbdd1('0x61')]['id'],'ContactId':_0x471ed6['id']}))[_0xbdd1('0x24')](function(_0x44ee15){_0x3ec93a['dataValues']['Messages']=[];_0x3ec93a['dataValues'][_0xbdd1('0xb5')][_0xbdd1('0xb6')](_0x44ee15['dataValues']);return _0x3ec93a;});});}})[_0xbdd1('0x24')](respondWithResult(_0x33cac4,null))['catch'](handleError(_0x33cac4,null));}; \ No newline at end of file +var _0x1da6=['name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','DESC','OpenchannelApplication','Applications','list','orderBy','applications','priority','account','Contacts','from','mapKey','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Tag','Tags','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','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','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','OpenchannelAccounts','UserProfileResource','stack'];(function(_0x4f3dee,_0x46bb90){var _0x291aad=function(_0x3ca8f5){while(--_0x3ca8f5){_0x4f3dee['push'](_0x4f3dee['shift']());}};_0x291aad(++_0x46bb90);}(_0x1da6,0x7c));var _0x61da=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x1da6[_0x574ce3];return _0x3447a0;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];config[_0x61da('0x1f')]=_[_0x61da('0x20')](config[_0x61da('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x61da('0x21'))(new Redis(config[_0x61da('0x1f')]));require(_0x61da('0x22'))[_0x61da('0x23')](socket);var jayson=require('jayson/promise');var client=jayson[_0x61da('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x61da('0x24')][_0x61da('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x4a0aea,_0x53f3a4,_0x1305fe,_0x314f41){return new BPromise(function(_0x46d2c4,_0x16ab1e){var _0x2ac3aa=_0x314f41||client;return _0x2ac3aa[_0x61da('0x26')](_0x4a0aea,_0x1305fe)['then'](function(_0x14f049){logger[_0x61da('0x27')](_0x61da('0x28'),_0x53f3a4,_0x61da('0x29'));logger['debug'](_0x61da('0x2a'),_0x53f3a4,_0x61da('0x29'),JSON[_0x61da('0x2b')](_0x14f049));if(_0x14f049[_0x61da('0x2c')]){if(_0x14f049['error'][_0x61da('0x2d')]===0x1f4){logger['error'](_0x61da('0x28'),_0x53f3a4,_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);return _0x16ab1e(_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);}logger[_0x61da('0x2c')](_0x61da('0x28'),_0x53f3a4,_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);return _0x46d2c4(_0x14f049[_0x61da('0x2c')]['message']);}else{logger[_0x61da('0x27')](_0x61da('0x28'),_0x53f3a4,_0x61da('0x29'));_0x46d2c4(_0x14f049[_0x61da('0x2f')][_0x61da('0x2e')]);}})[_0x61da('0x30')](function(_0x4860d4){logger[_0x61da('0x2c')](_0x61da('0x28'),_0x53f3a4,_0x4860d4);_0x16ab1e(_0x4860d4);});});}function respondWithStatusCode(_0x229326,_0x100ba1){_0x100ba1=_0x100ba1||0xcc;return function(_0x351241){if(_0x351241){return _0x229326[_0x61da('0x31')](_0x100ba1);}return _0x229326[_0x61da('0x32')](_0x100ba1)[_0x61da('0x33')]();};}function respondWithResult(_0x4c1bf4,_0x2746a6){_0x2746a6=_0x2746a6||0xc8;return function(_0x403244){if(_0x403244){return _0x4c1bf4[_0x61da('0x32')](_0x2746a6)[_0x61da('0x34')](_0x403244);}};}function respondWithFilteredResult(_0x52f486,_0x275aa6){return function(_0x591efe){if(_0x591efe){var _0x2c9a1d=typeof _0x275aa6[_0x61da('0x35')]===_0x61da('0x36')&&typeof _0x275aa6[_0x61da('0x37')]===_0x61da('0x36');var _0x3166be=_0x591efe[_0x61da('0x38')];var _0x52d93d=_0x2c9a1d?0x0:_0x275aa6[_0x61da('0x35')];var _0x511ec7=_0x2c9a1d?_0x591efe['count']:_0x275aa6[_0x61da('0x35')]+_0x275aa6[_0x61da('0x37')];var _0xfb69f1;if(_0x511ec7>=_0x3166be){_0x511ec7=_0x3166be;_0xfb69f1=0xc8;}else{_0xfb69f1=0xce;}_0x52f486[_0x61da('0x32')](_0xfb69f1);return _0x52f486[_0x61da('0x39')]('Content-Range',_0x52d93d+'-'+_0x511ec7+'/'+_0x3166be)[_0x61da('0x34')](_0x591efe);}return null;};}function patchUpdates(_0x1c0ab4){return function(_0x2963a5){try{jsonpatch[_0x61da('0x3a')](_0x2963a5,_0x1c0ab4,!![]);}catch(_0x5cb24d){return BPromise[_0x61da('0x3b')](_0x5cb24d);}return _0x2963a5[_0x61da('0x3c')]();};}function saveUpdates(_0x4a3267,_0x23c225){return function(_0x5b4df3){if(_0x5b4df3){return _0x5b4df3['update'](_0x4a3267)['then'](function(_0x5d5203){return _0x5d5203;});}return null;};}function removeEntity(_0x4a74c0,_0x456f83){return function(_0x423c85){if(_0x423c85){return _0x423c85[_0x61da('0x3d')]()[_0x61da('0x3e')](function(){var _0x771641=_0x423c85['get']({'plain':!![]});var _0x256fd0=_0x61da('0x3f');return db[_0x61da('0x40')]['destroy']({'where':{'type':_0x256fd0,'resourceId':_0x771641['id']}})[_0x61da('0x3e')](function(){return _0x423c85;});})[_0x61da('0x3e')](function(){_0x4a74c0[_0x61da('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fe54,_0x3e381b){return function(_0x168f4b){if(!_0x168f4b){_0x36fe54[_0x61da('0x31')](0x194);}return _0x168f4b;};}function handleError(_0x2d6918,_0x4b49e7){_0x4b49e7=_0x4b49e7||0x1f4;return function(_0x71c945){logger[_0x61da('0x2c')](_0x71c945[_0x61da('0x41')]);if(_0x71c945[_0x61da('0x42')]){delete _0x71c945[_0x61da('0x42')];}_0x2d6918['status'](_0x4b49e7)['send'](_0x71c945);};}exports['index']=function(_0x2deb98,_0x278732){var _0x22f01e={'include':[{'model':db[_0x61da('0x43')],'as':_0x61da('0x44')}]},_0x2e57df={},_0xb0edad={'count':0x0,'rows':[]};var _0x522aeb=_[_0x61da('0x45')](db[_0x61da('0x46')]['rawAttributes'],function(_0xf24ef6){return{'name':_0xf24ef6[_0x61da('0x47')],'type':_0xf24ef6[_0x61da('0x48')]['key']};});_0x2e57df[_0x61da('0x49')]=_['map'](_0x522aeb,_0x61da('0x42'));_0x2e57df[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x2deb98[_0x61da('0x4a')]);_0x2e57df['filters']=_[_0x61da('0x4c')](_0x2e57df[_0x61da('0x49')],_0x2e57df[_0x61da('0x4a')]);_0x22f01e[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x2e57df[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x2deb98[_0x61da('0x4a')][_0x61da('0x4e')]));_0x22f01e[_0x61da('0x4d')]=_0x22f01e['attributes'][_0x61da('0x4f')]?_0x22f01e[_0x61da('0x4d')]:_0x2e57df[_0x61da('0x49')];if(!_0x2deb98[_0x61da('0x4a')][_0x61da('0x50')](_0x61da('0x51'))){_0x22f01e[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x2deb98['query']['limit']);_0x22f01e[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x2deb98[_0x61da('0x4a')][_0x61da('0x35')]);}_0x22f01e[_0x61da('0x52')]=qs['sort'](_0x2deb98[_0x61da('0x4a')][_0x61da('0x53')]);_0x22f01e[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x2deb98[_0x61da('0x4a')],_0x2e57df[_0x61da('0x55')]),_0x522aeb);if(_0x2deb98[_0x61da('0x4a')][_0x61da('0x57')]){_0x22f01e['where']=_[_0x61da('0x58')](_0x22f01e[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x522aeb,function(_0x14f21c){if(_0x14f21c['type']!==_0x61da('0x59')){var _0x1dbd9e={};_0x1dbd9e[_0x14f21c[_0x61da('0x42')]]={'$like':'%'+_0x2deb98[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x1dbd9e;}})});}_0x22f01e=_['merge']({},_0x22f01e,_0x2deb98[_0x61da('0x5a')]);var _0x5b3dee={'where':_0x22f01e[_0x61da('0x54')]};return db[_0x61da('0x46')][_0x61da('0x38')](_0x5b3dee)['then'](function(_0x1a7f4f){_0xb0edad[_0x61da('0x38')]=_0x1a7f4f;if(_0x2deb98[_0x61da('0x4a')]['includeAll']){_0x22f01e[_0x61da('0x5b')]=[{'all':!![]}];}return db[_0x61da('0x46')][_0x61da('0x5c')](_0x22f01e);})[_0x61da('0x3e')](function(_0x4dd6fb){_0xb0edad[_0x61da('0x5d')]=_0x4dd6fb;return _0xb0edad;})['then'](respondWithFilteredResult(_0x278732,_0x22f01e))[_0x61da('0x30')](handleError(_0x278732,null));};exports['show']=function(_0x45f710,_0x45e1fc){var _0x388aa7={'raw':![],'where':{'id':_0x45f710['params']['id']},'include':[{'model':db[_0x61da('0x43')],'as':_0x61da('0x44')}]},_0x14313e={};_0x14313e[_0x61da('0x49')]=_[_0x61da('0x4b')](db[_0x61da('0x46')][_0x61da('0x5e')]);_0x14313e[_0x61da('0x4a')]=_['keys'](_0x45f710['query']);_0x14313e['filters']=_[_0x61da('0x4c')](_0x14313e[_0x61da('0x49')],_0x14313e[_0x61da('0x4a')]);_0x388aa7['attributes']=_[_0x61da('0x4c')](_0x14313e[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x45f710[_0x61da('0x4a')][_0x61da('0x4e')]));_0x388aa7[_0x61da('0x4d')]=_0x388aa7[_0x61da('0x4d')]['length']?_0x388aa7['attributes']:_0x14313e[_0x61da('0x49')];if(_0x45f710[_0x61da('0x4a')][_0x61da('0x5f')]){_0x388aa7[_0x61da('0x5b')]=[{'all':!![]}];}_0x388aa7=_[_0x61da('0x58')]({},_0x388aa7,_0x45f710[_0x61da('0x5a')]);return db[_0x61da('0x46')][_0x61da('0x60')](_0x388aa7)[_0x61da('0x3e')](handleEntityNotFound(_0x45e1fc,null))[_0x61da('0x3e')](respondWithResult(_0x45e1fc,null))[_0x61da('0x30')](handleError(_0x45e1fc,null));};exports['create']=function(_0x1848f2,_0x276167){return db['OpenchannelAccount'][_0x61da('0x61')](_0x1848f2[_0x61da('0x62')],{})[_0x61da('0x3e')](function(_0x4f5f9d){var _0x24c8cd=_0x1848f2[_0x61da('0x63')]['get']({'plain':!![]});if(!_0x24c8cd)throw new Error(_0x61da('0x64'));if(_0x24c8cd[_0x61da('0x65')]===_0x61da('0x63')){var _0x3611cc=_0x4f5f9d[_0x61da('0x66')]({'plain':!![]});var _0x10a013=_0x61da('0x3f');return db[_0x61da('0x67')][_0x61da('0x60')]({'where':{'name':_0x10a013,'userProfileId':_0x24c8cd['userProfileId']},'raw':!![]})['then'](function(_0x2810b2){if(_0x2810b2&&_0x2810b2['autoAssociation']===0x0){return db[_0x61da('0x40')][_0x61da('0x61')]({'name':_0x3611cc[_0x61da('0x42')],'resourceId':_0x3611cc['id'],'type':_0x2810b2['name'],'sectionId':_0x2810b2['id']},{})['then'](function(){return _0x4f5f9d;});}else{return _0x4f5f9d;}})[_0x61da('0x30')](function(_0xed1c26){logger['error'](_0x61da('0x68'),_0xed1c26);throw _0xed1c26;});}return _0x4f5f9d;})[_0x61da('0x3e')](respondWithResult(_0x276167,0xc9))[_0x61da('0x30')](handleError(_0x276167,null));};exports[_0x61da('0x69')]=function(_0x15a783,_0x2bfbb8){if(_0x15a783[_0x61da('0x62')]['id']){delete _0x15a783[_0x61da('0x62')]['id'];}return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x15a783[_0x61da('0x6a')]['id']},'include':[{'model':db['Pause'],'as':_0x61da('0x44')}]})['then'](handleEntityNotFound(_0x2bfbb8,null))[_0x61da('0x3e')](saveUpdates(_0x15a783[_0x61da('0x62')],null))[_0x61da('0x3e')](respondWithResult(_0x2bfbb8,null))[_0x61da('0x30')](handleError(_0x2bfbb8,null));};exports[_0x61da('0x3d')]=function(_0x33db23,_0x15b8eb){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x33db23[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x15b8eb,null))[_0x61da('0x3e')](removeEntity(_0x15b8eb,null))[_0x61da('0x30')](handleError(_0x15b8eb,null));};exports['describe']=function(_0x4defc7,_0x39f994){return db[_0x61da('0x46')][_0x61da('0x6b')]()[_0x61da('0x3e')](respondWithResult(_0x39f994,null))[_0x61da('0x30')](handleError(_0x39f994,null));};exports[_0x61da('0x6c')]=function(_0x5a4c25,_0x5d48e4,_0x1da2c7){if(_0x5a4c25[_0x61da('0x62')]['id']){delete _0x5a4c25[_0x61da('0x62')]['id'];}return db[_0x61da('0x46')]['find']({'where':{'id':_0x5a4c25[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5d48e4,null))[_0x61da('0x3e')](function(_0x5517d4){if(_0x5517d4){_0x5a4c25['body'][_0x61da('0x6d')]=_0x5517d4['id'];return db['Disposition'][_0x61da('0x61')](_0x5a4c25['body']);}})[_0x61da('0x3e')](respondWithResult(_0x5d48e4,null))['catch'](handleError(_0x5d48e4,null));};exports['getDispositions']=function(_0x5ec656,_0x46433,_0x2a6640){var _0x53d832={'raw':![],'where':{}};var _0x1b9b76={};var _0x33db8d={'count':0x0,'rows':[]};return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x5ec656['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x46433,null))[_0x61da('0x3e')](function(_0x1255b2){if(_0x1255b2){_0x1b9b76['model']=_[_0x61da('0x4b')](db[_0x61da('0x6f')]['rawAttributes']);_0x1b9b76[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x5ec656['query']);_0x1b9b76[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x1b9b76['model'],_0x1b9b76[_0x61da('0x4a')]);_0x53d832[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x1b9b76[_0x61da('0x49')],qs['fields'](_0x5ec656[_0x61da('0x4a')][_0x61da('0x4e')]));_0x53d832['attributes']=_0x53d832[_0x61da('0x4d')][_0x61da('0x4f')]?_0x53d832[_0x61da('0x4d')]:_0x1b9b76['model'];if(!_0x5ec656[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x53d832[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x5ec656['query'][_0x61da('0x37')]);_0x53d832[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x5ec656[_0x61da('0x4a')][_0x61da('0x35')]);}_0x53d832['order']=qs[_0x61da('0x53')](_0x5ec656['query']['sort']);_0x53d832[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x5ec656['query'],_0x1b9b76['filters']));_0x53d832[_0x61da('0x54')][_0x61da('0x6d')]=_0x1255b2['id'];if(_0x5ec656[_0x61da('0x4a')]['filter']){_0x53d832[_0x61da('0x54')]=_[_0x61da('0x58')](_0x53d832[_0x61da('0x54')],{'$or':_['map'](_0x53d832[_0x61da('0x4d')],function(_0x348299){var _0x38dfe3={};_0x38dfe3[_0x348299]={'$like':'%'+_0x5ec656[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x38dfe3;})});}_0x53d832=_['merge']({},_0x53d832,_0x5ec656['options']);return db[_0x61da('0x6f')][_0x61da('0x38')]({'where':_0x53d832[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0xef593b){_0x33db8d[_0x61da('0x38')]=_0xef593b;if(_0x5ec656[_0x61da('0x4a')][_0x61da('0x5f')]){_0x53d832[_0x61da('0x5b')]=[{'all':!![]}];}return db[_0x61da('0x6f')][_0x61da('0x5c')](_0x53d832);})[_0x61da('0x3e')](function(_0x1c8d5f){_0x33db8d[_0x61da('0x5d')]=_0x1c8d5f;return _0x33db8d;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x46433,_0x53d832))[_0x61da('0x30')](handleError(_0x46433,null));};exports[_0x61da('0x70')]=function(_0x3adbb4,_0xc85dea,_0x5875d6){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x3adbb4['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0xc85dea,null))[_0x61da('0x3e')](function(_0x47a517){if(_0x47a517){return _0x47a517[_0x61da('0x70')](_0x3adbb4[_0x61da('0x4a')][_0x61da('0x71')]);}})[_0x61da('0x3e')](respondWithStatusCode(_0xc85dea,null))[_0x61da('0x30')](handleError(_0xc85dea,null));};exports['addAnswer']=function(_0x56710f,_0x5582fb,_0x25c284){if(_0x56710f[_0x61da('0x62')]['id']){delete _0x56710f['body']['id'];}return db[_0x61da('0x46')]['find']({'where':{'id':_0x56710f[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5582fb,null))[_0x61da('0x3e')](function(_0x4e9e19){if(_0x4e9e19){_0x56710f[_0x61da('0x62')][_0x61da('0x6d')]=_0x4e9e19['id'];return db[_0x61da('0x72')]['create'](_0x56710f[_0x61da('0x62')]);}})[_0x61da('0x3e')](respondWithResult(_0x5582fb,null))[_0x61da('0x30')](handleError(_0x5582fb,null));};exports[_0x61da('0x73')]=function(_0x57ca1a,_0x2f5f65,_0x112823){var _0x15213c={'raw':![],'where':{}};var _0xbec4ba={};var _0x36d20e={'count':0x0,'rows':[]};return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x57ca1a[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x2f5f65,null))[_0x61da('0x3e')](function(_0x1a1fac){if(_0x1a1fac){_0xbec4ba['model']=_[_0x61da('0x4b')](db[_0x61da('0x72')][_0x61da('0x5e')]);_0xbec4ba[_0x61da('0x4a')]=_['keys'](_0x57ca1a[_0x61da('0x4a')]);_0xbec4ba[_0x61da('0x55')]=_[_0x61da('0x4c')](_0xbec4ba[_0x61da('0x49')],_0xbec4ba[_0x61da('0x4a')]);_0x15213c['attributes']=_[_0x61da('0x4c')](_0xbec4ba[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x57ca1a[_0x61da('0x4a')][_0x61da('0x4e')]));_0x15213c[_0x61da('0x4d')]=_0x15213c[_0x61da('0x4d')][_0x61da('0x4f')]?_0x15213c[_0x61da('0x4d')]:_0xbec4ba['model'];if(!_0x57ca1a[_0x61da('0x4a')][_0x61da('0x50')]('nolimit')){_0x15213c[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x57ca1a['query']['limit']);_0x15213c[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x57ca1a['query'][_0x61da('0x35')]);}_0x15213c[_0x61da('0x52')]=qs['sort'](_0x57ca1a[_0x61da('0x4a')]['sort']);_0x15213c[_0x61da('0x54')]=qs[_0x61da('0x55')](_['pick'](_0x57ca1a[_0x61da('0x4a')],_0xbec4ba[_0x61da('0x55')]));_0x15213c[_0x61da('0x54')][_0x61da('0x6d')]=_0x1a1fac['id'];if(_0x57ca1a[_0x61da('0x4a')]['filter']){_0x15213c[_0x61da('0x54')]=_[_0x61da('0x58')](_0x15213c[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x15213c[_0x61da('0x4d')],function(_0x47cfa4){var _0x5245d6={};_0x5245d6[_0x47cfa4]={'$like':'%'+_0x57ca1a[_0x61da('0x4a')]['filter']+'%'};return _0x5245d6;})});}_0x15213c=_[_0x61da('0x58')]({},_0x15213c,_0x57ca1a[_0x61da('0x5a')]);return db[_0x61da('0x72')][_0x61da('0x38')]({'where':_0x15213c[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0x19752e){_0x36d20e[_0x61da('0x38')]=_0x19752e;if(_0x57ca1a[_0x61da('0x4a')][_0x61da('0x5f')]){_0x15213c[_0x61da('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x61da('0x5c')](_0x15213c);})[_0x61da('0x3e')](function(_0x2b3ca8){_0x36d20e[_0x61da('0x5d')]=_0x2b3ca8;return _0x36d20e;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x2f5f65,_0x15213c))[_0x61da('0x30')](handleError(_0x2f5f65,null));};exports[_0x61da('0x74')]=function(_0x3b8bb7,_0x4f9606,_0x1b3c06){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x3b8bb7[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4f9606,null))[_0x61da('0x3e')](function(_0x4be6db){if(_0x4be6db){return _0x4be6db['removeAnswers'](_0x3b8bb7[_0x61da('0x4a')][_0x61da('0x71')]);}})['then'](respondWithStatusCode(_0x4f9606,null))[_0x61da('0x30')](handleError(_0x4f9606,null));};exports[_0x61da('0x75')]=function(_0x229e78,_0x5a97b0,_0x43b64d){var _0x4d929c={'body':_0x229e78[_0x61da('0x62')],'channel':_0x61da('0x76')};var _0x43767c=[];var _0x4e2f9b=[];var _0x41531a={};var _0x4820b5=![];return db['CmContact'][_0x61da('0x6b')]()[_0x61da('0x3e')](function(_0x328748){if(!_0x328748){throw new db['Sequelize'][(_0x61da('0x77'))](_0x61da('0x78'));}_0x43767c=_[_0x61da('0x79')](_[_0x61da('0x4b')](_0x328748),['createdAt',_0x61da('0x7a')]);_0x4e2f9b=_[_0x61da('0x79')](_[_0x61da('0x4b')](_0x328748),['createdAt','updatedAt',_0x61da('0x7b'),_0x61da('0x7c')]);if(_0x229e78[_0x61da('0x62')]['id']){delete _0x229e78[_0x61da('0x62')]['id'];}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')]['from'])){throw new db[(_0x61da('0x7e'))]['ValidationError'](_0x61da('0x7f'));}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')][_0x61da('0x62')])||_0x229e78[_0x61da('0x62')][_0x61da('0x62')]===''){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))](_0x61da('0x80'));}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')]['mapKey'])){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))](_0x61da('0x81')+_0x4e2f9b);}if(!_[_0x61da('0x82')](_0x4e2f9b,_0x229e78[_0x61da('0x62')]['mapKey'])){throw new db[(_0x61da('0x7e'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e2f9b);}_0x41531a[_0x229e78['body']['mapKey']]=_0x229e78['body']['from'];})[_0x61da('0x3e')](function(){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x229e78['params']['id']},'include':[{'model':db['CmList'],'as':_0x61da('0x83'),'include':[{'model':db[_0x61da('0x84')],'as':'Contacts','where':_0x41531a,'limit':0x1,'order':[[_0x61da('0x7a'),_0x61da('0x85')]]}]},{'model':db[_0x61da('0x86')],'as':_0x61da('0x87')}]});})[_0x61da('0x3e')](handleEntityNotFound(_0x5a97b0,null))[_0x61da('0x3e')](function(_0x3f6dd8){if(_0x3f6dd8&&_0x3f6dd8[_0x61da('0x83')]){_0x4d929c['account']=_0x3f6dd8;_0x4d929c['applications']=_0x3f6dd8[_0x61da('0x87')];_0x4d929c[_0x61da('0x88')]=_0x3f6dd8[_0x61da('0x83')];_0x4d929c['applications']=_[_0x61da('0x89')](_0x4d929c[_0x61da('0x8a')],[_0x61da('0x8b')],['asc']);if(_0x4d929c[_0x61da('0x8c')][_0x61da('0x87')]){delete _0x4d929c[_0x61da('0x8c')][_0x61da('0x87')];}if(_0x4d929c['account'][_0x61da('0x83')]&&_0x4d929c[_0x61da('0x8c')][_0x61da('0x83')][_0x61da('0x8d')][_0x61da('0x4f')]){return _0x4d929c['account'][_0x61da('0x83')][_0x61da('0x8d')][0x0];}var _0x33ca12=_['defaults'](_0x229e78[_0x61da('0x62')],{'firstName':_0x229e78['body'][_0x61da('0x8e')],'ListId':_0x3f6dd8[_0x61da('0x7c')]});_0x33ca12[_0x229e78['body'][_0x61da('0x8f')]]=_0x229e78[_0x61da('0x62')]['from'];return db[_0x61da('0x84')][_0x61da('0x61')](_0x33ca12,{'fields':_0x43767c,'raw':!![]});}})['then'](handleEntityNotFound(_0x5a97b0,null))['then'](function(_0x4beba3){_0x4d929c[_0x61da('0x90')]=_0x4beba3;if(_0x4beba3){var _0x52f54f={'ContactId':_0x4beba3['id'],'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'from':(_0x4beba3[_0x61da('0x91')]||'')+'\x20'+(_0x4beba3['lastName']||'')};var _0x183e52={'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'closed':![]};if(_0x229e78[_0x61da('0x62')]['threadId']){_0x183e52['threadId']=_0x229e78[_0x61da('0x62')][_0x61da('0x92')];return db[_0x61da('0x93')][_0x61da('0x60')]({'where':_0x183e52})[_0x61da('0x3e')](function(_0x4ec65f){if(_0x4ec65f){return[_0x4ec65f,![]];}_0x52f54f[_0x61da('0x92')]=_0x229e78['body'][_0x61da('0x92')];_0x52f54f[_0x61da('0x94')]=_0x229e78['body']['externalUrl'];return db[_0x61da('0x93')][_0x61da('0x61')](_0x52f54f)[_0x61da('0x3e')](function(_0x55d738){return[_0x55d738,!![]];});});}else{_0x183e52[_0x61da('0x92')]=null;}_0x183e52['ContactId']=_0x4beba3['id'];return db[_0x61da('0x93')]['find']({'where':_0x183e52})['then'](function(_0x8933ef){if(_0x8933ef){return[_0x8933ef,![]];}return db[_0x61da('0x93')][_0x61da('0x61')](_0x52f54f)['then'](function(_0x2fa413){return[_0x2fa413,!![]];});});}})['spread'](function(_0x557459,_0x253a0f){if(_0x557459){_0x4820b5=_0x253a0f;if(!_0x253a0f){var _0xe03c7f={'from':(_0x4d929c['contact'][_0x61da('0x91')]||'')+'\x20'+(_0x4d929c[_0x61da('0x90')][_0x61da('0x95')]||'')};if(_0x229e78[_0x61da('0x62')][_0x61da('0x92')]&&_0x229e78[_0x61da('0x62')][_0x61da('0x96')]&&_0x229e78[_0x61da('0x62')][_0x61da('0x92')]!=_0x229e78[_0x61da('0x62')][_0x61da('0x96')]){_0xe03c7f['threadId']=_0x229e78[_0x61da('0x62')]['messageId'];}return _0x557459['update'](_0xe03c7f);}else{return _0x557459;}}})[_0x61da('0x3e')](function(_0x55ca3d){_0x4d929c['interaction']=_0x55ca3d[_0x61da('0x66')]({'plain':!![]});_0x4d929c['interaction']['created']=_0x4820b5;if(_0x4d929c[_0x61da('0x97')][_0x61da('0x98')]){if(_0x4d929c[_0x61da('0x8c')][_0x61da('0x99')]){_0x4d929c[_0x61da('0x8a')][_0x61da('0x9a')]({'id':0x0,'priority':_0x4d929c['applications'][_0x61da('0x4f')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x229e78[_0x61da('0x62')]['body'],'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'OpenchannelInteractionId':_0x55ca3d['id'],'direction':'in','ContactId':_0x4d929c['contact']['id'],'AttachmentId':_0x229e78[_0x61da('0x62')][_0x61da('0x9b')]});})[_0x61da('0x3e')](function(_0x5ad1e3){_0x4d929c['message']=_0x5ad1e3;if(_0x4d929c[_0x61da('0x97')]['UserId']){return db[_0x61da('0x9c')][_0x61da('0x60')]({'attributes':['id','name'],'where':{'id':_0x4d929c[_0x61da('0x97')][_0x61da('0x9d')]}})[_0x61da('0x3e')](function(_0x16e2b9){if(_0x16e2b9){_0x4d929c[_0x61da('0x8a')][_0x61da('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x16e2b9[_0x61da('0x42')]+','+(_0x4d929c['account'][_0x61da('0x9f')]||0xa),'interval':_0x61da('0xa0')});_0x4d929c['forcedOwnership']=![];}return respondWithRpcPromise(_0x61da('0xa1'),_0x61da('0xa2'),_0x4d929c);});}return respondWithRpcPromise('Start',_0x61da('0xa2'),_0x4d929c);})['then'](function(_0x1f3321){respondWithRpcPromise('EventManager',_0x61da('0xa3'),{'event':_0x61da('0x75'),'message':_0x1f3321},client9002);return _0x1f3321;})[_0x61da('0x3e')](respondWithResult(_0x5a97b0,null))[_0x61da('0x30')](handleError(_0x5a97b0,null));};exports[_0x61da('0xa4')]=function(_0x43dfec,_0x1fdb21){var _0x3d6f81=_0x43dfec['params']['id'];var _0x532038=_0x43dfec[_0x61da('0x62')];var _0x45ed96=0xc8;var _0xd1fb7f=null;return db[_0x61da('0xa5')][_0x61da('0xa6')]({'isolationLevel':db[_0x61da('0xa5')][_0x61da('0xa7')][_0x61da('0xa8')][_0x61da('0xa9')]},function(_0x4668c3){return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x3d6f81},'transaction':_0x4668c3})[_0x61da('0x3e')](function(_0x57938d){if(_0x57938d){return db[_0x61da('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x3d6f81},'transaction':_0x4668c3})['then'](function(){var _0x1fe80f=_['map'](_0x532038,function(_0x255730){_0x255730[_0x61da('0x6d')]=_0x3d6f81;return _0x255730;});return db['OpenchannelApplication'][_0x61da('0xaa')](_0x1fe80f,{'transaction':_0x4668c3});});}else{_0x45ed96=0x194;_0xd1fb7f=[];}});})['then'](function(){if(_0x45ed96!==0x194){return db['OpenchannelApplication'][_0x61da('0xab')]({'where':{'OpenchannelAccountId':_0x3d6f81},'order':'priority'})['then'](function(_0x34bf61){_0xd1fb7f=_0x34bf61;});}})[_0x61da('0x30')](function(_0x5abbe6){_0x45ed96=0x1f4;logger['error'](_0x5abbe6[_0x61da('0x41')]);if(_0x5abbe6['name']){delete _0x5abbe6[_0x61da('0x42')];}_0xd1fb7f=_0x5abbe6;})[_0x61da('0xac')](function(){if(_0xd1fb7f===null){_0x1fdb21[_0x61da('0x31')](_0x45ed96);}else{if(_0x45ed96===0x1f4){_0x1fdb21[_0x61da('0x32')](_0x45ed96)[_0x61da('0xad')](_0xd1fb7f);}else{_0x1fdb21[_0x61da('0x32')](_0x45ed96)[_0x61da('0x34')](_0xd1fb7f);}}});};exports[_0x61da('0xae')]=function(_0xf21843,_0x241d9a,_0x1239c8){var _0x484313={};var _0x460bc7={};var _0x3825a3;var _0x1b5303;return db['OpenchannelAccount'][_0x61da('0x6e')]({'where':{'id':_0xf21843[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x241d9a,null))[_0x61da('0x3e')](function(_0x12097b){if(_0x12097b){_0x3825a3=_0x12097b;_0x460bc7[_0x61da('0x49')]=_[_0x61da('0x4b')](db[_0x61da('0x86')][_0x61da('0x5e')]);_0x460bc7[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0xf21843['query']);_0x460bc7[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x460bc7[_0x61da('0x49')],_0x460bc7['query']);_0x484313[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x460bc7[_0x61da('0x49')],qs[_0x61da('0x4e')](_0xf21843['query']['fields']));_0x484313['attributes']=_0x484313[_0x61da('0x4d')][_0x61da('0x4f')]?_0x484313[_0x61da('0x4d')]:_0x460bc7[_0x61da('0x49')];_0x484313[_0x61da('0x52')]=qs[_0x61da('0x53')](_0xf21843[_0x61da('0x4a')][_0x61da('0x53')]);_0x484313[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0xf21843[_0x61da('0x4a')],_0x460bc7[_0x61da('0x55')]));if(_0xf21843[_0x61da('0x4a')]['filter']){_0x484313[_0x61da('0x54')]=_['merge'](_0x484313[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x484313[_0x61da('0x4d')],function(_0x375a72){var _0x142bd8={};_0x142bd8[_0x375a72]={'$like':'%'+_0xf21843['query']['filter']+'%'};return _0x142bd8;})});}_0x484313=_['merge']({},_0x484313,_0xf21843['options']);return _0x3825a3[_0x61da('0xae')](_0x484313);}})['then'](function(_0x408757){if(_0x408757){_0x1b5303=_0x408757[_0x61da('0x4f')];if(!_0xf21843[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x484313['limit']=qs['limit'](_0xf21843[_0x61da('0x4a')]['limit']);_0x484313[_0x61da('0x35')]=qs[_0x61da('0x35')](_0xf21843[_0x61da('0x4a')]['offset']);}return _0x3825a3[_0x61da('0xae')](_0x484313);}})[_0x61da('0x3e')](function(_0x28030f){if(_0x28030f){return _0x28030f?{'count':_0x1b5303,'rows':_0x28030f}:null;}})[_0x61da('0x3e')](respondWithResult(_0x241d9a,null))[_0x61da('0x30')](handleError(_0x241d9a,null));};exports[_0x61da('0xaf')]=function(_0x3eb2df,_0x78cf6,_0x5cc28d){var _0x3da12d={'raw':![],'where':{}};var _0x2f09d5={};var _0x37d3f3={'count':0x0,'rows':[]};return db[_0x61da('0x46')]['findOne']({'where':{'id':_0x3eb2df[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x78cf6,null))['then'](function(_0x3fc7b1){if(_0x3fc7b1){_0x2f09d5['model']=_[_0x61da('0x4b')](db[_0x61da('0x93')][_0x61da('0x5e')]);_0x2f09d5[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x3eb2df[_0x61da('0x4a')]);_0x2f09d5['filters']=_[_0x61da('0x4c')](_0x2f09d5[_0x61da('0x49')],_0x2f09d5['query']);_0x3da12d[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x2f09d5['model'],qs[_0x61da('0x4e')](_0x3eb2df[_0x61da('0x4a')][_0x61da('0x4e')]));_0x3da12d['attributes']=_0x3da12d[_0x61da('0x4d')][_0x61da('0x4f')]?_0x3da12d[_0x61da('0x4d')]:_0x2f09d5[_0x61da('0x49')];if(!_0x3eb2df[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x3da12d[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x3eb2df[_0x61da('0x4a')][_0x61da('0x37')]);_0x3da12d[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x3eb2df[_0x61da('0x4a')]['offset']);}_0x3da12d[_0x61da('0x52')]=qs[_0x61da('0x53')](_0x3eb2df['query'][_0x61da('0x53')]);_0x3da12d[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x3eb2df[_0x61da('0x4a')],_0x2f09d5[_0x61da('0x55')]));_0x3da12d[_0x61da('0x54')][_0x61da('0x6d')]=_0x3fc7b1['id'];if(_0x3eb2df[_0x61da('0x4a')][_0x61da('0x57')]){_0x3da12d[_0x61da('0x54')]=_[_0x61da('0x58')](_0x3da12d[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x3da12d[_0x61da('0x4d')],function(_0x526091){var _0xbe9422={};_0xbe9422[_0x526091]={'$like':'%'+_0x3eb2df['query'][_0x61da('0x57')]+'%'};return _0xbe9422;})});}_0x3da12d=_['merge']({},_0x3da12d,_0x3eb2df['options']);return db[_0x61da('0x93')][_0x61da('0x38')]({'where':_0x3da12d[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0x59f683){_0x37d3f3['count']=_0x59f683;if(_0x3eb2df['query'][_0x61da('0x5f')]){_0x3da12d[_0x61da('0x5b')]=[{'model':db[_0x61da('0x84')],'as':'Contact','required':![]},{'model':db[_0x61da('0x9c')],'as':'Owner','attributes':[_0x61da('0x42'),'fullname','internal'],'required':![]},{'model':db[_0x61da('0xb0')],'as':_0x61da('0xb1'),'attributes':['id',_0x61da('0x42'),'color'],'where':_0x3eb2df[_0x61da('0x4a')][_0x61da('0xb2')]?{'id':_0x3eb2df[_0x61da('0x4a')]['tag']}:undefined,'required':_0x3eb2df['query'][_0x61da('0xb2')]?!![]:![]}];}return db[_0x61da('0x93')]['findAll'](_0x3da12d);})[_0x61da('0x3e')](function(_0x5138f5){_0x37d3f3[_0x61da('0x5d')]=_0x5138f5;return _0x37d3f3;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x78cf6,_0x3da12d))[_0x61da('0x30')](handleError(_0x78cf6,null));};exports[_0x61da('0xb3')]=function(_0x5a865a,_0x21b4e1,_0x58ca09){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x5a865a[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x21b4e1,null))[_0x61da('0x3e')](function(_0xd19c25){if(_0xd19c25){return _0xd19c25[_0x61da('0xb3')](_0x5a865a['body']['ids'],_[_0x61da('0xb4')](_0x5a865a[_0x61da('0x62')],['ids','id'])||{})['spread'](function(_0x11414b){for(var _0x2bbaa5=0x0;_0x2bbaa5<_0x5a865a[_0x61da('0x62')][_0x61da('0x71')][_0x61da('0x4f')];_0x2bbaa5+=0x1){socket[_0x61da('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x5a865a[_0x61da('0x62')][_0x61da('0x71')][_0x2bbaa5]),'OpenchannelAccountId':Number(_0x5a865a[_0x61da('0x6a')]['id'])});}return _0x11414b;});}})['then'](respondWithResult(_0x21b4e1,null))[_0x61da('0x30')](handleError(_0x21b4e1,null));};exports[_0x61da('0xb6')]=function(_0x495286,_0x2d7247,_0x3320c6){return db[_0x61da('0x46')]['find']({'where':{'id':_0x495286['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x2d7247,null))[_0x61da('0x3e')](function(_0x8a904c){if(_0x8a904c){return _0x8a904c[_0x61da('0xb6')](_0x495286[_0x61da('0x4a')][_0x61da('0x71')])[_0x61da('0x3e')](function(){if(_['isArray'](_0x495286[_0x61da('0x4a')][_0x61da('0x71')])){for(var _0x4ec5a4=0x0;_0x4ec5a4<_0x495286['query'][_0x61da('0x71')][_0x61da('0x4f')];_0x4ec5a4+=0x1){socket[_0x61da('0xb5')](_0x61da('0xb7'),{'UserId':Number(_0x495286['query'][_0x61da('0x71')][_0x4ec5a4]),'OpenchannelAccountId':Number(_0x495286[_0x61da('0x6a')]['id'])});}}else{socket[_0x61da('0xb5')](_0x61da('0xb7'),{'UserId':Number(_0x495286[_0x61da('0x4a')][_0x61da('0x71')]),'OpenchannelAccountId':Number(_0x495286[_0x61da('0x6a')]['id'])});}});}})[_0x61da('0x3e')](respondWithStatusCode(_0x2d7247,null))[_0x61da('0x30')](handleError(_0x2d7247,null));};exports[_0x61da('0xb8')]=function(_0x7a7940,_0x4f5638,_0x56856d){var _0x4f50b0={};var _0x230f03={};var _0x14c7bd;var _0x2c77ab;return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x7a7940[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x4f5638,null))['then'](function(_0x16a8bc){if(_0x16a8bc){_0x14c7bd=_0x16a8bc;_0x230f03[_0x61da('0x49')]=_[_0x61da('0x4b')](db['User'][_0x61da('0x5e')]);_0x230f03[_0x61da('0x4a')]=_['keys'](_0x7a7940[_0x61da('0x4a')]);_0x230f03[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x230f03[_0x61da('0x49')],_0x230f03['query']);_0x4f50b0[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x230f03[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x7a7940[_0x61da('0x4a')][_0x61da('0x4e')]));_0x4f50b0[_0x61da('0x4d')]=_0x4f50b0[_0x61da('0x4d')][_0x61da('0x4f')]?_0x4f50b0['attributes']:_0x230f03[_0x61da('0x49')];_0x4f50b0[_0x61da('0x52')]=qs[_0x61da('0x53')](_0x7a7940['query'][_0x61da('0x53')]);_0x4f50b0['where']=qs['filters'](_[_0x61da('0x56')](_0x7a7940[_0x61da('0x4a')],_0x230f03['filters']));if(_0x7a7940[_0x61da('0x4a')][_0x61da('0x57')]){_0x4f50b0[_0x61da('0x54')]=_['merge'](_0x4f50b0[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x4f50b0[_0x61da('0x4d')],function(_0x360525){var _0x293e2e={};_0x293e2e[_0x360525]={'$like':'%'+_0x7a7940[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x293e2e;})});}_0x4f50b0=_[_0x61da('0x58')]({},_0x4f50b0,_0x7a7940[_0x61da('0x5a')]);return _0x14c7bd[_0x61da('0xb8')](_0x4f50b0);}})['then'](function(_0x4108b9){if(_0x4108b9){_0x2c77ab=_0x4108b9['length'];if(!_0x7a7940[_0x61da('0x4a')][_0x61da('0x50')](_0x61da('0x51'))){_0x4f50b0['limit']=qs['limit'](_0x7a7940[_0x61da('0x4a')][_0x61da('0x37')]);_0x4f50b0[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x7a7940[_0x61da('0x4a')][_0x61da('0x35')]);}return _0x14c7bd[_0x61da('0xb8')](_0x4f50b0);}})['then'](function(_0x221945){if(_0x221945){return _0x221945?{'count':_0x2c77ab,'rows':_0x221945}:null;}})['then'](respondWithResult(_0x4f5638,null))[_0x61da('0x30')](handleError(_0x4f5638,null));};exports[_0x61da('0xad')]=function(_0x35c056,_0x3fb1dc,_0x4b5782){var _0x2b0a97,_0x5effa3,_0x4e8018;if(_[_0x61da('0x7d')](_0x35c056['body'][_0x61da('0x62')])||_0x35c056[_0x61da('0x62')][_0x61da('0x62')]===''){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x61da('0x7d')](_0x35c056[_0x61da('0x62')]['to'])){}_0x2b0a97=_0x35c056[_0x61da('0x62')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x35c056[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))[_0x61da('0x3e')](function(_0x29c008){if(_0x29c008){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x29c008['id']},'include':[{'model':db[_0x61da('0xb9')],'as':'List','include':[{'model':db[_0x61da('0x84')],'as':'Contacts','where':{[_0x29c008[_0x61da('0x8f')]]:_0x2b0a97},'limit':0x1,'order':[['updatedAt',_0x61da('0x85')]]}]}]})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))['then'](function(_0x50ab4a){if(_0x50ab4a&&_0x50ab4a['List']){_0x5effa3=_0x50ab4a[_0x61da('0x66')]({'plain':!![]});if(_0x5effa3[_0x61da('0x83')]&&_0x5effa3[_0x61da('0x83')][_0x61da('0x8d')][_0x61da('0x4f')]){return _0x5effa3[_0x61da('0x83')][_0x61da('0x8d')][0x0];}return db[_0x61da('0x84')][_0x61da('0x61')](_[_0x61da('0x20')](_0x35c056[_0x61da('0x62')],{'firstName':_0x2b0a97,[_0x50ab4a[_0x61da('0x8f')]]:_0x2b0a97,'phone':_0x2b0a97,'ListId':_0x5effa3[_0x61da('0x7c')]}));}})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))[_0x61da('0x3e')](function(_0x2ebf79){if(_0x2ebf79){_0x4e8018=_0x2ebf79;return db[_0x61da('0x93')][_0x61da('0x60')]({'where':{'ContactId':_0x4e8018['id'],'closed':![],'OpenchannelAccountId':_0x5effa3['id']}})[_0x61da('0x3e')](function(_0x44acec){if(_0x44acec){return[_0x44acec,![]];}return db[_0x61da('0x93')][_0x61da('0x61')]({'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id'],'OpenchannelAccountId':_0x5effa3['id'],'lastMsgDirection':_0x61da('0xba'),'firstMsgDirection':'out','Messages':[_[_0x61da('0x58')](_0x35c056['body'],{'read':![],'body':_0x35c056[_0x61da('0x62')][_0x61da('0x62')],'OpenchannelAccountId':_0x5effa3['id'],'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id']})]},{'include':[{'model':db[_0x61da('0xbb')],'as':_0x61da('0xbc')}]})[_0x61da('0x3e')](function(_0x5138af){return[_0x5138af,!![]];});});}})['spread'](function(_0x5001ce,_0x10ddc4){if(_0x10ddc4){return _0x5001ce;}return db[_0x61da('0xbb')][_0x61da('0x61')](_[_0x61da('0x58')](_0x35c056[_0x61da('0x62')],{'read':![],'body':_0x35c056['body'][_0x61da('0x62')],'OpenchannelAccountId':_0x5effa3['id'],'OpenchannelInteractionId':_0x5001ce['id'],'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id']}))['then'](function(_0x505347){_0x5001ce[_0x61da('0xbd')][_0x61da('0xbc')]=[];_0x5001ce[_0x61da('0xbd')][_0x61da('0xbc')][_0x61da('0x9a')](_0x505347[_0x61da('0xbd')]);return _0x5001ce;});});}})[_0x61da('0x3e')](respondWithResult(_0x3fb1dc,null))[_0x61da('0x30')](handleError(_0x3fb1dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d99506e..b2bc34c 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4a5760,_0x134c15){var _0x2994b=function(_0x9c3df8){while(--_0x9c3df8){_0x4a5760['push'](_0x4a5760['shift']());}};_0x2994b(++_0x134c15);}(_0x3c81,0x102));var _0x13c8=function(_0x26eec1,_0xce858d){_0x26eec1=_0x26eec1-0x0;var _0x1089bb=_0x3c81[_0x26eec1];return _0x1089bb;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x748003,_0x564d6a){var _0xb64054=function(_0x540957){while(--_0x540957){_0x748003['push'](_0x748003['shift']());}};_0xb64054(++_0x564d6a);}(_0x9348,0x10d));var _0x8934=function(_0x3f9eae,_0x42496b){_0x3f9eae=_0x3f9eae-0x0;var _0x26a492=_0x9348[_0x3f9eae];return _0x26a492;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 743a910..ca17fcf 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(_0x4da700,_0x3d4afb){var _0x567dc0=function(_0x528a2d){while(--_0x528a2d){_0x4da700['push'](_0x4da700['shift']());}};_0x567dc0(++_0x3d4afb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0xf84edc,_0x49f101){var _0x12c592=function(_0x4ee470){while(--_0x4ee470){_0xf84edc['push'](_0xf84edc['shift']());}};_0x12c592(++_0x49f101);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 bffde9c..c0d13a9 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 _0xa571=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x18a9f3,_0x2717ce){var _0x3d065b=function(_0x3306c6){while(--_0x3306c6){_0x18a9f3['push'](_0x18a9f3['shift']());}};_0x3d065b(++_0x2717ce);}(_0xa571,0x107));var _0x1a57=function(_0x12c09c,_0x21172c){_0x12c09c=_0x12c09c-0x0;var _0x8df49e=_0xa571[_0x12c09c];return _0x8df49e;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});config[_0x1a57('0xa')]=_[_0x1a57('0xb')](config[_0x1a57('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a57('0xc'))(new Redis(config[_0x1a57('0xa')]));require(_0x1a57('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c8182,_0x1f7086,_0x4740ef){return new BPromise(function(_0x289dc0,_0x831937){return client[_0x1a57('0xe')](_0x3c8182,_0x4740ef)[_0x1a57('0xf')](function(_0x22c683){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1f7086,_0x1a57('0x10'));logger[_0x1a57('0x11')](_0x1a57('0x12'),_0x1f7086,'request\x20sent',JSON[_0x1a57('0x13')](_0x22c683));if(_0x22c683[_0x1a57('0x14')]){if(_0x22c683['error'][_0x1a57('0x15')]===0x1f4){logger['error'](_0x1a57('0x16'),_0x1f7086,_0x22c683[_0x1a57('0x14')][_0x1a57('0x17')]);return _0x831937(_0x22c683[_0x1a57('0x14')]['message']);}logger[_0x1a57('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f7086,_0x22c683['error'][_0x1a57('0x17')]);return _0x289dc0(_0x22c683[_0x1a57('0x14')][_0x1a57('0x17')]);}else{logger['info'](_0x1a57('0x16'),_0x1f7086,_0x1a57('0x10'));_0x289dc0(_0x22c683[_0x1a57('0x18')]['message']);}})[_0x1a57('0x19')](function(_0x4262c8){logger[_0x1a57('0x14')](_0x1a57('0x16'),_0x1f7086,_0x4262c8);_0x831937(_0x4262c8);});});} \ No newline at end of file +var _0xeb74=['request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register'];(function(_0xe38937,_0x54458d){var _0x3c912e=function(_0x3ef720){while(--_0x3ef720){_0xe38937['push'](_0xe38937['shift']());}};_0x3c912e(++_0x54458d);}(_0xeb74,0xe3));var _0x4eb7=function(_0x4d690b,_0x4aa5f8){_0x4d690b=_0x4d690b-0x0;var _0x3552aa=_0xeb74[_0x4d690b];return _0x3552aa;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});config[_0x4eb7('0xc')]=_['defaults'](config[_0x4eb7('0xc')],{'host':_0x4eb7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4eb7('0xe'))[_0x4eb7('0xf')](socket);function respondWithRpcPromise(_0x4b3add,_0xa72e98,_0x4ff98e){return new BPromise(function(_0x3326cd,_0x462392){return client[_0x4eb7('0x10')](_0x4b3add,_0x4ff98e)['then'](function(_0x2b32be){logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));logger[_0x4eb7('0x14')](_0x4eb7('0x15'),_0xa72e98,_0x4eb7('0x13'),JSON['stringify'](_0x2b32be));if(_0x2b32be['error']){if(_0x2b32be['error'][_0x4eb7('0x16')]===0x1f4){logger['error'](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x462392(_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);}logger[_0x4eb7('0x17')](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x3326cd(_0x2b32be[_0x4eb7('0x17')]['message']);}else{logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));_0x3326cd(_0x2b32be[_0x4eb7('0x19')][_0x4eb7('0x18')]);}})[_0x4eb7('0x1a')](function(_0x2d0ea7){logger[_0x4eb7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xa72e98,_0x2d0ea7);_0x462392(_0x2d0ea7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2471a6d..fc3f096 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 _0xf403=['emit','length','./openchannelAccount.events','remove','update'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf403,0x1d3));var _0x3f40=function(_0x51bd8e,_0x2cc5c6){_0x51bd8e=_0x51bd8e-0x0;var _0x33be4b=_0xf403[_0x51bd8e];return _0x33be4b;};'use strict';var OpenchannelAccountEvents=require(_0x3f40('0x0'));var events=['save',_0x3f40('0x1'),_0x3f40('0x2')];function createListener(_0x10940e,_0x3b40ca){return function(_0x3a8288){_0x3b40ca[_0x3f40('0x3')](_0x10940e,_0x3a8288);};}function removeListener(_0x354916,_0x303209){return function(){OpenchannelAccountEvents['removeListener'](_0x354916,_0x303209);};}exports['register']=function(_0x33f742){for(var _0x22d5e6=0x0,_0x24fb9e=events[_0x3f40('0x4')];_0x22d5e6<_0x24fb9e;_0x22d5e6++){var _0x5878f9=events[_0x22d5e6];var _0x1dffe8=createListener('openchannelAccount:'+_0x5878f9,_0x33f742);OpenchannelAccountEvents['on'](_0x5878f9,_0x1dffe8);}}; \ No newline at end of file +var _0x98e1=['update','removeListener','register','length','save','remove'];(function(_0x383658,_0x1cea99){var _0x26bfc7=function(_0x21b697){while(--_0x21b697){_0x383658['push'](_0x383658['shift']());}};_0x26bfc7(++_0x1cea99);}(_0x98e1,0x160));var _0x198e=function(_0x271e08,_0x52189a){_0x271e08=_0x271e08-0x0;var _0x4d4eca=_0x98e1[_0x271e08];return _0x4d4eca;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x198e('0x0'),_0x198e('0x1'),_0x198e('0x2')];function createListener(_0x1d1f36,_0x53fd68){return function(_0x300c4b){_0x53fd68['emit'](_0x1d1f36,_0x300c4b);};}function removeListener(_0x4a102f,_0x3bd989){return function(){OpenchannelAccountEvents[_0x198e('0x3')](_0x4a102f,_0x3bd989);};}exports[_0x198e('0x4')]=function(_0x317209){for(var _0x551d31=0x0,_0x545114=events[_0x198e('0x5')];_0x551d31<_0x545114;_0x551d31++){var _0x4d45d6=events[_0x551d31];var _0x3322c5=createListener('openchannelAccount:'+_0x4d45d6,_0x317209);OpenchannelAccountEvents['on'](_0x4d45d6,_0x3322c5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9987d08..665fe1c 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 _0xf54e=['multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','put','/:id','update','destroy','exports'];(function(_0x2e5c24,_0x39c23d){var _0x3f0ab1=function(_0x305166){while(--_0x305166){_0x2e5c24['push'](_0x2e5c24['shift']());}};_0x3f0ab1(++_0x39c23d);}(_0xf54e,0x16c));var _0xef54=function(_0xde9059,_0x750aab){_0xde9059=_0xde9059-0x0;var _0x23197d=_0xf54e[_0xde9059];return _0x23197d;};'use strict';var multer=require(_0xef54('0x0'));var util=require('util');var path=require(_0xef54('0x1'));var timeout=require(_0xef54('0x2'));var express=require('express');var router=express[_0xef54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef54('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xef54('0x5'));var controller=require('./openchannelApplication.controller');router[_0xef54('0x6')]('/',auth[_0xef54('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xef54('0x8')]);router['post']('/',auth[_0xef54('0x7')](),controller['create']);router[_0xef54('0x9')](_0xef54('0xa'),auth[_0xef54('0x7')](),controller[_0xef54('0xb')]);router['delete'](_0xef54('0xa'),auth[_0xef54('0x7')](),controller[_0xef54('0xc')]);module[_0xef54('0xd')]=router; \ No newline at end of file +var _0x637d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','update','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x462853,_0x4b7272){var _0x27ca60=function(_0xaef816){while(--_0xaef816){_0x462853['push'](_0x462853['shift']());}};_0x27ca60(++_0x4b7272);}(_0x637d,0x181));var _0xd637=function(_0x371f3b,_0x4329cc){_0x371f3b=_0x371f3b-0x0;var _0x31287c=_0x637d[_0x371f3b];return _0x31287c;};'use strict';var multer=require('multer');var util=require(_0xd637('0x0'));var path=require(_0xd637('0x1'));var timeout=require(_0xd637('0x2'));var express=require(_0xd637('0x3'));var router=express[_0xd637('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd637('0x5'));var interaction=require(_0xd637('0x6'));var config=require(_0xd637('0x7'));var controller=require('./openchannelApplication.controller');router[_0xd637('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd637('0x8')]('/:id',auth[_0xd637('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd637('0xa')]);router[_0xd637('0xb')]('/:id',auth[_0xd637('0x9')](),controller[_0xd637('0xc')]);router['delete'](_0xd637('0xd'),auth[_0xd637('0x9')](),controller['destroy']);module[_0xd637('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 35654da..fc98e5d 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 _0xb4ad=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4ad,0x138));var _0xdb4a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb4ad[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdb4a('0x0')]={'priority':{'type':Sequelize[_0xdb4a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb4a('0x2')},'appdata':{'type':Sequelize[_0xdb4a('0x3')]()},'description':{'type':Sequelize[_0xdb4a('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdb4a('0x5')}}; \ No newline at end of file +var _0xabde=['*,*,*,*','exports','INTEGER','noop','STRING'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0xabde,0x1c3));var _0xeabd=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xabde[_0x350aeb];return _0x3c5273;};'use strict';var Sequelize=require('sequelize');module[_0xeabd('0x0')]={'priority':{'type':Sequelize[_0xeabd('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xeabd('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeabd('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 4a3420b..95b848d 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 _0xae79=['status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xae79,0x1af));var _0x9ae7=function(_0x264213,_0x5044fd){_0x264213=_0x264213-0x0;var _0x32aa8b=_0xae79[_0x264213];return _0x32aa8b;};'use strict';var emlformat=require(_0x9ae7('0x0'));var rimraf=require(_0x9ae7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ae7('0x2'));var rp=require(_0x9ae7('0x3'));var moment=require('moment');var BPromise=require(_0x9ae7('0x4'));var Mustache=require(_0x9ae7('0x5'));var util=require('util');var path=require(_0x9ae7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ae7('0x7'));var _=require(_0x9ae7('0x8'));var squel=require(_0x9ae7('0x9'));var crypto=require(_0x9ae7('0xa'));var jsforce=require(_0x9ae7('0xb'));var deskjs=require(_0x9ae7('0xc'));var toCsv=require(_0x9ae7('0xd'));var querystring=require(_0x9ae7('0xe'));var Papa=require(_0x9ae7('0xf'));var Redis=require('ioredis');var authService=require(_0x9ae7('0x10'));var qs=require(_0x9ae7('0x11'));var as=require(_0x9ae7('0x12'));var hardwareService=require(_0x9ae7('0x13'));var logger=require(_0x9ae7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9ae7('0x15'));var licenseUtil=require(_0x9ae7('0x16'));var db=require(_0x9ae7('0x17'))['db'];function respondWithStatusCode(_0x3e124e,_0x9644e8){_0x9644e8=_0x9644e8||0xcc;return function(_0x1d7cab){if(_0x1d7cab){return _0x3e124e[_0x9ae7('0x18')](_0x9644e8);}return _0x3e124e['status'](_0x9644e8)['end']();};}function respondWithResult(_0xcbafab,_0x35e6d1){_0x35e6d1=_0x35e6d1||0xc8;return function(_0xcdfbf2){if(_0xcdfbf2){return _0xcbafab[_0x9ae7('0x19')](_0x35e6d1)[_0x9ae7('0x1a')](_0xcdfbf2);}};}function respondWithFilteredResult(_0x4c2579,_0x5dcea7){return function(_0x37c8dd){if(_0x37c8dd){var _0x40e3ab=typeof _0x5dcea7[_0x9ae7('0x1b')]===_0x9ae7('0x1c')&&typeof _0x5dcea7['limit']===_0x9ae7('0x1c');var _0xd3b281=_0x37c8dd[_0x9ae7('0x1d')];var _0x175bcd=_0x40e3ab?0x0:_0x5dcea7['offset'];var _0x2fd67a=_0x40e3ab?_0x37c8dd['count']:_0x5dcea7['offset']+_0x5dcea7[_0x9ae7('0x1e')];var _0x23c6b1;if(_0x2fd67a>=_0xd3b281){_0x2fd67a=_0xd3b281;_0x23c6b1=0xc8;}else{_0x23c6b1=0xce;}_0x4c2579[_0x9ae7('0x19')](_0x23c6b1);return _0x4c2579[_0x9ae7('0x1f')](_0x9ae7('0x20'),_0x175bcd+'-'+_0x2fd67a+'/'+_0xd3b281)[_0x9ae7('0x1a')](_0x37c8dd);}return null;};}function patchUpdates(_0xfa6581){return function(_0x40c775){try{jsonpatch[_0x9ae7('0x21')](_0x40c775,_0xfa6581,!![]);}catch(_0x88a739){return BPromise['reject'](_0x88a739);}return _0x40c775[_0x9ae7('0x22')]();};}function saveUpdates(_0x353031,_0x4cbd8d){return function(_0x1e3605){if(_0x1e3605){return _0x1e3605[_0x9ae7('0x23')](_0x353031)['then'](function(_0x7904d){return _0x7904d;});}return null;};}function removeEntity(_0x5c1946,_0x1952a8){return function(_0x4e9e6a){if(_0x4e9e6a){return _0x4e9e6a[_0x9ae7('0x24')]()[_0x9ae7('0x25')](function(){_0x5c1946[_0x9ae7('0x19')](0xcc)[_0x9ae7('0x26')]();});}};}function handleEntityNotFound(_0x275b9b,_0x22f275){return function(_0xdecb03){if(!_0xdecb03){_0x275b9b['sendStatus'](0x194);}return _0xdecb03;};}function handleError(_0x3c0329,_0x269eb4){_0x269eb4=_0x269eb4||0x1f4;return function(_0x462195){logger[_0x9ae7('0x27')](_0x462195[_0x9ae7('0x28')]);if(_0x462195['name']){delete _0x462195[_0x9ae7('0x29')];}_0x3c0329[_0x9ae7('0x19')](_0x269eb4)['send'](_0x462195);};}exports[_0x9ae7('0x2a')]=function(_0x566b54,_0x4d74cd){var _0x15f4c1={},_0x3c6f7a={},_0x353cb5={'count':0x0,'rows':[]};var _0x150651=_[_0x9ae7('0x2b')](db[_0x9ae7('0x2c')][_0x9ae7('0x2d')],function(_0x16e3ec){return{'name':_0x16e3ec[_0x9ae7('0x2e')],'type':_0x16e3ec['type'][_0x9ae7('0x2f')]};});_0x3c6f7a[_0x9ae7('0x30')]=_[_0x9ae7('0x2b')](_0x150651,_0x9ae7('0x29'));_0x3c6f7a['query']=_['keys'](_0x566b54[_0x9ae7('0x31')]);_0x3c6f7a['filters']=_[_0x9ae7('0x32')](_0x3c6f7a['model'],_0x3c6f7a['query']);_0x15f4c1[_0x9ae7('0x33')]=_['intersection'](_0x3c6f7a[_0x9ae7('0x30')],qs[_0x9ae7('0x34')](_0x566b54[_0x9ae7('0x31')]['fields']));_0x15f4c1[_0x9ae7('0x33')]=_0x15f4c1['attributes']['length']?_0x15f4c1[_0x9ae7('0x33')]:_0x3c6f7a[_0x9ae7('0x30')];if(!_0x566b54[_0x9ae7('0x31')][_0x9ae7('0x35')](_0x9ae7('0x36'))){_0x15f4c1['limit']=qs['limit'](_0x566b54[_0x9ae7('0x31')][_0x9ae7('0x1e')]);_0x15f4c1['offset']=qs[_0x9ae7('0x1b')](_0x566b54['query'][_0x9ae7('0x1b')]);}_0x15f4c1[_0x9ae7('0x37')]=qs['sort'](_0x566b54['query'][_0x9ae7('0x38')]);_0x15f4c1[_0x9ae7('0x39')]=qs[_0x9ae7('0x3a')](_[_0x9ae7('0x3b')](_0x566b54[_0x9ae7('0x31')],_0x3c6f7a[_0x9ae7('0x3a')]),_0x150651);if(_0x566b54[_0x9ae7('0x31')]['filter']){_0x15f4c1[_0x9ae7('0x39')]=_[_0x9ae7('0x3c')](_0x15f4c1['where'],{'$or':_[_0x9ae7('0x2b')](_0x150651,function(_0x4eb4a6){if(_0x4eb4a6['type']!==_0x9ae7('0x3d')){var _0x2782e0={};_0x2782e0[_0x4eb4a6[_0x9ae7('0x29')]]={'$like':'%'+_0x566b54[_0x9ae7('0x31')][_0x9ae7('0x3e')]+'%'};return _0x2782e0;}})});}_0x15f4c1=_[_0x9ae7('0x3c')]({},_0x15f4c1,_0x566b54['options']);var _0x3aea13={'where':_0x15f4c1[_0x9ae7('0x39')]};return db['OpenchannelApplication']['count'](_0x3aea13)['then'](function(_0x10071c){_0x353cb5[_0x9ae7('0x1d')]=_0x10071c;if(_0x566b54[_0x9ae7('0x31')][_0x9ae7('0x3f')]){_0x15f4c1[_0x9ae7('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9ae7('0x41')](_0x15f4c1);})[_0x9ae7('0x25')](function(_0x568b40){_0x353cb5[_0x9ae7('0x42')]=_0x568b40;return _0x353cb5;})[_0x9ae7('0x25')](respondWithFilteredResult(_0x4d74cd,_0x15f4c1))[_0x9ae7('0x43')](handleError(_0x4d74cd,null));};exports[_0x9ae7('0x44')]=function(_0x15c4d0,_0x43719b){var _0x5becef={'raw':!![],'where':{'id':_0x15c4d0['params']['id']}},_0x1e4612={};_0x1e4612['model']=_[_0x9ae7('0x45')](db[_0x9ae7('0x2c')]['rawAttributes']);_0x1e4612[_0x9ae7('0x31')]=_[_0x9ae7('0x45')](_0x15c4d0[_0x9ae7('0x31')]);_0x1e4612[_0x9ae7('0x3a')]=_['intersection'](_0x1e4612['model'],_0x1e4612[_0x9ae7('0x31')]);_0x5becef['attributes']=_[_0x9ae7('0x32')](_0x1e4612[_0x9ae7('0x30')],qs[_0x9ae7('0x34')](_0x15c4d0[_0x9ae7('0x31')][_0x9ae7('0x34')]));_0x5becef[_0x9ae7('0x33')]=_0x5becef['attributes'][_0x9ae7('0x46')]?_0x5becef[_0x9ae7('0x33')]:_0x1e4612[_0x9ae7('0x30')];if(_0x15c4d0[_0x9ae7('0x31')][_0x9ae7('0x3f')]){_0x5becef[_0x9ae7('0x40')]=[{'all':!![]}];}_0x5becef=_[_0x9ae7('0x3c')]({},_0x5becef,_0x15c4d0[_0x9ae7('0x47')]);return db[_0x9ae7('0x2c')][_0x9ae7('0x48')](_0x5becef)[_0x9ae7('0x25')](handleEntityNotFound(_0x43719b,null))[_0x9ae7('0x25')](respondWithResult(_0x43719b,null))['catch'](handleError(_0x43719b,null));};exports[_0x9ae7('0x49')]=function(_0x218383,_0x180038){return db[_0x9ae7('0x2c')][_0x9ae7('0x49')](_0x218383[_0x9ae7('0x4a')],{})['then'](respondWithResult(_0x180038,0xc9))[_0x9ae7('0x43')](handleError(_0x180038,null));};exports[_0x9ae7('0x23')]=function(_0x46f52c,_0x3e5d29){if(_0x46f52c[_0x9ae7('0x4a')]['id']){delete _0x46f52c['body']['id'];}return db[_0x9ae7('0x2c')][_0x9ae7('0x48')]({'where':{'id':_0x46f52c[_0x9ae7('0x4b')]['id']}})[_0x9ae7('0x25')](handleEntityNotFound(_0x3e5d29,null))[_0x9ae7('0x25')](saveUpdates(_0x46f52c['body'],null))[_0x9ae7('0x25')](respondWithResult(_0x3e5d29,null))['catch'](handleError(_0x3e5d29,null));};exports[_0x9ae7('0x24')]=function(_0x446f0a,_0x1b2cf9){return db[_0x9ae7('0x2c')]['find']({'where':{'id':_0x446f0a[_0x9ae7('0x4b')]['id']}})[_0x9ae7('0x25')](handleEntityNotFound(_0x1b2cf9,null))[_0x9ae7('0x25')](removeEntity(_0x1b2cf9,null))[_0x9ae7('0x43')](handleError(_0x1b2cf9,null));}; \ No newline at end of file +var _0xb00f=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4967d5,_0x1f9943){var _0x2d7559=function(_0x447936){while(--_0x447936){_0x4967d5['push'](_0x4967d5['shift']());}};_0x2d7559(++_0x1f9943);}(_0xb00f,0x111));var _0xfb00=function(_0x28cc72,_0x2c0643){_0x28cc72=_0x28cc72-0x0;var _0xed74ab=_0xb00f[_0x28cc72];return _0xed74ab;};'use strict';var emlformat=require(_0xfb00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb00('0x1'));var rp=require(_0xfb00('0x2'));var moment=require(_0xfb00('0x3'));var BPromise=require(_0xfb00('0x4'));var Mustache=require('mustache');var util=require(_0xfb00('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfb00('0x6'));var ejs=require(_0xfb00('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb00('0x8'));var squel=require(_0xfb00('0x9'));var crypto=require(_0xfb00('0xa'));var jsforce=require(_0xfb00('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb00('0x6'));var querystring=require(_0xfb00('0xc'));var Papa=require(_0xfb00('0xd'));var Redis=require(_0xfb00('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfb00('0xf'));var as=require(_0xfb00('0x10'));var hardwareService=require(_0xfb00('0x11'));var logger=require(_0xfb00('0x12'))(_0xfb00('0x13'));var utils=require(_0xfb00('0x14'));var config=require(_0xfb00('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb00('0x16'))['db'];function respondWithStatusCode(_0x171304,_0x2eaf5d){_0x2eaf5d=_0x2eaf5d||0xcc;return function(_0x429909){if(_0x429909){return _0x171304[_0xfb00('0x17')](_0x2eaf5d);}return _0x171304[_0xfb00('0x18')](_0x2eaf5d)[_0xfb00('0x19')]();};}function respondWithResult(_0x1540a8,_0x1d1f59){_0x1d1f59=_0x1d1f59||0xc8;return function(_0x268cb4){if(_0x268cb4){return _0x1540a8[_0xfb00('0x18')](_0x1d1f59)['json'](_0x268cb4);}};}function respondWithFilteredResult(_0x2f077f,_0x175d50){return function(_0x509ecf){if(_0x509ecf){var _0xbf1096=typeof _0x175d50[_0xfb00('0x1a')]==='undefined'&&typeof _0x175d50['limit']===_0xfb00('0x1b');var _0x2549ed=_0x509ecf['count'];var _0x3f1d2c=_0xbf1096?0x0:_0x175d50['offset'];var _0x41b134=_0xbf1096?_0x509ecf['count']:_0x175d50[_0xfb00('0x1a')]+_0x175d50['limit'];var _0x10817b;if(_0x41b134>=_0x2549ed){_0x41b134=_0x2549ed;_0x10817b=0xc8;}else{_0x10817b=0xce;}_0x2f077f[_0xfb00('0x18')](_0x10817b);return _0x2f077f[_0xfb00('0x1c')]('Content-Range',_0x3f1d2c+'-'+_0x41b134+'/'+_0x2549ed)[_0xfb00('0x1d')](_0x509ecf);}return null;};}function patchUpdates(_0x3f2246){return function(_0x4fee6b){try{jsonpatch[_0xfb00('0x1e')](_0x4fee6b,_0x3f2246,!![]);}catch(_0x1ff052){return BPromise[_0xfb00('0x1f')](_0x1ff052);}return _0x4fee6b[_0xfb00('0x20')]();};}function saveUpdates(_0x523878,_0x37e682){return function(_0x1ec38a){if(_0x1ec38a){return _0x1ec38a[_0xfb00('0x21')](_0x523878)[_0xfb00('0x22')](function(_0xdc201){return _0xdc201;});}return null;};}function removeEntity(_0x4b86a1,_0x31003f){return function(_0xb9ebfb){if(_0xb9ebfb){return _0xb9ebfb[_0xfb00('0x23')]()['then'](function(){_0x4b86a1[_0xfb00('0x18')](0xcc)[_0xfb00('0x19')]();});}};}function handleEntityNotFound(_0x53c5cf,_0x2e6bc5){return function(_0x14d1fb){if(!_0x14d1fb){_0x53c5cf['sendStatus'](0x194);}return _0x14d1fb;};}function handleError(_0x485b55,_0x42cfb0){_0x42cfb0=_0x42cfb0||0x1f4;return function(_0x310cad){logger['error'](_0x310cad[_0xfb00('0x24')]);if(_0x310cad[_0xfb00('0x25')]){delete _0x310cad[_0xfb00('0x25')];}_0x485b55[_0xfb00('0x18')](_0x42cfb0)[_0xfb00('0x26')](_0x310cad);};}exports[_0xfb00('0x27')]=function(_0x2493b0,_0x228979){var _0x169bf2={},_0x2bd169={},_0x273e6f={'count':0x0,'rows':[]};var _0x10ec56=_[_0xfb00('0x28')](db[_0xfb00('0x29')]['rawAttributes'],function(_0x26adcb){return{'name':_0x26adcb[_0xfb00('0x2a')],'type':_0x26adcb[_0xfb00('0x2b')][_0xfb00('0x2c')]};});_0x2bd169[_0xfb00('0x2d')]=_[_0xfb00('0x28')](_0x10ec56,'name');_0x2bd169[_0xfb00('0x2e')]=_[_0xfb00('0x2f')](_0x2493b0[_0xfb00('0x2e')]);_0x2bd169[_0xfb00('0x30')]=_[_0xfb00('0x31')](_0x2bd169[_0xfb00('0x2d')],_0x2bd169[_0xfb00('0x2e')]);_0x169bf2[_0xfb00('0x32')]=_[_0xfb00('0x31')](_0x2bd169[_0xfb00('0x2d')],qs[_0xfb00('0x33')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x33')]));_0x169bf2[_0xfb00('0x32')]=_0x169bf2['attributes'][_0xfb00('0x34')]?_0x169bf2['attributes']:_0x2bd169['model'];if(!_0x2493b0['query']['hasOwnProperty']('nolimit')){_0x169bf2[_0xfb00('0x35')]=qs[_0xfb00('0x35')](_0x2493b0[_0xfb00('0x2e')]['limit']);_0x169bf2[_0xfb00('0x1a')]=qs[_0xfb00('0x1a')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x1a')]);}_0x169bf2[_0xfb00('0x36')]=qs[_0xfb00('0x37')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x37')]);_0x169bf2[_0xfb00('0x38')]=qs[_0xfb00('0x30')](_[_0xfb00('0x39')](_0x2493b0[_0xfb00('0x2e')],_0x2bd169[_0xfb00('0x30')]),_0x10ec56);if(_0x2493b0[_0xfb00('0x2e')]['filter']){_0x169bf2[_0xfb00('0x38')]=_[_0xfb00('0x3a')](_0x169bf2[_0xfb00('0x38')],{'$or':_[_0xfb00('0x28')](_0x10ec56,function(_0x28a73c){if(_0x28a73c[_0xfb00('0x2b')]!=='VIRTUAL'){var _0x3da173={};_0x3da173[_0x28a73c[_0xfb00('0x25')]]={'$like':'%'+_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x3b')]+'%'};return _0x3da173;}})});}_0x169bf2=_[_0xfb00('0x3a')]({},_0x169bf2,_0x2493b0[_0xfb00('0x3c')]);var _0x445572={'where':_0x169bf2[_0xfb00('0x38')]};return db[_0xfb00('0x29')][_0xfb00('0x3d')](_0x445572)[_0xfb00('0x22')](function(_0x5e44d0){_0x273e6f[_0xfb00('0x3d')]=_0x5e44d0;if(_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x3e')]){_0x169bf2[_0xfb00('0x3f')]=[{'all':!![]}];}return db[_0xfb00('0x29')][_0xfb00('0x40')](_0x169bf2);})[_0xfb00('0x22')](function(_0x438f9e){_0x273e6f[_0xfb00('0x41')]=_0x438f9e;return _0x273e6f;})[_0xfb00('0x22')](respondWithFilteredResult(_0x228979,_0x169bf2))['catch'](handleError(_0x228979,null));};exports[_0xfb00('0x42')]=function(_0x3cdd84,_0x62570d){var _0x246786={'raw':!![],'where':{'id':_0x3cdd84[_0xfb00('0x43')]['id']}},_0x38e9ea={};_0x38e9ea[_0xfb00('0x2d')]=_[_0xfb00('0x2f')](db[_0xfb00('0x29')][_0xfb00('0x44')]);_0x38e9ea[_0xfb00('0x2e')]=_[_0xfb00('0x2f')](_0x3cdd84[_0xfb00('0x2e')]);_0x38e9ea[_0xfb00('0x30')]=_[_0xfb00('0x31')](_0x38e9ea['model'],_0x38e9ea[_0xfb00('0x2e')]);_0x246786[_0xfb00('0x32')]=_['intersection'](_0x38e9ea['model'],qs[_0xfb00('0x33')](_0x3cdd84[_0xfb00('0x2e')][_0xfb00('0x33')]));_0x246786['attributes']=_0x246786[_0xfb00('0x32')]['length']?_0x246786['attributes']:_0x38e9ea['model'];if(_0x3cdd84[_0xfb00('0x2e')][_0xfb00('0x3e')]){_0x246786[_0xfb00('0x3f')]=[{'all':!![]}];}_0x246786=_['merge']({},_0x246786,_0x3cdd84[_0xfb00('0x3c')]);return db[_0xfb00('0x29')][_0xfb00('0x45')](_0x246786)[_0xfb00('0x22')](handleEntityNotFound(_0x62570d,null))[_0xfb00('0x22')](respondWithResult(_0x62570d,null))['catch'](handleError(_0x62570d,null));};exports[_0xfb00('0x46')]=function(_0x267b52,_0x34f8a0){return db[_0xfb00('0x29')]['create'](_0x267b52[_0xfb00('0x47')],{})[_0xfb00('0x22')](respondWithResult(_0x34f8a0,0xc9))[_0xfb00('0x48')](handleError(_0x34f8a0,null));};exports[_0xfb00('0x21')]=function(_0x40d3fe,_0x4ee8d6){if(_0x40d3fe[_0xfb00('0x47')]['id']){delete _0x40d3fe[_0xfb00('0x47')]['id'];}return db['OpenchannelApplication'][_0xfb00('0x45')]({'where':{'id':_0x40d3fe[_0xfb00('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee8d6,null))['then'](saveUpdates(_0x40d3fe[_0xfb00('0x47')],null))['then'](respondWithResult(_0x4ee8d6,null))[_0xfb00('0x48')](handleError(_0x4ee8d6,null));};exports[_0xfb00('0x23')]=function(_0x174887,_0x584425){return db['OpenchannelApplication'][_0xfb00('0x45')]({'where':{'id':_0x174887['params']['id']}})['then'](handleEntityNotFound(_0x584425,null))[_0xfb00('0x22')](removeEntity(_0x584425,null))['catch'](handleError(_0x584425,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f163851..60532f0 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 _0x8a02=['./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x42caf9,_0x1d60fe){var _0x5669d5=function(_0x1c34e6){while(--_0x1c34e6){_0x42caf9['push'](_0x42caf9['shift']());}};_0x5669d5(++_0x1d60fe);}(_0x8a02,0x71));var _0x28a0=function(_0x856af5,_0x2cdac5){_0x856af5=_0x856af5-0x0;var _0x18a007=_0x8a02[_0x856af5];return _0x18a007;};'use strict';var _=require(_0x28a0('0x0'));var util=require('util');var logger=require(_0x28a0('0x1'))('api');var moment=require(_0x28a0('0x2'));var BPromise=require(_0x28a0('0x3'));var rp=require(_0x28a0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28a0('0x5'));var config=require(_0x28a0('0x6'));var attributes=require(_0x28a0('0x7'));module[_0x28a0('0x8')]=function(_0x602ce3,_0x2e3d18){return _0x602ce3['define'](_0x28a0('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28a0('0xa'),'collate':_0x28a0('0xb')});}; \ No newline at end of file +var _0x2eee=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x54a816,_0x24f7b6){var _0x35b0d9=function(_0x24a431){while(--_0x24a431){_0x54a816['push'](_0x54a816['shift']());}};_0x35b0d9(++_0x24f7b6);}(_0x2eee,0x1bb));var _0xe2ee=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x2eee[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0xe2ee('0x0'));var util=require('util');var logger=require(_0xe2ee('0x1'))(_0xe2ee('0x2'));var moment=require(_0xe2ee('0x3'));var BPromise=require(_0xe2ee('0x4'));var rp=require(_0xe2ee('0x5'));var fs=require('fs');var path=require(_0xe2ee('0x6'));var rimraf=require(_0xe2ee('0x7'));var config=require(_0xe2ee('0x8'));var attributes=require(_0xe2ee('0x9'));module[_0xe2ee('0xa')]=function(_0x3bedfe,_0x1f2959){return _0x3bedfe['define']('OpenchannelApplication',attributes,{'tableName':_0xe2ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2ee('0xc'),'collate':_0xe2ee('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index faeacf3..c91da39 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 _0xd37b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelApplication','body','options','raw','where','limit','UpdateOpenchannelApplication','lodash','util'];(function(_0x25483f,_0x43852f){var _0x220d13=function(_0x4a5779){while(--_0x4a5779){_0x25483f['push'](_0x25483f['shift']());}};_0x220d13(++_0x43852f);}(_0xd37b,0xfa));var _0xbd37=function(_0x26d280,_0x2007ff){_0x26d280=_0x26d280-0x0;var _0x26c17e=_0xd37b[_0x26d280];return _0x26c17e;};'use strict';var _=require(_0xbd37('0x0'));var util=require(_0xbd37('0x1'));var moment=require('moment');var BPromise=require(_0xbd37('0x2'));var rs=require(_0xbd37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd37('0x4'))['db'];var utils=require(_0xbd37('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbd37('0x6'));var jayson=require(_0xbd37('0x7'));var client=jayson[_0xbd37('0x8')][_0xbd37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0888,_0x470cdf,_0x1cff5c){return new BPromise(function(_0x26d797,_0x5c2077){return client[_0xbd37('0xa')](_0x5c0888,_0x1cff5c)[_0xbd37('0xb')](function(_0x35ee10){logger['info'](_0xbd37('0xc'),_0x470cdf,_0xbd37('0xd'));logger[_0xbd37('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x470cdf,_0xbd37('0xd'),JSON[_0xbd37('0xf')](_0x35ee10));if(_0x35ee10[_0xbd37('0x10')]){if(_0x35ee10[_0xbd37('0x10')][_0xbd37('0x11')]===0x1f4){logger[_0xbd37('0x10')](_0xbd37('0xc'),_0x470cdf,_0x35ee10[_0xbd37('0x10')]['message']);return _0x5c2077(_0x35ee10['error'][_0xbd37('0x12')]);}logger[_0xbd37('0x10')](_0xbd37('0xc'),_0x470cdf,_0x35ee10[_0xbd37('0x10')][_0xbd37('0x12')]);return _0x26d797(_0x35ee10[_0xbd37('0x10')][_0xbd37('0x12')]);}else{logger['info'](_0xbd37('0xc'),_0x470cdf,_0xbd37('0xd'));_0x26d797(_0x35ee10[_0xbd37('0x13')]['message']);}})[_0xbd37('0x14')](function(_0x3c293c){logger['error'](_0xbd37('0xc'),_0x470cdf,_0x3c293c);_0x5c2077(_0x3c293c);});});}exports['UpdateOpenchannelApplication']=function(_0x3bda60){var _0x368f5b=this;return new Promise(function(_0x40c367,_0x221da7){return db[_0xbd37('0x15')]['update'](_0x3bda60[_0xbd37('0x16')],{'raw':_0x3bda60[_0xbd37('0x17')]?_0x3bda60[_0xbd37('0x17')][_0xbd37('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bda60[_0xbd37('0x17')]?_0x3bda60[_0xbd37('0x17')][_0xbd37('0x19')]||null:null,'attributes':_0x3bda60[_0xbd37('0x17')]?_0x3bda60['options']['attributes']||null:null,'limit':_0x3bda60[_0xbd37('0x17')]?_0x3bda60['options'][_0xbd37('0x1a')]||null:null})[_0xbd37('0xb')](function(_0x1cb067){logger['info']('UpdateOpenchannelApplication',_0x3bda60);logger[_0xbd37('0xe')](_0xbd37('0x1b'),_0x3bda60,JSON['stringify'](_0x1cb067));_0x40c367(_0x1cb067);})[_0xbd37('0x14')](function(_0x21799d){logger['error'](_0xbd37('0x1b'),_0x21799d[_0xbd37('0x12')],_0x3bda60);_0x221da7(_0x368f5b['error'](0x1f4,_0x21799d[_0xbd37('0x12')]));});});}; \ No newline at end of file +var _0xb286=['code','message','result','catch','OpenchannelApplication','update','body','options','raw','limit','debug','UpdateOpenchannelApplication','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x586bd5,_0x329cd1){var _0x395059=function(_0x18c82f){while(--_0x18c82f){_0x586bd5['push'](_0x586bd5['shift']());}};_0x395059(++_0x329cd1);}(_0xb286,0xff));var _0x6b28=function(_0x2cc6dc,_0x2a8398){_0x2cc6dc=_0x2cc6dc-0x0;var _0xa740e2=_0xb286[_0x2cc6dc];return _0xa740e2;};'use strict';var _=require(_0x6b28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b28('0x1'));var fs=require('fs');var Redis=require(_0x6b28('0x2'));var db=require(_0x6b28('0x3'))['db'];var utils=require(_0x6b28('0x4'));var logger=require(_0x6b28('0x5'))(_0x6b28('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6b28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a107d,_0x3675ed,_0xabe953){return new BPromise(function(_0x5ba72d,_0x527446){return client['request'](_0x5a107d,_0xabe953)[_0x6b28('0x8')](function(_0x523352){logger[_0x6b28('0x9')](_0x6b28('0xa'),_0x3675ed,_0x6b28('0xb'));logger['debug'](_0x6b28('0xc'),_0x3675ed,_0x6b28('0xb'),JSON[_0x6b28('0xd')](_0x523352));if(_0x523352[_0x6b28('0xe')]){if(_0x523352[_0x6b28('0xe')][_0x6b28('0xf')]===0x1f4){logger['error'](_0x6b28('0xa'),_0x3675ed,_0x523352['error']['message']);return _0x527446(_0x523352[_0x6b28('0xe')][_0x6b28('0x10')]);}logger[_0x6b28('0xe')](_0x6b28('0xa'),_0x3675ed,_0x523352[_0x6b28('0xe')][_0x6b28('0x10')]);return _0x5ba72d(_0x523352['error'][_0x6b28('0x10')]);}else{logger['info'](_0x6b28('0xa'),_0x3675ed,'request\x20sent');_0x5ba72d(_0x523352[_0x6b28('0x11')][_0x6b28('0x10')]);}})[_0x6b28('0x12')](function(_0x1d46dc){logger[_0x6b28('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x3675ed,_0x1d46dc);_0x527446(_0x1d46dc);});});}exports['UpdateOpenchannelApplication']=function(_0x563222){var _0x1a9677=this;return new Promise(function(_0x5327c9,_0x452d48){return db[_0x6b28('0x13')][_0x6b28('0x14')](_0x563222[_0x6b28('0x15')],{'raw':_0x563222['options']?_0x563222[_0x6b28('0x16')][_0x6b28('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563222['options']?_0x563222[_0x6b28('0x16')]['where']||null:null,'attributes':_0x563222[_0x6b28('0x16')]?_0x563222[_0x6b28('0x16')]['attributes']||null:null,'limit':_0x563222[_0x6b28('0x16')]?_0x563222[_0x6b28('0x16')][_0x6b28('0x18')]||null:null})[_0x6b28('0x8')](function(_0x3d5be8){logger[_0x6b28('0x9')]('UpdateOpenchannelApplication',_0x563222);logger[_0x6b28('0x19')](_0x6b28('0x1a'),_0x563222,JSON[_0x6b28('0xd')](_0x3d5be8));_0x5327c9(_0x3d5be8);})[_0x6b28('0x12')](function(_0x19aef3){logger[_0x6b28('0xe')](_0x6b28('0x1a'),_0x19aef3[_0x6b28('0x10')],_0x563222);_0x452d48(_0x1a9677['error'](0x1f4,_0x19aef3[_0x6b28('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 620dfdb..700d6ae 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 _0xc210=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xc210,0x84));var _0x0c21=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0xc210[_0x5eb868];return _0x278458;};'use strict';var multer=require(_0x0c21('0x0'));var util=require(_0x0c21('0x1'));var path=require('path');var timeout=require(_0x0c21('0x2'));var express=require('express');var router=express[_0x0c21('0x3')]();var fs_extra=require(_0x0c21('0x4'));var auth=require(_0x0c21('0x5'));var interaction=require(_0x0c21('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x0c21('0x7')]('/',auth[_0x0c21('0x8')](),controller[_0x0c21('0x9')]);router['get'](_0x0c21('0xa'),auth['isAuthenticated'](),controller[_0x0c21('0xb')]);router[_0x0c21('0x7')](_0x0c21('0xc'),auth[_0x0c21('0x8')](),controller['show']);router['get'](_0x0c21('0xd'),auth[_0x0c21('0x8')](),controller[_0x0c21('0xe')]);router['get'](_0x0c21('0xf'),auth[_0x0c21('0x8')](),controller[_0x0c21('0x10')]);router[_0x0c21('0x11')]('/',auth['isAuthenticated'](),controller[_0x0c21('0x12')]);router[_0x0c21('0x11')](_0x0c21('0xd'),auth['isAuthenticated'](),controller[_0x0c21('0x13')]);router[_0x0c21('0x11')](_0x0c21('0x14'),auth[_0x0c21('0x8')](),interaction['tracked'](_0x0c21('0x15'),_0x0c21('0x16')),controller[_0x0c21('0x17')]);router[_0x0c21('0x18')](_0x0c21('0xc'),auth[_0x0c21('0x8')](),interaction[_0x0c21('0x19')](_0x0c21('0x15'),_0x0c21('0x1a')),controller[_0x0c21('0x1b')]);router[_0x0c21('0x1c')](_0x0c21('0xc'),auth[_0x0c21('0x8')](),interaction['tracked'](_0x0c21('0x15'),_0x0c21('0x1d')),controller[_0x0c21('0x1e')]);router[_0x0c21('0x1c')](_0x0c21('0x14'),auth[_0x0c21('0x8')](),controller[_0x0c21('0x1f')]);module[_0x0c21('0x20')]=router; \ No newline at end of file +var _0x1f05=['describe','show','getMessages','/:id/download','download','post','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannelinteraction:update','update','destroy','delete','/:id/tags','removeTags','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x3df204,_0x43e85b){var _0x1436bd=function(_0x4c8822){while(--_0x4c8822){_0x3df204['push'](_0x3df204['shift']());}};_0x1436bd(++_0x43e85b);}(_0x1f05,0x12b));var _0x51f0=function(_0x5be7df,_0x7633eb){_0x5be7df=_0x5be7df-0x0;var _0x2379c7=_0x1f05[_0x5be7df];return _0x2379c7;};'use strict';var multer=require('multer');var util=require(_0x51f0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51f0('0x1'));var router=express[_0x51f0('0x2')]();var fs_extra=require(_0x51f0('0x3'));var auth=require(_0x51f0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x51f0('0x5'));var controller=require(_0x51f0('0x6'));router['get']('/',auth[_0x51f0('0x7')](),controller[_0x51f0('0x8')]);router[_0x51f0('0x9')](_0x51f0('0xa'),auth[_0x51f0('0x7')](),controller[_0x51f0('0xb')]);router[_0x51f0('0x9')]('/:id',auth[_0x51f0('0x7')](),controller[_0x51f0('0xc')]);router[_0x51f0('0x9')]('/:id/messages',auth[_0x51f0('0x7')](),controller[_0x51f0('0xd')]);router[_0x51f0('0x9')](_0x51f0('0xe'),auth[_0x51f0('0x7')](),controller[_0x51f0('0xf')]);router['post']('/',auth[_0x51f0('0x7')](),controller['create']);router[_0x51f0('0x10')]('/:id/messages',auth[_0x51f0('0x7')](),controller[_0x51f0('0x11')]);router['post']('/:id/tags',auth[_0x51f0('0x7')](),interaction['tracked'](_0x51f0('0x12'),_0x51f0('0x13')),controller[_0x51f0('0x14')]);router[_0x51f0('0x15')](_0x51f0('0x16'),auth[_0x51f0('0x7')](),interaction[_0x51f0('0x17')](_0x51f0('0x12'),_0x51f0('0x18')),controller[_0x51f0('0x19')]);router['delete']('/:id',auth[_0x51f0('0x7')](),interaction[_0x51f0('0x17')](_0x51f0('0x12'),'openchannelinteraction:destroy'),controller[_0x51f0('0x1a')]);router[_0x51f0('0x1b')](_0x51f0('0x1c'),auth[_0x51f0('0x7')](),controller[_0x51f0('0x1d')]);module[_0x51f0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 2bad701..b0e211a 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 _0x167e=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x25755a,_0x20749d){var _0x8be700=function(_0x336bb2){while(--_0x336bb2){_0x25755a['push'](_0x25755a['shift']());}};_0x8be700(++_0x20749d);}(_0x167e,0xa3));var _0xe167=function(_0x3be02e,_0x5d50a8){_0x3be02e=_0x3be02e-0x0;var _0x131285=_0x167e[_0x3be02e];return _0x131285;};'use strict';var Sequelize=require(_0xe167('0x0'));module[_0xe167('0x1')]={'closed':{'type':Sequelize[_0xe167('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe167('0x3')]},'disposition':{'type':Sequelize[_0xe167('0x4')]},'secondDisposition':{'type':Sequelize[_0xe167('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe167('0x4')]},'note':{'type':Sequelize[_0xe167('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xe167('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xe167('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe167('0x5')]('in',_0xe167('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe167('0x5')]('in',_0xe167('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xe167('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x383a=['DATE','ENUM','out','exports','BOOLEAN','STRING'];(function(_0x26637e,_0x376e3b){var _0x17583d=function(_0x263f6b){while(--_0x263f6b){_0x26637e['push'](_0x26637e['shift']());}};_0x17583d(++_0x376e3b);}(_0x383a,0x1ad));var _0xa383=function(_0x2b70bd,_0x2e39d2){_0x2b70bd=_0x2b70bd-0x0;var _0x4cd986=_0x383a[_0x2b70bd];return _0x4cd986;};'use strict';var Sequelize=require('sequelize');module[_0xa383('0x0')]={'closed':{'type':Sequelize[_0xa383('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa383('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa383('0x2')]},'read1stAt':{'type':Sequelize[_0xa383('0x3')]},'threadId':{'type':Sequelize[_0xa383('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa383('0x4')]('in',_0xa383('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa383('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b656c5b..38ee468 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 _0x4eda=['expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','count','keyBy','OpenchannelInteraction','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','rows','params','includeAll','include','merge','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','format','options','findAll','addTags','setTags','spread','emit','removeTags','download','root','files','tmp','join','server','transcript-%d-%s.zip','User','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','status','end','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','answered','total','closed','UserId','talking','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','users','left_join','cm_contacts','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4eda,0x96));var _0xa4ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4eda[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa4ed('0x0'));var rimraf=require(_0xa4ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ed('0x2'));var rp=require(_0xa4ed('0x3'));var moment=require(_0xa4ed('0x4'));var BPromise=require(_0xa4ed('0x5'));var Mustache=require(_0xa4ed('0x6'));var util=require(_0xa4ed('0x7'));var path=require(_0xa4ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4ed('0x9'));var fs=require('fs');var fs_extra=require(_0xa4ed('0xa'));var _=require('lodash');var squel=require(_0xa4ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xa4ed('0xc'));var deskjs=require(_0xa4ed('0xd'));var toCsv=require(_0xa4ed('0xe'));var querystring=require('querystring');var Papa=require(_0xa4ed('0xf'));var Redis=require(_0xa4ed('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4ed('0x11'));var pdf=require(_0xa4ed('0x12'));var hardwareService=require(_0xa4ed('0x13'));var logger=require(_0xa4ed('0x14'))('api');var utils=require(_0xa4ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa4ed('0x16'));var db=require(_0xa4ed('0x17'))['db'];config[_0xa4ed('0x18')]=_['defaults'](config[_0xa4ed('0x18')],{'host':_0xa4ed('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4ed('0x18')]));require(_0xa4ed('0x1a'))[_0xa4ed('0x1b')](socket);function respondWithStatusCode(_0x3dd050,_0x5a54c5){_0x5a54c5=_0x5a54c5||0xcc;return function(_0x27808a){if(_0x27808a){return _0x3dd050['sendStatus'](_0x5a54c5);}return _0x3dd050[_0xa4ed('0x1c')](_0x5a54c5)[_0xa4ed('0x1d')]();};}function respondWithResult(_0x3bc0e4,_0x3c1f85){_0x3c1f85=_0x3c1f85||0xc8;return function(_0x3e2b74){if(_0x3e2b74){return _0x3bc0e4[_0xa4ed('0x1c')](_0x3c1f85)['json'](_0x3e2b74);}};}function respondWithFilteredResult(_0x339e38,_0x51d8e9){return function(_0x29041f){if(_0x29041f){var _0x4efdd3=typeof _0x51d8e9[_0xa4ed('0x1e')]==='undefined'&&typeof _0x51d8e9[_0xa4ed('0x1f')]==='undefined';var _0x480bdf=_0x29041f['count'];var _0x419f38=_0x4efdd3?0x0:_0x51d8e9['offset'];var _0x189477=_0x4efdd3?_0x29041f['count']:_0x51d8e9[_0xa4ed('0x1e')]+_0x51d8e9[_0xa4ed('0x1f')];var _0x5a2cd3;if(_0x189477>=_0x480bdf){_0x189477=_0x480bdf;_0x5a2cd3=0xc8;}else{_0x5a2cd3=0xce;}_0x339e38[_0xa4ed('0x1c')](_0x5a2cd3);return _0x339e38[_0xa4ed('0x20')]('Content-Range',_0x419f38+'-'+_0x189477+'/'+_0x480bdf)['json'](_0x29041f);}return null;};}function patchUpdates(_0x2ca6dd){return function(_0x4aa021){try{jsonpatch['apply'](_0x4aa021,_0x2ca6dd,!![]);}catch(_0x307af6){return BPromise[_0xa4ed('0x21')](_0x307af6);}return _0x4aa021[_0xa4ed('0x22')]();};}function saveUpdates(_0x5908f3,_0x26ad02){return function(_0x4bd185){if(_0x4bd185){return _0x4bd185[_0xa4ed('0x23')](_0x5908f3)[_0xa4ed('0x24')](function(_0x2b94d3){return _0x2b94d3;});}return null;};}function removeEntity(_0x3495fc,_0x461b8f){return function(_0x3e3997){if(_0x3e3997){return _0x3e3997[_0xa4ed('0x25')]()[_0xa4ed('0x24')](function(){_0x3495fc[_0xa4ed('0x1c')](0xcc)[_0xa4ed('0x1d')]();});}};}function handleEntityNotFound(_0x401e36,_0x25ef7a){return function(_0x34a5e1){if(!_0x34a5e1){_0x401e36[_0xa4ed('0x26')](0x194);}return _0x34a5e1;};}function handleError(_0x2fb78e,_0x496cf6){_0x496cf6=_0x496cf6||0x1f4;return function(_0x2c5daf){logger[_0xa4ed('0x27')](_0x2c5daf['stack']);if(_0x2c5daf['name']){delete _0x2c5daf[_0xa4ed('0x28')];}_0x2fb78e[_0xa4ed('0x1c')](_0x496cf6)[_0xa4ed('0x29')](_0x2c5daf);};}function getInteractionUsers(_0x20edd8,_0x32e0b2){return new BPromise(function(_0x36d8cd,_0x2c337e){try{if(_0x32e0b2[_0x20edd8['id']]){_0x20edd8[_0xa4ed('0x2a')]=_[_0xa4ed('0x2b')](_0x32e0b2[_0x20edd8['id']],function(_0x4bb7c1){return{'id':_0x4bb7c1['id'],'fullname':_0x4bb7c1[_0xa4ed('0x2c')]};});}}catch(_0xf3624d){_0x2c337e(_0xf3624d);}_0x36d8cd(_0x20edd8);});}function getInteractionTags(_0x3fa775,_0x50d54a){return new BPromise(function(_0x1e1f9e,_0x51d7c2){try{if(_0x3fa775[_0xa4ed('0x2d')]){_0x3fa775[_0xa4ed('0x2e')]=[];_0x3fa775['TagIds'][_0xa4ed('0x2f')](',')[_0xa4ed('0x30')](function(_0x1959e6){_0x3fa775['Tags'][_0xa4ed('0x31')](_0x50d54a[_0x1959e6]);});}delete _0x3fa775[_0xa4ed('0x2d')];}catch(_0x1d61b6){_0x51d7c2(_0x1d61b6);}_0x1e1f9e(_0x3fa775);});}function updateOpenchannelInteraction(_0x58ca4b,_0x54ef0f,_0x4a2d20){return new BPromise(function(_0x5779f,_0x4edd7a){return getInteractionUsers(_0x58ca4b,_0x4a2d20)[_0xa4ed('0x24')](function(_0x2ed60f){return getInteractionTags(_0x2ed60f,_0x54ef0f);})['then'](function(_0x19c258){return getStateInteraction(_0x19c258);})[_0xa4ed('0x24')](function(_0x1d38c3){_0x5779f(_0x1d38c3);})[_0xa4ed('0x32')](function(_0x2d0f7f){_0x4edd7a(_0x2d0f7f);});});}function getStateInteraction(_0x33305b){return new BPromise(function(_0x3f8832){_0x33305b[_0xa4ed('0x33')]=0x0;_0x33305b['talking']=0x0;_0x33305b[_0xa4ed('0x34')]=0x0;_0x33305b['unmanaged']=0x0;_0x33305b[_0xa4ed('0x35')]=0x0;if(!_0x33305b[_0xa4ed('0x36')]&&!_0x33305b[_0xa4ed('0x37')]){_0x33305b[_0xa4ed('0x33')]+=0x1;}if(!_0x33305b['closed']&&_0x33305b[_0xa4ed('0x37')]){_0x33305b[_0xa4ed('0x38')]+=0x1;if(_0x33305b[_0xa4ed('0x33')]){_0x33305b['waiting']-=0x1;}}if(_0x33305b[_0xa4ed('0x36')]&&_0x33305b['UserId']){_0x33305b[_0xa4ed('0x34')]+=0x1;if(_0x33305b[_0xa4ed('0x38')]){_0x33305b[_0xa4ed('0x38')]-=0x1;}}if(_0x33305b['closed']&&!_0x33305b['UserId']){_0x33305b['unmanaged']+=0x1;if(_0x33305b[_0xa4ed('0x33')]){_0x33305b['waiting']-=0x1;}}_0x33305b[_0xa4ed('0x35')]+=0x1;_0x3f8832(_0x33305b);});}exports[_0xa4ed('0x39')]=function(_0x3609d2,_0x3e08cb){var _0x268a77={},_0x56c7d4={},_0x2ee605={'count':0x0,'rows':[]};var _0x2ab776=_[_0xa4ed('0x2b')](db['OpenchannelInteraction'][_0xa4ed('0x3a')],function(_0x7fbcfe){return{'name':_0x7fbcfe[_0xa4ed('0x3b')],'type':_0x7fbcfe[_0xa4ed('0x3c')][_0xa4ed('0x3d')]};});_0x56c7d4[_0xa4ed('0x3e')]=_[_0xa4ed('0x2b')](_0x2ab776,_0xa4ed('0x28'));_0x56c7d4[_0xa4ed('0x3f')]=_[_0xa4ed('0x40')](_0x3609d2[_0xa4ed('0x3f')]);_0x56c7d4[_0xa4ed('0x41')]=_[_0xa4ed('0x42')](_0x56c7d4[_0xa4ed('0x3e')],_0x56c7d4['query']);_0x268a77[_0xa4ed('0x43')]=_[_0xa4ed('0x42')](_0x56c7d4[_0xa4ed('0x3e')],qs[_0xa4ed('0x44')](_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x44')]));_0x268a77['attributes']=_0x268a77['attributes']['length']?_0x268a77['attributes']:_0x56c7d4[_0xa4ed('0x3e')];if(!_0x3609d2[_0xa4ed('0x3f')]['hasOwnProperty'](_0xa4ed('0x45'))){_0x268a77[_0xa4ed('0x1f')]=qs[_0xa4ed('0x1f')](_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x1f')]);_0x268a77[_0xa4ed('0x1e')]=qs[_0xa4ed('0x1e')](_0x3609d2[_0xa4ed('0x3f')]['offset']);}_0x268a77['order']=qs[_0xa4ed('0x46')](_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x46')]);_0x268a77[_0xa4ed('0x47')]=qs[_0xa4ed('0x41')](_['pick'](_0x3609d2[_0xa4ed('0x3f')],_0x56c7d4[_0xa4ed('0x41')]),_0x2ab776);var _0x18e71b=[];var _0x3397c3=squel[_0xa4ed('0x48')]()[_0xa4ed('0x49')]('id')[_0xa4ed('0x49')](_0xa4ed('0x28'))[_0xa4ed('0x49')](_0xa4ed('0x4a'))[_0xa4ed('0x4b')](_0xa4ed('0x4c'));var _0x50f886=squel['select']()[_0xa4ed('0x49')](_0xa4ed('0x4d'))[_0xa4ed('0x49')]('u.fullname')['field']('ui.OpenchannelInteractionId')[_0xa4ed('0x4b')](_0xa4ed('0x4e'),'ui')['left_join'](_0xa4ed('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x38a684=squel[_0xa4ed('0x48')]()['from']('openchannel_interactions','i')[_0xa4ed('0x50')](_0xa4ed('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xa4ed('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xa4ed('0x50')](_0xa4ed('0x52'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xa4ed('0x50')]('openchannel_messages','me',_0xa4ed('0x53'))['left_join'](_0xa4ed('0x54'),'it',_0xa4ed('0x55'))[_0xa4ed('0x50')](_0xa4ed('0x4c'),'t',_0xa4ed('0x56'));var _0x3ee5fe=squel[_0xa4ed('0x57')]();var _0x327819=[];var _0x1ad83c=squel['expr']();var _0x4ac49a;if(_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x58')]){_0x4ac49a=as[_0xa4ed('0x59')](_0x3609d2[_0xa4ed('0x3f')]['search']);var _0x2fe495=_0x4ac49a[_0xa4ed('0x5a')];for(var _0x284c6e=0x0;_0x284c6e<_0x4ac49a['conditions'][_0xa4ed('0x5b')];_0x284c6e++){var _0x591342=_0x4ac49a[_0xa4ed('0x5c')][_0x284c6e];var _0x4d85bc='i';var _0x5ccc07=_[_0xa4ed('0x5d')](_0x2ab776,[_0xa4ed('0x28'),_0x591342['field']]);if(!_0x5ccc07){switch(_0x591342[_0xa4ed('0x49')]){case _0xa4ed('0x5e'):if(_0x591342[_0xa4ed('0x5f')]==0x1){_0x38a684['having']('`'+_0x591342[_0xa4ed('0x49')]+_0xa4ed('0x60'));}else{_0x38a684[_0xa4ed('0x61')]('`'+_0x591342[_0xa4ed('0x49')]+_0xa4ed('0x62'));}break;case _0xa4ed('0x63'):if(_0x591342[_0xa4ed('0x64')]===_0xa4ed('0x65')){if(_0x591342[_0xa4ed('0x5f')]['split']('\x20')[_0xa4ed('0x5b')]>0x1){_0x3ee5fe[_0x2fe495](_0xa4ed('0x66'),qs[_0xa4ed('0x67')](_0x591342[_0xa4ed('0x5f')]),null);}else{var _0x2f9f32='%'+_0x591342['value']+'%';_0x3ee5fe[_0x2fe495]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2f9f32,_0x2f9f32,_0x2f9f32);}}else{_0x5ccc07=_[_0xa4ed('0x5d')](_0x2ab776,[_0xa4ed('0x28'),_0xa4ed('0x68')]);_0x591342[_0xa4ed('0x49')]=_0xa4ed('0x68');_0x5cc25a=as['buildExpression'](_0x4d85bc,_0x5ccc07['type'],_0x591342);_0x3ee5fe[_0x2fe495](_0x5cc25a[_0xa4ed('0x69')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x6a')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x1d')]);}break;case'Tag':var _0x26f8df=_0x591342[_0xa4ed('0x5f')][_0xa4ed('0x2f')](',')[_0xa4ed('0x2b')](function(_0x369789){return Number(_0x369789);});_0x26f8df[_0xa4ed('0x30')](function(_0x1deb8e){_0x1ad83c['or'](_0xa4ed('0x6b'),'%,'+_0x1deb8e+',%');});_0x327819=_[_0xa4ed('0x6c')](_0x327819,_0x26f8df);break;case'User':if(_0x591342[_0xa4ed('0x64')]===_0xa4ed('0x65')){_0x3ee5fe[_0x2fe495](_0xa4ed('0x6d'),'%'+_0x591342[_0xa4ed('0x5f')]+'%',null);}else{_0x5ccc07=_['find'](_0x2ab776,[_0xa4ed('0x28'),_0xa4ed('0x37')]);_0x591342[_0xa4ed('0x49')]=_0xa4ed('0x37');_0x5cc25a=as[_0xa4ed('0x6e')](_0x4d85bc,_0x5ccc07[_0xa4ed('0x3c')],_0x591342);_0x3ee5fe[_0x2fe495](_0x5cc25a[_0xa4ed('0x69')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x6a')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x1d')]);}break;case _0xa4ed('0x6f'):_0x5cc25a=as[_0xa4ed('0x6e')]('me',null,_0x591342);_0x3ee5fe[_0x2fe495](_0x5cc25a[_0xa4ed('0x69')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x6a')],_0x5cc25a['value'][_0xa4ed('0x1d')]);break;}}else{var _0x5cc25a=as['buildExpression'](_0x4d85bc,_0x5ccc07[_0xa4ed('0x3c')],_0x591342);_0x3ee5fe[_0x2fe495](_0x5cc25a[_0xa4ed('0x69')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x6a')],_0x5cc25a[_0xa4ed('0x5f')][_0xa4ed('0x1d')]);}}}else{var _0x53d732=_(_0x3609d2['query'])['keys']()[_0xa4ed('0x2b')](function(_0x10fc55){return _[_0xa4ed('0x70')](_0x2ab776,[_0xa4ed('0x28'),_0x10fc55])?_0x10fc55:undefined;})[_0xa4ed('0x71')]()[_0xa4ed('0x5f')]();if(!_[_0xa4ed('0x72')](_0x53d732)){_0x53d732[_0xa4ed('0x30')](function(_0x2313ae){if(_0x2313ae===_0xa4ed('0x73')){_0x38a684[_0xa4ed('0x47')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xa4ed('0x74')](_0x3609d2[_0xa4ed('0x3f')][_0x2313ae]));}else if(_0x2313ae==='createdAt'){var _0xc9832d=JSON[_0xa4ed('0x75')](_0x3609d2[_0xa4ed('0x3f')][_0x2313ae])[_0xa4ed('0x76')];var _0x48049d=JSON[_0xa4ed('0x75')](_0x3609d2[_0xa4ed('0x3f')][_0x2313ae])[_0xa4ed('0x77')];_0x38a684[_0xa4ed('0x47')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc9832d,_0x48049d);}else{if(_0x3609d2[_0xa4ed('0x3f')][_0x2313ae]===_0xa4ed('0x78')){_0x38a684[_0xa4ed('0x47')]('i.'+_0x2313ae+_0xa4ed('0x79'));}else{_0x38a684[_0xa4ed('0x47')]('i.'+_0x2313ae+_0xa4ed('0x7a'),_0x3609d2[_0xa4ed('0x3f')][_0x2313ae]);}}});}if(_0x3609d2['query'][_0xa4ed('0x7b')]){if(_0x3609d2['query'][_0xa4ed('0x7b')]==0x1){_0x38a684[_0xa4ed('0x61')](_0xa4ed('0x7c'));}else{_0x38a684[_0xa4ed('0x61')](_0xa4ed('0x7d'));}}if(_0x3609d2[_0xa4ed('0x3f')]['tag']){_0x327819=_[_0xa4ed('0x7e')](_0x3609d2[_0xa4ed('0x3f')]['tag'])?_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x7f')]:new Array(_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x7f')]);_0x327819[_0xa4ed('0x30')](function(_0x492155){_0x1ad83c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x492155+',%');});}if(_0x3609d2['query'][_0xa4ed('0x80')]){var _0x2da090=_0x3609d2[_0xa4ed('0x3f')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa4ed('0x81')](_0x2da090)){_0x3ee5fe['or'](_0xa4ed('0x82'),_0x2da090+'%');}else{_0x3ee5fe['or'](_0xa4ed('0x83'),qs['getFullTextValue'](_0x2da090))['or'](_0xa4ed('0x84'),_0x2da090+'%')['or'](_0xa4ed('0x85'),_0x2da090+'%');}}}_0x38a684['where'](_0x3ee5fe);_0x38a684[_0xa4ed('0x86')](_0xa4ed('0x87'));var _0x54ee0c={'type':db[_0xa4ed('0x88')][_0xa4ed('0x89')][_0xa4ed('0x8a')],'raw':!![]};var _0x57e730=_0x38a684['clone']();_0x57e730['field']('i.id');_0x57e730[_0xa4ed('0x49')](_0xa4ed('0x8b'),_0xa4ed('0x5e'));if(_0x268a77[_0xa4ed('0x8c')]){_0x268a77['order'][_0xa4ed('0x30')](function(_0x20f8ac){var _0x1cf8a9=_0x20f8ac[0x0]===_0xa4ed('0x8d')?_0x20f8ac[0x0]:'i.'+_0x20f8ac[0x0];_0x38a684[_0xa4ed('0x8c')](_0x1cf8a9,_0x20f8ac[0x1]===_0xa4ed('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x327819)){_0x38a684[_0xa4ed('0x61')](_0x1ad83c);_0x57e730[_0xa4ed('0x47')](_0xa4ed('0x8f'),_0x327819);}BPromise[_0xa4ed('0x90')]()[_0xa4ed('0x24')](function(){if(!_0x4ac49a){if(_0x3609d2['query']['OpenchannelAccountId'])return;_0x57e730['where'](_0xa4ed('0x91'));_0x38a684[_0xa4ed('0x47')](_0xa4ed('0x91'));return;}if(_0x3609d2[_0xa4ed('0x92')][_0xa4ed('0x93')]!==_0xa4ed('0x94'))return;return _0x3609d2[_0xa4ed('0x92')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x294053){if(_[_0xa4ed('0x72')](_0x294053)){_0x57e730['where'](_0xa4ed('0x95'));_0x38a684[_0xa4ed('0x47')](_0xa4ed('0x95'));}else{_0x57e730[_0xa4ed('0x47')](_0xa4ed('0x96'),_[_0xa4ed('0x2b')](_0x294053,'id'));_0x38a684[_0xa4ed('0x47')](_0xa4ed('0x96'),_['map'](_0x294053,'id'));}});})['then'](function(){if(_0x3609d2[_0xa4ed('0x92')]['role']===_0xa4ed('0x94')&&!_0x4ac49a&&!_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x73')])return[];return db[_0xa4ed('0x97')][_0xa4ed('0x3f')](_0x57e730[_0xa4ed('0x98')](),_0x54ee0c);})[_0xa4ed('0x24')](function(_0x5bd03e){_0x2ee605[_0xa4ed('0x99')]=_0x5bd03e[_0xa4ed('0x5b')];if(_0x2ee605[_0xa4ed('0x99')]===0x0)return[];return db[_0xa4ed('0x97')][_0xa4ed('0x3f')](_0x3397c3['toString'](),_0x54ee0c)[_0xa4ed('0x24')](function(_0x41ef33){_0x18e71b=_[_0xa4ed('0x9a')](_0x41ef33,'id');_0x54ee0c=_['merge'](_0x54ee0c,{'model':db[_0xa4ed('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3609d2[_0xa4ed('0x3f')][_0xa4ed('0x44')]){_0x268a77[_0xa4ed('0x43')][_0xa4ed('0x30')](function(_0x208670){_0x38a684[_0xa4ed('0x49')]('i.'+_0x208670);});}else{_0x38a684['field'](_0xa4ed('0x8b'),_0xa4ed('0x5e'));_0x38a684['field']('a.key','Account.key');_0x38a684[_0xa4ed('0x49')](_0xa4ed('0x9c'),'Account.mandatoryDisposition');_0x38a684[_0xa4ed('0x49')]('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',_0xa4ed('0x8d'));_0x38a684['field'](_0xa4ed('0x9d'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0x9e'),_0xa4ed('0x9f'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xa0'),_0xa4ed('0xa1'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xa2'),_0xa4ed('0xa3'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xa4'),_0xa4ed('0xa5'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xa6'),_0xa4ed('0xa7'));_0x38a684[_0xa4ed('0x49')]('c.fax',_0xa4ed('0xa8'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xa9'),_0xa4ed('0xaa'));_0x38a684['field'](_0xa4ed('0xab'),_0xa4ed('0xac'));_0x38a684[_0xa4ed('0x49')](_0xa4ed('0xad'),'TagIds');}if(_0x268a77[_0xa4ed('0x1f')])_0x38a684['limit'](_0x268a77[_0xa4ed('0x1f')]);if(_0x268a77['offset'])_0x38a684[_0xa4ed('0x1e')](_0x268a77[_0xa4ed('0x1e')]);return db['sequelize']['query'](_0x38a684[_0xa4ed('0x98')](),_0x54ee0c);})[_0xa4ed('0x24')](function(_0x256997){if(_0x256997[_0xa4ed('0x5b')]>0x0)_0x50f886[_0xa4ed('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xa4ed('0x2b')](_0x256997,'id'));return db[_0xa4ed('0x97')][_0xa4ed('0x3f')](_0x50f886[_0xa4ed('0x98')](),_0x54ee0c)[_0xa4ed('0x24')](function(_0x31440d){var _0x3ab5fd=_[_0xa4ed('0xae')](_0x31440d,_0xa4ed('0xaf'));var _0x13aa0d=[];_0x256997[_0xa4ed('0x30')](function(_0x2dc6d4){_0x13aa0d['push'](updateOpenchannelInteraction(_0x2dc6d4,_0x18e71b,_0x3ab5fd));});return BPromise['all'](_0x13aa0d);});});})[_0xa4ed('0x24')](function(_0x7897be){_0x2ee605[_0xa4ed('0xb0')]=_0x7897be;return _0x2ee605;})[_0xa4ed('0x24')](respondWithFilteredResult(_0x3e08cb,_0x268a77))[_0xa4ed('0x32')](handleError(_0x3e08cb,null));};exports['show']=function(_0x17d234,_0xa33886){var _0xb4d254={};if(_0x17d234[_0xa4ed('0x3f')]['type']&&_0x17d234[_0xa4ed('0x3f')]['type']===_0xa4ed('0x4b')){_0xb4d254['from']=_0x17d234['params']['id'];}else{_0xb4d254['id']=_0x17d234[_0xa4ed('0xb1')]['id'];}var _0x4dca70={'raw':![],'where':_0xb4d254},_0x53a9f3={};_0x53a9f3[_0xa4ed('0x3e')]=_[_0xa4ed('0x40')](db[_0xa4ed('0x9b')][_0xa4ed('0x3a')]);_0x53a9f3[_0xa4ed('0x3f')]=_[_0xa4ed('0x40')](_0x17d234[_0xa4ed('0x3f')]);_0x53a9f3[_0xa4ed('0x41')]=_[_0xa4ed('0x42')](_0x53a9f3[_0xa4ed('0x3e')],_0x53a9f3[_0xa4ed('0x3f')]);_0x4dca70[_0xa4ed('0x43')]=_[_0xa4ed('0x42')](_0x53a9f3[_0xa4ed('0x3e')],qs[_0xa4ed('0x44')](_0x17d234[_0xa4ed('0x3f')]['fields']));_0x4dca70['attributes']=_0x4dca70['attributes'][_0xa4ed('0x5b')]?_0x4dca70[_0xa4ed('0x43')]:_0x53a9f3[_0xa4ed('0x3e')];if(_0x17d234[_0xa4ed('0x3f')][_0xa4ed('0xb2')]){_0x4dca70[_0xa4ed('0xb3')]=[{'all':!![]}];}_0x4dca70=_[_0xa4ed('0xb4')]({},_0x4dca70,_0x17d234['options']);return db[_0xa4ed('0x9b')][_0xa4ed('0x5d')](_0x4dca70)[_0xa4ed('0x24')](handleEntityNotFound(_0xa33886,null))[_0xa4ed('0x24')](respondWithResult(_0xa33886,null))['catch'](handleError(_0xa33886,null));};exports[_0xa4ed('0xb5')]=function(_0x317b2,_0x56ab09){return db['OpenchannelInteraction'][_0xa4ed('0xb5')](_0x317b2[_0xa4ed('0x6f')],{})[_0xa4ed('0x24')](respondWithResult(_0x56ab09,0xc9))[_0xa4ed('0x32')](handleError(_0x56ab09,null));};exports[_0xa4ed('0x23')]=function(_0x305eb6,_0x19bb12){if(_0x305eb6['body']['id']){delete _0x305eb6[_0xa4ed('0x6f')]['id'];}return db['OpenchannelInteraction'][_0xa4ed('0x5d')]({'where':{'id':_0x305eb6[_0xa4ed('0xb1')]['id']}})[_0xa4ed('0x24')](handleEntityNotFound(_0x19bb12,null))['then'](saveUpdates(_0x305eb6[_0xa4ed('0x6f')],null))['then'](respondWithResult(_0x19bb12,null))[_0xa4ed('0x32')](handleError(_0x19bb12,null));};exports[_0xa4ed('0x25')]=function(_0x5f114a,_0x3ea514){return db[_0xa4ed('0x9b')][_0xa4ed('0x5d')]({'where':{'id':_0x5f114a[_0xa4ed('0xb1')]['id']}})['then'](handleEntityNotFound(_0x3ea514,null))[_0xa4ed('0x24')](removeEntity(_0x3ea514,null))[_0xa4ed('0x32')](handleError(_0x3ea514,null));};exports[_0xa4ed('0xb6')]=function(_0x25f1b1,_0x3d5450){return db[_0xa4ed('0x9b')]['describe']()[_0xa4ed('0x24')](respondWithResult(_0x3d5450,null))[_0xa4ed('0x32')](handleError(_0x3d5450,null));};exports[_0xa4ed('0xb7')]=function(_0x343f9d,_0x118461,_0x46f437){return db[_0xa4ed('0xb8')]['find']({'where':{'id':_0x343f9d['params']['id']}})['then'](handleEntityNotFound(_0x118461,null))[_0xa4ed('0x24')](function(_0x1c099a){if(_0x1c099a){return _0x1c099a[_0xa4ed('0xb7')](_0x343f9d['body'][_0xa4ed('0xb9')],_[_0xa4ed('0xba')](_0x343f9d[_0xa4ed('0x6f')],[_0xa4ed('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x118461,null))[_0xa4ed('0x32')](handleError(_0x118461,null));};exports[_0xa4ed('0xbb')]=function(_0x356054,_0x1708dc,_0xd08bc6){var _0x3ca6c2={'raw':![],'where':{}};var _0xe3eeed={};var _0x144a33={'count':0x0,'rows':[]};return db[_0xa4ed('0x9b')][_0xa4ed('0xbc')]({'where':{'id':_0x356054[_0xa4ed('0xb1')]['id']}})[_0xa4ed('0x24')](handleEntityNotFound(_0x1708dc,null))['then'](function(_0x2b9fb0){if(_0x2b9fb0){_0xe3eeed[_0xa4ed('0x3e')]=_[_0xa4ed('0x40')](db['OpenchannelMessage'][_0xa4ed('0x3a')]);_0xe3eeed['query']=_['keys'](_0x356054[_0xa4ed('0x3f')]);_0xe3eeed[_0xa4ed('0x41')]=_[_0xa4ed('0x42')](_0xe3eeed['model'],_0xe3eeed[_0xa4ed('0x3f')]);_0x3ca6c2[_0xa4ed('0x43')]=_[_0xa4ed('0x42')](_0xe3eeed[_0xa4ed('0x3e')],qs[_0xa4ed('0x44')](_0x356054[_0xa4ed('0x3f')][_0xa4ed('0x44')]));_0x3ca6c2[_0xa4ed('0x43')]=_0x3ca6c2['attributes'][_0xa4ed('0x5b')]?_0x3ca6c2[_0xa4ed('0x43')]:_0xe3eeed['model'];if(!_0x356054['query'][_0xa4ed('0xbd')]('nolimit')){_0x3ca6c2[_0xa4ed('0x1f')]=qs['limit'](_0x356054[_0xa4ed('0x3f')][_0xa4ed('0x1f')]);_0x3ca6c2[_0xa4ed('0x1e')]=qs[_0xa4ed('0x1e')](_0x356054['query'][_0xa4ed('0x1e')]);}_0x3ca6c2[_0xa4ed('0x8c')]=qs[_0xa4ed('0x46')](_0x356054[_0xa4ed('0x3f')]['sort']);_0x3ca6c2[_0xa4ed('0x47')]=qs[_0xa4ed('0x41')](_[_0xa4ed('0xbe')](_0x356054[_0xa4ed('0x3f')],_0xe3eeed[_0xa4ed('0x41')]));_0x3ca6c2[_0xa4ed('0x47')][_0xa4ed('0xaf')]=_0x2b9fb0['id'];if(_0x356054['query']['filter']){_0x3ca6c2[_0xa4ed('0x47')]=_['merge'](_0x3ca6c2[_0xa4ed('0x47')],{'$or':_[_0xa4ed('0x2b')](_0x3ca6c2[_0xa4ed('0x43')],function(_0x3d2888){var _0x569b40={};_0x569b40[_0x3d2888]={'$like':'%'+_0x356054[_0xa4ed('0x3f')]['filter']+'%'};return _0x569b40;})});}if(_0x356054['query'][_0xa4ed('0x76')]){var _0x388a2d=_0x356054[_0xa4ed('0x3f')]['$gte'][_0xa4ed('0x2f')](',');var _0x2480c1={};_0x2480c1[_0x388a2d[0x0]]={'$gte':moment(_0x388a2d[0x1])[_0xa4ed('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3ca6c2[_0xa4ed('0x47')]=_[_0xa4ed('0xb4')](_0x3ca6c2[_0xa4ed('0x47')],_0x2480c1);}_0x3ca6c2=_['merge']({},_0x3ca6c2,_0x356054[_0xa4ed('0xc0')]);return db[_0xa4ed('0xb8')][_0xa4ed('0x99')]({'where':_0x3ca6c2[_0xa4ed('0x47')]})[_0xa4ed('0x24')](function(_0x43ee16){_0x144a33[_0xa4ed('0x99')]=_0x43ee16;if(_0x356054[_0xa4ed('0x3f')][_0xa4ed('0xb2')]){_0x3ca6c2[_0xa4ed('0xb3')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xa4ed('0xc1')](_0x3ca6c2);})[_0xa4ed('0x24')](function(_0x72c49c){_0x144a33[_0xa4ed('0xb0')]=_0x72c49c;return _0x144a33;});}})['then'](respondWithFilteredResult(_0x1708dc,_0x3ca6c2))[_0xa4ed('0x32')](handleError(_0x1708dc,null));};exports[_0xa4ed('0xc2')]=function(_0x7ad80,_0x271f44,_0x1214f8){return db[_0xa4ed('0x9b')][_0xa4ed('0x5d')]({'where':{'id':_0x7ad80[_0xa4ed('0xb1')]['id']}})['then'](handleEntityNotFound(_0x271f44,null))[_0xa4ed('0x24')](function(_0xdad9c5){if(_0xdad9c5){return _0xdad9c5[_0xa4ed('0xc3')](_0x7ad80[_0xa4ed('0x6f')]['ids'],_[_0xa4ed('0xba')](_0x7ad80[_0xa4ed('0x6f')],[_0xa4ed('0xb9'),'id'])||{})[_0xa4ed('0xc4')](function(){return db['Tag'][_0xa4ed('0xc1')]({'attributes':['id',_0xa4ed('0x28'),_0xa4ed('0x4a')],'where':{'id':_0x7ad80[_0xa4ed('0x6f')]['ids']}});})['then'](function(_0x9c3137){socket[_0xa4ed('0xc5')]('openchannelInteractionTags:save',{'id':Number(_0x7ad80[_0xa4ed('0xb1')]['id']),'tags':_0x9c3137||[]});return{'id':Number(_0x7ad80['params']['id']),'tags':_0x9c3137||[]};});}})[_0xa4ed('0x24')](respondWithResult(_0x271f44,null))[_0xa4ed('0x32')](handleError(_0x271f44,null));};exports['removeTags']=function(_0x5cdc7a,_0x43e4e6,_0x31b3b3){return db['OpenchannelInteraction'][_0xa4ed('0x5d')]({'where':{'id':_0x5cdc7a['params']['id']}})[_0xa4ed('0x24')](handleEntityNotFound(_0x43e4e6,null))['then'](function(_0x32556c){if(_0x32556c){return _0x32556c[_0xa4ed('0xc6')](_0x5cdc7a[_0xa4ed('0x3f')][_0xa4ed('0xb9')]);}})[_0xa4ed('0x24')](respondWithStatusCode(_0x43e4e6,null))[_0xa4ed('0x32')](handleError(_0x43e4e6,null));};exports[_0xa4ed('0xc7')]=function(_0x4e88cd,_0x57d1ee){var _0x3c6ca9=moment()['unix']()[_0xa4ed('0x98')]();var _0x58d9ed=path['join'](config[_0xa4ed('0xc8')],'server',_0xa4ed('0xc9'),_0xa4ed('0xca'));var _0x22cef1=path[_0xa4ed('0xcb')](config[_0xa4ed('0xc8')],_0xa4ed('0xcc'),_0xa4ed('0xc9'),'attachments');var _0x23f6e8=path[_0xa4ed('0xcb')](_0x58d9ed,_0x3c6ca9);var _0x1c2aaf=util[_0xa4ed('0xbf')](_0xa4ed('0xcd'),_0x4e88cd['params']['id'],_0x3c6ca9);var _0x2e3450=path[_0xa4ed('0xcb')](_0x58d9ed,_0x1c2aaf);var _0x481217=[];_0x481217[_0xa4ed('0x31')]({'model':db[_0xa4ed('0xce')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x481217[_0xa4ed('0x31')]({'model':db[_0xa4ed('0xcf')],'as':_0xa4ed('0x63'),'attributes':['id',_0xa4ed('0xd0'),_0xa4ed('0xd1')],'raw':!![]});if(_0x4e88cd['query'][_0xa4ed('0xd2')]){_0x481217[_0xa4ed('0x31')]({'model':db[_0xa4ed('0xd3')],'as':_0xa4ed('0xd3'),'raw':!![]});}var _0x33bcd2=[{'model':db[_0xa4ed('0xb8')],'as':_0xa4ed('0xd4'),'attributes':['id',_0xa4ed('0x6f'),_0xa4ed('0xd5'),_0xa4ed('0xd6'),_0xa4ed('0xd7'),_0xa4ed('0x7b')],'include':_0x481217}];_0x33bcd2[_0xa4ed('0x31')]({'model':db[_0xa4ed('0xd8')],'as':_0xa4ed('0xd9'),'attributes':['id',_0xa4ed('0x28')]});_0x33bcd2['push']({'model':db['User'],'as':_0xa4ed('0xda'),'attributes':['id',_0xa4ed('0x2c')]});return db['OpenchannelInteraction'][_0xa4ed('0x5d')]({'where':{'id':_0x4e88cd[_0xa4ed('0xb1')]['id']},'include':_0x33bcd2})['then'](handleEntityNotFound(_0x57d1ee,null))['then'](function(_0x1ef32b){if(_0x1ef32b){var _0x42eb69=_0x1ef32b['get']({'plain':!![]});fs[_0xa4ed('0xdb')](_0x23f6e8);var _0xbca40f={'channel':_0xa4ed('0xdc'),'account':_0x42eb69[_0xa4ed('0xd9')][_0xa4ed('0x28')],'agent':_0x42eb69['Owner']?_0x42eb69[_0xa4ed('0xda')]['fullname']:_0xa4ed('0xdd'),'createdAt':moment(_0x42eb69[_0xa4ed('0xd5')])[_0xa4ed('0xbf')](_0xa4ed('0xde'))[_0xa4ed('0x98')](),'closedAt':_0x42eb69['closed']?moment(_0x42eb69['closedAt'])[_0xa4ed('0xbf')](_0xa4ed('0xde'))[_0xa4ed('0x98')]():'','disposition':_0x42eb69['disposition'],'visibility':_0x42eb69[_0xa4ed('0xdf')]?_0xa4ed('0xe0'):_0xa4ed('0xe1'),'messages':_(_0x42eb69[_0xa4ed('0xd4')])[_0xa4ed('0x80')]({'secret':![]})[_0xa4ed('0x2b')](function(_0x475505){if(_0x475505[_0xa4ed('0xd3')]){var _0x32080b=path[_0xa4ed('0xcb')](_0x22cef1,_0x475505['Attachment']['basename']);if(fs[_0xa4ed('0xe2')](_0x32080b)){fs[_0xa4ed('0xe3')](_0x32080b)[_0xa4ed('0xe4')](fs[_0xa4ed('0xe5')](path[_0xa4ed('0xcb')](_0x23f6e8,_0x475505[_0xa4ed('0xd3')]['basename'])));}}return{'date':moment(_0x475505[_0xa4ed('0xd5')])[_0xa4ed('0xbf')](_0xa4ed('0xde'))[_0xa4ed('0x98')](),'sender':_0x475505[_0xa4ed('0xd6')]===_0xa4ed('0xe6')?_0x475505[_0xa4ed('0xce')]?_0x475505[_0xa4ed('0xce')][_0xa4ed('0x2c')]:'System':_0x475505['Contact'][_0xa4ed('0xd0')]+(_0x475505[_0xa4ed('0x63')]['lastName']?'\x20'+_0x475505['Contact'][_0xa4ed('0xd1')]:''),'body':_0x475505['Attachment']?_0x475505[_0xa4ed('0xd3')]['basename']:_0x475505[_0xa4ed('0x6f')],'direction':_0x475505[_0xa4ed('0xd6')]===_0xa4ed('0xe6')?'A':'C','secret':_0x475505[_0xa4ed('0xd7')],'read':_0x475505[_0xa4ed('0x7b')],'attachment':_0x475505[_0xa4ed('0xd3')]};})['value']()};return ejs[_0xa4ed('0xe7')](path['join'](config[_0xa4ed('0xc8')],'server','views',_0xa4ed('0xe8')),{'interaction':_0xbca40f})[_0xa4ed('0x24')](function(_0x5734b4){var _0xa13a20=path[_0xa4ed('0xcb')](_0x23f6e8,'transcript-'+_0x42eb69['id']+'-'+_0x3c6ca9+'.pdf');var _0xcb0048={'path':_0xa13a20,'channel':_0xa4ed('0xdc'),'interactionId':_0x42eb69['id']};return pdf[_0xa4ed('0xe9')](_0x5734b4,_0xcb0048);})['then'](function(){return new BPromise(function(_0x44d527,_0x15ed1f){zipdir(_0x23f6e8,{'saveTo':_0x2e3450},function(_0x97ef2d,_0x3f536d){if(_0x97ef2d)return _0x15ed1f(_0x97ef2d);return _0x44d527(_0x3f536d);});})[_0xa4ed('0x24')](function(){return new BPromise(function(_0x3cf695,_0x2b1a28){rimraf(_0x23f6e8,function(_0x5a5d3b){if(_0x5a5d3b)_0x2b1a28(_0x5a5d3b);return _0x3cf695();});});})[_0xa4ed('0x24')](function(){return _0x57d1ee[_0xa4ed('0xc7')](_0x2e3450,_0x1c2aaf,function(_0x46efa7){if(_0x46efa7){console[_0xa4ed('0xea')](_0xa4ed('0xeb'),_0x46efa7);}else{fs[_0xa4ed('0xec')](_0x2e3450);}});});});}else{return _0x57d1ee[_0xa4ed('0x26')](0xc8);}})['catch'](handleError(_0x57d1ee,null));}; \ No newline at end of file +var _0xfd1c=['Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','Users','map','TagIds','Tags','split','catch','answered','unmanaged','total','closed','UserId','talking','waiting','index','OpenchannelInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','text','body','buildExpression','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','params','includeAll','include','create','update','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','findAll','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Owner','mkdirSync','Openchannel','closedAt','disposition','threadId'];(function(_0x3d3cfe,_0x2afef7){var _0x33d6b5=function(_0x3cb86e){while(--_0x3cb86e){_0x3d3cfe['push'](_0x3d3cfe['shift']());}};_0x33d6b5(++_0x2afef7);}(_0xfd1c,0x107));var _0xcfd1=function(_0x3778d8,_0x5ce417){_0x3778d8=_0x3778d8-0x0;var _0x45a1b3=_0xfd1c[_0x3778d8];return _0x45a1b3;};'use strict';var emlformat=require(_0xcfd1('0x0'));var rimraf=require(_0xcfd1('0x1'));var zipdir=require(_0xcfd1('0x2'));var jsonpatch=require(_0xcfd1('0x3'));var rp=require(_0xcfd1('0x4'));var moment=require(_0xcfd1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfd1('0x6'));var path=require('path');var sox=require(_0xcfd1('0x7'));var csv=require(_0xcfd1('0x8'));var ejs=require(_0xcfd1('0x9'));var fs=require('fs');var fs_extra=require(_0xcfd1('0xa'));var _=require(_0xcfd1('0xb'));var squel=require(_0xcfd1('0xc'));var crypto=require('crypto');var jsforce=require(_0xcfd1('0xd'));var deskjs=require(_0xcfd1('0xe'));var toCsv=require(_0xcfd1('0x8'));var querystring=require(_0xcfd1('0xf'));var Papa=require(_0xcfd1('0x10'));var Redis=require(_0xcfd1('0x11'));var authService=require(_0xcfd1('0x12'));var qs=require(_0xcfd1('0x13'));var as=require(_0xcfd1('0x14'));var pdf=require(_0xcfd1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfd1('0x16'))(_0xcfd1('0x17'));var utils=require(_0xcfd1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcfd1('0x19'));var db=require(_0xcfd1('0x1a'))['db'];config[_0xcfd1('0x1b')]=_[_0xcfd1('0x1c')](config['redis'],{'host':_0xcfd1('0x1d'),'port':0x18eb});var socket=require(_0xcfd1('0x1e'))(new Redis(config['redis']));require(_0xcfd1('0x1f'))['register'](socket);function respondWithStatusCode(_0x33166f,_0x2b6312){_0x2b6312=_0x2b6312||0xcc;return function(_0x3a45e7){if(_0x3a45e7){return _0x33166f[_0xcfd1('0x20')](_0x2b6312);}return _0x33166f[_0xcfd1('0x21')](_0x2b6312)[_0xcfd1('0x22')]();};}function respondWithResult(_0x3acd27,_0x5837da){_0x5837da=_0x5837da||0xc8;return function(_0x36e0fb){if(_0x36e0fb){return _0x3acd27[_0xcfd1('0x21')](_0x5837da)['json'](_0x36e0fb);}};}function respondWithFilteredResult(_0x2ab046,_0x4cc976){return function(_0x3a30f8){if(_0x3a30f8){var _0x23782c=typeof _0x4cc976[_0xcfd1('0x23')]==='undefined'&&typeof _0x4cc976['limit']===_0xcfd1('0x24');var _0x8b8c1e=_0x3a30f8[_0xcfd1('0x25')];var _0x18c5bb=_0x23782c?0x0:_0x4cc976[_0xcfd1('0x23')];var _0x12cdc4=_0x23782c?_0x3a30f8['count']:_0x4cc976[_0xcfd1('0x23')]+_0x4cc976[_0xcfd1('0x26')];var _0x4cde94;if(_0x12cdc4>=_0x8b8c1e){_0x12cdc4=_0x8b8c1e;_0x4cde94=0xc8;}else{_0x4cde94=0xce;}_0x2ab046[_0xcfd1('0x21')](_0x4cde94);return _0x2ab046[_0xcfd1('0x27')](_0xcfd1('0x28'),_0x18c5bb+'-'+_0x12cdc4+'/'+_0x8b8c1e)['json'](_0x3a30f8);}return null;};}function patchUpdates(_0x14783a){return function(_0x12cf03){try{jsonpatch[_0xcfd1('0x29')](_0x12cf03,_0x14783a,!![]);}catch(_0x4f4fa2){return BPromise[_0xcfd1('0x2a')](_0x4f4fa2);}return _0x12cf03['save']();};}function saveUpdates(_0x52c5c3,_0x3797d5){return function(_0x575316){if(_0x575316){return _0x575316['update'](_0x52c5c3)['then'](function(_0x45222a){return _0x45222a;});}return null;};}function removeEntity(_0x25a41e,_0x2c67e6){return function(_0x3587e7){if(_0x3587e7){return _0x3587e7[_0xcfd1('0x2b')]()[_0xcfd1('0x2c')](function(){_0x25a41e[_0xcfd1('0x21')](0xcc)[_0xcfd1('0x22')]();});}};}function handleEntityNotFound(_0x2bc34c,_0x5be914){return function(_0x5f5549){if(!_0x5f5549){_0x2bc34c[_0xcfd1('0x20')](0x194);}return _0x5f5549;};}function handleError(_0x287b4a,_0x13e08f){_0x13e08f=_0x13e08f||0x1f4;return function(_0x4fb1d6){logger[_0xcfd1('0x2d')](_0x4fb1d6[_0xcfd1('0x2e')]);if(_0x4fb1d6[_0xcfd1('0x2f')]){delete _0x4fb1d6[_0xcfd1('0x2f')];}_0x287b4a[_0xcfd1('0x21')](_0x13e08f)[_0xcfd1('0x30')](_0x4fb1d6);};}function getInteractionUsers(_0x3966d5,_0x582b7b){return new BPromise(function(_0x3b64dc,_0x2ad673){try{if(_0x582b7b[_0x3966d5['id']]){_0x3966d5[_0xcfd1('0x31')]=_[_0xcfd1('0x32')](_0x582b7b[_0x3966d5['id']],function(_0x3bc18f){return{'id':_0x3bc18f['id'],'fullname':_0x3bc18f['fullname']};});}}catch(_0x324562){_0x2ad673(_0x324562);}_0x3b64dc(_0x3966d5);});}function getInteractionTags(_0x27ca47,_0x15d909){return new BPromise(function(_0x29e0ba,_0x35baac){try{if(_0x27ca47[_0xcfd1('0x33')]){_0x27ca47[_0xcfd1('0x34')]=[];_0x27ca47[_0xcfd1('0x33')][_0xcfd1('0x35')](',')['forEach'](function(_0x6cf3a8){_0x27ca47['Tags']['push'](_0x15d909[_0x6cf3a8]);});}delete _0x27ca47['TagIds'];}catch(_0x371e0a){_0x35baac(_0x371e0a);}_0x29e0ba(_0x27ca47);});}function updateOpenchannelInteraction(_0x5d1cca,_0xe4665d,_0x4f62f7){return new BPromise(function(_0x8410cd,_0x348474){return getInteractionUsers(_0x5d1cca,_0x4f62f7)[_0xcfd1('0x2c')](function(_0x287398){return getInteractionTags(_0x287398,_0xe4665d);})['then'](function(_0x12c8c8){return getStateInteraction(_0x12c8c8);})[_0xcfd1('0x2c')](function(_0x232b76){_0x8410cd(_0x232b76);})[_0xcfd1('0x36')](function(_0x1c418c){_0x348474(_0x1c418c);});});}function getStateInteraction(_0x4c03b4){return new BPromise(function(_0x2c5f89){_0x4c03b4['waiting']=0x0;_0x4c03b4['talking']=0x0;_0x4c03b4[_0xcfd1('0x37')]=0x0;_0x4c03b4[_0xcfd1('0x38')]=0x0;_0x4c03b4[_0xcfd1('0x39')]=0x0;if(!_0x4c03b4[_0xcfd1('0x3a')]&&!_0x4c03b4['UserId']){_0x4c03b4['waiting']+=0x1;}if(!_0x4c03b4['closed']&&_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x3c')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3d')]){_0x4c03b4[_0xcfd1('0x3d')]-=0x1;}}if(_0x4c03b4[_0xcfd1('0x3a')]&&_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x37')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3c')]){_0x4c03b4[_0xcfd1('0x3c')]-=0x1;}}if(_0x4c03b4[_0xcfd1('0x3a')]&&!_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x38')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3d')]){_0x4c03b4[_0xcfd1('0x3d')]-=0x1;}}_0x4c03b4[_0xcfd1('0x39')]+=0x1;_0x2c5f89(_0x4c03b4);});}exports[_0xcfd1('0x3e')]=function(_0x5c242c,_0x2b0f66){var _0x45e607={},_0xe6ade2={},_0x48e80d={'count':0x0,'rows':[]};var _0x3794b5=_[_0xcfd1('0x32')](db[_0xcfd1('0x3f')][_0xcfd1('0x40')],function(_0x3e821e){return{'name':_0x3e821e[_0xcfd1('0x41')],'type':_0x3e821e['type']['key']};});_0xe6ade2[_0xcfd1('0x42')]=_['map'](_0x3794b5,_0xcfd1('0x2f'));_0xe6ade2[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x5c242c[_0xcfd1('0x43')]);_0xe6ade2[_0xcfd1('0x45')]=_[_0xcfd1('0x46')](_0xe6ade2[_0xcfd1('0x42')],_0xe6ade2[_0xcfd1('0x43')]);_0x45e607[_0xcfd1('0x47')]=_['intersection'](_0xe6ade2[_0xcfd1('0x42')],qs[_0xcfd1('0x48')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x48')]));_0x45e607[_0xcfd1('0x47')]=_0x45e607[_0xcfd1('0x47')][_0xcfd1('0x49')]?_0x45e607[_0xcfd1('0x47')]:_0xe6ade2[_0xcfd1('0x42')];if(!_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x4a')]('nolimit')){_0x45e607[_0xcfd1('0x26')]=qs[_0xcfd1('0x26')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x26')]);_0x45e607[_0xcfd1('0x23')]=qs[_0xcfd1('0x23')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x23')]);}_0x45e607[_0xcfd1('0x4b')]=qs[_0xcfd1('0x4c')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x4c')]);_0x45e607[_0xcfd1('0x4d')]=qs[_0xcfd1('0x45')](_['pick'](_0x5c242c[_0xcfd1('0x43')],_0xe6ade2[_0xcfd1('0x45')]),_0x3794b5);var _0x73f6dc=[];var _0xd83b12=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x4f')]('id')[_0xcfd1('0x4f')](_0xcfd1('0x2f'))['field'](_0xcfd1('0x50'))['from'](_0xcfd1('0x51'));var _0xcde407=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x4f')]('u.id')['field'](_0xcfd1('0x52'))[_0xcfd1('0x4f')](_0xcfd1('0x53'))[_0xcfd1('0x54')](_0xcfd1('0x55'),'ui')[_0xcfd1('0x56')](_0xcfd1('0x57'),'u',_0xcfd1('0x58'));var _0x343301=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x54')](_0xcfd1('0x59'),'i')[_0xcfd1('0x56')](_0xcfd1('0x5a'),'c',_0xcfd1('0x5b'))[_0xcfd1('0x56')]('users','o',_0xcfd1('0x5c'))[_0xcfd1('0x56')](_0xcfd1('0x5d'),'a',_0xcfd1('0x5e'))[_0xcfd1('0x56')]('openchannel_messages','me',_0xcfd1('0x5f'))['left_join']('openchannel_interaction_has_tags','it',_0xcfd1('0x60'))[_0xcfd1('0x56')](_0xcfd1('0x51'),'t','t.id\x20=\x20it.TagId');var _0x7b8987=squel[_0xcfd1('0x61')]();var _0x38e77c=[];var _0x28f123=squel[_0xcfd1('0x61')]();var _0x460aed;if(_0x5c242c['query'][_0xcfd1('0x62')]){_0x460aed=as[_0xcfd1('0x63')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x62')]);var _0xe6a494=_0x460aed[_0xcfd1('0x64')];for(var _0x320672=0x0;_0x320672<_0x460aed[_0xcfd1('0x65')][_0xcfd1('0x49')];_0x320672++){var _0x5cdd33=_0x460aed[_0xcfd1('0x65')][_0x320672];var _0x2930a7='i';var _0x178f7b=_['find'](_0x3794b5,['name',_0x5cdd33[_0xcfd1('0x4f')]]);if(!_0x178f7b){switch(_0x5cdd33[_0xcfd1('0x4f')]){case _0xcfd1('0x66'):if(_0x5cdd33[_0xcfd1('0x67')]==0x1){_0x343301[_0xcfd1('0x68')]('`'+_0x5cdd33['field']+_0xcfd1('0x69'));}else{_0x343301[_0xcfd1('0x68')]('`'+_0x5cdd33[_0xcfd1('0x4f')]+_0xcfd1('0x6a'));}break;case _0xcfd1('0x6b'):if(_0x5cdd33[_0xcfd1('0x6c')]===_0xcfd1('0x6d')){if(_0x5cdd33[_0xcfd1('0x67')][_0xcfd1('0x35')]('\x20')[_0xcfd1('0x49')]>0x1){_0x7b8987[_0xe6a494]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcfd1('0x6e')](_0x5cdd33['value']),null);}else{var _0x477884='%'+_0x5cdd33['value']+'%';_0x7b8987[_0xe6a494](_0xcfd1('0x6f'),_0x477884,_0x477884,_0x477884);}}else{_0x178f7b=_[_0xcfd1('0x70')](_0x3794b5,[_0xcfd1('0x2f'),_0xcfd1('0x71')]);_0x5cdd33[_0xcfd1('0x4f')]=_0xcfd1('0x71');_0x354762=as['buildExpression'](_0x2930a7,_0x178f7b['type'],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762['text'],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')]['end']);}break;case _0xcfd1('0x73'):var _0x37f8d8=_0x5cdd33['value'][_0xcfd1('0x35')](',')[_0xcfd1('0x32')](function(_0x478f20){return Number(_0x478f20);});_0x37f8d8[_0xcfd1('0x74')](function(_0x25c140){_0x28f123['or'](_0xcfd1('0x75'),'%,'+_0x25c140+',%');});_0x38e77c=_[_0xcfd1('0x76')](_0x38e77c,_0x37f8d8);break;case _0xcfd1('0x77'):if(_0x5cdd33[_0xcfd1('0x6c')]===_0xcfd1('0x6d')){_0x7b8987[_0xe6a494](_0xcfd1('0x78'),'%'+_0x5cdd33[_0xcfd1('0x67')]+'%',null);}else{_0x178f7b=_[_0xcfd1('0x70')](_0x3794b5,[_0xcfd1('0x2f'),_0xcfd1('0x3b')]);_0x5cdd33['field']=_0xcfd1('0x3b');_0x354762=as['buildExpression'](_0x2930a7,_0x178f7b[_0xcfd1('0x79')],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762[_0xcfd1('0x7a')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762['value'][_0xcfd1('0x22')]);}break;case _0xcfd1('0x7b'):_0x354762=as[_0xcfd1('0x7c')]('me',null,_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762['text'],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x22')]);break;}}else{var _0x354762=as['buildExpression'](_0x2930a7,_0x178f7b[_0xcfd1('0x79')],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762[_0xcfd1('0x7a')],_0x354762['value'][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x22')]);}}}else{var _0x1a01cf=_(_0x5c242c[_0xcfd1('0x43')])[_0xcfd1('0x44')]()[_0xcfd1('0x32')](function(_0x1129dd){return _[_0xcfd1('0x7d')](_0x3794b5,[_0xcfd1('0x2f'),_0x1129dd])?_0x1129dd:undefined;})[_0xcfd1('0x7e')]()['value']();if(!_[_0xcfd1('0x7f')](_0x1a01cf)){_0x1a01cf[_0xcfd1('0x74')](function(_0x2db28a){if(_0x2db28a==='OpenchannelAccountId'){_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x80'),[][_0xcfd1('0x81')](_0x5c242c[_0xcfd1('0x43')][_0x2db28a]));}else if(_0x2db28a===_0xcfd1('0x82')){var _0x691c06=JSON[_0xcfd1('0x83')](_0x5c242c['query'][_0x2db28a])[_0xcfd1('0x84')];var _0x45693f=JSON['parse'](_0x5c242c[_0xcfd1('0x43')][_0x2db28a])['$lte'];_0x343301[_0xcfd1('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x691c06,_0x45693f);}else{if(_0x5c242c[_0xcfd1('0x43')][_0x2db28a]===_0xcfd1('0x85')){_0x343301['where']('i.'+_0x2db28a+_0xcfd1('0x86'));}else{_0x343301['where']('i.'+_0x2db28a+'\x20=\x20?',_0x5c242c[_0xcfd1('0x43')][_0x2db28a]);}}});}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x87')]){if(_0x5c242c['query'][_0xcfd1('0x87')]==0x1){_0x343301['having']('`unreadMessages`\x20=\x200');}else{_0x343301[_0xcfd1('0x68')](_0xcfd1('0x88'));}}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x89')]){_0x38e77c=_[_0xcfd1('0x8a')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x89')])?_0x5c242c['query']['tag']:new Array(_0x5c242c['query'][_0xcfd1('0x89')]);_0x38e77c[_0xcfd1('0x74')](function(_0x5a23a8){_0x28f123['or'](_0xcfd1('0x75'),'%,'+_0x5a23a8+',%');});}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x8b')]){var _0x168335=_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x8b')]['replace']('\x5c','\x5c\x5c')[_0xcfd1('0x8c')](/'/g,'\x27\x27');if(qs[_0xcfd1('0x8d')](_0x168335)){_0x7b8987['or']('i.id\x20LIKE\x20?',_0x168335+'%');}else{_0x7b8987['or'](_0xcfd1('0x8e'),qs[_0xcfd1('0x6e')](_0x168335))['or'](_0xcfd1('0x8f'),_0x168335+'%')['or'](_0xcfd1('0x90'),_0x168335+'%');}}}_0x343301[_0xcfd1('0x4d')](_0x7b8987);_0x343301[_0xcfd1('0x91')](_0xcfd1('0x92'));var _0x1dc896={'type':db[_0xcfd1('0x93')][_0xcfd1('0x94')][_0xcfd1('0x95')],'raw':!![]};var _0x5acaaa=_0x343301['clone']();_0x5acaaa[_0xcfd1('0x4f')]('i.id');_0x5acaaa[_0xcfd1('0x4f')](_0xcfd1('0x96'),_0xcfd1('0x66'));if(_0x45e607[_0xcfd1('0x4b')]){_0x45e607[_0xcfd1('0x4b')][_0xcfd1('0x74')](function(_0x23c6c2){var _0xd36d68=_0x23c6c2[0x0]===_0xcfd1('0x97')?_0x23c6c2[0x0]:'i.'+_0x23c6c2[0x0];_0x343301[_0xcfd1('0x4b')](_0xd36d68,_0x23c6c2[0x1]===_0xcfd1('0x98')?![]:!![]);});}if(!_[_0xcfd1('0x7f')](_0x38e77c)){_0x343301[_0xcfd1('0x68')](_0x28f123);_0x5acaaa[_0xcfd1('0x4d')](_0xcfd1('0x99'),_0x38e77c);}BPromise[_0xcfd1('0x9a')]()[_0xcfd1('0x2c')](function(){if(!_0x460aed){if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x9b')])return;_0x5acaaa['where'](_0xcfd1('0x9c'));_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x9c'));return;}if(_0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0x9e')]!==_0xcfd1('0x9f'))return;return _0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0xa0')]({'attributes':['id'],'raw':!![]})[_0xcfd1('0x2c')](function(_0x29be27){if(_[_0xcfd1('0x7f')](_0x29be27)){_0x5acaaa['where'](_0xcfd1('0xa1'));_0x343301['where'](_0xcfd1('0xa1'));}else{_0x5acaaa['where'](_0xcfd1('0x80'),_[_0xcfd1('0x32')](_0x29be27,'id'));_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x80'),_['map'](_0x29be27,'id'));}});})[_0xcfd1('0x2c')](function(){if(_0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0x9e')]===_0xcfd1('0x9f')&&!_0x460aed&&!_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x9b')])return[];return db['sequelize'][_0xcfd1('0x43')](_0x5acaaa[_0xcfd1('0xa2')](),_0x1dc896);})[_0xcfd1('0x2c')](function(_0x55c6ff){_0x48e80d['count']=_0x55c6ff[_0xcfd1('0x49')];if(_0x48e80d[_0xcfd1('0x25')]===0x0)return[];return db[_0xcfd1('0xa3')][_0xcfd1('0x43')](_0xd83b12[_0xcfd1('0xa2')](),_0x1dc896)[_0xcfd1('0x2c')](function(_0x4466dc){_0x73f6dc=_[_0xcfd1('0xa4')](_0x4466dc,'id');_0x1dc896=_[_0xcfd1('0xa5')](_0x1dc896,{'model':db[_0xcfd1('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c242c[_0xcfd1('0x43')]['fields']){_0x45e607[_0xcfd1('0x47')][_0xcfd1('0x74')](function(_0x295b1d){_0x343301[_0xcfd1('0x4f')]('i.'+_0x295b1d);});}else{_0x343301['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcfd1('0x66'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa6'),_0xcfd1('0xa7'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa8'),'Account.mandatoryDisposition');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa9'),_0xcfd1('0x97'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xaa'));_0x343301[_0xcfd1('0x4f')]('c.firstName','Contact.firstName');_0x343301['field'](_0xcfd1('0xab'),'Contact.lastName');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xac'),_0xcfd1('0xad'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xae'),_0xcfd1('0xaf'));_0x343301['field'](_0xcfd1('0xb0'),_0xcfd1('0xb1'));_0x343301['field'](_0xcfd1('0xb2'),_0xcfd1('0xb3'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xb4'),_0xcfd1('0xb5'));_0x343301[_0xcfd1('0x4f')]('o.internal','Owner.internal');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xb6'),'TagIds');}if(_0x45e607['limit'])_0x343301[_0xcfd1('0x26')](_0x45e607['limit']);if(_0x45e607[_0xcfd1('0x23')])_0x343301[_0xcfd1('0x23')](_0x45e607[_0xcfd1('0x23')]);return db[_0xcfd1('0xa3')]['query'](_0x343301[_0xcfd1('0xa2')](),_0x1dc896);})['then'](function(_0x2e251f){if(_0x2e251f[_0xcfd1('0x49')]>0x0)_0xcde407[_0xcfd1('0x4d')](_0xcfd1('0xb7'),_['map'](_0x2e251f,'id'));return db[_0xcfd1('0xa3')][_0xcfd1('0x43')](_0xcde407[_0xcfd1('0xa2')](),_0x1dc896)[_0xcfd1('0x2c')](function(_0x4360ab){var _0x2a9e82=_[_0xcfd1('0xb8')](_0x4360ab,_0xcfd1('0xb9'));var _0x4c735f=[];_0x2e251f[_0xcfd1('0x74')](function(_0x55b747){_0x4c735f[_0xcfd1('0xba')](updateOpenchannelInteraction(_0x55b747,_0x73f6dc,_0x2a9e82));});return BPromise['all'](_0x4c735f);});});})[_0xcfd1('0x2c')](function(_0x19b761){_0x48e80d['rows']=_0x19b761;return _0x48e80d;})[_0xcfd1('0x2c')](respondWithFilteredResult(_0x2b0f66,_0x45e607))[_0xcfd1('0x36')](handleError(_0x2b0f66,null));};exports['show']=function(_0x183320,_0x4ac5c7){var _0x29df3e={};if(_0x183320['query'][_0xcfd1('0x79')]&&_0x183320[_0xcfd1('0x43')][_0xcfd1('0x79')]===_0xcfd1('0x54')){_0x29df3e['from']=_0x183320[_0xcfd1('0xbb')]['id'];}else{_0x29df3e['id']=_0x183320['params']['id'];}var _0x409e3d={'raw':![],'where':_0x29df3e},_0x5a5760={};_0x5a5760['model']=_[_0xcfd1('0x44')](db[_0xcfd1('0x3f')][_0xcfd1('0x40')]);_0x5a5760[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x183320[_0xcfd1('0x43')]);_0x5a5760[_0xcfd1('0x45')]=_[_0xcfd1('0x46')](_0x5a5760[_0xcfd1('0x42')],_0x5a5760[_0xcfd1('0x43')]);_0x409e3d[_0xcfd1('0x47')]=_[_0xcfd1('0x46')](_0x5a5760[_0xcfd1('0x42')],qs[_0xcfd1('0x48')](_0x183320['query'][_0xcfd1('0x48')]));_0x409e3d[_0xcfd1('0x47')]=_0x409e3d[_0xcfd1('0x47')]['length']?_0x409e3d['attributes']:_0x5a5760[_0xcfd1('0x42')];if(_0x183320[_0xcfd1('0x43')][_0xcfd1('0xbc')]){_0x409e3d[_0xcfd1('0xbd')]=[{'all':!![]}];}_0x409e3d=_[_0xcfd1('0xa5')]({},_0x409e3d,_0x183320['options']);return db[_0xcfd1('0x3f')][_0xcfd1('0x70')](_0x409e3d)['then'](handleEntityNotFound(_0x4ac5c7,null))[_0xcfd1('0x2c')](respondWithResult(_0x4ac5c7,null))['catch'](handleError(_0x4ac5c7,null));};exports[_0xcfd1('0xbe')]=function(_0x2f5a3b,_0x5f417c){return db[_0xcfd1('0x3f')]['create'](_0x2f5a3b[_0xcfd1('0x7b')],{})[_0xcfd1('0x2c')](respondWithResult(_0x5f417c,0xc9))[_0xcfd1('0x36')](handleError(_0x5f417c,null));};exports[_0xcfd1('0xbf')]=function(_0x2f6501,_0x47a11b){if(_0x2f6501['body']['id']){delete _0x2f6501[_0xcfd1('0x7b')]['id'];}return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x2f6501['params']['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x47a11b,null))[_0xcfd1('0x2c')](saveUpdates(_0x2f6501[_0xcfd1('0x7b')],null))[_0xcfd1('0x2c')](respondWithResult(_0x47a11b,null))['catch'](handleError(_0x47a11b,null));};exports[_0xcfd1('0x2b')]=function(_0x2aac8a,_0x3f087f){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x2aac8a[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x3f087f,null))[_0xcfd1('0x2c')](removeEntity(_0x3f087f,null))[_0xcfd1('0x36')](handleError(_0x3f087f,null));};exports['describe']=function(_0x2847e4,_0x428c1b){return db['OpenchannelInteraction'][_0xcfd1('0xc0')]()[_0xcfd1('0x2c')](respondWithResult(_0x428c1b,null))['catch'](handleError(_0x428c1b,null));};exports[_0xcfd1('0xc1')]=function(_0x2c0817,_0x43e910,_0xa3d075){return db[_0xcfd1('0xc2')][_0xcfd1('0x70')]({'where':{'id':_0x2c0817[_0xcfd1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x43e910,null))[_0xcfd1('0x2c')](function(_0x4bbae6){if(_0x4bbae6){return _0x4bbae6[_0xcfd1('0xc1')](_0x2c0817[_0xcfd1('0x7b')][_0xcfd1('0xc3')],_['omit'](_0x2c0817[_0xcfd1('0x7b')],['ids','id'])||{});}})[_0xcfd1('0x2c')](respondWithResult(_0x43e910,null))[_0xcfd1('0x36')](handleError(_0x43e910,null));};exports[_0xcfd1('0xc4')]=function(_0x135903,_0x6e2a82,_0x2783f5){var _0x488a33={'raw':![],'where':{}};var _0x3bb69f={};var _0x3497c5={'count':0x0,'rows':[]};return db[_0xcfd1('0x3f')][_0xcfd1('0xc5')]({'where':{'id':_0x135903[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x6e2a82,null))[_0xcfd1('0x2c')](function(_0x551492){if(_0x551492){_0x3bb69f[_0xcfd1('0x42')]=_[_0xcfd1('0x44')](db[_0xcfd1('0xc2')][_0xcfd1('0x40')]);_0x3bb69f['query']=_[_0xcfd1('0x44')](_0x135903['query']);_0x3bb69f[_0xcfd1('0x45')]=_['intersection'](_0x3bb69f[_0xcfd1('0x42')],_0x3bb69f[_0xcfd1('0x43')]);_0x488a33[_0xcfd1('0x47')]=_[_0xcfd1('0x46')](_0x3bb69f[_0xcfd1('0x42')],qs['fields'](_0x135903[_0xcfd1('0x43')]['fields']));_0x488a33['attributes']=_0x488a33[_0xcfd1('0x47')][_0xcfd1('0x49')]?_0x488a33[_0xcfd1('0x47')]:_0x3bb69f[_0xcfd1('0x42')];if(!_0x135903[_0xcfd1('0x43')][_0xcfd1('0x4a')](_0xcfd1('0xc6'))){_0x488a33[_0xcfd1('0x26')]=qs[_0xcfd1('0x26')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x26')]);_0x488a33['offset']=qs[_0xcfd1('0x23')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x23')]);}_0x488a33['order']=qs[_0xcfd1('0x4c')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x4c')]);_0x488a33[_0xcfd1('0x4d')]=qs[_0xcfd1('0x45')](_[_0xcfd1('0xc7')](_0x135903['query'],_0x3bb69f[_0xcfd1('0x45')]));_0x488a33['where'][_0xcfd1('0xb9')]=_0x551492['id'];if(_0x135903['query'][_0xcfd1('0x8b')]){_0x488a33['where']=_[_0xcfd1('0xa5')](_0x488a33[_0xcfd1('0x4d')],{'$or':_['map'](_0x488a33[_0xcfd1('0x47')],function(_0x4ffbd8){var _0x3c5808={};_0x3c5808[_0x4ffbd8]={'$like':'%'+_0x135903[_0xcfd1('0x43')][_0xcfd1('0x8b')]+'%'};return _0x3c5808;})});}if(_0x135903[_0xcfd1('0x43')][_0xcfd1('0x84')]){var _0x2dc26d=_0x135903[_0xcfd1('0x43')][_0xcfd1('0x84')][_0xcfd1('0x35')](',');var _0x1b5557={};_0x1b5557[_0x2dc26d[0x0]]={'$gte':moment(_0x2dc26d[0x1])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))};_0x488a33[_0xcfd1('0x4d')]=_[_0xcfd1('0xa5')](_0x488a33['where'],_0x1b5557);}_0x488a33=_[_0xcfd1('0xa5')]({},_0x488a33,_0x135903[_0xcfd1('0xca')]);return db['OpenchannelMessage']['count']({'where':_0x488a33[_0xcfd1('0x4d')]})[_0xcfd1('0x2c')](function(_0x4c3481){_0x3497c5[_0xcfd1('0x25')]=_0x4c3481;if(_0x135903[_0xcfd1('0x43')][_0xcfd1('0xbc')]){_0x488a33[_0xcfd1('0xbd')]=[{'all':!![]}];}return db[_0xcfd1('0xc2')]['findAll'](_0x488a33);})[_0xcfd1('0x2c')](function(_0x289b7c){_0x3497c5[_0xcfd1('0xcb')]=_0x289b7c;return _0x3497c5;});}})[_0xcfd1('0x2c')](respondWithFilteredResult(_0x6e2a82,_0x488a33))['catch'](handleError(_0x6e2a82,null));};exports[_0xcfd1('0xcc')]=function(_0x183afd,_0x14b32a,_0x38f3a8){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x183afd[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x14b32a,null))[_0xcfd1('0x2c')](function(_0x2511db){if(_0x2511db){return _0x2511db[_0xcfd1('0xcd')](_0x183afd[_0xcfd1('0x7b')][_0xcfd1('0xc3')],_['omit'](_0x183afd[_0xcfd1('0x7b')],[_0xcfd1('0xc3'),'id'])||{})[_0xcfd1('0xce')](function(){return db[_0xcfd1('0x73')][_0xcfd1('0xcf')]({'attributes':['id',_0xcfd1('0x2f'),_0xcfd1('0x50')],'where':{'id':_0x183afd[_0xcfd1('0x7b')][_0xcfd1('0xc3')]}});})[_0xcfd1('0x2c')](function(_0x519596){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x183afd[_0xcfd1('0xbb')]['id']),'tags':_0x519596||[]});return{'id':Number(_0x183afd[_0xcfd1('0xbb')]['id']),'tags':_0x519596||[]};});}})['then'](respondWithResult(_0x14b32a,null))[_0xcfd1('0x36')](handleError(_0x14b32a,null));};exports[_0xcfd1('0xd0')]=function(_0x52beb3,_0x254328,_0x3f57ad){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x52beb3[_0xcfd1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x254328,null))[_0xcfd1('0x2c')](function(_0x1efa53){if(_0x1efa53){return _0x1efa53[_0xcfd1('0xd0')](_0x52beb3[_0xcfd1('0x43')][_0xcfd1('0xc3')]);}})[_0xcfd1('0x2c')](respondWithStatusCode(_0x254328,null))['catch'](handleError(_0x254328,null));};exports[_0xcfd1('0xd1')]=function(_0x58663f,_0x2d5f70){var _0x28ff46=moment()['unix']()[_0xcfd1('0xa2')]();var _0x4fabce=path[_0xcfd1('0xd2')](config[_0xcfd1('0xd3')],_0xcfd1('0xd4'),_0xcfd1('0xd5'),_0xcfd1('0xd6'));var _0x58a1d0=path[_0xcfd1('0xd2')](config[_0xcfd1('0xd3')],_0xcfd1('0xd4'),_0xcfd1('0xd5'),_0xcfd1('0xd7'));var _0x155ff2=path[_0xcfd1('0xd2')](_0x4fabce,_0x28ff46);var _0x154587=util['format'](_0xcfd1('0xd8'),_0x58663f[_0xcfd1('0xbb')]['id'],_0x28ff46);var _0x3eab77=path[_0xcfd1('0xd2')](_0x4fabce,_0x154587);var _0x164dd2=[];_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0x77')],'as':_0xcfd1('0x77'),'attributes':['id',_0xcfd1('0xd9')],'raw':!![]});_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0xda')],'as':_0xcfd1('0x6b'),'attributes':['id',_0xcfd1('0xdb'),_0xcfd1('0xdc')],'raw':!![]});if(_0x58663f[_0xcfd1('0x43')][_0xcfd1('0xd7')]){_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0xdd')],'as':_0xcfd1('0xdd'),'raw':!![]});}var _0x55c946=[{'model':db['OpenchannelMessage'],'as':_0xcfd1('0xde'),'attributes':['id',_0xcfd1('0x7b'),_0xcfd1('0x82'),_0xcfd1('0xdf'),_0xcfd1('0xe0'),_0xcfd1('0x87')],'include':_0x164dd2}];_0x55c946[_0xcfd1('0xba')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x55c946['push']({'model':db[_0xcfd1('0x77')],'as':_0xcfd1('0xe1'),'attributes':['id',_0xcfd1('0xd9')]});return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x58663f[_0xcfd1('0xbb')]['id']},'include':_0x55c946})[_0xcfd1('0x2c')](handleEntityNotFound(_0x2d5f70,null))[_0xcfd1('0x2c')](function(_0x3b24e2){if(_0x3b24e2){var _0x5c6e4d=_0x3b24e2['get']({'plain':!![]});fs[_0xcfd1('0xe2')](_0x155ff2);var _0x567160={'channel':_0xcfd1('0xe3'),'account':_0x5c6e4d['Account'][_0xcfd1('0x2f')],'agent':_0x5c6e4d[_0xcfd1('0xe1')]?_0x5c6e4d['Owner']['fullname']:'N.A.','createdAt':moment(_0x5c6e4d[_0xcfd1('0x82')])[_0xcfd1('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5c6e4d[_0xcfd1('0x3a')]?moment(_0x5c6e4d[_0xcfd1('0xe4')])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))[_0xcfd1('0xa2')]():'','disposition':_0x5c6e4d[_0xcfd1('0xe5')],'visibility':_0x5c6e4d[_0xcfd1('0xe6')]?_0xcfd1('0xe7'):_0xcfd1('0xe8'),'messages':_(_0x5c6e4d['Messages'])[_0xcfd1('0x8b')]({'secret':![]})[_0xcfd1('0x32')](function(_0x59b793){if(_0x59b793[_0xcfd1('0xdd')]){var _0x4a2128=path[_0xcfd1('0xd2')](_0x58a1d0,_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')]);if(fs[_0xcfd1('0xea')](_0x4a2128)){fs[_0xcfd1('0xeb')](_0x4a2128)[_0xcfd1('0xec')](fs[_0xcfd1('0xed')](path[_0xcfd1('0xd2')](_0x155ff2,_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')])));}}return{'date':moment(_0x59b793[_0xcfd1('0x82')])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))[_0xcfd1('0xa2')](),'sender':_0x59b793['direction']===_0xcfd1('0xee')?_0x59b793['User']?_0x59b793[_0xcfd1('0x77')][_0xcfd1('0xd9')]:_0xcfd1('0xef'):_0x59b793['Contact']['firstName']+(_0x59b793[_0xcfd1('0x6b')]['lastName']?'\x20'+_0x59b793['Contact'][_0xcfd1('0xdc')]:''),'body':_0x59b793[_0xcfd1('0xdd')]?_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')]:_0x59b793[_0xcfd1('0x7b')],'direction':_0x59b793['direction']===_0xcfd1('0xee')?'A':'C','secret':_0x59b793[_0xcfd1('0xe0')],'read':_0x59b793[_0xcfd1('0x87')],'attachment':_0x59b793['Attachment']};})[_0xcfd1('0x67')]()};return ejs[_0xcfd1('0xf0')](path[_0xcfd1('0xd2')](config['root'],_0xcfd1('0xd4'),'views',_0xcfd1('0xf1')),{'interaction':_0x567160})[_0xcfd1('0x2c')](function(_0x52d15e){var _0x5af624=path[_0xcfd1('0xd2')](_0x155ff2,_0xcfd1('0xf2')+_0x5c6e4d['id']+'-'+_0x28ff46+_0xcfd1('0xf3'));var _0x139377={'path':_0x5af624,'channel':_0xcfd1('0xe3'),'interactionId':_0x5c6e4d['id']};return pdf[_0xcfd1('0xf4')](_0x52d15e,_0x139377);})[_0xcfd1('0x2c')](function(){return new BPromise(function(_0x30c84b,_0x4733df){zipdir(_0x155ff2,{'saveTo':_0x3eab77},function(_0x5163d8,_0x2d3a12){if(_0x5163d8)return _0x4733df(_0x5163d8);return _0x30c84b(_0x2d3a12);});})['then'](function(){return new BPromise(function(_0x26e60c,_0x4dabe2){rimraf(_0x155ff2,function(_0x414d75){if(_0x414d75)_0x4dabe2(_0x414d75);return _0x26e60c();});});})['then'](function(){return _0x2d5f70['download'](_0x3eab77,_0x154587,function(_0x1312e7){if(_0x1312e7){console[_0xcfd1('0xf5')]('err',_0x1312e7);}else{fs[_0xcfd1('0xf6')](_0x3eab77);}});});});}else{return _0x2d5f70[_0xcfd1('0x20')](0xc8);}})[_0xcfd1('0x36')](handleError(_0x2d5f70,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d80bd5d..12dbdce 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 _0xe5bb=['hook','exports','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe5bb,0x1a4));var _0xbe5b=function(_0x2e8202,_0x5d2a66){_0x2e8202=_0x2e8202-0x0;var _0x4b18c6=_0xe5bb[_0x2e8202];return _0x4b18c6;};'use strict';var EventEmitter=require(_0xbe5b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xbe5b('0x1')];var OpenchannelMessage=require(_0xbe5b('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbe5b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe5b('0x4'),'afterDestroy':_0xbe5b('0x5')};function emitEvent(_0x3399c3){return function(_0x635d9,_0x3a9eb5,_0x25262a){_0x635d9[_0xbe5b('0x6')]({'attributes':['id'],'raw':!![]})[_0xbe5b('0x7')](function(_0x4b8c97){_0x635d9[_0xbe5b('0x8')](_0xbe5b('0x9'),_0x4b8c97[_0xbe5b('0xa')](function(_0x3f2f7a){return{'id':_0x3f2f7a['id']};}));return OpenchannelMessage[_0xbe5b('0xb')]({'where':{'OpenchannelInteractionId':_0x635d9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe5b('0x7')](function(_0x487460){_0x635d9['setDataValue'](_0xbe5b('0xc'),_0x487460[_0xbe5b('0xd')]);OpenchannelInteractionEvents[_0xbe5b('0xe')](_0x3399c3+':'+_0x635d9['id'],_0x635d9);OpenchannelInteractionEvents[_0xbe5b('0xe')](_0x3399c3,_0x635d9);_0x25262a(null);})[_0xbe5b('0xf')](_0x25262a(null));};}for(var e in events){if(events[_0xbe5b('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xbe5b('0x11')](e,emitEvent(event));}}module[_0xbe5b('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3c7d=['remove','getUsers','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3c7d,0x127));var _0xd3c7=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x3c7d[_0x455c6c];return _0x488242;};'use strict';var EventEmitter=require(_0xd3c7('0x0'));var OpenchannelInteraction=require(_0xd3c7('0x1'))['db'][_0xd3c7('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd3c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3c7('0x4'),'afterDestroy':_0xd3c7('0x5')};function emitEvent(_0xd196af){return function(_0x52bc5b,_0x25212c,_0x153c39){_0x52bc5b[_0xd3c7('0x6')]({'attributes':['id'],'raw':!![]})[_0xd3c7('0x7')](function(_0x348fb7){_0x52bc5b[_0xd3c7('0x8')]('Users',_0x348fb7[_0xd3c7('0x9')](function(_0x340c14){return{'id':_0x340c14['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x52bc5b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3c7('0x7')](function(_0x5ebd8c){_0x52bc5b[_0xd3c7('0x8')](_0xd3c7('0xa'),_0x5ebd8c['length']);OpenchannelInteractionEvents[_0xd3c7('0xb')](_0xd196af+':'+_0x52bc5b['id'],_0x52bc5b);OpenchannelInteractionEvents[_0xd3c7('0xb')](_0xd196af,_0x52bc5b);_0x153c39(null);})[_0xd3c7('0xc')](_0x153c39(null));};}for(var e in events){if(events[_0xd3c7('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xd3c7('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c02f7e3..0d648e7 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 _0x3e58=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e58,0xee));var _0x83e5=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x3e58[_0x4e8401];return _0x17269f;};'use strict';var _=require('lodash');var util=require(_0x83e5('0x0'));var logger=require(_0x83e5('0x1'))(_0x83e5('0x2'));var moment=require(_0x83e5('0x3'));var BPromise=require(_0x83e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83e5('0x5'));var rimraf=require(_0x83e5('0x6'));var config=require(_0x83e5('0x7'));var attributes=require(_0x83e5('0x8'));module[_0x83e5('0x9')]=function(_0x24c84a,_0x1986b1){return _0x24c84a[_0x83e5('0xa')](_0x83e5('0xb'),attributes,{'tableName':_0x83e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x83e5('0xd'),'hooks':{'beforeUpdate':function(_0x16accb,_0x191d8b,_0x1f1bce){if(_0x16accb[_0x83e5('0xe')](_0x83e5('0xf'))){_0x16accb['closedAt']=moment()['format'](_0x83e5('0x10'));}_0x1f1bce(null,_0x16accb);}}});}; \ No newline at end of file +var _0x54c6=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x54c6,0x195));var _0x654c=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0x54c6[_0x20a270];return _0x49429a;};'use strict';var _=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var logger=require(_0x654c('0x2'))('api');var moment=require(_0x654c('0x3'));var BPromise=require(_0x654c('0x4'));var rp=require(_0x654c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x654c('0x6'));var config=require(_0x654c('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x654c('0x8')]=function(_0x2c1f72,_0x17d45b){return _0x2c1f72[_0x654c('0x9')](_0x654c('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x654c('0xb'),'hooks':{'beforeUpdate':function(_0x30f618,_0x29830a,_0x26f4c3){if(_0x30f618[_0x654c('0xc')](_0x654c('0xd'))){_0x30f618[_0x654c('0xe')]=moment()[_0x654c('0xf')](_0x654c('0x10'));}_0x26f4c3(null,_0x30f618);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 837f263..ab37814 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 _0x4564=['code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3cf02a,_0x2d90eb){var _0x3ed96e=function(_0x23c6ee){while(--_0x23c6ee){_0x3cf02a['push'](_0x3cf02a['shift']());}};_0x3ed96e(++_0x2d90eb);}(_0x4564,0x8a));var _0x4456=function(_0x39b88b,_0x42493e){_0x39b88b=_0x39b88b-0x0;var _0x347d97=_0x4564[_0x39b88b];return _0x347d97;};'use strict';var _=require(_0x4456('0x0'));var util=require('util');var moment=require(_0x4456('0x1'));var BPromise=require(_0x4456('0x2'));var rs=require(_0x4456('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4456('0x4'));var logger=require(_0x4456('0x5'))('rpc');var config=require(_0x4456('0x6'));var jayson=require(_0x4456('0x7'));var client=jayson[_0x4456('0x8')]['http']({'port':0x232a});config[_0x4456('0x9')]=_[_0x4456('0xa')](config['redis'],{'host':_0x4456('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4456('0x9')]));require(_0x4456('0xc'))[_0x4456('0xd')](socket);function respondWithRpcPromise(_0x380fda,_0x2ccccc,_0xd44c99){return new BPromise(function(_0x58f2c6,_0x3b1164){return client[_0x4456('0xe')](_0x380fda,_0xd44c99)[_0x4456('0xf')](function(_0xceb9d5){logger[_0x4456('0x10')](_0x4456('0x11'),_0x2ccccc,_0x4456('0x12'));logger[_0x4456('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2ccccc,_0x4456('0x12'),JSON[_0x4456('0x14')](_0xceb9d5));if(_0xceb9d5['error']){if(_0xceb9d5[_0x4456('0x15')][_0x4456('0x16')]===0x1f4){logger[_0x4456('0x15')](_0x4456('0x11'),_0x2ccccc,_0xceb9d5['error'][_0x4456('0x17')]);return _0x3b1164(_0xceb9d5[_0x4456('0x15')][_0x4456('0x17')]);}logger[_0x4456('0x15')](_0x4456('0x11'),_0x2ccccc,_0xceb9d5[_0x4456('0x15')][_0x4456('0x17')]);return _0x58f2c6(_0xceb9d5[_0x4456('0x15')][_0x4456('0x17')]);}else{logger[_0x4456('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2ccccc,'request\x20sent');_0x58f2c6(_0xceb9d5['result']['message']);}})[_0x4456('0x18')](function(_0x267757){logger[_0x4456('0x15')](_0x4456('0x11'),_0x2ccccc,_0x267757);_0x3b1164(_0x267757);});});}exports[_0x4456('0x19')]=function(_0x17ad42){var _0x4d2073=this;return new Promise(function(_0x2863db,_0x413afc){return db[_0x4456('0x1a')]['update'](_0x17ad42[_0x4456('0x1b')],{'raw':_0x17ad42[_0x4456('0x1c')]?_0x17ad42[_0x4456('0x1c')][_0x4456('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17ad42[_0x4456('0x1c')]?_0x17ad42[_0x4456('0x1c')][_0x4456('0x1e')]||null:null,'attributes':_0x17ad42[_0x4456('0x1c')]?_0x17ad42[_0x4456('0x1c')][_0x4456('0x1f')]||null:null,'limit':_0x17ad42[_0x4456('0x1c')]?_0x17ad42['options'][_0x4456('0x20')]||null:null})[_0x4456('0xf')](function(_0xd015b3){logger[_0x4456('0x10')](_0x4456('0x19'),_0x17ad42);logger['debug'](_0x4456('0x19'),_0x17ad42,JSON[_0x4456('0x14')](_0xd015b3));_0x2863db(_0xd015b3);})[_0x4456('0x18')](function(_0x30c68d){logger[_0x4456('0x15')](_0x4456('0x19'),_0x30c68d[_0x4456('0x17')],_0x17ad42);_0x413afc(_0x4d2073[_0x4456('0x15')](0x1f4,_0x30c68d[_0x4456('0x17')]));});});};exports[_0x4456('0x21')]=function(_0x35da10){return new Promise(function(_0x74784b,_0x378e26){return db['OpenchannelInteraction'][_0x4456('0x22')]({'where':_0x35da10['options']?_0x35da10[_0x4456('0x1c')][_0x4456('0x1e')]||null:null})[_0x4456('0xf')](function(_0x40cc17){if(_0x40cc17){return _0x40cc17[_0x4456('0x23')](_0x35da10[_0x4456('0x1b')][_0x4456('0x24')],_[_0x4456('0x25')](_0x35da10['body'],['ids','id'])||{});}})[_0x4456('0x26')](function(_0x50ccaf){logger[_0x4456('0x10')]('AddTags',_0x35da10);logger[_0x4456('0x13')](_0x4456('0x27'),_0x35da10,JSON[_0x4456('0x14')](_0x50ccaf));_0x74784b(_0x50ccaf);})[_0x4456('0x18')](function(_0x3d848d){logger[_0x4456('0x15')](_0x4456('0x27'),_0x3d848d[_0x4456('0x17')],_0x35da10);_0x378e26(_this[_0x4456('0x15')](0x1f4,_0x3d848d['message']));});});}; \ No newline at end of file +var _0x8169=['update','raw','options','where','attributes','debug','stringify','catch','find','addTags','body','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x4fb58c,_0x3a737c){var _0x1d8e77=function(_0x5f1387){while(--_0x5f1387){_0x4fb58c['push'](_0x4fb58c['shift']());}};_0x1d8e77(++_0x3a737c);}(_0x8169,0xfe));var _0x9816=function(_0x4c3d4a,_0x3d5888){_0x4c3d4a=_0x4c3d4a-0x0;var _0x189ad6=_0x8169[_0x4c3d4a];return _0x189ad6;};'use strict';var _=require('lodash');var util=require(_0x9816('0x0'));var moment=require(_0x9816('0x1'));var BPromise=require(_0x9816('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9816('0x3'));var db=require(_0x9816('0x4'))['db'];var utils=require(_0x9816('0x5'));var logger=require(_0x9816('0x6'))(_0x9816('0x7'));var config=require(_0x9816('0x8'));var jayson=require(_0x9816('0x9'));var client=jayson[_0x9816('0xa')]['http']({'port':0x232a});config[_0x9816('0xb')]=_[_0x9816('0xc')](config[_0x9816('0xb')],{'host':_0x9816('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x137041,_0x5984b3,_0x2dba4a){return new BPromise(function(_0x20018d,_0x370770){return client[_0x9816('0xe')](_0x137041,_0x2dba4a)[_0x9816('0xf')](function(_0x37728c){logger['info'](_0x9816('0x10'),_0x5984b3,_0x9816('0x11'));logger['debug'](_0x9816('0x12'),_0x5984b3,'request\x20sent',JSON['stringify'](_0x37728c));if(_0x37728c[_0x9816('0x13')]){if(_0x37728c[_0x9816('0x13')][_0x9816('0x14')]===0x1f4){logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);return _0x370770(_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);}logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x37728c[_0x9816('0x13')]['message']);return _0x20018d(_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);}else{logger[_0x9816('0x16')](_0x9816('0x10'),_0x5984b3,_0x9816('0x11'));_0x20018d(_0x37728c[_0x9816('0x17')][_0x9816('0x15')]);}})['catch'](function(_0x58a85c){logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x58a85c);_0x370770(_0x58a85c);});});}exports[_0x9816('0x18')]=function(_0x3242ad){var _0x4dc628=this;return new Promise(function(_0x5cd277,_0x4cd2a0){return db[_0x9816('0x19')][_0x9816('0x1a')](_0x3242ad['body'],{'raw':_0x3242ad['options']?_0x3242ad['options'][_0x9816('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3242ad[_0x9816('0x1c')]?_0x3242ad[_0x9816('0x1c')][_0x9816('0x1d')]||null:null,'attributes':_0x3242ad[_0x9816('0x1c')]?_0x3242ad[_0x9816('0x1c')][_0x9816('0x1e')]||null:null,'limit':_0x3242ad[_0x9816('0x1c')]?_0x3242ad['options']['limit']||null:null})['then'](function(_0x136ce4){logger[_0x9816('0x16')](_0x9816('0x18'),_0x3242ad);logger[_0x9816('0x1f')](_0x9816('0x18'),_0x3242ad,JSON[_0x9816('0x20')](_0x136ce4));_0x5cd277(_0x136ce4);})[_0x9816('0x21')](function(_0x44f662){logger[_0x9816('0x13')]('UpdateOpenchannelInteraction',_0x44f662[_0x9816('0x15')],_0x3242ad);_0x4cd2a0(_0x4dc628[_0x9816('0x13')](0x1f4,_0x44f662[_0x9816('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4102a2){return new Promise(function(_0x55dd9e,_0x267728){return db[_0x9816('0x19')][_0x9816('0x22')]({'where':_0x4102a2['options']?_0x4102a2[_0x9816('0x1c')][_0x9816('0x1d')]||null:null})[_0x9816('0xf')](function(_0x13742b){if(_0x13742b){return _0x13742b[_0x9816('0x23')](_0x4102a2[_0x9816('0x24')][_0x9816('0x25')],_['omit'](_0x4102a2['body'],[_0x9816('0x25'),'id'])||{});}})[_0x9816('0x26')](function(_0x2a4780){logger['info'](_0x9816('0x27'),_0x4102a2);logger['debug'](_0x9816('0x27'),_0x4102a2,JSON[_0x9816('0x20')](_0x2a4780));_0x55dd9e(_0x2a4780);})[_0x9816('0x21')](function(_0x54cb2d){logger['error'](_0x9816('0x27'),_0x54cb2d['message'],_0x4102a2);_0x267728(_this[_0x9816('0x13')](0x1f4,_0x54cb2d[_0x9816('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6f96f4e..a3af1b4 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 _0x39b9=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x5d5c5d,_0x501467){var _0x494ef9=function(_0x51e020){while(--_0x51e020){_0x5d5c5d['push'](_0x5d5c5d['shift']());}};_0x494ef9(++_0x501467);}(_0x39b9,0x92));var _0x939b=function(_0xe1b523,_0x2bc05b){_0xe1b523=_0xe1b523-0x0;var _0x52c152=_0x39b9[_0xe1b523];return _0x52c152;};'use strict';var OpenchannelInteractionEvents=require(_0x939b('0x0'));var events=[_0x939b('0x1'),_0x939b('0x2'),_0x939b('0x3')];function createListener(_0xf2ce6d,_0x37b7e0){return function(_0x1b4edc){_0x37b7e0[_0x939b('0x4')](_0xf2ce6d,_0x1b4edc);};}function removeListener(_0x42de12,_0xee1803){return function(){OpenchannelInteractionEvents[_0x939b('0x5')](_0x42de12,_0xee1803);};}exports[_0x939b('0x6')]=function(_0x4a0dbf){for(var _0x1ff4f1=0x0,_0x2b7f6f=events[_0x939b('0x7')];_0x1ff4f1<_0x2b7f6f;_0x1ff4f1++){var _0x290283=events[_0x1ff4f1];var _0x2a0add=createListener(_0x939b('0x8')+_0x290283,_0x4a0dbf);OpenchannelInteractionEvents['on'](_0x290283,_0x2a0add);}}; \ No newline at end of file +var _0x3b51=['./openchannelInteraction.events','remove','update','emit','register','openchannelInteraction:'];(function(_0x2c34c1,_0x3f9aa7){var _0x587ccc=function(_0x24bb12){while(--_0x24bb12){_0x2c34c1['push'](_0x2c34c1['shift']());}};_0x587ccc(++_0x3f9aa7);}(_0x3b51,0x186));var _0x13b5=function(_0x481f99,_0x458b72){_0x481f99=_0x481f99-0x0;var _0x721d60=_0x3b51[_0x481f99];return _0x721d60;};'use strict';var OpenchannelInteractionEvents=require(_0x13b5('0x0'));var events=['save',_0x13b5('0x1'),_0x13b5('0x2')];function createListener(_0x4b2651,_0x462217){return function(_0x18a414){_0x462217[_0x13b5('0x3')](_0x4b2651,_0x18a414);};}function removeListener(_0x1e5865,_0x50e2c3){return function(){OpenchannelInteractionEvents['removeListener'](_0x1e5865,_0x50e2c3);};}exports[_0x13b5('0x4')]=function(_0x33733c){for(var _0x53fa2c=0x0,_0x927b84=events['length'];_0x53fa2c<_0x927b84;_0x53fa2c++){var _0x557300=events[_0x53fa2c];var _0x1241bd=createListener(_0x13b5('0x5')+_0x557300,_0x33733c);OpenchannelInteractionEvents['on'](_0x557300,_0x1241bd);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 14c68e6..770cf43 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0xa30864,_0x34a5cd){var _0x1d431f=function(_0x510ca6){while(--_0x510ca6){_0xa30864['push'](_0xa30864['shift']());}};_0x1d431f(++_0x34a5cd);}(_0xe706,0xa3));var _0x6e70=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xe706[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x8359b,_0x42cbf9){var _0x1d3c4b=function(_0x14f548){while(--_0x14f548){_0x8359b['push'](_0x8359b['shift']());}};_0x1d3c4b(++_0x42cbf9);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index de8e48c..4715d5f 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 _0x7497=['TEXT','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x18b954,_0x2f7b3c){var _0x3e7bf5=function(_0x3a214b){while(--_0x3a214b){_0x18b954['push'](_0x18b954['shift']());}};_0x3e7bf5(++_0x2f7b3c);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'body':{'type':Sequelize[_0x7749('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7749('0x3')]('in',_0x7749('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7749('0x5')]},'providerName':{'type':Sequelize[_0x7749('0x6')]},'providerResponse':{'type':Sequelize[_0x7749('0x2')]}}; \ No newline at end of file +var _0x3c66=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x28e2fc,_0x11b9e9){var _0x37bb27=function(_0x4eac22){while(--_0x4eac22){_0x28e2fc['push'](_0x28e2fc['shift']());}};_0x37bb27(++_0x11b9e9);}(_0x3c66,0x8b));var _0x63c6=function(_0x3a3348,_0x3363db){_0x3a3348=_0x3a3348-0x0;var _0x3917c8=_0x3c66[_0x3a3348];return _0x3917c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x63c6('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63c6('0x2')]('in',_0x63c6('0x3')),'defaultValue':_0x63c6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x63c6('0x4')]},'providerName':{'type':Sequelize[_0x63c6('0x5')]},'providerResponse':{'type':Sequelize[_0x63c6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 72978b5..f5c22b3 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 _0xcd3a=['acceptmessage','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','Sequelize','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','index','map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','OpenchannelMessage','findAll','rows','catch','show','params','include','find','create','update','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x54a0ed,_0x398f33){var _0x31029d=function(_0x5b2aac){while(--_0x5b2aac){_0x54a0ed['push'](_0x54a0ed['shift']());}};_0x31029d(++_0x398f33);}(_0xcd3a,0x8e));var _0xacd3=function(_0x38f502,_0x5332e0){_0x38f502=_0x38f502-0x0;var _0x55064a=_0xcd3a[_0x38f502];return _0x55064a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacd3('0x0'));var zipdir=require(_0xacd3('0x1'));var jsonpatch=require(_0xacd3('0x2'));var rp=require(_0xacd3('0x3'));var moment=require(_0xacd3('0x4'));var BPromise=require(_0xacd3('0x5'));var Mustache=require(_0xacd3('0x6'));var util=require(_0xacd3('0x7'));var path=require(_0xacd3('0x8'));var sox=require('sox');var csv=require(_0xacd3('0x9'));var ejs=require(_0xacd3('0xa'));var fs=require('fs');var fs_extra=require(_0xacd3('0xb'));var _=require(_0xacd3('0xc'));var squel=require(_0xacd3('0xd'));var crypto=require('crypto');var jsforce=require(_0xacd3('0xe'));var deskjs=require(_0xacd3('0xf'));var toCsv=require(_0xacd3('0x9'));var querystring=require(_0xacd3('0x10'));var Papa=require('papaparse');var Redis=require(_0xacd3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xacd3('0x12'));var as=require(_0xacd3('0x13'));var hardwareService=require(_0xacd3('0x14'));var logger=require(_0xacd3('0x15'))(_0xacd3('0x16'));var utils=require(_0xacd3('0x17'));var config=require(_0xacd3('0x18'));var licenseUtil=require(_0xacd3('0x19'));var db=require(_0xacd3('0x1a'))['db'];config[_0xacd3('0x1b')]=_[_0xacd3('0x1c')](config['redis'],{'host':_0xacd3('0x1d'),'port':0x18eb});var socket=require(_0xacd3('0x1e'))(new Redis(config[_0xacd3('0x1b')]));require(_0xacd3('0x1f'))[_0xacd3('0x20')](socket);var jayson=require(_0xacd3('0x21'));var client=jayson[_0xacd3('0x22')][_0xacd3('0x23')]({'port':0x232c});var client9002=jayson[_0xacd3('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd5c1,_0x524439,_0x30525f,_0x4aceb4){return new BPromise(function(_0x28bd35,_0x460d22){var _0x1fd92d=_0x4aceb4||client;return _0x1fd92d[_0xacd3('0x24')](_0x1bd5c1,_0x30525f)[_0xacd3('0x25')](function(_0x1d3ec1){logger[_0xacd3('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x524439,_0xacd3('0x27'));logger[_0xacd3('0x28')](_0xacd3('0x29'),_0x524439,_0xacd3('0x27'),JSON[_0xacd3('0x2a')](_0x1d3ec1));if(_0x1d3ec1[_0xacd3('0x2b')]){if(_0x1d3ec1['error'][_0xacd3('0x2c')]===0x1f4){logger['error'](_0xacd3('0x2d'),_0x524439,_0x1d3ec1[_0xacd3('0x2b')][_0xacd3('0x2e')]);return _0x460d22(_0x1d3ec1['error'][_0xacd3('0x2e')]);}logger[_0xacd3('0x2b')](_0xacd3('0x2d'),_0x524439,_0x1d3ec1[_0xacd3('0x2b')][_0xacd3('0x2e')]);return _0x28bd35(_0x1d3ec1[_0xacd3('0x2b')][_0xacd3('0x2e')]);}else{logger[_0xacd3('0x26')](_0xacd3('0x2d'),_0x524439,_0xacd3('0x27'));_0x28bd35(_0x1d3ec1[_0xacd3('0x2f')][_0xacd3('0x2e')]);}})['catch'](function(_0x3e05ba){logger[_0xacd3('0x2b')](_0xacd3('0x2d'),_0x524439,_0x3e05ba);_0x460d22(_0x3e05ba);});});}function respondWithStatusCode(_0xa0fafe,_0x3e6693){_0x3e6693=_0x3e6693||0xcc;return function(_0x2d6869){if(_0x2d6869){return _0xa0fafe[_0xacd3('0x30')](_0x3e6693);}return _0xa0fafe[_0xacd3('0x31')](_0x3e6693)[_0xacd3('0x32')]();};}function respondWithResult(_0x193d04,_0xde2aa){_0xde2aa=_0xde2aa||0xc8;return function(_0x34bee3){if(_0x34bee3){return _0x193d04[_0xacd3('0x31')](_0xde2aa)[_0xacd3('0x33')](_0x34bee3);}};}function respondWithFilteredResult(_0x2376ca,_0x4e0022){return function(_0x3762b3){if(_0x3762b3){var _0x473786=typeof _0x4e0022[_0xacd3('0x34')]===_0xacd3('0x35')&&typeof _0x4e0022[_0xacd3('0x36')]===_0xacd3('0x35');var _0x611d86=_0x3762b3[_0xacd3('0x37')];var _0x1a4853=_0x473786?0x0:_0x4e0022[_0xacd3('0x34')];var _0x4ad40c=_0x473786?_0x3762b3[_0xacd3('0x37')]:_0x4e0022['offset']+_0x4e0022['limit'];var _0x5ef50a;if(_0x4ad40c>=_0x611d86){_0x4ad40c=_0x611d86;_0x5ef50a=0xc8;}else{_0x5ef50a=0xce;}_0x2376ca['status'](_0x5ef50a);return _0x2376ca[_0xacd3('0x38')]('Content-Range',_0x1a4853+'-'+_0x4ad40c+'/'+_0x611d86)[_0xacd3('0x33')](_0x3762b3);}return null;};}function patchUpdates(_0x4c1b1b){return function(_0x557a65){try{jsonpatch[_0xacd3('0x39')](_0x557a65,_0x4c1b1b,!![]);}catch(_0x16d9c4){return BPromise[_0xacd3('0x3a')](_0x16d9c4);}return _0x557a65[_0xacd3('0x3b')]();};}function saveUpdates(_0x316002,_0x2b9b1b){return function(_0x328729){if(_0x328729){return _0x328729['update'](_0x316002)[_0xacd3('0x25')](function(_0x2c3129){return _0x2c3129;});}return null;};}function removeEntity(_0x1aa637,_0x21bc1a){return function(_0x18b1d5){if(_0x18b1d5){return _0x18b1d5[_0xacd3('0x3c')]()['then'](function(){_0x1aa637[_0xacd3('0x31')](0xcc)[_0xacd3('0x32')]();});}};}function handleEntityNotFound(_0x41bae3,_0x3c4b48){return function(_0x4f4738){if(!_0x4f4738){_0x41bae3[_0xacd3('0x30')](0x194);}return _0x4f4738;};}function handleError(_0x42eec3,_0x473388){_0x473388=_0x473388||0x1f4;return function(_0x637168){logger['error'](_0x637168[_0xacd3('0x3d')]);if(_0x637168['name']){delete _0x637168[_0xacd3('0x3e')];}_0x42eec3[_0xacd3('0x31')](_0x473388)['send'](_0x637168);};}exports[_0xacd3('0x3f')]=function(_0x2535a1,_0xbceffe){var _0x1e27b0={},_0x22e7f9={},_0x1c755e={'count':0x0,'rows':[]};var _0x40585a=_[_0xacd3('0x40')](db['OpenchannelMessage']['rawAttributes'],function(_0x3bd671){return{'name':_0x3bd671[_0xacd3('0x41')],'type':_0x3bd671['type']['key']};});_0x22e7f9[_0xacd3('0x42')]=_[_0xacd3('0x40')](_0x40585a,_0xacd3('0x3e'));_0x22e7f9[_0xacd3('0x43')]=_[_0xacd3('0x44')](_0x2535a1[_0xacd3('0x43')]);_0x22e7f9[_0xacd3('0x45')]=_[_0xacd3('0x46')](_0x22e7f9[_0xacd3('0x42')],_0x22e7f9['query']);_0x1e27b0['attributes']=_['intersection'](_0x22e7f9['model'],qs[_0xacd3('0x47')](_0x2535a1[_0xacd3('0x43')][_0xacd3('0x47')]));_0x1e27b0['attributes']=_0x1e27b0[_0xacd3('0x48')][_0xacd3('0x49')]?_0x1e27b0[_0xacd3('0x48')]:_0x22e7f9[_0xacd3('0x42')];if(!_0x2535a1[_0xacd3('0x43')][_0xacd3('0x4a')](_0xacd3('0x4b'))){_0x1e27b0['limit']=qs[_0xacd3('0x36')](_0x2535a1[_0xacd3('0x43')][_0xacd3('0x36')]);_0x1e27b0[_0xacd3('0x34')]=qs['offset'](_0x2535a1['query'][_0xacd3('0x34')]);}_0x1e27b0[_0xacd3('0x4c')]=qs[_0xacd3('0x4d')](_0x2535a1['query'][_0xacd3('0x4d')]);_0x1e27b0[_0xacd3('0x4e')]=qs[_0xacd3('0x45')](_['pick'](_0x2535a1[_0xacd3('0x43')],_0x22e7f9[_0xacd3('0x45')]),_0x40585a);if(_0x2535a1[_0xacd3('0x43')][_0xacd3('0x4f')]){_0x1e27b0[_0xacd3('0x4e')]=_['merge'](_0x1e27b0[_0xacd3('0x4e')],{'$or':_[_0xacd3('0x40')](_0x40585a,function(_0x20724f){if(_0x20724f[_0xacd3('0x50')]!==_0xacd3('0x51')){var _0x5f18ae={};_0x5f18ae[_0x20724f['name']]={'$like':'%'+_0x2535a1[_0xacd3('0x43')][_0xacd3('0x4f')]+'%'};return _0x5f18ae;}})});}_0x1e27b0=_[_0xacd3('0x52')]({},_0x1e27b0,_0x2535a1[_0xacd3('0x53')]);var _0x4f7203={'where':_0x1e27b0['where']};return db['OpenchannelMessage'][_0xacd3('0x37')](_0x4f7203)[_0xacd3('0x25')](function(_0x7d852d){_0x1c755e[_0xacd3('0x37')]=_0x7d852d;if(_0x2535a1[_0xacd3('0x43')][_0xacd3('0x54')]){_0x1e27b0['include']=[{'all':!![]}];}return db[_0xacd3('0x55')][_0xacd3('0x56')](_0x1e27b0);})['then'](function(_0x50d6a6){_0x1c755e[_0xacd3('0x57')]=_0x50d6a6;return _0x1c755e;})[_0xacd3('0x25')](respondWithFilteredResult(_0xbceffe,_0x1e27b0))[_0xacd3('0x58')](handleError(_0xbceffe,null));};exports[_0xacd3('0x59')]=function(_0x1d10a6,_0x3b03ae){var _0x974b1={'raw':!![],'where':{'id':_0x1d10a6[_0xacd3('0x5a')]['id']}},_0x49a5ba={};_0x49a5ba[_0xacd3('0x42')]=_[_0xacd3('0x44')](db['OpenchannelMessage']['rawAttributes']);_0x49a5ba['query']=_['keys'](_0x1d10a6[_0xacd3('0x43')]);_0x49a5ba[_0xacd3('0x45')]=_[_0xacd3('0x46')](_0x49a5ba[_0xacd3('0x42')],_0x49a5ba[_0xacd3('0x43')]);_0x974b1[_0xacd3('0x48')]=_[_0xacd3('0x46')](_0x49a5ba['model'],qs[_0xacd3('0x47')](_0x1d10a6[_0xacd3('0x43')][_0xacd3('0x47')]));_0x974b1[_0xacd3('0x48')]=_0x974b1[_0xacd3('0x48')][_0xacd3('0x49')]?_0x974b1[_0xacd3('0x48')]:_0x49a5ba[_0xacd3('0x42')];if(_0x1d10a6[_0xacd3('0x43')][_0xacd3('0x54')]){_0x974b1[_0xacd3('0x5b')]=[{'all':!![]}];}_0x974b1=_[_0xacd3('0x52')]({},_0x974b1,_0x1d10a6['options']);return db[_0xacd3('0x55')][_0xacd3('0x5c')](_0x974b1)[_0xacd3('0x25')](handleEntityNotFound(_0x3b03ae,null))[_0xacd3('0x25')](respondWithResult(_0x3b03ae,null))[_0xacd3('0x58')](handleError(_0x3b03ae,null));};exports[_0xacd3('0x5d')]=function(_0x44bf23,_0x1f2fee){return db[_0xacd3('0x55')][_0xacd3('0x5d')](_0x44bf23['body'],{})['then'](respondWithResult(_0x1f2fee,0xc9))[_0xacd3('0x58')](handleError(_0x1f2fee,null));};exports[_0xacd3('0x5e')]=function(_0x40049d,_0x4938f6){if(_0x40049d[_0xacd3('0x5f')]['id']){delete _0x40049d[_0xacd3('0x5f')]['id'];}return db[_0xacd3('0x55')][_0xacd3('0x5c')]({'where':{'id':_0x40049d[_0xacd3('0x5a')]['id']}})[_0xacd3('0x25')](handleEntityNotFound(_0x4938f6,null))[_0xacd3('0x25')](saveUpdates(_0x40049d['body'],null))[_0xacd3('0x25')](respondWithResult(_0x4938f6,null))[_0xacd3('0x58')](handleError(_0x4938f6,null));};exports['destroy']=function(_0x36667f,_0x5def6d){return db[_0xacd3('0x55')][_0xacd3('0x5c')]({'where':{'id':_0x36667f[_0xacd3('0x5a')]['id']}})[_0xacd3('0x25')](handleEntityNotFound(_0x5def6d,null))['then'](removeEntity(_0x5def6d,null))[_0xacd3('0x58')](handleError(_0x5def6d,null));};exports[_0xacd3('0x60')]=function(_0x140fb5,_0x1fdca2){return db[_0xacd3('0x55')][_0xacd3('0x60')]()['then'](respondWithResult(_0x1fdca2,null))['catch'](handleError(_0x1fdca2,null));};var interaction_log=require(_0xacd3('0x15'))(_0xacd3('0x61'));exports[_0xacd3('0x62')]=function(_0x5cd9d5,_0x17ad83,_0x270298){var _0x141583={'agent':{},'channel':_0xacd3('0x63')};if(_0x5cd9d5[_0xacd3('0x5f')]['id']){delete _0x5cd9d5['body']['id'];}_0x5cd9d5[_0xacd3('0x5f')][_0xacd3('0x64')]=!![];_0x5cd9d5[_0xacd3('0x5f')][_0xacd3('0x65')]=moment()[_0xacd3('0x66')](_0xacd3('0x67'));_0x5cd9d5['body']['UserId']=_0x5cd9d5[_0xacd3('0x5f')][_0xacd3('0x68')]||_0x5cd9d5[_0xacd3('0x69')]['id'];_0x141583['agent']['id']=_0x5cd9d5[_0xacd3('0x5f')][_0xacd3('0x68')];return db[_0xacd3('0x55')][_0xacd3('0x5c')]({'where':{'id':_0x5cd9d5[_0xacd3('0x5a')]['id'],'UserId':null}})[_0xacd3('0x25')](handleEntityNotFound(_0x17ad83,null))[_0xacd3('0x25')](saveUpdates(_0x5cd9d5[_0xacd3('0x5f')],null))[_0xacd3('0x25')](function(_0x23cd74){if(_0x23cd74){_0x141583[_0xacd3('0x2e')]=_0x23cd74[_0xacd3('0x6a')]({'plain':!![]});return db[_0xacd3('0x6b')][_0xacd3('0x5c')]({'where':{'id':_0x23cd74[_0xacd3('0x6c')]}});}return null;})[_0xacd3('0x25')](handleEntityNotFound(_0x17ad83,null))[_0xacd3('0x25')](function(_0x256f86){if(_0x256f86){return _0x256f86[_0xacd3('0x5e')]({'UserId':_0x5cd9d5['body'][_0xacd3('0x68')],'read1stAt':_['isNil'](_0x256f86[_0xacd3('0x6d')])?moment()[_0xacd3('0x66')](_0xacd3('0x67')):undefined});}return null;})[_0xacd3('0x25')](function(_0x2a31fa){if(_0x2a31fa){_0x141583['interaction']=_0x2a31fa[_0xacd3('0x6a')]({'plain':!![]});interaction_log[_0xacd3('0x26')](_0xacd3('0x6e'),_0x5cd9d5[_0xacd3('0x69')]['id'],_0x5cd9d5[_0xacd3('0x69')][_0xacd3('0x3e')],_0x5cd9d5[_0xacd3('0x69')]['role'],_0x141583['interaction']['id'],_0x5cd9d5['body']?JSON[_0xacd3('0x2a')](_0x5cd9d5['body']):'null');return respondWithRpcPromise(_0xacd3('0x6f'),_0xacd3('0x70'),_0x141583);}return null;})[_0xacd3('0x25')](function(_0x57fc6c){var _0x1513c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57fc6c[_0xacd3('0x2e')][_0xacd3('0x71')];return db[_0xacd3('0x72')][_0xacd3('0x43')](_0x1513c2,{'type':db['Sequelize'][_0xacd3('0x73')][_0xacd3('0x74')],'raw':!![]})[_0xacd3('0x25')](function(_0x1d9971){return _0x1d9971;});})[_0xacd3('0x25')](function(_0x33e94){if(_0x33e94){_0x141583[_0xacd3('0x2e')][_0xacd3('0x75')]=_0x33e94[0x0];if(!_0x5cd9d5['body']['UserId'])return;return db[_0xacd3('0x76')][_0xacd3('0x5c')]({'where':{'id':_0x5cd9d5['body']['UserId'],'role':_0xacd3('0x77')},'attributes':['id','name',_0xacd3('0x78'),_0xacd3('0x79'),_0xacd3('0x7a')],'raw':!![]});}return null;})[_0xacd3('0x25')](function(_0x4e4117){if(!_0x4e4117)return null;_0x141583[_0xacd3('0x2e')]['agent']=_0x4e4117;return _0x141583;})['then'](function(_0x2946e0){if(_0x2946e0){if(_0x5cd9d5[_0xacd3('0x5f')][_0xacd3('0x7b')]){_0x141583['message'][_0xacd3('0x7c')]=util[_0xacd3('0x66')](_0xacd3('0x7d'),_0x5cd9d5[_0xacd3('0x69')]['name']);_0x141583[_0xacd3('0x2e')][_0xacd3('0x7e')]=_0x141583[_0xacd3('0x7e')];_0x141583['message'][_0xacd3('0x7f')]=_0x141583[_0xacd3('0x7e')];_0x141583[_0xacd3('0x2e')][_0xacd3('0x80')]=_0xacd3('0x62');return respondWithRpcPromise(_0xacd3('0x81'),'EventManager',{'event':_0xacd3('0x82'),'message':_0x141583[_0xacd3('0x2e')]},client9002)[_0xacd3('0x25')](function(){return _0x141583;});}return _0x141583;}return null;})[_0xacd3('0x25')](respondWithResult(_0x17ad83,null))[_0xacd3('0x58')](handleError(_0x17ad83,null));};var interaction_log=require(_0xacd3('0x15'))('openchannel-interactions');exports[_0xacd3('0x3a')]=function(_0x41262f,_0x1a9335,_0x44556f){var _0x17e285={'agent':{},'channel':'openchannel'};if(_0x41262f[_0xacd3('0x5f')]['id']){delete _0x41262f[_0xacd3('0x5f')]['id'];}_0x41262f['body'][_0xacd3('0x68')]=_0x41262f[_0xacd3('0x5f')][_0xacd3('0x68')]||_0x41262f['user']['id'];_0x17e285[_0xacd3('0x77')]['id']=_0x41262f[_0xacd3('0x5f')][_0xacd3('0x68')];return db[_0xacd3('0x55')][_0xacd3('0x5c')]({'where':{'id':_0x41262f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a9335,null))[_0xacd3('0x25')](function(_0x2a2d5c){if(_0x2a2d5c){_0x17e285[_0xacd3('0x2e')]=_0x2a2d5c['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2a2d5c[_0xacd3('0x6c')]}});}return null;})[_0xacd3('0x25')](handleEntityNotFound(_0x1a9335,null))[_0xacd3('0x25')](function(_0x469eeb){if(_0x469eeb){_0x17e285[_0xacd3('0x83')]=_0x469eeb[_0xacd3('0x6a')]({'plain':!![]});interaction_log[_0xacd3('0x26')](_0xacd3('0x84'),_0x41262f[_0xacd3('0x69')]['id'],_0x41262f[_0xacd3('0x69')][_0xacd3('0x3e')],_0x41262f[_0xacd3('0x69')][_0xacd3('0x85')],_0x17e285[_0xacd3('0x83')]['id'],_0x41262f[_0xacd3('0x5f')]?JSON[_0xacd3('0x2a')](_0x41262f[_0xacd3('0x5f')]):'null');return respondWithRpcPromise(_0xacd3('0x86'),'rejectMessage',_0x17e285);}return null;})[_0xacd3('0x25')](function(_0x1f3f92){var _0x5f5699='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1f3f92[_0xacd3('0x2e')][_0xacd3('0x71')];return db[_0xacd3('0x72')][_0xacd3('0x43')](_0x5f5699,{'type':db[_0xacd3('0x87')][_0xacd3('0x73')]['SELECT'],'raw':!![]})[_0xacd3('0x25')](function(_0x44a461){return _0x44a461;});})[_0xacd3('0x25')](function(_0x24cc67){if(_0x24cc67){_0x17e285[_0xacd3('0x2e')][_0xacd3('0x75')]=_0x24cc67[0x0];if(!_0x41262f[_0xacd3('0x5f')][_0xacd3('0x68')])return;return db[_0xacd3('0x76')][_0xacd3('0x5c')]({'where':{'id':_0x41262f[_0xacd3('0x5f')][_0xacd3('0x68')],'role':_0xacd3('0x77')},'attributes':['id',_0xacd3('0x3e'),_0xacd3('0x78'),_0xacd3('0x79'),_0xacd3('0x7a')],'raw':!![]});}return null;})[_0xacd3('0x25')](function(_0x35716c){if(!_0x35716c)return null;_0x17e285[_0xacd3('0x2e')][_0xacd3('0x77')]=_0x35716c;return _0x17e285;})[_0xacd3('0x25')](function(_0x3c388c){if(_0x3c388c){_0x3c388c[_0xacd3('0x2e')][_0xacd3('0x7c')]=util[_0xacd3('0x66')]('SIP/%s',_0x41262f[_0xacd3('0x69')][_0xacd3('0x3e')]);_0x3c388c[_0xacd3('0x2e')][_0xacd3('0x7e')]=_0x17e285[_0xacd3('0x7e')];_0x3c388c['message'][_0xacd3('0x7f')]=_0x17e285[_0xacd3('0x7e')];_0x3c388c[_0xacd3('0x2e')][_0xacd3('0x80')]=_0xacd3('0x3a');respondWithRpcPromise(_0xacd3('0x81'),_0xacd3('0x81'),{'event':'rejectmessage','message':_0x3c388c[_0xacd3('0x2e')]},client9002);return _0x17e285;}return null;})[_0xacd3('0x25')](respondWithResult(_0x1a9335,null))[_0xacd3('0x58')](handleError(_0x1a9335,null));}; \ No newline at end of file +var _0xc82d=['mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','name','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','destroy','describe','../../config/logger','openchannel-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','fullname','internal','manual','interface','format','channel','motionChannel','EventManager','acceptmessage','openchannel','RejectMessage','ContactId','QueryTypes','contact','User','SIP/%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x1594fa,_0x51967f){var _0x5778f4=function(_0x3d3f1d){while(--_0x3d3f1d){_0x1594fa['push'](_0x1594fa['shift']());}};_0x5778f4(++_0x51967f);}(_0xc82d,0x7a));var _0xdc82=function(_0x216494,_0x21a0b4){_0x216494=_0x216494-0x0;var _0x3fce22=_0xc82d[_0x216494];return _0x3fce22;};'use strict';var emlformat=require(_0xdc82('0x0'));var rimraf=require(_0xdc82('0x1'));var zipdir=require(_0xdc82('0x2'));var jsonpatch=require(_0xdc82('0x3'));var rp=require('request-promise');var moment=require(_0xdc82('0x4'));var BPromise=require(_0xdc82('0x5'));var Mustache=require(_0xdc82('0x6'));var util=require(_0xdc82('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdc82('0x8'));var ejs=require(_0xdc82('0x9'));var fs=require('fs');var fs_extra=require(_0xdc82('0xa'));var _=require('lodash');var squel=require(_0xdc82('0xb'));var crypto=require(_0xdc82('0xc'));var jsforce=require(_0xdc82('0xd'));var deskjs=require(_0xdc82('0xe'));var toCsv=require(_0xdc82('0x8'));var querystring=require('querystring');var Papa=require(_0xdc82('0xf'));var Redis=require('ioredis');var authService=require(_0xdc82('0x10'));var qs=require(_0xdc82('0x11'));var as=require(_0xdc82('0x12'));var hardwareService=require(_0xdc82('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdc82('0x14'));var config=require(_0xdc82('0x15'));var licenseUtil=require(_0xdc82('0x16'));var db=require(_0xdc82('0x17'))['db'];config[_0xdc82('0x18')]=_[_0xdc82('0x19')](config[_0xdc82('0x18')],{'host':_0xdc82('0x1a'),'port':0x18eb});var socket=require(_0xdc82('0x1b'))(new Redis(config[_0xdc82('0x18')]));require(_0xdc82('0x1c'))[_0xdc82('0x1d')](socket);var jayson=require(_0xdc82('0x1e'));var client=jayson['client'][_0xdc82('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xdc82('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5417c1,_0x58a0f4,_0x158f0f,_0x3ce90f){return new BPromise(function(_0x89d431,_0x240080){var _0x2c5ff5=_0x3ce90f||client;return _0x2c5ff5['request'](_0x5417c1,_0x158f0f)[_0xdc82('0x20')](function(_0x489873){logger['info'](_0xdc82('0x21'),_0x58a0f4,_0xdc82('0x22'));logger['debug'](_0xdc82('0x23'),_0x58a0f4,'request\x20sent',JSON[_0xdc82('0x24')](_0x489873));if(_0x489873[_0xdc82('0x25')]){if(_0x489873[_0xdc82('0x25')][_0xdc82('0x26')]===0x1f4){logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);return _0x240080(_0x489873['error'][_0xdc82('0x27')]);}logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);return _0x89d431(_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x58a0f4,_0xdc82('0x22'));_0x89d431(_0x489873['result'][_0xdc82('0x27')]);}})['catch'](function(_0x42256c){logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x42256c);_0x240080(_0x42256c);});});}function respondWithStatusCode(_0x3c6b7e,_0x436242){_0x436242=_0x436242||0xcc;return function(_0x9a1929){if(_0x9a1929){return _0x3c6b7e[_0xdc82('0x28')](_0x436242);}return _0x3c6b7e[_0xdc82('0x29')](_0x436242)[_0xdc82('0x2a')]();};}function respondWithResult(_0x3193aa,_0x44ec92){_0x44ec92=_0x44ec92||0xc8;return function(_0x32e7bb){if(_0x32e7bb){return _0x3193aa[_0xdc82('0x29')](_0x44ec92)[_0xdc82('0x2b')](_0x32e7bb);}};}function respondWithFilteredResult(_0x20b4cd,_0x589ff7){return function(_0x510758){if(_0x510758){var _0x5ca485=typeof _0x589ff7[_0xdc82('0x2c')]===_0xdc82('0x2d')&&typeof _0x589ff7[_0xdc82('0x2e')]===_0xdc82('0x2d');var _0x26e775=_0x510758[_0xdc82('0x2f')];var _0x48e292=_0x5ca485?0x0:_0x589ff7['offset'];var _0x11591b=_0x5ca485?_0x510758[_0xdc82('0x2f')]:_0x589ff7[_0xdc82('0x2c')]+_0x589ff7[_0xdc82('0x2e')];var _0x1ab085;if(_0x11591b>=_0x26e775){_0x11591b=_0x26e775;_0x1ab085=0xc8;}else{_0x1ab085=0xce;}_0x20b4cd[_0xdc82('0x29')](_0x1ab085);return _0x20b4cd['set'](_0xdc82('0x30'),_0x48e292+'-'+_0x11591b+'/'+_0x26e775)[_0xdc82('0x2b')](_0x510758);}return null;};}function patchUpdates(_0x22f1a3){return function(_0x32dca6){try{jsonpatch[_0xdc82('0x31')](_0x32dca6,_0x22f1a3,!![]);}catch(_0x49b9ac){return BPromise[_0xdc82('0x32')](_0x49b9ac);}return _0x32dca6[_0xdc82('0x33')]();};}function saveUpdates(_0x11f038,_0x2221cd){return function(_0x5b86ed){if(_0x5b86ed){return _0x5b86ed[_0xdc82('0x34')](_0x11f038)[_0xdc82('0x20')](function(_0x3c0df9){return _0x3c0df9;});}return null;};}function removeEntity(_0x2ce370,_0x4d480e){return function(_0x4206cb){if(_0x4206cb){return _0x4206cb['destroy']()[_0xdc82('0x20')](function(){_0x2ce370[_0xdc82('0x29')](0xcc)[_0xdc82('0x2a')]();});}};}function handleEntityNotFound(_0x24d520,_0x1006d8){return function(_0x68641c){if(!_0x68641c){_0x24d520[_0xdc82('0x28')](0x194);}return _0x68641c;};}function handleError(_0x2cac61,_0x28542f){_0x28542f=_0x28542f||0x1f4;return function(_0x594a8b){logger[_0xdc82('0x25')](_0x594a8b['stack']);if(_0x594a8b['name']){delete _0x594a8b[_0xdc82('0x35')];}_0x2cac61[_0xdc82('0x29')](_0x28542f)['send'](_0x594a8b);};}exports[_0xdc82('0x36')]=function(_0xd14e33,_0x37d40b){var _0x3e2e8b={},_0x361d40={},_0x429c16={'count':0x0,'rows':[]};var _0x209e14=_[_0xdc82('0x37')](db[_0xdc82('0x38')][_0xdc82('0x39')],function(_0x5bfb36){return{'name':_0x5bfb36['fieldName'],'type':_0x5bfb36[_0xdc82('0x3a')][_0xdc82('0x3b')]};});_0x361d40[_0xdc82('0x3c')]=_[_0xdc82('0x37')](_0x209e14,'name');_0x361d40[_0xdc82('0x3d')]=_[_0xdc82('0x3e')](_0xd14e33[_0xdc82('0x3d')]);_0x361d40[_0xdc82('0x3f')]=_['intersection'](_0x361d40[_0xdc82('0x3c')],_0x361d40['query']);_0x3e2e8b[_0xdc82('0x40')]=_['intersection'](_0x361d40[_0xdc82('0x3c')],qs[_0xdc82('0x41')](_0xd14e33[_0xdc82('0x3d')]['fields']));_0x3e2e8b[_0xdc82('0x40')]=_0x3e2e8b[_0xdc82('0x40')][_0xdc82('0x42')]?_0x3e2e8b[_0xdc82('0x40')]:_0x361d40[_0xdc82('0x3c')];if(!_0xd14e33['query'][_0xdc82('0x43')](_0xdc82('0x44'))){_0x3e2e8b[_0xdc82('0x2e')]=qs[_0xdc82('0x2e')](_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x2e')]);_0x3e2e8b[_0xdc82('0x2c')]=qs[_0xdc82('0x2c')](_0xd14e33['query']['offset']);}_0x3e2e8b[_0xdc82('0x45')]=qs[_0xdc82('0x46')](_0xd14e33[_0xdc82('0x3d')]['sort']);_0x3e2e8b[_0xdc82('0x47')]=qs['filters'](_[_0xdc82('0x48')](_0xd14e33[_0xdc82('0x3d')],_0x361d40[_0xdc82('0x3f')]),_0x209e14);if(_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x49')]){_0x3e2e8b['where']=_[_0xdc82('0x4a')](_0x3e2e8b['where'],{'$or':_[_0xdc82('0x37')](_0x209e14,function(_0x54711a){if(_0x54711a[_0xdc82('0x3a')]!==_0xdc82('0x4b')){var _0x2b2b2f={};_0x2b2b2f[_0x54711a['name']]={'$like':'%'+_0xd14e33[_0xdc82('0x3d')]['filter']+'%'};return _0x2b2b2f;}})});}_0x3e2e8b=_[_0xdc82('0x4a')]({},_0x3e2e8b,_0xd14e33['options']);var _0x431d3d={'where':_0x3e2e8b[_0xdc82('0x47')]};return db[_0xdc82('0x38')][_0xdc82('0x2f')](_0x431d3d)[_0xdc82('0x20')](function(_0x2dc130){_0x429c16[_0xdc82('0x2f')]=_0x2dc130;if(_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x4c')]){_0x3e2e8b[_0xdc82('0x4d')]=[{'all':!![]}];}return db[_0xdc82('0x38')][_0xdc82('0x4e')](_0x3e2e8b);})[_0xdc82('0x20')](function(_0x432fd2){_0x429c16[_0xdc82('0x4f')]=_0x432fd2;return _0x429c16;})[_0xdc82('0x20')](respondWithFilteredResult(_0x37d40b,_0x3e2e8b))[_0xdc82('0x50')](handleError(_0x37d40b,null));};exports[_0xdc82('0x51')]=function(_0x553e7e,_0x287989){var _0x2d40e1={'raw':!![],'where':{'id':_0x553e7e[_0xdc82('0x52')]['id']}},_0x12dc61={};_0x12dc61[_0xdc82('0x3c')]=_[_0xdc82('0x3e')](db['OpenchannelMessage']['rawAttributes']);_0x12dc61['query']=_['keys'](_0x553e7e['query']);_0x12dc61[_0xdc82('0x3f')]=_[_0xdc82('0x53')](_0x12dc61[_0xdc82('0x3c')],_0x12dc61['query']);_0x2d40e1[_0xdc82('0x40')]=_[_0xdc82('0x53')](_0x12dc61[_0xdc82('0x3c')],qs[_0xdc82('0x41')](_0x553e7e[_0xdc82('0x3d')][_0xdc82('0x41')]));_0x2d40e1[_0xdc82('0x40')]=_0x2d40e1[_0xdc82('0x40')][_0xdc82('0x42')]?_0x2d40e1[_0xdc82('0x40')]:_0x12dc61[_0xdc82('0x3c')];if(_0x553e7e[_0xdc82('0x3d')]['includeAll']){_0x2d40e1[_0xdc82('0x4d')]=[{'all':!![]}];}_0x2d40e1=_[_0xdc82('0x4a')]({},_0x2d40e1,_0x553e7e[_0xdc82('0x54')]);return db[_0xdc82('0x38')][_0xdc82('0x55')](_0x2d40e1)[_0xdc82('0x20')](handleEntityNotFound(_0x287989,null))[_0xdc82('0x20')](respondWithResult(_0x287989,null))[_0xdc82('0x50')](handleError(_0x287989,null));};exports[_0xdc82('0x56')]=function(_0x140b96,_0x4d1ae9){return db[_0xdc82('0x38')][_0xdc82('0x56')](_0x140b96[_0xdc82('0x57')],{})[_0xdc82('0x20')](respondWithResult(_0x4d1ae9,0xc9))[_0xdc82('0x50')](handleError(_0x4d1ae9,null));};exports[_0xdc82('0x34')]=function(_0x157316,_0x580f81){if(_0x157316[_0xdc82('0x57')]['id']){delete _0x157316[_0xdc82('0x57')]['id'];}return db['OpenchannelMessage'][_0xdc82('0x55')]({'where':{'id':_0x157316[_0xdc82('0x52')]['id']}})['then'](handleEntityNotFound(_0x580f81,null))[_0xdc82('0x20')](saveUpdates(_0x157316[_0xdc82('0x57')],null))[_0xdc82('0x20')](respondWithResult(_0x580f81,null))[_0xdc82('0x50')](handleError(_0x580f81,null));};exports[_0xdc82('0x58')]=function(_0x158120,_0x5d575a){return db[_0xdc82('0x38')]['find']({'where':{'id':_0x158120[_0xdc82('0x52')]['id']}})[_0xdc82('0x20')](handleEntityNotFound(_0x5d575a,null))[_0xdc82('0x20')](removeEntity(_0x5d575a,null))[_0xdc82('0x50')](handleError(_0x5d575a,null));};exports[_0xdc82('0x59')]=function(_0x26e29e,_0xd8278f){return db[_0xdc82('0x38')][_0xdc82('0x59')]()['then'](respondWithResult(_0xd8278f,null))[_0xdc82('0x50')](handleError(_0xd8278f,null));};var interaction_log=require(_0xdc82('0x5a'))(_0xdc82('0x5b'));exports[_0xdc82('0x5c')]=function(_0x3bbbe6,_0x5314ae,_0x4aae0f){var _0x1905f5={'agent':{},'channel':'openchannel'};if(_0x3bbbe6[_0xdc82('0x57')]['id']){delete _0x3bbbe6['body']['id'];}_0x3bbbe6[_0xdc82('0x57')]['read']=!![];_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5d')]=moment()['format'](_0xdc82('0x5e'));_0x3bbbe6['body']['UserId']=_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')]||_0x3bbbe6[_0xdc82('0x60')]['id'];_0x1905f5[_0xdc82('0x61')]['id']=_0x3bbbe6[_0xdc82('0x57')]['UserId'];return db[_0xdc82('0x38')][_0xdc82('0x55')]({'where':{'id':_0x3bbbe6[_0xdc82('0x52')]['id'],'UserId':null}})[_0xdc82('0x20')](handleEntityNotFound(_0x5314ae,null))[_0xdc82('0x20')](saveUpdates(_0x3bbbe6[_0xdc82('0x57')],null))[_0xdc82('0x20')](function(_0x5cd474){if(_0x5cd474){_0x1905f5[_0xdc82('0x27')]=_0x5cd474[_0xdc82('0x62')]({'plain':!![]});return db[_0xdc82('0x63')][_0xdc82('0x55')]({'where':{'id':_0x5cd474[_0xdc82('0x64')]}});}return null;})[_0xdc82('0x20')](handleEntityNotFound(_0x5314ae,null))[_0xdc82('0x20')](function(_0x3e6f66){if(_0x3e6f66){return _0x3e6f66[_0xdc82('0x34')]({'UserId':_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')],'read1stAt':_[_0xdc82('0x65')](_0x3e6f66[_0xdc82('0x66')])?moment()['format'](_0xdc82('0x5e')):undefined});}return null;})[_0xdc82('0x20')](function(_0x39b6d7){if(_0x39b6d7){_0x1905f5['interaction']=_0x39b6d7[_0xdc82('0x62')]({'plain':!![]});interaction_log[_0xdc82('0x67')](_0xdc82('0x68'),_0x3bbbe6[_0xdc82('0x60')]['id'],_0x3bbbe6[_0xdc82('0x60')]['name'],_0x3bbbe6[_0xdc82('0x60')][_0xdc82('0x69')],_0x1905f5[_0xdc82('0x6a')]['id'],_0x3bbbe6[_0xdc82('0x57')]?JSON['stringify'](_0x3bbbe6['body']):'null');return respondWithRpcPromise(_0xdc82('0x6b'),_0xdc82('0x6c'),_0x1905f5);}return null;})['then'](function(_0x5e8a63){var _0x5befb2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e8a63[_0xdc82('0x27')]['ContactId'];return db[_0xdc82('0x6d')][_0xdc82('0x3d')](_0x5befb2,{'type':db[_0xdc82('0x6e')]['QueryTypes'][_0xdc82('0x6f')],'raw':!![]})['then'](function(_0x4bb994){return _0x4bb994;});})[_0xdc82('0x20')](function(_0x31a1bc){if(_0x31a1bc){_0x1905f5['message']['contact']=_0x31a1bc[0x0];if(!_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')])return;return db['User'][_0xdc82('0x55')]({'where':{'id':_0x3bbbe6[_0xdc82('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0xdc82('0x35'),_0xdc82('0x70'),'email',_0xdc82('0x71')],'raw':!![]});}return null;})[_0xdc82('0x20')](function(_0x487fde){if(!_0x487fde)return null;_0x1905f5[_0xdc82('0x27')]['agent']=_0x487fde;return _0x1905f5;})['then'](function(_0x41655b){if(_0x41655b){if(_0x3bbbe6['body'][_0xdc82('0x72')]){_0x1905f5[_0xdc82('0x27')][_0xdc82('0x73')]=util[_0xdc82('0x74')]('SIP/%s',_0x3bbbe6['user'][_0xdc82('0x35')]);_0x1905f5[_0xdc82('0x27')][_0xdc82('0x75')]=_0x1905f5[_0xdc82('0x75')];_0x1905f5[_0xdc82('0x27')][_0xdc82('0x76')]=_0x1905f5['channel'];_0x1905f5[_0xdc82('0x27')]['event']=_0xdc82('0x5c');return respondWithRpcPromise(_0xdc82('0x77'),_0xdc82('0x77'),{'event':_0xdc82('0x78'),'message':_0x1905f5[_0xdc82('0x27')]},client9002)['then'](function(){return _0x1905f5;});}return _0x1905f5;}return null;})['then'](respondWithResult(_0x5314ae,null))[_0xdc82('0x50')](handleError(_0x5314ae,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x1500ba,_0x278f29,_0x554f15){var _0x14c6fc={'agent':{},'channel':_0xdc82('0x79')};if(_0x1500ba[_0xdc82('0x57')]['id']){delete _0x1500ba['body']['id'];}_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')]=_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')]||_0x1500ba[_0xdc82('0x60')]['id'];_0x14c6fc['agent']['id']=_0x1500ba[_0xdc82('0x57')]['UserId'];return db[_0xdc82('0x38')][_0xdc82('0x55')]({'where':{'id':_0x1500ba['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x278f29,null))['then'](function(_0x27e709){if(_0x27e709){_0x14c6fc[_0xdc82('0x27')]=_0x27e709[_0xdc82('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x27e709[_0xdc82('0x64')]}});}return null;})[_0xdc82('0x20')](handleEntityNotFound(_0x278f29,null))[_0xdc82('0x20')](function(_0x45f8c7){if(_0x45f8c7){_0x14c6fc[_0xdc82('0x6a')]=_0x45f8c7[_0xdc82('0x62')]({'plain':!![]});interaction_log[_0xdc82('0x67')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1500ba[_0xdc82('0x60')]['id'],_0x1500ba[_0xdc82('0x60')]['name'],_0x1500ba[_0xdc82('0x60')][_0xdc82('0x69')],_0x14c6fc[_0xdc82('0x6a')]['id'],_0x1500ba[_0xdc82('0x57')]?JSON[_0xdc82('0x24')](_0x1500ba[_0xdc82('0x57')]):'null');return respondWithRpcPromise(_0xdc82('0x7a'),'rejectMessage',_0x14c6fc);}return null;})['then'](function(_0x2f34f1){var _0x41590e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f34f1['message'][_0xdc82('0x7b')];return db['sequelize'][_0xdc82('0x3d')](_0x41590e,{'type':db[_0xdc82('0x6e')][_0xdc82('0x7c')][_0xdc82('0x6f')],'raw':!![]})[_0xdc82('0x20')](function(_0x1dd043){return _0x1dd043;});})[_0xdc82('0x20')](function(_0x6dbee2){if(_0x6dbee2){_0x14c6fc[_0xdc82('0x27')][_0xdc82('0x7d')]=_0x6dbee2[0x0];if(!_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')])return;return db[_0xdc82('0x7e')][_0xdc82('0x55')]({'where':{'id':_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')],'role':'agent'},'attributes':['id',_0xdc82('0x35'),_0xdc82('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xdc82('0x20')](function(_0x291bc4){if(!_0x291bc4)return null;_0x14c6fc[_0xdc82('0x27')][_0xdc82('0x61')]=_0x291bc4;return _0x14c6fc;})['then'](function(_0x174822){if(_0x174822){_0x174822[_0xdc82('0x27')]['interface']=util[_0xdc82('0x74')](_0xdc82('0x7f'),_0x1500ba[_0xdc82('0x60')][_0xdc82('0x35')]);_0x174822[_0xdc82('0x27')][_0xdc82('0x75')]=_0x14c6fc[_0xdc82('0x75')];_0x174822[_0xdc82('0x27')][_0xdc82('0x76')]=_0x14c6fc[_0xdc82('0x75')];_0x174822[_0xdc82('0x27')]['event']=_0xdc82('0x32');respondWithRpcPromise(_0xdc82('0x77'),'EventManager',{'event':'rejectmessage','message':_0x174822[_0xdc82('0x27')]},client9002);return _0x14c6fc;}return null;})['then'](respondWithResult(_0x278f29,null))[_0xdc82('0x50')](handleError(_0x278f29,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ba14abd..6aa2308 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 _0x24be=['hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x24be,0xbf));var _0xe24b=function(_0x512cb6,_0x2ed84d){_0x512cb6=_0x512cb6-0x0;var _0x2e0cdc=_0x24be[_0x512cb6];return _0x2e0cdc;};'use strict';var EventEmitter=require(_0xe24b('0x0'));var OpenchannelMessage=require(_0xe24b('0x1'))['db'][_0xe24b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe24b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe24b('0x4'),'afterDestroy':_0xe24b('0x5')};function emitEvent(_0x432ec6){return function(_0x384f8c,_0x2179b5,_0x3bfb01){OpenchannelMessageEvents[_0xe24b('0x6')](_0x432ec6+':'+_0x384f8c['id'],_0x384f8c);OpenchannelMessageEvents[_0xe24b('0x6')](_0x432ec6,_0x384f8c);_0x3bfb01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe24b('0x7')](e,emitEvent(event));}}module[_0xe24b('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1575=['save','remove','emit','hook','events','../../mysqldb'];(function(_0x56139e,_0x714ec2){var _0x113526=function(_0x529c28){while(--_0x529c28){_0x56139e['push'](_0x56139e['shift']());}};_0x113526(++_0x714ec2);}(_0x1575,0x88));var _0x5157=function(_0x3a7650,_0x458946){_0x3a7650=_0x3a7650-0x0;var _0x136de7=_0x1575[_0x3a7650];return _0x136de7;};'use strict';var EventEmitter=require(_0x5157('0x0'));var OpenchannelMessage=require(_0x5157('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5157('0x2'),'afterUpdate':'update','afterDestroy':_0x5157('0x3')};function emitEvent(_0x505f43){return function(_0x1e97da,_0x119c78,_0x18fb17){OpenchannelMessageEvents[_0x5157('0x4')](_0x505f43+':'+_0x1e97da['id'],_0x1e97da);OpenchannelMessageEvents[_0x5157('0x4')](_0x505f43,_0x1e97da);_0x18fb17(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x5157('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9b41d0d..8bc285e 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 _0x730a=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','method','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','createdAt','catch','error','CmContact','then','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','replyUri','info','afterCreate'];(function(_0x1e9211,_0x2ffb1e){var _0x3f4748=function(_0x5062b5){while(--_0x5062b5){_0x1e9211['push'](_0x1e9211['shift']());}};_0x3f4748(++_0x2ffb1e);}(_0x730a,0x19f));var _0xa730=function(_0x560d00,_0x5ef422){_0x560d00=_0x560d00-0x0;var _0xd80ada=_0x730a[_0x560d00];return _0xd80ada;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var logger=require('../../config/logger')(_0xa730('0x2'));var moment=require(_0xa730('0x3'));var BPromise=require(_0xa730('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa730('0x5'));var rimraf=require(_0xa730('0x6'));var config=require(_0xa730('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xa730('0x8')]=function(_0x361b9f,_0x32f3a4){return _0x361b9f[_0xa730('0x9')](_0xa730('0xa'),attributes,{'tableName':_0xa730('0xb'),'paranoid':![],'indexes':[{'name':_0xa730('0xc'),'fields':[_0xa730('0xd')],'type':_0xa730('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x593fc8,_0x54a9d5,_0x56c296){var _0x9e9535=_0x361b9f['models'];var _0x2097c8=_0x593fc8[_0xa730('0xf')]({'plain':!![]});if(_0x2097c8[_0xa730('0x10')]['toLowerCase']()==='in'||_0x2097c8[_0xa730('0x10')][_0xa730('0x11')]()===_0xa730('0x12')&&!_0x2097c8[_0xa730('0x13')]&&!_[_0xa730('0x14')](_0x2097c8['UserId'])){_0x9e9535[_0xa730('0x15')][_0xa730('0x16')]({'where':{'id':_0x2097c8['OpenchannelInteractionId']}})['then'](function(_0x42bb96){if(_0x42bb96){_0x42bb96['update']({'lastMsgAt':_0x2097c8[_0xa730('0x17')],'lastMsgDirection':_0x2097c8[_0xa730('0x10')][_0xa730('0x11')]()});}})[_0xa730('0x18')](function(_0x51d431){console[_0xa730('0x19')](_0x51d431);});}if(_0x2097c8[_0xa730('0x10')]===_0xa730('0x12')&&!_0x2097c8['secret']){var _0x58c8d9;_0x9e9535[_0xa730('0x1a')]['describe']()[_0xa730('0x1b')](function(_0x473790){return _0x9e9535[_0xa730('0x1c')][_0xa730('0x1d')]({'where':{'id':_0x2097c8['OpenchannelAccountId']},'include':[{'model':_0x9e9535[_0xa730('0x15')],'as':_0xa730('0x1e'),'where':{'id':_0x2097c8[_0xa730('0x1f')]},'limit':0x1,'include':[{'model':_0x9e9535[_0xa730('0x1a')],'as':'Contact','attributes':_['keys'](_0x473790)}]}]});})['then'](function(_0x3d1dcd){_0x58c8d9=_0x3d1dcd[_0xa730('0xf')]({'plain':!![]});if(_0x58c8d9&&_0x58c8d9[_0xa730('0x20')]){logger[_0xa730('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xa730('0x22'),util[_0xa730('0x23')](_0xa730('0x24'),_0x2097c8['id'],_0x58c8d9['replyUri']));if(_0x58c8d9[_0xa730('0x1e')]&&_0x58c8d9[_0xa730('0x1e')][_0xa730('0x25')]){_0x2097c8[_0xa730('0x26')]=_[_0xa730('0x27')](_0x58c8d9[_0xa730('0x1e')][0x0],_0xa730('0x28'));_0x2097c8[_0xa730('0x28')]=_0x58c8d9[_0xa730('0x1e')][0x0][_0xa730('0x28')];}var _0x54a9d5={'method':'POST','uri':encodeURI(_0x58c8d9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x54a9d5[_0xa730('0x29')]){case'GET':_0x54a9d5['qs']=_0x2097c8;break;case _0xa730('0x2a'):_0x54a9d5['body']=_0x2097c8;break;}return rp(_0x54a9d5)[_0xa730('0x1b')](function(_0x1aba6d){logger['info'](_0xa730('0x2b'),_0xa730('0x22'),util['format'](_0xa730('0x2c'),_0x2097c8['id'],_0x58c8d9[_0xa730('0x20')]));if(_0x1aba6d[_0xa730('0xd')][_0xa730('0x2d')]&&_0x1aba6d['body']['threadId']!=_0x2097c8['Interaction'][_0xa730('0x2d')]){return _0x9e9535[_0xa730('0x15')][_0xa730('0x2e')]({'threadId':_0x1aba6d[_0xa730('0xd')][_0xa730('0x2d')]},{'where':{'id':_0x2097c8[_0xa730('0x26')]['id']}});}else{return;}})[_0xa730('0x1b')](function(){return _0x593fc8[_0xa730('0x2e')]({'read':!![]});})[_0xa730('0x18')](function(_0x38e6a2){logger['error'](_0xa730('0x2b'),_0xa730('0x22'),util[_0xa730('0x2f')](_0x38e6a2,{'showHidden':![],'depth':null}));_0x56c296();});}else{_0x56c296();}})['finally'](function(){_0x56c296();});}else{_0x56c296();}}},'charset':_0xa730('0x30'),'collate':_0xa730('0x31')});}; \ No newline at end of file +var _0x70b4=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','then','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','OpenchannelMessage,\x20%s,\x20%s','threadId'];(function(_0x509b99,_0x3ff1f0){var _0x383d46=function(_0x5cfcab){while(--_0x5cfcab){_0x509b99['push'](_0x509b99['shift']());}};_0x383d46(++_0x3ff1f0);}(_0x70b4,0x130));var _0x470b=function(_0x4941bc,_0x199598){_0x4941bc=_0x4941bc-0x0;var _0xf3862d=_0x70b4[_0x4941bc];return _0xf3862d;};'use strict';var _=require(_0x470b('0x0'));var util=require('util');var logger=require(_0x470b('0x1'))(_0x470b('0x2'));var moment=require(_0x470b('0x3'));var BPromise=require(_0x470b('0x4'));var rp=require(_0x470b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x470b('0x6'));var config=require(_0x470b('0x7'));var attributes=require(_0x470b('0x8'));module['exports']=function(_0x256e8d,_0x1e9725){return _0x256e8d[_0x470b('0x9')](_0x470b('0xa'),attributes,{'tableName':_0x470b('0xb'),'paranoid':![],'indexes':[{'name':_0x470b('0xc'),'fields':[_0x470b('0xd')],'type':_0x470b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fe321,_0x245a4b,_0x4670c7){var _0x3d64f9=_0x256e8d[_0x470b('0xf')];var _0x3b2bb8=_0x2fe321[_0x470b('0x10')]({'plain':!![]});if(_0x3b2bb8['direction'][_0x470b('0x11')]()==='in'||_0x3b2bb8[_0x470b('0x12')][_0x470b('0x11')]()===_0x470b('0x13')&&!_0x3b2bb8['secret']&&!_['isNil'](_0x3b2bb8['UserId'])){_0x3d64f9[_0x470b('0x14')][_0x470b('0x15')]({'where':{'id':_0x3b2bb8[_0x470b('0x16')]}})['then'](function(_0x288966){if(_0x288966){_0x288966[_0x470b('0x17')]({'lastMsgAt':_0x3b2bb8[_0x470b('0x18')],'lastMsgDirection':_0x3b2bb8[_0x470b('0x12')][_0x470b('0x11')]()});}})['catch'](function(_0x325ba5){console[_0x470b('0x19')](_0x325ba5);});}if(_0x3b2bb8['direction']==='out'&&!_0x3b2bb8[_0x470b('0x1a')]){var _0x109c6a;_0x3d64f9[_0x470b('0x1b')][_0x470b('0x1c')]()['then'](function(_0x49d4e4){return _0x3d64f9[_0x470b('0x1d')][_0x470b('0x1e')]({'where':{'id':_0x3b2bb8[_0x470b('0x1f')]},'include':[{'model':_0x3d64f9['OpenchannelInteraction'],'as':_0x470b('0x20'),'where':{'id':_0x3b2bb8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3d64f9[_0x470b('0x1b')],'as':_0x470b('0x21'),'attributes':_[_0x470b('0x22')](_0x49d4e4)}]}]});})[_0x470b('0x23')](function(_0x5c437b){_0x109c6a=_0x5c437b[_0x470b('0x10')]({'plain':!![]});if(_0x109c6a&&_0x109c6a[_0x470b('0x24')]){logger[_0x470b('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x470b('0x26'),util[_0x470b('0x27')](_0x470b('0x28'),_0x3b2bb8['id'],_0x109c6a[_0x470b('0x24')]));if(_0x109c6a[_0x470b('0x20')]&&_0x109c6a['Interactions']['length']){_0x3b2bb8[_0x470b('0x29')]=_[_0x470b('0x2a')](_0x109c6a['Interactions'][0x0],_0x470b('0x21'));_0x3b2bb8['Contact']=_0x109c6a['Interactions'][0x0][_0x470b('0x21')];}var _0x245a4b={'method':_0x470b('0x2b'),'uri':encodeURI(_0x109c6a[_0x470b('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x245a4b['method']){case'GET':_0x245a4b['qs']=_0x3b2bb8;break;case _0x470b('0x2b'):_0x245a4b['body']=_0x3b2bb8;break;}return rp(_0x245a4b)[_0x470b('0x23')](function(_0x1d934f){logger[_0x470b('0x25')](_0x470b('0x2c'),_0x470b('0x26'),util[_0x470b('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b2bb8['id'],_0x109c6a[_0x470b('0x24')]));if(_0x1d934f[_0x470b('0xd')][_0x470b('0x2d')]&&_0x1d934f[_0x470b('0xd')][_0x470b('0x2d')]!=_0x3b2bb8[_0x470b('0x29')][_0x470b('0x2d')]){return _0x3d64f9[_0x470b('0x14')][_0x470b('0x17')]({'threadId':_0x1d934f['body']['threadId']},{'where':{'id':_0x3b2bb8[_0x470b('0x29')]['id']}});}else{return;}})[_0x470b('0x23')](function(){return _0x2fe321[_0x470b('0x17')]({'read':!![]});})['catch'](function(_0x3ff27a){logger[_0x470b('0x19')](_0x470b('0x2c'),_0x470b('0x26'),util[_0x470b('0x2e')](_0x3ff27a,{'showHidden':![],'depth':null}));_0x4670c7();});}else{_0x4670c7();}})[_0x470b('0x2f')](function(){_0x4670c7();});}else{_0x4670c7();}}},'charset':_0x470b('0x30'),'collate':_0x470b('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f28ba3b..ebe37c1 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xceee2f,_0x12b842){var _0x398ed9=function(_0x5db958){while(--_0x5db958){_0xceee2f['push'](_0xceee2f['shift']());}};_0x398ed9(++_0x12b842);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23ea61,_0xe8613b){_0x23ea61=_0x23ea61-0x0;var _0x5118fb=_0x5f2f[_0x23ea61];return _0x5118fb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','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','./openchannelMessage.socket','register','request'];(function(_0x4cacfc,_0x56dfe0){var _0xffb88c=function(_0x3023b7){while(--_0x3023b7){_0x4cacfc['push'](_0x4cacfc['shift']());}};_0xffb88c(++_0x56dfe0);}(_0xdb28,0x106));var _0x8db2=function(_0x2e0c50,_0x47cf9c){_0x2e0c50=_0x2e0c50-0x0;var _0x1a5ddd=_0xdb28[_0x2e0c50];return _0x1a5ddd;};'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')]('OpenchannelMessage,\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')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7884e49..6bcb986 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 _0xc5b4=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x2da2e2,_0x22e13c){var _0x5e0ef5=function(_0x550e01){while(--_0x550e01){_0x2da2e2['push'](_0x2da2e2['shift']());}};_0x5e0ef5(++_0x22e13c);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x4d0244,_0x6edca9){_0x4d0244=_0x4d0244-0x0;var _0x42e125=_0xc5b4[_0x4d0244];return _0x42e125;};'use strict';var OpenchannelMessageEvents=require(_0x4c5b('0x0'));var events=[_0x4c5b('0x1'),_0x4c5b('0x2'),_0x4c5b('0x3')];function createListener(_0x4b5219,_0x1d86d8){return function(_0x48da66){_0x1d86d8[_0x4c5b('0x4')](_0x4b5219,_0x48da66);};}function removeListener(_0x5f0720,_0x3dfc1d){return function(){OpenchannelMessageEvents[_0x4c5b('0x5')](_0x5f0720,_0x3dfc1d);};}exports[_0x4c5b('0x6')]=function(_0x2357cd){for(var _0x5e1471=0x0,_0x4ada7a=events[_0x4c5b('0x7')];_0x5e1471<_0x4ada7a;_0x5e1471++){var _0x233674=events[_0x5e1471];var _0xba50f6=createListener(_0x4c5b('0x8')+_0x233674,_0x2357cd);OpenchannelMessageEvents['on'](_0x233674,_0xba50f6);}}; \ No newline at end of file +var _0x96b7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0x96b7,0x149));var _0x796b=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x96b7[_0x38e8b0];return _0x139697;};'use strict';var OpenchannelMessageEvents=require(_0x796b('0x0'));var events=[_0x796b('0x1'),_0x796b('0x2'),_0x796b('0x3')];function createListener(_0x5210d4,_0x39b4f7){return function(_0x571082){_0x39b4f7[_0x796b('0x4')](_0x5210d4,_0x571082);};}function removeListener(_0x2268ff,_0x5866b8){return function(){OpenchannelMessageEvents[_0x796b('0x5')](_0x2268ff,_0x5866b8);};}exports['register']=function(_0x553615){for(var _0x4cece8=0x0,_0x30dbb9=events[_0x796b('0x6')];_0x4cece8<_0x30dbb9;_0x4cece8++){var _0x243531=events[_0x4cece8];var _0x4b7951=createListener(_0x796b('0x7')+_0x243531,_0x553615);OpenchannelMessageEvents['on'](_0x243531,_0x4b7951);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f7c555b..cef7f8c 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 _0xb1d5=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','describe','/:id','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','create','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util'];(function(_0x350c8b,_0x72ad97){var _0x9d0374=function(_0x7bb700){while(--_0x7bb700){_0x350c8b['push'](_0x350c8b['shift']());}};_0x9d0374(++_0x72ad97);}(_0xb1d5,0x19e));var _0x5b1d=function(_0x4bce41,_0x286dbe){_0x4bce41=_0x4bce41-0x0;var _0x1beaf2=_0xb1d5[_0x4bce41];return _0x1beaf2;};'use strict';var multer=require(_0x5b1d('0x0'));var util=require(_0x5b1d('0x1'));var path=require(_0x5b1d('0x2'));var timeout=require(_0x5b1d('0x3'));var express=require(_0x5b1d('0x4'));var router=express['Router']();var fs_extra=require(_0x5b1d('0x5'));var auth=require(_0x5b1d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b1d('0x7'));var controller=require(_0x5b1d('0x8'));router[_0x5b1d('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b1d('0xa')]);router[_0x5b1d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5b1d('0xb')]);router['get'](_0x5b1d('0xc'),auth[_0x5b1d('0xd')](),controller['show']);router['get']('/:id/members',auth[_0x5b1d('0xd')](),controller[_0x5b1d('0xe')]);router[_0x5b1d('0x9')](_0x5b1d('0xf'),auth['isAuthenticated'](),controller[_0x5b1d('0x10')]);router[_0x5b1d('0x9')](_0x5b1d('0x11'),auth[_0x5b1d('0xd')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x5b1d('0x12')]);router['post'](_0x5b1d('0xf'),auth[_0x5b1d('0xd')](),controller[_0x5b1d('0x13')]);router['post'](_0x5b1d('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5b1d('0x14')]('/:id',auth[_0x5b1d('0xd')](),controller[_0x5b1d('0x15')]);router[_0x5b1d('0x16')]('/:id',auth[_0x5b1d('0xd')](),controller[_0x5b1d('0x17')]);router['delete'](_0x5b1d('0xf'),auth[_0x5b1d('0xd')](),controller[_0x5b1d('0x18')]);router[_0x5b1d('0x16')](_0x5b1d('0x11'),auth[_0x5b1d('0xd')](),controller['removeAgents']);module[_0x5b1d('0x19')]=router; \ No newline at end of file +var _0xce3a=['getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce3a,0x13f));var _0xace3=function(_0x218f38,_0x4f8ad6){_0x218f38=_0x218f38-0x0;var _0x4b1b83=_0xce3a[_0x218f38];return _0x4b1b83;};'use strict';var multer=require('multer');var util=require(_0xace3('0x0'));var path=require('path');var timeout=require(_0xace3('0x1'));var express=require(_0xace3('0x2'));var router=express[_0xace3('0x3')]();var fs_extra=require(_0xace3('0x4'));var auth=require(_0xace3('0x5'));var interaction=require(_0xace3('0x6'));var config=require(_0xace3('0x7'));var controller=require(_0xace3('0x8'));router[_0xace3('0x9')]('/',auth[_0xace3('0xa')](),controller['index']);router[_0xace3('0x9')]('/describe',auth[_0xace3('0xa')](),controller[_0xace3('0xb')]);router[_0xace3('0x9')](_0xace3('0xc'),auth[_0xace3('0xa')](),controller[_0xace3('0xd')]);router[_0xace3('0x9')](_0xace3('0xe'),auth[_0xace3('0xa')](),controller[_0xace3('0xf')]);router['get'](_0xace3('0x10'),auth[_0xace3('0xa')](),controller[_0xace3('0x11')]);router[_0xace3('0x9')](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x13')]);router['post']('/',auth[_0xace3('0xa')](),controller[_0xace3('0x14')]);router[_0xace3('0x15')](_0xace3('0x10'),auth[_0xace3('0xa')](),controller[_0xace3('0x16')]);router[_0xace3('0x15')](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x17')]);router[_0xace3('0x18')](_0xace3('0xc'),auth[_0xace3('0xa')](),controller['update']);router['delete'](_0xace3('0xc'),auth[_0xace3('0xa')](),controller['destroy']);router[_0xace3('0x19')](_0xace3('0x10'),auth['isAuthenticated'](),controller[_0xace3('0x1a')]);router['delete'](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x1b')]);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 00e2e42..6ea285a 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 _0xc5d7=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2c6655,_0xef67d3){var _0x4749f3=function(_0x4125f7){while(--_0x4125f7){_0x2c6655['push'](_0x2c6655['shift']());}};_0x4749f3(++_0xef67d3);}(_0xc5d7,0x199));var _0x7c5d=function(_0x2fb542,_0x2f54ac){_0x2fb542=_0x2fb542-0x0;var _0x3b15f0=_0xc5d7[_0x2fb542];return _0x3b15f0;};'use strict';var Sequelize=require(_0x7c5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c5d('0x1')],'unique':_0x7c5d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7c5d('0x1')]},'timeout':{'type':Sequelize[_0x7c5d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c5d('0x4')](_0x7c5d('0x5'),_0x7c5d('0x6'),_0x7c5d('0x7'))}}; \ No newline at end of file +var _0x040f=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x109c0f,_0x3be9f4){var _0x4ed42b=function(_0x361d32){while(--_0x361d32){_0x109c0f['push'](_0x109c0f['shift']());}};_0x4ed42b(++_0x3be9f4);}(_0x040f,0x1e0));var _0xf040=function(_0x266df3,_0x310f44){_0x266df3=_0x266df3-0x0;var _0x36684b=_0x040f[_0x266df3];return _0x36684b;};'use strict';var Sequelize=require(_0xf040('0x0'));module[_0xf040('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf040('0x2')]},'timeout':{'type':Sequelize[_0xf040('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf040('0x4')](_0xf040('0x5'),_0xf040('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a878abe..9bafbd0 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 _0x0fc8=['VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','UserId','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','rimraf','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','status','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x549a2c,_0x13bd03){var _0x16b56b=function(_0x2798fc){while(--_0x2798fc){_0x549a2c['push'](_0x549a2c['shift']());}};_0x16b56b(++_0x13bd03);}(_0x0fc8,0x1d7));var _0x80fc=function(_0x11898e,_0x4cb0cc){_0x11898e=_0x11898e-0x0;var _0x5b4fb8=_0x0fc8[_0x11898e];return _0x5b4fb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80fc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x80fc('0x1'));var moment=require(_0x80fc('0x2'));var BPromise=require(_0x80fc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x80fc('0x4'));var sox=require(_0x80fc('0x5'));var csv=require(_0x80fc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80fc('0x7'));var _=require(_0x80fc('0x8'));var squel=require('squel');var crypto=require(_0x80fc('0x9'));var jsforce=require(_0x80fc('0xa'));var deskjs=require(_0x80fc('0xb'));var toCsv=require(_0x80fc('0x6'));var querystring=require(_0x80fc('0xc'));var Papa=require(_0x80fc('0xd'));var Redis=require(_0x80fc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80fc('0xf'));var logger=require(_0x80fc('0x10'))(_0x80fc('0x11'));var utils=require(_0x80fc('0x12'));var config=require(_0x80fc('0x13'));var licenseUtil=require(_0x80fc('0x14'));var db=require('../../mysqldb')['db'];config[_0x80fc('0x15')]=_[_0x80fc('0x16')](config[_0x80fc('0x15')],{'host':_0x80fc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80fc('0x15')]));require('./openchannelQueue.socket')[_0x80fc('0x18')](socket);function respondWithStatusCode(_0x111b3d,_0x54ad99){_0x54ad99=_0x54ad99||0xcc;return function(_0x255193){if(_0x255193){return _0x111b3d[_0x80fc('0x19')](_0x54ad99);}return _0x111b3d['status'](_0x54ad99)['end']();};}function respondWithResult(_0x459d86,_0x36882a){_0x36882a=_0x36882a||0xc8;return function(_0xcf81bd){if(_0xcf81bd){return _0x459d86['status'](_0x36882a)[_0x80fc('0x1a')](_0xcf81bd);}};}function respondWithFilteredResult(_0x2c9b1e,_0x4a6ca3){return function(_0x21686f){if(_0x21686f){var _0x1ad19b=typeof _0x4a6ca3[_0x80fc('0x1b')]===_0x80fc('0x1c')&&typeof _0x4a6ca3[_0x80fc('0x1d')]==='undefined';var _0x32317b=_0x21686f['count'];var _0x132ce5=_0x1ad19b?0x0:_0x4a6ca3['offset'];var _0x2e03c9=_0x1ad19b?_0x21686f[_0x80fc('0x1e')]:_0x4a6ca3[_0x80fc('0x1b')]+_0x4a6ca3['limit'];var _0x3fc460;if(_0x2e03c9>=_0x32317b){_0x2e03c9=_0x32317b;_0x3fc460=0xc8;}else{_0x3fc460=0xce;}_0x2c9b1e['status'](_0x3fc460);return _0x2c9b1e[_0x80fc('0x1f')]('Content-Range',_0x132ce5+'-'+_0x2e03c9+'/'+_0x32317b)[_0x80fc('0x1a')](_0x21686f);}return null;};}function patchUpdates(_0xb30491){return function(_0x52c8b8){try{jsonpatch[_0x80fc('0x20')](_0x52c8b8,_0xb30491,!![]);}catch(_0x405df5){return BPromise[_0x80fc('0x21')](_0x405df5);}return _0x52c8b8[_0x80fc('0x22')]();};}function saveUpdates(_0x11e305,_0x49acf4){return function(_0x208e2f){if(_0x208e2f){return _0x208e2f[_0x80fc('0x23')](_0x11e305)[_0x80fc('0x24')](function(_0x1ed505){return _0x1ed505;});}return null;};}function removeEntity(_0x2546db,_0x4942e0){return function(_0x3ae0ad){if(_0x3ae0ad){return _0x3ae0ad[_0x80fc('0x25')]()[_0x80fc('0x24')](function(){var _0x131fb6=_0x3ae0ad[_0x80fc('0x26')]({'plain':!![]});var _0x492045=_0x80fc('0x27');return db[_0x80fc('0x28')][_0x80fc('0x25')]({'where':{'type':_0x492045,'resourceId':_0x131fb6['id']}})[_0x80fc('0x24')](function(){return _0x3ae0ad;});})[_0x80fc('0x24')](function(){_0x2546db[_0x80fc('0x29')](0xcc)[_0x80fc('0x2a')]();});}};}function handleEntityNotFound(_0x29fe3b,_0x5a69e8){return function(_0x5b376b){if(!_0x5b376b){_0x29fe3b[_0x80fc('0x19')](0x194);}return _0x5b376b;};}function handleError(_0x5e5e03,_0x54a98a){_0x54a98a=_0x54a98a||0x1f4;return function(_0x37d0a2){logger[_0x80fc('0x2b')](_0x37d0a2[_0x80fc('0x2c')]);if(_0x37d0a2['name']){delete _0x37d0a2[_0x80fc('0x2d')];}_0x5e5e03['status'](_0x54a98a)[_0x80fc('0x2e')](_0x37d0a2);};}exports[_0x80fc('0x2f')]=function(_0x232130,_0x4c4b2a){var _0x4ecef3={},_0x47adcd={},_0x5983f8={'count':0x0,'rows':[]};var _0x1ea062=_[_0x80fc('0x30')](db[_0x80fc('0x31')][_0x80fc('0x32')],function(_0x784fc){return{'name':_0x784fc[_0x80fc('0x33')],'type':_0x784fc[_0x80fc('0x34')][_0x80fc('0x35')]};});_0x47adcd[_0x80fc('0x36')]=_[_0x80fc('0x30')](_0x1ea062,_0x80fc('0x2d'));_0x47adcd[_0x80fc('0x37')]=_[_0x80fc('0x38')](_0x232130[_0x80fc('0x37')]);_0x47adcd[_0x80fc('0x39')]=_[_0x80fc('0x3a')](_0x47adcd[_0x80fc('0x36')],_0x47adcd[_0x80fc('0x37')]);_0x4ecef3[_0x80fc('0x3b')]=_[_0x80fc('0x3a')](_0x47adcd[_0x80fc('0x36')],qs[_0x80fc('0x3c')](_0x232130[_0x80fc('0x37')][_0x80fc('0x3c')]));_0x4ecef3[_0x80fc('0x3b')]=_0x4ecef3[_0x80fc('0x3b')][_0x80fc('0x3d')]?_0x4ecef3[_0x80fc('0x3b')]:_0x47adcd[_0x80fc('0x36')];if(!_0x232130[_0x80fc('0x37')][_0x80fc('0x3e')](_0x80fc('0x3f'))){_0x4ecef3['limit']=qs['limit'](_0x232130[_0x80fc('0x37')][_0x80fc('0x1d')]);_0x4ecef3[_0x80fc('0x1b')]=qs[_0x80fc('0x1b')](_0x232130['query'][_0x80fc('0x1b')]);}_0x4ecef3[_0x80fc('0x40')]=qs[_0x80fc('0x41')](_0x232130[_0x80fc('0x37')][_0x80fc('0x41')]);_0x4ecef3['where']=qs[_0x80fc('0x39')](_['pick'](_0x232130[_0x80fc('0x37')],_0x47adcd[_0x80fc('0x39')]),_0x1ea062);if(_0x232130[_0x80fc('0x37')][_0x80fc('0x42')]){_0x4ecef3[_0x80fc('0x43')]=_[_0x80fc('0x44')](_0x4ecef3[_0x80fc('0x43')],{'$or':_[_0x80fc('0x30')](_0x1ea062,function(_0x4fae90){if(_0x4fae90[_0x80fc('0x34')]!==_0x80fc('0x45')){var _0x1267bb={};_0x1267bb[_0x4fae90[_0x80fc('0x2d')]]={'$like':'%'+_0x232130[_0x80fc('0x37')][_0x80fc('0x42')]+'%'};return _0x1267bb;}})});}_0x4ecef3=_[_0x80fc('0x44')]({},_0x4ecef3,_0x232130[_0x80fc('0x46')]);var _0x5895be={'where':_0x4ecef3[_0x80fc('0x43')]};return db[_0x80fc('0x31')][_0x80fc('0x1e')](_0x5895be)[_0x80fc('0x24')](function(_0x14d228){_0x5983f8[_0x80fc('0x1e')]=_0x14d228;if(_0x232130[_0x80fc('0x37')][_0x80fc('0x47')]){_0x4ecef3['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x80fc('0x48')](_0x4ecef3);})[_0x80fc('0x24')](function(_0xa50466){_0x5983f8[_0x80fc('0x49')]=_0xa50466;return _0x5983f8;})[_0x80fc('0x24')](respondWithFilteredResult(_0x4c4b2a,_0x4ecef3))[_0x80fc('0x4a')](handleError(_0x4c4b2a,null));};exports[_0x80fc('0x4b')]=function(_0x340b89,_0x13e144){var _0x155176={'raw':!![],'where':{'id':_0x340b89[_0x80fc('0x4c')]['id']}},_0xd28222={};_0xd28222['model']=_[_0x80fc('0x38')](db[_0x80fc('0x31')]['rawAttributes']);_0xd28222[_0x80fc('0x37')]=_[_0x80fc('0x38')](_0x340b89['query']);_0xd28222[_0x80fc('0x39')]=_[_0x80fc('0x3a')](_0xd28222[_0x80fc('0x36')],_0xd28222[_0x80fc('0x37')]);_0x155176[_0x80fc('0x3b')]=_[_0x80fc('0x3a')](_0xd28222[_0x80fc('0x36')],qs[_0x80fc('0x3c')](_0x340b89[_0x80fc('0x37')][_0x80fc('0x3c')]));_0x155176[_0x80fc('0x3b')]=_0x155176[_0x80fc('0x3b')][_0x80fc('0x3d')]?_0x155176[_0x80fc('0x3b')]:_0xd28222[_0x80fc('0x36')];if(_0x340b89[_0x80fc('0x37')]['includeAll']){_0x155176[_0x80fc('0x4d')]=[{'all':!![]}];}_0x155176=_['merge']({},_0x155176,_0x340b89[_0x80fc('0x46')]);return db[_0x80fc('0x31')][_0x80fc('0x4e')](_0x155176)[_0x80fc('0x24')](handleEntityNotFound(_0x13e144,null))[_0x80fc('0x24')](respondWithResult(_0x13e144,null))[_0x80fc('0x4a')](handleError(_0x13e144,null));};exports[_0x80fc('0x4f')]=function(_0x4f47e9,_0x3f039f){return db['OpenchannelQueue'][_0x80fc('0x4f')](_0x4f47e9[_0x80fc('0x50')],{})[_0x80fc('0x24')](function(_0x412556){var _0x3e0dc4=_0x4f47e9[_0x80fc('0x51')]['get']({'plain':!![]});if(!_0x3e0dc4)throw new Error(_0x80fc('0x52'));if(_0x3e0dc4['role']===_0x80fc('0x51')){var _0x2bec0a=_0x412556['get']({'plain':!![]});var _0x529aa6='OpenchannelQueues';return db[_0x80fc('0x53')][_0x80fc('0x4e')]({'where':{'name':_0x529aa6,'userProfileId':_0x3e0dc4['userProfileId']},'raw':!![]})[_0x80fc('0x24')](function(_0x2ff96c){if(_0x2ff96c&&_0x2ff96c['autoAssociation']===0x0){return db['UserProfileResource'][_0x80fc('0x4f')]({'name':_0x2bec0a[_0x80fc('0x2d')],'resourceId':_0x2bec0a['id'],'type':_0x2ff96c[_0x80fc('0x2d')],'sectionId':_0x2ff96c['id']},{})[_0x80fc('0x24')](function(){return _0x412556;});}else{return _0x412556;}})[_0x80fc('0x4a')](function(_0x28af59){logger[_0x80fc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28af59);throw _0x28af59;});}return _0x412556;})['then'](respondWithResult(_0x3f039f,0xc9))[_0x80fc('0x4a')](handleError(_0x3f039f,null));};exports[_0x80fc('0x23')]=function(_0x24f1a3,_0x4221cb){if(_0x24f1a3[_0x80fc('0x50')]['id']){delete _0x24f1a3['body']['id'];}return db[_0x80fc('0x31')][_0x80fc('0x4e')]({'where':{'id':_0x24f1a3[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0x4221cb,null))[_0x80fc('0x24')](saveUpdates(_0x24f1a3[_0x80fc('0x50')],null))[_0x80fc('0x24')](respondWithResult(_0x4221cb,null))['catch'](handleError(_0x4221cb,null));};exports[_0x80fc('0x25')]=function(_0x33aa10,_0x906763){return db['OpenchannelQueue'][_0x80fc('0x4e')]({'where':{'id':_0x33aa10[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0x906763,null))[_0x80fc('0x24')](removeEntity(_0x906763,null))[_0x80fc('0x4a')](handleError(_0x906763,null));};exports[_0x80fc('0x54')]=function(_0x83c204,_0x2ae2ae){return db[_0x80fc('0x31')][_0x80fc('0x54')]()['then'](respondWithResult(_0x2ae2ae,null))[_0x80fc('0x4a')](handleError(_0x2ae2ae,null));};exports[_0x80fc('0x55')]=function(_0x1b4193,_0x1f637b,_0x23f227){var _0x2e3c41={'raw':!![],'where':{}},_0x58c34c={},_0xeda479;return db[_0x80fc('0x31')][_0x80fc('0x56')]({'where':{'id':_0x1b4193[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0x1f637b,null))['then'](function(_0xe937c8){if(_0xe937c8){_0xeda479=_0xe937c8[_0x80fc('0x26')]({'plain':!![]});_0x58c34c[_0x80fc('0x36')]=_[_0x80fc('0x38')](db[_0x80fc('0x57')][_0x80fc('0x32')]);_0x58c34c[_0x80fc('0x37')]=_[_0x80fc('0x38')](_0x1b4193[_0x80fc('0x37')]);_0x58c34c[_0x80fc('0x39')]=_['intersection'](_0x58c34c['model'],_0x58c34c[_0x80fc('0x37')]);_0x2e3c41[_0x80fc('0x3b')]=_[_0x80fc('0x3a')](_0x58c34c[_0x80fc('0x36')],qs[_0x80fc('0x3c')](_0x1b4193[_0x80fc('0x37')][_0x80fc('0x3c')]));_0x2e3c41['attributes']=_0x2e3c41['attributes']['length']?_0x2e3c41[_0x80fc('0x3b')]:_0x58c34c[_0x80fc('0x36')];if(!_0x1b4193['query'][_0x80fc('0x3e')](_0x80fc('0x3f'))){_0x2e3c41[_0x80fc('0x1d')]=qs[_0x80fc('0x1d')](_0x1b4193[_0x80fc('0x37')][_0x80fc('0x1d')]);_0x2e3c41[_0x80fc('0x1b')]=qs['offset'](_0x1b4193['query'][_0x80fc('0x1b')]);}_0x2e3c41[_0x80fc('0x40')]=qs[_0x80fc('0x41')](_0x1b4193['query'][_0x80fc('0x41')]);_0x2e3c41['where']=qs[_0x80fc('0x39')](_[_0x80fc('0x58')](_0x1b4193[_0x80fc('0x37')],_0x58c34c[_0x80fc('0x39')]));_0x2e3c41[_0x80fc('0x43')][_0x80fc('0x59')]=_0xe937c8['id'];if(_0x1b4193[_0x80fc('0x37')][_0x80fc('0x42')]){_0x2e3c41['where']=_[_0x80fc('0x44')](_0x2e3c41['where'],{'$or':_[_0x80fc('0x30')](_0x2e3c41['attributes'],function(_0x4baefd){var _0x4bb365={};_0x4bb365[_0x4baefd]={'$like':'%'+_0x1b4193['query'][_0x80fc('0x42')]+'%'};return _0x4bb365;})});}_0x2e3c41=_[_0x80fc('0x44')]({},_0x2e3c41,_0x1b4193[_0x80fc('0x46')]);return db[_0x80fc('0x57')][_0x80fc('0x48')](_0x2e3c41);}})[_0x80fc('0x24')](function(_0x987f3c){if(_0x987f3c){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x987f3c,_0x80fc('0x5a')),'role':_0x80fc('0x5b')},'attributes':['id',_0x80fc('0x2d'),'openchannelPause',_0x80fc('0x5c'),_0x80fc('0x5d')]});}})[_0x80fc('0x24')](function(_0x40073a){if(_0x40073a){return{'count':_0x40073a[_0x80fc('0x1e')],'rows':_[_0x80fc('0x30')](_0x40073a[_0x80fc('0x49')],function(_0x4215f6){return{'membername':_0x4215f6['name'],'UserId':_0x4215f6['id'],'queue_name':_0xeda479['name'],'OpenchannelQueueId':_0xeda479['id'],'interface':util['format'](_0x80fc('0x5e'),_0x80fc('0x5f'),_0x4215f6[_0x80fc('0x2d')]),'penalty':0x0,'paused':_0x4215f6['openchannelPause'],'createdAt':_0x4215f6[_0x80fc('0x5d')],'updatedAt':_0x4215f6[_0x80fc('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x80fc('0x24')](respondWithFilteredResult(_0x1f637b,_0x2e3c41))[_0x80fc('0x4a')](handleError(_0x1f637b,null));};exports['getTeams']=function(_0x4acfc0,_0x28e010,_0x168bdf){var _0xfc2ff8={};var _0x58b94a={};var _0x440071;var _0x14db69;return db['OpenchannelQueue'][_0x80fc('0x56')]({'where':{'id':_0x4acfc0[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0x28e010,null))[_0x80fc('0x24')](function(_0x24fb83){if(_0x24fb83){_0x440071=_0x24fb83;_0x58b94a[_0x80fc('0x36')]=_[_0x80fc('0x38')](db['Team'][_0x80fc('0x32')]);_0x58b94a[_0x80fc('0x37')]=_[_0x80fc('0x38')](_0x4acfc0['query']);_0x58b94a[_0x80fc('0x39')]=_[_0x80fc('0x3a')](_0x58b94a[_0x80fc('0x36')],_0x58b94a[_0x80fc('0x37')]);_0xfc2ff8[_0x80fc('0x3b')]=_[_0x80fc('0x3a')](_0x58b94a['model'],qs['fields'](_0x4acfc0['query'][_0x80fc('0x3c')]));_0xfc2ff8[_0x80fc('0x3b')]=_0xfc2ff8['attributes'][_0x80fc('0x3d')]?_0xfc2ff8[_0x80fc('0x3b')]:_0x58b94a[_0x80fc('0x36')];_0xfc2ff8[_0x80fc('0x40')]=qs[_0x80fc('0x41')](_0x4acfc0[_0x80fc('0x37')][_0x80fc('0x41')]);_0xfc2ff8['where']=qs['filters'](_[_0x80fc('0x58')](_0x4acfc0[_0x80fc('0x37')],_0x58b94a[_0x80fc('0x39')]));if(_0x4acfc0[_0x80fc('0x37')][_0x80fc('0x42')]){_0xfc2ff8[_0x80fc('0x43')]=_[_0x80fc('0x44')](_0xfc2ff8['where'],{'$or':_[_0x80fc('0x30')](_0xfc2ff8[_0x80fc('0x3b')],function(_0x2d9e2f){var _0x153485={};_0x153485[_0x2d9e2f]={'$like':'%'+_0x4acfc0[_0x80fc('0x37')][_0x80fc('0x42')]+'%'};return _0x153485;})});}_0xfc2ff8=_['merge']({},_0xfc2ff8,_0x4acfc0['options']);return _0x440071['getTeams'](_0xfc2ff8);}})[_0x80fc('0x24')](function(_0x3afb9a){if(_0x3afb9a){_0x14db69=_0x3afb9a[_0x80fc('0x3d')];if(!_0x4acfc0[_0x80fc('0x37')][_0x80fc('0x3e')](_0x80fc('0x3f'))){_0xfc2ff8[_0x80fc('0x1d')]=qs['limit'](_0x4acfc0[_0x80fc('0x37')][_0x80fc('0x1d')]);_0xfc2ff8[_0x80fc('0x1b')]=qs[_0x80fc('0x1b')](_0x4acfc0[_0x80fc('0x37')]['offset']);}return _0x440071[_0x80fc('0x60')](_0xfc2ff8);}})['then'](function(_0x21da24){if(_0x21da24){return _0x21da24?{'count':_0x14db69,'rows':_0x21da24}:null;}})['then'](respondWithResult(_0x28e010,null))['catch'](handleError(_0x28e010,null));};exports['addTeams']=function(_0x4c6efc,_0x1939a5,_0x33b687){var _0x8ed124=_0x4c6efc[_0x80fc('0x50')][_0x80fc('0x61')];return db[_0x80fc('0x62')]['findAll']({'where':{'id':_0x8ed124},'attributes':['id'],'include':[{'model':db[_0x80fc('0x63')],'as':_0x80fc('0x64'),'attributes':['id',_0x80fc('0x2d'),_0x80fc('0x65'),_0x80fc('0x66'),_0x80fc('0x67')],'raw':!![]}]})['then'](function(_0x3d9696){if(_0x3d9696){var _0x1a1555=_[_0x80fc('0x68')](_0x3d9696,function(_0xe01d24){var _0x4efc0b=_0xe01d24['get']({'plain':!![]});return _0x4efc0b[_0x80fc('0x64')];});return db[_0x80fc('0x31')][_0x80fc('0x4e')]({'where':{'id':_0x4c6efc['params']['id']}})[_0x80fc('0x24')](function(_0x485ffd){return db[_0x80fc('0x69')][_0x80fc('0x6a')](function(_0x2814a4){return _0x485ffd[_0x80fc('0x6b')](_0x8ed124,{'transaction':_0x2814a4})['then'](function(){return BPromise[_0x80fc('0x6c')](_0x1a1555,function(_0x1f2349){return db[_0x80fc('0x57')][_0x80fc('0x6d')]({'where':{'UserId':_0x1f2349['id'],'OpenchannelQueueId':_0x4c6efc[_0x80fc('0x4c')]['id']},'transaction':_0x2814a4});});})[_0x80fc('0x24')](function(){_0x1a1555[_0x80fc('0x6e')](function(_0xdcae8d){socket['emit']('userOpenchannelQueue:save',{'UserId':_0xdcae8d['id'],'OpenchannelQueueId':_0x485ffd['id']});});});});});}})[_0x80fc('0x24')](respondWithStatusCode(_0x1939a5,null))[_0x80fc('0x4a')](handleError(_0x1939a5,null));};exports[_0x80fc('0x6f')]=function(_0x3ea623,_0x3bb972,_0x46282a){return db[_0x80fc('0x62')][_0x80fc('0x48')]({'where':{'id':_0x3ea623[_0x80fc('0x37')][_0x80fc('0x61')]},'attributes':['id'],'include':[{'model':db[_0x80fc('0x63')],'as':_0x80fc('0x64'),'attributes':['id'],'raw':!![]}]})[_0x80fc('0x24')](handleEntityNotFound(_0x3bb972,null))[_0x80fc('0x24')](function(_0x1963c3){var _0x348b7d=_[_0x80fc('0x30')](_0x1963c3,'id');var _0x1fc35a=[];var _0x245210=[];var _0x2d1951=squel[_0x80fc('0x70')]();_0x2d1951['field'](_0x80fc('0x71'))['from']('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x80fc('0x72'))[_0x80fc('0x43')]('OpenchannelQueueId\x20=\x20?',_0x3ea623[_0x80fc('0x4c')]['id']);for(var _0x5b4eea=0x0;_0x5b4eea<_0x1963c3[_0x80fc('0x3d')];_0x5b4eea+=0x1){let _0x3a9925=_0x1963c3[_0x5b4eea];for(var _0x527666=0x0;_0x527666<_0x3a9925[_0x80fc('0x64')][_0x80fc('0x3d')];_0x527666+=0x1){let _0x13bce6=_0x3a9925['Agents'][_0x527666];var _0x1e180f=_0x2d1951[_0x80fc('0x73')]();_0x1e180f[_0x80fc('0x43')]('ut.UserId\x20=\x20?',_0x13bce6['id']);_0x245210[_0x80fc('0x74')](db[_0x80fc('0x69')]['query'](_0x1e180f['toString'](),{'type':db[_0x80fc('0x69')][_0x80fc('0x75')][_0x80fc('0x76')]})[_0x80fc('0x24')](function(_0x36e965){if(_0x36e965[_0x80fc('0x3d')]===0x1){return _0x13bce6['id'];}else{var _0xa5f9f1=_[_0x80fc('0x77')](_[_0x80fc('0x30')](_0x36e965,'TeamId'),function(_0x2e9251){return _[_0x80fc('0x78')](_0x348b7d,_0x2e9251);});if(_0xa5f9f1){return _0x13bce6['id'];}}}));}}return BPromise[_0x80fc('0x79')](_0x245210)[_0x80fc('0x24')](function(_0x1968dc){_0x1fc35a=_(_0x1fc35a)[_0x80fc('0x7a')](_0x1968dc)[_0x80fc('0x7b')]()[_0x80fc('0x7c')]();return db[_0x80fc('0x31')][_0x80fc('0x4e')]({'where':{'id':_0x3ea623['params']['id']}})['then'](function(_0x1b4697){return db[_0x80fc('0x69')][_0x80fc('0x6a')](function(_0x3cda58){return _0x1b4697[_0x80fc('0x6f')](_0x3ea623[_0x80fc('0x37')][_0x80fc('0x61')],{'transaction':_0x3cda58})[_0x80fc('0x24')](function(){if(!_[_0x80fc('0x7d')](_0x1fc35a)){return _0x1b4697['removeAgents'](_0x1fc35a,{'transaction':_0x3cda58});}})[_0x80fc('0x24')](function(){_0x1fc35a[_0x80fc('0x6e')](function(_0x3bec64){socket[_0x80fc('0x7e')](_0x80fc('0x7f'),{'UserId':_0x3bec64,'OpenchannelQueueId':_0x1b4697['id']});});});});});});})['then'](respondWithStatusCode(_0x3bb972,null))[_0x80fc('0x4a')](handleError(_0x3bb972,null));};exports[_0x80fc('0x80')]=function(_0x211928,_0x445192,_0x26a95f){return db[_0x80fc('0x31')][_0x80fc('0x4e')]({'where':{'id':_0x211928[_0x80fc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x445192,null))[_0x80fc('0x24')](function(_0x3b27c0){if(_0x3b27c0){return _0x3b27c0[_0x80fc('0x80')](_0x211928[_0x80fc('0x50')][_0x80fc('0x61')],_[_0x80fc('0x81')](_0x211928[_0x80fc('0x50')],[_0x80fc('0x61'),'id'])||{})[_0x80fc('0x82')](function(_0x244269){for(var _0x5bdaaa=0x0;_0x5bdaaa<_0x211928['body'][_0x80fc('0x61')]['length'];_0x5bdaaa+=0x1){socket[_0x80fc('0x7e')](_0x80fc('0x83'),{'UserId':Number(_0x211928[_0x80fc('0x50')][_0x80fc('0x61')][_0x5bdaaa]),'OpenchannelQueueId':Number(_0x211928[_0x80fc('0x4c')]['id'])});}return _0x244269;});}})[_0x80fc('0x24')](respondWithResult(_0x445192,null))[_0x80fc('0x4a')](handleError(_0x445192,null));};exports[_0x80fc('0x84')]=function(_0x29e42e,_0x210a5d,_0x5931f2){return db[_0x80fc('0x31')]['find']({'where':{'id':_0x29e42e[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0x210a5d,null))['then'](function(_0x24133b){if(_0x24133b){return _0x24133b['removeAgents'](_0x29e42e[_0x80fc('0x37')][_0x80fc('0x61')])[_0x80fc('0x24')](function(){if(_[_0x80fc('0x85')](_0x29e42e[_0x80fc('0x37')][_0x80fc('0x61')])){for(var _0x46cba8=0x0;_0x46cba8<_0x29e42e[_0x80fc('0x37')][_0x80fc('0x61')][_0x80fc('0x3d')];_0x46cba8+=0x1){socket[_0x80fc('0x7e')](_0x80fc('0x7f'),{'UserId':Number(_0x29e42e[_0x80fc('0x37')][_0x80fc('0x61')][_0x46cba8]),'OpenchannelQueueId':Number(_0x29e42e[_0x80fc('0x4c')]['id'])});}}else{socket[_0x80fc('0x7e')](_0x80fc('0x7f'),{'UserId':Number(_0x29e42e[_0x80fc('0x37')][_0x80fc('0x61')]),'OpenchannelQueueId':Number(_0x29e42e[_0x80fc('0x4c')]['id'])});}});}})[_0x80fc('0x24')](respondWithStatusCode(_0x210a5d,null))[_0x80fc('0x4a')](handleError(_0x210a5d,null));};exports[_0x80fc('0x86')]=function(_0xca1e8c,_0xf4faba,_0x1a9a6c){var _0x47fa84={};var _0x871f69={};var _0x4d214a;var _0x5c5aac;return db[_0x80fc('0x31')][_0x80fc('0x56')]({'where':{'id':_0xca1e8c[_0x80fc('0x4c')]['id']}})[_0x80fc('0x24')](handleEntityNotFound(_0xf4faba,null))[_0x80fc('0x24')](function(_0x1431ef){if(_0x1431ef){_0x4d214a=_0x1431ef;_0x871f69['model']=_[_0x80fc('0x38')](db[_0x80fc('0x63')][_0x80fc('0x32')]);_0x871f69[_0x80fc('0x37')]=_[_0x80fc('0x38')](_0xca1e8c[_0x80fc('0x37')]);_0x871f69[_0x80fc('0x39')]=_[_0x80fc('0x3a')](_0x871f69[_0x80fc('0x36')],_0x871f69['query']);_0x47fa84['attributes']=_[_0x80fc('0x3a')](_0x871f69[_0x80fc('0x36')],qs['fields'](_0xca1e8c[_0x80fc('0x37')][_0x80fc('0x3c')]));_0x47fa84[_0x80fc('0x3b')]=_0x47fa84[_0x80fc('0x3b')][_0x80fc('0x3d')]?_0x47fa84[_0x80fc('0x3b')]:_0x871f69[_0x80fc('0x36')];_0x47fa84[_0x80fc('0x40')]=qs[_0x80fc('0x41')](_0xca1e8c['query'][_0x80fc('0x41')]);_0x47fa84[_0x80fc('0x43')]=qs['filters'](_[_0x80fc('0x58')](_0xca1e8c['query'],_0x871f69[_0x80fc('0x39')]));if(_0xca1e8c[_0x80fc('0x37')][_0x80fc('0x42')]){_0x47fa84['where']=_[_0x80fc('0x44')](_0x47fa84[_0x80fc('0x43')],{'$or':_[_0x80fc('0x30')](_0x47fa84[_0x80fc('0x3b')],function(_0x32dc10){var _0x32f22e={};_0x32f22e[_0x32dc10]={'$like':'%'+_0xca1e8c[_0x80fc('0x37')][_0x80fc('0x42')]+'%'};return _0x32f22e;})});}_0x47fa84=_[_0x80fc('0x44')]({},_0x47fa84,_0xca1e8c[_0x80fc('0x46')]);return _0x4d214a[_0x80fc('0x86')](_0x47fa84);}})[_0x80fc('0x24')](function(_0x4aae28){if(_0x4aae28){_0x5c5aac=_0x4aae28[_0x80fc('0x3d')];if(!_0xca1e8c[_0x80fc('0x37')][_0x80fc('0x3e')]('nolimit')){_0x47fa84[_0x80fc('0x1d')]=qs[_0x80fc('0x1d')](_0xca1e8c['query'][_0x80fc('0x1d')]);_0x47fa84[_0x80fc('0x1b')]=qs['offset'](_0xca1e8c['query']['offset']);}return _0x4d214a[_0x80fc('0x86')](_0x47fa84);}})['then'](function(_0x7120c2){if(_0x7120c2){return _0x7120c2?{'count':_0x5c5aac,'rows':_0x7120c2}:null;}})[_0x80fc('0x24')](respondWithResult(_0xf4faba,null))[_0x80fc('0x4a')](handleError(_0xf4faba,null));}; \ No newline at end of file +var _0xd680=['%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','SELECT','every','TeamId','includes','all','compact','value','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','then','get','OpenchannelQueues','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','pick','filter','merge','where','options','findAll','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','order','sort','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format'];(function(_0x43acda,_0x19a3dc){var _0x156ea4=function(_0x1a438d){while(--_0x1a438d){_0x43acda['push'](_0x43acda['shift']());}};_0x156ea4(++_0x19a3dc);}(_0xd680,0xb3));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d68('0x0'));var zipdir=require(_0x0d68('0x1'));var jsonpatch=require(_0x0d68('0x2'));var rp=require(_0x0d68('0x3'));var moment=require(_0x0d68('0x4'));var BPromise=require(_0x0d68('0x5'));var Mustache=require(_0x0d68('0x6'));var util=require(_0x0d68('0x7'));var path=require('path');var sox=require(_0x0d68('0x8'));var csv=require(_0x0d68('0x9'));var ejs=require(_0x0d68('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d68('0xb'));var squel=require('squel');var crypto=require(_0x0d68('0xc'));var jsforce=require(_0x0d68('0xd'));var deskjs=require(_0x0d68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0d68('0xf'));var Papa=require(_0x0d68('0x10'));var Redis=require(_0x0d68('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d68('0x12'));var as=require(_0x0d68('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d68('0x14'))(_0x0d68('0x15'));var utils=require('../../config/utils');var config=require(_0x0d68('0x16'));var licenseUtil=require(_0x0d68('0x17'));var db=require(_0x0d68('0x18'))['db'];config[_0x0d68('0x19')]=_[_0x0d68('0x1a')](config['redis'],{'host':_0x0d68('0x1b'),'port':0x18eb});var socket=require(_0x0d68('0x1c'))(new Redis(config[_0x0d68('0x19')]));require('./openchannelQueue.socket')[_0x0d68('0x1d')](socket);function respondWithStatusCode(_0x4012d7,_0x5d246c){_0x5d246c=_0x5d246c||0xcc;return function(_0x2f18ad){if(_0x2f18ad){return _0x4012d7[_0x0d68('0x1e')](_0x5d246c);}return _0x4012d7[_0x0d68('0x1f')](_0x5d246c)[_0x0d68('0x20')]();};}function respondWithResult(_0x2774e7,_0x23dbef){_0x23dbef=_0x23dbef||0xc8;return function(_0x20e79e){if(_0x20e79e){return _0x2774e7[_0x0d68('0x1f')](_0x23dbef)['json'](_0x20e79e);}};}function respondWithFilteredResult(_0x5a2d3c,_0x475e2c){return function(_0x2f6ee1){if(_0x2f6ee1){var _0x4c8536=typeof _0x475e2c[_0x0d68('0x21')]===_0x0d68('0x22')&&typeof _0x475e2c['limit']===_0x0d68('0x22');var _0x43d137=_0x2f6ee1['count'];var _0xe513e7=_0x4c8536?0x0:_0x475e2c[_0x0d68('0x21')];var _0x2afd11=_0x4c8536?_0x2f6ee1[_0x0d68('0x23')]:_0x475e2c[_0x0d68('0x21')]+_0x475e2c['limit'];var _0x2bc9f7;if(_0x2afd11>=_0x43d137){_0x2afd11=_0x43d137;_0x2bc9f7=0xc8;}else{_0x2bc9f7=0xce;}_0x5a2d3c[_0x0d68('0x1f')](_0x2bc9f7);return _0x5a2d3c[_0x0d68('0x24')](_0x0d68('0x25'),_0xe513e7+'-'+_0x2afd11+'/'+_0x43d137)[_0x0d68('0x26')](_0x2f6ee1);}return null;};}function patchUpdates(_0x3d1e5c){return function(_0x589b6b){try{jsonpatch[_0x0d68('0x27')](_0x589b6b,_0x3d1e5c,!![]);}catch(_0x508a8c){return BPromise['reject'](_0x508a8c);}return _0x589b6b[_0x0d68('0x28')]();};}function saveUpdates(_0x44dd10,_0x398db2){return function(_0x59d5fc){if(_0x59d5fc){return _0x59d5fc['update'](_0x44dd10)[_0x0d68('0x29')](function(_0x4c1d82){return _0x4c1d82;});}return null;};}function removeEntity(_0x5295e3,_0x5609a0){return function(_0x33deb1){if(_0x33deb1){return _0x33deb1['destroy']()[_0x0d68('0x29')](function(){var _0x20edc3=_0x33deb1[_0x0d68('0x2a')]({'plain':!![]});var _0x2a4b1c=_0x0d68('0x2b');return db['UserProfileResource'][_0x0d68('0x2c')]({'where':{'type':_0x2a4b1c,'resourceId':_0x20edc3['id']}})[_0x0d68('0x29')](function(){return _0x33deb1;});})[_0x0d68('0x29')](function(){_0x5295e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3155,_0x2af6fd){return function(_0x1e75c8){if(!_0x1e75c8){_0x1d3155[_0x0d68('0x1e')](0x194);}return _0x1e75c8;};}function handleError(_0x15baf3,_0x14d678){_0x14d678=_0x14d678||0x1f4;return function(_0x19f3ad){logger[_0x0d68('0x2d')](_0x19f3ad[_0x0d68('0x2e')]);if(_0x19f3ad[_0x0d68('0x2f')]){delete _0x19f3ad['name'];}_0x15baf3['status'](_0x14d678)['send'](_0x19f3ad);};}exports[_0x0d68('0x30')]=function(_0x255818,_0x5b53ac){var _0x273f59={},_0xa977b6={},_0x116e3e={'count':0x0,'rows':[]};var _0x110072=_[_0x0d68('0x31')](db[_0x0d68('0x32')][_0x0d68('0x33')],function(_0x5a4a87){return{'name':_0x5a4a87[_0x0d68('0x34')],'type':_0x5a4a87[_0x0d68('0x35')][_0x0d68('0x36')]};});_0xa977b6['model']=_[_0x0d68('0x31')](_0x110072,_0x0d68('0x2f'));_0xa977b6[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x255818[_0x0d68('0x37')]);_0xa977b6[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0xa977b6['model'],_0xa977b6['query']);_0x273f59[_0x0d68('0x3b')]=_[_0x0d68('0x3a')](_0xa977b6[_0x0d68('0x3c')],qs['fields'](_0x255818[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x273f59[_0x0d68('0x3b')]=_0x273f59[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x273f59[_0x0d68('0x3b')]:_0xa977b6[_0x0d68('0x3c')];if(!_0x255818[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x273f59[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x255818[_0x0d68('0x37')][_0x0d68('0x41')]);_0x273f59[_0x0d68('0x21')]=qs[_0x0d68('0x21')](_0x255818[_0x0d68('0x37')][_0x0d68('0x21')]);}_0x273f59['order']=qs['sort'](_0x255818[_0x0d68('0x37')]['sort']);_0x273f59['where']=qs['filters'](_[_0x0d68('0x42')](_0x255818[_0x0d68('0x37')],_0xa977b6[_0x0d68('0x39')]),_0x110072);if(_0x255818[_0x0d68('0x37')][_0x0d68('0x43')]){_0x273f59['where']=_[_0x0d68('0x44')](_0x273f59[_0x0d68('0x45')],{'$or':_['map'](_0x110072,function(_0x1ba5fe){if(_0x1ba5fe['type']!=='VIRTUAL'){var _0x52e0c9={};_0x52e0c9[_0x1ba5fe[_0x0d68('0x2f')]]={'$like':'%'+_0x255818['query']['filter']+'%'};return _0x52e0c9;}})});}_0x273f59=_[_0x0d68('0x44')]({},_0x273f59,_0x255818[_0x0d68('0x46')]);var _0x1e6db2={'where':_0x273f59[_0x0d68('0x45')]};return db['OpenchannelQueue'][_0x0d68('0x23')](_0x1e6db2)[_0x0d68('0x29')](function(_0x5462aa){_0x116e3e[_0x0d68('0x23')]=_0x5462aa;if(_0x255818['query']['includeAll']){_0x273f59['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0d68('0x47')](_0x273f59);})['then'](function(_0x488eb7){_0x116e3e['rows']=_0x488eb7;return _0x116e3e;})[_0x0d68('0x29')](respondWithFilteredResult(_0x5b53ac,_0x273f59))[_0x0d68('0x48')](handleError(_0x5b53ac,null));};exports[_0x0d68('0x49')]=function(_0x52beb7,_0x4682e7){var _0x5b2c6f={'raw':!![],'where':{'id':_0x52beb7[_0x0d68('0x4a')]['id']}},_0x375a1d={};_0x375a1d['model']=_[_0x0d68('0x38')](db[_0x0d68('0x32')]['rawAttributes']);_0x375a1d[_0x0d68('0x37')]=_['keys'](_0x52beb7[_0x0d68('0x37')]);_0x375a1d[_0x0d68('0x39')]=_['intersection'](_0x375a1d[_0x0d68('0x3c')],_0x375a1d[_0x0d68('0x37')]);_0x5b2c6f[_0x0d68('0x3b')]=_[_0x0d68('0x3a')](_0x375a1d[_0x0d68('0x3c')],qs[_0x0d68('0x3d')](_0x52beb7['query'][_0x0d68('0x3d')]));_0x5b2c6f[_0x0d68('0x3b')]=_0x5b2c6f[_0x0d68('0x3b')]['length']?_0x5b2c6f[_0x0d68('0x3b')]:_0x375a1d[_0x0d68('0x3c')];if(_0x52beb7[_0x0d68('0x37')][_0x0d68('0x4b')]){_0x5b2c6f[_0x0d68('0x4c')]=[{'all':!![]}];}_0x5b2c6f=_[_0x0d68('0x44')]({},_0x5b2c6f,_0x52beb7['options']);return db[_0x0d68('0x32')][_0x0d68('0x4d')](_0x5b2c6f)[_0x0d68('0x29')](handleEntityNotFound(_0x4682e7,null))[_0x0d68('0x29')](respondWithResult(_0x4682e7,null))['catch'](handleError(_0x4682e7,null));};exports[_0x0d68('0x4e')]=function(_0x5775bf,_0x5aa9f5){return db['OpenchannelQueue'][_0x0d68('0x4e')](_0x5775bf[_0x0d68('0x4f')],{})[_0x0d68('0x29')](function(_0x548e34){var _0x4bda79=_0x5775bf['user'][_0x0d68('0x2a')]({'plain':!![]});if(!_0x4bda79)throw new Error(_0x0d68('0x50'));if(_0x4bda79['role']===_0x0d68('0x51')){var _0x3523bb=_0x548e34[_0x0d68('0x2a')]({'plain':!![]});var _0x3f030a=_0x0d68('0x2b');return db['UserProfileSection'][_0x0d68('0x4d')]({'where':{'name':_0x3f030a,'userProfileId':_0x4bda79[_0x0d68('0x52')]},'raw':!![]})[_0x0d68('0x29')](function(_0x4c703a){if(_0x4c703a&&_0x4c703a[_0x0d68('0x53')]===0x0){return db[_0x0d68('0x54')]['create']({'name':_0x3523bb[_0x0d68('0x2f')],'resourceId':_0x3523bb['id'],'type':_0x4c703a['name'],'sectionId':_0x4c703a['id']},{})[_0x0d68('0x29')](function(){return _0x548e34;});}else{return _0x548e34;}})[_0x0d68('0x48')](function(_0x5a1e8a){logger[_0x0d68('0x2d')](_0x0d68('0x55'),_0x5a1e8a);throw _0x5a1e8a;});}return _0x548e34;})[_0x0d68('0x29')](respondWithResult(_0x5aa9f5,0xc9))[_0x0d68('0x48')](handleError(_0x5aa9f5,null));};exports[_0x0d68('0x56')]=function(_0x1e32c3,_0x4383a9){if(_0x1e32c3[_0x0d68('0x4f')]['id']){delete _0x1e32c3[_0x0d68('0x4f')]['id'];}return db[_0x0d68('0x32')]['find']({'where':{'id':_0x1e32c3[_0x0d68('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4383a9,null))[_0x0d68('0x29')](saveUpdates(_0x1e32c3[_0x0d68('0x4f')],null))['then'](respondWithResult(_0x4383a9,null))[_0x0d68('0x48')](handleError(_0x4383a9,null));};exports[_0x0d68('0x2c')]=function(_0x1d825d,_0x4032e4){return db['OpenchannelQueue'][_0x0d68('0x4d')]({'where':{'id':_0x1d825d[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x4032e4,null))['then'](removeEntity(_0x4032e4,null))[_0x0d68('0x48')](handleError(_0x4032e4,null));};exports['describe']=function(_0x2c1541,_0x523dda){return db[_0x0d68('0x32')][_0x0d68('0x57')]()[_0x0d68('0x29')](respondWithResult(_0x523dda,null))[_0x0d68('0x48')](handleError(_0x523dda,null));};exports[_0x0d68('0x58')]=function(_0x1e230b,_0x207035,_0x1a8763){var _0x557858={'raw':!![],'where':{}},_0x1ffeb3={},_0x30ab71;return db[_0x0d68('0x32')][_0x0d68('0x59')]({'where':{'id':_0x1e230b['params']['id']}})['then'](handleEntityNotFound(_0x207035,null))[_0x0d68('0x29')](function(_0x185f9a){if(_0x185f9a){_0x30ab71=_0x185f9a[_0x0d68('0x2a')]({'plain':!![]});_0x1ffeb3[_0x0d68('0x3c')]=_['keys'](db[_0x0d68('0x5a')][_0x0d68('0x33')]);_0x1ffeb3[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x1e230b['query']);_0x1ffeb3['filters']=_['intersection'](_0x1ffeb3[_0x0d68('0x3c')],_0x1ffeb3[_0x0d68('0x37')]);_0x557858[_0x0d68('0x3b')]=_['intersection'](_0x1ffeb3[_0x0d68('0x3c')],qs['fields'](_0x1e230b[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x557858[_0x0d68('0x3b')]=_0x557858[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x557858['attributes']:_0x1ffeb3[_0x0d68('0x3c')];if(!_0x1e230b[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x557858[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x1e230b[_0x0d68('0x37')][_0x0d68('0x41')]);_0x557858[_0x0d68('0x21')]=qs[_0x0d68('0x21')](_0x1e230b['query'][_0x0d68('0x21')]);}_0x557858[_0x0d68('0x5b')]=qs[_0x0d68('0x5c')](_0x1e230b[_0x0d68('0x37')]['sort']);_0x557858[_0x0d68('0x45')]=qs[_0x0d68('0x39')](_[_0x0d68('0x42')](_0x1e230b[_0x0d68('0x37')],_0x1ffeb3[_0x0d68('0x39')]));_0x557858['where'][_0x0d68('0x5d')]=_0x185f9a['id'];if(_0x1e230b[_0x0d68('0x37')][_0x0d68('0x43')]){_0x557858['where']=_[_0x0d68('0x44')](_0x557858['where'],{'$or':_[_0x0d68('0x31')](_0x557858[_0x0d68('0x3b')],function(_0x3fe01d){var _0x360a1e={};_0x360a1e[_0x3fe01d]={'$like':'%'+_0x1e230b[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x360a1e;})});}_0x557858=_[_0x0d68('0x44')]({},_0x557858,_0x1e230b[_0x0d68('0x46')]);return db['UserOpenchannelQueue'][_0x0d68('0x47')](_0x557858);}})['then'](function(_0x576841){if(_0x576841){return db['User'][_0x0d68('0x5e')]({'where':{'id':_[_0x0d68('0x31')](_0x576841,_0x0d68('0x5f')),'role':_0x0d68('0x60')},'attributes':['id','name',_0x0d68('0x61'),_0x0d68('0x62'),_0x0d68('0x63')]});}})[_0x0d68('0x29')](function(_0x469591){if(_0x469591){return{'count':_0x469591[_0x0d68('0x23')],'rows':_[_0x0d68('0x31')](_0x469591['rows'],function(_0x17debc){return{'membername':_0x17debc[_0x0d68('0x2f')],'UserId':_0x17debc['id'],'queue_name':_0x30ab71['name'],'OpenchannelQueueId':_0x30ab71['id'],'interface':util[_0x0d68('0x64')](_0x0d68('0x65'),_0x0d68('0x66'),_0x17debc[_0x0d68('0x2f')]),'penalty':0x0,'paused':_0x17debc[_0x0d68('0x61')],'createdAt':_0x17debc[_0x0d68('0x63')],'updatedAt':_0x17debc[_0x0d68('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d68('0x29')](respondWithFilteredResult(_0x207035,_0x557858))[_0x0d68('0x48')](handleError(_0x207035,null));};exports[_0x0d68('0x67')]=function(_0x37079f,_0x308c72,_0x927257){var _0x3058ac={};var _0x468cca={};var _0x3e4b12;var _0x105127;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x37079f[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x308c72,null))[_0x0d68('0x29')](function(_0x3a5367){if(_0x3a5367){_0x3e4b12=_0x3a5367;_0x468cca[_0x0d68('0x3c')]=_['keys'](db['Team'][_0x0d68('0x33')]);_0x468cca[_0x0d68('0x37')]=_['keys'](_0x37079f[_0x0d68('0x37')]);_0x468cca[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0x468cca[_0x0d68('0x3c')],_0x468cca['query']);_0x3058ac[_0x0d68('0x3b')]=_['intersection'](_0x468cca[_0x0d68('0x3c')],qs['fields'](_0x37079f[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x3058ac['attributes']=_0x3058ac[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x3058ac[_0x0d68('0x3b')]:_0x468cca[_0x0d68('0x3c')];_0x3058ac['order']=qs[_0x0d68('0x5c')](_0x37079f['query'][_0x0d68('0x5c')]);_0x3058ac[_0x0d68('0x45')]=qs[_0x0d68('0x39')](_['pick'](_0x37079f[_0x0d68('0x37')],_0x468cca[_0x0d68('0x39')]));if(_0x37079f[_0x0d68('0x37')][_0x0d68('0x43')]){_0x3058ac['where']=_[_0x0d68('0x44')](_0x3058ac[_0x0d68('0x45')],{'$or':_[_0x0d68('0x31')](_0x3058ac[_0x0d68('0x3b')],function(_0x25c19d){var _0x4585de={};_0x4585de[_0x25c19d]={'$like':'%'+_0x37079f[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x4585de;})});}_0x3058ac=_['merge']({},_0x3058ac,_0x37079f[_0x0d68('0x46')]);return _0x3e4b12[_0x0d68('0x67')](_0x3058ac);}})['then'](function(_0x5bc923){if(_0x5bc923){_0x105127=_0x5bc923['length'];if(!_0x37079f[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x3058ac[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x37079f[_0x0d68('0x37')]['limit']);_0x3058ac['offset']=qs[_0x0d68('0x21')](_0x37079f[_0x0d68('0x37')][_0x0d68('0x21')]);}return _0x3e4b12[_0x0d68('0x67')](_0x3058ac);}})[_0x0d68('0x29')](function(_0x2f9cea){if(_0x2f9cea){return _0x2f9cea?{'count':_0x105127,'rows':_0x2f9cea}:null;}})['then'](respondWithResult(_0x308c72,null))[_0x0d68('0x48')](handleError(_0x308c72,null));};exports[_0x0d68('0x68')]=function(_0x26e0e3,_0x5bfb1e,_0x5ad85a){var _0x36905a=_0x26e0e3['body'][_0x0d68('0x69')];return db[_0x0d68('0x6a')][_0x0d68('0x47')]({'where':{'id':_0x36905a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0d68('0x6b'),'attributes':['id','name',_0x0d68('0x6c'),_0x0d68('0x6d'),_0x0d68('0x6e')],'raw':!![]}]})[_0x0d68('0x29')](function(_0x313a28){if(_0x313a28){var _0x2dfbed=_[_0x0d68('0x6f')](_0x313a28,function(_0x10f1f7){var _0x48f5b5=_0x10f1f7['get']({'plain':!![]});return _0x48f5b5[_0x0d68('0x6b')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x26e0e3[_0x0d68('0x4a')]['id']}})['then'](function(_0xa172ad){return db['sequelize'][_0x0d68('0x70')](function(_0x2e00b1){return _0xa172ad[_0x0d68('0x68')](_0x36905a,{'transaction':_0x2e00b1})[_0x0d68('0x29')](function(){return BPromise['each'](_0x2dfbed,function(_0x1d60a3){return db['UserOpenchannelQueue'][_0x0d68('0x71')]({'where':{'UserId':_0x1d60a3['id'],'OpenchannelQueueId':_0x26e0e3[_0x0d68('0x4a')]['id']},'transaction':_0x2e00b1});});})['then'](function(){_0x2dfbed[_0x0d68('0x72')](function(_0x4d61da){socket[_0x0d68('0x73')](_0x0d68('0x74'),{'UserId':_0x4d61da['id'],'OpenchannelQueueId':_0xa172ad['id']});});});});});}})[_0x0d68('0x29')](respondWithStatusCode(_0x5bfb1e,null))[_0x0d68('0x48')](handleError(_0x5bfb1e,null));};exports[_0x0d68('0x75')]=function(_0x396525,_0x1f8fbf,_0x43185d){return db['Team'][_0x0d68('0x47')]({'where':{'id':_0x396525[_0x0d68('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d68('0x76')],'as':_0x0d68('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x0d68('0x29')](handleEntityNotFound(_0x1f8fbf,null))[_0x0d68('0x29')](function(_0x145244){var _0x3def45=_[_0x0d68('0x31')](_0x145244,'id');var _0x262370=[];var _0x562768=[];var _0x2c7939=squel['select']();_0x2c7939[_0x0d68('0x77')]('tq.TeamId')[_0x0d68('0x78')]('team_has_openchannel_queues','tq')[_0x0d68('0x79')](_0x0d68('0x7a'),'ut',_0x0d68('0x7b'))[_0x0d68('0x45')](_0x0d68('0x7c'),_0x396525[_0x0d68('0x4a')]['id']);for(var _0x34a8e0=0x0;_0x34a8e0<_0x145244['length'];_0x34a8e0+=0x1){let _0x338d04=_0x145244[_0x34a8e0];for(var _0x544be5=0x0;_0x544be5<_0x338d04[_0x0d68('0x6b')][_0x0d68('0x3e')];_0x544be5+=0x1){let _0x5929a3=_0x338d04['Agents'][_0x544be5];var _0x33e813=_0x2c7939[_0x0d68('0x7d')]();_0x33e813[_0x0d68('0x45')]('ut.UserId\x20=\x20?',_0x5929a3['id']);_0x562768[_0x0d68('0x7e')](db[_0x0d68('0x7f')]['query'](_0x33e813['toString'](),{'type':db[_0x0d68('0x7f')]['QueryTypes'][_0x0d68('0x80')]})[_0x0d68('0x29')](function(_0x33858e){if(_0x33858e['length']===0x1){return _0x5929a3['id'];}else{var _0x45d695=_[_0x0d68('0x81')](_[_0x0d68('0x31')](_0x33858e,_0x0d68('0x82')),function(_0x47d090){return _[_0x0d68('0x83')](_0x3def45,_0x47d090);});if(_0x45d695){return _0x5929a3['id'];}}}));}}return BPromise[_0x0d68('0x84')](_0x562768)[_0x0d68('0x29')](function(_0x16e805){_0x262370=_(_0x262370)['union'](_0x16e805)[_0x0d68('0x85')]()[_0x0d68('0x86')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x396525[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](function(_0x3b1c6b){return db['sequelize']['transaction'](function(_0x419d91){return _0x3b1c6b[_0x0d68('0x75')](_0x396525[_0x0d68('0x37')][_0x0d68('0x69')],{'transaction':_0x419d91})[_0x0d68('0x29')](function(){if(!_['isEmpty'](_0x262370)){return _0x3b1c6b['removeAgents'](_0x262370,{'transaction':_0x419d91});}})[_0x0d68('0x29')](function(){_0x262370[_0x0d68('0x72')](function(_0x61d483){socket[_0x0d68('0x73')](_0x0d68('0x87'),{'UserId':_0x61d483,'OpenchannelQueueId':_0x3b1c6b['id']});});});});});});})['then'](respondWithStatusCode(_0x1f8fbf,null))['catch'](handleError(_0x1f8fbf,null));};exports[_0x0d68('0x88')]=function(_0x301f73,_0x50912d,_0x1d6683){return db[_0x0d68('0x32')]['find']({'where':{'id':_0x301f73[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x50912d,null))[_0x0d68('0x29')](function(_0x4db272){if(_0x4db272){return _0x4db272[_0x0d68('0x88')](_0x301f73[_0x0d68('0x4f')][_0x0d68('0x69')],_['omit'](_0x301f73[_0x0d68('0x4f')],['ids','id'])||{})[_0x0d68('0x89')](function(_0x305f16){for(var _0x1e672e=0x0;_0x1e672e<_0x301f73['body'][_0x0d68('0x69')][_0x0d68('0x3e')];_0x1e672e+=0x1){socket[_0x0d68('0x73')](_0x0d68('0x74'),{'UserId':Number(_0x301f73[_0x0d68('0x4f')][_0x0d68('0x69')][_0x1e672e]),'OpenchannelQueueId':Number(_0x301f73[_0x0d68('0x4a')]['id'])});}return _0x305f16;});}})['then'](respondWithResult(_0x50912d,null))[_0x0d68('0x48')](handleError(_0x50912d,null));};exports['removeAgents']=function(_0x14cfe9,_0x4dd326,_0x2fa2d4){return db[_0x0d68('0x32')]['find']({'where':{'id':_0x14cfe9[_0x0d68('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4dd326,null))[_0x0d68('0x29')](function(_0x525d95){if(_0x525d95){return _0x525d95['removeAgents'](_0x14cfe9[_0x0d68('0x37')]['ids'])[_0x0d68('0x29')](function(){if(_[_0x0d68('0x8a')](_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')])){for(var _0x416c10=0x0;_0x416c10<_0x14cfe9[_0x0d68('0x37')]['ids'][_0x0d68('0x3e')];_0x416c10+=0x1){socket[_0x0d68('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')][_0x416c10]),'OpenchannelQueueId':Number(_0x14cfe9[_0x0d68('0x4a')]['id'])});}}else{socket[_0x0d68('0x73')](_0x0d68('0x87'),{'UserId':Number(_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')]),'OpenchannelQueueId':Number(_0x14cfe9[_0x0d68('0x4a')]['id'])});}});}})[_0x0d68('0x29')](respondWithStatusCode(_0x4dd326,null))[_0x0d68('0x48')](handleError(_0x4dd326,null));};exports[_0x0d68('0x8b')]=function(_0x5809a0,_0x4c59e9,_0x54bca9){var _0x91144c={};var _0x42fec0={};var _0x4130fa;var _0x45e149;return db['OpenchannelQueue'][_0x0d68('0x59')]({'where':{'id':_0x5809a0[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x4c59e9,null))[_0x0d68('0x29')](function(_0x224590){if(_0x224590){_0x4130fa=_0x224590;_0x42fec0[_0x0d68('0x3c')]=_['keys'](db['User'][_0x0d68('0x33')]);_0x42fec0[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x5809a0[_0x0d68('0x37')]);_0x42fec0[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0x42fec0[_0x0d68('0x3c')],_0x42fec0[_0x0d68('0x37')]);_0x91144c[_0x0d68('0x3b')]=_['intersection'](_0x42fec0['model'],qs['fields'](_0x5809a0[_0x0d68('0x37')]['fields']));_0x91144c[_0x0d68('0x3b')]=_0x91144c[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x91144c['attributes']:_0x42fec0[_0x0d68('0x3c')];_0x91144c[_0x0d68('0x5b')]=qs[_0x0d68('0x5c')](_0x5809a0[_0x0d68('0x37')][_0x0d68('0x5c')]);_0x91144c[_0x0d68('0x45')]=qs['filters'](_[_0x0d68('0x42')](_0x5809a0['query'],_0x42fec0[_0x0d68('0x39')]));if(_0x5809a0['query'][_0x0d68('0x43')]){_0x91144c[_0x0d68('0x45')]=_[_0x0d68('0x44')](_0x91144c['where'],{'$or':_[_0x0d68('0x31')](_0x91144c['attributes'],function(_0x354048){var _0x2eede8={};_0x2eede8[_0x354048]={'$like':'%'+_0x5809a0[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x2eede8;})});}_0x91144c=_[_0x0d68('0x44')]({},_0x91144c,_0x5809a0[_0x0d68('0x46')]);return _0x4130fa['getAgents'](_0x91144c);}})[_0x0d68('0x29')](function(_0x1aa3f7){if(_0x1aa3f7){_0x45e149=_0x1aa3f7[_0x0d68('0x3e')];if(!_0x5809a0[_0x0d68('0x37')]['hasOwnProperty'](_0x0d68('0x40'))){_0x91144c[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x5809a0['query'][_0x0d68('0x41')]);_0x91144c['offset']=qs['offset'](_0x5809a0[_0x0d68('0x37')][_0x0d68('0x21')]);}return _0x4130fa['getAgents'](_0x91144c);}})[_0x0d68('0x29')](function(_0x5abb84){if(_0x5abb84){return _0x5abb84?{'count':_0x45e149,'rows':_0x5abb84}:null;}})['then'](respondWithResult(_0x4c59e9,null))[_0x0d68('0x48')](handleError(_0x4c59e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9449cc2..2c7f8d5 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 _0x50eb=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','save','remove','emit'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x50eb,0x1aa));var _0xb50e=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x50eb[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require(_0xb50e('0x0'));var OpenchannelQueue=require(_0xb50e('0x1'))['db'][_0xb50e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb50e('0x3'),'afterUpdate':'update','afterDestroy':_0xb50e('0x4')};function emitEvent(_0x235fbf){return function(_0x4ce615,_0x97ae5e,_0x3208be){OpenchannelQueueEvents[_0xb50e('0x5')](_0x235fbf+':'+_0x4ce615['id'],_0x4ce615);OpenchannelQueueEvents['emit'](_0x235fbf,_0x4ce615);_0x3208be(null);};}for(var e in events){if(events[_0xb50e('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb50e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xb145=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb145,0x1bb));var _0x5b14=function(_0x46d359,_0x4084aa){_0x46d359=_0x46d359-0x0;var _0x1ebaae=_0xb145[_0x46d359];return _0x1ebaae;};'use strict';var EventEmitter=require(_0x5b14('0x0'));var OpenchannelQueue=require(_0x5b14('0x1'))['db'][_0x5b14('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5b14('0x3')](0x0);var events={'afterCreate':_0x5b14('0x4'),'afterUpdate':_0x5b14('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50cfa5){return function(_0x194225,_0x4847ed,_0x34a289){OpenchannelQueueEvents[_0x5b14('0x6')](_0x50cfa5+':'+_0x194225['id'],_0x194225);OpenchannelQueueEvents['emit'](_0x50cfa5,_0x194225);_0x34a289(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5b14('0x8')](e,emitEvent(event));}}module[_0x5b14('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 c7c5c7e..ba49c74 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 _0xe8af=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','api','bluebird','path','rimraf'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe8af,0x1c9));var _0xfe8a=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xe8af[_0xe8129c];return _0x709fc5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe8a('0x0'))(_0xfe8a('0x1'));var moment=require('moment');var BPromise=require(_0xfe8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe8a('0x3'));var rimraf=require(_0xfe8a('0x4'));var config=require(_0xfe8a('0x5'));var attributes=require(_0xfe8a('0x6'));module[_0xfe8a('0x7')]=function(_0x13cfa7,_0x35fef5){return _0x13cfa7[_0xfe8a('0x8')](_0xfe8a('0x9'),attributes,{'tableName':_0xfe8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb500=['moment','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x486caf,_0x1084d8){var _0x22ab74=function(_0x2e137e){while(--_0x2e137e){_0x486caf['push'](_0x486caf['shift']());}};_0x22ab74(++_0x1084d8);}(_0xb500,0xb3));var _0x0b50=function(_0x96f878,_0x5685fa){_0x96f878=_0x96f878-0x0;var _0x4ea01b=_0xb500[_0x96f878];return _0x4ea01b;};'use strict';var _=require('lodash');var util=require(_0x0b50('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0b50('0x1'));var BPromise=require(_0x0b50('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b50('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b50('0x4'));module[_0x0b50('0x5')]=function(_0x447f56,_0x4c2d1b){return _0x447f56[_0x0b50('0x6')](_0x0b50('0x7'),attributes,{'tableName':_0x0b50('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 d6c8e6a..ec6aa9c 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 _0x6d72=['OpenchannelQueue','options','limit','include','model','attributes','map','ShowOpenchannelQueue','find','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x6d72,0x101));var _0x26d7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6d72[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x26d7('0x0'));var util=require(_0x26d7('0x1'));var moment=require(_0x26d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x26d7('0x3'));var fs=require('fs');var Redis=require(_0x26d7('0x4'));var db=require(_0x26d7('0x5'))['db'];var utils=require(_0x26d7('0x6'));var logger=require(_0x26d7('0x7'))(_0x26d7('0x8'));var config=require(_0x26d7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x26d7('0xa')][_0x26d7('0xb')]({'port':0x232a});config[_0x26d7('0xc')]=_[_0x26d7('0xd')](config[_0x26d7('0xc')],{'host':_0x26d7('0xe'),'port':0x18eb});var socket=require(_0x26d7('0xf'))(new Redis(config[_0x26d7('0xc')]));require(_0x26d7('0x10'))[_0x26d7('0x11')](socket);function respondWithRpcPromise(_0x5a1354,_0x17a990,_0x3d49d3){return new BPromise(function(_0x5370be,_0x399626){return client[_0x26d7('0x12')](_0x5a1354,_0x3d49d3)[_0x26d7('0x13')](function(_0x35e92f){logger[_0x26d7('0x14')](_0x26d7('0x15'),_0x17a990,_0x26d7('0x16'));logger[_0x26d7('0x17')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x17a990,_0x26d7('0x16'),JSON[_0x26d7('0x18')](_0x35e92f));if(_0x35e92f[_0x26d7('0x19')]){if(_0x35e92f[_0x26d7('0x19')][_0x26d7('0x1a')]===0x1f4){logger['error'](_0x26d7('0x15'),_0x17a990,_0x35e92f[_0x26d7('0x19')][_0x26d7('0x1b')]);return _0x399626(_0x35e92f['error'][_0x26d7('0x1b')]);}logger[_0x26d7('0x19')](_0x26d7('0x15'),_0x17a990,_0x35e92f[_0x26d7('0x19')][_0x26d7('0x1b')]);return _0x5370be(_0x35e92f[_0x26d7('0x19')][_0x26d7('0x1b')]);}else{logger[_0x26d7('0x14')](_0x26d7('0x15'),_0x17a990,_0x26d7('0x16'));_0x5370be(_0x35e92f['result'][_0x26d7('0x1b')]);}})[_0x26d7('0x1c')](function(_0x30f7da){logger['error'](_0x26d7('0x15'),_0x17a990,_0x30f7da);_0x399626(_0x30f7da);});});}exports[_0x26d7('0x1d')]=function(_0xa30693){var _0x296edd=this;return new Promise(function(_0x23d5ac,_0x544ce3){return db[_0x26d7('0x1e')]['findAll']({'raw':_0xa30693[_0x26d7('0x1f')]?_0xa30693[_0x26d7('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xa30693[_0x26d7('0x1f')]?_0xa30693[_0x26d7('0x1f')]['where']||null:null,'attributes':_0xa30693['options']?_0xa30693[_0x26d7('0x1f')]['attributes']||null:null,'limit':_0xa30693[_0x26d7('0x1f')]?_0xa30693[_0x26d7('0x1f')][_0x26d7('0x20')]||null:null,'include':_0xa30693[_0x26d7('0x1f')]?_0xa30693[_0x26d7('0x1f')][_0x26d7('0x21')]?_['map'](_0xa30693[_0x26d7('0x1f')][_0x26d7('0x21')],function(_0x5631c6){return{'model':db[_0x5631c6[_0x26d7('0x22')]],'as':_0x5631c6['as'],'attributes':_0x5631c6[_0x26d7('0x23')],'include':_0x5631c6[_0x26d7('0x21')]?_[_0x26d7('0x24')](_0x5631c6['include'],function(_0x395363){return{'model':db[_0x395363[_0x26d7('0x22')]],'as':_0x395363['as'],'attributes':_0x395363[_0x26d7('0x23')],'include':_0x395363[_0x26d7('0x21')]?_['map'](_0x395363['include'],function(_0x158c79){return{'model':db[_0x158c79[_0x26d7('0x22')]],'as':_0x158c79['as'],'attributes':_0x158c79['attributes']};}):[]};}):[]};}):[]:[]})[_0x26d7('0x13')](function(_0x54e161){logger['info']('GetOpenchannelQueue',_0xa30693);logger[_0x26d7('0x17')](_0x26d7('0x1d'),_0xa30693,JSON[_0x26d7('0x18')](_0x54e161));_0x23d5ac(_0x54e161);})[_0x26d7('0x1c')](function(_0xa9348c){logger['error']('GetOpenchannelQueue',_0xa9348c[_0x26d7('0x1b')],_0xa30693);_0x544ce3(_0x296edd[_0x26d7('0x19')](0x1f4,_0xa9348c[_0x26d7('0x1b')]));});});};exports[_0x26d7('0x25')]=function(_0x3a6889){var _0x14f20f=this;return new Promise(function(_0x3c5b8e,_0x31ac9f){return db[_0x26d7('0x1e')][_0x26d7('0x26')]({'raw':_0x3a6889[_0x26d7('0x1f')]?_0x3a6889[_0x26d7('0x1f')][_0x26d7('0x27')]===undefined?!![]:![]:!![],'where':_0x3a6889[_0x26d7('0x1f')]?_0x3a6889[_0x26d7('0x1f')][_0x26d7('0x28')]||null:null,'attributes':_0x3a6889[_0x26d7('0x1f')]?_0x3a6889[_0x26d7('0x1f')][_0x26d7('0x23')]||null:null,'include':_0x3a6889[_0x26d7('0x1f')]?_0x3a6889['options'][_0x26d7('0x21')]?_[_0x26d7('0x24')](_0x3a6889[_0x26d7('0x1f')]['include'],function(_0x4bd7fd){return{'model':db[_0x4bd7fd[_0x26d7('0x22')]],'as':_0x4bd7fd['as'],'attributes':_0x4bd7fd[_0x26d7('0x23')],'include':_0x4bd7fd[_0x26d7('0x21')]?_['map'](_0x4bd7fd[_0x26d7('0x21')],function(_0x325469){return{'model':db[_0x325469['model']],'as':_0x325469['as'],'attributes':_0x325469[_0x26d7('0x23')],'include':_0x325469[_0x26d7('0x21')]?_[_0x26d7('0x24')](_0x325469[_0x26d7('0x21')],function(_0x162c3e){return{'model':db[_0x162c3e[_0x26d7('0x22')]],'as':_0x162c3e['as'],'attributes':_0x162c3e[_0x26d7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x26d7('0x13')](function(_0x5e0f1b){logger[_0x26d7('0x14')](_0x26d7('0x25'),_0x3a6889);logger[_0x26d7('0x17')]('ShowOpenchannelQueue',_0x3a6889,JSON[_0x26d7('0x18')](_0x5e0f1b));_0x3c5b8e(_0x5e0f1b);})[_0x26d7('0x1c')](function(_0xf94df){logger[_0x26d7('0x19')](_0x26d7('0x25'),_0xf94df[_0x26d7('0x1b')],_0x3a6889);_0x31ac9f(_0x14f20f[_0x26d7('0x19')](0x1f4,_0xf94df['message']));});});}; \ No newline at end of file +var _0xe605=['findAll','options','raw','where','attributes','map','include','model','then','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x2e1ef2,_0xcc4033){var _0x1aa955=function(_0x1d74b6){while(--_0x1d74b6){_0x2e1ef2['push'](_0x2e1ef2['shift']());}};_0x1aa955(++_0xcc4033);}(_0xe605,0x163));var _0x5e60=function(_0x349918,_0x4314f6){_0x349918=_0x349918-0x0;var _0x41fa33=_0xe605[_0x349918];return _0x41fa33;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5e60('0xa')][_0x5e60('0xb')]({'port':0x232a});config[_0x5e60('0xc')]=_[_0x5e60('0xd')](config[_0x5e60('0xc')],{'host':_0x5e60('0xe'),'port':0x18eb});var socket=require(_0x5e60('0xf'))(new Redis(config[_0x5e60('0xc')]));require(_0x5e60('0x10'))[_0x5e60('0x11')](socket);function respondWithRpcPromise(_0x42f78a,_0x18a16c,_0x207d99){return new BPromise(function(_0x1f03f2,_0x4bafa9){return client[_0x5e60('0x12')](_0x42f78a,_0x207d99)['then'](function(_0x33f9ba){logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x18a16c,_0x5e60('0x15'));logger[_0x5e60('0x16')](_0x5e60('0x17'),_0x18a16c,_0x5e60('0x15'),JSON[_0x5e60('0x18')](_0x33f9ba));if(_0x33f9ba[_0x5e60('0x19')]){if(_0x33f9ba['error'][_0x5e60('0x1a')]===0x1f4){logger[_0x5e60('0x19')](_0x5e60('0x14'),_0x18a16c,_0x33f9ba[_0x5e60('0x19')][_0x5e60('0x1b')]);return _0x4bafa9(_0x33f9ba[_0x5e60('0x19')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x18a16c,_0x33f9ba[_0x5e60('0x19')][_0x5e60('0x1b')]);return _0x1f03f2(_0x33f9ba['error'][_0x5e60('0x1b')]);}else{logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x18a16c,_0x5e60('0x15'));_0x1f03f2(_0x33f9ba[_0x5e60('0x1c')][_0x5e60('0x1b')]);}})[_0x5e60('0x1d')](function(_0x9de9b2){logger[_0x5e60('0x19')](_0x5e60('0x14'),_0x18a16c,_0x9de9b2);_0x4bafa9(_0x9de9b2);});});}exports[_0x5e60('0x1e')]=function(_0x87246f){var _0x54bc17=this;return new Promise(function(_0x1331fe,_0x491ce3){return db[_0x5e60('0x1f')][_0x5e60('0x20')]({'raw':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')][_0x5e60('0x22')]===undefined?!![]:![]:!![],'where':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')][_0x5e60('0x23')]||null:null,'attributes':_0x87246f[_0x5e60('0x21')]?_0x87246f['options'][_0x5e60('0x24')]||null:null,'limit':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')]['limit']||null:null,'include':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')]['include']?_[_0x5e60('0x25')](_0x87246f[_0x5e60('0x21')][_0x5e60('0x26')],function(_0x603f89){return{'model':db[_0x603f89[_0x5e60('0x27')]],'as':_0x603f89['as'],'attributes':_0x603f89[_0x5e60('0x24')],'include':_0x603f89[_0x5e60('0x26')]?_[_0x5e60('0x25')](_0x603f89[_0x5e60('0x26')],function(_0x4575ce){return{'model':db[_0x4575ce['model']],'as':_0x4575ce['as'],'attributes':_0x4575ce[_0x5e60('0x24')],'include':_0x4575ce[_0x5e60('0x26')]?_['map'](_0x4575ce[_0x5e60('0x26')],function(_0x54ef05){return{'model':db[_0x54ef05[_0x5e60('0x27')]],'as':_0x54ef05['as'],'attributes':_0x54ef05[_0x5e60('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0x28')](function(_0x315650){logger['info'](_0x5e60('0x1e'),_0x87246f);logger[_0x5e60('0x16')]('GetOpenchannelQueue',_0x87246f,JSON[_0x5e60('0x18')](_0x315650));_0x1331fe(_0x315650);})[_0x5e60('0x1d')](function(_0x1c4553){logger[_0x5e60('0x19')](_0x5e60('0x1e'),_0x1c4553[_0x5e60('0x1b')],_0x87246f);_0x491ce3(_0x54bc17[_0x5e60('0x19')](0x1f4,_0x1c4553['message']));});});};exports['ShowOpenchannelQueue']=function(_0xc5554c){var _0x2243f6=this;return new Promise(function(_0x2b5852,_0x581d42){return db[_0x5e60('0x1f')][_0x5e60('0x29')]({'raw':_0xc5554c[_0x5e60('0x21')]?_0xc5554c['options'][_0x5e60('0x22')]===undefined?!![]:![]:!![],'where':_0xc5554c[_0x5e60('0x21')]?_0xc5554c['options'][_0x5e60('0x23')]||null:null,'attributes':_0xc5554c['options']?_0xc5554c[_0x5e60('0x21')]['attributes']||null:null,'include':_0xc5554c[_0x5e60('0x21')]?_0xc5554c[_0x5e60('0x21')]['include']?_[_0x5e60('0x25')](_0xc5554c[_0x5e60('0x21')][_0x5e60('0x26')],function(_0x5ab0ce){return{'model':db[_0x5ab0ce[_0x5e60('0x27')]],'as':_0x5ab0ce['as'],'attributes':_0x5ab0ce[_0x5e60('0x24')],'include':_0x5ab0ce['include']?_[_0x5e60('0x25')](_0x5ab0ce[_0x5e60('0x26')],function(_0x2e6a7c){return{'model':db[_0x2e6a7c[_0x5e60('0x27')]],'as':_0x2e6a7c['as'],'attributes':_0x2e6a7c[_0x5e60('0x24')],'include':_0x2e6a7c[_0x5e60('0x26')]?_[_0x5e60('0x25')](_0x2e6a7c['include'],function(_0x44be5e){return{'model':db[_0x44be5e[_0x5e60('0x27')]],'as':_0x44be5e['as'],'attributes':_0x44be5e[_0x5e60('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0x28')](function(_0x15fc38){logger[_0x5e60('0x13')](_0x5e60('0x2a'),_0xc5554c);logger[_0x5e60('0x16')](_0x5e60('0x2a'),_0xc5554c,JSON[_0x5e60('0x18')](_0x15fc38));_0x2b5852(_0x15fc38);})[_0x5e60('0x1d')](function(_0x38d80e){logger[_0x5e60('0x19')](_0x5e60('0x2a'),_0x38d80e[_0x5e60('0x1b')],_0xc5554c);_0x581d42(_0x2243f6[_0x5e60('0x19')](0x1f4,_0x38d80e[_0x5e60('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5a90afd..5cbb05f 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 _0xdb63=['emit','removeListener','./openchannelQueue.events','save'];(function(_0x2b6490,_0x36e282){var _0x450121=function(_0x41feae){while(--_0x41feae){_0x2b6490['push'](_0x2b6490['shift']());}};_0x450121(++_0x36e282);}(_0xdb63,0x162));var _0x3db6=function(_0x3528cf,_0x54bf34){_0x3528cf=_0x3528cf-0x0;var _0x5c34af=_0xdb63[_0x3528cf];return _0x5c34af;};'use strict';var OpenchannelQueueEvents=require(_0x3db6('0x0'));var events=[_0x3db6('0x1'),'remove','update'];function createListener(_0x1a2842,_0x306863){return function(_0x48e643){_0x306863[_0x3db6('0x2')](_0x1a2842,_0x48e643);};}function removeListener(_0x4d8868,_0x48630e){return function(){OpenchannelQueueEvents[_0x3db6('0x3')](_0x4d8868,_0x48630e);};}exports['register']=function(_0xbd22b3){for(var _0x3f4153=0x0,_0x3f9640=events['length'];_0x3f4153<_0x3f9640;_0x3f4153++){var _0x23dfb8=events[_0x3f4153];var _0x9d2a=createListener('openchannelQueue:'+_0x23dfb8,_0xbd22b3);OpenchannelQueueEvents['on'](_0x23dfb8,_0x9d2a);}}; \ No newline at end of file +var _0x139a=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener'];(function(_0x5a7e0f,_0x1a4d83){var _0x10dc3f=function(_0x467b8d){while(--_0x467b8d){_0x5a7e0f['push'](_0x5a7e0f['shift']());}};_0x10dc3f(++_0x1a4d83);}(_0x139a,0x1a0));var _0xa139=function(_0x188bae,_0x4787ee){_0x188bae=_0x188bae-0x0;var _0x1a2b30=_0x139a[_0x188bae];return _0x1a2b30;};'use strict';var OpenchannelQueueEvents=require(_0xa139('0x0'));var events=[_0xa139('0x1'),_0xa139('0x2'),'update'];function createListener(_0x57c39b,_0x4cc73b){return function(_0x36eb71){_0x4cc73b['emit'](_0x57c39b,_0x36eb71);};}function removeListener(_0x9c9ed6,_0x44196b){return function(){OpenchannelQueueEvents[_0xa139('0x3')](_0x9c9ed6,_0x44196b);};}exports[_0xa139('0x4')]=function(_0x2f92b1){for(var _0x5bfbfe=0x0,_0x500c12=events[_0xa139('0x5')];_0x5bfbfe<_0x500c12;_0x5bfbfe++){var _0x46fd46=events[_0x5bfbfe];var _0x549610=createListener(_0xa139('0x6')+_0x46fd46,_0x2f92b1);OpenchannelQueueEvents['on'](_0x46fd46,_0x549610);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 3054d7b..478836e 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 _0xad38=['/describe','isAuthenticated','describe','/:id','show','post','create','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','index'];(function(_0x33bb96,_0x5ab67e){var _0x2ceaea=function(_0x52722a){while(--_0x52722a){_0x33bb96['push'](_0x33bb96['shift']());}};_0x2ceaea(++_0x5ab67e);}(_0xad38,0x105));var _0x8ad3=function(_0x312634,_0x165c8e){_0x312634=_0x312634-0x0;var _0x34a887=_0xad38[_0x312634];return _0x34a887;};'use strict';var multer=require(_0x8ad3('0x0'));var util=require('util');var path=require(_0x8ad3('0x1'));var timeout=require(_0x8ad3('0x2'));var express=require(_0x8ad3('0x3'));var router=express['Router']();var fs_extra=require(_0x8ad3('0x4'));var auth=require(_0x8ad3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ad3('0x6'));router[_0x8ad3('0x7')]('/',auth['isAuthenticated'](),controller[_0x8ad3('0x8')]);router['get'](_0x8ad3('0x9'),auth[_0x8ad3('0xa')](),controller[_0x8ad3('0xb')]);router['get'](_0x8ad3('0xc'),auth[_0x8ad3('0xa')](),controller[_0x8ad3('0xd')]);router[_0x8ad3('0xe')]('/',auth[_0x8ad3('0xa')](),controller[_0x8ad3('0xf')]);router['put'](_0x8ad3('0xc'),auth[_0x8ad3('0xa')](),controller[_0x8ad3('0x10')]);router['delete']('/:id',auth[_0x8ad3('0xa')](),controller['destroy']);module[_0x8ad3('0x11')]=router; \ No newline at end of file +var _0xf855=['Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5893fa,_0x187b93){var _0x8418df=function(_0x2c453b){while(--_0x2c453b){_0x5893fa['push'](_0x5893fa['shift']());}};_0x8418df(++_0x187b93);}(_0xf855,0x1b3));var _0x5f85=function(_0x513a4f,_0x349607){_0x513a4f=_0x513a4f-0x0;var _0xf81778=_0xf855[_0x513a4f];return _0xf81778;};'use strict';var multer=require(_0x5f85('0x0'));var util=require(_0x5f85('0x1'));var path=require(_0x5f85('0x2'));var timeout=require(_0x5f85('0x3'));var express=require(_0x5f85('0x4'));var router=express[_0x5f85('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f85('0x6'));var interaction=require(_0x5f85('0x7'));var config=require('../../config/environment');var controller=require(_0x5f85('0x8'));router[_0x5f85('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f85('0xa')]);router[_0x5f85('0x9')]('/describe',auth[_0x5f85('0xb')](),controller[_0x5f85('0xc')]);router[_0x5f85('0x9')](_0x5f85('0xd'),auth[_0x5f85('0xb')](),controller[_0x5f85('0xe')]);router[_0x5f85('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f85('0x10')]);router[_0x5f85('0x11')]('/:id',auth[_0x5f85('0xb')](),controller[_0x5f85('0x12')]);router[_0x5f85('0x13')](_0x5f85('0xd'),auth[_0x5f85('0xb')](),controller[_0x5f85('0x14')]);module[_0x5f85('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b983e8d..fc07c9d 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 _0xc586=['exports','STRING','DATE','moment'];(function(_0x51ba58,_0x1b1dbe){var _0x96d32a=function(_0x1a9084){while(--_0x1a9084){_0x51ba58['push'](_0x51ba58['shift']());}};_0x96d32a(++_0x1b1dbe);}(_0xc586,0xbb));var _0x6c58=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xc586[_0x29d94e];return _0x106237;};'use strict';var moment=require(_0x6c58('0x0'));var Sequelize=require('sequelize');module[_0x6c58('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6c58('0x2')]},'joinAt':{'type':Sequelize[_0x6c58('0x3')]},'leaveAt':{'type':Sequelize[_0x6c58('0x3')]},'acceptAt':{'type':Sequelize[_0x6c58('0x3')]},'exitAt':{'type':Sequelize[_0x6c58('0x3')]},'reason':{'type':Sequelize[_0x6c58('0x2')]}}; \ No newline at end of file +var _0xef6d=['sequelize','exports','STRING','DATE'];(function(_0x3a18da,_0x2d39bc){var _0x3f3915=function(_0x2b19c3){while(--_0x2b19c3){_0x3a18da['push'](_0x3a18da['shift']());}};_0x3f3915(++_0x2d39bc);}(_0xef6d,0x12c));var _0xdef6=function(_0x4c7af2,_0x52135b){_0x4c7af2=_0x4c7af2-0x0;var _0x41a89e=_0xef6d[_0x4c7af2];return _0x41a89e;};'use strict';var moment=require('moment');var Sequelize=require(_0xdef6('0x0'));module[_0xdef6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdef6('0x2')]},'joinAt':{'type':Sequelize[_0xdef6('0x3')]},'leaveAt':{'type':Sequelize[_0xdef6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdef6('0x3')]},'reason':{'type':Sequelize[_0xdef6('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 33d61e9..a5310f1 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 _0xc4cd=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','rows','show','params','create','body','catch','find','destroy','describe','rimraf','zip-dir','fast-json-patch','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then'];(function(_0x4209a1,_0x5f5b36){var _0x99e3ac=function(_0x216c6c){while(--_0x216c6c){_0x4209a1['push'](_0x4209a1['shift']());}};_0x99e3ac(++_0x5f5b36);}(_0xc4cd,0x1ea));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc4c('0x0'));var zipdir=require(_0xdc4c('0x1'));var jsonpatch=require(_0xdc4c('0x2'));var rp=require('request-promise');var moment=require(_0xdc4c('0x3'));var BPromise=require(_0xdc4c('0x4'));var Mustache=require(_0xdc4c('0x5'));var util=require('util');var path=require(_0xdc4c('0x6'));var sox=require(_0xdc4c('0x7'));var csv=require(_0xdc4c('0x8'));var ejs=require(_0xdc4c('0x9'));var fs=require('fs');var fs_extra=require(_0xdc4c('0xa'));var _=require('lodash');var squel=require(_0xdc4c('0xb'));var crypto=require('crypto');var jsforce=require(_0xdc4c('0xc'));var deskjs=require(_0xdc4c('0xd'));var toCsv=require(_0xdc4c('0x8'));var querystring=require('querystring');var Papa=require(_0xdc4c('0xe'));var Redis=require(_0xdc4c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdc4c('0x10'));var as=require(_0xdc4c('0x11'));var hardwareService=require(_0xdc4c('0x12'));var logger=require(_0xdc4c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdc4c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc4c('0x15'))['db'];function respondWithStatusCode(_0x1fcdb0,_0x4661c2){_0x4661c2=_0x4661c2||0xcc;return function(_0x120c13){if(_0x120c13){return _0x1fcdb0[_0xdc4c('0x16')](_0x4661c2);}return _0x1fcdb0[_0xdc4c('0x17')](_0x4661c2)[_0xdc4c('0x18')]();};}function respondWithResult(_0x11e1c3,_0x59df78){_0x59df78=_0x59df78||0xc8;return function(_0x56d5e3){if(_0x56d5e3){return _0x11e1c3[_0xdc4c('0x17')](_0x59df78)[_0xdc4c('0x19')](_0x56d5e3);}};}function respondWithFilteredResult(_0x25b110,_0x49d931){return function(_0x9766e6){if(_0x9766e6){var _0x3ce971=typeof _0x49d931[_0xdc4c('0x1a')]===_0xdc4c('0x1b')&&typeof _0x49d931['limit']===_0xdc4c('0x1b');var _0x10dbb9=_0x9766e6['count'];var _0x1dfe21=_0x3ce971?0x0:_0x49d931[_0xdc4c('0x1a')];var _0x4e5ebd=_0x3ce971?_0x9766e6[_0xdc4c('0x1c')]:_0x49d931[_0xdc4c('0x1a')]+_0x49d931['limit'];var _0x550c10;if(_0x4e5ebd>=_0x10dbb9){_0x4e5ebd=_0x10dbb9;_0x550c10=0xc8;}else{_0x550c10=0xce;}_0x25b110[_0xdc4c('0x17')](_0x550c10);return _0x25b110[_0xdc4c('0x1d')](_0xdc4c('0x1e'),_0x1dfe21+'-'+_0x4e5ebd+'/'+_0x10dbb9)[_0xdc4c('0x19')](_0x9766e6);}return null;};}function patchUpdates(_0x5cd7f1){return function(_0x5435f1){try{jsonpatch['apply'](_0x5435f1,_0x5cd7f1,!![]);}catch(_0x1527e6){return BPromise[_0xdc4c('0x1f')](_0x1527e6);}return _0x5435f1[_0xdc4c('0x20')]();};}function saveUpdates(_0x43ff90,_0x3163ef){return function(_0x39e0e7){if(_0x39e0e7){return _0x39e0e7[_0xdc4c('0x21')](_0x43ff90)[_0xdc4c('0x22')](function(_0x29c8ad){return _0x29c8ad;});}return null;};}function removeEntity(_0x1da13b,_0x4fd4c9){return function(_0x544ba1){if(_0x544ba1){return _0x544ba1['destroy']()[_0xdc4c('0x22')](function(){_0x1da13b['status'](0xcc)[_0xdc4c('0x18')]();});}};}function handleEntityNotFound(_0x36ece1,_0x2f8073){return function(_0x1eb575){if(!_0x1eb575){_0x36ece1[_0xdc4c('0x16')](0x194);}return _0x1eb575;};}function handleError(_0x330560,_0x5a917f){_0x5a917f=_0x5a917f||0x1f4;return function(_0x55bfb2){logger[_0xdc4c('0x23')](_0x55bfb2[_0xdc4c('0x24')]);if(_0x55bfb2['name']){delete _0x55bfb2[_0xdc4c('0x25')];}_0x330560['status'](_0x5a917f)[_0xdc4c('0x26')](_0x55bfb2);};}exports[_0xdc4c('0x27')]=function(_0x10376f,_0x22e82d){var _0x143d57={},_0x1553ff={},_0x586e61={'count':0x0,'rows':[]};var _0x51a3b2=_[_0xdc4c('0x28')](db['OpenchannelQueueReport'][_0xdc4c('0x29')],function(_0x43ecb2){return{'name':_0x43ecb2[_0xdc4c('0x2a')],'type':_0x43ecb2[_0xdc4c('0x2b')][_0xdc4c('0x2c')]};});_0x1553ff[_0xdc4c('0x2d')]=_['map'](_0x51a3b2,_0xdc4c('0x25'));_0x1553ff[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x10376f[_0xdc4c('0x2e')]);_0x1553ff[_0xdc4c('0x30')]=_[_0xdc4c('0x31')](_0x1553ff[_0xdc4c('0x2d')],_0x1553ff[_0xdc4c('0x2e')]);_0x143d57[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0x1553ff['model'],qs[_0xdc4c('0x33')](_0x10376f[_0xdc4c('0x2e')]['fields']));_0x143d57['attributes']=_0x143d57['attributes'][_0xdc4c('0x34')]?_0x143d57[_0xdc4c('0x32')]:_0x1553ff[_0xdc4c('0x2d')];if(!_0x10376f['query']['hasOwnProperty'](_0xdc4c('0x35'))){_0x143d57[_0xdc4c('0x36')]=qs[_0xdc4c('0x36')](_0x10376f[_0xdc4c('0x2e')]['limit']);_0x143d57[_0xdc4c('0x1a')]=qs[_0xdc4c('0x1a')](_0x10376f[_0xdc4c('0x2e')][_0xdc4c('0x1a')]);}_0x143d57[_0xdc4c('0x37')]=qs[_0xdc4c('0x38')](_0x10376f[_0xdc4c('0x2e')][_0xdc4c('0x38')]);_0x143d57[_0xdc4c('0x39')]=qs[_0xdc4c('0x30')](_[_0xdc4c('0x3a')](_0x10376f[_0xdc4c('0x2e')],_0x1553ff['filters']),_0x51a3b2);if(_0x10376f['query']['filter']){_0x143d57['where']=_[_0xdc4c('0x3b')](_0x143d57['where'],{'$or':_['map'](_0x51a3b2,function(_0x2eed9a){if(_0x2eed9a['type']!==_0xdc4c('0x3c')){var _0xba7e58={};_0xba7e58[_0x2eed9a[_0xdc4c('0x25')]]={'$like':'%'+_0x10376f[_0xdc4c('0x2e')][_0xdc4c('0x3d')]+'%'};return _0xba7e58;}})});}_0x143d57=_['merge']({},_0x143d57,_0x10376f[_0xdc4c('0x3e')]);var _0x1bb84a={'where':_0x143d57[_0xdc4c('0x39')]};return db[_0xdc4c('0x3f')][_0xdc4c('0x1c')](_0x1bb84a)['then'](function(_0xd39772){_0x586e61[_0xdc4c('0x1c')]=_0xd39772;if(_0x10376f['query'][_0xdc4c('0x40')]){_0x143d57[_0xdc4c('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x143d57);})[_0xdc4c('0x22')](function(_0x5a674c){_0x586e61[_0xdc4c('0x42')]=_0x5a674c;return _0x586e61;})[_0xdc4c('0x22')](respondWithFilteredResult(_0x22e82d,_0x143d57))['catch'](handleError(_0x22e82d,null));};exports[_0xdc4c('0x43')]=function(_0x3e8fc4,_0x52daad){var _0x49bc65={'raw':!![],'where':{'id':_0x3e8fc4[_0xdc4c('0x44')]['id']}},_0x7394c2={};_0x7394c2[_0xdc4c('0x2d')]=_['keys'](db['OpenchannelQueueReport'][_0xdc4c('0x29')]);_0x7394c2[_0xdc4c('0x2e')]=_['keys'](_0x3e8fc4['query']);_0x7394c2[_0xdc4c('0x30')]=_[_0xdc4c('0x31')](_0x7394c2[_0xdc4c('0x2d')],_0x7394c2['query']);_0x49bc65['attributes']=_[_0xdc4c('0x31')](_0x7394c2[_0xdc4c('0x2d')],qs[_0xdc4c('0x33')](_0x3e8fc4[_0xdc4c('0x2e')][_0xdc4c('0x33')]));_0x49bc65[_0xdc4c('0x32')]=_0x49bc65['attributes'][_0xdc4c('0x34')]?_0x49bc65[_0xdc4c('0x32')]:_0x7394c2[_0xdc4c('0x2d')];if(_0x3e8fc4[_0xdc4c('0x2e')][_0xdc4c('0x40')]){_0x49bc65[_0xdc4c('0x41')]=[{'all':!![]}];}_0x49bc65=_['merge']({},_0x49bc65,_0x3e8fc4[_0xdc4c('0x3e')]);return db[_0xdc4c('0x3f')]['find'](_0x49bc65)[_0xdc4c('0x22')](handleEntityNotFound(_0x52daad,null))[_0xdc4c('0x22')](respondWithResult(_0x52daad,null))['catch'](handleError(_0x52daad,null));};exports['create']=function(_0x1909b4,_0x5aaa71){return db['OpenchannelQueueReport'][_0xdc4c('0x45')](_0x1909b4[_0xdc4c('0x46')],{})[_0xdc4c('0x22')](respondWithResult(_0x5aaa71,0xc9))[_0xdc4c('0x47')](handleError(_0x5aaa71,null));};exports[_0xdc4c('0x21')]=function(_0x10cf23,_0x222f56){if(_0x10cf23[_0xdc4c('0x46')]['id']){delete _0x10cf23[_0xdc4c('0x46')]['id'];}return db[_0xdc4c('0x3f')][_0xdc4c('0x48')]({'where':{'id':_0x10cf23['params']['id']}})[_0xdc4c('0x22')](handleEntityNotFound(_0x222f56,null))[_0xdc4c('0x22')](saveUpdates(_0x10cf23[_0xdc4c('0x46')],null))[_0xdc4c('0x22')](respondWithResult(_0x222f56,null))[_0xdc4c('0x47')](handleError(_0x222f56,null));};exports[_0xdc4c('0x49')]=function(_0xa68bd,_0x59fa50){return db[_0xdc4c('0x3f')]['find']({'where':{'id':_0xa68bd[_0xdc4c('0x44')]['id']}})['then'](handleEntityNotFound(_0x59fa50,null))['then'](removeEntity(_0x59fa50,null))[_0xdc4c('0x47')](handleError(_0x59fa50,null));};exports[_0xdc4c('0x4a')]=function(_0x29f360,_0x3a445b){return db['OpenchannelQueueReport']['describe']()[_0xdc4c('0x22')](respondWithResult(_0x3a445b,null))[_0xdc4c('0x47')](handleError(_0x3a445b,null));}; \ No newline at end of file +var _0x51a8=['attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','OpenchannelQueueReport','fieldName','type','model','map','query','keys','filters','intersection'];(function(_0x4b44bc,_0x4fdec4){var _0x40a6ff=function(_0x55def3){while(--_0x55def3){_0x4b44bc['push'](_0x4b44bc['shift']());}};_0x40a6ff(++_0x4fdec4);}(_0x51a8,0xe7));var _0x851a=function(_0xe72a61,_0xcf5a94){_0xe72a61=_0xe72a61-0x0;var _0x2e0071=_0x51a8[_0xe72a61];return _0x2e0071;};'use strict';var emlformat=require(_0x851a('0x0'));var rimraf=require(_0x851a('0x1'));var zipdir=require(_0x851a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x851a('0x3'));var moment=require(_0x851a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x851a('0x5'));var path=require('path');var sox=require(_0x851a('0x6'));var csv=require(_0x851a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x851a('0x8'));var squel=require(_0x851a('0x9'));var crypto=require(_0x851a('0xa'));var jsforce=require(_0x851a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x851a('0xc'));var Papa=require(_0x851a('0xd'));var Redis=require(_0x851a('0xe'));var authService=require(_0x851a('0xf'));var qs=require(_0x851a('0x10'));var as=require(_0x851a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x851a('0x12'))(_0x851a('0x13'));var utils=require(_0x851a('0x14'));var config=require(_0x851a('0x15'));var licenseUtil=require(_0x851a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527938,_0x266dd2){_0x266dd2=_0x266dd2||0xcc;return function(_0x210f2b){if(_0x210f2b){return _0x527938['sendStatus'](_0x266dd2);}return _0x527938['status'](_0x266dd2)[_0x851a('0x17')]();};}function respondWithResult(_0x385848,_0x3852ed){_0x3852ed=_0x3852ed||0xc8;return function(_0x5b013a){if(_0x5b013a){return _0x385848[_0x851a('0x18')](_0x3852ed)[_0x851a('0x19')](_0x5b013a);}};}function respondWithFilteredResult(_0x562f83,_0x411d53){return function(_0x33b5e1){if(_0x33b5e1){var _0xa6efc3=typeof _0x411d53[_0x851a('0x1a')]===_0x851a('0x1b')&&typeof _0x411d53[_0x851a('0x1c')]===_0x851a('0x1b');var _0x5dd893=_0x33b5e1[_0x851a('0x1d')];var _0x52ca11=_0xa6efc3?0x0:_0x411d53[_0x851a('0x1a')];var _0x3e7727=_0xa6efc3?_0x33b5e1[_0x851a('0x1d')]:_0x411d53[_0x851a('0x1a')]+_0x411d53[_0x851a('0x1c')];var _0x31a5b9;if(_0x3e7727>=_0x5dd893){_0x3e7727=_0x5dd893;_0x31a5b9=0xc8;}else{_0x31a5b9=0xce;}_0x562f83['status'](_0x31a5b9);return _0x562f83[_0x851a('0x1e')](_0x851a('0x1f'),_0x52ca11+'-'+_0x3e7727+'/'+_0x5dd893)[_0x851a('0x19')](_0x33b5e1);}return null;};}function patchUpdates(_0x559ed1){return function(_0x59b78b){try{jsonpatch['apply'](_0x59b78b,_0x559ed1,!![]);}catch(_0x912863){return BPromise[_0x851a('0x20')](_0x912863);}return _0x59b78b['save']();};}function saveUpdates(_0x230db9,_0x4f6863){return function(_0x4f82e1){if(_0x4f82e1){return _0x4f82e1['update'](_0x230db9)[_0x851a('0x21')](function(_0x45f5e9){return _0x45f5e9;});}return null;};}function removeEntity(_0x843cad,_0x2a96b0){return function(_0x3c770a){if(_0x3c770a){return _0x3c770a[_0x851a('0x22')]()[_0x851a('0x21')](function(){_0x843cad[_0x851a('0x18')](0xcc)[_0x851a('0x17')]();});}};}function handleEntityNotFound(_0x154e87,_0x4e406d){return function(_0x13bb10){if(!_0x13bb10){_0x154e87[_0x851a('0x23')](0x194);}return _0x13bb10;};}function handleError(_0x46836d,_0xa89125){_0xa89125=_0xa89125||0x1f4;return function(_0x4a6489){logger[_0x851a('0x24')](_0x4a6489[_0x851a('0x25')]);if(_0x4a6489[_0x851a('0x26')]){delete _0x4a6489[_0x851a('0x26')];}_0x46836d[_0x851a('0x18')](_0xa89125)[_0x851a('0x27')](_0x4a6489);};}exports['index']=function(_0x1125d4,_0x5bf2dd){var _0x26da7a={},_0x3c3eab={},_0x4e1c37={'count':0x0,'rows':[]};var _0x51629c=_['map'](db[_0x851a('0x28')]['rawAttributes'],function(_0x41507a){return{'name':_0x41507a[_0x851a('0x29')],'type':_0x41507a[_0x851a('0x2a')]['key']};});_0x3c3eab[_0x851a('0x2b')]=_[_0x851a('0x2c')](_0x51629c,_0x851a('0x26'));_0x3c3eab[_0x851a('0x2d')]=_[_0x851a('0x2e')](_0x1125d4[_0x851a('0x2d')]);_0x3c3eab[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x3c3eab[_0x851a('0x2b')],_0x3c3eab['query']);_0x26da7a['attributes']=_[_0x851a('0x30')](_0x3c3eab[_0x851a('0x2b')],qs['fields'](_0x1125d4[_0x851a('0x2d')]['fields']));_0x26da7a['attributes']=_0x26da7a[_0x851a('0x31')][_0x851a('0x32')]?_0x26da7a[_0x851a('0x31')]:_0x3c3eab[_0x851a('0x2b')];if(!_0x1125d4[_0x851a('0x2d')]['hasOwnProperty']('nolimit')){_0x26da7a[_0x851a('0x1c')]=qs[_0x851a('0x1c')](_0x1125d4[_0x851a('0x2d')][_0x851a('0x1c')]);_0x26da7a[_0x851a('0x1a')]=qs[_0x851a('0x1a')](_0x1125d4[_0x851a('0x2d')]['offset']);}_0x26da7a[_0x851a('0x33')]=qs[_0x851a('0x34')](_0x1125d4[_0x851a('0x2d')][_0x851a('0x34')]);_0x26da7a[_0x851a('0x35')]=qs[_0x851a('0x2f')](_[_0x851a('0x36')](_0x1125d4[_0x851a('0x2d')],_0x3c3eab[_0x851a('0x2f')]),_0x51629c);if(_0x1125d4[_0x851a('0x2d')][_0x851a('0x37')]){_0x26da7a['where']=_['merge'](_0x26da7a['where'],{'$or':_['map'](_0x51629c,function(_0x333e5b){if(_0x333e5b[_0x851a('0x2a')]!==_0x851a('0x38')){var _0x4a1a57={};_0x4a1a57[_0x333e5b[_0x851a('0x26')]]={'$like':'%'+_0x1125d4[_0x851a('0x2d')]['filter']+'%'};return _0x4a1a57;}})});}_0x26da7a=_[_0x851a('0x39')]({},_0x26da7a,_0x1125d4[_0x851a('0x3a')]);var _0x466e33={'where':_0x26da7a[_0x851a('0x35')]};return db[_0x851a('0x28')][_0x851a('0x1d')](_0x466e33)[_0x851a('0x21')](function(_0x53a5e7){_0x4e1c37[_0x851a('0x1d')]=_0x53a5e7;if(_0x1125d4[_0x851a('0x2d')][_0x851a('0x3b')]){_0x26da7a[_0x851a('0x3c')]=[{'all':!![]}];}return db[_0x851a('0x28')]['findAll'](_0x26da7a);})[_0x851a('0x21')](function(_0x5215d5){_0x4e1c37[_0x851a('0x3d')]=_0x5215d5;return _0x4e1c37;})[_0x851a('0x21')](respondWithFilteredResult(_0x5bf2dd,_0x26da7a))['catch'](handleError(_0x5bf2dd,null));};exports['show']=function(_0x5667b0,_0x1566b0){var _0x16c661={'raw':!![],'where':{'id':_0x5667b0[_0x851a('0x3e')]['id']}},_0x438ae6={};_0x438ae6[_0x851a('0x2b')]=_[_0x851a('0x2e')](db[_0x851a('0x28')][_0x851a('0x3f')]);_0x438ae6[_0x851a('0x2d')]=_['keys'](_0x5667b0[_0x851a('0x2d')]);_0x438ae6[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x438ae6[_0x851a('0x2b')],_0x438ae6['query']);_0x16c661[_0x851a('0x31')]=_[_0x851a('0x30')](_0x438ae6[_0x851a('0x2b')],qs[_0x851a('0x40')](_0x5667b0[_0x851a('0x2d')]['fields']));_0x16c661['attributes']=_0x16c661[_0x851a('0x31')][_0x851a('0x32')]?_0x16c661[_0x851a('0x31')]:_0x438ae6[_0x851a('0x2b')];if(_0x5667b0[_0x851a('0x2d')][_0x851a('0x3b')]){_0x16c661['include']=[{'all':!![]}];}_0x16c661=_[_0x851a('0x39')]({},_0x16c661,_0x5667b0[_0x851a('0x3a')]);return db[_0x851a('0x28')][_0x851a('0x41')](_0x16c661)[_0x851a('0x21')](handleEntityNotFound(_0x1566b0,null))['then'](respondWithResult(_0x1566b0,null))[_0x851a('0x42')](handleError(_0x1566b0,null));};exports[_0x851a('0x43')]=function(_0x10677a,_0x2836f6){return db[_0x851a('0x28')][_0x851a('0x43')](_0x10677a['body'],{})[_0x851a('0x21')](respondWithResult(_0x2836f6,0xc9))[_0x851a('0x42')](handleError(_0x2836f6,null));};exports['update']=function(_0x10278b,_0x4d71e9){if(_0x10278b[_0x851a('0x44')]['id']){delete _0x10278b['body']['id'];}return db[_0x851a('0x28')][_0x851a('0x41')]({'where':{'id':_0x10278b[_0x851a('0x3e')]['id']}})[_0x851a('0x21')](handleEntityNotFound(_0x4d71e9,null))[_0x851a('0x21')](saveUpdates(_0x10278b[_0x851a('0x44')],null))[_0x851a('0x21')](respondWithResult(_0x4d71e9,null))[_0x851a('0x42')](handleError(_0x4d71e9,null));};exports['destroy']=function(_0x11f92a,_0x384ec0){return db[_0x851a('0x28')][_0x851a('0x41')]({'where':{'id':_0x11f92a['params']['id']}})[_0x851a('0x21')](handleEntityNotFound(_0x384ec0,null))[_0x851a('0x21')](removeEntity(_0x384ec0,null))[_0x851a('0x42')](handleError(_0x384ec0,null));};exports[_0x851a('0x45')]=function(_0x467cd9,_0x2138f6){return db['OpenchannelQueueReport'][_0x851a('0x45')]()['then'](respondWithResult(_0x2138f6,null))[_0x851a('0x42')](handleError(_0x2138f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e006a5b..b860aee 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x55bb11,_0xf518cd){var _0x2b3f23=function(_0x156da0){while(--_0x156da0){_0x55bb11['push'](_0x55bb11['shift']());}};_0x2b3f23(++_0xf518cd);}(_0x326f,0xd1));var _0xf326=function(_0x192bcd,_0x25b46f){_0x192bcd=_0x192bcd-0x0;var _0x50172f=_0x326f[_0x192bcd];return _0x50172f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x6428c8,_0xb3f114){var _0xfdf81d=function(_0x2b1334){while(--_0x2b1334){_0x6428c8['push'](_0x6428c8['shift']());}};_0xfdf81d(++_0xb3f114);}(_0x2ef3,0xba));var _0x32ef=function(_0x7219b6,_0xc8b6a8){_0x7219b6=_0x7219b6-0x0;var _0x757b84=_0x2ef3[_0x7219b6];return _0x757b84;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ddf48d0..05f266f 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 _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash'];(function(_0x304720,_0x4cb00c){var _0x3f2bf7=function(_0x591ac4){while(--_0x591ac4){_0x304720['push'](_0x304720['shift']());}};_0x3f2bf7(++_0x4cb00c);}(_0x6cb4,0xff));var _0x46cb=function(_0x57a6c3,_0x5a6f50){_0x57a6c3=_0x57a6c3-0x0;var _0x5b2cac=_0x6cb4[_0x57a6c3];return _0x5b2cac;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateOpenchannelQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0x5a13=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x35669b,_0x432dec){var _0x42ea84=function(_0x100e77){while(--_0x100e77){_0x35669b['push'](_0x35669b['shift']());}};_0x42ea84(++_0x432dec);}(_0x5a13,0x145));var _0x35a1=function(_0x37ec3c,_0x5e9f83){_0x37ec3c=_0x37ec3c-0x0;var _0x1873e1=_0x5a13[_0x37ec3c];return _0x1873e1;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')](_0x1de373[_0x35a1('0x1a')],{'raw':_0x1de373[_0x35a1('0x1b')]?_0x1de373[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![]})[_0x35a1('0xd')](function(_0x5929e5){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger['debug'](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x5929e5));_0x3b17dc(_0x5929e5);})['catch'](function(_0xc13bad){logger['error'](_0x35a1('0x17'),_0xc13bad[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0xc13bad['message']));});});};exports[_0x35a1('0x1d')]=function(_0x2b87a1){var _0x48f1bd=this;return new Promise(function(_0x4c41ce,_0x5303b4){return db[_0x35a1('0x18')]['update'](_0x2b87a1['body'],{'raw':_0x2b87a1['options']?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')]['where']||null:null,'attributes':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1e')]||null:null,'limit':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1f')]||null:null})[_0x35a1('0xd')](function(_0x24bb2d){logger[_0x35a1('0x14')](_0x35a1('0x1d'),_0x2b87a1);logger[_0x35a1('0x20')](_0x35a1('0x1d'),_0x2b87a1,JSON[_0x35a1('0x10')](_0x24bb2d));_0x4c41ce(_0x24bb2d);})[_0x35a1('0x16')](function(_0x2ae0ca){logger['error'](_0x35a1('0x1d'),_0x2ae0ca[_0x35a1('0x12')],_0x2b87a1);_0x5303b4(_0x48f1bd[_0x35a1('0x13')](0x1f4,_0x2ae0ca[_0x35a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 752bbe6..9f39c29 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 _0x48d2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','path'];(function(_0x25762c,_0x1ddd82){var _0x1f3ab8=function(_0x4ba689){while(--_0x4ba689){_0x25762c['push'](_0x25762c['shift']());}};_0x1f3ab8(++_0x1ddd82);}(_0x48d2,0x175));var _0x248d=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x48d2[_0x4bd950];return _0x5dc59a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x248d('0x0'));var timeout=require(_0x248d('0x1'));var express=require('express');var router=express[_0x248d('0x2')]();var fs_extra=require(_0x248d('0x3'));var auth=require(_0x248d('0x4'));var interaction=require(_0x248d('0x5'));var config=require(_0x248d('0x6'));var controller=require(_0x248d('0x7'));router[_0x248d('0x8')]('/',auth[_0x248d('0x9')](),controller[_0x248d('0xa')]);router['get'](_0x248d('0xb'),auth['isAuthenticated'](),controller[_0x248d('0xc')]);router[_0x248d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x248d('0xd')]);router[_0x248d('0xe')]('/',auth[_0x248d('0x9')](),controller[_0x248d('0xf')]);router[_0x248d('0x10')](_0x248d('0x11'),auth['isAuthenticated'](),controller[_0x248d('0x12')]);router[_0x248d('0x13')](_0x248d('0x11'),auth[_0x248d('0x9')](),controller[_0x248d('0x14')]);module[_0x248d('0x15')]=router; \ No newline at end of file +var _0xe675=['/describe','describe','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x350079,_0x510691){var _0x220852=function(_0x4e7d34){while(--_0x4e7d34){_0x350079['push'](_0x350079['shift']());}};_0x220852(++_0x510691);}(_0xe675,0x171));var _0x5e67=function(_0x328641,_0x2687e3){_0x328641=_0x328641-0x0;var _0x25e4f0=_0xe675[_0x328641];return _0x25e4f0;};'use strict';var multer=require(_0x5e67('0x0'));var util=require(_0x5e67('0x1'));var path=require(_0x5e67('0x2'));var timeout=require(_0x5e67('0x3'));var express=require('express');var router=express[_0x5e67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5e67('0x5'));var interaction=require(_0x5e67('0x6'));var config=require('../../config/environment');var controller=require(_0x5e67('0x7'));router[_0x5e67('0x8')]('/',auth[_0x5e67('0x9')](),controller[_0x5e67('0xa')]);router[_0x5e67('0x8')](_0x5e67('0xb'),auth[_0x5e67('0x9')](),controller[_0x5e67('0xc')]);router[_0x5e67('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5e67('0xd')]('/',auth[_0x5e67('0x9')](),controller['create']);router[_0x5e67('0xe')](_0x5e67('0xf'),auth[_0x5e67('0x9')](),controller[_0x5e67('0x10')]);router[_0x5e67('0x11')](_0x5e67('0xf'),auth['isAuthenticated'](),controller[_0x5e67('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c6c34e7..7798aeb 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x381d94,_0x37ec57){var _0x2b2a3b=function(_0x577d22){while(--_0x577d22){_0x381d94['push'](_0x381d94['shift']());}};_0x2b2a3b(++_0x37ec57);}(_0xe706,0xa3));var _0x6e70=function(_0x255cca,_0x121536){_0x255cca=_0x255cca-0x0;var _0x16d8de=_0xe706[_0x255cca];return _0x16d8de;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xa087f5,_0x34fd10){var _0x4c8806=function(_0x4b1cfe){while(--_0x4b1cfe){_0xa087f5['push'](_0xa087f5['shift']());}};_0x4c8806(++_0x34fd10);}(_0x008c,0x188));var _0xc008=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x008c[_0x138adb];return _0x1b27f2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0b3d663..f451f48 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 _0x4331=['rows','show','params','keys','includeAll','include','create','catch','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','OpenchannelTransferReport','findAll'];(function(_0x5219b8,_0x2ce9ed){var _0x1be94b=function(_0x25c222){while(--_0x25c222){_0x5219b8['push'](_0x5219b8['shift']());}};_0x1be94b(++_0x2ce9ed);}(_0x4331,0xa7));var _0x1433=function(_0x32d79f,_0x62176d){_0x32d79f=_0x32d79f-0x0;var _0x199b7a=_0x4331[_0x32d79f];return _0x199b7a;};'use strict';var emlformat=require(_0x1433('0x0'));var rimraf=require(_0x1433('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1433('0x2'));var rp=require(_0x1433('0x3'));var moment=require(_0x1433('0x4'));var BPromise=require(_0x1433('0x5'));var Mustache=require('mustache');var util=require(_0x1433('0x6'));var path=require(_0x1433('0x7'));var sox=require(_0x1433('0x8'));var csv=require(_0x1433('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1433('0xa'));var crypto=require(_0x1433('0xb'));var jsforce=require(_0x1433('0xc'));var deskjs=require(_0x1433('0xd'));var toCsv=require(_0x1433('0x9'));var querystring=require(_0x1433('0xe'));var Papa=require(_0x1433('0xf'));var Redis=require(_0x1433('0x10'));var authService=require(_0x1433('0x11'));var qs=require(_0x1433('0x12'));var as=require(_0x1433('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1433('0x14'))(_0x1433('0x15'));var utils=require(_0x1433('0x16'));var config=require(_0x1433('0x17'));var licenseUtil=require(_0x1433('0x18'));var db=require(_0x1433('0x19'))['db'];function respondWithStatusCode(_0x48c2c7,_0x743a3){_0x743a3=_0x743a3||0xcc;return function(_0x3a5123){if(_0x3a5123){return _0x48c2c7[_0x1433('0x1a')](_0x743a3);}return _0x48c2c7[_0x1433('0x1b')](_0x743a3)[_0x1433('0x1c')]();};}function respondWithResult(_0x13331e,_0x28d315){_0x28d315=_0x28d315||0xc8;return function(_0x228e08){if(_0x228e08){return _0x13331e['status'](_0x28d315)['json'](_0x228e08);}};}function respondWithFilteredResult(_0x3ef76d,_0x10f89c){return function(_0x3cf0cb){if(_0x3cf0cb){var _0x5d2d65=typeof _0x10f89c[_0x1433('0x1d')]===_0x1433('0x1e')&&typeof _0x10f89c[_0x1433('0x1f')]===_0x1433('0x1e');var _0x54f1f6=_0x3cf0cb[_0x1433('0x20')];var _0x226b68=_0x5d2d65?0x0:_0x10f89c[_0x1433('0x1d')];var _0x3e2264=_0x5d2d65?_0x3cf0cb['count']:_0x10f89c[_0x1433('0x1d')]+_0x10f89c['limit'];var _0x2ef1e0;if(_0x3e2264>=_0x54f1f6){_0x3e2264=_0x54f1f6;_0x2ef1e0=0xc8;}else{_0x2ef1e0=0xce;}_0x3ef76d['status'](_0x2ef1e0);return _0x3ef76d[_0x1433('0x21')](_0x1433('0x22'),_0x226b68+'-'+_0x3e2264+'/'+_0x54f1f6)[_0x1433('0x23')](_0x3cf0cb);}return null;};}function patchUpdates(_0x94f94d){return function(_0x3dd15b){try{jsonpatch[_0x1433('0x24')](_0x3dd15b,_0x94f94d,!![]);}catch(_0x40d4f9){return BPromise[_0x1433('0x25')](_0x40d4f9);}return _0x3dd15b[_0x1433('0x26')]();};}function saveUpdates(_0x390d04,_0x2735e5){return function(_0x42ee23){if(_0x42ee23){return _0x42ee23[_0x1433('0x27')](_0x390d04)[_0x1433('0x28')](function(_0x20e20b){return _0x20e20b;});}return null;};}function removeEntity(_0x55f6ca,_0x1133d5){return function(_0x5079d7){if(_0x5079d7){return _0x5079d7['destroy']()['then'](function(){_0x55f6ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25d2af,_0x3a9548){return function(_0x44b73f){if(!_0x44b73f){_0x25d2af[_0x1433('0x1a')](0x194);}return _0x44b73f;};}function handleError(_0x1c1a19,_0x21dfd5){_0x21dfd5=_0x21dfd5||0x1f4;return function(_0x1b6420){logger[_0x1433('0x29')](_0x1b6420[_0x1433('0x2a')]);if(_0x1b6420[_0x1433('0x2b')]){delete _0x1b6420[_0x1433('0x2b')];}_0x1c1a19[_0x1433('0x1b')](_0x21dfd5)['send'](_0x1b6420);};}exports[_0x1433('0x2c')]=function(_0x58c2e8,_0xa15712){var _0x17ece4={},_0xed9b50={},_0x506f0a={'count':0x0,'rows':[]};var _0x197576=_[_0x1433('0x2d')](db['OpenchannelTransferReport'][_0x1433('0x2e')],function(_0x3614c8){return{'name':_0x3614c8['fieldName'],'type':_0x3614c8[_0x1433('0x2f')][_0x1433('0x30')]};});_0xed9b50[_0x1433('0x31')]=_[_0x1433('0x2d')](_0x197576,_0x1433('0x2b'));_0xed9b50['query']=_['keys'](_0x58c2e8[_0x1433('0x32')]);_0xed9b50[_0x1433('0x33')]=_[_0x1433('0x34')](_0xed9b50[_0x1433('0x31')],_0xed9b50[_0x1433('0x32')]);_0x17ece4[_0x1433('0x35')]=_[_0x1433('0x34')](_0xed9b50[_0x1433('0x31')],qs[_0x1433('0x36')](_0x58c2e8[_0x1433('0x32')][_0x1433('0x36')]));_0x17ece4['attributes']=_0x17ece4['attributes'][_0x1433('0x37')]?_0x17ece4[_0x1433('0x35')]:_0xed9b50['model'];if(!_0x58c2e8[_0x1433('0x32')]['hasOwnProperty'](_0x1433('0x38'))){_0x17ece4[_0x1433('0x1f')]=qs[_0x1433('0x1f')](_0x58c2e8[_0x1433('0x32')][_0x1433('0x1f')]);_0x17ece4[_0x1433('0x1d')]=qs[_0x1433('0x1d')](_0x58c2e8['query'][_0x1433('0x1d')]);}_0x17ece4[_0x1433('0x39')]=qs[_0x1433('0x3a')](_0x58c2e8[_0x1433('0x32')][_0x1433('0x3a')]);_0x17ece4[_0x1433('0x3b')]=qs[_0x1433('0x33')](_[_0x1433('0x3c')](_0x58c2e8['query'],_0xed9b50[_0x1433('0x33')]),_0x197576);if(_0x58c2e8['query']['filter']){_0x17ece4['where']=_['merge'](_0x17ece4['where'],{'$or':_[_0x1433('0x2d')](_0x197576,function(_0x191ee1){if(_0x191ee1['type']!==_0x1433('0x3d')){var _0x5f2e7c={};_0x5f2e7c[_0x191ee1[_0x1433('0x2b')]]={'$like':'%'+_0x58c2e8[_0x1433('0x32')][_0x1433('0x3e')]+'%'};return _0x5f2e7c;}})});}_0x17ece4=_[_0x1433('0x3f')]({},_0x17ece4,_0x58c2e8[_0x1433('0x40')]);var _0x42bdc0={'where':_0x17ece4[_0x1433('0x3b')]};return db['OpenchannelTransferReport'][_0x1433('0x20')](_0x42bdc0)[_0x1433('0x28')](function(_0x4ec01f){_0x506f0a[_0x1433('0x20')]=_0x4ec01f;if(_0x58c2e8[_0x1433('0x32')]['includeAll']){_0x17ece4['include']=[{'all':!![]}];}return db[_0x1433('0x41')][_0x1433('0x42')](_0x17ece4);})[_0x1433('0x28')](function(_0x4b5e8c){_0x506f0a[_0x1433('0x43')]=_0x4b5e8c;return _0x506f0a;})[_0x1433('0x28')](respondWithFilteredResult(_0xa15712,_0x17ece4))['catch'](handleError(_0xa15712,null));};exports[_0x1433('0x44')]=function(_0x956ec7,_0x59f217){var _0x541ef1={'raw':!![],'where':{'id':_0x956ec7[_0x1433('0x45')]['id']}},_0x41a52f={};_0x41a52f[_0x1433('0x31')]=_['keys'](db[_0x1433('0x41')][_0x1433('0x2e')]);_0x41a52f[_0x1433('0x32')]=_[_0x1433('0x46')](_0x956ec7[_0x1433('0x32')]);_0x41a52f[_0x1433('0x33')]=_[_0x1433('0x34')](_0x41a52f['model'],_0x41a52f[_0x1433('0x32')]);_0x541ef1[_0x1433('0x35')]=_[_0x1433('0x34')](_0x41a52f['model'],qs[_0x1433('0x36')](_0x956ec7[_0x1433('0x32')][_0x1433('0x36')]));_0x541ef1[_0x1433('0x35')]=_0x541ef1['attributes'][_0x1433('0x37')]?_0x541ef1['attributes']:_0x41a52f[_0x1433('0x31')];if(_0x956ec7[_0x1433('0x32')][_0x1433('0x47')]){_0x541ef1[_0x1433('0x48')]=[{'all':!![]}];}_0x541ef1=_['merge']({},_0x541ef1,_0x956ec7[_0x1433('0x40')]);return db[_0x1433('0x41')]['find'](_0x541ef1)[_0x1433('0x28')](handleEntityNotFound(_0x59f217,null))[_0x1433('0x28')](respondWithResult(_0x59f217,null))['catch'](handleError(_0x59f217,null));};exports[_0x1433('0x49')]=function(_0x1b0b30,_0x3d7211){return db['OpenchannelTransferReport']['create'](_0x1b0b30['body'],{})[_0x1433('0x28')](respondWithResult(_0x3d7211,0xc9))[_0x1433('0x4a')](handleError(_0x3d7211,null));};exports[_0x1433('0x27')]=function(_0x1a59a0,_0x326393){if(_0x1a59a0[_0x1433('0x4b')]['id']){delete _0x1a59a0[_0x1433('0x4b')]['id'];}return db[_0x1433('0x41')]['find']({'where':{'id':_0x1a59a0[_0x1433('0x45')]['id']}})[_0x1433('0x28')](handleEntityNotFound(_0x326393,null))['then'](saveUpdates(_0x1a59a0[_0x1433('0x4b')],null))[_0x1433('0x28')](respondWithResult(_0x326393,null))[_0x1433('0x4a')](handleError(_0x326393,null));};exports[_0x1433('0x4c')]=function(_0x4f81e2,_0xf39a4f){return db[_0x1433('0x41')]['find']({'where':{'id':_0x4f81e2[_0x1433('0x45')]['id']}})[_0x1433('0x28')](handleEntityNotFound(_0xf39a4f,null))[_0x1433('0x28')](removeEntity(_0xf39a4f,null))[_0x1433('0x4a')](handleError(_0xf39a4f,null));};exports[_0x1433('0x4d')]=function(_0xd816e8,_0x59d172){return db[_0x1433('0x41')]['describe']()[_0x1433('0x28')](respondWithResult(_0x59d172,null))[_0x1433('0x4a')](handleError(_0x59d172,null));}; \ No newline at end of file +var _0xc751=['undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','index','map','OpenchannelTransferReport','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json'];(function(_0x3661c8,_0x38b9fb){var _0x1585bc=function(_0xf168d7){while(--_0xf168d7){_0x3661c8['push'](_0x3661c8['shift']());}};_0x1585bc(++_0x38b9fb);}(_0xc751,0x1eb));var _0x1c75=function(_0x44a75b,_0x3b156a){_0x44a75b=_0x44a75b-0x0;var _0x424fc0=_0xc751[_0x44a75b];return _0x424fc0;};'use strict';var emlformat=require(_0x1c75('0x0'));var rimraf=require(_0x1c75('0x1'));var zipdir=require(_0x1c75('0x2'));var jsonpatch=require(_0x1c75('0x3'));var rp=require(_0x1c75('0x4'));var moment=require(_0x1c75('0x5'));var BPromise=require(_0x1c75('0x6'));var Mustache=require(_0x1c75('0x7'));var util=require('util');var path=require(_0x1c75('0x8'));var sox=require(_0x1c75('0x9'));var csv=require(_0x1c75('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c75('0xb'));var squel=require(_0x1c75('0xc'));var crypto=require(_0x1c75('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1c75('0xa'));var querystring=require(_0x1c75('0xe'));var Papa=require(_0x1c75('0xf'));var Redis=require(_0x1c75('0x10'));var authService=require(_0x1c75('0x11'));var qs=require(_0x1c75('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c75('0x13'));var logger=require(_0x1c75('0x14'))(_0x1c75('0x15'));var utils=require(_0x1c75('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ac856,_0x19b231){_0x19b231=_0x19b231||0xcc;return function(_0x30a358){if(_0x30a358){return _0x5ac856[_0x1c75('0x17')](_0x19b231);}return _0x5ac856[_0x1c75('0x18')](_0x19b231)[_0x1c75('0x19')]();};}function respondWithResult(_0x5efe06,_0x23d2c1){_0x23d2c1=_0x23d2c1||0xc8;return function(_0x36e94c){if(_0x36e94c){return _0x5efe06[_0x1c75('0x18')](_0x23d2c1)[_0x1c75('0x1a')](_0x36e94c);}};}function respondWithFilteredResult(_0x49b3fa,_0x2efbd9){return function(_0x392d78){if(_0x392d78){var _0x1a9b34=typeof _0x2efbd9['offset']===_0x1c75('0x1b')&&typeof _0x2efbd9[_0x1c75('0x1c')]===_0x1c75('0x1b');var _0x515448=_0x392d78[_0x1c75('0x1d')];var _0x41d77f=_0x1a9b34?0x0:_0x2efbd9[_0x1c75('0x1e')];var _0x41aa61=_0x1a9b34?_0x392d78['count']:_0x2efbd9[_0x1c75('0x1e')]+_0x2efbd9['limit'];var _0x26d10d;if(_0x41aa61>=_0x515448){_0x41aa61=_0x515448;_0x26d10d=0xc8;}else{_0x26d10d=0xce;}_0x49b3fa[_0x1c75('0x18')](_0x26d10d);return _0x49b3fa[_0x1c75('0x1f')]('Content-Range',_0x41d77f+'-'+_0x41aa61+'/'+_0x515448)[_0x1c75('0x1a')](_0x392d78);}return null;};}function patchUpdates(_0x151692){return function(_0x556d94){try{jsonpatch[_0x1c75('0x20')](_0x556d94,_0x151692,!![]);}catch(_0x9442f5){return BPromise[_0x1c75('0x21')](_0x9442f5);}return _0x556d94[_0x1c75('0x22')]();};}function saveUpdates(_0x4bbf38,_0x71029a){return function(_0x214ec6){if(_0x214ec6){return _0x214ec6[_0x1c75('0x23')](_0x4bbf38)[_0x1c75('0x24')](function(_0x13e7b3){return _0x13e7b3;});}return null;};}function removeEntity(_0x588926,_0xc0033e){return function(_0x28f09b){if(_0x28f09b){return _0x28f09b[_0x1c75('0x25')]()[_0x1c75('0x24')](function(){_0x588926[_0x1c75('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d271a,_0x16f9a1){return function(_0x2151fb){if(!_0x2151fb){_0x4d271a[_0x1c75('0x17')](0x194);}return _0x2151fb;};}function handleError(_0x5511ad,_0xceeeff){_0xceeeff=_0xceeeff||0x1f4;return function(_0x131911){logger[_0x1c75('0x26')](_0x131911[_0x1c75('0x27')]);if(_0x131911['name']){delete _0x131911['name'];}_0x5511ad['status'](_0xceeeff)['send'](_0x131911);};}exports[_0x1c75('0x28')]=function(_0x5c0ce5,_0x320c88){var _0x3f2084={},_0x49d756={},_0x44d272={'count':0x0,'rows':[]};var _0x2b517c=_[_0x1c75('0x29')](db[_0x1c75('0x2a')]['rawAttributes'],function(_0x24e026){return{'name':_0x24e026['fieldName'],'type':_0x24e026[_0x1c75('0x2b')][_0x1c75('0x2c')]};});_0x49d756[_0x1c75('0x2d')]=_[_0x1c75('0x29')](_0x2b517c,_0x1c75('0x2e'));_0x49d756[_0x1c75('0x2f')]=_[_0x1c75('0x30')](_0x5c0ce5[_0x1c75('0x2f')]);_0x49d756[_0x1c75('0x31')]=_[_0x1c75('0x32')](_0x49d756[_0x1c75('0x2d')],_0x49d756[_0x1c75('0x2f')]);_0x3f2084['attributes']=_['intersection'](_0x49d756[_0x1c75('0x2d')],qs[_0x1c75('0x33')](_0x5c0ce5['query'][_0x1c75('0x33')]));_0x3f2084['attributes']=_0x3f2084[_0x1c75('0x34')]['length']?_0x3f2084[_0x1c75('0x34')]:_0x49d756[_0x1c75('0x2d')];if(!_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x35')](_0x1c75('0x36'))){_0x3f2084[_0x1c75('0x1c')]=qs['limit'](_0x5c0ce5['query']['limit']);_0x3f2084[_0x1c75('0x1e')]=qs[_0x1c75('0x1e')](_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x1e')]);}_0x3f2084[_0x1c75('0x37')]=qs['sort'](_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x38')]);_0x3f2084['where']=qs[_0x1c75('0x31')](_['pick'](_0x5c0ce5[_0x1c75('0x2f')],_0x49d756[_0x1c75('0x31')]),_0x2b517c);if(_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x39')]){_0x3f2084[_0x1c75('0x3a')]=_['merge'](_0x3f2084[_0x1c75('0x3a')],{'$or':_[_0x1c75('0x29')](_0x2b517c,function(_0x554422){if(_0x554422[_0x1c75('0x2b')]!==_0x1c75('0x3b')){var _0x3ec0cf={};_0x3ec0cf[_0x554422['name']]={'$like':'%'+_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x39')]+'%'};return _0x3ec0cf;}})});}_0x3f2084=_['merge']({},_0x3f2084,_0x5c0ce5[_0x1c75('0x3c')]);var _0x3917c5={'where':_0x3f2084[_0x1c75('0x3a')]};return db[_0x1c75('0x2a')][_0x1c75('0x1d')](_0x3917c5)[_0x1c75('0x24')](function(_0x253a9f){_0x44d272['count']=_0x253a9f;if(_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x3d')]){_0x3f2084[_0x1c75('0x3e')]=[{'all':!![]}];}return db[_0x1c75('0x2a')][_0x1c75('0x3f')](_0x3f2084);})[_0x1c75('0x24')](function(_0x571004){_0x44d272['rows']=_0x571004;return _0x44d272;})[_0x1c75('0x24')](respondWithFilteredResult(_0x320c88,_0x3f2084))['catch'](handleError(_0x320c88,null));};exports[_0x1c75('0x40')]=function(_0x417107,_0x57261b){var _0x34b822={'raw':!![],'where':{'id':_0x417107[_0x1c75('0x41')]['id']}},_0x44c01c={};_0x44c01c['model']=_[_0x1c75('0x30')](db[_0x1c75('0x2a')][_0x1c75('0x42')]);_0x44c01c[_0x1c75('0x2f')]=_[_0x1c75('0x30')](_0x417107[_0x1c75('0x2f')]);_0x44c01c[_0x1c75('0x31')]=_[_0x1c75('0x32')](_0x44c01c[_0x1c75('0x2d')],_0x44c01c[_0x1c75('0x2f')]);_0x34b822[_0x1c75('0x34')]=_['intersection'](_0x44c01c[_0x1c75('0x2d')],qs[_0x1c75('0x33')](_0x417107[_0x1c75('0x2f')]['fields']));_0x34b822['attributes']=_0x34b822[_0x1c75('0x34')][_0x1c75('0x43')]?_0x34b822[_0x1c75('0x34')]:_0x44c01c[_0x1c75('0x2d')];if(_0x417107['query'][_0x1c75('0x3d')]){_0x34b822[_0x1c75('0x3e')]=[{'all':!![]}];}_0x34b822=_[_0x1c75('0x44')]({},_0x34b822,_0x417107[_0x1c75('0x3c')]);return db[_0x1c75('0x2a')][_0x1c75('0x45')](_0x34b822)['then'](handleEntityNotFound(_0x57261b,null))[_0x1c75('0x24')](respondWithResult(_0x57261b,null))[_0x1c75('0x46')](handleError(_0x57261b,null));};exports[_0x1c75('0x47')]=function(_0xc5adf,_0x1da901){return db[_0x1c75('0x2a')][_0x1c75('0x47')](_0xc5adf['body'],{})[_0x1c75('0x24')](respondWithResult(_0x1da901,0xc9))[_0x1c75('0x46')](handleError(_0x1da901,null));};exports[_0x1c75('0x23')]=function(_0x2f2a1d,_0x4fcaa6){if(_0x2f2a1d[_0x1c75('0x48')]['id']){delete _0x2f2a1d[_0x1c75('0x48')]['id'];}return db[_0x1c75('0x2a')][_0x1c75('0x45')]({'where':{'id':_0x2f2a1d[_0x1c75('0x41')]['id']}})[_0x1c75('0x24')](handleEntityNotFound(_0x4fcaa6,null))[_0x1c75('0x24')](saveUpdates(_0x2f2a1d[_0x1c75('0x48')],null))[_0x1c75('0x24')](respondWithResult(_0x4fcaa6,null))[_0x1c75('0x46')](handleError(_0x4fcaa6,null));};exports[_0x1c75('0x25')]=function(_0x45bfa6,_0x446992){return db[_0x1c75('0x2a')][_0x1c75('0x45')]({'where':{'id':_0x45bfa6[_0x1c75('0x41')]['id']}})['then'](handleEntityNotFound(_0x446992,null))['then'](removeEntity(_0x446992,null))['catch'](handleError(_0x446992,null));};exports['describe']=function(_0x5810a8,_0x6fef6e){return db[_0x1c75('0x2a')][_0x1c75('0x49')]()[_0x1c75('0x24')](respondWithResult(_0x6fef6e,null))[_0x1c75('0x46')](handleError(_0x6fef6e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4cdd3da..a453b6d 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 _0xfa54=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4b6aa9,_0x10d491){var _0x321bf9=function(_0xbddd1a){while(--_0xbddd1a){_0x4b6aa9['push'](_0x4b6aa9['shift']());}};_0x321bf9(++_0x10d491);}(_0xfa54,0x1e9));var _0x4fa5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfa54[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4fa5('0x0'));var util=require(_0x4fa5('0x1'));var logger=require(_0x4fa5('0x2'))(_0x4fa5('0x3'));var moment=require(_0x4fa5('0x4'));var BPromise=require(_0x4fa5('0x5'));var rp=require(_0x4fa5('0x6'));var fs=require('fs');var path=require(_0x4fa5('0x7'));var rimraf=require(_0x4fa5('0x8'));var config=require('../../config/environment');var attributes=require(_0x4fa5('0x9'));module[_0x4fa5('0xa')]=function(_0x5aa0c0,_0x428ca3){return _0x5aa0c0[_0x4fa5('0xb')](_0x4fa5('0xc'),attributes,{'tableName':_0x4fa5('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4fa5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x929b=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x1b675d,_0x330201){var _0x4d706e=function(_0x49ad87){while(--_0x49ad87){_0x1b675d['push'](_0x1b675d['shift']());}};_0x4d706e(++_0x330201);}(_0x929b,0x6d));var _0xb929=function(_0x31ade7,_0x4a2dab){_0x31ade7=_0x31ade7-0x0;var _0x1b20ad=_0x929b[_0x31ade7];return _0x1b20ad;};'use strict';var _=require(_0xb929('0x0'));var util=require(_0xb929('0x1'));var logger=require('../../config/logger')(_0xb929('0x2'));var moment=require(_0xb929('0x3'));var BPromise=require(_0xb929('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb929('0x5'));var rimraf=require(_0xb929('0x6'));var config=require(_0xb929('0x7'));var attributes=require(_0xb929('0x8'));module[_0xb929('0x9')]=function(_0x35f297,_0x3c0e0f){return _0x35f297[_0xb929('0xa')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb929('0xb'),'fields':[_0xb929('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ce334f5..ada3b3f 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 _0x47c7=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x46c4ee,_0x5195a0){var _0x388fe6=function(_0x38d928){while(--_0x38d928){_0x46c4ee['push'](_0x46c4ee['shift']());}};_0x388fe6(++_0x5195a0);}(_0x47c7,0x1ab));var _0x747c=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x47c7[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x747c('0x0'));var util=require('util');var moment=require(_0x747c('0x1'));var BPromise=require(_0x747c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x747c('0x3'));var db=require(_0x747c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x747c('0x5'))(_0x747c('0x6'));var config=require(_0x747c('0x7'));var jayson=require(_0x747c('0x8'));var client=jayson['client'][_0x747c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eb6bc,_0xfc4504,_0x24206f){return new BPromise(function(_0x10b9f0,_0x21e0f1){return client[_0x747c('0xa')](_0x4eb6bc,_0x24206f)['then'](function(_0x47eac8){logger[_0x747c('0xb')](_0x747c('0xc'),_0xfc4504,_0x747c('0xd'));logger['debug'](_0x747c('0xe'),_0xfc4504,_0x747c('0xd'),JSON[_0x747c('0xf')](_0x47eac8));if(_0x47eac8['error']){if(_0x47eac8[_0x747c('0x10')]['code']===0x1f4){logger['error'](_0x747c('0xc'),_0xfc4504,_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);return _0x21e0f1(_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);}logger[_0x747c('0x10')](_0x747c('0xc'),_0xfc4504,_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);return _0x10b9f0(_0x47eac8[_0x747c('0x10')]['message']);}else{logger['info'](_0x747c('0xc'),_0xfc4504,_0x747c('0xd'));_0x10b9f0(_0x47eac8[_0x747c('0x12')]['message']);}})[_0x747c('0x13')](function(_0x1887d6){logger[_0x747c('0x10')](_0x747c('0xc'),_0xfc4504,_0x1887d6);_0x21e0f1(_0x1887d6);});});} \ No newline at end of file +var _0x5183=['../../config/utils','../../config/logger','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x5183,0x13e));var _0x3518=function(_0x58f30a,_0x2885ee){_0x58f30a=_0x58f30a-0x0;var _0x46225d=_0x5183[_0x58f30a];return _0x46225d;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var moment=require(_0x3518('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3518('0x3'));var db=require(_0x3518('0x4'))['db'];var utils=require(_0x3518('0x5'));var logger=require(_0x3518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3518('0x7'));var client=jayson[_0x3518('0x8')][_0x3518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482b2d,_0x5cd139,_0x488c52){return new BPromise(function(_0x147b59,_0x33e66c){return client[_0x3518('0xa')](_0x482b2d,_0x488c52)['then'](function(_0x12530b){logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));logger[_0x3518('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5cd139,_0x3518('0xc'),JSON[_0x3518('0xe')](_0x12530b));if(_0x12530b['error']){if(_0x12530b[_0x3518('0xf')][_0x3518('0x10')]===0x1f4){logger[_0x3518('0xf')](_0x3518('0xb'),_0x5cd139,_0x12530b['error']['message']);return _0x33e66c(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}logger[_0x3518('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5cd139,_0x12530b['error'][_0x3518('0x11')]);return _0x147b59(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}else{logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));_0x147b59(_0x12530b[_0x3518('0x12')][_0x3518('0x11')]);}})['catch'](function(_0xc7f658){logger['error'](_0x3518('0xb'),_0x5cd139,_0xc7f658);_0x33e66c(_0xc7f658);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 94932ad..635086e 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 _0xe7d0=['get','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x5bdb2f,_0x1044b0){var _0x1097d2=function(_0x2bcece){while(--_0x2bcece){_0x5bdb2f['push'](_0x5bdb2f['shift']());}};_0x1097d2(++_0x1044b0);}(_0xe7d0,0x78));var _0x0e7d=function(_0x25ea78,_0x104b88){_0x25ea78=_0x25ea78-0x0;var _0x1c23a3=_0xe7d0[_0x25ea78];return _0x1c23a3;};'use strict';var multer=require(_0x0e7d('0x0'));var util=require(_0x0e7d('0x1'));var path=require('path');var timeout=require(_0x0e7d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e7d('0x3'));var auth=require(_0x0e7d('0x4'));var interaction=require(_0x0e7d('0x5'));var config=require(_0x0e7d('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0x0e7d('0x7')](),controller['index']);router[_0x0e7d('0x8')](_0x0e7d('0x9'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xa')]);router[_0x0e7d('0xb')]('/',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xc')]);router[_0x0e7d('0xd')]('/:id',auth[_0x0e7d('0x7')](),controller['update']);router[_0x0e7d('0xe')](_0x0e7d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0e7d('0xf')]=router; \ No newline at end of file +var _0x76cc=['put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','show','post','create'];(function(_0x21b283,_0x46d64a){var _0x14631a=function(_0x4d2432){while(--_0x4d2432){_0x21b283['push'](_0x21b283['shift']());}};_0x14631a(++_0x46d64a);}(_0x76cc,0x117));var _0xc76c=function(_0x50dac3,_0x1cc598){_0x50dac3=_0x50dac3-0x0;var _0x404596=_0x76cc[_0x50dac3];return _0x404596;};'use strict';var multer=require(_0xc76c('0x0'));var util=require(_0xc76c('0x1'));var path=require('path');var timeout=require(_0xc76c('0x2'));var express=require(_0xc76c('0x3'));var router=express[_0xc76c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc76c('0x5'));var interaction=require(_0xc76c('0x6'));var config=require(_0xc76c('0x7'));var controller=require(_0xc76c('0x8'));router['get']('/',auth[_0xc76c('0x9')](),controller[_0xc76c('0xa')]);router[_0xc76c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc76c('0xc')]);router[_0xc76c('0xd')]('/',auth[_0xc76c('0x9')](),controller[_0xc76c('0xe')]);router[_0xc76c('0xf')]('/:id',auth[_0xc76c('0x9')](),controller[_0xc76c('0x10')]);router[_0xc76c('0x11')](_0xc76c('0x12'),auth[_0xc76c('0x9')](),controller[_0xc76c('0x13')]);module[_0xc76c('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index af1bf1b..09be750 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 _0x26e6=['STRING','sequelize','exports'];(function(_0x1c3d60,_0x585c4a){var _0x29fe72=function(_0x17b9af){while(--_0x17b9af){_0x1c3d60['push'](_0x1c3d60['shift']());}};_0x29fe72(++_0x585c4a);}(_0x26e6,0x19f));var _0x626e=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x26e6[_0x72895a];return _0x5226d5;};'use strict';var Sequelize=require(_0x626e('0x0'));module[_0x626e('0x1')]={'name':{'type':Sequelize[_0x626e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x626e('0x2')]}}; \ No newline at end of file +var _0xd2b3=['name','sequelize','exports'];(function(_0x4019ba,_0x8ae1c1){var _0x1ac2d2=function(_0x5b8f11){while(--_0x5b8f11){_0x4019ba['push'](_0x4019ba['shift']());}};_0x1ac2d2(++_0x8ae1c1);}(_0xd2b3,0x85));var _0x3d2b=function(_0x10cbe6,_0x4ff42e){_0x10cbe6=_0x10cbe6-0x0;var _0x597166=_0xd2b3[_0x10cbe6];return _0x597166;};'use strict';var Sequelize=require(_0x3d2b('0x0'));module[_0x3d2b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3d2b('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 2462d16..ce99117 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 _0xbe24=['query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','Pause','findAll','show','params','find','create','body','user','role','UserProfileSection','userProfileId','catch','error','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','name','index','map','rawAttributes','fieldName','model','keys'];(function(_0x414d64,_0x555a2c){var _0x51ca1b=function(_0x17f189){while(--_0x17f189){_0x414d64['push'](_0x414d64['shift']());}};_0x51ca1b(++_0x555a2c);}(_0xbe24,0xba));var _0x4be2=function(_0x317caa,_0x4b6991){_0x317caa=_0x317caa-0x0;var _0x15ecda=_0xbe24[_0x317caa];return _0x15ecda;};'use strict';var emlformat=require(_0x4be2('0x0'));var rimraf=require(_0x4be2('0x1'));var zipdir=require(_0x4be2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4be2('0x3'));var BPromise=require(_0x4be2('0x4'));var Mustache=require(_0x4be2('0x5'));var util=require(_0x4be2('0x6'));var path=require(_0x4be2('0x7'));var sox=require(_0x4be2('0x8'));var csv=require(_0x4be2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4be2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4be2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4be2('0x9'));var querystring=require(_0x4be2('0xc'));var Papa=require(_0x4be2('0xd'));var Redis=require(_0x4be2('0xe'));var authService=require(_0x4be2('0xf'));var qs=require(_0x4be2('0x10'));var as=require(_0x4be2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4be2('0x12'));var utils=require(_0x4be2('0x13'));var config=require(_0x4be2('0x14'));var licenseUtil=require(_0x4be2('0x15'));var db=require(_0x4be2('0x16'))['db'];function respondWithStatusCode(_0x58818a,_0x2c2603){_0x2c2603=_0x2c2603||0xcc;return function(_0x3d75f2){if(_0x3d75f2){return _0x58818a['sendStatus'](_0x2c2603);}return _0x58818a[_0x4be2('0x17')](_0x2c2603)[_0x4be2('0x18')]();};}function respondWithResult(_0x54d44e,_0x547eac){_0x547eac=_0x547eac||0xc8;return function(_0x38faea){if(_0x38faea){return _0x54d44e[_0x4be2('0x17')](_0x547eac)['json'](_0x38faea);}};}function respondWithFilteredResult(_0x5d288c,_0x4a8f44){return function(_0x2c210f){if(_0x2c210f){var _0x50de70=typeof _0x4a8f44[_0x4be2('0x19')]===_0x4be2('0x1a')&&typeof _0x4a8f44[_0x4be2('0x1b')]===_0x4be2('0x1a');var _0x3715b3=_0x2c210f['count'];var _0x5979db=_0x50de70?0x0:_0x4a8f44[_0x4be2('0x19')];var _0x52362a=_0x50de70?_0x2c210f[_0x4be2('0x1c')]:_0x4a8f44[_0x4be2('0x19')]+_0x4a8f44[_0x4be2('0x1b')];var _0x3f0bff;if(_0x52362a>=_0x3715b3){_0x52362a=_0x3715b3;_0x3f0bff=0xc8;}else{_0x3f0bff=0xce;}_0x5d288c[_0x4be2('0x17')](_0x3f0bff);return _0x5d288c[_0x4be2('0x1d')](_0x4be2('0x1e'),_0x5979db+'-'+_0x52362a+'/'+_0x3715b3)[_0x4be2('0x1f')](_0x2c210f);}return null;};}function patchUpdates(_0x114ca9){return function(_0x4b28e3){try{jsonpatch[_0x4be2('0x20')](_0x4b28e3,_0x114ca9,!![]);}catch(_0x2ab36e){return BPromise[_0x4be2('0x21')](_0x2ab36e);}return _0x4b28e3[_0x4be2('0x22')]();};}function saveUpdates(_0x3e0474,_0x3b94fb){return function(_0x1e89bf){if(_0x1e89bf){return _0x1e89bf[_0x4be2('0x23')](_0x3e0474)['then'](function(_0x23d8d3){return _0x23d8d3;});}return null;};}function removeEntity(_0x5e03e4,_0x4f593f){return function(_0x37ded6){if(_0x37ded6){return _0x37ded6[_0x4be2('0x24')]()[_0x4be2('0x25')](function(){var _0xad9813=_0x37ded6[_0x4be2('0x26')]({'plain':!![]});var _0xb13128='Pauses';return db[_0x4be2('0x27')][_0x4be2('0x24')]({'where':{'type':_0xb13128,'resourceId':_0xad9813['id']}})[_0x4be2('0x25')](function(){return _0x37ded6;});})[_0x4be2('0x25')](function(){_0x5e03e4[_0x4be2('0x17')](0xcc)[_0x4be2('0x18')]();});}};}function handleEntityNotFound(_0x4dac13,_0x178c5a){return function(_0x309c50){if(!_0x309c50){_0x4dac13[_0x4be2('0x28')](0x194);}return _0x309c50;};}function handleError(_0x1bc995,_0x3ae3a0){_0x3ae3a0=_0x3ae3a0||0x1f4;return function(_0x5cfe8c){logger['error'](_0x5cfe8c['stack']);if(_0x5cfe8c[_0x4be2('0x29')]){delete _0x5cfe8c[_0x4be2('0x29')];}_0x1bc995['status'](_0x3ae3a0)['send'](_0x5cfe8c);};}exports[_0x4be2('0x2a')]=function(_0x2eb2de,_0xbeeba8){var _0x5debf1={},_0xea86b9={},_0x5d971c={'count':0x0,'rows':[]};var _0x58a837=_[_0x4be2('0x2b')](db['Pause'][_0x4be2('0x2c')],function(_0x140ea5){return{'name':_0x140ea5[_0x4be2('0x2d')],'type':_0x140ea5['type']['key']};});_0xea86b9[_0x4be2('0x2e')]=_['map'](_0x58a837,_0x4be2('0x29'));_0xea86b9['query']=_[_0x4be2('0x2f')](_0x2eb2de[_0x4be2('0x30')]);_0xea86b9[_0x4be2('0x31')]=_[_0x4be2('0x32')](_0xea86b9['model'],_0xea86b9[_0x4be2('0x30')]);_0x5debf1[_0x4be2('0x33')]=_['intersection'](_0xea86b9[_0x4be2('0x2e')],qs[_0x4be2('0x34')](_0x2eb2de['query'][_0x4be2('0x34')]));_0x5debf1[_0x4be2('0x33')]=_0x5debf1[_0x4be2('0x33')]['length']?_0x5debf1[_0x4be2('0x33')]:_0xea86b9['model'];if(!_0x2eb2de['query'][_0x4be2('0x35')]('nolimit')){_0x5debf1[_0x4be2('0x1b')]=qs['limit'](_0x2eb2de[_0x4be2('0x30')][_0x4be2('0x1b')]);_0x5debf1[_0x4be2('0x19')]=qs[_0x4be2('0x19')](_0x2eb2de[_0x4be2('0x30')][_0x4be2('0x19')]);}_0x5debf1[_0x4be2('0x36')]=qs[_0x4be2('0x37')](_0x2eb2de['query']['sort']);_0x5debf1['where']=qs[_0x4be2('0x31')](_[_0x4be2('0x38')](_0x2eb2de[_0x4be2('0x30')],_0xea86b9[_0x4be2('0x31')]),_0x58a837);if(_0x2eb2de[_0x4be2('0x30')][_0x4be2('0x39')]){_0x5debf1['where']=_[_0x4be2('0x3a')](_0x5debf1[_0x4be2('0x3b')],{'$or':_[_0x4be2('0x2b')](_0x58a837,function(_0x5592c0){if(_0x5592c0[_0x4be2('0x3c')]!==_0x4be2('0x3d')){var _0x1ac6f3={};_0x1ac6f3[_0x5592c0['name']]={'$like':'%'+_0x2eb2de[_0x4be2('0x30')][_0x4be2('0x39')]+'%'};return _0x1ac6f3;}})});}_0x5debf1=_[_0x4be2('0x3a')]({},_0x5debf1,_0x2eb2de[_0x4be2('0x3e')]);var _0x5b3e4a={'where':_0x5debf1['where']};return db['Pause'][_0x4be2('0x1c')](_0x5b3e4a)[_0x4be2('0x25')](function(_0x9a2c01){_0x5d971c[_0x4be2('0x1c')]=_0x9a2c01;if(_0x2eb2de['query'][_0x4be2('0x3f')]){_0x5debf1[_0x4be2('0x40')]=[{'all':!![]}];}return db[_0x4be2('0x41')][_0x4be2('0x42')](_0x5debf1);})[_0x4be2('0x25')](function(_0x3f8bb7){_0x5d971c['rows']=_0x3f8bb7;return _0x5d971c;})['then'](respondWithFilteredResult(_0xbeeba8,_0x5debf1))['catch'](handleError(_0xbeeba8,null));};exports[_0x4be2('0x43')]=function(_0x30d3d2,_0x2bf9bb){var _0x39221f={'raw':!![],'where':{'id':_0x30d3d2[_0x4be2('0x44')]['id']}},_0x1975bd={};_0x1975bd[_0x4be2('0x2e')]=_['keys'](db[_0x4be2('0x41')]['rawAttributes']);_0x1975bd[_0x4be2('0x30')]=_[_0x4be2('0x2f')](_0x30d3d2[_0x4be2('0x30')]);_0x1975bd[_0x4be2('0x31')]=_[_0x4be2('0x32')](_0x1975bd[_0x4be2('0x2e')],_0x1975bd[_0x4be2('0x30')]);_0x39221f[_0x4be2('0x33')]=_['intersection'](_0x1975bd[_0x4be2('0x2e')],qs[_0x4be2('0x34')](_0x30d3d2[_0x4be2('0x30')][_0x4be2('0x34')]));_0x39221f[_0x4be2('0x33')]=_0x39221f['attributes']['length']?_0x39221f['attributes']:_0x1975bd['model'];if(_0x30d3d2[_0x4be2('0x30')][_0x4be2('0x3f')]){_0x39221f[_0x4be2('0x40')]=[{'all':!![]}];}_0x39221f=_[_0x4be2('0x3a')]({},_0x39221f,_0x30d3d2[_0x4be2('0x3e')]);return db[_0x4be2('0x41')][_0x4be2('0x45')](_0x39221f)['then'](handleEntityNotFound(_0x2bf9bb,null))[_0x4be2('0x25')](respondWithResult(_0x2bf9bb,null))['catch'](handleError(_0x2bf9bb,null));};exports[_0x4be2('0x46')]=function(_0x9620b9,_0x31e714){return db[_0x4be2('0x41')]['create'](_0x9620b9[_0x4be2('0x47')],{})[_0x4be2('0x25')](function(_0x35aa2a){var _0x4d3865=_0x9620b9[_0x4be2('0x48')]['get']({'plain':!![]});if(!_0x4d3865)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d3865[_0x4be2('0x49')]===_0x4be2('0x48')){var _0x4c52b2=_0x35aa2a[_0x4be2('0x26')]({'plain':!![]});var _0x196dff='Pauses';return db[_0x4be2('0x4a')][_0x4be2('0x45')]({'where':{'name':_0x196dff,'userProfileId':_0x4d3865[_0x4be2('0x4b')]},'raw':!![]})[_0x4be2('0x25')](function(_0x47c84c){if(_0x47c84c&&_0x47c84c['autoAssociation']===0x0){return db[_0x4be2('0x27')][_0x4be2('0x46')]({'name':_0x4c52b2[_0x4be2('0x29')],'resourceId':_0x4c52b2['id'],'type':_0x47c84c[_0x4be2('0x29')],'sectionId':_0x47c84c['id']},{})['then'](function(){return _0x35aa2a;});}else{return _0x35aa2a;}})[_0x4be2('0x4c')](function(_0x128f6a){logger[_0x4be2('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x128f6a);throw _0x128f6a;});}return _0x35aa2a;})[_0x4be2('0x25')](respondWithResult(_0x31e714,0xc9))['catch'](handleError(_0x31e714,null));};exports[_0x4be2('0x23')]=function(_0x356e47,_0x391ca3){if(_0x356e47[_0x4be2('0x47')]['id']){delete _0x356e47[_0x4be2('0x47')]['id'];}return db[_0x4be2('0x41')][_0x4be2('0x45')]({'where':{'id':_0x356e47['params']['id']}})[_0x4be2('0x25')](handleEntityNotFound(_0x391ca3,null))[_0x4be2('0x25')](saveUpdates(_0x356e47[_0x4be2('0x47')],null))[_0x4be2('0x25')](respondWithResult(_0x391ca3,null))[_0x4be2('0x4c')](handleError(_0x391ca3,null));};exports[_0x4be2('0x24')]=function(_0x49c927,_0x461c36){return db[_0x4be2('0x41')][_0x4be2('0x45')]({'where':{'id':_0x49c927[_0x4be2('0x44')]['id']}})[_0x4be2('0x25')](handleEntityNotFound(_0x461c36,null))[_0x4be2('0x25')](removeEntity(_0x461c36,null))[_0x4be2('0x4c')](handleError(_0x461c36,null));}; \ No newline at end of file +var _0xbdfb=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Pauses','UserProfileResource','destroy','then','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format'];(function(_0x4fc2b6,_0x2698bc){var _0xb20b54=function(_0x288194){while(--_0x288194){_0x4fc2b6['push'](_0x4fc2b6['shift']());}};_0xb20b54(++_0x2698bc);}(_0xbdfb,0x185));var _0xbbdf=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xbdfb[_0x2e76a7];return _0x454cde;};'use strict';var emlformat=require(_0xbbdf('0x0'));var rimraf=require(_0xbbdf('0x1'));var zipdir=require(_0xbbdf('0x2'));var jsonpatch=require(_0xbbdf('0x3'));var rp=require('request-promise');var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbbdf('0x6'));var sox=require('sox');var csv=require(_0xbbdf('0x7'));var ejs=require(_0xbbdf('0x8'));var fs=require('fs');var fs_extra=require(_0xbbdf('0x9'));var _=require('lodash');var squel=require(_0xbbdf('0xa'));var crypto=require('crypto');var jsforce=require(_0xbbdf('0xb'));var deskjs=require(_0xbbdf('0xc'));var toCsv=require(_0xbbdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbbdf('0xd'));var authService=require(_0xbbdf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbbdf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbbdf('0x10'));var config=require(_0xbbdf('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbdf('0x12'))['db'];function respondWithStatusCode(_0x1a8626,_0x530f11){_0x530f11=_0x530f11||0xcc;return function(_0x31c461){if(_0x31c461){return _0x1a8626[_0xbbdf('0x13')](_0x530f11);}return _0x1a8626[_0xbbdf('0x14')](_0x530f11)[_0xbbdf('0x15')]();};}function respondWithResult(_0x38e37e,_0x16a760){_0x16a760=_0x16a760||0xc8;return function(_0x88bde5){if(_0x88bde5){return _0x38e37e['status'](_0x16a760)[_0xbbdf('0x16')](_0x88bde5);}};}function respondWithFilteredResult(_0x426d1e,_0x78687b){return function(_0x5b2ac7){if(_0x5b2ac7){var _0x46eff5=typeof _0x78687b[_0xbbdf('0x17')]==='undefined'&&typeof _0x78687b[_0xbbdf('0x18')]===_0xbbdf('0x19');var _0x4bb868=_0x5b2ac7[_0xbbdf('0x1a')];var _0x1324c8=_0x46eff5?0x0:_0x78687b[_0xbbdf('0x17')];var _0x516e44=_0x46eff5?_0x5b2ac7[_0xbbdf('0x1a')]:_0x78687b[_0xbbdf('0x17')]+_0x78687b[_0xbbdf('0x18')];var _0x328e0b;if(_0x516e44>=_0x4bb868){_0x516e44=_0x4bb868;_0x328e0b=0xc8;}else{_0x328e0b=0xce;}_0x426d1e[_0xbbdf('0x14')](_0x328e0b);return _0x426d1e[_0xbbdf('0x1b')](_0xbbdf('0x1c'),_0x1324c8+'-'+_0x516e44+'/'+_0x4bb868)['json'](_0x5b2ac7);}return null;};}function patchUpdates(_0x55813b){return function(_0x2c31d7){try{jsonpatch['apply'](_0x2c31d7,_0x55813b,!![]);}catch(_0x565968){return BPromise[_0xbbdf('0x1d')](_0x565968);}return _0x2c31d7[_0xbbdf('0x1e')]();};}function saveUpdates(_0x285378,_0x48c18c){return function(_0x3eaddc){if(_0x3eaddc){return _0x3eaddc['update'](_0x285378)['then'](function(_0x289477){return _0x289477;});}return null;};}function removeEntity(_0x39af84,_0x541402){return function(_0x8fbbd0){if(_0x8fbbd0){return _0x8fbbd0['destroy']()['then'](function(){var _0x3a0293=_0x8fbbd0[_0xbbdf('0x1f')]({'plain':!![]});var _0x3d7b04=_0xbbdf('0x20');return db[_0xbbdf('0x21')][_0xbbdf('0x22')]({'where':{'type':_0x3d7b04,'resourceId':_0x3a0293['id']}})[_0xbbdf('0x23')](function(){return _0x8fbbd0;});})[_0xbbdf('0x23')](function(){_0x39af84[_0xbbdf('0x14')](0xcc)[_0xbbdf('0x15')]();});}};}function handleEntityNotFound(_0x199905,_0x225921){return function(_0xa8e6e){if(!_0xa8e6e){_0x199905[_0xbbdf('0x13')](0x194);}return _0xa8e6e;};}function handleError(_0x4abf36,_0x148cab){_0x148cab=_0x148cab||0x1f4;return function(_0x5b49f5){logger[_0xbbdf('0x24')](_0x5b49f5[_0xbbdf('0x25')]);if(_0x5b49f5[_0xbbdf('0x26')]){delete _0x5b49f5[_0xbbdf('0x26')];}_0x4abf36[_0xbbdf('0x14')](_0x148cab)[_0xbbdf('0x27')](_0x5b49f5);};}exports[_0xbbdf('0x28')]=function(_0x2ed408,_0x1c726e){var _0x53ac64={},_0x360a10={},_0x230d06={'count':0x0,'rows':[]};var _0x3e1127=_['map'](db[_0xbbdf('0x29')][_0xbbdf('0x2a')],function(_0x2960f3){return{'name':_0x2960f3[_0xbbdf('0x2b')],'type':_0x2960f3[_0xbbdf('0x2c')][_0xbbdf('0x2d')]};});_0x360a10['model']=_[_0xbbdf('0x2e')](_0x3e1127,'name');_0x360a10[_0xbbdf('0x2f')]=_[_0xbbdf('0x30')](_0x2ed408['query']);_0x360a10[_0xbbdf('0x31')]=_[_0xbbdf('0x32')](_0x360a10['model'],_0x360a10[_0xbbdf('0x2f')]);_0x53ac64[_0xbbdf('0x33')]=_[_0xbbdf('0x32')](_0x360a10[_0xbbdf('0x34')],qs[_0xbbdf('0x35')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x35')]));_0x53ac64[_0xbbdf('0x33')]=_0x53ac64['attributes'][_0xbbdf('0x36')]?_0x53ac64['attributes']:_0x360a10[_0xbbdf('0x34')];if(!_0x2ed408[_0xbbdf('0x2f')]['hasOwnProperty'](_0xbbdf('0x37'))){_0x53ac64[_0xbbdf('0x18')]=qs['limit'](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x18')]);_0x53ac64[_0xbbdf('0x17')]=qs[_0xbbdf('0x17')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x17')]);}_0x53ac64['order']=qs[_0xbbdf('0x38')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x38')]);_0x53ac64[_0xbbdf('0x39')]=qs[_0xbbdf('0x31')](_[_0xbbdf('0x3a')](_0x2ed408[_0xbbdf('0x2f')],_0x360a10[_0xbbdf('0x31')]),_0x3e1127);if(_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x3b')]){_0x53ac64[_0xbbdf('0x39')]=_[_0xbbdf('0x3c')](_0x53ac64[_0xbbdf('0x39')],{'$or':_[_0xbbdf('0x2e')](_0x3e1127,function(_0x3632d7){if(_0x3632d7[_0xbbdf('0x2c')]!==_0xbbdf('0x3d')){var _0x9c6b52={};_0x9c6b52[_0x3632d7[_0xbbdf('0x26')]]={'$like':'%'+_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x3b')]+'%'};return _0x9c6b52;}})});}_0x53ac64=_[_0xbbdf('0x3c')]({},_0x53ac64,_0x2ed408[_0xbbdf('0x3e')]);var _0x26c260={'where':_0x53ac64[_0xbbdf('0x39')]};return db[_0xbbdf('0x29')]['count'](_0x26c260)[_0xbbdf('0x23')](function(_0x4bf8e9){_0x230d06['count']=_0x4bf8e9;if(_0x2ed408['query'][_0xbbdf('0x3f')]){_0x53ac64[_0xbbdf('0x40')]=[{'all':!![]}];}return db[_0xbbdf('0x29')][_0xbbdf('0x41')](_0x53ac64);})['then'](function(_0x141ef3){_0x230d06['rows']=_0x141ef3;return _0x230d06;})[_0xbbdf('0x23')](respondWithFilteredResult(_0x1c726e,_0x53ac64))[_0xbbdf('0x42')](handleError(_0x1c726e,null));};exports[_0xbbdf('0x43')]=function(_0x520d2e,_0x48b52d){var _0x194a2a={'raw':!![],'where':{'id':_0x520d2e[_0xbbdf('0x44')]['id']}},_0xb73349={};_0xb73349['model']=_[_0xbbdf('0x30')](db[_0xbbdf('0x29')]['rawAttributes']);_0xb73349[_0xbbdf('0x2f')]=_[_0xbbdf('0x30')](_0x520d2e[_0xbbdf('0x2f')]);_0xb73349[_0xbbdf('0x31')]=_[_0xbbdf('0x32')](_0xb73349[_0xbbdf('0x34')],_0xb73349['query']);_0x194a2a[_0xbbdf('0x33')]=_[_0xbbdf('0x32')](_0xb73349['model'],qs[_0xbbdf('0x35')](_0x520d2e[_0xbbdf('0x2f')][_0xbbdf('0x35')]));_0x194a2a['attributes']=_0x194a2a[_0xbbdf('0x33')]['length']?_0x194a2a[_0xbbdf('0x33')]:_0xb73349['model'];if(_0x520d2e[_0xbbdf('0x2f')]['includeAll']){_0x194a2a[_0xbbdf('0x40')]=[{'all':!![]}];}_0x194a2a=_['merge']({},_0x194a2a,_0x520d2e[_0xbbdf('0x3e')]);return db[_0xbbdf('0x29')][_0xbbdf('0x45')](_0x194a2a)['then'](handleEntityNotFound(_0x48b52d,null))[_0xbbdf('0x23')](respondWithResult(_0x48b52d,null))[_0xbbdf('0x42')](handleError(_0x48b52d,null));};exports[_0xbbdf('0x46')]=function(_0x463d30,_0x38e6ce){return db[_0xbbdf('0x29')][_0xbbdf('0x46')](_0x463d30[_0xbbdf('0x47')],{})[_0xbbdf('0x23')](function(_0x584576){var _0x52354e=_0x463d30['user'][_0xbbdf('0x1f')]({'plain':!![]});if(!_0x52354e)throw new Error(_0xbbdf('0x48'));if(_0x52354e[_0xbbdf('0x49')]===_0xbbdf('0x4a')){var _0x31a180=_0x584576[_0xbbdf('0x1f')]({'plain':!![]});var _0x3818ff=_0xbbdf('0x20');return db['UserProfileSection'][_0xbbdf('0x45')]({'where':{'name':_0x3818ff,'userProfileId':_0x52354e[_0xbbdf('0x4b')]},'raw':!![]})['then'](function(_0x3c4129){if(_0x3c4129&&_0x3c4129['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x31a180[_0xbbdf('0x26')],'resourceId':_0x31a180['id'],'type':_0x3c4129[_0xbbdf('0x26')],'sectionId':_0x3c4129['id']},{})[_0xbbdf('0x23')](function(){return _0x584576;});}else{return _0x584576;}})[_0xbbdf('0x42')](function(_0xdda3ac){logger[_0xbbdf('0x24')](_0xbbdf('0x4c'),_0xdda3ac);throw _0xdda3ac;});}return _0x584576;})[_0xbbdf('0x23')](respondWithResult(_0x38e6ce,0xc9))['catch'](handleError(_0x38e6ce,null));};exports[_0xbbdf('0x4d')]=function(_0x4a2660,_0x5f4270){if(_0x4a2660[_0xbbdf('0x47')]['id']){delete _0x4a2660['body']['id'];}return db[_0xbbdf('0x29')][_0xbbdf('0x45')]({'where':{'id':_0x4a2660[_0xbbdf('0x44')]['id']}})[_0xbbdf('0x23')](handleEntityNotFound(_0x5f4270,null))[_0xbbdf('0x23')](saveUpdates(_0x4a2660[_0xbbdf('0x47')],null))['then'](respondWithResult(_0x5f4270,null))[_0xbbdf('0x42')](handleError(_0x5f4270,null));};exports[_0xbbdf('0x22')]=function(_0x4fee5b,_0x465501){return db[_0xbbdf('0x29')][_0xbbdf('0x45')]({'where':{'id':_0x4fee5b[_0xbbdf('0x44')]['id']}})[_0xbbdf('0x23')](handleEntityNotFound(_0x465501,null))[_0xbbdf('0x23')](removeEntity(_0x465501,null))['catch'](handleError(_0x465501,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c398e86..dfdab41 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x12b756,_0x2c5469){var _0x79a52f=function(_0x519f53){while(--_0x519f53){_0x12b756['push'](_0x12b756['shift']());}};_0x79a52f(++_0x2c5469);}(_0x814b,0x1a2));var _0xb814=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x814b[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x42934b,_0x483ed6){var _0x31c5e4=function(_0x2a51ba){while(--_0x2a51ba){_0x42934b['push'](_0x42934b['shift']());}};_0x31c5e4(++_0x483ed6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x202790,_0x1cd69f){_0x202790=_0x202790-0x0;var _0x188e92=_0x8ef6[_0x202790];return _0x188e92;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index eb31cbb..5ac1e33 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2e6b47,_0x526c98){var _0x4e4724=function(_0x236a96){while(--_0x236a96){_0x2e6b47['push'](_0x2e6b47['shift']());}};_0x4e4724(++_0x526c98);}(_0x7a54,0x106));var _0x47a5=function(_0x59856a,_0x3f289c){_0x59856a=_0x59856a-0x0;var _0x5741ef=_0x7a54[_0x59856a];return _0x5741ef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x470d4f,_0x372bae){var _0x244e15=function(_0x18ebf8){while(--_0x18ebf8){_0x470d4f['push'](_0x470d4f['shift']());}};_0x244e15(++_0x372bae);}(_0x7a54,0x106));var _0x47a5=function(_0x3dcfc1,_0x1ef348){_0x3dcfc1=_0x3dcfc1-0x0;var _0x22d649=_0x7a54[_0x3dcfc1];return _0x22d649;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 59b1739..609d9c1 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 _0x5636=['fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','extname','now','post','single','file','delete','exports','multer','util','Router'];(function(_0x991407,_0x25c4f9){var _0x551a31=function(_0x5eaf2f){while(--_0x5eaf2f){_0x991407['push'](_0x991407['shift']());}};_0x551a31(++_0x25c4f9);}(_0x5636,0x102));var _0x6563=function(_0x27b9dd,_0x3f991b){_0x27b9dd=_0x27b9dd-0x0;var _0x29fde4=_0x5636[_0x27b9dd];return _0x29fde4;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router[_0x6563('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x6563('0xe')]);var upload=multer({'storage':multer[_0x6563('0xf')]({'destination':function(_0x490a56,_0x506ee9,_0x5da960){_0x5da960(null,path[_0x6563('0x10')](config[_0x6563('0x11')],_0x6563('0x12')));},'filename':function(_0x12429c,_0x33816e,_0x2ed676){_0x33816e[_0x6563('0x13')]=_0x33816e[_0x6563('0x13')][_0x6563('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ed676(null,util['format'](_0x6563('0x15'),path['basename'](_0x33816e[_0x6563('0x13')],path[_0x6563('0x16')](_0x33816e[_0x6563('0x13')])),Date[_0x6563('0x17')](),path['extname'](_0x33816e[_0x6563('0x13')])));}})});router[_0x6563('0x18')]('/',upload[_0x6563('0x19')](_0x6563('0x1a')),controller['upload']);router[_0x6563('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x6563('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6563('0x1b')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x1b')]);module[_0x6563('0x1c')]=router; \ No newline at end of file +var _0x8ce3=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','/webhook','webhookGet','get','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','post','single','upload','put','/:id'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0x8ce3[_0x3d7de8];return _0x5e9a0c;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var fs_extra=require(_0x38ce('0x5'));var auth=require(_0x38ce('0x6'));var interaction=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var controller=require(_0x38ce('0x9'));router['get']('/',auth[_0x38ce('0xa')](),controller[_0x38ce('0xb')]);router['get'](_0x38ce('0xc'),controller[_0x38ce('0xd')]);router[_0x38ce('0xe')]('/:id',auth[_0x38ce('0xa')](),controller['show']);router[_0x38ce('0xe')]('/:id/download',auth[_0x38ce('0xa')](),controller[_0x38ce('0xf')]);var upload=multer({'storage':multer[_0x38ce('0x10')]({'destination':function(_0x2c0cab,_0x564332,_0x3603fa){_0x3603fa(null,path[_0x38ce('0x11')](config[_0x38ce('0x12')],_0x38ce('0x13')));},'filename':function(_0xe33aec,_0x42e234,_0x3ef662){_0x42e234[_0x38ce('0x14')]=_0x42e234[_0x38ce('0x14')][_0x38ce('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ef662(null,util[_0x38ce('0x16')]('%s-%s%s',path['basename'](_0x42e234[_0x38ce('0x14')],path[_0x38ce('0x17')](_0x42e234[_0x38ce('0x14')])),Date['now'](),path[_0x38ce('0x17')](_0x42e234['originalname'])));}})});router[_0x38ce('0x18')]('/',upload[_0x38ce('0x19')]('file'),controller[_0x38ce('0x1a')]);router[_0x38ce('0x18')](_0x38ce('0xc'),controller['webhookPost']);router[_0x38ce('0x1b')](_0x38ce('0x1c'),auth[_0x38ce('0xa')](),controller[_0x38ce('0x1d')]);router[_0x38ce('0x1e')](_0x38ce('0x1c'),auth[_0x38ce('0xa')](),controller['delete']);module[_0x38ce('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 05cbef9..bc441d3 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 _0x2bd3=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','sequelize','exports','STRING','ENUM','html','script'];(function(_0x143a86,_0x50dc0a){var _0x2f213b=function(_0x2e3dbe){while(--_0x2e3dbe){_0x143a86['push'](_0x143a86['shift']());}};_0x2f213b(++_0x50dc0a);}(_0x2bd3,0x180));var _0x32bd=function(_0x17ff72,_0x5a05c9){_0x17ff72=_0x17ff72-0x0;var _0x4b987c=_0x2bd3[_0x17ff72];return _0x4b987c;};'use strict';var Sequelize=require(_0x32bd('0x0'));module[_0x32bd('0x1')]={'name':{'type':Sequelize[_0x32bd('0x2')]},'type':{'type':Sequelize[_0x32bd('0x3')](_0x32bd('0x4'),_0x32bd('0x5'))},'description':{'type':Sequelize[_0x32bd('0x6')]},'version':{'type':Sequelize[_0x32bd('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x32bd('0x7')],'defaultValue':0x0,'comment':_0x32bd('0x8')},'sidebar':{'type':Sequelize[_0x32bd('0x3')]('adminOnly','agentOnly',_0x32bd('0x9'),'never'),'defaultValue':_0x32bd('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x32bd('0x2')]},'adminUrl':{'type':Sequelize[_0x32bd('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x32bd('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd9c=['adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x31cd5f,_0x2436ab){var _0x58efba=function(_0x5f2e60){while(--_0x5f2e60){_0x31cd5f['push'](_0x31cd5f['shift']());}};_0x58efba(++_0x2436ab);}(_0xfd9c,0xc8));var _0xcfd9=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xfd9c[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xcfd9('0x0'));module[_0xcfd9('0x1')]={'name':{'type':Sequelize[_0xcfd9('0x2')]},'type':{'type':Sequelize['ENUM'](_0xcfd9('0x3'),_0xcfd9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcfd9('0x5')]},'path':{'type':Sequelize[_0xcfd9('0x2')],'comment':_0xcfd9('0x6')},'active':{'type':Sequelize[_0xcfd9('0x7')],'defaultValue':0x0,'comment':_0xcfd9('0x8')},'sidebar':{'type':Sequelize[_0xcfd9('0x9')](_0xcfd9('0xa'),_0xcfd9('0xb'),'always',_0xcfd9('0xc')),'defaultValue':'always','comment':_0xcfd9('0xd')},'icon':{'type':Sequelize[_0xcfd9('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xcfd9('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xcfd9('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f0c56d5..fe036e7 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 _0xfa50=['chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','role','body','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','encoding','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','get','Plugins','end','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','attributes','intersection','fields','length','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','download','find','params','path','root','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','server/files/plugins','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s'];(function(_0x31f84d,_0x15c9ad){var _0x45f66c=function(_0x153d10){while(--_0x153d10){_0x31f84d['push'](_0x31f84d['shift']());}};_0x45f66c(++_0x15c9ad);}(_0xfa50,0x194));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0fa5('0x0'));var rimraf=require(_0x0fa5('0x1'));var zipdir=require(_0x0fa5('0x2'));var jsonpatch=require(_0x0fa5('0x3'));var rp=require(_0x0fa5('0x4'));var moment=require(_0x0fa5('0x5'));var BPromise=require(_0x0fa5('0x6'));var Mustache=require(_0x0fa5('0x7'));var util=require(_0x0fa5('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fa5('0x9'));var fs=require('fs');var fs_extra=require(_0x0fa5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0fa5('0xb'));var jsforce=require(_0x0fa5('0xc'));var deskjs=require(_0x0fa5('0xd'));var toCsv=require(_0x0fa5('0xe'));var querystring=require('querystring');var Papa=require(_0x0fa5('0xf'));var extract=require(_0x0fa5('0x10'));var rimraf=require(_0x0fa5('0x1'));var archiver=require('archiver');var Redis=require(_0x0fa5('0x11'));var authService=require(_0x0fa5('0x12'));var qs=require(_0x0fa5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0fa5('0x15'));var config=require(_0x0fa5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fa5('0x17'))['db'];config['redis']=_[_0x0fa5('0x18')](config[_0x0fa5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fa5('0x1a'))(new Redis(config[_0x0fa5('0x19')]));require(_0x0fa5('0x1b'))['register'](socket);function respondWithStatusCode(_0x4d2d00,_0x31bd2c){_0x31bd2c=_0x31bd2c||0xcc;return function(_0x441d8b){if(_0x441d8b){return _0x4d2d00['sendStatus'](_0x31bd2c);}return _0x4d2d00[_0x0fa5('0x1c')](_0x31bd2c)['end']();};}function respondWithResult(_0xfc4eff,_0x129278){_0x129278=_0x129278||0xc8;return function(_0x2d4149){if(_0x2d4149){return _0xfc4eff[_0x0fa5('0x1c')](_0x129278)[_0x0fa5('0x1d')](_0x2d4149);}};}function respondWithFilteredResult(_0x287d3f,_0x18b09e){return function(_0x1fbaad){if(_0x1fbaad){var _0x41b444=typeof _0x18b09e[_0x0fa5('0x1e')]===_0x0fa5('0x1f')&&typeof _0x18b09e['limit']===_0x0fa5('0x1f');var _0x44c56d=_0x1fbaad[_0x0fa5('0x20')];var _0x198cb8=_0x41b444?0x0:_0x18b09e[_0x0fa5('0x1e')];var _0x331706=_0x41b444?_0x1fbaad['count']:_0x18b09e['offset']+_0x18b09e[_0x0fa5('0x21')];var _0x14526e;if(_0x331706>=_0x44c56d){_0x331706=_0x44c56d;_0x14526e=0xc8;}else{_0x14526e=0xce;}_0x287d3f[_0x0fa5('0x1c')](_0x14526e);return _0x287d3f[_0x0fa5('0x22')]('Content-Range',_0x198cb8+'-'+_0x331706+'/'+_0x44c56d)[_0x0fa5('0x1d')](_0x1fbaad);}return null;};}function patchUpdates(_0xeb8bae){return function(_0x221a52){try{jsonpatch['apply'](_0x221a52,_0xeb8bae,!![]);}catch(_0x2ffab3){return BPromise[_0x0fa5('0x23')](_0x2ffab3);}return _0x221a52['save']();};}function saveUpdates(_0x47e79d,_0xa0939b){return function(_0x49785d){if(_0x49785d){return _0x49785d[_0x0fa5('0x24')](_0x47e79d)[_0x0fa5('0x25')](function(_0x42442b){return _0x42442b;});}return null;};}function removeEntity(_0x13ffbf,_0x3a0331){return function(_0x1ebcef){if(_0x1ebcef){return _0x1ebcef[_0x0fa5('0x26')]()[_0x0fa5('0x25')](function(){var _0x1c8938=_0x1ebcef[_0x0fa5('0x27')]({'plain':!![]});var _0x15965d=_0x0fa5('0x28');return db['UserProfileResource'][_0x0fa5('0x26')]({'where':{'type':_0x15965d,'resourceId':_0x1c8938['id']}})[_0x0fa5('0x25')](function(){return _0x1ebcef;});})[_0x0fa5('0x25')](function(){_0x13ffbf[_0x0fa5('0x1c')](0xcc)[_0x0fa5('0x29')]();});}};}function handleEntityNotFound(_0x43933a,_0x5d9c4e){return function(_0x3ed91e){if(!_0x3ed91e){_0x43933a[_0x0fa5('0x2a')](0x194);}return _0x3ed91e;};}function handleError(_0x52cece,_0x3b5b5d){_0x3b5b5d=_0x3b5b5d||0x1f4;return function(_0x135944){logger[_0x0fa5('0x2b')](_0x135944[_0x0fa5('0x2c')]);if(_0x135944['name']){delete _0x135944[_0x0fa5('0x2d')];}_0x52cece[_0x0fa5('0x1c')](_0x3b5b5d)[_0x0fa5('0x2e')](_0x135944);};}exports[_0x0fa5('0x2f')]=function(_0x286870,_0x31e6e6){var _0x5770e2={},_0x415abf={},_0x182e06={'count':0x0,'rows':[]};var _0x313dee=_[_0x0fa5('0x30')](db[_0x0fa5('0x31')][_0x0fa5('0x32')],function(_0x459d68){return{'name':_0x459d68['fieldName'],'type':_0x459d68['type'][_0x0fa5('0x33')]};});_0x415abf[_0x0fa5('0x34')]=_[_0x0fa5('0x30')](_0x313dee,_0x0fa5('0x2d'));_0x415abf['query']=_['keys'](_0x286870[_0x0fa5('0x35')]);_0x415abf['filters']=_['intersection'](_0x415abf[_0x0fa5('0x34')],_0x415abf['query']);_0x5770e2[_0x0fa5('0x36')]=_[_0x0fa5('0x37')](_0x415abf[_0x0fa5('0x34')],qs[_0x0fa5('0x38')](_0x286870[_0x0fa5('0x35')][_0x0fa5('0x38')]));_0x5770e2[_0x0fa5('0x36')]=_0x5770e2['attributes'][_0x0fa5('0x39')]?_0x5770e2[_0x0fa5('0x36')]:_0x415abf['model'];if(!_0x286870[_0x0fa5('0x35')]['hasOwnProperty']('nolimit')){_0x5770e2[_0x0fa5('0x21')]=qs[_0x0fa5('0x21')](_0x286870[_0x0fa5('0x35')]['limit']);_0x5770e2['offset']=qs['offset'](_0x286870['query'][_0x0fa5('0x1e')]);}_0x5770e2[_0x0fa5('0x3a')]=qs['sort'](_0x286870[_0x0fa5('0x35')][_0x0fa5('0x3b')]);_0x5770e2['where']=qs['filters'](_[_0x0fa5('0x3c')](_0x286870['query'],_0x415abf[_0x0fa5('0x3d')]),_0x313dee);if(_0x286870['query'][_0x0fa5('0x3e')]){_0x5770e2[_0x0fa5('0x3f')]=_[_0x0fa5('0x40')](_0x5770e2[_0x0fa5('0x3f')],{'$or':_['map'](_0x313dee,function(_0x28db0a){if(_0x28db0a[_0x0fa5('0x41')]!==_0x0fa5('0x42')){var _0xb49330={};_0xb49330[_0x28db0a[_0x0fa5('0x2d')]]={'$like':'%'+_0x286870['query'][_0x0fa5('0x3e')]+'%'};return _0xb49330;}})});}_0x5770e2=_[_0x0fa5('0x40')]({},_0x5770e2,_0x286870[_0x0fa5('0x43')]);var _0x26712e={'where':_0x5770e2[_0x0fa5('0x3f')]};return db[_0x0fa5('0x31')][_0x0fa5('0x20')](_0x26712e)[_0x0fa5('0x25')](function(_0x552ca1){_0x182e06[_0x0fa5('0x20')]=_0x552ca1;if(_0x286870[_0x0fa5('0x35')][_0x0fa5('0x44')]){_0x5770e2[_0x0fa5('0x45')]=[{'all':!![]}];}return db['Plugin'][_0x0fa5('0x46')](_0x5770e2);})[_0x0fa5('0x25')](function(_0x25a25b){_0x182e06[_0x0fa5('0x47')]=_0x25a25b;return _0x182e06;})[_0x0fa5('0x25')](respondWithFilteredResult(_0x31e6e6,_0x5770e2))['catch'](handleError(_0x31e6e6,null));};exports[_0x0fa5('0x48')]=function(_0x221c02,_0x22f380){var _0x3a67b0={'raw':!![],'where':{'id':_0x221c02['params']['id']}},_0x34de57={};_0x34de57[_0x0fa5('0x34')]=_[_0x0fa5('0x49')](db[_0x0fa5('0x31')][_0x0fa5('0x32')]);_0x34de57[_0x0fa5('0x35')]=_[_0x0fa5('0x49')](_0x221c02[_0x0fa5('0x35')]);_0x34de57['filters']=_[_0x0fa5('0x37')](_0x34de57[_0x0fa5('0x34')],_0x34de57[_0x0fa5('0x35')]);_0x3a67b0['attributes']=_['intersection'](_0x34de57[_0x0fa5('0x34')],qs[_0x0fa5('0x38')](_0x221c02[_0x0fa5('0x35')][_0x0fa5('0x38')]));_0x3a67b0[_0x0fa5('0x36')]=_0x3a67b0[_0x0fa5('0x36')]['length']?_0x3a67b0['attributes']:_0x34de57[_0x0fa5('0x34')];if(_0x221c02['query'][_0x0fa5('0x44')]){_0x3a67b0[_0x0fa5('0x45')]=[{'all':!![]}];}_0x3a67b0=_['merge']({},_0x3a67b0,_0x221c02['options']);return db['Plugin']['find'](_0x3a67b0)['then'](handleEntityNotFound(_0x22f380,null))['then'](respondWithResult(_0x22f380,null))[_0x0fa5('0x4a')](handleError(_0x22f380,null));};exports[_0x0fa5('0x4b')]=function(_0x2080fc,_0x15452d,_0x5aad1b){return db['Plugin'][_0x0fa5('0x4c')]({'where':{'id':_0x2080fc[_0x0fa5('0x4d')]['id']},'attributes':[_0x0fa5('0x2d'),_0x0fa5('0x4e')],'raw':!![]})[_0x0fa5('0x25')](handleEntityNotFound(_0x15452d,null))[_0x0fa5('0x25')](function(_0x2ad838){if(_0x2ad838){var _0x2bdc45=path['join'](config[_0x0fa5('0x4f')],'server/files/plugins',util[_0x0fa5('0x50')](_0x0fa5('0x51'),path[_0x0fa5('0x52')](_0x2ad838[_0x0fa5('0x4e')])));var _0x5dfe25=fs[_0x0fa5('0x53')](_0x2bdc45);var _0x42ff2f=archiver('zip',{'zlib':{'level':0x9}});_0x42ff2f['on'](_0x0fa5('0x54'),function(_0x114f7b){if(_0x114f7b['code']===_0x0fa5('0x55')){logger['error'](_0x114f7b);}else{throw new db[(_0x0fa5('0x56'))][(_0x0fa5('0x57'))](_0x0fa5('0x58'));}});_0x42ff2f['on']('error',function(_0x36bdd7){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x42ff2f['pipe'](_0x5dfe25);_0x42ff2f[_0x0fa5('0x59')](_0x0fa5('0x5a'),{'cwd':path[_0x0fa5('0x5b')](config['root'],_0x0fa5('0x5c'),path[_0x0fa5('0x5d')](_0x2ad838[_0x0fa5('0x4e')])),'ignore':[path[_0x0fa5('0x5b')](path[_0x0fa5('0x52')](_0x2ad838['path']),'node_modules/**/*'),path[_0x0fa5('0x5b')](path[_0x0fa5('0x52')](_0x2ad838['path']),_0x0fa5('0x5e'))],'nodir':!![]})['finalize']();_0x5dfe25['on'](_0x0fa5('0x5f'),function(){if(!fs[_0x0fa5('0x60')](_0x2bdc45)){throw new db[(_0x0fa5('0x56'))][(_0x0fa5('0x57'))](_0x0fa5('0x61'));}return _0x15452d[_0x0fa5('0x4b')](_0x2bdc45,util[_0x0fa5('0x50')](_0x0fa5('0x51'),path[_0x0fa5('0x52')](_0x2ad838['path'])),function(_0x378745){if(_0x378745){throw new db[(_0x0fa5('0x56'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2bdc45);logger[_0x0fa5('0x62')](_0x0fa5('0x63'));logger[_0x0fa5('0x62')](_0x0fa5('0x64'));});});}return null;})[_0x0fa5('0x4a')](handleError(_0x15452d,null));};exports['upload']=function(_0x420323,_0x55fd86,_0x45efe3){var _0x44c75e=path[_0x0fa5('0x52')](_0x420323[_0x0fa5('0x65')][_0x0fa5('0x66')],path[_0x0fa5('0x67')](_0x420323[_0x0fa5('0x65')][_0x0fa5('0x66')]));var _0x183dca=path[_0x0fa5('0x5b')](config[_0x0fa5('0x4f')],'server/files/plugins',_0x420323[_0x0fa5('0x65')]['filename']);var _0x13b290=path[_0x0fa5('0x5b')](config[_0x0fa5('0x4f')],'server/files/plugins',_0x44c75e);logger[_0x0fa5('0x62')](_0x0fa5('0x68'),_0x183dca);logger[_0x0fa5('0x62')](_0x0fa5('0x69'),_0x13b290);try{fs[_0x0fa5('0x6a')](_0x183dca,parseInt(_0x0fa5('0x6b'),0x8));extract(_0x183dca,{'dir':_0x13b290},function(_0x34161a){if(_0x34161a){logger[_0x0fa5('0x2b')](_0x34161a);handleError(_0x34161a,!![]);};var _0x88f9b5=fs[_0x0fa5('0x6c')](_0x13b290);if(_0x88f9b5[_0x0fa5('0x39')]>0x1){removeReferences(_0x183dca,_0x13b290);logger[_0x0fa5('0x2b')](_0x0fa5('0x6d'));return _0x45efe3(new Error(_0x0fa5('0x6d')));}var _0xc60170=fs[_0x0fa5('0x6e')](path[_0x0fa5('0x5b')](_0x13b290,_0x88f9b5[0x0]));if(_0xc60170['isFile']()){removeReferences(_0x183dca,_0x13b290);logger[_0x0fa5('0x2b')]('Invalid\x20plugin\x20structure');return _0x45efe3(new Error(_0x0fa5('0x6d')));}if(_0xc60170['isDirectory']()){var _0x607009=fs['readdirSync'](path[_0x0fa5('0x5b')](_0x13b290,_0x88f9b5[0x0]));if(_0x607009[_0x0fa5('0x39')]===0x0){removeReferences(_0x183dca,_0x13b290);logger[_0x0fa5('0x2b')](_0x0fa5('0x6d'));return _0x45efe3(new Error(_0x0fa5('0x6d')));}var _0x509743=_0x607009[_0x0fa5('0x6f')](function(_0x46aa59){return _0x46aa59===_0x0fa5('0x70');});if(!_0x509743){return _0x45efe3(new Error(_0x0fa5('0x71')));}var _0xa5d4e=fs[_0x0fa5('0x72')](path['join'](_0x13b290,_0x88f9b5[0x0],_0x0fa5('0x70')));var _0x48fc14=JSON[_0x0fa5('0x73')](_0xa5d4e);if('undefined'==typeof _0x48fc14['name']){return _0x45efe3(new Error(_0x0fa5('0x74')));}if('undefined'==typeof _0x48fc14['type']){return _0x45efe3(new Error(_0x0fa5('0x75')));}if(_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x76')]){return _0x45efe3(new Error(_0x0fa5('0x77')));}if('undefined'==typeof _0x48fc14[_0x0fa5('0x78')]){return _0x45efe3(new Error(_0x0fa5('0x79')));}if(_0x48fc14[_0x0fa5('0x41')]==='html'){if(_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x78')]['views']){return _0x45efe3(new Error(_0x0fa5('0x7a')));}if(_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x78')]['views'][_0x0fa5('0x7b')]&&_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7c')][_0x0fa5('0x7d')]){return _0x45efe3(new Error(_0x0fa5('0x7e')));}}else if(_0x48fc14[_0x0fa5('0x41')]==='script'){if(_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7f')]){return _0x45efe3(new Error(_0x0fa5('0x80')));}if(_0x0fa5('0x1f')==typeof _0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x81')]){return _0x45efe3(new Error(_0x0fa5('0x82')));}}else{return _0x45efe3(new Error(_0x0fa5('0x83')));}var _0x57130e=_0x48fc14[_0x0fa5('0x2d')];var _0x48d520=_0x48fc14[_0x0fa5('0x84')];var _0x32ac2c=_0x48fc14['type'];var _0x5c675e=_0x48fc14['sidebar']?_0x48fc14[_0x0fa5('0x85')]:_0x0fa5('0x86');var _0x10f2ee=_0x48fc14[_0x0fa5('0x87')]?_0x48fc14[_0x0fa5('0x87')]:_0x0fa5('0x88');var _0x3b54cb='';var _0x2aa8a7='';var _0x249286='';var _0x400a4d='';var _0x5e0031=_0x48fc14[_0x0fa5('0x76')];if(_0x32ac2c===_0x0fa5('0x89')){if('undefined'!=typeof _0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7c')][_0x0fa5('0x7b')]){var _0x50cc94=_0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0fa5('0x8a')](_0x50cc94)){_0x3b54cb=path['join'](_0x0fa5('0x8b'),_0x44c75e,_0x88f9b5[0x0],_0x50cc94);}else{_0x3b54cb=_0x50cc94;}}else{logger[_0x0fa5('0x62')](_0x0fa5('0x8c'));}if(_0x0fa5('0x1f')!=typeof _0x48fc14[_0x0fa5('0x78')]['views']['agent']){var _0x2e4e53=_0x48fc14[_0x0fa5('0x78')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0fa5('0x8a')](_0x2e4e53)){_0x2aa8a7=path[_0x0fa5('0x5b')](_0x0fa5('0x8b'),_0x44c75e,_0x88f9b5[0x0],_0x2e4e53);}else{_0x2aa8a7=_0x2e4e53;}}else{logger[_0x0fa5('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x32ac2c==='script'){_0x249286=_0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7f')];_0x400a4d=_0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x81')];if(_0x0fa5('0x1f')!=typeof _0x48fc14['parameters'][_0x0fa5('0x7c')]){if(_0x0fa5('0x1f')!=typeof _0x48fc14['parameters'][_0x0fa5('0x7c')]['admin']){var _0x50cc94=_0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7c')][_0x0fa5('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x0fa5('0x8a')](_0x50cc94)){_0x3b54cb=path[_0x0fa5('0x5b')]('plugins',_0x44c75e,_0x88f9b5[0x0],_0x50cc94);}else{_0x3b54cb=_0x50cc94;}}if('undefined'!=typeof _0x48fc14['parameters'][_0x0fa5('0x7c')][_0x0fa5('0x7d')]){var _0x2e4e53=_0x48fc14[_0x0fa5('0x78')][_0x0fa5('0x7c')][_0x0fa5('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x0fa5('0x8a')](_0x2e4e53)){_0x2aa8a7=path[_0x0fa5('0x5b')](_0x0fa5('0x8b'),_0x44c75e,_0x88f9b5[0x0],_0x2e4e53);}else{_0x2aa8a7=_0x2e4e53;}}}}var _0x2f1d55={'name':_0x57130e,'description':_0x48d520,'path':path['join'](_0x44c75e,_0x88f9b5[0x0]),'type':_0x32ac2c,'sidebar':_0x5c675e,'icon':_0x10f2ee,'adminUrl':_0x3b54cb,'agentUrl':_0x2aa8a7,'scriptName':_0x249286,'scriptPath':_0x400a4d,'version':_0x5e0031};removeReferences(_0x183dca,null);return db[_0x0fa5('0x31')]['create'](_0x2f1d55)[_0x0fa5('0x25')](function(_0x102b0c){var _0x32a2db={'role':_0x420323['body'][_0x0fa5('0x8d')],'userProfileId':_0x420323[_0x0fa5('0x8e')][_0x0fa5('0x8f')]};if(!_0x32a2db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32a2db['role']===_0x0fa5('0x90')){var _0x20b25e=_0x102b0c[_0x0fa5('0x27')]({'plain':!![]});return db[_0x0fa5('0x91')][_0x0fa5('0x4c')]({'where':{'name':_0x0fa5('0x28'),'userProfileId':_0x32a2db[_0x0fa5('0x8f')]},'raw':!![]})[_0x0fa5('0x25')](function(_0x1a2778){if(_0x1a2778&&_0x1a2778[_0x0fa5('0x92')]===0x0){return db[_0x0fa5('0x93')][_0x0fa5('0x94')]({'name':_0x20b25e['name'],'resourceId':_0x20b25e['id'],'type':_0x1a2778[_0x0fa5('0x2d')],'sectionId':_0x1a2778['id']},{})['then'](function(){return _0x102b0c;});}else{return _0x102b0c;}})[_0x0fa5('0x4a')](function(_0xa7ffa5){logger[_0x0fa5('0x2b')](_0x0fa5('0x95'),_0xa7ffa5);throw _0xa7ffa5;});}return _0x102b0c;})[_0x0fa5('0x25')](respondWithResult(_0x55fd86,null))[_0x0fa5('0x4a')](handleError(_0x55fd86,null));}});}catch(_0x13f33c){_0x55fd86[_0x0fa5('0x1c')](0x1f4)[_0x0fa5('0x2e')](_0x13f33c);}};function removeReferences(_0x24bd0d,_0x5e3b4c){try{if(_0x24bd0d){fs[_0x0fa5('0x96')](_0x24bd0d);logger[_0x0fa5('0x62')](_0x0fa5('0x97'));}if(_0x5e3b4c){rimraf(_0x5e3b4c,function(){});logger['info'](_0x0fa5('0x98'));}}catch(_0x6d1015){logger[_0x0fa5('0x2b')](_0x6d1015);}}exports[_0x0fa5('0x24')]=function(_0xb422f6,_0x286a4c,_0x451fd4){return db[_0x0fa5('0x31')][_0x0fa5('0x4c')]({'where':{'id':_0xb422f6[_0x0fa5('0x4d')]['id']}})[_0x0fa5('0x25')](handleEntityNotFound(_0x286a4c,null))['then'](saveUpdates(_0xb422f6['body'],null))['then'](respondWithResult(_0x286a4c,null))[_0x0fa5('0x4a')](handleError(_0x286a4c,null));};exports[_0x0fa5('0x99')]=function(_0x5edfea,_0x14926c,_0x1202db){return db[_0x0fa5('0x31')][_0x0fa5('0x4c')]({'where':{'id':_0x5edfea['params']['id']}})['then'](function(_0x4a402e){if(_0x4a402e){return _0x4a402e['destroy']();}})[_0x0fa5('0x25')](function(_0x2e1332){rimraf(path[_0x0fa5('0x5b')](config['root'],_0x0fa5('0x5c'),path[_0x0fa5('0x5d')](_0x2e1332[_0x0fa5('0x4e')])),function(){});return _0x2e1332;})[_0x0fa5('0x25')](handleEntityNotFound(_0x14926c,null))[_0x0fa5('0x25')](respondWithStatusCode(_0x14926c,null))[_0x0fa5('0x4a')](handleError(_0x14926c,null));};exports[_0x0fa5('0x9a')]=function(_0x45945c,_0x4029bc,_0x415335){return BPromise[_0x0fa5('0x9b')]()['then'](function(){if(!_0x45945c[_0x0fa5('0x35')]['path']){throw new Error(_0x0fa5('0x9c'));}if(!_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x9d')]){throw new Error(_0x0fa5('0x9e'));}var _0x5dabf5=_0x45945c[_0x0fa5('0x35')]['hostname']?_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x9f')]+':'+_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x9d')]:_0x0fa5('0xa0')+_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x9d')];var _0x5d296e=_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x1d')]?_0x45945c['query'][_0x0fa5('0x1d')]:!![];var _0x39a01b=_0x45945c[_0x0fa5('0x35')]['encoding']?_0x45945c[_0x0fa5('0x35')]['encoding']:null;var _0x552788={'method':_0x45945c[_0x0fa5('0xa1')],'uri':util['format'](_0x0fa5('0xa2'),_0x5dabf5,_0x45945c['query'][_0x0fa5('0x4e')]),'json':_0x5d296e,'resolveWithFullResponse':!![],'encoding':_0x39a01b,'qs':_0x45945c[_0x0fa5('0x35')]};if(_0x45945c['headers']){_0x552788[_0x0fa5('0xa3')]=_0x45945c['headers'];if(_0x552788[_0x0fa5('0xa3')][_0x0fa5('0xa4')]){delete _0x552788[_0x0fa5('0xa3')][_0x0fa5('0xa4')];}}if(_0x552788[_0x0fa5('0xa3')][_0x0fa5('0xa5')]){delete _0x552788[_0x0fa5('0xa3')]['content-type'];}return rp(_0x552788);})[_0x0fa5('0x25')](function(_0x2feb84){if(_0x2feb84){_0x4029bc['set'](_0x2feb84[_0x0fa5('0xa3')]);logger[_0x0fa5('0x62')](_0x2feb84[_0x0fa5('0x8e')]);if(_[_0x0fa5('0xa6')](_0x45945c[_0x0fa5('0x35')][_0x0fa5('0x4e')],_0x0fa5('0x4b'))&&_0x2feb84['statusCode']==0x1f4){return _0x4029bc['sendStatus'](_0x2feb84[_0x0fa5('0xa7')]);}else{return _0x4029bc['status'](_0x2feb84[_0x0fa5('0xa7')])[_0x0fa5('0x2e')](_0x2feb84[_0x0fa5('0x8e')]);}}else{return _0x4029bc[_0x0fa5('0x2a')](0xc8);}})[_0x0fa5('0x4a')](handleError(_0x4029bc,null));};exports[_0x0fa5('0xa8')]=function(_0x4568de,_0x506d76,_0x529cbe){return BPromise[_0x0fa5('0x9b')]()[_0x0fa5('0x25')](function(){if(!_0x4568de[_0x0fa5('0x35')]['path']){throw new Error(_0x0fa5('0x9c'));}if(!_0x4568de[_0x0fa5('0x35')][_0x0fa5('0x9d')]){throw new Error(_0x0fa5('0x9e'));}var _0x56bc08=_0x4568de[_0x0fa5('0x35')][_0x0fa5('0x9f')]?_0x4568de[_0x0fa5('0x35')][_0x0fa5('0x9f')]+':'+_0x4568de['query'][_0x0fa5('0x9d')]:_0x0fa5('0xa0')+_0x4568de['query'][_0x0fa5('0x9d')];var _0x466692=_0x4568de[_0x0fa5('0x35')][_0x0fa5('0x1d')]?_0x4568de[_0x0fa5('0x35')][_0x0fa5('0x1d')]:!![];var _0x4c4e79=_0x4568de[_0x0fa5('0x35')][_0x0fa5('0xa9')]?_0x4568de[_0x0fa5('0x35')]['encoding']:null;var _0x531cf5={'method':_0x4568de[_0x0fa5('0xa1')],'uri':util[_0x0fa5('0x50')](_0x0fa5('0xa2'),_0x56bc08,_0x4568de['query']['path']),'json':_0x466692,'resolveWithFullResponse':!![],'encoding':_0x4c4e79,'body':_0x4568de[_0x0fa5('0x8e')]};if(_0x4568de[_0x0fa5('0xa3')]){_0x531cf5['headers']=_0x4568de[_0x0fa5('0xa3')];if(_0x531cf5['headers']['content-length']){delete _0x531cf5['headers'][_0x0fa5('0xa4')];}}if(_0x531cf5[_0x0fa5('0xa3')]['content-type']){delete _0x531cf5[_0x0fa5('0xa3')][_0x0fa5('0xa5')];}return rp(_0x531cf5);})[_0x0fa5('0x25')](function(_0x490b8e){if(_0x490b8e){_0x506d76[_0x0fa5('0x22')](_0x490b8e[_0x0fa5('0xa3')]);logger['info'](_0x490b8e[_0x0fa5('0x8e')]);return _0x506d76['status'](_0x490b8e[_0x0fa5('0xa7')])[_0x0fa5('0x2e')](_0x490b8e[_0x0fa5('0x8e')]);}else{return _0x506d76[_0x0fa5('0x2a')](0xc8);}})[_0x0fa5('0x4a')](handleError(_0x506d76,null));}; \ No newline at end of file +var _0x7309=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','status','end','json','offset','undefined','limit','count','set','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','join','root','server/files/plugins','format','basename','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','hostname'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x7309,0xae));var _0x9730=function(_0x504994,_0x25a31a){_0x504994=_0x504994-0x0;var _0x4f60bd=_0x7309[_0x504994];return _0x4f60bd;};'use strict';var emlformat=require(_0x9730('0x0'));var rimraf=require(_0x9730('0x1'));var zipdir=require(_0x9730('0x2'));var jsonpatch=require(_0x9730('0x3'));var rp=require(_0x9730('0x4'));var moment=require(_0x9730('0x5'));var BPromise=require(_0x9730('0x6'));var Mustache=require(_0x9730('0x7'));var util=require(_0x9730('0x8'));var path=require(_0x9730('0x9'));var sox=require(_0x9730('0xa'));var csv=require('to-csv');var ejs=require(_0x9730('0xb'));var fs=require('fs');var fs_extra=require(_0x9730('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9730('0xd'));var jsforce=require(_0x9730('0xe'));var deskjs=require(_0x9730('0xf'));var toCsv=require(_0x9730('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x9730('0x11'));var rimraf=require(_0x9730('0x1'));var archiver=require(_0x9730('0x12'));var Redis=require(_0x9730('0x13'));var authService=require(_0x9730('0x14'));var qs=require(_0x9730('0x15'));var as=require(_0x9730('0x16'));var hardwareService=require(_0x9730('0x17'));var logger=require(_0x9730('0x18'))(_0x9730('0x19'));var utils=require('../../config/utils');var config=require(_0x9730('0x1a'));var licenseUtil=require(_0x9730('0x1b'));var db=require(_0x9730('0x1c'))['db'];config[_0x9730('0x1d')]=_[_0x9730('0x1e')](config[_0x9730('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x9730('0x1f'))(new Redis(config[_0x9730('0x1d')]));require(_0x9730('0x20'))['register'](socket);function respondWithStatusCode(_0x369fe5,_0x52ed9d){_0x52ed9d=_0x52ed9d||0xcc;return function(_0x4db056){if(_0x4db056){return _0x369fe5['sendStatus'](_0x52ed9d);}return _0x369fe5[_0x9730('0x21')](_0x52ed9d)[_0x9730('0x22')]();};}function respondWithResult(_0x2caf9d,_0x2ac6bb){_0x2ac6bb=_0x2ac6bb||0xc8;return function(_0x2e1688){if(_0x2e1688){return _0x2caf9d['status'](_0x2ac6bb)[_0x9730('0x23')](_0x2e1688);}};}function respondWithFilteredResult(_0x5eb56e,_0x583d52){return function(_0x2521a3){if(_0x2521a3){var _0x24b1f0=typeof _0x583d52[_0x9730('0x24')]===_0x9730('0x25')&&typeof _0x583d52[_0x9730('0x26')]===_0x9730('0x25');var _0x548a6e=_0x2521a3[_0x9730('0x27')];var _0x3f7719=_0x24b1f0?0x0:_0x583d52[_0x9730('0x24')];var _0x2b9f22=_0x24b1f0?_0x2521a3[_0x9730('0x27')]:_0x583d52[_0x9730('0x24')]+_0x583d52[_0x9730('0x26')];var _0x245c6b;if(_0x2b9f22>=_0x548a6e){_0x2b9f22=_0x548a6e;_0x245c6b=0xc8;}else{_0x245c6b=0xce;}_0x5eb56e[_0x9730('0x21')](_0x245c6b);return _0x5eb56e[_0x9730('0x28')]('Content-Range',_0x3f7719+'-'+_0x2b9f22+'/'+_0x548a6e)[_0x9730('0x23')](_0x2521a3);}return null;};}function patchUpdates(_0x1f54b6){return function(_0x11999a){try{jsonpatch['apply'](_0x11999a,_0x1f54b6,!![]);}catch(_0xe79fb9){return BPromise['reject'](_0xe79fb9);}return _0x11999a['save']();};}function saveUpdates(_0x189ebc,_0x10f416){return function(_0x413c22){if(_0x413c22){return _0x413c22[_0x9730('0x29')](_0x189ebc)[_0x9730('0x2a')](function(_0x3d20e7){return _0x3d20e7;});}return null;};}function removeEntity(_0x22a3b6,_0x1153ef){return function(_0x25e413){if(_0x25e413){return _0x25e413['destroy']()[_0x9730('0x2a')](function(){var _0x46cc0c=_0x25e413[_0x9730('0x2b')]({'plain':!![]});var _0x29d33e='Plugins';return db[_0x9730('0x2c')][_0x9730('0x2d')]({'where':{'type':_0x29d33e,'resourceId':_0x46cc0c['id']}})[_0x9730('0x2a')](function(){return _0x25e413;});})[_0x9730('0x2a')](function(){_0x22a3b6[_0x9730('0x21')](0xcc)[_0x9730('0x22')]();});}};}function handleEntityNotFound(_0x57bf0e,_0x3bf5c0){return function(_0x39313e){if(!_0x39313e){_0x57bf0e[_0x9730('0x2e')](0x194);}return _0x39313e;};}function handleError(_0x283751,_0x2adeb3){_0x2adeb3=_0x2adeb3||0x1f4;return function(_0x134593){logger['error'](_0x134593[_0x9730('0x2f')]);if(_0x134593['name']){delete _0x134593[_0x9730('0x30')];}_0x283751[_0x9730('0x21')](_0x2adeb3)['send'](_0x134593);};}exports[_0x9730('0x31')]=function(_0x1a19fb,_0x2ce981){var _0x353cf2={},_0x2f9b25={},_0x1edacc={'count':0x0,'rows':[]};var _0x1e522b=_[_0x9730('0x32')](db[_0x9730('0x33')][_0x9730('0x34')],function(_0xa6f4f0){return{'name':_0xa6f4f0[_0x9730('0x35')],'type':_0xa6f4f0[_0x9730('0x36')][_0x9730('0x37')]};});_0x2f9b25[_0x9730('0x38')]=_['map'](_0x1e522b,_0x9730('0x30'));_0x2f9b25[_0x9730('0x39')]=_['keys'](_0x1a19fb['query']);_0x2f9b25[_0x9730('0x3a')]=_[_0x9730('0x3b')](_0x2f9b25[_0x9730('0x38')],_0x2f9b25[_0x9730('0x39')]);_0x353cf2[_0x9730('0x3c')]=_[_0x9730('0x3b')](_0x2f9b25[_0x9730('0x38')],qs[_0x9730('0x3d')](_0x1a19fb[_0x9730('0x39')][_0x9730('0x3d')]));_0x353cf2[_0x9730('0x3c')]=_0x353cf2[_0x9730('0x3c')][_0x9730('0x3e')]?_0x353cf2['attributes']:_0x2f9b25['model'];if(!_0x1a19fb[_0x9730('0x39')][_0x9730('0x3f')](_0x9730('0x40'))){_0x353cf2[_0x9730('0x26')]=qs[_0x9730('0x26')](_0x1a19fb[_0x9730('0x39')][_0x9730('0x26')]);_0x353cf2[_0x9730('0x24')]=qs['offset'](_0x1a19fb[_0x9730('0x39')][_0x9730('0x24')]);}_0x353cf2['order']=qs[_0x9730('0x41')](_0x1a19fb['query']['sort']);_0x353cf2[_0x9730('0x42')]=qs[_0x9730('0x3a')](_[_0x9730('0x43')](_0x1a19fb[_0x9730('0x39')],_0x2f9b25[_0x9730('0x3a')]),_0x1e522b);if(_0x1a19fb[_0x9730('0x39')][_0x9730('0x44')]){_0x353cf2[_0x9730('0x42')]=_[_0x9730('0x45')](_0x353cf2[_0x9730('0x42')],{'$or':_[_0x9730('0x32')](_0x1e522b,function(_0x3e66ff){if(_0x3e66ff[_0x9730('0x36')]!==_0x9730('0x46')){var _0x4f77da={};_0x4f77da[_0x3e66ff[_0x9730('0x30')]]={'$like':'%'+_0x1a19fb[_0x9730('0x39')]['filter']+'%'};return _0x4f77da;}})});}_0x353cf2=_[_0x9730('0x45')]({},_0x353cf2,_0x1a19fb[_0x9730('0x47')]);var _0x5c00f7={'where':_0x353cf2[_0x9730('0x42')]};return db[_0x9730('0x33')][_0x9730('0x27')](_0x5c00f7)[_0x9730('0x2a')](function(_0x1fb8a3){_0x1edacc[_0x9730('0x27')]=_0x1fb8a3;if(_0x1a19fb[_0x9730('0x39')][_0x9730('0x48')]){_0x353cf2[_0x9730('0x49')]=[{'all':!![]}];}return db[_0x9730('0x33')]['findAll'](_0x353cf2);})['then'](function(_0x2bfe66){_0x1edacc[_0x9730('0x4a')]=_0x2bfe66;return _0x1edacc;})['then'](respondWithFilteredResult(_0x2ce981,_0x353cf2))['catch'](handleError(_0x2ce981,null));};exports[_0x9730('0x4b')]=function(_0x2efe11,_0x59224e){var _0x5eb83a={'raw':!![],'where':{'id':_0x2efe11[_0x9730('0x4c')]['id']}},_0x118bc6={};_0x118bc6[_0x9730('0x38')]=_[_0x9730('0x4d')](db[_0x9730('0x33')][_0x9730('0x34')]);_0x118bc6[_0x9730('0x39')]=_[_0x9730('0x4d')](_0x2efe11[_0x9730('0x39')]);_0x118bc6[_0x9730('0x3a')]=_[_0x9730('0x3b')](_0x118bc6[_0x9730('0x38')],_0x118bc6['query']);_0x5eb83a[_0x9730('0x3c')]=_[_0x9730('0x3b')](_0x118bc6[_0x9730('0x38')],qs[_0x9730('0x3d')](_0x2efe11[_0x9730('0x39')][_0x9730('0x3d')]));_0x5eb83a[_0x9730('0x3c')]=_0x5eb83a[_0x9730('0x3c')][_0x9730('0x3e')]?_0x5eb83a[_0x9730('0x3c')]:_0x118bc6[_0x9730('0x38')];if(_0x2efe11[_0x9730('0x39')][_0x9730('0x48')]){_0x5eb83a[_0x9730('0x49')]=[{'all':!![]}];}_0x5eb83a=_['merge']({},_0x5eb83a,_0x2efe11[_0x9730('0x47')]);return db[_0x9730('0x33')][_0x9730('0x4e')](_0x5eb83a)['then'](handleEntityNotFound(_0x59224e,null))[_0x9730('0x2a')](respondWithResult(_0x59224e,null))[_0x9730('0x4f')](handleError(_0x59224e,null));};exports['download']=function(_0x7722fd,_0x1627a2,_0x2628b7){return db['Plugin'][_0x9730('0x4e')]({'where':{'id':_0x7722fd[_0x9730('0x4c')]['id']},'attributes':[_0x9730('0x30'),_0x9730('0x9')],'raw':!![]})[_0x9730('0x2a')](handleEntityNotFound(_0x1627a2,null))[_0x9730('0x2a')](function(_0x4cb20d){if(_0x4cb20d){var _0x31e4b0=path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),util[_0x9730('0x53')]('%s.zip',path[_0x9730('0x54')](_0x4cb20d['path'])));var _0x2255be=fs['createWriteStream'](_0x31e4b0);var _0x124476=archiver(_0x9730('0x55'),{'zlib':{'level':0x9}});_0x124476['on']('warning',function(_0x122d81){if(_0x122d81[_0x9730('0x56')]===_0x9730('0x57')){logger[_0x9730('0x58')](_0x122d81);}else{throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x5b'));}});_0x124476['on'](_0x9730('0x58'),function(_0x5f5a6f){throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x5b'));});_0x124476[_0x9730('0x5c')](_0x2255be);_0x124476[_0x9730('0x5d')](_0x9730('0x5e'),{'cwd':path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),path[_0x9730('0x5f')](_0x4cb20d['path'])),'ignore':[path['join'](path[_0x9730('0x54')](_0x4cb20d[_0x9730('0x9')]),_0x9730('0x60')),path['join'](path[_0x9730('0x54')](_0x4cb20d['path']),_0x9730('0x61'))],'nodir':!![]})['finalize']();_0x2255be['on'](_0x9730('0x62'),function(){if(!fs[_0x9730('0x63')](_0x31e4b0)){throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x64'));}return _0x1627a2[_0x9730('0x65')](_0x31e4b0,util[_0x9730('0x53')](_0x9730('0x66'),path[_0x9730('0x54')](_0x4cb20d[_0x9730('0x9')])),function(_0x51bac3){if(_0x51bac3){throw new db['Sequelize'][(_0x9730('0x5a'))](_0x9730('0x67'));}fs[_0x9730('0x68')](_0x31e4b0);logger['info'](_0x9730('0x69'));logger[_0x9730('0x6a')](_0x9730('0x6b'));});});}return null;})[_0x9730('0x4f')](handleError(_0x1627a2,null));};exports[_0x9730('0x6c')]=function(_0x577d4b,_0x34af0c,_0xdf2e9a){var _0x32d0ec=path[_0x9730('0x54')](_0x577d4b[_0x9730('0x6d')][_0x9730('0x6e')],path[_0x9730('0x6f')](_0x577d4b['file'][_0x9730('0x6e')]));var _0x621fc9=path[_0x9730('0x50')](config['root'],_0x9730('0x52'),_0x577d4b[_0x9730('0x6d')][_0x9730('0x6e')]);var _0x1c3afc=path[_0x9730('0x50')](config['root'],_0x9730('0x52'),_0x32d0ec);logger[_0x9730('0x6a')](_0x9730('0x70'),_0x621fc9);logger['info'](_0x9730('0x71'),_0x1c3afc);try{fs[_0x9730('0x72')](_0x621fc9,parseInt(_0x9730('0x73'),0x8));extract(_0x621fc9,{'dir':_0x1c3afc},function(_0x4ff70c){if(_0x4ff70c){logger[_0x9730('0x58')](_0x4ff70c);handleError(_0x4ff70c,!![]);};var _0x12536e=fs[_0x9730('0x74')](_0x1c3afc);if(_0x12536e[_0x9730('0x3e')]>0x1){removeReferences(_0x621fc9,_0x1c3afc);logger['error'](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}var _0x59a796=fs['lstatSync'](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0]));if(_0x59a796[_0x9730('0x76')]()){removeReferences(_0x621fc9,_0x1c3afc);logger[_0x9730('0x58')](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}if(_0x59a796[_0x9730('0x77')]()){var _0x3f7c13=fs[_0x9730('0x74')](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0]));if(_0x3f7c13['length']===0x0){removeReferences(_0x621fc9,_0x1c3afc);logger['error'](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}var _0x214387=_0x3f7c13[_0x9730('0x78')](function(_0xf95ca4){return _0xf95ca4===_0x9730('0x79');});if(!_0x214387){return _0xdf2e9a(new Error(_0x9730('0x7a')));}var _0x37b2d6=fs[_0x9730('0x7b')](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0],_0x9730('0x79')));var _0x454b0c=JSON[_0x9730('0x7c')](_0x37b2d6);if('undefined'==typeof _0x454b0c[_0x9730('0x30')]){return _0xdf2e9a(new Error(_0x9730('0x7d')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x36')]){return _0xdf2e9a(new Error(_0x9730('0x7e')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x7f')]){return _0xdf2e9a(new Error(_0x9730('0x80')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')]){return _0xdf2e9a(new Error(_0x9730('0x82')));}if(_0x454b0c['type']===_0x9730('0x83')){if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]){return _0xdf2e9a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]['admin']&&_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')]){return _0xdf2e9a(new Error(_0x9730('0x86')));}}else if(_0x454b0c[_0x9730('0x36')]===_0x9730('0x87')){if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')]['scriptName']){return _0xdf2e9a(new Error(_0x9730('0x88')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x89')]){return _0xdf2e9a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xdf2e9a(new Error(_0x9730('0x8a')));}var _0x3875a5=_0x454b0c[_0x9730('0x30')];var _0x392b13=_0x454b0c[_0x9730('0x8b')];var _0x175cee=_0x454b0c[_0x9730('0x36')];var _0x2e1de3=_0x454b0c[_0x9730('0x8c')]?_0x454b0c[_0x9730('0x8c')]:_0x9730('0x8d');var _0x415ffc=_0x454b0c[_0x9730('0x8e')]?_0x454b0c[_0x9730('0x8e')]:_0x9730('0x8f');var _0x45e30e='';var _0x56efde='';var _0x72fefd='';var _0x51007b='';var _0x3a65ae=_0x454b0c[_0x9730('0x7f')];if(_0x175cee===_0x9730('0x83')){if('undefined'!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x90')]){var _0x4eb752=_0x454b0c[_0x9730('0x81')]['views'][_0x9730('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4eb752)){_0x45e30e=path[_0x9730('0x50')]('plugins',_0x32d0ec,_0x12536e[0x0],_0x4eb752);}else{_0x45e30e=_0x4eb752;}}else{logger['info'](_0x9730('0x91'));}if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')]){var _0x368835=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x368835)){_0x56efde=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x368835);}else{_0x56efde=_0x368835;}}else{logger['info'](_0x9730('0x93'));}}else if(_0x175cee===_0x9730('0x87')){_0x72fefd=_0x454b0c['parameters'][_0x9730('0x94')];_0x51007b=_0x454b0c[_0x9730('0x81')]['scriptPath'];if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]){if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]['admin']){var _0x4eb752=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4eb752)){_0x45e30e=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x4eb752);}else{_0x45e30e=_0x4eb752;}}if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')]['views'][_0x9730('0x85')]){var _0x368835=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x368835)){_0x56efde=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x368835);}else{_0x56efde=_0x368835;}}}}var _0x399ed6={'name':_0x3875a5,'description':_0x392b13,'path':path[_0x9730('0x50')](_0x32d0ec,_0x12536e[0x0]),'type':_0x175cee,'sidebar':_0x2e1de3,'icon':_0x415ffc,'adminUrl':_0x45e30e,'agentUrl':_0x56efde,'scriptName':_0x72fefd,'scriptPath':_0x51007b,'version':_0x3a65ae};removeReferences(_0x621fc9,null);return db[_0x9730('0x33')][_0x9730('0x95')](_0x399ed6)['then'](function(_0x4e9f83){var _0x3c2916={'role':_0x577d4b[_0x9730('0x96')]['role'],'userProfileId':_0x577d4b['body'][_0x9730('0x97')]};if(!_0x3c2916)throw new Error(_0x9730('0x98'));if(_0x3c2916['role']===_0x9730('0x99')){var _0xb1a44e=_0x4e9f83[_0x9730('0x2b')]({'plain':!![]});return db[_0x9730('0x9a')][_0x9730('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x3c2916[_0x9730('0x97')]},'raw':!![]})['then'](function(_0x5093b9){if(_0x5093b9&&_0x5093b9[_0x9730('0x9b')]===0x0){return db[_0x9730('0x2c')][_0x9730('0x95')]({'name':_0xb1a44e[_0x9730('0x30')],'resourceId':_0xb1a44e['id'],'type':_0x5093b9[_0x9730('0x30')],'sectionId':_0x5093b9['id']},{})[_0x9730('0x2a')](function(){return _0x4e9f83;});}else{return _0x4e9f83;}})[_0x9730('0x4f')](function(_0x463dcc){logger[_0x9730('0x58')](_0x9730('0x9c'),_0x463dcc);throw _0x463dcc;});}return _0x4e9f83;})[_0x9730('0x2a')](respondWithResult(_0x34af0c,null))[_0x9730('0x4f')](handleError(_0x34af0c,null));}});}catch(_0x3fe787){_0x34af0c['status'](0x1f4)['send'](_0x3fe787);}};function removeReferences(_0x3e5791,_0x4668a3){try{if(_0x3e5791){fs[_0x9730('0x68')](_0x3e5791);logger[_0x9730('0x6a')](_0x9730('0x9d'));}if(_0x4668a3){rimraf(_0x4668a3,function(){});logger[_0x9730('0x6a')](_0x9730('0x9e'));}}catch(_0x4c36bb){logger[_0x9730('0x58')](_0x4c36bb);}}exports[_0x9730('0x29')]=function(_0x422504,_0x4ea4d3,_0x315d5e){return db['Plugin'][_0x9730('0x4e')]({'where':{'id':_0x422504[_0x9730('0x4c')]['id']}})[_0x9730('0x2a')](handleEntityNotFound(_0x4ea4d3,null))['then'](saveUpdates(_0x422504['body'],null))[_0x9730('0x2a')](respondWithResult(_0x4ea4d3,null))[_0x9730('0x4f')](handleError(_0x4ea4d3,null));};exports['delete']=function(_0x14c270,_0xd210e1,_0x417998){return db[_0x9730('0x33')][_0x9730('0x4e')]({'where':{'id':_0x14c270[_0x9730('0x4c')]['id']}})[_0x9730('0x2a')](function(_0x47e84e){if(_0x47e84e){return _0x47e84e[_0x9730('0x2d')]();}})[_0x9730('0x2a')](function(_0x5d7baa){rimraf(path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),path[_0x9730('0x5f')](_0x5d7baa[_0x9730('0x9')])),function(){});return _0x5d7baa;})[_0x9730('0x2a')](handleEntityNotFound(_0xd210e1,null))['then'](respondWithStatusCode(_0xd210e1,null))['catch'](handleError(_0xd210e1,null));};exports['webhookGet']=function(_0x25dd70,_0x36fd42,_0x1bc3c0){return BPromise[_0x9730('0x9f')]()[_0x9730('0x2a')](function(){if(!_0x25dd70[_0x9730('0x39')][_0x9730('0x9')]){throw new Error(_0x9730('0xa0'));}if(!_0x25dd70['query'][_0x9730('0xa1')]){throw new Error(_0x9730('0xa2'));}var _0x1c7c59=_0x25dd70[_0x9730('0x39')]['hostname']?_0x25dd70[_0x9730('0x39')]['hostname']+':'+_0x25dd70[_0x9730('0x39')][_0x9730('0xa1')]:_0x9730('0xa3')+_0x25dd70['query'][_0x9730('0xa1')];var _0x13ab38=_0x25dd70[_0x9730('0x39')][_0x9730('0x23')]?_0x25dd70['query'][_0x9730('0x23')]:!![];var _0xa2f5e3=_0x25dd70[_0x9730('0x39')]['encoding']?_0x25dd70[_0x9730('0x39')][_0x9730('0xa4')]:null;var _0x46c910={'method':_0x25dd70[_0x9730('0xa5')],'uri':util[_0x9730('0x53')](_0x9730('0xa6'),_0x1c7c59,_0x25dd70['query']['path']),'json':_0x13ab38,'resolveWithFullResponse':!![],'encoding':_0xa2f5e3,'qs':_0x25dd70[_0x9730('0x39')]};if(_0x25dd70[_0x9730('0xa7')]){_0x46c910['headers']=_0x25dd70[_0x9730('0xa7')];if(_0x46c910['headers'][_0x9730('0xa8')]){delete _0x46c910[_0x9730('0xa7')][_0x9730('0xa8')];}}if(_0x46c910[_0x9730('0xa7')][_0x9730('0xa9')]){delete _0x46c910['headers']['content-type'];}return rp(_0x46c910);})[_0x9730('0x2a')](function(_0x50f4e5){if(_0x50f4e5){_0x36fd42[_0x9730('0x28')](_0x50f4e5[_0x9730('0xa7')]);logger[_0x9730('0x6a')](_0x50f4e5[_0x9730('0x96')]);if(_[_0x9730('0xaa')](_0x25dd70[_0x9730('0x39')]['path'],_0x9730('0x65'))&&_0x50f4e5[_0x9730('0xab')]==0x1f4){return _0x36fd42[_0x9730('0x2e')](_0x50f4e5[_0x9730('0xab')]);}else{return _0x36fd42['status'](_0x50f4e5['statusCode'])[_0x9730('0xac')](_0x50f4e5[_0x9730('0x96')]);}}else{return _0x36fd42[_0x9730('0x2e')](0xc8);}})[_0x9730('0x4f')](handleError(_0x36fd42,null));};exports['webhookPost']=function(_0x32071a,_0x47e3cf,_0x18da1c){return BPromise[_0x9730('0x9f')]()[_0x9730('0x2a')](function(){if(!_0x32071a[_0x9730('0x39')][_0x9730('0x9')]){throw new Error(_0x9730('0xa0'));}if(!_0x32071a['query'][_0x9730('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3544e4=_0x32071a[_0x9730('0x39')][_0x9730('0xad')]?_0x32071a[_0x9730('0x39')][_0x9730('0xad')]+':'+_0x32071a[_0x9730('0x39')]['port']:'http://localhost:'+_0x32071a[_0x9730('0x39')][_0x9730('0xa1')];var _0x4401f2=_0x32071a[_0x9730('0x39')][_0x9730('0x23')]?_0x32071a['query'][_0x9730('0x23')]:!![];var _0x2e99e8=_0x32071a[_0x9730('0x39')]['encoding']?_0x32071a[_0x9730('0x39')][_0x9730('0xa4')]:null;var _0x1dd1ab={'method':_0x32071a[_0x9730('0xa5')],'uri':util[_0x9730('0x53')]('%s%s',_0x3544e4,_0x32071a[_0x9730('0x39')][_0x9730('0x9')]),'json':_0x4401f2,'resolveWithFullResponse':!![],'encoding':_0x2e99e8,'body':_0x32071a[_0x9730('0x96')]};if(_0x32071a[_0x9730('0xa7')]){_0x1dd1ab[_0x9730('0xa7')]=_0x32071a['headers'];if(_0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa8')]){delete _0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa8')];}}if(_0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa9')]){delete _0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa9')];}return rp(_0x1dd1ab);})[_0x9730('0x2a')](function(_0x2bc178){if(_0x2bc178){_0x47e3cf['set'](_0x2bc178[_0x9730('0xa7')]);logger['info'](_0x2bc178[_0x9730('0x96')]);return _0x47e3cf[_0x9730('0x21')](_0x2bc178[_0x9730('0xab')])[_0x9730('0xac')](_0x2bc178['body']);}else{return _0x47e3cf[_0x9730('0x2e')](0xc8);}})[_0x9730('0x4f')](handleError(_0x47e3cf,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 363c415..5081862 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 _0x9e54=['update','remove','emit','exports','events','../../mysqldb'];(function(_0x447df8,_0x19a273){var _0x58f7a8=function(_0x932d3d){while(--_0x932d3d){_0x447df8['push'](_0x447df8['shift']());}};_0x58f7a8(++_0x19a273);}(_0x9e54,0x88));var _0x49e5=function(_0x44b355,_0x384ab1){_0x44b355=_0x44b355-0x0;var _0x5ae379=_0x9e54[_0x44b355];return _0x5ae379;};'use strict';var EventEmitter=require(_0x49e5('0x0'));var Plugin=require(_0x49e5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49e5('0x2'),'afterDestroy':_0x49e5('0x3')};function emitEvent(_0x36eeb6){return function(_0x5cd518,_0x377300,_0x31b5c4){PluginEvents['emit'](_0x36eeb6+':'+_0x5cd518['id'],_0x5cd518);PluginEvents[_0x49e5('0x4')](_0x36eeb6,_0x5cd518);_0x31b5c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x49e5('0x5')]=PluginEvents; \ No newline at end of file +var _0xc962=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x537b8f,_0x20568a){var _0x17e8e0=function(_0x80e62c){while(--_0x80e62c){_0x537b8f['push'](_0x537b8f['shift']());}};_0x17e8e0(++_0x20568a);}(_0xc962,0x6d));var _0x2c96=function(_0x2f8084,_0x4ce042){_0x2f8084=_0x2f8084-0x0;var _0xd474df=_0xc962[_0x2f8084];return _0xd474df;};'use strict';var EventEmitter=require(_0x2c96('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c96('0x1'),'afterUpdate':_0x2c96('0x2'),'afterDestroy':_0x2c96('0x3')};function emitEvent(_0x1a1faf){return function(_0x305702,_0x83568f,_0x451d99){PluginEvents[_0x2c96('0x4')](_0x1a1faf+':'+_0x305702['id'],_0x305702);PluginEvents['emit'](_0x1a1faf,_0x305702);_0x451d99(null);};}for(var e in events){if(events[_0x2c96('0x5')](e)){var event=events[e];Plugin[_0x2c96('0x6')](e,emitEvent(event));}}module[_0x2c96('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 02c48b8..6a41676 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 _0x1433=['plugins','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x4871f4,_0x2c1f0){var _0x565f30=function(_0x61e2ed){while(--_0x61e2ed){_0x4871f4['push'](_0x4871f4['shift']());}};_0x565f30(++_0x2c1f0);}(_0x1433,0x121));var _0x3143=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1433[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0637=['bluebird','request-promise','path','./plugin.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x0637,0x7e));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require('util');var logger=require(_0x7063('0x1'))(_0x7063('0x2'));var moment=require(_0x7063('0x3'));var BPromise=require(_0x7063('0x4'));var rp=require(_0x7063('0x5'));var fs=require('fs');var path=require(_0x7063('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7063('0x7'));module[_0x7063('0x8')]=function(_0x4b8552,_0x11e9f){return _0x4b8552[_0x7063('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 5c02f56..ba826e8 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 _0xf86b=['info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreatePlugin','Plugin','create','body','options','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./plugin.socket','register','request','then'];(function(_0x2d1f6f,_0x239dec){var _0x2b8c80=function(_0x2bb5ce){while(--_0x2bb5ce){_0x2d1f6f['push'](_0x2d1f6f['shift']());}};_0x2b8c80(++_0x239dec);}(_0xf86b,0xd7));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf86('0x0'));var BPromise=require(_0xbf86('0x1'));var rs=require(_0xbf86('0x2'));var fs=require('fs');var Redis=require(_0xbf86('0x3'));var db=require(_0xbf86('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf86('0x5'));var config=require(_0xbf86('0x6'));var jayson=require(_0xbf86('0x7'));var client=jayson[_0xbf86('0x8')][_0xbf86('0x9')]({'port':0x232a});config[_0xbf86('0xa')]=_['defaults'](config[_0xbf86('0xa')],{'host':_0xbf86('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbf86('0xc'))[_0xbf86('0xd')](socket);function respondWithRpcPromise(_0x148b5a,_0x534c8b,_0x5d7d88){return new BPromise(function(_0x551125,_0x1c6cf1){return client[_0xbf86('0xe')](_0x148b5a,_0x5d7d88)[_0xbf86('0xf')](function(_0x2fed08){logger[_0xbf86('0x10')](_0xbf86('0x11'),_0x534c8b,'request\x20sent');logger[_0xbf86('0x12')](_0xbf86('0x13'),_0x534c8b,_0xbf86('0x14'),JSON[_0xbf86('0x15')](_0x2fed08));if(_0x2fed08['error']){if(_0x2fed08['error'][_0xbf86('0x16')]===0x1f4){logger[_0xbf86('0x17')](_0xbf86('0x11'),_0x534c8b,_0x2fed08[_0xbf86('0x17')][_0xbf86('0x18')]);return _0x1c6cf1(_0x2fed08[_0xbf86('0x17')][_0xbf86('0x18')]);}logger[_0xbf86('0x17')](_0xbf86('0x11'),_0x534c8b,_0x2fed08[_0xbf86('0x17')][_0xbf86('0x18')]);return _0x551125(_0x2fed08[_0xbf86('0x17')][_0xbf86('0x18')]);}else{logger[_0xbf86('0x10')](_0xbf86('0x11'),_0x534c8b,'request\x20sent');_0x551125(_0x2fed08[_0xbf86('0x19')]['message']);}})['catch'](function(_0x2691a3){logger['error'](_0xbf86('0x11'),_0x534c8b,_0x2691a3);_0x1c6cf1(_0x2691a3);});});}exports[_0xbf86('0x1a')]=function(_0x405587){var _0x6f5492=this;return new Promise(function(_0x2435d4,_0x4cba21){return db[_0xbf86('0x1b')][_0xbf86('0x1c')](_0x405587[_0xbf86('0x1d')],{'raw':_0x405587[_0xbf86('0x1e')]?_0x405587['options'][_0xbf86('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x51759c){logger[_0xbf86('0x10')](_0xbf86('0x1a'),_0x405587);logger[_0xbf86('0x12')]('CreatePlugin',_0x405587,JSON[_0xbf86('0x15')](_0x51759c));_0x2435d4(_0x51759c);})[_0xbf86('0x20')](function(_0x132127){logger['error']('CreatePlugin',_0x132127[_0xbf86('0x18')],_0x405587);_0x4cba21(_0x6f5492['error'](0x1f4,_0x132127[_0xbf86('0x18')]));});});}; \ No newline at end of file +var _0x2a50=['defaults','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x13aa63,_0x4b64aa){var _0x34cda2=function(_0x121d0a){while(--_0x121d0a){_0x13aa63['push'](_0x13aa63['shift']());}};_0x34cda2(++_0x4b64aa);}(_0x2a50,0xe6));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x02a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x02a5('0x1'));var rs=require(_0x02a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02a5('0x3'))['db'];var utils=require(_0x02a5('0x4'));var logger=require(_0x02a5('0x5'))(_0x02a5('0x6'));var config=require(_0x02a5('0x7'));var jayson=require(_0x02a5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x02a5('0x9')]=_[_0x02a5('0xa')](config[_0x02a5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x02a5('0xb'))(new Redis(config[_0x02a5('0x9')]));require('./plugin.socket')[_0x02a5('0xc')](socket);function respondWithRpcPromise(_0x1e4aea,_0x3a8f8a,_0x40b414){return new BPromise(function(_0x5dca0f,_0x43f2f5){return client[_0x02a5('0xd')](_0x1e4aea,_0x40b414)['then'](function(_0x1886ca){logger[_0x02a5('0xe')](_0x02a5('0xf'),_0x3a8f8a,_0x02a5('0x10'));logger[_0x02a5('0x11')](_0x02a5('0x12'),_0x3a8f8a,_0x02a5('0x10'),JSON[_0x02a5('0x13')](_0x1886ca));if(_0x1886ca[_0x02a5('0x14')]){if(_0x1886ca[_0x02a5('0x14')]['code']===0x1f4){logger[_0x02a5('0x14')](_0x02a5('0xf'),_0x3a8f8a,_0x1886ca[_0x02a5('0x14')]['message']);return _0x43f2f5(_0x1886ca['error'][_0x02a5('0x15')]);}logger[_0x02a5('0x14')]('Plugin,\x20%s,\x20%s',_0x3a8f8a,_0x1886ca[_0x02a5('0x14')][_0x02a5('0x15')]);return _0x5dca0f(_0x1886ca[_0x02a5('0x14')][_0x02a5('0x15')]);}else{logger[_0x02a5('0xe')](_0x02a5('0xf'),_0x3a8f8a,'request\x20sent');_0x5dca0f(_0x1886ca[_0x02a5('0x16')][_0x02a5('0x15')]);}})[_0x02a5('0x17')](function(_0x3414a5){logger['error']('Plugin,\x20%s,\x20%s',_0x3a8f8a,_0x3414a5);_0x43f2f5(_0x3414a5);});});}exports[_0x02a5('0x18')]=function(_0x528b70){var _0x1bad3a=this;return new Promise(function(_0x51ee84,_0x218e27){return db[_0x02a5('0x19')][_0x02a5('0x1a')](_0x528b70[_0x02a5('0x1b')],{'raw':_0x528b70[_0x02a5('0x1c')]?_0x528b70[_0x02a5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x02a5('0x1d')](function(_0x1d64f9){logger[_0x02a5('0xe')](_0x02a5('0x18'),_0x528b70);logger[_0x02a5('0x11')](_0x02a5('0x18'),_0x528b70,JSON[_0x02a5('0x13')](_0x1d64f9));_0x51ee84(_0x1d64f9);})[_0x02a5('0x17')](function(_0x3f9a8a){logger[_0x02a5('0x14')](_0x02a5('0x18'),_0x3f9a8a[_0x02a5('0x15')],_0x528b70);_0x218e27(_0x1bad3a['error'](0x1f4,_0x3f9a8a[_0x02a5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ce239b8..9ac652e 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 _0x58a3=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x58a3,0x17f));var _0x358a=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x58a3[_0x50007c];return _0x5c1ec7;};'use strict';var PluginEvents=require(_0x358a('0x0'));var events=['save',_0x358a('0x1'),_0x358a('0x2')];function createListener(_0x33a9e8,_0x58a46e){return function(_0x595cb7){_0x58a46e[_0x358a('0x3')](_0x33a9e8,_0x595cb7);};}function removeListener(_0x4220cf,_0xcd14e5){return function(){PluginEvents[_0x358a('0x4')](_0x4220cf,_0xcd14e5);};}exports[_0x358a('0x5')]=function(_0x51afbb){for(var _0x5f144a=0x0,_0x69fe73=events[_0x358a('0x6')];_0x5f144a<_0x69fe73;_0x5f144a++){var _0x5ac090=events[_0x5f144a];var _0x3c6dc5=createListener(_0x358a('0x7')+_0x5ac090,_0x51afbb);PluginEvents['on'](_0x5ac090,_0x3c6dc5);}}; \ No newline at end of file +var _0x3d5d=['plugin:','./plugin.events','save','remove','update','emit','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d5d,0x1b3));var _0xd3d5=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x3d5d[_0x4bfe08];return _0x1f9125;};'use strict';var PluginEvents=require(_0xd3d5('0x0'));var events=[_0xd3d5('0x1'),_0xd3d5('0x2'),_0xd3d5('0x3')];function createListener(_0x534021,_0x328889){return function(_0x5f3fd7){_0x328889[_0xd3d5('0x4')](_0x534021,_0x5f3fd7);};}function removeListener(_0x1e64d4,_0x5ea716){return function(){PluginEvents['removeListener'](_0x1e64d4,_0x5ea716);};}exports['register']=function(_0x1f22f8){for(var _0x5b532d=0x0,_0x4d1e58=events[_0xd3d5('0x5')];_0x5b532d<_0x4d1e58;_0x5b532d++){var _0x3191df=events[_0x5b532d];var _0x38003e=createListener(_0xd3d5('0x6')+_0x3191df,_0x1f22f8);PluginEvents['on'](_0x3191df,_0x38003e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 50cd44a..f7af9ef 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(_0x59a5bf,_0x541a91){var _0x440eac=function(_0x5153ba){while(--_0x5153ba){_0x59a5bf['push'](_0x59a5bf['shift']());}};_0x440eac(++_0x541a91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x19cf7a,_0x1dd21e){var _0x1a75bb=function(_0x31aa5f){while(--_0x31aa5f){_0x19cf7a['push'](_0x19cf7a['shift']());}};_0x1a75bb(++_0x1dd21e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 b52dc5e..d69197b 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 _0x984b=['reject','express','motion2','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','delete','Unknown\x20id','api','path','child_process','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0xb97b68,_0x2e8b3d){var _0x59361d=function(_0x177b02){while(--_0x177b02){_0xb97b68['push'](_0xb97b68['shift']());}};_0x59361d(++_0x2e8b3d);}(_0x984b,0xee));var _0xb984=function(_0x521566,_0x1e1906){_0x521566=_0x521566-0x0;var _0x1d01b8=_0x984b[_0x521566];return _0x1d01b8;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xb984('0x0'));var path=require(_0xb984('0x1'));var exec=require(_0xb984('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x8384b0,_0x340f2c){return function(_0x4d8f6a){if(!_0x4d8f6a){_0x8384b0['sendStatus'](0x194);;}return _0x4d8f6a;};}function respondWithResult(_0x2cca53,_0x46c541){_0x46c541=_0x46c541||0xc8;return function(_0x5a605a){if(_0x5a605a){return _0x2cca53[_0xb984('0x3')](_0x46c541)[_0xb984('0x4')](_0x5a605a);}return null;};}function handleError(_0x4d72b7,_0x37fd36){_0x37fd36=_0x37fd36||0x1f4;return function(_0x4e6b9a){logger[_0xb984('0x5')](_0x4e6b9a[_0xb984('0x6')]);if(_0x4e6b9a[_0xb984('0x7')]){delete _0x4e6b9a[_0xb984('0x7')];}_0x4d72b7[_0xb984('0x3')](_0x37fd36)[_0xb984('0x8')](_0x4e6b9a);};}function execChildProcess(){return new BPromise(function(_0x11525c,_0xfca315){exec(_0xb984('0x9'),function(_0x3c3e8a,_0x1f107f,_0x39e612){logger['info'](_0x1f107f);logger[_0xb984('0xa')](_0x39e612);if(_0x3c3e8a){logger['error'](_0x3c3e8a);return _0xfca315(_0x3c3e8a);}return _0x11525c(_0x1f107f);});});}exports[_0xb984('0xb')]=function(_0x2dba22,_0x594a5e){return pm2[_0xb984('0xc')]()[_0xb984('0xd')](function(_0x564d24){if(_0x564d24){var _0x203dba=_[_0xb984('0xe')](_0x564d24,function(_0x549791){return _0x549791[_0xb984('0x7')]===_0xb984('0xf')||_0x549791['name']===_0xb984('0x10');});return{'rows':_0x203dba,'count':_0x203dba['length']};}return null;})[_0xb984('0xd')](respondWithResult(_0x594a5e,null))[_0xb984('0x11')](handleError(_0x594a5e,null));};exports[_0xb984('0x12')]=function(_0x3f7cff,_0x59dcb7){return pm2[_0xb984('0x13')](_0x3f7cff[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x59dcb7,null))[_0xb984('0xd')](handleEntityNotFound(_0x59dcb7,null))[_0xb984('0x11')](handleError(_0x59dcb7,null));};exports[_0xb984('0x15')]=function(_0x5c2e25,_0x2492f4){if(_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')]&&_0x5c2e25[_0xb984('0x16')][_0xb984('0x17')]){var _0xcf9365=path['join'](__dirname,_0xb984('0x18'),_0x5c2e25[_0xb984('0x16')]['script']);var _0x44b570=process[_0xb984('0x19')]();process[_0xb984('0x1a')](path[_0xb984('0x1b')](_0xcf9365));return execChildProcess()[_0xb984('0xd')](function(_0x286033){process[_0xb984('0x1a')](_0x44b570);return pm2['start']({'name':_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')],'script':_0xcf9365});})[_0xb984('0xd')](function(_0x5d4d38){pm2[_0xb984('0x1c')]();return _0x5d4d38[0x0];})[_0xb984('0xd')](respondWithResult(_0x2492f4,0xc9))[_0xb984('0x11')](handleError(_0x2492f4,null));}else{return _0x2492f4[_0xb984('0x3')](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x1d')});}};exports[_0xb984('0x1e')]=function(_0x4b3da0,_0x5d93d9){if(_0x4b3da0[_0xb984('0x16')]['id']){delete _0x4b3da0[_0xb984('0x16')]['id'];}var _0x3e254b={'online':_0xb984('0x1f'),'stopped':'stop'};if(_0x3e254b[_0xb984('0x20')](_0x4b3da0[_0xb984('0x16')][_0xb984('0x3')])){return pm2[_0x3e254b[_0x4b3da0['body'][_0xb984('0x3')]]](_0x4b3da0[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x5d93d9,0xc8))[_0xb984('0x11')](handleError(_0x5d93d9,null));}else{return _0x5d93d9['status'](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xb984('0x21')]=function(_0x23ecf6,_0x58a98c){if(_0x23ecf6[_0xb984('0x16')]['id']){delete _0x23ecf6[_0xb984('0x16')]['id'];}if(_0x23ecf6[_0xb984('0x14')]['id']){return pm2[_0xb984('0x22')](_0x23ecf6['params']['id'])['then'](function(_0x315f70){pm2[_0xb984('0x1c')]();return _0x315f70[0x0];})[_0xb984('0xd')](respondWithResult(_0x58a98c,null))[_0xb984('0x11')](handleError(_0x58a98c,null));}else{return _0x58a98c['status'](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x23')});}}; \ No newline at end of file +var _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x4b19e3,_0x2b63c3){var _0x2ce22a=function(_0x5c1fac){while(--_0x5c1fac){_0x4b19e3['push'](_0x4b19e3['shift']());}};_0x2ce22a(++_0x2b63c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xcb91[_0x25c326];return _0x762452;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 15a6b8a..ecf7536 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 _0xd262=['express','Router','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xd262,0x68));var _0x2d26=function(_0x3c7983,_0x599d4b){_0x3c7983=_0x3c7983-0x0;var _0x555d80=_0xd262[_0x3c7983];return _0x555d80;};'use strict';var express=require(_0x2d26('0x0'));var router=express[_0x2d26('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2d26('0x2'));router[_0x2d26('0x3')](_0x2d26('0x4'),auth[_0x2d26('0x5')](),controller['getAgents']);router[_0x2d26('0x3')](_0x2d26('0x6'),auth[_0x2d26('0x5')](),controller[_0x2d26('0x7')]);module['exports']=router; \ No newline at end of file +var _0x1084=['exports','express','Router','../../components/auth/service','get','/agents','getAgents','/queues','getQueues'];(function(_0x19d172,_0x21bf9b){var _0x4e1ccd=function(_0x144213){while(--_0x144213){_0x19d172['push'](_0x19d172['shift']());}};_0x4e1ccd(++_0x21bf9b);}(_0x1084,0x7f));var _0x4108=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0x1084[_0x3fc31d];return _0x31bb91;};'use strict';var express=require(_0x4108('0x0'));var router=express[_0x4108('0x1')]();var auth=require(_0x4108('0x2'));var controller=require('./realtime.controller');router[_0x4108('0x3')](_0x4108('0x4'),auth['isAuthenticated'](),controller[_0x4108('0x5')]);router['get'](_0x4108('0x6'),auth['isAuthenticated'](),controller[_0x4108('0x7')]);module[_0x4108('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 2dbb7a9..dd86e24 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 _0xa6ba=['smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','join','globalQueueFilter','User','rawAttributes','fieldName','type','key','role','agent','getOptions','where','isEmpty','user','nolimit','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','userProfileId','QueueCampaigns','UserProfile','util','lodash','../../config/logger','../../mysqldb','client','http','offset','undefined','count','limit','status','Content-Range','json','error','name','send','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','outbound','push','pTalking','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','get','agents','paused','loggedInDb','voice','originated','find','pick','filter','queue','length','busy','internal','talking','getMembers','UserId','accountcode','online','voiceStatus','Queue','findAll','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','idle','pause','faxStatus','mailStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','isArray','map','all','flatten','value','split','fields','globalStatus','order','startsWith','DESC','sort','pauseType','getAgents','userpic','lastLoginAt','lastPauseAt','address','smsPause','openchannelCapacity','mailCapacity'];(function(_0x3ab3ce,_0x5e3960){var _0x2021e1=function(_0x375b64){while(--_0x375b64){_0x3ab3ce['push'](_0x3ab3ce['shift']());}};_0x2021e1(++_0x5e3960);}(_0xa6ba,0xce));var _0xaa6b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa6ba[_0x411add];return _0x238242;};'use strict';var util=require(_0xaa6b('0x0'));var _=require(_0xaa6b('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0xaa6b('0x2'))('api');var db=require(_0xaa6b('0x3'))['db'];var amiClient=jayson[_0xaa6b('0x4')][_0xaa6b('0x5')]({'port':0x232a});var routingClient=jayson[_0xaa6b('0x4')]['http']({'port':0x232c});function respondWithFilteredResult(_0x20a7fc,_0x4c7890){return function(_0xb785ca){if(_0xb785ca){var _0x60c976=typeof _0x4c7890[_0xaa6b('0x6')]===_0xaa6b('0x7')&&typeof _0x4c7890['limit']===_0xaa6b('0x7');var _0x141cd0=_0xb785ca[_0xaa6b('0x8')];var _0x311de4=_0x60c976?0x0:_0x4c7890['offset'];var _0x207122=_0x60c976?_0xb785ca['count']:_0x4c7890[_0xaa6b('0x6')]+_0x4c7890[_0xaa6b('0x9')];var _0x31efb4;if(_0x207122>=_0x141cd0){_0x207122=_0x141cd0;_0x31efb4=0xc8;}else{_0x31efb4=0xce;}_0x20a7fc[_0xaa6b('0xa')](_0x31efb4);return _0x20a7fc['set'](_0xaa6b('0xb'),_0x311de4+'-'+_0x207122+'/'+_0x141cd0)[_0xaa6b('0xc')](_0xb785ca);}return null;};}function handleError(_0x4a7516,_0x270845){_0x270845=_0x270845||0x1f4;return function(_0x3cf94f){logger[_0xaa6b('0xd')](_0x3cf94f['stack']);if(_0x3cf94f[_0xaa6b('0xe')]){delete _0x3cf94f['name'];}_0x4a7516[_0xaa6b('0xa')](_0x270845)[_0xaa6b('0xf')](_0x3cf94f);};}function getRealtimeAgents(){return new Promise(function(_0x3a3f6e,_0x42b05f){return amiClient[_0xaa6b('0x10')](_0xaa6b('0x11'),{})[_0xaa6b('0x12')](function(_0x19f499){if(_0x19f499[_0xaa6b('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x4a944d=_0x19f499[_0xaa6b('0x13')];return routingClient['request']('Agents',{})[_0xaa6b('0x12')](function(_0x4ed8d0){if(_0x4ed8d0[_0xaa6b('0xd')])throw new Error(_0xaa6b('0x14'));var _0x4f4912=_0x4ed8d0['result'];return _0x3a3f6e(_[_0xaa6b('0x15')]({},_0x4a944d,_0x4f4912));});})[_0xaa6b('0x16')](function(_0xa3d7c4){_0x42b05f(_0xa3d7c4);});});}function getRealtimeQueues(_0x27275e,_0x399e48){return new Promise(function(_0x4c86fc,_0x51eb56){var _0x56f5f6=_0x399e48==='voice'?amiClient:routingClient;return _0x56f5f6[_0xaa6b('0x10')](_[_0xaa6b('0x17')](_0x399e48)+_0xaa6b('0x18'),_0x27275e)['then'](function(_0xc8af68){if(_0xc8af68['error'])throw new Error(util[_0xaa6b('0x19')](_0xaa6b('0x1a'),_0x399e48));return _0x4c86fc(_0xc8af68[_0xaa6b('0x13')]);})[_0xaa6b('0x16')](function(_0x1793f7){_0x51eb56(_0x1793f7);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x20cb58,_0x2b5095){return amiClient[_0xaa6b('0x10')](_0xaa6b('0x1b'),{})['then'](function(_0xe71af0){if(_0xe71af0[_0xaa6b('0xd')])throw new Error(_0xaa6b('0x1c'));return _0x20cb58(_0xe71af0[_0xaa6b('0x13')]);})['catch'](function(_0x42d7d2){_0x2b5095(_0x42d7d2);});});}function initializeQueues(_0x5a4f71,_0x49c486,_0x906d4c,_0x406381){var _0x2693d3=[_0xaa6b('0x1d'),_0xaa6b('0x1e'),_0xaa6b('0x1f'),'talking','paused'];if(_0x906d4c==='voice'&&_0x406381===_0xaa6b('0x20')){_0x2693d3[_0xaa6b('0x21')](_0xaa6b('0x22'),'originated',_0xaa6b('0x23'),_0xaa6b('0x24'),_0xaa6b('0x25'),'Trunk','startPredictive',_0xaa6b('0x26'),_0xaa6b('0x27'),'erlangCallToSecond','erlangAbandonmentRate',_0xaa6b('0x28'),_0xaa6b('0x29'),_0xaa6b('0x2a'),_0xaa6b('0x2b'),'predictiveIntervalAvailable',_0xaa6b('0x2c'),_0xaa6b('0x2d'),_0xaa6b('0x2e'),_0xaa6b('0x2f'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x5a4f71['map'](function(_0x2f9a52){var _0x2e9a48=_0x2f9a52[_0xaa6b('0x30')]({'plain':!![]});_0x2e9a48[_0xaa6b('0x31')]=[];_0x2e9a48[_0xaa6b('0x32')]=0x0;_0x2e9a48[_0xaa6b('0x33')]=0x0;_0x2e9a48[_0xaa6b('0x1d')]=0x0;_0x2e9a48[_0xaa6b('0x1e')]=0x0;_0x2e9a48['waiting']=0x0;if(_0x906d4c===_0xaa6b('0x34')){_0x2e9a48['talking']=0x0;_0x2e9a48['busy']=0x0;if(_0x406381==='outbound'){_0x2e9a48[_0xaa6b('0x22')]=0x0;_0x2e9a48[_0xaa6b('0x35')]=0x0;}}var _0x57690b=_[_0xaa6b('0x36')](_0x49c486,['id',_0x2e9a48['id']]);if(_0x57690b)_['merge'](_0x2e9a48,_[_0xaa6b('0x37')](_0x57690b,_0x2693d3));return _0x2e9a48;});}function updateAgentVoiceStatus(_0x15e304,_0x4d2bde,_0x3a817f){var _0x4fabb9=_[_0xaa6b('0x38')](_0x3a817f,[_0xaa6b('0x39'),_0x4d2bde['name']]);if(_0x4fabb9[_0xaa6b('0x3a')]===0x0)return _0x15e304[_0xaa6b('0x3b')]=!![];if(_['some'](_0x4fabb9,['connectedlinenum',_0x15e304[_0xaa6b('0x3c')]['toString']()]))return _0x15e304[_0xaa6b('0x3d')]=!![];if(!_0x15e304[_0xaa6b('0x3d')])return _0x15e304[_0xaa6b('0x3b')]=!![];}function getVoiceQueueAgents(_0x386177,_0x91dd43,_0x833d55,_0x79d46c){var _0x2a9c01=_[_0xaa6b('0x36')](_0x91dd43,['id',_0x386177['id']]);if(!_0x2a9c01)return _0x386177;return _0x2a9c01[_0xaa6b('0x3e')]({'raw':!![]})['then'](function(_0x4c8798){for(var _0x579ca9=0x0;_0x579ca9<_0x4c8798[_0xaa6b('0x3a')];_0x579ca9++){var _0x5b2954=_['find'](_0x833d55,['id',_0x4c8798[_0x579ca9]['UserId']]);if(!_0x5b2954){_0x5b2954={'id':_0x4c8798[_0x579ca9][_0xaa6b('0x3f')],'name':_0x4c8798[_0x579ca9][_0xaa6b('0x3f')],'accountcode':'','online':![]};}var _0x2e4974={'id':_0x5b2954['id'],'name':_0x5b2954[_0xaa6b('0xe')],'internal':_0x5b2954[_0xaa6b('0x40')],'online':Boolean(_0x5b2954[_0xaa6b('0x41')]),'paused':Boolean(_0x4c8798[_0x579ca9][_0xaa6b('0x32')])};if(_0x5b2954[_0xaa6b('0x42')]==='talking')updateAgentVoiceStatus(_0x2e4974,_0x386177,_0x79d46c);if(_0x2e4974[_0xaa6b('0x41')])_0x386177[_0xaa6b('0x33')]++;if(_0x2e4974[_0xaa6b('0x3b')])_0x386177['busy']++;if(_0x2e4974[_0xaa6b('0x32')]&&!_0x2e4974['busy']&&!_0x2e4974[_0xaa6b('0x3d')])_0x386177[_0xaa6b('0x32')]++;_0x386177[_0xaa6b('0x31')][_0xaa6b('0x21')](_0x2e4974);}return _0x386177;});}function getQueueAgents(_0x5d78dc,_0x87f75d,_0x11e891){var _0x4779e8='User'+_['startCase'](_0x11e891)+_0xaa6b('0x43');var _0x2220e7=_0x11e891+'Pause';return db[_0x4779e8][_0xaa6b('0x44')]({'where':{[_[_0xaa6b('0x17')](_0x11e891)+'QueueId']:_0x5d78dc['id']},'raw':!![]})[_0xaa6b('0x12')](function(_0x558840){for(var _0x3d064a=0x0;_0x3d064a<_0x558840[_0xaa6b('0x3a')];_0x3d064a++){var _0xc890c5=_[_0xaa6b('0x36')](_0x87f75d,['id',_0x558840[_0x3d064a][_0xaa6b('0x3f')]]);if(!_0xc890c5){_0xc890c5={'id':_0x558840[_0x3d064a]['UserId'],'name':_0x558840[_0x3d064a]['UserId'],'online':![],['pauseField']:![]};}var _0x1a9a57={'id':_0xc890c5['id'],'name':_0xc890c5[_0xaa6b('0xe')],'online':Boolean(_0xc890c5['online']),'paused':Boolean(_0xc890c5[_0x2220e7])};if(_0x1a9a57[_0xaa6b('0x41')])_0x5d78dc['loggedInDb']++;_0x5d78dc[_0xaa6b('0x31')][_0xaa6b('0x21')](_0x1a9a57);}return _0x5d78dc;});}function isIdle(_0x1b0fb9){return _0x1b0fb9==='idle'||_0x1b0fb9===_0xaa6b('0x45')||_0x1b0fb9===_0xaa6b('0x46')||_0x1b0fb9==='ringing'||_[_0xaa6b('0x47')](_0x1b0fb9);}function isAgentPaused(_0xd40867,_0x1572c4){var _0x3a03e3=[_0xd40867[_0xaa6b('0x48')],_0xd40867[_0xaa6b('0x49')],_0xd40867[_0xaa6b('0x4a')],_0xd40867[_0xaa6b('0x4b')],_0xd40867['smsPause'],_0xd40867[_0xaa6b('0x4c')],_0xd40867[_0xaa6b('0x4d')]];if(!_0x1572c4)return _[_0xaa6b('0x4e')](_0x3a03e3);var _0x481010=_[_0xaa6b('0x38')](_0x3a03e3);return _0x481010['length']>0x0&&_0x481010[_0xaa6b('0x3a')]<_0x3a03e3[_0xaa6b('0x3a')]?!![]:![];}function isAgentIdle(_0x25acb1){if(_0x25acb1[_0xaa6b('0x42')]!==_0xaa6b('0x4f')&&_0x25acb1[_0xaa6b('0x4c')]){_0x25acb1[_0xaa6b('0x42')]=_0xaa6b('0x50');return![];}return _['every']([_0x25acb1['chatStatus'],_0x25acb1[_0xaa6b('0x51')],_0x25acb1[_0xaa6b('0x52')],_0x25acb1['openchannelStatus'],_0x25acb1['smsStatus'],_0x25acb1['voiceStatus'],_0x25acb1[_0xaa6b('0x53')]],isIdle);}function getAgentStatus(_0x93d443){var _0x17a865=_0xaa6b('0x45');if(isAgentPaused(_0x93d443))_0x17a865=_0xaa6b('0x50');else if(isAgentPaused(_0x93d443,!![]))_0x17a865=_0xaa6b('0x54');else if(isAgentIdle(_0x93d443))_0x17a865='idle';else _0x17a865=_0xaa6b('0x3b');return _0x17a865;}function validateChannel(_0x406aa9){var _0x7f3bec=[_0xaa6b('0x55'),_0xaa6b('0x56'),_0xaa6b('0x57'),_0xaa6b('0x58'),_0xaa6b('0x59'),_0xaa6b('0x5a'),_0xaa6b('0x34')];if(!_[_0xaa6b('0x5b')](_0x7f3bec,_0x406aa9[_0xaa6b('0x5c')]()))throw new Error('Invalid\x20channel');return _0x406aa9[_0xaa6b('0x5c')]();}function getFilteredAgentIds(_0x1c079d,_0x29a9cd){var _0x8b8933=_[_0xaa6b('0x5d')](_0x1c079d)?_0x1c079d:[_0x1c079d];var _0x2c0590=_[_0xaa6b('0x5e')](_0x8b8933,function(_0x14d818){return db[_0x29a9cd]['findOne']({'where':{'name':_0x14d818}})[_0xaa6b('0x12')](function(_0x31862e){if(!_0x31862e)return[];return _0x31862e['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xaa6b('0x5f')](_0x2c0590)['then'](function(_0x59ef0a){var _0x10208d=_(_0x59ef0a)[_0xaa6b('0x60')]()['map']('id')['uniq']()[_0xaa6b('0x61')]();return _0x10208d;});}function getUpdatedSortOptions(_0x3fcd33){var _0x10b60a={'fields':[],'order':null};var _0x4dd9ea=_0x3fcd33[_0xaa6b('0x62')](',');_0x10b60a[_0xaa6b('0x63')]=_['filter'](_0x4dd9ea,function(_0x416243){if(!_0x416243[_0xaa6b('0x5b')](_0xaa6b('0x64')))return!![];_0x10b60a[_0xaa6b('0x65')]=_[_0xaa6b('0x66')](_0x416243,'-')?_0xaa6b('0x67'):'ASC';return![];});return _0x10b60a;}function orderAgentsByStatus(_0x13f935,_0x1e8f9d){return _0x13f935[_0xaa6b('0x68')](function(_0x4daabc,_0x2293d6){if(_0x4daabc[_0xaa6b('0x64')]===_0x2293d6[_0xaa6b('0x64')]&&_0x4daabc[_0xaa6b('0x64')]===_0xaa6b('0x50')){if(_0x1e8f9d==='DESC')return(_0x4daabc[_0xaa6b('0x69')]||'')<(_0x2293d6[_0xaa6b('0x69')]||'')?0x1:-0x1;return _0x4daabc['pauseType']<_0x2293d6['pauseType']?-0x1:0x1;}else{if(_0x1e8f9d===_0xaa6b('0x67'))return _0x4daabc[_0xaa6b('0x64')]<_0x2293d6[_0xaa6b('0x64')]?0x1:-0x1;return _0x4daabc[_0xaa6b('0x64')]<_0x2293d6[_0xaa6b('0x64')]?-0x1:0x1;}});}exports[_0xaa6b('0x6a')]=function(_0x147065,_0xe07489){var _0x81eb5e={'count':0x0,'rows':[]},_0x5681db={},_0x42e555,_0x2e60cb,_0xe1ef7e,_0x560227,_0xf6b3b8=[_0xaa6b('0x6b'),_0xaa6b('0x41'),_0xaa6b('0x6c'),_0xaa6b('0x6d'),_0xaa6b('0x69'),'lastPauseAt',_0xaa6b('0x3c'),_0xaa6b('0x6e'),'chatPause','openchannelPause',_0xaa6b('0x4a'),_0xaa6b('0x6f'),_0xaa6b('0x4d'),_0xaa6b('0x49'),_0xaa6b('0x4c'),'chatCapacity',_0xaa6b('0x70'),_0xaa6b('0x71'),_0xaa6b('0x72'),'whatsappCapacity','faxCapacity',_0xaa6b('0x73'),_0xaa6b('0x74'),_0xaa6b('0x75'),_0xaa6b('0x76'),_0xaa6b('0x77'),_0xaa6b('0x78'),_0xaa6b('0x79'),_0xaa6b('0x7a'),'mailStatus','smsStatus',_0xaa6b('0x53'),_0xaa6b('0x51'),'voiceStatus',_0xaa6b('0x7b'),'openchannelStatusTime',_0xaa6b('0x7c'),_0xaa6b('0x7d'),_0xaa6b('0x7e'),'faxStatusTime',_0xaa6b('0x7f'),_0xaa6b('0x39'),_0xaa6b('0x80'),_0xaa6b('0x81'),_0xaa6b('0x82'),_0xaa6b('0x83'),_0xaa6b('0x84')],_0x53ebce=['chatPause','openchannelPause',_0xaa6b('0x4a'),_0xaa6b('0x6f'),'whatsappPause',_0xaa6b('0x49'),_0xaa6b('0x4c'),_0xaa6b('0x41')];Promise[_0xaa6b('0x85')]()[_0xaa6b('0x12')](function(){if(_0x147065[_0xaa6b('0x86')]['channel'])_0x42e555=validateChannel(_0x147065[_0xaa6b('0x86')][_0xaa6b('0x87')]);if(!_0x147065[_0xaa6b('0x86')][_0xaa6b('0x68')]||!_0x147065['query'][_0xaa6b('0x68')][_0xaa6b('0x5b')]('globalStatus'))return;var _0x3fbd0f=getUpdatedSortOptions(_0x147065[_0xaa6b('0x86')][_0xaa6b('0x68')]);_0x147065[_0xaa6b('0x86')][_0xaa6b('0x68')]=_0x3fbd0f[_0xaa6b('0x63')][_0xaa6b('0x88')](',');_0x2e60cb=_0x3fbd0f[_0xaa6b('0x65')];})[_0xaa6b('0x12')](function(){if(!_0x147065[_0xaa6b('0x86')][_0xaa6b('0x89')])return[];var _0x5db097=_[_0xaa6b('0x17')](_0x42e555)+'Queue';return getFilteredAgentIds(_0x147065[_0xaa6b('0x86')][_0xaa6b('0x89')],_0x5db097);})[_0xaa6b('0x12')](function(_0x2fc1a0){var _0x37949f=_[_0xaa6b('0x5e')](db[_0xaa6b('0x8a')][_0xaa6b('0x8b')],function(_0x114f25){return{'name':_0x114f25[_0xaa6b('0x8c')],'type':_0x114f25[_0xaa6b('0x8d')][_0xaa6b('0x8e')]};});_0x147065[_0xaa6b('0x86')][_0xaa6b('0x8f')]=_0xaa6b('0x90');_0x147065['query'][_0xaa6b('0x41')]=!![];_0x5681db=qs[_0xaa6b('0x91')](_0x37949f,_0x147065);_0x5681db['raw']=!![];if(!_['isEmpty'](_0x2fc1a0)){_0x5681db[_0xaa6b('0x92')]=_[_0xaa6b('0x15')](_0x5681db[_0xaa6b('0x92')],{'$and':[{'id':{'$in':_0x2fc1a0}}]});}else if(!_[_0xaa6b('0x93')](_0x147065[_0xaa6b('0x86')]['globalQueueFilter'])){return _0x81eb5e;}if(_0x147065['user'][_0xaa6b('0x8f')]===_0xaa6b('0x94')){var _0x284c0b={'params':{'id':_0x147065[_0xaa6b('0x94')]['userProfileId']},'query':{'section':_0xaa6b('0x11'),'role':_0xaa6b('0x90'),'online':!![],'nolimit':_0x147065[_0xaa6b('0x86')][_0xaa6b('0x95')],'sort':_0x147065['query'][_0xaa6b('0x68')],'filter':_0x147065[_0xaa6b('0x86')][_0xaa6b('0x38')],'raw':!![],'ids':_0x2fc1a0}};return db['UserProfile'][_0xaa6b('0x96')](_0x284c0b);}return db[_0xaa6b('0x8a')][_0xaa6b('0x97')](_0x5681db);})[_0xaa6b('0x12')](function(_0x24ce26){_0x81eb5e[_0xaa6b('0x8')]=_0x24ce26[_0xaa6b('0x8')];_0xe1ef7e=_0x24ce26[_0xaa6b('0x98')];return getRealtimeAgents();})['then'](function(_0x80efeb){_0x560227=_0x80efeb[_0xaa6b('0x98')];return _0xe1ef7e[_0xaa6b('0x5e')](function(_0x32b408){var _0x385bd8=_['find'](_0x560227,['id',_0x32b408['id']]);if(_0x385bd8)_[_0xaa6b('0x15')](_0x32b408,_[_0xaa6b('0x37')](_[_0xaa6b('0x99')](_0x385bd8,_0x53ebce),_0xf6b3b8));_0x32b408['globalStatus']=getAgentStatus(_0x32b408);return _0x32b408;});})[_0xaa6b('0x12')](function(_0x3970d9){var _0x628a15;if(_0x147065[_0xaa6b('0x86')][_0xaa6b('0x9a')]){_0x628a15=_['filter'](_0x3970d9,[_0xaa6b('0x64'),_0x147065['query'][_0xaa6b('0x9a')]]);if(_0x147065[_0xaa6b('0x86')]['pauseTypeFilter']){_0x628a15=_[_0xaa6b('0x38')](_0x628a15,['pauseType',_0x147065[_0xaa6b('0x86')][_0xaa6b('0x9b')]]);}}if(_0x628a15)_0x3970d9=_0x628a15;if(!_0x2e60cb)return _0x3970d9;return orderAgentsByStatus(_0x3970d9,_0x2e60cb);})[_0xaa6b('0x12')](function(_0x5197da){_0x81eb5e[_0xaa6b('0x98')]=_0x5197da;return _0x81eb5e;})[_0xaa6b('0x12')](respondWithFilteredResult(_0xe07489,_0x5681db))[_0xaa6b('0x16')](handleError(_0xe07489,null));};exports[_0xaa6b('0x9c')]=function(_0x5eb343,_0x39f0ef){var _0x2b49a9={'count':0x0,'rows':[]},_0x144687={},_0x1b476c,_0x4ff98b,_0x401557,_0xc4851,_0x2b346c;Promise[_0xaa6b('0x85')]()[_0xaa6b('0x12')](function(){if(_0x5eb343[_0xaa6b('0x86')]['channel'])_0x1b476c=validateChannel(_0x5eb343[_0xaa6b('0x86')][_0xaa6b('0x87')]);var _0x48821a=_['startCase'](_0x1b476c)+'Queue';var _0x214a6a=_[_0xaa6b('0x5e')](db[_0x48821a]['rawAttributes'],function(_0x4cb1e4){return{'name':_0x4cb1e4[_0xaa6b('0x8c')],'type':_0x4cb1e4[_0xaa6b('0x8d')][_0xaa6b('0x8e')]};});_0x144687=qs[_0xaa6b('0x91')](_0x214a6a,_0x5eb343);if(_0x5eb343['user'][_0xaa6b('0x8f')]===_0xaa6b('0x94')){var _0x102fa3={'params':{'id':_0x5eb343[_0xaa6b('0x94')][_0xaa6b('0x9d')]},'query':{'section':_0x1b476c===_0xaa6b('0x34')&&_0x5eb343['query']['type']==='outbound'?_0xaa6b('0x9e'):_[_0xaa6b('0x17')](_0x1b476c)+_0xaa6b('0x18'),'type':_0x5eb343[_0xaa6b('0x86')][_0xaa6b('0x8d')],'nolimit':!![],'sort':_0xaa6b('0xe'),'filter':_0x5eb343[_0xaa6b('0x86')][_0xaa6b('0x38')]}};return db[_0xaa6b('0x9f')][_0xaa6b('0x96')](_0x102fa3);}return db[_0x48821a][_0xaa6b('0x97')](_0x144687);})[_0xaa6b('0x12')](function(_0x479f6a){_0x2b49a9['count']=_0x479f6a['count'];_0x4ff98b=_0x479f6a[_0xaa6b('0x98')];return getRealtimeQueues(_0x5eb343,_0x1b476c);})[_0xaa6b('0x12')](function(_0x2e3147){_0xc4851=_0x2e3147[_0xaa6b('0x98')];return getRealtimeAgents();})['then'](function(_0x463a5e){_0x401557=_0x463a5e[_0xaa6b('0x98')];if(_0x1b476c!=_0xaa6b('0x34'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x35eae4){_0x2b346c=_0x35eae4?_0x35eae4[_0xaa6b('0x98')]:[];return initializeQueues(_0x4ff98b,_0xc4851,_0x1b476c,_0x5eb343[_0xaa6b('0x86')]['type']);})[_0xaa6b('0x12')](function(_0xb21afe){var _0x2d04b2=_0xb21afe[_0xaa6b('0x5e')](function(_0x4456a1){if(_0x1b476c==='voice')return getVoiceQueueAgents(_0x4456a1,_0x4ff98b,_0x401557,_0x2b346c);else return getQueueAgents(_0x4456a1,_0x401557,_0x1b476c);});return Promise[_0xaa6b('0x5f')](_0x2d04b2);})[_0xaa6b('0x12')](function(_0x5a5336){_0x2b49a9['rows']=_0x5a5336;return _0x2b49a9;})[_0xaa6b('0x12')](respondWithFilteredResult(_0x39f0ef,_0x144687))['catch'](handleError(_0x39f0ef,null));}; \ No newline at end of file +var _0x788a=['chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','resolve','query','channel','join','order','globalQueueFilter','User','fieldName','type','role','agent','getOptions','raw','where','isEmpty','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','pauseTypeFilter','getQueues','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','status','set','Content-Range','json','stack','name','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','agents','loggedInDb','talking','outbound','pTalking','originated','merge','pick','queue','length','busy','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','push','Queue','findAll','QueueId','idle','unknown','ringing','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','filter','voiceStatus','pause','every','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','whatsapp','toLowerCase','findOne','getAgents','all','value','fields','includes','startsWith','ASC','sort','globalStatus','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x788a,0xcc));var _0xa788=function(_0x47087,_0x24eadd){_0x47087=_0x47087-0x0;var _0x2fba8c=_0x788a[_0x47087];return _0x2fba8c;};'use strict';var util=require(_0xa788('0x0'));var _=require(_0xa788('0x1'));var jayson=require(_0xa788('0x2'));var qs=require(_0xa788('0x3'));var logger=require(_0xa788('0x4'))(_0xa788('0x5'));var db=require(_0xa788('0x6'))['db'];var amiClient=jayson['client'][_0xa788('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0xa788('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x235ce8,_0x2e939e){return function(_0x14576b){if(_0x14576b){var _0x1308a8=typeof _0x2e939e[_0xa788('0x8')]===_0xa788('0x9')&&typeof _0x2e939e[_0xa788('0xa')]===_0xa788('0x9');var _0x2b4ea3=_0x14576b[_0xa788('0xb')];var _0x21d515=_0x1308a8?0x0:_0x2e939e[_0xa788('0x8')];var _0x32fd10=_0x1308a8?_0x14576b[_0xa788('0xb')]:_0x2e939e[_0xa788('0x8')]+_0x2e939e[_0xa788('0xa')];var _0x2bb553;if(_0x32fd10>=_0x2b4ea3){_0x32fd10=_0x2b4ea3;_0x2bb553=0xc8;}else{_0x2bb553=0xce;}_0x235ce8[_0xa788('0xc')](_0x2bb553);return _0x235ce8[_0xa788('0xd')](_0xa788('0xe'),_0x21d515+'-'+_0x32fd10+'/'+_0x2b4ea3)[_0xa788('0xf')](_0x14576b);}return null;};}function handleError(_0x405007,_0x1e2645){_0x1e2645=_0x1e2645||0x1f4;return function(_0x563062){logger['error'](_0x563062[_0xa788('0x10')]);if(_0x563062[_0xa788('0x11')]){delete _0x563062['name'];}_0x405007[_0xa788('0xc')](_0x1e2645)['send'](_0x563062);};}function getRealtimeAgents(){return new Promise(function(_0xe23dd,_0x3543eb){return amiClient['request'](_0xa788('0x12'),{})[_0xa788('0x13')](function(_0x4d9362){if(_0x4d9362[_0xa788('0x14')])throw new Error(_0xa788('0x15'));var _0x67e981=_0x4d9362['result'];return routingClient['request'](_0xa788('0x12'),{})[_0xa788('0x13')](function(_0x415e41){if(_0x415e41['error'])throw new Error(_0xa788('0x16'));var _0x52ac78=_0x415e41[_0xa788('0x17')];return _0xe23dd(_['merge']({},_0x67e981,_0x52ac78));});})[_0xa788('0x18')](function(_0x1229ef){_0x3543eb(_0x1229ef);});});}function getRealtimeQueues(_0x1a837b,_0x2cb976){return new Promise(function(_0x4038f5,_0x56c51c){var _0x1e8c55=_0x2cb976===_0xa788('0x19')?amiClient:routingClient;return _0x1e8c55[_0xa788('0x1a')](_[_0xa788('0x1b')](_0x2cb976)+_0xa788('0x1c'),_0x1a837b)[_0xa788('0x13')](function(_0x392182){if(_0x392182[_0xa788('0x14')])throw new Error(util['format'](_0xa788('0x1d'),_0x2cb976));return _0x4038f5(_0x392182[_0xa788('0x17')]);})[_0xa788('0x18')](function(_0x1020a7){_0x56c51c(_0x1020a7);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5aa362,_0x2a8c6d){return amiClient[_0xa788('0x1a')](_0xa788('0x1e'),{})[_0xa788('0x13')](function(_0x4578ef){if(_0x4578ef[_0xa788('0x14')])throw new Error(_0xa788('0x1f'));return _0x5aa362(_0x4578ef[_0xa788('0x17')]);})[_0xa788('0x18')](function(_0x5c29ac){_0x2a8c6d(_0x5c29ac);});});}function initializeQueues(_0x513e41,_0x44e6de,_0x26419a,_0x5aaab0){var _0x6461ca=[_0xa788('0x20'),_0xa788('0x21'),_0xa788('0x22'),'talking',_0xa788('0x23')];if(_0x26419a==='voice'&&_0x5aaab0==='outbound'){_0x6461ca['push']('pTalking','originated',_0xa788('0x24'),_0xa788('0x25'),_0xa788('0x26'),_0xa788('0x27'),'startPredictive',_0xa788('0x28'),_0xa788('0x29'),_0xa788('0x2a'),_0xa788('0x2b'),_0xa788('0x2c'),_0xa788('0x2d'),'dialPredictiveIntervalMaxThreshold',_0xa788('0x2e'),'predictiveIntervalAvailable',_0xa788('0x2f'),_0xa788('0x30'),_0xa788('0x31'),_0xa788('0x32'),'predictiveIntervalAvgHoldtime',_0xa788('0x33'));}return _0x513e41[_0xa788('0x34')](function(_0x464988){var _0x26a687=_0x464988['get']({'plain':!![]});_0x26a687[_0xa788('0x35')]=[];_0x26a687[_0xa788('0x23')]=0x0;_0x26a687[_0xa788('0x36')]=0x0;_0x26a687[_0xa788('0x20')]=0x0;_0x26a687[_0xa788('0x21')]=0x0;_0x26a687['waiting']=0x0;if(_0x26419a==='voice'){_0x26a687[_0xa788('0x37')]=0x0;_0x26a687['busy']=0x0;if(_0x5aaab0===_0xa788('0x38')){_0x26a687[_0xa788('0x39')]=0x0;_0x26a687[_0xa788('0x3a')]=0x0;}}var _0x23de16=_['find'](_0x44e6de,['id',_0x26a687['id']]);if(_0x23de16)_[_0xa788('0x3b')](_0x26a687,_[_0xa788('0x3c')](_0x23de16,_0x6461ca));return _0x26a687;});}function updateAgentVoiceStatus(_0x4caa74,_0x2b2e29,_0xa14558){var _0x2a5e2d=_['filter'](_0xa14558,[_0xa788('0x3d'),_0x2b2e29[_0xa788('0x11')]]);if(_0x2a5e2d[_0xa788('0x3e')]===0x0)return _0x4caa74[_0xa788('0x3f')]=!![];if(_[_0xa788('0x40')](_0x2a5e2d,[_0xa788('0x41'),_0x4caa74[_0xa788('0x42')][_0xa788('0x43')]()]))return _0x4caa74['talking']=!![];if(!_0x4caa74[_0xa788('0x37')])return _0x4caa74[_0xa788('0x3f')]=!![];}function getVoiceQueueAgents(_0x5775af,_0x313f0d,_0x2d805f,_0x50d305){var _0xed8be8=_[_0xa788('0x44')](_0x313f0d,['id',_0x5775af['id']]);if(!_0xed8be8)return _0x5775af;return _0xed8be8['getMembers']({'raw':!![]})[_0xa788('0x13')](function(_0x5e3fae){for(var _0x3fb177=0x0;_0x3fb177<_0x5e3fae[_0xa788('0x3e')];_0x3fb177++){var _0x4aa87c=_[_0xa788('0x44')](_0x2d805f,['id',_0x5e3fae[_0x3fb177][_0xa788('0x45')]]);if(!_0x4aa87c){_0x4aa87c={'id':_0x5e3fae[_0x3fb177][_0xa788('0x45')],'name':_0x5e3fae[_0x3fb177][_0xa788('0x45')],'accountcode':'','online':![]};}var _0x2eec97={'id':_0x4aa87c['id'],'name':_0x4aa87c[_0xa788('0x11')],'internal':_0x4aa87c[_0xa788('0x46')],'online':Boolean(_0x4aa87c[_0xa788('0x47')]),'paused':Boolean(_0x5e3fae[_0x3fb177][_0xa788('0x23')])};if(_0x4aa87c['voiceStatus']===_0xa788('0x37'))updateAgentVoiceStatus(_0x2eec97,_0x5775af,_0x50d305);if(_0x2eec97['online'])_0x5775af['loggedInDb']++;if(_0x2eec97[_0xa788('0x3f')])_0x5775af[_0xa788('0x3f')]++;if(_0x2eec97['paused']&&!_0x2eec97[_0xa788('0x3f')]&&!_0x2eec97['talking'])_0x5775af[_0xa788('0x23')]++;_0x5775af['agents'][_0xa788('0x48')](_0x2eec97);}return _0x5775af;});}function getQueueAgents(_0x3f2bd3,_0x321370,_0x1afd72){var _0x1c00a7='User'+_[_0xa788('0x1b')](_0x1afd72)+_0xa788('0x49');var _0x37eaaf=_0x1afd72+'Pause';return db[_0x1c00a7][_0xa788('0x4a')]({'where':{[_[_0xa788('0x1b')](_0x1afd72)+_0xa788('0x4b')]:_0x3f2bd3['id']},'raw':!![]})[_0xa788('0x13')](function(_0x4c6d3c){for(var _0x4f4f4e=0x0;_0x4f4f4e<_0x4c6d3c[_0xa788('0x3e')];_0x4f4f4e++){var _0x8b2576=_[_0xa788('0x44')](_0x321370,['id',_0x4c6d3c[_0x4f4f4e]['UserId']]);if(!_0x8b2576){_0x8b2576={'id':_0x4c6d3c[_0x4f4f4e][_0xa788('0x45')],'name':_0x4c6d3c[_0x4f4f4e][_0xa788('0x45')],'online':![],['pauseField']:![]};}var _0x51f19d={'id':_0x8b2576['id'],'name':_0x8b2576[_0xa788('0x11')],'online':Boolean(_0x8b2576[_0xa788('0x47')]),'paused':Boolean(_0x8b2576[_0x37eaaf])};if(_0x51f19d[_0xa788('0x47')])_0x3f2bd3['loggedInDb']++;_0x3f2bd3[_0xa788('0x35')][_0xa788('0x48')](_0x51f19d);}return _0x3f2bd3;});}function isIdle(_0x1c18a8){return _0x1c18a8===_0xa788('0x4c')||_0x1c18a8===_0xa788('0x4d')||_0x1c18a8==='unavailable'||_0x1c18a8===_0xa788('0x4e')||_['isNil'](_0x1c18a8);}function isAgentPaused(_0x231276,_0x72f5cc){var _0x20a2fd=[_0x231276[_0xa788('0x4f')],_0x231276[_0xa788('0x50')],_0x231276[_0xa788('0x51')],_0x231276['openchannelPause'],_0x231276[_0xa788('0x52')],_0x231276[_0xa788('0x53')],_0x231276[_0xa788('0x54')]];if(!_0x72f5cc)return _['every'](_0x20a2fd);var _0x4e6c27=_[_0xa788('0x55')](_0x20a2fd);return _0x4e6c27[_0xa788('0x3e')]>0x0&&_0x4e6c27['length']<_0x20a2fd['length']?!![]:![];}function isAgentIdle(_0x70032b){if(_0x70032b['voiceStatus']!=='idle'&&_0x70032b[_0xa788('0x53')]){_0x70032b[_0xa788('0x56')]=_0xa788('0x57');return![];}return _[_0xa788('0x58')]([_0x70032b['chatStatus'],_0x70032b[_0xa788('0x59')],_0x70032b[_0xa788('0x5a')],_0x70032b[_0xa788('0x5b')],_0x70032b[_0xa788('0x5c')],_0x70032b[_0xa788('0x56')],_0x70032b[_0xa788('0x5d')]],isIdle);}function getAgentStatus(_0x3d2fac){var _0x4988e0=_0xa788('0x4d');if(isAgentPaused(_0x3d2fac))_0x4988e0=_0xa788('0x57');else if(isAgentPaused(_0x3d2fac,!![]))_0x4988e0=_0xa788('0x5e');else if(isAgentIdle(_0x3d2fac))_0x4988e0=_0xa788('0x4c');else _0x4988e0='busy';return _0x4988e0;}function validateChannel(_0x28cbef){var _0x179b0b=[_0xa788('0x5f'),_0xa788('0x60'),_0xa788('0x61'),_0xa788('0x62'),'fax',_0xa788('0x63'),_0xa788('0x19')];if(!_['includes'](_0x179b0b,_0x28cbef[_0xa788('0x64')]()))throw new Error('Invalid\x20channel');return _0x28cbef[_0xa788('0x64')]();}function getFilteredAgentIds(_0x476c2b,_0x5b16ef){var _0x3094f1=_['isArray'](_0x476c2b)?_0x476c2b:[_0x476c2b];var _0x37f9cf=_['map'](_0x3094f1,function(_0x7f543b){return db[_0x5b16ef][_0xa788('0x65')]({'where':{'name':_0x7f543b}})[_0xa788('0x13')](function(_0x1ea309){if(!_0x1ea309)return[];return _0x1ea309[_0xa788('0x66')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa788('0x67')](_0x37f9cf)['then'](function(_0x474822){var _0xfad477=_(_0x474822)['flatten']()[_0xa788('0x34')]('id')['uniq']()[_0xa788('0x68')]();return _0xfad477;});}function getUpdatedSortOptions(_0x4de4d9){var _0x4094bf={'fields':[],'order':null};var _0x385fca=_0x4de4d9['split'](',');_0x4094bf[_0xa788('0x69')]=_['filter'](_0x385fca,function(_0x5e534f){if(!_0x5e534f[_0xa788('0x6a')]('globalStatus'))return!![];_0x4094bf['order']=_[_0xa788('0x6b')](_0x5e534f,'-')?'DESC':_0xa788('0x6c');return![];});return _0x4094bf;}function orderAgentsByStatus(_0x2f0dc2,_0x5a3d44){return _0x2f0dc2[_0xa788('0x6d')](function(_0x2542e9,_0x821466){if(_0x2542e9['globalStatus']===_0x821466[_0xa788('0x6e')]&&_0x2542e9[_0xa788('0x6e')]===_0xa788('0x57')){if(_0x5a3d44===_0xa788('0x6f'))return(_0x2542e9[_0xa788('0x70')]||'')<(_0x821466[_0xa788('0x70')]||'')?0x1:-0x1;return _0x2542e9[_0xa788('0x70')]<_0x821466[_0xa788('0x70')]?-0x1:0x1;}else{if(_0x5a3d44===_0xa788('0x6f'))return _0x2542e9[_0xa788('0x6e')]<_0x821466['globalStatus']?0x1:-0x1;return _0x2542e9[_0xa788('0x6e')]<_0x821466[_0xa788('0x6e')]?-0x1:0x1;}});}exports[_0xa788('0x66')]=function(_0x2bdee4,_0x464ea0){var _0x4ded60={'count':0x0,'rows':[]},_0xd0269b={},_0x216d7d,_0x1dbe05,_0x31d975,_0x34ce83,_0x4fc73f=[_0xa788('0x71'),_0xa788('0x47'),_0xa788('0x72'),_0xa788('0x73'),_0xa788('0x70'),_0xa788('0x73'),'internal',_0xa788('0x74'),'chatPause','openchannelPause','mailPause','smsPause',_0xa788('0x54'),'faxPause',_0xa788('0x53'),_0xa788('0x75'),_0xa788('0x76'),_0xa788('0x77'),_0xa788('0x78'),_0xa788('0x79'),'faxCapacity',_0xa788('0x7a'),_0xa788('0x7b'),_0xa788('0x7c'),_0xa788('0x7d'),'whatsappCurrentCapacity',_0xa788('0x7e'),'chatStatus',_0xa788('0x5b'),_0xa788('0x5a'),_0xa788('0x5c'),_0xa788('0x5d'),'faxStatus',_0xa788('0x56'),'chatStatusTime',_0xa788('0x7f'),_0xa788('0x80'),_0xa788('0x81'),_0xa788('0x82'),'faxStatusTime',_0xa788('0x83'),_0xa788('0x3d'),_0xa788('0x84'),_0xa788('0x85'),_0xa788('0x86'),_0xa788('0x87'),_0xa788('0x88')],_0x5d5805=[_0xa788('0x4f'),_0xa788('0x89'),_0xa788('0x51'),_0xa788('0x52'),_0xa788('0x54'),'faxPause',_0xa788('0x53'),_0xa788('0x47')];Promise[_0xa788('0x8a')]()['then'](function(){if(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x8c')])_0x216d7d=validateChannel(_0x2bdee4['query'][_0xa788('0x8c')]);if(!_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')]||!_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')][_0xa788('0x6a')](_0xa788('0x6e')))return;var _0x43dbfa=getUpdatedSortOptions(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')]);_0x2bdee4['query'][_0xa788('0x6d')]=_0x43dbfa[_0xa788('0x69')][_0xa788('0x8d')](',');_0x1dbe05=_0x43dbfa[_0xa788('0x8e')];})[_0xa788('0x13')](function(){if(!_0x2bdee4['query']['globalQueueFilter'])return[];var _0x3f4f42=_[_0xa788('0x1b')](_0x216d7d)+_0xa788('0x49');return getFilteredAgentIds(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x8f')],_0x3f4f42);})['then'](function(_0x3ada19){var _0x13780a=_[_0xa788('0x34')](db[_0xa788('0x90')]['rawAttributes'],function(_0x4eb79e){return{'name':_0x4eb79e[_0xa788('0x91')],'type':_0x4eb79e[_0xa788('0x92')]['key']};});_0x2bdee4[_0xa788('0x8b')][_0xa788('0x93')]=_0xa788('0x94');_0x2bdee4[_0xa788('0x8b')][_0xa788('0x47')]=!![];_0xd0269b=qs[_0xa788('0x95')](_0x13780a,_0x2bdee4);_0xd0269b[_0xa788('0x96')]=!![];if(!_['isEmpty'](_0x3ada19)){_0xd0269b[_0xa788('0x97')]=_[_0xa788('0x3b')](_0xd0269b[_0xa788('0x97')],{'$and':[{'id':{'$in':_0x3ada19}}]});}else if(!_[_0xa788('0x98')](_0x2bdee4['query'][_0xa788('0x8f')])){return _0x4ded60;}if(_0x2bdee4[_0xa788('0x99')]['role']===_0xa788('0x99')){var _0x1e3390={'params':{'id':_0x2bdee4[_0xa788('0x99')][_0xa788('0x9a')]},'query':{'section':_0xa788('0x12'),'role':'agent','online':!![],'nolimit':_0x2bdee4[_0xa788('0x8b')][_0xa788('0x9b')],'sort':_0x2bdee4[_0xa788('0x8b')]['sort'],'filter':_0x2bdee4[_0xa788('0x8b')][_0xa788('0x55')],'raw':!![],'ids':_0x3ada19}};return db[_0xa788('0x9c')][_0xa788('0x9d')](_0x1e3390);}return db[_0xa788('0x90')][_0xa788('0x9e')](_0xd0269b);})[_0xa788('0x13')](function(_0x176f7a){_0x4ded60[_0xa788('0xb')]=_0x176f7a[_0xa788('0xb')];_0x31d975=_0x176f7a['rows'];return getRealtimeAgents();})[_0xa788('0x13')](function(_0x5b0271){_0x34ce83=_0x5b0271[_0xa788('0x9f')];return _0x31d975[_0xa788('0x34')](function(_0x24d781){var _0x18ac42=_[_0xa788('0x44')](_0x34ce83,['id',_0x24d781['id']]);if(_0x18ac42)_[_0xa788('0x3b')](_0x24d781,_[_0xa788('0x3c')](_['omit'](_0x18ac42,_0x5d5805),_0x4fc73f));_0x24d781['globalStatus']=getAgentStatus(_0x24d781);return _0x24d781;});})[_0xa788('0x13')](function(_0x234e42){var _0x225e3c;if(_0x2bdee4[_0xa788('0x8b')]['globalStatusFilter']){_0x225e3c=_['filter'](_0x234e42,[_0xa788('0x6e'),_0x2bdee4[_0xa788('0x8b')]['globalStatusFilter']]);if(_0x2bdee4[_0xa788('0x8b')][_0xa788('0xa0')]){_0x225e3c=_[_0xa788('0x55')](_0x225e3c,[_0xa788('0x70'),_0x2bdee4['query'][_0xa788('0xa0')]]);}}if(_0x225e3c)_0x234e42=_0x225e3c;if(!_0x1dbe05)return _0x234e42;return orderAgentsByStatus(_0x234e42,_0x1dbe05);})[_0xa788('0x13')](function(_0x3656c8){_0x4ded60['rows']=_0x3656c8;return _0x4ded60;})['then'](respondWithFilteredResult(_0x464ea0,_0xd0269b))[_0xa788('0x18')](handleError(_0x464ea0,null));};exports[_0xa788('0xa1')]=function(_0x2716b8,_0x3cc6d0){var _0x697a6a={'count':0x0,'rows':[]},_0x2189d8={},_0x3ef561,_0x44aee0,_0x51dce6,_0x307ac7,_0x8d4dd9;Promise[_0xa788('0x8a')]()[_0xa788('0x13')](function(){if(_0x2716b8[_0xa788('0x8b')][_0xa788('0x8c')])_0x3ef561=validateChannel(_0x2716b8[_0xa788('0x8b')][_0xa788('0x8c')]);var _0x4990fe=_[_0xa788('0x1b')](_0x3ef561)+'Queue';var _0x78e74d=_[_0xa788('0x34')](db[_0x4990fe]['rawAttributes'],function(_0x4c5abd){return{'name':_0x4c5abd[_0xa788('0x91')],'type':_0x4c5abd['type']['key']};});_0x2189d8=qs[_0xa788('0x95')](_0x78e74d,_0x2716b8);if(_0x2716b8['user'][_0xa788('0x93')]===_0xa788('0x99')){var _0x21d5e6={'params':{'id':_0x2716b8['user'][_0xa788('0x9a')]},'query':{'section':_0x3ef561===_0xa788('0x19')&&_0x2716b8[_0xa788('0x8b')][_0xa788('0x92')]==='outbound'?_0xa788('0xa2'):_[_0xa788('0x1b')](_0x3ef561)+_0xa788('0x1c'),'type':_0x2716b8[_0xa788('0x8b')][_0xa788('0x92')],'nolimit':!![],'sort':_0xa788('0x11'),'filter':_0x2716b8['query'][_0xa788('0x55')]}};return db['UserProfile']['getResources'](_0x21d5e6);}return db[_0x4990fe][_0xa788('0x9e')](_0x2189d8);})[_0xa788('0x13')](function(_0x486966){_0x697a6a[_0xa788('0xb')]=_0x486966[_0xa788('0xb')];_0x44aee0=_0x486966[_0xa788('0x9f')];return getRealtimeQueues(_0x2716b8,_0x3ef561);})[_0xa788('0x13')](function(_0x476ec0){_0x307ac7=_0x476ec0['rows'];return getRealtimeAgents();})[_0xa788('0x13')](function(_0x1bba44){_0x51dce6=_0x1bba44[_0xa788('0x9f')];if(_0x3ef561!=_0xa788('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0xa788('0x13')](function(_0x5f564b){_0x8d4dd9=_0x5f564b?_0x5f564b[_0xa788('0x9f')]:[];return initializeQueues(_0x44aee0,_0x307ac7,_0x3ef561,_0x2716b8[_0xa788('0x8b')]['type']);})[_0xa788('0x13')](function(_0x2beea1){var _0x42f833=_0x2beea1['map'](function(_0x536142){if(_0x3ef561==='voice')return getVoiceQueueAgents(_0x536142,_0x44aee0,_0x51dce6,_0x8d4dd9);else return getQueueAgents(_0x536142,_0x51dce6,_0x3ef561);});return Promise[_0xa788('0x67')](_0x42f833);})[_0xa788('0x13')](function(_0x350455){_0x697a6a['rows']=_0x350455;return _0x697a6a;})[_0xa788('0x13')](respondWithFilteredResult(_0x3cc6d0,_0x2189d8))[_0xa788('0x18')](handleError(_0x3cc6d0,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e1b1484..d373a3a 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xa9e017,_0xbf9216){var _0x424e7d=function(_0x7d8b34){while(--_0x7d8b34){_0xa9e017['push'](_0xa9e017['shift']());}};_0x424e7d(++_0xbf9216);}(_0x70e0,0x17b));var _0x070e=function(_0x8968f,_0x40df9a){_0x8968f=_0x8968f-0x0;var _0x5d76c9=_0x70e0[_0x8968f];return _0x5d76c9;};'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(_0x5c23cc,_0x3bac85){var _0x1add2d=function(_0x349672){while(--_0x349672){_0x5c23cc['push'](_0x5c23cc['shift']());}};_0x1add2d(++_0x3bac85);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 611fec9..086baaa 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 _0x3e4d=['STRING','sequelize','INTEGER','DATE'];(function(_0xe34a7d,_0x5bbc78){var _0x454b8a=function(_0x26801c){while(--_0x26801c){_0xe34a7d['push'](_0xe34a7d['shift']());}};_0x454b8a(++_0x5bbc78);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x7ad6c3,_0xe87a7f){_0x7ad6c3=_0x7ad6c3-0x0;var _0xfe8a22=_0x3e4d[_0x7ad6c3];return _0xfe8a22;};'use strict';var Sequelize=require(_0xd3e4('0x0'));module['exports']={'state':{'type':Sequelize[_0xd3e4('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd3e4('0x2')]},'responsetime':{'type':Sequelize[_0xd3e4('0x2')]},'ringtime':{'type':Sequelize[_0xd3e4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd3e4('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25fa=['DATE','sequelize','INTEGER','STRING'];(function(_0x2ad4af,_0x4f6b8f){var _0x22fb69=function(_0x28363e){while(--_0x28363e){_0x2ad4af['push'](_0x2ad4af['shift']());}};_0x22fb69(++_0x4f6b8f);}(_0x25fa,0x109));var _0xa25f=function(_0x37c553,_0x1b82ea){_0x37c553=_0x37c553-0x0;var _0xf80ce4=_0x25fa[_0x37c553];return _0xf80ce4;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'state':{'type':Sequelize[_0xa25f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa25f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xa25f('0x2')]},'starttime':{'type':Sequelize[_0xa25f('0x3')]},'responsetime':{'type':Sequelize[_0xa25f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa25f('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7cdd914..beb1c32 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 _0x2e66=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview'];(function(_0x3647a0,_0x1929f3){var _0x561b64=function(_0x5ec461){while(--_0x5ec461){_0x3647a0['push'](_0x3647a0['shift']());}};_0x561b64(++_0x1929f3);}(_0x2e66,0x198));var _0x62e6=function(_0x787414,_0x34afba){_0x787414=_0x787414-0x0;var _0x249882=_0x2e66[_0x787414];return _0x249882;};'use strict';var _=require(_0x62e6('0x0'));var util=require(_0x62e6('0x1'));var logger=require(_0x62e6('0x2'))(_0x62e6('0x3'));var moment=require(_0x62e6('0x4'));var BPromise=require('bluebird');var rp=require(_0x62e6('0x5'));var fs=require('fs');var path=require(_0x62e6('0x6'));var rimraf=require(_0x62e6('0x7'));var config=require(_0x62e6('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x62e6('0x9')]=function(_0x57d9bd,_0xef695e){return _0x57d9bd['define'](_0x62e6('0xa'),attributes,{'tableName':_0x62e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef23=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','util'];(function(_0x3dd62a,_0x5b78c4){var _0x1eab97=function(_0x56156b){while(--_0x56156b){_0x3dd62a['push'](_0x3dd62a['shift']());}};_0x1eab97(++_0x5b78c4);}(_0xef23,0x1d5));var _0x3ef2=function(_0x2bbed7,_0x1a4257){_0x2bbed7=_0x2bbed7-0x0;var _0x110106=_0xef23[_0x2bbed7];return _0x110106;};'use strict';var _=require('lodash');var util=require(_0x3ef2('0x0'));var logger=require(_0x3ef2('0x1'))(_0x3ef2('0x2'));var moment=require('moment');var BPromise=require(_0x3ef2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ef2('0x4'));var rimraf=require(_0x3ef2('0x5'));var config=require(_0x3ef2('0x6'));var attributes=require(_0x3ef2('0x7'));module['exports']=function(_0x36f6a7,_0x5eaa4e){return _0x36f6a7['define'](_0x3ef2('0x8'),attributes,{'tableName':_0x3ef2('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 de5ab7d..95fa760 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 _0x3e7a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x3767e7,_0x5ae04e){var _0x4fec85=function(_0x4cfcf4){while(--_0x4cfcf4){_0x3767e7['push'](_0x3767e7['shift']());}};_0x4fec85(++_0x5ae04e);}(_0x3e7a,0xf7));var _0xa3e7=function(_0x560e46,_0x2ffbd6){_0x560e46=_0x560e46-0x0;var _0x4c8a06=_0x3e7a[_0x560e46];return _0x4c8a06;};'use strict';var _=require(_0xa3e7('0x0'));var util=require(_0xa3e7('0x1'));var moment=require(_0xa3e7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3e7('0x3'));var db=require(_0xa3e7('0x4'))['db'];var utils=require(_0xa3e7('0x5'));var logger=require(_0xa3e7('0x6'))(_0xa3e7('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3e7('0x8'));var client=jayson[_0xa3e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41ab7b,_0x28dc28,_0x247a70){return new BPromise(function(_0x20cf51,_0x57502a){return client[_0xa3e7('0xa')](_0x41ab7b,_0x247a70)[_0xa3e7('0xb')](function(_0x57b9f0){logger[_0xa3e7('0xc')](_0xa3e7('0xd'),_0x28dc28,'request\x20sent');logger[_0xa3e7('0xe')](_0xa3e7('0xf'),_0x28dc28,_0xa3e7('0x10'),JSON[_0xa3e7('0x11')](_0x57b9f0));if(_0x57b9f0[_0xa3e7('0x12')]){if(_0x57b9f0[_0xa3e7('0x12')][_0xa3e7('0x13')]===0x1f4){logger[_0xa3e7('0x12')](_0xa3e7('0xd'),_0x28dc28,_0x57b9f0[_0xa3e7('0x12')][_0xa3e7('0x14')]);return _0x57502a(_0x57b9f0[_0xa3e7('0x12')][_0xa3e7('0x14')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x28dc28,_0x57b9f0[_0xa3e7('0x12')][_0xa3e7('0x14')]);return _0x20cf51(_0x57b9f0[_0xa3e7('0x12')][_0xa3e7('0x14')]);}else{logger[_0xa3e7('0xc')](_0xa3e7('0xd'),_0x28dc28,_0xa3e7('0x10'));_0x20cf51(_0x57b9f0[_0xa3e7('0x15')][_0xa3e7('0x14')]);}})[_0xa3e7('0x16')](function(_0x42d034){logger[_0xa3e7('0x12')](_0xa3e7('0xd'),_0x28dc28,_0x42d034);_0x57502a(_0x42d034);});});}exports[_0xa3e7('0x17')]=function(_0x4c2811){var _0x5a3d1e=this;return new Promise(function(_0x4f9c3b,_0x20ca28){return db[_0xa3e7('0x18')]['create'](_0x4c2811[_0xa3e7('0x19')],{'raw':_0x4c2811['options']?_0x4c2811[_0xa3e7('0x1a')][_0xa3e7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x9e2b69){logger['info']('CreateReportAgentPreview',_0x4c2811);logger[_0xa3e7('0xe')](_0xa3e7('0x17'),_0x4c2811,JSON[_0xa3e7('0x11')](_0x9e2b69));_0x4f9c3b(_0x9e2b69);})[_0xa3e7('0x16')](function(_0x4f3af3){logger[_0xa3e7('0x12')](_0xa3e7('0x17'),_0x4f3af3[_0xa3e7('0x14')],_0x4c2811);_0x20ca28(_0x5a3d1e['error'](0x1f4,_0x4f3af3[_0xa3e7('0x14')]));});});}; \ No newline at end of file +var _0xd913=['catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result'];(function(_0x5b88b4,_0x23f575){var _0x1ca30b=function(_0x382aea){while(--_0x382aea){_0x5b88b4['push'](_0x5b88b4['shift']());}};_0x1ca30b(++_0x23f575);}(_0xd913,0xee));var _0x3d91=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xd913[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x3d91('0x0'));var util=require(_0x3d91('0x1'));var moment=require(_0x3d91('0x2'));var BPromise=require(_0x3d91('0x3'));var rs=require(_0x3d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d91('0x5'));var logger=require(_0x3d91('0x6'))(_0x3d91('0x7'));var config=require(_0x3d91('0x8'));var jayson=require(_0x3d91('0x9'));var client=jayson[_0x3d91('0xa')][_0x3d91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x497877,_0x5085c3,_0x461ecb){return new BPromise(function(_0x437257,_0x3a3cfd){return client[_0x3d91('0xc')](_0x497877,_0x461ecb)[_0x3d91('0xd')](function(_0x3d02d5){logger[_0x3d91('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x5085c3,_0x3d91('0xf'));logger[_0x3d91('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5085c3,_0x3d91('0xf'),JSON[_0x3d91('0x11')](_0x3d02d5));if(_0x3d02d5[_0x3d91('0x12')]){if(_0x3d02d5[_0x3d91('0x12')][_0x3d91('0x13')]===0x1f4){logger[_0x3d91('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5085c3,_0x3d02d5[_0x3d91('0x12')]['message']);return _0x3a3cfd(_0x3d02d5['error'][_0x3d91('0x14')]);}logger[_0x3d91('0x12')](_0x3d91('0x15'),_0x5085c3,_0x3d02d5[_0x3d91('0x12')][_0x3d91('0x14')]);return _0x437257(_0x3d02d5['error'][_0x3d91('0x14')]);}else{logger[_0x3d91('0xe')](_0x3d91('0x15'),_0x5085c3,'request\x20sent');_0x437257(_0x3d02d5[_0x3d91('0x16')]['message']);}})[_0x3d91('0x17')](function(_0x55b728){logger['error'](_0x3d91('0x15'),_0x5085c3,_0x55b728);_0x3a3cfd(_0x55b728);});});}exports[_0x3d91('0x18')]=function(_0x47453c){var _0x26d476=this;return new Promise(function(_0x1c3124,_0x1b44a1){return db[_0x3d91('0x19')][_0x3d91('0x1a')](_0x47453c[_0x3d91('0x1b')],{'raw':_0x47453c[_0x3d91('0x1c')]?_0x47453c[_0x3d91('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3d91('0xd')](function(_0x342758){logger['info'](_0x3d91('0x18'),_0x47453c);logger[_0x3d91('0x10')]('CreateReportAgentPreview',_0x47453c,JSON[_0x3d91('0x11')](_0x342758));_0x1c3124(_0x342758);})['catch'](function(_0xcc93ac){logger['error'](_0x3d91('0x18'),_0xcc93ac[_0x3d91('0x14')],_0x47453c);_0x1b44a1(_0x26d476[_0x3d91('0x12')](0x1f4,_0xcc93ac[_0x3d91('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 002c32b..1752bbf 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 _0xa317=['/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','/voice/queues/:id','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa317,0x13a));var _0x7a31=function(_0xd1e916,_0x264c19){_0xd1e916=_0xd1e916-0x0;var _0x15ba88=_0xa317[_0xd1e916];return _0x15ba88;};'use strict';var multer=require(_0x7a31('0x0'));var util=require(_0x7a31('0x1'));var path=require(_0x7a31('0x2'));var express=require('express');var router=express[_0x7a31('0x3')]();var auth=require(_0x7a31('0x4'));var controller=require(_0x7a31('0x5'));router[_0x7a31('0x6')]('/voice/channels',auth[_0x7a31('0x7')](),controller[_0x7a31('0x8')]);router[_0x7a31('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x7a31('0x7')](),controller['voiceChannelMixMonitor']);router[_0x7a31('0x6')](_0x7a31('0x9'),auth[_0x7a31('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x7a31('0xa'),auth[_0x7a31('0x7')](),controller['voiceQueues']);router[_0x7a31('0x6')]('/chat/queues',auth['isAuthenticated'](),controller[_0x7a31('0xb')]);router[_0x7a31('0x6')](_0x7a31('0xc'),auth[_0x7a31('0x7')](),controller['mailQueues']);router[_0x7a31('0x6')](_0x7a31('0xd'),auth[_0x7a31('0x7')](),controller['mailAccounts']);router[_0x7a31('0x6')](_0x7a31('0xe'),auth[_0x7a31('0x7')](),controller[_0x7a31('0xf')]);router[_0x7a31('0x6')](_0x7a31('0x10'),auth[_0x7a31('0x7')](),controller['smsQueues']);router['get'](_0x7a31('0x11'),auth[_0x7a31('0x7')](),controller['whatsappQueues']);router[_0x7a31('0x6')](_0x7a31('0x12'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x13')]);router['get'](_0x7a31('0x14'),auth[_0x7a31('0x7')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0x7a31('0x7')](),controller[_0x7a31('0x15')]);router[_0x7a31('0x6')](_0x7a31('0x16'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x17')]);router['get'](_0x7a31('0x18'),auth['isAuthenticated'](),controller[_0x7a31('0x19')]);router[_0x7a31('0x6')](_0x7a31('0x1a'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x1b')]);router[_0x7a31('0x6')]('/voice/queues/:id',auth[_0x7a31('0x7')](),controller['showVoiceQueues']);router[_0x7a31('0x1c')](_0x7a31('0x1d'),auth[_0x7a31('0x7')](),controller['updateVoiceQueue']);router['get'](_0x7a31('0x1e'),auth[_0x7a31('0x7')](),controller['outbound']);router['get'](_0x7a31('0x1f'),auth['isAuthenticated'](),controller[_0x7a31('0x20')]);router[_0x7a31('0x6')](_0x7a31('0x21'),auth['isAuthenticated'](),controller[_0x7a31('0x22')]);router[_0x7a31('0x1c')](_0x7a31('0x23'),auth['isAuthenticated'](),controller[_0x7a31('0x24')]);router['get']('/telephones',auth[_0x7a31('0x7')](),controller[_0x7a31('0x25')]);router[_0x7a31('0x6')](_0x7a31('0x26'),auth[_0x7a31('0x7')](),controller['trunks']);router[_0x7a31('0x6')](_0x7a31('0x27'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x28')]);router['get'](_0x7a31('0x29'),auth['isAuthenticated'](),controller[_0x7a31('0x2a')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x7a31('0x2b')]);router['get'](_0x7a31('0x2c'),auth['isAuthenticated'](),controller[_0x7a31('0x2d')]);router[_0x7a31('0x6')](_0x7a31('0x2e'),auth[_0x7a31('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x7a31('0x6')](_0x7a31('0x2f'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x30')]);router['get']('/sms/queues/waitinginteractions',auth[_0x7a31('0x7')](),controller[_0x7a31('0x31')]);router['get'](_0x7a31('0x32'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x33')]);router[_0x7a31('0x6')]('/fax/queues/waitinginteractions',auth[_0x7a31('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x7a31('0x34')](_0x7a31('0x35'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x36')](_0x7a31('0x37')));router[_0x7a31('0x6')](_0x7a31('0x38'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x39')]);router[_0x7a31('0x34')]('/chat/queues/:id/notify',auth[_0x7a31('0x7')](),controller[_0x7a31('0x36')](_0x7a31('0x3a')));router['get'](_0x7a31('0x3b'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x3c')]);router[_0x7a31('0x34')](_0x7a31('0x3d'),auth[_0x7a31('0x7')](),controller['queueNotify']('fax'));router[_0x7a31('0x6')](_0x7a31('0x3e'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x3f')]);router[_0x7a31('0x34')](_0x7a31('0x40'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x36')](_0x7a31('0x41')));router[_0x7a31('0x6')](_0x7a31('0x42'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x43')]);router[_0x7a31('0x34')](_0x7a31('0x44'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x36')](_0x7a31('0x45')));router[_0x7a31('0x34')](_0x7a31('0x46'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x36')]('whatsapp'));router[_0x7a31('0x6')]('/sms/queues/:id',auth[_0x7a31('0x7')](),controller[_0x7a31('0x47')]);router[_0x7a31('0x6')]('/whatsapp/queues/:id',auth[_0x7a31('0x7')](),controller[_0x7a31('0x48')]);router['post'](_0x7a31('0x49'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x7a31('0x4a')]=router; \ No newline at end of file +var _0x79ef=['./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','util','express','Router','../../components/auth/service'];(function(_0x5ccfe2,_0x5c0cae){var _0x5e1678=function(_0x16ffc2){while(--_0x16ffc2){_0x5ccfe2['push'](_0x5ccfe2['shift']());}};_0x5e1678(++_0x5c0cae);}(_0x79ef,0x13b));var _0xf79e=function(_0x10d08c,_0x3f690b){_0x10d08c=_0x10d08c-0x0;var _0x2b3e2c=_0x79ef[_0x10d08c];return _0x2b3e2c;};'use strict';var multer=require(_0xf79e('0x0'));var util=require(_0xf79e('0x1'));var path=require('path');var express=require(_0xf79e('0x2'));var router=express[_0xf79e('0x3')]();var auth=require(_0xf79e('0x4'));var controller=require(_0xf79e('0x5'));router[_0xf79e('0x6')](_0xf79e('0x7'),auth[_0xf79e('0x8')](),controller['voiceChannels']);router[_0xf79e('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xf79e('0x8')](),controller[_0xf79e('0x9')]);router[_0xf79e('0x6')](_0xf79e('0xa'),auth[_0xf79e('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xf79e('0x6')](_0xf79e('0xb'),auth['isAuthenticated'](),controller[_0xf79e('0xc')]);router[_0xf79e('0x6')](_0xf79e('0xd'),auth['isAuthenticated'](),controller[_0xf79e('0xe')]);router[_0xf79e('0x6')](_0xf79e('0xf'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x10')]);router[_0xf79e('0x6')](_0xf79e('0x11'),auth['isAuthenticated'](),controller[_0xf79e('0x12')]);router[_0xf79e('0x6')](_0xf79e('0x13'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x14')]);router[_0xf79e('0x6')](_0xf79e('0x15'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x16')]);router[_0xf79e('0x6')](_0xf79e('0x17'),auth['isAuthenticated'](),controller[_0xf79e('0x18')]);router[_0xf79e('0x6')]('/fax/queues',auth[_0xf79e('0x8')](),controller[_0xf79e('0x19')]);router['get']('/voice/queues/preview/:id',auth[_0xf79e('0x8')](),controller[_0xf79e('0x1a')]);router['get'](_0xf79e('0x1b'),auth['isAuthenticated'](),controller[_0xf79e('0x1c')]);router[_0xf79e('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xf79e('0x1d')]);router[_0xf79e('0x6')](_0xf79e('0x1e'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x1f')]);router[_0xf79e('0x6')](_0xf79e('0x20'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x21')]);router[_0xf79e('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xf79e('0x22')]);router['put']('/voice/queues/:id',auth[_0xf79e('0x8')](),controller[_0xf79e('0x23')]);router[_0xf79e('0x6')](_0xf79e('0x24'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x25')]);router[_0xf79e('0x6')](_0xf79e('0x26'),auth['isAuthenticated'](),controller[_0xf79e('0x27')]);router['get']('/agents',auth[_0xf79e('0x8')](),controller[_0xf79e('0x28')]);router[_0xf79e('0x29')](_0xf79e('0x2a'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x2b')]);router[_0xf79e('0x6')](_0xf79e('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0xf79e('0x6')]('/trunks',auth[_0xf79e('0x8')](),controller[_0xf79e('0x2d')]);router[_0xf79e('0x6')]('/campaigns',auth[_0xf79e('0x8')](),controller[_0xf79e('0x2e')]);router['get'](_0xf79e('0x2f'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x30')]);router[_0xf79e('0x6')](_0xf79e('0x31'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x32')]);router[_0xf79e('0x6')](_0xf79e('0x33'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x34')]);router[_0xf79e('0x6')](_0xf79e('0x35'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x36')]);router[_0xf79e('0x6')](_0xf79e('0x37'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x38')]);router['get'](_0xf79e('0x39'),auth[_0xf79e('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xf79e('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xf79e('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xf79e('0x3a'),auth['isAuthenticated'](),controller[_0xf79e('0x3b')]);router[_0xf79e('0x3c')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf79e('0x3d')](_0xf79e('0x3e')));router['get'](_0xf79e('0x3f'),auth[_0xf79e('0x8')](),controller['showMailQueues']);router['post'](_0xf79e('0x40'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x41')));router['get'](_0xf79e('0x42'),auth[_0xf79e('0x8')](),controller['showChatQueues']);router[_0xf79e('0x3c')](_0xf79e('0x43'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x44')));router['get'](_0xf79e('0x45'),auth[_0xf79e('0x8')](),controller['showFaxQueues']);router[_0xf79e('0x3c')](_0xf79e('0x46'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x47')));router[_0xf79e('0x6')](_0xf79e('0x48'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x49')]);router[_0xf79e('0x3c')](_0xf79e('0x4a'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x4b')));router[_0xf79e('0x3c')]('/whatsapp/queues/:id/notify',auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x4c')));router['get'](_0xf79e('0x4d'),auth[_0xf79e('0x8')](),controller['showSmsQueues']);router[_0xf79e('0x6')](_0xf79e('0x4e'),auth[_0xf79e('0x8')](),controller['showWhatsappQueues']);router[_0xf79e('0x3c')](_0xf79e('0x4f'),auth[_0xf79e('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 852f0e7..77915fe 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 _0x7c09=['update','MessageId','agent','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User'];(function(_0xc98d45,_0x5c8d0e){var _0x51e7b5=function(_0x304f45){while(--_0x304f45){_0xc98d45['push'](_0xc98d45['shift']());}};_0x51e7b5(++_0x5c8d0e);}(_0x7c09,0x102));var _0x97c0=function(_0x2547a0,_0x25ae4e){_0x2547a0=_0x2547a0-0x0;var _0x88f6a=_0x7c09[_0x2547a0];return _0x88f6a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x97c0('0x0'));var _=require(_0x97c0('0x1'));var util=require('util');var db=require(_0x97c0('0x2'))['db'];var logger=require(_0x97c0('0x3'))(_0x97c0('0x4'));var jayson=require(_0x97c0('0x5'));var amiClient=jayson[_0x97c0('0x6')][_0x97c0('0x7')]({'port':0x232a});var mailClient=jayson[_0x97c0('0x6')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){var _0x57661a=_0x2c19fa?_0x2c19fa:amiClient;return _0x57661a[_0x97c0('0x8')](_0x46fdd9,_0x42c6c7)['then'](function(_0x2d5507){if(_0x2d5507[_0x97c0('0x9')]){if(_0x2d5507['error']['code']===0x1f4){return _0x293785(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}return _0x109bc8(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}else{_0x109bc8(_0x2d5507[_0x97c0('0xb')]);}})[_0x97c0('0xc')](function(_0x7fc93){_0x293785(_0x7fc93);});});}function respondWithResult(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xc8;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0xd')](_0x9ca3c1)[_0x97c0('0xe')](_0x2ecf34);}return _0x39a3b4[_0x97c0('0xf')](0x194);};}function handleError(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0x1f4;return function(_0x15b336){logger[_0x97c0('0x9')](_0x15b336['stack']);if(_0x15b336[_0x97c0('0x10')]){delete _0x15b336[_0x97c0('0x10')];}_0x514782[_0x97c0('0xd')](_0x3f2fc2)[_0x97c0('0x11')](_0x15b336);};}function findById(_0x482be5){return function(_0x13d46e){if(!_['isNil'](_0x482be5)&&!_[_0x97c0('0x12')](_0x13d46e)&&!_[_0x97c0('0x12')](_0x13d46e['rows'])){return _[_0x97c0('0x13')](_0x13d46e[_0x97c0('0x14')],function(_0x179d43){return _0x179d43['id']==_0x482be5;});}return null;};}exports[_0x97c0('0x15')]=function(_0x183e2e,_0x3e7a52){return respondWithRpcPromise(_0x97c0('0x16'),_0x183e2e[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x3e7a52,null))[_0x97c0('0xc')](handleError(_0x3e7a52,null));};exports['voiceChannelMixMonitor']=function(_0x554122,_0x2b74a2){return respondWithRpcPromise(_0x97c0('0x19'),_[_0x97c0('0x1a')](_0x554122['query'],_0x554122[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x2b74a2,null))[_0x97c0('0xc')](handleError(_0x2b74a2,null));};exports[_0x97c0('0x1c')]=function(_0x30fba2,_0x3a0bfb){return respondWithRpcPromise(_0x97c0('0x1d'),_['merge'](_0x30fba2[_0x97c0('0x17')],_0x30fba2[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x3a0bfb,null))[_0x97c0('0xc')](handleError(_0x3a0bfb,null));};exports['voiceQueues']=function(_0x2bda6c,_0x14cada){return respondWithRpcPromise('VoiceQueues',_0x2bda6c[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x14cada,null))[_0x97c0('0xc')](handleError(_0x14cada,null));};exports['showVoiceQueues']=function(_0x4f11ba,_0x51f258){return respondWithRpcPromise(_0x97c0('0x1e'),_0x4f11ba[_0x97c0('0x17')])[_0x97c0('0x18')](findById(_0x4f11ba[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x51f258,null))[_0x97c0('0xc')](handleError(_0x51f258,null));};exports['updateVoiceQueue']=function(_0x10e47e,_0x1c183f){return respondWithRpcPromise(_0x97c0('0x1f'),_['merge'](_0x10e47e[_0x97c0('0x20')],_0x10e47e[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1c183f,null))[_0x97c0('0xc')](handleError(_0x1c183f,null));};exports[_0x97c0('0x21')]=function(_0x5c4e4e,_0x59abbb){return respondWithRpcPromise(_0x97c0('0x22'),_[_0x97c0('0x1a')](_0x5c4e4e[_0x97c0('0x17')],_0x5c4e4e['params']))[_0x97c0('0x18')](respondWithResult(_0x59abbb,null))[_0x97c0('0xc')](handleError(_0x59abbb,null));};exports['voiceQueuesChannels']=function(_0x30147b,_0x22833e){return respondWithRpcPromise(_0x97c0('0x23'),_0x30147b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x22833e,null))[_0x97c0('0xc')](handleError(_0x22833e,null));};exports[_0x97c0('0x24')]=function(_0x1a6c4b,_0x30b927){return respondWithRpcPromise(_0x97c0('0x25'),_[_0x97c0('0x1a')](_0x1a6c4b[_0x97c0('0x17')],_0x1a6c4b[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x30b927,null))[_0x97c0('0xc')](handleError(_0x30b927,null));};exports['voiceQueuesChannelHangup']=function(_0x292560,_0x1548b6){return respondWithRpcPromise(_0x97c0('0x26'),_[_0x97c0('0x1a')](_0x292560[_0x97c0('0x17')],_0x292560[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1548b6,null))[_0x97c0('0xc')](handleError(_0x1548b6,null));};exports['voiceQueuesChannelRedirect']=function(_0xd72d47,_0x4bf42a){return respondWithRpcPromise(_0x97c0('0x27'),_[_0x97c0('0x1a')](_0xd72d47[_0x97c0('0x17')],_0xd72d47[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x4bf42a,null))[_0x97c0('0xc')](handleError(_0x4bf42a,null));};exports[_0x97c0('0x28')]=function(_0x225ca4,_0x38f37a){return respondWithRpcPromise(_0x97c0('0x29'),_0x225ca4[_0x97c0('0x17')])['then'](respondWithResult(_0x38f37a,null))[_0x97c0('0xc')](handleError(_0x38f37a,null));};exports[_0x97c0('0x2a')]=function(_0x4d47b1,_0x137ee1){return respondWithRpcPromise(_0x97c0('0x2b'),_0x4d47b1[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x137ee1,null))['catch'](handleError(_0x137ee1,null));};exports[_0x97c0('0x2c')]=function(_0x4f1629,_0x1acf31){var _0x64cfcd;return respondWithRpcPromise('Agents',_0x4f1629[_0x97c0('0x17')])[_0x97c0('0x18')](function(_0xd728dd){_0x64cfcd=_0xd728dd;return respondWithRpcPromise(_0x97c0('0x2d'),_0x4f1629[_0x97c0('0x17')],routingClient);})[_0x97c0('0x18')](function(_0x36b3d0){return _[_0x97c0('0x1a')]({},_0x36b3d0,_0x64cfcd);})[_0x97c0('0x18')](respondWithResult(_0x1acf31,null))[_0x97c0('0xc')](handleError(_0x1acf31,null));};exports[_0x97c0('0x2e')]=function(_0x2cca4c,_0x1351d2){if(_0x2cca4c['body']&&_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')]&&_0x2cca4c[_0x97c0('0x30')]&&_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]){for(var _0x375ebc in _0x2cca4c[_0x97c0('0x20')]['interaction']){if(_0x2cca4c['body'][_0x97c0('0x2f')][_0x97c0('0x31')](_0x375ebc)){db[_0x97c0('0x32')][_0x97c0('0x33')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc]&&_0x2cca4c['body']['interaction'][_0x375ebc][_0x97c0('0x34')]?{'$notIn':_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc]}:{'$ne':null}}})[_0x97c0('0x18')](function(_0x2f538b){var _0x483656=moment()[_0x97c0('0x35')](_0x97c0('0x36'));for(var _0x342eeb=0x0,_0x10a8ea=_0x2f538b[_0x97c0('0x34')];_0x342eeb<_0x10a8ea;_0x342eeb+=0x1){_0x2f538b[_0x342eeb][_0x97c0('0x37')]({'exitAt':_0x483656});}});for(var _0x444e41=0x0;_0x444e41<_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc][_0x97c0('0x34')];_0x444e41+=0x1){db['MemberReport'][_0x97c0('0x38')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'type':_0x97c0('0x39'),'uniqueid':_0x2cca4c['body']['interaction'][_0x375ebc][_0x444e41],'exitAt':null},'defaults':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'interface':_[_0x97c0('0x12')](_0x2cca4c['user'][_0x97c0('0x3a')])?util[_0x97c0('0x35')](_0x97c0('0x3b'),_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]):_0x2cca4c['user'][_0x97c0('0x3a')],'type':_0x97c0('0x39'),'enterAt':moment()[_0x97c0('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x2cca4c[_0x97c0('0x30')]['internal'],'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc][_0x444e41]}});}}}}return respondWithRpcPromise(_0x97c0('0x3c'),{'id':_0x2cca4c[_0x97c0('0x1b')]['id'],'capacity':_0x2cca4c['body']['capacity']},routingClient)['then'](respondWithResult(_0x1351d2,null))[_0x97c0('0xc')](handleError(_0x1351d2,null));};exports[_0x97c0('0x3d')]=function(_0x3afef4,_0xdb2767){return respondWithRpcPromise(_0x97c0('0x3e'),_0x3afef4[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0xdb2767,null))['catch'](handleError(_0xdb2767,null));};exports[_0x97c0('0x3f')]=function(_0x3f074b,_0x20cd9c){return respondWithRpcPromise(_0x97c0('0x40'),_0x3f074b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x20cd9c,null))['catch'](handleError(_0x20cd9c,null));};exports[_0x97c0('0x41')]=function(_0x86a497,_0x4fbc1e){return respondWithRpcPromise(_0x97c0('0x42'),_0x86a497[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x4fbc1e,null))[_0x97c0('0xc')](handleError(_0x4fbc1e,null));};exports[_0x97c0('0x43')]=function(_0x18992d,_0x47298f){return respondWithRpcPromise('ChatQueues',_0x18992d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x47298f,null))[_0x97c0('0xc')](handleError(_0x47298f,null));};exports[_0x97c0('0x44')]=function(_0x154317,_0x2f1571){return respondWithRpcPromise(_0x97c0('0x45'),_0x154317[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x154317[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x2f1571,null))[_0x97c0('0xc')](handleError(_0x2f1571,null));};exports[_0x97c0('0x46')]=function(_0x57766f,_0x771495){return respondWithRpcPromise(_0x97c0('0x47'),_0x57766f[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x771495,null))[_0x97c0('0xc')](handleError(_0x771495,null));};exports[_0x97c0('0x48')]=function(_0x481f5b,_0x18a6c0){return respondWithRpcPromise(_0x97c0('0x47'),_0x481f5b['query'],routingClient)[_0x97c0('0x18')](findById(_0x481f5b[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x18a6c0,null))['catch'](handleError(_0x18a6c0,null));};exports[_0x97c0('0x49')]=function(_0x4c4fb2,_0x25c750){return respondWithRpcPromise(_0x97c0('0x4a'),_0x4c4fb2[_0x97c0('0x17')],mailClient)[_0x97c0('0x18')](respondWithResult(_0x25c750,null))[_0x97c0('0xc')](handleError(_0x25c750,null));};exports[_0x97c0('0x4b')]=function(_0x52643e,_0x3349df){return respondWithRpcPromise(_0x97c0('0x4c'),_0x52643e[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3349df,null))['catch'](handleError(_0x3349df,null));};exports[_0x97c0('0x4d')]=function(_0x3795db,_0x102f68){return respondWithRpcPromise(_0x97c0('0x4c'),_0x3795db['query'],routingClient)[_0x97c0('0x18')](findById(_0x3795db[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x102f68,null))[_0x97c0('0xc')](handleError(_0x102f68,null));};exports['smsQueues']=function(_0x32881c,_0x3c4c27){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32881c['query'],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3c4c27,null))[_0x97c0('0xc')](handleError(_0x3c4c27,null));};exports[_0x97c0('0x4f')]=function(_0x32e392,_0x373c34){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32e392[_0x97c0('0x17')],routingClient)['then'](findById(_0x32e392['params']['id']))[_0x97c0('0x18')](respondWithResult(_0x373c34,null))[_0x97c0('0xc')](handleError(_0x373c34,null));};exports['whatsappQueues']=function(_0x366a01,_0x5a4738){return respondWithRpcPromise('WhatsappQueues',_0x366a01[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x5a4738,null))[_0x97c0('0xc')](handleError(_0x5a4738,null));};exports[_0x97c0('0x50')]=function(_0x56be23,_0x496336){return respondWithRpcPromise('WhatsappQueues',_0x56be23[_0x97c0('0x17')],routingClient)['then'](findById(_0x56be23[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x496336,null))[_0x97c0('0xc')](handleError(_0x496336,null));};exports[_0x97c0('0x51')]=function(_0x400a8d,_0x321460){return respondWithRpcPromise(_0x97c0('0x52'),_0x400a8d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x321460,null))[_0x97c0('0xc')](handleError(_0x321460,null));};exports[_0x97c0('0x53')]=function(_0x536f72,_0x1c1182){return respondWithRpcPromise(_0x97c0('0x52'),_0x536f72[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x536f72[_0x97c0('0x1b')]['id']))['then'](respondWithResult(_0x1c1182,null))[_0x97c0('0xc')](handleError(_0x1c1182,null));};exports[_0x97c0('0x54')]=function(_0x579f54,_0x4116c9){return respondWithRpcPromise(_0x97c0('0x55'),_0x579f54[_0x97c0('0x17')])['then'](respondWithResult(_0x4116c9,null))[_0x97c0('0xc')](handleError(_0x4116c9,null));};exports[_0x97c0('0x56')]=function(_0x10f1aa,_0x165c72){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x10f1aa['query'],routingClient)['then'](respondWithResult(_0x165c72,null))[_0x97c0('0xc')](handleError(_0x165c72,null));};exports[_0x97c0('0x57')]=function(_0x442bba,_0x41f8e7){return respondWithRpcPromise(_0x97c0('0x58'),_0x442bba[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x41f8e7,null))[_0x97c0('0xc')](handleError(_0x41f8e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52d9d9,_0x199abc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52d9d9['query'],routingClient)['then'](respondWithResult(_0x199abc,null))[_0x97c0('0xc')](handleError(_0x199abc,null));};exports[_0x97c0('0x59')]=function(_0x123a99,_0x30968e){return respondWithRpcPromise(_0x97c0('0x5a'),_0x123a99['query'],routingClient)['then'](function(_0x35ced3){if(_0x123a99[_0x97c0('0x17')][_0x97c0('0x5b')]!==undefined){var _0x3a8ac0=_(_0x35ced3['rows'])[_0x97c0('0x5c')]([_0x123a99['query'][_0x97c0('0x5b')],_0x123a99[_0x97c0('0x1b')]['id']])[_0x97c0('0x5d')](_0x97c0('0x5e'))[_0x97c0('0x5f')]()[_0x97c0('0x60')]();return _0x35ced3[_0x97c0('0x14')][_0x97c0('0x5c')](function(_0x465a92){return _0x3a8ac0[_0x97c0('0x61')](_0x465a92['queue_id'])>-0x1;});}else{return _0x35ced3[_0x97c0('0x14')]['filter'](function(_0x5b8ebd){return _0x5b8ebd[_0x97c0('0x5e')]===parseInt(_0x123a99[_0x97c0('0x1b')]['id']);});}})['then'](respondWithResult(_0x30968e,null))[_0x97c0('0xc')](handleError(_0x30968e,null));};exports['smsQueuesWaitingInteractions']=function(_0x1f2380,_0x24a81c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1f2380[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x24a81c,null))['catch'](handleError(_0x24a81c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xab71f4,_0x12bb6e){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xab71f4[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x12bb6e,null))[_0x97c0('0xc')](handleError(_0x12bb6e,null));};exports[_0x97c0('0x62')]=function(_0x41b864,_0x11db50){return respondWithRpcPromise(_0x97c0('0x63'),_0x41b864[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x11db50,null))[_0x97c0('0xc')](handleError(_0x11db50,null));};exports['queueNotify']=function(_0x597cd1){return function(_0x4062f8,_0x4f9307){var _0x3f69a6,_0x15f953;var _0x567e15=_[_0x97c0('0x64')](_0x597cd1);var _0x344d5f=_0x597cd1===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x567e15+'Queue'][_0x97c0('0x68')]({'raw':!![],'where':{'id':_0x4062f8[_0x97c0('0x1b')]['id']}})[_0x97c0('0x18')](function(_0x58e7c0){if(_[_0x97c0('0x12')](_0x58e7c0)){throw new Error(_0x567e15+_0x97c0('0x69'));}_0x3f69a6=_0x58e7c0;return db[_0x567e15+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x4062f8['body'][_0x97c0('0x6b')]},'include':[{'model':db[_0x567e15+_0x97c0('0x6c')],'as':_0x97c0('0x6c')},{'model':db[_0x567e15+_0x344d5f],'as':_0x97c0('0x67')}]});})[_0x97c0('0x18')](function(_0x5828f7){if(_[_0x97c0('0x12')](_0x5828f7)){throw new Error(_0x567e15+_0x97c0('0x6d'));}_0x15f953=_0x5828f7;return _0x5828f7['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x372415={'uniqueid':_0x597cd1+'.'+_0x15f953['id']+'.'+_0x15f953[_0x97c0('0x6c')]['id'],'FromUserId':_0x4062f8[_0x97c0('0x30')]['id'],'type':'queue'};_0x372415[_0x567e15+'MessageId']=_0x15f953['id'];_0x372415[_0x567e15+_0x97c0('0x6e')]=_0x15f953['Interaction']['id'];_0x372415[_0x97c0('0x6f')+_0x567e15+_0x344d5f+'Id']=_0x15f953[_0x97c0('0x67')]['id'];_0x372415['To'+_0x567e15+_0x97c0('0x70')]=_0x3f69a6['id'];return db[_0x567e15+_0x97c0('0x71')][_0x97c0('0x72')](_0x372415);})[_0x97c0('0x18')](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x597cd1,'interaction':_0x15f953['Interaction'],'message':_0x15f953,'account':_0x15f953[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x74'),'appdata':_0x3f69a6[_0x97c0('0x10')]+','+(_0x15f953[_0x97c0('0x67')][_0x97c0('0x75')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x4f9307,null))[_0x97c0('0xc')](handleError(_0x4f9307,null));};};exports[_0x97c0('0x77')]=function(_0x15b27f,_0x1cc32c){var _0x1b2e52,_0x3c4c8e;if(_[_0x97c0('0x12')](_0x15b27f['body'][_0x97c0('0x78')])){throw new Error(_0x97c0('0x79'));}var _0x2f9ffe=_0x15b27f[_0x97c0('0x20')]['channel'];var _0x1eb0c7=_[_0x97c0('0x64')](_0x2f9ffe);var _0x6b955=_0x2f9ffe===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x97c0('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x15b27f[_0x97c0('0x1b')]['id'],'role':'agent'}})[_0x97c0('0x18')](function(_0x1822b5){if(_[_0x97c0('0x12')](_0x1822b5)){throw new Error('Agent\x20not\x20found');}_0x1b2e52=_0x1822b5;return db[_0x1eb0c7+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x15b27f[_0x97c0('0x20')][_0x97c0('0x6b')]},'include':[{'model':db[_0x1eb0c7+_0x97c0('0x6c')],'as':'Interaction'},{'model':db[_0x1eb0c7+_0x6b955],'as':_0x97c0('0x67')}]});})['then'](function(_0x2db5b0){if(_[_0x97c0('0x12')](_0x2db5b0)){throw new Error(_0x1eb0c7+'\x20Message\x20not\x20found');}_0x3c4c8e=_0x2db5b0;return _0x2db5b0[_0x97c0('0x7b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x97c0('0x18')](function(){var _0x1419cd={'uniqueid':_0x2f9ffe+'.'+_0x3c4c8e['id']+'.'+_0x3c4c8e[_0x97c0('0x6c')]['id'],'FromUserId':_0x15b27f[_0x97c0('0x30')]['id'],'type':_0x97c0('0x74'),'ToUserId':_0x1b2e52['id']};_0x1419cd[_0x1eb0c7+_0x97c0('0x7c')]=_0x3c4c8e['id'];_0x1419cd[_0x1eb0c7+_0x97c0('0x6e')]=_0x3c4c8e['Interaction']['id'];_0x1419cd[_0x97c0('0x6f')+_0x1eb0c7+_0x6b955+'Id']=_0x3c4c8e[_0x97c0('0x67')]['id'];return db[_0x1eb0c7+_0x97c0('0x71')]['create'](_0x1419cd);})['then'](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x2f9ffe,'interaction':_0x3c4c8e[_0x97c0('0x6c')],'message':_0x3c4c8e,'account':_0x3c4c8e[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x7d'),'appdata':_0x1b2e52[_0x97c0('0x10')]+','+(_0x3c4c8e[_0x97c0('0x67')][_0x97c0('0x7e')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x1cc32c,null))[_0x97c0('0xc')](handleError(_0x1cc32c,null));}; \ No newline at end of file +var _0xb4c7=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','queue','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels'];(function(_0x57591f,_0x381000){var _0x198e35=function(_0xfcd0f0){while(--_0xfcd0f0){_0x57591f['push'](_0x57591f['shift']());}};_0x198e35(++_0x381000);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2db327,_0x30ef30){_0x2db327=_0x2db327-0x0;var _0x203d6e=_0xb4c7[_0x2db327];return _0x203d6e;};'use strict';var BPromise=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var db=require(_0x7b4c('0x4'))['db'];var logger=require('../../config/logger')(_0x7b4c('0x5'));var jayson=require(_0x7b4c('0x6'));var amiClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232a});var mailClient=jayson[_0x7b4c('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){var _0x433aa2=_0x2d7b7e?_0x2d7b7e:amiClient;return _0x433aa2[_0x7b4c('0x9')](_0x2dd5c7,_0x4bf85d)[_0x7b4c('0xa')](function(_0x237e28){if(_0x237e28[_0x7b4c('0xb')]){if(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xc')]===0x1f4){return _0x570daa(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xd')]);}return _0x21687f(_0x237e28[_0x7b4c('0xb')]['message']);}else{_0x21687f(_0x237e28['result']);}})[_0x7b4c('0xe')](function(_0x18342b){_0x570daa(_0x18342b);});});}function respondWithResult(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xc8;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0xf')](_0x1722ad)[_0x7b4c('0x10')](_0x3e1558);}return _0x38656b[_0x7b4c('0x11')](0x194);};}function handleError(_0x25b90b,_0x387488){_0x387488=_0x387488||0x1f4;return function(_0x593a19){logger[_0x7b4c('0xb')](_0x593a19[_0x7b4c('0x12')]);if(_0x593a19[_0x7b4c('0x13')]){delete _0x593a19[_0x7b4c('0x13')];}_0x25b90b[_0x7b4c('0xf')](_0x387488)[_0x7b4c('0x14')](_0x593a19);};}function findById(_0x1642e1){return function(_0x22c409){if(!_['isNil'](_0x1642e1)&&!_[_0x7b4c('0x15')](_0x22c409)&&!_[_0x7b4c('0x15')](_0x22c409[_0x7b4c('0x16')])){return _[_0x7b4c('0x17')](_0x22c409['rows'],function(_0x3ce10c){return _0x3ce10c['id']==_0x1642e1;});}return null;};}exports[_0x7b4c('0x18')]=function(_0x32110e,_0x380b79){return respondWithRpcPromise(_0x7b4c('0x19'),_0x32110e[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x380b79,null))[_0x7b4c('0xe')](handleError(_0x380b79,null));};exports[_0x7b4c('0x1b')]=function(_0x55e3df,_0x1f06ec){return respondWithRpcPromise(_0x7b4c('0x1c'),_[_0x7b4c('0x1d')](_0x55e3df[_0x7b4c('0x1a')],_0x55e3df[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x1f06ec,null))[_0x7b4c('0xe')](handleError(_0x1f06ec,null));};exports[_0x7b4c('0x1f')]=function(_0x2ab9e1,_0x2c267c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7b4c('0x1d')](_0x2ab9e1[_0x7b4c('0x1a')],_0x2ab9e1[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x2c267c,null))[_0x7b4c('0xe')](handleError(_0x2c267c,null));};exports[_0x7b4c('0x20')]=function(_0x37c059,_0x459eb4){return respondWithRpcPromise(_0x7b4c('0x21'),_0x37c059[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x459eb4,null))[_0x7b4c('0xe')](handleError(_0x459eb4,null));};exports[_0x7b4c('0x22')]=function(_0x501f75,_0x27f361){return respondWithRpcPromise(_0x7b4c('0x21'),_0x501f75[_0x7b4c('0x1a')])[_0x7b4c('0xa')](findById(_0x501f75[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x27f361,null))[_0x7b4c('0xe')](handleError(_0x27f361,null));};exports[_0x7b4c('0x23')]=function(_0x3e4a46,_0x9a799b){return respondWithRpcPromise(_0x7b4c('0x24'),_[_0x7b4c('0x1d')](_0x3e4a46[_0x7b4c('0x25')],_0x3e4a46[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9a799b,null))[_0x7b4c('0xe')](handleError(_0x9a799b,null));};exports[_0x7b4c('0x26')]=function(_0xce5781,_0x9d3d31){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0xce5781['query'],_0xce5781[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9d3d31,null))[_0x7b4c('0xe')](handleError(_0x9d3d31,null));};exports[_0x7b4c('0x27')]=function(_0x498391,_0x6e66e3){return respondWithRpcPromise(_0x7b4c('0x28'),_0x498391['query'])[_0x7b4c('0xa')](respondWithResult(_0x6e66e3,null))['catch'](handleError(_0x6e66e3,null));};exports[_0x7b4c('0x29')]=function(_0x3b9149,_0x159001){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7b4c('0x1d')](_0x3b9149[_0x7b4c('0x1a')],_0x3b9149['params']))[_0x7b4c('0xa')](respondWithResult(_0x159001,null))[_0x7b4c('0xe')](handleError(_0x159001,null));};exports[_0x7b4c('0x2a')]=function(_0x2e0835,_0x56ff38){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7b4c('0x1d')](_0x2e0835[_0x7b4c('0x1a')],_0x2e0835['params']))[_0x7b4c('0xa')](respondWithResult(_0x56ff38,null))['catch'](handleError(_0x56ff38,null));};exports['voiceQueuesChannelRedirect']=function(_0x11ca38,_0x16ae89){return respondWithRpcPromise(_0x7b4c('0x2b'),_[_0x7b4c('0x1d')](_0x11ca38['query'],_0x11ca38[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x16ae89,null))[_0x7b4c('0xe')](handleError(_0x16ae89,null));};exports[_0x7b4c('0x2c')]=function(_0x346e0c,_0xddd16){return respondWithRpcPromise(_0x7b4c('0x2d'),_0x346e0c['query'])['then'](respondWithResult(_0xddd16,null))[_0x7b4c('0xe')](handleError(_0xddd16,null));};exports[_0x7b4c('0x2e')]=function(_0x31ef1e,_0x123a3a){return respondWithRpcPromise(_0x7b4c('0x2f'),_0x31ef1e['query'])[_0x7b4c('0xa')](respondWithResult(_0x123a3a,null))[_0x7b4c('0xe')](handleError(_0x123a3a,null));};exports[_0x7b4c('0x30')]=function(_0x26346a,_0x22f71b){var _0x25659d;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a[_0x7b4c('0x1a')])[_0x7b4c('0xa')](function(_0x54cd10){_0x25659d=_0x54cd10;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a['query'],routingClient);})[_0x7b4c('0xa')](function(_0x4dc71f){return _[_0x7b4c('0x1d')]({},_0x4dc71f,_0x25659d);})[_0x7b4c('0xa')](respondWithResult(_0x22f71b,null))['catch'](handleError(_0x22f71b,null));};exports['agentCapacity']=function(_0x354578,_0x4314b6){if(_0x354578[_0x7b4c('0x25')]&&_0x354578[_0x7b4c('0x25')]['interaction']&&_0x354578[_0x7b4c('0x32')]&&_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')]){for(var _0x5d4ed8 in _0x354578[_0x7b4c('0x25')]['interaction']){if(_0x354578['body'][_0x7b4c('0x33')]['hasOwnProperty'](_0x5d4ed8)){db[_0x7b4c('0x34')][_0x7b4c('0x35')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'exitAt':null,'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]&&_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]['length']?{'$notIn':_0x354578[_0x7b4c('0x25')]['interaction'][_0x5d4ed8]}:{'$ne':null}}})['then'](function(_0x23372c){var _0x1f1653=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x255cca=0x0,_0x2ce694=_0x23372c[_0x7b4c('0x37')];_0x255cca<_0x2ce694;_0x255cca+=0x1){_0x23372c[_0x255cca][_0x7b4c('0x38')]({'exitAt':_0x1f1653});}});for(var _0x8ebf9b=0x0;_0x8ebf9b<_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x7b4c('0x37')];_0x8ebf9b+=0x1){db['MemberReport'][_0x7b4c('0x39')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b],'exitAt':null},'defaults':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'interface':_[_0x7b4c('0x15')](_0x354578['user']['interface'])?util[_0x7b4c('0x3a')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x32')]['name']):_0x354578[_0x7b4c('0x32')][_0x7b4c('0x3c')],'type':'INTERACTION','enterAt':moment()[_0x7b4c('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7b4c('0x3d'),'internal':_0x354578['user'][_0x7b4c('0x3e')],'uniqueid':_0x354578['body'][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b]}});}}}}return respondWithRpcPromise(_0x7b4c('0x3f'),{'id':_0x354578['params']['id'],'capacity':_0x354578['body'][_0x7b4c('0x40')]},routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4314b6,null))[_0x7b4c('0xe')](handleError(_0x4314b6,null));};exports['telephones']=function(_0x56233b,_0x2fc5b5){return respondWithRpcPromise(_0x7b4c('0x41'),_0x56233b['query'])['then'](respondWithResult(_0x2fc5b5,null))[_0x7b4c('0xe')](handleError(_0x2fc5b5,null));};exports[_0x7b4c('0x42')]=function(_0x166fd1,_0x4b2207){return respondWithRpcPromise(_0x7b4c('0x43'),_0x166fd1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x4b2207,null))['catch'](handleError(_0x4b2207,null));};exports[_0x7b4c('0x44')]=function(_0x4d8491,_0x59db20){return respondWithRpcPromise(_0x7b4c('0x45'),_0x4d8491['query'])['then'](respondWithResult(_0x59db20,null))[_0x7b4c('0xe')](handleError(_0x59db20,null));};exports[_0x7b4c('0x46')]=function(_0xde9f5,_0x17af17){return respondWithRpcPromise('ChatQueues',_0xde9f5['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x17af17,null))[_0x7b4c('0xe')](handleError(_0x17af17,null));};exports[_0x7b4c('0x47')]=function(_0x59b358,_0x255262){return respondWithRpcPromise(_0x7b4c('0x48'),_0x59b358[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x59b358[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x255262,null))['catch'](handleError(_0x255262,null));};exports[_0x7b4c('0x49')]=function(_0x186e7d,_0x30de26){return respondWithRpcPromise(_0x7b4c('0x4a'),_0x186e7d[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x30de26,null))[_0x7b4c('0xe')](handleError(_0x30de26,null));};exports['showMailQueues']=function(_0x4443d0,_0x2dc79a){return respondWithRpcPromise('MailQueues',_0x4443d0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x4443d0[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x2dc79a,null))['catch'](handleError(_0x2dc79a,null));};exports[_0x7b4c('0x4b')]=function(_0x4e84a3,_0x542b85){return respondWithRpcPromise(_0x7b4c('0x4c'),_0x4e84a3[_0x7b4c('0x1a')],mailClient)[_0x7b4c('0xa')](respondWithResult(_0x542b85,null))[_0x7b4c('0xe')](handleError(_0x542b85,null));};exports[_0x7b4c('0x4d')]=function(_0x5b24f6,_0x4fcc9d){return respondWithRpcPromise(_0x7b4c('0x4e'),_0x5b24f6[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4fcc9d,null))['catch'](handleError(_0x4fcc9d,null));};exports[_0x7b4c('0x4f')]=function(_0xc4dae0,_0x36fc5d){return respondWithRpcPromise('OpenchannelQueues',_0xc4dae0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0xc4dae0[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x36fc5d,null))[_0x7b4c('0xe')](handleError(_0x36fc5d,null));};exports[_0x7b4c('0x50')]=function(_0x4ac03e,_0x1c64d5){return respondWithRpcPromise('SmsQueues',_0x4ac03e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x1c64d5,null))[_0x7b4c('0xe')](handleError(_0x1c64d5,null));};exports['showSmsQueues']=function(_0x5af2af,_0x237921){return respondWithRpcPromise(_0x7b4c('0x51'),_0x5af2af[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x5af2af[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x237921,null))[_0x7b4c('0xe')](handleError(_0x237921,null));};exports[_0x7b4c('0x52')]=function(_0x1315bd,_0x5f3ed5){return respondWithRpcPromise(_0x7b4c('0x53'),_0x1315bd['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x5f3ed5,null))[_0x7b4c('0xe')](handleError(_0x5f3ed5,null));};exports['showWhatsappQueues']=function(_0x7a38e,_0x13a882){return respondWithRpcPromise(_0x7b4c('0x53'),_0x7a38e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x7a38e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x13a882,null))[_0x7b4c('0xe')](handleError(_0x13a882,null));};exports['faxQueues']=function(_0x10d5b3,_0x2dc9a4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x10d5b3[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x2dc9a4,null))[_0x7b4c('0xe')](handleError(_0x2dc9a4,null));};exports[_0x7b4c('0x55')]=function(_0x2a5f6e,_0x34fce4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x2a5f6e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x2a5f6e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x34fce4,null))[_0x7b4c('0xe')](handleError(_0x34fce4,null));};exports[_0x7b4c('0x56')]=function(_0x168aa1,_0x36c7d9){return respondWithRpcPromise(_0x7b4c('0x57'),_0x168aa1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x36c7d9,null))['catch'](handleError(_0x36c7d9,null));};exports[_0x7b4c('0x58')]=function(_0x15033e,_0x50069b){return respondWithRpcPromise(_0x7b4c('0x59'),_0x15033e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x50069b,null))[_0x7b4c('0xe')](handleError(_0x50069b,null));};exports[_0x7b4c('0x5a')]=function(_0x15df66,_0x22a254){return respondWithRpcPromise(_0x7b4c('0x5b'),_0x15df66[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x22a254,null))[_0x7b4c('0xe')](handleError(_0x22a254,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x35067f,_0x5477e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x35067f[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x5477e3,null))['catch'](handleError(_0x5477e3,null));};exports[_0x7b4c('0x5c')]=function(_0x2d17ed,_0x328948){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2d17ed[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](function(_0x10e789){if(_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')]!==undefined){var _0x2837aa=_(_0x10e789[_0x7b4c('0x16')])[_0x7b4c('0x5e')]([_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')],_0x2d17ed[_0x7b4c('0x1e')]['id']])[_0x7b4c('0x5f')](_0x7b4c('0x60'))[_0x7b4c('0x61')]()['value']();return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x35e94a){return _0x2837aa[_0x7b4c('0x62')](_0x35e94a['queue_id'])>-0x1;});}else{return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x149d53){return _0x149d53[_0x7b4c('0x60')]===parseInt(_0x2d17ed[_0x7b4c('0x1e')]['id']);});}})[_0x7b4c('0xa')](respondWithResult(_0x328948,null))[_0x7b4c('0xe')](handleError(_0x328948,null));};exports['smsQueuesWaitingInteractions']=function(_0x11c809,_0x108c99){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x11c809['query'],routingClient)['then'](respondWithResult(_0x108c99,null))[_0x7b4c('0xe')](handleError(_0x108c99,null));};exports[_0x7b4c('0x63')]=function(_0x24d4f9,_0x19804d){return respondWithRpcPromise(_0x7b4c('0x64'),_0x24d4f9[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x19804d,null))[_0x7b4c('0xe')](handleError(_0x19804d,null));};exports[_0x7b4c('0x65')]=function(_0x2bc889,_0x83e8bb){return respondWithRpcPromise(_0x7b4c('0x66'),_0x2bc889[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x83e8bb,null))[_0x7b4c('0xe')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x67')]=function(_0x2afaa0){return function(_0x5dc6e6,_0x39c01d){var _0x392656,_0x1faa6f;var _0x3999bf=_[_0x7b4c('0x68')](_0x2afaa0);var _0x57f1a0=_0x2afaa0===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x3999bf+_0x7b4c('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x5dc6e6[_0x7b4c('0x1e')]['id']}})[_0x7b4c('0xa')](function(_0xdfa0bc){if(_['isNil'](_0xdfa0bc)){throw new Error(_0x3999bf+_0x7b4c('0x6d'));}_0x392656=_0xdfa0bc;return db[_0x3999bf+_0x7b4c('0x6e')][_0x7b4c('0x6f')]({'where':{'id':_0x5dc6e6[_0x7b4c('0x25')]['messageId']},'include':[{'model':db[_0x3999bf+_0x7b4c('0x70')],'as':_0x7b4c('0x70')},{'model':db[_0x3999bf+_0x57f1a0],'as':_0x7b4c('0x6b')}]});})[_0x7b4c('0xa')](function(_0x50c382){if(_[_0x7b4c('0x15')](_0x50c382)){throw new Error(_0x3999bf+'\x20Message\x20not\x20found');}_0x1faa6f=_0x50c382;return _0x50c382[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x24690a={'uniqueid':_0x2afaa0+'.'+_0x1faa6f['id']+'.'+_0x1faa6f[_0x7b4c('0x70')]['id'],'FromUserId':_0x5dc6e6[_0x7b4c('0x32')]['id'],'type':'queue'};_0x24690a[_0x3999bf+_0x7b4c('0x72')]=_0x1faa6f['id'];_0x24690a[_0x3999bf+'InteractionId']=_0x1faa6f[_0x7b4c('0x70')]['id'];_0x24690a[_0x7b4c('0x73')+_0x3999bf+_0x57f1a0+'Id']=_0x1faa6f['Account']['id'];_0x24690a['To'+_0x3999bf+_0x7b4c('0x74')]=_0x392656['id'];return db[_0x3999bf+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x24690a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x2afaa0,'interaction':_0x1faa6f[_0x7b4c('0x70')],'message':_0x1faa6f,'account':_0x1faa6f[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x392656[_0x7b4c('0x13')]+','+(_0x1faa6f[_0x7b4c('0x6b')][_0x7b4c('0x77')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x39c01d,null))[_0x7b4c('0xe')](handleError(_0x39c01d,null));};};exports[_0x7b4c('0x79')]=function(_0x4e9781,_0x5ec399){var _0xdb202,_0x433d74;if(_[_0x7b4c('0x15')](_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x228b2b=_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')];var _0x331db1=_['capitalize'](_0x228b2b);var _0x56ba6f=_0x228b2b===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x7b4c('0x7b')][_0x7b4c('0x6f')]({'raw':!![],'where':{'id':_0x4e9781['params']['id'],'role':_0x7b4c('0x3d')}})[_0x7b4c('0xa')](function(_0x450eca){if(_[_0x7b4c('0x15')](_0x450eca)){throw new Error('Agent\x20not\x20found');}_0xdb202=_0x450eca;return db[_0x331db1+'Message']['findOne']({'where':{'id':_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7c')]},'include':[{'model':db[_0x331db1+_0x7b4c('0x70')],'as':'Interaction'},{'model':db[_0x331db1+_0x56ba6f],'as':_0x7b4c('0x6b')}]});})['then'](function(_0x530030){if(_[_0x7b4c('0x15')](_0x530030)){throw new Error(_0x331db1+'\x20Message\x20not\x20found');}_0x433d74=_0x530030;return _0x530030[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b4c('0xa')](function(){var _0x5e444a={'uniqueid':_0x228b2b+'.'+_0x433d74['id']+'.'+_0x433d74['Interaction']['id'],'FromUserId':_0x4e9781[_0x7b4c('0x32')]['id'],'type':_0x7b4c('0x7d'),'ToUserId':_0xdb202['id']};_0x5e444a[_0x331db1+_0x7b4c('0x72')]=_0x433d74['id'];_0x5e444a[_0x331db1+_0x7b4c('0x7e')]=_0x433d74['Interaction']['id'];_0x5e444a['From'+_0x331db1+_0x56ba6f+'Id']=_0x433d74[_0x7b4c('0x6b')]['id'];return db[_0x331db1+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x5e444a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise(_0x7b4c('0x7f'),{'channel':_0x228b2b,'interaction':_0x433d74[_0x7b4c('0x70')],'message':_0x433d74,'account':_0x433d74[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xdb202[_0x7b4c('0x13')]+','+(_0x433d74[_0x7b4c('0x6b')][_0x7b4c('0x80')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x5ec399,null))[_0x7b4c('0xe')](handleError(_0x5ec399,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 252fed4..115f8a0 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 _0x8483=['get','isAuthenticated','index','/:id','show','/:id/run','run','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x411cf5,_0x3376e0){var _0x4de0d4=function(_0x506fbc){while(--_0x506fbc){_0x411cf5['push'](_0x411cf5['shift']());}};_0x4de0d4(++_0x3376e0);}(_0x8483,0xb4));var _0x3848=function(_0x282c96,_0x2f6e7b){_0x282c96=_0x282c96-0x0;var _0x2ed94c=_0x8483[_0x282c96];return _0x2ed94c;};'use strict';var multer=require(_0x3848('0x0'));var util=require(_0x3848('0x1'));var path=require(_0x3848('0x2'));var timeout=require(_0x3848('0x3'));var express=require(_0x3848('0x4'));var router=express['Router']();var fs_extra=require(_0x3848('0x5'));var auth=require(_0x3848('0x6'));var interaction=require(_0x3848('0x7'));var config=require(_0x3848('0x8'));var controller=require(_0x3848('0x9'));router[_0x3848('0xa')]('/',auth[_0x3848('0xb')](),controller[_0x3848('0xc')]);router[_0x3848('0xa')](_0x3848('0xd'),auth[_0x3848('0xb')](),controller[_0x3848('0xe')]);router[_0x3848('0xa')](_0x3848('0xf'),auth[_0x3848('0xb')](),controller[_0x3848('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3848('0x11')]('/:id',auth[_0x3848('0xb')](),controller['update']);router['delete'](_0x3848('0xd'),auth[_0x3848('0xb')](),controller['destroy']);module[_0x3848('0x12')]=router; \ No newline at end of file +var _0xd90d=['/:id/run','run','post','create','update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd90d,0x1db));var _0xdd90=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xd90d[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require('multer');var util=require(_0xdd90('0x0'));var path=require(_0xdd90('0x1'));var timeout=require(_0xdd90('0x2'));var express=require(_0xdd90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd90('0x4'));var config=require(_0xdd90('0x5'));var controller=require(_0xdd90('0x6'));router[_0xdd90('0x7')]('/',auth[_0xdd90('0x8')](),controller['index']);router[_0xdd90('0x7')](_0xdd90('0x9'),auth[_0xdd90('0x8')](),controller[_0xdd90('0xa')]);router[_0xdd90('0x7')](_0xdd90('0xb'),auth[_0xdd90('0x8')](),controller[_0xdd90('0xc')]);router[_0xdd90('0xd')]('/',auth[_0xdd90('0x8')](),controller[_0xdd90('0xe')]);router['put']('/:id',auth[_0xdd90('0x8')](),controller[_0xdd90('0xf')]);router[_0xdd90('0x10')]('/:id',auth[_0xdd90('0x8')](),controller['destroy']);module[_0xdd90('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 4380e86..f014d65 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 _0xbd18=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default'];(function(_0x5deb94,_0xcd9bd){var _0x121c0b=function(_0x1b8751){while(--_0x1b8751){_0x5deb94['push'](_0x5deb94['shift']());}};_0x121c0b(++_0xcd9bd);}(_0xbd18,0xbe));var _0x8bd1=function(_0x3a4969,_0x5303cd){_0x3a4969=_0x3a4969-0x0;var _0x40ded5=_0xbd18[_0x3a4969];return _0x40ded5;};'use strict';var Sequelize=require(_0x8bd1('0x0'));module[_0x8bd1('0x1')]={'name':{'type':Sequelize[_0x8bd1('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8bd1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8bd1('0x2')],'allowNull':![],'defaultValue':_0x8bd1('0x4')},'startAt':{'type':Sequelize[_0x8bd1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8bd1('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8bd1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8bd1('0x7')](_0x8bd1('0x8'),_0x8bd1('0x9'),_0x8bd1('0xa'),_0x8bd1('0xb'),_0x8bd1('0xc'),_0x8bd1('0xd'),_0x8bd1('0xe')),'allowNull':![],'defaultValue':_0x8bd1('0xc')},'output':{'type':Sequelize['ENUM'](_0x8bd1('0xf'),_0x8bd1('0x10'),_0x8bd1('0x11')),'allowNull':![],'defaultValue':_0x8bd1('0xf')},'type':{'type':Sequelize[_0x8bd1('0x7')](_0x8bd1('0x12'),_0x8bd1('0x13')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x8bd1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8bd1('0x2')]},'cc':{'type':Sequelize[_0x8bd1('0x14')]},'bcc':{'type':Sequelize[_0x8bd1('0x14')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2a88=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','weeks','days','hours','ENUM','csv','xlsx','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a88,0x18e));var _0x82a8=function(_0x533cf6,_0x89b44d){_0x533cf6=_0x533cf6-0x0;var _0x505702=_0x2a88[_0x533cf6];return _0x505702;};'use strict';var Sequelize=require(_0x82a8('0x0'));module[_0x82a8('0x1')]={'name':{'type':Sequelize[_0x82a8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x82a8('0x2')]},'active':{'type':Sequelize[_0x82a8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x82a8('0x2')],'allowNull':![],'defaultValue':_0x82a8('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x82a8('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x82a8('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x82a8('0x7'),_0x82a8('0x8'),_0x82a8('0x9'),_0x82a8('0xa'),_0x82a8('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x82a8('0xa')},'output':{'type':Sequelize[_0x82a8('0xc')](_0x82a8('0xd'),'pdf',_0x82a8('0xe')),'allowNull':![],'defaultValue':_0x82a8('0xd')},'type':{'type':Sequelize[_0x82a8('0xc')](_0x82a8('0xf'),_0x82a8('0x10')),'allowNull':![],'defaultValue':_0x82a8('0xf')},'sendMail':{'type':Sequelize[_0x82a8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x82a8('0x2')]},'cc':{'type':Sequelize[_0x82a8('0x11')]},'bcc':{'type':Sequelize[_0x82a8('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x82a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index adb3fd3..452c6bf 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 _0x4520=['crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x4520,0x143));var _0x0452=function(_0x411a06,_0x2ba2b2){_0x411a06=_0x411a06-0x0;var _0x27c34f=_0x4520[_0x411a06];return _0x27c34f;};'use strict';var emlformat=require(_0x0452('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0452('0x1'));var jsonpatch=require(_0x0452('0x2'));var rp=require(_0x0452('0x3'));var moment=require(_0x0452('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0452('0x5'));var util=require(_0x0452('0x6'));var path=require(_0x0452('0x7'));var sox=require(_0x0452('0x8'));var csv=require('to-csv');var ejs=require(_0x0452('0x9'));var fs=require('fs');var fs_extra=require(_0x0452('0xa'));var _=require(_0x0452('0xb'));var squel=require(_0x0452('0xc'));var crypto=require(_0x0452('0xd'));var jsforce=require(_0x0452('0xe'));var deskjs=require(_0x0452('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0452('0x10'));var qs=require(_0x0452('0x11'));var as=require(_0x0452('0x12'));var hardwareService=require(_0x0452('0x13'));var logger=require(_0x0452('0x14'))(_0x0452('0x15'));var utils=require(_0x0452('0x16'));var config=require(_0x0452('0x17'));var licenseUtil=require(_0x0452('0x18'));var db=require(_0x0452('0x19'))['db'];function respondWithStatusCode(_0x836ec9,_0x3142fe){_0x3142fe=_0x3142fe||0xcc;return function(_0x5208dd){if(_0x5208dd){return _0x836ec9['sendStatus'](_0x3142fe);}return _0x836ec9[_0x0452('0x1a')](_0x3142fe)['end']();};}function respondWithResult(_0x4382c2,_0x716d83){_0x716d83=_0x716d83||0xc8;return function(_0x1255b0){if(_0x1255b0){return _0x4382c2['status'](_0x716d83)[_0x0452('0x1b')](_0x1255b0);}};}function respondWithFilteredResult(_0x36bf49,_0x3265e8){return function(_0x5d09a1){if(_0x5d09a1){var _0x4a8dde=typeof _0x3265e8[_0x0452('0x1c')]==='undefined'&&typeof _0x3265e8[_0x0452('0x1d')]===_0x0452('0x1e');var _0x15529e=_0x5d09a1['count'];var _0x524bde=_0x4a8dde?0x0:_0x3265e8[_0x0452('0x1c')];var _0x49e2d0=_0x4a8dde?_0x5d09a1[_0x0452('0x1f')]:_0x3265e8[_0x0452('0x1c')]+_0x3265e8[_0x0452('0x1d')];var _0x29aab0;if(_0x49e2d0>=_0x15529e){_0x49e2d0=_0x15529e;_0x29aab0=0xc8;}else{_0x29aab0=0xce;}_0x36bf49[_0x0452('0x1a')](_0x29aab0);return _0x36bf49[_0x0452('0x20')]('Content-Range',_0x524bde+'-'+_0x49e2d0+'/'+_0x15529e)[_0x0452('0x1b')](_0x5d09a1);}return null;};}function patchUpdates(_0x8528f8){return function(_0x4fb27c){try{jsonpatch[_0x0452('0x21')](_0x4fb27c,_0x8528f8,!![]);}catch(_0x4b26e3){return BPromise['reject'](_0x4b26e3);}return _0x4fb27c['save']();};}function saveUpdates(_0x16095d,_0x4eb457){return function(_0x4bbe34){if(_0x4bbe34){return _0x4bbe34[_0x0452('0x22')](_0x16095d)['then'](function(_0x17c319){return _0x17c319;});}return null;};}function removeEntity(_0x31685b,_0x224dbc){return function(_0x58d55b){if(_0x58d55b){return _0x58d55b[_0x0452('0x23')]()[_0x0452('0x24')](function(){var _0x7b6519=_0x58d55b[_0x0452('0x25')]({'plain':!![]});var _0x4a2f24='Scheduler';return db[_0x0452('0x26')]['destroy']({'where':{'type':_0x4a2f24,'resourceId':_0x7b6519['id']}})[_0x0452('0x24')](function(){return _0x58d55b;});})[_0x0452('0x24')](function(){_0x31685b[_0x0452('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x450013,_0x276ff9){return function(_0x93429f){if(!_0x93429f){_0x450013[_0x0452('0x27')](0x194);}return _0x93429f;};}function handleError(_0x5bd478,_0x22186c){_0x22186c=_0x22186c||0x1f4;return function(_0x5a2308){logger[_0x0452('0x28')](_0x5a2308[_0x0452('0x29')]);if(_0x5a2308[_0x0452('0x2a')]){delete _0x5a2308[_0x0452('0x2a')];}_0x5bd478[_0x0452('0x1a')](_0x22186c)['send'](_0x5a2308);};}exports[_0x0452('0x2b')]=function(_0x1981a8,_0x2d0c3f){var _0x52a14e={},_0x133914={},_0x41a5fc={'count':0x0,'rows':[]};var _0x230319=_[_0x0452('0x2c')](db[_0x0452('0x2d')][_0x0452('0x2e')],function(_0x48f9af){return{'name':_0x48f9af[_0x0452('0x2f')],'type':_0x48f9af[_0x0452('0x30')][_0x0452('0x31')]};});_0x133914[_0x0452('0x32')]=_[_0x0452('0x2c')](_0x230319,_0x0452('0x2a'));_0x133914[_0x0452('0x33')]=_[_0x0452('0x34')](_0x1981a8['query']);_0x133914[_0x0452('0x35')]=_[_0x0452('0x36')](_0x133914[_0x0452('0x32')],_0x133914['query']);_0x52a14e[_0x0452('0x37')]=_[_0x0452('0x36')](_0x133914['model'],qs['fields'](_0x1981a8[_0x0452('0x33')][_0x0452('0x38')]));_0x52a14e[_0x0452('0x37')]=_0x52a14e[_0x0452('0x37')]['length']?_0x52a14e['attributes']:_0x133914[_0x0452('0x32')];if(!_0x1981a8['query']['hasOwnProperty'](_0x0452('0x39'))){_0x52a14e['limit']=qs['limit'](_0x1981a8[_0x0452('0x33')][_0x0452('0x1d')]);_0x52a14e[_0x0452('0x1c')]=qs[_0x0452('0x1c')](_0x1981a8[_0x0452('0x33')][_0x0452('0x1c')]);}_0x52a14e[_0x0452('0x3a')]=qs[_0x0452('0x3b')](_0x1981a8['query'][_0x0452('0x3b')]);_0x52a14e['where']=qs['filters'](_[_0x0452('0x3c')](_0x1981a8[_0x0452('0x33')],_0x133914['filters']),_0x230319);if(_0x1981a8[_0x0452('0x33')][_0x0452('0x3d')]){_0x52a14e[_0x0452('0x3e')]=_[_0x0452('0x3f')](_0x52a14e[_0x0452('0x3e')],{'$or':_['map'](_0x230319,function(_0xedca7f){if(_0xedca7f[_0x0452('0x30')]!=='VIRTUAL'){var _0xd670ca={};_0xd670ca[_0xedca7f['name']]={'$like':'%'+_0x1981a8[_0x0452('0x33')]['filter']+'%'};return _0xd670ca;}})});}_0x52a14e=_[_0x0452('0x3f')]({},_0x52a14e,_0x1981a8[_0x0452('0x40')]);var _0x3986ac={'where':_0x52a14e[_0x0452('0x3e')]};return db[_0x0452('0x2d')][_0x0452('0x1f')](_0x3986ac)[_0x0452('0x24')](function(_0x24812a){_0x41a5fc[_0x0452('0x1f')]=_0x24812a;if(_0x1981a8[_0x0452('0x33')][_0x0452('0x41')]){_0x52a14e['include']=[{'all':!![]}];}return db[_0x0452('0x2d')]['findAll'](_0x52a14e);})[_0x0452('0x24')](function(_0x47962d){_0x41a5fc[_0x0452('0x42')]=_0x47962d;return _0x41a5fc;})[_0x0452('0x24')](respondWithFilteredResult(_0x2d0c3f,_0x52a14e))[_0x0452('0x43')](handleError(_0x2d0c3f,null));};exports[_0x0452('0x44')]=function(_0x10ae4b,_0x8f584e){var _0x4c00f4={'raw':![],'where':{'id':_0x10ae4b[_0x0452('0x45')]['id']}},_0x362f10={};_0x362f10[_0x0452('0x32')]=_[_0x0452('0x34')](db[_0x0452('0x2d')][_0x0452('0x2e')]);_0x362f10[_0x0452('0x33')]=_[_0x0452('0x34')](_0x10ae4b[_0x0452('0x33')]);_0x362f10['filters']=_['intersection'](_0x362f10[_0x0452('0x32')],_0x362f10['query']);_0x4c00f4['attributes']=_['intersection'](_0x362f10[_0x0452('0x32')],qs['fields'](_0x10ae4b[_0x0452('0x33')][_0x0452('0x38')]));_0x4c00f4[_0x0452('0x37')]=_0x4c00f4[_0x0452('0x37')][_0x0452('0x46')]?_0x4c00f4[_0x0452('0x37')]:_0x362f10[_0x0452('0x32')];if(_0x10ae4b[_0x0452('0x33')]['includeAll']){_0x4c00f4[_0x0452('0x47')]=[{'all':!![]}];}_0x4c00f4=_[_0x0452('0x3f')]({},_0x4c00f4,_0x10ae4b[_0x0452('0x40')]);return db[_0x0452('0x2d')][_0x0452('0x48')](_0x4c00f4)[_0x0452('0x24')](handleEntityNotFound(_0x8f584e,null))[_0x0452('0x24')](respondWithResult(_0x8f584e,null))['catch'](handleError(_0x8f584e,null));};exports[_0x0452('0x49')]=function(_0x2225ba,_0x495edd){return db[_0x0452('0x2d')]['create'](_0x2225ba[_0x0452('0x4a')],{})[_0x0452('0x24')](function(_0x1181f4){var _0x35e108=_0x2225ba[_0x0452('0x4b')][_0x0452('0x25')]({'plain':!![]});if(!_0x35e108)throw new Error(_0x0452('0x4c'));if(_0x35e108[_0x0452('0x4d')]===_0x0452('0x4b')){var _0x31d5ac=_0x1181f4['get']({'plain':!![]});var _0x3f6413=_0x0452('0x4e');return db[_0x0452('0x4f')][_0x0452('0x48')]({'where':{'name':_0x3f6413,'userProfileId':_0x35e108[_0x0452('0x50')]},'raw':!![]})[_0x0452('0x24')](function(_0x49f259){if(_0x49f259&&_0x49f259[_0x0452('0x51')]===0x0){return db[_0x0452('0x26')]['create']({'name':_0x31d5ac[_0x0452('0x2a')],'resourceId':_0x31d5ac['id'],'type':_0x49f259[_0x0452('0x2a')],'sectionId':_0x49f259['id']},{})['then'](function(){return _0x1181f4;});}else{return _0x1181f4;}})[_0x0452('0x43')](function(_0x3217a3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3217a3);throw _0x3217a3;});}return _0x1181f4;})[_0x0452('0x24')](respondWithResult(_0x495edd,0xc9))[_0x0452('0x43')](handleError(_0x495edd,null));};exports[_0x0452('0x22')]=function(_0x4b28ef,_0x21788c){if(_0x4b28ef[_0x0452('0x4a')]['id']){delete _0x4b28ef[_0x0452('0x4a')]['id'];}return db[_0x0452('0x2d')]['find']({'where':{'id':_0x4b28ef[_0x0452('0x45')]['id']}})['then'](handleEntityNotFound(_0x21788c,null))[_0x0452('0x24')](saveUpdates(_0x4b28ef[_0x0452('0x4a')],null))[_0x0452('0x24')](respondWithResult(_0x21788c,null))['catch'](handleError(_0x21788c,null));};exports[_0x0452('0x23')]=function(_0x1c71f7,_0x1ab467){return db[_0x0452('0x2d')]['find']({'where':{'id':_0x1c71f7[_0x0452('0x45')]['id']}})[_0x0452('0x24')](handleEntityNotFound(_0x1ab467,null))[_0x0452('0x24')](removeEntity(_0x1ab467,null))[_0x0452('0x43')](handleError(_0x1ab467,null));};exports['run']=function(_0x24d339,_0x3f3fb4,_0x23d45d){var _0x5c4a77=require(_0x0452('0x52'));return db[_0x0452('0x2d')][_0x0452('0x48')]({'where':{'id':_0x24d339['params']['id']},'raw':!![]})[_0x0452('0x24')](handleEntityNotFound(_0x3f3fb4,null))[_0x0452('0x24')](function(){_0x5c4a77[_0x0452('0x53')](_0x24d339['params']['id']);})[_0x0452('0x24')](respondWithStatusCode(_0x3f3fb4,null))[_0x0452('0x43')](handleError(_0x3f3fb4,null));}; \ No newline at end of file +var _0x73b8=['role','user','UserProfileSection','userProfileId','update','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','Schedule','include','rows','catch','show','params','intersection','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x73b8,0xb0));var _0x873b=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x73b8[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x873b('0x0'));var rimraf=require(_0x873b('0x1'));var zipdir=require(_0x873b('0x2'));var jsonpatch=require(_0x873b('0x3'));var rp=require('request-promise');var moment=require(_0x873b('0x4'));var BPromise=require(_0x873b('0x5'));var Mustache=require(_0x873b('0x6'));var util=require(_0x873b('0x7'));var path=require(_0x873b('0x8'));var sox=require(_0x873b('0x9'));var csv=require(_0x873b('0xa'));var ejs=require(_0x873b('0xb'));var fs=require('fs');var fs_extra=require(_0x873b('0xc'));var _=require(_0x873b('0xd'));var squel=require(_0x873b('0xe'));var crypto=require(_0x873b('0xf'));var jsforce=require(_0x873b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x873b('0xa'));var querystring=require('querystring');var Papa=require(_0x873b('0x11'));var Redis=require(_0x873b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x873b('0x13'));var as=require(_0x873b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x873b('0x15'))(_0x873b('0x16'));var utils=require(_0x873b('0x17'));var config=require(_0x873b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb407d3,_0x20795a){_0x20795a=_0x20795a||0xcc;return function(_0x3eecdf){if(_0x3eecdf){return _0xb407d3[_0x873b('0x19')](_0x20795a);}return _0xb407d3[_0x873b('0x1a')](_0x20795a)[_0x873b('0x1b')]();};}function respondWithResult(_0xac183f,_0xfa01af){_0xfa01af=_0xfa01af||0xc8;return function(_0x90209b){if(_0x90209b){return _0xac183f[_0x873b('0x1a')](_0xfa01af)[_0x873b('0x1c')](_0x90209b);}};}function respondWithFilteredResult(_0x39da83,_0x4987fc){return function(_0xda0c34){if(_0xda0c34){var _0x2bb598=typeof _0x4987fc['offset']===_0x873b('0x1d')&&typeof _0x4987fc[_0x873b('0x1e')]===_0x873b('0x1d');var _0x1af5b1=_0xda0c34[_0x873b('0x1f')];var _0x2b8411=_0x2bb598?0x0:_0x4987fc[_0x873b('0x20')];var _0x505c3d=_0x2bb598?_0xda0c34[_0x873b('0x1f')]:_0x4987fc['offset']+_0x4987fc['limit'];var _0x2b86ff;if(_0x505c3d>=_0x1af5b1){_0x505c3d=_0x1af5b1;_0x2b86ff=0xc8;}else{_0x2b86ff=0xce;}_0x39da83['status'](_0x2b86ff);return _0x39da83[_0x873b('0x21')](_0x873b('0x22'),_0x2b8411+'-'+_0x505c3d+'/'+_0x1af5b1)[_0x873b('0x1c')](_0xda0c34);}return null;};}function patchUpdates(_0x4c252b){return function(_0x1d5637){try{jsonpatch['apply'](_0x1d5637,_0x4c252b,!![]);}catch(_0x393bcc){return BPromise[_0x873b('0x23')](_0x393bcc);}return _0x1d5637[_0x873b('0x24')]();};}function saveUpdates(_0x504aa6,_0x48cd2d){return function(_0xb58320){if(_0xb58320){return _0xb58320['update'](_0x504aa6)[_0x873b('0x25')](function(_0x3a3e64){return _0x3a3e64;});}return null;};}function removeEntity(_0x410312,_0x24bc6c){return function(_0x289d70){if(_0x289d70){return _0x289d70['destroy']()[_0x873b('0x25')](function(){var _0x42b4b2=_0x289d70[_0x873b('0x26')]({'plain':!![]});var _0xd433bf=_0x873b('0x27');return db[_0x873b('0x28')][_0x873b('0x29')]({'where':{'type':_0xd433bf,'resourceId':_0x42b4b2['id']}})[_0x873b('0x25')](function(){return _0x289d70;});})[_0x873b('0x25')](function(){_0x410312[_0x873b('0x1a')](0xcc)[_0x873b('0x1b')]();});}};}function handleEntityNotFound(_0xe1bced,_0x31f8c1){return function(_0x594f4b){if(!_0x594f4b){_0xe1bced[_0x873b('0x19')](0x194);}return _0x594f4b;};}function handleError(_0xc76ddd,_0x48d3a1){_0x48d3a1=_0x48d3a1||0x1f4;return function(_0x3d594e){logger[_0x873b('0x2a')](_0x3d594e[_0x873b('0x2b')]);if(_0x3d594e[_0x873b('0x2c')]){delete _0x3d594e['name'];}_0xc76ddd[_0x873b('0x1a')](_0x48d3a1)[_0x873b('0x2d')](_0x3d594e);};}exports[_0x873b('0x2e')]=function(_0xcbf649,_0xd1c651){var _0x4693bd={},_0x57dbf0={},_0x304bd2={'count':0x0,'rows':[]};var _0xadb00e=_['map'](db['Schedule'][_0x873b('0x2f')],function(_0x43a917){return{'name':_0x43a917['fieldName'],'type':_0x43a917['type']['key']};});_0x57dbf0[_0x873b('0x30')]=_['map'](_0xadb00e,_0x873b('0x2c'));_0x57dbf0[_0x873b('0x31')]=_[_0x873b('0x32')](_0xcbf649['query']);_0x57dbf0[_0x873b('0x33')]=_['intersection'](_0x57dbf0[_0x873b('0x30')],_0x57dbf0['query']);_0x4693bd[_0x873b('0x34')]=_['intersection'](_0x57dbf0[_0x873b('0x30')],qs[_0x873b('0x35')](_0xcbf649[_0x873b('0x31')][_0x873b('0x35')]));_0x4693bd[_0x873b('0x34')]=_0x4693bd[_0x873b('0x34')][_0x873b('0x36')]?_0x4693bd[_0x873b('0x34')]:_0x57dbf0[_0x873b('0x30')];if(!_0xcbf649['query'][_0x873b('0x37')](_0x873b('0x38'))){_0x4693bd['limit']=qs['limit'](_0xcbf649[_0x873b('0x31')][_0x873b('0x1e')]);_0x4693bd['offset']=qs[_0x873b('0x20')](_0xcbf649[_0x873b('0x31')][_0x873b('0x20')]);}_0x4693bd[_0x873b('0x39')]=qs[_0x873b('0x3a')](_0xcbf649['query']['sort']);_0x4693bd[_0x873b('0x3b')]=qs[_0x873b('0x33')](_[_0x873b('0x3c')](_0xcbf649[_0x873b('0x31')],_0x57dbf0[_0x873b('0x33')]),_0xadb00e);if(_0xcbf649[_0x873b('0x31')][_0x873b('0x3d')]){_0x4693bd[_0x873b('0x3b')]=_[_0x873b('0x3e')](_0x4693bd['where'],{'$or':_[_0x873b('0x3f')](_0xadb00e,function(_0x56200f){if(_0x56200f[_0x873b('0x40')]!==_0x873b('0x41')){var _0x2f940d={};_0x2f940d[_0x56200f[_0x873b('0x2c')]]={'$like':'%'+_0xcbf649['query'][_0x873b('0x3d')]+'%'};return _0x2f940d;}})});}_0x4693bd=_['merge']({},_0x4693bd,_0xcbf649['options']);var _0x29a151={'where':_0x4693bd['where']};return db[_0x873b('0x42')]['count'](_0x29a151)[_0x873b('0x25')](function(_0x33ebcb){_0x304bd2[_0x873b('0x1f')]=_0x33ebcb;if(_0xcbf649[_0x873b('0x31')]['includeAll']){_0x4693bd[_0x873b('0x43')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4693bd);})['then'](function(_0x44a683){_0x304bd2[_0x873b('0x44')]=_0x44a683;return _0x304bd2;})[_0x873b('0x25')](respondWithFilteredResult(_0xd1c651,_0x4693bd))[_0x873b('0x45')](handleError(_0xd1c651,null));};exports[_0x873b('0x46')]=function(_0x3450c4,_0x403cac){var _0xa3d794={'raw':![],'where':{'id':_0x3450c4[_0x873b('0x47')]['id']}},_0x3137a4={};_0x3137a4[_0x873b('0x30')]=_[_0x873b('0x32')](db[_0x873b('0x42')][_0x873b('0x2f')]);_0x3137a4[_0x873b('0x31')]=_['keys'](_0x3450c4['query']);_0x3137a4[_0x873b('0x33')]=_[_0x873b('0x48')](_0x3137a4[_0x873b('0x30')],_0x3137a4[_0x873b('0x31')]);_0xa3d794[_0x873b('0x34')]=_[_0x873b('0x48')](_0x3137a4[_0x873b('0x30')],qs[_0x873b('0x35')](_0x3450c4['query'][_0x873b('0x35')]));_0xa3d794[_0x873b('0x34')]=_0xa3d794['attributes']['length']?_0xa3d794[_0x873b('0x34')]:_0x3137a4[_0x873b('0x30')];if(_0x3450c4[_0x873b('0x31')][_0x873b('0x49')]){_0xa3d794[_0x873b('0x43')]=[{'all':!![]}];}_0xa3d794=_[_0x873b('0x3e')]({},_0xa3d794,_0x3450c4[_0x873b('0x4a')]);return db[_0x873b('0x42')][_0x873b('0x4b')](_0xa3d794)['then'](handleEntityNotFound(_0x403cac,null))['then'](respondWithResult(_0x403cac,null))[_0x873b('0x45')](handleError(_0x403cac,null));};exports[_0x873b('0x4c')]=function(_0x2c248a,_0x1fb2cf){return db[_0x873b('0x42')]['create'](_0x2c248a[_0x873b('0x4d')],{})[_0x873b('0x25')](function(_0x6fae88){var _0x2acbe0=_0x2c248a['user'][_0x873b('0x26')]({'plain':!![]});if(!_0x2acbe0)throw new Error(_0x873b('0x4e'));if(_0x2acbe0[_0x873b('0x4f')]===_0x873b('0x50')){var _0x2b294c=_0x6fae88['get']({'plain':!![]});var _0x2e4eaf=_0x873b('0x27');return db[_0x873b('0x51')][_0x873b('0x4b')]({'where':{'name':_0x2e4eaf,'userProfileId':_0x2acbe0[_0x873b('0x52')]},'raw':!![]})[_0x873b('0x25')](function(_0x46dbdf){if(_0x46dbdf&&_0x46dbdf['autoAssociation']===0x0){return db[_0x873b('0x28')][_0x873b('0x4c')]({'name':_0x2b294c[_0x873b('0x2c')],'resourceId':_0x2b294c['id'],'type':_0x46dbdf[_0x873b('0x2c')],'sectionId':_0x46dbdf['id']},{})[_0x873b('0x25')](function(){return _0x6fae88;});}else{return _0x6fae88;}})[_0x873b('0x45')](function(_0x4d9da2){logger[_0x873b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d9da2);throw _0x4d9da2;});}return _0x6fae88;})[_0x873b('0x25')](respondWithResult(_0x1fb2cf,0xc9))[_0x873b('0x45')](handleError(_0x1fb2cf,null));};exports[_0x873b('0x53')]=function(_0x14d211,_0x3a3c44){if(_0x14d211[_0x873b('0x4d')]['id']){delete _0x14d211[_0x873b('0x4d')]['id'];}return db[_0x873b('0x42')]['find']({'where':{'id':_0x14d211[_0x873b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a3c44,null))[_0x873b('0x25')](saveUpdates(_0x14d211[_0x873b('0x4d')],null))['then'](respondWithResult(_0x3a3c44,null))['catch'](handleError(_0x3a3c44,null));};exports[_0x873b('0x29')]=function(_0x1e460d,_0x3fd427){return db[_0x873b('0x42')][_0x873b('0x4b')]({'where':{'id':_0x1e460d[_0x873b('0x47')]['id']}})[_0x873b('0x25')](handleEntityNotFound(_0x3fd427,null))[_0x873b('0x25')](removeEntity(_0x3fd427,null))[_0x873b('0x45')](handleError(_0x3fd427,null));};exports['run']=function(_0x12d58e,_0x3d2f40,_0x69581f){var _0x5bd8e3=require('../../config/schedule');return db[_0x873b('0x42')][_0x873b('0x4b')]({'where':{'id':_0x12d58e[_0x873b('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d2f40,null))['then'](function(){_0x5bd8e3[_0x873b('0x54')](_0x12d58e[_0x873b('0x47')]['id']);})['then'](respondWithStatusCode(_0x3d2f40,null))['catch'](handleError(_0x3d2f40,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 09a4195..64dc99d 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 _0x92dc=['path','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','lodash','util','api','moment','bluebird','request-promise'];(function(_0x499c7b,_0x2a994b){var _0x44b6ee=function(_0x3d8983){while(--_0x3d8983){_0x499c7b['push'](_0x499c7b['shift']());}};_0x44b6ee(++_0x2a994b);}(_0x92dc,0x14a));var _0xc92d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x92dc[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xc92d('0x0'));var util=require(_0xc92d('0x1'));var logger=require('../../config/logger')(_0xc92d('0x2'));var moment=require(_0xc92d('0x3'));var BPromise=require(_0xc92d('0x4'));var rp=require(_0xc92d('0x5'));var fs=require('fs');var path=require(_0xc92d('0x6'));var rimraf=require(_0xc92d('0x7'));var config=require(_0xc92d('0x8'));var attributes=require(_0xc92d('0x9'));module['exports']=function(_0x218288,_0x5a602d){return _0x218288[_0xc92d('0xa')]('Schedule',attributes,{'tableName':_0xc92d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1089=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xddadc9,_0x5dbffa){var _0x112032=function(_0x685a4e){while(--_0x685a4e){_0xddadc9['push'](_0xddadc9['shift']());}};_0x112032(++_0x5dbffa);}(_0x1089,0x6f));var _0x9108=function(_0x556afe,_0x3f9359){_0x556afe=_0x556afe-0x0;var _0x3327a4=_0x1089[_0x556afe];return _0x3327a4;};'use strict';var _=require(_0x9108('0x0'));var util=require('util');var logger=require(_0x9108('0x1'))(_0x9108('0x2'));var moment=require(_0x9108('0x3'));var BPromise=require('bluebird');var rp=require(_0x9108('0x4'));var fs=require('fs');var path=require(_0x9108('0x5'));var rimraf=require(_0x9108('0x6'));var config=require(_0x9108('0x7'));var attributes=require(_0x9108('0x8'));module[_0x9108('0x9')]=function(_0x3b1f8f,_0x352db5){return _0x3b1f8f[_0x9108('0xa')](_0x9108('0xb'),attributes,{'tableName':_0x9108('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 21743aa..08f3664 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 _0xff5f=['error','code','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xff5f,0xdc));var _0xfff5=function(_0x11ca19,_0x3b243e){_0x11ca19=_0x11ca19-0x0;var _0x5f3c1b=_0xff5f[_0x11ca19];return _0x5f3c1b;};'use strict';var _=require(_0xfff5('0x0'));var util=require('util');var moment=require(_0xfff5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfff5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfff5('0x3'));var logger=require(_0xfff5('0x4'))('rpc');var config=require(_0xfff5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfff5('0x6')][_0xfff5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd2e8e5,_0x17c876,_0x34d919){return new BPromise(function(_0x17b3fc,_0x540a76){return client[_0xfff5('0x8')](_0xd2e8e5,_0x34d919)['then'](function(_0xec3e6e){logger[_0xfff5('0x9')](_0xfff5('0xa'),_0x17c876,_0xfff5('0xb'));logger[_0xfff5('0xc')](_0xfff5('0xd'),_0x17c876,'request\x20sent',JSON['stringify'](_0xec3e6e));if(_0xec3e6e[_0xfff5('0xe')]){if(_0xec3e6e[_0xfff5('0xe')][_0xfff5('0xf')]===0x1f4){logger[_0xfff5('0xe')]('Schedule,\x20%s,\x20%s',_0x17c876,_0xec3e6e[_0xfff5('0xe')][_0xfff5('0x10')]);return _0x540a76(_0xec3e6e[_0xfff5('0xe')][_0xfff5('0x10')]);}logger[_0xfff5('0xe')](_0xfff5('0xa'),_0x17c876,_0xec3e6e[_0xfff5('0xe')][_0xfff5('0x10')]);return _0x17b3fc(_0xec3e6e[_0xfff5('0xe')]['message']);}else{logger[_0xfff5('0x9')]('Schedule,\x20%s,\x20%s',_0x17c876,'request\x20sent');_0x17b3fc(_0xec3e6e['result'][_0xfff5('0x10')]);}})[_0xfff5('0x11')](function(_0x43a1fd){logger[_0xfff5('0xe')](_0xfff5('0xa'),_0x17c876,_0x43a1fd);_0x540a76(_0x43a1fd);});});} \ No newline at end of file +var _0x123f=['request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5596e0,_0x3c2a3d){var _0x56640a=function(_0x58a22a){while(--_0x58a22a){_0x5596e0['push'](_0x5596e0['shift']());}};_0x56640a(++_0x3c2a3d);}(_0x123f,0xc3));var _0xf123=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x123f[_0x1ebb10];return _0x20d709;};'use strict';var _=require(_0xf123('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf123('0x1'));var rs=require(_0xf123('0x2'));var fs=require('fs');var Redis=require(_0xf123('0x3'));var db=require(_0xf123('0x4'))['db'];var utils=require(_0xf123('0x5'));var logger=require(_0xf123('0x6'))(_0xf123('0x7'));var config=require(_0xf123('0x8'));var jayson=require(_0xf123('0x9'));var client=jayson[_0xf123('0xa')][_0xf123('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2645,_0x46f526,_0x302220){return new BPromise(function(_0x35b993,_0x412226){return client[_0xf123('0xc')](_0x1d2645,_0x302220)[_0xf123('0xd')](function(_0x3839bc){logger[_0xf123('0xe')]('Schedule,\x20%s,\x20%s',_0x46f526,_0xf123('0xf'));logger['debug'](_0xf123('0x10'),_0x46f526,_0xf123('0xf'),JSON['stringify'](_0x3839bc));if(_0x3839bc[_0xf123('0x11')]){if(_0x3839bc[_0xf123('0x11')][_0xf123('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x46f526,_0x3839bc[_0xf123('0x11')][_0xf123('0x13')]);return _0x412226(_0x3839bc['error']['message']);}logger[_0xf123('0x11')](_0xf123('0x14'),_0x46f526,_0x3839bc['error']['message']);return _0x35b993(_0x3839bc[_0xf123('0x11')]['message']);}else{logger['info'](_0xf123('0x14'),_0x46f526,_0xf123('0xf'));_0x35b993(_0x3839bc[_0xf123('0x15')][_0xf123('0x13')]);}})[_0xf123('0x16')](function(_0x3b537e){logger[_0xf123('0x11')](_0xf123('0x14'),_0x46f526,_0x3b537e);_0x412226(_0x3b537e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 66cc89a..34dc10e 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 _0x8a4e=['index','get','/describe','describe','/:id','/:id/download','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated'];(function(_0x1581bc,_0x23b9de){var _0x5e7936=function(_0x302ade){while(--_0x302ade){_0x1581bc['push'](_0x1581bc['shift']());}};_0x5e7936(++_0x23b9de);}(_0x8a4e,0xbc));var _0xe8a4=function(_0x274939,_0x2a2cb8){_0x274939=_0x274939-0x0;var _0x28478e=_0x8a4e[_0x274939];return _0x28478e;};'use strict';var multer=require('multer');var util=require(_0xe8a4('0x0'));var path=require('path');var timeout=require(_0xe8a4('0x1'));var express=require(_0xe8a4('0x2'));var router=express[_0xe8a4('0x3')]();var fs_extra=require(_0xe8a4('0x4'));var auth=require(_0xe8a4('0x5'));var interaction=require(_0xe8a4('0x6'));var config=require(_0xe8a4('0x7'));var controller=require(_0xe8a4('0x8'));router['get']('/',auth[_0xe8a4('0x9')](),controller[_0xe8a4('0xa')]);router[_0xe8a4('0xb')](_0xe8a4('0xc'),auth[_0xe8a4('0x9')](),controller[_0xe8a4('0xd')]);router['get'](_0xe8a4('0xe'),auth[_0xe8a4('0x9')](),controller['show']);router[_0xe8a4('0xb')](_0xe8a4('0xf'),auth[_0xe8a4('0x9')](),controller['download']);router[_0xe8a4('0x10')]('/',auth[_0xe8a4('0x9')](),controller['create']);router[_0xe8a4('0x11')]('/:id',auth[_0xe8a4('0x9')](),controller[_0xe8a4('0x12')]);router[_0xe8a4('0x13')]('/:id',auth[_0xe8a4('0x9')](),controller[_0xe8a4('0x14')]);module[_0xe8a4('0x15')]=router; \ No newline at end of file +var _0xb932=['download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','/:id/download'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb932,0x10b));var _0x2b93=function(_0x2c9d42,_0x4ab260){_0x2c9d42=_0x2c9d42-0x0;var _0x5ccd7a=_0xb932[_0x2c9d42];return _0x5ccd7a;};'use strict';var multer=require(_0x2b93('0x0'));var util=require(_0x2b93('0x1'));var path=require(_0x2b93('0x2'));var timeout=require(_0x2b93('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b93('0x4'));var interaction=require(_0x2b93('0x5'));var config=require(_0x2b93('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x2b93('0x7')](),controller[_0x2b93('0x8')]);router['get'](_0x2b93('0x9'),auth[_0x2b93('0x7')](),controller['describe']);router[_0x2b93('0xa')](_0x2b93('0xb'),auth[_0x2b93('0x7')](),controller['show']);router[_0x2b93('0xa')](_0x2b93('0xc'),auth[_0x2b93('0x7')](),controller[_0x2b93('0xd')]);router[_0x2b93('0xe')]('/',auth[_0x2b93('0x7')](),controller['create']);router[_0x2b93('0xf')](_0x2b93('0xb'),auth['isAuthenticated'](),controller[_0x2b93('0x10')]);router[_0x2b93('0x11')]('/:id',auth[_0x2b93('0x7')](),controller[_0x2b93('0x12')]);module[_0x2b93('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d8726c1..68019d6 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 _0x4f9b=['setDataValue','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER'];(function(_0x44d9d9,_0x3f269d){var _0x4fb5e2=function(_0x4a499c){while(--_0x4a499c){_0x44d9d9['push'](_0x44d9d9['shift']());}};_0x4fb5e2(++_0x3f269d);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x12ae6a,_0x1da41b){_0x12ae6a=_0x12ae6a-0x0;var _0x21f21b=_0x4f9b[_0x12ae6a];return _0x21f21b;};'use strict';var Sequelize=require(_0xb4f9('0x0'));var moment=require(_0xb4f9('0x1'));var path=require(_0xb4f9('0x2'));var config=require(_0xb4f9('0x3'));module[_0xb4f9('0x4')]={'format':{'type':Sequelize[_0xb4f9('0x5')],'get':function(){return this[_0xb4f9('0x6')](_0xb4f9('0x7'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb4f9('0x8')]},'channel':{'type':Sequelize[_0xb4f9('0x8')]},'value':{'type':Sequelize[_0xb4f9('0x8')],'set':function(_0x4e8f3c){var _0x37b924=_0x4e8f3c[_0xb4f9('0x9')](/\\/g,'/');this['setDataValue'](_0xb4f9('0x7'),_0x37b924);}},'rating':{'type':Sequelize[_0xb4f9('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb4f9('0xa')],'set':function(_0x4a9df3){this[_0xb4f9('0xb')]('startedAt',moment()[_0xb4f9('0xc')](_0x4a9df3,'ms'));this[_0xb4f9('0xb')](_0xb4f9('0xd'),moment());this[_0xb4f9('0xb')](_0xb4f9('0xe'),_0x4a9df3);}},'startedAt':{'type':Sequelize[_0xb4f9('0xf')],'get':function(){return moment(this[_0xb4f9('0x6')]('startedAt'))[_0xb4f9('0x10')](_0xb4f9('0x11'))[_0xb4f9('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb4f9('0xd')))[_0xb4f9('0x10')](_0xb4f9('0x11'))[_0xb4f9('0x12')]();}},'createdAt':{'type':Sequelize[_0xb4f9('0xf')],'get':function(){return moment(this[_0xb4f9('0x6')](_0xb4f9('0x13')))[_0xb4f9('0x10')](_0xb4f9('0x11'))[_0xb4f9('0x12')]();}},'updatedAt':{'type':Sequelize[_0xb4f9('0xf')],'get':function(){return moment(this[_0xb4f9('0x6')]('updatedAt'))[_0xb4f9('0x10')](_0xb4f9('0x11'))[_0xb4f9('0x12')]();}}}; \ No newline at end of file +var _0x58c9=['format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE'];(function(_0x449873,_0x3b4685){var _0x267f55=function(_0x404ac1){while(--_0x404ac1){_0x449873['push'](_0x449873['shift']());}};_0x267f55(++_0x3b4685);}(_0x58c9,0x1bc));var _0x958c=function(_0x9fcd24,_0x19cc96){_0x9fcd24=_0x9fcd24-0x0;var _0x21edb=_0x58c9[_0x9fcd24];return _0x21edb;};'use strict';var Sequelize=require(_0x958c('0x0'));var moment=require(_0x958c('0x1'));var path=require(_0x958c('0x2'));var config=require(_0x958c('0x3'));module[_0x958c('0x4')]={'format':{'type':Sequelize[_0x958c('0x5')],'get':function(){return this[_0x958c('0x6')](_0x958c('0x7'))?path[_0x958c('0x8')](this[_0x958c('0x6')](_0x958c('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x958c('0x9')]},'channel':{'type':Sequelize[_0x958c('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x158388){var _0xa44c9=_0x158388[_0x958c('0xa')](/\\/g,'/');this[_0x958c('0xb')](_0x958c('0x7'),_0xa44c9);}},'rating':{'type':Sequelize[_0x958c('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x958c('0xc')],'set':function(_0x128ef6){this[_0x958c('0xb')](_0x958c('0xd'),moment()[_0x958c('0xe')](_0x128ef6,'ms'));this['setDataValue'](_0x958c('0xf'),moment());this[_0x958c('0xb')](_0x958c('0x10'),_0x128ef6);}},'startedAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this[_0x958c('0x6')](_0x958c('0xd')))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x958c('0x13')]();}},'closedAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this['getDataValue'](_0x958c('0xf')))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x958c('0x13')]();}},'createdAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x958c('0x6')](_0x958c('0x14')))[_0x958c('0x12')](_0x958c('0x15'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 51511c0..8e93bfb 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 _0x8ef6=['keys','find','create','update','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params'];(function(_0x5c38b2,_0x27c8a4){var _0x1c3153=function(_0x4b7026){while(--_0x4b7026){_0x5c38b2['push'](_0x5c38b2['shift']());}};_0x1c3153(++_0x27c8a4);}(_0x8ef6,0xf2));var _0x68ef=function(_0x222471,_0x3525f7){_0x222471=_0x222471-0x0;var _0x84fb1f=_0x8ef6[_0x222471];return _0x84fb1f;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x13280b,_0x5e4dbe){return function(_0x178460){if(!_0x178460){_0x13280b['sendStatus'](0x194);}return _0x178460;};}function handleError(_0x599243,_0x55d8b0){_0x55d8b0=_0x55d8b0||0x1f4;return function(_0x1a7ce1){logger[_0x68ef('0x29')](_0x1a7ce1[_0x68ef('0x2a')]);if(_0x1a7ce1[_0x68ef('0x2b')]){delete _0x1a7ce1['name'];}_0x599243['status'](_0x55d8b0)[_0x68ef('0x2c')](_0x1a7ce1);};}exports[_0x68ef('0x2d')]=function(_0x7bf96,_0x263b30){var _0x22ef25={},_0x201884={},_0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x2e')][_0x68ef('0x2f')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x30')]['key']};});_0x201884[_0x68ef('0x31')]=_[_0x68ef('0x32')](_['map'](_0x4579cb,'name'),[_0x68ef('0x33')]);_0x201884[_0x68ef('0x34')]=_['keys'](_0x7bf96[_0x68ef('0x34')]);_0x201884[_0x68ef('0x35')]=_[_0x68ef('0x36')](_0x201884[_0x68ef('0x31')],_0x201884['query']);_0x22ef25[_0x68ef('0x37')]=_[_0x68ef('0x36')](_0x201884['model'],qs[_0x68ef('0x38')](_0x7bf96['query'][_0x68ef('0x38')]));_0x22ef25[_0x68ef('0x37')]=_0x22ef25['attributes'][_0x68ef('0x39')]?_0x22ef25['attributes']:_0x201884[_0x68ef('0x31')];if(!_0x7bf96['query'][_0x68ef('0x3a')](_0x68ef('0x3b'))){_0x22ef25[_0x68ef('0x21')]=qs['limit'](_0x7bf96[_0x68ef('0x34')]['limit']);_0x22ef25[_0x68ef('0x1f')]=qs['offset'](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x1f')]);}_0x22ef25[_0x68ef('0x3c')]=qs[_0x68ef('0x3d')](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3d')]);_0x22ef25['where']=qs[_0x68ef('0x35')](_[_0x68ef('0x3e')](_0x7bf96[_0x68ef('0x34')],_0x201884['filters']),_0x4579cb);if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3f')]){_0x22ef25[_0x68ef('0x40')]=_['merge'](_0x22ef25['where'],{'$or':_[_0x68ef('0x41')](_0x4579cb,function(_0xec7de3){if(_0xec7de3[_0x68ef('0x30')]!==_0x68ef('0x42')){var _0x401459={};_0x401459[_0xec7de3[_0x68ef('0x2b')]]={'$like':'%'+_0x7bf96[_0x68ef('0x34')]['filter']+'%'};return _0x401459;}})});}_0x22ef25=_[_0x68ef('0x43')]({},_0x22ef25,_0x7bf96[_0x68ef('0x44')]);var _0x2f6ee0={'where':_0x22ef25[_0x68ef('0x40')]};return db['ScreenRecording'][_0x68ef('0x45')](_0x2f6ee0)[_0x68ef('0x27')](function(_0xcf595d){_0x26288a[_0x68ef('0x45')]=_0xcf595d;if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x46')]){_0x22ef25['include']=[{'all':!![]}];}return db[_0x68ef('0x2e')][_0x68ef('0x47')](_0x22ef25);})[_0x68ef('0x27')](function(_0x43796b){_0x26288a[_0x68ef('0x48')]=_0x43796b;return _0x26288a;})[_0x68ef('0x27')](respondWithFilteredResult(_0x263b30,_0x22ef25))[_0x68ef('0x49')](handleError(_0x263b30,null));};exports[_0x68ef('0x4a')]=function(_0xc687ab,_0x531096){var _0xad1a28={'raw':![],'where':{'id':_0xc687ab[_0x68ef('0x4b')]['id']}},_0x19d7a1={};_0x19d7a1[_0x68ef('0x31')]=_[_0x68ef('0x4c')](db[_0x68ef('0x2e')][_0x68ef('0x2f')]);_0x19d7a1['query']=_[_0x68ef('0x4c')](_0xc687ab['query']);_0x19d7a1[_0x68ef('0x35')]=_[_0x68ef('0x36')](_0x19d7a1[_0x68ef('0x31')],_0x19d7a1[_0x68ef('0x34')]);_0xad1a28['attributes']=_[_0x68ef('0x36')](_0x19d7a1['model'],qs[_0x68ef('0x38')](_0xc687ab['query'][_0x68ef('0x38')]));_0xad1a28[_0x68ef('0x37')]=_0xad1a28[_0x68ef('0x37')]['length']?_0xad1a28['attributes']:_0x19d7a1[_0x68ef('0x31')];if(_0xc687ab[_0x68ef('0x34')]['includeAll']){_0xad1a28['include']=[{'all':!![]}];}_0xad1a28=_['merge']({},_0xad1a28,_0xc687ab[_0x68ef('0x44')]);return db[_0x68ef('0x2e')][_0x68ef('0x4d')](_0xad1a28)[_0x68ef('0x27')](handleEntityNotFound(_0x531096,null))[_0x68ef('0x27')](respondWithResult(_0x531096,null))['catch'](handleError(_0x531096,null));};exports['create']=function(_0xc39f5b,_0x21f064){return db[_0x68ef('0x2e')][_0x68ef('0x4e')](_0xc39f5b['body'],{})[_0x68ef('0x27')](respondWithResult(_0x21f064,0xc9))[_0x68ef('0x49')](handleError(_0x21f064,null));};exports[_0x68ef('0x4f')]=function(_0x14142a,_0x53880c){if(_0x14142a['body']['id']){delete _0x14142a[_0x68ef('0x50')]['id'];}delete _0x14142a[_0x68ef('0x50')]['duration'];delete _0x14142a[_0x68ef('0x50')][_0x68ef('0x51')];delete _0x14142a[_0x68ef('0x50')][_0x68ef('0x52')];delete _0x14142a[_0x68ef('0x50')]['value'];return db[_0x68ef('0x2e')][_0x68ef('0x4d')]({'where':{'id':_0x14142a[_0x68ef('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53880c,null))[_0x68ef('0x27')](saveUpdates(_0x14142a[_0x68ef('0x50')],null))[_0x68ef('0x27')](respondWithResult(_0x53880c,null))['catch'](handleError(_0x53880c,null));};exports[_0x68ef('0x53')]=function(_0x59e8ee,_0x574573){return db[_0x68ef('0x2e')]['describe']()[_0x68ef('0x27')](respondWithResult(_0x574573,null))[_0x68ef('0x49')](handleError(_0x574573,null));};exports[_0x68ef('0x54')]=function(_0x1e651f,_0x2a0be0,_0x45ae42){var _0x363498=require(_0x68ef('0x55'));var _0x2b35f4=![];var _0x247915={};if(_0x1e651f['query']['type']&&_0x1e651f[_0x68ef('0x34')][_0x68ef('0x30')]===_0x68ef('0x56')){_0x247915[_0x68ef('0x56')]=_0x1e651f[_0x68ef('0x4b')]['id'];}else{_0x247915['id']=_0x1e651f[_0x68ef('0x4b')]['id'];}return db[_0x68ef('0x2e')][_0x68ef('0x4d')]({'where':_0x247915,'attributes':['id',_0x68ef('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x2a0be0,null))['then'](function(_0x42a4b2){if(_0x42a4b2){var _0x5781c8=path[_0x68ef('0x58')](config['root'],_0x68ef('0x59'),_0x42a4b2[_0x68ef('0x57')]);var _0x552736=util[_0x68ef('0x33')]('%s.cypher',_0x5781c8);if(fs[_0x68ef('0x5a')](_0x552736)){_0x2b35f4=!![];return _0x363498[_0x68ef('0x5b')](_0x552736,_0x5781c8,config[_0x68ef('0x5c')][_0x68ef('0x5d')])[_0x68ef('0x27')](function(){return _0x42a4b2;});}return _0x42a4b2;}})[_0x68ef('0x27')](function(_0x5c347c){if(_0x5c347c){var _0x1cdaef=path[_0x68ef('0x58')](config[_0x68ef('0x5e')],_0x68ef('0x59'),_0x5c347c[_0x68ef('0x57')]);if(!fs[_0x68ef('0x5a')](_0x1cdaef)){throw new db['Sequelize'][(_0x68ef('0x5f'))](_0x68ef('0x60'));}if(_0x5c347c['filename']){return _0x2a0be0[_0x68ef('0x54')](_0x1cdaef,_0x5c347c[_0x68ef('0x61')]+path[_0x68ef('0x62')](_0x1cdaef),function(){if(_0x2b35f4){fs['unlink'](_0x1cdaef);}});}else{return _0x2a0be0[_0x68ef('0x54')](_0x1cdaef,function(_0x49d197){if(_0x2b35f4){fs['unlink'](_0x1cdaef);}});}}})[_0x68ef('0x49')](function(_0x540da5){if(_0x540da5[_0x68ef('0x63')]==='ScreenRecording\x20not\x20found'){_0x2a0be0[_0x68ef('0x1d')](0x194)[_0x68ef('0x2c')](_0x68ef('0x64'));}else{return handleError(_0x2a0be0,null);}});};exports[_0x68ef('0x28')]=function(_0x19ce17,_0x19a9c4){return db['ScreenRecording'][_0x68ef('0x4d')]({'where':{'id':_0x19ce17['params']['id']}})[_0x68ef('0x27')](function(_0x4b0c3e){if(_[_0x68ef('0x65')](_0x4b0c3e)){throw new ReferenceError(_0x68ef('0x66'));}return _0x4b0c3e;})[_0x68ef('0x27')](function(_0xf0a40f){var _0x2f409c=path[_0x68ef('0x58')](config[_0x68ef('0x5e')],'server/files/screen_recordings',_0xf0a40f[_0x68ef('0x57')]);logger[_0x68ef('0x67')](_0x68ef('0x68'),_0x2f409c);if(!_[_0x68ef('0x65')](_0xf0a40f[_0x68ef('0x57')])&&fs['existsSync'](_0x2f409c)){logger[_0x68ef('0x67')]('File:\x20\x22'+_0x2f409c+_0x68ef('0x69'));fs['unlinkSync'](_0x2f409c);}_0x2f409c=_0x2f409c+'.cypher';if(!_[_0x68ef('0x65')](_0xf0a40f[_0x68ef('0x57')])&&fs[_0x68ef('0x5a')](_0x2f409c)){logger[_0x68ef('0x67')]('File:\x20\x22'+_0x2f409c+_0x68ef('0x69'));fs['unlinkSync'](_0x2f409c);}return _0xf0a40f;})[_0x68ef('0x27')](function(_0x2d916e){if(!_0x2d916e)throw new InternalError();return _0x2d916e[_0x68ef('0x28')]();})['then'](function(){_0x19a9c4['status'](0xcc)[_0x68ef('0x1c')]();})[_0x68ef('0x49')](handleError(_0x19a9c4,null));}; \ No newline at end of file +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(_0x128b9d,_0x4a085f){var _0x3906c6=function(_0x2ee338){while(--_0x2ee338){_0x128b9d['push'](_0x128b9d['shift']());}};_0x3906c6(++_0x4a085f);}(_0xee14,0x13a));var _0x4ee1=function(_0x3e83d2,_0x238f9f){_0x3e83d2=_0x3e83d2-0x0;var _0x4246d2=_0xee14[_0x3e83d2];return _0x4246d2;};'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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 8fe3db3..2aad2e6 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 _0xfc70=['util','api','moment','bluebird','request-promise','path','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x22407e,_0x2a8907){var _0x846747=function(_0x120acd){while(--_0x120acd){_0x22407e['push'](_0x22407e['shift']());}};_0x846747(++_0x2a8907);}(_0xfc70,0x197));var _0x0fc7=function(_0x5a9433,_0x1036a7){_0x5a9433=_0x5a9433-0x0;var _0x265738=_0xfc70[_0x5a9433];return _0x265738;};'use strict';var _=require(_0x0fc7('0x0'));var util=require(_0x0fc7('0x1'));var logger=require('../../config/logger')(_0x0fc7('0x2'));var moment=require(_0x0fc7('0x3'));var BPromise=require(_0x0fc7('0x4'));var rp=require(_0x0fc7('0x5'));var fs=require('fs');var path=require(_0x0fc7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0fc7('0x7'));module[_0x0fc7('0x8')]=function(_0x146cf1,_0x5198d7){return _0x146cf1['define'](_0x0fc7('0x9'),attributes,{'tableName':_0x0fc7('0xa'),'paranoid':![],'indexes':[{'name':_0x0fc7('0xb'),'fields':[_0x0fc7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3432=['api','moment','bluebird','request-promise','rimraf','./screenRecording.attributes','define','ScreenRecording','interactionid','util'];(function(_0x4c97f4,_0x114839){var _0x53f50b=function(_0x1e908c){while(--_0x1e908c){_0x4c97f4['push'](_0x4c97f4['shift']());}};_0x53f50b(++_0x114839);}(_0x3432,0x199));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2343('0x0'));var logger=require('../../config/logger')(_0x2343('0x1'));var moment=require(_0x2343('0x2'));var BPromise=require(_0x2343('0x3'));var rp=require(_0x2343('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2343('0x5'));var config=require('../../config/environment');var attributes=require(_0x2343('0x6'));module['exports']=function(_0x14f05e,_0x580555){return _0x14f05e[_0x2343('0x7')](_0x2343('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2343('0x9'),'fields':[_0x2343('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a82bebc..94e6377 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 _0x851b=['code','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x851b,0x169));var _0xb851=function(_0x2db432,_0x1713f5){_0x2db432=_0x2db432-0x0;var _0x515b43=_0x851b[_0x2db432];return _0x515b43;};'use strict';var _=require('lodash');var util=require(_0xb851('0x0'));var moment=require('moment');var BPromise=require(_0xb851('0x1'));var rs=require(_0xb851('0x2'));var fs=require('fs');var Redis=require(_0xb851('0x3'));var db=require(_0xb851('0x4'))['db'];var utils=require(_0xb851('0x5'));var logger=require('../../config/logger')(_0xb851('0x6'));var config=require(_0xb851('0x7'));var jayson=require(_0xb851('0x8'));var client=jayson[_0xb851('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283285,_0x1389ef,_0x5e07b3){return new BPromise(function(_0x3269cb,_0x2a3163){return client[_0xb851('0xa')](_0x283285,_0x5e07b3)[_0xb851('0xb')](function(_0x5c736b){logger[_0xb851('0xc')](_0xb851('0xd'),_0x1389ef,_0xb851('0xe'));logger[_0xb851('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1389ef,_0xb851('0xe'),JSON[_0xb851('0x10')](_0x5c736b));if(_0x5c736b['error']){if(_0x5c736b['error'][_0xb851('0x11')]===0x1f4){logger['error'](_0xb851('0xd'),_0x1389ef,_0x5c736b[_0xb851('0x12')][_0xb851('0x13')]);return _0x2a3163(_0x5c736b[_0xb851('0x12')][_0xb851('0x13')]);}logger[_0xb851('0x12')](_0xb851('0xd'),_0x1389ef,_0x5c736b[_0xb851('0x12')][_0xb851('0x13')]);return _0x3269cb(_0x5c736b['error'][_0xb851('0x13')]);}else{logger[_0xb851('0xc')](_0xb851('0xd'),_0x1389ef,_0xb851('0xe'));_0x3269cb(_0x5c736b['result'][_0xb851('0x13')]);}})[_0xb851('0x14')](function(_0xbbc6b6){logger[_0xb851('0x12')](_0xb851('0xd'),_0x1389ef,_0xbbc6b6);_0x2a3163(_0xbbc6b6);});});} \ No newline at end of file +var _0x88b6=['request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x287d1b,_0x57e6bc){var _0x69c191=function(_0x217405){while(--_0x217405){_0x287d1b['push'](_0x287d1b['shift']());}};_0x69c191(++_0x57e6bc);}(_0x88b6,0xa5));var _0x688b=function(_0x3d0750,_0x29a3ed){_0x3d0750=_0x3d0750-0x0;var _0x58e9d4=_0x88b6[_0x3d0750];return _0x58e9d4;};'use strict';var _=require(_0x688b('0x0'));var util=require(_0x688b('0x1'));var moment=require('moment');var BPromise=require(_0x688b('0x2'));var rs=require(_0x688b('0x3'));var fs=require('fs');var Redis=require(_0x688b('0x4'));var db=require(_0x688b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x688b('0x6'))(_0x688b('0x7'));var config=require(_0x688b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x688b('0x9')][_0x688b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5692bc,_0x725694,_0x3827ca){return new BPromise(function(_0x39f389,_0x49e8c6){return client[_0x688b('0xb')](_0x5692bc,_0x3827ca)['then'](function(_0x3fff33){logger['info'](_0x688b('0xc'),_0x725694,_0x688b('0xd'));logger[_0x688b('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x725694,_0x688b('0xd'),JSON[_0x688b('0xf')](_0x3fff33));if(_0x3fff33[_0x688b('0x10')]){if(_0x3fff33['error'][_0x688b('0x11')]===0x1f4){logger[_0x688b('0x10')](_0x688b('0xc'),_0x725694,_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);return _0x49e8c6(_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);}logger[_0x688b('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x725694,_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);return _0x39f389(_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);}else{logger[_0x688b('0x13')](_0x688b('0xc'),_0x725694,_0x688b('0xd'));_0x39f389(_0x3fff33[_0x688b('0x14')]['message']);}})[_0x688b('0x15')](function(_0x505ece){logger[_0x688b('0x10')](_0x688b('0xc'),_0x725694,_0x505ece);_0x49e8c6(_0x505ece);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9c764e8..e101a39 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 _0x5422=['addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','format','logologin','join','addPreferred','favicon','/:id/favicon'];(function(_0x296249,_0x502d22){var _0x5a0b1f=function(_0x558005){while(--_0x558005){_0x296249['push'](_0x296249['shift']());}};_0x5a0b1f(++_0x502d22);}(_0x5422,0x118));var _0x2542=function(_0x432582,_0x41bef5){_0x432582=_0x432582-0x0;var _0x51ac0a=_0x5422[_0x432582];return _0x51ac0a;};'use strict';var multer=require(_0x2542('0x0'));var util=require(_0x2542('0x1'));var path=require(_0x2542('0x2'));var timeout=require(_0x2542('0x3'));var express=require(_0x2542('0x4'));var router=express[_0x2542('0x5')]();var fs_extra=require(_0x2542('0x6'));var auth=require(_0x2542('0x7'));var interaction=require(_0x2542('0x8'));var config=require(_0x2542('0x9'));var controller=require('./setting.controller');router[_0x2542('0xa')]('/',auth[_0x2542('0xb')](),controller[_0x2542('0xc')]);router[_0x2542('0xa')](_0x2542('0xd'),controller[_0x2542('0xe')]);router[_0x2542('0xa')](_0x2542('0xf'),controller[_0x2542('0x10')]);router[_0x2542('0xa')](_0x2542('0x11'),controller['getLogo']);router[_0x2542('0xa')](_0x2542('0x12'),controller[_0x2542('0x13')]);router[_0x2542('0xa')](_0x2542('0x14'),controller[_0x2542('0x15')]);router['get'](_0x2542('0x16'),controller[_0x2542('0x17')]);router[_0x2542('0xa')]('/:id/favicon',controller[_0x2542('0x18')]);var upload=multer({'storage':multer[_0x2542('0x19')]({'destination':function(_0x335bf5,_0x4729bf,_0x257675){_0x257675(null,path['join'](config[_0x2542('0x1a')],_0x2542('0x1b')));},'filename':function(_0x1bad91,_0x71028c,_0x50ec19){_0x50ec19(null,util['format'](_0x2542('0x1c'),_0x2542('0x1d'),path[_0x2542('0x1e')](_0x71028c[_0x2542('0x1f')])));}})});router[_0x2542('0x20')](_0x2542('0x11'),upload[_0x2542('0x21')](_0x2542('0x22')),controller[_0x2542('0x23')]);var upload=multer({'storage':multer[_0x2542('0x19')]({'destination':function(_0x3eec56,_0x510e8e,_0xed77d1){_0xed77d1(null,path['join'](config['root'],_0x2542('0x1b')));},'filename':function(_0x35c3a0,_0x118248,_0x4c3e0d){_0x4c3e0d(null,util[_0x2542('0x24')](_0x2542('0x1c'),_0x2542('0x25'),path[_0x2542('0x1e')](_0x118248[_0x2542('0x1f')])));}})});router['post'](_0x2542('0x12'),upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x2542('0x19')]({'destination':function(_0x619142,_0x45e09e,_0xa02597){_0xa02597(null,path[_0x2542('0x26')](config['root'],_0x2542('0x1b')));},'filename':function(_0x150134,_0x15184f,_0x4f0783){_0x4f0783(null,util[_0x2542('0x24')](_0x2542('0x1c'),'preferred',path[_0x2542('0x1e')](_0x15184f['originalname'])));}})});router[_0x2542('0x20')]('/:id/preferred',upload[_0x2542('0x21')](_0x2542('0x22')),controller[_0x2542('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16299f,_0xa660b8,_0x26505f){_0x26505f(null,path['join'](config['root'],_0x2542('0x1b')));},'filename':function(_0xded65e,_0x453cc4,_0x57723c){_0x57723c(null,util[_0x2542('0x24')](_0x2542('0x1c'),_0x2542('0x28'),path[_0x2542('0x1e')](_0x453cc4[_0x2542('0x1f')])));}})});router['post'](_0x2542('0x29'),upload[_0x2542('0x21')](_0x2542('0x22')),controller[_0x2542('0x2a')]);router[_0x2542('0x2b')](_0x2542('0xf'),auth['isAuthenticated'](),controller[_0x2542('0x2c')]);module[_0x2542('0x2d')]=router; \ No newline at end of file +var _0x6e24=['format','originalname','post','single','addLogo','diskStorage','%s%s','logologin','file','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','put','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/'];(function(_0x16d60e,_0x2c83cb){var _0x254949=function(_0x2c49ae){while(--_0x2c49ae){_0x16d60e['push'](_0x16d60e['shift']());}};_0x254949(++_0x2c83cb);}(_0x6e24,0x10d));var _0x46e2=function(_0x47a3c2,_0x55d53d){_0x47a3c2=_0x47a3c2-0x0;var _0x3cf66e=_0x6e24[_0x47a3c2];return _0x3cf66e;};'use strict';var multer=require(_0x46e2('0x0'));var util=require(_0x46e2('0x1'));var path=require(_0x46e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x46e2('0x3'));var router=express['Router']();var fs_extra=require(_0x46e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x46e2('0x5'));var config=require('../../config/environment');var controller=require(_0x46e2('0x6'));router[_0x46e2('0x7')]('/',auth[_0x46e2('0x8')](),controller[_0x46e2('0x9')]);router[_0x46e2('0x7')]('/now',controller[_0x46e2('0xa')]);router['get'](_0x46e2('0xb'),controller['show']);router['get'](_0x46e2('0xc'),controller[_0x46e2('0xd')]);router[_0x46e2('0x7')](_0x46e2('0xe'),controller[_0x46e2('0xf')]);router[_0x46e2('0x7')](_0x46e2('0x10'),controller[_0x46e2('0x11')]);router[_0x46e2('0x7')](_0x46e2('0x12'),controller[_0x46e2('0x13')]);router[_0x46e2('0x7')](_0x46e2('0x14'),controller[_0x46e2('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x470998,_0xcb2eef,_0x5d91ac){_0x5d91ac(null,path[_0x46e2('0x16')](config[_0x46e2('0x17')],_0x46e2('0x18')));},'filename':function(_0x39b697,_0x56d3cb,_0x55c400){_0x55c400(null,util[_0x46e2('0x19')]('%s%s','logo',path['extname'](_0x56d3cb[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')](_0x46e2('0xc'),upload[_0x46e2('0x1c')]('file'),controller[_0x46e2('0x1d')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x66622b,_0x310d89,_0x1d0def){_0x1d0def(null,path[_0x46e2('0x16')](config[_0x46e2('0x17')],'server/files/images/logos/'));},'filename':function(_0x574774,_0x4e6041,_0x428092){_0x428092(null,util['format'](_0x46e2('0x1f'),_0x46e2('0x20'),path['extname'](_0x4e6041[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')]('/:id/logo_login',upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x22')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x9b697f,_0x53b3dd,_0x12ad52){_0x12ad52(null,path['join'](config[_0x46e2('0x17')],_0x46e2('0x18')));},'filename':function(_0x119194,_0x40b617,_0x57652a){_0x57652a(null,util[_0x46e2('0x19')](_0x46e2('0x1f'),_0x46e2('0x23'),path[_0x46e2('0x24')](_0x40b617[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')](_0x46e2('0x12'),upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x25')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x52906a,_0x2ee70a,_0x4dc3cc){_0x4dc3cc(null,path['join'](config[_0x46e2('0x17')],'server/files/images/logos/'));},'filename':function(_0x315459,_0x19b83e,_0x3e100e){_0x3e100e(null,util[_0x46e2('0x19')](_0x46e2('0x1f'),_0x46e2('0x26'),path[_0x46e2('0x24')](_0x19b83e[_0x46e2('0x1a')])));}})});router['post'](_0x46e2('0x14'),upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x27')]);router[_0x46e2('0x28')](_0x46e2('0xb'),auth[_0x46e2('0x8')](),controller['update']);module[_0x46e2('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8d60e13..85085e0 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(_0x3fb153,_0x272577){var _0x4c4580=function(_0x59034e){while(--_0x59034e){_0x3fb153['push'](_0x3fb153['shift']());}};_0x4c4580(++_0x272577);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x6b11e4,_0x4a58f7){var _0x2b2325=function(_0x18a4d6){while(--_0x18a4d6){_0x6b11e4['push'](_0x6b11e4['shift']());}};_0x2b2325(++_0x4a58f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 0076b20..8f8b4b8 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 _0x7868=['undefined','limit','count','set','apply','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','rows','params','includeAll','options','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','download','getLogoLogin','getLicense','default_loginLogo.svg','gdpr','addPreferred','getPreferred','defaultLogo','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset'];(function(_0x5e5410,_0x38b8b9){var _0x53da28=function(_0x4ed8e4){while(--_0x4ed8e4){_0x5e5410['push'](_0x5e5410['shift']());}};_0x53da28(++_0x38b8b9);}(_0x7868,0x1c0));var _0x8786=function(_0x4ce033,_0x5bdea9){_0x4ce033=_0x4ce033-0x0;var _0x5a1e7c=_0x7868[_0x4ce033];return _0x5a1e7c;};'use strict';var emlformat=require(_0x8786('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8786('0x1'));var jsonpatch=require(_0x8786('0x2'));var rp=require(_0x8786('0x3'));var moment=require(_0x8786('0x4'));var BPromise=require(_0x8786('0x5'));var Mustache=require('mustache');var util=require(_0x8786('0x6'));var path=require(_0x8786('0x7'));var sox=require(_0x8786('0x8'));var csv=require(_0x8786('0x9'));var ejs=require(_0x8786('0xa'));var fs=require('fs');var fs_extra=require(_0x8786('0xb'));var _=require(_0x8786('0xc'));var squel=require(_0x8786('0xd'));var crypto=require(_0x8786('0xe'));var jsforce=require(_0x8786('0xf'));var deskjs=require(_0x8786('0x10'));var toCsv=require(_0x8786('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8786('0x11'));var authService=require(_0x8786('0x12'));var qs=require(_0x8786('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8786('0x14'))('api');var utils=require(_0x8786('0x15'));var config=require(_0x8786('0x16'));var licenseUtil=require(_0x8786('0x17'));var db=require(_0x8786('0x18'))['db'];var jayson=require(_0x8786('0x19'));var client=jayson[_0x8786('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0f59,_0x1235b3,_0x50d09d,_0x1cb9f1){return new BPromise(function(_0x1d3dd3,_0x5cde1d){var _0x130f3d=_0x1cb9f1||client;return _0x130f3d[_0x8786('0x1b')](_0x1a0f59,_0x50d09d)[_0x8786('0x1c')](function(_0x438bad){logger['info']('Setting,\x20%s,\x20%s',_0x1235b3,'request\x20sent');logger[_0x8786('0x1d')](_0x8786('0x1e'),_0x1235b3,_0x8786('0x1f'),JSON[_0x8786('0x20')](_0x438bad));if(_0x438bad['error']){if(_0x438bad[_0x8786('0x21')][_0x8786('0x22')]===0x1f4){logger[_0x8786('0x21')](_0x8786('0x23'),_0x1235b3,_0x438bad[_0x8786('0x21')][_0x8786('0x24')]);return _0x5cde1d(_0x438bad[_0x8786('0x21')][_0x8786('0x24')]);}logger[_0x8786('0x21')]('Setting,\x20%s,\x20%s',_0x1235b3,_0x438bad[_0x8786('0x21')][_0x8786('0x24')]);return _0x1d3dd3(_0x438bad[_0x8786('0x21')][_0x8786('0x24')]);}else{logger[_0x8786('0x25')]('Setting,\x20%s,\x20%s',_0x1235b3,_0x8786('0x1f'));_0x1d3dd3(_0x438bad[_0x8786('0x26')]['message']);}})[_0x8786('0x27')](function(_0x1af37a){logger[_0x8786('0x21')]('Setting,\x20%s,\x20%s',_0x1235b3,_0x1af37a);_0x5cde1d(_0x1af37a);});});}function respondWithStatusCode(_0x5165f7,_0x529247){_0x529247=_0x529247||0xcc;return function(_0x27f85e){if(_0x27f85e){return _0x5165f7[_0x8786('0x28')](_0x529247);}return _0x5165f7[_0x8786('0x29')](_0x529247)['end']();};}function respondWithResult(_0x1de2da,_0x42555b){_0x42555b=_0x42555b||0xc8;return function(_0xcd7d9){if(_0xcd7d9){return _0x1de2da[_0x8786('0x29')](_0x42555b)[_0x8786('0x2a')](_0xcd7d9);}};}function respondWithFilteredResult(_0x53c1a9,_0x4a17f3){return function(_0x30091c){if(_0x30091c){var _0x78f355=typeof _0x4a17f3[_0x8786('0x2b')]===_0x8786('0x2c')&&typeof _0x4a17f3[_0x8786('0x2d')]===_0x8786('0x2c');var _0x636e39=_0x30091c[_0x8786('0x2e')];var _0x322a04=_0x78f355?0x0:_0x4a17f3[_0x8786('0x2b')];var _0x49ab14=_0x78f355?_0x30091c['count']:_0x4a17f3['offset']+_0x4a17f3[_0x8786('0x2d')];var _0x502440;if(_0x49ab14>=_0x636e39){_0x49ab14=_0x636e39;_0x502440=0xc8;}else{_0x502440=0xce;}_0x53c1a9[_0x8786('0x29')](_0x502440);return _0x53c1a9[_0x8786('0x2f')]('Content-Range',_0x322a04+'-'+_0x49ab14+'/'+_0x636e39)[_0x8786('0x2a')](_0x30091c);}return null;};}function patchUpdates(_0x5b0273){return function(_0x1cc114){try{jsonpatch[_0x8786('0x30')](_0x1cc114,_0x5b0273,!![]);}catch(_0x3d2bb5){return BPromise['reject'](_0x3d2bb5);}return _0x1cc114['save']();};}function saveUpdates(_0x40ac99,_0x2794e5){return function(_0x208cae){if(_0x208cae){return _0x208cae[_0x8786('0x31')](_0x40ac99)['then'](function(_0x28c862){return _0x28c862;});}return null;};}function removeEntity(_0x3c8a14,_0x48e235){return function(_0x5bac26){if(_0x5bac26){return _0x5bac26[_0x8786('0x32')]()[_0x8786('0x1c')](function(){_0x3c8a14[_0x8786('0x29')](0xcc)[_0x8786('0x33')]();});}};}function handleEntityNotFound(_0x47d68b,_0x3cc194){return function(_0x199aad){if(!_0x199aad){_0x47d68b['sendStatus'](0x194);}return _0x199aad;};}function handleError(_0x3d38bd,_0x4d960d){_0x4d960d=_0x4d960d||0x1f4;return function(_0x5040c8){logger[_0x8786('0x21')](_0x5040c8[_0x8786('0x34')]);if(_0x5040c8[_0x8786('0x35')]){delete _0x5040c8['name'];}_0x3d38bd[_0x8786('0x29')](_0x4d960d)[_0x8786('0x36')](_0x5040c8);};}exports[_0x8786('0x37')]=function(_0x115504,_0x58d84d){var _0x5bb4fa={},_0x1f6c3a={},_0x1788cd={'count':0x0,'rows':[]};var _0x1a1f36=_[_0x8786('0x38')](db[_0x8786('0x39')][_0x8786('0x3a')],function(_0x58b552){return{'name':_0x58b552[_0x8786('0x3b')],'type':_0x58b552[_0x8786('0x3c')][_0x8786('0x3d')]};});_0x1f6c3a[_0x8786('0x3e')]=_[_0x8786('0x38')](_0x1a1f36,_0x8786('0x35'));_0x1f6c3a[_0x8786('0x3f')]=_[_0x8786('0x40')](_0x115504[_0x8786('0x3f')]);_0x1f6c3a[_0x8786('0x41')]=_[_0x8786('0x42')](_0x1f6c3a[_0x8786('0x3e')],_0x1f6c3a['query']);_0x5bb4fa[_0x8786('0x43')]=_[_0x8786('0x42')](_0x1f6c3a[_0x8786('0x3e')],qs[_0x8786('0x44')](_0x115504[_0x8786('0x3f')][_0x8786('0x44')]));_0x5bb4fa['attributes']=_0x5bb4fa[_0x8786('0x43')][_0x8786('0x45')]?_0x5bb4fa['attributes']:_0x1f6c3a[_0x8786('0x3e')];if(!_0x115504[_0x8786('0x3f')][_0x8786('0x46')](_0x8786('0x47'))){_0x5bb4fa[_0x8786('0x2d')]=qs[_0x8786('0x2d')](_0x115504[_0x8786('0x3f')][_0x8786('0x2d')]);_0x5bb4fa['offset']=qs['offset'](_0x115504[_0x8786('0x3f')][_0x8786('0x2b')]);}_0x5bb4fa[_0x8786('0x48')]=qs[_0x8786('0x49')](_0x115504[_0x8786('0x3f')][_0x8786('0x49')]);_0x5bb4fa['where']=qs[_0x8786('0x41')](_['pick'](_0x115504['query'],_0x1f6c3a[_0x8786('0x41')]),_0x1a1f36);if(_0x115504['query'][_0x8786('0x4a')]){_0x5bb4fa[_0x8786('0x4b')]=_[_0x8786('0x4c')](_0x5bb4fa[_0x8786('0x4b')],{'$or':_[_0x8786('0x38')](_0x1a1f36,function(_0x2e88a7){if(_0x2e88a7[_0x8786('0x3c')]!==_0x8786('0x4d')){var _0x2d1673={};_0x2d1673[_0x2e88a7['name']]={'$like':'%'+_0x115504[_0x8786('0x3f')][_0x8786('0x4a')]+'%'};return _0x2d1673;}})});}_0x5bb4fa=_[_0x8786('0x4c')]({},_0x5bb4fa,_0x115504['options']);var _0x59944f={'where':_0x5bb4fa[_0x8786('0x4b')]};return db[_0x8786('0x39')]['count'](_0x59944f)[_0x8786('0x1c')](function(_0x48b30d){_0x1788cd[_0x8786('0x2e')]=_0x48b30d;if(_0x115504[_0x8786('0x3f')]['includeAll']){_0x5bb4fa[_0x8786('0x4e')]=[{'all':!![]}];}return db[_0x8786('0x39')]['findAll'](_0x5bb4fa);})['then'](function(_0x5b2614){_0x1788cd[_0x8786('0x4f')]=_0x5b2614;return _0x1788cd;})['then'](respondWithFilteredResult(_0x58d84d,_0x5bb4fa))[_0x8786('0x27')](handleError(_0x58d84d,null));};exports['show']=function(_0x735f5c,_0x31e5e3){var _0x12dfbc={'raw':![],'where':{'id':_0x735f5c[_0x8786('0x50')]['id']}},_0x4c6f74={};_0x4c6f74[_0x8786('0x3e')]=_[_0x8786('0x40')](db[_0x8786('0x39')][_0x8786('0x3a')]);_0x4c6f74[_0x8786('0x3f')]=_['keys'](_0x735f5c[_0x8786('0x3f')]);_0x4c6f74[_0x8786('0x41')]=_['intersection'](_0x4c6f74['model'],_0x4c6f74[_0x8786('0x3f')]);_0x12dfbc[_0x8786('0x43')]=_[_0x8786('0x42')](_0x4c6f74[_0x8786('0x3e')],qs[_0x8786('0x44')](_0x735f5c[_0x8786('0x3f')][_0x8786('0x44')]));_0x12dfbc[_0x8786('0x43')]=_0x12dfbc[_0x8786('0x43')][_0x8786('0x45')]?_0x12dfbc['attributes']:_0x4c6f74[_0x8786('0x3e')];if(_0x735f5c[_0x8786('0x3f')][_0x8786('0x51')]){_0x12dfbc[_0x8786('0x4e')]=[{'all':!![]}];}_0x12dfbc=_['merge']({},_0x12dfbc,_0x735f5c[_0x8786('0x52')]);return db[_0x8786('0x39')]['find'](_0x12dfbc)[_0x8786('0x1c')](handleEntityNotFound(_0x31e5e3,null))['then'](respondWithResult(_0x31e5e3,null))[_0x8786('0x27')](handleError(_0x31e5e3,null));};exports[_0x8786('0x31')]=function(_0x49909a,_0x18bd9e){if(_0x49909a['body']['id']){delete _0x49909a[_0x8786('0x53')]['id'];}return db['Setting'][_0x8786('0x54')]({'where':{'id':_0x49909a[_0x8786('0x50')]['id']}})[_0x8786('0x1c')](handleEntityNotFound(_0x18bd9e,null))[_0x8786('0x1c')](saveUpdates(_0x49909a[_0x8786('0x53')],null))[_0x8786('0x1c')](respondWithResult(_0x18bd9e,null))[_0x8786('0x27')](handleError(_0x18bd9e,null));};exports[_0x8786('0x55')]=function(_0x15e5dd,_0x2ee45a,_0x1755ce){if(_0x15e5dd[_0x8786('0x56')]&&_0x15e5dd[_0x8786('0x56')][_0x8786('0x57')]){_0x15e5dd[_0x8786('0x53')][_0x8786('0x58')]=_0x15e5dd[_0x8786('0x56')][_0x8786('0x57')];}return db[_0x8786('0x39')][_0x8786('0x54')]({'where':{'id':_0x15e5dd[_0x8786('0x50')]['id']}})[_0x8786('0x1c')](handleEntityNotFound(_0x2ee45a,null))[_0x8786('0x1c')](saveUpdates(_0x15e5dd[_0x8786('0x53')],null))[_0x8786('0x1c')](respondWithResult(_0x2ee45a,null))[_0x8786('0x27')](handleError(_0x2ee45a,null));};exports[_0x8786('0x59')]=function(_0x1a7e43,_0x4a7964,_0x2cd63c){if(_0x1a7e43['file']&&_0x1a7e43['file'][_0x8786('0x57')]){_0x1a7e43['body'][_0x8786('0x5a')]=_0x1a7e43[_0x8786('0x56')][_0x8786('0x57')];}return db[_0x8786('0x39')][_0x8786('0x54')]({'where':{'id':_0x1a7e43[_0x8786('0x50')]['id']}})[_0x8786('0x1c')](handleEntityNotFound(_0x4a7964,null))[_0x8786('0x1c')](saveUpdates(_0x1a7e43[_0x8786('0x53')],null))['then'](respondWithResult(_0x4a7964,null))['catch'](handleError(_0x4a7964,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x376df9,_0xab06b9,_0x418050){var _0x1c33f6=_0x8786('0x5b');var _0x17c856={'custom':![]};return utilLicense['getLicense']()[_0x8786('0x1c')](function(_0x2476ff){if(_0x2476ff){_0x17c856=_0x2476ff;}return db[_0x8786('0x39')][_0x8786('0x54')]({'where':{'id':_0x376df9['params']['id']},'attributes':[_0x8786('0x58'),_0x8786('0x5a'),_0x8786('0x5c'),_0x8786('0x5d'),'defaultLogo',_0x8786('0x5e'),_0x8786('0x5f'),_0x8786('0x60')],'raw':!![]});})[_0x8786('0x1c')](handleEntityNotFound(_0xab06b9,null))[_0x8786('0x1c')](function(_0x2eea69){if(_0x2eea69){var _0x35e614=_0x2eea69[_0x8786('0x58')]&&fs[_0x8786('0x61')](path[_0x8786('0x62')](config[_0x8786('0x63')],_0x1c33f6,_[_0x8786('0x64')](_0x2eea69[_0x8786('0x58')])))?path[_0x8786('0x62')](config[_0x8786('0x63')],_0x1c33f6,_[_0x8786('0x64')](_0x2eea69[_0x8786('0x58')])):path[_0x8786('0x62')](config[_0x8786('0x63')],_0x1c33f6,_[_0x8786('0x64')]('default_logo.svg'));var _0x426c94=_0x8786('0x65')+_[_0x8786('0x66')](_0x8786('0x58'));if(_0x2eea69[_0x426c94]||!_0x17c856[_0x8786('0x67')]){_0x35e614=path[_0x8786('0x62')](config['root'],_0x1c33f6,_[_0x8786('0x64')](_0x8786('0x68')));}if(!fs[_0x8786('0x61')](_0x35e614)){throw new db[(_0x8786('0x69'))][(_0x8786('0x6a'))](_['upperFirst'](_0x8786('0x58'))+'\x20not\x20found');}return _0xab06b9[_0x8786('0x6b')](_0x35e614);}})[_0x8786('0x27')](handleError(_0xab06b9,null));};var utilLicense=require(_0x8786('0x17'));exports[_0x8786('0x6c')]=function(_0x59a9c0,_0x54a9f9,_0x3f3e3f){var _0x2e5724=_0x8786('0x5b');var _0xb8a6f2={'custom':![]};return utilLicense[_0x8786('0x6d')]()[_0x8786('0x1c')](function(_0xccf90b){if(_0xccf90b){_0xb8a6f2=_0xccf90b;}return db['Setting'][_0x8786('0x54')]({'where':{'id':_0x59a9c0[_0x8786('0x50')]['id']},'attributes':[_0x8786('0x58'),_0x8786('0x5a'),_0x8786('0x5c'),_0x8786('0x5d'),'defaultLogo',_0x8786('0x5e'),_0x8786('0x5f'),_0x8786('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x54a9f9,null))[_0x8786('0x1c')](function(_0x2969e8){if(_0x2969e8){var _0x319217=_0x2969e8['loginLogo']&&fs['existsSync'](path[_0x8786('0x62')](config[_0x8786('0x63')],_0x2e5724,_[_0x8786('0x64')](_0x2969e8[_0x8786('0x5a')])))?path[_0x8786('0x62')](config[_0x8786('0x63')],_0x2e5724,_[_0x8786('0x64')](_0x2969e8['loginLogo'])):path[_0x8786('0x62')](config[_0x8786('0x63')],_0x2e5724,_[_0x8786('0x64')](_0x8786('0x6e')));var _0x3504ed=_0x8786('0x65')+_[_0x8786('0x66')](_0x8786('0x5a'));if(_0x2969e8[_0x3504ed]||!_0xb8a6f2[_0x8786('0x67')]){_0x319217=path[_0x8786('0x62')](config[_0x8786('0x63')],_0x2e5724,_[_0x8786('0x64')](_0x8786('0x6e')));}if(!fs['existsSync'](_0x319217)){throw new db[(_0x8786('0x69'))][(_0x8786('0x6a'))](_['upperFirst'](_0x8786('0x5a'))+'\x20not\x20found');}return _0x54a9f9[_0x8786('0x6b')](_0x319217);}})['catch'](handleError(_0x54a9f9,null));};exports[_0x8786('0x6f')]=function(_0x5263f3,_0x4dd3cd){return db['Setting'][_0x8786('0x54')]({'where':{'id':_0x5263f3[_0x8786('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4dd3cd,null))[_0x8786('0x27')](handleError(_0x4dd3cd,null));};exports[_0x8786('0x70')]=function(_0x3a4a13,_0x40115d,_0x55fb94){if(_0x3a4a13['file']&&_0x3a4a13[_0x8786('0x56')][_0x8786('0x57')]){_0x3a4a13[_0x8786('0x53')][_0x8786('0x5c')]=_0x3a4a13['file'][_0x8786('0x57')];}return db[_0x8786('0x39')]['find']({'where':{'id':_0x3a4a13[_0x8786('0x50')]['id']}})['then'](handleEntityNotFound(_0x40115d,null))[_0x8786('0x1c')](saveUpdates(_0x3a4a13['body'],null))[_0x8786('0x1c')](respondWithResult(_0x40115d,null))['catch'](handleError(_0x40115d,null));};var utilLicense=require('../../config/license/util');exports[_0x8786('0x71')]=function(_0xdc78b2,_0x524be5,_0x4beda4){var _0x3e5974=_0x8786('0x5b');var _0x132987={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x21fd80){if(_0x21fd80){_0x132987=_0x21fd80;}return db[_0x8786('0x39')]['find']({'where':{'id':_0xdc78b2[_0x8786('0x50')]['id']},'attributes':['logo',_0x8786('0x5a'),'preferred',_0x8786('0x5d'),_0x8786('0x72'),_0x8786('0x5e'),_0x8786('0x5f'),_0x8786('0x60')],'raw':!![]});})[_0x8786('0x1c')](handleEntityNotFound(_0x524be5,null))[_0x8786('0x1c')](function(_0x126138){if(_0x126138){var _0x20d6a9=_0x126138[_0x8786('0x5c')]&&fs[_0x8786('0x61')](path['join'](config[_0x8786('0x63')],_0x3e5974,_[_0x8786('0x64')](_0x126138[_0x8786('0x5c')])))?path[_0x8786('0x62')](config['root'],_0x3e5974,_['toLower'](_0x126138[_0x8786('0x5c')])):path[_0x8786('0x62')](config[_0x8786('0x63')],_0x3e5974,_[_0x8786('0x64')](_0x8786('0x73')));var _0x418d48=_0x8786('0x65')+_['upperFirst'](_0x8786('0x5c'));if(_0x126138[_0x418d48]||!_0x132987[_0x8786('0x67')]||!_0x132987[_0x8786('0x5c')]){_0x20d6a9=path[_0x8786('0x62')](config[_0x8786('0x63')],_0x3e5974,_[_0x8786('0x64')]('default_preferred.png'));}if(!fs[_0x8786('0x61')](_0x20d6a9)){throw new db[(_0x8786('0x69'))][(_0x8786('0x6a'))](_['upperFirst'](_0x8786('0x5c'))+_0x8786('0x74'));}return _0x524be5['download'](_0x20d6a9);}})[_0x8786('0x27')](handleError(_0x524be5,null));};exports[_0x8786('0x75')]=function(_0x147344,_0x15a661,_0x18a84d){if(_0x147344[_0x8786('0x56')]&&_0x147344[_0x8786('0x56')][_0x8786('0x57')]){_0x147344['body'][_0x8786('0x5d')]=_0x147344['file'][_0x8786('0x57')];}return db['Setting'][_0x8786('0x54')]({'where':{'id':_0x147344[_0x8786('0x50')]['id']}})['then'](handleEntityNotFound(_0x15a661,null))[_0x8786('0x1c')](saveUpdates(_0x147344[_0x8786('0x53')],null))['then'](respondWithResult(_0x15a661,null))['catch'](handleError(_0x15a661,null));};var utilLicense=require(_0x8786('0x17'));exports[_0x8786('0x76')]=function(_0x329cfc,_0x35df6e,_0x440ef8){var _0x212a56=_0x8786('0x5b');var _0x2064c1={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x21c2ec){if(_0x21c2ec){_0x2064c1=_0x21c2ec;}return db[_0x8786('0x39')][_0x8786('0x54')]({'where':{'id':_0x329cfc[_0x8786('0x50')]['id']},'attributes':[_0x8786('0x58'),_0x8786('0x5a'),_0x8786('0x5c'),_0x8786('0x5d'),_0x8786('0x72'),_0x8786('0x5e'),_0x8786('0x5f'),_0x8786('0x60')],'raw':!![]});})[_0x8786('0x1c')](handleEntityNotFound(_0x35df6e,null))[_0x8786('0x1c')](function(_0x34d25e){if(_0x34d25e){var _0x447867=_0x34d25e['favicon']&&fs['existsSync'](path[_0x8786('0x62')](config['root'],_0x212a56,_['toLower'](_0x34d25e[_0x8786('0x5d')])))?path[_0x8786('0x62')](config[_0x8786('0x63')],_0x212a56,_[_0x8786('0x64')](_0x34d25e[_0x8786('0x5d')])):path[_0x8786('0x62')](config['root'],_0x212a56,_[_0x8786('0x64')]('default_favicon.ico'));var _0x2e4fb5=_0x8786('0x65')+_[_0x8786('0x66')](_0x8786('0x5d'));if(_0x34d25e[_0x2e4fb5]||!_0x2064c1[_0x8786('0x67')]){_0x447867=path[_0x8786('0x62')](config[_0x8786('0x63')],_0x212a56,_['toLower'](_0x8786('0x77')));}if(!fs[_0x8786('0x61')](_0x447867)){throw new db[(_0x8786('0x69'))]['ValidationError'](_[_0x8786('0x66')](_0x8786('0x5d'))+_0x8786('0x74'));}return _0x35df6e['download'](_0x447867);}})[_0x8786('0x27')](handleError(_0x35df6e,null));};exports[_0x8786('0x78')]=function(_0x42e203,_0x375f6f){var _0x5eefbf={'offset':moment()[_0x8786('0x79')]()};_0x5eefbf['now']=moment()['utcOffset'](_0x5eefbf['offset'])['format'](_0x8786('0x7a'));return _0x375f6f[_0x8786('0x29')](0xc8)[_0x8786('0x36')](_0x5eefbf);}; \ No newline at end of file +var _0x397b=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','http','request','info','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Setting','findAll','show','params','keys','body','find','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default_logo.svg','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultLogo','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x2ecce1,_0x5b7ec9){var _0x3677eb=function(_0x45a6d8){while(--_0x45a6d8){_0x2ecce1['push'](_0x2ecce1['shift']());}};_0x3677eb(++_0x5b7ec9);}(_0x397b,0x168));var _0xb397=function(_0x3364e4,_0x3737fe){_0x3364e4=_0x3364e4-0x0;var _0x3f6057=_0x397b[_0x3364e4];return _0x3f6057;};'use strict';var emlformat=require(_0xb397('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb397('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb397('0x2'));var Mustache=require(_0xb397('0x3'));var util=require(_0xb397('0x4'));var path=require(_0xb397('0x5'));var sox=require('sox');var csv=require(_0xb397('0x6'));var ejs=require(_0xb397('0x7'));var fs=require('fs');var fs_extra=require(_0xb397('0x8'));var _=require('lodash');var squel=require(_0xb397('0x9'));var crypto=require(_0xb397('0xa'));var jsforce=require(_0xb397('0xb'));var deskjs=require(_0xb397('0xc'));var toCsv=require(_0xb397('0x6'));var querystring=require(_0xb397('0xd'));var Papa=require(_0xb397('0xe'));var Redis=require(_0xb397('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb397('0x10'));var as=require(_0xb397('0x11'));var hardwareService=require(_0xb397('0x12'));var logger=require('../../config/logger')(_0xb397('0x13'));var utils=require('../../config/utils');var config=require(_0xb397('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb397('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb397('0x16')][_0xb397('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1a4eae,_0x2a6f09,_0x3a68db,_0x208d9d){return new BPromise(function(_0x777111,_0x194cd6){var _0xd33555=_0x208d9d||client;return _0xd33555[_0xb397('0x18')](_0x1a4eae,_0x3a68db)['then'](function(_0x5dbfe0){logger[_0xb397('0x19')]('Setting,\x20%s,\x20%s',_0x2a6f09,_0xb397('0x1a'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2a6f09,_0xb397('0x1a'),JSON[_0xb397('0x1b')](_0x5dbfe0));if(_0x5dbfe0[_0xb397('0x1c')]){if(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1d')]===0x1f4){logger[_0xb397('0x1c')]('Setting,\x20%s,\x20%s',_0x2a6f09,_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);return _0x194cd6(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);}logger['error'](_0xb397('0x1f'),_0x2a6f09,_0x5dbfe0[_0xb397('0x1c')]['message']);return _0x777111(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);}else{logger[_0xb397('0x19')](_0xb397('0x1f'),_0x2a6f09,_0xb397('0x1a'));_0x777111(_0x5dbfe0[_0xb397('0x20')]['message']);}})[_0xb397('0x21')](function(_0x3fa61b){logger['error'](_0xb397('0x1f'),_0x2a6f09,_0x3fa61b);_0x194cd6(_0x3fa61b);});});}function respondWithStatusCode(_0x2c24cd,_0x35f18f){_0x35f18f=_0x35f18f||0xcc;return function(_0x39ea24){if(_0x39ea24){return _0x2c24cd[_0xb397('0x22')](_0x35f18f);}return _0x2c24cd[_0xb397('0x23')](_0x35f18f)[_0xb397('0x24')]();};}function respondWithResult(_0x4a8427,_0x2ebc95){_0x2ebc95=_0x2ebc95||0xc8;return function(_0x5ce82d){if(_0x5ce82d){return _0x4a8427['status'](_0x2ebc95)[_0xb397('0x25')](_0x5ce82d);}};}function respondWithFilteredResult(_0x45675c,_0x4e7d77){return function(_0x163c3b){if(_0x163c3b){var _0x11735d=typeof _0x4e7d77['offset']===_0xb397('0x26')&&typeof _0x4e7d77['limit']===_0xb397('0x26');var _0x5c9029=_0x163c3b['count'];var _0x2c4f35=_0x11735d?0x0:_0x4e7d77['offset'];var _0x176f7d=_0x11735d?_0x163c3b[_0xb397('0x27')]:_0x4e7d77[_0xb397('0x28')]+_0x4e7d77[_0xb397('0x29')];var _0x5f00dc;if(_0x176f7d>=_0x5c9029){_0x176f7d=_0x5c9029;_0x5f00dc=0xc8;}else{_0x5f00dc=0xce;}_0x45675c['status'](_0x5f00dc);return _0x45675c[_0xb397('0x2a')](_0xb397('0x2b'),_0x2c4f35+'-'+_0x176f7d+'/'+_0x5c9029)[_0xb397('0x25')](_0x163c3b);}return null;};}function patchUpdates(_0xf8ab15){return function(_0x234bf0){try{jsonpatch[_0xb397('0x2c')](_0x234bf0,_0xf8ab15,!![]);}catch(_0x4cd2da){return BPromise[_0xb397('0x2d')](_0x4cd2da);}return _0x234bf0['save']();};}function saveUpdates(_0x3f3fc3,_0x2d4313){return function(_0x5adda6){if(_0x5adda6){return _0x5adda6[_0xb397('0x2e')](_0x3f3fc3)[_0xb397('0x2f')](function(_0x3affbc){return _0x3affbc;});}return null;};}function removeEntity(_0x4ddacf,_0x3bea4f){return function(_0x43d494){if(_0x43d494){return _0x43d494[_0xb397('0x30')]()['then'](function(){_0x4ddacf[_0xb397('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f78de,_0x5d24ed){return function(_0x4e8940){if(!_0x4e8940){_0x2f78de['sendStatus'](0x194);}return _0x4e8940;};}function handleError(_0x489186,_0x45f1a8){_0x45f1a8=_0x45f1a8||0x1f4;return function(_0x10081f){logger[_0xb397('0x1c')](_0x10081f[_0xb397('0x31')]);if(_0x10081f['name']){delete _0x10081f[_0xb397('0x32')];}_0x489186[_0xb397('0x23')](_0x45f1a8)[_0xb397('0x33')](_0x10081f);};}exports[_0xb397('0x34')]=function(_0x46c2c1,_0x11285c){var _0x4d66ba={},_0x3a9199={},_0x594cad={'count':0x0,'rows':[]};var _0x1b8a8a=_[_0xb397('0x35')](db['Setting'][_0xb397('0x36')],function(_0x5d3feb){return{'name':_0x5d3feb['fieldName'],'type':_0x5d3feb['type'][_0xb397('0x37')]};});_0x3a9199[_0xb397('0x38')]=_['map'](_0x1b8a8a,_0xb397('0x32'));_0x3a9199[_0xb397('0x39')]=_['keys'](_0x46c2c1['query']);_0x3a9199['filters']=_[_0xb397('0x3a')](_0x3a9199['model'],_0x3a9199['query']);_0x4d66ba[_0xb397('0x3b')]=_['intersection'](_0x3a9199[_0xb397('0x38')],qs['fields'](_0x46c2c1[_0xb397('0x39')][_0xb397('0x3c')]));_0x4d66ba[_0xb397('0x3b')]=_0x4d66ba[_0xb397('0x3b')][_0xb397('0x3d')]?_0x4d66ba['attributes']:_0x3a9199[_0xb397('0x38')];if(!_0x46c2c1[_0xb397('0x39')][_0xb397('0x3e')](_0xb397('0x3f'))){_0x4d66ba['limit']=qs['limit'](_0x46c2c1['query'][_0xb397('0x29')]);_0x4d66ba[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x46c2c1[_0xb397('0x39')][_0xb397('0x28')]);}_0x4d66ba[_0xb397('0x40')]=qs[_0xb397('0x41')](_0x46c2c1['query'][_0xb397('0x41')]);_0x4d66ba[_0xb397('0x42')]=qs[_0xb397('0x43')](_[_0xb397('0x44')](_0x46c2c1[_0xb397('0x39')],_0x3a9199[_0xb397('0x43')]),_0x1b8a8a);if(_0x46c2c1[_0xb397('0x39')][_0xb397('0x45')]){_0x4d66ba[_0xb397('0x42')]=_[_0xb397('0x46')](_0x4d66ba[_0xb397('0x42')],{'$or':_[_0xb397('0x35')](_0x1b8a8a,function(_0x91cf01){if(_0x91cf01[_0xb397('0x47')]!==_0xb397('0x48')){var _0x49d5d9={};_0x49d5d9[_0x91cf01['name']]={'$like':'%'+_0x46c2c1[_0xb397('0x39')][_0xb397('0x45')]+'%'};return _0x49d5d9;}})});}_0x4d66ba=_['merge']({},_0x4d66ba,_0x46c2c1[_0xb397('0x49')]);var _0x1adcf4={'where':_0x4d66ba[_0xb397('0x42')]};return db['Setting'][_0xb397('0x27')](_0x1adcf4)['then'](function(_0x14c400){_0x594cad[_0xb397('0x27')]=_0x14c400;if(_0x46c2c1[_0xb397('0x39')][_0xb397('0x4a')]){_0x4d66ba[_0xb397('0x4b')]=[{'all':!![]}];}return db[_0xb397('0x4c')][_0xb397('0x4d')](_0x4d66ba);})['then'](function(_0x530e8c){_0x594cad['rows']=_0x530e8c;return _0x594cad;})[_0xb397('0x2f')](respondWithFilteredResult(_0x11285c,_0x4d66ba))[_0xb397('0x21')](handleError(_0x11285c,null));};exports[_0xb397('0x4e')]=function(_0x339dec,_0x4316ea){var _0x1985c8={'raw':![],'where':{'id':_0x339dec[_0xb397('0x4f')]['id']}},_0xbc262={};_0xbc262[_0xb397('0x38')]=_['keys'](db[_0xb397('0x4c')][_0xb397('0x36')]);_0xbc262[_0xb397('0x39')]=_[_0xb397('0x50')](_0x339dec[_0xb397('0x39')]);_0xbc262[_0xb397('0x43')]=_[_0xb397('0x3a')](_0xbc262[_0xb397('0x38')],_0xbc262[_0xb397('0x39')]);_0x1985c8[_0xb397('0x3b')]=_[_0xb397('0x3a')](_0xbc262['model'],qs[_0xb397('0x3c')](_0x339dec[_0xb397('0x39')][_0xb397('0x3c')]));_0x1985c8[_0xb397('0x3b')]=_0x1985c8[_0xb397('0x3b')][_0xb397('0x3d')]?_0x1985c8[_0xb397('0x3b')]:_0xbc262[_0xb397('0x38')];if(_0x339dec[_0xb397('0x39')][_0xb397('0x4a')]){_0x1985c8[_0xb397('0x4b')]=[{'all':!![]}];}_0x1985c8=_[_0xb397('0x46')]({},_0x1985c8,_0x339dec[_0xb397('0x49')]);return db[_0xb397('0x4c')]['find'](_0x1985c8)[_0xb397('0x2f')](handleEntityNotFound(_0x4316ea,null))['then'](respondWithResult(_0x4316ea,null))[_0xb397('0x21')](handleError(_0x4316ea,null));};exports[_0xb397('0x2e')]=function(_0x2a7957,_0x2b89ee){if(_0x2a7957[_0xb397('0x51')]['id']){delete _0x2a7957['body']['id'];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x2a7957[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x2b89ee,null))['then'](saveUpdates(_0x2a7957['body'],null))[_0xb397('0x2f')](respondWithResult(_0x2b89ee,null))[_0xb397('0x21')](handleError(_0x2b89ee,null));};exports[_0xb397('0x53')]=function(_0x1d69f9,_0x36104a,_0x2ba41b){if(_0x1d69f9[_0xb397('0x54')]&&_0x1d69f9[_0xb397('0x54')][_0xb397('0x55')]){_0x1d69f9[_0xb397('0x51')]['logo']=_0x1d69f9['file']['filename'];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x1d69f9[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x36104a,null))[_0xb397('0x2f')](saveUpdates(_0x1d69f9[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x36104a,null))[_0xb397('0x21')](handleError(_0x36104a,null));};exports['addLogoLogin']=function(_0x1b3af8,_0x4cc78c,_0xcdd38){if(_0x1b3af8[_0xb397('0x54')]&&_0x1b3af8[_0xb397('0x54')][_0xb397('0x55')]){_0x1b3af8[_0xb397('0x51')][_0xb397('0x56')]=_0x1b3af8[_0xb397('0x54')][_0xb397('0x55')];}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x1b3af8[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x4cc78c,null))['then'](saveUpdates(_0x1b3af8[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x4cc78c,null))['catch'](handleError(_0x4cc78c,null));};var utilLicense=require(_0xb397('0x57'));exports[_0xb397('0x58')]=function(_0x744ed5,_0x2f1aed,_0x42c636){var _0x4a3e81='server/files/images/logos';var _0x389307={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x91f1af){if(_0x91f1af){_0x389307=_0x91f1af;}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x744ed5['params']['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),_0xb397('0x5b'),_0xb397('0x5c'),'defaultLogo',_0xb397('0x5d'),_0xb397('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x2f1aed,null))[_0xb397('0x2f')](function(_0x27b01d){if(_0x27b01d){var _0x14d2aa=_0x27b01d[_0xb397('0x5a')]&&fs[_0xb397('0x5f')](path['join'](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0x27b01d['logo'])))?path['join'](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0x27b01d['logo'])):path[_0xb397('0x62')](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0xb397('0x63')));var _0x3ff864='default'+_[_0xb397('0x64')](_0xb397('0x5a'));if(_0x27b01d[_0x3ff864]||!_0x389307['custom']){_0x14d2aa=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0xb397('0x63')));}if(!fs[_0xb397('0x5f')](_0x14d2aa)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x5a'))+_0xb397('0x67'));}return _0x2f1aed[_0xb397('0x68')](_0x14d2aa);}})[_0xb397('0x21')](handleError(_0x2f1aed,null));};var utilLicense=require('../../config/license/util');exports[_0xb397('0x69')]=function(_0x67e021,_0x126bb1,_0x9b3fe){var _0x3692aa=_0xb397('0x6a');var _0x301a57={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0xa59f7e){if(_0xa59f7e){_0x301a57=_0xa59f7e;}return db[_0xb397('0x4c')]['find']({'where':{'id':_0x67e021[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),'loginLogo','preferred',_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),'defaultPreferred',_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x126bb1,null))[_0xb397('0x2f')](function(_0x6d3468){if(_0x6d3468){var _0x1d0fde=_0x6d3468[_0xb397('0x56')]&&fs['existsSync'](path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_['toLower'](_0x6d3468[_0xb397('0x56')])))?path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0x6d3468['loginLogo'])):path['join'](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0xb397('0x6d')));var _0x4b4328='default'+_[_0xb397('0x64')]('loginLogo');if(_0x6d3468[_0x4b4328]||!_0x301a57[_0xb397('0x6e')]){_0x1d0fde=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0xb397('0x6d')));}if(!fs['existsSync'](_0x1d0fde)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x56'))+_0xb397('0x67'));}return _0x126bb1[_0xb397('0x68')](_0x1d0fde);}})['catch'](handleError(_0x126bb1,null));};exports[_0xb397('0x6f')]=function(_0x4188d8,_0x2e273b){return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x4188d8['params']['id']},'attributes':[_0xb397('0x70')]})[_0xb397('0x2f')](respondWithResult(_0x2e273b,null))[_0xb397('0x21')](handleError(_0x2e273b,null));};exports[_0xb397('0x71')]=function(_0x344b83,_0x49fa1a,_0x28665b){if(_0x344b83[_0xb397('0x54')]&&_0x344b83[_0xb397('0x54')]['filename']){_0x344b83[_0xb397('0x51')][_0xb397('0x5b')]=_0x344b83[_0xb397('0x54')][_0xb397('0x55')];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x344b83[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x49fa1a,null))[_0xb397('0x2f')](saveUpdates(_0x344b83['body'],null))[_0xb397('0x2f')](respondWithResult(_0x49fa1a,null))[_0xb397('0x21')](handleError(_0x49fa1a,null));};var utilLicense=require('../../config/license/util');exports[_0xb397('0x72')]=function(_0x4ee7f5,_0x4ccaa3,_0x21acdd){var _0x583142=_0xb397('0x6a');var _0x769395={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x4423cd){if(_0x4423cd){_0x769395=_0x4423cd;}return db[_0xb397('0x4c')]['find']({'where':{'id':_0x4ee7f5[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),_0xb397('0x5b'),_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),'defaultPreferred',_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x4ccaa3,null))['then'](function(_0x202c28){if(_0x202c28){var _0xf9a3f9=_0x202c28[_0xb397('0x5b')]&&fs[_0xb397('0x5f')](path[_0xb397('0x62')](config['root'],_0x583142,_['toLower'](_0x202c28['preferred'])))?path[_0xb397('0x62')](config[_0xb397('0x60')],_0x583142,_[_0xb397('0x61')](_0x202c28['preferred'])):path[_0xb397('0x62')](config['root'],_0x583142,_[_0xb397('0x61')]('default_preferred.png'));var _0x2ad5f9=_0xb397('0x73')+_[_0xb397('0x64')](_0xb397('0x5b'));if(_0x202c28[_0x2ad5f9]||!_0x769395['custom']||!_0x769395[_0xb397('0x5b')]){_0xf9a3f9=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x583142,_[_0xb397('0x61')](_0xb397('0x74')));}if(!fs['existsSync'](_0xf9a3f9)){throw new db['Sequelize'][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x5b'))+_0xb397('0x67'));}return _0x4ccaa3[_0xb397('0x68')](_0xf9a3f9);}})[_0xb397('0x21')](handleError(_0x4ccaa3,null));};exports[_0xb397('0x75')]=function(_0x54e9b8,_0x5e2e9a,_0x2bbddf){if(_0x54e9b8['file']&&_0x54e9b8[_0xb397('0x54')][_0xb397('0x55')]){_0x54e9b8[_0xb397('0x51')]['favicon']=_0x54e9b8[_0xb397('0x54')][_0xb397('0x55')];}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x54e9b8[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x5e2e9a,null))[_0xb397('0x2f')](saveUpdates(_0x54e9b8[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x5e2e9a,null))[_0xb397('0x21')](handleError(_0x5e2e9a,null));};var utilLicense=require(_0xb397('0x57'));exports[_0xb397('0x76')]=function(_0x3a2ebb,_0x288aac,_0x4de951){var _0xfed19f='server/files/images/logos';var _0x58e301={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x2c52b7){if(_0x2c52b7){_0x58e301=_0x2c52b7;}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x3a2ebb[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),'preferred',_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),_0xb397('0x5e'),_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x288aac,null))[_0xb397('0x2f')](function(_0x247d01){if(_0x247d01){var _0x3c73e7=_0x247d01[_0xb397('0x5c')]&&fs[_0xb397('0x5f')](path[_0xb397('0x62')](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0x247d01[_0xb397('0x5c')])))?path['join'](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0x247d01['favicon'])):path[_0xb397('0x62')](config[_0xb397('0x60')],_0xfed19f,_['toLower']('default_favicon.ico'));var _0x26ef95=_0xb397('0x73')+_['upperFirst'](_0xb397('0x5c'));if(_0x247d01[_0x26ef95]||!_0x58e301[_0xb397('0x6e')]){_0x3c73e7=path['join'](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0xb397('0x77')));}if(!fs[_0xb397('0x5f')](_0x3c73e7)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_['upperFirst'](_0xb397('0x5c'))+_0xb397('0x67'));}return _0x288aac['download'](_0x3c73e7);}})[_0xb397('0x21')](handleError(_0x288aac,null));};exports['getDate']=function(_0x215bd1,_0x4f4d26){var _0x1bd7d1={'offset':moment()[_0xb397('0x78')]()};_0x1bd7d1[_0xb397('0x79')]=moment()['utcOffset'](_0x1bd7d1[_0xb397('0x28')])[_0xb397('0x7a')](_0xb397('0x7b'));return _0x4f4d26[_0xb397('0x23')](0xc8)[_0xb397('0x33')](_0x1bd7d1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 41f4e94..ff909f7 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x3e74,0x175));var _0x43e7=function(_0x12bf31,_0x26c596){_0x12bf31=_0x12bf31-0x0;var _0x59762e=_0x3e74[_0x12bf31];return _0x59762e;};'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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x4143ee,_0x10af5a){var _0x527c77=function(_0xd60ed9){while(--_0xd60ed9){_0x4143ee['push'](_0x4143ee['shift']());}};_0x527c77(++_0x10af5a);}(_0xe14b,0x93));var _0xbe14=function(_0x2913be,_0x3771dc){_0x2913be=_0x2913be-0x0;var _0x1ac74c=_0xe14b[_0x2913be];return _0x1ac74c;};'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 f008f73..5c68320 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 _0x5e95=['info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','options','raw','attributes','map','model','include','then','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x283cf6,_0x14e096){var _0x4b40e5=function(_0xd340e5){while(--_0xd340e5){_0x283cf6['push'](_0x283cf6['shift']());}};_0x4b40e5(++_0x14e096);}(_0x5e95,0xa5));var _0x55e9=function(_0x253b24,_0x194a58){_0x253b24=_0x253b24-0x0;var _0x1c6bfa=_0x5e95[_0x253b24];return _0x1c6bfa;};'use strict';var _=require(_0x55e9('0x0'));var util=require(_0x55e9('0x1'));var moment=require('moment');var BPromise=require(_0x55e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55e9('0x3'));var db=require(_0x55e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55e9('0x5'))(_0x55e9('0x6'));var config=require(_0x55e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x55e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e4275,_0x10fb57,_0x1db941){return new BPromise(function(_0x49f2d6,_0x18b766){return client['request'](_0x4e4275,_0x1db941)['then'](function(_0x5dcd04){logger[_0x55e9('0x9')]('Setting,\x20%s,\x20%s',_0x10fb57,_0x55e9('0xa'));logger['debug'](_0x55e9('0xb'),_0x10fb57,'request\x20sent',JSON[_0x55e9('0xc')](_0x5dcd04));if(_0x5dcd04['error']){if(_0x5dcd04[_0x55e9('0xd')][_0x55e9('0xe')]===0x1f4){logger[_0x55e9('0xd')](_0x55e9('0xf'),_0x10fb57,_0x5dcd04['error']['message']);return _0x18b766(_0x5dcd04['error'][_0x55e9('0x10')]);}logger['error']('Setting,\x20%s,\x20%s',_0x10fb57,_0x5dcd04[_0x55e9('0xd')][_0x55e9('0x10')]);return _0x49f2d6(_0x5dcd04['error'][_0x55e9('0x10')]);}else{logger[_0x55e9('0x9')](_0x55e9('0xf'),_0x10fb57,_0x55e9('0xa'));_0x49f2d6(_0x5dcd04[_0x55e9('0x11')][_0x55e9('0x10')]);}})[_0x55e9('0x12')](function(_0x56733c){logger[_0x55e9('0xd')](_0x55e9('0xf'),_0x10fb57,_0x56733c);_0x18b766(_0x56733c);});});}exports[_0x55e9('0x13')]=function(_0x4502d7){var _0x3b281c=this;return new Promise(function(_0x3b8f59,_0x57eb29){return db[_0x55e9('0x14')]['find']({'raw':_0x4502d7[_0x55e9('0x15')]?_0x4502d7['options'][_0x55e9('0x16')]===undefined?!![]:![]:!![],'where':_0x4502d7[_0x55e9('0x15')]?_0x4502d7[_0x55e9('0x15')]['where']||null:null,'attributes':_0x4502d7['options']?_0x4502d7['options'][_0x55e9('0x17')]||null:null,'include':_0x4502d7[_0x55e9('0x15')]?_0x4502d7[_0x55e9('0x15')]['include']?_[_0x55e9('0x18')](_0x4502d7[_0x55e9('0x15')]['include'],function(_0x4d86d9){return{'model':db[_0x4d86d9[_0x55e9('0x19')]],'as':_0x4d86d9['as'],'attributes':_0x4d86d9[_0x55e9('0x17')],'include':_0x4d86d9[_0x55e9('0x1a')]?_['map'](_0x4d86d9['include'],function(_0x1a29d4){return{'model':db[_0x1a29d4[_0x55e9('0x19')]],'as':_0x1a29d4['as'],'attributes':_0x1a29d4[_0x55e9('0x17')],'include':_0x1a29d4['include']?_[_0x55e9('0x18')](_0x1a29d4[_0x55e9('0x1a')],function(_0x4980c5){return{'model':db[_0x4980c5[_0x55e9('0x19')]],'as':_0x4980c5['as'],'attributes':_0x4980c5[_0x55e9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x55e9('0x1b')](function(_0x23e7b3){logger[_0x55e9('0x9')](_0x55e9('0x13'),_0x4502d7);logger[_0x55e9('0x1c')](_0x55e9('0x13'),_0x4502d7,JSON[_0x55e9('0xc')](_0x23e7b3));_0x3b8f59(_0x23e7b3);})[_0x55e9('0x12')](function(_0x19cd63){logger[_0x55e9('0xd')]('ShowSetting',_0x19cd63['message'],_0x4502d7);_0x57eb29(_0x3b281c['error'](0x1f4,_0x19cd63[_0x55e9('0x10')]));});});}; \ No newline at end of file +var _0xdbd5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','where','attributes','map','include','model','lodash','moment'];(function(_0x5631a8,_0x2ff3ab){var _0x1a4293=function(_0x28f304){while(--_0x28f304){_0x5631a8['push'](_0x5631a8['shift']());}};_0x1a4293(++_0x2ff3ab);}(_0xdbd5,0xb2));var _0x5dbd=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xdbd5[_0xb725be];return _0x2f2424;};'use strict';var _=require(_0x5dbd('0x0'));var util=require('util');var moment=require(_0x5dbd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dbd('0x2'));var db=require(_0x5dbd('0x3'))['db'];var utils=require(_0x5dbd('0x4'));var logger=require(_0x5dbd('0x5'))(_0x5dbd('0x6'));var config=require(_0x5dbd('0x7'));var jayson=require(_0x5dbd('0x8'));var client=jayson['client'][_0x5dbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b7e7e,_0x2bbf58,_0x210053){return new BPromise(function(_0xe7073e,_0x44c14c){return client[_0x5dbd('0xa')](_0x5b7e7e,_0x210053)[_0x5dbd('0xb')](function(_0x44c8d7){logger[_0x5dbd('0xc')](_0x5dbd('0xd'),_0x2bbf58,_0x5dbd('0xe'));logger['debug'](_0x5dbd('0xf'),_0x2bbf58,'request\x20sent',JSON[_0x5dbd('0x10')](_0x44c8d7));if(_0x44c8d7[_0x5dbd('0x11')]){if(_0x44c8d7['error']['code']===0x1f4){logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x44c8d7['error'][_0x5dbd('0x12')]);return _0x44c14c(_0x44c8d7['error']['message']);}logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x44c8d7['error'][_0x5dbd('0x12')]);return _0xe7073e(_0x44c8d7[_0x5dbd('0x11')]['message']);}else{logger[_0x5dbd('0xc')](_0x5dbd('0xd'),_0x2bbf58,_0x5dbd('0xe'));_0xe7073e(_0x44c8d7[_0x5dbd('0x13')][_0x5dbd('0x12')]);}})[_0x5dbd('0x14')](function(_0x576501){logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x576501);_0x44c14c(_0x576501);});});}exports[_0x5dbd('0x15')]=function(_0x4e66e7){var _0x41df4d=this;return new Promise(function(_0x2a2573,_0xc26627){return db[_0x5dbd('0x16')][_0x5dbd('0x17')]({'raw':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x19')]||null:null,'attributes':_0x4e66e7['options']?_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x1a')]||null:null,'include':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')]['include']?_[_0x5dbd('0x1b')](_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x1c')],function(_0x2d89e1){return{'model':db[_0x2d89e1[_0x5dbd('0x1d')]],'as':_0x2d89e1['as'],'attributes':_0x2d89e1[_0x5dbd('0x1a')],'include':_0x2d89e1[_0x5dbd('0x1c')]?_[_0x5dbd('0x1b')](_0x2d89e1[_0x5dbd('0x1c')],function(_0x4751cd){return{'model':db[_0x4751cd[_0x5dbd('0x1d')]],'as':_0x4751cd['as'],'attributes':_0x4751cd['attributes'],'include':_0x4751cd[_0x5dbd('0x1c')]?_[_0x5dbd('0x1b')](_0x4751cd['include'],function(_0x1872f6){return{'model':db[_0x1872f6[_0x5dbd('0x1d')]],'as':_0x1872f6['as'],'attributes':_0x1872f6[_0x5dbd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5dbd('0xb')](function(_0x4addf8){logger[_0x5dbd('0xc')](_0x5dbd('0x15'),_0x4e66e7);logger['debug'](_0x5dbd('0x15'),_0x4e66e7,JSON['stringify'](_0x4addf8));_0x2a2573(_0x4addf8);})['catch'](function(_0x255ed6){logger['error'](_0x5dbd('0x15'),_0x255ed6['message'],_0x4e66e7);_0xc26627(_0x41df4d['error'](0x1f4,_0x255ed6[_0x5dbd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b42f642..3910bd1 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x336764,_0x26651d){var _0x17cc85=function(_0x50549e){while(--_0x50549e){_0x336764['push'](_0x336764['shift']());}};_0x17cc85(++_0x26651d);}(_0xabce,0x103));var _0xeabc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabce[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a23c77b..787a004 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 _0x7bdc=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','twilio','skebby','connectel','plivo','clickatell','bandwidth','infobip','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x546125,_0xfa3bf){var _0x77b546=function(_0x475555){while(--_0x475555){_0x546125['push'](_0x546125['shift']());}};_0x77b546(++_0xfa3bf);}(_0x7bdc,0x1bb));var _0xc7bd=function(_0x42474a,_0x5a94cd){_0x42474a=_0x42474a-0x0;var _0x4f547d=_0x7bdc[_0x42474a];return _0x4f547d;};'use strict';var Sequelize=require(_0xc7bd('0x0'));var rs=require('randomstring');module[_0xc7bd('0x1')]={'name':{'type':Sequelize[_0xc7bd('0x2')],'unique':_0xc7bd('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc7bd('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc7bd('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc7bd('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc7bd('0x2')]},'type':{'type':Sequelize['ENUM'](_0xc7bd('0x4'),_0xc7bd('0x5'),_0xc7bd('0x6'),'clicksend',_0xc7bd('0x7'),_0xc7bd('0x8'),_0xc7bd('0x9'),'csc',_0xc7bd('0xa'),_0xc7bd('0xb'))},'accountSid':{'type':Sequelize[_0xc7bd('0x2')]},'authId':{'type':Sequelize[_0xc7bd('0x2')]},'authToken':{'type':Sequelize[_0xc7bd('0x2')]},'smsMethod':{'type':Sequelize[_0xc7bd('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc7bd('0x2')]},'password':{'type':Sequelize[_0xc7bd('0x2')]},'apiKey':{'type':Sequelize[_0xc7bd('0x2')]},'applicationId':{'type':Sequelize[_0xc7bd('0x2')]},'accountId':{'type':Sequelize[_0xc7bd('0x2')]},'senderString':{'type':Sequelize[_0xc7bd('0x2')]},'deliveryReport':{'type':Sequelize[_0xc7bd('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc7bd('0xe')],'defaultValue':function(){return _0xc7bd('0xf');}},'notificationSound':{'type':Sequelize[_0xc7bd('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc7bd('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc7bd('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc7bd('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc7bd('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc7bd('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc7bd('0x10')],'comment':_0xc7bd('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x486cbe){if(!_0x486cbe)this[_0xc7bd('0x12')](_0xc7bd('0x13'),null);this['setDataValue'](_0xc7bd('0x14'),_0x486cbe);}}}; \ No newline at end of file +var _0x8eb7=['skebby','connectel','clicksend','plivo','infobip','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x8eb7,0xa4));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));var rs=require(_0x78eb('0x1'));module[_0x78eb('0x2')]={'name':{'type':Sequelize[_0x78eb('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x78eb('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x78eb('0x3')],'defaultValue':function(){return rs[_0x78eb('0x4')]();}},'phone':{'type':Sequelize[_0x78eb('0x3')]},'type':{'type':Sequelize[_0x78eb('0x5')]('twilio',_0x78eb('0x6'),_0x78eb('0x7'),_0x78eb('0x8'),_0x78eb('0x9'),'clickatell','bandwidth','csc',_0x78eb('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x78eb('0x3')]},'authId':{'type':Sequelize[_0x78eb('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x78eb('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x78eb('0x3')]},'password':{'type':Sequelize[_0x78eb('0x3')]},'apiKey':{'type':Sequelize[_0x78eb('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x78eb('0x3')]},'senderString':{'type':Sequelize[_0x78eb('0x3')]},'deliveryReport':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x78eb('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78eb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x78eb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x78eb('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x78eb('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![],'comment':_0x78eb('0xd'),'set':function(_0x4f2f4a){if(!_0x4f2f4a)this[_0x78eb('0xe')](_0x78eb('0xf'),null);this[_0x78eb('0xe')](_0x78eb('0x10'),_0x4f2f4a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 810c949..6dbcb02 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 _0x827c=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','SmsAccounts','end','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','params','Pause','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','filter','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','From','Body','MessageSid','skebby','sender','text','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','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','list','omit','contact','SmsInteraction','interaction','close','*,*,*,*','created','SmsMessage','UserId','User','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','DESC','List','get','out','Messages','spread','dataValues','push','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x827c,0xe1));var _0xc827=function(_0x449ec7,_0x271a0e){_0x449ec7=_0x449ec7-0x0;var _0x1dfbab=_0x827c[_0x449ec7];return _0x1dfbab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc827('0x0'));var jsonpatch=require(_0xc827('0x1'));var rp=require(_0xc827('0x2'));var moment=require(_0xc827('0x3'));var BPromise=require(_0xc827('0x4'));var Mustache=require(_0xc827('0x5'));var util=require(_0xc827('0x6'));var path=require(_0xc827('0x7'));var sox=require(_0xc827('0x8'));var csv=require(_0xc827('0x9'));var ejs=require(_0xc827('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc827('0xb'));var squel=require('squel');var crypto=require(_0xc827('0xc'));var jsforce=require(_0xc827('0xd'));var deskjs=require(_0xc827('0xe'));var toCsv=require(_0xc827('0x9'));var querystring=require(_0xc827('0xf'));var Papa=require(_0xc827('0x10'));var Redis=require('ioredis');var authService=require(_0xc827('0x11'));var qs=require(_0xc827('0x12'));var as=require(_0xc827('0x13'));var hardwareService=require(_0xc827('0x14'));var logger=require('../../config/logger')(_0xc827('0x15'));var utils=require(_0xc827('0x16'));var config=require(_0xc827('0x17'));var licenseUtil=require(_0xc827('0x18'));var db=require(_0xc827('0x19'))['db'];config[_0xc827('0x1a')]=_[_0xc827('0x1b')](config[_0xc827('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc827('0x1c'))(new Redis(config[_0xc827('0x1a')]));require(_0xc827('0x1d'))['register'](socket);var jayson=require(_0xc827('0x1e'));var client=jayson[_0xc827('0x1f')][_0xc827('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2f049d,_0x4d9a1c,_0x1707b3,_0x25ab0d){return new BPromise(function(_0x4fb03b,_0x5afa62){var _0xb2e39b=_0x25ab0d||client;return _0xb2e39b[_0xc827('0x21')](_0x2f049d,_0x1707b3)[_0xc827('0x22')](function(_0xb84939){logger['info'](_0xc827('0x23'),_0x4d9a1c,_0xc827('0x24'));logger['debug'](_0xc827('0x25'),_0x4d9a1c,_0xc827('0x24'),JSON['stringify'](_0xb84939));if(_0xb84939[_0xc827('0x26')]){if(_0xb84939[_0xc827('0x26')][_0xc827('0x27')]===0x1f4){logger[_0xc827('0x26')](_0xc827('0x23'),_0x4d9a1c,_0xb84939['error'][_0xc827('0x28')]);return _0x5afa62(_0xb84939[_0xc827('0x26')][_0xc827('0x28')]);}logger['error'](_0xc827('0x23'),_0x4d9a1c,_0xb84939[_0xc827('0x26')]['message']);return _0x4fb03b(_0xb84939[_0xc827('0x26')][_0xc827('0x28')]);}else{logger[_0xc827('0x29')](_0xc827('0x23'),_0x4d9a1c,_0xc827('0x24'));_0x4fb03b(_0xb84939[_0xc827('0x2a')][_0xc827('0x28')]);}})[_0xc827('0x2b')](function(_0x5d6099){logger[_0xc827('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4d9a1c,_0x5d6099);_0x5afa62(_0x5d6099);});});}function respondWithStatusCode(_0xa45171,_0x3ff0ce){_0x3ff0ce=_0x3ff0ce||0xcc;return function(_0x28d6e1){if(_0x28d6e1){return _0xa45171[_0xc827('0x2c')](_0x3ff0ce);}return _0xa45171['status'](_0x3ff0ce)['end']();};}function respondWithResult(_0x7e5dd0,_0x2d8f30){_0x2d8f30=_0x2d8f30||0xc8;return function(_0x3b0867){if(_0x3b0867){return _0x7e5dd0[_0xc827('0x2d')](_0x2d8f30)[_0xc827('0x2e')](_0x3b0867);}};}function respondWithFilteredResult(_0x12c019,_0x3525f2){return function(_0x42b928){if(_0x42b928){var _0x3ee6ad=typeof _0x3525f2[_0xc827('0x2f')]===_0xc827('0x30')&&typeof _0x3525f2[_0xc827('0x31')]===_0xc827('0x30');var _0x151f4a=_0x42b928[_0xc827('0x32')];var _0x4ac9ef=_0x3ee6ad?0x0:_0x3525f2[_0xc827('0x2f')];var _0x391d91=_0x3ee6ad?_0x42b928[_0xc827('0x32')]:_0x3525f2[_0xc827('0x2f')]+_0x3525f2[_0xc827('0x31')];var _0x1be561;if(_0x391d91>=_0x151f4a){_0x391d91=_0x151f4a;_0x1be561=0xc8;}else{_0x1be561=0xce;}_0x12c019[_0xc827('0x2d')](_0x1be561);return _0x12c019[_0xc827('0x33')](_0xc827('0x34'),_0x4ac9ef+'-'+_0x391d91+'/'+_0x151f4a)['json'](_0x42b928);}return null;};}function patchUpdates(_0x305b34){return function(_0x55f7a8){try{jsonpatch[_0xc827('0x35')](_0x55f7a8,_0x305b34,!![]);}catch(_0x43adef){return BPromise['reject'](_0x43adef);}return _0x55f7a8['save']();};}function saveUpdates(_0x16fc34,_0x1d2758){return function(_0x3749b3){if(_0x3749b3){return _0x3749b3[_0xc827('0x36')](_0x16fc34)[_0xc827('0x22')](function(_0x392400){return _0x392400;});}return null;};}function removeEntity(_0x53f41f,_0x179395){return function(_0x2bfd6a){if(_0x2bfd6a){return _0x2bfd6a[_0xc827('0x37')]()[_0xc827('0x22')](function(){var _0x463722=_0x2bfd6a['get']({'plain':!![]});var _0x187e41=_0xc827('0x38');return db['UserProfileResource'][_0xc827('0x37')]({'where':{'type':_0x187e41,'resourceId':_0x463722['id']}})[_0xc827('0x22')](function(){return _0x2bfd6a;});})[_0xc827('0x22')](function(){_0x53f41f[_0xc827('0x2d')](0xcc)[_0xc827('0x39')]();});}};}function handleEntityNotFound(_0x40b76a,_0x20a6b9){return function(_0x240894){if(!_0x240894){_0x40b76a[_0xc827('0x2c')](0x194);}return _0x240894;};}function handleError(_0x4b1a77,_0xb1ad82){_0xb1ad82=_0xb1ad82||0x1f4;return function(_0x2cbac5){logger[_0xc827('0x26')](_0x2cbac5[_0xc827('0x3a')]);if(_0x2cbac5['name']){delete _0x2cbac5[_0xc827('0x3b')];}_0x4b1a77[_0xc827('0x2d')](_0xb1ad82)[_0xc827('0x3c')](_0x2cbac5);};}exports[_0xc827('0x3d')]=function(_0x1bda04,_0x1ea497){var _0x3ead81={'include':[{'model':db['Pause'],'as':_0xc827('0x3e')}]},_0x1dcca4={},_0x4ba7f6={'count':0x0,'rows':[]};var _0x3de77e=_[_0xc827('0x3f')](db[_0xc827('0x40')][_0xc827('0x41')],function(_0x3cd1b5){return{'name':_0x3cd1b5['fieldName'],'type':_0x3cd1b5[_0xc827('0x42')][_0xc827('0x43')]};});_0x1dcca4['model']=_[_0xc827('0x3f')](_0x3de77e,'name');_0x1dcca4[_0xc827('0x44')]=_[_0xc827('0x45')](_0x1bda04[_0xc827('0x44')]);_0x1dcca4[_0xc827('0x46')]=_[_0xc827('0x47')](_0x1dcca4['model'],_0x1dcca4['query']);_0x3ead81[_0xc827('0x48')]=_[_0xc827('0x47')](_0x1dcca4[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x1bda04[_0xc827('0x44')][_0xc827('0x4a')]));_0x3ead81[_0xc827('0x48')]=_0x3ead81[_0xc827('0x48')][_0xc827('0x4b')]?_0x3ead81[_0xc827('0x48')]:_0x1dcca4[_0xc827('0x49')];if(!_0x1bda04[_0xc827('0x44')][_0xc827('0x4c')](_0xc827('0x4d'))){_0x3ead81[_0xc827('0x31')]=qs[_0xc827('0x31')](_0x1bda04[_0xc827('0x44')][_0xc827('0x31')]);_0x3ead81[_0xc827('0x2f')]=qs[_0xc827('0x2f')](_0x1bda04[_0xc827('0x44')][_0xc827('0x2f')]);}_0x3ead81[_0xc827('0x4e')]=qs[_0xc827('0x4f')](_0x1bda04[_0xc827('0x44')]['sort']);_0x3ead81[_0xc827('0x50')]=qs[_0xc827('0x46')](_[_0xc827('0x51')](_0x1bda04['query'],_0x1dcca4[_0xc827('0x46')]),_0x3de77e);if(_0x1bda04[_0xc827('0x44')]['filter']){_0x3ead81[_0xc827('0x50')]=_[_0xc827('0x52')](_0x3ead81['where'],{'$or':_[_0xc827('0x3f')](_0x3de77e,function(_0x278af1){if(_0x278af1[_0xc827('0x42')]!=='VIRTUAL'){var _0x2f9f7d={};_0x2f9f7d[_0x278af1['name']]={'$like':'%'+_0x1bda04[_0xc827('0x44')]['filter']+'%'};return _0x2f9f7d;}})});}_0x3ead81=_['merge']({},_0x3ead81,_0x1bda04[_0xc827('0x53')]);var _0x6d618={'where':_0x3ead81[_0xc827('0x50')]};return db[_0xc827('0x40')][_0xc827('0x32')](_0x6d618)['then'](function(_0x27342c){_0x4ba7f6[_0xc827('0x32')]=_0x27342c;if(_0x1bda04['query'][_0xc827('0x54')]){_0x3ead81[_0xc827('0x55')]=[{'all':!![]}];}return db[_0xc827('0x40')][_0xc827('0x56')](_0x3ead81);})[_0xc827('0x22')](function(_0x5f452d){_0x4ba7f6[_0xc827('0x57')]=_0x5f452d;return _0x4ba7f6;})[_0xc827('0x22')](respondWithFilteredResult(_0x1ea497,_0x3ead81))[_0xc827('0x2b')](handleError(_0x1ea497,null));};exports['show']=function(_0x53a7f8,_0x2a85f8){var _0x5bb706={'raw':![],'where':{'id':_0x53a7f8[_0xc827('0x58')]['id']},'include':[{'model':db[_0xc827('0x59')],'as':_0xc827('0x3e')}]},_0x3dd78e={};_0x3dd78e['model']=_[_0xc827('0x45')](db[_0xc827('0x40')]['rawAttributes']);_0x3dd78e[_0xc827('0x44')]=_[_0xc827('0x45')](_0x53a7f8['query']);_0x3dd78e['filters']=_[_0xc827('0x47')](_0x3dd78e[_0xc827('0x49')],_0x3dd78e[_0xc827('0x44')]);_0x5bb706[_0xc827('0x48')]=_[_0xc827('0x47')](_0x3dd78e[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x53a7f8['query'][_0xc827('0x4a')]));_0x5bb706[_0xc827('0x48')]=_0x5bb706[_0xc827('0x48')][_0xc827('0x4b')]?_0x5bb706[_0xc827('0x48')]:_0x3dd78e[_0xc827('0x49')];if(_0x53a7f8[_0xc827('0x44')][_0xc827('0x54')]){_0x5bb706[_0xc827('0x55')]=[{'all':!![]}];}_0x5bb706=_[_0xc827('0x52')]({},_0x5bb706,_0x53a7f8['options']);return db[_0xc827('0x40')]['find'](_0x5bb706)[_0xc827('0x22')](handleEntityNotFound(_0x2a85f8,null))[_0xc827('0x22')](respondWithResult(_0x2a85f8,null))[_0xc827('0x2b')](handleError(_0x2a85f8,null));};exports[_0xc827('0x5a')]=function(_0x23b4f7,_0x2d395f){return db[_0xc827('0x40')]['create'](_0x23b4f7['body'],{})[_0xc827('0x22')](function(_0x18b521){var _0x246ea1=_0x23b4f7[_0xc827('0x5b')]['get']({'plain':!![]});if(!_0x246ea1)throw new Error(_0xc827('0x5c'));if(_0x246ea1[_0xc827('0x5d')]==='user'){var _0x6b67ef=_0x18b521['get']({'plain':!![]});var _0x55928a=_0xc827('0x38');return db[_0xc827('0x5e')][_0xc827('0x5f')]({'where':{'name':_0x55928a,'userProfileId':_0x246ea1[_0xc827('0x60')]},'raw':!![]})['then'](function(_0xb29d36){if(_0xb29d36&&_0xb29d36[_0xc827('0x61')]===0x0){return db[_0xc827('0x62')][_0xc827('0x5a')]({'name':_0x6b67ef[_0xc827('0x3b')],'resourceId':_0x6b67ef['id'],'type':_0xb29d36[_0xc827('0x3b')],'sectionId':_0xb29d36['id']},{})[_0xc827('0x22')](function(){return _0x18b521;});}else{return _0x18b521;}})['catch'](function(_0x47ba7e){logger[_0xc827('0x26')](_0xc827('0x63'),_0x47ba7e);throw _0x47ba7e;});}return _0x18b521;})['then'](respondWithResult(_0x2d395f,0xc9))[_0xc827('0x2b')](handleError(_0x2d395f,null));};exports[_0xc827('0x36')]=function(_0xdbce96,_0x488ae5){if(_0xdbce96['body']['id']){delete _0xdbce96[_0xc827('0x64')]['id'];}return db['SmsAccount'][_0xc827('0x5f')]({'where':{'id':_0xdbce96[_0xc827('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xc827('0x3e')}]})['then'](handleEntityNotFound(_0x488ae5,null))[_0xc827('0x22')](saveUpdates(_0xdbce96[_0xc827('0x64')],null))[_0xc827('0x22')](respondWithResult(_0x488ae5,null))[_0xc827('0x2b')](handleError(_0x488ae5,null));};exports[_0xc827('0x37')]=function(_0x213fa4,_0x47aefa){return db[_0xc827('0x40')]['find']({'where':{'id':_0x213fa4[_0xc827('0x58')]['id']}})['then'](handleEntityNotFound(_0x47aefa,null))[_0xc827('0x22')](removeEntity(_0x47aefa,null))[_0xc827('0x2b')](handleError(_0x47aefa,null));};exports[_0xc827('0x65')]=function(_0x2ca185,_0x37b180){return db[_0xc827('0x40')]['describe']()[_0xc827('0x22')](respondWithResult(_0x37b180,null))['catch'](handleError(_0x37b180,null));};exports[_0xc827('0x66')]=function(_0x187e9b,_0x56355f,_0x2ad7b8){if(_0x187e9b[_0xc827('0x64')]['id']){delete _0x187e9b[_0xc827('0x64')]['id'];}return db['SmsAccount'][_0xc827('0x5f')]({'where':{'id':_0x187e9b[_0xc827('0x58')]['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x56355f,null))[_0xc827('0x22')](function(_0x5ee367){if(_0x5ee367){_0x187e9b[_0xc827('0x64')][_0xc827('0x67')]=_0x5ee367['id'];return db['Disposition'][_0xc827('0x5a')](_0x187e9b['body']);}})[_0xc827('0x22')](respondWithResult(_0x56355f,null))[_0xc827('0x2b')](handleError(_0x56355f,null));};exports[_0xc827('0x68')]=function(_0x1891a1,_0x4abf67,_0x16fad4){var _0xa1e3cd={'raw':![],'where':{}};var _0x5cbd62={};var _0x35e096={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc827('0x69')]({'where':{'id':_0x1891a1[_0xc827('0x58')]['id']}})['then'](handleEntityNotFound(_0x4abf67,null))[_0xc827('0x22')](function(_0x35851f){if(_0x35851f){_0x5cbd62['model']=_['keys'](db[_0xc827('0x6a')]['rawAttributes']);_0x5cbd62[_0xc827('0x44')]=_[_0xc827('0x45')](_0x1891a1[_0xc827('0x44')]);_0x5cbd62['filters']=_[_0xc827('0x47')](_0x5cbd62[_0xc827('0x49')],_0x5cbd62[_0xc827('0x44')]);_0xa1e3cd[_0xc827('0x48')]=_['intersection'](_0x5cbd62[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x1891a1[_0xc827('0x44')][_0xc827('0x4a')]));_0xa1e3cd[_0xc827('0x48')]=_0xa1e3cd[_0xc827('0x48')][_0xc827('0x4b')]?_0xa1e3cd['attributes']:_0x5cbd62[_0xc827('0x49')];if(!_0x1891a1[_0xc827('0x44')][_0xc827('0x4c')](_0xc827('0x4d'))){_0xa1e3cd[_0xc827('0x31')]=qs['limit'](_0x1891a1[_0xc827('0x44')]['limit']);_0xa1e3cd[_0xc827('0x2f')]=qs[_0xc827('0x2f')](_0x1891a1[_0xc827('0x44')][_0xc827('0x2f')]);}_0xa1e3cd[_0xc827('0x4e')]=qs[_0xc827('0x4f')](_0x1891a1[_0xc827('0x44')][_0xc827('0x4f')]);_0xa1e3cd['where']=qs[_0xc827('0x46')](_[_0xc827('0x51')](_0x1891a1[_0xc827('0x44')],_0x5cbd62[_0xc827('0x46')]));_0xa1e3cd['where']['SmsAccountId']=_0x35851f['id'];if(_0x1891a1[_0xc827('0x44')]['filter']){_0xa1e3cd[_0xc827('0x50')]=_[_0xc827('0x52')](_0xa1e3cd[_0xc827('0x50')],{'$or':_[_0xc827('0x3f')](_0xa1e3cd[_0xc827('0x48')],function(_0xd1c474){var _0x47881a={};_0x47881a[_0xd1c474]={'$like':'%'+_0x1891a1['query']['filter']+'%'};return _0x47881a;})});}_0xa1e3cd=_[_0xc827('0x52')]({},_0xa1e3cd,_0x1891a1[_0xc827('0x53')]);return db['Disposition'][_0xc827('0x32')]({'where':_0xa1e3cd[_0xc827('0x50')]})[_0xc827('0x22')](function(_0x1be0c4){_0x35e096[_0xc827('0x32')]=_0x1be0c4;if(_0x1891a1[_0xc827('0x44')][_0xc827('0x54')]){_0xa1e3cd[_0xc827('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xc827('0x56')](_0xa1e3cd);})[_0xc827('0x22')](function(_0x56ab79){_0x35e096['rows']=_0x56ab79;return _0x35e096;});}})[_0xc827('0x22')](respondWithFilteredResult(_0x4abf67,_0xa1e3cd))[_0xc827('0x2b')](handleError(_0x4abf67,null));};exports[_0xc827('0x6b')]=function(_0x2c5ccf,_0x515315,_0x111be3){return db[_0xc827('0x40')]['find']({'where':{'id':_0x2c5ccf[_0xc827('0x58')]['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x515315,null))['then'](function(_0x12c951){if(_0x12c951){return _0x12c951[_0xc827('0x6b')](_0x2c5ccf[_0xc827('0x44')][_0xc827('0x6c')]);}})[_0xc827('0x22')](respondWithStatusCode(_0x515315,null))[_0xc827('0x2b')](handleError(_0x515315,null));};exports[_0xc827('0x6d')]=function(_0x423b5e,_0x34963f,_0x4d84ba){if(_0x423b5e[_0xc827('0x64')]['id']){delete _0x423b5e[_0xc827('0x64')]['id'];}return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x423b5e[_0xc827('0x58')]['id']}})['then'](handleEntityNotFound(_0x34963f,null))[_0xc827('0x22')](function(_0x4e0481){if(_0x4e0481){_0x423b5e[_0xc827('0x64')][_0xc827('0x67')]=_0x4e0481['id'];return db[_0xc827('0x6e')][_0xc827('0x5a')](_0x423b5e['body']);}})[_0xc827('0x22')](respondWithResult(_0x34963f,null))['catch'](handleError(_0x34963f,null));};exports[_0xc827('0x6f')]=function(_0x553abc,_0x4813b0,_0x18b311){var _0x784d5e={'raw':![],'where':{}};var _0x1f3491={};var _0x4ec7b9={'count':0x0,'rows':[]};return db[_0xc827('0x40')][_0xc827('0x69')]({'where':{'id':_0x553abc[_0xc827('0x58')]['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x4813b0,null))[_0xc827('0x22')](function(_0x346df){if(_0x346df){_0x1f3491[_0xc827('0x49')]=_['keys'](db[_0xc827('0x6e')][_0xc827('0x41')]);_0x1f3491[_0xc827('0x44')]=_[_0xc827('0x45')](_0x553abc[_0xc827('0x44')]);_0x1f3491[_0xc827('0x46')]=_[_0xc827('0x47')](_0x1f3491[_0xc827('0x49')],_0x1f3491[_0xc827('0x44')]);_0x784d5e[_0xc827('0x48')]=_[_0xc827('0x47')](_0x1f3491[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x553abc['query'][_0xc827('0x4a')]));_0x784d5e['attributes']=_0x784d5e[_0xc827('0x48')]['length']?_0x784d5e[_0xc827('0x48')]:_0x1f3491[_0xc827('0x49')];if(!_0x553abc['query'][_0xc827('0x4c')](_0xc827('0x4d'))){_0x784d5e[_0xc827('0x31')]=qs[_0xc827('0x31')](_0x553abc[_0xc827('0x44')]['limit']);_0x784d5e['offset']=qs['offset'](_0x553abc[_0xc827('0x44')]['offset']);}_0x784d5e[_0xc827('0x4e')]=qs[_0xc827('0x4f')](_0x553abc[_0xc827('0x44')][_0xc827('0x4f')]);_0x784d5e[_0xc827('0x50')]=qs['filters'](_[_0xc827('0x51')](_0x553abc[_0xc827('0x44')],_0x1f3491[_0xc827('0x46')]));_0x784d5e['where']['SmsAccountId']=_0x346df['id'];if(_0x553abc[_0xc827('0x44')][_0xc827('0x70')]){_0x784d5e['where']=_[_0xc827('0x52')](_0x784d5e['where'],{'$or':_[_0xc827('0x3f')](_0x784d5e[_0xc827('0x48')],function(_0x47af8c){var _0x5ee66a={};_0x5ee66a[_0x47af8c]={'$like':'%'+_0x553abc['query'][_0xc827('0x70')]+'%'};return _0x5ee66a;})});}_0x784d5e=_[_0xc827('0x52')]({},_0x784d5e,_0x553abc[_0xc827('0x53')]);return db[_0xc827('0x6e')][_0xc827('0x32')]({'where':_0x784d5e[_0xc827('0x50')]})[_0xc827('0x22')](function(_0x3b2fd8){_0x4ec7b9['count']=_0x3b2fd8;if(_0x553abc['query'][_0xc827('0x54')]){_0x784d5e[_0xc827('0x55')]=[{'all':!![]}];}return db[_0xc827('0x6e')][_0xc827('0x56')](_0x784d5e);})[_0xc827('0x22')](function(_0x1ea209){_0x4ec7b9[_0xc827('0x57')]=_0x1ea209;return _0x4ec7b9;});}})[_0xc827('0x22')](respondWithFilteredResult(_0x4813b0,_0x784d5e))[_0xc827('0x2b')](handleError(_0x4813b0,null));};exports['removeAnswers']=function(_0x560a90,_0x55e286,_0x5e62df){return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x560a90['params']['id']}})['then'](handleEntityNotFound(_0x55e286,null))['then'](function(_0x390eaf){if(_0x390eaf){return _0x390eaf[_0xc827('0x71')](_0x560a90['query']['ids']);}})[_0xc827('0x22')](respondWithStatusCode(_0x55e286,null))[_0xc827('0x2b')](handleError(_0x55e286,null));};exports[_0xc827('0x72')]=function(_0x47d8c6,_0x511327,_0x1bdcb3){var _0x12782d={'channel':'sms'};var _0xd64dae=[];var _0x3665be=[];var _0xe232f={};return db['SmsAccount'][_0xc827('0x5f')]({'where':{'id':_0x47d8c6[_0xc827('0x58')]['id']},'include':[{'model':db[_0xc827('0x73')],'as':_0xc827('0x74')}]})[_0xc827('0x22')](handleEntityNotFound(_0x511327,null))[_0xc827('0x22')](function(_0x5e796b){_0x12782d[_0xc827('0x75')]=_0x5e796b;_0x12782d[_0xc827('0x76')]=_['orderBy'](_0x5e796b[_0xc827('0x74')],[_0xc827('0x77')],[_0xc827('0x78')]);if(_0x12782d[_0xc827('0x75')][_0xc827('0x74')]){delete _0x12782d[_0xc827('0x75')][_0xc827('0x74')];}return db[_0xc827('0x79')]['describe']();})[_0xc827('0x22')](function(_0x1800c4){if(!_0x1800c4){throw new db['Sequelize'][(_0xc827('0x7a'))](_0xc827('0x7b'));}_0xd64dae=_['difference'](_[_0xc827('0x45')](_0x1800c4),[_0xc827('0x7c'),_0xc827('0x7d')]);_0x3665be=_['difference'](_['keys'](_0x1800c4),[_0xc827('0x7c'),_0xc827('0x7d'),_0xc827('0x7e'),_0xc827('0x7f')]);_0x12782d[_0xc827('0x64')]={'mapKey':'mobile'};if(_0x12782d[_0xc827('0x75')][_0xc827('0x42')]){switch(_0x12782d[_0xc827('0x75')][_0xc827('0x42')]){case'twilio':_0x12782d['body'][_0xc827('0x80')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x81')];_0x12782d['body'][_0xc827('0x64')]=_0x47d8c6['body'][_0xc827('0x82')];_0x12782d[_0xc827('0x64')]['messageId']=_0x47d8c6[_0xc827('0x64')][_0xc827('0x83')];break;case _0xc827('0x84'):_0x12782d[_0xc827('0x64')][_0xc827('0x80')]='+'+_0x47d8c6[_0xc827('0x64')][_0xc827('0x85')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x86')];break;case'connectel':_0x12782d[_0xc827('0x64')][_0xc827('0x80')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x80')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6['body'][_0xc827('0x28')];break;case'clicksend':_0x12782d['body']['from']=_0x47d8c6[_0xc827('0x64')]['from'];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x64')];_0x12782d[_0xc827('0x64')][_0xc827('0x87')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x88')];break;case _0xc827('0x89'):_0x12782d['body'][_0xc827('0x80')]=_0x47d8c6[_0xc827('0x64')]['From'];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x8a')];_0x12782d[_0xc827('0x64')]['messageId']=_0x47d8c6[_0xc827('0x64')][_0xc827('0x8b')];break;case _0xc827('0x8c'):_0x12782d['body']['from']='+'+_0x47d8c6[_0xc827('0x64')][_0xc827('0x8d')][0x0]['from'];_0x12782d['body'][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x8d')][0x0]['text'];_0x12782d[_0xc827('0x64')][_0xc827('0x87')]=_0x47d8c6[_0xc827('0x64')]['results'][0x0][_0xc827('0x87')];break;case _0xc827('0x8e'):_0x12782d['body'][_0xc827('0x80')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x8f')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')]['segmentedMessage']['message'];break;case _0xc827('0x90'):_0x12782d[_0xc827('0x64')][_0xc827('0x80')]=_0x47d8c6['body'][_0xc827('0x91')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x86')];_0x12782d[_0xc827('0x64')]['messageId']=_0x47d8c6[_0xc827('0x64')][_0xc827('0x92')];break;case _0xc827('0x93'):_0x12782d[_0xc827('0x64')][_0xc827('0x87')]=_0x47d8c6['body'][0x0][_0xc827('0x28')]['id'];_0x12782d[_0xc827('0x64')][_0xc827('0x80')]=_0x47d8c6[_0xc827('0x64')][0x0][_0xc827('0x28')][_0xc827('0x80')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6['body'][0x0][_0xc827('0x28')]['text'];break;case _0xc827('0x94'):_0x12782d['body'][_0xc827('0x80')]=_0x47d8c6['body'][_0xc827('0x80')];_0x12782d[_0xc827('0x64')][_0xc827('0x64')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x28')];_0x12782d[_0xc827('0x64')][_0xc827('0x87')]=_0x47d8c6[_0xc827('0x64')][_0xc827('0x95')];break;}}if(_0x12782d[_0xc827('0x64')]['id']){delete _0x12782d['body']['id'];}if(_[_0xc827('0x96')](_0x12782d[_0xc827('0x64')][_0xc827('0x80')])){throw new db['Sequelize'][(_0xc827('0x7a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x12782d[_0xc827('0x64')][_0xc827('0x64')])||_0x12782d[_0xc827('0x64')][_0xc827('0x64')]===''){throw new db[(_0xc827('0x97'))][(_0xc827('0x7a'))](_0xc827('0x98'));}if(_[_0xc827('0x96')](_0x12782d['body']['mapKey'])){throw new db[(_0xc827('0x97'))][(_0xc827('0x7a'))](_0xc827('0x99')+_0x3665be);}if(!_[_0xc827('0x9a')](_0x3665be,_0x12782d[_0xc827('0x64')][_0xc827('0x9b')])){throw new db[(_0xc827('0x97'))][(_0xc827('0x7a'))](_0xc827('0x9c')+_0x3665be);}_0xe232f[_0x12782d[_0xc827('0x64')][_0xc827('0x9b')]]=_0x12782d[_0xc827('0x64')][_0xc827('0x80')];return db[_0xc827('0x9d')]['find']({'where':{'id':_0x12782d[_0xc827('0x75')][_0xc827('0x7f')]},'include':[{'model':db['CmContact'],'as':_0xc827('0x9e'),'where':_0xe232f,'limit':0x1,'order':[[_0xc827('0x7d'),'DESC']]}]});})['then'](handleEntityNotFound(_0x511327,null))['then'](function(_0x10ada0){if(_0x10ada0){_0x12782d[_0xc827('0x9f')]=_[_0xc827('0xa0')](_0x10ada0,[_0xc827('0x9e')]);if(_0x10ada0[_0xc827('0x9e')][_0xc827('0x4b')]){return _0x10ada0[_0xc827('0x9e')][0x0];}var _0x20ef15=_[_0xc827('0x1b')](_0x12782d[_0xc827('0x64')],{'firstName':_0x12782d[_0xc827('0x64')][_0xc827('0x80')],'ListId':_0x10ada0['id']});_0x20ef15[_0x12782d[_0xc827('0x64')]['mapKey']]=_0x12782d['body'][_0xc827('0x80')];return db[_0xc827('0x79')]['create'](_0x20ef15,{'fields':_0xd64dae,'raw':!![]});}})[_0xc827('0x22')](handleEntityNotFound(_0x511327,null))[_0xc827('0x22')](function(_0x396b94){if(_0x396b94){_0x12782d[_0xc827('0xa1')]=_0x396b94;var _0x490b14={'ContactId':_0x396b94['id'],'phone':_0x12782d['body'][_0xc827('0x80')],'SmsAccountId':_0x47d8c6[_0xc827('0x58')]['id']};var _0x1eb47c={'ContactId':_0x396b94['id'],'SmsAccountId':_0x47d8c6[_0xc827('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xc827('0x5f')]({'where':_0x1eb47c})[_0xc827('0x22')](function(_0x4c3f82){if(_0x4c3f82){return[_0x4c3f82,![]];}return db[_0xc827('0xa2')]['create'](_0x490b14)[_0xc827('0x22')](function(_0x4d3b95){return[_0x4d3b95,!![]];});});}})['spread'](function(_0xa979b7,_0x4de77e){_0x12782d[_0xc827('0xa3')]=_0xa979b7['get']({'plain':!![]});_0x12782d[_0xc827('0xa3')]['created']=![];if(_0x4de77e){if(_0x12782d['account']['autoclose']){_0x12782d[_0xc827('0x76')]['push']({'id':0x0,'priority':_0x12782d[_0xc827('0x76')]['length']+0x1,'app':_0xc827('0xa4'),'appdata':'unmanaged','interval':_0xc827('0xa5')});}_0x12782d[_0xc827('0xa3')][_0xc827('0xa6')]=!![];}return db[_0xc827('0xa7')]['create']({'phone':_0x12782d[_0xc827('0x64')]['from'],'messageId':_0x12782d[_0xc827('0x64')][_0xc827('0x87')],'body':_0x12782d[_0xc827('0x64')][_0xc827('0x64')],'SmsAccountId':_0x47d8c6[_0xc827('0x58')]['id'],'SmsInteractionId':_0xa979b7['id'],'direction':'in','ContactId':_0xa979b7['ContactId'],'AttachmentId':_0x12782d[_0xc827('0x64')]['AttachmentId']});})[_0xc827('0x22')](function(_0x4df7bf){_0x12782d['message']=_0x4df7bf;if(_0x12782d[_0xc827('0xa3')][_0xc827('0xa8')]){return db[_0xc827('0xa9')]['find']({'attributes':['id',_0xc827('0x3b')],'where':{'id':_0x12782d[_0xc827('0xa3')][_0xc827('0xa8')]}})[_0xc827('0x22')](function(_0x4bc7ea){if(_0x4bc7ea){_0x12782d[_0xc827('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4bc7ea['name']+','+(_0x12782d[_0xc827('0x75')][_0xc827('0xaa')]||0xa),'interval':_0xc827('0xa5')});}return respondWithRpcPromise(_0xc827('0xab'),'startRouting',_0x12782d);});}return respondWithRpcPromise(_0xc827('0xab'),_0xc827('0xac'),_0x12782d);})['then'](function(_0xd914be){if(_0xd914be){var _0x548a39=0xc8;var _0x4dba50=_0xc827('0xad');logger[_0xc827('0x29')](_0xc827('0x25'),_0x4dba50,_0x548a39,_0xc827('0xae'));logger['debug'](_0xc827('0xaf'),_0x4dba50,_0x548a39,_0xc827('0xae'),JSON[_0xc827('0xb0')](_0xd914be));if(_0x12782d[_0xc827('0x75')][_0xc827('0x42')]==='twilio'){return _0x511327[_0xc827('0x2d')](_0x548a39)['set'](_0xc827('0xb1'),'text/xml')['send'](_0xc827('0xb2'));}else{return _0x511327[_0xc827('0x2d')](_0x548a39)[_0xc827('0x2e')](_0xd914be);}}})['catch'](handleError(_0x511327,null));};exports[_0xc827('0xb3')]=function(_0x4b9e04,_0x2ccfdd){var _0x47d650=_0x4b9e04[_0xc827('0x58')]['id'];var _0x4dcd34=_0x4b9e04[_0xc827('0x64')];var _0x41e191=0xc8;var _0x166bbc=null;return db[_0xc827('0xb4')]['transaction']({'isolationLevel':db[_0xc827('0xb4')]['Transaction'][_0xc827('0xb5')][_0xc827('0xb6')]},function(_0x2bb672){return db[_0xc827('0x40')][_0xc827('0x69')]({'where':{'id':_0x47d650},'transaction':_0x2bb672})[_0xc827('0x22')](function(_0x4748c4){if(_0x4748c4){return db['SmsApplication'][_0xc827('0x37')]({'where':{'SmsAccountId':_0x47d650},'transaction':_0x2bb672})[_0xc827('0x22')](function(){var _0x19b4d3=_[_0xc827('0x3f')](_0x4dcd34,function(_0x3f0f26){_0x3f0f26[_0xc827('0x67')]=_0x47d650;return _0x3f0f26;});return db[_0xc827('0x73')][_0xc827('0xb7')](_0x19b4d3,{'transaction':_0x2bb672});});}else{_0x41e191=0x194;_0x166bbc=[];}});})[_0xc827('0x22')](function(){if(_0x41e191!==0x194){return db[_0xc827('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0x47d650},'order':_0xc827('0x77')})[_0xc827('0x22')](function(_0x32ccfb){_0x166bbc=_0x32ccfb;});}})[_0xc827('0x2b')](function(_0x3ef6e6){_0x41e191=0x1f4;logger[_0xc827('0x26')](_0x3ef6e6[_0xc827('0x3a')]);if(_0x3ef6e6[_0xc827('0x3b')]){delete _0x3ef6e6[_0xc827('0x3b')];}_0x166bbc=_0x3ef6e6;})['finally'](function(){if(_0x166bbc===null){_0x2ccfdd[_0xc827('0x2c')](_0x41e191);}else{if(_0x41e191===0x1f4){_0x2ccfdd['status'](_0x41e191)[_0xc827('0x3c')](_0x166bbc);}else{_0x2ccfdd[_0xc827('0x2d')](_0x41e191)[_0xc827('0x2e')](_0x166bbc);}}});};exports[_0xc827('0xb8')]=function(_0x20988b,_0x47694c,_0xd463c6){var _0x1f5299={};var _0xb8538b={};var _0x56dc98;var _0x929378;return db[_0xc827('0x40')][_0xc827('0x69')]({'where':{'id':_0x20988b[_0xc827('0x58')]['id']}})['then'](handleEntityNotFound(_0x47694c,null))[_0xc827('0x22')](function(_0x543a34){if(_0x543a34){_0x56dc98=_0x543a34;_0xb8538b['model']=_[_0xc827('0x45')](db[_0xc827('0x73')]['rawAttributes']);_0xb8538b['query']=_['keys'](_0x20988b['query']);_0xb8538b['filters']=_[_0xc827('0x47')](_0xb8538b['model'],_0xb8538b[_0xc827('0x44')]);_0x1f5299[_0xc827('0x48')]=_[_0xc827('0x47')](_0xb8538b[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x20988b[_0xc827('0x44')][_0xc827('0x4a')]));_0x1f5299[_0xc827('0x48')]=_0x1f5299[_0xc827('0x48')][_0xc827('0x4b')]?_0x1f5299[_0xc827('0x48')]:_0xb8538b[_0xc827('0x49')];_0x1f5299['order']=qs[_0xc827('0x4f')](_0x20988b['query'][_0xc827('0x4f')]);_0x1f5299[_0xc827('0x50')]=qs['filters'](_['pick'](_0x20988b[_0xc827('0x44')],_0xb8538b['filters']));if(_0x20988b[_0xc827('0x44')][_0xc827('0x70')]){_0x1f5299[_0xc827('0x50')]=_[_0xc827('0x52')](_0x1f5299[_0xc827('0x50')],{'$or':_['map'](_0x1f5299['attributes'],function(_0x3ad1e8){var _0x38091b={};_0x38091b[_0x3ad1e8]={'$like':'%'+_0x20988b[_0xc827('0x44')][_0xc827('0x70')]+'%'};return _0x38091b;})});}_0x1f5299=_[_0xc827('0x52')]({},_0x1f5299,_0x20988b[_0xc827('0x53')]);return _0x56dc98[_0xc827('0xb8')](_0x1f5299);}})[_0xc827('0x22')](function(_0xa60691){if(_0xa60691){_0x929378=_0xa60691[_0xc827('0x4b')];if(!_0x20988b[_0xc827('0x44')][_0xc827('0x4c')](_0xc827('0x4d'))){_0x1f5299[_0xc827('0x31')]=qs[_0xc827('0x31')](_0x20988b[_0xc827('0x44')][_0xc827('0x31')]);_0x1f5299[_0xc827('0x2f')]=qs[_0xc827('0x2f')](_0x20988b[_0xc827('0x44')][_0xc827('0x2f')]);}return _0x56dc98[_0xc827('0xb8')](_0x1f5299);}})[_0xc827('0x22')](function(_0xd60bd9){if(_0xd60bd9){return _0xd60bd9?{'count':_0x929378,'rows':_0xd60bd9}:null;}})[_0xc827('0x22')](respondWithResult(_0x47694c,null))[_0xc827('0x2b')](handleError(_0x47694c,null));};exports['getInteractions']=function(_0x2a5a06,_0x7f3d20,_0x5e8f7c){var _0x2eb00d={'raw':![],'where':{}};var _0x1ff711={};var _0x5563d3={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc827('0x69')]({'where':{'id':_0x2a5a06['params']['id']}})['then'](handleEntityNotFound(_0x7f3d20,null))[_0xc827('0x22')](function(_0x3aa235){if(_0x3aa235){_0x1ff711[_0xc827('0x49')]=_['keys'](db['SmsInteraction'][_0xc827('0x41')]);_0x1ff711[_0xc827('0x44')]=_[_0xc827('0x45')](_0x2a5a06[_0xc827('0x44')]);_0x1ff711[_0xc827('0x46')]=_[_0xc827('0x47')](_0x1ff711[_0xc827('0x49')],_0x1ff711[_0xc827('0x44')]);_0x2eb00d['attributes']=_[_0xc827('0x47')](_0x1ff711[_0xc827('0x49')],qs[_0xc827('0x4a')](_0x2a5a06[_0xc827('0x44')]['fields']));_0x2eb00d[_0xc827('0x48')]=_0x2eb00d['attributes'][_0xc827('0x4b')]?_0x2eb00d[_0xc827('0x48')]:_0x1ff711['model'];if(!_0x2a5a06[_0xc827('0x44')]['hasOwnProperty'](_0xc827('0x4d'))){_0x2eb00d[_0xc827('0x31')]=qs[_0xc827('0x31')](_0x2a5a06['query']['limit']);_0x2eb00d['offset']=qs[_0xc827('0x2f')](_0x2a5a06[_0xc827('0x44')][_0xc827('0x2f')]);}_0x2eb00d[_0xc827('0x4e')]=qs[_0xc827('0x4f')](_0x2a5a06[_0xc827('0x44')]['sort']);_0x2eb00d[_0xc827('0x50')]=qs[_0xc827('0x46')](_['pick'](_0x2a5a06['query'],_0x1ff711['filters']));_0x2eb00d['where'][_0xc827('0x67')]=_0x3aa235['id'];if(_0x2a5a06[_0xc827('0x44')][_0xc827('0x70')]){_0x2eb00d[_0xc827('0x50')]=_[_0xc827('0x52')](_0x2eb00d[_0xc827('0x50')],{'$or':_[_0xc827('0x3f')](_0x2eb00d[_0xc827('0x48')],function(_0x283b94){var _0xc9c5bf={};_0xc9c5bf[_0x283b94]={'$like':'%'+_0x2a5a06[_0xc827('0x44')][_0xc827('0x70')]+'%'};return _0xc9c5bf;})});}_0x2eb00d=_[_0xc827('0x52')]({},_0x2eb00d,_0x2a5a06[_0xc827('0x53')]);return db[_0xc827('0xa2')][_0xc827('0x32')]({'where':_0x2eb00d[_0xc827('0x50')]})[_0xc827('0x22')](function(_0x335d1){_0x5563d3['count']=_0x335d1;if(_0x2a5a06[_0xc827('0x44')][_0xc827('0x54')]){_0x2eb00d['include']=[{'model':db['CmContact'],'as':_0xc827('0xb9'),'required':![]},{'model':db['User'],'as':_0xc827('0xba'),'attributes':[_0xc827('0x3b'),_0xc827('0xbb'),_0xc827('0xbc')],'required':![]},{'model':db['Tag'],'as':_0xc827('0xbd'),'attributes':['id',_0xc827('0x3b'),'color'],'where':_0x2a5a06[_0xc827('0x44')][_0xc827('0xbe')]?{'id':_0x2a5a06[_0xc827('0x44')][_0xc827('0xbe')]}:undefined,'required':_0x2a5a06[_0xc827('0x44')][_0xc827('0xbe')]?!![]:![]}];}return db[_0xc827('0xa2')][_0xc827('0x56')](_0x2eb00d);})['then'](function(_0xadbca7){_0x5563d3[_0xc827('0x57')]=_0xadbca7;return _0x5563d3;});}})[_0xc827('0x22')](respondWithFilteredResult(_0x7f3d20,_0x2eb00d))['catch'](handleError(_0x7f3d20,null));};exports[_0xc827('0x3c')]=function(_0x2d306b,_0x2d275b,_0x3064c7){var _0x3e70ef,_0x1a0d48,_0x4cd5ea;if(_[_0xc827('0x96')](_0x2d306b[_0xc827('0x64')][_0xc827('0x64')])||_0x2d306b['body'][_0xc827('0x64')]===''){throw new db[(_0xc827('0x97'))][(_0xc827('0x7a'))](_0xc827('0x98'));}if(_['isNil'](_0x2d306b[_0xc827('0x64')]['to'])){throw new db[(_0xc827('0x97'))]['ValidationError'](_0xc827('0xbf'));}_0x3e70ef=_0x2d306b['body']['to'];return db['SmsAccount'][_0xc827('0x5f')]({'where':{'id':_0x2d306b[_0xc827('0x58')]['id']},'include':[{'model':db[_0xc827('0x9d')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc827('0x9e'),'where':{'mobile':_0x3e70ef},'limit':0x1,'order':[[_0xc827('0x7d'),_0xc827('0xc0')]]}]}]})[_0xc827('0x22')](handleEntityNotFound(_0x2d275b,null))['then'](function(_0x7a533e){if(_0x7a533e&&_0x7a533e[_0xc827('0xc1')]){_0x1a0d48=_0x7a533e[_0xc827('0xc2')]({'plain':!![]});if(_0x1a0d48[_0xc827('0xc1')]&&_0x1a0d48[_0xc827('0xc1')][_0xc827('0x9e')][_0xc827('0x4b')]){return _0x1a0d48['List'][_0xc827('0x9e')][0x0];}return db[_0xc827('0x79')][_0xc827('0x5a')](_[_0xc827('0x1b')](_0x2d306b[_0xc827('0x64')],{'firstName':_0x3e70ef,'mobile':_0x3e70ef,'phone':_0x3e70ef,'ListId':_0x1a0d48[_0xc827('0x7f')]}));}})[_0xc827('0x22')](handleEntityNotFound(_0x2d275b,null))[_0xc827('0x22')](function(_0x56927c){if(_0x56927c){_0x4cd5ea=_0x56927c;return db['SmsInteraction'][_0xc827('0x5f')]({'where':{'ContactId':_0x4cd5ea['id'],'closed':![],'SmsAccountId':_0x1a0d48['id']}})[_0xc827('0x22')](function(_0x4ae1b1){if(_0x4ae1b1){return[_0x4ae1b1,![]];}return db[_0xc827('0xa2')][_0xc827('0x5a')]({'UserId':_0x2d306b[_0xc827('0x5b')]['id'],'ContactId':_0x4cd5ea['id'],'SmsAccountId':_0x1a0d48['id'],'phone':_0x3e70ef,'firstMsgDirection':_0xc827('0xc3'),'Messages':[_[_0xc827('0x52')](_0x2d306b['body'],{'read':![],'body':_0x2d306b[_0xc827('0x64')][_0xc827('0x64')],'phone':_0x3e70ef,'SmsAccountId':_0x1a0d48['id'],'UserId':_0x2d306b[_0xc827('0x5b')]['id'],'ContactId':_0x4cd5ea['id']})]},{'include':[{'model':db[_0xc827('0xa7')],'as':_0xc827('0xc4')}]})[_0xc827('0x22')](function(_0x110928){return[_0x110928,!![]];});});}})[_0xc827('0xc5')](function(_0x4947dc,_0x562e3a){if(_0x562e3a){return _0x4947dc;}return db['SmsMessage']['create'](_[_0xc827('0x52')](_0x2d306b[_0xc827('0x64')],{'read':![],'body':_0x2d306b[_0xc827('0x64')][_0xc827('0x64')],'phone':_0x3e70ef,'SmsAccountId':_0x1a0d48['id'],'SmsInteractionId':_0x4947dc['id'],'UserId':_0x2d306b[_0xc827('0x5b')]['id'],'ContactId':_0x4cd5ea['id']}))[_0xc827('0x22')](function(_0x15d052){_0x4947dc['dataValues']['Messages']=[];_0x4947dc[_0xc827('0xc6')][_0xc827('0xc4')][_0xc827('0xc7')](_0x15d052[_0xc827('0xc6')]);return _0x4947dc;});})[_0xc827('0x22')](respondWithResult(_0x2d275b,null))['catch'](handleError(_0x2d275b,null));};exports[_0xc827('0x2d')]=function(_0x38c96e,_0x526819,_0x84b4dd){if(_0x38c96e[_0xc827('0x64')]['id']){delete _0x38c96e[_0xc827('0x64')]['id'];}var _0x5e4318,_0x2f2133,_0x12e6e7;return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x38c96e['params']['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x526819,null))[_0xc827('0x22')](function(_0x4e988b){if(_0x4e988b){_0x12e6e7=_0x4e988b;logger[_0xc827('0xc8')](_0xc827('0x25'),_0xc827('0x2d'),_0xc827('0xc9'),_0x4e988b['type'],util[_0xc827('0xca')](_0x38c96e['body'],{'showHidden':![],'depth':null}));switch(_0x4e988b['type']){case _0xc827('0x84'):if(_0x38c96e[_0xc827('0x64')][_0xc827('0xcb')]&&_0x38c96e[_0xc827('0x64')][_0xc827('0x2d')]){_0x2f2133=_0x38c96e[_0xc827('0x64')][_0xc827('0x2d')];return db[_0xc827('0xa7')][_0xc827('0x5f')]({'where':{'messageId':_0x38c96e[_0xc827('0x64')][_0xc827('0xcb')]}});}break;case _0xc827('0xcc'):if(_0x38c96e[_0xc827('0x64')][_0xc827('0xcd')]&&_0x38c96e[_0xc827('0x64')][_0xc827('0xce')]){_0x2f2133=_0x38c96e[_0xc827('0x64')][_0xc827('0xce')];return db['SmsMessage']['find']({'where':{'messageId':_0x38c96e[_0xc827('0x64')][_0xc827('0xcd')]}});}break;case _0xc827('0xcf'):if(_0x38c96e['body'][_0xc827('0x88')]&&_0x38c96e[_0xc827('0x64')][_0xc827('0xd0')]){_0x2f2133=_0x38c96e[_0xc827('0x64')][_0xc827('0xd0')];return db[_0xc827('0xa7')][_0xc827('0x5f')]({'where':{'messageId':_0x38c96e[_0xc827('0x64')][_0xc827('0x88')]}});}break;case'infobip':var _0x40af63=_0x38c96e[_0xc827('0x64')][_0xc827('0x8d')][0x0];if(_0x40af63[_0xc827('0x87')]&&_0x40af63['status'][_0xc827('0xd1')]===_0xc827('0xd2')){_0x2f2133=_0x40af63[_0xc827('0x2d')]['groupName'];return db[_0xc827('0xa7')][_0xc827('0x5f')]({'where':{'messageId':_0x40af63[_0xc827('0x87')]}});}break;case _0xc827('0x90'):if(_0x38c96e[_0xc827('0x64')][_0xc827('0x87')]&&_0x38c96e[_0xc827('0x64')][_0xc827('0x2d')]){_0x2f2133=_0x38c96e[_0xc827('0x64')][_0xc827('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x38c96e[_0xc827('0x64')][_0xc827('0x87')]}});}break;case _0xc827('0x93'):if(_0x38c96e['body'][0x0]['message']['id']){_0x2f2133=_0x38c96e['body'][0x0][_0xc827('0x42')];return db[_0xc827('0xa7')][_0xc827('0x5f')]({'where':{'messageId':_0x38c96e[_0xc827('0x64')][0x0][_0xc827('0x28')]['id']}});}break;case'intelepeer':if(_0x38c96e[_0xc827('0x64')][_0xc827('0xd3')]&&_0x38c96e[_0xc827('0x64')][_0xc827('0x2d')]){_0x2f2133=_0x38c96e['body'][_0xc827('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x38c96e[_0xc827('0x64')][_0xc827('0xd3')]}});}break;}}})[_0xc827('0x22')](handleEntityNotFound(_0x526819,null))[_0xc827('0x22')](function(_0x1407fa){if(_0x1407fa){_0x5e4318=_0x1407fa;switch(_0x12e6e7[_0xc827('0x42')]){case _0xc827('0x84'):if(_0x2f2133===_0xc827('0xd2')){return _0x5e4318['update']({'read':!![]});}else{logger['error'](_0xc827('0x25'),'status','skebby',util[_0xc827('0xca')](_0x38c96e['body'],{'showHidden':![],'depth':null}));}break;case _0xc827('0xcc'):if(_0x2f2133==='1'){return _0x5e4318[_0xc827('0x36')]({'read':!![]});}else{logger[_0xc827('0x26')](_0xc827('0x25'),_0xc827('0x2d'),_0xc827('0x84'),util[_0xc827('0xca')](_0x38c96e[_0xc827('0x64')],{'showHidden':![],'depth':null}));}break;case _0xc827('0xcf'):if(!_0x38c96e['body'][_0xc827('0xd4')]&&_0x2f2133>=0xc8&&_0x2f2133<=0xce){return _0x5e4318['update']({'read':!![]});}else{logger['error'](_0xc827('0x25'),_0xc827('0x2d'),_0xc827('0xcf'),util['inspect'](_0x38c96e[_0xc827('0x64')],{'showHidden':![],'depth':null}));}break;case _0xc827('0x8c'):var _0x7fdaf9=_0x38c96e[_0xc827('0x64')][_0xc827('0x8d')][0x0];if(_0x7fdaf9[_0xc827('0x2d')][_0xc827('0xd1')]===_0xc827('0xd2')){return _0x5e4318[_0xc827('0x36')]({'read':!![]});}else{logger[_0xc827('0x26')](_0xc827('0x25'),'status','infobip',util['inspect'](_0x38c96e['body'],{'showHidden':![],'depth':null}));}break;case _0xc827('0x90'):if(_0x2f2133=='DELIVERED_TO_GATEWAY'||_0x2f2133==_0xc827('0xd5')){return _0x5e4318[_0xc827('0x36')]({'read':!![]});}else{logger[_0xc827('0x26')](_0xc827('0x25'),_0xc827('0x2d'),_0xc827('0x90'),util['inspect'](_0x38c96e[_0xc827('0x64')],{'showHidden':![],'depth':null}));}break;case _0xc827('0x93'):if(_0x2f2133==_0xc827('0xd6')){return _0x5e4318[_0xc827('0x36')]({'read':!![]});}else{logger[_0xc827('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc827('0x2d'),'bandwidth',util[_0xc827('0xca')](_0x38c96e[_0xc827('0x64')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2f2133===_0xc827('0xd7')||_0x2f2133===_0xc827('0xd8')){return _0x5e4318[_0xc827('0x36')]({'read':!![]});}else{logger[_0xc827('0x26')](_0xc827('0x25'),_0xc827('0x2d'),'intelepeer',util[_0xc827('0xca')](_0x38c96e[_0xc827('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x5e4318;}})[_0xc827('0x22')](respondWithResult(_0x526819,null))[_0xc827('0x2b')](handleError(_0x526819,null));};exports[_0xc827('0xd9')]=function(_0x4f64ca,_0xe4458d,_0x4ca2a4){var _0x1bda0a,_0x5d0cef,_0x41df98;return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x4f64ca['params']['id']}})[_0xc827('0x22')](handleEntityNotFound(_0xe4458d,null))['then'](function(_0x1ac092){if(_0x1ac092){_0x41df98=_0x1ac092;logger['debug'](_0xc827('0x25'),_0xc827('0x2d'),'received\x20delivery\x20report\x20from',_0x1ac092[_0xc827('0x42')],util['inspect'](_0x4f64ca[_0xc827('0x44')],{'showHidden':![],'depth':null}));switch(_0x1ac092['type']){case'csc':if(_0x4f64ca[_0xc827('0x44')][_0xc827('0xda')]&&_0x4f64ca[_0xc827('0x44')][_0xc827('0xdb')]){_0x5d0cef=_0x4f64ca[_0xc827('0x44')]['state'];return db[_0xc827('0xa7')]['find']({'where':{'messageId':_0x4f64ca['query'][_0xc827('0xda')]}});}break;}}})[_0xc827('0x22')](handleEntityNotFound(_0xe4458d,null))[_0xc827('0x22')](function(_0x24be88){if(_0x24be88){_0x1bda0a=_0x24be88;switch(_0x41df98['type']){case'csc':if(_0x5d0cef==='2'||_0x5d0cef==='6'){return _0x1bda0a['update']({'read':!![]});}else{logger[_0xc827('0x26')](_0xc827('0x25'),_0xc827('0x2d'),_0xc827('0x8e'),util[_0xc827('0xca')](_0x4f64ca['query'],{'showHidden':![],'depth':null}));};break;}return _0x1bda0a;}})[_0xc827('0x22')](respondWithResult(_0xe4458d,null))['catch'](handleError(_0xe4458d,null));};exports[_0xc827('0xdc')]=function(_0x5a0a33,_0x18fea4,_0x3fa82c){return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x5a0a33[_0xc827('0x58')]['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x18fea4,null))[_0xc827('0x22')](function(_0x296410){if(_0x296410){return _0x296410[_0xc827('0xdc')](_0x5a0a33[_0xc827('0x64')][_0xc827('0x6c')],_[_0xc827('0xa0')](_0x5a0a33[_0xc827('0x64')],[_0xc827('0x6c'),'id'])||{})['spread'](function(_0x1ed748){for(var _0x33495c=0x0;_0x33495c<_0x5a0a33[_0xc827('0x64')][_0xc827('0x6c')][_0xc827('0x4b')];_0x33495c+=0x1){socket['emit'](_0xc827('0xdd'),{'UserId':Number(_0x5a0a33[_0xc827('0x64')][_0xc827('0x6c')][_0x33495c]),'SmsAccountId':Number(_0x5a0a33[_0xc827('0x58')]['id'])});}return _0x1ed748;});}})[_0xc827('0x22')](respondWithResult(_0x18fea4,null))[_0xc827('0x2b')](handleError(_0x18fea4,null));};exports[_0xc827('0xde')]=function(_0x5004d9,_0x40c8ff,_0xe0152e){return db[_0xc827('0x40')][_0xc827('0x5f')]({'where':{'id':_0x5004d9[_0xc827('0x58')]['id']}})[_0xc827('0x22')](handleEntityNotFound(_0x40c8ff,null))[_0xc827('0x22')](function(_0xd0783c){if(_0xd0783c){return _0xd0783c[_0xc827('0xde')](_0x5004d9[_0xc827('0x44')][_0xc827('0x6c')])['then'](function(){if(_[_0xc827('0xdf')](_0x5004d9[_0xc827('0x44')][_0xc827('0x6c')])){for(var _0x18758e=0x0;_0x18758e<_0x5004d9[_0xc827('0x44')]['ids'][_0xc827('0x4b')];_0x18758e+=0x1){socket['emit'](_0xc827('0xe0'),{'UserId':Number(_0x5004d9['query'][_0xc827('0x6c')][_0x18758e]),'SmsAccountId':Number(_0x5004d9[_0xc827('0x58')]['id'])});}}else{socket['emit'](_0xc827('0xe0'),{'UserId':Number(_0x5004d9[_0xc827('0x44')][_0xc827('0x6c')]),'SmsAccountId':Number(_0x5004d9['params']['id'])});}});}})[_0xc827('0x22')](respondWithStatusCode(_0x40c8ff,null))[_0xc827('0x2b')](handleError(_0x40c8ff,null));};exports[_0xc827('0xe1')]=function(_0x50ca2a,_0x4c25e8,_0x4bbf46){var _0x4bee71={};var _0x3398d0={};var _0x553407;var _0x1fc62c;return db[_0xc827('0x40')][_0xc827('0x69')]({'where':{'id':_0x50ca2a[_0xc827('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c25e8,null))[_0xc827('0x22')](function(_0x48c763){if(_0x48c763){_0x553407=_0x48c763;_0x3398d0[_0xc827('0x49')]=_[_0xc827('0x45')](db[_0xc827('0xa9')]['rawAttributes']);_0x3398d0['query']=_['keys'](_0x50ca2a[_0xc827('0x44')]);_0x3398d0['filters']=_[_0xc827('0x47')](_0x3398d0['model'],_0x3398d0[_0xc827('0x44')]);_0x4bee71[_0xc827('0x48')]=_[_0xc827('0x47')](_0x3398d0[_0xc827('0x49')],qs['fields'](_0x50ca2a[_0xc827('0x44')][_0xc827('0x4a')]));_0x4bee71['attributes']=_0x4bee71[_0xc827('0x48')][_0xc827('0x4b')]?_0x4bee71[_0xc827('0x48')]:_0x3398d0[_0xc827('0x49')];_0x4bee71[_0xc827('0x4e')]=qs['sort'](_0x50ca2a['query'][_0xc827('0x4f')]);_0x4bee71[_0xc827('0x50')]=qs['filters'](_[_0xc827('0x51')](_0x50ca2a[_0xc827('0x44')],_0x3398d0['filters']));if(_0x50ca2a[_0xc827('0x44')]['filter']){_0x4bee71[_0xc827('0x50')]=_[_0xc827('0x52')](_0x4bee71[_0xc827('0x50')],{'$or':_[_0xc827('0x3f')](_0x4bee71['attributes'],function(_0x11d14d){var _0x4e7a61={};_0x4e7a61[_0x11d14d]={'$like':'%'+_0x50ca2a[_0xc827('0x44')][_0xc827('0x70')]+'%'};return _0x4e7a61;})});}_0x4bee71=_['merge']({},_0x4bee71,_0x50ca2a[_0xc827('0x53')]);return _0x553407[_0xc827('0xe1')](_0x4bee71);}})[_0xc827('0x22')](function(_0x5763f0){if(_0x5763f0){_0x1fc62c=_0x5763f0['length'];if(!_0x50ca2a[_0xc827('0x44')]['hasOwnProperty']('nolimit')){_0x4bee71['limit']=qs[_0xc827('0x31')](_0x50ca2a[_0xc827('0x44')][_0xc827('0x31')]);_0x4bee71['offset']=qs['offset'](_0x50ca2a[_0xc827('0x44')]['offset']);}return _0x553407['getAgents'](_0x4bee71);}})['then'](function(_0x442abe){if(_0x442abe){return _0x442abe?{'count':_0x1fc62c,'rows':_0x442abe}:null;}})[_0xc827('0x22')](respondWithResult(_0x4c25e8,null))[_0xc827('0x2b')](handleError(_0x4c25e8,null));}; \ No newline at end of file +var _0x56a5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra'];(function(_0x310024,_0xcf27a8){var _0x259db4=function(_0x542313){while(--_0x542313){_0x310024['push'](_0x310024['shift']());}};_0x259db4(++_0xcf27a8);}(_0x56a5,0x1ce));var _0x556a=function(_0x1b7f17,_0x54411f){_0x1b7f17=_0x1b7f17-0x0;var _0x454a80=_0x56a5[_0x1b7f17];return _0x454a80;};'use strict';var emlformat=require(_0x556a('0x0'));var rimraf=require(_0x556a('0x1'));var zipdir=require(_0x556a('0x2'));var jsonpatch=require(_0x556a('0x3'));var rp=require(_0x556a('0x4'));var moment=require(_0x556a('0x5'));var BPromise=require(_0x556a('0x6'));var Mustache=require(_0x556a('0x7'));var util=require('util');var path=require(_0x556a('0x8'));var sox=require(_0x556a('0x9'));var csv=require('to-csv');var ejs=require(_0x556a('0xa'));var fs=require('fs');var fs_extra=require(_0x556a('0xb'));var _=require(_0x556a('0xc'));var squel=require(_0x556a('0xd'));var crypto=require(_0x556a('0xe'));var jsforce=require(_0x556a('0xf'));var deskjs=require(_0x556a('0x10'));var toCsv=require(_0x556a('0x11'));var querystring=require(_0x556a('0x12'));var Papa=require('papaparse');var Redis=require(_0x556a('0x13'));var authService=require(_0x556a('0x14'));var qs=require(_0x556a('0x15'));var as=require(_0x556a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x556a('0x17'));var utils=require(_0x556a('0x18'));var config=require(_0x556a('0x19'));var licenseUtil=require(_0x556a('0x1a'));var db=require(_0x556a('0x1b'))['db'];config[_0x556a('0x1c')]=_[_0x556a('0x1d')](config[_0x556a('0x1c')],{'host':_0x556a('0x1e'),'port':0x18eb});var socket=require(_0x556a('0x1f'))(new Redis(config['redis']));require(_0x556a('0x20'))[_0x556a('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x556a('0x22')][_0x556a('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x249a81,_0x519e5a,_0xb8d1d2,_0xf24268){return new BPromise(function(_0x4e4e4b,_0x480510){var _0x1e92a6=_0xf24268||client;return _0x1e92a6[_0x556a('0x24')](_0x249a81,_0xb8d1d2)[_0x556a('0x25')](function(_0x3f1446){logger[_0x556a('0x26')]('SmsAccount,\x20%s,\x20%s',_0x519e5a,_0x556a('0x27'));logger[_0x556a('0x28')](_0x556a('0x29'),_0x519e5a,_0x556a('0x27'),JSON[_0x556a('0x2a')](_0x3f1446));if(_0x3f1446[_0x556a('0x2b')]){if(_0x3f1446['error'][_0x556a('0x2c')]===0x1f4){logger[_0x556a('0x2b')](_0x556a('0x2d'),_0x519e5a,_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);return _0x480510(_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);}logger['error'](_0x556a('0x2d'),_0x519e5a,_0x3f1446['error'][_0x556a('0x2e')]);return _0x4e4e4b(_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);}else{logger[_0x556a('0x26')]('SmsAccount,\x20%s,\x20%s',_0x519e5a,_0x556a('0x27'));_0x4e4e4b(_0x3f1446[_0x556a('0x2f')]['message']);}})['catch'](function(_0x31b309){logger['error'](_0x556a('0x2d'),_0x519e5a,_0x31b309);_0x480510(_0x31b309);});});}function respondWithStatusCode(_0x5e8466,_0x431968){_0x431968=_0x431968||0xcc;return function(_0x39f64a){if(_0x39f64a){return _0x5e8466[_0x556a('0x30')](_0x431968);}return _0x5e8466[_0x556a('0x31')](_0x431968)['end']();};}function respondWithResult(_0x5cc536,_0x380c09){_0x380c09=_0x380c09||0xc8;return function(_0x52dd33){if(_0x52dd33){return _0x5cc536[_0x556a('0x31')](_0x380c09)[_0x556a('0x32')](_0x52dd33);}};}function respondWithFilteredResult(_0x4f2f5d,_0x1ee918){return function(_0x24cf29){if(_0x24cf29){var _0x223dd6=typeof _0x1ee918[_0x556a('0x33')]==='undefined'&&typeof _0x1ee918[_0x556a('0x34')]===_0x556a('0x35');var _0x576879=_0x24cf29[_0x556a('0x36')];var _0x3febcb=_0x223dd6?0x0:_0x1ee918[_0x556a('0x33')];var _0x28d148=_0x223dd6?_0x24cf29[_0x556a('0x36')]:_0x1ee918[_0x556a('0x33')]+_0x1ee918['limit'];var _0x28a28d;if(_0x28d148>=_0x576879){_0x28d148=_0x576879;_0x28a28d=0xc8;}else{_0x28a28d=0xce;}_0x4f2f5d['status'](_0x28a28d);return _0x4f2f5d[_0x556a('0x37')](_0x556a('0x38'),_0x3febcb+'-'+_0x28d148+'/'+_0x576879)[_0x556a('0x32')](_0x24cf29);}return null;};}function patchUpdates(_0x5ad323){return function(_0xa3e7da){try{jsonpatch[_0x556a('0x39')](_0xa3e7da,_0x5ad323,!![]);}catch(_0x29bbd6){return BPromise[_0x556a('0x3a')](_0x29bbd6);}return _0xa3e7da[_0x556a('0x3b')]();};}function saveUpdates(_0x5e18e0,_0x17b44b){return function(_0x5c2877){if(_0x5c2877){return _0x5c2877['update'](_0x5e18e0)['then'](function(_0x19bf20){return _0x19bf20;});}return null;};}function removeEntity(_0x393e8f,_0x132445){return function(_0x58c422){if(_0x58c422){return _0x58c422[_0x556a('0x3c')]()['then'](function(){var _0x2ce247=_0x58c422['get']({'plain':!![]});var _0x69fa2d=_0x556a('0x3d');return db[_0x556a('0x3e')][_0x556a('0x3c')]({'where':{'type':_0x69fa2d,'resourceId':_0x2ce247['id']}})[_0x556a('0x25')](function(){return _0x58c422;});})[_0x556a('0x25')](function(){_0x393e8f[_0x556a('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351682,_0x316b73){return function(_0x4c992d){if(!_0x4c992d){_0x351682[_0x556a('0x30')](0x194);}return _0x4c992d;};}function handleError(_0x208040,_0x107157){_0x107157=_0x107157||0x1f4;return function(_0x56ee77){logger[_0x556a('0x2b')](_0x56ee77[_0x556a('0x3f')]);if(_0x56ee77[_0x556a('0x40')]){delete _0x56ee77['name'];}_0x208040['status'](_0x107157)[_0x556a('0x41')](_0x56ee77);};}exports[_0x556a('0x42')]=function(_0x34c9f6,_0x41f41c){var _0x1e3f5f={'include':[{'model':db[_0x556a('0x43')],'as':_0x556a('0x44')}]},_0x49ef59={},_0x185e96={'count':0x0,'rows':[]};var _0x53696b=_[_0x556a('0x45')](db[_0x556a('0x46')][_0x556a('0x47')],function(_0xeea94a){return{'name':_0xeea94a[_0x556a('0x48')],'type':_0xeea94a[_0x556a('0x49')][_0x556a('0x4a')]};});_0x49ef59[_0x556a('0x4b')]=_[_0x556a('0x45')](_0x53696b,_0x556a('0x40'));_0x49ef59['query']=_[_0x556a('0x4c')](_0x34c9f6[_0x556a('0x4d')]);_0x49ef59[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x49ef59[_0x556a('0x4b')],_0x49ef59[_0x556a('0x4d')]);_0x1e3f5f[_0x556a('0x50')]=_['intersection'](_0x49ef59[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x51')]));_0x1e3f5f[_0x556a('0x50')]=_0x1e3f5f[_0x556a('0x50')][_0x556a('0x52')]?_0x1e3f5f['attributes']:_0x49ef59[_0x556a('0x4b')];if(!_0x34c9f6['query']['hasOwnProperty'](_0x556a('0x53'))){_0x1e3f5f['limit']=qs['limit'](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x34')]);_0x1e3f5f[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x33')]);}_0x1e3f5f[_0x556a('0x54')]=qs[_0x556a('0x55')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x55')]);_0x1e3f5f[_0x556a('0x56')]=qs[_0x556a('0x4e')](_['pick'](_0x34c9f6[_0x556a('0x4d')],_0x49ef59['filters']),_0x53696b);if(_0x34c9f6[_0x556a('0x4d')][_0x556a('0x57')]){_0x1e3f5f['where']=_[_0x556a('0x58')](_0x1e3f5f[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x53696b,function(_0x1a0081){if(_0x1a0081[_0x556a('0x49')]!==_0x556a('0x59')){var _0x1ecc95={};_0x1ecc95[_0x1a0081[_0x556a('0x40')]]={'$like':'%'+_0x34c9f6[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x1ecc95;}})});}_0x1e3f5f=_['merge']({},_0x1e3f5f,_0x34c9f6[_0x556a('0x5a')]);var _0x371ec2={'where':_0x1e3f5f[_0x556a('0x56')]};return db[_0x556a('0x46')][_0x556a('0x36')](_0x371ec2)[_0x556a('0x25')](function(_0x2279b7){_0x185e96['count']=_0x2279b7;if(_0x34c9f6[_0x556a('0x4d')]['includeAll']){_0x1e3f5f[_0x556a('0x5b')]=[{'all':!![]}];}return db[_0x556a('0x46')][_0x556a('0x5c')](_0x1e3f5f);})[_0x556a('0x25')](function(_0x11dee0){_0x185e96[_0x556a('0x5d')]=_0x11dee0;return _0x185e96;})[_0x556a('0x25')](respondWithFilteredResult(_0x41f41c,_0x1e3f5f))['catch'](handleError(_0x41f41c,null));};exports[_0x556a('0x5e')]=function(_0x11ff44,_0x3d0119){var _0xe61361={'raw':![],'where':{'id':_0x11ff44[_0x556a('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x556a('0x44')}]},_0xb52fe1={};_0xb52fe1[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x46')]['rawAttributes']);_0xb52fe1[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x11ff44['query']);_0xb52fe1[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0xb52fe1[_0x556a('0x4b')],_0xb52fe1[_0x556a('0x4d')]);_0xe61361[_0x556a('0x50')]=_[_0x556a('0x4f')](_0xb52fe1['model'],qs['fields'](_0x11ff44[_0x556a('0x4d')][_0x556a('0x51')]));_0xe61361[_0x556a('0x50')]=_0xe61361['attributes'][_0x556a('0x52')]?_0xe61361[_0x556a('0x50')]:_0xb52fe1[_0x556a('0x4b')];if(_0x11ff44['query'][_0x556a('0x60')]){_0xe61361['include']=[{'all':!![]}];}_0xe61361=_['merge']({},_0xe61361,_0x11ff44['options']);return db['SmsAccount'][_0x556a('0x61')](_0xe61361)[_0x556a('0x25')](handleEntityNotFound(_0x3d0119,null))[_0x556a('0x25')](respondWithResult(_0x3d0119,null))[_0x556a('0x62')](handleError(_0x3d0119,null));};exports[_0x556a('0x63')]=function(_0x5f21ea,_0x528c54){return db[_0x556a('0x46')][_0x556a('0x63')](_0x5f21ea['body'],{})[_0x556a('0x25')](function(_0x92e778){var _0x39eede=_0x5f21ea['user'][_0x556a('0x64')]({'plain':!![]});if(!_0x39eede)throw new Error(_0x556a('0x65'));if(_0x39eede[_0x556a('0x66')]===_0x556a('0x67')){var _0x39fd07=_0x92e778[_0x556a('0x64')]({'plain':!![]});var _0x4d9d96=_0x556a('0x3d');return db[_0x556a('0x68')]['find']({'where':{'name':_0x4d9d96,'userProfileId':_0x39eede[_0x556a('0x69')]},'raw':!![]})['then'](function(_0x345e96){if(_0x345e96&&_0x345e96[_0x556a('0x6a')]===0x0){return db[_0x556a('0x3e')][_0x556a('0x63')]({'name':_0x39fd07[_0x556a('0x40')],'resourceId':_0x39fd07['id'],'type':_0x345e96[_0x556a('0x40')],'sectionId':_0x345e96['id']},{})[_0x556a('0x25')](function(){return _0x92e778;});}else{return _0x92e778;}})[_0x556a('0x62')](function(_0x5011ff){logger[_0x556a('0x2b')](_0x556a('0x6b'),_0x5011ff);throw _0x5011ff;});}return _0x92e778;})[_0x556a('0x25')](respondWithResult(_0x528c54,0xc9))[_0x556a('0x62')](handleError(_0x528c54,null));};exports[_0x556a('0x6c')]=function(_0x3b9c69,_0x2e99c9){if(_0x3b9c69[_0x556a('0x6d')]['id']){delete _0x3b9c69[_0x556a('0x6d')]['id'];}return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x3b9c69[_0x556a('0x5f')]['id']},'include':[{'model':db[_0x556a('0x43')],'as':'mandatoryDispositionPause'}]})[_0x556a('0x25')](handleEntityNotFound(_0x2e99c9,null))['then'](saveUpdates(_0x3b9c69[_0x556a('0x6d')],null))[_0x556a('0x25')](respondWithResult(_0x2e99c9,null))['catch'](handleError(_0x2e99c9,null));};exports['destroy']=function(_0x103485,_0x9c25f5){return db['SmsAccount'][_0x556a('0x61')]({'where':{'id':_0x103485[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x9c25f5,null))[_0x556a('0x25')](removeEntity(_0x9c25f5,null))[_0x556a('0x62')](handleError(_0x9c25f5,null));};exports[_0x556a('0x6e')]=function(_0x54c505,_0x56d6e5){return db[_0x556a('0x46')][_0x556a('0x6e')]()['then'](respondWithResult(_0x56d6e5,null))[_0x556a('0x62')](handleError(_0x56d6e5,null));};exports['addDisposition']=function(_0x596149,_0x2a0c51,_0x47ede5){if(_0x596149[_0x556a('0x6d')]['id']){delete _0x596149['body']['id'];}return db[_0x556a('0x46')]['find']({'where':{'id':_0x596149[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a0c51,null))[_0x556a('0x25')](function(_0x7c9881){if(_0x7c9881){_0x596149['body'][_0x556a('0x6f')]=_0x7c9881['id'];return db[_0x556a('0x70')][_0x556a('0x63')](_0x596149['body']);}})['then'](respondWithResult(_0x2a0c51,null))[_0x556a('0x62')](handleError(_0x2a0c51,null));};exports[_0x556a('0x71')]=function(_0x582d84,_0x421c20,_0x2a5bde){var _0x411ef7={'raw':![],'where':{}};var _0xbc7dda={};var _0x4f7478={'count':0x0,'rows':[]};return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x582d84[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x421c20,null))[_0x556a('0x25')](function(_0x2cde6b){if(_0x2cde6b){_0xbc7dda[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x70')][_0x556a('0x47')]);_0xbc7dda[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x582d84[_0x556a('0x4d')]);_0xbc7dda[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0xbc7dda[_0x556a('0x4b')],_0xbc7dda[_0x556a('0x4d')]);_0x411ef7['attributes']=_[_0x556a('0x4f')](_0xbc7dda[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x582d84[_0x556a('0x4d')]['fields']));_0x411ef7[_0x556a('0x50')]=_0x411ef7[_0x556a('0x50')]['length']?_0x411ef7[_0x556a('0x50')]:_0xbc7dda[_0x556a('0x4b')];if(!_0x582d84[_0x556a('0x4d')][_0x556a('0x73')]('nolimit')){_0x411ef7['limit']=qs[_0x556a('0x34')](_0x582d84[_0x556a('0x4d')][_0x556a('0x34')]);_0x411ef7[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x582d84['query'][_0x556a('0x33')]);}_0x411ef7['order']=qs[_0x556a('0x55')](_0x582d84[_0x556a('0x4d')][_0x556a('0x55')]);_0x411ef7[_0x556a('0x56')]=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x582d84[_0x556a('0x4d')],_0xbc7dda[_0x556a('0x4e')]));_0x411ef7['where'][_0x556a('0x6f')]=_0x2cde6b['id'];if(_0x582d84[_0x556a('0x4d')]['filter']){_0x411ef7[_0x556a('0x56')]=_[_0x556a('0x58')](_0x411ef7[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x411ef7[_0x556a('0x50')],function(_0x484b80){var _0x3644e1={};_0x3644e1[_0x484b80]={'$like':'%'+_0x582d84['query'][_0x556a('0x57')]+'%'};return _0x3644e1;})});}_0x411ef7=_[_0x556a('0x58')]({},_0x411ef7,_0x582d84['options']);return db[_0x556a('0x70')][_0x556a('0x36')]({'where':_0x411ef7['where']})[_0x556a('0x25')](function(_0x4a0b4e){_0x4f7478['count']=_0x4a0b4e;if(_0x582d84['query'][_0x556a('0x60')]){_0x411ef7[_0x556a('0x5b')]=[{'all':!![]}];}return db[_0x556a('0x70')][_0x556a('0x5c')](_0x411ef7);})['then'](function(_0x5dc9b3){_0x4f7478[_0x556a('0x5d')]=_0x5dc9b3;return _0x4f7478;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x421c20,_0x411ef7))[_0x556a('0x62')](handleError(_0x421c20,null));};exports['removeDispositions']=function(_0x2c8ffe,_0x2ae3bc,_0x24e701){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x2c8ffe[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x2ae3bc,null))[_0x556a('0x25')](function(_0x39f4f6){if(_0x39f4f6){return _0x39f4f6[_0x556a('0x75')](_0x2c8ffe[_0x556a('0x4d')][_0x556a('0x76')]);}})[_0x556a('0x25')](respondWithStatusCode(_0x2ae3bc,null))[_0x556a('0x62')](handleError(_0x2ae3bc,null));};exports[_0x556a('0x77')]=function(_0x58c508,_0x2632fc,_0x27c02f){if(_0x58c508[_0x556a('0x6d')]['id']){delete _0x58c508[_0x556a('0x6d')]['id'];}return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x58c508[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2632fc,null))[_0x556a('0x25')](function(_0x4e9178){if(_0x4e9178){_0x58c508[_0x556a('0x6d')][_0x556a('0x6f')]=_0x4e9178['id'];return db['CannedAnswer'][_0x556a('0x63')](_0x58c508['body']);}})[_0x556a('0x25')](respondWithResult(_0x2632fc,null))[_0x556a('0x62')](handleError(_0x2632fc,null));};exports[_0x556a('0x78')]=function(_0x320542,_0x2954c6,_0x471931){var _0x1b9713={'raw':![],'where':{}};var _0x1d24ef={};var _0x4b3d93={'count':0x0,'rows':[]};return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x320542[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2954c6,null))['then'](function(_0x2aa5cf){if(_0x2aa5cf){_0x1d24ef[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x79')][_0x556a('0x47')]);_0x1d24ef[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x320542[_0x556a('0x4d')]);_0x1d24ef[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x1d24ef[_0x556a('0x4b')],_0x1d24ef[_0x556a('0x4d')]);_0x1b9713['attributes']=_['intersection'](_0x1d24ef[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x320542['query'][_0x556a('0x51')]));_0x1b9713[_0x556a('0x50')]=_0x1b9713[_0x556a('0x50')][_0x556a('0x52')]?_0x1b9713[_0x556a('0x50')]:_0x1d24ef[_0x556a('0x4b')];if(!_0x320542[_0x556a('0x4d')][_0x556a('0x73')]('nolimit')){_0x1b9713[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x320542[_0x556a('0x4d')]['limit']);_0x1b9713[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x320542[_0x556a('0x4d')][_0x556a('0x33')]);}_0x1b9713['order']=qs[_0x556a('0x55')](_0x320542[_0x556a('0x4d')][_0x556a('0x55')]);_0x1b9713[_0x556a('0x56')]=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x320542[_0x556a('0x4d')],_0x1d24ef[_0x556a('0x4e')]));_0x1b9713[_0x556a('0x56')][_0x556a('0x6f')]=_0x2aa5cf['id'];if(_0x320542['query']['filter']){_0x1b9713['where']=_[_0x556a('0x58')](_0x1b9713[_0x556a('0x56')],{'$or':_['map'](_0x1b9713[_0x556a('0x50')],function(_0x439b4f){var _0x389d6b={};_0x389d6b[_0x439b4f]={'$like':'%'+_0x320542[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x389d6b;})});}_0x1b9713=_['merge']({},_0x1b9713,_0x320542[_0x556a('0x5a')]);return db['CannedAnswer'][_0x556a('0x36')]({'where':_0x1b9713[_0x556a('0x56')]})['then'](function(_0x3ee588){_0x4b3d93['count']=_0x3ee588;if(_0x320542[_0x556a('0x4d')][_0x556a('0x60')]){_0x1b9713[_0x556a('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x556a('0x5c')](_0x1b9713);})['then'](function(_0x2664e8){_0x4b3d93[_0x556a('0x5d')]=_0x2664e8;return _0x4b3d93;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x2954c6,_0x1b9713))[_0x556a('0x62')](handleError(_0x2954c6,null));};exports['removeAnswers']=function(_0x409dba,_0xa7f937,_0x160ae7){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x409dba[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0xa7f937,null))[_0x556a('0x25')](function(_0x508359){if(_0x508359){return _0x508359[_0x556a('0x7a')](_0x409dba['query'][_0x556a('0x76')]);}})[_0x556a('0x25')](respondWithStatusCode(_0xa7f937,null))[_0x556a('0x62')](handleError(_0xa7f937,null));};exports[_0x556a('0x7b')]=function(_0x1bdf9f,_0x32dda8,_0x641baf){var _0x57f902={'channel':_0x556a('0x7c')};var _0xeee939=[];var _0x45c590=[];var _0x512113={};return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x1bdf9f[_0x556a('0x5f')]['id']},'include':[{'model':db[_0x556a('0x7d')],'as':_0x556a('0x7e')}]})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x2e6685){_0x57f902['account']=_0x2e6685;_0x57f902[_0x556a('0x7f')]=_[_0x556a('0x80')](_0x2e6685[_0x556a('0x7e')],['priority'],['asc']);if(_0x57f902['account']['Applications']){delete _0x57f902[_0x556a('0x81')][_0x556a('0x7e')];}return db[_0x556a('0x82')][_0x556a('0x6e')]();})[_0x556a('0x25')](function(_0x309814){if(!_0x309814){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0x85'));}_0xeee939=_['difference'](_['keys'](_0x309814),[_0x556a('0x86'),'updatedAt']);_0x45c590=_['difference'](_['keys'](_0x309814),[_0x556a('0x86'),_0x556a('0x87'),_0x556a('0x88'),_0x556a('0x89')]);_0x57f902['body']={'mapKey':_0x556a('0x8a')};if(_0x57f902['account']['type']){switch(_0x57f902[_0x556a('0x81')][_0x556a('0x49')]){case _0x556a('0x8b'):_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')]['From'];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body']['Body'];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f['body'][_0x556a('0x8e')];break;case _0x556a('0x8f'):_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]='+'+_0x1bdf9f[_0x556a('0x6d')]['sender'];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body']['text'];break;case'connectel':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x8c')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x2e')];break;case _0x556a('0x90'):_0x57f902[_0x556a('0x6d')]['from']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x8c')];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x6d')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f['body'][_0x556a('0x91')];break;case _0x556a('0x92'):_0x57f902['body'][_0x556a('0x8c')]=_0x1bdf9f['body'][_0x556a('0x93')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x94')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x95')];break;case _0x556a('0x96'):_0x57f902['body'][_0x556a('0x8c')]='+'+_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x8c')];_0x57f902['body']['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x98')];_0x57f902['body'][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x8d')];break;case'csc':_0x57f902[_0x556a('0x6d')]['from']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x99')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body'][_0x556a('0x9a')][_0x556a('0x2e')];break;case'clickatell':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')]['fromNumber'];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x98')];_0x57f902[_0x556a('0x6d')]['messageId']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x9b')];break;case _0x556a('0x9c'):_0x57f902[_0x556a('0x6d')]['messageId']=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['id'];_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['from'];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['text'];break;case _0x556a('0x9d'):_0x57f902['body'][_0x556a('0x8c')]=_0x1bdf9f['body']['from'];_0x57f902['body'][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x2e')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x9e')];break;}}if(_0x57f902[_0x556a('0x6d')]['id']){delete _0x57f902['body']['id'];}if(_[_0x556a('0x9f')](_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa0'));}if(_[_0x556a('0x9f')](_0x57f902['body'][_0x556a('0x6d')])||_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]===''){throw new db[(_0x556a('0x83'))]['ValidationError'](_0x556a('0xa1'));}if(_['isNil'](_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa3')+_0x45c590);}if(!_[_0x556a('0xa4')](_0x45c590,_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa5')+_0x45c590);}_0x512113[_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')]]=_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')];return db[_0x556a('0xa6')][_0x556a('0x61')]({'where':{'id':_0x57f902[_0x556a('0x81')][_0x556a('0x89')]},'include':[{'model':db[_0x556a('0x82')],'as':_0x556a('0xa7'),'where':_0x512113,'limit':0x1,'order':[['updatedAt',_0x556a('0xa8')]]}]});})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x19a6f1){if(_0x19a6f1){_0x57f902['list']=_[_0x556a('0xa9')](_0x19a6f1,['Contacts']);if(_0x19a6f1[_0x556a('0xa7')]['length']){return _0x19a6f1[_0x556a('0xa7')][0x0];}var _0x2622a1=_['defaults'](_0x57f902['body'],{'firstName':_0x57f902['body'][_0x556a('0x8c')],'ListId':_0x19a6f1['id']});_0x2622a1[_0x57f902['body'][_0x556a('0xa2')]]=_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')];return db[_0x556a('0x82')]['create'](_0x2622a1,{'fields':_0xeee939,'raw':!![]});}})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x1f4051){if(_0x1f4051){_0x57f902['contact']=_0x1f4051;var _0x306f18={'ContactId':_0x1f4051['id'],'phone':_0x57f902['body'][_0x556a('0x8c')],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id']};var _0x5efeee={'ContactId':_0x1f4051['id'],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id'],'closed':![]};return db[_0x556a('0xaa')][_0x556a('0x61')]({'where':_0x5efeee})['then'](function(_0x2f653b){if(_0x2f653b){return[_0x2f653b,![]];}return db['SmsInteraction']['create'](_0x306f18)[_0x556a('0x25')](function(_0x555cfe){return[_0x555cfe,!![]];});});}})[_0x556a('0xab')](function(_0x117051,_0x4a6296){_0x57f902[_0x556a('0xac')]=_0x117051[_0x556a('0x64')]({'plain':!![]});_0x57f902[_0x556a('0xac')][_0x556a('0xad')]=![];if(_0x4a6296){if(_0x57f902[_0x556a('0x81')]['autoclose']){_0x57f902[_0x556a('0x7f')][_0x556a('0xae')]({'id':0x0,'priority':_0x57f902['applications']['length']+0x1,'app':_0x556a('0xaf'),'appdata':_0x556a('0xb0'),'interval':_0x556a('0xb1')});}_0x57f902['interaction'][_0x556a('0xad')]=!![];}return db[_0x556a('0xb2')]['create']({'phone':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')],'messageId':_0x57f902[_0x556a('0x6d')]['messageId'],'body':_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id'],'SmsInteractionId':_0x117051['id'],'direction':'in','ContactId':_0x117051[_0x556a('0xb3')],'AttachmentId':_0x57f902[_0x556a('0x6d')][_0x556a('0xb4')]});})[_0x556a('0x25')](function(_0x82ca41){_0x57f902[_0x556a('0x2e')]=_0x82ca41;if(_0x57f902[_0x556a('0xac')][_0x556a('0xb5')]){return db[_0x556a('0xb6')][_0x556a('0x61')]({'attributes':['id',_0x556a('0x40')],'where':{'id':_0x57f902[_0x556a('0xac')][_0x556a('0xb5')]}})['then'](function(_0x37b93c){if(_0x37b93c){_0x57f902[_0x556a('0x7f')][_0x556a('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37b93c[_0x556a('0x40')]+','+(_0x57f902[_0x556a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x556a('0xb1')});}return respondWithRpcPromise(_0x556a('0xb8'),_0x556a('0xb9'),_0x57f902);});}return respondWithRpcPromise(_0x556a('0xb8'),_0x556a('0xb9'),_0x57f902);})['then'](function(_0x3f02c6){if(_0x3f02c6){var _0x10e0b9=0xc8;var _0x2ac1dd='receiveMessage';logger[_0x556a('0x26')](_0x556a('0x29'),_0x2ac1dd,_0x10e0b9,_0x556a('0xba'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2ac1dd,_0x10e0b9,_0x556a('0xba'),JSON[_0x556a('0x2a')](_0x3f02c6));if(_0x57f902[_0x556a('0x81')]['type']===_0x556a('0x8b')){return _0x32dda8[_0x556a('0x31')](_0x10e0b9)[_0x556a('0x37')](_0x556a('0xbb'),_0x556a('0xbc'))[_0x556a('0x41')](_0x556a('0xbd'));}else{return _0x32dda8[_0x556a('0x31')](_0x10e0b9)['json'](_0x3f02c6);}}})[_0x556a('0x62')](handleError(_0x32dda8,null));};exports[_0x556a('0xbe')]=function(_0xbfb62e,_0x37e7b7){var _0xbf168f=_0xbfb62e[_0x556a('0x5f')]['id'];var _0x42ce03=_0xbfb62e[_0x556a('0x6d')];var _0x5b9119=0xc8;var _0x506a64=null;return db[_0x556a('0xbf')]['transaction']({'isolationLevel':db[_0x556a('0xbf')][_0x556a('0xc0')]['ISOLATION_LEVELS'][_0x556a('0xc1')]},function(_0x50784e){return db['SmsAccount']['findOne']({'where':{'id':_0xbf168f},'transaction':_0x50784e})[_0x556a('0x25')](function(_0xda4ea7){if(_0xda4ea7){return db[_0x556a('0x7d')][_0x556a('0x3c')]({'where':{'SmsAccountId':_0xbf168f},'transaction':_0x50784e})['then'](function(){var _0x49ce96=_[_0x556a('0x45')](_0x42ce03,function(_0x502068){_0x502068['SmsAccountId']=_0xbf168f;return _0x502068;});return db['SmsApplication'][_0x556a('0xc2')](_0x49ce96,{'transaction':_0x50784e});});}else{_0x5b9119=0x194;_0x506a64=[];}});})[_0x556a('0x25')](function(){if(_0x5b9119!==0x194){return db[_0x556a('0x7d')][_0x556a('0xc3')]({'where':{'SmsAccountId':_0xbf168f},'order':_0x556a('0xc4')})[_0x556a('0x25')](function(_0x2ac40f){_0x506a64=_0x2ac40f;});}})[_0x556a('0x62')](function(_0x2d6673){_0x5b9119=0x1f4;logger[_0x556a('0x2b')](_0x2d6673[_0x556a('0x3f')]);if(_0x2d6673[_0x556a('0x40')]){delete _0x2d6673[_0x556a('0x40')];}_0x506a64=_0x2d6673;})['finally'](function(){if(_0x506a64===null){_0x37e7b7[_0x556a('0x30')](_0x5b9119);}else{if(_0x5b9119===0x1f4){_0x37e7b7['status'](_0x5b9119)[_0x556a('0x41')](_0x506a64);}else{_0x37e7b7[_0x556a('0x31')](_0x5b9119)[_0x556a('0x32')](_0x506a64);}}});};exports[_0x556a('0xc5')]=function(_0x25e85f,_0xe3b3e3,_0x3278df){var _0x944def={};var _0x3ec178={};var _0x2b3114;var _0x4774f6;return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x25e85f[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0xe3b3e3,null))[_0x556a('0x25')](function(_0x57e922){if(_0x57e922){_0x2b3114=_0x57e922;_0x3ec178[_0x556a('0x4b')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x3ec178[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x25e85f['query']);_0x3ec178[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x3ec178['model'],_0x3ec178[_0x556a('0x4d')]);_0x944def['attributes']=_['intersection'](_0x3ec178['model'],qs[_0x556a('0x51')](_0x25e85f['query'][_0x556a('0x51')]));_0x944def['attributes']=_0x944def[_0x556a('0x50')]['length']?_0x944def[_0x556a('0x50')]:_0x3ec178[_0x556a('0x4b')];_0x944def[_0x556a('0x54')]=qs[_0x556a('0x55')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x55')]);_0x944def['where']=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x25e85f['query'],_0x3ec178['filters']));if(_0x25e85f[_0x556a('0x4d')][_0x556a('0x57')]){_0x944def[_0x556a('0x56')]=_[_0x556a('0x58')](_0x944def['where'],{'$or':_[_0x556a('0x45')](_0x944def[_0x556a('0x50')],function(_0x5b49f8){var _0x4bfb45={};_0x4bfb45[_0x5b49f8]={'$like':'%'+_0x25e85f[_0x556a('0x4d')]['filter']+'%'};return _0x4bfb45;})});}_0x944def=_[_0x556a('0x58')]({},_0x944def,_0x25e85f[_0x556a('0x5a')]);return _0x2b3114[_0x556a('0xc5')](_0x944def);}})[_0x556a('0x25')](function(_0x1709c4){if(_0x1709c4){_0x4774f6=_0x1709c4[_0x556a('0x52')];if(!_0x25e85f[_0x556a('0x4d')][_0x556a('0x73')](_0x556a('0x53'))){_0x944def[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x34')]);_0x944def[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x33')]);}return _0x2b3114[_0x556a('0xc5')](_0x944def);}})[_0x556a('0x25')](function(_0x3dca0d){if(_0x3dca0d){return _0x3dca0d?{'count':_0x4774f6,'rows':_0x3dca0d}:null;}})[_0x556a('0x25')](respondWithResult(_0xe3b3e3,null))[_0x556a('0x62')](handleError(_0xe3b3e3,null));};exports[_0x556a('0xc6')]=function(_0x42e769,_0x4118d0,_0x10691b){var _0x2c20bb={'raw':![],'where':{}};var _0x3bd8a8={};var _0x559210={'count':0x0,'rows':[]};return db['SmsAccount'][_0x556a('0x72')]({'where':{'id':_0x42e769[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x4118d0,null))['then'](function(_0x564626){if(_0x564626){_0x3bd8a8[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0xaa')]['rawAttributes']);_0x3bd8a8[_0x556a('0x4d')]=_['keys'](_0x42e769[_0x556a('0x4d')]);_0x3bd8a8[_0x556a('0x4e')]=_['intersection'](_0x3bd8a8[_0x556a('0x4b')],_0x3bd8a8[_0x556a('0x4d')]);_0x2c20bb[_0x556a('0x50')]=_[_0x556a('0x4f')](_0x3bd8a8['model'],qs['fields'](_0x42e769['query'][_0x556a('0x51')]));_0x2c20bb[_0x556a('0x50')]=_0x2c20bb[_0x556a('0x50')][_0x556a('0x52')]?_0x2c20bb[_0x556a('0x50')]:_0x3bd8a8[_0x556a('0x4b')];if(!_0x42e769[_0x556a('0x4d')]['hasOwnProperty'](_0x556a('0x53'))){_0x2c20bb[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x42e769[_0x556a('0x4d')]['limit']);_0x2c20bb['offset']=qs[_0x556a('0x33')](_0x42e769['query']['offset']);}_0x2c20bb['order']=qs[_0x556a('0x55')](_0x42e769[_0x556a('0x4d')][_0x556a('0x55')]);_0x2c20bb[_0x556a('0x56')]=qs['filters'](_[_0x556a('0x74')](_0x42e769['query'],_0x3bd8a8[_0x556a('0x4e')]));_0x2c20bb[_0x556a('0x56')][_0x556a('0x6f')]=_0x564626['id'];if(_0x42e769[_0x556a('0x4d')][_0x556a('0x57')]){_0x2c20bb[_0x556a('0x56')]=_[_0x556a('0x58')](_0x2c20bb['where'],{'$or':_[_0x556a('0x45')](_0x2c20bb['attributes'],function(_0x4552a0){var _0x21daa4={};_0x21daa4[_0x4552a0]={'$like':'%'+_0x42e769[_0x556a('0x4d')]['filter']+'%'};return _0x21daa4;})});}_0x2c20bb=_['merge']({},_0x2c20bb,_0x42e769[_0x556a('0x5a')]);return db[_0x556a('0xaa')][_0x556a('0x36')]({'where':_0x2c20bb[_0x556a('0x56')]})['then'](function(_0x3dd6c8){_0x559210[_0x556a('0x36')]=_0x3dd6c8;if(_0x42e769['query'][_0x556a('0x60')]){_0x2c20bb[_0x556a('0x5b')]=[{'model':db[_0x556a('0x82')],'as':_0x556a('0xc7'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x556a('0x40'),_0x556a('0xc8'),_0x556a('0xc9')],'required':![]},{'model':db[_0x556a('0xca')],'as':_0x556a('0xcb'),'attributes':['id',_0x556a('0x40'),_0x556a('0xcc')],'where':_0x42e769['query'][_0x556a('0xcd')]?{'id':_0x42e769['query'][_0x556a('0xcd')]}:undefined,'required':_0x42e769[_0x556a('0x4d')][_0x556a('0xcd')]?!![]:![]}];}return db[_0x556a('0xaa')][_0x556a('0x5c')](_0x2c20bb);})[_0x556a('0x25')](function(_0x2e956b){_0x559210[_0x556a('0x5d')]=_0x2e956b;return _0x559210;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x4118d0,_0x2c20bb))[_0x556a('0x62')](handleError(_0x4118d0,null));};exports[_0x556a('0x41')]=function(_0x2f378d,_0x24a2e5,_0x30097b){var _0x337b38,_0x1e9ce4,_0x4f9f88;if(_[_0x556a('0x9f')](_0x2f378d[_0x556a('0x6d')][_0x556a('0x6d')])||_0x2f378d[_0x556a('0x6d')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x556a('0xa1'));}if(_[_0x556a('0x9f')](_0x2f378d[_0x556a('0x6d')]['to'])){throw new db['Sequelize'][(_0x556a('0x84'))](_0x556a('0xce'));}_0x337b38=_0x2f378d[_0x556a('0x6d')]['to'];return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x2f378d['params']['id']},'include':[{'model':db[_0x556a('0xa6')],'as':'List','include':[{'model':db[_0x556a('0x82')],'as':'Contacts','where':{'mobile':_0x337b38},'limit':0x1,'order':[[_0x556a('0x87'),_0x556a('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x24a2e5,null))[_0x556a('0x25')](function(_0x139043){if(_0x139043&&_0x139043[_0x556a('0xcf')]){_0x1e9ce4=_0x139043['get']({'plain':!![]});if(_0x1e9ce4[_0x556a('0xcf')]&&_0x1e9ce4[_0x556a('0xcf')]['Contacts']['length']){return _0x1e9ce4[_0x556a('0xcf')]['Contacts'][0x0];}return db[_0x556a('0x82')][_0x556a('0x63')](_[_0x556a('0x1d')](_0x2f378d[_0x556a('0x6d')],{'firstName':_0x337b38,'mobile':_0x337b38,'phone':_0x337b38,'ListId':_0x1e9ce4[_0x556a('0x89')]}));}})[_0x556a('0x25')](handleEntityNotFound(_0x24a2e5,null))[_0x556a('0x25')](function(_0x544c57){if(_0x544c57){_0x4f9f88=_0x544c57;return db['SmsInteraction']['find']({'where':{'ContactId':_0x4f9f88['id'],'closed':![],'SmsAccountId':_0x1e9ce4['id']}})[_0x556a('0x25')](function(_0x4cfb25){if(_0x4cfb25){return[_0x4cfb25,![]];}return db[_0x556a('0xaa')][_0x556a('0x63')]({'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id'],'SmsAccountId':_0x1e9ce4['id'],'phone':_0x337b38,'firstMsgDirection':_0x556a('0xd0'),'Messages':[_[_0x556a('0x58')](_0x2f378d[_0x556a('0x6d')],{'read':![],'body':_0x2f378d['body'][_0x556a('0x6d')],'phone':_0x337b38,'SmsAccountId':_0x1e9ce4['id'],'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x556a('0xd1')}]})[_0x556a('0x25')](function(_0x41ce1b){return[_0x41ce1b,!![]];});});}})[_0x556a('0xab')](function(_0x485d01,_0x153a20){if(_0x153a20){return _0x485d01;}return db[_0x556a('0xb2')]['create'](_[_0x556a('0x58')](_0x2f378d['body'],{'read':![],'body':_0x2f378d[_0x556a('0x6d')][_0x556a('0x6d')],'phone':_0x337b38,'SmsAccountId':_0x1e9ce4['id'],'SmsInteractionId':_0x485d01['id'],'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id']}))[_0x556a('0x25')](function(_0x1dc6e5){_0x485d01[_0x556a('0xd2')][_0x556a('0xd1')]=[];_0x485d01[_0x556a('0xd2')][_0x556a('0xd1')]['push'](_0x1dc6e5['dataValues']);return _0x485d01;});})[_0x556a('0x25')](respondWithResult(_0x24a2e5,null))[_0x556a('0x62')](handleError(_0x24a2e5,null));};exports['status']=function(_0x49025d,_0x5465e7,_0x50d001){if(_0x49025d[_0x556a('0x6d')]['id']){delete _0x49025d['body']['id'];}var _0x191cd7,_0x497af9,_0x39a8b7;return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x49025d['params']['id']}})['then'](handleEntityNotFound(_0x5465e7,null))[_0x556a('0x25')](function(_0x167180){if(_0x167180){_0x39a8b7=_0x167180;logger[_0x556a('0x28')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xd3'),_0x167180[_0x556a('0x49')],util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));switch(_0x167180[_0x556a('0x49')]){case _0x556a('0x8f'):if(_0x49025d[_0x556a('0x6d')]['skebby_dispatch_id']&&_0x49025d['body'][_0x556a('0x31')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0x31')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0xd5')]}});}break;case _0x556a('0xd6'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0xd7')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0xd8')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0xd8')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d['body'][_0x556a('0xd7')]}});}break;case _0x556a('0x90'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0x91')]&&_0x49025d['body'][_0x556a('0xd9')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0xd9')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0x91')]}});}break;case _0x556a('0x96'):var _0x529c79=_0x49025d[_0x556a('0x6d')][_0x556a('0x97')][0x0];if(_0x529c79[_0x556a('0x8d')]&&_0x529c79[_0x556a('0x31')][_0x556a('0xda')]===_0x556a('0xdb')){_0x497af9=_0x529c79[_0x556a('0x31')][_0x556a('0xda')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x529c79[_0x556a('0x8d')]}});}break;case _0x556a('0xdc'):if(_0x49025d['body'][_0x556a('0x8d')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0x31')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0x31')];return db['SmsMessage'][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0x8d')]}});}break;case _0x556a('0x9c'):if(_0x49025d[_0x556a('0x6d')][0x0]['message']['id']){_0x497af9=_0x49025d['body'][0x0][_0x556a('0x49')];return db[_0x556a('0xb2')]['find']({'where':{'messageId':_0x49025d['body'][0x0]['message']['id']}});}break;case _0x556a('0x9d'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0xdd')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0x31')]){_0x497af9=_0x49025d['body']['status'];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x5465e7,null))['then'](function(_0x2dab57){if(_0x2dab57){_0x191cd7=_0x2dab57;switch(_0x39a8b7[_0x556a('0x49')]){case _0x556a('0x8f'):if(_0x497af9==='DELIVERED'){return _0x191cd7['update']({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x8f'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0xd6'):if(_0x497af9==='1'){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x8f'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x90'):if(!_0x49025d['body'][_0x556a('0xde')]&&_0x497af9>=0xc8&&_0x497af9<=0xce){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),'clicksend',util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x96'):var _0x5d1d51=_0x49025d[_0x556a('0x6d')][_0x556a('0x97')][0x0];if(_0x5d1d51['status'][_0x556a('0xda')]===_0x556a('0xdb')){return _0x191cd7['update']({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),'infobip',util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x497af9==_0x556a('0xdf')||_0x497af9=='RECEIVED_BY_RECIPIENT'){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),'status',_0x556a('0xdc'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x9c'):if(_0x497af9==_0x556a('0xe0')){return _0x191cd7['update']({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x9c'),util['inspect'](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x9d'):if(_0x497af9===_0x556a('0xe1')||_0x497af9===_0x556a('0xe2')){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x9d'),util['inspect'](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;}return _0x191cd7;}})[_0x556a('0x25')](respondWithResult(_0x5465e7,null))[_0x556a('0x62')](handleError(_0x5465e7,null));};exports['statusGet']=function(_0x48673d,_0x5e127a,_0x32a556){var _0x339ed5,_0xb9a58a,_0x3f942e;return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x48673d[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x5e127a,null))[_0x556a('0x25')](function(_0x3b11d5){if(_0x3b11d5){_0x3f942e=_0x3b11d5;logger['debug'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xd3'),_0x3b11d5[_0x556a('0x49')],util[_0x556a('0xd4')](_0x48673d[_0x556a('0x4d')],{'showHidden':![],'depth':null}));switch(_0x3b11d5['type']){case _0x556a('0xe3'):if(_0x48673d[_0x556a('0x4d')][_0x556a('0xe4')]&&_0x48673d[_0x556a('0x4d')][_0x556a('0xe5')]){_0xb9a58a=_0x48673d[_0x556a('0x4d')][_0x556a('0xe5')];return db['SmsMessage'][_0x556a('0x61')]({'where':{'messageId':_0x48673d[_0x556a('0x4d')][_0x556a('0xe4')]}});}break;}}})[_0x556a('0x25')](handleEntityNotFound(_0x5e127a,null))[_0x556a('0x25')](function(_0x240a30){if(_0x240a30){_0x339ed5=_0x240a30;switch(_0x3f942e[_0x556a('0x49')]){case _0x556a('0xe3'):if(_0xb9a58a==='2'||_0xb9a58a==='6'){return _0x339ed5['update']({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xe3'),util[_0x556a('0xd4')](_0x48673d[_0x556a('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x339ed5;}})[_0x556a('0x25')](respondWithResult(_0x5e127a,null))['catch'](handleError(_0x5e127a,null));};exports[_0x556a('0xe6')]=function(_0x4bb1db,_0x528e1b,_0x240472){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x4bb1db[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x528e1b,null))[_0x556a('0x25')](function(_0x43876b){if(_0x43876b){return _0x43876b[_0x556a('0xe6')](_0x4bb1db['body']['ids'],_[_0x556a('0xa9')](_0x4bb1db[_0x556a('0x6d')],[_0x556a('0x76'),'id'])||{})[_0x556a('0xab')](function(_0x11ab83){for(var _0x2df562=0x0;_0x2df562<_0x4bb1db['body'][_0x556a('0x76')][_0x556a('0x52')];_0x2df562+=0x1){socket['emit'](_0x556a('0xe7'),{'UserId':Number(_0x4bb1db[_0x556a('0x6d')][_0x556a('0x76')][_0x2df562]),'SmsAccountId':Number(_0x4bb1db[_0x556a('0x5f')]['id'])});}return _0x11ab83;});}})[_0x556a('0x25')](respondWithResult(_0x528e1b,null))[_0x556a('0x62')](handleError(_0x528e1b,null));};exports[_0x556a('0xe8')]=function(_0x21047e,_0x1dbf1c,_0x30c0a0){return db['SmsAccount'][_0x556a('0x61')]({'where':{'id':_0x21047e[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x1dbf1c,null))['then'](function(_0x1f9f35){if(_0x1f9f35){return _0x1f9f35['removeAgents'](_0x21047e[_0x556a('0x4d')]['ids'])['then'](function(){if(_[_0x556a('0xe9')](_0x21047e[_0x556a('0x4d')]['ids'])){for(var _0x389cee=0x0;_0x389cee<_0x21047e['query'][_0x556a('0x76')][_0x556a('0x52')];_0x389cee+=0x1){socket[_0x556a('0xea')](_0x556a('0xeb'),{'UserId':Number(_0x21047e[_0x556a('0x4d')][_0x556a('0x76')][_0x389cee]),'SmsAccountId':Number(_0x21047e[_0x556a('0x5f')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x21047e[_0x556a('0x4d')][_0x556a('0x76')]),'SmsAccountId':Number(_0x21047e[_0x556a('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dbf1c,null))['catch'](handleError(_0x1dbf1c,null));};exports[_0x556a('0xec')]=function(_0x32a7c0,_0x372eba,_0x5e3ad9){var _0x566c07={};var _0x3445c1={};var _0x56aa87;var _0x4503df;return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x32a7c0[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x372eba,null))['then'](function(_0x4e7bd){if(_0x4e7bd){_0x56aa87=_0x4e7bd;_0x3445c1[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0xb6')]['rawAttributes']);_0x3445c1['query']=_[_0x556a('0x4c')](_0x32a7c0[_0x556a('0x4d')]);_0x3445c1[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x3445c1[_0x556a('0x4b')],_0x3445c1['query']);_0x566c07['attributes']=_[_0x556a('0x4f')](_0x3445c1[_0x556a('0x4b')],qs['fields'](_0x32a7c0['query']['fields']));_0x566c07[_0x556a('0x50')]=_0x566c07[_0x556a('0x50')][_0x556a('0x52')]?_0x566c07[_0x556a('0x50')]:_0x3445c1['model'];_0x566c07['order']=qs[_0x556a('0x55')](_0x32a7c0[_0x556a('0x4d')][_0x556a('0x55')]);_0x566c07['where']=qs['filters'](_['pick'](_0x32a7c0['query'],_0x3445c1['filters']));if(_0x32a7c0[_0x556a('0x4d')][_0x556a('0x57')]){_0x566c07[_0x556a('0x56')]=_[_0x556a('0x58')](_0x566c07[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x566c07[_0x556a('0x50')],function(_0x9a1a5d){var _0x4b3d2e={};_0x4b3d2e[_0x9a1a5d]={'$like':'%'+_0x32a7c0[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x4b3d2e;})});}_0x566c07=_['merge']({},_0x566c07,_0x32a7c0[_0x556a('0x5a')]);return _0x56aa87[_0x556a('0xec')](_0x566c07);}})[_0x556a('0x25')](function(_0x70d919){if(_0x70d919){_0x4503df=_0x70d919[_0x556a('0x52')];if(!_0x32a7c0[_0x556a('0x4d')]['hasOwnProperty'](_0x556a('0x53'))){_0x566c07[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x32a7c0['query'][_0x556a('0x34')]);_0x566c07[_0x556a('0x33')]=qs['offset'](_0x32a7c0[_0x556a('0x4d')][_0x556a('0x33')]);}return _0x56aa87[_0x556a('0xec')](_0x566c07);}})[_0x556a('0x25')](function(_0x4d8fdd){if(_0x4d8fdd){return _0x4d8fdd?{'count':_0x4503df,'rows':_0x4d8fdd}:null;}})[_0x556a('0x25')](respondWithResult(_0x372eba,null))[_0x556a('0x62')](handleError(_0x372eba,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 264c7d6..ef8e641 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 _0xa9fc=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x4feee0,_0x357f7d){var _0x314a92=function(_0x3151ec){while(--_0x3151ec){_0x4feee0['push'](_0x4feee0['shift']());}};_0x314a92(++_0x357f7d);}(_0xa9fc,0x1e9));var _0xca9f=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xa9fc[_0x40911a];return _0x27e8e3;};'use strict';var EventEmitter=require(_0xca9f('0x0'));var SmsAccount=require(_0xca9f('0x1'))['db'][_0xca9f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xca9f('0x3')](0x0);var events={'afterCreate':_0xca9f('0x4'),'afterUpdate':_0xca9f('0x5'),'afterDestroy':_0xca9f('0x6')};function emitEvent(_0x5728ec){return function(_0x1b83a1,_0x54acc7,_0x28ee66){SmsAccountEvents['emit'](_0x5728ec+':'+_0x1b83a1['id'],_0x1b83a1);SmsAccountEvents[_0xca9f('0x7')](_0x5728ec,_0x1b83a1);_0x28ee66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xca9f('0x8')](e,emitEvent(event));}}module[_0xca9f('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x2dd8=['../../mysqldb','save','update','remove','hasOwnProperty','hook'];(function(_0x20ad70,_0x301f5b){var _0x53509c=function(_0x14c70f){while(--_0x14c70f){_0x20ad70['push'](_0x20ad70['shift']());}};_0x53509c(++_0x301f5b);}(_0x2dd8,0xf0));var _0x82dd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dd8[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x82dd('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82dd('0x1'),'afterUpdate':_0x82dd('0x2'),'afterDestroy':_0x82dd('0x3')};function emitEvent(_0x3993dc){return function(_0x537c13,_0x248e10,_0x4e3a5f){SmsAccountEvents['emit'](_0x3993dc+':'+_0x537c13['id'],_0x537c13);SmsAccountEvents['emit'](_0x3993dc,_0x537c13);_0x4e3a5f(null);};}for(var e in events){if(events[_0x82dd('0x4')](e)){var event=events[e];SmsAccount[_0x82dd('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9e51460..5f1c58d 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 _0x7a65=['define','SmsAccount','util','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes'];(function(_0x2b8722,_0x50d540){var _0x20c180=function(_0x595b40){while(--_0x595b40){_0x2b8722['push'](_0x2b8722['shift']());}};_0x20c180(++_0x50d540);}(_0x7a65,0xd1));var _0x57a6=function(_0x25a799,_0x4367db){_0x25a799=_0x25a799-0x0;var _0x6d5a07=_0x7a65[_0x25a799];return _0x6d5a07;};'use strict';var _=require('lodash');var util=require(_0x57a6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x57a6('0x1'));var BPromise=require(_0x57a6('0x2'));var rp=require(_0x57a6('0x3'));var fs=require('fs');var path=require(_0x57a6('0x4'));var rimraf=require(_0x57a6('0x5'));var config=require('../../config/environment');var attributes=require(_0x57a6('0x6'));module['exports']=function(_0x3518ab,_0x248f7b){return _0x3518ab[_0x57a6('0x7')](_0x57a6('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83c9=['bluebird','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','api'];(function(_0x5b3302,_0x2c5760){var _0x47f39d=function(_0x24fe9c){while(--_0x24fe9c){_0x5b3302['push'](_0x5b3302['shift']());}};_0x47f39d(++_0x2c5760);}(_0x83c9,0x1b5));var _0x983c=function(_0xa1671c,_0x57700d){_0xa1671c=_0xa1671c-0x0;var _0x2107f0=_0x83c9[_0xa1671c];return _0x2107f0;};'use strict';var _=require(_0x983c('0x0'));var util=require(_0x983c('0x1'));var logger=require('../../config/logger')(_0x983c('0x2'));var moment=require('moment');var BPromise=require(_0x983c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x983c('0x4'));var config=require(_0x983c('0x5'));var attributes=require('./smsAccount.attributes');module[_0x983c('0x6')]=function(_0x54b389,_0x4a9712){return _0x54b389[_0x983c('0x7')](_0x983c('0x8'),attributes,{'tableName':_0x983c('0x9'),'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 bf23339..1a75f68 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 _0xc3c9=['debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','options','raw','where','map','attributes','include'];(function(_0x41b3e8,_0x1ac613){var _0x572746=function(_0x138059){while(--_0x138059){_0x41b3e8['push'](_0x41b3e8['shift']());}};_0x572746(++_0x1ac613);}(_0xc3c9,0x1c8));var _0x9c3c=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0xc3c9[_0x11503f];return _0x34caab;};'use strict';var _=require(_0x9c3c('0x0'));var util=require(_0x9c3c('0x1'));var moment=require(_0x9c3c('0x2'));var BPromise=require(_0x9c3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c3c('0x4'));var db=require(_0x9c3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c3c('0x6'))(_0x9c3c('0x7'));var config=require(_0x9c3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c3c('0x9')][_0x9c3c('0xa')]({'port':0x232a});config[_0x9c3c('0xb')]=_[_0x9c3c('0xc')](config[_0x9c3c('0xb')],{'host':_0x9c3c('0xd'),'port':0x18eb});var socket=require(_0x9c3c('0xe'))(new Redis(config[_0x9c3c('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0xf4f2db,_0x2e5b76,_0x458e12){return new BPromise(function(_0x1b1cd9,_0x9b5eaa){return client[_0x9c3c('0xf')](_0xf4f2db,_0x458e12)[_0x9c3c('0x10')](function(_0x3d6fa7){logger['info'](_0x9c3c('0x11'),_0x2e5b76,_0x9c3c('0x12'));logger['debug'](_0x9c3c('0x13'),_0x2e5b76,_0x9c3c('0x12'),JSON[_0x9c3c('0x14')](_0x3d6fa7));if(_0x3d6fa7[_0x9c3c('0x15')]){if(_0x3d6fa7['error'][_0x9c3c('0x16')]===0x1f4){logger[_0x9c3c('0x15')](_0x9c3c('0x11'),_0x2e5b76,_0x3d6fa7[_0x9c3c('0x15')][_0x9c3c('0x17')]);return _0x9b5eaa(_0x3d6fa7[_0x9c3c('0x15')][_0x9c3c('0x17')]);}logger[_0x9c3c('0x15')](_0x9c3c('0x11'),_0x2e5b76,_0x3d6fa7[_0x9c3c('0x15')]['message']);return _0x1b1cd9(_0x3d6fa7['error'][_0x9c3c('0x17')]);}else{logger[_0x9c3c('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2e5b76,_0x9c3c('0x12'));_0x1b1cd9(_0x3d6fa7[_0x9c3c('0x19')][_0x9c3c('0x17')]);}})[_0x9c3c('0x1a')](function(_0x222bd8){logger[_0x9c3c('0x15')](_0x9c3c('0x11'),_0x2e5b76,_0x222bd8);_0x9b5eaa(_0x222bd8);});});}exports[_0x9c3c('0x1b')]=function(_0x590e77){var _0xf7b8a8=this;return new Promise(function(_0x5e0402,_0x55e37e){return db['SmsAccount']['find']({'raw':_0x590e77[_0x9c3c('0x1c')]?_0x590e77[_0x9c3c('0x1c')][_0x9c3c('0x1d')]===undefined?!![]:![]:!![],'where':_0x590e77[_0x9c3c('0x1c')]?_0x590e77['options'][_0x9c3c('0x1e')]||null:null,'attributes':_0x590e77[_0x9c3c('0x1c')]?_0x590e77[_0x9c3c('0x1c')]['attributes']||null:null,'include':_0x590e77[_0x9c3c('0x1c')]?_0x590e77[_0x9c3c('0x1c')]['include']?_[_0x9c3c('0x1f')](_0x590e77[_0x9c3c('0x1c')]['include'],function(_0x32617d){return{'model':db[_0x32617d['model']],'as':_0x32617d['as'],'attributes':_0x32617d[_0x9c3c('0x20')],'include':_0x32617d[_0x9c3c('0x21')]?_[_0x9c3c('0x1f')](_0x32617d[_0x9c3c('0x21')],function(_0x4c67c7){return{'model':db[_0x4c67c7['model']],'as':_0x4c67c7['as'],'attributes':_0x4c67c7[_0x9c3c('0x20')],'include':_0x4c67c7[_0x9c3c('0x21')]?_[_0x9c3c('0x1f')](_0x4c67c7[_0x9c3c('0x21')],function(_0x4c5616){return{'model':db[_0x4c5616['model']],'as':_0x4c5616['as'],'attributes':_0x4c5616[_0x9c3c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9c3c('0x10')](function(_0x381114){logger['info'](_0x9c3c('0x1b'),_0x590e77);logger[_0x9c3c('0x22')](_0x9c3c('0x1b'),_0x590e77,JSON[_0x9c3c('0x14')](_0x381114));_0x5e0402(_0x381114);})[_0x9c3c('0x1a')](function(_0x1ea890){logger['error'](_0x9c3c('0x1b'),_0x1ea890[_0x9c3c('0x17')],_0x590e77);_0x55e37e(_0xf7b8a8['error'](0x1f4,_0x1ea890[_0x9c3c('0x17')]));});});}; \ No newline at end of file +var _0xf279=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug'];(function(_0x1d402b,_0x37c73b){var _0x5a17ee=function(_0x1b41f4){while(--_0x1b41f4){_0x1d402b['push'](_0x1d402b['shift']());}};_0x5a17ee(++_0x37c73b);}(_0xf279,0xe4));var _0x9f27=function(_0x528ffb,_0x2df4e0){_0x528ffb=_0x528ffb-0x0;var _0x41895=_0xf279[_0x528ffb];return _0x41895;};'use strict';var _=require(_0x9f27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9f27('0x1'));var rs=require(_0x9f27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f27('0x3'))['db'];var utils=require(_0x9f27('0x4'));var logger=require('../../config/logger')(_0x9f27('0x5'));var config=require('../../config/environment');var jayson=require(_0x9f27('0x6'));var client=jayson[_0x9f27('0x7')][_0x9f27('0x8')]({'port':0x232a});config[_0x9f27('0x9')]=_[_0x9f27('0xa')](config[_0x9f27('0x9')],{'host':_0x9f27('0xb'),'port':0x18eb});var socket=require(_0x9f27('0xc'))(new Redis(config[_0x9f27('0x9')]));require(_0x9f27('0xd'))[_0x9f27('0xe')](socket);function respondWithRpcPromise(_0x528a27,_0x5d5dfc,_0x579ac1){return new BPromise(function(_0x110fe9,_0x1bcabe){return client[_0x9f27('0xf')](_0x528a27,_0x579ac1)[_0x9f27('0x10')](function(_0x50bad3){logger[_0x9f27('0x11')](_0x9f27('0x12'),_0x5d5dfc,'request\x20sent');logger['debug'](_0x9f27('0x13'),_0x5d5dfc,_0x9f27('0x14'),JSON[_0x9f27('0x15')](_0x50bad3));if(_0x50bad3[_0x9f27('0x16')]){if(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x17')]===0x1f4){logger[_0x9f27('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5d5dfc,_0x50bad3['error'][_0x9f27('0x18')]);return _0x1bcabe(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x18')]);}logger[_0x9f27('0x16')](_0x9f27('0x12'),_0x5d5dfc,_0x50bad3['error'][_0x9f27('0x18')]);return _0x110fe9(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x18')]);}else{logger[_0x9f27('0x11')](_0x9f27('0x12'),_0x5d5dfc,'request\x20sent');_0x110fe9(_0x50bad3[_0x9f27('0x19')][_0x9f27('0x18')]);}})[_0x9f27('0x1a')](function(_0x2260c9){logger['error'](_0x9f27('0x12'),_0x5d5dfc,_0x2260c9);_0x1bcabe(_0x2260c9);});});}exports[_0x9f27('0x1b')]=function(_0x33ce89){var _0x36814a=this;return new Promise(function(_0xd2d698,_0x3dddcc){return db[_0x9f27('0x1c')][_0x9f27('0x1d')]({'raw':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x1f')]===undefined?!![]:![]:!![],'where':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x20')]||null:null,'attributes':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x21')]||null:null,'include':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x22')]?_[_0x9f27('0x23')](_0x33ce89['options'][_0x9f27('0x22')],function(_0x620382){return{'model':db[_0x620382[_0x9f27('0x24')]],'as':_0x620382['as'],'attributes':_0x620382['attributes'],'include':_0x620382['include']?_[_0x9f27('0x23')](_0x620382['include'],function(_0x1ed8d3){return{'model':db[_0x1ed8d3[_0x9f27('0x24')]],'as':_0x1ed8d3['as'],'attributes':_0x1ed8d3[_0x9f27('0x21')],'include':_0x1ed8d3[_0x9f27('0x22')]?_['map'](_0x1ed8d3[_0x9f27('0x22')],function(_0x143c9b){return{'model':db[_0x143c9b[_0x9f27('0x24')]],'as':_0x143c9b['as'],'attributes':_0x143c9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f27('0x10')](function(_0x176126){logger[_0x9f27('0x11')]('ShowSmsAccount',_0x33ce89);logger[_0x9f27('0x25')](_0x9f27('0x1b'),_0x33ce89,JSON[_0x9f27('0x15')](_0x176126));_0xd2d698(_0x176126);})[_0x9f27('0x1a')](function(_0x5d8651){logger[_0x9f27('0x16')]('ShowSmsAccount',_0x5d8651['message'],_0x33ce89);_0x3dddcc(_0x36814a[_0x9f27('0x16')](0x1f4,_0x5d8651['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5c64e98..a6466f2 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 c958862..b92827a 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x4c8c1e,_0x38a85b){var _0x1b276d=function(_0x17d5de){while(--_0x17d5de){_0x4c8c1e['push'](_0x4c8c1e['shift']());}};_0x1b276d(++_0x38a85b);}(_0x55ca,0x126));var _0xa55c=function(_0x316ad3,_0x24e897){_0x316ad3=_0x316ad3-0x0;var _0x1d81e0=_0x55ca[_0x316ad3];return _0x1d81e0;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x532af2,_0x176b93){var _0x1dbc4e=function(_0x43d3af){while(--_0x43d3af){_0x532af2['push'](_0x532af2['shift']());}};_0x1dbc4e(++_0x176b93);}(_0x55ca,0x126));var _0xa55c=function(_0x46f62c,_0x49eb41){_0x46f62c=_0x46f62c-0x0;var _0x46d994=_0x55ca[_0x46f62c];return _0x46d994;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5979605..55abcf9 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 _0xc4c2=['STRING','noop','*,*,*,*','exports'];(function(_0x23efe6,_0x737a9e){var _0x360532=function(_0x1991a4){while(--_0x1991a4){_0x23efe6['push'](_0x23efe6['shift']());}};_0x360532(++_0x737a9e);}(_0xc4c2,0xc7));var _0x2c4c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xc4c2[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require('sequelize');module[_0x2c4c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2c4c('0x1')],'allowNull':![],'defaultValue':_0x2c4c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2c4c('0x1')]},'interval':{'type':Sequelize[_0x2c4c('0x1')],'defaultValue':_0x2c4c('0x3')}}; \ No newline at end of file +var _0x872e=['TEXT','STRING','*,*,*,*','exports'];(function(_0x24d161,_0x38b6ce){var _0x3e0e8f=function(_0x35c6b4){while(--_0x35c6b4){_0x24d161['push'](_0x24d161['shift']());}};_0x3e0e8f(++_0x38b6ce);}(_0x872e,0x147));var _0xe872=function(_0x1be61e,_0x2a1203){_0x1be61e=_0x1be61e-0x0;var _0x29242d=_0x872e[_0x1be61e];return _0x29242d;};'use strict';var Sequelize=require('sequelize');module[_0xe872('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe872('0x1')]()},'description':{'type':Sequelize[_0xe872('0x2')]},'interval':{'type':Sequelize[_0xe872('0x2')],'defaultValue':_0xe872('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e9ab841..cecb75c 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 _0x3120=['fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','key','query','filters','intersection','model','attributes'];(function(_0x5cb4f0,_0xb16665){var _0x22208=function(_0xa6ac92){while(--_0xa6ac92){_0x5cb4f0['push'](_0x5cb4f0['shift']());}};_0x22208(++_0xb16665);}(_0x3120,0xf1));var _0x0312=function(_0xad2735,_0x51c593){_0xad2735=_0xad2735-0x0;var _0x30fc18=_0x3120[_0xad2735];return _0x30fc18;};'use strict';var emlformat=require(_0x0312('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0312('0x1'));var rp=require(_0x0312('0x2'));var moment=require(_0x0312('0x3'));var BPromise=require(_0x0312('0x4'));var Mustache=require(_0x0312('0x5'));var util=require(_0x0312('0x6'));var path=require(_0x0312('0x7'));var sox=require(_0x0312('0x8'));var csv=require(_0x0312('0x9'));var ejs=require(_0x0312('0xa'));var fs=require('fs');var fs_extra=require(_0x0312('0xb'));var _=require(_0x0312('0xc'));var squel=require(_0x0312('0xd'));var crypto=require(_0x0312('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0312('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0312('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0312('0x11'));var as=require(_0x0312('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0312('0x13'));var config=require(_0x0312('0x14'));var licenseUtil=require(_0x0312('0x15'));var db=require(_0x0312('0x16'))['db'];function respondWithStatusCode(_0x1350c3,_0x38da11){_0x38da11=_0x38da11||0xcc;return function(_0x10de4e){if(_0x10de4e){return _0x1350c3['sendStatus'](_0x38da11);}return _0x1350c3[_0x0312('0x17')](_0x38da11)[_0x0312('0x18')]();};}function respondWithResult(_0x265940,_0x2e3e1c){_0x2e3e1c=_0x2e3e1c||0xc8;return function(_0x4cb1a3){if(_0x4cb1a3){return _0x265940[_0x0312('0x17')](_0x2e3e1c)[_0x0312('0x19')](_0x4cb1a3);}};}function respondWithFilteredResult(_0x221aea,_0x2f4d7f){return function(_0x22819f){if(_0x22819f){var _0x48b12c=typeof _0x2f4d7f['offset']===_0x0312('0x1a')&&typeof _0x2f4d7f['limit']===_0x0312('0x1a');var _0x3d492d=_0x22819f[_0x0312('0x1b')];var _0x46b1fa=_0x48b12c?0x0:_0x2f4d7f[_0x0312('0x1c')];var _0x23d11f=_0x48b12c?_0x22819f['count']:_0x2f4d7f['offset']+_0x2f4d7f[_0x0312('0x1d')];var _0x5eb1eb;if(_0x23d11f>=_0x3d492d){_0x23d11f=_0x3d492d;_0x5eb1eb=0xc8;}else{_0x5eb1eb=0xce;}_0x221aea[_0x0312('0x17')](_0x5eb1eb);return _0x221aea[_0x0312('0x1e')](_0x0312('0x1f'),_0x46b1fa+'-'+_0x23d11f+'/'+_0x3d492d)[_0x0312('0x19')](_0x22819f);}return null;};}function patchUpdates(_0x342e6c){return function(_0x2a0f1a){try{jsonpatch[_0x0312('0x20')](_0x2a0f1a,_0x342e6c,!![]);}catch(_0x5b39d7){return BPromise['reject'](_0x5b39d7);}return _0x2a0f1a[_0x0312('0x21')]();};}function saveUpdates(_0x49f4c8,_0x47eb55){return function(_0x290e73){if(_0x290e73){return _0x290e73[_0x0312('0x22')](_0x49f4c8)[_0x0312('0x23')](function(_0x3d0488){return _0x3d0488;});}return null;};}function removeEntity(_0x382e01,_0x1015b5){return function(_0x4e3c67){if(_0x4e3c67){return _0x4e3c67[_0x0312('0x24')]()[_0x0312('0x23')](function(){_0x382e01[_0x0312('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5582,_0x748e3e){return function(_0x3e6ad0){if(!_0x3e6ad0){_0x2f5582[_0x0312('0x25')](0x194);}return _0x3e6ad0;};}function handleError(_0x2b6f60,_0x403cdb){_0x403cdb=_0x403cdb||0x1f4;return function(_0x200bda){logger[_0x0312('0x26')](_0x200bda[_0x0312('0x27')]);if(_0x200bda[_0x0312('0x28')]){delete _0x200bda[_0x0312('0x28')];}_0x2b6f60['status'](_0x403cdb)[_0x0312('0x29')](_0x200bda);};}exports[_0x0312('0x2a')]=function(_0xaeefdb,_0x21010f){var _0xacb07={},_0x3d323b={},_0x4b09ad={'count':0x0,'rows':[]};var _0x4256fd=_[_0x0312('0x2b')](db[_0x0312('0x2c')]['rawAttributes'],function(_0x49d2d5){return{'name':_0x49d2d5['fieldName'],'type':_0x49d2d5['type'][_0x0312('0x2d')]};});_0x3d323b['model']=_[_0x0312('0x2b')](_0x4256fd,_0x0312('0x28'));_0x3d323b[_0x0312('0x2e')]=_['keys'](_0xaeefdb[_0x0312('0x2e')]);_0x3d323b[_0x0312('0x2f')]=_[_0x0312('0x30')](_0x3d323b[_0x0312('0x31')],_0x3d323b['query']);_0xacb07[_0x0312('0x32')]=_[_0x0312('0x30')](_0x3d323b[_0x0312('0x31')],qs['fields'](_0xaeefdb[_0x0312('0x2e')][_0x0312('0x33')]));_0xacb07['attributes']=_0xacb07[_0x0312('0x32')][_0x0312('0x34')]?_0xacb07[_0x0312('0x32')]:_0x3d323b[_0x0312('0x31')];if(!_0xaeefdb[_0x0312('0x2e')]['hasOwnProperty'](_0x0312('0x35'))){_0xacb07[_0x0312('0x1d')]=qs[_0x0312('0x1d')](_0xaeefdb[_0x0312('0x2e')]['limit']);_0xacb07[_0x0312('0x1c')]=qs[_0x0312('0x1c')](_0xaeefdb[_0x0312('0x2e')]['offset']);}_0xacb07[_0x0312('0x36')]=qs[_0x0312('0x37')](_0xaeefdb[_0x0312('0x2e')][_0x0312('0x37')]);_0xacb07[_0x0312('0x38')]=qs[_0x0312('0x2f')](_[_0x0312('0x39')](_0xaeefdb[_0x0312('0x2e')],_0x3d323b[_0x0312('0x2f')]),_0x4256fd);if(_0xaeefdb[_0x0312('0x2e')][_0x0312('0x3a')]){_0xacb07['where']=_[_0x0312('0x3b')](_0xacb07['where'],{'$or':_[_0x0312('0x2b')](_0x4256fd,function(_0x10dd02){if(_0x10dd02[_0x0312('0x3c')]!==_0x0312('0x3d')){var _0x2ff3f8={};_0x2ff3f8[_0x10dd02[_0x0312('0x28')]]={'$like':'%'+_0xaeefdb[_0x0312('0x2e')][_0x0312('0x3a')]+'%'};return _0x2ff3f8;}})});}_0xacb07=_['merge']({},_0xacb07,_0xaeefdb[_0x0312('0x3e')]);var _0x22ad73={'where':_0xacb07['where']};return db[_0x0312('0x2c')][_0x0312('0x1b')](_0x22ad73)[_0x0312('0x23')](function(_0x34c428){_0x4b09ad[_0x0312('0x1b')]=_0x34c428;if(_0xaeefdb[_0x0312('0x2e')][_0x0312('0x3f')]){_0xacb07[_0x0312('0x40')]=[{'all':!![]}];}return db[_0x0312('0x2c')][_0x0312('0x41')](_0xacb07);})['then'](function(_0x3dcabb){_0x4b09ad['rows']=_0x3dcabb;return _0x4b09ad;})['then'](respondWithFilteredResult(_0x21010f,_0xacb07))['catch'](handleError(_0x21010f,null));};exports[_0x0312('0x42')]=function(_0xdc47f4,_0x4090e7){var _0x1d4a28={'raw':!![],'where':{'id':_0xdc47f4[_0x0312('0x43')]['id']}},_0x3c3856={};_0x3c3856['model']=_[_0x0312('0x44')](db['SmsApplication']['rawAttributes']);_0x3c3856[_0x0312('0x2e')]=_[_0x0312('0x44')](_0xdc47f4[_0x0312('0x2e')]);_0x3c3856['filters']=_[_0x0312('0x30')](_0x3c3856[_0x0312('0x31')],_0x3c3856['query']);_0x1d4a28[_0x0312('0x32')]=_['intersection'](_0x3c3856[_0x0312('0x31')],qs[_0x0312('0x33')](_0xdc47f4[_0x0312('0x2e')]['fields']));_0x1d4a28[_0x0312('0x32')]=_0x1d4a28[_0x0312('0x32')][_0x0312('0x34')]?_0x1d4a28[_0x0312('0x32')]:_0x3c3856[_0x0312('0x31')];if(_0xdc47f4[_0x0312('0x2e')][_0x0312('0x3f')]){_0x1d4a28[_0x0312('0x40')]=[{'all':!![]}];}_0x1d4a28=_[_0x0312('0x3b')]({},_0x1d4a28,_0xdc47f4['options']);return db[_0x0312('0x2c')][_0x0312('0x45')](_0x1d4a28)['then'](handleEntityNotFound(_0x4090e7,null))[_0x0312('0x23')](respondWithResult(_0x4090e7,null))[_0x0312('0x46')](handleError(_0x4090e7,null));};exports[_0x0312('0x47')]=function(_0x53c0d3,_0x14a4d7){return db['SmsApplication']['create'](_0x53c0d3[_0x0312('0x48')],{})[_0x0312('0x23')](respondWithResult(_0x14a4d7,0xc9))['catch'](handleError(_0x14a4d7,null));};exports[_0x0312('0x22')]=function(_0x4e70c1,_0x35bc82){if(_0x4e70c1[_0x0312('0x48')]['id']){delete _0x4e70c1[_0x0312('0x48')]['id'];}return db[_0x0312('0x2c')][_0x0312('0x45')]({'where':{'id':_0x4e70c1['params']['id']}})[_0x0312('0x23')](handleEntityNotFound(_0x35bc82,null))[_0x0312('0x23')](saveUpdates(_0x4e70c1[_0x0312('0x48')],null))[_0x0312('0x23')](respondWithResult(_0x35bc82,null))[_0x0312('0x46')](handleError(_0x35bc82,null));};exports['destroy']=function(_0x4c5759,_0x16985e){return db[_0x0312('0x2c')]['find']({'where':{'id':_0x4c5759[_0x0312('0x43')]['id']}})['then'](handleEntityNotFound(_0x16985e,null))[_0x0312('0x23')](removeEntity(_0x16985e,null))[_0x0312('0x46')](handleError(_0x16985e,null));}; \ No newline at end of file +var _0xcdf6=['offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','name','index','map','SmsApplication','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5393bd,_0x5f3020){var _0x5999d8=function(_0x13aa9d){while(--_0x13aa9d){_0x5393bd['push'](_0x5393bd['shift']());}};_0x5999d8(++_0x5f3020);}(_0xcdf6,0xc6));var _0x6cdf=function(_0x2146f0,_0x45f971){_0x2146f0=_0x2146f0-0x0;var _0x930692=_0xcdf6[_0x2146f0];return _0x930692;};'use strict';var emlformat=require(_0x6cdf('0x0'));var rimraf=require(_0x6cdf('0x1'));var zipdir=require(_0x6cdf('0x2'));var jsonpatch=require(_0x6cdf('0x3'));var rp=require(_0x6cdf('0x4'));var moment=require(_0x6cdf('0x5'));var BPromise=require(_0x6cdf('0x6'));var Mustache=require(_0x6cdf('0x7'));var util=require(_0x6cdf('0x8'));var path=require(_0x6cdf('0x9'));var sox=require(_0x6cdf('0xa'));var csv=require(_0x6cdf('0xb'));var ejs=require(_0x6cdf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6cdf('0xd'));var crypto=require(_0x6cdf('0xe'));var jsforce=require(_0x6cdf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cdf('0xb'));var querystring=require(_0x6cdf('0x10'));var Papa=require(_0x6cdf('0x11'));var Redis=require(_0x6cdf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6cdf('0x13'));var as=require(_0x6cdf('0x14'));var hardwareService=require(_0x6cdf('0x15'));var logger=require(_0x6cdf('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6cdf('0x17'));var licenseUtil=require(_0x6cdf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc8a90c,_0x25f26d){_0x25f26d=_0x25f26d||0xcc;return function(_0x288d0d){if(_0x288d0d){return _0xc8a90c[_0x6cdf('0x19')](_0x25f26d);}return _0xc8a90c[_0x6cdf('0x1a')](_0x25f26d)['end']();};}function respondWithResult(_0x143485,_0x2d832e){_0x2d832e=_0x2d832e||0xc8;return function(_0x193d23){if(_0x193d23){return _0x143485[_0x6cdf('0x1a')](_0x2d832e)['json'](_0x193d23);}};}function respondWithFilteredResult(_0xf9ef48,_0x154b6){return function(_0x6966a0){if(_0x6966a0){var _0x18c658=typeof _0x154b6[_0x6cdf('0x1b')]===_0x6cdf('0x1c')&&typeof _0x154b6[_0x6cdf('0x1d')]===_0x6cdf('0x1c');var _0x541464=_0x6966a0[_0x6cdf('0x1e')];var _0x503d63=_0x18c658?0x0:_0x154b6['offset'];var _0x11b04e=_0x18c658?_0x6966a0['count']:_0x154b6[_0x6cdf('0x1b')]+_0x154b6[_0x6cdf('0x1d')];var _0x18ad72;if(_0x11b04e>=_0x541464){_0x11b04e=_0x541464;_0x18ad72=0xc8;}else{_0x18ad72=0xce;}_0xf9ef48[_0x6cdf('0x1a')](_0x18ad72);return _0xf9ef48[_0x6cdf('0x1f')]('Content-Range',_0x503d63+'-'+_0x11b04e+'/'+_0x541464)[_0x6cdf('0x20')](_0x6966a0);}return null;};}function patchUpdates(_0x1dd6e8){return function(_0x44d84c){try{jsonpatch[_0x6cdf('0x21')](_0x44d84c,_0x1dd6e8,!![]);}catch(_0x13fe68){return BPromise[_0x6cdf('0x22')](_0x13fe68);}return _0x44d84c[_0x6cdf('0x23')]();};}function saveUpdates(_0xcb809a,_0x5bb1b1){return function(_0x2c0d85){if(_0x2c0d85){return _0x2c0d85[_0x6cdf('0x24')](_0xcb809a)[_0x6cdf('0x25')](function(_0xacba80){return _0xacba80;});}return null;};}function removeEntity(_0x1d89a1,_0x3d36f3){return function(_0xa95e44){if(_0xa95e44){return _0xa95e44[_0x6cdf('0x26')]()[_0x6cdf('0x25')](function(){_0x1d89a1[_0x6cdf('0x1a')](0xcc)[_0x6cdf('0x27')]();});}};}function handleEntityNotFound(_0x1e0b1f,_0x3c25fa){return function(_0x2cadc5){if(!_0x2cadc5){_0x1e0b1f[_0x6cdf('0x19')](0x194);}return _0x2cadc5;};}function handleError(_0x4c3370,_0x32ce3c){_0x32ce3c=_0x32ce3c||0x1f4;return function(_0x4b65b1){logger[_0x6cdf('0x28')](_0x4b65b1['stack']);if(_0x4b65b1[_0x6cdf('0x29')]){delete _0x4b65b1[_0x6cdf('0x29')];}_0x4c3370[_0x6cdf('0x1a')](_0x32ce3c)['send'](_0x4b65b1);};}exports[_0x6cdf('0x2a')]=function(_0x553ac3,_0x3544f0){var _0x46fbb3={},_0x3bf683={},_0x144649={'count':0x0,'rows':[]};var _0x349339=_[_0x6cdf('0x2b')](db[_0x6cdf('0x2c')][_0x6cdf('0x2d')],function(_0x34bbab){return{'name':_0x34bbab[_0x6cdf('0x2e')],'type':_0x34bbab[_0x6cdf('0x2f')]['key']};});_0x3bf683['model']=_[_0x6cdf('0x2b')](_0x349339,_0x6cdf('0x29'));_0x3bf683['query']=_[_0x6cdf('0x30')](_0x553ac3[_0x6cdf('0x31')]);_0x3bf683['filters']=_[_0x6cdf('0x32')](_0x3bf683['model'],_0x3bf683[_0x6cdf('0x31')]);_0x46fbb3[_0x6cdf('0x33')]=_[_0x6cdf('0x32')](_0x3bf683[_0x6cdf('0x34')],qs[_0x6cdf('0x35')](_0x553ac3[_0x6cdf('0x31')]['fields']));_0x46fbb3[_0x6cdf('0x33')]=_0x46fbb3['attributes'][_0x6cdf('0x36')]?_0x46fbb3[_0x6cdf('0x33')]:_0x3bf683[_0x6cdf('0x34')];if(!_0x553ac3[_0x6cdf('0x31')]['hasOwnProperty'](_0x6cdf('0x37'))){_0x46fbb3[_0x6cdf('0x1d')]=qs[_0x6cdf('0x1d')](_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x1d')]);_0x46fbb3['offset']=qs[_0x6cdf('0x1b')](_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x1b')]);}_0x46fbb3[_0x6cdf('0x38')]=qs[_0x6cdf('0x39')](_0x553ac3['query'][_0x6cdf('0x39')]);_0x46fbb3['where']=qs[_0x6cdf('0x3a')](_[_0x6cdf('0x3b')](_0x553ac3[_0x6cdf('0x31')],_0x3bf683[_0x6cdf('0x3a')]),_0x349339);if(_0x553ac3['query'][_0x6cdf('0x3c')]){_0x46fbb3[_0x6cdf('0x3d')]=_['merge'](_0x46fbb3[_0x6cdf('0x3d')],{'$or':_[_0x6cdf('0x2b')](_0x349339,function(_0x5da88d){if(_0x5da88d['type']!==_0x6cdf('0x3e')){var _0x31d406={};_0x31d406[_0x5da88d['name']]={'$like':'%'+_0x553ac3['query'][_0x6cdf('0x3c')]+'%'};return _0x31d406;}})});}_0x46fbb3=_[_0x6cdf('0x3f')]({},_0x46fbb3,_0x553ac3[_0x6cdf('0x40')]);var _0x5027f4={'where':_0x46fbb3['where']};return db[_0x6cdf('0x2c')][_0x6cdf('0x1e')](_0x5027f4)[_0x6cdf('0x25')](function(_0x3be497){_0x144649[_0x6cdf('0x1e')]=_0x3be497;if(_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x41')]){_0x46fbb3[_0x6cdf('0x42')]=[{'all':!![]}];}return db[_0x6cdf('0x2c')][_0x6cdf('0x43')](_0x46fbb3);})['then'](function(_0x2d5e3c){_0x144649[_0x6cdf('0x44')]=_0x2d5e3c;return _0x144649;})[_0x6cdf('0x25')](respondWithFilteredResult(_0x3544f0,_0x46fbb3))['catch'](handleError(_0x3544f0,null));};exports[_0x6cdf('0x45')]=function(_0x4f38cb,_0x1ca442){var _0x13c7ac={'raw':!![],'where':{'id':_0x4f38cb[_0x6cdf('0x46')]['id']}},_0xd26674={};_0xd26674[_0x6cdf('0x34')]=_[_0x6cdf('0x30')](db[_0x6cdf('0x2c')]['rawAttributes']);_0xd26674['query']=_[_0x6cdf('0x30')](_0x4f38cb['query']);_0xd26674[_0x6cdf('0x3a')]=_[_0x6cdf('0x32')](_0xd26674[_0x6cdf('0x34')],_0xd26674['query']);_0x13c7ac['attributes']=_['intersection'](_0xd26674['model'],qs[_0x6cdf('0x35')](_0x4f38cb[_0x6cdf('0x31')][_0x6cdf('0x35')]));_0x13c7ac[_0x6cdf('0x33')]=_0x13c7ac['attributes'][_0x6cdf('0x36')]?_0x13c7ac[_0x6cdf('0x33')]:_0xd26674[_0x6cdf('0x34')];if(_0x4f38cb['query'][_0x6cdf('0x41')]){_0x13c7ac[_0x6cdf('0x42')]=[{'all':!![]}];}_0x13c7ac=_[_0x6cdf('0x3f')]({},_0x13c7ac,_0x4f38cb[_0x6cdf('0x40')]);return db['SmsApplication']['find'](_0x13c7ac)[_0x6cdf('0x25')](handleEntityNotFound(_0x1ca442,null))[_0x6cdf('0x25')](respondWithResult(_0x1ca442,null))['catch'](handleError(_0x1ca442,null));};exports[_0x6cdf('0x47')]=function(_0x2afb12,_0x1010a4){return db['SmsApplication'][_0x6cdf('0x47')](_0x2afb12['body'],{})[_0x6cdf('0x25')](respondWithResult(_0x1010a4,0xc9))[_0x6cdf('0x48')](handleError(_0x1010a4,null));};exports[_0x6cdf('0x24')]=function(_0x87e504,_0x37c4e9){if(_0x87e504['body']['id']){delete _0x87e504[_0x6cdf('0x49')]['id'];}return db[_0x6cdf('0x2c')][_0x6cdf('0x4a')]({'where':{'id':_0x87e504[_0x6cdf('0x46')]['id']}})['then'](handleEntityNotFound(_0x37c4e9,null))[_0x6cdf('0x25')](saveUpdates(_0x87e504['body'],null))[_0x6cdf('0x25')](respondWithResult(_0x37c4e9,null))[_0x6cdf('0x48')](handleError(_0x37c4e9,null));};exports[_0x6cdf('0x26')]=function(_0x4f7c69,_0xaa7fc9){return db[_0x6cdf('0x2c')][_0x6cdf('0x4a')]({'where':{'id':_0x4f7c69[_0x6cdf('0x46')]['id']}})['then'](handleEntityNotFound(_0xaa7fc9,null))['then'](removeEntity(_0xaa7fc9,null))[_0x6cdf('0x48')](handleError(_0xaa7fc9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ba1b34a..e909b53 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 _0x4e2b=['utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e2b,0xa9));var _0xb4e2=function(_0x55bca7,_0x2b64be){_0x55bca7=_0x55bca7-0x0;var _0x288a2a=_0x4e2b[_0x55bca7];return _0x288a2a;};'use strict';var _=require('lodash');var util=require(_0xb4e2('0x0'));var logger=require('../../config/logger')(_0xb4e2('0x1'));var moment=require(_0xb4e2('0x2'));var BPromise=require(_0xb4e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4e2('0x4'));var config=require(_0xb4e2('0x5'));var attributes=require('./smsApplication.attributes');module[_0xb4e2('0x6')]=function(_0x32403c,_0x4be661){return _0x32403c[_0xb4e2('0x7')](_0xb4e2('0x8'),attributes,{'tableName':_0xb4e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb4e2('0xa'),'collate':_0xb4e2('0xb')});}; \ No newline at end of file +var _0x1059=['moment','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x1059,0x1ba));var _0x9105=function(_0xdcad6,_0x5b7cc9){_0xdcad6=_0xdcad6-0x0;var _0x294c34=_0x1059[_0xdcad6];return _0x294c34;};'use strict';var _=require(_0x9105('0x0'));var util=require('util');var logger=require(_0x9105('0x1'))('api');var moment=require(_0x9105('0x2'));var BPromise=require('bluebird');var rp=require(_0x9105('0x3'));var fs=require('fs');var path=require(_0x9105('0x4'));var rimraf=require(_0x9105('0x5'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x9105('0x6')]=function(_0x2e21eb,_0x3d8b47){return _0x2e21eb[_0x9105('0x7')](_0x9105('0x8'),attributes,{'tableName':_0x9105('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9105('0xa'),'collate':_0x9105('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 747b619..82dfa72 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 _0xc4d8=['then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x578c02,_0x215428){var _0x5dfa9e=function(_0x4737b1){while(--_0x4737b1){_0x578c02['push'](_0x578c02['shift']());}};_0x5dfa9e(++_0x215428);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc4d8[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x8c4d('0x0'));var util=require('util');var moment=require(_0x8c4d('0x1'));var BPromise=require(_0x8c4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c4d('0x4'));var config=require(_0x8c4d('0x5'));var jayson=require(_0x8c4d('0x6'));var client=jayson[_0x8c4d('0x7')][_0x8c4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15da54,_0x19ac49,_0x75b3d6){return new BPromise(function(_0x3369b8,_0x521b76){return client[_0x8c4d('0x9')](_0x15da54,_0x75b3d6)[_0x8c4d('0xa')](function(_0x36b577){logger[_0x8c4d('0xb')]('SmsApplication,\x20%s,\x20%s',_0x19ac49,'request\x20sent');logger[_0x8c4d('0xc')](_0x8c4d('0xd'),_0x19ac49,_0x8c4d('0xe'),JSON[_0x8c4d('0xf')](_0x36b577));if(_0x36b577[_0x8c4d('0x10')]){if(_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x11')]===0x1f4){logger[_0x8c4d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x19ac49,_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);return _0x521b76(_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);}logger[_0x8c4d('0x10')](_0x8c4d('0x13'),_0x19ac49,_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);return _0x3369b8(_0x36b577['error']['message']);}else{logger[_0x8c4d('0xb')](_0x8c4d('0x13'),_0x19ac49,'request\x20sent');_0x3369b8(_0x36b577[_0x8c4d('0x14')][_0x8c4d('0x12')]);}})[_0x8c4d('0x15')](function(_0x4d8ded){logger[_0x8c4d('0x10')](_0x8c4d('0x13'),_0x19ac49,_0x4d8ded);_0x521b76(_0x4d8ded);});});} \ No newline at end of file +var _0xd142=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x49ea1a,_0x42f485){var _0x1f784f=function(_0x33b589){while(--_0x33b589){_0x49ea1a['push'](_0x49ea1a['shift']());}};_0x1f784f(++_0x42f485);}(_0xd142,0x11a));var _0x2d14=function(_0x12d79d,_0x3c4f12){_0x12d79d=_0x12d79d-0x0;var _0x5cbe01=_0xd142[_0x12d79d];return _0x5cbe01;};'use strict';var _=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var moment=require(_0x2d14('0x2'));var BPromise=require(_0x2d14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d14('0x4'))['db'];var utils=require(_0x2d14('0x5'));var logger=require(_0x2d14('0x6'))(_0x2d14('0x7'));var config=require(_0x2d14('0x8'));var jayson=require(_0x2d14('0x9'));var client=jayson[_0x2d14('0xa')][_0x2d14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb081,_0x2104d6,_0xba6306){return new BPromise(function(_0x1b2d92,_0x4e5f73){return client[_0x2d14('0xc')](_0x5eb081,_0xba6306)[_0x2d14('0xd')](function(_0x581f76){logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));logger['debug'](_0x2d14('0x11'),_0x2104d6,_0x2d14('0x10'),JSON['stringify'](_0x581f76));if(_0x581f76['error']){if(_0x581f76[_0x2d14('0x12')][_0x2d14('0x13')]===0x1f4){logger[_0x2d14('0x12')]('SmsApplication,\x20%s,\x20%s',_0x2104d6,_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);return _0x4e5f73(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}logger['error'](_0x2d14('0xf'),_0x2104d6,_0x581f76[_0x2d14('0x12')]['message']);return _0x1b2d92(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}else{logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));_0x1b2d92(_0x581f76['result'][_0x2d14('0x14')]);}})[_0x2d14('0x15')](function(_0x3e12d3){logger[_0x2d14('0x12')](_0x2d14('0xf'),_0x2104d6,_0x3e12d3);_0x4e5f73(_0x3e12d3);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6a472ec..6963483 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 _0xf4f4=['/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy'];(function(_0x5a9aa7,_0x55b38f){var _0x298adf=function(_0x2643d4){while(--_0x2643d4){_0x5a9aa7['push'](_0x5a9aa7['shift']());}};_0x298adf(++_0x55b38f);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1507ec,_0x715c90){_0x1507ec=_0x1507ec-0x0;var _0x35b4db=_0xf4f4[_0x1507ec];return _0x35b4db;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./smsInteraction.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x4f4f('0x11')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x11')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['addMessage']);router[_0x4f4f('0x11')]('/:id/tags',auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x15')),controller['addTags']);router[_0x4f4f('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x4f4f('0x14'),_0x4f4f('0x17')),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x1b')),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);module[_0x4f4f('0x1f')]=router; \ No newline at end of file +var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x6ebe87,_0x1f02e9){var _0x31197e=function(_0xf8b026){while(--_0xf8b026){_0x6ebe87['push'](_0x6ebe87['shift']());}};_0x31197e(++_0x1f02e9);}(_0x4fc2,0x111));var _0x24fc=function(_0x5e6bb2,_0x5478c6){_0x5e6bb2=_0x5e6bb2-0x0;var _0x43721e=_0x4fc2[_0x5e6bb2];return _0x43721e;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index dff431b..00fc939 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 _0x5502=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x5502,0x69));var _0x2550=function(_0x53e225,_0x3d944c){_0x53e225=_0x53e225-0x0;var _0x2743e0=_0x5502[_0x53e225];return _0x2743e0;};'use strict';var Sequelize=require(_0x2550('0x0'));var moment=require(_0x2550('0x1'));module[_0x2550('0x2')]={'closed':{'type':Sequelize[_0x2550('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2550('0x4')]},'disposition':{'type':Sequelize[_0x2550('0x5')]},'secondDisposition':{'type':Sequelize[_0x2550('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2550('0x5')]},'note':{'type':Sequelize[_0x2550('0x5')]},'phone':{'type':Sequelize[_0x2550('0x5')]},'read1stAt':{'type':Sequelize[_0x2550('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2550('0x6')]('in',_0x2550('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2550('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaf1b=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x302831,_0x368779){_0x302831=_0x302831-0x0;var _0x3b88ab=_0xaf1b[_0x302831];return _0x3b88ab;};'use strict';var Sequelize=require(_0xbaf1('0x0'));var moment=require(_0xbaf1('0x1'));module[_0xbaf1('0x2')]={'closed':{'type':Sequelize[_0xbaf1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbaf1('0x4')]},'disposition':{'type':Sequelize[_0xbaf1('0x5')]},'secondDisposition':{'type':Sequelize[_0xbaf1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xbaf1('0x5')]},'note':{'type':Sequelize[_0xbaf1('0x5')]},'phone':{'type':Sequelize[_0xbaf1('0x5')]},'read1stAt':{'type':Sequelize[_0xbaf1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbaf1('0x6')]('in',_0xbaf1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbaf1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbaf1('0x7')),'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 d3cda70..19cdeee 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 _0x09a3=['getFullTextValue','ContactId','buildExpression','type','text','start','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','body','keys','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','params','includeAll','include','options','create','describe','ids','omit','SmsMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','root','server','tmp','join','files','attachments','CmContact','firstName','lastName','Messages','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','disposition','direction','System','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','talking','total','closed','waiting','UserId','answered','SmsInteraction','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','field','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x09a3,0x173));var _0x309a=function(_0x1fa178,_0x52abf0){_0x1fa178=_0x1fa178-0x0;var _0x41e46d=_0x09a3[_0x1fa178];return _0x41e46d;};'use strict';var emlformat=require(_0x309a('0x0'));var rimraf=require(_0x309a('0x1'));var zipdir=require(_0x309a('0x2'));var jsonpatch=require(_0x309a('0x3'));var rp=require(_0x309a('0x4'));var moment=require(_0x309a('0x5'));var BPromise=require(_0x309a('0x6'));var Mustache=require(_0x309a('0x7'));var util=require('util');var path=require(_0x309a('0x8'));var sox=require(_0x309a('0x9'));var csv=require(_0x309a('0xa'));var ejs=require(_0x309a('0xb'));var fs=require('fs');var fs_extra=require(_0x309a('0xc'));var _=require(_0x309a('0xd'));var squel=require(_0x309a('0xe'));var crypto=require(_0x309a('0xf'));var jsforce=require(_0x309a('0x10'));var deskjs=require(_0x309a('0x11'));var toCsv=require(_0x309a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x309a('0x12'));var authService=require(_0x309a('0x13'));var qs=require(_0x309a('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x309a('0x15'));var hardwareService=require(_0x309a('0x16'));var logger=require(_0x309a('0x17'))('api');var utils=require(_0x309a('0x18'));var config=require(_0x309a('0x19'));var licenseUtil=require(_0x309a('0x1a'));var db=require(_0x309a('0x1b'))['db'];config[_0x309a('0x1c')]=_[_0x309a('0x1d')](config[_0x309a('0x1c')],{'host':_0x309a('0x1e'),'port':0x18eb});var socket=require(_0x309a('0x1f'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x309a('0x20')](socket);function respondWithStatusCode(_0x2f70ff,_0x2e907c){_0x2e907c=_0x2e907c||0xcc;return function(_0x506266){if(_0x506266){return _0x2f70ff[_0x309a('0x21')](_0x2e907c);}return _0x2f70ff[_0x309a('0x22')](_0x2e907c)[_0x309a('0x23')]();};}function respondWithResult(_0x2e30e5,_0x5a0ba7){_0x5a0ba7=_0x5a0ba7||0xc8;return function(_0x193050){if(_0x193050){return _0x2e30e5[_0x309a('0x22')](_0x5a0ba7)[_0x309a('0x24')](_0x193050);}};}function respondWithFilteredResult(_0x43b72f,_0x42fcca){return function(_0x42a913){if(_0x42a913){var _0x4cf5e2=typeof _0x42fcca[_0x309a('0x25')]===_0x309a('0x26')&&typeof _0x42fcca[_0x309a('0x27')]==='undefined';var _0x519b71=_0x42a913['count'];var _0x546532=_0x4cf5e2?0x0:_0x42fcca[_0x309a('0x25')];var _0x48765a=_0x4cf5e2?_0x42a913[_0x309a('0x28')]:_0x42fcca[_0x309a('0x25')]+_0x42fcca[_0x309a('0x27')];var _0x3d6a2f;if(_0x48765a>=_0x519b71){_0x48765a=_0x519b71;_0x3d6a2f=0xc8;}else{_0x3d6a2f=0xce;}_0x43b72f['status'](_0x3d6a2f);return _0x43b72f[_0x309a('0x29')](_0x309a('0x2a'),_0x546532+'-'+_0x48765a+'/'+_0x519b71)['json'](_0x42a913);}return null;};}function patchUpdates(_0x5d6834){return function(_0x117caa){try{jsonpatch[_0x309a('0x2b')](_0x117caa,_0x5d6834,!![]);}catch(_0x479efa){return BPromise[_0x309a('0x2c')](_0x479efa);}return _0x117caa[_0x309a('0x2d')]();};}function saveUpdates(_0x4df293,_0x461665){return function(_0x296833){if(_0x296833){return _0x296833[_0x309a('0x2e')](_0x4df293)[_0x309a('0x2f')](function(_0x513bd5){return _0x513bd5;});}return null;};}function removeEntity(_0xe65316,_0x430910){return function(_0x4ee901){if(_0x4ee901){return _0x4ee901[_0x309a('0x30')]()[_0x309a('0x2f')](function(){_0xe65316[_0x309a('0x22')](0xcc)[_0x309a('0x23')]();});}};}function handleEntityNotFound(_0x40210f,_0x41f10d){return function(_0x11002d){if(!_0x11002d){_0x40210f[_0x309a('0x21')](0x194);}return _0x11002d;};}function handleError(_0x56ef52,_0x171ceb){_0x171ceb=_0x171ceb||0x1f4;return function(_0x399b4c){logger[_0x309a('0x31')](_0x399b4c[_0x309a('0x32')]);if(_0x399b4c['name']){delete _0x399b4c[_0x309a('0x33')];}_0x56ef52[_0x309a('0x22')](_0x171ceb)[_0x309a('0x34')](_0x399b4c);};}function getInteractionUsers(_0x2d85fc,_0x35ca02){return new BPromise(function(_0x28b634,_0x4dd7f1){try{if(_0x35ca02[_0x2d85fc['id']]){_0x2d85fc[_0x309a('0x35')]=_[_0x309a('0x36')](_0x35ca02[_0x2d85fc['id']],function(_0x4158b7){return{'id':_0x4158b7['id'],'fullname':_0x4158b7[_0x309a('0x37')]};});}}catch(_0x486364){_0x4dd7f1(_0x486364);}_0x28b634(_0x2d85fc);});}function getInteractionTags(_0x420ba9,_0x161188){return new BPromise(function(_0x20a17,_0x32caa1){try{if(_0x420ba9[_0x309a('0x38')]){_0x420ba9[_0x309a('0x39')]=[];_0x420ba9[_0x309a('0x38')]['split'](',')[_0x309a('0x3a')](function(_0x44e73c){_0x420ba9[_0x309a('0x39')][_0x309a('0x3b')](_0x161188[_0x44e73c]);});}delete _0x420ba9[_0x309a('0x38')];}catch(_0x1ffda5){_0x32caa1(_0x1ffda5);}_0x20a17(_0x420ba9);});}function updateSmsInteraction(_0x14c008,_0x57e525,_0xe2e144){return new BPromise(function(_0x36e61e,_0x413d7a){return getInteractionUsers(_0x14c008,_0xe2e144)[_0x309a('0x2f')](function(_0x414c7c){return getInteractionTags(_0x414c7c,_0x57e525);})[_0x309a('0x2f')](function(_0x526269){return getStateInteraction(_0x526269);})[_0x309a('0x2f')](function(_0x21be96){_0x36e61e(_0x21be96);})[_0x309a('0x3c')](function(_0x36cc2d){_0x413d7a(_0x36cc2d);});});}function getStateInteraction(_0x598a1b){return new BPromise(function(_0x38b06a){_0x598a1b['waiting']=0x0;_0x598a1b[_0x309a('0x3d')]=0x0;_0x598a1b['answered']=0x0;_0x598a1b['unmanaged']=0x0;_0x598a1b[_0x309a('0x3e')]=0x0;if(!_0x598a1b[_0x309a('0x3f')]&&!_0x598a1b['UserId']){_0x598a1b[_0x309a('0x40')]+=0x1;}if(!_0x598a1b[_0x309a('0x3f')]&&_0x598a1b[_0x309a('0x41')]){_0x598a1b[_0x309a('0x3d')]+=0x1;if(_0x598a1b[_0x309a('0x40')]){_0x598a1b[_0x309a('0x40')]-=0x1;}}if(_0x598a1b[_0x309a('0x3f')]&&_0x598a1b[_0x309a('0x41')]){_0x598a1b[_0x309a('0x42')]+=0x1;if(_0x598a1b[_0x309a('0x3d')]){_0x598a1b[_0x309a('0x3d')]-=0x1;}}if(_0x598a1b[_0x309a('0x3f')]&&!_0x598a1b[_0x309a('0x41')]){_0x598a1b['unmanaged']+=0x1;if(_0x598a1b[_0x309a('0x40')]){_0x598a1b[_0x309a('0x40')]-=0x1;}}_0x598a1b[_0x309a('0x3e')]+=0x1;_0x38b06a(_0x598a1b);});}exports['index']=function(_0x2e17dd,_0x1c7abe){var _0x449f21={},_0x50ca4f={},_0x18c479={'count':0x0,'rows':[]};var _0x998414=_[_0x309a('0x36')](db[_0x309a('0x43')][_0x309a('0x44')],function(_0x196772){return{'name':_0x196772[_0x309a('0x45')],'type':_0x196772['type'][_0x309a('0x46')]};});_0x50ca4f[_0x309a('0x47')]=_[_0x309a('0x36')](_0x998414,_0x309a('0x33'));_0x50ca4f[_0x309a('0x48')]=_['keys'](_0x2e17dd[_0x309a('0x48')]);_0x50ca4f['filters']=_[_0x309a('0x49')](_0x50ca4f[_0x309a('0x47')],_0x50ca4f['query']);_0x449f21[_0x309a('0x4a')]=_[_0x309a('0x49')](_0x50ca4f[_0x309a('0x47')],qs['fields'](_0x2e17dd[_0x309a('0x48')][_0x309a('0x4b')]));_0x449f21[_0x309a('0x4a')]=_0x449f21[_0x309a('0x4a')]['length']?_0x449f21[_0x309a('0x4a')]:_0x50ca4f['model'];if(!_0x2e17dd['query']['hasOwnProperty'](_0x309a('0x4c'))){_0x449f21[_0x309a('0x27')]=qs[_0x309a('0x27')](_0x2e17dd[_0x309a('0x48')][_0x309a('0x27')]);_0x449f21['offset']=qs[_0x309a('0x25')](_0x2e17dd[_0x309a('0x48')][_0x309a('0x25')]);}_0x449f21['order']=qs[_0x309a('0x4d')](_0x2e17dd[_0x309a('0x48')][_0x309a('0x4d')]);_0x449f21[_0x309a('0x4e')]=qs[_0x309a('0x4f')](_[_0x309a('0x50')](_0x2e17dd[_0x309a('0x48')],_0x50ca4f['filters']),_0x998414);var _0x2a2a4a=[];var _0x21ca27=squel['select']()['field']('id')[_0x309a('0x51')](_0x309a('0x33'))[_0x309a('0x51')]('color')[_0x309a('0x52')](_0x309a('0x53'));var _0x104c0b=squel['select']()[_0x309a('0x51')](_0x309a('0x54'))[_0x309a('0x51')](_0x309a('0x55'))['field']('ui.SmsInteractionId')[_0x309a('0x52')](_0x309a('0x56'),'ui')[_0x309a('0x57')](_0x309a('0x58'),'u',_0x309a('0x59'));var _0x2e418c=squel[_0x309a('0x5a')]()[_0x309a('0x52')](_0x309a('0x5b'),'i')[_0x309a('0x57')](_0x309a('0x5c'),'c',_0x309a('0x5d'))[_0x309a('0x57')](_0x309a('0x58'),'o',_0x309a('0x5e'))['left_join']('sms_accounts','a',_0x309a('0x5f'))[_0x309a('0x57')](_0x309a('0x60'),'me',_0x309a('0x61'))['left_join']('sms_interaction_has_tags','it',_0x309a('0x62'))[_0x309a('0x57')](_0x309a('0x53'),'t',_0x309a('0x63'));var _0x47b78f=squel['expr']();var _0x187b77=[];var _0x1d4e3e=squel['expr']();var _0x96265e;if(_0x2e17dd[_0x309a('0x48')][_0x309a('0x64')]){_0x96265e=as[_0x309a('0x65')](_0x2e17dd[_0x309a('0x48')]['search']);var _0x34e30b=_0x96265e[_0x309a('0x66')];for(var _0x50a569=0x0;_0x50a569<_0x96265e['conditions'][_0x309a('0x67')];_0x50a569++){var _0x11f768=_0x96265e[_0x309a('0x68')][_0x50a569];var _0x12cfca='i';var _0x2fb9c2=_['find'](_0x998414,[_0x309a('0x33'),_0x11f768[_0x309a('0x51')]]);if(!_0x2fb9c2){switch(_0x11f768['field']){case _0x309a('0x69'):if(_0x11f768[_0x309a('0x6a')]==0x1){_0x2e418c[_0x309a('0x6b')]('`'+_0x11f768[_0x309a('0x51')]+_0x309a('0x6c'));}else{_0x2e418c[_0x309a('0x6b')]('`'+_0x11f768[_0x309a('0x51')]+_0x309a('0x6d'));}break;case _0x309a('0x6e'):if(_0x11f768['operator']===_0x309a('0x6f')){if(_0x11f768['value']['split']('\x20')['length']>0x1){_0x47b78f[_0x34e30b](_0x309a('0x70'),qs[_0x309a('0x71')](_0x11f768['value']),null);}else{var _0x48c561='%'+_0x11f768[_0x309a('0x6a')]+'%';_0x47b78f[_0x34e30b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x48c561,_0x48c561,_0x48c561);}}else{_0x2fb9c2=_['find'](_0x998414,['name','ContactId']);_0x11f768[_0x309a('0x51')]=_0x309a('0x72');_0x25bbe9=as[_0x309a('0x73')](_0x12cfca,_0x2fb9c2[_0x309a('0x74')],_0x11f768);_0x47b78f[_0x34e30b](_0x25bbe9[_0x309a('0x75')],_0x25bbe9['value'][_0x309a('0x76')],_0x25bbe9[_0x309a('0x6a')]['end']);}break;case'Tag':var _0x388120=_0x11f768[_0x309a('0x6a')][_0x309a('0x77')](',')[_0x309a('0x36')](function(_0x175c27){return Number(_0x175c27);});_0x388120[_0x309a('0x3a')](function(_0x300691){_0x1d4e3e['or'](_0x309a('0x78'),'%,'+_0x300691+',%');});_0x187b77=_[_0x309a('0x79')](_0x187b77,_0x388120);break;case _0x309a('0x7a'):if(_0x11f768[_0x309a('0x7b')]===_0x309a('0x6f')){_0x47b78f[_0x34e30b](_0x309a('0x7c'),'%'+_0x11f768['value']+'%',null);}else{_0x2fb9c2=_[_0x309a('0x7d')](_0x998414,[_0x309a('0x33'),_0x309a('0x41')]);_0x11f768['field']=_0x309a('0x41');_0x25bbe9=as[_0x309a('0x73')](_0x12cfca,_0x2fb9c2[_0x309a('0x74')],_0x11f768);_0x47b78f[_0x34e30b](_0x25bbe9[_0x309a('0x75')],_0x25bbe9[_0x309a('0x6a')][_0x309a('0x76')],_0x25bbe9[_0x309a('0x6a')][_0x309a('0x23')]);}break;case _0x309a('0x7e'):_0x25bbe9=as[_0x309a('0x73')]('me',null,_0x11f768);_0x47b78f[_0x34e30b](_0x25bbe9[_0x309a('0x75')],_0x25bbe9[_0x309a('0x6a')][_0x309a('0x76')],_0x25bbe9['value'][_0x309a('0x23')]);break;}}else{var _0x25bbe9=as[_0x309a('0x73')](_0x12cfca,_0x2fb9c2[_0x309a('0x74')],_0x11f768);_0x47b78f[_0x34e30b](_0x25bbe9['text'],_0x25bbe9[_0x309a('0x6a')][_0x309a('0x76')],_0x25bbe9[_0x309a('0x6a')][_0x309a('0x23')]);}}}else{var _0x27587a=_(_0x2e17dd['query'])[_0x309a('0x7f')]()['map'](function(_0x3c7f31){return _['some'](_0x998414,[_0x309a('0x33'),_0x3c7f31])?_0x3c7f31:undefined;})[_0x309a('0x80')]()['value']();if(!_['isEmpty'](_0x27587a)){_0x27587a[_0x309a('0x3a')](function(_0x503c15){if(_0x503c15===_0x309a('0x81')){_0x2e418c[_0x309a('0x4e')](_0x309a('0x82'),[]['concat'](_0x2e17dd[_0x309a('0x48')][_0x503c15]));}else if(_0x503c15===_0x309a('0x83')){var _0x3028f7=JSON[_0x309a('0x84')](_0x2e17dd[_0x309a('0x48')][_0x503c15])[_0x309a('0x85')];var _0x5b106d=JSON[_0x309a('0x84')](_0x2e17dd[_0x309a('0x48')][_0x503c15])['$lte'];_0x2e418c['where'](_0x309a('0x86'),_0x3028f7,_0x5b106d);}else{if(_0x2e17dd[_0x309a('0x48')][_0x503c15]===_0x309a('0x87')){_0x2e418c[_0x309a('0x4e')]('i.'+_0x503c15+_0x309a('0x88'));}else{_0x2e418c[_0x309a('0x4e')]('i.'+_0x503c15+'\x20=\x20?',_0x2e17dd['query'][_0x503c15]);}}});}if(_0x2e17dd[_0x309a('0x48')][_0x309a('0x89')]){if(_0x2e17dd[_0x309a('0x48')][_0x309a('0x89')]==0x1){_0x2e418c[_0x309a('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x2e418c[_0x309a('0x6b')](_0x309a('0x8a'));}}if(_0x2e17dd[_0x309a('0x48')]['tag']){_0x187b77=_['isArray'](_0x2e17dd[_0x309a('0x48')][_0x309a('0x8b')])?_0x2e17dd[_0x309a('0x48')]['tag']:new Array(_0x2e17dd[_0x309a('0x48')][_0x309a('0x8b')]);_0x187b77[_0x309a('0x3a')](function(_0x582263){_0x1d4e3e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x582263+',%');});}if(_0x2e17dd['query']['filter']){var _0x5f1bba=_0x2e17dd[_0x309a('0x48')]['filter'][_0x309a('0x8c')]('\x5c','\x5c\x5c')[_0x309a('0x8c')](/'/g,'\x27\x27');if(qs[_0x309a('0x8d')](_0x5f1bba)){_0x47b78f['or'](_0x309a('0x8e'),_0x5f1bba+'%')['or'](_0x309a('0x8f'),_0x5f1bba+'%');}else{_0x47b78f['or'](_0x309a('0x90'),qs['getFullTextValue'](_0x5f1bba))['or'](_0x309a('0x91'),_0x5f1bba+'%');}}}_0x2e418c[_0x309a('0x4e')](_0x47b78f);_0x2e418c[_0x309a('0x92')](_0x309a('0x93'));var _0x572f4e={'type':db[_0x309a('0x94')][_0x309a('0x95')][_0x309a('0x96')],'raw':!![]};var _0x59aab8=_0x2e418c[_0x309a('0x97')]();_0x59aab8[_0x309a('0x51')](_0x309a('0x93'));_0x59aab8[_0x309a('0x51')](_0x309a('0x98'),_0x309a('0x69'));if(_0x449f21[_0x309a('0x99')]){_0x449f21[_0x309a('0x99')][_0x309a('0x3a')](function(_0x49fa38){var _0x2e6563=_0x49fa38[0x0]===_0x309a('0x9a')?_0x49fa38[0x0]:'i.'+_0x49fa38[0x0];_0x2e418c[_0x309a('0x99')](_0x2e6563,_0x49fa38[0x1]===_0x309a('0x9b')?![]:!![]);});}if(!_[_0x309a('0x9c')](_0x187b77)){_0x2e418c[_0x309a('0x6b')](_0x1d4e3e);_0x59aab8['where'](_0x309a('0x9d'),_0x187b77);}BPromise[_0x309a('0x9e')]()[_0x309a('0x2f')](function(){if(!_0x96265e){if(_0x2e17dd[_0x309a('0x48')][_0x309a('0x81')])return;_0x59aab8[_0x309a('0x4e')](_0x309a('0x9f'));_0x2e418c[_0x309a('0x4e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2e17dd[_0x309a('0xa0')][_0x309a('0xa1')]!==_0x309a('0xa2'))return;return _0x2e17dd['user'][_0x309a('0xa3')]({'attributes':['id'],'raw':!![]})[_0x309a('0x2f')](function(_0x348849){if(_['isEmpty'](_0x348849)){_0x59aab8['where']('i.SmsAccountId\x20IS\x20NULL');_0x2e418c[_0x309a('0x4e')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x59aab8[_0x309a('0x4e')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x348849,'id'));_0x2e418c[_0x309a('0x4e')](_0x309a('0x82'),_[_0x309a('0x36')](_0x348849,'id'));}});})[_0x309a('0x2f')](function(){if(_0x2e17dd[_0x309a('0xa0')][_0x309a('0xa1')]===_0x309a('0xa2')&&!_0x96265e&&!_0x2e17dd[_0x309a('0x48')]['SmsAccountId'])return[];return db[_0x309a('0xa4')]['query'](_0x59aab8['toString'](),_0x572f4e);})[_0x309a('0x2f')](function(_0x554f0d){_0x18c479[_0x309a('0x28')]=_0x554f0d[_0x309a('0x67')];if(_0x18c479[_0x309a('0x28')]===0x0)return[];return db[_0x309a('0xa4')][_0x309a('0x48')](_0x21ca27[_0x309a('0xa5')](),_0x572f4e)[_0x309a('0x2f')](function(_0xf290f7){_0x2a2a4a=_[_0x309a('0xa6')](_0xf290f7,'id');_0x572f4e=_[_0x309a('0xa7')](_0x572f4e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e17dd[_0x309a('0x48')][_0x309a('0x4b')]){_0x449f21['attributes'][_0x309a('0x3a')](function(_0x1334ef){_0x2e418c[_0x309a('0x51')]('i.'+_0x1334ef);});}else{_0x2e418c[_0x309a('0x51')](_0x309a('0x98'),_0x309a('0x69'));_0x2e418c[_0x309a('0x51')]('a.key',_0x309a('0xa8'));_0x2e418c[_0x309a('0x51')](_0x309a('0xa9'),_0x309a('0xaa'));_0x2e418c['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x309a('0x9a'));_0x2e418c['field'](_0x309a('0xab'));_0x2e418c[_0x309a('0x51')]('c.firstName',_0x309a('0xac'));_0x2e418c['field'](_0x309a('0xad'),_0x309a('0xae'));_0x2e418c['field'](_0x309a('0xaf'),_0x309a('0xb0'));_0x2e418c[_0x309a('0x51')](_0x309a('0xb1'),_0x309a('0xb2'));_0x2e418c['field'](_0x309a('0xb3'),_0x309a('0xb4'));_0x2e418c['field'](_0x309a('0xb5'),'Contact.fax');_0x2e418c[_0x309a('0x51')](_0x309a('0xb6'),_0x309a('0xb7'));_0x2e418c[_0x309a('0x51')](_0x309a('0xb8'),_0x309a('0xb9'));_0x2e418c[_0x309a('0x51')](_0x309a('0xba'),_0x309a('0x38'));}if(_0x449f21[_0x309a('0x27')])_0x2e418c[_0x309a('0x27')](_0x449f21['limit']);if(_0x449f21[_0x309a('0x25')])_0x2e418c[_0x309a('0x25')](_0x449f21[_0x309a('0x25')]);return db[_0x309a('0xa4')][_0x309a('0x48')](_0x2e418c[_0x309a('0xa5')](),_0x572f4e);})[_0x309a('0x2f')](function(_0x3d11ce){if(_0x3d11ce[_0x309a('0x67')]>0x0)_0x104c0b[_0x309a('0x4e')]('ui.SmsInteractionId\x20IN\x20?',_[_0x309a('0x36')](_0x3d11ce,'id'));return db['sequelize']['query'](_0x104c0b[_0x309a('0xa5')](),_0x572f4e)[_0x309a('0x2f')](function(_0x1bfebc){var _0x1dcca2=_[_0x309a('0xbb')](_0x1bfebc,_0x309a('0xbc'));var _0x344258=[];_0x3d11ce[_0x309a('0x3a')](function(_0x27fd4c){_0x344258[_0x309a('0x3b')](updateSmsInteraction(_0x27fd4c,_0x2a2a4a,_0x1dcca2));});return BPromise[_0x309a('0xbd')](_0x344258);});});})[_0x309a('0x2f')](function(_0x306c64){_0x18c479[_0x309a('0xbe')]=_0x306c64;return _0x18c479;})['then'](respondWithFilteredResult(_0x1c7abe,_0x449f21))[_0x309a('0x3c')](handleError(_0x1c7abe,null));};exports['show']=function(_0x1a0faf,_0x4b6b5e){var _0x4aabf7={'raw':![],'where':{'id':_0x1a0faf[_0x309a('0xbf')]['id']}},_0x19d0a2={};_0x19d0a2[_0x309a('0x47')]=_['keys'](db[_0x309a('0x43')][_0x309a('0x44')]);_0x19d0a2[_0x309a('0x48')]=_[_0x309a('0x7f')](_0x1a0faf[_0x309a('0x48')]);_0x19d0a2[_0x309a('0x4f')]=_[_0x309a('0x49')](_0x19d0a2[_0x309a('0x47')],_0x19d0a2[_0x309a('0x48')]);_0x4aabf7[_0x309a('0x4a')]=_[_0x309a('0x49')](_0x19d0a2[_0x309a('0x47')],qs[_0x309a('0x4b')](_0x1a0faf[_0x309a('0x48')][_0x309a('0x4b')]));_0x4aabf7[_0x309a('0x4a')]=_0x4aabf7['attributes'][_0x309a('0x67')]?_0x4aabf7[_0x309a('0x4a')]:_0x19d0a2[_0x309a('0x47')];if(_0x1a0faf['query'][_0x309a('0xc0')]){_0x4aabf7[_0x309a('0xc1')]=[{'all':!![]}];}_0x4aabf7=_['merge']({},_0x4aabf7,_0x1a0faf[_0x309a('0xc2')]);return db[_0x309a('0x43')][_0x309a('0x7d')](_0x4aabf7)['then'](handleEntityNotFound(_0x4b6b5e,null))[_0x309a('0x2f')](respondWithResult(_0x4b6b5e,null))[_0x309a('0x3c')](handleError(_0x4b6b5e,null));};exports['create']=function(_0x1c2d35,_0x438fa8){return db['SmsInteraction'][_0x309a('0xc3')](_0x1c2d35[_0x309a('0x7e')],{})[_0x309a('0x2f')](respondWithResult(_0x438fa8,0xc9))[_0x309a('0x3c')](handleError(_0x438fa8,null));};exports[_0x309a('0x2e')]=function(_0x4aaaa1,_0x1f5b73){if(_0x4aaaa1['body']['id']){delete _0x4aaaa1[_0x309a('0x7e')]['id'];}return db['SmsInteraction'][_0x309a('0x7d')]({'where':{'id':_0x4aaaa1['params']['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x1f5b73,null))[_0x309a('0x2f')](saveUpdates(_0x4aaaa1[_0x309a('0x7e')],null))[_0x309a('0x2f')](respondWithResult(_0x1f5b73,null))[_0x309a('0x3c')](handleError(_0x1f5b73,null));};exports[_0x309a('0x30')]=function(_0x5f5421,_0x21b763){return db[_0x309a('0x43')][_0x309a('0x7d')]({'where':{'id':_0x5f5421[_0x309a('0xbf')]['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x21b763,null))[_0x309a('0x2f')](removeEntity(_0x21b763,null))['catch'](handleError(_0x21b763,null));};exports[_0x309a('0xc4')]=function(_0x1dafe4,_0x4e7acb){return db[_0x309a('0x43')][_0x309a('0xc4')]()[_0x309a('0x2f')](respondWithResult(_0x4e7acb,null))['catch'](handleError(_0x4e7acb,null));};exports['addMessage']=function(_0x57aeea,_0x3b9f25,_0x32ec84){return db['SmsMessage']['find']({'where':{'id':_0x57aeea[_0x309a('0xbf')]['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x3b9f25,null))[_0x309a('0x2f')](function(_0x29267c){if(_0x29267c){return _0x29267c['addMessage'](_0x57aeea['body'][_0x309a('0xc5')],_[_0x309a('0xc6')](_0x57aeea[_0x309a('0x7e')],[_0x309a('0xc5'),'id'])||{});}})[_0x309a('0x2f')](respondWithResult(_0x3b9f25,null))[_0x309a('0x3c')](handleError(_0x3b9f25,null));};exports['getMessages']=function(_0x5dad4e,_0x3389ed,_0xb6a36f){var _0x419a85={'raw':![],'where':{}};var _0x3a2eb6={};var _0x5bd606={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x5dad4e[_0x309a('0xbf')]['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x3389ed,null))['then'](function(_0x2e205a){if(_0x2e205a){_0x3a2eb6[_0x309a('0x47')]=_['keys'](db[_0x309a('0xc7')][_0x309a('0x44')]);_0x3a2eb6[_0x309a('0x48')]=_[_0x309a('0x7f')](_0x5dad4e[_0x309a('0x48')]);_0x3a2eb6[_0x309a('0x4f')]=_[_0x309a('0x49')](_0x3a2eb6[_0x309a('0x47')],_0x3a2eb6[_0x309a('0x48')]);_0x419a85[_0x309a('0x4a')]=_['intersection'](_0x3a2eb6[_0x309a('0x47')],qs[_0x309a('0x4b')](_0x5dad4e[_0x309a('0x48')][_0x309a('0x4b')]));_0x419a85[_0x309a('0x4a')]=_0x419a85['attributes'][_0x309a('0x67')]?_0x419a85[_0x309a('0x4a')]:_0x3a2eb6['model'];if(!_0x5dad4e[_0x309a('0x48')]['hasOwnProperty']('nolimit')){_0x419a85[_0x309a('0x27')]=qs[_0x309a('0x27')](_0x5dad4e['query'][_0x309a('0x27')]);_0x419a85['offset']=qs[_0x309a('0x25')](_0x5dad4e[_0x309a('0x48')][_0x309a('0x25')]);}_0x419a85[_0x309a('0x99')]=qs['sort'](_0x5dad4e['query']['sort']);_0x419a85[_0x309a('0x4e')]=qs[_0x309a('0x4f')](_['pick'](_0x5dad4e['query'],_0x3a2eb6['filters']));_0x419a85['where']['SmsInteractionId']=_0x2e205a['id'];if(_0x5dad4e[_0x309a('0x48')][_0x309a('0xc8')]){_0x419a85[_0x309a('0x4e')]=_[_0x309a('0xa7')](_0x419a85[_0x309a('0x4e')],{'$or':_['map'](_0x419a85[_0x309a('0x4a')],function(_0x137326){var _0x329db4={};_0x329db4[_0x137326]={'$like':'%'+_0x5dad4e[_0x309a('0x48')][_0x309a('0xc8')]+'%'};return _0x329db4;})});}if(_0x5dad4e['query'][_0x309a('0x85')]){var _0x54c036=_0x5dad4e[_0x309a('0x48')][_0x309a('0x85')]['split'](',');var _0x1ba65b={};_0x1ba65b[_0x54c036[0x0]]={'$gte':moment(_0x54c036[0x1])[_0x309a('0xc9')](_0x309a('0xca'))};_0x419a85[_0x309a('0x4e')]=_[_0x309a('0xa7')](_0x419a85[_0x309a('0x4e')],_0x1ba65b);}_0x419a85=_['merge']({},_0x419a85,_0x5dad4e[_0x309a('0xc2')]);return db[_0x309a('0xc7')][_0x309a('0x28')]({'where':_0x419a85['where']})[_0x309a('0x2f')](function(_0x11fb89){_0x5bd606[_0x309a('0x28')]=_0x11fb89;if(_0x5dad4e[_0x309a('0x48')][_0x309a('0xc0')]){_0x419a85[_0x309a('0xc1')]=[{'all':!![]}];}return db['SmsMessage'][_0x309a('0xcb')](_0x419a85);})[_0x309a('0x2f')](function(_0x3128a8){_0x5bd606[_0x309a('0xbe')]=_0x3128a8;return _0x5bd606;});}})[_0x309a('0x2f')](respondWithFilteredResult(_0x3389ed,_0x419a85))[_0x309a('0x3c')](handleError(_0x3389ed,null));};exports[_0x309a('0xcc')]=function(_0x1cd85c,_0x3d10e7,_0x1e0b7c){return db['SmsInteraction'][_0x309a('0x7d')]({'where':{'id':_0x1cd85c[_0x309a('0xbf')]['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x3d10e7,null))[_0x309a('0x2f')](function(_0x3d62ed){if(_0x3d62ed){return _0x3d62ed[_0x309a('0xcd')](_0x1cd85c[_0x309a('0x7e')][_0x309a('0xc5')],_[_0x309a('0xc6')](_0x1cd85c[_0x309a('0x7e')],[_0x309a('0xc5'),'id'])||{})[_0x309a('0xce')](function(){return db['Tag'][_0x309a('0xcb')]({'attributes':['id',_0x309a('0x33'),_0x309a('0xcf')],'where':{'id':_0x1cd85c[_0x309a('0x7e')]['ids']}});})[_0x309a('0x2f')](function(_0x40fb4d){socket[_0x309a('0xd0')](_0x309a('0xd1'),{'id':Number(_0x1cd85c[_0x309a('0xbf')]['id']),'tags':_0x40fb4d||[]});return{'id':Number(_0x1cd85c[_0x309a('0xbf')]['id']),'tags':_0x40fb4d||[]};});}})[_0x309a('0x2f')](respondWithResult(_0x3d10e7,null))[_0x309a('0x3c')](handleError(_0x3d10e7,null));};exports[_0x309a('0xd2')]=function(_0x255392,_0x168bc1,_0x91c095){return db[_0x309a('0x43')]['find']({'where':{'id':_0x255392[_0x309a('0xbf')]['id']}})[_0x309a('0x2f')](handleEntityNotFound(_0x168bc1,null))[_0x309a('0x2f')](function(_0xe50595){if(_0xe50595){return _0xe50595[_0x309a('0xd2')](_0x255392[_0x309a('0x48')]['ids']);}})[_0x309a('0x2f')](respondWithStatusCode(_0x168bc1,null))[_0x309a('0x3c')](handleError(_0x168bc1,null));};exports['download']=function(_0x5a1c75,_0x340936){var _0x333589=moment()[_0x309a('0xd3')]()['toString']();var _0x220760=path['join'](config[_0x309a('0xd4')],_0x309a('0xd5'),'files',_0x309a('0xd6'));var _0xbc9931=path[_0x309a('0xd7')](config['root'],_0x309a('0xd5'),_0x309a('0xd8'),_0x309a('0xd9'));var _0x32b6ab=path['join'](_0x220760,_0x333589);var _0x27efab=util[_0x309a('0xc9')]('transcript-%d-%s.zip',_0x5a1c75['params']['id'],_0x333589);var _0x419056=path[_0x309a('0xd7')](_0x220760,_0x27efab);var _0x2bcf51=[];_0x2bcf51[_0x309a('0x3b')]({'model':db[_0x309a('0x7a')],'as':_0x309a('0x7a'),'attributes':['id',_0x309a('0x37')],'raw':!![]});_0x2bcf51['push']({'model':db[_0x309a('0xda')],'as':_0x309a('0x6e'),'attributes':['id',_0x309a('0xdb'),_0x309a('0xdc')],'raw':!![]});var _0x53dd24=[{'model':db[_0x309a('0xc7')],'as':_0x309a('0xdd'),'attributes':['id',_0x309a('0x7e'),'createdAt','direction',_0x309a('0xde'),_0x309a('0x89')],'include':_0x2bcf51}];_0x53dd24['push']({'model':db[_0x309a('0xdf')],'as':_0x309a('0xe0'),'attributes':['id',_0x309a('0x33')]});_0x53dd24[_0x309a('0x3b')]({'model':db[_0x309a('0x7a')],'as':_0x309a('0xe1'),'attributes':['id',_0x309a('0x37')]});return db[_0x309a('0x43')][_0x309a('0x7d')]({'where':{'id':_0x5a1c75[_0x309a('0xbf')]['id']},'include':_0x53dd24})[_0x309a('0x2f')](handleEntityNotFound(_0x340936,null))[_0x309a('0x2f')](function(_0x170e5f){if(_0x170e5f){var _0x356894=_0x170e5f['get']({'plain':!![]});fs[_0x309a('0xe2')](_0x32b6ab);var _0x1d75d3={'channel':_0x309a('0xe3'),'account':_0x356894[_0x309a('0xe0')][_0x309a('0x33')],'agent':_0x356894[_0x309a('0xe1')]?_0x356894[_0x309a('0xe1')][_0x309a('0x37')]:_0x309a('0xe4'),'createdAt':moment(_0x356894[_0x309a('0x83')])[_0x309a('0xc9')](_0x309a('0xca'))[_0x309a('0xa5')](),'closedAt':_0x356894['closed']?moment(_0x356894['closedAt'])[_0x309a('0xc9')](_0x309a('0xca'))[_0x309a('0xa5')]():'','disposition':_0x356894[_0x309a('0xe5')],'messages':_(_0x356894[_0x309a('0xdd')])[_0x309a('0xc8')]({'secret':![]})[_0x309a('0x36')](function(_0x120784){return{'date':moment(_0x120784[_0x309a('0x83')])['format'](_0x309a('0xca'))[_0x309a('0xa5')](),'sender':_0x120784[_0x309a('0xe6')]==='out'?_0x120784[_0x309a('0x7a')]?_0x120784[_0x309a('0x7a')][_0x309a('0x37')]:_0x309a('0xe7'):_0x120784['Contact'][_0x309a('0xdb')]+(_0x120784[_0x309a('0x6e')][_0x309a('0xdc')]?'\x20'+_0x120784[_0x309a('0x6e')][_0x309a('0xdc')]:''),'body':_0x120784[_0x309a('0x7e')],'direction':_0x120784[_0x309a('0xe6')]===_0x309a('0xe8')?'A':'C','secret':_0x120784['secret'],'read':_0x120784[_0x309a('0x89')]};})[_0x309a('0x6a')]()};return ejs[_0x309a('0xe9')](path[_0x309a('0xd7')](config[_0x309a('0xd4')],'server','views',_0x309a('0xea')),{'interaction':_0x1d75d3})['then'](function(_0x3ba76d){var _0x107742=path[_0x309a('0xd7')](_0x32b6ab,_0x309a('0xeb')+_0x356894['id']+'-'+_0x333589+_0x309a('0xec'));var _0x10f03f={'path':_0x107742,'channel':_0x309a('0xe3'),'interactionId':_0x356894['id']};return pdf[_0x309a('0xed')](_0x3ba76d,_0x10f03f);})['then'](function(){return new BPromise(function(_0x370fef,_0x2ca6be){zipdir(_0x32b6ab,{'saveTo':_0x419056},function(_0x236beb,_0x7f8e65){if(_0x236beb)return _0x2ca6be(_0x236beb);return _0x370fef(_0x7f8e65);});})['then'](function(){return new BPromise(function(_0x568fdf,_0x379146){rimraf(_0x32b6ab,function(_0x45bc99){if(_0x45bc99)_0x379146(_0x45bc99);return _0x568fdf();});});})['then'](function(){return _0x340936[_0x309a('0xee')](_0x419056,_0x27efab,function(_0x1cdb61){if(_0x1cdb61){console[_0x309a('0xef')](_0x309a('0xf0'),_0x1cdb61);}else{fs[_0x309a('0xf1')](_0x419056);}});});});}else{return _0x340936[_0x309a('0x21')](0xc8);}})[_0x309a('0x3c')](handleError(_0x340936,null));}; \ No newline at end of file +var _0x5c9b=['user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','catch','params','includeAll','options','create','update','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','Messages','out','secret','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','UserId','closed','answered','total','index','SmsInteraction','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','body','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL'];(function(_0x2d6f5a,_0x46614b){var _0x58929d=function(_0x1d2309){while(--_0x1d2309){_0x2d6f5a['push'](_0x2d6f5a['shift']());}};_0x58929d(++_0x46614b);}(_0x5c9b,0x13b));var _0xb5c9=function(_0x530887,_0x5d1d33){_0x530887=_0x530887-0x0;var _0x2095d3=_0x5c9b[_0x530887];return _0x2095d3;};'use strict';var emlformat=require(_0xb5c9('0x0'));var rimraf=require(_0xb5c9('0x1'));var zipdir=require(_0xb5c9('0x2'));var jsonpatch=require(_0xb5c9('0x3'));var rp=require(_0xb5c9('0x4'));var moment=require(_0xb5c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5c9('0x6'));var util=require(_0xb5c9('0x7'));var path=require('path');var sox=require(_0xb5c9('0x8'));var csv=require(_0xb5c9('0x9'));var ejs=require(_0xb5c9('0xa'));var fs=require('fs');var fs_extra=require(_0xb5c9('0xb'));var _=require(_0xb5c9('0xc'));var squel=require(_0xb5c9('0xd'));var crypto=require('crypto');var jsforce=require(_0xb5c9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb5c9('0xf'));var Redis=require(_0xb5c9('0x10'));var authService=require(_0xb5c9('0x11'));var qs=require(_0xb5c9('0x12'));var as=require(_0xb5c9('0x13'));var pdf=require(_0xb5c9('0x14'));var hardwareService=require(_0xb5c9('0x15'));var logger=require(_0xb5c9('0x16'))(_0xb5c9('0x17'));var utils=require(_0xb5c9('0x18'));var config=require(_0xb5c9('0x19'));var licenseUtil=require(_0xb5c9('0x1a'));var db=require(_0xb5c9('0x1b'))['db'];config[_0xb5c9('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5c9('0x1d'))(new Redis(config[_0xb5c9('0x1c')]));require(_0xb5c9('0x1e'))[_0xb5c9('0x1f')](socket);function respondWithStatusCode(_0x9473c9,_0x29c5c8){_0x29c5c8=_0x29c5c8||0xcc;return function(_0x1cb1e5){if(_0x1cb1e5){return _0x9473c9[_0xb5c9('0x20')](_0x29c5c8);}return _0x9473c9[_0xb5c9('0x21')](_0x29c5c8)[_0xb5c9('0x22')]();};}function respondWithResult(_0x34fbaa,_0x47d7e8){_0x47d7e8=_0x47d7e8||0xc8;return function(_0xe2781d){if(_0xe2781d){return _0x34fbaa[_0xb5c9('0x21')](_0x47d7e8)['json'](_0xe2781d);}};}function respondWithFilteredResult(_0x3ce1e3,_0x12eb18){return function(_0x404d0c){if(_0x404d0c){var _0x516810=typeof _0x12eb18[_0xb5c9('0x23')]==='undefined'&&typeof _0x12eb18[_0xb5c9('0x24')]===_0xb5c9('0x25');var _0x184265=_0x404d0c[_0xb5c9('0x26')];var _0x309bef=_0x516810?0x0:_0x12eb18['offset'];var _0x222f6c=_0x516810?_0x404d0c[_0xb5c9('0x26')]:_0x12eb18[_0xb5c9('0x23')]+_0x12eb18[_0xb5c9('0x24')];var _0x1c5226;if(_0x222f6c>=_0x184265){_0x222f6c=_0x184265;_0x1c5226=0xc8;}else{_0x1c5226=0xce;}_0x3ce1e3['status'](_0x1c5226);return _0x3ce1e3[_0xb5c9('0x27')]('Content-Range',_0x309bef+'-'+_0x222f6c+'/'+_0x184265)[_0xb5c9('0x28')](_0x404d0c);}return null;};}function patchUpdates(_0x279bc6){return function(_0x2d3628){try{jsonpatch['apply'](_0x2d3628,_0x279bc6,!![]);}catch(_0x406665){return BPromise[_0xb5c9('0x29')](_0x406665);}return _0x2d3628[_0xb5c9('0x2a')]();};}function saveUpdates(_0x40a7a1,_0x431d94){return function(_0x2109e4){if(_0x2109e4){return _0x2109e4['update'](_0x40a7a1)[_0xb5c9('0x2b')](function(_0x1b9f8b){return _0x1b9f8b;});}return null;};}function removeEntity(_0x2281af,_0x282eef){return function(_0x4416fd){if(_0x4416fd){return _0x4416fd['destroy']()[_0xb5c9('0x2b')](function(){_0x2281af[_0xb5c9('0x21')](0xcc)[_0xb5c9('0x22')]();});}};}function handleEntityNotFound(_0xda195c,_0x3ba11f){return function(_0x421bad){if(!_0x421bad){_0xda195c['sendStatus'](0x194);}return _0x421bad;};}function handleError(_0x1caa7b,_0xca267f){_0xca267f=_0xca267f||0x1f4;return function(_0x57335d){logger[_0xb5c9('0x2c')](_0x57335d['stack']);if(_0x57335d[_0xb5c9('0x2d')]){delete _0x57335d[_0xb5c9('0x2d')];}_0x1caa7b[_0xb5c9('0x21')](_0xca267f)[_0xb5c9('0x2e')](_0x57335d);};}function getInteractionUsers(_0x39eb84,_0x56186a){return new BPromise(function(_0x152d54,_0x403caa){try{if(_0x56186a[_0x39eb84['id']]){_0x39eb84[_0xb5c9('0x2f')]=_[_0xb5c9('0x30')](_0x56186a[_0x39eb84['id']],function(_0x2cb567){return{'id':_0x2cb567['id'],'fullname':_0x2cb567[_0xb5c9('0x31')]};});}}catch(_0x513691){_0x403caa(_0x513691);}_0x152d54(_0x39eb84);});}function getInteractionTags(_0x1c6145,_0x57ee60){return new BPromise(function(_0x2dcd43,_0x1d36ff){try{if(_0x1c6145[_0xb5c9('0x32')]){_0x1c6145[_0xb5c9('0x33')]=[];_0x1c6145[_0xb5c9('0x32')][_0xb5c9('0x34')](',')[_0xb5c9('0x35')](function(_0x3439d9){_0x1c6145[_0xb5c9('0x33')][_0xb5c9('0x36')](_0x57ee60[_0x3439d9]);});}delete _0x1c6145[_0xb5c9('0x32')];}catch(_0x440ed7){_0x1d36ff(_0x440ed7);}_0x2dcd43(_0x1c6145);});}function updateSmsInteraction(_0x51da61,_0x497bbd,_0x4f9fad){return new BPromise(function(_0x204c81,_0x2eed9e){return getInteractionUsers(_0x51da61,_0x4f9fad)[_0xb5c9('0x2b')](function(_0x23ddb9){return getInteractionTags(_0x23ddb9,_0x497bbd);})[_0xb5c9('0x2b')](function(_0x4bfd2d){return getStateInteraction(_0x4bfd2d);})['then'](function(_0x2b31dd){_0x204c81(_0x2b31dd);})['catch'](function(_0x298993){_0x2eed9e(_0x298993);});});}function getStateInteraction(_0x590039){return new BPromise(function(_0x1d30c9){_0x590039[_0xb5c9('0x37')]=0x0;_0x590039[_0xb5c9('0x38')]=0x0;_0x590039['answered']=0x0;_0x590039[_0xb5c9('0x39')]=0x0;_0x590039['total']=0x0;if(!_0x590039['closed']&&!_0x590039[_0xb5c9('0x3a')]){_0x590039['waiting']+=0x1;}if(!_0x590039[_0xb5c9('0x3b')]&&_0x590039['UserId']){_0x590039[_0xb5c9('0x38')]+=0x1;if(_0x590039[_0xb5c9('0x37')]){_0x590039[_0xb5c9('0x37')]-=0x1;}}if(_0x590039['closed']&&_0x590039[_0xb5c9('0x3a')]){_0x590039[_0xb5c9('0x3c')]+=0x1;if(_0x590039[_0xb5c9('0x38')]){_0x590039[_0xb5c9('0x38')]-=0x1;}}if(_0x590039['closed']&&!_0x590039[_0xb5c9('0x3a')]){_0x590039[_0xb5c9('0x39')]+=0x1;if(_0x590039[_0xb5c9('0x37')]){_0x590039[_0xb5c9('0x37')]-=0x1;}}_0x590039[_0xb5c9('0x3d')]+=0x1;_0x1d30c9(_0x590039);});}exports[_0xb5c9('0x3e')]=function(_0x2a0f5f,_0x190326){var _0x49f159={},_0x1586ae={},_0x109787={'count':0x0,'rows':[]};var _0x47afa8=_[_0xb5c9('0x30')](db[_0xb5c9('0x3f')][_0xb5c9('0x40')],function(_0x4eae){return{'name':_0x4eae[_0xb5c9('0x41')],'type':_0x4eae['type']['key']};});_0x1586ae['model']=_['map'](_0x47afa8,_0xb5c9('0x2d'));_0x1586ae[_0xb5c9('0x42')]=_[_0xb5c9('0x43')](_0x2a0f5f[_0xb5c9('0x42')]);_0x1586ae[_0xb5c9('0x44')]=_[_0xb5c9('0x45')](_0x1586ae[_0xb5c9('0x46')],_0x1586ae[_0xb5c9('0x42')]);_0x49f159[_0xb5c9('0x47')]=_[_0xb5c9('0x45')](_0x1586ae[_0xb5c9('0x46')],qs['fields'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x48')]));_0x49f159[_0xb5c9('0x47')]=_0x49f159[_0xb5c9('0x47')][_0xb5c9('0x49')]?_0x49f159[_0xb5c9('0x47')]:_0x1586ae[_0xb5c9('0x46')];if(!_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x4a')](_0xb5c9('0x4b'))){_0x49f159['limit']=qs['limit'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x24')]);_0x49f159[_0xb5c9('0x23')]=qs[_0xb5c9('0x23')](_0x2a0f5f['query']['offset']);}_0x49f159[_0xb5c9('0x4c')]=qs['sort'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x4d')]);_0x49f159['where']=qs[_0xb5c9('0x44')](_[_0xb5c9('0x4e')](_0x2a0f5f['query'],_0x1586ae[_0xb5c9('0x44')]),_0x47afa8);var _0x2b1988=[];var _0x4acb6f=squel[_0xb5c9('0x4f')]()['field']('id')[_0xb5c9('0x50')](_0xb5c9('0x2d'))['field'](_0xb5c9('0x51'))[_0xb5c9('0x52')](_0xb5c9('0x53'));var _0x410d73=squel[_0xb5c9('0x4f')]()[_0xb5c9('0x50')]('u.id')[_0xb5c9('0x50')]('u.fullname')[_0xb5c9('0x50')](_0xb5c9('0x54'))[_0xb5c9('0x52')](_0xb5c9('0x55'),'ui')[_0xb5c9('0x56')](_0xb5c9('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x43f4c3=squel['select']()[_0xb5c9('0x52')](_0xb5c9('0x58'),'i')[_0xb5c9('0x56')](_0xb5c9('0x59'),'c',_0xb5c9('0x5a'))[_0xb5c9('0x56')](_0xb5c9('0x57'),'o',_0xb5c9('0x5b'))[_0xb5c9('0x56')](_0xb5c9('0x5c'),'a',_0xb5c9('0x5d'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb5c9('0x56')](_0xb5c9('0x5e'),'it',_0xb5c9('0x5f'))[_0xb5c9('0x56')]('tools_tags','t',_0xb5c9('0x60'));var _0x5b5c91=squel[_0xb5c9('0x61')]();var _0x14a358=[];var _0x3dfdb0=squel[_0xb5c9('0x61')]();var _0x885d07;if(_0x2a0f5f['query'][_0xb5c9('0x62')]){_0x885d07=as[_0xb5c9('0x63')](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x62')]);var _0xa549ae=_0x885d07[_0xb5c9('0x64')];for(var _0x4d9123=0x0;_0x4d9123<_0x885d07['conditions'][_0xb5c9('0x49')];_0x4d9123++){var _0x567546=_0x885d07[_0xb5c9('0x65')][_0x4d9123];var _0x736b19='i';var _0x2bcbda=_['find'](_0x47afa8,[_0xb5c9('0x2d'),_0x567546[_0xb5c9('0x50')]]);if(!_0x2bcbda){switch(_0x567546[_0xb5c9('0x50')]){case'unreadMessages':if(_0x567546['value']==0x1){_0x43f4c3[_0xb5c9('0x66')]('`'+_0x567546[_0xb5c9('0x50')]+_0xb5c9('0x67'));}else{_0x43f4c3[_0xb5c9('0x66')]('`'+_0x567546[_0xb5c9('0x50')]+'`\x20>\x200');}break;case _0xb5c9('0x68'):if(_0x567546[_0xb5c9('0x69')]==='$substring'){if(_0x567546[_0xb5c9('0x6a')]['split']('\x20')[_0xb5c9('0x49')]>0x1){_0x5b5c91[_0xa549ae](_0xb5c9('0x6b'),qs[_0xb5c9('0x6c')](_0x567546[_0xb5c9('0x6a')]),null);}else{var _0x4e0dff='%'+_0x567546[_0xb5c9('0x6a')]+'%';_0x5b5c91[_0xa549ae](_0xb5c9('0x6d'),_0x4e0dff,_0x4e0dff,_0x4e0dff);}}else{_0x2bcbda=_['find'](_0x47afa8,['name',_0xb5c9('0x6e')]);_0x567546[_0xb5c9('0x50')]=_0xb5c9('0x6e');_0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x72')],_0x2587ac[_0xb5c9('0x6a')]['end']);}break;case'Tag':var _0xe4ed1c=_0x567546[_0xb5c9('0x6a')]['split'](',')['map'](function(_0x14ff25){return Number(_0x14ff25);});_0xe4ed1c['forEach'](function(_0x21392b){_0x3dfdb0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x21392b+',%');});_0x14a358=_['union'](_0x14a358,_0xe4ed1c);break;case _0xb5c9('0x73'):if(_0x567546[_0xb5c9('0x69')]===_0xb5c9('0x74')){_0x5b5c91[_0xa549ae](_0xb5c9('0x75'),'%'+_0x567546[_0xb5c9('0x6a')]+'%',null);}else{_0x2bcbda=_[_0xb5c9('0x76')](_0x47afa8,['name',_0xb5c9('0x3a')]);_0x567546[_0xb5c9('0x50')]=_0xb5c9('0x3a');_0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac['value'][_0xb5c9('0x72')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x22')]);}break;case _0xb5c9('0x77'):_0x2587ac=as[_0xb5c9('0x6f')]('me',null,_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x72')],_0x2587ac['value']['end']);break;}}else{var _0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac['text'],_0x2587ac[_0xb5c9('0x6a')]['start'],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x22')]);}}}else{var _0x276b86=_(_0x2a0f5f[_0xb5c9('0x42')])[_0xb5c9('0x43')]()[_0xb5c9('0x30')](function(_0x405852){return _[_0xb5c9('0x78')](_0x47afa8,[_0xb5c9('0x2d'),_0x405852])?_0x405852:undefined;})[_0xb5c9('0x79')]()[_0xb5c9('0x6a')]();if(!_[_0xb5c9('0x7a')](_0x276b86)){_0x276b86[_0xb5c9('0x35')](function(_0x48351a){if(_0x48351a===_0xb5c9('0x7b')){_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x7d'),[][_0xb5c9('0x7e')](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a]));}else if(_0x48351a===_0xb5c9('0x7f')){var _0x36f812=JSON['parse'](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a])['$gte'];var _0x856aa5=JSON[_0xb5c9('0x80')](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a])['$lte'];_0x43f4c3['where'](_0xb5c9('0x81'),_0x36f812,_0x856aa5);}else{if(_0x2a0f5f['query'][_0x48351a]==='null'){_0x43f4c3[_0xb5c9('0x7c')]('i.'+_0x48351a+_0xb5c9('0x82'));}else{_0x43f4c3[_0xb5c9('0x7c')]('i.'+_0x48351a+'\x20=\x20?',_0x2a0f5f[_0xb5c9('0x42')][_0x48351a]);}}});}if(_0x2a0f5f[_0xb5c9('0x42')]['read']){if(_0x2a0f5f[_0xb5c9('0x42')]['read']==0x1){_0x43f4c3[_0xb5c9('0x66')](_0xb5c9('0x83'));}else{_0x43f4c3['having'](_0xb5c9('0x84'));}}if(_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]){_0x14a358=_['isArray'](_0x2a0f5f[_0xb5c9('0x42')]['tag'])?_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]:new Array(_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]);_0x14a358[_0xb5c9('0x35')](function(_0x2a0ca2){_0x3dfdb0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a0ca2+',%');});}if(_0x2a0f5f['query'][_0xb5c9('0x86')]){var _0xa518d6=_0x2a0f5f['query']['filter']['replace']('\x5c','\x5c\x5c')[_0xb5c9('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xa518d6)){_0x5b5c91['or']('i.id\x20LIKE\x20?',_0xa518d6+'%')['or']('i.phone\x20LIKE\x20?',_0xa518d6+'%');}else{_0x5b5c91['or'](_0xb5c9('0x88'),qs[_0xb5c9('0x6c')](_0xa518d6))['or'](_0xb5c9('0x89'),_0xa518d6+'%');}}}_0x43f4c3[_0xb5c9('0x7c')](_0x5b5c91);_0x43f4c3['group'](_0xb5c9('0x8a'));var _0x3562c8={'type':db['Sequelize'][_0xb5c9('0x8b')][_0xb5c9('0x8c')],'raw':!![]};var _0x2af2c1=_0x43f4c3['clone']();_0x2af2c1[_0xb5c9('0x50')](_0xb5c9('0x8a'));_0x2af2c1[_0xb5c9('0x50')](_0xb5c9('0x8d'),_0xb5c9('0x8e'));if(_0x49f159['order']){_0x49f159[_0xb5c9('0x4c')][_0xb5c9('0x35')](function(_0x4d0fe4){var _0x3f2ee0=_0x4d0fe4[0x0]==='contactName'?_0x4d0fe4[0x0]:'i.'+_0x4d0fe4[0x0];_0x43f4c3[_0xb5c9('0x4c')](_0x3f2ee0,_0x4d0fe4[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb5c9('0x7a')](_0x14a358)){_0x43f4c3[_0xb5c9('0x66')](_0x3dfdb0);_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x8f'),_0x14a358);}BPromise['resolve']()[_0xb5c9('0x2b')](function(){if(!_0x885d07){if(_0x2a0f5f['query'][_0xb5c9('0x7b')])return;_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x90'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x90'));return;}if(_0x2a0f5f[_0xb5c9('0x91')][_0xb5c9('0x92')]!==_0xb5c9('0x93'))return;return _0x2a0f5f['user'][_0xb5c9('0x94')]({'attributes':['id'],'raw':!![]})[_0xb5c9('0x2b')](function(_0x178f57){if(_[_0xb5c9('0x7a')](_0x178f57)){_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x95'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x95'));}else{_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x7d'),_[_0xb5c9('0x30')](_0x178f57,'id'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x7d'),_[_0xb5c9('0x30')](_0x178f57,'id'));}});})[_0xb5c9('0x2b')](function(){if(_0x2a0f5f['user'][_0xb5c9('0x92')]===_0xb5c9('0x93')&&!_0x885d07&&!_0x2a0f5f[_0xb5c9('0x42')]['SmsAccountId'])return[];return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x2af2c1[_0xb5c9('0x97')](),_0x3562c8);})[_0xb5c9('0x2b')](function(_0x5df180){_0x109787['count']=_0x5df180[_0xb5c9('0x49')];if(_0x109787['count']===0x0)return[];return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x4acb6f[_0xb5c9('0x97')](),_0x3562c8)['then'](function(_0x2c8e20){_0x2b1988=_['keyBy'](_0x2c8e20,'id');_0x3562c8=_[_0xb5c9('0x98')](_0x3562c8,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a0f5f['query'][_0xb5c9('0x48')]){_0x49f159[_0xb5c9('0x47')][_0xb5c9('0x35')](function(_0x18e28c){_0x43f4c3[_0xb5c9('0x50')]('i.'+_0x18e28c);});}else{_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x8d'),_0xb5c9('0x8e'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x99'),'Account.key');_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9a'),_0xb5c9('0x9b'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9c'),_0xb5c9('0x9d'));_0x43f4c3['field'](_0xb5c9('0x9e'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9f'),_0xb5c9('0xa0'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa1'),_0xb5c9('0xa2'));_0x43f4c3['field'](_0xb5c9('0xa3'),_0xb5c9('0xa4'));_0x43f4c3[_0xb5c9('0x50')]('c.phone',_0xb5c9('0xa5'));_0x43f4c3[_0xb5c9('0x50')]('c.mobile',_0xb5c9('0xa6'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa7'),'Contact.fax');_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa8'),'Owner.fullname');_0x43f4c3['field'](_0xb5c9('0xa9'),_0xb5c9('0xaa'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xab'),_0xb5c9('0x32'));}if(_0x49f159[_0xb5c9('0x24')])_0x43f4c3[_0xb5c9('0x24')](_0x49f159['limit']);if(_0x49f159[_0xb5c9('0x23')])_0x43f4c3['offset'](_0x49f159[_0xb5c9('0x23')]);return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x43f4c3[_0xb5c9('0x97')](),_0x3562c8);})[_0xb5c9('0x2b')](function(_0x1e0819){if(_0x1e0819[_0xb5c9('0x49')]>0x0)_0x410d73[_0xb5c9('0x7c')](_0xb5c9('0xac'),_[_0xb5c9('0x30')](_0x1e0819,'id'));return db['sequelize'][_0xb5c9('0x42')](_0x410d73[_0xb5c9('0x97')](),_0x3562c8)[_0xb5c9('0x2b')](function(_0x49170b){var _0x4954ab=_[_0xb5c9('0xad')](_0x49170b,_0xb5c9('0xae'));var _0x4cba25=[];_0x1e0819[_0xb5c9('0x35')](function(_0x4b4315){_0x4cba25[_0xb5c9('0x36')](updateSmsInteraction(_0x4b4315,_0x2b1988,_0x4954ab));});return BPromise['all'](_0x4cba25);});});})['then'](function(_0x5ce092){_0x109787['rows']=_0x5ce092;return _0x109787;})[_0xb5c9('0x2b')](respondWithFilteredResult(_0x190326,_0x49f159))[_0xb5c9('0xaf')](handleError(_0x190326,null));};exports['show']=function(_0x175fc8,_0x3140d7){var _0x1932ef={'raw':![],'where':{'id':_0x175fc8[_0xb5c9('0xb0')]['id']}},_0x52d362={};_0x52d362[_0xb5c9('0x46')]=_[_0xb5c9('0x43')](db['SmsInteraction']['rawAttributes']);_0x52d362['query']=_[_0xb5c9('0x43')](_0x175fc8[_0xb5c9('0x42')]);_0x52d362[_0xb5c9('0x44')]=_[_0xb5c9('0x45')](_0x52d362[_0xb5c9('0x46')],_0x52d362[_0xb5c9('0x42')]);_0x1932ef['attributes']=_[_0xb5c9('0x45')](_0x52d362['model'],qs[_0xb5c9('0x48')](_0x175fc8['query'][_0xb5c9('0x48')]));_0x1932ef[_0xb5c9('0x47')]=_0x1932ef[_0xb5c9('0x47')][_0xb5c9('0x49')]?_0x1932ef['attributes']:_0x52d362[_0xb5c9('0x46')];if(_0x175fc8[_0xb5c9('0x42')][_0xb5c9('0xb1')]){_0x1932ef['include']=[{'all':!![]}];}_0x1932ef=_['merge']({},_0x1932ef,_0x175fc8[_0xb5c9('0xb2')]);return db[_0xb5c9('0x3f')][_0xb5c9('0x76')](_0x1932ef)['then'](handleEntityNotFound(_0x3140d7,null))[_0xb5c9('0x2b')](respondWithResult(_0x3140d7,null))[_0xb5c9('0xaf')](handleError(_0x3140d7,null));};exports[_0xb5c9('0xb3')]=function(_0x35b571,_0x473dd5){return db['SmsInteraction'][_0xb5c9('0xb3')](_0x35b571[_0xb5c9('0x77')],{})[_0xb5c9('0x2b')](respondWithResult(_0x473dd5,0xc9))[_0xb5c9('0xaf')](handleError(_0x473dd5,null));};exports[_0xb5c9('0xb4')]=function(_0x127255,_0x393d51){if(_0x127255[_0xb5c9('0x77')]['id']){delete _0x127255[_0xb5c9('0x77')]['id'];}return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x127255[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x393d51,null))[_0xb5c9('0x2b')](saveUpdates(_0x127255[_0xb5c9('0x77')],null))[_0xb5c9('0x2b')](respondWithResult(_0x393d51,null))[_0xb5c9('0xaf')](handleError(_0x393d51,null));};exports[_0xb5c9('0xb5')]=function(_0xc25157,_0x1d3681){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0xc25157[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x1d3681,null))[_0xb5c9('0x2b')](removeEntity(_0x1d3681,null))[_0xb5c9('0xaf')](handleError(_0x1d3681,null));};exports['describe']=function(_0xe2ae81,_0x56d633){return db[_0xb5c9('0x3f')][_0xb5c9('0xb6')]()[_0xb5c9('0x2b')](respondWithResult(_0x56d633,null))[_0xb5c9('0xaf')](handleError(_0x56d633,null));};exports[_0xb5c9('0xb7')]=function(_0x275895,_0x3ad74b,_0x48fbc4){return db[_0xb5c9('0xb8')]['find']({'where':{'id':_0x275895[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x3ad74b,null))['then'](function(_0x5c9adb){if(_0x5c9adb){return _0x5c9adb[_0xb5c9('0xb7')](_0x275895[_0xb5c9('0x77')][_0xb5c9('0xb9')],_[_0xb5c9('0xba')](_0x275895[_0xb5c9('0x77')],[_0xb5c9('0xb9'),'id'])||{});}})[_0xb5c9('0x2b')](respondWithResult(_0x3ad74b,null))[_0xb5c9('0xaf')](handleError(_0x3ad74b,null));};exports['getMessages']=function(_0x387840,_0x43b2a4,_0x2d8d40){var _0x4682d3={'raw':![],'where':{}};var _0x522708={};var _0x5021dd={'count':0x0,'rows':[]};return db[_0xb5c9('0x3f')][_0xb5c9('0xbb')]({'where':{'id':_0x387840[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x43b2a4,null))[_0xb5c9('0x2b')](function(_0x34d208){if(_0x34d208){_0x522708[_0xb5c9('0x46')]=_['keys'](db[_0xb5c9('0xb8')][_0xb5c9('0x40')]);_0x522708['query']=_[_0xb5c9('0x43')](_0x387840['query']);_0x522708[_0xb5c9('0x44')]=_['intersection'](_0x522708[_0xb5c9('0x46')],_0x522708[_0xb5c9('0x42')]);_0x4682d3[_0xb5c9('0x47')]=_[_0xb5c9('0x45')](_0x522708[_0xb5c9('0x46')],qs['fields'](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x48')]));_0x4682d3[_0xb5c9('0x47')]=_0x4682d3[_0xb5c9('0x47')]['length']?_0x4682d3[_0xb5c9('0x47')]:_0x522708['model'];if(!_0x387840[_0xb5c9('0x42')][_0xb5c9('0x4a')](_0xb5c9('0x4b'))){_0x4682d3[_0xb5c9('0x24')]=qs['limit'](_0x387840['query'][_0xb5c9('0x24')]);_0x4682d3[_0xb5c9('0x23')]=qs[_0xb5c9('0x23')](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x23')]);}_0x4682d3[_0xb5c9('0x4c')]=qs[_0xb5c9('0x4d')](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x4d')]);_0x4682d3[_0xb5c9('0x7c')]=qs[_0xb5c9('0x44')](_[_0xb5c9('0x4e')](_0x387840['query'],_0x522708['filters']));_0x4682d3[_0xb5c9('0x7c')][_0xb5c9('0xae')]=_0x34d208['id'];if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0x86')]){_0x4682d3[_0xb5c9('0x7c')]=_[_0xb5c9('0x98')](_0x4682d3['where'],{'$or':_[_0xb5c9('0x30')](_0x4682d3['attributes'],function(_0xa1fd05){var _0xc0d024={};_0xc0d024[_0xa1fd05]={'$like':'%'+_0x387840[_0xb5c9('0x42')]['filter']+'%'};return _0xc0d024;})});}if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0xbc')]){var _0x152ff4=_0x387840[_0xb5c9('0x42')][_0xb5c9('0xbc')][_0xb5c9('0x34')](',');var _0x2886d0={};_0x2886d0[_0x152ff4[0x0]]={'$gte':moment(_0x152ff4[0x1])[_0xb5c9('0xbd')](_0xb5c9('0xbe'))};_0x4682d3[_0xb5c9('0x7c')]=_[_0xb5c9('0x98')](_0x4682d3[_0xb5c9('0x7c')],_0x2886d0);}_0x4682d3=_['merge']({},_0x4682d3,_0x387840[_0xb5c9('0xb2')]);return db['SmsMessage'][_0xb5c9('0x26')]({'where':_0x4682d3[_0xb5c9('0x7c')]})[_0xb5c9('0x2b')](function(_0x1d3184){_0x5021dd['count']=_0x1d3184;if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0xb1')]){_0x4682d3['include']=[{'all':!![]}];}return db['SmsMessage'][_0xb5c9('0xbf')](_0x4682d3);})[_0xb5c9('0x2b')](function(_0x3a50bb){_0x5021dd[_0xb5c9('0xc0')]=_0x3a50bb;return _0x5021dd;});}})[_0xb5c9('0x2b')](respondWithFilteredResult(_0x43b2a4,_0x4682d3))[_0xb5c9('0xaf')](handleError(_0x43b2a4,null));};exports[_0xb5c9('0xc1')]=function(_0x2b2a5e,_0x406067,_0x440903){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x2b2a5e[_0xb5c9('0xb0')]['id']}})['then'](handleEntityNotFound(_0x406067,null))[_0xb5c9('0x2b')](function(_0x5942d1){if(_0x5942d1){return _0x5942d1[_0xb5c9('0xc2')](_0x2b2a5e[_0xb5c9('0x77')]['ids'],_[_0xb5c9('0xba')](_0x2b2a5e['body'],[_0xb5c9('0xb9'),'id'])||{})['spread'](function(){return db[_0xb5c9('0xc3')][_0xb5c9('0xbf')]({'attributes':['id',_0xb5c9('0x2d'),_0xb5c9('0x51')],'where':{'id':_0x2b2a5e[_0xb5c9('0x77')][_0xb5c9('0xb9')]}});})[_0xb5c9('0x2b')](function(_0x443def){socket[_0xb5c9('0xc4')](_0xb5c9('0xc5'),{'id':Number(_0x2b2a5e[_0xb5c9('0xb0')]['id']),'tags':_0x443def||[]});return{'id':Number(_0x2b2a5e[_0xb5c9('0xb0')]['id']),'tags':_0x443def||[]};});}})[_0xb5c9('0x2b')](respondWithResult(_0x406067,null))[_0xb5c9('0xaf')](handleError(_0x406067,null));};exports[_0xb5c9('0xc6')]=function(_0x38c261,_0x10f1b4,_0x361684){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x38c261[_0xb5c9('0xb0')]['id']}})['then'](handleEntityNotFound(_0x10f1b4,null))['then'](function(_0xdab298){if(_0xdab298){return _0xdab298[_0xb5c9('0xc6')](_0x38c261[_0xb5c9('0x42')][_0xb5c9('0xb9')]);}})['then'](respondWithStatusCode(_0x10f1b4,null))[_0xb5c9('0xaf')](handleError(_0x10f1b4,null));};exports[_0xb5c9('0xc7')]=function(_0x86d5d3,_0x5dcbe3){var _0x20fc0b=moment()[_0xb5c9('0xc8')]()[_0xb5c9('0x97')]();var _0x249978=path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],_0xb5c9('0xcb'),_0xb5c9('0xcc'),_0xb5c9('0xcd'));var _0x201c5c=path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],'server',_0xb5c9('0xcc'),_0xb5c9('0xce'));var _0x680381=path[_0xb5c9('0xc9')](_0x249978,_0x20fc0b);var _0x2394f2=util['format'](_0xb5c9('0xcf'),_0x86d5d3[_0xb5c9('0xb0')]['id'],_0x20fc0b);var _0x473742=path[_0xb5c9('0xc9')](_0x249978,_0x2394f2);var _0x24dfaa=[];_0x24dfaa[_0xb5c9('0x36')]({'model':db[_0xb5c9('0x73')],'as':_0xb5c9('0x73'),'attributes':['id',_0xb5c9('0x31')],'raw':!![]});_0x24dfaa[_0xb5c9('0x36')]({'model':db['CmContact'],'as':_0xb5c9('0x68'),'attributes':['id',_0xb5c9('0xd0'),_0xb5c9('0xd1')],'raw':!![]});var _0x195f3a=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb5c9('0x77'),'createdAt',_0xb5c9('0xd2'),'secret',_0xb5c9('0xd3')],'include':_0x24dfaa}];_0x195f3a['push']({'model':db[_0xb5c9('0xd4')],'as':_0xb5c9('0xd5'),'attributes':['id','name']});_0x195f3a[_0xb5c9('0x36')]({'model':db[_0xb5c9('0x73')],'as':'Owner','attributes':['id',_0xb5c9('0x31')]});return db['SmsInteraction'][_0xb5c9('0x76')]({'where':{'id':_0x86d5d3['params']['id']},'include':_0x195f3a})[_0xb5c9('0x2b')](handleEntityNotFound(_0x5dcbe3,null))[_0xb5c9('0x2b')](function(_0x5d9580){if(_0x5d9580){var _0x2db4d9=_0x5d9580[_0xb5c9('0xd6')]({'plain':!![]});fs[_0xb5c9('0xd7')](_0x680381);var _0x1ae8a4={'channel':_0xb5c9('0xd8'),'account':_0x2db4d9[_0xb5c9('0xd5')][_0xb5c9('0x2d')],'agent':_0x2db4d9[_0xb5c9('0xd9')]?_0x2db4d9[_0xb5c9('0xd9')][_0xb5c9('0x31')]:_0xb5c9('0xda'),'createdAt':moment(_0x2db4d9[_0xb5c9('0x7f')])['format'](_0xb5c9('0xbe'))[_0xb5c9('0x97')](),'closedAt':_0x2db4d9[_0xb5c9('0x3b')]?moment(_0x2db4d9[_0xb5c9('0xdb')])[_0xb5c9('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5c9('0x97')]():'','disposition':_0x2db4d9[_0xb5c9('0xdc')],'messages':_(_0x2db4d9[_0xb5c9('0xdd')])[_0xb5c9('0x86')]({'secret':![]})[_0xb5c9('0x30')](function(_0x1c6b38){return{'date':moment(_0x1c6b38[_0xb5c9('0x7f')])[_0xb5c9('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1c6b38[_0xb5c9('0xd2')]===_0xb5c9('0xde')?_0x1c6b38[_0xb5c9('0x73')]?_0x1c6b38[_0xb5c9('0x73')][_0xb5c9('0x31')]:'System':_0x1c6b38[_0xb5c9('0x68')]['firstName']+(_0x1c6b38[_0xb5c9('0x68')]['lastName']?'\x20'+_0x1c6b38[_0xb5c9('0x68')][_0xb5c9('0xd1')]:''),'body':_0x1c6b38[_0xb5c9('0x77')],'direction':_0x1c6b38[_0xb5c9('0xd2')]==='out'?'A':'C','secret':_0x1c6b38[_0xb5c9('0xdf')],'read':_0x1c6b38['read']};})['value']()};return ejs['renderFile'](path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],_0xb5c9('0xcb'),_0xb5c9('0xe0'),_0xb5c9('0xe1')),{'interaction':_0x1ae8a4})[_0xb5c9('0x2b')](function(_0x3d2918){var _0x1fae91=path['join'](_0x680381,_0xb5c9('0xe2')+_0x2db4d9['id']+'-'+_0x20fc0b+'.pdf');var _0x313b62={'path':_0x1fae91,'channel':_0xb5c9('0xd8'),'interactionId':_0x2db4d9['id']};return pdf[_0xb5c9('0xe3')](_0x3d2918,_0x313b62);})[_0xb5c9('0x2b')](function(){return new BPromise(function(_0x1f6683,_0x3e12c8){zipdir(_0x680381,{'saveTo':_0x473742},function(_0x46b684,_0x423cb4){if(_0x46b684)return _0x3e12c8(_0x46b684);return _0x1f6683(_0x423cb4);});})['then'](function(){return new BPromise(function(_0x3c5caf,_0xdf828c){rimraf(_0x680381,function(_0x570c1c){if(_0x570c1c)_0xdf828c(_0x570c1c);return _0x3c5caf();});});})[_0xb5c9('0x2b')](function(){return _0x5dcbe3['download'](_0x473742,_0x2394f2,function(_0x22dac0){if(_0x22dac0){console['log'](_0xb5c9('0xe4'),_0x22dac0);}else{fs[_0xb5c9('0xe5')](_0x473742);}});});});}else{return _0x5dcbe3[_0xb5c9('0x20')](0xc8);}})[_0xb5c9('0xaf')](handleError(_0x5dcbe3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a457c42..b818821 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 _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x18b305,_0x1e459b){var _0xe43edf=function(_0x389e1e){while(--_0x389e1e){_0x18b305['push'](_0x18b305['shift']());}};_0xe43edf(++_0x1e459b);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x27102b,_0x89db4f){_0x27102b=_0x27102b-0x0;var _0x35409e=_0xdd4f[_0x27102b];return _0x35409e;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xb10b=['remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x3ece20,_0x3d8777){var _0x14e828=function(_0x5d2539){while(--_0x5d2539){_0x3ece20['push'](_0x3ece20['shift']());}};_0x14e828(++_0x3d8777);}(_0xb10b,0x12a));var _0xbb10=function(_0x7f82c7,_0x2bec9d){_0x7f82c7=_0x7f82c7-0x0;var _0xccd46=_0xb10b[_0x7f82c7];return _0xccd46;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xbb10('0x1')];var SmsMessage=require(_0xbb10('0x2'))['db'][_0xbb10('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb10('0x4'),'afterUpdate':_0xbb10('0x5'),'afterDestroy':_0xbb10('0x6')};function emitEvent(_0x22320e){return function(_0x49baf4,_0x312b72,_0x481979){_0x49baf4[_0xbb10('0x7')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x8')](function(_0x513741){_0x49baf4[_0xbb10('0x9')](_0xbb10('0xa'),_0x513741[_0xbb10('0xb')](function(_0x1c3ee5){return{'id':_0x1c3ee5['id']};}));return SmsMessage[_0xbb10('0xc')]({'where':{'SmsInteractionId':_0x49baf4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb10('0x8')](function(_0x229887){_0x49baf4[_0xbb10('0x9')]('unreadMessages',_0x229887['length']);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e+':'+_0x49baf4['id'],_0x49baf4);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e,_0x49baf4);_0x481979(null);})[_0xbb10('0xe')](_0x481979(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xbb10('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9487108..61fa0f9 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 _0xd8fa=['format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x4571b8,_0x1c2a2e){var _0x1ac5b6=function(_0x21081c){while(--_0x21081c){_0x4571b8['push'](_0x4571b8['shift']());}};_0x1ac5b6(++_0x1c2a2e);}(_0xd8fa,0xa2));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad8f('0x0'))(_0xad8f('0x1'));var moment=require(_0xad8f('0x2'));var BPromise=require('bluebird');var rp=require(_0xad8f('0x3'));var fs=require('fs');var path=require(_0xad8f('0x4'));var rimraf=require(_0xad8f('0x5'));var config=require(_0xad8f('0x6'));var attributes=require(_0xad8f('0x7'));module['exports']=function(_0x477e8a,_0xc64422){return _0x477e8a[_0xad8f('0x8')](_0xad8f('0x9'),attributes,{'tableName':_0xad8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26f0b6,_0x5bce2b,_0x1ad882){if(_0x26f0b6[_0xad8f('0xb')](_0xad8f('0xc'))){_0x26f0b6[_0xad8f('0xd')]=moment()[_0xad8f('0xe')](_0xad8f('0xf'));}_0x1ad882(null,_0x26f0b6);}}});}; \ No newline at end of file +var _0xb80f=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2b3b1d,_0x2b3004){var _0x4b15cb=function(_0x78f031){while(--_0x78f031){_0x2b3b1d['push'](_0x2b3b1d['shift']());}};_0x4b15cb(++_0x2b3004);}(_0xb80f,0x12b));var _0xfb80=function(_0x53415f,_0x49f49d){_0x53415f=_0x53415f-0x0;var _0x192a85=_0xb80f[_0x53415f];return _0x192a85;};'use strict';var _=require(_0xfb80('0x0'));var util=require(_0xfb80('0x1'));var logger=require(_0xfb80('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfb80('0x3'));var rp=require(_0xfb80('0x4'));var fs=require('fs');var path=require(_0xfb80('0x5'));var rimraf=require(_0xfb80('0x6'));var config=require(_0xfb80('0x7'));var attributes=require(_0xfb80('0x8'));module[_0xfb80('0x9')]=function(_0x3cffae,_0x22dce3){return _0x3cffae['define'](_0xfb80('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36386a,_0x3a1dbc,_0x48e35a){if(_0x36386a[_0xfb80('0xb')](_0xfb80('0xc'))){_0x36386a[_0xfb80('0xd')]=moment()['format'](_0xfb80('0xe'));}_0x48e35a(null,_0x36386a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 00fdac1..ad8eb54 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 _0x2ebe=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','find','then','body','omit','ids','spread','AddTags','debug','lodash'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x2ebe,0xef));var _0xe2eb=function(_0x34c3d4,_0x1cae75){_0x34c3d4=_0x34c3d4-0x0;var _0x4c56bd=_0x2ebe[_0x34c3d4];return _0x4c56bd;};'use strict';var _=require(_0xe2eb('0x0'));var util=require(_0xe2eb('0x1'));var moment=require(_0xe2eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2eb('0x3'));var fs=require('fs');var Redis=require(_0xe2eb('0x4'));var db=require(_0xe2eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2eb('0x6'))(_0xe2eb('0x7'));var config=require(_0xe2eb('0x8'));var jayson=require(_0xe2eb('0x9'));var client=jayson[_0xe2eb('0xa')][_0xe2eb('0xb')]({'port':0x232a});config[_0xe2eb('0xc')]=_[_0xe2eb('0xd')](config[_0xe2eb('0xc')],{'host':_0xe2eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2eb('0xc')]));require(_0xe2eb('0xf'))[_0xe2eb('0x10')](socket);function respondWithRpcPromise(_0x2e4d02,_0x55a5fa,_0x486bd2){return new BPromise(function(_0x44fe27,_0x22b8a1){return client['request'](_0x2e4d02,_0x486bd2)['then'](function(_0x389956){logger[_0xe2eb('0x11')](_0xe2eb('0x12'),_0x55a5fa,_0xe2eb('0x13'));logger['debug'](_0xe2eb('0x14'),_0x55a5fa,_0xe2eb('0x13'),JSON[_0xe2eb('0x15')](_0x389956));if(_0x389956[_0xe2eb('0x16')]){if(_0x389956[_0xe2eb('0x16')][_0xe2eb('0x17')]===0x1f4){logger[_0xe2eb('0x16')](_0xe2eb('0x12'),_0x55a5fa,_0x389956['error'][_0xe2eb('0x18')]);return _0x22b8a1(_0x389956[_0xe2eb('0x16')][_0xe2eb('0x18')]);}logger[_0xe2eb('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x55a5fa,_0x389956[_0xe2eb('0x16')][_0xe2eb('0x18')]);return _0x44fe27(_0x389956['error']['message']);}else{logger['info'](_0xe2eb('0x12'),_0x55a5fa,_0xe2eb('0x13'));_0x44fe27(_0x389956['result']['message']);}})[_0xe2eb('0x19')](function(_0x2c29ca){logger[_0xe2eb('0x16')](_0xe2eb('0x12'),_0x55a5fa,_0x2c29ca);_0x22b8a1(_0x2c29ca);});});}exports[_0xe2eb('0x1a')]=function(_0x343bb6){var _0x43a40a=this;return new Promise(function(_0x20046d,_0x51aa4c){return db[_0xe2eb('0x1b')]['update'](_0x343bb6['body'],{'raw':_0x343bb6['options']?_0x343bb6[_0xe2eb('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x343bb6[_0xe2eb('0x1c')]?_0x343bb6['options'][_0xe2eb('0x1d')]||null:null,'attributes':_0x343bb6[_0xe2eb('0x1c')]?_0x343bb6[_0xe2eb('0x1c')][_0xe2eb('0x1e')]||null:null,'limit':_0x343bb6[_0xe2eb('0x1c')]?_0x343bb6['options'][_0xe2eb('0x1f')]||null:null})['then'](function(_0x57b1b8){logger[_0xe2eb('0x11')](_0xe2eb('0x1a'),_0x343bb6);logger['debug'](_0xe2eb('0x1a'),_0x343bb6,JSON[_0xe2eb('0x15')](_0x57b1b8));_0x20046d(_0x57b1b8);})[_0xe2eb('0x19')](function(_0x59d7b3){logger[_0xe2eb('0x16')](_0xe2eb('0x1a'),_0x59d7b3[_0xe2eb('0x18')],_0x343bb6);_0x51aa4c(_0x43a40a[_0xe2eb('0x16')](0x1f4,_0x59d7b3[_0xe2eb('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4d5d4e){return new Promise(function(_0x914c3f,_0x7a4e99){return db['SmsInteraction'][_0xe2eb('0x20')]({'where':_0x4d5d4e[_0xe2eb('0x1c')]?_0x4d5d4e[_0xe2eb('0x1c')][_0xe2eb('0x1d')]||null:null})[_0xe2eb('0x21')](function(_0x4cdac5){if(_0x4cdac5){return _0x4cdac5['addTags'](_0x4d5d4e[_0xe2eb('0x22')]['ids'],_[_0xe2eb('0x23')](_0x4d5d4e['body'],[_0xe2eb('0x24'),'id'])||{});}})[_0xe2eb('0x25')](function(_0x2dcc8d){logger[_0xe2eb('0x11')](_0xe2eb('0x26'),_0x4d5d4e);logger[_0xe2eb('0x27')](_0xe2eb('0x26'),_0x4d5d4e,JSON['stringify'](_0x2dcc8d));_0x914c3f(_0x2dcc8d);})[_0xe2eb('0x19')](function(_0x2ef7d9){logger[_0xe2eb('0x16')]('AddTags',_0x2ef7d9['message'],_0x4d5d4e);_0x7a4e99(_this[_0xe2eb('0x16')](0x1f4,_0x2ef7d9['message']));});});}; \ No newline at end of file +var _0x90cc=['SmsInteraction,\x20%s,\x20%s','info','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x90cc,0x119));var _0xc90c=function(_0xa306da,_0x2ef307){_0xa306da=_0xa306da-0x0;var _0x29f2db=_0x90cc[_0xa306da];return _0x29f2db;};'use strict';var _=require(_0xc90c('0x0'));var util=require(_0xc90c('0x1'));var moment=require('moment');var BPromise=require(_0xc90c('0x2'));var rs=require(_0xc90c('0x3'));var fs=require('fs');var Redis=require(_0xc90c('0x4'));var db=require(_0xc90c('0x5'))['db'];var utils=require(_0xc90c('0x6'));var logger=require(_0xc90c('0x7'))(_0xc90c('0x8'));var config=require(_0xc90c('0x9'));var jayson=require(_0xc90c('0xa'));var client=jayson[_0xc90c('0xb')][_0xc90c('0xc')]({'port':0x232a});config[_0xc90c('0xd')]=_['defaults'](config[_0xc90c('0xd')],{'host':_0xc90c('0xe'),'port':0x18eb});var socket=require(_0xc90c('0xf'))(new Redis(config[_0xc90c('0xd')]));require(_0xc90c('0x10'))[_0xc90c('0x11')](socket);function respondWithRpcPromise(_0x550c0c,_0xf41598,_0x31b439){return new BPromise(function(_0x43147a,_0x5731cc){return client[_0xc90c('0x12')](_0x550c0c,_0x31b439)[_0xc90c('0x13')](function(_0x1ffd13){logger['info']('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0xc90c('0x14'));logger[_0xc90c('0x15')](_0xc90c('0x16'),_0xf41598,_0xc90c('0x14'),JSON[_0xc90c('0x17')](_0x1ffd13));if(_0x1ffd13[_0xc90c('0x18')]){if(_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x19')]===0x1f4){logger[_0xc90c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0x1ffd13[_0xc90c('0x18')]['message']);return _0x5731cc(_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x1a')]);}logger[_0xc90c('0x18')](_0xc90c('0x1b'),_0xf41598,_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x1a')]);return _0x43147a(_0x1ffd13['error'][_0xc90c('0x1a')]);}else{logger[_0xc90c('0x1c')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0xc90c('0x14'));_0x43147a(_0x1ffd13[_0xc90c('0x1d')]['message']);}})[_0xc90c('0x1e')](function(_0x408294){logger[_0xc90c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0x408294);_0x5731cc(_0x408294);});});}exports[_0xc90c('0x1f')]=function(_0x1dfa93){var _0x4aaad2=this;return new Promise(function(_0x33026f,_0x462c87){return db[_0xc90c('0x20')]['update'](_0x1dfa93[_0xc90c('0x21')],{'raw':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')][_0xc90c('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')]['where']||null:null,'attributes':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')]['attributes']||null:null,'limit':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')][_0xc90c('0x24')]||null:null})[_0xc90c('0x13')](function(_0x385cf9){logger['info'](_0xc90c('0x1f'),_0x1dfa93);logger[_0xc90c('0x15')]('UpdateSmsInteraction',_0x1dfa93,JSON[_0xc90c('0x17')](_0x385cf9));_0x33026f(_0x385cf9);})[_0xc90c('0x1e')](function(_0x14650b){logger[_0xc90c('0x18')](_0xc90c('0x1f'),_0x14650b[_0xc90c('0x1a')],_0x1dfa93);_0x462c87(_0x4aaad2[_0xc90c('0x18')](0x1f4,_0x14650b['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x2996f1){return new Promise(function(_0x321b10,_0x3faf41){return db[_0xc90c('0x20')][_0xc90c('0x25')]({'where':_0x2996f1[_0xc90c('0x22')]?_0x2996f1['options'][_0xc90c('0x26')]||null:null})['then'](function(_0x4406c6){if(_0x4406c6){return _0x4406c6[_0xc90c('0x27')](_0x2996f1['body'][_0xc90c('0x28')],_[_0xc90c('0x29')](_0x2996f1[_0xc90c('0x21')],[_0xc90c('0x28'),'id'])||{});}})[_0xc90c('0x2a')](function(_0x288ba4){logger[_0xc90c('0x1c')](_0xc90c('0x2b'),_0x2996f1);logger[_0xc90c('0x15')](_0xc90c('0x2b'),_0x2996f1,JSON[_0xc90c('0x17')](_0x288ba4));_0x321b10(_0x288ba4);})[_0xc90c('0x1e')](function(_0x35de62){logger[_0xc90c('0x18')]('AddTags',_0x35de62[_0xc90c('0x1a')],_0x2996f1);_0x3faf41(_this[_0xc90c('0x18')](0x1f4,_0x35de62[_0xc90c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4e96c15..51450a2 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 _0x534c=['register','length','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x534c,0x1da));var _0xc534=function(_0x488715,_0x11d789){_0x488715=_0x488715-0x0;var _0x210c89=_0x534c[_0x488715];return _0x210c89;};'use strict';var SmsInteractionEvents=require(_0xc534('0x0'));var events=[_0xc534('0x1'),_0xc534('0x2'),_0xc534('0x3')];function createListener(_0x14941f,_0x52b8e8){return function(_0x5abf87){_0x52b8e8[_0xc534('0x4')](_0x14941f,_0x5abf87);};}function removeListener(_0x1af1d1,_0x5a5295){return function(){SmsInteractionEvents[_0xc534('0x5')](_0x1af1d1,_0x5a5295);};}exports[_0xc534('0x6')]=function(_0x2df71a){for(var _0x4304ac=0x0,_0x3ba8e0=events[_0xc534('0x7')];_0x4304ac<_0x3ba8e0;_0x4304ac++){var _0x4ea247=events[_0x4304ac];var _0x2ae249=createListener('smsInteraction:'+_0x4ea247,_0x2df71a);SmsInteractionEvents['on'](_0x4ea247,_0x2ae249);}}; \ No newline at end of file +var _0x694e=['removeListener','length','./smsInteraction.events','remove','update','emit'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x694e,0x1f4));var _0xe694=function(_0x5e2678,_0x28a810){_0x5e2678=_0x5e2678-0x0;var _0x123dac=_0x694e[_0x5e2678];return _0x123dac;};'use strict';var SmsInteractionEvents=require(_0xe694('0x0'));var events=['save',_0xe694('0x1'),_0xe694('0x2')];function createListener(_0x2d5f31,_0x519d0c){return function(_0x175189){_0x519d0c[_0xe694('0x3')](_0x2d5f31,_0x175189);};}function removeListener(_0x13a838,_0x3e4105){return function(){SmsInteractionEvents[_0xe694('0x4')](_0x13a838,_0x3e4105);};}exports['register']=function(_0x210814){for(var _0x35bc8c=0x0,_0xc6ba15=events[_0xe694('0x5')];_0x35bc8c<_0xc6ba15;_0x35bc8c++){var _0x434b48=events[_0x35bc8c];var _0x62a923=createListener('smsInteraction:'+_0x434b48,_0x210814);SmsInteractionEvents['on'](_0x434b48,_0x62a923);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 7a3370a..9124d4f 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 _0xc85a=['/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','describe','/:id','isAuthenticated','post','smsmessage:create','create','/:id/status','status','update','/:id/accept','accept','put'];(function(_0xf9b182,_0x514d58){var _0xfef7bb=function(_0x50bb24){while(--_0x50bb24){_0xf9b182['push'](_0xf9b182['shift']());}};_0xfef7bb(++_0x514d58);}(_0xc85a,0x90));var _0xac85=function(_0x1d15ae,_0x3942b7){_0x1d15ae=_0x1d15ae-0x0;var _0x42af3d=_0xc85a[_0x1d15ae];return _0x42af3d;};'use strict';var multer=require(_0xac85('0x0'));var util=require(_0xac85('0x1'));var path=require(_0xac85('0x2'));var timeout=require(_0xac85('0x3'));var express=require(_0xac85('0x4'));var router=express[_0xac85('0x5')]();var fs_extra=require(_0xac85('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xac85('0x7'));var config=require(_0xac85('0x8'));var controller=require(_0xac85('0x9'));router[_0xac85('0xa')]('/',auth['isAuthenticated'](),controller[_0xac85('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xac85('0xc')]);router[_0xac85('0xa')](_0xac85('0xd'),auth[_0xac85('0xe')](),controller['show']);router[_0xac85('0xf')]('/',auth[_0xac85('0xe')](),interaction['tracked']('sms',_0xac85('0x10')),controller[_0xac85('0x11')]);router['post'](_0xac85('0x12'),controller[_0xac85('0x13')]);router['put'](_0xac85('0xd'),auth[_0xac85('0xe')](),controller[_0xac85('0x14')]);router['put'](_0xac85('0x15'),auth[_0xac85('0xe')](),controller[_0xac85('0x16')]);router[_0xac85('0x17')](_0xac85('0x18'),auth[_0xac85('0xe')](),controller[_0xac85('0x19')]);router[_0xac85('0x1a')](_0xac85('0xd'),auth[_0xac85('0xe')](),controller['destroy']);module[_0xac85('0x1b')]=router; \ No newline at end of file +var _0x1794=['Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','smsmessage:create','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express'];(function(_0xd22cfd,_0x4a15ea){var _0x12b386=function(_0x41313e){while(--_0x41313e){_0xd22cfd['push'](_0xd22cfd['shift']());}};_0x12b386(++_0x4a15ea);}(_0x1794,0x19d));var _0x4179=function(_0x15fca7,_0x382d0b){_0x15fca7=_0x15fca7-0x0;var _0x2dc354=_0x1794[_0x15fca7];return _0x2dc354;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4179('0x0'));var timeout=require(_0x4179('0x1'));var express=require(_0x4179('0x2'));var router=express[_0x4179('0x3')]();var fs_extra=require(_0x4179('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4179('0x5'));var controller=require(_0x4179('0x6'));router[_0x4179('0x7')]('/',auth[_0x4179('0x8')](),controller[_0x4179('0x9')]);router[_0x4179('0x7')](_0x4179('0xa'),auth[_0x4179('0x8')](),controller[_0x4179('0xb')]);router[_0x4179('0x7')]('/:id',auth[_0x4179('0x8')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth['isAuthenticated'](),interaction[_0x4179('0xe')]('sms',_0x4179('0xf')),controller['create']);router[_0x4179('0xd')]('/:id/status',controller[_0x4179('0x10')]);router[_0x4179('0x11')](_0x4179('0x12'),auth['isAuthenticated'](),controller[_0x4179('0x13')]);router['put'](_0x4179('0x14'),auth[_0x4179('0x8')](),controller['accept']);router[_0x4179('0x11')](_0x4179('0x15'),auth['isAuthenticated'](),controller[_0x4179('0x16')]);router[_0x4179('0x17')](_0x4179('0x12'),auth[_0x4179('0x8')](),controller[_0x4179('0x18')]);module[_0x4179('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2ed33f2..44112b7 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 _0x09eb=['ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN'];(function(_0x49cb92,_0x3c31a6){var _0x16ee5a=function(_0x48e0c6){while(--_0x48e0c6){_0x49cb92['push'](_0x49cb92['shift']());}};_0x16ee5a(++_0x3c31a6);}(_0x09eb,0x1d9));var _0xb09e=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x09eb[_0x408e38];return _0x426b0e;};'use strict';var Sequelize=require(_0xb09e('0x0'));module[_0xb09e('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb09e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb09e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb09e('0x4')]('in',_0xb09e('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb09e('0x6')](0xbe)},'phone':{'type':Sequelize[_0xb09e('0x6')]},'readAt':{'type':Sequelize[_0xb09e('0x7')]},'secret':{'type':Sequelize[_0xb09e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb09e('0x6')]},'providerResponse':{'type':Sequelize[_0xb09e('0x8')]}}; \ No newline at end of file +var _0x3863=['STRING','DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3e7c7b,_0x233660){var _0x2938b2=function(_0x3e3e73){while(--_0x3e3e73){_0x3e7c7b['push'](_0x3e7c7b['shift']());}};_0x2938b2(++_0x233660);}(_0x3863,0x72));var _0x3386=function(_0x36da2c,_0x47404f){_0x36da2c=_0x36da2c-0x0;var _0x437a93=_0x3863[_0x36da2c];return _0x437a93;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3386('0x0')](_0x3386('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3386('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3386('0x3')]('in',_0x3386('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3386('0x5')]},'readAt':{'type':Sequelize[_0x3386('0x6')]},'secret':{'type':Sequelize[_0x3386('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3386('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 045836f..eef4fa3 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 _0x620b=['model','query','keys','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','describe','sms-interactions','sms','read','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','get','interaction','stringify','null','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','SmsAccount','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','infobip','eml-format','rimraf','zip-dir','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','SmsMessage','rawAttributes'];(function(_0x459e81,_0x52aeb0){var _0x4fac6a=function(_0x2880ae){while(--_0x2880ae){_0x459e81['push'](_0x459e81['shift']());}};_0x4fac6a(++_0x52aeb0);}(_0x620b,0x167));var _0xb620=function(_0x28a832,_0x1fc4ff){_0x28a832=_0x28a832-0x0;var _0x402553=_0x620b[_0x28a832];return _0x402553;};'use strict';var emlformat=require(_0xb620('0x0'));var rimraf=require(_0xb620('0x1'));var zipdir=require(_0xb620('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb620('0x3'));var util=require('util');var path=require(_0xb620('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb620('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb620('0x6'));var squel=require(_0xb620('0x7'));var crypto=require(_0xb620('0x8'));var jsforce=require(_0xb620('0x9'));var deskjs=require(_0xb620('0xa'));var toCsv=require(_0xb620('0xb'));var querystring=require(_0xb620('0xc'));var Papa=require(_0xb620('0xd'));var Redis=require('ioredis');var authService=require(_0xb620('0xe'));var qs=require(_0xb620('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb620('0x10'));var logger=require(_0xb620('0x11'))(_0xb620('0x12'));var utils=require(_0xb620('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb620('0x14'));var db=require('../../mysqldb')['db'];config[_0xb620('0x15')]=_[_0xb620('0x16')](config[_0xb620('0x15')],{'host':_0xb620('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb620('0x15')]));require('./smsMessage.socket')[_0xb620('0x18')](socket);var jayson=require(_0xb620('0x19'));var client=jayson[_0xb620('0x1a')][_0xb620('0x1b')]({'port':0x232c});var client9002=jayson[_0xb620('0x1a')][_0xb620('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x192423,_0x3f3177,_0x5530a8,_0x3f89c8){return new BPromise(function(_0x5413ce,_0x9237eb){var _0xa2bf8a=_0x3f89c8||client;return _0xa2bf8a[_0xb620('0x1c')](_0x192423,_0x5530a8)[_0xb620('0x1d')](function(_0x114aad){logger[_0xb620('0x1e')](_0xb620('0x1f'),_0x3f3177,'request\x20sent');logger['debug'](_0xb620('0x20'),_0x3f3177,_0xb620('0x21'),JSON['stringify'](_0x114aad));if(_0x114aad[_0xb620('0x22')]){if(_0x114aad[_0xb620('0x22')][_0xb620('0x23')]===0x1f4){logger[_0xb620('0x22')]('SmsMessage,\x20%s,\x20%s',_0x3f3177,_0x114aad[_0xb620('0x22')][_0xb620('0x24')]);return _0x9237eb(_0x114aad['error'][_0xb620('0x24')]);}logger['error'](_0xb620('0x1f'),_0x3f3177,_0x114aad['error'][_0xb620('0x24')]);return _0x5413ce(_0x114aad[_0xb620('0x22')]['message']);}else{logger[_0xb620('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x3f3177,'request\x20sent');_0x5413ce(_0x114aad[_0xb620('0x25')][_0xb620('0x24')]);}})[_0xb620('0x26')](function(_0x1b64b7){logger[_0xb620('0x22')]('SmsMessage,\x20%s,\x20%s',_0x3f3177,_0x1b64b7);_0x9237eb(_0x1b64b7);});});}function respondWithStatusCode(_0x6bd78c,_0x16f137){_0x16f137=_0x16f137||0xcc;return function(_0x593e48){if(_0x593e48){return _0x6bd78c['sendStatus'](_0x16f137);}return _0x6bd78c[_0xb620('0x27')](_0x16f137)[_0xb620('0x28')]();};}function respondWithResult(_0x41c487,_0x28370d){_0x28370d=_0x28370d||0xc8;return function(_0x39ac8f){if(_0x39ac8f){return _0x41c487[_0xb620('0x27')](_0x28370d)[_0xb620('0x29')](_0x39ac8f);}};}function respondWithFilteredResult(_0xa138bd,_0x597100){return function(_0x41af1a){if(_0x41af1a){var _0x1ef1cb=typeof _0x597100['offset']===_0xb620('0x2a')&&typeof _0x597100['limit']===_0xb620('0x2a');var _0x463e93=_0x41af1a['count'];var _0x55e2b6=_0x1ef1cb?0x0:_0x597100['offset'];var _0x4421c1=_0x1ef1cb?_0x41af1a[_0xb620('0x2b')]:_0x597100[_0xb620('0x2c')]+_0x597100[_0xb620('0x2d')];var _0x3a7189;if(_0x4421c1>=_0x463e93){_0x4421c1=_0x463e93;_0x3a7189=0xc8;}else{_0x3a7189=0xce;}_0xa138bd[_0xb620('0x27')](_0x3a7189);return _0xa138bd[_0xb620('0x2e')](_0xb620('0x2f'),_0x55e2b6+'-'+_0x4421c1+'/'+_0x463e93)[_0xb620('0x29')](_0x41af1a);}return null;};}function patchUpdates(_0x96104e){return function(_0x33e5c9){try{jsonpatch['apply'](_0x33e5c9,_0x96104e,!![]);}catch(_0x4f8ed4){return BPromise['reject'](_0x4f8ed4);}return _0x33e5c9[_0xb620('0x30')]();};}function saveUpdates(_0x24a8bf,_0x50ebaa){return function(_0x154c91){if(_0x154c91){return _0x154c91[_0xb620('0x31')](_0x24a8bf)[_0xb620('0x1d')](function(_0x3449c9){return _0x3449c9;});}return null;};}function removeEntity(_0x40e48f,_0x2aa0cd){return function(_0x1c4871){if(_0x1c4871){return _0x1c4871[_0xb620('0x32')]()[_0xb620('0x1d')](function(){_0x40e48f[_0xb620('0x27')](0xcc)[_0xb620('0x28')]();});}};}function handleEntityNotFound(_0x541994,_0x5047be){return function(_0x146c16){if(!_0x146c16){_0x541994['sendStatus'](0x194);}return _0x146c16;};}function handleError(_0x6b0067,_0x2af9de){_0x2af9de=_0x2af9de||0x1f4;return function(_0x164293){logger['error'](_0x164293[_0xb620('0x33')]);if(_0x164293[_0xb620('0x34')]){delete _0x164293[_0xb620('0x34')];}_0x6b0067[_0xb620('0x27')](_0x2af9de)['send'](_0x164293);};}exports['index']=function(_0x1f5f2e,_0x4f01a7){var _0x540d75={},_0x584c2e={},_0x5312a9={'count':0x0,'rows':[]};var _0x584f68=_['map'](db[_0xb620('0x35')][_0xb620('0x36')],function(_0x773bce){return{'name':_0x773bce['fieldName'],'type':_0x773bce['type']['key']};});_0x584c2e[_0xb620('0x37')]=_['map'](_0x584f68,_0xb620('0x34'));_0x584c2e[_0xb620('0x38')]=_[_0xb620('0x39')](_0x1f5f2e[_0xb620('0x38')]);_0x584c2e['filters']=_['intersection'](_0x584c2e['model'],_0x584c2e['query']);_0x540d75[_0xb620('0x3a')]=_['intersection'](_0x584c2e[_0xb620('0x37')],qs['fields'](_0x1f5f2e[_0xb620('0x38')][_0xb620('0x3b')]));_0x540d75['attributes']=_0x540d75['attributes'][_0xb620('0x3c')]?_0x540d75[_0xb620('0x3a')]:_0x584c2e[_0xb620('0x37')];if(!_0x1f5f2e[_0xb620('0x38')]['hasOwnProperty'](_0xb620('0x3d'))){_0x540d75[_0xb620('0x2d')]=qs['limit'](_0x1f5f2e[_0xb620('0x38')][_0xb620('0x2d')]);_0x540d75[_0xb620('0x2c')]=qs[_0xb620('0x2c')](_0x1f5f2e[_0xb620('0x38')][_0xb620('0x2c')]);}_0x540d75[_0xb620('0x3e')]=qs[_0xb620('0x3f')](_0x1f5f2e[_0xb620('0x38')]['sort']);_0x540d75['where']=qs['filters'](_[_0xb620('0x40')](_0x1f5f2e[_0xb620('0x38')],_0x584c2e[_0xb620('0x41')]),_0x584f68);if(_0x1f5f2e['query'][_0xb620('0x42')]){_0x540d75[_0xb620('0x43')]=_[_0xb620('0x44')](_0x540d75['where'],{'$or':_[_0xb620('0x45')](_0x584f68,function(_0x56fde9){if(_0x56fde9[_0xb620('0x46')]!==_0xb620('0x47')){var _0x5cb9c7={};_0x5cb9c7[_0x56fde9['name']]={'$like':'%'+_0x1f5f2e[_0xb620('0x38')][_0xb620('0x42')]+'%'};return _0x5cb9c7;}})});}_0x540d75=_[_0xb620('0x44')]({},_0x540d75,_0x1f5f2e[_0xb620('0x48')]);var _0x163bee={'where':_0x540d75[_0xb620('0x43')]};return db[_0xb620('0x35')][_0xb620('0x2b')](_0x163bee)[_0xb620('0x1d')](function(_0x4d9aeb){_0x5312a9[_0xb620('0x2b')]=_0x4d9aeb;if(_0x1f5f2e[_0xb620('0x38')][_0xb620('0x49')]){_0x540d75[_0xb620('0x4a')]=[{'all':!![]}];}return db['SmsMessage'][_0xb620('0x4b')](_0x540d75);})[_0xb620('0x1d')](function(_0x2a8944){_0x5312a9[_0xb620('0x4c')]=_0x2a8944;return _0x5312a9;})[_0xb620('0x1d')](respondWithFilteredResult(_0x4f01a7,_0x540d75))['catch'](handleError(_0x4f01a7,null));};exports[_0xb620('0x4d')]=function(_0x1668d8,_0x394c99){var _0x428433={'raw':!![],'where':{'id':_0x1668d8[_0xb620('0x4e')]['id']}},_0x761a79={};_0x761a79[_0xb620('0x37')]=_[_0xb620('0x39')](db[_0xb620('0x35')][_0xb620('0x36')]);_0x761a79[_0xb620('0x38')]=_[_0xb620('0x39')](_0x1668d8['query']);_0x761a79[_0xb620('0x41')]=_[_0xb620('0x4f')](_0x761a79[_0xb620('0x37')],_0x761a79[_0xb620('0x38')]);_0x428433['attributes']=_['intersection'](_0x761a79[_0xb620('0x37')],qs[_0xb620('0x3b')](_0x1668d8[_0xb620('0x38')][_0xb620('0x3b')]));_0x428433[_0xb620('0x3a')]=_0x428433[_0xb620('0x3a')]['length']?_0x428433[_0xb620('0x3a')]:_0x761a79[_0xb620('0x37')];if(_0x1668d8[_0xb620('0x38')][_0xb620('0x49')]){_0x428433[_0xb620('0x4a')]=[{'all':!![]}];}_0x428433=_['merge']({},_0x428433,_0x1668d8[_0xb620('0x48')]);return db[_0xb620('0x35')][_0xb620('0x50')](_0x428433)[_0xb620('0x1d')](handleEntityNotFound(_0x394c99,null))[_0xb620('0x1d')](respondWithResult(_0x394c99,null))[_0xb620('0x26')](handleError(_0x394c99,null));};exports['create']=function(_0xc095f1,_0x136ab5){return db['SmsMessage'][_0xb620('0x51')](_0xc095f1[_0xb620('0x52')],{})[_0xb620('0x1d')](respondWithResult(_0x136ab5,0xc9))[_0xb620('0x26')](handleError(_0x136ab5,null));};exports[_0xb620('0x31')]=function(_0x41712d,_0x11abad){if(_0x41712d[_0xb620('0x52')]['id']){delete _0x41712d[_0xb620('0x52')]['id'];}return db['SmsMessage'][_0xb620('0x50')]({'where':{'id':_0x41712d[_0xb620('0x4e')]['id']}})[_0xb620('0x1d')](handleEntityNotFound(_0x11abad,null))['then'](saveUpdates(_0x41712d[_0xb620('0x52')],null))[_0xb620('0x1d')](respondWithResult(_0x11abad,null))[_0xb620('0x26')](handleError(_0x11abad,null));};exports[_0xb620('0x32')]=function(_0x20b949,_0x456c2b){return db[_0xb620('0x35')][_0xb620('0x50')]({'where':{'id':_0x20b949['params']['id']}})[_0xb620('0x1d')](handleEntityNotFound(_0x456c2b,null))[_0xb620('0x1d')](removeEntity(_0x456c2b,null))[_0xb620('0x26')](handleError(_0x456c2b,null));};exports[_0xb620('0x53')]=function(_0x27828b,_0x5a64d1){return db[_0xb620('0x35')][_0xb620('0x53')]()[_0xb620('0x1d')](respondWithResult(_0x5a64d1,null))['catch'](handleError(_0x5a64d1,null));};var interaction_log=require(_0xb620('0x11'))(_0xb620('0x54'));exports['accept']=function(_0x2e1f93,_0xf6ca16,_0x1ee248){var _0x3d88bf={'agent':{},'channel':_0xb620('0x55')};if(_0x2e1f93[_0xb620('0x52')]['id']){delete _0x2e1f93[_0xb620('0x52')]['id'];}_0x2e1f93['body'][_0xb620('0x56')]=!![];_0x2e1f93['body']['readAt']=moment()[_0xb620('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e1f93[_0xb620('0x52')][_0xb620('0x58')]=_0x2e1f93['body'][_0xb620('0x58')]||_0x2e1f93[_0xb620('0x59')]['id'];_0x3d88bf[_0xb620('0x5a')]['id']=_0x2e1f93[_0xb620('0x52')][_0xb620('0x58')];return db[_0xb620('0x35')]['find']({'where':{'id':_0x2e1f93[_0xb620('0x4e')]['id'],'UserId':null}})[_0xb620('0x1d')](handleEntityNotFound(_0xf6ca16,null))['then'](saveUpdates(_0x2e1f93['body'],null))[_0xb620('0x1d')](function(_0x51cd29){if(_0x51cd29){_0x3d88bf[_0xb620('0x24')]=_0x51cd29['get']({'plain':!![]});return db[_0xb620('0x5b')][_0xb620('0x50')]({'where':{'id':_0x51cd29[_0xb620('0x5c')]}});}return null;})[_0xb620('0x1d')](handleEntityNotFound(_0xf6ca16,null))[_0xb620('0x1d')](function(_0x15daae){if(_0x15daae){return _0x15daae[_0xb620('0x31')]({'UserId':_0x2e1f93[_0xb620('0x52')][_0xb620('0x58')],'read1stAt':_[_0xb620('0x5d')](_0x15daae[_0xb620('0x5e')])?moment()[_0xb620('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb620('0x1d')](function(_0x5ab65c){if(_0x5ab65c){_0x3d88bf['interaction']=_0x5ab65c[_0xb620('0x5f')]({'plain':!![]});interaction_log[_0xb620('0x1e')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e1f93[_0xb620('0x59')]['id'],_0x2e1f93[_0xb620('0x59')][_0xb620('0x34')],_0x2e1f93[_0xb620('0x59')]['role'],_0x3d88bf[_0xb620('0x60')]['id'],_0x2e1f93[_0xb620('0x52')]?JSON[_0xb620('0x61')](_0x2e1f93['body']):_0xb620('0x62'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3d88bf);}return null;})[_0xb620('0x1d')](function(_0x5496ed){var _0x3c9430='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5496ed[_0xb620('0x24')][_0xb620('0x63')];return db[_0xb620('0x64')][_0xb620('0x38')](_0x3c9430,{'type':db[_0xb620('0x65')][_0xb620('0x66')][_0xb620('0x67')],'raw':!![]})['then'](function(_0x2bad2b){return _0x2bad2b;});})[_0xb620('0x1d')](function(_0x1480aa){if(_0x1480aa){_0x3d88bf[_0xb620('0x24')][_0xb620('0x68')]=_0x1480aa[0x0];if(!_0x2e1f93[_0xb620('0x52')][_0xb620('0x58')])return;return db['User']['find']({'where':{'id':_0x2e1f93[_0xb620('0x52')]['UserId'],'role':_0xb620('0x5a')},'attributes':['id',_0xb620('0x34'),_0xb620('0x69'),_0xb620('0x6a'),_0xb620('0x6b')],'raw':!![]});}return null;})[_0xb620('0x1d')](function(_0x5ba2f7){if(!_0x5ba2f7)return null;_0x3d88bf[_0xb620('0x24')][_0xb620('0x5a')]=_0x5ba2f7;return _0x3d88bf;})['then'](function(_0x514633){if(_0x514633){if(_0x2e1f93[_0xb620('0x52')][_0xb620('0x6c')]){_0x3d88bf[_0xb620('0x24')][_0xb620('0x6d')]=util[_0xb620('0x57')](_0xb620('0x6e'),_0x2e1f93['user'][_0xb620('0x34')]);_0x3d88bf[_0xb620('0x24')]['channel']=_0x3d88bf[_0xb620('0x6f')];_0x3d88bf[_0xb620('0x24')][_0xb620('0x70')]=_0x3d88bf[_0xb620('0x6f')];_0x3d88bf['message'][_0xb620('0x71')]=_0xb620('0x72');return respondWithRpcPromise(_0xb620('0x73'),_0xb620('0x73'),{'event':_0xb620('0x74'),'message':_0x3d88bf[_0xb620('0x24')]},client9002)[_0xb620('0x1d')](function(){return _0x3d88bf;});}return _0x3d88bf;}return null;})[_0xb620('0x1d')](respondWithResult(_0xf6ca16,null))[_0xb620('0x26')](handleError(_0xf6ca16,null));};var interaction_log=require('../../config/logger')(_0xb620('0x54'));exports[_0xb620('0x75')]=function(_0x136281,_0x5433e2,_0x3573a0){var _0x4a26f0={'agent':{},'channel':_0xb620('0x55')};if(_0x136281[_0xb620('0x52')]['id']){delete _0x136281[_0xb620('0x52')]['id'];}_0x136281[_0xb620('0x52')][_0xb620('0x58')]=_0x136281[_0xb620('0x52')]['UserId']||_0x136281[_0xb620('0x59')]['id'];_0x4a26f0[_0xb620('0x5a')]['id']=_0x136281[_0xb620('0x52')][_0xb620('0x58')];return db[_0xb620('0x35')][_0xb620('0x50')]({'where':{'id':_0x136281['params']['id'],'UserId':null}})[_0xb620('0x1d')](handleEntityNotFound(_0x5433e2,null))[_0xb620('0x1d')](function(_0x923baf){if(_0x923baf){_0x4a26f0[_0xb620('0x24')]=_0x923baf[_0xb620('0x5f')]({'plain':!![]});return db[_0xb620('0x5b')]['find']({'where':{'id':_0x923baf[_0xb620('0x5c')]}});}return null;})[_0xb620('0x1d')](handleEntityNotFound(_0x5433e2,null))[_0xb620('0x1d')](function(_0x562d94){if(_0x562d94){_0x4a26f0['interaction']=_0x562d94[_0xb620('0x5f')]({'plain':!![]});interaction_log[_0xb620('0x1e')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x136281[_0xb620('0x59')]['id'],_0x136281[_0xb620('0x59')]['name'],_0x136281['user']['role'],_0x4a26f0[_0xb620('0x60')]['id'],_0x136281[_0xb620('0x52')]?JSON[_0xb620('0x61')](_0x136281[_0xb620('0x52')]):_0xb620('0x62'));return respondWithRpcPromise(_0xb620('0x76'),'rejectMessage',_0x4a26f0);}return null;})[_0xb620('0x1d')](function(_0x2b33f1){var _0x779352=_0xb620('0x77')+_0x2b33f1['message'][_0xb620('0x63')];return db['sequelize']['query'](_0x779352,{'type':db['Sequelize'][_0xb620('0x66')]['SELECT'],'raw':!![]})['then'](function(_0x502bad){return _0x502bad;});})[_0xb620('0x1d')](function(_0x27b987){if(_0x27b987){_0x4a26f0[_0xb620('0x24')][_0xb620('0x68')]=_0x27b987[0x0];if(!_0x136281[_0xb620('0x52')]['UserId'])return;return db[_0xb620('0x78')]['find']({'where':{'id':_0x136281[_0xb620('0x52')]['UserId'],'role':_0xb620('0x5a')},'attributes':['id','name',_0xb620('0x69'),_0xb620('0x6a'),'internal'],'raw':!![]});}return null;})[_0xb620('0x1d')](function(_0x426f4f){if(!_0x426f4f)return null;_0x4a26f0[_0xb620('0x24')][_0xb620('0x5a')]=_0x426f4f;return _0x4a26f0;})[_0xb620('0x1d')](function(_0x4e287f){if(_0x4e287f){_0x4e287f[_0xb620('0x24')]['interface']=util['format'](_0xb620('0x6e'),_0x136281[_0xb620('0x59')][_0xb620('0x34')]);_0x4e287f[_0xb620('0x24')][_0xb620('0x6f')]=_0x4a26f0[_0xb620('0x6f')];_0x4e287f[_0xb620('0x24')]['motionChannel']=_0x4a26f0[_0xb620('0x6f')];_0x4e287f['message'][_0xb620('0x71')]=_0xb620('0x75');respondWithRpcPromise(_0xb620('0x73'),'EventManager',{'event':'rejectmessage','message':_0x4e287f[_0xb620('0x24')]},client9002);return _0x4a26f0;}return null;})[_0xb620('0x1d')](respondWithResult(_0x5433e2,null))[_0xb620('0x26')](handleError(_0x5433e2,null));};exports[_0xb620('0x27')]=function(_0x46d70a,_0x22a9e2,_0x1e7ebd){if(_0x46d70a[_0xb620('0x52')]['id']){delete _0x46d70a[_0xb620('0x52')]['id'];}var _0x499070;return db['SmsMessage'][_0xb620('0x50')]({'where':{'id':_0x46d70a[_0xb620('0x4e')]['id']}})[_0xb620('0x1d')](handleEntityNotFound(_0x22a9e2,null))[_0xb620('0x1d')](function(_0xab64ea){if(_0xab64ea){_0x499070=_0xab64ea;return db[_0xb620('0x79')][_0xb620('0x50')]({'where':{'id':_0xab64ea['SmsAccountId']}});}})[_0xb620('0x1d')](handleEntityNotFound(_0x22a9e2,null))['then'](function(_0x390888){if(_0x390888){logger[_0xb620('0x7a')](_0xb620('0x20'),_0xb620('0x27'),_0xb620('0x7b'),_0x390888[_0xb620('0x46')],util['inspect'](_0x46d70a[_0xb620('0x52')],{'showHidden':![],'depth':null}));switch(_0x390888[_0xb620('0x46')]){case _0xb620('0x7c'):if(_0x46d70a[_0xb620('0x52')][_0xb620('0x7d')]&&_0x46d70a[_0xb620('0x52')][_0xb620('0x7d')]===_0x499070[_0xb620('0x7e')]){return _0x499070[_0xb620('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb620('0x27'),_0xb620('0x7c'),util[_0xb620('0x7f')](_0x46d70a[_0xb620('0x52')],{'showHidden':![],'depth':null}));}break;case _0xb620('0x80'):if(_0x46d70a[_0xb620('0x52')]['MessageUUID']&&_0x46d70a[_0xb620('0x52')][_0xb620('0x81')]===_0x499070[_0xb620('0x7e')]&&_[_0xb620('0x82')]([_0xb620('0x83'),_0xb620('0x84')],_0x46d70a['body'][_0xb620('0x85')])>=0x0){return _0x499070[_0xb620('0x31')]({'read':!![]});}else{logger[_0xb620('0x22')](_0xb620('0x86'),'status',_0xb620('0x87'),util[_0xb620('0x7f')](_0x46d70a[_0xb620('0x52')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x31722e=_0x46d70a['body'][_0xb620('0x88')][0x0];if(_0x31722e[_0xb620('0x27')]['groupName']==='DELIVERED'){return _0x499070[_0xb620('0x31')]({'read':!![]});}else{logger[_0xb620('0x22')](_0xb620('0x86'),_0xb620('0x27'),_0xb620('0x89'),util[_0xb620('0x7f')](_0x46d70a[_0xb620('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x499070;}})[_0xb620('0x1d')](respondWithResult(_0x22a9e2,null))[_0xb620('0x26')](handleError(_0x22a9e2,null));}; \ No newline at end of file +var _0x3c85=['defaults','redis','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','end','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','params','create','body','find','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','agent','fullname','email','internal','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','sms','RejectMessage','rejectMessage','ContactId','SELECT','User','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b3b81,_0x2470ae){var _0x2f5b30=function(_0x4c4836){while(--_0x4c4836){_0x4b3b81['push'](_0x4b3b81['shift']());}};_0x2f5b30(++_0x2470ae);}(_0x3c85,0x1a0));var _0x53c8=function(_0x53cd56,_0x42028a){_0x53cd56=_0x53cd56-0x0;var _0x4ca0d7=_0x3c85[_0x53cd56];return _0x4ca0d7;};'use strict';var emlformat=require(_0x53c8('0x0'));var rimraf=require(_0x53c8('0x1'));var zipdir=require(_0x53c8('0x2'));var jsonpatch=require(_0x53c8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53c8('0x4'));var Mustache=require(_0x53c8('0x5'));var util=require(_0x53c8('0x6'));var path=require('path');var sox=require(_0x53c8('0x7'));var csv=require(_0x53c8('0x8'));var ejs=require(_0x53c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53c8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53c8('0xb'));var Papa=require(_0x53c8('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x53c8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c8('0xe'));var utils=require(_0x53c8('0xf'));var config=require(_0x53c8('0x10'));var licenseUtil=require(_0x53c8('0x11'));var db=require(_0x53c8('0x12'))['db'];config['redis']=_[_0x53c8('0x13')](config[_0x53c8('0x14')],{'host':_0x53c8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53c8('0x14')]));require(_0x53c8('0x16'))['register'](socket);var jayson=require(_0x53c8('0x17'));var client=jayson[_0x53c8('0x18')][_0x53c8('0x19')]({'port':0x232c});var client9002=jayson[_0x53c8('0x18')][_0x53c8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1c037f,_0x385c39,_0x27f14f,_0x2d9a6f){return new BPromise(function(_0x8a7c46,_0x28309c){var _0x44d6e4=_0x2d9a6f||client;return _0x44d6e4[_0x53c8('0x1a')](_0x1c037f,_0x27f14f)[_0x53c8('0x1b')](function(_0x59b253){logger[_0x53c8('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x385c39,'request\x20sent');logger[_0x53c8('0x1d')](_0x53c8('0x1e'),_0x385c39,_0x53c8('0x1f'),JSON[_0x53c8('0x20')](_0x59b253));if(_0x59b253['error']){if(_0x59b253[_0x53c8('0x21')][_0x53c8('0x22')]===0x1f4){logger[_0x53c8('0x21')](_0x53c8('0x23'),_0x385c39,_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);return _0x28309c(_0x59b253[_0x53c8('0x21')]['message']);}logger[_0x53c8('0x21')]('SmsMessage,\x20%s,\x20%s',_0x385c39,_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);return _0x8a7c46(_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);}else{logger['info'](_0x53c8('0x23'),_0x385c39,_0x53c8('0x1f'));_0x8a7c46(_0x59b253[_0x53c8('0x25')][_0x53c8('0x24')]);}})[_0x53c8('0x26')](function(_0x454bc5){logger[_0x53c8('0x21')](_0x53c8('0x23'),_0x385c39,_0x454bc5);_0x28309c(_0x454bc5);});});}function respondWithStatusCode(_0x1b6be5,_0x2821ad){_0x2821ad=_0x2821ad||0xcc;return function(_0x5e9265){if(_0x5e9265){return _0x1b6be5[_0x53c8('0x27')](_0x2821ad);}return _0x1b6be5['status'](_0x2821ad)['end']();};}function respondWithResult(_0x2b22c3,_0x181e88){_0x181e88=_0x181e88||0xc8;return function(_0x1ea1dd){if(_0x1ea1dd){return _0x2b22c3[_0x53c8('0x28')](_0x181e88)[_0x53c8('0x29')](_0x1ea1dd);}};}function respondWithFilteredResult(_0x3f2c72,_0x320293){return function(_0x4031ba){if(_0x4031ba){var _0xf11181=typeof _0x320293[_0x53c8('0x2a')]===_0x53c8('0x2b')&&typeof _0x320293[_0x53c8('0x2c')]===_0x53c8('0x2b');var _0x1bcc5e=_0x4031ba[_0x53c8('0x2d')];var _0x1c1f09=_0xf11181?0x0:_0x320293[_0x53c8('0x2a')];var _0x467173=_0xf11181?_0x4031ba[_0x53c8('0x2d')]:_0x320293['offset']+_0x320293[_0x53c8('0x2c')];var _0x3dc1c1;if(_0x467173>=_0x1bcc5e){_0x467173=_0x1bcc5e;_0x3dc1c1=0xc8;}else{_0x3dc1c1=0xce;}_0x3f2c72[_0x53c8('0x28')](_0x3dc1c1);return _0x3f2c72['set'](_0x53c8('0x2e'),_0x1c1f09+'-'+_0x467173+'/'+_0x1bcc5e)[_0x53c8('0x29')](_0x4031ba);}return null;};}function patchUpdates(_0x32ba58){return function(_0xa05081){try{jsonpatch['apply'](_0xa05081,_0x32ba58,!![]);}catch(_0x592f78){return BPromise[_0x53c8('0x2f')](_0x592f78);}return _0xa05081[_0x53c8('0x30')]();};}function saveUpdates(_0x14039b,_0x1a1461){return function(_0x2f3a1a){if(_0x2f3a1a){return _0x2f3a1a['update'](_0x14039b)[_0x53c8('0x1b')](function(_0x4f8e7f){return _0x4f8e7f;});}return null;};}function removeEntity(_0x299266,_0x979c82){return function(_0x2f8755){if(_0x2f8755){return _0x2f8755[_0x53c8('0x31')]()['then'](function(){_0x299266['status'](0xcc)[_0x53c8('0x32')]();});}};}function handleEntityNotFound(_0x314a84,_0x398eb2){return function(_0x2f1230){if(!_0x2f1230){_0x314a84[_0x53c8('0x27')](0x194);}return _0x2f1230;};}function handleError(_0x1683ee,_0x203d71){_0x203d71=_0x203d71||0x1f4;return function(_0x11109f){logger['error'](_0x11109f[_0x53c8('0x33')]);if(_0x11109f[_0x53c8('0x34')]){delete _0x11109f['name'];}_0x1683ee[_0x53c8('0x28')](_0x203d71)[_0x53c8('0x35')](_0x11109f);};}exports[_0x53c8('0x36')]=function(_0x1cda8c,_0x88da41){var _0x8430dd={},_0x3d2f86={},_0x521cf9={'count':0x0,'rows':[]};var _0x5a3ab2=_['map'](db[_0x53c8('0x37')][_0x53c8('0x38')],function(_0x13f787){return{'name':_0x13f787[_0x53c8('0x39')],'type':_0x13f787[_0x53c8('0x3a')][_0x53c8('0x3b')]};});_0x3d2f86[_0x53c8('0x3c')]=_[_0x53c8('0x3d')](_0x5a3ab2,_0x53c8('0x34'));_0x3d2f86[_0x53c8('0x3e')]=_[_0x53c8('0x3f')](_0x1cda8c[_0x53c8('0x3e')]);_0x3d2f86[_0x53c8('0x40')]=_[_0x53c8('0x41')](_0x3d2f86[_0x53c8('0x3c')],_0x3d2f86[_0x53c8('0x3e')]);_0x8430dd[_0x53c8('0x42')]=_[_0x53c8('0x41')](_0x3d2f86['model'],qs[_0x53c8('0x43')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x43')]));_0x8430dd[_0x53c8('0x42')]=_0x8430dd[_0x53c8('0x42')][_0x53c8('0x44')]?_0x8430dd[_0x53c8('0x42')]:_0x3d2f86[_0x53c8('0x3c')];if(!_0x1cda8c['query'][_0x53c8('0x45')](_0x53c8('0x46'))){_0x8430dd[_0x53c8('0x2c')]=qs[_0x53c8('0x2c')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x2c')]);_0x8430dd[_0x53c8('0x2a')]=qs[_0x53c8('0x2a')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x2a')]);}_0x8430dd[_0x53c8('0x47')]=qs[_0x53c8('0x48')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x48')]);_0x8430dd['where']=qs[_0x53c8('0x40')](_[_0x53c8('0x49')](_0x1cda8c['query'],_0x3d2f86['filters']),_0x5a3ab2);if(_0x1cda8c[_0x53c8('0x3e')]['filter']){_0x8430dd[_0x53c8('0x4a')]=_['merge'](_0x8430dd[_0x53c8('0x4a')],{'$or':_[_0x53c8('0x3d')](_0x5a3ab2,function(_0x2f97e8){if(_0x2f97e8[_0x53c8('0x3a')]!=='VIRTUAL'){var _0x4e8011={};_0x4e8011[_0x2f97e8['name']]={'$like':'%'+_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x4b')]+'%'};return _0x4e8011;}})});}_0x8430dd=_[_0x53c8('0x4c')]({},_0x8430dd,_0x1cda8c[_0x53c8('0x4d')]);var _0x191fd0={'where':_0x8430dd['where']};return db[_0x53c8('0x37')][_0x53c8('0x2d')](_0x191fd0)[_0x53c8('0x1b')](function(_0xfc7fc1){_0x521cf9[_0x53c8('0x2d')]=_0xfc7fc1;if(_0x1cda8c['query'][_0x53c8('0x4e')]){_0x8430dd[_0x53c8('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x53c8('0x50')](_0x8430dd);})[_0x53c8('0x1b')](function(_0x376f5d){_0x521cf9[_0x53c8('0x51')]=_0x376f5d;return _0x521cf9;})[_0x53c8('0x1b')](respondWithFilteredResult(_0x88da41,_0x8430dd))['catch'](handleError(_0x88da41,null));};exports['show']=function(_0x58bfca,_0x47c0e5){var _0x27381a={'raw':!![],'where':{'id':_0x58bfca[_0x53c8('0x52')]['id']}},_0x39db9b={};_0x39db9b[_0x53c8('0x3c')]=_['keys'](db[_0x53c8('0x37')][_0x53c8('0x38')]);_0x39db9b[_0x53c8('0x3e')]=_[_0x53c8('0x3f')](_0x58bfca[_0x53c8('0x3e')]);_0x39db9b[_0x53c8('0x40')]=_[_0x53c8('0x41')](_0x39db9b[_0x53c8('0x3c')],_0x39db9b[_0x53c8('0x3e')]);_0x27381a[_0x53c8('0x42')]=_[_0x53c8('0x41')](_0x39db9b[_0x53c8('0x3c')],qs['fields'](_0x58bfca['query'][_0x53c8('0x43')]));_0x27381a[_0x53c8('0x42')]=_0x27381a[_0x53c8('0x42')][_0x53c8('0x44')]?_0x27381a['attributes']:_0x39db9b[_0x53c8('0x3c')];if(_0x58bfca['query'][_0x53c8('0x4e')]){_0x27381a[_0x53c8('0x4f')]=[{'all':!![]}];}_0x27381a=_[_0x53c8('0x4c')]({},_0x27381a,_0x58bfca[_0x53c8('0x4d')]);return db[_0x53c8('0x37')]['find'](_0x27381a)[_0x53c8('0x1b')](handleEntityNotFound(_0x47c0e5,null))[_0x53c8('0x1b')](respondWithResult(_0x47c0e5,null))[_0x53c8('0x26')](handleError(_0x47c0e5,null));};exports[_0x53c8('0x53')]=function(_0x198677,_0xe45995){return db[_0x53c8('0x37')][_0x53c8('0x53')](_0x198677['body'],{})[_0x53c8('0x1b')](respondWithResult(_0xe45995,0xc9))[_0x53c8('0x26')](handleError(_0xe45995,null));};exports['update']=function(_0x534811,_0x55f7fa){if(_0x534811['body']['id']){delete _0x534811[_0x53c8('0x54')]['id'];}return db['SmsMessage'][_0x53c8('0x55')]({'where':{'id':_0x534811[_0x53c8('0x52')]['id']}})[_0x53c8('0x1b')](handleEntityNotFound(_0x55f7fa,null))[_0x53c8('0x1b')](saveUpdates(_0x534811[_0x53c8('0x54')],null))[_0x53c8('0x1b')](respondWithResult(_0x55f7fa,null))[_0x53c8('0x26')](handleError(_0x55f7fa,null));};exports['destroy']=function(_0x74bb85,_0x5d98cb){return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x74bb85['params']['id']}})[_0x53c8('0x1b')](handleEntityNotFound(_0x5d98cb,null))[_0x53c8('0x1b')](removeEntity(_0x5d98cb,null))['catch'](handleError(_0x5d98cb,null));};exports[_0x53c8('0x56')]=function(_0x2d9953,_0x28651b){return db[_0x53c8('0x37')][_0x53c8('0x56')]()[_0x53c8('0x1b')](respondWithResult(_0x28651b,null))[_0x53c8('0x26')](handleError(_0x28651b,null));};var interaction_log=require('../../config/logger')(_0x53c8('0x57'));exports[_0x53c8('0x58')]=function(_0x4ae2a0,_0x4c34f3,_0x4b13eb){var _0x480c4b={'agent':{},'channel':'sms'};if(_0x4ae2a0[_0x53c8('0x54')]['id']){delete _0x4ae2a0[_0x53c8('0x54')]['id'];}_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x59')]=!![];_0x4ae2a0['body'][_0x53c8('0x5a')]=moment()['format'](_0x53c8('0x5b'));_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')]=_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')]||_0x4ae2a0[_0x53c8('0x5d')]['id'];_0x480c4b['agent']['id']=_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')];return db[_0x53c8('0x37')]['find']({'where':{'id':_0x4ae2a0[_0x53c8('0x52')]['id'],'UserId':null}})[_0x53c8('0x1b')](handleEntityNotFound(_0x4c34f3,null))[_0x53c8('0x1b')](saveUpdates(_0x4ae2a0[_0x53c8('0x54')],null))[_0x53c8('0x1b')](function(_0x3fd82b){if(_0x3fd82b){_0x480c4b[_0x53c8('0x24')]=_0x3fd82b[_0x53c8('0x5e')]({'plain':!![]});return db[_0x53c8('0x5f')][_0x53c8('0x55')]({'where':{'id':_0x3fd82b[_0x53c8('0x60')]}});}return null;})[_0x53c8('0x1b')](handleEntityNotFound(_0x4c34f3,null))[_0x53c8('0x1b')](function(_0x3090f6){if(_0x3090f6){return _0x3090f6[_0x53c8('0x61')]({'UserId':_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')],'read1stAt':_[_0x53c8('0x62')](_0x3090f6[_0x53c8('0x63')])?moment()['format'](_0x53c8('0x5b')):undefined});}return null;})[_0x53c8('0x1b')](function(_0x366c9f){if(_0x366c9f){_0x480c4b['interaction']=_0x366c9f[_0x53c8('0x5e')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ae2a0['user']['id'],_0x4ae2a0[_0x53c8('0x5d')][_0x53c8('0x34')],_0x4ae2a0['user'][_0x53c8('0x64')],_0x480c4b[_0x53c8('0x65')]['id'],_0x4ae2a0['body']?JSON[_0x53c8('0x20')](_0x4ae2a0[_0x53c8('0x54')]):_0x53c8('0x66'));return respondWithRpcPromise(_0x53c8('0x67'),_0x53c8('0x68'),_0x480c4b);}return null;})[_0x53c8('0x1b')](function(_0x531ada){var _0x23a047=_0x53c8('0x69')+_0x531ada[_0x53c8('0x24')]['ContactId'];return db[_0x53c8('0x6a')][_0x53c8('0x3e')](_0x23a047,{'type':db[_0x53c8('0x6b')][_0x53c8('0x6c')]['SELECT'],'raw':!![]})[_0x53c8('0x1b')](function(_0x192892){return _0x192892;});})[_0x53c8('0x1b')](function(_0x1ee0d6){if(_0x1ee0d6){_0x480c4b[_0x53c8('0x24')][_0x53c8('0x6d')]=_0x1ee0d6[0x0];if(!_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')])return;return db['User'][_0x53c8('0x55')]({'where':{'id':_0x4ae2a0['body']['UserId'],'role':_0x53c8('0x6e')},'attributes':['id',_0x53c8('0x34'),_0x53c8('0x6f'),_0x53c8('0x70'),_0x53c8('0x71')],'raw':!![]});}return null;})[_0x53c8('0x1b')](function(_0x10fa3f){if(!_0x10fa3f)return null;_0x480c4b[_0x53c8('0x24')]['agent']=_0x10fa3f;return _0x480c4b;})[_0x53c8('0x1b')](function(_0x49e129){if(_0x49e129){if(_0x4ae2a0['body'][_0x53c8('0x72')]){_0x480c4b[_0x53c8('0x24')][_0x53c8('0x73')]=util[_0x53c8('0x74')](_0x53c8('0x75'),_0x4ae2a0[_0x53c8('0x5d')][_0x53c8('0x34')]);_0x480c4b['message'][_0x53c8('0x76')]=_0x480c4b[_0x53c8('0x76')];_0x480c4b[_0x53c8('0x24')]['motionChannel']=_0x480c4b[_0x53c8('0x76')];_0x480c4b[_0x53c8('0x24')][_0x53c8('0x77')]=_0x53c8('0x58');return respondWithRpcPromise(_0x53c8('0x78'),_0x53c8('0x78'),{'event':_0x53c8('0x79'),'message':_0x480c4b['message']},client9002)[_0x53c8('0x1b')](function(){return _0x480c4b;});}return _0x480c4b;}return null;})[_0x53c8('0x1b')](respondWithResult(_0x4c34f3,null))[_0x53c8('0x26')](handleError(_0x4c34f3,null));};var interaction_log=require('../../config/logger')(_0x53c8('0x57'));exports['reject']=function(_0x1d9644,_0x13f550,_0x2c5cce){var _0x35aac7={'agent':{},'channel':_0x53c8('0x7a')};if(_0x1d9644[_0x53c8('0x54')]['id']){delete _0x1d9644[_0x53c8('0x54')]['id'];}_0x1d9644['body'][_0x53c8('0x5c')]=_0x1d9644[_0x53c8('0x54')]['UserId']||_0x1d9644[_0x53c8('0x5d')]['id'];_0x35aac7[_0x53c8('0x6e')]['id']=_0x1d9644[_0x53c8('0x54')]['UserId'];return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x1d9644['params']['id'],'UserId':null}})[_0x53c8('0x1b')](handleEntityNotFound(_0x13f550,null))['then'](function(_0x1d39e7){if(_0x1d39e7){_0x35aac7[_0x53c8('0x24')]=_0x1d39e7[_0x53c8('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0x53c8('0x55')]({'where':{'id':_0x1d39e7[_0x53c8('0x60')]}});}return null;})[_0x53c8('0x1b')](handleEntityNotFound(_0x13f550,null))['then'](function(_0x45be10){if(_0x45be10){_0x35aac7[_0x53c8('0x65')]=_0x45be10[_0x53c8('0x5e')]({'plain':!![]});interaction_log[_0x53c8('0x1c')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d9644['user']['id'],_0x1d9644[_0x53c8('0x5d')]['name'],_0x1d9644['user'][_0x53c8('0x64')],_0x35aac7[_0x53c8('0x65')]['id'],_0x1d9644[_0x53c8('0x54')]?JSON['stringify'](_0x1d9644['body']):'null');return respondWithRpcPromise(_0x53c8('0x7b'),_0x53c8('0x7c'),_0x35aac7);}return null;})[_0x53c8('0x1b')](function(_0x2877b0){var _0x44fc96=_0x53c8('0x69')+_0x2877b0[_0x53c8('0x24')][_0x53c8('0x7d')];return db[_0x53c8('0x6a')][_0x53c8('0x3e')](_0x44fc96,{'type':db[_0x53c8('0x6b')][_0x53c8('0x6c')][_0x53c8('0x7e')],'raw':!![]})[_0x53c8('0x1b')](function(_0x37ea58){return _0x37ea58;});})['then'](function(_0x3f1f73){if(_0x3f1f73){_0x35aac7['message'][_0x53c8('0x6d')]=_0x3f1f73[0x0];if(!_0x1d9644['body'][_0x53c8('0x5c')])return;return db[_0x53c8('0x7f')]['find']({'where':{'id':_0x1d9644[_0x53c8('0x54')][_0x53c8('0x5c')],'role':_0x53c8('0x6e')},'attributes':['id',_0x53c8('0x34'),_0x53c8('0x6f'),_0x53c8('0x70'),_0x53c8('0x71')],'raw':!![]});}return null;})['then'](function(_0x5b59e3){if(!_0x5b59e3)return null;_0x35aac7[_0x53c8('0x24')][_0x53c8('0x6e')]=_0x5b59e3;return _0x35aac7;})[_0x53c8('0x1b')](function(_0x2948ef){if(_0x2948ef){_0x2948ef[_0x53c8('0x24')][_0x53c8('0x73')]=util[_0x53c8('0x74')](_0x53c8('0x75'),_0x1d9644['user'][_0x53c8('0x34')]);_0x2948ef[_0x53c8('0x24')]['channel']=_0x35aac7[_0x53c8('0x76')];_0x2948ef[_0x53c8('0x24')]['motionChannel']=_0x35aac7[_0x53c8('0x76')];_0x2948ef[_0x53c8('0x24')][_0x53c8('0x77')]='reject';respondWithRpcPromise(_0x53c8('0x78'),_0x53c8('0x78'),{'event':_0x53c8('0x80'),'message':_0x2948ef[_0x53c8('0x24')]},client9002);return _0x35aac7;}return null;})[_0x53c8('0x1b')](respondWithResult(_0x13f550,null))[_0x53c8('0x26')](handleError(_0x13f550,null));};exports[_0x53c8('0x28')]=function(_0x36edbc,_0x5c1c67,_0x50916f){if(_0x36edbc[_0x53c8('0x54')]['id']){delete _0x36edbc[_0x53c8('0x54')]['id'];}var _0x4aeb7f;return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x36edbc['params']['id']}})['then'](handleEntityNotFound(_0x5c1c67,null))[_0x53c8('0x1b')](function(_0xcba153){if(_0xcba153){_0x4aeb7f=_0xcba153;return db[_0x53c8('0x81')]['find']({'where':{'id':_0xcba153['SmsAccountId']}});}})[_0x53c8('0x1b')](handleEntityNotFound(_0x5c1c67,null))[_0x53c8('0x1b')](function(_0x53083d){if(_0x53083d){logger['debug'](_0x53c8('0x1e'),_0x53c8('0x28'),_0x53c8('0x82'),_0x53083d[_0x53c8('0x3a')],util[_0x53c8('0x83')](_0x36edbc['body'],{'showHidden':![],'depth':null}));switch(_0x53083d[_0x53c8('0x3a')]){case _0x53c8('0x84'):if(_0x36edbc[_0x53c8('0x54')][_0x53c8('0x85')]&&_0x36edbc[_0x53c8('0x54')][_0x53c8('0x85')]===_0x4aeb7f[_0x53c8('0x86')]){return _0x4aeb7f['update']({'read':!![]});}else{logger['error'](_0x53c8('0x87'),_0x53c8('0x28'),_0x53c8('0x84'),util[_0x53c8('0x83')](_0x36edbc[_0x53c8('0x54')],{'showHidden':![],'depth':null}));}break;case _0x53c8('0x88'):if(_0x36edbc[_0x53c8('0x54')][_0x53c8('0x89')]&&_0x36edbc[_0x53c8('0x54')][_0x53c8('0x89')]===_0x4aeb7f[_0x53c8('0x86')]&&_[_0x53c8('0x8a')]([_0x53c8('0x8b'),'delivered'],_0x36edbc['body'][_0x53c8('0x8c')])>=0x0){return _0x4aeb7f[_0x53c8('0x61')]({'read':!![]});}else{logger['error'](_0x53c8('0x87'),_0x53c8('0x28'),'plivio',util[_0x53c8('0x83')](_0x36edbc['body'],{'showHidden':![],'depth':null}));}break;case _0x53c8('0x8d'):var _0x329c7e=_0x36edbc[_0x53c8('0x54')][_0x53c8('0x8e')][0x0];if(_0x329c7e[_0x53c8('0x28')][_0x53c8('0x8f')]===_0x53c8('0x90')){return _0x4aeb7f[_0x53c8('0x61')]({'read':!![]});}else{logger[_0x53c8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c8('0x28'),_0x53c8('0x8d'),util[_0x53c8('0x83')](_0x36edbc[_0x53c8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4aeb7f;}})['then'](respondWithResult(_0x5c1c67,null))[_0x53c8('0x26')](handleError(_0x5c1c67,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 11e9ee3..48d8ee1 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 _0x600c=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x600c,0x1ee));var _0xc600=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x600c[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xc600('0x0'));var SmsMessage=require(_0xc600('0x1'))['db'][_0xc600('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc600('0x3')](0x0);var events={'afterCreate':_0xc600('0x4'),'afterUpdate':_0xc600('0x5'),'afterDestroy':_0xc600('0x6')};function emitEvent(_0x51e5ca){return function(_0x376c4c,_0x2f665b,_0x426f53){SmsMessageEvents[_0xc600('0x7')](_0x51e5ca+':'+_0x376c4c['id'],_0x376c4c);SmsMessageEvents[_0xc600('0x7')](_0x51e5ca,_0x376c4c);_0x426f53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc600('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x9861=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x9861,0xb4));var _0x1986=function(_0xe2f5ee,_0x9d7134){_0xe2f5ee=_0xe2f5ee-0x0;var _0x1f6fa9=_0x9861[_0xe2f5ee];return _0x1f6fa9;};'use strict';var EventEmitter=require(_0x1986('0x0'));var SmsMessage=require(_0x1986('0x1'))['db'][_0x1986('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1986('0x3')](0x0);var events={'afterCreate':_0x1986('0x4'),'afterUpdate':_0x1986('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c9748){return function(_0x947397,_0x2cbd0a,_0x44d878){SmsMessageEvents[_0x1986('0x6')](_0x1c9748+':'+_0x947397['id'],_0x947397);SmsMessageEvents['emit'](_0x1c9748,_0x947397);_0x44d878(null);};}for(var e in events){if(events[_0x1986('0x7')](e)){var event=events[e];SmsMessage[_0x1986('0x8')](e,emitEvent(event));}}module[_0x1986('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 31ab409..6358011 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 _0x810f=['Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','length','md5','digest','hex','signature=','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','out','SmsAccount','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','body','remote','/api/sms/messages/','/status?token=','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x810f,0x193));var _0xf810=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x810f[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xf810('0x0'));var util=require('util');var logger=require(_0xf810('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf810('0x2'));var rp=require(_0xf810('0x3'));var fs=require('fs');var path=require(_0xf810('0x4'));var rimraf=require(_0xf810('0x5'));var config=require('../../config/environment');var attributes=require(_0xf810('0x6'));module[_0xf810('0x7')]=function(_0x114d92,_0x4a3754){return _0x114d92[_0xf810('0x8')](_0xf810('0x9'),attributes,{'tableName':_0xf810('0xa'),'paranoid':![],'indexes':[{'name':_0xf810('0xb'),'fields':[_0xf810('0xb')]},{'name':_0xf810('0xc'),'fields':['body'],'type':_0xf810('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb828,_0x3ef457,_0x161860){var _0x564b2c=_0x114d92[_0xf810('0xe')];var _0x989ba5=_0x3eb828[_0xf810('0xf')]({'plain':!![]});if(_0x989ba5[_0xf810('0x10')][_0xf810('0x11')]()==='in'||_0x989ba5[_0xf810('0x10')][_0xf810('0x11')]()==='out'&&!_0x989ba5[_0xf810('0x12')]&&!_[_0xf810('0x13')](_0x989ba5[_0xf810('0x14')])&&!_[_0xf810('0x13')](_0x989ba5[_0xf810('0x15')])){_0x564b2c[_0xf810('0x16')][_0xf810('0x17')]({'where':{'id':_0x989ba5[_0xf810('0x15')]}})[_0xf810('0x18')](function(_0x1fa72a){if(_0x1fa72a){_0x1fa72a[_0xf810('0x19')]({'lastMsgAt':_0x989ba5['createdAt'],'lastMsgDirection':_0x989ba5[_0xf810('0x10')]['toLowerCase']()});}})['catch'](function(_0x367a73){console[_0xf810('0x1a')](_0x367a73);});}if(_0x989ba5['direction']===_0xf810('0x1b')&&!_0x989ba5[_0xf810('0x12')]){var _0x392f33;_0x564b2c[_0xf810('0x1c')]['find']({'where':{'id':_0x989ba5[_0xf810('0x1d')]},'raw':!![]})[_0xf810('0x18')](function(_0x1d58c5){_0x392f33=_0x1d58c5;if(_0x392f33&&_0x392f33[_0xf810('0x1e')]){switch(_0x392f33['type']){case _0xf810('0x1f'):var _0xddd3c9=require(_0xf810('0x1f'));if(_0x392f33['accountSid']&&_0x392f33[_0xf810('0x20')]&&_0x392f33[_0xf810('0x21')]){var _0x3d757a=new _0xddd3c9(_0x392f33[_0xf810('0x22')],_0x392f33[_0xf810('0x20')]);_0x3d757a[_0xf810('0x23')]['create']({'body':_0x989ba5[_0xf810('0x24')],'to':_0x989ba5['phone'],'from':_0x392f33[_0xf810('0x21')],'statusCallback':_0x392f33[_0xf810('0x25')]+_0xf810('0x26')+_0x989ba5['id']+_0xf810('0x27')+_0x392f33['token']})[_0xf810('0x18')](function(_0x5935ec){if(_0x5935ec[_0xf810('0x28')]){return _0x3eb828[_0xf810('0x19')]({'messageId':_0x5935ec[_0xf810('0x28')]});}})[_0xf810('0x29')](function(_0x102232){logger[_0xf810('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf810('0x2a'),_0xf810('0x1f'),util[_0xf810('0x2b')](_0x102232,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf810('0x2c'),_0xf810('0x2a'),'twilio',_0xf810('0x2d'));}break;case'skebby':var _0x3ac73d=_0xf810('0x2e');if(_0x392f33[_0xf810('0x2f')]&&_0x392f33[_0xf810('0x30')]){var _0x1e739a={'recipient':[_0x989ba5['phone']],'message':_0x989ba5[_0xf810('0x24')],'message_type':_0x392f33['smsMethod']};if(_0x392f33[_0xf810('0x31')]&&_0x392f33[_0xf810('0x31')]!=='SI'){_0x1e739a[_0xf810('0x32')]=_0x392f33[_0xf810('0x21')];}var _0x3cbaad={'url':_0x3ac73d+_0xf810('0x33')+_0x392f33['username']+'&password='+_0x392f33[_0xf810('0x30')],'method':_0xf810('0x34')};rp(_0x3cbaad)[_0xf810('0x18')](function(_0x2802d6){var _0x3fb297=_0x2802d6[_0xf810('0x35')](';');var _0x1b0cad={'user_key':_0x3fb297[0x0],'session_key':_0x3fb297[0x1]};_0x3cbaad={'url':_0x3ac73d+_0xf810('0x36'),'method':_0xf810('0x37'),'headers':{'user_key':_0x1b0cad[_0xf810('0x38')],'Session_key':_0x1b0cad[_0xf810('0x39')]},'json':!![],'body':_0x1e739a};return rp(_0x3cbaad);})['then'](function(_0x3e8fa7){if(_0x3e8fa7[_0xf810('0x3a')]>=0x1){var _0x3a7b97={'messageId':_0x3e8fa7[_0xf810('0x3b')]};if(_0x392f33[_0xf810('0x31')]!=='GP'||!_0x392f33[_0xf810('0x3c')]){_0x3a7b97['read']=!![];}return _0x3eb828[_0xf810('0x19')](_0x3a7b97);}else{return logger['error'](_0xf810('0x2c'),_0xf810('0x2a'),'skebby',util[_0xf810('0x2b')](_0x3e8fa7,{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0x445836){return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x3d'),util[_0xf810('0x2b')](_0x445836,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'skebby',_0xf810('0x3e'));}break;case _0xf810('0x3f'):if(_0x392f33[_0xf810('0x20')]){var _0x19bbd2={'recipient':_0x989ba5[_0xf810('0x21')],'message':_0x989ba5['body'],'sender':_0x392f33[_0xf810('0x40')]||_0x392f33[_0xf810('0x21')],'authorization':_0x392f33[_0xf810('0x20')]};var _0x3ef457={'method':_0xf810('0x37'),'uri':_0xf810('0x41'),'body':_0x19bbd2,'json':!![]};rp(_0x3ef457)[_0xf810('0x18')](function(_0x2e02fd){var _0x8e5e0={'messageId':_0x2e02fd[_0xf810('0x42')]};if(!_0x392f33[_0xf810('0x3c')]){_0x8e5e0[_0xf810('0x43')]=!![];}return _0x3eb828[_0xf810('0x19')](_0x8e5e0);})[_0xf810('0x29')](function(_0x1878bc){logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x3f'),util[_0xf810('0x2b')](_0x1878bc,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'connectel',_0xf810('0x44'));}break;case _0xf810('0x45'):if(_0x392f33['username']&&_0x392f33['password']){var _0x19bbd2={'messages':[{'source':_0xf810('0x46'),'to':_0x989ba5[_0xf810('0x21')],'body':_0x989ba5[_0xf810('0x24')],'from':_0x392f33['senderString']||_0x392f33[_0xf810('0x21')]}]};var _0xb26829=util[_0xf810('0x47')]('%s:%s',_0x392f33[_0xf810('0x2f')],_0x392f33[_0xf810('0x30')]);var _0x3ef457={'method':_0xf810('0x37'),'uri':_0xf810('0x48'),'body':_0x19bbd2,'headers':{'Authorization':util[_0xf810('0x47')](_0xf810('0x49'),new Buffer(_0xb26829)[_0xf810('0x4a')](_0xf810('0x4b')))},'json':!![]};rp(_0x3ef457)['then'](function(_0x1d32dd){if(_0x1d32dd[_0xf810('0x4c')]>=0xc8&&_0x1d32dd['http_code']<=0xce){if(_0x1d32dd[_0xf810('0x4d')]&&_0x1d32dd['data'][_0xf810('0x4e')]>0x0){var _0x2f299a=_[_0xf810('0x4f')](_0x1d32dd[_0xf810('0x4d')][_0xf810('0x23')]);var _0x1f6eba={'messageId':_0x2f299a[_0xf810('0x50')]};if(!_0x392f33[_0xf810('0x3c')]){_0x1f6eba['read']=!![];}return _0x3eb828[_0xf810('0x19')](_0x1f6eba);}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'clickSend',util['inspect'](_0x1d32dd,{'showHidden':![],'depth':null}));}}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x51'),util['inspect'](_0x1d32dd,{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0x4fcd4d){logger['error'](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x51'),util['inspect'](_0x4fcd4d,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'clickSend',_0xf810('0x3e'));}break;case'plivo':if(_0x392f33[_0xf810('0x52')]&&_0x392f33[_0xf810('0x20')]){var _0x19bbd2={'dst':_0x989ba5[_0xf810('0x21')],'text':_0x989ba5[_0xf810('0x24')],'src':_0x392f33[_0xf810('0x40')]||_0x392f33[_0xf810('0x21')],'url':_0x392f33[_0xf810('0x25')]+_0xf810('0x26')+_0x989ba5['id']+_0xf810('0x27')+_0x392f33[_0xf810('0x53')]};var _0xb26829=util[_0xf810('0x47')](_0xf810('0x54'),_0x392f33[_0xf810('0x52')],_0x392f33[_0xf810('0x20')]);var _0x3ef457={'method':_0xf810('0x37'),'uri':util[_0xf810('0x47')](_0xf810('0x55'),_0x392f33[_0xf810('0x52')]),'body':_0x19bbd2,'headers':{'Authorization':util[_0xf810('0x47')]('Basic\x20%s',new Buffer(_0xb26829)[_0xf810('0x4a')](_0xf810('0x4b')))},'json':!![]};rp(_0x3ef457)['then'](function(_0x2c55e5){var _0x47c8e7={'messageId':_0x2c55e5[_0xf810('0x56')][0x0]};return _0x3eb828[_0xf810('0x19')](_0x47c8e7);})['catch'](function(_0x5dd214){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf810('0x2a'),'plivo',util[_0xf810('0x2b')](_0x5dd214,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf810('0x2a'),'plivo',_0xf810('0x57'));}break;case _0xf810('0x58'):if(_0x392f33[_0xf810('0x2f')]&&_0x392f33[_0xf810('0x30')]){if(_0x392f33[_0xf810('0x59')]){var _0x3419f1={'method':_0xf810('0x37'),'uri':_0x392f33[_0xf810('0x59')]+_0xf810('0x5a'),'body':{'username':_0x392f33[_0xf810('0x2f')],'password':_0x392f33[_0xf810('0x30')]},'json':!![]};return rp(_0x3419f1)[_0xf810('0x18')](function(_0x363893){var _0x2f96c3={'method':_0xf810('0x37'),'uri':_0x392f33[_0xf810('0x59')]+_0xf810('0x5b'),'body':{'messages':[{'from':_0x392f33[_0xf810('0x21')],'destinations':[{'to':_0x989ba5[_0xf810('0x21')]}],'text':_0x989ba5[_0xf810('0x24')],'notifyUrl':_0x392f33[_0xf810('0x25')]+_0xf810('0x26')+_0x989ba5['id']+_0xf810('0x27')+_0x392f33[_0xf810('0x53')],'notifyContentType':_0xf810('0x5c'),'callbackData':_0x392f33[_0xf810('0x21')]+';'+_0x989ba5[_0xf810('0x24')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x363893[_0xf810('0x53')]},'json':!![]};return rp(_0x2f96c3)[_0xf810('0x18')](function(_0x922850){if(_0x922850[_0xf810('0x23')]){var _0x31c844={'messageId':_0x922850[_0xf810('0x23')][0x0][_0xf810('0xb')]};if(!_0x392f33[_0xf810('0x3c')]){_0x31c844['read']=!![];}return _0x3eb828[_0xf810('0x19')](_0x31c844);}else{return logger['error'](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x58'),util[_0xf810('0x2b')](_0x922850,{'showHidden':![],'depth':null}));}});})[_0xf810('0x29')](function(_0x57c252){return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x58'),util[_0xf810('0x2b')](_0x57c252,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x58'),_0xf810('0x5d'));}}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),'afterCreate',_0xf810('0x58'),_0xf810('0x3e'));}break;case _0xf810('0x5e'):var _0x1b9d94=require(_0xf810('0x5f'));if(_0x392f33[_0xf810('0x60')]){var _0x2e1169={};_0x2e1169['login']=_0x392f33[_0xf810('0x2f')];_0x2e1169['phone']=_0x989ba5[_0xf810('0x21')];_0x2e1169[_0xf810('0x32')]=_0x392f33['phone'];_0x2e1169[_0xf810('0x61')]=_0x989ba5[_0xf810('0x24')];_0x2e1169['timestamp']=+new Date();var _0x58c832='';var _0x19d502='';var _0x18f66a=Object['keys'](_0x2e1169);_0x18f66a['sort']();for(var _0xa90bbd=0x0;_0xa90bbd<_0x18f66a[_0xf810('0x62')];_0xa90bbd++){if(_0x58c832!=''){_0x58c832+='&';}_0x58c832+=_0x18f66a[_0xa90bbd]+'='+encodeURIComponent(_0x2e1169[_0x18f66a[_0xa90bbd]]);_0x19d502+=_0x2e1169[_0x18f66a[_0xa90bbd]];}_0x19d502+=_0x392f33[_0xf810('0x60')];_0x19d502=_0x1b9d94['createHash'](_0xf810('0x63'))[_0xf810('0x19')](_0x19d502)[_0xf810('0x64')](_0xf810('0x65'));if(_0x58c832!==''){_0x58c832+='&';}_0x58c832+=_0xf810('0x66')+_0x19d502;var _0x3cbaad={'method':_0xf810('0x34'),'uri':_0x392f33[_0xf810('0x59')]+_0xf810('0x67')+_0x58c832,'json':!![]};return rp(_0x3cbaad)['then'](function(_0x2e3423){var _0x1ebe33=Object[_0xf810('0x68')](_0x2e3423);if(_0x2e3423[_0x1ebe33[0x0]][_0xf810('0x1a')]&&parseInt(_0x2e3423[_0x1ebe33[0x0]][_0xf810('0x1a')])===0x0){var _0xf73ccf={'messageId':_0x2e3423[_0x1ebe33[0x0]]['id_sms']};if(!_0x392f33[_0xf810('0x3c')]){_0xf73ccf[_0xf810('0x43')]=!![];}return _0x3eb828[_0xf810('0x19')](_0xf73ccf);}else{return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'csc',util['inspect'](_0x2e3423[_0xf810('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0xd79e){return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x5e'),util[_0xf810('0x2b')](_0xd79e,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x5e'),_0xf810('0x69'));}break;case _0xf810('0x6a'):if(_0x392f33['apiKey']){var _0x2bab53={'method':_0xf810('0x37'),'uri':_0xf810('0x6b'),'headers':{'Authorization':_0x392f33['apiKey']},'body':{'content':_0x989ba5[_0xf810('0x24')],'to':[_0x989ba5['phone']],'from':_0x392f33[_0xf810('0x21')],'binary':![],'clientMessageId':_0xf810('0x6c'),'charset':_0xf810('0x6d')},'json':!![]};rp(_0x2bab53)[_0xf810('0x18')](function(_0x4630b4){if(!_0x4630b4['error']){var _0xca483f={'messageId':_0x4630b4['messages'][0x0][_0xf810('0x6e')]};if(!_0x392f33[_0xf810('0x3c')]){_0xca483f[_0xf810('0x43')]=!![];}return _0x3eb828[_0xf810('0x19')](_0xca483f);}else{return logger['error'](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x6a'),util[_0xf810('0x2b')](_0x4630b4[_0xf810('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0x7ead1c){return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'clickatell',util['inspect'](_0x7ead1c,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x6a'),_0xf810('0x69'));}break;case _0xf810('0x6f'):if(_0x392f33[_0xf810('0x2f')]&&_0x392f33[_0xf810('0x30')]){var _0xb26829=util[_0xf810('0x47')](_0xf810('0x54'),_0x392f33[_0xf810('0x2f')],_0x392f33[_0xf810('0x30')]);var _0x3ef457={'method':'POST','uri':_0xf810('0x70')+_0x392f33[_0xf810('0x71')]+_0xf810('0x72'),'body':{'to':[_0x989ba5[_0xf810('0x21')]],'text':_0x989ba5[_0xf810('0x24')],'from':_0x392f33[_0xf810('0x21')],'applicationId':_0x392f33[_0xf810('0x73')]},'headers':{'Authorization':util['format'](_0xf810('0x49'),new Buffer(_0xb26829)[_0xf810('0x4a')](_0xf810('0x4b')))},'json':!![]};rp(_0x3ef457)[_0xf810('0x18')](function(_0x4fe909){if(_0x4fe909['id']){var _0x1b9e08={'messageId':_0x4fe909['id']};return _0x3eb828[_0xf810('0x19')](_0x1b9e08);}else{logger[_0xf810('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf810('0x6f'),util[_0xf810('0x2b')](_0x4fe909,{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0x368c75){logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),'bandwidth',util['inspect'](_0x368c75,{'showHidden':![],'depth':null}));});}else{logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x6f'),_0xf810('0x3e'));}break;case _0xf810('0x74'):if(_0x392f33[_0xf810('0x60')]){var _0x419cea={};var _0x3cbaad={'method':_0xf810('0x37'),'uri':_0xf810('0x75'),'headers':{'Authorization':_0xf810('0x76')+_0x392f33[_0xf810('0x60')],'Content-Type':'application/json'},'body':{'from':_0x392f33[_0xf810('0x21')],'to':_0x989ba5[_0xf810('0x21')],'text':_0x989ba5[_0xf810('0x24')]},'json':!![]};return rp(_0x3cbaad)[_0xf810('0x18')](function(_0xc97f0){if(_0xc97f0['code']==0xca){_0x419cea[_0xf810('0x77')]=_0xc97f0;var _0x31b474={'method':_0xf810('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xf810('0x76')+_0x392f33['apiKey'],'Content-Type':_0xf810('0x5c')},'body':{'refid':_0x419cea[_0xf810('0x77')][_0xf810('0x78')]},'json':!![]};return rp(_0x31b474)['then'](function(_0x5e88a3){_0x419cea['status']=_0x5e88a3;var _0x2936c5={'messageId':_0x419cea[_0xf810('0x77')][_0xf810('0x78')],'read':!![]};return _0x3eb828[_0xf810('0x19')](_0x2936c5);});}else{return logger[_0xf810('0x1a')](_0xf810('0x2c'),_0xf810('0x2a'),_0xf810('0x74'),util[_0xf810('0x2b')](_0xc97f0,{'showHidden':![],'depth':null}));}})[_0xf810('0x29')](function(_0x1ceab3){return logger[_0xf810('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf810('0x2a'),_0xf810('0x74'),util[_0xf810('0x2b')](_0x1ceab3,{'showHidden':![],'depth':null}));});}else{return logger[_0xf810('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf810('0x2a'),_0xf810('0x74'),_0xf810('0x79'));}break;}}})['finally'](function(){_0x161860();});}else{_0x161860();}}},'charset':_0xf810('0x7a'),'collate':_0xf810('0x7b')});}; \ No newline at end of file +var _0xfb74=['total_sent','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','queued_count','head','data','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','application/json','infobip','csc','crypto','login','timestamp','keys','sort','length','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','create','body','phone','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xfb74,0xc1));var _0x4fb7=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xfb74[_0x1e8c4e];return _0x19088a;};'use strict';var _=require(_0x4fb7('0x0'));var util=require(_0x4fb7('0x1'));var logger=require(_0x4fb7('0x2'))(_0x4fb7('0x3'));var moment=require(_0x4fb7('0x4'));var BPromise=require(_0x4fb7('0x5'));var rp=require(_0x4fb7('0x6'));var fs=require('fs');var path=require(_0x4fb7('0x7'));var rimraf=require(_0x4fb7('0x8'));var config=require(_0x4fb7('0x9'));var attributes=require(_0x4fb7('0xa'));module['exports']=function(_0x2d54fe,_0x48734c){return _0x2d54fe['define'](_0x4fb7('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4fb7('0xc'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x63079a,_0x406ffc,_0x3511ed){var _0x104b22=_0x2d54fe[_0x4fb7('0xd')];var _0x49a3b2=_0x63079a[_0x4fb7('0xe')]({'plain':!![]});if(_0x49a3b2[_0x4fb7('0xf')][_0x4fb7('0x10')]()==='in'||_0x49a3b2['direction'][_0x4fb7('0x10')]()===_0x4fb7('0x11')&&!_0x49a3b2[_0x4fb7('0x12')]&&!_['isNil'](_0x49a3b2[_0x4fb7('0x13')])&&!_[_0x4fb7('0x14')](_0x49a3b2['SmsInteractionId'])){_0x104b22['SmsInteraction'][_0x4fb7('0x15')]({'where':{'id':_0x49a3b2[_0x4fb7('0x16')]}})[_0x4fb7('0x17')](function(_0x3fe6ac){if(_0x3fe6ac){_0x3fe6ac['update']({'lastMsgAt':_0x49a3b2[_0x4fb7('0x18')],'lastMsgDirection':_0x49a3b2[_0x4fb7('0xf')][_0x4fb7('0x10')]()});}})[_0x4fb7('0x19')](function(_0x118a27){console[_0x4fb7('0x1a')](_0x118a27);});}if(_0x49a3b2[_0x4fb7('0xf')]===_0x4fb7('0x11')&&!_0x49a3b2[_0x4fb7('0x12')]){var _0x37988c;_0x104b22[_0x4fb7('0x1b')]['find']({'where':{'id':_0x49a3b2[_0x4fb7('0x1c')]},'raw':!![]})[_0x4fb7('0x17')](function(_0x1eef50){_0x37988c=_0x1eef50;if(_0x37988c&&_0x37988c[_0x4fb7('0x1d')]){switch(_0x37988c['type']){case _0x4fb7('0x1e'):var _0x1f3f43=require(_0x4fb7('0x1e'));if(_0x37988c['accountSid']&&_0x37988c['authToken']&&_0x37988c['phone']){var _0x305815=new _0x1f3f43(_0x37988c[_0x4fb7('0x1f')],_0x37988c[_0x4fb7('0x20')]);_0x305815['messages'][_0x4fb7('0x21')]({'body':_0x49a3b2[_0x4fb7('0x22')],'to':_0x49a3b2[_0x4fb7('0x23')],'from':_0x37988c[_0x4fb7('0x23')],'statusCallback':_0x37988c['remote']+_0x4fb7('0x24')+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')]})['then'](function(_0x286485){if(_0x286485[_0x4fb7('0x27')]){return _0x63079a[_0x4fb7('0x28')]({'messageId':_0x286485[_0x4fb7('0x27')]});}})[_0x4fb7('0x19')](function(_0x26e152){logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x1e'),util[_0x4fb7('0x2b')](_0x26e152,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x1e'),_0x4fb7('0x2c'));}break;case'skebby':var _0xd8f3f3=_0x4fb7('0x2d');if(_0x37988c[_0x4fb7('0x2e')]&&_0x37988c[_0x4fb7('0x2f')]){var _0x51f628={'recipient':[_0x49a3b2[_0x4fb7('0x23')]],'message':_0x49a3b2[_0x4fb7('0x22')],'message_type':_0x37988c[_0x4fb7('0x30')]};if(_0x37988c[_0x4fb7('0x30')]&&_0x37988c[_0x4fb7('0x30')]!=='SI'){_0x51f628[_0x4fb7('0x31')]=_0x37988c['phone'];}var _0x3decf2={'url':_0xd8f3f3+'login?username='+_0x37988c[_0x4fb7('0x2e')]+_0x4fb7('0x32')+_0x37988c['password'],'method':_0x4fb7('0x33')};rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x55e260){var _0x2c19b5=_0x55e260[_0x4fb7('0x34')](';');var _0x305e2f={'user_key':_0x2c19b5[0x0],'session_key':_0x2c19b5[0x1]};_0x3decf2={'url':_0xd8f3f3+_0x4fb7('0x35'),'method':_0x4fb7('0x36'),'headers':{'user_key':_0x305e2f[_0x4fb7('0x37')],'Session_key':_0x305e2f[_0x4fb7('0x38')]},'json':!![],'body':_0x51f628};return rp(_0x3decf2);})['then'](function(_0x3c1f89){if(_0x3c1f89[_0x4fb7('0x39')]>=0x1){var _0x2580df={'messageId':_0x3c1f89['internal_order_id']};if(_0x37988c[_0x4fb7('0x30')]!=='GP'||!_0x37988c['deliveryReport']){_0x2580df[_0x4fb7('0x3a')]=!![];}return _0x63079a[_0x4fb7('0x28')](_0x2580df);}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'skebby',util[_0x4fb7('0x2b')](_0x3c1f89,{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x3d0af6){return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x3b'),util[_0x4fb7('0x2b')](_0x3d0af6,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x3b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4fb7('0x3c'):if(_0x37988c[_0x4fb7('0x20')]){var _0x389b3e={'recipient':_0x49a3b2[_0x4fb7('0x23')],'message':_0x49a3b2['body'],'sender':_0x37988c[_0x4fb7('0x3d')]||_0x37988c[_0x4fb7('0x23')],'authorization':_0x37988c[_0x4fb7('0x20')]};var _0x406ffc={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x3e'),'body':_0x389b3e,'json':!![]};rp(_0x406ffc)[_0x4fb7('0x17')](function(_0x289308){var _0x49ec97={'messageId':_0x289308[_0x4fb7('0x3f')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x49ec97[_0x4fb7('0x3a')]=!![];}return _0x63079a['update'](_0x49ec97);})[_0x4fb7('0x19')](function(_0x17cae0){logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x3c'),util['inspect'](_0x17cae0,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate','connectel',_0x4fb7('0x41'));}break;case _0x4fb7('0x42'):if(_0x37988c['username']&&_0x37988c[_0x4fb7('0x2f')]){var _0x389b3e={'messages':[{'source':_0x4fb7('0x43'),'to':_0x49a3b2['phone'],'body':_0x49a3b2[_0x4fb7('0x22')],'from':_0x37988c['senderString']||_0x37988c[_0x4fb7('0x23')]}]};var _0x50438b=util[_0x4fb7('0x44')](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x2e')],_0x37988c[_0x4fb7('0x2f')]);var _0x406ffc={'method':'POST','uri':_0x4fb7('0x46'),'body':_0x389b3e,'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)['toString']('base64'))},'json':!![]};rp(_0x406ffc)['then'](function(_0x59d6bd){if(_0x59d6bd[_0x4fb7('0x48')]>=0xc8&&_0x59d6bd[_0x4fb7('0x48')]<=0xce){if(_0x59d6bd['data']&&_0x59d6bd['data'][_0x4fb7('0x49')]>0x0){var _0x392b4d=_[_0x4fb7('0x4a')](_0x59d6bd[_0x4fb7('0x4b')][_0x4fb7('0x4c')]);var _0x28aa73={'messageId':_0x392b4d[_0x4fb7('0x4d')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x28aa73[_0x4fb7('0x3a')]=!![];}return _0x63079a[_0x4fb7('0x28')](_0x28aa73);}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x59d6bd,{'showHidden':![],'depth':null}));}}else{logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x59d6bd,{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x1074b4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fb7('0x2a'),_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x1074b4,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x4e'),_0x4fb7('0x4f'));}break;case'plivo':if(_0x37988c[_0x4fb7('0x50')]&&_0x37988c[_0x4fb7('0x20')]){var _0x389b3e={'dst':_0x49a3b2[_0x4fb7('0x23')],'text':_0x49a3b2[_0x4fb7('0x22')],'src':_0x37988c[_0x4fb7('0x3d')]||_0x37988c['phone'],'url':_0x37988c['remote']+'/api/sms/messages/'+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')]};var _0x50438b=util['format'](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x50')],_0x37988c[_0x4fb7('0x20')]);var _0x406ffc={'method':'POST','uri':util[_0x4fb7('0x44')](_0x4fb7('0x51'),_0x37988c[_0x4fb7('0x50')]),'body':_0x389b3e,'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)[_0x4fb7('0x52')](_0x4fb7('0x53')))},'json':!![]};rp(_0x406ffc)[_0x4fb7('0x17')](function(_0x9a6e6d){var _0x58b465={'messageId':_0x9a6e6d[_0x4fb7('0x54')][0x0]};return _0x63079a[_0x4fb7('0x28')](_0x58b465);})[_0x4fb7('0x19')](function(_0x41b8d4){logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x55'),util[_0x4fb7('0x2b')](_0x41b8d4,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fb7('0x2a'),_0x4fb7('0x55'),_0x4fb7('0x56'));}break;case'infobip':if(_0x37988c[_0x4fb7('0x2e')]&&_0x37988c[_0x4fb7('0x2f')]){if(_0x37988c[_0x4fb7('0x57')]){var _0x1d6113={'method':_0x4fb7('0x36'),'uri':_0x37988c[_0x4fb7('0x57')]+_0x4fb7('0x58'),'body':{'username':_0x37988c[_0x4fb7('0x2e')],'password':_0x37988c[_0x4fb7('0x2f')]},'json':!![]};return rp(_0x1d6113)['then'](function(_0x151004){var _0x954835={'method':_0x4fb7('0x36'),'uri':_0x37988c[_0x4fb7('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x37988c[_0x4fb7('0x23')],'destinations':[{'to':_0x49a3b2[_0x4fb7('0x23')]}],'text':_0x49a3b2[_0x4fb7('0x22')],'notifyUrl':_0x37988c[_0x4fb7('0x59')]+_0x4fb7('0x24')+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')],'notifyContentType':_0x4fb7('0x5a'),'callbackData':_0x37988c[_0x4fb7('0x23')]+';'+_0x49a3b2[_0x4fb7('0x22')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x151004[_0x4fb7('0x26')]},'json':!![]};return rp(_0x954835)[_0x4fb7('0x17')](function(_0xafcd83){if(_0xafcd83[_0x4fb7('0x4c')]){var _0x2eb0c7={'messageId':_0xafcd83[_0x4fb7('0x4c')][0x0]['messageId']};if(!_0x37988c[_0x4fb7('0x40')]){_0x2eb0c7[_0x4fb7('0x3a')]=!![];}return _0x63079a['update'](_0x2eb0c7);}else{return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5b'),util[_0x4fb7('0x2b')](_0xafcd83,{'showHidden':![],'depth':null}));}});})[_0x4fb7('0x19')](function(_0x462a07){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5b'),util['inspect'](_0x462a07,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'infobip',_0x4fb7('0x4f'));}break;case _0x4fb7('0x5c'):var _0x5d2e83=require(_0x4fb7('0x5d'));if(_0x37988c['apiKey']){var _0x19e798={};_0x19e798[_0x4fb7('0x5e')]=_0x37988c[_0x4fb7('0x2e')];_0x19e798[_0x4fb7('0x23')]=_0x49a3b2[_0x4fb7('0x23')];_0x19e798['sender']=_0x37988c[_0x4fb7('0x23')];_0x19e798['text']=_0x49a3b2[_0x4fb7('0x22')];_0x19e798[_0x4fb7('0x5f')]=+new Date();var _0x1124f8='';var _0x3f1083='';var _0x2a4929=Object[_0x4fb7('0x60')](_0x19e798);_0x2a4929[_0x4fb7('0x61')]();for(var _0x1da764=0x0;_0x1da764<_0x2a4929[_0x4fb7('0x62')];_0x1da764++){if(_0x1124f8!=''){_0x1124f8+='&';}_0x1124f8+=_0x2a4929[_0x1da764]+'='+encodeURIComponent(_0x19e798[_0x2a4929[_0x1da764]]);_0x3f1083+=_0x19e798[_0x2a4929[_0x1da764]];}_0x3f1083+=_0x37988c['apiKey'];_0x3f1083=_0x5d2e83['createHash']('md5')[_0x4fb7('0x28')](_0x3f1083)[_0x4fb7('0x63')](_0x4fb7('0x64'));if(_0x1124f8!==''){_0x1124f8+='&';}_0x1124f8+=_0x4fb7('0x65')+_0x3f1083;var _0x3decf2={'method':_0x4fb7('0x33'),'uri':_0x37988c['baseUrl']+_0x4fb7('0x66')+_0x1124f8,'json':!![]};return rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x158e41){var _0x59990b=Object['keys'](_0x158e41);if(_0x158e41[_0x59990b[0x0]][_0x4fb7('0x1a')]&&parseInt(_0x158e41[_0x59990b[0x0]][_0x4fb7('0x1a')])===0x0){var _0xfc858a={'messageId':_0x158e41[_0x59990b[0x0]][_0x4fb7('0x67')]};if(!_0x37988c['deliveryReport']){_0xfc858a['read']=!![];}return _0x63079a[_0x4fb7('0x28')](_0xfc858a);}else{return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5c'),util[_0x4fb7('0x2b')](_0x158e41[_0x4fb7('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x453d95){return logger['error'](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x5c'),util['inspect'](_0x453d95,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x5c'),_0x4fb7('0x68'));}break;case _0x4fb7('0x69'):if(_0x37988c[_0x4fb7('0x6a')]){var _0x33b868={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x6b'),'headers':{'Authorization':_0x37988c[_0x4fb7('0x6a')]},'body':{'content':_0x49a3b2['body'],'to':[_0x49a3b2['phone']],'from':_0x37988c['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x4fb7('0x6c')},'json':!![]};rp(_0x33b868)['then'](function(_0x41aba3){if(!_0x41aba3[_0x4fb7('0x1a')]){var _0x4f314d={'messageId':_0x41aba3[_0x4fb7('0x4c')][0x0][_0x4fb7('0x6d')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x4f314d['read']=!![];}return _0x63079a[_0x4fb7('0x28')](_0x4f314d);}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x69'),util[_0x4fb7('0x2b')](_0x41aba3[_0x4fb7('0x1a')],{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x53b5fe){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x69'),util[_0x4fb7('0x2b')](_0x53b5fe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),'clickatell',_0x4fb7('0x68'));}break;case _0x4fb7('0x6e'):if(_0x37988c['username']&&_0x37988c['password']){var _0x50438b=util[_0x4fb7('0x44')](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x2e')],_0x37988c[_0x4fb7('0x2f')]);var _0x406ffc={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x6f')+_0x37988c[_0x4fb7('0x70')]+_0x4fb7('0x71'),'body':{'to':[_0x49a3b2[_0x4fb7('0x23')]],'text':_0x49a3b2[_0x4fb7('0x22')],'from':_0x37988c[_0x4fb7('0x23')],'applicationId':_0x37988c[_0x4fb7('0x72')]},'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)[_0x4fb7('0x52')](_0x4fb7('0x53')))},'json':!![]};rp(_0x406ffc)['then'](function(_0x3a6cf0){if(_0x3a6cf0['id']){var _0x21c9f4={'messageId':_0x3a6cf0['id']};return _0x63079a[_0x4fb7('0x28')](_0x21c9f4);}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x6e'),util[_0x4fb7('0x2b')](_0x3a6cf0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d94f5){logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fb7('0x6e'),util[_0x4fb7('0x2b')](_0x3d94f5,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'bandwidth',_0x4fb7('0x4f'));}break;case _0x4fb7('0x73'):if(_0x37988c['apiKey']){var _0x578d00={};var _0x3decf2={'method':'POST','uri':_0x4fb7('0x74'),'headers':{'Authorization':_0x4fb7('0x75')+_0x37988c[_0x4fb7('0x6a')],'Content-Type':_0x4fb7('0x5a')},'body':{'from':_0x37988c[_0x4fb7('0x23')],'to':_0x49a3b2[_0x4fb7('0x23')],'text':_0x49a3b2['body']},'json':!![]};return rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x4e93f8){if(_0x4e93f8[_0x4fb7('0x76')]==0xca){_0x578d00[_0x4fb7('0x77')]=_0x4e93f8;var _0x261105={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x78'),'headers':{'Authorization':_0x4fb7('0x75')+_0x37988c[_0x4fb7('0x6a')],'Content-Type':_0x4fb7('0x5a')},'body':{'refid':_0x578d00['message'][_0x4fb7('0x79')]},'json':!![]};return rp(_0x261105)[_0x4fb7('0x17')](function(_0x5251a6){_0x578d00[_0x4fb7('0x7a')]=_0x5251a6;var _0x17315b={'messageId':_0x578d00[_0x4fb7('0x77')][_0x4fb7('0x79')],'read':!![]};return _0x63079a[_0x4fb7('0x28')](_0x17315b);});}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x73'),util[_0x4fb7('0x2b')](_0x4e93f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a6aca){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'intelepeer',util[_0x4fb7('0x2b')](_0x2a6aca,{'showHidden':![],'depth':null}));});}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x73'),'Token\x20not\x20received');}break;}}})[_0x4fb7('0x7b')](function(){_0x3511ed();});}else{_0x3511ed();}}},'charset':_0x4fb7('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b9af2d1..26f46ab 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 _0xf8ff=['redis','defaults','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSmsMessage','SmsMessage','create','body','raw','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x386ea8,_0x25a165){var _0x1bb9b4=function(_0x2d7cfd){while(--_0x2d7cfd){_0x386ea8['push'](_0x386ea8['shift']());}};_0x1bb9b4(++_0x25a165);}(_0xf8ff,0x71));var _0xff8f=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0xf8ff[_0x2493f7];return _0x594ab2;};'use strict';var _=require('lodash');var util=require(_0xff8f('0x0'));var moment=require(_0xff8f('0x1'));var BPromise=require(_0xff8f('0x2'));var rs=require(_0xff8f('0x3'));var fs=require('fs');var Redis=require(_0xff8f('0x4'));var db=require(_0xff8f('0x5'))['db'];var utils=require(_0xff8f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xff8f('0x7'));var jayson=require(_0xff8f('0x8'));var client=jayson[_0xff8f('0x9')][_0xff8f('0xa')]({'port':0x232a});config[_0xff8f('0xb')]=_[_0xff8f('0xc')](config[_0xff8f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xff8f('0xd'))(new Redis(config[_0xff8f('0xb')]));require('./smsMessage.socket')[_0xff8f('0xe')](socket);function respondWithRpcPromise(_0x4d743a,_0xbb3864,_0x114cc6){return new BPromise(function(_0x4531d2,_0x4c5884){return client[_0xff8f('0xf')](_0x4d743a,_0x114cc6)['then'](function(_0x3c1249){logger[_0xff8f('0x10')](_0xff8f('0x11'),_0xbb3864,_0xff8f('0x12'));logger['debug'](_0xff8f('0x13'),_0xbb3864,_0xff8f('0x12'),JSON[_0xff8f('0x14')](_0x3c1249));if(_0x3c1249[_0xff8f('0x15')]){if(_0x3c1249[_0xff8f('0x15')]['code']===0x1f4){logger[_0xff8f('0x15')]('SmsMessage,\x20%s,\x20%s',_0xbb3864,_0x3c1249[_0xff8f('0x15')][_0xff8f('0x16')]);return _0x4c5884(_0x3c1249[_0xff8f('0x15')][_0xff8f('0x16')]);}logger[_0xff8f('0x15')]('SmsMessage,\x20%s,\x20%s',_0xbb3864,_0x3c1249[_0xff8f('0x15')][_0xff8f('0x16')]);return _0x4531d2(_0x3c1249[_0xff8f('0x15')][_0xff8f('0x16')]);}else{logger[_0xff8f('0x10')](_0xff8f('0x11'),_0xbb3864,'request\x20sent');_0x4531d2(_0x3c1249['result'][_0xff8f('0x16')]);}})[_0xff8f('0x17')](function(_0x91469f){logger[_0xff8f('0x15')](_0xff8f('0x11'),_0xbb3864,_0x91469f);_0x4c5884(_0x91469f);});});}exports[_0xff8f('0x18')]=function(_0x57fec2){var _0x1f53df=this;return new Promise(function(_0x59349a,_0x34df6c){return db[_0xff8f('0x19')][_0xff8f('0x1a')](_0x57fec2[_0xff8f('0x1b')],{'raw':_0x57fec2['options']?_0x57fec2['options'][_0xff8f('0x1c')]===undefined?!![]:![]:!![]})[_0xff8f('0x1d')](function(_0x3d73fc){logger['info'](_0xff8f('0x18'),_0x57fec2);logger[_0xff8f('0x1e')](_0xff8f('0x18'),_0x57fec2,JSON[_0xff8f('0x14')](_0x3d73fc));_0x59349a(_0x3d73fc);})[_0xff8f('0x17')](function(_0x3f9a58){logger[_0xff8f('0x15')]('CreateSmsMessage',_0x3f9a58[_0xff8f('0x16')],_0x57fec2);_0x34df6c(_0x1f53df[_0xff8f('0x15')](0x1f4,_0x3f9a58[_0xff8f('0x16')]));});});}; \ No newline at end of file +var _0x4567=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','body','options','raw','stringify','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4567,0xe1));var _0x7456=function(_0x127f99,_0x32d8a1){_0x127f99=_0x127f99-0x0;var _0x1a35e8=_0x4567[_0x127f99];return _0x1a35e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7456('0x0'));var fs=require('fs');var Redis=require(_0x7456('0x1'));var db=require(_0x7456('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7456('0x3'));var config=require(_0x7456('0x4'));var jayson=require(_0x7456('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7456('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x7456('0x7'))(new Redis(config[_0x7456('0x6')]));require(_0x7456('0x8'))['register'](socket);function respondWithRpcPromise(_0x5cadf8,_0x33d58a,_0x40ead6){return new BPromise(function(_0x5ae34c,_0x3882ec){return client['request'](_0x5cadf8,_0x40ead6)[_0x7456('0x9')](function(_0x25862e){logger[_0x7456('0xa')]('SmsMessage,\x20%s,\x20%s',_0x33d58a,_0x7456('0xb'));logger[_0x7456('0xc')](_0x7456('0xd'),_0x33d58a,_0x7456('0xb'),JSON['stringify'](_0x25862e));if(_0x25862e[_0x7456('0xe')]){if(_0x25862e[_0x7456('0xe')]['code']===0x1f4){logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x25862e['error'][_0x7456('0x10')]);return _0x3882ec(_0x25862e[_0x7456('0xe')]['message']);}logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x25862e[_0x7456('0xe')][_0x7456('0x10')]);return _0x5ae34c(_0x25862e[_0x7456('0xe')][_0x7456('0x10')]);}else{logger[_0x7456('0xa')](_0x7456('0xf'),_0x33d58a,_0x7456('0xb'));_0x5ae34c(_0x25862e[_0x7456('0x11')][_0x7456('0x10')]);}})['catch'](function(_0x2f2c30){logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x2f2c30);_0x3882ec(_0x2f2c30);});});}exports[_0x7456('0x12')]=function(_0xcf9490){var _0x440f8a=this;return new Promise(function(_0x112c6f,_0x17b62f){return db[_0x7456('0x13')]['create'](_0xcf9490[_0x7456('0x14')],{'raw':_0xcf9490['options']?_0xcf9490[_0x7456('0x15')][_0x7456('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4f6eb9){logger[_0x7456('0xa')](_0x7456('0x12'),_0xcf9490);logger[_0x7456('0xc')]('CreateSmsMessage',_0xcf9490,JSON[_0x7456('0x17')](_0x4f6eb9));_0x112c6f(_0x4f6eb9);})[_0x7456('0x18')](function(_0x249fa5){logger[_0x7456('0xe')]('CreateSmsMessage',_0x249fa5[_0x7456('0x10')],_0xcf9490);_0x17b62f(_0x440f8a['error'](0x1f4,_0x249fa5[_0x7456('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d935e94..005256f 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 _0x553a=['save','remove','emit','removeListener','register','./smsMessage.events'];(function(_0x238272,_0x4084a7){var _0x526f61=function(_0x54427a){while(--_0x54427a){_0x238272['push'](_0x238272['shift']());}};_0x526f61(++_0x4084a7);}(_0x553a,0x173));var _0xa553=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x553a[_0x3ce937];return _0x41d2fa;};'use strict';var SmsMessageEvents=require(_0xa553('0x0'));var events=[_0xa553('0x1'),_0xa553('0x2'),'update'];function createListener(_0x469e3a,_0x23133e){return function(_0x412665){_0x23133e[_0xa553('0x3')](_0x469e3a,_0x412665);};}function removeListener(_0x3f3076,_0x2d3a5d){return function(){SmsMessageEvents[_0xa553('0x4')](_0x3f3076,_0x2d3a5d);};}exports[_0xa553('0x5')]=function(_0x5c13d5){for(var _0x942273=0x0,_0x5b8234=events['length'];_0x942273<_0x5b8234;_0x942273++){var _0x1b75a4=events[_0x942273];var _0x55c92d=createListener('smsMessage:'+_0x1b75a4,_0x5c13d5);SmsMessageEvents['on'](_0x1b75a4,_0x55c92d);}}; \ No newline at end of file +var _0xe340=['smsMessage:','./smsMessage.events','remove','emit','removeListener','length'];(function(_0x1ff97e,_0x73b58b){var _0x1a947f=function(_0xbff7f9){while(--_0xbff7f9){_0x1ff97e['push'](_0x1ff97e['shift']());}};_0x1a947f(++_0x73b58b);}(_0xe340,0x6d));var _0x0e34=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe340[_0x543084];return _0x306a57;};'use strict';var SmsMessageEvents=require(_0x0e34('0x0'));var events=['save',_0x0e34('0x1'),'update'];function createListener(_0x2d5a44,_0x1cdc4b){return function(_0x58d2ce){_0x1cdc4b[_0x0e34('0x2')](_0x2d5a44,_0x58d2ce);};}function removeListener(_0x21ddc4,_0x4d5cc4){return function(){SmsMessageEvents[_0x0e34('0x3')](_0x21ddc4,_0x4d5cc4);};}exports['register']=function(_0x3dfd01){for(var _0xf490e5=0x0,_0x1eede1=events[_0x0e34('0x4')];_0xf490e5<_0x1eede1;_0xf490e5++){var _0x4fce99=events[_0xf490e5];var _0x3a8eb9=createListener(_0x0e34('0x5')+_0x4fce99,_0x3dfd01);SmsMessageEvents['on'](_0x4fce99,_0x3a8eb9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c3b96f9..5b284cf 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 _0x462e=['post','create','addAgents','put','/:id','update','delete','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getAgents'];(function(_0x332ab1,_0x382a1c){var _0x17e607=function(_0x2d83da){while(--_0x2d83da){_0x332ab1['push'](_0x332ab1['shift']());}};_0x17e607(++_0x382a1c);}(_0x462e,0xc7));var _0xe462=function(_0x24f75d,_0x2513b3){_0x24f75d=_0x24f75d-0x0;var _0x57fbeb=_0x462e[_0x24f75d];return _0x57fbeb;};'use strict';var multer=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var path=require(_0xe462('0x2'));var timeout=require(_0xe462('0x3'));var express=require(_0xe462('0x4'));var router=express[_0xe462('0x5')]();var fs_extra=require(_0xe462('0x6'));var auth=require(_0xe462('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe462('0x8'));router[_0xe462('0x9')]('/',auth[_0xe462('0xa')](),controller['index']);router[_0xe462('0x9')]('/describe',auth[_0xe462('0xa')](),controller[_0xe462('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe462('0xc')]);router[_0xe462('0x9')](_0xe462('0xd'),auth[_0xe462('0xa')](),controller[_0xe462('0xe')]);router[_0xe462('0x9')](_0xe462('0xf'),auth[_0xe462('0xa')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xe462('0x10')]);router[_0xe462('0x11')]('/',auth[_0xe462('0xa')](),controller[_0xe462('0x12')]);router[_0xe462('0x11')](_0xe462('0xf'),auth[_0xe462('0xa')](),controller['addTeams']);router[_0xe462('0x11')]('/:id/users',auth[_0xe462('0xa')](),controller[_0xe462('0x13')]);router[_0xe462('0x14')](_0xe462('0x15'),auth[_0xe462('0xa')](),controller[_0xe462('0x16')]);router[_0xe462('0x17')]('/:id',auth[_0xe462('0xa')](),controller['destroy']);router[_0xe462('0x17')](_0xe462('0xf'),auth[_0xe462('0xa')](),controller[_0xe462('0x18')]);router['delete'](_0xe462('0x19'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xe462('0x1a')]=router; \ No newline at end of file +var _0xe7a8=['getTeams','getAgents','post','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xe7a8,0xcf));var _0x8e7a=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0xe7a8[_0x4acfd2];return _0x12afbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e7a('0x0'));var timeout=require(_0x8e7a('0x1'));var express=require(_0x8e7a('0x2'));var router=express[_0x8e7a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8e7a('0x4'));var interaction=require(_0x8e7a('0x5'));var config=require(_0x8e7a('0x6'));var controller=require(_0x8e7a('0x7'));router[_0x8e7a('0x8')]('/',auth[_0x8e7a('0x9')](),controller['index']);router[_0x8e7a('0x8')](_0x8e7a('0xa'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xb')]);router[_0x8e7a('0x8')](_0x8e7a('0xc'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xd')]);router[_0x8e7a('0x8')](_0x8e7a('0xe'),auth['isAuthenticated'](),controller[_0x8e7a('0xf')]);router[_0x8e7a('0x8')](_0x8e7a('0x10'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x11')]);router[_0x8e7a('0x8')]('/:id/users',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x12')]);router[_0x8e7a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8e7a('0x13')]('/:id/teams',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x14')]);router[_0x8e7a('0x13')](_0x8e7a('0x15'),auth[_0x8e7a('0x9')](),controller['addAgents']);router[_0x8e7a('0x16')]('/:id',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x17')]);router[_0x8e7a('0x18')](_0x8e7a('0xc'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x19')]);router[_0x8e7a('0x18')]('/:id/teams',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x1a')]);router[_0x8e7a('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x8e7a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6fbf2eb..fb53736 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 _0x94fc=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x33c477,_0x1aba86){var _0x4a63b3=function(_0x66b18b){while(--_0x66b18b){_0x33c477['push'](_0x33c477['shift']());}};_0x4a63b3(++_0x1aba86);}(_0x94fc,0x141));var _0xc94f=function(_0x19c28c,_0x5e16b1){_0x19c28c=_0x19c28c-0x0;var _0x2676d8=_0x94fc[_0x19c28c];return _0x2676d8;};'use strict';var Sequelize=require(_0xc94f('0x0'));module[_0xc94f('0x1')]={'name':{'type':Sequelize[_0xc94f('0x2')],'unique':_0xc94f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc94f('0x2')]},'timeout':{'type':Sequelize[_0xc94f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc94f('0x5')](_0xc94f('0x6'),'beepall',_0xc94f('0x7'))}}; \ No newline at end of file +var _0xac11=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x5dff45,_0x10cae1){var _0x33a904=function(_0x49bc33){while(--_0x49bc33){_0x5dff45['push'](_0x5dff45['shift']());}};_0x33a904(++_0x10cae1);}(_0xac11,0x75));var _0x1ac1=function(_0x2c31c2,_0x5cd6c4){_0x2c31c2=_0x2c31c2-0x0;var _0x46fd7d=_0xac11[_0x2c31c2];return _0x46fd7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ac1('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ac1('0x0')]},'timeout':{'type':Sequelize[_0x1ac1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ac1('0x2')](_0x1ac1('0x3'),_0x1ac1('0x4'),_0x1ac1('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c6c3c2a..3171c5f 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 _0xedd0=['status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','destroy','stack','name','send','index','SmsQueue','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filters','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','order','sort','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','Team','addTeams','Agents','online','voicePause','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x4ff670,_0x38d1a1){var _0x59f3d0=function(_0xf643fd){while(--_0xf643fd){_0x4ff670['push'](_0x4ff670['shift']());}};_0x59f3d0(++_0x38d1a1);}(_0xedd0,0x6c));var _0x0edd=function(_0x5f3d09,_0x1eb384){_0x5f3d09=_0x5f3d09-0x0;var _0x19c3da=_0xedd0[_0x5f3d09];return _0x19c3da;};'use strict';var emlformat=require(_0x0edd('0x0'));var rimraf=require(_0x0edd('0x1'));var zipdir=require(_0x0edd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0edd('0x3'));var moment=require(_0x0edd('0x4'));var BPromise=require(_0x0edd('0x5'));var Mustache=require(_0x0edd('0x6'));var util=require(_0x0edd('0x7'));var path=require(_0x0edd('0x8'));var sox=require(_0x0edd('0x9'));var csv=require(_0x0edd('0xa'));var ejs=require(_0x0edd('0xb'));var fs=require('fs');var fs_extra=require(_0x0edd('0xc'));var _=require(_0x0edd('0xd'));var squel=require('squel');var crypto=require(_0x0edd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0edd('0xf'));var toCsv=require(_0x0edd('0xa'));var querystring=require(_0x0edd('0x10'));var Papa=require('papaparse');var Redis=require(_0x0edd('0x11'));var authService=require(_0x0edd('0x12'));var qs=require(_0x0edd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0edd('0x14'));var logger=require(_0x0edd('0x15'))(_0x0edd('0x16'));var utils=require(_0x0edd('0x17'));var config=require(_0x0edd('0x18'));var licenseUtil=require(_0x0edd('0x19'));var db=require(_0x0edd('0x1a'))['db'];config['redis']=_[_0x0edd('0x1b')](config[_0x0edd('0x1c')],{'host':_0x0edd('0x1d'),'port':0x18eb});var socket=require(_0x0edd('0x1e'))(new Redis(config['redis']));require(_0x0edd('0x1f'))[_0x0edd('0x20')](socket);function respondWithStatusCode(_0x6d22e0,_0x1bff50){_0x1bff50=_0x1bff50||0xcc;return function(_0x155716){if(_0x155716){return _0x6d22e0['sendStatus'](_0x1bff50);}return _0x6d22e0[_0x0edd('0x21')](_0x1bff50)[_0x0edd('0x22')]();};}function respondWithResult(_0x190318,_0x3c82b5){_0x3c82b5=_0x3c82b5||0xc8;return function(_0x5a6b86){if(_0x5a6b86){return _0x190318[_0x0edd('0x21')](_0x3c82b5)[_0x0edd('0x23')](_0x5a6b86);}};}function respondWithFilteredResult(_0x21a7c8,_0x48fb1e){return function(_0x714a9c){if(_0x714a9c){var _0x59a95b=typeof _0x48fb1e['offset']===_0x0edd('0x24')&&typeof _0x48fb1e[_0x0edd('0x25')]===_0x0edd('0x24');var _0x135e94=_0x714a9c['count'];var _0x59b85e=_0x59a95b?0x0:_0x48fb1e[_0x0edd('0x26')];var _0x3978d8=_0x59a95b?_0x714a9c[_0x0edd('0x27')]:_0x48fb1e[_0x0edd('0x26')]+_0x48fb1e[_0x0edd('0x25')];var _0x6bd747;if(_0x3978d8>=_0x135e94){_0x3978d8=_0x135e94;_0x6bd747=0xc8;}else{_0x6bd747=0xce;}_0x21a7c8[_0x0edd('0x21')](_0x6bd747);return _0x21a7c8[_0x0edd('0x28')](_0x0edd('0x29'),_0x59b85e+'-'+_0x3978d8+'/'+_0x135e94)[_0x0edd('0x23')](_0x714a9c);}return null;};}function patchUpdates(_0x20bfd6){return function(_0xc0938c){try{jsonpatch[_0x0edd('0x2a')](_0xc0938c,_0x20bfd6,!![]);}catch(_0x38aa1c){return BPromise[_0x0edd('0x2b')](_0x38aa1c);}return _0xc0938c['save']();};}function saveUpdates(_0x50ba35,_0x178d2c){return function(_0x2fedde){if(_0x2fedde){return _0x2fedde[_0x0edd('0x2c')](_0x50ba35)[_0x0edd('0x2d')](function(_0x257cfc){return _0x257cfc;});}return null;};}function removeEntity(_0x2802a5,_0x4bb6c2){return function(_0x1302a5){if(_0x1302a5){return _0x1302a5['destroy']()[_0x0edd('0x2d')](function(){var _0x5af2a2=_0x1302a5[_0x0edd('0x2e')]({'plain':!![]});var _0x41f637='SmsQueues';return db['UserProfileResource'][_0x0edd('0x2f')]({'where':{'type':_0x41f637,'resourceId':_0x5af2a2['id']}})[_0x0edd('0x2d')](function(){return _0x1302a5;});})['then'](function(){_0x2802a5[_0x0edd('0x21')](0xcc)[_0x0edd('0x22')]();});}};}function handleEntityNotFound(_0x1e2c8f,_0x95c792){return function(_0x56ccac){if(!_0x56ccac){_0x1e2c8f['sendStatus'](0x194);}return _0x56ccac;};}function handleError(_0x5ddbfc,_0x20d6f5){_0x20d6f5=_0x20d6f5||0x1f4;return function(_0x16de39){logger['error'](_0x16de39[_0x0edd('0x30')]);if(_0x16de39[_0x0edd('0x31')]){delete _0x16de39[_0x0edd('0x31')];}_0x5ddbfc[_0x0edd('0x21')](_0x20d6f5)[_0x0edd('0x32')](_0x16de39);};}exports[_0x0edd('0x33')]=function(_0x34214f,_0x4b0154){var _0x2fa65e={},_0x1fbd05={},_0xa98d06={'count':0x0,'rows':[]};var _0x39e66e=_['map'](db[_0x0edd('0x34')][_0x0edd('0x35')],function(_0x5ef435){return{'name':_0x5ef435[_0x0edd('0x36')],'type':_0x5ef435['type']['key']};});_0x1fbd05[_0x0edd('0x37')]=_['map'](_0x39e66e,_0x0edd('0x31'));_0x1fbd05[_0x0edd('0x38')]=_[_0x0edd('0x39')](_0x34214f[_0x0edd('0x38')]);_0x1fbd05['filters']=_[_0x0edd('0x3a')](_0x1fbd05['model'],_0x1fbd05[_0x0edd('0x38')]);_0x2fa65e[_0x0edd('0x3b')]=_['intersection'](_0x1fbd05[_0x0edd('0x37')],qs[_0x0edd('0x3c')](_0x34214f[_0x0edd('0x38')][_0x0edd('0x3c')]));_0x2fa65e['attributes']=_0x2fa65e[_0x0edd('0x3b')]['length']?_0x2fa65e[_0x0edd('0x3b')]:_0x1fbd05[_0x0edd('0x37')];if(!_0x34214f['query'][_0x0edd('0x3d')](_0x0edd('0x3e'))){_0x2fa65e['limit']=qs[_0x0edd('0x25')](_0x34214f[_0x0edd('0x38')][_0x0edd('0x25')]);_0x2fa65e['offset']=qs['offset'](_0x34214f[_0x0edd('0x38')][_0x0edd('0x26')]);}_0x2fa65e['order']=qs['sort'](_0x34214f[_0x0edd('0x38')]['sort']);_0x2fa65e[_0x0edd('0x3f')]=qs['filters'](_[_0x0edd('0x40')](_0x34214f[_0x0edd('0x38')],_0x1fbd05[_0x0edd('0x41')]),_0x39e66e);if(_0x34214f[_0x0edd('0x38')][_0x0edd('0x42')]){_0x2fa65e[_0x0edd('0x3f')]=_[_0x0edd('0x43')](_0x2fa65e[_0x0edd('0x3f')],{'$or':_[_0x0edd('0x44')](_0x39e66e,function(_0xd74fa7){if(_0xd74fa7[_0x0edd('0x45')]!==_0x0edd('0x46')){var _0xcfc66d={};_0xcfc66d[_0xd74fa7[_0x0edd('0x31')]]={'$like':'%'+_0x34214f['query'][_0x0edd('0x42')]+'%'};return _0xcfc66d;}})});}_0x2fa65e=_['merge']({},_0x2fa65e,_0x34214f[_0x0edd('0x47')]);var _0x5dadb2={'where':_0x2fa65e[_0x0edd('0x3f')]};return db[_0x0edd('0x34')][_0x0edd('0x27')](_0x5dadb2)[_0x0edd('0x2d')](function(_0x302e04){_0xa98d06[_0x0edd('0x27')]=_0x302e04;if(_0x34214f['query'][_0x0edd('0x48')]){_0x2fa65e[_0x0edd('0x49')]=[{'all':!![]}];}return db[_0x0edd('0x34')][_0x0edd('0x4a')](_0x2fa65e);})[_0x0edd('0x2d')](function(_0x5e2842){_0xa98d06[_0x0edd('0x4b')]=_0x5e2842;return _0xa98d06;})[_0x0edd('0x2d')](respondWithFilteredResult(_0x4b0154,_0x2fa65e))[_0x0edd('0x4c')](handleError(_0x4b0154,null));};exports['show']=function(_0x3c525b,_0x11e076){var _0x36f1b4={'raw':!![],'where':{'id':_0x3c525b['params']['id']}},_0x36c01c={};_0x36c01c['model']=_[_0x0edd('0x39')](db[_0x0edd('0x34')][_0x0edd('0x35')]);_0x36c01c[_0x0edd('0x38')]=_[_0x0edd('0x39')](_0x3c525b[_0x0edd('0x38')]);_0x36c01c[_0x0edd('0x41')]=_[_0x0edd('0x3a')](_0x36c01c[_0x0edd('0x37')],_0x36c01c[_0x0edd('0x38')]);_0x36f1b4[_0x0edd('0x3b')]=_['intersection'](_0x36c01c[_0x0edd('0x37')],qs[_0x0edd('0x3c')](_0x3c525b['query'][_0x0edd('0x3c')]));_0x36f1b4[_0x0edd('0x3b')]=_0x36f1b4['attributes'][_0x0edd('0x4d')]?_0x36f1b4[_0x0edd('0x3b')]:_0x36c01c[_0x0edd('0x37')];if(_0x3c525b[_0x0edd('0x38')]['includeAll']){_0x36f1b4[_0x0edd('0x49')]=[{'all':!![]}];}_0x36f1b4=_[_0x0edd('0x43')]({},_0x36f1b4,_0x3c525b[_0x0edd('0x47')]);return db[_0x0edd('0x34')][_0x0edd('0x4e')](_0x36f1b4)[_0x0edd('0x2d')](handleEntityNotFound(_0x11e076,null))[_0x0edd('0x2d')](respondWithResult(_0x11e076,null))[_0x0edd('0x4c')](handleError(_0x11e076,null));};exports[_0x0edd('0x4f')]=function(_0x1f0cee,_0x412791){return db[_0x0edd('0x34')][_0x0edd('0x4f')](_0x1f0cee[_0x0edd('0x50')],{})[_0x0edd('0x2d')](function(_0x897d7d){var _0x3c4224=_0x1f0cee[_0x0edd('0x51')][_0x0edd('0x2e')]({'plain':!![]});if(!_0x3c4224)throw new Error(_0x0edd('0x52'));if(_0x3c4224[_0x0edd('0x53')]===_0x0edd('0x51')){var _0x548472=_0x897d7d['get']({'plain':!![]});var _0x2639e3=_0x0edd('0x54');return db[_0x0edd('0x55')][_0x0edd('0x4e')]({'where':{'name':_0x2639e3,'userProfileId':_0x3c4224[_0x0edd('0x56')]},'raw':!![]})[_0x0edd('0x2d')](function(_0x2e0b4a){if(_0x2e0b4a&&_0x2e0b4a[_0x0edd('0x57')]===0x0){return db[_0x0edd('0x58')]['create']({'name':_0x548472[_0x0edd('0x31')],'resourceId':_0x548472['id'],'type':_0x2e0b4a[_0x0edd('0x31')],'sectionId':_0x2e0b4a['id']},{})[_0x0edd('0x2d')](function(){return _0x897d7d;});}else{return _0x897d7d;}})['catch'](function(_0x1d5e96){logger[_0x0edd('0x59')](_0x0edd('0x5a'),_0x1d5e96);throw _0x1d5e96;});}return _0x897d7d;})[_0x0edd('0x2d')](respondWithResult(_0x412791,0xc9))[_0x0edd('0x4c')](handleError(_0x412791,null));};exports[_0x0edd('0x2c')]=function(_0x2d9dfc,_0x309459){if(_0x2d9dfc[_0x0edd('0x50')]['id']){delete _0x2d9dfc[_0x0edd('0x50')]['id'];}return db[_0x0edd('0x34')]['find']({'where':{'id':_0x2d9dfc['params']['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x309459,null))[_0x0edd('0x2d')](saveUpdates(_0x2d9dfc[_0x0edd('0x50')],null))[_0x0edd('0x2d')](respondWithResult(_0x309459,null))[_0x0edd('0x4c')](handleError(_0x309459,null));};exports[_0x0edd('0x2f')]=function(_0x11bf04,_0x175046){return db[_0x0edd('0x34')][_0x0edd('0x4e')]({'where':{'id':_0x11bf04[_0x0edd('0x5b')]['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x175046,null))[_0x0edd('0x2d')](removeEntity(_0x175046,null))[_0x0edd('0x4c')](handleError(_0x175046,null));};exports[_0x0edd('0x5c')]=function(_0x5560f1,_0x3e36a0){return db[_0x0edd('0x34')]['describe']()[_0x0edd('0x2d')](respondWithResult(_0x3e36a0,null))[_0x0edd('0x4c')](handleError(_0x3e36a0,null));};exports[_0x0edd('0x5d')]=function(_0x20613b,_0x296751,_0x2769dc){var _0x4ca82b={'raw':!![],'where':{}},_0x475108={},_0x74b2c0;return db[_0x0edd('0x34')][_0x0edd('0x5e')]({'where':{'id':_0x20613b[_0x0edd('0x5b')]['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x296751,null))['then'](function(_0x4abf68){if(_0x4abf68){_0x74b2c0=_0x4abf68[_0x0edd('0x2e')]({'plain':!![]});_0x475108[_0x0edd('0x37')]=_[_0x0edd('0x39')](db[_0x0edd('0x5f')]['rawAttributes']);_0x475108[_0x0edd('0x38')]=_[_0x0edd('0x39')](_0x20613b[_0x0edd('0x38')]);_0x475108[_0x0edd('0x41')]=_[_0x0edd('0x3a')](_0x475108[_0x0edd('0x37')],_0x475108[_0x0edd('0x38')]);_0x4ca82b['attributes']=_[_0x0edd('0x3a')](_0x475108[_0x0edd('0x37')],qs['fields'](_0x20613b[_0x0edd('0x38')]['fields']));_0x4ca82b[_0x0edd('0x3b')]=_0x4ca82b[_0x0edd('0x3b')][_0x0edd('0x4d')]?_0x4ca82b[_0x0edd('0x3b')]:_0x475108['model'];if(!_0x20613b['query'][_0x0edd('0x3d')](_0x0edd('0x3e'))){_0x4ca82b['limit']=qs[_0x0edd('0x25')](_0x20613b['query'][_0x0edd('0x25')]);_0x4ca82b[_0x0edd('0x26')]=qs[_0x0edd('0x26')](_0x20613b[_0x0edd('0x38')][_0x0edd('0x26')]);}_0x4ca82b[_0x0edd('0x60')]=qs[_0x0edd('0x61')](_0x20613b[_0x0edd('0x38')]['sort']);_0x4ca82b[_0x0edd('0x3f')]=qs[_0x0edd('0x41')](_[_0x0edd('0x40')](_0x20613b[_0x0edd('0x38')],_0x475108[_0x0edd('0x41')]));_0x4ca82b[_0x0edd('0x3f')][_0x0edd('0x62')]=_0x4abf68['id'];if(_0x20613b[_0x0edd('0x38')]['filter']){_0x4ca82b[_0x0edd('0x3f')]=_['merge'](_0x4ca82b[_0x0edd('0x3f')],{'$or':_[_0x0edd('0x44')](_0x4ca82b['attributes'],function(_0x7d81f5){var _0x36e04a={};_0x36e04a[_0x7d81f5]={'$like':'%'+_0x20613b[_0x0edd('0x38')][_0x0edd('0x42')]+'%'};return _0x36e04a;})});}_0x4ca82b=_[_0x0edd('0x43')]({},_0x4ca82b,_0x20613b[_0x0edd('0x47')]);return db[_0x0edd('0x5f')]['findAll'](_0x4ca82b);}})[_0x0edd('0x2d')](function(_0xf292ca){if(_0xf292ca){return db[_0x0edd('0x63')]['findAndCountAll']({'where':{'id':_[_0x0edd('0x44')](_0xf292ca,_0x0edd('0x64')),'role':_0x0edd('0x65')},'attributes':['id','name',_0x0edd('0x66'),_0x0edd('0x67'),_0x0edd('0x68')]});}})[_0x0edd('0x2d')](function(_0x3201c3){if(_0x3201c3){return{'count':_0x3201c3[_0x0edd('0x27')],'rows':_[_0x0edd('0x44')](_0x3201c3[_0x0edd('0x4b')],function(_0xbeb23f){return{'membername':_0xbeb23f[_0x0edd('0x31')],'UserId':_0xbeb23f['id'],'queue_name':_0x74b2c0[_0x0edd('0x31')],'SmsQueueId':_0x74b2c0['id'],'interface':util['format'](_0x0edd('0x69'),'SIP',_0xbeb23f['name']),'penalty':0x0,'paused':_0xbeb23f[_0x0edd('0x66')],'createdAt':_0xbeb23f[_0x0edd('0x68')],'updatedAt':_0xbeb23f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0edd('0x2d')](respondWithFilteredResult(_0x296751,_0x4ca82b))[_0x0edd('0x4c')](handleError(_0x296751,null));};exports['getTeams']=function(_0x1ac8f5,_0x22ed0e,_0x364aa2){var _0x53f74f={};var _0x4f2166={};var _0x73c575;var _0x31d434;return db[_0x0edd('0x34')][_0x0edd('0x5e')]({'where':{'id':_0x1ac8f5['params']['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x22ed0e,null))['then'](function(_0xd26f21){if(_0xd26f21){_0x73c575=_0xd26f21;_0x4f2166[_0x0edd('0x37')]=_['keys'](db[_0x0edd('0x6a')][_0x0edd('0x35')]);_0x4f2166[_0x0edd('0x38')]=_['keys'](_0x1ac8f5[_0x0edd('0x38')]);_0x4f2166[_0x0edd('0x41')]=_['intersection'](_0x4f2166[_0x0edd('0x37')],_0x4f2166[_0x0edd('0x38')]);_0x53f74f['attributes']=_['intersection'](_0x4f2166[_0x0edd('0x37')],qs['fields'](_0x1ac8f5[_0x0edd('0x38')][_0x0edd('0x3c')]));_0x53f74f[_0x0edd('0x3b')]=_0x53f74f['attributes'][_0x0edd('0x4d')]?_0x53f74f['attributes']:_0x4f2166[_0x0edd('0x37')];_0x53f74f[_0x0edd('0x60')]=qs[_0x0edd('0x61')](_0x1ac8f5['query'][_0x0edd('0x61')]);_0x53f74f[_0x0edd('0x3f')]=qs[_0x0edd('0x41')](_[_0x0edd('0x40')](_0x1ac8f5[_0x0edd('0x38')],_0x4f2166[_0x0edd('0x41')]));if(_0x1ac8f5['query'][_0x0edd('0x42')]){_0x53f74f['where']=_[_0x0edd('0x43')](_0x53f74f[_0x0edd('0x3f')],{'$or':_[_0x0edd('0x44')](_0x53f74f[_0x0edd('0x3b')],function(_0x25a1c6){var _0x568b4b={};_0x568b4b[_0x25a1c6]={'$like':'%'+_0x1ac8f5[_0x0edd('0x38')][_0x0edd('0x42')]+'%'};return _0x568b4b;})});}_0x53f74f=_[_0x0edd('0x43')]({},_0x53f74f,_0x1ac8f5[_0x0edd('0x47')]);return _0x73c575['getTeams'](_0x53f74f);}})[_0x0edd('0x2d')](function(_0x267ae2){if(_0x267ae2){_0x31d434=_0x267ae2[_0x0edd('0x4d')];if(!_0x1ac8f5[_0x0edd('0x38')][_0x0edd('0x3d')](_0x0edd('0x3e'))){_0x53f74f[_0x0edd('0x25')]=qs[_0x0edd('0x25')](_0x1ac8f5[_0x0edd('0x38')][_0x0edd('0x25')]);_0x53f74f[_0x0edd('0x26')]=qs[_0x0edd('0x26')](_0x1ac8f5['query'][_0x0edd('0x26')]);}return _0x73c575['getTeams'](_0x53f74f);}})['then'](function(_0x332a8d){if(_0x332a8d){return _0x332a8d?{'count':_0x31d434,'rows':_0x332a8d}:null;}})[_0x0edd('0x2d')](respondWithResult(_0x22ed0e,null))[_0x0edd('0x4c')](handleError(_0x22ed0e,null));};exports[_0x0edd('0x6b')]=function(_0x41cd19,_0x175569,_0x2f3b59){var _0x131547=_0x41cd19[_0x0edd('0x50')]['ids'];return db[_0x0edd('0x6a')][_0x0edd('0x4a')]({'where':{'id':_0x131547},'attributes':['id'],'include':[{'model':db[_0x0edd('0x63')],'as':_0x0edd('0x6c'),'attributes':['id',_0x0edd('0x31'),_0x0edd('0x6d'),_0x0edd('0x6e'),'interface'],'raw':!![]}]})['then'](function(_0x41e864){if(_0x41e864){var _0x14cf07=_['flatMap'](_0x41e864,function(_0x46ddc6){var _0x7a0a0e=_0x46ddc6['get']({'plain':!![]});return _0x7a0a0e[_0x0edd('0x6c')];});return db['SmsQueue'][_0x0edd('0x4e')]({'where':{'id':_0x41cd19[_0x0edd('0x5b')]['id']}})['then'](function(_0xc3ed5e){return db[_0x0edd('0x6f')][_0x0edd('0x70')](function(_0x3eb006){return _0xc3ed5e[_0x0edd('0x6b')](_0x131547,{'transaction':_0x3eb006})['then'](function(){return BPromise[_0x0edd('0x71')](_0x14cf07,function(_0x1238c8){return db[_0x0edd('0x5f')]['findOrCreate']({'where':{'UserId':_0x1238c8['id'],'SmsQueueId':_0x41cd19[_0x0edd('0x5b')]['id']},'transaction':_0x3eb006});});})[_0x0edd('0x2d')](function(){_0x14cf07[_0x0edd('0x72')](function(_0x366b81){socket[_0x0edd('0x73')](_0x0edd('0x74'),{'UserId':_0x366b81['id'],'SmsQueueId':_0xc3ed5e['id']});});});});});}})[_0x0edd('0x2d')](respondWithStatusCode(_0x175569,null))[_0x0edd('0x4c')](handleError(_0x175569,null));};exports[_0x0edd('0x75')]=function(_0x110d4c,_0x25f8dd,_0x172691){return db[_0x0edd('0x6a')][_0x0edd('0x4a')]({'where':{'id':_0x110d4c[_0x0edd('0x38')][_0x0edd('0x76')]},'attributes':['id'],'include':[{'model':db[_0x0edd('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0edd('0x2d')](handleEntityNotFound(_0x25f8dd,null))[_0x0edd('0x2d')](function(_0x5603fd){var _0x416037=_[_0x0edd('0x44')](_0x5603fd,'id');var _0x3e0ad1=[];var _0x41060b=[];var _0xd55924=squel[_0x0edd('0x77')]();_0xd55924[_0x0edd('0x78')]('tq.TeamId')[_0x0edd('0x79')](_0x0edd('0x7a'),'tq')[_0x0edd('0x7b')](_0x0edd('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0edd('0x3f')](_0x0edd('0x7d'),_0x110d4c['params']['id']);for(var _0x35fb80=0x0;_0x35fb80<_0x5603fd[_0x0edd('0x4d')];_0x35fb80+=0x1){let _0x3d0391=_0x5603fd[_0x35fb80];for(var _0x3ebb94=0x0;_0x3ebb94<_0x3d0391[_0x0edd('0x6c')][_0x0edd('0x4d')];_0x3ebb94+=0x1){let _0x33d8=_0x3d0391[_0x0edd('0x6c')][_0x3ebb94];var _0x3ee89f=_0xd55924[_0x0edd('0x7e')]();_0x3ee89f[_0x0edd('0x3f')](_0x0edd('0x7f'),_0x33d8['id']);_0x41060b[_0x0edd('0x80')](db[_0x0edd('0x6f')][_0x0edd('0x38')](_0x3ee89f[_0x0edd('0x81')](),{'type':db[_0x0edd('0x6f')]['QueryTypes'][_0x0edd('0x82')]})[_0x0edd('0x2d')](function(_0x2cc4a9){if(_0x2cc4a9[_0x0edd('0x4d')]===0x1){return _0x33d8['id'];}else{var _0x261882=_['every'](_[_0x0edd('0x44')](_0x2cc4a9,_0x0edd('0x83')),function(_0x5c2235){return _[_0x0edd('0x84')](_0x416037,_0x5c2235);});if(_0x261882){return _0x33d8['id'];}}}));}}return BPromise[_0x0edd('0x85')](_0x41060b)[_0x0edd('0x2d')](function(_0x4d8319){_0x3e0ad1=_(_0x3e0ad1)[_0x0edd('0x86')](_0x4d8319)[_0x0edd('0x87')]()[_0x0edd('0x88')]();return db[_0x0edd('0x34')]['find']({'where':{'id':_0x110d4c[_0x0edd('0x5b')]['id']}})[_0x0edd('0x2d')](function(_0x21e1ab){return db[_0x0edd('0x6f')][_0x0edd('0x70')](function(_0x58b88b){return _0x21e1ab[_0x0edd('0x75')](_0x110d4c[_0x0edd('0x38')][_0x0edd('0x76')],{'transaction':_0x58b88b})[_0x0edd('0x2d')](function(){if(!_[_0x0edd('0x89')](_0x3e0ad1)){return _0x21e1ab['removeAgents'](_0x3e0ad1,{'transaction':_0x58b88b});}})[_0x0edd('0x2d')](function(){_0x3e0ad1[_0x0edd('0x72')](function(_0x4e4e17){socket[_0x0edd('0x73')](_0x0edd('0x8a'),{'UserId':_0x4e4e17,'SmsQueueId':_0x21e1ab['id']});});});});});});})['then'](respondWithStatusCode(_0x25f8dd,null))[_0x0edd('0x4c')](handleError(_0x25f8dd,null));};exports['addAgents']=function(_0x5898bf,_0x3761bb,_0x550e68){return db[_0x0edd('0x34')][_0x0edd('0x4e')]({'where':{'id':_0x5898bf['params']['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x3761bb,null))[_0x0edd('0x2d')](function(_0x3a0392){if(_0x3a0392){return _0x3a0392['addAgents'](_0x5898bf[_0x0edd('0x50')][_0x0edd('0x76')],_['omit'](_0x5898bf[_0x0edd('0x50')],[_0x0edd('0x76'),'id'])||{})['spread'](function(_0x225c59){for(var _0x4c3f21=0x0;_0x4c3f21<_0x5898bf['body'][_0x0edd('0x76')][_0x0edd('0x4d')];_0x4c3f21+=0x1){socket[_0x0edd('0x73')](_0x0edd('0x74'),{'UserId':Number(_0x5898bf[_0x0edd('0x50')][_0x0edd('0x76')][_0x4c3f21]),'SmsQueueId':Number(_0x5898bf[_0x0edd('0x5b')]['id'])});}return _0x225c59;});}})[_0x0edd('0x2d')](respondWithResult(_0x3761bb,null))[_0x0edd('0x4c')](handleError(_0x3761bb,null));};exports['removeAgents']=function(_0x33366b,_0x184696,_0x11e857){return db['SmsQueue']['find']({'where':{'id':_0x33366b['params']['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x184696,null))[_0x0edd('0x2d')](function(_0x46639b){if(_0x46639b){return _0x46639b[_0x0edd('0x8b')](_0x33366b[_0x0edd('0x38')]['ids'])[_0x0edd('0x2d')](function(){if(_['isArray'](_0x33366b[_0x0edd('0x38')][_0x0edd('0x76')])){for(var _0x4b9214=0x0;_0x4b9214<_0x33366b[_0x0edd('0x38')][_0x0edd('0x76')][_0x0edd('0x4d')];_0x4b9214+=0x1){socket[_0x0edd('0x73')](_0x0edd('0x8a'),{'UserId':Number(_0x33366b['query']['ids'][_0x4b9214]),'SmsQueueId':Number(_0x33366b[_0x0edd('0x5b')]['id'])});}}else{socket[_0x0edd('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x33366b[_0x0edd('0x38')][_0x0edd('0x76')]),'SmsQueueId':Number(_0x33366b[_0x0edd('0x5b')]['id'])});}});}})[_0x0edd('0x2d')](respondWithStatusCode(_0x184696,null))[_0x0edd('0x4c')](handleError(_0x184696,null));};exports[_0x0edd('0x8c')]=function(_0x31a4be,_0x319c65,_0x5b0bc4){var _0x5a1d22={};var _0x45a565={};var _0x47e13a;var _0x563857;return db[_0x0edd('0x34')][_0x0edd('0x5e')]({'where':{'id':_0x31a4be[_0x0edd('0x5b')]['id']}})[_0x0edd('0x2d')](handleEntityNotFound(_0x319c65,null))[_0x0edd('0x2d')](function(_0x1def2b){if(_0x1def2b){_0x47e13a=_0x1def2b;_0x45a565['model']=_['keys'](db['User'][_0x0edd('0x35')]);_0x45a565['query']=_[_0x0edd('0x39')](_0x31a4be['query']);_0x45a565[_0x0edd('0x41')]=_['intersection'](_0x45a565[_0x0edd('0x37')],_0x45a565['query']);_0x5a1d22[_0x0edd('0x3b')]=_[_0x0edd('0x3a')](_0x45a565[_0x0edd('0x37')],qs['fields'](_0x31a4be[_0x0edd('0x38')]['fields']));_0x5a1d22[_0x0edd('0x3b')]=_0x5a1d22['attributes'][_0x0edd('0x4d')]?_0x5a1d22['attributes']:_0x45a565[_0x0edd('0x37')];_0x5a1d22[_0x0edd('0x60')]=qs[_0x0edd('0x61')](_0x31a4be[_0x0edd('0x38')][_0x0edd('0x61')]);_0x5a1d22[_0x0edd('0x3f')]=qs[_0x0edd('0x41')](_[_0x0edd('0x40')](_0x31a4be['query'],_0x45a565[_0x0edd('0x41')]));if(_0x31a4be['query'][_0x0edd('0x42')]){_0x5a1d22['where']=_[_0x0edd('0x43')](_0x5a1d22[_0x0edd('0x3f')],{'$or':_[_0x0edd('0x44')](_0x5a1d22[_0x0edd('0x3b')],function(_0x3a9640){var _0x47061d={};_0x47061d[_0x3a9640]={'$like':'%'+_0x31a4be[_0x0edd('0x38')]['filter']+'%'};return _0x47061d;})});}_0x5a1d22=_[_0x0edd('0x43')]({},_0x5a1d22,_0x31a4be[_0x0edd('0x47')]);return _0x47e13a[_0x0edd('0x8c')](_0x5a1d22);}})[_0x0edd('0x2d')](function(_0x2a7513){if(_0x2a7513){_0x563857=_0x2a7513[_0x0edd('0x4d')];if(!_0x31a4be[_0x0edd('0x38')]['hasOwnProperty']('nolimit')){_0x5a1d22[_0x0edd('0x25')]=qs['limit'](_0x31a4be['query'][_0x0edd('0x25')]);_0x5a1d22['offset']=qs[_0x0edd('0x26')](_0x31a4be[_0x0edd('0x38')][_0x0edd('0x26')]);}return _0x47e13a[_0x0edd('0x8c')](_0x5a1d22);}})['then'](function(_0x5a756f){if(_0x5a756f){return _0x5a756f?{'count':_0x563857,'rows':_0x5a756f}:null;}})[_0x0edd('0x2d')](respondWithResult(_0x319c65,null))[_0x0edd('0x4c')](handleError(_0x319c65,null));}; \ No newline at end of file +var _0xa567=['zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','get','SmsQueues','sendStatus','name','send','index','map','SmsQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','describe','findOne','UserSmsQueue','order','SmsQueueId','filter','User','UserId','updatedAt','createdAt','rows','format','%s/%s','smsPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','spread','isArray','userSmsQueue:remove','getAgents','rawAttributes','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa567,0x1ae));var _0x7a56=function(_0x4df28b,_0x362f3f){_0x4df28b=_0x4df28b-0x0;var _0x1ffba4=_0xa567[_0x4df28b];return _0x1ffba4;};'use strict';var emlformat=require(_0x7a56('0x0'));var rimraf=require(_0x7a56('0x1'));var zipdir=require(_0x7a56('0x2'));var jsonpatch=require(_0x7a56('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a56('0x4'));var Mustache=require('mustache');var util=require(_0x7a56('0x5'));var path=require(_0x7a56('0x6'));var sox=require(_0x7a56('0x7'));var csv=require(_0x7a56('0x8'));var ejs=require(_0x7a56('0x9'));var fs=require('fs');var fs_extra=require(_0x7a56('0xa'));var _=require(_0x7a56('0xb'));var squel=require(_0x7a56('0xc'));var crypto=require(_0x7a56('0xd'));var jsforce=require(_0x7a56('0xe'));var deskjs=require(_0x7a56('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a56('0x10'));var Papa=require(_0x7a56('0x11'));var Redis=require(_0x7a56('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a56('0x13'));var logger=require(_0x7a56('0x14'))(_0x7a56('0x15'));var utils=require(_0x7a56('0x16'));var config=require(_0x7a56('0x17'));var licenseUtil=require(_0x7a56('0x18'));var db=require(_0x7a56('0x19'))['db'];config[_0x7a56('0x1a')]=_['defaults'](config[_0x7a56('0x1a')],{'host':_0x7a56('0x1b'),'port':0x18eb});var socket=require(_0x7a56('0x1c'))(new Redis(config[_0x7a56('0x1a')]));require(_0x7a56('0x1d'))[_0x7a56('0x1e')](socket);function respondWithStatusCode(_0x1e992d,_0x2e202c){_0x2e202c=_0x2e202c||0xcc;return function(_0x5a537f){if(_0x5a537f){return _0x1e992d['sendStatus'](_0x2e202c);}return _0x1e992d['status'](_0x2e202c)[_0x7a56('0x1f')]();};}function respondWithResult(_0x32a451,_0x168fa3){_0x168fa3=_0x168fa3||0xc8;return function(_0x1fc11b){if(_0x1fc11b){return _0x32a451[_0x7a56('0x20')](_0x168fa3)['json'](_0x1fc11b);}};}function respondWithFilteredResult(_0x245ebc,_0x57961c){return function(_0x23fa3a){if(_0x23fa3a){var _0x306635=typeof _0x57961c[_0x7a56('0x21')]==='undefined'&&typeof _0x57961c[_0x7a56('0x22')]===_0x7a56('0x23');var _0x399621=_0x23fa3a[_0x7a56('0x24')];var _0x5f359b=_0x306635?0x0:_0x57961c['offset'];var _0x5eef3b=_0x306635?_0x23fa3a[_0x7a56('0x24')]:_0x57961c[_0x7a56('0x21')]+_0x57961c[_0x7a56('0x22')];var _0x47bdbf;if(_0x5eef3b>=_0x399621){_0x5eef3b=_0x399621;_0x47bdbf=0xc8;}else{_0x47bdbf=0xce;}_0x245ebc[_0x7a56('0x20')](_0x47bdbf);return _0x245ebc['set']('Content-Range',_0x5f359b+'-'+_0x5eef3b+'/'+_0x399621)[_0x7a56('0x25')](_0x23fa3a);}return null;};}function patchUpdates(_0xe806d2){return function(_0x3eec8e){try{jsonpatch[_0x7a56('0x26')](_0x3eec8e,_0xe806d2,!![]);}catch(_0x2701b2){return BPromise[_0x7a56('0x27')](_0x2701b2);}return _0x3eec8e[_0x7a56('0x28')]();};}function saveUpdates(_0x1e7f96,_0xfc9b88){return function(_0x3e09ae){if(_0x3e09ae){return _0x3e09ae[_0x7a56('0x29')](_0x1e7f96)[_0x7a56('0x2a')](function(_0x2004ef){return _0x2004ef;});}return null;};}function removeEntity(_0x4c810f,_0x585f71){return function(_0x2b3e6e){if(_0x2b3e6e){return _0x2b3e6e[_0x7a56('0x2b')]()[_0x7a56('0x2a')](function(){var _0x46ee67=_0x2b3e6e[_0x7a56('0x2c')]({'plain':!![]});var _0x207c56=_0x7a56('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x207c56,'resourceId':_0x46ee67['id']}})[_0x7a56('0x2a')](function(){return _0x2b3e6e;});})['then'](function(){_0x4c810f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144596,_0x14fc71){return function(_0x221b6f){if(!_0x221b6f){_0x144596[_0x7a56('0x2e')](0x194);}return _0x221b6f;};}function handleError(_0x3cbc47,_0x5e4942){_0x5e4942=_0x5e4942||0x1f4;return function(_0x44ea1a){logger['error'](_0x44ea1a['stack']);if(_0x44ea1a[_0x7a56('0x2f')]){delete _0x44ea1a[_0x7a56('0x2f')];}_0x3cbc47[_0x7a56('0x20')](_0x5e4942)[_0x7a56('0x30')](_0x44ea1a);};}exports[_0x7a56('0x31')]=function(_0x1aa94f,_0x43b1ad){var _0x1113b9={},_0x5906a2={},_0x2f8bfc={'count':0x0,'rows':[]};var _0x477a2b=_[_0x7a56('0x32')](db[_0x7a56('0x33')]['rawAttributes'],function(_0x49ad23){return{'name':_0x49ad23['fieldName'],'type':_0x49ad23['type'][_0x7a56('0x34')]};});_0x5906a2[_0x7a56('0x35')]=_['map'](_0x477a2b,_0x7a56('0x2f'));_0x5906a2[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x1aa94f[_0x7a56('0x36')]);_0x5906a2[_0x7a56('0x38')]=_[_0x7a56('0x39')](_0x5906a2[_0x7a56('0x35')],_0x5906a2[_0x7a56('0x36')]);_0x1113b9[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x5906a2['model'],qs[_0x7a56('0x3b')](_0x1aa94f['query'][_0x7a56('0x3b')]));_0x1113b9[_0x7a56('0x3a')]=_0x1113b9[_0x7a56('0x3a')][_0x7a56('0x3c')]?_0x1113b9['attributes']:_0x5906a2[_0x7a56('0x35')];if(!_0x1aa94f['query'][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x1113b9[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x1aa94f[_0x7a56('0x36')]['limit']);_0x1113b9[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x1aa94f['query'][_0x7a56('0x21')]);}_0x1113b9['order']=qs[_0x7a56('0x3f')](_0x1aa94f[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x1113b9[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x1aa94f[_0x7a56('0x36')],_0x5906a2[_0x7a56('0x38')]),_0x477a2b);if(_0x1aa94f[_0x7a56('0x36')]['filter']){_0x1113b9[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x1113b9[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x477a2b,function(_0x2681e8){if(_0x2681e8['type']!==_0x7a56('0x43')){var _0x13f0a2={};_0x13f0a2[_0x2681e8[_0x7a56('0x2f')]]={'$like':'%'+_0x1aa94f[_0x7a56('0x36')]['filter']+'%'};return _0x13f0a2;}})});}_0x1113b9=_[_0x7a56('0x42')]({},_0x1113b9,_0x1aa94f[_0x7a56('0x44')]);var _0x42dbf2={'where':_0x1113b9[_0x7a56('0x40')]};return db[_0x7a56('0x33')][_0x7a56('0x24')](_0x42dbf2)[_0x7a56('0x2a')](function(_0x2bd289){_0x2f8bfc[_0x7a56('0x24')]=_0x2bd289;if(_0x1aa94f[_0x7a56('0x36')][_0x7a56('0x45')]){_0x1113b9[_0x7a56('0x46')]=[{'all':!![]}];}return db[_0x7a56('0x33')][_0x7a56('0x47')](_0x1113b9);})['then'](function(_0x5aac49){_0x2f8bfc['rows']=_0x5aac49;return _0x2f8bfc;})[_0x7a56('0x2a')](respondWithFilteredResult(_0x43b1ad,_0x1113b9))[_0x7a56('0x48')](handleError(_0x43b1ad,null));};exports['show']=function(_0x581134,_0x596d78){var _0x272585={'raw':!![],'where':{'id':_0x581134[_0x7a56('0x49')]['id']}},_0x4c28aa={};_0x4c28aa[_0x7a56('0x35')]=_[_0x7a56('0x37')](db['SmsQueue']['rawAttributes']);_0x4c28aa['query']=_[_0x7a56('0x37')](_0x581134['query']);_0x4c28aa['filters']=_['intersection'](_0x4c28aa[_0x7a56('0x35')],_0x4c28aa[_0x7a56('0x36')]);_0x272585[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x4c28aa[_0x7a56('0x35')],qs[_0x7a56('0x3b')](_0x581134[_0x7a56('0x36')]['fields']));_0x272585[_0x7a56('0x3a')]=_0x272585[_0x7a56('0x3a')]['length']?_0x272585['attributes']:_0x4c28aa['model'];if(_0x581134['query'][_0x7a56('0x45')]){_0x272585[_0x7a56('0x46')]=[{'all':!![]}];}_0x272585=_[_0x7a56('0x42')]({},_0x272585,_0x581134[_0x7a56('0x44')]);return db[_0x7a56('0x33')][_0x7a56('0x4a')](_0x272585)[_0x7a56('0x2a')](handleEntityNotFound(_0x596d78,null))[_0x7a56('0x2a')](respondWithResult(_0x596d78,null))[_0x7a56('0x48')](handleError(_0x596d78,null));};exports[_0x7a56('0x4b')]=function(_0x4724d4,_0x469666){return db['SmsQueue'][_0x7a56('0x4b')](_0x4724d4['body'],{})[_0x7a56('0x2a')](function(_0x1336c4){var _0x572b26=_0x4724d4[_0x7a56('0x4c')][_0x7a56('0x2c')]({'plain':!![]});if(!_0x572b26)throw new Error(_0x7a56('0x4d'));if(_0x572b26[_0x7a56('0x4e')]===_0x7a56('0x4c')){var _0x214e4d=_0x1336c4[_0x7a56('0x2c')]({'plain':!![]});var _0x494016='SmsQueues';return db[_0x7a56('0x4f')][_0x7a56('0x4a')]({'where':{'name':_0x494016,'userProfileId':_0x572b26[_0x7a56('0x50')]},'raw':!![]})[_0x7a56('0x2a')](function(_0x324f0f){if(_0x324f0f&&_0x324f0f[_0x7a56('0x51')]===0x0){return db[_0x7a56('0x52')]['create']({'name':_0x214e4d['name'],'resourceId':_0x214e4d['id'],'type':_0x324f0f['name'],'sectionId':_0x324f0f['id']},{})[_0x7a56('0x2a')](function(){return _0x1336c4;});}else{return _0x1336c4;}})['catch'](function(_0x225918){logger[_0x7a56('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x225918);throw _0x225918;});}return _0x1336c4;})[_0x7a56('0x2a')](respondWithResult(_0x469666,0xc9))[_0x7a56('0x48')](handleError(_0x469666,null));};exports[_0x7a56('0x29')]=function(_0x391b6d,_0x2938ad){if(_0x391b6d[_0x7a56('0x54')]['id']){delete _0x391b6d[_0x7a56('0x54')]['id'];}return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x391b6d['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x2938ad,null))[_0x7a56('0x2a')](saveUpdates(_0x391b6d[_0x7a56('0x54')],null))['then'](respondWithResult(_0x2938ad,null))[_0x7a56('0x48')](handleError(_0x2938ad,null));};exports[_0x7a56('0x2b')]=function(_0x2302e3,_0x5a2a08){return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x2302e3['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x5a2a08,null))['then'](removeEntity(_0x5a2a08,null))[_0x7a56('0x48')](handleError(_0x5a2a08,null));};exports[_0x7a56('0x55')]=function(_0x427e5d,_0x307d3d){return db[_0x7a56('0x33')][_0x7a56('0x55')]()['then'](respondWithResult(_0x307d3d,null))[_0x7a56('0x48')](handleError(_0x307d3d,null));};exports['getMembers']=function(_0x465ba8,_0x46fcb4,_0x32bc9a){var _0x261949={'raw':!![],'where':{}},_0x200708={},_0x33ba8f;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x465ba8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x46fcb4,null))[_0x7a56('0x2a')](function(_0x6b1511){if(_0x6b1511){_0x33ba8f=_0x6b1511[_0x7a56('0x2c')]({'plain':!![]});_0x200708[_0x7a56('0x35')]=_[_0x7a56('0x37')](db[_0x7a56('0x57')]['rawAttributes']);_0x200708[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x465ba8[_0x7a56('0x36')]);_0x200708[_0x7a56('0x38')]=_['intersection'](_0x200708[_0x7a56('0x35')],_0x200708[_0x7a56('0x36')]);_0x261949[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x200708[_0x7a56('0x35')],qs[_0x7a56('0x3b')](_0x465ba8[_0x7a56('0x36')]['fields']));_0x261949[_0x7a56('0x3a')]=_0x261949['attributes'][_0x7a56('0x3c')]?_0x261949['attributes']:_0x200708['model'];if(!_0x465ba8[_0x7a56('0x36')][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x261949[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x465ba8[_0x7a56('0x36')][_0x7a56('0x22')]);_0x261949[_0x7a56('0x21')]=qs['offset'](_0x465ba8[_0x7a56('0x36')]['offset']);}_0x261949[_0x7a56('0x58')]=qs[_0x7a56('0x3f')](_0x465ba8[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x261949[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x465ba8[_0x7a56('0x36')],_0x200708['filters']));_0x261949[_0x7a56('0x40')][_0x7a56('0x59')]=_0x6b1511['id'];if(_0x465ba8[_0x7a56('0x36')][_0x7a56('0x5a')]){_0x261949[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x261949[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x261949[_0x7a56('0x3a')],function(_0x102417){var _0x24475d={};_0x24475d[_0x102417]={'$like':'%'+_0x465ba8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x24475d;})});}_0x261949=_[_0x7a56('0x42')]({},_0x261949,_0x465ba8['options']);return db[_0x7a56('0x57')]['findAll'](_0x261949);}})['then'](function(_0x56609c){if(_0x56609c){return db[_0x7a56('0x5b')]['findAndCountAll']({'where':{'id':_[_0x7a56('0x32')](_0x56609c,_0x7a56('0x5c')),'role':'agent'},'attributes':['id',_0x7a56('0x2f'),'smsPause',_0x7a56('0x5d'),_0x7a56('0x5e')]});}})['then'](function(_0x4fbfd8){if(_0x4fbfd8){return{'count':_0x4fbfd8[_0x7a56('0x24')],'rows':_['map'](_0x4fbfd8[_0x7a56('0x5f')],function(_0x47c9dc){return{'membername':_0x47c9dc['name'],'UserId':_0x47c9dc['id'],'queue_name':_0x33ba8f[_0x7a56('0x2f')],'SmsQueueId':_0x33ba8f['id'],'interface':util[_0x7a56('0x60')](_0x7a56('0x61'),'SIP',_0x47c9dc[_0x7a56('0x2f')]),'penalty':0x0,'paused':_0x47c9dc[_0x7a56('0x62')],'createdAt':_0x47c9dc[_0x7a56('0x5e')],'updatedAt':_0x47c9dc[_0x7a56('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46fcb4,_0x261949))['catch'](handleError(_0x46fcb4,null));};exports['getTeams']=function(_0x1502a8,_0x4dcd1c,_0x3a31fa){var _0x29a87f={};var _0x45cf3f={};var _0x4023f5;var _0x3cf54d;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x1502a8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x4dcd1c,null))[_0x7a56('0x2a')](function(_0x54dda2){if(_0x54dda2){_0x4023f5=_0x54dda2;_0x45cf3f['model']=_[_0x7a56('0x37')](db[_0x7a56('0x63')]['rawAttributes']);_0x45cf3f[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x1502a8[_0x7a56('0x36')]);_0x45cf3f[_0x7a56('0x38')]=_['intersection'](_0x45cf3f[_0x7a56('0x35')],_0x45cf3f[_0x7a56('0x36')]);_0x29a87f[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x45cf3f['model'],qs['fields'](_0x1502a8[_0x7a56('0x36')]['fields']));_0x29a87f[_0x7a56('0x3a')]=_0x29a87f[_0x7a56('0x3a')]['length']?_0x29a87f[_0x7a56('0x3a')]:_0x45cf3f['model'];_0x29a87f[_0x7a56('0x58')]=qs[_0x7a56('0x3f')](_0x1502a8[_0x7a56('0x36')]['sort']);_0x29a87f[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_['pick'](_0x1502a8[_0x7a56('0x36')],_0x45cf3f[_0x7a56('0x38')]));if(_0x1502a8[_0x7a56('0x36')][_0x7a56('0x5a')]){_0x29a87f[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x29a87f[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x29a87f[_0x7a56('0x3a')],function(_0x31c772){var _0x373577={};_0x373577[_0x31c772]={'$like':'%'+_0x1502a8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x373577;})});}_0x29a87f=_[_0x7a56('0x42')]({},_0x29a87f,_0x1502a8['options']);return _0x4023f5[_0x7a56('0x64')](_0x29a87f);}})['then'](function(_0x1b3dde){if(_0x1b3dde){_0x3cf54d=_0x1b3dde['length'];if(!_0x1502a8[_0x7a56('0x36')][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x29a87f[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x1502a8[_0x7a56('0x36')][_0x7a56('0x22')]);_0x29a87f[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x1502a8[_0x7a56('0x36')][_0x7a56('0x21')]);}return _0x4023f5[_0x7a56('0x64')](_0x29a87f);}})[_0x7a56('0x2a')](function(_0x29cf11){if(_0x29cf11){return _0x29cf11?{'count':_0x3cf54d,'rows':_0x29cf11}:null;}})[_0x7a56('0x2a')](respondWithResult(_0x4dcd1c,null))[_0x7a56('0x48')](handleError(_0x4dcd1c,null));};exports[_0x7a56('0x65')]=function(_0x4f92b0,_0x3eaf36,_0x238d0f){var _0x1a8e37=_0x4f92b0[_0x7a56('0x54')][_0x7a56('0x66')];return db[_0x7a56('0x63')][_0x7a56('0x47')]({'where':{'id':_0x1a8e37},'attributes':['id'],'include':[{'model':db[_0x7a56('0x5b')],'as':_0x7a56('0x67'),'attributes':['id',_0x7a56('0x2f'),_0x7a56('0x68'),_0x7a56('0x69'),_0x7a56('0x6a')],'raw':!![]}]})[_0x7a56('0x2a')](function(_0x79c0cd){if(_0x79c0cd){var _0x45d3d2=_[_0x7a56('0x6b')](_0x79c0cd,function(_0xd44345){var _0x428205=_0xd44345[_0x7a56('0x2c')]({'plain':!![]});return _0x428205[_0x7a56('0x67')];});return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x4f92b0[_0x7a56('0x49')]['id']}})['then'](function(_0x1e946d){return db[_0x7a56('0x6c')][_0x7a56('0x6d')](function(_0x235f3f){return _0x1e946d[_0x7a56('0x65')](_0x1a8e37,{'transaction':_0x235f3f})[_0x7a56('0x2a')](function(){return BPromise[_0x7a56('0x6e')](_0x45d3d2,function(_0xfe1a25){return db[_0x7a56('0x57')]['findOrCreate']({'where':{'UserId':_0xfe1a25['id'],'SmsQueueId':_0x4f92b0[_0x7a56('0x49')]['id']},'transaction':_0x235f3f});});})['then'](function(){_0x45d3d2['forEach'](function(_0x309084){socket['emit'](_0x7a56('0x6f'),{'UserId':_0x309084['id'],'SmsQueueId':_0x1e946d['id']});});});});});}})['then'](respondWithStatusCode(_0x3eaf36,null))[_0x7a56('0x48')](handleError(_0x3eaf36,null));};exports[_0x7a56('0x70')]=function(_0x46e9b0,_0x492e94,_0x3077ee){return db['Team']['findAll']({'where':{'id':_0x46e9b0[_0x7a56('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a56('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7a56('0x2a')](handleEntityNotFound(_0x492e94,null))['then'](function(_0x1bc49b){var _0x1629a9=_[_0x7a56('0x32')](_0x1bc49b,'id');var _0x3c893d=[];var _0x2ff845=[];var _0x2bf075=squel[_0x7a56('0x71')]();_0x2bf075[_0x7a56('0x72')](_0x7a56('0x73'))[_0x7a56('0x74')](_0x7a56('0x75'),'tq')[_0x7a56('0x76')](_0x7a56('0x77'),'ut',_0x7a56('0x78'))[_0x7a56('0x40')](_0x7a56('0x79'),_0x46e9b0[_0x7a56('0x49')]['id']);for(var _0xb06e8d=0x0;_0xb06e8d<_0x1bc49b[_0x7a56('0x3c')];_0xb06e8d+=0x1){let _0x37ab60=_0x1bc49b[_0xb06e8d];for(var _0x11c49b=0x0;_0x11c49b<_0x37ab60['Agents'][_0x7a56('0x3c')];_0x11c49b+=0x1){let _0x226238=_0x37ab60[_0x7a56('0x67')][_0x11c49b];var _0x79bf1c=_0x2bf075[_0x7a56('0x7a')]();_0x79bf1c[_0x7a56('0x40')](_0x7a56('0x7b'),_0x226238['id']);_0x2ff845[_0x7a56('0x7c')](db['sequelize'][_0x7a56('0x36')](_0x79bf1c[_0x7a56('0x7d')](),{'type':db[_0x7a56('0x6c')][_0x7a56('0x7e')][_0x7a56('0x7f')]})['then'](function(_0x282671){if(_0x282671[_0x7a56('0x3c')]===0x1){return _0x226238['id'];}else{var _0x49c7a9=_[_0x7a56('0x80')](_[_0x7a56('0x32')](_0x282671,_0x7a56('0x81')),function(_0x5a9f69){return _[_0x7a56('0x82')](_0x1629a9,_0x5a9f69);});if(_0x49c7a9){return _0x226238['id'];}}}));}}return BPromise[_0x7a56('0x83')](_0x2ff845)[_0x7a56('0x2a')](function(_0x5064f3){_0x3c893d=_(_0x3c893d)[_0x7a56('0x84')](_0x5064f3)[_0x7a56('0x85')]()[_0x7a56('0x86')]();return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x46e9b0[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](function(_0x5c660d){return db[_0x7a56('0x6c')][_0x7a56('0x6d')](function(_0x184d8a){return _0x5c660d['removeTeams'](_0x46e9b0[_0x7a56('0x36')][_0x7a56('0x66')],{'transaction':_0x184d8a})['then'](function(){if(!_[_0x7a56('0x87')](_0x3c893d)){return _0x5c660d[_0x7a56('0x88')](_0x3c893d,{'transaction':_0x184d8a});}})[_0x7a56('0x2a')](function(){_0x3c893d['forEach'](function(_0x2535e6){socket[_0x7a56('0x89')]('userSmsQueue:remove',{'UserId':_0x2535e6,'SmsQueueId':_0x5c660d['id']});});});});});});})[_0x7a56('0x2a')](respondWithStatusCode(_0x492e94,null))[_0x7a56('0x48')](handleError(_0x492e94,null));};exports[_0x7a56('0x8a')]=function(_0x3e1ecb,_0x2a6ae8,_0x10ab93){return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x3e1ecb['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x2a6ae8,null))['then'](function(_0x546d50){if(_0x546d50){return _0x546d50[_0x7a56('0x8a')](_0x3e1ecb[_0x7a56('0x54')]['ids'],_['omit'](_0x3e1ecb[_0x7a56('0x54')],[_0x7a56('0x66'),'id'])||{})[_0x7a56('0x8b')](function(_0x3da642){for(var _0x27cb5d=0x0;_0x27cb5d<_0x3e1ecb[_0x7a56('0x54')][_0x7a56('0x66')][_0x7a56('0x3c')];_0x27cb5d+=0x1){socket[_0x7a56('0x89')]('userSmsQueue:save',{'UserId':Number(_0x3e1ecb[_0x7a56('0x54')][_0x7a56('0x66')][_0x27cb5d]),'SmsQueueId':Number(_0x3e1ecb['params']['id'])});}return _0x3da642;});}})[_0x7a56('0x2a')](respondWithResult(_0x2a6ae8,null))[_0x7a56('0x48')](handleError(_0x2a6ae8,null));};exports[_0x7a56('0x88')]=function(_0x4ace8f,_0x22e66d,_0x48c21a){return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x4ace8f['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x22e66d,null))[_0x7a56('0x2a')](function(_0x5ba7a7){if(_0x5ba7a7){return _0x5ba7a7[_0x7a56('0x88')](_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')])['then'](function(){if(_[_0x7a56('0x8c')](_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')])){for(var _0x2883cf=0x0;_0x2883cf<_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')]['length'];_0x2883cf+=0x1){socket['emit'](_0x7a56('0x8d'),{'UserId':Number(_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')][_0x2883cf]),'SmsQueueId':Number(_0x4ace8f[_0x7a56('0x49')]['id'])});}}else{socket[_0x7a56('0x89')](_0x7a56('0x8d'),{'UserId':Number(_0x4ace8f[_0x7a56('0x36')]['ids']),'SmsQueueId':Number(_0x4ace8f[_0x7a56('0x49')]['id'])});}});}})[_0x7a56('0x2a')](respondWithStatusCode(_0x22e66d,null))[_0x7a56('0x48')](handleError(_0x22e66d,null));};exports[_0x7a56('0x8e')]=function(_0x2402b8,_0x4544e0,_0x1ea78b){var _0x5dfa85={};var _0x52c942={};var _0x10dced;var _0x5e8c6f;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x2402b8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x4544e0,null))[_0x7a56('0x2a')](function(_0x32f4f6){if(_0x32f4f6){_0x10dced=_0x32f4f6;_0x52c942[_0x7a56('0x35')]=_[_0x7a56('0x37')](db[_0x7a56('0x5b')][_0x7a56('0x8f')]);_0x52c942[_0x7a56('0x36')]=_['keys'](_0x2402b8[_0x7a56('0x36')]);_0x52c942['filters']=_[_0x7a56('0x39')](_0x52c942['model'],_0x52c942['query']);_0x5dfa85[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x52c942[_0x7a56('0x35')],qs['fields'](_0x2402b8['query'][_0x7a56('0x3b')]));_0x5dfa85[_0x7a56('0x3a')]=_0x5dfa85['attributes'][_0x7a56('0x3c')]?_0x5dfa85[_0x7a56('0x3a')]:_0x52c942[_0x7a56('0x35')];_0x5dfa85['order']=qs[_0x7a56('0x3f')](_0x2402b8[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x5dfa85[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x2402b8['query'],_0x52c942['filters']));if(_0x2402b8[_0x7a56('0x36')]['filter']){_0x5dfa85[_0x7a56('0x40')]=_['merge'](_0x5dfa85[_0x7a56('0x40')],{'$or':_['map'](_0x5dfa85[_0x7a56('0x3a')],function(_0xbbed1c){var _0x464352={};_0x464352[_0xbbed1c]={'$like':'%'+_0x2402b8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x464352;})});}_0x5dfa85=_[_0x7a56('0x42')]({},_0x5dfa85,_0x2402b8[_0x7a56('0x44')]);return _0x10dced['getAgents'](_0x5dfa85);}})['then'](function(_0x3c50e2){if(_0x3c50e2){_0x5e8c6f=_0x3c50e2[_0x7a56('0x3c')];if(!_0x2402b8[_0x7a56('0x36')][_0x7a56('0x3d')]('nolimit')){_0x5dfa85[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x2402b8['query'][_0x7a56('0x22')]);_0x5dfa85[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x2402b8[_0x7a56('0x36')]['offset']);}return _0x10dced['getAgents'](_0x5dfa85);}})[_0x7a56('0x2a')](function(_0x2431b2){if(_0x2431b2){return _0x2431b2?{'count':_0x5e8c6f,'rows':_0x2431b2}:null;}})['then'](respondWithResult(_0x4544e0,null))['catch'](handleError(_0x4544e0,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5bfc53b..b8ef476 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 _0x15a0=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x26b9f4,_0x42f2a0){var _0x3ea561=function(_0x72b1fe){while(--_0x72b1fe){_0x26b9f4['push'](_0x26b9f4['shift']());}};_0x3ea561(++_0x42f2a0);}(_0x15a0,0x83));var _0x015a=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x15a0[_0x146be0];return _0x1bcc25;};'use strict';var EventEmitter=require(_0x015a('0x0'));var SmsQueue=require(_0x015a('0x1'))['db'][_0x015a('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x015a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x015a('0x4'),'afterDestroy':_0x015a('0x5')};function emitEvent(_0x1b1326){return function(_0x1cc4a8,_0x279fc6,_0xe41182){SmsQueueEvents[_0x015a('0x6')](_0x1b1326+':'+_0x1cc4a8['id'],_0x1cc4a8);SmsQueueEvents['emit'](_0x1b1326,_0x1cc4a8);_0xe41182(null);};}for(var e in events){if(events[_0x015a('0x7')](e)){var event=events[e];SmsQueue[_0x015a('0x8')](e,emitEvent(event));}}module[_0x015a('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x8bc8=['hook','exports','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x8bc8,0x18e));var _0x88bc=function(_0x18a577,_0x25560c){_0x18a577=_0x18a577-0x0;var _0x1cb0c7=_0x8bc8[_0x18a577];return _0x1cb0c7;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x88bc('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x88bc('0x1')](0x0);var events={'afterCreate':_0x88bc('0x2'),'afterUpdate':_0x88bc('0x3'),'afterDestroy':_0x88bc('0x4')};function emitEvent(_0x4d0655){return function(_0x335481,_0x4b29cd,_0x106c4c){SmsQueueEvents[_0x88bc('0x5')](_0x4d0655+':'+_0x335481['id'],_0x335481);SmsQueueEvents[_0x88bc('0x5')](_0x4d0655,_0x335481);_0x106c4c(null);};}for(var e in events){if(events[_0x88bc('0x6')](e)){var event=events[e];SmsQueue[_0x88bc('0x7')](e,emitEvent(event));}}module[_0x88bc('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 65591bd..3848d40 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 _0x61f8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util'];(function(_0x4d91d8,_0x4e4652){var _0x41b11c=function(_0x1aadee){while(--_0x1aadee){_0x4d91d8['push'](_0x4d91d8['shift']());}};_0x41b11c(++_0x4e4652);}(_0x61f8,0xe9));var _0x861f=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x61f8[_0x20cc29];return _0x28d513;};'use strict';var _=require('lodash');var util=require(_0x861f('0x0'));var logger=require(_0x861f('0x1'))(_0x861f('0x2'));var moment=require('moment');var BPromise=require(_0x861f('0x3'));var rp=require(_0x861f('0x4'));var fs=require('fs');var path=require(_0x861f('0x5'));var rimraf=require(_0x861f('0x6'));var config=require(_0x861f('0x7'));var attributes=require(_0x861f('0x8'));module[_0x861f('0x9')]=function(_0x3877f4,_0x1ca54c){return _0x3877f4[_0x861f('0xa')](_0x861f('0xb'),attributes,{'tableName':_0x861f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2af2=['define','SmsQueue','sms_queues','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x75fbc2,_0x5b6f24){var _0x20597b=function(_0x2a0411){while(--_0x2a0411){_0x75fbc2['push'](_0x75fbc2['shift']());}};_0x20597b(++_0x5b6f24);}(_0x2af2,0x19b));var _0x22af=function(_0x1224b9,_0x2da0ad){_0x1224b9=_0x1224b9-0x0;var _0x4273fa=_0x2af2[_0x1224b9];return _0x4273fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22af('0x0'));var config=require(_0x22af('0x1'));var attributes=require(_0x22af('0x2'));module['exports']=function(_0x238d94,_0x517efd){return _0x238d94[_0x22af('0x3')](_0x22af('0x4'),attributes,{'tableName':_0x22af('0x5'),'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 b79f636..5200f1c 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 _0x09c1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','find','ShowSmsQueue','util'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x09c1,0xfb));var _0x109c=function(_0x6f116f,_0x48c8bd){_0x6f116f=_0x6f116f-0x0;var _0x120342=_0x09c1[_0x6f116f];return _0x120342;};'use strict';var _=require('lodash');var util=require(_0x109c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x109c('0x1'));var db=require(_0x109c('0x2'))['db'];var utils=require(_0x109c('0x3'));var logger=require(_0x109c('0x4'))(_0x109c('0x5'));var config=require('../../config/environment');var jayson=require(_0x109c('0x6'));var client=jayson['client'][_0x109c('0x7')]({'port':0x232a});config[_0x109c('0x8')]=_[_0x109c('0x9')](config[_0x109c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x109c('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x109c('0xb')](socket);function respondWithRpcPromise(_0x28658c,_0x5c3cb1,_0x35cbdf){return new BPromise(function(_0x56293e,_0x1d6723){return client['request'](_0x28658c,_0x35cbdf)['then'](function(_0x2d8d39){logger['info'](_0x109c('0xc'),_0x5c3cb1,_0x109c('0xd'));logger[_0x109c('0xe')](_0x109c('0xf'),_0x5c3cb1,_0x109c('0xd'),JSON['stringify'](_0x2d8d39));if(_0x2d8d39['error']){if(_0x2d8d39['error'][_0x109c('0x10')]===0x1f4){logger[_0x109c('0x11')](_0x109c('0xc'),_0x5c3cb1,_0x2d8d39[_0x109c('0x11')][_0x109c('0x12')]);return _0x1d6723(_0x2d8d39[_0x109c('0x11')][_0x109c('0x12')]);}logger[_0x109c('0x11')](_0x109c('0xc'),_0x5c3cb1,_0x2d8d39['error'][_0x109c('0x12')]);return _0x56293e(_0x2d8d39[_0x109c('0x11')][_0x109c('0x12')]);}else{logger[_0x109c('0x13')](_0x109c('0xc'),_0x5c3cb1,_0x109c('0xd'));_0x56293e(_0x2d8d39['result'][_0x109c('0x12')]);}})[_0x109c('0x14')](function(_0x5b3e94){logger[_0x109c('0x11')](_0x109c('0xc'),_0x5c3cb1,_0x5b3e94);_0x1d6723(_0x5b3e94);});});}exports[_0x109c('0x15')]=function(_0x2319c5){var _0x4f27e9=this;return new Promise(function(_0x4d9beb,_0x2f82e9){return db[_0x109c('0x16')][_0x109c('0x17')]({'raw':_0x2319c5['options']?_0x2319c5[_0x109c('0x18')][_0x109c('0x19')]===undefined?!![]:![]:!![],'where':_0x2319c5[_0x109c('0x18')]?_0x2319c5[_0x109c('0x18')][_0x109c('0x1a')]||null:null,'attributes':_0x2319c5[_0x109c('0x18')]?_0x2319c5['options']['attributes']||null:null,'limit':_0x2319c5[_0x109c('0x18')]?_0x2319c5[_0x109c('0x18')][_0x109c('0x1b')]||null:null,'include':_0x2319c5[_0x109c('0x18')]?_0x2319c5[_0x109c('0x18')][_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x2319c5[_0x109c('0x18')]['include'],function(_0x161698){return{'model':db[_0x161698[_0x109c('0x1e')]],'as':_0x161698['as'],'attributes':_0x161698[_0x109c('0x1f')],'include':_0x161698[_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x161698['include'],function(_0x51e10c){return{'model':db[_0x51e10c[_0x109c('0x1e')]],'as':_0x51e10c['as'],'attributes':_0x51e10c['attributes'],'include':_0x51e10c[_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x51e10c[_0x109c('0x1c')],function(_0x561808){return{'model':db[_0x561808[_0x109c('0x1e')]],'as':_0x561808['as'],'attributes':_0x561808[_0x109c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x109c('0x20')](function(_0x2ba38d){logger['info'](_0x109c('0x15'),_0x2319c5);logger[_0x109c('0xe')](_0x109c('0x15'),_0x2319c5,JSON[_0x109c('0x21')](_0x2ba38d));_0x4d9beb(_0x2ba38d);})[_0x109c('0x14')](function(_0x1392b9){logger[_0x109c('0x11')](_0x109c('0x15'),_0x1392b9['message'],_0x2319c5);_0x2f82e9(_0x4f27e9[_0x109c('0x11')](0x1f4,_0x1392b9[_0x109c('0x12')]));});});};exports['ShowSmsQueue']=function(_0x2d0a22){var _0x1f98b4=this;return new Promise(function(_0x4fcfbd,_0x50a141){return db['SmsQueue'][_0x109c('0x22')]({'raw':_0x2d0a22[_0x109c('0x18')]?_0x2d0a22[_0x109c('0x18')][_0x109c('0x19')]===undefined?!![]:![]:!![],'where':_0x2d0a22[_0x109c('0x18')]?_0x2d0a22[_0x109c('0x18')][_0x109c('0x1a')]||null:null,'attributes':_0x2d0a22[_0x109c('0x18')]?_0x2d0a22['options'][_0x109c('0x1f')]||null:null,'include':_0x2d0a22['options']?_0x2d0a22[_0x109c('0x18')][_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x2d0a22[_0x109c('0x18')][_0x109c('0x1c')],function(_0x545299){return{'model':db[_0x545299[_0x109c('0x1e')]],'as':_0x545299['as'],'attributes':_0x545299['attributes'],'include':_0x545299[_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x545299[_0x109c('0x1c')],function(_0x4a4d19){return{'model':db[_0x4a4d19[_0x109c('0x1e')]],'as':_0x4a4d19['as'],'attributes':_0x4a4d19[_0x109c('0x1f')],'include':_0x4a4d19[_0x109c('0x1c')]?_[_0x109c('0x1d')](_0x4a4d19[_0x109c('0x1c')],function(_0xbfba70){return{'model':db[_0xbfba70[_0x109c('0x1e')]],'as':_0xbfba70['as'],'attributes':_0xbfba70[_0x109c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x109c('0x20')](function(_0xd53158){logger[_0x109c('0x13')](_0x109c('0x23'),_0x2d0a22);logger[_0x109c('0xe')]('ShowSmsQueue',_0x2d0a22,JSON[_0x109c('0x21')](_0xd53158));_0x4fcfbd(_0xd53158);})[_0x109c('0x14')](function(_0x53a2dc){logger[_0x109c('0x11')](_0x109c('0x23'),_0x53a2dc['message'],_0x2d0a22);_0x50a141(_0x1f98b4[_0x109c('0x11')](0x1f4,_0x53a2dc[_0x109c('0x12')]));});});}; \ No newline at end of file +var _0x42c7=['result','catch','findAll','options','raw','limit','include','map','model','attributes','GetSmsQueue','SmsQueue','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x42c7,0x12d));var _0x742c=function(_0x2f125d,_0x4f2dd3){_0x2f125d=_0x2f125d-0x0;var _0x4e91cf=_0x42c7[_0x2f125d];return _0x4e91cf;};'use strict';var _=require(_0x742c('0x0'));var util=require(_0x742c('0x1'));var moment=require(_0x742c('0x2'));var BPromise=require(_0x742c('0x3'));var rs=require(_0x742c('0x4'));var fs=require('fs');var Redis=require(_0x742c('0x5'));var db=require(_0x742c('0x6'))['db'];var utils=require(_0x742c('0x7'));var logger=require(_0x742c('0x8'))(_0x742c('0x9'));var config=require(_0x742c('0xa'));var jayson=require(_0x742c('0xb'));var client=jayson[_0x742c('0xc')][_0x742c('0xd')]({'port':0x232a});config[_0x742c('0xe')]=_['defaults'](config[_0x742c('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x742c('0xf'))(new Redis(config[_0x742c('0xe')]));require(_0x742c('0x10'))['register'](socket);function respondWithRpcPromise(_0x18a43a,_0x34c936,_0x58f49c){return new BPromise(function(_0x1f1d90,_0x2c601c){return client[_0x742c('0x11')](_0x18a43a,_0x58f49c)[_0x742c('0x12')](function(_0x35fff6){logger[_0x742c('0x13')](_0x742c('0x14'),_0x34c936,_0x742c('0x15'));logger[_0x742c('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x34c936,_0x742c('0x15'),JSON[_0x742c('0x17')](_0x35fff6));if(_0x35fff6[_0x742c('0x18')]){if(_0x35fff6['error'][_0x742c('0x19')]===0x1f4){logger[_0x742c('0x18')](_0x742c('0x14'),_0x34c936,_0x35fff6[_0x742c('0x18')]['message']);return _0x2c601c(_0x35fff6[_0x742c('0x18')][_0x742c('0x1a')]);}logger[_0x742c('0x18')]('SmsQueue,\x20%s,\x20%s',_0x34c936,_0x35fff6['error']['message']);return _0x1f1d90(_0x35fff6[_0x742c('0x18')][_0x742c('0x1a')]);}else{logger[_0x742c('0x13')](_0x742c('0x14'),_0x34c936,_0x742c('0x15'));_0x1f1d90(_0x35fff6[_0x742c('0x1b')][_0x742c('0x1a')]);}})[_0x742c('0x1c')](function(_0x1851ce){logger['error'](_0x742c('0x14'),_0x34c936,_0x1851ce);_0x2c601c(_0x1851ce);});});}exports['GetSmsQueue']=function(_0xca85cd){var _0x1a9156=this;return new Promise(function(_0x136dfd,_0x207a97){return db['SmsQueue'][_0x742c('0x1d')]({'raw':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')][_0x742c('0x1f')]===undefined?!![]:![]:!![],'where':_0xca85cd['options']?_0xca85cd[_0x742c('0x1e')]['where']||null:null,'attributes':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')]['attributes']||null:null,'limit':_0xca85cd['options']?_0xca85cd[_0x742c('0x1e')][_0x742c('0x20')]||null:null,'include':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')][_0x742c('0x21')]?_[_0x742c('0x22')](_0xca85cd[_0x742c('0x1e')][_0x742c('0x21')],function(_0x163a3f){return{'model':db[_0x163a3f[_0x742c('0x23')]],'as':_0x163a3f['as'],'attributes':_0x163a3f['attributes'],'include':_0x163a3f[_0x742c('0x21')]?_['map'](_0x163a3f[_0x742c('0x21')],function(_0x54ad46){return{'model':db[_0x54ad46[_0x742c('0x23')]],'as':_0x54ad46['as'],'attributes':_0x54ad46[_0x742c('0x24')],'include':_0x54ad46['include']?_[_0x742c('0x22')](_0x54ad46[_0x742c('0x21')],function(_0x35f81e){return{'model':db[_0x35f81e[_0x742c('0x23')]],'as':_0x35f81e['as'],'attributes':_0x35f81e[_0x742c('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cb6b6){logger[_0x742c('0x13')](_0x742c('0x25'),_0xca85cd);logger[_0x742c('0x16')](_0x742c('0x25'),_0xca85cd,JSON[_0x742c('0x17')](_0x1cb6b6));_0x136dfd(_0x1cb6b6);})[_0x742c('0x1c')](function(_0x208de4){logger[_0x742c('0x18')](_0x742c('0x25'),_0x208de4[_0x742c('0x1a')],_0xca85cd);_0x207a97(_0x1a9156['error'](0x1f4,_0x208de4['message']));});});};exports['ShowSmsQueue']=function(_0x3a9b91){var _0x3b373b=this;return new Promise(function(_0x479bd0,_0x2f76f6){return db[_0x742c('0x26')]['find']({'raw':_0x3a9b91['options']?_0x3a9b91[_0x742c('0x1e')][_0x742c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91['options'][_0x742c('0x27')]||null:null,'attributes':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91[_0x742c('0x1e')]['attributes']||null:null,'include':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91['options']['include']?_[_0x742c('0x22')](_0x3a9b91[_0x742c('0x1e')][_0x742c('0x21')],function(_0x3aa729){return{'model':db[_0x3aa729[_0x742c('0x23')]],'as':_0x3aa729['as'],'attributes':_0x3aa729['attributes'],'include':_0x3aa729[_0x742c('0x21')]?_['map'](_0x3aa729['include'],function(_0x222ec0){return{'model':db[_0x222ec0[_0x742c('0x23')]],'as':_0x222ec0['as'],'attributes':_0x222ec0[_0x742c('0x24')],'include':_0x222ec0[_0x742c('0x21')]?_[_0x742c('0x22')](_0x222ec0[_0x742c('0x21')],function(_0x9d508c){return{'model':db[_0x9d508c[_0x742c('0x23')]],'as':_0x9d508c['as'],'attributes':_0x9d508c[_0x742c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x742c('0x12')](function(_0x5f44f4){logger[_0x742c('0x13')](_0x742c('0x28'),_0x3a9b91);logger[_0x742c('0x16')](_0x742c('0x28'),_0x3a9b91,JSON[_0x742c('0x17')](_0x5f44f4));_0x479bd0(_0x5f44f4);})[_0x742c('0x1c')](function(_0x5248b6){logger[_0x742c('0x18')](_0x742c('0x28'),_0x5248b6[_0x742c('0x1a')],_0x3a9b91);_0x2f76f6(_0x3b373b[_0x742c('0x18')](0x1f4,_0x5248b6[_0x742c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1f5e3bf..08a3cb4 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 _0xb974=['register','length','smsQueue:','save','update','emit','removeListener'];(function(_0x5bac06,_0x4d6e3e){var _0x42caf9=function(_0x2b0cec){while(--_0x2b0cec){_0x5bac06['push'](_0x5bac06['shift']());}};_0x42caf9(++_0x4d6e3e);}(_0xb974,0x96));var _0x4b97=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb974[_0x5b644e];return _0x49c6bf;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x4b97('0x0'),'remove',_0x4b97('0x1')];function createListener(_0x2e2f63,_0x31eb1d){return function(_0xa69e31){_0x31eb1d[_0x4b97('0x2')](_0x2e2f63,_0xa69e31);};}function removeListener(_0x248dd1,_0x439bb3){return function(){SmsQueueEvents[_0x4b97('0x3')](_0x248dd1,_0x439bb3);};}exports[_0x4b97('0x4')]=function(_0x55b864){for(var _0x32d943=0x0,_0xf8c339=events[_0x4b97('0x5')];_0x32d943<_0xf8c339;_0x32d943++){var _0x5947f2=events[_0x32d943];var _0x277cb2=createListener(_0x4b97('0x6')+_0x5947f2,_0x55b864);SmsQueueEvents['on'](_0x5947f2,_0x277cb2);}}; \ No newline at end of file +var _0x68bb=['save','emit','register','smsQueue:','./smsQueue.events'];(function(_0x1c6923,_0x336a65){var _0x3b674a=function(_0x2555ab){while(--_0x2555ab){_0x1c6923['push'](_0x1c6923['shift']());}};_0x3b674a(++_0x336a65);}(_0x68bb,0xa4));var _0xb68b=function(_0x30089c,_0x2e4737){_0x30089c=_0x30089c-0x0;var _0x4293de=_0x68bb[_0x30089c];return _0x4293de;};'use strict';var SmsQueueEvents=require(_0xb68b('0x0'));var events=[_0xb68b('0x1'),'remove','update'];function createListener(_0x3fb438,_0x3ca9a9){return function(_0x34121c){_0x3ca9a9[_0xb68b('0x2')](_0x3fb438,_0x34121c);};}function removeListener(_0x15e96f,_0x6bc514){return function(){SmsQueueEvents['removeListener'](_0x15e96f,_0x6bc514);};}exports[_0xb68b('0x3')]=function(_0x19b447){for(var _0x59c136=0x0,_0x5a0a9f=events['length'];_0x59c136<_0x5a0a9f;_0x59c136++){var _0x4fd75c=events[_0x59c136];var _0x35b08e=createListener(_0xb68b('0x4')+_0x4fd75c,_0x19b447);SmsQueueEvents['on'](_0x4fd75c,_0x35b08e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 0fd5256..a52e0cf 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 _0x6f3a=['fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','util','path','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f3a,0xe7));var _0xa6f3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6f3a[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xa6f3('0x0'));var path=require(_0xa6f3('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6f3('0x2'));var router=express['Router']();var fs_extra=require(_0xa6f3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa6f3('0x4'));var config=require(_0xa6f3('0x5'));var controller=require(_0xa6f3('0x6'));router[_0xa6f3('0x7')]('/',auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x9')]);router['get'](_0xa6f3('0xa'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa6f3('0xc')]);router['post']('/',auth[_0xa6f3('0x8')](),controller[_0xa6f3('0xd')]);router[_0xa6f3('0xe')](_0xa6f3('0xf'),auth[_0xa6f3('0x8')](),controller['update']);router[_0xa6f3('0x10')](_0xa6f3('0xf'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdf48=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','/describe','get','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x5d9fd7,_0x289326){var _0x233ee8=function(_0x349117){while(--_0x349117){_0x5d9fd7['push'](_0x5d9fd7['shift']());}};_0x233ee8(++_0x289326);}(_0xdf48,0x113));var _0x8df4=function(_0x49530f,_0x58104c){_0x49530f=_0x49530f-0x0;var _0x4875d4=_0xdf48[_0x49530f];return _0x4875d4;};'use strict';var multer=require('multer');var util=require(_0x8df4('0x0'));var path=require('path');var timeout=require(_0x8df4('0x1'));var express=require(_0x8df4('0x2'));var router=express[_0x8df4('0x3')]();var fs_extra=require(_0x8df4('0x4'));var auth=require(_0x8df4('0x5'));var interaction=require(_0x8df4('0x6'));var config=require(_0x8df4('0x7'));var controller=require(_0x8df4('0x8'));router['get']('/',auth[_0x8df4('0x9')](),controller['index']);router['get'](_0x8df4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8df4('0xb')](_0x8df4('0xc'),auth[_0x8df4('0x9')](),controller[_0x8df4('0xd')]);router[_0x8df4('0xe')]('/',auth[_0x8df4('0x9')](),controller[_0x8df4('0xf')]);router[_0x8df4('0x10')]('/:id',auth[_0x8df4('0x9')](),controller[_0x8df4('0x11')]);router['delete']('/:id',auth[_0x8df4('0x9')](),controller[_0x8df4('0x12')]);module[_0x8df4('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 80881a3..2add905 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 _0xc61d=['STRING','DATE','exports'];(function(_0x581661,_0x4daefb){var _0x4f7cca=function(_0x2f3a8a){while(--_0x2f3a8a){_0x581661['push'](_0x581661['shift']());}};_0x4f7cca(++_0x4daefb);}(_0xc61d,0x19a));var _0xdc61=function(_0x10a96a,_0x2e8bda){_0x10a96a=_0x10a96a-0x0;var _0xf50a21=_0xc61d[_0x10a96a];return _0xf50a21;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdc61('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdc61('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdc61('0x2')]},'acceptAt':{'type':Sequelize[_0xdc61('0x2')]},'exitAt':{'type':Sequelize[_0xdc61('0x2')]},'reason':{'type':Sequelize[_0xdc61('0x1')]}}; \ No newline at end of file +var _0xa368=['DATE','moment','exports'];(function(_0x29a1bb,_0x52859d){var _0x19f85e=function(_0x1b1000){while(--_0x1b1000){_0x29a1bb['push'](_0x29a1bb['shift']());}};_0x19f85e(++_0x52859d);}(_0xa368,0xd3));var _0x8a36=function(_0x221dcb,_0x147a94){_0x221dcb=_0x221dcb-0x0;var _0x411598=_0xa368[_0x221dcb];return _0x411598;};'use strict';var moment=require(_0x8a36('0x0'));var Sequelize=require('sequelize');module[_0x8a36('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8a36('0x2')]},'acceptAt':{'type':Sequelize[_0x8a36('0x2')]},'exitAt':{'type':Sequelize[_0x8a36('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e5cbf36..bfffc17 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 _0x522c=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','include','create','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x41b62a,_0x13d23e){var _0x429f38=function(_0x1d9198){while(--_0x1d9198){_0x41b62a['push'](_0x41b62a['shift']());}};_0x429f38(++_0x13d23e);}(_0x522c,0xc1));var _0xc522=function(_0x11fc42,_0x93f9c0){_0x11fc42=_0x11fc42-0x0;var _0x3decde=_0x522c[_0x11fc42];return _0x3decde;};'use strict';var emlformat=require(_0xc522('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc522('0x1'));var jsonpatch=require(_0xc522('0x2'));var rp=require(_0xc522('0x3'));var moment=require(_0xc522('0x4'));var BPromise=require(_0xc522('0x5'));var Mustache=require(_0xc522('0x6'));var util=require('util');var path=require(_0xc522('0x7'));var sox=require(_0xc522('0x8'));var csv=require('to-csv');var ejs=require(_0xc522('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc522('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc522('0xb'));var querystring=require(_0xc522('0xc'));var Papa=require(_0xc522('0xd'));var Redis=require(_0xc522('0xe'));var authService=require(_0xc522('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc522('0x10'));var hardwareService=require(_0xc522('0x11'));var logger=require(_0xc522('0x12'))(_0xc522('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc522('0x14'));var db=require(_0xc522('0x15'))['db'];function respondWithStatusCode(_0x8dbfbf,_0x1620d1){_0x1620d1=_0x1620d1||0xcc;return function(_0x58a0c1){if(_0x58a0c1){return _0x8dbfbf[_0xc522('0x16')](_0x1620d1);}return _0x8dbfbf[_0xc522('0x17')](_0x1620d1)[_0xc522('0x18')]();};}function respondWithResult(_0xb8eb07,_0x2566b7){_0x2566b7=_0x2566b7||0xc8;return function(_0x2a297d){if(_0x2a297d){return _0xb8eb07['status'](_0x2566b7)['json'](_0x2a297d);}};}function respondWithFilteredResult(_0x3b8a61,_0x498c42){return function(_0x420e06){if(_0x420e06){var _0x3c9283=typeof _0x498c42[_0xc522('0x19')]===_0xc522('0x1a')&&typeof _0x498c42[_0xc522('0x1b')]===_0xc522('0x1a');var _0x33c884=_0x420e06[_0xc522('0x1c')];var _0x447d7c=_0x3c9283?0x0:_0x498c42[_0xc522('0x19')];var _0xe01d68=_0x3c9283?_0x420e06[_0xc522('0x1c')]:_0x498c42[_0xc522('0x19')]+_0x498c42[_0xc522('0x1b')];var _0x2fd5ca;if(_0xe01d68>=_0x33c884){_0xe01d68=_0x33c884;_0x2fd5ca=0xc8;}else{_0x2fd5ca=0xce;}_0x3b8a61[_0xc522('0x17')](_0x2fd5ca);return _0x3b8a61['set'](_0xc522('0x1d'),_0x447d7c+'-'+_0xe01d68+'/'+_0x33c884)[_0xc522('0x1e')](_0x420e06);}return null;};}function patchUpdates(_0x157774){return function(_0x4a4124){try{jsonpatch[_0xc522('0x1f')](_0x4a4124,_0x157774,!![]);}catch(_0x563bcc){return BPromise[_0xc522('0x20')](_0x563bcc);}return _0x4a4124['save']();};}function saveUpdates(_0x6eb0c6,_0x675a6c){return function(_0x3cf215){if(_0x3cf215){return _0x3cf215[_0xc522('0x21')](_0x6eb0c6)[_0xc522('0x22')](function(_0x30e2ed){return _0x30e2ed;});}return null;};}function removeEntity(_0x256830,_0x500954){return function(_0x4b2304){if(_0x4b2304){return _0x4b2304[_0xc522('0x23')]()[_0xc522('0x22')](function(){_0x256830['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db500,_0x59f786){return function(_0x4afe48){if(!_0x4afe48){_0x2db500['sendStatus'](0x194);}return _0x4afe48;};}function handleError(_0x5d88d7,_0x50768f){_0x50768f=_0x50768f||0x1f4;return function(_0x1d0776){logger[_0xc522('0x24')](_0x1d0776[_0xc522('0x25')]);if(_0x1d0776['name']){delete _0x1d0776[_0xc522('0x26')];}_0x5d88d7[_0xc522('0x17')](_0x50768f)['send'](_0x1d0776);};}exports[_0xc522('0x27')]=function(_0x4d97d2,_0x3bf113){var _0x29924d={},_0xfe0e4e={},_0x5efd7b={'count':0x0,'rows':[]};var _0x21aec1=_['map'](db[_0xc522('0x28')][_0xc522('0x29')],function(_0x2f958c){return{'name':_0x2f958c[_0xc522('0x2a')],'type':_0x2f958c[_0xc522('0x2b')][_0xc522('0x2c')]};});_0xfe0e4e[_0xc522('0x2d')]=_[_0xc522('0x2e')](_0x21aec1,_0xc522('0x26'));_0xfe0e4e[_0xc522('0x2f')]=_[_0xc522('0x30')](_0x4d97d2['query']);_0xfe0e4e[_0xc522('0x31')]=_[_0xc522('0x32')](_0xfe0e4e[_0xc522('0x2d')],_0xfe0e4e[_0xc522('0x2f')]);_0x29924d[_0xc522('0x33')]=_[_0xc522('0x32')](_0xfe0e4e[_0xc522('0x2d')],qs[_0xc522('0x34')](_0x4d97d2['query'][_0xc522('0x34')]));_0x29924d[_0xc522('0x33')]=_0x29924d[_0xc522('0x33')][_0xc522('0x35')]?_0x29924d[_0xc522('0x33')]:_0xfe0e4e[_0xc522('0x2d')];if(!_0x4d97d2[_0xc522('0x2f')][_0xc522('0x36')](_0xc522('0x37'))){_0x29924d[_0xc522('0x1b')]=qs['limit'](_0x4d97d2[_0xc522('0x2f')][_0xc522('0x1b')]);_0x29924d[_0xc522('0x19')]=qs[_0xc522('0x19')](_0x4d97d2[_0xc522('0x2f')][_0xc522('0x19')]);}_0x29924d['order']=qs[_0xc522('0x38')](_0x4d97d2[_0xc522('0x2f')][_0xc522('0x38')]);_0x29924d['where']=qs[_0xc522('0x31')](_[_0xc522('0x39')](_0x4d97d2[_0xc522('0x2f')],_0xfe0e4e[_0xc522('0x31')]),_0x21aec1);if(_0x4d97d2[_0xc522('0x2f')][_0xc522('0x3a')]){_0x29924d[_0xc522('0x3b')]=_[_0xc522('0x3c')](_0x29924d['where'],{'$or':_[_0xc522('0x2e')](_0x21aec1,function(_0x5e73db){if(_0x5e73db[_0xc522('0x2b')]!=='VIRTUAL'){var _0x5b78d9={};_0x5b78d9[_0x5e73db[_0xc522('0x26')]]={'$like':'%'+_0x4d97d2[_0xc522('0x2f')][_0xc522('0x3a')]+'%'};return _0x5b78d9;}})});}_0x29924d=_[_0xc522('0x3c')]({},_0x29924d,_0x4d97d2[_0xc522('0x3d')]);var _0x208a47={'where':_0x29924d[_0xc522('0x3b')]};return db[_0xc522('0x28')][_0xc522('0x1c')](_0x208a47)[_0xc522('0x22')](function(_0x2ea701){_0x5efd7b[_0xc522('0x1c')]=_0x2ea701;if(_0x4d97d2[_0xc522('0x2f')][_0xc522('0x3e')]){_0x29924d['include']=[{'all':!![]}];}return db[_0xc522('0x28')]['findAll'](_0x29924d);})[_0xc522('0x22')](function(_0x4785d7){_0x5efd7b[_0xc522('0x3f')]=_0x4785d7;return _0x5efd7b;})[_0xc522('0x22')](respondWithFilteredResult(_0x3bf113,_0x29924d))[_0xc522('0x40')](handleError(_0x3bf113,null));};exports[_0xc522('0x41')]=function(_0xc52cfc,_0xa5fd2c){var _0x49ced3={'raw':!![],'where':{'id':_0xc52cfc[_0xc522('0x42')]['id']}},_0x5c0d55={};_0x5c0d55[_0xc522('0x2d')]=_[_0xc522('0x30')](db[_0xc522('0x28')][_0xc522('0x29')]);_0x5c0d55[_0xc522('0x2f')]=_[_0xc522('0x30')](_0xc52cfc[_0xc522('0x2f')]);_0x5c0d55[_0xc522('0x31')]=_['intersection'](_0x5c0d55[_0xc522('0x2d')],_0x5c0d55['query']);_0x49ced3[_0xc522('0x33')]=_[_0xc522('0x32')](_0x5c0d55[_0xc522('0x2d')],qs[_0xc522('0x34')](_0xc52cfc[_0xc522('0x2f')]['fields']));_0x49ced3[_0xc522('0x33')]=_0x49ced3[_0xc522('0x33')]['length']?_0x49ced3[_0xc522('0x33')]:_0x5c0d55[_0xc522('0x2d')];if(_0xc52cfc[_0xc522('0x2f')][_0xc522('0x3e')]){_0x49ced3[_0xc522('0x43')]=[{'all':!![]}];}_0x49ced3=_['merge']({},_0x49ced3,_0xc52cfc['options']);return db['SmsQueueReport']['find'](_0x49ced3)[_0xc522('0x22')](handleEntityNotFound(_0xa5fd2c,null))[_0xc522('0x22')](respondWithResult(_0xa5fd2c,null))['catch'](handleError(_0xa5fd2c,null));};exports[_0xc522('0x44')]=function(_0x4eed2c,_0x394d22){return db[_0xc522('0x28')][_0xc522('0x44')](_0x4eed2c['body'],{})[_0xc522('0x22')](respondWithResult(_0x394d22,0xc9))['catch'](handleError(_0x394d22,null));};exports[_0xc522('0x21')]=function(_0x13acf6,_0x4741f9){if(_0x13acf6['body']['id']){delete _0x13acf6['body']['id'];}return db[_0xc522('0x28')]['find']({'where':{'id':_0x13acf6[_0xc522('0x42')]['id']}})['then'](handleEntityNotFound(_0x4741f9,null))[_0xc522('0x22')](saveUpdates(_0x13acf6['body'],null))[_0xc522('0x22')](respondWithResult(_0x4741f9,null))[_0xc522('0x40')](handleError(_0x4741f9,null));};exports[_0xc522('0x23')]=function(_0x4086a8,_0x285eb1){return db[_0xc522('0x28')][_0xc522('0x45')]({'where':{'id':_0x4086a8[_0xc522('0x42')]['id']}})[_0xc522('0x22')](handleEntityNotFound(_0x285eb1,null))[_0xc522('0x22')](removeEntity(_0x285eb1,null))[_0xc522('0x40')](handleError(_0x285eb1,null));};exports[_0xc522('0x46')]=function(_0x28c7e2,_0xf6ff88){return db[_0xc522('0x28')]['describe']()[_0xc522('0x22')](respondWithResult(_0xf6ff88,null))[_0xc522('0x40')](handleError(_0xf6ff88,null));}; \ No newline at end of file +var _0x4944=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','stack','name','send','index','SmsQueueReport','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d394b,_0xcd5fbf){var _0x3ae625=function(_0x39fbd6){while(--_0x39fbd6){_0x5d394b['push'](_0x5d394b['shift']());}};_0x3ae625(++_0xcd5fbf);}(_0x4944,0x1e7));var _0x4494=function(_0x5698ef,_0x3d15fd){_0x5698ef=_0x5698ef-0x0;var _0x250ba3=_0x4944[_0x5698ef];return _0x250ba3;};'use strict';var emlformat=require(_0x4494('0x0'));var rimraf=require(_0x4494('0x1'));var zipdir=require(_0x4494('0x2'));var jsonpatch=require(_0x4494('0x3'));var rp=require(_0x4494('0x4'));var moment=require(_0x4494('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4494('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4494('0x7'));var fs=require('fs');var fs_extra=require(_0x4494('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4494('0x9'));var deskjs=require(_0x4494('0xa'));var toCsv=require(_0x4494('0xb'));var querystring=require(_0x4494('0xc'));var Papa=require(_0x4494('0xd'));var Redis=require(_0x4494('0xe'));var authService=require(_0x4494('0xf'));var qs=require(_0x4494('0x10'));var as=require(_0x4494('0x11'));var hardwareService=require(_0x4494('0x12'));var logger=require('../../config/logger')(_0x4494('0x13'));var utils=require(_0x4494('0x14'));var config=require(_0x4494('0x15'));var licenseUtil=require(_0x4494('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a472c,_0x183945){_0x183945=_0x183945||0xcc;return function(_0x245340){if(_0x245340){return _0x4a472c['sendStatus'](_0x183945);}return _0x4a472c[_0x4494('0x17')](_0x183945)['end']();};}function respondWithResult(_0x388cae,_0x594e11){_0x594e11=_0x594e11||0xc8;return function(_0xa2fa9){if(_0xa2fa9){return _0x388cae[_0x4494('0x17')](_0x594e11)[_0x4494('0x18')](_0xa2fa9);}};}function respondWithFilteredResult(_0x36a91d,_0x470b33){return function(_0x1d8a53){if(_0x1d8a53){var _0x49c39d=typeof _0x470b33[_0x4494('0x19')]==='undefined'&&typeof _0x470b33[_0x4494('0x1a')]===_0x4494('0x1b');var _0x4c1474=_0x1d8a53[_0x4494('0x1c')];var _0xa762f8=_0x49c39d?0x0:_0x470b33[_0x4494('0x19')];var _0x4ef393=_0x49c39d?_0x1d8a53[_0x4494('0x1c')]:_0x470b33[_0x4494('0x19')]+_0x470b33[_0x4494('0x1a')];var _0x538e8e;if(_0x4ef393>=_0x4c1474){_0x4ef393=_0x4c1474;_0x538e8e=0xc8;}else{_0x538e8e=0xce;}_0x36a91d[_0x4494('0x17')](_0x538e8e);return _0x36a91d[_0x4494('0x1d')](_0x4494('0x1e'),_0xa762f8+'-'+_0x4ef393+'/'+_0x4c1474)[_0x4494('0x18')](_0x1d8a53);}return null;};}function patchUpdates(_0x50a6d7){return function(_0x4acdfe){try{jsonpatch[_0x4494('0x1f')](_0x4acdfe,_0x50a6d7,!![]);}catch(_0x26047e){return BPromise['reject'](_0x26047e);}return _0x4acdfe[_0x4494('0x20')]();};}function saveUpdates(_0x1a5c94,_0x38aaee){return function(_0x207f37){if(_0x207f37){return _0x207f37[_0x4494('0x21')](_0x1a5c94)[_0x4494('0x22')](function(_0x411d02){return _0x411d02;});}return null;};}function removeEntity(_0x38c258,_0x1452ac){return function(_0x46ba7d){if(_0x46ba7d){return _0x46ba7d['destroy']()[_0x4494('0x22')](function(){_0x38c258['status'](0xcc)[_0x4494('0x23')]();});}};}function handleEntityNotFound(_0x2d3631,_0x25b867){return function(_0x3b00de){if(!_0x3b00de){_0x2d3631[_0x4494('0x24')](0x194);}return _0x3b00de;};}function handleError(_0x4aac6b,_0x4cb5ea){_0x4cb5ea=_0x4cb5ea||0x1f4;return function(_0x3d185a){logger[_0x4494('0x25')](_0x3d185a[_0x4494('0x26')]);if(_0x3d185a[_0x4494('0x27')]){delete _0x3d185a[_0x4494('0x27')];}_0x4aac6b[_0x4494('0x17')](_0x4cb5ea)[_0x4494('0x28')](_0x3d185a);};}exports[_0x4494('0x29')]=function(_0x19df84,_0x161769){var _0x4d6ffa={},_0x58809b={},_0x764fcf={'count':0x0,'rows':[]};var _0x3e3f40=_['map'](db[_0x4494('0x2a')][_0x4494('0x2b')],function(_0x294336){return{'name':_0x294336['fieldName'],'type':_0x294336[_0x4494('0x2c')]['key']};});_0x58809b[_0x4494('0x2d')]=_[_0x4494('0x2e')](_0x3e3f40,_0x4494('0x27'));_0x58809b[_0x4494('0x2f')]=_[_0x4494('0x30')](_0x19df84[_0x4494('0x2f')]);_0x58809b[_0x4494('0x31')]=_[_0x4494('0x32')](_0x58809b[_0x4494('0x2d')],_0x58809b[_0x4494('0x2f')]);_0x4d6ffa['attributes']=_[_0x4494('0x32')](_0x58809b[_0x4494('0x2d')],qs[_0x4494('0x33')](_0x19df84[_0x4494('0x2f')][_0x4494('0x33')]));_0x4d6ffa[_0x4494('0x34')]=_0x4d6ffa[_0x4494('0x34')][_0x4494('0x35')]?_0x4d6ffa[_0x4494('0x34')]:_0x58809b[_0x4494('0x2d')];if(!_0x19df84[_0x4494('0x2f')]['hasOwnProperty'](_0x4494('0x36'))){_0x4d6ffa[_0x4494('0x1a')]=qs[_0x4494('0x1a')](_0x19df84['query'][_0x4494('0x1a')]);_0x4d6ffa[_0x4494('0x19')]=qs[_0x4494('0x19')](_0x19df84['query'][_0x4494('0x19')]);}_0x4d6ffa[_0x4494('0x37')]=qs[_0x4494('0x38')](_0x19df84[_0x4494('0x2f')]['sort']);_0x4d6ffa[_0x4494('0x39')]=qs[_0x4494('0x31')](_['pick'](_0x19df84[_0x4494('0x2f')],_0x58809b[_0x4494('0x31')]),_0x3e3f40);if(_0x19df84['query']['filter']){_0x4d6ffa[_0x4494('0x39')]=_['merge'](_0x4d6ffa['where'],{'$or':_['map'](_0x3e3f40,function(_0x7d64fc){if(_0x7d64fc[_0x4494('0x2c')]!==_0x4494('0x3a')){var _0xf30151={};_0xf30151[_0x7d64fc[_0x4494('0x27')]]={'$like':'%'+_0x19df84[_0x4494('0x2f')][_0x4494('0x3b')]+'%'};return _0xf30151;}})});}_0x4d6ffa=_[_0x4494('0x3c')]({},_0x4d6ffa,_0x19df84['options']);var _0x11c94f={'where':_0x4d6ffa[_0x4494('0x39')]};return db['SmsQueueReport'][_0x4494('0x1c')](_0x11c94f)[_0x4494('0x22')](function(_0x2997b5){_0x764fcf['count']=_0x2997b5;if(_0x19df84[_0x4494('0x2f')][_0x4494('0x3d')]){_0x4d6ffa[_0x4494('0x3e')]=[{'all':!![]}];}return db[_0x4494('0x2a')][_0x4494('0x3f')](_0x4d6ffa);})[_0x4494('0x22')](function(_0x37ccbb){_0x764fcf[_0x4494('0x40')]=_0x37ccbb;return _0x764fcf;})[_0x4494('0x22')](respondWithFilteredResult(_0x161769,_0x4d6ffa))['catch'](handleError(_0x161769,null));};exports['show']=function(_0x7df4b2,_0x2ad2da){var _0x2321a7={'raw':!![],'where':{'id':_0x7df4b2[_0x4494('0x41')]['id']}},_0x448915={};_0x448915['model']=_[_0x4494('0x30')](db[_0x4494('0x2a')][_0x4494('0x2b')]);_0x448915[_0x4494('0x2f')]=_[_0x4494('0x30')](_0x7df4b2[_0x4494('0x2f')]);_0x448915[_0x4494('0x31')]=_[_0x4494('0x32')](_0x448915[_0x4494('0x2d')],_0x448915[_0x4494('0x2f')]);_0x2321a7[_0x4494('0x34')]=_['intersection'](_0x448915[_0x4494('0x2d')],qs[_0x4494('0x33')](_0x7df4b2[_0x4494('0x2f')][_0x4494('0x33')]));_0x2321a7[_0x4494('0x34')]=_0x2321a7[_0x4494('0x34')][_0x4494('0x35')]?_0x2321a7[_0x4494('0x34')]:_0x448915[_0x4494('0x2d')];if(_0x7df4b2[_0x4494('0x2f')][_0x4494('0x3d')]){_0x2321a7[_0x4494('0x3e')]=[{'all':!![]}];}_0x2321a7=_[_0x4494('0x3c')]({},_0x2321a7,_0x7df4b2[_0x4494('0x42')]);return db[_0x4494('0x2a')][_0x4494('0x43')](_0x2321a7)['then'](handleEntityNotFound(_0x2ad2da,null))[_0x4494('0x22')](respondWithResult(_0x2ad2da,null))[_0x4494('0x44')](handleError(_0x2ad2da,null));};exports['create']=function(_0x57cd42,_0x4f8902){return db[_0x4494('0x2a')][_0x4494('0x45')](_0x57cd42[_0x4494('0x46')],{})[_0x4494('0x22')](respondWithResult(_0x4f8902,0xc9))[_0x4494('0x44')](handleError(_0x4f8902,null));};exports[_0x4494('0x21')]=function(_0x1acb9d,_0x1169ff){if(_0x1acb9d[_0x4494('0x46')]['id']){delete _0x1acb9d[_0x4494('0x46')]['id'];}return db['SmsQueueReport'][_0x4494('0x43')]({'where':{'id':_0x1acb9d['params']['id']}})[_0x4494('0x22')](handleEntityNotFound(_0x1169ff,null))['then'](saveUpdates(_0x1acb9d[_0x4494('0x46')],null))[_0x4494('0x22')](respondWithResult(_0x1169ff,null))[_0x4494('0x44')](handleError(_0x1169ff,null));};exports['destroy']=function(_0x112b2c,_0x481b4a){return db[_0x4494('0x2a')][_0x4494('0x43')]({'where':{'id':_0x112b2c[_0x4494('0x41')]['id']}})[_0x4494('0x22')](handleEntityNotFound(_0x481b4a,null))[_0x4494('0x22')](removeEntity(_0x481b4a,null))[_0x4494('0x44')](handleError(_0x481b4a,null));};exports[_0x4494('0x47')]=function(_0x59e5f3,_0x3d5fd3){return db[_0x4494('0x2a')]['describe']()['then'](respondWithResult(_0x3d5fd3,null))[_0x4494('0x44')](handleError(_0x3d5fd3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1c94b2b..0bf1579 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29f8e6,_0x55e5d4){var _0xcd409e=function(_0x53a7de){while(--_0x53a7de){_0x29f8e6['push'](_0x29f8e6['shift']());}};_0xcd409e(++_0x55e5d4);}(_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('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0xa69e0,_0x5a6bb6){var _0x3fc6d0=function(_0x339181){while(--_0x339181){_0xa69e0['push'](_0xa69e0['shift']());}};_0x3fc6d0(++_0x5a6bb6);}(_0x70e0,0x17b));var _0x070e=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0x70e0[_0x1b1948];return _0x3cbd38;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1fbb2d4..21ca5c9 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 _0x9436=['raw','debug','stringify','update','where','attributes','limit','UpdateSmsQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options'];(function(_0x304ebc,_0x1b3158){var _0x4027c5=function(_0x4f85da){while(--_0x4f85da){_0x304ebc['push'](_0x304ebc['shift']());}};_0x4027c5(++_0x1b3158);}(_0x9436,0x17c));var _0x6943=function(_0x10e0a5,_0x149085){_0x10e0a5=_0x10e0a5-0x0;var _0x3f1320=_0x9436[_0x10e0a5];return _0x3f1320;};'use strict';var _=require(_0x6943('0x0'));var util=require('util');var moment=require(_0x6943('0x1'));var BPromise=require(_0x6943('0x2'));var rs=require(_0x6943('0x3'));var fs=require('fs');var Redis=require(_0x6943('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6943('0x5'))(_0x6943('0x6'));var config=require('../../config/environment');var jayson=require(_0x6943('0x7'));var client=jayson[_0x6943('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21d55b,_0x2ef649,_0x2b742a){return new BPromise(function(_0x3016cc,_0x29f025){return client[_0x6943('0x9')](_0x21d55b,_0x2b742a)[_0x6943('0xa')](function(_0x161743){logger['info'](_0x6943('0xb'),_0x2ef649,_0x6943('0xc'));logger['debug'](_0x6943('0xd'),_0x2ef649,'request\x20sent',JSON['stringify'](_0x161743));if(_0x161743['error']){if(_0x161743[_0x6943('0xe')]['code']===0x1f4){logger[_0x6943('0xe')](_0x6943('0xb'),_0x2ef649,_0x161743[_0x6943('0xe')]['message']);return _0x29f025(_0x161743[_0x6943('0xe')][_0x6943('0xf')]);}logger[_0x6943('0xe')](_0x6943('0xb'),_0x2ef649,_0x161743[_0x6943('0xe')]['message']);return _0x3016cc(_0x161743[_0x6943('0xe')][_0x6943('0xf')]);}else{logger[_0x6943('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x2ef649,_0x6943('0xc'));_0x3016cc(_0x161743[_0x6943('0x11')][_0x6943('0xf')]);}})[_0x6943('0x12')](function(_0xbfcf53){logger[_0x6943('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x2ef649,_0xbfcf53);_0x29f025(_0xbfcf53);});});}exports[_0x6943('0x13')]=function(_0x2174f1){var _0x2f305e=this;return new Promise(function(_0x501787,_0x2b9df9){return db[_0x6943('0x14')]['create'](_0x2174f1[_0x6943('0x15')],{'raw':_0x2174f1[_0x6943('0x16')]?_0x2174f1[_0x6943('0x16')][_0x6943('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1b117b){logger['info'](_0x6943('0x13'),_0x2174f1);logger[_0x6943('0x18')](_0x6943('0x13'),_0x2174f1,JSON[_0x6943('0x19')](_0x1b117b));_0x501787(_0x1b117b);})[_0x6943('0x12')](function(_0xd21282){logger[_0x6943('0xe')](_0x6943('0x13'),_0xd21282['message'],_0x2174f1);_0x2b9df9(_0x2f305e[_0x6943('0xe')](0x1f4,_0xd21282[_0x6943('0xf')]));});});};exports['UpdateSmsQueueReport']=function(_0x5a3aee){var _0x46ca90=this;return new Promise(function(_0xd6627c,_0x131a14){return db['SmsQueueReport'][_0x6943('0x1a')](_0x5a3aee[_0x6943('0x15')],{'raw':_0x5a3aee[_0x6943('0x16')]?_0x5a3aee['options'][_0x6943('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3aee[_0x6943('0x16')]?_0x5a3aee['options'][_0x6943('0x1b')]||null:null,'attributes':_0x5a3aee[_0x6943('0x16')]?_0x5a3aee[_0x6943('0x16')][_0x6943('0x1c')]||null:null,'limit':_0x5a3aee['options']?_0x5a3aee[_0x6943('0x16')][_0x6943('0x1d')]||null:null})[_0x6943('0xa')](function(_0x32cd2f){logger['info'](_0x6943('0x1e'),_0x5a3aee);logger[_0x6943('0x18')](_0x6943('0x1e'),_0x5a3aee,JSON['stringify'](_0x32cd2f));_0xd6627c(_0x32cd2f);})['catch'](function(_0x193921){logger[_0x6943('0xe')](_0x6943('0x1e'),_0x193921[_0x6943('0xf')],_0x5a3aee);_0x131a14(_0x46ca90[_0x6943('0xe')](0x1f4,_0x193921[_0x6943('0xf')]));});});}; \ No newline at end of file +var _0x40ed=['catch','SmsQueueReport','create','body','options','CreateSmsQueueReport','debug','stringify','UpdateSmsQueueReport','update','raw','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x13fb4f,_0x42f6af){var _0x298a4e=function(_0x18c6c1){while(--_0x18c6c1){_0x13fb4f['push'](_0x13fb4f['shift']());}};_0x298a4e(++_0x42f6af);}(_0x40ed,0x123));var _0xd40e=function(_0x18056c,_0x22e9a2){_0x18056c=_0x18056c-0x0;var _0xe6068=_0x40ed[_0x18056c];return _0xe6068;};'use strict';var _=require(_0xd40e('0x0'));var util=require('util');var moment=require(_0xd40e('0x1'));var BPromise=require(_0xd40e('0x2'));var rs=require(_0xd40e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd40e('0x4'))['db'];var utils=require(_0xd40e('0x5'));var logger=require('../../config/logger')(_0xd40e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd40e('0x7')][_0xd40e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe795a6,_0x26cdc2,_0x5d5a3c){return new BPromise(function(_0x193278,_0x4f9655){return client[_0xd40e('0x9')](_0xe795a6,_0x5d5a3c)[_0xd40e('0xa')](function(_0x57e6a4){logger[_0xd40e('0xb')](_0xd40e('0xc'),_0x26cdc2,_0xd40e('0xd'));logger['debug'](_0xd40e('0xe'),_0x26cdc2,_0xd40e('0xd'),JSON['stringify'](_0x57e6a4));if(_0x57e6a4[_0xd40e('0xf')]){if(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x10')]===0x1f4){logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);return _0x4f9655(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);}logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);return _0x193278(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);}else{logger['info'](_0xd40e('0xc'),_0x26cdc2,_0xd40e('0xd'));_0x193278(_0x57e6a4[_0xd40e('0x12')]['message']);}})[_0xd40e('0x13')](function(_0xb88cd6){logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0xb88cd6);_0x4f9655(_0xb88cd6);});});}exports['CreateSmsQueueReport']=function(_0x3fb314){var _0x47cb1c=this;return new Promise(function(_0x4bc50d,_0x180fb4){return db[_0xd40e('0x14')][_0xd40e('0x15')](_0x3fb314[_0xd40e('0x16')],{'raw':_0x3fb314[_0xd40e('0x17')]?_0x3fb314[_0xd40e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd40e('0xa')](function(_0x425b73){logger[_0xd40e('0xb')](_0xd40e('0x18'),_0x3fb314);logger[_0xd40e('0x19')](_0xd40e('0x18'),_0x3fb314,JSON[_0xd40e('0x1a')](_0x425b73));_0x4bc50d(_0x425b73);})[_0xd40e('0x13')](function(_0xac4746){logger[_0xd40e('0xf')](_0xd40e('0x18'),_0xac4746[_0xd40e('0x11')],_0x3fb314);_0x180fb4(_0x47cb1c[_0xd40e('0xf')](0x1f4,_0xac4746['message']));});});};exports[_0xd40e('0x1b')]=function(_0x2cca63){var _0x4a4b42=this;return new Promise(function(_0x5bef9a,_0x4c83e5){return db[_0xd40e('0x14')][_0xd40e('0x1c')](_0x2cca63[_0xd40e('0x16')],{'raw':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')][_0xd40e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cca63[_0xd40e('0x17')]?_0x2cca63['options']['where']||null:null,'attributes':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')][_0xd40e('0x1e')]||null:null,'limit':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')]['limit']||null:null})[_0xd40e('0xa')](function(_0xc3df08){logger['info']('UpdateSmsQueueReport',_0x2cca63);logger[_0xd40e('0x19')](_0xd40e('0x1b'),_0x2cca63,JSON[_0xd40e('0x1a')](_0xc3df08));_0x5bef9a(_0xc3df08);})[_0xd40e('0x13')](function(_0xe341f2){logger[_0xd40e('0xf')]('UpdateSmsQueueReport',_0xe341f2[_0xd40e('0x11')],_0x2cca63);_0x4c83e5(_0x4a4b42[_0xd40e('0xf')](0x1f4,_0xe341f2[_0xd40e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2f60939..7da8e57 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 _0x89c3=['/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','describe'];(function(_0x8a555,_0x47db50){var _0x573ade=function(_0x316054){while(--_0x316054){_0x8a555['push'](_0x8a555['shift']());}};_0x573ade(++_0x47db50);}(_0x89c3,0xff));var _0x389c=function(_0x1a7ff8,_0x5d5e82){_0x1a7ff8=_0x1a7ff8-0x0;var _0x2eb362=_0x89c3[_0x1a7ff8];return _0x2eb362;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var fs_extra=require(_0x389c('0x6'));var auth=require(_0x389c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x389c('0x8'));var controller=require('./smsTransferReport.controller');router[_0x389c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x389c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x389c('0xa')]);router[_0x389c('0x9')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth[_0x389c('0xc')](),controller[_0x389c('0xf')]);router[_0x389c('0x10')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x11')]);router[_0x389c('0x12')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd67b=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x5d2c9,_0x3f910d){var _0x327730=function(_0x146c20){while(--_0x146c20){_0x5d2c9['push'](_0x5d2c9['shift']());}};_0x327730(++_0x3f910d);}(_0xd67b,0x133));var _0xbd67=function(_0x5c67a2,_0x259b7c){_0x5c67a2=_0x5c67a2-0x0;var _0x53bbcc=_0xd67b[_0x5c67a2];return _0x53bbcc;};'use strict';var multer=require('multer');var util=require(_0xbd67('0x0'));var path=require('path');var timeout=require(_0xbd67('0x1'));var express=require(_0xbd67('0x2'));var router=express[_0xbd67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd67('0x5'));var controller=require('./smsTransferReport.controller');router[_0xbd67('0x6')]('/',auth[_0xbd67('0x7')](),controller[_0xbd67('0x8')]);router[_0xbd67('0x6')](_0xbd67('0x9'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xa')]);router[_0xbd67('0x6')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xc')]);router[_0xbd67('0xd')]('/',auth[_0xbd67('0x7')](),controller['create']);router['put'](_0xbd67('0xb'),auth['isAuthenticated'](),controller[_0xbd67('0xe')]);router[_0xbd67('0xf')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x10')]);module[_0xbd67('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7744fe6..1ae9d09 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(_0x10a280,_0x16b373){var _0x195a69=function(_0x46e761){while(--_0x46e761){_0x10a280['push'](_0x10a280['shift']());}};_0x195a69(++_0x16b373);}(_0x4b84,0x1cc));var _0x44b8=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x4b84[_0x400b43];return _0x3c330f;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1419b5,_0x1c7dce){var _0x381c59=function(_0x1e6cfd){while(--_0x1e6cfd){_0x1419b5['push'](_0x1419b5['shift']());}};_0x381c59(++_0x1c7dce);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0xaa88[_0x5d6e30];return _0x3d3f3b;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 089a07e..e1c3312 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 _0xf53d=['options','catch','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','SmsTransferReport','length'];(function(_0x23fc3d,_0x400346){var _0x46cfe2=function(_0x515776){while(--_0x515776){_0x23fc3d['push'](_0x23fc3d['shift']());}};_0x46cfe2(++_0x400346);}(_0xf53d,0x18e));var _0xdf53=function(_0x52fc54,_0x110caa){_0x52fc54=_0x52fc54-0x0;var _0xa887d6=_0xf53d[_0x52fc54];return _0xa887d6;};'use strict';var emlformat=require(_0xdf53('0x0'));var rimraf=require(_0xdf53('0x1'));var zipdir=require(_0xdf53('0x2'));var jsonpatch=require(_0xdf53('0x3'));var rp=require(_0xdf53('0x4'));var moment=require('moment');var BPromise=require(_0xdf53('0x5'));var Mustache=require('mustache');var util=require(_0xdf53('0x6'));var path=require('path');var sox=require(_0xdf53('0x7'));var csv=require(_0xdf53('0x8'));var ejs=require(_0xdf53('0x9'));var fs=require('fs');var fs_extra=require(_0xdf53('0xa'));var _=require(_0xdf53('0xb'));var squel=require(_0xdf53('0xc'));var crypto=require('crypto');var jsforce=require(_0xdf53('0xd'));var deskjs=require(_0xdf53('0xe'));var toCsv=require(_0xdf53('0x8'));var querystring=require(_0xdf53('0xf'));var Papa=require(_0xdf53('0x10'));var Redis=require(_0xdf53('0x11'));var authService=require(_0xdf53('0x12'));var qs=require(_0xdf53('0x13'));var as=require(_0xdf53('0x14'));var hardwareService=require(_0xdf53('0x15'));var logger=require(_0xdf53('0x16'))(_0xdf53('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50252b,_0x5d7cb0){_0x5d7cb0=_0x5d7cb0||0xcc;return function(_0x3e6e8b){if(_0x3e6e8b){return _0x50252b[_0xdf53('0x18')](_0x5d7cb0);}return _0x50252b[_0xdf53('0x19')](_0x5d7cb0)[_0xdf53('0x1a')]();};}function respondWithResult(_0x43d937,_0x4ca042){_0x4ca042=_0x4ca042||0xc8;return function(_0x542d25){if(_0x542d25){return _0x43d937[_0xdf53('0x19')](_0x4ca042)[_0xdf53('0x1b')](_0x542d25);}};}function respondWithFilteredResult(_0x3457e8,_0x222bab){return function(_0x427237){if(_0x427237){var _0x8a96b7=typeof _0x222bab[_0xdf53('0x1c')]==='undefined'&&typeof _0x222bab[_0xdf53('0x1d')]===_0xdf53('0x1e');var _0x21cead=_0x427237[_0xdf53('0x1f')];var _0x568374=_0x8a96b7?0x0:_0x222bab[_0xdf53('0x1c')];var _0x1fac2c=_0x8a96b7?_0x427237[_0xdf53('0x1f')]:_0x222bab[_0xdf53('0x1c')]+_0x222bab[_0xdf53('0x1d')];var _0x5cc3be;if(_0x1fac2c>=_0x21cead){_0x1fac2c=_0x21cead;_0x5cc3be=0xc8;}else{_0x5cc3be=0xce;}_0x3457e8[_0xdf53('0x19')](_0x5cc3be);return _0x3457e8['set'](_0xdf53('0x20'),_0x568374+'-'+_0x1fac2c+'/'+_0x21cead)[_0xdf53('0x1b')](_0x427237);}return null;};}function patchUpdates(_0x447e4b){return function(_0x2d1eae){try{jsonpatch[_0xdf53('0x21')](_0x2d1eae,_0x447e4b,!![]);}catch(_0x4e925f){return BPromise[_0xdf53('0x22')](_0x4e925f);}return _0x2d1eae[_0xdf53('0x23')]();};}function saveUpdates(_0x542a96,_0x203e3b){return function(_0x557b7b){if(_0x557b7b){return _0x557b7b[_0xdf53('0x24')](_0x542a96)[_0xdf53('0x25')](function(_0x2b9f75){return _0x2b9f75;});}return null;};}function removeEntity(_0x53ee6e,_0x46ba9c){return function(_0x3228db){if(_0x3228db){return _0x3228db['destroy']()[_0xdf53('0x25')](function(){_0x53ee6e[_0xdf53('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2940ed,_0x5cf109){return function(_0x2a4da3){if(!_0x2a4da3){_0x2940ed[_0xdf53('0x18')](0x194);}return _0x2a4da3;};}function handleError(_0x5a298e,_0x45b34b){_0x45b34b=_0x45b34b||0x1f4;return function(_0x2043ce){logger[_0xdf53('0x26')](_0x2043ce[_0xdf53('0x27')]);if(_0x2043ce[_0xdf53('0x28')]){delete _0x2043ce[_0xdf53('0x28')];}_0x5a298e[_0xdf53('0x19')](_0x45b34b)[_0xdf53('0x29')](_0x2043ce);};}exports[_0xdf53('0x2a')]=function(_0x262630,_0x53e2cf){var _0x4aeabb={},_0x258b14={},_0x4da909={'count':0x0,'rows':[]};var _0xad6521=_[_0xdf53('0x2b')](db['SmsTransferReport'][_0xdf53('0x2c')],function(_0x445c8e){return{'name':_0x445c8e[_0xdf53('0x2d')],'type':_0x445c8e['type'][_0xdf53('0x2e')]};});_0x258b14[_0xdf53('0x2f')]=_[_0xdf53('0x2b')](_0xad6521,_0xdf53('0x28'));_0x258b14[_0xdf53('0x30')]=_[_0xdf53('0x31')](_0x262630[_0xdf53('0x30')]);_0x258b14[_0xdf53('0x32')]=_[_0xdf53('0x33')](_0x258b14['model'],_0x258b14[_0xdf53('0x30')]);_0x4aeabb['attributes']=_[_0xdf53('0x33')](_0x258b14[_0xdf53('0x2f')],qs['fields'](_0x262630[_0xdf53('0x30')][_0xdf53('0x34')]));_0x4aeabb[_0xdf53('0x35')]=_0x4aeabb[_0xdf53('0x35')]['length']?_0x4aeabb[_0xdf53('0x35')]:_0x258b14[_0xdf53('0x2f')];if(!_0x262630['query'][_0xdf53('0x36')](_0xdf53('0x37'))){_0x4aeabb[_0xdf53('0x1d')]=qs[_0xdf53('0x1d')](_0x262630['query'][_0xdf53('0x1d')]);_0x4aeabb[_0xdf53('0x1c')]=qs[_0xdf53('0x1c')](_0x262630[_0xdf53('0x30')]['offset']);}_0x4aeabb['order']=qs['sort'](_0x262630[_0xdf53('0x30')][_0xdf53('0x38')]);_0x4aeabb[_0xdf53('0x39')]=qs['filters'](_[_0xdf53('0x3a')](_0x262630['query'],_0x258b14[_0xdf53('0x32')]),_0xad6521);if(_0x262630[_0xdf53('0x30')][_0xdf53('0x3b')]){_0x4aeabb['where']=_[_0xdf53('0x3c')](_0x4aeabb[_0xdf53('0x39')],{'$or':_[_0xdf53('0x2b')](_0xad6521,function(_0x14e0d0){if(_0x14e0d0[_0xdf53('0x3d')]!==_0xdf53('0x3e')){var _0x323236={};_0x323236[_0x14e0d0[_0xdf53('0x28')]]={'$like':'%'+_0x262630['query'][_0xdf53('0x3b')]+'%'};return _0x323236;}})});}_0x4aeabb=_[_0xdf53('0x3c')]({},_0x4aeabb,_0x262630['options']);var _0x5cb213={'where':_0x4aeabb[_0xdf53('0x39')]};return db['SmsTransferReport'][_0xdf53('0x1f')](_0x5cb213)[_0xdf53('0x25')](function(_0x46b14b){_0x4da909[_0xdf53('0x1f')]=_0x46b14b;if(_0x262630['query'][_0xdf53('0x3f')]){_0x4aeabb[_0xdf53('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xdf53('0x41')](_0x4aeabb);})[_0xdf53('0x25')](function(_0x313813){_0x4da909[_0xdf53('0x42')]=_0x313813;return _0x4da909;})['then'](respondWithFilteredResult(_0x53e2cf,_0x4aeabb))['catch'](handleError(_0x53e2cf,null));};exports[_0xdf53('0x43')]=function(_0x591651,_0x15c4f2){var _0xda423d={'raw':!![],'where':{'id':_0x591651['params']['id']}},_0x37bb05={};_0x37bb05[_0xdf53('0x2f')]=_[_0xdf53('0x31')](db[_0xdf53('0x44')][_0xdf53('0x2c')]);_0x37bb05['query']=_[_0xdf53('0x31')](_0x591651[_0xdf53('0x30')]);_0x37bb05['filters']=_[_0xdf53('0x33')](_0x37bb05[_0xdf53('0x2f')],_0x37bb05['query']);_0xda423d[_0xdf53('0x35')]=_[_0xdf53('0x33')](_0x37bb05[_0xdf53('0x2f')],qs[_0xdf53('0x34')](_0x591651[_0xdf53('0x30')][_0xdf53('0x34')]));_0xda423d[_0xdf53('0x35')]=_0xda423d[_0xdf53('0x35')][_0xdf53('0x45')]?_0xda423d[_0xdf53('0x35')]:_0x37bb05[_0xdf53('0x2f')];if(_0x591651[_0xdf53('0x30')][_0xdf53('0x3f')]){_0xda423d['include']=[{'all':!![]}];}_0xda423d=_[_0xdf53('0x3c')]({},_0xda423d,_0x591651[_0xdf53('0x46')]);return db['SmsTransferReport']['find'](_0xda423d)[_0xdf53('0x25')](handleEntityNotFound(_0x15c4f2,null))[_0xdf53('0x25')](respondWithResult(_0x15c4f2,null))[_0xdf53('0x47')](handleError(_0x15c4f2,null));};exports[_0xdf53('0x48')]=function(_0x1f6c8b,_0x37da11){return db[_0xdf53('0x44')][_0xdf53('0x48')](_0x1f6c8b['body'],{})[_0xdf53('0x25')](respondWithResult(_0x37da11,0xc9))[_0xdf53('0x47')](handleError(_0x37da11,null));};exports[_0xdf53('0x24')]=function(_0x2bf4dc,_0x1d9749){if(_0x2bf4dc[_0xdf53('0x49')]['id']){delete _0x2bf4dc[_0xdf53('0x49')]['id'];}return db[_0xdf53('0x44')]['find']({'where':{'id':_0x2bf4dc[_0xdf53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d9749,null))[_0xdf53('0x25')](saveUpdates(_0x2bf4dc[_0xdf53('0x49')],null))['then'](respondWithResult(_0x1d9749,null))[_0xdf53('0x47')](handleError(_0x1d9749,null));};exports[_0xdf53('0x4b')]=function(_0x307b52,_0x2792e6){return db['SmsTransferReport'][_0xdf53('0x4c')]({'where':{'id':_0x307b52[_0xdf53('0x4a')]['id']}})[_0xdf53('0x25')](handleEntityNotFound(_0x2792e6,null))[_0xdf53('0x25')](removeEntity(_0x2792e6,null))[_0xdf53('0x47')](handleError(_0x2792e6,null));};exports['describe']=function(_0x441169,_0x484d15){return db[_0xdf53('0x44')][_0xdf53('0x4d')]()['then'](respondWithResult(_0x484d15,null))['catch'](handleError(_0x484d15,null));}; \ No newline at end of file +var _0x067f=['offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x067f,0x7e));var _0xf067=function(_0x5868fd,_0x260693){_0x5868fd=_0x5868fd-0x0;var _0x46a9d6=_0x067f[_0x5868fd];return _0x46a9d6;};'use strict';var emlformat=require(_0xf067('0x0'));var rimraf=require(_0xf067('0x1'));var zipdir=require(_0xf067('0x2'));var jsonpatch=require(_0xf067('0x3'));var rp=require('request-promise');var moment=require(_0xf067('0x4'));var BPromise=require(_0xf067('0x5'));var Mustache=require(_0xf067('0x6'));var util=require(_0xf067('0x7'));var path=require(_0xf067('0x8'));var sox=require(_0xf067('0x9'));var csv=require(_0xf067('0xa'));var ejs=require(_0xf067('0xb'));var fs=require('fs');var fs_extra=require(_0xf067('0xc'));var _=require(_0xf067('0xd'));var squel=require(_0xf067('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf067('0xf'));var toCsv=require(_0xf067('0xa'));var querystring=require(_0xf067('0x10'));var Papa=require('papaparse');var Redis=require(_0xf067('0x11'));var authService=require(_0xf067('0x12'));var qs=require(_0xf067('0x13'));var as=require(_0xf067('0x14'));var hardwareService=require(_0xf067('0x15'));var logger=require('../../config/logger')(_0xf067('0x16'));var utils=require(_0xf067('0x17'));var config=require(_0xf067('0x18'));var licenseUtil=require(_0xf067('0x19'));var db=require(_0xf067('0x1a'))['db'];function respondWithStatusCode(_0x1e45da,_0x2d3716){_0x2d3716=_0x2d3716||0xcc;return function(_0x23a5df){if(_0x23a5df){return _0x1e45da[_0xf067('0x1b')](_0x2d3716);}return _0x1e45da['status'](_0x2d3716)[_0xf067('0x1c')]();};}function respondWithResult(_0xd8c9b9,_0xcdf4eb){_0xcdf4eb=_0xcdf4eb||0xc8;return function(_0x2c7638){if(_0x2c7638){return _0xd8c9b9['status'](_0xcdf4eb)[_0xf067('0x1d')](_0x2c7638);}};}function respondWithFilteredResult(_0x2401f9,_0x1ce7a0){return function(_0x33b0ff){if(_0x33b0ff){var _0x37b52c=typeof _0x1ce7a0['offset']==='undefined'&&typeof _0x1ce7a0[_0xf067('0x1e')]==='undefined';var _0x5aa46c=_0x33b0ff[_0xf067('0x1f')];var _0x5d80a7=_0x37b52c?0x0:_0x1ce7a0[_0xf067('0x20')];var _0x575c37=_0x37b52c?_0x33b0ff[_0xf067('0x1f')]:_0x1ce7a0[_0xf067('0x20')]+_0x1ce7a0['limit'];var _0xbf6472;if(_0x575c37>=_0x5aa46c){_0x575c37=_0x5aa46c;_0xbf6472=0xc8;}else{_0xbf6472=0xce;}_0x2401f9[_0xf067('0x21')](_0xbf6472);return _0x2401f9[_0xf067('0x22')](_0xf067('0x23'),_0x5d80a7+'-'+_0x575c37+'/'+_0x5aa46c)['json'](_0x33b0ff);}return null;};}function patchUpdates(_0x15388c){return function(_0x3c9fe9){try{jsonpatch[_0xf067('0x24')](_0x3c9fe9,_0x15388c,!![]);}catch(_0x4f3bbf){return BPromise[_0xf067('0x25')](_0x4f3bbf);}return _0x3c9fe9[_0xf067('0x26')]();};}function saveUpdates(_0x1b465d,_0x612837){return function(_0x212648){if(_0x212648){return _0x212648[_0xf067('0x27')](_0x1b465d)['then'](function(_0x44278b){return _0x44278b;});}return null;};}function removeEntity(_0x45d3f3,_0x47b818){return function(_0x3b9697){if(_0x3b9697){return _0x3b9697[_0xf067('0x28')]()[_0xf067('0x29')](function(){_0x45d3f3['status'](0xcc)[_0xf067('0x1c')]();});}};}function handleEntityNotFound(_0x34518a,_0x53f4ee){return function(_0xf76c03){if(!_0xf76c03){_0x34518a[_0xf067('0x1b')](0x194);}return _0xf76c03;};}function handleError(_0x3c000b,_0x1d07f8){_0x1d07f8=_0x1d07f8||0x1f4;return function(_0x1fe695){logger[_0xf067('0x2a')](_0x1fe695['stack']);if(_0x1fe695['name']){delete _0x1fe695[_0xf067('0x2b')];}_0x3c000b['status'](_0x1d07f8)[_0xf067('0x2c')](_0x1fe695);};}exports[_0xf067('0x2d')]=function(_0x3eda8a,_0x275887){var _0x3ba06d={},_0x87f89c={},_0x2714d1={'count':0x0,'rows':[]};var _0x4a8a11=_[_0xf067('0x2e')](db['SmsTransferReport']['rawAttributes'],function(_0x118e2f){return{'name':_0x118e2f[_0xf067('0x2f')],'type':_0x118e2f[_0xf067('0x30')][_0xf067('0x31')]};});_0x87f89c['model']=_[_0xf067('0x2e')](_0x4a8a11,_0xf067('0x2b'));_0x87f89c[_0xf067('0x32')]=_['keys'](_0x3eda8a['query']);_0x87f89c[_0xf067('0x33')]=_[_0xf067('0x34')](_0x87f89c[_0xf067('0x35')],_0x87f89c[_0xf067('0x32')]);_0x3ba06d['attributes']=_[_0xf067('0x34')](_0x87f89c[_0xf067('0x35')],qs[_0xf067('0x36')](_0x3eda8a[_0xf067('0x32')]['fields']));_0x3ba06d[_0xf067('0x37')]=_0x3ba06d[_0xf067('0x37')][_0xf067('0x38')]?_0x3ba06d[_0xf067('0x37')]:_0x87f89c[_0xf067('0x35')];if(!_0x3eda8a['query']['hasOwnProperty'](_0xf067('0x39'))){_0x3ba06d[_0xf067('0x1e')]=qs[_0xf067('0x1e')](_0x3eda8a[_0xf067('0x32')][_0xf067('0x1e')]);_0x3ba06d['offset']=qs[_0xf067('0x20')](_0x3eda8a[_0xf067('0x32')][_0xf067('0x20')]);}_0x3ba06d['order']=qs['sort'](_0x3eda8a['query'][_0xf067('0x3a')]);_0x3ba06d['where']=qs[_0xf067('0x33')](_[_0xf067('0x3b')](_0x3eda8a[_0xf067('0x32')],_0x87f89c['filters']),_0x4a8a11);if(_0x3eda8a[_0xf067('0x32')][_0xf067('0x3c')]){_0x3ba06d[_0xf067('0x3d')]=_[_0xf067('0x3e')](_0x3ba06d['where'],{'$or':_[_0xf067('0x2e')](_0x4a8a11,function(_0x4d69bb){if(_0x4d69bb[_0xf067('0x30')]!==_0xf067('0x3f')){var _0x22355d={};_0x22355d[_0x4d69bb[_0xf067('0x2b')]]={'$like':'%'+_0x3eda8a['query'][_0xf067('0x3c')]+'%'};return _0x22355d;}})});}_0x3ba06d=_[_0xf067('0x3e')]({},_0x3ba06d,_0x3eda8a[_0xf067('0x40')]);var _0x3579b5={'where':_0x3ba06d[_0xf067('0x3d')]};return db[_0xf067('0x41')][_0xf067('0x1f')](_0x3579b5)['then'](function(_0x2a6776){_0x2714d1['count']=_0x2a6776;if(_0x3eda8a[_0xf067('0x32')]['includeAll']){_0x3ba06d[_0xf067('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xf067('0x43')](_0x3ba06d);})[_0xf067('0x29')](function(_0x9bfb7b){_0x2714d1[_0xf067('0x44')]=_0x9bfb7b;return _0x2714d1;})[_0xf067('0x29')](respondWithFilteredResult(_0x275887,_0x3ba06d))[_0xf067('0x45')](handleError(_0x275887,null));};exports[_0xf067('0x46')]=function(_0x2eb5ee,_0x2a41c0){var _0xcb4c3={'raw':!![],'where':{'id':_0x2eb5ee[_0xf067('0x47')]['id']}},_0xb23d7d={};_0xb23d7d[_0xf067('0x35')]=_[_0xf067('0x48')](db[_0xf067('0x41')][_0xf067('0x49')]);_0xb23d7d[_0xf067('0x32')]=_[_0xf067('0x48')](_0x2eb5ee[_0xf067('0x32')]);_0xb23d7d['filters']=_[_0xf067('0x34')](_0xb23d7d['model'],_0xb23d7d[_0xf067('0x32')]);_0xcb4c3['attributes']=_[_0xf067('0x34')](_0xb23d7d[_0xf067('0x35')],qs[_0xf067('0x36')](_0x2eb5ee[_0xf067('0x32')][_0xf067('0x36')]));_0xcb4c3[_0xf067('0x37')]=_0xcb4c3[_0xf067('0x37')][_0xf067('0x38')]?_0xcb4c3[_0xf067('0x37')]:_0xb23d7d[_0xf067('0x35')];if(_0x2eb5ee[_0xf067('0x32')][_0xf067('0x4a')]){_0xcb4c3['include']=[{'all':!![]}];}_0xcb4c3=_[_0xf067('0x3e')]({},_0xcb4c3,_0x2eb5ee[_0xf067('0x40')]);return db[_0xf067('0x41')][_0xf067('0x4b')](_0xcb4c3)[_0xf067('0x29')](handleEntityNotFound(_0x2a41c0,null))[_0xf067('0x29')](respondWithResult(_0x2a41c0,null))['catch'](handleError(_0x2a41c0,null));};exports[_0xf067('0x4c')]=function(_0x5020df,_0x5c1abf){return db[_0xf067('0x41')][_0xf067('0x4c')](_0x5020df[_0xf067('0x4d')],{})[_0xf067('0x29')](respondWithResult(_0x5c1abf,0xc9))[_0xf067('0x45')](handleError(_0x5c1abf,null));};exports[_0xf067('0x27')]=function(_0x345360,_0x54ce89){if(_0x345360[_0xf067('0x4d')]['id']){delete _0x345360[_0xf067('0x4d')]['id'];}return db[_0xf067('0x41')][_0xf067('0x4b')]({'where':{'id':_0x345360['params']['id']}})[_0xf067('0x29')](handleEntityNotFound(_0x54ce89,null))['then'](saveUpdates(_0x345360[_0xf067('0x4d')],null))['then'](respondWithResult(_0x54ce89,null))[_0xf067('0x45')](handleError(_0x54ce89,null));};exports['destroy']=function(_0x54da52,_0x1c1fa4){return db[_0xf067('0x41')]['find']({'where':{'id':_0x54da52[_0xf067('0x47')]['id']}})[_0xf067('0x29')](handleEntityNotFound(_0x1c1fa4,null))[_0xf067('0x29')](removeEntity(_0x1c1fa4,null))[_0xf067('0x45')](handleError(_0x1c1fa4,null));};exports['describe']=function(_0x410203,_0x5a4383){return db[_0xf067('0x41')][_0xf067('0x4e')]()[_0xf067('0x29')](respondWithResult(_0x5a4383,null))['catch'](handleError(_0x5a4383,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a585332..51a0ed4 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 _0xf7d5=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport','uniqueid'];(function(_0x339f0e,_0x50715e){var _0x12d1ab=function(_0x48a37d){while(--_0x48a37d){_0x339f0e['push'](_0x339f0e['shift']());}};_0x12d1ab(++_0x50715e);}(_0xf7d5,0x16b));var _0x5f7d=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0xf7d5[_0x2f4d41];return _0x3b0bb2;};'use strict';var _=require(_0x5f7d('0x0'));var util=require('util');var logger=require(_0x5f7d('0x1'))('api');var moment=require(_0x5f7d('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f7d('0x3'));var fs=require('fs');var path=require(_0x5f7d('0x4'));var rimraf=require(_0x5f7d('0x5'));var config=require(_0x5f7d('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x5f7d('0x7')]=function(_0xeebc28,_0x59bb86){return _0xeebc28[_0x5f7d('0x8')](_0x5f7d('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5f7d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd679=['define','report_sms_transfer','uniqueid','lodash','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes','exports'];(function(_0x3d14bd,_0x3e8c72){var _0x3c9ef9=function(_0x4a17df){while(--_0x4a17df){_0x3d14bd['push'](_0x3d14bd['shift']());}};_0x3c9ef9(++_0x3e8c72);}(_0xd679,0x14d));var _0x9d67=function(_0x4b32db,_0x4111e8){_0x4b32db=_0x4b32db-0x0;var _0x3b369d=_0xd679[_0x4b32db];return _0x3b369d;};'use strict';var _=require(_0x9d67('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d67('0x1'));var moment=require(_0x9d67('0x2'));var BPromise=require(_0x9d67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d67('0x4'));var rimraf=require(_0x9d67('0x5'));var config=require('../../config/environment');var attributes=require(_0x9d67('0x6'));module[_0x9d67('0x7')]=function(_0x24b2f4,_0x477014){return _0x24b2f4[_0x9d67('0x8')]('SmsTransferReport',attributes,{'tableName':_0x9d67('0x9'),'paranoid':![],'indexes':[{'name':_0x9d67('0xa'),'fields':[_0x9d67('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 9ece9af..4f22ded 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 _0xfcbd=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa34e25,_0x4a87ff){var _0x4de80d=function(_0x46038b){while(--_0x46038b){_0xa34e25['push'](_0xa34e25['shift']());}};_0x4de80d(++_0x4a87ff);}(_0xfcbd,0x160));var _0xdfcb=function(_0x1853e5,_0x2193d4){_0x1853e5=_0x1853e5-0x0;var _0x26baad=_0xfcbd[_0x1853e5];return _0x26baad;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdfcb('0x1'));var rs=require(_0xdfcb('0x2'));var fs=require('fs');var Redis=require(_0xdfcb('0x3'));var db=require(_0xdfcb('0x4'))['db'];var utils=require(_0xdfcb('0x5'));var logger=require(_0xdfcb('0x6'))(_0xdfcb('0x7'));var config=require(_0xdfcb('0x8'));var jayson=require(_0xdfcb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46956c,_0x183ea8,_0xb8de95){return new BPromise(function(_0x3c5431,_0xbe50d6){return client[_0xdfcb('0xa')](_0x46956c,_0xb8de95)[_0xdfcb('0xb')](function(_0x5e650d){logger[_0xdfcb('0xc')](_0xdfcb('0xd'),_0x183ea8,_0xdfcb('0xe'));logger[_0xdfcb('0xf')](_0xdfcb('0x10'),_0x183ea8,_0xdfcb('0xe'),JSON[_0xdfcb('0x11')](_0x5e650d));if(_0x5e650d[_0xdfcb('0x12')]){if(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x13')]===0x1f4){logger[_0xdfcb('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x183ea8,_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);return _0xbe50d6(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);}logger[_0xdfcb('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x183ea8,_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);return _0x3c5431(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);}else{logger[_0xdfcb('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x183ea8,_0xdfcb('0xe'));_0x3c5431(_0x5e650d[_0xdfcb('0x15')][_0xdfcb('0x14')]);}})[_0xdfcb('0x16')](function(_0x11437d){logger[_0xdfcb('0x12')](_0xdfcb('0xd'),_0x183ea8,_0x11437d);_0xbe50d6(_0x11437d);});});} \ No newline at end of file +var _0xbe48=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xbe48,0x121));var _0x8be4=function(_0x3e3193,_0x457ffa){_0x3e3193=_0x3e3193-0x0;var _0x58eaf5=_0xbe48[_0x3e3193];return _0x58eaf5;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var moment=require(_0x8be4('0x2'));var BPromise=require(_0x8be4('0x3'));var rs=require(_0x8be4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8be4('0x5'));var logger=require(_0x8be4('0x6'))('rpc');var config=require(_0x8be4('0x7'));var jayson=require(_0x8be4('0x8'));var client=jayson[_0x8be4('0x9')][_0x8be4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe82da6,_0x4211b6,_0x35f862){return new BPromise(function(_0x554300,_0x3f87c6){return client[_0x8be4('0xb')](_0xe82da6,_0x35f862)['then'](function(_0x47ba2e){logger[_0x8be4('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4211b6,'request\x20sent');logger[_0x8be4('0xd')](_0x8be4('0xe'),_0x4211b6,_0x8be4('0xf'),JSON['stringify'](_0x47ba2e));if(_0x47ba2e['error']){if(_0x47ba2e['error'][_0x8be4('0x10')]===0x1f4){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x3f87c6(_0x47ba2e['error'][_0x8be4('0x13')]);}logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x554300(_0x47ba2e[_0x8be4('0x11')]['message']);}else{logger[_0x8be4('0xc')](_0x8be4('0x12'),_0x4211b6,_0x8be4('0xf'));_0x554300(_0x47ba2e[_0x8be4('0x14')][_0x8be4('0x13')]);}})[_0x8be4('0x15')](function(_0x435906){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x435906);_0x3f87c6(_0x435906);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5a298d5..a86ad74 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 _0xa1f4=['express','Router','fs-extra','../../components/auth/service','./sound.controller','index','get','isAuthenticated','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','basename','now','extname','file','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x50aebc,_0x5be39b){var _0x44da41=function(_0x5caca7){while(--_0x5caca7){_0x50aebc['push'](_0x50aebc['shift']());}};_0x44da41(++_0x5be39b);}(_0xa1f4,0x1be));var _0x4a1f=function(_0x26eda5,_0x2a77f2){_0x26eda5=_0x26eda5-0x0;var _0x592fad=_0xa1f4[_0x26eda5];return _0x592fad;};'use strict';var multer=require(_0x4a1f('0x0'));var util=require(_0x4a1f('0x1'));var path=require(_0x4a1f('0x2'));var timeout=require(_0x4a1f('0x3'));var express=require(_0x4a1f('0x4'));var router=express[_0x4a1f('0x5')]();var fs_extra=require(_0x4a1f('0x6'));var auth=require(_0x4a1f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a1f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4a1f('0x9')]);router[_0x4a1f('0xa')]('/:id',auth[_0x4a1f('0xb')](),controller[_0x4a1f('0xc')]);router[_0x4a1f('0xa')](_0x4a1f('0xd'),auth[_0x4a1f('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x4a1f('0xe')]({'destination':function(_0x1a5406,_0x38ee11,_0x16dba0){_0x16dba0(null,path[_0x4a1f('0xf')](config['root'],_0x4a1f('0x10')));},'filename':function(_0x4e558f,_0xea9c67,_0xac011){_0xea9c67['originalname']=_0xea9c67[_0x4a1f('0x11')][_0x4a1f('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xac011(null,util[_0x4a1f('0x13')]('%s-%s%s',path[_0x4a1f('0x14')](_0xea9c67['originalname'],path['extname'](_0xea9c67[_0x4a1f('0x11')])),Date[_0x4a1f('0x15')](),path[_0x4a1f('0x16')](_0xea9c67[_0x4a1f('0x11')])));}})});router['post']('/',upload['single'](_0x4a1f('0x17')),controller[_0x4a1f('0x18')]);router[_0x4a1f('0x19')](_0x4a1f('0x1a'),auth[_0x4a1f('0xb')](),controller[_0x4a1f('0x1b')]);router[_0x4a1f('0x1c')]('/:id',auth[_0x4a1f('0xb')](),controller[_0x4a1f('0x1c')]);module[_0x4a1f('0x1d')]=router; \ No newline at end of file +var _0x87f7=['single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','extname'];(function(_0x873d48,_0x3cf3c0){var _0x50c8ca=function(_0x954fd0){while(--_0x954fd0){_0x873d48['push'](_0x873d48['shift']());}};_0x50c8ca(++_0x3cf3c0);}(_0x87f7,0x130));var _0x787f=function(_0x4fab9a,_0x3a390a){_0x4fab9a=_0x4fab9a-0x0;var _0x54aa91=_0x87f7[_0x4fab9a];return _0x54aa91;};'use strict';var multer=require(_0x787f('0x0'));var util=require(_0x787f('0x1'));var path=require(_0x787f('0x2'));var timeout=require(_0x787f('0x3'));var express=require(_0x787f('0x4'));var router=express[_0x787f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x787f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x787f('0x7')]('/',auth[_0x787f('0x8')](),controller[_0x787f('0x9')]);router[_0x787f('0x7')](_0x787f('0xa'),auth[_0x787f('0x8')](),controller[_0x787f('0xb')]);router['get'](_0x787f('0xc'),auth[_0x787f('0x8')](),controller[_0x787f('0xd')]);var upload=multer({'storage':multer[_0x787f('0xe')]({'destination':function(_0x212cdc,_0x26b379,_0x5cf299){_0x5cf299(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x23e628,_0x2c548d,_0x3e758e){_0x2c548d[_0x787f('0xf')]=_0x2c548d[_0x787f('0xf')][_0x787f('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e758e(null,util[_0x787f('0x11')](_0x787f('0x12'),path['basename'](_0x2c548d[_0x787f('0xf')],path['extname'](_0x2c548d['originalname'])),Date['now'](),path[_0x787f('0x13')](_0x2c548d[_0x787f('0xf')])));}})});router['post']('/',upload[_0x787f('0x14')](_0x787f('0x15')),controller[_0x787f('0x16')]);router[_0x787f('0x17')]('/:id',auth[_0x787f('0x8')](),controller[_0x787f('0x18')]);router[_0x787f('0x19')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x787f('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 f60de8b..a551112 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 _0x37a8=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports','name'];(function(_0x550957,_0x48d5be){var _0x1d7108=function(_0x2c942f){while(--_0x2c942f){_0x550957['push'](_0x550957['shift']());}};_0x1d7108(++_0x48d5be);}(_0x37a8,0x1bd));var _0x837a=function(_0x4a0b15,_0x54818b){_0x4a0b15=_0x4a0b15-0x0;var _0x54f515=_0x37a8[_0x4a0b15];return _0x54f515;};'use strict';var Sequelize=require(_0x837a('0x0'));module[_0x837a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x837a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x837a('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x837a('0x3')]},'original_format':{'type':Sequelize[_0x837a('0x3')]},'original_duration':{'type':Sequelize[_0x837a('0x4')]},'original_sampleCount':{'type':Sequelize[_0x837a('0x5')]},'original_channelCount':{'type':Sequelize[_0x837a('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x837a('0x6')]},'converted_format':{'type':Sequelize[_0x837a('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x837a('0x5')]},'converted_channelCount':{'type':Sequelize[_0x837a('0x6')]},'converted_bitRate':{'type':Sequelize[_0x837a('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x244a=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x2ee97e,_0x5b7f3d){var _0x39412f=function(_0x2ccce5){while(--_0x2ccce5){_0x2ee97e['push'](_0x2ee97e['shift']());}};_0x39412f(++_0x5b7f3d);}(_0x244a,0x1ec));var _0xa244=function(_0x519dc2,_0x3b8548){_0x519dc2=_0x519dc2-0x0;var _0x53b69a=_0x244a[_0x519dc2];return _0x53b69a;};'use strict';var Sequelize=require(_0xa244('0x0'));module['exports']={'name':{'type':Sequelize[_0xa244('0x1')],'unique':_0xa244('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa244('0x1')]},'display_name':{'type':Sequelize[_0xa244('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa244('0x1')]},'original_format':{'type':Sequelize[_0xa244('0x1')]},'original_duration':{'type':Sequelize[_0xa244('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa244('0x4')]},'original_channelCount':{'type':Sequelize[_0xa244('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa244('0x5')]},'converted_format':{'type':Sequelize[_0xa244('0x1')]},'converted_duration':{'type':Sequelize[_0xa244('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xa244('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa244('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa244('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa244('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d1c15d5..2e4a4be 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 _0x5777=['params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show'];(function(_0x19429e,_0x27761b){var _0x429f93=function(_0x3fadb5){while(--_0x3fadb5){_0x19429e['push'](_0x19429e['shift']());}};_0x429f93(++_0x27761b);}(_0x5777,0xb0));var _0x7577=function(_0x3253e3,_0x19d384){_0x3253e3=_0x3253e3-0x0;var _0x10ca3e=_0x5777[_0x3253e3];return _0x10ca3e;};'use strict';var emlformat=require(_0x7577('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7577('0x1'));var jsonpatch=require(_0x7577('0x2'));var rp=require(_0x7577('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7577('0x4'));var util=require(_0x7577('0x5'));var path=require(_0x7577('0x6'));var sox=require(_0x7577('0x7'));var csv=require(_0x7577('0x8'));var ejs=require(_0x7577('0x9'));var fs=require('fs');var fs_extra=require(_0x7577('0xa'));var _=require(_0x7577('0xb'));var squel=require(_0x7577('0xc'));var crypto=require(_0x7577('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7577('0xe'));var toCsv=require(_0x7577('0x8'));var querystring=require(_0x7577('0xf'));var Papa=require(_0x7577('0x10'));var Redis=require(_0x7577('0x11'));var authService=require(_0x7577('0x12'));var qs=require(_0x7577('0x13'));var as=require(_0x7577('0x14'));var hardwareService=require(_0x7577('0x15'));var logger=require('../../config/logger')(_0x7577('0x16'));var utils=require(_0x7577('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7577('0x18'));var db=require(_0x7577('0x19'))['db'];function respondWithStatusCode(_0x5a231b,_0x42d73f){_0x42d73f=_0x42d73f||0xcc;return function(_0xd8afcc){if(_0xd8afcc){return _0x5a231b[_0x7577('0x1a')](_0x42d73f);}return _0x5a231b[_0x7577('0x1b')](_0x42d73f)['end']();};}function respondWithResult(_0x4a6918,_0x40309d){_0x40309d=_0x40309d||0xc8;return function(_0x80491c){if(_0x80491c){return _0x4a6918[_0x7577('0x1b')](_0x40309d)['json'](_0x80491c);}};}function respondWithFilteredResult(_0x5f016e,_0x5b2178){return function(_0x2618ec){if(_0x2618ec){var _0x2b5b5d=typeof _0x5b2178[_0x7577('0x1c')]==='undefined'&&typeof _0x5b2178[_0x7577('0x1d')]===_0x7577('0x1e');var _0x567d2b=_0x2618ec[_0x7577('0x1f')];var _0x4bba95=_0x2b5b5d?0x0:_0x5b2178[_0x7577('0x1c')];var _0xd436a3=_0x2b5b5d?_0x2618ec['count']:_0x5b2178[_0x7577('0x1c')]+_0x5b2178[_0x7577('0x1d')];var _0x52b268;if(_0xd436a3>=_0x567d2b){_0xd436a3=_0x567d2b;_0x52b268=0xc8;}else{_0x52b268=0xce;}_0x5f016e[_0x7577('0x1b')](_0x52b268);return _0x5f016e['set'](_0x7577('0x20'),_0x4bba95+'-'+_0xd436a3+'/'+_0x567d2b)['json'](_0x2618ec);}return null;};}function patchUpdates(_0x11032b){return function(_0x4c42ce){try{jsonpatch['apply'](_0x4c42ce,_0x11032b,!![]);}catch(_0x4ea16d){return BPromise[_0x7577('0x21')](_0x4ea16d);}return _0x4c42ce[_0x7577('0x22')]();};}function saveUpdates(_0x53efce,_0x345f1d){return function(_0x10c852){if(_0x10c852){return _0x10c852[_0x7577('0x23')](_0x53efce)[_0x7577('0x24')](function(_0x4e1b19){return _0x4e1b19;});}return null;};}function removeEntity(_0x31ca24,_0x57bad5){return function(_0x3c4e0a){if(_0x3c4e0a){return _0x3c4e0a[_0x7577('0x25')]()['then'](function(){var _0x370013=_0x3c4e0a[_0x7577('0x26')]({'plain':!![]});var _0x4feca7='Sounds';return db[_0x7577('0x27')][_0x7577('0x25')]({'where':{'type':_0x4feca7,'resourceId':_0x370013['id']}})[_0x7577('0x24')](function(){return _0x3c4e0a;});})[_0x7577('0x24')](function(){_0x31ca24[_0x7577('0x1b')](0xcc)[_0x7577('0x28')]();});}};}function handleEntityNotFound(_0x3e7f79,_0x2692d8){return function(_0x5e9ec5){if(!_0x5e9ec5){_0x3e7f79[_0x7577('0x1a')](0x194);}return _0x5e9ec5;};}function handleError(_0x549407,_0x4f6e83){_0x4f6e83=_0x4f6e83||0x1f4;return function(_0x480b70){logger[_0x7577('0x29')](_0x480b70[_0x7577('0x2a')]);if(_0x480b70[_0x7577('0x2b')]){delete _0x480b70[_0x7577('0x2b')];}_0x549407[_0x7577('0x1b')](_0x4f6e83)[_0x7577('0x2c')](_0x480b70);};}exports[_0x7577('0x2d')]=function(_0x3fab67,_0x4243e5){var _0x492559={},_0x2e7186={},_0x2a0091={'count':0x0,'rows':[]};var _0x20c958=_[_0x7577('0x2e')](db[_0x7577('0x2f')][_0x7577('0x30')],function(_0xb51284){return{'name':_0xb51284[_0x7577('0x31')],'type':_0xb51284[_0x7577('0x32')]['key']};});_0x2e7186[_0x7577('0x33')]=_[_0x7577('0x2e')](_0x20c958,_0x7577('0x2b'));_0x2e7186[_0x7577('0x34')]=_[_0x7577('0x35')](_0x3fab67[_0x7577('0x34')]);_0x2e7186[_0x7577('0x36')]=_['intersection'](_0x2e7186[_0x7577('0x33')],_0x2e7186[_0x7577('0x34')]);_0x492559[_0x7577('0x37')]=_[_0x7577('0x38')](_0x2e7186[_0x7577('0x33')],qs[_0x7577('0x39')](_0x3fab67[_0x7577('0x34')][_0x7577('0x39')]));_0x492559[_0x7577('0x37')]=_0x492559['attributes'][_0x7577('0x3a')]?_0x492559[_0x7577('0x37')]:_0x2e7186[_0x7577('0x33')];if(!_0x3fab67[_0x7577('0x34')][_0x7577('0x3b')](_0x7577('0x3c'))){_0x492559[_0x7577('0x1d')]=qs[_0x7577('0x1d')](_0x3fab67['query'][_0x7577('0x1d')]);_0x492559[_0x7577('0x1c')]=qs['offset'](_0x3fab67[_0x7577('0x34')][_0x7577('0x1c')]);}_0x492559[_0x7577('0x3d')]=qs[_0x7577('0x3e')](_0x3fab67['query'][_0x7577('0x3e')]);_0x492559[_0x7577('0x3f')]=qs[_0x7577('0x36')](_[_0x7577('0x40')](_0x3fab67[_0x7577('0x34')],_0x2e7186['filters']),_0x20c958);if(_0x3fab67[_0x7577('0x34')][_0x7577('0x41')]){_0x492559['where']=_['merge'](_0x492559[_0x7577('0x3f')],{'$or':_[_0x7577('0x2e')](_0x20c958,function(_0x258faf){if(_0x258faf[_0x7577('0x32')]!==_0x7577('0x42')){var _0x2d70e2={};_0x2d70e2[_0x258faf[_0x7577('0x2b')]]={'$like':'%'+_0x3fab67[_0x7577('0x34')][_0x7577('0x41')]+'%'};return _0x2d70e2;}})});}_0x492559=_[_0x7577('0x43')]({},_0x492559,_0x3fab67[_0x7577('0x44')]);var _0x5713df={'where':_0x492559[_0x7577('0x3f')]};return db[_0x7577('0x2f')][_0x7577('0x1f')](_0x5713df)[_0x7577('0x24')](function(_0x3dcb6b){_0x2a0091[_0x7577('0x1f')]=_0x3dcb6b;if(_0x3fab67[_0x7577('0x34')][_0x7577('0x45')]){_0x492559[_0x7577('0x46')]=[{'all':!![]}];}return db[_0x7577('0x2f')]['findAll'](_0x492559);})[_0x7577('0x24')](function(_0x51b803){_0x2a0091[_0x7577('0x47')]=_0x51b803;return _0x2a0091;})['then'](respondWithFilteredResult(_0x4243e5,_0x492559))[_0x7577('0x48')](handleError(_0x4243e5,null));};exports[_0x7577('0x49')]=function(_0xf18c33,_0x4f93e9){var _0x53bb2d={'raw':!![],'where':{'id':_0xf18c33[_0x7577('0x4a')]['id']}},_0x59423f={};_0x59423f[_0x7577('0x33')]=_[_0x7577('0x35')](db['Sound'][_0x7577('0x30')]);_0x59423f[_0x7577('0x34')]=_[_0x7577('0x35')](_0xf18c33['query']);_0x59423f[_0x7577('0x36')]=_[_0x7577('0x38')](_0x59423f[_0x7577('0x33')],_0x59423f['query']);_0x53bb2d[_0x7577('0x37')]=_[_0x7577('0x38')](_0x59423f[_0x7577('0x33')],qs['fields'](_0xf18c33[_0x7577('0x34')][_0x7577('0x39')]));_0x53bb2d[_0x7577('0x37')]=_0x53bb2d[_0x7577('0x37')][_0x7577('0x3a')]?_0x53bb2d['attributes']:_0x59423f['model'];if(_0xf18c33['query']['includeAll']){_0x53bb2d[_0x7577('0x46')]=[{'all':!![]}];}_0x53bb2d=_[_0x7577('0x43')]({},_0x53bb2d,_0xf18c33[_0x7577('0x44')]);return db[_0x7577('0x2f')][_0x7577('0x4b')](_0x53bb2d)[_0x7577('0x24')](handleEntityNotFound(_0x4f93e9,null))[_0x7577('0x24')](respondWithResult(_0x4f93e9,null))[_0x7577('0x48')](handleError(_0x4f93e9,null));};exports[_0x7577('0x4c')]=function(_0x2705e0,_0x3057c2,_0x196c52){return db[_0x7577('0x2f')][_0x7577('0x4b')]({'where':{'id':_0x2705e0['params']['id']},'attributes':[_0x7577('0x2b'),_0x7577('0x4d'),_0x7577('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x3057c2,null))['then'](function(_0x11a123){if(_0x11a123){if(!fs[_0x7577('0x4f')](path[_0x7577('0x50')](config[_0x7577('0x51')],_0x7577('0x52'),_0x11a123[_0x7577('0x4d')]+'.'+_0x11a123[_0x7577('0x4e')]))){throw new db[(_0x7577('0x53'))][(_0x7577('0x54'))](_0x7577('0x55'));}return _0x3057c2[_0x7577('0x4c')](path[_0x7577('0x50')](config[_0x7577('0x51')],_0x7577('0x52'),util[_0x7577('0x56')](_0x7577('0x57'),_0x11a123[_0x7577('0x4d')],_0x11a123['converted_format'])),util[_0x7577('0x56')](_0x7577('0x57'),_0x11a123['name'],_0x11a123['converted_format']));}return null;})[_0x7577('0x48')](handleError(_0x3057c2,null));};exports[_0x7577('0x58')]=function(_0x16da99,_0x54747b,_0x4d50d8){var _0x16164a={'name':path[_0x7577('0x59')](_0x16da99[_0x7577('0x5a')][_0x7577('0x5b')],path[_0x7577('0x5c')](_0x16da99[_0x7577('0x5a')]['originalname'])),'save_name':path[_0x7577('0x59')](_0x16da99[_0x7577('0x5a')][_0x7577('0x5d')],path['extname'](_0x16da99[_0x7577('0x5a')]['filename'])),'original_format':path['extname'](_0x16da99['file']['originalname'])[_0x7577('0x5e')](0x1),'converted_format':_0x7577('0x5f')};var _0x30f9b5=path[_0x7577('0x50')](config[_0x7577('0x51')],_0x7577('0x60'),_0x16da99[_0x7577('0x5a')][_0x7577('0x5d')]);var _0x3164cc=path[_0x7577('0x50')](config[_0x7577('0x51')],_0x7577('0x52'),util['format'](_0x7577('0x57'),path['basename'](_0x16da99[_0x7577('0x5a')][_0x7577('0x5d')],path[_0x7577('0x5c')](_0x16da99[_0x7577('0x5a')]['filename'])),_0x16164a[_0x7577('0x4e')]));logger[_0x7577('0x61')](_0x7577('0x62'),_0x30f9b5);logger[_0x7577('0x61')](_0x7577('0x63'),_0x3164cc);try{fs[_0x7577('0x64')](_0x30f9b5,parseInt(_0x7577('0x65'),0x8));var _0x413e46=sox[_0x7577('0x66')](_0x30f9b5,_0x3164cc,{'sampleRate':0x1f40,'format':_0x7577('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x413e46['on'](_0x7577('0x29'),function(_0xa41d6){fs['unlinkSync'](_0x30f9b5);_0x54747b[_0x7577('0x1b')](0x1f4)[_0x7577('0x2c')](_0xa41d6);});_0x413e46['on'](_0x7577('0x67'),function(_0x142094){_0x16164a['original_duration']=isNaN(_0x142094[_0x7577('0x68')])?null:_0x142094[_0x7577('0x68')]*0x3e8;_0x16164a[_0x7577('0x69')]=isNaN(_0x142094[_0x7577('0x6a')])?null:_0x142094[_0x7577('0x6a')];_0x16164a['original_channelCount']=isNaN(_0x142094[_0x7577('0x6b')])?null:_0x142094[_0x7577('0x6b')];_0x16164a[_0x7577('0x6c')]=isNaN(_0x142094[_0x7577('0x6d')])?null:_0x142094[_0x7577('0x6d')];_0x16164a['original_sampleRate']=isNaN(_0x142094[_0x7577('0x6e')])?null:_0x142094[_0x7577('0x6e')];});_0x413e46['on'](_0x7577('0x6f'),function(_0x5189a4){_0x16164a[_0x7577('0x70')]=isNaN(_0x5189a4['duration'])?null:_0x5189a4[_0x7577('0x68')]*0x3e8;_0x16164a[_0x7577('0x71')]=isNaN(_0x5189a4[_0x7577('0x6a')])?null:_0x5189a4[_0x7577('0x6a')];_0x16164a[_0x7577('0x72')]=isNaN(_0x5189a4['channelCount'])?null:_0x5189a4[_0x7577('0x6b')];_0x16164a['converted_bitRate']=isNaN(_0x5189a4[_0x7577('0x6d')])?null:_0x5189a4[_0x7577('0x6d')];_0x16164a[_0x7577('0x73')]=isNaN(_0x5189a4['sampleRate'])?null:_0x5189a4[_0x7577('0x6e')];});_0x413e46['on'](_0x7577('0x28'),function(){fs[_0x7577('0x64')](_0x3164cc,parseInt(_0x7577('0x65'),0x8));return db[_0x7577('0x2f')]['create'](_0x16164a)[_0x7577('0x24')](function(_0x3fa41a){var _0x33e322={'role':_0x16da99[_0x7577('0x74')]['role'],'userProfileId':_0x16da99[_0x7577('0x74')]['userProfileId']};if(!_0x33e322)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33e322[_0x7577('0x75')]===_0x7577('0x76')){var _0x662268=_0x3fa41a['get']({'plain':!![]});return db[_0x7577('0x77')][_0x7577('0x4b')]({'where':{'name':_0x7577('0x78'),'userProfileId':_0x33e322['userProfileId']},'raw':!![]})[_0x7577('0x24')](function(_0x2d594c){if(_0x2d594c&&_0x2d594c['autoAssociation']===0x0){return db[_0x7577('0x27')][_0x7577('0x58')]({'name':_0x662268[_0x7577('0x2b')],'resourceId':_0x662268['id'],'type':_0x2d594c[_0x7577('0x2b')],'sectionId':_0x2d594c['id']},{})['then'](function(){return _0x3fa41a;});}else{return _0x3fa41a;}})[_0x7577('0x48')](function(_0x5e5761){logger[_0x7577('0x29')](_0x7577('0x79'),_0x5e5761);throw _0x5e5761;});}return _0x3fa41a;})[_0x7577('0x24')](respondWithResult(_0x54747b,null))[_0x7577('0x48')](handleError(_0x54747b,null));});_0x413e46[_0x7577('0x7a')]();}catch(_0x27a796){_0x54747b['status'](0x1f4)[_0x7577('0x2c')](_0x27a796);}};exports[_0x7577('0x23')]=function(_0x564924,_0x1f17c4,_0x322178){return db['Sound'][_0x7577('0x4b')]({'where':{'id':_0x564924[_0x7577('0x4a')]['id']}})[_0x7577('0x24')](handleEntityNotFound(_0x1f17c4,null))[_0x7577('0x24')](saveUpdates(_[_0x7577('0x40')](_0x564924[_0x7577('0x74')],[_0x7577('0x2b'),'description']),null))['then'](respondWithResult(_0x1f17c4,null))['catch'](handleError(_0x1f17c4,null));};exports['delete']=function(_0x27c49d,_0x1400f1,_0xfa8662){return db[_0x7577('0x2f')]['find']({'where':{'id':_0x27c49d[_0x7577('0x4a')]['id']}})[_0x7577('0x24')](function(_0x5d68d6){if(_0x5d68d6){return _0x5d68d6[_0x7577('0x25')]();}})[_0x7577('0x24')](function(_0x2144b5){var _0x1bcd79=path[_0x7577('0x50')](config[_0x7577('0x51')],_0x7577('0x60'),util['format']('%s.%s',_0x2144b5[_0x7577('0x4d')],_0x2144b5[_0x7577('0x7b')]));var _0x4beeae=path[_0x7577('0x50')](config['root'],_0x7577('0x52'),util['format'](_0x7577('0x57'),_0x2144b5[_0x7577('0x4d')],_0x2144b5[_0x7577('0x4e')]));fs[_0x7577('0x7c')](_0x1bcd79);fs[_0x7577('0x7c')](_0x4beeae);return _0x2144b5;})['then'](function(_0x3be8e1){if(_0x3be8e1){return _0x1400f1[_0x7577('0x1b')](0xcc)[_0x7577('0x28')]();}})['then'](handleEntityNotFound(_0x1400f1,null))[_0x7577('0x48')](handleError(_0x1400f1,null));}; \ No newline at end of file +var _0xba5a=['root','format','%s.%s','create','originalname','extname','basename','file','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xba5a,0x1b1));var _0xaba5=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xba5a[_0x1dd532];return _0x3732aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaba5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaba5('0x1'));var rp=require(_0xaba5('0x2'));var moment=require(_0xaba5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaba5('0x4'));var path=require(_0xaba5('0x5'));var sox=require(_0xaba5('0x6'));var csv=require(_0xaba5('0x7'));var ejs=require(_0xaba5('0x8'));var fs=require('fs');var fs_extra=require(_0xaba5('0x9'));var _=require('lodash');var squel=require(_0xaba5('0xa'));var crypto=require(_0xaba5('0xb'));var jsforce=require(_0xaba5('0xc'));var deskjs=require(_0xaba5('0xd'));var toCsv=require(_0xaba5('0x7'));var querystring=require(_0xaba5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaba5('0xf'));var qs=require(_0xaba5('0x10'));var as=require(_0xaba5('0x11'));var hardwareService=require(_0xaba5('0x12'));var logger=require(_0xaba5('0x13'))(_0xaba5('0x14'));var utils=require(_0xaba5('0x15'));var config=require(_0xaba5('0x16'));var licenseUtil=require(_0xaba5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bcf0,_0x299080){_0x299080=_0x299080||0xcc;return function(_0x3b2a47){if(_0x3b2a47){return _0x54bcf0[_0xaba5('0x18')](_0x299080);}return _0x54bcf0[_0xaba5('0x19')](_0x299080)[_0xaba5('0x1a')]();};}function respondWithResult(_0xf78084,_0x50e0fe){_0x50e0fe=_0x50e0fe||0xc8;return function(_0x63bd39){if(_0x63bd39){return _0xf78084[_0xaba5('0x19')](_0x50e0fe)[_0xaba5('0x1b')](_0x63bd39);}};}function respondWithFilteredResult(_0x2794eb,_0x4a211){return function(_0x4a7043){if(_0x4a7043){var _0x33c131=typeof _0x4a211[_0xaba5('0x1c')]===_0xaba5('0x1d')&&typeof _0x4a211[_0xaba5('0x1e')]==='undefined';var _0x255f9f=_0x4a7043['count'];var _0x220676=_0x33c131?0x0:_0x4a211['offset'];var _0x1cbe18=_0x33c131?_0x4a7043[_0xaba5('0x1f')]:_0x4a211[_0xaba5('0x1c')]+_0x4a211['limit'];var _0x8034e1;if(_0x1cbe18>=_0x255f9f){_0x1cbe18=_0x255f9f;_0x8034e1=0xc8;}else{_0x8034e1=0xce;}_0x2794eb[_0xaba5('0x19')](_0x8034e1);return _0x2794eb[_0xaba5('0x20')]('Content-Range',_0x220676+'-'+_0x1cbe18+'/'+_0x255f9f)[_0xaba5('0x1b')](_0x4a7043);}return null;};}function patchUpdates(_0xd77007){return function(_0xab073d){try{jsonpatch[_0xaba5('0x21')](_0xab073d,_0xd77007,!![]);}catch(_0x568c22){return BPromise[_0xaba5('0x22')](_0x568c22);}return _0xab073d[_0xaba5('0x23')]();};}function saveUpdates(_0x2d55b9,_0x5da2de){return function(_0x1d2770){if(_0x1d2770){return _0x1d2770[_0xaba5('0x24')](_0x2d55b9)[_0xaba5('0x25')](function(_0x44df78){return _0x44df78;});}return null;};}function removeEntity(_0x11ea76,_0x17b9aa){return function(_0x254682){if(_0x254682){return _0x254682['destroy']()[_0xaba5('0x25')](function(){var _0x3a9023=_0x254682[_0xaba5('0x26')]({'plain':!![]});var _0x4c2ee3='Sounds';return db['UserProfileResource'][_0xaba5('0x27')]({'where':{'type':_0x4c2ee3,'resourceId':_0x3a9023['id']}})[_0xaba5('0x25')](function(){return _0x254682;});})[_0xaba5('0x25')](function(){_0x11ea76[_0xaba5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240827,_0x401b48){return function(_0xfdad7a){if(!_0xfdad7a){_0x240827[_0xaba5('0x18')](0x194);}return _0xfdad7a;};}function handleError(_0x4d9025,_0x248816){_0x248816=_0x248816||0x1f4;return function(_0x433a5d){logger[_0xaba5('0x28')](_0x433a5d[_0xaba5('0x29')]);if(_0x433a5d[_0xaba5('0x2a')]){delete _0x433a5d[_0xaba5('0x2a')];}_0x4d9025[_0xaba5('0x19')](_0x248816)[_0xaba5('0x2b')](_0x433a5d);};}exports[_0xaba5('0x2c')]=function(_0x5138a9,_0x75baea){var _0x24cf1b={},_0x51bb85={},_0x4986ff={'count':0x0,'rows':[]};var _0x3996a5=_['map'](db[_0xaba5('0x2d')][_0xaba5('0x2e')],function(_0x5aebb5){return{'name':_0x5aebb5[_0xaba5('0x2f')],'type':_0x5aebb5[_0xaba5('0x30')][_0xaba5('0x31')]};});_0x51bb85[_0xaba5('0x32')]=_[_0xaba5('0x33')](_0x3996a5,'name');_0x51bb85['query']=_[_0xaba5('0x34')](_0x5138a9[_0xaba5('0x35')]);_0x51bb85['filters']=_[_0xaba5('0x36')](_0x51bb85['model'],_0x51bb85[_0xaba5('0x35')]);_0x24cf1b[_0xaba5('0x37')]=_[_0xaba5('0x36')](_0x51bb85[_0xaba5('0x32')],qs[_0xaba5('0x38')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x38')]));_0x24cf1b[_0xaba5('0x37')]=_0x24cf1b[_0xaba5('0x37')][_0xaba5('0x39')]?_0x24cf1b[_0xaba5('0x37')]:_0x51bb85[_0xaba5('0x32')];if(!_0x5138a9[_0xaba5('0x35')]['hasOwnProperty'](_0xaba5('0x3a'))){_0x24cf1b[_0xaba5('0x1e')]=qs[_0xaba5('0x1e')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x1e')]);_0x24cf1b[_0xaba5('0x1c')]=qs['offset'](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x1c')]);}_0x24cf1b[_0xaba5('0x3b')]=qs[_0xaba5('0x3c')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x3c')]);_0x24cf1b[_0xaba5('0x3d')]=qs[_0xaba5('0x3e')](_[_0xaba5('0x3f')](_0x5138a9['query'],_0x51bb85[_0xaba5('0x3e')]),_0x3996a5);if(_0x5138a9[_0xaba5('0x35')][_0xaba5('0x40')]){_0x24cf1b[_0xaba5('0x3d')]=_[_0xaba5('0x41')](_0x24cf1b[_0xaba5('0x3d')],{'$or':_[_0xaba5('0x33')](_0x3996a5,function(_0x284651){if(_0x284651['type']!==_0xaba5('0x42')){var _0x3d6d3d={};_0x3d6d3d[_0x284651[_0xaba5('0x2a')]]={'$like':'%'+_0x5138a9[_0xaba5('0x35')][_0xaba5('0x40')]+'%'};return _0x3d6d3d;}})});}_0x24cf1b=_['merge']({},_0x24cf1b,_0x5138a9[_0xaba5('0x43')]);var _0x9195bc={'where':_0x24cf1b[_0xaba5('0x3d')]};return db[_0xaba5('0x2d')][_0xaba5('0x1f')](_0x9195bc)[_0xaba5('0x25')](function(_0xa2ec58){_0x4986ff[_0xaba5('0x1f')]=_0xa2ec58;if(_0x5138a9[_0xaba5('0x35')][_0xaba5('0x44')]){_0x24cf1b[_0xaba5('0x45')]=[{'all':!![]}];}return db['Sound'][_0xaba5('0x46')](_0x24cf1b);})[_0xaba5('0x25')](function(_0x39be3b){_0x4986ff[_0xaba5('0x47')]=_0x39be3b;return _0x4986ff;})[_0xaba5('0x25')](respondWithFilteredResult(_0x75baea,_0x24cf1b))['catch'](handleError(_0x75baea,null));};exports['show']=function(_0x476147,_0x3d388a){var _0xe59101={'raw':!![],'where':{'id':_0x476147[_0xaba5('0x48')]['id']}},_0x52ccb0={};_0x52ccb0[_0xaba5('0x32')]=_[_0xaba5('0x34')](db[_0xaba5('0x2d')][_0xaba5('0x2e')]);_0x52ccb0[_0xaba5('0x35')]=_[_0xaba5('0x34')](_0x476147[_0xaba5('0x35')]);_0x52ccb0[_0xaba5('0x3e')]=_[_0xaba5('0x36')](_0x52ccb0[_0xaba5('0x32')],_0x52ccb0[_0xaba5('0x35')]);_0xe59101[_0xaba5('0x37')]=_['intersection'](_0x52ccb0[_0xaba5('0x32')],qs[_0xaba5('0x38')](_0x476147['query'][_0xaba5('0x38')]));_0xe59101[_0xaba5('0x37')]=_0xe59101['attributes'][_0xaba5('0x39')]?_0xe59101[_0xaba5('0x37')]:_0x52ccb0[_0xaba5('0x32')];if(_0x476147['query'][_0xaba5('0x44')]){_0xe59101['include']=[{'all':!![]}];}_0xe59101=_['merge']({},_0xe59101,_0x476147[_0xaba5('0x43')]);return db['Sound'][_0xaba5('0x49')](_0xe59101)['then'](handleEntityNotFound(_0x3d388a,null))['then'](respondWithResult(_0x3d388a,null))[_0xaba5('0x4a')](handleError(_0x3d388a,null));};exports['download']=function(_0x1cfd12,_0xabd6ef,_0x332c3e){return db['Sound'][_0xaba5('0x49')]({'where':{'id':_0x1cfd12['params']['id']},'attributes':[_0xaba5('0x2a'),_0xaba5('0x4b'),_0xaba5('0x4c')],'raw':!![]})[_0xaba5('0x25')](handleEntityNotFound(_0xabd6ef,null))[_0xaba5('0x25')](function(_0xe64d31){if(_0xe64d31){if(!fs[_0xaba5('0x4d')](path['join'](config['root'],_0xaba5('0x4e'),_0xe64d31[_0xaba5('0x4b')]+'.'+_0xe64d31[_0xaba5('0x4c')]))){throw new db[(_0xaba5('0x4f'))]['ValidationError'](_0xaba5('0x50'));}return _0xabd6ef[_0xaba5('0x51')](path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x4e'),util[_0xaba5('0x54')]('%s.%s',_0xe64d31['save_name'],_0xe64d31['converted_format'])),util['format'](_0xaba5('0x55'),_0xe64d31[_0xaba5('0x2a')],_0xe64d31[_0xaba5('0x4c')]));}return null;})[_0xaba5('0x4a')](handleError(_0xabd6ef,null));};exports[_0xaba5('0x56')]=function(_0x2fee70,_0x17f350,_0x5a346b){var _0x1fbf7f={'name':path['basename'](_0x2fee70['file'][_0xaba5('0x57')],path[_0xaba5('0x58')](_0x2fee70['file'][_0xaba5('0x57')])),'save_name':path[_0xaba5('0x59')](_0x2fee70[_0xaba5('0x5a')]['filename'],path[_0xaba5('0x58')](_0x2fee70['file']['filename'])),'original_format':path[_0xaba5('0x58')](_0x2fee70[_0xaba5('0x5a')]['originalname'])[_0xaba5('0x5b')](0x1),'converted_format':_0xaba5('0x5c')};var _0xf80a21=path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x5d'),_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')]);var _0x3bc7ff=path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x4e'),util[_0xaba5('0x54')]('%s.%s',path[_0xaba5('0x59')](_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')],path[_0xaba5('0x58')](_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')])),_0x1fbf7f[_0xaba5('0x4c')]));logger[_0xaba5('0x5f')](_0xaba5('0x60'),_0xf80a21);logger[_0xaba5('0x5f')](_0xaba5('0x61'),_0x3bc7ff);try{fs[_0xaba5('0x62')](_0xf80a21,parseInt(_0xaba5('0x63'),0x8));var _0x13ce5d=sox[_0xaba5('0x64')](_0xf80a21,_0x3bc7ff,{'sampleRate':0x1f40,'format':_0xaba5('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13ce5d['on'](_0xaba5('0x28'),function(_0xdcac21){fs[_0xaba5('0x65')](_0xf80a21);_0x17f350[_0xaba5('0x19')](0x1f4)[_0xaba5('0x2b')](_0xdcac21);});_0x13ce5d['on']('src',function(_0x1afec2){_0x1fbf7f[_0xaba5('0x66')]=isNaN(_0x1afec2[_0xaba5('0x67')])?null:_0x1afec2[_0xaba5('0x67')]*0x3e8;_0x1fbf7f[_0xaba5('0x68')]=isNaN(_0x1afec2['sampleCount'])?null:_0x1afec2[_0xaba5('0x69')];_0x1fbf7f['original_channelCount']=isNaN(_0x1afec2[_0xaba5('0x6a')])?null:_0x1afec2['channelCount'];_0x1fbf7f[_0xaba5('0x6b')]=isNaN(_0x1afec2[_0xaba5('0x6c')])?null:_0x1afec2[_0xaba5('0x6c')];_0x1fbf7f[_0xaba5('0x6d')]=isNaN(_0x1afec2[_0xaba5('0x6e')])?null:_0x1afec2[_0xaba5('0x6e')];});_0x13ce5d['on'](_0xaba5('0x6f'),function(_0x5ec6a5){_0x1fbf7f[_0xaba5('0x70')]=isNaN(_0x5ec6a5[_0xaba5('0x67')])?null:_0x5ec6a5[_0xaba5('0x67')]*0x3e8;_0x1fbf7f['converted_sampleCount']=isNaN(_0x5ec6a5['sampleCount'])?null:_0x5ec6a5['sampleCount'];_0x1fbf7f[_0xaba5('0x71')]=isNaN(_0x5ec6a5[_0xaba5('0x6a')])?null:_0x5ec6a5[_0xaba5('0x6a')];_0x1fbf7f[_0xaba5('0x72')]=isNaN(_0x5ec6a5[_0xaba5('0x6c')])?null:_0x5ec6a5[_0xaba5('0x6c')];_0x1fbf7f[_0xaba5('0x73')]=isNaN(_0x5ec6a5[_0xaba5('0x6e')])?null:_0x5ec6a5['sampleRate'];});_0x13ce5d['on'](_0xaba5('0x1a'),function(){fs[_0xaba5('0x62')](_0x3bc7ff,parseInt(_0xaba5('0x63'),0x8));return db[_0xaba5('0x2d')][_0xaba5('0x56')](_0x1fbf7f)[_0xaba5('0x25')](function(_0x4a950e){var _0x2911f6={'role':_0x2fee70[_0xaba5('0x74')][_0xaba5('0x75')],'userProfileId':_0x2fee70[_0xaba5('0x74')][_0xaba5('0x76')]};if(!_0x2911f6)throw new Error(_0xaba5('0x77'));if(_0x2911f6['role']===_0xaba5('0x78')){var _0x1ef569=_0x4a950e[_0xaba5('0x26')]({'plain':!![]});return db[_0xaba5('0x79')]['find']({'where':{'name':_0xaba5('0x7a'),'userProfileId':_0x2911f6[_0xaba5('0x76')]},'raw':!![]})[_0xaba5('0x25')](function(_0x3d5f9b){if(_0x3d5f9b&&_0x3d5f9b[_0xaba5('0x7b')]===0x0){return db[_0xaba5('0x7c')][_0xaba5('0x56')]({'name':_0x1ef569[_0xaba5('0x2a')],'resourceId':_0x1ef569['id'],'type':_0x3d5f9b[_0xaba5('0x2a')],'sectionId':_0x3d5f9b['id']},{})['then'](function(){return _0x4a950e;});}else{return _0x4a950e;}})[_0xaba5('0x4a')](function(_0x1c2ee1){logger[_0xaba5('0x28')](_0xaba5('0x7d'),_0x1c2ee1);throw _0x1c2ee1;});}return _0x4a950e;})['then'](respondWithResult(_0x17f350,null))[_0xaba5('0x4a')](handleError(_0x17f350,null));});_0x13ce5d[_0xaba5('0x7e')]();}catch(_0x55b72b){_0x17f350[_0xaba5('0x19')](0x1f4)[_0xaba5('0x2b')](_0x55b72b);}};exports[_0xaba5('0x24')]=function(_0x2a25ab,_0x7acd84,_0x2a7124){return db[_0xaba5('0x2d')][_0xaba5('0x49')]({'where':{'id':_0x2a25ab['params']['id']}})[_0xaba5('0x25')](handleEntityNotFound(_0x7acd84,null))[_0xaba5('0x25')](saveUpdates(_[_0xaba5('0x3f')](_0x2a25ab[_0xaba5('0x74')],[_0xaba5('0x2a'),'description']),null))['then'](respondWithResult(_0x7acd84,null))[_0xaba5('0x4a')](handleError(_0x7acd84,null));};exports[_0xaba5('0x7f')]=function(_0x4dbe4f,_0x59b1f1,_0x19cdfd){return db['Sound'][_0xaba5('0x49')]({'where':{'id':_0x4dbe4f[_0xaba5('0x48')]['id']}})['then'](function(_0x1d08e5){if(_0x1d08e5){return _0x1d08e5[_0xaba5('0x27')]();}})['then'](function(_0xd3a5de){var _0x11813b=path['join'](config[_0xaba5('0x53')],_0xaba5('0x5d'),util[_0xaba5('0x54')]('%s.%s',_0xd3a5de['save_name'],_0xd3a5de[_0xaba5('0x80')]));var _0x29992a=path['join'](config[_0xaba5('0x53')],_0xaba5('0x4e'),util['format'](_0xaba5('0x55'),_0xd3a5de[_0xaba5('0x4b')],_0xd3a5de['converted_format']));fs[_0xaba5('0x65')](_0x11813b);fs[_0xaba5('0x65')](_0x29992a);return _0xd3a5de;})[_0xaba5('0x25')](function(_0x17b4aa){if(_0x17b4aa){return _0x59b1f1[_0xaba5('0x19')](0xcc)[_0xaba5('0x1a')]();}})['then'](handleEntityNotFound(_0x59b1f1,null))['catch'](handleError(_0x59b1f1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f84716d..5b18795 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 _0x6195=['bluebird','path','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0x6195,0x73));var _0x5619=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0x6195[_0x1f38c6];return _0x259367;};'use strict';var _=require(_0x5619('0x0'));var util=require(_0x5619('0x1'));var logger=require(_0x5619('0x2'))(_0x5619('0x3'));var moment=require(_0x5619('0x4'));var BPromise=require(_0x5619('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5619('0x6'));var rimraf=require('rimraf');var config=require(_0x5619('0x7'));var attributes=require(_0x5619('0x8'));module['exports']=function(_0x236447,_0x313c16){return _0x236447[_0x5619('0x9')](_0x5619('0xa'),attributes,{'tableName':_0x5619('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe092=['path','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c89ef,_0x296c7e){var _0x517710=function(_0x4fd0e7){while(--_0x4fd0e7){_0x5c89ef['push'](_0x5c89ef['shift']());}};_0x517710(++_0x296c7e);}(_0xe092,0x1c1));var _0x2e09=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xe092[_0x1bc013];return _0x55df36;};'use strict';var _=require('lodash');var util=require(_0x2e09('0x0'));var logger=require(_0x2e09('0x1'))(_0x2e09('0x2'));var moment=require(_0x2e09('0x3'));var BPromise=require(_0x2e09('0x4'));var rp=require(_0x2e09('0x5'));var fs=require('fs');var path=require(_0x2e09('0x6'));var rimraf=require('rimraf');var config=require(_0x2e09('0x7'));var attributes=require(_0x2e09('0x8'));module[_0x2e09('0x9')]=function(_0x2318c8,_0x4d0c33){return _0x2318c8[_0x2e09('0xa')](_0x2e09('0xb'),attributes,{'tableName':_0x2e09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 13f63b0..a2a5d78 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 _0x6d49=['http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound','Sound','find','options','raw','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2ebb21,_0x4bb59a){var _0x52302f=function(_0x26b111){while(--_0x26b111){_0x2ebb21['push'](_0x2ebb21['shift']());}};_0x52302f(++_0x4bb59a);}(_0x6d49,0x1a2));var _0x96d4=function(_0x260b33,_0x5942a1){_0x260b33=_0x260b33-0x0;var _0x115576=_0x6d49[_0x260b33];return _0x115576;};'use strict';var _=require(_0x96d4('0x0'));var util=require(_0x96d4('0x1'));var moment=require(_0x96d4('0x2'));var BPromise=require(_0x96d4('0x3'));var rs=require(_0x96d4('0x4'));var fs=require('fs');var Redis=require(_0x96d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96d4('0x6'));var logger=require(_0x96d4('0x7'))(_0x96d4('0x8'));var config=require('../../config/environment');var jayson=require(_0x96d4('0x9'));var client=jayson[_0x96d4('0xa')][_0x96d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x372eb9,_0x40067b,_0xea2689){return new BPromise(function(_0x2a5239,_0x27109c){return client[_0x96d4('0xc')](_0x372eb9,_0xea2689)['then'](function(_0x4b1d2c){logger[_0x96d4('0xd')](_0x96d4('0xe'),_0x40067b,_0x96d4('0xf'));logger[_0x96d4('0x10')](_0x96d4('0x11'),_0x40067b,_0x96d4('0xf'),JSON[_0x96d4('0x12')](_0x4b1d2c));if(_0x4b1d2c[_0x96d4('0x13')]){if(_0x4b1d2c[_0x96d4('0x13')][_0x96d4('0x14')]===0x1f4){logger[_0x96d4('0x13')](_0x96d4('0xe'),_0x40067b,_0x4b1d2c['error'][_0x96d4('0x15')]);return _0x27109c(_0x4b1d2c[_0x96d4('0x13')]['message']);}logger['error'](_0x96d4('0xe'),_0x40067b,_0x4b1d2c[_0x96d4('0x13')]['message']);return _0x2a5239(_0x4b1d2c[_0x96d4('0x13')][_0x96d4('0x15')]);}else{logger[_0x96d4('0xd')](_0x96d4('0xe'),_0x40067b,'request\x20sent');_0x2a5239(_0x4b1d2c['result'][_0x96d4('0x15')]);}})[_0x96d4('0x16')](function(_0x5d7055){logger[_0x96d4('0x13')](_0x96d4('0xe'),_0x40067b,_0x5d7055);_0x27109c(_0x5d7055);});});}exports[_0x96d4('0x17')]=function(_0x577d1e){var _0x18a121=this;return new Promise(function(_0xb6384d,_0x4f5cb2){return db[_0x96d4('0x18')][_0x96d4('0x19')]({'raw':_0x577d1e['options']?_0x577d1e[_0x96d4('0x1a')][_0x96d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x577d1e[_0x96d4('0x1a')]?_0x577d1e[_0x96d4('0x1a')]['where']||null:null,'attributes':_0x577d1e['options']?_0x577d1e[_0x96d4('0x1a')][_0x96d4('0x1c')]||null:null,'include':_0x577d1e[_0x96d4('0x1a')]?_0x577d1e['options']['include']?_[_0x96d4('0x1d')](_0x577d1e[_0x96d4('0x1a')][_0x96d4('0x1e')],function(_0x1f9db5){return{'model':db[_0x1f9db5[_0x96d4('0x1f')]],'as':_0x1f9db5['as'],'attributes':_0x1f9db5[_0x96d4('0x1c')],'include':_0x1f9db5[_0x96d4('0x1e')]?_[_0x96d4('0x1d')](_0x1f9db5[_0x96d4('0x1e')],function(_0x4b4585){return{'model':db[_0x4b4585[_0x96d4('0x1f')]],'as':_0x4b4585['as'],'attributes':_0x4b4585[_0x96d4('0x1c')],'include':_0x4b4585[_0x96d4('0x1e')]?_[_0x96d4('0x1d')](_0x4b4585[_0x96d4('0x1e')],function(_0x30ac16){return{'model':db[_0x30ac16[_0x96d4('0x1f')]],'as':_0x30ac16['as'],'attributes':_0x30ac16[_0x96d4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x96d4('0x20')](function(_0x56c1c0){logger[_0x96d4('0xd')](_0x96d4('0x17'),_0x577d1e);logger['debug'](_0x96d4('0x17'),_0x577d1e,JSON[_0x96d4('0x12')](_0x56c1c0));_0xb6384d(_0x56c1c0);})[_0x96d4('0x16')](function(_0x356c81){logger[_0x96d4('0x13')](_0x96d4('0x17'),_0x356c81['message'],_0x577d1e);_0x4f5cb2(_0x18a121[_0x96d4('0x13')](0x1f4,_0x356c81[_0x96d4('0x15')]));});});}; \ No newline at end of file +var _0xa3c9=['find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3c9,0x147));var _0x9a3c=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xa3c9[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0x9a3c('0x0'));var util=require(_0x9a3c('0x1'));var moment=require(_0x9a3c('0x2'));var BPromise=require(_0x9a3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a3c('0x4'))['db'];var utils=require(_0x9a3c('0x5'));var logger=require('../../config/logger')(_0x9a3c('0x6'));var config=require(_0x9a3c('0x7'));var jayson=require(_0x9a3c('0x8'));var client=jayson['client'][_0x9a3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x225268,_0x3c13ae,_0x5f1456){return new BPromise(function(_0x4415da,_0x6ede54){return client['request'](_0x225268,_0x5f1456)[_0x9a3c('0xa')](function(_0x42cc30){logger['info'](_0x9a3c('0xb'),_0x3c13ae,_0x9a3c('0xc'));logger[_0x9a3c('0xd')](_0x9a3c('0xe'),_0x3c13ae,_0x9a3c('0xc'),JSON[_0x9a3c('0xf')](_0x42cc30));if(_0x42cc30['error']){if(_0x42cc30[_0x9a3c('0x10')][_0x9a3c('0x11')]===0x1f4){logger[_0x9a3c('0x10')](_0x9a3c('0xb'),_0x3c13ae,_0x42cc30[_0x9a3c('0x10')]['message']);return _0x6ede54(_0x42cc30['error'][_0x9a3c('0x12')]);}logger[_0x9a3c('0x10')](_0x9a3c('0xb'),_0x3c13ae,_0x42cc30[_0x9a3c('0x10')][_0x9a3c('0x12')]);return _0x4415da(_0x42cc30['error'][_0x9a3c('0x12')]);}else{logger[_0x9a3c('0x13')]('Sound,\x20%s,\x20%s',_0x3c13ae,_0x9a3c('0xc'));_0x4415da(_0x42cc30['result'][_0x9a3c('0x12')]);}})['catch'](function(_0x13d515){logger['error']('Sound,\x20%s,\x20%s',_0x3c13ae,_0x13d515);_0x6ede54(_0x13d515);});});}exports[_0x9a3c('0x14')]=function(_0x41e6b0){var _0xf68bcd=this;return new Promise(function(_0x2a3cf3,_0x4d0956){return db['Sound'][_0x9a3c('0x15')]({'raw':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x17')]===undefined?!![]:![]:!![],'where':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0['options'][_0x9a3c('0x18')]||null:null,'attributes':_0x41e6b0['options']?_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x19')]||null:null,'include':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0[_0x9a3c('0x16')]['include']?_[_0x9a3c('0x1a')](_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x1b')],function(_0x2c1775){return{'model':db[_0x2c1775[_0x9a3c('0x1c')]],'as':_0x2c1775['as'],'attributes':_0x2c1775[_0x9a3c('0x19')],'include':_0x2c1775[_0x9a3c('0x1b')]?_[_0x9a3c('0x1a')](_0x2c1775[_0x9a3c('0x1b')],function(_0x2f32ab){return{'model':db[_0x2f32ab[_0x9a3c('0x1c')]],'as':_0x2f32ab['as'],'attributes':_0x2f32ab[_0x9a3c('0x19')],'include':_0x2f32ab[_0x9a3c('0x1b')]?_[_0x9a3c('0x1a')](_0x2f32ab[_0x9a3c('0x1b')],function(_0x1c80f4){return{'model':db[_0x1c80f4['model']],'as':_0x1c80f4['as'],'attributes':_0x1c80f4[_0x9a3c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb27d45){logger[_0x9a3c('0x13')](_0x9a3c('0x14'),_0x41e6b0);logger[_0x9a3c('0xd')]('ShowSound',_0x41e6b0,JSON[_0x9a3c('0xf')](_0xb27d45));_0x2a3cf3(_0xb27d45);})['catch'](function(_0x730d50){logger[_0x9a3c('0x10')](_0x9a3c('0x14'),_0x730d50[_0x9a3c('0x12')],_0x41e6b0);_0x4d0956(_0xf68bcd[_0x9a3c('0x10')](0x1f4,_0x730d50[_0x9a3c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index affbb3a..c04eb68 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2a75fe,_0x118d67){var _0x3ff551=function(_0x2f7a7d){while(--_0x2f7a7d){_0x2a75fe['push'](_0x2a75fe['shift']());}};_0x3ff551(++_0x118d67);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x5e1f45,_0x45795d){var _0xa9d684=function(_0x3bd8e9){while(--_0x3bd8e9){_0x5e1f45['push'](_0x5e1f45['shift']());}};_0xa9d684(++_0x45795d);}(_0x14a0,0x8e));var _0x014a=function(_0x3c2c1f,_0x4d93d3){_0x3c2c1f=_0x3c2c1f-0x0;var _0x5adf10=_0x14a0[_0x3c2c1f];return _0x5adf10;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1ec4d09..d5f4ff5 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 _0xa9f7=['TEXT','medium','out','sequelize','exports','STRING'];(function(_0x2ead39,_0x1ea6fa){var _0x3e0770=function(_0x2d6391){while(--_0x2d6391){_0x2ead39['push'](_0x2ead39['shift']());}};_0x3e0770(++_0x1ea6fa);}(_0xa9f7,0xc9));var _0x7a9f=function(_0x2a39ab,_0x30bd25){_0x2a39ab=_0x2a39ab-0x0;var _0x1c8442=_0xa9f7[_0x2a39ab];return _0x1c8442;};'use strict';var Sequelize=require(_0x7a9f('0x0'));module[_0x7a9f('0x1')]={'uniqueid':{'type':Sequelize[_0x7a9f('0x2')]},'body':{'type':Sequelize[_0x7a9f('0x3')](_0x7a9f('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7a9f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7a9f('0x2')]},'providerResponse':{'type':Sequelize[_0x7a9f('0x3')]}}; \ No newline at end of file +var _0x649b=['medium','out','STRING','sequelize','exports','TEXT'];(function(_0x2de04e,_0x3c3b69){var _0x4c9797=function(_0x9f00ab){while(--_0x9f00ab){_0x2de04e['push'](_0x2de04e['shift']());}};_0x4c9797(++_0x3c3b69);}(_0x649b,0x81));var _0xb649=function(_0x53317c,_0x4d9520){_0x53317c=_0x53317c-0x0;var _0x20a6c8=_0x649b[_0x53317c];return _0x20a6c8;};'use strict';var Sequelize=require(_0xb649('0x0'));module[_0xb649('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb649('0x2')](_0xb649('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb649('0x4')),'defaultValue':_0xb649('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb649('0x5')]},'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 7395f47..36e5758 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 _0x5525=['to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','catch','params','attributes','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox'];(function(_0x33aca9,_0x54dc27){var _0x59c757=function(_0x1dc448){while(--_0x1dc448){_0x33aca9['push'](_0x33aca9['shift']());}};_0x59c757(++_0x54dc27);}(_0x5525,0x87));var _0x5552=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5525[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5552('0x0'));var rimraf=require(_0x5552('0x1'));var zipdir=require(_0x5552('0x2'));var jsonpatch=require(_0x5552('0x3'));var rp=require(_0x5552('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5552('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5552('0x6'));var csv=require(_0x5552('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5552('0x8'));var _=require(_0x5552('0x9'));var squel=require(_0x5552('0xa'));var crypto=require('crypto');var jsforce=require(_0x5552('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5552('0x7'));var querystring=require(_0x5552('0xc'));var Papa=require(_0x5552('0xd'));var Redis=require(_0x5552('0xe'));var authService=require(_0x5552('0xf'));var qs=require(_0x5552('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5552('0x11'))('api');var utils=require(_0x5552('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5552('0x13'));var db=require(_0x5552('0x14'))['db'];function respondWithStatusCode(_0x5864a6,_0x18942f){_0x18942f=_0x18942f||0xcc;return function(_0x847614){if(_0x847614){return _0x5864a6['sendStatus'](_0x18942f);}return _0x5864a6['status'](_0x18942f)['end']();};}function respondWithResult(_0x5bb292,_0x5c1dd2){_0x5c1dd2=_0x5c1dd2||0xc8;return function(_0x50c108){if(_0x50c108){return _0x5bb292['status'](_0x5c1dd2)[_0x5552('0x15')](_0x50c108);}};}function respondWithFilteredResult(_0x5561a9,_0x54ed06){return function(_0x47760f){if(_0x47760f){var _0x5e78d9=typeof _0x54ed06['offset']===_0x5552('0x16')&&typeof _0x54ed06['limit']===_0x5552('0x16');var _0x35f503=_0x47760f[_0x5552('0x17')];var _0x5325df=_0x5e78d9?0x0:_0x54ed06[_0x5552('0x18')];var _0x3b16e6=_0x5e78d9?_0x47760f[_0x5552('0x17')]:_0x54ed06[_0x5552('0x18')]+_0x54ed06[_0x5552('0x19')];var _0x1b7322;if(_0x3b16e6>=_0x35f503){_0x3b16e6=_0x35f503;_0x1b7322=0xc8;}else{_0x1b7322=0xce;}_0x5561a9[_0x5552('0x1a')](_0x1b7322);return _0x5561a9[_0x5552('0x1b')](_0x5552('0x1c'),_0x5325df+'-'+_0x3b16e6+'/'+_0x35f503)[_0x5552('0x15')](_0x47760f);}return null;};}function patchUpdates(_0xd6c510){return function(_0x1e8131){try{jsonpatch[_0x5552('0x1d')](_0x1e8131,_0xd6c510,!![]);}catch(_0x684833){return BPromise[_0x5552('0x1e')](_0x684833);}return _0x1e8131['save']();};}function saveUpdates(_0xd9a825,_0x333806){return function(_0x1a363a){if(_0x1a363a){return _0x1a363a[_0x5552('0x1f')](_0xd9a825)['then'](function(_0x15ef78){return _0x15ef78;});}return null;};}function removeEntity(_0x36b5ee,_0x58b66f){return function(_0x404e00){if(_0x404e00){return _0x404e00[_0x5552('0x20')]()['then'](function(){_0x36b5ee[_0x5552('0x1a')](0xcc)[_0x5552('0x21')]();});}};}function handleEntityNotFound(_0x351725,_0x9e6b94){return function(_0x596046){if(!_0x596046){_0x351725[_0x5552('0x22')](0x194);}return _0x596046;};}function handleError(_0x5e210e,_0x221d66){_0x221d66=_0x221d66||0x1f4;return function(_0x42c5fd){logger['error'](_0x42c5fd[_0x5552('0x23')]);if(_0x42c5fd['name']){delete _0x42c5fd[_0x5552('0x24')];}_0x5e210e[_0x5552('0x1a')](_0x221d66)[_0x5552('0x25')](_0x42c5fd);};}exports[_0x5552('0x26')]=function(_0x54a9c7,_0x7a298f){var _0x45c42e={},_0x5c0bc0={},_0x1f8b87={'count':0x0,'rows':[]};var _0x1183f9=_[_0x5552('0x27')](db[_0x5552('0x28')][_0x5552('0x29')],function(_0x1a5c2a){return{'name':_0x1a5c2a[_0x5552('0x2a')],'type':_0x1a5c2a[_0x5552('0x2b')][_0x5552('0x2c')]};});_0x5c0bc0[_0x5552('0x2d')]=_[_0x5552('0x27')](_0x1183f9,'name');_0x5c0bc0[_0x5552('0x2e')]=_[_0x5552('0x2f')](_0x54a9c7[_0x5552('0x2e')]);_0x5c0bc0[_0x5552('0x30')]=_[_0x5552('0x31')](_0x5c0bc0['model'],_0x5c0bc0[_0x5552('0x2e')]);_0x45c42e['attributes']=_[_0x5552('0x31')](_0x5c0bc0['model'],qs[_0x5552('0x32')](_0x54a9c7[_0x5552('0x2e')][_0x5552('0x32')]));_0x45c42e['attributes']=_0x45c42e['attributes'][_0x5552('0x33')]?_0x45c42e['attributes']:_0x5c0bc0[_0x5552('0x2d')];if(!_0x54a9c7[_0x5552('0x2e')][_0x5552('0x34')]('nolimit')){_0x45c42e['limit']=qs[_0x5552('0x19')](_0x54a9c7['query'][_0x5552('0x19')]);_0x45c42e[_0x5552('0x18')]=qs['offset'](_0x54a9c7['query']['offset']);}_0x45c42e[_0x5552('0x35')]=qs[_0x5552('0x36')](_0x54a9c7['query']['sort']);_0x45c42e[_0x5552('0x37')]=qs[_0x5552('0x30')](_[_0x5552('0x38')](_0x54a9c7['query'],_0x5c0bc0[_0x5552('0x30')]),_0x1183f9);if(_0x54a9c7[_0x5552('0x2e')][_0x5552('0x39')]){_0x45c42e['where']=_[_0x5552('0x3a')](_0x45c42e[_0x5552('0x37')],{'$or':_[_0x5552('0x27')](_0x1183f9,function(_0x13da1f){if(_0x13da1f[_0x5552('0x2b')]!==_0x5552('0x3b')){var _0xdcff8e={};_0xdcff8e[_0x13da1f['name']]={'$like':'%'+_0x54a9c7[_0x5552('0x2e')][_0x5552('0x39')]+'%'};return _0xdcff8e;}})});}_0x45c42e=_[_0x5552('0x3a')]({},_0x45c42e,_0x54a9c7['options']);var _0x4a57f5={'where':_0x45c42e[_0x5552('0x37')]};return db[_0x5552('0x28')][_0x5552('0x17')](_0x4a57f5)[_0x5552('0x3c')](function(_0x5d4e1f){_0x1f8b87[_0x5552('0x17')]=_0x5d4e1f;if(_0x54a9c7[_0x5552('0x2e')]['includeAll']){_0x45c42e[_0x5552('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x5552('0x3e')](_0x45c42e);})['then'](function(_0x570fcb){_0x1f8b87['rows']=_0x570fcb;return _0x1f8b87;})['then'](respondWithFilteredResult(_0x7a298f,_0x45c42e))[_0x5552('0x3f')](handleError(_0x7a298f,null));};exports['show']=function(_0x5eb45a,_0xeb6e56){var _0x14a2c8={'raw':!![],'where':{'id':_0x5eb45a[_0x5552('0x40')]['id']}},_0x259c3e={};_0x259c3e[_0x5552('0x2d')]=_['keys'](db[_0x5552('0x28')][_0x5552('0x29')]);_0x259c3e[_0x5552('0x2e')]=_[_0x5552('0x2f')](_0x5eb45a[_0x5552('0x2e')]);_0x259c3e[_0x5552('0x30')]=_[_0x5552('0x31')](_0x259c3e[_0x5552('0x2d')],_0x259c3e['query']);_0x14a2c8[_0x5552('0x41')]=_['intersection'](_0x259c3e['model'],qs[_0x5552('0x32')](_0x5eb45a[_0x5552('0x2e')]['fields']));_0x14a2c8[_0x5552('0x41')]=_0x14a2c8[_0x5552('0x41')][_0x5552('0x33')]?_0x14a2c8[_0x5552('0x41')]:_0x259c3e[_0x5552('0x2d')];if(_0x5eb45a[_0x5552('0x2e')][_0x5552('0x42')]){_0x14a2c8[_0x5552('0x3d')]=[{'all':!![]}];}_0x14a2c8=_[_0x5552('0x3a')]({},_0x14a2c8,_0x5eb45a[_0x5552('0x43')]);return db[_0x5552('0x28')][_0x5552('0x44')](_0x14a2c8)['then'](handleEntityNotFound(_0xeb6e56,null))[_0x5552('0x3c')](respondWithResult(_0xeb6e56,null))[_0x5552('0x3f')](handleError(_0xeb6e56,null));};exports['create']=function(_0x2dd592,_0x481309){return db[_0x5552('0x28')][_0x5552('0x45')](_0x2dd592[_0x5552('0x46')],{})[_0x5552('0x3c')](respondWithResult(_0x481309,0xc9))[_0x5552('0x3f')](handleError(_0x481309,null));};exports['update']=function(_0x3262e6,_0x4e1b00){if(_0x3262e6['body']['id']){delete _0x3262e6['body']['id'];}return db['SquareMessage'][_0x5552('0x44')]({'where':{'id':_0x3262e6[_0x5552('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e1b00,null))[_0x5552('0x3c')](saveUpdates(_0x3262e6['body'],null))['then'](respondWithResult(_0x4e1b00,null))[_0x5552('0x3f')](handleError(_0x4e1b00,null));};exports[_0x5552('0x20')]=function(_0x3ee77c,_0x31a86c){return db[_0x5552('0x28')][_0x5552('0x44')]({'where':{'id':_0x3ee77c[_0x5552('0x40')]['id']}})[_0x5552('0x3c')](handleEntityNotFound(_0x31a86c,null))[_0x5552('0x3c')](removeEntity(_0x31a86c,null))['catch'](handleError(_0x31a86c,null));}; \ No newline at end of file +var _0xf69c=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key'];(function(_0x2db84f,_0x23c61d){var _0x1e2295=function(_0x3960e2){while(--_0x3960e2){_0x2db84f['push'](_0x2db84f['shift']());}};_0x1e2295(++_0x23c61d);}(_0xf69c,0x1e2));var _0xcf69=function(_0x45b100,_0x29a4b1){_0x45b100=_0x45b100-0x0;var _0x1b41f8=_0xf69c[_0x45b100];return _0x1b41f8;};'use strict';var emlformat=require(_0xcf69('0x0'));var rimraf=require(_0xcf69('0x1'));var zipdir=require(_0xcf69('0x2'));var jsonpatch=require(_0xcf69('0x3'));var rp=require('request-promise');var moment=require(_0xcf69('0x4'));var BPromise=require(_0xcf69('0x5'));var Mustache=require(_0xcf69('0x6'));var util=require('util');var path=require(_0xcf69('0x7'));var sox=require(_0xcf69('0x8'));var csv=require(_0xcf69('0x9'));var ejs=require(_0xcf69('0xa'));var fs=require('fs');var fs_extra=require(_0xcf69('0xb'));var _=require(_0xcf69('0xc'));var squel=require(_0xcf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xe'));var deskjs=require(_0xcf69('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf69('0x10'));var Papa=require(_0xcf69('0x11'));var Redis=require(_0xcf69('0x12'));var authService=require(_0xcf69('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf69('0x14'));var hardwareService=require(_0xcf69('0x15'));var logger=require(_0xcf69('0x16'))('api');var utils=require(_0xcf69('0x17'));var config=require(_0xcf69('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf69('0x19'))['db'];function respondWithStatusCode(_0x25640b,_0x1055f2){_0x1055f2=_0x1055f2||0xcc;return function(_0x339c87){if(_0x339c87){return _0x25640b[_0xcf69('0x1a')](_0x1055f2);}return _0x25640b[_0xcf69('0x1b')](_0x1055f2)[_0xcf69('0x1c')]();};}function respondWithResult(_0x36b3c9,_0x5965d5){_0x5965d5=_0x5965d5||0xc8;return function(_0x32d71f){if(_0x32d71f){return _0x36b3c9['status'](_0x5965d5)[_0xcf69('0x1d')](_0x32d71f);}};}function respondWithFilteredResult(_0x4e32b0,_0x6b4f8e){return function(_0x1d2212){if(_0x1d2212){var _0x5e01be=typeof _0x6b4f8e['offset']===_0xcf69('0x1e')&&typeof _0x6b4f8e['limit']===_0xcf69('0x1e');var _0x561ce4=_0x1d2212[_0xcf69('0x1f')];var _0x50b557=_0x5e01be?0x0:_0x6b4f8e[_0xcf69('0x20')];var _0x5ea276=_0x5e01be?_0x1d2212[_0xcf69('0x1f')]:_0x6b4f8e[_0xcf69('0x20')]+_0x6b4f8e[_0xcf69('0x21')];var _0x5ef249;if(_0x5ea276>=_0x561ce4){_0x5ea276=_0x561ce4;_0x5ef249=0xc8;}else{_0x5ef249=0xce;}_0x4e32b0[_0xcf69('0x1b')](_0x5ef249);return _0x4e32b0[_0xcf69('0x22')](_0xcf69('0x23'),_0x50b557+'-'+_0x5ea276+'/'+_0x561ce4)[_0xcf69('0x1d')](_0x1d2212);}return null;};}function patchUpdates(_0x14b779){return function(_0x10c747){try{jsonpatch[_0xcf69('0x24')](_0x10c747,_0x14b779,!![]);}catch(_0x4a7409){return BPromise[_0xcf69('0x25')](_0x4a7409);}return _0x10c747[_0xcf69('0x26')]();};}function saveUpdates(_0x278c1a,_0x142283){return function(_0xa2031d){if(_0xa2031d){return _0xa2031d['update'](_0x278c1a)[_0xcf69('0x27')](function(_0x5a7e85){return _0x5a7e85;});}return null;};}function removeEntity(_0x1f8d99,_0xe28ca){return function(_0x48a1be){if(_0x48a1be){return _0x48a1be[_0xcf69('0x28')]()['then'](function(){_0x1f8d99[_0xcf69('0x1b')](0xcc)[_0xcf69('0x1c')]();});}};}function handleEntityNotFound(_0x597275,_0x58a7f3){return function(_0x28e837){if(!_0x28e837){_0x597275[_0xcf69('0x1a')](0x194);}return _0x28e837;};}function handleError(_0x410736,_0x229182){_0x229182=_0x229182||0x1f4;return function(_0x540c58){logger[_0xcf69('0x29')](_0x540c58[_0xcf69('0x2a')]);if(_0x540c58[_0xcf69('0x2b')]){delete _0x540c58[_0xcf69('0x2b')];}_0x410736[_0xcf69('0x1b')](_0x229182)['send'](_0x540c58);};}exports[_0xcf69('0x2c')]=function(_0x1e7e77,_0x10862e){var _0x332afd={},_0x200a7a={},_0x40f2bc={'count':0x0,'rows':[]};var _0x398929=_[_0xcf69('0x2d')](db['SquareMessage'][_0xcf69('0x2e')],function(_0x463733){return{'name':_0x463733[_0xcf69('0x2f')],'type':_0x463733[_0xcf69('0x30')][_0xcf69('0x31')]};});_0x200a7a[_0xcf69('0x32')]=_[_0xcf69('0x2d')](_0x398929,_0xcf69('0x2b'));_0x200a7a[_0xcf69('0x33')]=_[_0xcf69('0x34')](_0x1e7e77[_0xcf69('0x33')]);_0x200a7a[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x200a7a['model'],_0x200a7a['query']);_0x332afd[_0xcf69('0x37')]=_[_0xcf69('0x36')](_0x200a7a[_0xcf69('0x32')],qs[_0xcf69('0x38')](_0x1e7e77[_0xcf69('0x33')][_0xcf69('0x38')]));_0x332afd[_0xcf69('0x37')]=_0x332afd[_0xcf69('0x37')][_0xcf69('0x39')]?_0x332afd[_0xcf69('0x37')]:_0x200a7a[_0xcf69('0x32')];if(!_0x1e7e77[_0xcf69('0x33')]['hasOwnProperty'](_0xcf69('0x3a'))){_0x332afd[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x1e7e77['query'][_0xcf69('0x21')]);_0x332afd['offset']=qs[_0xcf69('0x20')](_0x1e7e77['query'][_0xcf69('0x20')]);}_0x332afd[_0xcf69('0x3b')]=qs['sort'](_0x1e7e77['query']['sort']);_0x332afd[_0xcf69('0x3c')]=qs[_0xcf69('0x35')](_[_0xcf69('0x3d')](_0x1e7e77['query'],_0x200a7a[_0xcf69('0x35')]),_0x398929);if(_0x1e7e77[_0xcf69('0x33')][_0xcf69('0x3e')]){_0x332afd[_0xcf69('0x3c')]=_[_0xcf69('0x3f')](_0x332afd[_0xcf69('0x3c')],{'$or':_[_0xcf69('0x2d')](_0x398929,function(_0x2301dc){if(_0x2301dc[_0xcf69('0x30')]!==_0xcf69('0x40')){var _0x1d7aa0={};_0x1d7aa0[_0x2301dc[_0xcf69('0x2b')]]={'$like':'%'+_0x1e7e77['query'][_0xcf69('0x3e')]+'%'};return _0x1d7aa0;}})});}_0x332afd=_[_0xcf69('0x3f')]({},_0x332afd,_0x1e7e77['options']);var _0x32eec9={'where':_0x332afd[_0xcf69('0x3c')]};return db[_0xcf69('0x41')][_0xcf69('0x1f')](_0x32eec9)[_0xcf69('0x27')](function(_0x129ebb){_0x40f2bc[_0xcf69('0x1f')]=_0x129ebb;if(_0x1e7e77['query'][_0xcf69('0x42')]){_0x332afd[_0xcf69('0x43')]=[{'all':!![]}];}return db[_0xcf69('0x41')][_0xcf69('0x44')](_0x332afd);})[_0xcf69('0x27')](function(_0x2a14e9){_0x40f2bc['rows']=_0x2a14e9;return _0x40f2bc;})[_0xcf69('0x27')](respondWithFilteredResult(_0x10862e,_0x332afd))[_0xcf69('0x45')](handleError(_0x10862e,null));};exports[_0xcf69('0x46')]=function(_0x201cd2,_0x1e27fa){var _0x274b85={'raw':!![],'where':{'id':_0x201cd2[_0xcf69('0x47')]['id']}},_0x2e0cb5={};_0x2e0cb5[_0xcf69('0x32')]=_['keys'](db[_0xcf69('0x41')][_0xcf69('0x2e')]);_0x2e0cb5[_0xcf69('0x33')]=_[_0xcf69('0x34')](_0x201cd2[_0xcf69('0x33')]);_0x2e0cb5[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x2e0cb5[_0xcf69('0x32')],_0x2e0cb5['query']);_0x274b85[_0xcf69('0x37')]=_[_0xcf69('0x36')](_0x2e0cb5[_0xcf69('0x32')],qs[_0xcf69('0x38')](_0x201cd2[_0xcf69('0x33')][_0xcf69('0x38')]));_0x274b85[_0xcf69('0x37')]=_0x274b85[_0xcf69('0x37')][_0xcf69('0x39')]?_0x274b85[_0xcf69('0x37')]:_0x2e0cb5[_0xcf69('0x32')];if(_0x201cd2[_0xcf69('0x33')]['includeAll']){_0x274b85[_0xcf69('0x43')]=[{'all':!![]}];}_0x274b85=_['merge']({},_0x274b85,_0x201cd2['options']);return db[_0xcf69('0x41')][_0xcf69('0x48')](_0x274b85)[_0xcf69('0x27')](handleEntityNotFound(_0x1e27fa,null))[_0xcf69('0x27')](respondWithResult(_0x1e27fa,null))[_0xcf69('0x45')](handleError(_0x1e27fa,null));};exports[_0xcf69('0x49')]=function(_0x2b9338,_0x217dae){return db[_0xcf69('0x41')][_0xcf69('0x49')](_0x2b9338[_0xcf69('0x4a')],{})[_0xcf69('0x27')](respondWithResult(_0x217dae,0xc9))[_0xcf69('0x45')](handleError(_0x217dae,null));};exports[_0xcf69('0x4b')]=function(_0x2b63e1,_0x524c08){if(_0x2b63e1[_0xcf69('0x4a')]['id']){delete _0x2b63e1[_0xcf69('0x4a')]['id'];}return db['SquareMessage'][_0xcf69('0x48')]({'where':{'id':_0x2b63e1[_0xcf69('0x47')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x524c08,null))[_0xcf69('0x27')](saveUpdates(_0x2b63e1['body'],null))[_0xcf69('0x27')](respondWithResult(_0x524c08,null))[_0xcf69('0x45')](handleError(_0x524c08,null));};exports['destroy']=function(_0xac5f90,_0x4ec08f){return db['SquareMessage'][_0xcf69('0x48')]({'where':{'id':_0xac5f90[_0xcf69('0x47')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x4ec08f,null))['then'](removeEntity(_0x4ec08f,null))[_0xcf69('0x45')](handleError(_0x4ec08f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4589120..0d45743 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 _0xf8d6=['bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','api','moment'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0xf8d6,0xe4));var _0x6f8d=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0xf8d6[_0x46a671];return _0x526d75;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6f8d('0x0'));var moment=require(_0x6f8d('0x1'));var BPromise=require(_0x6f8d('0x2'));var rp=require(_0x6f8d('0x3'));var fs=require('fs');var path=require(_0x6f8d('0x4'));var rimraf=require('rimraf');var config=require(_0x6f8d('0x5'));var attributes=require(_0x6f8d('0x6'));module[_0x6f8d('0x7')]=function(_0x59ee88,_0x2b66c0){return _0x59ee88['define'](_0x6f8d('0x8'),attributes,{'tableName':_0x6f8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1048=['lodash','util','api','request-promise','rimraf','../../config/environment','exports','define','square_messages'];(function(_0x49e45c,_0x534d7e){var _0x29d34b=function(_0x23ecb3){while(--_0x23ecb3){_0x49e45c['push'](_0x49e45c['shift']());}};_0x29d34b(++_0x534d7e);}(_0x1048,0xbd));var _0x8104=function(_0x44cd47,_0x172f8e){_0x44cd47=_0x44cd47-0x0;var _0x474d07=_0x1048[_0x44cd47];return _0x474d07;};'use strict';var _=require(_0x8104('0x0'));var util=require(_0x8104('0x1'));var logger=require('../../config/logger')(_0x8104('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8104('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8104('0x4'));var config=require(_0x8104('0x5'));var attributes=require('./squareMessage.attributes');module[_0x8104('0x6')]=function(_0xec613a,_0x5a2db2){return _0xec613a[_0x8104('0x7')]('SquareMessage',attributes,{'tableName':_0x8104('0x8'),'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 62c053c..04b10f2 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 _0xf69b=['rpc','request','then','info','request\x20sent','stringify','error','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage','create','body','options','debug','catch','ioredis','../../config/utils','../../config/logger'];(function(_0x3674c5,_0x2115db){var _0x4c34e6=function(_0x224afa){while(--_0x224afa){_0x3674c5['push'](_0x3674c5['shift']());}};_0x4c34e6(++_0x2115db);}(_0xf69b,0x1f1));var _0xbf69=function(_0x59ff73,_0x1b8960){_0x59ff73=_0x59ff73-0x0;var _0x56aff5=_0xf69b[_0x59ff73];return _0x56aff5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf69('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf69('0x1'));var logger=require(_0xbf69('0x2'))(_0xbf69('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42df06,_0xc0139d,_0x22c8b8){return new BPromise(function(_0x5ef231,_0x3ffa0e){return client[_0xbf69('0x4')](_0x42df06,_0x22c8b8)[_0xbf69('0x5')](function(_0x35e28a){logger[_0xbf69('0x6')]('SquareMessage,\x20%s,\x20%s',_0xc0139d,_0xbf69('0x7'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0xc0139d,_0xbf69('0x7'),JSON[_0xbf69('0x8')](_0x35e28a));if(_0x35e28a[_0xbf69('0x9')]){if(_0x35e28a[_0xbf69('0x9')]['code']===0x1f4){logger[_0xbf69('0x9')](_0xbf69('0xa'),_0xc0139d,_0x35e28a[_0xbf69('0x9')][_0xbf69('0xb')]);return _0x3ffa0e(_0x35e28a[_0xbf69('0x9')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0xc0139d,_0x35e28a[_0xbf69('0x9')]['message']);return _0x5ef231(_0x35e28a['error'][_0xbf69('0xb')]);}else{logger[_0xbf69('0x6')](_0xbf69('0xa'),_0xc0139d,_0xbf69('0x7'));_0x5ef231(_0x35e28a[_0xbf69('0xc')]['message']);}})['catch'](function(_0x3acf63){logger[_0xbf69('0x9')](_0xbf69('0xa'),_0xc0139d,_0x3acf63);_0x3ffa0e(_0x3acf63);});});}exports[_0xbf69('0xd')]=function(_0x4ae93e){var _0x50e3db=this;return new Promise(function(_0x2c387a,_0x25235b){return db[_0xbf69('0xe')][_0xbf69('0xf')](_0x4ae93e[_0xbf69('0x10')],{'raw':_0x4ae93e[_0xbf69('0x11')]?_0x4ae93e[_0xbf69('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xbf69('0x5')](function(_0x15d0c2){logger[_0xbf69('0x6')](_0xbf69('0xd'),_0x4ae93e);logger[_0xbf69('0x12')]('CreateSquareMessage',_0x4ae93e,JSON['stringify'](_0x15d0c2));_0x2c387a(_0x15d0c2);})[_0xbf69('0x13')](function(_0x280724){logger[_0xbf69('0x9')](_0xbf69('0xd'),_0x280724[_0xbf69('0xb')],_0x4ae93e);_0x25235b(_0x50e3db[_0xbf69('0x9')](0x1f4,_0x280724[_0xbf69('0xb')]));});});}; \ No newline at end of file +var _0xd8b0=['CreateSquareMessage','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','SquareMessage','create','body','options'];(function(_0x48087a,_0x18cdbb){var _0xd651c2=function(_0xbd16ba){while(--_0xbd16ba){_0x48087a['push'](_0x48087a['shift']());}};_0xd651c2(++_0x18cdbb);}(_0xd8b0,0x11f));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0d8b('0x0'));var rs=require(_0x0d8b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d8b('0x2'));var logger=require('../../config/logger')(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var jayson=require(_0x0d8b('0x5'));var client=jayson[_0x0d8b('0x6')][_0x0d8b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1098c1,_0x270356,_0x5b3e2a){return new BPromise(function(_0x3e7b64,_0x288c8f){return client[_0x0d8b('0x8')](_0x1098c1,_0x5b3e2a)[_0x0d8b('0x9')](function(_0x4fd8a8){logger[_0x0d8b('0xa')]('SquareMessage,\x20%s,\x20%s',_0x270356,_0x0d8b('0xb'));logger[_0x0d8b('0xc')](_0x0d8b('0xd'),_0x270356,_0x0d8b('0xb'),JSON[_0x0d8b('0xe')](_0x4fd8a8));if(_0x4fd8a8[_0x0d8b('0xf')]){if(_0x4fd8a8[_0x0d8b('0xf')][_0x0d8b('0x10')]===0x1f4){logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x4fd8a8['error'][_0x0d8b('0x12')]);return _0x288c8f(_0x4fd8a8['error'][_0x0d8b('0x12')]);}logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x4fd8a8['error']['message']);return _0x3e7b64(_0x4fd8a8[_0x0d8b('0xf')][_0x0d8b('0x12')]);}else{logger[_0x0d8b('0xa')](_0x0d8b('0x11'),_0x270356,_0x0d8b('0xb'));_0x3e7b64(_0x4fd8a8[_0x0d8b('0x13')][_0x0d8b('0x12')]);}})[_0x0d8b('0x14')](function(_0x20ddcd){logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x20ddcd);_0x288c8f(_0x20ddcd);});});}exports['CreateSquareMessage']=function(_0x1b0155){var _0x41b98a=this;return new Promise(function(_0x4bc92b,_0x1f0ffd){return db[_0x0d8b('0x15')][_0x0d8b('0x16')](_0x1b0155[_0x0d8b('0x17')],{'raw':_0x1b0155[_0x0d8b('0x18')]?_0x1b0155[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0d8b('0x9')](function(_0x3abe67){logger[_0x0d8b('0xa')]('CreateSquareMessage',_0x1b0155);logger[_0x0d8b('0xc')](_0x0d8b('0x19'),_0x1b0155,JSON[_0x0d8b('0xe')](_0x3abe67));_0x4bc92b(_0x3abe67);})['catch'](function(_0x4ad2a2){logger['error'](_0x0d8b('0x19'),_0x4ad2a2[_0x0d8b('0x12')],_0x1b0155);_0x1f0ffd(_0x41b98a[_0x0d8b('0xf')](0x1f4,_0x4ad2a2[_0x0d8b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 13e693f..1098bba 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 _0xd3a2=['test','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x269f9c,_0xdedd6c){var _0x3c6f0e=function(_0x27d9b4){while(--_0x27d9b4){_0x269f9c['push'](_0x269f9c['shift']());}};_0x3c6f0e(++_0xdedd6c);}(_0xd3a2,0x15d));var _0x2d3a=function(_0x3ed017,_0x2d41d5){_0x3ed017=_0x3ed017-0x0;var _0x52cded=_0xd3a2[_0x3ed017];return _0x52cded;};'use strict';var multer=require(_0x2d3a('0x0'));var util=require(_0x2d3a('0x1'));var path=require(_0x2d3a('0x2'));var timeout=require(_0x2d3a('0x3'));var express=require(_0x2d3a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2d3a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d3a('0x6'));var controller=require(_0x2d3a('0x7'));router[_0x2d3a('0x8')]('/',auth[_0x2d3a('0x9')](),controller[_0x2d3a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2d3a('0x8')]('/:id/test',auth[_0x2d3a('0x9')](),timeout('15s'),controller[_0x2d3a('0xb')]);router[_0x2d3a('0xc')]('/',auth[_0x2d3a('0x9')](),controller[_0x2d3a('0xd')]);router[_0x2d3a('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2d3a('0xf'),auth[_0x2d3a('0x9')](),controller[_0x2d3a('0x10')]);module[_0x2d3a('0x11')]=router; \ No newline at end of file +var _0x8c22=['express','Router','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','test','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3d0870,_0x4888c2){var _0x2f17c0=function(_0x1a52c1){while(--_0x1a52c1){_0x3d0870['push'](_0x3d0870['shift']());}};_0x2f17c0(++_0x4888c2);}(_0x8c22,0x1f1));var _0x28c2=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x8c22[_0xed9fea];return _0x198f12;};'use strict';var multer=require(_0x28c2('0x0'));var util=require(_0x28c2('0x1'));var path=require('path');var timeout=require(_0x28c2('0x2'));var express=require(_0x28c2('0x3'));var router=express[_0x28c2('0x4')]();var fs_extra=require(_0x28c2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28c2('0x6'));var controller=require(_0x28c2('0x7'));router[_0x28c2('0x8')]('/',auth[_0x28c2('0x9')](),controller[_0x28c2('0xa')]);router['get'](_0x28c2('0xb'),auth[_0x28c2('0x9')](),controller['show']);router[_0x28c2('0x8')]('/:id/test',auth[_0x28c2('0x9')](),timeout('15s'),controller[_0x28c2('0xc')]);router[_0x28c2('0xd')]('/',auth['isAuthenticated'](),controller[_0x28c2('0xe')]);router[_0x28c2('0xf')](_0x28c2('0xb'),auth[_0x28c2('0x9')](),controller[_0x28c2('0x10')]);router[_0x28c2('0x11')](_0x28c2('0xb'),auth['isAuthenticated'](),controller[_0x28c2('0x12')]);module[_0x28c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index c9d7085..3d0ffb0 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 _0x8bca=['name','sequelize','exports','STRING'];(function(_0x494438,_0x294e76){var _0x383a87=function(_0x395d08){while(--_0x395d08){_0x494438['push'](_0x494438['shift']());}};_0x383a87(++_0x294e76);}(_0x8bca,0xb1));var _0xa8bc=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x8bca[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0xa8bc('0x0'));module[_0xa8bc('0x1')]={'name':{'type':Sequelize[_0xa8bc('0x2')],'unique':_0xa8bc('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa8bc('0x2')]},'description':{'type':Sequelize[_0xa8bc('0x2')]}}; \ No newline at end of file +var _0x8626=['sequelize','exports','STRING','name'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8626,0x104));var _0x6862=function(_0x1534a6,_0x3fc09a){_0x1534a6=_0x1534a6-0x0;var _0x518820=_0x8626[_0x1534a6];return _0x518820;};'use strict';var Sequelize=require(_0x6862('0x0'));module[_0x6862('0x1')]={'name':{'type':Sequelize[_0x6862('0x2')],'unique':_0x6862('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 477bb34..8cfbf1e 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 _0x2c6a=['destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','SquareOdbc','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x2c6a,0xdc));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa2c6('0x0'));var rimraf=require(_0xa2c6('0x1'));var zipdir=require(_0xa2c6('0x2'));var jsonpatch=require(_0xa2c6('0x3'));var rp=require('request-promise');var moment=require(_0xa2c6('0x4'));var BPromise=require(_0xa2c6('0x5'));var Mustache=require(_0xa2c6('0x6'));var util=require(_0xa2c6('0x7'));var path=require(_0xa2c6('0x8'));var sox=require(_0xa2c6('0x9'));var csv=require(_0xa2c6('0xa'));var ejs=require(_0xa2c6('0xb'));var fs=require('fs');var fs_extra=require(_0xa2c6('0xc'));var _=require('lodash');var squel=require(_0xa2c6('0xd'));var crypto=require(_0xa2c6('0xe'));var jsforce=require(_0xa2c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa2c6('0xa'));var querystring=require(_0xa2c6('0x10'));var Papa=require('papaparse');var Redis=require(_0xa2c6('0x11'));var authService=require(_0xa2c6('0x12'));var qs=require(_0xa2c6('0x13'));var as=require(_0xa2c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c6('0x15'))('api');var utils=require(_0xa2c6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa2c6('0x17'));var db=require(_0xa2c6('0x18'))['db'];function respondWithStatusCode(_0x35cec7,_0x44f4d7){_0x44f4d7=_0x44f4d7||0xcc;return function(_0x54a906){if(_0x54a906){return _0x35cec7[_0xa2c6('0x19')](_0x44f4d7);}return _0x35cec7[_0xa2c6('0x1a')](_0x44f4d7)[_0xa2c6('0x1b')]();};}function respondWithResult(_0x570ccf,_0x58212c){_0x58212c=_0x58212c||0xc8;return function(_0x583c84){if(_0x583c84){return _0x570ccf[_0xa2c6('0x1a')](_0x58212c)[_0xa2c6('0x1c')](_0x583c84);}};}function respondWithFilteredResult(_0xcae2a8,_0x27137a){return function(_0x4acfe2){if(_0x4acfe2){var _0x5439a3=typeof _0x27137a[_0xa2c6('0x1d')]===_0xa2c6('0x1e')&&typeof _0x27137a['limit']===_0xa2c6('0x1e');var _0x2768f7=_0x4acfe2['count'];var _0x1e7f15=_0x5439a3?0x0:_0x27137a['offset'];var _0x486e69=_0x5439a3?_0x4acfe2[_0xa2c6('0x1f')]:_0x27137a[_0xa2c6('0x1d')]+_0x27137a['limit'];var _0xe9a78a;if(_0x486e69>=_0x2768f7){_0x486e69=_0x2768f7;_0xe9a78a=0xc8;}else{_0xe9a78a=0xce;}_0xcae2a8[_0xa2c6('0x1a')](_0xe9a78a);return _0xcae2a8[_0xa2c6('0x20')](_0xa2c6('0x21'),_0x1e7f15+'-'+_0x486e69+'/'+_0x2768f7)['json'](_0x4acfe2);}return null;};}function patchUpdates(_0x35b2fa){return function(_0x1fad06){try{jsonpatch['apply'](_0x1fad06,_0x35b2fa,!![]);}catch(_0x31e0e4){return BPromise[_0xa2c6('0x22')](_0x31e0e4);}return _0x1fad06[_0xa2c6('0x23')]();};}function saveUpdates(_0x3793ab,_0x2511b0){return function(_0x1a5e6f){if(_0x1a5e6f){return _0x1a5e6f[_0xa2c6('0x24')](_0x3793ab)[_0xa2c6('0x25')](function(_0x574195){return _0x574195;});}return null;};}function removeEntity(_0x171ed5,_0x5b2851){return function(_0x2b58a2){if(_0x2b58a2){return _0x2b58a2[_0xa2c6('0x26')]()[_0xa2c6('0x25')](function(){var _0x5b634e=_0x2b58a2[_0xa2c6('0x27')]({'plain':!![]});var _0x406407=_0xa2c6('0x28');return db[_0xa2c6('0x29')][_0xa2c6('0x26')]({'where':{'type':_0x406407,'resourceId':_0x5b634e['id']}})[_0xa2c6('0x25')](function(){return _0x2b58a2;});})['then'](function(){_0x171ed5[_0xa2c6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe876e4,_0x229156){return function(_0x3a04d4){if(!_0x3a04d4){_0xe876e4[_0xa2c6('0x19')](0x194);}return _0x3a04d4;};}function handleError(_0x22e9e7,_0x15ca9c){_0x15ca9c=_0x15ca9c||0x1f4;return function(_0x5519ca){logger[_0xa2c6('0x2a')](_0x5519ca[_0xa2c6('0x2b')]);if(_0x5519ca[_0xa2c6('0x2c')]){delete _0x5519ca[_0xa2c6('0x2c')];}_0x22e9e7[_0xa2c6('0x1a')](_0x15ca9c)[_0xa2c6('0x2d')](_0x5519ca);};}exports[_0xa2c6('0x2e')]=function(_0x7d6f38,_0x2c48c1){var _0x21f10a={},_0x1919da={},_0x316623={'count':0x0,'rows':[]};var _0x5d6c9c=_[_0xa2c6('0x2f')](db['SquareOdbc'][_0xa2c6('0x30')],function(_0xb0b032){return{'name':_0xb0b032['fieldName'],'type':_0xb0b032['type'][_0xa2c6('0x31')]};});_0x1919da[_0xa2c6('0x32')]=_['map'](_0x5d6c9c,_0xa2c6('0x2c'));_0x1919da[_0xa2c6('0x33')]=_[_0xa2c6('0x34')](_0x7d6f38[_0xa2c6('0x33')]);_0x1919da[_0xa2c6('0x35')]=_[_0xa2c6('0x36')](_0x1919da[_0xa2c6('0x32')],_0x1919da['query']);_0x21f10a[_0xa2c6('0x37')]=_['intersection'](_0x1919da[_0xa2c6('0x32')],qs[_0xa2c6('0x38')](_0x7d6f38[_0xa2c6('0x33')][_0xa2c6('0x38')]));_0x21f10a[_0xa2c6('0x37')]=_0x21f10a[_0xa2c6('0x37')][_0xa2c6('0x39')]?_0x21f10a['attributes']:_0x1919da[_0xa2c6('0x32')];if(!_0x7d6f38[_0xa2c6('0x33')][_0xa2c6('0x3a')]('nolimit')){_0x21f10a[_0xa2c6('0x3b')]=qs[_0xa2c6('0x3b')](_0x7d6f38[_0xa2c6('0x33')]['limit']);_0x21f10a['offset']=qs['offset'](_0x7d6f38['query']['offset']);}_0x21f10a[_0xa2c6('0x3c')]=qs[_0xa2c6('0x3d')](_0x7d6f38[_0xa2c6('0x33')]['sort']);_0x21f10a[_0xa2c6('0x3e')]=qs[_0xa2c6('0x35')](_[_0xa2c6('0x3f')](_0x7d6f38[_0xa2c6('0x33')],_0x1919da[_0xa2c6('0x35')]),_0x5d6c9c);if(_0x7d6f38[_0xa2c6('0x33')][_0xa2c6('0x40')]){_0x21f10a[_0xa2c6('0x3e')]=_[_0xa2c6('0x41')](_0x21f10a['where'],{'$or':_[_0xa2c6('0x2f')](_0x5d6c9c,function(_0x3bac74){if(_0x3bac74[_0xa2c6('0x42')]!=='VIRTUAL'){var _0x8a6b53={};_0x8a6b53[_0x3bac74[_0xa2c6('0x2c')]]={'$like':'%'+_0x7d6f38[_0xa2c6('0x33')][_0xa2c6('0x40')]+'%'};return _0x8a6b53;}})});}_0x21f10a=_[_0xa2c6('0x41')]({},_0x21f10a,_0x7d6f38[_0xa2c6('0x43')]);var _0x1d2196={'where':_0x21f10a[_0xa2c6('0x3e')]};return db['SquareOdbc'][_0xa2c6('0x1f')](_0x1d2196)[_0xa2c6('0x25')](function(_0x4450b3){_0x316623[_0xa2c6('0x1f')]=_0x4450b3;if(_0x7d6f38[_0xa2c6('0x33')][_0xa2c6('0x44')]){_0x21f10a[_0xa2c6('0x45')]=[{'all':!![]}];}return db[_0xa2c6('0x46')][_0xa2c6('0x47')](_0x21f10a);})[_0xa2c6('0x25')](function(_0x3fb9ce){_0x316623['rows']=_0x3fb9ce;return _0x316623;})[_0xa2c6('0x25')](respondWithFilteredResult(_0x2c48c1,_0x21f10a))[_0xa2c6('0x48')](handleError(_0x2c48c1,null));};exports[_0xa2c6('0x49')]=function(_0x561ec4,_0x40485e){var _0x1414f3={'raw':!![],'where':{'id':_0x561ec4[_0xa2c6('0x4a')]['id']}},_0x4fa7e3={};_0x4fa7e3[_0xa2c6('0x32')]=_['keys'](db[_0xa2c6('0x46')][_0xa2c6('0x30')]);_0x4fa7e3['query']=_[_0xa2c6('0x34')](_0x561ec4['query']);_0x4fa7e3[_0xa2c6('0x35')]=_[_0xa2c6('0x36')](_0x4fa7e3[_0xa2c6('0x32')],_0x4fa7e3[_0xa2c6('0x33')]);_0x1414f3[_0xa2c6('0x37')]=_[_0xa2c6('0x36')](_0x4fa7e3[_0xa2c6('0x32')],qs['fields'](_0x561ec4['query'][_0xa2c6('0x38')]));_0x1414f3['attributes']=_0x1414f3[_0xa2c6('0x37')][_0xa2c6('0x39')]?_0x1414f3[_0xa2c6('0x37')]:_0x4fa7e3['model'];if(_0x561ec4[_0xa2c6('0x33')]['includeAll']){_0x1414f3['include']=[{'all':!![]}];}_0x1414f3=_[_0xa2c6('0x41')]({},_0x1414f3,_0x561ec4[_0xa2c6('0x43')]);return db[_0xa2c6('0x46')][_0xa2c6('0x4b')](_0x1414f3)[_0xa2c6('0x25')](handleEntityNotFound(_0x40485e,null))[_0xa2c6('0x25')](respondWithResult(_0x40485e,null))[_0xa2c6('0x48')](handleError(_0x40485e,null));};exports['create']=function(_0x356a8b,_0x3aa8f2){return db[_0xa2c6('0x46')][_0xa2c6('0x4c')](_0x356a8b[_0xa2c6('0x4d')],{})[_0xa2c6('0x25')](function(_0x6d34c6){var _0x55c07e=_0x356a8b[_0xa2c6('0x4e')][_0xa2c6('0x27')]({'plain':!![]});if(!_0x55c07e)throw new Error(_0xa2c6('0x4f'));if(_0x55c07e[_0xa2c6('0x50')]===_0xa2c6('0x4e')){var _0x1e5dc3=_0x6d34c6[_0xa2c6('0x27')]({'plain':!![]});var _0x23090e=_0xa2c6('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x23090e,'userProfileId':_0x55c07e[_0xa2c6('0x51')]},'raw':!![]})[_0xa2c6('0x25')](function(_0xabd12c){if(_0xabd12c&&_0xabd12c[_0xa2c6('0x52')]===0x0){return db['UserProfileResource'][_0xa2c6('0x4c')]({'name':_0x1e5dc3[_0xa2c6('0x2c')],'resourceId':_0x1e5dc3['id'],'type':_0xabd12c[_0xa2c6('0x2c')],'sectionId':_0xabd12c['id']},{})[_0xa2c6('0x25')](function(){return _0x6d34c6;});}else{return _0x6d34c6;}})[_0xa2c6('0x48')](function(_0x4fa37e){logger[_0xa2c6('0x2a')](_0xa2c6('0x53'),_0x4fa37e);throw _0x4fa37e;});}return _0x6d34c6;})[_0xa2c6('0x25')](respondWithResult(_0x3aa8f2,0xc9))[_0xa2c6('0x48')](handleError(_0x3aa8f2,null));};exports[_0xa2c6('0x24')]=function(_0x38246b,_0x3b1c70){if(_0x38246b['body']['id']){delete _0x38246b[_0xa2c6('0x4d')]['id'];}return db[_0xa2c6('0x46')][_0xa2c6('0x4b')]({'where':{'id':_0x38246b[_0xa2c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b1c70,null))[_0xa2c6('0x25')](saveUpdates(_0x38246b['body'],null))['then'](respondWithResult(_0x3b1c70,null))['catch'](handleError(_0x3b1c70,null));};exports['destroy']=function(_0x3cd12b,_0x8b513d){return db[_0xa2c6('0x46')][_0xa2c6('0x4b')]({'where':{'id':_0x3cd12b[_0xa2c6('0x4a')]['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x8b513d,null))[_0xa2c6('0x25')](removeEntity(_0x8b513d,null))[_0xa2c6('0x48')](handleError(_0x8b513d,null));};exports['test']=function(_0x3d9a29,_0x225ad8,_0xcf01e1){var _0x538b8f;return db[_0xa2c6('0x46')]['find']({'where':{'id':_0x3d9a29['params']['id']},'attributes':['id',_0xa2c6('0x54')]})[_0xa2c6('0x25')](handleEntityNotFound(_0x225ad8,null))['then'](function(_0x3a515d){if(_0x3a515d){var _0x4f709c=require(_0xa2c6('0x55'))();_0x4f709c['openSync'](_0x3a515d[_0xa2c6('0x54')]);_0x4f709c['closeSync']();return _0x3a515d;}})[_0xa2c6('0x25')](respondWithResult(_0x225ad8,null))[_0xa2c6('0x48')](handleError(_0x225ad8,null));}; \ No newline at end of file +var _0x5114=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','odbc','dsn','eml-format','rimraf','zip-dir'];(function(_0x34dbc3,_0x58d3bb){var _0x2763b4=function(_0x1cfd5f){while(--_0x1cfd5f){_0x34dbc3['push'](_0x34dbc3['shift']());}};_0x2763b4(++_0x58d3bb);}(_0x5114,0xab));var _0x4511=function(_0x34d867,_0x1cdf99){_0x34d867=_0x34d867-0x0;var _0x1663dc=_0x5114[_0x34d867];return _0x1663dc;};'use strict';var emlformat=require(_0x4511('0x0'));var rimraf=require(_0x4511('0x1'));var zipdir=require(_0x4511('0x2'));var jsonpatch=require(_0x4511('0x3'));var rp=require(_0x4511('0x4'));var moment=require('moment');var BPromise=require(_0x4511('0x5'));var Mustache=require(_0x4511('0x6'));var util=require(_0x4511('0x7'));var path=require(_0x4511('0x8'));var sox=require(_0x4511('0x9'));var csv=require(_0x4511('0xa'));var ejs=require(_0x4511('0xb'));var fs=require('fs');var fs_extra=require(_0x4511('0xc'));var _=require(_0x4511('0xd'));var squel=require(_0x4511('0xe'));var crypto=require('crypto');var jsforce=require(_0x4511('0xf'));var deskjs=require(_0x4511('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4511('0x11'));var Papa=require(_0x4511('0x12'));var Redis=require(_0x4511('0x13'));var authService=require(_0x4511('0x14'));var qs=require(_0x4511('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4511('0x16'));var logger=require(_0x4511('0x17'))(_0x4511('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4511('0x19'));var db=require(_0x4511('0x1a'))['db'];function respondWithStatusCode(_0xa40fe5,_0x750e63){_0x750e63=_0x750e63||0xcc;return function(_0x12273b){if(_0x12273b){return _0xa40fe5['sendStatus'](_0x750e63);}return _0xa40fe5['status'](_0x750e63)[_0x4511('0x1b')]();};}function respondWithResult(_0x3feae9,_0x85681b){_0x85681b=_0x85681b||0xc8;return function(_0x3d85cd){if(_0x3d85cd){return _0x3feae9[_0x4511('0x1c')](_0x85681b)[_0x4511('0x1d')](_0x3d85cd);}};}function respondWithFilteredResult(_0x2ef14e,_0x1976b5){return function(_0x4a15ad){if(_0x4a15ad){var _0xd09a10=typeof _0x1976b5[_0x4511('0x1e')]===_0x4511('0x1f')&&typeof _0x1976b5['limit']==='undefined';var _0x4116a1=_0x4a15ad[_0x4511('0x20')];var _0x10c9b6=_0xd09a10?0x0:_0x1976b5[_0x4511('0x1e')];var _0x16b410=_0xd09a10?_0x4a15ad[_0x4511('0x20')]:_0x1976b5[_0x4511('0x1e')]+_0x1976b5[_0x4511('0x21')];var _0x4c4e69;if(_0x16b410>=_0x4116a1){_0x16b410=_0x4116a1;_0x4c4e69=0xc8;}else{_0x4c4e69=0xce;}_0x2ef14e[_0x4511('0x1c')](_0x4c4e69);return _0x2ef14e[_0x4511('0x22')]('Content-Range',_0x10c9b6+'-'+_0x16b410+'/'+_0x4116a1)[_0x4511('0x1d')](_0x4a15ad);}return null;};}function patchUpdates(_0x7b489b){return function(_0x37d0b1){try{jsonpatch['apply'](_0x37d0b1,_0x7b489b,!![]);}catch(_0x1abd8c){return BPromise[_0x4511('0x23')](_0x1abd8c);}return _0x37d0b1[_0x4511('0x24')]();};}function saveUpdates(_0x438964,_0x5463df){return function(_0x557728){if(_0x557728){return _0x557728['update'](_0x438964)[_0x4511('0x25')](function(_0x186b5d){return _0x186b5d;});}return null;};}function removeEntity(_0x4beb4a,_0x43e615){return function(_0x5d997b){if(_0x5d997b){return _0x5d997b[_0x4511('0x26')]()[_0x4511('0x25')](function(){var _0x5a1270=_0x5d997b[_0x4511('0x27')]({'plain':!![]});var _0x327805=_0x4511('0x28');return db[_0x4511('0x29')][_0x4511('0x26')]({'where':{'type':_0x327805,'resourceId':_0x5a1270['id']}})['then'](function(){return _0x5d997b;});})[_0x4511('0x25')](function(){_0x4beb4a['status'](0xcc)[_0x4511('0x1b')]();});}};}function handleEntityNotFound(_0x2ff322,_0x28db90){return function(_0x3d8ebd){if(!_0x3d8ebd){_0x2ff322[_0x4511('0x2a')](0x194);}return _0x3d8ebd;};}function handleError(_0x4ca8be,_0x504896){_0x504896=_0x504896||0x1f4;return function(_0x252b80){logger[_0x4511('0x2b')](_0x252b80[_0x4511('0x2c')]);if(_0x252b80[_0x4511('0x2d')]){delete _0x252b80[_0x4511('0x2d')];}_0x4ca8be[_0x4511('0x1c')](_0x504896)[_0x4511('0x2e')](_0x252b80);};}exports['index']=function(_0x1574e5,_0x4ac689){var _0x170627={},_0x32535c={},_0xc1bf65={'count':0x0,'rows':[]};var _0x39f786=_['map'](db[_0x4511('0x2f')][_0x4511('0x30')],function(_0x50cbab){return{'name':_0x50cbab[_0x4511('0x31')],'type':_0x50cbab[_0x4511('0x32')][_0x4511('0x33')]};});_0x32535c[_0x4511('0x34')]=_[_0x4511('0x35')](_0x39f786,_0x4511('0x2d'));_0x32535c[_0x4511('0x36')]=_[_0x4511('0x37')](_0x1574e5['query']);_0x32535c['filters']=_['intersection'](_0x32535c[_0x4511('0x34')],_0x32535c['query']);_0x170627[_0x4511('0x38')]=_[_0x4511('0x39')](_0x32535c['model'],qs[_0x4511('0x3a')](_0x1574e5['query'][_0x4511('0x3a')]));_0x170627[_0x4511('0x38')]=_0x170627[_0x4511('0x38')][_0x4511('0x3b')]?_0x170627[_0x4511('0x38')]:_0x32535c[_0x4511('0x34')];if(!_0x1574e5['query']['hasOwnProperty'](_0x4511('0x3c'))){_0x170627[_0x4511('0x21')]=qs['limit'](_0x1574e5[_0x4511('0x36')][_0x4511('0x21')]);_0x170627[_0x4511('0x1e')]=qs[_0x4511('0x1e')](_0x1574e5[_0x4511('0x36')]['offset']);}_0x170627[_0x4511('0x3d')]=qs[_0x4511('0x3e')](_0x1574e5[_0x4511('0x36')][_0x4511('0x3e')]);_0x170627['where']=qs['filters'](_['pick'](_0x1574e5[_0x4511('0x36')],_0x32535c[_0x4511('0x3f')]),_0x39f786);if(_0x1574e5['query']['filter']){_0x170627[_0x4511('0x40')]=_[_0x4511('0x41')](_0x170627[_0x4511('0x40')],{'$or':_['map'](_0x39f786,function(_0x5a2542){if(_0x5a2542['type']!==_0x4511('0x42')){var _0x33560b={};_0x33560b[_0x5a2542['name']]={'$like':'%'+_0x1574e5[_0x4511('0x36')][_0x4511('0x43')]+'%'};return _0x33560b;}})});}_0x170627=_[_0x4511('0x41')]({},_0x170627,_0x1574e5[_0x4511('0x44')]);var _0x480ef5={'where':_0x170627[_0x4511('0x40')]};return db[_0x4511('0x2f')][_0x4511('0x20')](_0x480ef5)[_0x4511('0x25')](function(_0x236a65){_0xc1bf65['count']=_0x236a65;if(_0x1574e5['query'][_0x4511('0x45')]){_0x170627[_0x4511('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4511('0x47')](_0x170627);})[_0x4511('0x25')](function(_0x3d1bd6){_0xc1bf65[_0x4511('0x48')]=_0x3d1bd6;return _0xc1bf65;})[_0x4511('0x25')](respondWithFilteredResult(_0x4ac689,_0x170627))[_0x4511('0x49')](handleError(_0x4ac689,null));};exports[_0x4511('0x4a')]=function(_0x20fcfb,_0x466224){var _0x1e50bb={'raw':!![],'where':{'id':_0x20fcfb[_0x4511('0x4b')]['id']}},_0xb66ae9={};_0xb66ae9[_0x4511('0x34')]=_[_0x4511('0x37')](db[_0x4511('0x2f')][_0x4511('0x30')]);_0xb66ae9[_0x4511('0x36')]=_[_0x4511('0x37')](_0x20fcfb[_0x4511('0x36')]);_0xb66ae9[_0x4511('0x3f')]=_['intersection'](_0xb66ae9[_0x4511('0x34')],_0xb66ae9[_0x4511('0x36')]);_0x1e50bb['attributes']=_[_0x4511('0x39')](_0xb66ae9[_0x4511('0x34')],qs[_0x4511('0x3a')](_0x20fcfb['query'][_0x4511('0x3a')]));_0x1e50bb[_0x4511('0x38')]=_0x1e50bb[_0x4511('0x38')][_0x4511('0x3b')]?_0x1e50bb[_0x4511('0x38')]:_0xb66ae9['model'];if(_0x20fcfb[_0x4511('0x36')][_0x4511('0x45')]){_0x1e50bb[_0x4511('0x46')]=[{'all':!![]}];}_0x1e50bb=_[_0x4511('0x41')]({},_0x1e50bb,_0x20fcfb['options']);return db['SquareOdbc']['find'](_0x1e50bb)[_0x4511('0x25')](handleEntityNotFound(_0x466224,null))['then'](respondWithResult(_0x466224,null))[_0x4511('0x49')](handleError(_0x466224,null));};exports['create']=function(_0x2630f2,_0x1ca4a1){return db[_0x4511('0x2f')][_0x4511('0x4c')](_0x2630f2['body'],{})[_0x4511('0x25')](function(_0x5265d6){var _0x279910=_0x2630f2[_0x4511('0x4d')]['get']({'plain':!![]});if(!_0x279910)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279910['role']==='user'){var _0x493881=_0x5265d6['get']({'plain':!![]});var _0x3b5b02='ODBC';return db[_0x4511('0x4e')][_0x4511('0x4f')]({'where':{'name':_0x3b5b02,'userProfileId':_0x279910[_0x4511('0x50')]},'raw':!![]})[_0x4511('0x25')](function(_0x1227fe){if(_0x1227fe&&_0x1227fe[_0x4511('0x51')]===0x0){return db[_0x4511('0x29')]['create']({'name':_0x493881[_0x4511('0x2d')],'resourceId':_0x493881['id'],'type':_0x1227fe['name'],'sectionId':_0x1227fe['id']},{})[_0x4511('0x25')](function(){return _0x5265d6;});}else{return _0x5265d6;}})[_0x4511('0x49')](function(_0x211c88){logger['error'](_0x4511('0x52'),_0x211c88);throw _0x211c88;});}return _0x5265d6;})['then'](respondWithResult(_0x1ca4a1,0xc9))[_0x4511('0x49')](handleError(_0x1ca4a1,null));};exports[_0x4511('0x53')]=function(_0x5dd39a,_0x4738b5){if(_0x5dd39a[_0x4511('0x54')]['id']){delete _0x5dd39a[_0x4511('0x54')]['id'];}return db['SquareOdbc'][_0x4511('0x4f')]({'where':{'id':_0x5dd39a[_0x4511('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4738b5,null))['then'](saveUpdates(_0x5dd39a['body'],null))[_0x4511('0x25')](respondWithResult(_0x4738b5,null))[_0x4511('0x49')](handleError(_0x4738b5,null));};exports[_0x4511('0x26')]=function(_0x487ac7,_0x38e20d){return db[_0x4511('0x2f')][_0x4511('0x4f')]({'where':{'id':_0x487ac7['params']['id']}})[_0x4511('0x25')](handleEntityNotFound(_0x38e20d,null))[_0x4511('0x25')](removeEntity(_0x38e20d,null))['catch'](handleError(_0x38e20d,null));};exports['test']=function(_0x4b678d,_0x2f3eba,_0x4b784c){var _0x469f65;return db[_0x4511('0x2f')][_0x4511('0x4f')]({'where':{'id':_0x4b678d[_0x4511('0x4b')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x2f3eba,null))[_0x4511('0x25')](function(_0x2a575a){if(_0x2a575a){var _0x1ab7d0=require(_0x4511('0x55'))();_0x1ab7d0['openSync'](_0x2a575a[_0x4511('0x56')]);_0x1ab7d0['closeSync']();return _0x2a575a;}})[_0x4511('0x25')](respondWithResult(_0x2f3eba,null))[_0x4511('0x49')](handleError(_0x2f3eba,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b4ad251..2083009 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 _0x2ba0=['path','rimraf','./squareOdbc.attributes','SquareOdbc','square_odbc','util','../../config/logger','bluebird'];(function(_0x67655b,_0x15ff31){var _0x71c09d=function(_0x50c331){while(--_0x50c331){_0x67655b['push'](_0x67655b['shift']());}};_0x71c09d(++_0x15ff31);}(_0x2ba0,0x1dd));var _0x02ba=function(_0x4aee59,_0x5afa1f){_0x4aee59=_0x4aee59-0x0;var _0x168eb9=_0x2ba0[_0x4aee59];return _0x168eb9;};'use strict';var _=require('lodash');var util=require(_0x02ba('0x0'));var logger=require(_0x02ba('0x1'))('api');var moment=require('moment');var BPromise=require(_0x02ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ba('0x3'));var rimraf=require(_0x02ba('0x4'));var config=require('../../config/environment');var attributes=require(_0x02ba('0x5'));module['exports']=function(_0x566ffa,_0x3a924d){return _0x566ffa['define'](_0x02ba('0x6'),attributes,{'tableName':_0x02ba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04b4=['request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','lodash','util','../../config/logger','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04b4,0x17b));var _0x404b=function(_0xd21fa4,_0xce2592){_0xd21fa4=_0xd21fa4-0x0;var _0x53395a=_0x04b4[_0xd21fa4];return _0x53395a;};'use strict';var _=require(_0x404b('0x0'));var util=require(_0x404b('0x1'));var logger=require(_0x404b('0x2'))('api');var moment=require(_0x404b('0x3'));var BPromise=require(_0x404b('0x4'));var rp=require(_0x404b('0x5'));var fs=require('fs');var path=require(_0x404b('0x6'));var rimraf=require(_0x404b('0x7'));var config=require(_0x404b('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x404b('0x9')]=function(_0x3910a6,_0x46c6a8){return _0x3910a6[_0x404b('0xa')](_0x404b('0xb'),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 b17f40d..cbdb69f 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 _0x7fa1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','lodash','ioredis'];(function(_0x168b9b,_0x173a43){var _0x5bdc55=function(_0x16d820){while(--_0x16d820){_0x168b9b['push'](_0x168b9b['shift']());}};_0x5bdc55(++_0x173a43);}(_0x7fa1,0x1a2));var _0x17fa=function(_0x26e6ed,_0x5ae7ac){_0x26e6ed=_0x26e6ed-0x0;var _0x4f38f2=_0x7fa1[_0x26e6ed];return _0x4f38f2;};'use strict';var _=require(_0x17fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17fa('0x1'));var db=require(_0x17fa('0x2'))['db'];var utils=require(_0x17fa('0x3'));var logger=require(_0x17fa('0x4'))(_0x17fa('0x5'));var config=require(_0x17fa('0x6'));var jayson=require(_0x17fa('0x7'));var client=jayson['client'][_0x17fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x242d8a,_0x11e91f,_0x3d9b5f){return new BPromise(function(_0x32103f,_0x4af226){return client[_0x17fa('0x9')](_0x242d8a,_0x3d9b5f)[_0x17fa('0xa')](function(_0x355d64){logger[_0x17fa('0xb')](_0x17fa('0xc'),_0x11e91f,_0x17fa('0xd'));logger[_0x17fa('0xe')](_0x17fa('0xf'),_0x11e91f,_0x17fa('0xd'),JSON['stringify'](_0x355d64));if(_0x355d64[_0x17fa('0x10')]){if(_0x355d64[_0x17fa('0x10')]['code']===0x1f4){logger[_0x17fa('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x11e91f,_0x355d64['error'][_0x17fa('0x11')]);return _0x4af226(_0x355d64[_0x17fa('0x10')][_0x17fa('0x11')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x11e91f,_0x355d64[_0x17fa('0x10')][_0x17fa('0x11')]);return _0x32103f(_0x355d64[_0x17fa('0x10')][_0x17fa('0x11')]);}else{logger['info'](_0x17fa('0xc'),_0x11e91f,'request\x20sent');_0x32103f(_0x355d64[_0x17fa('0x12')]['message']);}})[_0x17fa('0x13')](function(_0x4350a8){logger[_0x17fa('0x10')](_0x17fa('0xc'),_0x11e91f,_0x4350a8);_0x4af226(_0x4350a8);});});}exports[_0x17fa('0x14')]=function(_0x5238db){var _0x1637ba=this;return new Promise(function(_0x129614,_0x4e0025){return db['SquareOdbc'][_0x17fa('0x15')]({'raw':_0x5238db[_0x17fa('0x16')]?_0x5238db[_0x17fa('0x16')][_0x17fa('0x17')]===undefined?!![]:![]:!![],'where':_0x5238db[_0x17fa('0x16')]?_0x5238db['options'][_0x17fa('0x18')]||null:null,'attributes':_0x5238db[_0x17fa('0x16')]?_0x5238db[_0x17fa('0x16')][_0x17fa('0x19')]||null:null,'include':_0x5238db[_0x17fa('0x16')]?_0x5238db['options'][_0x17fa('0x1a')]?_['map'](_0x5238db['options'][_0x17fa('0x1a')],function(_0x158a7e){return{'model':db[_0x158a7e[_0x17fa('0x1b')]],'as':_0x158a7e['as'],'attributes':_0x158a7e[_0x17fa('0x19')],'include':_0x158a7e[_0x17fa('0x1a')]?_[_0x17fa('0x1c')](_0x158a7e['include'],function(_0x1c237d){return{'model':db[_0x1c237d[_0x17fa('0x1b')]],'as':_0x1c237d['as'],'attributes':_0x1c237d['attributes'],'include':_0x1c237d[_0x17fa('0x1a')]?_[_0x17fa('0x1c')](_0x1c237d[_0x17fa('0x1a')],function(_0x3372aa){return{'model':db[_0x3372aa['model']],'as':_0x3372aa['as'],'attributes':_0x3372aa[_0x17fa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x17fa('0xa')](function(_0x1a4da4){logger[_0x17fa('0xb')](_0x17fa('0x14'),_0x5238db);logger[_0x17fa('0xe')](_0x17fa('0x14'),_0x5238db,JSON[_0x17fa('0x1d')](_0x1a4da4));_0x129614(_0x1a4da4);})['catch'](function(_0x1a2f91){logger[_0x17fa('0x10')]('ShowSquareOdbc',_0x1a2f91[_0x17fa('0x11')],_0x5238db);_0x4e0025(_0x1637ba[_0x17fa('0x10')](0x1f4,_0x1a2f91[_0x17fa('0x11')]));});});}; \ No newline at end of file +var _0x021e=['map','include','model','then','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes'];(function(_0x3fbb91,_0x5ec106){var _0x3eb213=function(_0x118b9f){while(--_0x118b9f){_0x3fbb91['push'](_0x3fbb91['shift']());}};_0x3eb213(++_0x5ec106);}(_0x021e,0x1d5));var _0xe021=function(_0x541639,_0x698af3){_0x541639=_0x541639-0x0;var _0x414d6e=_0x021e[_0x541639];return _0x414d6e;};'use strict';var _=require(_0xe021('0x0'));var util=require('util');var moment=require(_0xe021('0x1'));var BPromise=require(_0xe021('0x2'));var rs=require(_0xe021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe021('0x4'));var logger=require(_0xe021('0x5'))(_0xe021('0x6'));var config=require('../../config/environment');var jayson=require(_0xe021('0x7'));var client=jayson[_0xe021('0x8')][_0xe021('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x263ad5,_0x4569c0,_0x50cd75){return new BPromise(function(_0x4b3d6f,_0x268ec3){return client[_0xe021('0xa')](_0x263ad5,_0x50cd75)['then'](function(_0x1e6b3a){logger[_0xe021('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x4569c0,_0xe021('0xc'));logger[_0xe021('0xd')](_0xe021('0xe'),_0x4569c0,_0xe021('0xc'),JSON[_0xe021('0xf')](_0x1e6b3a));if(_0x1e6b3a['error']){if(_0x1e6b3a[_0xe021('0x10')]['code']===0x1f4){logger['error'](_0xe021('0x11'),_0x4569c0,_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);return _0x268ec3(_0x1e6b3a[_0xe021('0x10')]['message']);}logger[_0xe021('0x10')](_0xe021('0x11'),_0x4569c0,_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);return _0x4b3d6f(_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);}else{logger['info'](_0xe021('0x11'),_0x4569c0,_0xe021('0xc'));_0x4b3d6f(_0x1e6b3a['result']['message']);}})[_0xe021('0x13')](function(_0x3b9629){logger['error'](_0xe021('0x11'),_0x4569c0,_0x3b9629);_0x268ec3(_0x3b9629);});});}exports[_0xe021('0x14')]=function(_0x3a6c28){var _0x4b9860=this;return new Promise(function(_0x1de3f3,_0x4729ba){return db[_0xe021('0x15')][_0xe021('0x16')]({'raw':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')][_0xe021('0x18')]===undefined?!![]:![]:!![],'where':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28['options'][_0xe021('0x19')]||null:null,'attributes':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')][_0xe021('0x1a')]||null:null,'include':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')]['include']?_[_0xe021('0x1b')](_0x3a6c28[_0xe021('0x17')][_0xe021('0x1c')],function(_0x1e248f){return{'model':db[_0x1e248f[_0xe021('0x1d')]],'as':_0x1e248f['as'],'attributes':_0x1e248f[_0xe021('0x1a')],'include':_0x1e248f[_0xe021('0x1c')]?_[_0xe021('0x1b')](_0x1e248f[_0xe021('0x1c')],function(_0x516292){return{'model':db[_0x516292[_0xe021('0x1d')]],'as':_0x516292['as'],'attributes':_0x516292[_0xe021('0x1a')],'include':_0x516292['include']?_[_0xe021('0x1b')](_0x516292[_0xe021('0x1c')],function(_0x4c6426){return{'model':db[_0x4c6426['model']],'as':_0x4c6426['as'],'attributes':_0x4c6426[_0xe021('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe021('0x1e')](function(_0x380286){logger[_0xe021('0xb')]('ShowSquareOdbc',_0x3a6c28);logger[_0xe021('0xd')]('ShowSquareOdbc',_0x3a6c28,JSON[_0xe021('0xf')](_0x380286));_0x1de3f3(_0x380286);})[_0xe021('0x13')](function(_0x294cda){logger[_0xe021('0x10')](_0xe021('0x14'),_0x294cda['message'],_0x3a6c28);_0x4729ba(_0x4b9860[_0xe021('0x10')](0x1f4,_0x294cda[_0xe021('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 88bf60f..e2536f0 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 _0xd33c=['update','delete','destroy','removeUsers','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','getUsers','post','create','/:id/users','addUsers','put','/:id'];(function(_0x8680b1,_0x5b05de){var _0x5bb0f0=function(_0x2d4a32){while(--_0x2d4a32){_0x8680b1['push'](_0x8680b1['shift']());}};_0x5bb0f0(++_0x5b05de);}(_0xd33c,0x115));var _0xcd33=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd33c[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xcd33('0x0'));var util=require(_0xcd33('0x1'));var path=require('path');var timeout=require(_0xcd33('0x2'));var express=require(_0xcd33('0x3'));var router=express['Router']();var fs_extra=require(_0xcd33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcd33('0x5'));var config=require(_0xcd33('0x6'));var controller=require(_0xcd33('0x7'));router[_0xcd33('0x8')]('/',auth[_0xcd33('0x9')](),controller['index']);router[_0xcd33('0x8')]('/:id',auth[_0xcd33('0x9')](),controller['show']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xcd33('0xa')]);router[_0xcd33('0xb')]('/',auth[_0xcd33('0x9')](),controller[_0xcd33('0xc')]);router[_0xcd33('0xb')](_0xcd33('0xd'),auth[_0xcd33('0x9')](),controller[_0xcd33('0xe')]);router[_0xcd33('0xf')](_0xcd33('0x10'),auth[_0xcd33('0x9')](),controller[_0xcd33('0x11')]);router[_0xcd33('0x12')](_0xcd33('0x10'),auth[_0xcd33('0x9')](),controller[_0xcd33('0x13')]);router['delete'](_0xcd33('0xd'),auth[_0xcd33('0x9')](),controller[_0xcd33('0x14')]);module['exports']=router; \ No newline at end of file +var _0x58c8=['show','/:id/users','getUsers','post','addUsers','put','/:id','delete','destroy','removeUsers','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x2e293b,_0x3a6cb1){var _0x5d7a68=function(_0x315233){while(--_0x315233){_0x2e293b['push'](_0x2e293b['shift']());}};_0x5d7a68(++_0x3a6cb1);}(_0x58c8,0x1d9));var _0x858c=function(_0x518ba6,_0x2f55b3){_0x518ba6=_0x518ba6-0x0;var _0x319f35=_0x58c8[_0x518ba6];return _0x319f35;};'use strict';var multer=require('multer');var util=require(_0x858c('0x0'));var path=require('path');var timeout=require(_0x858c('0x1'));var express=require('express');var router=express[_0x858c('0x2')]();var fs_extra=require(_0x858c('0x3'));var auth=require(_0x858c('0x4'));var interaction=require(_0x858c('0x5'));var config=require(_0x858c('0x6'));var controller=require(_0x858c('0x7'));router[_0x858c('0x8')]('/',auth[_0x858c('0x9')](),controller[_0x858c('0xa')]);router[_0x858c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x858c('0xb')]);router[_0x858c('0x8')](_0x858c('0xc'),auth[_0x858c('0x9')](),controller[_0x858c('0xd')]);router['post']('/',auth[_0x858c('0x9')](),controller['create']);router[_0x858c('0xe')](_0x858c('0xc'),auth['isAuthenticated'](),controller[_0x858c('0xf')]);router[_0x858c('0x10')](_0x858c('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x858c('0x12')](_0x858c('0x11'),auth['isAuthenticated'](),controller[_0x858c('0x13')]);router[_0x858c('0x12')](_0x858c('0xc'),auth[_0x858c('0x9')](),controller[_0x858c('0x14')]);module[_0x858c('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6036f61..0813900 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 _0x843c=['utf8','long','production','sequelize','exports','name','STRING','TEXT','BLOB','getDataValue','preproduction','toString'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x843c,0x1bf));var _0xc843=function(_0x552aa3,_0x53f1ee){_0x552aa3=_0x552aa3-0x0;var _0x266880=_0x843c[_0x552aa3];return _0x266880;};'use strict';var Sequelize=require(_0xc843('0x0'));module[_0xc843('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc843('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc843('0x3')]},'notes':{'type':Sequelize[_0xc843('0x4')]},'preproduction':{'type':Sequelize[_0xc843('0x5')]('long'),'get':function(){if(this[_0xc843('0x6')](_0xc843('0x7'))){return this[_0xc843('0x6')](_0xc843('0x7'))[_0xc843('0x8')](_0xc843('0x9'));}}},'production':{'type':Sequelize[_0xc843('0x5')](_0xc843('0xa')),'get':function(){if(this['getDataValue'](_0xc843('0xb'))){return this[_0xc843('0x6')](_0xc843('0xb'))[_0xc843('0x8')](_0xc843('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4e25=['STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','exports'];(function(_0x5f4e19,_0x1f3030){var _0x10f3ee=function(_0x25cb24){while(--_0x25cb24){_0x5f4e19['push'](_0x5f4e19['shift']());}};_0x10f3ee(++_0x1f3030);}(_0x4e25,0x175));var _0x54e2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4e25[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x54e2('0x0')]={'name':{'type':Sequelize[_0x54e2('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x54e2('0x1')]},'notes':{'type':Sequelize[_0x54e2('0x2')]},'preproduction':{'type':Sequelize[_0x54e2('0x3')]('long'),'get':function(){if(this[_0x54e2('0x4')](_0x54e2('0x5'))){return this[_0x54e2('0x4')](_0x54e2('0x5'))[_0x54e2('0x6')](_0x54e2('0x7'));}}},'production':{'type':Sequelize[_0x54e2('0x3')](_0x54e2('0x8')),'get':function(){if(this['getDataValue'](_0x54e2('0x9'))){return this[_0x54e2('0x4')]('production')['toString'](_0x54e2('0x7'));}}},'savedAt':{'type':Sequelize[_0x54e2('0xa')]},'publishedAt':{'type':Sequelize[_0x54e2('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 25feaa9..009507f 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 _0x57ca=['sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','user','role','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','User','order','getUsers','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit'];(function(_0x5d05d9,_0x40bfa5){var _0x428a79=function(_0x5f5bda){while(--_0x5f5bda){_0x5d05d9['push'](_0x5d05d9['shift']());}};_0x428a79(++_0x40bfa5);}(_0x57ca,0x108));var _0xa57c=function(_0x11042f,_0x34aa6c){_0x11042f=_0x11042f-0x0;var _0xa2622d=_0x57ca[_0x11042f];return _0xa2622d;};'use strict';var _=require('lodash');var Redis=require(_0xa57c('0x0'));var qs=require(_0xa57c('0x1'));var logger=require('../../config/logger')(_0xa57c('0x2'));var config=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];config[_0xa57c('0x5')]=_[_0xa57c('0x6')](config['redis'],{'host':_0xa57c('0x7'),'port':0x18eb});var socket=require(_0xa57c('0x8'))(new Redis(config[_0xa57c('0x5')]));require(_0xa57c('0x9'))[_0xa57c('0xa')](socket);function respondWithStatusCode(_0x314574,_0x19e28e){_0x19e28e=_0x19e28e||0xcc;return function(_0x271ccc){if(_0x271ccc){return _0x314574['sendStatus'](_0x19e28e);}return _0x314574[_0xa57c('0xb')](_0x19e28e)['end']();};}function respondWithResult(_0x46ba92,_0x932dcc){_0x932dcc=_0x932dcc||0xc8;return function(_0x4fa5ed){if(_0x4fa5ed){return _0x46ba92[_0xa57c('0xb')](_0x932dcc)['json'](_0x4fa5ed);}};}function respondWithFilteredResult(_0x554101,_0x44b221){return function(_0x58e6b6){if(_0x58e6b6){var _0x2ed4c6=typeof _0x44b221['offset']===_0xa57c('0xc')&&typeof _0x44b221[_0xa57c('0xd')]===_0xa57c('0xc');var _0x9e25bf=_0x58e6b6[_0xa57c('0xe')];var _0x57a546=_0x2ed4c6?0x0:_0x44b221[_0xa57c('0xf')];var _0x546cde=_0x2ed4c6?_0x58e6b6[_0xa57c('0xe')]:_0x44b221[_0xa57c('0xf')]+_0x44b221[_0xa57c('0xd')];var _0x3821d2;if(_0x546cde>=_0x9e25bf){_0x546cde=_0x9e25bf;_0x3821d2=0xc8;}else{_0x3821d2=0xce;}_0x554101[_0xa57c('0xb')](_0x3821d2);return _0x554101[_0xa57c('0x10')](_0xa57c('0x11'),_0x57a546+'-'+_0x546cde+'/'+_0x9e25bf)['json'](_0x58e6b6);}return null;};}function saveUpdates(_0x26607a){return function(_0xdf7ff6){if(_0xdf7ff6){return _0xdf7ff6[_0xa57c('0x12')](_0x26607a)['then'](function(_0x2746a0){return _0x2746a0;});}return null;};}function removeEntity(_0x5f33f1){return function(_0x3e7afa){if(_0x3e7afa){return _0x3e7afa[_0xa57c('0x13')]()[_0xa57c('0x14')](function(){var _0xe3d505=_0x3e7afa[_0xa57c('0x15')]({'plain':!![]});var _0x4728f9=_0xa57c('0x16');return db[_0xa57c('0x17')]['destroy']({'where':{'type':_0x4728f9,'resourceId':_0xe3d505['id']}})[_0xa57c('0x14')](function(){return _0x3e7afa;});})['then'](function(){var _0x4a35bb=new Redis(config[_0xa57c('0x5')]);_0x4a35bb[_0xa57c('0x18')](_0xa57c('0x19'),JSON[_0xa57c('0x1a')]({'id':_0x3e7afa['id'],'deleted':!![]}));})['then'](function(){_0x5f33f1[_0xa57c('0xb')](0xcc)[_0xa57c('0x1b')]();});}};}function handleEntityNotFound(_0x34d1bc){return function(_0x2213b2){if(!_0x2213b2){_0x34d1bc[_0xa57c('0x1c')](0x194);}return _0x2213b2;};}function handleError(_0x1404fd,_0x1e0192){_0x1e0192=_0x1e0192||0x1f4;return function(_0x42038e){logger[_0xa57c('0x1d')](_0x42038e[_0xa57c('0x1e')]);if(_0x42038e[_0xa57c('0x1f')]){delete _0x42038e[_0xa57c('0x1f')];}_0x1404fd[_0xa57c('0xb')](_0x1e0192)[_0xa57c('0x20')](_0x42038e);};}exports[_0xa57c('0x21')]=function(_0x511a26,_0x2db443){var _0x5226d0={},_0x27884d={},_0x5228b9={'count':0x0,'rows':[]};var _0x315ad7=_[_0xa57c('0x22')](db[_0xa57c('0x23')][_0xa57c('0x24')],function(_0x337f97){return{'name':_0x337f97[_0xa57c('0x25')],'type':_0x337f97['type'][_0xa57c('0x26')]};});_0x27884d['model']=_['map'](_0x315ad7,_0xa57c('0x1f'));_0x27884d[_0xa57c('0x27')]=_['keys'](_0x511a26[_0xa57c('0x27')]);_0x27884d[_0xa57c('0x28')]=_[_0xa57c('0x29')](_0x27884d['model'],_0x27884d[_0xa57c('0x27')]);_0x5226d0['attributes']=_[_0xa57c('0x29')](_0x27884d['model'],qs[_0xa57c('0x2a')](_0x511a26['query'][_0xa57c('0x2a')]));_0x5226d0['attributes']=_0x5226d0[_0xa57c('0x2b')][_0xa57c('0x2c')]?_0x5226d0[_0xa57c('0x2b')]:_0x27884d[_0xa57c('0x2d')];if(!_0x511a26[_0xa57c('0x27')][_0xa57c('0x2e')](_0xa57c('0x2f'))){_0x5226d0['limit']=qs[_0xa57c('0xd')](_0x511a26['query'][_0xa57c('0xd')]);_0x5226d0[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x511a26['query'][_0xa57c('0xf')]);}_0x5226d0['order']=qs[_0xa57c('0x30')](_0x511a26['query'][_0xa57c('0x30')]);_0x5226d0['where']=qs[_0xa57c('0x28')](_[_0xa57c('0x31')](_0x511a26['query'],_0x27884d[_0xa57c('0x28')]),_0x315ad7);if(_0x511a26['query'][_0xa57c('0x32')]){_0x5226d0['where']=_[_0xa57c('0x33')](_0x5226d0[_0xa57c('0x34')],{'$or':_[_0xa57c('0x22')](_0x315ad7,function(_0x62f697){if(_0x62f697[_0xa57c('0x35')]!==_0xa57c('0x36')){var _0x59b8af={};_0x59b8af[_0x62f697['name']]={'$like':'%'+_0x511a26[_0xa57c('0x27')][_0xa57c('0x32')]+'%'};return _0x59b8af;}})});}_0x5226d0=_[_0xa57c('0x33')]({},_0x5226d0,_0x511a26['options']);var _0x12b644={'where':_0x5226d0['where']};return db[_0xa57c('0x23')][_0xa57c('0xe')](_0x12b644)['then'](function(_0x558cf7){_0x5228b9['count']=_0x558cf7;if(_0x511a26[_0xa57c('0x27')][_0xa57c('0x37')]){_0x5226d0[_0xa57c('0x38')]=[{'all':!![]}];}return db[_0xa57c('0x23')][_0xa57c('0x39')](_0x5226d0);})[_0xa57c('0x14')](function(_0x5a444a){_0x5228b9[_0xa57c('0x3a')]=_0x5a444a;return _0x5228b9;})[_0xa57c('0x14')](respondWithFilteredResult(_0x2db443,_0x5226d0))['catch'](handleError(_0x2db443,null));};exports['show']=function(_0x5e10b,_0x203375){var _0x5af5e9={'raw':![],'where':{'id':_0x5e10b[_0xa57c('0x3b')]['id']}},_0x24459a={};_0x24459a[_0xa57c('0x2d')]=_[_0xa57c('0x3c')](db[_0xa57c('0x23')][_0xa57c('0x24')]);_0x24459a['query']=_[_0xa57c('0x3c')](_0x5e10b['query']);_0x24459a['filters']=_['intersection'](_0x24459a['model'],_0x24459a['query']);_0x5af5e9[_0xa57c('0x2b')]=_[_0xa57c('0x29')](_0x24459a[_0xa57c('0x2d')],qs['fields'](_0x5e10b['query']['fields']));_0x5af5e9[_0xa57c('0x2b')]=_0x5af5e9[_0xa57c('0x2b')][_0xa57c('0x2c')]?_0x5af5e9[_0xa57c('0x2b')]:_0x24459a[_0xa57c('0x2d')];if(_0x5e10b[_0xa57c('0x27')]['includeAll']){_0x5af5e9[_0xa57c('0x38')]=[{'all':!![]}];}_0x5af5e9=_[_0xa57c('0x33')]({},_0x5af5e9,_0x5e10b[_0xa57c('0x3d')]);return db[_0xa57c('0x23')][_0xa57c('0x3e')](_0x5af5e9)[_0xa57c('0x14')](handleEntityNotFound(_0x203375,null))['then'](respondWithResult(_0x203375,null))[_0xa57c('0x3f')](handleError(_0x203375,null));};exports[_0xa57c('0x40')]=function(_0xa3ff0,_0x14e943){return db[_0xa57c('0x23')]['create'](_0xa3ff0[_0xa57c('0x41')],{})[_0xa57c('0x14')](function(_0xa18f64){var _0x17aae4=_0xa3ff0[_0xa57c('0x42')][_0xa57c('0x15')]({'plain':!![]});if(!_0x17aae4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17aae4[_0xa57c('0x43')]===_0xa57c('0x42')){var _0x247906=_0xa18f64[_0xa57c('0x15')]({'plain':!![]});var _0x2ea6af=_0xa57c('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x2ea6af,'userProfileId':_0x17aae4['userProfileId']},'raw':!![]})['then'](function(_0x232675){if(_0x232675&&_0x232675['autoAssociation']===0x0){return db[_0xa57c('0x17')][_0xa57c('0x40')]({'name':_0x247906['name'],'resourceId':_0x247906['id'],'type':_0x232675[_0xa57c('0x1f')],'sectionId':_0x232675['id']},{})[_0xa57c('0x14')](function(){return _0xa18f64;});}else{return _0xa18f64;}})[_0xa57c('0x3f')](function(_0x128ea2){logger[_0xa57c('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x128ea2);throw _0x128ea2;});}return _0xa18f64;})[_0xa57c('0x14')](respondWithResult(_0x14e943,0xc9))[_0xa57c('0x3f')](handleError(_0x14e943,null));};exports[_0xa57c('0x12')]=function(_0xd57bac,_0x2e4b84){if(_0xd57bac['body']['id']){delete _0xd57bac[_0xa57c('0x41')]['id'];}return db['SquareProject']['find']({'where':{'id':_0xd57bac[_0xa57c('0x3b')]['id']}})[_0xa57c('0x14')](handleEntityNotFound(_0x2e4b84,null))[_0xa57c('0x14')](saveUpdates(_0xd57bac['body'],null))['then'](function(_0x10c281){if(!_0x10c281)return;var _0x1eca91=_0x10c281[_0xa57c('0x15')]({'plain':!![]});return _0x1eca91;})[_0xa57c('0x14')](function(_0x4d2899){var _0x3c450f=new Redis(config[_0xa57c('0x5')]);_0x3c450f[_0xa57c('0x18')]('agi',JSON['stringify'](_[_0xa57c('0x31')](_0x4d2899,['id',_0xa57c('0x1f'),'production'])));return _0x4d2899;})[_0xa57c('0x14')](respondWithResult(_0x2e4b84,null))[_0xa57c('0x3f')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x13')]=function(_0x43484e,_0x369514){return db[_0xa57c('0x23')][_0xa57c('0x3e')]({'where':{'id':_0x43484e['params']['id']}})['then'](handleEntityNotFound(_0x369514,null))[_0xa57c('0x14')](removeEntity(_0x369514,null))[_0xa57c('0x3f')](handleError(_0x369514,null));};exports[_0xa57c('0x44')]=function(_0x2a6538,_0x15aeb7){return db[_0xa57c('0x23')][_0xa57c('0x3e')]({'where':{'id':_0x2a6538[_0xa57c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x15aeb7,null))['then'](function(_0x28997e){if(_0x28997e){return _0x28997e['addUsers'](_0x2a6538[_0xa57c('0x41')][_0xa57c('0x45')],_[_0xa57c('0x46')](_0x2a6538['body'],[_0xa57c('0x45'),'id'])||{});}})['then'](respondWithResult(_0x15aeb7,null))[_0xa57c('0x3f')](handleError(_0x15aeb7,null));};exports['removeUsers']=function(_0x39484d,_0x170187){return db[_0xa57c('0x23')][_0xa57c('0x3e')]({'where':{'id':_0x39484d['params']['id']}})[_0xa57c('0x14')](handleEntityNotFound(_0x170187,null))[_0xa57c('0x14')](function(_0x3bd25a){if(_0x3bd25a){return _0x3bd25a[_0xa57c('0x47')](_0x39484d[_0xa57c('0x27')]['ids'])[_0xa57c('0x14')](function(){if(_[_0xa57c('0x48')](_0x39484d[_0xa57c('0x27')][_0xa57c('0x45')])){for(var _0x2adcf6=0x0;_0x2adcf6<_0x39484d[_0xa57c('0x27')][_0xa57c('0x45')][_0xa57c('0x2c')];_0x2adcf6+=0x1){socket[_0xa57c('0x49')](_0xa57c('0x4a'),{'UserId':Number(_0x39484d['query'][_0xa57c('0x45')][_0x2adcf6]),'SquareProjectId':Number(_0x39484d[_0xa57c('0x3b')]['id'])});}}else{socket[_0xa57c('0x49')](_0xa57c('0x4a'),{'UserId':Number(_0x39484d[_0xa57c('0x27')][_0xa57c('0x45')]),'SquareProjectId':Number(_0x39484d['params']['id'])});}});}})[_0xa57c('0x14')](respondWithStatusCode(_0x170187,null))[_0xa57c('0x3f')](handleError(_0x170187,null));};exports['getUsers']=function(_0xb164af,_0x3f5c19){var _0x29c66f={};var _0xa78a75={};var _0x40c0a0;var _0x255cef;return db[_0xa57c('0x23')]['findOne']({'where':{'id':_0xb164af[_0xa57c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3f5c19,null))[_0xa57c('0x14')](function(_0x56ac7e){if(_0x56ac7e){_0x40c0a0=_0x56ac7e;_0xa78a75[_0xa57c('0x2d')]=_['keys'](db[_0xa57c('0x4b')][_0xa57c('0x24')]);_0xa78a75['query']=_[_0xa57c('0x3c')](_0xb164af[_0xa57c('0x27')]);_0xa78a75[_0xa57c('0x28')]=_[_0xa57c('0x29')](_0xa78a75['model'],_0xa78a75[_0xa57c('0x27')]);_0x29c66f[_0xa57c('0x2b')]=_[_0xa57c('0x29')](_0xa78a75[_0xa57c('0x2d')],qs[_0xa57c('0x2a')](_0xb164af[_0xa57c('0x27')][_0xa57c('0x2a')]));_0x29c66f[_0xa57c('0x2b')]=_0x29c66f[_0xa57c('0x2b')][_0xa57c('0x2c')]?_0x29c66f[_0xa57c('0x2b')]:_0xa78a75[_0xa57c('0x2d')];_0x29c66f[_0xa57c('0x4c')]=qs[_0xa57c('0x30')](_0xb164af[_0xa57c('0x27')][_0xa57c('0x30')]);_0x29c66f['where']=qs[_0xa57c('0x28')](_['pick'](_0xb164af[_0xa57c('0x27')],_0xa78a75[_0xa57c('0x28')]));if(_0xb164af[_0xa57c('0x27')]['filter']){_0x29c66f[_0xa57c('0x34')]=_[_0xa57c('0x33')](_0x29c66f[_0xa57c('0x34')],{'$or':_['map'](_0x29c66f['attributes'],function(_0x20ff5f){var _0x39aa65={};_0x39aa65[_0x20ff5f]={'$like':'%'+_0xb164af[_0xa57c('0x27')][_0xa57c('0x32')]+'%'};return _0x39aa65;})});}_0x29c66f=_[_0xa57c('0x33')]({},_0x29c66f,_0xb164af[_0xa57c('0x3d')]);return _0x40c0a0[_0xa57c('0x4d')](_0x29c66f);}})[_0xa57c('0x14')](function(_0x37cbaf){if(_0x37cbaf){_0x255cef=_0x37cbaf['length'];if(!_0xb164af[_0xa57c('0x27')][_0xa57c('0x2e')]('nolimit')){_0x29c66f[_0xa57c('0xd')]=qs[_0xa57c('0xd')](_0xb164af[_0xa57c('0x27')][_0xa57c('0xd')]);_0x29c66f[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0xb164af[_0xa57c('0x27')][_0xa57c('0xf')]);}return _0x40c0a0['getUsers'](_0x29c66f);}})[_0xa57c('0x14')](function(_0x29bf7f){if(_0x29bf7f){return _0x29bf7f?{'count':_0x255cef,'rows':_0x29bf7f}:null;}})['then'](respondWithResult(_0x3f5c19,null))[_0xa57c('0x3f')](handleError(_0x3f5c19,null));}; \ No newline at end of file +var _0xc1c6=['../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','SquareProjects','then','publish','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SquareProject','includeAll','include','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis'];(function(_0x5246dd,_0x5e824d){var _0x357762=function(_0x6855a7){while(--_0x6855a7){_0x5246dd['push'](_0x5246dd['shift']());}};_0x357762(++_0x5e824d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4ccb7e,_0x185e96){_0x4ccb7e=_0x4ccb7e-0x0;var _0x25fe87=_0xc1c6[_0x4ccb7e];return _0x25fe87;};'use strict';var _=require(_0x6c1c('0x0'));var Redis=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var logger=require('../../config/logger')(_0x6c1c('0x3'));var config=require('../../config/environment');var db=require(_0x6c1c('0x4'))['db'];config[_0x6c1c('0x5')]=_[_0x6c1c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c1c('0x7'))(new Redis(config['redis']));require(_0x6c1c('0x8'))['register'](socket);function respondWithStatusCode(_0xe510ca,_0x2eb1ba){_0x2eb1ba=_0x2eb1ba||0xcc;return function(_0x38369d){if(_0x38369d){return _0xe510ca[_0x6c1c('0x9')](_0x2eb1ba);}return _0xe510ca['status'](_0x2eb1ba)[_0x6c1c('0xa')]();};}function respondWithResult(_0x3ca985,_0x524d21){_0x524d21=_0x524d21||0xc8;return function(_0x147c7b){if(_0x147c7b){return _0x3ca985[_0x6c1c('0xb')](_0x524d21)[_0x6c1c('0xc')](_0x147c7b);}};}function respondWithFilteredResult(_0x1137e8,_0x49fb01){return function(_0x3a25a2){if(_0x3a25a2){var _0x2a4fd4=typeof _0x49fb01[_0x6c1c('0xd')]==='undefined'&&typeof _0x49fb01[_0x6c1c('0xe')]===_0x6c1c('0xf');var _0x2067bd=_0x3a25a2['count'];var _0x2e82e9=_0x2a4fd4?0x0:_0x49fb01['offset'];var _0x357370=_0x2a4fd4?_0x3a25a2[_0x6c1c('0x10')]:_0x49fb01[_0x6c1c('0xd')]+_0x49fb01[_0x6c1c('0xe')];var _0x350e6f;if(_0x357370>=_0x2067bd){_0x357370=_0x2067bd;_0x350e6f=0xc8;}else{_0x350e6f=0xce;}_0x1137e8[_0x6c1c('0xb')](_0x350e6f);return _0x1137e8[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x2e82e9+'-'+_0x357370+'/'+_0x2067bd)[_0x6c1c('0xc')](_0x3a25a2);}return null;};}function saveUpdates(_0x5f3758){return function(_0x3df1b7){if(_0x3df1b7){return _0x3df1b7[_0x6c1c('0x13')](_0x5f3758)['then'](function(_0x3a2d32){return _0x3a2d32;});}return null;};}function removeEntity(_0x237cac){return function(_0x494ffc){if(_0x494ffc){return _0x494ffc[_0x6c1c('0x14')]()['then'](function(){var _0x338dc2=_0x494ffc[_0x6c1c('0x15')]({'plain':!![]});var _0x5a3bb7=_0x6c1c('0x16');return db['UserProfileResource'][_0x6c1c('0x14')]({'where':{'type':_0x5a3bb7,'resourceId':_0x338dc2['id']}})[_0x6c1c('0x17')](function(){return _0x494ffc;});})[_0x6c1c('0x17')](function(){var _0x211f49=new Redis(config[_0x6c1c('0x5')]);_0x211f49[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON[_0x6c1c('0x1a')]({'id':_0x494ffc['id'],'deleted':!![]}));})[_0x6c1c('0x17')](function(){_0x237cac[_0x6c1c('0xb')](0xcc)[_0x6c1c('0xa')]();});}};}function handleEntityNotFound(_0x450b1f){return function(_0x2382c0){if(!_0x2382c0){_0x450b1f[_0x6c1c('0x9')](0x194);}return _0x2382c0;};}function handleError(_0x31fed2,_0x19c269){_0x19c269=_0x19c269||0x1f4;return function(_0x2319d3){logger[_0x6c1c('0x1b')](_0x2319d3[_0x6c1c('0x1c')]);if(_0x2319d3[_0x6c1c('0x1d')]){delete _0x2319d3[_0x6c1c('0x1d')];}_0x31fed2[_0x6c1c('0xb')](_0x19c269)[_0x6c1c('0x1e')](_0x2319d3);};}exports[_0x6c1c('0x1f')]=function(_0x18452d,_0x80bc05){var _0x3b7cc1={},_0x1b9d7d={},_0x2feaf4={'count':0x0,'rows':[]};var _0x5f4568=_[_0x6c1c('0x20')](db['SquareProject'][_0x6c1c('0x21')],function(_0x4c23f8){return{'name':_0x4c23f8[_0x6c1c('0x22')],'type':_0x4c23f8['type'][_0x6c1c('0x23')]};});_0x1b9d7d[_0x6c1c('0x24')]=_['map'](_0x5f4568,_0x6c1c('0x1d'));_0x1b9d7d[_0x6c1c('0x25')]=_['keys'](_0x18452d[_0x6c1c('0x25')]);_0x1b9d7d[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],_0x1b9d7d['query']);_0x3b7cc1['attributes']=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x28')]));_0x3b7cc1[_0x6c1c('0x29')]=_0x3b7cc1['attributes'][_0x6c1c('0x2a')]?_0x3b7cc1[_0x6c1c('0x29')]:_0x1b9d7d['model'];if(!_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2b')](_0x6c1c('0x2c'))){_0x3b7cc1[_0x6c1c('0xe')]=qs['limit'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0xe')]);_0x3b7cc1[_0x6c1c('0xd')]=qs['offset'](_0x18452d[_0x6c1c('0x25')]['offset']);}_0x3b7cc1[_0x6c1c('0x2d')]=qs['sort'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2e')]);_0x3b7cc1[_0x6c1c('0x2f')]=qs['filters'](_['pick'](_0x18452d[_0x6c1c('0x25')],_0x1b9d7d[_0x6c1c('0x26')]),_0x5f4568);if(_0x18452d[_0x6c1c('0x25')]['filter']){_0x3b7cc1[_0x6c1c('0x2f')]=_['merge'](_0x3b7cc1['where'],{'$or':_[_0x6c1c('0x20')](_0x5f4568,function(_0xbafcb3){if(_0xbafcb3[_0x6c1c('0x30')]!==_0x6c1c('0x31')){var _0x4bed10={};_0x4bed10[_0xbafcb3[_0x6c1c('0x1d')]]={'$like':'%'+_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4bed10;}})});}_0x3b7cc1=_[_0x6c1c('0x33')]({},_0x3b7cc1,_0x18452d[_0x6c1c('0x34')]);var _0x398e95={'where':_0x3b7cc1[_0x6c1c('0x2f')]};return db[_0x6c1c('0x35')][_0x6c1c('0x10')](_0x398e95)[_0x6c1c('0x17')](function(_0x47d75e){_0x2feaf4[_0x6c1c('0x10')]=_0x47d75e;if(_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x36')]){_0x3b7cc1[_0x6c1c('0x37')]=[{'all':!![]}];}return db[_0x6c1c('0x35')]['findAll'](_0x3b7cc1);})['then'](function(_0x549db1){_0x2feaf4[_0x6c1c('0x38')]=_0x549db1;return _0x2feaf4;})['then'](respondWithFilteredResult(_0x80bc05,_0x3b7cc1))['catch'](handleError(_0x80bc05,null));};exports[_0x6c1c('0x39')]=function(_0x37244e,_0x5f3f3e){var _0x2b2ae5={'raw':![],'where':{'id':_0x37244e[_0x6c1c('0x3a')]['id']}},_0x40645f={};_0x40645f['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x35')]['rawAttributes']);_0x40645f[_0x6c1c('0x25')]=_['keys'](_0x37244e[_0x6c1c('0x25')]);_0x40645f[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],_0x40645f[_0x6c1c('0x25')]);_0x2b2ae5['attributes']=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x37244e['query'][_0x6c1c('0x28')]));_0x2b2ae5[_0x6c1c('0x29')]=_0x2b2ae5[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x2b2ae5[_0x6c1c('0x29')]:_0x40645f['model'];if(_0x37244e[_0x6c1c('0x25')]['includeAll']){_0x2b2ae5['include']=[{'all':!![]}];}_0x2b2ae5=_['merge']({},_0x2b2ae5,_0x37244e[_0x6c1c('0x34')]);return db[_0x6c1c('0x35')][_0x6c1c('0x3c')](_0x2b2ae5)[_0x6c1c('0x17')](handleEntityNotFound(_0x5f3f3e,null))[_0x6c1c('0x17')](respondWithResult(_0x5f3f3e,null))[_0x6c1c('0x3d')](handleError(_0x5f3f3e,null));};exports[_0x6c1c('0x3e')]=function(_0x167f3b,_0x5ed2d7){return db[_0x6c1c('0x35')][_0x6c1c('0x3e')](_0x167f3b['body'],{})[_0x6c1c('0x17')](function(_0x5518f6){var _0x39e741=_0x167f3b[_0x6c1c('0x3f')][_0x6c1c('0x15')]({'plain':!![]});if(!_0x39e741)throw new Error(_0x6c1c('0x40'));if(_0x39e741[_0x6c1c('0x41')]==='user'){var _0x1fe6e8=_0x5518f6['get']({'plain':!![]});var _0x2a59bc=_0x6c1c('0x16');return db[_0x6c1c('0x42')][_0x6c1c('0x3c')]({'where':{'name':_0x2a59bc,'userProfileId':_0x39e741[_0x6c1c('0x43')]},'raw':!![]})[_0x6c1c('0x17')](function(_0x52c14d){if(_0x52c14d&&_0x52c14d[_0x6c1c('0x44')]===0x0){return db[_0x6c1c('0x45')]['create']({'name':_0x1fe6e8[_0x6c1c('0x1d')],'resourceId':_0x1fe6e8['id'],'type':_0x52c14d[_0x6c1c('0x1d')],'sectionId':_0x52c14d['id']},{})[_0x6c1c('0x17')](function(){return _0x5518f6;});}else{return _0x5518f6;}})[_0x6c1c('0x3d')](function(_0x5badb4){logger[_0x6c1c('0x1b')](_0x6c1c('0x46'),_0x5badb4);throw _0x5badb4;});}return _0x5518f6;})[_0x6c1c('0x17')](respondWithResult(_0x5ed2d7,0xc9))['catch'](handleError(_0x5ed2d7,null));};exports['update']=function(_0x56b367,_0x5714a6){if(_0x56b367['body']['id']){delete _0x56b367[_0x6c1c('0x47')]['id'];}return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x56b367[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x17')](saveUpdates(_0x56b367['body'],null))['then'](function(_0x28bd68){if(!_0x28bd68)return;var _0xd5936=_0x28bd68['get']({'plain':!![]});return _0xd5936;})[_0x6c1c('0x17')](function(_0x25dda9){var _0x3f4303=new Redis(config[_0x6c1c('0x5')]);_0x3f4303[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON['stringify'](_[_0x6c1c('0x48')](_0x25dda9,['id',_0x6c1c('0x1d'),'production'])));return _0x25dda9;})['then'](respondWithResult(_0x5714a6,null))[_0x6c1c('0x3d')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x14')]=function(_0x3a2fef,_0x58ac8d){return db[_0x6c1c('0x35')][_0x6c1c('0x3c')]({'where':{'id':_0x3a2fef[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x58ac8d,null))['then'](removeEntity(_0x58ac8d,null))['catch'](handleError(_0x58ac8d,null));};exports[_0x6c1c('0x49')]=function(_0x1ac7e4,_0x1a8e19){return db['SquareProject']['find']({'where':{'id':_0x1ac7e4[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x1a8e19,null))['then'](function(_0x2a334b){if(_0x2a334b){return _0x2a334b[_0x6c1c('0x49')](_0x1ac7e4[_0x6c1c('0x47')][_0x6c1c('0x4a')],_[_0x6c1c('0x4b')](_0x1ac7e4[_0x6c1c('0x47')],['ids','id'])||{});}})[_0x6c1c('0x17')](respondWithResult(_0x1a8e19,null))['catch'](handleError(_0x1a8e19,null));};exports[_0x6c1c('0x4c')]=function(_0x1930ea,_0x117240){return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x1930ea['params']['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x117240,null))[_0x6c1c('0x17')](function(_0x612be2){if(_0x612be2){return _0x612be2['removeUsers'](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])[_0x6c1c('0x17')](function(){if(_[_0x6c1c('0x4d')](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])){for(var _0xed095f=0x0;_0xed095f<_0x1930ea['query'][_0x6c1c('0x4a')]['length'];_0xed095f+=0x1){socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')][_0xed095f]),'SquareProjectId':Number(_0x1930ea['params']['id'])});}}else{socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')]),'SquareProjectId':Number(_0x1930ea[_0x6c1c('0x3a')]['id'])});}});}})[_0x6c1c('0x17')](respondWithStatusCode(_0x117240,null))[_0x6c1c('0x3d')](handleError(_0x117240,null));};exports[_0x6c1c('0x50')]=function(_0x2d248c,_0x13963a){var _0x26ee48={};var _0x4fa646={};var _0x43d379;var _0x6b05c7;return db[_0x6c1c('0x35')][_0x6c1c('0x51')]({'where':{'id':_0x2d248c[_0x6c1c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13963a,null))[_0x6c1c('0x17')](function(_0x39636a){if(_0x39636a){_0x43d379=_0x39636a;_0x4fa646['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x52')][_0x6c1c('0x21')]);_0x4fa646['query']=_[_0x6c1c('0x3b')](_0x2d248c[_0x6c1c('0x25')]);_0x4fa646[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x4fa646[_0x6c1c('0x24')],_0x4fa646[_0x6c1c('0x25')]);_0x26ee48['attributes']=_['intersection'](_0x4fa646[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x2d248c['query']['fields']));_0x26ee48['attributes']=_0x26ee48[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x26ee48[_0x6c1c('0x29')]:_0x4fa646[_0x6c1c('0x24')];_0x26ee48['order']=qs[_0x6c1c('0x2e')](_0x2d248c['query']['sort']);_0x26ee48['where']=qs[_0x6c1c('0x26')](_[_0x6c1c('0x48')](_0x2d248c[_0x6c1c('0x25')],_0x4fa646[_0x6c1c('0x26')]));if(_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]){_0x26ee48['where']=_[_0x6c1c('0x33')](_0x26ee48[_0x6c1c('0x2f')],{'$or':_[_0x6c1c('0x20')](_0x26ee48['attributes'],function(_0x585a42){var _0x4ea97d={};_0x4ea97d[_0x585a42]={'$like':'%'+_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4ea97d;})});}_0x26ee48=_['merge']({},_0x26ee48,_0x2d248c[_0x6c1c('0x34')]);return _0x43d379['getUsers'](_0x26ee48);}})[_0x6c1c('0x17')](function(_0x1fc46f){if(_0x1fc46f){_0x6b05c7=_0x1fc46f[_0x6c1c('0x2a')];if(!_0x2d248c[_0x6c1c('0x25')]['hasOwnProperty'](_0x6c1c('0x2c'))){_0x26ee48[_0x6c1c('0xe')]=qs['limit'](_0x2d248c['query'][_0x6c1c('0xe')]);_0x26ee48[_0x6c1c('0xd')]=qs[_0x6c1c('0xd')](_0x2d248c['query'][_0x6c1c('0xd')]);}return _0x43d379[_0x6c1c('0x50')](_0x26ee48);}})['then'](function(_0x4a730a){if(_0x4a730a){return _0x4a730a?{'count':_0x6b05c7,'rows':_0x4a730a}:null;}})['then'](respondWithResult(_0x13963a,null))['catch'](handleError(_0x13963a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8098f9b..169861d 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 _0x628c=['exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x49cff4,_0x567173){var _0x173b56=function(_0x2a83f5){while(--_0x2a83f5){_0x49cff4['push'](_0x49cff4['shift']());}};_0x173b56(++_0x567173);}(_0x628c,0x151));var _0xc628=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x628c[_0x4ded65];return _0x5864fb;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xc628('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc628('0x1')](0x0);var events={'afterCreate':_0xc628('0x2'),'afterUpdate':'update','afterDestroy':_0xc628('0x3')};function emitEvent(_0x452323){return function(_0x49c490,_0x1b20f0,_0x594704){SquareProjectEvents[_0xc628('0x4')](_0x452323+':'+_0x49c490['id'],_0x49c490);SquareProjectEvents[_0xc628('0x4')](_0x452323,_0x49c490);_0x594704(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xc628('0x5')]=SquareProjectEvents; \ No newline at end of file +var _0x3eca=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x3eca,0xc9));var _0xa3ec=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x3eca[_0x845505];return _0x2513b9;};'use strict';var EventEmitter=require(_0xa3ec('0x0'));var SquareProject=require(_0xa3ec('0x1'))['db'][_0xa3ec('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa3ec('0x3')](0x0);var events={'afterCreate':_0xa3ec('0x4'),'afterUpdate':_0xa3ec('0x5'),'afterDestroy':_0xa3ec('0x6')};function emitEvent(_0x41b0c4){return function(_0x5b9de2,_0x41d480,_0x5d0839){SquareProjectEvents[_0xa3ec('0x7')](_0x41b0c4+':'+_0x5b9de2['id'],_0x5b9de2);SquareProjectEvents['emit'](_0x41b0c4,_0x5b9de2);_0x5d0839(null);};}for(var e in events){if(events[_0xa3ec('0x8')](e)){var event=events[e];SquareProject[_0xa3ec('0x9')](e,emitEvent(event));}}module[_0xa3ec('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 68673bc..768659d 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 _0xed7b=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','format'];(function(_0x10bd8a,_0x37942a){var _0x53473e=function(_0x3966a8){while(--_0x3966a8){_0x10bd8a['push'](_0x10bd8a['shift']());}};_0x53473e(++_0x37942a);}(_0xed7b,0x17f));var _0xbed7=function(_0xc62355,_0x2509ab){_0xc62355=_0xc62355-0x0;var _0x1baa4e=_0xed7b[_0xc62355];return _0x1baa4e;};'use strict';var _=require(_0xbed7('0x0'));var util=require(_0xbed7('0x1'));var logger=require(_0xbed7('0x2'))(_0xbed7('0x3'));var moment=require(_0xbed7('0x4'));var BPromise=require(_0xbed7('0x5'));var rp=require(_0xbed7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbed7('0x7'));var config=require(_0xbed7('0x8'));var attributes=require(_0xbed7('0x9'));module['exports']=function(_0x4add40,_0x39fe5c){return _0x4add40[_0xbed7('0xa')](_0xbed7('0xb'),attributes,{'tableName':_0xbed7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42bf11,_0x19e47e,_0x3acf6e){if(_0x42bf11[_0xbed7('0xd')](_0xbed7('0xe'))){_0x42bf11['savedAt']=moment()[_0xbed7('0xf')](_0xbed7('0x10'));}if(_0x42bf11['changed'](_0xbed7('0x11'))){_0x42bf11[_0xbed7('0x12')]=moment()['format'](_0xbed7('0x10'));}_0x3acf6e(null,_0x42bf11);}}});}; \ No newline at end of file +var _0x61df=['path','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','api','moment','request-promise'];(function(_0x137d56,_0x42c324){var _0xeb8b5=function(_0x3db051){while(--_0x3db051){_0x137d56['push'](_0x137d56['shift']());}};_0xeb8b5(++_0x42c324);}(_0x61df,0xbd));var _0xf61d=function(_0x45b1a6,_0x8b881d){_0x45b1a6=_0x45b1a6-0x0;var _0x5f530b=_0x61df[_0x45b1a6];return _0x5f530b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf61d('0x0'));var moment=require(_0xf61d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x2'));var fs=require('fs');var path=require(_0xf61d('0x3'));var rimraf=require('rimraf');var config=require(_0xf61d('0x4'));var attributes=require(_0xf61d('0x5'));module[_0xf61d('0x6')]=function(_0x458eb9,_0x2d0791){return _0x458eb9[_0xf61d('0x7')]('SquareProject',attributes,{'tableName':_0xf61d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49523e,_0x32ad93,_0x2a07c5){if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xa'))){_0x49523e[_0xf61d('0xb')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xe'))){_0x49523e[_0xf61d('0xf')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}_0x2a07c5(null,_0x49523e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b9e048a..35a2a13 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 _0x943c=['rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','attributes','limit','include','map','model','then','info','stringify','catch','message','ShowSquareProject','find','where','debug','error','lodash','ioredis','../../config/logger'];(function(_0x19e404,_0x2e6973){var _0x17728f=function(_0x54323f){while(--_0x54323f){_0x19e404['push'](_0x19e404['shift']());}};_0x17728f(++_0x2e6973);}(_0x943c,0x8e));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var Redis=require(_0xc943('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xc943('0x2'))(_0xc943('0x3'));var config=require(_0xc943('0x4'));config[_0xc943('0x5')]=_[_0xc943('0x6')](config['redis'],{'host':_0xc943('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc943('0x8'))[_0xc943('0x9')](socket);exports[_0xc943('0xa')]=function(_0x29348b){var _0x585ece=this;return new Promise(function(_0x10fabb,_0x425c66){return db[_0xc943('0xb')]['findAll']({'raw':_0x29348b[_0xc943('0xc')]?_0x29348b[_0xc943('0xc')][_0xc943('0xd')]===undefined?!![]:![]:!![],'where':_0x29348b['options']?_0x29348b[_0xc943('0xc')]['where']||null:null,'attributes':_0x29348b[_0xc943('0xc')]?_0x29348b[_0xc943('0xc')][_0xc943('0xe')]||null:null,'limit':_0x29348b[_0xc943('0xc')]?_0x29348b['options'][_0xc943('0xf')]||null:null,'include':_0x29348b[_0xc943('0xc')]?_0x29348b[_0xc943('0xc')][_0xc943('0x10')]?_[_0xc943('0x11')](_0x29348b['options'][_0xc943('0x10')],function(_0x5ad693){return{'model':db[_0x5ad693[_0xc943('0x12')]],'as':_0x5ad693['as'],'attributes':_0x5ad693[_0xc943('0xe')],'include':_0x5ad693['include']?_[_0xc943('0x11')](_0x5ad693[_0xc943('0x10')],function(_0x25fe4a){return{'model':db[_0x25fe4a[_0xc943('0x12')]],'as':_0x25fe4a['as'],'attributes':_0x25fe4a[_0xc943('0xe')],'include':_0x25fe4a['include']?_[_0xc943('0x11')](_0x25fe4a[_0xc943('0x10')],function(_0x5bbf9f){return{'model':db[_0x5bbf9f[_0xc943('0x12')]],'as':_0x5bbf9f['as'],'attributes':_0x5bbf9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc943('0x13')](function(_0xeedc89){logger[_0xc943('0x14')](_0xc943('0xa'),_0x29348b);logger['debug'](_0xc943('0xa'),_0x29348b,JSON[_0xc943('0x15')](_0xeedc89));_0x10fabb(_0xeedc89);})[_0xc943('0x16')](function(_0x45b63d){logger['error']('GetSquareProjects',_0x45b63d[_0xc943('0x17')],_0x29348b);_0x425c66(_0x585ece['error'](0x1f4,_0x45b63d[_0xc943('0x17')]));});});};exports[_0xc943('0x18')]=function(_0x14049b){var _0x207977=this;return new Promise(function(_0x571896,_0x3c3dc9){return db[_0xc943('0xb')][_0xc943('0x19')]({'raw':_0x14049b[_0xc943('0xc')]?_0x14049b[_0xc943('0xc')][_0xc943('0xd')]===undefined?!![]:![]:!![],'where':_0x14049b[_0xc943('0xc')]?_0x14049b[_0xc943('0xc')][_0xc943('0x1a')]||null:null,'attributes':_0x14049b[_0xc943('0xc')]?_0x14049b[_0xc943('0xc')][_0xc943('0xe')]||null:null,'include':_0x14049b['options']?_0x14049b[_0xc943('0xc')][_0xc943('0x10')]?_[_0xc943('0x11')](_0x14049b[_0xc943('0xc')][_0xc943('0x10')],function(_0x811da4){return{'model':db[_0x811da4[_0xc943('0x12')]],'as':_0x811da4['as'],'attributes':_0x811da4[_0xc943('0xe')],'include':_0x811da4[_0xc943('0x10')]?_[_0xc943('0x11')](_0x811da4[_0xc943('0x10')],function(_0x24df5a){return{'model':db[_0x24df5a[_0xc943('0x12')]],'as':_0x24df5a['as'],'attributes':_0x24df5a['attributes'],'include':_0x24df5a[_0xc943('0x10')]?_[_0xc943('0x11')](_0x24df5a[_0xc943('0x10')],function(_0x4d711d){return{'model':db[_0x4d711d[_0xc943('0x12')]],'as':_0x4d711d['as'],'attributes':_0x4d711d[_0xc943('0xe')]};}):[]};}):[]};}):[]:[]})[_0xc943('0x13')](function(_0x575807){logger['info'](_0xc943('0x18'),_0x14049b);logger[_0xc943('0x1b')]('ShowSquareProject',_0x14049b,JSON[_0xc943('0x15')](_0x575807));_0x571896(_0x575807);})[_0xc943('0x16')](function(_0x3fa597){logger[_0xc943('0x1c')](_0xc943('0x18'),_0x3fa597['message'],_0x14049b);_0x3c3dc9(_0x207977['error'](0x1f4,_0x3fa597[_0xc943('0x17')]));});});}; \ No newline at end of file +var _0x2c4c=['include','map','model','info','GetSquareProjects','debug','stringify','catch','message','error','ShowSquareProject','find','then','lodash','../../mysqldb','rpc','redis','defaults','localhost','./squareProject.socket','register','findAll','options','raw','where','attributes','limit'];(function(_0x549444,_0x41c180){var _0x2348d2=function(_0x12e035){while(--_0x12e035){_0x549444['push'](_0x549444['shift']());}};_0x2348d2(++_0x41c180);}(_0x2c4c,0x94));var _0xc2c4=function(_0x3862e6,_0x168099){_0x3862e6=_0x3862e6-0x0;var _0x50b550=_0x2c4c[_0x3862e6];return _0x50b550;};'use strict';var _=require(_0xc2c4('0x0'));var Redis=require('ioredis');var db=require(_0xc2c4('0x1'))['db'];var logger=require('../../config/logger')(_0xc2c4('0x2'));var config=require('../../config/environment');config[_0xc2c4('0x3')]=_[_0xc2c4('0x4')](config[_0xc2c4('0x3')],{'host':_0xc2c4('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc2c4('0x6'))[_0xc2c4('0x7')](socket);exports['GetSquareProjects']=function(_0x2b079c){var _0x1e182e=this;return new Promise(function(_0x58921f,_0x2eb631){return db['SquareProject'][_0xc2c4('0x8')]({'raw':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xa')]===undefined?!![]:![]:!![],'where':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xb')]||null:null,'attributes':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c['options'][_0xc2c4('0xc')]||null:null,'limit':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xd')]||null:null,'include':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c['options'][_0xc2c4('0xe')]?_[_0xc2c4('0xf')](_0x2b079c[_0xc2c4('0x9')]['include'],function(_0x13a698){return{'model':db[_0x13a698[_0xc2c4('0x10')]],'as':_0x13a698['as'],'attributes':_0x13a698[_0xc2c4('0xc')],'include':_0x13a698[_0xc2c4('0xe')]?_['map'](_0x13a698[_0xc2c4('0xe')],function(_0x16e84d){return{'model':db[_0x16e84d['model']],'as':_0x16e84d['as'],'attributes':_0x16e84d[_0xc2c4('0xc')],'include':_0x16e84d[_0xc2c4('0xe')]?_[_0xc2c4('0xf')](_0x16e84d['include'],function(_0x17b764){return{'model':db[_0x17b764['model']],'as':_0x17b764['as'],'attributes':_0x17b764[_0xc2c4('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x334f07){logger[_0xc2c4('0x11')](_0xc2c4('0x12'),_0x2b079c);logger[_0xc2c4('0x13')](_0xc2c4('0x12'),_0x2b079c,JSON[_0xc2c4('0x14')](_0x334f07));_0x58921f(_0x334f07);})[_0xc2c4('0x15')](function(_0x4fabc0){logger['error']('GetSquareProjects',_0x4fabc0[_0xc2c4('0x16')],_0x2b079c);_0x2eb631(_0x1e182e[_0xc2c4('0x17')](0x1f4,_0x4fabc0[_0xc2c4('0x16')]));});});};exports[_0xc2c4('0x18')]=function(_0x4f2b30){var _0x1983ae=this;return new Promise(function(_0x2ec520,_0x194a07){return db['SquareProject'][_0xc2c4('0x19')]({'raw':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xa')]===undefined?!![]:![]:!![],'where':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30[_0xc2c4('0x9')]['where']||null:null,'attributes':_0x4f2b30['options']?_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xc')]||null:null,'include':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30['options'][_0xc2c4('0xe')]?_['map'](_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xe')],function(_0x20ef88){return{'model':db[_0x20ef88[_0xc2c4('0x10')]],'as':_0x20ef88['as'],'attributes':_0x20ef88[_0xc2c4('0xc')],'include':_0x20ef88['include']?_[_0xc2c4('0xf')](_0x20ef88[_0xc2c4('0xe')],function(_0x9b0f53){return{'model':db[_0x9b0f53[_0xc2c4('0x10')]],'as':_0x9b0f53['as'],'attributes':_0x9b0f53[_0xc2c4('0xc')],'include':_0x9b0f53[_0xc2c4('0xe')]?_['map'](_0x9b0f53[_0xc2c4('0xe')],function(_0x29bbc3){return{'model':db[_0x29bbc3['model']],'as':_0x29bbc3['as'],'attributes':_0x29bbc3[_0xc2c4('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc2c4('0x1a')](function(_0x3ef715){logger['info']('ShowSquareProject',_0x4f2b30);logger[_0xc2c4('0x13')](_0xc2c4('0x18'),_0x4f2b30,JSON['stringify'](_0x3ef715));_0x2ec520(_0x3ef715);})[_0xc2c4('0x15')](function(_0x4734d2){logger[_0xc2c4('0x17')]('ShowSquareProject',_0x4734d2[_0xc2c4('0x16')],_0x4f2b30);_0x194a07(_0x1983ae[_0xc2c4('0x17')](0x1f4,_0x4734d2[_0xc2c4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 193c8d6..2164a32 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 _0x9775=['update','emit','removeListener','register','length','./squareProject.events','save','remove'];(function(_0x27d383,_0x1bb36c){var _0x263d36=function(_0x4cc0df){while(--_0x4cc0df){_0x27d383['push'](_0x27d383['shift']());}};_0x263d36(++_0x1bb36c);}(_0x9775,0x1e5));var _0x5977=function(_0x322133,_0x3c05e2){_0x322133=_0x322133-0x0;var _0x1c627e=_0x9775[_0x322133];return _0x1c627e;};'use strict';var SquareProjectEvents=require(_0x5977('0x0'));var events=[_0x5977('0x1'),_0x5977('0x2'),_0x5977('0x3')];function createListener(_0x54029c,_0x212032){return function(_0x1a84e6){_0x212032[_0x5977('0x4')](_0x54029c,_0x1a84e6);};}function removeListener(_0x19dd3e,_0x7c0764){return function(){SquareProjectEvents[_0x5977('0x5')](_0x19dd3e,_0x7c0764);};}exports[_0x5977('0x6')]=function(_0x2883cd){for(var _0x56641b=0x0,_0x25e375=events[_0x5977('0x7')];_0x56641b<_0x25e375;_0x56641b++){var _0x2c2ce1=events[_0x56641b];var _0x45f4ed=createListener('squareProject:'+_0x2c2ce1,_0x2883cd);SquareProjectEvents['on'](_0x2c2ce1,_0x45f4ed);}}; \ No newline at end of file +var _0x693a=['register','length','squareProject:','save','remove','update','emit','removeListener'];(function(_0x1b4892,_0x1d99c){var _0x254642=function(_0x51d2f9){while(--_0x51d2f9){_0x1b4892['push'](_0x1b4892['shift']());}};_0x254642(++_0x1d99c);}(_0x693a,0xbb));var _0xa693=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x693a[_0x5f6a8a];return _0x2cce4d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xa693('0x0'),_0xa693('0x1'),_0xa693('0x2')];function createListener(_0x5ba0dc,_0x45b1c0){return function(_0x5323fb){_0x45b1c0[_0xa693('0x3')](_0x5ba0dc,_0x5323fb);};}function removeListener(_0x34a2a9,_0x4bfc9e){return function(){SquareProjectEvents[_0xa693('0x4')](_0x34a2a9,_0x4bfc9e);};}exports[_0xa693('0x5')]=function(_0x213bbf){for(var _0x4f5aae=0x0,_0x3fab35=events[_0xa693('0x6')];_0x4f5aae<_0x3fab35;_0x4f5aae++){var _0x552b01=events[_0x4f5aae];var _0xb9a9f1=createListener(_0xa693('0x7')+_0x552b01,_0x213bbf);SquareProjectEvents['on'](_0x552b01,_0xb9a9f1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e5cea8d..0913350 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0295,0x1f0));var _0x5029=function(_0x2e5bb6,_0x4a569b){_0x2e5bb6=_0x2e5bb6-0x0;var _0xdae9ed=_0x0295[_0x2e5bb6];return _0xdae9ed;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x12c66d,_0x9fd894){var _0x48c456=function(_0x528b5d){while(--_0x528b5d){_0x12c66d['push'](_0x12c66d['shift']());}};_0x48c456(++_0x9fd894);}(_0xabce,0x103));var _0xeabc=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xabce[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6422676..597d188 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 _0x2d17=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0x196034,_0x3a2926){_0x196034=_0x196034-0x0;var _0x3ae58f=_0x2d17[_0x196034];return _0x3ae58f;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x72d1('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x72d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x72d1('0x2')]},'format':{'type':Sequelize[_0x72d1('0x3')],'get':function(){var _0x5b40a9='';var _0x477264=this[_0x72d1('0x4')](_0x72d1('0x5'));if(_0x477264){_0x5b40a9=_0x477264['substring'](_0x477264[_0x72d1('0x6')]('.'));}return _0x5b40a9;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xf494,0x1c6));var _0x4f49=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0xf494[_0x37bab4];return _0x336d20;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b280232..889e05d 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 _0xca89=['length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','extname','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','SquareRecording','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x5212de,_0x5ff15e){var _0x4defee=function(_0x2e8a6b){while(--_0x2e8a6b){_0x5212de['push'](_0x5212de['shift']());}};_0x4defee(++_0x5ff15e);}(_0xca89,0x146));var _0x9ca8=function(_0x5958d0,_0xaf1fa4){_0x5958d0=_0x5958d0-0x0;var _0x4af73d=_0xca89[_0x5958d0];return _0x4af73d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ca8('0x0'));var rp=require('request-promise');var moment=require(_0x9ca8('0x1'));var BPromise=require(_0x9ca8('0x2'));var Mustache=require('mustache');var util=require(_0x9ca8('0x3'));var path=require(_0x9ca8('0x4'));var sox=require(_0x9ca8('0x5'));var csv=require(_0x9ca8('0x6'));var ejs=require(_0x9ca8('0x7'));var fs=require('fs');var fs_extra=require(_0x9ca8('0x8'));var _=require('lodash');var squel=require(_0x9ca8('0x9'));var crypto=require(_0x9ca8('0xa'));var jsforce=require(_0x9ca8('0xb'));var deskjs=require(_0x9ca8('0xc'));var toCsv=require(_0x9ca8('0x6'));var querystring=require('querystring');var Papa=require(_0x9ca8('0xd'));var Redis=require(_0x9ca8('0xe'));var authService=require(_0x9ca8('0xf'));var qs=require(_0x9ca8('0x10'));var as=require(_0x9ca8('0x11'));var hardwareService=require(_0x9ca8('0x12'));var logger=require(_0x9ca8('0x13'))(_0x9ca8('0x14'));var utils=require(_0x9ca8('0x15'));var config=require(_0x9ca8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363c49,_0x609cd1){_0x609cd1=_0x609cd1||0xcc;return function(_0x58b78a){if(_0x58b78a){return _0x363c49[_0x9ca8('0x17')](_0x609cd1);}return _0x363c49[_0x9ca8('0x18')](_0x609cd1)[_0x9ca8('0x19')]();};}function respondWithResult(_0x46d631,_0x588f24){_0x588f24=_0x588f24||0xc8;return function(_0x5aaa0a){if(_0x5aaa0a){return _0x46d631['status'](_0x588f24)['json'](_0x5aaa0a);}};}function respondWithFilteredResult(_0x2ab7a7,_0x574009){return function(_0x1f0375){if(_0x1f0375){var _0x53a76c=typeof _0x574009[_0x9ca8('0x1a')]===_0x9ca8('0x1b')&&typeof _0x574009[_0x9ca8('0x1c')]==='undefined';var _0x393c3b=_0x1f0375[_0x9ca8('0x1d')];var _0x36f56c=_0x53a76c?0x0:_0x574009[_0x9ca8('0x1a')];var _0x2bd8f5=_0x53a76c?_0x1f0375['count']:_0x574009[_0x9ca8('0x1a')]+_0x574009[_0x9ca8('0x1c')];var _0x1cc09c;if(_0x2bd8f5>=_0x393c3b){_0x2bd8f5=_0x393c3b;_0x1cc09c=0xc8;}else{_0x1cc09c=0xce;}_0x2ab7a7[_0x9ca8('0x18')](_0x1cc09c);return _0x2ab7a7[_0x9ca8('0x1e')](_0x9ca8('0x1f'),_0x36f56c+'-'+_0x2bd8f5+'/'+_0x393c3b)[_0x9ca8('0x20')](_0x1f0375);}return null;};}function patchUpdates(_0x57f661){return function(_0x403880){try{jsonpatch[_0x9ca8('0x21')](_0x403880,_0x57f661,!![]);}catch(_0xf211f8){return BPromise['reject'](_0xf211f8);}return _0x403880[_0x9ca8('0x22')]();};}function saveUpdates(_0x490463,_0x324f22){return function(_0x540d96){if(_0x540d96){return _0x540d96[_0x9ca8('0x23')](_0x490463)[_0x9ca8('0x24')](function(_0x524c1f){return _0x524c1f;});}return null;};}function removeEntity(_0xccc325,_0x3f71f8){return function(_0x1c0b02){if(_0x1c0b02){return _0x1c0b02[_0x9ca8('0x25')]()[_0x9ca8('0x24')](function(){_0xccc325['status'](0xcc)[_0x9ca8('0x19')]();});}};}function handleEntityNotFound(_0x32612c,_0x3de8e1){return function(_0xb988a2){if(!_0xb988a2){_0x32612c[_0x9ca8('0x17')](0x194);}return _0xb988a2;};}function handleError(_0x3abd30,_0x659d32){_0x659d32=_0x659d32||0x1f4;return function(_0xa92207){logger[_0x9ca8('0x26')](_0xa92207[_0x9ca8('0x27')]);if(_0xa92207[_0x9ca8('0x28')]){delete _0xa92207[_0x9ca8('0x28')];}_0x3abd30[_0x9ca8('0x18')](_0x659d32)['send'](_0xa92207);};}exports[_0x9ca8('0x29')]=function(_0x5b93c6,_0x28c5ef){var _0x9b65aa={},_0x23f4e5={},_0xa955bf={'count':0x0,'rows':[]};var _0x21c82e=_['map'](db[_0x9ca8('0x2a')]['rawAttributes'],function(_0x39c051){return{'name':_0x39c051[_0x9ca8('0x2b')],'type':_0x39c051[_0x9ca8('0x2c')][_0x9ca8('0x2d')]};});_0x23f4e5[_0x9ca8('0x2e')]=_[_0x9ca8('0x2f')](_0x21c82e,_0x9ca8('0x28'));_0x23f4e5['query']=_[_0x9ca8('0x30')](_0x5b93c6[_0x9ca8('0x31')]);_0x23f4e5[_0x9ca8('0x32')]=_[_0x9ca8('0x33')](_0x23f4e5[_0x9ca8('0x2e')],_0x23f4e5[_0x9ca8('0x31')]);_0x9b65aa[_0x9ca8('0x34')]=_[_0x9ca8('0x33')](_0x23f4e5['model'],qs['fields'](_0x5b93c6[_0x9ca8('0x31')][_0x9ca8('0x35')]));_0x9b65aa[_0x9ca8('0x34')]=_0x9b65aa[_0x9ca8('0x34')][_0x9ca8('0x36')]?_0x9b65aa['attributes']:_0x23f4e5[_0x9ca8('0x2e')];if(!_0x5b93c6[_0x9ca8('0x31')]['hasOwnProperty'](_0x9ca8('0x37'))){_0x9b65aa['limit']=qs[_0x9ca8('0x1c')](_0x5b93c6['query'][_0x9ca8('0x1c')]);_0x9b65aa[_0x9ca8('0x1a')]=qs[_0x9ca8('0x1a')](_0x5b93c6[_0x9ca8('0x31')]['offset']);}_0x9b65aa['order']=qs[_0x9ca8('0x38')](_0x5b93c6['query'][_0x9ca8('0x38')]);_0x9b65aa[_0x9ca8('0x39')]=qs[_0x9ca8('0x32')](_['pick'](_0x5b93c6[_0x9ca8('0x31')],_0x23f4e5['filters']),_0x21c82e);if(_0x5b93c6[_0x9ca8('0x31')][_0x9ca8('0x3a')]){_0x9b65aa[_0x9ca8('0x39')]=_[_0x9ca8('0x3b')](_0x9b65aa[_0x9ca8('0x39')],{'$or':_['map'](_0x21c82e,function(_0x4dcd90){if(_0x4dcd90[_0x9ca8('0x2c')]!==_0x9ca8('0x3c')){var _0x315bb9={};_0x315bb9[_0x4dcd90['name']]={'$like':'%'+_0x5b93c6['query'][_0x9ca8('0x3a')]+'%'};return _0x315bb9;}})});}_0x9b65aa=_[_0x9ca8('0x3b')]({},_0x9b65aa,_0x5b93c6[_0x9ca8('0x3d')]);var _0x3ff963={'where':_0x9b65aa['where']};return db[_0x9ca8('0x2a')][_0x9ca8('0x1d')](_0x3ff963)[_0x9ca8('0x24')](function(_0x4aaf4f){_0xa955bf[_0x9ca8('0x1d')]=_0x4aaf4f;if(_0x5b93c6[_0x9ca8('0x31')][_0x9ca8('0x3e')]){_0x9b65aa[_0x9ca8('0x3f')]=[{'all':!![]}];}return db[_0x9ca8('0x2a')][_0x9ca8('0x40')](_0x9b65aa);})[_0x9ca8('0x24')](function(_0x19fac6){_0xa955bf[_0x9ca8('0x41')]=_0x19fac6;return _0xa955bf;})[_0x9ca8('0x24')](respondWithFilteredResult(_0x28c5ef,_0x9b65aa))[_0x9ca8('0x42')](handleError(_0x28c5ef,null));};exports['show']=function(_0x572838,_0xb6d1a7){var _0x35a721={'raw':!![],'where':{'id':_0x572838[_0x9ca8('0x43')]['id']}},_0x4fa4de={};_0x4fa4de[_0x9ca8('0x2e')]=_[_0x9ca8('0x30')](db['SquareRecording']['rawAttributes']);_0x4fa4de['query']=_[_0x9ca8('0x30')](_0x572838[_0x9ca8('0x31')]);_0x4fa4de['filters']=_[_0x9ca8('0x33')](_0x4fa4de['model'],_0x4fa4de['query']);_0x35a721[_0x9ca8('0x34')]=_[_0x9ca8('0x33')](_0x4fa4de[_0x9ca8('0x2e')],qs[_0x9ca8('0x35')](_0x572838[_0x9ca8('0x31')][_0x9ca8('0x35')]));_0x35a721[_0x9ca8('0x34')]=_0x35a721[_0x9ca8('0x34')][_0x9ca8('0x36')]?_0x35a721[_0x9ca8('0x34')]:_0x4fa4de['model'];if(_0x572838['query'][_0x9ca8('0x3e')]){_0x35a721[_0x9ca8('0x3f')]=[{'all':!![]}];}_0x35a721=_['merge']({},_0x35a721,_0x572838[_0x9ca8('0x3d')]);return db[_0x9ca8('0x2a')][_0x9ca8('0x44')](_0x35a721)[_0x9ca8('0x24')](handleEntityNotFound(_0xb6d1a7,null))[_0x9ca8('0x24')](respondWithResult(_0xb6d1a7,null))[_0x9ca8('0x42')](handleError(_0xb6d1a7,null));};exports[_0x9ca8('0x45')]=function(_0x45d545,_0x110b75){return db['SquareRecording'][_0x9ca8('0x45')](_0x45d545[_0x9ca8('0x46')],{})[_0x9ca8('0x24')](respondWithResult(_0x110b75,0xc9))['catch'](handleError(_0x110b75,null));};exports[_0x9ca8('0x23')]=function(_0x1f2da5,_0x263140){if(_0x1f2da5[_0x9ca8('0x46')]['id']){delete _0x1f2da5[_0x9ca8('0x46')]['id'];}return db[_0x9ca8('0x2a')][_0x9ca8('0x44')]({'where':{'id':_0x1f2da5['params']['id']}})['then'](handleEntityNotFound(_0x263140,null))['then'](saveUpdates(_0x1f2da5[_0x9ca8('0x46')],null))[_0x9ca8('0x24')](respondWithResult(_0x263140,null))['catch'](handleError(_0x263140,null));};exports['download']=function(_0x232c93,_0x23b020,_0xe3b70f){var _0x3f5e71=require(_0x9ca8('0x47'));var _0x48ac8e=![];var _0x139afd={};if(_0x232c93[_0x9ca8('0x31')][_0x9ca8('0x2c')]&&_0x232c93[_0x9ca8('0x31')][_0x9ca8('0x2c')]===_0x9ca8('0x48')){_0x139afd[_0x9ca8('0x48')]=_0x232c93['params']['id'];}else{_0x139afd['id']=_0x232c93['params']['id'];}return db[_0x9ca8('0x2a')][_0x9ca8('0x44')]({'where':_0x139afd,'attributes':['id',_0x9ca8('0x49'),_0x9ca8('0x4a')],'raw':!![]})[_0x9ca8('0x24')](handleEntityNotFound(_0x23b020,null))[_0x9ca8('0x24')](function(_0x76b6a3){if(_0x76b6a3){var _0x4c46ba=_0x76b6a3['savePath'];var _0x1cf475=util[_0x9ca8('0x4b')](_0x9ca8('0x4c'),_0x4c46ba);if(fs[_0x9ca8('0x4d')](_0x1cf475)){_0x48ac8e=!![];return _0x3f5e71[_0x9ca8('0x4e')](_0x1cf475,_0x4c46ba,config[_0x9ca8('0x4f')][_0x9ca8('0x50')])[_0x9ca8('0x24')](function(){return _0x76b6a3;});}return _0x76b6a3;}})[_0x9ca8('0x24')](function(_0x59be60){if(_0x59be60){var _0x1170eb=_0x59be60[_0x9ca8('0x49')];if(!fs[_0x9ca8('0x4d')](_0x1170eb)){throw new db[(_0x9ca8('0x51'))]['ValidationError'](_0x9ca8('0x52'));}if(_0x59be60[_0x9ca8('0x4a')]){return _0x23b020[_0x9ca8('0x53')](_0x1170eb,_0x59be60[_0x9ca8('0x4a')]+path[_0x9ca8('0x54')](_0x1170eb),function(){if(_0x48ac8e){fs['unlink'](_0x1170eb);}});}else{return _0x23b020['download'](_0x1170eb,function(_0x26d865){if(_0x48ac8e){fs['unlink'](_0x1170eb);}});}}})[_0x9ca8('0x42')](function(_0x3c0d77){if(_0x3c0d77[_0x9ca8('0x55')]===_0x9ca8('0x52')){_0x23b020[_0x9ca8('0x18')](0x194)[_0x9ca8('0x56')](_0x9ca8('0x57'));}else{return handleError(_0x23b020,null);}});};exports['destroy']=function(_0x50cff0,_0x12f678){return db['SquareRecording']['find']({'where':{'id':_0x50cff0[_0x9ca8('0x43')]['id']}})[_0x9ca8('0x24')](function(_0x414c5c){if(_[_0x9ca8('0x58')](_0x414c5c)){throw new ReferenceError(_0x9ca8('0x59'));}return _0x414c5c;})[_0x9ca8('0x24')](function(_0x180885){var _0x261d31=_0x180885[_0x9ca8('0x49')];logger[_0x9ca8('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x261d31);if(!_['isNil'](_0x180885[_0x9ca8('0x49')])&&fs[_0x9ca8('0x4d')](_0x261d31)){logger[_0x9ca8('0x5a')]('File:\x20\x22'+_0x261d31+_0x9ca8('0x5b'));fs[_0x9ca8('0x5c')](_0x261d31);}_0x261d31=_0x261d31+_0x9ca8('0x5d');if(!_['isNil'](_0x180885[_0x9ca8('0x49')])&&fs['existsSync'](_0x261d31)){logger[_0x9ca8('0x5a')](_0x9ca8('0x5e')+_0x261d31+_0x9ca8('0x5b'));fs[_0x9ca8('0x5c')](_0x261d31);}return _0x180885;})[_0x9ca8('0x24')](function(_0x4a16ac){if(!_0x4a16ac)throw new InternalError();return _0x4a16ac[_0x9ca8('0x25')]();})['then'](function(){_0x12f678[_0x9ca8('0x18')](0xcc)[_0x9ca8('0x19')]();})[_0x9ca8('0x42')](handleError(_0x12f678,null));}; \ No newline at end of file +var _0xb7eb=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x13f1b8,_0x59f46e){var _0x1c5635=function(_0x4f09e2){while(--_0x4f09e2){_0x13f1b8['push'](_0x13f1b8['shift']());}};_0x1c5635(++_0x59f46e);}(_0xb7eb,0x130));var _0xbb7e=function(_0x5a1f24,_0x15df0d){_0x5a1f24=_0x5a1f24-0x0;var _0x47e330=_0xb7eb[_0x5a1f24];return _0x47e330;};'use strict';var emlformat=require(_0xbb7e('0x0'));var rimraf=require(_0xbb7e('0x1'));var zipdir=require(_0xbb7e('0x2'));var jsonpatch=require(_0xbb7e('0x3'));var rp=require(_0xbb7e('0x4'));var moment=require(_0xbb7e('0x5'));var BPromise=require(_0xbb7e('0x6'));var Mustache=require(_0xbb7e('0x7'));var util=require(_0xbb7e('0x8'));var path=require(_0xbb7e('0x9'));var sox=require(_0xbb7e('0xa'));var csv=require(_0xbb7e('0xb'));var ejs=require(_0xbb7e('0xc'));var fs=require('fs');var fs_extra=require(_0xbb7e('0xd'));var _=require(_0xbb7e('0xe'));var squel=require(_0xbb7e('0xf'));var crypto=require(_0xbb7e('0x10'));var jsforce=require(_0xbb7e('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb7e('0x12'));var Redis=require(_0xbb7e('0x13'));var authService=require(_0xbb7e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbb7e('0x15'));var hardwareService=require(_0xbb7e('0x16'));var logger=require('../../config/logger')(_0xbb7e('0x17'));var utils=require(_0xbb7e('0x18'));var config=require(_0xbb7e('0x19'));var licenseUtil=require(_0xbb7e('0x1a'));var db=require(_0xbb7e('0x1b'))['db'];function respondWithStatusCode(_0x98b2a5,_0x3ec80e){_0x3ec80e=_0x3ec80e||0xcc;return function(_0xf811e6){if(_0xf811e6){return _0x98b2a5['sendStatus'](_0x3ec80e);}return _0x98b2a5[_0xbb7e('0x1c')](_0x3ec80e)[_0xbb7e('0x1d')]();};}function respondWithResult(_0x26ee1d,_0x2c2566){_0x2c2566=_0x2c2566||0xc8;return function(_0x3f7d4f){if(_0x3f7d4f){return _0x26ee1d['status'](_0x2c2566)['json'](_0x3f7d4f);}};}function respondWithFilteredResult(_0x1f90bc,_0x27ca0c){return function(_0x4ab5d4){if(_0x4ab5d4){var _0x43d9b4=typeof _0x27ca0c[_0xbb7e('0x1e')]==='undefined'&&typeof _0x27ca0c[_0xbb7e('0x1f')]===_0xbb7e('0x20');var _0x13ce20=_0x4ab5d4[_0xbb7e('0x21')];var _0xc03582=_0x43d9b4?0x0:_0x27ca0c[_0xbb7e('0x1e')];var _0x27d421=_0x43d9b4?_0x4ab5d4[_0xbb7e('0x21')]:_0x27ca0c[_0xbb7e('0x1e')]+_0x27ca0c[_0xbb7e('0x1f')];var _0xe164f9;if(_0x27d421>=_0x13ce20){_0x27d421=_0x13ce20;_0xe164f9=0xc8;}else{_0xe164f9=0xce;}_0x1f90bc['status'](_0xe164f9);return _0x1f90bc[_0xbb7e('0x22')](_0xbb7e('0x23'),_0xc03582+'-'+_0x27d421+'/'+_0x13ce20)[_0xbb7e('0x24')](_0x4ab5d4);}return null;};}function patchUpdates(_0x2e9fc5){return function(_0x4cf19e){try{jsonpatch['apply'](_0x4cf19e,_0x2e9fc5,!![]);}catch(_0xd471f6){return BPromise['reject'](_0xd471f6);}return _0x4cf19e['save']();};}function saveUpdates(_0x2f1ce1,_0x30b81f){return function(_0x18c8bc){if(_0x18c8bc){return _0x18c8bc[_0xbb7e('0x25')](_0x2f1ce1)['then'](function(_0x565b7f){return _0x565b7f;});}return null;};}function removeEntity(_0xad5c47,_0x2dc634){return function(_0x4960cf){if(_0x4960cf){return _0x4960cf['destroy']()[_0xbb7e('0x26')](function(){_0xad5c47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5747bc,_0x351ed2){return function(_0x48d1a8){if(!_0x48d1a8){_0x5747bc[_0xbb7e('0x27')](0x194);}return _0x48d1a8;};}function handleError(_0x49b9d2,_0xf36f29){_0xf36f29=_0xf36f29||0x1f4;return function(_0x3f36eb){logger[_0xbb7e('0x28')](_0x3f36eb[_0xbb7e('0x29')]);if(_0x3f36eb[_0xbb7e('0x2a')]){delete _0x3f36eb[_0xbb7e('0x2a')];}_0x49b9d2[_0xbb7e('0x1c')](_0xf36f29)[_0xbb7e('0x2b')](_0x3f36eb);};}exports[_0xbb7e('0x2c')]=function(_0x6cdea5,_0x57a8c6){var _0x412ee2={},_0x159a0f={},_0x17655d={'count':0x0,'rows':[]};var _0x30343=_[_0xbb7e('0x2d')](db[_0xbb7e('0x2e')]['rawAttributes'],function(_0xff9c79){return{'name':_0xff9c79[_0xbb7e('0x2f')],'type':_0xff9c79['type'][_0xbb7e('0x30')]};});_0x159a0f[_0xbb7e('0x31')]=_['map'](_0x30343,'name');_0x159a0f['query']=_[_0xbb7e('0x32')](_0x6cdea5[_0xbb7e('0x33')]);_0x159a0f[_0xbb7e('0x34')]=_[_0xbb7e('0x35')](_0x159a0f[_0xbb7e('0x31')],_0x159a0f[_0xbb7e('0x33')]);_0x412ee2[_0xbb7e('0x36')]=_[_0xbb7e('0x35')](_0x159a0f[_0xbb7e('0x31')],qs[_0xbb7e('0x37')](_0x6cdea5[_0xbb7e('0x33')]['fields']));_0x412ee2['attributes']=_0x412ee2[_0xbb7e('0x36')][_0xbb7e('0x38')]?_0x412ee2['attributes']:_0x159a0f[_0xbb7e('0x31')];if(!_0x6cdea5['query'][_0xbb7e('0x39')]('nolimit')){_0x412ee2[_0xbb7e('0x1f')]=qs[_0xbb7e('0x1f')](_0x6cdea5['query'][_0xbb7e('0x1f')]);_0x412ee2[_0xbb7e('0x1e')]=qs[_0xbb7e('0x1e')](_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x1e')]);}_0x412ee2['order']=qs[_0xbb7e('0x3a')](_0x6cdea5['query'][_0xbb7e('0x3a')]);_0x412ee2[_0xbb7e('0x3b')]=qs[_0xbb7e('0x34')](_['pick'](_0x6cdea5['query'],_0x159a0f[_0xbb7e('0x34')]),_0x30343);if(_0x6cdea5['query'][_0xbb7e('0x3c')]){_0x412ee2[_0xbb7e('0x3b')]=_[_0xbb7e('0x3d')](_0x412ee2[_0xbb7e('0x3b')],{'$or':_[_0xbb7e('0x2d')](_0x30343,function(_0xedfe63){if(_0xedfe63[_0xbb7e('0x3e')]!==_0xbb7e('0x3f')){var _0x216ede={};_0x216ede[_0xedfe63[_0xbb7e('0x2a')]]={'$like':'%'+_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x3c')]+'%'};return _0x216ede;}})});}_0x412ee2=_['merge']({},_0x412ee2,_0x6cdea5[_0xbb7e('0x40')]);var _0x35dcaf={'where':_0x412ee2[_0xbb7e('0x3b')]};return db[_0xbb7e('0x2e')][_0xbb7e('0x21')](_0x35dcaf)[_0xbb7e('0x26')](function(_0x245761){_0x17655d[_0xbb7e('0x21')]=_0x245761;if(_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x41')]){_0x412ee2[_0xbb7e('0x42')]=[{'all':!![]}];}return db[_0xbb7e('0x2e')][_0xbb7e('0x43')](_0x412ee2);})[_0xbb7e('0x26')](function(_0x33534a){_0x17655d[_0xbb7e('0x44')]=_0x33534a;return _0x17655d;})[_0xbb7e('0x26')](respondWithFilteredResult(_0x57a8c6,_0x412ee2))[_0xbb7e('0x45')](handleError(_0x57a8c6,null));};exports[_0xbb7e('0x46')]=function(_0x2c9815,_0x47f505){var _0x25c9c4={'raw':!![],'where':{'id':_0x2c9815['params']['id']}},_0x2f546f={};_0x2f546f['model']=_[_0xbb7e('0x32')](db['SquareRecording'][_0xbb7e('0x47')]);_0x2f546f[_0xbb7e('0x33')]=_[_0xbb7e('0x32')](_0x2c9815['query']);_0x2f546f['filters']=_[_0xbb7e('0x35')](_0x2f546f[_0xbb7e('0x31')],_0x2f546f[_0xbb7e('0x33')]);_0x25c9c4['attributes']=_['intersection'](_0x2f546f[_0xbb7e('0x31')],qs[_0xbb7e('0x37')](_0x2c9815[_0xbb7e('0x33')][_0xbb7e('0x37')]));_0x25c9c4[_0xbb7e('0x36')]=_0x25c9c4[_0xbb7e('0x36')][_0xbb7e('0x38')]?_0x25c9c4['attributes']:_0x2f546f[_0xbb7e('0x31')];if(_0x2c9815['query'][_0xbb7e('0x41')]){_0x25c9c4[_0xbb7e('0x42')]=[{'all':!![]}];}_0x25c9c4=_['merge']({},_0x25c9c4,_0x2c9815['options']);return db[_0xbb7e('0x2e')]['find'](_0x25c9c4)[_0xbb7e('0x26')](handleEntityNotFound(_0x47f505,null))['then'](respondWithResult(_0x47f505,null))['catch'](handleError(_0x47f505,null));};exports[_0xbb7e('0x48')]=function(_0x1d537d,_0x384442){return db[_0xbb7e('0x2e')][_0xbb7e('0x48')](_0x1d537d['body'],{})[_0xbb7e('0x26')](respondWithResult(_0x384442,0xc9))['catch'](handleError(_0x384442,null));};exports[_0xbb7e('0x25')]=function(_0xf9cf90,_0x142faa){if(_0xf9cf90[_0xbb7e('0x49')]['id']){delete _0xf9cf90[_0xbb7e('0x49')]['id'];}return db[_0xbb7e('0x2e')][_0xbb7e('0x4a')]({'where':{'id':_0xf9cf90[_0xbb7e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x142faa,null))[_0xbb7e('0x26')](saveUpdates(_0xf9cf90[_0xbb7e('0x49')],null))[_0xbb7e('0x26')](respondWithResult(_0x142faa,null))['catch'](handleError(_0x142faa,null));};exports[_0xbb7e('0x4c')]=function(_0x4a8ebd,_0x2a5bee,_0x572d04){var _0x1afafb=require(_0xbb7e('0x4d'));var _0x4160fa=![];var _0x1024b8={};if(_0x4a8ebd[_0xbb7e('0x33')][_0xbb7e('0x3e')]&&_0x4a8ebd[_0xbb7e('0x33')]['type']==='uniqueid'){_0x1024b8[_0xbb7e('0x4e')]=_0x4a8ebd[_0xbb7e('0x4b')]['id'];}else{_0x1024b8['id']=_0x4a8ebd[_0xbb7e('0x4b')]['id'];}return db[_0xbb7e('0x2e')]['find']({'where':_0x1024b8,'attributes':['id',_0xbb7e('0x4f'),_0xbb7e('0x50')],'raw':!![]})[_0xbb7e('0x26')](handleEntityNotFound(_0x2a5bee,null))[_0xbb7e('0x26')](function(_0x1c1143){if(_0x1c1143){var _0xe3d667=_0x1c1143[_0xbb7e('0x4f')];var _0x196e4f=util['format']('%s.cypher',_0xe3d667);if(fs['existsSync'](_0x196e4f)){_0x4160fa=!![];return _0x1afafb[_0xbb7e('0x51')](_0x196e4f,_0xe3d667,config[_0xbb7e('0x52')][_0xbb7e('0x53')])[_0xbb7e('0x26')](function(){return _0x1c1143;});}return _0x1c1143;}})[_0xbb7e('0x26')](function(_0x192c3a){if(_0x192c3a){var _0x2ba569=_0x192c3a[_0xbb7e('0x4f')];if(!fs[_0xbb7e('0x54')](_0x2ba569)){throw new db[(_0xbb7e('0x55'))][(_0xbb7e('0x56'))](_0xbb7e('0x57'));}if(_0x192c3a[_0xbb7e('0x50')]){return _0x2a5bee['download'](_0x2ba569,_0x192c3a[_0xbb7e('0x50')]+path[_0xbb7e('0x58')](_0x2ba569),function(){if(_0x4160fa){fs[_0xbb7e('0x59')](_0x2ba569);}});}else{return _0x2a5bee[_0xbb7e('0x4c')](_0x2ba569,function(_0x26223d){if(_0x4160fa){fs[_0xbb7e('0x59')](_0x2ba569);}});}}})[_0xbb7e('0x45')](function(_0x42ebd2){if(_0x42ebd2['message']===_0xbb7e('0x57')){_0x2a5bee[_0xbb7e('0x1c')](0x194)['send'](_0xbb7e('0x5a'));}else{return handleError(_0x2a5bee,null);}});};exports[_0xbb7e('0x5b')]=function(_0x5834a0,_0x93ace8){return db['SquareRecording']['find']({'where':{'id':_0x5834a0[_0xbb7e('0x4b')]['id']}})[_0xbb7e('0x26')](function(_0x7a9f90){if(_[_0xbb7e('0x5c')](_0x7a9f90)){throw new ReferenceError(_0xbb7e('0x5d'));}return _0x7a9f90;})[_0xbb7e('0x26')](function(_0x27b7e1){var _0x3f8aed=_0x27b7e1[_0xbb7e('0x4f')];logger[_0xbb7e('0x5e')](_0xbb7e('0x5f'),_0x3f8aed);if(!_[_0xbb7e('0x5c')](_0x27b7e1[_0xbb7e('0x4f')])&&fs[_0xbb7e('0x54')](_0x3f8aed)){logger[_0xbb7e('0x5e')]('File:\x20\x22'+_0x3f8aed+_0xbb7e('0x60'));fs[_0xbb7e('0x61')](_0x3f8aed);}_0x3f8aed=_0x3f8aed+_0xbb7e('0x62');if(!_['isNil'](_0x27b7e1[_0xbb7e('0x4f')])&&fs['existsSync'](_0x3f8aed)){logger[_0xbb7e('0x5e')](_0xbb7e('0x63')+_0x3f8aed+_0xbb7e('0x60'));fs[_0xbb7e('0x61')](_0x3f8aed);}return _0x27b7e1;})[_0xbb7e('0x26')](function(_0x1d221e){if(!_0x1d221e)throw new InternalError();return _0x1d221e[_0xbb7e('0x5b')]();})[_0xbb7e('0x26')](function(){_0x93ace8['status'](0xcc)[_0xbb7e('0x1d')]();})[_0xbb7e('0x45')](handleError(_0x93ace8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 34d9d02..d0d2db2 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 _0x77a9=['../../config/environment','./squareRecording.attributes','exports','square_recordings','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa79fbc,_0x309f44){var _0x29f1a7=function(_0x116935){while(--_0x116935){_0xa79fbc['push'](_0xa79fbc['shift']());}};_0x29f1a7(++_0x309f44);}(_0x77a9,0x19e));var _0x977a=function(_0x5a5dfb,_0x548412){_0x5a5dfb=_0x5a5dfb-0x0;var _0x38cf4d=_0x77a9[_0x5a5dfb];return _0x38cf4d;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('SquareRecording',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ac=['api','moment','request-promise','rimraf','exports','define','square_recordings','lodash'];(function(_0x13c4ca,_0x648be2){var _0x13b078=function(_0x30b03e){while(--_0x30b03e){_0x13c4ca['push'](_0x13c4ca['shift']());}};_0x13b078(++_0x648be2);}(_0xf9ac,0x87));var _0xcf9a=function(_0x575934,_0x4a6760){_0x575934=_0x575934-0x0;var _0x109a3d=_0xf9ac[_0x575934];return _0x109a3d;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf9a('0x1'));var moment=require(_0xcf9a('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf9a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf9a('0x4'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xcf9a('0x5')]=function(_0x3d77c8,_0x158971){return _0x3d77c8[_0xcf9a('0x6')]('SquareRecording',attributes,{'tableName':_0xcf9a('0x7'),'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 98f10b0..b6863ed 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 _0x4f6d=['message','catch','CreateSquareRecording','SquareRecording','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x48f46f,_0x10296a){var _0x2f99b9=function(_0x45eace){while(--_0x45eace){_0x48f46f['push'](_0x48f46f['shift']());}};_0x2f99b9(++_0x10296a);}(_0x4f6d,0x13e));var _0xd4f6=function(_0x54214a,_0x16b6dd){_0x54214a=_0x54214a-0x0;var _0x1fea42=_0x4f6d[_0x54214a];return _0x1fea42;};'use strict';var _=require('lodash');var util=require(_0xd4f6('0x0'));var moment=require(_0xd4f6('0x1'));var BPromise=require(_0xd4f6('0x2'));var rs=require(_0xd4f6('0x3'));var fs=require('fs');var Redis=require(_0xd4f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f6('0x5'));var logger=require(_0xd4f6('0x6'))('rpc');var config=require(_0xd4f6('0x7'));var jayson=require(_0xd4f6('0x8'));var client=jayson['client'][_0xd4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fcc9f,_0x2fa481,_0x4b7197){return new BPromise(function(_0x287bfe,_0x3fe7a6){return client[_0xd4f6('0xa')](_0x3fcc9f,_0x4b7197)[_0xd4f6('0xb')](function(_0x52a363){logger[_0xd4f6('0xc')](_0xd4f6('0xd'),_0x2fa481,_0xd4f6('0xe'));logger[_0xd4f6('0xf')](_0xd4f6('0x10'),_0x2fa481,'request\x20sent',JSON[_0xd4f6('0x11')](_0x52a363));if(_0x52a363[_0xd4f6('0x12')]){if(_0x52a363[_0xd4f6('0x12')][_0xd4f6('0x13')]===0x1f4){logger[_0xd4f6('0x12')]('SquareRecording,\x20%s,\x20%s',_0x2fa481,_0x52a363['error'][_0xd4f6('0x14')]);return _0x3fe7a6(_0x52a363[_0xd4f6('0x12')]['message']);}logger[_0xd4f6('0x12')](_0xd4f6('0xd'),_0x2fa481,_0x52a363['error'][_0xd4f6('0x14')]);return _0x287bfe(_0x52a363[_0xd4f6('0x12')][_0xd4f6('0x14')]);}else{logger[_0xd4f6('0xc')](_0xd4f6('0xd'),_0x2fa481,'request\x20sent');_0x287bfe(_0x52a363['result'][_0xd4f6('0x14')]);}})[_0xd4f6('0x15')](function(_0x52783e){logger[_0xd4f6('0x12')](_0xd4f6('0xd'),_0x2fa481,_0x52783e);_0x3fe7a6(_0x52783e);});});}exports[_0xd4f6('0x16')]=function(_0x2f7e5b){var _0x427ed8=this;return new Promise(function(_0x2e85da,_0x236528){return db[_0xd4f6('0x17')]['create'](_0x2f7e5b['body'],{'raw':_0x2f7e5b[_0xd4f6('0x18')]?_0x2f7e5b['options'][_0xd4f6('0x19')]===undefined?!![]:![]:!![]})[_0xd4f6('0xb')](function(_0x1a5389){logger['info'](_0xd4f6('0x16'),_0x2f7e5b);logger[_0xd4f6('0xf')](_0xd4f6('0x16'),_0x2f7e5b,JSON['stringify'](_0x1a5389));_0x2e85da(_0x1a5389);})[_0xd4f6('0x15')](function(_0x49a28b){logger[_0xd4f6('0x12')]('CreateSquareRecording',_0x49a28b[_0xd4f6('0x14')],_0x2f7e5b);_0x236528(_0x427ed8['error'](0x1f4,_0x49a28b['message']));});});}; \ No newline at end of file +var _0x28b4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','raw','debug','util','ioredis'];(function(_0x3a7ffc,_0x2f49a7){var _0xbba4dd=function(_0x5ee7b4){while(--_0x5ee7b4){_0x3a7ffc['push'](_0x3a7ffc['shift']());}};_0xbba4dd(++_0x2f49a7);}(_0x28b4,0x175));var _0x428b=function(_0x34b51b,_0x4af5f2){_0x34b51b=_0x34b51b-0x0;var _0xac5975=_0x28b4[_0x34b51b];return _0xac5975;};'use strict';var _=require('lodash');var util=require(_0x428b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428b('0x1'));var db=require(_0x428b('0x2'))['db'];var utils=require(_0x428b('0x3'));var logger=require(_0x428b('0x4'))(_0x428b('0x5'));var config=require(_0x428b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x428b('0x7')][_0x428b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd216,_0x146bcd,_0x3f0f9b){return new BPromise(function(_0x539f0b,_0x3587b2){return client[_0x428b('0x9')](_0x4cd216,_0x3f0f9b)[_0x428b('0xa')](function(_0x82aebb){logger[_0x428b('0xb')](_0x428b('0xc'),_0x146bcd,_0x428b('0xd'));logger['debug'](_0x428b('0xe'),_0x146bcd,_0x428b('0xd'),JSON['stringify'](_0x82aebb));if(_0x82aebb[_0x428b('0xf')]){if(_0x82aebb[_0x428b('0xf')][_0x428b('0x10')]===0x1f4){logger[_0x428b('0xf')]('SquareRecording,\x20%s,\x20%s',_0x146bcd,_0x82aebb[_0x428b('0xf')][_0x428b('0x11')]);return _0x3587b2(_0x82aebb[_0x428b('0xf')][_0x428b('0x11')]);}logger[_0x428b('0xf')](_0x428b('0xc'),_0x146bcd,_0x82aebb['error']['message']);return _0x539f0b(_0x82aebb[_0x428b('0xf')]['message']);}else{logger['info'](_0x428b('0xc'),_0x146bcd,_0x428b('0xd'));_0x539f0b(_0x82aebb['result']['message']);}})[_0x428b('0x12')](function(_0x1c1d4c){logger[_0x428b('0xf')]('SquareRecording,\x20%s,\x20%s',_0x146bcd,_0x1c1d4c);_0x3587b2(_0x1c1d4c);});});}exports[_0x428b('0x13')]=function(_0x18ba7b){var _0x2ff13a=this;return new Promise(function(_0x269b36,_0x310c5f){return db[_0x428b('0x14')][_0x428b('0x15')](_0x18ba7b[_0x428b('0x16')],{'raw':_0x18ba7b['options']?_0x18ba7b['options'][_0x428b('0x17')]===undefined?!![]:![]:!![]})[_0x428b('0xa')](function(_0x58d5c5){logger[_0x428b('0xb')](_0x428b('0x13'),_0x18ba7b);logger[_0x428b('0x18')]('CreateSquareRecording',_0x18ba7b,JSON['stringify'](_0x58d5c5));_0x269b36(_0x58d5c5);})[_0x428b('0x12')](function(_0x307fb5){logger[_0x428b('0xf')](_0x428b('0x13'),_0x307fb5[_0x428b('0x11')],_0x18ba7b);_0x310c5f(_0x2ff13a[_0x428b('0xf')](0x1f4,_0x307fb5[_0x428b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1ec8f3a..496805c 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 _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(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_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('./squareReport.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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e6ec3d0..a19e86a 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 _0xb3b7=['exports','STRING','DATE','BOOLEAN'];(function(_0x5a2d7c,_0x42cc84){var _0x44754c=function(_0x432f8e){while(--_0x432f8e){_0x5a2d7c['push'](_0x5a2d7c['shift']());}};_0x44754c(++_0x42cc84);}(_0xb3b7,0x6c));var _0x7b3b=function(_0xe563e0,_0x33a74f){_0xe563e0=_0xe563e0-0x0;var _0x5ac082=_0xb3b7[_0xe563e0];return _0x5ac082;};'use strict';var Sequelize=require('sequelize');module[_0x7b3b('0x0')]={'network':{'type':Sequelize[_0x7b3b('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7b3b('0x1')]},'language':{'type':Sequelize[_0x7b3b('0x1')]},'type':{'type':Sequelize[_0x7b3b('0x1')]},'uniqueid':{'type':Sequelize[_0x7b3b('0x1')]},'version':{'type':Sequelize[_0x7b3b('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b3b('0x1')]},'callingpres':{'type':Sequelize[_0x7b3b('0x1')]},'callingani2':{'type':Sequelize[_0x7b3b('0x1')]},'callington':{'type':Sequelize[_0x7b3b('0x1')]},'callingtns':{'type':Sequelize[_0x7b3b('0x1')]},'dnid':{'type':Sequelize[_0x7b3b('0x1')]},'rdnis':{'type':Sequelize[_0x7b3b('0x1')]},'context':{'type':Sequelize[_0x7b3b('0x1')]},'extension':{'type':Sequelize[_0x7b3b('0x1')]},'priority':{'type':Sequelize[_0x7b3b('0x1')]},'enhanced':{'type':Sequelize[_0x7b3b('0x1')]},'accountcode':{'type':Sequelize[_0x7b3b('0x1')]},'threadid':{'type':Sequelize[_0x7b3b('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7b3b('0x2')]},'bot':{'type':Sequelize[_0x7b3b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x264b=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x264b,0x6f));var _0xb264=function(_0x770bee,_0x82f4df){_0x770bee=_0x770bee-0x0;var _0x140b18=_0x264b[_0x770bee];return _0x140b18;};'use strict';var Sequelize=require(_0xb264('0x0'));module[_0xb264('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb264('0x2')]},'request':{'type':Sequelize[_0xb264('0x2')]},'channel':{'type':Sequelize[_0xb264('0x2')]},'language':{'type':Sequelize[_0xb264('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb264('0x2')]},'version':{'type':Sequelize[_0xb264('0x2')]},'callerid':{'type':Sequelize[_0xb264('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xb264('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xb264('0x2')]},'callingtns':{'type':Sequelize[_0xb264('0x2')]},'dnid':{'type':Sequelize[_0xb264('0x2')]},'rdnis':{'type':Sequelize[_0xb264('0x2')]},'context':{'type':Sequelize[_0xb264('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb264('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb264('0x2')]},'threadid':{'type':Sequelize[_0xb264('0x2')]},'project_name':{'type':Sequelize[_0xb264('0x2')]},'joinAt':{'type':Sequelize[_0xb264('0x3')]},'leaveAt':{'type':Sequelize[_0xb264('0x3')]},'bot':{'type':Sequelize[_0xb264('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 6fc9fe2..e2699d2 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 _0xbd0f=['squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','SquareReport','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x11b8b8,_0x5d7b0f){var _0x51739a=function(_0x5da0d2){while(--_0x5da0d2){_0x11b8b8['push'](_0x11b8b8['shift']());}};_0x51739a(++_0x5d7b0f);}(_0xbd0f,0x11c));var _0xfbd0=function(_0x3f7b29,_0x4f1ccd){_0x3f7b29=_0x3f7b29-0x0;var _0x2eb61f=_0xbd0f[_0x3f7b29];return _0x2eb61f;};'use strict';var emlformat=require(_0xfbd0('0x0'));var rimraf=require(_0xfbd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbd0('0x2'));var rp=require(_0xfbd0('0x3'));var moment=require(_0xfbd0('0x4'));var BPromise=require(_0xfbd0('0x5'));var Mustache=require(_0xfbd0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfbd0('0x7'));var csv=require(_0xfbd0('0x8'));var ejs=require(_0xfbd0('0x9'));var fs=require('fs');var fs_extra=require(_0xfbd0('0xa'));var _=require(_0xfbd0('0xb'));var squel=require(_0xfbd0('0xc'));var crypto=require(_0xfbd0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfbd0('0xe'));var toCsv=require(_0xfbd0('0x8'));var querystring=require('querystring');var Papa=require(_0xfbd0('0xf'));var Redis=require('ioredis');var authService=require(_0xfbd0('0x10'));var qs=require(_0xfbd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbd0('0x12'));var logger=require('../../config/logger')(_0xfbd0('0x13'));var utils=require('../../config/utils');var config=require(_0xfbd0('0x14'));var licenseUtil=require(_0xfbd0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b0e1d,_0x270264){_0x270264=_0x270264||0xcc;return function(_0x2f567d){if(_0x2f567d){return _0x5b0e1d[_0xfbd0('0x16')](_0x270264);}return _0x5b0e1d['status'](_0x270264)['end']();};}function respondWithResult(_0x1f2362,_0x577136){_0x577136=_0x577136||0xc8;return function(_0x3da4a3){if(_0x3da4a3){return _0x1f2362[_0xfbd0('0x17')](_0x577136)[_0xfbd0('0x18')](_0x3da4a3);}};}function respondWithFilteredResult(_0x31a1c3,_0x5f3ae0){return function(_0x4d427e){if(_0x4d427e){var _0x1fa6d5=typeof _0x5f3ae0['offset']===_0xfbd0('0x19')&&typeof _0x5f3ae0[_0xfbd0('0x1a')]===_0xfbd0('0x19');var _0x464dff=_0x4d427e[_0xfbd0('0x1b')];var _0x3c694e=_0x1fa6d5?0x0:_0x5f3ae0[_0xfbd0('0x1c')];var _0x4b136e=_0x1fa6d5?_0x4d427e[_0xfbd0('0x1b')]:_0x5f3ae0[_0xfbd0('0x1c')]+_0x5f3ae0['limit'];var _0x6de868;if(_0x4b136e>=_0x464dff){_0x4b136e=_0x464dff;_0x6de868=0xc8;}else{_0x6de868=0xce;}_0x31a1c3[_0xfbd0('0x17')](_0x6de868);return _0x31a1c3[_0xfbd0('0x1d')](_0xfbd0('0x1e'),_0x3c694e+'-'+_0x4b136e+'/'+_0x464dff)[_0xfbd0('0x18')](_0x4d427e);}return null;};}function patchUpdates(_0x7a791f){return function(_0x599785){try{jsonpatch[_0xfbd0('0x1f')](_0x599785,_0x7a791f,!![]);}catch(_0x1c3c81){return BPromise[_0xfbd0('0x20')](_0x1c3c81);}return _0x599785[_0xfbd0('0x21')]();};}function saveUpdates(_0x2b2b4b,_0x3c3066){return function(_0x131d4f){if(_0x131d4f){return _0x131d4f[_0xfbd0('0x22')](_0x2b2b4b)[_0xfbd0('0x23')](function(_0x129849){return _0x129849;});}return null;};}function removeEntity(_0x1f0b61,_0x467550){return function(_0x5a3651){if(_0x5a3651){return _0x5a3651[_0xfbd0('0x24')]()['then'](function(){_0x1f0b61[_0xfbd0('0x17')](0xcc)[_0xfbd0('0x25')]();});}};}function handleEntityNotFound(_0x4d868a,_0x4088f4){return function(_0x1c2afe){if(!_0x1c2afe){_0x4d868a[_0xfbd0('0x16')](0x194);}return _0x1c2afe;};}function handleError(_0x38a540,_0x10fd87){_0x10fd87=_0x10fd87||0x1f4;return function(_0x5984b5){logger[_0xfbd0('0x26')](_0x5984b5['stack']);if(_0x5984b5[_0xfbd0('0x27')]){delete _0x5984b5[_0xfbd0('0x27')];}_0x38a540['status'](_0x10fd87)[_0xfbd0('0x28')](_0x5984b5);};}exports[_0xfbd0('0x29')]=function(_0x59f9b6,_0x5715f3){var _0x450a9b={},_0x20084f={},_0x21bb60={'count':0x0,'rows':[]};var _0x30594f=_['map'](db['SquareReport'][_0xfbd0('0x2a')],function(_0x20c9fb){return{'name':_0x20c9fb[_0xfbd0('0x2b')],'type':_0x20c9fb[_0xfbd0('0x2c')][_0xfbd0('0x2d')]};});_0x20084f[_0xfbd0('0x2e')]=_[_0xfbd0('0x2f')](_0x30594f,_0xfbd0('0x27'));_0x20084f['query']=_[_0xfbd0('0x30')](_0x59f9b6[_0xfbd0('0x31')]);_0x20084f['filters']=_['intersection'](_0x20084f['model'],_0x20084f[_0xfbd0('0x31')]);_0x450a9b[_0xfbd0('0x32')]=_[_0xfbd0('0x33')](_0x20084f[_0xfbd0('0x2e')],qs[_0xfbd0('0x34')](_0x59f9b6[_0xfbd0('0x31')]['fields']));_0x450a9b['attributes']=_0x450a9b[_0xfbd0('0x32')][_0xfbd0('0x35')]?_0x450a9b['attributes']:_0x20084f['model'];if(!_0x59f9b6[_0xfbd0('0x31')][_0xfbd0('0x36')]('nolimit')){_0x450a9b['limit']=qs['limit'](_0x59f9b6[_0xfbd0('0x31')][_0xfbd0('0x1a')]);_0x450a9b['offset']=qs[_0xfbd0('0x1c')](_0x59f9b6['query'][_0xfbd0('0x1c')]);}_0x450a9b['order']=qs['sort'](_0x59f9b6[_0xfbd0('0x31')][_0xfbd0('0x37')]);_0x450a9b['where']=qs[_0xfbd0('0x38')](_['pick'](_0x59f9b6[_0xfbd0('0x31')],_0x20084f[_0xfbd0('0x38')]),_0x30594f);if(_0x59f9b6[_0xfbd0('0x31')][_0xfbd0('0x39')]){_0x450a9b[_0xfbd0('0x3a')]=_[_0xfbd0('0x3b')](_0x450a9b[_0xfbd0('0x3a')],{'$or':_[_0xfbd0('0x2f')](_0x30594f,function(_0x248e84){if(_0x248e84['type']!==_0xfbd0('0x3c')){var _0x564e55={};_0x564e55[_0x248e84['name']]={'$like':'%'+_0x59f9b6['query'][_0xfbd0('0x39')]+'%'};return _0x564e55;}})});}_0x450a9b=_[_0xfbd0('0x3b')]({},_0x450a9b,_0x59f9b6[_0xfbd0('0x3d')]);var _0x5a89ae={'where':_0x450a9b[_0xfbd0('0x3a')]};return db[_0xfbd0('0x3e')][_0xfbd0('0x1b')](_0x5a89ae)[_0xfbd0('0x23')](function(_0x5c8f23){_0x21bb60[_0xfbd0('0x1b')]=_0x5c8f23;if(_0x59f9b6[_0xfbd0('0x31')]['includeAll']){_0x450a9b['include']=[{'all':!![]}];}return db[_0xfbd0('0x3e')][_0xfbd0('0x3f')](_0x450a9b);})[_0xfbd0('0x23')](function(_0x213fdb){_0x21bb60[_0xfbd0('0x40')]=_0x213fdb;return _0x21bb60;})['then'](respondWithFilteredResult(_0x5715f3,_0x450a9b))[_0xfbd0('0x41')](handleError(_0x5715f3,null));};exports[_0xfbd0('0x42')]=function(_0x2c494a,_0x5829f6){var _0x57c6d6={'raw':!![],'where':{'id':_0x2c494a[_0xfbd0('0x43')]['id']}},_0x5f2617={};_0x5f2617['model']=_[_0xfbd0('0x30')](db[_0xfbd0('0x3e')][_0xfbd0('0x2a')]);_0x5f2617[_0xfbd0('0x31')]=_[_0xfbd0('0x30')](_0x2c494a['query']);_0x5f2617[_0xfbd0('0x38')]=_['intersection'](_0x5f2617['model'],_0x5f2617['query']);_0x57c6d6['attributes']=_['intersection'](_0x5f2617[_0xfbd0('0x2e')],qs[_0xfbd0('0x34')](_0x2c494a[_0xfbd0('0x31')][_0xfbd0('0x34')]));_0x57c6d6[_0xfbd0('0x32')]=_0x57c6d6['attributes'][_0xfbd0('0x35')]?_0x57c6d6['attributes']:_0x5f2617[_0xfbd0('0x2e')];if(_0x2c494a['query'][_0xfbd0('0x44')]){_0x57c6d6[_0xfbd0('0x45')]=[{'all':!![]}];}_0x57c6d6=_[_0xfbd0('0x3b')]({},_0x57c6d6,_0x2c494a[_0xfbd0('0x3d')]);return db[_0xfbd0('0x3e')][_0xfbd0('0x46')](_0x57c6d6)[_0xfbd0('0x23')](handleEntityNotFound(_0x5829f6,null))['then'](respondWithResult(_0x5829f6,null))[_0xfbd0('0x41')](handleError(_0x5829f6,null));};exports['create']=function(_0x44e71e,_0x487ffe){return db[_0xfbd0('0x3e')][_0xfbd0('0x47')](_0x44e71e[_0xfbd0('0x48')],{})['then'](respondWithResult(_0x487ffe,0xc9))[_0xfbd0('0x41')](handleError(_0x487ffe,null));};exports[_0xfbd0('0x22')]=function(_0x4ca60c,_0x215fd5){if(_0x4ca60c[_0xfbd0('0x48')]['id']){delete _0x4ca60c[_0xfbd0('0x48')]['id'];}return db[_0xfbd0('0x3e')]['find']({'where':{'id':_0x4ca60c['params']['id']}})['then'](handleEntityNotFound(_0x215fd5,null))[_0xfbd0('0x23')](saveUpdates(_0x4ca60c['body'],null))[_0xfbd0('0x23')](respondWithResult(_0x215fd5,null))[_0xfbd0('0x41')](handleError(_0x215fd5,null));};exports[_0xfbd0('0x24')]=function(_0x20c01f,_0x767130){return db[_0xfbd0('0x3e')][_0xfbd0('0x46')]({'where':{'id':_0x20c01f[_0xfbd0('0x43')]['id']}})[_0xfbd0('0x23')](handleEntityNotFound(_0x767130,null))['then'](removeEntity(_0x767130,null))[_0xfbd0('0x41')](handleError(_0x767130,null));};exports[_0xfbd0('0x49')]=function(_0x35e06c,_0x36afb9){return db['SquareReport'][_0xfbd0('0x49')]()[_0xfbd0('0x23')](respondWithResult(_0x36afb9,null))[_0xfbd0('0x41')](handleError(_0x36afb9,null));}; \ No newline at end of file +var _0x767c=['update','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find'];(function(_0x4d45b0,_0x508b1f){var _0x2d726d=function(_0x2e3ec3){while(--_0x2e3ec3){_0x4d45b0['push'](_0x4d45b0['shift']());}};_0x2d726d(++_0x508b1f);}(_0x767c,0x93));var _0xc767=function(_0xcfde1d,_0x47fcab){_0xcfde1d=_0xcfde1d-0x0;var _0x2abc9e=_0x767c[_0xcfde1d];return _0x2abc9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc767('0x0'));var zipdir=require(_0xc767('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc767('0x2'));var moment=require(_0xc767('0x3'));var BPromise=require(_0xc767('0x4'));var Mustache=require(_0xc767('0x5'));var util=require('util');var path=require(_0xc767('0x6'));var sox=require(_0xc767('0x7'));var csv=require(_0xc767('0x8'));var ejs=require(_0xc767('0x9'));var fs=require('fs');var fs_extra=require(_0xc767('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc767('0xb'));var jsforce=require(_0xc767('0xc'));var deskjs=require(_0xc767('0xd'));var toCsv=require(_0xc767('0x8'));var querystring=require(_0xc767('0xe'));var Papa=require('papaparse');var Redis=require(_0xc767('0xf'));var authService=require(_0xc767('0x10'));var qs=require(_0xc767('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc767('0x12'));var logger=require(_0xc767('0x13'))(_0xc767('0x14'));var utils=require('../../config/utils');var config=require(_0xc767('0x15'));var licenseUtil=require(_0xc767('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485fd2,_0xa53e6c){_0xa53e6c=_0xa53e6c||0xcc;return function(_0x3b9760){if(_0x3b9760){return _0x485fd2[_0xc767('0x17')](_0xa53e6c);}return _0x485fd2[_0xc767('0x18')](_0xa53e6c)[_0xc767('0x19')]();};}function respondWithResult(_0x51e20e,_0x152dfe){_0x152dfe=_0x152dfe||0xc8;return function(_0x424963){if(_0x424963){return _0x51e20e['status'](_0x152dfe)['json'](_0x424963);}};}function respondWithFilteredResult(_0x5bfc00,_0x878663){return function(_0x28c2ae){if(_0x28c2ae){var _0x2942bc=typeof _0x878663[_0xc767('0x1a')]===_0xc767('0x1b')&&typeof _0x878663[_0xc767('0x1c')]===_0xc767('0x1b');var _0x3d809b=_0x28c2ae[_0xc767('0x1d')];var _0x2edb05=_0x2942bc?0x0:_0x878663[_0xc767('0x1a')];var _0x123e7c=_0x2942bc?_0x28c2ae['count']:_0x878663[_0xc767('0x1a')]+_0x878663['limit'];var _0x37df4e;if(_0x123e7c>=_0x3d809b){_0x123e7c=_0x3d809b;_0x37df4e=0xc8;}else{_0x37df4e=0xce;}_0x5bfc00['status'](_0x37df4e);return _0x5bfc00[_0xc767('0x1e')](_0xc767('0x1f'),_0x2edb05+'-'+_0x123e7c+'/'+_0x3d809b)['json'](_0x28c2ae);}return null;};}function patchUpdates(_0x661809){return function(_0x5178a7){try{jsonpatch[_0xc767('0x20')](_0x5178a7,_0x661809,!![]);}catch(_0x3d1827){return BPromise['reject'](_0x3d1827);}return _0x5178a7['save']();};}function saveUpdates(_0x2aabf9,_0x11ab98){return function(_0x5d8178){if(_0x5d8178){return _0x5d8178['update'](_0x2aabf9)[_0xc767('0x21')](function(_0x21cfca){return _0x21cfca;});}return null;};}function removeEntity(_0xa88b56,_0x470a7e){return function(_0x3afbef){if(_0x3afbef){return _0x3afbef[_0xc767('0x22')]()[_0xc767('0x21')](function(){_0xa88b56[_0xc767('0x18')](0xcc)[_0xc767('0x19')]();});}};}function handleEntityNotFound(_0x35dd7e,_0x18fd0f){return function(_0x42936b){if(!_0x42936b){_0x35dd7e[_0xc767('0x17')](0x194);}return _0x42936b;};}function handleError(_0xf4a5b5,_0x4c100c){_0x4c100c=_0x4c100c||0x1f4;return function(_0x5bef2e){logger['error'](_0x5bef2e['stack']);if(_0x5bef2e[_0xc767('0x23')]){delete _0x5bef2e[_0xc767('0x23')];}_0xf4a5b5[_0xc767('0x18')](_0x4c100c)[_0xc767('0x24')](_0x5bef2e);};}exports[_0xc767('0x25')]=function(_0x265f42,_0x433922){var _0x89f9aa={},_0x165ec8={},_0x5a49db={'count':0x0,'rows':[]};var _0x10ad02=_[_0xc767('0x26')](db[_0xc767('0x27')][_0xc767('0x28')],function(_0x3ac919){return{'name':_0x3ac919[_0xc767('0x29')],'type':_0x3ac919[_0xc767('0x2a')][_0xc767('0x2b')]};});_0x165ec8[_0xc767('0x2c')]=_['map'](_0x10ad02,_0xc767('0x23'));_0x165ec8[_0xc767('0x2d')]=_[_0xc767('0x2e')](_0x265f42[_0xc767('0x2d')]);_0x165ec8[_0xc767('0x2f')]=_['intersection'](_0x165ec8[_0xc767('0x2c')],_0x165ec8[_0xc767('0x2d')]);_0x89f9aa[_0xc767('0x30')]=_['intersection'](_0x165ec8[_0xc767('0x2c')],qs['fields'](_0x265f42['query'][_0xc767('0x31')]));_0x89f9aa[_0xc767('0x30')]=_0x89f9aa[_0xc767('0x30')][_0xc767('0x32')]?_0x89f9aa['attributes']:_0x165ec8[_0xc767('0x2c')];if(!_0x265f42[_0xc767('0x2d')][_0xc767('0x33')](_0xc767('0x34'))){_0x89f9aa['limit']=qs['limit'](_0x265f42[_0xc767('0x2d')]['limit']);_0x89f9aa[_0xc767('0x1a')]=qs[_0xc767('0x1a')](_0x265f42['query'][_0xc767('0x1a')]);}_0x89f9aa['order']=qs[_0xc767('0x35')](_0x265f42[_0xc767('0x2d')][_0xc767('0x35')]);_0x89f9aa[_0xc767('0x36')]=qs['filters'](_[_0xc767('0x37')](_0x265f42[_0xc767('0x2d')],_0x165ec8['filters']),_0x10ad02);if(_0x265f42['query'][_0xc767('0x38')]){_0x89f9aa[_0xc767('0x36')]=_[_0xc767('0x39')](_0x89f9aa[_0xc767('0x36')],{'$or':_['map'](_0x10ad02,function(_0x43e316){if(_0x43e316[_0xc767('0x2a')]!==_0xc767('0x3a')){var _0x10771b={};_0x10771b[_0x43e316[_0xc767('0x23')]]={'$like':'%'+_0x265f42['query'][_0xc767('0x38')]+'%'};return _0x10771b;}})});}_0x89f9aa=_[_0xc767('0x39')]({},_0x89f9aa,_0x265f42['options']);var _0x4dece={'where':_0x89f9aa['where']};return db[_0xc767('0x27')][_0xc767('0x1d')](_0x4dece)[_0xc767('0x21')](function(_0xd8ae7){_0x5a49db[_0xc767('0x1d')]=_0xd8ae7;if(_0x265f42[_0xc767('0x2d')][_0xc767('0x3b')]){_0x89f9aa[_0xc767('0x3c')]=[{'all':!![]}];}return db[_0xc767('0x27')][_0xc767('0x3d')](_0x89f9aa);})[_0xc767('0x21')](function(_0x138d70){_0x5a49db[_0xc767('0x3e')]=_0x138d70;return _0x5a49db;})[_0xc767('0x21')](respondWithFilteredResult(_0x433922,_0x89f9aa))[_0xc767('0x3f')](handleError(_0x433922,null));};exports[_0xc767('0x40')]=function(_0x1556c9,_0x1028d6){var _0x536ec6={'raw':!![],'where':{'id':_0x1556c9[_0xc767('0x41')]['id']}},_0xd168a4={};_0xd168a4['model']=_['keys'](db[_0xc767('0x27')][_0xc767('0x28')]);_0xd168a4[_0xc767('0x2d')]=_[_0xc767('0x2e')](_0x1556c9['query']);_0xd168a4[_0xc767('0x2f')]=_['intersection'](_0xd168a4['model'],_0xd168a4[_0xc767('0x2d')]);_0x536ec6[_0xc767('0x30')]=_[_0xc767('0x42')](_0xd168a4[_0xc767('0x2c')],qs['fields'](_0x1556c9[_0xc767('0x2d')][_0xc767('0x31')]));_0x536ec6[_0xc767('0x30')]=_0x536ec6[_0xc767('0x30')][_0xc767('0x32')]?_0x536ec6[_0xc767('0x30')]:_0xd168a4['model'];if(_0x1556c9['query'][_0xc767('0x3b')]){_0x536ec6[_0xc767('0x3c')]=[{'all':!![]}];}_0x536ec6=_[_0xc767('0x39')]({},_0x536ec6,_0x1556c9[_0xc767('0x43')]);return db[_0xc767('0x27')][_0xc767('0x44')](_0x536ec6)['then'](handleEntityNotFound(_0x1028d6,null))[_0xc767('0x21')](respondWithResult(_0x1028d6,null))[_0xc767('0x3f')](handleError(_0x1028d6,null));};exports['create']=function(_0x2e2f2f,_0xa58730){return db[_0xc767('0x27')]['create'](_0x2e2f2f['body'],{})[_0xc767('0x21')](respondWithResult(_0xa58730,0xc9))['catch'](handleError(_0xa58730,null));};exports[_0xc767('0x45')]=function(_0x3c661f,_0xfd9916){if(_0x3c661f[_0xc767('0x46')]['id']){delete _0x3c661f[_0xc767('0x46')]['id'];}return db['SquareReport'][_0xc767('0x44')]({'where':{'id':_0x3c661f[_0xc767('0x41')]['id']}})[_0xc767('0x21')](handleEntityNotFound(_0xfd9916,null))[_0xc767('0x21')](saveUpdates(_0x3c661f[_0xc767('0x46')],null))['then'](respondWithResult(_0xfd9916,null))['catch'](handleError(_0xfd9916,null));};exports[_0xc767('0x22')]=function(_0x274c28,_0x3578cc){return db[_0xc767('0x27')][_0xc767('0x44')]({'where':{'id':_0x274c28[_0xc767('0x41')]['id']}})['then'](handleEntityNotFound(_0x3578cc,null))['then'](removeEntity(_0x3578cc,null))[_0xc767('0x3f')](handleError(_0x3578cc,null));};exports[_0xc767('0x47')]=function(_0x46fb1b,_0x406a88){return db[_0xc767('0x27')]['describe']()[_0xc767('0x21')](respondWithResult(_0x406a88,null))['catch'](handleError(_0x406a88,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3cd0ad0..7be0566 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 _0xfc87=['util','../../config/logger','moment','bluebird','request-promise','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x18aa82,_0x2f0f35){var _0x3fa3ba=function(_0x3dc7d7){while(--_0x3dc7d7){_0x18aa82['push'](_0x18aa82['shift']());}};_0x3fa3ba(++_0x2f0f35);}(_0xfc87,0x12c));var _0x7fc8=function(_0x1063ee,_0x3de0d9){_0x1063ee=_0x1063ee-0x0;var _0x2444f9=_0xfc87[_0x1063ee];return _0x2444f9;};'use strict';var _=require('lodash');var util=require(_0x7fc8('0x0'));var logger=require(_0x7fc8('0x1'))('api');var moment=require(_0x7fc8('0x2'));var BPromise=require(_0x7fc8('0x3'));var rp=require(_0x7fc8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7fc8('0x5'));module[_0x7fc8('0x6')]=function(_0x254e2e,_0x32d442){return _0x254e2e[_0x7fc8('0x7')](_0x7fc8('0x8'),attributes,{'tableName':_0x7fc8('0x9'),'paranoid':![],'indexes':[{'name':_0x7fc8('0xa'),'fields':[_0x7fc8('0xb'),'project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xce02=['project_name','leaveAt','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid'];(function(_0xdd9bba,_0x2e6c98){var _0x39c164=function(_0xe5ccdd){while(--_0xe5ccdd){_0xdd9bba['push'](_0xdd9bba['shift']());}};_0x39c164(++_0x2e6c98);}(_0xce02,0xa7));var _0x2ce0=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xce02[_0x42020e];return _0x561551;};'use strict';var _=require('lodash');var util=require(_0x2ce0('0x0'));var logger=require(_0x2ce0('0x1'))('api');var moment=require(_0x2ce0('0x2'));var BPromise=require(_0x2ce0('0x3'));var rp=require(_0x2ce0('0x4'));var fs=require('fs');var path=require(_0x2ce0('0x5'));var rimraf=require('rimraf');var config=require(_0x2ce0('0x6'));var attributes=require(_0x2ce0('0x7'));module[_0x2ce0('0x8')]=function(_0x50d644,_0x289cc0){return _0x50d644[_0x2ce0('0x9')](_0x2ce0('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x2ce0('0xb'),'fields':[_0x2ce0('0xc'),_0x2ce0('0xd')]},{'name':_0x2ce0('0xe'),'fields':[_0x2ce0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a9c21a8..9525c36 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 _0x1b90=['options','CreateSquareReport','stringify','UpdateSquareReport','update','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','result','catch','SquareReport','body'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x1b90,0x152));var _0x01b9=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x1b90[_0x60878f];return _0x1fbefb;};'use strict';var _=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var moment=require('moment');var BPromise=require(_0x01b9('0x2'));var rs=require(_0x01b9('0x3'));var fs=require('fs');var Redis=require(_0x01b9('0x4'));var db=require(_0x01b9('0x5'))['db'];var utils=require(_0x01b9('0x6'));var logger=require(_0x01b9('0x7'))(_0x01b9('0x8'));var config=require(_0x01b9('0x9'));var jayson=require(_0x01b9('0xa'));var client=jayson['client'][_0x01b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52fc55,_0xb72a00,_0x13d1fc){return new BPromise(function(_0x2c5f2e,_0x262095){return client[_0x01b9('0xc')](_0x52fc55,_0x13d1fc)[_0x01b9('0xd')](function(_0x44e883){logger[_0x01b9('0xe')]('SquareReport,\x20%s,\x20%s',_0xb72a00,_0x01b9('0xf'));logger[_0x01b9('0x10')](_0x01b9('0x11'),_0xb72a00,_0x01b9('0xf'),JSON['stringify'](_0x44e883));if(_0x44e883['error']){if(_0x44e883[_0x01b9('0x12')]['code']===0x1f4){logger[_0x01b9('0x12')](_0x01b9('0x13'),_0xb72a00,_0x44e883[_0x01b9('0x12')][_0x01b9('0x14')]);return _0x262095(_0x44e883[_0x01b9('0x12')][_0x01b9('0x14')]);}logger[_0x01b9('0x12')](_0x01b9('0x13'),_0xb72a00,_0x44e883[_0x01b9('0x12')][_0x01b9('0x14')]);return _0x2c5f2e(_0x44e883[_0x01b9('0x12')][_0x01b9('0x14')]);}else{logger[_0x01b9('0xe')](_0x01b9('0x13'),_0xb72a00,_0x01b9('0xf'));_0x2c5f2e(_0x44e883[_0x01b9('0x15')]['message']);}})[_0x01b9('0x16')](function(_0x222814){logger[_0x01b9('0x12')](_0x01b9('0x13'),_0xb72a00,_0x222814);_0x262095(_0x222814);});});}exports['CreateSquareReport']=function(_0x31401c){var _0x4153fd=this;return new Promise(function(_0x358032,_0x18eb58){return db[_0x01b9('0x17')]['create'](_0x31401c[_0x01b9('0x18')],{'raw':_0x31401c[_0x01b9('0x19')]?_0x31401c['options']['raw']===undefined?!![]:![]:!![]})[_0x01b9('0xd')](function(_0xf74a31){logger['info'](_0x01b9('0x1a'),_0x31401c);logger[_0x01b9('0x10')](_0x01b9('0x1a'),_0x31401c,JSON[_0x01b9('0x1b')](_0xf74a31));_0x358032(_0xf74a31);})['catch'](function(_0x63a925){logger[_0x01b9('0x12')]('CreateSquareReport',_0x63a925[_0x01b9('0x14')],_0x31401c);_0x18eb58(_0x4153fd[_0x01b9('0x12')](0x1f4,_0x63a925[_0x01b9('0x14')]));});});};exports[_0x01b9('0x1c')]=function(_0x4044e7){var _0x38cc42=this;return new Promise(function(_0x571544,_0x1b3e79){return db[_0x01b9('0x17')][_0x01b9('0x1d')](_0x4044e7[_0x01b9('0x18')],{'raw':_0x4044e7[_0x01b9('0x19')]?_0x4044e7['options'][_0x01b9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4044e7[_0x01b9('0x19')]?_0x4044e7[_0x01b9('0x19')][_0x01b9('0x1f')]||null:null,'attributes':_0x4044e7[_0x01b9('0x19')]?_0x4044e7[_0x01b9('0x19')][_0x01b9('0x20')]||null:null,'limit':_0x4044e7['options']?_0x4044e7['options']['limit']||null:null})[_0x01b9('0xd')](function(_0x199962){logger['info']('UpdateSquareReport',_0x4044e7);logger['debug'](_0x01b9('0x1c'),_0x4044e7,JSON[_0x01b9('0x1b')](_0x199962));_0x571544(_0x199962);})[_0x01b9('0x16')](function(_0x38deac){logger[_0x01b9('0x12')](_0x01b9('0x1c'),_0x38deac['message'],_0x4044e7);_0x1b3e79(_0x38cc42[_0x01b9('0x12')](0x1f4,_0x38deac[_0x01b9('0x14')]));});});}; \ No newline at end of file +var _0x7717=['message','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s'];(function(_0x528e64,_0x1e94fc){var _0x582907=function(_0x5bb456){while(--_0x5bb456){_0x528e64['push'](_0x528e64['shift']());}};_0x582907(++_0x1e94fc);}(_0x7717,0x9d));var _0x7771=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7717[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var moment=require(_0x7771('0x2'));var BPromise=require(_0x7771('0x3'));var rs=require(_0x7771('0x4'));var fs=require('fs');var Redis=require(_0x7771('0x5'));var db=require(_0x7771('0x6'))['db'];var utils=require(_0x7771('0x7'));var logger=require(_0x7771('0x8'))(_0x7771('0x9'));var config=require(_0x7771('0xa'));var jayson=require(_0x7771('0xb'));var client=jayson[_0x7771('0xc')][_0x7771('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x505e3a,_0x281ed3,_0xace122){return new BPromise(function(_0x3e2c89,_0x1ea602){return client['request'](_0x505e3a,_0xace122)[_0x7771('0xe')](function(_0x410f3c){logger[_0x7771('0xf')]('SquareReport,\x20%s,\x20%s',_0x281ed3,_0x7771('0x10'));logger[_0x7771('0x11')](_0x7771('0x12'),_0x281ed3,_0x7771('0x10'),JSON[_0x7771('0x13')](_0x410f3c));if(_0x410f3c[_0x7771('0x14')]){if(_0x410f3c['error'][_0x7771('0x15')]===0x1f4){logger[_0x7771('0x14')](_0x7771('0x16'),_0x281ed3,_0x410f3c[_0x7771('0x14')][_0x7771('0x17')]);return _0x1ea602(_0x410f3c[_0x7771('0x14')]['message']);}logger[_0x7771('0x14')](_0x7771('0x16'),_0x281ed3,_0x410f3c[_0x7771('0x14')]['message']);return _0x3e2c89(_0x410f3c[_0x7771('0x14')][_0x7771('0x17')]);}else{logger[_0x7771('0xf')](_0x7771('0x16'),_0x281ed3,_0x7771('0x10'));_0x3e2c89(_0x410f3c[_0x7771('0x18')]['message']);}})[_0x7771('0x19')](function(_0x331d0a){logger['error'](_0x7771('0x16'),_0x281ed3,_0x331d0a);_0x1ea602(_0x331d0a);});});}exports[_0x7771('0x1a')]=function(_0x379c53){var _0x2ca41f=this;return new Promise(function(_0x3ffb18,_0x1e1ac0){return db['SquareReport'][_0x7771('0x1b')](_0x379c53[_0x7771('0x1c')],{'raw':_0x379c53[_0x7771('0x1d')]?_0x379c53[_0x7771('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7771('0xe')](function(_0x1f760e){logger[_0x7771('0xf')](_0x7771('0x1a'),_0x379c53);logger[_0x7771('0x11')](_0x7771('0x1a'),_0x379c53,JSON[_0x7771('0x13')](_0x1f760e));_0x3ffb18(_0x1f760e);})[_0x7771('0x19')](function(_0x20c8ad){logger[_0x7771('0x14')]('CreateSquareReport',_0x20c8ad[_0x7771('0x17')],_0x379c53);_0x1e1ac0(_0x2ca41f[_0x7771('0x14')](0x1f4,_0x20c8ad[_0x7771('0x17')]));});});};exports[_0x7771('0x1e')]=function(_0x4b619c){var _0xd61256=this;return new Promise(function(_0x3c974b,_0xff1332){return db['SquareReport'][_0x7771('0x1f')](_0x4b619c[_0x7771('0x1c')],{'raw':_0x4b619c[_0x7771('0x1d')]?_0x4b619c[_0x7771('0x1d')][_0x7771('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b619c['options']?_0x4b619c[_0x7771('0x1d')][_0x7771('0x21')]||null:null,'attributes':_0x4b619c['options']?_0x4b619c['options'][_0x7771('0x22')]||null:null,'limit':_0x4b619c[_0x7771('0x1d')]?_0x4b619c['options'][_0x7771('0x23')]||null:null})[_0x7771('0xe')](function(_0x3187aa){logger['info'](_0x7771('0x1e'),_0x4b619c);logger[_0x7771('0x11')](_0x7771('0x1e'),_0x4b619c,JSON[_0x7771('0x13')](_0x3187aa));_0x3c974b(_0x3187aa);})[_0x7771('0x19')](function(_0x32bffc){logger[_0x7771('0x14')]('UpdateSquareReport',_0x32bffc['message'],_0x4b619c);_0xff1332(_0xd61256['error'](0x1f4,_0x32bffc[_0x7771('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4ec1e48..f3c4458 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 _0xabdd=['./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fe29e,_0x188f7a){var _0x76849d=function(_0x4cefe4){while(--_0x4cefe4){_0x2fe29e['push'](_0x2fe29e['shift']());}};_0x76849d(++_0x188f7a);}(_0xabdd,0x1f2));var _0xdabd=function(_0x2751fc,_0x10747e){_0x2751fc=_0x2751fc-0x0;var _0x2755d5=_0xabdd[_0x2751fc];return _0x2755d5;};'use strict';var multer=require(_0xdabd('0x0'));var util=require(_0xdabd('0x1'));var path=require(_0xdabd('0x2'));var timeout=require('connect-timeout');var express=require(_0xdabd('0x3'));var router=express[_0xdabd('0x4')]();var fs_extra=require(_0xdabd('0x5'));var auth=require(_0xdabd('0x6'));var interaction=require(_0xdabd('0x7'));var config=require('../../config/environment');var controller=require(_0xdabd('0x8'));router[_0xdabd('0x9')]('/',auth[_0xdabd('0xa')](),controller[_0xdabd('0xb')]);router[_0xdabd('0x9')](_0xdabd('0xc'),auth['isAuthenticated'](),controller[_0xdabd('0xd')]);router[_0xdabd('0x9')](_0xdabd('0xe'),auth[_0xdabd('0xa')](),controller[_0xdabd('0xf')]);router[_0xdabd('0x10')]('/',auth[_0xdabd('0xa')](),controller[_0xdabd('0x11')]);router['put'](_0xdabd('0xe'),auth[_0xdabd('0xa')](),controller[_0xdabd('0x12')]);router[_0xdabd('0x13')](_0xdabd('0xe'),auth[_0xdabd('0xa')](),controller[_0xdabd('0x14')]);module[_0xdabd('0x15')]=router; \ No newline at end of file +var _0xa591=['describe','show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xa591,0x77));var _0x1a59=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa591[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x1a59('0x0'));var util=require(_0x1a59('0x1'));var path=require(_0x1a59('0x2'));var timeout=require(_0x1a59('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1a59('0x4'));var auth=require(_0x1a59('0x5'));var interaction=require(_0x1a59('0x6'));var config=require(_0x1a59('0x7'));var controller=require(_0x1a59('0x8'));router[_0x1a59('0x9')]('/',auth[_0x1a59('0xa')](),controller[_0x1a59('0xb')]);router[_0x1a59('0x9')](_0x1a59('0xc'),auth[_0x1a59('0xa')](),controller[_0x1a59('0xd')]);router[_0x1a59('0x9')]('/:id',auth[_0x1a59('0xa')](),controller[_0x1a59('0xe')]);router[_0x1a59('0xf')]('/',auth[_0x1a59('0xa')](),controller[_0x1a59('0x10')]);router[_0x1a59('0x11')]('/:id',auth[_0x1a59('0xa')](),controller[_0x1a59('0x12')]);router[_0x1a59('0x13')](_0x1a59('0x14'),auth[_0x1a59('0xa')](),controller['destroy']);module[_0x1a59('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f9f2eb9..45277eb 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 _0x01be=['exports','STRING','TEXT','sequelize'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x01be,0x1d3));var _0xe01b=function(_0x2b03ef,_0x29d3a0){_0x2b03ef=_0x2b03ef-0x0;var _0x181055=_0x01be[_0x2b03ef];return _0x181055;};'use strict';var Sequelize=require(_0xe01b('0x0'));module[_0xe01b('0x1')]={'uniqueid':{'type':Sequelize[_0xe01b('0x2')]},'node':{'type':Sequelize[_0xe01b('0x2')]},'application':{'type':Sequelize[_0xe01b('0x2')]},'data':{'type':Sequelize[_0xe01b('0x3')]},'project_name':{'type':Sequelize[_0xe01b('0x2')]},'callerid':{'type':Sequelize[_0xe01b('0x2')]}}; \ No newline at end of file +var _0xefc6=['sequelize','exports','STRING','TEXT'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xefc6,0x148));var _0x6efc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xefc6[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x6efc('0x0'));module[_0x6efc('0x1')]={'uniqueid':{'type':Sequelize[_0x6efc('0x2')]},'node':{'type':Sequelize[_0x6efc('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x6efc('0x3')]},'project_name':{'type':Sequelize[_0x6efc('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3a93614..d2790b2 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 _0x53b2=['filters','merge','map','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SquareDetailsReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3b82bd,_0x3b3d53){var _0x4ae976=function(_0x1f1aaf){while(--_0x1f1aaf){_0x3b82bd['push'](_0x3b82bd['shift']());}};_0x4ae976(++_0x3b3d53);}(_0x53b2,0xa8));var _0x253b=function(_0x43007a,_0x5bf45f){_0x43007a=_0x43007a-0x0;var _0x190a86=_0x53b2[_0x43007a];return _0x190a86;};'use strict';var emlformat=require(_0x253b('0x0'));var rimraf=require(_0x253b('0x1'));var zipdir=require(_0x253b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x253b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x253b('0x4'));var util=require(_0x253b('0x5'));var path=require(_0x253b('0x6'));var sox=require('sox');var csv=require(_0x253b('0x7'));var ejs=require(_0x253b('0x8'));var fs=require('fs');var fs_extra=require(_0x253b('0x9'));var _=require(_0x253b('0xa'));var squel=require(_0x253b('0xb'));var crypto=require('crypto');var jsforce=require(_0x253b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x253b('0xd'));var Papa=require(_0x253b('0xe'));var Redis=require('ioredis');var authService=require(_0x253b('0xf'));var qs=require(_0x253b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x253b('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x253b('0x12'));var licenseUtil=require(_0x253b('0x13'));var db=require(_0x253b('0x14'))['db'];function respondWithStatusCode(_0x5eb4be,_0x1c7dff){_0x1c7dff=_0x1c7dff||0xcc;return function(_0x2860e6){if(_0x2860e6){return _0x5eb4be[_0x253b('0x15')](_0x1c7dff);}return _0x5eb4be[_0x253b('0x16')](_0x1c7dff)[_0x253b('0x17')]();};}function respondWithResult(_0x27739e,_0x3c686b){_0x3c686b=_0x3c686b||0xc8;return function(_0xc18611){if(_0xc18611){return _0x27739e['status'](_0x3c686b)[_0x253b('0x18')](_0xc18611);}};}function respondWithFilteredResult(_0x2374c3,_0x1fba0e){return function(_0x554015){if(_0x554015){var _0x4a80f8=typeof _0x1fba0e['offset']===_0x253b('0x19')&&typeof _0x1fba0e[_0x253b('0x1a')]===_0x253b('0x19');var _0x360d2b=_0x554015[_0x253b('0x1b')];var _0x3462b4=_0x4a80f8?0x0:_0x1fba0e[_0x253b('0x1c')];var _0x3bc7c0=_0x4a80f8?_0x554015[_0x253b('0x1b')]:_0x1fba0e[_0x253b('0x1c')]+_0x1fba0e[_0x253b('0x1a')];var _0x56c40b;if(_0x3bc7c0>=_0x360d2b){_0x3bc7c0=_0x360d2b;_0x56c40b=0xc8;}else{_0x56c40b=0xce;}_0x2374c3['status'](_0x56c40b);return _0x2374c3[_0x253b('0x1d')](_0x253b('0x1e'),_0x3462b4+'-'+_0x3bc7c0+'/'+_0x360d2b)[_0x253b('0x18')](_0x554015);}return null;};}function patchUpdates(_0x307d0c){return function(_0x80965c){try{jsonpatch[_0x253b('0x1f')](_0x80965c,_0x307d0c,!![]);}catch(_0x35c21e){return BPromise[_0x253b('0x20')](_0x35c21e);}return _0x80965c[_0x253b('0x21')]();};}function saveUpdates(_0x1d0df3,_0x41e6ec){return function(_0x264f3c){if(_0x264f3c){return _0x264f3c['update'](_0x1d0df3)[_0x253b('0x22')](function(_0x51d6a7){return _0x51d6a7;});}return null;};}function removeEntity(_0x939068,_0x161378){return function(_0x248c4e){if(_0x248c4e){return _0x248c4e[_0x253b('0x23')]()['then'](function(){_0x939068[_0x253b('0x16')](0xcc)[_0x253b('0x17')]();});}};}function handleEntityNotFound(_0x1ba1e8,_0x32e12e){return function(_0x1fbbd7){if(!_0x1fbbd7){_0x1ba1e8[_0x253b('0x15')](0x194);}return _0x1fbbd7;};}function handleError(_0x5cd1aa,_0x594c8b){_0x594c8b=_0x594c8b||0x1f4;return function(_0x60263e){logger[_0x253b('0x24')](_0x60263e[_0x253b('0x25')]);if(_0x60263e[_0x253b('0x26')]){delete _0x60263e[_0x253b('0x26')];}_0x5cd1aa['status'](_0x594c8b)[_0x253b('0x27')](_0x60263e);};}exports[_0x253b('0x28')]=function(_0x61678c,_0x4a8f2d){var _0x558cc2={},_0x36bf69={},_0x7f51a={'count':0x0,'rows':[]};var _0x1318cb=_['map'](db[_0x253b('0x29')]['rawAttributes'],function(_0x117e79){return{'name':_0x117e79[_0x253b('0x2a')],'type':_0x117e79[_0x253b('0x2b')][_0x253b('0x2c')]};});_0x36bf69[_0x253b('0x2d')]=_['map'](_0x1318cb,'name');_0x36bf69[_0x253b('0x2e')]=_[_0x253b('0x2f')](_0x61678c[_0x253b('0x2e')]);_0x36bf69['filters']=_['intersection'](_0x36bf69[_0x253b('0x2d')],_0x36bf69[_0x253b('0x2e')]);_0x558cc2[_0x253b('0x30')]=_[_0x253b('0x31')](_0x36bf69[_0x253b('0x2d')],qs['fields'](_0x61678c[_0x253b('0x2e')][_0x253b('0x32')]));_0x558cc2[_0x253b('0x30')]=_0x558cc2['attributes'][_0x253b('0x33')]?_0x558cc2[_0x253b('0x30')]:_0x36bf69[_0x253b('0x2d')];if(!_0x61678c[_0x253b('0x2e')][_0x253b('0x34')](_0x253b('0x35'))){_0x558cc2[_0x253b('0x1a')]=qs[_0x253b('0x1a')](_0x61678c['query'][_0x253b('0x1a')]);_0x558cc2[_0x253b('0x1c')]=qs['offset'](_0x61678c[_0x253b('0x2e')][_0x253b('0x1c')]);}_0x558cc2[_0x253b('0x36')]=qs[_0x253b('0x37')](_0x61678c[_0x253b('0x2e')][_0x253b('0x37')]);_0x558cc2[_0x253b('0x38')]=qs['filters'](_['pick'](_0x61678c['query'],_0x36bf69[_0x253b('0x39')]),_0x1318cb);if(_0x61678c[_0x253b('0x2e')]['filter']){_0x558cc2[_0x253b('0x38')]=_[_0x253b('0x3a')](_0x558cc2[_0x253b('0x38')],{'$or':_[_0x253b('0x3b')](_0x1318cb,function(_0x1b1c69){if(_0x1b1c69['type']!==_0x253b('0x3c')){var _0x37f8f8={};_0x37f8f8[_0x1b1c69[_0x253b('0x26')]]={'$like':'%'+_0x61678c[_0x253b('0x2e')][_0x253b('0x3d')]+'%'};return _0x37f8f8;}})});}_0x558cc2=_['merge']({},_0x558cc2,_0x61678c[_0x253b('0x3e')]);var _0x4c3645={'where':_0x558cc2['where']};return db[_0x253b('0x29')][_0x253b('0x1b')](_0x4c3645)['then'](function(_0x3b3815){_0x7f51a['count']=_0x3b3815;if(_0x61678c['query']['includeAll']){_0x558cc2[_0x253b('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x558cc2);})[_0x253b('0x22')](function(_0x43e741){_0x7f51a[_0x253b('0x40')]=_0x43e741;return _0x7f51a;})[_0x253b('0x22')](respondWithFilteredResult(_0x4a8f2d,_0x558cc2))['catch'](handleError(_0x4a8f2d,null));};exports[_0x253b('0x41')]=function(_0x22b759,_0x3550b2){var _0x2df17a={'raw':!![],'where':{'id':_0x22b759[_0x253b('0x42')]['id']}},_0x5b3fa4={};_0x5b3fa4[_0x253b('0x2d')]=_['keys'](db[_0x253b('0x29')][_0x253b('0x43')]);_0x5b3fa4[_0x253b('0x2e')]=_['keys'](_0x22b759[_0x253b('0x2e')]);_0x5b3fa4[_0x253b('0x39')]=_[_0x253b('0x31')](_0x5b3fa4['model'],_0x5b3fa4[_0x253b('0x2e')]);_0x2df17a[_0x253b('0x30')]=_[_0x253b('0x31')](_0x5b3fa4['model'],qs[_0x253b('0x32')](_0x22b759['query'][_0x253b('0x32')]));_0x2df17a[_0x253b('0x30')]=_0x2df17a[_0x253b('0x30')][_0x253b('0x33')]?_0x2df17a[_0x253b('0x30')]:_0x5b3fa4[_0x253b('0x2d')];if(_0x22b759[_0x253b('0x2e')][_0x253b('0x44')]){_0x2df17a[_0x253b('0x3f')]=[{'all':!![]}];}_0x2df17a=_[_0x253b('0x3a')]({},_0x2df17a,_0x22b759['options']);return db[_0x253b('0x29')][_0x253b('0x45')](_0x2df17a)[_0x253b('0x22')](handleEntityNotFound(_0x3550b2,null))['then'](respondWithResult(_0x3550b2,null))[_0x253b('0x46')](handleError(_0x3550b2,null));};exports[_0x253b('0x47')]=function(_0xc0b882,_0x37f382){return db[_0x253b('0x29')]['create'](_0xc0b882[_0x253b('0x48')],{})['then'](respondWithResult(_0x37f382,0xc9))['catch'](handleError(_0x37f382,null));};exports[_0x253b('0x49')]=function(_0x59b4d3,_0x1be9d9){if(_0x59b4d3[_0x253b('0x48')]['id']){delete _0x59b4d3['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x59b4d3[_0x253b('0x42')]['id']}})[_0x253b('0x22')](handleEntityNotFound(_0x1be9d9,null))[_0x253b('0x22')](saveUpdates(_0x59b4d3[_0x253b('0x48')],null))['then'](respondWithResult(_0x1be9d9,null))[_0x253b('0x46')](handleError(_0x1be9d9,null));};exports[_0x253b('0x23')]=function(_0x1c7d4d,_0x2a615a){return db[_0x253b('0x29')][_0x253b('0x45')]({'where':{'id':_0x1c7d4d[_0x253b('0x42')]['id']}})[_0x253b('0x22')](handleEntityNotFound(_0x2a615a,null))[_0x253b('0x22')](removeEntity(_0x2a615a,null))[_0x253b('0x46')](handleError(_0x2a615a,null));};exports['describe']=function(_0x4028ee,_0x1b07b3){return db['SquareDetailsReport'][_0x253b('0x4a')]()['then'](respondWithResult(_0x1b07b3,null))[_0x253b('0x46')](handleError(_0x1b07b3,null));}; \ No newline at end of file +var _0x15e7=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf'];(function(_0x4d5353,_0x11fe19){var _0x3ae1db=function(_0x52e262){while(--_0x52e262){_0x4d5353['push'](_0x4d5353['shift']());}};_0x3ae1db(++_0x11fe19);}(_0x15e7,0x1ef));var _0x715e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x15e7[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x715e('0x0'));var rimraf=require(_0x715e('0x1'));var zipdir=require(_0x715e('0x2'));var jsonpatch=require(_0x715e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x715e('0x4'));var Mustache=require(_0x715e('0x5'));var util=require(_0x715e('0x6'));var path=require(_0x715e('0x7'));var sox=require(_0x715e('0x8'));var csv=require(_0x715e('0x9'));var ejs=require(_0x715e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x715e('0xb'));var squel=require(_0x715e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x715e('0xd'));var toCsv=require(_0x715e('0x9'));var querystring=require(_0x715e('0xe'));var Papa=require('papaparse');var Redis=require(_0x715e('0xf'));var authService=require(_0x715e('0x10'));var qs=require(_0x715e('0x11'));var as=require(_0x715e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x715e('0x13'))(_0x715e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x715e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f17f1,_0x483502){_0x483502=_0x483502||0xcc;return function(_0x44844d){if(_0x44844d){return _0x2f17f1[_0x715e('0x16')](_0x483502);}return _0x2f17f1[_0x715e('0x17')](_0x483502)[_0x715e('0x18')]();};}function respondWithResult(_0x5ef906,_0x5942d3){_0x5942d3=_0x5942d3||0xc8;return function(_0x3ebd3e){if(_0x3ebd3e){return _0x5ef906[_0x715e('0x17')](_0x5942d3)[_0x715e('0x19')](_0x3ebd3e);}};}function respondWithFilteredResult(_0x2ba3e4,_0x22dda9){return function(_0x3f400a){if(_0x3f400a){var _0x4393f7=typeof _0x22dda9['offset']==='undefined'&&typeof _0x22dda9[_0x715e('0x1a')]==='undefined';var _0x2a170b=_0x3f400a[_0x715e('0x1b')];var _0x4db6ac=_0x4393f7?0x0:_0x22dda9['offset'];var _0x66e709=_0x4393f7?_0x3f400a[_0x715e('0x1b')]:_0x22dda9[_0x715e('0x1c')]+_0x22dda9[_0x715e('0x1a')];var _0x599f49;if(_0x66e709>=_0x2a170b){_0x66e709=_0x2a170b;_0x599f49=0xc8;}else{_0x599f49=0xce;}_0x2ba3e4[_0x715e('0x17')](_0x599f49);return _0x2ba3e4[_0x715e('0x1d')](_0x715e('0x1e'),_0x4db6ac+'-'+_0x66e709+'/'+_0x2a170b)['json'](_0x3f400a);}return null;};}function patchUpdates(_0x181312){return function(_0x524202){try{jsonpatch['apply'](_0x524202,_0x181312,!![]);}catch(_0x27e582){return BPromise[_0x715e('0x1f')](_0x27e582);}return _0x524202['save']();};}function saveUpdates(_0x56d018,_0x2a6376){return function(_0x35654f){if(_0x35654f){return _0x35654f[_0x715e('0x20')](_0x56d018)[_0x715e('0x21')](function(_0x84ba5c){return _0x84ba5c;});}return null;};}function removeEntity(_0x578769,_0x2560f9){return function(_0x105bf7){if(_0x105bf7){return _0x105bf7[_0x715e('0x22')]()['then'](function(){_0x578769[_0x715e('0x17')](0xcc)[_0x715e('0x18')]();});}};}function handleEntityNotFound(_0x380558,_0x4fcaf3){return function(_0x255e05){if(!_0x255e05){_0x380558['sendStatus'](0x194);}return _0x255e05;};}function handleError(_0x6eb753,_0x525eac){_0x525eac=_0x525eac||0x1f4;return function(_0x7687fd){logger[_0x715e('0x23')](_0x7687fd[_0x715e('0x24')]);if(_0x7687fd[_0x715e('0x25')]){delete _0x7687fd['name'];}_0x6eb753['status'](_0x525eac)[_0x715e('0x26')](_0x7687fd);};}exports[_0x715e('0x27')]=function(_0x56d45e,_0x488f49){var _0x49ff3d={},_0x132746={},_0x44a9ef={'count':0x0,'rows':[]};var _0x1f3ec2=_[_0x715e('0x28')](db[_0x715e('0x29')][_0x715e('0x2a')],function(_0x235306){return{'name':_0x235306[_0x715e('0x2b')],'type':_0x235306['type'][_0x715e('0x2c')]};});_0x132746['model']=_[_0x715e('0x28')](_0x1f3ec2,'name');_0x132746[_0x715e('0x2d')]=_[_0x715e('0x2e')](_0x56d45e[_0x715e('0x2d')]);_0x132746['filters']=_['intersection'](_0x132746['model'],_0x132746['query']);_0x49ff3d['attributes']=_[_0x715e('0x2f')](_0x132746[_0x715e('0x30')],qs[_0x715e('0x31')](_0x56d45e[_0x715e('0x2d')][_0x715e('0x31')]));_0x49ff3d[_0x715e('0x32')]=_0x49ff3d['attributes'][_0x715e('0x33')]?_0x49ff3d[_0x715e('0x32')]:_0x132746[_0x715e('0x30')];if(!_0x56d45e[_0x715e('0x2d')][_0x715e('0x34')](_0x715e('0x35'))){_0x49ff3d['limit']=qs['limit'](_0x56d45e[_0x715e('0x2d')][_0x715e('0x1a')]);_0x49ff3d['offset']=qs[_0x715e('0x1c')](_0x56d45e[_0x715e('0x2d')]['offset']);}_0x49ff3d['order']=qs[_0x715e('0x36')](_0x56d45e[_0x715e('0x2d')][_0x715e('0x36')]);_0x49ff3d[_0x715e('0x37')]=qs[_0x715e('0x38')](_['pick'](_0x56d45e['query'],_0x132746[_0x715e('0x38')]),_0x1f3ec2);if(_0x56d45e['query'][_0x715e('0x39')]){_0x49ff3d[_0x715e('0x37')]=_[_0x715e('0x3a')](_0x49ff3d[_0x715e('0x37')],{'$or':_[_0x715e('0x28')](_0x1f3ec2,function(_0x5e4131){if(_0x5e4131['type']!==_0x715e('0x3b')){var _0x1c80f8={};_0x1c80f8[_0x5e4131[_0x715e('0x25')]]={'$like':'%'+_0x56d45e[_0x715e('0x2d')][_0x715e('0x39')]+'%'};return _0x1c80f8;}})});}_0x49ff3d=_[_0x715e('0x3a')]({},_0x49ff3d,_0x56d45e[_0x715e('0x3c')]);var _0x36f25d={'where':_0x49ff3d[_0x715e('0x37')]};return db[_0x715e('0x29')][_0x715e('0x1b')](_0x36f25d)[_0x715e('0x21')](function(_0xca4df6){_0x44a9ef[_0x715e('0x1b')]=_0xca4df6;if(_0x56d45e['query']['includeAll']){_0x49ff3d[_0x715e('0x3d')]=[{'all':!![]}];}return db[_0x715e('0x29')][_0x715e('0x3e')](_0x49ff3d);})['then'](function(_0x285754){_0x44a9ef[_0x715e('0x3f')]=_0x285754;return _0x44a9ef;})[_0x715e('0x21')](respondWithFilteredResult(_0x488f49,_0x49ff3d))[_0x715e('0x40')](handleError(_0x488f49,null));};exports[_0x715e('0x41')]=function(_0x3bad24,_0x34804c){var _0x552b46={'raw':!![],'where':{'id':_0x3bad24[_0x715e('0x42')]['id']}},_0x23092f={};_0x23092f[_0x715e('0x30')]=_[_0x715e('0x2e')](db['SquareDetailsReport'][_0x715e('0x2a')]);_0x23092f['query']=_['keys'](_0x3bad24[_0x715e('0x2d')]);_0x23092f['filters']=_[_0x715e('0x2f')](_0x23092f[_0x715e('0x30')],_0x23092f['query']);_0x552b46[_0x715e('0x32')]=_[_0x715e('0x2f')](_0x23092f['model'],qs['fields'](_0x3bad24[_0x715e('0x2d')][_0x715e('0x31')]));_0x552b46[_0x715e('0x32')]=_0x552b46[_0x715e('0x32')][_0x715e('0x33')]?_0x552b46[_0x715e('0x32')]:_0x23092f[_0x715e('0x30')];if(_0x3bad24[_0x715e('0x2d')][_0x715e('0x43')]){_0x552b46[_0x715e('0x3d')]=[{'all':!![]}];}_0x552b46=_['merge']({},_0x552b46,_0x3bad24[_0x715e('0x3c')]);return db[_0x715e('0x29')][_0x715e('0x44')](_0x552b46)[_0x715e('0x21')](handleEntityNotFound(_0x34804c,null))[_0x715e('0x21')](respondWithResult(_0x34804c,null))[_0x715e('0x40')](handleError(_0x34804c,null));};exports[_0x715e('0x45')]=function(_0x3889e7,_0x51e97){return db[_0x715e('0x29')][_0x715e('0x45')](_0x3889e7[_0x715e('0x46')],{})[_0x715e('0x21')](respondWithResult(_0x51e97,0xc9))[_0x715e('0x40')](handleError(_0x51e97,null));};exports[_0x715e('0x20')]=function(_0x387bf8,_0x4f1d22){if(_0x387bf8[_0x715e('0x46')]['id']){delete _0x387bf8[_0x715e('0x46')]['id'];}return db[_0x715e('0x29')]['find']({'where':{'id':_0x387bf8[_0x715e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f1d22,null))['then'](saveUpdates(_0x387bf8['body'],null))[_0x715e('0x21')](respondWithResult(_0x4f1d22,null))[_0x715e('0x40')](handleError(_0x4f1d22,null));};exports[_0x715e('0x22')]=function(_0x41803b,_0x15a6f6){return db[_0x715e('0x29')][_0x715e('0x44')]({'where':{'id':_0x41803b[_0x715e('0x42')]['id']}})[_0x715e('0x21')](handleEntityNotFound(_0x15a6f6,null))[_0x715e('0x21')](removeEntity(_0x15a6f6,null))[_0x715e('0x40')](handleError(_0x15a6f6,null));};exports['describe']=function(_0x48ef6f,_0x59dcf7){return db[_0x715e('0x29')]['describe']()[_0x715e('0x21')](respondWithResult(_0x59dcf7,null))['catch'](handleError(_0x59dcf7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 35f48c7..b31f14c 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 _0xb6ac=['SquareDetailsReport','report_square_details','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0xb6ac,0xff));var _0xcb6a=function(_0xf7e038,_0x47727f){_0xf7e038=_0xf7e038-0x0;var _0x128802=_0xb6ac[_0xf7e038];return _0x128802;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcb6a('0x0'));var BPromise=require(_0xcb6a('0x1'));var rp=require(_0xcb6a('0x2'));var fs=require('fs');var path=require(_0xcb6a('0x3'));var rimraf=require(_0xcb6a('0x4'));var config=require(_0xcb6a('0x5'));var attributes=require(_0xcb6a('0x6'));module[_0xcb6a('0x7')]=function(_0x54fd22,_0x5b235a){return _0x54fd22[_0xcb6a('0x8')](_0xcb6a('0x9'),attributes,{'tableName':_0xcb6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa937=['moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xa937,0x194));var _0x7a93=function(_0x11899d,_0x27ef4b){_0x11899d=_0x11899d-0x0;var _0x559f82=_0xa937[_0x11899d];return _0x559f82;};'use strict';var _=require('lodash');var util=require(_0x7a93('0x0'));var logger=require(_0x7a93('0x1'))(_0x7a93('0x2'));var moment=require(_0x7a93('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a93('0x4'));var fs=require('fs');var path=require(_0x7a93('0x5'));var rimraf=require(_0x7a93('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a93('0x7'));module[_0x7a93('0x8')]=function(_0x5c0026,_0x5148e6){return _0x5c0026['define'](_0x7a93('0x9'),attributes,{'tableName':_0x7a93('0xa'),'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 8c512de..0bb9edf 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 _0x6f2f=['ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','code','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util'];(function(_0x2cf0c0,_0x44e5cf){var _0x597b78=function(_0x257093){while(--_0x257093){_0x2cf0c0['push'](_0x2cf0c0['shift']());}};_0x597b78(++_0x44e5cf);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x6f2f[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});}exports[_0xf6f2('0x13')]=function(_0x400055){var _0x506b3=this;return new Promise(function(_0x42b93b,_0x1b11ea){return db[_0xf6f2('0x14')]['create'](_0x400055['body'],{'raw':_0x400055[_0xf6f2('0x15')]?_0x400055['options'][_0xf6f2('0x16')]===undefined?!![]:![]:!![]})[_0xf6f2('0x8')](function(_0x312429){logger[_0xf6f2('0x9')]('CreateSquareDetailsReport',_0x400055);logger[_0xf6f2('0xb')](_0xf6f2('0x13'),_0x400055,JSON[_0xf6f2('0x17')](_0x312429));_0x42b93b(_0x312429);})[_0xf6f2('0x12')](function(_0x5dce4f){logger[_0xf6f2('0xe')]('CreateSquareDetailsReport',_0x5dce4f[_0xf6f2('0x10')],_0x400055);_0x1b11ea(_0x506b3['error'](0x1f4,_0x5dce4f[_0xf6f2('0x10')]));});});}; \ No newline at end of file +var _0x8d05=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch'];(function(_0x561a7f,_0x269589){var _0xe95f99=function(_0x10900a){while(--_0x10900a){_0x561a7f['push'](_0x561a7f['shift']());}};_0xe95f99(++_0x269589);}(_0x8d05,0xe8));var _0x58d0=function(_0x3c6800,_0x3f5362){_0x3c6800=_0x3c6800-0x0;var _0x1d05bd=_0x8d05[_0x3c6800];return _0x1d05bd;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateSquareDetailsReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3ba3141..5bba314 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 _0xe59a=['/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x4eb4c9,_0xf1762){var _0x2893e4=function(_0x55ea5f){while(--_0x55ea5f){_0x4eb4c9['push'](_0x4eb4c9['shift']());}};_0x2893e4(++_0xf1762);}(_0xe59a,0x1ad));var _0xae59=function(_0x49c8bd,_0x5ed726){_0x49c8bd=_0x49c8bd-0x0;var _0x236884=_0xe59a[_0x49c8bd];return _0x236884;};'use strict';var express=require('express');var router=express[_0xae59('0x0')]();var auth=require(_0xae59('0x1'));var controller=require(_0xae59('0x2'));router[_0xae59('0x3')]('/',auth[_0xae59('0x4')](),controller['index']);router[_0xae59('0x3')](_0xae59('0x5'),auth[_0xae59('0x4')](),controller['killProcess']);module[_0xae59('0x6')]=router; \ No newline at end of file +var _0x278d=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x4e6312,_0x47e29c){var _0x2b5c20=function(_0x303e14){while(--_0x303e14){_0x4e6312['push'](_0x4e6312['shift']());}};_0x2b5c20(++_0x47e29c);}(_0x278d,0xac));var _0xd278=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0x278d[_0x179b74];return _0x268f76;};'use strict';var express=require(_0xd278('0x0'));var router=express[_0xd278('0x1')]();var auth=require(_0xd278('0x2'));var controller=require(_0xd278('0x3'));router[_0xd278('0x4')]('/',auth[_0xd278('0x5')](),controller[_0xd278('0x6')]);router[_0xd278('0x4')](_0xd278('0x7'),auth[_0xd278('0x5')](),controller[_0xd278('0x8')]);module[_0xd278('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5c8fcad..bbea692 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 _0x75ae=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','params','kill','SIGINT'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x75ae,0xbe));var _0xe75a=function(_0x41b520,_0x3d63e6){_0x41b520=_0x41b520-0x0;var _0x226c6a=_0x75ae[_0x41b520];return _0x226c6a;};'use strict';var info=require(_0xe75a('0x0'));var exec=require(_0xe75a('0x1'))[_0xe75a('0x2')];var logger=require(_0xe75a('0x3'))('api');var util=require(_0xe75a('0x4'));var BPromise=require(_0xe75a('0x5'));var _=require(_0xe75a('0x6'));function handleError(_0x2a395f,_0x1a9e80,_0x87af17){_0x1a9e80=_0x1a9e80||0x1f4;return function(_0x486b93){logger['error'](_0xe75a('0x7'),_0x87af17,_0x1a9e80,util['inspect'](_0x486b93,{'showHidden':![],'depth':null}));delete _0x486b93[_0xe75a('0x8')];_0x2a395f[_0xe75a('0x9')](_0x1a9e80)[_0xe75a('0xa')](_0x486b93);};}exports[_0xe75a('0xb')]=function(_0x1123aa,_0x3940ee){return info[_0xe75a('0xc')]()[_0xe75a('0xd')](function(_0x533853){return _0x3940ee[_0xe75a('0x9')](0xc8)[_0xe75a('0xe')](_0x533853);})[_0xe75a('0xf')](function(_0x466285){return _0x3940ee['status'](0x1f4)[_0xe75a('0xe')](_0x466285);});};exports[_0xe75a('0x10')]=function(_0x3b5847,_0x317d5c){var _0x29f6e4=[_0xe75a('0x11')];return new BPromise(function(_0x36dd72,_0x24c90e){return exec(util[_0xe75a('0x12')](_0xe75a('0x13'),_0x3b5847['params'][_0xe75a('0x14')]),function(_0x1b7999,_0x2beebb,_0x3bfd44){if(_0x1b7999){return _0x24c90e(_0x1b7999);}return _0x36dd72(_0x2beebb);});})[_0xe75a('0xd')](function(_0x236e8a){var _0x765f8c=![];var _0x1977f7=_0x236e8a['split'](/\n/);for(var _0x2ecf57=0x0,_0x370a56=_0x29f6e4[_0xe75a('0x15')];_0x2ecf57<_0x370a56,_0x765f8c===![];_0x2ecf57+=0x1){if(_0x236e8a[_0xe75a('0x16')](_0x29f6e4[_0x2ecf57])>=0x0){_0x765f8c=!![];}}if(!_0x765f8c){throw new Error(util[_0xe75a('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3b5847[_0xe75a('0x17')][_0xe75a('0x14')]));}process[_0xe75a('0x18')](_0x3b5847[_0xe75a('0x17')]['pid'],_0xe75a('0x19'));return _0x317d5c[_0xe75a('0x9')](0xc8)['json']({'message':util[_0xe75a('0x12')](_0xe75a('0x1a'),_0x3b5847['params'][_0xe75a('0x14')])});})['catch'](handleError(_0x317d5c,null,_0xe75a('0x10')));}; \ No newline at end of file +var _0xb959=['api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger'];(function(_0x58c654,_0x56f774){var _0x1b1164=function(_0x4ed7db){while(--_0x4ed7db){_0x58c654['push'](_0x58c654['shift']());}};_0x1b1164(++_0x56f774);}(_0xb959,0x10a));var _0x9b95=function(_0x824bce,_0x4c06fb){_0x824bce=_0x824bce-0x0;var _0x5428d4=_0xb959[_0x824bce];return _0x5428d4;};'use strict';var info=require(_0x9b95('0x0'));var exec=require(_0x9b95('0x1'))[_0x9b95('0x2')];var logger=require(_0x9b95('0x3'))(_0x9b95('0x4'));var util=require(_0x9b95('0x5'));var BPromise=require('bluebird');var _=require(_0x9b95('0x6'));function handleError(_0x1ee7fe,_0x5d5342,_0x398657){_0x5d5342=_0x5d5342||0x1f4;return function(_0x3f0a8a){logger[_0x9b95('0x7')](_0x9b95('0x8'),_0x398657,_0x5d5342,util[_0x9b95('0x9')](_0x3f0a8a,{'showHidden':![],'depth':null}));delete _0x3f0a8a['name'];_0x1ee7fe[_0x9b95('0xa')](_0x5d5342)[_0x9b95('0xb')](_0x3f0a8a);};}exports[_0x9b95('0xc')]=function(_0x583a9b,_0x31ec29){return info[_0x9b95('0xd')]()['then'](function(_0x595927){return _0x31ec29['status'](0xc8)['json'](_0x595927);})['catch'](function(_0x4ab9f6){return _0x31ec29[_0x9b95('0xa')](0x1f4)[_0x9b95('0xe')](_0x4ab9f6);});};exports['killProcess']=function(_0x2525cb,_0x446d7c){var _0x50d3b8=['components/import/cm'];return new BPromise(function(_0x4eb23e,_0x48f829){return exec(util[_0x9b95('0xf')](_0x9b95('0x10'),_0x2525cb['params'][_0x9b95('0x11')]),function(_0x45d687,_0x34fc64,_0x272a8b){if(_0x45d687){return _0x48f829(_0x45d687);}return _0x4eb23e(_0x34fc64);});})[_0x9b95('0x12')](function(_0x9b4703){var _0x1b543c=![];var _0x5b5d21=_0x9b4703[_0x9b95('0x13')](/\n/);for(var _0x5ae634=0x0,_0x705842=_0x50d3b8[_0x9b95('0x14')];_0x5ae634<_0x705842,_0x1b543c===![];_0x5ae634+=0x1){if(_0x9b4703['indexOf'](_0x50d3b8[_0x5ae634])>=0x0){_0x1b543c=!![];}}if(!_0x1b543c){throw new Error(util['format'](_0x9b95('0x15'),_0x2525cb['params'][_0x9b95('0x11')]));}process['kill'](_0x2525cb[_0x9b95('0x16')]['pid'],_0x9b95('0x17'));return _0x446d7c[_0x9b95('0xa')](0xc8)[_0x9b95('0xe')]({'message':util[_0x9b95('0xf')](_0x9b95('0x18'),_0x2525cb['params'][_0x9b95('0x11')])});})[_0x9b95('0x19')](handleError(_0x446d7c,null,_0x9b95('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7089dbc..d990c66 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0xeb8e14,_0x42d558){var _0x53a5f9=function(_0x56aa19){while(--_0x56aa19){_0xeb8e14['push'](_0xeb8e14['shift']());}};_0x53a5f9(++_0x42d558);}(_0x5eb8,0xb0));var _0x85eb=function(_0x209f9c,_0x4ea385){_0x209f9c=_0x209f9c-0x0;var _0x13c1ef=_0x5eb8[_0x209f9c];return _0x13c1ef;};'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 _0x5087=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x92ba64,_0x4cefcb){var _0x176c7c=function(_0x55aed0){while(--_0x55aed0){_0x92ba64['push'](_0x92ba64['shift']());}};_0x176c7c(++_0x4cefcb);}(_0x5087,0x1da));var _0x7508=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x5087[_0x4e8286];return _0x44a440;};'use strict';var multer=require('multer');var util=require(_0x7508('0x0'));var path=require('path');var timeout=require(_0x7508('0x1'));var express=require(_0x7508('0x2'));var router=express[_0x7508('0x3')]();var fs_extra=require(_0x7508('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7508('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x7508('0x6')]('/',auth[_0x7508('0x7')](),controller[_0x7508('0x8')]);router[_0x7508('0x6')](_0x7508('0x9'),auth['isAuthenticated'](),controller[_0x7508('0xa')]);router['post']('/',auth[_0x7508('0x7')](),controller[_0x7508('0xb')]);router[_0x7508('0xc')](_0x7508('0x9'),auth[_0x7508('0x7')](),controller[_0x7508('0xd')]);router['delete'](_0x7508('0x9'),auth[_0x7508('0x7')](),controller[_0x7508('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ac95eec..d9818d0 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 _0xf767=['STRING','name','#0091EA'];(function(_0x2a6efc,_0x2f5a3d){var _0x1a7813=function(_0x47f993){while(--_0x47f993){_0x2a6efc['push'](_0x2a6efc['shift']());}};_0x1a7813(++_0x2f5a3d);}(_0xf767,0x183));var _0x7f76=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xf767[_0x56a871];return _0x124954;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7f76('0x0')],'unique':_0x7f76('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7f76('0x0')],'defaultValue':_0x7f76('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bc3=['exports','STRING','#0091EA','sequelize'];(function(_0x5d1d00,_0x3861d3){var _0x368b73=function(_0x1b78dd){while(--_0x1b78dd){_0x5d1d00['push'](_0x5d1d00['shift']());}};_0x368b73(++_0x3861d3);}(_0x9bc3,0x137));var _0x39bc=function(_0x386c0b,_0x25a98b){_0x386c0b=_0x386c0b-0x0;var _0x1ebc25=_0x9bc3[_0x386c0b];return _0x1ebc25;};'use strict';var Sequelize=require(_0x39bc('0x0'));module[_0x39bc('0x1')]={'name':{'type':Sequelize[_0x39bc('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x39bc('0x2')],'defaultValue':_0x39bc('0x3')},'description':{'type':Sequelize[_0x39bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index eac4303..a077915 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 _0xa25c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf'];(function(_0x223047,_0x42e882){var _0x52abcb=function(_0x37a4aa){while(--_0x37a4aa){_0x223047['push'](_0x223047['shift']());}};_0x52abcb(++_0x42e882);}(_0xa25c,0x13f));var _0xca25=function(_0x47d053,_0x3f081b){_0x47d053=_0x47d053-0x0;var _0x3c3e4e=_0xa25c[_0x47d053];return _0x3c3e4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){var _0x349364=_0x8cec43[_0xca25('0x24')]({'plain':!![]});var _0x20dc6d='Tags';return db[_0xca25('0x25')][_0xca25('0x23')]({'where':{'type':_0x20dc6d,'resourceId':_0x349364['id']}})[_0xca25('0x22')](function(){return _0x8cec43;});})[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274de1,_0x41eb3a){return function(_0x3d7414){if(!_0x3d7414){_0x274de1[_0xca25('0x26')](0x194);}return _0x3d7414;};}function handleError(_0x2ae0e3,_0x375112){_0x375112=_0x375112||0x1f4;return function(_0xfd888c){logger[_0xca25('0x27')](_0xfd888c[_0xca25('0x28')]);if(_0xfd888c[_0xca25('0x29')]){delete _0xfd888c[_0xca25('0x29')];}_0x2ae0e3[_0xca25('0x16')](_0x375112)[_0xca25('0x2a')](_0xfd888c);};}exports[_0xca25('0x2b')]=function(_0x455df1,_0x2433bb){var _0x14ad0f={},_0x333a43={},_0x478d30={'count':0x0,'rows':[]};var _0x2ecabe=_[_0xca25('0x2c')](db[_0xca25('0x2d')]['rawAttributes'],function(_0xe86982){return{'name':_0xe86982[_0xca25('0x2e')],'type':_0xe86982[_0xca25('0x2f')][_0xca25('0x30')]};});_0x333a43[_0xca25('0x31')]=_[_0xca25('0x2c')](_0x2ecabe,'name');_0x333a43[_0xca25('0x32')]=_['keys'](_0x455df1[_0xca25('0x32')]);_0x333a43[_0xca25('0x33')]=_[_0xca25('0x34')](_0x333a43['model'],_0x333a43[_0xca25('0x32')]);_0x14ad0f[_0xca25('0x35')]=_[_0xca25('0x34')](_0x333a43[_0xca25('0x31')],qs[_0xca25('0x36')](_0x455df1['query'][_0xca25('0x36')]));_0x14ad0f[_0xca25('0x35')]=_0x14ad0f[_0xca25('0x35')][_0xca25('0x37')]?_0x14ad0f[_0xca25('0x35')]:_0x333a43[_0xca25('0x31')];if(!_0x455df1[_0xca25('0x32')]['hasOwnProperty']('nolimit')){_0x14ad0f[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0x455df1['query']['limit']);_0x14ad0f[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0x455df1[_0xca25('0x32')]['offset']);}_0x14ad0f[_0xca25('0x38')]=qs[_0xca25('0x39')](_0x455df1[_0xca25('0x32')][_0xca25('0x39')]);_0x14ad0f[_0xca25('0x3a')]=qs[_0xca25('0x33')](_['pick'](_0x455df1[_0xca25('0x32')],_0x333a43['filters']),_0x2ecabe);if(_0x455df1[_0xca25('0x32')][_0xca25('0x3b')]){_0x14ad0f[_0xca25('0x3a')]=_[_0xca25('0x3c')](_0x14ad0f[_0xca25('0x3a')],{'$or':_[_0xca25('0x2c')](_0x2ecabe,function(_0x99ed21){if(_0x99ed21[_0xca25('0x2f')]!==_0xca25('0x3d')){var _0x513995={};_0x513995[_0x99ed21[_0xca25('0x29')]]={'$like':'%'+_0x455df1['query'][_0xca25('0x3b')]+'%'};return _0x513995;}})});}_0x14ad0f=_['merge']({},_0x14ad0f,_0x455df1[_0xca25('0x3e')]);var _0x184ed5={'where':_0x14ad0f[_0xca25('0x3a')]};return db[_0xca25('0x2d')]['count'](_0x184ed5)[_0xca25('0x22')](function(_0x5aafa5){_0x478d30[_0xca25('0x1b')]=_0x5aafa5;if(_0x455df1[_0xca25('0x32')]['includeAll']){_0x14ad0f[_0xca25('0x3f')]=[{'all':!![]}];}return db[_0xca25('0x2d')][_0xca25('0x40')](_0x14ad0f);})[_0xca25('0x22')](function(_0x1068c9){_0x478d30[_0xca25('0x41')]=_0x1068c9;return _0x478d30;})[_0xca25('0x22')](respondWithFilteredResult(_0x2433bb,_0x14ad0f))['catch'](handleError(_0x2433bb,null));};exports[_0xca25('0x42')]=function(_0x300e20,_0x57ed5f){var _0x5b1062={'raw':!![],'where':{'id':_0x300e20['params']['id']}},_0x487710={};_0x487710[_0xca25('0x31')]=_[_0xca25('0x43')](db[_0xca25('0x2d')][_0xca25('0x44')]);_0x487710['query']=_[_0xca25('0x43')](_0x300e20[_0xca25('0x32')]);_0x487710[_0xca25('0x33')]=_[_0xca25('0x34')](_0x487710['model'],_0x487710[_0xca25('0x32')]);_0x5b1062['attributes']=_[_0xca25('0x34')](_0x487710[_0xca25('0x31')],qs[_0xca25('0x36')](_0x300e20[_0xca25('0x32')][_0xca25('0x36')]));_0x5b1062[_0xca25('0x35')]=_0x5b1062['attributes'][_0xca25('0x37')]?_0x5b1062[_0xca25('0x35')]:_0x487710[_0xca25('0x31')];if(_0x300e20[_0xca25('0x32')][_0xca25('0x45')]){_0x5b1062[_0xca25('0x3f')]=[{'all':!![]}];}_0x5b1062=_[_0xca25('0x3c')]({},_0x5b1062,_0x300e20[_0xca25('0x3e')]);return db[_0xca25('0x2d')][_0xca25('0x46')](_0x5b1062)[_0xca25('0x22')](handleEntityNotFound(_0x57ed5f,null))[_0xca25('0x22')](respondWithResult(_0x57ed5f,null))[_0xca25('0x47')](handleError(_0x57ed5f,null));};exports[_0xca25('0x48')]=function(_0x3279e0,_0x1fba32){return db[_0xca25('0x2d')][_0xca25('0x48')](_0x3279e0['body'],{})[_0xca25('0x22')](function(_0x39d342){var _0x9fcba=_0x3279e0[_0xca25('0x49')]['get']({'plain':!![]});if(!_0x9fcba)throw new Error(_0xca25('0x4a'));if(_0x9fcba[_0xca25('0x4b')]==='user'){var _0x2bc528=_0x39d342[_0xca25('0x24')]({'plain':!![]});var _0x747387=_0xca25('0x4c');return db['UserProfileSection'][_0xca25('0x46')]({'where':{'name':_0x747387,'userProfileId':_0x9fcba['userProfileId']},'raw':!![]})[_0xca25('0x22')](function(_0x485252){if(_0x485252&&_0x485252['autoAssociation']===0x0){return db[_0xca25('0x25')][_0xca25('0x48')]({'name':_0x2bc528[_0xca25('0x29')],'resourceId':_0x2bc528['id'],'type':_0x485252[_0xca25('0x29')],'sectionId':_0x485252['id']},{})['then'](function(){return _0x39d342;});}else{return _0x39d342;}})['catch'](function(_0xfaf8f5){logger['error'](_0xca25('0x4d'),_0xfaf8f5);throw _0xfaf8f5;});}return _0x39d342;})[_0xca25('0x22')](respondWithResult(_0x1fba32,0xc9))[_0xca25('0x47')](handleError(_0x1fba32,null));};exports[_0xca25('0x21')]=function(_0x149dcd,_0x4d2f9c){if(_0x149dcd['body']['id']){delete _0x149dcd[_0xca25('0x4e')]['id'];}return db[_0xca25('0x2d')][_0xca25('0x46')]({'where':{'id':_0x149dcd[_0xca25('0x4f')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x4d2f9c,null))[_0xca25('0x22')](saveUpdates(_0x149dcd['body'],null))[_0xca25('0x22')](respondWithResult(_0x4d2f9c,null))[_0xca25('0x47')](handleError(_0x4d2f9c,null));};exports[_0xca25('0x23')]=function(_0xa4fec2,_0x86fc48){return db[_0xca25('0x2d')][_0xca25('0x46')]({'where':{'id':_0xa4fec2[_0xca25('0x4f')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x86fc48,null))['then'](removeEntity(_0x86fc48,null))[_0xca25('0x47')](handleError(_0x86fc48,null));}; \ No newline at end of file +var _0x24cd=['undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','Tag','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(_0x267fa4,_0x3d27b){var _0x398e4b=function(_0x24d94d){while(--_0x24d94d){_0x267fa4['push'](_0x267fa4['shift']());}};_0x398e4b(++_0x3d27b);}(_0x24cd,0x83));var _0xd24c=function(_0x136b55,_0x253950){_0x136b55=_0x136b55-0x0;var _0x3029cb=_0x24cd[_0x136b55];return _0x3029cb;};'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['Tag'][_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 diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4ca8f5e..cbe91a1 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 _0xbe08=['../../config/environment','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe08,0x121));var _0x8be0=function(_0x325454,_0x727d06){_0x325454=_0x325454-0x0;var _0xd8e1bf=_0xbe08[_0x325454];return _0xd8e1bf;};'use strict';var _=require('lodash');var util=require(_0x8be0('0x0'));var logger=require(_0x8be0('0x1'))(_0x8be0('0x2'));var moment=require(_0x8be0('0x3'));var BPromise=require(_0x8be0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be0('0x5'));var rimraf=require(_0x8be0('0x6'));var config=require(_0x8be0('0x7'));var attributes=require('./tag.attributes');module['exports']=function(_0x4cde1e,_0x57c4c){return _0x4cde1e['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff91=['request-promise','path','rimraf','define','tools_tags','util','../../config/logger','api','moment','bluebird'];(function(_0x3d7365,_0x13ccfb){var _0x3d96ac=function(_0x24135e){while(--_0x24135e){_0x3d7365['push'](_0x3d7365['shift']());}};_0x3d96ac(++_0x13ccfb);}(_0xff91,0x1d1));var _0x1ff9=function(_0xce08a3,_0x3999e4){_0xce08a3=_0xce08a3-0x0;var _0x53ccb6=_0xff91[_0xce08a3];return _0x53ccb6;};'use strict';var _=require('lodash');var util=require(_0x1ff9('0x0'));var logger=require(_0x1ff9('0x1'))(_0x1ff9('0x2'));var moment=require(_0x1ff9('0x3'));var BPromise=require(_0x1ff9('0x4'));var rp=require(_0x1ff9('0x5'));var fs=require('fs');var path=require(_0x1ff9('0x6'));var rimraf=require(_0x1ff9('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x3ce8b8,_0x371e6d){return _0x3ce8b8[_0x1ff9('0x8')]('Tag',attributes,{'tableName':_0x1ff9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b741b29..4c1d9d3 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 _0x29d4=['request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s'];(function(_0x5f14c0,_0x4312eb){var _0x32daee=function(_0x30519d){while(--_0x30519d){_0x5f14c0['push'](_0x5f14c0['shift']());}};_0x32daee(++_0x4312eb);}(_0x29d4,0x1a1));var _0x429d=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x29d4[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});} \ No newline at end of file +var _0x8664=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5a16fa,_0x118162){var _0x52ff17=function(_0x5813e1){while(--_0x5813e1){_0x5a16fa['push'](_0x5a16fa['shift']());}};_0x52ff17(++_0x118162);}(_0x8664,0x11a));var _0x4866=function(_0x1216ec,_0x5e7bc1){_0x1216ec=_0x1216ec-0x0;var _0x47fc29=_0x8664[_0x1216ec];return _0x47fc29;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var moment=require(_0x4866('0x2'));var BPromise=require(_0x4866('0x3'));var rs=require(_0x4866('0x4'));var fs=require('fs');var Redis=require(_0x4866('0x5'));var db=require(_0x4866('0x6'))['db'];var utils=require(_0x4866('0x7'));var logger=require(_0x4866('0x8'))('rpc');var config=require(_0x4866('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4866('0xa')][_0x4866('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439f55,_0x10f7c1,_0x2b4bb0){return new BPromise(function(_0x142f18,_0x4e07e3){return client[_0x4866('0xc')](_0x439f55,_0x2b4bb0)[_0x4866('0xd')](function(_0x10a369){logger[_0x4866('0xe')](_0x4866('0xf'),_0x10f7c1,'request\x20sent');logger[_0x4866('0x10')](_0x4866('0x11'),_0x10f7c1,'request\x20sent',JSON[_0x4866('0x12')](_0x10a369));if(_0x10a369[_0x4866('0x13')]){if(_0x10a369['error']['code']===0x1f4){logger['error'](_0x4866('0xf'),_0x10f7c1,_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);return _0x4e07e3(_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);}logger[_0x4866('0x13')]('Tag,\x20%s,\x20%s',_0x10f7c1,_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);return _0x142f18(_0x10a369['error'][_0x4866('0x14')]);}else{logger[_0x4866('0xe')](_0x4866('0xf'),_0x10f7c1,_0x4866('0x15'));_0x142f18(_0x10a369[_0x4866('0x16')][_0x4866('0x14')]);}})[_0x4866('0x17')](function(_0x653916){logger[_0x4866('0x13')]('Tag,\x20%s,\x20%s',_0x10f7c1,_0x653916);_0x4e07e3(_0x653916);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 53cea02..e61118f 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 4e3087e..8836315 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 _0xb7e7=['STRING','sequelize'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x23d0e8,_0x1f514e){var _0x55cb1e=function(_0x117055){while(--_0x117055){_0x23d0e8['push'](_0x23d0e8['shift']());}};_0x55cb1e(++_0x1f514e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb10b[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9fb5dd3..6d5e9f2 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 _0xb9f2=['update','transaction','sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','UserProfileResource','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','addQueues','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','penalty','get','QueueId','TeamVoiceQueue','findOrCreate','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','Mail','Queue:remove','getAgents','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','Team','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','findAll','show','params','fields','includeAll','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb9f2,0xe3));var _0x2b9f=function(_0x54ed8f,_0x53cdec){_0x54ed8f=_0x54ed8f-0x0;var _0x2557f0=_0xb9f2[_0x54ed8f];return _0x2557f0;};'use strict';var emlformat=require(_0x2b9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b9f('0x1'));var jsonpatch=require(_0x2b9f('0x2'));var rp=require(_0x2b9f('0x3'));var moment=require(_0x2b9f('0x4'));var BPromise=require(_0x2b9f('0x5'));var Mustache=require(_0x2b9f('0x6'));var util=require(_0x2b9f('0x7'));var path=require('path');var sox=require(_0x2b9f('0x8'));var csv=require(_0x2b9f('0x9'));var ejs=require(_0x2b9f('0xa'));var fs=require('fs');var fs_extra=require(_0x2b9f('0xb'));var _=require('lodash');var squel=require(_0x2b9f('0xc'));var crypto=require('crypto');var jsforce=require(_0x2b9f('0xd'));var deskjs=require(_0x2b9f('0xe'));var toCsv=require(_0x2b9f('0x9'));var querystring=require(_0x2b9f('0xf'));var Papa=require(_0x2b9f('0x10'));var Redis=require(_0x2b9f('0x11'));var authService=require(_0x2b9f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b9f('0x13'));var hardwareService=require(_0x2b9f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2b9f('0x15'));var config=require(_0x2b9f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b9f('0x17'))['db'];config['redis']=_[_0x2b9f('0x18')](config[_0x2b9f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b9f('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x2b9f('0x1b')](socket);function respondWithStatusCode(_0x4e6ffc,_0x4d1aaf){_0x4d1aaf=_0x4d1aaf||0xcc;return function(_0x4467a9){if(_0x4467a9){return _0x4e6ffc[_0x2b9f('0x1c')](_0x4d1aaf);}return _0x4e6ffc[_0x2b9f('0x1d')](_0x4d1aaf)[_0x2b9f('0x1e')]();};}function respondWithResult(_0x5b4432,_0x11a5a1){_0x11a5a1=_0x11a5a1||0xc8;return function(_0x1a9980){if(_0x1a9980){return _0x5b4432['status'](_0x11a5a1)[_0x2b9f('0x1f')](_0x1a9980);}};}function respondWithFilteredResult(_0x377c80,_0x5d68ca){return function(_0x4b48cc){if(_0x4b48cc){var _0x3108de=typeof _0x5d68ca[_0x2b9f('0x20')]===_0x2b9f('0x21')&&typeof _0x5d68ca['limit']===_0x2b9f('0x21');var _0x209abf=_0x4b48cc[_0x2b9f('0x22')];var _0x691687=_0x3108de?0x0:_0x5d68ca[_0x2b9f('0x20')];var _0x37e7d8=_0x3108de?_0x4b48cc[_0x2b9f('0x22')]:_0x5d68ca[_0x2b9f('0x20')]+_0x5d68ca[_0x2b9f('0x23')];var _0x4a668b;if(_0x37e7d8>=_0x209abf){_0x37e7d8=_0x209abf;_0x4a668b=0xc8;}else{_0x4a668b=0xce;}_0x377c80[_0x2b9f('0x1d')](_0x4a668b);return _0x377c80[_0x2b9f('0x24')](_0x2b9f('0x25'),_0x691687+'-'+_0x37e7d8+'/'+_0x209abf)[_0x2b9f('0x1f')](_0x4b48cc);}return null;};}function patchUpdates(_0x46be0b){return function(_0x52fa8b){try{jsonpatch[_0x2b9f('0x26')](_0x52fa8b,_0x46be0b,!![]);}catch(_0x41e47e){return BPromise[_0x2b9f('0x27')](_0x41e47e);}return _0x52fa8b[_0x2b9f('0x28')]();};}function saveUpdates(_0x13ea76,_0x5da862){return function(_0x3193e1){if(_0x3193e1){return _0x3193e1['update'](_0x13ea76)[_0x2b9f('0x29')](function(_0xa0eafa){return _0xa0eafa;});}return null;};}function handleEntityNotFound(_0x43e8fb,_0x540abb){return function(_0x4e43cc){if(!_0x4e43cc){_0x43e8fb[_0x2b9f('0x1c')](0x194);}return _0x4e43cc;};}function handleError(_0x2a0956,_0x2d0220){_0x2d0220=_0x2d0220||0x1f4;return function(_0x222535){logger[_0x2b9f('0x2a')](_0x222535[_0x2b9f('0x2b')]);if(_0x222535[_0x2b9f('0x2c')]){delete _0x222535[_0x2b9f('0x2c')];}_0x2a0956[_0x2b9f('0x1d')](_0x2d0220)[_0x2b9f('0x2d')](_0x222535);};}exports[_0x2b9f('0x2e')]=function(_0x2df57f,_0x212744){var _0x43dd32={},_0x1f42b5={},_0x59db15={'count':0x0,'rows':[]};var _0x2bf217=_['map'](db[_0x2b9f('0x2f')][_0x2b9f('0x30')],function(_0x35144b){return{'name':_0x35144b[_0x2b9f('0x31')],'type':_0x35144b[_0x2b9f('0x32')]['key']};});_0x1f42b5[_0x2b9f('0x33')]=_[_0x2b9f('0x34')](_0x2bf217,_0x2b9f('0x2c'));_0x1f42b5[_0x2b9f('0x35')]=_[_0x2b9f('0x36')](_0x2df57f[_0x2b9f('0x35')]);_0x1f42b5[_0x2b9f('0x37')]=_[_0x2b9f('0x38')](_0x1f42b5['model'],_0x1f42b5[_0x2b9f('0x35')]);_0x43dd32[_0x2b9f('0x39')]=_[_0x2b9f('0x38')](_0x1f42b5[_0x2b9f('0x33')],qs['fields'](_0x2df57f[_0x2b9f('0x35')]['fields']));_0x43dd32[_0x2b9f('0x39')]=_0x43dd32[_0x2b9f('0x39')][_0x2b9f('0x3a')]?_0x43dd32['attributes']:_0x1f42b5[_0x2b9f('0x33')];if(!_0x2df57f[_0x2b9f('0x35')][_0x2b9f('0x3b')](_0x2b9f('0x3c'))){_0x43dd32[_0x2b9f('0x23')]=qs['limit'](_0x2df57f[_0x2b9f('0x35')][_0x2b9f('0x23')]);_0x43dd32[_0x2b9f('0x20')]=qs[_0x2b9f('0x20')](_0x2df57f[_0x2b9f('0x35')][_0x2b9f('0x20')]);}_0x43dd32['order']=qs[_0x2b9f('0x3d')](_0x2df57f['query']['sort']);_0x43dd32[_0x2b9f('0x3e')]=qs[_0x2b9f('0x37')](_['pick'](_0x2df57f[_0x2b9f('0x35')],_0x1f42b5[_0x2b9f('0x37')]),_0x2bf217);if(_0x2df57f[_0x2b9f('0x35')][_0x2b9f('0x3f')]){_0x43dd32[_0x2b9f('0x3e')]=_['merge'](_0x43dd32[_0x2b9f('0x3e')],{'$or':_[_0x2b9f('0x34')](_0x2bf217,function(_0x794b2d){if(_0x794b2d[_0x2b9f('0x32')]!==_0x2b9f('0x40')){var _0x4547b4={};_0x4547b4[_0x794b2d['name']]={'$like':'%'+_0x2df57f[_0x2b9f('0x35')][_0x2b9f('0x3f')]+'%'};return _0x4547b4;}})});}_0x43dd32=_[_0x2b9f('0x41')]({},_0x43dd32,_0x2df57f['options']);var _0x2d86ac={'where':_0x43dd32['where']};return db[_0x2b9f('0x2f')][_0x2b9f('0x22')](_0x2d86ac)[_0x2b9f('0x29')](function(_0x3d19b4){_0x59db15[_0x2b9f('0x22')]=_0x3d19b4;if(_0x2df57f[_0x2b9f('0x35')]['includeAll']){_0x43dd32['include']=[{'all':!![]}];}return db[_0x2b9f('0x2f')][_0x2b9f('0x42')](_0x43dd32);})[_0x2b9f('0x29')](function(_0x3c7228){_0x59db15['rows']=_0x3c7228;return _0x59db15;})[_0x2b9f('0x29')](respondWithFilteredResult(_0x212744,_0x43dd32))['catch'](handleError(_0x212744,null));};exports[_0x2b9f('0x43')]=function(_0x57f484,_0xa18599){var _0x5ed359={'raw':![],'where':{'id':_0x57f484[_0x2b9f('0x44')]['id']}},_0x4dccad={};_0x4dccad[_0x2b9f('0x33')]=_['keys'](db[_0x2b9f('0x2f')]['rawAttributes']);_0x4dccad[_0x2b9f('0x35')]=_['keys'](_0x57f484['query']);_0x4dccad[_0x2b9f('0x37')]=_[_0x2b9f('0x38')](_0x4dccad[_0x2b9f('0x33')],_0x4dccad['query']);_0x5ed359[_0x2b9f('0x39')]=_['intersection'](_0x4dccad[_0x2b9f('0x33')],qs[_0x2b9f('0x45')](_0x57f484[_0x2b9f('0x35')]['fields']));_0x5ed359['attributes']=_0x5ed359[_0x2b9f('0x39')]['length']?_0x5ed359[_0x2b9f('0x39')]:_0x4dccad[_0x2b9f('0x33')];if(_0x57f484[_0x2b9f('0x35')][_0x2b9f('0x46')]){_0x5ed359[_0x2b9f('0x47')]=[{'all':!![]}];}_0x5ed359=_['merge']({},_0x5ed359,_0x57f484[_0x2b9f('0x48')]);return db['Team'][_0x2b9f('0x49')](_0x5ed359)[_0x2b9f('0x29')](handleEntityNotFound(_0xa18599,null))[_0x2b9f('0x29')](respondWithResult(_0xa18599,null))[_0x2b9f('0x4a')](handleError(_0xa18599,null));};exports[_0x2b9f('0x4b')]=function(_0x27824d,_0x863821){return db[_0x2b9f('0x2f')][_0x2b9f('0x4b')](_0x27824d[_0x2b9f('0x4c')],{})['then'](function(_0x38f62e){var _0xaa8cd1=_0x27824d[_0x2b9f('0x4d')]['get']({'plain':!![]});if(!_0xaa8cd1)throw new Error(_0x2b9f('0x4e'));if(_0xaa8cd1[_0x2b9f('0x4f')]===_0x2b9f('0x4d')){var _0x318a15=_0x38f62e['get']({'plain':!![]});var _0x55c43a=_0x2b9f('0x50');return db[_0x2b9f('0x51')][_0x2b9f('0x49')]({'where':{'name':_0x55c43a,'userProfileId':_0xaa8cd1['userProfileId']},'raw':!![]})['then'](function(_0x4dc55f){if(_0x4dc55f&&_0x4dc55f['autoAssociation']===0x0){return db['UserProfileResource'][_0x2b9f('0x4b')]({'name':_0x318a15[_0x2b9f('0x2c')],'resourceId':_0x318a15['id'],'type':_0x4dc55f[_0x2b9f('0x2c')],'sectionId':_0x4dc55f['id']},{})[_0x2b9f('0x29')](function(){return _0x38f62e;});}else{return _0x38f62e;}})[_0x2b9f('0x4a')](function(_0x158911){logger[_0x2b9f('0x2a')](_0x2b9f('0x52'),_0x158911);throw _0x158911;});}return _0x38f62e;})[_0x2b9f('0x29')](respondWithResult(_0x863821,0xc9))['catch'](handleError(_0x863821,null));};exports[_0x2b9f('0x53')]=function(_0x4629f9,_0x2b6e67){if(_0x4629f9['body']['id']){delete _0x4629f9[_0x2b9f('0x4c')]['id'];}return db[_0x2b9f('0x2f')][_0x2b9f('0x49')]({'where':{'id':_0x4629f9[_0x2b9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b6e67,null))[_0x2b9f('0x29')](saveUpdates(_0x4629f9[_0x2b9f('0x4c')],null))['then'](respondWithResult(_0x2b6e67,null))[_0x2b9f('0x4a')](handleError(_0x2b6e67,null));};exports['destroy']=function(_0x1f722b,_0x502f20){var _0x5d2d48=_0x1f722b[_0x2b9f('0x44')]['id'];var _0x2fd35a=[];return db['sequelize'][_0x2b9f('0x54')](function(_0x5dbdce){var _0x513a52='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5d2d48;return db[_0x2b9f('0x55')][_0x2b9f('0x35')](_0x513a52,{'type':db['Sequelize'][_0x2b9f('0x56')][_0x2b9f('0x57')],'raw':!![],'transaction':_0x5dbdce})[_0x2b9f('0x29')](function(_0x118d48){_0x2fd35a=_[_0x2b9f('0x34')](_0x118d48,function(_0x247414){return Number(_0x247414[_0x2b9f('0x58')]);});})[_0x2b9f('0x29')](function(){var _0x2cafec=_0x2b9f('0x59')+_0x5d2d48;return db[_0x2b9f('0x55')]['query'](_0x2cafec,{'type':db['Sequelize'][_0x2b9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x35e5fd){var _0x26ff05=_[_0x2b9f('0x34')](_0x35e5fd,function(_0x10a319){return Number(_0x10a319['VoiceQueueId']);});return db[_0x2b9f('0x5a')][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'VoiceQueueId':{'$in':_0x26ff05}},'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(){var _0x5a3645=_0x2b9f('0x5c')+_0x5d2d48;return db[_0x2b9f('0x55')]['query'](_0x5a3645,{'type':db[_0x2b9f('0x5d')][_0x2b9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x1b3424){var _0x35fb58=_[_0x2b9f('0x34')](_0x1b3424,function(_0x2df058){return Number(_0x2df058['MailQueueId']);});return db[_0x2b9f('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x2fd35a},'MailQueueId':{'$in':_0x35fb58}},'transaction':_0x5dbdce});})['then'](function(){var _0x29566a=_0x2b9f('0x5f')+_0x5d2d48;return db[_0x2b9f('0x55')][_0x2b9f('0x35')](_0x29566a,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x163bce){var _0x4a6a2d=_[_0x2b9f('0x34')](_0x163bce,function(_0x50bace){return Number(_0x50bace['SmsQueueId']);});return db[_0x2b9f('0x60')][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'SmsQueueId':{'$in':_0x4a6a2d}},'transaction':_0x5dbdce});})['then'](function(){var _0x830479=_0x2b9f('0x61')+_0x5d2d48;return db[_0x2b9f('0x55')][_0x2b9f('0x35')](_0x830479,{'type':db[_0x2b9f('0x5d')][_0x2b9f('0x56')][_0x2b9f('0x57')],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x5813f0){var _0x3e69fa=_['map'](_0x5813f0,function(_0x124b51){return Number(_0x124b51[_0x2b9f('0x62')]);});return db[_0x2b9f('0x63')][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'ChatQueueId':{'$in':_0x3e69fa}},'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(){var _0x56f45f=_0x2b9f('0x64')+_0x5d2d48;return db['sequelize'][_0x2b9f('0x35')](_0x56f45f,{'type':db[_0x2b9f('0x5d')][_0x2b9f('0x56')][_0x2b9f('0x57')],'raw':!![],'transaction':_0x5dbdce});})['then'](function(_0x2017fd){var _0x7dd47b=_[_0x2b9f('0x34')](_0x2017fd,function(_0x1244b4){return Number(_0x1244b4[_0x2b9f('0x65')]);});return db['UserFaxQueue'][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'FaxQueueId':{'$in':_0x7dd47b}},'transaction':_0x5dbdce});})['then'](function(){var _0x26c6ac=_0x2b9f('0x66')+_0x5d2d48;return db['sequelize'][_0x2b9f('0x35')](_0x26c6ac,{'type':db[_0x2b9f('0x5d')][_0x2b9f('0x56')]['SELECT'],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x3821f6){var _0x83deac=_[_0x2b9f('0x34')](_0x3821f6,function(_0x238578){return Number(_0x238578['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'OpenchannelQueueId':{'$in':_0x83deac}},'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(){var _0x433b6f='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5d2d48;return db[_0x2b9f('0x55')][_0x2b9f('0x35')](_0x433b6f,{'type':db[_0x2b9f('0x5d')][_0x2b9f('0x56')][_0x2b9f('0x57')],'raw':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x420954){var _0x6c71ba=_['map'](_0x420954,function(_0x4ed38d){return Number(_0x4ed38d[_0x2b9f('0x67')]);});return db[_0x2b9f('0x68')][_0x2b9f('0x5b')]({'where':{'UserId':{'$in':_0x2fd35a},'WhatsappQueueId':{'$in':_0x6c71ba}},'transaction':_0x5dbdce});})['then'](function(){return db[_0x2b9f('0x69')][_0x2b9f('0x49')]({'where':{'TeamId':_0x5d2d48}});})[_0x2b9f('0x29')](function(_0x3dfa52){if(_0x3dfa52===null){return;}return db[_0x2b9f('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x2fd35a},'VoicePrefixId':_0x3dfa52['VoicePrefixId']},'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(){return db[_0x2b9f('0x2f')][_0x2b9f('0x5b')]({'where':{'id':_0x5d2d48},'cascade':!![],'transaction':_0x5dbdce});})[_0x2b9f('0x29')](function(_0x318f70){if(_0x318f70===0x0){_0x502f20[_0x2b9f('0x1c')](0x194);}else{return db[_0x2b9f('0x6b')][_0x2b9f('0x5b')]({'where':{'type':_0x2b9f('0x50'),'resourceId':_0x5d2d48},'cascade':!![],'transaction':_0x5dbdce})[_0x2b9f('0x29')](function(){_0x502f20[_0x2b9f('0x1d')](0xcc)[_0x2b9f('0x1e')]();});}})[_0x2b9f('0x4a')](function(_0x479d73){_0x502f20[_0x2b9f('0x1d')](0x1f4)[_0x2b9f('0x2d')](_0x479d73);});});};exports[_0x2b9f('0x6c')]=function(_0x57fbb4,_0x11dc8d,_0x3a15b8){return db[_0x2b9f('0x2f')][_0x2b9f('0x6d')]({'where':{'id':_0x57fbb4[_0x2b9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x11dc8d,null))[_0x2b9f('0x29')](function(_0x1d4cc1){if(!_0x57fbb4[_0x2b9f('0x35')]['channel']||!utils[_0x2b9f('0x6e')](_0x57fbb4[_0x2b9f('0x35')][_0x2b9f('0x6f')])){throw new db[(_0x2b9f('0x5d'))][(_0x2b9f('0x70'))](_0x2b9f('0x71'));}var _0x142464={};var _0x23a032={};_0x23a032[_0x2b9f('0x33')]=_['keys'](db[_[_0x2b9f('0x72')](_0x57fbb4[_0x2b9f('0x35')][_0x2b9f('0x6f')][_0x2b9f('0x73')]())+_0x2b9f('0x74')][_0x2b9f('0x30')]);_0x23a032[_0x2b9f('0x35')]=_[_0x2b9f('0x36')](_0x57fbb4[_0x2b9f('0x35')]);_0x23a032['filters']=_[_0x2b9f('0x38')](_0x23a032[_0x2b9f('0x33')],_0x23a032['query']);_0x142464[_0x2b9f('0x39')]=_[_0x2b9f('0x38')](_0x23a032['model'],qs['fields'](_0x57fbb4[_0x2b9f('0x35')][_0x2b9f('0x45')]));_0x142464[_0x2b9f('0x39')]=_0x142464[_0x2b9f('0x39')][_0x2b9f('0x3a')]?_0x142464[_0x2b9f('0x39')]:_0x23a032['model'];_0x142464['limit']=qs[_0x2b9f('0x23')](_0x57fbb4[_0x2b9f('0x35')][_0x2b9f('0x23')]);_0x142464['offset']=qs[_0x2b9f('0x20')](_0x57fbb4[_0x2b9f('0x35')][_0x2b9f('0x20')]);_0x142464[_0x2b9f('0x75')]=qs[_0x2b9f('0x3d')](_0x57fbb4['query']['sort']);_0x142464[_0x2b9f('0x3e')]=qs[_0x2b9f('0x37')](_['pick'](_0x57fbb4[_0x2b9f('0x35')],_0x23a032['filters']));_0x142464=_[_0x2b9f('0x41')]({},_0x142464,_0x57fbb4[_0x2b9f('0x48')]);return _0x1d4cc1['get'+_[_0x2b9f('0x72')](_0x57fbb4['query'][_0x2b9f('0x6f')][_0x2b9f('0x73')]())+'Queues'](_0x142464);})['then'](respondWithResult(_0x11dc8d,null))[_0x2b9f('0x4a')](handleError(_0x11dc8d,null));};exports[_0x2b9f('0x76')]=function(_0x10e6d0,_0xad1b55,_0x5b302d){return db[_0x2b9f('0x2f')][_0x2b9f('0x6d')]({'where':{'id':_0x10e6d0['params']['id']}})[_0x2b9f('0x29')](function(_0x49487a){if(_0x49487a){if(!_0x10e6d0['body'][_0x2b9f('0x6f')]||!utils[_0x2b9f('0x6e')](_0x10e6d0[_0x2b9f('0x4c')][_0x2b9f('0x6f')])){throw new db[(_0x2b9f('0x5d'))]['ValidationError'](_0x2b9f('0x71'));}return _0x49487a[_0x2b9f('0x77')+_['capitalize'](_0x10e6d0['body'][_0x2b9f('0x6f')][_0x2b9f('0x73')]())+_0x2b9f('0x78')](_0x10e6d0[_0x2b9f('0x4c')][_0x2b9f('0x79')]);}return null;})[_0x2b9f('0x29')](handleEntityNotFound(_0xad1b55,null))[_0x2b9f('0x29')](respondWithStatusCode(_0xad1b55,null))[_0x2b9f('0x4a')](handleError(_0xad1b55,null));};exports[_0x2b9f('0x7a')]=function(_0x154a9c,_0x42fb18,_0x39fe88){return db['Team']['findOne']({'where':{'id':_0x154a9c[_0x2b9f('0x44')]['id']}})[_0x2b9f('0x29')](function(_0x460945){if(_0x460945){if(!_0x154a9c['query'][_0x2b9f('0x6f')]||!utils[_0x2b9f('0x6e')](_0x154a9c[_0x2b9f('0x35')][_0x2b9f('0x6f')])){throw new db[(_0x2b9f('0x5d'))][(_0x2b9f('0x70'))](_0x2b9f('0x71'));}return _0x460945[_0x2b9f('0x7b')+_[_0x2b9f('0x72')](_0x154a9c[_0x2b9f('0x35')][_0x2b9f('0x6f')][_0x2b9f('0x73')]())+_0x2b9f('0x78')](_0x154a9c['query'][_0x2b9f('0x79')]);}return null;})[_0x2b9f('0x29')](handleEntityNotFound(_0x42fb18,null))['then'](respondWithStatusCode(_0x42fb18,null))[_0x2b9f('0x4a')](handleError(_0x42fb18,null));};exports[_0x2b9f('0x7c')]=function(_0x1f6a6f,_0x23bb61){var _0x4de8ce=_[_0x2b9f('0x7d')](_0x1f6a6f['body'][_0x2b9f('0x79')])?_0x1f6a6f[_0x2b9f('0x4c')][_0x2b9f('0x79')]:[_0x1f6a6f[_0x2b9f('0x4c')]['ids']];var _0x2f1dfd=_0x1f6a6f['params']['id'];return db[_0x2b9f('0x2f')]['find']({'where':{'id':_0x2f1dfd}})[_0x2b9f('0x29')](handleEntityNotFound(_0x23bb61,null))[_0x2b9f('0x29')](function(_0xbba3c0){if(_0xbba3c0){var _0x300289=[_0x2b9f('0x7e'),_0x2b9f('0x7f'),'Mail',_0x2b9f('0x80'),_0x2b9f('0x81'),_0x2b9f('0x82'),_0x2b9f('0x83')];return db[_0x2b9f('0x55')][_0x2b9f('0x54')](function(_0x5c2a61){var _0x11d2c3=_['map'](_0x300289,function(_0x4025c3){var _0x3cb92f={'attributes':['id',_0x2b9f('0x2c')]};if(_0x4025c3===_0x2b9f('0x7e')){_0x3cb92f[_0x2b9f('0x84')]={'attributes':[_0x2b9f('0x85')]};}return _0xbba3c0[_0x2b9f('0x86')+_0x4025c3+_0x2b9f('0x78')](_0x3cb92f)[_0x2b9f('0x29')](function(_0x78320a){var _0x2b85a9=_['map'](_0x78320a,function(_0x36db12){var _0x214685=_['map'](_0x4de8ce,function(_0x13043f){var _0x46d6cf={'where':{'UserId':_0x13043f,[_0x4025c3+_0x2b9f('0x87')]:_0x36db12['id']},'transaction':_0x5c2a61};if(_0x4025c3===_0x2b9f('0x7e')){_0x46d6cf[_0x2b9f('0x18')]={'penalty':_0x36db12[_0x2b9f('0x88')][_0x2b9f('0x85')]};}return db['User'+_0x4025c3+_0x2b9f('0x74')][_0x2b9f('0x89')](_0x46d6cf)[_0x2b9f('0x29')](function(){socket['emit'](_0x2b9f('0x4d')+_0x4025c3+'Queue:save',{'UserId':_0x13043f,[_0x4025c3+'QueueId']:_0x36db12['id']});if(_0x4025c3!=='Voice'){return;}return db[_0x2b9f('0x8a')][_0x2b9f('0x42')]({'where':{'id':_0x4de8ce,'online':0x1},'attributes':['id','name',_0x2b9f('0x8b'),_0x2b9f('0x8c'),'interface'],'raw':!![]})[_0x2b9f('0x29')](function(_0x572209){var _0x54c48c=_[_0x2b9f('0x34')](_0x572209,function(_0x27d278){return db[_0x2b9f('0x8d')][_0x2b9f('0x8e')]({'membername':_0x27d278[_0x2b9f('0x2c')],'UserId':_0x27d278['id'],'queue_name':_0x36db12[_0x2b9f('0x2c')],'VoiceQueueId':_0x36db12['id'],'interface':_[_0x2b9f('0x8f')](_0x27d278[_0x2b9f('0x90')])?util[_0x2b9f('0x91')](_0x2b9f('0x92'),_0x27d278[_0x2b9f('0x2c')]):_0x27d278['interface'],'paused':_0x27d278[_0x2b9f('0x8c')]||![],'penalty':_0x36db12[_0x2b9f('0x88')][_0x2b9f('0x85')]},{'transaction':_0x5c2a61});});return Promise[_0x2b9f('0x93')](_0x54c48c);});});});return Promise[_0x2b9f('0x93')](_0x214685);});return Promise[_0x2b9f('0x93')](_0x2b85a9);})[_0x2b9f('0x29')](function(){return db[_0x2b9f('0x69')][_0x2b9f('0x6d')]({'where':{'teamId':_0x2f1dfd}})['then'](function(_0x2d924c){if(_0x2d924c){var _0x2e10d1=_['map'](_0x4de8ce,function(_0xf43892){db[_0x2b9f('0x6a')][_0x2b9f('0x8e')]({'UserId':_0xf43892,'VoicePrefixId':_0x2d924c[_0x2b9f('0x94')]});});return Promise[_0x2b9f('0x93')](_0x2e10d1);}});});});return Promise['all'](_0x11d2c3)[_0x2b9f('0x29')](function(){return _0xbba3c0[_0x2b9f('0x7c')](_0x4de8ce,{'transaction':_0x5c2a61})[_0x2b9f('0x95')](function(_0x5b0fa6){return _0x5b0fa6;});});});}})[_0x2b9f('0x29')](respondWithResult(_0x23bb61,null))[_0x2b9f('0x4a')](handleError(_0x23bb61,null));};exports[_0x2b9f('0x96')]=function(_0x468ce8,_0x470175){var _0x84d5e2=_['isArray'](_0x468ce8[_0x2b9f('0x35')][_0x2b9f('0x79')])?_0x468ce8[_0x2b9f('0x35')][_0x2b9f('0x79')]:[_0x468ce8['query']['ids']];var _0x5678f1=_0x468ce8['params']['id'];return db[_0x2b9f('0x2f')][_0x2b9f('0x49')]({'where':{'id':_0x5678f1}})[_0x2b9f('0x29')](handleEntityNotFound(_0x470175,null))[_0x2b9f('0x29')](function(_0x17ef56){if(_0x17ef56){var _0x567df5=[_0x2b9f('0x7e'),_0x2b9f('0x7f'),_0x2b9f('0x97'),_0x2b9f('0x80'),_0x2b9f('0x81'),_0x2b9f('0x82'),'Whatsapp'];return db[_0x2b9f('0x55')][_0x2b9f('0x54')](function(_0x2f9e30){var _0x3da280=_[_0x2b9f('0x34')](_0x567df5,function(_0x3e5975){var _0x1db471={'attributes':['id',_0x2b9f('0x2c')]};return _0x17ef56['get'+_0x3e5975+_0x2b9f('0x78')](_0x1db471)[_0x2b9f('0x29')](function(_0x40cbce){var _0xf804c5=_[_0x2b9f('0x34')](_0x40cbce,function(_0x1875a3){return _0x1875a3['removeAgents'](_0x84d5e2,{'transaction':_0x2f9e30})['then'](function(){var _0x410fd8=_[_0x2b9f('0x34')](_0x84d5e2,function(_0x1d34ec){socket['emit'](_0x2b9f('0x4d')+_0x3e5975+_0x2b9f('0x98'),{'UserId':Number(_0x1d34ec),[_0x3e5975+_0x2b9f('0x87')]:_0x1875a3['id']});if(_0x3e5975!=='Voice'){return;}return db[_0x2b9f('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x1875a3['id'],'UserId':_0x1d34ec},'transaction':_0x2f9e30});});return Promise[_0x2b9f('0x93')](_0x410fd8);});});return Promise[_0x2b9f('0x93')](_0xf804c5);});});return Promise[_0x2b9f('0x93')](_0x3da280)['then'](function(){return _0x17ef56[_0x2b9f('0x96')](_0x84d5e2,{'transaction':_0x2f9e30});})['then'](function(){return db[_0x2b9f('0x69')][_0x2b9f('0x6d')]({'where':{'teamId':_0x5678f1}})[_0x2b9f('0x29')](function(_0x422644){if(_0x422644){var _0x10727c=_['map'](_0x84d5e2,function(_0x2f73a6){db['UserVoicePrefix'][_0x2b9f('0x5b')]({'where':{'UserId':_0x2f73a6,'VoicePrefixId':_0x422644[_0x2b9f('0x94')]}});});return Promise[_0x2b9f('0x93')](_0x10727c);}});});});}})[_0x2b9f('0x29')](respondWithStatusCode(_0x470175,null))[_0x2b9f('0x4a')](handleError(_0x470175,null));};exports[_0x2b9f('0x99')]=function(_0x3f7cc3,_0x432376,_0x2b40dd){var _0x1b04af={};var _0xbe2353={};var _0x19a9f6;var _0x39855f;return db[_0x2b9f('0x2f')][_0x2b9f('0x6d')]({'where':{'id':_0x3f7cc3[_0x2b9f('0x44')]['id']}})[_0x2b9f('0x29')](handleEntityNotFound(_0x432376,null))[_0x2b9f('0x29')](function(_0x1624e0){if(_0x1624e0){_0x19a9f6=_0x1624e0;_0xbe2353[_0x2b9f('0x33')]=_['keys'](db['User'][_0x2b9f('0x30')]);_0xbe2353[_0x2b9f('0x35')]=_[_0x2b9f('0x36')](_0x3f7cc3[_0x2b9f('0x35')]);_0xbe2353[_0x2b9f('0x37')]=_[_0x2b9f('0x38')](_0xbe2353[_0x2b9f('0x33')],_0xbe2353['query']);_0x1b04af[_0x2b9f('0x39')]=_[_0x2b9f('0x38')](_0xbe2353[_0x2b9f('0x33')],qs['fields'](_0x3f7cc3[_0x2b9f('0x35')][_0x2b9f('0x45')]));_0x1b04af['attributes']=_0x1b04af[_0x2b9f('0x39')][_0x2b9f('0x3a')]?_0x1b04af[_0x2b9f('0x39')]:_0xbe2353[_0x2b9f('0x33')];_0x1b04af[_0x2b9f('0x75')]=qs[_0x2b9f('0x3d')](_0x3f7cc3[_0x2b9f('0x35')][_0x2b9f('0x3d')]);_0x1b04af[_0x2b9f('0x3e')]=qs[_0x2b9f('0x37')](_[_0x2b9f('0x9a')](_0x3f7cc3['query'],_0xbe2353[_0x2b9f('0x37')]));if(_0x3f7cc3[_0x2b9f('0x35')][_0x2b9f('0x3f')]){_0x1b04af[_0x2b9f('0x3e')]=_[_0x2b9f('0x41')](_0x1b04af['where'],{'$or':_[_0x2b9f('0x34')](_0x1b04af['attributes'],function(_0x44cedc){var _0x1e332a={};_0x1e332a[_0x44cedc]={'$like':'%'+_0x3f7cc3['query']['filter']+'%'};return _0x1e332a;})});}_0x1b04af=_[_0x2b9f('0x41')]({},_0x1b04af,_0x3f7cc3['options']);return _0x19a9f6[_0x2b9f('0x99')](_0x1b04af);}})[_0x2b9f('0x29')](function(_0x4c2ea7){if(_0x4c2ea7){_0x39855f=_0x4c2ea7[_0x2b9f('0x3a')];if(!_0x3f7cc3[_0x2b9f('0x35')][_0x2b9f('0x3b')](_0x2b9f('0x3c'))){_0x1b04af[_0x2b9f('0x23')]=qs['limit'](_0x3f7cc3[_0x2b9f('0x35')][_0x2b9f('0x23')]);_0x1b04af[_0x2b9f('0x20')]=qs[_0x2b9f('0x20')](_0x3f7cc3[_0x2b9f('0x35')]['offset']);}return _0x19a9f6[_0x2b9f('0x99')](_0x1b04af);}})[_0x2b9f('0x29')](function(_0x2c1aba){if(_0x2c1aba){return _0x2c1aba?{'count':_0x39855f,'rows':_0x2c1aba}:null;}})[_0x2b9f('0x29')](respondWithResult(_0x432376,null))[_0x2b9f('0x4a')](handleError(_0x432376,null));}; \ No newline at end of file +var _0xfd47=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','then','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','sequelize','Sequelize','QueryTypes','VoiceQueueId','MailQueueId','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','OpenchannelQueueId','UserOpenchannelQueue','TeamVoicePrefix','VoicePrefixId','Teams','getQueues','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','options','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','transaction','through','QueueId','TeamVoiceQueue','penalty','User','Queue','emit','Queue:save','online','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','UserVoicePrefix','spread','removeAgents','Queue:remove','pick','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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'];(function(_0x31a68a,_0x366537){var _0x2c9995=function(_0x1c1c61){while(--_0x1c1c61){_0x31a68a['push'](_0x31a68a['shift']());}};_0x2c9995(++_0x366537);}(_0xfd47,0x1bd));var _0x7fd4=function(_0x314fa8,_0x1ff327){_0x314fa8=_0x314fa8-0x0;var _0x1c68bb=_0xfd47[_0x314fa8];return _0x1c68bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fd4('0x0'));var jsonpatch=require(_0x7fd4('0x1'));var rp=require(_0x7fd4('0x2'));var moment=require('moment');var BPromise=require(_0x7fd4('0x3'));var Mustache=require(_0x7fd4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7fd4('0x5'));var csv=require(_0x7fd4('0x6'));var ejs=require(_0x7fd4('0x7'));var fs=require('fs');var fs_extra=require(_0x7fd4('0x8'));var _=require('lodash');var squel=require(_0x7fd4('0x9'));var crypto=require(_0x7fd4('0xa'));var jsforce=require(_0x7fd4('0xb'));var deskjs=require(_0x7fd4('0xc'));var toCsv=require(_0x7fd4('0x6'));var querystring=require(_0x7fd4('0xd'));var Papa=require(_0x7fd4('0xe'));var Redis=require(_0x7fd4('0xf'));var authService=require(_0x7fd4('0x10'));var qs=require(_0x7fd4('0x11'));var as=require(_0x7fd4('0x12'));var hardwareService=require(_0x7fd4('0x13'));var logger=require(_0x7fd4('0x14'))(_0x7fd4('0x15'));var utils=require('../../config/utils');var config=require(_0x7fd4('0x16'));var licenseUtil=require(_0x7fd4('0x17'));var db=require(_0x7fd4('0x18'))['db'];config['redis']=_[_0x7fd4('0x19')](config[_0x7fd4('0x1a')],{'host':_0x7fd4('0x1b'),'port':0x18eb});var socket=require(_0x7fd4('0x1c'))(new Redis(config[_0x7fd4('0x1a')]));require('./team.socket')[_0x7fd4('0x1d')](socket);function respondWithStatusCode(_0x55f038,_0x5f446d){_0x5f446d=_0x5f446d||0xcc;return function(_0x3be6a){if(_0x3be6a){return _0x55f038[_0x7fd4('0x1e')](_0x5f446d);}return _0x55f038[_0x7fd4('0x1f')](_0x5f446d)[_0x7fd4('0x20')]();};}function respondWithResult(_0x1ee29e,_0x1ea4d6){_0x1ea4d6=_0x1ea4d6||0xc8;return function(_0x1f6c0b){if(_0x1f6c0b){return _0x1ee29e[_0x7fd4('0x1f')](_0x1ea4d6)[_0x7fd4('0x21')](_0x1f6c0b);}};}function respondWithFilteredResult(_0xbc17c,_0x48aad4){return function(_0x260c9a){if(_0x260c9a){var _0x45cf2f=typeof _0x48aad4['offset']===_0x7fd4('0x22')&&typeof _0x48aad4[_0x7fd4('0x23')]===_0x7fd4('0x22');var _0x1c67e0=_0x260c9a['count'];var _0x5559f6=_0x45cf2f?0x0:_0x48aad4[_0x7fd4('0x24')];var _0x1d000d=_0x45cf2f?_0x260c9a['count']:_0x48aad4[_0x7fd4('0x24')]+_0x48aad4[_0x7fd4('0x23')];var _0x79312d;if(_0x1d000d>=_0x1c67e0){_0x1d000d=_0x1c67e0;_0x79312d=0xc8;}else{_0x79312d=0xce;}_0xbc17c[_0x7fd4('0x1f')](_0x79312d);return _0xbc17c[_0x7fd4('0x25')](_0x7fd4('0x26'),_0x5559f6+'-'+_0x1d000d+'/'+_0x1c67e0)['json'](_0x260c9a);}return null;};}function patchUpdates(_0x5b659c){return function(_0x208d0f){try{jsonpatch[_0x7fd4('0x27')](_0x208d0f,_0x5b659c,!![]);}catch(_0x5ca14b){return BPromise[_0x7fd4('0x28')](_0x5ca14b);}return _0x208d0f[_0x7fd4('0x29')]();};}function saveUpdates(_0x445a13,_0x4adb6e){return function(_0x1ba75e){if(_0x1ba75e){return _0x1ba75e[_0x7fd4('0x2a')](_0x445a13)['then'](function(_0x5872bb){return _0x5872bb;});}return null;};}function handleEntityNotFound(_0x4841ba,_0x26dd99){return function(_0x556a54){if(!_0x556a54){_0x4841ba[_0x7fd4('0x1e')](0x194);}return _0x556a54;};}function handleError(_0x4475fd,_0x1423c5){_0x1423c5=_0x1423c5||0x1f4;return function(_0x11986c){logger['error'](_0x11986c[_0x7fd4('0x2b')]);if(_0x11986c['name']){delete _0x11986c[_0x7fd4('0x2c')];}_0x4475fd[_0x7fd4('0x1f')](_0x1423c5)[_0x7fd4('0x2d')](_0x11986c);};}exports['index']=function(_0x158bbf,_0x321d9e){var _0x4972ef={},_0x3a9901={},_0x3b1a80={'count':0x0,'rows':[]};var _0x137333=_['map'](db[_0x7fd4('0x2e')][_0x7fd4('0x2f')],function(_0x5794dd){return{'name':_0x5794dd[_0x7fd4('0x30')],'type':_0x5794dd[_0x7fd4('0x31')][_0x7fd4('0x32')]};});_0x3a9901[_0x7fd4('0x33')]=_[_0x7fd4('0x34')](_0x137333,_0x7fd4('0x2c'));_0x3a9901['query']=_[_0x7fd4('0x35')](_0x158bbf[_0x7fd4('0x36')]);_0x3a9901['filters']=_[_0x7fd4('0x37')](_0x3a9901[_0x7fd4('0x33')],_0x3a9901[_0x7fd4('0x36')]);_0x4972ef['attributes']=_[_0x7fd4('0x37')](_0x3a9901['model'],qs['fields'](_0x158bbf['query']['fields']));_0x4972ef[_0x7fd4('0x38')]=_0x4972ef[_0x7fd4('0x38')][_0x7fd4('0x39')]?_0x4972ef[_0x7fd4('0x38')]:_0x3a9901[_0x7fd4('0x33')];if(!_0x158bbf['query'][_0x7fd4('0x3a')](_0x7fd4('0x3b'))){_0x4972ef[_0x7fd4('0x23')]=qs['limit'](_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x23')]);_0x4972ef['offset']=qs[_0x7fd4('0x24')](_0x158bbf['query'][_0x7fd4('0x24')]);}_0x4972ef[_0x7fd4('0x3c')]=qs[_0x7fd4('0x3d')](_0x158bbf['query']['sort']);_0x4972ef[_0x7fd4('0x3e')]=qs['filters'](_['pick'](_0x158bbf['query'],_0x3a9901[_0x7fd4('0x3f')]),_0x137333);if(_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x40')]){_0x4972ef[_0x7fd4('0x3e')]=_[_0x7fd4('0x41')](_0x4972ef[_0x7fd4('0x3e')],{'$or':_[_0x7fd4('0x34')](_0x137333,function(_0x39fb77){if(_0x39fb77[_0x7fd4('0x31')]!==_0x7fd4('0x42')){var _0x439b48={};_0x439b48[_0x39fb77['name']]={'$like':'%'+_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x40')]+'%'};return _0x439b48;}})});}_0x4972ef=_['merge']({},_0x4972ef,_0x158bbf['options']);var _0x251320={'where':_0x4972ef[_0x7fd4('0x3e')]};return db['Team']['count'](_0x251320)[_0x7fd4('0x43')](function(_0x2914df){_0x3b1a80[_0x7fd4('0x44')]=_0x2914df;if(_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x45')]){_0x4972ef[_0x7fd4('0x46')]=[{'all':!![]}];}return db[_0x7fd4('0x2e')][_0x7fd4('0x47')](_0x4972ef);})[_0x7fd4('0x43')](function(_0x4d7b50){_0x3b1a80[_0x7fd4('0x48')]=_0x4d7b50;return _0x3b1a80;})[_0x7fd4('0x43')](respondWithFilteredResult(_0x321d9e,_0x4972ef))[_0x7fd4('0x49')](handleError(_0x321d9e,null));};exports[_0x7fd4('0x4a')]=function(_0x1b89d5,_0x2561b2){var _0x3339c7={'raw':![],'where':{'id':_0x1b89d5[_0x7fd4('0x4b')]['id']}},_0x462228={};_0x462228[_0x7fd4('0x33')]=_[_0x7fd4('0x35')](db[_0x7fd4('0x2e')]['rawAttributes']);_0x462228[_0x7fd4('0x36')]=_['keys'](_0x1b89d5[_0x7fd4('0x36')]);_0x462228[_0x7fd4('0x3f')]=_['intersection'](_0x462228['model'],_0x462228[_0x7fd4('0x36')]);_0x3339c7[_0x7fd4('0x38')]=_[_0x7fd4('0x37')](_0x462228[_0x7fd4('0x33')],qs[_0x7fd4('0x4c')](_0x1b89d5[_0x7fd4('0x36')][_0x7fd4('0x4c')]));_0x3339c7[_0x7fd4('0x38')]=_0x3339c7['attributes']['length']?_0x3339c7['attributes']:_0x462228['model'];if(_0x1b89d5[_0x7fd4('0x36')][_0x7fd4('0x45')]){_0x3339c7[_0x7fd4('0x46')]=[{'all':!![]}];}_0x3339c7=_[_0x7fd4('0x41')]({},_0x3339c7,_0x1b89d5['options']);return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')](_0x3339c7)[_0x7fd4('0x43')](handleEntityNotFound(_0x2561b2,null))['then'](respondWithResult(_0x2561b2,null))[_0x7fd4('0x49')](handleError(_0x2561b2,null));};exports['create']=function(_0x222b57,_0x4150b2){return db[_0x7fd4('0x2e')][_0x7fd4('0x4e')](_0x222b57['body'],{})[_0x7fd4('0x43')](function(_0x256349){var _0x49a30c=_0x222b57[_0x7fd4('0x4f')][_0x7fd4('0x50')]({'plain':!![]});if(!_0x49a30c)throw new Error(_0x7fd4('0x51'));if(_0x49a30c[_0x7fd4('0x52')]===_0x7fd4('0x4f')){var _0x12bb70=_0x256349[_0x7fd4('0x50')]({'plain':!![]});var _0x34eaa7='Teams';return db[_0x7fd4('0x53')][_0x7fd4('0x4d')]({'where':{'name':_0x34eaa7,'userProfileId':_0x49a30c[_0x7fd4('0x54')]},'raw':!![]})[_0x7fd4('0x43')](function(_0x1c52b6){if(_0x1c52b6&&_0x1c52b6[_0x7fd4('0x55')]===0x0){return db[_0x7fd4('0x56')][_0x7fd4('0x4e')]({'name':_0x12bb70['name'],'resourceId':_0x12bb70['id'],'type':_0x1c52b6[_0x7fd4('0x2c')],'sectionId':_0x1c52b6['id']},{})['then'](function(){return _0x256349;});}else{return _0x256349;}})[_0x7fd4('0x49')](function(_0x28f380){logger[_0x7fd4('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28f380);throw _0x28f380;});}return _0x256349;})[_0x7fd4('0x43')](respondWithResult(_0x4150b2,0xc9))['catch'](handleError(_0x4150b2,null));};exports[_0x7fd4('0x2a')]=function(_0x1f224d,_0x5248f0){if(_0x1f224d[_0x7fd4('0x58')]['id']){delete _0x1f224d['body']['id'];}return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x1f224d[_0x7fd4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5248f0,null))['then'](saveUpdates(_0x1f224d[_0x7fd4('0x58')],null))[_0x7fd4('0x43')](respondWithResult(_0x5248f0,null))[_0x7fd4('0x49')](handleError(_0x5248f0,null));};exports[_0x7fd4('0x59')]=function(_0x2bd828,_0x244e02){var _0x11832e=_0x2bd828[_0x7fd4('0x4b')]['id'];var _0x195a27=[];return db['sequelize']['transaction'](function(_0x49d2f8){var _0x31cff0=_0x7fd4('0x5a')+_0x11832e;return db['sequelize'][_0x7fd4('0x36')](_0x31cff0,{'type':db['Sequelize']['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8})[_0x7fd4('0x43')](function(_0x5118dd){_0x195a27=_[_0x7fd4('0x34')](_0x5118dd,function(_0x13521c){return Number(_0x13521c[_0x7fd4('0x5c')]);});})[_0x7fd4('0x43')](function(){var _0x2a1d5e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x2a1d5e,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x589a3f){var _0x42b106=_[_0x7fd4('0x34')](_0x589a3f,function(_0x119781){return Number(_0x119781[_0x7fd4('0x60')]);});return db['UserVoiceQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'VoiceQueueId':{'$in':_0x42b106}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x206b65='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db['sequelize']['query'](_0x206b65,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x319802){var _0x294c70=_[_0x7fd4('0x34')](_0x319802,function(_0x3945eb){return Number(_0x3945eb[_0x7fd4('0x61')]);});return db['UserMailQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'MailQueueId':{'$in':_0x294c70}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x1d952c=_0x7fd4('0x62')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x1d952c,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x2415fd){var _0x1f5f13=_[_0x7fd4('0x34')](_0x2415fd,function(_0x4c75b0){return Number(_0x4c75b0[_0x7fd4('0x63')]);});return db[_0x7fd4('0x64')]['destroy']({'where':{'UserId':{'$in':_0x195a27},'SmsQueueId':{'$in':_0x1f5f13}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0xe87772=_0x7fd4('0x65')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0xe87772,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')]['SELECT'],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x20d06a){var _0x317442=_['map'](_0x20d06a,function(_0x2bed6b){return Number(_0x2bed6b[_0x7fd4('0x66')]);});return db['UserChatQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'ChatQueueId':{'$in':_0x317442}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x368a0d=_0x7fd4('0x67')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x368a0d,{'type':db[_0x7fd4('0x5e')]['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x3f8559){var _0x58909c=_['map'](_0x3f8559,function(_0x3904a1){return Number(_0x3904a1[_0x7fd4('0x68')]);});return db[_0x7fd4('0x69')][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'FaxQueueId':{'$in':_0x58909c}},'transaction':_0x49d2f8});})['then'](function(){var _0xd5122c='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0xd5122c,{'type':db[_0x7fd4('0x5e')]['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x60c1ce){var _0x4a7b12=_[_0x7fd4('0x34')](_0x60c1ce,function(_0x3ade71){return Number(_0x3ade71[_0x7fd4('0x6a')]);});return db[_0x7fd4('0x6b')][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'OpenchannelQueueId':{'$in':_0x4a7b12}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x416619='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x416619,{'type':db['Sequelize'][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x2b6372){var _0x3f49fc=_['map'](_0x2b6372,function(_0x38435e){return Number(_0x38435e['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'WhatsappQueueId':{'$in':_0x3f49fc}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){return db[_0x7fd4('0x6c')]['find']({'where':{'TeamId':_0x11832e}});})['then'](function(_0x259d4a){if(_0x259d4a===null){return;}return db['UserVoicePrefix'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'VoicePrefixId':_0x259d4a[_0x7fd4('0x6d')]},'transaction':_0x49d2f8});})['then'](function(){return db['Team'][_0x7fd4('0x59')]({'where':{'id':_0x11832e},'cascade':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x3b2ab9){if(_0x3b2ab9===0x0){_0x244e02[_0x7fd4('0x1e')](0x194);}else{return db['UserProfileResource'][_0x7fd4('0x59')]({'where':{'type':_0x7fd4('0x6e'),'resourceId':_0x11832e},'cascade':!![],'transaction':_0x49d2f8})['then'](function(){_0x244e02[_0x7fd4('0x1f')](0xcc)[_0x7fd4('0x20')]();});}})['catch'](function(_0x54114a){_0x244e02[_0x7fd4('0x1f')](0x1f4)[_0x7fd4('0x2d')](_0x54114a);});});};exports[_0x7fd4('0x6f')]=function(_0x68f190,_0x54c52d,_0x34f52a){return db['Team']['findOne']({'where':{'id':_0x68f190[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](handleEntityNotFound(_0x54c52d,null))['then'](function(_0x2ca76d){if(!_0x68f190[_0x7fd4('0x36')]['channel']||!utils[_0x7fd4('0x70')](_0x68f190['query']['channel'])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}var _0x5efa7f={};var _0x117f50={};_0x117f50['model']=_[_0x7fd4('0x35')](db[_[_0x7fd4('0x73')](_0x68f190['query'][_0x7fd4('0x74')]['toLowerCase']())+'Queue'][_0x7fd4('0x2f')]);_0x117f50[_0x7fd4('0x36')]=_[_0x7fd4('0x35')](_0x68f190[_0x7fd4('0x36')]);_0x117f50[_0x7fd4('0x3f')]=_[_0x7fd4('0x37')](_0x117f50[_0x7fd4('0x33')],_0x117f50[_0x7fd4('0x36')]);_0x5efa7f[_0x7fd4('0x38')]=_['intersection'](_0x117f50[_0x7fd4('0x33')],qs['fields'](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x4c')]));_0x5efa7f[_0x7fd4('0x38')]=_0x5efa7f[_0x7fd4('0x38')][_0x7fd4('0x39')]?_0x5efa7f[_0x7fd4('0x38')]:_0x117f50['model'];_0x5efa7f[_0x7fd4('0x23')]=qs['limit'](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x23')]);_0x5efa7f[_0x7fd4('0x24')]=qs[_0x7fd4('0x24')](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x24')]);_0x5efa7f['order']=qs[_0x7fd4('0x3d')](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x3d')]);_0x5efa7f[_0x7fd4('0x3e')]=qs['filters'](_['pick'](_0x68f190['query'],_0x117f50[_0x7fd4('0x3f')]));_0x5efa7f=_[_0x7fd4('0x41')]({},_0x5efa7f,_0x68f190[_0x7fd4('0x75')]);return _0x2ca76d[_0x7fd4('0x50')+_['capitalize'](_0x68f190[_0x7fd4('0x36')]['channel'][_0x7fd4('0x76')]())+_0x7fd4('0x77')](_0x5efa7f);})[_0x7fd4('0x43')](respondWithResult(_0x54c52d,null))[_0x7fd4('0x49')](handleError(_0x54c52d,null));};exports[_0x7fd4('0x78')]=function(_0x58471e,_0x4068c5,_0xa11e8c){return db[_0x7fd4('0x2e')][_0x7fd4('0x79')]({'where':{'id':_0x58471e[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](function(_0x37d832){if(_0x37d832){if(!_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x74')]||!utils[_0x7fd4('0x70')](_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x74')])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}return _0x37d832[_0x7fd4('0x7a')+_[_0x7fd4('0x73')](_0x58471e['body'][_0x7fd4('0x74')][_0x7fd4('0x76')]())+_0x7fd4('0x77')](_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x7b')]);}return null;})[_0x7fd4('0x43')](handleEntityNotFound(_0x4068c5,null))[_0x7fd4('0x43')](respondWithStatusCode(_0x4068c5,null))[_0x7fd4('0x49')](handleError(_0x4068c5,null));};exports[_0x7fd4('0x7c')]=function(_0x2e8581,_0x13601a,_0x4a9cf4){return db[_0x7fd4('0x2e')][_0x7fd4('0x79')]({'where':{'id':_0x2e8581[_0x7fd4('0x4b')]['id']}})['then'](function(_0x5e99e6){if(_0x5e99e6){if(!_0x2e8581[_0x7fd4('0x36')][_0x7fd4('0x74')]||!utils[_0x7fd4('0x70')](_0x2e8581[_0x7fd4('0x36')]['channel'])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}return _0x5e99e6['remove'+_[_0x7fd4('0x73')](_0x2e8581['query']['channel'][_0x7fd4('0x76')]())+'Queues'](_0x2e8581['query'][_0x7fd4('0x7b')]);}return null;})[_0x7fd4('0x43')](handleEntityNotFound(_0x13601a,null))['then'](respondWithStatusCode(_0x13601a,null))[_0x7fd4('0x49')](handleError(_0x13601a,null));};exports[_0x7fd4('0x7d')]=function(_0x5cffa1,_0x180fd5){var _0xbb04cd=_[_0x7fd4('0x7e')](_0x5cffa1['body'][_0x7fd4('0x7b')])?_0x5cffa1[_0x7fd4('0x58')]['ids']:[_0x5cffa1[_0x7fd4('0x58')][_0x7fd4('0x7b')]];var _0x5c0376=_0x5cffa1[_0x7fd4('0x4b')]['id'];return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x5c0376}})[_0x7fd4('0x43')](handleEntityNotFound(_0x180fd5,null))[_0x7fd4('0x43')](function(_0x1fae5a){if(_0x1fae5a){var _0x50ec7f=[_0x7fd4('0x7f'),_0x7fd4('0x80'),_0x7fd4('0x81'),_0x7fd4('0x82'),_0x7fd4('0x83'),_0x7fd4('0x84'),'Whatsapp'];return db['sequelize'][_0x7fd4('0x85')](function(_0x2addc2){var _0x415479=_['map'](_0x50ec7f,function(_0x2d18b0){var _0x1e1f76={'attributes':['id',_0x7fd4('0x2c')]};if(_0x2d18b0==='Voice'){_0x1e1f76[_0x7fd4('0x86')]={'attributes':['penalty']};}return _0x1fae5a['get'+_0x2d18b0+'Queues'](_0x1e1f76)[_0x7fd4('0x43')](function(_0x14b5f6){var _0x405a9c=_[_0x7fd4('0x34')](_0x14b5f6,function(_0x1c84a1){var _0x277e5f=_[_0x7fd4('0x34')](_0xbb04cd,function(_0xf4888e){var _0x31a975={'where':{'UserId':_0xf4888e,[_0x2d18b0+_0x7fd4('0x87')]:_0x1c84a1['id']},'transaction':_0x2addc2};if(_0x2d18b0===_0x7fd4('0x7f')){_0x31a975[_0x7fd4('0x19')]={'penalty':_0x1c84a1[_0x7fd4('0x88')][_0x7fd4('0x89')]};}return db[_0x7fd4('0x8a')+_0x2d18b0+_0x7fd4('0x8b')]['findOrCreate'](_0x31a975)[_0x7fd4('0x43')](function(){socket[_0x7fd4('0x8c')](_0x7fd4('0x4f')+_0x2d18b0+_0x7fd4('0x8d'),{'UserId':_0xf4888e,[_0x2d18b0+_0x7fd4('0x87')]:_0x1c84a1['id']});if(_0x2d18b0!==_0x7fd4('0x7f')){return;}return db[_0x7fd4('0x8a')][_0x7fd4('0x47')]({'where':{'id':_0xbb04cd,'online':0x1},'attributes':['id',_0x7fd4('0x2c'),_0x7fd4('0x8e'),'voicePause','interface'],'raw':!![]})[_0x7fd4('0x43')](function(_0x508da6){var _0x49b822=_[_0x7fd4('0x34')](_0x508da6,function(_0x5592bd){return db[_0x7fd4('0x8f')][_0x7fd4('0x90')]({'membername':_0x5592bd[_0x7fd4('0x2c')],'UserId':_0x5592bd['id'],'queue_name':_0x1c84a1['name'],'VoiceQueueId':_0x1c84a1['id'],'interface':_[_0x7fd4('0x91')](_0x5592bd['interface'])?util[_0x7fd4('0x92')](_0x7fd4('0x93'),_0x5592bd[_0x7fd4('0x2c')]):_0x5592bd['interface'],'paused':_0x5592bd[_0x7fd4('0x94')]||![],'penalty':_0x1c84a1[_0x7fd4('0x88')][_0x7fd4('0x89')]},{'transaction':_0x2addc2});});return Promise['all'](_0x49b822);});});});return Promise['all'](_0x277e5f);});return Promise[_0x7fd4('0x95')](_0x405a9c);})['then'](function(){return db[_0x7fd4('0x6c')][_0x7fd4('0x79')]({'where':{'teamId':_0x5c0376}})[_0x7fd4('0x43')](function(_0x3de71d){if(_0x3de71d){var _0x4ab8a1=_[_0x7fd4('0x34')](_0xbb04cd,function(_0x35004c){db[_0x7fd4('0x96')][_0x7fd4('0x90')]({'UserId':_0x35004c,'VoicePrefixId':_0x3de71d[_0x7fd4('0x6d')]});});return Promise[_0x7fd4('0x95')](_0x4ab8a1);}});});});return Promise[_0x7fd4('0x95')](_0x415479)[_0x7fd4('0x43')](function(){return _0x1fae5a[_0x7fd4('0x7d')](_0xbb04cd,{'transaction':_0x2addc2})[_0x7fd4('0x97')](function(_0x3a3969){return _0x3a3969;});});});}})[_0x7fd4('0x43')](respondWithResult(_0x180fd5,null))[_0x7fd4('0x49')](handleError(_0x180fd5,null));};exports['removeAgents']=function(_0x3fc33a,_0x44ee0e){var _0x116e63=_[_0x7fd4('0x7e')](_0x3fc33a[_0x7fd4('0x36')]['ids'])?_0x3fc33a[_0x7fd4('0x36')][_0x7fd4('0x7b')]:[_0x3fc33a['query'][_0x7fd4('0x7b')]];var _0x2f794f=_0x3fc33a[_0x7fd4('0x4b')]['id'];return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x2f794f}})[_0x7fd4('0x43')](handleEntityNotFound(_0x44ee0e,null))[_0x7fd4('0x43')](function(_0x85fc13){if(_0x85fc13){var _0x16ce07=[_0x7fd4('0x7f'),_0x7fd4('0x80'),_0x7fd4('0x81'),'Sms','Fax',_0x7fd4('0x84'),'Whatsapp'];return db[_0x7fd4('0x5d')][_0x7fd4('0x85')](function(_0x283df5){var _0x12f1b1=_[_0x7fd4('0x34')](_0x16ce07,function(_0x1777ed){var _0x4d2673={'attributes':['id',_0x7fd4('0x2c')]};return _0x85fc13[_0x7fd4('0x50')+_0x1777ed+'Queues'](_0x4d2673)[_0x7fd4('0x43')](function(_0x3519a1){var _0x1d046d=_[_0x7fd4('0x34')](_0x3519a1,function(_0xfd6d24){return _0xfd6d24[_0x7fd4('0x98')](_0x116e63,{'transaction':_0x283df5})[_0x7fd4('0x43')](function(){var _0x3f7a53=_['map'](_0x116e63,function(_0x48b7a4){socket['emit'](_0x7fd4('0x4f')+_0x1777ed+_0x7fd4('0x99'),{'UserId':Number(_0x48b7a4),[_0x1777ed+'QueueId']:_0xfd6d24['id']});if(_0x1777ed!==_0x7fd4('0x7f')){return;}return db[_0x7fd4('0x8f')][_0x7fd4('0x59')]({'where':{'VoiceQueueId':_0xfd6d24['id'],'UserId':_0x48b7a4},'transaction':_0x283df5});});return Promise[_0x7fd4('0x95')](_0x3f7a53);});});return Promise[_0x7fd4('0x95')](_0x1d046d);});});return Promise[_0x7fd4('0x95')](_0x12f1b1)[_0x7fd4('0x43')](function(){return _0x85fc13[_0x7fd4('0x98')](_0x116e63,{'transaction':_0x283df5});})[_0x7fd4('0x43')](function(){return db[_0x7fd4('0x6c')]['findOne']({'where':{'teamId':_0x2f794f}})[_0x7fd4('0x43')](function(_0x4441be){if(_0x4441be){var _0x2ba7f4=_[_0x7fd4('0x34')](_0x116e63,function(_0x4971c9){db[_0x7fd4('0x96')][_0x7fd4('0x59')]({'where':{'UserId':_0x4971c9,'VoicePrefixId':_0x4441be['VoicePrefixId']}});});return Promise['all'](_0x2ba7f4);}});});});}})['then'](respondWithStatusCode(_0x44ee0e,null))[_0x7fd4('0x49')](handleError(_0x44ee0e,null));};exports['getAgents']=function(_0x5607d9,_0x483961,_0x4412f6){var _0x18942d={};var _0x217d4f={};var _0x48d46a;var _0xd0fece;return db['Team']['findOne']({'where':{'id':_0x5607d9[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](handleEntityNotFound(_0x483961,null))[_0x7fd4('0x43')](function(_0x2adaa3){if(_0x2adaa3){_0x48d46a=_0x2adaa3;_0x217d4f['model']=_[_0x7fd4('0x35')](db[_0x7fd4('0x8a')][_0x7fd4('0x2f')]);_0x217d4f[_0x7fd4('0x36')]=_[_0x7fd4('0x35')](_0x5607d9[_0x7fd4('0x36')]);_0x217d4f[_0x7fd4('0x3f')]=_['intersection'](_0x217d4f[_0x7fd4('0x33')],_0x217d4f['query']);_0x18942d[_0x7fd4('0x38')]=_[_0x7fd4('0x37')](_0x217d4f[_0x7fd4('0x33')],qs[_0x7fd4('0x4c')](_0x5607d9['query'][_0x7fd4('0x4c')]));_0x18942d[_0x7fd4('0x38')]=_0x18942d[_0x7fd4('0x38')]['length']?_0x18942d[_0x7fd4('0x38')]:_0x217d4f['model'];_0x18942d['order']=qs[_0x7fd4('0x3d')](_0x5607d9[_0x7fd4('0x36')][_0x7fd4('0x3d')]);_0x18942d[_0x7fd4('0x3e')]=qs[_0x7fd4('0x3f')](_[_0x7fd4('0x9a')](_0x5607d9[_0x7fd4('0x36')],_0x217d4f['filters']));if(_0x5607d9[_0x7fd4('0x36')]['filter']){_0x18942d[_0x7fd4('0x3e')]=_['merge'](_0x18942d[_0x7fd4('0x3e')],{'$or':_[_0x7fd4('0x34')](_0x18942d[_0x7fd4('0x38')],function(_0x501fdd){var _0x45c635={};_0x45c635[_0x501fdd]={'$like':'%'+_0x5607d9[_0x7fd4('0x36')]['filter']+'%'};return _0x45c635;})});}_0x18942d=_[_0x7fd4('0x41')]({},_0x18942d,_0x5607d9['options']);return _0x48d46a['getAgents'](_0x18942d);}})[_0x7fd4('0x43')](function(_0x10be61){if(_0x10be61){_0xd0fece=_0x10be61[_0x7fd4('0x39')];if(!_0x5607d9['query'][_0x7fd4('0x3a')](_0x7fd4('0x3b'))){_0x18942d[_0x7fd4('0x23')]=qs[_0x7fd4('0x23')](_0x5607d9[_0x7fd4('0x36')]['limit']);_0x18942d[_0x7fd4('0x24')]=qs[_0x7fd4('0x24')](_0x5607d9[_0x7fd4('0x36')][_0x7fd4('0x24')]);}return _0x48d46a['getAgents'](_0x18942d);}})[_0x7fd4('0x43')](function(_0x3dab5f){if(_0x3dab5f){return _0x3dab5f?{'count':_0xd0fece,'rows':_0x3dab5f}:null;}})['then'](respondWithResult(_0x483961,null))['catch'](handleError(_0x483961,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6088a1b..2e01f16 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 _0x49ee=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2c0d36,_0x145bfa){var _0x1a6d54=function(_0x3ca7c0){while(--_0x3ca7c0){_0x2c0d36['push'](_0x2c0d36['shift']());}};_0x1a6d54(++_0x145bfa);}(_0x49ee,0x1e1));var _0xe49e=function(_0x2d891f,_0x2c2171){_0x2d891f=_0x2d891f-0x0;var _0x1d1ab3=_0x49ee[_0x2d891f];return _0x1d1ab3;};'use strict';var EventEmitter=require(_0xe49e('0x0'));var Team=require(_0xe49e('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe49e('0x2')](0x0);var events={'afterCreate':_0xe49e('0x3'),'afterUpdate':_0xe49e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x717042){return function(_0x2b208d,_0x1989b6,_0x18bdd9){TeamEvents['emit'](_0x717042+':'+_0x2b208d['id'],_0x2b208d);TeamEvents[_0xe49e('0x5')](_0x717042,_0x2b208d);_0x18bdd9(null);};}for(var e in events){if(events[_0xe49e('0x6')](e)){var event=events[e];Team[_0xe49e('0x7')](e,emitEvent(event));}}module[_0xe49e('0x8')]=TeamEvents; \ No newline at end of file +var _0x4a9d=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x4a9d,0x1b5));var _0xd4a9=function(_0x11d6f0,_0xe996b2){_0x11d6f0=_0x11d6f0-0x0;var _0x49d492=_0x4a9d[_0x11d6f0];return _0x49d492;};'use strict';var EventEmitter=require('events');var Team=require(_0xd4a9('0x0'))['db'][_0xd4a9('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd4a9('0x2')](0x0);var events={'afterCreate':_0xd4a9('0x3'),'afterUpdate':_0xd4a9('0x4'),'afterDestroy':_0xd4a9('0x5')};function emitEvent(_0x5de848){return function(_0x1e84a6,_0x448b30,_0x44032f){TeamEvents[_0xd4a9('0x6')](_0x5de848+':'+_0x1e84a6['id'],_0x1e84a6);TeamEvents[_0xd4a9('0x6')](_0x5de848,_0x1e84a6);_0x44032f(null);};}for(var e in events){if(events[_0xd4a9('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd4a9('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8078d7f..add697c 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 _0x80f5=['teams','Chat','Fax','Mail','Openchannel','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','channel','exports'];(function(_0x398a0a,_0x3e51da){var _0x3d548e=function(_0x4f3cfe){while(--_0x4f3cfe){_0x398a0a['push'](_0x398a0a['shift']());}};_0x3d548e(++_0x3e51da);}(_0x80f5,0x88));var _0x580f=function(_0x6f5598,_0xabeb74){_0x6f5598=_0x6f5598-0x0;var _0x1e1325=_0x80f5[_0x6f5598];return _0x1e1325;};'use strict';var _=require(_0x580f('0x0'));var attributes=require(_0x580f('0x1'));function getQueuesByChannel(_0x481c1d,_0x14bf5c){var _0x2c13cd=_0x580f('0x2')+_0x14bf5c+_0x580f('0x3');return _0x481c1d[_0x2c13cd]()[_0x580f('0x4')](function(_0x48ae3c){return _[_0x580f('0x5')](_0x48ae3c,function(_0x174332){_0x174332['setDataValue'](_0x580f('0x6'),_0x14bf5c);return _0x174332;});})['catch'](function(_0x17616e){throw _0x17616e;});}module[_0x580f('0x7')]=function(_0xe0ec33){return _0xe0ec33['define']('Team',attributes,{'tableName':_0x580f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f6039=this;var _0x46b09c=[_0x580f('0x9'),_0x580f('0xa'),_0x580f('0xb'),_0x580f('0xc'),'Sms','Voice',_0x580f('0xd')];return Promise[_0x580f('0xe')]()[_0x580f('0x4')](function(){var _0x27a0d9=_[_0x580f('0x5')](_0x46b09c,function(_0x3ec132){return getQueuesByChannel(_0x3f6039,_0x3ec132);});return Promise[_0x580f('0xf')](_0x27a0d9);})['catch'](function(_0x461976){throw _0x461976;});}}});}; \ No newline at end of file +var _0xd8db=['define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','all','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd8db,0xd0));var _0xbd8d=function(_0x3ba422,_0x53303c){_0x3ba422=_0x3ba422-0x0;var _0x20b5dd=_0xd8db[_0x3ba422];return _0x20b5dd;};'use strict';var _=require('lodash');var attributes=require(_0xbd8d('0x0'));function getQueuesByChannel(_0x5c6dfe,_0x5cf63f){var _0x285119='get'+_0x5cf63f+_0xbd8d('0x1');return _0x5c6dfe[_0x285119]()[_0xbd8d('0x2')](function(_0x28d7a2){return _[_0xbd8d('0x3')](_0x28d7a2,function(_0x41d361){_0x41d361[_0xbd8d('0x4')](_0xbd8d('0x5'),_0x5cf63f);return _0x41d361;});})[_0xbd8d('0x6')](function(_0x4a5984){throw _0x4a5984;});}module[_0xbd8d('0x7')]=function(_0x1068a6){return _0x1068a6[_0xbd8d('0x8')](_0xbd8d('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x37248d=this;var _0x29b706=[_0xbd8d('0xa'),_0xbd8d('0xb'),_0xbd8d('0xc'),_0xbd8d('0xd'),_0xbd8d('0xe'),_0xbd8d('0xf'),_0xbd8d('0x10')];return Promise['resolve']()[_0xbd8d('0x2')](function(){var _0x2f575d=_[_0xbd8d('0x3')](_0x29b706,function(_0x51dd12){return getQueuesByChannel(_0x37248d,_0x51dd12);});return Promise[_0xbd8d('0x11')](_0x2f575d);})[_0xbd8d('0x6')](function(_0x556acd){throw _0x556acd;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b264276..4320a0a 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 _0x1e03=['http','localhost','socket.io-emitter','redis','./team.socket','register','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0x1e03,0x99));var _0x31e0=function(_0x4863de,_0x185cd2){_0x4863de=_0x4863de-0x0;var _0x416da0=_0x1e03[_0x4863de];return _0x416da0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x31e0('0x0'));var rs=require(_0x31e0('0x1'));var fs=require('fs');var Redis=require(_0x31e0('0x2'));var db=require(_0x31e0('0x3'))['db'];var utils=require(_0x31e0('0x4'));var logger=require(_0x31e0('0x5'))(_0x31e0('0x6'));var config=require(_0x31e0('0x7'));var jayson=require(_0x31e0('0x8'));var client=jayson['client'][_0x31e0('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x31e0('0xa'),'port':0x18eb});var socket=require(_0x31e0('0xb'))(new Redis(config[_0x31e0('0xc')]));require(_0x31e0('0xd'))[_0x31e0('0xe')](socket);function respondWithRpcPromise(_0x3a3a2b,_0x4c80c4,_0x47eb39){return new BPromise(function(_0x1be3c3,_0x3579aa){return client['request'](_0x3a3a2b,_0x47eb39)[_0x31e0('0xf')](function(_0x17f9f4){logger['info']('Team,\x20%s,\x20%s',_0x4c80c4,_0x31e0('0x10'));logger[_0x31e0('0x11')](_0x31e0('0x12'),_0x4c80c4,'request\x20sent',JSON[_0x31e0('0x13')](_0x17f9f4));if(_0x17f9f4[_0x31e0('0x14')]){if(_0x17f9f4[_0x31e0('0x14')][_0x31e0('0x15')]===0x1f4){logger[_0x31e0('0x14')](_0x31e0('0x16'),_0x4c80c4,_0x17f9f4[_0x31e0('0x14')]['message']);return _0x3579aa(_0x17f9f4[_0x31e0('0x14')][_0x31e0('0x17')]);}logger[_0x31e0('0x14')](_0x31e0('0x16'),_0x4c80c4,_0x17f9f4['error']['message']);return _0x1be3c3(_0x17f9f4[_0x31e0('0x14')][_0x31e0('0x17')]);}else{logger[_0x31e0('0x18')]('Team,\x20%s,\x20%s',_0x4c80c4,'request\x20sent');_0x1be3c3(_0x17f9f4[_0x31e0('0x19')][_0x31e0('0x17')]);}})[_0x31e0('0x1a')](function(_0x47f7e0){logger[_0x31e0('0x14')](_0x31e0('0x16'),_0x4c80c4,_0x47f7e0);_0x3579aa(_0x47f7e0);});});} \ No newline at end of file +var _0x0411=['register','request','then','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','localhost','socket.io-emitter','redis','./team.socket'];(function(_0x594821,_0x153b6c){var _0x139112=function(_0x105337){while(--_0x105337){_0x594821['push'](_0x594821['shift']());}};_0x139112(++_0x153b6c);}(_0x0411,0x15d));var _0x1041=function(_0x1ccefa,_0x5f0dd9){_0x1ccefa=_0x1ccefa-0x0;var _0x2ffc70=_0x0411[_0x1ccefa];return _0x2ffc70;};'use strict';var _=require(_0x1041('0x0'));var util=require(_0x1041('0x1'));var moment=require(_0x1041('0x2'));var BPromise=require(_0x1041('0x3'));var rs=require(_0x1041('0x4'));var fs=require('fs');var Redis=require(_0x1041('0x5'));var db=require(_0x1041('0x6'))['db'];var utils=require(_0x1041('0x7'));var logger=require(_0x1041('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1041('0x9'));var client=jayson[_0x1041('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1041('0xb'),'port':0x18eb});var socket=require(_0x1041('0xc'))(new Redis(config[_0x1041('0xd')]));require(_0x1041('0xe'))[_0x1041('0xf')](socket);function respondWithRpcPromise(_0x3205e5,_0x6c62a1,_0x10a3bb){return new BPromise(function(_0x55c7e3,_0x2f02aa){return client[_0x1041('0x10')](_0x3205e5,_0x10a3bb)[_0x1041('0x11')](function(_0x1ac87b){logger['info']('Team,\x20%s,\x20%s',_0x6c62a1,'request\x20sent');logger[_0x1041('0x12')](_0x1041('0x13'),_0x6c62a1,_0x1041('0x14'),JSON[_0x1041('0x15')](_0x1ac87b));if(_0x1ac87b[_0x1041('0x16')]){if(_0x1ac87b[_0x1041('0x16')][_0x1041('0x17')]===0x1f4){logger[_0x1041('0x16')](_0x1041('0x18'),_0x6c62a1,_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);return _0x2f02aa(_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);}logger[_0x1041('0x16')](_0x1041('0x18'),_0x6c62a1,_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);return _0x55c7e3(_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x6c62a1,_0x1041('0x14'));_0x55c7e3(_0x1ac87b[_0x1041('0x1a')]['message']);}})[_0x1041('0x1b')](function(_0x327c6c){logger['error'](_0x1041('0x18'),_0x6c62a1,_0x327c6c);_0x2f02aa(_0x327c6c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index fd22e66..98629bb 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 _0x0f46=['update','removeListener','register','team:','./team.events','save','remove'];(function(_0x61b4c7,_0xf6eafa){var _0x5f57a1=function(_0x5cbc37){while(--_0x5cbc37){_0x61b4c7['push'](_0x61b4c7['shift']());}};_0x5f57a1(++_0xf6eafa);}(_0x0f46,0x1a1));var _0x60f4=function(_0x1a5892,_0x39dde3){_0x1a5892=_0x1a5892-0x0;var _0x3ff86c=_0x0f46[_0x1a5892];return _0x3ff86c;};'use strict';var TeamEvents=require(_0x60f4('0x0'));var events=[_0x60f4('0x1'),_0x60f4('0x2'),_0x60f4('0x3')];function createListener(_0x520158,_0x53fb6c){return function(_0x17bb87){_0x53fb6c['emit'](_0x520158,_0x17bb87);};}function removeListener(_0x37e5d8,_0x5c13aa){return function(){TeamEvents[_0x60f4('0x4')](_0x37e5d8,_0x5c13aa);};}exports[_0x60f4('0x5')]=function(_0x2bb9ee){for(var _0x467eec=0x0,_0x10f4f9=events['length'];_0x467eec<_0x10f4f9;_0x467eec++){var _0x2e0c0a=events[_0x467eec];var _0x40aa19=createListener(_0x60f4('0x6')+_0x2e0c0a,_0x2bb9ee);TeamEvents['on'](_0x2e0c0a,_0x40aa19);}}; \ No newline at end of file +var _0x0036=['removeListener','register','team:','./team.events','save','remove','update','emit'];(function(_0x175d2b,_0x334432){var _0x581c71=function(_0x5cee18){while(--_0x5cee18){_0x175d2b['push'](_0x175d2b['shift']());}};_0x581c71(++_0x334432);}(_0x0036,0x73));var _0x6003=function(_0x510810,_0x5ba056){_0x510810=_0x510810-0x0;var _0x3b2990=_0x0036[_0x510810];return _0x3b2990;};'use strict';var TeamEvents=require(_0x6003('0x0'));var events=[_0x6003('0x1'),_0x6003('0x2'),_0x6003('0x3')];function createListener(_0x31bb7e,_0x41a61d){return function(_0x3aa11b){_0x41a61d[_0x6003('0x4')](_0x31bb7e,_0x3aa11b);};}function removeListener(_0x45bed1,_0x46cd97){return function(){TeamEvents[_0x6003('0x5')](_0x45bed1,_0x46cd97);};}exports[_0x6003('0x6')]=function(_0x159d55){for(var _0x23976c=0x0,_0x3ddcff=events['length'];_0x23976c<_0x3ddcff;_0x23976c++){var _0x1674ba=events[_0x23976c];var _0x1b6954=createListener(_0x6003('0x7')+_0x1674ba,_0x159d55);TeamEvents['on'](_0x1674ba,_0x1b6954);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 736f29e..6358d20 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 _0x23a8=['exports','INTEGER'];(function(_0x3f1f19,_0x5e9b18){var _0x1b5e91=function(_0x283742){while(--_0x283742){_0x3f1f19['push'](_0x3f1f19['shift']());}};_0x1b5e91(++_0x5e9b18);}(_0x23a8,0x172));var _0x823a=function(_0x3092e4,_0x9872d4){_0x3092e4=_0x3092e4-0x0;var _0xacbaa8=_0x23a8[_0x3092e4];return _0xacbaa8;};'use strict';var Sequelize=require('sequelize');module[_0x823a('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x823a('0x1')]}}; \ No newline at end of file +var _0x8653=['INTEGER'];(function(_0x1bf473,_0x22acfe){var _0x3570ce=function(_0xb3b650){while(--_0xb3b650){_0x1bf473['push'](_0x1bf473['shift']());}};_0x3570ce(++_0x22acfe);}(_0x8653,0x17a));var _0x3865=function(_0x294b48,_0x11b96f){_0x294b48=_0x294b48-0x0;var _0x227273=_0x8653[_0x294b48];return _0x227273;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3865('0x0')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5f57128..b97d8ff 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 _0x94e6=['moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','lodash','../../config/logger','api'];(function(_0x4fa91d,_0xb5eb66){var _0x449624=function(_0x27fd2f){while(--_0x27fd2f){_0x4fa91d['push'](_0x4fa91d['shift']());}};_0x449624(++_0xb5eb66);}(_0x94e6,0x194));var _0x694e=function(_0x2418ac,_0x102e02){_0x2418ac=_0x2418ac-0x0;var _0x3bc01b=_0x94e6[_0x2418ac];return _0x3bc01b;};'use strict';var _=require(_0x694e('0x0'));var util=require('util');var logger=require(_0x694e('0x1'))(_0x694e('0x2'));var moment=require(_0x694e('0x3'));var BPromise=require(_0x694e('0x4'));var rp=require(_0x694e('0x5'));var fs=require('fs');var path=require(_0x694e('0x6'));var rimraf=require('rimraf');var config=require(_0x694e('0x7'));var attributes=require(_0x694e('0x8'));module['exports']=function(_0x59abaf,_0x43238f){return _0x59abaf[_0x694e('0x9')](_0x694e('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ba6=['bluebird','request-promise','path','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','moment'];(function(_0x318155,_0x38ac1f){var _0x226c00=function(_0x453eb0){while(--_0x453eb0){_0x318155['push'](_0x318155['shift']());}};_0x226c00(++_0x38ac1f);}(_0x8ba6,0x11b));var _0x68ba=function(_0x1d7b84,_0x1df5bf){_0x1d7b84=_0x1d7b84-0x0;var _0x1b8df7=_0x8ba6[_0x1d7b84];return _0x1b8df7;};'use strict';var _=require(_0x68ba('0x0'));var util=require('util');var logger=require(_0x68ba('0x1'))('api');var moment=require(_0x68ba('0x2'));var BPromise=require(_0x68ba('0x3'));var rp=require(_0x68ba('0x4'));var fs=require('fs');var path=require(_0x68ba('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x68ba('0x6'));module[_0x68ba('0x7')]=function(_0x14f5f6,_0x183957){return _0x14f5f6[_0x68ba('0x8')](_0x68ba('0x9'),attributes,{'tableName':_0x68ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d44e323..d030419 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2c72f1,_0x4ddc4b){var _0x222f0f=function(_0x22c6fd){while(--_0x22c6fd){_0x2c72f1['push'](_0x2c72f1['shift']());}};_0x222f0f(++_0x4ddc4b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xcb91[_0x23be51];return _0x47a26d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1f69288..31590bb 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 _0xb5b5=['sequelize','exports'];(function(_0xf74372,_0x51fe82){var _0x36bb65=function(_0x499b7a){while(--_0x499b7a){_0xf74372['push'](_0xf74372['shift']());}};_0x36bb65(++_0x51fe82);}(_0xb5b5,0x138));var _0x5b5b=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xb5b5[_0x508685];return _0x976a76;};'use strict';var Sequelize=require(_0x5b5b('0x0'));module[_0x5b5b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7676=['INTEGER','sequelize','exports'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x7676,0xb8));var _0x6767=function(_0x1bac48,_0x597502){_0x1bac48=_0x1bac48-0x0;var _0x5eb030=_0x7676[_0x1bac48];return _0x5eb030;};'use strict';var Sequelize=require(_0x6767('0x0'));module[_0x6767('0x1')]={'penalty':{'type':Sequelize[_0x6767('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 8bf5cc4..6545e19 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 _0xe3c5=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x2f6dfe,_0x115dab){_0x2f6dfe=_0x2f6dfe-0x0;var _0x5e5c9c=_0xe3c5[_0x2f6dfe];return _0x5e5c9c;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x455d=['./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x455d,0x190));var _0xd455=function(_0xa09138,_0x4b4d4d){_0xa09138=_0xa09138-0x0;var _0x38befb=_0x455d[_0xa09138];return _0x38befb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd455('0x0'))(_0xd455('0x1'));var moment=require(_0xd455('0x2'));var BPromise=require('bluebird');var rp=require(_0xd455('0x3'));var fs=require('fs');var path=require(_0xd455('0x4'));var rimraf=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var attributes=require(_0xd455('0x7'));module[_0xd455('0x8')]=function(_0x41b357,_0x32a340){return _0x41b357[_0xd455('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xd455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index f274fb3..de87472 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 _0xc271=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5b8ae9,_0x1f69cd){var _0x25fcdf=function(_0xe204e3){while(--_0xe204e3){_0x5b8ae9['push'](_0x5b8ae9['shift']());}};_0x25fcdf(++_0x1f69cd);}(_0xc271,0x165));var _0x1c27=function(_0x18e1a4,_0x585c65){_0x18e1a4=_0x18e1a4-0x0;var _0x5c7fe4=_0xc271[_0x18e1a4];return _0x5c7fe4;};'use strict';var _=require(_0x1c27('0x0'));var util=require(_0x1c27('0x1'));var moment=require(_0x1c27('0x2'));var BPromise=require(_0x1c27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c27('0x4'));var db=require(_0x1c27('0x5'))['db'];var utils=require(_0x1c27('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c27('0x7'));var jayson=require(_0x1c27('0x8'));var client=jayson['client'][_0x1c27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b86dc,_0x344ab2,_0x31686a){return new BPromise(function(_0x21d843,_0x1304e0){return client[_0x1c27('0xa')](_0x4b86dc,_0x31686a)['then'](function(_0x15f054){logger['info'](_0x1c27('0xb'),_0x344ab2,_0x1c27('0xc'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x344ab2,_0x1c27('0xc'),JSON[_0x1c27('0xd')](_0x15f054));if(_0x15f054[_0x1c27('0xe')]){if(_0x15f054[_0x1c27('0xe')][_0x1c27('0xf')]===0x1f4){logger[_0x1c27('0xe')](_0x1c27('0xb'),_0x344ab2,_0x15f054[_0x1c27('0xe')][_0x1c27('0x10')]);return _0x1304e0(_0x15f054[_0x1c27('0xe')][_0x1c27('0x10')]);}logger['error'](_0x1c27('0xb'),_0x344ab2,_0x15f054[_0x1c27('0xe')][_0x1c27('0x10')]);return _0x21d843(_0x15f054[_0x1c27('0xe')]['message']);}else{logger[_0x1c27('0x11')](_0x1c27('0xb'),_0x344ab2,'request\x20sent');_0x21d843(_0x15f054[_0x1c27('0x12')][_0x1c27('0x10')]);}})[_0x1c27('0x13')](function(_0x237aec){logger[_0x1c27('0xe')](_0x1c27('0xb'),_0x344ab2,_0x237aec);_0x1304e0(_0x237aec);});});} \ No newline at end of file +var _0x083e=['http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x169d54,_0x26300){var _0xbbff5c=function(_0x5dd902){while(--_0x5dd902){_0x169d54['push'](_0x169d54['shift']());}};_0xbbff5c(++_0x26300);}(_0x083e,0x140));var _0xe083=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x083e[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0xe083('0x0'));var util=require(_0xe083('0x1'));var moment=require('moment');var BPromise=require(_0xe083('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe083('0x3'));var db=require(_0xe083('0x4'))['db'];var utils=require(_0xe083('0x5'));var logger=require(_0xe083('0x6'))(_0xe083('0x7'));var config=require(_0xe083('0x8'));var jayson=require(_0xe083('0x9'));var client=jayson['client'][_0xe083('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b81e3,_0x3eefa7,_0x35e969){return new BPromise(function(_0x8a8c3f,_0xd950e4){return client['request'](_0x1b81e3,_0x35e969)['then'](function(_0x34f7d7){logger[_0xe083('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0xe083('0xc'));logger[_0xe083('0xd')](_0xe083('0xe'),_0x3eefa7,_0xe083('0xc'),JSON[_0xe083('0xf')](_0x34f7d7));if(_0x34f7d7[_0xe083('0x10')]){if(_0x34f7d7[_0xe083('0x10')][_0xe083('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x34f7d7['error'][_0xe083('0x12')]);return _0xd950e4(_0x34f7d7[_0xe083('0x10')][_0xe083('0x12')]);}logger[_0xe083('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x34f7d7[_0xe083('0x10')][_0xe083('0x12')]);return _0x8a8c3f(_0x34f7d7[_0xe083('0x10')]['message']);}else{logger[_0xe083('0xb')](_0xe083('0x13'),_0x3eefa7,'request\x20sent');_0x8a8c3f(_0x34f7d7[_0xe083('0x14')]['message']);}})[_0xe083('0x15')](function(_0x52d0da){logger[_0xe083('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x52d0da);_0xd950e4(_0x52d0da);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b0d9b76..3d929be 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 _0xc6c0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path'];(function(_0x5aa1e1,_0x459ded){var _0x5c21f4=function(_0x577902){while(--_0x577902){_0x5aa1e1['push'](_0x5aa1e1['shift']());}};_0x5c21f4(++_0x459ded);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xc6c0[_0x506d83];return _0x335e8b;};'use strict';var multer=require(_0x0c6c('0x0'));var util=require('util');var path=require(_0x0c6c('0x1'));var timeout=require(_0x0c6c('0x2'));var express=require(_0x0c6c('0x3'));var router=express[_0x0c6c('0x4')]();var fs_extra=require(_0x0c6c('0x5'));var auth=require(_0x0c6c('0x6'));var interaction=require(_0x0c6c('0x7'));var config=require(_0x0c6c('0x8'));var controller=require(_0x0c6c('0x9'));router[_0x0c6c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0c6c('0xa')](_0x0c6c('0xb'),auth[_0x0c6c('0xc')](),controller[_0x0c6c('0xd')]);router[_0x0c6c('0xe')]('/',auth[_0x0c6c('0xc')](),controller[_0x0c6c('0xf')]);router[_0x0c6c('0x10')](_0x0c6c('0xb'),auth[_0x0c6c('0xc')](),controller[_0x0c6c('0x11')]);router[_0x0c6c('0x12')](_0x0c6c('0xb'),auth[_0x0c6c('0xc')](),controller[_0x0c6c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x288a=['../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x288a,0x188));var _0xa288=function(_0x4b0f49,_0x20c369){_0x4b0f49=_0x4b0f49-0x0;var _0x5a0771=_0x288a[_0x4b0f49];return _0x5a0771;};'use strict';var multer=require('multer');var util=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var timeout=require(_0xa288('0x2'));var express=require(_0xa288('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa288('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa288('0x5'));var controller=require(_0xa288('0x6'));router[_0xa288('0x7')]('/',auth['isAuthenticated'](),controller[_0xa288('0x8')]);router[_0xa288('0x7')](_0xa288('0x9'),auth['isAuthenticated'](),controller[_0xa288('0xa')]);router[_0xa288('0xb')]('/',auth[_0xa288('0xc')](),controller[_0xa288('0xd')]);router[_0xa288('0xe')](_0xa288('0x9'),auth[_0xa288('0xc')](),controller[_0xa288('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa288('0x10')]);module[_0xa288('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e756147..efef65a 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 _0x6266=['STRING','TEXT','sequelize','exports'];(function(_0x5dd0de,_0x16a4b8){var _0x17fc0e=function(_0x97bc59){while(--_0x97bc59){_0x5dd0de['push'](_0x5dd0de['shift']());}};_0x17fc0e(++_0x16a4b8);}(_0x6266,0x76));var _0x6626=function(_0x230471,_0x55e759){_0x230471=_0x230471-0x0;var _0x27a486=_0x6266[_0x230471];return _0x27a486;};'use strict';var Sequelize=require(_0x6626('0x0'));module[_0x6626('0x1')]={'name':{'type':Sequelize[_0x6626('0x2')]},'description':{'type':Sequelize[_0x6626('0x2')]},'html':{'type':Sequelize[_0x6626('0x3')]}}; \ No newline at end of file +var _0x0c5a=['STRING','TEXT','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0c5a,0x126));var _0xa0c5=function(_0x49df19,_0x22eb80){_0x49df19=_0x49df19-0x0;var _0x154d18=_0x0c5a[_0x49df19];return _0x154d18;};'use strict';var Sequelize=require(_0xa0c5('0x0'));module[_0xa0c5('0x1')]={'name':{'type':Sequelize[_0xa0c5('0x2')]},'description':{'type':Sequelize[_0xa0c5('0x2')]},'html':{'type':Sequelize[_0xa0c5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d13f8bb..48c59b5 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 _0x4e71=['params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','apply','save','update','then','get','Templates','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','Template','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show'];(function(_0x261f3b,_0x45fd76){var _0x325e3e=function(_0x5e0ec1){while(--_0x5e0ec1){_0x261f3b['push'](_0x261f3b['shift']());}};_0x325e3e(++_0x45fd76);}(_0x4e71,0xe3));var _0x14e7=function(_0x4b6c48,_0x4593ba){_0x4b6c48=_0x4b6c48-0x0;var _0xa0e78a=_0x4e71[_0x4b6c48];return _0xa0e78a;};'use strict';var emlformat=require(_0x14e7('0x0'));var rimraf=require(_0x14e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14e7('0x2'));var rp=require('request-promise');var moment=require(_0x14e7('0x3'));var BPromise=require(_0x14e7('0x4'));var Mustache=require(_0x14e7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x14e7('0x6'));var csv=require(_0x14e7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x14e7('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14e7('0x9'));var Papa=require('papaparse');var Redis=require(_0x14e7('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14e7('0xb'));var hardwareService=require(_0x14e7('0xc'));var logger=require('../../config/logger')(_0x14e7('0xd'));var utils=require(_0x14e7('0xe'));var config=require(_0x14e7('0xf'));var licenseUtil=require(_0x14e7('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9de7,_0x66e3e5){_0x66e3e5=_0x66e3e5||0xcc;return function(_0x6071){if(_0x6071){return _0x3c9de7['sendStatus'](_0x66e3e5);}return _0x3c9de7['status'](_0x66e3e5)['end']();};}function respondWithResult(_0xb5f036,_0x1daffe){_0x1daffe=_0x1daffe||0xc8;return function(_0x504a65){if(_0x504a65){return _0xb5f036[_0x14e7('0x11')](_0x1daffe)[_0x14e7('0x12')](_0x504a65);}};}function respondWithFilteredResult(_0x495ae2,_0x5cfe02){return function(_0x2fa6b0){if(_0x2fa6b0){var _0x46cc95=typeof _0x5cfe02[_0x14e7('0x13')]===_0x14e7('0x14')&&typeof _0x5cfe02[_0x14e7('0x15')]===_0x14e7('0x14');var _0x41aeb1=_0x2fa6b0['count'];var _0x2100c5=_0x46cc95?0x0:_0x5cfe02['offset'];var _0x115ff0=_0x46cc95?_0x2fa6b0['count']:_0x5cfe02[_0x14e7('0x13')]+_0x5cfe02['limit'];var _0x25699a;if(_0x115ff0>=_0x41aeb1){_0x115ff0=_0x41aeb1;_0x25699a=0xc8;}else{_0x25699a=0xce;}_0x495ae2[_0x14e7('0x11')](_0x25699a);return _0x495ae2['set']('Content-Range',_0x2100c5+'-'+_0x115ff0+'/'+_0x41aeb1)['json'](_0x2fa6b0);}return null;};}function patchUpdates(_0x11b49a){return function(_0x41ce18){try{jsonpatch[_0x14e7('0x16')](_0x41ce18,_0x11b49a,!![]);}catch(_0x1718c2){return BPromise['reject'](_0x1718c2);}return _0x41ce18[_0x14e7('0x17')]();};}function saveUpdates(_0x2aa3ae,_0x4cac87){return function(_0x23bdd6){if(_0x23bdd6){return _0x23bdd6[_0x14e7('0x18')](_0x2aa3ae)[_0x14e7('0x19')](function(_0x22a89b){return _0x22a89b;});}return null;};}function removeEntity(_0x5e33c1,_0xd5677f){return function(_0x5d1824){if(_0x5d1824){return _0x5d1824['destroy']()[_0x14e7('0x19')](function(){var _0x23f17d=_0x5d1824[_0x14e7('0x1a')]({'plain':!![]});var _0x4f706f=_0x14e7('0x1b');return db[_0x14e7('0x1c')][_0x14e7('0x1d')]({'where':{'type':_0x4f706f,'resourceId':_0x23f17d['id']}})[_0x14e7('0x19')](function(){return _0x5d1824;});})['then'](function(){_0x5e33c1['status'](0xcc)[_0x14e7('0x1e')]();});}};}function handleEntityNotFound(_0x9370cb,_0x19bbeb){return function(_0x57731c){if(!_0x57731c){_0x9370cb[_0x14e7('0x1f')](0x194);}return _0x57731c;};}function handleError(_0x598f3c,_0x1b4e8d){_0x1b4e8d=_0x1b4e8d||0x1f4;return function(_0x22793c){logger[_0x14e7('0x20')](_0x22793c['stack']);if(_0x22793c[_0x14e7('0x21')]){delete _0x22793c['name'];}_0x598f3c[_0x14e7('0x11')](_0x1b4e8d)[_0x14e7('0x22')](_0x22793c);};}exports[_0x14e7('0x23')]=function(_0x530493,_0x3069c8){var _0x5dce69={},_0x52511d={},_0x187989={'count':0x0,'rows':[]};var _0x39046b=_[_0x14e7('0x24')](db[_0x14e7('0x25')][_0x14e7('0x26')],function(_0x3b83c1){return{'name':_0x3b83c1[_0x14e7('0x27')],'type':_0x3b83c1['type']['key']};});_0x52511d[_0x14e7('0x28')]=_[_0x14e7('0x24')](_0x39046b,_0x14e7('0x21'));_0x52511d[_0x14e7('0x29')]=_[_0x14e7('0x2a')](_0x530493[_0x14e7('0x29')]);_0x52511d[_0x14e7('0x2b')]=_[_0x14e7('0x2c')](_0x52511d[_0x14e7('0x28')],_0x52511d[_0x14e7('0x29')]);_0x5dce69[_0x14e7('0x2d')]=_[_0x14e7('0x2c')](_0x52511d[_0x14e7('0x28')],qs['fields'](_0x530493[_0x14e7('0x29')]['fields']));_0x5dce69[_0x14e7('0x2d')]=_0x5dce69[_0x14e7('0x2d')][_0x14e7('0x2e')]?_0x5dce69['attributes']:_0x52511d['model'];if(!_0x530493[_0x14e7('0x29')][_0x14e7('0x2f')]('nolimit')){_0x5dce69[_0x14e7('0x15')]=qs[_0x14e7('0x15')](_0x530493[_0x14e7('0x29')]['limit']);_0x5dce69[_0x14e7('0x13')]=qs[_0x14e7('0x13')](_0x530493['query']['offset']);}_0x5dce69[_0x14e7('0x30')]=qs[_0x14e7('0x31')](_0x530493[_0x14e7('0x29')][_0x14e7('0x31')]);_0x5dce69[_0x14e7('0x32')]=qs['filters'](_[_0x14e7('0x33')](_0x530493[_0x14e7('0x29')],_0x52511d[_0x14e7('0x2b')]),_0x39046b);if(_0x530493[_0x14e7('0x29')][_0x14e7('0x34')]){_0x5dce69[_0x14e7('0x32')]=_['merge'](_0x5dce69[_0x14e7('0x32')],{'$or':_['map'](_0x39046b,function(_0x395e72){if(_0x395e72[_0x14e7('0x35')]!=='VIRTUAL'){var _0x3512ac={};_0x3512ac[_0x395e72[_0x14e7('0x21')]]={'$like':'%'+_0x530493[_0x14e7('0x29')][_0x14e7('0x34')]+'%'};return _0x3512ac;}})});}_0x5dce69=_[_0x14e7('0x36')]({},_0x5dce69,_0x530493[_0x14e7('0x37')]);var _0x2f5a09={'where':_0x5dce69[_0x14e7('0x32')]};return db[_0x14e7('0x25')]['count'](_0x2f5a09)[_0x14e7('0x19')](function(_0x30b1c1){_0x187989['count']=_0x30b1c1;if(_0x530493[_0x14e7('0x29')][_0x14e7('0x38')]){_0x5dce69[_0x14e7('0x39')]=[{'all':!![]}];}return db[_0x14e7('0x25')][_0x14e7('0x3a')](_0x5dce69);})[_0x14e7('0x19')](function(_0xbfd61f){_0x187989[_0x14e7('0x3b')]=_0xbfd61f;return _0x187989;})[_0x14e7('0x19')](respondWithFilteredResult(_0x3069c8,_0x5dce69))['catch'](handleError(_0x3069c8,null));};exports[_0x14e7('0x3c')]=function(_0x3a7d68,_0x45b6b1){var _0x515204={'raw':!![],'where':{'id':_0x3a7d68[_0x14e7('0x3d')]['id']}},_0x6ba7c7={};_0x6ba7c7[_0x14e7('0x28')]=_[_0x14e7('0x2a')](db[_0x14e7('0x25')][_0x14e7('0x26')]);_0x6ba7c7[_0x14e7('0x29')]=_[_0x14e7('0x2a')](_0x3a7d68[_0x14e7('0x29')]);_0x6ba7c7[_0x14e7('0x2b')]=_[_0x14e7('0x2c')](_0x6ba7c7[_0x14e7('0x28')],_0x6ba7c7[_0x14e7('0x29')]);_0x515204[_0x14e7('0x2d')]=_['intersection'](_0x6ba7c7['model'],qs['fields'](_0x3a7d68['query'][_0x14e7('0x3e')]));_0x515204['attributes']=_0x515204['attributes']['length']?_0x515204['attributes']:_0x6ba7c7[_0x14e7('0x28')];if(_0x3a7d68[_0x14e7('0x29')][_0x14e7('0x38')]){_0x515204[_0x14e7('0x39')]=[{'all':!![]}];}_0x515204=_[_0x14e7('0x36')]({},_0x515204,_0x3a7d68[_0x14e7('0x37')]);return db['Template'][_0x14e7('0x3f')](_0x515204)[_0x14e7('0x19')](handleEntityNotFound(_0x45b6b1,null))[_0x14e7('0x19')](respondWithResult(_0x45b6b1,null))[_0x14e7('0x40')](handleError(_0x45b6b1,null));};exports[_0x14e7('0x41')]=function(_0x3a3b8b,_0xbdf6d9){return db[_0x14e7('0x25')]['create'](_0x3a3b8b[_0x14e7('0x42')],{})[_0x14e7('0x19')](function(_0x4c0e05){var _0x2c6ac0=_0x3a3b8b[_0x14e7('0x43')][_0x14e7('0x1a')]({'plain':!![]});if(!_0x2c6ac0)throw new Error(_0x14e7('0x44'));if(_0x2c6ac0[_0x14e7('0x45')]===_0x14e7('0x43')){var _0x437814=_0x4c0e05[_0x14e7('0x1a')]({'plain':!![]});var _0x1b3205=_0x14e7('0x1b');return db[_0x14e7('0x46')]['find']({'where':{'name':_0x1b3205,'userProfileId':_0x2c6ac0['userProfileId']},'raw':!![]})[_0x14e7('0x19')](function(_0x48d8c0){if(_0x48d8c0&&_0x48d8c0['autoAssociation']===0x0){return db[_0x14e7('0x1c')][_0x14e7('0x41')]({'name':_0x437814[_0x14e7('0x21')],'resourceId':_0x437814['id'],'type':_0x48d8c0[_0x14e7('0x21')],'sectionId':_0x48d8c0['id']},{})[_0x14e7('0x19')](function(){return _0x4c0e05;});}else{return _0x4c0e05;}})[_0x14e7('0x40')](function(_0x8de065){logger['error'](_0x14e7('0x47'),_0x8de065);throw _0x8de065;});}return _0x4c0e05;})[_0x14e7('0x19')](respondWithResult(_0xbdf6d9,0xc9))['catch'](handleError(_0xbdf6d9,null));};exports[_0x14e7('0x18')]=function(_0x3f9dbb,_0x4ba173){if(_0x3f9dbb[_0x14e7('0x42')]['id']){delete _0x3f9dbb['body']['id'];}return db[_0x14e7('0x25')]['find']({'where':{'id':_0x3f9dbb[_0x14e7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4ba173,null))[_0x14e7('0x19')](saveUpdates(_0x3f9dbb[_0x14e7('0x42')],null))[_0x14e7('0x19')](respondWithResult(_0x4ba173,null))[_0x14e7('0x40')](handleError(_0x4ba173,null));};exports['destroy']=function(_0x42594f,_0x5a30d7){return db['Template'][_0x14e7('0x3f')]({'where':{'id':_0x42594f[_0x14e7('0x3d')]['id']}})[_0x14e7('0x19')](handleEntityNotFound(_0x5a30d7,null))[_0x14e7('0x19')](removeEntity(_0x5a30d7,null))[_0x14e7('0x40')](handleError(_0x5a30d7,null));}; \ No newline at end of file +var _0x084f=['save','update','then','get','Templates','destroy','error','stack','name','index','map','Template','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','moment','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2e75d3,_0x3027a8){var _0x1a14f1=function(_0x6c8e71){while(--_0x6c8e71){_0x2e75d3['push'](_0x2e75d3['shift']());}};_0x1a14f1(++_0x3027a8);}(_0x084f,0x124));var _0xf084=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x084f[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xf084('0x0'));var rimraf=require(_0xf084('0x1'));var zipdir=require(_0xf084('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf084('0x3'));var moment=require(_0xf084('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf084('0x5'));var util=require('util');var path=require(_0xf084('0x6'));var sox=require(_0xf084('0x7'));var csv=require(_0xf084('0x8'));var ejs=require(_0xf084('0x9'));var fs=require('fs');var fs_extra=require(_0xf084('0xa'));var _=require(_0xf084('0xb'));var squel=require(_0xf084('0xc'));var crypto=require(_0xf084('0xd'));var jsforce=require(_0xf084('0xe'));var deskjs=require(_0xf084('0xf'));var toCsv=require(_0xf084('0x8'));var querystring=require(_0xf084('0x10'));var Papa=require(_0xf084('0x11'));var Redis=require(_0xf084('0x12'));var authService=require(_0xf084('0x13'));var qs=require(_0xf084('0x14'));var as=require(_0xf084('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf084('0x16'))(_0xf084('0x17'));var utils=require('../../config/utils');var config=require(_0xf084('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf084('0x19'))['db'];function respondWithStatusCode(_0x1facf4,_0x4a67c8){_0x4a67c8=_0x4a67c8||0xcc;return function(_0x145101){if(_0x145101){return _0x1facf4[_0xf084('0x1a')](_0x4a67c8);}return _0x1facf4[_0xf084('0x1b')](_0x4a67c8)[_0xf084('0x1c')]();};}function respondWithResult(_0x639e04,_0x5cc544){_0x5cc544=_0x5cc544||0xc8;return function(_0x3ca02d){if(_0x3ca02d){return _0x639e04[_0xf084('0x1b')](_0x5cc544)[_0xf084('0x1d')](_0x3ca02d);}};}function respondWithFilteredResult(_0x3fb979,_0x3bc925){return function(_0x4eb0b2){if(_0x4eb0b2){var _0x1fffdb=typeof _0x3bc925[_0xf084('0x1e')]===_0xf084('0x1f')&&typeof _0x3bc925[_0xf084('0x20')]===_0xf084('0x1f');var _0x568ec5=_0x4eb0b2[_0xf084('0x21')];var _0x4b58fa=_0x1fffdb?0x0:_0x3bc925['offset'];var _0x2cea40=_0x1fffdb?_0x4eb0b2['count']:_0x3bc925[_0xf084('0x1e')]+_0x3bc925[_0xf084('0x20')];var _0x21e892;if(_0x2cea40>=_0x568ec5){_0x2cea40=_0x568ec5;_0x21e892=0xc8;}else{_0x21e892=0xce;}_0x3fb979[_0xf084('0x1b')](_0x21e892);return _0x3fb979[_0xf084('0x22')](_0xf084('0x23'),_0x4b58fa+'-'+_0x2cea40+'/'+_0x568ec5)[_0xf084('0x1d')](_0x4eb0b2);}return null;};}function patchUpdates(_0x1f8be5){return function(_0x14c84a){try{jsonpatch['apply'](_0x14c84a,_0x1f8be5,!![]);}catch(_0x638c14){return BPromise['reject'](_0x638c14);}return _0x14c84a[_0xf084('0x24')]();};}function saveUpdates(_0x57446e,_0x1f8f30){return function(_0x16f2bc){if(_0x16f2bc){return _0x16f2bc[_0xf084('0x25')](_0x57446e)[_0xf084('0x26')](function(_0xa94faa){return _0xa94faa;});}return null;};}function removeEntity(_0x34ff21,_0x4fc381){return function(_0x219f04){if(_0x219f04){return _0x219f04['destroy']()[_0xf084('0x26')](function(){var _0xbb74f0=_0x219f04[_0xf084('0x27')]({'plain':!![]});var _0xaf7169=_0xf084('0x28');return db['UserProfileResource'][_0xf084('0x29')]({'where':{'type':_0xaf7169,'resourceId':_0xbb74f0['id']}})[_0xf084('0x26')](function(){return _0x219f04;});})[_0xf084('0x26')](function(){_0x34ff21[_0xf084('0x1b')](0xcc)[_0xf084('0x1c')]();});}};}function handleEntityNotFound(_0x2992cf,_0x2f970f){return function(_0x216db9){if(!_0x216db9){_0x2992cf[_0xf084('0x1a')](0x194);}return _0x216db9;};}function handleError(_0x5beac7,_0x2cd449){_0x2cd449=_0x2cd449||0x1f4;return function(_0x546fb4){logger[_0xf084('0x2a')](_0x546fb4[_0xf084('0x2b')]);if(_0x546fb4['name']){delete _0x546fb4[_0xf084('0x2c')];}_0x5beac7[_0xf084('0x1b')](_0x2cd449)['send'](_0x546fb4);};}exports[_0xf084('0x2d')]=function(_0x57dde0,_0x225039){var _0x7fa78e={},_0x4112b1={},_0x5d963e={'count':0x0,'rows':[]};var _0x5f547b=_[_0xf084('0x2e')](db[_0xf084('0x2f')][_0xf084('0x30')],function(_0x27bebe){return{'name':_0x27bebe[_0xf084('0x31')],'type':_0x27bebe['type'][_0xf084('0x32')]};});_0x4112b1[_0xf084('0x33')]=_[_0xf084('0x2e')](_0x5f547b,_0xf084('0x2c'));_0x4112b1[_0xf084('0x34')]=_['keys'](_0x57dde0['query']);_0x4112b1[_0xf084('0x35')]=_[_0xf084('0x36')](_0x4112b1[_0xf084('0x33')],_0x4112b1[_0xf084('0x34')]);_0x7fa78e['attributes']=_[_0xf084('0x36')](_0x4112b1[_0xf084('0x33')],qs[_0xf084('0x37')](_0x57dde0[_0xf084('0x34')][_0xf084('0x37')]));_0x7fa78e[_0xf084('0x38')]=_0x7fa78e[_0xf084('0x38')]['length']?_0x7fa78e[_0xf084('0x38')]:_0x4112b1[_0xf084('0x33')];if(!_0x57dde0['query']['hasOwnProperty']('nolimit')){_0x7fa78e[_0xf084('0x20')]=qs[_0xf084('0x20')](_0x57dde0['query'][_0xf084('0x20')]);_0x7fa78e[_0xf084('0x1e')]=qs['offset'](_0x57dde0[_0xf084('0x34')][_0xf084('0x1e')]);}_0x7fa78e[_0xf084('0x39')]=qs[_0xf084('0x3a')](_0x57dde0[_0xf084('0x34')][_0xf084('0x3a')]);_0x7fa78e[_0xf084('0x3b')]=qs[_0xf084('0x35')](_[_0xf084('0x3c')](_0x57dde0[_0xf084('0x34')],_0x4112b1[_0xf084('0x35')]),_0x5f547b);if(_0x57dde0['query']['filter']){_0x7fa78e['where']=_[_0xf084('0x3d')](_0x7fa78e[_0xf084('0x3b')],{'$or':_[_0xf084('0x2e')](_0x5f547b,function(_0x182519){if(_0x182519[_0xf084('0x3e')]!==_0xf084('0x3f')){var _0x3e39ba={};_0x3e39ba[_0x182519['name']]={'$like':'%'+_0x57dde0[_0xf084('0x34')][_0xf084('0x40')]+'%'};return _0x3e39ba;}})});}_0x7fa78e=_[_0xf084('0x3d')]({},_0x7fa78e,_0x57dde0[_0xf084('0x41')]);var _0x1c1689={'where':_0x7fa78e['where']};return db[_0xf084('0x2f')][_0xf084('0x21')](_0x1c1689)[_0xf084('0x26')](function(_0x5d6cb4){_0x5d963e[_0xf084('0x21')]=_0x5d6cb4;if(_0x57dde0['query'][_0xf084('0x42')]){_0x7fa78e[_0xf084('0x43')]=[{'all':!![]}];}return db[_0xf084('0x2f')][_0xf084('0x44')](_0x7fa78e);})[_0xf084('0x26')](function(_0x3b6399){_0x5d963e['rows']=_0x3b6399;return _0x5d963e;})[_0xf084('0x26')](respondWithFilteredResult(_0x225039,_0x7fa78e))['catch'](handleError(_0x225039,null));};exports[_0xf084('0x45')]=function(_0x43369d,_0x1434e9){var _0x942ea0={'raw':!![],'where':{'id':_0x43369d[_0xf084('0x46')]['id']}},_0x2aa715={};_0x2aa715['model']=_['keys'](db['Template']['rawAttributes']);_0x2aa715[_0xf084('0x34')]=_['keys'](_0x43369d[_0xf084('0x34')]);_0x2aa715[_0xf084('0x35')]=_[_0xf084('0x36')](_0x2aa715[_0xf084('0x33')],_0x2aa715[_0xf084('0x34')]);_0x942ea0[_0xf084('0x38')]=_[_0xf084('0x36')](_0x2aa715[_0xf084('0x33')],qs[_0xf084('0x37')](_0x43369d['query'][_0xf084('0x37')]));_0x942ea0[_0xf084('0x38')]=_0x942ea0[_0xf084('0x38')][_0xf084('0x47')]?_0x942ea0['attributes']:_0x2aa715[_0xf084('0x33')];if(_0x43369d['query'][_0xf084('0x42')]){_0x942ea0['include']=[{'all':!![]}];}_0x942ea0=_[_0xf084('0x3d')]({},_0x942ea0,_0x43369d[_0xf084('0x41')]);return db[_0xf084('0x2f')][_0xf084('0x48')](_0x942ea0)['then'](handleEntityNotFound(_0x1434e9,null))['then'](respondWithResult(_0x1434e9,null))[_0xf084('0x49')](handleError(_0x1434e9,null));};exports[_0xf084('0x4a')]=function(_0x4642f7,_0x18aa21){return db[_0xf084('0x2f')][_0xf084('0x4a')](_0x4642f7[_0xf084('0x4b')],{})['then'](function(_0x417309){var _0x386b84=_0x4642f7[_0xf084('0x4c')]['get']({'plain':!![]});if(!_0x386b84)throw new Error(_0xf084('0x4d'));if(_0x386b84['role']===_0xf084('0x4c')){var _0x45aed5=_0x417309['get']({'plain':!![]});var _0x20236c=_0xf084('0x28');return db[_0xf084('0x4e')][_0xf084('0x48')]({'where':{'name':_0x20236c,'userProfileId':_0x386b84[_0xf084('0x4f')]},'raw':!![]})['then'](function(_0x504ae9){if(_0x504ae9&&_0x504ae9[_0xf084('0x50')]===0x0){return db[_0xf084('0x51')][_0xf084('0x4a')]({'name':_0x45aed5[_0xf084('0x2c')],'resourceId':_0x45aed5['id'],'type':_0x504ae9[_0xf084('0x2c')],'sectionId':_0x504ae9['id']},{})[_0xf084('0x26')](function(){return _0x417309;});}else{return _0x417309;}})[_0xf084('0x49')](function(_0x518261){logger[_0xf084('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x518261);throw _0x518261;});}return _0x417309;})[_0xf084('0x26')](respondWithResult(_0x18aa21,0xc9))[_0xf084('0x49')](handleError(_0x18aa21,null));};exports[_0xf084('0x25')]=function(_0x2188e3,_0x475d26){if(_0x2188e3[_0xf084('0x4b')]['id']){delete _0x2188e3[_0xf084('0x4b')]['id'];}return db[_0xf084('0x2f')]['find']({'where':{'id':_0x2188e3[_0xf084('0x46')]['id']}})[_0xf084('0x26')](handleEntityNotFound(_0x475d26,null))['then'](saveUpdates(_0x2188e3[_0xf084('0x4b')],null))[_0xf084('0x26')](respondWithResult(_0x475d26,null))[_0xf084('0x49')](handleError(_0x475d26,null));};exports[_0xf084('0x29')]=function(_0x2ca31a,_0x3d5e5b){return db['Template'][_0xf084('0x48')]({'where':{'id':_0x2ca31a[_0xf084('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d5e5b,null))[_0xf084('0x26')](removeEntity(_0x3d5e5b,null))[_0xf084('0x49')](handleError(_0x3d5e5b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 85f4ea0..fe426d9 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 _0x347b=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','Template','tools_templates','lodash','util'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x347b,0x1d7));var _0xb347=function(_0x25a233,_0x1402dd){_0x25a233=_0x25a233-0x0;var _0x48ed17=_0x347b[_0x25a233];return _0x48ed17;};'use strict';var _=require(_0xb347('0x0'));var util=require(_0xb347('0x1'));var logger=require(_0xb347('0x2'))(_0xb347('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb347('0x4'));var fs=require('fs');var path=require(_0xb347('0x5'));var rimraf=require(_0xb347('0x6'));var config=require(_0xb347('0x7'));var attributes=require('./template.attributes');module[_0xb347('0x8')]=function(_0x337049,_0x2133dd){return _0x337049['define'](_0xb347('0x9'),attributes,{'tableName':_0xb347('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7057=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x173ea8,_0x3175a9){var _0x24332c=function(_0x5adbb8){while(--_0x5adbb8){_0x173ea8['push'](_0x173ea8['shift']());}};_0x24332c(++_0x3175a9);}(_0x7057,0x1f2));var _0x7705=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7057[_0x616290];return _0x453879;};'use strict';var _=require(_0x7705('0x0'));var util=require(_0x7705('0x1'));var logger=require(_0x7705('0x2'))(_0x7705('0x3'));var moment=require('moment');var BPromise=require(_0x7705('0x4'));var rp=require(_0x7705('0x5'));var fs=require('fs');var path=require(_0x7705('0x6'));var rimraf=require(_0x7705('0x7'));var config=require(_0x7705('0x8'));var attributes=require(_0x7705('0x9'));module[_0x7705('0xa')]=function(_0x1a5c9d,_0x2978c3){return _0x1a5c9d[_0x7705('0xb')](_0x7705('0xc'),attributes,{'tableName':_0x7705('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 2a50360..c2b278c 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 _0xada2=['client','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5013c9,_0x2b1f81){var _0x1f5ec0=function(_0x4fb900){while(--_0x4fb900){_0x5013c9['push'](_0x5013c9['shift']());}};_0x1f5ec0(++_0x2b1f81);}(_0xada2,0xc2));var _0x2ada=function(_0x16adab,_0x1da88f){_0x16adab=_0x16adab-0x0;var _0x2b0376=_0xada2[_0x16adab];return _0x2b0376;};'use strict';var _=require(_0x2ada('0x0'));var util=require('util');var moment=require(_0x2ada('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ada('0x2'));var fs=require('fs');var Redis=require(_0x2ada('0x3'));var db=require(_0x2ada('0x4'))['db'];var utils=require(_0x2ada('0x5'));var logger=require(_0x2ada('0x6'))(_0x2ada('0x7'));var config=require(_0x2ada('0x8'));var jayson=require(_0x2ada('0x9'));var client=jayson[_0x2ada('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x269249,_0x92ba58,_0x11cf14){return new BPromise(function(_0x2788fd,_0x435437){return client['request'](_0x269249,_0x11cf14)[_0x2ada('0xb')](function(_0x539d07){logger[_0x2ada('0xc')]('Template,\x20%s,\x20%s',_0x92ba58,_0x2ada('0xd'));logger[_0x2ada('0xe')](_0x2ada('0xf'),_0x92ba58,_0x2ada('0xd'),JSON['stringify'](_0x539d07));if(_0x539d07[_0x2ada('0x10')]){if(_0x539d07[_0x2ada('0x10')][_0x2ada('0x11')]===0x1f4){logger['error'](_0x2ada('0x12'),_0x92ba58,_0x539d07['error'][_0x2ada('0x13')]);return _0x435437(_0x539d07[_0x2ada('0x10')]['message']);}logger['error'](_0x2ada('0x12'),_0x92ba58,_0x539d07[_0x2ada('0x10')][_0x2ada('0x13')]);return _0x2788fd(_0x539d07['error'][_0x2ada('0x13')]);}else{logger[_0x2ada('0xc')](_0x2ada('0x12'),_0x92ba58,_0x2ada('0xd'));_0x2788fd(_0x539d07[_0x2ada('0x14')][_0x2ada('0x13')]);}})[_0x2ada('0x15')](function(_0x3111cc){logger['error'](_0x2ada('0x12'),_0x92ba58,_0x3111cc);_0x435437(_0x3111cc);});});}exports[_0x2ada('0x16')]=function(_0x6cae58){var _0x21a548=this;return new Promise(function(_0x815867,_0x38c8cc){return db[_0x2ada('0x17')][_0x2ada('0x18')]({'raw':_0x6cae58[_0x2ada('0x19')]?_0x6cae58[_0x2ada('0x19')][_0x2ada('0x1a')]===undefined?!![]:![]:!![],'where':_0x6cae58[_0x2ada('0x19')]?_0x6cae58[_0x2ada('0x19')][_0x2ada('0x1b')]||null:null,'attributes':_0x6cae58[_0x2ada('0x19')]?_0x6cae58[_0x2ada('0x19')][_0x2ada('0x1c')]||null:null,'limit':_0x6cae58['options']?_0x6cae58[_0x2ada('0x19')][_0x2ada('0x1d')]||null:null,'include':_0x6cae58[_0x2ada('0x19')]?_0x6cae58['options'][_0x2ada('0x1e')]?_[_0x2ada('0x1f')](_0x6cae58[_0x2ada('0x19')][_0x2ada('0x1e')],function(_0x205289){return{'model':db[_0x205289[_0x2ada('0x20')]],'as':_0x205289['as'],'attributes':_0x205289[_0x2ada('0x1c')],'include':_0x205289[_0x2ada('0x1e')]?_[_0x2ada('0x1f')](_0x205289['include'],function(_0x4dd7ce){return{'model':db[_0x4dd7ce[_0x2ada('0x20')]],'as':_0x4dd7ce['as'],'attributes':_0x4dd7ce[_0x2ada('0x1c')],'include':_0x4dd7ce['include']?_['map'](_0x4dd7ce[_0x2ada('0x1e')],function(_0x1c8097){return{'model':db[_0x1c8097['model']],'as':_0x1c8097['as'],'attributes':_0x1c8097[_0x2ada('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2ada('0xb')](function(_0x1c7b62){logger[_0x2ada('0xc')](_0x2ada('0x16'),_0x6cae58);logger[_0x2ada('0xe')](_0x2ada('0x16'),_0x6cae58,JSON[_0x2ada('0x21')](_0x1c7b62));_0x815867(_0x1c7b62);})[_0x2ada('0x15')](function(_0xc0dc53){logger[_0x2ada('0x10')]('GetTemplate',_0xc0dc53['message'],_0x6cae58);_0x38c8cc(_0x21a548['error'](0x1f4,_0xc0dc53[_0x2ada('0x13')]));});});}; \ No newline at end of file +var _0x0299=['code','message','result','catch','Template','findAll','options','raw','attributes','limit','include','map','model','GetTemplate','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x4e62d7,_0x4b89c7){var _0x52923f=function(_0x3c05d3){while(--_0x3c05d3){_0x4e62d7['push'](_0x4e62d7['shift']());}};_0x52923f(++_0x4b89c7);}(_0x0299,0x93));var _0x9029=function(_0x30e657,_0x58c2e7){_0x30e657=_0x30e657-0x0;var _0x19dbe8=_0x0299[_0x30e657];return _0x19dbe8;};'use strict';var _=require(_0x9029('0x0'));var util=require(_0x9029('0x1'));var moment=require(_0x9029('0x2'));var BPromise=require('bluebird');var rs=require(_0x9029('0x3'));var fs=require('fs');var Redis=require(_0x9029('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9029('0x5'))(_0x9029('0x6'));var config=require('../../config/environment');var jayson=require(_0x9029('0x7'));var client=jayson[_0x9029('0x8')][_0x9029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x420e15,_0x2fa849,_0x3064e7){return new BPromise(function(_0x5e46f8,_0x3b467d){return client[_0x9029('0xa')](_0x420e15,_0x3064e7)[_0x9029('0xb')](function(_0x5e16aa){logger[_0x9029('0xc')](_0x9029('0xd'),_0x2fa849,_0x9029('0xe'));logger[_0x9029('0xf')](_0x9029('0x10'),_0x2fa849,_0x9029('0xe'),JSON['stringify'](_0x5e16aa));if(_0x5e16aa[_0x9029('0x11')]){if(_0x5e16aa[_0x9029('0x11')][_0x9029('0x12')]===0x1f4){logger[_0x9029('0x11')](_0x9029('0xd'),_0x2fa849,_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);return _0x3b467d(_0x5e16aa[_0x9029('0x11')]['message']);}logger[_0x9029('0x11')](_0x9029('0xd'),_0x2fa849,_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);return _0x5e46f8(_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);}else{logger[_0x9029('0xc')](_0x9029('0xd'),_0x2fa849,_0x9029('0xe'));_0x5e46f8(_0x5e16aa[_0x9029('0x14')][_0x9029('0x13')]);}})[_0x9029('0x15')](function(_0x30ca00){logger['error']('Template,\x20%s,\x20%s',_0x2fa849,_0x30ca00);_0x3b467d(_0x30ca00);});});}exports['GetTemplate']=function(_0x3ea8be){var _0x49d7f7=this;return new Promise(function(_0x1c6055,_0xaf2051){return db[_0x9029('0x16')][_0x9029('0x17')]({'raw':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')][_0x9029('0x19')]===undefined?!![]:![]:!![],'where':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')]['where']||null:null,'attributes':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be['options'][_0x9029('0x1a')]||null:null,'limit':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')][_0x9029('0x1b')]||null:null,'include':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be['options'][_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x3ea8be[_0x9029('0x18')]['include'],function(_0x1de2b9){return{'model':db[_0x1de2b9['model']],'as':_0x1de2b9['as'],'attributes':_0x1de2b9[_0x9029('0x1a')],'include':_0x1de2b9[_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x1de2b9[_0x9029('0x1c')],function(_0x4fc560){return{'model':db[_0x4fc560[_0x9029('0x1e')]],'as':_0x4fc560['as'],'attributes':_0x4fc560[_0x9029('0x1a')],'include':_0x4fc560[_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x4fc560[_0x9029('0x1c')],function(_0x20f4b3){return{'model':db[_0x20f4b3[_0x9029('0x1e')]],'as':_0x20f4b3['as'],'attributes':_0x20f4b3[_0x9029('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9029('0xb')](function(_0x48832e){logger['info'](_0x9029('0x1f'),_0x3ea8be);logger['debug'](_0x9029('0x1f'),_0x3ea8be,JSON[_0x9029('0x20')](_0x48832e));_0x1c6055(_0x48832e);})[_0x9029('0x15')](function(_0x4a0613){logger['error'](_0x9029('0x1f'),_0x4a0613[_0x9029('0x13')],_0x3ea8be);_0xaf2051(_0x49d7f7['error'](0x1f4,_0x4a0613[_0x9029('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c598ce0..4ef3115 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 _0xfb66=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3db340,_0x32803e){var _0x3b0ef2=function(_0x22cfcd){while(--_0x22cfcd){_0x3db340['push'](_0x3db340['shift']());}};_0x3b0ef2(++_0x32803e);}(_0xfb66,0xf7));var _0x6fb6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x6fb6('0x0'));var util=require(_0x6fb6('0x1'));var path=require(_0x6fb6('0x2'));var timeout=require(_0x6fb6('0x3'));var express=require(_0x6fb6('0x4'));var router=express[_0x6fb6('0x5')]();var fs_extra=require(_0x6fb6('0x6'));var auth=require(_0x6fb6('0x7'));var interaction=require(_0x6fb6('0x8'));var config=require('../../config/environment');var controller=require(_0x6fb6('0x9'));router[_0x6fb6('0xa')]('/',auth[_0x6fb6('0xb')](),controller[_0x6fb6('0xc')]);router[_0x6fb6('0xa')](_0x6fb6('0xd'),auth['isAuthenticated'](),controller[_0x6fb6('0xe')]);router[_0x6fb6('0xa')](_0x6fb6('0xf'),auth['isAuthenticated'](),controller[_0x6fb6('0x10')]);router[_0x6fb6('0xa')](_0x6fb6('0x11'),auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x12')]);router[_0x6fb6('0xa')]('/:id/actions',auth[_0x6fb6('0xb')](),controller['getActions']);router[_0x6fb6('0x13')]('/',auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x14')]);router[_0x6fb6('0x13')](_0x6fb6('0xf'),auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x15')]);router['post'](_0x6fb6('0x11'),auth['isAuthenticated'](),controller[_0x6fb6('0x16')]);router['post']('/:id/actions',auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x17')]);router['put']('/:id',auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x18')]);router[_0x6fb6('0x19')](_0x6fb6('0xd'),auth[_0x6fb6('0xb')](),controller[_0x6fb6('0x1a')]);module[_0x6fb6('0x1b')]=router; \ No newline at end of file +var _0xabf0=['fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','create','addAllCondition','/:id/actions','addAction','put','exports','util','path','connect-timeout','express'];(function(_0x45bfcc,_0x276a99){var _0x58a4d7=function(_0x1befbd){while(--_0x1befbd){_0x45bfcc['push'](_0x45bfcc['shift']());}};_0x58a4d7(++_0x276a99);}(_0xabf0,0x183));var _0x0abf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xabf0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x0abf('0x0'));var path=require(_0x0abf('0x1'));var timeout=require(_0x0abf('0x2'));var express=require(_0x0abf('0x3'));var router=express['Router']();var fs_extra=require(_0x0abf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0abf('0x5'));var config=require(_0x0abf('0x6'));var controller=require(_0x0abf('0x7'));router[_0x0abf('0x8')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0xa')]);router['get'](_0x0abf('0xb'),auth[_0x0abf('0x9')](),controller['show']);router['get'](_0x0abf('0xc'),auth[_0x0abf('0x9')](),controller[_0x0abf('0xd')]);router['get'](_0x0abf('0xe'),auth[_0x0abf('0x9')](),controller['getAnyConditions']);router[_0x0abf('0x8')]('/:id/actions',auth[_0x0abf('0x9')](),controller[_0x0abf('0xf')]);router[_0x0abf('0x10')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0x11')]);router[_0x0abf('0x10')]('/:id/all_conditions',auth[_0x0abf('0x9')](),controller[_0x0abf('0x12')]);router[_0x0abf('0x10')](_0x0abf('0xe'),auth[_0x0abf('0x9')](),controller['addAnyCondition']);router[_0x0abf('0x10')](_0x0abf('0x13'),auth[_0x0abf('0x9')](),controller[_0x0abf('0x14')]);router[_0x0abf('0x15')]('/:id',auth[_0x0abf('0x9')](),controller['update']);router['delete'](_0x0abf('0xb'),auth[_0x0abf('0x9')](),controller['destroy']);module[_0x0abf('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index acc2dd6..aa70f31 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 _0x35f5=['BOOLEAN','sequelize','STRING'];(function(_0x28da24,_0x48eb19){var _0x5315a2=function(_0xa02c10){while(--_0xa02c10){_0x28da24['push'](_0x28da24['shift']());}};_0x5315a2(++_0x48eb19);}(_0x35f5,0x100));var _0x535f=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x35f5[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x535f('0x0'));module['exports']={'name':{'type':Sequelize[_0x535f('0x1')]},'channel':{'type':Sequelize[_0x535f('0x1')]},'description':{'type':Sequelize[_0x535f('0x1')]},'status':{'type':Sequelize[_0x535f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa600=['BOOLEAN','sequelize','STRING'];(function(_0x3adf08,_0x10d810){var _0xd14b6c=function(_0x1fb20e){while(--_0x1fb20e){_0x3adf08['push'](_0x3adf08['shift']());}};_0xd14b6c(++_0x10d810);}(_0xa600,0x166));var _0x0a60=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0xa600[_0xf10840];return _0x1fdf7e;};'use strict';var Sequelize=require(_0x0a60('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0a60('0x1')]},'description':{'type':Sequelize[_0x0a60('0x1')]},'status':{'type':Sequelize[_0x0a60('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 32a0764..dba791a 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 _0x58bf=['count','set','Content-Range','json','apply','reject','update','then','destroy','UserProfileResource','end','error','stack','send','index','map','Trigger','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','options','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','api','../../config/utils','../../mysqldb','status','offset','undefined','limit'];(function(_0xb81525,_0x4683a4){var _0x522f75=function(_0x4329a0){while(--_0x4329a0){_0xb81525['push'](_0xb81525['shift']());}};_0x522f75(++_0x4683a4);}(_0x58bf,0x1c7));var _0xf58b=function(_0xe95191,_0x1513c0){_0xe95191=_0xe95191-0x0;var _0x2845cc=_0x58bf[_0xe95191];return _0x2845cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf58b('0x0'));var zipdir=require(_0xf58b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf58b('0x2'));var moment=require(_0xf58b('0x3'));var BPromise=require(_0xf58b('0x4'));var Mustache=require(_0xf58b('0x5'));var util=require(_0xf58b('0x6'));var path=require(_0xf58b('0x7'));var sox=require(_0xf58b('0x8'));var csv=require('to-csv');var ejs=require(_0xf58b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf58b('0xa'));var squel=require(_0xf58b('0xb'));var crypto=require(_0xf58b('0xc'));var jsforce=require(_0xf58b('0xd'));var deskjs=require(_0xf58b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf58b('0xf'));var Papa=require(_0xf58b('0x10'));var Redis=require(_0xf58b('0x11'));var authService=require(_0xf58b('0x12'));var qs=require(_0xf58b('0x13'));var as=require(_0xf58b('0x14'));var hardwareService=require(_0xf58b('0x15'));var logger=require(_0xf58b('0x16'))(_0xf58b('0x17'));var utils=require(_0xf58b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf58b('0x19'))['db'];function respondWithStatusCode(_0xa07b72,_0x39957b){_0x39957b=_0x39957b||0xcc;return function(_0x2ab796){if(_0x2ab796){return _0xa07b72['sendStatus'](_0x39957b);}return _0xa07b72[_0xf58b('0x1a')](_0x39957b)['end']();};}function respondWithResult(_0x17a7eb,_0x23b5ff){_0x23b5ff=_0x23b5ff||0xc8;return function(_0x377733){if(_0x377733){return _0x17a7eb[_0xf58b('0x1a')](_0x23b5ff)['json'](_0x377733);}};}function respondWithFilteredResult(_0x3c58c9,_0x2b1104){return function(_0x38a554){if(_0x38a554){var _0x1c7f3c=typeof _0x2b1104[_0xf58b('0x1b')]===_0xf58b('0x1c')&&typeof _0x2b1104[_0xf58b('0x1d')]===_0xf58b('0x1c');var _0x1133e6=_0x38a554['count'];var _0x8a6e1b=_0x1c7f3c?0x0:_0x2b1104[_0xf58b('0x1b')];var _0x45f98f=_0x1c7f3c?_0x38a554[_0xf58b('0x1e')]:_0x2b1104[_0xf58b('0x1b')]+_0x2b1104[_0xf58b('0x1d')];var _0x5e0160;if(_0x45f98f>=_0x1133e6){_0x45f98f=_0x1133e6;_0x5e0160=0xc8;}else{_0x5e0160=0xce;}_0x3c58c9[_0xf58b('0x1a')](_0x5e0160);return _0x3c58c9[_0xf58b('0x1f')](_0xf58b('0x20'),_0x8a6e1b+'-'+_0x45f98f+'/'+_0x1133e6)[_0xf58b('0x21')](_0x38a554);}return null;};}function patchUpdates(_0x34c69d){return function(_0x3411e8){try{jsonpatch[_0xf58b('0x22')](_0x3411e8,_0x34c69d,!![]);}catch(_0x5dbb4e){return BPromise[_0xf58b('0x23')](_0x5dbb4e);}return _0x3411e8['save']();};}function saveUpdates(_0x4edd72,_0x57730c){return function(_0x46fabd){if(_0x46fabd){return _0x46fabd[_0xf58b('0x24')](_0x4edd72)[_0xf58b('0x25')](function(_0x51db2b){return _0x51db2b;});}return null;};}function removeEntity(_0x5bd960,_0x461af0){return function(_0x4f4fb1){if(_0x4f4fb1){return _0x4f4fb1[_0xf58b('0x26')]()[_0xf58b('0x25')](function(){var _0x1a06e5=_0x4f4fb1['get']({'plain':!![]});var _0xad45b3='Triggers';return db[_0xf58b('0x27')]['destroy']({'where':{'type':_0xad45b3,'resourceId':_0x1a06e5['id']}})[_0xf58b('0x25')](function(){return _0x4f4fb1;});})[_0xf58b('0x25')](function(){_0x5bd960[_0xf58b('0x1a')](0xcc)[_0xf58b('0x28')]();});}};}function handleEntityNotFound(_0x82212,_0x3994b2){return function(_0x39fed6){if(!_0x39fed6){_0x82212['sendStatus'](0x194);}return _0x39fed6;};}function handleError(_0x2b9ec1,_0x3aa28f){_0x3aa28f=_0x3aa28f||0x1f4;return function(_0xfedd54){logger[_0xf58b('0x29')](_0xfedd54[_0xf58b('0x2a')]);if(_0xfedd54['name']){delete _0xfedd54['name'];}_0x2b9ec1['status'](_0x3aa28f)[_0xf58b('0x2b')](_0xfedd54);};}exports[_0xf58b('0x2c')]=function(_0x553516,_0x3deae5){var _0xe96de5={},_0x4d67da={},_0x4e5dca={'count':0x0,'rows':[]};var _0x499bd5=_[_0xf58b('0x2d')](db[_0xf58b('0x2e')][_0xf58b('0x2f')],function(_0xe445e){return{'name':_0xe445e['fieldName'],'type':_0xe445e[_0xf58b('0x30')][_0xf58b('0x31')]};});_0x4d67da[_0xf58b('0x32')]=_[_0xf58b('0x2d')](_0x499bd5,_0xf58b('0x33'));_0x4d67da[_0xf58b('0x34')]=_[_0xf58b('0x35')](_0x553516['query']);_0x4d67da[_0xf58b('0x36')]=_[_0xf58b('0x37')](_0x4d67da[_0xf58b('0x32')],_0x4d67da[_0xf58b('0x34')]);_0xe96de5[_0xf58b('0x38')]=_[_0xf58b('0x37')](_0x4d67da['model'],qs[_0xf58b('0x39')](_0x553516[_0xf58b('0x34')][_0xf58b('0x39')]));_0xe96de5[_0xf58b('0x38')]=_0xe96de5[_0xf58b('0x38')][_0xf58b('0x3a')]?_0xe96de5['attributes']:_0x4d67da[_0xf58b('0x32')];if(!_0x553516['query']['hasOwnProperty']('nolimit')){_0xe96de5[_0xf58b('0x1d')]=qs[_0xf58b('0x1d')](_0x553516[_0xf58b('0x34')][_0xf58b('0x1d')]);_0xe96de5['offset']=qs[_0xf58b('0x1b')](_0x553516[_0xf58b('0x34')][_0xf58b('0x1b')]);}_0xe96de5[_0xf58b('0x3b')]=qs['sort'](_0x553516[_0xf58b('0x34')][_0xf58b('0x3c')]);_0xe96de5[_0xf58b('0x3d')]=qs[_0xf58b('0x36')](_[_0xf58b('0x3e')](_0x553516['query'],_0x4d67da[_0xf58b('0x36')]),_0x499bd5);if(_0x553516[_0xf58b('0x34')][_0xf58b('0x3f')]){_0xe96de5[_0xf58b('0x3d')]=_[_0xf58b('0x40')](_0xe96de5[_0xf58b('0x3d')],{'$or':_['map'](_0x499bd5,function(_0x540362){if(_0x540362[_0xf58b('0x30')]!=='VIRTUAL'){var _0x3c73ff={};_0x3c73ff[_0x540362[_0xf58b('0x33')]]={'$like':'%'+_0x553516['query'][_0xf58b('0x3f')]+'%'};return _0x3c73ff;}})});}_0xe96de5=_[_0xf58b('0x40')]({},_0xe96de5,_0x553516['options']);var _0x55a438={'where':_0xe96de5[_0xf58b('0x3d')]};return db[_0xf58b('0x2e')][_0xf58b('0x1e')](_0x55a438)[_0xf58b('0x25')](function(_0x277766){_0x4e5dca['count']=_0x277766;if(_0x553516['query']['includeAll']){_0xe96de5[_0xf58b('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xf58b('0x42')](_0xe96de5);})[_0xf58b('0x25')](function(_0x3b5d59){_0x4e5dca[_0xf58b('0x43')]=_0x3b5d59;return _0x4e5dca;})[_0xf58b('0x25')](respondWithFilteredResult(_0x3deae5,_0xe96de5))[_0xf58b('0x44')](handleError(_0x3deae5,null));};exports[_0xf58b('0x45')]=function(_0x3d407b,_0x3c4dbc){var _0x2dcf1a={'raw':![],'where':{'id':_0x3d407b[_0xf58b('0x46')]['id']}},_0x1d78fc={};_0x1d78fc[_0xf58b('0x32')]=_['keys'](db[_0xf58b('0x2e')][_0xf58b('0x2f')]);_0x1d78fc[_0xf58b('0x34')]=_[_0xf58b('0x35')](_0x3d407b[_0xf58b('0x34')]);_0x1d78fc[_0xf58b('0x36')]=_['intersection'](_0x1d78fc[_0xf58b('0x32')],_0x1d78fc[_0xf58b('0x34')]);_0x2dcf1a['attributes']=_[_0xf58b('0x37')](_0x1d78fc[_0xf58b('0x32')],qs['fields'](_0x3d407b[_0xf58b('0x34')][_0xf58b('0x39')]));_0x2dcf1a[_0xf58b('0x38')]=_0x2dcf1a[_0xf58b('0x38')][_0xf58b('0x3a')]?_0x2dcf1a[_0xf58b('0x38')]:_0x1d78fc['model'];if(_0x3d407b['query']['includeAll']){_0x2dcf1a[_0xf58b('0x41')]=[{'all':!![]}];}_0x2dcf1a=_[_0xf58b('0x40')]({},_0x2dcf1a,_0x3d407b['options']);return db[_0xf58b('0x2e')][_0xf58b('0x47')](_0x2dcf1a)[_0xf58b('0x25')](handleEntityNotFound(_0x3c4dbc,null))[_0xf58b('0x25')](respondWithResult(_0x3c4dbc,null))[_0xf58b('0x44')](handleError(_0x3c4dbc,null));};exports['create']=function(_0x3aabbb,_0x431f8d){return db[_0xf58b('0x2e')]['create'](_0x3aabbb[_0xf58b('0x48')],{})[_0xf58b('0x25')](function(_0x9ea148){var _0x224aad=_0x3aabbb[_0xf58b('0x49')][_0xf58b('0x4a')]({'plain':!![]});if(!_0x224aad)throw new Error(_0xf58b('0x4b'));if(_0x224aad[_0xf58b('0x4c')]===_0xf58b('0x49')){var _0x2cb077=_0x9ea148['get']({'plain':!![]});var _0x3a8df0=_0xf58b('0x4d');return db[_0xf58b('0x4e')][_0xf58b('0x47')]({'where':{'name':_0x3a8df0,'userProfileId':_0x224aad['userProfileId']},'raw':!![]})['then'](function(_0x246f78){if(_0x246f78&&_0x246f78[_0xf58b('0x4f')]===0x0){return db['UserProfileResource'][_0xf58b('0x50')]({'name':_0x2cb077['name'],'resourceId':_0x2cb077['id'],'type':_0x246f78[_0xf58b('0x33')],'sectionId':_0x246f78['id']},{})[_0xf58b('0x25')](function(){return _0x9ea148;});}else{return _0x9ea148;}})['catch'](function(_0x5af9fb){logger[_0xf58b('0x29')](_0xf58b('0x51'),_0x5af9fb);throw _0x5af9fb;});}return _0x9ea148;})[_0xf58b('0x25')](respondWithResult(_0x431f8d,0xc9))['catch'](handleError(_0x431f8d,null));};exports[_0xf58b('0x24')]=function(_0x57ea31,_0x32e6d0){if(_0x57ea31[_0xf58b('0x48')]['id']){delete _0x57ea31[_0xf58b('0x48')]['id'];}return db[_0xf58b('0x2e')]['find']({'where':{'id':_0x57ea31[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x32e6d0,null))[_0xf58b('0x25')](saveUpdates(_0x57ea31[_0xf58b('0x48')],null))[_0xf58b('0x25')](respondWithResult(_0x32e6d0,null))[_0xf58b('0x44')](handleError(_0x32e6d0,null));};exports[_0xf58b('0x26')]=function(_0x1751fb,_0x3dba3d){return db[_0xf58b('0x2e')]['find']({'where':{'id':_0x1751fb[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x3dba3d,null))[_0xf58b('0x25')](removeEntity(_0x3dba3d,null))['catch'](handleError(_0x3dba3d,null));};exports[_0xf58b('0x52')]=function(_0x121023,_0xf96fec,_0x1a08d3){if(_0x121023[_0xf58b('0x48')]['id']){delete _0x121023['body']['id'];}return db[_0xf58b('0x2e')][_0xf58b('0x47')]({'where':{'id':_0x121023['params']['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0xf96fec,null))[_0xf58b('0x25')](function(_0xd79871){if(_0xd79871){_0x121023[_0xf58b('0x48')][_0xf58b('0x53')]=_0xd79871['id'];return db[_0xf58b('0x54')][_0xf58b('0x50')](_0x121023[_0xf58b('0x48')]);}})[_0xf58b('0x25')](respondWithResult(_0xf96fec,null))[_0xf58b('0x44')](handleError(_0xf96fec,null));};exports[_0xf58b('0x55')]=function(_0x3a79fc,_0x433d67,_0x242202){if(_0x3a79fc[_0xf58b('0x48')]['id']){delete _0x3a79fc[_0xf58b('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3a79fc[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x433d67,null))[_0xf58b('0x25')](function(_0xe2befb){if(_0xe2befb){_0x3a79fc[_0xf58b('0x48')][_0xf58b('0x56')]=_0xe2befb['id'];return db[_0xf58b('0x54')]['create'](_0x3a79fc[_0xf58b('0x48')]);}})[_0xf58b('0x25')](respondWithResult(_0x433d67,null))['catch'](handleError(_0x433d67,null));};exports[_0xf58b('0x57')]=function(_0x365db3,_0x2f47cf,_0x5c02fb){var _0x2d4ac6={};var _0x24ac12={};var _0x4fe5cd;var _0x3694a8;return db[_0xf58b('0x2e')][_0xf58b('0x58')]({'where':{'id':_0x365db3[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x2f47cf,null))[_0xf58b('0x25')](function(_0x89f581){if(_0x89f581){_0x4fe5cd=_0x89f581;_0x24ac12[_0xf58b('0x32')]=_[_0xf58b('0x35')](db[_0xf58b('0x54')][_0xf58b('0x2f')]);_0x24ac12[_0xf58b('0x34')]=_[_0xf58b('0x35')](_0x365db3[_0xf58b('0x34')]);_0x24ac12[_0xf58b('0x36')]=_[_0xf58b('0x37')](_0x24ac12[_0xf58b('0x32')],_0x24ac12[_0xf58b('0x34')]);_0x2d4ac6[_0xf58b('0x38')]=_[_0xf58b('0x37')](_0x24ac12['model'],qs[_0xf58b('0x39')](_0x365db3[_0xf58b('0x34')][_0xf58b('0x39')]));_0x2d4ac6[_0xf58b('0x38')]=_0x2d4ac6['attributes'][_0xf58b('0x3a')]?_0x2d4ac6[_0xf58b('0x38')]:_0x24ac12['model'];_0x2d4ac6[_0xf58b('0x3b')]=qs[_0xf58b('0x3c')](_0x365db3[_0xf58b('0x34')]['sort']);_0x2d4ac6['where']=qs['filters'](_[_0xf58b('0x3e')](_0x365db3[_0xf58b('0x34')],_0x24ac12[_0xf58b('0x36')]));if(_0x365db3['query']['filter']){_0x2d4ac6['where']=_[_0xf58b('0x40')](_0x2d4ac6[_0xf58b('0x3d')],{'$or':_[_0xf58b('0x2d')](_0x2d4ac6[_0xf58b('0x38')],function(_0x77ff8d){var _0x1d9fa9={};_0x1d9fa9[_0x77ff8d]={'$like':'%'+_0x365db3['query'][_0xf58b('0x3f')]+'%'};return _0x1d9fa9;})});}_0x2d4ac6=_['merge']({},_0x2d4ac6,_0x365db3['options']);return _0x4fe5cd['getAllConditions'](_0x2d4ac6);}})[_0xf58b('0x25')](function(_0x4448ec){if(_0x4448ec){_0x3694a8=_0x4448ec[_0xf58b('0x3a')];if(!_0x365db3[_0xf58b('0x34')]['hasOwnProperty'](_0xf58b('0x59'))){_0x2d4ac6['limit']=qs['limit'](_0x365db3[_0xf58b('0x34')][_0xf58b('0x1d')]);_0x2d4ac6[_0xf58b('0x1b')]=qs[_0xf58b('0x1b')](_0x365db3['query'][_0xf58b('0x1b')]);}return _0x4fe5cd[_0xf58b('0x57')](_0x2d4ac6);}})['then'](function(_0x35c1c3){if(_0x35c1c3){return _0x35c1c3?{'count':_0x3694a8,'rows':_0x35c1c3}:null;}})[_0xf58b('0x25')](respondWithResult(_0x2f47cf,null))[_0xf58b('0x44')](handleError(_0x2f47cf,null));};exports['getAnyConditions']=function(_0x14d1b8,_0x59d570,_0xd69419){var _0xd640e6={};var _0x52975={};var _0x458669;var _0x45f2eb;return db[_0xf58b('0x2e')][_0xf58b('0x58')]({'where':{'id':_0x14d1b8[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x59d570,null))[_0xf58b('0x25')](function(_0x2e7717){if(_0x2e7717){_0x458669=_0x2e7717;_0x52975['model']=_[_0xf58b('0x35')](db[_0xf58b('0x54')][_0xf58b('0x2f')]);_0x52975[_0xf58b('0x34')]=_[_0xf58b('0x35')](_0x14d1b8['query']);_0x52975[_0xf58b('0x36')]=_['intersection'](_0x52975[_0xf58b('0x32')],_0x52975[_0xf58b('0x34')]);_0xd640e6[_0xf58b('0x38')]=_[_0xf58b('0x37')](_0x52975[_0xf58b('0x32')],qs[_0xf58b('0x39')](_0x14d1b8[_0xf58b('0x34')]['fields']));_0xd640e6[_0xf58b('0x38')]=_0xd640e6[_0xf58b('0x38')]['length']?_0xd640e6[_0xf58b('0x38')]:_0x52975['model'];_0xd640e6[_0xf58b('0x3b')]=qs[_0xf58b('0x3c')](_0x14d1b8['query'][_0xf58b('0x3c')]);_0xd640e6[_0xf58b('0x3d')]=qs[_0xf58b('0x36')](_['pick'](_0x14d1b8[_0xf58b('0x34')],_0x52975['filters']));if(_0x14d1b8[_0xf58b('0x34')][_0xf58b('0x3f')]){_0xd640e6[_0xf58b('0x3d')]=_[_0xf58b('0x40')](_0xd640e6['where'],{'$or':_[_0xf58b('0x2d')](_0xd640e6[_0xf58b('0x38')],function(_0x57c6c5){var _0x547545={};_0x547545[_0x57c6c5]={'$like':'%'+_0x14d1b8[_0xf58b('0x34')]['filter']+'%'};return _0x547545;})});}_0xd640e6=_[_0xf58b('0x40')]({},_0xd640e6,_0x14d1b8['options']);return _0x458669['getAnyConditions'](_0xd640e6);}})[_0xf58b('0x25')](function(_0x416362){if(_0x416362){_0x45f2eb=_0x416362[_0xf58b('0x3a')];if(!_0x14d1b8[_0xf58b('0x34')][_0xf58b('0x5a')](_0xf58b('0x59'))){_0xd640e6['limit']=qs[_0xf58b('0x1d')](_0x14d1b8[_0xf58b('0x34')]['limit']);_0xd640e6['offset']=qs[_0xf58b('0x1b')](_0x14d1b8[_0xf58b('0x34')]['offset']);}return _0x458669[_0xf58b('0x5b')](_0xd640e6);}})[_0xf58b('0x25')](function(_0x2da1a8){if(_0x2da1a8){return _0x2da1a8?{'count':_0x45f2eb,'rows':_0x2da1a8}:null;}})['then'](respondWithResult(_0x59d570,null))['catch'](handleError(_0x59d570,null));};exports[_0xf58b('0x5c')]=function(_0x52d3f3,_0x28dcf7,_0x51d156){if(_0x52d3f3[_0xf58b('0x48')]['id']){delete _0x52d3f3[_0xf58b('0x48')]['id'];}return db[_0xf58b('0x2e')][_0xf58b('0x47')]({'where':{'id':_0x52d3f3['params']['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x28dcf7,null))['then'](function(_0x1f6de0){if(_0x1f6de0){_0x52d3f3[_0xf58b('0x48')][_0xf58b('0x5d')]=_0x1f6de0['id'];return db[_0xf58b('0x5e')][_0xf58b('0x50')](_0x52d3f3['body']);}})[_0xf58b('0x25')](respondWithResult(_0x28dcf7,null))[_0xf58b('0x44')](handleError(_0x28dcf7,null));};exports[_0xf58b('0x5f')]=function(_0x2bac02,_0x211f9d,_0x394704){var _0x2ac72e={};var _0xe2ebfd={};var _0x2dc173;var _0x59de84;return db[_0xf58b('0x2e')][_0xf58b('0x58')]({'where':{'id':_0x2bac02[_0xf58b('0x46')]['id']}})[_0xf58b('0x25')](handleEntityNotFound(_0x211f9d,null))[_0xf58b('0x25')](function(_0x87051c){if(_0x87051c){_0x2dc173=_0x87051c;_0xe2ebfd[_0xf58b('0x32')]=_['keys'](db[_0xf58b('0x5e')][_0xf58b('0x2f')]);_0xe2ebfd[_0xf58b('0x34')]=_[_0xf58b('0x35')](_0x2bac02[_0xf58b('0x34')]);_0xe2ebfd[_0xf58b('0x36')]=_[_0xf58b('0x37')](_0xe2ebfd[_0xf58b('0x32')],_0xe2ebfd[_0xf58b('0x34')]);_0x2ac72e[_0xf58b('0x38')]=_['intersection'](_0xe2ebfd['model'],qs[_0xf58b('0x39')](_0x2bac02['query'][_0xf58b('0x39')]));_0x2ac72e[_0xf58b('0x38')]=_0x2ac72e[_0xf58b('0x38')][_0xf58b('0x3a')]?_0x2ac72e['attributes']:_0xe2ebfd[_0xf58b('0x32')];_0x2ac72e[_0xf58b('0x3b')]=qs[_0xf58b('0x3c')](_0x2bac02[_0xf58b('0x34')][_0xf58b('0x3c')]);_0x2ac72e['where']=qs['filters'](_[_0xf58b('0x3e')](_0x2bac02[_0xf58b('0x34')],_0xe2ebfd['filters']));if(_0x2bac02[_0xf58b('0x34')]['filter']){_0x2ac72e[_0xf58b('0x3d')]=_[_0xf58b('0x40')](_0x2ac72e[_0xf58b('0x3d')],{'$or':_[_0xf58b('0x2d')](_0x2ac72e[_0xf58b('0x38')],function(_0x1e1fed){var _0x5b8109={};_0x5b8109[_0x1e1fed]={'$like':'%'+_0x2bac02['query'][_0xf58b('0x3f')]+'%'};return _0x5b8109;})});}_0x2ac72e=_['merge']({},_0x2ac72e,_0x2bac02[_0xf58b('0x60')]);return _0x2dc173['getActions'](_0x2ac72e);}})[_0xf58b('0x25')](function(_0x583f6f){if(_0x583f6f){_0x59de84=_0x583f6f[_0xf58b('0x3a')];if(!_0x2bac02[_0xf58b('0x34')][_0xf58b('0x5a')](_0xf58b('0x59'))){_0x2ac72e[_0xf58b('0x1d')]=qs['limit'](_0x2bac02[_0xf58b('0x34')]['limit']);_0x2ac72e[_0xf58b('0x1b')]=qs['offset'](_0x2bac02[_0xf58b('0x34')]['offset']);}return _0x2dc173[_0xf58b('0x5f')](_0x2ac72e);}})['then'](function(_0x441423){if(_0x441423){return _0x441423?{'count':_0x59de84,'rows':_0x441423}:null;}})[_0xf58b('0x25')](respondWithResult(_0x211f9d,null))[_0xf58b('0x44')](handleError(_0x211f9d,null));}; \ No newline at end of file +var _0xd164=['name','send','index','map','Trigger','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','catch','keys','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','Triggers','destroy','error','stack'];(function(_0x54818d,_0x2853a5){var _0x420ccb=function(_0xb4c6cd){while(--_0xb4c6cd){_0x54818d['push'](_0x54818d['shift']());}};_0x420ccb(++_0x2853a5);}(_0xd164,0xde));var _0x4d16=function(_0x43b5ce,_0x1158a4){_0x43b5ce=_0x43b5ce-0x0;var _0x295a0a=_0xd164[_0x43b5ce];return _0x295a0a;};'use strict';var emlformat=require(_0x4d16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d16('0x1'));var jsonpatch=require(_0x4d16('0x2'));var rp=require(_0x4d16('0x3'));var moment=require(_0x4d16('0x4'));var BPromise=require(_0x4d16('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d16('0x6'));var sox=require(_0x4d16('0x7'));var csv=require('to-csv');var ejs=require(_0x4d16('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d16('0x9'));var squel=require(_0x4d16('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d16('0xb'));var deskjs=require(_0x4d16('0xc'));var toCsv=require(_0x4d16('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d16('0xe'));var authService=require(_0x4d16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4d16('0x10'));var hardwareService=require(_0x4d16('0x11'));var logger=require('../../config/logger')(_0x4d16('0x12'));var utils=require('../../config/utils');var config=require(_0x4d16('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d16('0x14'))['db'];function respondWithStatusCode(_0x5bb676,_0x50ee67){_0x50ee67=_0x50ee67||0xcc;return function(_0x471a3c){if(_0x471a3c){return _0x5bb676[_0x4d16('0x15')](_0x50ee67);}return _0x5bb676[_0x4d16('0x16')](_0x50ee67)['end']();};}function respondWithResult(_0x1218eb,_0x159bb9){_0x159bb9=_0x159bb9||0xc8;return function(_0x12e55b){if(_0x12e55b){return _0x1218eb[_0x4d16('0x16')](_0x159bb9)[_0x4d16('0x17')](_0x12e55b);}};}function respondWithFilteredResult(_0x294d0a,_0x430ef5){return function(_0x274af8){if(_0x274af8){var _0x203d69=typeof _0x430ef5[_0x4d16('0x18')]==='undefined'&&typeof _0x430ef5[_0x4d16('0x19')]==='undefined';var _0x9b43bc=_0x274af8[_0x4d16('0x1a')];var _0x1c0a4c=_0x203d69?0x0:_0x430ef5[_0x4d16('0x18')];var _0x59d289=_0x203d69?_0x274af8[_0x4d16('0x1a')]:_0x430ef5[_0x4d16('0x18')]+_0x430ef5['limit'];var _0x39da6e;if(_0x59d289>=_0x9b43bc){_0x59d289=_0x9b43bc;_0x39da6e=0xc8;}else{_0x39da6e=0xce;}_0x294d0a['status'](_0x39da6e);return _0x294d0a['set']('Content-Range',_0x1c0a4c+'-'+_0x59d289+'/'+_0x9b43bc)[_0x4d16('0x17')](_0x274af8);}return null;};}function patchUpdates(_0x3ba279){return function(_0x8e81ac){try{jsonpatch[_0x4d16('0x1b')](_0x8e81ac,_0x3ba279,!![]);}catch(_0x18d8f0){return BPromise[_0x4d16('0x1c')](_0x18d8f0);}return _0x8e81ac[_0x4d16('0x1d')]();};}function saveUpdates(_0x1cd972,_0x39e4e9){return function(_0x366ce4){if(_0x366ce4){return _0x366ce4[_0x4d16('0x1e')](_0x1cd972)[_0x4d16('0x1f')](function(_0xe34f93){return _0xe34f93;});}return null;};}function removeEntity(_0x162c24,_0xbfbe7d){return function(_0x1c5d10){if(_0x1c5d10){return _0x1c5d10['destroy']()['then'](function(){var _0x22c341=_0x1c5d10['get']({'plain':!![]});var _0x40e890=_0x4d16('0x20');return db['UserProfileResource'][_0x4d16('0x21')]({'where':{'type':_0x40e890,'resourceId':_0x22c341['id']}})['then'](function(){return _0x1c5d10;});})[_0x4d16('0x1f')](function(){_0x162c24[_0x4d16('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eede0,_0x165c0f){return function(_0x2085ed){if(!_0x2085ed){_0x3eede0['sendStatus'](0x194);}return _0x2085ed;};}function handleError(_0x6aaf7c,_0x2a3125){_0x2a3125=_0x2a3125||0x1f4;return function(_0x1af3a1){logger[_0x4d16('0x22')](_0x1af3a1[_0x4d16('0x23')]);if(_0x1af3a1['name']){delete _0x1af3a1[_0x4d16('0x24')];}_0x6aaf7c[_0x4d16('0x16')](_0x2a3125)[_0x4d16('0x25')](_0x1af3a1);};}exports[_0x4d16('0x26')]=function(_0x3a56a4,_0x45f832){var _0x2c9707={},_0x3cc95d={},_0x331e54={'count':0x0,'rows':[]};var _0x2e1600=_[_0x4d16('0x27')](db[_0x4d16('0x28')][_0x4d16('0x29')],function(_0x51fe27){return{'name':_0x51fe27['fieldName'],'type':_0x51fe27['type'][_0x4d16('0x2a')]};});_0x3cc95d[_0x4d16('0x2b')]=_['map'](_0x2e1600,'name');_0x3cc95d[_0x4d16('0x2c')]=_['keys'](_0x3a56a4[_0x4d16('0x2c')]);_0x3cc95d[_0x4d16('0x2d')]=_['intersection'](_0x3cc95d['model'],_0x3cc95d['query']);_0x2c9707[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x3cc95d[_0x4d16('0x2b')],qs['fields'](_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x30')]));_0x2c9707[_0x4d16('0x2e')]=_0x2c9707['attributes'][_0x4d16('0x31')]?_0x2c9707[_0x4d16('0x2e')]:_0x3cc95d[_0x4d16('0x2b')];if(!_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x32')](_0x4d16('0x33'))){_0x2c9707[_0x4d16('0x19')]=qs['limit'](_0x3a56a4['query'][_0x4d16('0x19')]);_0x2c9707['offset']=qs['offset'](_0x3a56a4['query']['offset']);}_0x2c9707[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x2c9707[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_['pick'](_0x3a56a4[_0x4d16('0x2c')],_0x3cc95d[_0x4d16('0x2d')]),_0x2e1600);if(_0x3a56a4[_0x4d16('0x2c')]['filter']){_0x2c9707[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x2c9707[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x2e1600,function(_0x54c786){if(_0x54c786['type']!==_0x4d16('0x38')){var _0x2f49c8={};_0x2f49c8[_0x54c786[_0x4d16('0x24')]]={'$like':'%'+_0x3a56a4['query'][_0x4d16('0x39')]+'%'};return _0x2f49c8;}})});}_0x2c9707=_['merge']({},_0x2c9707,_0x3a56a4['options']);var _0x2ea7e5={'where':_0x2c9707['where']};return db[_0x4d16('0x28')][_0x4d16('0x1a')](_0x2ea7e5)['then'](function(_0x2d49e1){_0x331e54[_0x4d16('0x1a')]=_0x2d49e1;if(_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x3a')]){_0x2c9707['include']=[{'all':!![]}];}return db['Trigger'][_0x4d16('0x3b')](_0x2c9707);})[_0x4d16('0x1f')](function(_0x1b7c3e){_0x331e54['rows']=_0x1b7c3e;return _0x331e54;})[_0x4d16('0x1f')](respondWithFilteredResult(_0x45f832,_0x2c9707))[_0x4d16('0x3c')](handleError(_0x45f832,null));};exports['show']=function(_0x3e0f54,_0x26e7eb){var _0xc106a5={'raw':![],'where':{'id':_0x3e0f54['params']['id']}},_0x24b695={};_0x24b695[_0x4d16('0x2b')]=_[_0x4d16('0x3d')](db['Trigger'][_0x4d16('0x29')]);_0x24b695[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x3e0f54[_0x4d16('0x2c')]);_0x24b695[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0x24b695[_0x4d16('0x2b')],_0x24b695['query']);_0xc106a5[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x24b695[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x3e0f54['query'][_0x4d16('0x30')]));_0xc106a5[_0x4d16('0x2e')]=_0xc106a5[_0x4d16('0x2e')][_0x4d16('0x31')]?_0xc106a5[_0x4d16('0x2e')]:_0x24b695['model'];if(_0x3e0f54['query']['includeAll']){_0xc106a5[_0x4d16('0x3e')]=[{'all':!![]}];}_0xc106a5=_[_0x4d16('0x37')]({},_0xc106a5,_0x3e0f54[_0x4d16('0x3f')]);return db['Trigger'][_0x4d16('0x40')](_0xc106a5)['then'](handleEntityNotFound(_0x26e7eb,null))[_0x4d16('0x1f')](respondWithResult(_0x26e7eb,null))['catch'](handleError(_0x26e7eb,null));};exports[_0x4d16('0x41')]=function(_0x1ad52a,_0x5a3e81){return db[_0x4d16('0x28')][_0x4d16('0x41')](_0x1ad52a['body'],{})[_0x4d16('0x1f')](function(_0x4b0ff2){var _0x1b22fc=_0x1ad52a['user']['get']({'plain':!![]});if(!_0x1b22fc)throw new Error(_0x4d16('0x42'));if(_0x1b22fc[_0x4d16('0x43')]===_0x4d16('0x44')){var _0x29532e=_0x4b0ff2[_0x4d16('0x45')]({'plain':!![]});var _0x346f21=_0x4d16('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x346f21,'userProfileId':_0x1b22fc[_0x4d16('0x46')]},'raw':!![]})[_0x4d16('0x1f')](function(_0x4eee9a){if(_0x4eee9a&&_0x4eee9a[_0x4d16('0x47')]===0x0){return db['UserProfileResource'][_0x4d16('0x41')]({'name':_0x29532e[_0x4d16('0x24')],'resourceId':_0x29532e['id'],'type':_0x4eee9a['name'],'sectionId':_0x4eee9a['id']},{})[_0x4d16('0x1f')](function(){return _0x4b0ff2;});}else{return _0x4b0ff2;}})[_0x4d16('0x3c')](function(_0x3ba688){logger[_0x4d16('0x22')](_0x4d16('0x48'),_0x3ba688);throw _0x3ba688;});}return _0x4b0ff2;})[_0x4d16('0x1f')](respondWithResult(_0x5a3e81,0xc9))['catch'](handleError(_0x5a3e81,null));};exports['update']=function(_0x536faa,_0x1609a7){if(_0x536faa['body']['id']){delete _0x536faa[_0x4d16('0x49')]['id'];}return db['Trigger'][_0x4d16('0x40')]({'where':{'id':_0x536faa[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x1609a7,null))['then'](saveUpdates(_0x536faa['body'],null))['then'](respondWithResult(_0x1609a7,null))[_0x4d16('0x3c')](handleError(_0x1609a7,null));};exports[_0x4d16('0x21')]=function(_0x2d38d4,_0x303e9f){return db[_0x4d16('0x28')][_0x4d16('0x40')]({'where':{'id':_0x2d38d4['params']['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x303e9f,null))[_0x4d16('0x1f')](removeEntity(_0x303e9f,null))['catch'](handleError(_0x303e9f,null));};exports[_0x4d16('0x4b')]=function(_0x4a8a64,_0x179542,_0x4d2368){if(_0x4a8a64['body']['id']){delete _0x4a8a64['body']['id'];}return db[_0x4d16('0x28')][_0x4d16('0x40')]({'where':{'id':_0x4a8a64[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x179542,null))[_0x4d16('0x1f')](function(_0x3a7b13){if(_0x3a7b13){_0x4a8a64[_0x4d16('0x49')][_0x4d16('0x4c')]=_0x3a7b13['id'];return db[_0x4d16('0x4d')][_0x4d16('0x41')](_0x4a8a64['body']);}})[_0x4d16('0x1f')](respondWithResult(_0x179542,null))[_0x4d16('0x3c')](handleError(_0x179542,null));};exports['addAnyCondition']=function(_0x3a59e8,_0x1a2047,_0x4b45ef){if(_0x3a59e8[_0x4d16('0x49')]['id']){delete _0x3a59e8[_0x4d16('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3a59e8[_0x4d16('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a2047,null))[_0x4d16('0x1f')](function(_0x5199cf){if(_0x5199cf){_0x3a59e8[_0x4d16('0x49')][_0x4d16('0x4e')]=_0x5199cf['id'];return db[_0x4d16('0x4d')][_0x4d16('0x41')](_0x3a59e8['body']);}})[_0x4d16('0x1f')](respondWithResult(_0x1a2047,null))[_0x4d16('0x3c')](handleError(_0x1a2047,null));};exports[_0x4d16('0x4f')]=function(_0x15d8ff,_0x13e98e,_0x1e079d){var _0x2fa8e4={};var _0x2b9a6b={};var _0x31d6f3;var _0xa04450;return db['Trigger'][_0x4d16('0x50')]({'where':{'id':_0x15d8ff[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x13e98e,null))[_0x4d16('0x1f')](function(_0xa84848){if(_0xa84848){_0x31d6f3=_0xa84848;_0x2b9a6b['model']=_[_0x4d16('0x3d')](db[_0x4d16('0x4d')][_0x4d16('0x29')]);_0x2b9a6b[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x15d8ff[_0x4d16('0x2c')]);_0x2b9a6b['filters']=_['intersection'](_0x2b9a6b[_0x4d16('0x2b')],_0x2b9a6b[_0x4d16('0x2c')]);_0x2fa8e4[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x2b9a6b[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x15d8ff['query'][_0x4d16('0x30')]));_0x2fa8e4[_0x4d16('0x2e')]=_0x2fa8e4[_0x4d16('0x2e')][_0x4d16('0x31')]?_0x2fa8e4[_0x4d16('0x2e')]:_0x2b9a6b[_0x4d16('0x2b')];_0x2fa8e4[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x2fa8e4[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_[_0x4d16('0x51')](_0x15d8ff['query'],_0x2b9a6b[_0x4d16('0x2d')]));if(_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x39')]){_0x2fa8e4[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x2fa8e4[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x2fa8e4[_0x4d16('0x2e')],function(_0x3a0bd6){var _0x2812a9={};_0x2812a9[_0x3a0bd6]={'$like':'%'+_0x15d8ff[_0x4d16('0x2c')]['filter']+'%'};return _0x2812a9;})});}_0x2fa8e4=_[_0x4d16('0x37')]({},_0x2fa8e4,_0x15d8ff[_0x4d16('0x3f')]);return _0x31d6f3[_0x4d16('0x4f')](_0x2fa8e4);}})['then'](function(_0x2b5a13){if(_0x2b5a13){_0xa04450=_0x2b5a13[_0x4d16('0x31')];if(!_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x32')](_0x4d16('0x33'))){_0x2fa8e4[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x15d8ff[_0x4d16('0x2c')]['limit']);_0x2fa8e4[_0x4d16('0x18')]=qs[_0x4d16('0x18')](_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0x31d6f3[_0x4d16('0x4f')](_0x2fa8e4);}})[_0x4d16('0x1f')](function(_0xa0bef6){if(_0xa0bef6){return _0xa0bef6?{'count':_0xa04450,'rows':_0xa0bef6}:null;}})[_0x4d16('0x1f')](respondWithResult(_0x13e98e,null))[_0x4d16('0x3c')](handleError(_0x13e98e,null));};exports[_0x4d16('0x52')]=function(_0x4ec974,_0x4db4f0,_0x1367d6){var _0x40ebf5={};var _0xfa0bae={};var _0xaa886a;var _0x3ae761;return db[_0x4d16('0x28')][_0x4d16('0x50')]({'where':{'id':_0x4ec974[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x4db4f0,null))[_0x4d16('0x1f')](function(_0x34950a){if(_0x34950a){_0xaa886a=_0x34950a;_0xfa0bae[_0x4d16('0x2b')]=_[_0x4d16('0x3d')](db[_0x4d16('0x4d')]['rawAttributes']);_0xfa0bae[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x4ec974[_0x4d16('0x2c')]);_0xfa0bae[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0xfa0bae[_0x4d16('0x2b')],_0xfa0bae[_0x4d16('0x2c')]);_0x40ebf5[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0xfa0bae[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x4ec974['query']['fields']));_0x40ebf5[_0x4d16('0x2e')]=_0x40ebf5[_0x4d16('0x2e')]['length']?_0x40ebf5[_0x4d16('0x2e')]:_0xfa0bae['model'];_0x40ebf5[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x40ebf5[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_['pick'](_0x4ec974[_0x4d16('0x2c')],_0xfa0bae[_0x4d16('0x2d')]));if(_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x39')]){_0x40ebf5[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x40ebf5[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x40ebf5[_0x4d16('0x2e')],function(_0x26042f){var _0x3d5c8c={};_0x3d5c8c[_0x26042f]={'$like':'%'+_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x39')]+'%'};return _0x3d5c8c;})});}_0x40ebf5=_['merge']({},_0x40ebf5,_0x4ec974[_0x4d16('0x3f')]);return _0xaa886a[_0x4d16('0x52')](_0x40ebf5);}})[_0x4d16('0x1f')](function(_0x20cd36){if(_0x20cd36){_0x3ae761=_0x20cd36[_0x4d16('0x31')];if(!_0x4ec974['query'][_0x4d16('0x32')]('nolimit')){_0x40ebf5[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x4ec974[_0x4d16('0x2c')]['limit']);_0x40ebf5[_0x4d16('0x18')]=qs[_0x4d16('0x18')](_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0xaa886a[_0x4d16('0x52')](_0x40ebf5);}})['then'](function(_0x56af20){if(_0x56af20){return _0x56af20?{'count':_0x3ae761,'rows':_0x56af20}:null;}})['then'](respondWithResult(_0x4db4f0,null))['catch'](handleError(_0x4db4f0,null));};exports['addAction']=function(_0x2b63ed,_0x4da56c,_0x4960ca){if(_0x2b63ed[_0x4d16('0x49')]['id']){delete _0x2b63ed[_0x4d16('0x49')]['id'];}return db[_0x4d16('0x28')]['find']({'where':{'id':_0x2b63ed[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x4da56c,null))[_0x4d16('0x1f')](function(_0x2644aa){if(_0x2644aa){_0x2b63ed[_0x4d16('0x49')][_0x4d16('0x53')]=_0x2644aa['id'];return db[_0x4d16('0x54')][_0x4d16('0x41')](_0x2b63ed[_0x4d16('0x49')]);}})['then'](respondWithResult(_0x4da56c,null))[_0x4d16('0x3c')](handleError(_0x4da56c,null));};exports[_0x4d16('0x55')]=function(_0x55a729,_0x259b64,_0x1d5fab){var _0x1bfdb1={};var _0x5ca5bd={};var _0x6ade57;var _0x54d5a1;return db[_0x4d16('0x28')][_0x4d16('0x50')]({'where':{'id':_0x55a729['params']['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x259b64,null))[_0x4d16('0x1f')](function(_0x5aaf9f){if(_0x5aaf9f){_0x6ade57=_0x5aaf9f;_0x5ca5bd['model']=_[_0x4d16('0x3d')](db['Action']['rawAttributes']);_0x5ca5bd['query']=_[_0x4d16('0x3d')](_0x55a729[_0x4d16('0x2c')]);_0x5ca5bd[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0x5ca5bd[_0x4d16('0x2b')],_0x5ca5bd[_0x4d16('0x2c')]);_0x1bfdb1['attributes']=_['intersection'](_0x5ca5bd['model'],qs['fields'](_0x55a729['query'][_0x4d16('0x30')]));_0x1bfdb1[_0x4d16('0x2e')]=_0x1bfdb1['attributes'][_0x4d16('0x31')]?_0x1bfdb1[_0x4d16('0x2e')]:_0x5ca5bd[_0x4d16('0x2b')];_0x1bfdb1[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x1bfdb1[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_[_0x4d16('0x51')](_0x55a729[_0x4d16('0x2c')],_0x5ca5bd['filters']));if(_0x55a729['query']['filter']){_0x1bfdb1[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x1bfdb1[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x1bfdb1[_0x4d16('0x2e')],function(_0x1f6741){var _0x1a0e1c={};_0x1a0e1c[_0x1f6741]={'$like':'%'+_0x55a729['query'][_0x4d16('0x39')]+'%'};return _0x1a0e1c;})});}_0x1bfdb1=_['merge']({},_0x1bfdb1,_0x55a729['options']);return _0x6ade57[_0x4d16('0x55')](_0x1bfdb1);}})['then'](function(_0x403e1b){if(_0x403e1b){_0x54d5a1=_0x403e1b[_0x4d16('0x31')];if(!_0x55a729[_0x4d16('0x2c')]['hasOwnProperty'](_0x4d16('0x33'))){_0x1bfdb1[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x19')]);_0x1bfdb1[_0x4d16('0x18')]=qs['offset'](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0x6ade57[_0x4d16('0x55')](_0x1bfdb1);}})[_0x4d16('0x1f')](function(_0x4b0e47){if(_0x4b0e47){return _0x4b0e47?{'count':_0x54d5a1,'rows':_0x4b0e47}:null;}})['then'](respondWithResult(_0x259b64,null))[_0x4d16('0x3c')](handleError(_0x259b64,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7fa7cbf..0ffa0e9 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 _0x6873=['request-promise','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','../../config/logger','api','moment','bluebird'];(function(_0x3fd9fc,_0x3024eb){var _0x36a63d=function(_0x761e1b){while(--_0x761e1b){_0x3fd9fc['push'](_0x3fd9fc['shift']());}};_0x36a63d(++_0x3024eb);}(_0x6873,0xac));var _0x3687=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x6873[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3687('0x0'))(_0x3687('0x1'));var moment=require(_0x3687('0x2'));var BPromise=require(_0x3687('0x3'));var rp=require(_0x3687('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3687('0x5'));var config=require('../../config/environment');var attributes=require(_0x3687('0x6'));module[_0x3687('0x7')]=function(_0x4ecd9e,_0x3ff2e3){return _0x4ecd9e[_0x3687('0x8')](_0x3687('0x9'),attributes,{'tableName':_0x3687('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x746f=['../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfc6af9,_0x388de6){var _0x3a13a4=function(_0x2eb546){while(--_0x2eb546){_0xfc6af9['push'](_0xfc6af9['shift']());}};_0x3a13a4(++_0x388de6);}(_0x746f,0x9c));var _0xf746=function(_0x35ae69,_0x5e2f74){_0x35ae69=_0x35ae69-0x0;var _0x265e2b=_0x746f[_0x35ae69];return _0x265e2b;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var logger=require(_0xf746('0x2'))(_0xf746('0x3'));var moment=require(_0xf746('0x4'));var BPromise=require(_0xf746('0x5'));var rp=require(_0xf746('0x6'));var fs=require('fs');var path=require(_0xf746('0x7'));var rimraf=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var attributes=require(_0xf746('0xa'));module[_0xf746('0xb')]=function(_0x19d855,_0x2f0f3c){return _0x19d855[_0xf746('0xc')](_0xf746('0xd'),attributes,{'tableName':_0xf746('0xe'),'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 8541bb6..116019c 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 _0x0f6b=['../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x21a88c,_0x5548cf){var _0x153140=function(_0x591904){while(--_0x591904){_0x21a88c['push'](_0x21a88c['shift']());}};_0x153140(++_0x5548cf);}(_0x0f6b,0x102));var _0xb0f6=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x0f6b[_0x10291b];return _0x1d5fbe;};'use strict';var _=require('lodash');var util=require(_0xb0f6('0x0'));var moment=require(_0xb0f6('0x1'));var BPromise=require(_0xb0f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0f6('0x3'));var db=require(_0xb0f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0f6('0x5'))('rpc');var config=require(_0xb0f6('0x6'));var jayson=require(_0xb0f6('0x7'));var client=jayson[_0xb0f6('0x8')][_0xb0f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1acbd9,_0x37ed89,_0x125c1c){return new BPromise(function(_0x57d013,_0x12ee31){return client[_0xb0f6('0xa')](_0x1acbd9,_0x125c1c)[_0xb0f6('0xb')](function(_0x2f3aed){logger[_0xb0f6('0xc')](_0xb0f6('0xd'),_0x37ed89,_0xb0f6('0xe'));logger[_0xb0f6('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x37ed89,_0xb0f6('0xe'),JSON[_0xb0f6('0x10')](_0x2f3aed));if(_0x2f3aed[_0xb0f6('0x11')]){if(_0x2f3aed[_0xb0f6('0x11')]['code']===0x1f4){logger[_0xb0f6('0x11')](_0xb0f6('0xd'),_0x37ed89,_0x2f3aed[_0xb0f6('0x11')][_0xb0f6('0x12')]);return _0x12ee31(_0x2f3aed[_0xb0f6('0x11')][_0xb0f6('0x12')]);}logger[_0xb0f6('0x11')](_0xb0f6('0xd'),_0x37ed89,_0x2f3aed[_0xb0f6('0x11')][_0xb0f6('0x12')]);return _0x57d013(_0x2f3aed[_0xb0f6('0x11')][_0xb0f6('0x12')]);}else{logger[_0xb0f6('0xc')](_0xb0f6('0xd'),_0x37ed89,'request\x20sent');_0x57d013(_0x2f3aed[_0xb0f6('0x13')][_0xb0f6('0x12')]);}})['catch'](function(_0x205c92){logger[_0xb0f6('0x11')](_0xb0f6('0xd'),_0x37ed89,_0x205c92);_0x12ee31(_0x205c92);});});}exports[_0xb0f6('0x14')]=function(_0x31f704){var _0x397c30=this;return new Promise(function(_0x251352,_0x21ae07){return db[_0xb0f6('0x15')][_0xb0f6('0x16')]({'raw':_0x31f704[_0xb0f6('0x17')]?_0x31f704['options'][_0xb0f6('0x18')]===undefined?!![]:![]:!![],'where':_0x31f704[_0xb0f6('0x17')]?_0x31f704['options'][_0xb0f6('0x19')]||null:null,'attributes':_0x31f704[_0xb0f6('0x17')]?_0x31f704[_0xb0f6('0x17')][_0xb0f6('0x1a')]||null:null,'limit':_0x31f704[_0xb0f6('0x17')]?_0x31f704['options'][_0xb0f6('0x1b')]||null:null,'include':_0x31f704[_0xb0f6('0x17')]?_0x31f704[_0xb0f6('0x17')][_0xb0f6('0x1c')]?_[_0xb0f6('0x1d')](_0x31f704[_0xb0f6('0x17')]['include'],function(_0xd12ad6){return{'model':db[_0xd12ad6[_0xb0f6('0x1e')]],'as':_0xd12ad6['as'],'attributes':_0xd12ad6['attributes'],'include':_0xd12ad6[_0xb0f6('0x1c')]?_[_0xb0f6('0x1d')](_0xd12ad6['include'],function(_0x4c486f){return{'model':db[_0x4c486f[_0xb0f6('0x1e')]],'as':_0x4c486f['as'],'attributes':_0x4c486f[_0xb0f6('0x1a')],'include':_0x4c486f[_0xb0f6('0x1c')]?_[_0xb0f6('0x1d')](_0x4c486f[_0xb0f6('0x1c')],function(_0xaf10bb){return{'model':db[_0xaf10bb[_0xb0f6('0x1e')]],'as':_0xaf10bb['as'],'attributes':_0xaf10bb[_0xb0f6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb0f6('0xb')](function(_0x585aad){logger[_0xb0f6('0xc')](_0xb0f6('0x14'),_0x31f704);logger['debug'](_0xb0f6('0x14'),_0x31f704,JSON[_0xb0f6('0x10')](_0x585aad));_0x251352(_0x585aad);})[_0xb0f6('0x1f')](function(_0x1b77eb){logger['error'](_0xb0f6('0x14'),_0x1b77eb[_0xb0f6('0x12')],_0x31f704);_0x21ae07(_0x397c30['error'](0x1f4,_0x1b77eb[_0xb0f6('0x12')]));});});};exports[_0xb0f6('0x20')]=function(_0x3b55da){var _0xac6295=this;return new Promise(function(_0x414c64,_0x3a86ba){return db[_0xb0f6('0x15')]['find']({'raw':_0x3b55da[_0xb0f6('0x17')]?_0x3b55da[_0xb0f6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b55da[_0xb0f6('0x17')]?_0x3b55da[_0xb0f6('0x17')][_0xb0f6('0x19')]||null:null,'attributes':_0x3b55da['options']?_0x3b55da[_0xb0f6('0x17')][_0xb0f6('0x1a')]||null:null,'include':_0x3b55da[_0xb0f6('0x17')]?_0x3b55da[_0xb0f6('0x17')]['include']?_[_0xb0f6('0x1d')](_0x3b55da['options']['include'],function(_0x5e4734){return{'model':db[_0x5e4734[_0xb0f6('0x1e')]],'as':_0x5e4734['as'],'attributes':_0x5e4734[_0xb0f6('0x1a')],'include':_0x5e4734[_0xb0f6('0x1c')]?_[_0xb0f6('0x1d')](_0x5e4734[_0xb0f6('0x1c')],function(_0xb9e9ad){return{'model':db[_0xb9e9ad[_0xb0f6('0x1e')]],'as':_0xb9e9ad['as'],'attributes':_0xb9e9ad[_0xb0f6('0x1a')],'include':_0xb9e9ad[_0xb0f6('0x1c')]?_[_0xb0f6('0x1d')](_0xb9e9ad[_0xb0f6('0x1c')],function(_0x3e2fed){return{'model':db[_0x3e2fed['model']],'as':_0x3e2fed['as'],'attributes':_0x3e2fed[_0xb0f6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc2f476){logger[_0xb0f6('0xc')](_0xb0f6('0x20'),_0x3b55da);logger[_0xb0f6('0xf')](_0xb0f6('0x20'),_0x3b55da,JSON['stringify'](_0xc2f476));_0x414c64(_0xc2f476);})['catch'](function(_0x53e7b8){logger['error'](_0xb0f6('0x20'),_0x53e7b8['message'],_0x3b55da);_0x3a86ba(_0xac6295[_0xb0f6('0x11')](0x1f4,_0x53e7b8['message']));});});}; \ No newline at end of file +var _0x6b1b=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','debug','ShowTrigger','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5363a3,_0x3c6310){var _0x4cd0c6=function(_0x3d7747){while(--_0x3d7747){_0x5363a3['push'](_0x5363a3['shift']());}};_0x4cd0c6(++_0x3c6310);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x6b1b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('Trigger,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('Trigger,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});}exports[_0xb6b1('0x14')]=function(_0x51fb33){var _0x47a204=this;return new Promise(function(_0x581e28,_0x1bdf63){return db[_0xb6b1('0x15')][_0xb6b1('0x16')]({'raw':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x51fb33['options']?_0x51fb33['options'][_0xb6b1('0x19')]||null:null,'attributes':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['attributes']||null:null,'limit':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['limit']||null:null,'include':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')],function(_0x1eb1b2){return{'model':db[_0x1eb1b2[_0xb6b1('0x1c')]],'as':_0x1eb1b2['as'],'attributes':_0x1eb1b2[_0xb6b1('0x1d')],'include':_0x1eb1b2[_0xb6b1('0x1a')]?_['map'](_0x1eb1b2[_0xb6b1('0x1a')],function(_0x4f1e2e){return{'model':db[_0x4f1e2e[_0xb6b1('0x1c')]],'as':_0x4f1e2e['as'],'attributes':_0x4f1e2e['attributes'],'include':_0x4f1e2e[_0xb6b1('0x1a')]?_['map'](_0x4f1e2e[_0xb6b1('0x1a')],function(_0x387603){return{'model':db[_0x387603[_0xb6b1('0x1c')]],'as':_0x387603['as'],'attributes':_0x387603[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0x188627){logger[_0xb6b1('0xd')](_0xb6b1('0x14'),_0x51fb33);logger[_0xb6b1('0x1e')]('GetTrigger',_0x51fb33,JSON[_0xb6b1('0xf')](_0x188627));_0x581e28(_0x188627);})['catch'](function(_0x427efb){logger[_0xb6b1('0x10')](_0xb6b1('0x14'),_0x427efb[_0xb6b1('0x12')],_0x51fb33);_0x1bdf63(_0x47a204[_0xb6b1('0x10')](0x1f4,_0x427efb[_0xb6b1('0x12')]));});});};exports[_0xb6b1('0x1f')]=function(_0x59094f){var _0x427797=this;return new Promise(function(_0x2ccd37,_0x1791a2){return db['Trigger'][_0xb6b1('0x20')]({'raw':_0x59094f[_0xb6b1('0x17')]?_0x59094f['options'][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')][_0xb6b1('0x19')]||null:null,'attributes':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['attributes']||null:null,'include':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['include']?_[_0xb6b1('0x1b')](_0x59094f['options'][_0xb6b1('0x1a')],function(_0x242ec3){return{'model':db[_0x242ec3[_0xb6b1('0x1c')]],'as':_0x242ec3['as'],'attributes':_0x242ec3[_0xb6b1('0x1d')],'include':_0x242ec3[_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x242ec3['include'],function(_0x203d8e){return{'model':db[_0x203d8e[_0xb6b1('0x1c')]],'as':_0x203d8e['as'],'attributes':_0x203d8e[_0xb6b1('0x1d')],'include':_0x203d8e[_0xb6b1('0x1a')]?_['map'](_0x203d8e['include'],function(_0x4b9125){return{'model':db[_0x4b9125[_0xb6b1('0x1c')]],'as':_0x4b9125['as'],'attributes':_0x4b9125[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0xe9cc){logger[_0xb6b1('0xd')](_0xb6b1('0x1f'),_0x59094f);logger[_0xb6b1('0x1e')](_0xb6b1('0x1f'),_0x59094f,JSON[_0xb6b1('0xf')](_0xe9cc));_0x2ccd37(_0xe9cc);})[_0xb6b1('0x13')](function(_0x9abbe1){logger[_0xb6b1('0x10')]('ShowTrigger',_0x9abbe1[_0xb6b1('0x12')],_0x59094f);_0x1791a2(_0x427797[_0xb6b1('0x10')](0x1f4,_0x9abbe1[_0xb6b1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d23400d..8597247 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 _0x13ef=['create','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','show','post','/:id/clone','clone'];(function(_0x2a2f8b,_0x4300d2){var _0x3a6017=function(_0x25045f){while(--_0x25045f){_0x2a2f8b['push'](_0x2a2f8b['shift']());}};_0x3a6017(++_0x4300d2);}(_0x13ef,0x83));var _0xf13e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x13ef[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0xf13e('0x0'));var util=require(_0xf13e('0x1'));var path=require(_0xf13e('0x2'));var timeout=require(_0xf13e('0x3'));var express=require(_0xf13e('0x4'));var router=express[_0xf13e('0x5')]();var fs_extra=require(_0xf13e('0x6'));var auth=require(_0xf13e('0x7'));var interaction=require(_0xf13e('0x8'));var config=require('../../config/environment');var controller=require(_0xf13e('0x9'));router['get']('/',auth[_0xf13e('0xa')](),controller[_0xf13e('0xb')]);router['get']('/:id',auth[_0xf13e('0xa')](),controller[_0xf13e('0xc')]);router[_0xf13e('0xd')](_0xf13e('0xe'),auth['isAuthenticated'](),controller[_0xf13e('0xf')]);router['post']('/',auth[_0xf13e('0xa')](),controller[_0xf13e('0x10')]);router['put']('/:id',auth[_0xf13e('0xa')](),controller['update']);router[_0xf13e('0x11')](_0xf13e('0x12'),auth[_0xf13e('0xa')](),controller[_0xf13e('0x13')]);module[_0xf13e('0x14')]=router; \ No newline at end of file +var _0x79d5=['../../components/auth/service','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x3afc57,_0x56b5b9){var _0x3c6ecf=function(_0x198d6d){while(--_0x198d6d){_0x3afc57['push'](_0x3afc57['shift']());}};_0x3c6ecf(++_0x56b5b9);}(_0x79d5,0x13b));var _0x579d=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x79d5[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require('multer');var util=require(_0x579d('0x0'));var path=require(_0x579d('0x1'));var timeout=require(_0x579d('0x2'));var express=require('express');var router=express[_0x579d('0x3')]();var fs_extra=require(_0x579d('0x4'));var auth=require(_0x579d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x579d('0x6'));router[_0x579d('0x7')]('/',auth['isAuthenticated'](),controller[_0x579d('0x8')]);router[_0x579d('0x7')](_0x579d('0x9'),auth[_0x579d('0xa')](),controller[_0x579d('0xb')]);router[_0x579d('0xc')](_0x579d('0xd'),auth[_0x579d('0xa')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x579d('0xe')]);router[_0x579d('0xf')]('/:id',auth[_0x579d('0xa')](),controller[_0x579d('0x10')]);router[_0x579d('0x11')](_0x579d('0x9'),auth[_0x579d('0xa')](),controller[_0x579d('0x12')]);module[_0x579d('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 788c58a..f6fb2e4 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 _0xa02e=['friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','\x22\x22\x20<>','always','INTEGER','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x19c849,_0x36bab1){var _0x18d1c8=function(_0x5adbd6){while(--_0x5adbd6){_0x19c849['push'](_0x19c849['shift']());}};_0x18d1c8(++_0x36bab1);}(_0xa02e,0xb8));var _0xea02=function(_0x5b6bd2,_0x2ba560){_0x5b6bd2=_0x5b6bd2-0x0;var _0x2a1ced=_0xa02e[_0x5b6bd2];return _0x2a1ced;};'use strict';var Sequelize=require(_0xea02('0x0'));module[_0xea02('0x1')]={'name':{'type':Sequelize[_0xea02('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x4'),_0xea02('0x5'),_0xea02('0x6')),'allowNull':![],'defaultValue':_0xea02('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x7'),_0xea02('0x8'),_0xea02('0x9'),'ALLOWED',_0xea02('0xa'),_0xea02('0xb'),_0xea02('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xea02('0x2')]},'permit':{'type':Sequelize[_0xea02('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xea02('0x2')]},'transport':{'type':Sequelize[_0xea02('0x2')],'defaultValue':'udp','set':function(_0x2a26ae){this['setDataValue'](_0xea02('0xd'),_0x2a26ae?_0x2a26ae[_0xea02('0xe')](','):null);},'get':function(){return this[_0xea02('0xf')]('transport')?this['getDataValue']('transport')[_0xea02('0x10')](','):null;},'comment':_0xea02('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xea02('0x12'),'info',_0xea02('0x13'),_0xea02('0x14'),'auto'),'defaultValue':_0xea02('0x12')},'directmedia':{'type':Sequelize[_0xea02('0x3')]('yes','no',_0xea02('0x15'),_0xea02('0x16'),_0xea02('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xea02('0x2')]},'directmediadeny':{'type':Sequelize[_0xea02('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xea02('0x19'),'set':function(_0x5330c3){this[_0xea02('0x1a')]('nat',_0x5330c3?_0x5330c3['join'](','):null);},'get':function(){return this[_0xea02('0xf')](_0xea02('0x1b'))?this[_0xea02('0xf')](_0xea02('0x1b'))[_0xea02('0x10')](','):null;},'comment':_0xea02('0x1c')},'callgroup':{'type':Sequelize[_0xea02('0x2')]},'namedcallgroup':{'type':Sequelize[_0xea02('0x2')]},'pickupgroup':{'type':Sequelize[_0xea02('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xea02('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xea02('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xea02('0x2')],'defaultValue':_0xea02('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea02('0x1e'),'set':function(_0x281c7e){this[_0xea02('0x1a')]('allow',_0x281c7e?_0x281c7e[_0xea02('0xe')](';'):_0xea02('0x1e'));},'get':function(){return this['getDataValue'](_0xea02('0x1f'))?this['getDataValue'](_0xea02('0x1f'))[_0xea02('0x10')](';'):null;},'comment':_0xea02('0x20')},'autoframing':{'type':Sequelize[_0xea02('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x5151f7){this[_0xea02('0x1a')](_0xea02('0x21'),_0x5151f7?_0x5151f7[_0xea02('0xe')](','):null);},'get':function(){return this[_0xea02('0xf')](_0xea02('0x21'))?this[_0xea02('0xf')](_0xea02('0x21'))[_0xea02('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no',_0xea02('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xea02('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xea02('0x23')},'amaflags':{'type':Sequelize[_0xea02('0x2')]},'callcounter':{'type':Sequelize[_0xea02('0x3')]('yes','no'),'defaultValue':_0xea02('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xea02('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xea02('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xea02('0x2')]},'videosupport':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no',_0xea02('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xea02('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xea02('0x3')]('accept',_0xea02('0x26'),_0xea02('0x27'))},'session_expires':{'type':Sequelize[_0xea02('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x28'),_0xea02('0x29')),'defaultValue':_0xea02('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xea02('0x2')]},'regexten':{'type':Sequelize[_0xea02('0x2')]},'fromdomain':{'type':Sequelize[_0xea02('0x2')]},'fromuser':{'type':Sequelize[_0xea02('0x2')]},'port':{'type':Sequelize[_0xea02('0x25')](0x5)},'qualify':{'type':Sequelize[_0xea02('0x3')]('yes','no'),'defaultValue':_0xea02('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xea02('0x2')]},'defaultuser':{'type':Sequelize[_0xea02('0x2')]},'rtptimeout':{'type':Sequelize[_0xea02('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xea02('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xea02('0x2')]},'callbackextension':{'type':Sequelize[_0xea02('0x2')]},'timert1':{'type':Sequelize[_0xea02('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xea02('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xea02('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xea02('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xea02('0x2')]},'use_q850_reason':{'type':Sequelize[_0xea02('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no')},'force_avp':{'type':Sequelize[_0xea02('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no',_0xea02('0x2a'),_0xea02('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xea02('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xea02('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xea02('0x2')]},'dtlscipher':{'type':Sequelize[_0xea02('0x2')]},'dtlscafile':{'type':Sequelize[_0xea02('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x2c'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xea02('0x2')]},'recordofffeature':{'type':Sequelize[_0xea02('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xea02('0x3')](_0xea02('0x18'),'no')},'vmexten':{'type':Sequelize[_0xea02('0x2')]},'mohinterpret':{'type':Sequelize[_0xea02('0x2')]},'mohsuggest':{'type':Sequelize[_0xea02('0x2')]},'parkinglot':{'type':Sequelize[_0xea02('0x2')]},'description':{'type':Sequelize[_0xea02('0x2')]},'host':{'type':Sequelize[_0xea02('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xea02('0x18'),'no',_0xea02('0x15'),_0xea02('0x16'),_0xea02('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xea02('0x2')]},'otherFields':{'type':Sequelize[_0xea02('0x2')]},'active':{'type':Sequelize[_0xea02('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xea02('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7e8f=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','refuse','originate','uac','uas','fingerprint','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x505088,_0x23a321){var _0x3eb2c9=function(_0x2fcf8d){while(--_0x2fcf8d){_0x505088['push'](_0x505088['shift']());}};_0x3eb2c9(++_0x23a321);}(_0x7e8f,0x13f));var _0xf7e8=function(_0x5a6748,_0x4bcebf){_0x5a6748=_0x5a6748-0x0;var _0x2533a9=_0x7e8f[_0x5a6748];return _0x2533a9;};'use strict';var Sequelize=require(_0xf7e8('0x0'));module[_0xf7e8('0x1')]={'name':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'unique':_0xf7e8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf7e8('0x4')]('friend','user',_0xf7e8('0x5')),'allowNull':![],'defaultValue':_0xf7e8('0x6')},'context':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'defaultValue':_0xf7e8('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xf7e8('0x8'),'ALLOWED_PASSED_SCREEN',_0xf7e8('0x9'),_0xf7e8('0xa'),'PROHIB_NOT_SCREENED',_0xf7e8('0xb'),'PROHIB_FAILED_SCREEN',_0xf7e8('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf7e8('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xf7e8('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'udp','set':function(_0x29fbfc){this[_0xf7e8('0xd')](_0xf7e8('0xe'),_0x29fbfc?_0x29fbfc['join'](','):null);},'get':function(){return this[_0xf7e8('0xf')](_0xf7e8('0xe'))?this[_0xf7e8('0xf')](_0xf7e8('0xe'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x11')},'dtmfmode':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x12'),_0xf7e8('0x13'),_0xf7e8('0x14'),'inband',_0xf7e8('0x15')),'defaultValue':_0xf7e8('0x12')},'directmedia':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no',_0xf7e8('0x17'),'update',_0xf7e8('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf7e8('0x2')]},'directmediadeny':{'type':Sequelize[_0xf7e8('0x2')]},'nat':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':_0xf7e8('0x19'),'set':function(_0x250ffa){this['setDataValue'](_0xf7e8('0x1a'),_0x250ffa?_0x250ffa[_0xf7e8('0x1b')](','):null);},'get':function(){return this[_0xf7e8('0xf')](_0xf7e8('0x1a'))?this[_0xf7e8('0xf')](_0xf7e8('0x1a'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x1c')},'callgroup':{'type':Sequelize[_0xf7e8('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf7e8('0x2')]},'pickupgroup':{'type':Sequelize[_0xf7e8('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf7e8('0x2')]},'language':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xf7e8('0x1d')},'allow':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'defaultValue':_0xf7e8('0x1e'),'set':function(_0x508aea){this[_0xf7e8('0xd')](_0xf7e8('0x1f'),_0x508aea?_0x508aea['join'](';'):_0xf7e8('0x1e'));},'get':function(){return this['getDataValue']('allow')?this[_0xf7e8('0xf')](_0xf7e8('0x1f'))['split'](';'):null;},'comment':_0xf7e8('0x20')},'autoframing':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'insecure':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'port,invite','set':function(_0x1b81ef){this[_0xf7e8('0xd')](_0xf7e8('0x21'),_0x1b81ef?_0x1b81ef['join'](','):null);},'get':function(){return this[_0xf7e8('0xf')]('insecure')?this[_0xf7e8('0xf')](_0xf7e8('0x21'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf7e8('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xf7e8('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'accountcode':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf7e8('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf7e8('0x2')]},'callcounter':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xf7e8('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xf7e8('0x2')]},'template':{'type':Sequelize[_0xf7e8('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no',_0xf7e8('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'mailbox':{'type':Sequelize[_0xf7e8('0x2')]},'session_timers':{'type':Sequelize[_0xf7e8('0x4')]('accept',_0xf7e8('0x26'),_0xf7e8('0x27'))},'session_expires':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x28'),_0xf7e8('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf7e8('0x2')]},'regexten':{'type':Sequelize[_0xf7e8('0x2')]},'fromdomain':{'type':Sequelize[_0xf7e8('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf7e8('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf7e8('0x2')]},'rtptimeout':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf7e8('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf7e8('0x2')]},'contactacl':{'type':Sequelize[_0xf7e8('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf7e8('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'force_avp':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'icesupport':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xf7e8('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no',_0xf7e8('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xf7e8('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscipher':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscafile':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscapath':{'type':Sequelize[_0xf7e8('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf7e8('0x2b'),_0xf7e8('0x2c'),_0xf7e8('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf7e8('0x2')]},'usereqphone':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf7e8('0x2')]},'recordofffeature':{'type':Sequelize[_0xf7e8('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'vmexten':{'type':Sequelize[_0xf7e8('0x2')]},'mohinterpret':{'type':Sequelize[_0xf7e8('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf7e8('0x2')]},'description':{'type':Sequelize[_0xf7e8('0x2')]},'host':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':_0xf7e8('0x2e')},'canreinvite':{'type':Sequelize[_0xf7e8('0x4')]('yes','no',_0xf7e8('0x17'),_0xf7e8('0x2f'),_0xf7e8('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf7e8('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf7e8('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 dae9de6..38272d2 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x5e9a18,_0x336250){var _0x249df2=function(_0x6fd5b){while(--_0x6fd5b){_0x5e9a18['push'](_0x5e9a18['shift']());}};_0x249df2(++_0x336250);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5047e3,_0x17719f){var _0x4aae7a=function(_0x16dd91){while(--_0x16dd91){_0x5047e3['push'](_0x5047e3['shift']());}};_0x4aae7a(++_0x17719f);}(_0x55ca,0x126));var _0xa55c=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x55ca[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 95e208c..eb2ed31 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 _0xdf4b=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x5bcf60,_0x2bd443){var _0x5d3f29=function(_0x239e14){while(--_0x239e14){_0x5bcf60['push'](_0x5bcf60['shift']());}};_0x5d3f29(++_0x2bd443);}(_0xdf4b,0x1f1));var _0xbdf4=function(_0x4db689,_0x25fa52){_0x4db689=_0x4db689-0x0;var _0x5b23d2=_0xdf4b[_0x4db689];return _0x5b23d2;};'use strict';var _=require(_0xbdf4('0x0'));var util=require(_0xbdf4('0x1'));var logger=require(_0xbdf4('0x2'))(_0xbdf4('0x3'));var moment=require('moment');var BPromise=require(_0xbdf4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdf4('0x5'));var rimraf=require('rimraf');var config=require(_0xbdf4('0x6'));var attributes=require(_0xbdf4('0x7'));module[_0xbdf4('0x8')]=function(_0x98c36d,_0x2b9b11){return _0x98c36d[_0xbdf4('0x9')](_0xbdf4('0xa'),attributes,{'tableName':_0xbdf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./trunk.attributes','exports'];(function(_0x3d4af2,_0x415445){var _0x347c55=function(_0x1584ae){while(--_0x1584ae){_0x3d4af2['push'](_0x3d4af2['shift']());}};_0x347c55(++_0x415445);}(_0xadb5,0x1f1));var _0x5adb=function(_0x3d1586,_0x252acf){_0x3d1586=_0x3d1586-0x0;var _0x30de63=_0xadb5[_0x3d1586];return _0x30de63;};'use strict';var _=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var logger=require(_0x5adb('0x2'))(_0x5adb('0x3'));var moment=require(_0x5adb('0x4'));var BPromise=require('bluebird');var rp=require(_0x5adb('0x5'));var fs=require('fs');var path=require(_0x5adb('0x6'));var rimraf=require('rimraf');var config=require(_0x5adb('0x7'));var attributes=require(_0x5adb('0x8'));module[_0x5adb('0x9')]=function(_0x118e54,_0x4c31bd){return _0x118e54[_0x5adb('0xa')](_0x5adb('0xb'),attributes,{'tableName':_0x5adb('0xc'),'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 ca953f7..71264d1 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 _0x86e7=['Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetTrunk','options','where','attributes','include','map','model','ShowTrunk','Trunk','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x401792,_0x3e07f6){var _0x25e1c1=function(_0x5c6732){while(--_0x5c6732){_0x401792['push'](_0x401792['shift']());}};_0x25e1c1(++_0x3e07f6);}(_0x86e7,0x1d1));var _0x786e=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x86e7[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x786e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x786e('0x1'));var rs=require(_0x786e('0x2'));var fs=require('fs');var Redis=require(_0x786e('0x3'));var db=require(_0x786e('0x4'))['db'];var utils=require(_0x786e('0x5'));var logger=require(_0x786e('0x6'))(_0x786e('0x7'));var config=require(_0x786e('0x8'));var jayson=require(_0x786e('0x9'));var client=jayson[_0x786e('0xa')][_0x786e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d9666,_0xf8ab08,_0x3998bd){return new BPromise(function(_0x5bf297,_0x47a944){return client[_0x786e('0xc')](_0x1d9666,_0x3998bd)[_0x786e('0xd')](function(_0x17953b){logger[_0x786e('0xe')](_0x786e('0xf'),_0xf8ab08,'request\x20sent');logger['debug'](_0x786e('0x10'),_0xf8ab08,_0x786e('0x11'),JSON[_0x786e('0x12')](_0x17953b));if(_0x17953b['error']){if(_0x17953b[_0x786e('0x13')]['code']===0x1f4){logger[_0x786e('0x13')](_0x786e('0xf'),_0xf8ab08,_0x17953b[_0x786e('0x13')][_0x786e('0x14')]);return _0x47a944(_0x17953b[_0x786e('0x13')][_0x786e('0x14')]);}logger[_0x786e('0x13')]('Trunk,\x20%s,\x20%s',_0xf8ab08,_0x17953b[_0x786e('0x13')][_0x786e('0x14')]);return _0x5bf297(_0x17953b[_0x786e('0x13')][_0x786e('0x14')]);}else{logger[_0x786e('0xe')](_0x786e('0xf'),_0xf8ab08,_0x786e('0x11'));_0x5bf297(_0x17953b['result'][_0x786e('0x14')]);}})[_0x786e('0x15')](function(_0x2159a4){logger[_0x786e('0x13')](_0x786e('0xf'),_0xf8ab08,_0x2159a4);_0x47a944(_0x2159a4);});});}exports[_0x786e('0x16')]=function(_0x3f95fe){var _0x13e47b=this;return new Promise(function(_0x4f9bde,_0x3b402a){return db['Trunk']['findAll']({'raw':_0x3f95fe[_0x786e('0x17')]?_0x3f95fe[_0x786e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3f95fe['options']?_0x3f95fe[_0x786e('0x17')][_0x786e('0x18')]||null:null,'attributes':_0x3f95fe[_0x786e('0x17')]?_0x3f95fe['options'][_0x786e('0x19')]||null:null,'limit':_0x3f95fe[_0x786e('0x17')]?_0x3f95fe[_0x786e('0x17')]['limit']||null:null,'include':_0x3f95fe['options']?_0x3f95fe[_0x786e('0x17')][_0x786e('0x1a')]?_[_0x786e('0x1b')](_0x3f95fe['options'][_0x786e('0x1a')],function(_0x2599a9){return{'model':db[_0x2599a9['model']],'as':_0x2599a9['as'],'attributes':_0x2599a9[_0x786e('0x19')],'include':_0x2599a9['include']?_[_0x786e('0x1b')](_0x2599a9[_0x786e('0x1a')],function(_0x5712b9){return{'model':db[_0x5712b9[_0x786e('0x1c')]],'as':_0x5712b9['as'],'attributes':_0x5712b9['attributes'],'include':_0x5712b9[_0x786e('0x1a')]?_['map'](_0x5712b9[_0x786e('0x1a')],function(_0x4ba6f5){return{'model':db[_0x4ba6f5[_0x786e('0x1c')]],'as':_0x4ba6f5['as'],'attributes':_0x4ba6f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x786e('0xd')](function(_0x217674){logger['info']('GetTrunk',_0x3f95fe);logger['debug'](_0x786e('0x16'),_0x3f95fe,JSON[_0x786e('0x12')](_0x217674));_0x4f9bde(_0x217674);})[_0x786e('0x15')](function(_0xa5a43c){logger[_0x786e('0x13')](_0x786e('0x16'),_0xa5a43c['message'],_0x3f95fe);_0x3b402a(_0x13e47b[_0x786e('0x13')](0x1f4,_0xa5a43c[_0x786e('0x14')]));});});};exports[_0x786e('0x1d')]=function(_0x3b260f){var _0x3fce8b=this;return new Promise(function(_0xaa3afe,_0x1af19c){return db[_0x786e('0x1e')][_0x786e('0x1f')]({'raw':_0x3b260f[_0x786e('0x17')]?_0x3b260f[_0x786e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b260f['options']?_0x3b260f[_0x786e('0x17')][_0x786e('0x18')]||null:null,'attributes':_0x3b260f['options']?_0x3b260f['options'][_0x786e('0x19')]||null:null,'include':_0x3b260f['options']?_0x3b260f[_0x786e('0x17')][_0x786e('0x1a')]?_[_0x786e('0x1b')](_0x3b260f['options'][_0x786e('0x1a')],function(_0x2e2634){return{'model':db[_0x2e2634[_0x786e('0x1c')]],'as':_0x2e2634['as'],'attributes':_0x2e2634[_0x786e('0x19')],'include':_0x2e2634[_0x786e('0x1a')]?_[_0x786e('0x1b')](_0x2e2634[_0x786e('0x1a')],function(_0x531ff9){return{'model':db[_0x531ff9[_0x786e('0x1c')]],'as':_0x531ff9['as'],'attributes':_0x531ff9[_0x786e('0x19')],'include':_0x531ff9['include']?_[_0x786e('0x1b')](_0x531ff9['include'],function(_0x390f66){return{'model':db[_0x390f66[_0x786e('0x1c')]],'as':_0x390f66['as'],'attributes':_0x390f66[_0x786e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522da0){logger['info']('ShowTrunk',_0x3b260f);logger['debug'](_0x786e('0x1d'),_0x3b260f,JSON['stringify'](_0x522da0));_0xaa3afe(_0x522da0);})['catch'](function(_0x3639e4){logger['error'](_0x786e('0x1d'),_0x3639e4[_0x786e('0x14')],_0x3b260f);_0x1af19c(_0x3fce8b['error'](0x1f4,_0x3639e4[_0x786e('0x14')]));});});}; \ No newline at end of file +var _0x7f94=['code','message','result','GetTrunk','Trunk','options','raw','where','attributes','include','model','catch','find','map','ShowTrunk','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f94,0xd5));var _0x47f9=function(_0x54ac9a,_0x1f66c1){_0x54ac9a=_0x54ac9a-0x0;var _0x3197ca=_0x7f94[_0x54ac9a];return _0x3197ca;};'use strict';var _=require(_0x47f9('0x0'));var util=require(_0x47f9('0x1'));var moment=require('moment');var BPromise=require(_0x47f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47f9('0x3'));var db=require(_0x47f9('0x4'))['db'];var utils=require(_0x47f9('0x5'));var logger=require(_0x47f9('0x6'))('rpc');var config=require(_0x47f9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x47f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbb9eb6,_0x20a49c,_0x3c84bd){return new BPromise(function(_0x26f951,_0x697e9d){return client[_0x47f9('0x9')](_0xbb9eb6,_0x3c84bd)[_0x47f9('0xa')](function(_0x553bbb){logger[_0x47f9('0xb')](_0x47f9('0xc'),_0x20a49c,_0x47f9('0xd'));logger[_0x47f9('0xe')](_0x47f9('0xf'),_0x20a49c,'request\x20sent',JSON[_0x47f9('0x10')](_0x553bbb));if(_0x553bbb[_0x47f9('0x11')]){if(_0x553bbb[_0x47f9('0x11')][_0x47f9('0x12')]===0x1f4){logger[_0x47f9('0x11')](_0x47f9('0xc'),_0x20a49c,_0x553bbb[_0x47f9('0x11')][_0x47f9('0x13')]);return _0x697e9d(_0x553bbb[_0x47f9('0x11')][_0x47f9('0x13')]);}logger[_0x47f9('0x11')]('Trunk,\x20%s,\x20%s',_0x20a49c,_0x553bbb['error'][_0x47f9('0x13')]);return _0x26f951(_0x553bbb['error']['message']);}else{logger[_0x47f9('0xb')]('Trunk,\x20%s,\x20%s',_0x20a49c,'request\x20sent');_0x26f951(_0x553bbb[_0x47f9('0x14')][_0x47f9('0x13')]);}})['catch'](function(_0x30caa5){logger[_0x47f9('0x11')](_0x47f9('0xc'),_0x20a49c,_0x30caa5);_0x697e9d(_0x30caa5);});});}exports[_0x47f9('0x15')]=function(_0x27c839){var _0x24a770=this;return new Promise(function(_0x4a59cd,_0x182191){return db[_0x47f9('0x16')]['findAll']({'raw':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x18')]===undefined?!![]:![]:!![],'where':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x19')]||null:null,'attributes':_0x27c839[_0x47f9('0x17')]?_0x27c839['options'][_0x47f9('0x1a')]||null:null,'limit':_0x27c839['options']?_0x27c839[_0x47f9('0x17')]['limit']||null:null,'include':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x1b')]?_['map'](_0x27c839[_0x47f9('0x17')][_0x47f9('0x1b')],function(_0x552be4){return{'model':db[_0x552be4['model']],'as':_0x552be4['as'],'attributes':_0x552be4[_0x47f9('0x1a')],'include':_0x552be4['include']?_['map'](_0x552be4[_0x47f9('0x1b')],function(_0x3ab4ab){return{'model':db[_0x3ab4ab['model']],'as':_0x3ab4ab['as'],'attributes':_0x3ab4ab[_0x47f9('0x1a')],'include':_0x3ab4ab['include']?_['map'](_0x3ab4ab[_0x47f9('0x1b')],function(_0xe0ee68){return{'model':db[_0xe0ee68[_0x47f9('0x1c')]],'as':_0xe0ee68['as'],'attributes':_0xe0ee68[_0x47f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47f9('0xa')](function(_0x2d86a2){logger[_0x47f9('0xb')](_0x47f9('0x15'),_0x27c839);logger[_0x47f9('0xe')](_0x47f9('0x15'),_0x27c839,JSON[_0x47f9('0x10')](_0x2d86a2));_0x4a59cd(_0x2d86a2);})[_0x47f9('0x1d')](function(_0x23995d){logger[_0x47f9('0x11')](_0x47f9('0x15'),_0x23995d[_0x47f9('0x13')],_0x27c839);_0x182191(_0x24a770[_0x47f9('0x11')](0x1f4,_0x23995d[_0x47f9('0x13')]));});});};exports['ShowTrunk']=function(_0x3f5689){var _0x3185b3=this;return new Promise(function(_0x41a1c7,_0x3107b3){return db[_0x47f9('0x16')][_0x47f9('0x1e')]({'raw':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x18')]===undefined?!![]:![]:!![],'where':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x19')]||null:null,'attributes':_0x3f5689[_0x47f9('0x17')]?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x1a')]||null:null,'include':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')]['include']?_[_0x47f9('0x1f')](_0x3f5689[_0x47f9('0x17')]['include'],function(_0x367199){return{'model':db[_0x367199[_0x47f9('0x1c')]],'as':_0x367199['as'],'attributes':_0x367199[_0x47f9('0x1a')],'include':_0x367199[_0x47f9('0x1b')]?_[_0x47f9('0x1f')](_0x367199[_0x47f9('0x1b')],function(_0x559f2e){return{'model':db[_0x559f2e[_0x47f9('0x1c')]],'as':_0x559f2e['as'],'attributes':_0x559f2e[_0x47f9('0x1a')],'include':_0x559f2e['include']?_[_0x47f9('0x1f')](_0x559f2e[_0x47f9('0x1b')],function(_0xe485f0){return{'model':db[_0xe485f0[_0x47f9('0x1c')]],'as':_0xe485f0['as'],'attributes':_0xe485f0[_0x47f9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dae1d){logger[_0x47f9('0xb')](_0x47f9('0x20'),_0x3f5689);logger[_0x47f9('0xe')]('ShowTrunk',_0x3f5689,JSON['stringify'](_0x3dae1d));_0x41a1c7(_0x3dae1d);})[_0x47f9('0x1d')](function(_0x2f125b){logger[_0x47f9('0x11')](_0x47f9('0x20'),_0x2f125b[_0x47f9('0x13')],_0x3f5689);_0x3107b3(_0x3185b3['error'](0x1f4,_0x2f125b[_0x47f9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0ce4d46..fd65bf4 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 _0x29c0=['exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x29c0,0x191));var _0x029c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x29c0[_0xae7c2f];return _0x5d7001;};'use strict';var express=require(_0x029c('0x0'));var router=express[_0x029c('0x1')]();var auth=require(_0x029c('0x2'));var controller=require(_0x029c('0x3'));router['put'](_0x029c('0x4'),auth[_0x029c('0x5')](),controller[_0x029c('0x6')]);module[_0x029c('0x7')]=router; \ No newline at end of file +var _0xcaf0=['/:id','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x34fa67,_0x1823ab){var _0x4bf61b=function(_0x152160){while(--_0x152160){_0x34fa67['push'](_0x34fa67['shift']());}};_0x4bf61b(++_0x1823ab);}(_0xcaf0,0xcf));var _0x0caf=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcaf0[_0x232ec0];return _0x356705;};'use strict';var express=require(_0x0caf('0x0'));var router=express['Router']();var auth=require(_0x0caf('0x1'));var controller=require(_0x0caf('0x2'));router['put'](_0x0caf('0x3'),auth[_0x0caf('0x4')](),controller[_0x0caf('0x5')]);module[_0x0caf('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 f5295a5..a3649ea 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 _0xa997=['INTEGER','UserId','sequelize','warning','info','error','TEXT','DATE'];(function(_0x3ea00b,_0x3d5409){var _0xe0082d=function(_0x532c4c){while(--_0x532c4c){_0x3ea00b['push'](_0x3ea00b['shift']());}};_0xe0082d(++_0x3d5409);}(_0xa997,0x1ca));var _0x7a99=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xa997[_0x5a4400];return _0xf9b532;};'use strict';var Sequelize=require(_0x7a99('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x7a99('0x1'),_0x7a99('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7a99('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7a99('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7a99('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7a99('0x6')],'unique':_0x7a99('0x7')}}; \ No newline at end of file +var _0x6f7b=['exports','ENUM','error','BOOLEAN','TEXT','DATE','INTEGER','sequelize','warning','info','debug'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6f7b,0x11a));var _0xb6f7=function(_0x36a99e,_0xe8e30e){_0x36a99e=_0x36a99e-0x0;var _0x34b61f=_0x6f7b[_0x36a99e];return _0x34b61f;};'use strict';var Sequelize=require(_0xb6f7('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb6f7('0x1'),_0xb6f7('0x2'),_0xb6f7('0x3')];module[_0xb6f7('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb6f7('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb6f7('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb6f7('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb6f7('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb6f7('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb6f7('0xa')],'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 fe284ab..7592bcc 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 _0xecd5=['socket.io-emitter','redis','./user-setting.socket','localhost','status','json','update','then','sendStatus','stack','name','send','role','admin','params','Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/logger','api','../../mysqldb'];(function(_0x3142ba,_0x1489d4){var _0x2c818e=function(_0x17f16d){while(--_0x17f16d){_0x3142ba['push'](_0x3142ba['shift']());}};_0x2c818e(++_0x1489d4);}(_0xecd5,0x110));var _0x5ecd=function(_0x2951ba,_0x6fd214){_0x2951ba=_0x2951ba-0x0;var _0x22221e=_0xecd5[_0x2951ba];return _0x22221e;};'use strict';var _=require('lodash');var Redis=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var config=require('../../config/environment');var db=require(_0x5ecd('0x3'))['db'];var socket=require(_0x5ecd('0x4'))(new Redis(config[_0x5ecd('0x5')]));require(_0x5ecd('0x6'))['register'](socket);config[_0x5ecd('0x5')]=_['defaults'](config[_0x5ecd('0x5')],{'host':_0x5ecd('0x7'),'port':0x18eb});function respondWithResult(_0x4a1870,_0x42c752){_0x42c752=_0x42c752||0xc8;return function(_0x26d951){if(_0x26d951){return _0x4a1870[_0x5ecd('0x8')](_0x42c752)[_0x5ecd('0x9')](_0x26d951);}};}function saveUpdates(_0x39c98f){return function(_0x3e9833){if(_0x3e9833){return _0x3e9833[_0x5ecd('0xa')](_0x39c98f)[_0x5ecd('0xb')](function(_0x340c6b){return _0x340c6b;});}return null;};}function handleEntityNotFound(_0x22781a){return function(_0x317051){if(!_0x317051){_0x22781a[_0x5ecd('0xc')](0x194);}return _0x317051;};}function handleError(_0x5a8b1c,_0x31685a){_0x31685a=_0x31685a||0x1f4;return function(_0x55c216){logger['error'](_0x55c216[_0x5ecd('0xd')]);if(_0x55c216[_0x5ecd('0xe')]){delete _0x55c216['name'];}_0x5a8b1c['status'](_0x31685a)[_0x5ecd('0xf')](_0x55c216);};}exports[_0x5ecd('0xa')]=function(_0x47cf02,_0x37bfe1){if(_0x47cf02['user'][_0x5ecd('0x10')]!==_0x5ecd('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x47cf02[_0x5ecd('0x12')]['id'])))throw new Error(_0x5ecd('0x13'));return db['UserSetting'][_0x5ecd('0x14')]({'where':{'id':_0x47cf02['params']['id']}})[_0x5ecd('0xb')](handleEntityNotFound(_0x37bfe1,null))[_0x5ecd('0xb')](saveUpdates(_0x47cf02[_0x5ecd('0x15')],null))[_0x5ecd('0xb')](respondWithResult(_0x37bfe1,null))[_0x5ecd('0x16')](handleError(_0x37bfe1,null));}; \ No newline at end of file +var _0x2060=['status','send','user','role','admin','params','UserSetting','find','body','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','localhost','json','update','then','sendStatus','stack','name'];(function(_0x114463,_0xbe6dd9){var _0x138c9a=function(_0x487413){while(--_0x487413){_0x114463['push'](_0x114463['shift']());}};_0x138c9a(++_0xbe6dd9);}(_0x2060,0x1be));var _0x0206=function(_0x131634,_0x4959f1){_0x131634=_0x131634-0x0;var _0x4ac914=_0x2060[_0x131634];return _0x4ac914;};'use strict';var _=require(_0x0206('0x0'));var Redis=require('ioredis');var logger=require(_0x0206('0x1'))(_0x0206('0x2'));var config=require(_0x0206('0x3'));var db=require(_0x0206('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0206('0x5')]));require(_0x0206('0x6'))['register'](socket);config[_0x0206('0x5')]=_['defaults'](config[_0x0206('0x5')],{'host':_0x0206('0x7'),'port':0x18eb});function respondWithResult(_0x529d59,_0x2eda0e){_0x2eda0e=_0x2eda0e||0xc8;return function(_0x5c8dbb){if(_0x5c8dbb){return _0x529d59['status'](_0x2eda0e)[_0x0206('0x8')](_0x5c8dbb);}};}function saveUpdates(_0x3b9cd7){return function(_0x3bc420){if(_0x3bc420){return _0x3bc420[_0x0206('0x9')](_0x3b9cd7)[_0x0206('0xa')](function(_0x3e20d1){return _0x3e20d1;});}return null;};}function handleEntityNotFound(_0x2cdca9){return function(_0x138f07){if(!_0x138f07){_0x2cdca9[_0x0206('0xb')](0x194);}return _0x138f07;};}function handleError(_0x4223da,_0x3cc292){_0x3cc292=_0x3cc292||0x1f4;return function(_0x521d23){logger['error'](_0x521d23[_0x0206('0xc')]);if(_0x521d23[_0x0206('0xd')]){delete _0x521d23['name'];}_0x4223da[_0x0206('0xe')](_0x3cc292)[_0x0206('0xf')](_0x521d23);};}exports[_0x0206('0x9')]=function(_0x4a7bac,_0x2217e8){if(_0x4a7bac[_0x0206('0x10')][_0x0206('0x11')]!==_0x0206('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x4a7bac[_0x0206('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x0206('0x14')][_0x0206('0x15')]({'where':{'id':_0x4a7bac[_0x0206('0x13')]['id']}})[_0x0206('0xa')](handleEntityNotFound(_0x2217e8,null))[_0x0206('0xa')](saveUpdates(_0x4a7bac[_0x0206('0x16')],null))['then'](respondWithResult(_0x2217e8,null))['catch'](handleError(_0x2217e8,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 9929d89..350b146 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 _0x1541=['hook','../../mysqldb','UserSetting','save','update','remove','emit'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x1541,0x158));var _0x1154=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x1541[_0x3227c1];return _0x31fd48;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x1154('0x0'))['db'][_0x1154('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1154('0x2'),'afterUpdate':_0x1154('0x3'),'afterDestroy':_0x1154('0x4')};function emitEvent(_0x3094e1){return function(_0x472999,_0x18177b,_0x44e598){UserSettingEvents[_0x1154('0x5')](_0x3094e1+':'+_0x472999['id'],_0x472999);UserSettingEvents[_0x1154('0x5')](_0x3094e1,_0x472999);_0x44e598(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1154('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xc196=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x246cbe,_0x19305c){var _0x855b0=function(_0x2c8d0d){while(--_0x2c8d0d){_0x246cbe['push'](_0x246cbe['shift']());}};_0x855b0(++_0x19305c);}(_0xc196,0x113));var _0x6c19=function(_0x17e2f2,_0x4835e8){_0x17e2f2=_0x17e2f2-0x0;var _0x1dedb3=_0xc196[_0x17e2f2];return _0x1dedb3;};'use strict';var EventEmitter=require(_0x6c19('0x0'));var UserSetting=require(_0x6c19('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6c19('0x2')](0x0);var events={'afterCreate':_0x6c19('0x3'),'afterUpdate':_0x6c19('0x4'),'afterDestroy':_0x6c19('0x5')};function emitEvent(_0x42bf1d){return function(_0x1e82e0,_0xb5beca,_0x7f2c71){UserSettingEvents[_0x6c19('0x6')](_0x42bf1d+':'+_0x1e82e0['id'],_0x1e82e0);UserSettingEvents[_0x6c19('0x6')](_0x42bf1d,_0x1e82e0);_0x7f2c71(null);};}for(var e in events){if(events[_0x6c19('0x7')](e)){var event=events[e];UserSetting[_0x6c19('0x8')](e,emitEvent(event));}}module[_0x6c19('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 7e9b1aa..38caed9 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 _0x5106=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x542e08,_0x2b046f){var _0x1bc656=function(_0x3f3e8d){while(--_0x3f3e8d){_0x542e08['push'](_0x542e08['shift']());}};_0x1bc656(++_0x2b046f);}(_0x5106,0x116));var _0x6510=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5106[_0x122ef9];return _0x42fba0;};'use strict';var attributes=require(_0x6510('0x0'));module['exports']=function(_0x276f19){return _0x276f19['define'](_0x6510('0x1'),attributes,{'tableName':_0x6510('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x579fe8){if(!_0x579fe8['clientSideLoggingEnabled'])_0x579fe8[_0x6510('0x3')]=null;else if(_0x579fe8[_0x6510('0x3')]===null)_0x579fe8[_0x6510('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x3c2c=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x164759,_0x3fbc17){var _0x53868b=function(_0x1f73d5){while(--_0x1f73d5){_0x164759['push'](_0x164759['shift']());}};_0x53868b(++_0x3fbc17);}(_0x3c2c,0x160));var _0xc3c2=function(_0x562331,_0x45638f){_0x562331=_0x562331-0x0;var _0x3c0e48=_0x3c2c[_0x562331];return _0x3c0e48;};'use strict';var attributes=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]=function(_0x34190d){return _0x34190d[_0xc3c2('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x321ef5){if(!_0x321ef5[_0xc3c2('0x3')])_0x321ef5[_0xc3c2('0x4')]=null;else if(_0x321ef5[_0xc3c2('0x4')]===null)_0x321ef5['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 46acdd1..7c4797d 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 _0x2a0b=['length','./user-setting.events','save','remove','update','emit','register'];(function(_0x43d61b,_0x539e3e){var _0x4ca40e=function(_0xbca421){while(--_0xbca421){_0x43d61b['push'](_0x43d61b['shift']());}};_0x4ca40e(++_0x539e3e);}(_0x2a0b,0xcc));var _0xb2a0=function(_0x2047cc,_0x24c166){_0x2047cc=_0x2047cc-0x0;var _0xc1beca=_0x2a0b[_0x2047cc];return _0xc1beca;};'use strict';var UserSettingEvents=require(_0xb2a0('0x0'));var events=[_0xb2a0('0x1'),_0xb2a0('0x2'),_0xb2a0('0x3')];function createListener(_0x27966e,_0x20550e){return function(_0x43b104){_0x20550e[_0xb2a0('0x4')](_0x27966e,_0x43b104);if(_0x27966e==='user-setting:update'){_0x20550e['emit']('user-setting:update:user-'+_0x43b104['UserId'],_0x43b104);}};}exports[_0xb2a0('0x5')]=function(_0x250af1){for(var _0x1d8d93=0x0,_0x3d30fc=events[_0xb2a0('0x6')];_0x1d8d93<_0x3d30fc;_0x1d8d93++){var _0x30d9a7=events[_0x1d8d93];var _0xe4d7f5=createListener('user-setting:'+_0x30d9a7,_0x250af1);UserSettingEvents['on'](_0x30d9a7,_0xe4d7f5);}}; \ No newline at end of file +var _0xb9bf=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x47b794,_0x4d87ac){var _0x36223f=function(_0xfeec79){while(--_0xfeec79){_0x47b794['push'](_0x47b794['shift']());}};_0x36223f(++_0x4d87ac);}(_0xb9bf,0xaf));var _0xfb9b=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xb9bf[_0x2261ce];return _0x524640;};'use strict';var UserSettingEvents=require(_0xfb9b('0x0'));var events=[_0xfb9b('0x1'),_0xfb9b('0x2'),'update'];function createListener(_0xf7214a,_0x5085de){return function(_0x497e1d){_0x5085de[_0xfb9b('0x3')](_0xf7214a,_0x497e1d);if(_0xf7214a===_0xfb9b('0x4')){_0x5085de[_0xfb9b('0x3')](_0xfb9b('0x5')+_0x497e1d['UserId'],_0x497e1d);}};}exports[_0xfb9b('0x6')]=function(_0x2ef841){for(var _0x356d39=0x0,_0x466b70=events[_0xfb9b('0x7')];_0x356d39<_0x466b70;_0x356d39++){var _0x3eb465=events[_0x356d39];var _0x3e2a44=createListener(_0xfb9b('0x8')+_0x3eb465,_0x2ef841);UserSettingEvents['on'](_0x3eb465,_0x3e2a44);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6b4f0d5..e62e92d 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 _0xa85d=['/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/api_key','getApiKey','addContacts','post','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts'];(function(_0xb069d2,_0x66f5aa){var _0x137711=function(_0x4c31b4){while(--_0x4c31b4){_0xb069d2['push'](_0xb069d2['shift']());}};_0x137711(++_0x66f5aa);}(_0xa85d,0x192));var _0xda85=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xa85d[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0xda85('0x0'));var util=require(_0xda85('0x1'));var path=require(_0xda85('0x2'));var timeout=require(_0xda85('0x3'));var express=require(_0xda85('0x4'));var router=express[_0xda85('0x5')]();var fs_extra=require(_0xda85('0x6'));var auth=require(_0xda85('0x7'));var interaction=require(_0xda85('0x8'));var config=require('../../config/environment');var controller=require(_0xda85('0x9'));router['get']('/',auth[_0xda85('0xa')](),controller[_0xda85('0xb')]);router[_0xda85('0xc')](_0xda85('0xd'),auth['isAuthenticated'](),controller[_0xda85('0xe')]);router[_0xda85('0xc')]('/whoami',auth['isAuthenticated'](),controller[_0xda85('0xf')]);router[_0xda85('0xc')]('/presence',auth[_0xda85('0xa')](),controller['getPresence']);router['get'](_0xda85('0x10'),auth[_0xda85('0xa')](),controller[_0xda85('0x11')]);router[_0xda85('0xc')](_0xda85('0x12'),controller[_0xda85('0x13')]);router[_0xda85('0xc')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xda85('0x14')]);router['get'](_0xda85('0x15'),auth['isAuthenticated'](),controller[_0xda85('0x16')]);router[_0xda85('0xc')]('/:id/queues',auth[_0xda85('0xa')](),controller['getQueues']);router[_0xda85('0xc')]('/:id/queues_rt',auth[_0xda85('0xa')](),controller[_0xda85('0x17')]);router[_0xda85('0xc')]('/:id/groups',auth['isAuthenticated'](),controller[_0xda85('0x18')]);router[_0xda85('0xc')](_0xda85('0x19'),auth[_0xda85('0xa')](),controller[_0xda85('0x1a')]);router[_0xda85('0xc')](_0xda85('0x1b'),auth[_0xda85('0xa')](),controller[_0xda85('0x1c')]);router[_0xda85('0xc')](_0xda85('0x1d'),auth['isAuthenticated'](),controller[_0xda85('0x1e')]);router[_0xda85('0xc')](_0xda85('0x1f'),auth['isAuthenticated'](),controller[_0xda85('0x20')]);router[_0xda85('0xc')](_0xda85('0x21'),auth[_0xda85('0xa')](),controller[_0xda85('0x22')]);router[_0xda85('0xc')](_0xda85('0x23'),auth[_0xda85('0xa')](),controller[_0xda85('0x24')]);router['get'](_0xda85('0x25'),auth[_0xda85('0xa')](),controller['getFaxInteractions']);router[_0xda85('0xc')]('/:id/whatsapp/interactions',auth[_0xda85('0xa')](),controller[_0xda85('0x26')]);router[_0xda85('0xc')](_0xda85('0x27'),auth[_0xda85('0xa')](),controller[_0xda85('0x28')]);router[_0xda85('0xc')](_0xda85('0x29'),auth[_0xda85('0xa')](),controller['getLists']);router[_0xda85('0xc')](_0xda85('0x2a'),auth[_0xda85('0xa')](),controller[_0xda85('0x2b')]);router[_0xda85('0xc')](_0xda85('0x2c'),auth[_0xda85('0xa')](),controller[_0xda85('0x2d')]);router[_0xda85('0xc')](_0xda85('0x2e'),auth['isAuthenticated'](),controller[_0xda85('0x2f')]);router[_0xda85('0xc')](_0xda85('0x30'),auth[_0xda85('0xa')](),controller['getMailAccounts']);router[_0xda85('0xc')](_0xda85('0x31'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xda85('0x32'),auth[_0xda85('0xa')](),controller[_0xda85('0x33')]);router[_0xda85('0xc')](_0xda85('0x34'),auth[_0xda85('0xa')](),controller['getChatWebsites']);router[_0xda85('0xc')](_0xda85('0x35'),auth['isAuthenticated'](),controller[_0xda85('0x36')]);router[_0xda85('0xc')](_0xda85('0x37'),auth[_0xda85('0xa')](),controller['getSquareProjects']);router['get']('/:id/scheduled_calls',auth[_0xda85('0xa')](),controller['getScheduledCalls']);router[_0xda85('0xc')](_0xda85('0x38'),auth[_0xda85('0xa')](),controller[_0xda85('0x39')]);router['post'](_0xda85('0x15'),auth[_0xda85('0xa')](),controller[_0xda85('0x3a')]);router['post']('/',auth[_0xda85('0xa')](),controller['create']);router[_0xda85('0x3b')](_0xda85('0x3c'),auth[_0xda85('0xa')](),controller[_0xda85('0x3d')]);router[_0xda85('0x3b')](_0xda85('0x3e'),auth[_0xda85('0xa')](),controller[_0xda85('0x3f')]);var upload=multer({'storage':multer[_0xda85('0x40')]({'destination':function(_0x57b37f,_0x1dae47,_0x119bf1){_0x119bf1(null,path[_0xda85('0x41')](config[_0xda85('0x42')],_0xda85('0x43')));},'filename':function(_0x541d62,_0x475667,_0x18dadd){_0x18dadd(null,util[_0xda85('0x44')]('%s-%s',Date[_0xda85('0x45')](),_0x475667[_0xda85('0x46')]));}})});router[_0xda85('0x3b')](_0xda85('0x12'),upload[_0xda85('0x47')](_0xda85('0x48')),controller[_0xda85('0x49')]);router[_0xda85('0x3b')](_0xda85('0x4a'),auth[_0xda85('0xa')](),controller[_0xda85('0x4b')]);router[_0xda85('0x3b')]('/:id/logout',auth['isAuthenticated'](),controller[_0xda85('0x4c')]);router[_0xda85('0x3b')](_0xda85('0x4d'),auth['isAuthenticated'](),controller[_0xda85('0x4e')]);router[_0xda85('0x3b')](_0xda85('0x4f'),auth[_0xda85('0xa')](),controller[_0xda85('0x50')]);router[_0xda85('0x3b')]('/:id/teams',auth[_0xda85('0xa')](),controller[_0xda85('0x51')]);router['post'](_0xda85('0x52'),auth[_0xda85('0xa')](),controller[_0xda85('0x53')]);router[_0xda85('0x3b')]('/:id/mail_interactions',auth[_0xda85('0xa')](),controller[_0xda85('0x54')]);router[_0xda85('0x3b')](_0xda85('0x55'),auth['isAuthenticated'](),controller[_0xda85('0x56')]);router[_0xda85('0x3b')](_0xda85('0x57'),auth[_0xda85('0xa')](),controller[_0xda85('0x58')]);router[_0xda85('0x3b')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xda85('0x3b')]('/:id/whatsapp_interactions',auth[_0xda85('0xa')](),controller[_0xda85('0x59')]);router[_0xda85('0x3b')](_0xda85('0x2e'),auth[_0xda85('0xa')](),controller['addFaxAccounts']);router[_0xda85('0x3b')](_0xda85('0x30'),auth[_0xda85('0xa')](),controller['addMailAccounts']);router[_0xda85('0x3b')](_0xda85('0x31'),auth[_0xda85('0xa')](),controller[_0xda85('0x5a')]);router[_0xda85('0x3b')](_0xda85('0x32'),auth[_0xda85('0xa')](),controller[_0xda85('0x5b')]);router[_0xda85('0x3b')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xda85('0x5c')]);router[_0xda85('0x3b')](_0xda85('0x35'),auth[_0xda85('0xa')](),controller[_0xda85('0x5d')]);router[_0xda85('0x3b')](_0xda85('0x37'),auth['isAuthenticated'](),controller['addSquareProjects']);router['post'](_0xda85('0x38'),auth[_0xda85('0xa')](),controller[_0xda85('0x5e')]);router[_0xda85('0x5f')](_0xda85('0x10'),auth[_0xda85('0xa')](),controller[_0xda85('0x60')]);router[_0xda85('0x5f')]('/:id/password',auth[_0xda85('0xa')](),controller[_0xda85('0x61')]);router[_0xda85('0x62')](_0xda85('0x3e'),auth['isAuthenticated'](),controller[_0xda85('0x63')]);router[_0xda85('0x62')](_0xda85('0x27'),auth[_0xda85('0xa')](),controller[_0xda85('0x64')]);router[_0xda85('0x62')](_0xda85('0x10'),auth[_0xda85('0xa')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xda85('0x65')]);router[_0xda85('0x62')](_0xda85('0x66'),auth[_0xda85('0xa')](),controller[_0xda85('0x67')]);router[_0xda85('0x62')](_0xda85('0x55'),auth[_0xda85('0xa')](),controller[_0xda85('0x68')]);router[_0xda85('0x62')](_0xda85('0x57'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xda85('0x62')](_0xda85('0x69'),auth[_0xda85('0xa')](),controller[_0xda85('0x6a')]);router[_0xda85('0x62')](_0xda85('0x6b'),auth[_0xda85('0xa')](),controller[_0xda85('0x6c')]);router['delete'](_0xda85('0x2e'),auth[_0xda85('0xa')](),controller['removeFaxAccounts']);router[_0xda85('0x62')](_0xda85('0x30'),auth[_0xda85('0xa')](),controller[_0xda85('0x6d')]);router[_0xda85('0x62')](_0xda85('0x31'),auth[_0xda85('0xa')](),controller[_0xda85('0x6e')]);router[_0xda85('0x62')](_0xda85('0x32'),auth[_0xda85('0xa')](),controller['removeSmsAccounts']);router[_0xda85('0x62')](_0xda85('0x34'),auth[_0xda85('0xa')](),controller['removeChatWebsites']);router[_0xda85('0x62')](_0xda85('0x35'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0xda85('0x37'),auth[_0xda85('0xa')](),controller[_0xda85('0x6f')]);router[_0xda85('0x62')](_0xda85('0x38'),auth[_0xda85('0xa')](),controller[_0xda85('0x70')]);module['exports']=router; \ No newline at end of file +var _0xb786=['/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','update','put','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','getVoiceQueuesRt'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb786,0x64));var _0x6b78=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0xb786[_0x1c60bd];return _0xc46ef9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b78('0x0'));var timeout=require(_0x6b78('0x1'));var express=require(_0x6b78('0x2'));var router=express[_0x6b78('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b78('0x4'));var interaction=require(_0x6b78('0x5'));var config=require(_0x6b78('0x6'));var controller=require('./user.controller');router[_0x6b78('0x7')]('/',auth[_0x6b78('0x8')](),controller[_0x6b78('0x9')]);router[_0x6b78('0x7')](_0x6b78('0xa'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xb')]);router['get'](_0x6b78('0xc'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xd')]);router[_0x6b78('0x7')](_0x6b78('0xe'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xf')]);router[_0x6b78('0x7')](_0x6b78('0x10'),auth['isAuthenticated'](),controller[_0x6b78('0x11')]);router['get'](_0x6b78('0x12'),controller['getAvatar']);router[_0x6b78('0x7')](_0x6b78('0x13'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x14')]);router[_0x6b78('0x7')]('/:id/contacts',auth[_0x6b78('0x8')](),controller['getContacts']);router[_0x6b78('0x7')]('/:id/queues',auth[_0x6b78('0x8')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x6b78('0x15')]);router['get'](_0x6b78('0x16'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x17')]);router[_0x6b78('0x7')](_0x6b78('0x18'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x19')]);router['get'](_0x6b78('0x1a'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x1b')]);router['get'](_0x6b78('0x1c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x1d')]);router['get']('/:id/openchannel/interactions',auth[_0x6b78('0x8')](),controller[_0x6b78('0x1e')]);router[_0x6b78('0x7')](_0x6b78('0x1f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x20')]);router[_0x6b78('0x7')](_0x6b78('0x21'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x22')]);router[_0x6b78('0x7')]('/:id/fax/interactions',auth[_0x6b78('0x8')](),controller['getFaxInteractions']);router[_0x6b78('0x7')](_0x6b78('0x23'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x24')]);router['get'](_0x6b78('0x25'),auth[_0x6b78('0x8')](),controller['getTeams']);router[_0x6b78('0x7')](_0x6b78('0x26'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x27')]);router[_0x6b78('0x7')]('/:id/agents',auth[_0x6b78('0x8')](),controller[_0x6b78('0x28')]);router[_0x6b78('0x7')](_0x6b78('0x29'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x2a')]);router[_0x6b78('0x7')](_0x6b78('0x2b'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x2c')]);router[_0x6b78('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x2d')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x2e')]);router[_0x6b78('0x7')](_0x6b78('0x2f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x30')]);router['get']('/:id/chat_websites',auth[_0x6b78('0x8')](),controller[_0x6b78('0x31')]);router[_0x6b78('0x7')]('/:id/whatsapp_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x32')]);router[_0x6b78('0x7')](_0x6b78('0x33'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x34')]);router[_0x6b78('0x7')](_0x6b78('0x35'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x36')]);router[_0x6b78('0x7')](_0x6b78('0x37'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x6b78('0x38')](_0x6b78('0x39'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3a')]);router[_0x6b78('0x38')]('/',auth['isAuthenticated'](),controller[_0x6b78('0x3b')]);router[_0x6b78('0x38')](_0x6b78('0x3c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3d')]);router[_0x6b78('0x38')](_0x6b78('0x3e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3f')]);var upload=multer({'storage':multer[_0x6b78('0x40')]({'destination':function(_0x155a44,_0x19000f,_0x542e9b){_0x542e9b(null,path[_0x6b78('0x41')](config[_0x6b78('0x42')],_0x6b78('0x43')));},'filename':function(_0x369775,_0x3476f4,_0x16a603){_0x16a603(null,util['format'](_0x6b78('0x44'),Date[_0x6b78('0x45')](),_0x3476f4[_0x6b78('0x46')]));}})});router[_0x6b78('0x38')]('/:id/avatar',upload[_0x6b78('0x47')](_0x6b78('0x48')),controller['addAvatar']);router[_0x6b78('0x38')](_0x6b78('0x49'),auth['isAuthenticated'](),controller[_0x6b78('0x4a')]);router[_0x6b78('0x38')](_0x6b78('0x4b'),auth[_0x6b78('0x8')](),controller['logout']);router['post'](_0x6b78('0x4c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x4d')]);router[_0x6b78('0x38')](_0x6b78('0x4e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x4f')]);router[_0x6b78('0x38')](_0x6b78('0x25'),auth['isAuthenticated'](),controller[_0x6b78('0x50')]);router[_0x6b78('0x38')](_0x6b78('0x51'),auth['isAuthenticated'](),controller[_0x6b78('0x52')]);router['post'](_0x6b78('0x53'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x54')]);router[_0x6b78('0x38')](_0x6b78('0x55'),auth[_0x6b78('0x8')](),controller['addFaxInteractions']);router[_0x6b78('0x38')](_0x6b78('0x56'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x57')]);router[_0x6b78('0x38')]('/:id/openchannel_interactions',auth[_0x6b78('0x8')](),controller[_0x6b78('0x58')]);router[_0x6b78('0x38')]('/:id/whatsapp_interactions',auth[_0x6b78('0x8')](),controller['addWhatsappInteractions']);router[_0x6b78('0x38')]('/:id/fax_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x59')]);router[_0x6b78('0x38')]('/:id/mail_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x5a')]);router[_0x6b78('0x38')](_0x6b78('0x5b'),auth[_0x6b78('0x8')](),controller['addOpenchannelAccounts']);router[_0x6b78('0x38')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x5c')]);router[_0x6b78('0x38')]('/:id/chat_websites',auth[_0x6b78('0x8')](),controller[_0x6b78('0x5d')]);router[_0x6b78('0x38')](_0x6b78('0x5e'),auth[_0x6b78('0x8')](),controller['addWhatsappAccounts']);router[_0x6b78('0x38')](_0x6b78('0x33'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x6b78('0x38')](_0x6b78('0x37'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x5f')]);router['put']('/:id',auth[_0x6b78('0x8')](),controller[_0x6b78('0x60')]);router[_0x6b78('0x61')]('/:id/password',auth[_0x6b78('0x8')](),controller[_0x6b78('0x62')]);router[_0x6b78('0x63')](_0x6b78('0x3e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x64')]);router[_0x6b78('0x63')](_0x6b78('0x25'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x65')]);router[_0x6b78('0x63')](_0x6b78('0x10'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x66')]);router[_0x6b78('0x63')](_0x6b78('0x51'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x67')]);router[_0x6b78('0x63')](_0x6b78('0x53'),auth['isAuthenticated'](),controller[_0x6b78('0x68')]);router['delete'](_0x6b78('0x55'),auth['isAuthenticated'](),controller[_0x6b78('0x69')]);router[_0x6b78('0x63')](_0x6b78('0x56'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6a')]);router[_0x6b78('0x63')](_0x6b78('0x6b'),auth['isAuthenticated'](),controller[_0x6b78('0x6c')]);router[_0x6b78('0x63')](_0x6b78('0x6d'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6e')]);router[_0x6b78('0x63')](_0x6b78('0x2b'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6f')]);router[_0x6b78('0x63')](_0x6b78('0x70'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x71')]);router[_0x6b78('0x63')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x72')]);router[_0x6b78('0x63')](_0x6b78('0x2f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x73')]);router[_0x6b78('0x63')](_0x6b78('0x74'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x75')]);router[_0x6b78('0x63')](_0x6b78('0x5e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x76')]);router[_0x6b78('0x63')](_0x6b78('0x33'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x77')]);router[_0x6b78('0x63')](_0x6b78('0x37'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x78')]);module[_0x6b78('0x79')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 970d3e8..7c5d9eb 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +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(_0x5b280e,_0x16ca48){var _0xcc44a2=function(_0x3d76b8){while(--_0x3d76b8){_0x5b280e['push'](_0x5b280e['shift']());}};_0xcc44a2(++_0x16ca48);}(_0xedd9,0xfc));var _0x9edd=function(_0xd2d0a7,_0x39e2fc){_0xd2d0a7=_0xd2d0a7-0x0;var _0x429ed4=_0xedd9[_0xd2d0a7];return _0x429ed4;};'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 diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 6ffaa6f..3f17ea5 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 _0x7686=['upsert','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Team','removeAgent','TeamVoicePrefix','getDataValue','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lte','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','lastName','Contact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','isEmpty','inbound','flatten','col','toString','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','select','field','ui.','InteractionId','user_has_','_interactions','OpenTabs','moment','bluebird','util','path','lodash','ioredis','../../config/logger','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','Users','user','Agents','agent','Telephones','ignore','value','includes','role','find','UserProfileResource','destroy','stack','name','User','map','type','key','filter','password','salt','getOptions','includeAll','include','query','true','userSetting','attributes','findAll','rows','openTabs','length','push','chat','dataValues','sms','fax','whatsapp','catch','show','params','model','differenceBy','rawAttributes','keys','filters','intersection','fields','merge','openchannel','all','body','describe','addContacts','ids','omit','internal','Setting','securePassword','max','min_internal','sequelize','QueryTypes','SELECT','isNil','from','voicemail','mailbox','fullname','permissions','101','102','113','110','104','106','107','109','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','telephone','autoAssociation','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','Queues','penalty','capitalize','emit','Queue:save','voice','VoiceQueue','get','format','SIP/%s','UserVoiceQueueRt','removeQueues','isValidChannel','isArray','QueueId','Queue:remove','addAvatar','filename','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','download','mail','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MAIL','WhatsappOpenTabs','getContacts','CmContact','order','sort','where','pick','options','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','hasOwnProperty','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','bulkCreate','concat','LOGININPAUSE','resolve','logout','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','whatsapppause','pauseType','QueuePause','manual','%s%s','Pause','getTeams','addTeams','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','addAgent','Voice'];(function(_0x58289b,_0xe70210){var _0x3dee8e=function(_0x55cd2f){while(--_0x55cd2f){_0x58289b['push'](_0x58289b['shift']());}};_0x3dee8e(++_0xe70210);}(_0x7686,0x7c));var _0x6768=function(_0x5e69e0,_0x13900a){_0x5e69e0=_0x5e69e0-0x0;var _0x193e24=_0x7686[_0x5e69e0];return _0x193e24;};'use strict';var moment=require(_0x6768('0x0'));var BPromise=require(_0x6768('0x1'));var util=require(_0x6768('0x2'));var path=require(_0x6768('0x3'));var fs=require('fs');var _=require(_0x6768('0x4'));var squel=require('squel');var jayson=require('jayson/promise');var Redis=require(_0x6768('0x5'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0x6768('0x6'))('api');var utils=require(_0x6768('0x7'));var config=require(_0x6768('0x8'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x6768('0x9'))[_0x6768('0xa')];var APINotFoundError=require(_0x6768('0x9'))['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0x6768('0xb')];var db=require(_0x6768('0xc'))['db'];var socket=require(_0x6768('0xd'))(new Redis(config[_0x6768('0xe')]));require(_0x6768('0xf'))['register'](socket);config[_0x6768('0xe')]=_[_0x6768('0x10')](config[_0x6768('0xe')],{'host':_0x6768('0x11'),'port':0x18eb});var client=jayson[_0x6768('0x12')][_0x6768('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x19437c,_0x177f0a,_0x3e9dc2,_0xdc4ddf){return new BPromise(function(_0x5d5e8a,_0x4f51a7){var _0x22221a=_0xdc4ddf||client;return _0x22221a[_0x6768('0x14')](_0x19437c,_0x3e9dc2)[_0x6768('0x15')](function(_0x1ae172){logger[_0x6768('0x16')](_0x6768('0x17'),_0x177f0a,'request\x20sent');logger['debug'](_0x6768('0x18'),_0x177f0a,_0x6768('0x19'),JSON[_0x6768('0x1a')](_0x1ae172));if(_0x1ae172[_0x6768('0x1b')]){if(_0x1ae172[_0x6768('0x1b')]['code']===0x1f4){logger[_0x6768('0x1b')](_0x6768('0x17'),_0x177f0a,_0x1ae172[_0x6768('0x1b')][_0x6768('0x1c')]);return _0x4f51a7(_0x1ae172[_0x6768('0x1b')][_0x6768('0x1c')]);}logger[_0x6768('0x1b')](_0x6768('0x17'),_0x177f0a,_0x1ae172[_0x6768('0x1b')][_0x6768('0x1c')]);return _0x5d5e8a(_0x1ae172[_0x6768('0x1b')][_0x6768('0x1c')]);}else{logger['info']('User,\x20%s,\x20%s',_0x177f0a,_0x6768('0x19'));_0x5d5e8a(_0x1ae172[_0x6768('0x1d')][_0x6768('0x1c')]);}})['catch'](function(_0x152351){logger[_0x6768('0x1b')](_0x6768('0x17'),_0x177f0a,_0x152351);_0x4f51a7(_0x152351);});});}function respondWithStatusCode(_0x520e26,_0x3e2722){_0x3e2722=_0x3e2722||0xcc;return function(_0x311c50){if(_0x311c50){return _0x520e26[_0x6768('0x1e')](_0x3e2722);}return _0x520e26['status'](_0x3e2722)[_0x6768('0x1f')]();};}function respondWithResult(_0x2d97c7,_0x50aad4){_0x50aad4=_0x50aad4||0xc8;return function(_0x55672a){if(_0x55672a){return _0x2d97c7[_0x6768('0x20')](_0x50aad4)[_0x6768('0x21')](_0x55672a);}};}function respondWithFilteredResult(_0x562d60,_0x4285cd){return function(_0x39dde5){if(_0x39dde5){var _0x532ac6=typeof _0x4285cd[_0x6768('0x22')]==='undefined'&&typeof _0x4285cd[_0x6768('0x23')]===_0x6768('0x24');var _0x501410=_0x39dde5[_0x6768('0x25')];var _0x41c128=_0x532ac6?0x0:_0x4285cd[_0x6768('0x22')];var _0x5b3eaa=_0x532ac6?_0x39dde5[_0x6768('0x25')]:_0x4285cd[_0x6768('0x22')]+_0x4285cd[_0x6768('0x23')];var _0x2d8e75;if(_0x5b3eaa>=_0x501410){_0x5b3eaa=_0x501410;_0x2d8e75=0xc8;}else{_0x2d8e75=0xce;}_0x562d60[_0x6768('0x20')](_0x2d8e75);return _0x562d60[_0x6768('0x26')](_0x6768('0x27'),_0x41c128+'-'+_0x5b3eaa+'/'+_0x501410)[_0x6768('0x21')](_0x39dde5);}return null;};}function saveUpdates(_0x447683){return function(_0x136488){if(_0x136488){return _0x136488[_0x6768('0x28')](_0x447683)[_0x6768('0x15')](function(_0x4cbb47){socket['emit']('userNotification:recalc:'+_0x4cbb47['id'],{});return _0x4cbb47;});}return null;};}function removeEntity(_0x106b7f){return function(_0x4548f6){if(_0x4548f6){return _0x4548f6['destroy']()['then'](function(){var _0x51107f=_0x4548f6['get']({'plain':!![]});if(_0x51107f['role']==='admin')return;var _0x921c11=[{'name':_0x6768('0x29'),'value':_0x6768('0x2a'),'ignore':!![]},{'name':_0x6768('0x2b'),'value':_0x6768('0x2c'),'ignore':![]},{'name':_0x6768('0x2d'),'value':'telephone','ignore':![]}];var _0xddb953=_(_0x921c11)['filter'](_0x6768('0x2e'))['map'](_0x6768('0x2f'))[_0x6768('0x2f')]();if(_[_0x6768('0x30')](_0xddb953,_0x51107f[_0x6768('0x31')])){return;}var _0x5aa463=_[_0x6768('0x32')](_0x921c11,[_0x6768('0x2f'),_0x51107f[_0x6768('0x31')]])['name'];return db[_0x6768('0x33')][_0x6768('0x34')]({'where':{'type':_0x5aa463,'resourceId':_0x51107f['id']}})[_0x6768('0x15')](function(){return _0x4548f6;});})[_0x6768('0x15')](function(){_0x106b7f[_0x6768('0x20')](0xcc)[_0x6768('0x1f')]();});}};}function handleEntityNotFound(_0x9d1edf){return function(_0x408dd9){if(!_0x408dd9){_0x9d1edf[_0x6768('0x1e')](0x194);}return _0x408dd9;};}function handleError(_0x313b20,_0x4e149f){_0x4e149f=_0x4e149f||0x1f4;return function(_0x2b5fd4){logger[_0x6768('0x1b')](_0x2b5fd4[_0x6768('0x35')]);if(_0x2b5fd4[_0x6768('0x36')]){delete _0x2b5fd4[_0x6768('0x36')];}_0x313b20[_0x6768('0x20')](_0x4e149f)['send'](_0x2b5fd4);};}exports['index']=function(_0x21d3e2,_0x4db4ec){var _0x36c552={},_0x407a33={'count':0x0,'rows':[]};var _0x1c8c03=_(db[_0x6768('0x37')]['rawAttributes'])[_0x6768('0x38')](function(_0x51777b){return{'name':_0x51777b['fieldName'],'type':_0x51777b[_0x6768('0x39')][_0x6768('0x3a')]};})[_0x6768('0x3b')](function(_0x1911b3){return!_[_0x6768('0x30')]([_0x6768('0x3c'),_0x6768('0x3d')],_0x1911b3[_0x6768('0x36')]);})[_0x6768('0x2f')]();_0x36c552=qs[_0x6768('0x3e')](_0x1c8c03,_0x21d3e2);var _0x5804dc={'where':_0x36c552['where']};return db['User'][_0x6768('0x25')](_0x5804dc)[_0x6768('0x15')](function(_0x372b49){_0x407a33[_0x6768('0x25')]=_0x372b49;if(_0x21d3e2['query'][_0x6768('0x3f')]){_0x36c552[_0x6768('0x40')]=[{'all':!![]}];}if(_0x21d3e2[_0x6768('0x41')]['userSetting']===_0x6768('0x42')){_0x36c552[_0x6768('0x40')]=[{'model':db['UserSetting'],'as':_0x6768('0x43')}];}if(!_['includes'](_0x36c552[_0x6768('0x44')],'id')){_0x36c552[_0x6768('0x44')]['push']('id');}return db['User'][_0x6768('0x45')](_0x36c552);})['then'](function(_0x3b346a){_0x407a33[_0x6768('0x46')]=_0x3b346a;if(_0x21d3e2['query'][_0x6768('0x47')]===_0x6768('0x42')){var _0x3eae78=[];for(var _0x1f4f2d=0x0;_0x1f4f2d<_0x407a33[_0x6768('0x46')][_0x6768('0x48')];_0x1f4f2d++){_0x3eae78[_0x6768('0x49')](get_open_tabs(_0x6768('0x4a'),_0x407a33[_0x6768('0x46')][_0x1f4f2d][_0x6768('0x4b')]));_0x3eae78[_0x6768('0x49')](get_open_tabs(_0x6768('0x4c'),_0x407a33[_0x6768('0x46')][_0x1f4f2d][_0x6768('0x4b')]));_0x3eae78[_0x6768('0x49')](get_open_tabs(_0x6768('0x4d'),_0x407a33[_0x6768('0x46')][_0x1f4f2d][_0x6768('0x4b')]));_0x3eae78[_0x6768('0x49')](get_open_tabs('mail',_0x407a33[_0x6768('0x46')][_0x1f4f2d][_0x6768('0x4b')]));_0x3eae78['push'](get_open_tabs('openchannel',_0x407a33[_0x6768('0x46')][_0x1f4f2d][_0x6768('0x4b')]));_0x3eae78['push'](get_open_tabs(_0x6768('0x4e'),_0x407a33['rows'][_0x1f4f2d][_0x6768('0x4b')]));}return BPromise['all'](_0x3eae78)[_0x6768('0x15')](function(){return _0x407a33;});}else{return _0x407a33;}})[_0x6768('0x15')](respondWithFilteredResult(_0x4db4ec,_0x36c552))[_0x6768('0x4f')](handleError(_0x4db4ec,null));};exports[_0x6768('0x50')]=function(_0x2225ae,_0x1a23d0){var _0x951420={'raw':![],'where':{'id':_0x2225ae[_0x6768('0x51')]['id']}},_0x7744a8={};_0x7744a8[_0x6768('0x52')]=_[_0x6768('0x53')](_['keys'](db[_0x6768('0x37')][_0x6768('0x54')]),[_0x6768('0x3c'),_0x6768('0x3d')]);_0x7744a8[_0x6768('0x41')]=_[_0x6768('0x55')](_0x2225ae[_0x6768('0x41')]);_0x7744a8[_0x6768('0x56')]=_[_0x6768('0x57')](_0x7744a8[_0x6768('0x52')],_0x7744a8['query']);_0x951420[_0x6768('0x44')]=_['intersection'](_0x7744a8['model'],qs[_0x6768('0x58')](_0x2225ae[_0x6768('0x41')][_0x6768('0x58')]));_0x951420[_0x6768('0x44')]=_0x951420['attributes'][_0x6768('0x48')]?_0x951420[_0x6768('0x44')]:_0x7744a8[_0x6768('0x52')];if(_0x2225ae[_0x6768('0x41')]['includeAll']){_0x951420[_0x6768('0x40')]=[{'all':!![]}];}if(_0x2225ae[_0x6768('0x41')][_0x6768('0x43')]===_0x6768('0x42')){_0x951420[_0x6768('0x40')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x951420=_[_0x6768('0x59')]({},_0x951420,_0x2225ae['options']);if(!_[_0x6768('0x30')](_0x951420[_0x6768('0x44')],'id')){_0x951420[_0x6768('0x44')][_0x6768('0x49')]('id');}return db['User'][_0x6768('0x32')](_0x951420)[_0x6768('0x15')](handleEntityNotFound(_0x1a23d0,null))[_0x6768('0x15')](function(_0x304b75){var _0x493685=[];values=_0x304b75;if(_0x2225ae[_0x6768('0x41')][_0x6768('0x47')]===_0x6768('0x42')){_0x493685[_0x6768('0x49')](get_open_tabs('chat',_0x304b75[_0x6768('0x4b')]));_0x493685[_0x6768('0x49')](get_open_tabs('sms',_0x304b75[_0x6768('0x4b')]));_0x493685['push'](get_open_tabs(_0x6768('0x5a'),_0x304b75[_0x6768('0x4b')]));_0x493685[_0x6768('0x49')](get_open_tabs(_0x6768('0x4e'),_0x304b75[_0x6768('0x4b')]));_0x493685[_0x6768('0x49')](get_open_tabs(_0x6768('0x4d'),_0x304b75[_0x6768('0x4b')]));_0x493685[_0x6768('0x49')](get_open_tabs('mail',_0x304b75[_0x6768('0x4b')]));return BPromise[_0x6768('0x5b')](_0x493685);}else{return values;}})[_0x6768('0x15')](function(){return values;})[_0x6768('0x15')](respondWithResult(_0x1a23d0,null))[_0x6768('0x4f')](handleError(_0x1a23d0,null));};exports[_0x6768('0x28')]=function(_0x5ba2cd,_0x2d3a35){if(_0x5ba2cd['body']['id']){delete _0x5ba2cd[_0x6768('0x5c')]['id'];}delete _0x5ba2cd[_0x6768('0x5c')][_0x6768('0x31')];return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x5ba2cd[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x2d3a35,null))[_0x6768('0x15')](saveUpdates(_0x5ba2cd[_0x6768('0x5c')],null))[_0x6768('0x15')](respondWithResult(_0x2d3a35,null))['catch'](handleError(_0x2d3a35,null));};exports['describe']=function(_0x216c14,_0x3eccbc){return db['User'][_0x6768('0x5d')]()[_0x6768('0x15')](respondWithResult(_0x3eccbc,null))[_0x6768('0x4f')](handleError(_0x3eccbc,null));};exports[_0x6768('0x5e')]=function(_0x1c35c5,_0x222791){return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x1c35c5[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x222791,null))[_0x6768('0x15')](function(_0x5b067c){if(_0x5b067c){return _0x5b067c[_0x6768('0x5e')](_0x1c35c5[_0x6768('0x5c')][_0x6768('0x5f')],_[_0x6768('0x60')](_0x1c35c5[_0x6768('0x5c')],[_0x6768('0x5f'),'id'])||{});}})[_0x6768('0x15')](respondWithResult(_0x222791,null))[_0x6768('0x4f')](handleError(_0x222791,null));};function validateUser(_0x3e69f4){return new BPromise(function(_0x15566d,_0x35b03a){if(_0x3e69f4[_0x6768('0x61')])return _0x15566d(_0x3e69f4);return db[_0x6768('0x62')]['findById'](0x1)['then'](function(_0x400120){if(_0x400120[_0x6768('0x63')])authService['validatePasswordPattern'](_0x3e69f4[_0x6768('0x3c')]);db[_0x6768('0x37')][_0x6768('0x64')]('internal')[_0x6768('0x15')](function(_0x51c5af){if(_['isNil'](_0x51c5af)){_0x3e69f4['internal']=_0x400120[_0x6768('0x65')]||0x1;return;}if(_['isNil'](_0x400120['min_internal'])||_0x400120['min_internal']===_0x51c5af){_0x3e69f4[_0x6768('0x61')]=_0x51c5af+0x1;return;}if(_0x400120[_0x6768('0x65')]>_0x51c5af){_0x3e69f4[_0x6768('0x61')]=_0x400120[_0x6768('0x65')];return;}return db[_0x6768('0x66')][_0x6768('0x41')]('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[_0x6768('0x66')][_0x6768('0x67')][_0x6768('0x68')]})['then'](function(_0x2a2dd2){if(_0x2a2dd2&&_0x2a2dd2[_0x6768('0x48')]){for(var _0x53b1d4=0x0,_0x546c6d=_0x2a2dd2[_0x6768('0x48')];_0x53b1d4<_0x546c6d&&_[_0x6768('0x69')](_0x3e69f4[_0x6768('0x61')]);_0x53b1d4++){if(_0x400120[_0x6768('0x65')]<=_0x2a2dd2[_0x53b1d4]['from']){_0x3e69f4[_0x6768('0x61')]=_0x2a2dd2[_0x53b1d4]['from'];}else if(_0x400120['min_internal']>_0x2a2dd2[_0x53b1d4][_0x6768('0x6a')]&&_0x400120[_0x6768('0x65')]<=_0x2a2dd2[_0x53b1d4]['to']){_0x3e69f4[_0x6768('0x61')]=_0x400120[_0x6768('0x65')];}}}if(_[_0x6768('0x69')](_0x3e69f4['internal'])){_0x3e69f4[_0x6768('0x61')]=_0x51c5af+0x1;}return _0x15566d(_0x3e69f4);});});})[_0x6768('0x4f')](function(_0xd63f51){_0x35b03a(_0xd63f51);});});}function updateUser(_0x10811b){return new BPromise(function(_0x4021e1,_0x125713){try{if(_0x10811b[_0x6768('0x6b')]){_0x10811b[_0x6768('0x6c')]=_0x10811b[_0x6768('0x61')];_0x10811b['VoiceMail']={'mailbox':_0x10811b[_0x6768('0x61')],'password':_0x10811b[_0x6768('0x3c')],'fullname':_0x10811b[_0x6768('0x6d')],'email':_0x10811b['email']};}if(_0x10811b[_0x6768('0x31')]===_0x6768('0x2c')){if(!_0x10811b[_0x6768('0x6e')])_0x10811b['permissions']=[_0x6768('0x6f'),_0x6768('0x70'),'103',_0x6768('0x71'),_0x6768('0x72'),_0x6768('0x73'),'105',_0x6768('0x74'),_0x6768('0x75'),'108',_0x6768('0x76'),_0x6768('0x77'),_0x6768('0x78'),'114',_0x6768('0x79')];}_0x4021e1(_0x10811b);}catch(_0x3c3135){_0x125713(_0x3c3135);}});}exports[_0x6768('0x7a')]=function(_0x21ef5a,_0x30071b){if(_0x21ef5a[_0x6768('0x2a')]['role']==='agent')throw new Error(_0x6768('0x7b'));if(_0x21ef5a[_0x6768('0x5c')][_0x6768('0x31')]===_0x6768('0x2a')&&_0x21ef5a[_0x6768('0x2a')][_0x6768('0x31')]!=='admin'){throw new Error(_0x6768('0x7c'));}if(_0x21ef5a[_0x6768('0x5c')][_0x6768('0x31')]===_0x6768('0x7d')&&_0x21ef5a['user'][_0x6768('0x31')]!==_0x6768('0x7d')){throw new Error(_0x6768('0x7e'));}return licenseUtil[_0x6768('0x7f')]([_0x21ef5a[_0x6768('0x5c')]])[_0x6768('0x15')](function(){return validateUser(_0x21ef5a[_0x6768('0x5c')]);})[_0x6768('0x15')](function(_0x166f89){return updateUser(_0x166f89)[_0x6768('0x15')](function(_0x4ce1a7){if(_0x4ce1a7[_0x6768('0x31')]===_0x6768('0x7d')){_0x4ce1a7[_0x6768('0x80')]=_0x21ef5a[_0x6768('0x2a')][_0x6768('0x80')];delete _0x4ce1a7[_0x6768('0x81')];}return _0x4ce1a7;});})[_0x6768('0x15')](function(_0x4437b5){return db[_0x6768('0x37')][_0x6768('0x7a')](_0x4437b5,{'include':[{'model':db[_0x6768('0x82')],'as':_0x6768('0x82')}]});})[_0x6768('0x15')](function(_0x1834f5){if(_0x21ef5a['body'][_0x6768('0x31')]===_0x6768('0x2a'))return _0x1834f5;if(_0x21ef5a[_0x6768('0x2a')][_0x6768('0x31')]!==_0x6768('0x2a'))return _0x1834f5;return db[_0x6768('0x83')]['find']({'where':{'name':_0x1834f5[_0x6768('0x31')]===_0x6768('0x2c')?'Agents':_0x6768('0x2d'),'userProfileId':_0x21ef5a['user'][_0x6768('0x81')]},'raw':!![]})[_0x6768('0x15')](function(_0x424fea){if(!_0x424fea||_0x424fea['autoAssociation']!=0x0)return _0x1834f5;return db[_0x6768('0x33')][_0x6768('0x7a')]({'name':_0x1834f5[_0x6768('0x36')],'resourceId':_0x1834f5['id'],'type':_0x424fea[_0x6768('0x36')],'sectionId':_0x424fea['id']},{})[_0x6768('0x15')](function(){return _0x1834f5;});})[_0x6768('0x4f')](function(_0x28ef56){logger[_0x6768('0x1b')](_0x6768('0x84'),_0x28ef56);throw _0x28ef56;});})[_0x6768('0x15')](respondWithResult(_0x30071b,0xc9))[_0x6768('0x4f')](handleError(_0x30071b,null));};exports['bulkCreate']=function(_0x1605f4,_0x1ec6f8){var _0x512533=_0x1605f4[_0x6768('0x5c')];var _0x412925=[];if(_0x1605f4[_0x6768('0x2a')][_0x6768('0x31')]==='agent')throw new Error(_0x6768('0x7b'));if(_[_0x6768('0x85')](_0x512533,['role','user'])&&_0x1605f4[_0x6768('0x2a')][_0x6768('0x31')]!==_0x6768('0x7d')){throw new Error(_0x6768('0x7c'));}if(_[_0x6768('0x85')](_0x512533,['role',_0x6768('0x7d')])&&_0x1605f4[_0x6768('0x2a')][_0x6768('0x31')]!=='admin'){throw new Error(_0x6768('0x86'));}return licenseUtil[_0x6768('0x7f')](_0x512533)['then'](function(){return validateUser(_0x512533[0x0]);})[_0x6768('0x15')](function(){for(var _0x167424=0x1;_0x167424<_0x512533[_0x6768('0x48')];_0x167424++){var _0x3d35c2=_0x512533[_0x167424-0x1][_0x6768('0x61')];if(!_0x512533[_0x167424][_0x6768('0x61')])_0x512533[_0x167424][_0x6768('0x61')]=_0x3d35c2+0x1;_0x412925['push'](validateUser(_0x512533[_0x167424]));}return BPromise[_0x6768('0x5b')](_0x412925);})['then'](function(){_0x412925=[];for(var _0x4470b4=0x0;_0x4470b4<_0x512533[_0x6768('0x48')];_0x4470b4++){_0x412925[_0x6768('0x49')](updateUser(_0x512533[_0x4470b4]));}return BPromise['all'](_0x412925);})[_0x6768('0x15')](function(){return BPromise[_0x6768('0x87')](_0x512533,function(_0x157ad6){return db['User']['create'](_0x157ad6,{'include':[{'model':db[_0x6768('0x82')],'as':_0x6768('0x82')}]})[_0x6768('0x15')](function(_0x53373c){_0x157ad6['id']=_0x53373c['id'];return _0x157ad6;});});})[_0x6768('0x15')](function(_0x57dea8){if(_0x1605f4[_0x6768('0x5c')][_0x6768('0x31')]===_0x6768('0x2a'))return _0x57dea8;if(_0x1605f4[_0x6768('0x2a')][_0x6768('0x31')]!==_0x6768('0x2a'))return _0x57dea8;var _0x55a0a6=_[_0x6768('0x85')](_0x57dea8,function(_0x27bd6f){return _0x27bd6f[_0x6768('0x31')]==='agent'||_0x27bd6f['role']===_0x6768('0x88');});if(!_0x55a0a6)return _0x57dea8;return db[_0x6768('0x83')]['findAll']({'where':{'name':{'$or':[_0x6768('0x2b'),_0x6768('0x2d')]},'userProfileId':_0x1605f4['user'][_0x6768('0x81')]},'raw':!![]})[_0x6768('0x15')](function(_0x36570f){if(_['isEmpty'](_0x36570f)||!_[_0x6768('0x85')](_0x36570f,[_0x6768('0x89'),0x0]))return _0x57dea8;_0x412925=[];var _0x457a36=_(_0x36570f)[_0x6768('0x38')](function(_0x212346){if(_0x212346[_0x6768('0x89')]===0x1)return;return _0x212346[_0x6768('0x36')]===_0x6768('0x2b')?_0x6768('0x2c'):'telephone';})[_0x6768('0x8a')]()[_0x6768('0x2f')]();for(var _0x59793e=0x0;_0x59793e<_0x57dea8[_0x6768('0x48')];_0x59793e++){if(!_[_0x6768('0x30')](_0x457a36,_0x57dea8[_0x59793e][_0x6768('0x31')]))return;var _0x19a6d6=_0x57dea8[_0x59793e]['role']===_0x6768('0x2c')?_0x6768('0x2b'):_0x6768('0x2d');_0x412925['push'](db[_0x6768('0x33')][_0x6768('0x7a')]({'name':_0x57dea8[_0x59793e][_0x6768('0x36')],'resourceId':_0x57dea8[_0x59793e]['id'],'type':_0x19a6d6,'sectionId':_[_0x6768('0x32')](_0x36570f,[_0x6768('0x36'),_0x19a6d6])['id']},{}));}return BPromise['all'](_0x412925);});})['then'](respondWithResult(_0x1ec6f8,0xc9))[_0x6768('0x4f')](handleError(_0x1ec6f8,null));};exports['changePassword']=function(_0x3d7fd1,_0x5dc8ae){if(_0x3d7fd1[_0x6768('0x5c')]['id']){delete _0x3d7fd1[_0x6768('0x5c')]['id'];}return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x3d7fd1[_0x6768('0x51')]['id']}})[_0x6768('0x15')](function(_0x12ee18){if(!_0x12ee18)return null;if(_0x12ee18['id']===_0x3d7fd1['user']['id']){if(!_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8b')]||!_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8c')]){throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0x8f'));}if(!_0x12ee18[_0x6768('0x90')](_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8b')])){throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0x91'));}if(_0x3d7fd1[_0x6768('0x5c')]['oldPassword']===_0x3d7fd1[_0x6768('0x5c')]['newPassword']){throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0x92'));}}else if(_0x3d7fd1[_0x6768('0x2a')][_0x6768('0x31')]==='admin'){if(!_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8c')]){throw new db[(_0x6768('0x8d'))]['ValidationError'](_0x6768('0x93'));}}else if(_0x3d7fd1[_0x6768('0x2a')]['role']===_0x6768('0x2a')){if(!_0x3d7fd1['body'][_0x6768('0x8c')]){throw new db[(_0x6768('0x8d'))]['ValidationError'](_0x6768('0x93'));}if(_0x12ee18[_0x6768('0x31')]!==_0x6768('0x2c')){throw new db['Sequelize']['ValidationError'](_0x6768('0x7b'));}}else{throw new db[(_0x6768('0x8d'))]['ValidationError'](_0x6768('0x7b'));}return _0x12ee18;})['then'](handleEntityNotFound(_0x5dc8ae,null))[_0x6768('0x15')](function(_0x255d21){return db[_0x6768('0x62')][_0x6768('0x94')]({'attributes':['id',_0x6768('0x63'),_0x6768('0x95'),_0x6768('0x96')]})['then'](function(_0x4d83b2){if(_0x4d83b2[_0x6768('0x63')])authService[_0x6768('0x97')](_0x3d7fd1[_0x6768('0x5c')]['newPassword']);if(!_0x4d83b2[_0x6768('0x95')]||!_0x255d21['previousPasswords'])return _0x255d21;authService[_0x6768('0x98')](_0x3d7fd1[_0x6768('0x5c')]['newPassword'],_0x255d21[_0x6768('0x99')],_0x4d83b2[_0x6768('0x96')]);return _0x255d21;})[_0x6768('0x15')](saveUpdates({'password':_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8c')],'passwordResetAt':_0x3d7fd1[_0x6768('0x2a')]['id']==_0x3d7fd1[_0x6768('0x51')]['id']?moment():null,'previousPasswords':authService[_0x6768('0x9a')](_0x3d7fd1[_0x6768('0x5c')][_0x6768('0x8c')],_0x255d21[_0x6768('0x99')])},null));})[_0x6768('0x15')](respondWithResult(_0x5dc8ae,null))[_0x6768('0x4f')](handleError(_0x5dc8ae,null));};exports['addQueues']=function(_0x2ba9e4,_0xd5ad25){var _0x1fd5c1=_0x2ba9e4['body'][_0x6768('0x9b')];return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x2ba9e4[_0x6768('0x51')]['id']},'attributes':['id','name','role',_0x6768('0x9c'),_0x6768('0x9d'),_0x6768('0x9e'),_0x6768('0x9f')]})[_0x6768('0x15')](handleEntityNotFound(_0xd5ad25,null))[_0x6768('0x15')](function(_0x57adab){if(_0x57adab){if(!utils['isValidChannel'](_0x1fd5c1)){throw new db['Sequelize']['ValidationError'](_0x6768('0xa0'));}return _0x57adab[_0x6768('0xa1')+_['capitalize'](_0x1fd5c1[_0x6768('0xa2')]())+_0x6768('0xa3')](_0x2ba9e4[_0x6768('0x5c')][_0x6768('0x5f')],{'penalty':_0x2ba9e4[_0x6768('0x5c')][_0x6768('0xa4')]||0x0})['spread'](function(_0x54e8fc){for(var _0x48990e=0x0;_0x48990e<_0x2ba9e4[_0x6768('0x5c')][_0x6768('0x5f')][_0x6768('0x48')];_0x48990e+=0x1){var _0x4d62ec={'UserId':Number(_0x2ba9e4[_0x6768('0x51')]['id'])};_0x4d62ec[_[_0x6768('0xa5')](_0x1fd5c1['toLowerCase']())+'QueueId']=Number(_0x2ba9e4['body'][_0x6768('0x5f')][_0x48990e]);socket[_0x6768('0xa6')]('user'+_[_0x6768('0xa5')](_0x1fd5c1[_0x6768('0xa2')]())+_0x6768('0xa7'),_0x4d62ec);}return _0x54e8fc;})[_0x6768('0x15')](function(){if(_0x1fd5c1===_0x6768('0xa8')){return db[_0x6768('0xa9')][_0x6768('0x45')]({'where':{'id':_0x2ba9e4[_0x6768('0x5c')][_0x6768('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x253b51){var _0x5898d6=_0x57adab[_0x6768('0xaa')]({'plain':!![]});var _0x165c7a=[];if(_0x1fd5c1===_0x6768('0xa8')&&_0x5898d6['role']===_0x6768('0x2c')&&_0x5898d6[_0x6768('0x9c')]){for(var _0x3bed21=0x0;_0x3bed21<_0x253b51[_0x6768('0x48')];_0x3bed21+=0x1){_0x165c7a[_0x6768('0x49')]({'membername':_0x5898d6['name'],'UserId':_0x5898d6['id'],'queue_name':_0x253b51[_0x3bed21][_0x6768('0x36')],'VoiceQueueId':_0x253b51[_0x3bed21]['id'],'interface':_[_0x6768('0x69')](_0x5898d6[_0x6768('0x9f')])?util[_0x6768('0xab')](_0x6768('0xac'),_0x5898d6['name']):_0x5898d6[_0x6768('0x9f')],'paused':_0x5898d6[_0x6768('0x9e')]||![],'penalty':_0x2ba9e4[_0x6768('0x5c')][_0x6768('0xa4')]||0x0});}return BPromise[_0x6768('0x87')](_0x165c7a,function(_0x4475ab){return db[_0x6768('0xad')]['upsert'](_0x4475ab);});}return _0x57adab;});}})[_0x6768('0x15')](respondWithStatusCode(_0xd5ad25,null))[_0x6768('0x4f')](handleError(_0xd5ad25,null));};exports[_0x6768('0xae')]=function(_0x40244c,_0x4b0e51){var _0x13628e,_0x6cf0c9;return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x40244c[_0x6768('0x51')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x4b0e51,null))[_0x6768('0x15')](function(_0x32e365){if(_0x32e365){_0x13628e=_0x32e365;if(!_0x40244c[_0x6768('0x41')][_0x6768('0x9b')]||!utils[_0x6768('0xaf')](_0x40244c[_0x6768('0x41')][_0x6768('0x9b')])){throw new db['Sequelize'][(_0x6768('0x8e'))]('Unknown\x20channel');}return _0x32e365['remove'+_['capitalize'](_0x40244c['query'][_0x6768('0x9b')][_0x6768('0xa2')]())+_0x6768('0xa3')](_0x40244c[_0x6768('0x41')]['ids']);}})['then'](function(_0x31b112){if(_[_0x6768('0xb0')](_0x40244c[_0x6768('0x41')][_0x6768('0x5f')])){for(var _0xae2426=0x0;_0xae2426<_0x40244c[_0x6768('0x41')]['ids'][_0x6768('0x48')];_0xae2426+=0x1){_0x6cf0c9={'UserId':Number(_0x40244c['params']['id'])};_0x6cf0c9[_[_0x6768('0xa5')](_0x40244c[_0x6768('0x41')][_0x6768('0x9b')][_0x6768('0xa2')]())+_0x6768('0xb1')]=Number(_0x40244c[_0x6768('0x41')][_0x6768('0x5f')][_0xae2426]);socket[_0x6768('0xa6')](_0x6768('0x2a')+_[_0x6768('0xa5')](_0x40244c[_0x6768('0x41')]['channel']['toLowerCase']())+_0x6768('0xb2'),_0x6cf0c9);}}else{_0x6cf0c9={'UserId':Number(_0x40244c['params']['id'])};_0x6cf0c9[_[_0x6768('0xa5')](_0x40244c[_0x6768('0x41')][_0x6768('0x9b')][_0x6768('0xa2')]())+_0x6768('0xb1')]=Number(_0x40244c['query']['ids']);socket[_0x6768('0xa6')](_0x6768('0x2a')+_[_0x6768('0xa5')](_0x40244c['query'][_0x6768('0x9b')][_0x6768('0xa2')]())+_0x6768('0xb2'),_0x6cf0c9);}return _0x31b112;})[_0x6768('0x15')](function(){if(_0x40244c[_0x6768('0x41')][_0x6768('0x9b')]===_0x6768('0xa8')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x40244c[_0x6768('0x51')]['id'],'VoiceQueueId':_0x40244c[_0x6768('0x41')][_0x6768('0x5f')]},'individualHooks':!![]})[_0x6768('0x15')](function(){return _0x13628e;});}return _0x13628e;})['then'](respondWithStatusCode(_0x4b0e51,null))[_0x6768('0x4f')](handleError(_0x4b0e51,null));};exports[_0x6768('0xb3')]=function(_0x5ec91d,_0x39b774){_0x5ec91d[_0x6768('0x5c')]['userpic']=_0x5ec91d['file'][_0x6768('0xb4')];return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x5ec91d['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x39b774,null))['then'](saveUpdates(_0x5ec91d[_0x6768('0x5c')],null))['then'](respondWithResult(_0x39b774,null))[_0x6768('0x4f')](handleError(_0x39b774,null));};exports['getAvatar']=function(_0x36c8e9,_0x223b8c){var _0x1d5f4b=path[_0x6768('0xb5')](config[_0x6768('0xb6')],_0x6768('0xb7'));return db['User'][_0x6768('0x32')]({'where':{'id':_0x36c8e9[_0x6768('0x51')]['id']},'attributes':['id',_0x6768('0xb8')],'raw':!![]})['then'](handleEntityNotFound(_0x223b8c,null))['then'](function(_0x2e5676){if(_0x2e5676){if(_['isNil'](_0x2e5676[_0x6768('0xb8')])){return _0x223b8c['download'](_0x1d5f4b);}else{if(!fs[_0x6768('0xb9')](path['join'](config['root'],'server/files/images/',_0x2e5676[_0x6768('0xb8')]))){return _0x223b8c[_0x6768('0xba')](_0x1d5f4b);}return _0x223b8c[_0x6768('0xba')](path['join'](config[_0x6768('0xb6')],'server/files/images/',_0x2e5676[_0x6768('0xb8')]));}}})[_0x6768('0x4f')](handleError(_0x223b8c,null));};exports['getOpenTabs']=function(_0x32cddd,_0x1bbdcd){return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x32cddd[_0x6768('0x51')]['id']},'attributes':['id']})[_0x6768('0x15')](handleEntityNotFound(_0x1bbdcd,null))[_0x6768('0x15')](function(_0x3b28b7){var _0x388f96=[];values=_0x3b28b7[_0x6768('0x4b')];_0x388f96[_0x6768('0x49')](get_open_tabs(_0x6768('0x4a'),_0x3b28b7[_0x6768('0x4b')]));_0x388f96[_0x6768('0x49')](get_open_tabs(_0x6768('0x4c'),_0x3b28b7['dataValues']));_0x388f96[_0x6768('0x49')](get_open_tabs('openchannel',_0x3b28b7[_0x6768('0x4b')]));_0x388f96[_0x6768('0x49')](get_open_tabs(_0x6768('0x4e'),_0x3b28b7[_0x6768('0x4b')]));_0x388f96[_0x6768('0x49')](get_open_tabs('fax',_0x3b28b7[_0x6768('0x4b')]));_0x388f96['push'](get_open_tabs(_0x6768('0xbb'),_0x3b28b7[_0x6768('0x4b')]));return BPromise[_0x6768('0x5b')](_0x388f96);})[_0x6768('0x15')](function(_0x12e510){if(_0x12e510){var _0x5d4cd4=_[_0x6768('0x38')](values[_0x6768('0xbc')],function(_0xe2e3ec){return{'channel':_0x6768('0xbd'),'id':_0xe2e3ec['id'],'createdAt':_0xe2e3ec[_0x6768('0xbe')]};});var _0x463a08=_[_0x6768('0x38')](values[_0x6768('0xbf')],function(_0x24ce34){return{'channel':_0x6768('0xc0'),'id':_0x24ce34['id'],'createdAt':_0x24ce34[_0x6768('0xbe')]};});var _0x528f4b=_[_0x6768('0x38')](values['OpenchannelOpenTabs'],function(_0x4886d2){return{'channel':_0x6768('0xc1'),'id':_0x4886d2['id'],'createdAt':_0x4886d2['createdAt']};});var _0x3a0ab1=_[_0x6768('0x38')](values['MailOpenTabs'],function(_0x43d66f){return{'channel':_0x6768('0xc2'),'id':_0x43d66f['id'],'createdAt':_0x43d66f[_0x6768('0xbe')]};});var _0x4f80e8=_[_0x6768('0x38')](values['SmsOpenTabs'],function(_0x44acf5){return{'channel':'SMS','id':_0x44acf5['id'],'createdAt':_0x44acf5[_0x6768('0xbe')]};});var _0x2fa8f2=_[_0x6768('0x38')](values[_0x6768('0xc3')],function(_0x2e9ffa){return{'channel':'WHATSAPP','id':_0x2e9ffa['id'],'createdAt':_0x2e9ffa[_0x6768('0xbe')]};});var _0x428305=_['concat'](_0x5d4cd4,_0x463a08,_0x528f4b,_0x3a0ab1,_0x4f80e8,_0x2fa8f2);var _0x492be8={'count':_0x428305['length'],'rows':_0x428305};return _0x492be8;}else return null;})[_0x6768('0x15')](respondWithResult(_0x1bbdcd,null))[_0x6768('0x4f')](handleError(_0x1bbdcd,null));};exports[_0x6768('0xc4')]=function(_0xc58361,_0x30af50){var _0x9e454f={};var _0x896f2b={};var _0xfe5b7a;var _0x231f03;return db['User']['findOne']({'where':{'id':_0xc58361[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x30af50,null))[_0x6768('0x15')](function(_0x5ad533){if(_0x5ad533){_0xfe5b7a=_0x5ad533;_0x896f2b['model']=_[_0x6768('0x55')](db[_0x6768('0xc5')][_0x6768('0x54')]);_0x896f2b[_0x6768('0x41')]=_[_0x6768('0x55')](_0xc58361[_0x6768('0x41')]);_0x896f2b[_0x6768('0x56')]=_[_0x6768('0x57')](_0x896f2b[_0x6768('0x52')],_0x896f2b[_0x6768('0x41')]);_0x9e454f['attributes']=_[_0x6768('0x57')](_0x896f2b[_0x6768('0x52')],qs['fields'](_0xc58361[_0x6768('0x41')][_0x6768('0x58')]));_0x9e454f[_0x6768('0x44')]=_0x9e454f[_0x6768('0x44')][_0x6768('0x48')]?_0x9e454f[_0x6768('0x44')]:_0x896f2b[_0x6768('0x52')];_0x9e454f[_0x6768('0xc6')]=qs[_0x6768('0xc7')](_0xc58361[_0x6768('0x41')]['sort']);_0x9e454f[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0xc58361['query'],_0x896f2b[_0x6768('0x56')]));if(_0xc58361['query'][_0x6768('0x3b')]){_0x9e454f['where']=_['merge'](_0x9e454f[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x9e454f[_0x6768('0x44')],function(_0x30db74){var _0x584b26={};_0x584b26[_0x30db74]={'$like':'%'+_0xc58361[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x584b26;})});}_0x9e454f=_[_0x6768('0x59')]({},_0x9e454f,_0xc58361[_0x6768('0xca')]);return _0xfe5b7a['getContacts'](_0x9e454f);}})['then'](function(_0xdafa8){if(_0xdafa8){_0x231f03=_0xdafa8['length'];if(_0xc58361[_0x6768('0x41')]['hasOwnProperty'](_0x6768('0x3f'))){_0x9e454f[_0x6768('0x40')]=[{'model':db[_0x6768('0xcb')],'as':_0x6768('0xcc'),'required':![]},{'model':db[_0x6768('0xcd')],'as':_0x6768('0xce'),'attributes':['id',_0x6768('0x36'),_0x6768('0xcf')],'where':_0xc58361[_0x6768('0x41')][_0x6768('0xd0')]?{'id':_0xc58361[_0x6768('0x41')][_0x6768('0xd0')]}:undefined,'required':_0xc58361['query'][_0x6768('0xd0')]?!![]:![]}];}if(!_0xc58361['query']['hasOwnProperty'](_0x6768('0xd1'))){_0x9e454f[_0x6768('0x23')]=qs['limit'](_0xc58361['query'][_0x6768('0x23')]);_0x9e454f[_0x6768('0x22')]=qs[_0x6768('0x22')](_0xc58361[_0x6768('0x41')][_0x6768('0x22')]);}return _0xfe5b7a[_0x6768('0xc4')](_0x9e454f);}})[_0x6768('0x15')](function(_0x50e51f){if(_0x50e51f){return _0x50e51f?{'count':_0x231f03,'rows':_0x50e51f}:null;}})[_0x6768('0x15')](respondWithResult(_0x30af50,null))[_0x6768('0x4f')](handleError(_0x30af50,null));};exports[_0x6768('0xd2')]=function(_0x307814,_0x58e739){var _0x2b655f;var _0x21f214={};var _0x5bba8c;return db['User'][_0x6768('0x94')]({'where':{'id':_0x307814[_0x6768('0x51')]['id']},'attributes':['id',_0x6768('0x36'),_0x6768('0x31')]})[_0x6768('0x15')](handleEntityNotFound(_0x58e739,null))['then'](function(_0x39b926){if(!utils[_0x6768('0xaf')](_0x307814[_0x6768('0x41')][_0x6768('0x9b')])){throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0xa0'));}_0x2b655f=_0x39b926;var _0x18f06b={};_0x18f06b[_0x6768('0x52')]=_[_0x6768('0x55')](db[_[_0x6768('0xa5')](_0x307814[_0x6768('0x41')]['channel'])+_0x6768('0xd3')][_0x6768('0x54')]);_0x18f06b['query']=_[_0x6768('0x55')](_0x307814[_0x6768('0x41')]);_0x18f06b[_0x6768('0x56')]=_[_0x6768('0x57')](_0x18f06b[_0x6768('0x52')],_0x18f06b['query']);_0x21f214[_0x6768('0x44')]=_[_0x6768('0x57')](_0x18f06b[_0x6768('0x52')],qs[_0x6768('0x58')](_0x307814[_0x6768('0x41')][_0x6768('0x58')]));_0x21f214[_0x6768('0x44')]=_0x21f214[_0x6768('0x44')]['length']?_0x21f214['attributes']:_0x18f06b[_0x6768('0x52')];_0x21f214[_0x6768('0xc6')]=qs['sort'](_0x307814[_0x6768('0x41')][_0x6768('0xc7')]);_0x21f214['where']=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x307814['query'],_0x18f06b[_0x6768('0x56')]));if(_0x307814[_0x6768('0x41')][_0x6768('0x3b')]){_0x21f214[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x21f214[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x21f214[_0x6768('0x44')],function(_0x4f0288){var _0x420765={};_0x420765[_0x4f0288]={'$like':'%'+_0x307814['query']['filter']+'%'};return _0x420765;})});}_0x21f214=_['merge']({},_0x21f214,_0x307814[_0x6768('0xca')]);switch(_0x2b655f[_0x6768('0x31')]){case _0x6768('0x7d'):return db[_[_0x6768('0xa5')](_0x307814['query'][_0x6768('0x9b')])+_0x6768('0xd3')]['findAll'](_0x21f214);case _0x6768('0x2a'):case _0x6768('0x2c'):return _0x2b655f[_0x6768('0xaa')+_[_0x6768('0xa5')](_0x307814[_0x6768('0x41')][_0x6768('0x9b')])+_0x6768('0xa3')](_0x21f214);default:throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))]('Unknown\x20role');}})['then'](function(_0x3d90f3){_0x5bba8c=_0x3d90f3[_0x6768('0x48')];if(!_0x307814[_0x6768('0x41')][_0x6768('0xd4')](_0x6768('0xd1'))){_0x21f214['limit']=qs[_0x6768('0x23')](_0x307814[_0x6768('0x41')]['limit']);_0x21f214['offset']=qs[_0x6768('0x22')](_0x307814[_0x6768('0x41')]['offset']);}switch(_0x2b655f['role']){case'admin':return db[_[_0x6768('0xa5')](_0x307814[_0x6768('0x41')][_0x6768('0x9b')])+_0x6768('0xd3')][_0x6768('0x45')](_0x21f214);case _0x6768('0x2a'):case _0x6768('0x2c'):return _0x2b655f['get'+_[_0x6768('0xa5')](_0x307814['query']['channel'])+'Queues'](_0x21f214);}})['then'](function(_0x494f7e){return{'count':_0x5bba8c,'rows':_0x494f7e};})[_0x6768('0x15')](respondWithResult(_0x58e739,null))[_0x6768('0x4f')](handleError(_0x58e739,null));};exports[_0x6768('0xd5')]=function(_0x31b57a,_0x3755e7){var _0x12af5f={};var _0x20a789={};var _0x405f0c;var _0x522e0d;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x31b57a[_0x6768('0x51')]['id']}})['then'](handleEntityNotFound(_0x3755e7,null))['then'](function(_0x461126){if(_0x461126){_0x405f0c=_0x461126;_0x20a789['model']=_[_0x6768('0x55')](db[_0x6768('0xad')]['rawAttributes']);_0x20a789[_0x6768('0x41')]=_[_0x6768('0x55')](_0x31b57a['query']);_0x20a789[_0x6768('0x56')]=_[_0x6768('0x57')](_0x20a789['model'],_0x20a789[_0x6768('0x41')]);_0x12af5f[_0x6768('0x44')]=_[_0x6768('0x57')](_0x20a789[_0x6768('0x52')],qs[_0x6768('0x58')](_0x31b57a[_0x6768('0x41')][_0x6768('0x58')]));_0x12af5f['attributes']=_0x12af5f[_0x6768('0x44')][_0x6768('0x48')]?_0x12af5f[_0x6768('0x44')]:_0x20a789['model'];_0x12af5f[_0x6768('0xc6')]=qs['sort'](_0x31b57a[_0x6768('0x41')][_0x6768('0xc7')]);_0x12af5f['where']=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x31b57a[_0x6768('0x41')],_0x20a789['filters']));if(_0x31b57a[_0x6768('0x41')][_0x6768('0x3b')]){_0x12af5f[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x12af5f[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x12af5f[_0x6768('0x44')],function(_0x2f5777){var _0x592e55={};_0x592e55[_0x2f5777]={'$like':'%'+_0x31b57a[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x592e55;})});}_0x12af5f=_[_0x6768('0x59')]({},_0x12af5f,_0x31b57a[_0x6768('0xca')]);return _0x405f0c[_0x6768('0xd5')](_0x12af5f);}})[_0x6768('0x15')](function(_0x2427f4){if(_0x2427f4){_0x522e0d=_0x2427f4[_0x6768('0x48')];if(!_0x31b57a[_0x6768('0x41')]['hasOwnProperty'](_0x6768('0xd1'))){_0x12af5f['limit']=qs[_0x6768('0x23')](_0x31b57a[_0x6768('0x41')][_0x6768('0x23')]);_0x12af5f['offset']=qs['offset'](_0x31b57a[_0x6768('0x41')][_0x6768('0x22')]);}return _0x405f0c[_0x6768('0xd5')](_0x12af5f);}})[_0x6768('0x15')](function(_0x57827c){if(_0x57827c){return _0x57827c?{'count':_0x522e0d,'rows':_0x57827c}:null;}})[_0x6768('0x15')](respondWithResult(_0x3755e7,null))['catch'](handleError(_0x3755e7,null));};exports['getGroups']=function(_0x32fa30,_0x4efea8){var _0x1c7c45={};var _0x5d460b={};var _0x543b03;var _0x45b540;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x32fa30['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x4efea8,null))[_0x6768('0x15')](function(_0x34f06b){if(_0x34f06b){_0x543b03=_0x34f06b;_0x5d460b['model']=_[_0x6768('0x55')](db[_0x6768('0xd6')][_0x6768('0x54')]);_0x5d460b['query']=_[_0x6768('0x55')](_0x32fa30[_0x6768('0x41')]);_0x5d460b[_0x6768('0x56')]=_[_0x6768('0x57')](_0x5d460b[_0x6768('0x52')],_0x5d460b[_0x6768('0x41')]);_0x1c7c45[_0x6768('0x44')]=_[_0x6768('0x57')](_0x5d460b[_0x6768('0x52')],qs[_0x6768('0x58')](_0x32fa30['query']['fields']));_0x1c7c45[_0x6768('0x44')]=_0x1c7c45[_0x6768('0x44')][_0x6768('0x48')]?_0x1c7c45[_0x6768('0x44')]:_0x5d460b[_0x6768('0x52')];_0x1c7c45[_0x6768('0xc6')]=qs['sort'](_0x32fa30['query'][_0x6768('0xc7')]);_0x1c7c45['where']=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x32fa30[_0x6768('0x41')],_0x5d460b['filters']));if(_0x32fa30[_0x6768('0x41')][_0x6768('0x3b')]){_0x1c7c45['where']=_[_0x6768('0x59')](_0x1c7c45[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x1c7c45[_0x6768('0x44')],function(_0x37bcbe){var _0x210135={};_0x210135[_0x37bcbe]={'$like':'%'+_0x32fa30[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x210135;})});}_0x1c7c45=_[_0x6768('0x59')]({},_0x1c7c45,_0x32fa30[_0x6768('0xca')]);return _0x543b03[_0x6768('0xd7')](_0x1c7c45);}})['then'](function(_0x2e6740){if(_0x2e6740){_0x45b540=_0x2e6740[_0x6768('0x48')];if(!_0x32fa30['query'][_0x6768('0xd4')](_0x6768('0xd1'))){_0x1c7c45[_0x6768('0x23')]=qs[_0x6768('0x23')](_0x32fa30['query']['limit']);_0x1c7c45[_0x6768('0x22')]=qs['offset'](_0x32fa30[_0x6768('0x41')]['offset']);}return _0x543b03['getGroups'](_0x1c7c45);}})[_0x6768('0x15')](function(_0x2f054f){if(_0x2f054f){return _0x2f054f?{'count':_0x45b540,'rows':_0x2f054f}:null;}})['then'](respondWithResult(_0x4efea8,null))['catch'](handleError(_0x4efea8,null));};exports[_0x6768('0xd8')]=function(_0x424d09,_0x1e8b64){var _0x14fd6d={'raw':!![],'where':{}};var _0x3d1be8={};var _0x275da3={'count':0x0,'rows':[]};return db[_0x6768('0x37')]['findOne']({'where':{'id':_0x424d09['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x1e8b64,null))['then'](function(_0x3bcb3a){if(_0x3bcb3a){_0x3d1be8[_0x6768('0x52')]=_[_0x6768('0x55')](db['VoiceRecording'][_0x6768('0x54')]);_0x3d1be8[_0x6768('0x41')]=_[_0x6768('0x55')](_0x424d09[_0x6768('0x41')]);_0x3d1be8['filters']=_[_0x6768('0x57')](_0x3d1be8[_0x6768('0x52')],_0x3d1be8[_0x6768('0x41')]);_0x14fd6d[_0x6768('0x44')]=_['intersection'](_0x3d1be8[_0x6768('0x52')],qs['fields'](_0x424d09['query'][_0x6768('0x58')]));_0x14fd6d[_0x6768('0x44')]=_0x14fd6d[_0x6768('0x44')][_0x6768('0x48')]?_0x14fd6d['attributes']:_0x3d1be8[_0x6768('0x52')];if(!_0x424d09['query'][_0x6768('0xd4')](_0x6768('0xd1'))){_0x14fd6d[_0x6768('0x23')]=qs[_0x6768('0x23')](_0x424d09[_0x6768('0x41')]['limit']);_0x14fd6d[_0x6768('0x22')]=qs['offset'](_0x424d09['query'][_0x6768('0x22')]);}_0x14fd6d[_0x6768('0xc6')]=qs[_0x6768('0xc7')](_0x424d09[_0x6768('0x41')]['sort']);_0x14fd6d[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x424d09[_0x6768('0x41')],_0x3d1be8[_0x6768('0x56')]));_0x14fd6d['where'][_0x6768('0xd9')]=_0x3bcb3a['id'];if(_0x424d09[_0x6768('0x41')][_0x6768('0x3b')]){_0x14fd6d[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x14fd6d[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x14fd6d[_0x6768('0x44')],function(_0x223663){var _0xefe23b={};_0xefe23b[_0x223663]={'$like':'%'+_0x424d09[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0xefe23b;})});}_0x14fd6d=_[_0x6768('0x59')]({},_0x14fd6d,_0x424d09[_0x6768('0xca')]);return db[_0x6768('0xda')][_0x6768('0x25')]({'where':_0x14fd6d[_0x6768('0xc8')]})[_0x6768('0x15')](function(_0x2e9435){_0x275da3['count']=_0x2e9435;if(_0x424d09[_0x6768('0x41')][_0x6768('0x3f')]){_0x14fd6d['include']=[{'all':!![]}];}return db[_0x6768('0xda')][_0x6768('0x45')](_0x14fd6d);})[_0x6768('0x15')](function(_0x5dabf6){_0x275da3[_0x6768('0x46')]=_0x5dabf6;return _0x275da3;});}})[_0x6768('0x15')](respondWithFilteredResult(_0x1e8b64,_0x14fd6d))[_0x6768('0x4f')](handleError(_0x1e8b64,null));};exports[_0x6768('0xdb')]=function(_0x2b5b40,_0x21ddb8){var _0x571498={'raw':!![],'where':{}};var _0x5892e5={};var _0x40aa8b={'count':0x0,'rows':[]};return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x2b5b40[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x21ddb8,null))['then'](function(_0x2a8fe4){if(_0x2a8fe4){_0x5892e5[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xdc')][_0x6768('0x54')]);_0x5892e5[_0x6768('0x41')]=_[_0x6768('0x55')](_0x2b5b40[_0x6768('0x41')]);_0x5892e5['filters']=_['intersection'](_0x5892e5[_0x6768('0x52')],_0x5892e5[_0x6768('0x41')]);_0x571498[_0x6768('0x44')]=_[_0x6768('0x57')](_0x5892e5[_0x6768('0x52')],qs[_0x6768('0x58')](_0x2b5b40[_0x6768('0x41')][_0x6768('0x58')]));_0x571498[_0x6768('0x44')]=_0x571498[_0x6768('0x44')]['length']?_0x571498['attributes']:_0x5892e5[_0x6768('0x52')];if(!_0x2b5b40[_0x6768('0x41')]['hasOwnProperty'](_0x6768('0xd1'))){_0x571498[_0x6768('0x23')]=qs['limit'](_0x2b5b40[_0x6768('0x41')]['limit']);_0x571498[_0x6768('0x22')]=qs[_0x6768('0x22')](_0x2b5b40['query'][_0x6768('0x22')]);}_0x571498[_0x6768('0xc6')]=qs['sort'](_0x2b5b40[_0x6768('0x41')][_0x6768('0xc7')]);_0x571498['where']=qs[_0x6768('0x56')](_['pick'](_0x2b5b40[_0x6768('0x41')],_0x5892e5[_0x6768('0x56')]));_0x571498[_0x6768('0xc8')][_0x6768('0xd9')]=_0x2a8fe4['id'];if(_0x2b5b40[_0x6768('0x41')][_0x6768('0x3b')]){_0x571498['where']=_[_0x6768('0x59')](_0x571498['where'],{'$or':_[_0x6768('0x38')](_0x571498[_0x6768('0x44')],function(_0x39362e){var _0x5c0341={};_0x5c0341[_0x39362e]={'$like':'%'+_0x2b5b40['query']['filter']+'%'};return _0x5c0341;})});}_0x571498=_[_0x6768('0x59')]({},_0x571498,_0x2b5b40[_0x6768('0xca')]);return db['ScreenRecording'][_0x6768('0x25')]({'where':_0x571498[_0x6768('0xc8')]})[_0x6768('0x15')](function(_0x450497){_0x40aa8b[_0x6768('0x25')]=_0x450497;if(_0x2b5b40[_0x6768('0x41')][_0x6768('0x3f')]){_0x571498[_0x6768('0x40')]=[{'all':!![]}];}return db[_0x6768('0xdc')][_0x6768('0x45')](_0x571498);})['then'](function(_0x205581){_0x40aa8b[_0x6768('0x46')]=_0x205581;return _0x40aa8b;});}})['then'](respondWithFilteredResult(_0x21ddb8,_0x571498))[_0x6768('0x4f')](handleError(_0x21ddb8,null));};exports['getChatInteractions']=function(_0x307126,_0x581a7b){var _0x42e1f4={};var _0x1744d8={};var _0x3b4b87;var _0x5d1f7f;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x307126[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x581a7b,null))[_0x6768('0x15')](function(_0x3c639b){if(_0x3c639b){_0x3b4b87=_0x3c639b;_0x1744d8[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xdd')][_0x6768('0x54')]);_0x1744d8[_0x6768('0x41')]=_[_0x6768('0x55')](_0x307126[_0x6768('0x41')]);_0x1744d8[_0x6768('0x56')]=_[_0x6768('0x57')](_0x1744d8[_0x6768('0x52')],_0x1744d8[_0x6768('0x41')]);_0x42e1f4[_0x6768('0x44')]=_[_0x6768('0x57')](_0x1744d8[_0x6768('0x52')],qs[_0x6768('0x58')](_0x307126[_0x6768('0x41')]['fields']));_0x42e1f4[_0x6768('0x44')]=_0x42e1f4[_0x6768('0x44')][_0x6768('0x48')]?_0x42e1f4[_0x6768('0x44')]:_0x1744d8[_0x6768('0x52')];_0x42e1f4['order']=qs[_0x6768('0xc7')](_0x307126['query'][_0x6768('0xc7')]);_0x42e1f4[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x307126[_0x6768('0x41')],_0x1744d8[_0x6768('0x56')]));if(_0x307126[_0x6768('0x41')][_0x6768('0x3b')]){_0x42e1f4[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x42e1f4[_0x6768('0xc8')],{'$or':_['map'](_0x42e1f4[_0x6768('0x44')],function(_0x55b5bf){var _0x5ad76c={};_0x5ad76c[_0x55b5bf]={'$like':'%'+_0x307126['query'][_0x6768('0x3b')]+'%'};return _0x5ad76c;})});}_0x42e1f4=_[_0x6768('0x59')]({},_0x42e1f4,_0x307126['options']);return _0x3b4b87[_0x6768('0xde')](_0x42e1f4);}})[_0x6768('0x15')](function(_0x88c109){if(_0x88c109){_0x5d1f7f=_0x88c109[_0x6768('0x48')];if(!_0x307126[_0x6768('0x41')][_0x6768('0xd4')](_0x6768('0xd1'))){_0x42e1f4[_0x6768('0x23')]=qs[_0x6768('0x23')](_0x307126[_0x6768('0x41')][_0x6768('0x23')]);_0x42e1f4[_0x6768('0x22')]=qs['offset'](_0x307126['query'][_0x6768('0x22')]);}return _0x3b4b87[_0x6768('0xde')](_0x42e1f4);}})['then'](function(_0x3bbff4){if(_0x3bbff4){return _0x3bbff4?{'count':_0x5d1f7f,'rows':_0x3bbff4}:null;}})[_0x6768('0x15')](respondWithResult(_0x581a7b,null))[_0x6768('0x4f')](handleError(_0x581a7b,null));};exports[_0x6768('0xdf')]=function(_0x4f7024,_0x250c76){var _0x49d8da={};var _0x5b513b={};var _0x1fa425;var _0x262b1e;return db[_0x6768('0x37')]['findOne']({'where':{'id':_0x4f7024['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x250c76,null))[_0x6768('0x15')](function(_0x2bd923){if(_0x2bd923){_0x1fa425=_0x2bd923;_0x5b513b[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xe0')]['rawAttributes']);_0x5b513b[_0x6768('0x41')]=_[_0x6768('0x55')](_0x4f7024[_0x6768('0x41')]);_0x5b513b[_0x6768('0x56')]=_[_0x6768('0x57')](_0x5b513b[_0x6768('0x52')],_0x5b513b[_0x6768('0x41')]);_0x49d8da[_0x6768('0x44')]=_[_0x6768('0x57')](_0x5b513b['model'],qs[_0x6768('0x58')](_0x4f7024[_0x6768('0x41')]['fields']));_0x49d8da[_0x6768('0x44')]=_0x49d8da['attributes'][_0x6768('0x48')]?_0x49d8da['attributes']:_0x5b513b[_0x6768('0x52')];_0x49d8da[_0x6768('0xc6')]=qs['sort'](_0x4f7024[_0x6768('0x41')]['sort']);_0x49d8da['where']=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x4f7024['query'],_0x5b513b[_0x6768('0x56')]));if(_0x4f7024['query'][_0x6768('0x3b')]){_0x49d8da[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x49d8da[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x49d8da[_0x6768('0x44')],function(_0x18cc79){var _0x4d5466={};_0x4d5466[_0x18cc79]={'$like':'%'+_0x4f7024[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x4d5466;})});}_0x49d8da=_['merge']({},_0x49d8da,_0x4f7024[_0x6768('0xca')]);return _0x1fa425[_0x6768('0xdf')](_0x49d8da);}})[_0x6768('0x15')](function(_0x42e8b3){if(_0x42e8b3){_0x262b1e=_0x42e8b3['length'];if(!_0x4f7024[_0x6768('0x41')]['hasOwnProperty']('nolimit')){_0x49d8da['limit']=qs['limit'](_0x4f7024[_0x6768('0x41')][_0x6768('0x23')]);_0x49d8da['offset']=qs['offset'](_0x4f7024[_0x6768('0x41')][_0x6768('0x22')]);}return _0x1fa425[_0x6768('0xdf')](_0x49d8da);}})[_0x6768('0x15')](function(_0x46ad07){if(_0x46ad07){return _0x46ad07?{'count':_0x262b1e,'rows':_0x46ad07}:null;}})['then'](respondWithResult(_0x250c76,null))[_0x6768('0x4f')](handleError(_0x250c76,null));};exports['getMailInteractions']=function(_0xbc7308,_0x58de35){var _0x407025={'raw':!![],'where':{}};var _0xc0601e={};var _0x262356={'count':0x0,'rows':[]};return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0xbc7308[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x58de35,null))[_0x6768('0x15')](function(_0x18c464){if(_0x18c464){_0xc0601e[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xe1')][_0x6768('0x54')]);_0xc0601e[_0x6768('0x41')]=_[_0x6768('0x55')](_0xbc7308[_0x6768('0x41')]);_0xc0601e[_0x6768('0x56')]=_[_0x6768('0x57')](_0xc0601e['model'],_0xc0601e['query']);_0x407025[_0x6768('0x44')]=_[_0x6768('0x57')](_0xc0601e[_0x6768('0x52')],qs[_0x6768('0x58')](_0xbc7308[_0x6768('0x41')][_0x6768('0x58')]));_0x407025[_0x6768('0x44')]=_0x407025[_0x6768('0x44')][_0x6768('0x48')]?_0x407025[_0x6768('0x44')]:_0xc0601e[_0x6768('0x52')];if(!_0xbc7308[_0x6768('0x41')][_0x6768('0xd4')](_0x6768('0xd1'))){_0x407025[_0x6768('0x23')]=qs[_0x6768('0x23')](_0xbc7308['query']['limit']);_0x407025['offset']=qs[_0x6768('0x22')](_0xbc7308[_0x6768('0x41')][_0x6768('0x22')]);}_0x407025[_0x6768('0xc6')]=qs[_0x6768('0xc7')](_0xbc7308[_0x6768('0x41')]['sort']);_0x407025['where']=qs[_0x6768('0x56')](_['pick'](_0xbc7308[_0x6768('0x41')],_0xc0601e[_0x6768('0x56')]));_0x407025[_0x6768('0xc8')][_0x6768('0xd9')]=_0x18c464['id'];if(_0xbc7308[_0x6768('0x41')][_0x6768('0x3b')]){_0x407025['where']=_[_0x6768('0x59')](_0x407025[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x407025[_0x6768('0x44')],function(_0x940fa6){var _0x4b60c7={};_0x4b60c7[_0x940fa6]={'$like':'%'+_0xbc7308[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x4b60c7;})});}_0x407025=_[_0x6768('0x59')]({},_0x407025,_0xbc7308['options']);return db[_0x6768('0xe1')]['count']({'where':_0x407025[_0x6768('0xc8')]})[_0x6768('0x15')](function(_0xec8a35){_0x262356[_0x6768('0x25')]=_0xec8a35;if(_0xbc7308[_0x6768('0x41')][_0x6768('0x3f')]){_0x407025[_0x6768('0x40')]=[{'all':!![]}];}return db[_0x6768('0xe1')][_0x6768('0x45')](_0x407025);})['then'](function(_0x14d800){_0x262356[_0x6768('0x46')]=_0x14d800;return _0x262356;});}})['then'](respondWithFilteredResult(_0x58de35,_0x407025))[_0x6768('0x4f')](handleError(_0x58de35,null));};exports[_0x6768('0xe2')]=function(_0x47b5a1,_0x4ce6c1){var _0x14e714={};var _0x220fc6={};var _0x43221a;var _0x7781d9;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x47b5a1['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x4ce6c1,null))[_0x6768('0x15')](function(_0x425d66){if(_0x425d66){_0x43221a=_0x425d66;_0x220fc6[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xe3')][_0x6768('0x54')]);_0x220fc6[_0x6768('0x41')]=_['keys'](_0x47b5a1['query']);_0x220fc6[_0x6768('0x56')]=_[_0x6768('0x57')](_0x220fc6[_0x6768('0x52')],_0x220fc6[_0x6768('0x41')]);_0x14e714[_0x6768('0x44')]=_['intersection'](_0x220fc6[_0x6768('0x52')],qs[_0x6768('0x58')](_0x47b5a1[_0x6768('0x41')]['fields']));_0x14e714[_0x6768('0x44')]=_0x14e714[_0x6768('0x44')]['length']?_0x14e714[_0x6768('0x44')]:_0x220fc6[_0x6768('0x52')];_0x14e714['order']=qs[_0x6768('0xc7')](_0x47b5a1[_0x6768('0x41')]['sort']);_0x14e714[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x47b5a1[_0x6768('0x41')],_0x220fc6[_0x6768('0x56')]));if(_0x47b5a1['query'][_0x6768('0x3b')]){_0x14e714[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x14e714[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x14e714[_0x6768('0x44')],function(_0x27f520){var _0x3a3228={};_0x3a3228[_0x27f520]={'$like':'%'+_0x47b5a1['query'][_0x6768('0x3b')]+'%'};return _0x3a3228;})});}_0x14e714=_[_0x6768('0x59')]({},_0x14e714,_0x47b5a1[_0x6768('0xca')]);return _0x43221a[_0x6768('0xe2')](_0x14e714);}})[_0x6768('0x15')](function(_0x2ca6d8){if(_0x2ca6d8){_0x7781d9=_0x2ca6d8[_0x6768('0x48')];if(!_0x47b5a1[_0x6768('0x41')][_0x6768('0xd4')](_0x6768('0xd1'))){_0x14e714['limit']=qs['limit'](_0x47b5a1['query']['limit']);_0x14e714['offset']=qs['offset'](_0x47b5a1[_0x6768('0x41')][_0x6768('0x22')]);}return _0x43221a['getSmsInteractions'](_0x14e714);}})[_0x6768('0x15')](function(_0x2abad5){if(_0x2abad5){return _0x2abad5?{'count':_0x7781d9,'rows':_0x2abad5}:null;}})[_0x6768('0x15')](respondWithResult(_0x4ce6c1,null))[_0x6768('0x4f')](handleError(_0x4ce6c1,null));};exports[_0x6768('0xe4')]=function(_0xb7a775,_0x2f71eb){var _0x252622={};var _0x4f3e3a={};var _0x60beb5;var _0xf573fa;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0xb7a775['params']['id']}})['then'](handleEntityNotFound(_0x2f71eb,null))['then'](function(_0x55ae06){if(_0x55ae06){_0x60beb5=_0x55ae06;_0x4f3e3a['model']=_[_0x6768('0x55')](db[_0x6768('0xe5')]['rawAttributes']);_0x4f3e3a['query']=_['keys'](_0xb7a775[_0x6768('0x41')]);_0x4f3e3a['filters']=_['intersection'](_0x4f3e3a[_0x6768('0x52')],_0x4f3e3a['query']);_0x252622[_0x6768('0x44')]=_[_0x6768('0x57')](_0x4f3e3a[_0x6768('0x52')],qs[_0x6768('0x58')](_0xb7a775[_0x6768('0x41')][_0x6768('0x58')]));_0x252622['attributes']=_0x252622[_0x6768('0x44')][_0x6768('0x48')]?_0x252622[_0x6768('0x44')]:_0x4f3e3a['model'];_0x252622[_0x6768('0xc6')]=qs['sort'](_0xb7a775[_0x6768('0x41')][_0x6768('0xc7')]);_0x252622[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0xb7a775[_0x6768('0x41')],_0x4f3e3a['filters']));if(_0xb7a775[_0x6768('0x41')][_0x6768('0x3b')]){_0x252622[_0x6768('0xc8')]=_[_0x6768('0x59')](_0x252622[_0x6768('0xc8')],{'$or':_['map'](_0x252622[_0x6768('0x44')],function(_0x4c37a4){var _0x21cc2d={};_0x21cc2d[_0x4c37a4]={'$like':'%'+_0xb7a775['query'][_0x6768('0x3b')]+'%'};return _0x21cc2d;})});}_0x252622=_[_0x6768('0x59')]({},_0x252622,_0xb7a775[_0x6768('0xca')]);return _0x60beb5['getFaxInteractions'](_0x252622);}})[_0x6768('0x15')](function(_0x2e8577){if(_0x2e8577){_0xf573fa=_0x2e8577['length'];if(!_0xb7a775['query'][_0x6768('0xd4')](_0x6768('0xd1'))){_0x252622[_0x6768('0x23')]=qs[_0x6768('0x23')](_0xb7a775[_0x6768('0x41')][_0x6768('0x23')]);_0x252622['offset']=qs[_0x6768('0x22')](_0xb7a775[_0x6768('0x41')]['offset']);}return _0x60beb5[_0x6768('0xe4')](_0x252622);}})[_0x6768('0x15')](function(_0xce7c65){if(_0xce7c65){return _0xce7c65?{'count':_0xf573fa,'rows':_0xce7c65}:null;}})[_0x6768('0x15')](respondWithResult(_0x2f71eb,null))[_0x6768('0x4f')](handleError(_0x2f71eb,null));};exports[_0x6768('0xe6')]=function(_0x6ff8a,_0x2e5850){var _0x270474={};var _0x217775={};var _0x2613c6;var _0x3998eb;return db[_0x6768('0x37')]['findOne']({'where':{'id':_0x6ff8a[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x2e5850,null))[_0x6768('0x15')](function(_0x4a5bd7){if(_0x4a5bd7){_0x2613c6=_0x4a5bd7;_0x217775['model']=_[_0x6768('0x55')](db[_0x6768('0xe7')][_0x6768('0x54')]);_0x217775[_0x6768('0x41')]=_[_0x6768('0x55')](_0x6ff8a['query']);_0x217775['filters']=_[_0x6768('0x57')](_0x217775['model'],_0x217775[_0x6768('0x41')]);_0x270474[_0x6768('0x44')]=_[_0x6768('0x57')](_0x217775[_0x6768('0x52')],qs[_0x6768('0x58')](_0x6ff8a[_0x6768('0x41')]['fields']));_0x270474[_0x6768('0x44')]=_0x270474[_0x6768('0x44')][_0x6768('0x48')]?_0x270474[_0x6768('0x44')]:_0x217775['model'];_0x270474[_0x6768('0xc6')]=qs['sort'](_0x6ff8a[_0x6768('0x41')][_0x6768('0xc7')]);_0x270474[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x6ff8a[_0x6768('0x41')],_0x217775[_0x6768('0x56')]));if(_0x6ff8a[_0x6768('0x41')][_0x6768('0x3b')]){_0x270474['where']=_[_0x6768('0x59')](_0x270474[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x270474[_0x6768('0x44')],function(_0x4a3a4e){var _0x25ccce={};_0x25ccce[_0x4a3a4e]={'$like':'%'+_0x6ff8a[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x25ccce;})});}_0x270474=_[_0x6768('0x59')]({},_0x270474,_0x6ff8a[_0x6768('0xca')]);return _0x2613c6[_0x6768('0xe6')](_0x270474);}})[_0x6768('0x15')](function(_0x47984e){if(_0x47984e){_0x3998eb=_0x47984e[_0x6768('0x48')];if(!_0x6ff8a[_0x6768('0x41')]['hasOwnProperty'](_0x6768('0xd1'))){_0x270474[_0x6768('0x23')]=qs[_0x6768('0x23')](_0x6ff8a['query']['limit']);_0x270474[_0x6768('0x22')]=qs['offset'](_0x6ff8a['query'][_0x6768('0x22')]);}return _0x2613c6['getWhatsappInteractions'](_0x270474);}})[_0x6768('0x15')](function(_0x2657a7){if(_0x2657a7){return _0x2657a7?{'count':_0x3998eb,'rows':_0x2657a7}:null;}})[_0x6768('0x15')](respondWithResult(_0x2e5850,null))[_0x6768('0x4f')](handleError(_0x2e5850,null));};exports[_0x6768('0xe8')]=function(_0x16a5b0,_0x145b89,_0x233ea2){var _0x425f6a;var _0x5d37ba;var _0x41d257;var _0x20ba4b=!_['isNil'](_0x16a5b0[_0x6768('0x51')]['id'])?_0x16a5b0[_0x6768('0x51')]['id']:!_[_0x6768('0x69')](_0x16a5b0[_0x6768('0x2a')]['id'])?_0x16a5b0[_0x6768('0x2a')]['id']:null;return db['User'][_0x6768('0x32')]({'where':{'id':_0x20ba4b,'role':{'$or':[_0x6768('0x7d'),_0x6768('0x2a'),_0x6768('0x2c')]}},'attributes':['id','name','phone',_0x6768('0xe9'),_0x6768('0x31'),_0x6768('0x61'),_0x6768('0x9d')]})['then'](function(_0x5e36eb){if(_0x5e36eb){if(_0x5e36eb[_0x6768('0x31')]===_0x6768('0x2c')){_0x425f6a=_0x5e36eb;if(_0x16a5b0[_0x6768('0x5c')]['interface']){_0x41d257=util['format'](_0x6768('0xea'),_0x425f6a[_0x16a5b0[_0x6768('0x5c')][_0x6768('0x9f')]]);}else if(_0x16a5b0[_0x6768('0x5c')][_0x6768('0xeb')]){_0x41d257=util[_0x6768('0xab')](_0x6768('0xac'),_0x16a5b0[_0x6768('0x5c')][_0x6768('0xeb')]);}else{_0x41d257=util['format'](_0x6768('0xac'),_0x425f6a['name']);}socket['to'](util[_0x6768('0xab')](_0x6768('0xec'),_0x425f6a['name']))[_0x6768('0xa6')]('user:forcelogout',{'user':{'id':_0x425f6a['id'],'name':_0x425f6a[_0x6768('0x36')]},'ip':_0x16a5b0[_0x6768('0xed')]['x-forwarded-for']||_0x16a5b0[_0x6768('0xee')][_0x6768('0xef')]||_0x16a5b0['socket'][_0x6768('0xef')]||_0x16a5b0[_0x6768('0xee')][_0x6768('0xf0')]['remoteAddress']});return db[_0x6768('0xad')][_0x6768('0x34')]({'where':{'membername':_0x425f6a[_0x6768('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0xf1'));}})[_0x6768('0x15')](function(){if(_0x425f6a){return _0x425f6a[_0x6768('0xf2')]({'raw':!![]});}})[_0x6768('0x15')](function(_0x534279){if(_0x425f6a){var _0x1be13a=[];if(_0x534279){_0x5d37ba=_0x534279;if(_0x5d37ba[_0x6768('0x48')]){for(var _0x83df40=0x0;_0x83df40<_0x5d37ba[_0x6768('0x48')];_0x83df40++){_0x1be13a[_0x6768('0x49')]({'membername':_0x425f6a[_0x6768('0x36')],'UserId':_0x425f6a['id'],'queue_name':_0x5d37ba[_0x83df40][_0x6768('0x36')],'VoiceQueueId':_0x5d37ba[_0x83df40]['id'],'interface':_0x41d257,'paused':_0x425f6a[_0x6768('0x9d')]||![],'penalty':_0x5d37ba[_0x83df40][_0x6768('0xf3')]||0x0});}return BPromise[_0x6768('0x87')](_0x1be13a,function(_0x240a1b){return db['UserVoiceQueueRt']['upsert'](_0x240a1b);});}}}})[_0x6768('0x15')](function(){if(_0x425f6a){return db[_0x6768('0xf4')][_0x6768('0x45')]({'where':{'membername':_0x425f6a[_0x6768('0x36')],'exitAt':null}});}})[_0x6768('0x15')](function(_0x4fc4c1){if(_0x425f6a){var _0x2e8a42=[];_0x4fc4c1[_0x6768('0xf5')](function(_0x3869b5){_0x2e8a42['push'](_0x3869b5['update']({'exitAt':moment()['format'](_0x6768('0xf6'))}));});return BPromise['all'](_0x2e8a42);}})[_0x6768('0x15')](function(){if(_0x425f6a){var _0x167a4d=[];var _0x5360f9=[];var _0x59dbe0=utils[_0x6768('0xf7')]();var _0x51dba2={'membername':_0x425f6a[_0x6768('0x36')],'interface':_0x41d257,'enterAt':moment()[_0x6768('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x425f6a[_0x6768('0x31')],'internal':_0x425f6a[_0x6768('0x61')]};_0x59dbe0[_0x6768('0xf5')](function(_0x1add57){_0x167a4d[_0x6768('0x49')](_[_0x6768('0x59')]({'channel':_0x1add57,'type':_0x6768('0xf8'),'data1':_0x16a5b0['body'][_0x6768('0xf9')],'data2':_0x41d257},_0x51dba2));if(_0x425f6a[_0x6768('0x9d')]){_0x5360f9[_0x6768('0x49')](_['merge']({'channel':_0x1add57,'type':'PAUSE','data1':'LOGININPAUSE'},_0x51dba2));}});return db[_0x6768('0xf4')][_0x6768('0xfa')](_0x167a4d[_0x6768('0xfb')](_0x5360f9),{'individualHooks':!![]});}})[_0x6768('0x15')](function(){if(_0x425f6a){return _0x425f6a[_0x6768('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0x6768('0xf6')),'voicePause':_0x425f6a[_0x6768('0x9d')]||![],'mailPause':_0x425f6a[_0x6768('0x9d')]||![],'chatPause':_0x425f6a[_0x6768('0x9d')]||![],'faxPause':_0x425f6a[_0x6768('0x9d')]||![],'smsPause':_0x425f6a['loginInPause']||![],'openchannelPause':_0x425f6a['loginInPause']||![],'whatsappPause':_0x425f6a[_0x6768('0x9d')]||![],'pauseType':_0x425f6a[_0x6768('0x9d')]?_0x6768('0xfc'):null,'interface':_0x41d257,'lastPauseAt':moment()[_0x6768('0xab')](_0x6768('0xf6'))});}})['then'](function(_0x3af985){if(_0x16a5b0['isMiddleware']){return _0x233ea2();}else{return BPromise[_0x6768('0xfd')](_0x3af985)[_0x6768('0x15')](respondWithResult(_0x145b89,null));}})[_0x6768('0x4f')](handleError(_0x145b89,null));};exports[_0x6768('0xfe')]=function(_0x1c0cec,_0x6e3216){var _0x26cef5;return db[_0x6768('0x37')]['find']({'where':{'id':_0x1c0cec['params']['id'],'role':_0x6768('0x2c')},'attributes':['id',_0x6768('0x36'),_0x6768('0x31')]})[_0x6768('0x15')](handleEntityNotFound(_0x6e3216,null))[_0x6768('0x15')](function(_0x74c0ed){if(_0x74c0ed){_0x26cef5=_0x74c0ed;return db[_0x6768('0xad')][_0x6768('0x34')]({'where':{'membername':_0x26cef5[_0x6768('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0x6768('0xf4')]['findAll']({'where':{'membername':_0x26cef5['name'],'exitAt':null}});})[_0x6768('0x15')](function(_0x291c2d){var _0x4cde44=[];_0x291c2d[_0x6768('0xf5')](function(_0x1070d7){_0x4cde44[_0x6768('0x49')](_0x1070d7['update']({'exitAt':moment()[_0x6768('0xab')](_0x6768('0xf6'))}));});return BPromise[_0x6768('0x5b')](_0x4cde44);})[_0x6768('0x15')](function(){return _0x26cef5[_0x6768('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x6e3216,null))['catch'](handleError(_0x6e3216,null));};exports['pause']=function(_0x2c18fe,_0x508bd3){var _0x5c3294;return db[_0x6768('0xad')][_0x6768('0x28')]({'paused':0x1},{'where':{'UserId':_0x2c18fe[_0x6768('0x51')]['id']},'individualHooks':!![]})[_0x6768('0x15')](function(){return db[_0x6768('0x37')][_0x6768('0x32')]({'where':{'id':_0x2c18fe['params']['id'],'role':_0x6768('0x2c')},'attributes':['id',_0x6768('0x36'),_0x6768('0x31'),_0x6768('0x61'),_0x6768('0x9f')]});})['then'](handleEntityNotFound(_0x508bd3,null))[_0x6768('0x15')](function(_0x3e9fc6){if(_0x3e9fc6){_0x5c3294=_0x3e9fc6;return respondWithRpcPromise('QueuePause',_0x6768('0xff'),{'id':_0x5c3294['id'],'name':_0x5c3294[_0x6768('0x36')],'pause':!![]});}})['then'](function(){if(_0x5c3294){return db['MemberReport'][_0x6768('0x45')]({'where':{'membername':_0x5c3294[_0x6768('0x36')],'type':_0x6768('0x100'),'exitAt':null}});}})[_0x6768('0x15')](function(_0xb108fb){if(_0xb108fb['length']){var _0x2b4e5b=moment()['format'](_0x6768('0xf6'));for(var _0x569226=0x0,_0x3ac0c4=_0xb108fb[_0x6768('0x48')];_0x569226<_0x3ac0c4;_0x569226++){_0xb108fb[_0x569226][_0x6768('0x101')]({'exitAt':_0x2b4e5b});}}})['then'](function(){var _0x347421=[];var _0x22a1c7=utils[_0x6768('0xf7')]();_0x22a1c7[_0x6768('0xf5')](function(_0x4e7271){_0x347421[_0x6768('0x49')]({'channel':_0x4e7271,'membername':_0x5c3294[_0x6768('0x36')],'interface':_['isNil'](_0x5c3294[_0x6768('0x9f')])?util[_0x6768('0xab')]('SIP/%s',_0x5c3294[_0x6768('0x36')]):_0x5c3294['interface'],'type':_0x6768('0x100'),'enterAt':moment()[_0x6768('0xab')](_0x6768('0xf6')),'data1':_0x2c18fe['body'][_0x6768('0x39')]||_0x6768('0x102'),'role':_0x5c3294['role'],'internal':_0x5c3294[_0x6768('0x61')]});});return db[_0x6768('0xf4')][_0x6768('0xfa')](_0x347421,{'individualHooks':!![]});})['then'](function(){return _0x5c3294[_0x6768('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2c18fe[_0x6768('0x5c')][_0x6768('0x39')]||_0x6768('0x102'),'lastPauseAt':moment()['format'](_0x6768('0xf6'))});})[_0x6768('0x15')](respondWithResult(_0x508bd3,null))[_0x6768('0x4f')](handleError(_0x508bd3,null));};exports[_0x6768('0x103')]=function(_0x511b50,_0x79389f){var _0x20a678;return db['User']['find']({'where':{'id':_0x511b50[_0x6768('0x51')]['id']},'attributes':['id',_0x6768('0x36'),'role',_0x6768('0x9e'),_0x6768('0x104'),'chatPause',_0x6768('0x105'),'openchannelPause',_0x6768('0x106'),_0x6768('0x107'),_0x6768('0x108'),'lastPauseAt']})[_0x6768('0x15')](handleEntityNotFound(_0x79389f,null))[_0x6768('0x15')](function(_0x3bb6e5){if(_0x3bb6e5){_0x20a678=_0x3bb6e5;if(_0x511b50[_0x6768('0x5c')]['channel']&&!utils[_0x6768('0xaf')](_0x511b50[_0x6768('0x5c')][_0x6768('0x9b')])){throw new db[(_0x6768('0x8d'))][(_0x6768('0x8e'))](_0x6768('0xa0'));}switch(_0x511b50[_0x6768('0x5c')]['channel']){case _0x6768('0xa8'):return respondWithRpcPromise(_0x6768('0x109'),_0x6768('0x103'),{'id':_0x20a678['id'],'name':_0x20a678[_0x6768('0x36')],'pause':![]})[_0x6768('0x15')](function(){return db[_0x6768('0xad')][_0x6768('0x28')]({'paused':0x0},{'where':{'UserId':_0x20a678['id']},'individualHooks':!![]});})[_0x6768('0x15')](function(){return db['MemberReport'][_0x6768('0x32')]({'where':{'channel':_0x511b50[_0x6768('0x5c')][_0x6768('0x9b')],'membername':_0x20a678['name'],'type':_0x6768('0x100'),'exitAt':null}});})[_0x6768('0x15')](function(_0x19aa76){if(_0x19aa76){return _0x19aa76[_0x6768('0x28')]({'exitAt':moment()[_0x6768('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6768('0x10a')},{'individualHooks':!![]});}return null;})[_0x6768('0x15')](function(){return _0x20a678[_0x6768('0x28')]({'voicePause':![]});});case'mail':case'chat':case _0x6768('0x4d'):case _0x6768('0x4c'):case'whatsapp':case _0x6768('0x5a'):return db[_0x6768('0xf4')][_0x6768('0x32')]({'where':{'channel':_0x511b50[_0x6768('0x5c')][_0x6768('0x9b')],'membername':_0x20a678[_0x6768('0x36')],'type':_0x6768('0x100'),'exitAt':null}})['then'](function(_0x5051c7){if(_0x5051c7){return _0x5051c7[_0x6768('0x28')]({'exitAt':moment()[_0x6768('0xab')](_0x6768('0xf6')),'data2':_0x6768('0x10a')},{'individualHooks':!![]});}return null;})[_0x6768('0x15')](function(){var _0x10a3ea={};_['set'](_0x10a3ea,util[_0x6768('0xab')](_0x6768('0x10b'),_0x511b50[_0x6768('0x5c')][_0x6768('0x9b')],_0x6768('0x10c')),![]);return _0x20a678[_0x6768('0x28')](_0x10a3ea);});default:return respondWithRpcPromise(_0x6768('0x109'),_0x6768('0x103'),{'id':_0x20a678['id'],'name':_0x20a678[_0x6768('0x36')],'pause':![]})[_0x6768('0x15')](function(){return db[_0x6768('0xad')][_0x6768('0x28')]({'paused':0x0},{'where':{'UserId':_0x20a678['id']}});})[_0x6768('0x15')](function(){return db[_0x6768('0xf4')]['findAll']({'where':{'membername':_0x20a678[_0x6768('0x36')],'type':'PAUSE','exitAt':null}});})[_0x6768('0x15')](function(_0x4130f1){var _0x3a0a34=[];_0x4130f1[_0x6768('0xf5')](function(_0x23fbec){_0x3a0a34['push'](_0x23fbec[_0x6768('0x28')]({'exitAt':moment()[_0x6768('0xab')](_0x6768('0xf6')),'data2':'manual'}));});return BPromise[_0x6768('0x5b')](_0x3a0a34);})[_0x6768('0x15')](function(){return _0x20a678[_0x6768('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6768('0x15')](respondWithResult(_0x79389f,null))[_0x6768('0x4f')](handleError(_0x79389f,null));};exports[_0x6768('0x10d')]=function(_0x6836e8,_0x54527){var _0x346464={};var _0xc7beb={};var _0x1a5ee7;var _0x4a4435;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x6836e8[_0x6768('0x51')]['id']}})['then'](handleEntityNotFound(_0x54527,null))['then'](function(_0x240d35){if(_0x240d35){_0x1a5ee7=_0x240d35;_0xc7beb[_0x6768('0x52')]=_[_0x6768('0x55')](db['Team'][_0x6768('0x54')]);_0xc7beb[_0x6768('0x41')]=_[_0x6768('0x55')](_0x6836e8[_0x6768('0x41')]);_0xc7beb['filters']=_[_0x6768('0x57')](_0xc7beb[_0x6768('0x52')],_0xc7beb['query']);_0x346464[_0x6768('0x44')]=_[_0x6768('0x57')](_0xc7beb[_0x6768('0x52')],qs[_0x6768('0x58')](_0x6836e8[_0x6768('0x41')]['fields']));_0x346464[_0x6768('0x44')]=_0x346464[_0x6768('0x44')]['length']?_0x346464['attributes']:_0xc7beb['model'];_0x346464['order']=qs[_0x6768('0xc7')](_0x6836e8[_0x6768('0x41')][_0x6768('0xc7')]);_0x346464[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x6836e8[_0x6768('0x41')],_0xc7beb[_0x6768('0x56')]));if(_0x6836e8['query'][_0x6768('0x3b')]){_0x346464[_0x6768('0xc8')]=_['merge'](_0x346464['where'],{'$or':_['map'](_0x346464['attributes'],function(_0x2f37e5){var _0x27f9e8={};_0x27f9e8[_0x2f37e5]={'$like':'%'+_0x6836e8[_0x6768('0x41')][_0x6768('0x3b')]+'%'};return _0x27f9e8;})});}_0x346464=_[_0x6768('0x59')]({},_0x346464,_0x6836e8[_0x6768('0xca')]);return _0x1a5ee7[_0x6768('0x10d')](_0x346464);}})[_0x6768('0x15')](function(_0x3b5000){if(_0x3b5000){_0x4a4435=_0x3b5000[_0x6768('0x48')];if(!_0x6836e8['query']['hasOwnProperty'](_0x6768('0xd1'))){_0x346464[_0x6768('0x23')]=qs[_0x6768('0x23')](_0x6836e8['query'][_0x6768('0x23')]);_0x346464[_0x6768('0x22')]=qs[_0x6768('0x22')](_0x6836e8[_0x6768('0x41')][_0x6768('0x22')]);}return _0x1a5ee7[_0x6768('0x10d')](_0x346464);}})[_0x6768('0x15')](function(_0x2bf5bc){if(_0x2bf5bc){return _0x2bf5bc?{'count':_0x4a4435,'rows':_0x2bf5bc}:null;}})[_0x6768('0x15')](respondWithResult(_0x54527,null))[_0x6768('0x4f')](handleError(_0x54527,null));};exports[_0x6768('0x10e')]=function(_0x5447db,_0x170013){var _0x83fb79=_0x5447db['params']['id'];var _0x511edd=_0x5447db[_0x6768('0x5c')]?_0x5447db[_0x6768('0x5c')][_0x6768('0x5f')]:null;var _0x53adbc=[];return Promise[_0x6768('0xfd')]()[_0x6768('0x15')](function(){if(!_0x511edd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x6768('0x15')](function(){return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x83fb79}});})[_0x6768('0x15')](function(_0x20c692){if(!_0x20c692)throw new APINotFoundError(util[_0x6768('0xab')](_0x6768('0x10f'),_0x5447db[_0x6768('0x51')]['id']));return db[_0x6768('0x66')][_0x6768('0x110')](function(_0x121054){return _0x20c692[_0x6768('0x10e')](_0x511edd,{'transaction':_0x121054})[_0x6768('0x15')](function(){return db['Team'][_0x6768('0x45')]({'where':{'id':{'$in':_0x511edd}}});})[_0x6768('0x15')](function(_0x3baef0){var _0x31cb3c=_[_0x6768('0x38')](_0x3baef0,function(_0x497adc){return _0x497adc[_0x6768('0x111')]();});return Promise[_0x6768('0x5b')](_0x31cb3c);})[_0x6768('0x15')](function(_0x2121f4){_0x53adbc=_[_0x6768('0x112')](_0x2121f4);var _0x138285=_[_0x6768('0x38')](_0x53adbc,function(_0x32c27d){return _0x32c27d[_0x6768('0x113')](_0x20c692['id'],{'transaction':_0x121054});});return Promise[_0x6768('0x5b')](_0x138285);})[_0x6768('0x15')](function(){if(!_0x20c692[_0x6768('0x9c')])return;var _0x9c832d=_[_0x6768('0x3b')](_0x53adbc,function(_0x43c6f1){return _0x43c6f1['getDataValue']('channel')===_0x6768('0x114');});var _0x3d1cfb=_[_0x6768('0x38')](_0x9c832d,function(_0x527c92){return db[_0x6768('0xad')][_0x6768('0x115')]({'membername':_0x20c692['name'],'UserId':_0x20c692['id'],'queue_name':_0x527c92['name'],'VoiceQueueId':_0x527c92['id'],'interface':_[_0x6768('0x69')](_0x20c692[_0x6768('0x9f')])?util[_0x6768('0xab')](_0x6768('0xac'),_0x20c692[_0x6768('0x36')]):_0x20c692[_0x6768('0x9f')],'paused':_0x20c692[_0x6768('0x9e')]||![],'penalty':_0x20c692['penalty']},{'transaction':_0x121054});});return Promise[_0x6768('0x5b')](_0x3d1cfb);})['then'](function(){return db['TeamVoicePrefix'][_0x6768('0x45')]({'where':{'teamId':{'$in':_0x511edd}}});})[_0x6768('0x15')](function(_0x750757){var _0x205d3f=_[_0x6768('0x38')](_0x750757,function(_0x47d314){return db[_0x6768('0x116')][_0x6768('0x7a')]({'UserId':_0x20c692['id'],'VoicePrefixId':_0x47d314[_0x6768('0x117')]},{'transaction':_0x121054});});return Promise[_0x6768('0x5b')](_0x205d3f);});});})['then'](function(){for(var _0xa7fb70=0x0;_0xa7fb70<_0x53adbc[_0x6768('0x48')];_0xa7fb70++){var _0x42a07a=_0x53adbc[_0xa7fb70]['getDataValue'](_0x6768('0x9b'));var _0x5a9755=_0x42a07a+_0x6768('0xb1');socket[_0x6768('0xa6')](_0x6768('0x2a')+_0x42a07a+_0x6768('0xa7'),{'UserId':_0x83fb79,['queueField']:_0x53adbc[_0xa7fb70]['id']});}})['then'](respondWithStatusCode(_0x170013,null))[_0x6768('0x4f')](APIHandleError(_0x170013));};exports[_0x6768('0x118')]=function(_0x4d1d5b,_0x3feddd){var _0x3e2abb=_0x4d1d5b[_0x6768('0x51')]['id'];var _0x22cee1=null;if(_0x4d1d5b['query'][_0x6768('0x5f')]){_0x22cee1=_[_0x6768('0xb0')](_0x4d1d5b[_0x6768('0x41')][_0x6768('0x5f')])?_0x4d1d5b[_0x6768('0x41')][_0x6768('0x5f')]:[_0x4d1d5b[_0x6768('0x41')][_0x6768('0x5f')]];}var _0xc0580e=[];return Promise[_0x6768('0xfd')]()['then'](function(){if(!_0x22cee1)throw new APIBadRequestError(_0x6768('0x119'));})[_0x6768('0x15')](function(){return db['User']['findOne']({'where':{'id':_0x3e2abb}});})[_0x6768('0x15')](function(_0x3c09b5){if(!_0x3c09b5)throw new APINotFoundError(util['format'](_0x6768('0x10f'),_0x4d1d5b[_0x6768('0x51')]['id']));return db['sequelize'][_0x6768('0x110')](function(_0x30b137){return _0x3c09b5[_0x6768('0x118')](_0x22cee1,{'transaction':_0x30b137})['then'](function(){return db[_0x6768('0x11a')][_0x6768('0x45')]({'where':{'id':{'$in':_0x22cee1}}});})[_0x6768('0x15')](function(_0x8576b){var _0x16fa63=_['map'](_0x8576b,function(_0x2eb700){return _0x2eb700[_0x6768('0x111')]();});return Promise[_0x6768('0x5b')](_0x16fa63);})['then'](function(_0x1d03b){_0xc0580e=_[_0x6768('0x112')](_0x1d03b);var _0x3c1321=_[_0x6768('0x38')](_0xc0580e,function(_0x34575b){return _0x34575b[_0x6768('0x11b')](_0x3c09b5['id'],{'transaction':_0x30b137});});return Promise[_0x6768('0x5b')](_0x3c1321);})[_0x6768('0x15')](function(){if(!_0x3c09b5[_0x6768('0x9c')])return;var _0x31a7d9=_[_0x6768('0x3b')](_0xc0580e,function(_0x2a0d5f){return _0x2a0d5f['getDataValue'](_0x6768('0x9b'))===_0x6768('0x114');});var _0x53d1c6=_['map'](_0x31a7d9,function(_0x1a176d){return db[_0x6768('0xad')][_0x6768('0x34')]({'where':{'VoiceQueueId':_0x1a176d['id'],'UserId':_0x3c09b5['id']},'transaction':_0x30b137});});return Promise[_0x6768('0x5b')](_0x53d1c6);})['then'](function(){return db[_0x6768('0x11c')][_0x6768('0x45')]({'where':{'teamId':{'$in':_0x22cee1}}});})[_0x6768('0x15')](function(_0x5e4013){var _0x49b94d=_[_0x6768('0x38')](_0x5e4013,function(_0x5742c3){return db['UserVoicePrefix'][_0x6768('0x34')]({'where':{'UserId':_0x3c09b5['id'],'VoicePrefixId':_0x5742c3[_0x6768('0x117')]}},{'transaction':_0x30b137});});return Promise[_0x6768('0x5b')](_0x49b94d);});});})[_0x6768('0x15')](function(){for(var _0x2caa59=0x0;_0x2caa59<_0xc0580e[_0x6768('0x48')];_0x2caa59++){var _0x4e23c8=_0xc0580e[_0x2caa59][_0x6768('0x11d')]('channel');var _0xd6aa2d=_0x4e23c8+_0x6768('0xb1');socket['emit'](_0x6768('0x2a')+_0x4e23c8+_0x6768('0xb2'),{'UserId':_0x3e2abb,['queueField']:_0xc0580e[_0x2caa59]['id']});}})[_0x6768('0x15')](respondWithStatusCode(_0x3feddd,null))[_0x6768('0x4f')](APIHandleError(_0x3feddd));};exports[_0x6768('0x11e')]=function(_0x38799c,_0x1022fb){var _0x5c7fbb={};var _0x18247f={};var _0x512b14;var _0x1a6af0;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x38799c['params']['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x1022fb,null))[_0x6768('0x15')](function(_0x99a3ca){if(_0x99a3ca){_0x512b14=_0x99a3ca;_0x18247f[_0x6768('0x52')]=_[_0x6768('0x55')](db[_0x6768('0xcb')][_0x6768('0x54')]);_0x18247f[_0x6768('0x41')]=_[_0x6768('0x55')](_0x38799c[_0x6768('0x41')]);_0x18247f[_0x6768('0x56')]=_[_0x6768('0x57')](_0x18247f[_0x6768('0x52')],_0x18247f[_0x6768('0x41')]);_0x5c7fbb[_0x6768('0x44')]=_[_0x6768('0x57')](_0x18247f[_0x6768('0x52')],qs[_0x6768('0x58')](_0x38799c[_0x6768('0x41')]['fields']));_0x5c7fbb[_0x6768('0x44')]=_0x5c7fbb[_0x6768('0x44')]['length']?_0x5c7fbb[_0x6768('0x44')]:_0x18247f[_0x6768('0x52')];_0x5c7fbb[_0x6768('0xc6')]=qs[_0x6768('0xc7')](_0x38799c[_0x6768('0x41')][_0x6768('0xc7')]);_0x5c7fbb[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x38799c['query'],_0x18247f[_0x6768('0x56')]));if(_0x38799c[_0x6768('0x41')][_0x6768('0x3b')]){_0x5c7fbb[_0x6768('0xc8')]=_['merge'](_0x5c7fbb[_0x6768('0xc8')],{'$or':_[_0x6768('0x38')](_0x5c7fbb['attributes'],function(_0x5adc60){var _0x5350de={};_0x5350de[_0x5adc60]={'$like':'%'+_0x38799c[_0x6768('0x41')]['filter']+'%'};return _0x5350de;})});}_0x5c7fbb=_['merge']({},_0x5c7fbb,_0x38799c['options']);return _0x512b14[_0x6768('0x11e')](_0x5c7fbb);}})['then'](function(_0xab1912){if(_0xab1912){_0x1a6af0=_0xab1912[_0x6768('0x48')];if(!_0x38799c[_0x6768('0x41')][_0x6768('0xd4')]('nolimit')){_0x5c7fbb['limit']=qs[_0x6768('0x23')](_0x38799c[_0x6768('0x41')][_0x6768('0x23')]);_0x5c7fbb[_0x6768('0x22')]=qs['offset'](_0x38799c[_0x6768('0x41')][_0x6768('0x22')]);}return _0x512b14[_0x6768('0x11e')](_0x5c7fbb);}})[_0x6768('0x15')](function(_0x42bcd0){if(_0x42bcd0){return _0x42bcd0?{'count':_0x1a6af0,'rows':_0x42bcd0}:null;}})[_0x6768('0x15')](respondWithResult(_0x1022fb,null))[_0x6768('0x4f')](handleError(_0x1022fb,null));};exports['getAgents']=function(_0x43636a,_0x4aa4bd){var _0x864db9={};var _0x5227e4={};var _0x231981;return db[_0x6768('0x37')][_0x6768('0x94')]({'where':{'id':_0x43636a[_0x6768('0x51')]['id']}})[_0x6768('0x15')](handleEntityNotFound(_0x4aa4bd,null))[_0x6768('0x15')](function(_0x4c31a4){if(_0x4c31a4){_0x231981=_0x4c31a4;_0x5227e4['model']=_[_0x6768('0x55')](db[_0x6768('0x37')][_0x6768('0x54')]);_0x5227e4['query']=_[_0x6768('0x55')](_0x43636a['query']);_0x5227e4['filters']=_[_0x6768('0x57')](_0x5227e4[_0x6768('0x52')],_0x5227e4[_0x6768('0x41')]);_0x864db9[_0x6768('0x44')]=_[_0x6768('0x57')](_0x5227e4[_0x6768('0x52')],qs[_0x6768('0x58')](_0x43636a[_0x6768('0x41')]['fields']));_0x864db9['attributes']=_0x864db9[_0x6768('0x44')]['length']?_0x864db9[_0x6768('0x44')]:_0x5227e4[_0x6768('0x52')];_0x864db9['order']=qs[_0x6768('0xc7')](_0x43636a[_0x6768('0x41')]['sort']);_0x864db9[_0x6768('0xc8')]=qs[_0x6768('0x56')](_[_0x6768('0xc9')](_0x43636a['query'],_0x5227e4[_0x6768('0x56')]));if(_0x43636a[_0x6768('0x41')][_0x6768('0x3b')]){_0x864db9['where']=_[_0x6768('0x59')](_0x864db9[_0x6768('0xc8')],{'$or':_['map'](_0x864db9['attributes'],function(_0x23a866){var _0x360079={};_0x360079[_0x23a866]={'$like':'%'+_0x43636a[_0x6768('0x41')]['filter']+'%'};return _0x360079;})});}_0x864db9['model']=db[_0x6768('0x37')];_0x864db9['as']=_0x6768('0x2b');_0x864db9=_['merge']({},_0x864db9,_0x43636a['options']);return _0x231981[_0x6768('0xf2')]({'include':[_0x864db9]});}})[_0x6768('0x15')](function(_0x534a11){if(_0x534a11){var _0x33ddd7={},_0x9eb0ff=[];for(var _0x38b6dc=0x0;_0x38b6dc<_0x534a11['length'];_0x38b6dc+=0x1){for(var _0x22a3f5=0x0,_0x4b5738;_0x22a3f5<_0x534a11[_0x38b6dc][_0x6768('0x2b')][_0x6768('0x48')];_0x22a3f5+=0x1){_0x4b5738=_0x534a11[_0x38b6dc]['Agents'][_0x22a3f5]['get']({'plain':!![]});_0x33ddd7[_0x4b5738['id']]=_0x4b5738;}}_0x33ddd7=_[_0x6768('0x11f')](_0x33ddd7);for(var _0x1d5f30=qs[_0x6768('0x22')](_0x43636a[_0x6768('0x41')][_0x6768('0x22')]);_0x1d5f30<_0x33ddd7[_0x6768('0x48')]&&_0x9eb0ff[_0x6768('0x48')]=_0x1cbeb1){_0x33d615=_0x1cbeb1;_0x1a3c1c=0xc8;}else{_0x1a3c1c=0xce;}_0x4f1622[_0x8038('0x1f')](_0x1a3c1c);return _0x4f1622[_0x8038('0x24')](_0x8038('0x25'),_0x44a3ec+'-'+_0x33d615+'/'+_0x1cbeb1)[_0x8038('0x26')](_0x398975);}return null;};}function saveUpdates(_0x3773ef){return function(_0x32ae50){if(_0x32ae50){return _0x32ae50[_0x8038('0x27')](_0x3773ef)['then'](function(_0x212c49){socket[_0x8038('0x28')](_0x8038('0x29')+_0x212c49['id'],{});return _0x212c49;});}return null;};}function removeEntity(_0x42bc63){return function(_0x200aa6){if(_0x200aa6){return _0x200aa6['destroy']()[_0x8038('0x15')](function(){var _0x401c6a=_0x200aa6[_0x8038('0x2a')]({'plain':!![]});if(_0x401c6a[_0x8038('0x2b')]===_0x8038('0x2c'))return;var _0x22906e=[{'name':_0x8038('0x2d'),'value':_0x8038('0x2e'),'ignore':!![]},{'name':_0x8038('0x2f'),'value':_0x8038('0x30'),'ignore':![]},{'name':_0x8038('0x31'),'value':_0x8038('0x32'),'ignore':![]}];var _0x434b23=_(_0x22906e)['filter'](_0x8038('0x33'))[_0x8038('0x34')](_0x8038('0x35'))[_0x8038('0x35')]();if(_[_0x8038('0x36')](_0x434b23,_0x401c6a[_0x8038('0x2b')])){return;}var _0x465722=_['find'](_0x22906e,[_0x8038('0x35'),_0x401c6a['role']])[_0x8038('0x37')];return db['UserProfileResource']['destroy']({'where':{'type':_0x465722,'resourceId':_0x401c6a['id']}})[_0x8038('0x15')](function(){return _0x200aa6;});})['then'](function(){_0x42bc63[_0x8038('0x1f')](0xcc)[_0x8038('0x20')]();});}};}function handleEntityNotFound(_0x2a22f0){return function(_0x3a3b7f){if(!_0x3a3b7f){_0x2a22f0['sendStatus'](0x194);}return _0x3a3b7f;};}function handleError(_0x453bd4,_0xebd29a){_0xebd29a=_0xebd29a||0x1f4;return function(_0x3dcf99){logger[_0x8038('0x1b')](_0x3dcf99['stack']);if(_0x3dcf99[_0x8038('0x37')]){delete _0x3dcf99[_0x8038('0x37')];}_0x453bd4[_0x8038('0x1f')](_0xebd29a)['send'](_0x3dcf99);};}exports['index']=function(_0x54bce4,_0x3d010d){var _0x4fed01={},_0x34df3c={'count':0x0,'rows':[]};var _0x13bfbf=_(db[_0x8038('0x38')]['rawAttributes'])[_0x8038('0x34')](function(_0x3bb33a){return{'name':_0x3bb33a[_0x8038('0x39')],'type':_0x3bb33a[_0x8038('0x3a')]['key']};})[_0x8038('0x3b')](function(_0x1d8165){return!_[_0x8038('0x36')]([_0x8038('0x3c'),_0x8038('0x3d')],_0x1d8165[_0x8038('0x37')]);})[_0x8038('0x35')]();_0x4fed01=qs[_0x8038('0x3e')](_0x13bfbf,_0x54bce4);var _0x2a41ef={'where':_0x4fed01[_0x8038('0x3f')]};return db[_0x8038('0x38')][_0x8038('0x23')](_0x2a41ef)['then'](function(_0x488dde){_0x34df3c['count']=_0x488dde;if(_0x54bce4[_0x8038('0x40')][_0x8038('0x41')]){_0x4fed01[_0x8038('0x42')]=[{'all':!![]}];}if(_0x54bce4[_0x8038('0x40')][_0x8038('0x43')]===_0x8038('0x44')){_0x4fed01['include']=[{'model':db[_0x8038('0x45')],'as':_0x8038('0x43')}];}if(!_[_0x8038('0x36')](_0x4fed01[_0x8038('0x46')],'id')){_0x4fed01[_0x8038('0x46')][_0x8038('0x47')]('id');}return db[_0x8038('0x38')][_0x8038('0x48')](_0x4fed01);})['then'](function(_0x135d65){_0x34df3c['rows']=_0x135d65;if(_0x54bce4[_0x8038('0x40')]['openTabs']===_0x8038('0x44')){var _0x1bd60e=[];for(var _0x143682=0x0;_0x143682<_0x34df3c[_0x8038('0x49')]['length'];_0x143682++){_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e[_0x8038('0x47')](get_open_tabs('sms',_0x34df3c[_0x8038('0x49')][_0x143682]['dataValues']));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4d'),_0x34df3c['rows'][_0x143682]['dataValues']));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4e'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e['push'](get_open_tabs(_0x8038('0x4f'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));}return BPromise[_0x8038('0x50')](_0x1bd60e)['then'](function(){return _0x34df3c;});}else{return _0x34df3c;}})[_0x8038('0x15')](respondWithFilteredResult(_0x3d010d,_0x4fed01))[_0x8038('0x51')](handleError(_0x3d010d,null));};exports['show']=function(_0xc2901f,_0x1e3dcd){var _0x2b91d9={'raw':![],'where':{'id':_0xc2901f[_0x8038('0x52')]['id']}},_0x5f5685={};_0x5f5685[_0x8038('0x53')]=_['differenceBy'](_[_0x8038('0x54')](db[_0x8038('0x38')][_0x8038('0x55')]),[_0x8038('0x3c'),_0x8038('0x3d')]);_0x5f5685[_0x8038('0x40')]=_[_0x8038('0x54')](_0xc2901f['query']);_0x5f5685[_0x8038('0x56')]=_['intersection'](_0x5f5685[_0x8038('0x53')],_0x5f5685[_0x8038('0x40')]);_0x2b91d9['attributes']=_[_0x8038('0x57')](_0x5f5685[_0x8038('0x53')],qs[_0x8038('0x58')](_0xc2901f['query'][_0x8038('0x58')]));_0x2b91d9[_0x8038('0x46')]=_0x2b91d9[_0x8038('0x46')][_0x8038('0x59')]?_0x2b91d9[_0x8038('0x46')]:_0x5f5685[_0x8038('0x53')];if(_0xc2901f[_0x8038('0x40')][_0x8038('0x41')]){_0x2b91d9[_0x8038('0x42')]=[{'all':!![]}];}if(_0xc2901f[_0x8038('0x40')]['userSetting']===_0x8038('0x44')){_0x2b91d9[_0x8038('0x42')]=[{'model':db[_0x8038('0x45')],'as':_0x8038('0x43')}];}_0x2b91d9=_['merge']({},_0x2b91d9,_0xc2901f[_0x8038('0x5a')]);if(!_[_0x8038('0x36')](_0x2b91d9[_0x8038('0x46')],'id')){_0x2b91d9[_0x8038('0x46')][_0x8038('0x47')]('id');}return db[_0x8038('0x38')][_0x8038('0x5b')](_0x2b91d9)[_0x8038('0x15')](handleEntityNotFound(_0x1e3dcd,null))[_0x8038('0x15')](function(_0x4f42de){var _0x4a482e=[];values=_0x4f42de;if(_0xc2901f[_0x8038('0x40')][_0x8038('0x5c')]===_0x8038('0x44')){_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x4f42de['dataValues']));_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x5d'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e['push'](get_open_tabs(_0x8038('0x4e'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e[_0x8038('0x47')](get_open_tabs('whatsapp',_0x4f42de[_0x8038('0x4b')]));_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e['push'](get_open_tabs(_0x8038('0x4d'),_0x4f42de[_0x8038('0x4b')]));return BPromise[_0x8038('0x50')](_0x4a482e);}else{return values;}})['then'](function(){return values;})[_0x8038('0x15')](respondWithResult(_0x1e3dcd,null))['catch'](handleError(_0x1e3dcd,null));};exports[_0x8038('0x27')]=function(_0x319953,_0x24b825){if(_0x319953[_0x8038('0x5e')]['id']){delete _0x319953['body']['id'];}delete _0x319953['body']['role'];return db['User'][_0x8038('0x5b')]({'where':{'id':_0x319953[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x24b825,null))['then'](saveUpdates(_0x319953[_0x8038('0x5e')],null))[_0x8038('0x15')](respondWithResult(_0x24b825,null))['catch'](handleError(_0x24b825,null));};exports[_0x8038('0x5f')]=function(_0x2ae206,_0x1b5caf){return db[_0x8038('0x38')][_0x8038('0x5f')]()['then'](respondWithResult(_0x1b5caf,null))[_0x8038('0x51')](handleError(_0x1b5caf,null));};exports['addContacts']=function(_0x12b0d5,_0x1683f8){return db['User']['find']({'where':{'id':_0x12b0d5[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x1683f8,null))[_0x8038('0x15')](function(_0x4403e2){if(_0x4403e2){return _0x4403e2[_0x8038('0x60')](_0x12b0d5[_0x8038('0x5e')][_0x8038('0x61')],_[_0x8038('0x62')](_0x12b0d5['body'],[_0x8038('0x61'),'id'])||{});}})[_0x8038('0x15')](respondWithResult(_0x1683f8,null))[_0x8038('0x51')](handleError(_0x1683f8,null));};function validateUser(_0x5b278a){return new BPromise(function(_0x23b8c2,_0x5111c1){if(_0x5b278a[_0x8038('0x63')])return _0x23b8c2(_0x5b278a);return db[_0x8038('0x64')]['findById'](0x1)[_0x8038('0x15')](function(_0x45c9f2){if(_0x45c9f2['securePassword'])authService[_0x8038('0x65')](_0x5b278a['password']);db['User'][_0x8038('0x66')](_0x8038('0x63'))[_0x8038('0x15')](function(_0x2c925f){if(_['isNil'](_0x2c925f)){_0x5b278a[_0x8038('0x63')]=_0x45c9f2[_0x8038('0x67')]||0x1;return;}if(_[_0x8038('0x68')](_0x45c9f2['min_internal'])||_0x45c9f2['min_internal']===_0x2c925f){_0x5b278a[_0x8038('0x63')]=_0x2c925f+0x1;return;}if(_0x45c9f2[_0x8038('0x67')]>_0x2c925f){_0x5b278a[_0x8038('0x63')]=_0x45c9f2[_0x8038('0x67')];return;}return db['sequelize'][_0x8038('0x40')](_0x8038('0x69'),{'type':db['sequelize'][_0x8038('0x6a')][_0x8038('0x6b')]})['then'](function(_0xc94c3){if(_0xc94c3&&_0xc94c3[_0x8038('0x59')]){for(var _0xcca4b3=0x0,_0xd180be=_0xc94c3[_0x8038('0x59')];_0xcca4b3<_0xd180be&&_[_0x8038('0x68')](_0x5b278a[_0x8038('0x63')]);_0xcca4b3++){if(_0x45c9f2['min_internal']<=_0xc94c3[_0xcca4b3][_0x8038('0x6c')]){_0x5b278a[_0x8038('0x63')]=_0xc94c3[_0xcca4b3][_0x8038('0x6c')];}else if(_0x45c9f2[_0x8038('0x67')]>_0xc94c3[_0xcca4b3][_0x8038('0x6c')]&&_0x45c9f2['min_internal']<=_0xc94c3[_0xcca4b3]['to']){_0x5b278a[_0x8038('0x63')]=_0x45c9f2['min_internal'];}}}if(_['isNil'](_0x5b278a[_0x8038('0x63')])){_0x5b278a['internal']=_0x2c925f+0x1;}return _0x23b8c2(_0x5b278a);});});})[_0x8038('0x51')](function(_0x624091){_0x5111c1(_0x624091);});});}function updateUser(_0x560275){return new BPromise(function(_0x1b1d0a,_0xd2d012){try{if(_0x560275['voicemail']){_0x560275[_0x8038('0x6d')]=_0x560275['internal'];_0x560275[_0x8038('0x6e')]={'mailbox':_0x560275['internal'],'password':_0x560275[_0x8038('0x3c')],'fullname':_0x560275[_0x8038('0x6f')],'email':_0x560275[_0x8038('0x70')]};}if(_0x560275[_0x8038('0x2b')]===_0x8038('0x30')){if(!_0x560275[_0x8038('0x71')])_0x560275[_0x8038('0x71')]=[_0x8038('0x72'),_0x8038('0x73'),_0x8038('0x74'),_0x8038('0x75'),'110',_0x8038('0x76'),'105','106','107','108',_0x8038('0x77'),_0x8038('0x78'),_0x8038('0x79'),_0x8038('0x7a'),_0x8038('0x7b')];}_0x1b1d0a(_0x560275);}catch(_0x2d1cef){_0xd2d012(_0x2d1cef);}});}exports[_0x8038('0x7c')]=function(_0x1cbe1c,_0x42054f){if(_0x1cbe1c[_0x8038('0x2e')]['role']===_0x8038('0x30'))throw new Error(_0x8038('0x7d'));if(_0x1cbe1c[_0x8038('0x5e')]['role']===_0x8038('0x2e')&&_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x7e'));}if(_0x1cbe1c[_0x8038('0x5e')][_0x8038('0x2b')]==='admin'&&_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x7f'));}return licenseUtil[_0x8038('0x80')]([_0x1cbe1c[_0x8038('0x5e')]])['then'](function(){return validateUser(_0x1cbe1c[_0x8038('0x5e')]);})[_0x8038('0x15')](function(_0x2d151c){return updateUser(_0x2d151c)[_0x8038('0x15')](function(_0x292626){if(_0x292626['role']===_0x8038('0x2c')){_0x292626[_0x8038('0x81')]=_0x1cbe1c[_0x8038('0x2e')]['settingsEnabled'];delete _0x292626['userProfileId'];}return _0x292626;});})[_0x8038('0x15')](function(_0x3a87ca){return db['User']['create'](_0x3a87ca,{'include':[{'model':db[_0x8038('0x6e')],'as':_0x8038('0x6e')}]});})[_0x8038('0x15')](function(_0x234f09){if(_0x1cbe1c[_0x8038('0x5e')][_0x8038('0x2b')]===_0x8038('0x2e'))return _0x234f09;if(_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!=='user')return _0x234f09;return db['UserProfileSection']['find']({'where':{'name':_0x234f09[_0x8038('0x2b')]==='agent'?_0x8038('0x2f'):_0x8038('0x31'),'userProfileId':_0x1cbe1c[_0x8038('0x2e')]['userProfileId']},'raw':!![]})[_0x8038('0x15')](function(_0x5deb4b){if(!_0x5deb4b||_0x5deb4b[_0x8038('0x82')]!=0x0)return _0x234f09;return db[_0x8038('0x83')][_0x8038('0x7c')]({'name':_0x234f09[_0x8038('0x37')],'resourceId':_0x234f09['id'],'type':_0x5deb4b[_0x8038('0x37')],'sectionId':_0x5deb4b['id']},{})['then'](function(){return _0x234f09;});})[_0x8038('0x51')](function(_0x2acc1b){logger[_0x8038('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2acc1b);throw _0x2acc1b;});})[_0x8038('0x15')](respondWithResult(_0x42054f,0xc9))[_0x8038('0x51')](handleError(_0x42054f,null));};exports[_0x8038('0x84')]=function(_0x4f1b01,_0x49f87b){var _0x20c19a=_0x4f1b01[_0x8038('0x5e')];var _0x1f3541=[];if(_0x4f1b01[_0x8038('0x2e')][_0x8038('0x2b')]==='agent')throw new Error('Unauthorized');if(_[_0x8038('0x85')](_0x20c19a,[_0x8038('0x2b'),_0x8038('0x2e')])&&_0x4f1b01['user']['role']!==_0x8038('0x2c')){throw new Error(_0x8038('0x7e'));}if(_[_0x8038('0x85')](_0x20c19a,['role',_0x8038('0x2c')])&&_0x4f1b01[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x86'));}return licenseUtil[_0x8038('0x80')](_0x20c19a)[_0x8038('0x15')](function(){return validateUser(_0x20c19a[0x0]);})[_0x8038('0x15')](function(){for(var _0x493e1f=0x1;_0x493e1f<_0x20c19a[_0x8038('0x59')];_0x493e1f++){var _0x42ea15=_0x20c19a[_0x493e1f-0x1][_0x8038('0x63')];if(!_0x20c19a[_0x493e1f][_0x8038('0x63')])_0x20c19a[_0x493e1f][_0x8038('0x63')]=_0x42ea15+0x1;_0x1f3541[_0x8038('0x47')](validateUser(_0x20c19a[_0x493e1f]));}return BPromise['all'](_0x1f3541);})[_0x8038('0x15')](function(){_0x1f3541=[];for(var _0x4ec954=0x0;_0x4ec954<_0x20c19a[_0x8038('0x59')];_0x4ec954++){_0x1f3541['push'](updateUser(_0x20c19a[_0x4ec954]));}return BPromise[_0x8038('0x50')](_0x1f3541);})[_0x8038('0x15')](function(){return BPromise['each'](_0x20c19a,function(_0x19bc4d){return db[_0x8038('0x38')][_0x8038('0x7c')](_0x19bc4d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x8038('0x15')](function(_0x3372cc){_0x19bc4d['id']=_0x3372cc['id'];return _0x19bc4d;});});})['then'](function(_0x59765d){if(_0x4f1b01[_0x8038('0x5e')][_0x8038('0x2b')]==='user')return _0x59765d;if(_0x4f1b01[_0x8038('0x2e')]['role']!==_0x8038('0x2e'))return _0x59765d;var _0x486c77=_['some'](_0x59765d,function(_0x46d5d2){return _0x46d5d2[_0x8038('0x2b')]===_0x8038('0x30')||_0x46d5d2[_0x8038('0x2b')]===_0x8038('0x32');});if(!_0x486c77)return _0x59765d;return db[_0x8038('0x87')][_0x8038('0x48')]({'where':{'name':{'$or':[_0x8038('0x2f'),_0x8038('0x31')]},'userProfileId':_0x4f1b01[_0x8038('0x2e')]['userProfileId']},'raw':!![]})[_0x8038('0x15')](function(_0x4f66d3){if(_[_0x8038('0x88')](_0x4f66d3)||!_['some'](_0x4f66d3,[_0x8038('0x82'),0x0]))return _0x59765d;_0x1f3541=[];var _0x24c1d2=_(_0x4f66d3)[_0x8038('0x34')](function(_0x484fc2){if(_0x484fc2[_0x8038('0x82')]===0x1)return;return _0x484fc2[_0x8038('0x37')]===_0x8038('0x2f')?_0x8038('0x30'):_0x8038('0x32');})[_0x8038('0x89')]()[_0x8038('0x35')]();for(var _0x4b27e0=0x0;_0x4b27e0<_0x59765d[_0x8038('0x59')];_0x4b27e0++){if(!_['includes'](_0x24c1d2,_0x59765d[_0x4b27e0][_0x8038('0x2b')]))return;var _0x461e9a=_0x59765d[_0x4b27e0][_0x8038('0x2b')]===_0x8038('0x30')?_0x8038('0x2f'):'Telephones';_0x1f3541['push'](db[_0x8038('0x83')][_0x8038('0x7c')]({'name':_0x59765d[_0x4b27e0][_0x8038('0x37')],'resourceId':_0x59765d[_0x4b27e0]['id'],'type':_0x461e9a,'sectionId':_[_0x8038('0x5b')](_0x4f66d3,[_0x8038('0x37'),_0x461e9a])['id']},{}));}return BPromise[_0x8038('0x50')](_0x1f3541);});})[_0x8038('0x15')](respondWithResult(_0x49f87b,0xc9))[_0x8038('0x51')](handleError(_0x49f87b,null));};exports[_0x8038('0x8a')]=function(_0x43eaec,_0x5e2d92){if(_0x43eaec[_0x8038('0x5e')]['id']){delete _0x43eaec[_0x8038('0x5e')]['id'];}return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x43eaec[_0x8038('0x52')]['id']}})[_0x8038('0x15')](function(_0x549219){if(!_0x549219)return null;if(_0x549219['id']===_0x43eaec[_0x8038('0x2e')]['id']){if(!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8b')]||!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x8f'));}if(!_0x549219[_0x8038('0x90')](_0x43eaec['body']['oldPassword'])){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x91'));}if(_0x43eaec[_0x8038('0x5e')][_0x8038('0x8b')]===_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x92'));}}else if(_0x43eaec[_0x8038('0x2e')][_0x8038('0x2b')]===_0x8038('0x2c')){if(!_0x43eaec[_0x8038('0x5e')]['newPassword']){throw new db[(_0x8038('0x8d'))]['ValidationError'](_0x8038('0x93'));}}else if(_0x43eaec[_0x8038('0x2e')][_0x8038('0x2b')]===_0x8038('0x2e')){if(!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x93'));}if(_0x549219[_0x8038('0x2b')]!==_0x8038('0x30')){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))]('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0x8038('0x7d'));}return _0x549219;})[_0x8038('0x15')](handleEntityNotFound(_0x5e2d92,null))[_0x8038('0x15')](function(_0x2f54a6){return db[_0x8038('0x64')][_0x8038('0x94')]({'attributes':['id',_0x8038('0x95'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8038('0x15')](function(_0x122da6){if(_0x122da6['securePassword'])authService[_0x8038('0x65')](_0x43eaec['body'][_0x8038('0x8c')]);if(!_0x122da6['enforcePasswordHistory']||!_0x2f54a6[_0x8038('0x96')])return _0x2f54a6;authService[_0x8038('0x97')](_0x43eaec['body'][_0x8038('0x8c')],_0x2f54a6[_0x8038('0x96')],_0x122da6['passwordHistoryLimit']);return _0x2f54a6;})['then'](saveUpdates({'password':_0x43eaec['body'][_0x8038('0x8c')],'passwordResetAt':_0x43eaec[_0x8038('0x2e')]['id']==_0x43eaec[_0x8038('0x52')]['id']?moment():null,'previousPasswords':authService[_0x8038('0x98')](_0x43eaec['body'][_0x8038('0x8c')],_0x2f54a6['previousPasswords'])},null));})[_0x8038('0x15')](respondWithResult(_0x5e2d92,null))[_0x8038('0x51')](handleError(_0x5e2d92,null));};exports[_0x8038('0x99')]=function(_0x25f89c,_0x1870ee){var _0x505881=_0x25f89c[_0x8038('0x5e')][_0x8038('0x9a')];return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x25f89c[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b'),'online',_0x8038('0x9b'),'voicePause',_0x8038('0x9c')]})[_0x8038('0x15')](handleEntityNotFound(_0x1870ee,null))[_0x8038('0x15')](function(_0x5e20a2){if(_0x5e20a2){if(!utils['isValidChannel'](_0x505881)){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x9d'));}return _0x5e20a2[_0x8038('0x9e')+_[_0x8038('0x9f')](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa1')](_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')],{'penalty':_0x25f89c[_0x8038('0x5e')]['penalty']||0x0})['spread'](function(_0x33b5b3){for(var _0x84a009=0x0;_0x84a009<_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')][_0x8038('0x59')];_0x84a009+=0x1){var _0x2aa74b={'UserId':Number(_0x25f89c['params']['id'])};_0x2aa74b[_['capitalize'](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa2')]=Number(_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')][_0x84a009]);socket[_0x8038('0x28')](_0x8038('0x2e')+_[_0x8038('0x9f')](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa3'),_0x2aa74b);}return _0x33b5b3;})['then'](function(){if(_0x505881===_0x8038('0xa4')){return db[_0x8038('0xa5')][_0x8038('0x48')]({'where':{'id':_0x25f89c[_0x8038('0x5e')]['ids']||[]},'raw':!![],'attributes':['id',_0x8038('0x37')]});}})[_0x8038('0x15')](function(_0x367e9c){var _0x4c4c63=_0x5e20a2[_0x8038('0x2a')]({'plain':!![]});var _0x55f59f=[];if(_0x505881===_0x8038('0xa4')&&_0x4c4c63[_0x8038('0x2b')]===_0x8038('0x30')&&_0x4c4c63[_0x8038('0xa6')]){for(var _0x8722d2=0x0;_0x8722d2<_0x367e9c['length'];_0x8722d2+=0x1){_0x55f59f[_0x8038('0x47')]({'membername':_0x4c4c63['name'],'UserId':_0x4c4c63['id'],'queue_name':_0x367e9c[_0x8722d2][_0x8038('0x37')],'VoiceQueueId':_0x367e9c[_0x8722d2]['id'],'interface':_['isNil'](_0x4c4c63[_0x8038('0x9c')])?util[_0x8038('0xa7')](_0x8038('0xa8'),_0x4c4c63[_0x8038('0x37')]):_0x4c4c63[_0x8038('0x9c')],'paused':_0x4c4c63[_0x8038('0xa9')]||![],'penalty':_0x25f89c[_0x8038('0x5e')]['penalty']||0x0});}return BPromise[_0x8038('0xaa')](_0x55f59f,function(_0x2189ee){return db['UserVoiceQueueRt']['upsert'](_0x2189ee);});}return _0x5e20a2;});}})[_0x8038('0x15')](respondWithStatusCode(_0x1870ee,null))[_0x8038('0x51')](handleError(_0x1870ee,null));};exports[_0x8038('0xab')]=function(_0x5b73f9,_0x24c63a){var _0x31df5c,_0xa4bc85;return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x5b73f9[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b')]})['then'](handleEntityNotFound(_0x24c63a,null))[_0x8038('0x15')](function(_0x5909b1){if(_0x5909b1){_0x31df5c=_0x5909b1;if(!_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]||!utils['isValidChannel'](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')])){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x9d'));}return _0x5909b1[_0x8038('0xac')+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')][_0x8038('0xa0')]())+_0x8038('0xa1')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x61')]);}})['then'](function(_0x44dfac){if(_[_0x8038('0xad')](_0x5b73f9[_0x8038('0x40')]['ids'])){for(var _0x12f82d=0x0;_0x12f82d<_0x5b73f9['query'][_0x8038('0x61')][_0x8038('0x59')];_0x12f82d+=0x1){_0xa4bc85={'UserId':Number(_0x5b73f9['params']['id'])};_0xa4bc85[_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')]['channel']['toLowerCase']())+_0x8038('0xa2')]=Number(_0x5b73f9[_0x8038('0x40')]['ids'][_0x12f82d]);socket[_0x8038('0x28')]('user'+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]['toLowerCase']())+_0x8038('0xae'),_0xa4bc85);}}else{_0xa4bc85={'UserId':Number(_0x5b73f9[_0x8038('0x52')]['id'])};_0xa4bc85[_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]['toLowerCase']())+_0x8038('0xa2')]=Number(_0x5b73f9['query'][_0x8038('0x61')]);socket[_0x8038('0x28')](_0x8038('0x2e')+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')]['channel'][_0x8038('0xa0')]())+_0x8038('0xae'),_0xa4bc85);}return _0x44dfac;})[_0x8038('0x15')](function(){if(_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]===_0x8038('0xa4')){return db['UserVoiceQueueRt'][_0x8038('0xaf')]({'where':{'UserId':_0x5b73f9[_0x8038('0x52')]['id'],'VoiceQueueId':_0x5b73f9[_0x8038('0x40')]['ids']},'individualHooks':!![]})['then'](function(){return _0x31df5c;});}return _0x31df5c;})[_0x8038('0x15')](respondWithStatusCode(_0x24c63a,null))[_0x8038('0x51')](handleError(_0x24c63a,null));};exports['addAvatar']=function(_0x40c940,_0x3fa3de){_0x40c940[_0x8038('0x5e')][_0x8038('0xb0')]=_0x40c940['file'][_0x8038('0xb1')];return db['User']['find']({'where':{'id':_0x40c940['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3fa3de,null))['then'](saveUpdates(_0x40c940[_0x8038('0x5e')],null))[_0x8038('0x15')](respondWithResult(_0x3fa3de,null))['catch'](handleError(_0x3fa3de,null));};exports['getAvatar']=function(_0x54449d,_0x371b1d){var _0x5abc43=path[_0x8038('0xb2')](config[_0x8038('0xb3')],_0x8038('0xb4'));return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x54449d['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8038('0x15')](handleEntityNotFound(_0x371b1d,null))[_0x8038('0x15')](function(_0x47b40e){if(_0x47b40e){if(_[_0x8038('0x68')](_0x47b40e[_0x8038('0xb0')])){return _0x371b1d[_0x8038('0xb5')](_0x5abc43);}else{if(!fs['existsSync'](path['join'](config[_0x8038('0xb3')],_0x8038('0xb6'),_0x47b40e['userpic']))){return _0x371b1d[_0x8038('0xb5')](_0x5abc43);}return _0x371b1d[_0x8038('0xb5')](path[_0x8038('0xb2')](config[_0x8038('0xb3')],_0x8038('0xb6'),_0x47b40e[_0x8038('0xb0')]));}}})['catch'](handleError(_0x371b1d,null));};exports[_0x8038('0xb7')]=function(_0x57cb8f,_0x5e3ad5){return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x57cb8f[_0x8038('0x52')]['id']},'attributes':['id']})[_0x8038('0x15')](handleEntityNotFound(_0x5e3ad5,null))['then'](function(_0x587973){var _0xfb43fc=[];values=_0x587973['dataValues'];_0xfb43fc[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs('sms',_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs('openchannel',_0x587973['dataValues']));_0xfb43fc['push'](get_open_tabs(_0x8038('0x4f'),_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x587973[_0x8038('0x4b')]));_0xfb43fc['push'](get_open_tabs(_0x8038('0x4d'),_0x587973['dataValues']));return BPromise['all'](_0xfb43fc);})[_0x8038('0x15')](function(_0x37e267){if(_0x37e267){var _0x1d7269=_['map'](values[_0x8038('0xb8')],function(_0x5f1fe4){return{'channel':_0x8038('0xb9'),'id':_0x5f1fe4['id'],'createdAt':_0x5f1fe4['createdAt']};});var _0x100987=_[_0x8038('0x34')](values[_0x8038('0xba')],function(_0xc184fa){return{'channel':_0x8038('0xbb'),'id':_0xc184fa['id'],'createdAt':_0xc184fa[_0x8038('0xbc')]};});var _0x5acd85=_['map'](values[_0x8038('0xbd')],function(_0xb870ce){return{'channel':_0x8038('0xbe'),'id':_0xb870ce['id'],'createdAt':_0xb870ce[_0x8038('0xbc')]};});var _0x159fc9=_[_0x8038('0x34')](values['MailOpenTabs'],function(_0xad0af3){return{'channel':_0x8038('0xbf'),'id':_0xad0af3['id'],'createdAt':_0xad0af3[_0x8038('0xbc')]};});var _0x521cb8=_[_0x8038('0x34')](values[_0x8038('0xc0')],function(_0x63df1b){return{'channel':_0x8038('0xc1'),'id':_0x63df1b['id'],'createdAt':_0x63df1b[_0x8038('0xbc')]};});var _0x516b09=_[_0x8038('0x34')](values[_0x8038('0xc2')],function(_0x52e631){return{'channel':_0x8038('0xc3'),'id':_0x52e631['id'],'createdAt':_0x52e631[_0x8038('0xbc')]};});var _0x75888e=_[_0x8038('0xc4')](_0x1d7269,_0x100987,_0x5acd85,_0x159fc9,_0x521cb8,_0x516b09);var _0xaf605a={'count':_0x75888e[_0x8038('0x59')],'rows':_0x75888e};return _0xaf605a;}else return null;})[_0x8038('0x15')](respondWithResult(_0x5e3ad5,null))[_0x8038('0x51')](handleError(_0x5e3ad5,null));};exports[_0x8038('0xc5')]=function(_0x2ab24a,_0x45eb3f){var _0x11e982={};var _0x2f1747={};var _0x5a64c6;var _0x197cb7;return db['User'][_0x8038('0x94')]({'where':{'id':_0x2ab24a[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x45eb3f,null))[_0x8038('0x15')](function(_0x371205){if(_0x371205){_0x5a64c6=_0x371205;_0x2f1747['model']=_['keys'](db['CmContact'][_0x8038('0x55')]);_0x2f1747[_0x8038('0x40')]=_[_0x8038('0x54')](_0x2ab24a[_0x8038('0x40')]);_0x2f1747[_0x8038('0x56')]=_['intersection'](_0x2f1747[_0x8038('0x53')],_0x2f1747[_0x8038('0x40')]);_0x11e982[_0x8038('0x46')]=_[_0x8038('0x57')](_0x2f1747[_0x8038('0x53')],qs[_0x8038('0x58')](_0x2ab24a[_0x8038('0x40')][_0x8038('0x58')]));_0x11e982[_0x8038('0x46')]=_0x11e982[_0x8038('0x46')][_0x8038('0x59')]?_0x11e982[_0x8038('0x46')]:_0x2f1747['model'];_0x11e982['order']=qs[_0x8038('0xc6')](_0x2ab24a['query'][_0x8038('0xc6')]);_0x11e982[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x2ab24a[_0x8038('0x40')],_0x2f1747[_0x8038('0x56')]));if(_0x2ab24a['query'][_0x8038('0x3b')]){_0x11e982['where']=_[_0x8038('0xc8')](_0x11e982[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x11e982['attributes'],function(_0x32a5bc){var _0x5d6b7a={};_0x5d6b7a[_0x32a5bc]={'$like':'%'+_0x2ab24a[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x5d6b7a;})});}_0x11e982=_['merge']({},_0x11e982,_0x2ab24a[_0x8038('0x5a')]);return _0x5a64c6['getContacts'](_0x11e982);}})['then'](function(_0x30695a){if(_0x30695a){_0x197cb7=_0x30695a[_0x8038('0x59')];if(_0x2ab24a[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0x41'))){_0x11e982[_0x8038('0x42')]=[{'model':db[_0x8038('0xca')],'as':'List','required':![]},{'model':db[_0x8038('0xcb')],'as':'Tags','attributes':['id',_0x8038('0x37'),'color'],'where':_0x2ab24a[_0x8038('0x40')]['tag']?{'id':_0x2ab24a[_0x8038('0x40')][_0x8038('0xcc')]}:undefined,'required':_0x2ab24a[_0x8038('0x40')][_0x8038('0xcc')]?!![]:![]}];}if(!_0x2ab24a[_0x8038('0x40')]['hasOwnProperty'](_0x8038('0xcd'))){_0x11e982[_0x8038('0xce')]=qs['limit'](_0x2ab24a[_0x8038('0x40')][_0x8038('0xce')]);_0x11e982[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x2ab24a['query'][_0x8038('0x21')]);}return _0x5a64c6[_0x8038('0xc5')](_0x11e982);}})[_0x8038('0x15')](function(_0x16b147){if(_0x16b147){return _0x16b147?{'count':_0x197cb7,'rows':_0x16b147}:null;}})[_0x8038('0x15')](respondWithResult(_0x45eb3f,null))['catch'](handleError(_0x45eb3f,null));};exports[_0x8038('0xcf')]=function(_0x49eb64,_0x538c07){var _0x569ac9;var _0xbd0ca1={};var _0x453f74;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x49eb64[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b')]})[_0x8038('0x15')](handleEntityNotFound(_0x538c07,null))[_0x8038('0x15')](function(_0x1067d4){if(!utils[_0x8038('0xd0')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x9d'));}_0x569ac9=_0x1067d4;var _0x4ed741={};_0x4ed741[_0x8038('0x53')]=_[_0x8038('0x54')](db[_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+'Queue'][_0x8038('0x55')]);_0x4ed741[_0x8038('0x40')]=_[_0x8038('0x54')](_0x49eb64['query']);_0x4ed741[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4ed741['model'],_0x4ed741['query']);_0xbd0ca1[_0x8038('0x46')]=_[_0x8038('0x57')](_0x4ed741[_0x8038('0x53')],qs[_0x8038('0x58')](_0x49eb64[_0x8038('0x40')][_0x8038('0x58')]));_0xbd0ca1[_0x8038('0x46')]=_0xbd0ca1[_0x8038('0x46')][_0x8038('0x59')]?_0xbd0ca1[_0x8038('0x46')]:_0x4ed741[_0x8038('0x53')];_0xbd0ca1[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x49eb64[_0x8038('0x40')]['sort']);_0xbd0ca1[_0x8038('0x3f')]=qs['filters'](_[_0x8038('0xc7')](_0x49eb64['query'],_0x4ed741[_0x8038('0x56')]));if(_0x49eb64[_0x8038('0x40')][_0x8038('0x3b')]){_0xbd0ca1[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0xbd0ca1[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0xbd0ca1['attributes'],function(_0x119785){var _0x963ab9={};_0x963ab9[_0x119785]={'$like':'%'+_0x49eb64['query'][_0x8038('0x3b')]+'%'};return _0x963ab9;})});}_0xbd0ca1=_[_0x8038('0xc8')]({},_0xbd0ca1,_0x49eb64[_0x8038('0x5a')]);switch(_0x569ac9[_0x8038('0x2b')]){case _0x8038('0x2c'):return db[_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xd2')][_0x8038('0x48')](_0xbd0ca1);case _0x8038('0x2e'):case _0x8038('0x30'):return _0x569ac9[_0x8038('0x2a')+_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xa1')](_0xbd0ca1);default:throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0xd3'));}})[_0x8038('0x15')](function(_0x129cfd){_0x453f74=_0x129cfd['length'];if(!_0x49eb64[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0xbd0ca1[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x49eb64['query'][_0x8038('0xce')]);_0xbd0ca1[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x49eb64[_0x8038('0x40')]['offset']);}switch(_0x569ac9[_0x8038('0x2b')]){case'admin':return db[_['capitalize'](_0x49eb64['query']['channel'])+'Queue'][_0x8038('0x48')](_0xbd0ca1);case _0x8038('0x2e'):case _0x8038('0x30'):return _0x569ac9[_0x8038('0x2a')+_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xa1')](_0xbd0ca1);}})[_0x8038('0x15')](function(_0x32221d){return{'count':_0x453f74,'rows':_0x32221d};})[_0x8038('0x15')](respondWithResult(_0x538c07,null))[_0x8038('0x51')](handleError(_0x538c07,null));};exports[_0x8038('0xd4')]=function(_0x5a28d5,_0x20b3fa){var _0x4f9428={};var _0x60065a={};var _0x2c3abc;var _0x5bf168;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5a28d5['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x20b3fa,null))['then'](function(_0x2fa4e3){if(_0x2fa4e3){_0x2c3abc=_0x2fa4e3;_0x60065a['model']=_[_0x8038('0x54')](db[_0x8038('0xd5')][_0x8038('0x55')]);_0x60065a[_0x8038('0x40')]=_[_0x8038('0x54')](_0x5a28d5[_0x8038('0x40')]);_0x60065a[_0x8038('0x56')]=_[_0x8038('0x57')](_0x60065a[_0x8038('0x53')],_0x60065a['query']);_0x4f9428[_0x8038('0x46')]=_[_0x8038('0x57')](_0x60065a[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5a28d5[_0x8038('0x40')][_0x8038('0x58')]));_0x4f9428['attributes']=_0x4f9428[_0x8038('0x46')]['length']?_0x4f9428[_0x8038('0x46')]:_0x60065a[_0x8038('0x53')];_0x4f9428[_0x8038('0xd1')]=qs['sort'](_0x5a28d5['query'][_0x8038('0xc6')]);_0x4f9428['where']=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x5a28d5[_0x8038('0x40')],_0x60065a[_0x8038('0x56')]));if(_0x5a28d5[_0x8038('0x40')][_0x8038('0x3b')]){_0x4f9428['where']=_[_0x8038('0xc8')](_0x4f9428[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x4f9428['attributes'],function(_0x3d77a9){var _0x3e8321={};_0x3e8321[_0x3d77a9]={'$like':'%'+_0x5a28d5[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x3e8321;})});}_0x4f9428=_[_0x8038('0xc8')]({},_0x4f9428,_0x5a28d5[_0x8038('0x5a')]);return _0x2c3abc[_0x8038('0xd4')](_0x4f9428);}})['then'](function(_0x35be5b){if(_0x35be5b){_0x5bf168=_0x35be5b[_0x8038('0x59')];if(!_0x5a28d5['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x4f9428['limit']=qs[_0x8038('0xce')](_0x5a28d5[_0x8038('0x40')][_0x8038('0xce')]);_0x4f9428[_0x8038('0x21')]=qs['offset'](_0x5a28d5[_0x8038('0x40')][_0x8038('0x21')]);}return _0x2c3abc[_0x8038('0xd4')](_0x4f9428);}})[_0x8038('0x15')](function(_0x509a23){if(_0x509a23){return _0x509a23?{'count':_0x5bf168,'rows':_0x509a23}:null;}})[_0x8038('0x15')](respondWithResult(_0x20b3fa,null))[_0x8038('0x51')](handleError(_0x20b3fa,null));};exports['getGroups']=function(_0x5af39c,_0x20f054){var _0x25bca2={};var _0x21fa79={};var _0x5c5953;var _0x426e8d;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5af39c['params']['id']}})['then'](handleEntityNotFound(_0x20f054,null))[_0x8038('0x15')](function(_0x27ecf5){if(_0x27ecf5){_0x5c5953=_0x27ecf5;_0x21fa79[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xd6')][_0x8038('0x55')]);_0x21fa79['query']=_['keys'](_0x5af39c[_0x8038('0x40')]);_0x21fa79[_0x8038('0x56')]=_['intersection'](_0x21fa79[_0x8038('0x53')],_0x21fa79[_0x8038('0x40')]);_0x25bca2[_0x8038('0x46')]=_[_0x8038('0x57')](_0x21fa79[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5af39c[_0x8038('0x40')][_0x8038('0x58')]));_0x25bca2[_0x8038('0x46')]=_0x25bca2['attributes']['length']?_0x25bca2[_0x8038('0x46')]:_0x21fa79[_0x8038('0x53')];_0x25bca2[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x5af39c[_0x8038('0x40')][_0x8038('0xc6')]);_0x25bca2[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x5af39c[_0x8038('0x40')],_0x21fa79[_0x8038('0x56')]));if(_0x5af39c[_0x8038('0x40')]['filter']){_0x25bca2[_0x8038('0x3f')]=_['merge'](_0x25bca2[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x25bca2[_0x8038('0x46')],function(_0x195338){var _0x153041={};_0x153041[_0x195338]={'$like':'%'+_0x5af39c[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x153041;})});}_0x25bca2=_[_0x8038('0xc8')]({},_0x25bca2,_0x5af39c[_0x8038('0x5a')]);return _0x5c5953['getGroups'](_0x25bca2);}})['then'](function(_0x3a73d9){if(_0x3a73d9){_0x426e8d=_0x3a73d9[_0x8038('0x59')];if(!_0x5af39c['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x25bca2[_0x8038('0xce')]=qs['limit'](_0x5af39c['query'][_0x8038('0xce')]);_0x25bca2[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5af39c[_0x8038('0x40')][_0x8038('0x21')]);}return _0x5c5953['getGroups'](_0x25bca2);}})[_0x8038('0x15')](function(_0x18ae5e){if(_0x18ae5e){return _0x18ae5e?{'count':_0x426e8d,'rows':_0x18ae5e}:null;}})[_0x8038('0x15')](respondWithResult(_0x20f054,null))['catch'](handleError(_0x20f054,null));};exports[_0x8038('0xd7')]=function(_0x4c49bf,_0xb50ebf){var _0x1132a2={'raw':!![],'where':{}};var _0x685354={};var _0x357b79={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x4c49bf[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0xb50ebf,null))[_0x8038('0x15')](function(_0x50f328){if(_0x50f328){_0x685354[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xd8')]['rawAttributes']);_0x685354[_0x8038('0x40')]=_[_0x8038('0x54')](_0x4c49bf['query']);_0x685354[_0x8038('0x56')]=_[_0x8038('0x57')](_0x685354['model'],_0x685354['query']);_0x1132a2[_0x8038('0x46')]=_[_0x8038('0x57')](_0x685354[_0x8038('0x53')],qs['fields'](_0x4c49bf[_0x8038('0x40')][_0x8038('0x58')]));_0x1132a2[_0x8038('0x46')]=_0x1132a2['attributes'][_0x8038('0x59')]?_0x1132a2[_0x8038('0x46')]:_0x685354[_0x8038('0x53')];if(!_0x4c49bf['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x1132a2[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x4c49bf['query'][_0x8038('0xce')]);_0x1132a2['offset']=qs['offset'](_0x4c49bf['query']['offset']);}_0x1132a2[_0x8038('0xd1')]=qs['sort'](_0x4c49bf[_0x8038('0x40')][_0x8038('0xc6')]);_0x1132a2[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x4c49bf[_0x8038('0x40')],_0x685354[_0x8038('0x56')]));_0x1132a2['where'][_0x8038('0xd9')]=_0x50f328['id'];if(_0x4c49bf['query'][_0x8038('0x3b')]){_0x1132a2[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x1132a2[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x1132a2[_0x8038('0x46')],function(_0x146105){var _0x367ee2={};_0x367ee2[_0x146105]={'$like':'%'+_0x4c49bf[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x367ee2;})});}_0x1132a2=_[_0x8038('0xc8')]({},_0x1132a2,_0x4c49bf[_0x8038('0x5a')]);return db['VoiceRecording'][_0x8038('0x23')]({'where':_0x1132a2[_0x8038('0x3f')]})[_0x8038('0x15')](function(_0x3ecd05){_0x357b79[_0x8038('0x23')]=_0x3ecd05;if(_0x4c49bf[_0x8038('0x40')]['includeAll']){_0x1132a2[_0x8038('0x42')]=[{'all':!![]}];}return db[_0x8038('0xd8')][_0x8038('0x48')](_0x1132a2);})['then'](function(_0x32772c){_0x357b79['rows']=_0x32772c;return _0x357b79;});}})[_0x8038('0x15')](respondWithFilteredResult(_0xb50ebf,_0x1132a2))[_0x8038('0x51')](handleError(_0xb50ebf,null));};exports['getScreenRecordings']=function(_0xf1f60a,_0x4ead3a){var _0xd193ca={'raw':!![],'where':{}};var _0x932954={};var _0x38b18e={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0xf1f60a[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x4ead3a,null))[_0x8038('0x15')](function(_0x3f0204){if(_0x3f0204){_0x932954[_0x8038('0x53')]=_['keys'](db[_0x8038('0xda')][_0x8038('0x55')]);_0x932954[_0x8038('0x40')]=_[_0x8038('0x54')](_0xf1f60a[_0x8038('0x40')]);_0x932954[_0x8038('0x56')]=_[_0x8038('0x57')](_0x932954[_0x8038('0x53')],_0x932954[_0x8038('0x40')]);_0xd193ca['attributes']=_[_0x8038('0x57')](_0x932954[_0x8038('0x53')],qs['fields'](_0xf1f60a[_0x8038('0x40')][_0x8038('0x58')]));_0xd193ca['attributes']=_0xd193ca[_0x8038('0x46')][_0x8038('0x59')]?_0xd193ca[_0x8038('0x46')]:_0x932954[_0x8038('0x53')];if(!_0xf1f60a[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0xd193ca[_0x8038('0xce')]=qs[_0x8038('0xce')](_0xf1f60a[_0x8038('0x40')][_0x8038('0xce')]);_0xd193ca[_0x8038('0x21')]=qs[_0x8038('0x21')](_0xf1f60a[_0x8038('0x40')][_0x8038('0x21')]);}_0xd193ca[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0xf1f60a['query']['sort']);_0xd193ca[_0x8038('0x3f')]=qs['filters'](_['pick'](_0xf1f60a['query'],_0x932954['filters']));_0xd193ca[_0x8038('0x3f')][_0x8038('0xd9')]=_0x3f0204['id'];if(_0xf1f60a[_0x8038('0x40')][_0x8038('0x3b')]){_0xd193ca['where']=_[_0x8038('0xc8')](_0xd193ca['where'],{'$or':_[_0x8038('0x34')](_0xd193ca[_0x8038('0x46')],function(_0x3fc539){var _0x48ee04={};_0x48ee04[_0x3fc539]={'$like':'%'+_0xf1f60a['query'][_0x8038('0x3b')]+'%'};return _0x48ee04;})});}_0xd193ca=_[_0x8038('0xc8')]({},_0xd193ca,_0xf1f60a[_0x8038('0x5a')]);return db[_0x8038('0xda')][_0x8038('0x23')]({'where':_0xd193ca['where']})[_0x8038('0x15')](function(_0x2e3a82){_0x38b18e['count']=_0x2e3a82;if(_0xf1f60a[_0x8038('0x40')][_0x8038('0x41')]){_0xd193ca['include']=[{'all':!![]}];}return db[_0x8038('0xda')]['findAll'](_0xd193ca);})[_0x8038('0x15')](function(_0x2c3801){_0x38b18e[_0x8038('0x49')]=_0x2c3801;return _0x38b18e;});}})[_0x8038('0x15')](respondWithFilteredResult(_0x4ead3a,_0xd193ca))[_0x8038('0x51')](handleError(_0x4ead3a,null));};exports['getChatInteractions']=function(_0x41a415,_0x3ac2bc){var _0x39d65b={};var _0x16548d={};var _0x52d0e6;var _0x151a9c;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x41a415[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3ac2bc,null))['then'](function(_0x5894c3){if(_0x5894c3){_0x52d0e6=_0x5894c3;_0x16548d[_0x8038('0x53')]=_['keys'](db[_0x8038('0xdb')][_0x8038('0x55')]);_0x16548d['query']=_['keys'](_0x41a415['query']);_0x16548d['filters']=_['intersection'](_0x16548d[_0x8038('0x53')],_0x16548d[_0x8038('0x40')]);_0x39d65b[_0x8038('0x46')]=_[_0x8038('0x57')](_0x16548d[_0x8038('0x53')],qs[_0x8038('0x58')](_0x41a415['query']['fields']));_0x39d65b[_0x8038('0x46')]=_0x39d65b[_0x8038('0x46')][_0x8038('0x59')]?_0x39d65b[_0x8038('0x46')]:_0x16548d[_0x8038('0x53')];_0x39d65b[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x41a415[_0x8038('0x40')][_0x8038('0xc6')]);_0x39d65b[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x41a415[_0x8038('0x40')],_0x16548d[_0x8038('0x56')]));if(_0x41a415[_0x8038('0x40')][_0x8038('0x3b')]){_0x39d65b['where']=_[_0x8038('0xc8')](_0x39d65b['where'],{'$or':_[_0x8038('0x34')](_0x39d65b[_0x8038('0x46')],function(_0x19d19b){var _0x2fb172={};_0x2fb172[_0x19d19b]={'$like':'%'+_0x41a415[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x2fb172;})});}_0x39d65b=_['merge']({},_0x39d65b,_0x41a415['options']);return _0x52d0e6['getChatInteractions'](_0x39d65b);}})[_0x8038('0x15')](function(_0x2b1212){if(_0x2b1212){_0x151a9c=_0x2b1212[_0x8038('0x59')];if(!_0x41a415[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x39d65b[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x41a415[_0x8038('0x40')]['limit']);_0x39d65b['offset']=qs[_0x8038('0x21')](_0x41a415['query'][_0x8038('0x21')]);}return _0x52d0e6['getChatInteractions'](_0x39d65b);}})[_0x8038('0x15')](function(_0x1e3650){if(_0x1e3650){return _0x1e3650?{'count':_0x151a9c,'rows':_0x1e3650}:null;}})[_0x8038('0x15')](respondWithResult(_0x3ac2bc,null))[_0x8038('0x51')](handleError(_0x3ac2bc,null));};exports['getOpenchannelInteractions']=function(_0x280740,_0x310154){var _0x387766={};var _0x11715c={};var _0x3befb7;var _0x1c5314;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x280740['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x310154,null))[_0x8038('0x15')](function(_0x2235ad){if(_0x2235ad){_0x3befb7=_0x2235ad;_0x11715c[_0x8038('0x53')]=_[_0x8038('0x54')](db['OpenchannelInteraction'][_0x8038('0x55')]);_0x11715c[_0x8038('0x40')]=_[_0x8038('0x54')](_0x280740[_0x8038('0x40')]);_0x11715c[_0x8038('0x56')]=_[_0x8038('0x57')](_0x11715c[_0x8038('0x53')],_0x11715c[_0x8038('0x40')]);_0x387766['attributes']=_[_0x8038('0x57')](_0x11715c[_0x8038('0x53')],qs[_0x8038('0x58')](_0x280740[_0x8038('0x40')]['fields']));_0x387766[_0x8038('0x46')]=_0x387766[_0x8038('0x46')][_0x8038('0x59')]?_0x387766[_0x8038('0x46')]:_0x11715c[_0x8038('0x53')];_0x387766[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x280740['query'][_0x8038('0xc6')]);_0x387766[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x280740[_0x8038('0x40')],_0x11715c[_0x8038('0x56')]));if(_0x280740[_0x8038('0x40')]['filter']){_0x387766[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x387766['where'],{'$or':_[_0x8038('0x34')](_0x387766['attributes'],function(_0x21662d){var _0x5a14ae={};_0x5a14ae[_0x21662d]={'$like':'%'+_0x280740[_0x8038('0x40')]['filter']+'%'};return _0x5a14ae;})});}_0x387766=_[_0x8038('0xc8')]({},_0x387766,_0x280740['options']);return _0x3befb7['getOpenchannelInteractions'](_0x387766);}})[_0x8038('0x15')](function(_0x1d527a){if(_0x1d527a){_0x1c5314=_0x1d527a[_0x8038('0x59')];if(!_0x280740[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x387766[_0x8038('0xce')]=qs['limit'](_0x280740[_0x8038('0x40')]['limit']);_0x387766['offset']=qs[_0x8038('0x21')](_0x280740[_0x8038('0x40')]['offset']);}return _0x3befb7[_0x8038('0xdc')](_0x387766);}})[_0x8038('0x15')](function(_0x3e67f0){if(_0x3e67f0){return _0x3e67f0?{'count':_0x1c5314,'rows':_0x3e67f0}:null;}})['then'](respondWithResult(_0x310154,null))[_0x8038('0x51')](handleError(_0x310154,null));};exports[_0x8038('0xdd')]=function(_0x5baf03,_0x53fb8e){var _0x2678eb={'raw':!![],'where':{}};var _0x4448c5={};var _0x5c02f5={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5baf03[_0x8038('0x52')]['id']}})['then'](handleEntityNotFound(_0x53fb8e,null))['then'](function(_0x1d522f){if(_0x1d522f){_0x4448c5[_0x8038('0x53')]=_['keys'](db[_0x8038('0xde')]['rawAttributes']);_0x4448c5[_0x8038('0x40')]=_['keys'](_0x5baf03[_0x8038('0x40')]);_0x4448c5[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4448c5['model'],_0x4448c5['query']);_0x2678eb[_0x8038('0x46')]=_[_0x8038('0x57')](_0x4448c5[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5baf03[_0x8038('0x40')]['fields']));_0x2678eb['attributes']=_0x2678eb['attributes']['length']?_0x2678eb[_0x8038('0x46')]:_0x4448c5[_0x8038('0x53')];if(!_0x5baf03[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x2678eb[_0x8038('0xce')]=qs['limit'](_0x5baf03['query'][_0x8038('0xce')]);_0x2678eb[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5baf03[_0x8038('0x40')]['offset']);}_0x2678eb[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x5baf03[_0x8038('0x40')][_0x8038('0xc6')]);_0x2678eb[_0x8038('0x3f')]=qs[_0x8038('0x56')](_['pick'](_0x5baf03[_0x8038('0x40')],_0x4448c5[_0x8038('0x56')]));_0x2678eb['where']['UserId']=_0x1d522f['id'];if(_0x5baf03[_0x8038('0x40')][_0x8038('0x3b')]){_0x2678eb[_0x8038('0x3f')]=_['merge'](_0x2678eb['where'],{'$or':_[_0x8038('0x34')](_0x2678eb[_0x8038('0x46')],function(_0xe16d6d){var _0x1b039e={};_0x1b039e[_0xe16d6d]={'$like':'%'+_0x5baf03['query'][_0x8038('0x3b')]+'%'};return _0x1b039e;})});}_0x2678eb=_[_0x8038('0xc8')]({},_0x2678eb,_0x5baf03[_0x8038('0x5a')]);return db[_0x8038('0xde')][_0x8038('0x23')]({'where':_0x2678eb[_0x8038('0x3f')]})[_0x8038('0x15')](function(_0x1277fa){_0x5c02f5['count']=_0x1277fa;if(_0x5baf03[_0x8038('0x40')][_0x8038('0x41')]){_0x2678eb['include']=[{'all':!![]}];}return db[_0x8038('0xde')][_0x8038('0x48')](_0x2678eb);})[_0x8038('0x15')](function(_0x7bcc95){_0x5c02f5[_0x8038('0x49')]=_0x7bcc95;return _0x5c02f5;});}})[_0x8038('0x15')](respondWithFilteredResult(_0x53fb8e,_0x2678eb))[_0x8038('0x51')](handleError(_0x53fb8e,null));};exports[_0x8038('0xdf')]=function(_0x5496b6,_0x3e03bb){var _0x34ba80={};var _0xdf243d={};var _0x1f248;var _0x3412b8;return db['User'][_0x8038('0x94')]({'where':{'id':_0x5496b6[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3e03bb,null))[_0x8038('0x15')](function(_0x399cae){if(_0x399cae){_0x1f248=_0x399cae;_0xdf243d[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe0')]['rawAttributes']);_0xdf243d[_0x8038('0x40')]=_[_0x8038('0x54')](_0x5496b6[_0x8038('0x40')]);_0xdf243d[_0x8038('0x56')]=_[_0x8038('0x57')](_0xdf243d['model'],_0xdf243d[_0x8038('0x40')]);_0x34ba80[_0x8038('0x46')]=_[_0x8038('0x57')](_0xdf243d[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5496b6[_0x8038('0x40')][_0x8038('0x58')]));_0x34ba80['attributes']=_0x34ba80[_0x8038('0x46')]['length']?_0x34ba80['attributes']:_0xdf243d[_0x8038('0x53')];_0x34ba80[_0x8038('0xd1')]=qs['sort'](_0x5496b6['query'][_0x8038('0xc6')]);_0x34ba80['where']=qs[_0x8038('0x56')](_['pick'](_0x5496b6['query'],_0xdf243d['filters']));if(_0x5496b6[_0x8038('0x40')][_0x8038('0x3b')]){_0x34ba80[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x34ba80['where'],{'$or':_[_0x8038('0x34')](_0x34ba80[_0x8038('0x46')],function(_0x5c8ada){var _0x5edafb={};_0x5edafb[_0x5c8ada]={'$like':'%'+_0x5496b6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x5edafb;})});}_0x34ba80=_['merge']({},_0x34ba80,_0x5496b6['options']);return _0x1f248['getSmsInteractions'](_0x34ba80);}})[_0x8038('0x15')](function(_0x368f33){if(_0x368f33){_0x3412b8=_0x368f33[_0x8038('0x59')];if(!_0x5496b6[_0x8038('0x40')]['hasOwnProperty'](_0x8038('0xcd'))){_0x34ba80[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x5496b6[_0x8038('0x40')][_0x8038('0xce')]);_0x34ba80[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5496b6['query']['offset']);}return _0x1f248[_0x8038('0xdf')](_0x34ba80);}})[_0x8038('0x15')](function(_0x12b440){if(_0x12b440){return _0x12b440?{'count':_0x3412b8,'rows':_0x12b440}:null;}})['then'](respondWithResult(_0x3e03bb,null))[_0x8038('0x51')](handleError(_0x3e03bb,null));};exports[_0x8038('0xe1')]=function(_0x31d1b9,_0x538a12){var _0x1b6ad3={};var _0x186e89={};var _0x40b001;var _0x2f937f;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x31d1b9[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x538a12,null))[_0x8038('0x15')](function(_0x273890){if(_0x273890){_0x40b001=_0x273890;_0x186e89[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe2')][_0x8038('0x55')]);_0x186e89[_0x8038('0x40')]=_[_0x8038('0x54')](_0x31d1b9[_0x8038('0x40')]);_0x186e89[_0x8038('0x56')]=_[_0x8038('0x57')](_0x186e89[_0x8038('0x53')],_0x186e89[_0x8038('0x40')]);_0x1b6ad3[_0x8038('0x46')]=_['intersection'](_0x186e89[_0x8038('0x53')],qs[_0x8038('0x58')](_0x31d1b9[_0x8038('0x40')][_0x8038('0x58')]));_0x1b6ad3[_0x8038('0x46')]=_0x1b6ad3[_0x8038('0x46')][_0x8038('0x59')]?_0x1b6ad3[_0x8038('0x46')]:_0x186e89[_0x8038('0x53')];_0x1b6ad3[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x31d1b9['query'][_0x8038('0xc6')]);_0x1b6ad3[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x31d1b9[_0x8038('0x40')],_0x186e89[_0x8038('0x56')]));if(_0x31d1b9['query'][_0x8038('0x3b')]){_0x1b6ad3[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x1b6ad3[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x1b6ad3[_0x8038('0x46')],function(_0x4eee8f){var _0x146d3c={};_0x146d3c[_0x4eee8f]={'$like':'%'+_0x31d1b9['query'][_0x8038('0x3b')]+'%'};return _0x146d3c;})});}_0x1b6ad3=_[_0x8038('0xc8')]({},_0x1b6ad3,_0x31d1b9[_0x8038('0x5a')]);return _0x40b001['getFaxInteractions'](_0x1b6ad3);}})[_0x8038('0x15')](function(_0x451bec){if(_0x451bec){_0x2f937f=_0x451bec['length'];if(!_0x31d1b9[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x1b6ad3[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x31d1b9['query'][_0x8038('0xce')]);_0x1b6ad3['offset']=qs[_0x8038('0x21')](_0x31d1b9[_0x8038('0x40')]['offset']);}return _0x40b001[_0x8038('0xe1')](_0x1b6ad3);}})[_0x8038('0x15')](function(_0x3948a8){if(_0x3948a8){return _0x3948a8?{'count':_0x2f937f,'rows':_0x3948a8}:null;}})[_0x8038('0x15')](respondWithResult(_0x538a12,null))[_0x8038('0x51')](handleError(_0x538a12,null));};exports['getWhatsappInteractions']=function(_0x3934f6,_0x593a89){var _0x2411bf={};var _0x386ed3={};var _0x5ac9b7;var _0x4228a9;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x3934f6[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x593a89,null))[_0x8038('0x15')](function(_0x4d3f41){if(_0x4d3f41){_0x5ac9b7=_0x4d3f41;_0x386ed3[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe3')]['rawAttributes']);_0x386ed3[_0x8038('0x40')]=_[_0x8038('0x54')](_0x3934f6[_0x8038('0x40')]);_0x386ed3[_0x8038('0x56')]=_[_0x8038('0x57')](_0x386ed3['model'],_0x386ed3['query']);_0x2411bf[_0x8038('0x46')]=_[_0x8038('0x57')](_0x386ed3['model'],qs['fields'](_0x3934f6[_0x8038('0x40')]['fields']));_0x2411bf[_0x8038('0x46')]=_0x2411bf['attributes'][_0x8038('0x59')]?_0x2411bf[_0x8038('0x46')]:_0x386ed3['model'];_0x2411bf['order']=qs['sort'](_0x3934f6[_0x8038('0x40')][_0x8038('0xc6')]);_0x2411bf[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x3934f6[_0x8038('0x40')],_0x386ed3['filters']));if(_0x3934f6[_0x8038('0x40')][_0x8038('0x3b')]){_0x2411bf[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x2411bf['where'],{'$or':_[_0x8038('0x34')](_0x2411bf[_0x8038('0x46')],function(_0x146427){var _0x491acc={};_0x491acc[_0x146427]={'$like':'%'+_0x3934f6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x491acc;})});}_0x2411bf=_[_0x8038('0xc8')]({},_0x2411bf,_0x3934f6[_0x8038('0x5a')]);return _0x5ac9b7[_0x8038('0xe4')](_0x2411bf);}})[_0x8038('0x15')](function(_0x48f973){if(_0x48f973){_0x4228a9=_0x48f973[_0x8038('0x59')];if(!_0x3934f6[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x2411bf[_0x8038('0xce')]=qs['limit'](_0x3934f6['query'][_0x8038('0xce')]);_0x2411bf[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x3934f6['query'][_0x8038('0x21')]);}return _0x5ac9b7[_0x8038('0xe4')](_0x2411bf);}})[_0x8038('0x15')](function(_0x2c8be3){if(_0x2c8be3){return _0x2c8be3?{'count':_0x4228a9,'rows':_0x2c8be3}:null;}})[_0x8038('0x15')](respondWithResult(_0x593a89,null))['catch'](handleError(_0x593a89,null));};exports[_0x8038('0xe5')]=function(_0x374c2d,_0x42d5d6,_0x171baf){var _0xd57f87;var _0x5e407c;var _0x151021;var _0x517147=!_[_0x8038('0x68')](_0x374c2d['params']['id'])?_0x374c2d[_0x8038('0x52')]['id']:!_['isNil'](_0x374c2d[_0x8038('0x2e')]['id'])?_0x374c2d[_0x8038('0x2e')]['id']:null;return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x517147,'role':{'$or':[_0x8038('0x2c'),'user',_0x8038('0x30')]}},'attributes':['id','name',_0x8038('0xe6'),_0x8038('0xe7'),_0x8038('0x2b'),_0x8038('0x63'),_0x8038('0x9b')]})[_0x8038('0x15')](function(_0x5e4bd7){if(_0x5e4bd7){if(_0x5e4bd7['role']==='agent'){_0xd57f87=_0x5e4bd7;if(_0x374c2d[_0x8038('0x5e')][_0x8038('0x9c')]){_0x151021=util[_0x8038('0xa7')](_0x8038('0xe8'),_0xd57f87[_0x374c2d['body']['interface']]);}else if(_0x374c2d[_0x8038('0x5e')][_0x8038('0xe9')]){_0x151021=util[_0x8038('0xa7')](_0x8038('0xa8'),_0x374c2d[_0x8038('0x5e')][_0x8038('0xe9')]);}else{_0x151021=util[_0x8038('0xa7')](_0x8038('0xa8'),_0xd57f87[_0x8038('0x37')]);}socket['to'](util[_0x8038('0xa7')](_0x8038('0xea'),_0xd57f87[_0x8038('0x37')]))[_0x8038('0x28')](_0x8038('0xeb'),{'user':{'id':_0xd57f87['id'],'name':_0xd57f87[_0x8038('0x37')]},'ip':_0x374c2d[_0x8038('0xec')][_0x8038('0xed')]||_0x374c2d[_0x8038('0xee')]['remoteAddress']||_0x374c2d[_0x8038('0xef')][_0x8038('0xf0')]||_0x374c2d[_0x8038('0xee')]['socket'][_0x8038('0xf0')]});return db[_0x8038('0xd5')]['destroy']({'where':{'membername':_0xd57f87[_0x8038('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0xf1'));}})[_0x8038('0x15')](function(){if(_0xd57f87){return _0xd57f87[_0x8038('0xf2')]({'raw':!![]});}})['then'](function(_0x56ace5){if(_0xd57f87){var _0x147a6e=[];if(_0x56ace5){_0x5e407c=_0x56ace5;if(_0x5e407c[_0x8038('0x59')]){for(var _0x142f09=0x0;_0x142f09<_0x5e407c[_0x8038('0x59')];_0x142f09++){_0x147a6e[_0x8038('0x47')]({'membername':_0xd57f87[_0x8038('0x37')],'UserId':_0xd57f87['id'],'queue_name':_0x5e407c[_0x142f09][_0x8038('0x37')],'VoiceQueueId':_0x5e407c[_0x142f09]['id'],'interface':_0x151021,'paused':_0xd57f87['loginInPause']||![],'penalty':_0x5e407c[_0x142f09][_0x8038('0xf3')]||0x0});}return BPromise['each'](_0x147a6e,function(_0x5b52e8){return db[_0x8038('0xd5')]['upsert'](_0x5b52e8);});}}}})[_0x8038('0x15')](function(){if(_0xd57f87){return db[_0x8038('0xf4')][_0x8038('0x48')]({'where':{'membername':_0xd57f87[_0x8038('0x37')],'exitAt':null}});}})[_0x8038('0x15')](function(_0x57b6b2){if(_0xd57f87){var _0x72746d=[];_0x57b6b2[_0x8038('0xf5')](function(_0x2ace67){_0x72746d[_0x8038('0x47')](_0x2ace67[_0x8038('0x27')]({'exitAt':moment()['format'](_0x8038('0xf6'))}));});return BPromise[_0x8038('0x50')](_0x72746d);}})['then'](function(){if(_0xd57f87){var _0x24c4c4=[];var _0xb2eba0=[];var _0x1bc17d=utils[_0x8038('0xf7')]();var _0x119b13={'membername':_0xd57f87[_0x8038('0x37')],'interface':_0x151021,'enterAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'role':_0xd57f87[_0x8038('0x2b')],'internal':_0xd57f87[_0x8038('0x63')]};_0x1bc17d[_0x8038('0xf5')](function(_0x1294ec){_0x24c4c4[_0x8038('0x47')](_[_0x8038('0xc8')]({'channel':_0x1294ec,'type':'LOGIN','data1':_0x374c2d[_0x8038('0x5e')][_0x8038('0xf8')],'data2':_0x151021},_0x119b13));if(_0xd57f87[_0x8038('0x9b')]){_0xb2eba0[_0x8038('0x47')](_[_0x8038('0xc8')]({'channel':_0x1294ec,'type':'PAUSE','data1':'LOGININPAUSE'},_0x119b13));}});return db[_0x8038('0xf4')][_0x8038('0x84')](_0x24c4c4[_0x8038('0xc4')](_0xb2eba0),{'individualHooks':!![]});}})[_0x8038('0x15')](function(){if(_0xd57f87){return _0xd57f87[_0x8038('0x27')]({'online':!![],'lastLoginAt':moment()[_0x8038('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xd57f87[_0x8038('0x9b')]||![],'mailPause':_0xd57f87[_0x8038('0x9b')]||![],'chatPause':_0xd57f87['loginInPause']||![],'faxPause':_0xd57f87[_0x8038('0x9b')]||![],'smsPause':_0xd57f87[_0x8038('0x9b')]||![],'openchannelPause':_0xd57f87[_0x8038('0x9b')]||![],'whatsappPause':_0xd57f87[_0x8038('0x9b')]||![],'pauseType':_0xd57f87['loginInPause']?_0x8038('0xf9'):null,'interface':_0x151021,'lastPauseAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))});}})[_0x8038('0x15')](function(_0x29c414){if(_0x374c2d[_0x8038('0xfa')]){return _0x171baf();}else{return BPromise[_0x8038('0xfb')](_0x29c414)[_0x8038('0x15')](respondWithResult(_0x42d5d6,null));}})[_0x8038('0x51')](handleError(_0x42d5d6,null));};exports['logout']=function(_0x218db5,_0x89848f){var _0x3d0f31;return db['User']['find']({'where':{'id':_0x218db5[_0x8038('0x52')]['id'],'role':_0x8038('0x30')},'attributes':['id','name',_0x8038('0x2b')]})[_0x8038('0x15')](handleEntityNotFound(_0x89848f,null))[_0x8038('0x15')](function(_0x3b7a60){if(_0x3b7a60){_0x3d0f31=_0x3b7a60;return db[_0x8038('0xd5')][_0x8038('0xaf')]({'where':{'membername':_0x3d0f31['name']},'individualHooks':!![]});}})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')][_0x8038('0x48')]({'where':{'membername':_0x3d0f31['name'],'exitAt':null}});})[_0x8038('0x15')](function(_0x105646){var _0x2118c4=[];_0x105646[_0x8038('0xf5')](function(_0x7042a1){_0x2118c4[_0x8038('0x47')](_0x7042a1[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))}));});return BPromise[_0x8038('0x50')](_0x2118c4);})[_0x8038('0x15')](function(){return _0x3d0f31[_0x8038('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x89848f,null))[_0x8038('0x51')](handleError(_0x89848f,null));};exports[_0x8038('0xfc')]=function(_0x241e6f,_0x42d69f){var _0x23196a;return db['UserVoiceQueueRt'][_0x8038('0x27')]({'paused':0x1},{'where':{'UserId':_0x241e6f[_0x8038('0x52')]['id']},'individualHooks':!![]})[_0x8038('0x15')](function(){return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x241e6f[_0x8038('0x52')]['id'],'role':_0x8038('0x30')},'attributes':['id',_0x8038('0x37'),'role','internal',_0x8038('0x9c')]});})[_0x8038('0x15')](handleEntityNotFound(_0x42d69f,null))['then'](function(_0x2faaa2){if(_0x2faaa2){_0x23196a=_0x2faaa2;return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0xfc'),{'id':_0x23196a['id'],'name':_0x23196a[_0x8038('0x37')],'pause':!![]});}})[_0x8038('0x15')](function(){if(_0x23196a){return db[_0x8038('0xf4')]['findAll']({'where':{'membername':_0x23196a[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}});}})[_0x8038('0x15')](function(_0x44c637){if(_0x44c637[_0x8038('0x59')]){var _0x4bb5ea=moment()[_0x8038('0xa7')](_0x8038('0xf6'));for(var _0x118983=0x0,_0x5dc9b6=_0x44c637[_0x8038('0x59')];_0x118983<_0x5dc9b6;_0x118983++){_0x44c637[_0x118983][_0x8038('0xff')]({'exitAt':_0x4bb5ea});}}})[_0x8038('0x15')](function(){var _0x5b70d8=[];var _0x49f553=utils[_0x8038('0xf7')]();_0x49f553[_0x8038('0xf5')](function(_0x3e4216){_0x5b70d8[_0x8038('0x47')]({'channel':_0x3e4216,'membername':_0x23196a[_0x8038('0x37')],'interface':_['isNil'](_0x23196a[_0x8038('0x9c')])?util[_0x8038('0xa7')](_0x8038('0xa8'),_0x23196a[_0x8038('0x37')]):_0x23196a[_0x8038('0x9c')],'type':_0x8038('0xfe'),'enterAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data1':_0x241e6f[_0x8038('0x5e')]['type']||_0x8038('0x100'),'role':_0x23196a[_0x8038('0x2b')],'internal':_0x23196a[_0x8038('0x63')]});});return db[_0x8038('0xf4')][_0x8038('0x84')](_0x5b70d8,{'individualHooks':!![]});})['then'](function(){return _0x23196a[_0x8038('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x241e6f[_0x8038('0x5e')][_0x8038('0x3a')]||_0x8038('0x100'),'lastPauseAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))});})[_0x8038('0x15')](respondWithResult(_0x42d69f,null))[_0x8038('0x51')](handleError(_0x42d69f,null));};exports[_0x8038('0x101')]=function(_0x22edfe,_0x48826d){var _0x4656e6;return db['User'][_0x8038('0x5b')]({'where':{'id':_0x22edfe[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b'),'voicePause',_0x8038('0x102'),_0x8038('0x103'),_0x8038('0x104'),_0x8038('0x105'),_0x8038('0x106'),_0x8038('0x107'),_0x8038('0x108'),'lastPauseAt']})[_0x8038('0x15')](handleEntityNotFound(_0x48826d,null))[_0x8038('0x15')](function(_0x48b121){if(_0x48b121){_0x4656e6=_0x48b121;if(_0x22edfe['body']['channel']&&!utils[_0x8038('0xd0')](_0x22edfe[_0x8038('0x5e')][_0x8038('0x9a')])){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x9d'));}switch(_0x22edfe[_0x8038('0x5e')]['channel']){case _0x8038('0xa4'):return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0x101'),{'id':_0x4656e6['id'],'name':_0x4656e6['name'],'pause':![]})[_0x8038('0x15')](function(){return db['UserVoiceQueueRt'][_0x8038('0x27')]({'paused':0x0},{'where':{'UserId':_0x4656e6['id']},'individualHooks':!![]});})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')][_0x8038('0x5b')]({'where':{'channel':_0x22edfe[_0x8038('0x5e')]['channel'],'membername':_0x4656e6[_0x8038('0x37')],'type':'PAUSE','exitAt':null}});})[_0x8038('0x15')](function(_0x5152b4){if(_0x5152b4){return _0x5152b4[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8038('0x15')](function(){return _0x4656e6[_0x8038('0x27')]({'voicePause':![]});});case _0x8038('0x4d'):case _0x8038('0x4a'):case _0x8038('0x4c'):case _0x8038('0x5d'):case _0x8038('0x4f'):case _0x8038('0x4e'):return db['MemberReport'][_0x8038('0x5b')]({'where':{'channel':_0x22edfe['body']['channel'],'membername':_0x4656e6[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}})[_0x8038('0x15')](function(_0xd2e7d){if(_0xd2e7d){return _0xd2e7d[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x1a0858={};_['set'](_0x1a0858,util[_0x8038('0xa7')](_0x8038('0x109'),_0x22edfe['body'][_0x8038('0x9a')],'Pause'),![]);return _0x4656e6[_0x8038('0x27')](_0x1a0858);});default:return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0x101'),{'id':_0x4656e6['id'],'name':_0x4656e6[_0x8038('0x37')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4656e6['id']}});})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')]['findAll']({'where':{'membername':_0x4656e6[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}});})['then'](function(_0x467c2d){var _0x473281=[];_0x467c2d[_0x8038('0xf5')](function(_0x4b4119){_0x473281[_0x8038('0x47')](_0x4b4119[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':_0x8038('0x10a')}));});return BPromise[_0x8038('0x50')](_0x473281);})[_0x8038('0x15')](function(){return _0x4656e6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8038('0x15')](respondWithResult(_0x48826d,null))[_0x8038('0x51')](handleError(_0x48826d,null));};exports[_0x8038('0x10b')]=function(_0x3fcfa2,_0x257492){var _0x51630c={};var _0x559801={};var _0x1abb27;var _0x390871;return db[_0x8038('0x38')]['findOne']({'where':{'id':_0x3fcfa2['params']['id']}})['then'](handleEntityNotFound(_0x257492,null))[_0x8038('0x15')](function(_0x3bcc29){if(_0x3bcc29){_0x1abb27=_0x3bcc29;_0x559801[_0x8038('0x53')]=_[_0x8038('0x54')](db['Team']['rawAttributes']);_0x559801[_0x8038('0x40')]=_[_0x8038('0x54')](_0x3fcfa2[_0x8038('0x40')]);_0x559801[_0x8038('0x56')]=_[_0x8038('0x57')](_0x559801[_0x8038('0x53')],_0x559801['query']);_0x51630c[_0x8038('0x46')]=_[_0x8038('0x57')](_0x559801[_0x8038('0x53')],qs[_0x8038('0x58')](_0x3fcfa2['query']['fields']));_0x51630c[_0x8038('0x46')]=_0x51630c[_0x8038('0x46')][_0x8038('0x59')]?_0x51630c[_0x8038('0x46')]:_0x559801[_0x8038('0x53')];_0x51630c['order']=qs[_0x8038('0xc6')](_0x3fcfa2['query']['sort']);_0x51630c['where']=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x3fcfa2[_0x8038('0x40')],_0x559801[_0x8038('0x56')]));if(_0x3fcfa2[_0x8038('0x40')][_0x8038('0x3b')]){_0x51630c[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x51630c[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x51630c[_0x8038('0x46')],function(_0x821053){var _0x282741={};_0x282741[_0x821053]={'$like':'%'+_0x3fcfa2[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x282741;})});}_0x51630c=_[_0x8038('0xc8')]({},_0x51630c,_0x3fcfa2[_0x8038('0x5a')]);return _0x1abb27[_0x8038('0x10b')](_0x51630c);}})[_0x8038('0x15')](function(_0x4600cf){if(_0x4600cf){_0x390871=_0x4600cf['length'];if(!_0x3fcfa2[_0x8038('0x40')][_0x8038('0xc9')]('nolimit')){_0x51630c[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x3fcfa2['query'][_0x8038('0xce')]);_0x51630c[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x3fcfa2[_0x8038('0x40')][_0x8038('0x21')]);}return _0x1abb27['getTeams'](_0x51630c);}})[_0x8038('0x15')](function(_0x409ad8){if(_0x409ad8){return _0x409ad8?{'count':_0x390871,'rows':_0x409ad8}:null;}})[_0x8038('0x15')](respondWithResult(_0x257492,null))['catch'](handleError(_0x257492,null));};exports[_0x8038('0x10c')]=function(_0x1c1f77,_0x17cfc9){var _0xd153f9=_0x1c1f77['params']['id'];var _0x65bc5e=_0x1c1f77[_0x8038('0x5e')]?_0x1c1f77[_0x8038('0x5e')]['ids']:null;var _0x309634=[];return Promise['resolve']()['then'](function(){if(!_0x65bc5e)throw new APIBadRequestError(_0x8038('0x10d'));})[_0x8038('0x15')](function(){return db['User'][_0x8038('0x94')]({'where':{'id':_0xd153f9}});})[_0x8038('0x15')](function(_0x3a7e3d){if(!_0x3a7e3d)throw new APINotFoundError(util[_0x8038('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1c1f77[_0x8038('0x52')]['id']));return db[_0x8038('0x10e')][_0x8038('0x10f')](function(_0x591ad0){return _0x3a7e3d[_0x8038('0x10c')](_0x65bc5e,{'transaction':_0x591ad0})[_0x8038('0x15')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x65bc5e}}});})[_0x8038('0x15')](function(_0x1938a3){var _0x4133ba=_[_0x8038('0x34')](_0x1938a3,function(_0x2a8f1c){return _0x2a8f1c[_0x8038('0x110')]();});return Promise[_0x8038('0x50')](_0x4133ba);})['then'](function(_0x5c04f0){_0x309634=_[_0x8038('0x111')](_0x5c04f0);var _0x1b7b3a=_['map'](_0x309634,function(_0x2ca2d0){return _0x2ca2d0[_0x8038('0x112')](_0x3a7e3d['id'],{'transaction':_0x591ad0});});return Promise['all'](_0x1b7b3a);})[_0x8038('0x15')](function(){if(!_0x3a7e3d[_0x8038('0xa6')])return;var _0x238f74=_['filter'](_0x309634,function(_0x1a151b){return _0x1a151b[_0x8038('0x113')]('channel')===_0x8038('0x114');});var _0x98efb4=_[_0x8038('0x34')](_0x238f74,function(_0x5b3c5c){return db[_0x8038('0xd5')][_0x8038('0x115')]({'membername':_0x3a7e3d[_0x8038('0x37')],'UserId':_0x3a7e3d['id'],'queue_name':_0x5b3c5c[_0x8038('0x37')],'VoiceQueueId':_0x5b3c5c['id'],'interface':_['isNil'](_0x3a7e3d[_0x8038('0x9c')])?util['format'](_0x8038('0xa8'),_0x3a7e3d[_0x8038('0x37')]):_0x3a7e3d[_0x8038('0x9c')],'paused':_0x3a7e3d[_0x8038('0xa9')]||![],'penalty':_0x3a7e3d[_0x8038('0x116')]},{'transaction':_0x591ad0});});return Promise[_0x8038('0x50')](_0x98efb4);})[_0x8038('0x15')](function(){return db[_0x8038('0x117')][_0x8038('0x48')]({'where':{'teamId':{'$in':_0x65bc5e}}});})[_0x8038('0x15')](function(_0x14e6cb){var _0x35d54f=_[_0x8038('0x34')](_0x14e6cb,function(_0x31aea3){return db[_0x8038('0x118')][_0x8038('0x7c')]({'UserId':_0x3a7e3d['id'],'VoicePrefixId':_0x31aea3['VoicePrefixId']},{'transaction':_0x591ad0});});return Promise[_0x8038('0x50')](_0x35d54f);});});})[_0x8038('0x15')](function(){for(var _0x354606=0x0;_0x354606<_0x309634[_0x8038('0x59')];_0x354606++){var _0x27e864=_0x309634[_0x354606]['getDataValue'](_0x8038('0x9a'));var _0x124ca5=_0x27e864+_0x8038('0xa2');socket['emit'](_0x8038('0x2e')+_0x27e864+_0x8038('0xa3'),{'UserId':_0xd153f9,['queueField']:_0x309634[_0x354606]['id']});}})[_0x8038('0x15')](respondWithStatusCode(_0x17cfc9,null))[_0x8038('0x51')](APIHandleError(_0x17cfc9));};exports[_0x8038('0x119')]=function(_0x2157cd,_0x2208cc){var _0x1b5bc7=_0x2157cd['params']['id'];var _0x2d7f7d=null;if(_0x2157cd[_0x8038('0x40')]['ids']){_0x2d7f7d=_[_0x8038('0xad')](_0x2157cd[_0x8038('0x40')][_0x8038('0x61')])?_0x2157cd[_0x8038('0x40')]['ids']:[_0x2157cd[_0x8038('0x40')][_0x8038('0x61')]];}var _0x459865=[];return Promise['resolve']()[_0x8038('0x15')](function(){if(!_0x2d7f7d)throw new APIBadRequestError(_0x8038('0x11a'));})[_0x8038('0x15')](function(){return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x1b5bc7}});})[_0x8038('0x15')](function(_0x2b1a30){if(!_0x2b1a30)throw new APINotFoundError(util[_0x8038('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2157cd[_0x8038('0x52')]['id']));return db['sequelize'][_0x8038('0x10f')](function(_0x27d1bb){return _0x2b1a30[_0x8038('0x119')](_0x2d7f7d,{'transaction':_0x27d1bb})['then'](function(){return db['Team'][_0x8038('0x48')]({'where':{'id':{'$in':_0x2d7f7d}}});})[_0x8038('0x15')](function(_0x373ef1){var _0x4074f8=_['map'](_0x373ef1,function(_0x5cd5f9){return _0x5cd5f9[_0x8038('0x110')]();});return Promise[_0x8038('0x50')](_0x4074f8);})[_0x8038('0x15')](function(_0xea1b7c){_0x459865=_[_0x8038('0x111')](_0xea1b7c);var _0x5356e2=_[_0x8038('0x34')](_0x459865,function(_0x52b74d){return _0x52b74d[_0x8038('0x11b')](_0x2b1a30['id'],{'transaction':_0x27d1bb});});return Promise[_0x8038('0x50')](_0x5356e2);})[_0x8038('0x15')](function(){if(!_0x2b1a30[_0x8038('0xa6')])return;var _0x5ebbb1=_[_0x8038('0x3b')](_0x459865,function(_0x15c1d8){return _0x15c1d8[_0x8038('0x113')](_0x8038('0x9a'))===_0x8038('0x114');});var _0x36c9a5=_[_0x8038('0x34')](_0x5ebbb1,function(_0x56e6d6){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x56e6d6['id'],'UserId':_0x2b1a30['id']},'transaction':_0x27d1bb});});return Promise['all'](_0x36c9a5);})['then'](function(){return db[_0x8038('0x117')][_0x8038('0x48')]({'where':{'teamId':{'$in':_0x2d7f7d}}});})[_0x8038('0x15')](function(_0x347732){var _0x20f8c6=_[_0x8038('0x34')](_0x347732,function(_0x56826c){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2b1a30['id'],'VoicePrefixId':_0x56826c['VoicePrefixId']}},{'transaction':_0x27d1bb});});return Promise['all'](_0x20f8c6);});});})[_0x8038('0x15')](function(){for(var _0x462c34=0x0;_0x462c34<_0x459865[_0x8038('0x59')];_0x462c34++){var _0x428011=_0x459865[_0x462c34][_0x8038('0x113')]('channel');var _0x16600f=_0x428011+'QueueId';socket[_0x8038('0x28')](_0x8038('0x2e')+_0x428011+'Queue:remove',{'UserId':_0x1b5bc7,['queueField']:_0x459865[_0x462c34]['id']});}})[_0x8038('0x15')](respondWithStatusCode(_0x2208cc,null))['catch'](APIHandleError(_0x2208cc));};exports[_0x8038('0x11c')]=function(_0x1702f7,_0x272fc9){var _0x9c2789={};var _0x4ae2cf={};var _0x1610a2;var _0x1267ac;return db['User'][_0x8038('0x94')]({'where':{'id':_0x1702f7[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x272fc9,null))[_0x8038('0x15')](function(_0x125820){if(_0x125820){_0x1610a2=_0x125820;_0x4ae2cf['model']=_[_0x8038('0x54')](db[_0x8038('0xca')][_0x8038('0x55')]);_0x4ae2cf[_0x8038('0x40')]=_['keys'](_0x1702f7[_0x8038('0x40')]);_0x4ae2cf[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4ae2cf['model'],_0x4ae2cf[_0x8038('0x40')]);_0x9c2789['attributes']=_['intersection'](_0x4ae2cf['model'],qs[_0x8038('0x58')](_0x1702f7['query'][_0x8038('0x58')]));_0x9c2789[_0x8038('0x46')]=_0x9c2789[_0x8038('0x46')][_0x8038('0x59')]?_0x9c2789[_0x8038('0x46')]:_0x4ae2cf['model'];_0x9c2789[_0x8038('0xd1')]=qs['sort'](_0x1702f7[_0x8038('0x40')][_0x8038('0xc6')]);_0x9c2789[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x1702f7[_0x8038('0x40')],_0x4ae2cf[_0x8038('0x56')]));if(_0x1702f7[_0x8038('0x40')][_0x8038('0x3b')]){_0x9c2789['where']=_[_0x8038('0xc8')](_0x9c2789[_0x8038('0x3f')],{'$or':_['map'](_0x9c2789[_0x8038('0x46')],function(_0x41d707){var _0x211c1a={};_0x211c1a[_0x41d707]={'$like':'%'+_0x1702f7[_0x8038('0x40')]['filter']+'%'};return _0x211c1a;})});}_0x9c2789=_[_0x8038('0xc8')]({},_0x9c2789,_0x1702f7[_0x8038('0x5a')]);return _0x1610a2[_0x8038('0x11c')](_0x9c2789);}})[_0x8038('0x15')](function(_0x1b0aeb){if(_0x1b0aeb){_0x1267ac=_0x1b0aeb['length'];if(!_0x1702f7[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x9c2789[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x1702f7['query'][_0x8038('0xce')]);_0x9c2789[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x1702f7[_0x8038('0x40')][_0x8038('0x21')]);}return _0x1610a2[_0x8038('0x11c')](_0x9c2789);}})[_0x8038('0x15')](function(_0xccf1de){if(_0xccf1de){return _0xccf1de?{'count':_0x1267ac,'rows':_0xccf1de}:null;}})[_0x8038('0x15')](respondWithResult(_0x272fc9,null))[_0x8038('0x51')](handleError(_0x272fc9,null));};exports[_0x8038('0x11d')]=function(_0x4c6cd6,_0x2b54f6){var _0x503804={};var _0xaf6027={};var _0x3ed394;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x4c6cd6['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x2b54f6,null))[_0x8038('0x15')](function(_0x69348b){if(_0x69348b){_0x3ed394=_0x69348b;_0xaf6027[_0x8038('0x53')]=_['keys'](db[_0x8038('0x38')]['rawAttributes']);_0xaf6027['query']=_['keys'](_0x4c6cd6[_0x8038('0x40')]);_0xaf6027['filters']=_[_0x8038('0x57')](_0xaf6027['model'],_0xaf6027[_0x8038('0x40')]);_0x503804[_0x8038('0x46')]=_['intersection'](_0xaf6027[_0x8038('0x53')],qs[_0x8038('0x58')](_0x4c6cd6[_0x8038('0x40')][_0x8038('0x58')]));_0x503804['attributes']=_0x503804[_0x8038('0x46')][_0x8038('0x59')]?_0x503804[_0x8038('0x46')]:_0xaf6027['model'];_0x503804[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x4c6cd6[_0x8038('0x40')][_0x8038('0xc6')]);_0x503804[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x4c6cd6[_0x8038('0x40')],_0xaf6027[_0x8038('0x56')]));if(_0x4c6cd6[_0x8038('0x40')][_0x8038('0x3b')]){_0x503804['where']=_[_0x8038('0xc8')](_0x503804[_0x8038('0x3f')],{'$or':_['map'](_0x503804[_0x8038('0x46')],function(_0x5c113d){var _0xe5bd7b={};_0xe5bd7b[_0x5c113d]={'$like':'%'+_0x4c6cd6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0xe5bd7b;})});}_0x503804[_0x8038('0x53')]=db[_0x8038('0x38')];_0x503804['as']=_0x8038('0x2f');_0x503804=_[_0x8038('0xc8')]({},_0x503804,_0x4c6cd6[_0x8038('0x5a')]);return _0x3ed394[_0x8038('0xf2')]({'include':[_0x503804]});}})[_0x8038('0x15')](function(_0x39bfbb){if(_0x39bfbb){var _0x2a2707={},_0x4b96e3=[];for(var _0x4c4277=0x0;_0x4c4277<_0x39bfbb[_0x8038('0x59')];_0x4c4277+=0x1){for(var _0x32767e=0x0,_0xd6cc8e;_0x32767e<_0x39bfbb[_0x4c4277][_0x8038('0x2f')][_0x8038('0x59')];_0x32767e+=0x1){_0xd6cc8e=_0x39bfbb[_0x4c4277]['Agents'][_0x32767e][_0x8038('0x2a')]({'plain':!![]});_0x2a2707[_0xd6cc8e['id']]=_0xd6cc8e;}}_0x2a2707=_['values'](_0x2a2707);for(var _0x327628=qs[_0x8038('0x21')](_0x4c6cd6[_0x8038('0x40')]['offset']);_0x327628<_0x2a2707[_0x8038('0x59')]&&_0x4b96e3[_0x8038('0x59')]=_0x5c8620[_0x00f3('0x50')]){throw new Error(_0x00f3('0x51'));}})[_0x00f3('0x24')](function(){if(_0x4e6278){return db[_0x00f3('0x2c')][_0x00f3('0x4a')]({'where':{'membername':_0x4e6278[_0x00f3('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x4e6278){return _0x4e6278[_0x00f3('0x52')]({'raw':!![]});}})[_0x00f3('0x24')](function(_0x5eea60){if(_0x4e6278){if(_0x5eea60){var _0x3abbc9=[];_0x2ed8ba=_0x5eea60;if(_0x2ed8ba['length']){for(var _0x4a5720=0x0;_0x4a5720<_0x2ed8ba[_0x00f3('0x2f')];_0x4a5720++){_0x3abbc9[_0x00f3('0x35')](db[_0x00f3('0x2c')][_0x00f3('0x53')]({'membername':_0x4e6278[_0x00f3('0x28')],'UserId':_0x4e6278['id'],'queue_name':_0x2ed8ba[_0x4a5720]['name'],'VoiceQueueId':_0x2ed8ba[_0x4a5720]['id'],'interface':_0x39d013,'paused':_0x4e6278[_0x00f3('0x4c')]||![],'penalty':_0x2ed8ba[_0x4a5720][_0x00f3('0x54')]||0x0}));}return BPromise[_0x00f3('0x49')](_0x3abbc9);}}}})[_0x00f3('0x24')](function(){if(_0x4e6278){return db[_0x00f3('0x3a')]['findAll']({'where':{'membername':_0x4e6278['name'],'exitAt':null}});}})[_0x00f3('0x24')](function(_0x5c80e1){if(_0x4e6278){if(_0x5c80e1&&_0x5c80e1[_0x00f3('0x2f')]){var _0x316141=[];_0x5c80e1[_0x00f3('0x34')](function(_0x24019d){_0x316141[_0x00f3('0x35')](_0x24019d[_0x00f3('0x2d')]({'exitAt':moment()['format'](_0x00f3('0x31'))}));});return BPromise[_0x00f3('0x49')](_0x316141);}}})[_0x00f3('0x24')](function(_0x665f27){if(_0x4e6278){var _0x4d2636=[];var _0x46031c=[];var _0x4fff4e=utils[_0x00f3('0x33')]();var _0x54536a={'membername':_0x4e6278[_0x00f3('0x28')],'interface':_0x39d013,'enterAt':moment()[_0x00f3('0x30')](_0x00f3('0x31')),'role':_0x4e6278[_0x00f3('0x29')],'internal':_0x4e6278['internal']};_0x4fff4e['forEach'](function(_0x10ed92){_0x4d2636['push'](_[_0x00f3('0x55')]({'channel':_0x10ed92,'type':_0x00f3('0x56'),'data1':_0x00f3('0x57'),'data2':_0x39d013},_0x54536a));if(_0x4e6278[_0x00f3('0x4c')]){_0x46031c['push'](_[_0x00f3('0x55')]({'channel':_0x10ed92,'type':_0x00f3('0x2e'),'data1':_0x00f3('0x58')},_0x54536a));}});return db['MemberReport']['bulkCreate'](_0x4d2636[_0x00f3('0x59')](_0x46031c),{'individualHooks':!![]});}})['then'](function(){if(_0x4e6278){return _0x4e6278[_0x00f3('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0x00f3('0x31')),'voicePause':_0x4e6278[_0x00f3('0x4c')]||![],'mailPause':_0x4e6278[_0x00f3('0x4c')]||![],'chatPause':_0x4e6278['loginInPause']||![],'faxPause':_0x4e6278[_0x00f3('0x4c')]||![],'smsPause':_0x4e6278[_0x00f3('0x4c')]||![],'openchannelPause':_0x4e6278[_0x00f3('0x4c')]||![],'pauseType':_0x4e6278[_0x00f3('0x4c')]?_0x00f3('0x58'):null,'lastPauseAt':moment()['format'](_0x00f3('0x31')),'interface':_0x39d013});}})[_0x00f3('0x24')](function(_0x508718){_0x2b776c(_0x508718);})[_0x00f3('0x18')](function(_0x4cba27){_0x344d71(_0x30ca45['error'](0x1f4,_0x4cba27['message']));});});}; \ No newline at end of file +var _0x88e6=['PauseUser','name','role','interface','UserVoiceQueueRt','update','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','MemberReport','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','openchannel','whatsapp','set','%s%s','push','all','LogoutUser','destroy','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','User','findAll','options','where','attributes','limit','include','map','model','then','GetUser','debug','ShowUser','raw'];(function(_0x45866b,_0xbbd773){var _0x293d15=function(_0x3aadf3){while(--_0x3aadf3){_0x45866b['push'](_0x45866b['shift']());}};_0x293d15(++_0xbbd773);}(_0x88e6,0x8d));var _0x688e=function(_0x3005d5,_0x23d9f9){_0x3005d5=_0x3005d5-0x0;var _0x5bec29=_0x88e6[_0x3005d5];return _0x5bec29;};'use strict';var _=require(_0x688e('0x0'));var util=require(_0x688e('0x1'));var moment=require(_0x688e('0x2'));var BPromise=require(_0x688e('0x3'));var rs=require(_0x688e('0x4'));var fs=require('fs');var Redis=require(_0x688e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x688e('0x6'))(_0x688e('0x7'));var config=require('../../config/environment');var jayson=require(_0x688e('0x8'));var client=jayson[_0x688e('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x688e('0xa')],{'host':_0x688e('0xb'),'port':0x18eb});var socket=require(_0x688e('0xc'))(new Redis(config['redis']));require(_0x688e('0xd'))[_0x688e('0xe')](socket);function respondWithRpcPromise(_0x4964dd,_0x3674b6,_0x463cd7){return new BPromise(function(_0x9c4428,_0x3d9b6f){return client[_0x688e('0xf')](_0x4964dd,_0x463cd7)['then'](function(_0x400204){logger[_0x688e('0x10')](_0x688e('0x11'),_0x3674b6,_0x688e('0x12'));logger['debug'](_0x688e('0x13'),_0x3674b6,_0x688e('0x12'),JSON[_0x688e('0x14')](_0x400204));if(_0x400204[_0x688e('0x15')]){if(_0x400204[_0x688e('0x15')][_0x688e('0x16')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x3674b6,_0x400204[_0x688e('0x15')][_0x688e('0x17')]);return _0x3d9b6f(_0x400204[_0x688e('0x15')][_0x688e('0x17')]);}logger[_0x688e('0x15')](_0x688e('0x11'),_0x3674b6,_0x400204[_0x688e('0x15')][_0x688e('0x17')]);return _0x9c4428(_0x400204['error'][_0x688e('0x17')]);}else{logger['info'](_0x688e('0x11'),_0x3674b6,_0x688e('0x12'));_0x9c4428(_0x400204['result'][_0x688e('0x17')]);}})[_0x688e('0x18')](function(_0x2d0b5b){logger[_0x688e('0x15')]('User,\x20%s,\x20%s',_0x3674b6,_0x2d0b5b);_0x3d9b6f(_0x2d0b5b);});});}exports['GetUser']=function(_0xce9067){var _0x286b35=this;return new Promise(function(_0x50b2dd,_0x2b9f3f){return db[_0x688e('0x19')][_0x688e('0x1a')]({'raw':_0xce9067[_0x688e('0x1b')]?_0xce9067[_0x688e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xce9067[_0x688e('0x1b')]?_0xce9067[_0x688e('0x1b')][_0x688e('0x1c')]||null:null,'attributes':_0xce9067[_0x688e('0x1b')]?_0xce9067[_0x688e('0x1b')][_0x688e('0x1d')]||null:null,'limit':_0xce9067[_0x688e('0x1b')]?_0xce9067[_0x688e('0x1b')][_0x688e('0x1e')]||null:null,'include':_0xce9067[_0x688e('0x1b')]?_0xce9067[_0x688e('0x1b')][_0x688e('0x1f')]?_[_0x688e('0x20')](_0xce9067[_0x688e('0x1b')][_0x688e('0x1f')],function(_0x268a55){return{'model':db[_0x268a55[_0x688e('0x21')]],'as':_0x268a55['as'],'attributes':_0x268a55[_0x688e('0x1d')],'include':_0x268a55[_0x688e('0x1f')]?_['map'](_0x268a55[_0x688e('0x1f')],function(_0x576f5a){return{'model':db[_0x576f5a['model']],'as':_0x576f5a['as'],'attributes':_0x576f5a[_0x688e('0x1d')],'include':_0x576f5a['include']?_['map'](_0x576f5a[_0x688e('0x1f')],function(_0x5f461c){return{'model':db[_0x5f461c['model']],'as':_0x5f461c['as'],'attributes':_0x5f461c[_0x688e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x688e('0x22')](function(_0x3c5797){logger[_0x688e('0x10')](_0x688e('0x23'),_0xce9067);logger[_0x688e('0x24')](_0x688e('0x23'),_0xce9067,JSON[_0x688e('0x14')](_0x3c5797));_0x50b2dd(_0x3c5797);})['catch'](function(_0x13b1cd){logger[_0x688e('0x15')]('GetUser',_0x13b1cd[_0x688e('0x17')],_0xce9067);_0x2b9f3f(_0x286b35[_0x688e('0x15')](0x1f4,_0x13b1cd['message']));});});};exports[_0x688e('0x25')]=function(_0x239cc0){var _0x2f062d=this;return new Promise(function(_0x2c6295,_0x57d89e){return db[_0x688e('0x19')]['find']({'raw':_0x239cc0[_0x688e('0x1b')]?_0x239cc0[_0x688e('0x1b')][_0x688e('0x26')]===undefined?!![]:![]:!![],'where':_0x239cc0[_0x688e('0x1b')]?_0x239cc0[_0x688e('0x1b')][_0x688e('0x1c')]||null:null,'attributes':_0x239cc0['options']?_0x239cc0[_0x688e('0x1b')][_0x688e('0x1d')]||null:null,'include':_0x239cc0[_0x688e('0x1b')]?_0x239cc0[_0x688e('0x1b')][_0x688e('0x1f')]?_[_0x688e('0x20')](_0x239cc0['options'][_0x688e('0x1f')],function(_0x5e3f25){return{'model':db[_0x5e3f25[_0x688e('0x21')]],'as':_0x5e3f25['as'],'attributes':_0x5e3f25[_0x688e('0x1d')],'include':_0x5e3f25[_0x688e('0x1f')]?_[_0x688e('0x20')](_0x5e3f25[_0x688e('0x1f')],function(_0xdb5837){return{'model':db[_0xdb5837['model']],'as':_0xdb5837['as'],'attributes':_0xdb5837[_0x688e('0x1d')],'include':_0xdb5837['include']?_[_0x688e('0x20')](_0xdb5837['include'],function(_0x43ba99){return{'model':db[_0x43ba99[_0x688e('0x21')]],'as':_0x43ba99['as'],'attributes':_0x43ba99['attributes']};}):[]};}):[]};}):[]:[]})[_0x688e('0x22')](function(_0x5ae261){logger[_0x688e('0x10')](_0x688e('0x25'),_0x239cc0);logger['debug'](_0x688e('0x25'),_0x239cc0,JSON['stringify'](_0x5ae261));_0x2c6295(_0x5ae261);})[_0x688e('0x18')](function(_0x44a032){logger[_0x688e('0x15')]('ShowUser',_0x44a032[_0x688e('0x17')],_0x239cc0);_0x57d89e(_0x2f062d[_0x688e('0x15')](0x1f4,_0x44a032[_0x688e('0x17')]));});});};exports[_0x688e('0x27')]=function(_0x47a8f1){var _0x2e390e=this;return new Promise(function(_0x5ab176,_0x83fd74){var _0x4f9369;return db[_0x688e('0x19')]['find']({'where':_0x47a8f1[_0x688e('0x1b')]['where']||{},'attributes':['id',_0x688e('0x28'),_0x688e('0x29'),'internal',_0x688e('0x2a')]})[_0x688e('0x22')](function(_0x41f0c9){if(_0x41f0c9){_0x4f9369=_0x41f0c9;return db[_0x688e('0x2b')][_0x688e('0x2c')]({'paused':0x1},{'where':{'UserId':_0x4f9369['id']},'individualHooks':!![]});}})[_0x688e('0x22')](function(){if(_0x4f9369){return db['MemberReport'][_0x688e('0x1a')]({'where':{'membername':_0x4f9369[_0x688e('0x28')],'type':_0x688e('0x2d'),'exitAt':null}});}})[_0x688e('0x22')](function(_0x308e95){if(_0x4f9369){if(_0x308e95&&_0x308e95['length']){var _0x4eb637=moment()[_0x688e('0x2e')](_0x688e('0x2f'));for(var _0x1e46fc=0x0,_0x3475a=_0x308e95[_0x688e('0x30')];_0x1e46fc<_0x3475a;_0x1e46fc++){_0x308e95[_0x1e46fc]['updateAttributes']({'exitAt':_0x4eb637});}}}})[_0x688e('0x22')](function(){if(_0x4f9369){var _0x4b1449=[];var _0x519496=utils[_0x688e('0x31')]();_0x519496[_0x688e('0x32')](function(_0x47797e){_0x4b1449['push']({'channel':_0x47797e,'membername':_0x4f9369[_0x688e('0x28')],'interface':_[_0x688e('0x33')](_0x4f9369[_0x688e('0x2a')])?util[_0x688e('0x2e')](_0x688e('0x34'),_0x4f9369[_0x688e('0x28')]):_0x4f9369[_0x688e('0x2a')],'type':_0x688e('0x2d'),'enterAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'data1':_0x47a8f1[_0x688e('0x35')][_0x688e('0x36')]||_0x688e('0x37'),'role':_0x4f9369[_0x688e('0x29')],'internal':_0x4f9369[_0x688e('0x38')],'uniqueid':_0x47a8f1['body']['uniqueid']||null});});return db[_0x688e('0x39')][_0x688e('0x3a')](_0x4b1449,{'individualHooks':!![]});}})[_0x688e('0x22')](function(){if(_0x4f9369){return _0x4f9369[_0x688e('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x47a8f1[_0x688e('0x35')][_0x688e('0x36')]||_0x688e('0x37'),'lastPauseAt':moment()[_0x688e('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x688e('0x22')](function(_0x35cbea){_0x5ab176(_0x35cbea);})[_0x688e('0x18')](function(_0x5cd628){_0x83fd74(_0x2e390e[_0x688e('0x15')](0x1f4,_0x5cd628[_0x688e('0x17')]));});});};exports[_0x688e('0x3b')]=function(_0x89ec90){var _0x2b234b=this;return new Promise(function(_0x2bf1f2,_0x1354da){var _0x3ab74c;return db['User'][_0x688e('0x3c')]({'where':_0x89ec90['options'][_0x688e('0x1c')]||{},'attributes':['id',_0x688e('0x28')]})[_0x688e('0x22')](function(_0x392c15){if(_0x392c15){_0x3ab74c=_0x392c15;if(_0x89ec90[_0x688e('0x35')][_0x688e('0x3d')]&&!utils[_0x688e('0x3e')](_0x89ec90[_0x688e('0x35')][_0x688e('0x3d')])){throw new Error(_0x688e('0x3f'));}switch(_0x89ec90[_0x688e('0x35')]['channel']){case _0x688e('0x40'):return db['UserVoiceQueueRt'][_0x688e('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3ab74c['id']}})[_0x688e('0x22')](function(){return db['MemberReport']['find']({'where':{'channel':_0x89ec90[_0x688e('0x35')][_0x688e('0x3d')],'membername':_0x3ab74c[_0x688e('0x28')],'type':_0x688e('0x2d'),'exitAt':null}});})[_0x688e('0x22')](function(_0x3c4a11){if(_0x3c4a11){return _0x3c4a11['update']({'exitAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'data2':_0x688e('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3ab74c[_0x688e('0x2c')]({'voicePause':![]});});case _0x688e('0x42'):case _0x688e('0x43'):case'fax':case'sms':case _0x688e('0x44'):case _0x688e('0x45'):return db[_0x688e('0x39')]['find']({'where':{'channel':_0x89ec90[_0x688e('0x35')][_0x688e('0x3d')],'membername':_0x3ab74c['name'],'type':_0x688e('0x2d'),'exitAt':null}})[_0x688e('0x22')](function(_0x565db5){return _0x565db5[_0x688e('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x688e('0x22')](function(){var _0x551001={};_[_0x688e('0x46')](_0x551001,util[_0x688e('0x2e')](_0x688e('0x47'),_0x89ec90[_0x688e('0x35')][_0x688e('0x3d')],'Pause'),![]);return _0x3ab74c[_0x688e('0x2c')](_0x551001);});default:return db[_0x688e('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x3ab74c['id']}})[_0x688e('0x22')](function(){return db[_0x688e('0x39')][_0x688e('0x1a')]({'where':{'membername':_0x3ab74c['name'],'type':_0x688e('0x2d'),'exitAt':null}});})[_0x688e('0x22')](function(_0x18bbb1){var _0x594e63=[];_0x18bbb1['forEach'](function(_0x3daf86){_0x594e63[_0x688e('0x48')](_0x3daf86[_0x688e('0x2c')]({'exitAt':moment()['format'](_0x688e('0x2f')),'data2':_0x688e('0x41')}));});return BPromise[_0x688e('0x49')](_0x594e63);})[_0x688e('0x22')](function(){return _0x3ab74c['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x688e('0x22')](function(_0x990f91){_0x2bf1f2(_0x990f91);})[_0x688e('0x18')](function(_0x132d01){_0x1354da(_0x2b234b[_0x688e('0x15')](0x1f4,_0x132d01['message']));});});};exports[_0x688e('0x4a')]=function(_0x16c393){var _0x100f94=this;return new Promise(function(_0x3c9e78,_0x13bebe){var _0x31ccec;return db['User'][_0x688e('0x3c')]({'where':_0x16c393[_0x688e('0x1b')][_0x688e('0x1c')]||{},'attributes':['id',_0x688e('0x28')]})[_0x688e('0x22')](function(_0x31de1b){if(_0x31de1b){_0x31ccec=_0x31de1b;return db[_0x688e('0x2b')][_0x688e('0x4b')]({'where':{'membername':_0x31ccec['name']},'individualHooks':!![]});}})['then'](function(){if(_0x31ccec){return db[_0x688e('0x39')][_0x688e('0x1a')]({'where':{'membername':_0x31ccec[_0x688e('0x28')],'exitAt':null}});}})['then'](function(_0x2d629a){if(_0x31ccec){if(_0x2d629a&&_0x2d629a[_0x688e('0x30')]){var _0x29d4aa=[];_0x2d629a[_0x688e('0x32')](function(_0x123665){_0x29d4aa['push'](_0x123665[_0x688e('0x2c')]({'exitAt':moment()[_0x688e('0x2e')](_0x688e('0x2f'))}));});return BPromise[_0x688e('0x49')](_0x29d4aa);}}})[_0x688e('0x22')](function(){if(_0x31ccec){return _0x31ccec[_0x688e('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x688e('0x22')](function(_0x18cad9){_0x3c9e78(_0x18cad9);})[_0x688e('0x18')](function(_0x57dd95){_0x13bebe(_0x100f94[_0x688e('0x15')](0x1f4,_0x57dd95['message']));});});};exports['LoginUser']=function(_0x5aabf9){var _0x26f7c7=this;return new Promise(function(_0x26915b,_0x5d03dd){var _0x40d9c9;var _0x233f21;var _0x21c6d6;var _0x23a409;return db[_0x688e('0x19')][_0x688e('0x3c')]({'where':_0x5aabf9[_0x688e('0x1b')][_0x688e('0x1c')]||{},'attributes':['id','name',_0x688e('0x29'),'mobile',_0x688e('0x4c'),_0x688e('0x38'),_0x688e('0x4d'),'interface']})[_0x688e('0x22')](function(_0x3194d0){if(_0x3194d0){_0x40d9c9=_0x3194d0;_0x23a409=_0x5aabf9[_0x688e('0x35')][_0x688e('0x2a')]?_0x5aabf9['body'][_0x688e('0x2a')]:util[_0x688e('0x2e')]('SIP/%s',_0x40d9c9[_0x688e('0x28')]);return db['User'][_0x688e('0x4e')]({'where':{'role':_0x688e('0x4f'),'online':!![],'id':{'$ne':_0x40d9c9['id']}}});}})['then'](function(_0x5760ee){if(_0x5760ee){_0x21c6d6=_0x5760ee;return require(_0x688e('0x50'))[_0x688e('0x51')]();}})[_0x688e('0x22')](function(_0x55c77e){if(_0x55c77e&&_0x55c77e[_0x688e('0x52')]&&_0x21c6d6>=_0x55c77e[_0x688e('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x688e('0x22')](function(){if(_0x40d9c9){return db[_0x688e('0x2b')][_0x688e('0x4b')]({'where':{'membername':_0x40d9c9[_0x688e('0x28')]},'individualHooks':!![]});}})[_0x688e('0x22')](function(){if(_0x40d9c9){return _0x40d9c9['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5985b9){if(_0x40d9c9){if(_0x5985b9){var _0x56fe46=[];_0x233f21=_0x5985b9;if(_0x233f21[_0x688e('0x30')]){for(var _0x5f159b=0x0;_0x5f159b<_0x233f21['length'];_0x5f159b++){_0x56fe46[_0x688e('0x48')](db['UserVoiceQueueRt'][_0x688e('0x53')]({'membername':_0x40d9c9[_0x688e('0x28')],'UserId':_0x40d9c9['id'],'queue_name':_0x233f21[_0x5f159b][_0x688e('0x28')],'VoiceQueueId':_0x233f21[_0x5f159b]['id'],'interface':_0x23a409,'paused':_0x40d9c9[_0x688e('0x4d')]||![],'penalty':_0x233f21[_0x5f159b][_0x688e('0x54')]||0x0}));}return BPromise['all'](_0x56fe46);}}}})[_0x688e('0x22')](function(){if(_0x40d9c9){return db[_0x688e('0x39')][_0x688e('0x1a')]({'where':{'membername':_0x40d9c9[_0x688e('0x28')],'exitAt':null}});}})[_0x688e('0x22')](function(_0x2c0311){if(_0x40d9c9){if(_0x2c0311&&_0x2c0311[_0x688e('0x30')]){var _0x51357e=[];_0x2c0311[_0x688e('0x32')](function(_0x35efa8){_0x51357e[_0x688e('0x48')](_0x35efa8[_0x688e('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x51357e);}}})[_0x688e('0x22')](function(_0x1083d3){if(_0x40d9c9){var _0x3d78aa=[];var _0x4523aa=[];var _0x355e6b=utils[_0x688e('0x31')]();var _0x5196c5={'membername':_0x40d9c9[_0x688e('0x28')],'interface':_0x23a409,'enterAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'role':_0x40d9c9[_0x688e('0x29')],'internal':_0x40d9c9[_0x688e('0x38')]};_0x355e6b[_0x688e('0x32')](function(_0x444a21){_0x3d78aa[_0x688e('0x48')](_[_0x688e('0x55')]({'channel':_0x444a21,'type':_0x688e('0x56'),'data1':_0x688e('0x57'),'data2':_0x23a409},_0x5196c5));if(_0x40d9c9[_0x688e('0x4d')]){_0x4523aa[_0x688e('0x48')](_[_0x688e('0x55')]({'channel':_0x444a21,'type':_0x688e('0x2d'),'data1':_0x688e('0x58')},_0x5196c5));}});return db[_0x688e('0x39')]['bulkCreate'](_0x3d78aa[_0x688e('0x59')](_0x4523aa),{'individualHooks':!![]});}})['then'](function(){if(_0x40d9c9){return _0x40d9c9[_0x688e('0x2c')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x40d9c9['loginInPause']||![],'mailPause':_0x40d9c9[_0x688e('0x4d')]||![],'chatPause':_0x40d9c9[_0x688e('0x4d')]||![],'faxPause':_0x40d9c9[_0x688e('0x4d')]||![],'smsPause':_0x40d9c9[_0x688e('0x4d')]||![],'openchannelPause':_0x40d9c9[_0x688e('0x4d')]||![],'pauseType':_0x40d9c9['loginInPause']?_0x688e('0x58'):null,'lastPauseAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'interface':_0x23a409});}})['then'](function(_0x3b79b5){_0x26915b(_0x3b79b5);})[_0x688e('0x18')](function(_0x50ab72){_0x5d03dd(_0x26f7c7[_0x688e('0x15')](0x1f4,_0x50ab72['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 406a11c..ab061de 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 _0x4da4=['user:','./user.events','update','emit','removeListener','register','length'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x4da4,0xa2));var _0x44da=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x4da4[_0x46a3e8];return _0xf1442e;};'use strict';var UserEvents=require(_0x44da('0x0'));var events=['save','remove',_0x44da('0x1')];function createListener(_0xb08661,_0x72be61){return function(_0x61ce50){_0x72be61[_0x44da('0x2')](_0xb08661,_0x61ce50);};}function removeListener(_0x21f228,_0x52df86){return function(){UserEvents[_0x44da('0x3')](_0x21f228,_0x52df86);};}exports[_0x44da('0x4')]=function(_0xe117f1){for(var _0x1c2ac7=0x0,_0x38bb23=events[_0x44da('0x5')];_0x1c2ac7<_0x38bb23;_0x1c2ac7++){var _0x37b9d6=events[_0x1c2ac7];var _0x1fcd67=createListener(_0x44da('0x6')+_0x37b9d6,_0xe117f1);UserEvents['on'](_0x37b9d6,_0x1fcd67);}}; \ No newline at end of file +var _0x1a32=['register','length','./user.events','remove','update','emit','removeListener'];(function(_0x2e1e3d,_0x2d6648){var _0x129355=function(_0x2f341a){while(--_0x2f341a){_0x2e1e3d['push'](_0x2e1e3d['shift']());}};_0x129355(++_0x2d6648);}(_0x1a32,0x1c2));var _0x21a3=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x1a32[_0x471a85];return _0x5f2039;};'use strict';var UserEvents=require(_0x21a3('0x0'));var events=['save',_0x21a3('0x1'),_0x21a3('0x2')];function createListener(_0x3fbd41,_0x1ae843){return function(_0x3a0638){_0x1ae843[_0x21a3('0x3')](_0x3fbd41,_0x3a0638);};}function removeListener(_0x596924,_0x78af5d){return function(){UserEvents[_0x21a3('0x4')](_0x596924,_0x78af5d);};}exports[_0x21a3('0x5')]=function(_0x2474c2){for(var _0x2b0328=0x0,_0x24ffe6=events[_0x21a3('0x6')];_0x2b0328<_0x24ffe6;_0x2b0328++){var _0x3726a4=events[_0x2b0328];var _0x2bbd0d=createListener('user:'+_0x3726a4,_0x2474c2);UserEvents['on'](_0x3726a4,_0x2bbd0d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5f2b4b4..445c050 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x39077a,_0x44224d){var _0x5cb3fc=function(_0x17f42d){while(--_0x17f42d){_0x39077a['push'](_0x39077a['shift']());}};_0x5cb3fc(++_0x44224d);}(_0xedd9,0xfc));var _0x9edd=function(_0x458594,_0x40114d){_0x458594=_0x458594-0x0;var _0x42cc64=_0xedd9[_0x458594];return _0x42cc64;};'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(_0x20048c,_0x337690){var _0x1d7f4b=function(_0x420930){while(--_0x420930){_0x20048c['push'](_0x20048c['shift']());}};_0x1d7f4b(++_0x337690);}(_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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a3e377c..60c827b 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 _0x2a1d=['INTEGER'];(function(_0x3d387a,_0x81c3ff){var _0xe3eebd=function(_0x3d90bf){while(--_0x3d90bf){_0x3d387a['push'](_0x3d387a['shift']());}};_0xe3eebd(++_0x81c3ff);}(_0x2a1d,0x113));var _0xd2a1=function(_0x1ce639,_0x2e518b){_0x1ce639=_0x1ce639-0x0;var _0x4b6109=_0x2a1d[_0x1ce639];return _0x4b6109;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd2a1('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc7a3=['INTEGER','exports'];(function(_0x4b3104,_0x2ca8ab){var _0x1c57da=function(_0x18ca66){while(--_0x18ca66){_0x4b3104['push'](_0x4b3104['shift']());}};_0x1c57da(++_0x2ca8ab);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x5d329b,_0x15387a){_0x5d329b=_0x5d329b-0x0;var _0x21eefb=_0xc7a3[_0x5d329b];return _0x21eefb;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'penalty':{'type':Sequelize[_0x3c7a('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 91b1221..31ff335 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 _0xa697=['user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue'];(function(_0xa34a64,_0x4055ca){var _0x459dd0=function(_0x176d05){while(--_0x176d05){_0xa34a64['push'](_0xa34a64['shift']());}};_0x459dd0(++_0x4055ca);}(_0xa697,0x187));var _0x7a69=function(_0x46c38d,_0x1a586d){_0x46c38d=_0x46c38d-0x0;var _0x2752d7=_0xa697[_0x46c38d];return _0x2752d7;};'use strict';var _=require(_0x7a69('0x0'));var util=require(_0x7a69('0x1'));var logger=require(_0x7a69('0x2'))(_0x7a69('0x3'));var moment=require(_0x7a69('0x4'));var BPromise=require(_0x7a69('0x5'));var rp=require(_0x7a69('0x6'));var fs=require('fs');var path=require(_0x7a69('0x7'));var rimraf=require(_0x7a69('0x8'));var config=require('../../config/environment');var attributes=require(_0x7a69('0x9'));module['exports']=function(_0x300ed1,_0x5cfa00){return _0x300ed1[_0x7a69('0xa')](_0x7a69('0xb'),attributes,{'tableName':_0x7a69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9528=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x208b82,_0xd915bf){var _0x3ee9bd=function(_0x7970dc){while(--_0x7970dc){_0x208b82['push'](_0x208b82['shift']());}};_0x3ee9bd(++_0xd915bf);}(_0x9528,0x1bc));var _0x8952=function(_0x1a7bb9,_0x31b400){_0x1a7bb9=_0x1a7bb9-0x0;var _0xd43994=_0x9528[_0x1a7bb9];return _0xd43994;};'use strict';var _=require(_0x8952('0x0'));var util=require(_0x8952('0x1'));var logger=require(_0x8952('0x2'))(_0x8952('0x3'));var moment=require(_0x8952('0x4'));var BPromise=require(_0x8952('0x5'));var rp=require(_0x8952('0x6'));var fs=require('fs');var path=require(_0x8952('0x7'));var rimraf=require(_0x8952('0x8'));var config=require(_0x8952('0x9'));var attributes=require(_0x8952('0xa'));module[_0x8952('0xb')]=function(_0x24eebd,_0x142f2f){return _0x24eebd[_0x8952('0xc')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 20dbf01..04fccec 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 _0x6f54=['request','then','debug','request\x20sent','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x22d4af,_0xce8763){var _0x3519c6=function(_0x3aaf4c){while(--_0x3aaf4c){_0x22d4af['push'](_0x22d4af['shift']());}};_0x3519c6(++_0xce8763);}(_0x6f54,0xc4));var _0x46f5=function(_0x19806c,_0x5da1ab){_0x19806c=_0x19806c-0x0;var _0x23dd76=_0x6f54[_0x19806c];return _0x23dd76;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x46f5('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f5('0x1'));var db=require(_0x46f5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x46f5('0x3'))(_0x46f5('0x4'));var config=require(_0x46f5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46f5('0x6')][_0x46f5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x401945,_0x1de3c4,_0x9f7b3){return new BPromise(function(_0x4b9ce1,_0x2e35ee){return client[_0x46f5('0x8')](_0x401945,_0x9f7b3)[_0x46f5('0x9')](function(_0x3691e9){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1de3c4,'request\x20sent');logger[_0x46f5('0xa')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1de3c4,_0x46f5('0xb'),JSON[_0x46f5('0xc')](_0x3691e9));if(_0x3691e9[_0x46f5('0xd')]){if(_0x3691e9[_0x46f5('0xd')][_0x46f5('0xe')]===0x1f4){logger[_0x46f5('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1de3c4,_0x3691e9[_0x46f5('0xd')][_0x46f5('0xf')]);return _0x2e35ee(_0x3691e9[_0x46f5('0xd')][_0x46f5('0xf')]);}logger[_0x46f5('0xd')](_0x46f5('0x10'),_0x1de3c4,_0x3691e9['error'][_0x46f5('0xf')]);return _0x4b9ce1(_0x3691e9['error'][_0x46f5('0xf')]);}else{logger['info'](_0x46f5('0x10'),_0x1de3c4,_0x46f5('0xb'));_0x4b9ce1(_0x3691e9['result']['message']);}})['catch'](function(_0x4bae6a){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x1de3c4,_0x4bae6a);_0x2e35ee(_0x4bae6a);});});} \ No newline at end of file +var _0xd6a9=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xd6a9,0x1e3));var _0x9d6a=function(_0x388ff1,_0x4a991f){_0x388ff1=_0x388ff1-0x0;var _0x38d4ae=_0xd6a9[_0x388ff1];return _0x38d4ae;};'use strict';var _=require('lodash');var util=require(_0x9d6a('0x0'));var moment=require(_0x9d6a('0x1'));var BPromise=require(_0x9d6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d6a('0x3'))['db'];var utils=require(_0x9d6a('0x4'));var logger=require('../../config/logger')(_0x9d6a('0x5'));var config=require('../../config/environment');var jayson=require(_0x9d6a('0x6'));var client=jayson[_0x9d6a('0x7')][_0x9d6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41fb69,_0x2e7411,_0x5712ee){return new BPromise(function(_0x13b4c9,_0x317a77){return client['request'](_0x41fb69,_0x5712ee)[_0x9d6a('0x9')](function(_0x30abaa){logger[_0x9d6a('0xa')](_0x9d6a('0xb'),_0x2e7411,_0x9d6a('0xc'));logger['debug'](_0x9d6a('0xd'),_0x2e7411,_0x9d6a('0xc'),JSON[_0x9d6a('0xe')](_0x30abaa));if(_0x30abaa[_0x9d6a('0xf')]){if(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x10')]===0x1f4){logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x30abaa['error'][_0x9d6a('0x11')]);return _0x317a77(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);}logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);return _0x13b4c9(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);}else{logger[_0x9d6a('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x2e7411,_0x9d6a('0xc'));_0x13b4c9(_0x30abaa['result'][_0x9d6a('0x11')]);}})['catch'](function(_0x116cda){logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x116cda);_0x317a77(_0x116cda);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2bb0e49..113edf9 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x784768,_0x3d0c75){var _0x3b76fc=function(_0x2fdce9){while(--_0x2fdce9){_0x784768['push'](_0x784768['shift']());}};_0x3b76fc(++_0x3d0c75);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5155d5,_0x37283d){var _0x4daced=function(_0x265a4d){while(--_0x265a4d){_0x5155d5['push'](_0x5155d5['shift']());}};_0x4daced(++_0x37283d);}(_0xe706,0xa3));var _0x6e70=function(_0xd333a1,_0x1f61a0){_0xd333a1=_0xd333a1-0x0;var _0x553a60=_0xe706[_0xd333a1];return _0x553a60;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index abc1362..6839dc5 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 _0xb023=['STRING','sequelize','exports','INTEGER'];(function(_0x13869e,_0x57d3c7){var _0xf9ef3c=function(_0x4d04c0){while(--_0x4d04c0){_0x13869e['push'](_0x13869e['shift']());}};_0xf9ef3c(++_0x57d3c7);}(_0xb023,0x1c9));var _0x3b02=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0xb023[_0x9c3c56];return _0x2dd782;};'use strict';var Sequelize=require(_0x3b02('0x0'));module[_0x3b02('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3b02('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3b02('0x3')]}}; \ No newline at end of file +var _0x446a=['INTEGER','STRING','sequelize'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x446a,0x12e));var _0xa446=function(_0x24b219,_0x1ba8bd){_0x24b219=_0x24b219-0x0;var _0x538d48=_0x446a[_0x24b219];return _0x538d48;};'use strict';var Sequelize=require(_0xa446('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa446('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa446('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa446('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 798c32f..a20933f 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 _0x4a57=['moment','bluebird','path','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','api'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x4a57,0x102));var _0x74a5=function(_0x29de86,_0x1427d5){_0x29de86=_0x29de86-0x0;var _0x25d145=_0x4a57[_0x29de86];return _0x25d145;};'use strict';var _=require(_0x74a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x74a5('0x1'));var moment=require(_0x74a5('0x2'));var BPromise=require(_0x74a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74a5('0x4'));var rimraf=require('rimraf');var config=require(_0x74a5('0x5'));var attributes=require(_0x74a5('0x6'));module['exports']=function(_0x5edcb6,_0x3baecb){return _0x5edcb6[_0x74a5('0x7')](_0x74a5('0x8'),attributes,{'tableName':_0x74a5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c50=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x49e1b4,_0x480780){var _0x402f2a=function(_0x371ffe){while(--_0x371ffe){_0x49e1b4['push'](_0x49e1b4['shift']());}};_0x402f2a(++_0x480780);}(_0x5c50,0x184));var _0x05c5=function(_0x515be2,_0x51b3ff){_0x515be2=_0x515be2-0x0;var _0x514679=_0x5c50[_0x515be2];return _0x514679;};'use strict';var _=require(_0x05c5('0x0'));var util=require(_0x05c5('0x1'));var logger=require(_0x05c5('0x2'))('api');var moment=require(_0x05c5('0x3'));var BPromise=require(_0x05c5('0x4'));var rp=require(_0x05c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05c5('0x6'));var config=require(_0x05c5('0x7'));var attributes=require(_0x05c5('0x8'));module[_0x05c5('0x9')]=function(_0x47c0ca,_0x1d25e3){return _0x47c0ca[_0x05c5('0xa')](_0x05c5('0xb'),attributes,{'tableName':_0x05c5('0xc'),'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 5142b3e..4e8ec5b 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 _0x5202=['request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserFaxQueue,\x20%s,\x20%s','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x1ed5f6,_0x4c5116){var _0x40809a=function(_0x3a79be){while(--_0x3a79be){_0x1ed5f6['push'](_0x1ed5f6['shift']());}};_0x40809a(++_0x4c5116);}(_0x5202,0xbf));var _0x2520=function(_0x53b6a1,_0x3d66b5){_0x53b6a1=_0x53b6a1-0x0;var _0x4122f6=_0x5202[_0x53b6a1];return _0x4122f6;};'use strict';var _=require(_0x2520('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2520('0x1'));var rs=require(_0x2520('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2520('0x3'))['db'];var utils=require(_0x2520('0x4'));var logger=require('../../config/logger')(_0x2520('0x5'));var config=require(_0x2520('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2520('0x7')][_0x2520('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22dcd0,_0x16d2a9,_0x4f9c8f){return new BPromise(function(_0x2f067a,_0x2a2a6b){return client[_0x2520('0x9')](_0x22dcd0,_0x4f9c8f)[_0x2520('0xa')](function(_0x5d1ae0){logger[_0x2520('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x16d2a9,_0x2520('0xc'));logger[_0x2520('0xd')](_0x2520('0xe'),_0x16d2a9,'request\x20sent',JSON['stringify'](_0x5d1ae0));if(_0x5d1ae0[_0x2520('0xf')]){if(_0x5d1ae0[_0x2520('0xf')][_0x2520('0x10')]===0x1f4){logger[_0x2520('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x16d2a9,_0x5d1ae0[_0x2520('0xf')][_0x2520('0x11')]);return _0x2a2a6b(_0x5d1ae0[_0x2520('0xf')][_0x2520('0x11')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x16d2a9,_0x5d1ae0[_0x2520('0xf')]['message']);return _0x2f067a(_0x5d1ae0[_0x2520('0xf')][_0x2520('0x11')]);}else{logger[_0x2520('0xb')](_0x2520('0x12'),_0x16d2a9,'request\x20sent');_0x2f067a(_0x5d1ae0[_0x2520('0x13')][_0x2520('0x11')]);}})['catch'](function(_0x2aa6c4){logger['error'](_0x2520('0x12'),_0x16d2a9,_0x2aa6c4);_0x2a2a6b(_0x2aa6c4);});});} \ No newline at end of file +var _0x542c=['rpc','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x28bbb9,_0x319419){var _0x104c01=function(_0x24c401){while(--_0x24c401){_0x28bbb9['push'](_0x28bbb9['shift']());}};_0x104c01(++_0x319419);}(_0x542c,0x17f));var _0xc542=function(_0x23e32e,_0x2d78de){_0x23e32e=_0x23e32e-0x0;var _0x489bd8=_0x542c[_0x23e32e];return _0x489bd8;};'use strict';var _=require(_0xc542('0x0'));var util=require(_0xc542('0x1'));var moment=require(_0xc542('0x2'));var BPromise=require(_0xc542('0x3'));var rs=require(_0xc542('0x4'));var fs=require('fs');var Redis=require(_0xc542('0x5'));var db=require(_0xc542('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc542('0x7'))(_0xc542('0x8'));var config=require('../../config/environment');var jayson=require(_0xc542('0x9'));var client=jayson['client'][_0xc542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a193,_0x55f5ef,_0x4a0e56){return new BPromise(function(_0x420770,_0x5079b8){return client[_0xc542('0xb')](_0x12a193,_0x4a0e56)[_0xc542('0xc')](function(_0x4a601d){logger[_0xc542('0xd')](_0xc542('0xe'),_0x55f5ef,'request\x20sent');logger[_0xc542('0xf')](_0xc542('0x10'),_0x55f5ef,_0xc542('0x11'),JSON[_0xc542('0x12')](_0x4a601d));if(_0x4a601d['error']){if(_0x4a601d[_0xc542('0x13')][_0xc542('0x14')]===0x1f4){logger[_0xc542('0x13')](_0xc542('0xe'),_0x55f5ef,_0x4a601d[_0xc542('0x13')][_0xc542('0x15')]);return _0x5079b8(_0x4a601d[_0xc542('0x13')]['message']);}logger[_0xc542('0x13')](_0xc542('0xe'),_0x55f5ef,_0x4a601d['error'][_0xc542('0x15')]);return _0x420770(_0x4a601d[_0xc542('0x13')][_0xc542('0x15')]);}else{logger[_0xc542('0xd')](_0xc542('0xe'),_0x55f5ef,_0xc542('0x11'));_0x420770(_0x4a601d['result']['message']);}})[_0xc542('0x16')](function(_0xa4c23b){logger[_0xc542('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x55f5ef,_0xa4c23b);_0x5079b8(_0xa4c23b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8586613..f0d5e8e 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5cd1bf,_0x19c3ac){var _0x373923=function(_0x2b81a1){while(--_0x2b81a1){_0x5cd1bf['push'](_0x5cd1bf['shift']());}};_0x373923(++_0x19c3ac);}(_0xe706,0xa3));var _0x6e70=function(_0x50c86a,_0x2fec99){_0x50c86a=_0x50c86a-0x0;var _0x53420a=_0xe706[_0x50c86a];return _0x53420a;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2e3ebb,_0x5afc59){var _0x8f027f=function(_0x29b2f3){while(--_0x29b2f3){_0x2e3ebb['push'](_0x2e3ebb['shift']());}};_0x8f027f(++_0x5afc59);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d8ead2c..16254a7 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 _0xcd0d=['exports','INTEGER','sequelize'];(function(_0x378789,_0x894ede){var _0x493aa7=function(_0x293ab8){while(--_0x293ab8){_0x378789['push'](_0x378789['shift']());}};_0x493aa7(++_0x894ede);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0xcd0d[_0x1d56fd];return _0x1f9f71;};'use strict';var Sequelize=require(_0xdcd0('0x0'));module[_0xdcd0('0x1')]={'penalty':{'type':Sequelize[_0xdcd0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf54=['INTEGER','sequelize'];(function(_0x24be2d,_0x4b8647){var _0x4f74ec=function(_0x35e6f4){while(--_0x35e6f4){_0x24be2d['push'](_0x24be2d['shift']());}};_0x4f74ec(++_0x4b8647);}(_0xbf54,0x18f));var _0x4bf5=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xbf54[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x4bf5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4bf5('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 36cb97e..f6d1e72 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 _0xa386=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x1087b8,_0x38eca3){var _0x5d8738=function(_0x530825){while(--_0x530825){_0x1087b8['push'](_0x1087b8['shift']());}};_0x5d8738(++_0x38eca3);}(_0xa386,0x1e9));var _0x6a38=function(_0x155eb8,_0x5aca30){_0x155eb8=_0x155eb8-0x0;var _0x159589=_0xa386[_0x155eb8];return _0x159589;};'use strict';var _=require(_0x6a38('0x0'));var util=require(_0x6a38('0x1'));var logger=require(_0x6a38('0x2'))('api');var moment=require(_0x6a38('0x3'));var BPromise=require(_0x6a38('0x4'));var rp=require(_0x6a38('0x5'));var fs=require('fs');var path=require(_0x6a38('0x6'));var rimraf=require(_0x6a38('0x7'));var config=require(_0x6a38('0x8'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x4873a7,_0xd7c25b){return _0x4873a7[_0x6a38('0x9')](_0x6a38('0xa'),attributes,{'tableName':_0x6a38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97ce=['../../config/environment','./userMailQueue.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x31ee03,_0x17ab14){var _0x3bee07=function(_0x15102c){while(--_0x15102c){_0x31ee03['push'](_0x31ee03['shift']());}};_0x3bee07(++_0x17ab14);}(_0x97ce,0x193));var _0xe97c=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x97ce[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var logger=require(_0xe97c('0x2'))(_0xe97c('0x3'));var moment=require('moment');var BPromise=require(_0xe97c('0x4'));var rp=require(_0xe97c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe97c('0x6'));var config=require(_0xe97c('0x7'));var attributes=require(_0xe97c('0x8'));module['exports']=function(_0x452bb4,_0x5d8f05){return _0x452bb4[_0xe97c('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 b79eb69..52f40d9 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x49ae67,_0x326efa){var _0x112b94=function(_0x44746a){while(--_0x44746a){_0x49ae67['push'](_0x49ae67['shift']());}};_0x112b94(++_0x326efa);}(_0x3e74,0x175));var _0x43e7=function(_0x23846f,_0x3baa4b){_0x23846f=_0x23846f-0x0;var _0x2592f1=_0x3e74[_0x23846f];return _0x2592f1;};'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']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\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')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x968f7c,_0x3d48d1){var _0x5aadbe=function(_0x43a380){while(--_0x43a380){_0x968f7c['push'](_0x968f7c['shift']());}};_0x5aadbe(++_0x3d48d1);}(_0x34e8,0x12c));var _0x834e=function(_0x218280,_0x5a5b77){_0x218280=_0x218280-0x0;var _0x1041a2=_0x34e8[_0x218280];return _0x1041a2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 37b9857..7942e13 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 _0x43b9=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','util'];(function(_0x179609,_0x25e189){var _0x484e73=function(_0x46ecca){while(--_0x46ecca){_0x179609['push'](_0x179609['shift']());}};_0x484e73(++_0x25e189);}(_0x43b9,0x1c7));var _0x943b=function(_0x176f3b,_0x3a00e3){_0x176f3b=_0x176f3b-0x0;var _0x2aaa7c=_0x43b9[_0x176f3b];return _0x2aaa7c;};'use strict';var multer=require('multer');var util=require(_0x943b('0x0'));var path=require(_0x943b('0x1'));var timeout=require(_0x943b('0x2'));var express=require(_0x943b('0x3'));var router=express[_0x943b('0x4')]();var fs_extra=require(_0x943b('0x5'));var auth=require(_0x943b('0x6'));var interaction=require(_0x943b('0x7'));var config=require(_0x943b('0x8'));var controller=require('./userNotification.controller');router[_0x943b('0x9')]('/',auth['isAuthenticated'](),controller[_0x943b('0xa')]);module[_0x943b('0xb')]=router; \ No newline at end of file +var _0x6cd3=['post','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x6cd3,0xf4));var _0x36cd=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x6cd3[_0x334fea];return _0x3c5829;};'use strict';var multer=require(_0x36cd('0x0'));var util=require('util');var path=require(_0x36cd('0x1'));var timeout=require(_0x36cd('0x2'));var express=require(_0x36cd('0x3'));var router=express[_0x36cd('0x4')]();var fs_extra=require(_0x36cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x36cd('0x6'));var config=require(_0x36cd('0x7'));var controller=require(_0x36cd('0x8'));router[_0x36cd('0x9')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x36cd('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b2e8abd..649486b 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 _0xcf20=['TEXT','STRING','BOOLEAN','exports'];(function(_0x4ba8d8,_0x36e552){var _0x4d14a8=function(_0xf35c42){while(--_0xf35c42){_0x4ba8d8['push'](_0x4ba8d8['shift']());}};_0x4d14a8(++_0x36e552);}(_0xcf20,0xf3));var _0x0cf2=function(_0x2137da,_0x457383){_0x2137da=_0x2137da-0x0;var _0x6b060a=_0xcf20[_0x2137da];return _0x6b060a;};'use strict';var Sequelize=require('sequelize');module[_0x0cf2('0x0')]={'body':{'type':Sequelize[_0x0cf2('0x1')]},'senderName':{'type':Sequelize[_0x0cf2('0x2')]},'recipientsId':{'type':Sequelize[_0x0cf2('0x1')]},'recipientsDescription':{'type':Sequelize[_0x0cf2('0x2')]},'beep':{'type':Sequelize[_0x0cf2('0x3')]}}; \ No newline at end of file +var _0xbcfb=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1928df,_0x51b325){var _0x260d12=function(_0x17908e){while(--_0x17908e){_0x1928df['push'](_0x1928df['shift']());}};_0x260d12(++_0x51b325);}(_0xbcfb,0xbd));var _0xbbcf=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xbcfb[_0x510b98];return _0x45e775;};'use strict';var Sequelize=require(_0xbbcf('0x0'));module[_0xbbcf('0x1')]={'body':{'type':Sequelize[_0xbbcf('0x2')]},'senderName':{'type':Sequelize[_0xbbcf('0x3')]},'recipientsId':{'type':Sequelize[_0xbbcf('0x2')]},'recipientsDescription':{'type':Sequelize[_0xbbcf('0x3')]},'beep':{'type':Sequelize[_0xbbcf('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 081b615..99012d5 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 _0x97fa=['startCase','User','union','ids','queue','replace','Queue','push','all','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','text','body','ValidationError','hasOwnProperty','TemplateId','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach'];(function(_0xdf5f9a,_0x607753){var _0x403c8f=function(_0x3a4d9f){while(--_0x3a4d9f){_0xdf5f9a['push'](_0xdf5f9a['shift']());}};_0x403c8f(++_0x607753);}(_0x97fa,0x1e5));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa97f('0x0'));var rimraf=require(_0xa97f('0x1'));var zipdir=require(_0xa97f('0x2'));var jsonpatch=require(_0xa97f('0x3'));var rp=require(_0xa97f('0x4'));var moment=require(_0xa97f('0x5'));var BPromise=require(_0xa97f('0x6'));var Mustache=require(_0xa97f('0x7'));var util=require(_0xa97f('0x8'));var path=require(_0xa97f('0x9'));var sox=require(_0xa97f('0xa'));var csv=require(_0xa97f('0xb'));var ejs=require(_0xa97f('0xc'));var fs=require('fs');var fs_extra=require(_0xa97f('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa97f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa97f('0xf'));var Papa=require(_0xa97f('0x10'));var Redis=require(_0xa97f('0x11'));var authService=require(_0xa97f('0x12'));var qs=require(_0xa97f('0x13'));var as=require(_0xa97f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa97f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa97f('0x16'));var db=require(_0xa97f('0x17'))['db'];config['redis']=_[_0xa97f('0x18')](config[_0xa97f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa97f('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x1583a7,_0x2e64ca){_0x2e64ca=_0x2e64ca||0xcc;return function(_0x3f6743){if(_0x3f6743){return _0x1583a7['sendStatus'](_0x2e64ca);}return _0x1583a7[_0xa97f('0x1b')](_0x2e64ca)[_0xa97f('0x1c')]();};}function respondWithResult(_0x2325a6,_0x4fba89){_0x4fba89=_0x4fba89||0xc8;return function(_0x469547){if(_0x469547){return _0x2325a6[_0xa97f('0x1b')](_0x4fba89)['json'](_0x469547);}};}function respondWithFilteredResult(_0x2093f1,_0x289817){return function(_0x4ac040){if(_0x4ac040){var _0x25cbee=typeof _0x289817[_0xa97f('0x1d')]==='undefined'&&typeof _0x289817[_0xa97f('0x1e')]===_0xa97f('0x1f');var _0x11c045=_0x4ac040[_0xa97f('0x20')];var _0x6b3085=_0x25cbee?0x0:_0x289817[_0xa97f('0x1d')];var _0x5a6c92=_0x25cbee?_0x4ac040[_0xa97f('0x20')]:_0x289817['offset']+_0x289817[_0xa97f('0x1e')];var _0x153cc9;if(_0x5a6c92>=_0x11c045){_0x5a6c92=_0x11c045;_0x153cc9=0xc8;}else{_0x153cc9=0xce;}_0x2093f1[_0xa97f('0x1b')](_0x153cc9);return _0x2093f1[_0xa97f('0x21')](_0xa97f('0x22'),_0x6b3085+'-'+_0x5a6c92+'/'+_0x11c045)['json'](_0x4ac040);}return null;};}function patchUpdates(_0x157763){return function(_0x10b355){try{jsonpatch[_0xa97f('0x23')](_0x10b355,_0x157763,!![]);}catch(_0x38a926){return BPromise[_0xa97f('0x24')](_0x38a926);}return _0x10b355[_0xa97f('0x25')]();};}function saveUpdates(_0x5cdc48,_0x5f2be1){return function(_0x4e89bc){if(_0x4e89bc){return _0x4e89bc[_0xa97f('0x26')](_0x5cdc48)[_0xa97f('0x27')](function(_0x389371){return _0x389371;});}return null;};}function removeEntity(_0x12072b,_0x540bb7){return function(_0x6f553c){if(_0x6f553c){return _0x6f553c[_0xa97f('0x28')]()[_0xa97f('0x27')](function(){_0x12072b[_0xa97f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110bf7,_0x5470fb){return function(_0x12b1d7){if(!_0x12b1d7){_0x110bf7[_0xa97f('0x29')](0x194);}return _0x12b1d7;};}function handleError(_0x4ac398,_0x2c94e1){_0x2c94e1=_0x2c94e1||0x1f4;return function(_0x2bf7c7){logger[_0xa97f('0x2a')](_0x2bf7c7[_0xa97f('0x2b')]);if(_0x2bf7c7['name']){delete _0x2bf7c7['name'];}_0x4ac398[_0xa97f('0x1b')](_0x2c94e1)['send'](_0x2bf7c7);};}exports['sendUserNotification']=function(_0x35c7b6,_0x303878,_0x3e6ed4){if(!_0x35c7b6['body']['hasOwnProperty'](_0xa97f('0x2c'))&&!_0x35c7b6[_0xa97f('0x2d')]['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0xa97f('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x35c7b6['body'][_0xa97f('0x2f')](_0xa97f('0x30'))&&!_0x35c7b6['body'][_0xa97f('0x2f')](_0xa97f('0x31'))){throw new db[(_0xa97f('0x32'))][(_0xa97f('0x2e'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x35c7b6['body'][_0xa97f('0x2f')](_0xa97f('0x33'))){throw new db['Sequelize']['ValidationError'](_0xa97f('0x34'));}else{try{var _0x4e9577=JSON['parse'](_0x35c7b6[_0xa97f('0x2d')][_0xa97f('0x33')]);}catch(_0x1d8bfd){logger[_0xa97f('0x2a')](_0x1d8bfd);throw new db[(_0xa97f('0x32'))][(_0xa97f('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x293cb9=[_0xa97f('0x35'),_0xa97f('0x36'),'mailqueue','openchannelqueue',_0xa97f('0x37'),_0xa97f('0x38'),_0xa97f('0x39'),_0xa97f('0x3a'),_0xa97f('0x3b')];if(_[_0xa97f('0x3c')](_0x4e9577,function(_0x4904a9){return!_[_0xa97f('0x3d')](_0x293cb9,_0x4904a9['model'][_0xa97f('0x3e')]());})){throw new db[(_0xa97f('0x32'))]['ValidationError'](_0xa97f('0x3f'));}}}var _0x4bfe34={};_0x4bfe34[_0xa97f('0x40')]=_0x35c7b6['body']['hasOwnProperty'](_0xa97f('0x40'))?_0x35c7b6[_0xa97f('0x2d')][_0xa97f('0x40')]:_0x35c7b6[_0xa97f('0x3b')][_0xa97f('0x41')];_0x4bfe34[_0xa97f('0x42')]=_['isEmpty'](_0x35c7b6['body'][_0xa97f('0x42')])?null:_0x35c7b6[_0xa97f('0x2d')][_0xa97f('0x42')];_0x4bfe34[_0xa97f('0x43')]=_0x35c7b6[_0xa97f('0x2d')][_0xa97f('0x43')]||![];_0x4bfe34[_0xa97f('0x44')]=_0x35c7b6[_0xa97f('0x3b')]['id'];return getContent(_0x35c7b6[_0xa97f('0x2d')])[_0xa97f('0x27')](function(_0x26ecca){_0x4bfe34[_0xa97f('0x2d')]=_0x26ecca;return getRecipients(_0x4e9577);})[_0xa97f('0x27')](function(_0x1d8f5f){_0x4bfe34[_0xa97f('0x45')]=_[_0xa97f('0x46')](_0x1d8f5f)[_0xa97f('0x47')](',');return db[_0xa97f('0x48')][_0xa97f('0x49')](function(_0x110488){return db[_0xa97f('0x4a')][_0xa97f('0x4b')](_0x4bfe34,{'raw':!![],'transaction':_0x110488})['then'](function(_0x1e34e5){var _0x4ff4ce={'sender':_0x4bfe34[_0xa97f('0x40')],'description':_0x4bfe34['recipientsDescription'],'content':_0x4bfe34[_0xa97f('0x2d')],'beep':_0x4bfe34[_0xa97f('0x43')]};_0x1d8f5f['forEach'](function(_0x18d139){_0x4ff4ce[_0xa97f('0x4c')]=_0x18d139;socket[_0xa97f('0x4d')](_0xa97f('0x4e'),_0x4ff4ce);});return _0x1e34e5;});});})[_0xa97f('0x27')](respondWithResult(_0x303878,0xc9))[_0xa97f('0x4f')](handleError(_0x303878,null));};function getContent(_0x4f1987){return new BPromise(function(_0x3c2175,_0x3efed5){if(_0x4f1987[_0xa97f('0x2c')]){_0x3c2175(_0x4f1987[_0xa97f('0x2c')]);return;}return db['Template'][_0xa97f('0x50')]({'attributes':[_0xa97f('0x51')],'where':{'id':_0x4f1987[_0xa97f('0x30')]},'raw':!![]})['then'](function(_0x37713a){if(!_0x37713a)throw new db[(_0xa97f('0x32'))][(_0xa97f('0x2e'))](_0xa97f('0x52'));var _0x32b92a=Mustache[_0xa97f('0x53')](_0x37713a[_0xa97f('0x51')],_0x4f1987[_0xa97f('0x31')]);_0x3c2175(_0x32b92a);})[_0xa97f('0x4f')](function(_0x3527a8){_0x3efed5(_0x3527a8);});});}function getRecipients(_0xfaf8f1){return new BPromise(function(_0x2194e7,_0x59977b){var _0x1c09ee=[];var _0x1ea45f=[];_0xfaf8f1[_0xa97f('0x54')](function(_0x5d4cd7){var _0x56ddf7=_[_0xa97f('0x55')](_0x5d4cd7['model'][_0xa97f('0x3e')]());if(_0x56ddf7===_0xa97f('0x56')){_0x1c09ee=_[_0xa97f('0x57')](_0x1c09ee,_0x5d4cd7[_0xa97f('0x58')]);}else{if(_[_0xa97f('0x3d')](_0x56ddf7,_0xa97f('0x59')))_0x56ddf7=_0x56ddf7[_0xa97f('0x5a')]('queue',_0xa97f('0x5b'));_0x5d4cd7[_0xa97f('0x58')][_0xa97f('0x54')](function(_0x569f10){_0x1ea45f[_0xa97f('0x5c')](getAgents(_0x56ddf7,_0x569f10));});}});return BPromise[_0xa97f('0x5d')](_0x1ea45f)[_0xa97f('0x27')](function(_0x19735b){_0x1c09ee=_[_0xa97f('0x57')](_0x1c09ee,_['flatten'](_0x19735b));_0x2194e7(_0x1c09ee);})['catch'](function(_0x19ee49){_0x59977b(_0x19ee49);});});}function getAgents(_0x29d2c4,_0x580318){return new BPromise(function(_0x1b66aa,_0x2bb565){return db[_0x29d2c4][_0xa97f('0x50')]({'where':{'id':_0x580318}})[_0xa97f('0x27')](function(_0x36a39c){return _0x36a39c['getAgents']({'attributes':['id'],'raw':!![]})[_0xa97f('0x27')](function(_0x233187){var _0x1b427f=_[_0xa97f('0x5e')](_0x233187,'id');_0x1b66aa(_0x1b427f);});})['catch'](function(_0x1faeec){_0x2bb565(_0x1faeec);});});} \ No newline at end of file +var _0x121a=['user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','render','User','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team'];(function(_0x371005,_0xf16eb4){var _0x2f79d3=function(_0x417e0f){while(--_0x417e0f){_0x371005['push'](_0x371005['shift']());}};_0x2f79d3(++_0xf16eb4);}(_0x121a,0x86));var _0xa121=function(_0x16dffa,_0x139bee){_0x16dffa=_0x16dffa-0x0;var _0x29a5c6=_0x121a[_0x16dffa];return _0x29a5c6;};'use strict';var emlformat=require(_0xa121('0x0'));var rimraf=require(_0xa121('0x1'));var zipdir=require(_0xa121('0x2'));var jsonpatch=require(_0xa121('0x3'));var rp=require('request-promise');var moment=require(_0xa121('0x4'));var BPromise=require(_0xa121('0x5'));var Mustache=require(_0xa121('0x6'));var util=require(_0xa121('0x7'));var path=require('path');var sox=require(_0xa121('0x8'));var csv=require(_0xa121('0x9'));var ejs=require(_0xa121('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa121('0xb'));var squel=require(_0xa121('0xc'));var crypto=require(_0xa121('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa121('0xe'));var toCsv=require(_0xa121('0x9'));var querystring=require('querystring');var Papa=require(_0xa121('0xf'));var Redis=require('ioredis');var authService=require(_0xa121('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa121('0x11'));var hardwareService=require(_0xa121('0x12'));var logger=require(_0xa121('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa121('0x14'));var licenseUtil=require(_0xa121('0x15'));var db=require(_0xa121('0x16'))['db'];config[_0xa121('0x17')]=_['defaults'](config[_0xa121('0x17')],{'host':_0xa121('0x18'),'port':0x18eb});var socket=require(_0xa121('0x19'))(new Redis(config[_0xa121('0x17')]));require('./userNotification.socket')[_0xa121('0x1a')](socket);function respondWithStatusCode(_0x509791,_0x30959e){_0x30959e=_0x30959e||0xcc;return function(_0x5ea177){if(_0x5ea177){return _0x509791[_0xa121('0x1b')](_0x30959e);}return _0x509791[_0xa121('0x1c')](_0x30959e)['end']();};}function respondWithResult(_0x5ca8e5,_0x52fa2d){_0x52fa2d=_0x52fa2d||0xc8;return function(_0x10a7c5){if(_0x10a7c5){return _0x5ca8e5[_0xa121('0x1c')](_0x52fa2d)[_0xa121('0x1d')](_0x10a7c5);}};}function respondWithFilteredResult(_0x34b93e,_0x9d6748){return function(_0xa45ae3){if(_0xa45ae3){var _0x2bbbec=typeof _0x9d6748['offset']===_0xa121('0x1e')&&typeof _0x9d6748[_0xa121('0x1f')]===_0xa121('0x1e');var _0x4ca7a7=_0xa45ae3[_0xa121('0x20')];var _0xcae367=_0x2bbbec?0x0:_0x9d6748[_0xa121('0x21')];var _0x429ca9=_0x2bbbec?_0xa45ae3[_0xa121('0x20')]:_0x9d6748['offset']+_0x9d6748[_0xa121('0x1f')];var _0x10c870;if(_0x429ca9>=_0x4ca7a7){_0x429ca9=_0x4ca7a7;_0x10c870=0xc8;}else{_0x10c870=0xce;}_0x34b93e[_0xa121('0x1c')](_0x10c870);return _0x34b93e['set'](_0xa121('0x22'),_0xcae367+'-'+_0x429ca9+'/'+_0x4ca7a7)[_0xa121('0x1d')](_0xa45ae3);}return null;};}function patchUpdates(_0x359631){return function(_0x1c6c38){try{jsonpatch[_0xa121('0x23')](_0x1c6c38,_0x359631,!![]);}catch(_0x2482e4){return BPromise[_0xa121('0x24')](_0x2482e4);}return _0x1c6c38['save']();};}function saveUpdates(_0x3484f1,_0x36e823){return function(_0x42d90c){if(_0x42d90c){return _0x42d90c[_0xa121('0x25')](_0x3484f1)[_0xa121('0x26')](function(_0x350bf8){return _0x350bf8;});}return null;};}function removeEntity(_0x5e5b7f,_0x429615){return function(_0x4f35ec){if(_0x4f35ec){return _0x4f35ec[_0xa121('0x27')]()[_0xa121('0x26')](function(){_0x5e5b7f[_0xa121('0x1c')](0xcc)[_0xa121('0x28')]();});}};}function handleEntityNotFound(_0x10cc8e,_0x2098cc){return function(_0xce46ce){if(!_0xce46ce){_0x10cc8e[_0xa121('0x1b')](0x194);}return _0xce46ce;};}function handleError(_0x51ef3e,_0x2524be){_0x2524be=_0x2524be||0x1f4;return function(_0x31bb90){logger['error'](_0x31bb90[_0xa121('0x29')]);if(_0x31bb90['name']){delete _0x31bb90[_0xa121('0x2a')];}_0x51ef3e[_0xa121('0x1c')](_0x2524be)[_0xa121('0x2b')](_0x31bb90);};}exports['sendUserNotification']=function(_0x2d24aa,_0x5be45d,_0x4cc508){if(!_0x2d24aa['body']['hasOwnProperty'](_0xa121('0x2c'))&&!_0x2d24aa[_0xa121('0x2d')][_0xa121('0x2e')](_0xa121('0x2f'))){throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2d24aa['body']['hasOwnProperty'](_0xa121('0x2f'))&&!_0x2d24aa['body'][_0xa121('0x2e')]('view')){throw new db['Sequelize']['ValidationError'](_0xa121('0x32'));}if(!_0x2d24aa['body'][_0xa121('0x2e')](_0xa121('0x33'))){throw new db['Sequelize'][(_0xa121('0x31'))](_0xa121('0x34'));}else{try{var _0x2f3e41=JSON[_0xa121('0x35')](_0x2d24aa[_0xa121('0x2d')]['recipients']);}catch(_0x957cd7){logger[_0xa121('0x36')](_0x957cd7);throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))](_0xa121('0x37'));}var _0x246a42=[_0xa121('0x38'),'faxqueue',_0xa121('0x39'),'openchannelqueue',_0xa121('0x3a'),_0xa121('0x3b'),_0xa121('0x3c'),_0xa121('0x3d'),_0xa121('0x3e')];if(_[_0xa121('0x3f')](_0x2f3e41,function(_0xc5ea7d){return!_[_0xa121('0x40')](_0x246a42,_0xc5ea7d[_0xa121('0x41')][_0xa121('0x42')]());})){throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))](_0xa121('0x43'));}}}var _0x241b15={};_0x241b15[_0xa121('0x44')]=_0x2d24aa[_0xa121('0x2d')][_0xa121('0x2e')]('senderName')?_0x2d24aa[_0xa121('0x2d')][_0xa121('0x44')]:_0x2d24aa[_0xa121('0x3e')][_0xa121('0x45')];_0x241b15[_0xa121('0x46')]=_[_0xa121('0x47')](_0x2d24aa[_0xa121('0x2d')]['recipientsDescription'])?null:_0x2d24aa['body'][_0xa121('0x46')];_0x241b15['beep']=_0x2d24aa[_0xa121('0x2d')][_0xa121('0x48')]||![];_0x241b15['SenderId']=_0x2d24aa['user']['id'];return getContent(_0x2d24aa[_0xa121('0x2d')])[_0xa121('0x26')](function(_0x59cb83){_0x241b15[_0xa121('0x2d')]=_0x59cb83;return getRecipients(_0x2f3e41);})[_0xa121('0x26')](function(_0x367be6){_0x241b15[_0xa121('0x49')]=_[_0xa121('0x4a')](_0x367be6)[_0xa121('0x4b')](',');return db[_0xa121('0x4c')][_0xa121('0x4d')](function(_0x3f802e){return db[_0xa121('0x4e')][_0xa121('0x4f')](_0x241b15,{'raw':!![],'transaction':_0x3f802e})[_0xa121('0x26')](function(_0x43fb44){var _0x314e77={'sender':_0x241b15[_0xa121('0x44')],'description':_0x241b15[_0xa121('0x46')],'content':_0x241b15[_0xa121('0x2d')],'beep':_0x241b15['beep']};_0x367be6[_0xa121('0x50')](function(_0x137ad8){_0x314e77[_0xa121('0x51')]=_0x137ad8;socket[_0xa121('0x52')](_0xa121('0x53'),_0x314e77);});return _0x43fb44;});});})[_0xa121('0x26')](respondWithResult(_0x5be45d,0xc9))[_0xa121('0x54')](handleError(_0x5be45d,null));};function getContent(_0x5410bb){return new BPromise(function(_0x3bc58d,_0x4f3287){if(_0x5410bb[_0xa121('0x2c')]){_0x3bc58d(_0x5410bb['text']);return;}return db[_0xa121('0x55')]['findOne']({'attributes':[_0xa121('0x56')],'where':{'id':_0x5410bb[_0xa121('0x2f')]},'raw':!![]})[_0xa121('0x26')](function(_0x3d9e83){if(!_0x3d9e83)throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x483627=Mustache[_0xa121('0x57')](_0x3d9e83[_0xa121('0x56')],_0x5410bb['view']);_0x3bc58d(_0x483627);})['catch'](function(_0x271872){_0x4f3287(_0x271872);});});}function getRecipients(_0xaffd97){return new BPromise(function(_0x1cdcba,_0x370012){var _0x52ebee=[];var _0x59c17b=[];_0xaffd97['forEach'](function(_0x4b58e1){var _0x1831ff=_['startCase'](_0x4b58e1[_0xa121('0x41')]['toLowerCase']());if(_0x1831ff===_0xa121('0x58')){_0x52ebee=_['union'](_0x52ebee,_0x4b58e1[_0xa121('0x59')]);}else{if(_[_0xa121('0x40')](_0x1831ff,_0xa121('0x5a')))_0x1831ff=_0x1831ff[_0xa121('0x5b')]('queue',_0xa121('0x5c'));_0x4b58e1['ids'][_0xa121('0x50')](function(_0x346561){_0x59c17b[_0xa121('0x5d')](getAgents(_0x1831ff,_0x346561));});}});return BPromise[_0xa121('0x5e')](_0x59c17b)[_0xa121('0x26')](function(_0x5a6af5){_0x52ebee=_['union'](_0x52ebee,_[_0xa121('0x5f')](_0x5a6af5));_0x1cdcba(_0x52ebee);})[_0xa121('0x54')](function(_0x59115b){_0x370012(_0x59115b);});});}function getAgents(_0x5d8e3b,_0x53f46e){return new BPromise(function(_0xa783ef,_0x263e3d){return db[_0x5d8e3b][_0xa121('0x60')]({'where':{'id':_0x53f46e}})['then'](function(_0x302eac){return _0x302eac[_0xa121('0x61')]({'attributes':['id'],'raw':!![]})[_0xa121('0x26')](function(_0x54ac65){var _0x1a8e44=_['map'](_0x54ac65,'id');_0xa783ef(_0x1a8e44);});})[_0xa121('0x54')](function(_0x3b99f6){_0x263e3d(_0x3b99f6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 09ba729..5be5bbe 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 _0x845a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xf7ebec,_0x270f1a){var _0x43ada2=function(_0x1bc3ac){while(--_0x1bc3ac){_0xf7ebec['push'](_0xf7ebec['shift']());}};_0x43ada2(++_0x270f1a);}(_0x845a,0x178));var _0xa845=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x845a[_0x316efa];return _0x4d96cc;};'use strict';var EventEmitter=require(_0xa845('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa845('0x1')](0x0);var events={'afterCreate':_0xa845('0x2'),'afterUpdate':_0xa845('0x3'),'afterDestroy':_0xa845('0x4')};function emitEvent(_0x4e8f5c){return function(_0x2eb758,_0x3672f5,_0x22a268){UserNotificationEvents[_0xa845('0x5')](_0x4e8f5c+':'+_0x2eb758['id'],_0x2eb758);UserNotificationEvents[_0xa845('0x5')](_0x4e8f5c,_0x2eb758);_0x22a268(null);};}for(var e in events){if(events[_0xa845('0x6')](e)){var event=events[e];UserNotification[_0xa845('0x7')](e,emitEvent(event));}}module[_0xa845('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x5f54=['setMaxListeners','save','update','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0x502a4c,_0x298a92){var _0x485b38=function(_0x75ffa0){while(--_0x75ffa0){_0x502a4c['push'](_0x502a4c['shift']());}};_0x485b38(++_0x298a92);}(_0x5f54,0xa6));var _0x45f5=function(_0x240926,_0x1aab68){_0x240926=_0x240926-0x0;var _0x4e6120=_0x5f54[_0x240926];return _0x4e6120;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x45f5('0x0'))['db'][_0x45f5('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x45f5('0x2')](0x0);var events={'afterCreate':_0x45f5('0x3'),'afterUpdate':_0x45f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a613b){return function(_0x4d1c08,_0xd0a956,_0x56083d){UserNotificationEvents['emit'](_0x4a613b+':'+_0x4d1c08['id'],_0x4d1c08);UserNotificationEvents['emit'](_0x4a613b,_0x4d1c08);_0x56083d(null);};}for(var e in events){if(events[_0x45f5('0x5')](e)){var event=events[e];UserNotification[_0x45f5('0x6')](e,emitEvent(event));}}module[_0x45f5('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 17c9005..710cae7 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 _0x772c=['request-promise','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x460899,_0xc1058c){var _0xd55630=function(_0x28ed5f){while(--_0x28ed5f){_0x460899['push'](_0x460899['shift']());}};_0xd55630(++_0xc1058c);}(_0x772c,0x159));var _0xc772=function(_0x3b70c6,_0x3e85f3){_0x3b70c6=_0x3b70c6-0x0;var _0x4ecb62=_0x772c[_0x3b70c6];return _0x4ecb62;};'use strict';var _=require('lodash');var util=require(_0xc772('0x0'));var logger=require(_0xc772('0x1'))(_0xc772('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc772('0x3'));var fs=require('fs');var path=require(_0xc772('0x4'));var rimraf=require(_0xc772('0x5'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0xc772('0x6')]=function(_0x421387,_0x241963){return _0x421387[_0xc772('0x7')](_0xc772('0x8'),attributes,{'tableName':_0xc772('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc772('0xa'),'collate':_0xc772('0xb')});}; \ No newline at end of file +var _0xf5b7=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf5b7,0x74));var _0x7f5b=function(_0x37e77d,_0x54fd40){_0x37e77d=_0x37e77d-0x0;var _0x417410=_0xf5b7[_0x37e77d];return _0x417410;};'use strict';var _=require(_0x7f5b('0x0'));var util=require('util');var logger=require(_0x7f5b('0x1'))(_0x7f5b('0x2'));var moment=require(_0x7f5b('0x3'));var BPromise=require(_0x7f5b('0x4'));var rp=require(_0x7f5b('0x5'));var fs=require('fs');var path=require(_0x7f5b('0x6'));var rimraf=require(_0x7f5b('0x7'));var config=require(_0x7f5b('0x8'));var attributes=require(_0x7f5b('0x9'));module[_0x7f5b('0xa')]=function(_0x57ca78,_0x1c2364){return _0x57ca78[_0x7f5b('0xb')](_0x7f5b('0xc'),attributes,{'tableName':_0x7f5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f5b('0xe'),'collate':_0x7f5b('0xf')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6ca23fb..09253c4 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 _0xece6=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x219c8c,_0x407e2e){var _0x3e57d1=function(_0x204f36){while(--_0x204f36){_0x219c8c['push'](_0x219c8c['shift']());}};_0x3e57d1(++_0x407e2e);}(_0xece6,0xea));var _0x6ece=function(_0x4a25e3,_0xffc2aa){_0x4a25e3=_0x4a25e3-0x0;var _0xc2ac02=_0xece6[_0x4a25e3];return _0xc2ac02;};'use strict';var _=require(_0x6ece('0x0'));var util=require(_0x6ece('0x1'));var moment=require(_0x6ece('0x2'));var BPromise=require(_0x6ece('0x3'));var rs=require(_0x6ece('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ece('0x5'))['db'];var utils=require(_0x6ece('0x6'));var logger=require('../../config/logger')(_0x6ece('0x7'));var config=require(_0x6ece('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ece('0x9')][_0x6ece('0xa')]({'port':0x232a});config[_0x6ece('0xb')]=_[_0x6ece('0xc')](config[_0x6ece('0xb')],{'host':_0x6ece('0xd'),'port':0x18eb});var socket=require(_0x6ece('0xe'))(new Redis(config[_0x6ece('0xb')]));require(_0x6ece('0xf'))[_0x6ece('0x10')](socket);function respondWithRpcPromise(_0x2527b7,_0x33e66b,_0x5c6496){return new BPromise(function(_0x327d68,_0x42448f){return client[_0x6ece('0x11')](_0x2527b7,_0x5c6496)[_0x6ece('0x12')](function(_0x3d2e05){logger[_0x6ece('0x13')](_0x6ece('0x14'),_0x33e66b,_0x6ece('0x15'));logger[_0x6ece('0x16')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x33e66b,_0x6ece('0x15'),JSON[_0x6ece('0x17')](_0x3d2e05));if(_0x3d2e05['error']){if(_0x3d2e05[_0x6ece('0x18')][_0x6ece('0x19')]===0x1f4){logger[_0x6ece('0x18')]('UserNotification,\x20%s,\x20%s',_0x33e66b,_0x3d2e05[_0x6ece('0x18')][_0x6ece('0x1a')]);return _0x42448f(_0x3d2e05[_0x6ece('0x18')][_0x6ece('0x1a')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x33e66b,_0x3d2e05[_0x6ece('0x18')][_0x6ece('0x1a')]);return _0x327d68(_0x3d2e05[_0x6ece('0x18')][_0x6ece('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x33e66b,_0x6ece('0x15'));_0x327d68(_0x3d2e05[_0x6ece('0x1b')]['message']);}})[_0x6ece('0x1c')](function(_0x123624){logger['error'](_0x6ece('0x14'),_0x33e66b,_0x123624);_0x42448f(_0x123624);});});} \ No newline at end of file +var _0xc4ca=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11c686,_0x12d5fb){var _0x459f55=function(_0x5307e8){while(--_0x5307e8){_0x11c686['push'](_0x11c686['shift']());}};_0x459f55(++_0x12d5fb);}(_0xc4ca,0x14b));var _0xac4c=function(_0x4f4d4a,_0x21bdaa){_0x4f4d4a=_0x4f4d4a-0x0;var _0x20b807=_0xc4ca[_0x4f4d4a];return _0x20b807;};'use strict';var _=require('lodash');var util=require(_0xac4c('0x0'));var moment=require(_0xac4c('0x1'));var BPromise=require(_0xac4c('0x2'));var rs=require(_0xac4c('0x3'));var fs=require('fs');var Redis=require(_0xac4c('0x4'));var db=require(_0xac4c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac4c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac4c('0x7'));var client=jayson[_0xac4c('0x8')][_0xac4c('0x9')]({'port':0x232a});config[_0xac4c('0xa')]=_['defaults'](config['redis'],{'host':_0xac4c('0xb'),'port':0x18eb});var socket=require(_0xac4c('0xc'))(new Redis(config[_0xac4c('0xa')]));require(_0xac4c('0xd'))[_0xac4c('0xe')](socket);function respondWithRpcPromise(_0x4cb0ea,_0x5ccc4a,_0x3bb71c){return new BPromise(function(_0x1b0a2d,_0x3276ce){return client[_0xac4c('0xf')](_0x4cb0ea,_0x3bb71c)[_0xac4c('0x10')](function(_0x2b5bda){logger[_0xac4c('0x11')](_0xac4c('0x12'),_0x5ccc4a,_0xac4c('0x13'));logger['debug'](_0xac4c('0x14'),_0x5ccc4a,'request\x20sent',JSON[_0xac4c('0x15')](_0x2b5bda));if(_0x2b5bda['error']){if(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x17')]===0x1f4){logger['error'](_0xac4c('0x12'),_0x5ccc4a,_0x2b5bda['error']['message']);return _0x3276ce(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);}logger[_0xac4c('0x16')](_0xac4c('0x12'),_0x5ccc4a,_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);return _0x1b0a2d(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);}else{logger['info'](_0xac4c('0x12'),_0x5ccc4a,'request\x20sent');_0x1b0a2d(_0x2b5bda['result'][_0xac4c('0x18')]);}})[_0xac4c('0x19')](function(_0x1dbe0a){logger[_0xac4c('0x16')](_0xac4c('0x12'),_0x5ccc4a,_0x1dbe0a);_0x3276ce(_0x1dbe0a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index baa0907..f42268e 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 _0x4204=['emit','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4204,0x6d));var _0x4420=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x4204[_0x1f1e31];return _0x229b56;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x4420('0x0'),'remove','update'];function createListener(_0xadb110,_0x1303bb){return function(_0xecc440){_0x1303bb[_0x4420('0x1')](_0xadb110,_0xecc440);};}function removeListener(_0x59590c,_0x4d88c0){return function(){UserNotificationEvents['removeListener'](_0x59590c,_0x4d88c0);};}exports['register']=function(_0x487b3e){for(var _0x23b6d5=0x0,_0x11bf04=events['length'];_0x23b6d5<_0x11bf04;_0x23b6d5++){var _0xfd0d20=events[_0x23b6d5];var _0x13b84b=createListener('userNotification:'+_0xfd0d20,_0x487b3e);UserNotificationEvents['on'](_0xfd0d20,_0x13b84b);}}; \ No newline at end of file +var _0x7f54=['emit','removeListener','userNotification:','./userNotification.events','save'];(function(_0x3a0cde,_0xb0a95d){var _0x566af9=function(_0x5850f1){while(--_0x5850f1){_0x3a0cde['push'](_0x3a0cde['shift']());}};_0x566af9(++_0xb0a95d);}(_0x7f54,0x85));var _0x47f5=function(_0x305fc8,_0x16e31e){_0x305fc8=_0x305fc8-0x0;var _0x427cea=_0x7f54[_0x305fc8];return _0x427cea;};'use strict';var UserNotificationEvents=require(_0x47f5('0x0'));var events=[_0x47f5('0x1'),'remove','update'];function createListener(_0x96c872,_0x466fe1){return function(_0x306755){_0x466fe1[_0x47f5('0x2')](_0x96c872,_0x306755);};}function removeListener(_0x4afdf6,_0x42781b){return function(){UserNotificationEvents[_0x47f5('0x3')](_0x4afdf6,_0x42781b);};}exports['register']=function(_0x20294b){for(var _0xaf7ace=0x0,_0x559ff0=events['length'];_0xaf7ace<_0x559ff0;_0xaf7ace++){var _0x48e888=events[_0xaf7ace];var _0x3c9924=createListener(_0x47f5('0x4')+_0x48e888,_0x20294b);UserNotificationEvents['on'](_0x48e888,_0x3c9924);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 11455e8..3509bb9 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x27a611,_0xe00621){var _0x39c5de=function(_0x1bdcfc){while(--_0x1bdcfc){_0x27a611['push'](_0x27a611['shift']());}};_0x39c5de(++_0xe00621);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x525847,_0x240458){var _0x4b8fb9=function(_0x421075){while(--_0x421075){_0x525847['push'](_0x525847['shift']());}};_0x4b8fb9(++_0x240458);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 418069d..17459a8 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 _0x48e3=['exports','sequelize'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x48e3,0xe9));var _0x348e=function(_0x29d289,_0x34d198){_0x29d289=_0x29d289-0x0;var _0x382f24=_0x48e3[_0x29d289];return _0x382f24;};'use strict';var Sequelize=require(_0x348e('0x0'));module[_0x348e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x231a=['sequelize','exports','INTEGER'];(function(_0x4b18f9,_0x261ef5){var _0x1488cf=function(_0x414fa2){while(--_0x414fa2){_0x4b18f9['push'](_0x4b18f9['shift']());}};_0x1488cf(++_0x261ef5);}(_0x231a,0x7b));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa231('0x0'));module[_0xa231('0x1')]={'penalty':{'type':Sequelize[_0xa231('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 9404ff6..89cbdc0 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 _0xc7fa=['util','api','path','rimraf','./userOpenchannelQueue.attributes','exports','lodash'];(function(_0x48cf34,_0x2f6de8){var _0x4bc5b3=function(_0xef7898){while(--_0xef7898){_0x48cf34['push'](_0x48cf34['shift']());}};_0x4bc5b3(++_0x2f6de8);}(_0xc7fa,0x18e));var _0xac7f=function(_0x1a20b2,_0x51e00b){_0x1a20b2=_0x1a20b2-0x0;var _0xb58eb8=_0xc7fa[_0x1a20b2];return _0xb58eb8;};'use strict';var _=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));var logger=require('../../config/logger')(_0xac7f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xac7f('0x3'));var rimraf=require(_0xac7f('0x4'));var config=require('../../config/environment');var attributes=require(_0xac7f('0x5'));module[_0xac7f('0x6')]=function(_0xdab2dd,_0x4eb464){return _0xdab2dd['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d33=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash'];(function(_0x13b6d3,_0x1c46c7){var _0x259bef=function(_0x53c272){while(--_0x53c272){_0x13b6d3['push'](_0x13b6d3['shift']());}};_0x259bef(++_0x1c46c7);}(_0x0d33,0xd7));var _0x30d3=function(_0x129726,_0x10fc4a){_0x129726=_0x129726-0x0;var _0x4257bd=_0x0d33[_0x129726];return _0x4257bd;};'use strict';var _=require(_0x30d3('0x0'));var util=require(_0x30d3('0x1'));var logger=require(_0x30d3('0x2'))(_0x30d3('0x3'));var moment=require('moment');var BPromise=require(_0x30d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d3('0x5'));var rimraf=require(_0x30d3('0x6'));var config=require(_0x30d3('0x7'));var attributes=require(_0x30d3('0x8'));module[_0x30d3('0x9')]=function(_0x15e267,_0x19696c){return _0x15e267[_0x30d3('0xa')](_0x30d3('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index d409bc2..d97f5ae 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 _0x5ba5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x3cbae4,_0x3508f6){var _0x4113c1=function(_0x4a93cc){while(--_0x4a93cc){_0x3cbae4['push'](_0x3cbae4['shift']());}};_0x4113c1(++_0x3508f6);}(_0x5ba5,0x1cd));var _0x55ba=function(_0x387f26,_0x324ff6){_0x387f26=_0x387f26-0x0;var _0x4118b3=_0x5ba5[_0x387f26];return _0x4118b3;};'use strict';var _=require(_0x55ba('0x0'));var util=require(_0x55ba('0x1'));var moment=require(_0x55ba('0x2'));var BPromise=require(_0x55ba('0x3'));var rs=require(_0x55ba('0x4'));var fs=require('fs');var Redis=require(_0x55ba('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x55ba('0x6'));var logger=require(_0x55ba('0x7'))(_0x55ba('0x8'));var config=require(_0x55ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x55ba('0xa')][_0x55ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40e95e,_0x5a1f5d,_0x259bc4){return new BPromise(function(_0x1a2b3e,_0x2883c5){return client['request'](_0x40e95e,_0x259bc4)[_0x55ba('0xc')](function(_0x3977f6){logger[_0x55ba('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5a1f5d,'request\x20sent');logger[_0x55ba('0xe')](_0x55ba('0xf'),_0x5a1f5d,'request\x20sent',JSON['stringify'](_0x3977f6));if(_0x3977f6[_0x55ba('0x10')]){if(_0x3977f6['error'][_0x55ba('0x11')]===0x1f4){logger[_0x55ba('0x10')](_0x55ba('0x12'),_0x5a1f5d,_0x3977f6[_0x55ba('0x10')][_0x55ba('0x13')]);return _0x2883c5(_0x3977f6[_0x55ba('0x10')][_0x55ba('0x13')]);}logger['error'](_0x55ba('0x12'),_0x5a1f5d,_0x3977f6[_0x55ba('0x10')][_0x55ba('0x13')]);return _0x1a2b3e(_0x3977f6[_0x55ba('0x10')][_0x55ba('0x13')]);}else{logger[_0x55ba('0xd')](_0x55ba('0x12'),_0x5a1f5d,_0x55ba('0x14'));_0x1a2b3e(_0x3977f6[_0x55ba('0x15')][_0x55ba('0x13')]);}})[_0x55ba('0x16')](function(_0x547b67){logger[_0x55ba('0x10')](_0x55ba('0x12'),_0x5a1f5d,_0x547b67);_0x2883c5(_0x547b67);});});} \ No newline at end of file +var _0x991a=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x57160c,_0x3c8e5c){var _0x35f682=function(_0x21ca37){while(--_0x21ca37){_0x57160c['push'](_0x57160c['shift']());}};_0x35f682(++_0x3c8e5c);}(_0x991a,0x7d));var _0xa991=function(_0x1e6a20,_0x3c6b33){_0x1e6a20=_0x1e6a20-0x0;var _0x3226be=_0x991a[_0x1e6a20];return _0x3226be;};'use strict';var _=require(_0xa991('0x0'));var util=require(_0xa991('0x1'));var moment=require(_0xa991('0x2'));var BPromise=require(_0xa991('0x3'));var rs=require(_0xa991('0x4'));var fs=require('fs');var Redis=require(_0xa991('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa991('0x6'));var logger=require(_0xa991('0x7'))(_0xa991('0x8'));var config=require(_0xa991('0x9'));var jayson=require(_0xa991('0xa'));var client=jayson[_0xa991('0xb')][_0xa991('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e9c4d,_0x10d5d5,_0x55679c){return new BPromise(function(_0x4d2331,_0x22a336){return client[_0xa991('0xd')](_0x5e9c4d,_0x55679c)['then'](function(_0x46bbe9){logger[_0xa991('0xe')](_0xa991('0xf'),_0x10d5d5,_0xa991('0x10'));logger[_0xa991('0x11')](_0xa991('0x12'),_0x10d5d5,_0xa991('0x10'),JSON[_0xa991('0x13')](_0x46bbe9));if(_0x46bbe9['error']){if(_0x46bbe9[_0xa991('0x14')][_0xa991('0x15')]===0x1f4){logger[_0xa991('0x14')](_0xa991('0xf'),_0x10d5d5,_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);return _0x22a336(_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);}logger[_0xa991('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x10d5d5,_0x46bbe9['error'][_0xa991('0x16')]);return _0x4d2331(_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);}else{logger[_0xa991('0xe')](_0xa991('0xf'),_0x10d5d5,_0xa991('0x10'));_0x4d2331(_0x46bbe9[_0xa991('0x17')][_0xa991('0x16')]);}})[_0xa991('0x18')](function(_0x488813){logger[_0xa991('0x14')](_0xa991('0xf'),_0x10d5d5,_0x488813);_0x22a336(_0x488813);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 982fa80..aaaa572 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 _0x775f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','/:id','removeSections','delete','removeResources','exports','multer','util','path'];(function(_0xd210ed,_0x3c9710){var _0x28c473=function(_0x455c8e){while(--_0x455c8e){_0xd210ed['push'](_0xd210ed['shift']());}};_0x28c473(++_0x3c9710);}(_0x775f,0x185));var _0xf775=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x775f[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0xf775('0x0'));var util=require(_0xf775('0x1'));var path=require(_0xf775('0x2'));var timeout=require(_0xf775('0x3'));var express=require(_0xf775('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf775('0x5'));var interaction=require(_0xf775('0x6'));var config=require('../../config/environment');var controller=require(_0xf775('0x7'));router[_0xf775('0x8')]('/',auth[_0xf775('0x9')](),controller[_0xf775('0xa')]);router[_0xf775('0x8')](_0xf775('0xb'),auth[_0xf775('0x9')](),controller['describe']);router[_0xf775('0x8')]('/:id',auth[_0xf775('0x9')](),controller[_0xf775('0xc')]);router[_0xf775('0x8')]('/:id/sections',auth[_0xf775('0x9')](),controller[_0xf775('0xd')]);router['get'](_0xf775('0xe'),auth[_0xf775('0x9')](),controller[_0xf775('0xf')]);router[_0xf775('0x10')]('/',auth[_0xf775('0x9')](),controller[_0xf775('0x11')]);router[_0xf775('0x10')](_0xf775('0x12'),auth[_0xf775('0x9')](),controller[_0xf775('0x13')]);router[_0xf775('0x10')](_0xf775('0x14'),auth[_0xf775('0x9')](),controller[_0xf775('0x15')]);router[_0xf775('0x10')](_0xf775('0xe'),auth[_0xf775('0x9')](),controller[_0xf775('0x16')]);router['put'](_0xf775('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf775('0x17'),auth[_0xf775('0x9')](),controller['destroy']);router['delete']('/:id/sections',auth[_0xf775('0x9')](),controller[_0xf775('0x18')]);router[_0xf775('0x19')](_0xf775('0xe'),auth['isAuthenticated'](),controller[_0xf775('0x1a')]);module[_0xf775('0x1b')]=router; \ No newline at end of file +var _0xcde0=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','clone','addSections','addResources','put','update','delete','destroy','removeSections','exports'];(function(_0x82ffeb,_0x3dd0d1){var _0x14f6bf=function(_0xcfc0ae){while(--_0xcfc0ae){_0x82ffeb['push'](_0x82ffeb['shift']());}};_0x14f6bf(++_0x3dd0d1);}(_0xcde0,0x14a));var _0x0cde=function(_0x2f85d2,_0x2b96e6){_0x2f85d2=_0x2f85d2-0x0;var _0x414923=_0xcde0[_0x2f85d2];return _0x414923;};'use strict';var multer=require(_0x0cde('0x0'));var util=require(_0x0cde('0x1'));var path=require(_0x0cde('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cde('0x3'));var router=express[_0x0cde('0x4')]();var fs_extra=require(_0x0cde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0cde('0x6'));var config=require(_0x0cde('0x7'));var controller=require(_0x0cde('0x8'));router[_0x0cde('0x9')]('/',auth[_0x0cde('0xa')](),controller[_0x0cde('0xb')]);router[_0x0cde('0x9')](_0x0cde('0xc'),auth[_0x0cde('0xa')](),controller[_0x0cde('0xd')]);router[_0x0cde('0x9')](_0x0cde('0xe'),auth['isAuthenticated'](),controller[_0x0cde('0xf')]);router['get'](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x11')]);router['get'](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller['getResources']);router[_0x0cde('0x13')]('/',auth[_0x0cde('0xa')](),controller[_0x0cde('0x14')]);router[_0x0cde('0x13')]('/:id/clone',auth[_0x0cde('0xa')](),controller[_0x0cde('0x15')]);router[_0x0cde('0x13')](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x16')]);router[_0x0cde('0x13')](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x17')]);router[_0x0cde('0x18')](_0x0cde('0xe'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x19')]);router[_0x0cde('0x1a')](_0x0cde('0xe'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x1b')]);router[_0x0cde('0x1a')](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x1c')]);router[_0x0cde('0x1a')](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller['removeResources']);module[_0x0cde('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9a87333..6ce0709 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 _0xc450=['BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x4ce993,_0x3b6cf3){var _0x59d528=function(_0x2d7156){while(--_0x2d7156){_0x4ce993['push'](_0x4ce993['shift']());}};_0x59d528(++_0x3b6cf3);}(_0xc450,0xb0));var _0x0c45=function(_0x190c8c,_0x4c779e){_0x190c8c=_0x190c8c-0x0;var _0x111b19=_0xc450[_0x190c8c];return _0x111b19;};'use strict';var Sequelize=require('sequelize');module[_0x0c45('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0c45('0x1')},'crudPermissions':{'type':Sequelize[_0x0c45('0x2')],'set':function(_0x507ca2){this[_0x0c45('0x3')](_0x0c45('0x4'),_0x507ca2?_0x507ca2['join'](''):[]);},'get':function(){return this[_0x0c45('0x5')](_0x0c45('0x4'))?this[_0x0c45('0x5')](_0x0c45('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0c45('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0c45('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0c45('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0c45('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0c45('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3613=['STRING','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3613,0x1c9));var _0x3361=function(_0x240285,_0x2f2c46){_0x240285=_0x240285-0x0;var _0x44055a=_0x3613[_0x240285];return _0x44055a;};'use strict';var Sequelize=require(_0x3361('0x0'));module[_0x3361('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3361('0x2')},'crudPermissions':{'type':Sequelize[_0x3361('0x3')],'set':function(_0x5274d5){this[_0x3361('0x4')]('crudPermissions',_0x5274d5?_0x5274d5[_0x3361('0x5')](''):[]);},'get':function(){return this[_0x3361('0x6')](_0x3361('0x7'))?this[_0x3361('0x6')](_0x3361('0x7'))[_0x3361('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3361('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3361('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2bc309c..c96990f 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 _0xd5f9=['includeAll','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','sequelize','userProfileId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','then','include','catch','show'];(function(_0x57a161,_0x3aed74){var _0x1a76ca=function(_0x2b8ebf){while(--_0x2b8ebf){_0x57a161['push'](_0x57a161['shift']());}};_0x1a76ca(++_0x3aed74);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x434ddc,_0x1f9e59){_0x434ddc=_0x434ddc-0x0;var _0x283bf5=_0xd5f9[_0x434ddc];return _0x283bf5;};'use strict';var emlformat=require(_0x9d5f('0x0'));var rimraf=require(_0x9d5f('0x1'));var zipdir=require(_0x9d5f('0x2'));var jsonpatch=require(_0x9d5f('0x3'));var rp=require('request-promise');var moment=require(_0x9d5f('0x4'));var BPromise=require(_0x9d5f('0x5'));var Mustache=require(_0x9d5f('0x6'));var util=require(_0x9d5f('0x7'));var path=require(_0x9d5f('0x8'));var sox=require(_0x9d5f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d5f('0xa'));var squel=require(_0x9d5f('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d5f('0xc'));var deskjs=require(_0x9d5f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9d5f('0xe'));var Papa=require(_0x9d5f('0xf'));var Redis=require('ioredis');var authService=require(_0x9d5f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9d5f('0x11'));var hardwareService=require(_0x9d5f('0x12'));var logger=require(_0x9d5f('0x13'))(_0x9d5f('0x14'));var utils=require(_0x9d5f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9d5f('0x16'));var db=require(_0x9d5f('0x17'))['db'];config[_0x9d5f('0x18')]=_[_0x9d5f('0x19')](config[_0x9d5f('0x18')],{'host':_0x9d5f('0x1a'),'port':0x18eb});var socket=require(_0x9d5f('0x1b'))(new Redis(config[_0x9d5f('0x18')]));require(_0x9d5f('0x1c'))['register'](socket);function respondWithStatusCode(_0x52700b,_0x486e1c){_0x486e1c=_0x486e1c||0xcc;return function(_0x54bcc4){if(_0x54bcc4){return _0x52700b[_0x9d5f('0x1d')](_0x486e1c);}return _0x52700b[_0x9d5f('0x1e')](_0x486e1c)['end']();};}function respondWithResult(_0x23ca6f,_0x10f7d5){_0x10f7d5=_0x10f7d5||0xc8;return function(_0x34da46){if(_0x34da46){return _0x23ca6f[_0x9d5f('0x1e')](_0x10f7d5)[_0x9d5f('0x1f')](_0x34da46);}};}function respondWithFilteredResult(_0x54de1e,_0x16ea25){return function(_0x463c1e){if(_0x463c1e){var _0xbfb436=typeof _0x16ea25[_0x9d5f('0x20')]===_0x9d5f('0x21')&&typeof _0x16ea25[_0x9d5f('0x22')]===_0x9d5f('0x21');var _0x5114a2=_0x463c1e[_0x9d5f('0x23')];var _0x17c436=_0xbfb436?0x0:_0x16ea25[_0x9d5f('0x20')];var _0x550102=_0xbfb436?_0x463c1e['count']:_0x16ea25[_0x9d5f('0x20')]+_0x16ea25[_0x9d5f('0x22')];var _0x1577d7;if(_0x550102>=_0x5114a2){_0x550102=_0x5114a2;_0x1577d7=0xc8;}else{_0x1577d7=0xce;}_0x54de1e[_0x9d5f('0x1e')](_0x1577d7);return _0x54de1e['set'](_0x9d5f('0x24'),_0x17c436+'-'+_0x550102+'/'+_0x5114a2)['json'](_0x463c1e);}return null;};}function patchUpdates(_0x3dc3c4){return function(_0x5c0b8f){try{jsonpatch[_0x9d5f('0x25')](_0x5c0b8f,_0x3dc3c4,!![]);}catch(_0x125e31){return BPromise[_0x9d5f('0x26')](_0x125e31);}return _0x5c0b8f[_0x9d5f('0x27')]();};}function saveUpdates(_0x1360cf,_0x552fe8){return function(_0x301dc4){if(_0x301dc4){return _0x301dc4[_0x9d5f('0x28')](_0x1360cf)['then'](function(_0x2a032a){return _0x2a032a;});}return null;};}function removeEntity(_0x167d4a,_0x1e92cb){return function(_0x3ccb94){if(_0x3ccb94){return _0x3ccb94[_0x9d5f('0x29')]()['then'](function(){_0x167d4a[_0x9d5f('0x1e')](0xcc)[_0x9d5f('0x2a')]();});}};}function handleEntityNotFound(_0x288235,_0x4afdd7){return function(_0x5f8281){if(!_0x5f8281){_0x288235['sendStatus'](0x194);}return _0x5f8281;};}function handleError(_0xfa70cf,_0x19303a){_0x19303a=_0x19303a||0x1f4;return function(_0x59118d){logger[_0x9d5f('0x2b')](_0x59118d[_0x9d5f('0x2c')]);if(_0x59118d[_0x9d5f('0x2d')]){delete _0x59118d['name'];}_0xfa70cf['status'](_0x19303a)['send'](_0x59118d);};}exports[_0x9d5f('0x2e')]=function(_0x3e4090,_0x1be00e){var _0x4fafae={},_0x332191={},_0x4c15e4={'count':0x0,'rows':[]};var _0x540ec=_[_0x9d5f('0x2f')](db[_0x9d5f('0x30')][_0x9d5f('0x31')],function(_0x342a32){return{'name':_0x342a32[_0x9d5f('0x32')],'type':_0x342a32['type'][_0x9d5f('0x33')]};});_0x332191[_0x9d5f('0x34')]=_[_0x9d5f('0x2f')](_0x540ec,'name');_0x332191['query']=_[_0x9d5f('0x35')](_0x3e4090[_0x9d5f('0x36')]);_0x332191[_0x9d5f('0x37')]=_[_0x9d5f('0x38')](_0x332191[_0x9d5f('0x34')],_0x332191[_0x9d5f('0x36')]);_0x4fafae[_0x9d5f('0x39')]=_[_0x9d5f('0x38')](_0x332191[_0x9d5f('0x34')],qs[_0x9d5f('0x3a')](_0x3e4090[_0x9d5f('0x36')][_0x9d5f('0x3a')]));_0x4fafae[_0x9d5f('0x39')]=_0x4fafae[_0x9d5f('0x39')][_0x9d5f('0x3b')]?_0x4fafae[_0x9d5f('0x39')]:_0x332191[_0x9d5f('0x34')];if(!_0x3e4090[_0x9d5f('0x36')][_0x9d5f('0x3c')](_0x9d5f('0x3d'))){_0x4fafae[_0x9d5f('0x22')]=qs['limit'](_0x3e4090['query'][_0x9d5f('0x22')]);_0x4fafae[_0x9d5f('0x20')]=qs[_0x9d5f('0x20')](_0x3e4090[_0x9d5f('0x36')][_0x9d5f('0x20')]);}_0x4fafae['order']=qs['sort'](_0x3e4090[_0x9d5f('0x36')]['sort']);_0x4fafae[_0x9d5f('0x3e')]=qs['filters'](_[_0x9d5f('0x3f')](_0x3e4090[_0x9d5f('0x36')],_0x332191['filters']),_0x540ec);if(_0x3e4090[_0x9d5f('0x36')][_0x9d5f('0x40')]){_0x4fafae['where']=_[_0x9d5f('0x41')](_0x4fafae['where'],{'$or':_['map'](_0x540ec,function(_0x305360){if(_0x305360[_0x9d5f('0x42')]!==_0x9d5f('0x43')){var _0x17dd30={};_0x17dd30[_0x305360[_0x9d5f('0x2d')]]={'$like':'%'+_0x3e4090[_0x9d5f('0x36')][_0x9d5f('0x40')]+'%'};return _0x17dd30;}})});}_0x4fafae=_[_0x9d5f('0x41')]({},_0x4fafae,_0x3e4090[_0x9d5f('0x44')]);var _0x37ecb4={'where':_0x4fafae[_0x9d5f('0x3e')]};return db[_0x9d5f('0x30')][_0x9d5f('0x23')](_0x37ecb4)[_0x9d5f('0x45')](function(_0x23fbaf){_0x4c15e4['count']=_0x23fbaf;if(_0x3e4090[_0x9d5f('0x36')]['includeAll']){_0x4fafae[_0x9d5f('0x46')]=[{'all':!![]}];}return db[_0x9d5f('0x30')]['findAll'](_0x4fafae);})[_0x9d5f('0x45')](function(_0x4b6dd8){_0x4c15e4['rows']=_0x4b6dd8;return _0x4c15e4;})[_0x9d5f('0x45')](respondWithFilteredResult(_0x1be00e,_0x4fafae))[_0x9d5f('0x47')](handleError(_0x1be00e,null));};exports[_0x9d5f('0x48')]=function(_0x4874ef,_0xd9c2b6){var _0x234cdc={'raw':![],'where':{'id':_0x4874ef['params']['id']}},_0x16f38f={};_0x16f38f['model']=_[_0x9d5f('0x35')](db['UserProfile'][_0x9d5f('0x31')]);_0x16f38f[_0x9d5f('0x36')]=_['keys'](_0x4874ef['query']);_0x16f38f[_0x9d5f('0x37')]=_[_0x9d5f('0x38')](_0x16f38f[_0x9d5f('0x34')],_0x16f38f['query']);_0x234cdc['attributes']=_[_0x9d5f('0x38')](_0x16f38f[_0x9d5f('0x34')],qs[_0x9d5f('0x3a')](_0x4874ef[_0x9d5f('0x36')][_0x9d5f('0x3a')]));_0x234cdc[_0x9d5f('0x39')]=_0x234cdc[_0x9d5f('0x39')]['length']?_0x234cdc[_0x9d5f('0x39')]:_0x16f38f[_0x9d5f('0x34')];if(_0x4874ef[_0x9d5f('0x36')][_0x9d5f('0x49')]){_0x234cdc[_0x9d5f('0x46')]=[{'all':!![]}];}_0x234cdc=_[_0x9d5f('0x41')]({},_0x234cdc,_0x4874ef[_0x9d5f('0x44')]);return db['UserProfile'][_0x9d5f('0x4a')](_0x234cdc)[_0x9d5f('0x45')](handleEntityNotFound(_0xd9c2b6,null))[_0x9d5f('0x45')](respondWithResult(_0xd9c2b6,null))[_0x9d5f('0x47')](handleError(_0xd9c2b6,null));};exports[_0x9d5f('0x4b')]=function(_0x1704d1,_0x31f90e){return db['UserProfile']['create'](_0x1704d1[_0x9d5f('0x4c')],{})[_0x9d5f('0x45')](respondWithResult(_0x31f90e,0xc9))[_0x9d5f('0x47')](handleError(_0x31f90e,null));};exports[_0x9d5f('0x4d')]=function(_0x573ef0,_0x562356){var _0x2980a9={'where':{'id':_0x573ef0[_0x9d5f('0x4e')]['id']}},_0x5a6700={};_0x5a6700[_0x9d5f('0x34')]=_['keys'](db['UserProfile']['rawAttributes']);_0x2980a9['attributes']=_[_0x9d5f('0x38')](_0x5a6700['model'],qs[_0x9d5f('0x3a')](_0x573ef0[_0x9d5f('0x36')][_0x9d5f('0x3a')]));_0x2980a9[_0x9d5f('0x39')]=_0x2980a9[_0x9d5f('0x39')][_0x9d5f('0x3b')]?_0x2980a9['attributes']:_0x5a6700[_0x9d5f('0x34')];if(_0x573ef0[_0x9d5f('0x36')][_0x9d5f('0x49')]){_0x2980a9[_0x9d5f('0x46')]=[{'all':!![]}];}_0x2980a9=_['merge']({},_0x2980a9,_0x573ef0[_0x9d5f('0x44')]);return db[_0x9d5f('0x30')][_0x9d5f('0x4a')](_0x2980a9)['then'](handleEntityNotFound(_0x562356,null))[_0x9d5f('0x45')](function(_0x4330ac){if(_0x4330ac){var _0x3bec62=_0x4330ac[_0x9d5f('0x4f')]({'plain':!![]});_0x3bec62=qs[_0x9d5f('0x50')](_0x3bec62,['id',_0x9d5f('0x51'),_0x9d5f('0x52'),_0x9d5f('0x53')]);_0x573ef0['body']=_[_0x9d5f('0x50')](_0x573ef0[_0x9d5f('0x4c')],['id',_0x9d5f('0x51'),'updatedAt']);return db['sequelize'][_0x9d5f('0x54')](function(_0x4681df){return db[_0x9d5f('0x30')]['create'](_[_0x9d5f('0x41')](_0x3bec62,_0x573ef0[_0x9d5f('0x4c')]),{'include':_0x573ef0[_0x9d5f('0x36')][_0x9d5f('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x4681df})[_0x9d5f('0x45')](function(_0x19bbc4){var _0x57ab45=_0x19bbc4[_0x9d5f('0x4f')]({'plain':!![]});return db[_0x9d5f('0x55')][_0x9d5f('0x56')]({'where':{'userProfileId':_0x573ef0[_0x9d5f('0x4e')]['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x55ac88){if(_0x55ac88){return BPromise[_0x9d5f('0x57')](_0x55ac88,function(_0x4c3926){return new BPromise(function(_0x359cc6,_0xa3bef4){if(_0x4c3926[_0x9d5f('0x58')]===null||_0x4c3926[_0x9d5f('0x58')]===0x1)_0x359cc6(null);return db[_0x9d5f('0x59')]['findAll']({'where':{'sectionId':_0x4c3926['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x2fb366){var _0x23d71e=_[_0x9d5f('0x2f')](_0x2fb366,function(_0x1d9d8f){return qs['omit'](_0x1d9d8f,['id',_0x9d5f('0x51'),_0x9d5f('0x52'),_0x9d5f('0x5a')]);});_0x359cc6(_0x23d71e);})[_0x9d5f('0x47')](function(_0x1b4c38){_0xa3bef4(_0x1b4c38);});})['then'](function(_0x1ac2cf){var _0x232eb5=qs[_0x9d5f('0x50')](_0x4c3926,['id',_0x9d5f('0x51'),_0x9d5f('0x52')]);_0x232eb5['userProfileId']=_0x57ab45['id'];if(_0x1ac2cf)_0x232eb5[_0x9d5f('0x5b')]=_0x1ac2cf;return _0x232eb5;})[_0x9d5f('0x45')](function(_0x3e7091){return db[_0x9d5f('0x55')][_0x9d5f('0x4b')](_0x3e7091,{'include':[{'model':db[_0x9d5f('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4681df});});})['then'](function(){return _0x57ab45;});}});});});}})[_0x9d5f('0x45')](respondWithResult(_0x562356,0xc9))[_0x9d5f('0x47')](handleError(_0x562356,null));};exports['update']=function(_0x312a90,_0x5ea2fc){if(_0x312a90['body']['id']){delete _0x312a90[_0x9d5f('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x312a90['params']['id']}})[_0x9d5f('0x45')](handleEntityNotFound(_0x5ea2fc,null))['then'](saveUpdates(_0x312a90[_0x9d5f('0x4c')],null))['then'](respondWithResult(_0x5ea2fc,null))['catch'](handleError(_0x5ea2fc,null));};exports[_0x9d5f('0x29')]=function(_0x233c6e,_0x7150f1){return db[_0x9d5f('0x30')]['find']({'where':{'id':_0x233c6e[_0x9d5f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x7150f1,null))['then'](removeEntity(_0x7150f1,null))[_0x9d5f('0x47')](handleError(_0x7150f1,null));};exports[_0x9d5f('0x5c')]=function(_0x238e38,_0x3137d3){return db[_0x9d5f('0x30')]['describe']()['then'](respondWithResult(_0x3137d3,null))['catch'](handleError(_0x3137d3,null));};exports['addSections']=function(_0x5ba529,_0x4920ab){var _0x239848=_0x5ba529[_0x9d5f('0x4c')];return db[_0x9d5f('0x30')][_0x9d5f('0x4a')]({'where':{'id':_0x5ba529[_0x9d5f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4920ab,null))[_0x9d5f('0x45')](function(_0x47e737){if(_0x47e737){return db['sequelize'][_0x9d5f('0x54')](function(_0xd675ba){return db['UserProfileSection'][_0x9d5f('0x29')]({'where':{'userProfileId':_0x5ba529[_0x9d5f('0x4e')]['id'],'sectionId':_[_0x9d5f('0x2f')](_0x239848,function(_0x59a5a2){return _0x59a5a2[_0x9d5f('0x5a')];})},'transaction':_0xd675ba})[_0x9d5f('0x45')](function(){var _0x568360=_[_0x9d5f('0x2f')](_0x239848,function(_0xac8284){_0xac8284['userProfileId']=_0x5ba529['params']['id'];return _0xac8284;});var _0x50ae5e=[];return BPromise[_0x9d5f('0x57')](_0x568360,function(_0x1b0c0b){return db['UserProfileSection'][_0x9d5f('0x4b')](_0x1b0c0b,{'include':[{'model':db[_0x9d5f('0x59')],'as':_0x9d5f('0x5b')}],'raw':!![],'transaction':_0xd675ba})[_0x9d5f('0x45')](function(_0x4e27c9){_0x50ae5e[_0x9d5f('0x5d')](_0x4e27c9[_0x9d5f('0x4f')]({'plain':!![]}));});})[_0x9d5f('0x45')](function(){return _0x50ae5e;});});});}})[_0x9d5f('0x45')](function(_0x4fb981){return _0x4fb981;})[_0x9d5f('0x45')](respondWithResult(_0x4920ab,null))[_0x9d5f('0x47')](handleError(_0x4920ab,null));};exports[_0x9d5f('0x5e')]=function(_0x1d9223,_0x8fc895){var _0x3c91f5;return db[_0x9d5f('0x30')][_0x9d5f('0x4a')]({'where':{'id':_0x1d9223['params']['id']},'attributes':['id',_0x9d5f('0x2d')]})[_0x9d5f('0x45')](handleEntityNotFound(_0x8fc895,null))[_0x9d5f('0x45')](function(_0x2794a4){if(_0x2794a4){_0x3c91f5=_0x2794a4;return db[_0x9d5f('0x55')]['destroy']({'where':{'userProfileId':_0x1d9223['params']['id'],'sectionId':_0x1d9223['query'][_0x9d5f('0x5f')]}});}})['then'](function(){return _0x3c91f5;})['then'](respondWithStatusCode(_0x8fc895,null))[_0x9d5f('0x47')](handleError(_0x8fc895,null));};exports[_0x9d5f('0x60')]=function(_0x51b957,_0x3dbff4){var _0x242a9a=[];var _0x7ddbe=[];return db[_0x9d5f('0x55')]['findAll']({'where':{'userProfileId':_0x51b957['params']['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x3eb814){_0x242a9a=_[_0x9d5f('0x40')](_0x3eb814,function(_0x429286){return _0x429286[_0x9d5f('0x61')]===0x1||_[_0x9d5f('0x62')]([0x3eb,0x709],_0x429286['sectionId']);});if(!_[_0x9d5f('0x63')](_0x242a9a)){return _[_0x9d5f('0x2f')](_0x242a9a,function(_0x42fc08){return _0x42fc08['sectionId'];});}else{return;}})[_0x9d5f('0x45')](function(_0x572375){if(_0x572375)_0x7ddbe=_0x572375;if(_[_0x9d5f('0x62')](_0x7ddbe,0x64)){var _0x180077=_['find'](_0x242a9a,{'sectionId':0x64});return hasDefaultDashboard(_0x180077)[_0x9d5f('0x45')](function(_0x2f3634){return _[_0x9d5f('0x2f')](_0x242a9a,function(_0x2a4fc4){if(_0x2a4fc4[_0x9d5f('0x5a')]===0x64){_0x2a4fc4['subsections']=_0x2f3634;}return _0x2a4fc4;});});}else{return;}})[_0x9d5f('0x45')](function(_0x2c1343){if(_0x2c1343)_0x242a9a=_0x2c1343;if(_['includes'](_0x7ddbe,0x3eb)){var _0x34eddc=_['find'](_0x242a9a,{'sectionId':0x3eb});return getCustomDashboards(_0x34eddc)[_0x9d5f('0x45')](function(_0x5b14a4){return _[_0x9d5f('0x2f')](_0x242a9a,function(_0x4d5dee){if(_0x34eddc[_0x9d5f('0x61')]){if(_0x4d5dee[_0x9d5f('0x5a')]===0x3eb){_0x4d5dee['subsections']=_0x5b14a4;}}else{if(_0x4d5dee[_0x9d5f('0x5a')]===0x64){_0x4d5dee[_0x9d5f('0x64')]=_0x5b14a4;}}return _0x4d5dee;});});}else{return;}})[_0x9d5f('0x45')](function(_0x19bc4d){if(_0x19bc4d)_0x242a9a=_0x19bc4d;if(_[_0x9d5f('0x62')](_0x7ddbe,0x709)){var _0x26a458=_[_0x9d5f('0x4a')](_0x242a9a,{'sectionId':0x709});return getPlugins(_0x26a458)['then'](function(_0x18e51b){if(_0x26a458['enabled']){return _['map'](_0x242a9a,function(_0x41c2bd){if(_0x41c2bd[_0x9d5f('0x5a')]===0x709){_0x41c2bd[_0x9d5f('0x64')]=_0x18e51b;}return _0x41c2bd;});}else{var _0x543c21={'sectionId':0x76c,'enabled':0x1,'subsections':_0x18e51b};var _0x79a6ab=_[_0x9d5f('0x2f')](_0x242a9a);_0x79a6ab['push'](_0x543c21);return _0x79a6ab;}});}else{return;}})[_0x9d5f('0x45')](function(_0x3d261a){if(_0x3d261a)_0x242a9a=_0x3d261a;return _['filter'](_0x242a9a,[_0x9d5f('0x61'),0x1]);})['then'](respondWithResult(_0x3dbff4,null))[_0x9d5f('0x47')](handleError(_0x3dbff4,null));};function hasDefaultDashboard(_0x4f9f58){var _0x14c915=[0x65];return new BPromise(function(_0x2b820c,_0x3d62f0){try{if(_0x4f9f58['autoAssociation']){_0x2b820c(_0x14c915);}else{return db[_0x9d5f('0x59')][_0x9d5f('0x65')]({'where':{'sectionId':_0x4f9f58['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x899c62){_0x899c62?_0x2b820c(_0x14c915):_0x2b820c();});}}catch(_0x9e63dc){_0x3d62f0(_0x9e63dc);}});}function getCustomDashboards(_0xafd9a8){var _0x473f12=[];return new BPromise(function(_0xbc4f8b,_0x1819ce){try{if(_0xafd9a8[_0x9d5f('0x58')]){return db[_0x9d5f('0x66')][_0x9d5f('0x56')]({'raw':!![]})[_0x9d5f('0x45')](function(_0x329aa9){_0x329aa9[_0x9d5f('0x67')](function(_0x27f448){_0x473f12[_0x9d5f('0x5d')](_0x27f448['id']+0x1869f);});_0xbc4f8b(_0x473f12);});}else{return db[_0x9d5f('0x59')][_0x9d5f('0x56')]({'where':{'sectionId':_0xafd9a8['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x26b7b3){_0x26b7b3[_0x9d5f('0x67')](function(_0x533e2c){_0x473f12[_0x9d5f('0x5d')](_0x533e2c[_0x9d5f('0x68')]+0x1869f);});_0xbc4f8b(_0x473f12);});}}catch(_0x3b1249){_0x1819ce(_0x3b1249);}});}function getPlugins(_0x4408a1){var _0x402698=[];return new BPromise(function(_0x42ea59,_0x59f4f9){try{if(_0x4408a1[_0x9d5f('0x58')]){return db['Plugin'][_0x9d5f('0x56')]({'raw':!![]})[_0x9d5f('0x45')](function(_0x399c2e){_0x399c2e[_0x9d5f('0x67')](function(_0x3f9096){_0x402698['push'](_0x3f9096['id']+0x15b38);});_0x42ea59(_0x402698);});}else{return db[_0x9d5f('0x59')]['findAll']({'where':{'sectionId':_0x4408a1['id']},'raw':!![]})[_0x9d5f('0x45')](function(_0x55c3d7){_0x55c3d7['forEach'](function(_0x26ae09){_0x402698[_0x9d5f('0x5d')](_0x26ae09[_0x9d5f('0x68')]+0x15b38);});_0x42ea59(_0x402698);});}}catch(_0x292d2f){_0x59f4f9(_0x292d2f);}});}exports[_0x9d5f('0x69')]=function(_0x8e73c5,_0xe87da0){return db['UserProfile']['find']({'where':{'id':_0x8e73c5[_0x9d5f('0x4e')]['id']}})[_0x9d5f('0x45')](handleEntityNotFound(_0xe87da0,null))[_0x9d5f('0x45')](function(_0x28d413){if(_0x28d413){return db[_0x9d5f('0x6a')][_0x9d5f('0x54')](function(_0x49be2c){return db[_0x9d5f('0x55')][_0x9d5f('0x56')]({'where':{'userProfileId':_0x8e73c5['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x23249d){if(_0x23249d){return db[_0x9d5f('0x55')][_0x9d5f('0x29')]({'where':{'userProfileId':_0x8e73c5[_0x9d5f('0x4e')]['id'],'id':_[_0x9d5f('0x2f')](_0x23249d,function(_0x2c4ef3){return _0x2c4ef3['id'];})},'transaction':_0x49be2c});}})[_0x9d5f('0x45')](function(_0x2e5d3b){var _0x269995=_[_0x9d5f('0x2f')](_0x8e73c5[_0x9d5f('0x4c')],function(_0x1fcbaa){_0x1fcbaa[_0x9d5f('0x6b')]=_0x8e73c5[_0x9d5f('0x4e')]['id'];return _0x1fcbaa;});return db['UserProfileSection']['bulkCreate'](_0x269995,{'raw':!![],'transaction':_0x49be2c});})[_0x9d5f('0x45')](function(_0x410209){var _0x1c1245=_[_0x9d5f('0x40')](_[_0x9d5f('0x2f')](_0x410209,function(_0x325fbb){return _0x325fbb[_0x9d5f('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1c1245){return db[_0x9d5f('0x55')][_0x9d5f('0x56')]({'where':{'userProfileId':_0x8e73c5[_0x9d5f('0x4e')]['id'],'sectionId':_[_0x9d5f('0x2f')](_0x1c1245,function(_0x552042){return _0x552042[_0x9d5f('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9d5f('0x45')](function(_0x3331c9){var _0x1215e5=_[_0x9d5f('0x2f')](_0x8e73c5['body'],function(_0x467170){_0x467170[_0x9d5f('0x6b')]=_0x8e73c5[_0x9d5f('0x4e')]['id'];return _0x467170;});return db[_0x9d5f('0x59')][_0x9d5f('0x6c')](_0x1215e5,{'raw':!![],'transaction':_0x49be2c});});}})['catch'](handleError(_0xe87da0,null));});}})[_0x9d5f('0x45')](function(_0xac1199){var _0xe7e44b=_[_0x9d5f('0x2f')](_0xac1199,function(_0x11cb13){return _0x11cb13[_0x9d5f('0x4f')]({'plain':!![]});});})[_0x9d5f('0x45')](respondWithResult(_0xe87da0,null))[_0x9d5f('0x47')](handleError(_0xe87da0,null));};exports['removeResources']=function(_0x9b1842,_0x18604e,_0x5373f7){return db[_0x9d5f('0x30')][_0x9d5f('0x4a')]({'where':{'id':_0x9b1842[_0x9d5f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18604e,null))[_0x9d5f('0x45')](function(_0x1db771){if(_0x1db771){return _0x1db771[_0x9d5f('0x6d')](_0x9b1842['query'][_0x9d5f('0x5f')]);}})['then'](respondWithStatusCode(_0x18604e,null))['catch'](handleError(_0x18604e,null));};exports[_0x9d5f('0x6e')]=function(_0x407286,_0x45bdeb){var _0x49a412={};if(!_0x407286['query'][_0x9d5f('0x6f')])throw new Error(_0x9d5f('0x70'));if(!_0x407286[_0x9d5f('0x36')][_0x9d5f('0x3c')](_0x9d5f('0x3d'))){_0x49a412['limit']=qs[_0x9d5f('0x22')](_0x407286['query'][_0x9d5f('0x22')]);_0x49a412['offset']=qs[_0x9d5f('0x20')](_0x407286[_0x9d5f('0x36')][_0x9d5f('0x20')]);}return db[_0x9d5f('0x30')][_0x9d5f('0x4a')]({'where':{'id':_0x407286['params']['id']}})['then'](function(_0x226a1c){if(!_0x226a1c)throw new Error(_0x9d5f('0x71')+_0x407286[_0x9d5f('0x4e')]['id']);return db['UserProfile']['getResources'](_0x407286);})[_0x9d5f('0x45')](respondWithFilteredResult(_0x45bdeb,_0x49a412))[_0x9d5f('0x47')](handleError(_0x45bdeb,null));}; \ No newline at end of file +var _0x723c=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','autoAssociation','userProfileId','Resources','UserProfileResource','describe','addSections','sequelize','each','push','removeSections','enabled','includes','sectionId','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5fb9da,_0x1ac0d0){var _0x528081=function(_0x24793f){while(--_0x24793f){_0x5fb9da['push'](_0x5fb9da['shift']());}};_0x528081(++_0x1ac0d0);}(_0x723c,0x1ad));var _0xc723=function(_0x447e2f,_0x47a0ed){_0x447e2f=_0x447e2f-0x0;var _0x523ad4=_0x723c[_0x447e2f];return _0x523ad4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc723('0x0'));var zipdir=require(_0xc723('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc723('0x2'));var moment=require('moment');var BPromise=require(_0xc723('0x3'));var Mustache=require(_0xc723('0x4'));var util=require(_0xc723('0x5'));var path=require(_0xc723('0x6'));var sox=require(_0xc723('0x7'));var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc723('0xa'));var squel=require(_0xc723('0xb'));var crypto=require('crypto');var jsforce=require(_0xc723('0xc'));var deskjs=require(_0xc723('0xd'));var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc723('0x10'));var as=require(_0xc723('0x11'));var hardwareService=require(_0xc723('0x12'));var logger=require(_0xc723('0x13'))('api');var utils=require(_0xc723('0x14'));var config=require(_0xc723('0x15'));var licenseUtil=require(_0xc723('0x16'));var db=require(_0xc723('0x17'))['db'];config[_0xc723('0x18')]=_['defaults'](config[_0xc723('0x18')],{'host':_0xc723('0x19'),'port':0x18eb});var socket=require(_0xc723('0x1a'))(new Redis(config[_0xc723('0x18')]));require(_0xc723('0x1b'))['register'](socket);function respondWithStatusCode(_0x2e8be7,_0x5426f8){_0x5426f8=_0x5426f8||0xcc;return function(_0x5e37c1){if(_0x5e37c1){return _0x2e8be7[_0xc723('0x1c')](_0x5426f8);}return _0x2e8be7[_0xc723('0x1d')](_0x5426f8)[_0xc723('0x1e')]();};}function respondWithResult(_0x309574,_0x15f2c3){_0x15f2c3=_0x15f2c3||0xc8;return function(_0x165a8f){if(_0x165a8f){return _0x309574[_0xc723('0x1d')](_0x15f2c3)[_0xc723('0x1f')](_0x165a8f);}};}function respondWithFilteredResult(_0x5345a4,_0x931da1){return function(_0x41b4af){if(_0x41b4af){var _0x1f095e=typeof _0x931da1[_0xc723('0x20')]==='undefined'&&typeof _0x931da1['limit']===_0xc723('0x21');var _0x298470=_0x41b4af[_0xc723('0x22')];var _0xcae217=_0x1f095e?0x0:_0x931da1[_0xc723('0x20')];var _0x5478ec=_0x1f095e?_0x41b4af[_0xc723('0x22')]:_0x931da1[_0xc723('0x20')]+_0x931da1[_0xc723('0x23')];var _0x172cf0;if(_0x5478ec>=_0x298470){_0x5478ec=_0x298470;_0x172cf0=0xc8;}else{_0x172cf0=0xce;}_0x5345a4[_0xc723('0x1d')](_0x172cf0);return _0x5345a4[_0xc723('0x24')](_0xc723('0x25'),_0xcae217+'-'+_0x5478ec+'/'+_0x298470)[_0xc723('0x1f')](_0x41b4af);}return null;};}function patchUpdates(_0x1de575){return function(_0x43265c){try{jsonpatch[_0xc723('0x26')](_0x43265c,_0x1de575,!![]);}catch(_0xf77cc5){return BPromise['reject'](_0xf77cc5);}return _0x43265c[_0xc723('0x27')]();};}function saveUpdates(_0x4cd1ee,_0x2728a5){return function(_0x380fb5){if(_0x380fb5){return _0x380fb5[_0xc723('0x28')](_0x4cd1ee)['then'](function(_0x41fb45){return _0x41fb45;});}return null;};}function removeEntity(_0x1a4811,_0x4ed3ca){return function(_0x5acbda){if(_0x5acbda){return _0x5acbda[_0xc723('0x29')]()[_0xc723('0x2a')](function(){_0x1a4811[_0xc723('0x1d')](0xcc)[_0xc723('0x1e')]();});}};}function handleEntityNotFound(_0x4066cd,_0x40a594){return function(_0x1670cf){if(!_0x1670cf){_0x4066cd[_0xc723('0x1c')](0x194);}return _0x1670cf;};}function handleError(_0x5b9cb6,_0x567895){_0x567895=_0x567895||0x1f4;return function(_0x2ccef6){logger[_0xc723('0x2b')](_0x2ccef6[_0xc723('0x2c')]);if(_0x2ccef6['name']){delete _0x2ccef6[_0xc723('0x2d')];}_0x5b9cb6[_0xc723('0x1d')](_0x567895)[_0xc723('0x2e')](_0x2ccef6);};}exports[_0xc723('0x2f')]=function(_0x4e874b,_0x14186d){var _0x13407b={},_0x81801={},_0x5acc14={'count':0x0,'rows':[]};var _0x35f71e=_[_0xc723('0x30')](db[_0xc723('0x31')]['rawAttributes'],function(_0x25f85d){return{'name':_0x25f85d['fieldName'],'type':_0x25f85d['type']['key']};});_0x81801[_0xc723('0x32')]=_[_0xc723('0x30')](_0x35f71e,'name');_0x81801[_0xc723('0x33')]=_[_0xc723('0x34')](_0x4e874b[_0xc723('0x33')]);_0x81801[_0xc723('0x35')]=_[_0xc723('0x36')](_0x81801[_0xc723('0x32')],_0x81801[_0xc723('0x33')]);_0x13407b[_0xc723('0x37')]=_[_0xc723('0x36')](_0x81801[_0xc723('0x32')],qs[_0xc723('0x38')](_0x4e874b[_0xc723('0x33')]['fields']));_0x13407b[_0xc723('0x37')]=_0x13407b['attributes']['length']?_0x13407b[_0xc723('0x37')]:_0x81801['model'];if(!_0x4e874b['query'][_0xc723('0x39')](_0xc723('0x3a'))){_0x13407b[_0xc723('0x23')]=qs[_0xc723('0x23')](_0x4e874b['query'][_0xc723('0x23')]);_0x13407b[_0xc723('0x20')]=qs[_0xc723('0x20')](_0x4e874b[_0xc723('0x33')][_0xc723('0x20')]);}_0x13407b['order']=qs[_0xc723('0x3b')](_0x4e874b[_0xc723('0x33')][_0xc723('0x3b')]);_0x13407b[_0xc723('0x3c')]=qs[_0xc723('0x35')](_['pick'](_0x4e874b[_0xc723('0x33')],_0x81801['filters']),_0x35f71e);if(_0x4e874b[_0xc723('0x33')][_0xc723('0x3d')]){_0x13407b[_0xc723('0x3c')]=_[_0xc723('0x3e')](_0x13407b[_0xc723('0x3c')],{'$or':_['map'](_0x35f71e,function(_0x41e738){if(_0x41e738[_0xc723('0x3f')]!==_0xc723('0x40')){var _0x11682b={};_0x11682b[_0x41e738[_0xc723('0x2d')]]={'$like':'%'+_0x4e874b[_0xc723('0x33')]['filter']+'%'};return _0x11682b;}})});}_0x13407b=_['merge']({},_0x13407b,_0x4e874b[_0xc723('0x41')]);var _0x17926b={'where':_0x13407b[_0xc723('0x3c')]};return db[_0xc723('0x31')][_0xc723('0x22')](_0x17926b)['then'](function(_0x435b3b){_0x5acc14[_0xc723('0x22')]=_0x435b3b;if(_0x4e874b[_0xc723('0x33')][_0xc723('0x42')]){_0x13407b[_0xc723('0x43')]=[{'all':!![]}];}return db[_0xc723('0x31')][_0xc723('0x44')](_0x13407b);})[_0xc723('0x2a')](function(_0x3fd3ee){_0x5acc14[_0xc723('0x45')]=_0x3fd3ee;return _0x5acc14;})['then'](respondWithFilteredResult(_0x14186d,_0x13407b))['catch'](handleError(_0x14186d,null));};exports['show']=function(_0x379c5a,_0x50f4b7){var _0x926e98={'raw':![],'where':{'id':_0x379c5a[_0xc723('0x46')]['id']}},_0x26ad1e={};_0x26ad1e['model']=_['keys'](db['UserProfile'][_0xc723('0x47')]);_0x26ad1e[_0xc723('0x33')]=_[_0xc723('0x34')](_0x379c5a[_0xc723('0x33')]);_0x26ad1e['filters']=_[_0xc723('0x36')](_0x26ad1e[_0xc723('0x32')],_0x26ad1e[_0xc723('0x33')]);_0x926e98[_0xc723('0x37')]=_[_0xc723('0x36')](_0x26ad1e['model'],qs[_0xc723('0x38')](_0x379c5a[_0xc723('0x33')][_0xc723('0x38')]));_0x926e98[_0xc723('0x37')]=_0x926e98[_0xc723('0x37')][_0xc723('0x48')]?_0x926e98[_0xc723('0x37')]:_0x26ad1e['model'];if(_0x379c5a[_0xc723('0x33')][_0xc723('0x42')]){_0x926e98[_0xc723('0x43')]=[{'all':!![]}];}_0x926e98=_['merge']({},_0x926e98,_0x379c5a[_0xc723('0x41')]);return db[_0xc723('0x31')][_0xc723('0x49')](_0x926e98)[_0xc723('0x2a')](handleEntityNotFound(_0x50f4b7,null))[_0xc723('0x2a')](respondWithResult(_0x50f4b7,null))[_0xc723('0x4a')](handleError(_0x50f4b7,null));};exports[_0xc723('0x4b')]=function(_0x306b59,_0x21b2d3){return db[_0xc723('0x31')][_0xc723('0x4b')](_0x306b59[_0xc723('0x4c')],{})['then'](respondWithResult(_0x21b2d3,0xc9))['catch'](handleError(_0x21b2d3,null));};exports[_0xc723('0x4d')]=function(_0x50738d,_0x164c3d){var _0x2938d3={'where':{'id':_0x50738d[_0xc723('0x46')]['id']}},_0x1e6d72={};_0x1e6d72['model']=_[_0xc723('0x34')](db[_0xc723('0x31')][_0xc723('0x47')]);_0x2938d3[_0xc723('0x37')]=_[_0xc723('0x36')](_0x1e6d72[_0xc723('0x32')],qs[_0xc723('0x38')](_0x50738d['query'][_0xc723('0x38')]));_0x2938d3[_0xc723('0x37')]=_0x2938d3[_0xc723('0x37')][_0xc723('0x48')]?_0x2938d3[_0xc723('0x37')]:_0x1e6d72[_0xc723('0x32')];if(_0x50738d['query'][_0xc723('0x42')]){_0x2938d3[_0xc723('0x43')]=[{'all':!![]}];}_0x2938d3=_[_0xc723('0x3e')]({},_0x2938d3,_0x50738d['options']);return db[_0xc723('0x31')][_0xc723('0x49')](_0x2938d3)[_0xc723('0x2a')](handleEntityNotFound(_0x164c3d,null))[_0xc723('0x2a')](function(_0x3c0dfa){if(_0x3c0dfa){var _0x3a5fc2=_0x3c0dfa[_0xc723('0x4e')]({'plain':!![]});_0x3a5fc2=qs[_0xc723('0x4f')](_0x3a5fc2,['id','createdAt',_0xc723('0x50'),_0xc723('0x51')]);_0x50738d['body']=_[_0xc723('0x4f')](_0x50738d[_0xc723('0x4c')],['id',_0xc723('0x52'),'updatedAt']);return db['sequelize'][_0xc723('0x53')](function(_0x34274c){return db['UserProfile']['create'](_['merge'](_0x3a5fc2,_0x50738d[_0xc723('0x4c')]),{'include':_0x50738d['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x34274c})['then'](function(_0x1c03a9){var _0x33c962=_0x1c03a9[_0xc723('0x4e')]({'plain':!![]});return db[_0xc723('0x54')]['findAll']({'where':{'userProfileId':_0x50738d[_0xc723('0x46')]['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x55d5c7){if(_0x55d5c7){return BPromise['each'](_0x55d5c7,function(_0x1fdd41){return new BPromise(function(_0x2395b3,_0x221d5a){if(_0x1fdd41[_0xc723('0x55')]===null||_0x1fdd41[_0xc723('0x55')]===0x1)_0x2395b3(null);return db['UserProfileResource'][_0xc723('0x44')]({'where':{'sectionId':_0x1fdd41['id']},'raw':!![]})['then'](function(_0x3cfd3b){var _0x184811=_['map'](_0x3cfd3b,function(_0x5ef4dd){return qs[_0xc723('0x4f')](_0x5ef4dd,['id',_0xc723('0x52'),'updatedAt','sectionId']);});_0x2395b3(_0x184811);})[_0xc723('0x4a')](function(_0x49c2e5){_0x221d5a(_0x49c2e5);});})[_0xc723('0x2a')](function(_0x6d750){var _0x40dc70=qs[_0xc723('0x4f')](_0x1fdd41,['id',_0xc723('0x52'),_0xc723('0x50')]);_0x40dc70[_0xc723('0x56')]=_0x33c962['id'];if(_0x6d750)_0x40dc70[_0xc723('0x57')]=_0x6d750;return _0x40dc70;})[_0xc723('0x2a')](function(_0x2e8983){return db[_0xc723('0x54')]['create'](_0x2e8983,{'include':[{'model':db[_0xc723('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x34274c});});})['then'](function(){return _0x33c962;});}});});});}})[_0xc723('0x2a')](respondWithResult(_0x164c3d,0xc9))[_0xc723('0x4a')](handleError(_0x164c3d,null));};exports['update']=function(_0x548e16,_0x38cc10){if(_0x548e16[_0xc723('0x4c')]['id']){delete _0x548e16[_0xc723('0x4c')]['id'];}return db[_0xc723('0x31')]['find']({'where':{'id':_0x548e16[_0xc723('0x46')]['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x38cc10,null))[_0xc723('0x2a')](saveUpdates(_0x548e16[_0xc723('0x4c')],null))[_0xc723('0x2a')](respondWithResult(_0x38cc10,null))[_0xc723('0x4a')](handleError(_0x38cc10,null));};exports[_0xc723('0x29')]=function(_0x42d6b5,_0x1f7f6f){return db['UserProfile'][_0xc723('0x49')]({'where':{'id':_0x42d6b5[_0xc723('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f7f6f,null))[_0xc723('0x2a')](removeEntity(_0x1f7f6f,null))[_0xc723('0x4a')](handleError(_0x1f7f6f,null));};exports[_0xc723('0x59')]=function(_0x1e1292,_0x182ab1){return db[_0xc723('0x31')]['describe']()[_0xc723('0x2a')](respondWithResult(_0x182ab1,null))['catch'](handleError(_0x182ab1,null));};exports[_0xc723('0x5a')]=function(_0x4126e7,_0x161c6e){var _0x3cbf88=_0x4126e7[_0xc723('0x4c')];return db[_0xc723('0x31')][_0xc723('0x49')]({'where':{'id':_0x4126e7['params']['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x161c6e,null))[_0xc723('0x2a')](function(_0x268b1f){if(_0x268b1f){return db[_0xc723('0x5b')][_0xc723('0x53')](function(_0x3d4fb5){return db['UserProfileSection'][_0xc723('0x29')]({'where':{'userProfileId':_0x4126e7[_0xc723('0x46')]['id'],'sectionId':_[_0xc723('0x30')](_0x3cbf88,function(_0x39e50b){return _0x39e50b['sectionId'];})},'transaction':_0x3d4fb5})['then'](function(){var _0x13f9b2=_[_0xc723('0x30')](_0x3cbf88,function(_0x4d771e){_0x4d771e['userProfileId']=_0x4126e7['params']['id'];return _0x4d771e;});var _0x1ca816=[];return BPromise[_0xc723('0x5c')](_0x13f9b2,function(_0x1f90a6){return db[_0xc723('0x54')][_0xc723('0x4b')](_0x1f90a6,{'include':[{'model':db[_0xc723('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x3d4fb5})[_0xc723('0x2a')](function(_0x531e06){_0x1ca816[_0xc723('0x5d')](_0x531e06[_0xc723('0x4e')]({'plain':!![]}));});})[_0xc723('0x2a')](function(){return _0x1ca816;});});});}})[_0xc723('0x2a')](function(_0x476c7b){return _0x476c7b;})['then'](respondWithResult(_0x161c6e,null))['catch'](handleError(_0x161c6e,null));};exports[_0xc723('0x5e')]=function(_0x442e78,_0x1abde5){var _0x1690d3;return db[_0xc723('0x31')]['find']({'where':{'id':_0x442e78['params']['id']},'attributes':['id',_0xc723('0x2d')]})[_0xc723('0x2a')](handleEntityNotFound(_0x1abde5,null))[_0xc723('0x2a')](function(_0x3a42ed){if(_0x3a42ed){_0x1690d3=_0x3a42ed;return db[_0xc723('0x54')][_0xc723('0x29')]({'where':{'userProfileId':_0x442e78[_0xc723('0x46')]['id'],'sectionId':_0x442e78[_0xc723('0x33')]['ids']}});}})[_0xc723('0x2a')](function(){return _0x1690d3;})[_0xc723('0x2a')](respondWithStatusCode(_0x1abde5,null))['catch'](handleError(_0x1abde5,null));};exports['getSections']=function(_0x160c84,_0x1518f3){var _0x16bfa0=[];var _0x1120dc=[];return db[_0xc723('0x54')]['findAll']({'where':{'userProfileId':_0x160c84[_0xc723('0x46')]['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x32bd9a){_0x16bfa0=_[_0xc723('0x3d')](_0x32bd9a,function(_0x32a393){return _0x32a393[_0xc723('0x5f')]===0x1||_[_0xc723('0x60')]([0x3eb,0x709],_0x32a393[_0xc723('0x61')]);});if(!_[_0xc723('0x62')](_0x16bfa0)){return _['map'](_0x16bfa0,function(_0x73751){return _0x73751[_0xc723('0x61')];});}else{return;}})[_0xc723('0x2a')](function(_0x344f32){if(_0x344f32)_0x1120dc=_0x344f32;if(_[_0xc723('0x60')](_0x1120dc,0x64)){var _0x44c9de=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x64});return hasDefaultDashboard(_0x44c9de)[_0xc723('0x2a')](function(_0x2f315c){return _[_0xc723('0x30')](_0x16bfa0,function(_0xd73d21){if(_0xd73d21[_0xc723('0x61')]===0x64){_0xd73d21[_0xc723('0x63')]=_0x2f315c;}return _0xd73d21;});});}else{return;}})[_0xc723('0x2a')](function(_0x4bab1a){if(_0x4bab1a)_0x16bfa0=_0x4bab1a;if(_[_0xc723('0x60')](_0x1120dc,0x3eb)){var _0x253771=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x3eb});return getCustomDashboards(_0x253771)['then'](function(_0x1139cc){return _['map'](_0x16bfa0,function(_0x59c898){if(_0x253771[_0xc723('0x5f')]){if(_0x59c898[_0xc723('0x61')]===0x3eb){_0x59c898[_0xc723('0x63')]=_0x1139cc;}}else{if(_0x59c898['sectionId']===0x64){_0x59c898['subsections']=_0x1139cc;}}return _0x59c898;});});}else{return;}})['then'](function(_0x36ad6e){if(_0x36ad6e)_0x16bfa0=_0x36ad6e;if(_[_0xc723('0x60')](_0x1120dc,0x709)){var _0x2c7a19=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x709});return getPlugins(_0x2c7a19)[_0xc723('0x2a')](function(_0x9dc0fa){if(_0x2c7a19[_0xc723('0x5f')]){return _[_0xc723('0x30')](_0x16bfa0,function(_0x49198a){if(_0x49198a['sectionId']===0x709){_0x49198a[_0xc723('0x63')]=_0x9dc0fa;}return _0x49198a;});}else{var _0x1a1c8a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9dc0fa};var _0x1a47f1=_[_0xc723('0x30')](_0x16bfa0);_0x1a47f1['push'](_0x1a1c8a);return _0x1a47f1;}});}else{return;}})[_0xc723('0x2a')](function(_0x2d7287){if(_0x2d7287)_0x16bfa0=_0x2d7287;return _['filter'](_0x16bfa0,[_0xc723('0x5f'),0x1]);})[_0xc723('0x2a')](respondWithResult(_0x1518f3,null))[_0xc723('0x4a')](handleError(_0x1518f3,null));};function hasDefaultDashboard(_0x5d36dc){var _0xcea9e4=[0x65];return new BPromise(function(_0x13fe7e,_0x4f1a65){try{if(_0x5d36dc[_0xc723('0x55')]){_0x13fe7e(_0xcea9e4);}else{return db['UserProfileResource'][_0xc723('0x64')]({'where':{'sectionId':_0x5d36dc['id']},'raw':!![]})['then'](function(_0x5c413a){_0x5c413a?_0x13fe7e(_0xcea9e4):_0x13fe7e();});}}catch(_0x459cc0){_0x4f1a65(_0x459cc0);}});}function getCustomDashboards(_0x4a5e90){var _0x5271eb=[];return new BPromise(function(_0x7dfbf6,_0x54525e){try{if(_0x4a5e90[_0xc723('0x55')]){return db[_0xc723('0x65')][_0xc723('0x44')]({'raw':!![]})[_0xc723('0x2a')](function(_0x4cb086){_0x4cb086[_0xc723('0x66')](function(_0x29eddb){_0x5271eb[_0xc723('0x5d')](_0x29eddb['id']+0x1869f);});_0x7dfbf6(_0x5271eb);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4a5e90['id']},'raw':!![]})['then'](function(_0x4c828e){_0x4c828e[_0xc723('0x66')](function(_0x4a7e65){_0x5271eb[_0xc723('0x5d')](_0x4a7e65['resourceId']+0x1869f);});_0x7dfbf6(_0x5271eb);});}}catch(_0x4da573){_0x54525e(_0x4da573);}});}function getPlugins(_0x460ba3){var _0x57f43b=[];return new BPromise(function(_0x2880e1,_0x5df523){try{if(_0x460ba3[_0xc723('0x55')]){return db[_0xc723('0x67')]['findAll']({'raw':!![]})[_0xc723('0x2a')](function(_0x2edcb8){_0x2edcb8[_0xc723('0x66')](function(_0x5438cc){_0x57f43b[_0xc723('0x5d')](_0x5438cc['id']+0x15b38);});_0x2880e1(_0x57f43b);});}else{return db[_0xc723('0x58')][_0xc723('0x44')]({'where':{'sectionId':_0x460ba3['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x3e914e){_0x3e914e[_0xc723('0x66')](function(_0x1cc5dd){_0x57f43b[_0xc723('0x5d')](_0x1cc5dd[_0xc723('0x68')]+0x15b38);});_0x2880e1(_0x57f43b);});}}catch(_0xe0f626){_0x5df523(_0xe0f626);}});}exports[_0xc723('0x69')]=function(_0xdbe6c,_0x54ce4f){return db['UserProfile']['find']({'where':{'id':_0xdbe6c[_0xc723('0x46')]['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x54ce4f,null))[_0xc723('0x2a')](function(_0x21b35d){if(_0x21b35d){return db[_0xc723('0x5b')][_0xc723('0x53')](function(_0x1edca7){return db['UserProfileSection'][_0xc723('0x44')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xc723('0x2a')](function(_0x3552fe){if(_0x3552fe){return db[_0xc723('0x54')][_0xc723('0x29')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id'],'id':_[_0xc723('0x30')](_0x3552fe,function(_0x45e413){return _0x45e413['id'];})},'transaction':_0x1edca7});}})[_0xc723('0x2a')](function(_0x17ed23){var _0x796d6b=_[_0xc723('0x30')](_0xdbe6c['body'],function(_0x570344){_0x570344[_0xc723('0x56')]=_0xdbe6c['params']['id'];return _0x570344;});return db[_0xc723('0x54')]['bulkCreate'](_0x796d6b,{'raw':!![],'transaction':_0x1edca7});})['then'](function(_0x1e44f4){var _0x3a6f35=_['filter'](_[_0xc723('0x30')](_0x1e44f4,function(_0x7d0722){return _0x7d0722[_0xc723('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a6f35){return db['UserProfileSection'][_0xc723('0x44')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id'],'sectionId':_[_0xc723('0x30')](_0x3a6f35,function(_0x1a803b){return _0x1a803b[_0xc723('0x61')];})},'attributes':['id',_0xc723('0x61')],'raw':!![]})[_0xc723('0x2a')](function(_0x4b6848){var _0x16b572=_[_0xc723('0x30')](_0xdbe6c[_0xc723('0x4c')],function(_0x5d2f81){_0x5d2f81[_0xc723('0x56')]=_0xdbe6c[_0xc723('0x46')]['id'];return _0x5d2f81;});return db[_0xc723('0x58')][_0xc723('0x6a')](_0x16b572,{'raw':!![],'transaction':_0x1edca7});});}})[_0xc723('0x4a')](handleError(_0x54ce4f,null));});}})[_0xc723('0x2a')](function(_0x3bda59){var _0x3fe7d4=_[_0xc723('0x30')](_0x3bda59,function(_0x389323){return _0x389323[_0xc723('0x4e')]({'plain':!![]});});})[_0xc723('0x2a')](respondWithResult(_0x54ce4f,null))['catch'](handleError(_0x54ce4f,null));};exports[_0xc723('0x6b')]=function(_0x17ba11,_0x34dc9a,_0x12035c){return db[_0xc723('0x31')][_0xc723('0x49')]({'where':{'id':_0x17ba11['params']['id']}})['then'](handleEntityNotFound(_0x34dc9a,null))['then'](function(_0x4be1bc){if(_0x4be1bc){return _0x4be1bc[_0xc723('0x6b')](_0x17ba11[_0xc723('0x33')]['ids']);}})[_0xc723('0x2a')](respondWithStatusCode(_0x34dc9a,null))['catch'](handleError(_0x34dc9a,null));};exports[_0xc723('0x6c')]=function(_0x213900,_0x3a364b){var _0x112d68={};if(!_0x213900[_0xc723('0x33')][_0xc723('0x6d')])throw new Error(_0xc723('0x6e'));if(!_0x213900[_0xc723('0x33')][_0xc723('0x39')](_0xc723('0x3a'))){_0x112d68[_0xc723('0x23')]=qs[_0xc723('0x23')](_0x213900[_0xc723('0x33')]['limit']);_0x112d68[_0xc723('0x20')]=qs['offset'](_0x213900['query'][_0xc723('0x20')]);}return db['UserProfile'][_0xc723('0x49')]({'where':{'id':_0x213900[_0xc723('0x46')]['id']}})['then'](function(_0x8c2050){if(!_0x8c2050)throw new Error(_0xc723('0x6f')+_0x213900[_0xc723('0x46')]['id']);return db[_0xc723('0x31')][_0xc723('0x6c')](_0x213900);})[_0xc723('0x2a')](respondWithFilteredResult(_0x3a364b,_0x112d68))[_0xc723('0x4a')](handleError(_0x3a364b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 2e2ea27..97433ad 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 _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x5e6dc5,_0x4badde){var _0x1a8b75=function(_0x4ae6f2){while(--_0x4ae6f2){_0x5e6dc5['push'](_0x5e6dc5['shift']());}};_0x1a8b75(++_0x4badde);}(_0x3914,0xeb));var _0x4391=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x3914[_0x195c21];return _0x3576a8;};'use strict';var EventEmitter=require(_0x4391('0x0'));var UserProfile=require(_0x4391('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){UserProfileEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);UserProfileEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x9e6d=['save','remove','emit','exports','events','UserProfile','setMaxListeners'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2f5a87,_0x450cb7){_0x2f5a87=_0x2f5a87-0x0;var _0x46b6c0=_0x9e6d[_0x2f5a87];return _0x46b6c0;};'use strict';var EventEmitter=require(_0xd9e6('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd9e6('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd9e6('0x2')](0x0);var events={'afterCreate':_0xd9e6('0x3'),'afterUpdate':'update','afterDestroy':_0xd9e6('0x4')};function emitEvent(_0x1d5756){return function(_0x2f1c0,_0x3b2951,_0x5e363d){UserProfileEvents[_0xd9e6('0x5')](_0x1d5756+':'+_0x2f1c0['id'],_0x2f1c0);UserProfileEvents[_0xd9e6('0x5')](_0x1d5756,_0x2f1c0);_0x5e363d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd9e6('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 8b72456..e563d59 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 _0x430c=['rows','ids','Tags','color','tag','Tag','ThroughTags','Agents','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','squel','exports','filter','field','value','findAll','then','associatedResources','map','model','name','catch','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','childModel','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','telephones','admin','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','length','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','where','pick','merge','key','foreignKey','options','includeAll','include','forEach','reportType','default','custom','CustomReports','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x430c,0x1a1));var _0xc430=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x430c[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xc430('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xc430('0x1'));module[_0xc430('0x2')]=function(_0x1d5b5e){var _0x503988=_0x1d5b5e['models'];function _0x5ccda6(_0x47d8b9,_0x338a82){return new Promise(function(_0x2408f5,_0x50b256){if(!_0x338a82)return _0x2408f5(null);var _0x42aa9c=_0x338a82['filter']?{[_0x338a82[_0xc430('0x3')][_0xc430('0x4')]]:_0x338a82[_0xc430('0x3')][_0xc430('0x5')]}:undefined;return _0x503988[_0x47d8b9][_0xc430('0x6')]({'where':_0x42aa9c,'raw':!![]})[_0xc430('0x7')](function(_0x861581){_0x338a82[_0xc430('0x8')]=_[_0xc430('0x9')](_0x861581,'id');_0x2408f5(_0x338a82);})['catch'](function(_0x97fa5b){_0x50b256(_0x97fa5b);});});}function _0x2b47d6(_0x56c090,_0x39e624){return new Promise(function(_0x5aeed9,_0x3b84bc){var _0x47e664=_0x56c090[_0xc430('0x3')]?{[_0x56c090[_0xc430('0x3')][_0xc430('0x4')]]:_0x56c090[_0xc430('0x3')][_0xc430('0x5')]}:undefined;return _0x503988[_0x56c090[_0xc430('0xa')]][_0xc430('0x6')]({'where':_0x47e664,'raw':!![]})['then'](function(_0x4e9134){_0x39e624[_0xc430('0x8')]=_[_0xc430('0x9')](_0x4e9134,function(_0x17d5c8){return _0x17d5c8[_0xc430('0xb')];});_0x5aeed9(_0x39e624);})[_0xc430('0xc')](function(_0x55cc6c){_0x3b84bc(_0x55cc6c);});});}function _0x111598(_0x4aeb72,_0x4bf91f,_0x2e7987){if(!_0x4bf91f)return Promise[_0xc430('0xd')](null);return new Promise(function(_0x2327c5,_0x5830b0){return _0x503988['UserProfileResource'][_0xc430('0x6')]({'where':{'sectionId':_0x4bf91f['id']},'raw':!![]})['then'](function(_0x2bcb21){if(_0x4aeb72['field']&&_0x4aeb72['field']!=='id'){_0x4bf91f[_0xc430('0x8')]=_['map'](_0x2bcb21,function(_0x302926){return _0x302926[_0x4aeb72[_0xc430('0x4')]];});}else{if(_0x2e7987===_0xc430('0xe')){_0x4bf91f[_0xc430('0x8')]=_[_0xc430('0x9')](_0x2bcb21,function(_0x5af282){return{'id':_0x5af282[_0xc430('0xf')],'type':_0x5af282['type']};});}else{_0x4bf91f['associatedResources']=_[_0xc430('0x9')](_0x2bcb21,function(_0x2ea352){return _0x2ea352[_0xc430('0xf')];});}}_0x2327c5(_0x4bf91f);})['catch'](function(_0x3fd56b){_0x5830b0(_0x3fd56b);});});}function _0x57d26e(_0x23425d,_0x22ebfb){var _0x4efecd={'parentSections':[]};switch(_0x23425d[_0xc430('0x10')]()){case _0xc430('0x11'):_0x4efecd['childModel']=_0xc430('0x12');break;case'odbc':_0x4efecd[_0xc430('0x13')]='SquareOdbc';break;case _0xc430('0x14'):_0x4efecd[_0xc430('0x13')]='SquareRecording';_0x4efecd[_0xc430('0x15')]=[{'name':_0xc430('0x16'),'field':_0xc430('0xb'),'foreignKey':_0xc430('0x17')}];break;case _0xc430('0x18'):_0x4efecd['childModel']=_0xc430('0x19');break;case _0xc430('0x1a'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x1b');_0x4efecd['parentSections']=[{'name':_0xc430('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xc430('0x1d'):_0x4efecd['childModel']=_0xc430('0x1e');break;case _0xc430('0x1f'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x20');break;case'globalcustomfields':_0x4efecd[_0xc430('0x13')]=_0xc430('0x21');break;case _0xc430('0x22'):_0x4efecd[_0xc430('0x13')]='ChatQueue';break;case _0xc430('0x23'):_0x4efecd[_0xc430('0x13')]='ChatWebsite';break;case _0xc430('0x24'):_0x4efecd['childModel']='FaxQueue';break;case _0xc430('0x25'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x26');break;case _0xc430('0x27'):case _0xc430('0x28'):case _0xc430('0x29'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x2a');break;case'contexts':_0x4efecd[_0xc430('0x13')]='VoiceContext';break;case _0xc430('0x2b'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x2c');break;case _0xc430('0x2d'):_0x4efecd['childModel']=_0xc430('0x2e');_0x4efecd['parentSections']=[{'name':'Agents','field':_0xc430('0xb'),'foreignKey':_0xc430('0x2f'),'model':'User','filter':{'field':_0xc430('0x30'),'value':[_0xc430('0x31')]}},{'name':_0xc430('0x32'),'field':_0xc430('0xb'),'foreignKey':_0xc430('0x2f'),'model':_0xc430('0x33'),'filter':{'field':_0xc430('0x30'),'value':[_0xc430('0x34')]}},{'name':_0xc430('0x35'),'field':_0xc430('0xb'),'foreignKey':_0xc430('0x36'),'model':_0xc430('0x37'),'filter':{'field':_0xc430('0x38'),'value':[_0xc430('0x39')]}},{'name':_0xc430('0x3a'),'field':'name','foreignKey':_0xc430('0x36'),'model':_0xc430('0x37'),'filter':{'field':_0xc430('0x38'),'value':[_0xc430('0x3b')]}}];break;case'musiconholds':_0x4efecd[_0xc430('0x13')]=_0xc430('0x3c');break;case _0xc430('0x3d'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x3e');break;case _0xc430('0x3f'):_0x4efecd['childModel']=_0xc430('0x40');break;case _0xc430('0x41'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x42');break;case _0xc430('0x43'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x44');break;case _0xc430('0x45'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x46');break;case _0xc430('0x47'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x48');break;case _0xc430('0x49'):_0x4efecd['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x4efecd[_0xc430('0x13')]=_0xc430('0x4a');break;case _0xc430('0x4b'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x4c');break;case _0xc430('0x4d'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x4e');break;case _0xc430('0x4f'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x50');break;case _0xc430('0x51'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x52');break;case _0xc430('0x53'):_0x4efecd[_0xc430('0x13')]='Team';break;case _0xc430('0x54'):case _0xc430('0x55'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x37');if(_0x22ebfb){_0x4efecd[_0xc430('0x15')]=[{'name':_0xc430('0x35')},{'name':_0xc430('0x3a')}];}break;case _0xc430('0x56'):case'agents':case _0xc430('0x57'):_0x4efecd['childModel']=_0xc430('0x33');if(_0x22ebfb){_0x4efecd[_0xc430('0x15')]=[{'name':'Users','filter':{'field':'role','value':[_0xc430('0x58'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xc430('0x32')}];}break;case'zendeskaccounts':_0x4efecd[_0xc430('0x13')]=_0xc430('0x59');break;case _0xc430('0x5a'):_0x4efecd['childModel']=_0xc430('0x5b');break;case _0xc430('0x5c'):_0x4efecd[_0xc430('0x13')]='FreshdeskAccount';break;case _0xc430('0x5d'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x5e');break;case _0xc430('0x5f'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x60');break;case _0xc430('0x61'):_0x4efecd['childModel']=_0xc430('0x62');break;case _0xc430('0x63'):_0x4efecd[_0xc430('0x13')]='User';break;case _0xc430('0x64'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x65');break;case _0xc430('0x66'):_0x4efecd['childModel']=_0xc430('0x67');break;case'customdashboards':_0x4efecd[_0xc430('0x13')]=_0xc430('0x68');break;case _0xc430('0x69'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x6a');break;case _0xc430('0x6b'):_0x4efecd['childModel']=_0xc430('0x6c');break;case _0xc430('0x6d'):_0x4efecd['childModel']=_0xc430('0x6e');break;case _0xc430('0x6f'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x70');break;case'tags':_0x4efecd[_0xc430('0x13')]='Tag';break;case _0xc430('0x71'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x72');break;case _0xc430('0x73'):_0x4efecd['childModel']=_0xc430('0x74');break;case _0xc430('0x75'):_0x4efecd['childModel']='Trunk';break;case _0xc430('0x76'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x77');break;case _0xc430('0x78'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x79');break;case _0xc430('0x7a'):_0x4efecd['childModel']=_0xc430('0xe');_0x4efecd['parentSections']=[{'name':_0xc430('0x7b'),'field':'id','foreignKey':_0xc430('0x7c')}];break;case _0xc430('0x7d'):_0x4efecd[_0xc430('0x13')]=_0xc430('0x7e');break;}return _0x4efecd;}function _0x12b6f2(_0x540653,_0x1b2214){var _0x325387=_0x540653[_0xc430('0x7f')](0x0)[_0xc430('0x80')]()+_0x540653[_0xc430('0x81')](0x1);var _0xb4d28f={'type':_0x503988[_0xc430('0x82')]['QueryTypes'][_0xc430('0x83')],'raw':!![]};return new Promise(function(_0x52b5b4,_0x2a4ad3){var _0x4cc37b=squel[_0xc430('0x84')]()[_0xc430('0x4')](_0xc430('0x85')+_0x325387+_0xc430('0x86'),'id')[_0xc430('0x4')](_0xc430('0x87'))['from'](_0xc430('0x88')+_0x540653+_0xc430('0x89'),'ui')['where']('ui.UserId\x20=\x20?',_0x1b2214['id']);return _0x503988[_0xc430('0x8a')][_0xc430('0x8b')](_0x4cc37b[_0xc430('0x8c')](),_0xb4d28f)[_0xc430('0x7')](function(_0x3ca9ac){_0x1b2214[_0x325387+_0xc430('0x8d')]=_0x3ca9ac;_0x52b5b4(_0x3ca9ac);})[_0xc430('0xc')](function(_0x28fa9f){_0x2a4ad3(_0x28fa9f);});});}return _0x1d5b5e[_0xc430('0x8e')](_0xc430('0x8f'),attributes,{'tableName':_0xc430('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28199b){var _0x56cc9c={'raw':_0x28199b['query'][_0xc430('0x91')],'where':{}};var _0x56c6a8={};var _0x18596b={'count':0x0,'rows':[]};var _0x3ba16b=_0x28199b['query'][_0xc430('0x92')];var _0x4e1732=_0x28199b['query'][_0xc430('0x93')]||![];var _0x43d62f=_0x57d26e(_0x3ba16b,_0x4e1732);if(!_0x43d62f['childModel'])throw new Error(_0xc430('0x94')+_0x3ba16b+'\x27');var _0x5bb111=[{'name':_0x3ba16b}];if(!_['isEmpty'](_0x43d62f[_0xc430('0x15')]))_0x5bb111=_0x43d62f[_0xc430('0x15')];var _0xd4aae7=[];for(var _0x2c1620=0x0;_0x2c1620<_0x5bb111['length'];_0x2c1620++){_0xd4aae7[_0xc430('0x95')](_0x503988[_0xc430('0x96')][_0xc430('0x97')]({'where':{'userProfileId':_0x28199b[_0xc430('0x98')]['id'],'name':_0x5bb111[_0x2c1620]['name']},'raw':!![]}));}return Promise[_0xc430('0x99')](_0xd4aae7)[_0xc430('0x7')](function(_0x2c8840){var _0x304d1a=_[_0xc430('0x3')](_0x2c8840,function(_0x2c53c9){return _0x2c53c9?_0x2c53c9:undefined;});var _0x420942=_[_0xc430('0x3')](_0x5bb111,[_0xc430('0x9a'),!![]]);var _0x29ca31=_[_0xc430('0x9b')](_0x304d1a)&&_['isEmpty'](_0x420942)?null:_['union'](_0x420942,_0x304d1a);if(!_0x29ca31)return null;var _0x5e40ef=[];for(var _0x4000c0=0x0;_0x4000c0<_0x29ca31[_0xc430('0x9c')];_0x4000c0++){var _0xdde142=_['find'](_0x5bb111,function(_0x58fb03){return _0x29ca31[_0x4000c0]?_0x58fb03[_0xc430('0xb')]===_0x29ca31[_0x4000c0][_0xc430('0xb')]:null;});if(_0xdde142){if(_0x29ca31[_0x4000c0][_0xc430('0x9a')]){_0x5e40ef[_0xc430('0x95')](_0x5ccda6(_0x43d62f[_0xc430('0x13')],_0x29ca31[_0x4000c0]));}else{if(!_0x29ca31[_0x4000c0][_0xc430('0x9d')]){_0x5e40ef[_0xc430('0x95')](_0x111598(_0xdde142,_0x29ca31[_0x4000c0],_0x43d62f[_0xc430('0x13')]));}else{if(_0xdde142[_0xc430('0xa')]){_0x5e40ef[_0xc430('0x95')](_0x2b47d6(_0xdde142,_0x29ca31[_0x4000c0]));}}}}}return Promise['all'](_0x5e40ef);})[_0xc430('0x7')](function(_0x43ad3d){var _0x1c6390=_0x43ad3d;var _0x4e21bc=null;if(_0x1c6390){_0x4e21bc=_0x1c6390['length']===0x1?_0x1c6390[0x0]:null;}if(!_0x4e21bc&&!_0x1c6390)return _0x18596b;var _0x50b32a=_0x503988[_0x43d62f[_0xc430('0x13')]][_0xc430('0x9e')];_0x56c6a8[_0xc430('0xa')]=_[_0xc430('0x9f')](_0x50b32a);_0x56c6a8['query']=_[_0xc430('0x9f')](_0x28199b[_0xc430('0x8b')]);_0x56c6a8[_0xc430('0xa0')]=_['intersection'](_0x56c6a8[_0xc430('0xa')],_0x56c6a8['query']);_0x56cc9c[_0xc430('0xa1')]=_[_0xc430('0xa2')](_0x56c6a8[_0xc430('0xa')],qs[_0xc430('0xa3')](_0x28199b[_0xc430('0x8b')]['fields']));_0x56cc9c[_0xc430('0xa1')]=_0x56cc9c[_0xc430('0xa1')][_0xc430('0x9c')]?_0x56cc9c[_0xc430('0xa1')]:_0x56c6a8['model'];if(!_0x28199b['query'][_0xc430('0xa4')]('nolimit')){_0x56cc9c['limit']=qs[_0xc430('0xa5')](_0x28199b[_0xc430('0x8b')]['limit']);_0x56cc9c[_0xc430('0xa6')]=qs[_0xc430('0xa6')](_0x28199b[_0xc430('0x8b')][_0xc430('0xa6')]);}_0x56cc9c[_0xc430('0xa7')]=qs[_0xc430('0xa8')](_0x28199b['query'][_0xc430('0xa8')]);_0x56cc9c[_0xc430('0xa9')]=qs[_0xc430('0xa0')](_[_0xc430('0xaa')](_0x28199b['query'],_0x56c6a8[_0xc430('0xa0')]));if(_0x28199b[_0xc430('0x8b')][_0xc430('0x3')]){_0x56cc9c['where']=_[_0xc430('0xab')](_0x56cc9c['where'],{'$or':_['map'](_0x50b32a,function(_0x15242a){if(_0x15242a['type'][_0xc430('0xac')]!=='VIRTUAL'){var _0x22aac8={};_0x22aac8[_0x15242a[_0xc430('0x4')]]={'$like':'%'+_0x28199b['query'][_0xc430('0x3')]+'%'};return _0x22aac8;}})});}var _0x12a26b=[];var _0x5c90a1=null;var _0x3778e7={};if(_0x4e21bc){_0x5c90a1=_[_0xc430('0x97')](_0x5bb111,['name',_0x4e21bc[_0xc430('0xb')]]);if(_0x5c90a1[_0xc430('0x4')]){_0x3778e7={};if(_0x43d62f['childModel']===_0xc430('0xe')){_0x3778e7[_0x5c90a1[_0xc430('0xad')]]=_[_0xc430('0x9')](_0x4e21bc[_0xc430('0x8')],'id');}else{_0x3778e7[_0x5c90a1[_0xc430('0xad')]]=_0x4e21bc[_0xc430('0x8')];}_0x12a26b[_0xc430('0x95')](_0x3778e7);}else{_0x56cc9c[_0xc430('0xa9')]['id']=_0x4e21bc[_0xc430('0x8')];}}else{for(var _0x19789f=0x0;_0x19789f<_0x1c6390[_0xc430('0x9c')];_0x19789f++){_0x5c90a1=_['find'](_0x5bb111,[_0xc430('0xb'),_0x1c6390[_0x19789f][_0xc430('0xb')]]);if(_0x5c90a1[_0xc430('0x4')]){_0x3778e7={};_0x3778e7[_0x5c90a1['foreignKey']]=_0x1c6390[_0x19789f]['associatedResources'];_0x12a26b[_0xc430('0x95')](_0x3778e7);}else{if(!_0x56cc9c['where']['id'])_0x56cc9c[_0xc430('0xa9')]['id']=[];_0x1c6390[_0x19789f][_0xc430('0x8')]['forEach'](function(_0x4f47c0){_0x56cc9c[_0xc430('0xa9')]['id'][_0xc430('0x95')](_0x4f47c0);});}}}if(!_[_0xc430('0x9b')](_0x12a26b)){_0x56cc9c['where']=_[_0xc430('0xab')](_0x56cc9c['where'],{'$and':{'$or':_0x12a26b}});}_0x56cc9c=_['merge']({},_0x56cc9c,_0x28199b[_0xc430('0xae')]);if(_0x4e21bc&&!_0x4e21bc[_0xc430('0x9d')]&&_0x43d62f[_0xc430('0x13')]==='AnalyticExtractedReport'){if(_0x28199b[_0xc430('0x8b')][_0xc430('0xaf')]){_0x56cc9c[_0xc430('0xb0')]=[{'all':!![]}];}return _0x503988[_0x43d62f[_0xc430('0x13')]][_0xc430('0x6')](_0x56cc9c)['then'](function(_0x550472){var _0x1d0236=[];_0x550472[_0xc430('0xb1')](function(_0x45df86){var _0x2daabd;switch(_0x45df86[_0xc430('0xb2')]){case _0xc430('0xb3'):_0x2daabd=_[_0xc430('0x97')](_0x4e21bc[_0xc430('0x8')],function(_0x343cc8){return _0x343cc8['id']===_0x45df86[_0xc430('0x7c')]&&_0x343cc8[_0xc430('0x38')]==='DefaultReports';});break;case _0xc430('0xb4'):_0x2daabd=_[_0xc430('0x97')](_0x4e21bc[_0xc430('0x8')],function(_0x1176d6){return _0x1176d6['id']===_0x45df86['reportId']&&_0x1176d6['type']===_0xc430('0xb5');});break;}if(_0x2daabd)_0x1d0236['push'](_0x45df86);});_0x18596b[_0xc430('0xb6')]=_0x1d0236[_0xc430('0x9c')];_0x18596b[_0xc430('0xb7')]=_0x1d0236;return _0x18596b;});}else{if(!_[_0xc430('0x9b')](_0x28199b[_0xc430('0x8b')]['ids'])){_0x56cc9c['where']['id']=_0x56cc9c['where']['id']?_['intersection'](_0x56cc9c[_0xc430('0xa9')]['id'],_0x28199b['query']['ids']):_0x28199b[_0xc430('0x8b')][_0xc430('0xb8')];}return _0x503988[_0x43d62f[_0xc430('0x13')]][_0xc430('0xb6')]({'where':_0x56cc9c[_0xc430('0xa9')]})[_0xc430('0x7')](function(_0xadab04){_0x18596b[_0xc430('0xb6')]=_0xadab04;if(_0x28199b[_0xc430('0x8b')][_0xc430('0xaf')]){if(_0x43d62f[_0xc430('0x13')]===_0xc430('0x1b')){_0x56cc9c[_0xc430('0xb0')]=[{'model':_0x503988['Tag'],'as':_0xc430('0xb9'),'attributes':['id',_0xc430('0xb'),_0xc430('0xba')],'required':_0x28199b[_0xc430('0x8b')][_0xc430('0xbb')]?!![]:![]},{'model':_0x503988[_0xc430('0xbc')],'as':_0xc430('0xbd'),'attributes':['id',_0xc430('0xb'),'color'],'through':_0x28199b[_0xc430('0x8b')][_0xc430('0xbb')]?{'attributes':[],'where':{'TagId':_0x28199b['query'][_0xc430('0xbb')]||undefined}}:{},'required':_0x28199b[_0xc430('0x8b')][_0xc430('0xbb')]?!![]:![]}];}else{_0x56cc9c[_0xc430('0xb0')]=[{'all':!![]}];}}return _0x503988[_0x43d62f['childModel']][_0xc430('0x6')](_0x56cc9c);})['then'](function(_0x5d030c){_0x18596b[_0xc430('0xb7')]=_0x5d030c;if(_0x3ba16b===_0xc430('0xbe')&&_0x28199b[_0xc430('0x8b')][_0xc430('0xbf')]===_0xc430('0xc0')){var _0x18859d=[];for(var _0x51102e=0x0;_0x51102e<_0x18596b[_0xc430('0xb7')][_0xc430('0x9c')];_0x51102e++){_0x18859d[_0xc430('0x95')](_0x12b6f2(_0xc430('0xc1'),_0x18596b[_0xc430('0xb7')][_0x51102e][_0xc430('0xc2')]));_0x18859d[_0xc430('0x95')](_0x12b6f2(_0xc430('0xc3'),_0x18596b[_0xc430('0xb7')][_0x51102e][_0xc430('0xc2')]));_0x18859d['push'](_0x12b6f2(_0xc430('0xc4'),_0x18596b[_0xc430('0xb7')][_0x51102e]['dataValues']));_0x18859d['push'](_0x12b6f2(_0xc430('0xc5'),_0x18596b[_0xc430('0xb7')][_0x51102e][_0xc430('0xc2')]));_0x18859d[_0xc430('0x95')](_0x12b6f2(_0xc430('0xc6'),_0x18596b['rows'][_0x51102e][_0xc430('0xc2')]));_0x18859d[_0xc430('0x95')](_0x12b6f2(_0xc430('0xc7'),_0x18596b[_0xc430('0xb7')][_0x51102e]['dataValues']));}return Promise[_0xc430('0x99')](_0x18859d)['then'](function(){return _0x18596b;});}return _0x18596b;});}});}}});}; \ No newline at end of file +var _0x3423=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','DefaultReports','custom','rows','ids','count','Tags','color','tag','include','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','model','associatedResources','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','childModel','parentSections','projects','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','QueueCampaigns','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','charAt','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','sequelize','query','toString','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes'];(function(_0x580bfc,_0x53933c){var _0x45f9ad=function(_0x28c93b){while(--_0x28c93b){_0x580bfc['push'](_0x580bfc['shift']());}};_0x45f9ad(++_0x53933c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x3342('0x0'));var squel=require(_0x3342('0x1'));module[_0x3342('0x2')]=function(_0x3b763d){var _0x21bdc2=_0x3b763d[_0x3342('0x3')];function _0x2207ce(_0x3c5d8d,_0x3075f8){return new Promise(function(_0x19206f,_0x467453){if(!_0x3075f8)return _0x19206f(null);var _0x2ccbe0=_0x3075f8[_0x3342('0x4')]?{[_0x3075f8[_0x3342('0x4')][_0x3342('0x5')]]:_0x3075f8[_0x3342('0x4')][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x3c5d8d][_0x3342('0x7')]({'where':_0x2ccbe0,'raw':!![]})[_0x3342('0x8')](function(_0x4ae4f3){_0x3075f8['associatedResources']=_[_0x3342('0x9')](_0x4ae4f3,'id');_0x19206f(_0x3075f8);})['catch'](function(_0x5a1fba){_0x467453(_0x5a1fba);});});}function _0x51b276(_0x4f85e3,_0xb11eb9){return new Promise(function(_0x2f3c47,_0x51496d){var _0x2d14c4=_0x4f85e3['filter']?{[_0x4f85e3[_0x3342('0x4')][_0x3342('0x5')]]:_0x4f85e3['filter'][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x4f85e3[_0x3342('0xa')]][_0x3342('0x7')]({'where':_0x2d14c4,'raw':!![]})[_0x3342('0x8')](function(_0x61fcc0){_0xb11eb9[_0x3342('0xb')]=_[_0x3342('0x9')](_0x61fcc0,function(_0x59be1d){return _0x59be1d[_0x3342('0xc')];});_0x2f3c47(_0xb11eb9);})[_0x3342('0xd')](function(_0x49afe3){_0x51496d(_0x49afe3);});});}function _0x40d609(_0x2c9df0,_0x51ef91,_0x554f9c){if(!_0x51ef91)return Promise[_0x3342('0xe')](null);return new Promise(function(_0x143cf1,_0x6949fc){return _0x21bdc2[_0x3342('0xf')][_0x3342('0x7')]({'where':{'sectionId':_0x51ef91['id']},'raw':!![]})[_0x3342('0x8')](function(_0x45a3ca){if(_0x2c9df0[_0x3342('0x5')]&&_0x2c9df0[_0x3342('0x5')]!=='id'){_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0xda235a){return _0xda235a[_0x2c9df0[_0x3342('0x5')]];});}else{if(_0x554f9c==='AnalyticExtractedReport'){_0x51ef91[_0x3342('0xb')]=_[_0x3342('0x9')](_0x45a3ca,function(_0x52f7b7){return{'id':_0x52f7b7[_0x3342('0x10')],'type':_0x52f7b7[_0x3342('0x11')]};});}else{_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0x5a0658){return _0x5a0658[_0x3342('0x10')];});}}_0x143cf1(_0x51ef91);})[_0x3342('0xd')](function(_0xa23053){_0x6949fc(_0xa23053);});});}function _0x2dbad1(_0xd2b87d,_0x2925a2){var _0x26eb87={'parentSections':[]};switch(_0xd2b87d[_0x3342('0x12')]()){case'squareprojects':_0x26eb87[_0x3342('0x13')]='SquareProject';break;case'odbc':_0x26eb87[_0x3342('0x13')]='SquareOdbc';break;case'squarerecordings':_0x26eb87[_0x3342('0x13')]='SquareRecording';_0x26eb87[_0x3342('0x14')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0x3342('0x15'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x16');break;case'contacts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x17');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x18'),'field':'id','foreignKey':'ListId'}];break;case _0x3342('0x19'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1a');break;case _0x3342('0x1b'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1c');break;case _0x3342('0x1d'):_0x26eb87['childModel']=_0x3342('0x1e');break;case'chatqueues':_0x26eb87[_0x3342('0x13')]=_0x3342('0x1f');break;case'chatwebsites':_0x26eb87[_0x3342('0x13')]=_0x3342('0x20');break;case _0x3342('0x21'):_0x26eb87[_0x3342('0x13')]='FaxQueue';break;case _0x3342('0x22'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x23');break;case _0x3342('0x24'):case _0x3342('0x25'):case _0x3342('0x26'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x27');break;case _0x3342('0x28'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x29');break;case _0x3342('0x2a'):_0x26eb87['childModel']='VoiceMail';break;case _0x3342('0x2b'):_0x26eb87['childModel']=_0x3342('0x2c');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x2d'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['agent']}},{'name':_0x3342('0x31'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['telephone']}},{'name':_0x3342('0x32'),'field':'name','foreignKey':_0x3342('0x33'),'model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x35')]}},{'name':'QueueCampaigns','field':_0x3342('0xc'),'foreignKey':'queue','model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x36')]}}];break;case _0x3342('0x37'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x38');break;case _0x3342('0x39'):_0x26eb87['childModel']=_0x3342('0x3a');break;case _0x3342('0x3b'):_0x26eb87['childModel']=_0x3342('0x3c');break;case _0x3342('0x3d'):_0x26eb87['childModel']=_0x3342('0x3e');break;case _0x3342('0x3f'):_0x26eb87['childModel']='MailQueue';break;case'mailaccounts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x40');break;case'mailsubstatuses':_0x26eb87[_0x3342('0x13')]=_0x3342('0x41');break;case _0x3342('0x42'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x43');break;case _0x3342('0x44'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x45');break;case'smsqueues':_0x26eb87['childModel']=_0x3342('0x46');break;case _0x3342('0x47'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x48');break;case _0x3342('0x49'):_0x26eb87[_0x3342('0x13')]='WhatsappQueue';break;case _0x3342('0x4a'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4b');break;case _0x3342('0x4c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4d');break;case'voicequeues':case _0x3342('0x4e'):_0x26eb87['childModel']=_0x3342('0x34');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x32')},{'name':_0x3342('0x4f')}];}break;case'users':case _0x3342('0x50'):case _0x3342('0x51'):_0x26eb87['childModel']=_0x3342('0x2f');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x52'),'filter':{'field':_0x3342('0x30'),'value':['admin',_0x3342('0x53')]},'ignore':!![]},{'name':_0x3342('0x2d')},{'name':'Telephones'}];}break;case _0x3342('0x54'):_0x26eb87['childModel']='ZendeskAccount';break;case _0x3342('0x55'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x56');break;case _0x3342('0x57'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x58');break;case _0x3342('0x59'):_0x26eb87['childModel']='SugarcrmAccount';break;case _0x3342('0x5a'):_0x26eb87['childModel']=_0x3342('0x5b');break;case'zohoaccounts':_0x26eb87['childModel']='ZohoAccount';break;case _0x3342('0x5c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x2f');break;case _0x3342('0x5d'):_0x26eb87['childModel']=_0x3342('0x5e');break;case _0x3342('0x5f'):_0x26eb87['childModel']=_0x3342('0x60');break;case _0x3342('0x61'):_0x26eb87[_0x3342('0x13')]='Dashboard';break;case _0x3342('0x62'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x63');break;case _0x3342('0x64'):_0x26eb87[_0x3342('0x13')]='Pause';break;case _0x3342('0x65'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x66');break;case _0x3342('0x67'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x68');break;case _0x3342('0x69'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6a');break;case'templates':_0x26eb87[_0x3342('0x13')]='Template';break;case _0x3342('0x6b'):_0x26eb87['childModel']='Trigger';break;case'trunks':_0x26eb87['childModel']=_0x3342('0x6c');break;case _0x3342('0x6d'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6e');break;case _0x3342('0x6f'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x70');break;case _0x3342('0x71'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x72');_0x26eb87[_0x3342('0x14')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3342('0x73'):_0x26eb87['childModel']=_0x3342('0x74');break;}return _0x26eb87;}function _0x59964b(_0x4c777e,_0x44faea){var _0x43d39f=_0x4c777e[_0x3342('0x75')](0x0)['toUpperCase']()+_0x4c777e['slice'](0x1);var _0x54b41d={'type':_0x21bdc2[_0x3342('0x76')]['QueryTypes'][_0x3342('0x77')],'raw':!![]};return new Promise(function(_0x219a17,_0x372af5){var _0x4d3660=squel[_0x3342('0x78')]()[_0x3342('0x5')](_0x3342('0x79')+_0x43d39f+_0x3342('0x7a'),'id')[_0x3342('0x5')](_0x3342('0x7b'))[_0x3342('0x7c')]('user_has_'+_0x4c777e+'_interactions','ui')[_0x3342('0x7d')]('ui.UserId\x20=\x20?',_0x44faea['id']);return _0x21bdc2[_0x3342('0x7e')][_0x3342('0x7f')](_0x4d3660[_0x3342('0x80')](),_0x54b41d)[_0x3342('0x8')](function(_0xe9b979){_0x44faea[_0x43d39f+'OpenTabs']=_0xe9b979;_0x219a17(_0xe9b979);})[_0x3342('0xd')](function(_0x3f2fcb){_0x372af5(_0x3f2fcb);});});}return _0x3b763d['define'](_0x3342('0x81'),attributes,{'tableName':_0x3342('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x10842c){var _0x2858a6={'raw':_0x10842c[_0x3342('0x7f')][_0x3342('0x83')],'where':{}};var _0x19fcc5={};var _0x2f6a48={'count':0x0,'rows':[]};var _0x16c3f3=_0x10842c[_0x3342('0x7f')][_0x3342('0x84')];var _0x28bbfa=_0x10842c[_0x3342('0x7f')]['mergeResources']||![];var _0x5c9399=_0x2dbad1(_0x16c3f3,_0x28bbfa);if(!_0x5c9399[_0x3342('0x13')])throw new Error(_0x3342('0x85')+_0x16c3f3+'\x27');var _0x14193b=[{'name':_0x16c3f3}];if(!_[_0x3342('0x86')](_0x5c9399['parentSections']))_0x14193b=_0x5c9399['parentSections'];var _0x3310ac=[];for(var _0x18751b=0x0;_0x18751b<_0x14193b[_0x3342('0x87')];_0x18751b++){_0x3310ac[_0x3342('0x88')](_0x21bdc2[_0x3342('0x89')][_0x3342('0x8a')]({'where':{'userProfileId':_0x10842c[_0x3342('0x8b')]['id'],'name':_0x14193b[_0x18751b][_0x3342('0xc')]},'raw':!![]}));}return Promise[_0x3342('0x8c')](_0x3310ac)[_0x3342('0x8')](function(_0x4887d4){var _0x3392a2=_['filter'](_0x4887d4,function(_0x1c5d7d){return _0x1c5d7d?_0x1c5d7d:undefined;});var _0xba7c0e=_['filter'](_0x14193b,[_0x3342('0x8d'),!![]]);var _0x3506d4=_['isEmpty'](_0x3392a2)&&_[_0x3342('0x86')](_0xba7c0e)?null:_[_0x3342('0x8e')](_0xba7c0e,_0x3392a2);if(!_0x3506d4)return null;var _0x1e3353=[];for(var _0x466e06=0x0;_0x466e06<_0x3506d4[_0x3342('0x87')];_0x466e06++){var _0x42bc3b=_[_0x3342('0x8a')](_0x14193b,function(_0x57b8ac){return _0x3506d4[_0x466e06]?_0x57b8ac[_0x3342('0xc')]===_0x3506d4[_0x466e06]['name']:null;});if(_0x42bc3b){if(_0x3506d4[_0x466e06]['ignore']){_0x1e3353[_0x3342('0x88')](_0x2207ce(_0x5c9399[_0x3342('0x13')],_0x3506d4[_0x466e06]));}else{if(!_0x3506d4[_0x466e06][_0x3342('0x8f')]){_0x1e3353[_0x3342('0x88')](_0x40d609(_0x42bc3b,_0x3506d4[_0x466e06],_0x5c9399[_0x3342('0x13')]));}else{if(_0x42bc3b[_0x3342('0xa')]){_0x1e3353[_0x3342('0x88')](_0x51b276(_0x42bc3b,_0x3506d4[_0x466e06]));}}}}}return Promise[_0x3342('0x8c')](_0x1e3353);})['then'](function(_0x3c8fd5){var _0x2766e8=_0x3c8fd5;var _0x2cfbee=null;if(_0x2766e8){_0x2cfbee=_0x2766e8[_0x3342('0x87')]===0x1?_0x2766e8[0x0]:null;}if(!_0x2cfbee&&!_0x2766e8)return _0x2f6a48;var _0x3c151b=_0x21bdc2[_0x5c9399[_0x3342('0x13')]][_0x3342('0x90')];_0x19fcc5['model']=_[_0x3342('0x91')](_0x3c151b);_0x19fcc5[_0x3342('0x7f')]=_[_0x3342('0x91')](_0x10842c[_0x3342('0x7f')]);_0x19fcc5[_0x3342('0x92')]=_[_0x3342('0x93')](_0x19fcc5['model'],_0x19fcc5['query']);_0x2858a6['attributes']=_[_0x3342('0x93')](_0x19fcc5[_0x3342('0xa')],qs[_0x3342('0x94')](_0x10842c[_0x3342('0x7f')][_0x3342('0x94')]));_0x2858a6[_0x3342('0x95')]=_0x2858a6[_0x3342('0x95')][_0x3342('0x87')]?_0x2858a6['attributes']:_0x19fcc5[_0x3342('0xa')];if(!_0x10842c[_0x3342('0x7f')][_0x3342('0x96')](_0x3342('0x97'))){_0x2858a6['limit']=qs[_0x3342('0x98')](_0x10842c[_0x3342('0x7f')][_0x3342('0x98')]);_0x2858a6[_0x3342('0x99')]=qs[_0x3342('0x99')](_0x10842c[_0x3342('0x7f')][_0x3342('0x99')]);}_0x2858a6[_0x3342('0x9a')]=qs[_0x3342('0x9b')](_0x10842c['query'][_0x3342('0x9b')]);_0x2858a6[_0x3342('0x7d')]=qs['filters'](_[_0x3342('0x9c')](_0x10842c['query'],_0x19fcc5[_0x3342('0x92')]));if(_0x10842c['query'][_0x3342('0x4')]){_0x2858a6['where']=_[_0x3342('0x9d')](_0x2858a6[_0x3342('0x7d')],{'$or':_['map'](_0x3c151b,function(_0x3a24b7){if(_0x3a24b7[_0x3342('0x11')]['key']!==_0x3342('0x9e')){var _0x24c9ef={};_0x24c9ef[_0x3a24b7[_0x3342('0x5')]]={'$like':'%'+_0x10842c[_0x3342('0x7f')][_0x3342('0x4')]+'%'};return _0x24c9ef;}})});}var _0x1d58cb=[];var _0x5cb6c5=null;var _0x29a7a1={};if(_0x2cfbee){_0x5cb6c5=_[_0x3342('0x8a')](_0x14193b,[_0x3342('0xc'),_0x2cfbee[_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};if(_0x5c9399[_0x3342('0x13')]===_0x3342('0x72')){_0x29a7a1[_0x5cb6c5[_0x3342('0x9f')]]=_[_0x3342('0x9')](_0x2cfbee[_0x3342('0xb')],'id');}else{_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2cfbee[_0x3342('0xb')];}_0x1d58cb[_0x3342('0x88')](_0x29a7a1);}else{_0x2858a6[_0x3342('0x7d')]['id']=_0x2cfbee['associatedResources'];}}else{for(var _0x5ef689=0x0;_0x5ef689<_0x2766e8[_0x3342('0x87')];_0x5ef689++){_0x5cb6c5=_['find'](_0x14193b,['name',_0x2766e8[_0x5ef689][_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2766e8[_0x5ef689][_0x3342('0xb')];_0x1d58cb['push'](_0x29a7a1);}else{if(!_0x2858a6[_0x3342('0x7d')]['id'])_0x2858a6['where']['id']=[];_0x2766e8[_0x5ef689]['associatedResources'][_0x3342('0xa0')](function(_0x2d3f3e){_0x2858a6[_0x3342('0x7d')]['id']['push'](_0x2d3f3e);});}}}if(!_['isEmpty'](_0x1d58cb)){_0x2858a6[_0x3342('0x7d')]=_['merge'](_0x2858a6[_0x3342('0x7d')],{'$and':{'$or':_0x1d58cb}});}_0x2858a6=_[_0x3342('0x9d')]({},_0x2858a6,_0x10842c[_0x3342('0xa1')]);if(_0x2cfbee&&!_0x2cfbee[_0x3342('0x8f')]&&_0x5c9399['childModel']==='AnalyticExtractedReport'){if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){_0x2858a6['include']=[{'all':!![]}];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6)[_0x3342('0x8')](function(_0x21a2bc){var _0x45899e=[];_0x21a2bc[_0x3342('0xa0')](function(_0x22b415){var _0x5e368f;switch(_0x22b415['reportType']){case'default':_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x3aaf86){return _0x3aaf86['id']===_0x22b415['reportId']&&_0x3aaf86[_0x3342('0x11')]===_0x3342('0xa3');});break;case _0x3342('0xa4'):_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x2355c0){return _0x2355c0['id']===_0x22b415['reportId']&&_0x2355c0[_0x3342('0x11')]==='CustomReports';});break;}if(_0x5e368f)_0x45899e['push'](_0x22b415);});_0x2f6a48['count']=_0x45899e[_0x3342('0x87')];_0x2f6a48[_0x3342('0xa5')]=_0x45899e;return _0x2f6a48;});}else{if(!_['isEmpty'](_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')])){_0x2858a6['where']['id']=_0x2858a6[_0x3342('0x7d')]['id']?_[_0x3342('0x93')](_0x2858a6[_0x3342('0x7d')]['id'],_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')]):_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['count']({'where':_0x2858a6[_0x3342('0x7d')]})[_0x3342('0x8')](function(_0x13738c){_0x2f6a48[_0x3342('0xa7')]=_0x13738c;if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){if(_0x5c9399[_0x3342('0x13')]==='CmContact'){_0x2858a6['include']=[{'model':_0x21bdc2[_0x3342('0x6a')],'as':_0x3342('0xa8'),'attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]},{'model':_0x21bdc2[_0x3342('0x6a')],'as':'ThroughTags','attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'through':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?{'attributes':[],'where':{'TagId':_0x10842c[_0x3342('0x7f')]['tag']||undefined}}:{},'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]}];}else{_0x2858a6[_0x3342('0xab')]=[{'all':!![]}];}}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6);})[_0x3342('0x8')](function(_0x250317){_0x2f6a48[_0x3342('0xa5')]=_0x250317;if(_0x16c3f3===_0x3342('0x2d')&&_0x10842c[_0x3342('0x7f')][_0x3342('0xac')]===_0x3342('0xad')){var _0x5ccbc6=[];for(var _0x53a9e1=0x0;_0x53a9e1<_0x2f6a48[_0x3342('0xa5')]['length'];_0x53a9e1++){_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xae'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('sms',_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('fax',_0x2f6a48['rows'][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb0'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb1'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb2'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1]['dataValues']));}return Promise['all'](_0x5ccbc6)['then'](function(){return _0x2f6a48;});}return _0x2f6a48;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index b070764..92af5ab 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 _0xbf13=['jayson/promise','client','http','redis','localhost','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','UserProfile,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x19da9c,_0x4c1542){var _0x369a83=function(_0x5540f3){while(--_0x5540f3){_0x19da9c['push'](_0x19da9c['shift']());}};_0x369a83(++_0x4c1542);}(_0xbf13,0xe2));var _0x3bf1=function(_0x47d5c5,_0x12c4b8){_0x47d5c5=_0x47d5c5-0x0;var _0x573c65=_0xbf13[_0x47d5c5];return _0x573c65;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require(_0x3bf1('0x7'));var jayson=require(_0x3bf1('0x8'));var client=jayson[_0x3bf1('0x9')][_0x3bf1('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3bf1('0xb')],{'host':_0x3bf1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bf1('0xb')]));require(_0x3bf1('0xd'))[_0x3bf1('0xe')](socket);function respondWithRpcPromise(_0x3bcda3,_0xdc68d1,_0xa1374a){return new BPromise(function(_0x48444a,_0x50bf27){return client[_0x3bf1('0xf')](_0x3bcda3,_0xa1374a)[_0x3bf1('0x10')](function(_0x4d8dbd){logger[_0x3bf1('0x11')]('UserProfile,\x20%s,\x20%s',_0xdc68d1,_0x3bf1('0x12'));logger[_0x3bf1('0x13')](_0x3bf1('0x14'),_0xdc68d1,_0x3bf1('0x12'),JSON[_0x3bf1('0x15')](_0x4d8dbd));if(_0x4d8dbd[_0x3bf1('0x16')]){if(_0x4d8dbd['error']['code']===0x1f4){logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x50bf27(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x48444a(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}else{logger[_0x3bf1('0x11')](_0x3bf1('0x17'),_0xdc68d1,'request\x20sent');_0x48444a(_0x4d8dbd['result'][_0x3bf1('0x18')]);}})[_0x3bf1('0x19')](function(_0x140e51){logger['error']('UserProfile,\x20%s,\x20%s',_0xdc68d1,_0x140e51);_0x50bf27(_0x140e51);});});} \ No newline at end of file +var _0xac6a=['localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5eee1d,_0x578128){var _0x36e73f=function(_0x35a00e){while(--_0x35a00e){_0x5eee1d['push'](_0x5eee1d['shift']());}};_0x36e73f(++_0x578128);}(_0xac6a,0xc2));var _0xaac6=function(_0x2fd7ab,_0x5ceab9){_0x2fd7ab=_0x2fd7ab-0x0;var _0x562853=_0xac6a[_0x2fd7ab];return _0x562853;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./userProfile.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f350c50..111ef06 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 _0x3e79=['register','save','remove','emit','removeListener'];(function(_0x2c3ee3,_0x485dff){var _0x234062=function(_0x493c16){while(--_0x493c16){_0x2c3ee3['push'](_0x2c3ee3['shift']());}};_0x234062(++_0x485dff);}(_0x3e79,0xf6));var _0x93e7=function(_0x32749f,_0x41907f){_0x32749f=_0x32749f-0x0;var _0x52862f=_0x3e79[_0x32749f];return _0x52862f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x93e7('0x0'),_0x93e7('0x1'),'update'];function createListener(_0x3f2dfe,_0x55fa11){return function(_0x312c45){_0x55fa11[_0x93e7('0x2')](_0x3f2dfe,_0x312c45);};}function removeListener(_0x2ae4cb,_0x432f8b){return function(){UserProfileEvents[_0x93e7('0x3')](_0x2ae4cb,_0x432f8b);};}exports[_0x93e7('0x4')]=function(_0x4ad5a6){for(var _0x50290b=0x0,_0x488e83=events['length'];_0x50290b<_0x488e83;_0x50290b++){var _0x180eda=events[_0x50290b];var _0x1b9719=createListener('userProfile:'+_0x180eda,_0x4ad5a6);UserProfileEvents['on'](_0x180eda,_0x1b9719);}}; \ No newline at end of file +var _0xd8b1=['length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xd8b1,0x105));var _0x1d8b=function(_0x253d8f,_0x510e18){_0x253d8f=_0x253d8f-0x0;var _0x47a203=_0xd8b1[_0x253d8f];return _0x47a203;};'use strict';var UserProfileEvents=require(_0x1d8b('0x0'));var events=[_0x1d8b('0x1'),_0x1d8b('0x2'),_0x1d8b('0x3')];function createListener(_0x20c6dd,_0x5deaca){return function(_0x68d7af){_0x5deaca[_0x1d8b('0x4')](_0x20c6dd,_0x68d7af);};}function removeListener(_0x531170,_0xad218){return function(){UserProfileEvents['removeListener'](_0x531170,_0xad218);};}exports['register']=function(_0x4d5ba0){for(var _0x27534c=0x0,_0x5f5bbd=events[_0x1d8b('0x5')];_0x27534c<_0x5f5bbd;_0x27534c++){var _0xdba2e5=events[_0x27534c];var _0x2b28e2=createListener(_0x1d8b('0x6')+_0xdba2e5,_0x4d5ba0);UserProfileEvents['on'](_0xdba2e5,_0x2b28e2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9dfada3..593af6a 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 _0xbcdf=['/describe','get','/:id','show','create','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x53106c,_0x2ed47c){var _0x52581b=function(_0x1d8723){while(--_0x1d8723){_0x53106c['push'](_0x53106c['shift']());}};_0x52581b(++_0x2ed47c);}(_0xbcdf,0xaa));var _0xfbcd=function(_0x3fea84,_0x3e832f){_0x3fea84=_0x3fea84-0x0;var _0x20778a=_0xbcdf[_0x3fea84];return _0x20778a;};'use strict';var multer=require('multer');var util=require(_0xfbcd('0x0'));var path=require(_0xfbcd('0x1'));var timeout=require(_0xfbcd('0x2'));var express=require(_0xfbcd('0x3'));var router=express[_0xfbcd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbcd('0x5'));var interaction=require(_0xfbcd('0x6'));var config=require(_0xfbcd('0x7'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xfbcd('0x8')](),controller[_0xfbcd('0x9')]);router['get'](_0xfbcd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xfbcd('0xb')](_0xfbcd('0xc'),auth[_0xfbcd('0x8')](),controller[_0xfbcd('0xd')]);router['post']('/',auth[_0xfbcd('0x8')](),controller[_0xfbcd('0xe')]);router['put']('/:id',auth[_0xfbcd('0x8')](),controller['update']);router['delete'](_0xfbcd('0xc'),auth[_0xfbcd('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5da6=['express','Router','fs-extra','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5da6,0xd5));var _0x65da=function(_0x3a76f7,_0x2cd65d){_0x3a76f7=_0x3a76f7-0x0;var _0x4d4e44=_0x5da6[_0x3a76f7];return _0x4d4e44;};'use strict';var multer=require(_0x65da('0x0'));var util=require('util');var path=require(_0x65da('0x1'));var timeout=require(_0x65da('0x2'));var express=require(_0x65da('0x3'));var router=express[_0x65da('0x4')]();var fs_extra=require(_0x65da('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x65da('0x6'));router[_0x65da('0x7')]('/',auth['isAuthenticated'](),controller[_0x65da('0x8')]);router[_0x65da('0x7')](_0x65da('0x9'),auth[_0x65da('0xa')](),controller[_0x65da('0xb')]);router['get'](_0x65da('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x65da('0xa')](),controller[_0x65da('0xd')]);router[_0x65da('0xe')](_0x65da('0xc'),auth['isAuthenticated'](),controller[_0x65da('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x65da('0x10')]);module[_0x65da('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7018979..f687044 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 _0xa26e=['INTEGER','sequelize','exports'];(function(_0x4f03cf,_0x5f0b0d){var _0xf78bc7=function(_0x496847){while(--_0x496847){_0x4f03cf['push'](_0x4f03cf['shift']());}};_0xf78bc7(++_0x5f0b0d);}(_0xa26e,0x169));var _0xea26=function(_0x11fcd8,_0x30c1f4){_0x11fcd8=_0x11fcd8-0x0;var _0x585de1=_0xa26e[_0x11fcd8];return _0x585de1;};'use strict';var Sequelize=require(_0xea26('0x0'));module[_0xea26('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xea26('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xbd3a=['STRING'];(function(_0x1d2f7b,_0x394fac){var _0x2979ca=function(_0x53ab09){while(--_0x53ab09){_0x1d2f7b['push'](_0x1d2f7b['shift']());}};_0x2979ca(++_0x394fac);}(_0xbd3a,0xc8));var _0xabd3=function(_0x1012e3,_0x5bd06b){_0x1012e3=_0x1012e3-0x0;var _0x50bb35=_0xbd3a[_0x1012e3];return _0x50bb35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xabd3('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xabd3('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1280e44..dca6716 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x40cb36,_0x50f27c){var _0x34e536=function(_0x267baa){while(--_0x267baa){_0x40cb36['push'](_0x40cb36['shift']());}};_0x34e536(++_0x50f27c);}(_0x90b1,0x1bb));var _0x190b=function(_0x5a69ab,_0x610049){_0x5a69ab=_0x5a69ab-0x0;var _0x27f2f7=_0x90b1[_0x5a69ab];return _0x27f2f7;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file +var _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x1f25ac,_0x5c3d9f){var _0x27d350=function(_0x564312){while(--_0x564312){_0x1f25ac['push'](_0x1f25ac['shift']());}};_0x27d350(++_0x5c3d9f);}(_0xf61e,0x191));var _0xef61=function(_0x341673,_0x53874e){_0x341673=_0x341673-0x0;var _0xd95370=_0xf61e[_0x341673];return _0xd95370;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 16c6458..2a55dcd 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 _0x30f1=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x1bb4a7,_0x178bb8){var _0x4b68cf=function(_0x2af614){while(--_0x2af614){_0x1bb4a7['push'](_0x1bb4a7['shift']());}};_0x4b68cf(++_0x178bb8);}(_0x30f1,0x196));var _0x130f=function(_0x47e82f,_0x3b3a71){_0x47e82f=_0x47e82f-0x0;var _0x1b77f7=_0x30f1[_0x47e82f];return _0x1b77f7;};'use strict';var _=require(_0x130f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x130f('0x1'));var moment=require(_0x130f('0x2'));var BPromise=require('bluebird');var rp=require(_0x130f('0x3'));var fs=require('fs');var path=require(_0x130f('0x4'));var rimraf=require(_0x130f('0x5'));var config=require(_0x130f('0x6'));var attributes=require(_0x130f('0x7'));module[_0x130f('0x8')]=function(_0x4e95c0,_0x79bd0e){return _0x4e95c0[_0x130f('0x9')](_0x130f('0xa'),attributes,{'tableName':_0x130f('0xb'),'paranoid':![],'indexes':[{'name':_0x130f('0xc'),'fields':[_0x130f('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x06b7=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1ec578,_0x2af79d){var _0x349c8a=function(_0x17e928){while(--_0x17e928){_0x1ec578['push'](_0x1ec578['shift']());}};_0x349c8a(++_0x2af79d);}(_0x06b7,0x1d6));var _0x706b=function(_0x4b527e,_0x4c85fe){_0x4b527e=_0x4b527e-0x0;var _0x1a1189=_0x06b7[_0x4b527e];return _0x1a1189;};'use strict';var _=require('lodash');var util=require(_0x706b('0x0'));var logger=require(_0x706b('0x1'))(_0x706b('0x2'));var moment=require(_0x706b('0x3'));var BPromise=require('bluebird');var rp=require(_0x706b('0x4'));var fs=require('fs');var path=require(_0x706b('0x5'));var rimraf=require(_0x706b('0x6'));var config=require(_0x706b('0x7'));var attributes=require(_0x706b('0x8'));module[_0x706b('0x9')]=function(_0x425730,_0x9d1084){return _0x425730[_0x706b('0xa')]('UserProfileResource',attributes,{'tableName':_0x706b('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x706b('0xc'),_0x706b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6e824a9..bab6322 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 _0xe413=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x30cb97,_0x6a49c4){var _0x2255f6=function(_0x2b2c0f){while(--_0x2b2c0f){_0x30cb97['push'](_0x30cb97['shift']());}};_0x2255f6(++_0x6a49c4);}(_0xe413,0x1d6));var _0x3e41=function(_0x10e3f6,_0x4d63eb){_0x10e3f6=_0x10e3f6-0x0;var _0x233e2f=_0xe413[_0x10e3f6];return _0x233e2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e41('0x0'));var BPromise=require(_0x3e41('0x1'));var rs=require(_0x3e41('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e41('0x3'));var logger=require(_0x3e41('0x4'))(_0x3e41('0x5'));var config=require(_0x3e41('0x6'));var jayson=require(_0x3e41('0x7'));var client=jayson[_0x3e41('0x8')][_0x3e41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ea798,_0x4f4189,_0x78ef51){return new BPromise(function(_0x3f9a9e,_0x27f566){return client[_0x3e41('0xa')](_0x4ea798,_0x78ef51)[_0x3e41('0xb')](function(_0x5eeafc){logger[_0x3e41('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x4f4189,_0x3e41('0xd'));logger['debug'](_0x3e41('0xe'),_0x4f4189,_0x3e41('0xd'),JSON[_0x3e41('0xf')](_0x5eeafc));if(_0x5eeafc[_0x3e41('0x10')]){if(_0x5eeafc['error'][_0x3e41('0x11')]===0x1f4){logger[_0x3e41('0x10')](_0x3e41('0x12'),_0x4f4189,_0x5eeafc[_0x3e41('0x10')][_0x3e41('0x13')]);return _0x27f566(_0x5eeafc[_0x3e41('0x10')]['message']);}logger['error'](_0x3e41('0x12'),_0x4f4189,_0x5eeafc['error'][_0x3e41('0x13')]);return _0x3f9a9e(_0x5eeafc[_0x3e41('0x10')][_0x3e41('0x13')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4f4189,_0x3e41('0xd'));_0x3f9a9e(_0x5eeafc[_0x3e41('0x14')]['message']);}})[_0x3e41('0x15')](function(_0x716d16){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4f4189,_0x716d16);_0x27f566(_0x716d16);});});} \ No newline at end of file +var _0x5e7c=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug'];(function(_0x436fcb,_0x384cba){var _0x5af55f=function(_0x5cf253){while(--_0x5cf253){_0x436fcb['push'](_0x436fcb['shift']());}};_0x5af55f(++_0x384cba);}(_0x5e7c,0x91));var _0xc5e7=function(_0x3bc147,_0x1cd58f){_0x3bc147=_0x3bc147-0x0;var _0x51ee75=_0x5e7c[_0x3bc147];return _0x51ee75;};'use strict';var _=require(_0xc5e7('0x0'));var util=require(_0xc5e7('0x1'));var moment=require(_0xc5e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5e7('0x3'));var fs=require('fs');var Redis=require(_0xc5e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5e7('0x5'));var logger=require(_0xc5e7('0x6'))(_0xc5e7('0x7'));var config=require(_0xc5e7('0x8'));var jayson=require(_0xc5e7('0x9'));var client=jayson[_0xc5e7('0xa')][_0xc5e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4466d6,_0x4a7f11,_0x441136){return new BPromise(function(_0x54640c,_0x8b0492){return client['request'](_0x4466d6,_0x441136)[_0xc5e7('0xc')](function(_0x1cd149){logger[_0xc5e7('0xd')](_0xc5e7('0xe'),_0x4a7f11,'request\x20sent');logger[_0xc5e7('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4a7f11,'request\x20sent',JSON[_0xc5e7('0x10')](_0x1cd149));if(_0x1cd149[_0xc5e7('0x11')]){if(_0x1cd149[_0xc5e7('0x11')][_0xc5e7('0x12')]===0x1f4){logger['error'](_0xc5e7('0xe'),_0x4a7f11,_0x1cd149[_0xc5e7('0x11')][_0xc5e7('0x13')]);return _0x8b0492(_0x1cd149[_0xc5e7('0x11')]['message']);}logger[_0xc5e7('0x11')](_0xc5e7('0xe'),_0x4a7f11,_0x1cd149[_0xc5e7('0x11')]['message']);return _0x54640c(_0x1cd149['error'][_0xc5e7('0x13')]);}else{logger['info'](_0xc5e7('0xe'),_0x4a7f11,_0xc5e7('0x14'));_0x54640c(_0x1cd149[_0xc5e7('0x15')][_0xc5e7('0x13')]);}})[_0xc5e7('0x16')](function(_0x151f78){logger[_0xc5e7('0x11')](_0xc5e7('0xe'),_0x4a7f11,_0x151f78);_0x8b0492(_0x151f78);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3fdb83c..4863a7f 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 _0xab1b=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a06c8,_0xc74a7c){var _0x5d8acd=function(_0xc90c57){while(--_0xc90c57){_0x5a06c8['push'](_0x5a06c8['shift']());}};_0x5d8acd(++_0xc74a7c);}(_0xab1b,0x159));var _0xbab1=function(_0x3ab80e,_0x3c2966){_0x3ab80e=_0x3ab80e-0x0;var _0x2281d5=_0xab1b[_0x3ab80e];return _0x2281d5;};'use strict';var multer=require(_0xbab1('0x0'));var util=require(_0xbab1('0x1'));var path=require(_0xbab1('0x2'));var timeout=require(_0xbab1('0x3'));var express=require(_0xbab1('0x4'));var router=express[_0xbab1('0x5')]();var fs_extra=require(_0xbab1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbab1('0x7'));var config=require(_0xbab1('0x8'));var controller=require(_0xbab1('0x9'));router[_0xbab1('0xa')]('/',auth[_0xbab1('0xb')](),controller[_0xbab1('0xc')]);router[_0xbab1('0xa')](_0xbab1('0xd'),auth[_0xbab1('0xb')](),controller[_0xbab1('0xe')]);router['get'](_0xbab1('0xf'),auth[_0xbab1('0xb')](),controller[_0xbab1('0x10')]);router[_0xbab1('0x11')]('/',auth[_0xbab1('0xb')](),controller[_0xbab1('0x12')]);router['put'](_0xbab1('0xf'),auth[_0xbab1('0xb')](),controller[_0xbab1('0x13')]);router[_0xbab1('0x14')](_0xbab1('0xf'),auth['isAuthenticated'](),controller[_0xbab1('0x15')]);module['exports']=router; \ No newline at end of file +var _0x39b9=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x39b9,0x99));var _0x939b=function(_0x28a418,_0x301838){_0x28a418=_0x28a418-0x0;var _0x29fd01=_0x39b9[_0x28a418];return _0x29fd01;};'use strict';var multer=require(_0x939b('0x0'));var util=require(_0x939b('0x1'));var path=require(_0x939b('0x2'));var timeout=require(_0x939b('0x3'));var express=require(_0x939b('0x4'));var router=express[_0x939b('0x5')]();var fs_extra=require(_0x939b('0x6'));var auth=require(_0x939b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x939b('0x8')]('/',auth[_0x939b('0x9')](),controller[_0x939b('0xa')]);router[_0x939b('0x8')](_0x939b('0xb'),auth['isAuthenticated'](),controller[_0x939b('0xc')]);router[_0x939b('0x8')](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0xe')]);router[_0x939b('0xf')]('/',auth[_0x939b('0x9')](),controller[_0x939b('0x10')]);router[_0x939b('0x11')](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0x12')]);router['delete'](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0x13')]);module[_0x939b('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1de8663..966c741 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 _0x4fc2=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4fc2,0x111));var _0x24fc=function(_0x1ccda4,_0x1647d3){_0x1ccda4=_0x1ccda4-0x0;var _0x334196=_0x4fc2[_0x1ccda4];return _0x334196;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x24fc('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x24fc('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x24fc('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x24fc('0x2')],'set':function(_0x541ad2){this[_0x24fc('0x4')](_0x24fc('0x5'),_0x541ad2?_0x541ad2['join'](''):[]);},'get':function(){return this[_0x24fc('0x6')](_0x24fc('0x5'))?this['getDataValue'](_0x24fc('0x5'))[_0x24fc('0x7')](''):[];}}}; \ No newline at end of file +var _0xcf66=['getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x214fe4,_0x20a197){var _0x5ab5d2=function(_0x48e105){while(--_0x48e105){_0x214fe4['push'](_0x214fe4['shift']());}};_0x5ab5d2(++_0x20a197);}(_0xcf66,0x71));var _0x6cf6=function(_0x4b2fd8,_0x49ec4c){_0x4b2fd8=_0x4b2fd8-0x0;var _0x33b91a=_0xcf66[_0x4b2fd8];return _0x33b91a;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6cf6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1c599d){this[_0x6cf6('0x5')]('crudPermissions',_0x1c599d?_0x1c599d[_0x6cf6('0x6')](''):[]);},'get':function(){return this[_0x6cf6('0x7')](_0x6cf6('0x8'))?this['getDataValue'](_0x6cf6('0x8'))[_0x6cf6('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d121ed6..30c31e4 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 _0x1e15=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x208840,_0x2b5059){var _0x33c754=function(_0x1dba70){while(--_0x1dba70){_0x208840['push'](_0x208840['shift']());}};_0x33c754(++_0x2b5059);}(_0x1e15,0x116));var _0x51e1=function(_0x381a6b,_0x4e510d){_0x381a6b=_0x381a6b-0x0;var _0x3e87f0=_0x1e15[_0x381a6b];return _0x3e87f0;};'use strict';var emlformat=require(_0x51e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51e1('0x1'));var jsonpatch=require(_0x51e1('0x2'));var rp=require(_0x51e1('0x3'));var moment=require(_0x51e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51e1('0x5'));var util=require(_0x51e1('0x6'));var path=require(_0x51e1('0x7'));var sox=require(_0x51e1('0x8'));var csv=require(_0x51e1('0x9'));var ejs=require(_0x51e1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51e1('0xb'));var squel=require(_0x51e1('0xc'));var crypto=require(_0x51e1('0xd'));var jsforce=require(_0x51e1('0xe'));var deskjs=require(_0x51e1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x51e1('0x10'));var Papa=require(_0x51e1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51e1('0x12'));var as=require(_0x51e1('0x13'));var hardwareService=require(_0x51e1('0x14'));var logger=require(_0x51e1('0x15'))(_0x51e1('0x16'));var utils=require(_0x51e1('0x17'));var config=require(_0x51e1('0x18'));var licenseUtil=require(_0x51e1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20d3ee,_0x3c13f8){_0x3c13f8=_0x3c13f8||0xcc;return function(_0x55bae8){if(_0x55bae8){return _0x20d3ee[_0x51e1('0x1a')](_0x3c13f8);}return _0x20d3ee[_0x51e1('0x1b')](_0x3c13f8)[_0x51e1('0x1c')]();};}function respondWithResult(_0x105d6d,_0x36bb75){_0x36bb75=_0x36bb75||0xc8;return function(_0x133271){if(_0x133271){return _0x105d6d[_0x51e1('0x1b')](_0x36bb75)['json'](_0x133271);}};}function respondWithFilteredResult(_0x251a51,_0x20913b){return function(_0x235a44){if(_0x235a44){var _0x53419d=typeof _0x20913b[_0x51e1('0x1d')]===_0x51e1('0x1e')&&typeof _0x20913b[_0x51e1('0x1f')]==='undefined';var _0x1c96bd=_0x235a44[_0x51e1('0x20')];var _0x3cbcad=_0x53419d?0x0:_0x20913b['offset'];var _0x4cfa35=_0x53419d?_0x235a44['count']:_0x20913b['offset']+_0x20913b[_0x51e1('0x1f')];var _0x3f6ccd;if(_0x4cfa35>=_0x1c96bd){_0x4cfa35=_0x1c96bd;_0x3f6ccd=0xc8;}else{_0x3f6ccd=0xce;}_0x251a51[_0x51e1('0x1b')](_0x3f6ccd);return _0x251a51['set'](_0x51e1('0x21'),_0x3cbcad+'-'+_0x4cfa35+'/'+_0x1c96bd)[_0x51e1('0x22')](_0x235a44);}return null;};}function patchUpdates(_0x33d251){return function(_0x1d9439){try{jsonpatch[_0x51e1('0x23')](_0x1d9439,_0x33d251,!![]);}catch(_0x9af107){return BPromise[_0x51e1('0x24')](_0x9af107);}return _0x1d9439[_0x51e1('0x25')]();};}function saveUpdates(_0x5d87e4,_0x45d65d){return function(_0x1a5f7d){if(_0x1a5f7d){return _0x1a5f7d['update'](_0x5d87e4)['then'](function(_0x5ad7f2){return _0x5ad7f2;});}return null;};}function removeEntity(_0x351637,_0x1a93b9){return function(_0x1c10aa){if(_0x1c10aa){return _0x1c10aa[_0x51e1('0x26')]()[_0x51e1('0x27')](function(){_0x351637[_0x51e1('0x1b')](0xcc)[_0x51e1('0x1c')]();});}};}function handleEntityNotFound(_0x1f834f,_0x1c8be6){return function(_0x4134c3){if(!_0x4134c3){_0x1f834f[_0x51e1('0x1a')](0x194);}return _0x4134c3;};}function handleError(_0x20459d,_0x502285){_0x502285=_0x502285||0x1f4;return function(_0x48abb3){logger[_0x51e1('0x28')](_0x48abb3['stack']);if(_0x48abb3[_0x51e1('0x29')]){delete _0x48abb3[_0x51e1('0x29')];}_0x20459d[_0x51e1('0x1b')](_0x502285)[_0x51e1('0x2a')](_0x48abb3);};}exports[_0x51e1('0x2b')]=function(_0x10e9fc,_0x5daa22){var _0x2e0a01={},_0x4862db={},_0x5c0128={'count':0x0,'rows':[]};var _0x580930=_[_0x51e1('0x2c')](db[_0x51e1('0x2d')][_0x51e1('0x2e')],function(_0x4dc4ab){return{'name':_0x4dc4ab[_0x51e1('0x2f')],'type':_0x4dc4ab[_0x51e1('0x30')]['key']};});_0x4862db[_0x51e1('0x31')]=_[_0x51e1('0x2c')](_0x580930,'name');_0x4862db[_0x51e1('0x32')]=_[_0x51e1('0x33')](_0x10e9fc[_0x51e1('0x32')]);_0x4862db[_0x51e1('0x34')]=_[_0x51e1('0x35')](_0x4862db[_0x51e1('0x31')],_0x4862db['query']);_0x2e0a01[_0x51e1('0x36')]=_['intersection'](_0x4862db['model'],qs[_0x51e1('0x37')](_0x10e9fc[_0x51e1('0x32')]['fields']));_0x2e0a01[_0x51e1('0x36')]=_0x2e0a01['attributes'][_0x51e1('0x38')]?_0x2e0a01[_0x51e1('0x36')]:_0x4862db[_0x51e1('0x31')];if(!_0x10e9fc['query'][_0x51e1('0x39')]('nolimit')){_0x2e0a01[_0x51e1('0x1f')]=qs[_0x51e1('0x1f')](_0x10e9fc[_0x51e1('0x32')]['limit']);_0x2e0a01[_0x51e1('0x1d')]=qs[_0x51e1('0x1d')](_0x10e9fc['query'][_0x51e1('0x1d')]);}_0x2e0a01[_0x51e1('0x3a')]=qs[_0x51e1('0x3b')](_0x10e9fc[_0x51e1('0x32')][_0x51e1('0x3b')]);_0x2e0a01[_0x51e1('0x3c')]=qs[_0x51e1('0x34')](_['pick'](_0x10e9fc[_0x51e1('0x32')],_0x4862db[_0x51e1('0x34')]),_0x580930);if(_0x10e9fc['query'][_0x51e1('0x3d')]){_0x2e0a01[_0x51e1('0x3c')]=_['merge'](_0x2e0a01[_0x51e1('0x3c')],{'$or':_[_0x51e1('0x2c')](_0x580930,function(_0x221b1c){if(_0x221b1c[_0x51e1('0x30')]!==_0x51e1('0x3e')){var _0x2409e8={};_0x2409e8[_0x221b1c[_0x51e1('0x29')]]={'$like':'%'+_0x10e9fc[_0x51e1('0x32')][_0x51e1('0x3d')]+'%'};return _0x2409e8;}})});}_0x2e0a01=_[_0x51e1('0x3f')]({},_0x2e0a01,_0x10e9fc[_0x51e1('0x40')]);var _0x272c83={'where':_0x2e0a01[_0x51e1('0x3c')]};return db[_0x51e1('0x2d')][_0x51e1('0x20')](_0x272c83)[_0x51e1('0x27')](function(_0x4c5e02){_0x5c0128[_0x51e1('0x20')]=_0x4c5e02;if(_0x10e9fc[_0x51e1('0x32')][_0x51e1('0x41')]){_0x2e0a01[_0x51e1('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0x51e1('0x43')](_0x2e0a01);})[_0x51e1('0x27')](function(_0x2a85cc){_0x5c0128['rows']=_0x2a85cc;return _0x5c0128;})['then'](respondWithFilteredResult(_0x5daa22,_0x2e0a01))[_0x51e1('0x44')](handleError(_0x5daa22,null));};exports['show']=function(_0x38f70c,_0x47cb97){var _0x48e87b={'raw':![],'where':{'id':_0x38f70c[_0x51e1('0x45')]['id']}},_0x4d1f16={};_0x4d1f16[_0x51e1('0x31')]=_[_0x51e1('0x33')](db[_0x51e1('0x2d')]['rawAttributes']);_0x4d1f16[_0x51e1('0x32')]=_[_0x51e1('0x33')](_0x38f70c[_0x51e1('0x32')]);_0x4d1f16[_0x51e1('0x34')]=_[_0x51e1('0x35')](_0x4d1f16[_0x51e1('0x31')],_0x4d1f16[_0x51e1('0x32')]);_0x48e87b['attributes']=_[_0x51e1('0x35')](_0x4d1f16[_0x51e1('0x31')],qs[_0x51e1('0x37')](_0x38f70c[_0x51e1('0x32')][_0x51e1('0x37')]));_0x48e87b[_0x51e1('0x36')]=_0x48e87b[_0x51e1('0x36')]['length']?_0x48e87b[_0x51e1('0x36')]:_0x4d1f16[_0x51e1('0x31')];if(_0x38f70c[_0x51e1('0x32')][_0x51e1('0x41')]){_0x48e87b[_0x51e1('0x42')]=[{'all':!![]}];}_0x48e87b=_[_0x51e1('0x3f')]({},_0x48e87b,_0x38f70c['options']);return db[_0x51e1('0x2d')][_0x51e1('0x46')](_0x48e87b)[_0x51e1('0x27')](handleEntityNotFound(_0x47cb97,null))[_0x51e1('0x27')](respondWithResult(_0x47cb97,null))[_0x51e1('0x44')](handleError(_0x47cb97,null));};exports[_0x51e1('0x47')]=function(_0x49106b,_0x7ec168){return db['UserProfileSection'][_0x51e1('0x47')](_0x49106b[_0x51e1('0x48')],{})[_0x51e1('0x27')](respondWithResult(_0x7ec168,0xc9))['catch'](handleError(_0x7ec168,null));};exports[_0x51e1('0x49')]=function(_0x57ff5d,_0xfa021f){if(_0x57ff5d[_0x51e1('0x48')]['id']){delete _0x57ff5d[_0x51e1('0x48')]['id'];}return db[_0x51e1('0x2d')][_0x51e1('0x46')]({'where':{'id':_0x57ff5d[_0x51e1('0x45')]['id']}})[_0x51e1('0x27')](handleEntityNotFound(_0xfa021f,null))[_0x51e1('0x27')](saveUpdates(_0x57ff5d[_0x51e1('0x48')],null))['then'](respondWithResult(_0xfa021f,null))['catch'](handleError(_0xfa021f,null));};exports[_0x51e1('0x26')]=function(_0x17e2d4,_0x4026be){return db[_0x51e1('0x2d')][_0x51e1('0x46')]({'where':{'id':_0x17e2d4[_0x51e1('0x45')]['id']}})[_0x51e1('0x27')](handleEntityNotFound(_0x4026be,null))['then'](removeEntity(_0x4026be,null))[_0x51e1('0x44')](handleError(_0x4026be,null));};exports[_0x51e1('0x4a')]=function(_0x3ae351,_0x1f4734){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x1f4734,null))['catch'](handleError(_0x1f4734,null));}; \ No newline at end of file +var _0xdcd5=['../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xa316a,_0x249375){var _0x4fa5da=function(_0x1bd3b3){while(--_0x1bd3b3){_0xa316a['push'](_0xa316a['shift']());}};_0x4fa5da(++_0x249375);}(_0xdcd5,0x1a0));var _0x5dcd=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xdcd5[_0x450bf9];return _0x268350;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dcd('0x0'));var rp=require('request-promise');var moment=require(_0x5dcd('0x1'));var BPromise=require(_0x5dcd('0x2'));var Mustache=require(_0x5dcd('0x3'));var util=require(_0x5dcd('0x4'));var path=require(_0x5dcd('0x5'));var sox=require('sox');var csv=require(_0x5dcd('0x6'));var ejs=require(_0x5dcd('0x7'));var fs=require('fs');var fs_extra=require(_0x5dcd('0x8'));var _=require('lodash');var squel=require(_0x5dcd('0x9'));var crypto=require(_0x5dcd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5dcd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5dcd('0xc'));var Papa=require(_0x5dcd('0xd'));var Redis=require(_0x5dcd('0xe'));var authService=require(_0x5dcd('0xf'));var qs=require(_0x5dcd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dcd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5dcd('0x12'));var licenseUtil=require(_0x5dcd('0x13'));var db=require(_0x5dcd('0x14'))['db'];function respondWithStatusCode(_0x2600cb,_0x4b0845){_0x4b0845=_0x4b0845||0xcc;return function(_0x3d38c3){if(_0x3d38c3){return _0x2600cb[_0x5dcd('0x15')](_0x4b0845);}return _0x2600cb['status'](_0x4b0845)[_0x5dcd('0x16')]();};}function respondWithResult(_0x176d36,_0x26d9b8){_0x26d9b8=_0x26d9b8||0xc8;return function(_0x1690c5){if(_0x1690c5){return _0x176d36[_0x5dcd('0x17')](_0x26d9b8)[_0x5dcd('0x18')](_0x1690c5);}};}function respondWithFilteredResult(_0xdaff19,_0x164506){return function(_0x2102d0){if(_0x2102d0){var _0x22f8a6=typeof _0x164506[_0x5dcd('0x19')]==='undefined'&&typeof _0x164506[_0x5dcd('0x1a')]==='undefined';var _0x12bff6=_0x2102d0[_0x5dcd('0x1b')];var _0x1d546e=_0x22f8a6?0x0:_0x164506[_0x5dcd('0x19')];var _0x16ec9b=_0x22f8a6?_0x2102d0[_0x5dcd('0x1b')]:_0x164506[_0x5dcd('0x19')]+_0x164506['limit'];var _0x49e42c;if(_0x16ec9b>=_0x12bff6){_0x16ec9b=_0x12bff6;_0x49e42c=0xc8;}else{_0x49e42c=0xce;}_0xdaff19[_0x5dcd('0x17')](_0x49e42c);return _0xdaff19[_0x5dcd('0x1c')](_0x5dcd('0x1d'),_0x1d546e+'-'+_0x16ec9b+'/'+_0x12bff6)['json'](_0x2102d0);}return null;};}function patchUpdates(_0x4f2d64){return function(_0x21d043){try{jsonpatch[_0x5dcd('0x1e')](_0x21d043,_0x4f2d64,!![]);}catch(_0x1bc932){return BPromise[_0x5dcd('0x1f')](_0x1bc932);}return _0x21d043['save']();};}function saveUpdates(_0x28a5bc,_0x17a78d){return function(_0x347d9b){if(_0x347d9b){return _0x347d9b[_0x5dcd('0x20')](_0x28a5bc)[_0x5dcd('0x21')](function(_0x196df9){return _0x196df9;});}return null;};}function removeEntity(_0x2f4996,_0x5c5cf3){return function(_0x382dd6){if(_0x382dd6){return _0x382dd6[_0x5dcd('0x22')]()['then'](function(){_0x2f4996['status'](0xcc)[_0x5dcd('0x16')]();});}};}function handleEntityNotFound(_0x45f3c3,_0x105e20){return function(_0x50ac23){if(!_0x50ac23){_0x45f3c3['sendStatus'](0x194);}return _0x50ac23;};}function handleError(_0x4e8d5b,_0x26bb8b){_0x26bb8b=_0x26bb8b||0x1f4;return function(_0x498cc1){logger[_0x5dcd('0x23')](_0x498cc1[_0x5dcd('0x24')]);if(_0x498cc1['name']){delete _0x498cc1['name'];}_0x4e8d5b[_0x5dcd('0x17')](_0x26bb8b)[_0x5dcd('0x25')](_0x498cc1);};}exports[_0x5dcd('0x26')]=function(_0x490f18,_0x1fc103){var _0x3e350={},_0x91cbaa={},_0x2e9938={'count':0x0,'rows':[]};var _0x14b7a3=_[_0x5dcd('0x27')](db[_0x5dcd('0x28')][_0x5dcd('0x29')],function(_0x58f66b){return{'name':_0x58f66b[_0x5dcd('0x2a')],'type':_0x58f66b['type'][_0x5dcd('0x2b')]};});_0x91cbaa[_0x5dcd('0x2c')]=_[_0x5dcd('0x27')](_0x14b7a3,_0x5dcd('0x2d'));_0x91cbaa[_0x5dcd('0x2e')]=_[_0x5dcd('0x2f')](_0x490f18[_0x5dcd('0x2e')]);_0x91cbaa[_0x5dcd('0x30')]=_[_0x5dcd('0x31')](_0x91cbaa['model'],_0x91cbaa[_0x5dcd('0x2e')]);_0x3e350[_0x5dcd('0x32')]=_['intersection'](_0x91cbaa[_0x5dcd('0x2c')],qs[_0x5dcd('0x33')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x33')]));_0x3e350[_0x5dcd('0x32')]=_0x3e350[_0x5dcd('0x32')]['length']?_0x3e350[_0x5dcd('0x32')]:_0x91cbaa['model'];if(!_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x34')](_0x5dcd('0x35'))){_0x3e350[_0x5dcd('0x1a')]=qs[_0x5dcd('0x1a')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x1a')]);_0x3e350['offset']=qs['offset'](_0x490f18['query'][_0x5dcd('0x19')]);}_0x3e350[_0x5dcd('0x36')]=qs[_0x5dcd('0x37')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x37')]);_0x3e350['where']=qs[_0x5dcd('0x30')](_['pick'](_0x490f18[_0x5dcd('0x2e')],_0x91cbaa[_0x5dcd('0x30')]),_0x14b7a3);if(_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x38')]){_0x3e350[_0x5dcd('0x39')]=_[_0x5dcd('0x3a')](_0x3e350[_0x5dcd('0x39')],{'$or':_['map'](_0x14b7a3,function(_0x55e8e7){if(_0x55e8e7[_0x5dcd('0x3b')]!=='VIRTUAL'){var _0x3296a2={};_0x3296a2[_0x55e8e7['name']]={'$like':'%'+_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x38')]+'%'};return _0x3296a2;}})});}_0x3e350=_[_0x5dcd('0x3a')]({},_0x3e350,_0x490f18[_0x5dcd('0x3c')]);var _0x3b25d5={'where':_0x3e350[_0x5dcd('0x39')]};return db['UserProfileSection'][_0x5dcd('0x1b')](_0x3b25d5)[_0x5dcd('0x21')](function(_0x5012e5){_0x2e9938['count']=_0x5012e5;if(_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x3d')]){_0x3e350[_0x5dcd('0x3e')]=[{'all':!![]}];}return db[_0x5dcd('0x28')]['findAll'](_0x3e350);})[_0x5dcd('0x21')](function(_0x1a2d7f){_0x2e9938[_0x5dcd('0x3f')]=_0x1a2d7f;return _0x2e9938;})[_0x5dcd('0x21')](respondWithFilteredResult(_0x1fc103,_0x3e350))[_0x5dcd('0x40')](handleError(_0x1fc103,null));};exports[_0x5dcd('0x41')]=function(_0x527fdb,_0x5e850e){var _0x3c2a68={'raw':![],'where':{'id':_0x527fdb['params']['id']}},_0x4b246d={};_0x4b246d['model']=_[_0x5dcd('0x2f')](db[_0x5dcd('0x28')]['rawAttributes']);_0x4b246d[_0x5dcd('0x2e')]=_[_0x5dcd('0x2f')](_0x527fdb[_0x5dcd('0x2e')]);_0x4b246d['filters']=_['intersection'](_0x4b246d[_0x5dcd('0x2c')],_0x4b246d[_0x5dcd('0x2e')]);_0x3c2a68['attributes']=_['intersection'](_0x4b246d[_0x5dcd('0x2c')],qs['fields'](_0x527fdb[_0x5dcd('0x2e')][_0x5dcd('0x33')]));_0x3c2a68[_0x5dcd('0x32')]=_0x3c2a68[_0x5dcd('0x32')][_0x5dcd('0x42')]?_0x3c2a68[_0x5dcd('0x32')]:_0x4b246d[_0x5dcd('0x2c')];if(_0x527fdb[_0x5dcd('0x2e')][_0x5dcd('0x3d')]){_0x3c2a68['include']=[{'all':!![]}];}_0x3c2a68=_[_0x5dcd('0x3a')]({},_0x3c2a68,_0x527fdb[_0x5dcd('0x3c')]);return db[_0x5dcd('0x28')][_0x5dcd('0x43')](_0x3c2a68)[_0x5dcd('0x21')](handleEntityNotFound(_0x5e850e,null))[_0x5dcd('0x21')](respondWithResult(_0x5e850e,null))['catch'](handleError(_0x5e850e,null));};exports['create']=function(_0x46ca83,_0x68f9e5){return db['UserProfileSection'][_0x5dcd('0x44')](_0x46ca83[_0x5dcd('0x45')],{})['then'](respondWithResult(_0x68f9e5,0xc9))['catch'](handleError(_0x68f9e5,null));};exports['update']=function(_0x29c7bf,_0x1a6545){if(_0x29c7bf[_0x5dcd('0x45')]['id']){delete _0x29c7bf[_0x5dcd('0x45')]['id'];}return db['UserProfileSection'][_0x5dcd('0x43')]({'where':{'id':_0x29c7bf[_0x5dcd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a6545,null))['then'](saveUpdates(_0x29c7bf['body'],null))[_0x5dcd('0x21')](respondWithResult(_0x1a6545,null))['catch'](handleError(_0x1a6545,null));};exports[_0x5dcd('0x22')]=function(_0x5a6862,_0x2758fa){return db['UserProfileSection']['find']({'where':{'id':_0x5a6862['params']['id']}})[_0x5dcd('0x21')](handleEntityNotFound(_0x2758fa,null))[_0x5dcd('0x21')](removeEntity(_0x2758fa,null))['catch'](handleError(_0x2758fa,null));};exports[_0x5dcd('0x47')]=function(_0x16869b,_0x4017e3){return db[_0x5dcd('0x28')][_0x5dcd('0x47')]()[_0x5dcd('0x21')](respondWithResult(_0x4017e3,null))['catch'](handleError(_0x4017e3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9ba0248..e21b7b7 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 _0x2d07=['UserProfileSection','sectionId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x99ed1f,_0x51d4de){var _0x888ae0=function(_0x177104){while(--_0x177104){_0x99ed1f['push'](_0x99ed1f['shift']());}};_0x888ae0(++_0x51d4de);}(_0x2d07,0x13a));var _0x72d0=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0x2d07[_0x217a6f];return _0x5553f3;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var logger=require('../../config/logger')(_0x72d0('0x2'));var moment=require(_0x72d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d0('0x4'));var fs=require('fs');var path=require(_0x72d0('0x5'));var rimraf=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var attributes=require(_0x72d0('0x8'));module[_0x72d0('0x9')]=function(_0x4e0f5c,_0x180424){return _0x4e0f5c[_0x72d0('0xa')](_0x72d0('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x72d0('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3646=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3646,0x12c));var _0x6364=function(_0x27f593,_0x2e9209){_0x27f593=_0x27f593-0x0;var _0x451489=_0x3646[_0x27f593];return _0x451489;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var logger=require(_0x6364('0x2'))(_0x6364('0x3'));var moment=require(_0x6364('0x4'));var BPromise=require(_0x6364('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6364('0x6'));var rimraf=require('rimraf');var config=require(_0x6364('0x7'));var attributes=require(_0x6364('0x8'));module[_0x6364('0x9')]=function(_0x13d3e8,_0x465c85){return _0x13d3e8[_0x6364('0xa')](_0x6364('0xb'),attributes,{'tableName':_0x6364('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6364('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a7b9486..0e82f0f 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 _0xc455=['info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message'];(function(_0x99a1be,_0x380fe8){var _0xb7c123=function(_0x5633d5){while(--_0x5633d5){_0x99a1be['push'](_0x99a1be['shift']());}};_0xb7c123(++_0x380fe8);}(_0xc455,0x152));var _0x5c45=function(_0x52cc91,_0x3c2f71){_0x52cc91=_0x52cc91-0x0;var _0x269506=_0xc455[_0x52cc91];return _0x269506;};'use strict';var _=require(_0x5c45('0x0'));var util=require(_0x5c45('0x1'));var moment=require(_0x5c45('0x2'));var BPromise=require(_0x5c45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c45('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c45('0x5'))(_0x5c45('0x6'));var config=require('../../config/environment');var jayson=require(_0x5c45('0x7'));var client=jayson[_0x5c45('0x8')][_0x5c45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405a0e,_0x3823e4,_0x567648){return new BPromise(function(_0x40c4de,_0x4cd2ba){return client['request'](_0x405a0e,_0x567648)[_0x5c45('0xa')](function(_0x263871){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x3823e4,_0x5c45('0xb'));logger[_0x5c45('0xc')](_0x5c45('0xd'),_0x3823e4,'request\x20sent',JSON[_0x5c45('0xe')](_0x263871));if(_0x263871[_0x5c45('0xf')]){if(_0x263871['error'][_0x5c45('0x10')]===0x1f4){logger[_0x5c45('0xf')](_0x5c45('0x11'),_0x3823e4,_0x263871['error'][_0x5c45('0x12')]);return _0x4cd2ba(_0x263871[_0x5c45('0xf')][_0x5c45('0x12')]);}logger[_0x5c45('0xf')](_0x5c45('0x11'),_0x3823e4,_0x263871['error'][_0x5c45('0x12')]);return _0x40c4de(_0x263871[_0x5c45('0xf')]['message']);}else{logger[_0x5c45('0x13')](_0x5c45('0x11'),_0x3823e4,_0x5c45('0xb'));_0x40c4de(_0x263871['result'][_0x5c45('0x12')]);}})[_0x5c45('0x14')](function(_0x205519){logger[_0x5c45('0xf')](_0x5c45('0x11'),_0x3823e4,_0x205519);_0x4cd2ba(_0x205519);});});} \ No newline at end of file +var _0xf97f=['result','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x254b1d,_0x50d7e7){var _0x5377b8=function(_0x1d42e9){while(--_0x1d42e9){_0x254b1d['push'](_0x254b1d['shift']());}};_0x5377b8(++_0x50d7e7);}(_0xf97f,0xc7));var _0xff97=function(_0x47e5f1,_0x1ee147){_0x47e5f1=_0x47e5f1-0x0;var _0x212888=_0xf97f[_0x47e5f1];return _0x212888;};'use strict';var _=require(_0xff97('0x0'));var util=require(_0xff97('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff97('0x2'));var db=require(_0xff97('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xff97('0x4'))(_0xff97('0x5'));var config=require(_0xff97('0x6'));var jayson=require(_0xff97('0x7'));var client=jayson[_0xff97('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce0bc,_0x293b8e,_0x4c302d){return new BPromise(function(_0x5141fa,_0x2c793b){return client[_0xff97('0x9')](_0x2ce0bc,_0x4c302d)['then'](function(_0x1fe445){logger['info'](_0xff97('0xa'),_0x293b8e,_0xff97('0xb'));logger['debug'](_0xff97('0xc'),_0x293b8e,_0xff97('0xb'),JSON[_0xff97('0xd')](_0x1fe445));if(_0x1fe445[_0xff97('0xe')]){if(_0x1fe445[_0xff97('0xe')]['code']===0x1f4){logger[_0xff97('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x293b8e,_0x1fe445['error'][_0xff97('0xf')]);return _0x2c793b(_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);}logger[_0xff97('0xe')](_0xff97('0xa'),_0x293b8e,_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);return _0x5141fa(_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);}else{logger[_0xff97('0x10')](_0xff97('0xa'),_0x293b8e,'request\x20sent');_0x5141fa(_0x1fe445[_0xff97('0x11')][_0xff97('0xf')]);}})['catch'](function(_0x4d48cd){logger[_0xff97('0xe')](_0xff97('0xa'),_0x293b8e,_0x4d48cd);_0x2c793b(_0x4d48cd);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 71f7773..30a8713 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xd9076f,_0x1f2480){var _0x222963=function(_0x1ff54e){while(--_0x1ff54e){_0xd9076f['push'](_0xd9076f['shift']());}};_0x222963(++_0x1f2480);}(_0xe706,0xa3));var _0x6e70=function(_0xc8a598,_0x8ffd7c){_0xc8a598=_0xc8a598-0x0;var _0x2a6225=_0xe706[_0xc8a598];return _0x2a6225;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e958d,_0x45a0ae){var _0x2545c6=function(_0xa513b9){while(--_0xa513b9){_0x4e958d['push'](_0x4e958d['shift']());}};_0x2545c6(++_0x45a0ae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xcb91[_0x49d19d];return _0x4ebef1;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4475d74..b421294 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 _0xa6f6=['exports','sequelize'];(function(_0x2596fa,_0x189c14){var _0x159184=function(_0x22a487){while(--_0x22a487){_0x2596fa['push'](_0x2596fa['shift']());}};_0x159184(++_0x189c14);}(_0xa6f6,0x16b));var _0x6a6f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa6f6[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x6a6f('0x0'));module[_0x6a6f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d03=['exports','INTEGER','sequelize'];(function(_0x511015,_0x375ec8){var _0x41b1a6=function(_0x17c895){while(--_0x17c895){_0x511015['push'](_0x511015['shift']());}};_0x41b1a6(++_0x375ec8);}(_0x1d03,0x6b));var _0x31d0=function(_0x440c0,_0x39578e){_0x440c0=_0x440c0-0x0;var _0x50ce14=_0x1d03[_0x440c0];return _0x50ce14;};'use strict';var Sequelize=require(_0x31d0('0x0'));module[_0x31d0('0x1')]={'penalty':{'type':Sequelize[_0x31d0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4ddb168..833f924 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 _0x7096=['exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x7096,0x10c));var _0x6709=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7096[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eba=['user_has_sms_queues','util','../../config/logger','api','moment','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x2f2919,_0x37445e){var _0x2f3406=function(_0xa99c94){while(--_0xa99c94){_0x2f2919['push'](_0x2f2919['shift']());}};_0x2f3406(++_0x37445e);}(_0x2eba,0xc7));var _0xa2eb=function(_0x162c3c,_0x3bd756){_0x162c3c=_0x162c3c-0x0;var _0x21c060=_0x2eba[_0x162c3c];return _0x21c060;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('UserSmsQueue',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index a59c19e..3474e27 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 _0x934a=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e5d12,_0x33fc33){var _0x104386=function(_0xb310b0){while(--_0xb310b0){_0x5e5d12['push'](_0x5e5d12['shift']());}};_0x104386(++_0x33fc33);}(_0x934a,0x1ad));var _0xa934=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x934a[_0x36feb2];return _0x292b43;};'use strict';var _=require(_0xa934('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa934('0x1'));var fs=require('fs');var Redis=require(_0xa934('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa934('0x3'));var logger=require(_0xa934('0x4'))(_0xa934('0x5'));var config=require(_0xa934('0x6'));var jayson=require(_0xa934('0x7'));var client=jayson['client'][_0xa934('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e5045,_0x5494c2,_0x4c30cd){return new BPromise(function(_0x556012,_0x99ff72){return client[_0xa934('0x9')](_0x5e5045,_0x4c30cd)[_0xa934('0xa')](function(_0x39035b){logger[_0xa934('0xb')](_0xa934('0xc'),_0x5494c2,'request\x20sent');logger[_0xa934('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5494c2,_0xa934('0xe'),JSON[_0xa934('0xf')](_0x39035b));if(_0x39035b[_0xa934('0x10')]){if(_0x39035b[_0xa934('0x10')]['code']===0x1f4){logger[_0xa934('0x10')](_0xa934('0xc'),_0x5494c2,_0x39035b[_0xa934('0x10')][_0xa934('0x11')]);return _0x99ff72(_0x39035b[_0xa934('0x10')][_0xa934('0x11')]);}logger[_0xa934('0x10')](_0xa934('0xc'),_0x5494c2,_0x39035b[_0xa934('0x10')][_0xa934('0x11')]);return _0x556012(_0x39035b[_0xa934('0x10')][_0xa934('0x11')]);}else{logger[_0xa934('0xb')](_0xa934('0xc'),_0x5494c2,_0xa934('0xe'));_0x556012(_0x39035b[_0xa934('0x12')][_0xa934('0x11')]);}})['catch'](function(_0x3bde4d){logger[_0xa934('0x10')](_0xa934('0xc'),_0x5494c2,_0x3bde4d);_0x99ff72(_0x3bde4d);});});} \ No newline at end of file +var _0xd044=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5cedf5,_0x36fb97){var _0x55081a=function(_0x54f9f3){while(--_0x54f9f3){_0x5cedf5['push'](_0x5cedf5['shift']());}};_0x55081a(++_0x36fb97);}(_0xd044,0x1b9));var _0x4d04=function(_0x28dcf7,_0x2362a6){_0x28dcf7=_0x28dcf7-0x0;var _0x340b7d=_0xd044[_0x28dcf7];return _0x340b7d;};'use strict';var _=require('lodash');var util=require(_0x4d04('0x0'));var moment=require('moment');var BPromise=require(_0x4d04('0x1'));var rs=require(_0x4d04('0x2'));var fs=require('fs');var Redis=require(_0x4d04('0x3'));var db=require(_0x4d04('0x4'))['db'];var utils=require(_0x4d04('0x5'));var logger=require(_0x4d04('0x6'))(_0x4d04('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d04('0x8'));var client=jayson[_0x4d04('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0724,_0x7b1628,_0x38abb7){return new BPromise(function(_0x3a02c0,_0x587ac9){return client[_0x4d04('0xa')](_0x2e0724,_0x38abb7)['then'](function(_0x152fb1){logger[_0x4d04('0xb')](_0x4d04('0xc'),_0x7b1628,'request\x20sent');logger['debug'](_0x4d04('0xd'),_0x7b1628,_0x4d04('0xe'),JSON[_0x4d04('0xf')](_0x152fb1));if(_0x152fb1[_0x4d04('0x10')]){if(_0x152fb1[_0x4d04('0x10')]['code']===0x1f4){logger['error'](_0x4d04('0xc'),_0x7b1628,_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);return _0x587ac9(_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);}logger['error'](_0x4d04('0xc'),_0x7b1628,_0x152fb1[_0x4d04('0x10')]['message']);return _0x3a02c0(_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x7b1628,_0x4d04('0xe'));_0x3a02c0(_0x152fb1[_0x4d04('0x12')][_0x4d04('0x11')]);}})[_0x4d04('0x13')](function(_0x8bab43){logger[_0x4d04('0x10')](_0x4d04('0xc'),_0x7b1628,_0x8bab43);_0x587ac9(_0x8bab43);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b7cb3f6..42e0ed0 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 _0x6fb0=['sequelize','exports','INTEGER'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x6fb0,0x8a));var _0x06fb=function(_0x113674,_0x22af5f){_0x113674=_0x113674-0x0;var _0x3c6adb=_0x6fb0[_0x113674];return _0x3c6adb;};'use strict';var Sequelize=require(_0x06fb('0x0'));module[_0x06fb('0x1')]={'UserId':{'type':Sequelize[_0x06fb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x06fb('0x2')]}}; \ No newline at end of file +var _0xab53=['INTEGER','sequelize'];(function(_0x538372,_0x53231f){var _0x168679=function(_0xbe1395){while(--_0xbe1395){_0x538372['push'](_0x538372['shift']());}};_0x168679(++_0x53231f);}(_0xab53,0x193));var _0x3ab5=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xab53[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x3ab5('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x3ab5('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index cc238a7..507d16a 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(_0x386887,_0x44ac96){var _0x240f3f=function(_0x1696c8){while(--_0x1696c8){_0x386887['push'](_0x386887['shift']());}};_0x240f3f(++_0x44ac96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0xe11dc6,_0x1f8110){var _0xaf2106=function(_0x4aec73){while(--_0x4aec73){_0xe11dc6['push'](_0xe11dc6['shift']());}};_0xaf2106(++_0x1f8110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 753e554..4d8b379 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5e465a,_0x3e0f32){var _0x52c7db=function(_0x2c9dea){while(--_0x2c9dea){_0x5e465a['push'](_0x5e465a['shift']());}};_0x52c7db(++_0x3e0f32);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x351ebc,_0x341170){var _0x2f0ef3=function(_0x5ea2ff){while(--_0x5ea2ff){_0x351ebc['push'](_0x351ebc['shift']());}};_0x2f0ef3(++_0x341170);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xcb91[_0x65c0bb];return _0x320bd5;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f17fc3b..e4a77e9 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 _0xaa9d=['sequelize','exports','INTEGER'];(function(_0x286595,_0x29f350){var _0x3ea6b8=function(_0x157dc3){while(--_0x157dc3){_0x286595['push'](_0x286595['shift']());}};_0x3ea6b8(++_0x29f350);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x16a629,_0x2dc47f){_0x16a629=_0x16a629-0x0;var _0x1d9e4d=_0xaa9d[_0x16a629];return _0x1d9e4d;};'use strict';var Sequelize=require(_0xdaa9('0x0'));module[_0xdaa9('0x1')]={'penalty':{'type':Sequelize[_0xdaa9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3cfa=['exports'];(function(_0x57fb7c,_0x5d9c02){var _0xf2dffd=function(_0x1c84bd){while(--_0x1c84bd){_0x57fb7c['push'](_0x57fb7c['shift']());}};_0xf2dffd(++_0x5d9c02);}(_0x3cfa,0x6d));var _0xa3cf=function(_0x56a118,_0x2147ff){_0x56a118=_0x56a118-0x0;var _0x1738c2=_0x3cfa[_0x56a118];return _0x1738c2;};'use strict';var Sequelize=require('sequelize');module[_0xa3cf('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1826427..0012eea 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 _0xd390=['./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd390,0xaf));var _0x0d39=function(_0x335aeb,_0xf9bf9a){_0x335aeb=_0x335aeb-0x0;var _0x320c2e=_0xd390[_0x335aeb];return _0x320c2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d39('0x0'))('api');var moment=require(_0x0d39('0x1'));var BPromise=require('bluebird');var rp=require(_0x0d39('0x2'));var fs=require('fs');var path=require(_0x0d39('0x3'));var rimraf=require(_0x0d39('0x4'));var config=require('../../config/environment');var attributes=require(_0x0d39('0x5'));module[_0x0d39('0x6')]=function(_0x2577b0,_0x325946){return _0x2577b0['define'](_0x0d39('0x7'),attributes,{'tableName':_0x0d39('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0f4=['user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0xc0f4,0xdd));var _0x4c0f=function(_0x1ba72a,_0x38fc48){_0x1ba72a=_0x1ba72a-0x0;var _0x5ca05d=_0xc0f4[_0x1ba72a];return _0x5ca05d;};'use strict';var _=require(_0x4c0f('0x0'));var util=require(_0x4c0f('0x1'));var logger=require(_0x4c0f('0x2'))(_0x4c0f('0x3'));var moment=require('moment');var BPromise=require(_0x4c0f('0x4'));var rp=require(_0x4c0f('0x5'));var fs=require('fs');var path=require(_0x4c0f('0x6'));var rimraf=require('rimraf');var config=require(_0x4c0f('0x7'));var attributes=require(_0x4c0f('0x8'));module[_0x4c0f('0x9')]=function(_0x4008f5,_0x47a921){return _0x4008f5['define']('UserVoiceQueue',attributes,{'tableName':_0x4c0f('0xa'),'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 f0d6fdf..7ec90c9 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 _0xdb71=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x5ca51d,_0xe86f27){var _0x5f3d85=function(_0x21e54a){while(--_0x21e54a){_0x5ca51d['push'](_0x5ca51d['shift']());}};_0x5f3d85(++_0xe86f27);}(_0xdb71,0x1bb));var _0x1db7=function(_0x5e285f,_0x471816){_0x5e285f=_0x5e285f-0x0;var _0x2ddfba=_0xdb71[_0x5e285f];return _0x2ddfba;};'use strict';var _=require(_0x1db7('0x0'));var util=require(_0x1db7('0x1'));var moment=require(_0x1db7('0x2'));var BPromise=require(_0x1db7('0x3'));var rs=require(_0x1db7('0x4'));var fs=require('fs');var Redis=require(_0x1db7('0x5'));var db=require(_0x1db7('0x6'))['db'];var utils=require(_0x1db7('0x7'));var logger=require('../../config/logger')(_0x1db7('0x8'));var config=require(_0x1db7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1db7('0xa')][_0x1db7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x308add,_0x44e2bd,_0x31beb0){return new BPromise(function(_0x2745b4,_0x30bac0){return client[_0x1db7('0xc')](_0x308add,_0x31beb0)[_0x1db7('0xd')](function(_0x5062d5){logger[_0x1db7('0xe')](_0x1db7('0xf'),_0x44e2bd,_0x1db7('0x10'));logger['debug'](_0x1db7('0x11'),_0x44e2bd,_0x1db7('0x10'),JSON[_0x1db7('0x12')](_0x5062d5));if(_0x5062d5[_0x1db7('0x13')]){if(_0x5062d5[_0x1db7('0x13')][_0x1db7('0x14')]===0x1f4){logger[_0x1db7('0x13')](_0x1db7('0xf'),_0x44e2bd,_0x5062d5[_0x1db7('0x13')][_0x1db7('0x15')]);return _0x30bac0(_0x5062d5[_0x1db7('0x13')][_0x1db7('0x15')]);}logger[_0x1db7('0x13')](_0x1db7('0xf'),_0x44e2bd,_0x5062d5['error'][_0x1db7('0x15')]);return _0x2745b4(_0x5062d5[_0x1db7('0x13')][_0x1db7('0x15')]);}else{logger[_0x1db7('0xe')](_0x1db7('0xf'),_0x44e2bd,_0x1db7('0x10'));_0x2745b4(_0x5062d5[_0x1db7('0x16')][_0x1db7('0x15')]);}})[_0x1db7('0x17')](function(_0x5dfa89){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x44e2bd,_0x5dfa89);_0x30bac0(_0x5dfa89);});});} \ No newline at end of file +var _0x98b5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x98b5,0x164));var _0x598b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x98b5[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x598b('0x0'));var moment=require(_0x598b('0x1'));var BPromise=require(_0x598b('0x2'));var rs=require(_0x598b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x598b('0x4'));var logger=require('../../config/logger')(_0x598b('0x5'));var config=require(_0x598b('0x6'));var jayson=require(_0x598b('0x7'));var client=jayson[_0x598b('0x8')][_0x598b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44b50d,_0x348018,_0x5a1ed1){return new BPromise(function(_0x50bca5,_0x2fc8b5){return client[_0x598b('0xa')](_0x44b50d,_0x5a1ed1)[_0x598b('0xb')](function(_0x3c3e26){logger[_0x598b('0xc')](_0x598b('0xd'),_0x348018,_0x598b('0xe'));logger['debug'](_0x598b('0xf'),_0x348018,_0x598b('0xe'),JSON['stringify'](_0x3c3e26));if(_0x3c3e26[_0x598b('0x10')]){if(_0x3c3e26[_0x598b('0x10')][_0x598b('0x11')]===0x1f4){logger['error'](_0x598b('0xd'),_0x348018,_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);return _0x2fc8b5(_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);}logger['error'](_0x598b('0xd'),_0x348018,_0x3c3e26[_0x598b('0x10')]['message']);return _0x50bca5(_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);}else{logger['info'](_0x598b('0xd'),_0x348018,_0x598b('0xe'));_0x50bca5(_0x3c3e26['result']['message']);}})[_0x598b('0x13')](function(_0x5ce413){logger[_0x598b('0x10')](_0x598b('0xd'),_0x348018,_0x5ce413);_0x2fc8b5(_0x5ce413);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 92b137a..02e97b0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3674e9,_0x4aa997){var _0x46fa11=function(_0xc953ca){while(--_0xc953ca){_0x3674e9['push'](_0x3674e9['shift']());}};_0x46fa11(++_0x4aa997);}(_0xe706,0xa3));var _0x6e70=function(_0x23d2a0,_0x516174){_0x23d2a0=_0x23d2a0-0x0;var _0x409e80=_0xe706[_0x23d2a0];return _0x409e80;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b7db0fa..8c7a76d 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 _0x05f8=['STRING','INTEGER','queue_interface','sequelize','Required\x20by\x20Asterisk'];(function(_0x4ee6b9,_0x507cec){var _0x209084=function(_0xdcf093){while(--_0xdcf093){_0x4ee6b9['push'](_0x4ee6b9['shift']());}};_0x209084(++_0x507cec);}(_0x05f8,0x8f));var _0x805f=function(_0x58c803,_0x5e4b69){_0x58c803=_0x58c803-0x0;var _0x516056=_0x05f8[_0x58c803];return _0x516056;};'use strict';var Sequelize=require(_0x805f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x805f('0x1')},'membername':{'type':Sequelize[_0x805f('0x2')],'allowNull':![],'comment':_0x805f('0x1')},'UserId':{'type':Sequelize[_0x805f('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x805f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x805f('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x805f('0x1')},'penalty':{'type':Sequelize[_0x805f('0x3')](0xb),'defaultValue':0x0,'comment':_0x805f('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x805f('0x1')}}; \ No newline at end of file +var _0x5977=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x141b4e,_0x306d07){var _0x44c4a3=function(_0x42c20d){while(--_0x42c20d){_0x141b4e['push'](_0x141b4e['shift']());}};_0x44c4a3(++_0x306d07);}(_0x5977,0xe1));var _0x7597=function(_0x27073f,_0x261ce7){_0x27073f=_0x27073f-0x0;var _0x4eb744=_0x5977[_0x27073f];return _0x4eb744;};'use strict';var Sequelize=require(_0x7597('0x0'));module[_0x7597('0x1')]={'uniqueid':{'type':Sequelize[_0x7597('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7597('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x7597('0x3')},'UserId':{'type':Sequelize[_0x7597('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7597('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x7597('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7597('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7597('0x4')],'allowNull':![],'unique':_0x7597('0x5'),'comment':_0x7597('0x3')},'penalty':{'type':Sequelize[_0x7597('0x2')](0xb),'defaultValue':0x0,'comment':_0x7597('0x3')},'paused':{'type':Sequelize[_0x7597('0x2')](0xb),'defaultValue':0x0,'comment':_0x7597('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d2177c1..0007eb4 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 _0x61ce=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xf2b6ce,_0x5c2dca){var _0x1b095a=function(_0x2ec194){while(--_0x2ec194){_0xf2b6ce['push'](_0xf2b6ce['shift']());}};_0x1b095a(++_0x5c2dca);}(_0x61ce,0x9a));var _0xe61c=function(_0x7f4c93,_0x521f89){_0x7f4c93=_0x7f4c93-0x0;var _0x3d152e=_0x61ce[_0x7f4c93];return _0x3d152e;};'use strict';var EventEmitter=require(_0xe61c('0x0'));var UserVoiceQueueRt=require(_0xe61c('0x1'))['db'][_0xe61c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe61c('0x3')](0x0);var events={'afterCreate':_0xe61c('0x4'),'afterUpdate':_0xe61c('0x5'),'afterDestroy':_0xe61c('0x6')};function emitEvent(_0x1e90a1){return function(_0x7c358c,_0x5cc938,_0x125a30){UserVoiceQueueRtEvents[_0xe61c('0x7')](_0x1e90a1+':'+_0x7c358c['id'],_0x7c358c);UserVoiceQueueRtEvents[_0xe61c('0x7')](_0x1e90a1,_0x7c358c);_0x125a30(null);};}for(var e in events){if(events[_0xe61c('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xe61c('0x9')](e,emitEvent(event));}}module[_0xe61c('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6125=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','exports'];(function(_0xdfd303,_0x48c7b6){var _0x57a73a=function(_0x337246){while(--_0x337246){_0xdfd303['push'](_0xdfd303['shift']());}};_0x57a73a(++_0x48c7b6);}(_0x6125,0x88));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5612('0x0'))['db'][_0x5612('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5612('0x2')](0x0);var events={'afterCreate':_0x5612('0x3'),'afterUpdate':'update','afterDestroy':_0x5612('0x4')};function emitEvent(_0x4fd86d){return function(_0x5e9ff2,_0x14ae69,_0x2e3436){UserVoiceQueueRtEvents[_0x5612('0x5')](_0x4fd86d+':'+_0x5e9ff2['id'],_0x5e9ff2);UserVoiceQueueRtEvents['emit'](_0x4fd86d,_0x5e9ff2);_0x2e3436(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5612('0x6')](e,emitEvent(event));}}module[_0x5612('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9f69994..f0ef8af 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 _0x5fc5=['bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','moment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5fc5,0xd9));var _0x55fc=function(_0x7fddb3,_0x173ffb){_0x7fddb3=_0x7fddb3-0x0;var _0x5089b0=_0x5fc5[_0x7fddb3];return _0x5089b0;};'use strict';var _=require(_0x55fc('0x0'));var util=require(_0x55fc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x55fc('0x2'));var BPromise=require(_0x55fc('0x3'));var rp=require(_0x55fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55fc('0x5'));var attributes=require(_0x55fc('0x6'));module[_0x55fc('0x7')]=function(_0x1168ae,_0x178be4){return _0x1168ae[_0x55fc('0x8')](_0x55fc('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeda=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4c42ea,_0x54d3f3){var _0x57d7c5=function(_0x53ed8e){while(--_0x53ed8e){_0x4c42ea['push'](_0x4c42ea['shift']());}};_0x57d7c5(++_0x54d3f3);}(_0xdeda,0x1cd));var _0xaded=function(_0x3f0c12,_0xea4b1d){_0x3f0c12=_0x3f0c12-0x0;var _0x2b90e0=_0xdeda[_0x3f0c12];return _0x2b90e0;};'use strict';var _=require(_0xaded('0x0'));var util=require(_0xaded('0x1'));var logger=require(_0xaded('0x2'))('api');var moment=require(_0xaded('0x3'));var BPromise=require('bluebird');var rp=require(_0xaded('0x4'));var fs=require('fs');var path=require(_0xaded('0x5'));var rimraf=require(_0xaded('0x6'));var config=require(_0xaded('0x7'));var attributes=require(_0xaded('0x8'));module['exports']=function(_0x57bca2,_0x306159){return _0x57bca2[_0xaded('0x9')](_0xaded('0xa'),attributes,{'tableName':_0xaded('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 6d9770a..769c8a5 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 _0x19d1=['UserVoiceQueueRt','options','where','COUNT','sequelize','literal','outboundQueuePauses','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x367a44,_0x121a26){var _0x14c9d1=function(_0x1262a8){while(--_0x1262a8){_0x367a44['push'](_0x367a44['shift']());}};_0x14c9d1(++_0x121a26);}(_0x19d1,0x1e9));var _0x119d=function(_0x95940,_0xbcdef7){_0x95940=_0x95940-0x0;var _0x4764a8=_0x19d1[_0x95940];return _0x4764a8;};'use strict';var _=require(_0x119d('0x0'));var util=require('util');var moment=require(_0x119d('0x1'));var BPromise=require(_0x119d('0x2'));var rs=require(_0x119d('0x3'));var fs=require('fs');var Redis=require(_0x119d('0x4'));var db=require(_0x119d('0x5'))['db'];var utils=require(_0x119d('0x6'));var logger=require(_0x119d('0x7'))(_0x119d('0x8'));var config=require(_0x119d('0x9'));var jayson=require(_0x119d('0xa'));var client=jayson[_0x119d('0xb')][_0x119d('0xc')]({'port':0x232a});config[_0x119d('0xd')]=_[_0x119d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x119d('0xf'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x4fe0e2,_0x9d68a7,_0x53a4cc){return new BPromise(function(_0x4d3a65,_0x3b8525){return client[_0x119d('0x10')](_0x4fe0e2,_0x53a4cc)[_0x119d('0x11')](function(_0x138cb3){logger['info'](_0x119d('0x12'),_0x9d68a7,_0x119d('0x13'));logger[_0x119d('0x14')](_0x119d('0x15'),_0x9d68a7,_0x119d('0x13'),JSON[_0x119d('0x16')](_0x138cb3));if(_0x138cb3[_0x119d('0x17')]){if(_0x138cb3[_0x119d('0x17')][_0x119d('0x18')]===0x1f4){logger[_0x119d('0x17')](_0x119d('0x12'),_0x9d68a7,_0x138cb3['error'][_0x119d('0x19')]);return _0x3b8525(_0x138cb3[_0x119d('0x17')][_0x119d('0x19')]);}logger['error'](_0x119d('0x12'),_0x9d68a7,_0x138cb3[_0x119d('0x17')]['message']);return _0x4d3a65(_0x138cb3['error'][_0x119d('0x19')]);}else{logger['info'](_0x119d('0x12'),_0x9d68a7,_0x119d('0x13'));_0x4d3a65(_0x138cb3[_0x119d('0x1a')][_0x119d('0x19')]);}})[_0x119d('0x1b')](function(_0x2ed635){logger['error'](_0x119d('0x12'),_0x9d68a7,_0x2ed635);_0x3b8525(_0x2ed635);});});}exports[_0x119d('0x1c')]=function(_0x330136){var _0x407238=this;return new Promise(function(_0x47ed22,_0x115a93){return db[_0x119d('0x1d')]['findAll']({'raw':_0x330136[_0x119d('0x1e')]?_0x330136[_0x119d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x330136['options']?_0x330136[_0x119d('0x1e')][_0x119d('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x119d('0x20'),db[_0x119d('0x21')]['fn']('IF',db[_0x119d('0x21')][_0x119d('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0x119d('0x23')]]})[_0x119d('0x11')](function(_0x55c58c){logger[_0x119d('0x24')](_0x119d('0x1c'),_0x330136);logger[_0x119d('0x14')](_0x119d('0x1c'),_0x330136,JSON[_0x119d('0x16')](_0x55c58c));_0x47ed22(_0x55c58c);})[_0x119d('0x1b')](function(_0x262b35){logger[_0x119d('0x17')]('GetVoiceQueueRtPauses',_0x262b35['message'],_0x330136);_0x115a93(_0x407238[_0x119d('0x17')](0x1f4,_0x262b35[_0x119d('0x19')]));});});}; \ No newline at end of file +var _0xc220=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x45502d,_0x5ca8b7){var _0x8813c9=function(_0xa53455){while(--_0xa53455){_0x45502d['push'](_0x45502d['shift']());}};_0x8813c9(++_0x5ca8b7);}(_0xc220,0xd8));var _0x0c22=function(_0x5c3781,_0x266c58){_0x5c3781=_0x5c3781-0x0;var _0x50dc13=_0xc220[_0x5c3781];return _0x50dc13;};'use strict';var _=require('lodash');var util=require(_0x0c22('0x0'));var moment=require(_0x0c22('0x1'));var BPromise=require(_0x0c22('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c22('0x3'))['db'];var utils=require(_0x0c22('0x4'));var logger=require(_0x0c22('0x5'))('rpc');var config=require(_0x0c22('0x6'));var jayson=require(_0x0c22('0x7'));var client=jayson['client'][_0x0c22('0x8')]({'port':0x232a});config[_0x0c22('0x9')]=_['defaults'](config[_0x0c22('0x9')],{'host':_0x0c22('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c22('0x9')]));require(_0x0c22('0xb'))['register'](socket);function respondWithRpcPromise(_0x12bd7b,_0x267afb,_0x212845){return new BPromise(function(_0x2437d3,_0x120f09){return client[_0x0c22('0xc')](_0x12bd7b,_0x212845)['then'](function(_0x457100){logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x267afb,_0x0c22('0xf'));logger[_0x0c22('0x10')](_0x0c22('0x11'),_0x267afb,_0x0c22('0xf'),JSON[_0x0c22('0x12')](_0x457100));if(_0x457100['error']){if(_0x457100[_0x0c22('0x13')]['code']===0x1f4){logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);return _0x120f09(_0x457100['error']['message']);}logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);return _0x2437d3(_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);}else{logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x267afb,'request\x20sent');_0x2437d3(_0x457100[_0x0c22('0x15')][_0x0c22('0x14')]);}})['catch'](function(_0x3b33f1){logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x3b33f1);_0x120f09(_0x3b33f1);});});}exports['GetVoiceQueueRtPauses']=function(_0x1e67ca){var _0x2197c0=this;return new Promise(function(_0x544087,_0x31967e){return db[_0x0c22('0x16')][_0x0c22('0x17')]({'raw':_0x1e67ca[_0x0c22('0x18')]?_0x1e67ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e67ca[_0x0c22('0x18')]?_0x1e67ca[_0x0c22('0x18')][_0x0c22('0x19')]||null:null,'attributes':[[db[_0x0c22('0x1a')]['fn'](_0x0c22('0x1b'),db[_0x0c22('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x0c22('0x1c')))),_0x0c22('0x1d')]]})[_0x0c22('0x1e')](function(_0x3a0443){logger['info'](_0x0c22('0x1f'),_0x1e67ca);logger[_0x0c22('0x10')](_0x0c22('0x1f'),_0x1e67ca,JSON[_0x0c22('0x12')](_0x3a0443));_0x544087(_0x3a0443);})[_0x0c22('0x20')](function(_0x478a5a){logger[_0x0c22('0x13')]('GetVoiceQueueRtPauses',_0x478a5a[_0x0c22('0x14')],_0x1e67ca);_0x31967e(_0x2197c0[_0x0c22('0x13')](0x1f4,_0x478a5a[_0x0c22('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 41a78a4..fe9e804 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 _0x3974=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x2d5045,_0x381889){var _0x2446e3=function(_0xbb6c32){while(--_0xbb6c32){_0x2d5045['push'](_0x2d5045['shift']());}};_0x2446e3(++_0x381889);}(_0x3974,0xbc));var _0x4397=function(_0x520334,_0x51c471){_0x520334=_0x520334-0x0;var _0x363a86=_0x3974[_0x520334];return _0x363a86;};'use strict';var UserVoiceQueueRtEvents=require(_0x4397('0x0'));var events=[_0x4397('0x1'),_0x4397('0x2'),'update'];function createListener(_0x5f33b7,_0x160396){return function(_0x258182){_0x160396[_0x4397('0x3')](_0x5f33b7,_0x258182);};}function removeListener(_0x1337be,_0x3eefc4){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1337be,_0x3eefc4);};}exports[_0x4397('0x4')]=function(_0x2bf887){for(var _0x32f617=0x0,_0x391ea0=events['length'];_0x32f617<_0x391ea0;_0x32f617++){var _0x37eeef=events[_0x32f617];var _0x429564=createListener(_0x4397('0x5')+_0x37eeef,_0x2bf887);UserVoiceQueueRtEvents['on'](_0x37eeef,_0x429564);}}; \ No newline at end of file +var _0x4074=['./userVoiceQueueRt.events','save','remove','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4074,0xf0));var _0x4407=function(_0x3e8312,_0xe08810){_0x3e8312=_0x3e8312-0x0;var _0x33afc3=_0x4074[_0x3e8312];return _0x33afc3;};'use strict';var UserVoiceQueueRtEvents=require(_0x4407('0x0'));var events=[_0x4407('0x1'),_0x4407('0x2'),'update'];function createListener(_0x1021e6,_0x2a756){return function(_0x14c0bc){_0x2a756[_0x4407('0x3')](_0x1021e6,_0x14c0bc);};}function removeListener(_0x188494,_0x3c9f5c){return function(){UserVoiceQueueRtEvents[_0x4407('0x4')](_0x188494,_0x3c9f5c);};}exports[_0x4407('0x5')]=function(_0x3f085d){for(var _0x35899d=0x0,_0x4933cf=events[_0x4407('0x6')];_0x35899d<_0x4933cf;_0x35899d++){var _0x5f0699=events[_0x35899d];var _0x414f0a=createListener(_0x4407('0x7')+_0x5f0699,_0x3f085d);UserVoiceQueueRtEvents['on'](_0x5f0699,_0x414f0a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6db67ba..3422d4f 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b7927,_0x4bb9ba){var _0x3117ff=function(_0x226aaa){while(--_0x226aaa){_0x1b7927['push'](_0x1b7927['shift']());}};_0x3117ff(++_0x4bb9ba);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x57c4ec,_0xfb1ad0){var _0x157f3c=function(_0x283be4){while(--_0x283be4){_0x57c4ec['push'](_0x57c4ec['shift']());}};_0x157f3c(++_0xfb1ad0);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 816273a..a90854a 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 _0xa306=['INTEGER','sequelize','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa306,0x1cf));var _0x6a30=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xa306[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0x6a30('0x0'));module[_0x6a30('0x1')]={'penalty':{'type':Sequelize[_0x6a30('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x678e=['INTEGER','sequelize'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x678e,0x1b1));var _0xe678=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x678e[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xe678('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe678('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 2383527..614b231 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 _0xdf06=['util','api','moment','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x438740,_0x24e449){var _0x2dfbae=function(_0x56ec47){while(--_0x56ec47){_0x438740['push'](_0x438740['shift']());}};_0x2dfbae(++_0x24e449);}(_0xdf06,0x1df));var _0x6df0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xdf06[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x6df0('0x0'));var util=require(_0x6df0('0x1'));var logger=require('../../config/logger')(_0x6df0('0x2'));var moment=require(_0x6df0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6df0('0x4'));var rimraf=require(_0x6df0('0x5'));var config=require(_0x6df0('0x6'));var attributes=require(_0x6df0('0x7'));module[_0x6df0('0x8')]=function(_0x3ae8de,_0x339f2d){return _0x3ae8de[_0x6df0('0x9')](_0x6df0('0xa'),attributes,{'tableName':_0x6df0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605b=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x222ca6,_0x24b060){var _0x10f6dc=function(_0x4fce5b){while(--_0x4fce5b){_0x222ca6['push'](_0x222ca6['shift']());}};_0x10f6dc(++_0x24b060);}(_0x605b,0xe9));var _0xb605=function(_0x284ddf,_0x15451c){_0x284ddf=_0x284ddf-0x0;var _0x1a2e15=_0x605b[_0x284ddf];return _0x1a2e15;};'use strict';var _=require(_0xb605('0x0'));var util=require(_0xb605('0x1'));var logger=require(_0xb605('0x2'))(_0xb605('0x3'));var moment=require(_0xb605('0x4'));var BPromise=require(_0xb605('0x5'));var rp=require(_0xb605('0x6'));var fs=require('fs');var path=require(_0xb605('0x7'));var rimraf=require(_0xb605('0x8'));var config=require(_0xb605('0x9'));var attributes=require(_0xb605('0xa'));module[_0xb605('0xb')]=function(_0x3d4206,_0x5442f0){return _0x3d4206['define'](_0xb605('0xc'),attributes,{'tableName':_0xb605('0xd'),'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 298df62..c50caff 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 _0xa877=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xa877,0x1cc));var _0x7a87=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa877[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7a87('0x0'));var util=require(_0x7a87('0x1'));var moment=require('moment');var BPromise=require(_0x7a87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a87('0x3'))['db'];var utils=require(_0x7a87('0x4'));var logger=require(_0x7a87('0x5'))(_0x7a87('0x6'));var config=require(_0x7a87('0x7'));var jayson=require(_0x7a87('0x8'));var client=jayson[_0x7a87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x463ae4,_0x17c32d,_0x232c1e){return new BPromise(function(_0x22c2cf,_0x334126){return client[_0x7a87('0xa')](_0x463ae4,_0x232c1e)[_0x7a87('0xb')](function(_0x46b157){logger[_0x7a87('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17c32d,'request\x20sent');logger[_0x7a87('0xd')](_0x7a87('0xe'),_0x17c32d,'request\x20sent',JSON[_0x7a87('0xf')](_0x46b157));if(_0x46b157[_0x7a87('0x10')]){if(_0x46b157['error'][_0x7a87('0x11')]===0x1f4){logger[_0x7a87('0x10')](_0x7a87('0x12'),_0x17c32d,_0x46b157[_0x7a87('0x10')][_0x7a87('0x13')]);return _0x334126(_0x46b157[_0x7a87('0x10')][_0x7a87('0x13')]);}logger[_0x7a87('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17c32d,_0x46b157[_0x7a87('0x10')][_0x7a87('0x13')]);return _0x22c2cf(_0x46b157['error'][_0x7a87('0x13')]);}else{logger[_0x7a87('0xc')](_0x7a87('0x12'),_0x17c32d,_0x7a87('0x14'));_0x22c2cf(_0x46b157['result']['message']);}})[_0x7a87('0x15')](function(_0x3f1792){logger['error'](_0x7a87('0x12'),_0x17c32d,_0x3f1792);_0x334126(_0x3f1792);});});} \ No newline at end of file +var _0x53a2=['message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x305666,_0x42b4d7){var _0x5d3131=function(_0x44754d){while(--_0x44754d){_0x305666['push'](_0x305666['shift']());}};_0x5d3131(++_0x42b4d7);}(_0x53a2,0x9a));var _0x253a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x53a2[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x253a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x253a('0x1'));var fs=require('fs');var Redis=require(_0x253a('0x2'));var db=require(_0x253a('0x3'))['db'];var utils=require(_0x253a('0x4'));var logger=require(_0x253a('0x5'))('rpc');var config=require(_0x253a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x253a('0x7')][_0x253a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20a917,_0x5cc9bd,_0x1c633a){return new BPromise(function(_0x18e7c1,_0x347f3c){return client[_0x253a('0x9')](_0x20a917,_0x1c633a)[_0x253a('0xa')](function(_0x3c8344){logger[_0x253a('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cc9bd,'request\x20sent');logger[_0x253a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5cc9bd,_0x253a('0xd'),JSON[_0x253a('0xe')](_0x3c8344));if(_0x3c8344[_0x253a('0xf')]){if(_0x3c8344['error']['code']===0x1f4){logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x3c8344[_0x253a('0xf')][_0x253a('0x11')]);return _0x347f3c(_0x3c8344[_0x253a('0xf')][_0x253a('0x11')]);}logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x3c8344[_0x253a('0xf')]['message']);return _0x18e7c1(_0x3c8344['error'][_0x253a('0x11')]);}else{logger['info'](_0x253a('0x10'),_0x5cc9bd,_0x253a('0xd'));_0x18e7c1(_0x3c8344['result'][_0x253a('0x11')]);}})[_0x253a('0x12')](function(_0x4ba99a){logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x4ba99a);_0x347f3c(_0x4ba99a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 101c4fb..c72db96 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 _0x4849=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x1a7f32,_0x21eef0){var _0x533a71=function(_0x52c6be){while(--_0x52c6be){_0x1a7f32['push'](_0x1a7f32['shift']());}};_0x533a71(++_0x21eef0);}(_0x4849,0x86));var _0x9484=function(_0x1ab5fa,_0x74abd){_0x1ab5fa=_0x1ab5fa-0x0;var _0x5ee7f6=_0x4849[_0x1ab5fa];return _0x5ee7f6;};'use strict';var multer=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var path=require('path');var timeout=require(_0x9484('0x2'));var express=require(_0x9484('0x3'));var router=express[_0x9484('0x4')]();var fs_extra=require(_0x9484('0x5'));var auth=require(_0x9484('0x6'));var interaction=require(_0x9484('0x7'));var config=require(_0x9484('0x8'));var controller=require('./variable.controller');router[_0x9484('0x9')]('/',auth[_0x9484('0xa')](),controller['index']);router[_0x9484('0x9')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0xc')]);router[_0x9484('0xd')]('/',auth['isAuthenticated'](),controller[_0x9484('0xe')]);router[_0x9484('0xf')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller['update']);router[_0x9484('0x10')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0x11')]);module[_0x9484('0x12')]=router; \ No newline at end of file +var _0xa276=['../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x30ce,_0x17b61c){var _0x3114a0=function(_0xef3ce5){while(--_0xef3ce5){_0x30ce['push'](_0x30ce['shift']());}};_0x3114a0(++_0x17b61c);}(_0xa276,0x9a));var _0x6a27=function(_0xaa9c36,_0x4d05e5){_0xaa9c36=_0xaa9c36-0x0;var _0x5373b=_0xa276[_0xaa9c36];return _0x5373b;};'use strict';var multer=require('multer');var util=require(_0x6a27('0x0'));var path=require(_0x6a27('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a27('0x2'));var router=express[_0x6a27('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6a27('0x4'));var interaction=require(_0x6a27('0x5'));var config=require(_0x6a27('0x6'));var controller=require('./variable.controller');router[_0x6a27('0x7')]('/',auth[_0x6a27('0x8')](),controller[_0x6a27('0x9')]);router['get'](_0x6a27('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6a27('0xb')]);router[_0x6a27('0xc')](_0x6a27('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6a27('0xd')](_0x6a27('0xa'),auth[_0x6a27('0x8')](),controller[_0x6a27('0xe')]);module[_0x6a27('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index df32c44..22aeb7b 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 _0x64f5=['sequelize','STRING'];(function(_0x452209,_0x15ee11){var _0x32d028=function(_0x5a3bb5){while(--_0x5a3bb5){_0x452209['push'](_0x452209['shift']());}};_0x32d028(++_0x15ee11);}(_0x64f5,0x17e));var _0x564f=function(_0x58fabb,_0x11da4b){_0x58fabb=_0x58fabb-0x0;var _0x165e9d=_0x64f5[_0x58fabb];return _0x165e9d;};'use strict';var Sequelize=require(_0x564f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x564f('0x1')]}}; \ No newline at end of file +var _0x0bd3=['exports','STRING','sequelize'];(function(_0x568134,_0x1b286d){var _0x4bd132=function(_0x32fa50){while(--_0x32fa50){_0x568134['push'](_0x568134['shift']());}};_0x4bd132(++_0x1b286d);}(_0x0bd3,0x173));var _0x30bd=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x0bd3[_0x4bbe00];return _0x3999d2;};'use strict';var Sequelize=require(_0x30bd('0x0'));module[_0x30bd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x30bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 9341043..2a7c2b1 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 _0x4686=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','Variables','UserProfileResource','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll'];(function(_0x42e5a,_0x4f2ce8){var _0x43cb7c=function(_0x5ce4ac){while(--_0x5ce4ac){_0x42e5a['push'](_0x42e5a['shift']());}};_0x43cb7c(++_0x4f2ce8);}(_0x4686,0x106));var _0x6468=function(_0x42a206,_0x3287f3){_0x42a206=_0x42a206-0x0;var _0x33faed=_0x4686[_0x42a206];return _0x33faed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6468('0x0'));var zipdir=require(_0x6468('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6468('0x2'));var moment=require(_0x6468('0x3'));var BPromise=require(_0x6468('0x4'));var Mustache=require(_0x6468('0x5'));var util=require(_0x6468('0x6'));var path=require('path');var sox=require(_0x6468('0x7'));var csv=require(_0x6468('0x8'));var ejs=require(_0x6468('0x9'));var fs=require('fs');var fs_extra=require(_0x6468('0xa'));var _=require(_0x6468('0xb'));var squel=require(_0x6468('0xc'));var crypto=require(_0x6468('0xd'));var jsforce=require(_0x6468('0xe'));var deskjs=require(_0x6468('0xf'));var toCsv=require(_0x6468('0x8'));var querystring=require(_0x6468('0x10'));var Papa=require(_0x6468('0x11'));var Redis=require(_0x6468('0x12'));var authService=require(_0x6468('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6468('0x14'));var hardwareService=require(_0x6468('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6468('0x16'));var config=require(_0x6468('0x17'));var licenseUtil=require(_0x6468('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115501,_0x4d9150){_0x4d9150=_0x4d9150||0xcc;return function(_0x225e95){if(_0x225e95){return _0x115501[_0x6468('0x19')](_0x4d9150);}return _0x115501[_0x6468('0x1a')](_0x4d9150)[_0x6468('0x1b')]();};}function respondWithResult(_0x109019,_0x30e009){_0x30e009=_0x30e009||0xc8;return function(_0x10dab1){if(_0x10dab1){return _0x109019[_0x6468('0x1a')](_0x30e009)[_0x6468('0x1c')](_0x10dab1);}};}function respondWithFilteredResult(_0x2a5904,_0x42fb30){return function(_0x113feb){if(_0x113feb){var _0x2a8d03=typeof _0x42fb30[_0x6468('0x1d')]===_0x6468('0x1e')&&typeof _0x42fb30[_0x6468('0x1f')]===_0x6468('0x1e');var _0x32008d=_0x113feb[_0x6468('0x20')];var _0x8640b6=_0x2a8d03?0x0:_0x42fb30['offset'];var _0x3b13a1=_0x2a8d03?_0x113feb['count']:_0x42fb30['offset']+_0x42fb30[_0x6468('0x1f')];var _0x337716;if(_0x3b13a1>=_0x32008d){_0x3b13a1=_0x32008d;_0x337716=0xc8;}else{_0x337716=0xce;}_0x2a5904[_0x6468('0x1a')](_0x337716);return _0x2a5904[_0x6468('0x21')](_0x6468('0x22'),_0x8640b6+'-'+_0x3b13a1+'/'+_0x32008d)[_0x6468('0x1c')](_0x113feb);}return null;};}function patchUpdates(_0x31128a){return function(_0x1ac112){try{jsonpatch[_0x6468('0x23')](_0x1ac112,_0x31128a,!![]);}catch(_0x5bc2b4){return BPromise[_0x6468('0x24')](_0x5bc2b4);}return _0x1ac112['save']();};}function saveUpdates(_0x2a9f57,_0x3caac2){return function(_0x58d58a){if(_0x58d58a){return _0x58d58a['update'](_0x2a9f57)[_0x6468('0x25')](function(_0x16c6ee){return _0x16c6ee;});}return null;};}function removeEntity(_0x190a1c,_0x1cdb16){return function(_0x5c74e3){if(_0x5c74e3){return _0x5c74e3[_0x6468('0x26')]()[_0x6468('0x25')](function(){var _0x29afe9=_0x5c74e3['get']({'plain':!![]});var _0x1950c4=_0x6468('0x27');return db[_0x6468('0x28')][_0x6468('0x26')]({'where':{'type':_0x1950c4,'resourceId':_0x29afe9['id']}})[_0x6468('0x25')](function(){return _0x5c74e3;});})[_0x6468('0x25')](function(){_0x190a1c['status'](0xcc)[_0x6468('0x1b')]();});}};}function handleEntityNotFound(_0xdd56cb,_0x1f7eba){return function(_0x3de38e){if(!_0x3de38e){_0xdd56cb[_0x6468('0x19')](0x194);}return _0x3de38e;};}function handleError(_0xb640d9,_0x18ac13){_0x18ac13=_0x18ac13||0x1f4;return function(_0x15b5f1){logger[_0x6468('0x29')](_0x15b5f1['stack']);if(_0x15b5f1[_0x6468('0x2a')]){delete _0x15b5f1['name'];}_0xb640d9['status'](_0x18ac13)[_0x6468('0x2b')](_0x15b5f1);};}exports[_0x6468('0x2c')]=function(_0x166258,_0x45a5f2){var _0x522137={},_0x13fe01={},_0x21289b={'count':0x0,'rows':[]};var _0x4f0f02=_[_0x6468('0x2d')](db[_0x6468('0x2e')][_0x6468('0x2f')],function(_0x4c90b8){return{'name':_0x4c90b8[_0x6468('0x30')],'type':_0x4c90b8[_0x6468('0x31')][_0x6468('0x32')]};});_0x13fe01[_0x6468('0x33')]=_[_0x6468('0x2d')](_0x4f0f02,'name');_0x13fe01[_0x6468('0x34')]=_[_0x6468('0x35')](_0x166258['query']);_0x13fe01[_0x6468('0x36')]=_['intersection'](_0x13fe01[_0x6468('0x33')],_0x13fe01[_0x6468('0x34')]);_0x522137['attributes']=_[_0x6468('0x37')](_0x13fe01[_0x6468('0x33')],qs['fields'](_0x166258[_0x6468('0x34')][_0x6468('0x38')]));_0x522137[_0x6468('0x39')]=_0x522137['attributes']['length']?_0x522137[_0x6468('0x39')]:_0x13fe01[_0x6468('0x33')];if(!_0x166258['query'][_0x6468('0x3a')]('nolimit')){_0x522137[_0x6468('0x1f')]=qs['limit'](_0x166258[_0x6468('0x34')][_0x6468('0x1f')]);_0x522137['offset']=qs[_0x6468('0x1d')](_0x166258[_0x6468('0x34')][_0x6468('0x1d')]);}_0x522137[_0x6468('0x3b')]=qs[_0x6468('0x3c')](_0x166258[_0x6468('0x34')]['sort']);_0x522137[_0x6468('0x3d')]=qs[_0x6468('0x36')](_['pick'](_0x166258[_0x6468('0x34')],_0x13fe01[_0x6468('0x36')]),_0x4f0f02);if(_0x166258[_0x6468('0x34')][_0x6468('0x3e')]){_0x522137[_0x6468('0x3d')]=_[_0x6468('0x3f')](_0x522137[_0x6468('0x3d')],{'$or':_[_0x6468('0x2d')](_0x4f0f02,function(_0x5d5401){if(_0x5d5401[_0x6468('0x31')]!==_0x6468('0x40')){var _0x264b4a={};_0x264b4a[_0x5d5401['name']]={'$like':'%'+_0x166258[_0x6468('0x34')]['filter']+'%'};return _0x264b4a;}})});}_0x522137=_[_0x6468('0x3f')]({},_0x522137,_0x166258[_0x6468('0x41')]);var _0x5174f0={'where':_0x522137[_0x6468('0x3d')]};return db[_0x6468('0x2e')][_0x6468('0x20')](_0x5174f0)['then'](function(_0x2ee6ac){_0x21289b[_0x6468('0x20')]=_0x2ee6ac;if(_0x166258[_0x6468('0x34')]['includeAll']){_0x522137[_0x6468('0x42')]=[{'all':!![]}];}return db[_0x6468('0x2e')][_0x6468('0x43')](_0x522137);})['then'](function(_0x1c88e4){_0x21289b[_0x6468('0x44')]=_0x1c88e4;return _0x21289b;})['then'](respondWithFilteredResult(_0x45a5f2,_0x522137))[_0x6468('0x45')](handleError(_0x45a5f2,null));};exports[_0x6468('0x46')]=function(_0x4e8c8d,_0x412185){var _0x4cc0f1={'raw':!![],'where':{'id':_0x4e8c8d[_0x6468('0x47')]['id']}},_0x233fd2={};_0x233fd2[_0x6468('0x33')]=_['keys'](db['Variable'][_0x6468('0x2f')]);_0x233fd2[_0x6468('0x34')]=_[_0x6468('0x35')](_0x4e8c8d[_0x6468('0x34')]);_0x233fd2['filters']=_['intersection'](_0x233fd2['model'],_0x233fd2['query']);_0x4cc0f1[_0x6468('0x39')]=_['intersection'](_0x233fd2[_0x6468('0x33')],qs[_0x6468('0x38')](_0x4e8c8d[_0x6468('0x34')]['fields']));_0x4cc0f1[_0x6468('0x39')]=_0x4cc0f1['attributes'][_0x6468('0x48')]?_0x4cc0f1[_0x6468('0x39')]:_0x233fd2[_0x6468('0x33')];if(_0x4e8c8d[_0x6468('0x34')][_0x6468('0x49')]){_0x4cc0f1[_0x6468('0x42')]=[{'all':!![]}];}_0x4cc0f1=_['merge']({},_0x4cc0f1,_0x4e8c8d[_0x6468('0x41')]);return db[_0x6468('0x2e')][_0x6468('0x4a')](_0x4cc0f1)[_0x6468('0x25')](handleEntityNotFound(_0x412185,null))[_0x6468('0x25')](respondWithResult(_0x412185,null))[_0x6468('0x45')](handleError(_0x412185,null));};exports[_0x6468('0x4b')]=function(_0x3da478,_0x286719){return db[_0x6468('0x2e')][_0x6468('0x4b')](_0x3da478['body'],{})[_0x6468('0x25')](function(_0x2f8b05){var _0x169f45=_0x3da478[_0x6468('0x4c')]['get']({'plain':!![]});if(!_0x169f45)throw new Error(_0x6468('0x4d'));if(_0x169f45[_0x6468('0x4e')]===_0x6468('0x4c')){var _0x5dfce0=_0x2f8b05['get']({'plain':!![]});var _0x11b4e4='Variables';return db[_0x6468('0x4f')][_0x6468('0x4a')]({'where':{'name':_0x11b4e4,'userProfileId':_0x169f45[_0x6468('0x50')]},'raw':!![]})[_0x6468('0x25')](function(_0x19c41c){if(_0x19c41c&&_0x19c41c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5dfce0[_0x6468('0x2a')],'resourceId':_0x5dfce0['id'],'type':_0x19c41c[_0x6468('0x2a')],'sectionId':_0x19c41c['id']},{})[_0x6468('0x25')](function(){return _0x2f8b05;});}else{return _0x2f8b05;}})['catch'](function(_0x3edad2){logger[_0x6468('0x29')](_0x6468('0x51'),_0x3edad2);throw _0x3edad2;});}return _0x2f8b05;})[_0x6468('0x25')](respondWithResult(_0x286719,0xc9))[_0x6468('0x45')](handleError(_0x286719,null));};exports[_0x6468('0x52')]=function(_0x26bcf0,_0x392f4f){if(_0x26bcf0['body']['id']){delete _0x26bcf0[_0x6468('0x53')]['id'];}return db[_0x6468('0x2e')][_0x6468('0x4a')]({'where':{'id':_0x26bcf0[_0x6468('0x47')]['id']}})['then'](handleEntityNotFound(_0x392f4f,null))[_0x6468('0x25')](saveUpdates(_0x26bcf0[_0x6468('0x53')],null))[_0x6468('0x25')](respondWithResult(_0x392f4f,null))['catch'](handleError(_0x392f4f,null));};exports[_0x6468('0x26')]=function(_0x8b0e6c,_0xd7d350){return db[_0x6468('0x2e')][_0x6468('0x4a')]({'where':{'id':_0x8b0e6c[_0x6468('0x47')]['id']}})[_0x6468('0x25')](handleEntityNotFound(_0xd7d350,null))[_0x6468('0x25')](removeEntity(_0xd7d350,null))[_0x6468('0x45')](handleError(_0xd7d350,null));}; \ No newline at end of file +var _0x9851=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','get','Variables','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','Variable','includeAll','include','findAll','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x9851,0x1a3));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require(_0x1985('0x1'));var zipdir=require(_0x1985('0x2'));var jsonpatch=require(_0x1985('0x3'));var rp=require(_0x1985('0x4'));var moment=require(_0x1985('0x5'));var BPromise=require(_0x1985('0x6'));var Mustache=require(_0x1985('0x7'));var util=require(_0x1985('0x8'));var path=require('path');var sox=require(_0x1985('0x9'));var csv=require(_0x1985('0xa'));var ejs=require(_0x1985('0xb'));var fs=require('fs');var fs_extra=require(_0x1985('0xc'));var _=require(_0x1985('0xd'));var squel=require(_0x1985('0xe'));var crypto=require(_0x1985('0xf'));var jsforce=require(_0x1985('0x10'));var deskjs=require(_0x1985('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1985('0x12'));var Redis=require('ioredis');var authService=require(_0x1985('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1985('0x14'));var hardwareService=require(_0x1985('0x15'));var logger=require(_0x1985('0x16'))(_0x1985('0x17'));var utils=require(_0x1985('0x18'));var config=require(_0x1985('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad955,_0x1957cb){_0x1957cb=_0x1957cb||0xcc;return function(_0x275961){if(_0x275961){return _0x2ad955[_0x1985('0x1a')](_0x1957cb);}return _0x2ad955[_0x1985('0x1b')](_0x1957cb)[_0x1985('0x1c')]();};}function respondWithResult(_0x279bc2,_0x4f96df){_0x4f96df=_0x4f96df||0xc8;return function(_0x533e9e){if(_0x533e9e){return _0x279bc2[_0x1985('0x1b')](_0x4f96df)[_0x1985('0x1d')](_0x533e9e);}};}function respondWithFilteredResult(_0x344673,_0x2a0430){return function(_0x117e7c){if(_0x117e7c){var _0x43257e=typeof _0x2a0430[_0x1985('0x1e')]===_0x1985('0x1f')&&typeof _0x2a0430[_0x1985('0x20')]===_0x1985('0x1f');var _0x72ad49=_0x117e7c[_0x1985('0x21')];var _0x147dc7=_0x43257e?0x0:_0x2a0430['offset'];var _0x583e8e=_0x43257e?_0x117e7c[_0x1985('0x21')]:_0x2a0430['offset']+_0x2a0430[_0x1985('0x20')];var _0x19f5ec;if(_0x583e8e>=_0x72ad49){_0x583e8e=_0x72ad49;_0x19f5ec=0xc8;}else{_0x19f5ec=0xce;}_0x344673['status'](_0x19f5ec);return _0x344673[_0x1985('0x22')]('Content-Range',_0x147dc7+'-'+_0x583e8e+'/'+_0x72ad49)[_0x1985('0x1d')](_0x117e7c);}return null;};}function patchUpdates(_0x490c06){return function(_0x549d33){try{jsonpatch['apply'](_0x549d33,_0x490c06,!![]);}catch(_0x509c1b){return BPromise[_0x1985('0x23')](_0x509c1b);}return _0x549d33[_0x1985('0x24')]();};}function saveUpdates(_0x3ef6a5,_0x593807){return function(_0x5153ad){if(_0x5153ad){return _0x5153ad['update'](_0x3ef6a5)[_0x1985('0x25')](function(_0x58f3fb){return _0x58f3fb;});}return null;};}function removeEntity(_0x18fb1b,_0x18f5d6){return function(_0x4cfd38){if(_0x4cfd38){return _0x4cfd38['destroy']()[_0x1985('0x25')](function(){var _0x13dc97=_0x4cfd38[_0x1985('0x26')]({'plain':!![]});var _0x2cfe02=_0x1985('0x27');return db['UserProfileResource'][_0x1985('0x28')]({'where':{'type':_0x2cfe02,'resourceId':_0x13dc97['id']}})[_0x1985('0x25')](function(){return _0x4cfd38;});})[_0x1985('0x25')](function(){_0x18fb1b[_0x1985('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27df22,_0x26eb9b){return function(_0x5fd7de){if(!_0x5fd7de){_0x27df22[_0x1985('0x1a')](0x194);}return _0x5fd7de;};}function handleError(_0x13d8c9,_0x3eb21b){_0x3eb21b=_0x3eb21b||0x1f4;return function(_0x4b2db7){logger['error'](_0x4b2db7['stack']);if(_0x4b2db7[_0x1985('0x29')]){delete _0x4b2db7['name'];}_0x13d8c9['status'](_0x3eb21b)[_0x1985('0x2a')](_0x4b2db7);};}exports['index']=function(_0x48c531,_0x17430b){var _0x17df7d={},_0x26c464={},_0x80210d={'count':0x0,'rows':[]};var _0x30e8d3=_[_0x1985('0x2b')](db['Variable'][_0x1985('0x2c')],function(_0x2167ee){return{'name':_0x2167ee[_0x1985('0x2d')],'type':_0x2167ee[_0x1985('0x2e')][_0x1985('0x2f')]};});_0x26c464['model']=_[_0x1985('0x2b')](_0x30e8d3,_0x1985('0x29'));_0x26c464[_0x1985('0x30')]=_[_0x1985('0x31')](_0x48c531[_0x1985('0x30')]);_0x26c464[_0x1985('0x32')]=_['intersection'](_0x26c464[_0x1985('0x33')],_0x26c464[_0x1985('0x30')]);_0x17df7d[_0x1985('0x34')]=_[_0x1985('0x35')](_0x26c464[_0x1985('0x33')],qs[_0x1985('0x36')](_0x48c531['query'][_0x1985('0x36')]));_0x17df7d[_0x1985('0x34')]=_0x17df7d[_0x1985('0x34')][_0x1985('0x37')]?_0x17df7d['attributes']:_0x26c464[_0x1985('0x33')];if(!_0x48c531[_0x1985('0x30')][_0x1985('0x38')](_0x1985('0x39'))){_0x17df7d['limit']=qs['limit'](_0x48c531[_0x1985('0x30')]['limit']);_0x17df7d[_0x1985('0x1e')]=qs['offset'](_0x48c531[_0x1985('0x30')][_0x1985('0x1e')]);}_0x17df7d[_0x1985('0x3a')]=qs[_0x1985('0x3b')](_0x48c531[_0x1985('0x30')][_0x1985('0x3b')]);_0x17df7d['where']=qs[_0x1985('0x32')](_['pick'](_0x48c531[_0x1985('0x30')],_0x26c464['filters']),_0x30e8d3);if(_0x48c531[_0x1985('0x30')][_0x1985('0x3c')]){_0x17df7d[_0x1985('0x3d')]=_[_0x1985('0x3e')](_0x17df7d[_0x1985('0x3d')],{'$or':_['map'](_0x30e8d3,function(_0x5f1e5d){if(_0x5f1e5d['type']!=='VIRTUAL'){var _0x376d9f={};_0x376d9f[_0x5f1e5d['name']]={'$like':'%'+_0x48c531[_0x1985('0x30')]['filter']+'%'};return _0x376d9f;}})});}_0x17df7d=_['merge']({},_0x17df7d,_0x48c531[_0x1985('0x3f')]);var _0x217ceb={'where':_0x17df7d[_0x1985('0x3d')]};return db[_0x1985('0x40')][_0x1985('0x21')](_0x217ceb)['then'](function(_0x665e48){_0x80210d[_0x1985('0x21')]=_0x665e48;if(_0x48c531['query'][_0x1985('0x41')]){_0x17df7d[_0x1985('0x42')]=[{'all':!![]}];}return db[_0x1985('0x40')][_0x1985('0x43')](_0x17df7d);})[_0x1985('0x25')](function(_0x37ce51){_0x80210d['rows']=_0x37ce51;return _0x80210d;})[_0x1985('0x25')](respondWithFilteredResult(_0x17430b,_0x17df7d))['catch'](handleError(_0x17430b,null));};exports[_0x1985('0x44')]=function(_0x3750b8,_0x5dc081){var _0x36736d={'raw':!![],'where':{'id':_0x3750b8[_0x1985('0x45')]['id']}},_0x3c30c4={};_0x3c30c4[_0x1985('0x33')]=_[_0x1985('0x31')](db[_0x1985('0x40')][_0x1985('0x2c')]);_0x3c30c4[_0x1985('0x30')]=_['keys'](_0x3750b8[_0x1985('0x30')]);_0x3c30c4['filters']=_[_0x1985('0x35')](_0x3c30c4[_0x1985('0x33')],_0x3c30c4[_0x1985('0x30')]);_0x36736d['attributes']=_[_0x1985('0x35')](_0x3c30c4[_0x1985('0x33')],qs[_0x1985('0x36')](_0x3750b8[_0x1985('0x30')][_0x1985('0x36')]));_0x36736d['attributes']=_0x36736d['attributes'][_0x1985('0x37')]?_0x36736d[_0x1985('0x34')]:_0x3c30c4[_0x1985('0x33')];if(_0x3750b8[_0x1985('0x30')][_0x1985('0x41')]){_0x36736d[_0x1985('0x42')]=[{'all':!![]}];}_0x36736d=_[_0x1985('0x3e')]({},_0x36736d,_0x3750b8[_0x1985('0x3f')]);return db[_0x1985('0x40')]['find'](_0x36736d)['then'](handleEntityNotFound(_0x5dc081,null))['then'](respondWithResult(_0x5dc081,null))[_0x1985('0x46')](handleError(_0x5dc081,null));};exports[_0x1985('0x47')]=function(_0x5923f7,_0x4a4cd8){return db[_0x1985('0x40')][_0x1985('0x47')](_0x5923f7['body'],{})[_0x1985('0x25')](function(_0x13a542){var _0x5f0b72=_0x5923f7[_0x1985('0x48')]['get']({'plain':!![]});if(!_0x5f0b72)throw new Error(_0x1985('0x49'));if(_0x5f0b72[_0x1985('0x4a')]===_0x1985('0x48')){var _0x2a9afb=_0x13a542[_0x1985('0x26')]({'plain':!![]});var _0x5e1bcd=_0x1985('0x27');return db['UserProfileSection'][_0x1985('0x4b')]({'where':{'name':_0x5e1bcd,'userProfileId':_0x5f0b72[_0x1985('0x4c')]},'raw':!![]})['then'](function(_0x4eed89){if(_0x4eed89&&_0x4eed89[_0x1985('0x4d')]===0x0){return db[_0x1985('0x4e')]['create']({'name':_0x2a9afb[_0x1985('0x29')],'resourceId':_0x2a9afb['id'],'type':_0x4eed89['name'],'sectionId':_0x4eed89['id']},{})[_0x1985('0x25')](function(){return _0x13a542;});}else{return _0x13a542;}})[_0x1985('0x46')](function(_0x52b689){logger[_0x1985('0x4f')](_0x1985('0x50'),_0x52b689);throw _0x52b689;});}return _0x13a542;})['then'](respondWithResult(_0x4a4cd8,0xc9))[_0x1985('0x46')](handleError(_0x4a4cd8,null));};exports[_0x1985('0x51')]=function(_0x563bee,_0x4e2e33){if(_0x563bee[_0x1985('0x52')]['id']){delete _0x563bee[_0x1985('0x52')]['id'];}return db['Variable']['find']({'where':{'id':_0x563bee[_0x1985('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e2e33,null))[_0x1985('0x25')](saveUpdates(_0x563bee['body'],null))[_0x1985('0x25')](respondWithResult(_0x4e2e33,null))[_0x1985('0x46')](handleError(_0x4e2e33,null));};exports['destroy']=function(_0x296e84,_0x9d6f70){return db[_0x1985('0x40')][_0x1985('0x4b')]({'where':{'id':_0x296e84[_0x1985('0x45')]['id']}})[_0x1985('0x25')](handleEntityNotFound(_0x9d6f70,null))[_0x1985('0x25')](removeEntity(_0x9d6f70,null))[_0x1985('0x46')](handleError(_0x9d6f70,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 276410d..fee0ed9 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 _0x4871=['moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x13eb16,_0x2bc3e2){var _0x507b6a=function(_0x537a9f){while(--_0x537a9f){_0x13eb16['push'](_0x13eb16['shift']());}};_0x507b6a(++_0x2bc3e2);}(_0x4871,0x97));var _0x1487=function(_0x157b80,_0x409003){_0x157b80=_0x157b80-0x0;var _0x5ac422=_0x4871[_0x157b80];return _0x5ac422;};'use strict';var _=require(_0x1487('0x0'));var util=require('util');var logger=require(_0x1487('0x1'))(_0x1487('0x2'));var moment=require(_0x1487('0x3'));var BPromise=require(_0x1487('0x4'));var rp=require(_0x1487('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1487('0x6'));var config=require(_0x1487('0x7'));var attributes=require(_0x1487('0x8'));module['exports']=function(_0x7f77e9,_0x5ae5de){return _0x7f77e9['define'](_0x1487('0x9'),attributes,{'tableName':_0x1487('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf87d=['define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x552b9f,_0x544356){var _0x23ddef=function(_0x1249b6){while(--_0x1249b6){_0x552b9f['push'](_0x552b9f['shift']());}};_0x23ddef(++_0x544356);}(_0xf87d,0x13b));var _0xdf87=function(_0x4aef3e,_0x206580){_0x4aef3e=_0x4aef3e-0x0;var _0x596883=_0xf87d[_0x4aef3e];return _0x596883;};'use strict';var _=require(_0xdf87('0x0'));var util=require('util');var logger=require(_0xdf87('0x1'))(_0xdf87('0x2'));var moment=require(_0xdf87('0x3'));var BPromise=require(_0xdf87('0x4'));var rp=require(_0xdf87('0x5'));var fs=require('fs');var path=require(_0xdf87('0x6'));var rimraf=require(_0xdf87('0x7'));var config=require(_0xdf87('0x8'));var attributes=require(_0xdf87('0x9'));module['exports']=function(_0x5e3fac,_0x384355){return _0x5e3fac[_0xdf87('0xa')](_0xdf87('0xb'),attributes,{'tableName':_0xdf87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1559be1..90e4598 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(_0x2825ae,_0x47550e){var _0x4601fe=function(_0x5c2346){while(--_0x5c2346){_0x2825ae['push'](_0x2825ae['shift']());}};_0x4601fe(++_0x47550e);}(_0xe14b,0x93));var _0xbe14=function(_0x58ca23,_0x39ff8e){_0x58ca23=_0x58ca23-0x0;var _0x5493e5=_0xe14b[_0x58ca23];return _0x5493e5;};'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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x506238,_0x234094){var _0x5d2654=function(_0x5acda1){while(--_0x5acda1){_0x506238['push'](_0x506238['shift']());}};_0x5d2654(++_0x234094);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 370ffe3..4b6589b 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 _0x381c=['migrations','exports','express','Router','./version.controller','get','index','/fetch','canUpdate','/reset','/pull','isAuthenticated'];(function(_0x2c5918,_0x15b744){var _0x48a9bb=function(_0xfbc835){while(--_0xfbc835){_0x2c5918['push'](_0x2c5918['shift']());}};_0x48a9bb(++_0x15b744);}(_0x381c,0xb6));var _0xc381=function(_0x21d4f1,_0x1b4aaf){_0x21d4f1=_0x21d4f1-0x0;var _0x5caae9=_0x381c[_0x21d4f1];return _0x5caae9;};'use strict';var express=require(_0xc381('0x0'));var router=express[_0xc381('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc381('0x2'));router[_0xc381('0x3')]('/',controller[_0xc381('0x4')]);router[_0xc381('0x3')](_0xc381('0x5'),auth['isAuthenticated'](),auth[_0xc381('0x6')](),controller['fetch']);router[_0xc381('0x3')](_0xc381('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0xc381('0x3')](_0xc381('0x8'),auth[_0xc381('0x9')](),auth[_0xc381('0x6')](),controller['pull']);router['get']('/restart',auth[_0xc381('0x9')](),controller['restart']);router[_0xc381('0x3')]('/migrations',controller[_0xc381('0xa')]);module[_0xc381('0xb')]=router; \ No newline at end of file +var _0xaf5b=['/pull','pull','/restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x560b95,_0x46ed21){var _0x385938=function(_0x4836dc){while(--_0x4836dc){_0x560b95['push'](_0x560b95['shift']());}};_0x385938(++_0x46ed21);}(_0xaf5b,0x1c5));var _0xbaf5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaf5b[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xbaf5('0x0'));var router=express[_0xbaf5('0x1')]();var auth=require(_0xbaf5('0x2'));var controller=require(_0xbaf5('0x3'));router[_0xbaf5('0x4')]('/',controller[_0xbaf5('0x5')]);router[_0xbaf5('0x4')](_0xbaf5('0x6'),auth[_0xbaf5('0x7')](),auth[_0xbaf5('0x8')](),controller['fetch']);router[_0xbaf5('0x4')](_0xbaf5('0x9'),auth['isAuthenticated'](),auth[_0xbaf5('0x8')](),controller[_0xbaf5('0xa')]);router[_0xbaf5('0x4')](_0xbaf5('0xb'),auth[_0xbaf5('0x7')](),auth[_0xbaf5('0x8')](),controller[_0xbaf5('0xc')]);router[_0xbaf5('0x4')](_0xbaf5('0xd'),auth['isAuthenticated'](),controller['restart']);router[_0xbaf5('0x4')]('/migrations',controller[_0xbaf5('0xe')]);module[_0xbaf5('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b199783..6646831 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 _0xa26b=['pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','query','latest','2.0.0','status','json','fetch','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','migrations','length','.js','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.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash'];(function(_0x68f3de,_0x54ddac){var _0xb180ff=function(_0x4f85c1){while(--_0x4f85c1){_0x68f3de['push'](_0x68f3de['shift']());}};_0xb180ff(++_0x54ddac);}(_0xa26b,0x6c));var _0xba26=function(_0x43e206,_0xac99ac){_0x43e206=_0x43e206-0x0;var _0x31dd8c=_0xa26b[_0x43e206];return _0x31dd8c;};'use strict';var Umzug=require(_0xba26('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xba26('0x1'));var pkginfo=require(_0xba26('0x2'))(module,_0xba26('0x3'));var compareVersions=require(_0xba26('0x4'));var exec=require(_0xba26('0x5'))['exec'];var db=require(_0xba26('0x6'))['db'];var config=require(_0xba26('0x7'));var pm2=require(_0xba26('0x8'));var logger=require('../../config/logger')(_0xba26('0x9'));var git=require('simple-git')(config[_0xba26('0xa')]);exports[_0xba26('0xb')]=function(_0x964d5a,_0x44ba3c){var _0xd2bc55={'current':module[_0xba26('0xc')][_0xba26('0x3')],'phonebar':0x2};if(_0x964d5a[_0xba26('0xd')]&&_0x964d5a[_0xba26('0xd')]['latest']){return git['fetch']()['tags'](function(_0x262855,_0x3c4d5b){_0xd2bc55[_0xba26('0xe')]=(_0x262855?module[_0xba26('0xc')]['version']:_0x3c4d5b['latest'])||_0xba26('0xf');return _0x44ba3c[_0xba26('0x10')](0xc8)[_0xba26('0x11')](_0xd2bc55);});}else{return _0x44ba3c['status'](0xc8)[_0xba26('0x11')](_0xd2bc55);}};exports[_0xba26('0x12')]=function(_0x40d41a,_0x18da93){return git[_0xba26('0x12')]([_0xba26('0x13'),'master'],function(_0x1ce24e){if(_0x1ce24e){logger[_0xba26('0x14')](_0x1ce24e);return _0x18da93[_0xba26('0x10')](0x1f4)[_0xba26('0x11')](_0x1ce24e);}logger[_0xba26('0x15')](_0xba26('0x16'));return _0x18da93[_0xba26('0x10')](0xc8)[_0xba26('0x11')]({'output':_0xba26('0x17')});});};exports[_0xba26('0x18')]=function(_0x582138,_0x463bfa){return git[_0xba26('0x18')]([_0xba26('0x19'),_0xba26('0x1a')],function(_0x4923b1){if(_0x4923b1){logger[_0xba26('0x14')](_0x4923b1);return _0x463bfa[_0xba26('0x10')](0x1f4)[_0xba26('0x11')](_0x4923b1);}logger['info'](_0xba26('0x1b'));return _0x463bfa[_0xba26('0x10')](0xc8)[_0xba26('0x11')]({'output':_0xba26('0x1c')});});};exports[_0xba26('0x1d')]=function(_0x16493f,_0x2dc80f){exec(_0xba26('0x1e'),function(_0x1d24d8,_0x202803,_0x63b1c8){logger[_0xba26('0x15')](_0x202803);logger[_0xba26('0x15')](_0x63b1c8);if(_0x1d24d8){logger[_0xba26('0x14')](_0x1d24d8);return _0x2dc80f[_0xba26('0x10')](0x1f4)[_0xba26('0x11')](_0x1d24d8);}return _0x2dc80f[_0xba26('0x10')](0xc8)[_0xba26('0x11')]({'output':_0x202803});});};exports[_0xba26('0x1f')]=function(_0xe2c55d,_0x4c3c7c){return pm2['restart'](_0xba26('0x20'))[_0xba26('0x21')](function(_0x4d404b){logger[_0xba26('0x15')](_0xba26('0x22'),_0x4d404b);return _0x4c3c7c['status'](0xc8)['json']({'output':_0xba26('0x23')});})[_0xba26('0x24')](function(_0x4e3b53){logger[_0xba26('0x14')](_0x4e3b53);return _0x4c3c7c[_0xba26('0x10')](0x1f4)[_0xba26('0x11')](_0x4e3b53);});};exports['migrations']=function(_0x3b8a28,_0x4f0ff3){var _0x175c25=fs['readdirSync'](path[_0xba26('0x25')](config[_0xba26('0xa')],_0xba26('0x26'),_0xba26('0x27')));var _0x1451c2=[];for(var _0x4586e7=0x0;_0x4586e7<_0x175c25[_0xba26('0x28')];_0x4586e7++){var _0x4a22ba=_0x175c25[_0x4586e7]['replace'](_0xba26('0x29'),'');if(compareVersions(module[_0xba26('0xc')][_0xba26('0x3')],_0x4a22ba)===-0x1){_0x1451c2[_0xba26('0x2a')](_0x4a22ba);}}if(_0x1451c2[_0xba26('0x28')]){var _0x3de6f4=_0x1451c2[_0xba26('0x2b')](compareVersions);var _0x10c359=new Umzug({'storage':_0xba26('0x2c'),'storageOptions':{'model':db[_0xba26('0x2d')],'modelName':_0xba26('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0xba26('0x2c')][_0xba26('0x2e')](),db['sequelize'][_0xba26('0x2f')],function(){throw new Error(_0xba26('0x30'));}],'path':path[_0xba26('0x25')](config[_0xba26('0xa')],_0xba26('0x26'),_0xba26('0x27')),'pattern':/\.js$/}});_0x10c359['up']({'migrations':_[_0xba26('0x31')](_0x3de6f4,function(_0x41cad8){return _0x41cad8+_0xba26('0x29');})})[_0xba26('0x21')](function(){return _0x4f0ff3[_0xba26('0x10')](0xc8)[_0xba26('0x11')]({'output':_0xba26('0x32')+module[_0xba26('0xc')][_0xba26('0x3')]+_0xba26('0x33')+_[_0xba26('0x34')](_0x3de6f4),'migrations':_[_0xba26('0x25')](_0x3de6f4)});})[_0xba26('0x24')](function(_0x2b8949){if(_0x2b8949 instanceof db[_0xba26('0x2c')][_0xba26('0x35')]){return _0x4f0ff3[_0xba26('0x10')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x4f0ff3[_0xba26('0x10')](0x1f4)[_0xba26('0x11')](_0x2b8949);}});}else{return _0x4f0ff3[_0xba26('0x10')](0xc8)[_0xba26('0x11')]({'output':_0xba26('0x36')});}}; \ No newline at end of file +var _0xa04e=['migrations','readdirSync','join','server','length','replace','push','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa04e,0x10f));var _0xea04=function(_0x38a426,_0x25094e){_0x38a426=_0x38a426-0x0;var _0xf507e8=_0xa04e[_0x38a426];return _0xf507e8;};'use strict';var Umzug=require(_0xea04('0x0'));var path=require(_0xea04('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xea04('0x2'))(module,_0xea04('0x3'));var compareVersions=require(_0xea04('0x4'));var exec=require(_0xea04('0x5'))[_0xea04('0x6')];var db=require(_0xea04('0x7'))['db'];var config=require(_0xea04('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xea04('0x9'))('update');var git=require(_0xea04('0xa'))(config[_0xea04('0xb')]);exports['index']=function(_0x171462,_0x251535){var _0x30167e={'current':module[_0xea04('0xc')][_0xea04('0x3')],'phonebar':0x2};if(_0x171462[_0xea04('0xd')]&&_0x171462[_0xea04('0xd')][_0xea04('0xe')]){return git[_0xea04('0xf')]()[_0xea04('0x10')](function(_0x119545,_0x3ae39a){_0x30167e[_0xea04('0xe')]=(_0x119545?module[_0xea04('0xc')][_0xea04('0x3')]:_0x3ae39a['latest'])||_0xea04('0x11');return _0x251535['status'](0xc8)[_0xea04('0x12')](_0x30167e);});}else{return _0x251535[_0xea04('0x13')](0xc8)[_0xea04('0x12')](_0x30167e);}};exports['fetch']=function(_0xbe4f56,_0x291418){return git[_0xea04('0xf')]([_0xea04('0x14'),_0xea04('0x15')],function(_0x450de1){if(_0x450de1){logger[_0xea04('0x16')](_0x450de1);return _0x291418['status'](0x1f4)['json'](_0x450de1);}logger[_0xea04('0x17')]('git\x20fetch');return _0x291418[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x18')});});};exports['reset']=function(_0xd6db6a,_0x5f07e9){return git[_0xea04('0x19')]([_0xea04('0x1a'),'FETCH_HEAD'],function(_0x5353b9){if(_0x5353b9){logger[_0xea04('0x16')](_0x5353b9);return _0x5f07e9[_0xea04('0x13')](0x1f4)[_0xea04('0x12')](_0x5353b9);}logger[_0xea04('0x17')](_0xea04('0x1b'));return _0x5f07e9[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x1c')});});};exports['pull']=function(_0x596d25,_0x37f8f2){exec('npm\x20install\x20--production',function(_0xfa655d,_0x3f9c57,_0x5d90c5){logger[_0xea04('0x17')](_0x3f9c57);logger[_0xea04('0x17')](_0x5d90c5);if(_0xfa655d){logger[_0xea04('0x16')](_0xfa655d);return _0x37f8f2[_0xea04('0x13')](0x1f4)['json'](_0xfa655d);}return _0x37f8f2[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0x3f9c57});});};exports[_0xea04('0x1d')]=function(_0x5f0bd7,_0x232f65){return pm2[_0xea04('0x1d')](_0xea04('0x1e'))[_0xea04('0x1f')](function(_0x583b5f){logger[_0xea04('0x17')](_0xea04('0x20'),_0x583b5f);return _0x232f65['status'](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x21')});})[_0xea04('0x22')](function(_0x30ee05){logger[_0xea04('0x16')](_0x30ee05);return _0x232f65[_0xea04('0x13')](0x1f4)['json'](_0x30ee05);});};exports[_0xea04('0x23')]=function(_0x1ac468,_0x183fb8){var _0x351e1a=fs[_0xea04('0x24')](path[_0xea04('0x25')](config[_0xea04('0xb')],_0xea04('0x26'),'migrations'));var _0x31c3=[];for(var _0x126c2e=0x0;_0x126c2e<_0x351e1a[_0xea04('0x27')];_0x126c2e++){var _0x577881=_0x351e1a[_0x126c2e][_0xea04('0x28')]('.js','');if(compareVersions(module[_0xea04('0xc')][_0xea04('0x3')],_0x577881)===-0x1){_0x31c3[_0xea04('0x29')](_0x577881);}}if(_0x31c3['length']){var _0x56bc1b=_0x31c3['sort'](compareVersions);var _0x286a0b=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xea04('0x2a'),'columnName':_0xea04('0x3')},'migrations':{'params':[db[_0xea04('0x2b')]['getQueryInterface'](),db['sequelize'][_0xea04('0x2c')],function(){throw new Error(_0xea04('0x2d'));}],'path':path[_0xea04('0x25')](config[_0xea04('0xb')],_0xea04('0x26'),_0xea04('0x23')),'pattern':/\.js$/}});_0x286a0b['up']({'migrations':_['map'](_0x56bc1b,function(_0x196fd4){return _0x196fd4+'.js';})})['then'](function(){return _0x183fb8[_0xea04('0x13')](0xc8)['json']({'output':_0xea04('0x2e')+module[_0xea04('0xc')][_0xea04('0x3')]+_0xea04('0x2f')+_[_0xea04('0x30')](_0x56bc1b),'migrations':_[_0xea04('0x25')](_0x56bc1b)});})[_0xea04('0x22')](function(_0x17efef){if(_0x17efef instanceof db[_0xea04('0x2b')][_0xea04('0x31')]){return _0x183fb8[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x32')});}else{return _0x183fb8['status'](0x1f4)['json'](_0x17efef);}});}else{return _0x183fb8[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 663d038..aae5aa3 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 _0xdcd1=['index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5a3707,_0x3fdff4){var _0x36afc1=function(_0x309852){while(--_0x309852){_0x5a3707['push'](_0x5a3707['shift']());}};_0x36afc1(++_0x3fdff4);}(_0xdcd1,0x16b));var _0x1dcd=function(_0x59518b,_0x31d79f){_0x59518b=_0x59518b-0x0;var _0x22245a=_0xdcd1[_0x59518b];return _0x22245a;};'use strict';var multer=require(_0x1dcd('0x0'));var util=require('util');var path=require(_0x1dcd('0x1'));var timeout=require(_0x1dcd('0x2'));var express=require(_0x1dcd('0x3'));var router=express[_0x1dcd('0x4')]();var fs_extra=require(_0x1dcd('0x5'));var auth=require(_0x1dcd('0x6'));var interaction=require(_0x1dcd('0x7'));var config=require(_0x1dcd('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x1dcd('0x9')]('/',auth[_0x1dcd('0xa')](),controller[_0x1dcd('0xb')]);router['get'](_0x1dcd('0xc'),auth[_0x1dcd('0xa')](),controller[_0x1dcd('0xd')]);router[_0x1dcd('0x9')](_0x1dcd('0xe'),auth['isAuthenticated'](),controller[_0x1dcd('0xf')]);router[_0x1dcd('0x10')]('/',auth[_0x1dcd('0xa')](),controller[_0x1dcd('0x11')]);router[_0x1dcd('0x12')]('/:id',auth[_0x1dcd('0xa')](),controller[_0x1dcd('0x13')]);router[_0x1dcd('0x14')](_0x1dcd('0xe'),auth[_0x1dcd('0xa')](),controller['destroy']);module[_0x1dcd('0x15')]=router; \ No newline at end of file +var _0x71ef=['express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4e6eea,_0xd3018d){var _0x1d5e23=function(_0x2e31e1){while(--_0x2e31e1){_0x4e6eea['push'](_0x4e6eea['shift']());}};_0x1d5e23(++_0xd3018d);}(_0x71ef,0x100));var _0xf71e=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x71ef[_0x384231];return _0x2480bf;};'use strict';var multer=require(_0xf71e('0x0'));var util=require(_0xf71e('0x1'));var path=require(_0xf71e('0x2'));var timeout=require(_0xf71e('0x3'));var express=require(_0xf71e('0x4'));var router=express[_0xf71e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf71e('0x6'));var config=require(_0xf71e('0x7'));var controller=require(_0xf71e('0x8'));router[_0xf71e('0x9')]('/',auth[_0xf71e('0xa')](),controller[_0xf71e('0xb')]);router[_0xf71e('0x9')]('/describe',auth[_0xf71e('0xa')](),controller['describe']);router[_0xf71e('0x9')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0xd')]);router[_0xf71e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf71e('0xf')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0x10')]);router[_0xf71e('0x11')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0x12')]);module[_0xf71e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c85b87d..07b0208 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 _0xa866=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x496cb1,_0x5abaf5){var _0x4de2f0=function(_0x5c27a9){while(--_0x5c27a9){_0x496cb1['push'](_0x496cb1['shift']());}};_0x4de2f0(++_0x5abaf5);}(_0xa866,0x6a));var _0x6a86=function(_0x1e05e8,_0x24ff01){_0x1e05e8=_0x1e05e8-0x0;var _0x488905=_0xa866[_0x1e05e8];return _0x488905;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'type':{'type':Sequelize[_0x6a86('0x2')]},'uniqueid':{'type':Sequelize[_0x6a86('0x2')]},'calleridnum':{'type':Sequelize[_0x6a86('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6a86('0x2')]},'interface':{'type':Sequelize[_0x6a86('0x2')]},'membername':{'type':Sequelize[_0x6a86('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6a86('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6a86('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6a86('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6a86('0x4')]},'agentcomplete':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6a86('0x4')]},'agentacw':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a86('0x4')]},'reason':{'type':Sequelize[_0x6a86('0x2')]},'lastevent':{'type':Sequelize[_0x6a86('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6a86('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6a86('0x2')]},'accountcode':{'type':Sequelize[_0x6a86('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6a86('0x2')]},'destchannel':{'type':Sequelize[_0x6a86('0x2')]},'destchannelstate':{'type':Sequelize[_0x6a86('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridname':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6a86('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6a86('0x2')]},'destcontext':{'type':Sequelize[_0x6a86('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6a86('0x2')]},'destuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6a86('0x2')]},'transfer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a86('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6a86('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2272,0xd8));var _0x2227=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2272[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'type':{'type':Sequelize[_0x2227('0x2')]},'uniqueid':{'type':Sequelize[_0x2227('0x2')]},'calleridnum':{'type':Sequelize[_0x2227('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2227('0x2')]},'interface':{'type':Sequelize[_0x2227('0x2')]},'membername':{'type':Sequelize[_0x2227('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2227('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2227('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2227('0x3')]},'holdtime':{'type':Sequelize[_0x2227('0x4')]},'agentcomplete':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2227('0x4')]},'agentacw':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2227('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2227('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2227('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2227('0x2')]},'connectedlinename':{'type':Sequelize[_0x2227('0x2')]},'language':{'type':Sequelize[_0x2227('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2227('0x2')]},'exten':{'type':Sequelize[_0x2227('0x2')]},'priority':{'type':Sequelize[_0x2227('0x2')]},'destchannel':{'type':Sequelize[_0x2227('0x2')]},'destchannelstate':{'type':Sequelize[_0x2227('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2227('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2227('0x2')]},'destcontext':{'type':Sequelize[_0x2227('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2227('0x2')]},'destuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2227('0x2')]},'transfer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2227('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2227('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2227('0x2')]},'agententerreason':{'type':Sequelize[_0x2227('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index c8d0622..de9b874 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(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 0a1343a..7d00cd4 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 _0x16a6=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','api'];(function(_0x5b7c5f,_0x22c407){var _0x560648=function(_0x4fb123){while(--_0x4fb123){_0x5b7c5f['push'](_0x5b7c5f['shift']());}};_0x560648(++_0x22c407);}(_0x16a6,0x15c));var _0x616a=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x16a6[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require('../../config/logger')(_0x616a('0x2'));var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require(_0x616a('0x5'));var fs=require('fs');var path=require(_0x616a('0x6'));var rimraf=require(_0x616a('0x7'));var config=require('../../config/environment');var attributes=require(_0x616a('0x8'));module[_0x616a('0x9')]=function(_0x4c1641,_0x56eaab){return _0x4c1641[_0x616a('0xa')](_0x616a('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x616a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc59=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4f41f4,_0x3c1c9b){var _0x3bb311=function(_0x29fe4e){while(--_0x29fe4e){_0x4f41f4['push'](_0x4f41f4['shift']());}};_0x3bb311(++_0x3c1c9b);}(_0xdc59,0x12c));var _0x9dc5=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xdc59[_0xd09668];return _0x68726;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9dc5('0x3'));var rp=require(_0x9dc5('0x4'));var fs=require('fs');var path=require(_0x9dc5('0x5'));var rimraf=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var attributes=require(_0x9dc5('0x8'));module[_0x9dc5('0x9')]=function(_0xf17598,_0x13e31c){return _0xf17598['define'](_0x9dc5('0xa'),attributes,{'tableName':_0x9dc5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9dc5('0xc'),_0x9dc5('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 6f16854..4f3a7bb 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 _0x1b52=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4eda22,_0x3d2db4){var _0x4a5706=function(_0x4345e3){while(--_0x4345e3){_0x4eda22['push'](_0x4eda22['shift']());}};_0x4a5706(++_0x3d2db4);}(_0x1b52,0x1be));var _0x21b5=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x1b52[_0x36f47c];return _0x296c55;};'use strict';var _=require('lodash');var util=require(_0x21b5('0x0'));var moment=require(_0x21b5('0x1'));var BPromise=require(_0x21b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21b5('0x3'));var db=require(_0x21b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x21b5('0x5'))(_0x21b5('0x6'));var config=require(_0x21b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x21b5('0x8')][_0x21b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb576,_0x149e01,_0x8e73e8){return new BPromise(function(_0x1e81e,_0xe2521d){return client[_0x21b5('0xa')](_0x1cb576,_0x8e73e8)[_0x21b5('0xb')](function(_0x296433){logger[_0x21b5('0xc')](_0x21b5('0xd'),_0x149e01,_0x21b5('0xe'));logger[_0x21b5('0xf')](_0x21b5('0x10'),_0x149e01,_0x21b5('0xe'),JSON[_0x21b5('0x11')](_0x296433));if(_0x296433[_0x21b5('0x12')]){if(_0x296433[_0x21b5('0x12')][_0x21b5('0x13')]===0x1f4){logger['error'](_0x21b5('0xd'),_0x149e01,_0x296433[_0x21b5('0x12')]['message']);return _0xe2521d(_0x296433[_0x21b5('0x12')][_0x21b5('0x14')]);}logger[_0x21b5('0x12')](_0x21b5('0xd'),_0x149e01,_0x296433[_0x21b5('0x12')][_0x21b5('0x14')]);return _0x1e81e(_0x296433[_0x21b5('0x12')][_0x21b5('0x14')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x149e01,_0x21b5('0xe'));_0x1e81e(_0x296433[_0x21b5('0x15')][_0x21b5('0x14')]);}})[_0x21b5('0x16')](function(_0x4ad1c4){logger[_0x21b5('0x12')](_0x21b5('0xd'),_0x149e01,_0x4ad1c4);_0xe2521d(_0x4ad1c4);});});}exports[_0x21b5('0x17')]=function(_0x578a9f){var _0x48554d=this;return new Promise(function(_0x41a73f,_0x199404){return db[_0x21b5('0x18')][_0x21b5('0x19')](_0x578a9f[_0x21b5('0x1a')],{'raw':_0x578a9f[_0x21b5('0x1b')]?_0x578a9f[_0x21b5('0x1b')][_0x21b5('0x1c')]===undefined?!![]:![]:!![]})[_0x21b5('0xb')](function(_0x44d906){logger[_0x21b5('0xc')](_0x21b5('0x17'),_0x578a9f);logger[_0x21b5('0xf')](_0x21b5('0x17'),_0x578a9f,JSON[_0x21b5('0x11')](_0x44d906));_0x41a73f(_0x44d906);})[_0x21b5('0x16')](function(_0x1a4a9e){logger[_0x21b5('0x12')](_0x21b5('0x17'),_0x1a4a9e[_0x21b5('0x14')],_0x578a9f);_0x199404(_0x48554d[_0x21b5('0x12')](0x1f4,_0x1a4a9e[_0x21b5('0x14')]));});});};exports[_0x21b5('0x1d')]=function(_0x11b0b6){var _0xd44a5c=this;return new Promise(function(_0x2adcf8,_0x2dcaa1){return db[_0x21b5('0x18')][_0x21b5('0x1e')](_0x11b0b6[_0x21b5('0x1a')],{'raw':_0x11b0b6['options']?_0x11b0b6[_0x21b5('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11b0b6['options']?_0x11b0b6['options'][_0x21b5('0x1f')]||null:null,'attributes':_0x11b0b6['options']?_0x11b0b6[_0x21b5('0x1b')]['attributes']||null:null,'limit':_0x11b0b6[_0x21b5('0x1b')]?_0x11b0b6[_0x21b5('0x1b')][_0x21b5('0x20')]||null:null})['then'](function(_0x3cc9d8){logger['info']('UpdateVoiceAgentReport',_0x11b0b6);logger[_0x21b5('0xf')]('UpdateVoiceAgentReport',_0x11b0b6,JSON[_0x21b5('0x11')](_0x3cc9d8));_0x2adcf8(_0x3cc9d8);})[_0x21b5('0x16')](function(_0xac4e42){logger[_0x21b5('0x12')](_0x21b5('0x1d'),_0xac4e42[_0x21b5('0x14')],_0x11b0b6);_0x2dcaa1(_0xd44a5c['error'](0x1f4,_0xac4e42[_0x21b5('0x14')]));});});}; \ No newline at end of file +var _0xba16=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x56090c,_0x3a6133){var _0x11b44d=function(_0x1114f2){while(--_0x1114f2){_0x56090c['push'](_0x56090c['shift']());}};_0x11b44d(++_0x3a6133);}(_0xba16,0x1e9));var _0x6ba1=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0xba16[_0x24ae03];return _0x38a29e;};'use strict';var _=require(_0x6ba1('0x0'));var util=require(_0x6ba1('0x1'));var moment=require(_0x6ba1('0x2'));var BPromise=require(_0x6ba1('0x3'));var rs=require(_0x6ba1('0x4'));var fs=require('fs');var Redis=require(_0x6ba1('0x5'));var db=require(_0x6ba1('0x6'))['db'];var utils=require(_0x6ba1('0x7'));var logger=require(_0x6ba1('0x8'))(_0x6ba1('0x9'));var config=require(_0x6ba1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ba1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e72f4,_0x5f5c0b,_0x2f2131){return new BPromise(function(_0x4b7943,_0x2030e9){return client[_0x6ba1('0xc')](_0x1e72f4,_0x2f2131)[_0x6ba1('0xd')](function(_0x27caa9){logger[_0x6ba1('0xe')](_0x6ba1('0xf'),_0x5f5c0b,_0x6ba1('0x10'));logger[_0x6ba1('0x11')](_0x6ba1('0x12'),_0x5f5c0b,_0x6ba1('0x10'),JSON['stringify'](_0x27caa9));if(_0x27caa9['error']){if(_0x27caa9[_0x6ba1('0x13')][_0x6ba1('0x14')]===0x1f4){logger[_0x6ba1('0x13')](_0x6ba1('0xf'),_0x5f5c0b,_0x27caa9[_0x6ba1('0x13')]['message']);return _0x2030e9(_0x27caa9[_0x6ba1('0x13')][_0x6ba1('0x15')]);}logger[_0x6ba1('0x13')](_0x6ba1('0xf'),_0x5f5c0b,_0x27caa9['error']['message']);return _0x4b7943(_0x27caa9[_0x6ba1('0x13')]['message']);}else{logger[_0x6ba1('0xe')](_0x6ba1('0xf'),_0x5f5c0b,_0x6ba1('0x10'));_0x4b7943(_0x27caa9['result'][_0x6ba1('0x15')]);}})[_0x6ba1('0x16')](function(_0x3cda77){logger['error'](_0x6ba1('0xf'),_0x5f5c0b,_0x3cda77);_0x2030e9(_0x3cda77);});});}exports[_0x6ba1('0x17')]=function(_0x11abde){var _0xea2c57=this;return new Promise(function(_0x1c7c1f,_0x10a012){return db[_0x6ba1('0x18')][_0x6ba1('0x19')](_0x11abde['body'],{'raw':_0x11abde[_0x6ba1('0x1a')]?_0x11abde['options'][_0x6ba1('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x286453){logger[_0x6ba1('0xe')](_0x6ba1('0x17'),_0x11abde);logger[_0x6ba1('0x11')](_0x6ba1('0x17'),_0x11abde,JSON[_0x6ba1('0x1c')](_0x286453));_0x1c7c1f(_0x286453);})[_0x6ba1('0x16')](function(_0xada5f8){logger[_0x6ba1('0x13')](_0x6ba1('0x17'),_0xada5f8['message'],_0x11abde);_0x10a012(_0xea2c57['error'](0x1f4,_0xada5f8['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x1c1447){var _0xcd20b8=this;return new Promise(function(_0xdadd33,_0xb1efe7){return db['VoiceAgentReport'][_0x6ba1('0x1d')](_0x1c1447['body'],{'raw':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447['options']['where']||null:null,'attributes':_0x1c1447['options']?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1e')]||null:null,'limit':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1f')]||null:null})[_0x6ba1('0xd')](function(_0x4649b9){logger[_0x6ba1('0xe')]('UpdateVoiceAgentReport',_0x1c1447);logger[_0x6ba1('0x11')](_0x6ba1('0x20'),_0x1c1447,JSON[_0x6ba1('0x1c')](_0x4649b9));_0xdadd33(_0x4649b9);})['catch'](function(_0x4c27e5){logger[_0x6ba1('0x13')](_0x6ba1('0x20'),_0x4c27e5[_0x6ba1('0x15')],_0x1c1447);_0xb1efe7(_0xcd20b8[_0x6ba1('0x13')](0x1f4,_0x4c27e5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e123020..0b6f01c 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 _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x5d570b,_0x2f7b1d){var _0x307749=function(_0x3700ba){while(--_0x3700ba){_0x5d570b['push'](_0x5d570b['shift']());}};_0x307749(++_0x2f7b1d);}(_0xe14b,0x93));var _0xbe14=function(_0xc35af1,_0x136846){_0xc35af1=_0xc35af1-0x0;var _0x3ce39b=_0xe14b[_0xc35af1];return _0x3ce39b;};'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('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file +var _0x56a4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0xd75a57,_0x4d8223){var _0x4b1560=function(_0x5ca42){while(--_0x5ca42){_0xd75a57['push'](_0xd75a57['shift']());}};_0x4b1560(++_0x4d8223);}(_0x56a4,0x11b));var _0x456a=function(_0xe06071,_0x4eeaa1){_0xe06071=_0xe06071-0x0;var _0x8ad8be=_0x56a4[_0xe06071];return _0x8ad8be;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/describe',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0x8')]('/:id',auth[_0x456a('0xa')](),controller['show']);router[_0x456a('0xc')]('/',auth[_0x456a('0xa')](),controller[_0x456a('0xd')]);router[_0x456a('0xe')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x10')]);router[_0x456a('0x11')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 600810e..77f9d11 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 _0x26f9=['ENUM','outbound','inbound-fax','dialer','STRING','DATE','INTEGER','sequelize','exports'];(function(_0x1ac5d9,_0x162c61){var _0x5d2660=function(_0x3dce51){while(--_0x3dce51){_0x1ac5d9['push'](_0x1ac5d9['shift']());}};_0x5d2660(++_0x162c61);}(_0x26f9,0x16f));var _0x926f=function(_0x2a2766,_0x475265){_0x2a2766=_0x2a2766-0x0;var _0x30a56c=_0x26f9[_0x2a2766];return _0x30a56c;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x926f('0x2')]('inbound','internal',_0x926f('0x3'),_0x926f('0x4'),'outbound-fax',_0x926f('0x5'))},'tag':{'type':Sequelize[_0x926f('0x6')]},'accountcode':{'type':Sequelize[_0x926f('0x6')]},'source':{'type':Sequelize[_0x926f('0x6')]},'destination':{'type':Sequelize[_0x926f('0x6')]},'destinationcontext':{'type':Sequelize[_0x926f('0x6')]},'callerid':{'type':Sequelize[_0x926f('0x6')]},'channel':{'type':Sequelize[_0x926f('0x6')]},'destinationchannel':{'type':Sequelize[_0x926f('0x6')]},'lastapplication':{'type':Sequelize[_0x926f('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x926f('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x926f('0x7')]},'endtime':{'type':Sequelize[_0x926f('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x926f('0x8')]},'mohtime':{'type':Sequelize[_0x926f('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x926f('0x6')]},'amaflags':{'type':Sequelize[_0x926f('0x6')]},'userfield':{'type':Sequelize[_0x926f('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x926f('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x926f('0x6')]},'note':{'type':Sequelize[_0x926f('0x6')]},'prefix':{'type':Sequelize[_0x926f('0x6')]},'routeid':{'type':Sequelize[_0x926f('0x8')]},'sipcallid':{'type':Sequelize[_0x926f('0x6')]}}; \ No newline at end of file +var _0x2c91=['dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x22c326,_0x30cde5){var _0x4bcfcd=function(_0x5ac260){while(--_0x5ac260){_0x22c326['push'](_0x22c326['shift']());}};_0x4bcfcd(++_0x30cde5);}(_0x2c91,0x158));var _0x12c9=function(_0x49cd08,_0x5109a6){_0x49cd08=_0x49cd08-0x0;var _0x17c64c=_0x2c91[_0x49cd08];return _0x17c64c;};'use strict';var Sequelize=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'uniqueid':{'type':Sequelize[_0x12c9('0x2')]},'type':{'type':Sequelize[_0x12c9('0x3')](_0x12c9('0x4'),_0x12c9('0x5'),_0x12c9('0x6'),_0x12c9('0x7'),'outbound-fax',_0x12c9('0x8'))},'tag':{'type':Sequelize[_0x12c9('0x2')]},'accountcode':{'type':Sequelize[_0x12c9('0x2')]},'source':{'type':Sequelize[_0x12c9('0x2')]},'destination':{'type':Sequelize[_0x12c9('0x2')]},'destinationcontext':{'type':Sequelize[_0x12c9('0x2')]},'callerid':{'type':Sequelize[_0x12c9('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x12c9('0x2')]},'lastapplication':{'type':Sequelize[_0x12c9('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x12c9('0x9')]},'systemanswertime':{'type':Sequelize[_0x12c9('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x12c9('0x9')]},'duration':{'type':Sequelize[_0x12c9('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x12c9('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x12c9('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x12c9('0x2')]},'userDisposition':{'type':Sequelize[_0x12c9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x12c9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x12c9('0x2')]},'note':{'type':Sequelize[_0x12c9('0x2')]},'prefix':{'type':Sequelize[_0x12c9('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x12c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6577960..2ba4ac6 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x225559,_0x10a9b2){var _0x326d09=function(_0xce7dfd){while(--_0xce7dfd){_0x225559['push'](_0x225559['shift']());}};_0x326d09(++_0x10a9b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xb10b[_0x43a1b8];return _0x324ecc;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +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(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x2ef3,0xba));var _0x32ef=function(_0x240a7e,_0x168e6e){_0x240a7e=_0x240a7e-0x0;var _0x5e6b9d=_0x2ef3[_0x240a7e];return _0x5e6b9d;};'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 013fc0e..36f23fe 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 _0xc324=['bluebird','request-promise','path','./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1bf2f2,_0x1d58dc){var _0x3261b7=function(_0x3850b4){while(--_0x3850b4){_0x1bf2f2['push'](_0x1bf2f2['shift']());}};_0x3261b7(++_0x1d58dc);}(_0xc324,0x67));var _0x4c32=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc324[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4c32('0x0'));var util=require(_0x4c32('0x1'));var logger=require(_0x4c32('0x2'))(_0x4c32('0x3'));var moment=require(_0x4c32('0x4'));var BPromise=require(_0x4c32('0x5'));var rp=require(_0x4c32('0x6'));var fs=require('fs');var path=require(_0x4c32('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c32('0x8'));module[_0x4c32('0x9')]=function(_0x2b0506,_0x5143c){return _0x2b0506[_0x4c32('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4c32('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09f0=['./voiceCallReport.attributes','exports','VoiceCallReport','report_call','util','moment','bluebird','path','../../config/environment'];(function(_0x598ee8,_0x2faf97){var _0x326800=function(_0x2d01bc){while(--_0x2d01bc){_0x598ee8['push'](_0x598ee8['shift']());}};_0x326800(++_0x2faf97);}(_0x09f0,0x79));var _0x009f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x009f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x009f('0x1'));var BPromise=require(_0x009f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x009f('0x3'));var rimraf=require('rimraf');var config=require(_0x009f('0x4'));var attributes=require(_0x009f('0x5'));module[_0x009f('0x6')]=function(_0x2ff875,_0x46eef7){return _0x2ff875['define'](_0x009f('0x7'),attributes,{'tableName':_0x009f('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d567209..a4610bc 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 _0x4573=['../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4573,0x12a));var _0x3457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3457('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3457('0x1'));var fs=require('fs');var Redis=require(_0x3457('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3457('0x3'));var logger=require(_0x3457('0x4'))(_0x3457('0x5'));var config=require(_0x3457('0x6'));var jayson=require(_0x3457('0x7'));var client=jayson[_0x3457('0x8')][_0x3457('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x166f8c,_0x1c4c1e,_0x29274a){return new BPromise(function(_0x4b9e6c,_0x441282){return client[_0x3457('0xa')](_0x166f8c,_0x29274a)['then'](function(_0x53258a){logger[_0x3457('0xb')](_0x3457('0xc'),_0x1c4c1e,_0x3457('0xd'));logger[_0x3457('0xe')](_0x3457('0xf'),_0x1c4c1e,_0x3457('0xd'),JSON[_0x3457('0x10')](_0x53258a));if(_0x53258a['error']){if(_0x53258a[_0x3457('0x11')][_0x3457('0x12')]===0x1f4){logger[_0x3457('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1c4c1e,_0x53258a[_0x3457('0x11')][_0x3457('0x13')]);return _0x441282(_0x53258a[_0x3457('0x11')][_0x3457('0x13')]);}logger[_0x3457('0x11')](_0x3457('0xc'),_0x1c4c1e,_0x53258a[_0x3457('0x11')][_0x3457('0x13')]);return _0x4b9e6c(_0x53258a[_0x3457('0x11')][_0x3457('0x13')]);}else{logger['info'](_0x3457('0xc'),_0x1c4c1e,'request\x20sent');_0x4b9e6c(_0x53258a[_0x3457('0x14')][_0x3457('0x13')]);}})[_0x3457('0x15')](function(_0x388629){logger['error'](_0x3457('0xc'),_0x1c4c1e,_0x388629);_0x441282(_0x388629);});});}exports[_0x3457('0x16')]=function(_0x3656b5){var _0x16be6d=this;return new Promise(function(_0x4d19c8,_0x27fbb6){return db[_0x3457('0x17')]['findAll']({'raw':_0x3656b5[_0x3457('0x18')]?_0x3656b5[_0x3457('0x18')][_0x3457('0x19')]===undefined?!![]:![]:!![],'where':_0x3656b5[_0x3457('0x18')]?_0x3656b5[_0x3457('0x18')][_0x3457('0x1a')]||null:null,'attributes':_0x3656b5[_0x3457('0x18')]?_0x3656b5[_0x3457('0x18')][_0x3457('0x1b')]||null:null,'limit':_0x3656b5[_0x3457('0x18')]?_0x3656b5[_0x3457('0x18')][_0x3457('0x1c')]||null:null,'include':_0x3656b5[_0x3457('0x18')]?_0x3656b5[_0x3457('0x18')][_0x3457('0x1d')]?_[_0x3457('0x1e')](_0x3656b5['options']['include'],function(_0x360446){return{'model':db[_0x360446['model']],'as':_0x360446['as'],'attributes':_0x360446['attributes'],'include':_0x360446[_0x3457('0x1d')]?_[_0x3457('0x1e')](_0x360446[_0x3457('0x1d')],function(_0x15cbe2){return{'model':db[_0x15cbe2[_0x3457('0x1f')]],'as':_0x15cbe2['as'],'attributes':_0x15cbe2['attributes'],'include':_0x15cbe2[_0x3457('0x1d')]?_[_0x3457('0x1e')](_0x15cbe2[_0x3457('0x1d')],function(_0x2f46da){return{'model':db[_0x2f46da[_0x3457('0x1f')]],'as':_0x2f46da['as'],'attributes':_0x2f46da[_0x3457('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3457('0x20')](function(_0x38c3ba){logger[_0x3457('0xb')](_0x3457('0x16'),_0x3656b5);logger[_0x3457('0xe')](_0x3457('0x16'),_0x3656b5,JSON[_0x3457('0x10')](_0x38c3ba));_0x4d19c8(_0x38c3ba);})['catch'](function(_0x26c635){logger[_0x3457('0x11')](_0x3457('0x16'),_0x26c635[_0x3457('0x13')],_0x3656b5);_0x27fbb6(_0x16be6d[_0x3457('0x11')](0x1f4,_0x26c635[_0x3457('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x58e375){var _0x5d666e=this;return new Promise(function(_0x267798,_0x43a279){return db['VoiceCallReport'][_0x3457('0x21')](_0x58e375[_0x3457('0x22')],{'raw':_0x58e375[_0x3457('0x18')]?_0x58e375[_0x3457('0x18')][_0x3457('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x390343){logger[_0x3457('0xb')](_0x3457('0x23'),_0x58e375);logger[_0x3457('0xe')](_0x3457('0x23'),_0x58e375,JSON[_0x3457('0x10')](_0x390343));_0x267798(_0x390343);})[_0x3457('0x15')](function(_0x38d407){logger[_0x3457('0x11')](_0x3457('0x23'),_0x38d407[_0x3457('0x13')],_0x58e375);_0x43a279(_0x5d666e[_0x3457('0x11')](0x1f4,_0x38d407[_0x3457('0x13')]));});});};exports[_0x3457('0x24')]=function(_0x33f5f8){var _0x4f6ff4=this;return new Promise(function(_0x3a4a01,_0x33e5ae){return db[_0x3457('0x17')][_0x3457('0x25')](_0x33f5f8['body'],{'raw':_0x33f5f8[_0x3457('0x18')]?_0x33f5f8[_0x3457('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33f5f8[_0x3457('0x18')]?_0x33f5f8[_0x3457('0x18')][_0x3457('0x1a')]||null:null,'attributes':_0x33f5f8[_0x3457('0x18')]?_0x33f5f8[_0x3457('0x18')][_0x3457('0x1b')]||null:null,'limit':_0x33f5f8[_0x3457('0x18')]?_0x33f5f8[_0x3457('0x18')]['limit']||null:null})[_0x3457('0x20')](function(_0x4736fb){logger['info'](_0x3457('0x24'),_0x33f5f8);logger[_0x3457('0xe')](_0x3457('0x24'),_0x33f5f8,JSON['stringify'](_0x4736fb));_0x3a4a01(_0x4736fb);})[_0x3457('0x15')](function(_0x2a2590){logger['error'](_0x3457('0x24'),_0x2a2590[_0x3457('0x13')],_0x33f5f8);_0x33e5ae(_0x4f6ff4[_0x3457('0x11')](0x1f4,_0x2a2590[_0x3457('0x13')]));});});}; \ No newline at end of file +var _0xc9eb=['model','map','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x3506f0,_0x327849){var _0xe9fe24=function(_0x1f5bf9){while(--_0x1f5bf9){_0x3506f0['push'](_0x3506f0['shift']());}};_0xe9fe24(++_0x327849);}(_0xc9eb,0x1a2));var _0xbc9e=function(_0x1e5083,_0x7284b0){_0x1e5083=_0x1e5083-0x0;var _0x3312ab=_0xc9eb[_0x1e5083];return _0x3312ab;};'use strict';var _=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var moment=require(_0xbc9e('0x2'));var BPromise=require(_0xbc9e('0x3'));var rs=require(_0xbc9e('0x4'));var fs=require('fs');var Redis=require(_0xbc9e('0x5'));var db=require(_0xbc9e('0x6'))['db'];var utils=require(_0xbc9e('0x7'));var logger=require(_0xbc9e('0x8'))('rpc');var config=require(_0xbc9e('0x9'));var jayson=require(_0xbc9e('0xa'));var client=jayson['client'][_0xbc9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x295bcb,_0xbdfd84,_0x23cd73){return new BPromise(function(_0x132fdd,_0xfc2b44){return client[_0xbc9e('0xc')](_0x295bcb,_0x23cd73)[_0xbc9e('0xd')](function(_0x252f53){logger[_0xbc9e('0xe')](_0xbc9e('0xf'),_0xbdfd84,_0xbc9e('0x10'));logger['debug'](_0xbc9e('0x11'),_0xbdfd84,_0xbc9e('0x10'),JSON[_0xbc9e('0x12')](_0x252f53));if(_0x252f53['error']){if(_0x252f53[_0xbc9e('0x13')][_0xbc9e('0x14')]===0x1f4){logger['error'](_0xbc9e('0xf'),_0xbdfd84,_0x252f53[_0xbc9e('0x13')]['message']);return _0xfc2b44(_0x252f53['error'][_0xbc9e('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xbdfd84,_0x252f53[_0xbc9e('0x13')][_0xbc9e('0x15')]);return _0x132fdd(_0x252f53[_0xbc9e('0x13')]['message']);}else{logger[_0xbc9e('0xe')](_0xbc9e('0xf'),_0xbdfd84,'request\x20sent');_0x132fdd(_0x252f53[_0xbc9e('0x16')]['message']);}})[_0xbc9e('0x17')](function(_0x2e7540){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xbdfd84,_0x2e7540);_0xfc2b44(_0x2e7540);});});}exports[_0xbc9e('0x18')]=function(_0x5a2623){var _0x472124=this;return new Promise(function(_0x2b323e,_0x2cb01b){return db[_0xbc9e('0x19')][_0xbc9e('0x1a')]({'raw':_0x5a2623['options']?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1d')]||null:null,'attributes':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1e')]||null:null,'limit':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1f')]||null:null,'include':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x20')]?_['map'](_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x20')],function(_0x351726){return{'model':db[_0x351726['model']],'as':_0x351726['as'],'attributes':_0x351726[_0xbc9e('0x1e')],'include':_0x351726[_0xbc9e('0x20')]?_['map'](_0x351726['include'],function(_0x58ad64){return{'model':db[_0x58ad64[_0xbc9e('0x21')]],'as':_0x58ad64['as'],'attributes':_0x58ad64['attributes'],'include':_0x58ad64[_0xbc9e('0x20')]?_[_0xbc9e('0x22')](_0x58ad64[_0xbc9e('0x20')],function(_0x3c86f5){return{'model':db[_0x3c86f5[_0xbc9e('0x21')]],'as':_0x3c86f5['as'],'attributes':_0x3c86f5[_0xbc9e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27112b){logger[_0xbc9e('0xe')](_0xbc9e('0x18'),_0x5a2623);logger[_0xbc9e('0x23')](_0xbc9e('0x18'),_0x5a2623,JSON[_0xbc9e('0x12')](_0x27112b));_0x2b323e(_0x27112b);})[_0xbc9e('0x17')](function(_0x4b485b){logger[_0xbc9e('0x13')](_0xbc9e('0x18'),_0x4b485b[_0xbc9e('0x15')],_0x5a2623);_0x2cb01b(_0x472124[_0xbc9e('0x13')](0x1f4,_0x4b485b[_0xbc9e('0x15')]));});});};exports[_0xbc9e('0x24')]=function(_0x2a077c){var _0x53cbdc=this;return new Promise(function(_0x3c2109,_0x134186){return db[_0xbc9e('0x19')][_0xbc9e('0x25')](_0x2a077c[_0xbc9e('0x26')],{'raw':_0x2a077c[_0xbc9e('0x1b')]?_0x2a077c[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![]})[_0xbc9e('0xd')](function(_0x5bb619){logger[_0xbc9e('0xe')]('CreateVoiceCallReport',_0x2a077c);logger[_0xbc9e('0x23')]('CreateVoiceCallReport',_0x2a077c,JSON[_0xbc9e('0x12')](_0x5bb619));_0x3c2109(_0x5bb619);})[_0xbc9e('0x17')](function(_0x4a3734){logger['error'](_0xbc9e('0x24'),_0x4a3734[_0xbc9e('0x15')],_0x2a077c);_0x134186(_0x53cbdc[_0xbc9e('0x13')](0x1f4,_0x4a3734[_0xbc9e('0x15')]));});});};exports[_0xbc9e('0x27')]=function(_0x4f3383){var _0x34a104=this;return new Promise(function(_0x203717,_0x48dc80){return db[_0xbc9e('0x19')][_0xbc9e('0x28')](_0x4f3383['body'],{'raw':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383['options'][_0xbc9e('0x1d')]||null:null,'attributes':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383[_0xbc9e('0x1b')]['attributes']||null:null,'limit':_0x4f3383['options']?_0x4f3383['options'][_0xbc9e('0x1f')]||null:null})[_0xbc9e('0xd')](function(_0x51c7a0){logger[_0xbc9e('0xe')](_0xbc9e('0x27'),_0x4f3383);logger[_0xbc9e('0x23')](_0xbc9e('0x27'),_0x4f3383,JSON[_0xbc9e('0x12')](_0x51c7a0));_0x203717(_0x51c7a0);})[_0xbc9e('0x17')](function(_0x4aca9f){logger['error']('UpdateVoiceCallReport',_0x4aca9f[_0xbc9e('0x15')],_0x4f3383);_0x48dc80(_0x34a104[_0xbc9e('0x13')](0x1f4,_0x4aca9f[_0xbc9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6734140..9654aa9 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 _0x928c=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x372491,_0x2ea23c){var _0x20b32a=function(_0xba55db){while(--_0xba55db){_0x372491['push'](_0x372491['shift']());}};_0x20b32a(++_0x2ea23c);}(_0x928c,0x133));var _0xc928=function(_0x3e560f,_0xb5380e){_0x3e560f=_0x3e560f-0x0;var _0x1fdc10=_0x928c[_0x3e560f];return _0x1fdc10;};'use strict';var multer=require(_0xc928('0x0'));var util=require('util');var path=require(_0xc928('0x1'));var timeout=require(_0xc928('0x2'));var express=require(_0xc928('0x3'));var router=express[_0xc928('0x4')]();var fs_extra=require(_0xc928('0x5'));var auth=require(_0xc928('0x6'));var interaction=require(_0xc928('0x7'));var config=require(_0xc928('0x8'));var controller=require(_0xc928('0x9'));router[_0xc928('0xa')]('/',auth[_0xc928('0xb')](),controller[_0xc928('0xc')]);router['get'](_0xc928('0xd'),auth[_0xc928('0xb')](),controller[_0xc928('0xe')]);router[_0xc928('0xf')]('/',auth[_0xc928('0xb')](),controller['create']);router[_0xc928('0x10')](_0xc928('0xd'),auth[_0xc928('0xb')](),controller[_0xc928('0x11')]);router[_0xc928('0x12')](_0xc928('0xd'),auth[_0xc928('0xb')](),controller[_0xc928('0x13')]);module[_0xc928('0x14')]=router; \ No newline at end of file +var _0xca46=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0xa83021,_0x41a4d6){var _0x13ee5b=function(_0x352654){while(--_0x352654){_0xa83021['push'](_0xa83021['shift']());}};_0x13ee5b(++_0x41a4d6);}(_0xca46,0x175));var _0x6ca4=function(_0x668a54,_0x512101){_0x668a54=_0x668a54-0x0;var _0x700b7e=_0xca46[_0x668a54];return _0x700b7e;};'use strict';var multer=require(_0x6ca4('0x0'));var util=require(_0x6ca4('0x1'));var path=require(_0x6ca4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ca4('0x3')]();var fs_extra=require(_0x6ca4('0x4'));var auth=require(_0x6ca4('0x5'));var interaction=require(_0x6ca4('0x6'));var config=require(_0x6ca4('0x7'));var controller=require(_0x6ca4('0x8'));router[_0x6ca4('0x9')]('/',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xb')]);router[_0x6ca4('0x9')]('/:id',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xc')]);router[_0x6ca4('0xd')]('/',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xe')]);router[_0x6ca4('0xf')](_0x6ca4('0x10'),auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x11')]);router[_0x6ca4('0x12')]('/:id',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x13')]);module[_0x6ca4('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6bca629..22bae9d 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 _0x2a66=['split','BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue'];(function(_0x5817ea,_0x36d5c4){var _0x4189f2=function(_0x3176c7){while(--_0x3176c7){_0x5817ea['push'](_0x5817ea['shift']());}};_0x4189f2(++_0x36d5c4);}(_0x2a66,0xad));var _0x62a6=function(_0x320839,_0x3a18a5){_0x320839=_0x320839-0x0;var _0x29387e=_0x2a66[_0x320839];return _0x29387e;};'use strict';var Sequelize=require(_0x62a6('0x0'));module[_0x62a6('0x1')]={'name':{'type':Sequelize[_0x62a6('0x2')]},'prefix':{'type':Sequelize[_0x62a6('0x2')],'unique':_0x62a6('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x62a6('0x2')],'set':function(_0xd95891){this['setDataValue'](_0x62a6('0x4'),_0xd95891?_0xd95891[_0x62a6('0x5')](''):[]);},'get':function(){return this[_0x62a6('0x6')](_0x62a6('0x4'))?this[_0x62a6('0x6')](_0x62a6('0x4'))[_0x62a6('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x62a6('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x62a6('0x2')]},'description':{'type':Sequelize[_0x62a6('0x2')]}}; \ No newline at end of file +var _0x9e2f=['exports','STRING','name','setDataValue','getDataValue','options','BOOLEAN','sequelize'];(function(_0x3500a0,_0x1f6b04){var _0x1195c3=function(_0x365ab8){while(--_0x365ab8){_0x3500a0['push'](_0x3500a0['shift']());}};_0x1195c3(++_0x1f6b04);}(_0x9e2f,0xb7));var _0xf9e2=function(_0x3318d8,_0x1ecfdb){_0x3318d8=_0x3318d8-0x0;var _0x4bab7f=_0x9e2f[_0x3318d8];return _0x4bab7f;};'use strict';var Sequelize=require(_0xf9e2('0x0'));module[_0xf9e2('0x1')]={'name':{'type':Sequelize[_0xf9e2('0x2')]},'prefix':{'type':Sequelize[_0xf9e2('0x2')],'unique':_0xf9e2('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2c82a4){this[_0xf9e2('0x4')]('options',_0x2c82a4?_0x2c82a4['join'](''):[]);},'get':function(){return this[_0xf9e2('0x5')](_0xf9e2('0x6'))?this[_0xf9e2('0x5')](_0xf9e2('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0xf9e2('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf9e2('0x2')]},'record':{'type':Sequelize[_0xf9e2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf9e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ae20aa2..68294af 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 _0x280f=['status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x39443c,_0x25bf1f){var _0x39a016=function(_0x352fc3){while(--_0x352fc3){_0x39443c['push'](_0x39443c['shift']());}};_0x39a016(++_0x25bf1f);}(_0x280f,0xe2));var _0xf280=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x280f[_0x136619];return _0x38c4a5;};'use strict';var emlformat=require(_0xf280('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf280('0x1'));var jsonpatch=require(_0xf280('0x2'));var rp=require(_0xf280('0x3'));var moment=require(_0xf280('0x4'));var BPromise=require(_0xf280('0x5'));var Mustache=require(_0xf280('0x6'));var util=require(_0xf280('0x7'));var path=require('path');var sox=require(_0xf280('0x8'));var csv=require(_0xf280('0x9'));var ejs=require(_0xf280('0xa'));var fs=require('fs');var fs_extra=require(_0xf280('0xb'));var _=require(_0xf280('0xc'));var squel=require('squel');var crypto=require(_0xf280('0xd'));var jsforce=require(_0xf280('0xe'));var deskjs=require(_0xf280('0xf'));var toCsv=require(_0xf280('0x9'));var querystring=require(_0xf280('0x10'));var Papa=require(_0xf280('0x11'));var Redis=require('ioredis');var authService=require(_0xf280('0x12'));var qs=require(_0xf280('0x13'));var as=require(_0xf280('0x14'));var hardwareService=require(_0xf280('0x15'));var logger=require(_0xf280('0x16'))(_0xf280('0x17'));var utils=require(_0xf280('0x18'));var config=require(_0xf280('0x19'));var licenseUtil=require(_0xf280('0x1a'));var db=require(_0xf280('0x1b'))['db'];function respondWithStatusCode(_0x148d24,_0x56221f){_0x56221f=_0x56221f||0xcc;return function(_0x566eb7){if(_0x566eb7){return _0x148d24[_0xf280('0x1c')](_0x56221f);}return _0x148d24[_0xf280('0x1d')](_0x56221f)[_0xf280('0x1e')]();};}function respondWithResult(_0x1d7175,_0x3e9acc){_0x3e9acc=_0x3e9acc||0xc8;return function(_0x59fb22){if(_0x59fb22){return _0x1d7175[_0xf280('0x1d')](_0x3e9acc)[_0xf280('0x1f')](_0x59fb22);}};}function respondWithFilteredResult(_0x34cadb,_0x224162){return function(_0x1e8f4d){if(_0x1e8f4d){var _0x462177=typeof _0x224162[_0xf280('0x20')]==='undefined'&&typeof _0x224162['limit']==='undefined';var _0x30a9a6=_0x1e8f4d['count'];var _0x11c2b0=_0x462177?0x0:_0x224162['offset'];var _0x2a19e7=_0x462177?_0x1e8f4d[_0xf280('0x21')]:_0x224162['offset']+_0x224162[_0xf280('0x22')];var _0x59b8af;if(_0x2a19e7>=_0x30a9a6){_0x2a19e7=_0x30a9a6;_0x59b8af=0xc8;}else{_0x59b8af=0xce;}_0x34cadb[_0xf280('0x1d')](_0x59b8af);return _0x34cadb[_0xf280('0x23')](_0xf280('0x24'),_0x11c2b0+'-'+_0x2a19e7+'/'+_0x30a9a6)[_0xf280('0x1f')](_0x1e8f4d);}return null;};}function patchUpdates(_0x11db7d){return function(_0x3a4eff){try{jsonpatch[_0xf280('0x25')](_0x3a4eff,_0x11db7d,!![]);}catch(_0x469bdf){return BPromise[_0xf280('0x26')](_0x469bdf);}return _0x3a4eff['save']();};}function saveUpdates(_0x1ad62a,_0x5a1aa1){return function(_0xfb624e){if(_0xfb624e){return _0xfb624e[_0xf280('0x27')](_0x1ad62a)[_0xf280('0x28')](function(_0x32039f){return _0x32039f;});}return null;};}function removeEntity(_0x3de08f,_0x42020c){return function(_0x4c3618){if(_0x4c3618){return _0x4c3618[_0xf280('0x29')]()[_0xf280('0x28')](function(){var _0x7fbee=_0x4c3618[_0xf280('0x2a')]({'plain':!![]});var _0x35cd2d=_0xf280('0x2b');return db[_0xf280('0x2c')][_0xf280('0x29')]({'where':{'type':_0x35cd2d,'resourceId':_0x7fbee['id']}})['then'](function(){return _0x4c3618;});})[_0xf280('0x28')](function(){_0x3de08f[_0xf280('0x1d')](0xcc)[_0xf280('0x1e')]();});}};}function handleEntityNotFound(_0xf9ac1c,_0x4ea08f){return function(_0x5433c2){if(!_0x5433c2){_0xf9ac1c['sendStatus'](0x194);}return _0x5433c2;};}function handleError(_0x4e2e5a,_0x5a82f6){_0x5a82f6=_0x5a82f6||0x1f4;return function(_0x3da40e){logger[_0xf280('0x2d')](_0x3da40e[_0xf280('0x2e')]);if(_0x3da40e[_0xf280('0x2f')]){delete _0x3da40e['name'];}_0x4e2e5a[_0xf280('0x1d')](_0x5a82f6)['send'](_0x3da40e);};}exports[_0xf280('0x30')]=function(_0x24a0a1,_0x534233){var _0x25a2d7={},_0x7bbbd={},_0xd67c92={'count':0x0,'rows':[]};var _0x12bb3a=_['map'](db[_0xf280('0x31')][_0xf280('0x32')],function(_0x3e2f5d){return{'name':_0x3e2f5d[_0xf280('0x33')],'type':_0x3e2f5d[_0xf280('0x34')][_0xf280('0x35')]};});_0x7bbbd[_0xf280('0x36')]=_[_0xf280('0x37')](_0x12bb3a,'name');_0x7bbbd[_0xf280('0x38')]=_[_0xf280('0x39')](_0x24a0a1[_0xf280('0x38')]);_0x7bbbd[_0xf280('0x3a')]=_['intersection'](_0x7bbbd['model'],_0x7bbbd[_0xf280('0x38')]);_0x25a2d7['attributes']=_[_0xf280('0x3b')](_0x7bbbd[_0xf280('0x36')],qs[_0xf280('0x3c')](_0x24a0a1[_0xf280('0x38')][_0xf280('0x3c')]));_0x25a2d7['attributes']=_0x25a2d7['attributes']['length']?_0x25a2d7[_0xf280('0x3d')]:_0x7bbbd['model'];if(!_0x24a0a1[_0xf280('0x38')][_0xf280('0x3e')]('nolimit')){_0x25a2d7[_0xf280('0x22')]=qs[_0xf280('0x22')](_0x24a0a1[_0xf280('0x38')][_0xf280('0x22')]);_0x25a2d7[_0xf280('0x20')]=qs[_0xf280('0x20')](_0x24a0a1[_0xf280('0x38')][_0xf280('0x20')]);}_0x25a2d7[_0xf280('0x3f')]=qs[_0xf280('0x40')](_0x24a0a1['query'][_0xf280('0x40')]);_0x25a2d7[_0xf280('0x41')]=qs[_0xf280('0x3a')](_[_0xf280('0x42')](_0x24a0a1[_0xf280('0x38')],_0x7bbbd['filters']),_0x12bb3a);if(_0x24a0a1[_0xf280('0x38')][_0xf280('0x43')]){_0x25a2d7['where']=_[_0xf280('0x44')](_0x25a2d7[_0xf280('0x41')],{'$or':_[_0xf280('0x37')](_0x12bb3a,function(_0x49bbf2){if(_0x49bbf2[_0xf280('0x34')]!==_0xf280('0x45')){var _0x5ec3c5={};_0x5ec3c5[_0x49bbf2[_0xf280('0x2f')]]={'$like':'%'+_0x24a0a1[_0xf280('0x38')][_0xf280('0x43')]+'%'};return _0x5ec3c5;}})});}_0x25a2d7=_[_0xf280('0x44')]({},_0x25a2d7,_0x24a0a1[_0xf280('0x46')]);var _0xddbcf1={'where':_0x25a2d7[_0xf280('0x41')]};return db[_0xf280('0x31')][_0xf280('0x21')](_0xddbcf1)[_0xf280('0x28')](function(_0x22822e){_0xd67c92['count']=_0x22822e;if(_0x24a0a1[_0xf280('0x38')][_0xf280('0x47')]){_0x25a2d7[_0xf280('0x48')]=[{'all':!![]}];}return db[_0xf280('0x31')]['findAll'](_0x25a2d7);})[_0xf280('0x28')](function(_0x456ac6){_0xd67c92[_0xf280('0x49')]=_0x456ac6;return _0xd67c92;})[_0xf280('0x28')](respondWithFilteredResult(_0x534233,_0x25a2d7))[_0xf280('0x4a')](handleError(_0x534233,null));};exports['show']=function(_0x1a925b,_0x5a0e36){var _0x1c1674={'raw':![],'where':{'id':_0x1a925b[_0xf280('0x4b')]['id']}},_0x545cbd={};_0x545cbd[_0xf280('0x36')]=_[_0xf280('0x39')](db['VoiceChanSpy']['rawAttributes']);_0x545cbd[_0xf280('0x38')]=_[_0xf280('0x39')](_0x1a925b['query']);_0x545cbd[_0xf280('0x3a')]=_[_0xf280('0x3b')](_0x545cbd[_0xf280('0x36')],_0x545cbd[_0xf280('0x38')]);_0x1c1674[_0xf280('0x3d')]=_['intersection'](_0x545cbd[_0xf280('0x36')],qs[_0xf280('0x3c')](_0x1a925b[_0xf280('0x38')][_0xf280('0x3c')]));_0x1c1674[_0xf280('0x3d')]=_0x1c1674[_0xf280('0x3d')][_0xf280('0x4c')]?_0x1c1674['attributes']:_0x545cbd[_0xf280('0x36')];if(_0x1a925b[_0xf280('0x38')][_0xf280('0x47')]){_0x1c1674[_0xf280('0x48')]=[{'all':!![]}];}_0x1c1674=_['merge']({},_0x1c1674,_0x1a925b[_0xf280('0x46')]);return db[_0xf280('0x31')]['find'](_0x1c1674)[_0xf280('0x28')](handleEntityNotFound(_0x5a0e36,null))[_0xf280('0x28')](respondWithResult(_0x5a0e36,null))['catch'](handleError(_0x5a0e36,null));};exports[_0xf280('0x4d')]=function(_0x4991d9,_0x5f45ca){return db[_0xf280('0x31')][_0xf280('0x4d')](_0x4991d9['body'],{})['then'](function(_0x11f140){var _0x55ba4b=_0x4991d9[_0xf280('0x4e')][_0xf280('0x2a')]({'plain':!![]});if(!_0x55ba4b)throw new Error(_0xf280('0x4f'));if(_0x55ba4b[_0xf280('0x50')]===_0xf280('0x4e')){var _0x1c4522=_0x11f140[_0xf280('0x2a')]({'plain':!![]});var _0x47ab97=_0xf280('0x2b');return db[_0xf280('0x51')]['find']({'where':{'name':_0x47ab97,'userProfileId':_0x55ba4b['userProfileId']},'raw':!![]})['then'](function(_0x5c8e51){if(_0x5c8e51&&_0x5c8e51['autoAssociation']===0x0){return db[_0xf280('0x2c')][_0xf280('0x4d')]({'name':_0x1c4522['name'],'resourceId':_0x1c4522['id'],'type':_0x5c8e51[_0xf280('0x2f')],'sectionId':_0x5c8e51['id']},{})[_0xf280('0x28')](function(){return _0x11f140;});}else{return _0x11f140;}})['catch'](function(_0x3842a3){logger['error'](_0xf280('0x52'),_0x3842a3);throw _0x3842a3;});}return _0x11f140;})['then'](respondWithResult(_0x5f45ca,0xc9))[_0xf280('0x4a')](handleError(_0x5f45ca,null));};exports[_0xf280('0x27')]=function(_0x85ec5a,_0x33ee4f){if(_0x85ec5a[_0xf280('0x53')]['id']){delete _0x85ec5a['body']['id'];}return db[_0xf280('0x31')][_0xf280('0x54')]({'where':{'id':_0x85ec5a[_0xf280('0x4b')]['id']}})[_0xf280('0x28')](handleEntityNotFound(_0x33ee4f,null))[_0xf280('0x28')](saveUpdates(_0x85ec5a[_0xf280('0x53')],null))[_0xf280('0x28')](respondWithResult(_0x33ee4f,null))[_0xf280('0x4a')](handleError(_0x33ee4f,null));};exports[_0xf280('0x29')]=function(_0x1f28a2,_0x486fb0){return db[_0xf280('0x31')]['find']({'where':{'id':_0x1f28a2['params']['id']}})['then'](handleEntityNotFound(_0x486fb0,null))['then'](removeEntity(_0x486fb0,null))[_0xf280('0x4a')](handleError(_0x486fb0,null));}; \ No newline at end of file +var _0xb677=['type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','ChanSpies','stack','send','map','VoiceChanSpy','rawAttributes','fieldName'];(function(_0x1c3978,_0x2b9b06){var _0x3f92fb=function(_0x52986e){while(--_0x52986e){_0x1c3978['push'](_0x1c3978['shift']());}};_0x3f92fb(++_0x2b9b06);}(_0xb677,0x119));var _0x7b67=function(_0x1e78fe,_0x1a0475){_0x1e78fe=_0x1e78fe-0x0;var _0x42914f=_0xb677[_0x1e78fe];return _0x42914f;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b67('0x1'));var jsonpatch=require(_0x7b67('0x2'));var rp=require(_0x7b67('0x3'));var moment=require(_0x7b67('0x4'));var BPromise=require(_0x7b67('0x5'));var Mustache=require(_0x7b67('0x6'));var util=require(_0x7b67('0x7'));var path=require(_0x7b67('0x8'));var sox=require('sox');var csv=require(_0x7b67('0x9'));var ejs=require(_0x7b67('0xa'));var fs=require('fs');var fs_extra=require(_0x7b67('0xb'));var _=require(_0x7b67('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7b67('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b67('0xf'));var authService=require(_0x7b67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b67('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b67('0x12'))(_0x7b67('0x13'));var utils=require(_0x7b67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b402,_0x454df4){_0x454df4=_0x454df4||0xcc;return function(_0x1e17fc){if(_0x1e17fc){return _0x25b402[_0x7b67('0x15')](_0x454df4);}return _0x25b402[_0x7b67('0x16')](_0x454df4)[_0x7b67('0x17')]();};}function respondWithResult(_0x4f15f5,_0x37eb7a){_0x37eb7a=_0x37eb7a||0xc8;return function(_0x473d10){if(_0x473d10){return _0x4f15f5[_0x7b67('0x16')](_0x37eb7a)[_0x7b67('0x18')](_0x473d10);}};}function respondWithFilteredResult(_0x377208,_0x309f1c){return function(_0x1861d1){if(_0x1861d1){var _0xf99987=typeof _0x309f1c['offset']===_0x7b67('0x19')&&typeof _0x309f1c[_0x7b67('0x1a')]===_0x7b67('0x19');var _0x41e23d=_0x1861d1[_0x7b67('0x1b')];var _0x18d9da=_0xf99987?0x0:_0x309f1c['offset'];var _0x33f462=_0xf99987?_0x1861d1[_0x7b67('0x1b')]:_0x309f1c[_0x7b67('0x1c')]+_0x309f1c[_0x7b67('0x1a')];var _0x4732dc;if(_0x33f462>=_0x41e23d){_0x33f462=_0x41e23d;_0x4732dc=0xc8;}else{_0x4732dc=0xce;}_0x377208[_0x7b67('0x16')](_0x4732dc);return _0x377208[_0x7b67('0x1d')](_0x7b67('0x1e'),_0x18d9da+'-'+_0x33f462+'/'+_0x41e23d)[_0x7b67('0x18')](_0x1861d1);}return null;};}function patchUpdates(_0x8f1cbe){return function(_0x5ddb36){try{jsonpatch[_0x7b67('0x1f')](_0x5ddb36,_0x8f1cbe,!![]);}catch(_0x16bc9b){return BPromise['reject'](_0x16bc9b);}return _0x5ddb36['save']();};}function saveUpdates(_0x48cd2e,_0x48944a){return function(_0x44b951){if(_0x44b951){return _0x44b951[_0x7b67('0x20')](_0x48cd2e)[_0x7b67('0x21')](function(_0x3042fe){return _0x3042fe;});}return null;};}function removeEntity(_0x2c3f11,_0x56b952){return function(_0x3b4fea){if(_0x3b4fea){return _0x3b4fea[_0x7b67('0x22')]()[_0x7b67('0x21')](function(){var _0x3f5202=_0x3b4fea[_0x7b67('0x23')]({'plain':!![]});var _0x3e9630=_0x7b67('0x24');return db['UserProfileResource'][_0x7b67('0x22')]({'where':{'type':_0x3e9630,'resourceId':_0x3f5202['id']}})['then'](function(){return _0x3b4fea;});})[_0x7b67('0x21')](function(){_0x2c3f11[_0x7b67('0x16')](0xcc)[_0x7b67('0x17')]();});}};}function handleEntityNotFound(_0x34a88d,_0x5f2a13){return function(_0x3cf152){if(!_0x3cf152){_0x34a88d[_0x7b67('0x15')](0x194);}return _0x3cf152;};}function handleError(_0x37e35f,_0x5c3f44){_0x5c3f44=_0x5c3f44||0x1f4;return function(_0x5e35c9){logger['error'](_0x5e35c9[_0x7b67('0x25')]);if(_0x5e35c9['name']){delete _0x5e35c9['name'];}_0x37e35f[_0x7b67('0x16')](_0x5c3f44)[_0x7b67('0x26')](_0x5e35c9);};}exports['index']=function(_0x2fe0c5,_0x5ee04b){var _0x4815ab={},_0x196f96={},_0x1caf69={'count':0x0,'rows':[]};var _0x3345af=_[_0x7b67('0x27')](db[_0x7b67('0x28')][_0x7b67('0x29')],function(_0x7af5fe){return{'name':_0x7af5fe[_0x7b67('0x2a')],'type':_0x7af5fe[_0x7b67('0x2b')][_0x7b67('0x2c')]};});_0x196f96[_0x7b67('0x2d')]=_[_0x7b67('0x27')](_0x3345af,_0x7b67('0x2e'));_0x196f96[_0x7b67('0x2f')]=_[_0x7b67('0x30')](_0x2fe0c5[_0x7b67('0x2f')]);_0x196f96[_0x7b67('0x31')]=_['intersection'](_0x196f96[_0x7b67('0x2d')],_0x196f96[_0x7b67('0x2f')]);_0x4815ab['attributes']=_[_0x7b67('0x32')](_0x196f96[_0x7b67('0x2d')],qs[_0x7b67('0x33')](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x33')]));_0x4815ab[_0x7b67('0x34')]=_0x4815ab[_0x7b67('0x34')][_0x7b67('0x35')]?_0x4815ab[_0x7b67('0x34')]:_0x196f96[_0x7b67('0x2d')];if(!_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x36')](_0x7b67('0x37'))){_0x4815ab['limit']=qs[_0x7b67('0x1a')](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x1a')]);_0x4815ab[_0x7b67('0x1c')]=qs['offset'](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x1c')]);}_0x4815ab[_0x7b67('0x38')]=qs[_0x7b67('0x39')](_0x2fe0c5[_0x7b67('0x2f')]['sort']);_0x4815ab[_0x7b67('0x3a')]=qs[_0x7b67('0x31')](_[_0x7b67('0x3b')](_0x2fe0c5[_0x7b67('0x2f')],_0x196f96[_0x7b67('0x31')]),_0x3345af);if(_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x3c')]){_0x4815ab[_0x7b67('0x3a')]=_[_0x7b67('0x3d')](_0x4815ab[_0x7b67('0x3a')],{'$or':_[_0x7b67('0x27')](_0x3345af,function(_0x2e2888){if(_0x2e2888[_0x7b67('0x2b')]!==_0x7b67('0x3e')){var _0x28a278={};_0x28a278[_0x2e2888['name']]={'$like':'%'+_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x3c')]+'%'};return _0x28a278;}})});}_0x4815ab=_[_0x7b67('0x3d')]({},_0x4815ab,_0x2fe0c5[_0x7b67('0x3f')]);var _0x317815={'where':_0x4815ab[_0x7b67('0x3a')]};return db['VoiceChanSpy']['count'](_0x317815)[_0x7b67('0x21')](function(_0x16d60a){_0x1caf69['count']=_0x16d60a;if(_0x2fe0c5['query'][_0x7b67('0x40')]){_0x4815ab[_0x7b67('0x41')]=[{'all':!![]}];}return db[_0x7b67('0x28')][_0x7b67('0x42')](_0x4815ab);})[_0x7b67('0x21')](function(_0x46629b){_0x1caf69['rows']=_0x46629b;return _0x1caf69;})[_0x7b67('0x21')](respondWithFilteredResult(_0x5ee04b,_0x4815ab))[_0x7b67('0x43')](handleError(_0x5ee04b,null));};exports[_0x7b67('0x44')]=function(_0x36615f,_0x5dcdd7){var _0x251a3c={'raw':![],'where':{'id':_0x36615f[_0x7b67('0x45')]['id']}},_0x40ba75={};_0x40ba75['model']=_['keys'](db[_0x7b67('0x28')]['rawAttributes']);_0x40ba75[_0x7b67('0x2f')]=_['keys'](_0x36615f['query']);_0x40ba75[_0x7b67('0x31')]=_['intersection'](_0x40ba75[_0x7b67('0x2d')],_0x40ba75['query']);_0x251a3c[_0x7b67('0x34')]=_[_0x7b67('0x32')](_0x40ba75['model'],qs[_0x7b67('0x33')](_0x36615f[_0x7b67('0x2f')][_0x7b67('0x33')]));_0x251a3c[_0x7b67('0x34')]=_0x251a3c[_0x7b67('0x34')][_0x7b67('0x35')]?_0x251a3c[_0x7b67('0x34')]:_0x40ba75[_0x7b67('0x2d')];if(_0x36615f[_0x7b67('0x2f')][_0x7b67('0x40')]){_0x251a3c[_0x7b67('0x41')]=[{'all':!![]}];}_0x251a3c=_[_0x7b67('0x3d')]({},_0x251a3c,_0x36615f[_0x7b67('0x3f')]);return db[_0x7b67('0x28')]['find'](_0x251a3c)[_0x7b67('0x21')](handleEntityNotFound(_0x5dcdd7,null))[_0x7b67('0x21')](respondWithResult(_0x5dcdd7,null))['catch'](handleError(_0x5dcdd7,null));};exports[_0x7b67('0x46')]=function(_0x4a96c5,_0x1c80e9){return db[_0x7b67('0x28')][_0x7b67('0x46')](_0x4a96c5[_0x7b67('0x47')],{})['then'](function(_0x385c6e){var _0x4c3d7f=_0x4a96c5[_0x7b67('0x48')]['get']({'plain':!![]});if(!_0x4c3d7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c3d7f[_0x7b67('0x49')]===_0x7b67('0x48')){var _0x5b3560=_0x385c6e['get']({'plain':!![]});var _0x3d35c3=_0x7b67('0x24');return db[_0x7b67('0x4a')][_0x7b67('0x4b')]({'where':{'name':_0x3d35c3,'userProfileId':_0x4c3d7f[_0x7b67('0x4c')]},'raw':!![]})['then'](function(_0xdad2b5){if(_0xdad2b5&&_0xdad2b5[_0x7b67('0x4d')]===0x0){return db[_0x7b67('0x4e')][_0x7b67('0x46')]({'name':_0x5b3560['name'],'resourceId':_0x5b3560['id'],'type':_0xdad2b5[_0x7b67('0x2e')],'sectionId':_0xdad2b5['id']},{})['then'](function(){return _0x385c6e;});}else{return _0x385c6e;}})[_0x7b67('0x43')](function(_0x1ea2b5){logger[_0x7b67('0x4f')](_0x7b67('0x50'),_0x1ea2b5);throw _0x1ea2b5;});}return _0x385c6e;})[_0x7b67('0x21')](respondWithResult(_0x1c80e9,0xc9))[_0x7b67('0x43')](handleError(_0x1c80e9,null));};exports[_0x7b67('0x20')]=function(_0x2023da,_0x56d18d){if(_0x2023da['body']['id']){delete _0x2023da['body']['id'];}return db['VoiceChanSpy'][_0x7b67('0x4b')]({'where':{'id':_0x2023da[_0x7b67('0x45')]['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x56d18d,null))[_0x7b67('0x21')](saveUpdates(_0x2023da[_0x7b67('0x47')],null))['then'](respondWithResult(_0x56d18d,null))[_0x7b67('0x43')](handleError(_0x56d18d,null));};exports['destroy']=function(_0x11313a,_0xe0cb78){return db[_0x7b67('0x28')][_0x7b67('0x4b')]({'where':{'id':_0x11313a[_0x7b67('0x45')]['id']}})['then'](handleEntityNotFound(_0xe0cb78,null))[_0x7b67('0x21')](removeEntity(_0xe0cb78,null))[_0x7b67('0x43')](handleError(_0xe0cb78,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e8a3c20..74398f9 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 _0xe104=['findAll','agent','then','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','catch','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','Set','format','chanspy','record','recordingFormat','auth','ChanSpy','name','options','join','concat','internal','User'];(function(_0x38d6b2,_0x555cad){var _0x347a3b=function(_0x53b203){while(--_0x53b203){_0x38d6b2['push'](_0x38d6b2['shift']());}};_0x347a3b(++_0x555cad);}(_0xe104,0x18c));var _0x4e10=function(_0x480a73,_0x1b0f9b){_0x480a73=_0x480a73-0x0;var _0x283255=_0xe104[_0x480a73];return _0x283255;};'use strict';var _=require(_0x4e10('0x0'));var util=require(_0x4e10('0x1'));var BPromise=require(_0x4e10('0x2'));var attributes=require(_0x4e10('0x3'));var getUserApplications=function(_0x89815f,_0x5db2ba,_0x547806){var _0x417a7b=0x1;var _0x540a82=[];var _0x3349ab={'context':_0x5db2ba[_0x4e10('0x4')]||_0x4e10('0x5'),'exten':util['format'](_0x4e10('0x6'),_0x89815f[_0x4e10('0x7')],_0x547806),'type':_0x4e10('0x8'),'isApp':![],'ChanSpyId':_0x89815f['id'],'UserId':_0x5db2ba['id']};_0x540a82[_0x4e10('0x9')](_[_0x4e10('0xa')]({'app':_0x4e10('0xb'),'appdata':util[_0x4e10('0xc')]('CDR(type)=%s',_0x4e10('0xd')),'priority':_0x417a7b++},_0x3349ab));if(_0x89815f[_0x4e10('0xe')]){_0x540a82['push'](_[_0x4e10('0xa')]({'app':'MixMonitor','appdata':util[_0x4e10('0xc')]('${UNIQUEID}.%s,a',_0x89815f[_0x4e10('0xf')]),'priority':_0x417a7b++},_0x3349ab));}if(_0x89815f[_0x4e10('0x10')]){_0x540a82[_0x4e10('0x9')](_[_0x4e10('0xa')]({'app':'Authenticate','appdata':_0x89815f['password'],'priority':_0x417a7b++},_0x3349ab));}_0x540a82[_0x4e10('0x9')](_['merge']({'app':_0x4e10('0x11'),'appdata':util['format']('SIP/%s,%s',_0x5db2ba[_0x4e10('0x12')],_0x89815f[_0x4e10('0x13')]?_0x89815f['options'][_0x4e10('0x14')](''):''),'priority':_0x417a7b++},_0x3349ab));if(_0x89815f[_0x4e10('0xe')]){_0x540a82[_0x4e10('0x9')](_[_0x4e10('0xa')]({'app':'StopMixMonitor','priority':_0x417a7b++},_0x3349ab));}return _0x540a82;};var getChanSpyApplications=function(_0x1d5d51,_0x1f8fbe){var _0x20db54=[];for(var _0x27b1b8=0x0,_0x28e02a=0x1;_0x27b1b8<_0x1f8fbe['length'];_0x27b1b8++,_0x28e02a=0x1){_0x20db54=_0x20db54[_0x4e10('0x15')](getUserApplications(_0x1d5d51,_0x1f8fbe[_0x27b1b8],_0x1f8fbe[_0x27b1b8][_0x4e10('0x16')]));if(_0x1f8fbe[_0x27b1b8][_0x4e10('0x16')]!=_0x1f8fbe[_0x27b1b8][_0x4e10('0x12')]){_0x20db54=_0x20db54[_0x4e10('0x15')](getUserApplications(_0x1d5d51,_0x1f8fbe[_0x27b1b8],_0x1f8fbe[_0x27b1b8][_0x4e10('0x12')]));}}return _0x20db54;};var getChanSpyPromise=function(_0x5f8105,_0x522221){return new BPromise(function(_0x3321ab,_0x5758c2){return _0x5f8105[_0x4e10('0x17')][_0x4e10('0x18')]({'attributes':['id',_0x4e10('0x12'),_0x4e10('0x16')],'where':{'role':_0x4e10('0x19'),'chanspy':!![]},'raw':!![]})[_0x4e10('0x1a')](function(_0x2716f6){if(_0x2716f6){return _0x3321ab(getChanSpyApplications(_0x522221,_0x2716f6));}return _0x3321ab([]);})['catch'](function(_0x4ff674){_0x5758c2(_0x4ff674);});});};module['exports']=function(_0x1a9049,_0x37c1bd){var _0x165f1f=_0x1a9049[_0x4e10('0x1b')];return _0x1a9049[_0x4e10('0x1c')](_0x4e10('0x1d'),attributes,{'tableName':_0x4e10('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ed691,_0x4cfb4d,_0x204ea7){return getChanSpyPromise(_0x165f1f,_0x2ed691)[_0x4e10('0x1a')](function(_0x45075f){if(_0x45075f&&_0x45075f[_0x4e10('0x1f')]){return _0x165f1f[_0x4e10('0x20')]['bulkCreate'](_0x45075f);}})[_0x4e10('0x1a')](function(){_0x204ea7();})[_0x4e10('0x21')](function(_0x495f9d){_0x204ea7(_0x495f9d);});},'afterUpdate':function(_0x49c637,_0x366be8,_0x4a88a6){return _0x165f1f[_0x4e10('0x20')]['destroy']({'where':{'ChanSpyId':_0x49c637['id']}})[_0x4e10('0x1a')](function(){return getChanSpyPromise(_0x165f1f,_0x49c637);})['then'](function(_0x2e0fd5){if(_0x2e0fd5&&_0x2e0fd5[_0x4e10('0x1f')]){return _0x165f1f[_0x4e10('0x20')][_0x4e10('0x22')](_0x2e0fd5);}})[_0x4e10('0x1a')](function(){_0x4a88a6();})[_0x4e10('0x21')](function(_0x4578c7){_0x4a88a6(_0x4578c7);});},'afterDestroy':function(_0x245436,_0x315c59,_0x419c78){return _0x165f1f[_0x4e10('0x20')]['destroy']({'where':{'ChanSpyId':_0x245436['id']}})['then'](function(){_0x419c78();})['catch'](function(_0x2d1b76){_0x419c78(_0x2d1b76);});}}});}; \ No newline at end of file +var _0xa9a4=['destroy','util','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x4d584f,_0x385fcd){var _0x383793=function(_0x309159){while(--_0x309159){_0x4d584f['push'](_0x4d584f['shift']());}};_0x383793(++_0x385fcd);}(_0xa9a4,0x76));var _0x4a9a=function(_0x42e51f,_0x14945a){_0x42e51f=_0x42e51f-0x0;var _0x50ff74=_0xa9a4[_0x42e51f];return _0x50ff74;};'use strict';var _=require('lodash');var util=require(_0x4a9a('0x0'));var BPromise=require('bluebird');var attributes=require(_0x4a9a('0x1'));var getUserApplications=function(_0x5a3580,_0x3f1452,_0x56e643){var _0xf81ac4=0x1;var _0x4f6265=[];var _0x1f47a6={'context':_0x3f1452['context']||_0x4a9a('0x2'),'exten':util['format'](_0x4a9a('0x3'),_0x5a3580[_0x4a9a('0x4')],_0x56e643),'type':_0x4a9a('0x5'),'isApp':![],'ChanSpyId':_0x5a3580['id'],'UserId':_0x3f1452['id']};_0x4f6265[_0x4a9a('0x6')](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x8'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0xa'),_0x4a9a('0xb')),'priority':_0xf81ac4++},_0x1f47a6));if(_0x5a3580[_0x4a9a('0xc')]){_0x4f6265[_0x4a9a('0x6')](_['merge']({'app':_0x4a9a('0xd'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0xe'),_0x5a3580[_0x4a9a('0xf')]),'priority':_0xf81ac4++},_0x1f47a6));}if(_0x5a3580[_0x4a9a('0x10')]){_0x4f6265['push'](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x11'),'appdata':_0x5a3580[_0x4a9a('0x12')],'priority':_0xf81ac4++},_0x1f47a6));}_0x4f6265['push'](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x13'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0x14'),_0x3f1452[_0x4a9a('0x15')],_0x5a3580[_0x4a9a('0x16')]?_0x5a3580[_0x4a9a('0x16')][_0x4a9a('0x17')](''):''),'priority':_0xf81ac4++},_0x1f47a6));if(_0x5a3580['record']){_0x4f6265[_0x4a9a('0x6')](_['merge']({'app':_0x4a9a('0x18'),'priority':_0xf81ac4++},_0x1f47a6));}return _0x4f6265;};var getChanSpyApplications=function(_0x46fb31,_0x2f7d29){var _0x3bad2a=[];for(var _0x3afbc8=0x0,_0x35d8bc=0x1;_0x3afbc8<_0x2f7d29[_0x4a9a('0x19')];_0x3afbc8++,_0x35d8bc=0x1){_0x3bad2a=_0x3bad2a[_0x4a9a('0x1a')](getUserApplications(_0x46fb31,_0x2f7d29[_0x3afbc8],_0x2f7d29[_0x3afbc8]['internal']));if(_0x2f7d29[_0x3afbc8][_0x4a9a('0x1b')]!=_0x2f7d29[_0x3afbc8][_0x4a9a('0x15')]){_0x3bad2a=_0x3bad2a[_0x4a9a('0x1a')](getUserApplications(_0x46fb31,_0x2f7d29[_0x3afbc8],_0x2f7d29[_0x3afbc8][_0x4a9a('0x15')]));}}return _0x3bad2a;};var getChanSpyPromise=function(_0x18c339,_0x5cc422){return new BPromise(function(_0x3cd558,_0x405075){return _0x18c339['User']['findAll']({'attributes':['id',_0x4a9a('0x15'),_0x4a9a('0x1b')],'where':{'role':_0x4a9a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x4a9a('0x1d')](function(_0x2e4fa3){if(_0x2e4fa3){return _0x3cd558(getChanSpyApplications(_0x5cc422,_0x2e4fa3));}return _0x3cd558([]);})[_0x4a9a('0x1e')](function(_0x423445){_0x405075(_0x423445);});});};module[_0x4a9a('0x1f')]=function(_0x31e6e7,_0x3d1923){var _0x410b31=_0x31e6e7[_0x4a9a('0x20')];return _0x31e6e7[_0x4a9a('0x21')](_0x4a9a('0x22'),attributes,{'tableName':_0x4a9a('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2f09,_0x484619,_0x549e51){return getChanSpyPromise(_0x410b31,_0x5b2f09)[_0x4a9a('0x1d')](function(_0x5f596b){if(_0x5f596b&&_0x5f596b['length']){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x25')](_0x5f596b);}})[_0x4a9a('0x1d')](function(){_0x549e51();})[_0x4a9a('0x1e')](function(_0x355902){_0x549e51(_0x355902);});},'afterUpdate':function(_0x3061a9,_0x364a20,_0x22d910){return _0x410b31[_0x4a9a('0x24')]['destroy']({'where':{'ChanSpyId':_0x3061a9['id']}})[_0x4a9a('0x1d')](function(){return getChanSpyPromise(_0x410b31,_0x3061a9);})[_0x4a9a('0x1d')](function(_0x49ff6b){if(_0x49ff6b&&_0x49ff6b[_0x4a9a('0x19')]){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x25')](_0x49ff6b);}})[_0x4a9a('0x1d')](function(){_0x22d910();})[_0x4a9a('0x1e')](function(_0x2eae98){_0x22d910(_0x2eae98);});},'afterDestroy':function(_0x9e8b49,_0x3ca9,_0x41b4e8){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x26')]({'where':{'ChanSpyId':_0x9e8b49['id']}})[_0x4a9a('0x1d')](function(){_0x41b4e8();})['catch'](function(_0x1ef73e){_0x41b4e8(_0x1ef73e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 305ad0e..0c50081 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 _0xf403=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf403,0x1d3));var _0x3f40=function(_0x3c05ef,_0x3d5e24){_0x3c05ef=_0x3c05ef-0x0;var _0x35f428=_0xf403[_0x3c05ef];return _0x35f428;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f40('0x9')][_0x3f40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24fb9e,_0x1f21fa,_0x5878f9){return new BPromise(function(_0x1dffe8,_0x4c1694){return client['request'](_0x24fb9e,_0x5878f9)[_0x3f40('0xb')](function(_0xb4a314){logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,'request\x20sent');logger[_0x3f40('0xd')](_0x3f40('0xe'),_0x1f21fa,_0x3f40('0xf'),JSON['stringify'](_0xb4a314));if(_0xb4a314[_0x3f40('0x10')]){if(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x11')]===0x1f4){logger['error'](_0x3f40('0x12'),_0x1f21fa,_0xb4a314['error'][_0x3f40('0x13')]);return _0x4c1694(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}logger[_0x3f40('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);return _0x1dffe8(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0x3f40('0xf'));_0x1dffe8(_0xb4a314[_0x3f40('0x14')]['message']);}})['catch'](function(_0x54f596){logger[_0x3f40('0x10')](_0x3f40('0x12'),_0x1f21fa,_0x54f596);_0x4c1694(_0x54f596);});});} \ No newline at end of file +var _0xcea2=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x3f6336,_0x2ac0cc){var _0x5eecc7=function(_0x2ee921){while(--_0x2ee921){_0x3f6336['push'](_0x3f6336['shift']());}};_0x5eecc7(++_0x2ac0cc);}(_0xcea2,0x15a));var _0x2cea=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcea2[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 449c7da..82c2489 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 _0x1e5c=['./voiceContext.controller','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x1e5c,0x181));var _0xc1e5=function(_0x554634,_0x1048d2){_0x554634=_0x554634-0x0;var _0x4f1a08=_0x1e5c[_0x554634];return _0x4f1a08;};'use strict';var multer=require(_0xc1e5('0x0'));var util=require(_0xc1e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1e5('0x2')]();var fs_extra=require(_0xc1e5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc1e5('0x4'));var config=require('../../config/environment');var controller=require(_0xc1e5('0x5'));router['get']('/',auth[_0xc1e5('0x6')](),controller[_0xc1e5('0x7')]);router['get'](_0xc1e5('0x8'),auth[_0xc1e5('0x6')](),controller[_0xc1e5('0x9')]);router['post']('/',auth[_0xc1e5('0x6')](),controller[_0xc1e5('0xa')]);router[_0xc1e5('0xb')]('/:id',auth[_0xc1e5('0x6')](),controller[_0xc1e5('0xc')]);router[_0xc1e5('0xd')](_0xc1e5('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xc1e5('0xe')]=router; \ No newline at end of file +var _0x76f6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0x76f6,0x1a0));var _0x676f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x76f6[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x676f('0x0'));var path=require(_0x676f('0x1'));var timeout=require(_0x676f('0x2'));var express=require(_0x676f('0x3'));var router=express[_0x676f('0x4')]();var fs_extra=require(_0x676f('0x5'));var auth=require(_0x676f('0x6'));var interaction=require(_0x676f('0x7'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x676f('0x8')]('/',auth[_0x676f('0x9')](),controller[_0x676f('0xa')]);router[_0x676f('0x8')](_0x676f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x676f('0xc')]('/',auth[_0x676f('0x9')](),controller[_0x676f('0xd')]);router[_0x676f('0xe')](_0x676f('0xb'),auth[_0x676f('0x9')](),controller[_0x676f('0xf')]);router[_0x676f('0x10')](_0x676f('0xb'),auth['isAuthenticated'](),controller[_0x676f('0x11')]);module[_0x676f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 092649f..956e6c2 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 _0x9ad7=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0x41e912,_0x4ccc06){var _0x245963=function(_0xf9cd62){while(--_0xf9cd62){_0x41e912['push'](_0x41e912['shift']());}};_0x245963(++_0x4ccc06);}(_0x9ad7,0x74));var _0x79ad=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x9ad7[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x79ad('0x0'));module[_0x79ad('0x1')]={'name':{'type':Sequelize[_0x79ad('0x2')],'unique':_0x79ad('0x3')},'description':{'type':Sequelize[_0x79ad('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x79ad('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a9f=['exports','STRING','name'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x8a9f,0x90));var _0xf8a9=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x8a9f[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require('sequelize');module[_0xf8a9('0x0')]={'name':{'type':Sequelize[_0xf8a9('0x1')],'unique':_0xf8a9('0x2')},'description':{'type':Sequelize[_0xf8a9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b857344..9e60b2b 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 _0x55e5=['squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','count','Content-Range','reject','save','update','destroy','Contexts','UserProfileResource','end','stack','name','send','VoiceContext','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','includeAll','rows','rawAttributes','include','merge','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','render','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x55e5,0xb8));var _0x555e=function(_0x2a436b,_0x1a48c3){_0x2a436b=_0x2a436b-0x0;var _0x38bce1=_0x55e5[_0x2a436b];return _0x38bce1;};'use strict';var emlformat=require(_0x555e('0x0'));var rimraf=require(_0x555e('0x1'));var zipdir=require(_0x555e('0x2'));var jsonpatch=require(_0x555e('0x3'));var rp=require(_0x555e('0x4'));var moment=require('moment');var BPromise=require(_0x555e('0x5'));var Mustache=require(_0x555e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x555e('0x7'));var csv=require('to-csv');var ejs=require(_0x555e('0x8'));var fs=require('fs');var fs_extra=require(_0x555e('0x9'));var _=require('lodash');var squel=require(_0x555e('0xa'));var crypto=require('crypto');var jsforce=require(_0x555e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x555e('0xc'));var Papa=require(_0x555e('0xd'));var Redis=require(_0x555e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x555e('0xf'));var as=require(_0x555e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x555e('0x11'));var utils=require(_0x555e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x555e('0x13'));var db=require(_0x555e('0x14'))['db'];var jayson=require(_0x555e('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58c716,_0x34dd31,_0x348358,_0x1e86b3){return new BPromise(function(_0x3370ce,_0x366959){var _0x3edab8=_0x1e86b3||client;return _0x3edab8[_0x555e('0x16')](_0x58c716,_0x348358)[_0x555e('0x17')](function(_0x30abf4){logger[_0x555e('0x18')](_0x555e('0x19'),_0x34dd31,_0x555e('0x1a'));logger[_0x555e('0x1b')](_0x555e('0x1c'),_0x34dd31,'request\x20sent',JSON[_0x555e('0x1d')](_0x30abf4));if(_0x30abf4[_0x555e('0x1e')]){if(_0x30abf4[_0x555e('0x1e')][_0x555e('0x1f')]===0x1f4){logger[_0x555e('0x1e')](_0x555e('0x19'),_0x34dd31,_0x30abf4[_0x555e('0x1e')]['message']);return _0x366959(_0x30abf4[_0x555e('0x1e')][_0x555e('0x20')]);}logger['error'](_0x555e('0x19'),_0x34dd31,_0x30abf4[_0x555e('0x1e')][_0x555e('0x20')]);return _0x3370ce(_0x30abf4['error']['message']);}else{logger['info'](_0x555e('0x19'),_0x34dd31,'request\x20sent');_0x3370ce(_0x30abf4['result'][_0x555e('0x20')]);}})[_0x555e('0x21')](function(_0x2fda4d){logger[_0x555e('0x1e')](_0x555e('0x19'),_0x34dd31,_0x2fda4d);_0x366959(_0x2fda4d);});});}function respondWithStatusCode(_0x42b2c2,_0x3ebcfc){_0x3ebcfc=_0x3ebcfc||0xcc;return function(_0x8c0991){if(_0x8c0991){return _0x42b2c2[_0x555e('0x22')](_0x3ebcfc);}return _0x42b2c2[_0x555e('0x23')](_0x3ebcfc)['end']();};}function respondWithResult(_0x34091e,_0x3328a3){_0x3328a3=_0x3328a3||0xc8;return function(_0x554015){if(_0x554015){return _0x34091e[_0x555e('0x23')](_0x3328a3)[_0x555e('0x24')](_0x554015);}};}function respondWithFilteredResult(_0x5a734e,_0x247824){return function(_0x29490f){if(_0x29490f){var _0x52cf62=typeof _0x247824[_0x555e('0x25')]===_0x555e('0x26')&&typeof _0x247824['limit']===_0x555e('0x26');var _0x3c2e09=_0x29490f[_0x555e('0x27')];var _0x4f8e94=_0x52cf62?0x0:_0x247824['offset'];var _0xe84aa0=_0x52cf62?_0x29490f[_0x555e('0x27')]:_0x247824[_0x555e('0x25')]+_0x247824['limit'];var _0x45f272;if(_0xe84aa0>=_0x3c2e09){_0xe84aa0=_0x3c2e09;_0x45f272=0xc8;}else{_0x45f272=0xce;}_0x5a734e['status'](_0x45f272);return _0x5a734e['set'](_0x555e('0x28'),_0x4f8e94+'-'+_0xe84aa0+'/'+_0x3c2e09)['json'](_0x29490f);}return null;};}function patchUpdates(_0x1d2226){return function(_0x117340){try{jsonpatch['apply'](_0x117340,_0x1d2226,!![]);}catch(_0x4e6372){return BPromise[_0x555e('0x29')](_0x4e6372);}return _0x117340[_0x555e('0x2a')]();};}function saveUpdates(_0x18e4b3,_0x1ffe0d){return function(_0x23a104){if(_0x23a104){return _0x23a104[_0x555e('0x2b')](_0x18e4b3)[_0x555e('0x17')](function(_0x5f5c82){return _0x5f5c82;});}return null;};}function removeEntity(_0x39f5a1,_0x1981fc){return function(_0x230b4f){if(_0x230b4f){return _0x230b4f[_0x555e('0x2c')]()[_0x555e('0x17')](function(){var _0x5209ad=_0x230b4f['get']({'plain':!![]});var _0x22fdb7=_0x555e('0x2d');return db[_0x555e('0x2e')]['destroy']({'where':{'type':_0x22fdb7,'resourceId':_0x5209ad['id']}})[_0x555e('0x17')](function(){return _0x230b4f;});})[_0x555e('0x17')](function(){_0x39f5a1[_0x555e('0x23')](0xcc)[_0x555e('0x2f')]();});}};}function handleEntityNotFound(_0x4aab72,_0x57665f){return function(_0x4bb573){if(!_0x4bb573){_0x4aab72['sendStatus'](0x194);}return _0x4bb573;};}function handleError(_0x389960,_0x52fb61){_0x52fb61=_0x52fb61||0x1f4;return function(_0x256a81){logger[_0x555e('0x1e')](_0x256a81[_0x555e('0x30')]);if(_0x256a81['name']){delete _0x256a81[_0x555e('0x31')];}_0x389960[_0x555e('0x23')](_0x52fb61)[_0x555e('0x32')](_0x256a81);};}exports['index']=function(_0x33505,_0x33565b){var _0x5cfa6a={},_0x439fcd={},_0x5672e7={'count':0x0,'rows':[]};var _0x1352e7=_['map'](db[_0x555e('0x33')]['rawAttributes'],function(_0x23345c){return{'name':_0x23345c[_0x555e('0x34')],'type':_0x23345c[_0x555e('0x35')][_0x555e('0x36')]};});_0x439fcd[_0x555e('0x37')]=_[_0x555e('0x38')](_0x1352e7,_0x555e('0x31'));_0x439fcd[_0x555e('0x39')]=_[_0x555e('0x3a')](_0x33505[_0x555e('0x39')]);_0x439fcd['filters']=_[_0x555e('0x3b')](_0x439fcd[_0x555e('0x37')],_0x439fcd[_0x555e('0x39')]);_0x5cfa6a[_0x555e('0x3c')]=_['intersection'](_0x439fcd[_0x555e('0x37')],qs['fields'](_0x33505['query'][_0x555e('0x3d')]));_0x5cfa6a['attributes']=_0x5cfa6a['attributes'][_0x555e('0x3e')]?_0x5cfa6a['attributes']:_0x439fcd['model'];if(!_0x33505[_0x555e('0x39')][_0x555e('0x3f')]('nolimit')){_0x5cfa6a[_0x555e('0x40')]=qs[_0x555e('0x40')](_0x33505[_0x555e('0x39')][_0x555e('0x40')]);_0x5cfa6a[_0x555e('0x25')]=qs['offset'](_0x33505[_0x555e('0x39')][_0x555e('0x25')]);}_0x5cfa6a['order']=qs[_0x555e('0x41')](_0x33505[_0x555e('0x39')][_0x555e('0x41')]);_0x5cfa6a[_0x555e('0x42')]=qs[_0x555e('0x43')](_[_0x555e('0x44')](_0x33505[_0x555e('0x39')],_0x439fcd[_0x555e('0x43')]),_0x1352e7);if(_0x33505[_0x555e('0x39')][_0x555e('0x45')]){_0x5cfa6a[_0x555e('0x42')]=_['merge'](_0x5cfa6a[_0x555e('0x42')],{'$or':_[_0x555e('0x38')](_0x1352e7,function(_0x19aa3a){if(_0x19aa3a[_0x555e('0x35')]!=='VIRTUAL'){var _0x3f3ae8={};_0x3f3ae8[_0x19aa3a['name']]={'$like':'%'+_0x33505[_0x555e('0x39')][_0x555e('0x45')]+'%'};return _0x3f3ae8;}})});}_0x5cfa6a=_['merge']({},_0x5cfa6a,_0x33505['options']);var _0x4fd121={'where':_0x5cfa6a[_0x555e('0x42')]};return db[_0x555e('0x33')]['count'](_0x4fd121)[_0x555e('0x17')](function(_0x50720e){_0x5672e7[_0x555e('0x27')]=_0x50720e;if(_0x33505[_0x555e('0x39')][_0x555e('0x46')]){_0x5cfa6a['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x5cfa6a);})[_0x555e('0x17')](function(_0x53a21e){_0x5672e7[_0x555e('0x47')]=_0x53a21e;return _0x5672e7;})[_0x555e('0x17')](respondWithFilteredResult(_0x33565b,_0x5cfa6a))[_0x555e('0x21')](handleError(_0x33565b,null));};exports['show']=function(_0x5c3408,_0x2c9c6a){var _0x3d8f6f={'raw':![],'where':{'id':_0x5c3408['params']['id']}},_0x1e024a={};_0x1e024a[_0x555e('0x37')]=_[_0x555e('0x3a')](db[_0x555e('0x33')][_0x555e('0x48')]);_0x1e024a['query']=_[_0x555e('0x3a')](_0x5c3408['query']);_0x1e024a['filters']=_[_0x555e('0x3b')](_0x1e024a[_0x555e('0x37')],_0x1e024a[_0x555e('0x39')]);_0x3d8f6f['attributes']=_[_0x555e('0x3b')](_0x1e024a[_0x555e('0x37')],qs[_0x555e('0x3d')](_0x5c3408[_0x555e('0x39')][_0x555e('0x3d')]));_0x3d8f6f[_0x555e('0x3c')]=_0x3d8f6f[_0x555e('0x3c')]['length']?_0x3d8f6f[_0x555e('0x3c')]:_0x1e024a[_0x555e('0x37')];if(_0x5c3408[_0x555e('0x39')]['includeAll']){_0x3d8f6f[_0x555e('0x49')]=[{'all':!![]}];}_0x3d8f6f=_[_0x555e('0x4a')]({},_0x3d8f6f,_0x5c3408[_0x555e('0x4b')]);return db[_0x555e('0x33')]['find'](_0x3d8f6f)[_0x555e('0x17')](handleEntityNotFound(_0x2c9c6a,null))['then'](respondWithResult(_0x2c9c6a,null))[_0x555e('0x21')](handleError(_0x2c9c6a,null));};exports[_0x555e('0x4c')]=function(_0x3e1b6b,_0x1f1047,_0x405fa1){var _0x268209;return db[_0x555e('0x33')][_0x555e('0x4c')](_0x3e1b6b[_0x555e('0x4d')],{'raw':!![]})[_0x555e('0x17')](function(_0x7a303b){_0x268209=_0x7a303b;return db[_0x555e('0x33')][_0x555e('0x4e')]({'raw':!![]});})[_0x555e('0x17')](function(_0xb8915b){var _0x2eb49f=fs[_0x555e('0x4f')](path[_0x555e('0x50')](config[_0x555e('0x51')],_0x555e('0x52')),_0x555e('0x53'));var _0x471583=ejs['render'](_0x2eb49f,{'contexts':_0xb8915b||[]});fs[_0x555e('0x54')](_0x555e('0x55'),_0x471583);})[_0x555e('0x17')](function(){return respondWithRpcPromise('Reload',_0x555e('0x4c'),{'module':_0x555e('0x56')});})[_0x555e('0x17')](function(){var _0x49bdce=_0x3e1b6b[_0x555e('0x57')][_0x555e('0x58')]({'plain':!![]});if(!_0x49bdce)throw new Error(_0x555e('0x59'));if(_0x49bdce[_0x555e('0x5a')]===_0x555e('0x57')){var _0x1dec92=_0x268209['get']({'plain':!![]});return db[_0x555e('0x5b')][_0x555e('0x5c')]({'where':{'name':_0x555e('0x2d'),'userProfileId':_0x49bdce[_0x555e('0x5d')]},'raw':!![]})[_0x555e('0x17')](function(_0x3e70dc){if(_0x3e70dc&&_0x3e70dc['autoAssociation']===0x0){return db[_0x555e('0x2e')][_0x555e('0x4c')]({'name':_0x1dec92['name'],'resourceId':_0x1dec92['id'],'type':_0x3e70dc[_0x555e('0x31')],'sectionId':_0x3e70dc['id']},{})[_0x555e('0x17')](function(){return _0x268209;});}else{return _0x268209;}})[_0x555e('0x21')](function(_0x2dda3c){logger[_0x555e('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dda3c);throw _0x2dda3c;});}return _0x268209;})['then'](respondWithResult(_0x1f1047,0xc9))[_0x555e('0x21')](handleError(_0x1f1047,null));};exports[_0x555e('0x2b')]=function(_0x1c25df,_0x30da16,_0x4e5575){var _0x3bb31f;return db[_0x555e('0x33')][_0x555e('0x5c')]({'where':{'id':_0x1c25df[_0x555e('0x5e')]['id']}})[_0x555e('0x17')](handleEntityNotFound(_0x30da16,null))[_0x555e('0x17')](saveUpdates(_0x1c25df[_0x555e('0x4d')],null))[_0x555e('0x17')](function(_0x18fb99){if(_0x18fb99){_0x3bb31f=_0x18fb99;return db[_0x555e('0x33')]['findAll']({'raw':!![]});}})[_0x555e('0x17')](function(_0xadb427){var _0x2abdfd=fs[_0x555e('0x4f')](path[_0x555e('0x50')](config[_0x555e('0x51')],'server/files/templates/context.ejs'),_0x555e('0x53'));var _0x544b04=ejs[_0x555e('0x5f')](_0x2abdfd,{'contexts':_0xadb427||[]});fs[_0x555e('0x54')](_0x555e('0x55'),_0x544b04);})['then'](function(){return respondWithRpcPromise(_0x555e('0x60'),_0x555e('0x2b'),{'module':_0x555e('0x56')});})[_0x555e('0x17')](function(){return _0x3bb31f;})[_0x555e('0x17')](respondWithResult(_0x30da16,null))['catch'](handleError(_0x30da16,null));};exports[_0x555e('0x2c')]=function(_0x462554,_0x5ce16,_0x3f199b){var _0xcc17aa;return db[_0x555e('0x33')][_0x555e('0x5c')]({'where':{'id':_0x462554[_0x555e('0x5e')]['id']}})[_0x555e('0x17')](handleEntityNotFound(_0x5ce16,null))[_0x555e('0x17')](removeEntity(_0x5ce16,null))['then'](function(){return db[_0x555e('0x33')]['findAll']({'raw':!![]});})[_0x555e('0x17')](function(_0x3b0f6d){var _0x2a11c6=fs[_0x555e('0x4f')](path[_0x555e('0x50')](config['root'],_0x555e('0x52')),'utf8');var _0x37178a=ejs['render'](_0x2a11c6,{'contexts':_0x3b0f6d});fs[_0x555e('0x54')](_0x555e('0x55'),_0x37178a);return respondWithRpcPromise(_0x555e('0x60'),_0x555e('0x2c'),{'module':'chan_sip.so'});})[_0x555e('0x21')](handleError(_0x5ce16,null));}; \ No newline at end of file +var _0xaa7d=['offset','set','Content-Range','apply','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','VoiceContext','findAll','rows','rawAttributes','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count'];(function(_0x39d32d,_0xdffcd5){var _0x33b077=function(_0x2dd835){while(--_0x2dd835){_0x39d32d['push'](_0x39d32d['shift']());}};_0x33b077(++_0xdffcd5);}(_0xaa7d,0x1e7));var _0xdaa7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xaa7d[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0xdaa7('0x0'));var rimraf=require(_0xdaa7('0x1'));var zipdir=require(_0xdaa7('0x2'));var jsonpatch=require(_0xdaa7('0x3'));var rp=require('request-promise');var moment=require(_0xdaa7('0x4'));var BPromise=require(_0xdaa7('0x5'));var Mustache=require(_0xdaa7('0x6'));var util=require(_0xdaa7('0x7'));var path=require('path');var sox=require(_0xdaa7('0x8'));var csv=require(_0xdaa7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaa7('0xa'));var squel=require(_0xdaa7('0xb'));var crypto=require(_0xdaa7('0xc'));var jsforce=require(_0xdaa7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdaa7('0x9'));var querystring=require('querystring');var Papa=require(_0xdaa7('0xe'));var Redis=require(_0xdaa7('0xf'));var authService=require(_0xdaa7('0x10'));var qs=require(_0xdaa7('0x11'));var as=require(_0xdaa7('0x12'));var hardwareService=require(_0xdaa7('0x13'));var logger=require(_0xdaa7('0x14'))(_0xdaa7('0x15'));var utils=require(_0xdaa7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdaa7('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdaa7('0x18'));var client=jayson[_0xdaa7('0x19')][_0xdaa7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x210944,_0x3014c4,_0x2eefe4,_0x5a9223){return new BPromise(function(_0x55edca,_0x3965bf){var _0x478881=_0x5a9223||client;return _0x478881[_0xdaa7('0x1b')](_0x210944,_0x2eefe4)['then'](function(_0x5c4af0){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3014c4,_0xdaa7('0x1c'));logger[_0xdaa7('0x1d')](_0xdaa7('0x1e'),_0x3014c4,_0xdaa7('0x1c'),JSON[_0xdaa7('0x1f')](_0x5c4af0));if(_0x5c4af0['error']){if(_0x5c4af0['error']['code']===0x1f4){logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0x5c4af0[_0xdaa7('0x20')][_0xdaa7('0x22')]);return _0x3965bf(_0x5c4af0[_0xdaa7('0x20')][_0xdaa7('0x22')]);}logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0x5c4af0['error'][_0xdaa7('0x22')]);return _0x55edca(_0x5c4af0['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3014c4,_0xdaa7('0x1c'));_0x55edca(_0x5c4af0[_0xdaa7('0x23')]['message']);}})[_0xdaa7('0x24')](function(_0xf62fef){logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0xf62fef);_0x3965bf(_0xf62fef);});});}function respondWithStatusCode(_0x15357f,_0x230269){_0x230269=_0x230269||0xcc;return function(_0x10465){if(_0x10465){return _0x15357f['sendStatus'](_0x230269);}return _0x15357f[_0xdaa7('0x25')](_0x230269)[_0xdaa7('0x26')]();};}function respondWithResult(_0x27812f,_0x2d4377){_0x2d4377=_0x2d4377||0xc8;return function(_0x9486dd){if(_0x9486dd){return _0x27812f[_0xdaa7('0x25')](_0x2d4377)[_0xdaa7('0x27')](_0x9486dd);}};}function respondWithFilteredResult(_0x45ce94,_0x1c1ec0){return function(_0x29f512){if(_0x29f512){var _0x2fa5ec=typeof _0x1c1ec0['offset']===_0xdaa7('0x28')&&typeof _0x1c1ec0[_0xdaa7('0x29')]===_0xdaa7('0x28');var _0xb9f5d1=_0x29f512[_0xdaa7('0x2a')];var _0x345c33=_0x2fa5ec?0x0:_0x1c1ec0[_0xdaa7('0x2b')];var _0x8b36ac=_0x2fa5ec?_0x29f512[_0xdaa7('0x2a')]:_0x1c1ec0[_0xdaa7('0x2b')]+_0x1c1ec0[_0xdaa7('0x29')];var _0x181ede;if(_0x8b36ac>=_0xb9f5d1){_0x8b36ac=_0xb9f5d1;_0x181ede=0xc8;}else{_0x181ede=0xce;}_0x45ce94[_0xdaa7('0x25')](_0x181ede);return _0x45ce94[_0xdaa7('0x2c')](_0xdaa7('0x2d'),_0x345c33+'-'+_0x8b36ac+'/'+_0xb9f5d1)['json'](_0x29f512);}return null;};}function patchUpdates(_0x39ce89){return function(_0x1263ac){try{jsonpatch[_0xdaa7('0x2e')](_0x1263ac,_0x39ce89,!![]);}catch(_0x517d3e){return BPromise['reject'](_0x517d3e);}return _0x1263ac[_0xdaa7('0x2f')]();};}function saveUpdates(_0x1b55a9,_0x4c58c6){return function(_0x4c5973){if(_0x4c5973){return _0x4c5973[_0xdaa7('0x30')](_0x1b55a9)[_0xdaa7('0x31')](function(_0x4f50f0){return _0x4f50f0;});}return null;};}function removeEntity(_0xa89b1d,_0x56a5b){return function(_0x12b702){if(_0x12b702){return _0x12b702[_0xdaa7('0x32')]()[_0xdaa7('0x31')](function(){var _0x1979c1=_0x12b702[_0xdaa7('0x33')]({'plain':!![]});var _0x370dfc=_0xdaa7('0x34');return db[_0xdaa7('0x35')][_0xdaa7('0x32')]({'where':{'type':_0x370dfc,'resourceId':_0x1979c1['id']}})[_0xdaa7('0x31')](function(){return _0x12b702;});})[_0xdaa7('0x31')](function(){_0xa89b1d[_0xdaa7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ee2f,_0x57da63){return function(_0xc1e419){if(!_0xc1e419){_0x55ee2f[_0xdaa7('0x36')](0x194);}return _0xc1e419;};}function handleError(_0xc224f6,_0xd6a1bc){_0xd6a1bc=_0xd6a1bc||0x1f4;return function(_0x26a0c4){logger[_0xdaa7('0x20')](_0x26a0c4[_0xdaa7('0x37')]);if(_0x26a0c4[_0xdaa7('0x38')]){delete _0x26a0c4[_0xdaa7('0x38')];}_0xc224f6[_0xdaa7('0x25')](_0xd6a1bc)['send'](_0x26a0c4);};}exports[_0xdaa7('0x39')]=function(_0x23d5fd,_0x3b4f5f){var _0x1b833c={},_0x37d756={},_0x16363c={'count':0x0,'rows':[]};var _0x22ab20=_['map'](db['VoiceContext']['rawAttributes'],function(_0x2a7ddc){return{'name':_0x2a7ddc[_0xdaa7('0x3a')],'type':_0x2a7ddc[_0xdaa7('0x3b')][_0xdaa7('0x3c')]};});_0x37d756[_0xdaa7('0x3d')]=_[_0xdaa7('0x3e')](_0x22ab20,_0xdaa7('0x38'));_0x37d756[_0xdaa7('0x3f')]=_[_0xdaa7('0x40')](_0x23d5fd['query']);_0x37d756[_0xdaa7('0x41')]=_[_0xdaa7('0x42')](_0x37d756[_0xdaa7('0x3d')],_0x37d756['query']);_0x1b833c['attributes']=_[_0xdaa7('0x42')](_0x37d756[_0xdaa7('0x3d')],qs[_0xdaa7('0x43')](_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x43')]));_0x1b833c['attributes']=_0x1b833c['attributes'][_0xdaa7('0x44')]?_0x1b833c[_0xdaa7('0x45')]:_0x37d756[_0xdaa7('0x3d')];if(!_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x46')](_0xdaa7('0x47'))){_0x1b833c[_0xdaa7('0x29')]=qs[_0xdaa7('0x29')](_0x23d5fd[_0xdaa7('0x3f')]['limit']);_0x1b833c[_0xdaa7('0x2b')]=qs['offset'](_0x23d5fd[_0xdaa7('0x3f')]['offset']);}_0x1b833c[_0xdaa7('0x48')]=qs[_0xdaa7('0x49')](_0x23d5fd['query'][_0xdaa7('0x49')]);_0x1b833c[_0xdaa7('0x4a')]=qs[_0xdaa7('0x41')](_[_0xdaa7('0x4b')](_0x23d5fd[_0xdaa7('0x3f')],_0x37d756[_0xdaa7('0x41')]),_0x22ab20);if(_0x23d5fd[_0xdaa7('0x3f')]['filter']){_0x1b833c[_0xdaa7('0x4a')]=_[_0xdaa7('0x4c')](_0x1b833c[_0xdaa7('0x4a')],{'$or':_[_0xdaa7('0x3e')](_0x22ab20,function(_0x5c4d46){if(_0x5c4d46[_0xdaa7('0x3b')]!==_0xdaa7('0x4d')){var _0x31479c={};_0x31479c[_0x5c4d46[_0xdaa7('0x38')]]={'$like':'%'+_0x23d5fd['query'][_0xdaa7('0x4e')]+'%'};return _0x31479c;}})});}_0x1b833c=_[_0xdaa7('0x4c')]({},_0x1b833c,_0x23d5fd[_0xdaa7('0x4f')]);var _0x153a41={'where':_0x1b833c[_0xdaa7('0x4a')]};return db['VoiceContext'][_0xdaa7('0x2a')](_0x153a41)[_0xdaa7('0x31')](function(_0x2e6d4e){_0x16363c['count']=_0x2e6d4e;if(_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x50')]){_0x1b833c[_0xdaa7('0x51')]=[{'all':!![]}];}return db[_0xdaa7('0x52')][_0xdaa7('0x53')](_0x1b833c);})[_0xdaa7('0x31')](function(_0x48d1ae){_0x16363c[_0xdaa7('0x54')]=_0x48d1ae;return _0x16363c;})[_0xdaa7('0x31')](respondWithFilteredResult(_0x3b4f5f,_0x1b833c))[_0xdaa7('0x24')](handleError(_0x3b4f5f,null));};exports['show']=function(_0x5164cb,_0x49c77f){var _0x3e9951={'raw':![],'where':{'id':_0x5164cb['params']['id']}},_0x48fc4a={};_0x48fc4a[_0xdaa7('0x3d')]=_[_0xdaa7('0x40')](db[_0xdaa7('0x52')][_0xdaa7('0x55')]);_0x48fc4a[_0xdaa7('0x3f')]=_[_0xdaa7('0x40')](_0x5164cb[_0xdaa7('0x3f')]);_0x48fc4a[_0xdaa7('0x41')]=_[_0xdaa7('0x42')](_0x48fc4a[_0xdaa7('0x3d')],_0x48fc4a['query']);_0x3e9951[_0xdaa7('0x45')]=_[_0xdaa7('0x42')](_0x48fc4a[_0xdaa7('0x3d')],qs[_0xdaa7('0x43')](_0x5164cb[_0xdaa7('0x3f')][_0xdaa7('0x43')]));_0x3e9951['attributes']=_0x3e9951[_0xdaa7('0x45')][_0xdaa7('0x44')]?_0x3e9951['attributes']:_0x48fc4a[_0xdaa7('0x3d')];if(_0x5164cb[_0xdaa7('0x3f')][_0xdaa7('0x50')]){_0x3e9951[_0xdaa7('0x51')]=[{'all':!![]}];}_0x3e9951=_[_0xdaa7('0x4c')]({},_0x3e9951,_0x5164cb['options']);return db[_0xdaa7('0x52')][_0xdaa7('0x56')](_0x3e9951)['then'](handleEntityNotFound(_0x49c77f,null))[_0xdaa7('0x31')](respondWithResult(_0x49c77f,null))['catch'](handleError(_0x49c77f,null));};exports[_0xdaa7('0x57')]=function(_0x27f423,_0x5432d8,_0x4eef19){var _0x5b095b;return db[_0xdaa7('0x52')][_0xdaa7('0x57')](_0x27f423[_0xdaa7('0x58')],{'raw':!![]})[_0xdaa7('0x31')](function(_0x2563d5){_0x5b095b=_0x2563d5;return db[_0xdaa7('0x52')]['findAll']({'raw':!![]});})[_0xdaa7('0x31')](function(_0x396fcc){var _0x5216ec=fs[_0xdaa7('0x59')](path['join'](config[_0xdaa7('0x5a')],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x2924b1=ejs[_0xdaa7('0x5d')](_0x5216ec,{'contexts':_0x396fcc||[]});fs['writeFileSync'](_0xdaa7('0x5e'),_0x2924b1);})['then'](function(){return respondWithRpcPromise(_0xdaa7('0x5f'),'create',{'module':_0xdaa7('0x60')});})['then'](function(){var _0x14ffb2=_0x27f423[_0xdaa7('0x61')]['get']({'plain':!![]});if(!_0x14ffb2)throw new Error(_0xdaa7('0x62'));if(_0x14ffb2[_0xdaa7('0x63')]==='user'){var _0x5bf5d0=_0x5b095b['get']({'plain':!![]});return db[_0xdaa7('0x64')][_0xdaa7('0x56')]({'where':{'name':_0xdaa7('0x34'),'userProfileId':_0x14ffb2['userProfileId']},'raw':!![]})[_0xdaa7('0x31')](function(_0x47730b){if(_0x47730b&&_0x47730b[_0xdaa7('0x65')]===0x0){return db['UserProfileResource'][_0xdaa7('0x57')]({'name':_0x5bf5d0[_0xdaa7('0x38')],'resourceId':_0x5bf5d0['id'],'type':_0x47730b['name'],'sectionId':_0x47730b['id']},{})[_0xdaa7('0x31')](function(){return _0x5b095b;});}else{return _0x5b095b;}})[_0xdaa7('0x24')](function(_0x289048){logger[_0xdaa7('0x20')](_0xdaa7('0x66'),_0x289048);throw _0x289048;});}return _0x5b095b;})['then'](respondWithResult(_0x5432d8,0xc9))[_0xdaa7('0x24')](handleError(_0x5432d8,null));};exports[_0xdaa7('0x30')]=function(_0x2f84ce,_0x405423,_0x4ac7f0){var _0x749a16;return db['VoiceContext']['find']({'where':{'id':_0x2f84ce[_0xdaa7('0x67')]['id']}})['then'](handleEntityNotFound(_0x405423,null))[_0xdaa7('0x31')](saveUpdates(_0x2f84ce[_0xdaa7('0x58')],null))[_0xdaa7('0x31')](function(_0x4ccbb0){if(_0x4ccbb0){_0x749a16=_0x4ccbb0;return db[_0xdaa7('0x52')][_0xdaa7('0x53')]({'raw':!![]});}})[_0xdaa7('0x31')](function(_0x1fe9bb){var _0x5d97ce=fs[_0xdaa7('0x59')](path[_0xdaa7('0x68')](config['root'],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x368f0a=ejs[_0xdaa7('0x5d')](_0x5d97ce,{'contexts':_0x1fe9bb||[]});fs[_0xdaa7('0x69')](_0xdaa7('0x5e'),_0x368f0a);})[_0xdaa7('0x31')](function(){return respondWithRpcPromise(_0xdaa7('0x5f'),_0xdaa7('0x30'),{'module':_0xdaa7('0x60')});})[_0xdaa7('0x31')](function(){return _0x749a16;})['then'](respondWithResult(_0x405423,null))[_0xdaa7('0x24')](handleError(_0x405423,null));};exports['destroy']=function(_0x25bd1e,_0x4c9772,_0x47ca59){var _0x7454b8;return db[_0xdaa7('0x52')][_0xdaa7('0x56')]({'where':{'id':_0x25bd1e[_0xdaa7('0x67')]['id']}})[_0xdaa7('0x31')](handleEntityNotFound(_0x4c9772,null))[_0xdaa7('0x31')](removeEntity(_0x4c9772,null))[_0xdaa7('0x31')](function(){return db[_0xdaa7('0x52')][_0xdaa7('0x53')]({'raw':!![]});})[_0xdaa7('0x31')](function(_0x595195){var _0x6673df=fs[_0xdaa7('0x59')](path[_0xdaa7('0x68')](config[_0xdaa7('0x5a')],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x220064=ejs[_0xdaa7('0x5d')](_0x6673df,{'contexts':_0x595195});fs[_0xdaa7('0x69')](_0xdaa7('0x5e'),_0x220064);return respondWithRpcPromise(_0xdaa7('0x5f'),_0xdaa7('0x32'),{'module':'chan_sip.so'});})[_0xdaa7('0x24')](handleError(_0x4c9772,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 148c151..a58d9fe 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 _0xa765=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xa765,0xe7));var _0x5a76=function(_0x5c96af,_0x4ac7f8){_0x5c96af=_0x5c96af-0x0;var _0x387b15=_0xa765[_0x5c96af];return _0x387b15;};'use strict';var _=require(_0x5a76('0x0'));var util=require(_0x5a76('0x1'));var logger=require(_0x5a76('0x2'))('api');var moment=require(_0x5a76('0x3'));var BPromise=require(_0x5a76('0x4'));var rp=require(_0x5a76('0x5'));var fs=require('fs');var path=require(_0x5a76('0x6'));var rimraf=require(_0x5a76('0x7'));var config=require(_0x5a76('0x8'));var attributes=require(_0x5a76('0x9'));module[_0x5a76('0xa')]=function(_0x193a36,_0x1de31a){return _0x193a36[_0x5a76('0xb')](_0x5a76('0xc'),attributes,{'tableName':_0x5a76('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22be=['rimraf','exports','define','voice_contexts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x30348f,_0x3f7f64){var _0x4e61cc=function(_0x5e6b1b){while(--_0x5e6b1b){_0x30348f['push'](_0x30348f['shift']());}};_0x4e61cc(++_0x3f7f64);}(_0x22be,0x108));var _0xe22b=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x22be[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0xe22b('0x0'));var util=require(_0xe22b('0x1'));var logger=require(_0xe22b('0x2'))('api');var moment=require(_0xe22b('0x3'));var BPromise=require(_0xe22b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe22b('0x5'));var rimraf=require(_0xe22b('0x6'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xe22b('0x7')]=function(_0x4d91a9,_0xaa0ac9){return _0x4d91a9[_0xe22b('0x8')]('VoiceContext',attributes,{'tableName':_0xe22b('0x9'),'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 a37a941..5f6d3d0 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 _0x9d62=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x15f1a5,_0x1b1e5a){var _0x415422=function(_0x16b34e){while(--_0x16b34e){_0x15f1a5['push'](_0x15f1a5['shift']());}};_0x415422(++_0x1b1e5a);}(_0x9d62,0xaf));var _0x29d6=function(_0x5e9a5a,_0x3f2bd2){_0x5e9a5a=_0x5e9a5a-0x0;var _0x1ff058=_0x9d62[_0x5e9a5a];return _0x1ff058;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var moment=require(_0x29d6('0x2'));var BPromise=require(_0x29d6('0x3'));var rs=require(_0x29d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d6('0x5'))['db'];var utils=require(_0x29d6('0x6'));var logger=require(_0x29d6('0x7'))(_0x29d6('0x8'));var config=require(_0x29d6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x29d6('0xa')][_0x29d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xef4a2c,_0x158dd2,_0x243871){return new BPromise(function(_0x35b6cf,_0x547bfd){return client[_0x29d6('0xc')](_0xef4a2c,_0x243871)[_0x29d6('0xd')](function(_0x91a20d){logger[_0x29d6('0xe')](_0x29d6('0xf'),_0x158dd2,_0x29d6('0x10'));logger[_0x29d6('0x11')](_0x29d6('0x12'),_0x158dd2,'request\x20sent',JSON[_0x29d6('0x13')](_0x91a20d));if(_0x91a20d[_0x29d6('0x14')]){if(_0x91a20d[_0x29d6('0x14')][_0x29d6('0x15')]===0x1f4){logger[_0x29d6('0x14')](_0x29d6('0xf'),_0x158dd2,_0x91a20d[_0x29d6('0x14')]['message']);return _0x547bfd(_0x91a20d[_0x29d6('0x14')]['message']);}logger[_0x29d6('0x14')](_0x29d6('0xf'),_0x158dd2,_0x91a20d[_0x29d6('0x14')][_0x29d6('0x16')]);return _0x35b6cf(_0x91a20d['error']['message']);}else{logger['info'](_0x29d6('0xf'),_0x158dd2,_0x29d6('0x10'));_0x35b6cf(_0x91a20d[_0x29d6('0x17')][_0x29d6('0x16')]);}})[_0x29d6('0x18')](function(_0x27bb4b){logger[_0x29d6('0x14')]('VoiceContext,\x20%s,\x20%s',_0x158dd2,_0x27bb4b);_0x547bfd(_0x27bb4b);});});} \ No newline at end of file +var _0xfe36=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xfe36,0x1b6));var _0x6fe3=function(_0x419676,_0xfcdcb9){_0x419676=_0x419676-0x0;var _0x4eee1d=_0xfe36[_0x419676];return _0x4eee1d;};'use strict';var _=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var moment=require('moment');var BPromise=require(_0x6fe3('0x2'));var rs=require(_0x6fe3('0x3'));var fs=require('fs');var Redis=require(_0x6fe3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fe3('0x5'));var logger=require(_0x6fe3('0x6'))(_0x6fe3('0x7'));var config=require(_0x6fe3('0x8'));var jayson=require(_0x6fe3('0x9'));var client=jayson[_0x6fe3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef797,_0x36998c,_0x373ed8){return new BPromise(function(_0x3b725c,_0x55e152){return client[_0x6fe3('0xb')](_0x5ef797,_0x373ed8)[_0x6fe3('0xc')](function(_0x5242de){logger[_0x6fe3('0xd')](_0x6fe3('0xe'),_0x36998c,_0x6fe3('0xf'));logger[_0x6fe3('0x10')](_0x6fe3('0x11'),_0x36998c,_0x6fe3('0xf'),JSON[_0x6fe3('0x12')](_0x5242de));if(_0x5242de['error']){if(_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x14')]===0x1f4){logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);return _0x55e152(_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);}logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);return _0x3b725c(_0x5242de['error']['message']);}else{logger[_0x6fe3('0xd')]('VoiceContext,\x20%s,\x20%s',_0x36998c,_0x6fe3('0xf'));_0x3b725c(_0x5242de[_0x6fe3('0x16')][_0x6fe3('0x15')]);}})[_0x6fe3('0x17')](function(_0x5dea64){logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5dea64);_0x55e152(_0x5dea64);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c6a57f9..b3682d2 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 _0x1d81=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bdc6e,_0x5aed16){var _0xad537e=function(_0x1ec66d){while(--_0x1ec66d){_0x1bdc6e['push'](_0x1bdc6e['shift']());}};_0xad537e(++_0x5aed16);}(_0x1d81,0x64));var _0x11d8=function(_0x37bf43,_0x5b2339){_0x37bf43=_0x37bf43-0x0;var _0x4101c5=_0x1d81[_0x37bf43];return _0x4101c5;};'use strict';var multer=require(_0x11d8('0x0'));var util=require(_0x11d8('0x1'));var path=require(_0x11d8('0x2'));var timeout=require(_0x11d8('0x3'));var express=require(_0x11d8('0x4'));var router=express[_0x11d8('0x5')]();var fs_extra=require(_0x11d8('0x6'));var auth=require(_0x11d8('0x7'));var interaction=require(_0x11d8('0x8'));var config=require(_0x11d8('0x9'));var controller=require(_0x11d8('0xa'));router[_0x11d8('0xb')]('/',auth[_0x11d8('0xc')](),controller[_0x11d8('0xd')]);router[_0x11d8('0xb')](_0x11d8('0xe'),auth[_0x11d8('0xc')](),controller[_0x11d8('0xf')]);router[_0x11d8('0xb')](_0x11d8('0x10'),auth['isAuthenticated'](),controller[_0x11d8('0x11')]);router['post']('/',auth[_0x11d8('0xc')](),controller[_0x11d8('0x12')]);router[_0x11d8('0x13')](_0x11d8('0x10'),auth[_0x11d8('0xc')](),controller['update']);router['delete'](_0x11d8('0x10'),auth[_0x11d8('0xc')](),controller[_0x11d8('0x14')]);module[_0x11d8('0x15')]=router; \ No newline at end of file +var _0x59a0=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0xbd9d14,_0x399efb){var _0x382602=function(_0x2ca7e1){while(--_0x2ca7e1){_0xbd9d14['push'](_0xbd9d14['shift']());}};_0x382602(++_0x399efb);}(_0x59a0,0x184));var _0x059a=function(_0x4ad5a2,_0x2f7245){_0x4ad5a2=_0x4ad5a2-0x0;var _0x1bdbe6=_0x59a0[_0x4ad5a2];return _0x1bdbe6;};'use strict';var multer=require(_0x059a('0x0'));var util=require(_0x059a('0x1'));var path=require(_0x059a('0x2'));var timeout=require('connect-timeout');var express=require(_0x059a('0x3'));var router=express[_0x059a('0x4')]();var fs_extra=require(_0x059a('0x5'));var auth=require(_0x059a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x059a('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x059a('0x8')](),controller['index']);router[_0x059a('0x9')](_0x059a('0xa'),auth[_0x059a('0x8')](),controller[_0x059a('0xb')]);router[_0x059a('0x9')](_0x059a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x059a('0xd')]('/',auth[_0x059a('0x8')](),controller[_0x059a('0xe')]);router[_0x059a('0xf')](_0x059a('0xc'),auth[_0x059a('0x8')](),controller[_0x059a('0x10')]);router[_0x059a('0x11')]('/:id',auth[_0x059a('0x8')](),controller[_0x059a('0x12')]);module[_0x059a('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 13fdd2d..e3baee6 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3de142,_0x480197){var _0x33f1df=function(_0x1c0f40){while(--_0x1c0f40){_0x3de142['push'](_0x3de142['shift']());}};_0x33f1df(++_0x480197);}(_0xbec5,0xe5));var _0x5bec=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xbec5[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x103f99,_0x447300){var _0x4a972b=function(_0x1ef0c8){while(--_0x1ef0c8){_0x103f99['push'](_0x103f99['shift']());}};_0x4a972b(++_0x447300);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d7668,_0x5eb4e6){_0x3d7668=_0x3d7668-0x0;var _0x3d6711=_0xa41a[_0x3d7668];return _0x3d6711;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ef07942..fd6ac6c 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 _0xc18c=['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/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','end','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','map','options','count','findAll','catch','show','params','includeAll','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x2e887e,_0x4c14db){var _0x1c0f65=function(_0x58701f){while(--_0x58701f){_0x2e887e['push'](_0x2e887e['shift']());}};_0x1c0f65(++_0x4c14db);}(_0xc18c,0xd5));var _0xcc18=function(_0xa63acf,_0x5c6a28){_0xa63acf=_0xa63acf-0x0;var _0x542621=_0xc18c[_0xa63acf];return _0x542621;};'use strict';var emlformat=require(_0xcc18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc18('0x2'));var moment=require(_0xcc18('0x3'));var BPromise=require(_0xcc18('0x4'));var Mustache=require(_0xcc18('0x5'));var util=require(_0xcc18('0x6'));var path=require('path');var sox=require(_0xcc18('0x7'));var csv=require(_0xcc18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc18('0x9'));var _=require(_0xcc18('0xa'));var squel=require(_0xcc18('0xb'));var crypto=require(_0xcc18('0xc'));var jsforce=require(_0xcc18('0xd'));var deskjs=require(_0xcc18('0xe'));var toCsv=require(_0xcc18('0x8'));var querystring=require(_0xcc18('0xf'));var Papa=require(_0xcc18('0x10'));var Redis=require(_0xcc18('0x11'));var authService=require(_0xcc18('0x12'));var qs=require(_0xcc18('0x13'));var as=require(_0xcc18('0x14'));var hardwareService=require(_0xcc18('0x15'));var logger=require(_0xcc18('0x16'))(_0xcc18('0x17'));var utils=require(_0xcc18('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcc18('0x19'));var db=require(_0xcc18('0x1a'))['db'];function respondWithStatusCode(_0x1b9883,_0x4f4de4){_0x4f4de4=_0x4f4de4||0xcc;return function(_0x52f579){if(_0x52f579){return _0x1b9883[_0xcc18('0x1b')](_0x4f4de4);}return _0x1b9883[_0xcc18('0x1c')](_0x4f4de4)['end']();};}function respondWithResult(_0x205fdf,_0x9dc895){_0x9dc895=_0x9dc895||0xc8;return function(_0x1fa1ed){if(_0x1fa1ed){return _0x205fdf[_0xcc18('0x1c')](_0x9dc895)['json'](_0x1fa1ed);}};}function respondWithFilteredResult(_0x4602a5,_0x5e59c5){return function(_0x34e4bf){if(_0x34e4bf){var _0x1bafca=typeof _0x5e59c5[_0xcc18('0x1d')]===_0xcc18('0x1e')&&typeof _0x5e59c5[_0xcc18('0x1f')]===_0xcc18('0x1e');var _0x36dc6d=_0x34e4bf['count'];var _0x3b6222=_0x1bafca?0x0:_0x5e59c5[_0xcc18('0x1d')];var _0x4ec816=_0x1bafca?_0x34e4bf['count']:_0x5e59c5[_0xcc18('0x1d')]+_0x5e59c5[_0xcc18('0x1f')];var _0x233fed;if(_0x4ec816>=_0x36dc6d){_0x4ec816=_0x36dc6d;_0x233fed=0xc8;}else{_0x233fed=0xce;}_0x4602a5[_0xcc18('0x1c')](_0x233fed);return _0x4602a5[_0xcc18('0x20')](_0xcc18('0x21'),_0x3b6222+'-'+_0x4ec816+'/'+_0x36dc6d)[_0xcc18('0x22')](_0x34e4bf);}return null;};}function patchUpdates(_0x21c6e1){return function(_0x393e87){try{jsonpatch['apply'](_0x393e87,_0x21c6e1,!![]);}catch(_0x2a9e4b){return BPromise[_0xcc18('0x23')](_0x2a9e4b);}return _0x393e87['save']();};}function saveUpdates(_0x273c13,_0x190aea){return function(_0x1c3477){if(_0x1c3477){return _0x1c3477[_0xcc18('0x24')](_0x273c13)[_0xcc18('0x25')](function(_0x1c9a22){return _0x1c9a22;});}return null;};}function removeEntity(_0x4c06d9,_0x44488f){return function(_0x693d20){if(_0x693d20){return _0x693d20[_0xcc18('0x26')]()[_0xcc18('0x25')](function(){_0x4c06d9['status'](0xcc)[_0xcc18('0x27')]();});}};}function handleEntityNotFound(_0x4e8e46,_0x24503b){return function(_0x245393){if(!_0x245393){_0x4e8e46[_0xcc18('0x1b')](0x194);}return _0x245393;};}function handleError(_0x2d1170,_0x289aca){_0x289aca=_0x289aca||0x1f4;return function(_0x3a7998){logger[_0xcc18('0x28')](_0x3a7998['stack']);if(_0x3a7998[_0xcc18('0x29')]){delete _0x3a7998[_0xcc18('0x29')];}_0x2d1170[_0xcc18('0x1c')](_0x289aca)[_0xcc18('0x2a')](_0x3a7998);};}exports[_0xcc18('0x2b')]=function(_0x8d064e,_0x31df24){var _0x4ecc31={},_0x396aea={},_0x49bd53={'count':0x0,'rows':[]};var _0x56877b=_['map'](db[_0xcc18('0x2c')][_0xcc18('0x2d')],function(_0x143a67){return{'name':_0x143a67[_0xcc18('0x2e')],'type':_0x143a67['type'][_0xcc18('0x2f')]};});_0x396aea[_0xcc18('0x30')]=_['map'](_0x56877b,_0xcc18('0x29'));_0x396aea[_0xcc18('0x31')]=_[_0xcc18('0x32')](_0x8d064e[_0xcc18('0x31')]);_0x396aea['filters']=_[_0xcc18('0x33')](_0x396aea[_0xcc18('0x30')],_0x396aea['query']);_0x4ecc31[_0xcc18('0x34')]=_[_0xcc18('0x33')](_0x396aea[_0xcc18('0x30')],qs[_0xcc18('0x35')](_0x8d064e[_0xcc18('0x31')][_0xcc18('0x35')]));_0x4ecc31[_0xcc18('0x34')]=_0x4ecc31[_0xcc18('0x34')][_0xcc18('0x36')]?_0x4ecc31[_0xcc18('0x34')]:_0x396aea[_0xcc18('0x30')];if(!_0x8d064e['query']['hasOwnProperty']('nolimit')){_0x4ecc31[_0xcc18('0x1f')]=qs[_0xcc18('0x1f')](_0x8d064e[_0xcc18('0x31')][_0xcc18('0x1f')]);_0x4ecc31['offset']=qs[_0xcc18('0x1d')](_0x8d064e[_0xcc18('0x31')]['offset']);}_0x4ecc31['order']=qs[_0xcc18('0x37')](_0x8d064e[_0xcc18('0x31')][_0xcc18('0x37')]);_0x4ecc31[_0xcc18('0x38')]=qs[_0xcc18('0x39')](_[_0xcc18('0x3a')](_0x8d064e[_0xcc18('0x31')],_0x396aea[_0xcc18('0x39')]),_0x56877b);if(_0x8d064e[_0xcc18('0x31')][_0xcc18('0x3b')]){_0x4ecc31[_0xcc18('0x38')]=_[_0xcc18('0x3c')](_0x4ecc31[_0xcc18('0x38')],{'$or':_[_0xcc18('0x3d')](_0x56877b,function(_0x139ddb){if(_0x139ddb['type']!=='VIRTUAL'){var _0x4feaed={};_0x4feaed[_0x139ddb['name']]={'$like':'%'+_0x8d064e[_0xcc18('0x31')][_0xcc18('0x3b')]+'%'};return _0x4feaed;}})});}_0x4ecc31=_[_0xcc18('0x3c')]({},_0x4ecc31,_0x8d064e[_0xcc18('0x3e')]);var _0x16e15e={'where':_0x4ecc31[_0xcc18('0x38')]};return db[_0xcc18('0x2c')][_0xcc18('0x3f')](_0x16e15e)['then'](function(_0xa098){_0x49bd53['count']=_0xa098;if(_0x8d064e['query']['includeAll']){_0x4ecc31['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xcc18('0x40')](_0x4ecc31);})[_0xcc18('0x25')](function(_0x4428f0){_0x49bd53['rows']=_0x4428f0;return _0x49bd53;})[_0xcc18('0x25')](respondWithFilteredResult(_0x31df24,_0x4ecc31))[_0xcc18('0x41')](handleError(_0x31df24,null));};exports[_0xcc18('0x42')]=function(_0x3d95bf,_0x4b53a9){var _0x3c2767={'raw':!![],'where':{'id':_0x3d95bf[_0xcc18('0x43')]['id']}},_0x2beefc={};_0x2beefc[_0xcc18('0x30')]=_[_0xcc18('0x32')](db['VoiceDialReport']['rawAttributes']);_0x2beefc[_0xcc18('0x31')]=_[_0xcc18('0x32')](_0x3d95bf[_0xcc18('0x31')]);_0x2beefc[_0xcc18('0x39')]=_[_0xcc18('0x33')](_0x2beefc[_0xcc18('0x30')],_0x2beefc[_0xcc18('0x31')]);_0x3c2767[_0xcc18('0x34')]=_[_0xcc18('0x33')](_0x2beefc[_0xcc18('0x30')],qs['fields'](_0x3d95bf['query'][_0xcc18('0x35')]));_0x3c2767[_0xcc18('0x34')]=_0x3c2767[_0xcc18('0x34')][_0xcc18('0x36')]?_0x3c2767['attributes']:_0x2beefc[_0xcc18('0x30')];if(_0x3d95bf[_0xcc18('0x31')][_0xcc18('0x44')]){_0x3c2767[_0xcc18('0x45')]=[{'all':!![]}];}_0x3c2767=_[_0xcc18('0x3c')]({},_0x3c2767,_0x3d95bf[_0xcc18('0x3e')]);return db[_0xcc18('0x2c')][_0xcc18('0x46')](_0x3c2767)[_0xcc18('0x25')](handleEntityNotFound(_0x4b53a9,null))[_0xcc18('0x25')](respondWithResult(_0x4b53a9,null))['catch'](handleError(_0x4b53a9,null));};exports[_0xcc18('0x47')]=function(_0x4c09ae,_0x1aff41){return db[_0xcc18('0x2c')]['create'](_0x4c09ae[_0xcc18('0x48')],{})[_0xcc18('0x25')](respondWithResult(_0x1aff41,0xc9))['catch'](handleError(_0x1aff41,null));};exports[_0xcc18('0x24')]=function(_0x301662,_0x2cd1c0){if(_0x301662[_0xcc18('0x48')]['id']){delete _0x301662['body']['id'];}return db[_0xcc18('0x2c')][_0xcc18('0x46')]({'where':{'id':_0x301662[_0xcc18('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cd1c0,null))[_0xcc18('0x25')](saveUpdates(_0x301662['body'],null))[_0xcc18('0x25')](respondWithResult(_0x2cd1c0,null))[_0xcc18('0x41')](handleError(_0x2cd1c0,null));};exports[_0xcc18('0x26')]=function(_0xcf5da2,_0xd82e23){return db['VoiceDialReport'][_0xcc18('0x46')]({'where':{'id':_0xcf5da2['params']['id']}})[_0xcc18('0x25')](handleEntityNotFound(_0xd82e23,null))['then'](removeEntity(_0xd82e23,null))[_0xcc18('0x41')](handleError(_0xd82e23,null));};exports[_0xcc18('0x49')]=function(_0x20b508,_0x41165e){return db[_0xcc18('0x2c')][_0xcc18('0x49')]()['then'](respondWithResult(_0x41165e,null))[_0xcc18('0x41')](handleError(_0x41165e,null));}; \ No newline at end of file +var _0xdbc9=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','save','update','then','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','describe','rimraf','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdbc9,0x1b4));var _0x9dbc=function(_0x22fcfa,_0x217372){_0x22fcfa=_0x22fcfa-0x0;var _0x4ebc17=_0xdbc9[_0x22fcfa];return _0x4ebc17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9dbc('0x1'));var moment=require(_0x9dbc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9dbc('0x3'));var util=require(_0x9dbc('0x4'));var path=require(_0x9dbc('0x5'));var sox=require(_0x9dbc('0x6'));var csv=require(_0x9dbc('0x7'));var ejs=require(_0x9dbc('0x8'));var fs=require('fs');var fs_extra=require(_0x9dbc('0x9'));var _=require(_0x9dbc('0xa'));var squel=require(_0x9dbc('0xb'));var crypto=require(_0x9dbc('0xc'));var jsforce=require(_0x9dbc('0xd'));var deskjs=require(_0x9dbc('0xe'));var toCsv=require(_0x9dbc('0x7'));var querystring=require(_0x9dbc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9dbc('0x10'));var qs=require(_0x9dbc('0x11'));var as=require(_0x9dbc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dbc('0x13'))(_0x9dbc('0x14'));var utils=require(_0x9dbc('0x15'));var config=require(_0x9dbc('0x16'));var licenseUtil=require(_0x9dbc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2677,_0x428acd){_0x428acd=_0x428acd||0xcc;return function(_0x4978b2){if(_0x4978b2){return _0x4c2677[_0x9dbc('0x18')](_0x428acd);}return _0x4c2677[_0x9dbc('0x19')](_0x428acd)[_0x9dbc('0x1a')]();};}function respondWithResult(_0x1cce1a,_0x1bb901){_0x1bb901=_0x1bb901||0xc8;return function(_0x8b71c0){if(_0x8b71c0){return _0x1cce1a[_0x9dbc('0x19')](_0x1bb901)['json'](_0x8b71c0);}};}function respondWithFilteredResult(_0xc73906,_0x1fc8fb){return function(_0x321d23){if(_0x321d23){var _0x585580=typeof _0x1fc8fb['offset']===_0x9dbc('0x1b')&&typeof _0x1fc8fb[_0x9dbc('0x1c')]==='undefined';var _0x2e585a=_0x321d23[_0x9dbc('0x1d')];var _0x4952a8=_0x585580?0x0:_0x1fc8fb[_0x9dbc('0x1e')];var _0x235044=_0x585580?_0x321d23[_0x9dbc('0x1d')]:_0x1fc8fb[_0x9dbc('0x1e')]+_0x1fc8fb[_0x9dbc('0x1c')];var _0x4e9101;if(_0x235044>=_0x2e585a){_0x235044=_0x2e585a;_0x4e9101=0xc8;}else{_0x4e9101=0xce;}_0xc73906[_0x9dbc('0x19')](_0x4e9101);return _0xc73906['set'](_0x9dbc('0x1f'),_0x4952a8+'-'+_0x235044+'/'+_0x2e585a)['json'](_0x321d23);}return null;};}function patchUpdates(_0x31d0c2){return function(_0x52b34b){try{jsonpatch['apply'](_0x52b34b,_0x31d0c2,!![]);}catch(_0x22ff51){return BPromise['reject'](_0x22ff51);}return _0x52b34b[_0x9dbc('0x20')]();};}function saveUpdates(_0xbcc904,_0x2dc300){return function(_0x5df5da){if(_0x5df5da){return _0x5df5da[_0x9dbc('0x21')](_0xbcc904)[_0x9dbc('0x22')](function(_0x103617){return _0x103617;});}return null;};}function removeEntity(_0x19e449,_0x592324){return function(_0x51f946){if(_0x51f946){return _0x51f946[_0x9dbc('0x23')]()[_0x9dbc('0x22')](function(){_0x19e449[_0x9dbc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38be33,_0x484a52){return function(_0x43d63c){if(!_0x43d63c){_0x38be33[_0x9dbc('0x18')](0x194);}return _0x43d63c;};}function handleError(_0x31e533,_0x21d3c8){_0x21d3c8=_0x21d3c8||0x1f4;return function(_0x8d551f){logger['error'](_0x8d551f[_0x9dbc('0x24')]);if(_0x8d551f[_0x9dbc('0x25')]){delete _0x8d551f[_0x9dbc('0x25')];}_0x31e533[_0x9dbc('0x19')](_0x21d3c8)[_0x9dbc('0x26')](_0x8d551f);};}exports[_0x9dbc('0x27')]=function(_0x235970,_0x4ee081){var _0x5be05b={},_0xb5ba12={},_0x29f807={'count':0x0,'rows':[]};var _0x175bbb=_[_0x9dbc('0x28')](db[_0x9dbc('0x29')][_0x9dbc('0x2a')],function(_0xb59574){return{'name':_0xb59574[_0x9dbc('0x2b')],'type':_0xb59574[_0x9dbc('0x2c')][_0x9dbc('0x2d')]};});_0xb5ba12[_0x9dbc('0x2e')]=_[_0x9dbc('0x28')](_0x175bbb,'name');_0xb5ba12['query']=_[_0x9dbc('0x2f')](_0x235970[_0x9dbc('0x30')]);_0xb5ba12[_0x9dbc('0x31')]=_['intersection'](_0xb5ba12['model'],_0xb5ba12[_0x9dbc('0x30')]);_0x5be05b[_0x9dbc('0x32')]=_[_0x9dbc('0x33')](_0xb5ba12[_0x9dbc('0x2e')],qs['fields'](_0x235970[_0x9dbc('0x30')]['fields']));_0x5be05b[_0x9dbc('0x32')]=_0x5be05b[_0x9dbc('0x32')][_0x9dbc('0x34')]?_0x5be05b[_0x9dbc('0x32')]:_0xb5ba12[_0x9dbc('0x2e')];if(!_0x235970[_0x9dbc('0x30')]['hasOwnProperty'](_0x9dbc('0x35'))){_0x5be05b[_0x9dbc('0x1c')]=qs['limit'](_0x235970['query'][_0x9dbc('0x1c')]);_0x5be05b[_0x9dbc('0x1e')]=qs['offset'](_0x235970[_0x9dbc('0x30')][_0x9dbc('0x1e')]);}_0x5be05b['order']=qs['sort'](_0x235970['query'][_0x9dbc('0x36')]);_0x5be05b['where']=qs['filters'](_[_0x9dbc('0x37')](_0x235970['query'],_0xb5ba12[_0x9dbc('0x31')]),_0x175bbb);if(_0x235970[_0x9dbc('0x30')][_0x9dbc('0x38')]){_0x5be05b[_0x9dbc('0x39')]=_[_0x9dbc('0x3a')](_0x5be05b['where'],{'$or':_['map'](_0x175bbb,function(_0x2cedb3){if(_0x2cedb3[_0x9dbc('0x2c')]!==_0x9dbc('0x3b')){var _0x35ee2d={};_0x35ee2d[_0x2cedb3['name']]={'$like':'%'+_0x235970['query'][_0x9dbc('0x38')]+'%'};return _0x35ee2d;}})});}_0x5be05b=_['merge']({},_0x5be05b,_0x235970[_0x9dbc('0x3c')]);var _0x3a429b={'where':_0x5be05b[_0x9dbc('0x39')]};return db[_0x9dbc('0x29')][_0x9dbc('0x1d')](_0x3a429b)[_0x9dbc('0x22')](function(_0x488227){_0x29f807[_0x9dbc('0x1d')]=_0x488227;if(_0x235970[_0x9dbc('0x30')][_0x9dbc('0x3d')]){_0x5be05b['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x9dbc('0x3e')](_0x5be05b);})['then'](function(_0x295711){_0x29f807[_0x9dbc('0x3f')]=_0x295711;return _0x29f807;})['then'](respondWithFilteredResult(_0x4ee081,_0x5be05b))[_0x9dbc('0x40')](handleError(_0x4ee081,null));};exports[_0x9dbc('0x41')]=function(_0x33c04d,_0x9b6e2f){var _0x1b25fd={'raw':!![],'where':{'id':_0x33c04d['params']['id']}},_0x55c97f={};_0x55c97f[_0x9dbc('0x2e')]=_[_0x9dbc('0x2f')](db[_0x9dbc('0x29')][_0x9dbc('0x2a')]);_0x55c97f[_0x9dbc('0x30')]=_['keys'](_0x33c04d[_0x9dbc('0x30')]);_0x55c97f[_0x9dbc('0x31')]=_[_0x9dbc('0x33')](_0x55c97f[_0x9dbc('0x2e')],_0x55c97f[_0x9dbc('0x30')]);_0x1b25fd[_0x9dbc('0x32')]=_[_0x9dbc('0x33')](_0x55c97f[_0x9dbc('0x2e')],qs[_0x9dbc('0x42')](_0x33c04d[_0x9dbc('0x30')][_0x9dbc('0x42')]));_0x1b25fd[_0x9dbc('0x32')]=_0x1b25fd[_0x9dbc('0x32')][_0x9dbc('0x34')]?_0x1b25fd['attributes']:_0x55c97f[_0x9dbc('0x2e')];if(_0x33c04d['query'][_0x9dbc('0x3d')]){_0x1b25fd[_0x9dbc('0x43')]=[{'all':!![]}];}_0x1b25fd=_['merge']({},_0x1b25fd,_0x33c04d[_0x9dbc('0x3c')]);return db[_0x9dbc('0x29')][_0x9dbc('0x44')](_0x1b25fd)[_0x9dbc('0x22')](handleEntityNotFound(_0x9b6e2f,null))['then'](respondWithResult(_0x9b6e2f,null))[_0x9dbc('0x40')](handleError(_0x9b6e2f,null));};exports[_0x9dbc('0x45')]=function(_0xf31301,_0x38c823){return db[_0x9dbc('0x29')][_0x9dbc('0x45')](_0xf31301['body'],{})[_0x9dbc('0x22')](respondWithResult(_0x38c823,0xc9))[_0x9dbc('0x40')](handleError(_0x38c823,null));};exports['update']=function(_0x319268,_0x15d627){if(_0x319268[_0x9dbc('0x46')]['id']){delete _0x319268[_0x9dbc('0x46')]['id'];}return db[_0x9dbc('0x29')]['find']({'where':{'id':_0x319268[_0x9dbc('0x47')]['id']}})[_0x9dbc('0x22')](handleEntityNotFound(_0x15d627,null))[_0x9dbc('0x22')](saveUpdates(_0x319268[_0x9dbc('0x46')],null))[_0x9dbc('0x22')](respondWithResult(_0x15d627,null))['catch'](handleError(_0x15d627,null));};exports[_0x9dbc('0x23')]=function(_0xe78e0,_0x532944){return db[_0x9dbc('0x29')][_0x9dbc('0x44')]({'where':{'id':_0xe78e0[_0x9dbc('0x47')]['id']}})['then'](handleEntityNotFound(_0x532944,null))[_0x9dbc('0x22')](removeEntity(_0x532944,null))[_0x9dbc('0x40')](handleError(_0x532944,null));};exports[_0x9dbc('0x48')]=function(_0x5a71de,_0x500ead){return db[_0x9dbc('0x29')][_0x9dbc('0x48')]()['then'](respondWithResult(_0x500ead,null))['catch'](handleError(_0x500ead,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 45c9f9f..5391661 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 _0x6e9b=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','api','moment','bluebird','request-promise'];(function(_0x11dea1,_0x4e876a){var _0x37b92a=function(_0x2412b5){while(--_0x2412b5){_0x11dea1['push'](_0x11dea1['shift']());}};_0x37b92a(++_0x4e876a);}(_0x6e9b,0x1e4));var _0xb6e9=function(_0x62371,_0x5abc21){_0x62371=_0x62371-0x0;var _0x1d6dcc=_0x6e9b[_0x62371];return _0x1d6dcc;};'use strict';var _=require(_0xb6e9('0x0'));var util=require(_0xb6e9('0x1'));var logger=require('../../config/logger')(_0xb6e9('0x2'));var moment=require(_0xb6e9('0x3'));var BPromise=require(_0xb6e9('0x4'));var rp=require(_0xb6e9('0x5'));var fs=require('fs');var path=require(_0xb6e9('0x6'));var rimraf=require(_0xb6e9('0x7'));var config=require(_0xb6e9('0x8'));var attributes=require(_0xb6e9('0x9'));module[_0xb6e9('0xa')]=function(_0x4b64ce,_0x216e08){return _0x4b64ce[_0xb6e9('0xb')](_0xb6e9('0xc'),attributes,{'tableName':_0xb6e9('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x18fe=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x80ba8c,_0x5a0c71){var _0x1c8d12=function(_0xc848c9){while(--_0xc848c9){_0x80ba8c['push'](_0x80ba8c['shift']());}};_0x1c8d12(++_0x5a0c71);}(_0x18fe,0x13a));var _0xe18f=function(_0x4e4c4e,_0x24e8d6){_0x4e4c4e=_0x4e4c4e-0x0;var _0x5d04d7=_0x18fe[_0x4e4c4e];return _0x5d04d7;};'use strict';var _=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var logger=require(_0xe18f('0x2'))(_0xe18f('0x3'));var moment=require(_0xe18f('0x4'));var BPromise=require(_0xe18f('0x5'));var rp=require(_0xe18f('0x6'));var fs=require('fs');var path=require(_0xe18f('0x7'));var rimraf=require(_0xe18f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe18f('0x9'));module[_0xe18f('0xa')]=function(_0x5ba26c,_0x227062){return _0x5ba26c[_0xe18f('0xb')](_0xe18f('0xc'),attributes,{'tableName':_0xe18f('0xd'),'paranoid':![],'indexes':[{'fields':[_0xe18f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index abeaf2f..9b368bd 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 _0x367f=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','VoiceDialReport','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5bd78f,_0x5a7e0f){var _0x53dfe9=function(_0x404848){while(--_0x404848){_0x5bd78f['push'](_0x5bd78f['shift']());}};_0x53dfe9(++_0x5a7e0f);}(_0x367f,0x90));var _0xf367=function(_0x1b2baf,_0x120c94){_0x1b2baf=_0x1b2baf-0x0;var _0x478e2d=_0x367f[_0x1b2baf];return _0x478e2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf367('0x0'));var BPromise=require(_0xf367('0x1'));var rs=require(_0xf367('0x2'));var fs=require('fs');var Redis=require(_0xf367('0x3'));var db=require(_0xf367('0x4'))['db'];var utils=require(_0xf367('0x5'));var logger=require(_0xf367('0x6'))(_0xf367('0x7'));var config=require('../../config/environment');var jayson=require(_0xf367('0x8'));var client=jayson[_0xf367('0x9')][_0xf367('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185ef2,_0x529675,_0xdb4f3f){return new BPromise(function(_0x5a3b92,_0x33e4b3){return client[_0xf367('0xb')](_0x185ef2,_0xdb4f3f)[_0xf367('0xc')](function(_0x186173){logger[_0xf367('0xd')](_0xf367('0xe'),_0x529675,_0xf367('0xf'));logger[_0xf367('0x10')](_0xf367('0x11'),_0x529675,_0xf367('0xf'),JSON[_0xf367('0x12')](_0x186173));if(_0x186173['error']){if(_0x186173['error'][_0xf367('0x13')]===0x1f4){logger[_0xf367('0x14')](_0xf367('0xe'),_0x529675,_0x186173[_0xf367('0x14')][_0xf367('0x15')]);return _0x33e4b3(_0x186173[_0xf367('0x14')][_0xf367('0x15')]);}logger['error'](_0xf367('0xe'),_0x529675,_0x186173[_0xf367('0x14')][_0xf367('0x15')]);return _0x5a3b92(_0x186173['error']['message']);}else{logger['info'](_0xf367('0xe'),_0x529675,_0xf367('0xf'));_0x5a3b92(_0x186173[_0xf367('0x16')][_0xf367('0x15')]);}})[_0xf367('0x17')](function(_0x54da48){logger[_0xf367('0x14')](_0xf367('0xe'),_0x529675,_0x54da48);_0x33e4b3(_0x54da48);});});}exports[_0xf367('0x18')]=function(_0x168891){var _0x29939c=this;return new Promise(function(_0x5aa179,_0x355986){return db['VoiceDialReport'][_0xf367('0x19')](_0x168891['body'],{'raw':_0x168891[_0xf367('0x1a')]?_0x168891[_0xf367('0x1a')][_0xf367('0x1b')]===undefined?!![]:![]:!![]})[_0xf367('0xc')](function(_0x4186a1){logger['info'](_0xf367('0x18'),_0x168891);logger[_0xf367('0x10')]('CreateVoiceDialReport',_0x168891,JSON[_0xf367('0x12')](_0x4186a1));_0x5aa179(_0x4186a1);})[_0xf367('0x17')](function(_0xcccc27){logger[_0xf367('0x14')]('CreateVoiceDialReport',_0xcccc27[_0xf367('0x15')],_0x168891);_0x355986(_0x29939c['error'](0x1f4,_0xcccc27[_0xf367('0x15')]));});});};exports[_0xf367('0x1c')]=function(_0x5b080f){var _0x40255c=this;return new Promise(function(_0x4918ee,_0x5d7813){return db[_0xf367('0x1d')]['update'](_0x5b080f['body'],{'raw':_0x5b080f['options']?_0x5b080f[_0xf367('0x1a')][_0xf367('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b080f['options']?_0x5b080f[_0xf367('0x1a')]['where']||null:null,'attributes':_0x5b080f[_0xf367('0x1a')]?_0x5b080f[_0xf367('0x1a')][_0xf367('0x1e')]||null:null,'limit':_0x5b080f[_0xf367('0x1a')]?_0x5b080f['options'][_0xf367('0x1f')]||null:null})[_0xf367('0xc')](function(_0x323dbe){logger[_0xf367('0xd')]('UpdateVoiceDialReport',_0x5b080f);logger[_0xf367('0x10')](_0xf367('0x1c'),_0x5b080f,JSON['stringify'](_0x323dbe));_0x4918ee(_0x323dbe);})['catch'](function(_0x16727f){logger[_0xf367('0x14')](_0xf367('0x1c'),_0x16727f[_0xf367('0x15')],_0x5b080f);_0x5d7813(_0x40255c['error'](0x1f4,_0x16727f[_0xf367('0x15')]));});});}; \ No newline at end of file +var _0x5128=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','update','options','where','attributes','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5128,0x18d));var _0x8512=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5128[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x8512('0x0'));var util=require(_0x8512('0x1'));var moment=require('moment');var BPromise=require(_0x8512('0x2'));var rs=require(_0x8512('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8512('0x5'))(_0x8512('0x6'));var config=require(_0x8512('0x7'));var jayson=require(_0x8512('0x8'));var client=jayson[_0x8512('0x9')][_0x8512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375671,_0x2208ee,_0x45fb44){return new BPromise(function(_0x523c35,_0x428c37){return client['request'](_0x375671,_0x45fb44)[_0x8512('0xb')](function(_0x56f075){logger[_0x8512('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x2208ee,_0x8512('0xd'));logger[_0x8512('0xe')](_0x8512('0xf'),_0x2208ee,_0x8512('0xd'),JSON[_0x8512('0x10')](_0x56f075));if(_0x56f075[_0x8512('0x11')]){if(_0x56f075[_0x8512('0x11')][_0x8512('0x12')]===0x1f4){logger[_0x8512('0x11')](_0x8512('0x13'),_0x2208ee,_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);return _0x428c37(_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);}logger[_0x8512('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x2208ee,_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);return _0x523c35(_0x56f075[_0x8512('0x11')]['message']);}else{logger[_0x8512('0xc')](_0x8512('0x13'),_0x2208ee,'request\x20sent');_0x523c35(_0x56f075[_0x8512('0x15')][_0x8512('0x14')]);}})[_0x8512('0x16')](function(_0xd773c9){logger[_0x8512('0x11')](_0x8512('0x13'),_0x2208ee,_0xd773c9);_0x428c37(_0xd773c9);});});}exports[_0x8512('0x17')]=function(_0x295d47){var _0x458b0b=this;return new Promise(function(_0x26806c,_0x3d3797){return db['VoiceDialReport'][_0x8512('0x18')](_0x295d47[_0x8512('0x19')],{'raw':_0x295d47['options']?_0x295d47['options']['raw']===undefined?!![]:![]:!![]})[_0x8512('0xb')](function(_0x3a892a){logger['info']('CreateVoiceDialReport',_0x295d47);logger['debug'](_0x8512('0x17'),_0x295d47,JSON[_0x8512('0x10')](_0x3a892a));_0x26806c(_0x3a892a);})[_0x8512('0x16')](function(_0x3a9620){logger[_0x8512('0x11')](_0x8512('0x17'),_0x3a9620[_0x8512('0x14')],_0x295d47);_0x3d3797(_0x458b0b[_0x8512('0x11')](0x1f4,_0x3a9620[_0x8512('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x3ccc5b){var _0x9fb666=this;return new Promise(function(_0x39b817,_0x14af7b){return db['VoiceDialReport'][_0x8512('0x1a')](_0x3ccc5b[_0x8512('0x19')],{'raw':_0x3ccc5b['options']?_0x3ccc5b[_0x8512('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ccc5b[_0x8512('0x1b')]?_0x3ccc5b[_0x8512('0x1b')][_0x8512('0x1c')]||null:null,'attributes':_0x3ccc5b['options']?_0x3ccc5b[_0x8512('0x1b')][_0x8512('0x1d')]||null:null,'limit':_0x3ccc5b[_0x8512('0x1b')]?_0x3ccc5b[_0x8512('0x1b')]['limit']||null:null})[_0x8512('0xb')](function(_0x46378e){logger['info'](_0x8512('0x1e'),_0x3ccc5b);logger[_0x8512('0xe')](_0x8512('0x1e'),_0x3ccc5b,JSON[_0x8512('0x10')](_0x46378e));_0x39b817(_0x46378e);})[_0x8512('0x16')](function(_0x3d196a){logger['error'](_0x8512('0x1e'),_0x3d196a[_0x8512('0x14')],_0x3ccc5b);_0x14af7b(_0x9fb666[_0x8512('0x11')](0x1f4,_0x3d196a[_0x8512('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b12280c..0b3d5c6 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 _0x01b6=['create','/:id/applications','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0x471aa6,_0x5ec092){var _0x5c87b5=function(_0x3ea06a){while(--_0x3ea06a){_0x471aa6['push'](_0x471aa6['shift']());}};_0x5c87b5(++_0x5ec092);}(_0x01b6,0x110));var _0x601b=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x01b6[_0x37ae2e];return _0x19c50f;};'use strict';var multer=require(_0x601b('0x0'));var util=require('util');var path=require(_0x601b('0x1'));var timeout=require('connect-timeout');var express=require(_0x601b('0x2'));var router=express[_0x601b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x601b('0x4'));var interaction=require(_0x601b('0x5'));var config=require(_0x601b('0x6'));var controller=require(_0x601b('0x7'));router[_0x601b('0x8')]('/',auth[_0x601b('0x9')](),controller[_0x601b('0xa')]);router[_0x601b('0x8')]('/:id',auth[_0x601b('0x9')](),controller[_0x601b('0xb')]);router[_0x601b('0xc')]('/',auth[_0x601b('0x9')](),controller[_0x601b('0xd')]);router[_0x601b('0xc')](_0x601b('0xe'),auth[_0x601b('0x9')](),controller['addApplications']);router[_0x601b('0xf')]('/:id',auth[_0x601b('0x9')](),controller[_0x601b('0x10')]);router[_0x601b('0x11')]('/:id',auth[_0x601b('0x9')](),controller[_0x601b('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa035=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','show','create','post','/:id/applications','addApplications','put','update','delete','exports'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xa035,0xbd));var _0x5a03=function(_0x4e8a4c,_0x5369f4){_0x4e8a4c=_0x4e8a4c-0x0;var _0x42460e=_0xa035[_0x4e8a4c];return _0x42460e;};'use strict';var multer=require('multer');var util=require(_0x5a03('0x0'));var path=require(_0x5a03('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a03('0x2'));var router=express[_0x5a03('0x3')]();var fs_extra=require(_0x5a03('0x4'));var auth=require(_0x5a03('0x5'));var interaction=require(_0x5a03('0x6'));var config=require(_0x5a03('0x7'));var controller=require(_0x5a03('0x8'));router['get']('/',auth[_0x5a03('0x9')](),controller[_0x5a03('0xa')]);router['get'](_0x5a03('0xb'),auth[_0x5a03('0x9')](),controller[_0x5a03('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a03('0xd')]);router[_0x5a03('0xe')](_0x5a03('0xf'),auth[_0x5a03('0x9')](),controller[_0x5a03('0x10')]);router[_0x5a03('0x11')](_0x5a03('0xb'),auth['isAuthenticated'](),controller[_0x5a03('0x12')]);router[_0x5a03('0x13')](_0x5a03('0xb'),auth[_0x5a03('0x9')](),controller['destroy']);module[_0x5a03('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a2b30d2..d0c9bca 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 _0xc2bc=['internal','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x2d44e2,_0xb6ea7c){var _0x4f33d7=function(_0x2f2487){while(--_0x2f2487){_0x2d44e2['push'](_0x2d44e2['shift']());}};_0x4f33d7(++_0xb6ea7c);}(_0xc2bc,0x92));var _0xcc2b=function(_0x3de304,_0x581d6f){_0x3de304=_0x3de304-0x0;var _0x103760=_0xc2bc[_0x3de304];return _0x103760;};'use strict';var Sequelize=require('sequelize');module[_0xcc2b('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':![],'unique':_0xcc2b('0x2')},'priority':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xcc2b('0x2')},'tag':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc2b('0x3')},'appdata':{'type':Sequelize[_0xcc2b('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xcc2b('0x4')](_0xcc2b('0x5'),_0xcc2b('0x6'),_0xcc2b('0x7'),'inbound-fax',_0xcc2b('0x8'),'system',_0xcc2b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xcc2b('0x1')]},'interval':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':![],'defaultValue':_0xcc2b('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xcc2b('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xcc2b('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xcc2b('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xcc2b('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xcc2b('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xcc2b('0xe')],'get':function(_0x3fdfff){return this[_0xcc2b('0xf')](_0xcc2b('0x10'));}},'alias':{'type':Sequelize[_0xcc2b('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x28df=['outbound','internal','system','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x13f66f,_0x17bcd2){var _0x1a3b8c=function(_0x2a8ff1){while(--_0x2a8ff1){_0x13f66f['push'](_0x13f66f['shift']());}};_0x1a3b8c(++_0x17bcd2);}(_0x28df,0xd8));var _0xf28d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x28df[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'unique':_0xf28d('0x1')},'priority':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xf28d('0x1')},'tag':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':_0xf28d('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf28d('0x3')](_0xf28d('0x4'),_0xf28d('0x5'),_0xf28d('0x6'),'inbound-fax','outbound-fax',_0xf28d('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xf28d('0x8')]},'isApp':{'type':Sequelize[_0xf28d('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf28d('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf28d('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xf28d('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf28d('0x8')]},'recordingFormat':{'type':Sequelize[_0xf28d('0x0')],'defaultValue':_0xf28d('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xf28d('0xb')],'get':function(_0x44329e){return this[_0xf28d('0xc')]('exten');}},'alias':{'type':Sequelize[_0xf28d('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f4ebb52..a846f6a 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 _0x5551=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','VoiceExtension','findAll','rows','catch','show','include','params','create','body','outbound','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','limit','count','Content-Range','destroy','InboundRoutes','inbound','OutboundRoutes','internal','filter','ignore','value','includes','find','type','name','UserProfileResource','then','error','stack','send','index','map','rawAttributes','model','keys','filters'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x5551,0x1ab));var _0x1555=function(_0x440708,_0x867f37){_0x440708=_0x440708-0x0;var _0x4defb4=_0x5551[_0x440708];return _0x4defb4;};'use strict';var _=require(_0x1555('0x0'));var Redis=require(_0x1555('0x1'));var qs=require(_0x1555('0x2'));var logger=require(_0x1555('0x3'))(_0x1555('0x4'));var config=require(_0x1555('0x5'));var db=require(_0x1555('0x6'))['db'];config['redis']=_[_0x1555('0x7')](config[_0x1555('0x8')],{'host':_0x1555('0x9'),'port':0x18eb});var socket=require(_0x1555('0xa'))(new Redis(config[_0x1555('0x8')]));require(_0x1555('0xb'))['register'](socket);function respondWithStatusCode(_0x5d78f0,_0x25c458){_0x25c458=_0x25c458||0xcc;return function(_0x2304ab){if(_0x2304ab){return _0x5d78f0[_0x1555('0xc')](_0x25c458);}return _0x5d78f0[_0x1555('0xd')](_0x25c458)[_0x1555('0xe')]();};}function respondWithResult(_0x2630a1,_0xd80cd1){_0xd80cd1=_0xd80cd1||0xc8;return function(_0x475721){if(_0x475721){return _0x2630a1[_0x1555('0xd')](_0xd80cd1)[_0x1555('0xf')](_0x475721);}};}function respondWithFilteredResult(_0x27a2e5,_0x4f2361){return function(_0x25d7ad){if(_0x25d7ad){var _0x38496c=typeof _0x4f2361[_0x1555('0x10')]==='undefined'&&typeof _0x4f2361[_0x1555('0x11')]==='undefined';var _0x364875=_0x25d7ad[_0x1555('0x12')];var _0x4b47fd=_0x38496c?0x0:_0x4f2361[_0x1555('0x10')];var _0x392e2e=_0x38496c?_0x25d7ad['count']:_0x4f2361[_0x1555('0x10')]+_0x4f2361[_0x1555('0x11')];var _0x55c251;if(_0x392e2e>=_0x364875){_0x392e2e=_0x364875;_0x55c251=0xc8;}else{_0x55c251=0xce;}_0x27a2e5[_0x1555('0xd')](_0x55c251);return _0x27a2e5['set'](_0x1555('0x13'),_0x4b47fd+'-'+_0x392e2e+'/'+_0x364875)[_0x1555('0xf')](_0x25d7ad);}return null;};}function removeEntity(_0x3c90db){return function(_0x4270c9){if(_0x4270c9){return _0x4270c9[_0x1555('0x14')]()['then'](function(){var _0x1716d9=_0x4270c9['get']({'plain':!![]});var _0x7b8f38=[{'name':_0x1555('0x15'),'value':_0x1555('0x16'),'ignore':![]},{'name':_0x1555('0x17'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x1555('0x18'),'ignore':![]}];var _0x458746=_(_0x7b8f38)[_0x1555('0x19')](_0x1555('0x1a'))['map'](_0x1555('0x1b'))[_0x1555('0x1b')]();if(_[_0x1555('0x1c')](_0x458746,_0x1716d9['type'])){return;}var _0x2df2c5=_[_0x1555('0x1d')](_0x7b8f38,[_0x1555('0x1b'),_0x1716d9[_0x1555('0x1e')]])[_0x1555('0x1f')];return db[_0x1555('0x20')][_0x1555('0x14')]({'where':{'type':_0x2df2c5,'resourceId':_0x1716d9['id']}})[_0x1555('0x21')](function(){return _0x4270c9;});})['then'](function(){_0x3c90db[_0x1555('0xd')](0xcc)[_0x1555('0xe')]();});}};}function handleEntityNotFound(_0x5a267d){return function(_0x2e6ca4){if(!_0x2e6ca4){_0x5a267d[_0x1555('0xc')](0x194);}return _0x2e6ca4;};}function handleError(_0x1f1a38,_0x500435){_0x500435=_0x500435||0x1f4;return function(_0xc33426){logger[_0x1555('0x22')](_0xc33426[_0x1555('0x23')]);if(_0xc33426[_0x1555('0x1f')]){delete _0xc33426['name'];}_0x1f1a38['status'](_0x500435)[_0x1555('0x24')](_0xc33426);};}exports[_0x1555('0x25')]=function(_0x3a5a2f,_0x60bd5c){var _0x2d4e33={},_0x16889a={},_0x253280={'count':0x0,'rows':[]};var _0x1c21b8=_[_0x1555('0x26')](db['VoiceExtension'][_0x1555('0x27')],function(_0x256714){return{'name':_0x256714['fieldName'],'type':_0x256714[_0x1555('0x1e')]['key']};});_0x16889a[_0x1555('0x28')]=_[_0x1555('0x26')](_0x1c21b8,_0x1555('0x1f'));_0x16889a['query']=_[_0x1555('0x29')](_0x3a5a2f['query']);_0x16889a[_0x1555('0x2a')]=_[_0x1555('0x2b')](_0x16889a[_0x1555('0x28')],_0x16889a[_0x1555('0x2c')]);_0x2d4e33[_0x1555('0x2d')]=_['intersection'](_0x16889a[_0x1555('0x28')],qs[_0x1555('0x2e')](_0x3a5a2f[_0x1555('0x2c')][_0x1555('0x2e')]));_0x2d4e33[_0x1555('0x2d')]=_0x2d4e33['attributes'][_0x1555('0x2f')]?_0x2d4e33[_0x1555('0x2d')]:_0x16889a[_0x1555('0x28')];if(!_0x3a5a2f[_0x1555('0x2c')][_0x1555('0x30')](_0x1555('0x31'))){_0x2d4e33[_0x1555('0x11')]=qs[_0x1555('0x11')](_0x3a5a2f['query'][_0x1555('0x11')]);_0x2d4e33[_0x1555('0x10')]=qs[_0x1555('0x10')](_0x3a5a2f[_0x1555('0x2c')]['offset']);}_0x2d4e33[_0x1555('0x32')]=qs['sort'](_0x3a5a2f[_0x1555('0x2c')]['sort']);_0x2d4e33[_0x1555('0x33')]=qs[_0x1555('0x2a')](_['pick'](_0x3a5a2f[_0x1555('0x2c')],_0x16889a['filters']),_0x1c21b8);if(_0x3a5a2f[_0x1555('0x2c')][_0x1555('0x19')]){_0x2d4e33[_0x1555('0x33')]=_[_0x1555('0x34')](_0x2d4e33[_0x1555('0x33')],{'$or':_['map'](_0x1c21b8,function(_0x3a35cc){if(_0x3a35cc[_0x1555('0x1e')]!==_0x1555('0x35')){var _0x4bebc6={};_0x4bebc6[_0x3a35cc[_0x1555('0x1f')]]={'$like':'%'+_0x3a5a2f[_0x1555('0x2c')][_0x1555('0x19')]+'%'};return _0x4bebc6;}})});}_0x2d4e33=_[_0x1555('0x34')]({},_0x2d4e33,_0x3a5a2f[_0x1555('0x36')]);var _0x86cff1={'where':_0x2d4e33[_0x1555('0x33')]};return db['VoiceExtension'][_0x1555('0x12')](_0x86cff1)[_0x1555('0x21')](function(_0xe75010){_0x253280[_0x1555('0x12')]=_0xe75010;if(_0x3a5a2f[_0x1555('0x2c')]['includeAll']){_0x2d4e33['include']=[{'all':!![]}];}return db[_0x1555('0x37')][_0x1555('0x38')](_0x2d4e33);})[_0x1555('0x21')](function(_0x3dbace){_0x253280[_0x1555('0x39')]=_0x3dbace;return _0x253280;})[_0x1555('0x21')](respondWithFilteredResult(_0x60bd5c,_0x2d4e33))[_0x1555('0x3a')](handleError(_0x60bd5c,null));};exports[_0x1555('0x3b')]=function(_0x326b4a,_0x5e1329){var _0x2eabfa={'raw':![],'where':{'id':_0x326b4a['params']['id']}},_0x483cc9={};_0x483cc9['model']=_[_0x1555('0x29')](db[_0x1555('0x37')][_0x1555('0x27')]);_0x483cc9[_0x1555('0x2c')]=_[_0x1555('0x29')](_0x326b4a['query']);_0x483cc9[_0x1555('0x2a')]=_[_0x1555('0x2b')](_0x483cc9['model'],_0x483cc9[_0x1555('0x2c')]);_0x2eabfa[_0x1555('0x2d')]=_['intersection'](_0x483cc9['model'],qs['fields'](_0x326b4a['query'][_0x1555('0x2e')]));_0x2eabfa[_0x1555('0x2d')]=_0x2eabfa[_0x1555('0x2d')]['length']?_0x2eabfa[_0x1555('0x2d')]:_0x483cc9[_0x1555('0x28')];if(_0x326b4a['query']['includeAll']){_0x2eabfa[_0x1555('0x3c')]=[{'all':!![]}];}_0x2eabfa=_[_0x1555('0x34')]({},_0x2eabfa,_0x326b4a[_0x1555('0x36')]);return db[_0x1555('0x37')][_0x1555('0x1d')](_0x2eabfa)[_0x1555('0x21')](handleEntityNotFound(_0x5e1329,null))[_0x1555('0x21')](respondWithResult(_0x5e1329,null))[_0x1555('0x3a')](handleError(_0x5e1329,null));};exports[_0x1555('0x14')]=function(_0x37ee8d,_0x40b75d){return db[_0x1555('0x37')][_0x1555('0x1d')]({'where':{'id':_0x37ee8d[_0x1555('0x3d')]['id']}})[_0x1555('0x21')](handleEntityNotFound(_0x40b75d,null))[_0x1555('0x21')](removeEntity(_0x40b75d,null))[_0x1555('0x3a')](handleError(_0x40b75d,null));};exports[_0x1555('0x3e')]=function(_0x5dd640,_0x5cb3ca){if(_0x5dd640[_0x1555('0x3f')][_0x1555('0x1e')]===_0x1555('0x40')&&!_[_0x1555('0x41')](_0x5dd640['body'][_0x1555('0x42')],'_')){_0x5dd640['body'][_0x1555('0x42')]='_'[_0x1555('0x43')](_0x5dd640[_0x1555('0x3f')][_0x1555('0x42')]);}return db[_0x1555('0x37')]['create'](_0x5dd640['body'],{'raw':![]})['then'](function(_0x4f2df0){var _0x380f4a=_0x5dd640['user']['get']({'plain':!![]});if(!_0x380f4a)throw new Error(_0x1555('0x44'));if(_0x380f4a['role']===_0x1555('0x45')){var _0x29f2d0=_0x4f2df0['get']({'plain':!![]});var _0x4f9e35=[{'name':_0x1555('0x15'),'value':_0x1555('0x16')},{'name':_0x1555('0x17'),'value':_0x1555('0x40')},{'name':_0x1555('0x46'),'value':_0x1555('0x18')}];var _0x454e17=_[_0x1555('0x1d')](_0x4f9e35,[_0x1555('0x1b'),_0x29f2d0[_0x1555('0x1e')]])['name'];return db[_0x1555('0x47')][_0x1555('0x1d')]({'where':{'name':_0x454e17,'userProfileId':_0x380f4a[_0x1555('0x48')]},'raw':!![]})[_0x1555('0x21')](function(_0x124e91){if(_0x124e91&&_0x124e91[_0x1555('0x49')]===0x0){return db['UserProfileResource'][_0x1555('0x3e')]({'name':_0x29f2d0[_0x1555('0x1f')],'resourceId':_0x29f2d0['id'],'type':_0x124e91['name'],'sectionId':_0x124e91['id']},{})[_0x1555('0x21')](function(){return _0x4f2df0;});}else{return _0x4f2df0;}})[_0x1555('0x3a')](function(_0xf9b104){logger['error'](_0x1555('0x4a'),_0xf9b104);throw _0xf9b104;});}return _0x4f2df0;})[_0x1555('0x21')](respondWithResult(_0x5cb3ca,0xc9))[_0x1555('0x3a')](handleError(_0x5cb3ca,null));};exports[_0x1555('0x4b')]=function(_0x101f3f,_0x3c578c){if(_0x101f3f[_0x1555('0x3f')]['id']){delete _0x101f3f[_0x1555('0x3f')]['id'];}return db[_0x1555('0x37')]['find']({'where':{'id':_0x101f3f[_0x1555('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c578c,null))[_0x1555('0x21')](function(_0xa675ae){if(_0xa675ae){return db['VoiceExtension']['update'](_[_0x1555('0x4c')](_0x101f3f[_0x1555('0x3f')],[_0x1555('0x42'),_0x1555('0x4d'),_0x1555('0x4e'),_0x1555('0x4f'),_0x1555('0x50'),_0x1555('0x51'),_0x1555('0x52')]),{'where':{'context':_0xa675ae[_0x1555('0x4d')],'exten':_0xa675ae['exten']},'individualHooks':!![]})['then'](function(_0x46d738){return _0x46d738;});}return null;})[_0x1555('0x21')](respondWithStatusCode(_0x3c578c,null))[_0x1555('0x3a')](handleError(_0x3c578c,null));};exports[_0x1555('0x53')]=function(_0x48e99b,_0x4d3bb1){var _0x135100=_0x48e99b[_0x1555('0x3d')]['id'];var _0x32a8d9=_0x48e99b[_0x1555('0x3f')];var _0x549e77=0xc8;var _0x21540b=null;return db['sequelize'][_0x1555('0x54')]({'isolationLevel':db['sequelize']['Transaction'][_0x1555('0x55')][_0x1555('0x56')]},function(_0x26fad0){return db[_0x1555('0x37')][_0x1555('0x57')]({'where':{'id':_0x135100},'transaction':_0x26fad0})[_0x1555('0x21')](function(_0x44822b){if(_0x44822b){return db[_0x1555('0x37')][_0x1555('0x14')]({'where':{'VoiceExtensionId':_0x135100},'transaction':_0x26fad0})['then'](function(){var _0x35707c=_[_0x1555('0x26')](_0x32a8d9,function(_0x52a828){_0x52a828[_0x1555('0x58')]=_0x135100;_0x52a828[_0x1555('0x59')]=!![];return _0x52a828;});return _0x44822b[_0x1555('0x5a')](_0x35707c);})[_0x1555('0x21')](function(_0x1ad5eb){return db['VoiceExtension'][_0x1555('0x5b')](_0x1ad5eb,{'transaction':_0x26fad0});});}else{_0x549e77=0x194;_0x21540b=[];}});})[_0x1555('0x21')](function(){if(_0x549e77!==0x194){return db[_0x1555('0x37')][_0x1555('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x135100},'order':_0x1555('0x5d')})['then'](function(_0x2deec5){_0x21540b=_0x2deec5;});}})[_0x1555('0x3a')](function(_0x3f9d93){_0x549e77=0x1f4;logger['error'](_0x3f9d93[_0x1555('0x23')]);if(_0x3f9d93[_0x1555('0x1f')]){delete _0x3f9d93[_0x1555('0x1f')];}_0x21540b=_0x3f9d93;})['finally'](function(){if(_0x21540b===null){_0x4d3bb1[_0x1555('0xc')](_0x549e77);}else{if(_0x549e77===0x1f4){_0x4d3bb1[_0x1555('0xd')](_0x549e77)['send'](_0x21540b);}else{_0x4d3bb1[_0x1555('0xd')](_0x549e77)['json'](_0x21540b);}}});}; \ No newline at end of file +var _0xbb30=['./voiceExtension.socket','register','status','end','json','offset','undefined','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','find','type','name','UserProfileResource','error','stack','VoiceExtension','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','length','create','startsWith','body','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','send','lodash','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbb30,0x1a8));var _0x0bb3=function(_0x3578c4,_0x2f5cf0){_0x3578c4=_0x3578c4-0x0;var _0x336e24=_0xbb30[_0x3578c4];return _0x336e24;};'use strict';var _=require(_0x0bb3('0x0'));var Redis=require('ioredis');var qs=require(_0x0bb3('0x1'));var logger=require('../../config/logger')(_0x0bb3('0x2'));var config=require(_0x0bb3('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0bb3('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bb3('0x5'))(new Redis(config[_0x0bb3('0x4')]));require(_0x0bb3('0x6'))[_0x0bb3('0x7')](socket);function respondWithStatusCode(_0xfa5f7d,_0x3c4c5d){_0x3c4c5d=_0x3c4c5d||0xcc;return function(_0x269fc6){if(_0x269fc6){return _0xfa5f7d['sendStatus'](_0x3c4c5d);}return _0xfa5f7d[_0x0bb3('0x8')](_0x3c4c5d)[_0x0bb3('0x9')]();};}function respondWithResult(_0x2453b,_0x15bddd){_0x15bddd=_0x15bddd||0xc8;return function(_0x321a33){if(_0x321a33){return _0x2453b[_0x0bb3('0x8')](_0x15bddd)[_0x0bb3('0xa')](_0x321a33);}};}function respondWithFilteredResult(_0x3130b4,_0x11f175){return function(_0x4375f9){if(_0x4375f9){var _0x11c20b=typeof _0x11f175[_0x0bb3('0xb')]===_0x0bb3('0xc')&&typeof _0x11f175['limit']==='undefined';var _0x573ff8=_0x4375f9['count'];var _0x31d69d=_0x11c20b?0x0:_0x11f175['offset'];var _0x440c29=_0x11c20b?_0x4375f9[_0x0bb3('0xd')]:_0x11f175[_0x0bb3('0xb')]+_0x11f175['limit'];var _0x21a8a1;if(_0x440c29>=_0x573ff8){_0x440c29=_0x573ff8;_0x21a8a1=0xc8;}else{_0x21a8a1=0xce;}_0x3130b4[_0x0bb3('0x8')](_0x21a8a1);return _0x3130b4['set'](_0x0bb3('0xe'),_0x31d69d+'-'+_0x440c29+'/'+_0x573ff8)[_0x0bb3('0xa')](_0x4375f9);}return null;};}function removeEntity(_0x4cda43){return function(_0x179c0){if(_0x179c0){return _0x179c0[_0x0bb3('0xf')]()[_0x0bb3('0x10')](function(){var _0x350e37=_0x179c0[_0x0bb3('0x11')]({'plain':!![]});var _0x26e0ab=[{'name':_0x0bb3('0x12'),'value':_0x0bb3('0x13'),'ignore':![]},{'name':_0x0bb3('0x14'),'value':_0x0bb3('0x15'),'ignore':![]},{'name':_0x0bb3('0x16'),'value':_0x0bb3('0x17'),'ignore':![]}];var _0x33af06=_(_0x26e0ab)['filter']('ignore')[_0x0bb3('0x18')](_0x0bb3('0x19'))['value']();if(_[_0x0bb3('0x1a')](_0x33af06,_0x350e37['type'])){return;}var _0x386c49=_[_0x0bb3('0x1b')](_0x26e0ab,[_0x0bb3('0x19'),_0x350e37[_0x0bb3('0x1c')]])[_0x0bb3('0x1d')];return db[_0x0bb3('0x1e')][_0x0bb3('0xf')]({'where':{'type':_0x386c49,'resourceId':_0x350e37['id']}})['then'](function(){return _0x179c0;});})[_0x0bb3('0x10')](function(){_0x4cda43[_0x0bb3('0x8')](0xcc)[_0x0bb3('0x9')]();});}};}function handleEntityNotFound(_0x1e6bb0){return function(_0x5f0766){if(!_0x5f0766){_0x1e6bb0['sendStatus'](0x194);}return _0x5f0766;};}function handleError(_0x3545f5,_0x524c05){_0x524c05=_0x524c05||0x1f4;return function(_0x13813f){logger[_0x0bb3('0x1f')](_0x13813f[_0x0bb3('0x20')]);if(_0x13813f['name']){delete _0x13813f[_0x0bb3('0x1d')];}_0x3545f5[_0x0bb3('0x8')](_0x524c05)['send'](_0x13813f);};}exports['index']=function(_0x27fd8a,_0x24f74f){var _0x3d8ff7={},_0x32bc96={},_0x3e1d07={'count':0x0,'rows':[]};var _0x4616ef=_['map'](db[_0x0bb3('0x21')]['rawAttributes'],function(_0x5c29e8){return{'name':_0x5c29e8[_0x0bb3('0x22')],'type':_0x5c29e8[_0x0bb3('0x1c')]['key']};});_0x32bc96[_0x0bb3('0x23')]=_[_0x0bb3('0x18')](_0x4616ef,'name');_0x32bc96[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](_0x27fd8a[_0x0bb3('0x24')]);_0x32bc96[_0x0bb3('0x26')]=_[_0x0bb3('0x27')](_0x32bc96[_0x0bb3('0x23')],_0x32bc96[_0x0bb3('0x24')]);_0x3d8ff7[_0x0bb3('0x28')]=_[_0x0bb3('0x27')](_0x32bc96[_0x0bb3('0x23')],qs[_0x0bb3('0x29')](_0x27fd8a['query'][_0x0bb3('0x29')]));_0x3d8ff7[_0x0bb3('0x28')]=_0x3d8ff7['attributes']['length']?_0x3d8ff7['attributes']:_0x32bc96[_0x0bb3('0x23')];if(!_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2a')](_0x0bb3('0x2b'))){_0x3d8ff7[_0x0bb3('0x2c')]=qs[_0x0bb3('0x2c')](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2c')]);_0x3d8ff7[_0x0bb3('0xb')]=qs['offset'](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0xb')]);}_0x3d8ff7['order']=qs['sort'](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2d')]);_0x3d8ff7[_0x0bb3('0x2e')]=qs[_0x0bb3('0x26')](_['pick'](_0x27fd8a[_0x0bb3('0x24')],_0x32bc96[_0x0bb3('0x26')]),_0x4616ef);if(_0x27fd8a['query']['filter']){_0x3d8ff7[_0x0bb3('0x2e')]=_[_0x0bb3('0x2f')](_0x3d8ff7[_0x0bb3('0x2e')],{'$or':_[_0x0bb3('0x18')](_0x4616ef,function(_0x2494b9){if(_0x2494b9[_0x0bb3('0x1c')]!==_0x0bb3('0x30')){var _0x3392cd={};_0x3392cd[_0x2494b9[_0x0bb3('0x1d')]]={'$like':'%'+_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x31')]+'%'};return _0x3392cd;}})});}_0x3d8ff7=_['merge']({},_0x3d8ff7,_0x27fd8a[_0x0bb3('0x32')]);var _0x2faf0c={'where':_0x3d8ff7['where']};return db[_0x0bb3('0x21')][_0x0bb3('0xd')](_0x2faf0c)[_0x0bb3('0x10')](function(_0x167b26){_0x3e1d07[_0x0bb3('0xd')]=_0x167b26;if(_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x33')]){_0x3d8ff7[_0x0bb3('0x34')]=[{'all':!![]}];}return db[_0x0bb3('0x21')][_0x0bb3('0x35')](_0x3d8ff7);})[_0x0bb3('0x10')](function(_0x368176){_0x3e1d07[_0x0bb3('0x36')]=_0x368176;return _0x3e1d07;})[_0x0bb3('0x10')](respondWithFilteredResult(_0x24f74f,_0x3d8ff7))[_0x0bb3('0x37')](handleError(_0x24f74f,null));};exports['show']=function(_0x3451b6,_0x5da73e){var _0x595104={'raw':![],'where':{'id':_0x3451b6[_0x0bb3('0x38')]['id']}},_0x41c84f={};_0x41c84f['model']=_['keys'](db['VoiceExtension']['rawAttributes']);_0x41c84f[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](_0x3451b6[_0x0bb3('0x24')]);_0x41c84f['filters']=_[_0x0bb3('0x27')](_0x41c84f[_0x0bb3('0x23')],_0x41c84f[_0x0bb3('0x24')]);_0x595104[_0x0bb3('0x28')]=_['intersection'](_0x41c84f[_0x0bb3('0x23')],qs['fields'](_0x3451b6['query'][_0x0bb3('0x29')]));_0x595104[_0x0bb3('0x28')]=_0x595104[_0x0bb3('0x28')][_0x0bb3('0x39')]?_0x595104['attributes']:_0x41c84f[_0x0bb3('0x23')];if(_0x3451b6[_0x0bb3('0x24')][_0x0bb3('0x33')]){_0x595104['include']=[{'all':!![]}];}_0x595104=_['merge']({},_0x595104,_0x3451b6[_0x0bb3('0x32')]);return db[_0x0bb3('0x21')][_0x0bb3('0x1b')](_0x595104)[_0x0bb3('0x10')](handleEntityNotFound(_0x5da73e,null))['then'](respondWithResult(_0x5da73e,null))['catch'](handleError(_0x5da73e,null));};exports[_0x0bb3('0xf')]=function(_0x51860d,_0x4b5403){return db[_0x0bb3('0x21')][_0x0bb3('0x1b')]({'where':{'id':_0x51860d[_0x0bb3('0x38')]['id']}})['then'](handleEntityNotFound(_0x4b5403,null))[_0x0bb3('0x10')](removeEntity(_0x4b5403,null))[_0x0bb3('0x37')](handleError(_0x4b5403,null));};exports[_0x0bb3('0x3a')]=function(_0x2a636f,_0x2122e0){if(_0x2a636f['body']['type']===_0x0bb3('0x15')&&!_[_0x0bb3('0x3b')](_0x2a636f['body']['exten'],'_')){_0x2a636f[_0x0bb3('0x3c')][_0x0bb3('0x3d')]='_'[_0x0bb3('0x3e')](_0x2a636f['body'][_0x0bb3('0x3d')]);}return db[_0x0bb3('0x21')][_0x0bb3('0x3a')](_0x2a636f[_0x0bb3('0x3c')],{'raw':![]})[_0x0bb3('0x10')](function(_0x304d9d){var _0x47b382=_0x2a636f[_0x0bb3('0x3f')][_0x0bb3('0x11')]({'plain':!![]});if(!_0x47b382)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47b382[_0x0bb3('0x40')]===_0x0bb3('0x3f')){var _0x21b3b1=_0x304d9d['get']({'plain':!![]});var _0xbebb73=[{'name':_0x0bb3('0x12'),'value':_0x0bb3('0x13')},{'name':_0x0bb3('0x14'),'value':'outbound'},{'name':_0x0bb3('0x16'),'value':_0x0bb3('0x17')}];var _0xbed8c5=_[_0x0bb3('0x1b')](_0xbebb73,['value',_0x21b3b1['type']])[_0x0bb3('0x1d')];return db[_0x0bb3('0x41')][_0x0bb3('0x1b')]({'where':{'name':_0xbed8c5,'userProfileId':_0x47b382[_0x0bb3('0x42')]},'raw':!![]})['then'](function(_0x1262fc){if(_0x1262fc&&_0x1262fc[_0x0bb3('0x43')]===0x0){return db[_0x0bb3('0x1e')]['create']({'name':_0x21b3b1[_0x0bb3('0x1d')],'resourceId':_0x21b3b1['id'],'type':_0x1262fc[_0x0bb3('0x1d')],'sectionId':_0x1262fc['id']},{})[_0x0bb3('0x10')](function(){return _0x304d9d;});}else{return _0x304d9d;}})[_0x0bb3('0x37')](function(_0x1d5a20){logger[_0x0bb3('0x1f')](_0x0bb3('0x44'),_0x1d5a20);throw _0x1d5a20;});}return _0x304d9d;})['then'](respondWithResult(_0x2122e0,0xc9))['catch'](handleError(_0x2122e0,null));};exports[_0x0bb3('0x45')]=function(_0x1bddb0,_0xc8c659){if(_0x1bddb0['body']['id']){delete _0x1bddb0[_0x0bb3('0x3c')]['id'];}return db[_0x0bb3('0x21')][_0x0bb3('0x1b')]({'where':{'id':_0x1bddb0[_0x0bb3('0x38')]['id']}})[_0x0bb3('0x10')](handleEntityNotFound(_0xc8c659,null))[_0x0bb3('0x10')](function(_0x316592){if(_0x316592){return db[_0x0bb3('0x21')]['update'](_[_0x0bb3('0x46')](_0x1bddb0[_0x0bb3('0x3c')],[_0x0bb3('0x3d'),_0x0bb3('0x47'),_0x0bb3('0x48'),'recordingFormat',_0x0bb3('0x49'),_0x0bb3('0x4a'),_0x0bb3('0x4b')]),{'where':{'context':_0x316592['context'],'exten':_0x316592['exten']},'individualHooks':!![]})[_0x0bb3('0x10')](function(_0x343bcb){return _0x343bcb;});}return null;})[_0x0bb3('0x10')](respondWithStatusCode(_0xc8c659,null))[_0x0bb3('0x37')](handleError(_0xc8c659,null));};exports[_0x0bb3('0x4c')]=function(_0x42860a,_0x3fe5ab){var _0x19c17d=_0x42860a[_0x0bb3('0x38')]['id'];var _0xe9e191=_0x42860a['body'];var _0x28c511=0xc8;var _0x404437=null;return db[_0x0bb3('0x4d')][_0x0bb3('0x4e')]({'isolationLevel':db[_0x0bb3('0x4d')]['Transaction'][_0x0bb3('0x4f')][_0x0bb3('0x50')]},function(_0x3a04a3){return db[_0x0bb3('0x21')]['findOne']({'where':{'id':_0x19c17d},'transaction':_0x3a04a3})[_0x0bb3('0x10')](function(_0x503d30){if(_0x503d30){return db[_0x0bb3('0x21')]['destroy']({'where':{'VoiceExtensionId':_0x19c17d},'transaction':_0x3a04a3})[_0x0bb3('0x10')](function(){var _0x2fa825=_['map'](_0xe9e191,function(_0x1393f8){_0x1393f8['VoiceExtensionId']=_0x19c17d;_0x1393f8[_0x0bb3('0x51')]=!![];return _0x1393f8;});return _0x503d30[_0x0bb3('0x52')](_0x2fa825);})['then'](function(_0x504f64){return db[_0x0bb3('0x21')][_0x0bb3('0x53')](_0x504f64,{'transaction':_0x3a04a3});});}else{_0x28c511=0x194;_0x404437=[];}});})[_0x0bb3('0x10')](function(){if(_0x28c511!==0x194){return db[_0x0bb3('0x21')][_0x0bb3('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x19c17d},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x569785){_0x404437=_0x569785;});}})['catch'](function(_0x4e0ea9){_0x28c511=0x1f4;logger[_0x0bb3('0x1f')](_0x4e0ea9['stack']);if(_0x4e0ea9[_0x0bb3('0x1d')]){delete _0x4e0ea9['name'];}_0x404437=_0x4e0ea9;})['finally'](function(){if(_0x404437===null){_0x3fe5ab['sendStatus'](_0x28c511);}else{if(_0x28c511===0x1f4){_0x3fe5ab['status'](_0x28c511)[_0x0bb3('0x55')](_0x404437);}else{_0x3fe5ab['status'](_0x28c511)[_0x0bb3('0xa')](_0x404437);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3951db1..d50f01a 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 _0x5d56=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x1512be,_0x108ac){var _0x2f218a=function(_0x548d9e){while(--_0x548d9e){_0x1512be['push'](_0x1512be['shift']());}};_0x2f218a(++_0x108ac);}(_0x5d56,0x166));var _0x65d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d56[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x65d5('0x0'));var VoiceExtension=require(_0x65d5('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x65d5('0x2')](0x0);var events={'afterCreate':_0x65d5('0x3'),'afterUpdate':'update','afterDestroy':_0x65d5('0x4')};function emitEvent(_0x34f4b0){return function(_0x127ec4,_0x25c30b,_0x34dbc0){VoiceExtensionEvents[_0x65d5('0x5')](_0x34f4b0+':'+_0x127ec4['id'],_0x127ec4);VoiceExtensionEvents[_0x65d5('0x5')](_0x34f4b0,_0x127ec4);_0x34dbc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x65d5('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x118f=['emit','hasOwnProperty','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x264eeb,_0xc05998){var _0xa45c83=function(_0x2a82d9){while(--_0x2a82d9){_0x264eeb['push'](_0x264eeb['shift']());}};_0xa45c83(++_0xc05998);}(_0x118f,0x1b2));var _0xf118=function(_0x24ff3c,_0x1e7534){_0x24ff3c=_0x24ff3c-0x0;var _0xc84e8f=_0x118f[_0x24ff3c];return _0xc84e8f;};'use strict';var EventEmitter=require(_0xf118('0x0'));var VoiceExtension=require(_0xf118('0x1'))['db'][_0xf118('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf118('0x3')](0x0);var events={'afterCreate':_0xf118('0x4'),'afterUpdate':_0xf118('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d6fad){return function(_0x3045c6,_0x17d3a6,_0x5880aa){VoiceExtensionEvents[_0xf118('0x6')](_0x5d6fad+':'+_0x3045c6['id'],_0x3045c6);VoiceExtensionEvents[_0xf118('0x6')](_0x5d6fad,_0x3045c6);_0x5880aa(null);};}for(var e in events){if(events[_0xf118('0x7')](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 a10dd2a..07e0367 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 _0x2cd0=['none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','length','name','param','phone','prefix','${EXTEN:','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','concat','define','VoiceExtension','voice_extensions','last','lodash','./voiceExtension.attributes','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','recordingFormat'];(function(_0x320f23,_0x1450c0){var _0x2b1e43=function(_0x3e9d58){while(--_0x3e9d58){_0x320f23['push'](_0x320f23['shift']());}};_0x2b1e43(++_0x1450c0);}(_0x2cd0,0x8a));var _0x02cd=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x2cd0[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x02cd('0x0'));var attributes=require(_0x02cd('0x1'));module['exports']=function(_0x5184c5){var _0x22baca=_0x5184c5['models'];function _0x55565b(_0x26f5f2){var _0x291580=0x2;var _0x3fba37=[{'type':_0x26f5f2[_0x02cd('0x2')],'app':_0x02cd('0x3'),'appdata':_0x02cd('0x4')+_0x26f5f2[_0x02cd('0x2')],'context':_0x26f5f2[_0x02cd('0x5')],'exten':_0x26f5f2[_0x02cd('0x6')],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']},{'type':_0x26f5f2[_0x02cd('0x2')],'app':_0x26f5f2['alias']?_0x02cd('0x3'):_0x02cd('0x7'),'appdata':_0x26f5f2[_0x02cd('0x8')]?_0x02cd('0x9')+_0x26f5f2[_0x02cd('0x8')]:_0x02cd('0xa'),'context':_0x26f5f2[_0x02cd('0x5')],'exten':_0x26f5f2[_0x02cd('0x6')],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']}];if(_0x26f5f2[_0x02cd('0x2')]===_0x02cd('0xb')){_0x3fba37['push']({'type':'inbound','app':_0x02cd('0x3'),'appdata':_0x02cd('0xc')+_0x26f5f2['id'],'context':_0x26f5f2['context'],'exten':_0x26f5f2['exten'],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']});}_0x3fba37[_0x02cd('0xd')]({'type':_0x26f5f2['type'],'app':_0x02cd('0x3'),'appdata':_0x02cd('0xe'),'context':_0x26f5f2[_0x02cd('0x5')],'exten':_0x26f5f2[_0x02cd('0x6')],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']},{'type':_0x26f5f2[_0x02cd('0x2')],'app':_0x02cd('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x26f5f2['context'],'exten':_0x26f5f2[_0x02cd('0x6')],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']},{'type':_0x26f5f2[_0x02cd('0x2')],'app':_0x02cd('0x3'),'appdata':_0x02cd('0xf'),'context':_0x26f5f2[_0x02cd('0x5')],'exten':_0x26f5f2['exten'],'priority':_0x291580++,'VoiceExtensionId':_0x26f5f2['id']});return _0x3fba37;}function _0x94301f(_0x49f36f){var _0x58a391=0x2;var _0x40d319=[{'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x11'),'context':_0x49f36f['context'],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':'outbound','app':_0x49f36f[_0x02cd('0x8')]?_0x02cd('0x3'):_0x02cd('0x7'),'appdata':_0x49f36f[_0x02cd('0x8')]?_0x02cd('0x9')+_0x49f36f[_0x02cd('0x8')]:_0x02cd('0xa'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x12')+(_0x49f36f[_0x02cd('0x13')]?'${EXTEN:'+_0x49f36f[_0x02cd('0x13')]+'}':'${EXTEN}'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':'outbound','app':_0x02cd('0x3'),'appdata':_0x02cd('0xc')+_0x49f36f['id'],'context':_0x49f36f['context'],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':_0x02cd('0x14'),'appdata':_0x02cd('0x15')+(_0x58a391+0x2)+'):Goto('+(_0x58a391+0x1)+')','context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':_0x49f36f[_0x02cd('0x13')]?_0x02cd('0x16')+_0x49f36f[_0x02cd('0x13')]+'}':_0x02cd('0x17'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':'outbound','app':_0x02cd('0x3'),'appdata':_0x02cd('0xe'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x18'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':'outbound','app':_0x02cd('0x3'),'appdata':_0x02cd('0xf'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':'outboundrouteid='+_0x49f36f['id'],'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']}];if(_0x49f36f['hasOwnProperty'](_0x02cd('0x19'))&&_0x49f36f[_0x02cd('0x19')]!==_0x02cd('0x1a')){_0x40d319['push']({'type':_0x02cd('0x10'),'app':_0x02cd('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f[_0x02cd('0x6')],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']},{'type':_0x02cd('0x10'),'app':'Set','appdata':_0x02cd('0x1b')+_0x49f36f[_0x02cd('0x19')]||_0x02cd('0x1c'),'context':_0x49f36f[_0x02cd('0x5')],'exten':_0x49f36f['exten'],'priority':_0x58a391++,'VoiceExtensionId':_0x49f36f['id']});}return _0x40d319;}function _0x16f378(_0x148545,_0x46568f){var _0x251766=[{'name':_0x02cd('0x1d'),'param':0x0},{'name':_0x02cd('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0xfcd11a={};var _0x261a50=_0x46568f[_0x02cd('0x1f')](',');var _0x2c57c8=[];for(var _0x543f5d=0x0;_0x543f5d<_0x251766[_0x02cd('0x20')];_0x543f5d++){switch(_0x251766[_0x543f5d][_0x02cd('0x21')]){case _0x02cd('0x1d'):_0xfcd11a[_0x02cd('0x1d')]=_0x261a50[_0x251766[_0x543f5d][_0x02cd('0x22')]][_0x02cd('0x1f')]('/')[0x1];_0xfcd11a[_0x02cd('0x23')]=_0x261a50[_0x251766[_0x543f5d][_0x02cd('0x22')]][_0x02cd('0x1f')]('/')[0x2];_0xfcd11a[_0x02cd('0x24')]=_0xfcd11a[_0x02cd('0x23')]?_0xfcd11a[_0x02cd('0x23')][_0x02cd('0x1f')]('$')[0x0]:undefined;_0xfcd11a[_0x02cd('0x23')]=_0x148545[_0x02cd('0x13')]?(_0xfcd11a[_0x02cd('0x24')]||'')+_0x02cd('0x25')+_0x148545['cutdigits']+'}':(_0xfcd11a[_0x02cd('0x24')]||'')+_0x02cd('0x26');_0x2c57c8[_0x251766[_0x543f5d][_0x02cd('0x22')]]=[_0x02cd('0x27'),_0xfcd11a['trunk'],_0xfcd11a[_0x02cd('0x23')]][_0x02cd('0x28')]('/');break;case _0x02cd('0x29'):_0xfcd11a[_0x02cd('0x29')]=_0x261a50[_0x251766[_0x543f5d]['param']];if(_0x148545['recordingFormat']!=='none'){if(_0xfcd11a[_0x02cd('0x29')][_0x02cd('0x2a')](_0x02cd('0x2b'))<0x0){_0xfcd11a[_0x02cd('0x29')]+=_0x02cd('0x2b');}}else{_0xfcd11a[_0x02cd('0x29')]=_0xfcd11a[_0x02cd('0x29')][_0x02cd('0x2c')](_0x02cd('0x2b'),'');}_0x2c57c8[_0x251766[_0x543f5d][_0x02cd('0x22')]]=_0xfcd11a[_0x02cd('0x29')];break;default:_0x2c57c8[_0x251766[_0x543f5d][_0x02cd('0x22')]]=_0x261a50[_0x251766[_0x543f5d]['param']];}}return _0x2c57c8[_0x02cd('0x28')](',');}function _0x222fe1(_0x58d3f5,_0x1cd391,_0x5e1617){return new Promise(function(_0x252eec,_0x3e7355){var _0x27833c=[];if(_[_0x02cd('0x2d')](_0x1cd391))return _0x252eec(_0x27833c);_0x22baca[_0x02cd('0x2e')][_0x02cd('0x2f')]({'attributes':['id','interval',_0x02cd('0x30')],'raw':!![]})[_0x02cd('0x31')](function(_0x10c4b8){for(var _0x47fc37=0x0,_0x3c0b89=0x0;_0x47fc37<_0x1cd391['length'];_0x47fc37++,_0x3c0b89=0x0){var _0x451624=_0x1cd391[_0x47fc37];var _0x19fa67=[];var _0x34c045=[];delete _0x451624['id'];if(_0x451624[_0x02cd('0x32')]!==_0x02cd('0x33')){_0x451624[_0x02cd('0x34')]=[_0x451624[_0x02cd('0x32')]];}else{_0x451624['intervals']=_0x451624['IntervalId']?_[_0x02cd('0x35')](_[_0x02cd('0x36')](_0x10c4b8,{'IntervalId':_0x451624[_0x02cd('0x30')]}),_0x02cd('0x32')):[];}_0x451624[_0x02cd('0x5')]=_0x58d3f5[_0x02cd('0x5')];_0x451624[_0x02cd('0x6')]=_0x58d3f5[_0x02cd('0x6')];if(_0x451624['type'])_0x451624[_0x02cd('0x2')]=_0x451624[_0x02cd('0x2')][_0x02cd('0x37')]();if(_0x58d3f5[_0x02cd('0x2')]===_0x02cd('0x10')){if(_0x451624['hasOwnProperty'](_0x02cd('0x38'))&&_0x451624[_0x02cd('0x38')]&&_0x451624[_0x02cd('0x38')]!=='--'){_0x19fa67[_0x02cd('0xd')]({'type':_0x451624['type']['toLowerCase'](),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x39')+_0x451624[_0x02cd('0x38')],'context':_0x58d3f5['context'],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')][_0x02cd('0x20')]+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});}_0x19fa67[_0x02cd('0xd')]({'type':_0x451624[_0x02cd('0x2')][_0x02cd('0x37')](),'app':'ExecIf','appdata':_0x02cd('0x3a')+(_0x451624[_0x02cd('0x3b')]?_0x02cd('0x3c')+_0x451624[_0x02cd('0x3b')]+')':_0x02cd('0x3d')),'context':_0x58d3f5[_0x02cd('0x5')],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')][_0x02cd('0x20')]+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});}else{if(_0x451624['hasOwnProperty']('answer')){if([_0x02cd('0x3e'),'playback'][_0x02cd('0x3f')](_0x451624[_0x02cd('0x40')][_0x02cd('0x37')]())&&_0x451624[_0x02cd('0x41')]!==_0x02cd('0x42')){if(_0x451624[_0x02cd('0x43')]){_0x19fa67[_0x02cd('0xd')]({'type':_0x451624[_0x02cd('0x2')][_0x02cd('0x37')](),'app':'ExecIf','appdata':_0x02cd('0x44'),'context':_0x58d3f5['context'],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')]['length']+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});_0x19fa67[_0x02cd('0xd')]({'type':_0x451624[_0x02cd('0x2')]['toLowerCase'](),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x45'),'context':_0x58d3f5[_0x02cd('0x5')],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')]['length']+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});}else{_0x19fa67[_0x02cd('0xd')]({'type':_0x451624[_0x02cd('0x2')]['toLowerCase'](),'app':_0x02cd('0x14'),'appdata':_0x02cd('0x46'),'context':_0x58d3f5[_0x02cd('0x5')],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')][_0x02cd('0x20')]+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});_0x19fa67['push']({'type':_0x451624['type'][_0x02cd('0x37')](),'app':_0x02cd('0x3'),'appdata':_0x02cd('0x47'),'context':_0x58d3f5[_0x02cd('0x5')],'exten':_0x58d3f5[_0x02cd('0x6')],'priority':_0x451624[_0x02cd('0x34')][_0x02cd('0x20')]+_0x5e1617+_0x3c0b89++,'VoiceExtensionId':_0x58d3f5['id']});}}}}for(var _0x4c7512=0x0;_0x4c7512<_0x451624[_0x02cd('0x34')][_0x02cd('0x20')];_0x4c7512++){var _0x1e234d=_0x5e1617+_0x451624['intervals'][_0x02cd('0x20')];var _0x1479e1=_0x4c7512===_0x451624['intervals'][_0x02cd('0x20')]-0x1?_0x5e1617+_0x19fa67[_0x02cd('0x20')]+_0x34c045[_0x02cd('0x20')]+0x2:_0x5e1617+_0x4c7512+0x1;_0x19fa67[_0x02cd('0x48')](_0x4c7512,0x0,{'type':_0x58d3f5[_0x02cd('0x2')],'app':_0x02cd('0x49'),'appdata':_0x451624[_0x02cd('0x34')][_0x4c7512]+'?'+_0x58d3f5[_0x02cd('0x5')]+_0x02cd('0x4a')+_0x1e234d+':'+_0x58d3f5[_0x02cd('0x5')]+',${EXTEN},'+_0x1479e1,'exten':_0x58d3f5['exten'],'context':_0x58d3f5['context'],'priority':_0x5e1617+_0x4c7512,'VoiceExtensionId':_0x58d3f5['id']});}if(_0x451624[_0x02cd('0x41')]==='outboundDial')_0x451624[_0x02cd('0x4b')]=_0x16f378(_0x58d3f5,_0x451624['appdata']);_0x451624[_0x02cd('0x4c')]=_0x19fa67[_0x02cd('0x20')]?_['last'](_0x19fa67)['priority']+0x1:_0x5e1617;_0x27833c=_[_0x02cd('0x4d')](_0x27833c,_0x19fa67,[_0x451624],_0x34c045);_0x5e1617=_['last'](_0x27833c)[_0x02cd('0x4c')]+0x1;}return _0x252eec(_0x27833c);})['catch'](function(_0x5118b3){_0x3e7355(_0x5118b3);});});}return _0x5184c5[_0x02cd('0x4e')](_0x02cd('0x4f'),attributes,{'tableName':_0x02cd('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xfa7eca){var _0x56ffea=this['get']({'plain':!![]});var _0x67e0b6=_0x56ffea[_0x02cd('0x2')]===_0x02cd('0x10')?_0x94301f(_0x56ffea):_0x55565b(_0x56ffea);return _0x222fe1(_0x56ffea,_0xfa7eca,_[_0x02cd('0x51')](_0x67e0b6)[_0x02cd('0x4c')]+0x1)[_0x02cd('0x31')](function(_0xa8da7a){var _0x457899=_[_0x02cd('0x4d')](_0x67e0b6,_0xa8da7a);_0x457899[_0x02cd('0xd')]({'type':_0x56ffea[_0x02cd('0x2')],'app':'Hangup','exten':_0x56ffea['exten'],'context':_0x56ffea[_0x02cd('0x5')],'priority':_['last'](_0x457899)[_0x02cd('0x4c')]+0x1,'VoiceExtensionId':_0x56ffea['id']});return _0x457899;});}}});}; \ No newline at end of file +var _0xccd7=['phone','prefix','${EXTEN:','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','intervals','map','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','CDR(type)=','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param'];(function(_0x1080f5,_0x1021d3){var _0x193ed3=function(_0x39d0a3){while(--_0x39d0a3){_0x1080f5['push'](_0x1080f5['shift']());}};_0x193ed3(++_0x1021d3);}(_0xccd7,0x75));var _0x7ccd=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xccd7[_0x3fb9dd];return _0x20136a;};'use strict';var _=require('lodash');var attributes=require(_0x7ccd('0x0'));module[_0x7ccd('0x1')]=function(_0x34cf48){var _0x17e0f2=_0x34cf48[_0x7ccd('0x2')];function _0x17bd10(_0x34626f){var _0x1ec9a1=0x2;var _0x4aac3b=[{'type':_0x34626f[_0x7ccd('0x3')],'app':'Set','appdata':_0x7ccd('0x4')+_0x34626f[_0x7ccd('0x3')],'context':_0x34626f['context'],'exten':_0x34626f['exten'],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f['type'],'app':_0x34626f[_0x7ccd('0x5')]?_0x7ccd('0x6'):_0x7ccd('0x7'),'appdata':_0x34626f[_0x7ccd('0x5')]?_0x7ccd('0x8')+_0x34626f[_0x7ccd('0x5')]:_0x7ccd('0x9'),'context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']}];if(_0x34626f['type']===_0x7ccd('0xc')){_0x4aac3b[_0x7ccd('0xd')]({'type':_0x7ccd('0xc'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xe')+_0x34626f['id'],'context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f['exten'],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']});}_0x4aac3b[_0x7ccd('0xd')]({'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xf'),'context':_0x34626f['context'],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x10'),'context':_0x34626f['context'],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']});return _0x4aac3b;}function _0x16335e(_0x156616){var _0x225321=0x2;var _0x14141c=[{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x7ccd('0x12'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x156616[_0x7ccd('0x5')]?'Set':'NoOp','appdata':_0x156616[_0x7ccd('0x5')]?'CDR(routeAlias)='+_0x156616[_0x7ccd('0x5')]:_0x7ccd('0x9'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616['exten'],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x7ccd('0x13')+(_0x156616['cutdigits']?'${EXTEN:'+_0x156616[_0x7ccd('0x14')]+'}':_0x7ccd('0x15')),'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xe')+_0x156616['id'],'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x16'),'appdata':_0x7ccd('0x17')+(_0x225321+0x2)+_0x7ccd('0x18')+(_0x225321+0x1)+')','context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x156616[_0x7ccd('0x14')]?_0x7ccd('0x19')+_0x156616[_0x7ccd('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x1a'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616['exten'],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xf'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x10'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':'Set','appdata':_0x7ccd('0x1b')+_0x156616['id'],'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']}];if(_0x156616[_0x7ccd('0x1c')](_0x7ccd('0x1d'))&&_0x156616['recordingFormat']!==_0x7ccd('0x1e')){_0x14141c[_0x7ccd('0xd')]({'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x1f'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x20')+_0x156616[_0x7ccd('0x1d')]||_0x7ccd('0x21'),'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']});}return _0x14141c;}function _0x13d8a6(_0x3b8d3a,_0x1a4821){var _0x2a598c=[{'name':_0x7ccd('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x7ccd('0x23'),'param':0x2},{'name':_0x7ccd('0x24'),'param':0x3}];var _0x2fd0ab={};var _0x45d2d6=_0x1a4821[_0x7ccd('0x25')](',');var _0x171600=[];for(var _0x2fac2e=0x0;_0x2fac2e<_0x2a598c[_0x7ccd('0x26')];_0x2fac2e++){switch(_0x2a598c[_0x2fac2e][_0x7ccd('0x27')]){case _0x7ccd('0x22'):_0x2fd0ab[_0x7ccd('0x22')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]][_0x7ccd('0x25')]('/')[0x1];_0x2fd0ab[_0x7ccd('0x29')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]][_0x7ccd('0x25')]('/')[0x2];_0x2fd0ab[_0x7ccd('0x2a')]=_0x2fd0ab[_0x7ccd('0x29')]?_0x2fd0ab[_0x7ccd('0x29')][_0x7ccd('0x25')]('$')[0x0]:undefined;_0x2fd0ab[_0x7ccd('0x29')]=_0x3b8d3a['cutdigits']?(_0x2fd0ab['prefix']||'')+_0x7ccd('0x2b')+_0x3b8d3a['cutdigits']+'}':(_0x2fd0ab[_0x7ccd('0x2a')]||'')+_0x7ccd('0x15');_0x171600[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]]=[_0x7ccd('0x2c'),_0x2fd0ab[_0x7ccd('0x22')],_0x2fd0ab[_0x7ccd('0x29')]][_0x7ccd('0x2d')]('/');break;case _0x7ccd('0x23'):_0x2fd0ab[_0x7ccd('0x23')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]];if(_0x3b8d3a[_0x7ccd('0x1d')]!==_0x7ccd('0x1e')){if(_0x2fd0ab['options']['indexOf'](_0x7ccd('0x2e'))<0x0){_0x2fd0ab['options']+=_0x7ccd('0x2e');}}else{_0x2fd0ab['options']=_0x2fd0ab[_0x7ccd('0x23')][_0x7ccd('0x2f')]('U(xcally-mixmonitor-context)','');}_0x171600[_0x2a598c[_0x2fac2e]['param']]=_0x2fd0ab[_0x7ccd('0x23')];break;default:_0x171600[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]];}}return _0x171600['join'](',');}function _0x5b6dba(_0x54e0b8,_0x526184,_0x18e537){return new Promise(function(_0x1e1471,_0x5d88ba){var _0x11bcc5=[];if(_[_0x7ccd('0x30')](_0x526184))return _0x1e1471(_0x11bcc5);_0x17e0f2[_0x7ccd('0x31')]['findAll']({'attributes':['id',_0x7ccd('0x32'),_0x7ccd('0x33')],'raw':!![]})[_0x7ccd('0x34')](function(_0x2db5a7){for(var _0x2922af=0x0,_0x41cad7=0x0;_0x2922af<_0x526184[_0x7ccd('0x26')];_0x2922af++,_0x41cad7=0x0){var _0x38cb23=_0x526184[_0x2922af];var _0x2efbf0=[];var _0x6b1763=[];delete _0x38cb23['id'];if(_0x38cb23[_0x7ccd('0x32')]!=='*,*,*,*'){_0x38cb23[_0x7ccd('0x35')]=[_0x38cb23[_0x7ccd('0x32')]];}else{_0x38cb23['intervals']=_0x38cb23['IntervalId']?_[_0x7ccd('0x36')](_['filter'](_0x2db5a7,{'IntervalId':_0x38cb23[_0x7ccd('0x33')]}),'interval'):[];}_0x38cb23[_0x7ccd('0xa')]=_0x54e0b8[_0x7ccd('0xa')];_0x38cb23[_0x7ccd('0xb')]=_0x54e0b8[_0x7ccd('0xb')];if(_0x38cb23[_0x7ccd('0x3')])_0x38cb23['type']=_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')]();if(_0x54e0b8[_0x7ccd('0x3')]===_0x7ccd('0x11')){if(_0x38cb23[_0x7ccd('0x1c')](_0x7ccd('0x38'))&&_0x38cb23['tag']&&_0x38cb23[_0x7ccd('0x38')]!=='--'){_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x39')+_0x38cb23['tag'],'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}_0x2efbf0['push']({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x38cb23['callerID']?'Set(CALLERID(all)='+_0x38cb23[_0x7ccd('0x3a')]+')':_0x7ccd('0x3b')),'context':_0x54e0b8['context'],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}else{if(_0x38cb23[_0x7ccd('0x1c')](_0x7ccd('0x3c'))){if([_0x7ccd('0x3d'),'playback'][_0x7ccd('0x3e')](_0x38cb23['app'][_0x7ccd('0x37')]())&&_0x38cb23[_0x7ccd('0x3f')]!=='custom'){if(_0x38cb23[_0x7ccd('0x3c')]){_0x2efbf0['push']({'type':_0x38cb23[_0x7ccd('0x3')]['toLowerCase'](),'app':_0x7ccd('0x16'),'appdata':_0x7ccd('0x40'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x41'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}else{_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23['type'][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x42'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8['exten'],'priority':_0x38cb23['intervals'][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}}}}for(var _0x5f2af6=0x0;_0x5f2af6<_0x38cb23[_0x7ccd('0x35')]['length'];_0x5f2af6++){var _0x2fb965=_0x18e537+_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')];var _0x2dc5ec=_0x5f2af6===_0x38cb23['intervals'][_0x7ccd('0x26')]-0x1?_0x18e537+_0x2efbf0[_0x7ccd('0x26')]+_0x6b1763['length']+0x2:_0x18e537+_0x5f2af6+0x1;_0x2efbf0[_0x7ccd('0x43')](_0x5f2af6,0x0,{'type':_0x54e0b8[_0x7ccd('0x3')],'app':_0x7ccd('0x44'),'appdata':_0x38cb23[_0x7ccd('0x35')][_0x5f2af6]+'?'+_0x54e0b8[_0x7ccd('0xa')]+_0x7ccd('0x45')+_0x2fb965+':'+_0x54e0b8[_0x7ccd('0xa')]+_0x7ccd('0x45')+_0x2dc5ec,'exten':_0x54e0b8['exten'],'context':_0x54e0b8[_0x7ccd('0xa')],'priority':_0x18e537+_0x5f2af6,'VoiceExtensionId':_0x54e0b8['id']});}if(_0x38cb23['appType']===_0x7ccd('0x46'))_0x38cb23[_0x7ccd('0x47')]=_0x13d8a6(_0x54e0b8,_0x38cb23['appdata']);_0x38cb23[_0x7ccd('0x48')]=_0x2efbf0['length']?_[_0x7ccd('0x49')](_0x2efbf0)[_0x7ccd('0x48')]+0x1:_0x18e537;_0x11bcc5=_[_0x7ccd('0x4a')](_0x11bcc5,_0x2efbf0,[_0x38cb23],_0x6b1763);_0x18e537=_[_0x7ccd('0x49')](_0x11bcc5)[_0x7ccd('0x48')]+0x1;}return _0x1e1471(_0x11bcc5);})[_0x7ccd('0x4b')](function(_0x55f9ae){_0x5d88ba(_0x55f9ae);});});}return _0x34cf48['define']('VoiceExtension',attributes,{'tableName':_0x7ccd('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x322240){var _0x3adfc9=this[_0x7ccd('0x4d')]({'plain':!![]});var _0x153479=_0x3adfc9[_0x7ccd('0x3')]===_0x7ccd('0x11')?_0x16335e(_0x3adfc9):_0x17bd10(_0x3adfc9);return _0x5b6dba(_0x3adfc9,_0x322240,_['last'](_0x153479)[_0x7ccd('0x48')]+0x1)[_0x7ccd('0x34')](function(_0x3e59f9){var _0x13c67c=_['concat'](_0x153479,_0x3e59f9);_0x13c67c['push']({'type':_0x3adfc9['type'],'app':_0x7ccd('0x4e'),'exten':_0x3adfc9['exten'],'context':_0x3adfc9[_0x7ccd('0xa')],'priority':_[_0x7ccd('0x49')](_0x13c67c)[_0x7ccd('0x48')]+0x1,'VoiceExtensionId':_0x3adfc9['id']});return _0x13c67c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d37d6a2..2c18f0a 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 _0xcb04=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','include','map','model','attributes','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x50063e,_0x5f2edb){var _0x9bac88=function(_0x2d93e4){while(--_0x2d93e4){_0x50063e['push'](_0x50063e['shift']());}};_0x9bac88(++_0x5f2edb);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var moment=require(_0x4cb0('0x2'));var BPromise=require(_0x4cb0('0x3'));var rs=require(_0x4cb0('0x4'));var fs=require('fs');var Redis=require(_0x4cb0('0x5'));var db=require(_0x4cb0('0x6'))['db'];var utils=require(_0x4cb0('0x7'));var logger=require(_0x4cb0('0x8'))(_0x4cb0('0x9'));var config=require('../../config/environment');var jayson=require(_0x4cb0('0xa'));var client=jayson[_0x4cb0('0xb')][_0x4cb0('0xc')]({'port':0x232a});config[_0x4cb0('0xd')]=_[_0x4cb0('0xe')](config[_0x4cb0('0xd')],{'host':_0x4cb0('0xf'),'port':0x18eb});var socket=require(_0x4cb0('0x10'))(new Redis(config[_0x4cb0('0xd')]));require(_0x4cb0('0x11'))[_0x4cb0('0x12')](socket);function respondWithRpcPromise(_0x10d679,_0x442a53,_0x24170c){return new BPromise(function(_0xc313bc,_0x57738){return client[_0x4cb0('0x13')](_0x10d679,_0x24170c)[_0x4cb0('0x14')](function(_0x5d5c99){logger[_0x4cb0('0x15')](_0x4cb0('0x16'),_0x442a53,_0x4cb0('0x17'));logger[_0x4cb0('0x18')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x442a53,_0x4cb0('0x17'),JSON[_0x4cb0('0x19')](_0x5d5c99));if(_0x5d5c99[_0x4cb0('0x1a')]){if(_0x5d5c99[_0x4cb0('0x1a')][_0x4cb0('0x1b')]===0x1f4){logger[_0x4cb0('0x1a')](_0x4cb0('0x16'),_0x442a53,_0x5d5c99[_0x4cb0('0x1a')][_0x4cb0('0x1c')]);return _0x57738(_0x5d5c99['error'][_0x4cb0('0x1c')]);}logger[_0x4cb0('0x1a')](_0x4cb0('0x16'),_0x442a53,_0x5d5c99[_0x4cb0('0x1a')]['message']);return _0xc313bc(_0x5d5c99['error'][_0x4cb0('0x1c')]);}else{logger[_0x4cb0('0x15')](_0x4cb0('0x16'),_0x442a53,_0x4cb0('0x17'));_0xc313bc(_0x5d5c99[_0x4cb0('0x1d')][_0x4cb0('0x1c')]);}})[_0x4cb0('0x1e')](function(_0x4cd6b5){logger['error'](_0x4cb0('0x16'),_0x442a53,_0x4cd6b5);_0x57738(_0x4cd6b5);});});}exports['GetVoiceExtension']=function(_0x4ca756){var _0x2dac48=this;return new Promise(function(_0x3b2f0c,_0x4981a8){return db[_0x4cb0('0x1f')][_0x4cb0('0x20')]({'raw':_0x4ca756[_0x4cb0('0x21')]?_0x4ca756['options'][_0x4cb0('0x22')]===undefined?!![]:![]:!![],'where':_0x4ca756['options']?_0x4ca756[_0x4cb0('0x21')][_0x4cb0('0x23')]||null:null,'attributes':_0x4ca756[_0x4cb0('0x21')]?_0x4ca756[_0x4cb0('0x21')]['attributes']||null:null,'limit':_0x4ca756[_0x4cb0('0x21')]?_0x4ca756[_0x4cb0('0x21')]['limit']||null:null,'include':_0x4ca756['options']?_0x4ca756[_0x4cb0('0x21')][_0x4cb0('0x24')]?_[_0x4cb0('0x25')](_0x4ca756[_0x4cb0('0x21')][_0x4cb0('0x24')],function(_0x3710eb){return{'model':db[_0x3710eb[_0x4cb0('0x26')]],'as':_0x3710eb['as'],'attributes':_0x3710eb[_0x4cb0('0x27')],'include':_0x3710eb[_0x4cb0('0x24')]?_[_0x4cb0('0x25')](_0x3710eb[_0x4cb0('0x24')],function(_0xde2bd9){return{'model':db[_0xde2bd9['model']],'as':_0xde2bd9['as'],'attributes':_0xde2bd9[_0x4cb0('0x27')],'include':_0xde2bd9[_0x4cb0('0x24')]?_[_0x4cb0('0x25')](_0xde2bd9[_0x4cb0('0x24')],function(_0x25a25d){return{'model':db[_0x25a25d['model']],'as':_0x25a25d['as'],'attributes':_0x25a25d[_0x4cb0('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1294ff){logger[_0x4cb0('0x15')](_0x4cb0('0x28'),_0x4ca756);logger['debug'](_0x4cb0('0x28'),_0x4ca756,JSON[_0x4cb0('0x19')](_0x1294ff));_0x3b2f0c(_0x1294ff);})[_0x4cb0('0x1e')](function(_0xe3ae3a){logger['error'](_0x4cb0('0x28'),_0xe3ae3a['message'],_0x4ca756);_0x4981a8(_0x2dac48['error'](0x1f4,_0xe3ae3a[_0x4cb0('0x1c')]));});});}; \ No newline at end of file +var _0x9576=['attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0xaf2427,_0x504859){var _0x67addb=function(_0x14b655){while(--_0x14b655){_0xaf2427['push'](_0xaf2427['shift']());}};_0x67addb(++_0x504859);}(_0x9576,0x182));var _0x6957=function(_0x10bf75,_0x20869){_0x10bf75=_0x10bf75-0x0;var _0x2675f8=_0x9576[_0x10bf75];return _0x2675f8;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});config[_0x6957('0xb')]=_[_0x6957('0xc')](config[_0x6957('0xb')],{'host':_0x6957('0xd'),'port':0x18eb});var socket=require(_0x6957('0xe'))(new Redis(config[_0x6957('0xb')]));require('./voiceExtension.socket')[_0x6957('0xf')](socket);function respondWithRpcPromise(_0x1dded8,_0x483af0,_0x55078f){return new BPromise(function(_0x3e0520,_0x25c338){return client[_0x6957('0x10')](_0x1dded8,_0x55078f)[_0x6957('0x11')](function(_0x3e2f16){logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x483af0,_0x6957('0x14'),JSON[_0x6957('0x15')](_0x3e2f16));if(_0x3e2f16[_0x6957('0x16')]){if(_0x3e2f16[_0x6957('0x16')][_0x6957('0x17')]===0x1f4){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16['error']['message']);return _0x25c338(_0x3e2f16['error'][_0x6957('0x18')]);}logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16[_0x6957('0x16')]['message']);return _0x3e0520(_0x3e2f16[_0x6957('0x16')]['message']);}else{logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');_0x3e0520(_0x3e2f16[_0x6957('0x19')][_0x6957('0x18')]);}})[_0x6957('0x1a')](function(_0x4c527c){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x4c527c);_0x25c338(_0x4c527c);});});}exports[_0x6957('0x1b')]=function(_0x135893){var _0x1ce753=this;return new Promise(function(_0x26d3fd,_0x35ee5b){return db[_0x6957('0x1c')]['findAll']({'raw':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x1e')]===undefined?!![]:![]:!![],'where':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x1f')]||null:null,'attributes':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x20')]||null:null,'limit':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x21')]||null:null,'include':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')]['include']?_['map'](_0x135893[_0x6957('0x1d')][_0x6957('0x22')],function(_0x5c4e49){return{'model':db[_0x5c4e49['model']],'as':_0x5c4e49['as'],'attributes':_0x5c4e49[_0x6957('0x20')],'include':_0x5c4e49[_0x6957('0x22')]?_[_0x6957('0x23')](_0x5c4e49['include'],function(_0x330015){return{'model':db[_0x330015[_0x6957('0x24')]],'as':_0x330015['as'],'attributes':_0x330015[_0x6957('0x20')],'include':_0x330015[_0x6957('0x22')]?_[_0x6957('0x23')](_0x330015[_0x6957('0x22')],function(_0x2d33ef){return{'model':db[_0x2d33ef[_0x6957('0x24')]],'as':_0x2d33ef['as'],'attributes':_0x2d33ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x11')](function(_0x3a6e07){logger[_0x6957('0x12')](_0x6957('0x1b'),_0x135893);logger[_0x6957('0x25')](_0x6957('0x1b'),_0x135893,JSON[_0x6957('0x15')](_0x3a6e07));_0x26d3fd(_0x3a6e07);})[_0x6957('0x1a')](function(_0x1300b1){logger[_0x6957('0x16')](_0x6957('0x1b'),_0x1300b1['message'],_0x135893);_0x35ee5b(_0x1ce753['error'](0x1f4,_0x1300b1[_0x6957('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d6cdfbf..4fd48a8 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x814b,0x1a2));var _0xb814=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x814b[_0x173441];return _0x2423a8;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x251699,_0x549104){var _0xcf1b50=function(_0xce46e8){while(--_0xce46e8){_0x251699['push'](_0x251699['shift']());}};_0xcf1b50(++_0x549104);}(_0x53ec,0x192));var _0xc53e=function(_0x29632e,_0x40f63f){_0x29632e=_0x29632e-0x0;var _0xda5a7e=_0x53ec[_0x29632e];return _0xda5a7e;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 363312c..636a799 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x59115f,_0x56e317){var _0x4672ff=function(_0x151041){while(--_0x151041){_0x59115f['push'](_0x59115f['shift']());}};_0x4672ff(++_0x56e317);}(_0x2ef3,0xba));var _0x32ef=function(_0x736602,_0x58c162){_0x736602=_0x736602-0x0;var _0x43b0cc=_0x2ef3[_0x736602];return _0x43b0cc;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x4991=['show','/:id/messages','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated'];(function(_0x5ea72f,_0x1ad3c6){var _0x49be44=function(_0x3fa258){while(--_0x3fa258){_0x5ea72f['push'](_0x5ea72f['shift']());}};_0x49be44(++_0x1ad3c6);}(_0x4991,0xf7));var _0x1499=function(_0x5e1ddd,_0x24438e){_0x5e1ddd=_0x5e1ddd-0x0;var _0x3addc5=_0x4991[_0x5e1ddd];return _0x3addc5;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['getMessages']);router[_0x1499('0xf')]('/',auth[_0x1499('0xc')](),controller['create']);router[_0x1499('0x10')](_0x1499('0xb'),auth['isAuthenticated'](),controller[_0x1499('0x11')]);router[_0x1499('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1499('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b87d0c4..30245b6 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 _0xe8d6=['TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','yes','ENUM'];(function(_0x16852f,_0x4e8e3e){var _0x13e242=function(_0xf77f45){while(--_0xf77f45){_0x16852f['push'](_0x16852f['shift']());}};_0x13e242(++_0x4e8e3e);}(_0xe8d6,0x76));var _0x6e8d=function(_0x276ec9,_0x5e5d0b){_0x276ec9=_0x276ec9-0x0;var _0x4d117d=_0xe8d6[_0x276ec9];return _0x4d117d;};'use strict';var Sequelize=require(_0x6e8d('0x0'));module[_0x6e8d('0x1')]={'customer_id':{'type':Sequelize[_0x6e8d('0x2')]},'context':{'type':Sequelize[_0x6e8d('0x2')],'defaultValue':_0x6e8d('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x6e8d('0x2')],'defaultValue':'','allowNull':![],'unique':_0x6e8d('0x4')},'password':{'type':Sequelize[_0x6e8d('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x514eeb){this[_0x6e8d('0x5')](_0x6e8d('0x6'),typeof _0x514eeb==='string'&&_0x514eeb[_0x6e8d('0x7')]()?_0x514eeb[_0x6e8d('0x7')]():null);}},'pager':{'type':Sequelize[_0x6e8d('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x6e8d('0x8'),'no'),'defaultValue':_0x6e8d('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':_0x6e8d('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x6e8d('0x2')]},'callback':{'type':Sequelize[_0x6e8d('0x2')]},'review':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6e8d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':_0x6e8d('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6e8d('0x9')](_0x6e8d('0x8'),'no'),'defaultValue':_0x6e8d('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x6e8d('0x2')]},'maxsecs':{'type':Sequelize[_0x6e8d('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6e8d('0xc')],'get':function(){return this[_0x6e8d('0xd')]('fullname')+_0x6e8d('0xe')+this[_0x6e8d('0xd')](_0x6e8d('0xf'));}}}; \ No newline at end of file +var _0xcde0=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x40ce01,_0x1e39c8){var _0xa0f16e=function(_0x2356ad){while(--_0x2356ad){_0x40ce01['push'](_0x40ce01['shift']());}};_0xa0f16e(++_0x1e39c8);}(_0xcde0,0x193));var _0x0cde=function(_0x3a6dbb,_0x484fc8){_0x3a6dbb=_0x3a6dbb-0x0;var _0x1a4f5c=_0xcde0[_0x3a6dbb];return _0x1a4f5c;};'use strict';var Sequelize=require('sequelize');module[_0x0cde('0x0')]={'customer_id':{'type':Sequelize[_0x0cde('0x1')]},'context':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':_0x0cde('0x2'),'unique':_0x0cde('0x3')},'mailbox':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0cde('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0cde('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2e57ac){this[_0x0cde('0x4')]('email',typeof _0x2e57ac===_0x0cde('0x5')&&_0x2e57ac[_0x0cde('0x6')]()?_0x2e57ac[_0x0cde('0x6')]():null);}},'pager':{'type':Sequelize[_0x0cde('0x1')]},'tz':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':_0x0cde('0x7')},'attach':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0cde('0x1')]},'callback':{'type':Sequelize[_0x0cde('0x1')]},'review':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0cde('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'stamp':{'type':_0x0cde('0xb')},'emailsubject':{'type':Sequelize[_0x0cde('0x1')]},'emailbody':{'type':Sequelize[_0x0cde('0x1')]},'maxsecs':{'type':Sequelize[_0x0cde('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0cde('0xd')],'get':function(){return this[_0x0cde('0xe')](_0x0cde('0xf'))+_0x0cde('0x10')+this[_0x0cde('0xe')](_0x0cde('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f35a4c4..58d3a06 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 _0xe706=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','VoiceMail','findAll','catch','keys','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','params','destroy','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','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'];(function(_0x342160,_0x3911ca){var _0x5b5547=function(_0x1934aa){while(--_0x1934aa){_0x342160['push'](_0x342160['shift']());}};_0x5b5547(++_0x3911ca);}(_0xe706,0xa3));var _0x6e70=function(_0x1afadf,_0x357131){_0x1afadf=_0x1afadf-0x0;var _0x3a3b4a=_0xe706[_0x1afadf];return _0x3a3b4a;};'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(){var _0x41e352=_0x538b9c[_0x6e70('0x2a')]({'plain':!![]});var _0x51d292=_0x6e70('0x2b');return db[_0x6e70('0x2c')]['destroy']({'where':{'type':_0x51d292,'resourceId':_0x41e352['id']}})[_0x6e70('0x29')](function(){return _0x538b9c;});})[_0x6e70('0x29')](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a5fe,_0x2c4d37){return function(_0x3af17f){if(!_0x3af17f){_0x54a5fe[_0x6e70('0x1d')](0x194);}return _0x3af17f;};}function handleError(_0x114344,_0x43fee0){_0x43fee0=_0x43fee0||0x1f4;return function(_0x5d772a){logger[_0x6e70('0x2d')](_0x5d772a[_0x6e70('0x2e')]);if(_0x5d772a[_0x6e70('0x2f')]){delete _0x5d772a[_0x6e70('0x2f')];}_0x114344[_0x6e70('0x1e')](_0x43fee0)[_0x6e70('0x30')](_0x5d772a);};}exports[_0x6e70('0x31')]=function(_0x24114a,_0x3a0821){var _0x3a5d30={},_0x4b1229={},_0x1b27d8={'count':0x0,'rows':[]};var _0x50d60b=_[_0x6e70('0x32')](db['VoiceMail'][_0x6e70('0x33')],function(_0x2722e8){return{'name':_0x2722e8[_0x6e70('0x34')],'type':_0x2722e8['type'][_0x6e70('0x35')]};});_0x4b1229[_0x6e70('0x36')]=_['map'](_0x50d60b,_0x6e70('0x2f'));_0x4b1229[_0x6e70('0x37')]=_['keys'](_0x24114a[_0x6e70('0x37')]);_0x4b1229[_0x6e70('0x38')]=_[_0x6e70('0x39')](_0x4b1229[_0x6e70('0x36')],_0x4b1229[_0x6e70('0x37')]);_0x3a5d30[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x4b1229[_0x6e70('0x36')],qs[_0x6e70('0x3b')](_0x24114a[_0x6e70('0x37')]['fields']));_0x3a5d30[_0x6e70('0x3a')]=_0x3a5d30['attributes'][_0x6e70('0x3c')]?_0x3a5d30[_0x6e70('0x3a')]:_0x4b1229[_0x6e70('0x36')];if(!_0x24114a[_0x6e70('0x37')][_0x6e70('0x3d')](_0x6e70('0x3e'))){_0x3a5d30[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x24114a[_0x6e70('0x37')][_0x6e70('0x20')]);_0x3a5d30[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x24114a[_0x6e70('0x37')]['offset']);}_0x3a5d30['order']=qs['sort'](_0x24114a[_0x6e70('0x37')][_0x6e70('0x3f')]);_0x3a5d30[_0x6e70('0x40')]=qs[_0x6e70('0x38')](_[_0x6e70('0x41')](_0x24114a[_0x6e70('0x37')],_0x4b1229['filters']),_0x50d60b);if(_0x24114a[_0x6e70('0x37')][_0x6e70('0x42')]){_0x3a5d30[_0x6e70('0x40')]=_[_0x6e70('0x43')](_0x3a5d30[_0x6e70('0x40')],{'$or':_[_0x6e70('0x32')](_0x50d60b,function(_0x246e61){if(_0x246e61[_0x6e70('0x44')]!=='VIRTUAL'){var _0x2c0bd1={};_0x2c0bd1[_0x246e61[_0x6e70('0x2f')]]={'$like':'%'+_0x24114a[_0x6e70('0x37')][_0x6e70('0x42')]+'%'};return _0x2c0bd1;}})});}_0x3a5d30=_[_0x6e70('0x43')]({},_0x3a5d30,_0x24114a[_0x6e70('0x45')]);var _0x21b0e7={'where':_0x3a5d30['where']};return db['VoiceMail']['count'](_0x21b0e7)[_0x6e70('0x29')](function(_0x2b63cc){_0x1b27d8[_0x6e70('0x21')]=_0x2b63cc;if(_0x24114a[_0x6e70('0x37')][_0x6e70('0x46')]){_0x3a5d30['include']=[{'all':!![]}];}return db[_0x6e70('0x47')][_0x6e70('0x48')](_0x3a5d30);})[_0x6e70('0x29')](function(_0x52b197){_0x1b27d8['rows']=_0x52b197;return _0x1b27d8;})['then'](respondWithFilteredResult(_0x3a0821,_0x3a5d30))[_0x6e70('0x49')](handleError(_0x3a0821,null));};exports['show']=function(_0x42f49a,_0x39913a){var _0x3fed21={'raw':!![],'where':{'id':_0x42f49a['params']['id']}},_0x75a90d={};_0x75a90d[_0x6e70('0x36')]=_['keys'](db[_0x6e70('0x47')][_0x6e70('0x33')]);_0x75a90d[_0x6e70('0x37')]=_[_0x6e70('0x4a')](_0x42f49a['query']);_0x75a90d[_0x6e70('0x38')]=_[_0x6e70('0x39')](_0x75a90d[_0x6e70('0x36')],_0x75a90d[_0x6e70('0x37')]);_0x3fed21[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x75a90d[_0x6e70('0x36')],qs['fields'](_0x42f49a[_0x6e70('0x37')][_0x6e70('0x3b')]));_0x3fed21[_0x6e70('0x3a')]=_0x3fed21[_0x6e70('0x3a')][_0x6e70('0x3c')]?_0x3fed21[_0x6e70('0x3a')]:_0x75a90d[_0x6e70('0x36')];if(_0x42f49a['query'][_0x6e70('0x46')]){_0x3fed21['include']=[{'all':!![]}];}_0x3fed21=_[_0x6e70('0x43')]({},_0x3fed21,_0x42f49a[_0x6e70('0x45')]);return db['VoiceMail']['find'](_0x3fed21)[_0x6e70('0x29')](handleEntityNotFound(_0x39913a,null))[_0x6e70('0x29')](respondWithResult(_0x39913a,null))[_0x6e70('0x49')](handleError(_0x39913a,null));};exports['create']=function(_0x4af9b1,_0x238ebb){return db[_0x6e70('0x47')][_0x6e70('0x4b')](_0x4af9b1[_0x6e70('0x4c')],{})[_0x6e70('0x29')](function(_0x340674){var _0x4ad5a9=_0x4af9b1[_0x6e70('0x4d')][_0x6e70('0x2a')]({'plain':!![]});if(!_0x4ad5a9)throw new Error(_0x6e70('0x4e'));if(_0x4ad5a9[_0x6e70('0x4f')]===_0x6e70('0x4d')){var _0x4b354e=_0x340674['get']({'plain':!![]});var _0x2c5538=_0x6e70('0x2b');return db[_0x6e70('0x50')][_0x6e70('0x51')]({'where':{'name':_0x2c5538,'userProfileId':_0x4ad5a9[_0x6e70('0x52')]},'raw':!![]})['then'](function(_0x41bd0b){if(_0x41bd0b&&_0x41bd0b[_0x6e70('0x53')]===0x0){return db[_0x6e70('0x2c')][_0x6e70('0x4b')]({'name':_0x4b354e[_0x6e70('0x2f')],'resourceId':_0x4b354e['id'],'type':_0x41bd0b['name'],'sectionId':_0x41bd0b['id']},{})[_0x6e70('0x29')](function(){return _0x340674;});}else{return _0x340674;}})[_0x6e70('0x49')](function(_0x2c20d3){logger[_0x6e70('0x2d')](_0x6e70('0x54'),_0x2c20d3);throw _0x2c20d3;});}return _0x340674;})[_0x6e70('0x29')](respondWithResult(_0x238ebb,0xc9))['catch'](handleError(_0x238ebb,null));};exports[_0x6e70('0x28')]=function(_0x8d425d,_0x5c2396){if(_0x8d425d[_0x6e70('0x4c')]['id']){delete _0x8d425d[_0x6e70('0x4c')]['id'];}return db['VoiceMail'][_0x6e70('0x51')]({'where':{'id':_0x8d425d[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x5c2396,null))[_0x6e70('0x29')](saveUpdates(_0x8d425d[_0x6e70('0x4c')],null))['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0x49')](handleError(_0x5c2396,null));};exports[_0x6e70('0x56')]=function(_0x10d655,_0x13be81){return db[_0x6e70('0x47')][_0x6e70('0x51')]({'where':{'id':_0x10d655[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x13be81,null))[_0x6e70('0x29')](removeEntity(_0x13be81,null))[_0x6e70('0x49')](handleError(_0x13be81,null));};exports[_0x6e70('0x57')]=function(_0x1b12a1,_0xb8f78,_0x1fd9a6){return db[_0x6e70('0x47')][_0x6e70('0x58')]({'where':{'id':_0x1b12a1[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0xb8f78,null))[_0x6e70('0x29')](function(_0x1c7dca){var _0x4c6aab;var _0x28898a={},_0x4434dd={};_0x4434dd[_0x6e70('0x36')]=_[_0x6e70('0x4a')](db[_0x6e70('0x59')][_0x6e70('0x33')]);_0x4434dd['query']=_[_0x6e70('0x4a')](_0x1b12a1[_0x6e70('0x37')]);_0x4434dd['filters']=_[_0x6e70('0x39')](_0x4434dd[_0x6e70('0x36')],_0x4434dd[_0x6e70('0x37')]);_0x28898a['attributes']=_['intersection'](_0x4434dd[_0x6e70('0x36')],qs[_0x6e70('0x3b')](_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3b')]));_0x28898a[_0x6e70('0x3a')]=_0x28898a[_0x6e70('0x3a')][_0x6e70('0x3c')]?_0x28898a['attributes']:_0x4434dd['model'];if(!_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3d')](_0x6e70('0x3e'))){_0x28898a[_0x6e70('0x20')]=qs['limit'](_0x1b12a1['query'][_0x6e70('0x20')]);_0x28898a[_0x6e70('0x22')]=qs['offset'](_0x1b12a1['query'][_0x6e70('0x22')]);}_0x28898a['order']=qs[_0x6e70('0x3f')](_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3f')]);_0x28898a[_0x6e70('0x40')]=qs[_0x6e70('0x38')](_[_0x6e70('0x41')](_0x1b12a1[_0x6e70('0x37')],_0x4434dd[_0x6e70('0x38')]));if(_0x1b12a1['query'][_0x6e70('0x42')]){_0x28898a[_0x6e70('0x40')]=_[_0x6e70('0x43')](_0x28898a[_0x6e70('0x40')],{'$or':_[_0x6e70('0x32')](_0x28898a['attributes'],function(_0x5f5b02){var _0x5979bf={};_0x5979bf[_0x5f5b02]={'$like':'%'+_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x42')]+'%'};return _0x5979bf;})});}_0x28898a[_0x6e70('0x40')]=_['merge'](_0x28898a['where'],{'mailboxuser':_0x1c7dca[_0x6e70('0x5a')]});_0x28898a=_[_0x6e70('0x43')]({},_0x28898a,_0x1b12a1[_0x6e70('0x45')]);return db[_0x6e70('0x59')][_0x6e70('0x5b')](_0x28898a)[_0x6e70('0x29')](respondWithFilteredResult(_0xb8f78,_0x28898a));})['catch'](handleError(_0xb8f78,null));}; \ No newline at end of file +var _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb574,0x106));var _0x4b57=function(_0x3ff5ea,_0x40f5a7){_0x3ff5ea=_0x3ff5ea-0x0;var _0xcc5b36=_0xb574[_0x3ff5ea];return _0xcc5b36;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6434713..b7f1523 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 _0x88ca=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x88ca,0x1cd));var _0xa88c=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x88ca[_0x810025];return _0x4dbc81;};'use strict';var _=require(_0xa88c('0x0'));var util=require(_0xa88c('0x1'));var logger=require(_0xa88c('0x2'))(_0xa88c('0x3'));var moment=require(_0xa88c('0x4'));var BPromise=require('bluebird');var rp=require(_0xa88c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa88c('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x485380,_0x4e0047){return _0x485380[_0xa88c('0x7')](_0xa88c('0x8'),attributes,{'tableName':_0xa88c('0x9'),'paranoid':![],'indexes':[{'name':_0xa88c('0xa'),'fields':[_0xa88c('0xb'),_0xa88c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5385=['exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x526c9a,_0x571d87){var _0x22f2eb=function(_0x1c9e9e){while(--_0x1c9e9e){_0x526c9a['push'](_0x526c9a['shift']());}};_0x22f2eb(++_0x571d87);}(_0x5385,0x106));var _0x5538=function(_0x10f50f,_0x5d655c){_0x10f50f=_0x10f50f-0x0;var _0x3ea740=_0x5385[_0x10f50f];return _0x3ea740;};'use strict';var _=require(_0x5538('0x0'));var util=require('util');var logger=require(_0x5538('0x1'))(_0x5538('0x2'));var moment=require(_0x5538('0x3'));var BPromise=require(_0x5538('0x4'));var rp=require(_0x5538('0x5'));var fs=require('fs');var path=require(_0x5538('0x6'));var rimraf=require(_0x5538('0x7'));var config=require(_0x5538('0x8'));var attributes=require(_0x5538('0x9'));module[_0x5538('0xa')]=function(_0x1b92b6,_0x55ece9){return _0x1b92b6[_0x5538('0xb')](_0x5538('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x5538('0xd'),'fields':[_0x5538('0xe'),_0x5538('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b6e3d83..79f7741 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 _0x0f30=['info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5a42b,_0x44ef00){var _0x427d1b=function(_0x1f0717){while(--_0x1f0717){_0x5a42b['push'](_0x5a42b['shift']());}};_0x427d1b(++_0x44ef00);}(_0x0f30,0xb2));var _0x00f3=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x0f30[_0x177346];return _0x155669;};'use strict';var _=require(_0x00f3('0x0'));var util=require(_0x00f3('0x1'));var moment=require(_0x00f3('0x2'));var BPromise=require(_0x00f3('0x3'));var rs=require(_0x00f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x00f3('0x5'));var logger=require(_0x00f3('0x6'))(_0x00f3('0x7'));var config=require('../../config/environment');var jayson=require(_0x00f3('0x8'));var client=jayson[_0x00f3('0x9')][_0x00f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa063,_0x3113a5,_0x1c71fe){return new BPromise(function(_0x55c6d4,_0x30b53f){return client[_0x00f3('0xb')](_0x5aa063,_0x1c71fe)[_0x00f3('0xc')](function(_0x21c0ef){logger['info'](_0x00f3('0xd'),_0x3113a5,_0x00f3('0xe'));logger[_0x00f3('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3113a5,_0x00f3('0xe'),JSON[_0x00f3('0x10')](_0x21c0ef));if(_0x21c0ef[_0x00f3('0x11')]){if(_0x21c0ef[_0x00f3('0x11')][_0x00f3('0x12')]===0x1f4){logger[_0x00f3('0x11')](_0x00f3('0xd'),_0x3113a5,_0x21c0ef[_0x00f3('0x11')]['message']);return _0x30b53f(_0x21c0ef[_0x00f3('0x11')][_0x00f3('0x13')]);}logger[_0x00f3('0x11')](_0x00f3('0xd'),_0x3113a5,_0x21c0ef[_0x00f3('0x11')][_0x00f3('0x13')]);return _0x55c6d4(_0x21c0ef[_0x00f3('0x11')][_0x00f3('0x13')]);}else{logger[_0x00f3('0x14')](_0x00f3('0xd'),_0x3113a5,_0x00f3('0xe'));_0x55c6d4(_0x21c0ef[_0x00f3('0x15')]['message']);}})['catch'](function(_0x3b3a85){logger['error'](_0x00f3('0xd'),_0x3113a5,_0x3b3a85);_0x30b53f(_0x3b3a85);});});} \ No newline at end of file +var _0x618f=['bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x34f554,_0x4535cf){var _0x3fd23b=function(_0x5d1aff){while(--_0x5d1aff){_0x34f554['push'](_0x34f554['shift']());}};_0x3fd23b(++_0x4535cf);}(_0x618f,0x19f));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf618('0x0'));var util=require(_0xf618('0x1'));var moment=require(_0xf618('0x2'));var BPromise=require(_0xf618('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf618('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf618('0x5'))('rpc');var config=require(_0xf618('0x6'));var jayson=require(_0xf618('0x7'));var client=jayson[_0xf618('0x8')][_0xf618('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6352b5,_0x25696b,_0x399fe4){return new BPromise(function(_0x42e773,_0x573ea8){return client['request'](_0x6352b5,_0x399fe4)[_0xf618('0xa')](function(_0x5947e8){logger['info'](_0xf618('0xb'),_0x25696b,_0xf618('0xc'));logger[_0xf618('0xd')](_0xf618('0xe'),_0x25696b,_0xf618('0xc'),JSON[_0xf618('0xf')](_0x5947e8));if(_0x5947e8[_0xf618('0x10')]){if(_0x5947e8[_0xf618('0x10')][_0xf618('0x11')]===0x1f4){logger[_0xf618('0x10')](_0xf618('0xb'),_0x25696b,_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);return _0x573ea8(_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x25696b,_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);return _0x42e773(_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);}else{logger[_0xf618('0x13')](_0xf618('0xb'),_0x25696b,'request\x20sent');_0x42e773(_0x5947e8[_0xf618('0x14')][_0xf618('0x12')]);}})[_0xf618('0x15')](function(_0x132708){logger[_0xf618('0x10')](_0xf618('0xb'),_0x25696b,_0x132708);_0x573ea8(_0x132708);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ee57f46..4496f94 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 _0xf8ac=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','download','create','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x2dfa99,_0x143a56){var _0x4ea5f1=function(_0x206290){while(--_0x206290){_0x2dfa99['push'](_0x2dfa99['shift']());}};_0x4ea5f1(++_0x143a56);}(_0xf8ac,0xd8));var _0xcf8a=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0xf8ac[_0x21ecc8];return _0x510c1d;};'use strict';var multer=require('multer');var util=require(_0xcf8a('0x0'));var path=require(_0xcf8a('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf8a('0x2'));var router=express[_0xcf8a('0x3')]();var fs_extra=require(_0xcf8a('0x4'));var auth=require(_0xcf8a('0x5'));var interaction=require(_0xcf8a('0x6'));var config=require(_0xcf8a('0x7'));var controller=require(_0xcf8a('0x8'));router['get']('/',auth[_0xcf8a('0x9')](),controller[_0xcf8a('0xa')]);router[_0xcf8a('0xb')](_0xcf8a('0xc'),auth[_0xcf8a('0x9')](),controller['show']);router['get']('/:id/download',auth[_0xcf8a('0x9')](),controller[_0xcf8a('0xd')]);router['post']('/',auth[_0xcf8a('0x9')](),controller[_0xcf8a('0xe')]);router[_0xcf8a('0xf')]('/:id',auth[_0xcf8a('0x9')](),controller[_0xcf8a('0x10')]);router[_0xcf8a('0x11')](_0xcf8a('0xc'),auth['isAuthenticated'](),controller[_0xcf8a('0x12')]);module[_0xcf8a('0x13')]=router; \ No newline at end of file +var _0x05c4=['index','show','get','/:id/download','download','create','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated'];(function(_0x4e0691,_0x168052){var _0x138faa=function(_0x3dd722){while(--_0x3dd722){_0x4e0691['push'](_0x4e0691['shift']());}};_0x138faa(++_0x168052);}(_0x05c4,0x1d7));var _0x405c=function(_0x2ff6b7,_0x131c69){_0x2ff6b7=_0x2ff6b7-0x0;var _0x1881ec=_0x05c4[_0x2ff6b7];return _0x1881ec;};'use strict';var multer=require(_0x405c('0x0'));var util=require(_0x405c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x405c('0x2'));var router=express[_0x405c('0x3')]();var fs_extra=require(_0x405c('0x4'));var auth=require(_0x405c('0x5'));var interaction=require(_0x405c('0x6'));var config=require('../../config/environment');var controller=require(_0x405c('0x7'));router['get']('/',auth[_0x405c('0x8')](),controller[_0x405c('0x9')]);router['get']('/:id',auth[_0x405c('0x8')](),controller[_0x405c('0xa')]);router[_0x405c('0xb')](_0x405c('0xc'),auth[_0x405c('0x8')](),controller[_0x405c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x405c('0xe')]);router[_0x405c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x405c('0x10')]);router[_0x405c('0x11')](_0x405c('0x12'),auth[_0x405c('0x8')](),controller['destroy']);module[_0x405c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 46e0b39..b77d095 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 _0xd90c=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd90c,0x137));var _0xcd90=function(_0x3385d6,_0xed7d89){_0x3385d6=_0x3385d6-0x0;var _0x52c88f=_0xd90c[_0x3385d6];return _0x52c88f;};'use strict';var Sequelize=require('sequelize');module[_0xcd90('0x0')]={'name':{'type':Sequelize[_0xcd90('0x1')],'get':function(_0x446346){return this[_0xcd90('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xcd90('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xcd90('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xcd90('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xcd90('0x6'),'defaultValue':Sequelize[_0xcd90('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3e5a=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3e5a,0x198));var _0xa3e5=function(_0x1daf41,_0x4081aa){_0x1daf41=_0x1daf41-0x0;var _0xf7c5b3=_0x3e5a[_0x1daf41];return _0xf7c5b3;};'use strict';var Sequelize=require(_0xa3e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3e5('0x1')],'get':function(_0x5a7e26){return this[_0xa3e5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa3e5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa3e5('0x5')](_0xa3e5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'stamp':{'type':_0xa3e5('0x7'),'defaultValue':Sequelize[_0xa3e5('0x8')](_0xa3e5('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 723a872..f7da2d8 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 _0xf7b3=['ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','options','includeAll','findAll','catch','show','params','length','include','find','create','body','download','recording','Sequelize'];(function(_0x31b5fb,_0x40573a){var _0x3d53a6=function(_0x5cd3c9){while(--_0x5cd3c9){_0x31b5fb['push'](_0x31b5fb['shift']());}};_0x3d53a6(++_0x40573a);}(_0xf7b3,0x14f));var _0x3f7b=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xf7b3[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0x3f7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f7b('0x1'));var jsonpatch=require(_0x3f7b('0x2'));var rp=require(_0x3f7b('0x3'));var moment=require(_0x3f7b('0x4'));var BPromise=require(_0x3f7b('0x5'));var Mustache=require(_0x3f7b('0x6'));var util=require(_0x3f7b('0x7'));var path=require(_0x3f7b('0x8'));var sox=require(_0x3f7b('0x9'));var csv=require('to-csv');var ejs=require(_0x3f7b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f7b('0xb'));var squel=require(_0x3f7b('0xc'));var crypto=require(_0x3f7b('0xd'));var jsforce=require(_0x3f7b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f7b('0xf'));var querystring=require(_0x3f7b('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f7b('0x11'));var authService=require(_0x3f7b('0x12'));var qs=require(_0x3f7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f7b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3f7b('0x15'));var config=require(_0x3f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f7b('0x17'))['db'];function respondWithStatusCode(_0x5e71f1,_0x2b5a4c){_0x2b5a4c=_0x2b5a4c||0xcc;return function(_0x1409f3){if(_0x1409f3){return _0x5e71f1[_0x3f7b('0x18')](_0x2b5a4c);}return _0x5e71f1[_0x3f7b('0x19')](_0x2b5a4c)[_0x3f7b('0x1a')]();};}function respondWithResult(_0x4ce86d,_0x439edc){_0x439edc=_0x439edc||0xc8;return function(_0x1715e3){if(_0x1715e3){return _0x4ce86d[_0x3f7b('0x19')](_0x439edc)[_0x3f7b('0x1b')](_0x1715e3);}};}function respondWithFilteredResult(_0x26d0c5,_0x404d88){return function(_0x3da517){if(_0x3da517){var _0x5a7c60=typeof _0x404d88['offset']==='undefined'&&typeof _0x404d88[_0x3f7b('0x1c')]===_0x3f7b('0x1d');var _0x1a3581=_0x3da517['count'];var _0x2ba745=_0x5a7c60?0x0:_0x404d88[_0x3f7b('0x1e')];var _0x4f9b0f=_0x5a7c60?_0x3da517[_0x3f7b('0x1f')]:_0x404d88[_0x3f7b('0x1e')]+_0x404d88['limit'];var _0x3fff5b;if(_0x4f9b0f>=_0x1a3581){_0x4f9b0f=_0x1a3581;_0x3fff5b=0xc8;}else{_0x3fff5b=0xce;}_0x26d0c5[_0x3f7b('0x19')](_0x3fff5b);return _0x26d0c5[_0x3f7b('0x20')]('Content-Range',_0x2ba745+'-'+_0x4f9b0f+'/'+_0x1a3581)[_0x3f7b('0x1b')](_0x3da517);}return null;};}function patchUpdates(_0x992ac3){return function(_0x39cc27){try{jsonpatch[_0x3f7b('0x21')](_0x39cc27,_0x992ac3,!![]);}catch(_0x2acb34){return BPromise[_0x3f7b('0x22')](_0x2acb34);}return _0x39cc27[_0x3f7b('0x23')]();};}function saveUpdates(_0x3db7f2,_0x39dc27){return function(_0x2a992b){if(_0x2a992b){return _0x2a992b[_0x3f7b('0x24')](_0x3db7f2)[_0x3f7b('0x25')](function(_0x445a5c){return _0x445a5c;});}return null;};}function removeEntity(_0x1804e9,_0x4aa461){return function(_0x2fce7c){if(_0x2fce7c){return _0x2fce7c[_0x3f7b('0x26')]()[_0x3f7b('0x25')](function(){_0x1804e9[_0x3f7b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353ceb,_0x5dc290){return function(_0x3e0ab3){if(!_0x3e0ab3){_0x353ceb[_0x3f7b('0x18')](0x194);}return _0x3e0ab3;};}function handleError(_0x38f2fd,_0x63c35d){_0x63c35d=_0x63c35d||0x1f4;return function(_0x23be16){logger[_0x3f7b('0x27')](_0x23be16[_0x3f7b('0x28')]);if(_0x23be16[_0x3f7b('0x29')]){delete _0x23be16[_0x3f7b('0x29')];}_0x38f2fd[_0x3f7b('0x19')](_0x63c35d)['send'](_0x23be16);};}exports['index']=function(_0x29f5d8,_0x102be6){var _0x24b00c={},_0x1119ce={},_0x50d05a={'count':0x0,'rows':[]};var _0x700dc3=_[_0x3f7b('0x2a')](db[_0x3f7b('0x2b')][_0x3f7b('0x2c')],function(_0x59b965){return{'name':_0x59b965[_0x3f7b('0x2d')],'type':_0x59b965['type']['key']};});_0x1119ce[_0x3f7b('0x2e')]=_['differenceBy'](_[_0x3f7b('0x2a')](_0x700dc3,_0x3f7b('0x29')),[_0x3f7b('0x29')]);_0x1119ce[_0x3f7b('0x2f')]=_[_0x3f7b('0x30')](_0x29f5d8[_0x3f7b('0x2f')]);_0x1119ce['filters']=_['intersection'](_0x1119ce[_0x3f7b('0x2e')],_0x1119ce[_0x3f7b('0x2f')]);_0x24b00c[_0x3f7b('0x31')]=_[_0x3f7b('0x32')](_0x1119ce[_0x3f7b('0x2e')],qs['fields'](_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x33')]));_0x24b00c[_0x3f7b('0x31')]=_0x24b00c[_0x3f7b('0x31')]['length']?_0x24b00c[_0x3f7b('0x31')]:_0x1119ce[_0x3f7b('0x2e')];if(!_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x34')](_0x3f7b('0x35'))){_0x24b00c[_0x3f7b('0x1c')]=qs[_0x3f7b('0x1c')](_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x1c')]);_0x24b00c['offset']=qs[_0x3f7b('0x1e')](_0x29f5d8[_0x3f7b('0x2f')]['offset']);}_0x24b00c[_0x3f7b('0x36')]=qs['sort'](_0x29f5d8[_0x3f7b('0x2f')]['sort']);_0x24b00c[_0x3f7b('0x37')]=qs[_0x3f7b('0x38')](_[_0x3f7b('0x39')](_0x29f5d8[_0x3f7b('0x2f')],_0x1119ce[_0x3f7b('0x38')]),_0x700dc3);if(_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x3a')]){_0x24b00c['where']=_[_0x3f7b('0x3b')](_0x24b00c['where'],{'$or':_[_0x3f7b('0x2a')](_0x700dc3,function(_0x2acd78){if(_0x2acd78[_0x3f7b('0x3c')]!=='VIRTUAL'){var _0x36e985={};_0x36e985[_0x2acd78['name']]={'$like':'%'+_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x3a')]+'%'};return _0x36e985;}})});}_0x24b00c=_[_0x3f7b('0x3b')]({},_0x24b00c,_0x29f5d8[_0x3f7b('0x3d')]);var _0x1dbf17={'where':_0x24b00c[_0x3f7b('0x37')]};return db[_0x3f7b('0x2b')][_0x3f7b('0x1f')](_0x1dbf17)[_0x3f7b('0x25')](function(_0x433765){_0x50d05a[_0x3f7b('0x1f')]=_0x433765;if(_0x29f5d8[_0x3f7b('0x2f')][_0x3f7b('0x3e')]){_0x24b00c['include']=[{'all':!![]}];}return db[_0x3f7b('0x2b')][_0x3f7b('0x3f')](_0x24b00c);})[_0x3f7b('0x25')](function(_0x2769b1){_0x50d05a['rows']=_0x2769b1;return _0x50d05a;})['then'](respondWithFilteredResult(_0x102be6,_0x24b00c))[_0x3f7b('0x40')](handleError(_0x102be6,null));};exports[_0x3f7b('0x41')]=function(_0x4a3c3e,_0x3fce78){var _0x51b113={'raw':!![],'where':{'id':_0x4a3c3e[_0x3f7b('0x42')]['id']}},_0x574e9b={};_0x574e9b['model']=_['keys'](db[_0x3f7b('0x2b')]['rawAttributes']);_0x574e9b['query']=_[_0x3f7b('0x30')](_0x4a3c3e[_0x3f7b('0x2f')]);_0x574e9b[_0x3f7b('0x38')]=_[_0x3f7b('0x32')](_0x574e9b[_0x3f7b('0x2e')],_0x574e9b[_0x3f7b('0x2f')]);_0x51b113['attributes']=_['intersection'](_0x574e9b[_0x3f7b('0x2e')],qs[_0x3f7b('0x33')](_0x4a3c3e[_0x3f7b('0x2f')][_0x3f7b('0x33')]));_0x51b113[_0x3f7b('0x31')]=_0x51b113['attributes'][_0x3f7b('0x43')]?_0x51b113[_0x3f7b('0x31')]:_0x574e9b[_0x3f7b('0x2e')];if(_0x4a3c3e['query']['includeAll']){_0x51b113[_0x3f7b('0x44')]=[{'all':!![]}];}_0x51b113=_[_0x3f7b('0x3b')]({},_0x51b113,_0x4a3c3e['options']);return db['VoiceMailMessage'][_0x3f7b('0x45')](_0x51b113)[_0x3f7b('0x25')](handleEntityNotFound(_0x3fce78,null))[_0x3f7b('0x25')](respondWithResult(_0x3fce78,null))[_0x3f7b('0x40')](handleError(_0x3fce78,null));};exports['create']=function(_0x5077b8,_0xb0ab73){return db[_0x3f7b('0x2b')][_0x3f7b('0x46')](_0x5077b8[_0x3f7b('0x47')],{})[_0x3f7b('0x25')](respondWithResult(_0xb0ab73,0xc9))[_0x3f7b('0x40')](handleError(_0xb0ab73,null));};exports['update']=function(_0x3bc93b,_0x4e32dd){if(_0x3bc93b[_0x3f7b('0x47')]['id']){delete _0x3bc93b[_0x3f7b('0x47')]['id'];}return db[_0x3f7b('0x2b')][_0x3f7b('0x45')]({'where':{'id':_0x3bc93b[_0x3f7b('0x42')]['id']}})[_0x3f7b('0x25')](handleEntityNotFound(_0x4e32dd,null))[_0x3f7b('0x25')](saveUpdates(_0x3bc93b[_0x3f7b('0x47')],null))['then'](respondWithResult(_0x4e32dd,null))['catch'](handleError(_0x4e32dd,null));};exports[_0x3f7b('0x26')]=function(_0x41f3df,_0x1bae4d){return db['VoiceMailMessage'][_0x3f7b('0x45')]({'where':{'id':_0x41f3df[_0x3f7b('0x42')]['id']}})[_0x3f7b('0x25')](handleEntityNotFound(_0x1bae4d,null))[_0x3f7b('0x25')](removeEntity(_0x1bae4d,null))[_0x3f7b('0x40')](handleError(_0x1bae4d,null));};exports[_0x3f7b('0x48')]=function(_0x490e1e,_0x477639,_0x385a00){return db[_0x3f7b('0x2b')][_0x3f7b('0x45')]({'where':{'id':_0x490e1e[_0x3f7b('0x42')]['id']},'attributes':['id',_0x3f7b('0x49'),'msg_id']})[_0x3f7b('0x25')](handleEntityNotFound(_0x477639,null))[_0x3f7b('0x25')](function(_0x2367da){if(_0x2367da){if(!_0x2367da[_0x3f7b('0x49')]){throw new db[(_0x3f7b('0x4a'))][(_0x3f7b('0x4b'))](_0x3f7b('0x4c'));}var _0x16ba80={'Content-Type':_0x3f7b('0x4d'),'Content-Disposition':'attachment'};if(_0x2367da[_0x3f7b('0x4e')]){_0x16ba80['Content-Disposition']=_0x3f7b('0x4f')+_0x2367da[_0x3f7b('0x4e')]+_0x3f7b('0x50');}_0x477639[_0x3f7b('0x20')](_0x16ba80);return _0x477639[_0x3f7b('0x51')](new Buffer(_0x2367da[_0x3f7b('0x49')]));}})['catch'](handleError(_0x477639,null));}; \ No newline at end of file +var _0xf61c=['catch','show','params','create','body','find','download','msg_id','recording','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','rows'];(function(_0xb23b5f,_0x27b6a3){var _0x21e54c=function(_0xc9ea85){while(--_0xc9ea85){_0xb23b5f['push'](_0xb23b5f['shift']());}};_0x21e54c(++_0x27b6a3);}(_0xf61c,0x114));var _0xcf61=function(_0x42bd4b,_0xde9b3f){_0x42bd4b=_0x42bd4b-0x0;var _0x2c4f1a=_0xf61c[_0x42bd4b];return _0x2c4f1a;};'use strict';var emlformat=require(_0xcf61('0x0'));var rimraf=require(_0xcf61('0x1'));var zipdir=require(_0xcf61('0x2'));var jsonpatch=require(_0xcf61('0x3'));var rp=require(_0xcf61('0x4'));var moment=require(_0xcf61('0x5'));var BPromise=require(_0xcf61('0x6'));var Mustache=require('mustache');var util=require(_0xcf61('0x7'));var path=require(_0xcf61('0x8'));var sox=require(_0xcf61('0x9'));var csv=require(_0xcf61('0xa'));var ejs=require(_0xcf61('0xb'));var fs=require('fs');var fs_extra=require(_0xcf61('0xc'));var _=require(_0xcf61('0xd'));var squel=require('squel');var crypto=require(_0xcf61('0xe'));var jsforce=require(_0xcf61('0xf'));var deskjs=require(_0xcf61('0x10'));var toCsv=require(_0xcf61('0xa'));var querystring=require(_0xcf61('0x11'));var Papa=require(_0xcf61('0x12'));var Redis=require('ioredis');var authService=require(_0xcf61('0x13'));var qs=require(_0xcf61('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf61('0x15'));var logger=require('../../config/logger')(_0xcf61('0x16'));var utils=require(_0xcf61('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf61('0x18'))['db'];function respondWithStatusCode(_0x330f94,_0x28bae8){_0x28bae8=_0x28bae8||0xcc;return function(_0x31fc03){if(_0x31fc03){return _0x330f94[_0xcf61('0x19')](_0x28bae8);}return _0x330f94[_0xcf61('0x1a')](_0x28bae8)[_0xcf61('0x1b')]();};}function respondWithResult(_0xfe41bd,_0x496c74){_0x496c74=_0x496c74||0xc8;return function(_0x3ad915){if(_0x3ad915){return _0xfe41bd[_0xcf61('0x1a')](_0x496c74)[_0xcf61('0x1c')](_0x3ad915);}};}function respondWithFilteredResult(_0x4ee5ee,_0x29e439){return function(_0x3e4c90){if(_0x3e4c90){var _0x4488da=typeof _0x29e439[_0xcf61('0x1d')]===_0xcf61('0x1e')&&typeof _0x29e439['limit']===_0xcf61('0x1e');var _0x1468e9=_0x3e4c90[_0xcf61('0x1f')];var _0x42a5d1=_0x4488da?0x0:_0x29e439[_0xcf61('0x1d')];var _0x13bde2=_0x4488da?_0x3e4c90['count']:_0x29e439[_0xcf61('0x1d')]+_0x29e439[_0xcf61('0x20')];var _0x597281;if(_0x13bde2>=_0x1468e9){_0x13bde2=_0x1468e9;_0x597281=0xc8;}else{_0x597281=0xce;}_0x4ee5ee[_0xcf61('0x1a')](_0x597281);return _0x4ee5ee[_0xcf61('0x21')]('Content-Range',_0x42a5d1+'-'+_0x13bde2+'/'+_0x1468e9)[_0xcf61('0x1c')](_0x3e4c90);}return null;};}function patchUpdates(_0x2dd2fd){return function(_0x1ee17c){try{jsonpatch['apply'](_0x1ee17c,_0x2dd2fd,!![]);}catch(_0x5b24a2){return BPromise[_0xcf61('0x22')](_0x5b24a2);}return _0x1ee17c[_0xcf61('0x23')]();};}function saveUpdates(_0x58aef5,_0x3f1475){return function(_0x15a64e){if(_0x15a64e){return _0x15a64e[_0xcf61('0x24')](_0x58aef5)[_0xcf61('0x25')](function(_0x476839){return _0x476839;});}return null;};}function removeEntity(_0x17f277,_0x35c456){return function(_0xe30600){if(_0xe30600){return _0xe30600[_0xcf61('0x26')]()[_0xcf61('0x25')](function(){_0x17f277[_0xcf61('0x1a')](0xcc)[_0xcf61('0x1b')]();});}};}function handleEntityNotFound(_0x30d3c2,_0x1725dd){return function(_0x4452e6){if(!_0x4452e6){_0x30d3c2['sendStatus'](0x194);}return _0x4452e6;};}function handleError(_0x28afd2,_0x459097){_0x459097=_0x459097||0x1f4;return function(_0x6c7d3){logger[_0xcf61('0x27')](_0x6c7d3[_0xcf61('0x28')]);if(_0x6c7d3[_0xcf61('0x29')]){delete _0x6c7d3[_0xcf61('0x29')];}_0x28afd2[_0xcf61('0x1a')](_0x459097)[_0xcf61('0x2a')](_0x6c7d3);};}exports[_0xcf61('0x2b')]=function(_0x47b368,_0x303638){var _0x52064f={},_0x3b13e3={},_0x442690={'count':0x0,'rows':[]};var _0x33c213=_[_0xcf61('0x2c')](db['VoiceMailMessage'][_0xcf61('0x2d')],function(_0x3e1ecc){return{'name':_0x3e1ecc[_0xcf61('0x2e')],'type':_0x3e1ecc[_0xcf61('0x2f')][_0xcf61('0x30')]};});_0x3b13e3['model']=_[_0xcf61('0x31')](_[_0xcf61('0x2c')](_0x33c213,_0xcf61('0x29')),[_0xcf61('0x29')]);_0x3b13e3[_0xcf61('0x32')]=_[_0xcf61('0x33')](_0x47b368[_0xcf61('0x32')]);_0x3b13e3[_0xcf61('0x34')]=_[_0xcf61('0x35')](_0x3b13e3[_0xcf61('0x36')],_0x3b13e3[_0xcf61('0x32')]);_0x52064f[_0xcf61('0x37')]=_['intersection'](_0x3b13e3[_0xcf61('0x36')],qs[_0xcf61('0x38')](_0x47b368[_0xcf61('0x32')][_0xcf61('0x38')]));_0x52064f[_0xcf61('0x37')]=_0x52064f[_0xcf61('0x37')][_0xcf61('0x39')]?_0x52064f[_0xcf61('0x37')]:_0x3b13e3[_0xcf61('0x36')];if(!_0x47b368['query'][_0xcf61('0x3a')](_0xcf61('0x3b'))){_0x52064f[_0xcf61('0x20')]=qs[_0xcf61('0x20')](_0x47b368[_0xcf61('0x32')][_0xcf61('0x20')]);_0x52064f[_0xcf61('0x1d')]=qs['offset'](_0x47b368[_0xcf61('0x32')][_0xcf61('0x1d')]);}_0x52064f[_0xcf61('0x3c')]=qs[_0xcf61('0x3d')](_0x47b368['query'][_0xcf61('0x3d')]);_0x52064f[_0xcf61('0x3e')]=qs[_0xcf61('0x34')](_[_0xcf61('0x3f')](_0x47b368[_0xcf61('0x32')],_0x3b13e3[_0xcf61('0x34')]),_0x33c213);if(_0x47b368[_0xcf61('0x32')][_0xcf61('0x40')]){_0x52064f[_0xcf61('0x3e')]=_[_0xcf61('0x41')](_0x52064f[_0xcf61('0x3e')],{'$or':_[_0xcf61('0x2c')](_0x33c213,function(_0x412d88){if(_0x412d88[_0xcf61('0x2f')]!==_0xcf61('0x42')){var _0x3d12a7={};_0x3d12a7[_0x412d88[_0xcf61('0x29')]]={'$like':'%'+_0x47b368[_0xcf61('0x32')][_0xcf61('0x40')]+'%'};return _0x3d12a7;}})});}_0x52064f=_['merge']({},_0x52064f,_0x47b368[_0xcf61('0x43')]);var _0x2598b2={'where':_0x52064f['where']};return db[_0xcf61('0x44')][_0xcf61('0x1f')](_0x2598b2)[_0xcf61('0x25')](function(_0x56d0fb){_0x442690[_0xcf61('0x1f')]=_0x56d0fb;if(_0x47b368['query'][_0xcf61('0x45')]){_0x52064f[_0xcf61('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x52064f);})[_0xcf61('0x25')](function(_0x7e07ea){_0x442690[_0xcf61('0x47')]=_0x7e07ea;return _0x442690;})[_0xcf61('0x25')](respondWithFilteredResult(_0x303638,_0x52064f))[_0xcf61('0x48')](handleError(_0x303638,null));};exports[_0xcf61('0x49')]=function(_0x323ab9,_0x3f0dd7){var _0x5e30ac={'raw':!![],'where':{'id':_0x323ab9[_0xcf61('0x4a')]['id']}},_0x146ea8={};_0x146ea8[_0xcf61('0x36')]=_[_0xcf61('0x33')](db[_0xcf61('0x44')][_0xcf61('0x2d')]);_0x146ea8[_0xcf61('0x32')]=_[_0xcf61('0x33')](_0x323ab9[_0xcf61('0x32')]);_0x146ea8[_0xcf61('0x34')]=_[_0xcf61('0x35')](_0x146ea8[_0xcf61('0x36')],_0x146ea8[_0xcf61('0x32')]);_0x5e30ac[_0xcf61('0x37')]=_['intersection'](_0x146ea8[_0xcf61('0x36')],qs[_0xcf61('0x38')](_0x323ab9['query'][_0xcf61('0x38')]));_0x5e30ac[_0xcf61('0x37')]=_0x5e30ac[_0xcf61('0x37')][_0xcf61('0x39')]?_0x5e30ac[_0xcf61('0x37')]:_0x146ea8['model'];if(_0x323ab9['query'][_0xcf61('0x45')]){_0x5e30ac['include']=[{'all':!![]}];}_0x5e30ac=_[_0xcf61('0x41')]({},_0x5e30ac,_0x323ab9['options']);return db[_0xcf61('0x44')]['find'](_0x5e30ac)[_0xcf61('0x25')](handleEntityNotFound(_0x3f0dd7,null))['then'](respondWithResult(_0x3f0dd7,null))[_0xcf61('0x48')](handleError(_0x3f0dd7,null));};exports[_0xcf61('0x4b')]=function(_0xa7da6,_0x32baec){return db[_0xcf61('0x44')][_0xcf61('0x4b')](_0xa7da6[_0xcf61('0x4c')],{})['then'](respondWithResult(_0x32baec,0xc9))[_0xcf61('0x48')](handleError(_0x32baec,null));};exports[_0xcf61('0x24')]=function(_0x51db1a,_0x53f2db){if(_0x51db1a['body']['id']){delete _0x51db1a[_0xcf61('0x4c')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x51db1a[_0xcf61('0x4a')]['id']}})[_0xcf61('0x25')](handleEntityNotFound(_0x53f2db,null))[_0xcf61('0x25')](saveUpdates(_0x51db1a[_0xcf61('0x4c')],null))[_0xcf61('0x25')](respondWithResult(_0x53f2db,null))['catch'](handleError(_0x53f2db,null));};exports[_0xcf61('0x26')]=function(_0x4c4d26,_0x1b45e7){return db[_0xcf61('0x44')][_0xcf61('0x4d')]({'where':{'id':_0x4c4d26[_0xcf61('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b45e7,null))['then'](removeEntity(_0x1b45e7,null))[_0xcf61('0x48')](handleError(_0x1b45e7,null));};exports[_0xcf61('0x4e')]=function(_0x31d21b,_0xab27c9,_0x1a6902){return db[_0xcf61('0x44')][_0xcf61('0x4d')]({'where':{'id':_0x31d21b[_0xcf61('0x4a')]['id']},'attributes':['id','recording',_0xcf61('0x4f')]})[_0xcf61('0x25')](handleEntityNotFound(_0xab27c9,null))[_0xcf61('0x25')](function(_0x2f6334){if(_0x2f6334){if(!_0x2f6334[_0xcf61('0x50')]){throw new db[(_0xcf61('0x51'))][(_0xcf61('0x52'))]('VoiceMailMessage\x20not\x20found');}var _0x5a427e={'Content-Type':_0xcf61('0x53'),'Content-Disposition':'attachment'};if(_0x2f6334[_0xcf61('0x4f')]){_0x5a427e[_0xcf61('0x54')]=_0xcf61('0x55')+_0x2f6334['msg_id']+_0xcf61('0x56');}_0xab27c9['set'](_0x5a427e);return _0xab27c9[_0xcf61('0x2a')](new Buffer(_0x2f6334[_0xcf61('0x50')]));}})['catch'](handleError(_0xab27c9,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9233341..2185f3e 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 _0x80db=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','util','api'];(function(_0x2e1f39,_0x5df28f){var _0x4e7d9a=function(_0x40ae20){while(--_0x40ae20){_0x2e1f39['push'](_0x2e1f39['shift']());}};_0x4e7d9a(++_0x5df28f);}(_0x80db,0x1a2));var _0xb80d=function(_0x115a32,_0x3125e6){_0x115a32=_0x115a32-0x0;var _0x2cbf86=_0x80db[_0x115a32];return _0x2cbf86;};'use strict';var _=require('lodash');var util=require(_0xb80d('0x0'));var logger=require('../../config/logger')(_0xb80d('0x1'));var moment=require('moment');var BPromise=require(_0xb80d('0x2'));var rp=require(_0xb80d('0x3'));var fs=require('fs');var path=require(_0xb80d('0x4'));var rimraf=require(_0xb80d('0x5'));var config=require(_0xb80d('0x6'));var attributes=require(_0xb80d('0x7'));module['exports']=function(_0x46cf9f,_0x28db6f){return _0x46cf9f[_0xb80d('0x8')](_0xb80d('0x9'),attributes,{'tableName':_0xb80d('0xa'),'paranoid':![],'indexes':[{'name':_0xb80d('0xb'),'fields':[_0xb80d('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x00f9=['api','moment','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00f9,0xe8));var _0x900f=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x00f9[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var util=require(_0x900f('0x0'));var logger=require(_0x900f('0x1'))(_0x900f('0x2'));var moment=require(_0x900f('0x3'));var BPromise=require(_0x900f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x900f('0x5'));var config=require(_0x900f('0x6'));var attributes=require(_0x900f('0x7'));module[_0x900f('0x8')]=function(_0x2e7b2c,_0x3ff6cb){return _0x2e7b2c[_0x900f('0x9')](_0x900f('0xa'),attributes,{'tableName':_0x900f('0xb'),'paranoid':![],'indexes':[{'name':_0x900f('0xc'),'fields':[_0x900f('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8c460a3..b9bdcf1 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 _0xe044=['jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3f3b4c,_0x14e7be){var _0x3d1497=function(_0x2fd0a8){while(--_0x2fd0a8){_0x3f3b4c['push'](_0x3f3b4c['shift']());}};_0x3d1497(++_0x14e7be);}(_0xe044,0x116));var _0x4e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe044[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4e04('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e04('0x2'));var db=require(_0x4e04('0x3'))['db'];var utils=require(_0x4e04('0x4'));var logger=require(_0x4e04('0x5'))(_0x4e04('0x6'));var config=require(_0x4e04('0x7'));var jayson=require(_0x4e04('0x8'));var client=jayson[_0x4e04('0x9')][_0x4e04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5db96f,_0x2aab73,_0x3f1e7a){return new BPromise(function(_0x3b01ed,_0x7a571){return client[_0x4e04('0xb')](_0x5db96f,_0x3f1e7a)['then'](function(_0x1cf7e2){logger[_0x4e04('0xc')](_0x4e04('0xd'),_0x2aab73,_0x4e04('0xe'));logger['debug'](_0x4e04('0xf'),_0x2aab73,'request\x20sent',JSON[_0x4e04('0x10')](_0x1cf7e2));if(_0x1cf7e2[_0x4e04('0x11')]){if(_0x1cf7e2['error'][_0x4e04('0x12')]===0x1f4){logger[_0x4e04('0x11')](_0x4e04('0xd'),_0x2aab73,_0x1cf7e2[_0x4e04('0x11')][_0x4e04('0x13')]);return _0x7a571(_0x1cf7e2[_0x4e04('0x11')][_0x4e04('0x13')]);}logger[_0x4e04('0x11')](_0x4e04('0xd'),_0x2aab73,_0x1cf7e2[_0x4e04('0x11')][_0x4e04('0x13')]);return _0x3b01ed(_0x1cf7e2[_0x4e04('0x11')][_0x4e04('0x13')]);}else{logger[_0x4e04('0xc')](_0x4e04('0xd'),_0x2aab73,_0x4e04('0xe'));_0x3b01ed(_0x1cf7e2[_0x4e04('0x14')][_0x4e04('0x13')]);}})[_0x4e04('0x15')](function(_0x45bf56){logger['error'](_0x4e04('0xd'),_0x2aab73,_0x45bf56);_0x7a571(_0x45bf56);});});} \ No newline at end of file +var _0xa1b0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x833f32,_0x96443f){var _0x25879d=function(_0x7fb4d4){while(--_0x7fb4d4){_0x833f32['push'](_0x833f32['shift']());}};_0x25879d(++_0x96443f);}(_0xa1b0,0x81));var _0x0a1b=function(_0x422953,_0x5f404a){_0x422953=_0x422953-0x0;var _0x1c8903=_0xa1b0[_0x422953];return _0x1c8903;};'use strict';var _=require(_0x0a1b('0x0'));var util=require(_0x0a1b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a1b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a1b('0x3'));var logger=require('../../config/logger')(_0x0a1b('0x4'));var config=require(_0x0a1b('0x5'));var jayson=require(_0x0a1b('0x6'));var client=jayson[_0x0a1b('0x7')][_0x0a1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f1c64,_0x37316c,_0x430fe4){return new BPromise(function(_0x17266d,_0x5dbdc4){return client[_0x0a1b('0x9')](_0x3f1c64,_0x430fe4)[_0x0a1b('0xa')](function(_0x17352a){logger[_0x0a1b('0xb')](_0x0a1b('0xc'),_0x37316c,_0x0a1b('0xd'));logger[_0x0a1b('0xe')](_0x0a1b('0xf'),_0x37316c,_0x0a1b('0xd'),JSON[_0x0a1b('0x10')](_0x17352a));if(_0x17352a[_0x0a1b('0x11')]){if(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x12')]===0x1f4){logger['error'](_0x0a1b('0xc'),_0x37316c,_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);return _0x5dbdc4(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);}logger[_0x0a1b('0x11')](_0x0a1b('0xc'),_0x37316c,_0x17352a[_0x0a1b('0x11')]['message']);return _0x17266d(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);}else{logger[_0x0a1b('0xb')](_0x0a1b('0xc'),_0x37316c,_0x0a1b('0xd'));_0x17266d(_0x17352a[_0x0a1b('0x14')][_0x0a1b('0x13')]);}})[_0x0a1b('0x15')](function(_0x1bbd1b){logger['error'](_0x0a1b('0xc'),_0x37316c,_0x1bbd1b);_0x5dbdc4(_0x1bbd1b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bdc71f5..b662bed 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 _0x67b6=['addSound','put','update','/:id/sounds/:id2','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','getSounds','post','create','/:id/sounds'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x67b6,0x139));var _0x667b=function(_0x50d244,_0x586349){_0x50d244=_0x50d244-0x0;var _0x2475b6=_0x67b6[_0x50d244];return _0x2475b6;};'use strict';var multer=require(_0x667b('0x0'));var util=require(_0x667b('0x1'));var path=require(_0x667b('0x2'));var timeout=require('connect-timeout');var express=require(_0x667b('0x3'));var router=express[_0x667b('0x4')]();var fs_extra=require(_0x667b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x667b('0x6'));var config=require(_0x667b('0x7'));var controller=require(_0x667b('0x8'));router[_0x667b('0x9')]('/',auth[_0x667b('0xa')](),controller[_0x667b('0xb')]);router[_0x667b('0x9')](_0x667b('0xc'),auth[_0x667b('0xa')](),controller['show']);router['get']('/:id/sounds',auth[_0x667b('0xa')](),controller[_0x667b('0xd')]);router[_0x667b('0xe')]('/',auth[_0x667b('0xa')](),controller[_0x667b('0xf')]);router['post'](_0x667b('0x10'),auth['isAuthenticated'](),controller[_0x667b('0x11')]);router[_0x667b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x667b('0x13')]);router['delete'](_0x667b('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x667b('0x14'),auth['isAuthenticated'](),controller['removeSound']);module[_0x667b('0x15')]=router; \ No newline at end of file +var _0x0796=['post','create','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x254dcc,_0x4d5a5f){var _0x5bc8fd=function(_0x9949dc){while(--_0x9949dc){_0x254dcc['push'](_0x254dcc['shift']());}};_0x5bc8fd(++_0x4d5a5f);}(_0x0796,0x129));var _0x6079=function(_0x92b3ae,_0x201d08){_0x92b3ae=_0x92b3ae-0x0;var _0x4da89c=_0x0796[_0x92b3ae];return _0x4da89c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6079('0x0'));var timeout=require(_0x6079('0x1'));var express=require(_0x6079('0x2'));var router=express['Router']();var fs_extra=require(_0x6079('0x3'));var auth=require(_0x6079('0x4'));var interaction=require(_0x6079('0x5'));var config=require(_0x6079('0x6'));var controller=require(_0x6079('0x7'));router[_0x6079('0x8')]('/',auth[_0x6079('0x9')](),controller[_0x6079('0xa')]);router['get'](_0x6079('0xb'),auth[_0x6079('0x9')](),controller[_0x6079('0xc')]);router['get'](_0x6079('0xd'),auth[_0x6079('0x9')](),controller[_0x6079('0xe')]);router[_0x6079('0xf')]('/',auth[_0x6079('0x9')](),controller[_0x6079('0x10')]);router[_0x6079('0xf')](_0x6079('0xd'),auth[_0x6079('0x9')](),controller[_0x6079('0x11')]);router[_0x6079('0x12')](_0x6079('0xb'),auth[_0x6079('0x9')](),controller[_0x6079('0x13')]);router[_0x6079('0x14')]('/:id',auth[_0x6079('0x9')](),controller['destroy']);router[_0x6079('0x14')](_0x6079('0x15'),auth['isAuthenticated'](),controller[_0x6079('0x16')]);module[_0x6079('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 2aa82af..33d9c80 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 _0x5b20=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5b20,0x86));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x05b2('0x0'));module[_0x05b2('0x1')]={'name':{'type':Sequelize[_0x05b2('0x2')],'allowNull':![],'unique':_0x05b2('0x3')},'mode':{'type':Sequelize[_0x05b2('0x4')](_0x05b2('0x5'),_0x05b2('0x6'),_0x05b2('0x7'),_0x05b2('0x8'),_0x05b2('0x9'),_0x05b2('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x05b2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x05b2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x05b2('0x2')],'allowNull':!![],'defaultValue':_0x05b2('0xb')},'format':{'type':Sequelize[_0x05b2('0x2')],'allowNull':!![]},'stamp':{'type':_0x05b2('0xc')},'defaultEntry':{'type':Sequelize[_0x05b2('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1ea=['quietmp3nb','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb'];(function(_0x3aac69,_0x81d09f){var _0x38d35b=function(_0x58ef90){while(--_0x58ef90){_0x3aac69['push'](_0x3aac69['shift']());}};_0x38d35b(++_0x81d09f);}(_0xb1ea,0x9e));var _0xab1e=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xb1ea[_0xb833b1];return _0x1ab87a;};'use strict';var Sequelize=require(_0xab1e('0x0'));module[_0xab1e('0x1')]={'name':{'type':Sequelize[_0xab1e('0x2')],'allowNull':![],'unique':_0xab1e('0x3')},'mode':{'type':Sequelize['ENUM'](_0xab1e('0x4'),_0xab1e('0x5'),_0xab1e('0x6'),_0xab1e('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![],'defaultValue':_0xab1e('0x8')},'format':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![]},'stamp':{'type':_0xab1e('0x9')},'defaultEntry':{'type':Sequelize[_0xab1e('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index c1fc35e..26d4b3f 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 _0x71b7=['ValidationError','removeSound','id2','%s.%s','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','model','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','server/files/sounds/converted','format','basename','extname','converted_format','symlinkSync'];(function(_0xa7c05d,_0x312374){var _0x47b002=function(_0x44aa2f){while(--_0x44aa2f){_0xa7c05d['push'](_0xa7c05d['shift']());}};_0x47b002(++_0x312374);}(_0x71b7,0x1cb));var _0x771b=function(_0xbcbd76,_0x25722b){_0xbcbd76=_0xbcbd76-0x0;var _0x503680=_0x71b7[_0xbcbd76];return _0x503680;};'use strict';var emlformat=require(_0x771b('0x0'));var rimraf=require(_0x771b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x771b('0x2'));var BPromise=require(_0x771b('0x3'));var Mustache=require(_0x771b('0x4'));var util=require(_0x771b('0x5'));var path=require(_0x771b('0x6'));var sox=require(_0x771b('0x7'));var csv=require(_0x771b('0x8'));var ejs=require(_0x771b('0x9'));var fs=require('fs');var fs_extra=require(_0x771b('0xa'));var _=require(_0x771b('0xb'));var squel=require('squel');var crypto=require(_0x771b('0xc'));var jsforce=require(_0x771b('0xd'));var deskjs=require(_0x771b('0xe'));var toCsv=require(_0x771b('0x8'));var querystring=require('querystring');var Papa=require(_0x771b('0xf'));var Redis=require(_0x771b('0x10'));var authService=require(_0x771b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x771b('0x12'));var logger=require(_0x771b('0x13'))(_0x771b('0x14'));var utils=require('../../config/utils');var config=require(_0x771b('0x15'));var licenseUtil=require(_0x771b('0x16'));var db=require(_0x771b('0x17'))['db'];function respondWithStatusCode(_0x402f4a,_0x1c8055){_0x1c8055=_0x1c8055||0xcc;return function(_0x12b847){if(_0x12b847){return _0x402f4a[_0x771b('0x18')](_0x1c8055);}return _0x402f4a[_0x771b('0x19')](_0x1c8055)[_0x771b('0x1a')]();};}function respondWithResult(_0x27e841,_0x2e9977){_0x2e9977=_0x2e9977||0xc8;return function(_0x4111af){if(_0x4111af){return _0x27e841[_0x771b('0x19')](_0x2e9977)[_0x771b('0x1b')](_0x4111af);}};}function respondWithFilteredResult(_0x987823,_0x7f753c){return function(_0x18b7d9){if(_0x18b7d9){var _0x52c97f=typeof _0x7f753c[_0x771b('0x1c')]===_0x771b('0x1d')&&typeof _0x7f753c[_0x771b('0x1e')]===_0x771b('0x1d');var _0x4e5aa0=_0x18b7d9[_0x771b('0x1f')];var _0x2c37e8=_0x52c97f?0x0:_0x7f753c['offset'];var _0x11ea75=_0x52c97f?_0x18b7d9[_0x771b('0x1f')]:_0x7f753c[_0x771b('0x1c')]+_0x7f753c[_0x771b('0x1e')];var _0x56b84c;if(_0x11ea75>=_0x4e5aa0){_0x11ea75=_0x4e5aa0;_0x56b84c=0xc8;}else{_0x56b84c=0xce;}_0x987823[_0x771b('0x19')](_0x56b84c);return _0x987823['set']('Content-Range',_0x2c37e8+'-'+_0x11ea75+'/'+_0x4e5aa0)[_0x771b('0x1b')](_0x18b7d9);}return null;};}function patchUpdates(_0x1ac6d9){return function(_0x453159){try{jsonpatch[_0x771b('0x20')](_0x453159,_0x1ac6d9,!![]);}catch(_0x5b5a00){return BPromise['reject'](_0x5b5a00);}return _0x453159[_0x771b('0x21')]();};}function saveUpdates(_0x24e4b8,_0x4146b1){return function(_0x376659){if(_0x376659){return _0x376659[_0x771b('0x22')](_0x24e4b8)[_0x771b('0x23')](function(_0x45993c){return _0x45993c;});}return null;};}function removeEntity(_0x3a81c8,_0x4e4183){return function(_0x31995e){if(_0x31995e){return _0x31995e[_0x771b('0x24')]()[_0x771b('0x23')](function(){var _0x51728f=_0x31995e[_0x771b('0x25')]({'plain':!![]});var _0x134610=_0x771b('0x26');return db['UserProfileResource'][_0x771b('0x24')]({'where':{'type':_0x134610,'resourceId':_0x51728f['id']}})[_0x771b('0x23')](function(){return _0x31995e;});})['then'](function(){_0x3a81c8[_0x771b('0x19')](0xcc)[_0x771b('0x1a')]();});}};}function handleEntityNotFound(_0x523540,_0x12c700){return function(_0x5dcca3){if(!_0x5dcca3){_0x523540['sendStatus'](0x194);}return _0x5dcca3;};}function handleError(_0x32bb8f,_0x4ed805){_0x4ed805=_0x4ed805||0x1f4;return function(_0x56ea3b){logger[_0x771b('0x27')](_0x56ea3b[_0x771b('0x28')]);if(_0x56ea3b[_0x771b('0x29')]){delete _0x56ea3b['name'];}_0x32bb8f[_0x771b('0x19')](_0x4ed805)[_0x771b('0x2a')](_0x56ea3b);};}exports['index']=function(_0x526efe,_0x2240cf){var _0x384305={},_0x3cf8f9={},_0x515364={'count':0x0,'rows':[]};var _0xc212f7=_[_0x771b('0x2b')](db[_0x771b('0x2c')][_0x771b('0x2d')],function(_0x393fa6){return{'name':_0x393fa6['fieldName'],'type':_0x393fa6['type']['key']};});_0x3cf8f9[_0x771b('0x2e')]=_[_0x771b('0x2b')](_0xc212f7,'name');_0x3cf8f9['query']=_['keys'](_0x526efe[_0x771b('0x2f')]);_0x3cf8f9[_0x771b('0x30')]=_[_0x771b('0x31')](_0x3cf8f9[_0x771b('0x2e')],_0x3cf8f9['query']);_0x384305['attributes']=_[_0x771b('0x31')](_0x3cf8f9[_0x771b('0x2e')],qs[_0x771b('0x32')](_0x526efe[_0x771b('0x2f')][_0x771b('0x32')]));_0x384305[_0x771b('0x33')]=_0x384305['attributes'][_0x771b('0x34')]?_0x384305[_0x771b('0x33')]:_0x3cf8f9['model'];if(!_0x526efe[_0x771b('0x2f')]['hasOwnProperty']('nolimit')){_0x384305[_0x771b('0x1e')]=qs[_0x771b('0x1e')](_0x526efe[_0x771b('0x2f')][_0x771b('0x1e')]);_0x384305[_0x771b('0x1c')]=qs['offset'](_0x526efe[_0x771b('0x2f')][_0x771b('0x1c')]);}_0x384305[_0x771b('0x35')]=qs[_0x771b('0x36')](_0x526efe[_0x771b('0x2f')][_0x771b('0x36')]);delete _0x526efe[_0x771b('0x2f')][_0x771b('0x36')];_0x384305['where']=qs[_0x771b('0x30')](_[_0x771b('0x37')](_0x526efe['query'],_0x3cf8f9[_0x771b('0x30')]),_0xc212f7);if(_0x526efe[_0x771b('0x2f')][_0x771b('0x38')]){_0x384305[_0x771b('0x39')]=_[_0x771b('0x3a')](_0x384305['where'],{'$or':_[_0x771b('0x2b')](_0xc212f7,function(_0x34f72d){if(_0x34f72d[_0x771b('0x3b')]!==_0x771b('0x3c')){var _0x4df30d={};_0x4df30d[_0x34f72d['name']]={'$like':'%'+_0x526efe[_0x771b('0x2f')][_0x771b('0x38')]+'%'};return _0x4df30d;}})});}_0x384305=_[_0x771b('0x3a')]({},_0x384305,_0x526efe[_0x771b('0x3d')]);var _0x257fa5={'where':_0x384305[_0x771b('0x39')]};return db[_0x771b('0x2c')][_0x771b('0x1f')](_0x257fa5)[_0x771b('0x23')](function(_0xe15854){_0x515364[_0x771b('0x1f')]=_0xe15854;if(_0x526efe[_0x771b('0x2f')][_0x771b('0x3e')]){_0x384305['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x771b('0x3f')](_0x384305);})[_0x771b('0x23')](function(_0x4179f7){_0x515364[_0x771b('0x40')]=_0x4179f7;return _0x515364;})['then'](respondWithFilteredResult(_0x2240cf,_0x384305))[_0x771b('0x41')](handleError(_0x2240cf,null));};exports[_0x771b('0x42')]=function(_0x16a2d1,_0x7a3ee2){var _0x41fe30={'raw':![],'where':{'id':_0x16a2d1[_0x771b('0x43')]['id']}},_0x859bf5={};_0x859bf5['model']=_[_0x771b('0x44')](db[_0x771b('0x2c')][_0x771b('0x2d')]);_0x859bf5[_0x771b('0x2f')]=_[_0x771b('0x44')](_0x16a2d1[_0x771b('0x2f')]);_0x859bf5[_0x771b('0x30')]=_[_0x771b('0x31')](_0x859bf5[_0x771b('0x2e')],_0x859bf5[_0x771b('0x2f')]);_0x41fe30[_0x771b('0x33')]=_[_0x771b('0x31')](_0x859bf5[_0x771b('0x2e')],qs['fields'](_0x16a2d1[_0x771b('0x2f')][_0x771b('0x32')]));_0x41fe30[_0x771b('0x33')]=_0x41fe30[_0x771b('0x33')][_0x771b('0x34')]?_0x41fe30['attributes']:_0x859bf5[_0x771b('0x2e')];if(_0x16a2d1['query'][_0x771b('0x3e')]){_0x41fe30[_0x771b('0x45')]=[{'all':!![]}];}_0x41fe30=_['merge']({},_0x41fe30,_0x16a2d1[_0x771b('0x3d')]);return db[_0x771b('0x2c')][_0x771b('0x46')](_0x41fe30)[_0x771b('0x23')](handleEntityNotFound(_0x7a3ee2,null))[_0x771b('0x23')](respondWithResult(_0x7a3ee2,null))[_0x771b('0x41')](handleError(_0x7a3ee2,null));};exports['update']=function(_0x4e8dbb,_0x483307){if(_0x4e8dbb[_0x771b('0x47')]['id']){delete _0x4e8dbb['body']['id'];}return db[_0x771b('0x2c')]['find']({'where':{'id':_0x4e8dbb[_0x771b('0x43')]['id']}})[_0x771b('0x23')](handleEntityNotFound(_0x483307,null))[_0x771b('0x23')](saveUpdates(_0x4e8dbb['body'],null))[_0x771b('0x23')](respondWithResult(_0x483307,null))['catch'](handleError(_0x483307,null));};exports[_0x771b('0x48')]=function(_0x31cc51,_0x1c84df,_0x424039){return db[_0x771b('0x49')]['transaction'](function(_0x4e481e){if(_0x31cc51[_0x771b('0x47')][_0x771b('0x4a')]===_0x771b('0x4b')){_0x31cc51['body'][_0x771b('0x4c')]=path[_0x771b('0x4d')](config[_0x771b('0x4e')],_0x771b('0x4f'),_0x31cc51[_0x771b('0x47')][_0x771b('0x29')]);}return db[_0x771b('0x2c')]['create'](_0x31cc51[_0x771b('0x47')],{'transaction':_0x4e481e})[_0x771b('0x23')](function(_0x1d4ce7){if(_0x31cc51[_0x771b('0x47')][_0x771b('0x4a')]==='files'){fs[_0x771b('0x50')](_0x1d4ce7[_0x771b('0x4c')],parseInt(_0x771b('0x51'),0x8));}var _0x5055de=_0x31cc51['user'][_0x771b('0x25')]({'plain':!![]});if(!_0x5055de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5055de[_0x771b('0x52')]===_0x771b('0x53')){var _0xbd93a=_0x1d4ce7[_0x771b('0x25')]({'plain':!![]});return db[_0x771b('0x54')][_0x771b('0x46')]({'where':{'name':_0x771b('0x26'),'userProfileId':_0x5055de[_0x771b('0x55')]},'raw':!![]})[_0x771b('0x23')](function(_0x362a1d){if(_0x362a1d&&_0x362a1d[_0x771b('0x56')]===0x0){return db[_0x771b('0x57')]['create']({'name':_0xbd93a[_0x771b('0x29')],'resourceId':_0xbd93a['id'],'type':_0x362a1d[_0x771b('0x29')],'sectionId':_0x362a1d['id']},{})[_0x771b('0x23')](function(){return _0x1d4ce7;});}else{return _0x1d4ce7;}})['catch'](function(_0x580e59){logger[_0x771b('0x27')](_0x771b('0x58'),_0x580e59);});}return _0x1d4ce7;});})[_0x771b('0x23')](respondWithResult(_0x1c84df,0xc9))[_0x771b('0x41')](handleError(_0x1c84df,null));};exports[_0x771b('0x24')]=function(_0x6e3c61,_0x550de5,_0x2174de){var _0x396e6c;return db[_0x771b('0x2c')]['find']({'where':{'id':_0x6e3c61['params']['id']}})['then'](function(_0xdab1f){if(_0xdab1f){return db[_0x771b('0x49')][_0x771b('0x59')](function(_0x4b1c8c){return _0xdab1f['destroy']({'transaction':_0x4b1c8c,'raw':!![]})[_0x771b('0x23')](function(_0x52cfc4){if(_0x52cfc4[_0x771b('0x4c')]){fs[_0x771b('0x5a')](_0x52cfc4[_0x771b('0x4c')])[_0x771b('0x5b')](function(_0x245e7e){fs[_0x771b('0x5c')](path['join'](_0x52cfc4[_0x771b('0x4c')],_0x245e7e));});fs[_0x771b('0x5d')](_0x52cfc4[_0x771b('0x4c')]);}return _0x52cfc4;});})[_0x771b('0x41')](function(_0xdc150b){throw new db[(_0x771b('0x5e'))]['ValidationError'](_0xdc150b[_0x771b('0x5f')]);});}})[_0x771b('0x23')](handleEntityNotFound(_0x550de5,null))[_0x771b('0x23')](removeEntity(_0x550de5,null))[_0x771b('0x41')](handleError(_0x550de5,null));};exports['addSound']=function(_0x1eb2db,_0x56e677,_0x5b4da3){return db[_0x771b('0x49')]['transaction'](function(_0x525d44){var _0x2c4e80;return db[_0x771b('0x2c')][_0x771b('0x46')]({'where':{'id':_0x1eb2db['params']['id']}})[_0x771b('0x23')](function(_0x2ccfd7){if(_0x2ccfd7){_0x2c4e80=_0x2ccfd7;return _0x2ccfd7[_0x771b('0x60')](_0x1eb2db['body']['id'],{'transaction':_0x525d44});}})[_0x771b('0x23')](function(_0x34418d){if(_0x34418d){return db[_0x771b('0x61')][_0x771b('0x62')]({'where':{'id':_0x1eb2db['body']['id']},'attributes':['id','name',_0x771b('0x63'),'converted_format','createdAt'],'raw':!![]});}})[_0x771b('0x23')](function(_0x5601c4){if(_0x5601c4){var _0x37f841=path[_0x771b('0x4d')](config[_0x771b('0x4e')],_0x771b('0x64'),util[_0x771b('0x65')]('%s.%s',path[_0x771b('0x66')](_0x5601c4['save_name'],path[_0x771b('0x67')](_0x5601c4[_0x771b('0x63')])),_0x5601c4[_0x771b('0x68')]));var _0x422f39=path[_0x771b('0x4d')](config['root'],_0x771b('0x4f'),_0x2c4e80[_0x771b('0x29')],util['format']('%s.%s',_0x5601c4[_0x771b('0x29')],_0x5601c4['converted_format']));fs[_0x771b('0x69')](_0x37f841,_0x422f39);return _0x5601c4;}})[_0x771b('0x41')](function(_0x3486f0){throw new db[(_0x771b('0x5e'))][(_0x771b('0x6a'))](_0x3486f0[_0x771b('0x5f')]);});})[_0x771b('0x23')](handleEntityNotFound(_0x56e677,null))[_0x771b('0x23')](respondWithResult(_0x56e677,0xc9))['catch'](handleError(_0x56e677,null));};exports[_0x771b('0x6b')]=function(_0x58d8a9,_0x414de4,_0x56c757){return db['sequelize'][_0x771b('0x59')](function(_0x1065d8){var _0x4b9e74;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x58d8a9['params']['id']}})['then'](handleEntityNotFound(_0x414de4,null))[_0x771b('0x23')](function(_0x4116c4){if(_0x4116c4){_0x4b9e74=_0x4116c4;return _0x4116c4['removeSound'](_0x58d8a9[_0x771b('0x43')][_0x771b('0x6c')]);}})[_0x771b('0x23')](function(_0x407dff){if(_0x407dff){return db['Sound']['findOne']({'where':{'id':_0x58d8a9[_0x771b('0x43')]['id2']},'attributes':['id',_0x771b('0x29'),_0x771b('0x63'),_0x771b('0x68'),'createdAt'],'raw':!![]});}})[_0x771b('0x23')](function(_0x131edc){if(_0x131edc){fs[_0x771b('0x5c')](path[_0x771b('0x4d')](_0x4b9e74[_0x771b('0x4c')],util[_0x771b('0x65')](_0x771b('0x6d'),_0x131edc['name'],_0x131edc[_0x771b('0x68')])));return _0x131edc;}})['catch'](function(_0x202347){throw new db[(_0x771b('0x5e'))][(_0x771b('0x6a'))](_0x202347[_0x771b('0x5f')]);});})[_0x771b('0x23')](handleEntityNotFound(_0x414de4,null))['then'](respondWithStatusCode(_0x414de4,0xcc))['catch'](handleError(_0x414de4,null));};exports[_0x771b('0x6e')]=function(_0x18f61b,_0x372d40,_0x5a285d){var _0x3c4ad3={};var _0x189860={};var _0x383278;var _0x423d8d;return db['VoiceMusicOnHold'][_0x771b('0x62')]({'where':{'id':_0x18f61b[_0x771b('0x43')]['id']}})[_0x771b('0x23')](handleEntityNotFound(_0x372d40,null))[_0x771b('0x23')](function(_0x24d3ba){if(_0x24d3ba){_0x383278=_0x24d3ba;_0x189860[_0x771b('0x2e')]=_[_0x771b('0x44')](db['Sound'][_0x771b('0x2d')]);_0x189860[_0x771b('0x2f')]=_[_0x771b('0x44')](_0x18f61b[_0x771b('0x2f')]);_0x189860[_0x771b('0x30')]=_[_0x771b('0x31')](_0x189860[_0x771b('0x2e')],_0x189860[_0x771b('0x2f')]);_0x3c4ad3['attributes']=_[_0x771b('0x31')](_0x189860[_0x771b('0x2e')],qs[_0x771b('0x32')](_0x18f61b[_0x771b('0x2f')][_0x771b('0x32')]));_0x3c4ad3[_0x771b('0x33')]=_0x3c4ad3[_0x771b('0x33')][_0x771b('0x34')]?_0x3c4ad3[_0x771b('0x33')]:_0x189860[_0x771b('0x2e')];_0x3c4ad3['order']=qs[_0x771b('0x36')](_0x18f61b[_0x771b('0x2f')][_0x771b('0x36')]);_0x3c4ad3[_0x771b('0x39')]=qs['filters'](_[_0x771b('0x37')](_0x18f61b[_0x771b('0x2f')],_0x189860[_0x771b('0x30')]));if(_0x18f61b['query']['filter']){_0x3c4ad3[_0x771b('0x39')]=_['merge'](_0x3c4ad3[_0x771b('0x39')],{'$or':_[_0x771b('0x2b')](_0x3c4ad3['attributes'],function(_0x2b8e44){var _0x195505={};_0x195505[_0x2b8e44]={'$like':'%'+_0x18f61b[_0x771b('0x2f')]['filter']+'%'};return _0x195505;})});}_0x3c4ad3=_[_0x771b('0x3a')]({},_0x3c4ad3,_0x18f61b[_0x771b('0x3d')]);return _0x383278[_0x771b('0x6e')](_0x3c4ad3);}})[_0x771b('0x23')](function(_0x5d8436){if(_0x5d8436){_0x423d8d=_0x5d8436[_0x771b('0x34')];if(!_0x18f61b['query'][_0x771b('0x6f')](_0x771b('0x70'))){_0x3c4ad3[_0x771b('0x1e')]=qs[_0x771b('0x1e')](_0x18f61b['query'][_0x771b('0x1e')]);_0x3c4ad3[_0x771b('0x1c')]=qs[_0x771b('0x1c')](_0x18f61b[_0x771b('0x2f')]['offset']);}return _0x383278[_0x771b('0x6e')](_0x3c4ad3);}})[_0x771b('0x23')](function(_0x395fad){if(_0x395fad){return _0x395fad?{'count':_0x423d8d,'rows':_0x395fad}:null;}})[_0x771b('0x23')](respondWithResult(_0x372d40,null))['catch'](handleError(_0x372d40,null));}; \ No newline at end of file +var _0xd050=['Content-Range','json','apply','reject','save','update','destroy','get','MusicOnHolds','then','error','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','length','options','body','find','params','catch','create','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','extname','converted_format','format','symlinkSync','Sequelize','message','removeSound','id2','Sound','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd050,0x13d));var _0x0d05=function(_0x25382a,_0x28c993){_0x25382a=_0x25382a-0x0;var _0x305590=_0xd050[_0x25382a];return _0x305590;};'use strict';var emlformat=require(_0x0d05('0x0'));var rimraf=require(_0x0d05('0x1'));var zipdir=require(_0x0d05('0x2'));var jsonpatch=require(_0x0d05('0x3'));var rp=require(_0x0d05('0x4'));var moment=require(_0x0d05('0x5'));var BPromise=require(_0x0d05('0x6'));var Mustache=require('mustache');var util=require(_0x0d05('0x7'));var path=require(_0x0d05('0x8'));var sox=require(_0x0d05('0x9'));var csv=require('to-csv');var ejs=require(_0x0d05('0xa'));var fs=require('fs');var fs_extra=require(_0x0d05('0xb'));var _=require(_0x0d05('0xc'));var squel=require(_0x0d05('0xd'));var crypto=require(_0x0d05('0xe'));var jsforce=require(_0x0d05('0xf'));var deskjs=require(_0x0d05('0x10'));var toCsv=require(_0x0d05('0x11'));var querystring=require(_0x0d05('0x12'));var Papa=require(_0x0d05('0x13'));var Redis=require(_0x0d05('0x14'));var authService=require(_0x0d05('0x15'));var qs=require(_0x0d05('0x16'));var as=require(_0x0d05('0x17'));var hardwareService=require(_0x0d05('0x18'));var logger=require(_0x0d05('0x19'))(_0x0d05('0x1a'));var utils=require(_0x0d05('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x0d05('0x1c'));var db=require(_0x0d05('0x1d'))['db'];function respondWithStatusCode(_0x549aa8,_0x1bda31){_0x1bda31=_0x1bda31||0xcc;return function(_0x8a5f03){if(_0x8a5f03){return _0x549aa8[_0x0d05('0x1e')](_0x1bda31);}return _0x549aa8['status'](_0x1bda31)[_0x0d05('0x1f')]();};}function respondWithResult(_0x4e871d,_0x466cee){_0x466cee=_0x466cee||0xc8;return function(_0x1e96fe){if(_0x1e96fe){return _0x4e871d['status'](_0x466cee)['json'](_0x1e96fe);}};}function respondWithFilteredResult(_0x5da97e,_0xfea59e){return function(_0x1deff4){if(_0x1deff4){var _0x2c328e=typeof _0xfea59e['offset']===_0x0d05('0x20')&&typeof _0xfea59e[_0x0d05('0x21')]==='undefined';var _0x2b6b45=_0x1deff4[_0x0d05('0x22')];var _0x391754=_0x2c328e?0x0:_0xfea59e[_0x0d05('0x23')];var _0x30a1c2=_0x2c328e?_0x1deff4['count']:_0xfea59e[_0x0d05('0x23')]+_0xfea59e[_0x0d05('0x21')];var _0x720730;if(_0x30a1c2>=_0x2b6b45){_0x30a1c2=_0x2b6b45;_0x720730=0xc8;}else{_0x720730=0xce;}_0x5da97e[_0x0d05('0x24')](_0x720730);return _0x5da97e['set'](_0x0d05('0x25'),_0x391754+'-'+_0x30a1c2+'/'+_0x2b6b45)[_0x0d05('0x26')](_0x1deff4);}return null;};}function patchUpdates(_0x6fb66){return function(_0x4be0d4){try{jsonpatch[_0x0d05('0x27')](_0x4be0d4,_0x6fb66,!![]);}catch(_0x45c4af){return BPromise[_0x0d05('0x28')](_0x45c4af);}return _0x4be0d4[_0x0d05('0x29')]();};}function saveUpdates(_0x57322c,_0x68e210){return function(_0x40ab66){if(_0x40ab66){return _0x40ab66[_0x0d05('0x2a')](_0x57322c)['then'](function(_0x1b6c74){return _0x1b6c74;});}return null;};}function removeEntity(_0x500aff,_0x245cda){return function(_0x5a05c8){if(_0x5a05c8){return _0x5a05c8[_0x0d05('0x2b')]()['then'](function(){var _0x4cd7fa=_0x5a05c8[_0x0d05('0x2c')]({'plain':!![]});var _0x460977=_0x0d05('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x460977,'resourceId':_0x4cd7fa['id']}})[_0x0d05('0x2e')](function(){return _0x5a05c8;});})[_0x0d05('0x2e')](function(){_0x500aff[_0x0d05('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22b899,_0x3fc79a){return function(_0x10c682){if(!_0x10c682){_0x22b899[_0x0d05('0x1e')](0x194);}return _0x10c682;};}function handleError(_0x3cc80a,_0x2a023c){_0x2a023c=_0x2a023c||0x1f4;return function(_0x1489d1){logger[_0x0d05('0x2f')](_0x1489d1[_0x0d05('0x30')]);if(_0x1489d1[_0x0d05('0x31')]){delete _0x1489d1[_0x0d05('0x31')];}_0x3cc80a[_0x0d05('0x24')](_0x2a023c)[_0x0d05('0x32')](_0x1489d1);};}exports['index']=function(_0x48bf9e,_0x4db6ad){var _0x4b3576={},_0x4807c2={},_0x16a8b8={'count':0x0,'rows':[]};var _0x3e938e=_['map'](db[_0x0d05('0x33')][_0x0d05('0x34')],function(_0x204523){return{'name':_0x204523[_0x0d05('0x35')],'type':_0x204523['type'][_0x0d05('0x36')]};});_0x4807c2[_0x0d05('0x37')]=_[_0x0d05('0x38')](_0x3e938e,_0x0d05('0x31'));_0x4807c2[_0x0d05('0x39')]=_[_0x0d05('0x3a')](_0x48bf9e[_0x0d05('0x39')]);_0x4807c2[_0x0d05('0x3b')]=_[_0x0d05('0x3c')](_0x4807c2['model'],_0x4807c2[_0x0d05('0x39')]);_0x4b3576[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x4807c2[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x3e')]));_0x4b3576['attributes']=_0x4b3576['attributes']['length']?_0x4b3576[_0x0d05('0x3d')]:_0x4807c2['model'];if(!_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x3f')]('nolimit')){_0x4b3576[_0x0d05('0x21')]=qs[_0x0d05('0x21')](_0x48bf9e[_0x0d05('0x39')]['limit']);_0x4b3576[_0x0d05('0x23')]=qs[_0x0d05('0x23')](_0x48bf9e[_0x0d05('0x39')]['offset']);}_0x4b3576[_0x0d05('0x40')]=qs[_0x0d05('0x41')](_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x41')]);delete _0x48bf9e['query'][_0x0d05('0x41')];_0x4b3576[_0x0d05('0x42')]=qs[_0x0d05('0x3b')](_['pick'](_0x48bf9e[_0x0d05('0x39')],_0x4807c2['filters']),_0x3e938e);if(_0x48bf9e['query'][_0x0d05('0x43')]){_0x4b3576[_0x0d05('0x42')]=_[_0x0d05('0x44')](_0x4b3576[_0x0d05('0x42')],{'$or':_[_0x0d05('0x38')](_0x3e938e,function(_0x39dd22){if(_0x39dd22['type']!=='VIRTUAL'){var _0x5415e3={};_0x5415e3[_0x39dd22['name']]={'$like':'%'+_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x43')]+'%'};return _0x5415e3;}})});}_0x4b3576=_[_0x0d05('0x44')]({},_0x4b3576,_0x48bf9e['options']);var _0x3e0468={'where':_0x4b3576[_0x0d05('0x42')]};return db[_0x0d05('0x33')][_0x0d05('0x22')](_0x3e0468)[_0x0d05('0x2e')](function(_0x2368e6){_0x16a8b8[_0x0d05('0x22')]=_0x2368e6;if(_0x48bf9e['query'][_0x0d05('0x45')]){_0x4b3576[_0x0d05('0x46')]=[{'all':!![]}];}return db[_0x0d05('0x33')][_0x0d05('0x47')](_0x4b3576);})[_0x0d05('0x2e')](function(_0x258098){_0x16a8b8[_0x0d05('0x48')]=_0x258098;return _0x16a8b8;})[_0x0d05('0x2e')](respondWithFilteredResult(_0x4db6ad,_0x4b3576))['catch'](handleError(_0x4db6ad,null));};exports['show']=function(_0x441bff,_0x428fd1){var _0xbced34={'raw':![],'where':{'id':_0x441bff['params']['id']}},_0x38c60d={};_0x38c60d[_0x0d05('0x37')]=_[_0x0d05('0x3a')](db[_0x0d05('0x33')]['rawAttributes']);_0x38c60d['query']=_['keys'](_0x441bff[_0x0d05('0x39')]);_0x38c60d[_0x0d05('0x3b')]=_[_0x0d05('0x3c')](_0x38c60d[_0x0d05('0x37')],_0x38c60d[_0x0d05('0x39')]);_0xbced34[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x38c60d[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x441bff['query'][_0x0d05('0x3e')]));_0xbced34[_0x0d05('0x3d')]=_0xbced34[_0x0d05('0x3d')][_0x0d05('0x49')]?_0xbced34[_0x0d05('0x3d')]:_0x38c60d[_0x0d05('0x37')];if(_0x441bff[_0x0d05('0x39')][_0x0d05('0x45')]){_0xbced34[_0x0d05('0x46')]=[{'all':!![]}];}_0xbced34=_[_0x0d05('0x44')]({},_0xbced34,_0x441bff[_0x0d05('0x4a')]);return db['VoiceMusicOnHold']['find'](_0xbced34)[_0x0d05('0x2e')](handleEntityNotFound(_0x428fd1,null))[_0x0d05('0x2e')](respondWithResult(_0x428fd1,null))['catch'](handleError(_0x428fd1,null));};exports[_0x0d05('0x2a')]=function(_0xea67f1,_0x2fad4e){if(_0xea67f1[_0x0d05('0x4b')]['id']){delete _0xea67f1['body']['id'];}return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0xea67f1[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](handleEntityNotFound(_0x2fad4e,null))[_0x0d05('0x2e')](saveUpdates(_0xea67f1[_0x0d05('0x4b')],null))[_0x0d05('0x2e')](respondWithResult(_0x2fad4e,null))[_0x0d05('0x4e')](handleError(_0x2fad4e,null));};exports[_0x0d05('0x4f')]=function(_0x26a2d0,_0x16bb1c,_0x2bf5e2){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x3e5a30){if(_0x26a2d0['body']['mode']===_0x0d05('0x52')){_0x26a2d0[_0x0d05('0x4b')][_0x0d05('0x53')]=path[_0x0d05('0x54')](config[_0x0d05('0x55')],'server/files/moh',_0x26a2d0['body'][_0x0d05('0x31')]);}return db[_0x0d05('0x33')][_0x0d05('0x4f')](_0x26a2d0[_0x0d05('0x4b')],{'transaction':_0x3e5a30})[_0x0d05('0x2e')](function(_0x527cf6){if(_0x26a2d0[_0x0d05('0x4b')][_0x0d05('0x56')]===_0x0d05('0x52')){fs[_0x0d05('0x57')](_0x527cf6[_0x0d05('0x53')],parseInt(_0x0d05('0x58'),0x8));}var _0x394cd1=_0x26a2d0[_0x0d05('0x59')]['get']({'plain':!![]});if(!_0x394cd1)throw new Error(_0x0d05('0x5a'));if(_0x394cd1[_0x0d05('0x5b')]===_0x0d05('0x59')){var _0xd88eff=_0x527cf6[_0x0d05('0x2c')]({'plain':!![]});return db[_0x0d05('0x5c')][_0x0d05('0x4c')]({'where':{'name':_0x0d05('0x2d'),'userProfileId':_0x394cd1[_0x0d05('0x5d')]},'raw':!![]})[_0x0d05('0x2e')](function(_0x3b6f82){if(_0x3b6f82&&_0x3b6f82[_0x0d05('0x5e')]===0x0){return db[_0x0d05('0x5f')]['create']({'name':_0xd88eff[_0x0d05('0x31')],'resourceId':_0xd88eff['id'],'type':_0x3b6f82[_0x0d05('0x31')],'sectionId':_0x3b6f82['id']},{})[_0x0d05('0x2e')](function(){return _0x527cf6;});}else{return _0x527cf6;}})['catch'](function(_0x2351bd){logger[_0x0d05('0x2f')](_0x0d05('0x60'),_0x2351bd);});}return _0x527cf6;});})[_0x0d05('0x2e')](respondWithResult(_0x16bb1c,0xc9))[_0x0d05('0x4e')](handleError(_0x16bb1c,null));};exports['destroy']=function(_0x14c652,_0x263fb0,_0x4f4a6d){var _0x299e5e;return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0x14c652['params']['id']}})[_0x0d05('0x2e')](function(_0x3f1210){if(_0x3f1210){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x4c02f6){return _0x3f1210[_0x0d05('0x2b')]({'transaction':_0x4c02f6,'raw':!![]})[_0x0d05('0x2e')](function(_0x5780ba){if(_0x5780ba[_0x0d05('0x53')]){fs[_0x0d05('0x61')](_0x5780ba['directory'])[_0x0d05('0x62')](function(_0x5cdbd0){fs[_0x0d05('0x63')](path[_0x0d05('0x54')](_0x5780ba[_0x0d05('0x53')],_0x5cdbd0));});fs[_0x0d05('0x64')](_0x5780ba[_0x0d05('0x53')]);}return _0x5780ba;});})[_0x0d05('0x4e')](function(_0x46cbc9){throw new db['Sequelize'][(_0x0d05('0x65'))](_0x46cbc9['message']);});}})['then'](handleEntityNotFound(_0x263fb0,null))[_0x0d05('0x2e')](removeEntity(_0x263fb0,null))[_0x0d05('0x4e')](handleError(_0x263fb0,null));};exports[_0x0d05('0x66')]=function(_0x565116,_0x54bc34,_0x501f87){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x36186f){var _0x2bf020;return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0x565116[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](function(_0x18c69d){if(_0x18c69d){_0x2bf020=_0x18c69d;return _0x18c69d[_0x0d05('0x66')](_0x565116[_0x0d05('0x4b')]['id'],{'transaction':_0x36186f});}})[_0x0d05('0x2e')](function(_0x2929a1){if(_0x2929a1){return db['Sound'][_0x0d05('0x67')]({'where':{'id':_0x565116[_0x0d05('0x4b')]['id']},'attributes':['id','name',_0x0d05('0x68'),'converted_format',_0x0d05('0x69')],'raw':!![]});}})[_0x0d05('0x2e')](function(_0x3b0704){if(_0x3b0704){var _0x1aa515=path[_0x0d05('0x54')](config[_0x0d05('0x55')],_0x0d05('0x6a'),util['format'](_0x0d05('0x6b'),path['basename'](_0x3b0704[_0x0d05('0x68')],path[_0x0d05('0x6c')](_0x3b0704[_0x0d05('0x68')])),_0x3b0704[_0x0d05('0x6d')]));var _0x5d7253=path[_0x0d05('0x54')](config['root'],'server/files/moh',_0x2bf020[_0x0d05('0x31')],util[_0x0d05('0x6e')](_0x0d05('0x6b'),_0x3b0704[_0x0d05('0x31')],_0x3b0704[_0x0d05('0x6d')]));fs[_0x0d05('0x6f')](_0x1aa515,_0x5d7253);return _0x3b0704;}})[_0x0d05('0x4e')](function(_0x4cb441){throw new db[(_0x0d05('0x70'))][(_0x0d05('0x65'))](_0x4cb441[_0x0d05('0x71')]);});})[_0x0d05('0x2e')](handleEntityNotFound(_0x54bc34,null))[_0x0d05('0x2e')](respondWithResult(_0x54bc34,0xc9))[_0x0d05('0x4e')](handleError(_0x54bc34,null));};exports[_0x0d05('0x72')]=function(_0x3d3860,_0x18ef03,_0x594fda){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x35a244){var _0x42fe4f;return db[_0x0d05('0x33')][_0x0d05('0x67')]({'where':{'id':_0x3d3860[_0x0d05('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18ef03,null))[_0x0d05('0x2e')](function(_0x44bb56){if(_0x44bb56){_0x42fe4f=_0x44bb56;return _0x44bb56['removeSound'](_0x3d3860[_0x0d05('0x4d')][_0x0d05('0x73')]);}})[_0x0d05('0x2e')](function(_0x14bceb){if(_0x14bceb){return db[_0x0d05('0x74')][_0x0d05('0x67')]({'where':{'id':_0x3d3860[_0x0d05('0x4d')][_0x0d05('0x73')]},'attributes':['id',_0x0d05('0x31'),_0x0d05('0x68'),'converted_format',_0x0d05('0x69')],'raw':!![]});}})[_0x0d05('0x2e')](function(_0x434a10){if(_0x434a10){fs[_0x0d05('0x63')](path[_0x0d05('0x54')](_0x42fe4f[_0x0d05('0x53')],util[_0x0d05('0x6e')](_0x0d05('0x6b'),_0x434a10['name'],_0x434a10[_0x0d05('0x6d')])));return _0x434a10;}})['catch'](function(_0x430929){throw new db[(_0x0d05('0x70'))][(_0x0d05('0x65'))](_0x430929[_0x0d05('0x71')]);});})[_0x0d05('0x2e')](handleEntityNotFound(_0x18ef03,null))['then'](respondWithStatusCode(_0x18ef03,0xcc))[_0x0d05('0x4e')](handleError(_0x18ef03,null));};exports[_0x0d05('0x75')]=function(_0x1270f6,_0x9a002b,_0x1ea600){var _0x56e3b4={};var _0x120c95={};var _0x3e5ad8;var _0x1aa692;return db[_0x0d05('0x33')]['findOne']({'where':{'id':_0x1270f6[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](handleEntityNotFound(_0x9a002b,null))['then'](function(_0x446068){if(_0x446068){_0x3e5ad8=_0x446068;_0x120c95[_0x0d05('0x37')]=_[_0x0d05('0x3a')](db['Sound'][_0x0d05('0x34')]);_0x120c95[_0x0d05('0x39')]=_[_0x0d05('0x3a')](_0x1270f6[_0x0d05('0x39')]);_0x120c95['filters']=_['intersection'](_0x120c95['model'],_0x120c95[_0x0d05('0x39')]);_0x56e3b4[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x120c95[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x3e')]));_0x56e3b4[_0x0d05('0x3d')]=_0x56e3b4[_0x0d05('0x3d')][_0x0d05('0x49')]?_0x56e3b4[_0x0d05('0x3d')]:_0x120c95[_0x0d05('0x37')];_0x56e3b4['order']=qs[_0x0d05('0x41')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x41')]);_0x56e3b4[_0x0d05('0x42')]=qs[_0x0d05('0x3b')](_['pick'](_0x1270f6[_0x0d05('0x39')],_0x120c95[_0x0d05('0x3b')]));if(_0x1270f6['query']['filter']){_0x56e3b4[_0x0d05('0x42')]=_[_0x0d05('0x44')](_0x56e3b4[_0x0d05('0x42')],{'$or':_[_0x0d05('0x38')](_0x56e3b4[_0x0d05('0x3d')],function(_0x155880){var _0x1f5392={};_0x1f5392[_0x155880]={'$like':'%'+_0x1270f6['query'][_0x0d05('0x43')]+'%'};return _0x1f5392;})});}_0x56e3b4=_['merge']({},_0x56e3b4,_0x1270f6[_0x0d05('0x4a')]);return _0x3e5ad8['getSounds'](_0x56e3b4);}})[_0x0d05('0x2e')](function(_0x3e5e8b){if(_0x3e5e8b){_0x1aa692=_0x3e5e8b['length'];if(!_0x1270f6[_0x0d05('0x39')][_0x0d05('0x3f')]('nolimit')){_0x56e3b4[_0x0d05('0x21')]=qs[_0x0d05('0x21')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x21')]);_0x56e3b4[_0x0d05('0x23')]=qs[_0x0d05('0x23')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x23')]);}return _0x3e5ad8[_0x0d05('0x75')](_0x56e3b4);}})['then'](function(_0x2c47e5){if(_0x2c47e5){return _0x2c47e5?{'count':_0x1aa692,'rows':_0x2c47e5}:null;}})[_0x0d05('0x2e')](respondWithResult(_0x9a002b,null))[_0x0d05('0x4e')](handleError(_0x9a002b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4cd0b3f..8bd5b3e 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 _0x28ff=['VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x3791ed,_0x21744a){var _0x5ed6b2=function(_0x421bce){while(--_0x421bce){_0x3791ed['push'](_0x3791ed['shift']());}};_0x5ed6b2(++_0x21744a);}(_0x28ff,0x11f));var _0xf28f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x28ff[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf28f('0x0'));var util=require(_0xf28f('0x1'));var logger=require(_0xf28f('0x2'))(_0xf28f('0x3'));var moment=require(_0xf28f('0x4'));var BPromise=require(_0xf28f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf28f('0x6'));var rimraf=require(_0xf28f('0x7'));var config=require(_0xf28f('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0xfde9a7,_0x2f92e9){return _0xfde9a7[_0xf28f('0x9')](_0xf28f('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02dd=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x02dd,0xc5));var _0xd02d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x02dd[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xd02d('0x0'));var util=require(_0xd02d('0x1'));var logger=require(_0xd02d('0x2'))(_0xd02d('0x3'));var moment=require(_0xd02d('0x4'));var BPromise=require(_0xd02d('0x5'));var rp=require(_0xd02d('0x6'));var fs=require('fs');var path=require(_0xd02d('0x7'));var rimraf=require(_0xd02d('0x8'));var config=require('../../config/environment');var attributes=require(_0xd02d('0x9'));module[_0xd02d('0xa')]=function(_0x14bc95,_0x2841a7){return _0x14bc95[_0xd02d('0xb')](_0xd02d('0xc'),attributes,{'tableName':_0xd02d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index be5d528..6bf3ab7 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2cf626,_0x5dc6f0){var _0x3a61d4=function(_0x10401c){while(--_0x10401c){_0x2cf626['push'](_0x2cf626['shift']());}};_0x3a61d4(++_0x5dc6f0);}(_0x34e8,0x12c));var _0x834e=function(_0x487e30,_0x15eb57){_0x487e30=_0x487e30-0x0;var _0x3a359a=_0x34e8[_0x487e30];return _0x3a359a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb8c0e3,_0x117bb7){var _0x18547c=function(_0x2880a4){while(--_0x2880a4){_0xb8c0e3['push'](_0xb8c0e3['shift']());}};_0x18547c(++_0x117bb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f8065bf..e57bbb6 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 _0x4b68=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports'];(function(_0x615872,_0x12463f){var _0x1f5ceb=function(_0x548ea5){while(--_0x548ea5){_0x615872['push'](_0x615872['shift']());}};_0x1f5ceb(++_0x12463f);}(_0x4b68,0x129));var _0x84b6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b68[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x84b6('0x0'));var util=require(_0x84b6('0x1'));var path=require(_0x84b6('0x2'));var timeout=require(_0x84b6('0x3'));var express=require(_0x84b6('0x4'));var router=express['Router']();var fs_extra=require(_0x84b6('0x5'));var auth=require(_0x84b6('0x6'));var interaction=require(_0x84b6('0x7'));var config=require(_0x84b6('0x8'));var controller=require('./voicePrefix.controller');router[_0x84b6('0x9')]('/',auth[_0x84b6('0xa')](),controller['index']);router[_0x84b6('0x9')]('/describe',auth[_0x84b6('0xa')](),controller[_0x84b6('0xb')]);router[_0x84b6('0x9')](_0x84b6('0xc'),auth[_0x84b6('0xa')](),controller[_0x84b6('0xd')]);router['get'](_0x84b6('0xe'),auth[_0x84b6('0xa')](),controller[_0x84b6('0xf')]);router[_0x84b6('0x9')](_0x84b6('0x10'),auth['isAuthenticated'](),controller[_0x84b6('0x11')]);router[_0x84b6('0x12')]('/',auth[_0x84b6('0xa')](),controller['create']);router[_0x84b6('0x12')](_0x84b6('0xe'),auth[_0x84b6('0xa')](),controller[_0x84b6('0x13')]);router[_0x84b6('0x12')](_0x84b6('0x10'),auth['isAuthenticated'](),controller[_0x84b6('0x14')]);router[_0x84b6('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x84b6('0x16')]);router[_0x84b6('0x17')](_0x84b6('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x84b6('0x17')](_0x84b6('0xe'),auth[_0x84b6('0xa')](),controller[_0x84b6('0x18')]);router['delete']('/:id/teams',auth[_0x84b6('0xa')](),controller[_0x84b6('0x19')]);module[_0x84b6('0x1a')]=router; \ No newline at end of file +var _0x487d=['/:id','show','getAgents','getTeams','post','create','/:id/users','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x26ffd9,_0x380473){var _0x32c2a3=function(_0x3eff4e){while(--_0x3eff4e){_0x26ffd9['push'](_0x26ffd9['shift']());}};_0x32c2a3(++_0x380473);}(_0x487d,0x1b4));var _0xd487=function(_0x5773e7,_0x435e69){_0x5773e7=_0x5773e7-0x0;var _0x5e6621=_0x487d[_0x5773e7];return _0x5e6621;};'use strict';var multer=require(_0xd487('0x0'));var util=require(_0xd487('0x1'));var path=require(_0xd487('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd487('0x3')]();var fs_extra=require(_0xd487('0x4'));var auth=require(_0xd487('0x5'));var interaction=require(_0xd487('0x6'));var config=require(_0xd487('0x7'));var controller=require('./voicePrefix.controller');router[_0xd487('0x8')]('/',auth[_0xd487('0x9')](),controller['index']);router[_0xd487('0x8')](_0xd487('0xa'),auth[_0xd487('0x9')](),controller[_0xd487('0xb')]);router['get'](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0xd')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xd487('0xe')]);router[_0xd487('0x8')]('/:id/teams',auth[_0xd487('0x9')](),controller[_0xd487('0xf')]);router[_0xd487('0x10')]('/',auth[_0xd487('0x9')](),controller[_0xd487('0x11')]);router[_0xd487('0x10')](_0xd487('0x12'),auth[_0xd487('0x9')](),controller['addAgents']);router[_0xd487('0x10')](_0xd487('0x13'),auth[_0xd487('0x9')](),controller[_0xd487('0x14')]);router[_0xd487('0x15')](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0x16')]);router[_0xd487('0x17')](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0x18')]);router['delete'](_0xd487('0x12'),auth[_0xd487('0x9')](),controller[_0xd487('0x19')]);router[_0xd487('0x17')]('/:id/teams',auth[_0xd487('0x9')](),controller[_0xd487('0x1a')]);module[_0xd487('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index fb15386..2c4c926 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 _0x7fb7=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x4bc325,_0x42cd15){var _0x161c6c=function(_0x52ed6d){while(--_0x52ed6d){_0x4bc325['push'](_0x4bc325['shift']());}};_0x161c6c(++_0x42cd15);}(_0x7fb7,0x69));var _0x77fb=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x7fb7[_0x2b9e8a];return _0x520e67;};'use strict';var Sequelize=require(_0x77fb('0x0'));module[_0x77fb('0x1')]={'name':{'type':Sequelize[_0x77fb('0x2')],'allowNull':![],'unique':_0x77fb('0x3')},'prefix':{'type':Sequelize[_0x77fb('0x4')],'get':function(_0x1d6d47){return _0x77fb('0x5')+this[_0x77fb('0x6')](_0x77fb('0x3'))+'-';}},'description':{'type':Sequelize[_0x77fb('0x2')]},'callerIdAll':{'type':Sequelize[_0x77fb('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x77fb('0x7')]}}; \ No newline at end of file +var _0xd3cf=['INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue','name'];(function(_0x4688d3,_0x400ed5){var _0x572067=function(_0x4601f1){while(--_0x4601f1){_0x4688d3['push'](_0x4688d3['shift']());}};_0x572067(++_0x400ed5);}(_0xd3cf,0x149));var _0xfd3c=function(_0x245b4f,_0x181e27){_0x245b4f=_0x245b4f-0x0;var _0x257559=_0xd3cf[_0x245b4f];return _0x257559;};'use strict';var Sequelize=require(_0xfd3c('0x0'));module[_0xfd3c('0x1')]={'name':{'type':Sequelize[_0xfd3c('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xfd3c('0x3')],'get':function(_0x1770ca){return _0xfd3c('0x4')+this[_0xfd3c('0x5')](_0xfd3c('0x6'))+'-';}},'description':{'type':Sequelize[_0xfd3c('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xfd3c('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index be13009..37c1016 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 _0x282b=['find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','context','from-sip','exten','app','system','description','priority','appdata','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','nolimit','getTeams','Team','addTeams','Agents','flatMap','TeamVoicePrefix','upsert','each','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','status','offset','undefined','count','set','json','apply','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch'];(function(_0x24721a,_0x1ac53c){var _0x6a9880=function(_0x558dc8){while(--_0x558dc8){_0x24721a['push'](_0x24721a['shift']());}};_0x6a9880(++_0x1ac53c);}(_0x282b,0xec));var _0xb282=function(_0x4db3b5,_0x255671){_0x4db3b5=_0x4db3b5-0x0;var _0x1bcff8=_0x282b[_0x4db3b5];return _0x1bcff8;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb282('0x17')]=_[_0xb282('0x18')](config[_0xb282('0x17')],{'host':_0xb282('0x19'),'port':0x18eb});var socket=require(_0xb282('0x1a'))(new Redis(config['redis']));require(_0xb282('0x1b'))['register'](socket);function respondWithStatusCode(_0xe1d53,_0x211862){_0x211862=_0x211862||0xcc;return function(_0x4af892){if(_0x4af892){return _0xe1d53['sendStatus'](_0x211862);}return _0xe1d53['status'](_0x211862)[_0xb282('0x1c')]();};}function respondWithResult(_0x350676,_0x7c20df){_0x7c20df=_0x7c20df||0xc8;return function(_0xbb182){if(_0xbb182){return _0x350676[_0xb282('0x1d')](_0x7c20df)['json'](_0xbb182);}};}function respondWithFilteredResult(_0x191a31,_0x5519bf){return function(_0xca5f12){if(_0xca5f12){var _0x45b070=typeof _0x5519bf[_0xb282('0x1e')]==='undefined'&&typeof _0x5519bf['limit']===_0xb282('0x1f');var _0x2cdeb1=_0xca5f12['count'];var _0x89543a=_0x45b070?0x0:_0x5519bf[_0xb282('0x1e')];var _0x2e3928=_0x45b070?_0xca5f12[_0xb282('0x20')]:_0x5519bf[_0xb282('0x1e')]+_0x5519bf['limit'];var _0x1de407;if(_0x2e3928>=_0x2cdeb1){_0x2e3928=_0x2cdeb1;_0x1de407=0xc8;}else{_0x1de407=0xce;}_0x191a31[_0xb282('0x1d')](_0x1de407);return _0x191a31[_0xb282('0x21')]('Content-Range',_0x89543a+'-'+_0x2e3928+'/'+_0x2cdeb1)[_0xb282('0x22')](_0xca5f12);}return null;};}function patchUpdates(_0x2a7ef8){return function(_0x3c55ad){try{jsonpatch[_0xb282('0x23')](_0x3c55ad,_0x2a7ef8,!![]);}catch(_0x680095){return BPromise['reject'](_0x680095);}return _0x3c55ad['save']();};}function saveUpdates(_0x360f15,_0x3c7f1f){return function(_0x4934f0){if(_0x4934f0){return _0x4934f0['update'](_0x360f15)[_0xb282('0x24')](function(_0x114f77){return _0x114f77;});}return null;};}function removeEntity(_0x3451e5,_0x3c4018){return function(_0x211cc1){if(_0x211cc1){return _0x211cc1[_0xb282('0x25')]()['then'](function(){var _0xa0d7fb=_0x211cc1[_0xb282('0x26')]({'plain':!![]});var _0x50bd73=_0xb282('0x27');return db[_0xb282('0x28')][_0xb282('0x25')]({'where':{'type':_0x50bd73,'resourceId':_0xa0d7fb['id']}})[_0xb282('0x24')](function(){return _0x211cc1;});})['then'](function(){_0x3451e5[_0xb282('0x1d')](0xcc)[_0xb282('0x1c')]();});}};}function handleEntityNotFound(_0xe337b8,_0x433ad5){return function(_0x4cee93){if(!_0x4cee93){_0xe337b8[_0xb282('0x29')](0x194);}return _0x4cee93;};}function handleError(_0x22f657,_0x499e3d){_0x499e3d=_0x499e3d||0x1f4;return function(_0x1b15b5){logger[_0xb282('0x2a')](_0x1b15b5[_0xb282('0x2b')]);if(_0x1b15b5[_0xb282('0x2c')]){delete _0x1b15b5[_0xb282('0x2c')];}_0x22f657['status'](_0x499e3d)[_0xb282('0x2d')](_0x1b15b5);};}exports['index']=function(_0x4b7660,_0x1bf721){var _0x687829={},_0x5e0b7a={},_0x22fefc={'count':0x0,'rows':[]};var _0x548bca=_[_0xb282('0x2e')](db[_0xb282('0x2f')][_0xb282('0x30')],function(_0x41e0eb){return{'name':_0x41e0eb[_0xb282('0x31')],'type':_0x41e0eb[_0xb282('0x32')]['key']};});_0x5e0b7a[_0xb282('0x33')]=_[_0xb282('0x2e')](_0x548bca,'name');_0x5e0b7a['query']=_[_0xb282('0x34')](_0x4b7660[_0xb282('0x35')]);_0x5e0b7a[_0xb282('0x36')]=_['intersection'](_0x5e0b7a['model'],_0x5e0b7a['query']);_0x687829[_0xb282('0x37')]=_[_0xb282('0x38')](_0x5e0b7a[_0xb282('0x33')],qs[_0xb282('0x39')](_0x4b7660[_0xb282('0x35')][_0xb282('0x39')]));_0x687829[_0xb282('0x37')]=_0x687829['attributes'][_0xb282('0x3a')]?_0x687829['attributes']:_0x5e0b7a[_0xb282('0x33')];if(!_0x4b7660[_0xb282('0x35')][_0xb282('0x3b')]('nolimit')){_0x687829[_0xb282('0x3c')]=qs['limit'](_0x4b7660[_0xb282('0x35')][_0xb282('0x3c')]);_0x687829[_0xb282('0x1e')]=qs[_0xb282('0x1e')](_0x4b7660['query']['offset']);}_0x687829[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x4b7660[_0xb282('0x35')][_0xb282('0x3e')]);_0x687829['where']=qs[_0xb282('0x36')](_['pick'](_0x4b7660[_0xb282('0x35')],_0x5e0b7a[_0xb282('0x36')]),_0x548bca);if(_0x4b7660['query'][_0xb282('0x3f')]){_0x687829[_0xb282('0x40')]=_[_0xb282('0x41')](_0x687829[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0x548bca,function(_0x23c6b8){if(_0x23c6b8[_0xb282('0x32')]!==_0xb282('0x42')){var _0x44aed6={};_0x44aed6[_0x23c6b8[_0xb282('0x2c')]]={'$like':'%'+_0x4b7660[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x44aed6;}})});}_0x687829=_[_0xb282('0x41')]({},_0x687829,_0x4b7660[_0xb282('0x43')]);var _0x309441={'where':_0x687829[_0xb282('0x40')]};return db[_0xb282('0x2f')][_0xb282('0x20')](_0x309441)['then'](function(_0x310ad1){_0x22fefc['count']=_0x310ad1;if(_0x4b7660[_0xb282('0x35')][_0xb282('0x44')]){_0x687829[_0xb282('0x45')]=[{'all':!![]}];}return db[_0xb282('0x2f')][_0xb282('0x46')](_0x687829);})[_0xb282('0x24')](function(_0x5a6c0d){_0x22fefc['rows']=_0x5a6c0d;return _0x22fefc;})[_0xb282('0x24')](respondWithFilteredResult(_0x1bf721,_0x687829))['catch'](handleError(_0x1bf721,null));};exports[_0xb282('0x47')]=function(_0x273c3e,_0x4f9a98){var _0x229868={'raw':![],'where':{'id':_0x273c3e[_0xb282('0x48')]['id']}},_0x2d5ec7={};_0x2d5ec7['model']=_['keys'](db[_0xb282('0x2f')]['rawAttributes']);_0x2d5ec7[_0xb282('0x35')]=_[_0xb282('0x34')](_0x273c3e[_0xb282('0x35')]);_0x2d5ec7[_0xb282('0x36')]=_[_0xb282('0x38')](_0x2d5ec7[_0xb282('0x33')],_0x2d5ec7['query']);_0x229868[_0xb282('0x37')]=_[_0xb282('0x38')](_0x2d5ec7[_0xb282('0x33')],qs['fields'](_0x273c3e[_0xb282('0x35')]['fields']));_0x229868[_0xb282('0x37')]=_0x229868['attributes'][_0xb282('0x3a')]?_0x229868['attributes']:_0x2d5ec7['model'];if(_0x273c3e['query'][_0xb282('0x44')]){_0x229868[_0xb282('0x45')]=[{'all':!![]}];}_0x229868=_[_0xb282('0x41')]({},_0x229868,_0x273c3e[_0xb282('0x43')]);return db['VoicePrefix']['find'](_0x229868)['then'](handleEntityNotFound(_0x4f9a98,null))[_0xb282('0x24')](respondWithResult(_0x4f9a98,null))[_0xb282('0x49')](handleError(_0x4f9a98,null));};exports[_0xb282('0x25')]=function(_0x1ab323,_0x4e5b3d){return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x1ab323['params']['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x4e5b3d,null))[_0xb282('0x24')](removeEntity(_0x4e5b3d,null))[_0xb282('0x49')](handleError(_0x4e5b3d,null));};exports[_0xb282('0x4b')]=function(_0x1d356e,_0x5522be){return db[_0xb282('0x2f')][_0xb282('0x4b')]()[_0xb282('0x24')](respondWithResult(_0x5522be,null))[_0xb282('0x49')](handleError(_0x5522be,null));};exports[_0xb282('0x4c')]=function(_0x112d4d,_0x4cde65){var _0x87d777;return db['sequelize'][_0xb282('0x4d')](function(_0x1e6ade){return db['VoicePrefix'][_0xb282('0x4c')](_0x112d4d[_0xb282('0x4e')],{'transaction':_0x1e6ade})[_0xb282('0x24')](function(_0x49fc44){_0x87d777=_0x49fc44['get']({'plain':!![]});return db[_0xb282('0x4f')][_0xb282('0x4a')]({'where':{'id':_0x87d777[_0xb282('0x50')]},'raw':!![]})['then'](function(_0x2d3839){return createVoicePrefixExtensions(_0x87d777,_0x2d3839,_0x1e6ade);});});})['then'](function(){var _0x46db52=_0x112d4d[_0xb282('0x51')]['get']({'plain':!![]});if(!_0x46db52)throw new Error(_0xb282('0x52'));if(_0x46db52['role']===_0xb282('0x51')){var _0x34b31a=_0x87d777;return db[_0xb282('0x53')][_0xb282('0x4a')]({'where':{'name':_0xb282('0x27'),'userProfileId':_0x46db52[_0xb282('0x54')]},'raw':!![]})['then'](function(_0x46cef8){if(_0x46cef8&&_0x46cef8['autoAssociation']===0x0){return db[_0xb282('0x28')][_0xb282('0x4c')]({'name':_0x34b31a['name'],'resourceId':_0x34b31a['id'],'type':_0x46cef8['name'],'sectionId':_0x46cef8['id']},{})[_0xb282('0x24')](function(){return _0x87d777;});}else{return _0x87d777;}})[_0xb282('0x49')](function(_0x14b501){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14b501);throw _0x14b501;});}return _0x87d777;})[_0xb282('0x24')](respondWithResult(_0x4cde65,null))[_0xb282('0x49')](handleError(_0x4cde65,null));};function Extension(_0x3716b0,_0x5d6a78,_0x3a1414,_0x5d5318){this[_0xb282('0x55')]=_0xb282('0x56');this[_0xb282('0x57')]=_0x3716b0;this[_0xb282('0x58')]=_0x3a1414;this[_0xb282('0x32')]=_0xb282('0x59');this[_0xb282('0x5a')]='Voice\x20Prefix\x20Extension';this[_0xb282('0x5b')]=_0x5d6a78;this[_0xb282('0x5c')]=_0x5d5318;}function createVoicePrefixExtensions(_0x3ed2cc,_0x58116b,_0x545ca7){return new BPromise(function(_0x37d1a8,_0x137154){var _0x1d2d00=new Extension(formatPrefixName(_0x3ed2cc['prefix']),0x1,'NoOp',_0xb282('0x5d'));_0x1d2d00[_0xb282('0x5e')]=_0x3ed2cc['id'];return db['VoiceExtension'][_0xb282('0x4c')](_0x1d2d00,{'transaction':_0x545ca7})[_0xb282('0x24')](function(_0x15c7b7){var _0x5bbc70=_0x15c7b7[_0xb282('0x26')]({'plain':!![]});var _0x2fb4e4=_['map'](addVoicePrefixExtensions(_0x3ed2cc,_0x58116b),function(_0x214052){_0x214052[_0xb282('0x50')]=_0x5bbc70['id'];_0x214052[_0xb282('0x5e')]=_0x3ed2cc['id'];return _0x214052;});return db[_0xb282('0x4f')]['bulkCreate'](_0x2fb4e4,{'transaction':_0x545ca7})['then'](function(_0xfdf710){if(!_0xfdf710){return _0x137154(_0xb282('0x5f'));}else{return _0x37d1a8(_0xfdf710);}})['catch'](function(_0x3cdcf5){return _0x137154(_0x3cdcf5);});});;});};function addVoicePrefixExtensions(_0x1b0e1f,_0x10b6c4){var _0x364b77=[];var _0x568e6d=formatPrefixName(_0x1b0e1f[_0xb282('0x60')]);_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x2,_0xb282('0x62'),'CDR(prefix)='+_0x1b0e1f[_0xb282('0x2c')]));if(_0x1b0e1f[_0xb282('0x63')]){_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x3,'Set',_0xb282('0x64')+_0x1b0e1f[_0xb282('0x63')]));}else{_0x364b77['push'](new Extension(_0x568e6d,0x3,'NoOp',_0xb282('0x65')));}_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x4,_0xb282('0x66'),_0x10b6c4[_0xb282('0x55')]+','+_0xb282('0x67')+(0x8+_0x1b0e1f[_0xb282('0x2c')][_0xb282('0x3a')])+'}'+','+0x1));return _0x364b77;}function formatPrefixName(_0xbb4060){var _0x1d8e6a='_';for(var _0x1805f6=0x0;_0x1805f6<_0xbb4060[_0xb282('0x3a')];_0x1805f6++){if(_0xbb4060[_0xb282('0x68')](_0x1805f6)=='-'){_0x1d8e6a+=_0xbb4060[_0xb282('0x68')](_0x1805f6);}else{_0x1d8e6a+='['+_0xbb4060[_0xb282('0x68')](_0x1805f6)+']';}}_0x1d8e6a+='.';return _0x1d8e6a;}exports[_0xb282('0x69')]=function(_0x3a87ce,_0x4ccef5,_0x2cffa2){var _0x2c7986=_0x3a87ce[_0xb282('0x4e')];_0x2c7986[_0xb282('0x60')]=_0xb282('0x6a')+_0x2c7986[_0xb282('0x2c')]+'-';return db[_0xb282('0x6b')][_0xb282('0x4d')](function(_0x2203e7){return db[_0xb282('0x2f')][_0xb282('0x69')](_0x2c7986,{'where':{'id':_0x2c7986['id']},'transaction':_0x2203e7})['then'](function(){return db[_0xb282('0x4f')][_0xb282('0x25')]({'where':{'VoicePrefixId':_0x2c7986['id']},'transaction':_0x2203e7})[_0xb282('0x24')](function(){return db[_0xb282('0x4f')][_0xb282('0x4a')]({'where':{'id':_0x2c7986['VoiceExtensionId']},'raw':!![]})['then'](function(_0x37432b){return createVoicePrefixExtensions(_0x2c7986,_0x37432b,_0x2203e7);});});});})[_0xb282('0x24')](function(){return db[_0xb282('0x2f')][_0xb282('0x6c')](_0x2c7986['id']);})[_0xb282('0x24')](respondWithResult(_0x4ccef5,null))[_0xb282('0x49')](handleError(_0x4ccef5,null));};exports[_0xb282('0x6d')]=function(_0x4df661,_0x4feef4,_0x1ae253){return db[_0xb282('0x2f')]['find']({'where':{'id':_0x4df661['params']['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x4feef4,null))[_0xb282('0x24')](function(_0x2ff720){if(_0x2ff720){return _0x2ff720[_0xb282('0x6d')](_0x4df661[_0xb282('0x4e')][_0xb282('0x6e')],_[_0xb282('0x6f')](_0x4df661['body'],[_0xb282('0x6e'),'id'])||{})[_0xb282('0x70')](function(_0x2d7518){for(var _0xc9f89a=0x0;_0xc9f89a<_0x4df661[_0xb282('0x4e')][_0xb282('0x6e')][_0xb282('0x3a')];_0xc9f89a+=0x1){socket[_0xb282('0x71')](_0xb282('0x72'),{'UserId':Number(_0x4df661[_0xb282('0x4e')]['ids'][_0xc9f89a]),'VoicePrefixId':Number(_0x4df661[_0xb282('0x48')]['id'])});}return _0x2d7518;});}})[_0xb282('0x24')](respondWithResult(_0x4feef4,null))[_0xb282('0x49')](handleError(_0x4feef4,null));};exports[_0xb282('0x73')]=function(_0xc5ed41,_0xb1394f,_0xa0f193){return db[_0xb282('0x2f')]['find']({'where':{'id':_0xc5ed41[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0xb1394f,null))[_0xb282('0x24')](function(_0x313018){if(_0x313018){return _0x313018[_0xb282('0x73')](_0xc5ed41[_0xb282('0x35')]['ids'])[_0xb282('0x24')](function(){if(_[_0xb282('0x74')](_0xc5ed41[_0xb282('0x35')]['ids'])){for(var _0xbe0ab4=0x0;_0xbe0ab4<_0xc5ed41[_0xb282('0x35')]['ids'][_0xb282('0x3a')];_0xbe0ab4+=0x1){socket[_0xb282('0x71')](_0xb282('0x75'),{'UserId':Number(_0xc5ed41[_0xb282('0x35')][_0xb282('0x6e')][_0xbe0ab4]),'VoicePrefixId':Number(_0xc5ed41[_0xb282('0x48')]['id'])});}}else{socket[_0xb282('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0xc5ed41['query'][_0xb282('0x6e')]),'VoicePrefixId':Number(_0xc5ed41['params']['id'])});}});}})[_0xb282('0x24')](respondWithStatusCode(_0xb1394f,null))[_0xb282('0x49')](handleError(_0xb1394f,null));};exports[_0xb282('0x76')]=function(_0x47331b,_0x178c0d,_0x58f088){var _0xa1f33c={};var _0x1fb9c2={};var _0x23151f;var _0x5d7eb3;return db[_0xb282('0x2f')][_0xb282('0x77')]({'where':{'id':_0x47331b[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x178c0d,null))[_0xb282('0x24')](function(_0x29110d){if(_0x29110d){_0x23151f=_0x29110d;_0x1fb9c2['model']=_[_0xb282('0x34')](db[_0xb282('0x78')][_0xb282('0x30')]);_0x1fb9c2[_0xb282('0x35')]=_['keys'](_0x47331b[_0xb282('0x35')]);_0x1fb9c2[_0xb282('0x36')]=_[_0xb282('0x38')](_0x1fb9c2[_0xb282('0x33')],_0x1fb9c2[_0xb282('0x35')]);_0xa1f33c[_0xb282('0x37')]=_[_0xb282('0x38')](_0x1fb9c2[_0xb282('0x33')],qs[_0xb282('0x39')](_0x47331b[_0xb282('0x35')][_0xb282('0x39')]));_0xa1f33c['attributes']=_0xa1f33c[_0xb282('0x37')][_0xb282('0x3a')]?_0xa1f33c['attributes']:_0x1fb9c2[_0xb282('0x33')];_0xa1f33c[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x47331b[_0xb282('0x35')][_0xb282('0x3e')]);_0xa1f33c[_0xb282('0x40')]=qs[_0xb282('0x36')](_[_0xb282('0x79')](_0x47331b[_0xb282('0x35')],_0x1fb9c2[_0xb282('0x36')]));if(_0x47331b['query'][_0xb282('0x3f')]){_0xa1f33c[_0xb282('0x40')]=_[_0xb282('0x41')](_0xa1f33c[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0xa1f33c[_0xb282('0x37')],function(_0x3b703d){var _0x442c4d={};_0x442c4d[_0x3b703d]={'$like':'%'+_0x47331b[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x442c4d;})});}_0xa1f33c=_[_0xb282('0x41')]({},_0xa1f33c,_0x47331b['options']);return _0x23151f['getAgents'](_0xa1f33c);}})[_0xb282('0x24')](function(_0x317cd7){if(_0x317cd7){_0x5d7eb3=_0x317cd7[_0xb282('0x3a')];if(!_0x47331b[_0xb282('0x35')][_0xb282('0x3b')](_0xb282('0x7a'))){_0xa1f33c[_0xb282('0x3c')]=qs[_0xb282('0x3c')](_0x47331b[_0xb282('0x35')][_0xb282('0x3c')]);_0xa1f33c[_0xb282('0x1e')]=qs['offset'](_0x47331b['query']['offset']);}return _0x23151f['getAgents'](_0xa1f33c);}})[_0xb282('0x24')](function(_0x213131){if(_0x213131){return _0x213131?{'count':_0x5d7eb3,'rows':_0x213131}:null;}})[_0xb282('0x24')](respondWithResult(_0x178c0d,null))['catch'](handleError(_0x178c0d,null));};exports[_0xb282('0x7b')]=function(_0x358073,_0x69b0fd,_0x43068c){var _0x522c5b={};var _0x3e391b={};var _0x112c88;var _0x1c95c2;return db[_0xb282('0x2f')][_0xb282('0x77')]({'where':{'id':_0x358073[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x69b0fd,null))[_0xb282('0x24')](function(_0x4116dd){if(_0x4116dd){_0x112c88=_0x4116dd;_0x3e391b[_0xb282('0x33')]=_[_0xb282('0x34')](db[_0xb282('0x7c')][_0xb282('0x30')]);_0x3e391b[_0xb282('0x35')]=_[_0xb282('0x34')](_0x358073[_0xb282('0x35')]);_0x3e391b[_0xb282('0x36')]=_[_0xb282('0x38')](_0x3e391b[_0xb282('0x33')],_0x3e391b[_0xb282('0x35')]);_0x522c5b[_0xb282('0x37')]=_[_0xb282('0x38')](_0x3e391b['model'],qs[_0xb282('0x39')](_0x358073['query']['fields']));_0x522c5b['attributes']=_0x522c5b[_0xb282('0x37')][_0xb282('0x3a')]?_0x522c5b[_0xb282('0x37')]:_0x3e391b[_0xb282('0x33')];_0x522c5b[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x358073['query'][_0xb282('0x3e')]);_0x522c5b[_0xb282('0x40')]=qs[_0xb282('0x36')](_['pick'](_0x358073['query'],_0x3e391b[_0xb282('0x36')]));if(_0x358073[_0xb282('0x35')][_0xb282('0x3f')]){_0x522c5b[_0xb282('0x40')]=_['merge'](_0x522c5b[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0x522c5b[_0xb282('0x37')],function(_0x1070cc){var _0x38c052={};_0x38c052[_0x1070cc]={'$like':'%'+_0x358073[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x38c052;})});}_0x522c5b=_[_0xb282('0x41')]({},_0x522c5b,_0x358073[_0xb282('0x43')]);return _0x112c88[_0xb282('0x7b')](_0x522c5b);}})[_0xb282('0x24')](function(_0x167c68){if(_0x167c68){_0x1c95c2=_0x167c68[_0xb282('0x3a')];if(!_0x358073[_0xb282('0x35')][_0xb282('0x3b')](_0xb282('0x7a'))){_0x522c5b[_0xb282('0x3c')]=qs[_0xb282('0x3c')](_0x358073[_0xb282('0x35')]['limit']);_0x522c5b[_0xb282('0x1e')]=qs[_0xb282('0x1e')](_0x358073['query']['offset']);}return _0x112c88[_0xb282('0x7b')](_0x522c5b);}})[_0xb282('0x24')](function(_0x5172cd){if(_0x5172cd){return _0x5172cd?{'count':_0x1c95c2,'rows':_0x5172cd}:null;}})['then'](respondWithResult(_0x69b0fd,null))[_0xb282('0x49')](handleError(_0x69b0fd,null));};exports[_0xb282('0x7d')]=function(_0x1419f6,_0x408c76,_0x4ea491){var _0x44b80c=_0x1419f6[_0xb282('0x4e')][_0xb282('0x6e')];var _0x3e2abb;return db[_0xb282('0x7c')]['findAll']({'where':{'id':_0x44b80c},'attributes':['id'],'include':[{'model':db[_0xb282('0x78')],'as':_0xb282('0x7e'),'attributes':['id',_0xb282('0x2c'),'online','voicePause','interface'],'raw':!![]}]})[_0xb282('0x24')](function(_0x459239){if(_0x459239){_0x3e2abb=_0x459239;var _0x32976b=_[_0xb282('0x7f')](_0x459239,function(_0x147637){var _0x4dbee6=_0x147637['get']({'plain':!![]});return _0x4dbee6[_0xb282('0x7e')];});return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x1419f6[_0xb282('0x48')]['id']}})['then'](function(_0x3b22a2){return db[_0xb282('0x6b')][_0xb282('0x4d')](function(_0x449d3d){return _0x3b22a2[_0xb282('0x7d')](_0x44b80c,{'transaction':_0x449d3d})['then'](function(){return BPromise['each'](_0x3e2abb,function(_0x13860e){return db[_0xb282('0x80')][_0xb282('0x81')]({'TeamId':_0x13860e['id'],'VoicePrefixId':_0x1419f6[_0xb282('0x48')]['id']},{'transaction':_0x449d3d});});})[_0xb282('0x24')](function(){return BPromise[_0xb282('0x82')](_0x32976b,function(_0x139c9b){return db[_0xb282('0x83')][_0xb282('0x84')]({'where':{'UserId':_0x139c9b['id'],'VoicePrefixId':_0x1419f6[_0xb282('0x48')]['id']},'transaction':_0x449d3d});});})[_0xb282('0x24')](function(){_0x32976b['forEach'](function(_0x5a3f34){socket[_0xb282('0x71')](_0xb282('0x72'),{'UserId':_0x5a3f34['id'],'VoicePrefixId':_0x3b22a2['id']});});});});});}})[_0xb282('0x24')](respondWithStatusCode(_0x408c76,null))[_0xb282('0x49')](handleError(_0x408c76,null));};exports[_0xb282('0x85')]=function(_0x45980d,_0xfaf15c,_0x287895){return db[_0xb282('0x7c')]['findAll']({'where':{'id':_0x45980d[_0xb282('0x35')][_0xb282('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xb282('0x78')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb282('0x24')](handleEntityNotFound(_0xfaf15c,null))[_0xb282('0x24')](function(_0x5d1f5f){var _0x47cbdf=_[_0xb282('0x2e')](_0x5d1f5f,'id');var _0x4ca7d3=[];var _0x1de459=[];var _0x3f75b4=squel[_0xb282('0x86')]();_0x3f75b4[_0xb282('0x87')](_0xb282('0x88'))[_0xb282('0x89')]('team_has_voice_prefixes','tq')[_0xb282('0x8a')](_0xb282('0x8b'),'ut',_0xb282('0x8c'))[_0xb282('0x40')](_0xb282('0x8d'),_0x45980d[_0xb282('0x48')]['id']);for(var _0x202925=0x0;_0x202925<_0x5d1f5f['length'];_0x202925+=0x1){let _0x14fb81=_0x5d1f5f[_0x202925];for(var _0x3f8919=0x0;_0x3f8919<_0x14fb81[_0xb282('0x7e')][_0xb282('0x3a')];_0x3f8919+=0x1){let _0x59add4=_0x14fb81[_0xb282('0x7e')][_0x3f8919];var _0x1a017a=_0x3f75b4[_0xb282('0x8e')]();_0x1a017a['where'](_0xb282('0x8f'),_0x59add4['id']);_0x1de459[_0xb282('0x61')](db[_0xb282('0x6b')][_0xb282('0x35')](_0x1a017a[_0xb282('0x90')](),{'type':db[_0xb282('0x6b')][_0xb282('0x91')][_0xb282('0x92')]})['then'](function(_0x57514b){if(_0x57514b[_0xb282('0x3a')]===0x1){return _0x59add4['id'];}else{var _0x25c4b4=_[_0xb282('0x93')](_[_0xb282('0x2e')](_0x57514b,_0xb282('0x94')),function(_0x1b33ba){return _['includes'](_0x47cbdf,_0x1b33ba);});if(_0x25c4b4){return _0x59add4['id'];}}}));}}return BPromise[_0xb282('0x95')](_0x1de459)[_0xb282('0x24')](function(_0x23ce2d){_0x4ca7d3=_(_0x4ca7d3)[_0xb282('0x96')](_0x23ce2d)[_0xb282('0x97')]()[_0xb282('0x98')]();return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x45980d[_0xb282('0x48')]['id']}})[_0xb282('0x24')](function(_0x120cb4){return db['sequelize']['transaction'](function(_0x580acc){return _0x120cb4[_0xb282('0x85')](_0x45980d[_0xb282('0x35')][_0xb282('0x6e')],{'transaction':_0x580acc})[_0xb282('0x24')](function(){if(!_[_0xb282('0x99')](_0x4ca7d3)){return _0x120cb4[_0xb282('0x73')](_0x4ca7d3,{'transaction':_0x580acc});}})[_0xb282('0x24')](function(){_0x4ca7d3[_0xb282('0x9a')](function(_0x28f31e){socket[_0xb282('0x71')]('userVoicePrefix:remove',{'UserId':_0x28f31e,'VoicePrefixId':_0x120cb4['id']});});});});});});})[_0xb282('0x24')](respondWithStatusCode(_0xfaf15c,null))[_0xb282('0x49')](handleError(_0xfaf15c,null));}; \ No newline at end of file +var _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x3266,0x6a));var _0x6326=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x3266[_0x270adf];return _0x29eda9;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 32eb190..2698817 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 _0x499d=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4239f7,_0x1c66a4){var _0x4d1724=function(_0xc05da7){while(--_0xc05da7){_0x4239f7['push'](_0x4239f7['shift']());}};_0x4d1724(++_0x1c66a4);}(_0x499d,0x114));var _0xd499=function(_0x170a8e,_0xe3af05){_0x170a8e=_0x170a8e-0x0;var _0x3f88a5=_0x499d[_0x170a8e];return _0x3f88a5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xd499('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd499('0x1')](0x0);var events={'afterCreate':_0xd499('0x2'),'afterUpdate':'update','afterDestroy':_0xd499('0x3')};function emitEvent(_0x1a066b){return function(_0xb84998,_0x479de1,_0x49805a){VoicePrefixEvents[_0xd499('0x4')](_0x1a066b+':'+_0xb84998['id'],_0xb84998);VoicePrefixEvents[_0xd499('0x4')](_0x1a066b,_0xb84998);_0x49805a(null);};}for(var e in events){if(events[_0xd499('0x5')](e)){var event=events[e];VoicePrefix[_0xd499('0x6')](e,emitEvent(event));}}module[_0xd499('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xe497=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xe497,0x17b));var _0x7e49=function(_0x4ddfc0,_0x2447b5){_0x4ddfc0=_0x4ddfc0-0x0;var _0x1ff2de=_0xe497[_0x4ddfc0];return _0x1ff2de;};'use strict';var EventEmitter=require(_0x7e49('0x0'));var VoicePrefix=require(_0x7e49('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7e49('0x2')](0x0);var events={'afterCreate':_0x7e49('0x3'),'afterUpdate':_0x7e49('0x4'),'afterDestroy':_0x7e49('0x5')};function emitEvent(_0x218541){return function(_0x29074c,_0x215984,_0xcfc4db){VoicePrefixEvents['emit'](_0x218541+':'+_0x29074c['id'],_0x29074c);VoicePrefixEvents[_0x7e49('0x6')](_0x218541,_0x29074c);_0xcfc4db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7e49('0x7')](e,emitEvent(event));}}module[_0x7e49('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 d965d91..ccd02a6 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 _0xba07=['path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5da8e9,_0x3beb32){var _0x24a605=function(_0x284ab3){while(--_0x284ab3){_0x5da8e9['push'](_0x5da8e9['shift']());}};_0x24a605(++_0x3beb32);}(_0xba07,0xed));var _0x7ba0=function(_0x4528d3,_0x1388a4){_0x4528d3=_0x4528d3-0x0;var _0x126840=_0xba07[_0x4528d3];return _0x126840;};'use strict';var _=require(_0x7ba0('0x0'));var util=require('util');var logger=require(_0x7ba0('0x1'))(_0x7ba0('0x2'));var moment=require(_0x7ba0('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ba0('0x4'));var fs=require('fs');var path=require(_0x7ba0('0x5'));var rimraf=require(_0x7ba0('0x6'));var config=require(_0x7ba0('0x7'));var attributes=require(_0x7ba0('0x8'));module['exports']=function(_0x2f3e9c,_0x3e0a7d){return _0x2f3e9c[_0x7ba0('0x9')]('VoicePrefix',attributes,{'tableName':_0x7ba0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f4=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x59f4,0x99));var _0x459f=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x59f4[_0x290fa6];return _0x47f1f3;};'use strict';var _=require(_0x459f('0x0'));var util=require(_0x459f('0x1'));var logger=require(_0x459f('0x2'))(_0x459f('0x3'));var moment=require(_0x459f('0x4'));var BPromise=require(_0x459f('0x5'));var rp=require(_0x459f('0x6'));var fs=require('fs');var path=require(_0x459f('0x7'));var rimraf=require(_0x459f('0x8'));var config=require(_0x459f('0x9'));var attributes=require(_0x459f('0xa'));module[_0x459f('0xb')]=function(_0xb4795f,_0x18dd77){return _0xb4795f[_0x459f('0xc')](_0x459f('0xd'),attributes,{'tableName':_0x459f('0xe'),'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 0eb5daa..364734d 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 _0x13c5=['request\x20sent','result','lodash','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message'];(function(_0x1473f6,_0x3cecae){var _0x4d90b0=function(_0x5e6d01){while(--_0x5e6d01){_0x1473f6['push'](_0x1473f6['shift']());}};_0x4d90b0(++_0x3cecae);}(_0x13c5,0x7a));var _0x513c=function(_0x17bbce,_0x982528){_0x17bbce=_0x17bbce-0x0;var _0x58dfd3=_0x13c5[_0x17bbce];return _0x58dfd3;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');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(_0x513c('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x513c('0x2'));var jayson=require(_0x513c('0x3'));var client=jayson[_0x513c('0x4')][_0x513c('0x5')]({'port':0x232a});config['redis']=_['defaults'](config[_0x513c('0x6')],{'host':_0x513c('0x7'),'port':0x18eb});var socket=require(_0x513c('0x8'))(new Redis(config[_0x513c('0x6')]));require(_0x513c('0x9'))[_0x513c('0xa')](socket);function respondWithRpcPromise(_0x222c25,_0x18471d,_0x4adc04){return new BPromise(function(_0xd70448,_0x224eb2){return client['request'](_0x222c25,_0x4adc04)['then'](function(_0x798eed){logger[_0x513c('0xb')]('VoicePrefix,\x20%s,\x20%s',_0x18471d,'request\x20sent');logger['debug'](_0x513c('0xc'),_0x18471d,'request\x20sent',JSON[_0x513c('0xd')](_0x798eed));if(_0x798eed[_0x513c('0xe')]){if(_0x798eed['error'][_0x513c('0xf')]===0x1f4){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0x224eb2(_0x798eed['error'][_0x513c('0x11')]);}logger['error'](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0xd70448(_0x798eed[_0x513c('0xe')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x18471d,_0x513c('0x12'));_0xd70448(_0x798eed[_0x513c('0x13')]['message']);}})['catch'](function(_0x217e7a){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x217e7a);_0x224eb2(_0x217e7a);});});} \ No newline at end of file +var _0x3cb7=['http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x472ded,_0x7b9b67){var _0x4cdf81=function(_0xb56ef){while(--_0xb56ef){_0x472ded['push'](_0x472ded['shift']());}};_0x4cdf81(++_0x7b9b67);}(_0x3cb7,0xcf));var _0x73cb=function(_0x4eb3ec,_0x51b871){_0x4eb3ec=_0x4eb3ec-0x0;var _0x1a3de8=_0x3cb7[_0x4eb3ec];return _0x1a3de8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 33de24e..0c5b938 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 _0x7382=['save','register','voicePrefix:'];(function(_0x10633a,_0x404fe8){var _0x475357=function(_0x582f6d){while(--_0x582f6d){_0x10633a['push'](_0x10633a['shift']());}};_0x475357(++_0x404fe8);}(_0x7382,0x1f2));var _0x2738=function(_0x432c35,_0x598c24){_0x432c35=_0x432c35-0x0;var _0x1ddee3=_0x7382[_0x432c35];return _0x1ddee3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2738('0x0'),'remove','update'];function createListener(_0x190aa6,_0x480143){return function(_0x250b3c){_0x480143['emit'](_0x190aa6,_0x250b3c);};}function removeListener(_0x402f25,_0x25ad1b){return function(){VoicePrefixEvents['removeListener'](_0x402f25,_0x25ad1b);};}exports[_0x2738('0x1')]=function(_0x267a1a){for(var _0x457c61=0x0,_0x1437b0=events['length'];_0x457c61<_0x1437b0;_0x457c61++){var _0x99e22e=events[_0x457c61];var _0x20a64f=createListener(_0x2738('0x2')+_0x99e22e,_0x267a1a);VoicePrefixEvents['on'](_0x99e22e,_0x20a64f);}}; \ No newline at end of file +var _0x4198=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x182095,_0x39aa0c){var _0x579570=function(_0x1e0205){while(--_0x1e0205){_0x182095['push'](_0x182095['shift']());}};_0x579570(++_0x39aa0c);}(_0x4198,0x69));var _0x8419=function(_0xde8c8a,_0x4234c8){_0xde8c8a=_0xde8c8a-0x0;var _0xfa2dde=_0x4198[_0xde8c8a];return _0xfa2dde;};'use strict';var VoicePrefixEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){VoicePrefixEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);VoicePrefixEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3355d03..7bdf265 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x3aaf78,_0x27aa1f){_0x3aaf78=_0x3aaf78-0x0;var _0x1c97b7=_0xb10b[_0x3aaf78];return _0x1c97b7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xf8195c,_0x35c404){var _0x259b88=function(_0x432c20){while(--_0x432c20){_0xf8195c['push'](_0xf8195c['shift']());}};_0x259b88(++_0x35c404);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 dc45567..ce875d5 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 _0xa853=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','inbound','STRING','default','ringall','leastrecent','fewestcalls','linear','strategy','rrmemory','getDataValue','type','dialMethod','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','split','setDataValue','join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xa853,0x170));var _0x3a85=function(_0xf0ac5c,_0x348414){_0xf0ac5c=_0xf0ac5c-0x0;var _0x47a110=_0xa853[_0xf0ac5c];return _0x47a110;};'use strict';var Sequelize=require('sequelize');module[_0x3a85('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3a85('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x3a85('0x3')},'musiconhold':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':_0x3a85('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3a85('0x2')]('rr',_0x3a85('0x6'),_0x3a85('0x7'),_0x3a85('0x8'),'random','rrmemory',_0x3a85('0x9'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x3a85('0x6'),'set':function(_0x3c10ca){this['setDataValue'](_0x3a85('0xa'),_0x3c10ca?_0x3c10ca:_0x3a85('0xb'));},'get':function(){var _0x4badfe=this[_0x3a85('0xc')](_0x3a85('0xd'));var _0x4ae7ea=this[_0x3a85('0xc')](_0x3a85('0xe'));var _0x10aecd=this[_0x3a85('0xc')](_0x3a85('0xa'));if(_0x4badfe==='inbound'){return _0x10aecd;}if(_0x4ae7ea==='booked'&&_0x10aecd===_0x3a85('0xb')||_0x4ae7ea==='booked'&&_0x10aecd===_0x3a85('0xf')){return _0x10aecd;}if(_0x4ae7ea===_0x3a85('0x10')||_0x4ae7ea===_0x3a85('0x11')||_0x4ae7ea===_0x3a85('0x12')){return _0x10aecd;}return null;}},'servicelevel':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3a85('0x4')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':_0x3a85('0x14')},'autopause':{'type':Sequelize[_0x3a85('0x2')]('yes','no',_0x3a85('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3a85('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x3a85('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3a85('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3a85('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':_0x3a85('0x14')},'announce_holdtime':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3a85('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x3a85('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3a85('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3a85('0x4')]},'queue_youarenext':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3a85('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3a85('0x4')]},'queue_quantity1':{'type':Sequelize[_0x3a85('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x3a85('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x3a85('0x16')],'set':function(_0x1af78f){this['setDataValue']('periodic_announce',_0x1af78f?_0x1af78f['join'](','):[]);},'get':function(){return this[_0x3a85('0xc')](_0x3a85('0x17'))?this[_0x3a85('0xc')](_0x3a85('0x17'))[_0x3a85('0x18')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x16ec67){this[_0x3a85('0x19')]('joinempty',_0x16ec67?_0x16ec67[_0x3a85('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x3a85('0xc')](_0x3a85('0x1b'))[_0x3a85('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':'no','set':function(_0x6522f5){this['setDataValue']('leavewhenempty',_0x6522f5?_0x6522f5[_0x3a85('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0x3a85('0x1c'))?this[_0x3a85('0xc')](_0x3a85('0x1c'))[_0x3a85('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3a85('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3a85('0x4')]},'description':{'type':Sequelize[_0x3a85('0x4')]},'acw':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':0x0,'set':function(_0x54faf3){this[_0x3a85('0x19')](_0x3a85('0x1e'),_0x54faf3);if(_0x54faf3){if(this[_0x3a85('0xc')](_0x3a85('0x1f'))<0x2){this[_0x3a85('0x19')](_0x3a85('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':0x0,'comment':_0x3a85('0x20')},'dialMethod':{'type':Sequelize[_0x3a85('0x2')]('preview',_0x3a85('0x10'),_0x3a85('0x12'),_0x3a85('0x11'),'booked'),'defaultValue':'progressive','comment':_0x3a85('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3a85('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3a85('0x23')},'dialLimitQueue':{'type':Sequelize[_0x3a85('0x13')](0x4)[_0x3a85('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x3a85('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3a85('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor','dropRate'),'defaultValue':_0x3a85('0x26'),'comment':_0x3a85('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3a85('0x24')](0x2)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3a85('0x28')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x3a85('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3a85('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3a85('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x29')},'dialQueueOptions':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x3a85('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x2a')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)[_0x3a85('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a85('0x2b')},'dialBusyMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x2c')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a85('0x2d')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'comment':_0x3a85('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3a85('0x2f')},'dialTimezone':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':_0x3a85('0x30')},'dialPrefix':{'type':Sequelize[_0x3a85('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3a85('0x2')](_0x3a85('0x31'),_0x3a85('0x32'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3a85('0x13')](0x9)[_0x3a85('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3a85('0x33')},'dialAMDGreeting':{'type':Sequelize[_0x3a85('0x13')](0x9)[_0x3a85('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3a85('0x34')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3a85('0x13')](0x9)[_0x3a85('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3a85('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x3a85('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a85('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0x3a85('0x13')](0x9)[_0x3a85('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3a85('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3a85('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3a85('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3a85('0x13')](0x9)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3a85('0x13')](0x5)[_0x3a85('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3a85('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a85('0x39')},'dialRecallMeTimeout':{'type':Sequelize[_0x3a85('0x13')](0x5)[_0x3a85('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3a85('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3a85('0x2')]('DESC',_0x3a85('0x3b')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x3a85('0x4')],'comment':_0x3a85('0x3c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a85('0x3d')},'dialCutDigit':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a85('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)[_0x3a85('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)[_0x3a85('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x3f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3a85('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a85('0x40')},'dialMachineMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x41')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a85('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a85('0x42')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a85('0x43')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a85('0x44')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33896c){if(!_0x33896c)this[_0x3a85('0x19')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x33896c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x3a85('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3a85('0x13')](0x3)[_0x3a85('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3a85('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x171d=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','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.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','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\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','ENUM','inbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty'];(function(_0x1e4166,_0x1abeec){var _0x22fef1=function(_0x3c587b){while(--_0x3c587b){_0x1e4166['push'](_0x1e4166['shift']());}};_0x22fef1(++_0x1abeec);}(_0x171d,0x1cc));var _0xd171=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x171d[_0x58efa6];return _0x5d643c;};'use strict';var Sequelize=require(_0xd171('0x0'));module[_0xd171('0x1')]={'name':{'type':Sequelize[_0xd171('0x2')],'allowNull':![],'unique':_0xd171('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x5'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xd171('0x6')},'announce':{'type':Sequelize[_0xd171('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd171('0x4')]('rr',_0xd171('0x7'),'leastrecent',_0xd171('0x8'),_0xd171('0x9'),_0xd171('0xa'),_0xd171('0xb'),_0xd171('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0xd171('0x7'),'set':function(_0x24d380){this[_0xd171('0xd')](_0xd171('0xe'),_0x24d380?_0x24d380:_0xd171('0xa'));},'get':function(){var _0x4ab62f=this[_0xd171('0xf')](_0xd171('0x10'));var _0x76d53e=this['getDataValue'](_0xd171('0x11'));var _0x59865c=this[_0xd171('0xf')]('strategy');if(_0x4ab62f===_0xd171('0x5')){return _0x59865c;}if(_0x76d53e===_0xd171('0x12')&&_0x59865c===_0xd171('0xa')||_0x76d53e===_0xd171('0x12')&&_0x59865c===_0xd171('0x13')){return _0x59865c;}if(_0x76d53e===_0xd171('0x14')||_0x76d53e==='predictive'||_0x76d53e===_0xd171('0x15')){return _0x59865c;}return null;}},'servicelevel':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd171('0x16')](0xb)},'timeout':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd171('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':_0xd171('0x17')},'autopause':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no',_0xd171('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd171('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xd171('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd171('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':_0xd171('0x17')},'announce_holdtime':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no',_0xd171('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd171('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xd171('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd171('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd171('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd171('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd171('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xd171('0x2')]},'queue_less_than':{'type':Sequelize[_0xd171('0x2')]},'periodic_announce':{'type':Sequelize[_0xd171('0x1a')],'set':function(_0x3b3252){this['setDataValue']('periodic_announce',_0x3b3252?_0x3b3252[_0xd171('0x1b')](','):[]);},'get':function(){return this[_0xd171('0xf')]('periodic_announce')?this['getDataValue'](_0xd171('0x1c'))[_0xd171('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x17'),'set':function(_0x5e8248){this[_0xd171('0xd')](_0xd171('0x1e'),_0x5e8248?_0x5e8248[_0xd171('0x1b')](','):undefined);},'get':function(){return this[_0xd171('0xf')](_0xd171('0x1e'))?this[_0xd171('0xf')]('joinempty')[_0xd171('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd171('0x2')],'defaultValue':'no','set':function(_0x22653b){this['setDataValue'](_0xd171('0x1f'),_0x22653b?_0x22653b[_0xd171('0x1b')](','):undefined);},'get':function(){return this[_0xd171('0xf')](_0xd171('0x1f'))?this[_0xd171('0xf')](_0xd171('0x1f'))[_0xd171('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd171('0x2')]},'description':{'type':Sequelize[_0xd171('0x2')]},'acw':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'set':function(_0x133874){this[_0xd171('0xd')](_0xd171('0x21'),_0x133874);if(_0x133874){if(this[_0xd171('0xf')]('wrapuptime')<0x2){this[_0xd171('0xd')](_0xd171('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'comment':_0xd171('0x23')},'dialMethod':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x24'),_0xd171('0x14'),_0xd171('0x15'),'predictive',_0xd171('0x12')),'defaultValue':_0xd171('0x14'),'comment':_0xd171('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xd171('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd171('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xd171('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd171('0x28')},'dialPowerLevel':{'type':Sequelize[_0xd171('0x29')](0x2)[_0xd171('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd171('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x2b'),_0xd171('0x2c')),'defaultValue':_0xd171('0x2c'),'comment':_0xd171('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd171('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x2f'),'comment':_0xd171('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xd171('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x3,'comment':_0xd171('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd171('0x38')},'dialTimezone':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x39')},'dialPrefix':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd171('0x3a'),'never',_0xd171('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'comment':_0xd171('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0xd171('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd171('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd171('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd171('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd171('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd171('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd171('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd171('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd171('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd171('0x44'),_0xd171('0x45')),'defaultValue':_0xd171('0x44')},'dialQueueProject2':{'type':Sequelize[_0xd171('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd171('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd171('0x16')],'allowNull':!![],'comment':_0xd171('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![],'comment':_0xd171('0x4f'),'set':function(_0x4987cd){if(!_0x4987cd)this['setDataValue'](_0xd171('0x50'),null);this[_0xd171('0xd')](_0xd171('0x51'),_0x4987cd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd171('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d65d9aa..089933d 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 _0x4975=['index','map','VoiceQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','options','include','findAll','params','keys','includeAll','find','catch','body','user','outbound','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','getHoppers','hasOwnProperty','pick','VoiceQueueId','CmHopper','rows','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','removeAgents','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','phone\x20IS\x20NOT\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','inbound','filter','value','includes','type','name','sendStatus','error','stack','send'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4975,0x86));var _0x5497=function(_0x9a529e,_0x4c1ed4){_0x9a529e=_0x9a529e-0x0;var _0x4187f2=_0x4975[_0x9a529e];return _0x4187f2;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];config[_0x5497('0x18')]=_[_0x5497('0x19')](config[_0x5497('0x18')],{'host':_0x5497('0x1a'),'port':0x18eb});var socket=require(_0x5497('0x1b'))(new Redis(config[_0x5497('0x18')]));require(_0x5497('0x1c'))[_0x5497('0x1d')](socket);function respondWithStatusCode(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xcc;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['sendStatus'](_0x55f590);}return _0x1a4c74[_0x5497('0x1e')](_0x55f590)[_0x5497('0x1f')]();};}function respondWithResult(_0x19e5f3,_0x3ce50b){_0x3ce50b=_0x3ce50b||0xc8;return function(_0x37c18e){if(_0x37c18e){return _0x19e5f3[_0x5497('0x1e')](_0x3ce50b)[_0x5497('0x20')](_0x37c18e);}};}function respondWithFilteredResult(_0x575f6b,_0x56a788){return function(_0x3f4d20){if(_0x3f4d20){var _0x1bf442=typeof _0x56a788[_0x5497('0x21')]==='undefined'&&typeof _0x56a788[_0x5497('0x22')]===_0x5497('0x23');var _0x18e8a8=_0x3f4d20[_0x5497('0x24')];var _0x1b1b43=_0x1bf442?0x0:_0x56a788[_0x5497('0x21')];var _0x16d378=_0x1bf442?_0x3f4d20[_0x5497('0x24')]:_0x56a788[_0x5497('0x21')]+_0x56a788[_0x5497('0x22')];var _0x186065;if(_0x16d378>=_0x18e8a8){_0x16d378=_0x18e8a8;_0x186065=0xc8;}else{_0x186065=0xce;}_0x575f6b['status'](_0x186065);return _0x575f6b[_0x5497('0x25')]('Content-Range',_0x1b1b43+'-'+_0x16d378+'/'+_0x18e8a8)[_0x5497('0x20')](_0x3f4d20);}return null;};}function patchUpdates(_0xd0868d){return function(_0x44265c){try{jsonpatch[_0x5497('0x26')](_0x44265c,_0xd0868d,!![]);}catch(_0x35ecd9){return BPromise[_0x5497('0x27')](_0x35ecd9);}return _0x44265c['save']();};}function saveUpdates(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x28')](_0x54043a)[_0x5497('0x29')](function(_0x5223b5){return _0x5223b5;});}return null;};}function removeEntity(_0x13b7a4,_0x57268c){return function(_0x1f3198){if(_0x1f3198){return _0x1f3198[_0x5497('0x2a')]()[_0x5497('0x29')](function(){var _0x34a1a5=_0x1f3198[_0x5497('0x2b')]({'plain':!![]});var _0x31cd01=[{'name':'VoiceQueues','value':_0x5497('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x498f15=_(_0x31cd01)[_0x5497('0x2d')]('ignore')['map'](_0x5497('0x2e'))[_0x5497('0x2e')]();if(_[_0x5497('0x2f')](_0x498f15,_0x34a1a5['type'])){return;}var _0x59380f=_['find'](_0x31cd01,[_0x5497('0x2e'),_0x34a1a5[_0x5497('0x30')]])[_0x5497('0x31')];return db['UserProfileResource']['destroy']({'where':{'type':_0x59380f,'resourceId':_0x34a1a5['id']}})['then'](function(){return _0x1f3198;});})[_0x5497('0x29')](function(){_0x13b7a4['status'](0xcc)[_0x5497('0x1f')]();});}};}function handleEntityNotFound(_0x258c2d,_0x77c575){return function(_0x4d05c4){if(!_0x4d05c4){_0x258c2d[_0x5497('0x32')](0x194);}return _0x4d05c4;};}function handleError(_0x32aba1,_0x592c00){_0x592c00=_0x592c00||0x1f4;return function(_0xce7cb2){logger[_0x5497('0x33')](_0xce7cb2[_0x5497('0x34')]);if(_0xce7cb2['name']){delete _0xce7cb2[_0x5497('0x31')];}_0x32aba1[_0x5497('0x1e')](_0x592c00)[_0x5497('0x35')](_0xce7cb2);};}exports[_0x5497('0x36')]=function(_0x412f5b,_0x4a6459){var _0x386845={},_0x31ae43={},_0x558a70={'count':0x0,'rows':[]};var _0x1ffc9b=_[_0x5497('0x37')](db[_0x5497('0x38')][_0x5497('0x39')],function(_0x1656c7){return{'name':_0x1656c7[_0x5497('0x3a')],'type':_0x1656c7['type'][_0x5497('0x3b')]};});_0x31ae43['model']=_[_0x5497('0x37')](_0x1ffc9b,_0x5497('0x31'));_0x31ae43[_0x5497('0x3c')]=_['keys'](_0x412f5b['query']);_0x31ae43[_0x5497('0x3d')]=_[_0x5497('0x3e')](_0x31ae43[_0x5497('0x3f')],_0x31ae43[_0x5497('0x3c')]);_0x386845[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x31ae43['model'],qs[_0x5497('0x41')](_0x412f5b[_0x5497('0x3c')][_0x5497('0x41')]));_0x386845[_0x5497('0x40')]=_0x386845[_0x5497('0x40')][_0x5497('0x42')]?_0x386845[_0x5497('0x40')]:_0x31ae43[_0x5497('0x3f')];if(!_0x412f5b[_0x5497('0x3c')]['hasOwnProperty'](_0x5497('0x43'))){_0x386845[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x412f5b[_0x5497('0x3c')][_0x5497('0x22')]);_0x386845[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x412f5b['query'][_0x5497('0x21')]);}_0x386845[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x412f5b[_0x5497('0x3c')][_0x5497('0x45')]);_0x386845[_0x5497('0x46')]=qs[_0x5497('0x3d')](_['pick'](_0x412f5b[_0x5497('0x3c')],_0x31ae43[_0x5497('0x3d')]),_0x1ffc9b);if(_0x412f5b[_0x5497('0x3c')][_0x5497('0x2d')]){_0x386845[_0x5497('0x46')]=_[_0x5497('0x47')](_0x386845[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0x1ffc9b,function(_0x2021ae){if(_0x2021ae[_0x5497('0x30')]!=='VIRTUAL'){var _0x2464a4={};_0x2464a4[_0x2021ae['name']]={'$like':'%'+_0x412f5b[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x2464a4;}})});}_0x386845=_[_0x5497('0x47')]({},_0x386845,_0x412f5b[_0x5497('0x48')]);var _0x133746={'where':_0x386845['where']};return db[_0x5497('0x38')][_0x5497('0x24')](_0x133746)['then'](function(_0x4d9a8d){_0x558a70['count']=_0x4d9a8d;if(_0x412f5b[_0x5497('0x3c')]['includeAll']){_0x386845[_0x5497('0x49')]=[{'all':!![]}];}return db[_0x5497('0x38')][_0x5497('0x4a')](_0x386845);})[_0x5497('0x29')](function(_0xbf2f0){_0x558a70['rows']=_0xbf2f0;return _0x558a70;})['then'](respondWithFilteredResult(_0x4a6459,_0x386845))['catch'](handleError(_0x4a6459,null));};exports['show']=function(_0x3cbe4b,_0x43c430){var _0x417f31={'raw':![],'where':{'id':_0x3cbe4b[_0x5497('0x4b')]['id']}},_0x185512={};_0x185512[_0x5497('0x3f')]=_[_0x5497('0x4c')](db[_0x5497('0x38')][_0x5497('0x39')]);_0x185512['query']=_[_0x5497('0x4c')](_0x3cbe4b[_0x5497('0x3c')]);_0x185512[_0x5497('0x3d')]=_['intersection'](_0x185512[_0x5497('0x3f')],_0x185512['query']);_0x417f31[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x185512[_0x5497('0x3f')],qs['fields'](_0x3cbe4b[_0x5497('0x3c')][_0x5497('0x41')]));_0x417f31['attributes']=_0x417f31[_0x5497('0x40')]['length']?_0x417f31[_0x5497('0x40')]:_0x185512['model'];if(_0x3cbe4b[_0x5497('0x3c')][_0x5497('0x4d')]){_0x417f31[_0x5497('0x49')]=[{'all':!![]}];}_0x417f31=_[_0x5497('0x47')]({},_0x417f31,_0x3cbe4b[_0x5497('0x48')]);return db[_0x5497('0x38')][_0x5497('0x4e')](_0x417f31)[_0x5497('0x29')](handleEntityNotFound(_0x43c430,null))['then'](respondWithResult(_0x43c430,null))[_0x5497('0x4f')](handleError(_0x43c430,null));};exports['create']=function(_0x4c516b,_0x33a882){return db[_0x5497('0x38')]['create'](_0x4c516b[_0x5497('0x50')],{})[_0x5497('0x29')](function(_0x436a83){var _0x3094c7=_0x4c516b['user'][_0x5497('0x2b')]({'plain':!![]});if(!_0x3094c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3094c7['role']===_0x5497('0x51')){var _0x33dd07=_0x436a83[_0x5497('0x2b')]({'plain':!![]});var _0x49c85a=[{'name':'VoiceQueues','value':_0x5497('0x2c')},{'name':'QueueCampaigns','value':_0x5497('0x52')}];var _0x530431=_[_0x5497('0x4e')](_0x49c85a,['value',_0x33dd07[_0x5497('0x30')]])[_0x5497('0x31')];return db['UserProfileSection'][_0x5497('0x4e')]({'where':{'name':_0x530431,'userProfileId':_0x3094c7['userProfileId']},'raw':!![]})['then'](function(_0x284f6d){if(_0x284f6d&&_0x284f6d[_0x5497('0x53')]===0x0){return db['UserProfileResource'][_0x5497('0x54')]({'name':_0x33dd07[_0x5497('0x31')],'resourceId':_0x33dd07['id'],'type':_0x284f6d[_0x5497('0x31')],'sectionId':_0x284f6d['id']},{})[_0x5497('0x29')](function(){return _0x436a83;});}else{return _0x436a83;}})[_0x5497('0x4f')](function(_0x25c75e){logger['error'](_0x5497('0x55'),_0x25c75e);throw _0x25c75e;});}return _0x436a83;})['then'](respondWithResult(_0x33a882,0xc9))['catch'](handleError(_0x33a882,null));};exports['clone']=function(_0x1f3965,_0x37e0b9){var _0x23fd59={'where':{'id':_0x1f3965[_0x5497('0x4b')]['id']}},_0x544085={};_0x544085['model']=_['keys'](db[_0x5497('0x38')][_0x5497('0x39')]);_0x23fd59[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x544085[_0x5497('0x3f')],qs[_0x5497('0x41')](_0x1f3965['query'][_0x5497('0x41')]));_0x23fd59[_0x5497('0x40')]=_0x23fd59[_0x5497('0x40')][_0x5497('0x42')]?_0x23fd59['attributes']:_0x544085[_0x5497('0x3f')];if(_0x1f3965[_0x5497('0x3c')][_0x5497('0x4d')]){_0x23fd59[_0x5497('0x49')]=[{'all':!![]}];}_0x23fd59=_['merge']({},_0x23fd59,_0x1f3965[_0x5497('0x48')]);return db[_0x5497('0x38')][_0x5497('0x4e')](_0x23fd59)['then'](handleEntityNotFound(_0x37e0b9,null))[_0x5497('0x29')](function(_0x50a144){if(_0x50a144){var _0x5b4e84=_0x50a144['get']({'plain':!![]});_0x5b4e84=qs[_0x5497('0x56')](_0x5b4e84,['id',_0x5497('0x57'),_0x5497('0x58')]);_0x1f3965['body']=_[_0x5497('0x56')](_0x1f3965[_0x5497('0x50')],['id',_0x5497('0x57'),_0x5497('0x58')]);return db['VoiceQueue'][_0x5497('0x54')](_[_0x5497('0x47')](_0x5b4e84,_0x1f3965[_0x5497('0x50')]),{'include':_0x1f3965['query'][_0x5497('0x4d')]?[{'all':!![]}]:undefined})[_0x5497('0x29')](function(_0xb3eec2){var _0x4368e3=_0x1f3965[_0x5497('0x51')][_0x5497('0x2b')]({'plain':!![]});if(!_0x4368e3)throw new Error(_0x5497('0x59'));if(_0x4368e3['role']===_0x5497('0x51')){var _0x17186e=_0xb3eec2[_0x5497('0x2b')]({'plain':!![]});var _0x20efea=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0x5497('0x52')}];var _0x1d1405=_[_0x5497('0x4e')](_0x20efea,['value',_0x17186e[_0x5497('0x30')]])[_0x5497('0x31')];return db[_0x5497('0x5a')][_0x5497('0x4e')]({'where':{'name':_0x1d1405,'userProfileId':_0x4368e3[_0x5497('0x5b')]},'raw':!![]})[_0x5497('0x29')](function(_0x3f38bf){if(_0x3f38bf&&_0x3f38bf[_0x5497('0x53')]===0x0){return db[_0x5497('0x5c')][_0x5497('0x54')]({'name':_0x17186e[_0x5497('0x31')],'resourceId':_0x17186e['id'],'type':_0x3f38bf['name'],'sectionId':_0x3f38bf['id']},{})[_0x5497('0x29')](function(){return _0xb3eec2;});}else{return _0xb3eec2;}})[_0x5497('0x4f')](function(_0x238d68){logger['error'](_0x5497('0x55'),_0x238d68);throw _0x238d68;});}return _0xb3eec2;});}})['then'](respondWithResult(_0x37e0b9,0xc9))[_0x5497('0x4f')](handleError(_0x37e0b9,null));};exports[_0x5497('0x28')]=function(_0x4ca2d2,_0x2c67d7){if(_0x4ca2d2[_0x5497('0x50')]['id']){delete _0x4ca2d2[_0x5497('0x50')]['id'];}return db[_0x5497('0x38')]['find']({'where':{'id':_0x4ca2d2[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x2c67d7,null))[_0x5497('0x29')](saveUpdates(_0x4ca2d2['body'],null))[_0x5497('0x29')](respondWithResult(_0x2c67d7,null))[_0x5497('0x4f')](handleError(_0x2c67d7,null));};exports['destroy']=function(_0x105298,_0xebe694){return db[_0x5497('0x38')]['find']({'where':{'id':_0x105298['params']['id']}})[_0x5497('0x29')](handleEntityNotFound(_0xebe694,null))[_0x5497('0x29')](removeEntity(_0xebe694,null))[_0x5497('0x4f')](handleError(_0xebe694,null));};exports[_0x5497('0x5d')]=function(_0xad9c91,_0x819588,_0x13f1b7){var _0x4e4d70={'raw':![],'where':{}};var _0x48a571={};var _0x166daa={'count':0x0,'rows':[]};return db[_0x5497('0x38')]['findOne']({'where':{'id':_0xad9c91[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x819588,null))[_0x5497('0x29')](function(_0x510078){if(_0x510078){_0x48a571[_0x5497('0x3f')]=_[_0x5497('0x4c')](db['CmHopper'][_0x5497('0x39')]);_0x48a571[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0xad9c91[_0x5497('0x3c')]);_0x48a571[_0x5497('0x3d')]=_['intersection'](_0x48a571[_0x5497('0x3f')],_0x48a571[_0x5497('0x3c')]);_0x4e4d70[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x48a571[_0x5497('0x3f')],qs['fields'](_0xad9c91[_0x5497('0x3c')][_0x5497('0x41')]));_0x4e4d70[_0x5497('0x40')]=_0x4e4d70[_0x5497('0x40')]['length']?_0x4e4d70[_0x5497('0x40')]:_0x48a571[_0x5497('0x3f')];if(!_0xad9c91['query'][_0x5497('0x5e')](_0x5497('0x43'))){_0x4e4d70[_0x5497('0x22')]=qs[_0x5497('0x22')](_0xad9c91['query']['limit']);_0x4e4d70['offset']=qs['offset'](_0xad9c91['query'][_0x5497('0x21')]);}_0x4e4d70[_0x5497('0x44')]=qs[_0x5497('0x45')](_0xad9c91[_0x5497('0x3c')][_0x5497('0x45')]);_0x4e4d70['where']=qs['filters'](_[_0x5497('0x5f')](_0xad9c91[_0x5497('0x3c')],_0x48a571[_0x5497('0x3d')]));_0x4e4d70[_0x5497('0x46')][_0x5497('0x60')]=_0x510078['id'];if(_0xad9c91[_0x5497('0x3c')][_0x5497('0x2d')]){_0x4e4d70[_0x5497('0x46')]=_[_0x5497('0x47')](_0x4e4d70[_0x5497('0x46')],{'$or':_['map'](_0x4e4d70[_0x5497('0x40')],function(_0x4118ec){var _0x2868b1={};_0x2868b1[_0x4118ec]={'$like':'%'+_0xad9c91[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x2868b1;})});}_0x4e4d70=_[_0x5497('0x47')]({},_0x4e4d70,_0xad9c91['options']);return db[_0x5497('0x61')]['count']({'where':_0x4e4d70[_0x5497('0x46')]})[_0x5497('0x29')](function(_0x2207b9){_0x166daa['count']=_0x2207b9;if(_0xad9c91['query'][_0x5497('0x4d')]){_0x4e4d70[_0x5497('0x49')]=[{'all':!![]}];}return db[_0x5497('0x61')][_0x5497('0x4a')](_0x4e4d70);})[_0x5497('0x29')](function(_0x1876d2){_0x166daa[_0x5497('0x62')]=_0x1876d2;return _0x166daa;});}})[_0x5497('0x29')](respondWithFilteredResult(_0x819588,_0x4e4d70))['catch'](handleError(_0x819588,null));};exports['getHopperHistories']=function(_0x492372,_0x1f47e6,_0x1dfe31){var _0x160b4b={'raw':!![],'where':{}};var _0xc81d7d={};var _0x4c442f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5497('0x63')]({'where':{'id':_0x492372[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f47e6,null))[_0x5497('0x29')](function(_0x2fc11a){if(_0x2fc11a){_0xc81d7d[_0x5497('0x3f')]=_[_0x5497('0x4c')](db['CmHopperHistory']['rawAttributes']);_0xc81d7d['query']=_['keys'](_0x492372['query']);_0xc81d7d[_0x5497('0x3d')]=_['intersection'](_0xc81d7d[_0x5497('0x3f')],_0xc81d7d['query']);_0x160b4b[_0x5497('0x40')]=_[_0x5497('0x3e')](_0xc81d7d[_0x5497('0x3f')],qs[_0x5497('0x41')](_0x492372[_0x5497('0x3c')][_0x5497('0x41')]));_0x160b4b['attributes']=_0x160b4b[_0x5497('0x40')]['length']?_0x160b4b[_0x5497('0x40')]:_0xc81d7d[_0x5497('0x3f')];if(!_0x492372[_0x5497('0x3c')][_0x5497('0x5e')](_0x5497('0x43'))){_0x160b4b[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x492372[_0x5497('0x3c')][_0x5497('0x22')]);_0x160b4b[_0x5497('0x21')]=qs['offset'](_0x492372[_0x5497('0x3c')]['offset']);}_0x160b4b[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x492372['query'][_0x5497('0x45')]);_0x160b4b[_0x5497('0x46')]=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x492372[_0x5497('0x3c')],_0xc81d7d[_0x5497('0x3d')]));_0x160b4b[_0x5497('0x46')][_0x5497('0x60')]=_0x2fc11a['id'];if(_0x492372[_0x5497('0x3c')][_0x5497('0x2d')]){_0x160b4b[_0x5497('0x46')]=_[_0x5497('0x47')](_0x160b4b[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0x160b4b['attributes'],function(_0x37c17e){var _0x163b5b={};_0x163b5b[_0x37c17e]={'$like':'%'+_0x492372[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x163b5b;})});}_0x160b4b=_[_0x5497('0x47')]({},_0x160b4b,_0x492372['options']);return db[_0x5497('0x64')][_0x5497('0x24')]({'where':_0x160b4b['where']})['then'](function(_0x3a5872){_0x4c442f[_0x5497('0x24')]=_0x3a5872;if(_0x492372[_0x5497('0x3c')][_0x5497('0x4d')]){_0x160b4b[_0x5497('0x49')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x160b4b);})[_0x5497('0x29')](function(_0x593b38){_0x4c442f[_0x5497('0x62')]=_0x593b38;return _0x4c442f;});}})[_0x5497('0x29')](respondWithFilteredResult(_0x1f47e6,_0x160b4b))[_0x5497('0x4f')](handleError(_0x1f47e6,null));};exports[_0x5497('0x65')]=function(_0x2bdedb,_0x13350b,_0x53acd4){var _0x49df29={'raw':!![],'where':{}};var _0x85a1fa={};var _0x40fce7={'count':0x0,'rows':[]};return db[_0x5497('0x38')]['findOne']({'where':{'id':_0x2bdedb[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13350b,null))[_0x5497('0x29')](function(_0x5ec87d){if(_0x5ec87d){_0x85a1fa['model']=_[_0x5497('0x4c')](db[_0x5497('0x66')]['rawAttributes']);_0x85a1fa[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x2bdedb[_0x5497('0x3c')]);_0x85a1fa[_0x5497('0x3d')]=_['intersection'](_0x85a1fa[_0x5497('0x3f')],_0x85a1fa[_0x5497('0x3c')]);_0x49df29[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x85a1fa[_0x5497('0x3f')],qs['fields'](_0x2bdedb[_0x5497('0x3c')]['fields']));_0x49df29[_0x5497('0x40')]=_0x49df29[_0x5497('0x40')][_0x5497('0x42')]?_0x49df29[_0x5497('0x40')]:_0x85a1fa[_0x5497('0x3f')];if(!_0x2bdedb[_0x5497('0x3c')][_0x5497('0x5e')](_0x5497('0x43'))){_0x49df29[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x2bdedb[_0x5497('0x3c')]['limit']);_0x49df29[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x2bdedb[_0x5497('0x3c')][_0x5497('0x21')]);}_0x49df29[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x2bdedb[_0x5497('0x3c')][_0x5497('0x45')]);_0x49df29[_0x5497('0x46')]=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x2bdedb['query'],_0x85a1fa[_0x5497('0x3d')]));_0x49df29[_0x5497('0x46')][_0x5497('0x60')]=_0x5ec87d['id'];if(_0x2bdedb[_0x5497('0x3c')][_0x5497('0x2d')]){_0x49df29[_0x5497('0x46')]=_[_0x5497('0x47')](_0x49df29[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0x49df29[_0x5497('0x40')],function(_0x9db313){var _0x917a6b={};_0x917a6b[_0x9db313]={'$like':'%'+_0x2bdedb[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x917a6b;})});}_0x49df29=_['merge']({},_0x49df29,_0x2bdedb['options']);return db[_0x5497('0x66')][_0x5497('0x24')]({'where':_0x49df29[_0x5497('0x46')]})['then'](function(_0x349a89){_0x40fce7[_0x5497('0x24')]=_0x349a89;if(_0x2bdedb[_0x5497('0x3c')][_0x5497('0x4d')]){_0x49df29[_0x5497('0x49')]=[{'all':!![]}];}return db[_0x5497('0x66')][_0x5497('0x4a')](_0x49df29);})[_0x5497('0x29')](function(_0x491789){_0x40fce7['rows']=_0x491789;return _0x40fce7;});}})['then'](respondWithFilteredResult(_0x13350b,_0x49df29))[_0x5497('0x4f')](handleError(_0x13350b,null));};exports[_0x5497('0x67')]=function(_0x4dab6a,_0x649ca7,_0x27f42b){var _0x1bef85={'raw':!![],'where':{}};var _0x5a0f98={};var _0x4423ee={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5497('0x63')]({'where':{'id':_0x4dab6a[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x649ca7,null))['then'](function(_0x1c3dad){if(_0x1c3dad){_0x5a0f98[_0x5497('0x3f')]=_['keys'](db[_0x5497('0x68')][_0x5497('0x39')]);_0x5a0f98[_0x5497('0x3c')]=_['keys'](_0x4dab6a[_0x5497('0x3c')]);_0x5a0f98[_0x5497('0x3d')]=_[_0x5497('0x3e')](_0x5a0f98[_0x5497('0x3f')],_0x5a0f98[_0x5497('0x3c')]);_0x1bef85[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x5a0f98[_0x5497('0x3f')],qs[_0x5497('0x41')](_0x4dab6a[_0x5497('0x3c')][_0x5497('0x41')]));_0x1bef85[_0x5497('0x40')]=_0x1bef85[_0x5497('0x40')][_0x5497('0x42')]?_0x1bef85[_0x5497('0x40')]:_0x5a0f98['model'];if(!_0x4dab6a[_0x5497('0x3c')]['hasOwnProperty'](_0x5497('0x43'))){_0x1bef85[_0x5497('0x22')]=qs['limit'](_0x4dab6a['query'][_0x5497('0x22')]);_0x1bef85[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x4dab6a[_0x5497('0x3c')]['offset']);}_0x1bef85[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x4dab6a['query']['sort']);_0x1bef85[_0x5497('0x46')]=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x4dab6a[_0x5497('0x3c')],_0x5a0f98[_0x5497('0x3d')]));_0x1bef85['where']['VoiceQueueId']=_0x1c3dad['id'];if(_0x4dab6a[_0x5497('0x3c')][_0x5497('0x2d')]){_0x1bef85['where']=_[_0x5497('0x47')](_0x1bef85[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0x1bef85[_0x5497('0x40')],function(_0x358ec5){var _0x5cddbc={};_0x5cddbc[_0x358ec5]={'$like':'%'+_0x4dab6a[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x5cddbc;})});}_0x1bef85=_[_0x5497('0x47')]({},_0x1bef85,_0x4dab6a['options']);return db['CmHopperBlack'][_0x5497('0x24')]({'where':_0x1bef85[_0x5497('0x46')]})[_0x5497('0x29')](function(_0x5e07b0){_0x4423ee[_0x5497('0x24')]=_0x5e07b0;if(_0x4dab6a[_0x5497('0x3c')][_0x5497('0x4d')]){_0x1bef85['include']=[{'all':!![]}];}return db[_0x5497('0x68')][_0x5497('0x4a')](_0x1bef85);})['then'](function(_0x5264a8){_0x4423ee[_0x5497('0x62')]=_0x5264a8;return _0x4423ee;});}})[_0x5497('0x29')](respondWithFilteredResult(_0x649ca7,_0x1bef85))['catch'](handleError(_0x649ca7,null));};exports[_0x5497('0x69')]=function(_0x5001d5,_0x22c8ad,_0x2c58e6){var _0x300f3e={};var _0x30e3f0={};var _0x31d47d;var _0x113336;return db[_0x5497('0x38')]['findOne']({'where':{'id':_0x5001d5['params']['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x22c8ad,null))[_0x5497('0x29')](function(_0x4ec65c){if(_0x4ec65c){_0x31d47d=_0x4ec65c;_0x30e3f0['model']=_[_0x5497('0x4c')](db[_0x5497('0x6a')][_0x5497('0x39')]);_0x30e3f0[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x5001d5[_0x5497('0x3c')]);_0x30e3f0['filters']=_[_0x5497('0x3e')](_0x30e3f0[_0x5497('0x3f')],_0x30e3f0[_0x5497('0x3c')]);_0x300f3e[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x30e3f0[_0x5497('0x3f')],qs['fields'](_0x5001d5[_0x5497('0x3c')]['fields']));_0x300f3e[_0x5497('0x40')]=_0x300f3e[_0x5497('0x40')][_0x5497('0x42')]?_0x300f3e['attributes']:_0x30e3f0[_0x5497('0x3f')];_0x300f3e['order']=qs['sort'](_0x5001d5[_0x5497('0x3c')][_0x5497('0x45')]);_0x300f3e['where']=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x5001d5[_0x5497('0x3c')],_0x30e3f0[_0x5497('0x3d')]));if(_0x5001d5[_0x5497('0x3c')][_0x5497('0x2d')]){_0x300f3e[_0x5497('0x46')]=_[_0x5497('0x47')](_0x300f3e[_0x5497('0x46')],{'$or':_['map'](_0x300f3e[_0x5497('0x40')],function(_0xad0a6){var _0xa3246f={};_0xa3246f[_0xad0a6]={'$like':'%'+_0x5001d5[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0xa3246f;})});}_0x300f3e=_[_0x5497('0x47')]({},_0x300f3e,_0x5001d5[_0x5497('0x48')]);return _0x31d47d[_0x5497('0x69')](_0x300f3e);}})[_0x5497('0x29')](function(_0x2c5720){if(_0x2c5720){_0x113336=_0x2c5720[_0x5497('0x42')];if(!_0x5001d5[_0x5497('0x3c')][_0x5497('0x5e')](_0x5497('0x43'))){_0x300f3e[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x5001d5[_0x5497('0x3c')][_0x5497('0x22')]);_0x300f3e[_0x5497('0x21')]=qs['offset'](_0x5001d5[_0x5497('0x3c')][_0x5497('0x21')]);}return _0x31d47d['getTeams'](_0x300f3e);}})['then'](function(_0x3fa976){if(_0x3fa976){return _0x3fa976?{'count':_0x113336,'rows':_0x3fa976}:null;}})['then'](respondWithResult(_0x22c8ad,null))[_0x5497('0x4f')](handleError(_0x22c8ad,null));};exports[_0x5497('0x6b')]=function(_0x8755ed,_0x2d185e,_0x25233f){var _0x2fc2b5=_0x8755ed[_0x5497('0x50')][_0x5497('0x6c')];var _0xd469af=_[_0x5497('0x37')](_0x2fc2b5,'id');return db[_0x5497('0x6a')]['findAll']({'where':{'id':_0xd469af},'attributes':['id'],'include':[{'model':db[_0x5497('0x6d')],'as':'Agents','attributes':['id',_0x5497('0x31'),_0x5497('0x6e'),_0x5497('0x6f'),_0x5497('0x70')],'raw':!![]}]})[_0x5497('0x29')](function(_0x296e58){if(_0x296e58){var _0xc34204=_[_0x5497('0x71')](_0x296e58,function(_0x5b7011){var _0x47cffa=_0x5b7011[_0x5497('0x2b')]({'plain':!![]});_0x47cffa[_0x5497('0x72')][_0x5497('0x73')](function(_0x2e9b06){_0x2e9b06[_0x5497('0x74')]=_['find'](_0x2fc2b5,{'id':_0x47cffa['id']})[_0x5497('0x74')];});return _0x47cffa['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0x8755ed['params']['id']}})[_0x5497('0x29')](function(_0x49d555){return db['sequelize'][_0x5497('0x75')](function(_0x1c8be2){return _0x49d555[_0x5497('0x6b')](_0xd469af,{'transaction':_0x1c8be2})[_0x5497('0x29')](function(){return BPromise['each'](_0x2fc2b5,function(_0x2e62ae){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x2e62ae['id'],'VoiceQueueId':_0x8755ed[_0x5497('0x4b')]['id'],'penalty':_0x2e62ae['penalty']},{'transaction':_0x1c8be2});});})[_0x5497('0x29')](function(){return BPromise[_0x5497('0x76')](_0xc34204,function(_0xd0d16a){return db['UserVoiceQueue'][_0x5497('0x77')]({'where':{'UserId':_0xd0d16a['id'],'VoiceQueueId':_0x8755ed['params']['id']},'defaults':{'penalty':_0xd0d16a[_0x5497('0x74')]},'transaction':_0x1c8be2});});})[_0x5497('0x29')](function(){return BPromise[_0x5497('0x76')](_[_0x5497('0x2d')](_0xc34204,{'online':!![]}),function(_0x3537a3){return db[_0x5497('0x78')][_0x5497('0x79')]({'membername':_0x3537a3[_0x5497('0x31')],'UserId':_0x3537a3['id'],'queue_name':_0x49d555[_0x5497('0x31')],'VoiceQueueId':_0x49d555['id'],'interface':_['isNil'](_0x3537a3[_0x5497('0x70')])?util[_0x5497('0x7a')](_0x5497('0x7b'),_0x3537a3['name']):_0x3537a3[_0x5497('0x70')],'paused':_0x3537a3[_0x5497('0x6f')]||![],'penalty':_0x3537a3[_0x5497('0x74')]},{'transaction':_0x1c8be2});});})[_0x5497('0x29')](function(){_0xc34204[_0x5497('0x73')](function(_0x4a1a70){socket[_0x5497('0x7c')](_0x5497('0x7d'),{'UserId':_0x4a1a70['id'],'VoiceQueueId':_0x49d555['id']});});});});});}})[_0x5497('0x29')](respondWithStatusCode(_0x2d185e,null))[_0x5497('0x4f')](handleError(_0x2d185e,null));};exports['removeTeams']=function(_0x23646a,_0x2603b5,_0x8298f2){return db[_0x5497('0x6a')][_0x5497('0x4a')]({'where':{'id':_0x23646a[_0x5497('0x3c')][_0x5497('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5497('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2603b5,null))[_0x5497('0x29')](function(_0x183142){var _0x55fe87=_['map'](_0x183142,'id');var _0x5cfdea=[];var _0x3dd293=[];var _0x18f72b=squel[_0x5497('0x7f')]();_0x18f72b[_0x5497('0x80')]('tq.TeamId')[_0x5497('0x81')](_0x5497('0x82'),'tq')[_0x5497('0x83')](_0x5497('0x84'),'ut',_0x5497('0x85'))['where'](_0x5497('0x86'),_0x23646a['params']['id']);for(var _0x1e56a4=0x0;_0x1e56a4<_0x183142[_0x5497('0x42')];_0x1e56a4+=0x1){let _0x464c97=_0x183142[_0x1e56a4];for(var _0x267861=0x0;_0x267861<_0x464c97['Agents']['length'];_0x267861+=0x1){let _0x3cad8a=_0x464c97['Agents'][_0x267861];var _0x2e00e6=_0x18f72b['clone']();_0x2e00e6[_0x5497('0x46')]('ut.UserId\x20=\x20?',_0x3cad8a['id']);_0x3dd293[_0x5497('0x87')](db[_0x5497('0x88')]['query'](_0x2e00e6[_0x5497('0x89')](),{'type':db[_0x5497('0x88')][_0x5497('0x8a')][_0x5497('0x8b')]})['then'](function(_0x33184c){if(_0x33184c[_0x5497('0x42')]===0x1){return _0x3cad8a['id'];}else{var _0x2e5e88=_[_0x5497('0x8c')](_[_0x5497('0x37')](_0x33184c,_0x5497('0x8d')),function(_0x41b271){return _[_0x5497('0x2f')](_0x55fe87,_0x41b271);});if(_0x2e5e88){return _0x3cad8a['id'];}}}));}}return BPromise[_0x5497('0x8e')](_0x3dd293)[_0x5497('0x29')](function(_0x29a9e5){_0x5cfdea=_(_0x5cfdea)[_0x5497('0x8f')](_0x29a9e5)[_0x5497('0x90')]()[_0x5497('0x2e')]();return db[_0x5497('0x38')][_0x5497('0x4e')]({'where':{'id':_0x23646a[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](function(_0x33c0d9){return db[_0x5497('0x88')][_0x5497('0x75')](function(_0x311484){return _0x33c0d9[_0x5497('0x91')](_0x23646a[_0x5497('0x3c')]['ids'],{'transaction':_0x311484})[_0x5497('0x29')](function(){if(!_['isEmpty'](_0x5cfdea)){return _0x33c0d9[_0x5497('0x92')](_0x5cfdea,{'transaction':_0x311484})['then'](function(){return db[_0x5497('0x78')]['destroy']({'where':{'VoiceQueueId':_0x23646a['params']['id'],'UserId':_0x5cfdea},'transaction':_0x311484});});}})[_0x5497('0x29')](function(){_0x5cfdea['forEach'](function(_0x4c6d77){socket[_0x5497('0x7c')]('userVoiceQueue:remove',{'UserId':_0x4c6d77,'VoiceQueueId':_0x33c0d9['id']});});});});});});})[_0x5497('0x29')](respondWithStatusCode(_0x2603b5,null))['catch'](handleError(_0x2603b5,null));};exports['addAgents']=function(_0x118c30,_0x3cab30,_0x171b7e){var _0x4963c2,_0x1674b4;return db[_0x5497('0x38')][_0x5497('0x4e')]({'where':{'id':_0x118c30[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x3cab30,null))['then'](function(_0xc43157){if(_0xc43157){_0x1674b4=_0xc43157;return _0xc43157['addAgents'](_0x118c30['body'][_0x5497('0x7e')],_[_0x5497('0x56')](_0x118c30['body'],[_0x5497('0x7e'),'id'])||{})['spread'](function(_0x49da94){for(var _0x2a1994=0x0;_0x2a1994<_0x118c30[_0x5497('0x50')][_0x5497('0x7e')][_0x5497('0x42')];_0x2a1994+=0x1){socket['emit'](_0x5497('0x7d'),{'UserId':Number(_0x118c30[_0x5497('0x50')][_0x5497('0x7e')][_0x2a1994]),'VoiceQueueId':Number(_0x118c30[_0x5497('0x4b')]['id'])});}return _0x49da94;});}})[_0x5497('0x29')](function(_0x51f848){_0x4963c2=_0x51f848||[];if(_0x1674b4){return db['User'][_0x5497('0x4a')]({'where':{'id':_0x118c30[_0x5497('0x50')][_0x5497('0x7e')]},'attributes':['id',_0x5497('0x31'),_0x5497('0x6e'),'voicePause',_0x5497('0x70')],'raw':!![]});}})[_0x5497('0x29')](function(_0x5e3b48){if(!_['isEmpty'](_0x5e3b48)){var _0x4d045e=[];for(var _0x2cfb5b=0x0;_0x2cfb5b<_0x5e3b48[_0x5497('0x42')];_0x2cfb5b++){if(_0x5e3b48[_0x2cfb5b][_0x5497('0x6e')]){_0x4d045e[_0x5497('0x87')](db[_0x5497('0x78')][_0x5497('0x79')]({'membername':_0x5e3b48[_0x2cfb5b][_0x5497('0x31')],'UserId':_0x5e3b48[_0x2cfb5b]['id'],'queue_name':_0x1674b4['name'],'VoiceQueueId':_0x1674b4['id'],'interface':_[_0x5497('0x93')](_0x5e3b48[_0x2cfb5b][_0x5497('0x70')])?util['format']('SIP/%s',_0x5e3b48[_0x2cfb5b][_0x5497('0x31')]):_0x5e3b48[_0x2cfb5b]['interface'],'paused':_0x5e3b48[_0x2cfb5b][_0x5497('0x6f')]||![],'penalty':_0x118c30[_0x5497('0x50')][_0x5497('0x74')]||0x0}));}}return BPromise[_0x5497('0x8e')](_0x4d045e);}})['then'](function(){return _0x4963c2;})[_0x5497('0x29')](respondWithResult(_0x3cab30,null))[_0x5497('0x4f')](handleError(_0x3cab30,null));};exports[_0x5497('0x92')]=function(_0x438c46,_0x25acb2,_0x590265){return db[_0x5497('0x38')][_0x5497('0x4e')]({'where':{'id':_0x438c46[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x25acb2,null))[_0x5497('0x29')](function(_0x14fa45){if(_0x14fa45){return _0x14fa45[_0x5497('0x92')](_0x438c46['query']['ids'])[_0x5497('0x29')](function(){if(_[_0x5497('0x94')](_0x438c46['query'][_0x5497('0x7e')])){for(var _0x43fc44=0x0;_0x43fc44<_0x438c46['query']['ids'][_0x5497('0x42')];_0x43fc44+=0x1){socket[_0x5497('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x438c46['query']['ids'][_0x43fc44]),'VoiceQueueId':Number(_0x438c46[_0x5497('0x4b')]['id'])});}}else{socket[_0x5497('0x7c')](_0x5497('0x95'),{'UserId':Number(_0x438c46['query'][_0x5497('0x7e')]),'VoiceQueueId':Number(_0x438c46['params']['id'])});}});}})[_0x5497('0x29')](function(_0x58bd84){return db[_0x5497('0x78')]['destroy']({'where':{'VoiceQueueId':_0x438c46[_0x5497('0x4b')]['id'],'UserId':_0x438c46[_0x5497('0x3c')][_0x5497('0x7e')]}})[_0x5497('0x29')](function(){return _0x58bd84;});})[_0x5497('0x29')](respondWithStatusCode(_0x25acb2,null))[_0x5497('0x4f')](handleError(_0x25acb2,null));};exports[_0x5497('0x96')]=function(_0x342a97,_0x32cf68,_0x15969b){var _0x1c4ca6={};var _0x2c4b4c={};var _0x482a20;var _0x817179;return db[_0x5497('0x38')]['findOne']({'where':{'id':_0x342a97[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x32cf68,null))[_0x5497('0x29')](function(_0xedbcba){if(_0xedbcba){_0x482a20=_0xedbcba;_0x2c4b4c['model']=_[_0x5497('0x4c')](db[_0x5497('0x6d')][_0x5497('0x39')]);_0x2c4b4c[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x342a97[_0x5497('0x3c')]);_0x2c4b4c['filters']=_[_0x5497('0x3e')](_0x2c4b4c['model'],_0x2c4b4c[_0x5497('0x3c')]);_0x1c4ca6[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x2c4b4c[_0x5497('0x3f')],qs[_0x5497('0x41')](_0x342a97['query'][_0x5497('0x41')]));_0x1c4ca6[_0x5497('0x40')]=_0x1c4ca6[_0x5497('0x40')][_0x5497('0x42')]?_0x1c4ca6[_0x5497('0x40')]:_0x2c4b4c[_0x5497('0x3f')];_0x1c4ca6[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x342a97[_0x5497('0x3c')][_0x5497('0x45')]);_0x1c4ca6['where']=qs[_0x5497('0x3d')](_['pick'](_0x342a97[_0x5497('0x3c')],_0x2c4b4c[_0x5497('0x3d')]));if(_0x342a97['query'][_0x5497('0x2d')]){_0x1c4ca6[_0x5497('0x46')]=_[_0x5497('0x47')](_0x1c4ca6[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0x1c4ca6[_0x5497('0x40')],function(_0x4835bb){var _0x299a38={};_0x299a38[_0x4835bb]={'$like':'%'+_0x342a97[_0x5497('0x3c')]['filter']+'%'};return _0x299a38;})});}_0x1c4ca6=_['merge']({},_0x1c4ca6,_0x342a97['options']);return _0x482a20[_0x5497('0x96')](_0x1c4ca6);}})['then'](function(_0x331368){if(_0x331368){_0x817179=_0x331368[_0x5497('0x42')];if(!_0x342a97[_0x5497('0x3c')]['hasOwnProperty'](_0x5497('0x43'))){_0x1c4ca6['limit']=qs[_0x5497('0x22')](_0x342a97[_0x5497('0x3c')][_0x5497('0x22')]);_0x1c4ca6[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x342a97[_0x5497('0x3c')]['offset']);}return _0x482a20['getAgents'](_0x1c4ca6);}})['then'](function(_0x387181){if(_0x387181){return _0x387181?{'count':_0x817179,'rows':_0x387181}:null;}})[_0x5497('0x29')](respondWithResult(_0x32cf68,null))[_0x5497('0x4f')](handleError(_0x32cf68,null));};exports[_0x5497('0x97')]=function(_0x639a6a,_0xa965d1,_0x102049){var _0xc84025={};var _0x267bfa={};var _0x8fbf4e;var _0x5b54ff;return db[_0x5497('0x38')][_0x5497('0x63')]({'where':{'id':_0x639a6a['params']['id']}})[_0x5497('0x29')](handleEntityNotFound(_0xa965d1,null))[_0x5497('0x29')](function(_0x9de85e){if(_0x9de85e){_0x8fbf4e=_0x9de85e;_0x267bfa[_0x5497('0x3f')]=_['keys'](db[_0x5497('0x78')]['rawAttributes']);_0x267bfa[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x639a6a[_0x5497('0x3c')]);_0x267bfa['filters']=_[_0x5497('0x3e')](_0x267bfa['model'],_0x267bfa[_0x5497('0x3c')]);_0xc84025[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x267bfa[_0x5497('0x3f')],qs[_0x5497('0x41')](_0x639a6a[_0x5497('0x3c')][_0x5497('0x41')]));_0xc84025[_0x5497('0x40')]=_0xc84025['attributes'][_0x5497('0x42')]?_0xc84025['attributes']:_0x267bfa['model'];_0xc84025[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x639a6a[_0x5497('0x3c')][_0x5497('0x45')]);_0xc84025[_0x5497('0x46')]=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x639a6a[_0x5497('0x3c')],_0x267bfa[_0x5497('0x3d')]));if(_0x639a6a['query'][_0x5497('0x2d')]){_0xc84025['where']=_['merge'](_0xc84025[_0x5497('0x46')],{'$or':_[_0x5497('0x37')](_0xc84025['attributes'],function(_0x14fb29){var _0x5e709c={};_0x5e709c[_0x14fb29]={'$like':'%'+_0x639a6a[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x5e709c;})});}_0xc84025=_[_0x5497('0x47')]({},_0xc84025,_0x639a6a[_0x5497('0x48')]);return _0x8fbf4e[_0x5497('0x97')](_0xc84025);}})[_0x5497('0x29')](function(_0x3dce6a){if(_0x3dce6a){_0x5b54ff=_0x3dce6a['length'];if(!_0x639a6a[_0x5497('0x3c')]['hasOwnProperty']('nolimit')){_0xc84025['limit']=qs[_0x5497('0x22')](_0x639a6a[_0x5497('0x3c')][_0x5497('0x22')]);_0xc84025[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x639a6a[_0x5497('0x3c')]['offset']);}return _0x8fbf4e[_0x5497('0x97')](_0xc84025);}})['then'](function(_0x3f9b91){return _0x3f9b91?{'count':_0x5b54ff,'rows':_0x3f9b91}:null;})[_0x5497('0x29')](respondWithResult(_0xa965d1,null))['catch'](handleError(_0xa965d1,null));};exports[_0x5497('0x98')]=function(_0x4a3144,_0x266240,_0x159ef2){var _0x7b8cb2={};var _0x5b10d3={};var _0x5e2697;var _0x1a7fcc;return db[_0x5497('0x38')][_0x5497('0x63')]({'where':{'id':_0x4a3144[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x266240,null))[_0x5497('0x29')](function(_0x11b9ca){if(_0x11b9ca){_0x5e2697=_0x11b9ca;_0x5b10d3[_0x5497('0x3f')]=_['keys'](db[_0x5497('0x99')]['rawAttributes']);_0x5b10d3[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x4a3144[_0x5497('0x3c')]);_0x5b10d3['filters']=_[_0x5497('0x3e')](_0x5b10d3[_0x5497('0x3f')],_0x5b10d3[_0x5497('0x3c')]);_0x7b8cb2[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x5b10d3[_0x5497('0x3f')],qs['fields'](_0x4a3144[_0x5497('0x3c')][_0x5497('0x41')]));_0x7b8cb2[_0x5497('0x40')]=_0x7b8cb2[_0x5497('0x40')][_0x5497('0x42')]?_0x7b8cb2[_0x5497('0x40')]:_0x5b10d3[_0x5497('0x3f')];_0x7b8cb2['order']=qs[_0x5497('0x45')](_0x4a3144['query'][_0x5497('0x45')]);_0x7b8cb2[_0x5497('0x46')]=qs[_0x5497('0x3d')](_[_0x5497('0x5f')](_0x4a3144[_0x5497('0x3c')],_0x5b10d3[_0x5497('0x3d')]));if(_0x4a3144[_0x5497('0x3c')][_0x5497('0x2d')]){_0x7b8cb2[_0x5497('0x46')]=_[_0x5497('0x47')](_0x7b8cb2['where'],{'$or':_[_0x5497('0x37')](_0x7b8cb2[_0x5497('0x40')],function(_0x14cc22){var _0xec3037={};_0xec3037[_0x14cc22]={'$like':'%'+_0x4a3144[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0xec3037;})});}_0x7b8cb2=_['merge']({},_0x7b8cb2,_0x4a3144[_0x5497('0x48')]);return _0x5e2697[_0x5497('0x98')](_0x7b8cb2);}})[_0x5497('0x29')](function(_0x3c25b6){if(_0x3c25b6){_0x1a7fcc=_0x3c25b6['length'];if(!_0x4a3144[_0x5497('0x3c')][_0x5497('0x5e')](_0x5497('0x43'))){_0x7b8cb2[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x4a3144[_0x5497('0x3c')][_0x5497('0x22')]);_0x7b8cb2[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x4a3144[_0x5497('0x3c')]['offset']);}return _0x5e2697[_0x5497('0x98')](_0x7b8cb2);}})[_0x5497('0x29')](function(_0x2c4db5){if(_0x2c4db5){return _0x2c4db5?{'count':_0x1a7fcc,'rows':_0x2c4db5}:null;}})[_0x5497('0x29')](respondWithResult(_0x266240,null))[_0x5497('0x4f')](handleError(_0x266240,null));};exports[_0x5497('0x9a')]=function(_0x34477e,_0x50d866,_0x5b34f8){var _0x9a27e5=moment()[_0x5497('0x7a')](_0x5497('0x9b'));var _0x32bdf1,_0x2304cc;return db['VoiceQueue'][_0x5497('0x4e')]({'where':{'id':_0x34477e[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50d866,null))[_0x5497('0x29')](function(_0x5c9c14){if(_0x5c9c14){_0x2304cc=_0x5c9c14;return _0x5c9c14[_0x5497('0x9a')](_0x34477e[_0x5497('0x50')][_0x5497('0x7e')],_[_0x5497('0x56')](_0x34477e[_0x5497('0x50')],[_0x5497('0x7e'),'id'])||{});}return null;})[_0x5497('0x9c')](function(_0x24e23b){var _0x2cc264;_0x32bdf1=_0x24e23b||[];var _0x55e20d=[];if(_0x24e23b){for(var _0x1a07d2=0x0;_0x1a07d2<_0x24e23b[_0x5497('0x42')];_0x1a07d2+=0x1){var _0x221f31=_0x24e23b[_0x1a07d2][_0x5497('0x2b')]({'plain':!![]});_0x2304cc[_0x5497('0x9d')]=_0x34477e[_0x5497('0x50')][_0x5497('0x9d')]?_0x34477e[_0x5497('0x50')][_0x5497('0x9d')]:_0x2304cc[_0x5497('0x9d')];switch(_0x2304cc[_0x5497('0x9d')]){case'always':_0x2cc264=squel[_0x5497('0x9e')]()[_0x5497('0x9f')](_0x5497('0xa0'))[_0x5497('0xa1')]([_0x5497('0xa2'),_0x5497('0xa3'),_0x5497('0xa4'),'ListId',_0x5497('0x60'),'createdAt',_0x5497('0x58')],squel[_0x5497('0x7f')]()[_0x5497('0x80')](_0x5497('0xa2'),_0x5497('0xa2'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27','scheduledAt')['field']('id',_0x5497('0xa4'))['field'](_0x221f31['CmListId'][_0x5497('0x89')](),_0x5497('0xa5'))[_0x5497('0x80')](_0x34477e[_0x5497('0x4b')]['id'][_0x5497('0x89')](),_0x5497('0x60'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27',_0x5497('0x57'))['field']('\x27'+_0x9a27e5+'\x27',_0x5497('0x58'))[_0x5497('0x81')]('cm_contacts')['where'](_0x5497('0xa6'))['where'](_0x5497('0xa7'),_0x221f31[_0x5497('0xa8')][_0x5497('0x89')]())[_0x5497('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x5497('0x46')](_0x5497('0xa9'),squel[_0x5497('0x7f')]()[_0x5497('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x5497('0x81')]('cm_hopper_final')[_0x5497('0x46')](_0x5497('0x86'),_0x34477e[_0x5497('0x4b')]['id'][_0x5497('0x89')]()))[_0x5497('0x46')](_0x5497('0xa9'),squel[_0x5497('0x7f')]()[_0x5497('0x80')](_0x5497('0xaa'))['from'](_0x5497('0xa0'))[_0x5497('0x46')](_0x5497('0x86'),_0x34477e[_0x5497('0x4b')]['id'][_0x5497('0x89')]())))[_0x5497('0x89')]();break;case _0x5497('0xab'):_0x2cc264=squel[_0x5497('0x9e')]()[_0x5497('0x9f')](_0x5497('0xa0'))[_0x5497('0xa1')](['phone',_0x5497('0xa3'),_0x5497('0xa4'),'ListId','VoiceQueueId','createdAt',_0x5497('0x58')],squel['select']()[_0x5497('0x80')](_0x5497('0xa2'),_0x5497('0xa2'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27','scheduledAt')[_0x5497('0x80')]('id',_0x5497('0xa4'))[_0x5497('0x80')](_0x221f31['CmListId'][_0x5497('0x89')](),'ListId')[_0x5497('0x80')](_0x34477e[_0x5497('0x4b')]['id'][_0x5497('0x89')](),'VoiceQueueId')['field']('\x27'+_0x9a27e5+'\x27',_0x5497('0x57'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27','updatedAt')['from']('cm_contacts')[_0x5497('0x46')](_0x5497('0xa6'))[_0x5497('0x46')](_0x5497('0xa7'),_0x221f31[_0x5497('0xa8')][_0x5497('0x89')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x5497('0x46')](_0x5497('0xa9'),squel['select']()[_0x5497('0x80')](_0x5497('0xaa'))[_0x5497('0x81')](_0x5497('0xa0'))[_0x5497('0x46')](_0x5497('0x86'),_0x34477e[_0x5497('0x4b')]['id'][_0x5497('0x89')]())))[_0x5497('0x89')]();break;default:_0x2cc264=squel[_0x5497('0x9e')]()[_0x5497('0x9f')](_0x5497('0xa0'))[_0x5497('0xa1')](['phone',_0x5497('0xa3'),_0x5497('0xa4'),_0x5497('0xa5'),_0x5497('0x60'),_0x5497('0x57'),_0x5497('0x58')],squel[_0x5497('0x7f')]()[_0x5497('0x80')]('phone','phone')['field']('\x27'+_0x9a27e5+'\x27',_0x5497('0xa3'))['field']('id','ContactId')[_0x5497('0x80')](_0x221f31[_0x5497('0xa8')][_0x5497('0x89')](),_0x5497('0xa5'))['field'](_0x34477e['params']['id'][_0x5497('0x89')](),_0x5497('0x60'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27',_0x5497('0x57'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27',_0x5497('0x58'))[_0x5497('0x81')](_0x5497('0xac'))['where'](_0x5497('0xa6'))[_0x5497('0x46')](_0x5497('0xa7'),_0x221f31[_0x5497('0xa8')][_0x5497('0x89')]())[_0x5497('0x46')](_0x5497('0xad')))[_0x5497('0x89')]();}_0x55e20d[_0x5497('0x87')](db[_0x5497('0x88')][_0x5497('0x3c')](_0x2cc264));}return BPromise[_0x5497('0x8e')](_0x55e20d);}})[_0x5497('0x29')](function(){var _0x47fff0=[];var _0x1d7bbe=squel['insert']()[_0x5497('0x9f')]('cm_hopper_additional_phones')[_0x5497('0xa1')]([_0x5497('0xae'),_0x5497('0xa2'),_0x5497('0xaf'),'createdAt',_0x5497('0x58')],squel[_0x5497('0x7f')]()[_0x5497('0x80')](_0x5497('0xb0'))[_0x5497('0x80')](_0x5497('0xb1'))[_0x5497('0x80')](_0x5497('0xb2'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27',_0x5497('0x57'))[_0x5497('0x80')]('\x27'+_0x9a27e5+'\x27','updatedAt')[_0x5497('0x81')](_0x5497('0xb3'),'ci')[_0x5497('0x83')](_0x5497('0xa0'),'h',_0x5497('0xb4'))[_0x5497('0x46')](_0x5497('0xb5'),_0x9a27e5)[_0x5497('0x46')](_0x5497('0xb6'),'PHONE'))[_0x5497('0x89')]();_0x47fff0[_0x5497('0x87')](db[_0x5497('0x88')][_0x5497('0x3c')](_0x1d7bbe));return BPromise[_0x5497('0x8e')](_0x47fff0);})[_0x5497('0x29')](function(){return _0x32bdf1;})['then'](respondWithResult(_0x50d866,null))[_0x5497('0x4f')](handleError(_0x50d866,null));};exports[_0x5497('0xb7')]=function(_0x52e20f,_0x2b6c18,_0x1abf52){return db[_0x5497('0x38')][_0x5497('0x4e')]({'where':{'id':_0x52e20f[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x2b6c18,null))[_0x5497('0x29')](function(_0x23f3c3){if(_0x23f3c3){return _0x23f3c3[_0x5497('0xb7')](_0x52e20f[_0x5497('0x3c')][_0x5497('0x7e')]);}})[_0x5497('0x29')](function(_0x43d177){if(_0x43d177){return db[_0x5497('0x61')][_0x5497('0x2a')]({'where':{'ListId':_0x52e20f[_0x5497('0x3c')][_0x5497('0x7e')],'VoiceQueueId':_0x52e20f[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](function(){return _0x43d177;});}})['then'](respondWithStatusCode(_0x2b6c18,null))[_0x5497('0x4f')](handleError(_0x2b6c18,null));};exports[_0x5497('0xb8')]=function(_0x6d4dce,_0x4e9070,_0x59b5e9){var _0x25f8da={};var _0x4bdd3c={};var _0x39ecf7;var _0x41eb15;return db['VoiceQueue'][_0x5497('0x63')]({'where':{'id':_0x6d4dce['params']['id']}})['then'](handleEntityNotFound(_0x4e9070,null))[_0x5497('0x29')](function(_0x40f785){if(_0x40f785){_0x39ecf7=_0x40f785;_0x4bdd3c[_0x5497('0x3f')]=_['keys'](db[_0x5497('0x99')][_0x5497('0x39')]);_0x4bdd3c[_0x5497('0x3c')]=_[_0x5497('0x4c')](_0x6d4dce[_0x5497('0x3c')]);_0x4bdd3c['filters']=_[_0x5497('0x3e')](_0x4bdd3c[_0x5497('0x3f')],_0x4bdd3c[_0x5497('0x3c')]);_0x25f8da[_0x5497('0x40')]=_[_0x5497('0x3e')](_0x4bdd3c['model'],qs[_0x5497('0x41')](_0x6d4dce[_0x5497('0x3c')][_0x5497('0x41')]));_0x25f8da[_0x5497('0x40')]=_0x25f8da[_0x5497('0x40')][_0x5497('0x42')]?_0x25f8da[_0x5497('0x40')]:_0x4bdd3c[_0x5497('0x3f')];_0x25f8da[_0x5497('0x44')]=qs[_0x5497('0x45')](_0x6d4dce[_0x5497('0x3c')][_0x5497('0x45')]);_0x25f8da[_0x5497('0x46')]=qs['filters'](_[_0x5497('0x5f')](_0x6d4dce[_0x5497('0x3c')],_0x4bdd3c[_0x5497('0x3d')]));if(_0x6d4dce[_0x5497('0x3c')]['filter']){_0x25f8da['where']=_[_0x5497('0x47')](_0x25f8da[_0x5497('0x46')],{'$or':_['map'](_0x25f8da[_0x5497('0x40')],function(_0x3aa687){var _0x33db5b={};_0x33db5b[_0x3aa687]={'$like':'%'+_0x6d4dce[_0x5497('0x3c')][_0x5497('0x2d')]+'%'};return _0x33db5b;})});}_0x25f8da=_[_0x5497('0x47')]({},_0x25f8da,_0x6d4dce[_0x5497('0x48')]);return _0x39ecf7[_0x5497('0xb8')](_0x25f8da);}})['then'](function(_0x3bd65d){if(_0x3bd65d){_0x41eb15=_0x3bd65d[_0x5497('0x42')];if(!_0x6d4dce[_0x5497('0x3c')][_0x5497('0x5e')]('nolimit')){_0x25f8da[_0x5497('0x22')]=qs[_0x5497('0x22')](_0x6d4dce['query']['limit']);_0x25f8da[_0x5497('0x21')]=qs[_0x5497('0x21')](_0x6d4dce[_0x5497('0x3c')][_0x5497('0x21')]);}return _0x39ecf7[_0x5497('0xb8')](_0x25f8da);}})[_0x5497('0x29')](function(_0x53454a){if(_0x53454a){return _0x53454a?{'count':_0x41eb15,'rows':_0x53454a}:null;}})[_0x5497('0x29')](respondWithResult(_0x4e9070,null))[_0x5497('0x4f')](handleError(_0x4e9070,null));};exports[_0x5497('0xb9')]=function(_0x3c8b98,_0x410e61,_0x2293e2){var _0xae08ab,_0x154445;return db[_0x5497('0x38')][_0x5497('0x4e')]({'where':{'id':_0x3c8b98['params']['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x410e61,null))[_0x5497('0x29')](function(_0x55a872){if(_0x55a872){_0x154445=_0x55a872;return _0x55a872[_0x5497('0xb9')](_0x3c8b98[_0x5497('0x50')][_0x5497('0x7e')],_[_0x5497('0x56')](_0x3c8b98[_0x5497('0x50')],[_0x5497('0x7e'),'id'])||{});}return null;})['spread'](function(_0x29fce9){var _0x29aa6c;_0xae08ab=_0x29fce9||[];var _0x348139=[];if(_0x29fce9){for(var _0x1d9a73=0x0;_0x1d9a73<_0x29fce9[_0x5497('0x42')];_0x1d9a73+=0x1){var _0xa0d2b4=_0x29fce9[_0x1d9a73]['get']({'plain':!![]});_0x29aa6c=squel[_0x5497('0x9e')]()[_0x5497('0x9f')]('cm_hopper_black')[_0x5497('0xa1')]([_0x5497('0xa2'),'ContactId',_0x5497('0xa5'),_0x5497('0x60'),_0x5497('0x57'),_0x5497('0x58')],squel['select']()[_0x5497('0x80')](_0x5497('0xa2'),_0x5497('0xa2'))['field']('id',_0x5497('0xa4'))[_0x5497('0x80')](_0xa0d2b4['CmListId'][_0x5497('0x89')](),_0x5497('0xa5'))[_0x5497('0x80')](_0x3c8b98[_0x5497('0x4b')]['id'][_0x5497('0x89')](),_0x5497('0x60'))[_0x5497('0x80')](_0x5497('0xba'),_0x5497('0x57'))[_0x5497('0x80')]('NOW()','updatedAt')[_0x5497('0x81')](_0x5497('0xac'))['where'](_0x5497('0xa6'))[_0x5497('0x46')](_0x5497('0xa7'),_0xa0d2b4['CmListId'][_0x5497('0x89')]())[_0x5497('0x46')](_0x5497('0xad')))[_0x5497('0x89')]();_0x348139[_0x5497('0x87')](db[_0x5497('0x88')][_0x5497('0x3c')](_0x29aa6c));}return BPromise[_0x5497('0x8e')](_0x348139);}})[_0x5497('0x29')](function(){return _0xae08ab;})[_0x5497('0x29')](respondWithResult(_0x410e61,null))[_0x5497('0x4f')](handleError(_0x410e61,null));};exports['removeBlackLists']=function(_0x1821e6,_0x4902ff,_0x5c7a8a){return db['VoiceQueue'][_0x5497('0x4e')]({'where':{'id':_0x1821e6[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](handleEntityNotFound(_0x4902ff,null))[_0x5497('0x29')](function(_0x39ecdf){if(_0x39ecdf){return _0x39ecdf[_0x5497('0xbb')](_0x1821e6[_0x5497('0x3c')][_0x5497('0x7e')]);}})[_0x5497('0x29')](function(_0x1eddcc){if(_0x1eddcc){return db[_0x5497('0x68')][_0x5497('0x2a')]({'where':{'ListId':_0x1821e6[_0x5497('0x3c')][_0x5497('0x7e')],'VoiceQueueId':_0x1821e6[_0x5497('0x4b')]['id']}})[_0x5497('0x29')](function(){return _0x1eddcc;});}})['then'](respondWithStatusCode(_0x4902ff,null))[_0x5497('0x4f')](handleError(_0x4902ff,null));}; \ No newline at end of file +var _0xed5c=['length','nolimit','order','sort','pick','where','merge','count','includeAll','include','VoiceQueue','rows','catch','show','params','create','body','role','user','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','type','name','UserProfileResource','destroy','end','error','stack','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x527845,_0x526c4e){var _0x2187ba=function(_0x183888){while(--_0x183888){_0x527845['push'](_0x527845['shift']());}};_0x2187ba(++_0x526c4e);}(_0xed5c,0x81));var _0xced5=function(_0x7d76e3,_0x5850ea){_0x7d76e3=_0x7d76e3-0x0;var _0x32edb8=_0xed5c[_0x7d76e3];return _0x32edb8;};'use strict';var emlformat=require(_0xced5('0x0'));var rimraf=require(_0xced5('0x1'));var zipdir=require(_0xced5('0x2'));var jsonpatch=require(_0xced5('0x3'));var rp=require(_0xced5('0x4'));var moment=require(_0xced5('0x5'));var BPromise=require(_0xced5('0x6'));var Mustache=require(_0xced5('0x7'));var util=require(_0xced5('0x8'));var path=require(_0xced5('0x9'));var sox=require('sox');var csv=require(_0xced5('0xa'));var ejs=require(_0xced5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xced5('0xc'));var crypto=require(_0xced5('0xd'));var jsforce=require(_0xced5('0xe'));var deskjs=require(_0xced5('0xf'));var toCsv=require(_0xced5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xced5('0x10'));var authService=require(_0xced5('0x11'));var qs=require(_0xced5('0x12'));var as=require(_0xced5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced5('0x14'))('api');var utils=require(_0xced5('0x15'));var config=require(_0xced5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xced5('0x17'))['db'];config['redis']=_[_0xced5('0x18')](config[_0xced5('0x19')],{'host':_0xced5('0x1a'),'port':0x18eb});var socket=require(_0xced5('0x1b'))(new Redis(config[_0xced5('0x19')]));require(_0xced5('0x1c'))[_0xced5('0x1d')](socket);function respondWithStatusCode(_0x4bee02,_0x4b2533){_0x4b2533=_0x4b2533||0xcc;return function(_0x23ca09){if(_0x23ca09){return _0x4bee02[_0xced5('0x1e')](_0x4b2533);}return _0x4bee02[_0xced5('0x1f')](_0x4b2533)['end']();};}function respondWithResult(_0x4fa2a3,_0x456843){_0x456843=_0x456843||0xc8;return function(_0x1c8c90){if(_0x1c8c90){return _0x4fa2a3[_0xced5('0x1f')](_0x456843)[_0xced5('0x20')](_0x1c8c90);}};}function respondWithFilteredResult(_0x17e4eb,_0x13928f){return function(_0x54c5a4){if(_0x54c5a4){var _0x29a3ba=typeof _0x13928f[_0xced5('0x21')]==='undefined'&&typeof _0x13928f[_0xced5('0x22')]===_0xced5('0x23');var _0x14e3ec=_0x54c5a4['count'];var _0x127eb4=_0x29a3ba?0x0:_0x13928f[_0xced5('0x21')];var _0x2a5aca=_0x29a3ba?_0x54c5a4['count']:_0x13928f[_0xced5('0x21')]+_0x13928f[_0xced5('0x22')];var _0xf84ec;if(_0x2a5aca>=_0x14e3ec){_0x2a5aca=_0x14e3ec;_0xf84ec=0xc8;}else{_0xf84ec=0xce;}_0x17e4eb[_0xced5('0x1f')](_0xf84ec);return _0x17e4eb[_0xced5('0x24')](_0xced5('0x25'),_0x127eb4+'-'+_0x2a5aca+'/'+_0x14e3ec)['json'](_0x54c5a4);}return null;};}function patchUpdates(_0x1ba520){return function(_0x4a56a4){try{jsonpatch[_0xced5('0x26')](_0x4a56a4,_0x1ba520,!![]);}catch(_0x5b11c5){return BPromise[_0xced5('0x27')](_0x5b11c5);}return _0x4a56a4[_0xced5('0x28')]();};}function saveUpdates(_0x1c18e0,_0x45766f){return function(_0xe536f8){if(_0xe536f8){return _0xe536f8[_0xced5('0x29')](_0x1c18e0)[_0xced5('0x2a')](function(_0x2f092b){return _0x2f092b;});}return null;};}function removeEntity(_0x548cbb,_0x92ac47){return function(_0x4de26f){if(_0x4de26f){return _0x4de26f['destroy']()[_0xced5('0x2a')](function(){var _0x2cd6c4=_0x4de26f[_0xced5('0x2b')]({'plain':!![]});var _0x2e4774=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d'),'ignore':![]},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f'),'ignore':![]}];var _0x239b32=_(_0x2e4774)[_0xced5('0x30')](_0xced5('0x31'))['map'](_0xced5('0x32'))[_0xced5('0x32')]();if(_['includes'](_0x239b32,_0x2cd6c4['type'])){return;}var _0x499040=_['find'](_0x2e4774,[_0xced5('0x32'),_0x2cd6c4[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x35')][_0xced5('0x36')]({'where':{'type':_0x499040,'resourceId':_0x2cd6c4['id']}})['then'](function(){return _0x4de26f;});})[_0xced5('0x2a')](function(){_0x548cbb['status'](0xcc)[_0xced5('0x37')]();});}};}function handleEntityNotFound(_0x1fa141,_0x4d56c6){return function(_0x5d8f4f){if(!_0x5d8f4f){_0x1fa141[_0xced5('0x1e')](0x194);}return _0x5d8f4f;};}function handleError(_0x579b4a,_0x2faacb){_0x2faacb=_0x2faacb||0x1f4;return function(_0x3bd7d5){logger[_0xced5('0x38')](_0x3bd7d5[_0xced5('0x39')]);if(_0x3bd7d5[_0xced5('0x34')]){delete _0x3bd7d5[_0xced5('0x34')];}_0x579b4a[_0xced5('0x1f')](_0x2faacb)['send'](_0x3bd7d5);};}exports[_0xced5('0x3a')]=function(_0x213569,_0x5dca26){var _0x39fb2c={},_0x3ff95d={},_0x542afe={'count':0x0,'rows':[]};var _0x288ab0=_[_0xced5('0x3b')](db['VoiceQueue'][_0xced5('0x3c')],function(_0x4ea2fa){return{'name':_0x4ea2fa[_0xced5('0x3d')],'type':_0x4ea2fa['type'][_0xced5('0x3e')]};});_0x3ff95d[_0xced5('0x3f')]=_['map'](_0x288ab0,'name');_0x3ff95d[_0xced5('0x40')]=_[_0xced5('0x41')](_0x213569['query']);_0x3ff95d[_0xced5('0x42')]=_[_0xced5('0x43')](_0x3ff95d['model'],_0x3ff95d[_0xced5('0x40')]);_0x39fb2c[_0xced5('0x44')]=_[_0xced5('0x43')](_0x3ff95d['model'],qs[_0xced5('0x45')](_0x213569[_0xced5('0x40')][_0xced5('0x45')]));_0x39fb2c['attributes']=_0x39fb2c[_0xced5('0x44')][_0xced5('0x46')]?_0x39fb2c[_0xced5('0x44')]:_0x3ff95d['model'];if(!_0x213569[_0xced5('0x40')]['hasOwnProperty'](_0xced5('0x47'))){_0x39fb2c[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x213569[_0xced5('0x40')][_0xced5('0x22')]);_0x39fb2c[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x213569['query'][_0xced5('0x21')]);}_0x39fb2c[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x213569['query'][_0xced5('0x49')]);_0x39fb2c['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x213569[_0xced5('0x40')],_0x3ff95d[_0xced5('0x42')]),_0x288ab0);if(_0x213569[_0xced5('0x40')][_0xced5('0x30')]){_0x39fb2c[_0xced5('0x4b')]=_['merge'](_0x39fb2c[_0xced5('0x4b')],{'$or':_['map'](_0x288ab0,function(_0x466e6a){if(_0x466e6a[_0xced5('0x33')]!=='VIRTUAL'){var _0x2f2a57={};_0x2f2a57[_0x466e6a[_0xced5('0x34')]]={'$like':'%'+_0x213569[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x2f2a57;}})});}_0x39fb2c=_[_0xced5('0x4c')]({},_0x39fb2c,_0x213569['options']);var _0x53636f={'where':_0x39fb2c[_0xced5('0x4b')]};return db['VoiceQueue'][_0xced5('0x4d')](_0x53636f)[_0xced5('0x2a')](function(_0xf38fab){_0x542afe[_0xced5('0x4d')]=_0xf38fab;if(_0x213569[_0xced5('0x40')][_0xced5('0x4e')]){_0x39fb2c[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x50')]['findAll'](_0x39fb2c);})['then'](function(_0x5c8a1c){_0x542afe[_0xced5('0x51')]=_0x5c8a1c;return _0x542afe;})[_0xced5('0x2a')](respondWithFilteredResult(_0x5dca26,_0x39fb2c))[_0xced5('0x52')](handleError(_0x5dca26,null));};exports[_0xced5('0x53')]=function(_0x1849b9,_0x1539a2){var _0xeb8839={'raw':![],'where':{'id':_0x1849b9[_0xced5('0x54')]['id']}},_0x1cab90={};_0x1cab90[_0xced5('0x3f')]=_[_0xced5('0x41')](db['VoiceQueue'][_0xced5('0x3c')]);_0x1cab90[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1849b9[_0xced5('0x40')]);_0x1cab90[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1cab90['model'],_0x1cab90[_0xced5('0x40')]);_0xeb8839[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1cab90[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1849b9[_0xced5('0x40')][_0xced5('0x45')]));_0xeb8839[_0xced5('0x44')]=_0xeb8839['attributes'][_0xced5('0x46')]?_0xeb8839[_0xced5('0x44')]:_0x1cab90[_0xced5('0x3f')];if(_0x1849b9[_0xced5('0x40')][_0xced5('0x4e')]){_0xeb8839[_0xced5('0x4f')]=[{'all':!![]}];}_0xeb8839=_['merge']({},_0xeb8839,_0x1849b9['options']);return db[_0xced5('0x50')]['find'](_0xeb8839)[_0xced5('0x2a')](handleEntityNotFound(_0x1539a2,null))['then'](respondWithResult(_0x1539a2,null))[_0xced5('0x52')](handleError(_0x1539a2,null));};exports['create']=function(_0xbefa95,_0xfda45c){return db[_0xced5('0x50')][_0xced5('0x55')](_0xbefa95[_0xced5('0x56')],{})[_0xced5('0x2a')](function(_0xcb1ec1){var _0x3a958f=_0xbefa95['user'][_0xced5('0x2b')]({'plain':!![]});if(!_0x3a958f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a958f[_0xced5('0x57')]===_0xced5('0x58')){var _0x4a47bb=_0xcb1ec1[_0xced5('0x2b')]({'plain':!![]});var _0x50e559=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d')},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f')}];var _0x590def=_[_0xced5('0x59')](_0x50e559,[_0xced5('0x32'),_0x4a47bb[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x5a')]['find']({'where':{'name':_0x590def,'userProfileId':_0x3a958f[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0xd6315d){if(_0xd6315d&&_0xd6315d[_0xced5('0x5c')]===0x0){return db[_0xced5('0x35')][_0xced5('0x55')]({'name':_0x4a47bb[_0xced5('0x34')],'resourceId':_0x4a47bb['id'],'type':_0xd6315d[_0xced5('0x34')],'sectionId':_0xd6315d['id']},{})[_0xced5('0x2a')](function(){return _0xcb1ec1;});}else{return _0xcb1ec1;}})[_0xced5('0x52')](function(_0x442094){logger[_0xced5('0x38')](_0xced5('0x5d'),_0x442094);throw _0x442094;});}return _0xcb1ec1;})[_0xced5('0x2a')](respondWithResult(_0xfda45c,0xc9))[_0xced5('0x52')](handleError(_0xfda45c,null));};exports[_0xced5('0x5e')]=function(_0x8301b8,_0x4a6e1d){var _0x44cb19={'where':{'id':_0x8301b8[_0xced5('0x54')]['id']}},_0x11f019={};_0x11f019[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x50')]['rawAttributes']);_0x44cb19[_0xced5('0x44')]=_['intersection'](_0x11f019[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x8301b8[_0xced5('0x40')][_0xced5('0x45')]));_0x44cb19[_0xced5('0x44')]=_0x44cb19[_0xced5('0x44')]['length']?_0x44cb19[_0xced5('0x44')]:_0x11f019[_0xced5('0x3f')];if(_0x8301b8['query'][_0xced5('0x4e')]){_0x44cb19['include']=[{'all':!![]}];}_0x44cb19=_['merge']({},_0x44cb19,_0x8301b8[_0xced5('0x5f')]);return db[_0xced5('0x50')][_0xced5('0x59')](_0x44cb19)[_0xced5('0x2a')](handleEntityNotFound(_0x4a6e1d,null))['then'](function(_0x2259d2){if(_0x2259d2){var _0xea78be=_0x2259d2[_0xced5('0x2b')]({'plain':!![]});_0xea78be=qs['omit'](_0xea78be,['id',_0xced5('0x60'),_0xced5('0x61')]);_0x8301b8['body']=_['omit'](_0x8301b8[_0xced5('0x56')],['id',_0xced5('0x60'),'updatedAt']);return db['VoiceQueue'][_0xced5('0x55')](_[_0xced5('0x4c')](_0xea78be,_0x8301b8[_0xced5('0x56')]),{'include':_0x8301b8['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x426b3b){var _0x599327=_0x8301b8[_0xced5('0x58')][_0xced5('0x2b')]({'plain':!![]});if(!_0x599327)throw new Error(_0xced5('0x62'));if(_0x599327[_0xced5('0x57')]===_0xced5('0x58')){var _0x50d5fd=_0x426b3b[_0xced5('0x2b')]({'plain':!![]});var _0x448a33=[{'name':_0xced5('0x2c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xced5('0x2f')}];var _0x4dde63=_['find'](_0x448a33,[_0xced5('0x32'),_0x50d5fd['type']])[_0xced5('0x34')];return db['UserProfileSection'][_0xced5('0x59')]({'where':{'name':_0x4dde63,'userProfileId':_0x599327[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0x39a7f2){if(_0x39a7f2&&_0x39a7f2[_0xced5('0x5c')]===0x0){return db['UserProfileResource'][_0xced5('0x55')]({'name':_0x50d5fd[_0xced5('0x34')],'resourceId':_0x50d5fd['id'],'type':_0x39a7f2['name'],'sectionId':_0x39a7f2['id']},{})[_0xced5('0x2a')](function(){return _0x426b3b;});}else{return _0x426b3b;}})[_0xced5('0x52')](function(_0x546420){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x546420);throw _0x546420;});}return _0x426b3b;});}})[_0xced5('0x2a')](respondWithResult(_0x4a6e1d,0xc9))[_0xced5('0x52')](handleError(_0x4a6e1d,null));};exports[_0xced5('0x29')]=function(_0x3f202c,_0x248535){if(_0x3f202c[_0xced5('0x56')]['id']){delete _0x3f202c[_0xced5('0x56')]['id'];}return db[_0xced5('0x50')]['find']({'where':{'id':_0x3f202c[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x248535,null))[_0xced5('0x2a')](saveUpdates(_0x3f202c[_0xced5('0x56')],null))[_0xced5('0x2a')](respondWithResult(_0x248535,null))[_0xced5('0x52')](handleError(_0x248535,null));};exports[_0xced5('0x36')]=function(_0x425a1e,_0x474b1f){return db[_0xced5('0x50')]['find']({'where':{'id':_0x425a1e['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x474b1f,null))[_0xced5('0x2a')](removeEntity(_0x474b1f,null))[_0xced5('0x52')](handleError(_0x474b1f,null));};exports[_0xced5('0x63')]=function(_0x43abb9,_0x35a2d6,_0x5ed3bc){var _0x3dcfbc={'raw':![],'where':{}};var _0x216223={};var _0x451e90={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x43abb9['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x35a2d6,null))[_0xced5('0x2a')](function(_0x5d80d5){if(_0x5d80d5){_0x216223[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x65')][_0xced5('0x3c')]);_0x216223['query']=_[_0xced5('0x41')](_0x43abb9[_0xced5('0x40')]);_0x216223['filters']=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],_0x216223[_0xced5('0x40')]);_0x3dcfbc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x43abb9[_0xced5('0x40')]['fields']));_0x3dcfbc[_0xced5('0x44')]=_0x3dcfbc[_0xced5('0x44')]['length']?_0x3dcfbc[_0xced5('0x44')]:_0x216223[_0xced5('0x3f')];if(!_0x43abb9['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x3dcfbc['limit']=qs[_0xced5('0x22')](_0x43abb9[_0xced5('0x40')]['limit']);_0x3dcfbc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x43abb9[_0xced5('0x40')][_0xced5('0x21')]);}_0x3dcfbc[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x43abb9[_0xced5('0x40')][_0xced5('0x49')]);_0x3dcfbc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x43abb9[_0xced5('0x40')],_0x216223[_0xced5('0x42')]));_0x3dcfbc[_0xced5('0x4b')][_0xced5('0x67')]=_0x5d80d5['id'];if(_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]){_0x3dcfbc[_0xced5('0x4b')]=_['merge'](_0x3dcfbc['where'],{'$or':_[_0xced5('0x3b')](_0x3dcfbc[_0xced5('0x44')],function(_0x38abe9){var _0x262d48={};_0x262d48[_0x38abe9]={'$like':'%'+_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x262d48;})});}_0x3dcfbc=_[_0xced5('0x4c')]({},_0x3dcfbc,_0x43abb9['options']);return db['CmHopper'][_0xced5('0x4d')]({'where':_0x3dcfbc['where']})[_0xced5('0x2a')](function(_0x2f9ae5){_0x451e90[_0xced5('0x4d')]=_0x2f9ae5;if(_0x43abb9[_0xced5('0x40')]['includeAll']){_0x3dcfbc[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x65')]['findAll'](_0x3dcfbc);})[_0xced5('0x2a')](function(_0x4bb793){_0x451e90[_0xced5('0x51')]=_0x4bb793;return _0x451e90;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x35a2d6,_0x3dcfbc))[_0xced5('0x52')](handleError(_0x35a2d6,null));};exports['getHopperHistories']=function(_0x38512b,_0x59b8ca,_0xcf0652){var _0x5e9b3f={'raw':!![],'where':{}};var _0x426915={};var _0x4eeb79={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x38512b['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x59b8ca,null))[_0xced5('0x2a')](function(_0x33bd7e){if(_0x33bd7e){_0x426915[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x68')][_0xced5('0x3c')]);_0x426915[_0xced5('0x40')]=_[_0xced5('0x41')](_0x38512b['query']);_0x426915[_0xced5('0x42')]=_[_0xced5('0x43')](_0x426915[_0xced5('0x3f')],_0x426915[_0xced5('0x40')]);_0x5e9b3f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x426915['model'],qs[_0xced5('0x45')](_0x38512b['query'][_0xced5('0x45')]));_0x5e9b3f[_0xced5('0x44')]=_0x5e9b3f[_0xced5('0x44')][_0xced5('0x46')]?_0x5e9b3f[_0xced5('0x44')]:_0x426915[_0xced5('0x3f')];if(!_0x38512b[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x5e9b3f[_0xced5('0x22')]=qs['limit'](_0x38512b['query'][_0xced5('0x22')]);_0x5e9b3f['offset']=qs[_0xced5('0x21')](_0x38512b['query']['offset']);}_0x5e9b3f[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x38512b[_0xced5('0x40')]['sort']);_0x5e9b3f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x38512b[_0xced5('0x40')],_0x426915['filters']));_0x5e9b3f[_0xced5('0x4b')]['VoiceQueueId']=_0x33bd7e['id'];if(_0x38512b[_0xced5('0x40')]['filter']){_0x5e9b3f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x5e9b3f[_0xced5('0x4b')],{'$or':_['map'](_0x5e9b3f['attributes'],function(_0x5fcbed){var _0x1f412a={};_0x1f412a[_0x5fcbed]={'$like':'%'+_0x38512b['query'][_0xced5('0x30')]+'%'};return _0x1f412a;})});}_0x5e9b3f=_[_0xced5('0x4c')]({},_0x5e9b3f,_0x38512b[_0xced5('0x5f')]);return db[_0xced5('0x68')][_0xced5('0x4d')]({'where':_0x5e9b3f[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x247b1e){_0x4eeb79[_0xced5('0x4d')]=_0x247b1e;if(_0x38512b[_0xced5('0x40')][_0xced5('0x4e')]){_0x5e9b3f[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x68')][_0xced5('0x69')](_0x5e9b3f);})[_0xced5('0x2a')](function(_0x582ef4){_0x4eeb79[_0xced5('0x51')]=_0x582ef4;return _0x4eeb79;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x59b8ca,_0x5e9b3f))[_0xced5('0x52')](handleError(_0x59b8ca,null));};exports[_0xced5('0x6a')]=function(_0x1c9857,_0x289ae2,_0xe8e587){var _0xd6dcbd={'raw':!![],'where':{}};var _0x302405={};var _0x535f56={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1c9857[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x289ae2,null))[_0xced5('0x2a')](function(_0x3380bd){if(_0x3380bd){_0x302405[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x6b')][_0xced5('0x3c')]);_0x302405[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1c9857[_0xced5('0x40')]);_0x302405['filters']=_['intersection'](_0x302405[_0xced5('0x3f')],_0x302405['query']);_0xd6dcbd['attributes']=_[_0xced5('0x43')](_0x302405['model'],qs[_0xced5('0x45')](_0x1c9857['query'][_0xced5('0x45')]));_0xd6dcbd['attributes']=_0xd6dcbd['attributes'][_0xced5('0x46')]?_0xd6dcbd[_0xced5('0x44')]:_0x302405['model'];if(!_0x1c9857[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0xd6dcbd[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1c9857[_0xced5('0x40')][_0xced5('0x22')]);_0xd6dcbd[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x1c9857[_0xced5('0x40')]['offset']);}_0xd6dcbd[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x1c9857[_0xced5('0x40')][_0xced5('0x49')]);_0xd6dcbd[_0xced5('0x4b')]=qs['filters'](_['pick'](_0x1c9857['query'],_0x302405[_0xced5('0x42')]));_0xd6dcbd['where'][_0xced5('0x67')]=_0x3380bd['id'];if(_0x1c9857['query']['filter']){_0xd6dcbd['where']=_[_0xced5('0x4c')](_0xd6dcbd['where'],{'$or':_['map'](_0xd6dcbd[_0xced5('0x44')],function(_0x31c1e1){var _0x5631a1={};_0x5631a1[_0x31c1e1]={'$like':'%'+_0x1c9857[_0xced5('0x40')]['filter']+'%'};return _0x5631a1;})});}_0xd6dcbd=_[_0xced5('0x4c')]({},_0xd6dcbd,_0x1c9857[_0xced5('0x5f')]);return db['CmHopperFinal'][_0xced5('0x4d')]({'where':_0xd6dcbd['where']})[_0xced5('0x2a')](function(_0x19753a){_0x535f56['count']=_0x19753a;if(_0x1c9857[_0xced5('0x40')][_0xced5('0x4e')]){_0xd6dcbd['include']=[{'all':!![]}];}return db[_0xced5('0x6b')]['findAll'](_0xd6dcbd);})[_0xced5('0x2a')](function(_0x482575){_0x535f56['rows']=_0x482575;return _0x535f56;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x289ae2,_0xd6dcbd))[_0xced5('0x52')](handleError(_0x289ae2,null));};exports['getHopperBlacks']=function(_0x1286d9,_0x44608e,_0x27ffad){var _0x7aac76={'raw':!![],'where':{}};var _0x31d78b={};var _0x206f87={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1286d9[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x44608e,null))[_0xced5('0x2a')](function(_0x52f53a){if(_0x52f53a){_0x31d78b['model']=_[_0xced5('0x41')](db[_0xced5('0x6c')][_0xced5('0x3c')]);_0x31d78b[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1286d9['query']);_0x31d78b[_0xced5('0x42')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],_0x31d78b['query']);_0x7aac76[_0xced5('0x44')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1286d9[_0xced5('0x40')][_0xced5('0x45')]));_0x7aac76[_0xced5('0x44')]=_0x7aac76['attributes'][_0xced5('0x46')]?_0x7aac76[_0xced5('0x44')]:_0x31d78b[_0xced5('0x3f')];if(!_0x1286d9[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x7aac76[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1286d9['query'][_0xced5('0x22')]);_0x7aac76[_0xced5('0x21')]=qs['offset'](_0x1286d9[_0xced5('0x40')][_0xced5('0x21')]);}_0x7aac76[_0xced5('0x48')]=qs['sort'](_0x1286d9['query'][_0xced5('0x49')]);_0x7aac76[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x1286d9['query'],_0x31d78b[_0xced5('0x42')]));_0x7aac76['where'][_0xced5('0x67')]=_0x52f53a['id'];if(_0x1286d9['query']['filter']){_0x7aac76[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x7aac76[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x7aac76['attributes'],function(_0x541062){var _0x33646e={};_0x33646e[_0x541062]={'$like':'%'+_0x1286d9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x33646e;})});}_0x7aac76=_[_0xced5('0x4c')]({},_0x7aac76,_0x1286d9[_0xced5('0x5f')]);return db[_0xced5('0x6c')][_0xced5('0x4d')]({'where':_0x7aac76[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x13ad22){_0x206f87[_0xced5('0x4d')]=_0x13ad22;if(_0x1286d9['query'][_0xced5('0x4e')]){_0x7aac76[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x6c')]['findAll'](_0x7aac76);})[_0xced5('0x2a')](function(_0x4a5e13){_0x206f87['rows']=_0x4a5e13;return _0x206f87;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x44608e,_0x7aac76))[_0xced5('0x52')](handleError(_0x44608e,null));};exports[_0xced5('0x6d')]=function(_0x151721,_0x5dd260,_0x2845af){var _0x4ce63f={};var _0x35668a={};var _0x338639;var _0x25dbb9;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x151721[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x5dd260,null))['then'](function(_0x5c2a19){if(_0x5c2a19){_0x338639=_0x5c2a19;_0x35668a['model']=_[_0xced5('0x41')](db[_0xced5('0x6e')][_0xced5('0x3c')]);_0x35668a[_0xced5('0x40')]=_[_0xced5('0x41')](_0x151721[_0xced5('0x40')]);_0x35668a[_0xced5('0x42')]=_[_0xced5('0x43')](_0x35668a['model'],_0x35668a[_0xced5('0x40')]);_0x4ce63f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x35668a[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x151721[_0xced5('0x40')]['fields']));_0x4ce63f[_0xced5('0x44')]=_0x4ce63f[_0xced5('0x44')]['length']?_0x4ce63f['attributes']:_0x35668a[_0xced5('0x3f')];_0x4ce63f['order']=qs['sort'](_0x151721[_0xced5('0x40')][_0xced5('0x49')]);_0x4ce63f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x151721[_0xced5('0x40')],_0x35668a[_0xced5('0x42')]));if(_0x151721[_0xced5('0x40')]['filter']){_0x4ce63f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x4ce63f['where'],{'$or':_[_0xced5('0x3b')](_0x4ce63f[_0xced5('0x44')],function(_0x4a8b34){var _0x51d710={};_0x51d710[_0x4a8b34]={'$like':'%'+_0x151721['query'][_0xced5('0x30')]+'%'};return _0x51d710;})});}_0x4ce63f=_[_0xced5('0x4c')]({},_0x4ce63f,_0x151721[_0xced5('0x5f')]);return _0x338639[_0xced5('0x6d')](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x3bed24){if(_0x3bed24){_0x25dbb9=_0x3bed24[_0xced5('0x46')];if(!_0x151721['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x4ce63f[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x151721[_0xced5('0x40')][_0xced5('0x22')]);_0x4ce63f[_0xced5('0x21')]=qs['offset'](_0x151721[_0xced5('0x40')]['offset']);}return _0x338639['getTeams'](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x44a238){if(_0x44a238){return _0x44a238?{'count':_0x25dbb9,'rows':_0x44a238}:null;}})[_0xced5('0x2a')](respondWithResult(_0x5dd260,null))[_0xced5('0x52')](handleError(_0x5dd260,null));};exports[_0xced5('0x6f')]=function(_0x40f724,_0x5e4e68,_0x512f23){var _0x573eb6=_0x40f724['body']['teams'];var _0x530bbc=_['map'](_0x573eb6,'id');return db[_0xced5('0x6e')]['findAll']({'where':{'id':_0x530bbc},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),'voicePause',_0xced5('0x73')],'raw':!![]}]})[_0xced5('0x2a')](function(_0x590f82){if(_0x590f82){var _0x575456=_[_0xced5('0x74')](_0x590f82,function(_0x1138b){var _0x973ffd=_0x1138b[_0xced5('0x2b')]({'plain':!![]});_0x973ffd[_0xced5('0x71')][_0xced5('0x75')](function(_0x37efb8){_0x37efb8['penalty']=_['find'](_0x573eb6,{'id':_0x973ffd['id']})[_0xced5('0x76')];});return _0x973ffd[_0xced5('0x71')];});return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x40f724[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(_0x2aa01c){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x52d75b){return _0x2aa01c['addTeams'](_0x530bbc,{'transaction':_0x52d75b})[_0xced5('0x2a')](function(){return BPromise[_0xced5('0x79')](_0x573eb6,function(_0x52d165){return db[_0xced5('0x7a')][_0xced5('0x7b')]({'TeamId':_0x52d165['id'],'VoiceQueueId':_0x40f724[_0xced5('0x54')]['id'],'penalty':_0x52d165[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){return BPromise['each'](_0x575456,function(_0x1fb030){return db[_0xced5('0x7c')][_0xced5('0x7d')]({'where':{'UserId':_0x1fb030['id'],'VoiceQueueId':_0x40f724['params']['id']},'defaults':{'penalty':_0x1fb030[_0xced5('0x76')]},'transaction':_0x52d75b});});})['then'](function(){return BPromise[_0xced5('0x79')](_[_0xced5('0x30')](_0x575456,{'online':!![]}),function(_0x1ea70b){return db[_0xced5('0x7e')][_0xced5('0x7b')]({'membername':_0x1ea70b['name'],'UserId':_0x1ea70b['id'],'queue_name':_0x2aa01c[_0xced5('0x34')],'VoiceQueueId':_0x2aa01c['id'],'interface':_[_0xced5('0x7f')](_0x1ea70b[_0xced5('0x73')])?util[_0xced5('0x80')]('SIP/%s',_0x1ea70b['name']):_0x1ea70b[_0xced5('0x73')],'paused':_0x1ea70b[_0xced5('0x81')]||![],'penalty':_0x1ea70b[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){_0x575456[_0xced5('0x75')](function(_0x42c06b){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':_0x42c06b['id'],'VoiceQueueId':_0x2aa01c['id']});});});});});}})[_0xced5('0x2a')](respondWithStatusCode(_0x5e4e68,null))[_0xced5('0x52')](handleError(_0x5e4e68,null));};exports[_0xced5('0x84')]=function(_0x5cce35,_0x53b436,_0x3c8d00){return db[_0xced5('0x6e')][_0xced5('0x69')]({'where':{'id':_0x5cce35[_0xced5('0x40')][_0xced5('0x85')]},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id'],'raw':!![]}]})[_0xced5('0x2a')](handleEntityNotFound(_0x53b436,null))[_0xced5('0x2a')](function(_0x5c0cc8){var _0x4fa3a0=_['map'](_0x5c0cc8,'id');var _0x15f48b=[];var _0x2e924f=[];var _0x2c698c=squel[_0xced5('0x86')]();_0x2c698c[_0xced5('0x87')](_0xced5('0x88'))[_0xced5('0x89')]('team_has_voice_queues','tq')[_0xced5('0x8a')](_0xced5('0x8b'),'ut',_0xced5('0x8c'))['where']('VoiceQueueId\x20=\x20?',_0x5cce35[_0xced5('0x54')]['id']);for(var _0x1cc673=0x0;_0x1cc673<_0x5c0cc8['length'];_0x1cc673+=0x1){let _0x4a755d=_0x5c0cc8[_0x1cc673];for(var _0x580ffb=0x0;_0x580ffb<_0x4a755d[_0xced5('0x71')][_0xced5('0x46')];_0x580ffb+=0x1){let _0x3de78a=_0x4a755d[_0xced5('0x71')][_0x580ffb];var _0x4cb9ca=_0x2c698c[_0xced5('0x5e')]();_0x4cb9ca[_0xced5('0x4b')]('ut.UserId\x20=\x20?',_0x3de78a['id']);_0x2e924f[_0xced5('0x8d')](db['sequelize']['query'](_0x4cb9ca['toString'](),{'type':db[_0xced5('0x77')][_0xced5('0x8e')]['SELECT']})[_0xced5('0x2a')](function(_0x2609a1){if(_0x2609a1['length']===0x1){return _0x3de78a['id'];}else{var _0x58d319=_[_0xced5('0x8f')](_[_0xced5('0x3b')](_0x2609a1,'TeamId'),function(_0x1afa96){return _[_0xced5('0x90')](_0x4fa3a0,_0x1afa96);});if(_0x58d319){return _0x3de78a['id'];}}}));}}return BPromise[_0xced5('0x91')](_0x2e924f)[_0xced5('0x2a')](function(_0x4c1e40){_0x15f48b=_(_0x15f48b)[_0xced5('0x92')](_0x4c1e40)[_0xced5('0x93')]()['value']();return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5cce35['params']['id']}})[_0xced5('0x2a')](function(_0x20e3ca){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x335e8d){return _0x20e3ca[_0xced5('0x84')](_0x5cce35['query']['ids'],{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){if(!_[_0xced5('0x94')](_0x15f48b)){return _0x20e3ca[_0xced5('0x95')](_0x15f48b,{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){return db[_0xced5('0x7e')][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x5cce35['params']['id'],'UserId':_0x15f48b},'transaction':_0x335e8d});});}})[_0xced5('0x2a')](function(){_0x15f48b[_0xced5('0x75')](function(_0x1a32a1){socket['emit'](_0xced5('0x96'),{'UserId':_0x1a32a1,'VoiceQueueId':_0x20e3ca['id']});});});});});});})['then'](respondWithStatusCode(_0x53b436,null))['catch'](handleError(_0x53b436,null));};exports['addAgents']=function(_0x14e5db,_0x2ac4d5,_0x30f57b){var _0x298cf8,_0x58522b;return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x14e5db['params']['id']}})['then'](handleEntityNotFound(_0x2ac4d5,null))['then'](function(_0x2690d7){if(_0x2690d7){_0x58522b=_0x2690d7;return _0x2690d7[_0xced5('0x97')](_0x14e5db[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x14e5db[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{})[_0xced5('0x99')](function(_0x475083){for(var _0x28d57b=0x0;_0x28d57b<_0x14e5db['body'][_0xced5('0x85')][_0xced5('0x46')];_0x28d57b+=0x1){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':Number(_0x14e5db[_0xced5('0x56')][_0xced5('0x85')][_0x28d57b]),'VoiceQueueId':Number(_0x14e5db[_0xced5('0x54')]['id'])});}return _0x475083;});}})[_0xced5('0x2a')](function(_0x25a584){_0x298cf8=_0x25a584||[];if(_0x58522b){return db['User']['findAll']({'where':{'id':_0x14e5db[_0xced5('0x56')][_0xced5('0x85')]},'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),_0xced5('0x81'),_0xced5('0x73')],'raw':!![]});}})[_0xced5('0x2a')](function(_0x491fb7){if(!_[_0xced5('0x94')](_0x491fb7)){var _0x45a1d1=[];for(var _0x5e4dfe=0x0;_0x5e4dfe<_0x491fb7[_0xced5('0x46')];_0x5e4dfe++){if(_0x491fb7[_0x5e4dfe]['online']){_0x45a1d1['push'](db[_0xced5('0x7e')]['upsert']({'membername':_0x491fb7[_0x5e4dfe][_0xced5('0x34')],'UserId':_0x491fb7[_0x5e4dfe]['id'],'queue_name':_0x58522b[_0xced5('0x34')],'VoiceQueueId':_0x58522b['id'],'interface':_[_0xced5('0x7f')](_0x491fb7[_0x5e4dfe]['interface'])?util[_0xced5('0x80')](_0xced5('0x9a'),_0x491fb7[_0x5e4dfe][_0xced5('0x34')]):_0x491fb7[_0x5e4dfe][_0xced5('0x73')],'paused':_0x491fb7[_0x5e4dfe][_0xced5('0x81')]||![],'penalty':_0x14e5db[_0xced5('0x56')][_0xced5('0x76')]||0x0}));}}return BPromise['all'](_0x45a1d1);}})[_0xced5('0x2a')](function(){return _0x298cf8;})[_0xced5('0x2a')](respondWithResult(_0x2ac4d5,null))[_0xced5('0x52')](handleError(_0x2ac4d5,null));};exports[_0xced5('0x95')]=function(_0x46081c,_0x6d114f,_0x5545fb){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x46081c['params']['id']}})['then'](handleEntityNotFound(_0x6d114f,null))[_0xced5('0x2a')](function(_0x2a4bf1){if(_0x2a4bf1){return _0x2a4bf1['removeAgents'](_0x46081c['query'][_0xced5('0x85')])[_0xced5('0x2a')](function(){if(_[_0xced5('0x9b')](_0x46081c[_0xced5('0x40')][_0xced5('0x85')])){for(var _0x1bc1e4=0x0;_0x1bc1e4<_0x46081c[_0xced5('0x40')]['ids'][_0xced5('0x46')];_0x1bc1e4+=0x1){socket[_0xced5('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0x46081c[_0xced5('0x40')][_0xced5('0x85')][_0x1bc1e4]),'VoiceQueueId':Number(_0x46081c['params']['id'])});}}else{socket['emit'](_0xced5('0x96'),{'UserId':Number(_0x46081c[_0xced5('0x40')]['ids']),'VoiceQueueId':Number(_0x46081c['params']['id'])});}});}})['then'](function(_0x542f0d){return db['UserVoiceQueueRt'][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x46081c[_0xced5('0x54')]['id'],'UserId':_0x46081c['query'][_0xced5('0x85')]}})[_0xced5('0x2a')](function(){return _0x542f0d;});})['then'](respondWithStatusCode(_0x6d114f,null))[_0xced5('0x52')](handleError(_0x6d114f,null));};exports[_0xced5('0x9c')]=function(_0x40429e,_0x4b3d25,_0x47134b){var _0x121ddc={};var _0x1d7b28={};var _0x2a2eaa;var _0x53d0d8;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x40429e[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x4b3d25,null))['then'](function(_0x17087c){if(_0x17087c){_0x2a2eaa=_0x17087c;_0x1d7b28[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x70')][_0xced5('0x3c')]);_0x1d7b28[_0xced5('0x40')]=_[_0xced5('0x41')](_0x40429e[_0xced5('0x40')]);_0x1d7b28[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1d7b28['model'],_0x1d7b28[_0xced5('0x40')]);_0x121ddc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1d7b28[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x40429e['query']['fields']));_0x121ddc[_0xced5('0x44')]=_0x121ddc[_0xced5('0x44')][_0xced5('0x46')]?_0x121ddc[_0xced5('0x44')]:_0x1d7b28[_0xced5('0x3f')];_0x121ddc['order']=qs[_0xced5('0x49')](_0x40429e[_0xced5('0x40')]['sort']);_0x121ddc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x40429e[_0xced5('0x40')],_0x1d7b28[_0xced5('0x42')]));if(_0x40429e['query']['filter']){_0x121ddc[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x121ddc['where'],{'$or':_[_0xced5('0x3b')](_0x121ddc['attributes'],function(_0x2a1eb6){var _0x59c5cf={};_0x59c5cf[_0x2a1eb6]={'$like':'%'+_0x40429e['query'][_0xced5('0x30')]+'%'};return _0x59c5cf;})});}_0x121ddc=_[_0xced5('0x4c')]({},_0x121ddc,_0x40429e[_0xced5('0x5f')]);return _0x2a2eaa['getAgents'](_0x121ddc);}})[_0xced5('0x2a')](function(_0x206050){if(_0x206050){_0x53d0d8=_0x206050['length'];if(!_0x40429e[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x121ddc['limit']=qs[_0xced5('0x22')](_0x40429e[_0xced5('0x40')]['limit']);_0x121ddc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x40429e[_0xced5('0x40')][_0xced5('0x21')]);}return _0x2a2eaa[_0xced5('0x9c')](_0x121ddc);}})[_0xced5('0x2a')](function(_0x211b7a){if(_0x211b7a){return _0x211b7a?{'count':_0x53d0d8,'rows':_0x211b7a}:null;}})[_0xced5('0x2a')](respondWithResult(_0x4b3d25,null))[_0xced5('0x52')](handleError(_0x4b3d25,null));};exports[_0xced5('0x9d')]=function(_0x435e14,_0x191fcb,_0x5487f4){var _0x47caa3={};var _0x1a2ab5={};var _0x28afb0;var _0x2b02f3;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x435e14[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x191fcb,null))[_0xced5('0x2a')](function(_0x18c67e){if(_0x18c67e){_0x28afb0=_0x18c67e;_0x1a2ab5[_0xced5('0x3f')]=_[_0xced5('0x41')](db['UserVoiceQueueRt'][_0xced5('0x3c')]);_0x1a2ab5['query']=_[_0xced5('0x41')](_0x435e14[_0xced5('0x40')]);_0x1a2ab5[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],_0x1a2ab5['query']);_0x47caa3[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],qs['fields'](_0x435e14[_0xced5('0x40')][_0xced5('0x45')]));_0x47caa3[_0xced5('0x44')]=_0x47caa3['attributes']['length']?_0x47caa3[_0xced5('0x44')]:_0x1a2ab5[_0xced5('0x3f')];_0x47caa3[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x435e14['query'][_0xced5('0x49')]);_0x47caa3['where']=qs[_0xced5('0x42')](_['pick'](_0x435e14[_0xced5('0x40')],_0x1a2ab5[_0xced5('0x42')]));if(_0x435e14[_0xced5('0x40')][_0xced5('0x30')]){_0x47caa3[_0xced5('0x4b')]=_['merge'](_0x47caa3[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x47caa3[_0xced5('0x44')],function(_0x56d82b){var _0x56b4f2={};_0x56b4f2[_0x56d82b]={'$like':'%'+_0x435e14[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x56b4f2;})});}_0x47caa3=_[_0xced5('0x4c')]({},_0x47caa3,_0x435e14['options']);return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x21d5d2){if(_0x21d5d2){_0x2b02f3=_0x21d5d2[_0xced5('0x46')];if(!_0x435e14[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x47caa3[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x435e14['query']['limit']);_0x47caa3[_0xced5('0x21')]=qs['offset'](_0x435e14[_0xced5('0x40')][_0xced5('0x21')]);}return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x15395e){return _0x15395e?{'count':_0x2b02f3,'rows':_0x15395e}:null;})[_0xced5('0x2a')](respondWithResult(_0x191fcb,null))[_0xced5('0x52')](handleError(_0x191fcb,null));};exports['getLists']=function(_0x319be2,_0x2a3438,_0x527753){var _0x251991={};var _0x4650da={};var _0x4a5fcb;var _0xbc24ca;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x319be2['params']['id']}})['then'](handleEntityNotFound(_0x2a3438,null))[_0xced5('0x2a')](function(_0x340608){if(_0x340608){_0x4a5fcb=_0x340608;_0x4650da[_0xced5('0x3f')]=_['keys'](db[_0xced5('0x9e')]['rawAttributes']);_0x4650da[_0xced5('0x40')]=_[_0xced5('0x41')](_0x319be2[_0xced5('0x40')]);_0x4650da[_0xced5('0x42')]=_['intersection'](_0x4650da['model'],_0x4650da[_0xced5('0x40')]);_0x251991[_0xced5('0x44')]=_[_0xced5('0x43')](_0x4650da['model'],qs[_0xced5('0x45')](_0x319be2[_0xced5('0x40')][_0xced5('0x45')]));_0x251991[_0xced5('0x44')]=_0x251991[_0xced5('0x44')][_0xced5('0x46')]?_0x251991[_0xced5('0x44')]:_0x4650da[_0xced5('0x3f')];_0x251991[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x319be2[_0xced5('0x40')][_0xced5('0x49')]);_0x251991[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x319be2[_0xced5('0x40')],_0x4650da['filters']));if(_0x319be2[_0xced5('0x40')]['filter']){_0x251991[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x251991[_0xced5('0x4b')],{'$or':_['map'](_0x251991[_0xced5('0x44')],function(_0xa93acf){var _0x126cf0={};_0x126cf0[_0xa93acf]={'$like':'%'+_0x319be2[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x126cf0;})});}_0x251991=_[_0xced5('0x4c')]({},_0x251991,_0x319be2[_0xced5('0x5f')]);return _0x4a5fcb['getLists'](_0x251991);}})[_0xced5('0x2a')](function(_0x1a185b){if(_0x1a185b){_0xbc24ca=_0x1a185b[_0xced5('0x46')];if(!_0x319be2['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x251991[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x319be2[_0xced5('0x40')][_0xced5('0x22')]);_0x251991[_0xced5('0x21')]=qs['offset'](_0x319be2[_0xced5('0x40')]['offset']);}return _0x4a5fcb[_0xced5('0x9f')](_0x251991);}})[_0xced5('0x2a')](function(_0x18ff11){if(_0x18ff11){return _0x18ff11?{'count':_0xbc24ca,'rows':_0x18ff11}:null;}})['then'](respondWithResult(_0x2a3438,null))[_0xced5('0x52')](handleError(_0x2a3438,null));};exports[_0xced5('0xa0')]=function(_0x2b4903,_0x539393,_0x26e288){var _0x45dd46=moment()[_0xced5('0x80')]('YYYY-MM-DD\x20HH:mm:ss');var _0xab1896,_0x31da3c;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x2b4903[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x539393,null))[_0xced5('0x2a')](function(_0x165f87){if(_0x165f87){_0x31da3c=_0x165f87;return _0x165f87[_0xced5('0xa0')](_0x2b4903[_0xced5('0x56')]['ids'],_['omit'](_0x2b4903[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{});}return null;})['spread'](function(_0x835dbb){var _0x15f489;_0xab1896=_0x835dbb||[];var _0x2e2e46=[];if(_0x835dbb){for(var _0x15ba88=0x0;_0x15ba88<_0x835dbb['length'];_0x15ba88+=0x1){var _0x1dea62=_0x835dbb[_0x15ba88][_0xced5('0x2b')]({'plain':!![]});_0x31da3c[_0xced5('0xa1')]=_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]?_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]:_0x31da3c[_0xced5('0xa1')];switch(_0x31da3c[_0xced5('0xa1')]){case _0xced5('0xa2'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xa5'))[_0xced5('0xa6')](['phone',_0xced5('0xa7'),'ContactId',_0xced5('0xa8'),_0xced5('0x67'),'createdAt',_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id','ContactId')[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')]('ListId\x20=\x20?',_0x1dea62[_0xced5('0xaa')]['toString']())[_0xced5('0x4b')](_0xced5('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xaf'))[_0xced5('0x89')](_0xced5('0xb0'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]()))['where'](_0xced5('0xb2'),squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xb3'))[_0xced5('0x89')](_0xced5('0xa5'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;case _0xced5('0xb4'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')]('cm_hopper')['fromQuery']([_0xced5('0xa9'),_0xced5('0xa7'),_0xced5('0xb5'),_0xced5('0xa8'),'VoiceQueueId','createdAt',_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))['field'](_0x1dea62['CmListId']['toString'](),'ListId')[_0xced5('0x87')](_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')]('cm_contacts')['where'](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xced5('0x4b')](_0xced5('0xb2'),squel[_0xced5('0x86')]()['field']('COALESCE(phone,\x27\x27)')[_0xced5('0x89')](_0xced5('0xa5'))[_0xced5('0x4b')](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;default:_0x15f489=squel[_0xced5('0xa3')]()['into'](_0xced5('0xa5'))[_0xced5('0xa6')]([_0xced5('0xa9'),'scheduledAt','ContactId',_0xced5('0xa8'),'VoiceQueueId',_0xced5('0x60'),_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))['field'](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27','updatedAt')[_0xced5('0x89')]('cm_contacts')[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62['CmListId'][_0xced5('0xab')]())['where'](_0xced5('0xae')))[_0xced5('0xab')]();}_0x2e2e46[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x15f489));}return BPromise[_0xced5('0x91')](_0x2e2e46);}})['then'](function(){var _0x1799ce=[];var _0x4b1af1=squel['insert']()[_0xced5('0xa4')](_0xced5('0xb7'))[_0xced5('0xa6')]([_0xced5('0xb8'),_0xced5('0xa9'),_0xced5('0xb9'),_0xced5('0x60'),'updatedAt'],squel[_0xced5('0x86')]()['field'](_0xced5('0xba'))[_0xced5('0x87')]('ci.item')[_0xced5('0x87')](_0xced5('0xbb'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xbc'),'ci')['join']('cm_hopper','h',_0xced5('0xbd'))[_0xced5('0x4b')](_0xced5('0xbe'),_0x45dd46)[_0xced5('0x4b')](_0xced5('0xbf'),_0xced5('0xc0')))['toString']();_0x1799ce[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x4b1af1));return BPromise[_0xced5('0x91')](_0x1799ce);})[_0xced5('0x2a')](function(){return _0xab1896;})[_0xced5('0x2a')](respondWithResult(_0x539393,null))[_0xced5('0x52')](handleError(_0x539393,null));};exports['removeLists']=function(_0x460edc,_0x2b5b8b,_0x1dbbd5){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x460edc['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x2b5b8b,null))[_0xced5('0x2a')](function(_0x3b306b){if(_0x3b306b){return _0x3b306b[_0xced5('0xc1')](_0x460edc[_0xced5('0x40')]['ids']);}})[_0xced5('0x2a')](function(_0x455fb9){if(_0x455fb9){return db[_0xced5('0x65')]['destroy']({'where':{'ListId':_0x460edc['query'][_0xced5('0x85')],'VoiceQueueId':_0x460edc[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(){return _0x455fb9;});}})[_0xced5('0x2a')](respondWithStatusCode(_0x2b5b8b,null))[_0xced5('0x52')](handleError(_0x2b5b8b,null));};exports['getBlackLists']=function(_0x422629,_0x2ae75c,_0xdd023d){var _0x471af0={};var _0x2c82c6={};var _0xa03e29;var _0x207cfc;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x422629[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ae75c,null))[_0xced5('0x2a')](function(_0x2e9c49){if(_0x2e9c49){_0xa03e29=_0x2e9c49;_0x2c82c6['model']=_[_0xced5('0x41')](db[_0xced5('0x9e')][_0xced5('0x3c')]);_0x2c82c6[_0xced5('0x40')]=_[_0xced5('0x41')](_0x422629[_0xced5('0x40')]);_0x2c82c6['filters']=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],_0x2c82c6[_0xced5('0x40')]);_0x471af0[_0xced5('0x44')]=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],qs['fields'](_0x422629[_0xced5('0x40')]['fields']));_0x471af0[_0xced5('0x44')]=_0x471af0[_0xced5('0x44')][_0xced5('0x46')]?_0x471af0[_0xced5('0x44')]:_0x2c82c6[_0xced5('0x3f')];_0x471af0[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x422629['query'][_0xced5('0x49')]);_0x471af0['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x422629['query'],_0x2c82c6[_0xced5('0x42')]));if(_0x422629['query'][_0xced5('0x30')]){_0x471af0[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x471af0['where'],{'$or':_['map'](_0x471af0[_0xced5('0x44')],function(_0x5d0b72){var _0x109cbd={};_0x109cbd[_0x5d0b72]={'$like':'%'+_0x422629[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x109cbd;})});}_0x471af0=_[_0xced5('0x4c')]({},_0x471af0,_0x422629[_0xced5('0x5f')]);return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x4be1c5){if(_0x4be1c5){_0x207cfc=_0x4be1c5[_0xced5('0x46')];if(!_0x422629[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x471af0[_0xced5('0x22')]=qs['limit'](_0x422629[_0xced5('0x40')][_0xced5('0x22')]);_0x471af0[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x422629[_0xced5('0x40')]['offset']);}return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x2b5cf7){if(_0x2b5cf7){return _0x2b5cf7?{'count':_0x207cfc,'rows':_0x2b5cf7}:null;}})[_0xced5('0x2a')](respondWithResult(_0x2ae75c,null))[_0xced5('0x52')](handleError(_0x2ae75c,null));};exports[_0xced5('0xc3')]=function(_0x5e07ef,_0x261063,_0xe68a26){var _0x3600c2,_0x515afc;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5e07ef[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x261063,null))[_0xced5('0x2a')](function(_0x215df1){if(_0x215df1){_0x515afc=_0x215df1;return _0x215df1[_0xced5('0xc3')](_0x5e07ef[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x5e07ef[_0xced5('0x56')],['ids','id'])||{});}return null;})[_0xced5('0x99')](function(_0x25277f){var _0x30e0fc;_0x3600c2=_0x25277f||[];var _0x269438=[];if(_0x25277f){for(var _0x5191c4=0x0;_0x5191c4<_0x25277f[_0xced5('0x46')];_0x5191c4+=0x1){var _0xc86886=_0x25277f[_0x5191c4][_0xced5('0x2b')]({'plain':!![]});_0x30e0fc=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xc4'))[_0xced5('0xa6')]([_0xced5('0xa9'),_0xced5('0xb5'),_0xced5('0xa8'),_0xced5('0x67'),_0xced5('0x60'),_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('id','ContactId')['field'](_0xc86886[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x5e07ef['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('NOW()',_0xced5('0x60'))['field'](_0xced5('0xc5'),'updatedAt')[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')]('deletedAt\x20IS\x20NULL')[_0xced5('0x4b')]('ListId\x20=\x20?',_0xc86886['CmListId'][_0xced5('0xab')]())[_0xced5('0x4b')](_0xced5('0xae')))[_0xced5('0xab')]();_0x269438[_0xced5('0x8d')](db['sequelize'][_0xced5('0x40')](_0x30e0fc));}return BPromise['all'](_0x269438);}})[_0xced5('0x2a')](function(){return _0x3600c2;})['then'](respondWithResult(_0x261063,null))['catch'](handleError(_0x261063,null));};exports[_0xced5('0xc6')]=function(_0x586f18,_0x1451dc,_0x2cb10d){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x586f18[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x1451dc,null))[_0xced5('0x2a')](function(_0x441118){if(_0x441118){return _0x441118[_0xced5('0xc6')](_0x586f18[_0xced5('0x40')][_0xced5('0x85')]);}})[_0xced5('0x2a')](function(_0x2b2da8){if(_0x2b2da8){return db[_0xced5('0x6c')][_0xced5('0x36')]({'where':{'ListId':_0x586f18['query']['ids'],'VoiceQueueId':_0x586f18['params']['id']}})[_0xced5('0x2a')](function(){return _0x2b2da8;});}})['then'](respondWithStatusCode(_0x1451dc,null))[_0xced5('0x52')](handleError(_0x1451dc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 917a54d..5ed9cf4 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 _0x37f8=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove'];(function(_0x308ca4,_0x57770b){var _0x4086a9=function(_0x31014b){while(--_0x31014b){_0x308ca4['push'](_0x308ca4['shift']());}};_0x4086a9(++_0x57770b);}(_0x37f8,0x174));var _0x837f=function(_0x8fd834,_0x273d72){_0x8fd834=_0x8fd834-0x0;var _0x46d360=_0x37f8[_0x8fd834];return _0x46d360;};'use strict';var EventEmitter=require(_0x837f('0x0'));var VoiceQueue=require(_0x837f('0x1'))['db'][_0x837f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x837f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x837f('0x4'),'afterDestroy':_0x837f('0x5')};function emitEvent(_0x14d866){return function(_0x59ced8,_0x535dc8,_0xf88034){VoiceQueueEvents[_0x837f('0x6')](_0x14d866+':'+_0x59ced8['id'],_0x59ced8);VoiceQueueEvents['emit'](_0x14d866,_0x59ced8);_0xf88034(null);};}for(var e in events){if(events[_0x837f('0x7')](e)){var event=events[e];VoiceQueue[_0x837f('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x5a9e=['VoiceQueue','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x5a9e,0xb6));var _0xe5a9=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x5a9e[_0x55a89e];return _0x3aa2bd;};'use strict';var EventEmitter=require(_0xe5a9('0x0'));var VoiceQueue=require(_0xe5a9('0x1'))['db'][_0xe5a9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe5a9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5a9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1257dc){return function(_0x9e88d,_0x161669,_0x2dc160){VoiceQueueEvents[_0xe5a9('0x5')](_0x1257dc+':'+_0x9e88d['id'],_0x9e88d);VoiceQueueEvents[_0xe5a9('0x5')](_0x1257dc,_0x9e88d);_0x2dc160(null);};}for(var e in events){if(events[_0xe5a9('0x6')](e)){var event=events[e];VoiceQueue[_0xe5a9('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 6a0c3c6..a6c43e8 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0xf27433,_0x4db185){var _0x4b2db3=function(_0x2a6aa9){while(--_0x2a6aa9){_0xf27433['push'](_0xf27433['shift']());}};_0x4b2db3(++_0x4db185);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x289fd4,_0xd34ba6){var _0x3d4a88=function(_0x2a3726){while(--_0x2a3726){_0x289fd4['push'](_0x289fd4['shift']());}};_0x3d4a88(++_0xd34ba6);}(_0x008c,0x188));var _0xc008=function(_0x54ce4a,_0x502cba){_0x54ce4a=_0x54ce4a-0x0;var _0x279dce=_0x008c[_0x54ce4a];return _0x279dce;};'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')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 91bc73b..81ceb41 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 _0xeb20=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','map','attributes','model','find','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x413d12,_0x575e1e){var _0x4b09f1=function(_0x3adfef){while(--_0x3adfef){_0x413d12['push'](_0x413d12['shift']());}};_0x4b09f1(++_0x575e1e);}(_0xeb20,0xc2));var _0x0eb2=function(_0x2064b6,_0x49272f){_0x2064b6=_0x2064b6-0x0;var _0x1ad489=_0xeb20[_0x2064b6];return _0x1ad489;};'use strict';var _=require(_0x0eb2('0x0'));var util=require(_0x0eb2('0x1'));var moment=require('moment');var BPromise=require(_0x0eb2('0x2'));var rs=require(_0x0eb2('0x3'));var fs=require('fs');var Redis=require(_0x0eb2('0x4'));var db=require(_0x0eb2('0x5'))['db'];var utils=require(_0x0eb2('0x6'));var logger=require(_0x0eb2('0x7'))(_0x0eb2('0x8'));var config=require(_0x0eb2('0x9'));var jayson=require(_0x0eb2('0xa'));var client=jayson[_0x0eb2('0xb')]['http']({'port':0x232a});config[_0x0eb2('0xc')]=_[_0x0eb2('0xd')](config[_0x0eb2('0xc')],{'host':_0x0eb2('0xe'),'port':0x18eb});var socket=require(_0x0eb2('0xf'))(new Redis(config[_0x0eb2('0xc')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x376aea,_0x2571a6,_0x2c5167){return new BPromise(function(_0x4de2b7,_0x43a19b){return client[_0x0eb2('0x10')](_0x376aea,_0x2c5167)[_0x0eb2('0x11')](function(_0x308a27){logger[_0x0eb2('0x12')](_0x0eb2('0x13'),_0x2571a6,'request\x20sent');logger[_0x0eb2('0x14')](_0x0eb2('0x15'),_0x2571a6,'request\x20sent',JSON[_0x0eb2('0x16')](_0x308a27));if(_0x308a27[_0x0eb2('0x17')]){if(_0x308a27[_0x0eb2('0x17')]['code']===0x1f4){logger[_0x0eb2('0x17')](_0x0eb2('0x13'),_0x2571a6,_0x308a27['error'][_0x0eb2('0x18')]);return _0x43a19b(_0x308a27['error']['message']);}logger['error'](_0x0eb2('0x13'),_0x2571a6,_0x308a27[_0x0eb2('0x17')]['message']);return _0x4de2b7(_0x308a27['error']['message']);}else{logger[_0x0eb2('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2571a6,_0x0eb2('0x19'));_0x4de2b7(_0x308a27[_0x0eb2('0x1a')][_0x0eb2('0x18')]);}})[_0x0eb2('0x1b')](function(_0x187bdd){logger[_0x0eb2('0x17')](_0x0eb2('0x13'),_0x2571a6,_0x187bdd);_0x43a19b(_0x187bdd);});});}exports[_0x0eb2('0x1c')]=function(_0x19126f){var _0xccee58=this;return new Promise(function(_0x27b4e9,_0x577ff1){return db[_0x0eb2('0x1d')]['findAll']({'raw':_0x19126f['options']?_0x19126f[_0x0eb2('0x1e')][_0x0eb2('0x1f')]===undefined?!![]:![]:!![],'where':_0x19126f['options']?_0x19126f['options'][_0x0eb2('0x20')]||null:null,'attributes':_0x19126f[_0x0eb2('0x1e')]?_0x19126f[_0x0eb2('0x1e')]['attributes']||null:null,'limit':_0x19126f[_0x0eb2('0x1e')]?_0x19126f[_0x0eb2('0x1e')][_0x0eb2('0x21')]||null:null,'include':_0x19126f[_0x0eb2('0x1e')]?_0x19126f[_0x0eb2('0x1e')][_0x0eb2('0x22')]?_[_0x0eb2('0x23')](_0x19126f['options'][_0x0eb2('0x22')],function(_0x4ca72c){return{'model':db[_0x4ca72c['model']],'as':_0x4ca72c['as'],'attributes':_0x4ca72c[_0x0eb2('0x24')],'include':_0x4ca72c['include']?_[_0x0eb2('0x23')](_0x4ca72c[_0x0eb2('0x22')],function(_0x42f7a2){return{'model':db[_0x42f7a2[_0x0eb2('0x25')]],'as':_0x42f7a2['as'],'attributes':_0x42f7a2['attributes'],'include':_0x42f7a2[_0x0eb2('0x22')]?_[_0x0eb2('0x23')](_0x42f7a2[_0x0eb2('0x22')],function(_0x5a331){return{'model':db[_0x5a331[_0x0eb2('0x25')]],'as':_0x5a331['as'],'attributes':_0x5a331[_0x0eb2('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d0c81){logger[_0x0eb2('0x12')]('GetVoiceQueue',_0x19126f);logger[_0x0eb2('0x14')](_0x0eb2('0x1c'),_0x19126f,JSON[_0x0eb2('0x16')](_0x5d0c81));_0x27b4e9(_0x5d0c81);})['catch'](function(_0x485acb){logger[_0x0eb2('0x17')]('GetVoiceQueue',_0x485acb[_0x0eb2('0x18')],_0x19126f);_0x577ff1(_0xccee58[_0x0eb2('0x17')](0x1f4,_0x485acb['message']));});});};exports['ShowVoiceQueue']=function(_0xd0c2ca){var _0x55ca8c=this;return new Promise(function(_0x32d9ef,_0x5b7ab4){return db[_0x0eb2('0x1d')][_0x0eb2('0x26')]({'raw':_0xd0c2ca[_0x0eb2('0x1e')]?_0xd0c2ca['options'][_0x0eb2('0x1f')]===undefined?!![]:![]:!![],'where':_0xd0c2ca[_0x0eb2('0x1e')]?_0xd0c2ca['options'][_0x0eb2('0x20')]||null:null,'attributes':_0xd0c2ca[_0x0eb2('0x1e')]?_0xd0c2ca[_0x0eb2('0x1e')]['attributes']||null:null,'include':_0xd0c2ca[_0x0eb2('0x1e')]?_0xd0c2ca[_0x0eb2('0x1e')][_0x0eb2('0x22')]?_['map'](_0xd0c2ca['options']['include'],function(_0x26e37f){return{'model':db[_0x26e37f[_0x0eb2('0x25')]],'as':_0x26e37f['as'],'attributes':_0x26e37f[_0x0eb2('0x24')],'include':_0x26e37f['include']?_[_0x0eb2('0x23')](_0x26e37f['include'],function(_0x598397){return{'model':db[_0x598397[_0x0eb2('0x25')]],'as':_0x598397['as'],'attributes':_0x598397[_0x0eb2('0x24')],'include':_0x598397[_0x0eb2('0x22')]?_[_0x0eb2('0x23')](_0x598397[_0x0eb2('0x22')],function(_0x3f44d2){return{'model':db[_0x3f44d2[_0x0eb2('0x25')]],'as':_0x3f44d2['as'],'attributes':_0x3f44d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x0eb2('0x11')](function(_0xf24ad0){logger[_0x0eb2('0x12')](_0x0eb2('0x27'),_0xd0c2ca);logger[_0x0eb2('0x14')]('ShowVoiceQueue',_0xd0c2ca,JSON[_0x0eb2('0x16')](_0xf24ad0));_0x32d9ef(_0xf24ad0);})[_0x0eb2('0x1b')](function(_0x42c972){logger[_0x0eb2('0x17')](_0x0eb2('0x27'),_0x42c972[_0x0eb2('0x18')],_0xd0c2ca);_0x5b7ab4(_0x55ca8c['error'](0x1f4,_0x42c972['message']));});});}; \ No newline at end of file +var _0xe64d=['VoiceQueue','findAll','options','raw','where','include','model','attributes','map','ShowVoiceQueue','find','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue'];(function(_0x4091b4,_0x2e6fc4){var _0x5120f1=function(_0xf27c2c){while(--_0xf27c2c){_0x4091b4['push'](_0x4091b4['shift']());}};_0x5120f1(++_0x2e6fc4);}(_0xe64d,0xa3));var _0xde64=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xe64d[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0xde64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde64('0x1'));var rs=require(_0xde64('0x2'));var fs=require('fs');var Redis=require(_0xde64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde64('0x4'));var logger=require(_0xde64('0x5'))(_0xde64('0x6'));var config=require('../../config/environment');var jayson=require(_0xde64('0x7'));var client=jayson[_0xde64('0x8')][_0xde64('0x9')]({'port':0x232a});config[_0xde64('0xa')]=_['defaults'](config['redis'],{'host':_0xde64('0xb'),'port':0x18eb});var socket=require(_0xde64('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1a1300,_0x1a455a,_0x23ddb9){return new BPromise(function(_0x1b8bcc,_0x3adc88){return client[_0xde64('0xd')](_0x1a1300,_0x23ddb9)[_0xde64('0xe')](function(_0x54d5db){logger[_0xde64('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x1a455a,'request\x20sent');logger[_0xde64('0x10')](_0xde64('0x11'),_0x1a455a,_0xde64('0x12'),JSON[_0xde64('0x13')](_0x54d5db));if(_0x54d5db[_0xde64('0x14')]){if(_0x54d5db[_0xde64('0x14')][_0xde64('0x15')]===0x1f4){logger['error'](_0xde64('0x16'),_0x1a455a,_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);return _0x3adc88(_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);}logger[_0xde64('0x14')](_0xde64('0x16'),_0x1a455a,_0x54d5db['error'][_0xde64('0x17')]);return _0x1b8bcc(_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);}else{logger['info'](_0xde64('0x16'),_0x1a455a,'request\x20sent');_0x1b8bcc(_0x54d5db[_0xde64('0x18')][_0xde64('0x17')]);}})[_0xde64('0x19')](function(_0x3bf478){logger[_0xde64('0x14')](_0xde64('0x16'),_0x1a455a,_0x3bf478);_0x3adc88(_0x3bf478);});});}exports[_0xde64('0x1a')]=function(_0x65960b){var _0xf89beb=this;return new Promise(function(_0x3afad0,_0x4cc593){return db[_0xde64('0x1b')][_0xde64('0x1c')]({'raw':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')][_0xde64('0x1e')]===undefined?!![]:![]:!![],'where':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')][_0xde64('0x1f')]||null:null,'attributes':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')]['attributes']||null:null,'limit':_0x65960b[_0xde64('0x1d')]?_0x65960b['options']['limit']||null:null,'include':_0x65960b['options']?_0x65960b[_0xde64('0x1d')][_0xde64('0x20')]?_['map'](_0x65960b[_0xde64('0x1d')][_0xde64('0x20')],function(_0x249fe8){return{'model':db[_0x249fe8[_0xde64('0x21')]],'as':_0x249fe8['as'],'attributes':_0x249fe8[_0xde64('0x22')],'include':_0x249fe8[_0xde64('0x20')]?_[_0xde64('0x23')](_0x249fe8[_0xde64('0x20')],function(_0x37f206){return{'model':db[_0x37f206[_0xde64('0x21')]],'as':_0x37f206['as'],'attributes':_0x37f206[_0xde64('0x22')],'include':_0x37f206[_0xde64('0x20')]?_['map'](_0x37f206[_0xde64('0x20')],function(_0x597d1e){return{'model':db[_0x597d1e[_0xde64('0x21')]],'as':_0x597d1e['as'],'attributes':_0x597d1e[_0xde64('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53e297){logger['info']('GetVoiceQueue',_0x65960b);logger[_0xde64('0x10')](_0xde64('0x1a'),_0x65960b,JSON[_0xde64('0x13')](_0x53e297));_0x3afad0(_0x53e297);})[_0xde64('0x19')](function(_0x3387e9){logger[_0xde64('0x14')]('GetVoiceQueue',_0x3387e9[_0xde64('0x17')],_0x65960b);_0x4cc593(_0xf89beb[_0xde64('0x14')](0x1f4,_0x3387e9[_0xde64('0x17')]));});});};exports[_0xde64('0x24')]=function(_0x51961f){var _0x424bd2=this;return new Promise(function(_0x23f7e5,_0x5b2bae){return db[_0xde64('0x1b')][_0xde64('0x25')]({'raw':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x1e')]===undefined?!![]:![]:!![],'where':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x1f')]||null:null,'attributes':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')]['attributes']||null:null,'include':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x20')]?_[_0xde64('0x23')](_0x51961f[_0xde64('0x1d')][_0xde64('0x20')],function(_0x510e08){return{'model':db[_0x510e08['model']],'as':_0x510e08['as'],'attributes':_0x510e08[_0xde64('0x22')],'include':_0x510e08[_0xde64('0x20')]?_[_0xde64('0x23')](_0x510e08[_0xde64('0x20')],function(_0x2abbd1){return{'model':db[_0x2abbd1['model']],'as':_0x2abbd1['as'],'attributes':_0x2abbd1['attributes'],'include':_0x2abbd1[_0xde64('0x20')]?_[_0xde64('0x23')](_0x2abbd1[_0xde64('0x20')],function(_0x1389ea){return{'model':db[_0x1389ea[_0xde64('0x21')]],'as':_0x1389ea['as'],'attributes':_0x1389ea[_0xde64('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e6696){logger[_0xde64('0xf')]('ShowVoiceQueue',_0x51961f);logger[_0xde64('0x10')]('ShowVoiceQueue',_0x51961f,JSON[_0xde64('0x13')](_0x5e6696));_0x23f7e5(_0x5e6696);})['catch'](function(_0x4fc39f){logger[_0xde64('0x14')](_0xde64('0x24'),_0x4fc39f[_0xde64('0x17')],_0x51961f);_0x5b2bae(_0x424bd2['error'](0x1f4,_0x4fc39f[_0xde64('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index e28cfa9..06c5794 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 _0xb399=['./voiceQueue.events','emit','removeListener','length','voiceQueue:'];(function(_0xcd859a,_0xaafb39){var _0x41e780=function(_0x455e9a){while(--_0x455e9a){_0xcd859a['push'](_0xcd859a['shift']());}};_0x41e780(++_0xaafb39);}(_0xb399,0x1a9));var _0x9b39=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0xb399[_0x4f08dd];return _0x3017ee;};'use strict';var VoiceQueueEvents=require(_0x9b39('0x0'));var events=['save','remove','update'];function createListener(_0x7dfc57,_0x254fa3){return function(_0x2f5700){_0x254fa3[_0x9b39('0x1')](_0x7dfc57,_0x2f5700);};}function removeListener(_0x93cf93,_0x582f5d){return function(){VoiceQueueEvents[_0x9b39('0x2')](_0x93cf93,_0x582f5d);};}exports['register']=function(_0xfd94d7){for(var _0x41ba45=0x0,_0x29c329=events[_0x9b39('0x3')];_0x41ba45<_0x29c329;_0x41ba45++){var _0x31a9d2=events[_0x41ba45];var _0x218460=createListener(_0x9b39('0x4')+_0x31a9d2,_0xfd94d7);VoiceQueueEvents['on'](_0x31a9d2,_0x218460);}}; \ No newline at end of file +var _0xc9f9=['./voiceQueue.events','save','remove','emit','removeListener','register','voiceQueue:'];(function(_0x401658,_0xa8fb28){var _0x55b212=function(_0x1854cf){while(--_0x1854cf){_0x401658['push'](_0x401658['shift']());}};_0x55b212(++_0xa8fb28);}(_0xc9f9,0x1d5));var _0x9c9f=function(_0x43dd42,_0x3afd34){_0x43dd42=_0x43dd42-0x0;var _0x599621=_0xc9f9[_0x43dd42];return _0x599621;};'use strict';var VoiceQueueEvents=require(_0x9c9f('0x0'));var events=[_0x9c9f('0x1'),_0x9c9f('0x2'),'update'];function createListener(_0x384bf7,_0x22daa6){return function(_0x1e9fc8){_0x22daa6[_0x9c9f('0x3')](_0x384bf7,_0x1e9fc8);};}function removeListener(_0x351131,_0x5a5f9d){return function(){VoiceQueueEvents[_0x9c9f('0x4')](_0x351131,_0x5a5f9d);};}exports[_0x9c9f('0x5')]=function(_0x45bbd5){for(var _0xb8e133=0x0,_0x39a330=events['length'];_0xb8e133<_0x39a330;_0xb8e133++){var _0x15dfda=events[_0xb8e133];var _0x3a183a=createListener(_0x9c9f('0x6')+_0x15dfda,_0x45bbd5);VoiceQueueEvents['on'](_0x15dfda,_0x3a183a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e05a218..3b07b1b 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 _0xb611=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','getVoiceQueuesReport','/:id','create','update','destroy','exports'];(function(_0x31e3f9,_0x3eed4a){var _0x1e40fa=function(_0x462d95){while(--_0x462d95){_0x31e3f9['push'](_0x31e3f9['shift']());}};_0x1e40fa(++_0x3eed4a);}(_0xb611,0x1a2));var _0x1b61=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xb611[_0x11ba83];return _0x3f3925;};'use strict';var multer=require(_0x1b61('0x0'));var util=require('util');var path=require(_0x1b61('0x1'));var timeout=require(_0x1b61('0x2'));var express=require(_0x1b61('0x3'));var router=express[_0x1b61('0x4')]();var fs_extra=require(_0x1b61('0x5'));var auth=require(_0x1b61('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1b61('0x7'));var controller=require(_0x1b61('0x8'));router[_0x1b61('0x9')]('/',auth[_0x1b61('0xa')](),controller[_0x1b61('0xb')]);router[_0x1b61('0x9')](_0x1b61('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x1b61('0x9')]('/index',auth['isAuthenticated'](),controller[_0x1b61('0xd')]);router[_0x1b61('0x9')](_0x1b61('0xe'),auth[_0x1b61('0xa')](),controller['show']);router['post']('/',auth[_0x1b61('0xa')](),controller[_0x1b61('0xf')]);router['put'](_0x1b61('0xe'),auth[_0x1b61('0xa')](),controller[_0x1b61('0x10')]);router['delete'](_0x1b61('0xe'),auth[_0x1b61('0xa')](),controller[_0x1b61('0x11')]);module[_0x1b61('0x12')]=router; \ No newline at end of file +var _0xd673=['index','/describe','isAuthenticated','describe','/index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x213e28,_0x1c5271){var _0x3f50d=function(_0x13f1bd){while(--_0x13f1bd){_0x213e28['push'](_0x213e28['shift']());}};_0x3f50d(++_0x1c5271);}(_0xd673,0x198));var _0x3d67=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd673[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3d67('0x0'));var util=require(_0x3d67('0x1'));var path=require(_0x3d67('0x2'));var timeout=require(_0x3d67('0x3'));var express=require(_0x3d67('0x4'));var router=express[_0x3d67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3d67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d67('0x7'));var controller=require(_0x3d67('0x8'));router[_0x3d67('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d67('0xa')]);router[_0x3d67('0x9')](_0x3d67('0xb'),auth[_0x3d67('0xc')](),controller[_0x3d67('0xd')]);router[_0x3d67('0x9')](_0x3d67('0xe'),auth[_0x3d67('0xc')](),controller['getVoiceQueuesReport']);router[_0x3d67('0x9')](_0x3d67('0xf'),auth[_0x3d67('0xc')](),controller[_0x3d67('0x10')]);router[_0x3d67('0x11')]('/',auth[_0x3d67('0xc')](),controller[_0x3d67('0x12')]);router[_0x3d67('0x13')](_0x3d67('0xf'),auth[_0x3d67('0xc')](),controller[_0x3d67('0x14')]);router[_0x3d67('0x15')](_0x3d67('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 82c7b7b..86ee506 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 _0xac80=['YYYY-MM-DD\x20HH:mm:ss','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','format'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xac80,0x88));var _0x0ac8=function(_0x27ca56,_0x487544){_0x27ca56=_0x27ca56-0x0;var _0x1e68bd=_0xac80[_0x27ca56];return _0x1e68bd;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0ac8('0x0')]={'type':{'type':Sequelize[_0x0ac8('0x1')]},'uniqueid':{'type':Sequelize[_0x0ac8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0ac8('0x1')]},'queue':{'type':Sequelize[_0x0ac8('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x0ac8('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x0ac8('0x2')],'set':function(_0x43d7dd){var _0x142925=moment(_0x43d7dd);var _0x11d7ba=moment(this['getDataValue']('queuecallerjoinAt'))[_0x0ac8('0x3')](_0x0ac8('0x4'));var _0x2b88e9=_0x142925['diff'](_0x11d7ba,'seconds');this['setDataValue'](_0x0ac8('0x5'),_0x43d7dd);this['setDataValue']('holdtime',_0x2b88e9||null);}},'position':{'type':Sequelize[_0x0ac8('0x6')]},'count':{'type':Sequelize[_0x0ac8('0x6')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0ac8('0x7')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0ac8('0x2')]},'queuecallerexit':{'type':Sequelize[_0x0ac8('0x7')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0ac8('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x0ac8('0x1')],'comment':_0x0ac8('0x8')},'originalposition':{'type':Sequelize[_0x0ac8('0x6')]},'channel':{'type':Sequelize[_0x0ac8('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0ac8('0x1')]},'connectedlinename':{'type':Sequelize[_0x0ac8('0x1')]},'accountcode':{'type':Sequelize[_0x0ac8('0x1')]},'context':{'type':Sequelize[_0x0ac8('0x1')]},'exten':{'type':Sequelize[_0x0ac8('0x1')]},'priority':{'type':Sequelize[_0x0ac8('0x1')]},'holdtime':{'type':Sequelize[_0x0ac8('0x6')]},'mohtime':{'type':Sequelize[_0x0ac8('0x6')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0ac8('0x7')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0ac8('0x1')],'comment':_0x0ac8('0x9')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x0ac8('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0ac8('0x1')]},'thirdDisposition':{'type':Sequelize[_0x0ac8('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x0ac8('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7795=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x4056fc,_0x230d63){var _0x57594e=function(_0xc342){while(--_0xc342){_0x4056fc['push'](_0x4056fc['shift']());}};_0x57594e(++_0x230d63);}(_0x7795,0x141));var _0x5779=function(_0xd8cc73,_0x52ff25){_0xd8cc73=_0xd8cc73-0x0;var _0x1e9339=_0x7795[_0xd8cc73];return _0x1e9339;};'use strict';var Sequelize=require(_0x5779('0x0'));var moment=require(_0x5779('0x1'));module['exports']={'type':{'type':Sequelize[_0x5779('0x2')]},'uniqueid':{'type':Sequelize[_0x5779('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5779('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5779('0x3')],'set':function(_0x583f83){var _0x3e0c06=moment(_0x583f83);var _0xa1ce06=moment(this[_0x5779('0x4')](_0x5779('0x5')))[_0x5779('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x576850=_0x3e0c06[_0x5779('0x7')](_0xa1ce06,_0x5779('0x8'));this[_0x5779('0x9')](_0x5779('0xa'),_0x583f83);this['setDataValue'](_0x5779('0xb'),_0x576850||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5779('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5779('0x3')]},'queuecallerexit':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5779('0xe')},'originalposition':{'type':Sequelize[_0x5779('0xc')]},'channel':{'type':Sequelize[_0x5779('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5779('0x2')]},'connectedlinename':{'type':Sequelize[_0x5779('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5779('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5779('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5779('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5779('0x2')]},'transfer':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5779('0x2')],'comment':_0x5779('0xf')},'transferexten':{'type':Sequelize[_0x5779('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5779('0x2')]},'disposition':{'type':Sequelize[_0x5779('0x2')]},'secondDisposition':{'type':Sequelize[_0x5779('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5779('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5779('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b5667f4..6d2e3c7 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 _0x18df=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','status','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','describe','getVoiceQueuesReport','order','findAll','eml-format','rimraf','zip-dir'];(function(_0x33588b,_0x1ceae0){var _0x62e8bd=function(_0x5507b0){while(--_0x5507b0){_0x33588b['push'](_0x33588b['shift']());}};_0x62e8bd(++_0x1ceae0);}(_0x18df,0xa1));var _0xf18d=function(_0x28c7c6,_0x165ed1){_0x28c7c6=_0x28c7c6-0x0;var _0x5ddd58=_0x18df[_0x28c7c6];return _0x5ddd58;};'use strict';var emlformat=require(_0xf18d('0x0'));var rimraf=require(_0xf18d('0x1'));var zipdir=require(_0xf18d('0x2'));var jsonpatch=require(_0xf18d('0x3'));var rp=require(_0xf18d('0x4'));var moment=require('moment');var BPromise=require(_0xf18d('0x5'));var Mustache=require(_0xf18d('0x6'));var util=require(_0xf18d('0x7'));var path=require(_0xf18d('0x8'));var sox=require('sox');var csv=require(_0xf18d('0x9'));var ejs=require(_0xf18d('0xa'));var fs=require('fs');var fs_extra=require(_0xf18d('0xb'));var _=require(_0xf18d('0xc'));var squel=require(_0xf18d('0xd'));var crypto=require(_0xf18d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf18d('0xf'));var toCsv=require(_0xf18d('0x9'));var querystring=require(_0xf18d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf18d('0x11'));var qs=require(_0xf18d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf18d('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf18d('0x14'));var licenseUtil=require(_0xf18d('0x15'));var db=require('../../mysqldb')['db'];config[_0xf18d('0x16')]=_[_0xf18d('0x17')](config[_0xf18d('0x16')],{'host':_0xf18d('0x18'),'port':0x18eb});var socket=require(_0xf18d('0x19'))(new Redis(config[_0xf18d('0x16')]));require('./voiceQueueReport.socket')[_0xf18d('0x1a')](socket);function respondWithStatusCode(_0x49559e,_0x13608f){_0x13608f=_0x13608f||0xcc;return function(_0x2722fe){if(_0x2722fe){return _0x49559e[_0xf18d('0x1b')](_0x13608f);}return _0x49559e['status'](_0x13608f)[_0xf18d('0x1c')]();};}function respondWithResult(_0x28185f,_0x13768d){_0x13768d=_0x13768d||0xc8;return function(_0x275895){if(_0x275895){return _0x28185f['status'](_0x13768d)[_0xf18d('0x1d')](_0x275895);}};}function respondWithFilteredResult(_0x4cb658,_0x3c06fb){return function(_0x33c7ef){if(_0x33c7ef){var _0x4c9329=typeof _0x3c06fb['offset']===_0xf18d('0x1e')&&typeof _0x3c06fb[_0xf18d('0x1f')]==='undefined';var _0x5585ce=_0x33c7ef[_0xf18d('0x20')];var _0xac1b5a=_0x4c9329?0x0:_0x3c06fb['offset'];var _0x37b998=_0x4c9329?_0x33c7ef['count']:_0x3c06fb[_0xf18d('0x21')]+_0x3c06fb[_0xf18d('0x1f')];var _0x5067b3;if(_0x37b998>=_0x5585ce){_0x37b998=_0x5585ce;_0x5067b3=0xc8;}else{_0x5067b3=0xce;}_0x4cb658['status'](_0x5067b3);return _0x4cb658['set'](_0xf18d('0x22'),_0xac1b5a+'-'+_0x37b998+'/'+_0x5585ce)[_0xf18d('0x1d')](_0x33c7ef);}return null;};}function patchUpdates(_0x62b68a){return function(_0x50983a){try{jsonpatch[_0xf18d('0x23')](_0x50983a,_0x62b68a,!![]);}catch(_0x3d87eb){return BPromise[_0xf18d('0x24')](_0x3d87eb);}return _0x50983a[_0xf18d('0x25')]();};}function saveUpdates(_0x43cbc4,_0x33897e){return function(_0x891248){if(_0x891248){return _0x891248[_0xf18d('0x26')](_0x43cbc4)[_0xf18d('0x27')](function(_0x4b10c8){return _0x4b10c8;});}return null;};}function removeEntity(_0x5b0a0e,_0x1bdb6c){return function(_0x4aaf60){if(_0x4aaf60){return _0x4aaf60[_0xf18d('0x28')]()['then'](function(){_0x5b0a0e[_0xf18d('0x29')](0xcc)[_0xf18d('0x1c')]();});}};}function handleEntityNotFound(_0x4de165,_0x54e1e7){return function(_0x338a4e){if(!_0x338a4e){_0x4de165[_0xf18d('0x1b')](0x194);}return _0x338a4e;};}function handleError(_0x317627,_0x37d671){_0x37d671=_0x37d671||0x1f4;return function(_0x36e13b){logger[_0xf18d('0x2a')](_0x36e13b['stack']);if(_0x36e13b['name']){delete _0x36e13b[_0xf18d('0x2b')];}_0x317627[_0xf18d('0x29')](_0x37d671)[_0xf18d('0x2c')](_0x36e13b);};}exports[_0xf18d('0x2d')]=function(_0x55c0fa,_0x220393){var _0x328b40={},_0x530e5c={},_0x266d51={'count':0x0,'rows':[]};var _0x253b16=_[_0xf18d('0x2e')](db[_0xf18d('0x2f')][_0xf18d('0x30')],function(_0x2703ca){return{'name':_0x2703ca[_0xf18d('0x31')],'type':_0x2703ca[_0xf18d('0x32')][_0xf18d('0x33')]};});_0x530e5c['model']=_['map'](_0x253b16,_0xf18d('0x2b'));_0x530e5c['query']=_[_0xf18d('0x34')](_0x55c0fa[_0xf18d('0x35')]);_0x530e5c['filters']=_[_0xf18d('0x36')](_0x530e5c[_0xf18d('0x37')],_0x530e5c[_0xf18d('0x35')]);_0x328b40[_0xf18d('0x38')]=_['intersection'](_0x530e5c[_0xf18d('0x37')],qs[_0xf18d('0x39')](_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x39')]));_0x328b40[_0xf18d('0x38')]=_0x328b40[_0xf18d('0x38')][_0xf18d('0x3a')]?_0x328b40[_0xf18d('0x38')]:_0x530e5c[_0xf18d('0x37')];if(!_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x3b')](_0xf18d('0x3c'))){_0x328b40[_0xf18d('0x1f')]=qs[_0xf18d('0x1f')](_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x1f')]);_0x328b40['offset']=qs[_0xf18d('0x21')](_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x21')]);}_0x328b40['order']=qs[_0xf18d('0x3d')](_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x3d')]);_0x328b40[_0xf18d('0x3e')]=qs['filters'](_[_0xf18d('0x3f')](_0x55c0fa['query'],_0x530e5c[_0xf18d('0x40')]),_0x253b16);if(_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x41')]){_0x328b40[_0xf18d('0x3e')]=_[_0xf18d('0x42')](_0x328b40['where'],{'$or':_[_0xf18d('0x2e')](_0x253b16,function(_0x277961){if(_0x277961[_0xf18d('0x32')]!==_0xf18d('0x43')){var _0x55c724={};_0x55c724[_0x277961[_0xf18d('0x2b')]]={'$like':'%'+_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x41')]+'%'};return _0x55c724;}})});}_0x328b40=_['merge']({},_0x328b40,_0x55c0fa['options']);var _0x304473={'where':_0x328b40[_0xf18d('0x3e')]};return db['VoiceQueueReport']['count'](_0x304473)[_0xf18d('0x27')](function(_0xee6109){_0x266d51[_0xf18d('0x20')]=_0xee6109;if(_0x55c0fa[_0xf18d('0x35')][_0xf18d('0x44')]){_0x328b40[_0xf18d('0x45')]=[{'all':!![]}];}return db[_0xf18d('0x2f')]['findAll'](_0x328b40);})['then'](function(_0x11b3f6){_0x266d51[_0xf18d('0x46')]=_0x11b3f6;return _0x266d51;})[_0xf18d('0x27')](respondWithFilteredResult(_0x220393,_0x328b40))[_0xf18d('0x47')](handleError(_0x220393,null));};exports[_0xf18d('0x48')]=function(_0x3d69a6,_0x29ea6c){var _0x1240a3={'raw':![],'where':{'id':_0x3d69a6[_0xf18d('0x49')]['id']}},_0x45fe29={};_0x45fe29[_0xf18d('0x37')]=_[_0xf18d('0x34')](db['VoiceQueueReport'][_0xf18d('0x30')]);_0x45fe29[_0xf18d('0x35')]=_[_0xf18d('0x34')](_0x3d69a6['query']);_0x45fe29[_0xf18d('0x40')]=_[_0xf18d('0x36')](_0x45fe29['model'],_0x45fe29[_0xf18d('0x35')]);_0x1240a3[_0xf18d('0x38')]=_['intersection'](_0x45fe29['model'],qs[_0xf18d('0x39')](_0x3d69a6[_0xf18d('0x35')][_0xf18d('0x39')]));_0x1240a3[_0xf18d('0x38')]=_0x1240a3['attributes'][_0xf18d('0x3a')]?_0x1240a3[_0xf18d('0x38')]:_0x45fe29['model'];if(_0x3d69a6[_0xf18d('0x35')]['includeAll']){_0x1240a3[_0xf18d('0x45')]=[{'all':!![]}];}_0x1240a3=_[_0xf18d('0x42')]({},_0x1240a3,_0x3d69a6[_0xf18d('0x4a')]);return db[_0xf18d('0x2f')][_0xf18d('0x4b')](_0x1240a3)[_0xf18d('0x27')](handleEntityNotFound(_0x29ea6c,null))[_0xf18d('0x27')](respondWithResult(_0x29ea6c,null))[_0xf18d('0x47')](handleError(_0x29ea6c,null));};exports['create']=function(_0x5a7f4c,_0x5075a3){return db[_0xf18d('0x2f')][_0xf18d('0x4c')](_0x5a7f4c[_0xf18d('0x4d')],{})[_0xf18d('0x27')](respondWithResult(_0x5075a3,0xc9))[_0xf18d('0x47')](handleError(_0x5075a3,null));};exports[_0xf18d('0x26')]=function(_0x414e8a,_0x202113){if(_0x414e8a['body']['id']){delete _0x414e8a[_0xf18d('0x4d')]['id'];}return db[_0xf18d('0x2f')][_0xf18d('0x4b')]({'where':{'id':_0x414e8a[_0xf18d('0x49')]['id']}})[_0xf18d('0x27')](handleEntityNotFound(_0x202113,null))[_0xf18d('0x27')](saveUpdates(_0x414e8a[_0xf18d('0x4d')],null))[_0xf18d('0x27')](respondWithResult(_0x202113,null))[_0xf18d('0x47')](handleError(_0x202113,null));};exports[_0xf18d('0x28')]=function(_0x3a4180,_0x487cd1){return db['VoiceQueueReport'][_0xf18d('0x4b')]({'where':{'id':_0x3a4180['params']['id']}})[_0xf18d('0x27')](handleEntityNotFound(_0x487cd1,null))[_0xf18d('0x27')](removeEntity(_0x487cd1,null))[_0xf18d('0x47')](handleError(_0x487cd1,null));};exports[_0xf18d('0x4e')]=function(_0x4241a8,_0x2b2c87){return db[_0xf18d('0x2f')][_0xf18d('0x4e')]()[_0xf18d('0x27')](respondWithResult(_0x2b2c87,null))['catch'](handleError(_0x2b2c87,null));};exports[_0xf18d('0x4f')]=function(_0x3a1c89,_0x3cfec4){var _0x19d8c6={},_0x1c356d={},_0x14e244={'count':0x0,'rows':[]};_0x1c356d[_0xf18d('0x37')]=_[_0xf18d('0x34')](db[_0xf18d('0x2f')][_0xf18d('0x30')]);_0x1c356d[_0xf18d('0x35')]=_[_0xf18d('0x34')](_0x3a1c89['query']);_0x1c356d[_0xf18d('0x40')]=_['intersection'](_0x1c356d[_0xf18d('0x37')],_0x1c356d[_0xf18d('0x35')]);_0x19d8c6[_0xf18d('0x38')]=_[_0xf18d('0x36')](_0x1c356d[_0xf18d('0x37')],qs[_0xf18d('0x39')](_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x39')]));_0x19d8c6[_0xf18d('0x38')]=_0x19d8c6[_0xf18d('0x38')][_0xf18d('0x3a')]?_0x19d8c6[_0xf18d('0x38')]:_0x1c356d[_0xf18d('0x37')];if(!_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x3b')]('nolimit')){_0x19d8c6[_0xf18d('0x1f')]=qs['limit'](_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x1f')]);_0x19d8c6[_0xf18d('0x21')]=qs[_0xf18d('0x21')](_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x21')]);}_0x19d8c6[_0xf18d('0x50')]=qs[_0xf18d('0x3d')](_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x3d')]);_0x19d8c6[_0xf18d('0x3e')]=qs[_0xf18d('0x40')](_['pick'](_0x3a1c89[_0xf18d('0x35')],_0x1c356d['filters']));if(_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x41')]){_0x19d8c6[_0xf18d('0x3e')]=_['merge'](_0x19d8c6['where'],{'$or':_[_0xf18d('0x2e')](_0x19d8c6[_0xf18d('0x38')],function(_0x278f9b){var _0x2d8501={};_0x2d8501[_0x278f9b]={'$like':'%'+_0x3a1c89[_0xf18d('0x35')][_0xf18d('0x41')]+'%'};return _0x2d8501;})});}_0x19d8c6=_['merge']({},_0x19d8c6,_0x3a1c89[_0xf18d('0x4a')]);var _0x4f22de={'where':_0x19d8c6['where']};return db[_0xf18d('0x2f')][_0xf18d('0x20')](_0x4f22de)[_0xf18d('0x27')](function(_0xac3bdf){_0x14e244[_0xf18d('0x20')]=_0xac3bdf;if(_0x3a1c89[_0xf18d('0x35')]['includeAll']){_0x19d8c6[_0xf18d('0x45')]=[{'all':!![]}];}return db[_0xf18d('0x2f')][_0xf18d('0x51')](_0x19d8c6);})['then'](function(_0x5ba492){_0x14e244[_0xf18d('0x46')]=_0x5ba492;return _0x14e244;})['then'](respondWithFilteredResult(_0x3cfec4,_0x19d8c6,_0xf18d('0x4f')))[_0xf18d('0x47')](handleError(_0x3cfec4,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x2f56=['fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','name','index','map','VoiceQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2f56,0x19e));var _0x62f5=function(_0x2dba2e,_0x1120bf){_0x2dba2e=_0x2dba2e-0x0;var _0x58f8ca=_0x2f56[_0x2dba2e];return _0x58f8ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62f5('0x0'));var zipdir=require(_0x62f5('0x1'));var jsonpatch=require(_0x62f5('0x2'));var rp=require(_0x62f5('0x3'));var moment=require(_0x62f5('0x4'));var BPromise=require(_0x62f5('0x5'));var Mustache=require(_0x62f5('0x6'));var util=require(_0x62f5('0x7'));var path=require(_0x62f5('0x8'));var sox=require(_0x62f5('0x9'));var csv=require('to-csv');var ejs=require(_0x62f5('0xa'));var fs=require('fs');var fs_extra=require(_0x62f5('0xb'));var _=require(_0x62f5('0xc'));var squel=require(_0x62f5('0xd'));var crypto=require(_0x62f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x62f5('0xf'));var toCsv=require(_0x62f5('0x10'));var querystring=require(_0x62f5('0x11'));var Papa=require(_0x62f5('0x12'));var Redis=require(_0x62f5('0x13'));var authService=require(_0x62f5('0x14'));var qs=require(_0x62f5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62f5('0x16'));var logger=require(_0x62f5('0x17'))(_0x62f5('0x18'));var utils=require('../../config/utils');var config=require(_0x62f5('0x19'));var licenseUtil=require(_0x62f5('0x1a'));var db=require(_0x62f5('0x1b'))['db'];config['redis']=_[_0x62f5('0x1c')](config[_0x62f5('0x1d')],{'host':_0x62f5('0x1e'),'port':0x18eb});var socket=require(_0x62f5('0x1f'))(new Redis(config[_0x62f5('0x1d')]));require(_0x62f5('0x20'))[_0x62f5('0x21')](socket);function respondWithStatusCode(_0x33fa71,_0x329099){_0x329099=_0x329099||0xcc;return function(_0x133cb9){if(_0x133cb9){return _0x33fa71[_0x62f5('0x22')](_0x329099);}return _0x33fa71[_0x62f5('0x23')](_0x329099)[_0x62f5('0x24')]();};}function respondWithResult(_0x2ed8d0,_0x342c5d){_0x342c5d=_0x342c5d||0xc8;return function(_0x2dcdc9){if(_0x2dcdc9){return _0x2ed8d0[_0x62f5('0x23')](_0x342c5d)[_0x62f5('0x25')](_0x2dcdc9);}};}function respondWithFilteredResult(_0x5a22e7,_0x250337){return function(_0x27b9c3){if(_0x27b9c3){var _0x50176a=typeof _0x250337[_0x62f5('0x26')]==='undefined'&&typeof _0x250337['limit']===_0x62f5('0x27');var _0x23cdd4=_0x27b9c3[_0x62f5('0x28')];var _0x147125=_0x50176a?0x0:_0x250337[_0x62f5('0x26')];var _0x167a14=_0x50176a?_0x27b9c3[_0x62f5('0x28')]:_0x250337[_0x62f5('0x26')]+_0x250337['limit'];var _0x5555da;if(_0x167a14>=_0x23cdd4){_0x167a14=_0x23cdd4;_0x5555da=0xc8;}else{_0x5555da=0xce;}_0x5a22e7['status'](_0x5555da);return _0x5a22e7[_0x62f5('0x29')]('Content-Range',_0x147125+'-'+_0x167a14+'/'+_0x23cdd4)[_0x62f5('0x25')](_0x27b9c3);}return null;};}function patchUpdates(_0x3dec13){return function(_0x1a45f4){try{jsonpatch[_0x62f5('0x2a')](_0x1a45f4,_0x3dec13,!![]);}catch(_0x545ac3){return BPromise[_0x62f5('0x2b')](_0x545ac3);}return _0x1a45f4[_0x62f5('0x2c')]();};}function saveUpdates(_0x3dc16f,_0x16cb9e){return function(_0x3e7666){if(_0x3e7666){return _0x3e7666[_0x62f5('0x2d')](_0x3dc16f)[_0x62f5('0x2e')](function(_0x42a5ef){return _0x42a5ef;});}return null;};}function removeEntity(_0x44dc63,_0x105e0c){return function(_0x12690a){if(_0x12690a){return _0x12690a[_0x62f5('0x2f')]()[_0x62f5('0x2e')](function(){_0x44dc63[_0x62f5('0x23')](0xcc)[_0x62f5('0x24')]();});}};}function handleEntityNotFound(_0x4dac11,_0x9c6f06){return function(_0x2010fd){if(!_0x2010fd){_0x4dac11[_0x62f5('0x22')](0x194);}return _0x2010fd;};}function handleError(_0xec76d6,_0x4b2e5b){_0x4b2e5b=_0x4b2e5b||0x1f4;return function(_0xe2bf6e){logger['error'](_0xe2bf6e['stack']);if(_0xe2bf6e[_0x62f5('0x30')]){delete _0xe2bf6e['name'];}_0xec76d6[_0x62f5('0x23')](_0x4b2e5b)['send'](_0xe2bf6e);};}exports[_0x62f5('0x31')]=function(_0x54c79d,_0x377d88){var _0x49e768={},_0x3cf7a2={},_0x4b1525={'count':0x0,'rows':[]};var _0x1eae04=_[_0x62f5('0x32')](db[_0x62f5('0x33')]['rawAttributes'],function(_0x6cde23){return{'name':_0x6cde23[_0x62f5('0x34')],'type':_0x6cde23[_0x62f5('0x35')]['key']};});_0x3cf7a2[_0x62f5('0x36')]=_[_0x62f5('0x32')](_0x1eae04,_0x62f5('0x30'));_0x3cf7a2[_0x62f5('0x37')]=_[_0x62f5('0x38')](_0x54c79d[_0x62f5('0x37')]);_0x3cf7a2[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x3cf7a2[_0x62f5('0x36')],_0x3cf7a2[_0x62f5('0x37')]);_0x49e768[_0x62f5('0x3b')]=_['intersection'](_0x3cf7a2[_0x62f5('0x36')],qs['fields'](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x3c')]));_0x49e768[_0x62f5('0x3b')]=_0x49e768[_0x62f5('0x3b')][_0x62f5('0x3d')]?_0x49e768[_0x62f5('0x3b')]:_0x3cf7a2['model'];if(!_0x54c79d[_0x62f5('0x37')][_0x62f5('0x3e')](_0x62f5('0x3f'))){_0x49e768[_0x62f5('0x40')]=qs['limit'](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x40')]);_0x49e768[_0x62f5('0x26')]=qs[_0x62f5('0x26')](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x26')]);}_0x49e768[_0x62f5('0x41')]=qs[_0x62f5('0x42')](_0x54c79d['query']['sort']);_0x49e768[_0x62f5('0x43')]=qs[_0x62f5('0x39')](_[_0x62f5('0x44')](_0x54c79d[_0x62f5('0x37')],_0x3cf7a2[_0x62f5('0x39')]),_0x1eae04);if(_0x54c79d[_0x62f5('0x37')][_0x62f5('0x45')]){_0x49e768[_0x62f5('0x43')]=_[_0x62f5('0x46')](_0x49e768[_0x62f5('0x43')],{'$or':_[_0x62f5('0x32')](_0x1eae04,function(_0x273d15){if(_0x273d15[_0x62f5('0x35')]!=='VIRTUAL'){var _0x8d6952={};_0x8d6952[_0x273d15['name']]={'$like':'%'+_0x54c79d[_0x62f5('0x37')][_0x62f5('0x45')]+'%'};return _0x8d6952;}})});}_0x49e768=_[_0x62f5('0x46')]({},_0x49e768,_0x54c79d[_0x62f5('0x47')]);var _0x45f070={'where':_0x49e768[_0x62f5('0x43')]};return db[_0x62f5('0x33')]['count'](_0x45f070)[_0x62f5('0x2e')](function(_0x143bb9){_0x4b1525[_0x62f5('0x28')]=_0x143bb9;if(_0x54c79d['query'][_0x62f5('0x48')]){_0x49e768[_0x62f5('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x62f5('0x4a')](_0x49e768);})['then'](function(_0x1ce2db){_0x4b1525[_0x62f5('0x4b')]=_0x1ce2db;return _0x4b1525;})[_0x62f5('0x2e')](respondWithFilteredResult(_0x377d88,_0x49e768))[_0x62f5('0x4c')](handleError(_0x377d88,null));};exports[_0x62f5('0x4d')]=function(_0x4b2d0d,_0x2be7ce){var _0x4275ee={'raw':![],'where':{'id':_0x4b2d0d[_0x62f5('0x4e')]['id']}},_0x318fb0={};_0x318fb0[_0x62f5('0x36')]=_[_0x62f5('0x38')](db['VoiceQueueReport'][_0x62f5('0x4f')]);_0x318fb0[_0x62f5('0x37')]=_['keys'](_0x4b2d0d[_0x62f5('0x37')]);_0x318fb0[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x318fb0['model'],_0x318fb0[_0x62f5('0x37')]);_0x4275ee['attributes']=_[_0x62f5('0x3a')](_0x318fb0[_0x62f5('0x36')],qs[_0x62f5('0x3c')](_0x4b2d0d[_0x62f5('0x37')][_0x62f5('0x3c')]));_0x4275ee['attributes']=_0x4275ee[_0x62f5('0x3b')][_0x62f5('0x3d')]?_0x4275ee[_0x62f5('0x3b')]:_0x318fb0[_0x62f5('0x36')];if(_0x4b2d0d[_0x62f5('0x37')][_0x62f5('0x48')]){_0x4275ee['include']=[{'all':!![]}];}_0x4275ee=_[_0x62f5('0x46')]({},_0x4275ee,_0x4b2d0d[_0x62f5('0x47')]);return db[_0x62f5('0x33')][_0x62f5('0x50')](_0x4275ee)[_0x62f5('0x2e')](handleEntityNotFound(_0x2be7ce,null))['then'](respondWithResult(_0x2be7ce,null))[_0x62f5('0x4c')](handleError(_0x2be7ce,null));};exports[_0x62f5('0x51')]=function(_0x545d8f,_0x1d071d){return db[_0x62f5('0x33')][_0x62f5('0x51')](_0x545d8f['body'],{})[_0x62f5('0x2e')](respondWithResult(_0x1d071d,0xc9))[_0x62f5('0x4c')](handleError(_0x1d071d,null));};exports[_0x62f5('0x2d')]=function(_0xa6375c,_0x3d9818){if(_0xa6375c[_0x62f5('0x52')]['id']){delete _0xa6375c[_0x62f5('0x52')]['id'];}return db[_0x62f5('0x33')][_0x62f5('0x50')]({'where':{'id':_0xa6375c['params']['id']}})['then'](handleEntityNotFound(_0x3d9818,null))[_0x62f5('0x2e')](saveUpdates(_0xa6375c[_0x62f5('0x52')],null))[_0x62f5('0x2e')](respondWithResult(_0x3d9818,null))[_0x62f5('0x4c')](handleError(_0x3d9818,null));};exports['destroy']=function(_0x2ce624,_0x1e9ceb){return db[_0x62f5('0x33')][_0x62f5('0x50')]({'where':{'id':_0x2ce624[_0x62f5('0x4e')]['id']}})[_0x62f5('0x2e')](handleEntityNotFound(_0x1e9ceb,null))[_0x62f5('0x2e')](removeEntity(_0x1e9ceb,null))['catch'](handleError(_0x1e9ceb,null));};exports['describe']=function(_0x491604,_0x4bf574){return db[_0x62f5('0x33')][_0x62f5('0x53')]()[_0x62f5('0x2e')](respondWithResult(_0x4bf574,null))['catch'](handleError(_0x4bf574,null));};exports[_0x62f5('0x54')]=function(_0x3c68e2,_0x96ad2b){var _0x5adaaa={},_0x128fc8={},_0x35a3b3={'count':0x0,'rows':[]};_0x128fc8[_0x62f5('0x36')]=_[_0x62f5('0x38')](db[_0x62f5('0x33')][_0x62f5('0x4f')]);_0x128fc8[_0x62f5('0x37')]=_[_0x62f5('0x38')](_0x3c68e2[_0x62f5('0x37')]);_0x128fc8[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x128fc8[_0x62f5('0x36')],_0x128fc8[_0x62f5('0x37')]);_0x5adaaa['attributes']=_[_0x62f5('0x3a')](_0x128fc8['model'],qs['fields'](_0x3c68e2['query'][_0x62f5('0x3c')]));_0x5adaaa[_0x62f5('0x3b')]=_0x5adaaa['attributes']['length']?_0x5adaaa['attributes']:_0x128fc8[_0x62f5('0x36')];if(!_0x3c68e2[_0x62f5('0x37')]['hasOwnProperty'](_0x62f5('0x3f'))){_0x5adaaa[_0x62f5('0x40')]=qs['limit'](_0x3c68e2['query'][_0x62f5('0x40')]);_0x5adaaa[_0x62f5('0x26')]=qs[_0x62f5('0x26')](_0x3c68e2[_0x62f5('0x37')][_0x62f5('0x26')]);}_0x5adaaa[_0x62f5('0x41')]=qs[_0x62f5('0x42')](_0x3c68e2[_0x62f5('0x37')]['sort']);_0x5adaaa[_0x62f5('0x43')]=qs[_0x62f5('0x39')](_[_0x62f5('0x44')](_0x3c68e2[_0x62f5('0x37')],_0x128fc8['filters']));if(_0x3c68e2[_0x62f5('0x37')]['filter']){_0x5adaaa[_0x62f5('0x43')]=_[_0x62f5('0x46')](_0x5adaaa[_0x62f5('0x43')],{'$or':_['map'](_0x5adaaa[_0x62f5('0x3b')],function(_0x102e10){var _0x2cd191={};_0x2cd191[_0x102e10]={'$like':'%'+_0x3c68e2['query']['filter']+'%'};return _0x2cd191;})});}_0x5adaaa=_['merge']({},_0x5adaaa,_0x3c68e2[_0x62f5('0x47')]);var _0x197166={'where':_0x5adaaa[_0x62f5('0x43')]};return db[_0x62f5('0x33')][_0x62f5('0x28')](_0x197166)[_0x62f5('0x2e')](function(_0x5f2589){_0x35a3b3[_0x62f5('0x28')]=_0x5f2589;if(_0x3c68e2[_0x62f5('0x37')][_0x62f5('0x48')]){_0x5adaaa[_0x62f5('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x62f5('0x4a')](_0x5adaaa);})[_0x62f5('0x2e')](function(_0x5e1aa7){_0x35a3b3[_0x62f5('0x4b')]=_0x5e1aa7;return _0x35a3b3;})[_0x62f5('0x2e')](respondWithFilteredResult(_0x96ad2b,_0x5adaaa,_0x62f5('0x54')))[_0x62f5('0x4c')](handleError(_0x96ad2b,null,_0x62f5('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6839012..14e516e 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 _0x2eca=['hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0x2eca,0xec));var _0xa2ec=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0x2eca[_0x3f288d];return _0x5e8468;};'use strict';var EventEmitter=require(_0xa2ec('0x0'));var VoiceQueueReport=require(_0xa2ec('0x1'))['db'][_0xa2ec('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa2ec('0x3')](0x0);var events={'afterCreate':_0xa2ec('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d972c){return function(_0x1c2896,_0x313cd4,_0x2153a9){VoiceQueueReportEvents[_0xa2ec('0x5')](_0x1d972c+':'+_0x1c2896['id'],_0x1c2896);VoiceQueueReportEvents[_0xa2ec('0x5')](_0x1d972c,_0x1c2896);_0x2153a9(null);};}for(var e in events){if(events[_0xa2ec('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa2ec('0x7')](e,emitEvent(event));}}module[_0xa2ec('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4b54=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x4b54,0x17a));var _0x44b5=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x4b54[_0x27bd2c];return _0x3784ea;};'use strict';var EventEmitter=require(_0x44b5('0x0'));var VoiceQueueReport=require(_0x44b5('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44b5('0x2'),'afterUpdate':_0x44b5('0x3'),'afterDestroy':_0x44b5('0x4')};function emitEvent(_0x3be756){return function(_0x41f525,_0x3eb325,_0x29f645){VoiceQueueReportEvents[_0x44b5('0x5')](_0x3be756+':'+_0x41f525['id'],_0x41f525);VoiceQueueReportEvents[_0x44b5('0x5')](_0x3be756,_0x41f525);_0x29f645(null);};}for(var e in events){if(events[_0x44b5('0x6')](e)){var event=events[e];VoiceQueueReport[_0x44b5('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 0aa394e..99a3796 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 _0xf0be=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4def12,_0x45a687){var _0x393f62=function(_0x941d8b){while(--_0x941d8b){_0x4def12['push'](_0x4def12['shift']());}};_0x393f62(++_0x45a687);}(_0xf0be,0x1cb));var _0xef0b=function(_0x1c2a5d,_0x172c28){_0x1c2a5d=_0x1c2a5d-0x0;var _0x1786c9=_0xf0be[_0x1c2a5d];return _0x1786c9;};'use strict';var _=require(_0xef0b('0x0'));var util=require(_0xef0b('0x1'));var logger=require(_0xef0b('0x2'))('api');var moment=require(_0xef0b('0x3'));var BPromise=require(_0xef0b('0x4'));var rp=require(_0xef0b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef0b('0x6'));var config=require(_0xef0b('0x7'));var attributes=require(_0xef0b('0x8'));module[_0xef0b('0x9')]=function(_0x398fbf,_0x31cb0b){return _0x398fbf[_0xef0b('0xa')](_0xef0b('0xb'),attributes,{'tableName':_0xef0b('0xc'),'paranoid':![],'indexes':[{'fields':[_0xef0b('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0663=['define','report_queue','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes'];(function(_0x2545d0,_0x397e79){var _0x10111b=function(_0x2fdcd8){while(--_0x2fdcd8){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10111b(++_0x397e79);}(_0x0663,0xea));var _0x3066=function(_0x5ce798,_0x458f99){_0x5ce798=_0x5ce798-0x0;var _0x279321=_0x0663[_0x5ce798];return _0x279321;};'use strict';var _=require(_0x3066('0x0'));var util=require(_0x3066('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3066('0x2'));var BPromise=require(_0x3066('0x3'));var rp=require(_0x3066('0x4'));var fs=require('fs');var path=require(_0x3066('0x5'));var rimraf=require(_0x3066('0x6'));var config=require('../../config/environment');var attributes=require(_0x3066('0x7'));module['exports']=function(_0x464500,_0x38fc77){return _0x464500[_0x3066('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x3066('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x3066('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7053f6d..9eae272 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 _0x2da9=['then','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','include','model','map'];(function(_0xf4eae3,_0x438eba){var _0x441c2a=function(_0x192b43){while(--_0x192b43){_0xf4eae3['push'](_0xf4eae3['shift']());}};_0x441c2a(++_0x438eba);}(_0x2da9,0x8c));var _0x92da=function(_0x1fa9d2,_0x5d72d9){_0x1fa9d2=_0x1fa9d2-0x0;var _0x1f4ffc=_0x2da9[_0x1fa9d2];return _0x1f4ffc;};'use strict';var _=require(_0x92da('0x0'));var util=require('util');var moment=require(_0x92da('0x1'));var BPromise=require(_0x92da('0x2'));var rs=require(_0x92da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92da('0x4'))['db'];var utils=require(_0x92da('0x5'));var logger=require(_0x92da('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x92da('0x7'));var client=jayson[_0x92da('0x8')]['http']({'port':0x232a});config[_0x92da('0x9')]=_[_0x92da('0xa')](config[_0x92da('0x9')],{'host':_0x92da('0xb'),'port':0x18eb});var socket=require(_0x92da('0xc'))(new Redis(config[_0x92da('0x9')]));require(_0x92da('0xd'))[_0x92da('0xe')](socket);function respondWithRpcPromise(_0x192156,_0x1a03b8,_0x46d017){return new BPromise(function(_0x29fc98,_0x35c792){return client[_0x92da('0xf')](_0x192156,_0x46d017)['then'](function(_0x360060){logger[_0x92da('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a03b8,_0x92da('0x11'));logger[_0x92da('0x12')](_0x92da('0x13'),_0x1a03b8,_0x92da('0x11'),JSON[_0x92da('0x14')](_0x360060));if(_0x360060[_0x92da('0x15')]){if(_0x360060['error'][_0x92da('0x16')]===0x1f4){logger[_0x92da('0x15')](_0x92da('0x17'),_0x1a03b8,_0x360060[_0x92da('0x15')]['message']);return _0x35c792(_0x360060[_0x92da('0x15')]['message']);}logger[_0x92da('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a03b8,_0x360060[_0x92da('0x15')][_0x92da('0x18')]);return _0x29fc98(_0x360060[_0x92da('0x15')][_0x92da('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1a03b8,_0x92da('0x11'));_0x29fc98(_0x360060[_0x92da('0x19')][_0x92da('0x18')]);}})[_0x92da('0x1a')](function(_0x9e1c70){logger[_0x92da('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a03b8,_0x9e1c70);_0x35c792(_0x9e1c70);});});}exports['GetVoiceQueueReport']=function(_0x59df94){var _0x1faa28=this;return new Promise(function(_0x2ade33,_0x2eec16){return db[_0x92da('0x1b')][_0x92da('0x1c')]({'raw':_0x59df94[_0x92da('0x1d')]?_0x59df94[_0x92da('0x1d')][_0x92da('0x1e')]===undefined?!![]:![]:!![],'where':_0x59df94[_0x92da('0x1d')]?_0x59df94[_0x92da('0x1d')][_0x92da('0x1f')]||null:null,'attributes':_0x59df94[_0x92da('0x1d')]?_0x59df94[_0x92da('0x1d')][_0x92da('0x20')]||null:null,'limit':_0x59df94[_0x92da('0x1d')]?_0x59df94[_0x92da('0x1d')]['limit']||null:null,'include':_0x59df94['options']?_0x59df94[_0x92da('0x1d')][_0x92da('0x21')]?_['map'](_0x59df94[_0x92da('0x1d')][_0x92da('0x21')],function(_0x56178d){return{'model':db[_0x56178d[_0x92da('0x22')]],'as':_0x56178d['as'],'attributes':_0x56178d[_0x92da('0x20')],'include':_0x56178d[_0x92da('0x21')]?_[_0x92da('0x23')](_0x56178d[_0x92da('0x21')],function(_0x5b7491){return{'model':db[_0x5b7491[_0x92da('0x22')]],'as':_0x5b7491['as'],'attributes':_0x5b7491[_0x92da('0x20')],'include':_0x5b7491[_0x92da('0x21')]?_[_0x92da('0x23')](_0x5b7491[_0x92da('0x21')],function(_0x566a4b){return{'model':db[_0x566a4b[_0x92da('0x22')]],'as':_0x566a4b['as'],'attributes':_0x566a4b['attributes']};}):[]};}):[]};}):[]:[]})[_0x92da('0x24')](function(_0x2ed032){logger['info'](_0x92da('0x25'),_0x59df94);logger[_0x92da('0x12')](_0x92da('0x25'),_0x59df94,JSON[_0x92da('0x14')](_0x2ed032));_0x2ade33(_0x2ed032);})[_0x92da('0x1a')](function(_0x228f5c){logger[_0x92da('0x15')](_0x92da('0x25'),_0x228f5c[_0x92da('0x18')],_0x59df94);_0x2eec16(_0x1faa28[_0x92da('0x15')](0x1f4,_0x228f5c[_0x92da('0x18')]));});});};exports[_0x92da('0x26')]=function(_0x4d18bd){var _0x2c8bd2=this;return new Promise(function(_0x2cf1c9,_0x2da53f){return db[_0x92da('0x1b')][_0x92da('0x27')](_0x4d18bd[_0x92da('0x28')],{'raw':_0x4d18bd[_0x92da('0x1d')]?_0x4d18bd['options']['raw']===undefined?!![]:![]:!![]})[_0x92da('0x24')](function(_0x35dff2){logger[_0x92da('0x10')](_0x92da('0x26'),_0x4d18bd);logger[_0x92da('0x12')](_0x92da('0x26'),_0x4d18bd,JSON[_0x92da('0x14')](_0x35dff2));_0x2cf1c9(_0x35dff2);})[_0x92da('0x1a')](function(_0x5bc4c8){logger[_0x92da('0x15')](_0x92da('0x26'),_0x5bc4c8[_0x92da('0x18')],_0x4d18bd);_0x2da53f(_0x2c8bd2[_0x92da('0x15')](0x1f4,_0x5bc4c8[_0x92da('0x18')]));});});};exports[_0x92da('0x29')]=function(_0x17510c){var _0x2d3aab=this;return new Promise(function(_0x1a4bbb,_0x409ef1){return db[_0x92da('0x1b')][_0x92da('0x2a')](_0x17510c[_0x92da('0x28')],{'raw':_0x17510c['options']?_0x17510c[_0x92da('0x1d')][_0x92da('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17510c[_0x92da('0x1d')]?_0x17510c[_0x92da('0x1d')][_0x92da('0x1f')]||null:null,'attributes':_0x17510c[_0x92da('0x1d')]?_0x17510c[_0x92da('0x1d')][_0x92da('0x20')]||null:null,'limit':_0x17510c[_0x92da('0x1d')]?_0x17510c[_0x92da('0x1d')][_0x92da('0x2b')]||null:null})[_0x92da('0x24')](function(_0x4cd95b){logger[_0x92da('0x10')](_0x92da('0x29'),_0x17510c);logger[_0x92da('0x12')](_0x92da('0x29'),_0x17510c,JSON[_0x92da('0x14')](_0x4cd95b));_0x1a4bbb(_0x4cd95b);})[_0x92da('0x1a')](function(_0x4bdb19){logger['error']('UpdateVoiceQueueReport',_0x4bdb19[_0x92da('0x18')],_0x17510c);_0x409ef1(_0x2d3aab[_0x92da('0x15')](0x1f4,_0x4bdb19[_0x92da('0x18')]));});});}; \ No newline at end of file +var _0xae06=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceQueueReport','options','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','catch','update','raw','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x150152,_0x3752ae){var _0x315897=function(_0x1b1362){while(--_0x1b1362){_0x150152['push'](_0x150152['shift']());}};_0x315897(++_0x3752ae);}(_0xae06,0xb4));var _0x6ae0=function(_0x163c7e,_0x41aa01){_0x163c7e=_0x163c7e-0x0;var _0xa5eb7d=_0xae06[_0x163c7e];return _0xa5eb7d;};'use strict';var _=require(_0x6ae0('0x0'));var util=require(_0x6ae0('0x1'));var moment=require(_0x6ae0('0x2'));var BPromise=require(_0x6ae0('0x3'));var rs=require(_0x6ae0('0x4'));var fs=require('fs');var Redis=require(_0x6ae0('0x5'));var db=require(_0x6ae0('0x6'))['db'];var utils=require(_0x6ae0('0x7'));var logger=require(_0x6ae0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ae0('0x9'));var client=jayson['client'][_0x6ae0('0xa')]({'port':0x232a});config[_0x6ae0('0xb')]=_['defaults'](config[_0x6ae0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ae0('0xc'))(new Redis(config[_0x6ae0('0xb')]));require(_0x6ae0('0xd'))[_0x6ae0('0xe')](socket);function respondWithRpcPromise(_0xa7d8b9,_0x507bbe,_0x1ca236){return new BPromise(function(_0x412720,_0x3275b4){return client[_0x6ae0('0xf')](_0xa7d8b9,_0x1ca236)[_0x6ae0('0x10')](function(_0x401e0f){logger[_0x6ae0('0x11')](_0x6ae0('0x12'),_0x507bbe,_0x6ae0('0x13'));logger['debug'](_0x6ae0('0x14'),_0x507bbe,'request\x20sent',JSON[_0x6ae0('0x15')](_0x401e0f));if(_0x401e0f[_0x6ae0('0x16')]){if(_0x401e0f[_0x6ae0('0x16')]['code']===0x1f4){logger[_0x6ae0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x507bbe,_0x401e0f['error']['message']);return _0x3275b4(_0x401e0f['error']['message']);}logger[_0x6ae0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x507bbe,_0x401e0f[_0x6ae0('0x16')][_0x6ae0('0x17')]);return _0x412720(_0x401e0f['error'][_0x6ae0('0x17')]);}else{logger[_0x6ae0('0x11')](_0x6ae0('0x12'),_0x507bbe,_0x6ae0('0x13'));_0x412720(_0x401e0f[_0x6ae0('0x18')][_0x6ae0('0x17')]);}})['catch'](function(_0x3415c7){logger[_0x6ae0('0x16')](_0x6ae0('0x12'),_0x507bbe,_0x3415c7);_0x3275b4(_0x3415c7);});});}exports['GetVoiceQueueReport']=function(_0x2fba81){var _0x5d98cb=this;return new Promise(function(_0x3f9730,_0x7624d2){return db[_0x6ae0('0x19')]['findAll']({'raw':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1b')]||null:null,'attributes':_0x2fba81['options']?_0x2fba81[_0x6ae0('0x1a')]['attributes']||null:null,'limit':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1c')]||null:null,'include':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1d')]?_[_0x6ae0('0x1e')](_0x2fba81[_0x6ae0('0x1a')]['include'],function(_0x4e08c7){return{'model':db[_0x4e08c7[_0x6ae0('0x1f')]],'as':_0x4e08c7['as'],'attributes':_0x4e08c7[_0x6ae0('0x20')],'include':_0x4e08c7[_0x6ae0('0x1d')]?_[_0x6ae0('0x1e')](_0x4e08c7[_0x6ae0('0x1d')],function(_0x8b332){return{'model':db[_0x8b332['model']],'as':_0x8b332['as'],'attributes':_0x8b332[_0x6ae0('0x20')],'include':_0x8b332[_0x6ae0('0x1d')]?_['map'](_0x8b332[_0x6ae0('0x1d')],function(_0x5ee1b8){return{'model':db[_0x5ee1b8[_0x6ae0('0x1f')]],'as':_0x5ee1b8['as'],'attributes':_0x5ee1b8[_0x6ae0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6ae0('0x10')](function(_0x4ca2dd){logger[_0x6ae0('0x11')]('GetVoiceQueueReport',_0x2fba81);logger['debug'](_0x6ae0('0x21'),_0x2fba81,JSON[_0x6ae0('0x15')](_0x4ca2dd));_0x3f9730(_0x4ca2dd);})['catch'](function(_0x485cd2){logger[_0x6ae0('0x16')](_0x6ae0('0x21'),_0x485cd2[_0x6ae0('0x17')],_0x2fba81);_0x7624d2(_0x5d98cb[_0x6ae0('0x16')](0x1f4,_0x485cd2[_0x6ae0('0x17')]));});});};exports[_0x6ae0('0x22')]=function(_0x257b01){var _0x44ae6f=this;return new Promise(function(_0x5812bc,_0x272159){return db['VoiceQueueReport'][_0x6ae0('0x23')](_0x257b01['body'],{'raw':_0x257b01[_0x6ae0('0x1a')]?_0x257b01['options']['raw']===undefined?!![]:![]:!![]})[_0x6ae0('0x10')](function(_0x282102){logger['info'](_0x6ae0('0x22'),_0x257b01);logger['debug'](_0x6ae0('0x22'),_0x257b01,JSON['stringify'](_0x282102));_0x5812bc(_0x282102);})[_0x6ae0('0x24')](function(_0x4d14b6){logger['error'](_0x6ae0('0x22'),_0x4d14b6[_0x6ae0('0x17')],_0x257b01);_0x272159(_0x44ae6f[_0x6ae0('0x16')](0x1f4,_0x4d14b6[_0x6ae0('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x480bd9){var _0x31e68a=this;return new Promise(function(_0xc9dead,_0x3d1ba7){return db[_0x6ae0('0x19')][_0x6ae0('0x25')](_0x480bd9['body'],{'raw':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9['options'][_0x6ae0('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480bd9['options']?_0x480bd9[_0x6ae0('0x1a')]['where']||null:null,'attributes':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9[_0x6ae0('0x1a')][_0x6ae0('0x20')]||null:null,'limit':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9[_0x6ae0('0x1a')][_0x6ae0('0x1c')]||null:null})[_0x6ae0('0x10')](function(_0x8bb567){logger['info']('UpdateVoiceQueueReport',_0x480bd9);logger['debug'](_0x6ae0('0x27'),_0x480bd9,JSON[_0x6ae0('0x15')](_0x8bb567));_0xc9dead(_0x8bb567);})['catch'](function(_0x18a519){logger[_0x6ae0('0x16')]('UpdateVoiceQueueReport',_0x18a519[_0x6ae0('0x17')],_0x480bd9);_0x3d1ba7(_0x31e68a[_0x6ae0('0x16')](0x1f4,_0x18a519[_0x6ae0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f73ddf5..73e3d01 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 _0x78f0=['save','remove','update','removeListener','register','length','voiceQueueReport:'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0x78f0,0x1dc));var _0x078f=function(_0x359a55,_0x5df398){_0x359a55=_0x359a55-0x0;var _0x26510f=_0x78f0[_0x359a55];return _0x26510f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x078f('0x0'),_0x078f('0x1'),_0x078f('0x2')];function createListener(_0x2cad6e,_0x1221dc){return function(_0x4ceeca){_0x1221dc['emit'](_0x2cad6e,_0x4ceeca);};}function removeListener(_0x2c61b4,_0x478069){return function(){VoiceQueueReportEvents[_0x078f('0x3')](_0x2c61b4,_0x478069);};}exports[_0x078f('0x4')]=function(_0x14761f){for(var _0x332899=0x0,_0x4b0413=events[_0x078f('0x5')];_0x332899<_0x4b0413;_0x332899++){var _0x1f31e1=events[_0x332899];var _0x4f6f4d=createListener(_0x078f('0x6')+_0x1f31e1,_0x14761f);VoiceQueueReportEvents['on'](_0x1f31e1,_0x4f6f4d);}}; \ No newline at end of file +var _0x121d=['register','length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x34f8a8,_0x186230){var _0x111f52=function(_0x4b075c){while(--_0x4b075c){_0x34f8a8['push'](_0x34f8a8['shift']());}};_0x111f52(++_0x186230);}(_0x121d,0xea));var _0xd121=function(_0x9a0c2e,_0x3381d3){_0x9a0c2e=_0x9a0c2e-0x0;var _0x56bd45=_0x121d[_0x9a0c2e];return _0x56bd45;};'use strict';var VoiceQueueReportEvents=require(_0xd121('0x0'));var events=[_0xd121('0x1'),_0xd121('0x2'),_0xd121('0x3')];function createListener(_0x16ed51,_0x40e506){return function(_0x233726){_0x40e506[_0xd121('0x4')](_0x16ed51,_0x233726);};}function removeListener(_0x20a687,_0x349fc5){return function(){VoiceQueueReportEvents[_0xd121('0x5')](_0x20a687,_0x349fc5);};}exports[_0xd121('0x6')]=function(_0x2b2f41){for(var _0x31c727=0x0,_0x540cf2=events[_0xd121('0x7')];_0x31c727<_0x540cf2;_0x31c727++){var _0x5b67f7=events[_0x31c727];var _0x1da01c=createListener('voiceQueueReport:'+_0x5b67f7,_0x2b2f41);VoiceQueueReportEvents['on'](_0x5b67f7,_0x1da01c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index aa11f07..1f5c4e9 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 _0x3754=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x47c492,_0x311a27){var _0x32105d=function(_0x5b0289){while(--_0x5b0289){_0x47c492['push'](_0x47c492['shift']());}};_0x32105d(++_0x311a27);}(_0x3754,0x72));var _0x4375=function(_0x41ac39,_0x267f76){_0x41ac39=_0x41ac39-0x0;var _0x2aa5f8=_0x3754[_0x41ac39];return _0x2aa5f8;};'use strict';var multer=require(_0x4375('0x0'));var util=require(_0x4375('0x1'));var path=require(_0x4375('0x2'));var timeout=require(_0x4375('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4375('0x4'));var interaction=require(_0x4375('0x5'));var config=require(_0x4375('0x6'));var controller=require(_0x4375('0x7'));router[_0x4375('0x8')]('/',auth[_0x4375('0x9')](),controller[_0x4375('0xa')]);router[_0x4375('0x8')]('/:id',auth[_0x4375('0x9')](),controller[_0x4375('0xb')]);router[_0x4375('0xc')]('/',auth[_0x4375('0x9')](),controller[_0x4375('0xd')]);router[_0x4375('0xe')](_0x4375('0xf'),auth['isAuthenticated'](),controller[_0x4375('0x10')]);router[_0x4375('0x11')](_0x4375('0xf'),auth[_0x4375('0x9')](),controller[_0x4375('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5cd8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x3ae3df,_0x122a4e){var _0xde8953=function(_0x3b35cb){while(--_0x3b35cb){_0x3ae3df['push'](_0x3ae3df['shift']());}};_0xde8953(++_0x122a4e);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x54c70b,_0x219a96){_0x54c70b=_0x54c70b-0x0;var _0x43c2cd=_0x5cd8[_0x54c70b];return _0x43c2cd;};'use strict';var multer=require(_0x85cd('0x0'));var util=require('util');var path=require(_0x85cd('0x1'));var timeout=require(_0x85cd('0x2'));var express=require(_0x85cd('0x3'));var router=express[_0x85cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85cd('0x6'));var controller=require(_0x85cd('0x7'));router[_0x85cd('0x8')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xa')]);router['get'](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller['show']);router[_0x85cd('0xc')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xd')]);router[_0x85cd('0xe')](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xf')]);router[_0x85cd('0x10')](_0x85cd('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x85cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 04b5f27..95474a0 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 _0x6475=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x111276,_0x3a36e4){var _0x2a3f82=function(_0xc00a34){while(--_0xc00a34){_0x111276['push'](_0x111276['shift']());}};_0x2a3f82(++_0x3a36e4);}(_0x6475,0x1de));var _0x5647=function(_0x4ff120,_0x30ee0b){_0x4ff120=_0x4ff120-0x0;var _0x1a8437=_0x6475[_0x4ff120];return _0x1a8437;};'use strict';var Sequelize=require(_0x5647('0x0'));var moment=require(_0x5647('0x1'));module[_0x5647('0x2')]={'time':{'type':Sequelize[_0x5647('0x3')]},'callid':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5647('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5647('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5647('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x98bb=['format','sequelize','STRING','DATE'];(function(_0x5ccaa1,_0xc6b075){var _0x48bb3f=function(_0x443d57){while(--_0x443d57){_0x5ccaa1['push'](_0x5ccaa1['shift']());}};_0x48bb3f(++_0xc6b075);}(_0x98bb,0x1d5));var _0xb98b=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x98bb[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xb98b('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xb98b('0x1')]},'callid':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb98b('0x2')],'allowNull':![],'defaultValue':moment()[_0xb98b('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9e2d85c..cd31443 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 _0xb7ef=['fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','eml-format','rimraf','zip-dir'];(function(_0x22ed8c,_0x55b71e){var _0x117271=function(_0x38963f){while(--_0x38963f){_0x22ed8c['push'](_0x22ed8c['shift']());}};_0x117271(++_0x55b71e);}(_0xb7ef,0x9b));var _0xfb7e=function(_0x44e4e1,_0x5637b2){_0x44e4e1=_0x44e4e1-0x0;var _0x300cd2=_0xb7ef[_0x44e4e1];return _0x300cd2;};'use strict';var emlformat=require(_0xfb7e('0x0'));var rimraf=require(_0xfb7e('0x1'));var zipdir=require(_0xfb7e('0x2'));var jsonpatch=require(_0xfb7e('0x3'));var rp=require(_0xfb7e('0x4'));var moment=require(_0xfb7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb7e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfb7e('0x7'));var csv=require(_0xfb7e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb7e('0x9'));var _=require('lodash');var squel=require(_0xfb7e('0xa'));var crypto=require(_0xfb7e('0xb'));var jsforce=require(_0xfb7e('0xc'));var deskjs=require(_0xfb7e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb7e('0xe'));var Papa=require(_0xfb7e('0xf'));var Redis=require(_0xfb7e('0x10'));var authService=require(_0xfb7e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb7e('0x12'));var hardwareService=require(_0xfb7e('0x13'));var logger=require(_0xfb7e('0x14'))(_0xfb7e('0x15'));var utils=require(_0xfb7e('0x16'));var config=require(_0xfb7e('0x17'));var licenseUtil=require(_0xfb7e('0x18'));var db=require(_0xfb7e('0x19'))['db'];function respondWithStatusCode(_0x38fcc0,_0x32b633){_0x32b633=_0x32b633||0xcc;return function(_0x4d1554){if(_0x4d1554){return _0x38fcc0[_0xfb7e('0x1a')](_0x32b633);}return _0x38fcc0[_0xfb7e('0x1b')](_0x32b633)[_0xfb7e('0x1c')]();};}function respondWithResult(_0x18e75a,_0x3d8b34){_0x3d8b34=_0x3d8b34||0xc8;return function(_0x14ceea){if(_0x14ceea){return _0x18e75a['status'](_0x3d8b34)[_0xfb7e('0x1d')](_0x14ceea);}};}function respondWithFilteredResult(_0x4e1179,_0x2eb99f){return function(_0x290ea3){if(_0x290ea3){var _0x10573a=typeof _0x2eb99f[_0xfb7e('0x1e')]==='undefined'&&typeof _0x2eb99f[_0xfb7e('0x1f')]===_0xfb7e('0x20');var _0x4fde06=_0x290ea3['count'];var _0x1ac677=_0x10573a?0x0:_0x2eb99f[_0xfb7e('0x1e')];var _0x45c10d=_0x10573a?_0x290ea3['count']:_0x2eb99f[_0xfb7e('0x1e')]+_0x2eb99f['limit'];var _0x5efbca;if(_0x45c10d>=_0x4fde06){_0x45c10d=_0x4fde06;_0x5efbca=0xc8;}else{_0x5efbca=0xce;}_0x4e1179['status'](_0x5efbca);return _0x4e1179[_0xfb7e('0x21')](_0xfb7e('0x22'),_0x1ac677+'-'+_0x45c10d+'/'+_0x4fde06)[_0xfb7e('0x1d')](_0x290ea3);}return null;};}function patchUpdates(_0x26a06c){return function(_0x5cbecf){try{jsonpatch[_0xfb7e('0x23')](_0x5cbecf,_0x26a06c,!![]);}catch(_0x21561d){return BPromise[_0xfb7e('0x24')](_0x21561d);}return _0x5cbecf[_0xfb7e('0x25')]();};}function saveUpdates(_0x25eae9,_0x38faa2){return function(_0x3a1b50){if(_0x3a1b50){return _0x3a1b50['update'](_0x25eae9)['then'](function(_0x4f1b61){return _0x4f1b61;});}return null;};}function removeEntity(_0x27dc92,_0x241ce6){return function(_0x15e41d){if(_0x15e41d){return _0x15e41d[_0xfb7e('0x26')]()[_0xfb7e('0x27')](function(){_0x27dc92[_0xfb7e('0x1b')](0xcc)[_0xfb7e('0x1c')]();});}};}function handleEntityNotFound(_0x4d6234,_0x30afa5){return function(_0x51ef35){if(!_0x51ef35){_0x4d6234[_0xfb7e('0x1a')](0x194);}return _0x51ef35;};}function handleError(_0x5bb2e1,_0x31ec9b){_0x31ec9b=_0x31ec9b||0x1f4;return function(_0x4a87b2){logger[_0xfb7e('0x28')](_0x4a87b2['stack']);if(_0x4a87b2['name']){delete _0x4a87b2[_0xfb7e('0x29')];}_0x5bb2e1[_0xfb7e('0x1b')](_0x31ec9b)[_0xfb7e('0x2a')](_0x4a87b2);};}exports[_0xfb7e('0x2b')]=function(_0x200f39,_0x3fbc34){var _0x2453a5={},_0x1e3ec1={},_0x228527={'count':0x0,'rows':[]};var _0x45d874=_[_0xfb7e('0x2c')](db[_0xfb7e('0x2d')]['rawAttributes'],function(_0x203eab){return{'name':_0x203eab[_0xfb7e('0x2e')],'type':_0x203eab[_0xfb7e('0x2f')][_0xfb7e('0x30')]};});_0x1e3ec1[_0xfb7e('0x31')]=_[_0xfb7e('0x2c')](_0x45d874,'name');_0x1e3ec1[_0xfb7e('0x32')]=_['keys'](_0x200f39['query']);_0x1e3ec1[_0xfb7e('0x33')]=_[_0xfb7e('0x34')](_0x1e3ec1[_0xfb7e('0x31')],_0x1e3ec1[_0xfb7e('0x32')]);_0x2453a5[_0xfb7e('0x35')]=_[_0xfb7e('0x34')](_0x1e3ec1[_0xfb7e('0x31')],qs[_0xfb7e('0x36')](_0x200f39[_0xfb7e('0x32')][_0xfb7e('0x36')]));_0x2453a5[_0xfb7e('0x35')]=_0x2453a5[_0xfb7e('0x35')][_0xfb7e('0x37')]?_0x2453a5[_0xfb7e('0x35')]:_0x1e3ec1[_0xfb7e('0x31')];if(!_0x200f39[_0xfb7e('0x32')][_0xfb7e('0x38')](_0xfb7e('0x39'))){_0x2453a5[_0xfb7e('0x1f')]=qs[_0xfb7e('0x1f')](_0x200f39[_0xfb7e('0x32')]['limit']);_0x2453a5[_0xfb7e('0x1e')]=qs[_0xfb7e('0x1e')](_0x200f39['query'][_0xfb7e('0x1e')]);}_0x2453a5['order']=qs[_0xfb7e('0x3a')](_0x200f39[_0xfb7e('0x32')][_0xfb7e('0x3a')]);_0x2453a5['where']=qs[_0xfb7e('0x33')](_[_0xfb7e('0x3b')](_0x200f39[_0xfb7e('0x32')],_0x1e3ec1[_0xfb7e('0x33')]),_0x45d874);if(_0x200f39['query'][_0xfb7e('0x3c')]){_0x2453a5['where']=_[_0xfb7e('0x3d')](_0x2453a5['where'],{'$or':_[_0xfb7e('0x2c')](_0x45d874,function(_0x3e5ec3){if(_0x3e5ec3['type']!==_0xfb7e('0x3e')){var _0xd8c473={};_0xd8c473[_0x3e5ec3[_0xfb7e('0x29')]]={'$like':'%'+_0x200f39['query']['filter']+'%'};return _0xd8c473;}})});}_0x2453a5=_['merge']({},_0x2453a5,_0x200f39[_0xfb7e('0x3f')]);var _0x24392c={'where':_0x2453a5[_0xfb7e('0x40')]};return db[_0xfb7e('0x2d')]['count'](_0x24392c)[_0xfb7e('0x27')](function(_0x4ed626){_0x228527[_0xfb7e('0x41')]=_0x4ed626;if(_0x200f39[_0xfb7e('0x32')][_0xfb7e('0x42')]){_0x2453a5[_0xfb7e('0x43')]=[{'all':!![]}];}return db[_0xfb7e('0x2d')][_0xfb7e('0x44')](_0x2453a5);})[_0xfb7e('0x27')](function(_0x31013d){_0x228527[_0xfb7e('0x45')]=_0x31013d;return _0x228527;})['then'](respondWithFilteredResult(_0x3fbc34,_0x2453a5))[_0xfb7e('0x46')](handleError(_0x3fbc34,null));};exports[_0xfb7e('0x47')]=function(_0x45d3dc,_0x137982){var _0x7a7f62={'raw':!![],'where':{'id':_0x45d3dc['params']['id']}},_0x405d3d={};_0x405d3d['model']=_[_0xfb7e('0x48')](db[_0xfb7e('0x2d')][_0xfb7e('0x49')]);_0x405d3d[_0xfb7e('0x32')]=_[_0xfb7e('0x48')](_0x45d3dc['query']);_0x405d3d[_0xfb7e('0x33')]=_[_0xfb7e('0x34')](_0x405d3d[_0xfb7e('0x31')],_0x405d3d[_0xfb7e('0x32')]);_0x7a7f62[_0xfb7e('0x35')]=_[_0xfb7e('0x34')](_0x405d3d[_0xfb7e('0x31')],qs[_0xfb7e('0x36')](_0x45d3dc[_0xfb7e('0x32')][_0xfb7e('0x36')]));_0x7a7f62['attributes']=_0x7a7f62[_0xfb7e('0x35')][_0xfb7e('0x37')]?_0x7a7f62['attributes']:_0x405d3d[_0xfb7e('0x31')];if(_0x45d3dc[_0xfb7e('0x32')]['includeAll']){_0x7a7f62['include']=[{'all':!![]}];}_0x7a7f62=_[_0xfb7e('0x3d')]({},_0x7a7f62,_0x45d3dc[_0xfb7e('0x3f')]);return db[_0xfb7e('0x2d')][_0xfb7e('0x4a')](_0x7a7f62)[_0xfb7e('0x27')](handleEntityNotFound(_0x137982,null))[_0xfb7e('0x27')](respondWithResult(_0x137982,null))[_0xfb7e('0x46')](handleError(_0x137982,null));};exports[_0xfb7e('0x4b')]=function(_0x14edb9,_0x9c429c){return db[_0xfb7e('0x2d')][_0xfb7e('0x4b')](_0x14edb9[_0xfb7e('0x4c')],{})[_0xfb7e('0x27')](respondWithResult(_0x9c429c,0xc9))[_0xfb7e('0x46')](handleError(_0x9c429c,null));};exports[_0xfb7e('0x4d')]=function(_0x1a2b81,_0x20e033){if(_0x1a2b81['body']['id']){delete _0x1a2b81[_0xfb7e('0x4c')]['id'];}return db[_0xfb7e('0x2d')][_0xfb7e('0x4a')]({'where':{'id':_0x1a2b81[_0xfb7e('0x4e')]['id']}})[_0xfb7e('0x27')](handleEntityNotFound(_0x20e033,null))[_0xfb7e('0x27')](saveUpdates(_0x1a2b81[_0xfb7e('0x4c')],null))[_0xfb7e('0x27')](respondWithResult(_0x20e033,null))['catch'](handleError(_0x20e033,null));};exports[_0xfb7e('0x26')]=function(_0x16b7c6,_0x3908b3){return db[_0xfb7e('0x2d')]['find']({'where':{'id':_0x16b7c6[_0xfb7e('0x4e')]['id']}})[_0xfb7e('0x27')](handleEntityNotFound(_0x3908b3,null))[_0xfb7e('0x27')](removeEntity(_0x3908b3,null))['catch'](handleError(_0x3908b3,null));}; \ No newline at end of file +var _0x9049=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','VoiceQueuesLog','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0x9049,0x194));var _0x9904=function(_0x4357db,_0x5ecf79){_0x4357db=_0x4357db-0x0;var _0x77c7e=_0x9049[_0x4357db];return _0x77c7e;};'use strict';var emlformat=require(_0x9904('0x0'));var rimraf=require(_0x9904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9904('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9904('0x3'));var Mustache=require(_0x9904('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9904('0x5'));var csv=require(_0x9904('0x6'));var ejs=require(_0x9904('0x7'));var fs=require('fs');var fs_extra=require(_0x9904('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9904('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9904('0xa'));var Papa=require(_0x9904('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9904('0xc'));var as=require(_0x9904('0xd'));var hardwareService=require(_0x9904('0xe'));var logger=require(_0x9904('0xf'))(_0x9904('0x10'));var utils=require('../../config/utils');var config=require(_0x9904('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9904('0x12'))['db'];function respondWithStatusCode(_0x510c25,_0xedec91){_0xedec91=_0xedec91||0xcc;return function(_0x41d624){if(_0x41d624){return _0x510c25[_0x9904('0x13')](_0xedec91);}return _0x510c25[_0x9904('0x14')](_0xedec91)[_0x9904('0x15')]();};}function respondWithResult(_0xc1d55,_0x3e8eaa){_0x3e8eaa=_0x3e8eaa||0xc8;return function(_0x38dc82){if(_0x38dc82){return _0xc1d55[_0x9904('0x14')](_0x3e8eaa)[_0x9904('0x16')](_0x38dc82);}};}function respondWithFilteredResult(_0x27774e,_0x2c6de2){return function(_0x533fd6){if(_0x533fd6){var _0x2ac4d3=typeof _0x2c6de2['offset']===_0x9904('0x17')&&typeof _0x2c6de2[_0x9904('0x18')]==='undefined';var _0x3ed47e=_0x533fd6['count'];var _0x4f452e=_0x2ac4d3?0x0:_0x2c6de2[_0x9904('0x19')];var _0x20dd25=_0x2ac4d3?_0x533fd6[_0x9904('0x1a')]:_0x2c6de2[_0x9904('0x19')]+_0x2c6de2[_0x9904('0x18')];var _0x36fc6d;if(_0x20dd25>=_0x3ed47e){_0x20dd25=_0x3ed47e;_0x36fc6d=0xc8;}else{_0x36fc6d=0xce;}_0x27774e[_0x9904('0x14')](_0x36fc6d);return _0x27774e['set'](_0x9904('0x1b'),_0x4f452e+'-'+_0x20dd25+'/'+_0x3ed47e)['json'](_0x533fd6);}return null;};}function patchUpdates(_0x10b237){return function(_0x4b2832){try{jsonpatch[_0x9904('0x1c')](_0x4b2832,_0x10b237,!![]);}catch(_0x2d6d89){return BPromise[_0x9904('0x1d')](_0x2d6d89);}return _0x4b2832[_0x9904('0x1e')]();};}function saveUpdates(_0x5975e0,_0x12d609){return function(_0x9413f){if(_0x9413f){return _0x9413f[_0x9904('0x1f')](_0x5975e0)[_0x9904('0x20')](function(_0x4837f4){return _0x4837f4;});}return null;};}function removeEntity(_0x24f7df,_0x3f8327){return function(_0x2e8f33){if(_0x2e8f33){return _0x2e8f33[_0x9904('0x21')]()[_0x9904('0x20')](function(){_0x24f7df[_0x9904('0x14')](0xcc)[_0x9904('0x15')]();});}};}function handleEntityNotFound(_0x595839,_0x3398dd){return function(_0x106e9e){if(!_0x106e9e){_0x595839[_0x9904('0x13')](0x194);}return _0x106e9e;};}function handleError(_0x3439c5,_0x400321){_0x400321=_0x400321||0x1f4;return function(_0x36cc09){logger[_0x9904('0x22')](_0x36cc09[_0x9904('0x23')]);if(_0x36cc09[_0x9904('0x24')]){delete _0x36cc09[_0x9904('0x24')];}_0x3439c5[_0x9904('0x14')](_0x400321)['send'](_0x36cc09);};}exports[_0x9904('0x25')]=function(_0x4edf4c,_0x51bc56){var _0x16a7aa={},_0x3e77ed={},_0x58549f={'count':0x0,'rows':[]};var _0x2858a1=_['map'](db[_0x9904('0x26')]['rawAttributes'],function(_0xb861f3){return{'name':_0xb861f3[_0x9904('0x27')],'type':_0xb861f3[_0x9904('0x28')][_0x9904('0x29')]};});_0x3e77ed[_0x9904('0x2a')]=_[_0x9904('0x2b')](_0x2858a1,_0x9904('0x24'));_0x3e77ed[_0x9904('0x2c')]=_[_0x9904('0x2d')](_0x4edf4c[_0x9904('0x2c')]);_0x3e77ed[_0x9904('0x2e')]=_[_0x9904('0x2f')](_0x3e77ed['model'],_0x3e77ed[_0x9904('0x2c')]);_0x16a7aa[_0x9904('0x30')]=_[_0x9904('0x2f')](_0x3e77ed['model'],qs[_0x9904('0x31')](_0x4edf4c[_0x9904('0x2c')][_0x9904('0x31')]));_0x16a7aa[_0x9904('0x30')]=_0x16a7aa[_0x9904('0x30')]['length']?_0x16a7aa[_0x9904('0x30')]:_0x3e77ed['model'];if(!_0x4edf4c[_0x9904('0x2c')][_0x9904('0x32')]('nolimit')){_0x16a7aa[_0x9904('0x18')]=qs[_0x9904('0x18')](_0x4edf4c['query'][_0x9904('0x18')]);_0x16a7aa[_0x9904('0x19')]=qs['offset'](_0x4edf4c[_0x9904('0x2c')][_0x9904('0x19')]);}_0x16a7aa[_0x9904('0x33')]=qs[_0x9904('0x34')](_0x4edf4c[_0x9904('0x2c')]['sort']);_0x16a7aa['where']=qs[_0x9904('0x2e')](_[_0x9904('0x35')](_0x4edf4c[_0x9904('0x2c')],_0x3e77ed[_0x9904('0x2e')]),_0x2858a1);if(_0x4edf4c['query'][_0x9904('0x36')]){_0x16a7aa[_0x9904('0x37')]=_['merge'](_0x16a7aa[_0x9904('0x37')],{'$or':_[_0x9904('0x2b')](_0x2858a1,function(_0x34fc20){if(_0x34fc20[_0x9904('0x28')]!==_0x9904('0x38')){var _0x174d30={};_0x174d30[_0x34fc20['name']]={'$like':'%'+_0x4edf4c[_0x9904('0x2c')][_0x9904('0x36')]+'%'};return _0x174d30;}})});}_0x16a7aa=_[_0x9904('0x39')]({},_0x16a7aa,_0x4edf4c[_0x9904('0x3a')]);var _0x47ab10={'where':_0x16a7aa[_0x9904('0x37')]};return db['VoiceQueuesLog'][_0x9904('0x1a')](_0x47ab10)[_0x9904('0x20')](function(_0x191146){_0x58549f[_0x9904('0x1a')]=_0x191146;if(_0x4edf4c['query'][_0x9904('0x3b')]){_0x16a7aa[_0x9904('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9904('0x3d')](_0x16a7aa);})[_0x9904('0x20')](function(_0x3ebb48){_0x58549f[_0x9904('0x3e')]=_0x3ebb48;return _0x58549f;})[_0x9904('0x20')](respondWithFilteredResult(_0x51bc56,_0x16a7aa))[_0x9904('0x3f')](handleError(_0x51bc56,null));};exports['show']=function(_0x26429e,_0x4d6ba4){var _0x3070de={'raw':!![],'where':{'id':_0x26429e[_0x9904('0x40')]['id']}},_0x30bd89={};_0x30bd89[_0x9904('0x2a')]=_[_0x9904('0x2d')](db[_0x9904('0x26')][_0x9904('0x41')]);_0x30bd89[_0x9904('0x2c')]=_[_0x9904('0x2d')](_0x26429e[_0x9904('0x2c')]);_0x30bd89[_0x9904('0x2e')]=_['intersection'](_0x30bd89['model'],_0x30bd89[_0x9904('0x2c')]);_0x3070de['attributes']=_[_0x9904('0x2f')](_0x30bd89[_0x9904('0x2a')],qs[_0x9904('0x31')](_0x26429e[_0x9904('0x2c')][_0x9904('0x31')]));_0x3070de[_0x9904('0x30')]=_0x3070de[_0x9904('0x30')][_0x9904('0x42')]?_0x3070de[_0x9904('0x30')]:_0x30bd89[_0x9904('0x2a')];if(_0x26429e[_0x9904('0x2c')][_0x9904('0x3b')]){_0x3070de[_0x9904('0x3c')]=[{'all':!![]}];}_0x3070de=_['merge']({},_0x3070de,_0x26429e[_0x9904('0x3a')]);return db[_0x9904('0x26')][_0x9904('0x43')](_0x3070de)[_0x9904('0x20')](handleEntityNotFound(_0x4d6ba4,null))[_0x9904('0x20')](respondWithResult(_0x4d6ba4,null))['catch'](handleError(_0x4d6ba4,null));};exports[_0x9904('0x44')]=function(_0x4ced03,_0x230bb4){return db[_0x9904('0x26')][_0x9904('0x44')](_0x4ced03[_0x9904('0x45')],{})[_0x9904('0x20')](respondWithResult(_0x230bb4,0xc9))[_0x9904('0x3f')](handleError(_0x230bb4,null));};exports[_0x9904('0x1f')]=function(_0x59f085,_0x1d5079){if(_0x59f085[_0x9904('0x45')]['id']){delete _0x59f085[_0x9904('0x45')]['id'];}return db[_0x9904('0x26')]['find']({'where':{'id':_0x59f085[_0x9904('0x40')]['id']}})[_0x9904('0x20')](handleEntityNotFound(_0x1d5079,null))[_0x9904('0x20')](saveUpdates(_0x59f085['body'],null))[_0x9904('0x20')](respondWithResult(_0x1d5079,null))[_0x9904('0x3f')](handleError(_0x1d5079,null));};exports[_0x9904('0x21')]=function(_0x35fc45,_0x17ae9b){return db[_0x9904('0x26')][_0x9904('0x43')]({'where':{'id':_0x35fc45[_0x9904('0x40')]['id']}})[_0x9904('0x20')](handleEntityNotFound(_0x17ae9b,null))[_0x9904('0x20')](removeEntity(_0x17ae9b,null))[_0x9904('0x3f')](handleError(_0x17ae9b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 127aa83..4ec1181 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 _0xa181=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','moment'];(function(_0x43df4d,_0x1ee462){var _0x54971c=function(_0x43c00c){while(--_0x43c00c){_0x43df4d['push'](_0x43df4d['shift']());}};_0x54971c(++_0x1ee462);}(_0xa181,0x10a));var _0x1a18=function(_0x32aa18,_0x432c22){_0x32aa18=_0x32aa18-0x0;var _0x240069=_0xa181[_0x32aa18];return _0x240069;};'use strict';var _=require(_0x1a18('0x0'));var util=require(_0x1a18('0x1'));var logger=require(_0x1a18('0x2'))('api');var moment=require(_0x1a18('0x3'));var BPromise=require(_0x1a18('0x4'));var rp=require(_0x1a18('0x5'));var fs=require('fs');var path=require(_0x1a18('0x6'));var rimraf=require(_0x1a18('0x7'));var config=require(_0x1a18('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x1a18('0x9')]=function(_0x501ea2,_0x246a4e){return _0x501ea2[_0x1a18('0xa')](_0x1a18('0xb'),attributes,{'tableName':_0x1a18('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x1a18('0xd'),_0x1a18('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc185=['rimraf','../../config/environment','define','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x32c364,_0xc70257){var _0x163e0c=function(_0x4a59be){while(--_0x4a59be){_0x32c364['push'](_0x32c364['shift']());}};_0x163e0c(++_0xc70257);}(_0xc185,0x96));var _0x5c18=function(_0x2d903a,_0x2d0dd2){_0x2d903a=_0x2d903a-0x0;var _0x5b2a8a=_0xc185[_0x2d903a];return _0x5b2a8a;};'use strict';var _=require('lodash');var util=require(_0x5c18('0x0'));var logger=require(_0x5c18('0x1'))('api');var moment=require(_0x5c18('0x2'));var BPromise=require(_0x5c18('0x3'));var rp=require(_0x5c18('0x4'));var fs=require('fs');var path=require(_0x5c18('0x5'));var rimraf=require(_0x5c18('0x6'));var config=require(_0x5c18('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4c5e6b,_0xc354ac){return _0x4c5e6b[_0x5c18('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x5c18('0x9'),'paranoid':![],'indexes':[{'name':_0x5c18('0xa'),'fields':[_0x5c18('0xb'),_0x5c18('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5635c85..3afee9b 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 _0x9acc=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x2f9e52,_0x1b5fc5){var _0x572a8e=function(_0x2fd06b){while(--_0x2fd06b){_0x2f9e52['push'](_0x2f9e52['shift']());}};_0x572a8e(++_0x1b5fc5);}(_0x9acc,0x175));var _0xc9ac=function(_0x134527,_0x4fb537){_0x134527=_0x134527-0x0;var _0x318699=_0x9acc[_0x134527];return _0x318699;};'use strict';var _=require(_0xc9ac('0x0'));var util=require(_0xc9ac('0x1'));var moment=require(_0xc9ac('0x2'));var BPromise=require(_0xc9ac('0x3'));var rs=require(_0xc9ac('0x4'));var fs=require('fs');var Redis=require(_0xc9ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9ac('0x6'));var logger=require('../../config/logger')(_0xc9ac('0x7'));var config=require('../../config/environment');var jayson=require(_0xc9ac('0x8'));var client=jayson[_0xc9ac('0x9')][_0xc9ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8307,_0x212dcc,_0x391c03){return new BPromise(function(_0x387423,_0x1d552a){return client[_0xc9ac('0xb')](_0x1c8307,_0x391c03)[_0xc9ac('0xc')](function(_0x38fce0){logger[_0xc9ac('0xd')](_0xc9ac('0xe'),_0x212dcc,_0xc9ac('0xf'));logger[_0xc9ac('0x10')](_0xc9ac('0x11'),_0x212dcc,_0xc9ac('0xf'),JSON[_0xc9ac('0x12')](_0x38fce0));if(_0x38fce0[_0xc9ac('0x13')]){if(_0x38fce0[_0xc9ac('0x13')]['code']===0x1f4){logger[_0xc9ac('0x13')](_0xc9ac('0xe'),_0x212dcc,_0x38fce0['error'][_0xc9ac('0x14')]);return _0x1d552a(_0x38fce0[_0xc9ac('0x13')][_0xc9ac('0x14')]);}logger['error'](_0xc9ac('0xe'),_0x212dcc,_0x38fce0[_0xc9ac('0x13')]['message']);return _0x387423(_0x38fce0[_0xc9ac('0x13')][_0xc9ac('0x14')]);}else{logger['info'](_0xc9ac('0xe'),_0x212dcc,_0xc9ac('0xf'));_0x387423(_0x38fce0[_0xc9ac('0x15')][_0xc9ac('0x14')]);}})[_0xc9ac('0x16')](function(_0x3727b5){logger[_0xc9ac('0x13')](_0xc9ac('0xe'),_0x212dcc,_0x3727b5);_0x1d552a(_0x3727b5);});});} \ No newline at end of file +var _0xbc48=['stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x3e92aa,_0x113124){var _0x249178=function(_0x2fdefa){while(--_0x2fdefa){_0x3e92aa['push'](_0x3e92aa['shift']());}};_0x249178(++_0x113124);}(_0xbc48,0x16b));var _0x8bc4=function(_0x47020f,_0x36f16b){_0x47020f=_0x47020f-0x0;var _0x2c6749=_0xbc48[_0x47020f];return _0x2c6749;};'use strict';var _=require('lodash');var util=require(_0x8bc4('0x0'));var moment=require(_0x8bc4('0x1'));var BPromise=require(_0x8bc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bc4('0x4'));var logger=require(_0x8bc4('0x5'))(_0x8bc4('0x6'));var config=require(_0x8bc4('0x7'));var jayson=require(_0x8bc4('0x8'));var client=jayson[_0x8bc4('0x9')][_0x8bc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe686,_0x32e271,_0x2f2372){return new BPromise(function(_0x10c6c2,_0x2dcbfa){return client['request'](_0x2fe686,_0x2f2372)[_0x8bc4('0xb')](function(_0x3ef891){logger[_0x8bc4('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32e271,_0x8bc4('0xd'));logger[_0x8bc4('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x32e271,_0x8bc4('0xd'),JSON[_0x8bc4('0xf')](_0x3ef891));if(_0x3ef891[_0x8bc4('0x10')]){if(_0x3ef891[_0x8bc4('0x10')]['code']===0x1f4){logger[_0x8bc4('0x10')](_0x8bc4('0x11'),_0x32e271,_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);return _0x2dcbfa(_0x3ef891[_0x8bc4('0x10')]['message']);}logger[_0x8bc4('0x10')](_0x8bc4('0x11'),_0x32e271,_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);return _0x10c6c2(_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);}else{logger[_0x8bc4('0xc')](_0x8bc4('0x11'),_0x32e271,_0x8bc4('0xd'));_0x10c6c2(_0x3ef891[_0x8bc4('0x13')][_0x8bc4('0x12')]);}})[_0x8bc4('0x14')](function(_0xced882){logger[_0x8bc4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32e271,_0xced882);_0x2dcbfa(_0xced882);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a7fb500..75d9083 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 _0x0371=['isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0x1d4d4c,_0x39b0f2){var _0x5074bc=function(_0x393ba8){while(--_0x393ba8){_0x1d4d4c['push'](_0x1d4d4c['shift']());}};_0x5074bc(++_0x39b0f2);}(_0x0371,0xa6));var _0x1037=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x0371[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0x1037('0x0'));var util=require(_0x1037('0x1'));var path=require(_0x1037('0x2'));var timeout=require(_0x1037('0x3'));var express=require(_0x1037('0x4'));var router=express[_0x1037('0x5')]();var fs_extra=require(_0x1037('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1037('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x1037('0x8')]('/',auth[_0x1037('0x9')](),controller[_0x1037('0xa')]);router[_0x1037('0x8')](_0x1037('0xb'),auth[_0x1037('0x9')](),controller[_0x1037('0xc')]);router[_0x1037('0x8')](_0x1037('0xd'),auth[_0x1037('0x9')](),controller[_0x1037('0xe')]);router['get'](_0x1037('0xf'),auth[_0x1037('0x9')](),controller[_0x1037('0x10')]);router[_0x1037('0x8')](_0x1037('0x11'),controller['downloads']);router[_0x1037('0x8')](_0x1037('0x12'),auth[_0x1037('0x9')](),controller[_0x1037('0x13')]);router[_0x1037('0x14')]('/',auth[_0x1037('0x9')](),controller[_0x1037('0x15')]);router['post'](_0x1037('0x12'),auth[_0x1037('0x9')](),controller[_0x1037('0x16')]);router['put'](_0x1037('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1037('0xd'),auth[_0x1037('0x9')](),controller[_0x1037('0x17')]);module[_0x1037('0x18')]=router; \ No newline at end of file +var _0xdc3e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x23eaf0,_0x347b70){var _0x353da4=function(_0x22a504){while(--_0x22a504){_0x23eaf0['push'](_0x23eaf0['shift']());}};_0x353da4(++_0x347b70);}(_0xdc3e,0x169));var _0xedc3=function(_0x3e18c8,_0x124343){_0x3e18c8=_0x3e18c8-0x0;var _0x14b686=_0xdc3e[_0x3e18c8];return _0x14b686;};'use strict';var multer=require(_0xedc3('0x0'));var util=require(_0xedc3('0x1'));var path=require('path');var timeout=require(_0xedc3('0x2'));var express=require(_0xedc3('0x3'));var router=express[_0xedc3('0x4')]();var fs_extra=require(_0xedc3('0x5'));var auth=require(_0xedc3('0x6'));var interaction=require(_0xedc3('0x7'));var config=require(_0xedc3('0x8'));var controller=require(_0xedc3('0x9'));router[_0xedc3('0xa')]('/',auth[_0xedc3('0xb')](),controller[_0xedc3('0xc')]);router[_0xedc3('0xa')](_0xedc3('0xd'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xe')]);router[_0xedc3('0xa')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller['show']);router['get'](_0xedc3('0x10'),auth['isAuthenticated'](),controller[_0xedc3('0x11')]);router[_0xedc3('0xa')](_0xedc3('0x12'),controller[_0xedc3('0x13')]);router[_0xedc3('0xa')](_0xedc3('0x14'),auth[_0xedc3('0xb')](),controller[_0xedc3('0x15')]);router[_0xedc3('0x16')]('/',auth['isAuthenticated'](),controller[_0xedc3('0x17')]);router[_0xedc3('0x16')](_0xedc3('0x14'),auth[_0xedc3('0xb')](),controller['runTranscribe']);router[_0xedc3('0x18')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller[_0xedc3('0x19')]);router[_0xedc3('0x1a')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller['destroy']);module[_0xedc3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a4add9e..24d06fb 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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 4c499a5..a96d394 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 _0x11a7=['squel','crypto','jsforce','desk.js','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','VoiceRecording','type','model','format','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','download','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','secrets','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','listBuckets','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','sentiment','sentimentRegion','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','.txt','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x661879,_0x17f818){var _0x38188d=function(_0x133210){while(--_0x133210){_0x661879['push'](_0x661879['shift']());}};_0x38188d(++_0x17f818);}(_0x11a7,0x116));var _0x711a=function(_0x1f52ea,_0x1dd436){_0x1f52ea=_0x1f52ea-0x0;var _0x2d4b16=_0x11a7[_0x1f52ea];return _0x2d4b16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x711a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x711a('0x1'));var rp=require(_0x711a('0x2'));var moment=require(_0x711a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x711a('0x4'));var path=require('path');var sox=require(_0x711a('0x5'));var csv=require(_0x711a('0x6'));var ejs=require(_0x711a('0x7'));var fs=require('fs');var fs_extra=require(_0x711a('0x8'));var _=require(_0x711a('0x9'));var squel=require(_0x711a('0xa'));var crypto=require(_0x711a('0xb'));var jsforce=require(_0x711a('0xc'));var deskjs=require(_0x711a('0xd'));var toCsv=require(_0x711a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0x711a('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x711a('0xf'));var authService=require(_0x711a('0x10'));var qs=require(_0x711a('0x11'));var as=require(_0x711a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x711a('0x13'))(_0x711a('0x14'));var utils=require(_0x711a('0x15'));var config=require(_0x711a('0x16'));var licenseUtil=require(_0x711a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7cf1,_0x16b404){_0x16b404=_0x16b404||0xcc;return function(_0x2d9c31){if(_0x2d9c31){return _0x4c7cf1[_0x711a('0x18')](_0x16b404);}return _0x4c7cf1[_0x711a('0x19')](_0x16b404)[_0x711a('0x1a')]();};}function respondWithResult(_0x4848a5,_0x3ef980){_0x3ef980=_0x3ef980||0xc8;return function(_0x1a6f57){if(_0x1a6f57){return _0x4848a5[_0x711a('0x19')](_0x3ef980)[_0x711a('0x1b')](_0x1a6f57);}};}function respondWithFilteredResult(_0x3af746,_0x388897){return function(_0x3f2228){if(_0x3f2228){var _0x278ac7=typeof _0x388897[_0x711a('0x1c')]===_0x711a('0x1d')&&typeof _0x388897['limit']===_0x711a('0x1d');var _0x241e8a=_0x3f2228[_0x711a('0x1e')];var _0x61f9cb=_0x278ac7?0x0:_0x388897[_0x711a('0x1c')];var _0x12e700=_0x278ac7?_0x3f2228[_0x711a('0x1e')]:_0x388897['offset']+_0x388897[_0x711a('0x1f')];var _0xbe38d5;if(_0x12e700>=_0x241e8a){_0x12e700=_0x241e8a;_0xbe38d5=0xc8;}else{_0xbe38d5=0xce;}_0x3af746[_0x711a('0x19')](_0xbe38d5);return _0x3af746[_0x711a('0x20')](_0x711a('0x21'),_0x61f9cb+'-'+_0x12e700+'/'+_0x241e8a)[_0x711a('0x1b')](_0x3f2228);}return null;};}function patchUpdates(_0x3c03ec){return function(_0x26f9ef){try{jsonpatch['apply'](_0x26f9ef,_0x3c03ec,!![]);}catch(_0x177ad0){return BPromise['reject'](_0x177ad0);}return _0x26f9ef[_0x711a('0x22')]();};}function saveUpdates(_0x5d66a7,_0x1f8805){return function(_0x2d1fa5){if(_0x2d1fa5){return _0x2d1fa5[_0x711a('0x23')](_0x5d66a7)[_0x711a('0x24')](function(_0x173383){return _0x173383;});}return null;};}function removeEntity(_0x406104,_0x34d1f5){return function(_0x494cae){if(_0x494cae){return _0x494cae[_0x711a('0x25')]()[_0x711a('0x24')](function(){_0x406104['status'](0xcc)[_0x711a('0x1a')]();});}};}function handleEntityNotFound(_0x4ece7a,_0x127175){return function(_0x268718){if(!_0x268718){_0x4ece7a[_0x711a('0x18')](0x194);}return _0x268718;};}function handleError(_0x3d2249,_0x4ee0ce){_0x4ee0ce=_0x4ee0ce||0x1f4;return function(_0x315f0c){logger['error'](_0x315f0c[_0x711a('0x26')]);if(_0x315f0c[_0x711a('0x27')]){delete _0x315f0c[_0x711a('0x27')];}_0x3d2249[_0x711a('0x19')](_0x4ee0ce)[_0x711a('0x28')](_0x315f0c);};}exports[_0x711a('0x29')]=function(_0x44f0f3,_0x47bbe8){var _0x148297={},_0x49586c={},_0x2f137a={'count':0x0,'rows':[]};var _0x54cca1=_[_0x711a('0x2a')](db[_0x711a('0x2b')]['rawAttributes'],function(_0x3e867b){return{'name':_0x3e867b['fieldName'],'type':_0x3e867b[_0x711a('0x2c')]['key']};});_0x49586c[_0x711a('0x2d')]=_['differenceBy'](_[_0x711a('0x2a')](_0x54cca1,_0x711a('0x27')),[_0x711a('0x2e')]);_0x49586c[_0x711a('0x2f')]=_[_0x711a('0x30')](_0x44f0f3['query']);_0x49586c[_0x711a('0x31')]=_[_0x711a('0x32')](_0x49586c[_0x711a('0x2d')],_0x49586c[_0x711a('0x2f')]);_0x148297[_0x711a('0x33')]=_['intersection'](_0x49586c['model'],qs[_0x711a('0x34')](_0x44f0f3[_0x711a('0x2f')][_0x711a('0x34')]));_0x148297[_0x711a('0x33')]=_0x148297[_0x711a('0x33')][_0x711a('0x35')]?_0x148297['attributes']:_0x49586c[_0x711a('0x2d')];if(!_0x44f0f3[_0x711a('0x2f')]['hasOwnProperty'](_0x711a('0x36'))){_0x148297[_0x711a('0x1f')]=qs['limit'](_0x44f0f3['query'][_0x711a('0x1f')]);_0x148297[_0x711a('0x1c')]=qs[_0x711a('0x1c')](_0x44f0f3[_0x711a('0x2f')][_0x711a('0x1c')]);}_0x148297['order']=qs[_0x711a('0x37')](_0x44f0f3['query'][_0x711a('0x37')]);_0x148297[_0x711a('0x38')]=qs[_0x711a('0x31')](_[_0x711a('0x39')](_0x44f0f3[_0x711a('0x2f')],_0x49586c['filters']),_0x54cca1);if(_0x44f0f3[_0x711a('0x2f')][_0x711a('0x3a')]){_0x148297[_0x711a('0x38')]=_[_0x711a('0x3b')](_0x148297[_0x711a('0x38')],{'$or':_[_0x711a('0x2a')](_0x54cca1,function(_0x21c020){if(_0x21c020[_0x711a('0x2c')]!=='VIRTUAL'){var _0x326df9={};_0x326df9[_0x21c020['name']]={'$like':'%'+_0x44f0f3[_0x711a('0x2f')][_0x711a('0x3a')]+'%'};return _0x326df9;}})});}_0x148297=_[_0x711a('0x3b')]({},_0x148297,_0x44f0f3[_0x711a('0x3c')]);var _0x4132bb={'where':_0x148297[_0x711a('0x38')]};return db[_0x711a('0x2b')][_0x711a('0x1e')](_0x4132bb)[_0x711a('0x24')](function(_0x60c2d1){_0x2f137a[_0x711a('0x1e')]=_0x60c2d1;if(_0x44f0f3[_0x711a('0x2f')][_0x711a('0x3d')]){_0x148297[_0x711a('0x3e')]=[{'all':!![]}];}return db[_0x711a('0x2b')][_0x711a('0x3f')](_0x148297);})[_0x711a('0x24')](function(_0x1d31f8){_0x2f137a[_0x711a('0x40')]=_0x1d31f8;return _0x2f137a;})[_0x711a('0x24')](respondWithFilteredResult(_0x47bbe8,_0x148297))[_0x711a('0x41')](handleError(_0x47bbe8,null));};exports[_0x711a('0x42')]=function(_0x2bd7fd,_0x425f24){var _0x5de24d={'raw':![],'where':{'id':_0x2bd7fd[_0x711a('0x43')]['id']}},_0x2d1a23={};_0x2d1a23[_0x711a('0x2d')]=_['keys'](db[_0x711a('0x2b')]['rawAttributes']);_0x2d1a23[_0x711a('0x2f')]=_[_0x711a('0x30')](_0x2bd7fd[_0x711a('0x2f')]);_0x2d1a23[_0x711a('0x31')]=_[_0x711a('0x32')](_0x2d1a23[_0x711a('0x2d')],_0x2d1a23[_0x711a('0x2f')]);_0x5de24d[_0x711a('0x33')]=_[_0x711a('0x32')](_0x2d1a23[_0x711a('0x2d')],qs[_0x711a('0x34')](_0x2bd7fd[_0x711a('0x2f')][_0x711a('0x34')]));_0x5de24d[_0x711a('0x33')]=_0x5de24d[_0x711a('0x33')][_0x711a('0x35')]?_0x5de24d[_0x711a('0x33')]:_0x2d1a23[_0x711a('0x2d')];if(_0x2bd7fd[_0x711a('0x2f')][_0x711a('0x3d')]){_0x5de24d[_0x711a('0x3e')]=[{'all':!![]}];}_0x5de24d=_[_0x711a('0x3b')]({},_0x5de24d,_0x2bd7fd['options']);return db[_0x711a('0x2b')][_0x711a('0x44')](_0x5de24d)[_0x711a('0x24')](handleEntityNotFound(_0x425f24,null))[_0x711a('0x24')](respondWithResult(_0x425f24,null))['catch'](handleError(_0x425f24,null));};exports['create']=function(_0x341622,_0x25f60a){return db[_0x711a('0x2b')]['create'](_0x341622[_0x711a('0x45')],{})[_0x711a('0x24')](respondWithResult(_0x25f60a,0xc9))[_0x711a('0x41')](handleError(_0x25f60a,null));};exports[_0x711a('0x23')]=function(_0x1fde9c,_0x2d1b86){if(_0x1fde9c['body']['id']){delete _0x1fde9c[_0x711a('0x45')]['id'];}return db[_0x711a('0x2b')]['find']({'where':{'id':_0x1fde9c[_0x711a('0x43')]['id']}})[_0x711a('0x24')](handleEntityNotFound(_0x2d1b86,null))[_0x711a('0x24')](saveUpdates(_0x1fde9c[_0x711a('0x45')],null))[_0x711a('0x24')](respondWithResult(_0x2d1b86,null))[_0x711a('0x41')](handleError(_0x2d1b86,null));};exports[_0x711a('0x46')]=function(_0x4fec94,_0xce0104){return db[_0x711a('0x2b')][_0x711a('0x46')]()[_0x711a('0x24')](respondWithResult(_0xce0104,null))['catch'](handleError(_0xce0104,null));};exports[_0x711a('0x47')]=function(_0x75ddf5,_0x49057c,_0x2e2abf){var _0x445b19=require('../../components/encryptor');var _0x1e1ce1=![];var _0x1bf867={};if(_0x75ddf5[_0x711a('0x2f')]['type']&&_0x75ddf5[_0x711a('0x2f')][_0x711a('0x2c')]===_0x711a('0x48')){_0x1bf867[_0x711a('0x48')]=_0x75ddf5['params']['id'];}else{_0x1bf867['id']=_0x75ddf5[_0x711a('0x43')]['id'];}return db['VoiceRecording']['find']({'where':_0x1bf867,'attributes':['id',_0x711a('0x49')],'raw':!![]})[_0x711a('0x24')](handleEntityNotFound(_0x49057c,null))[_0x711a('0x24')](function(_0x4b8e29){if(_0x4b8e29){var _0xa5196d=_0x4b8e29['value'];var _0x2a70f1=util[_0x711a('0x2e')](_0x711a('0x4a'),_0xa5196d);if(fs['existsSync'](_0x2a70f1)){_0x1e1ce1=!![];return _0x445b19[_0x711a('0x4b')](_0x2a70f1,_0xa5196d,config['secrets'][_0x711a('0x4c')])['then'](function(){return _0x4b8e29;});}return _0x4b8e29;}})[_0x711a('0x24')](function(_0x3477e2){if(_0x3477e2){var _0x5d315c=_0x3477e2[_0x711a('0x49')];if(!fs[_0x711a('0x4d')](_0x5d315c)){throw new db[(_0x711a('0x4e'))][(_0x711a('0x4f'))](_0x711a('0x50'));}if(_0x3477e2[_0x711a('0x51')]){return _0x49057c[_0x711a('0x47')](_0x5d315c,_0x3477e2[_0x711a('0x51')]+path[_0x711a('0x52')](_0x5d315c),function(){if(_0x1e1ce1){fs[_0x711a('0x53')](_0x5d315c);}});}else{return _0x49057c[_0x711a('0x47')](_0x5d315c,function(_0x2e8fbc){if(_0x1e1ce1){fs[_0x711a('0x53')](_0x5d315c);}});}}})[_0x711a('0x41')](function(_0x18bee9){if(_0x18bee9['message']===_0x711a('0x50')){_0x49057c[_0x711a('0x19')](0x194)['send'](_0x711a('0x54'));}else{return handleError(_0x49057c,null);}});};exports[_0x711a('0x55')]=function(_0xde1f1,_0x2ccc88,_0x10e0ed){var _0x2794d6=require(_0x711a('0x56'));var _0x30261f=![];var _0x144ea6={'$and':[db[_0x711a('0x57')][_0x711a('0x38')](db[_0x711a('0x57')]['fn'](_0x711a('0x58'),db[_0x711a('0x57')][_0x711a('0x59')](_0x711a('0x48'))),_0xde1f1['query']['token'])]};if(_0xde1f1[_0x711a('0x2f')][_0x711a('0x2c')]&&_0xde1f1[_0x711a('0x2f')]['type']==='uniqueid'){_0x144ea6[_0x711a('0x5a')]['push']({'uniqueid':_0xde1f1[_0x711a('0x43')]['id']});}else{_0x144ea6[_0x711a('0x5a')][_0x711a('0x5b')]({'id':_0xde1f1[_0x711a('0x43')]['id']});}return db[_0x711a('0x2b')][_0x711a('0x44')]({'where':_0x144ea6,'attributes':['id',_0x711a('0x49')],'raw':!![]})[_0x711a('0x24')](handleEntityNotFound(_0x2ccc88,null))[_0x711a('0x24')](function(_0x22d3b7){if(_0x22d3b7){var _0x19ae63=util[_0x711a('0x2e')](_0x711a('0x4a'),_0x22d3b7[_0x711a('0x49')]);if(fs[_0x711a('0x4d')](_0x19ae63)){_0x30261f=!![];return _0x2794d6[_0x711a('0x4b')](_0x19ae63,_0x22d3b7[_0x711a('0x49')],config[_0x711a('0x5c')][_0x711a('0x4c')])[_0x711a('0x24')](function(){return _0x22d3b7;});}return _0x22d3b7;}})[_0x711a('0x24')](function(_0x57c939){if(_0x57c939){if(!fs['existsSync'](_0x57c939[_0x711a('0x49')])){throw new db[(_0x711a('0x4e'))][(_0x711a('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x57c939[_0x711a('0x51')]){return _0x2ccc88[_0x711a('0x47')](_0x57c939[_0x711a('0x49')],_0x57c939['filename']+path[_0x711a('0x52')](_0x57c939['value']),function(){if(_0x30261f){fs[_0x711a('0x53')](_0x57c939[_0x711a('0x49')]);}});}else{return _0x2ccc88['download'](_0x57c939['value'],function(_0x956d15){if(_0x30261f){fs['unlink'](_0x57c939['value']);}});}}})[_0x711a('0x41')](handleError(_0x2ccc88,null));};exports[_0x711a('0x25')]=function(_0xcae19e,_0x5c6982){return db['VoiceRecording'][_0x711a('0x44')]({'where':{'id':_0xcae19e[_0x711a('0x43')]['id']}})[_0x711a('0x24')](function(_0x21b22a){if(_['isNil'](_0x21b22a)){throw new ReferenceError(_0x711a('0x5d'));}return _0x21b22a;})[_0x711a('0x24')](function(_0x2fc08a){var _0x4b74e7=_0x2fc08a[_0x711a('0x49')];logger[_0x711a('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x4b74e7);if(!_['isNil'](_0x2fc08a[_0x711a('0x49')])&&fs[_0x711a('0x4d')](_0x4b74e7)){logger['info'](_0x711a('0x5f')+_0x4b74e7+_0x711a('0x60'));fs[_0x711a('0x61')](_0x4b74e7);}_0x4b74e7=_0x4b74e7+'.cypher';if(!_[_0x711a('0x62')](_0x2fc08a['value'])&&fs[_0x711a('0x4d')](_0x4b74e7)){logger['info'](_0x711a('0x5f')+_0x4b74e7+_0x711a('0x60'));fs['unlinkSync'](_0x4b74e7);}return _0x2fc08a;})[_0x711a('0x24')](function(_0x3d23ed){if(!_0x3d23ed)throw new InternalError();return _0x3d23ed[_0x711a('0x25')]();})[_0x711a('0x24')](function(){_0x5c6982[_0x711a('0x19')](0xcc)['end']();})[_0x711a('0x41')](handleError(_0x5c6982,null));};function getBucketslist(_0x43d3f7,_0x1b4dc3,_0x28f0da){return new Promise(function(_0x3811c3,_0x557d02){var _0x4e5b74=new AWS['S3']({'accessKeyId':_0x1b4dc3,'secretAccessKey':_0x43d3f7,'region':_0x28f0da});_0x4e5b74[_0x711a('0x63')]({},function(_0x46ff03,_0x11e0f5){if(_0x46ff03){return _0x557d02(_0x46ff03);}else{return _0x3811c3(_0x11e0f5);}});});}function createBucket(_0x440f8a,_0x71c1f5,_0x18f9b6,_0xcfcd8b){return new Promise(function(_0x5cbc5f,_0x594ad8){var _0x32bf85=new AWS['S3']({'accessKeyId':_0x71c1f5,'secretAccessKey':_0x440f8a,'region':_0x18f9b6});_0x32bf85['createBucket']({'Bucket':_0xcfcd8b},function(_0x3fde42,_0x2a693a){if(_0x3fde42){return _0x594ad8(_0x3fde42);}else{return _0x5cbc5f(_0x2a693a);}});});}function uploadFile(_0x19cbff,_0x3c8545,_0xb936ce,_0x25362e,_0x175f31,_0x4485c6){return new Promise(function(_0xf715b9,_0x5dd3c0){var _0x4410f4=new AWS['S3']({'accessKeyId':_0x3c8545,'secretAccessKey':_0x19cbff,'region':_0xb936ce});_0x4410f4['upload']({'Bucket':_0x25362e,'Key':_0x175f31,'Body':_0x4485c6},function(_0x529146,_0x7c148f){if(_0x529146){return _0x5dd3c0(_0x529146);}else{return _0xf715b9(_0x7c148f);}});});}function startTranscribe(_0x300e2c,_0x443c46,_0x4048ea,_0x29403a,_0x9a183,_0x5b064c){return new Promise(function(_0x476748,_0x2abf98){var _0xa5087d=new AWS[(_0x711a('0x64'))]({'accessKeyId':_0x443c46,'secretAccessKey':_0x300e2c,'region':_0x4048ea});_0xa5087d[_0x711a('0x65')]({'TranscriptionJobName':_0x29403a,'LanguageCode':_0x9a183,'Media':{'MediaFileUri':_0x5b064c}},function(_0x5a4826,_0x5d2e79){if(_0x5a4826){return _0x2abf98(_0x5a4826);}else{return _0x476748(_0x5d2e79);}});});}function transcribe(_0x46a742,_0x289d18,_0x6c292a,_0x549c8f,_0x1a0965,_0x47bc21,_0x128154){return new Promise(function(_0x3d12de,_0x1c560f){var _0x2afd83={};logger[_0x711a('0x5e')](util[_0x711a('0x2e')](_0x711a('0x66'),_0x46a742,_0x1a0965));return uploadFile(_0x289d18,_0x6c292a,_0x549c8f,_0x1a0965,path[_0x711a('0x67')](_0x47bc21),fs[_0x711a('0x68')](_0x47bc21))['then'](function(_0x3c13f5){logger[_0x711a('0x5e')](util[_0x711a('0x2e')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x46a742,_0x1a0965,_0x3c13f5[_0x711a('0x69')]));_0x2afd83[_0x711a('0x6a')]=_0x3c13f5[_0x711a('0x6b')];_0x2afd83[_0x711a('0x6c')]=_0x3c13f5[_0x711a('0x69')];logger[_0x711a('0x5e')](util[_0x711a('0x2e')](_0x711a('0x6d'),_0x46a742));return startTranscribe(_0x289d18,_0x6c292a,_0x549c8f,uuidv4(),_0x128154,_0x3c13f5[_0x711a('0x69')]);})[_0x711a('0x24')](function(_0x4552a5){logger[_0x711a('0x5e')](util['format'](_0x711a('0x6e'),_0x46a742,_0x4552a5[_0x711a('0x6f')][_0x711a('0x70')]));_0x2afd83[_0x711a('0x71')]=_0x4552a5[_0x711a('0x6f')]['TranscriptionJobName'];_0x2afd83[_0x711a('0x72')]=_0x4552a5[_0x711a('0x6f')][_0x711a('0x73')];return _0x3d12de(_0x2afd83);})[_0x711a('0x41')](function(_0x59f28c){return _0x1c560f(_0x59f28c);});});}exports[_0x711a('0x74')]=function(_0xfd2194,_0x3c9bd0,_0x3fea4c){var _0x353028;var _0x5a9de8;var _0x329b4f;var _0x586f6e=require(_0x711a('0x56'));return db[_0x711a('0x2b')][_0x711a('0x75')]({'where':{'id':_0xfd2194[_0x711a('0x43')]['id']}})[_0x711a('0x24')](function(_0x5a9244){if(_0x5a9244){var _0x475331=util['format']('%s.cypher',_0x5a9244['value']);if(fs[_0x711a('0x4d')](_0x475331)){cypher=!![];return _0x586f6e[_0x711a('0x4b')](_0x475331,_0x5a9244['value'],config[_0x711a('0x5c')][_0x711a('0x4c')])[_0x711a('0x24')](function(){return _0x5a9244;});}return _0x5a9244;}})[_0x711a('0x24')](function(_0x2cf303){if(!_0x2cf303){throw new db[(_0x711a('0x4e'))][(_0x711a('0x4f'))](_0x711a('0x76'));}_0x5a9de8=_0x2cf303;return db[_0x711a('0x77')][_0x711a('0x75')]({'where':{'id':0x1}});})[_0x711a('0x24')](handleEntityNotFound(_0x3c9bd0,null))[_0x711a('0x24')](function(_0x8482d3){if(_0x8482d3){_0x353028=_0x8482d3;if(!_0x353028[_0x711a('0x78')]||!_0x353028[_0x711a('0x79')]||!_0x353028[_0x711a('0x7a')]||!_0x353028['language']||!_0x353028[_0x711a('0x6a')]){throw new db[(_0x711a('0x4e'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0xfd2194[_0x711a('0x45')]['runSentiment']&&(!_0x353028[_0x711a('0x7b')]||!_0x353028['sentimentAccountId']||!_0x353028[_0x711a('0x7c')]||!_0x353028['language']||!_0x353028[_0x711a('0x6a')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x711a('0x7d')][_0x711a('0x75')]({'where':{'id':_0x353028[_0x711a('0x79')]}});}})['then'](function(_0x37a9c2){if(!_0x37a9c2){throw new db['Sequelize'][(_0x711a('0x4f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x37a9c2[_0x711a('0x7e')]||!_0x37a9c2['data2']){throw new db[(_0x711a('0x4e'))][(_0x711a('0x4f'))](_0x711a('0x7f'));}_0x329b4f=_0x37a9c2;return getBucketslist(_0x329b4f[_0x711a('0x7e')],_0x329b4f[_0x711a('0x80')],_0x353028['transcribeRegion']);})[_0x711a('0x24')](function(_0x2c8a77){if(_0x2c8a77&&_0x2c8a77[_0x711a('0x81')]){var _0x11a817=_[_0x711a('0x44')](_0x2c8a77[_0x711a('0x81')],function(_0x4cb9ce){return _0x4cb9ce[_0x711a('0x82')]===_0x353028[_0x711a('0x6a')];});if(!_0x11a817){logger[_0x711a('0x5e')](util[_0x711a('0x2e')](_0x711a('0x83'),_0xfd2194['params']['id'],_0x353028['bucket']));return createBucket(_0x329b4f[_0x711a('0x7e')],_0x329b4f[_0x711a('0x80')],_0x353028[_0x711a('0x7a')],_0x353028[_0x711a('0x6a')]);}logger['info'](util['format'](_0x711a('0x84'),_0xfd2194[_0x711a('0x43')]['id'],_0x353028[_0x711a('0x6a')]));return;}})[_0x711a('0x24')](function(_0x545d80){if(_0x5a9de8[_0x711a('0x72')]===_0x711a('0x85')){return transcribe(_0xfd2194[_0x711a('0x43')]['id'],_0x329b4f[_0x711a('0x7e')],_0x329b4f[_0x711a('0x80')],_0x353028[_0x711a('0x7a')],_0x353028[_0x711a('0x6a')],_0x5a9de8['value'],_0x353028[_0x711a('0x86')]);}else{logger[_0x711a('0x5e')](util[_0x711a('0x2e')](_0x711a('0x87'),_0xfd2194[_0x711a('0x43')]['id']));return{'transcribeStatus':_0x711a('0x88')};}})[_0x711a('0x24')](function(_0x1565f8){if(_0x1565f8){_0x1565f8[_0x711a('0x89')]=_0xfd2194[_0x711a('0x45')][_0x711a('0x8a')];return _0x5a9de8[_0x711a('0x8b')](_0x1565f8);}})['then'](respondWithResult(_0x3c9bd0,null))['catch'](handleError(_0x3c9bd0,null));};function writeFile(_0x5440a4,_0x180530){return new Promise(function(_0x1a513d,_0x333b4b){fs[_0x711a('0x8c')](_0x180530,_0x5440a4,function(_0x4fcc40,_0x27ded5){if(_0x4fcc40){return _0x333b4b(_0x4fcc40);}else{return _0x1a513d(_0x27ded5);}});});}exports[_0x711a('0x8d')]=function(_0x65c7ef,_0x35a2e1,_0x540452){return db[_0x711a('0x2b')]['findOne']({'where':{'id':_0x65c7ef[_0x711a('0x43')]['id']}})[_0x711a('0x24')](handleEntityNotFound(_0x35a2e1))[_0x711a('0x24')](function(_0x3c8cf3){if(_0x3c8cf3&&_0x3c8cf3[_0x711a('0x8e')]){var _0x40556b=_0x3c8cf3['fileText'];var _0x53edf3=config['root']+'/server/files/transcribes/transcribe_'+_0x3c8cf3['id']+_0x711a('0x8f');if(fs[_0x711a('0x4d')](_0x53edf3)){return _0x53edf3;}return writeFile(_0x40556b,_0x53edf3)[_0x711a('0x24')](function(){return _0x53edf3;});}else{throw new db[(_0x711a('0x4e'))][(_0x711a('0x4f'))]('Transcript\x20not\x20available');}})[_0x711a('0x24')](function(_0xe54c27){return _0x35a2e1['download'](_0xe54c27);})[_0x711a('0x41')](handleError(_0x35a2e1));}; \ No newline at end of file +var _0xc642=['catch','show','keys','find','create','body','params','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','Not\x20found','sequelize','col','token','$and','push','%s.cypher','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','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\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','../../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','save','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x3abac4,_0x418685){var _0x2d97d7=function(_0x5c9a34){while(--_0x5c9a34){_0x3abac4['push'](_0x3abac4['shift']());}};_0x2d97d7(++_0x418685);}(_0xc642,0x185));var _0x2c64=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc642[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x2c64('0x0'));var rimraf=require(_0x2c64('0x1'));var zipdir=require(_0x2c64('0x2'));var jsonpatch=require(_0x2c64('0x3'));var rp=require(_0x2c64('0x4'));var moment=require(_0x2c64('0x5'));var BPromise=require(_0x2c64('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c64('0x7'));var sox=require(_0x2c64('0x8'));var csv=require(_0x2c64('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c64('0xa'));var _=require(_0x2c64('0xb'));var squel=require(_0x2c64('0xc'));var crypto=require(_0x2c64('0xd'));var jsforce=require(_0x2c64('0xe'));var deskjs=require(_0x2c64('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c64('0x10'));var Papa=require(_0x2c64('0x11'));var AWS=require(_0x2c64('0x12'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c64('0x13'));var as=require(_0x2c64('0x14'));var hardwareService=require(_0x2c64('0x15'));var logger=require(_0x2c64('0x16'))('api');var utils=require(_0x2c64('0x17'));var config=require(_0x2c64('0x18'));var licenseUtil=require(_0x2c64('0x19'));var db=require(_0x2c64('0x1a'))['db'];function respondWithStatusCode(_0x423364,_0x277a44){_0x277a44=_0x277a44||0xcc;return function(_0x87c24f){if(_0x87c24f){return _0x423364[_0x2c64('0x1b')](_0x277a44);}return _0x423364[_0x2c64('0x1c')](_0x277a44)[_0x2c64('0x1d')]();};}function respondWithResult(_0x5ca8bd,_0x496329){_0x496329=_0x496329||0xc8;return function(_0x72ae5){if(_0x72ae5){return _0x5ca8bd[_0x2c64('0x1c')](_0x496329)[_0x2c64('0x1e')](_0x72ae5);}};}function respondWithFilteredResult(_0x4352f7,_0x5d894b){return function(_0xe2fea2){if(_0xe2fea2){var _0x4cb365=typeof _0x5d894b[_0x2c64('0x1f')]===_0x2c64('0x20')&&typeof _0x5d894b[_0x2c64('0x21')]===_0x2c64('0x20');var _0x536171=_0xe2fea2[_0x2c64('0x22')];var _0x6ea931=_0x4cb365?0x0:_0x5d894b[_0x2c64('0x1f')];var _0x2c492a=_0x4cb365?_0xe2fea2[_0x2c64('0x22')]:_0x5d894b[_0x2c64('0x1f')]+_0x5d894b[_0x2c64('0x21')];var _0xdb2987;if(_0x2c492a>=_0x536171){_0x2c492a=_0x536171;_0xdb2987=0xc8;}else{_0xdb2987=0xce;}_0x4352f7['status'](_0xdb2987);return _0x4352f7[_0x2c64('0x23')](_0x2c64('0x24'),_0x6ea931+'-'+_0x2c492a+'/'+_0x536171)['json'](_0xe2fea2);}return null;};}function patchUpdates(_0xaff558){return function(_0x1cf056){try{jsonpatch[_0x2c64('0x25')](_0x1cf056,_0xaff558,!![]);}catch(_0x258103){return BPromise['reject'](_0x258103);}return _0x1cf056[_0x2c64('0x26')]();};}function saveUpdates(_0x52f0d2,_0x4807dd){return function(_0x404c44){if(_0x404c44){return _0x404c44[_0x2c64('0x27')](_0x52f0d2)['then'](function(_0x22ac4f){return _0x22ac4f;});}return null;};}function removeEntity(_0x29a7ad,_0x3efc53){return function(_0x524269){if(_0x524269){return _0x524269[_0x2c64('0x28')]()[_0x2c64('0x29')](function(){_0x29a7ad[_0x2c64('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f0d5,_0x1f9bb5){return function(_0x240aa5){if(!_0x240aa5){_0x11f0d5[_0x2c64('0x1b')](0x194);}return _0x240aa5;};}function handleError(_0x255f2f,_0x4ba2fb){_0x4ba2fb=_0x4ba2fb||0x1f4;return function(_0x271311){logger[_0x2c64('0x2a')](_0x271311[_0x2c64('0x2b')]);if(_0x271311[_0x2c64('0x2c')]){delete _0x271311[_0x2c64('0x2c')];}_0x255f2f[_0x2c64('0x1c')](_0x4ba2fb)[_0x2c64('0x2d')](_0x271311);};}exports[_0x2c64('0x2e')]=function(_0x523f70,_0x5dff8a){var _0x189d54={},_0x12a19d={},_0x50a4c6={'count':0x0,'rows':[]};var _0x44c944=_[_0x2c64('0x2f')](db[_0x2c64('0x30')]['rawAttributes'],function(_0x2b0286){return{'name':_0x2b0286['fieldName'],'type':_0x2b0286[_0x2c64('0x31')][_0x2c64('0x32')]};});_0x12a19d['model']=_[_0x2c64('0x33')](_['map'](_0x44c944,'name'),[_0x2c64('0x34')]);_0x12a19d[_0x2c64('0x35')]=_['keys'](_0x523f70[_0x2c64('0x35')]);_0x12a19d[_0x2c64('0x36')]=_[_0x2c64('0x37')](_0x12a19d[_0x2c64('0x38')],_0x12a19d[_0x2c64('0x35')]);_0x189d54['attributes']=_[_0x2c64('0x37')](_0x12a19d['model'],qs[_0x2c64('0x39')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x39')]));_0x189d54[_0x2c64('0x3a')]=_0x189d54[_0x2c64('0x3a')][_0x2c64('0x3b')]?_0x189d54['attributes']:_0x12a19d[_0x2c64('0x38')];if(!_0x523f70['query'][_0x2c64('0x3c')](_0x2c64('0x3d'))){_0x189d54[_0x2c64('0x21')]=qs[_0x2c64('0x21')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x21')]);_0x189d54[_0x2c64('0x1f')]=qs[_0x2c64('0x1f')](_0x523f70['query'][_0x2c64('0x1f')]);}_0x189d54[_0x2c64('0x3e')]=qs[_0x2c64('0x3f')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x3f')]);_0x189d54[_0x2c64('0x40')]=qs['filters'](_[_0x2c64('0x41')](_0x523f70['query'],_0x12a19d['filters']),_0x44c944);if(_0x523f70[_0x2c64('0x35')][_0x2c64('0x42')]){_0x189d54['where']=_['merge'](_0x189d54['where'],{'$or':_[_0x2c64('0x2f')](_0x44c944,function(_0x22e194){if(_0x22e194[_0x2c64('0x31')]!=='VIRTUAL'){var _0x4a3028={};_0x4a3028[_0x22e194['name']]={'$like':'%'+_0x523f70[_0x2c64('0x35')][_0x2c64('0x42')]+'%'};return _0x4a3028;}})});}_0x189d54=_[_0x2c64('0x43')]({},_0x189d54,_0x523f70[_0x2c64('0x44')]);var _0x215278={'where':_0x189d54['where']};return db[_0x2c64('0x30')][_0x2c64('0x22')](_0x215278)[_0x2c64('0x29')](function(_0x2165a0){_0x50a4c6[_0x2c64('0x22')]=_0x2165a0;if(_0x523f70[_0x2c64('0x35')][_0x2c64('0x45')]){_0x189d54[_0x2c64('0x46')]=[{'all':!![]}];}return db[_0x2c64('0x30')][_0x2c64('0x47')](_0x189d54);})['then'](function(_0x22e42d){_0x50a4c6[_0x2c64('0x48')]=_0x22e42d;return _0x50a4c6;})[_0x2c64('0x29')](respondWithFilteredResult(_0x5dff8a,_0x189d54))[_0x2c64('0x49')](handleError(_0x5dff8a,null));};exports[_0x2c64('0x4a')]=function(_0x145c4d,_0x1c18cf){var _0x35ae4b={'raw':![],'where':{'id':_0x145c4d['params']['id']}},_0x582fe1={};_0x582fe1[_0x2c64('0x38')]=_['keys'](db[_0x2c64('0x30')]['rawAttributes']);_0x582fe1[_0x2c64('0x35')]=_[_0x2c64('0x4b')](_0x145c4d[_0x2c64('0x35')]);_0x582fe1[_0x2c64('0x36')]=_[_0x2c64('0x37')](_0x582fe1[_0x2c64('0x38')],_0x582fe1[_0x2c64('0x35')]);_0x35ae4b['attributes']=_[_0x2c64('0x37')](_0x582fe1[_0x2c64('0x38')],qs[_0x2c64('0x39')](_0x145c4d[_0x2c64('0x35')][_0x2c64('0x39')]));_0x35ae4b[_0x2c64('0x3a')]=_0x35ae4b['attributes'][_0x2c64('0x3b')]?_0x35ae4b[_0x2c64('0x3a')]:_0x582fe1[_0x2c64('0x38')];if(_0x145c4d[_0x2c64('0x35')][_0x2c64('0x45')]){_0x35ae4b[_0x2c64('0x46')]=[{'all':!![]}];}_0x35ae4b=_[_0x2c64('0x43')]({},_0x35ae4b,_0x145c4d[_0x2c64('0x44')]);return db[_0x2c64('0x30')][_0x2c64('0x4c')](_0x35ae4b)[_0x2c64('0x29')](handleEntityNotFound(_0x1c18cf,null))[_0x2c64('0x29')](respondWithResult(_0x1c18cf,null))[_0x2c64('0x49')](handleError(_0x1c18cf,null));};exports[_0x2c64('0x4d')]=function(_0x5e018f,_0x3c293a){return db[_0x2c64('0x30')][_0x2c64('0x4d')](_0x5e018f[_0x2c64('0x4e')],{})['then'](respondWithResult(_0x3c293a,0xc9))[_0x2c64('0x49')](handleError(_0x3c293a,null));};exports[_0x2c64('0x27')]=function(_0x5e286d,_0x42bdbd){if(_0x5e286d[_0x2c64('0x4e')]['id']){delete _0x5e286d['body']['id'];}return db['VoiceRecording'][_0x2c64('0x4c')]({'where':{'id':_0x5e286d[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](handleEntityNotFound(_0x42bdbd,null))[_0x2c64('0x29')](saveUpdates(_0x5e286d[_0x2c64('0x4e')],null))[_0x2c64('0x29')](respondWithResult(_0x42bdbd,null))[_0x2c64('0x49')](handleError(_0x42bdbd,null));};exports['describe']=function(_0x2da88b,_0x55e791){return db[_0x2c64('0x30')][_0x2c64('0x50')]()['then'](respondWithResult(_0x55e791,null))[_0x2c64('0x49')](handleError(_0x55e791,null));};exports['download']=function(_0x2d7580,_0x66d43,_0x2df1b2){var _0x19c5fb=require(_0x2c64('0x51'));var _0x34eae7=![];var _0x2b45ba={};if(_0x2d7580[_0x2c64('0x35')][_0x2c64('0x31')]&&_0x2d7580['query'][_0x2c64('0x31')]===_0x2c64('0x52')){_0x2b45ba[_0x2c64('0x52')]=_0x2d7580[_0x2c64('0x4f')]['id'];}else{_0x2b45ba['id']=_0x2d7580['params']['id'];}return db[_0x2c64('0x30')][_0x2c64('0x4c')]({'where':_0x2b45ba,'attributes':['id',_0x2c64('0x53')],'raw':!![]})[_0x2c64('0x29')](handleEntityNotFound(_0x66d43,null))[_0x2c64('0x29')](function(_0x4c21b1){if(_0x4c21b1){var _0x5ac62f=_0x4c21b1[_0x2c64('0x53')];var _0x2f3477=util[_0x2c64('0x34')]('%s.cypher',_0x5ac62f);if(fs[_0x2c64('0x54')](_0x2f3477)){_0x34eae7=!![];return _0x19c5fb[_0x2c64('0x55')](_0x2f3477,_0x5ac62f,config[_0x2c64('0x56')][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x4c21b1;});}return _0x4c21b1;}})[_0x2c64('0x29')](function(_0x32337c){if(_0x32337c){var _0x3af561=_0x32337c[_0x2c64('0x53')];if(!fs[_0x2c64('0x54')](_0x3af561)){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x59'));}if(_0x32337c[_0x2c64('0x5a')]){return _0x66d43[_0x2c64('0x5b')](_0x3af561,_0x32337c[_0x2c64('0x5a')]+path['extname'](_0x3af561),function(){if(_0x34eae7){fs['unlink'](_0x3af561);}});}else{return _0x66d43[_0x2c64('0x5b')](_0x3af561,function(_0x4b017d){if(_0x34eae7){fs[_0x2c64('0x5c')](_0x3af561);}});}}})['catch'](function(_0x118bc9){if(_0x118bc9['message']==='VoiceRecording\x20not\x20found'){_0x66d43['status'](0x194)[_0x2c64('0x2d')](_0x2c64('0x5d'));}else{return handleError(_0x66d43,null);}});};exports['downloads']=function(_0xf40ccf,_0x9d1340,_0x56da29){var _0x4ee038=require(_0x2c64('0x51'));var _0x4ee46c=![];var _0x35de6d={'$and':[db[_0x2c64('0x5e')][_0x2c64('0x40')](db['sequelize']['fn']('MD5',db['sequelize'][_0x2c64('0x5f')](_0x2c64('0x52'))),_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x60')])]};if(_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x31')]&&_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x31')]==='uniqueid'){_0x35de6d[_0x2c64('0x61')][_0x2c64('0x62')]({'uniqueid':_0xf40ccf[_0x2c64('0x4f')]['id']});}else{_0x35de6d[_0x2c64('0x61')][_0x2c64('0x62')]({'id':_0xf40ccf[_0x2c64('0x4f')]['id']});}return db['VoiceRecording'][_0x2c64('0x4c')]({'where':_0x35de6d,'attributes':['id',_0x2c64('0x53')],'raw':!![]})[_0x2c64('0x29')](handleEntityNotFound(_0x9d1340,null))[_0x2c64('0x29')](function(_0x8165b3){if(_0x8165b3){var _0x5385d2=util[_0x2c64('0x34')](_0x2c64('0x63'),_0x8165b3[_0x2c64('0x53')]);if(fs[_0x2c64('0x54')](_0x5385d2)){_0x4ee46c=!![];return _0x4ee038[_0x2c64('0x55')](_0x5385d2,_0x8165b3[_0x2c64('0x53')],config['secrets'][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x8165b3;});}return _0x8165b3;}})[_0x2c64('0x29')](function(_0xd96ca){if(_0xd96ca){if(!fs['existsSync'](_0xd96ca['value'])){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x59'));}if(_0xd96ca[_0x2c64('0x5a')]){return _0x9d1340[_0x2c64('0x5b')](_0xd96ca[_0x2c64('0x53')],_0xd96ca[_0x2c64('0x5a')]+path[_0x2c64('0x64')](_0xd96ca[_0x2c64('0x53')]),function(){if(_0x4ee46c){fs[_0x2c64('0x5c')](_0xd96ca[_0x2c64('0x53')]);}});}else{return _0x9d1340[_0x2c64('0x5b')](_0xd96ca[_0x2c64('0x53')],function(_0x44384d){if(_0x4ee46c){fs[_0x2c64('0x5c')](_0xd96ca['value']);}});}}})[_0x2c64('0x49')](handleError(_0x9d1340,null));};exports[_0x2c64('0x28')]=function(_0x3a0154,_0x39e896){return db['VoiceRecording'][_0x2c64('0x4c')]({'where':{'id':_0x3a0154[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](function(_0x321e87){if(_[_0x2c64('0x65')](_0x321e87)){throw new ReferenceError(_0x2c64('0x66'));}return _0x321e87;})[_0x2c64('0x29')](function(_0x217924){var _0x302774=_0x217924[_0x2c64('0x53')];logger['info'](_0x2c64('0x67'),_0x302774);if(!_[_0x2c64('0x65')](_0x217924['value'])&&fs[_0x2c64('0x54')](_0x302774)){logger[_0x2c64('0x68')](_0x2c64('0x69')+_0x302774+_0x2c64('0x6a'));fs['unlinkSync'](_0x302774);}_0x302774=_0x302774+'.cypher';if(!_['isNil'](_0x217924['value'])&&fs[_0x2c64('0x54')](_0x302774)){logger['info'](_0x2c64('0x69')+_0x302774+_0x2c64('0x6a'));fs['unlinkSync'](_0x302774);}return _0x217924;})[_0x2c64('0x29')](function(_0x12f7ab){if(!_0x12f7ab)throw new InternalError();return _0x12f7ab[_0x2c64('0x28')]();})[_0x2c64('0x29')](function(){_0x39e896[_0x2c64('0x1c')](0xcc)[_0x2c64('0x1d')]();})['catch'](handleError(_0x39e896,null));};function getBucketslist(_0x370ed0,_0x52f819,_0x422ab9){return new Promise(function(_0x53b380,_0x2c13b8){var _0x118380=new AWS['S3']({'accessKeyId':_0x52f819,'secretAccessKey':_0x370ed0,'region':_0x422ab9});_0x118380[_0x2c64('0x6b')]({},function(_0x1696c1,_0x2104f2){if(_0x1696c1){return _0x2c13b8(_0x1696c1);}else{return _0x53b380(_0x2104f2);}});});}function createBucket(_0x212b68,_0x39c4d3,_0x214593,_0x21d8b8){return new Promise(function(_0x3638cc,_0x32f037){var _0x4c7efa=new AWS['S3']({'accessKeyId':_0x39c4d3,'secretAccessKey':_0x212b68,'region':_0x214593});_0x4c7efa[_0x2c64('0x6c')]({'Bucket':_0x21d8b8},function(_0x3eb76a,_0x402475){if(_0x3eb76a){return _0x32f037(_0x3eb76a);}else{return _0x3638cc(_0x402475);}});});}function uploadFile(_0x221ed9,_0x331b41,_0x2efffa,_0x1d0f6f,_0x4d72bb,_0x51139d){return new Promise(function(_0x39d29a,_0x373366){var _0x48ec07=new AWS['S3']({'accessKeyId':_0x331b41,'secretAccessKey':_0x221ed9,'region':_0x2efffa});_0x48ec07[_0x2c64('0x6d')]({'Bucket':_0x1d0f6f,'Key':_0x4d72bb,'Body':_0x51139d},function(_0x1ae399,_0x3fb46f){if(_0x1ae399){return _0x373366(_0x1ae399);}else{return _0x39d29a(_0x3fb46f);}});});}function startTranscribe(_0x2ecc7d,_0x17c11e,_0x361b74,_0x2a303a,_0x42bb4e,_0x1546ef){return new Promise(function(_0x2ad128,_0x5c1f48){var _0x58ba70=new AWS['TranscribeService']({'accessKeyId':_0x17c11e,'secretAccessKey':_0x2ecc7d,'region':_0x361b74});_0x58ba70[_0x2c64('0x6e')]({'TranscriptionJobName':_0x2a303a,'LanguageCode':_0x42bb4e,'Media':{'MediaFileUri':_0x1546ef}},function(_0x3304da,_0x24618f){if(_0x3304da){return _0x5c1f48(_0x3304da);}else{return _0x2ad128(_0x24618f);}});});}function transcribe(_0x36124b,_0x2b5110,_0x5ed309,_0x462569,_0x49aac5,_0x11b60d,_0x150d79){return new Promise(function(_0x2add35,_0x273120){var _0x34d39d={};logger['info'](util[_0x2c64('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x36124b,_0x49aac5));return uploadFile(_0x2b5110,_0x5ed309,_0x462569,_0x49aac5,path[_0x2c64('0x6f')](_0x11b60d),fs[_0x2c64('0x70')](_0x11b60d))['then'](function(_0x51bd8a){logger[_0x2c64('0x68')](util['format'](_0x2c64('0x71'),_0x36124b,_0x49aac5,_0x51bd8a[_0x2c64('0x72')]));_0x34d39d[_0x2c64('0x73')]=_0x51bd8a[_0x2c64('0x74')];_0x34d39d[_0x2c64('0x75')]=_0x51bd8a['Location'];logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x76'),_0x36124b));return startTranscribe(_0x2b5110,_0x5ed309,_0x462569,uuidv4(),_0x150d79,_0x51bd8a['Location']);})[_0x2c64('0x29')](function(_0x4aefce){logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x77'),_0x36124b,_0x4aefce[_0x2c64('0x78')][_0x2c64('0x79')]));_0x34d39d['transcribeName']=_0x4aefce['TranscriptionJob'][_0x2c64('0x79')];_0x34d39d[_0x2c64('0x7a')]=_0x4aefce[_0x2c64('0x78')]['TranscriptionJobStatus'];return _0x2add35(_0x34d39d);})[_0x2c64('0x49')](function(_0x3e8eeb){return _0x273120(_0x3e8eeb);});});}exports[_0x2c64('0x7b')]=function(_0x52bc85,_0x61c9a8,_0x3a508f){var _0x26698a;var _0x30dc16;var _0x17e1f1;var _0xf70aff=require('../../components/encryptor');return db['VoiceRecording'][_0x2c64('0x7c')]({'where':{'id':_0x52bc85[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](function(_0x2d9c5a){if(_0x2d9c5a){var _0x2ad251=util[_0x2c64('0x34')]('%s.cypher',_0x2d9c5a['value']);if(fs[_0x2c64('0x54')](_0x2ad251)){cypher=!![];return _0xf70aff[_0x2c64('0x55')](_0x2ad251,_0x2d9c5a[_0x2c64('0x53')],config['secrets'][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x2d9c5a;});}return _0x2d9c5a;}})['then'](function(_0x4282ef){if(!_0x4282ef){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x7e'));}_0x30dc16=_0x4282ef;return db[_0x2c64('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x2c64('0x29')](handleEntityNotFound(_0x61c9a8,null))[_0x2c64('0x29')](function(_0x432ba1){if(_0x432ba1){_0x26698a=_0x432ba1;if(!_0x26698a['transcribe']||!_0x26698a[_0x2c64('0x80')]||!_0x26698a[_0x2c64('0x81')]||!_0x26698a[_0x2c64('0x82')]||!_0x26698a[_0x2c64('0x73')]){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x83'));}if(_0x52bc85[_0x2c64('0x4e')]['runSentiment']&&(!_0x26698a[_0x2c64('0x84')]||!_0x26698a[_0x2c64('0x85')]||!_0x26698a[_0x2c64('0x86')]||!_0x26698a[_0x2c64('0x82')]||!_0x26698a[_0x2c64('0x73')])){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x87'));}return db[_0x2c64('0x88')][_0x2c64('0x7c')]({'where':{'id':_0x26698a[_0x2c64('0x80')]}});}})[_0x2c64('0x29')](function(_0x115424){if(!_0x115424){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x89'));}if(!_0x115424[_0x2c64('0x8a')]||!_0x115424[_0x2c64('0x8b')]){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x8c'));}_0x17e1f1=_0x115424;return getBucketslist(_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a[_0x2c64('0x81')]);})[_0x2c64('0x29')](function(_0x58438c){if(_0x58438c&&_0x58438c[_0x2c64('0x8d')]){var _0xddca31=_[_0x2c64('0x4c')](_0x58438c[_0x2c64('0x8d')],function(_0x3749db){return _0x3749db[_0x2c64('0x8e')]===_0x26698a[_0x2c64('0x73')];});if(!_0xddca31){logger['info'](util[_0x2c64('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x52bc85[_0x2c64('0x4f')]['id'],_0x26698a['bucket']));return createBucket(_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a[_0x2c64('0x81')],_0x26698a[_0x2c64('0x73')]);}logger['info'](util[_0x2c64('0x34')](_0x2c64('0x8f'),_0x52bc85[_0x2c64('0x4f')]['id'],_0x26698a[_0x2c64('0x73')]));return;}})['then'](function(_0x47ed42){if(_0x30dc16['transcribeStatus']===_0x2c64('0x90')){return transcribe(_0x52bc85[_0x2c64('0x4f')]['id'],_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a['transcribeRegion'],_0x26698a[_0x2c64('0x73')],_0x30dc16[_0x2c64('0x53')],_0x26698a[_0x2c64('0x82')]);}else{logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x91'),_0x52bc85['params']['id']));return{'transcribeStatus':_0x2c64('0x92')};}})['then'](function(_0x164fed){if(_0x164fed){_0x164fed['tempSentiment']=_0x52bc85['body'][_0x2c64('0x93')];return _0x30dc16[_0x2c64('0x94')](_0x164fed);}})[_0x2c64('0x29')](respondWithResult(_0x61c9a8,null))[_0x2c64('0x49')](handleError(_0x61c9a8,null));};function writeFile(_0x4b8c21,_0x3d051c){return new Promise(function(_0x597c79,_0x57957a){fs[_0x2c64('0x95')](_0x3d051c,_0x4b8c21,function(_0x41ede3,_0x510e76){if(_0x41ede3){return _0x57957a(_0x41ede3);}else{return _0x597c79(_0x510e76);}});});}exports[_0x2c64('0x96')]=function(_0x8046bf,_0x3d604b,_0x3a5409){return db[_0x2c64('0x30')][_0x2c64('0x7c')]({'where':{'id':_0x8046bf[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](handleEntityNotFound(_0x3d604b))[_0x2c64('0x29')](function(_0x298801){if(_0x298801&&_0x298801['fileText']){var _0x1c7d02=_0x298801[_0x2c64('0x97')];var _0x4fd5fa=config[_0x2c64('0x98')]+_0x2c64('0x99')+_0x298801['id']+'.txt';if(fs[_0x2c64('0x54')](_0x4fd5fa)){return _0x4fd5fa;}return writeFile(_0x1c7d02,_0x4fd5fa)[_0x2c64('0x29')](function(){return _0x4fd5fa;});}else{throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))]('Transcript\x20not\x20available');}})['then'](function(_0x573d75){return _0x3d604b[_0x2c64('0x5b')](_0x573d75);})[_0x2c64('0x49')](handleError(_0x3d604b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0b0a819..d05868e 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 _0x9d68=['api','moment','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','util'];(function(_0x1b2f60,_0x397037){var _0x472af4=function(_0x46f82d){while(--_0x46f82d){_0x1b2f60['push'](_0x1b2f60['shift']());}};_0x472af4(++_0x397037);}(_0x9d68,0xaf));var _0x89d6=function(_0xf2726b,_0x87deb7){_0xf2726b=_0xf2726b-0x0;var _0xa61a5=_0x9d68[_0xf2726b];return _0xa61a5;};'use strict';var _=require('lodash');var util=require(_0x89d6('0x0'));var logger=require('../../config/logger')(_0x89d6('0x1'));var moment=require(_0x89d6('0x2'));var BPromise=require('bluebird');var rp=require(_0x89d6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89d6('0x4'));var config=require(_0x89d6('0x5'));var attributes=require(_0x89d6('0x6'));module[_0x89d6('0x7')]=function(_0x2b5382,_0x210eb8){return _0x2b5382[_0x89d6('0x8')](_0x89d6('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x89d6('0xa'),'fields':[_0x89d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb51=['path','rimraf','./voiceRecording.attributes','define','voice_recordings','uniqueid','util','../../config/logger','api'];(function(_0x54aedc,_0x496913){var _0x426586=function(_0x4f6337){while(--_0x4f6337){_0x54aedc['push'](_0x54aedc['shift']());}};_0x426586(++_0x496913);}(_0xfb51,0xc3));var _0x1fb5=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xfb51[_0x397f37];return _0x31cae6;};'use strict';var _=require('lodash');var util=require(_0x1fb5('0x0'));var logger=require(_0x1fb5('0x1'))(_0x1fb5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb5('0x3'));var rimraf=require(_0x1fb5('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fb5('0x5'));module['exports']=function(_0x3b6061,_0x39aca7){return _0x3b6061[_0x1fb5('0x6')]('VoiceRecording',attributes,{'tableName':_0x1fb5('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1fb5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 3cf5401..97d97cd 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 _0x3a6d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','body','value','%s.cypher','encryptFile','secrets','recording','unlink','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x276194,_0x261c0e){var _0x378dfd=function(_0x54cdad){while(--_0x54cdad){_0x276194['push'](_0x276194['shift']());}};_0x378dfd(++_0x261c0e);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3a6d[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')](_0x8d1286['body'],{'raw':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286['options'][_0xd3a6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['attributes']||null:null,'limit':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['limit']||null:null})['then'](function(_0x5846bc){logger['info']('UpdateVoiceRecording',_0x8d1286);logger[_0xd3a6('0x1c')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x5846bc));_0xbe58b4(_0x5846bc);})['catch'](function(_0x456541){logger['error'](_0xd3a6('0x16'),_0x456541[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x456541['message']));});});};exports[_0xd3a6('0x1d')]=function(_0x3bc8d1){var _0x1b09ac=this;return new Promise(function(_0x219e32,_0x169d11){var _0x3106f1=require('../../components/encryptor');var _0x30df90;return db[_0xd3a6('0x1e')][_0xd3a6('0x1f')]({'attributes':['id',_0xd3a6('0x20')],'where':{'id':0x1},'raw':!![]})[_0xd3a6('0xd')](function(_0x45c628){_0x30df90=_0x45c628;return db['VoiceRecording']['create'](_0x3bc8d1[_0xd3a6('0x21')]);})[_0xd3a6('0xd')](function(_0x35981c){if(_0x30df90[_0xd3a6('0x20')]&&fs['existsSync'](_0x35981c[_0xd3a6('0x22')])){var _0xa4efd=util['format'](_0xd3a6('0x23'),_0x35981c['value']);return _0x3106f1[_0xd3a6('0x24')](_0x35981c[_0xd3a6('0x22')],_0xa4efd,config[_0xd3a6('0x25')][_0xd3a6('0x26')])[_0xd3a6('0xd')](function(){fs[_0xd3a6('0x27')](_0x35981c[_0xd3a6('0x22')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x35981c;});}return _0x35981c;})[_0xd3a6('0xd')](function(_0x155640){logger[_0xd3a6('0xe')]('CreateVoiceRecording',_0x3bc8d1);logger[_0xd3a6('0x1c')](_0xd3a6('0x1d'),_0x3bc8d1,JSON[_0xd3a6('0x12')](_0x155640));_0x219e32(_0x155640);})[_0xd3a6('0x28')](function(_0x3ebd0d){logger[_0xd3a6('0x13')](_0xd3a6('0x1d'),_0x3ebd0d[_0xd3a6('0x14')],_0x3bc8d1);_0x169d11(_0x1b09ac['error'](0x1f4,_0x3ebd0d[_0xd3a6('0x14')]));});});}; \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x478735,_0x21d957){var _0x16623b=function(_0x204be2){while(--_0x204be2){_0x478735['push'](_0x478735['shift']());}};_0x16623b(++_0x21d957);}(_0x1623,0xab));var _0x3162=function(_0x1344a7,_0x3fdc04){_0x1344a7=_0x1344a7-0x0;var _0x17a642=_0x1623[_0x1344a7];return _0x17a642;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4e85480..83f06e7 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 _0x70bd=['/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index'];(function(_0x52b91f,_0x499757){var _0x15f8f5=function(_0x33fbf6){while(--_0x33fbf6){_0x52b91f['push'](_0x52b91f['shift']());}};_0x15f8f5(++_0x499757);}(_0x70bd,0x183));var _0xd70b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x70bd[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0xd70b('0x0'));var util=require(_0xd70b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd70b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd70b('0x3'));var interaction=require(_0xd70b('0x4'));var config=require(_0xd70b('0x5'));var controller=require(_0xd70b('0x6'));router['get']('/',auth[_0xd70b('0x7')](),controller[_0xd70b('0x8')]);router['get'](_0xd70b('0x9'),auth[_0xd70b('0x7')](),controller[_0xd70b('0xa')]);router['get']('/:id',auth[_0xd70b('0x7')](),controller[_0xd70b('0xb')]);router[_0xd70b('0xc')]('/',auth[_0xd70b('0x7')](),controller['create']);router['put']('/:id',auth[_0xd70b('0x7')](),controller[_0xd70b('0xd')]);router[_0xd70b('0xe')](_0xd70b('0xf'),auth[_0xd70b('0x7')](),controller[_0xd70b('0x10')]);module[_0xd70b('0x11')]=router; \ No newline at end of file +var _0xe5b1=['index','/describe','describe','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe5b1,0xb4));var _0x1e5b=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xe5b1[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0x1e5b('0x0'));var util=require('util');var path=require(_0x1e5b('0x1'));var timeout=require(_0x1e5b('0x2'));var express=require(_0x1e5b('0x3'));var router=express[_0x1e5b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1e5b('0x5'));var config=require(_0x1e5b('0x6'));var controller=require(_0x1e5b('0x7'));router[_0x1e5b('0x8')]('/',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xa')]);router[_0x1e5b('0x8')](_0x1e5b('0xb'),auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xc')]);router[_0x1e5b('0x8')](_0x1e5b('0xd'),auth['isAuthenticated'](),controller[_0x1e5b('0xe')]);router['post']('/',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xf')]);router[_0x1e5b('0x10')]('/:id',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0x11')]);router[_0x1e5b('0x12')]('/:id',auth[_0x1e5b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f1629c5..b5862fb 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 _0x5af8=['sequelize','moment','ENUM','blind','attended','STRING'];(function(_0x6578d1,_0x3db94d){var _0x4ebfa7=function(_0x2268ea){while(--_0x2268ea){_0x6578d1['push'](_0x6578d1['shift']());}};_0x4ebfa7(++_0x3db94d);}(_0x5af8,0x1bc));var _0x85af=function(_0x21fdf6,_0x2fa1f8){_0x21fdf6=_0x21fdf6-0x0;var _0x858a00=_0x5af8[_0x21fdf6];return _0x858a00;};'use strict';var Sequelize=require(_0x85af('0x0'));var moment=require(_0x85af('0x1'));module['exports']={'type':{'type':Sequelize[_0x85af('0x2')](_0x85af('0x3'),_0x85af('0x4'))},'result':{'type':Sequelize[_0x85af('0x5')]},'transfererchannel':{'type':Sequelize[_0x85af('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x85af('0x5')]},'transferercalleridname':{'type':Sequelize[_0x85af('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x85af('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x85af('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x85af('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x85af('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x85af('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x85af('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x85af('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x85af('0x5')]},'transfereeexten':{'type':Sequelize[_0x85af('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x85af('0x5')]},'isexternal':{'type':Sequelize[_0x85af('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x85af('0x5')]},'extension':{'type':Sequelize[_0x85af('0x5')]}}; \ No newline at end of file +var _0x740e=['blind','STRING','Yes','sequelize','exports'];(function(_0x8386ea,_0x45474d){var _0x369414=function(_0x2b9f28){while(--_0x2b9f28){_0x8386ea['push'](_0x8386ea['shift']());}};_0x369414(++_0x45474d);}(_0x740e,0x1c5));var _0xe740=function(_0x1d1b7b,_0x15f59e){_0x1d1b7b=_0x1d1b7b-0x0;var _0x481669=_0x740e[_0x1d1b7b];return _0x481669;};'use strict';var Sequelize=require(_0xe740('0x0'));var moment=require('moment');module[_0xe740('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe740('0x2'),'attended')},'result':{'type':Sequelize[_0xe740('0x3')]},'transfererchannel':{'type':Sequelize[_0xe740('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xe740('0x3')]},'transferercalleridname':{'type':Sequelize[_0xe740('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe740('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xe740('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xe740('0x3')]},'transferercontext':{'type':Sequelize[_0xe740('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xe740('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe740('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xe740('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe740('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe740('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xe740('0x3')]},'transfereecontext':{'type':Sequelize[_0xe740('0x3')]},'transfereeexten':{'type':Sequelize[_0xe740('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xe740('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xe740('0x4'),'No')},'context':{'type':Sequelize[_0xe740('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0d38499..1b3eec0 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 _0x259d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1566c7,_0x428187){var _0x219c54=function(_0xec0378){while(--_0xec0378){_0x1566c7['push'](_0x1566c7['shift']());}};_0x219c54(++_0x428187);}(_0x259d,0x128));var _0xd259=function(_0x30715c,_0x54753f){_0x30715c=_0x30715c-0x0;var _0x41ee4b=_0x259d[_0x30715c];return _0x41ee4b;};'use strict';var emlformat=require(_0xd259('0x0'));var rimraf=require(_0xd259('0x1'));var zipdir=require(_0xd259('0x2'));var jsonpatch=require(_0xd259('0x3'));var rp=require(_0xd259('0x4'));var moment=require(_0xd259('0x5'));var BPromise=require(_0xd259('0x6'));var Mustache=require(_0xd259('0x7'));var util=require(_0xd259('0x8'));var path=require(_0xd259('0x9'));var sox=require(_0xd259('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd259('0xb'));var _=require(_0xd259('0xc'));var squel=require('squel');var crypto=require(_0xd259('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd259('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd259('0xf'));var Redis=require(_0xd259('0x10'));var authService=require(_0xd259('0x11'));var qs=require(_0xd259('0x12'));var as=require(_0xd259('0x13'));var hardwareService=require(_0xd259('0x14'));var logger=require(_0xd259('0x15'))(_0xd259('0x16'));var utils=require(_0xd259('0x17'));var config=require(_0xd259('0x18'));var licenseUtil=require(_0xd259('0x19'));var db=require(_0xd259('0x1a'))['db'];function respondWithStatusCode(_0x291682,_0x5a349a){_0x5a349a=_0x5a349a||0xcc;return function(_0x3d4759){if(_0x3d4759){return _0x291682[_0xd259('0x1b')](_0x5a349a);}return _0x291682[_0xd259('0x1c')](_0x5a349a)['end']();};}function respondWithResult(_0x3cdf6a,_0x197bee){_0x197bee=_0x197bee||0xc8;return function(_0x329a80){if(_0x329a80){return _0x3cdf6a[_0xd259('0x1c')](_0x197bee)[_0xd259('0x1d')](_0x329a80);}};}function respondWithFilteredResult(_0x2f1088,_0x10a5f0){return function(_0x4c9bb5){if(_0x4c9bb5){var _0x211428=typeof _0x10a5f0['offset']===_0xd259('0x1e')&&typeof _0x10a5f0[_0xd259('0x1f')]==='undefined';var _0x46f27e=_0x4c9bb5[_0xd259('0x20')];var _0x2cadc4=_0x211428?0x0:_0x10a5f0[_0xd259('0x21')];var _0x39d879=_0x211428?_0x4c9bb5[_0xd259('0x20')]:_0x10a5f0[_0xd259('0x21')]+_0x10a5f0[_0xd259('0x1f')];var _0x4ec7c5;if(_0x39d879>=_0x46f27e){_0x39d879=_0x46f27e;_0x4ec7c5=0xc8;}else{_0x4ec7c5=0xce;}_0x2f1088[_0xd259('0x1c')](_0x4ec7c5);return _0x2f1088[_0xd259('0x22')](_0xd259('0x23'),_0x2cadc4+'-'+_0x39d879+'/'+_0x46f27e)['json'](_0x4c9bb5);}return null;};}function patchUpdates(_0x27111b){return function(_0x1f07c8){try{jsonpatch[_0xd259('0x24')](_0x1f07c8,_0x27111b,!![]);}catch(_0x49803c){return BPromise['reject'](_0x49803c);}return _0x1f07c8[_0xd259('0x25')]();};}function saveUpdates(_0xf61ee7,_0x5b99fa){return function(_0x116efd){if(_0x116efd){return _0x116efd[_0xd259('0x26')](_0xf61ee7)[_0xd259('0x27')](function(_0x5659e4){return _0x5659e4;});}return null;};}function removeEntity(_0x3861d5,_0x365589){return function(_0xe8c688){if(_0xe8c688){return _0xe8c688[_0xd259('0x28')]()['then'](function(){_0x3861d5[_0xd259('0x1c')](0xcc)[_0xd259('0x29')]();});}};}function handleEntityNotFound(_0x5c071d,_0x9f5fbb){return function(_0x52476a){if(!_0x52476a){_0x5c071d[_0xd259('0x1b')](0x194);}return _0x52476a;};}function handleError(_0x25d21a,_0x16510b){_0x16510b=_0x16510b||0x1f4;return function(_0x92c5cb){logger[_0xd259('0x2a')](_0x92c5cb[_0xd259('0x2b')]);if(_0x92c5cb[_0xd259('0x2c')]){delete _0x92c5cb[_0xd259('0x2c')];}_0x25d21a[_0xd259('0x1c')](_0x16510b)[_0xd259('0x2d')](_0x92c5cb);};}exports[_0xd259('0x2e')]=function(_0x4e2f43,_0x2124ed){var _0xa8cb1f={},_0x4d94e7={},_0x2e168e={'count':0x0,'rows':[]};var _0x40c863=_[_0xd259('0x2f')](db[_0xd259('0x30')][_0xd259('0x31')],function(_0x56dcf6){return{'name':_0x56dcf6[_0xd259('0x32')],'type':_0x56dcf6[_0xd259('0x33')]['key']};});_0x4d94e7[_0xd259('0x34')]=_[_0xd259('0x2f')](_0x40c863,_0xd259('0x2c'));_0x4d94e7['query']=_[_0xd259('0x35')](_0x4e2f43[_0xd259('0x36')]);_0x4d94e7[_0xd259('0x37')]=_[_0xd259('0x38')](_0x4d94e7[_0xd259('0x34')],_0x4d94e7[_0xd259('0x36')]);_0xa8cb1f[_0xd259('0x39')]=_[_0xd259('0x38')](_0x4d94e7[_0xd259('0x34')],qs[_0xd259('0x3a')](_0x4e2f43[_0xd259('0x36')][_0xd259('0x3a')]));_0xa8cb1f['attributes']=_0xa8cb1f[_0xd259('0x39')][_0xd259('0x3b')]?_0xa8cb1f[_0xd259('0x39')]:_0x4d94e7[_0xd259('0x34')];if(!_0x4e2f43['query']['hasOwnProperty'](_0xd259('0x3c'))){_0xa8cb1f[_0xd259('0x1f')]=qs[_0xd259('0x1f')](_0x4e2f43['query'][_0xd259('0x1f')]);_0xa8cb1f[_0xd259('0x21')]=qs[_0xd259('0x21')](_0x4e2f43[_0xd259('0x36')][_0xd259('0x21')]);}_0xa8cb1f[_0xd259('0x3d')]=qs[_0xd259('0x3e')](_0x4e2f43[_0xd259('0x36')]['sort']);_0xa8cb1f[_0xd259('0x3f')]=qs[_0xd259('0x37')](_[_0xd259('0x40')](_0x4e2f43[_0xd259('0x36')],_0x4d94e7[_0xd259('0x37')]),_0x40c863);if(_0x4e2f43[_0xd259('0x36')][_0xd259('0x41')]){_0xa8cb1f[_0xd259('0x3f')]=_[_0xd259('0x42')](_0xa8cb1f[_0xd259('0x3f')],{'$or':_[_0xd259('0x2f')](_0x40c863,function(_0x36d111){if(_0x36d111[_0xd259('0x33')]!==_0xd259('0x43')){var _0x7d69ad={};_0x7d69ad[_0x36d111[_0xd259('0x2c')]]={'$like':'%'+_0x4e2f43[_0xd259('0x36')][_0xd259('0x41')]+'%'};return _0x7d69ad;}})});}_0xa8cb1f=_[_0xd259('0x42')]({},_0xa8cb1f,_0x4e2f43[_0xd259('0x44')]);var _0xcbd8d9={'where':_0xa8cb1f[_0xd259('0x3f')]};return db[_0xd259('0x30')][_0xd259('0x20')](_0xcbd8d9)[_0xd259('0x27')](function(_0x49f3cb){_0x2e168e[_0xd259('0x20')]=_0x49f3cb;if(_0x4e2f43['query'][_0xd259('0x45')]){_0xa8cb1f[_0xd259('0x46')]=[{'all':!![]}];}return db[_0xd259('0x30')][_0xd259('0x47')](_0xa8cb1f);})[_0xd259('0x27')](function(_0xc085f0){_0x2e168e[_0xd259('0x48')]=_0xc085f0;return _0x2e168e;})[_0xd259('0x27')](respondWithFilteredResult(_0x2124ed,_0xa8cb1f))[_0xd259('0x49')](handleError(_0x2124ed,null));};exports[_0xd259('0x4a')]=function(_0x3a8baa,_0x20428b){var _0x3b9be2={'raw':!![],'where':{'id':_0x3a8baa[_0xd259('0x4b')]['id']}},_0x213aab={};_0x213aab[_0xd259('0x34')]=_[_0xd259('0x35')](db[_0xd259('0x30')][_0xd259('0x31')]);_0x213aab['query']=_[_0xd259('0x35')](_0x3a8baa['query']);_0x213aab[_0xd259('0x37')]=_[_0xd259('0x38')](_0x213aab[_0xd259('0x34')],_0x213aab[_0xd259('0x36')]);_0x3b9be2['attributes']=_[_0xd259('0x38')](_0x213aab[_0xd259('0x34')],qs['fields'](_0x3a8baa['query'][_0xd259('0x3a')]));_0x3b9be2[_0xd259('0x39')]=_0x3b9be2[_0xd259('0x39')][_0xd259('0x3b')]?_0x3b9be2[_0xd259('0x39')]:_0x213aab[_0xd259('0x34')];if(_0x3a8baa['query']['includeAll']){_0x3b9be2[_0xd259('0x46')]=[{'all':!![]}];}_0x3b9be2=_[_0xd259('0x42')]({},_0x3b9be2,_0x3a8baa[_0xd259('0x44')]);return db[_0xd259('0x30')]['find'](_0x3b9be2)['then'](handleEntityNotFound(_0x20428b,null))[_0xd259('0x27')](respondWithResult(_0x20428b,null))[_0xd259('0x49')](handleError(_0x20428b,null));};exports[_0xd259('0x4c')]=function(_0x3ce718,_0x12a0ad){return db[_0xd259('0x30')][_0xd259('0x4c')](_0x3ce718['body'],{})['then'](respondWithResult(_0x12a0ad,0xc9))[_0xd259('0x49')](handleError(_0x12a0ad,null));};exports[_0xd259('0x26')]=function(_0x268514,_0x5e0f83){if(_0x268514['body']['id']){delete _0x268514['body']['id'];}return db[_0xd259('0x30')][_0xd259('0x4d')]({'where':{'id':_0x268514[_0xd259('0x4b')]['id']}})[_0xd259('0x27')](handleEntityNotFound(_0x5e0f83,null))[_0xd259('0x27')](saveUpdates(_0x268514[_0xd259('0x4e')],null))['then'](respondWithResult(_0x5e0f83,null))[_0xd259('0x49')](handleError(_0x5e0f83,null));};exports[_0xd259('0x28')]=function(_0x29ce78,_0xb8b8a1){return db[_0xd259('0x30')][_0xd259('0x4d')]({'where':{'id':_0x29ce78['params']['id']}})['then'](handleEntityNotFound(_0xb8b8a1,null))[_0xd259('0x27')](removeEntity(_0xb8b8a1,null))['catch'](handleError(_0xb8b8a1,null));};exports[_0xd259('0x4f')]=function(_0x4901aa,_0x1b7679){return db['VoiceTransferReport']['describe']()['then'](respondWithResult(_0x1b7679,null))[_0xd259('0x49')](handleError(_0x1b7679,null));}; \ No newline at end of file +var _0x673a=['save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','VoiceTransferReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x41cb86,_0x4a705c){var _0x39a7d2=function(_0x22c960){while(--_0x22c960){_0x41cb86['push'](_0x41cb86['shift']());}};_0x39a7d2(++_0x4a705c);}(_0x673a,0x1ca));var _0xa673=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x673a[_0x43371b];return _0x19cd26;};'use strict';var emlformat=require(_0xa673('0x0'));var rimraf=require(_0xa673('0x1'));var zipdir=require(_0xa673('0x2'));var jsonpatch=require(_0xa673('0x3'));var rp=require(_0xa673('0x4'));var moment=require(_0xa673('0x5'));var BPromise=require(_0xa673('0x6'));var Mustache=require(_0xa673('0x7'));var util=require('util');var path=require(_0xa673('0x8'));var sox=require(_0xa673('0x9'));var csv=require(_0xa673('0xa'));var ejs=require(_0xa673('0xb'));var fs=require('fs');var fs_extra=require(_0xa673('0xc'));var _=require(_0xa673('0xd'));var squel=require('squel');var crypto=require(_0xa673('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa673('0xf'));var toCsv=require(_0xa673('0xa'));var querystring=require(_0xa673('0x10'));var Papa=require('papaparse');var Redis=require(_0xa673('0x11'));var authService=require(_0xa673('0x12'));var qs=require(_0xa673('0x13'));var as=require(_0xa673('0x14'));var hardwareService=require(_0xa673('0x15'));var logger=require(_0xa673('0x16'))(_0xa673('0x17'));var utils=require(_0xa673('0x18'));var config=require(_0xa673('0x19'));var licenseUtil=require(_0xa673('0x1a'));var db=require(_0xa673('0x1b'))['db'];function respondWithStatusCode(_0x24c48a,_0x16a444){_0x16a444=_0x16a444||0xcc;return function(_0x3fe9bf){if(_0x3fe9bf){return _0x24c48a[_0xa673('0x1c')](_0x16a444);}return _0x24c48a[_0xa673('0x1d')](_0x16a444)[_0xa673('0x1e')]();};}function respondWithResult(_0x2cfa8f,_0x1cb586){_0x1cb586=_0x1cb586||0xc8;return function(_0x30709b){if(_0x30709b){return _0x2cfa8f[_0xa673('0x1d')](_0x1cb586)[_0xa673('0x1f')](_0x30709b);}};}function respondWithFilteredResult(_0x266e28,_0x1c5457){return function(_0x200b7f){if(_0x200b7f){var _0x97fe13=typeof _0x1c5457[_0xa673('0x20')]===_0xa673('0x21')&&typeof _0x1c5457['limit']===_0xa673('0x21');var _0x1ad4a1=_0x200b7f[_0xa673('0x22')];var _0x184bc3=_0x97fe13?0x0:_0x1c5457[_0xa673('0x20')];var _0x297dbe=_0x97fe13?_0x200b7f[_0xa673('0x22')]:_0x1c5457['offset']+_0x1c5457[_0xa673('0x23')];var _0x40f64d;if(_0x297dbe>=_0x1ad4a1){_0x297dbe=_0x1ad4a1;_0x40f64d=0xc8;}else{_0x40f64d=0xce;}_0x266e28['status'](_0x40f64d);return _0x266e28[_0xa673('0x24')](_0xa673('0x25'),_0x184bc3+'-'+_0x297dbe+'/'+_0x1ad4a1)[_0xa673('0x1f')](_0x200b7f);}return null;};}function patchUpdates(_0x4fe5e3){return function(_0x34d72e){try{jsonpatch[_0xa673('0x26')](_0x34d72e,_0x4fe5e3,!![]);}catch(_0x477297){return BPromise[_0xa673('0x27')](_0x477297);}return _0x34d72e[_0xa673('0x28')]();};}function saveUpdates(_0x3a4cda,_0x23e412){return function(_0xb4c16c){if(_0xb4c16c){return _0xb4c16c[_0xa673('0x29')](_0x3a4cda)[_0xa673('0x2a')](function(_0x472c54){return _0x472c54;});}return null;};}function removeEntity(_0x4b3b06,_0x449016){return function(_0x5c57e3){if(_0x5c57e3){return _0x5c57e3[_0xa673('0x2b')]()[_0xa673('0x2a')](function(){_0x4b3b06[_0xa673('0x1d')](0xcc)[_0xa673('0x1e')]();});}};}function handleEntityNotFound(_0x8bcef0,_0x53e8e9){return function(_0x1fbc8e){if(!_0x1fbc8e){_0x8bcef0[_0xa673('0x1c')](0x194);}return _0x1fbc8e;};}function handleError(_0x4317f0,_0x4edb27){_0x4edb27=_0x4edb27||0x1f4;return function(_0x2b020c){logger['error'](_0x2b020c[_0xa673('0x2c')]);if(_0x2b020c['name']){delete _0x2b020c[_0xa673('0x2d')];}_0x4317f0[_0xa673('0x1d')](_0x4edb27)[_0xa673('0x2e')](_0x2b020c);};}exports[_0xa673('0x2f')]=function(_0x5ee6e9,_0x285790){var _0xd0464c={},_0x252ce8={},_0x234a0a={'count':0x0,'rows':[]};var _0x383f7f=_[_0xa673('0x30')](db['VoiceTransferReport'][_0xa673('0x31')],function(_0x2e7d7f){return{'name':_0x2e7d7f[_0xa673('0x32')],'type':_0x2e7d7f['type'][_0xa673('0x33')]};});_0x252ce8[_0xa673('0x34')]=_[_0xa673('0x30')](_0x383f7f,'name');_0x252ce8[_0xa673('0x35')]=_[_0xa673('0x36')](_0x5ee6e9['query']);_0x252ce8['filters']=_['intersection'](_0x252ce8[_0xa673('0x34')],_0x252ce8[_0xa673('0x35')]);_0xd0464c[_0xa673('0x37')]=_[_0xa673('0x38')](_0x252ce8[_0xa673('0x34')],qs[_0xa673('0x39')](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x39')]));_0xd0464c[_0xa673('0x37')]=_0xd0464c[_0xa673('0x37')][_0xa673('0x3a')]?_0xd0464c[_0xa673('0x37')]:_0x252ce8['model'];if(!_0x5ee6e9[_0xa673('0x35')][_0xa673('0x3b')](_0xa673('0x3c'))){_0xd0464c[_0xa673('0x23')]=qs[_0xa673('0x23')](_0x5ee6e9[_0xa673('0x35')]['limit']);_0xd0464c[_0xa673('0x20')]=qs[_0xa673('0x20')](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x20')]);}_0xd0464c[_0xa673('0x3d')]=qs['sort'](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x3e')]);_0xd0464c[_0xa673('0x3f')]=qs[_0xa673('0x40')](_[_0xa673('0x41')](_0x5ee6e9[_0xa673('0x35')],_0x252ce8[_0xa673('0x40')]),_0x383f7f);if(_0x5ee6e9[_0xa673('0x35')][_0xa673('0x42')]){_0xd0464c[_0xa673('0x3f')]=_['merge'](_0xd0464c[_0xa673('0x3f')],{'$or':_['map'](_0x383f7f,function(_0x43824c){if(_0x43824c[_0xa673('0x43')]!==_0xa673('0x44')){var _0x22b5b7={};_0x22b5b7[_0x43824c[_0xa673('0x2d')]]={'$like':'%'+_0x5ee6e9[_0xa673('0x35')][_0xa673('0x42')]+'%'};return _0x22b5b7;}})});}_0xd0464c=_[_0xa673('0x45')]({},_0xd0464c,_0x5ee6e9[_0xa673('0x46')]);var _0x3bcefc={'where':_0xd0464c[_0xa673('0x3f')]};return db[_0xa673('0x47')][_0xa673('0x22')](_0x3bcefc)[_0xa673('0x2a')](function(_0x20ff6a){_0x234a0a[_0xa673('0x22')]=_0x20ff6a;if(_0x5ee6e9[_0xa673('0x35')]['includeAll']){_0xd0464c[_0xa673('0x48')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xa673('0x49')](_0xd0464c);})[_0xa673('0x2a')](function(_0x10ea91){_0x234a0a[_0xa673('0x4a')]=_0x10ea91;return _0x234a0a;})[_0xa673('0x2a')](respondWithFilteredResult(_0x285790,_0xd0464c))[_0xa673('0x4b')](handleError(_0x285790,null));};exports[_0xa673('0x4c')]=function(_0x5c7ef9,_0xfeba4f){var _0x2d9e40={'raw':!![],'where':{'id':_0x5c7ef9[_0xa673('0x4d')]['id']}},_0xe9d311={};_0xe9d311[_0xa673('0x34')]=_['keys'](db['VoiceTransferReport'][_0xa673('0x31')]);_0xe9d311[_0xa673('0x35')]=_[_0xa673('0x36')](_0x5c7ef9[_0xa673('0x35')]);_0xe9d311['filters']=_[_0xa673('0x38')](_0xe9d311['model'],_0xe9d311[_0xa673('0x35')]);_0x2d9e40[_0xa673('0x37')]=_[_0xa673('0x38')](_0xe9d311[_0xa673('0x34')],qs[_0xa673('0x39')](_0x5c7ef9[_0xa673('0x35')][_0xa673('0x39')]));_0x2d9e40[_0xa673('0x37')]=_0x2d9e40[_0xa673('0x37')][_0xa673('0x3a')]?_0x2d9e40[_0xa673('0x37')]:_0xe9d311[_0xa673('0x34')];if(_0x5c7ef9[_0xa673('0x35')][_0xa673('0x4e')]){_0x2d9e40[_0xa673('0x48')]=[{'all':!![]}];}_0x2d9e40=_['merge']({},_0x2d9e40,_0x5c7ef9[_0xa673('0x46')]);return db[_0xa673('0x47')][_0xa673('0x4f')](_0x2d9e40)['then'](handleEntityNotFound(_0xfeba4f,null))[_0xa673('0x2a')](respondWithResult(_0xfeba4f,null))[_0xa673('0x4b')](handleError(_0xfeba4f,null));};exports['create']=function(_0x458907,_0x11963c){return db[_0xa673('0x47')][_0xa673('0x50')](_0x458907[_0xa673('0x51')],{})[_0xa673('0x2a')](respondWithResult(_0x11963c,0xc9))[_0xa673('0x4b')](handleError(_0x11963c,null));};exports[_0xa673('0x29')]=function(_0x53a107,_0x15469b){if(_0x53a107[_0xa673('0x51')]['id']){delete _0x53a107[_0xa673('0x51')]['id'];}return db['VoiceTransferReport'][_0xa673('0x4f')]({'where':{'id':_0x53a107[_0xa673('0x4d')]['id']}})[_0xa673('0x2a')](handleEntityNotFound(_0x15469b,null))[_0xa673('0x2a')](saveUpdates(_0x53a107[_0xa673('0x51')],null))[_0xa673('0x2a')](respondWithResult(_0x15469b,null))['catch'](handleError(_0x15469b,null));};exports[_0xa673('0x2b')]=function(_0x45be4e,_0x2673b5){return db[_0xa673('0x47')][_0xa673('0x4f')]({'where':{'id':_0x45be4e[_0xa673('0x4d')]['id']}})[_0xa673('0x2a')](handleEntityNotFound(_0x2673b5,null))[_0xa673('0x2a')](removeEntity(_0x2673b5,null))[_0xa673('0x4b')](handleError(_0x2673b5,null));};exports[_0xa673('0x52')]=function(_0x218887,_0x59b97b){return db[_0xa673('0x47')][_0xa673('0x52')]()[_0xa673('0x2a')](respondWithResult(_0x59b97b,null))['catch'](handleError(_0x59b97b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2fb8086..158e801 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 _0x32bc=['bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x32bc,0x183));var _0xc32b=function(_0x474ca9,_0x11a63b){_0x474ca9=_0x474ca9-0x0;var _0x221fd6=_0x32bc[_0x474ca9];return _0x221fd6;};'use strict';var _=require(_0xc32b('0x0'));var util=require(_0xc32b('0x1'));var logger=require(_0xc32b('0x2'))(_0xc32b('0x3'));var moment=require(_0xc32b('0x4'));var BPromise=require(_0xc32b('0x5'));var rp=require(_0xc32b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc32b('0x7'));var config=require(_0xc32b('0x8'));var attributes=require(_0xc32b('0x9'));module[_0xc32b('0xa')]=function(_0x3ac599,_0x578262){return _0x3ac599[_0xc32b('0xb')](_0xc32b('0xc'),attributes,{'tableName':_0xc32b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x644a=['rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','path'];(function(_0x128f3a,_0x4d9402){var _0xe7c692=function(_0x8f8048){while(--_0x8f8048){_0x128f3a['push'](_0x128f3a['shift']());}};_0xe7c692(++_0x4d9402);}(_0x644a,0x123));var _0xa644=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0x644a[_0x3fafb9];return _0xada4d4;};'use strict';var _=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var logger=require('../../config/logger')(_0xa644('0x2'));var moment=require(_0xa644('0x3'));var BPromise=require(_0xa644('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa644('0x5'));var rimraf=require(_0xa644('0x6'));var config=require('../../config/environment');var attributes=require(_0xa644('0x7'));module[_0xa644('0x8')]=function(_0x106d4d,_0x3f3cba){return _0x106d4d['define'](_0xa644('0x9'),attributes,{'tableName':_0xa644('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b56df19..e79ac9b 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 _0x3412=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateVoiceTransferReport','create','body','raw','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x3412,0x88));var _0x2341=function(_0x29d5ce,_0x1503e9){_0x29d5ce=_0x29d5ce-0x0;var _0x266f7b=_0x3412[_0x29d5ce];return _0x266f7b;};'use strict';var _=require(_0x2341('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2341('0x1'));var rs=require(_0x2341('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2341('0x3'))(_0x2341('0x4'));var config=require(_0x2341('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2341('0x6')][_0x2341('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6db08d,_0x2ffda8,_0x3ee9d1){return new BPromise(function(_0x552971,_0xbfe63e){return client[_0x2341('0x8')](_0x6db08d,_0x3ee9d1)[_0x2341('0x9')](function(_0x5e7905){logger[_0x2341('0xa')](_0x2341('0xb'),_0x2ffda8,_0x2341('0xc'));logger[_0x2341('0xd')](_0x2341('0xe'),_0x2ffda8,_0x2341('0xc'),JSON[_0x2341('0xf')](_0x5e7905));if(_0x5e7905['error']){if(_0x5e7905['error'][_0x2341('0x10')]===0x1f4){logger[_0x2341('0x11')](_0x2341('0xb'),_0x2ffda8,_0x5e7905[_0x2341('0x11')][_0x2341('0x12')]);return _0xbfe63e(_0x5e7905[_0x2341('0x11')]['message']);}logger['error'](_0x2341('0xb'),_0x2ffda8,_0x5e7905[_0x2341('0x11')][_0x2341('0x12')]);return _0x552971(_0x5e7905[_0x2341('0x11')][_0x2341('0x12')]);}else{logger[_0x2341('0xa')](_0x2341('0xb'),_0x2ffda8,'request\x20sent');_0x552971(_0x5e7905[_0x2341('0x13')][_0x2341('0x12')]);}})['catch'](function(_0x308bd8){logger[_0x2341('0x11')](_0x2341('0xb'),_0x2ffda8,_0x308bd8);_0xbfe63e(_0x308bd8);});});}exports[_0x2341('0x14')]=function(_0x301f9d){var _0x243cc9=this;return new Promise(function(_0x5ca719,_0x3a200e){return db['VoiceTransferReport'][_0x2341('0x15')](_0x301f9d[_0x2341('0x16')],{'raw':_0x301f9d['options']?_0x301f9d['options'][_0x2341('0x17')]===undefined?!![]:![]:!![]})[_0x2341('0x9')](function(_0x2192c9){logger['info'](_0x2341('0x14'),_0x301f9d);logger[_0x2341('0xd')](_0x2341('0x14'),_0x301f9d,JSON[_0x2341('0xf')](_0x2192c9));_0x5ca719(_0x2192c9);})['catch'](function(_0x29c2e4){logger['error']('CreateVoiceTransferReport',_0x29c2e4[_0x2341('0x12')],_0x301f9d);_0x3a200e(_0x243cc9[_0x2341('0x11')](0x1f4,_0x29c2e4[_0x2341('0x12')]));});});}; \ No newline at end of file +var _0x5021=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateVoiceTransferReport','create','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3fc45a,_0x32e470){var _0x3096e0=function(_0x2d6a53){while(--_0x2d6a53){_0x3fc45a['push'](_0x3fc45a['shift']());}};_0x3096e0(++_0x32e470);}(_0x5021,0x135));var _0x1502=function(_0x4d0ae5,_0x2546ec){_0x4d0ae5=_0x4d0ae5-0x0;var _0xc26f12=_0x5021[_0x4d0ae5];return _0xc26f12;};'use strict';var _=require(_0x1502('0x0'));var util=require(_0x1502('0x1'));var moment=require('moment');var BPromise=require(_0x1502('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1502('0x3'));var db=require(_0x1502('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1502('0x5'))(_0x1502('0x6'));var config=require(_0x1502('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1502('0x8')][_0x1502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93ceb4,_0x211da6,_0x4c555f){return new BPromise(function(_0x536c4a,_0x395745){return client[_0x1502('0xa')](_0x93ceb4,_0x4c555f)[_0x1502('0xb')](function(_0x417cb9){logger[_0x1502('0xc')](_0x1502('0xd'),_0x211da6,_0x1502('0xe'));logger[_0x1502('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x211da6,_0x1502('0xe'),JSON[_0x1502('0x10')](_0x417cb9));if(_0x417cb9['error']){if(_0x417cb9[_0x1502('0x11')][_0x1502('0x12')]===0x1f4){logger[_0x1502('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);return _0x395745(_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);}logger[_0x1502('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);return _0x536c4a(_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);}else{logger['info'](_0x1502('0xd'),_0x211da6,_0x1502('0xe'));_0x536c4a(_0x417cb9['result']['message']);}})['catch'](function(_0x438e62){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x438e62);_0x395745(_0x438e62);});});}exports[_0x1502('0x14')]=function(_0x552a2c){var _0x10aa31=this;return new Promise(function(_0x6ccdf7,_0x59b0a0){return db['VoiceTransferReport'][_0x1502('0x15')](_0x552a2c['body'],{'raw':_0x552a2c[_0x1502('0x16')]?_0x552a2c[_0x1502('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8c35fa){logger[_0x1502('0xc')](_0x1502('0x14'),_0x552a2c);logger[_0x1502('0xf')](_0x1502('0x14'),_0x552a2c,JSON[_0x1502('0x10')](_0x8c35fa));_0x6ccdf7(_0x8c35fa);})['catch'](function(_0x30efa4){logger[_0x1502('0x11')]('CreateVoiceTransferReport',_0x30efa4[_0x1502('0x13')],_0x552a2c);_0x59b0a0(_0x10aa31[_0x1502('0x11')](0x1f4,_0x30efa4['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d9f5c27..ee8dea5 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 _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x11adac,_0x102240){var _0x50e68f=function(_0x183e4e){while(--_0x183e4e){_0x11adac['push'](_0x11adac['shift']());}};_0x50e68f(++_0x102240);}(_0xe706,0xa3));var _0x6e70=function(_0x54af0d,_0x3e5db0){_0x54af0d=_0x54af0d-0x0;var _0x57b08d=_0xe706[_0x54af0d];return _0x57b08d;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x486398,_0x370d53){var _0x2d4bc5=function(_0x4013f9){while(--_0x4013f9){_0x486398['push'](_0x486398['shift']());}};_0x2d4bc5(++_0x370d53);}(_0xe14d,0x1ee));var _0xde14=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe14d[_0x3826ad];return _0x17b900;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d9892c8..8b096f5 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 _0x98d3=['transfer\x20executed!','path','lodash','../../config/environment','bluebird','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','request','error','message','catch','User','findOne','agent','then','VoiceChannels','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','webbar:conference','transfer\x20fired:','transferNumber'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x98d3,0x173));var _0x398d=function(_0x96d9d3,_0x58b090){_0x96d9d3=_0x96d9d3-0x0;var _0x151093=_0x98d3[_0x96d9d3];return _0x151093;};'use strict';var path=require(_0x398d('0x0'));var fs=require('fs');var _=require(_0x398d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x398d('0x2'));var util=require('util');var BPromise=require(_0x398d('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x398d('0x4')][_0x398d('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x398d('0x6'));config[_0x398d('0x7')]=_[_0x398d('0x8')](config['redis'],{'host':_0x398d('0x9'),'port':0x18eb});var io=require(_0x398d('0xa'))(new Redis(config[_0x398d('0x7')]));var Schema=require(_0x398d('0xb'));var originateValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0xe')]},'callerId':{'type':_0x398d('0xd')},'callbackUrl':{'type':_0x398d('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x10')]},'transferNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});function emit(_0x278004,_0x4099a5,_0x3ff03c){logger[_0x398d('0x12')](_0x278004,_0x4099a5,JSON['stringify'](_0x3ff03c));io['to'](_0x278004)[_0x398d('0x13')](_0x4099a5,_0x3ff03c);}function handleError(_0x54e717){return function(_0x673840){console[_0x398d('0x14')](_0x398d('0x15'),_0x673840,_0x673840 instanceof RangeError);logger['error'](_0x673840['stack']);if(_0x673840 instanceof RangeError){if(_0x673840['name']){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x194)[_0x398d('0x18')](_0x673840);}else{if(_0x673840[_0x398d('0x16')]){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x1f4)[_0x398d('0x18')](_0x673840);}};}function checkError(){return function(_0x552411){if(!_0x552411){throw new RangeError('NotFound');}return _0x552411;};}function respondWithRpcPromise(_0x5e667d,_0x16e580){return new BPromise(function(_0x3b275a,_0x1ea5f9){var _0x2affed=amiClient;return _0x2affed[_0x398d('0x19')](_0x5e667d,_0x16e580)['then'](function(_0x5c4c70){if(_0x5c4c70[_0x398d('0x1a')]){if(_0x5c4c70[_0x398d('0x1a')]['code']===0x1f4){return _0x1ea5f9(_0x5c4c70[_0x398d('0x1a')][_0x398d('0x1b')]);}return _0x3b275a(_0x5c4c70['error']['message']);}else{_0x3b275a(_0x5c4c70['result']);}})[_0x398d('0x1c')](function(_0x2cc4ef){_0x1ea5f9(_0x2cc4ef);});});}function getAgent(_0x24fa2c){return db[_0x398d('0x1d')][_0x398d('0x1e')]({'where':{'id':_0x24fa2c,'role':_0x398d('0x1f')}})[_0x398d('0x20')](checkError());}function getAgentCheckSession(_0x17318c,_0x4f4466){return new BPromise(function(_0x35bd19,_0x557dce){var _0x4aa568=respondWithRpcPromise(_0x398d('0x21'));var _0x27bc6e=getAgent(_0x17318c);Promise['all']([_0x4aa568,_0x27bc6e])[_0x398d('0x20')](function(_0x558249){var _0x3ae172=_0x558249[0x0];var _0x8abf30=_0x558249[0x1];var _0x582d16=_['filter'](_0x3ae172[_0x398d('0x22')],function(_0x2ca780){return _0x2ca780['UserId']==_0x8abf30['id']&&_0x2ca780[_0x398d('0x23')]==_0x4f4466;});if(_0x582d16[_0x398d('0x24')]==0x1){_0x35bd19(_0x8abf30);}else{_0x557dce(new RangeError(_0x398d('0x25')+_0x4f4466+_0x398d('0x26')));}});});}exports[_0x398d('0x27')]=function(_0x3bcc5e,_0x490bee){logger['info'](_0x398d('0x28'),_0x3bcc5e[_0x398d('0x29')]);var _0x45f1a3=originateValidation[_0x398d('0xb')](_0x3bcc5e[_0x398d('0x29')]);if(_0x45f1a3[_0x398d('0x24')]>0x0){return _0x490bee[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x45f1a3);}var _0x1827be=_0x3bcc5e['body'][_0x398d('0x2b')];var _0x3807f0=_0x3bcc5e[_0x398d('0x29')]['callNumber'];var _0x5be779=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2c')];var _0x3fb8ff=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2d')];return getAgent(_0x1827be)[_0x398d('0x20')](function(_0x324d76){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x324d76[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x324d76[_0x398d('0x16')]),_0x398d('0x31'),{'callNumber':_0x3807f0,'callerId':_0x5be779,'callbackUrl':_0x3fb8ff});return _0x490bee[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x32')});})[_0x398d('0x1c')](handleError(_0x490bee));};exports[_0x398d('0x33')]=function(_0x5ae43b,_0x244512){logger[_0x398d('0x12')](_0x398d('0x34'),_0x5ae43b[_0x398d('0x29')]);var _0x209c2b=hangupValidation[_0x398d('0xb')](_0x5ae43b[_0x398d('0x29')]);if(_0x209c2b['length']>0x0){return _0x244512[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x209c2b);}var _0x165d26=_0x5ae43b[_0x398d('0x29')][_0x398d('0x2b')];var _0x219651=_0x5ae43b[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x165d26)['then'](function(_0x208eb2){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x208eb2[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x208eb2[_0x398d('0x16')]),_0x398d('0x35'),{'sessionId':_0x219651});return _0x244512['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x36')});})[_0x398d('0x1c')](handleError(_0x244512));};exports[_0x398d('0x37')]=function(_0x217fc0,_0x30ac4d){logger[_0x398d('0x12')](_0x398d('0x38'),_0x217fc0[_0x398d('0x29')]);var _0x5d7d33=answerValidation[_0x398d('0xb')](_0x217fc0[_0x398d('0x29')]);if(_0x5d7d33[_0x398d('0x24')]>0x0){return _0x30ac4d[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x5d7d33);}var _0x227984=_0x217fc0['body'][_0x398d('0x2b')];var _0x1a6bdc=_0x217fc0['body'][_0x398d('0x23')];return getAgent(_0x227984)[_0x398d('0x20')](function(_0x2f419f){logger['info'](_0x398d('0x2e'),_0x2f419f[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x2f419f[_0x398d('0x16')]),'webbar:answer',{'sessionId':_0x1a6bdc});return _0x30ac4d[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x39')});})['catch'](handleError(_0x30ac4d));};exports[_0x398d('0x3a')]=function(_0x3f9fb2,_0x578a0f){logger[_0x398d('0x12')](_0x398d('0x3b'),_0x3f9fb2[_0x398d('0x29')]);var _0x1f67a9=holdValidation[_0x398d('0xb')](_0x3f9fb2[_0x398d('0x29')]);if(_0x1f67a9[_0x398d('0x24')]>0x0){return _0x578a0f[_0x398d('0x17')](0x190)['json'](_0x1f67a9);}var _0x34c0fc=_0x3f9fb2[_0x398d('0x29')]['userId'];var _0x5f4aef=_0x3f9fb2[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x34c0fc)[_0x398d('0x20')](function(_0x35d260){logger['info'](_0x398d('0x2e'),_0x35d260['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x35d260[_0x398d('0x16')]),'webbar:hold',{'sessionId':_0x5f4aef});return _0x578a0f['status'](0xc8)['json']({'error':![],'message':_0x398d('0x3c')});})[_0x398d('0x1c')](handleError(_0x578a0f));};exports[_0x398d('0x3d')]=function(_0x3fa030,_0x578784){logger['info'](_0x398d('0x3e'),_0x3fa030[_0x398d('0x29')]);var _0x1615ee=unholdValidation['validate'](_0x3fa030[_0x398d('0x29')]);if(_0x1615ee[_0x398d('0x24')]>0x0){return _0x578784[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x1615ee);}var _0x20c488=_0x3fa030[_0x398d('0x29')]['userId'];var _0x158828=_0x3fa030[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x20c488)[_0x398d('0x20')](function(_0x499f2e){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x499f2e[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x499f2e['name']),_0x398d('0x3f'),{'sessionId':_0x158828});return _0x578784['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x40')});})['catch'](handleError(_0x578784));};exports[_0x398d('0x41')]=function(_0x5109e7,_0x2eac8c){logger[_0x398d('0x12')](_0x398d('0x42'),_0x2eac8c[_0x398d('0x29')]);var _0x360e67=callsValidation[_0x398d('0xb')](_0x5109e7[_0x398d('0x29')]);if(_0x360e67[_0x398d('0x24')]>0x0){return _0x2eac8c[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x360e67);}var _0x179862=_0x5109e7[_0x398d('0x29')][_0x398d('0x2b')];var _0x783c74=respondWithRpcPromise(_0x398d('0x21'));var _0x3f3108=getAgent(_0x179862);return Promise[_0x398d('0x43')]([_0x783c74,_0x3f3108])[_0x398d('0x20')](function(_0x4717cf){var _0xb25709=_0x4717cf[0x0];var _0x7f4acb=_0x4717cf[0x1];var _0xcd2b9d=_['filter'](_0xb25709[_0x398d('0x22')],function(_0x26d6f8){return _0x26d6f8[_0x398d('0x44')]==_0x7f4acb['id'];});return _0x2eac8c[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'count':_0xcd2b9d[_0x398d('0x24')],'rows':_0xcd2b9d});})[_0x398d('0x1c')](handleError(_0x2eac8c));};exports[_0x398d('0x45')]=function(_0xe6cf33,_0x9c3971){logger[_0x398d('0x12')]('conference\x20fired:',_0xe6cf33[_0x398d('0x29')]);var _0x207fd6=conferenceValidation['validate'](_0xe6cf33[_0x398d('0x29')]);if(_0x207fd6['length']>0x0){return _0x9c3971['status'](0x190)['json'](_0x207fd6);}var _0x37646f=_0xe6cf33[_0x398d('0x29')]['userId'];return getAgent(_0x37646f)[_0x398d('0x20')](function(_0x278262){logger[_0x398d('0x12')]('entityFound:',_0x278262[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x278262['name']),_0x398d('0x46'));return _0x9c3971['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x398d('0x1c')](handleError(_0x9c3971));};exports['transfer']=function(_0x35c204,_0x1b5929){logger[_0x398d('0x12')](_0x398d('0x47'),_0x35c204[_0x398d('0x29')]);var _0x56e3f6=transferValidation[_0x398d('0xb')](_0x35c204[_0x398d('0x29')]);if(_0x56e3f6[_0x398d('0x24')]>0x0){return _0x1b5929[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x56e3f6);}var _0x12d76f=_0x35c204[_0x398d('0x29')]['userId'];var _0x227661=_0x35c204[_0x398d('0x29')][_0x398d('0x23')];var _0x5085f4=_0x35c204['body'][_0x398d('0x48')];return getAgent(_0x12d76f)[_0x398d('0x20')](function(_0x540121){logger['info'](_0x398d('0x2e'),_0x540121['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x540121[_0x398d('0x16')]),'webbar:transfer',{'sessionId':_0x227661,'transferNumber':_0x5085f4});return _0x1b5929['status'](0xc8)['json']({'error':![],'message':_0x398d('0x49')});})[_0x398d('0x1c')](handleError(_0x1b5929));}; \ No newline at end of file +var _0xe600=['redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','format','user:%s','catch','hangup\x20fired:','userId','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','all','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x3b375e,_0x565734){var _0x55419f=function(_0x56dd1e){while(--_0x56dd1e){_0x3b375e['push'](_0x3b375e['shift']());}};_0x55419f(++_0x565734);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0e60('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0e60('0x1'));var util=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var jayson=require(_0x0e60('0x4'));var amiClient=jayson[_0x0e60('0x5')][_0x0e60('0x6')]({'port':0x232a});var logger=require(_0x0e60('0x7'))(_0x0e60('0x8'));var Redis=require(_0x0e60('0x9'));config[_0x0e60('0xa')]=_['defaults'](config[_0x0e60('0xa')],{'host':_0x0e60('0xb'),'port':0x18eb});var io=require(_0x0e60('0xc'))(new Redis(config[_0x0e60('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'callNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x10')]},'callerId':{'type':_0x0e60('0xf')},'callbackUrl':{'type':_0x0e60('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]}});function emit(_0x5ab4ba,_0x2a8b5a,_0x3f2d13){logger[_0x0e60('0x12')](_0x5ab4ba,_0x2a8b5a,JSON[_0x0e60('0x13')](_0x3f2d13));io['to'](_0x5ab4ba)[_0x0e60('0x14')](_0x2a8b5a,_0x3f2d13);}function handleError(_0x4ed292){return function(_0x992490){console[_0x0e60('0x15')]('handleError:',_0x992490,_0x992490 instanceof RangeError);logger[_0x0e60('0x16')](_0x992490[_0x0e60('0x17')]);if(_0x992490 instanceof RangeError){if(_0x992490[_0x0e60('0x18')]){delete _0x992490['name'];}_0x4ed292[_0x0e60('0x19')](0x194)['send'](_0x992490);}else{if(_0x992490[_0x0e60('0x18')]){delete _0x992490[_0x0e60('0x18')];}_0x4ed292[_0x0e60('0x19')](0x1f4)[_0x0e60('0x1a')](_0x992490);}};}function checkError(){return function(_0x329620){if(!_0x329620){throw new RangeError(_0x0e60('0x1b'));}return _0x329620;};}function respondWithRpcPromise(_0x38f677,_0x2ed72f){return new BPromise(function(_0x352633,_0x10f875){var _0x22c0e0=amiClient;return _0x22c0e0[_0x0e60('0x1c')](_0x38f677,_0x2ed72f)[_0x0e60('0x1d')](function(_0x16985f){if(_0x16985f[_0x0e60('0x16')]){if(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1e')]===0x1f4){return _0x10f875(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1f')]);}return _0x352633(_0x16985f['error'][_0x0e60('0x1f')]);}else{_0x352633(_0x16985f[_0x0e60('0x20')]);}})['catch'](function(_0x10451f){_0x10f875(_0x10451f);});});}function getAgent(_0x5ddd18){return db[_0x0e60('0x21')]['findOne']({'where':{'id':_0x5ddd18,'role':'agent'}})[_0x0e60('0x1d')](checkError());}function getAgentCheckSession(_0x39dae2,_0x526aaa){return new BPromise(function(_0x4eb9b8,_0x3ca649){var _0x54d7ce=respondWithRpcPromise(_0x0e60('0x22'));var _0x548919=getAgent(_0x39dae2);Promise['all']([_0x54d7ce,_0x548919])[_0x0e60('0x1d')](function(_0x3d3c13){var _0x2a282d=_0x3d3c13[0x0];var _0x4d9b18=_0x3d3c13[0x1];var _0x473813=_['filter'](_0x2a282d[_0x0e60('0x23')],function(_0x1d54c0){return _0x1d54c0[_0x0e60('0x24')]==_0x4d9b18['id']&&_0x1d54c0['sessionId']==_0x526aaa;});if(_0x473813[_0x0e60('0x25')]==0x1){_0x4eb9b8(_0x4d9b18);}else{_0x3ca649(new RangeError(_0x0e60('0x26')+_0x526aaa+_0x0e60('0x27')));}});});}exports['originate']=function(_0x17e210,_0x3ea4ac){logger[_0x0e60('0x12')](_0x0e60('0x28'),_0x17e210[_0x0e60('0x29')]);var _0x588e9d=originateValidation[_0x0e60('0x2a')](_0x17e210['body']);if(_0x588e9d[_0x0e60('0x25')]>0x0){return _0x3ea4ac['status'](0x190)[_0x0e60('0x2b')](_0x588e9d);}var _0x2388a7=_0x17e210[_0x0e60('0x29')]['userId'];var _0xf29971=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2c')];var _0x81a892=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2d')];var _0x9302fe=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2e')];return getAgent(_0x2388a7)[_0x0e60('0x1d')](function(_0x2533a9){logger[_0x0e60('0x12')]('entityFound:',_0x2533a9[_0x0e60('0x18')]);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x2533a9[_0x0e60('0x18')]),'webbar:originate',{'callNumber':_0xf29971,'callerId':_0x81a892,'callbackUrl':_0x9302fe});return _0x3ea4ac['status'](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x0e60('0x31')](handleError(_0x3ea4ac));};exports['hangup']=function(_0x4582b8,_0x44db32){logger[_0x0e60('0x12')](_0x0e60('0x32'),_0x4582b8[_0x0e60('0x29')]);var _0x25761d=hangupValidation[_0x0e60('0x2a')](_0x4582b8[_0x0e60('0x29')]);if(_0x25761d[_0x0e60('0x25')]>0x0){return _0x44db32[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x25761d);}var _0x3becf9=_0x4582b8['body'][_0x0e60('0x33')];var _0x56ce38=_0x4582b8[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x3becf9)['then'](function(_0x482583){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x482583['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x482583['name']),_0x0e60('0x36'),{'sessionId':_0x56ce38});return _0x44db32[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x37')});})[_0x0e60('0x31')](handleError(_0x44db32));};exports[_0x0e60('0x38')]=function(_0x8244f,_0x233743){logger[_0x0e60('0x12')]('answer\x20fired:',_0x8244f['body']);var _0x535c06=answerValidation[_0x0e60('0x2a')](_0x8244f['body']);if(_0x535c06[_0x0e60('0x25')]>0x0){return _0x233743[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x535c06);}var _0x4bfebf=_0x8244f[_0x0e60('0x29')][_0x0e60('0x33')];var _0x4ce029=_0x8244f['body'][_0x0e60('0x34')];return getAgent(_0x4bfebf)[_0x0e60('0x1d')](function(_0xd4f785){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0xd4f785[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0xd4f785[_0x0e60('0x18')]),_0x0e60('0x39'),{'sessionId':_0x4ce029});return _0x233743[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x233743));};exports['hold']=function(_0x36f90e,_0x449f38){logger[_0x0e60('0x12')](_0x0e60('0x3a'),_0x36f90e['body']);var _0x5b9cf6=holdValidation['validate'](_0x36f90e[_0x0e60('0x29')]);if(_0x5b9cf6[_0x0e60('0x25')]>0x0){return _0x449f38[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x5b9cf6);}var _0x8777f4=_0x36f90e['body']['userId'];var _0x3c3ab7=_0x36f90e[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x8777f4)[_0x0e60('0x1d')](function(_0x4ad156){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x4ad156[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x4ad156[_0x0e60('0x18')]),'webbar:hold',{'sessionId':_0x3c3ab7});return _0x449f38[_0x0e60('0x19')](0xc8)['json']({'error':![],'message':_0x0e60('0x3b')});})[_0x0e60('0x31')](handleError(_0x449f38));};exports[_0x0e60('0x3c')]=function(_0x2e887c,_0x477a99){logger['info'](_0x0e60('0x3d'),_0x2e887c[_0x0e60('0x29')]);var _0x103c30=unholdValidation[_0x0e60('0x2a')](_0x2e887c['body']);if(_0x103c30[_0x0e60('0x25')]>0x0){return _0x477a99[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x103c30);}var _0x2d7403=_0x2e887c['body'][_0x0e60('0x33')];var _0x4c6f07=_0x2e887c[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x2d7403)[_0x0e60('0x1d')](function(_0x9e4340){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x9e4340[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x9e4340['name']),_0x0e60('0x3e'),{'sessionId':_0x4c6f07});return _0x477a99[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x3f')});})['catch'](handleError(_0x477a99));};exports['calls']=function(_0x3282b8,_0x5a6c01){logger[_0x0e60('0x12')](_0x0e60('0x40'),_0x5a6c01[_0x0e60('0x29')]);var _0x24ada9=callsValidation[_0x0e60('0x2a')](_0x3282b8[_0x0e60('0x29')]);if(_0x24ada9[_0x0e60('0x25')]>0x0){return _0x5a6c01[_0x0e60('0x19')](0x190)['json'](_0x24ada9);}var _0x33b560=_0x3282b8[_0x0e60('0x29')][_0x0e60('0x33')];var _0x1249b2=respondWithRpcPromise(_0x0e60('0x22'));var _0x52ac12=getAgent(_0x33b560);return Promise[_0x0e60('0x41')]([_0x1249b2,_0x52ac12])[_0x0e60('0x1d')](function(_0x3ee5e2){var _0x221608=_0x3ee5e2[0x0];var _0x565eab=_0x3ee5e2[0x1];var _0x88b035=_['filter'](_0x221608[_0x0e60('0x23')],function(_0x37c13c){return _0x37c13c[_0x0e60('0x24')]==_0x565eab['id'];});return _0x5a6c01[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'count':_0x88b035['length'],'rows':_0x88b035});})[_0x0e60('0x31')](handleError(_0x5a6c01));};exports[_0x0e60('0x42')]=function(_0x55d4e7,_0x472ebe){logger['info'](_0x0e60('0x43'),_0x55d4e7[_0x0e60('0x29')]);var _0x5e50ad=conferenceValidation['validate'](_0x55d4e7[_0x0e60('0x29')]);if(_0x5e50ad[_0x0e60('0x25')]>0x0){return _0x472ebe['status'](0x190)['json'](_0x5e50ad);}var _0x33bc63=_0x55d4e7[_0x0e60('0x29')][_0x0e60('0x33')];return getAgent(_0x33bc63)[_0x0e60('0x1d')](function(_0x58fa48){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x58fa48[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x58fa48[_0x0e60('0x18')]),'webbar:conference');return _0x472ebe[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0x0e60('0x31')](handleError(_0x472ebe));};exports[_0x0e60('0x44')]=function(_0x5f383e,_0x5cc420){logger[_0x0e60('0x12')](_0x0e60('0x45'),_0x5f383e[_0x0e60('0x29')]);var _0x234cc5=transferValidation[_0x0e60('0x2a')](_0x5f383e[_0x0e60('0x29')]);if(_0x234cc5[_0x0e60('0x25')]>0x0){return _0x5cc420[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x234cc5);}var _0x2d0c5d=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x33')];var _0x2546f8=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x34')];var _0x200d81=_0x5f383e[_0x0e60('0x29')]['transferNumber'];return getAgent(_0x2d0c5d)['then'](function(_0x1a8efe){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x1a8efe['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x1a8efe['name']),_0x0e60('0x46'),{'sessionId':_0x2546f8,'transferNumber':_0x200d81});return _0x5cc420[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x5cc420));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index abe87f1..9b80adb 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','create','/:id/dispositions','post','addAnswer','addAgents','addApplications','notify','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x564e23,_0x28e1d7){var _0x27517b=function(_0x23e6f3){while(--_0x23e6f3){_0x564e23['push'](_0x564e23['shift']());}};_0x27517b(++_0x28e1d7);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0xb')]('/:id/dispositions',auth[_0x7413('0xe')](),controller[_0x7413('0x11')]);router[_0x7413('0xb')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller['getAnswers']);router[_0x7413('0xb')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x14')]);router[_0x7413('0xb')](_0x7413('0x15'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x7413('0xe')](),controller[_0x7413('0x16')]);router['post'](_0x7413('0x17'),auth[_0x7413('0xe')](),controller['addDisposition']);router[_0x7413('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7413('0x19')]);router['post'](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x1a')]);router[_0x7413('0x18')](_0x7413('0x15'),auth[_0x7413('0xe')](),controller[_0x7413('0x1b')]);router[_0x7413('0x18')]('/:id/notify',controller[_0x7413('0x1c')]);router[_0x7413('0x18')](_0x7413('0x1d'),auth[_0x7413('0xe')](),controller['send']);router[_0x7413('0x1e')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x1f')]);router[_0x7413('0x20')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x21')]);router['delete']('/:id/dispositions',auth[_0x7413('0xe')](),controller['removeDispositions']);router[_0x7413('0x20')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller[_0x7413('0x22')]);router[_0x7413('0x20')](_0x7413('0x13'),auth[_0x7413('0xe')](),controller[_0x7413('0x23')]);module[_0x7413('0x24')]=router; \ No newline at end of file +var _0xd7d1=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','/:id/send','send','put','update'];(function(_0x2a70b2,_0x22ddcc){var _0x72e18d=function(_0x4929ba){while(--_0x4929ba){_0x2a70b2['push'](_0x2a70b2['shift']());}};_0x72e18d(++_0x22ddcc);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x496a1d,_0x294ee6){_0x496a1d=_0x496a1d-0x0;var _0x485f92=_0xd7d1[_0x496a1d];return _0x485f92;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getDispositions']);router[_0x1d7d('0xb')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0xb')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x14')]);router['get']('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d7d('0x16')]);router[_0x1d7d('0x17')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x18')]);router['post'](_0x1d7d('0x19'),auth[_0x1d7d('0xc')](),controller['addAnswer']);router[_0x1d7d('0x17')](_0x1d7d('0x13'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1a')]);router[_0x1d7d('0x17')]('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1b')]);router['post']('/:id/notify',controller[_0x1d7d('0x1c')]);router[_0x1d7d('0x17')](_0x1d7d('0x1d'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1e')]);router[_0x1d7d('0x1f')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x20')]);router[_0x1d7d('0x21')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x22')]);router['delete']('/:id/dispositions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x23')]);router[_0x1d7d('0x21')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x24')]);router[_0x1d7d('0x21')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x25')]);module[_0x1d7d('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 1480a3b..1b8a75d 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 _0xdec5=['name','ENUM','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x3ec6a5,_0x31dfaa){var _0x47b5a0=function(_0x2ff1ca){while(--_0x2ff1ca){_0x3ec6a5['push'](_0x3ec6a5['shift']());}};_0x47b5a0(++_0x31dfaa);}(_0xdec5,0x7a));var _0x5dec=function(_0x1cca82,_0x5e1d82){_0x1cca82=_0x1cca82-0x0;var _0x5e1f45=_0xdec5[_0x1cca82];return _0x5e1f45;};'use strict';var Sequelize=require(_0x5dec('0x0'));var rs=require(_0x5dec('0x1'));module[_0x5dec('0x2')]={'name':{'type':Sequelize[_0x5dec('0x3')],'unique':_0x5dec('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5dec('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5dec('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5dec('0x3')]},'type':{'type':Sequelize[_0x5dec('0x5')]('twilio',_0x5dec('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5dec('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5dec('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5dec('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5dec('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5dec('0x9')],'comment':_0x5dec('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5dec('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x10d4ab){if(!_0x10d4ab){this[_0x5dec('0xb')](_0x5dec('0xc'),null);}this[_0x5dec('0xb')](_0x5dec('0xd'),_0x10d4ab);}},'description':{'type':Sequelize[_0x5dec('0x3')]}}; \ No newline at end of file +var _0x24eb=['setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','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','mandatoryDispositionPauseId'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x24eb,0x13d));var _0xb24e=function(_0x5b3a35,_0x312e9b){_0x5b3a35=_0x5b3a35-0x0;var _0x4383df=_0x24eb[_0x5b3a35];return _0x4383df;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb24e('0x0'));module[_0xb24e('0x1')]={'name':{'type':Sequelize[_0xb24e('0x2')],'unique':_0xb24e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb24e('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb24e('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb24e('0x4')](_0xb24e('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0xb24e('0x2')]},'baseUrl':{'type':Sequelize[_0xb24e('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb24e('0x6')],'defaultValue':function(){return _0xb24e('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb24e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb24e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb24e('0x9')],'comment':_0xb24e('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb24e('0xb'),'set':function(_0x3b7e50){if(!_0x3b7e50){this['setDataValue'](_0xb24e('0xc'),null);}this[_0xb24e('0xd')](_0xb24e('0xe'),_0x3b7e50);}},'description':{'type':Sequelize[_0xb24e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index aba557f..de02b7f 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 _0xcdd3=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','status','offset','undefined','count','limit','json','reject','save','UserProfileResource','destroy','end','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','findAll','removeDispositions','addAnswer','WhatsappAccountId','CannedAnswer','removeAnswers','addAgents','ids','omit','spread','emit','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','finally','sendStatus','send','getApplications','whatsapp','Applications','account','statuses','state','read','update','timestamp','message_id','applications','priority','asc','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','defaults','contact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','Messages','dataValues','push'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcdd3,0x17e));var _0x3cdd=function(_0x24e11a,_0x516f69){_0x24e11a=_0x24e11a-0x0;var _0x4901a6=_0xcdd3[_0x24e11a];return _0x4901a6;};'use strict';var emlformat=require(_0x3cdd('0x0'));var rimraf=require(_0x3cdd('0x1'));var zipdir=require(_0x3cdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3cdd('0x3'));var BPromise=require(_0x3cdd('0x4'));var Mustache=require(_0x3cdd('0x5'));var util=require(_0x3cdd('0x6'));var path=require(_0x3cdd('0x7'));var sox=require('sox');var csv=require(_0x3cdd('0x8'));var ejs=require(_0x3cdd('0x9'));var fs=require('fs');var fs_extra=require(_0x3cdd('0xa'));var _=require('lodash');var squel=require(_0x3cdd('0xb'));var crypto=require(_0x3cdd('0xc'));var jsforce=require(_0x3cdd('0xd'));var deskjs=require(_0x3cdd('0xe'));var toCsv=require(_0x3cdd('0x8'));var querystring=require(_0x3cdd('0xf'));var Papa=require(_0x3cdd('0x10'));var Redis=require('ioredis');var authService=require(_0x3cdd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cdd('0x12'))(_0x3cdd('0x13'));var utils=require('../../config/utils');var config=require(_0x3cdd('0x14'));var licenseUtil=require(_0x3cdd('0x15'));var db=require(_0x3cdd('0x16'))['db'];config['redis']=_['defaults'](config[_0x3cdd('0x17')],{'host':_0x3cdd('0x18'),'port':0x18eb});var socket=require(_0x3cdd('0x19'))(new Redis(config[_0x3cdd('0x17')]));require(_0x3cdd('0x1a'))[_0x3cdd('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3cdd('0x1c')][_0x3cdd('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5d3e5d,_0x39b3eb,_0x1bf832,_0x207736){return new BPromise(function(_0x18ec35,_0x1b80bd){var _0x76c2ab=_0x207736||client;return _0x76c2ab[_0x3cdd('0x1e')](_0x5d3e5d,_0x1bf832)[_0x3cdd('0x1f')](function(_0x4445f2){logger[_0x3cdd('0x20')](_0x3cdd('0x21'),_0x39b3eb,_0x3cdd('0x22'));logger[_0x3cdd('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39b3eb,_0x3cdd('0x22'),JSON['stringify'](_0x4445f2));if(_0x4445f2['error']){if(_0x4445f2['error'][_0x3cdd('0x24')]===0x1f4){logger[_0x3cdd('0x25')](_0x3cdd('0x21'),_0x39b3eb,_0x4445f2['error'][_0x3cdd('0x26')]);return _0x1b80bd(_0x4445f2[_0x3cdd('0x25')][_0x3cdd('0x26')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x39b3eb,_0x4445f2['error'][_0x3cdd('0x26')]);return _0x18ec35(_0x4445f2['error']['message']);}else{logger[_0x3cdd('0x20')](_0x3cdd('0x21'),_0x39b3eb,_0x3cdd('0x22'));_0x18ec35(_0x4445f2[_0x3cdd('0x27')][_0x3cdd('0x26')]);}})[_0x3cdd('0x28')](function(_0x46bc9b){logger[_0x3cdd('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x39b3eb,_0x46bc9b);_0x1b80bd(_0x46bc9b);});});}function respondWithStatusCode(_0x1a930d,_0x4b6adc){_0x4b6adc=_0x4b6adc||0xcc;return function(_0x2be6d8){if(_0x2be6d8){return _0x1a930d['sendStatus'](_0x4b6adc);}return _0x1a930d[_0x3cdd('0x29')](_0x4b6adc)['end']();};}function respondWithResult(_0x7589b8,_0x264656){_0x264656=_0x264656||0xc8;return function(_0x39095){if(_0x39095){return _0x7589b8[_0x3cdd('0x29')](_0x264656)['json'](_0x39095);}};}function respondWithFilteredResult(_0x2fce45,_0x10bb4c){return function(_0x5352d4){if(_0x5352d4){var _0xf494e6=typeof _0x10bb4c[_0x3cdd('0x2a')]===_0x3cdd('0x2b')&&typeof _0x10bb4c['limit']==='undefined';var _0x13da33=_0x5352d4[_0x3cdd('0x2c')];var _0x20f227=_0xf494e6?0x0:_0x10bb4c[_0x3cdd('0x2a')];var _0x5a4bb9=_0xf494e6?_0x5352d4[_0x3cdd('0x2c')]:_0x10bb4c['offset']+_0x10bb4c[_0x3cdd('0x2d')];var _0x21cbd6;if(_0x5a4bb9>=_0x13da33){_0x5a4bb9=_0x13da33;_0x21cbd6=0xc8;}else{_0x21cbd6=0xce;}_0x2fce45[_0x3cdd('0x29')](_0x21cbd6);return _0x2fce45['set']('Content-Range',_0x20f227+'-'+_0x5a4bb9+'/'+_0x13da33)[_0x3cdd('0x2e')](_0x5352d4);}return null;};}function patchUpdates(_0x35e866){return function(_0x13e956){try{jsonpatch['apply'](_0x13e956,_0x35e866,!![]);}catch(_0x512f1a){return BPromise[_0x3cdd('0x2f')](_0x512f1a);}return _0x13e956[_0x3cdd('0x30')]();};}function saveUpdates(_0x3c9a00,_0x507280){return function(_0xa94dfa){if(_0xa94dfa){return _0xa94dfa['update'](_0x3c9a00)[_0x3cdd('0x1f')](function(_0x1a0c28){return _0x1a0c28;});}return null;};}function removeEntity(_0x259398,_0x219ac2){return function(_0x5bffc3){if(_0x5bffc3){return _0x5bffc3['destroy']()[_0x3cdd('0x1f')](function(){var _0x57f1eb=_0x5bffc3['get']({'plain':!![]});var _0x5d0190='WhatsappAccounts';return db[_0x3cdd('0x31')][_0x3cdd('0x32')]({'where':{'type':_0x5d0190,'resourceId':_0x57f1eb['id']}})['then'](function(){return _0x5bffc3;});})[_0x3cdd('0x1f')](function(){_0x259398[_0x3cdd('0x29')](0xcc)[_0x3cdd('0x33')]();});}};}function handleEntityNotFound(_0x22a6bb,_0x5509d7){return function(_0x2feac5){if(!_0x2feac5){_0x22a6bb['sendStatus'](0x194);}return _0x2feac5;};}function handleError(_0x13f28f,_0xc185a){_0xc185a=_0xc185a||0x1f4;return function(_0x1a4123){logger[_0x3cdd('0x25')](_0x1a4123[_0x3cdd('0x34')]);if(_0x1a4123[_0x3cdd('0x35')]){delete _0x1a4123[_0x3cdd('0x35')];}_0x13f28f[_0x3cdd('0x29')](_0xc185a)['send'](_0x1a4123);};}exports[_0x3cdd('0x36')]=function(_0xacc16f,_0x388b05){var _0x4fe370={'include':[{'model':db[_0x3cdd('0x37')],'as':_0x3cdd('0x38')}]},_0x24835f={},_0x4fa9e5={'count':0x0,'rows':[]};var _0x53eb6c=_['map'](db[_0x3cdd('0x39')]['rawAttributes'],function(_0x4fc169){return{'name':_0x4fc169[_0x3cdd('0x3a')],'type':_0x4fc169[_0x3cdd('0x3b')][_0x3cdd('0x3c')]};});_0x24835f[_0x3cdd('0x3d')]=_[_0x3cdd('0x3e')](_0x53eb6c,_0x3cdd('0x35'));_0x24835f[_0x3cdd('0x3f')]=_[_0x3cdd('0x40')](_0xacc16f['query']);_0x24835f[_0x3cdd('0x41')]=_[_0x3cdd('0x42')](_0x24835f[_0x3cdd('0x3d')],_0x24835f['query']);_0x4fe370[_0x3cdd('0x43')]=_[_0x3cdd('0x42')](_0x24835f[_0x3cdd('0x3d')],qs[_0x3cdd('0x44')](_0xacc16f[_0x3cdd('0x3f')]['fields']));_0x4fe370[_0x3cdd('0x43')]=_0x4fe370['attributes']['length']?_0x4fe370[_0x3cdd('0x43')]:_0x24835f[_0x3cdd('0x3d')];if(!_0xacc16f[_0x3cdd('0x3f')][_0x3cdd('0x45')](_0x3cdd('0x46'))){_0x4fe370[_0x3cdd('0x2d')]=qs[_0x3cdd('0x2d')](_0xacc16f[_0x3cdd('0x3f')][_0x3cdd('0x2d')]);_0x4fe370[_0x3cdd('0x2a')]=qs[_0x3cdd('0x2a')](_0xacc16f['query'][_0x3cdd('0x2a')]);}_0x4fe370[_0x3cdd('0x47')]=qs[_0x3cdd('0x48')](_0xacc16f['query'][_0x3cdd('0x48')]);_0x4fe370[_0x3cdd('0x49')]=qs[_0x3cdd('0x41')](_[_0x3cdd('0x4a')](_0xacc16f['query'],_0x24835f['filters']),_0x53eb6c);if(_0xacc16f[_0x3cdd('0x3f')][_0x3cdd('0x4b')]){_0x4fe370[_0x3cdd('0x49')]=_[_0x3cdd('0x4c')](_0x4fe370[_0x3cdd('0x49')],{'$or':_[_0x3cdd('0x3e')](_0x53eb6c,function(_0x513b2c){if(_0x513b2c[_0x3cdd('0x3b')]!==_0x3cdd('0x4d')){var _0x81e96d={};_0x81e96d[_0x513b2c[_0x3cdd('0x35')]]={'$like':'%'+_0xacc16f['query']['filter']+'%'};return _0x81e96d;}})});}_0x4fe370=_[_0x3cdd('0x4c')]({},_0x4fe370,_0xacc16f[_0x3cdd('0x4e')]);var _0x1f3c94={'where':_0x4fe370[_0x3cdd('0x49')]};return db[_0x3cdd('0x39')]['count'](_0x1f3c94)[_0x3cdd('0x1f')](function(_0x244279){_0x4fa9e5['count']=_0x244279;if(_0xacc16f[_0x3cdd('0x3f')][_0x3cdd('0x4f')]){_0x4fe370[_0x3cdd('0x50')]=[{'all':!![]}];}return db[_0x3cdd('0x39')]['findAll'](_0x4fe370);})[_0x3cdd('0x1f')](function(_0x291399){_0x4fa9e5[_0x3cdd('0x51')]=_0x291399;return _0x4fa9e5;})[_0x3cdd('0x1f')](respondWithFilteredResult(_0x388b05,_0x4fe370))[_0x3cdd('0x28')](handleError(_0x388b05,null));};exports[_0x3cdd('0x52')]=function(_0x488936,_0x69bd04){var _0x272b40={'raw':![],'where':{'id':_0x488936[_0x3cdd('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x3cdd('0x38')}]},_0x381470={};_0x381470['model']=_['keys'](db[_0x3cdd('0x39')]['rawAttributes']);_0x381470[_0x3cdd('0x3f')]=_['keys'](_0x488936[_0x3cdd('0x3f')]);_0x381470['filters']=_['intersection'](_0x381470[_0x3cdd('0x3d')],_0x381470[_0x3cdd('0x3f')]);_0x272b40[_0x3cdd('0x43')]=_[_0x3cdd('0x42')](_0x381470[_0x3cdd('0x3d')],qs[_0x3cdd('0x44')](_0x488936[_0x3cdd('0x3f')]['fields']));_0x272b40[_0x3cdd('0x43')]=_0x272b40[_0x3cdd('0x43')][_0x3cdd('0x54')]?_0x272b40['attributes']:_0x381470[_0x3cdd('0x3d')];if(_0x488936[_0x3cdd('0x3f')]['includeAll']){_0x272b40['include']=[{'all':!![]}];}_0x272b40=_[_0x3cdd('0x4c')]({},_0x272b40,_0x488936[_0x3cdd('0x4e')]);return db[_0x3cdd('0x39')][_0x3cdd('0x55')](_0x272b40)['then'](handleEntityNotFound(_0x69bd04,null))[_0x3cdd('0x1f')](respondWithResult(_0x69bd04,null))[_0x3cdd('0x28')](handleError(_0x69bd04,null));};exports[_0x3cdd('0x56')]=function(_0xcd979d,_0x6ea6f6){return db[_0x3cdd('0x39')][_0x3cdd('0x56')](_0xcd979d['body'],{})[_0x3cdd('0x1f')](function(_0x5afecc){var _0x4518eb=_0xcd979d[_0x3cdd('0x57')][_0x3cdd('0x58')]({'plain':!![]});if(!_0x4518eb)throw new Error(_0x3cdd('0x59'));if(_0x4518eb[_0x3cdd('0x5a')]===_0x3cdd('0x57')){var _0x3f2f7a=_0x5afecc['get']({'plain':!![]});var _0x437392='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x437392,'userProfileId':_0x4518eb['userProfileId']},'raw':!![]})[_0x3cdd('0x1f')](function(_0x834229){if(_0x834229&&_0x834229[_0x3cdd('0x5b')]===0x0){return db[_0x3cdd('0x31')][_0x3cdd('0x56')]({'name':_0x3f2f7a['name'],'resourceId':_0x3f2f7a['id'],'type':_0x834229[_0x3cdd('0x35')],'sectionId':_0x834229['id']},{})[_0x3cdd('0x1f')](function(){return _0x5afecc;});}else{return _0x5afecc;}})[_0x3cdd('0x28')](function(_0x2786e0){logger['error'](_0x3cdd('0x5c'),_0x2786e0);throw _0x2786e0;});}return _0x5afecc;})[_0x3cdd('0x1f')](respondWithResult(_0x6ea6f6,0xc9))[_0x3cdd('0x28')](handleError(_0x6ea6f6,null));};exports['update']=function(_0xbf6b36,_0x52dabe){if(_0xbf6b36[_0x3cdd('0x5d')]['id']){delete _0xbf6b36[_0x3cdd('0x5d')]['id'];}return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0xbf6b36[_0x3cdd('0x53')]['id']},'include':[{'model':db[_0x3cdd('0x37')],'as':_0x3cdd('0x38')}]})[_0x3cdd('0x1f')](handleEntityNotFound(_0x52dabe,null))[_0x3cdd('0x1f')](saveUpdates(_0xbf6b36[_0x3cdd('0x5d')],null))[_0x3cdd('0x1f')](respondWithResult(_0x52dabe,null))[_0x3cdd('0x28')](handleError(_0x52dabe,null));};exports[_0x3cdd('0x32')]=function(_0x3ab8a1,_0xd9619e){return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0x3ab8a1[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0xd9619e,null))[_0x3cdd('0x1f')](removeEntity(_0xd9619e,null))[_0x3cdd('0x28')](handleError(_0xd9619e,null));};exports['describe']=function(_0x528d53,_0x220c5e){return db[_0x3cdd('0x39')][_0x3cdd('0x5e')]()[_0x3cdd('0x1f')](respondWithResult(_0x220c5e,null))[_0x3cdd('0x28')](handleError(_0x220c5e,null));};exports[_0x3cdd('0x5f')]=function(_0x5a2d74,_0x568a2e,_0x19a3e2){if(_0x5a2d74[_0x3cdd('0x5d')]['id']){delete _0x5a2d74[_0x3cdd('0x5d')]['id'];}return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0x5a2d74[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x568a2e,null))['then'](function(_0x3d7841){if(_0x3d7841){_0x5a2d74[_0x3cdd('0x5d')]['WhatsappAccountId']=_0x3d7841['id'];return db[_0x3cdd('0x60')]['create'](_0x5a2d74[_0x3cdd('0x5d')]);}})[_0x3cdd('0x1f')](respondWithResult(_0x568a2e,null))[_0x3cdd('0x28')](handleError(_0x568a2e,null));};exports[_0x3cdd('0x61')]=function(_0x2fe0bf,_0x310078,_0x33e174){var _0x3a1fdd={'raw':![],'where':{}};var _0x1c943d={};var _0x418bdd={'count':0x0,'rows':[]};return db[_0x3cdd('0x39')][_0x3cdd('0x62')]({'where':{'id':_0x2fe0bf['params']['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x310078,null))[_0x3cdd('0x1f')](function(_0x683002){if(_0x683002){_0x1c943d[_0x3cdd('0x3d')]=_[_0x3cdd('0x40')](db['Disposition'][_0x3cdd('0x63')]);_0x1c943d[_0x3cdd('0x3f')]=_[_0x3cdd('0x40')](_0x2fe0bf[_0x3cdd('0x3f')]);_0x1c943d[_0x3cdd('0x41')]=_[_0x3cdd('0x42')](_0x1c943d['model'],_0x1c943d[_0x3cdd('0x3f')]);_0x3a1fdd[_0x3cdd('0x43')]=_[_0x3cdd('0x42')](_0x1c943d[_0x3cdd('0x3d')],qs[_0x3cdd('0x44')](_0x2fe0bf[_0x3cdd('0x3f')][_0x3cdd('0x44')]));_0x3a1fdd[_0x3cdd('0x43')]=_0x3a1fdd['attributes'][_0x3cdd('0x54')]?_0x3a1fdd['attributes']:_0x1c943d['model'];if(!_0x2fe0bf['query']['hasOwnProperty']('nolimit')){_0x3a1fdd[_0x3cdd('0x2d')]=qs[_0x3cdd('0x2d')](_0x2fe0bf[_0x3cdd('0x3f')][_0x3cdd('0x2d')]);_0x3a1fdd[_0x3cdd('0x2a')]=qs[_0x3cdd('0x2a')](_0x2fe0bf[_0x3cdd('0x3f')][_0x3cdd('0x2a')]);}_0x3a1fdd[_0x3cdd('0x47')]=qs[_0x3cdd('0x48')](_0x2fe0bf[_0x3cdd('0x3f')][_0x3cdd('0x48')]);_0x3a1fdd[_0x3cdd('0x49')]=qs[_0x3cdd('0x41')](_[_0x3cdd('0x4a')](_0x2fe0bf[_0x3cdd('0x3f')],_0x1c943d[_0x3cdd('0x41')]));_0x3a1fdd['where']['WhatsappAccountId']=_0x683002['id'];if(_0x2fe0bf[_0x3cdd('0x3f')][_0x3cdd('0x4b')]){_0x3a1fdd[_0x3cdd('0x49')]=_[_0x3cdd('0x4c')](_0x3a1fdd['where'],{'$or':_[_0x3cdd('0x3e')](_0x3a1fdd[_0x3cdd('0x43')],function(_0x217a41){var _0x1157ef={};_0x1157ef[_0x217a41]={'$like':'%'+_0x2fe0bf['query']['filter']+'%'};return _0x1157ef;})});}_0x3a1fdd=_['merge']({},_0x3a1fdd,_0x2fe0bf[_0x3cdd('0x4e')]);return db[_0x3cdd('0x60')][_0x3cdd('0x2c')]({'where':_0x3a1fdd[_0x3cdd('0x49')]})[_0x3cdd('0x1f')](function(_0x9b9787){_0x418bdd[_0x3cdd('0x2c')]=_0x9b9787;if(_0x2fe0bf['query']['includeAll']){_0x3a1fdd[_0x3cdd('0x50')]=[{'all':!![]}];}return db[_0x3cdd('0x60')][_0x3cdd('0x64')](_0x3a1fdd);})[_0x3cdd('0x1f')](function(_0x473f4d){_0x418bdd[_0x3cdd('0x51')]=_0x473f4d;return _0x418bdd;});}})[_0x3cdd('0x1f')](respondWithFilteredResult(_0x310078,_0x3a1fdd))['catch'](handleError(_0x310078,null));};exports[_0x3cdd('0x65')]=function(_0x272221,_0x4b9c11,_0x3827fd){return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0x272221[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x4b9c11,null))[_0x3cdd('0x1f')](function(_0x201a97){if(_0x201a97){return _0x201a97[_0x3cdd('0x65')](_0x272221[_0x3cdd('0x3f')]['ids']);}})[_0x3cdd('0x1f')](respondWithStatusCode(_0x4b9c11,null))[_0x3cdd('0x28')](handleError(_0x4b9c11,null));};exports[_0x3cdd('0x66')]=function(_0x328b08,_0x42ea31,_0x526119){if(_0x328b08['body']['id']){delete _0x328b08[_0x3cdd('0x5d')]['id'];}return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0x328b08[_0x3cdd('0x53')]['id']}})['then'](handleEntityNotFound(_0x42ea31,null))[_0x3cdd('0x1f')](function(_0x5268fd){if(_0x5268fd){_0x328b08[_0x3cdd('0x5d')][_0x3cdd('0x67')]=_0x5268fd['id'];return db['CannedAnswer'][_0x3cdd('0x56')](_0x328b08['body']);}})[_0x3cdd('0x1f')](respondWithResult(_0x42ea31,null))[_0x3cdd('0x28')](handleError(_0x42ea31,null));};exports['getAnswers']=function(_0x406121,_0x485750,_0x17ecb1){var _0x45e7e8={'raw':![],'where':{}};var _0xfcc7e9={};var _0x827dda={'count':0x0,'rows':[]};return db[_0x3cdd('0x39')][_0x3cdd('0x62')]({'where':{'id':_0x406121[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x485750,null))[_0x3cdd('0x1f')](function(_0x958b4d){if(_0x958b4d){_0xfcc7e9[_0x3cdd('0x3d')]=_['keys'](db[_0x3cdd('0x68')][_0x3cdd('0x63')]);_0xfcc7e9[_0x3cdd('0x3f')]=_[_0x3cdd('0x40')](_0x406121[_0x3cdd('0x3f')]);_0xfcc7e9[_0x3cdd('0x41')]=_[_0x3cdd('0x42')](_0xfcc7e9[_0x3cdd('0x3d')],_0xfcc7e9[_0x3cdd('0x3f')]);_0x45e7e8[_0x3cdd('0x43')]=_['intersection'](_0xfcc7e9['model'],qs['fields'](_0x406121[_0x3cdd('0x3f')]['fields']));_0x45e7e8[_0x3cdd('0x43')]=_0x45e7e8['attributes'][_0x3cdd('0x54')]?_0x45e7e8[_0x3cdd('0x43')]:_0xfcc7e9[_0x3cdd('0x3d')];if(!_0x406121[_0x3cdd('0x3f')][_0x3cdd('0x45')](_0x3cdd('0x46'))){_0x45e7e8[_0x3cdd('0x2d')]=qs[_0x3cdd('0x2d')](_0x406121[_0x3cdd('0x3f')][_0x3cdd('0x2d')]);_0x45e7e8[_0x3cdd('0x2a')]=qs['offset'](_0x406121[_0x3cdd('0x3f')][_0x3cdd('0x2a')]);}_0x45e7e8[_0x3cdd('0x47')]=qs[_0x3cdd('0x48')](_0x406121['query']['sort']);_0x45e7e8[_0x3cdd('0x49')]=qs[_0x3cdd('0x41')](_[_0x3cdd('0x4a')](_0x406121[_0x3cdd('0x3f')],_0xfcc7e9[_0x3cdd('0x41')]));_0x45e7e8[_0x3cdd('0x49')][_0x3cdd('0x67')]=_0x958b4d['id'];if(_0x406121[_0x3cdd('0x3f')][_0x3cdd('0x4b')]){_0x45e7e8[_0x3cdd('0x49')]=_[_0x3cdd('0x4c')](_0x45e7e8['where'],{'$or':_[_0x3cdd('0x3e')](_0x45e7e8[_0x3cdd('0x43')],function(_0xde0ffb){var _0x2c10b3={};_0x2c10b3[_0xde0ffb]={'$like':'%'+_0x406121[_0x3cdd('0x3f')][_0x3cdd('0x4b')]+'%'};return _0x2c10b3;})});}_0x45e7e8=_['merge']({},_0x45e7e8,_0x406121[_0x3cdd('0x4e')]);return db[_0x3cdd('0x68')][_0x3cdd('0x2c')]({'where':_0x45e7e8[_0x3cdd('0x49')]})[_0x3cdd('0x1f')](function(_0x4f72d3){_0x827dda[_0x3cdd('0x2c')]=_0x4f72d3;if(_0x406121['query'][_0x3cdd('0x4f')]){_0x45e7e8['include']=[{'all':!![]}];}return db[_0x3cdd('0x68')][_0x3cdd('0x64')](_0x45e7e8);})[_0x3cdd('0x1f')](function(_0x258be8){_0x827dda[_0x3cdd('0x51')]=_0x258be8;return _0x827dda;});}})[_0x3cdd('0x1f')](respondWithFilteredResult(_0x485750,_0x45e7e8))[_0x3cdd('0x28')](handleError(_0x485750,null));};exports[_0x3cdd('0x69')]=function(_0x56378d,_0x232c30,_0x48f539){return db[_0x3cdd('0x39')][_0x3cdd('0x55')]({'where':{'id':_0x56378d[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x232c30,null))['then'](function(_0x24fee3){if(_0x24fee3){return _0x24fee3[_0x3cdd('0x69')](_0x56378d[_0x3cdd('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x232c30,null))[_0x3cdd('0x28')](handleError(_0x232c30,null));};exports[_0x3cdd('0x6a')]=function(_0x4c32bc,_0x546e24,_0x46cacc){return db['WhatsappAccount']['find']({'where':{'id':_0x4c32bc['params']['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x546e24,null))[_0x3cdd('0x1f')](function(_0x1747f7){if(_0x1747f7){return _0x1747f7[_0x3cdd('0x6a')](_0x4c32bc[_0x3cdd('0x5d')][_0x3cdd('0x6b')],_[_0x3cdd('0x6c')](_0x4c32bc[_0x3cdd('0x5d')],[_0x3cdd('0x6b'),'id'])||{})[_0x3cdd('0x6d')](function(_0x31fc9a){for(var _0x4578de=0x0;_0x4578de<_0x4c32bc[_0x3cdd('0x5d')]['ids']['length'];_0x4578de+=0x1){socket[_0x3cdd('0x6e')]('userWhatsappAccount:save',{'UserId':Number(_0x4c32bc[_0x3cdd('0x5d')][_0x3cdd('0x6b')][_0x4578de]),'WhatsappAccountId':Number(_0x4c32bc[_0x3cdd('0x53')]['id'])});}return _0x31fc9a;});}})[_0x3cdd('0x1f')](respondWithResult(_0x546e24,null))['catch'](handleError(_0x546e24,null));};exports[_0x3cdd('0x6f')]=function(_0x38760b,_0x13fb81,_0x22dace){return db[_0x3cdd('0x39')]['find']({'where':{'id':_0x38760b[_0x3cdd('0x53')]['id']}})['then'](handleEntityNotFound(_0x13fb81,null))[_0x3cdd('0x1f')](function(_0x1cb223){if(_0x1cb223){return _0x1cb223['removeAgents'](_0x38760b[_0x3cdd('0x3f')][_0x3cdd('0x6b')])[_0x3cdd('0x1f')](function(){if(_['isArray'](_0x38760b[_0x3cdd('0x3f')][_0x3cdd('0x6b')])){for(var _0x4a9c9b=0x0;_0x4a9c9b<_0x38760b[_0x3cdd('0x3f')][_0x3cdd('0x6b')][_0x3cdd('0x54')];_0x4a9c9b+=0x1){socket[_0x3cdd('0x6e')](_0x3cdd('0x70'),{'UserId':Number(_0x38760b[_0x3cdd('0x3f')][_0x3cdd('0x6b')][_0x4a9c9b]),'WhatsappAccountId':Number(_0x38760b[_0x3cdd('0x53')]['id'])});}}else{socket['emit'](_0x3cdd('0x70'),{'UserId':Number(_0x38760b['query'][_0x3cdd('0x6b')]),'WhatsappAccountId':Number(_0x38760b['params']['id'])});}});}})[_0x3cdd('0x1f')](respondWithStatusCode(_0x13fb81,null))['catch'](handleError(_0x13fb81,null));};exports['getAgents']=function(_0x37653e,_0x2b40c7,_0x276272){var _0x1f7ab5={};var _0x2ee5d8={};var _0x369f31;var _0xd7e4e3;return db[_0x3cdd('0x39')][_0x3cdd('0x62')]({'where':{'id':_0x37653e[_0x3cdd('0x53')]['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x2b40c7,null))[_0x3cdd('0x1f')](function(_0x251ac5){if(_0x251ac5){_0x369f31=_0x251ac5;_0x2ee5d8[_0x3cdd('0x3d')]=_[_0x3cdd('0x40')](db[_0x3cdd('0x71')]['rawAttributes']);_0x2ee5d8['query']=_['keys'](_0x37653e[_0x3cdd('0x3f')]);_0x2ee5d8[_0x3cdd('0x41')]=_[_0x3cdd('0x42')](_0x2ee5d8[_0x3cdd('0x3d')],_0x2ee5d8[_0x3cdd('0x3f')]);_0x1f7ab5[_0x3cdd('0x43')]=_[_0x3cdd('0x42')](_0x2ee5d8['model'],qs[_0x3cdd('0x44')](_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x44')]));_0x1f7ab5[_0x3cdd('0x43')]=_0x1f7ab5[_0x3cdd('0x43')]['length']?_0x1f7ab5['attributes']:_0x2ee5d8[_0x3cdd('0x3d')];_0x1f7ab5[_0x3cdd('0x47')]=qs[_0x3cdd('0x48')](_0x37653e[_0x3cdd('0x3f')]['sort']);_0x1f7ab5['where']=qs[_0x3cdd('0x41')](_[_0x3cdd('0x4a')](_0x37653e[_0x3cdd('0x3f')],_0x2ee5d8[_0x3cdd('0x41')]));if(_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x4b')]){_0x1f7ab5[_0x3cdd('0x49')]=_[_0x3cdd('0x4c')](_0x1f7ab5[_0x3cdd('0x49')],{'$or':_[_0x3cdd('0x3e')](_0x1f7ab5[_0x3cdd('0x43')],function(_0x724eb7){var _0x331361={};_0x331361[_0x724eb7]={'$like':'%'+_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x4b')]+'%'};return _0x331361;})});}_0x1f7ab5=_[_0x3cdd('0x4c')]({},_0x1f7ab5,_0x37653e[_0x3cdd('0x4e')]);return _0x369f31[_0x3cdd('0x72')](_0x1f7ab5);}})[_0x3cdd('0x1f')](function(_0x3d3906){if(_0x3d3906){_0xd7e4e3=_0x3d3906[_0x3cdd('0x54')];if(!_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x45')]('nolimit')){_0x1f7ab5[_0x3cdd('0x2d')]=qs[_0x3cdd('0x2d')](_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x2d')]);_0x1f7ab5[_0x3cdd('0x2a')]=qs['offset'](_0x37653e[_0x3cdd('0x3f')][_0x3cdd('0x2a')]);}return _0x369f31[_0x3cdd('0x72')](_0x1f7ab5);}})['then'](function(_0x4abe0a){if(_0x4abe0a){return _0x4abe0a?{'count':_0xd7e4e3,'rows':_0x4abe0a}:null;}})[_0x3cdd('0x1f')](respondWithResult(_0x2b40c7,null))[_0x3cdd('0x28')](handleError(_0x2b40c7,null));};exports[_0x3cdd('0x73')]=function(_0x1b7ce9,_0xc4ec16){var _0x463a91=_0x1b7ce9['params']['id'];var _0x93a335=_0x1b7ce9[_0x3cdd('0x5d')];var _0x237b9d=0xc8;var _0x26854e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3cdd('0x74')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x49e046){return db[_0x3cdd('0x39')][_0x3cdd('0x62')]({'where':{'id':_0x463a91},'transaction':_0x49e046})[_0x3cdd('0x1f')](function(_0x8bdd31){if(_0x8bdd31){return db[_0x3cdd('0x75')][_0x3cdd('0x32')]({'where':{'WhatsappAccountId':_0x463a91},'transaction':_0x49e046})[_0x3cdd('0x1f')](function(){var _0x4b0b36=_[_0x3cdd('0x3e')](_0x93a335,function(_0x300ec0){_0x300ec0[_0x3cdd('0x67')]=_0x463a91;return _0x300ec0;});return db[_0x3cdd('0x75')][_0x3cdd('0x76')](_0x4b0b36,{'transaction':_0x49e046});});}else{_0x237b9d=0x194;_0x26854e=[];}});})[_0x3cdd('0x1f')](function(){if(_0x237b9d!==0x194){return db[_0x3cdd('0x75')][_0x3cdd('0x77')]({'where':{'WhatsappAccountId':_0x463a91},'order':'priority'})[_0x3cdd('0x1f')](function(_0x405375){_0x26854e=_0x405375;});}})['catch'](function(_0x1f096f){_0x237b9d=0x1f4;logger[_0x3cdd('0x25')](_0x1f096f[_0x3cdd('0x34')]);if(_0x1f096f[_0x3cdd('0x35')]){delete _0x1f096f['name'];}_0x26854e=_0x1f096f;})[_0x3cdd('0x78')](function(){if(_0x26854e===null){_0xc4ec16[_0x3cdd('0x79')](_0x237b9d);}else{if(_0x237b9d===0x1f4){_0xc4ec16[_0x3cdd('0x29')](_0x237b9d)[_0x3cdd('0x7a')](_0x26854e);}else{_0xc4ec16['status'](_0x237b9d)['json'](_0x26854e);}}});};exports[_0x3cdd('0x7b')]=function(_0x13cb74,_0x282997,_0x16f815){var _0x14e431={};var _0x1fd14a={};var _0x10aeb4;var _0x519ef1;return db[_0x3cdd('0x39')]['findOne']({'where':{'id':_0x13cb74['params']['id']}})[_0x3cdd('0x1f')](handleEntityNotFound(_0x282997,null))[_0x3cdd('0x1f')](function(_0x4e838d){if(_0x4e838d){_0x10aeb4=_0x4e838d;_0x1fd14a[_0x3cdd('0x3d')]=_[_0x3cdd('0x40')](db[_0x3cdd('0x75')][_0x3cdd('0x63')]);_0x1fd14a[_0x3cdd('0x3f')]=_[_0x3cdd('0x40')](_0x13cb74[_0x3cdd('0x3f')]);_0x1fd14a[_0x3cdd('0x41')]=_[_0x3cdd('0x42')](_0x1fd14a[_0x3cdd('0x3d')],_0x1fd14a[_0x3cdd('0x3f')]);_0x14e431[_0x3cdd('0x43')]=_[_0x3cdd('0x42')](_0x1fd14a[_0x3cdd('0x3d')],qs[_0x3cdd('0x44')](_0x13cb74['query']['fields']));_0x14e431[_0x3cdd('0x43')]=_0x14e431[_0x3cdd('0x43')][_0x3cdd('0x54')]?_0x14e431['attributes']:_0x1fd14a[_0x3cdd('0x3d')];_0x14e431[_0x3cdd('0x47')]=qs[_0x3cdd('0x48')](_0x13cb74[_0x3cdd('0x3f')][_0x3cdd('0x48')]);_0x14e431['where']=qs[_0x3cdd('0x41')](_[_0x3cdd('0x4a')](_0x13cb74[_0x3cdd('0x3f')],_0x1fd14a[_0x3cdd('0x41')]));if(_0x13cb74[_0x3cdd('0x3f')][_0x3cdd('0x4b')]){_0x14e431[_0x3cdd('0x49')]=_[_0x3cdd('0x4c')](_0x14e431['where'],{'$or':_[_0x3cdd('0x3e')](_0x14e431[_0x3cdd('0x43')],function(_0x300b07){var _0x518282={};_0x518282[_0x300b07]={'$like':'%'+_0x13cb74[_0x3cdd('0x3f')][_0x3cdd('0x4b')]+'%'};return _0x518282;})});}_0x14e431=_[_0x3cdd('0x4c')]({},_0x14e431,_0x13cb74[_0x3cdd('0x4e')]);return _0x10aeb4['getApplications'](_0x14e431);}})['then'](function(_0x503ed1){if(_0x503ed1){_0x519ef1=_0x503ed1['length'];if(!_0x13cb74[_0x3cdd('0x3f')][_0x3cdd('0x45')](_0x3cdd('0x46'))){_0x14e431[_0x3cdd('0x2d')]=qs[_0x3cdd('0x2d')](_0x13cb74['query'][_0x3cdd('0x2d')]);_0x14e431[_0x3cdd('0x2a')]=qs[_0x3cdd('0x2a')](_0x13cb74['query'][_0x3cdd('0x2a')]);}return _0x10aeb4[_0x3cdd('0x7b')](_0x14e431);}})[_0x3cdd('0x1f')](function(_0x32cbc4){if(_0x32cbc4){return _0x32cbc4?{'count':_0x519ef1,'rows':_0x32cbc4}:null;}})[_0x3cdd('0x1f')](respondWithResult(_0x282997,null))[_0x3cdd('0x28')](handleError(_0x282997,null));};exports['notify']=function(_0x5e6b33,_0x24905f,_0x310e73){var _0x32b982={'channel':_0x3cdd('0x7c')};var _0x224485=[];var _0x2a63a9=[];var _0x401533={};return db[_0x3cdd('0x39')]['find']({'where':{'id':_0x5e6b33[_0x3cdd('0x53')]['id']},'include':[{'model':db[_0x3cdd('0x75')],'as':_0x3cdd('0x7d')}]})['then'](handleEntityNotFound(_0x24905f,null))[_0x3cdd('0x1f')](function(_0x34e1fe){_0x32b982[_0x3cdd('0x7e')]=_0x34e1fe;if(_0x32b982[_0x3cdd('0x7e')]&&_0x32b982[_0x3cdd('0x7e')][_0x3cdd('0x3b')]==='sinch'&&_0x5e6b33[_0x3cdd('0x5d')]['statuses']){if(_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x7f')][_0x3cdd('0x54')]===0x0)return;if(_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x7f')][0x0][_0x3cdd('0x80')]!==_0x3cdd('0x81'))return;return db['WhatsappMessage'][_0x3cdd('0x82')]({'read':!![],'readAt':_0x5e6b33[_0x3cdd('0x5d')]['statuses'][0x0][_0x3cdd('0x83')]},{'where':{'messageId':_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x7f')][0x0][_0x3cdd('0x84')]},'individualHooks':!![]})[_0x3cdd('0x1f')](function(_0x5bc5e3){return _0x24905f[_0x3cdd('0x29')](0xc8)[_0x3cdd('0x2e')](_0x5bc5e3);});}_0x32b982[_0x3cdd('0x85')]=_['orderBy'](_0x34e1fe[_0x3cdd('0x7d')],[_0x3cdd('0x86')],[_0x3cdd('0x87')]);if(_0x32b982['account'][_0x3cdd('0x7d')]){delete _0x32b982[_0x3cdd('0x7e')]['Applications'];}return db['CmContact']['describe']()[_0x3cdd('0x1f')](function(_0x5b77aa){if(!_0x5b77aa){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))]('no\x20available\x20attributes');}_0x224485=_[_0x3cdd('0x8a')](_[_0x3cdd('0x40')](_0x5b77aa),[_0x3cdd('0x8b'),_0x3cdd('0x8c')]);_0x2a63a9=_['difference'](_[_0x3cdd('0x40')](_0x5b77aa),[_0x3cdd('0x8b'),_0x3cdd('0x8c'),_0x3cdd('0x8d'),_0x3cdd('0x8e')]);_0x32b982[_0x3cdd('0x5d')]={'mapKey':_0x3cdd('0x8f')};if(_0x32b982[_0x3cdd('0x7e')]&&_0x32b982[_0x3cdd('0x7e')]['type']===_0x3cdd('0x90')){_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x91')]=_0x5e6b33['body'][_0x3cdd('0x92')][_0x3cdd('0x93')](_0x3cdd('0x94'),'');_0x32b982['body'][_0x3cdd('0x5d')]=_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x95')];_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x96')]=_0x5e6b33['body'][_0x3cdd('0x97')];}if(_0x32b982[_0x3cdd('0x7e')]&&_0x32b982[_0x3cdd('0x7e')][_0x3cdd('0x3b')]===_0x3cdd('0x98')){_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x91')]=_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x99')][0x0][_0x3cdd('0x91')];_0x32b982['body'][_0x3cdd('0x5d')]=_0x5e6b33[_0x3cdd('0x5d')]['notifications'][0x0][_0x3cdd('0x26')][_0x3cdd('0x5d')];_0x32b982['body'][_0x3cdd('0x96')]=_0x5e6b33[_0x3cdd('0x5d')][_0x3cdd('0x99')][0x0][_0x3cdd('0x84')];}if(_0x32b982[_0x3cdd('0x5d')]['id']){delete _0x32b982['body']['id'];}if(_[_0x3cdd('0x9a')](_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x91')])){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))](_0x3cdd('0x9b'));}if(_[_0x3cdd('0x9a')](_0x32b982['body'][_0x3cdd('0x5d')])||_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x5d')]===''){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))](_0x3cdd('0x9c'));}if(_[_0x3cdd('0x9a')](_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x9d')])){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))](_0x3cdd('0x9e')+_0x2a63a9);}if(!_['includes'](_0x2a63a9,_0x32b982[_0x3cdd('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x3cdd('0x89'))](_0x3cdd('0x9f')+_0x2a63a9);}_0x401533[_0x32b982['body'][_0x3cdd('0x9d')]]=_0x32b982[_0x3cdd('0x5d')]['from'];return db[_0x3cdd('0xa0')][_0x3cdd('0x55')]({'where':{'id':_0x32b982[_0x3cdd('0x7e')][_0x3cdd('0x8e')]},'include':[{'model':db[_0x3cdd('0xa1')],'as':_0x3cdd('0xa2'),'where':_0x401533,'limit':0x1,'order':[[_0x3cdd('0x8c'),'DESC']]}]});})['then'](handleEntityNotFound(_0x24905f,null))[_0x3cdd('0x1f')](function(_0x5c6a4e){if(_0x5c6a4e){_0x32b982['list']=_['omit'](_0x5c6a4e,[_0x3cdd('0xa2')]);if(_0x5c6a4e[_0x3cdd('0xa2')][_0x3cdd('0x54')]){return _0x5c6a4e[_0x3cdd('0xa2')][0x0];}var _0x43dcdc=_[_0x3cdd('0xa3')](_0x32b982[_0x3cdd('0x5d')],{'firstName':_0x32b982['body'][_0x3cdd('0x91')],'ListId':_0x5c6a4e['id']});_0x43dcdc[_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x9d')]]=_0x32b982[_0x3cdd('0x5d')]['from'];return db['CmContact']['create'](_0x43dcdc,{'fields':_0x224485,'raw':!![]});}})['then'](handleEntityNotFound(_0x24905f,null))[_0x3cdd('0x1f')](function(_0xe56546){if(_0xe56546){_0x32b982[_0x3cdd('0xa4')]=_0xe56546;var _0x3fdc0b={'ContactId':_0xe56546['id'],'phone':_0x32b982['body']['from'],'WhatsappAccountId':_0x5e6b33['params']['id']};var _0x33718c={'ContactId':_0xe56546['id'],'WhatsappAccountId':_0x5e6b33[_0x3cdd('0x53')]['id'],'closed':![]};return db[_0x3cdd('0xa5')][_0x3cdd('0x55')]({'where':_0x33718c})[_0x3cdd('0x1f')](function(_0x1ae0f5){if(_0x1ae0f5){return[_0x1ae0f5,![]];}return db[_0x3cdd('0xa5')]['create'](_0x3fdc0b)[_0x3cdd('0x1f')](function(_0x3ff94e){return[_0x3ff94e,!![]];});});}})[_0x3cdd('0x6d')](function(_0x44e9c7,_0x1cb038){_0x32b982['interaction']=_0x44e9c7['get']({'plain':!![]});_0x32b982[_0x3cdd('0xa6')]['created']=![];if(_0x1cb038){if(_0x32b982[_0x3cdd('0x7e')][_0x3cdd('0xa7')]){_0x32b982[_0x3cdd('0x85')]['push']({'id':0x0,'priority':_0x32b982[_0x3cdd('0x85')]['length']+0x1,'app':'close','appdata':_0x3cdd('0xa8'),'interval':_0x3cdd('0xa9')});}_0x32b982['interaction'][_0x3cdd('0xaa')]=!![];}return db[_0x3cdd('0xab')][_0x3cdd('0x56')]({'phone':_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x91')],'messageId':_0x32b982[_0x3cdd('0x5d')][_0x3cdd('0x96')],'body':_0x32b982['body'][_0x3cdd('0x5d')],'WhatsappAccountId':_0x5e6b33[_0x3cdd('0x53')]['id'],'WhatsappInteractionId':_0x44e9c7['id'],'direction':'in','ContactId':_0x44e9c7[_0x3cdd('0xac')],'AttachmentId':_0x32b982[_0x3cdd('0x5d')]['AttachmentId']});})[_0x3cdd('0x1f')](function(_0x54ac3f){_0x32b982[_0x3cdd('0x26')]=_0x54ac3f;if(_0x32b982[_0x3cdd('0xa6')]['UserId']){return db[_0x3cdd('0x71')][_0x3cdd('0x55')]({'attributes':['id','name'],'where':{'id':_0x32b982[_0x3cdd('0xa6')][_0x3cdd('0xad')]}})[_0x3cdd('0x1f')](function(_0x1e3039){if(_0x1e3039){_0x32b982[_0x3cdd('0x85')][_0x3cdd('0xae')]({'id':0x0,'priority':0x0,'app':_0x3cdd('0xaf'),'appdata':_0x1e3039[_0x3cdd('0x35')]+','+(_0x32b982[_0x3cdd('0x7e')]['waitForTheAssignedAgent']||0xa),'interval':_0x3cdd('0xa9')});}return respondWithRpcPromise(_0x3cdd('0xb0'),_0x3cdd('0xb1'),_0x32b982);});}return respondWithRpcPromise(_0x3cdd('0xb0'),_0x3cdd('0xb1'),_0x32b982);})['then'](function(_0x44ccb8){if(_0x44ccb8){var _0x437779=0xc8;var _0x45382f='receiveMessage';logger[_0x3cdd('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x45382f,_0x437779,'entity\x20found');logger[_0x3cdd('0x23')](_0x3cdd('0xb2'),_0x45382f,_0x437779,_0x3cdd('0xb3'),JSON[_0x3cdd('0xb4')](_0x44ccb8));if(_0x32b982[_0x3cdd('0x7e')][_0x3cdd('0x3b')]==='twilio'){return _0x24905f['status'](_0x437779)[_0x3cdd('0xb5')](_0x3cdd('0xb6'),_0x3cdd('0xb7'))['send'](_0x3cdd('0xb8'));}else{return _0x24905f['status'](_0x437779)[_0x3cdd('0x2e')](_0x44ccb8);}}});})['catch'](handleError(_0x24905f,null));};exports[_0x3cdd('0x7a')]=function(_0xb7c0f1,_0xb907c,_0x184985){var _0xae6564,_0x1b60b0,_0x578b9a;if(_[_0x3cdd('0x9a')](_0xb7c0f1[_0x3cdd('0x5d')][_0x3cdd('0x5d')])||_0xb7c0f1[_0x3cdd('0x5d')][_0x3cdd('0x5d')]===''){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))](_0x3cdd('0x9c'));}if(_[_0x3cdd('0x9a')](_0xb7c0f1[_0x3cdd('0x5d')]['to'])){throw new db[(_0x3cdd('0x88'))][(_0x3cdd('0x89'))](_0x3cdd('0xb9'));}_0xae6564=_0xb7c0f1[_0x3cdd('0x5d')]['to'];return db[_0x3cdd('0x39')]['find']({'where':{'id':_0xb7c0f1['params']['id']},'include':[{'model':db[_0x3cdd('0xa0')],'as':'List','include':[{'model':db[_0x3cdd('0xa1')],'as':_0x3cdd('0xa2'),'where':{'mobile':_0xae6564},'limit':0x1,'order':[['updatedAt',_0x3cdd('0xba')]]}]}]})[_0x3cdd('0x1f')](handleEntityNotFound(_0xb907c,null))[_0x3cdd('0x1f')](function(_0x28775f){if(_0x28775f&&_0x28775f[_0x3cdd('0xbb')]){_0x1b60b0=_0x28775f['get']({'plain':!![]});if(_0x1b60b0[_0x3cdd('0xbb')]&&_0x1b60b0[_0x3cdd('0xbb')][_0x3cdd('0xa2')][_0x3cdd('0x54')]){return _0x1b60b0[_0x3cdd('0xbb')][_0x3cdd('0xa2')][0x0];}return db[_0x3cdd('0xa1')]['create'](_[_0x3cdd('0xa3')](_0xb7c0f1[_0x3cdd('0x5d')],{'firstName':_0xae6564,'mobile':_0xae6564,'phone':_0xae6564,'ListId':_0x1b60b0[_0x3cdd('0x8e')]}));}})[_0x3cdd('0x1f')](handleEntityNotFound(_0xb907c,null))[_0x3cdd('0x1f')](function(_0x5b8a1){if(_0x5b8a1){_0x578b9a=_0x5b8a1;return db[_0x3cdd('0xa5')][_0x3cdd('0x55')]({'where':{'ContactId':_0x578b9a['id'],'closed':![],'WhatsappAccountId':_0x1b60b0['id']}})[_0x3cdd('0x1f')](function(_0x4c5916){if(_0x4c5916){return[_0x4c5916,![]];}return db[_0x3cdd('0xa5')][_0x3cdd('0x56')]({'UserId':_0xb7c0f1[_0x3cdd('0x57')]['id'],'ContactId':_0x578b9a['id'],'WhatsappAccountId':_0x1b60b0['id'],'phone':_0xae6564,'firstMsgDirection':'out','Messages':[_[_0x3cdd('0x4c')](_0xb7c0f1[_0x3cdd('0x5d')],{'read':![],'body':_0xb7c0f1['body']['body'],'phone':_0xae6564,'WhatsappAccountId':_0x1b60b0['id'],'UserId':_0xb7c0f1[_0x3cdd('0x57')]['id'],'ContactId':_0x578b9a['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3cdd('0xbc')}]})['then'](function(_0xb3f80c){return[_0xb3f80c,!![]];});});}})[_0x3cdd('0x6d')](function(_0x155130,_0x619cdc){if(_0x619cdc){return _0x155130;}return db[_0x3cdd('0xab')][_0x3cdd('0x56')](_[_0x3cdd('0x4c')](_0xb7c0f1['body'],{'read':![],'body':_0xb7c0f1[_0x3cdd('0x5d')][_0x3cdd('0x5d')],'phone':_0xae6564,'WhatsappAccountId':_0x1b60b0['id'],'WhatsappInteractionId':_0x155130['id'],'UserId':_0xb7c0f1[_0x3cdd('0x57')]['id'],'ContactId':_0x578b9a['id']}))['then'](function(_0xfd815d){_0x155130[_0x3cdd('0xbd')][_0x3cdd('0xbc')]=[];_0x155130['dataValues'][_0x3cdd('0xbc')][_0x3cdd('0xbe')](_0xfd815d['dataValues']);return _0x155130;});})[_0x3cdd('0x1f')](respondWithResult(_0xb907c,null))[_0x3cdd('0x28')](handleError(_0xb907c,null));}; \ No newline at end of file +var _0xb5dd=['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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','name','index','Pause','map','WhatsappAccount','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb5dd,0x17b));var _0xdb5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5dd[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xdb5d('0x0'));var rimraf=require(_0xdb5d('0x1'));var zipdir=require(_0xdb5d('0x2'));var jsonpatch=require(_0xdb5d('0x3'));var rp=require(_0xdb5d('0x4'));var moment=require('moment');var BPromise=require(_0xdb5d('0x5'));var Mustache=require(_0xdb5d('0x6'));var util=require(_0xdb5d('0x7'));var path=require(_0xdb5d('0x8'));var sox=require('sox');var csv=require(_0xdb5d('0x9'));var ejs=require(_0xdb5d('0xa'));var fs=require('fs');var fs_extra=require(_0xdb5d('0xb'));var _=require(_0xdb5d('0xc'));var squel=require(_0xdb5d('0xd'));var crypto=require(_0xdb5d('0xe'));var jsforce=require(_0xdb5d('0xf'));var deskjs=require(_0xdb5d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdb5d('0x11'));var Papa=require('papaparse');var Redis=require(_0xdb5d('0x12'));var authService=require(_0xdb5d('0x13'));var qs=require(_0xdb5d('0x14'));var as=require(_0xdb5d('0x15'));var hardwareService=require(_0xdb5d('0x16'));var logger=require(_0xdb5d('0x17'))(_0xdb5d('0x18'));var utils=require(_0xdb5d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdb5d('0x1a'));var db=require(_0xdb5d('0x1b'))['db'];config['redis']=_['defaults'](config[_0xdb5d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb5d('0x1d'))(new Redis(config['redis']));require(_0xdb5d('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdb5d('0x1f')][_0xdb5d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1d81bb,_0x305250,_0x5e2000,_0x23db87){return new BPromise(function(_0x4ed4c9,_0x2f2921){var _0x53cdfc=_0x23db87||client;return _0x53cdfc[_0xdb5d('0x21')](_0x1d81bb,_0x5e2000)[_0xdb5d('0x22')](function(_0x43b84d){logger[_0xdb5d('0x23')](_0xdb5d('0x24'),_0x305250,_0xdb5d('0x25'));logger[_0xdb5d('0x26')](_0xdb5d('0x27'),_0x305250,_0xdb5d('0x25'),JSON['stringify'](_0x43b84d));if(_0x43b84d[_0xdb5d('0x28')]){if(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x29')]===0x1f4){logger['error'](_0xdb5d('0x24'),_0x305250,_0x43b84d['error'][_0xdb5d('0x2a')]);return _0x2f2921(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);}logger['error'](_0xdb5d('0x24'),_0x305250,_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);return _0x4ed4c9(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);}else{logger[_0xdb5d('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x305250,_0xdb5d('0x25'));_0x4ed4c9(_0x43b84d[_0xdb5d('0x2b')][_0xdb5d('0x2a')]);}})['catch'](function(_0x46bbf1){logger['error'](_0xdb5d('0x24'),_0x305250,_0x46bbf1);_0x2f2921(_0x46bbf1);});});}function respondWithStatusCode(_0x5b3e13,_0x4a9fff){_0x4a9fff=_0x4a9fff||0xcc;return function(_0x298bd4){if(_0x298bd4){return _0x5b3e13[_0xdb5d('0x2c')](_0x4a9fff);}return _0x5b3e13['status'](_0x4a9fff)['end']();};}function respondWithResult(_0x16c8be,_0x161e35){_0x161e35=_0x161e35||0xc8;return function(_0x4a7669){if(_0x4a7669){return _0x16c8be[_0xdb5d('0x2d')](_0x161e35)[_0xdb5d('0x2e')](_0x4a7669);}};}function respondWithFilteredResult(_0x525c53,_0x169825){return function(_0x155dca){if(_0x155dca){var _0xe4f57f=typeof _0x169825['offset']===_0xdb5d('0x2f')&&typeof _0x169825[_0xdb5d('0x30')]===_0xdb5d('0x2f');var _0x13a843=_0x155dca[_0xdb5d('0x31')];var _0x1db6d9=_0xe4f57f?0x0:_0x169825[_0xdb5d('0x32')];var _0x146f3e=_0xe4f57f?_0x155dca[_0xdb5d('0x31')]:_0x169825[_0xdb5d('0x32')]+_0x169825[_0xdb5d('0x30')];var _0x381c5f;if(_0x146f3e>=_0x13a843){_0x146f3e=_0x13a843;_0x381c5f=0xc8;}else{_0x381c5f=0xce;}_0x525c53[_0xdb5d('0x2d')](_0x381c5f);return _0x525c53['set']('Content-Range',_0x1db6d9+'-'+_0x146f3e+'/'+_0x13a843)['json'](_0x155dca);}return null;};}function patchUpdates(_0x2a0788){return function(_0x1aeb5a){try{jsonpatch[_0xdb5d('0x33')](_0x1aeb5a,_0x2a0788,!![]);}catch(_0x15f14a){return BPromise[_0xdb5d('0x34')](_0x15f14a);}return _0x1aeb5a[_0xdb5d('0x35')]();};}function saveUpdates(_0x24a75b,_0x30b20b){return function(_0x44595c){if(_0x44595c){return _0x44595c[_0xdb5d('0x36')](_0x24a75b)[_0xdb5d('0x22')](function(_0x554a11){return _0x554a11;});}return null;};}function removeEntity(_0x484f52,_0x190434){return function(_0x317086){if(_0x317086){return _0x317086[_0xdb5d('0x37')]()[_0xdb5d('0x22')](function(){var _0x12072e=_0x317086[_0xdb5d('0x38')]({'plain':!![]});var _0x218fd9=_0xdb5d('0x39');return db[_0xdb5d('0x3a')]['destroy']({'where':{'type':_0x218fd9,'resourceId':_0x12072e['id']}})[_0xdb5d('0x22')](function(){return _0x317086;});})['then'](function(){_0x484f52[_0xdb5d('0x2d')](0xcc)[_0xdb5d('0x3b')]();});}};}function handleEntityNotFound(_0x376ab4,_0x26ee34){return function(_0x431533){if(!_0x431533){_0x376ab4[_0xdb5d('0x2c')](0x194);}return _0x431533;};}function handleError(_0x214431,_0x5dcd96){_0x5dcd96=_0x5dcd96||0x1f4;return function(_0x36421a){logger[_0xdb5d('0x28')](_0x36421a['stack']);if(_0x36421a[_0xdb5d('0x3c')]){delete _0x36421a[_0xdb5d('0x3c')];}_0x214431[_0xdb5d('0x2d')](_0x5dcd96)['send'](_0x36421a);};}exports[_0xdb5d('0x3d')]=function(_0x1bbbe9,_0x3fd1ef){var _0x3a95b4={'include':[{'model':db[_0xdb5d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x168485={},_0x1f7d8b={'count':0x0,'rows':[]};var _0xd9ea94=_[_0xdb5d('0x3f')](db[_0xdb5d('0x40')][_0xdb5d('0x41')],function(_0x1f89d6){return{'name':_0x1f89d6['fieldName'],'type':_0x1f89d6['type']['key']};});_0x168485['model']=_[_0xdb5d('0x3f')](_0xd9ea94,_0xdb5d('0x3c'));_0x168485[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x1bbbe9[_0xdb5d('0x42')]);_0x168485[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x168485[_0xdb5d('0x46')],_0x168485[_0xdb5d('0x42')]);_0x3a95b4['attributes']=_[_0xdb5d('0x45')](_0x168485[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0x3a95b4[_0xdb5d('0x48')]=_0x3a95b4['attributes'][_0xdb5d('0x49')]?_0x3a95b4[_0xdb5d('0x48')]:_0x168485[_0xdb5d('0x46')];if(!_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0x3a95b4[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0x3a95b4[_0xdb5d('0x32')]=qs['offset'](_0x1bbbe9['query'][_0xdb5d('0x32')]);}_0x3a95b4[_0xdb5d('0x4b')]=qs[_0xdb5d('0x4c')](_0x1bbbe9['query']['sort']);_0x3a95b4[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x1bbbe9[_0xdb5d('0x42')],_0x168485['filters']),_0xd9ea94);if(_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x4f')]){_0x3a95b4[_0xdb5d('0x4d')]=_[_0xdb5d('0x50')](_0x3a95b4[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xd9ea94,function(_0x2184f4){if(_0x2184f4[_0xdb5d('0x51')]!==_0xdb5d('0x52')){var _0x48e0db={};_0x48e0db[_0x2184f4['name']]={'$like':'%'+_0x1bbbe9['query']['filter']+'%'};return _0x48e0db;}})});}_0x3a95b4=_[_0xdb5d('0x50')]({},_0x3a95b4,_0x1bbbe9[_0xdb5d('0x53')]);var _0x5b9551={'where':_0x3a95b4[_0xdb5d('0x4d')]};return db[_0xdb5d('0x40')]['count'](_0x5b9551)[_0xdb5d('0x22')](function(_0x20d2a2){_0x1f7d8b['count']=_0x20d2a2;if(_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x3a95b4[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x40')][_0xdb5d('0x56')](_0x3a95b4);})[_0xdb5d('0x22')](function(_0x27bcc1){_0x1f7d8b[_0xdb5d('0x57')]=_0x27bcc1;return _0x1f7d8b;})[_0xdb5d('0x22')](respondWithFilteredResult(_0x3fd1ef,_0x3a95b4))[_0xdb5d('0x58')](handleError(_0x3fd1ef,null));};exports[_0xdb5d('0x59')]=function(_0xccae2a,_0x1d164c){var _0x67e07b={'raw':![],'where':{'id':_0xccae2a[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x3e')],'as':_0xdb5d('0x5b')}]},_0x305655={};_0x305655[_0xdb5d('0x46')]=_['keys'](db[_0xdb5d('0x40')][_0xdb5d('0x41')]);_0x305655[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0xccae2a['query']);_0x305655['filters']=_['intersection'](_0x305655[_0xdb5d('0x46')],_0x305655[_0xdb5d('0x42')]);_0x67e07b[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x305655[_0xdb5d('0x46')],qs['fields'](_0xccae2a['query']['fields']));_0x67e07b[_0xdb5d('0x48')]=_0x67e07b['attributes'][_0xdb5d('0x49')]?_0x67e07b[_0xdb5d('0x48')]:_0x305655[_0xdb5d('0x46')];if(_0xccae2a[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x67e07b[_0xdb5d('0x55')]=[{'all':!![]}];}_0x67e07b=_[_0xdb5d('0x50')]({},_0x67e07b,_0xccae2a['options']);return db[_0xdb5d('0x40')][_0xdb5d('0x5c')](_0x67e07b)[_0xdb5d('0x22')](handleEntityNotFound(_0x1d164c,null))[_0xdb5d('0x22')](respondWithResult(_0x1d164c,null))[_0xdb5d('0x58')](handleError(_0x1d164c,null));};exports[_0xdb5d('0x5d')]=function(_0x38cb93,_0xaff544){return db['WhatsappAccount'][_0xdb5d('0x5d')](_0x38cb93[_0xdb5d('0x5e')],{})[_0xdb5d('0x22')](function(_0x17bf5d){var _0x154f4f=_0x38cb93[_0xdb5d('0x5f')][_0xdb5d('0x38')]({'plain':!![]});if(!_0x154f4f)throw new Error(_0xdb5d('0x60'));if(_0x154f4f[_0xdb5d('0x61')]===_0xdb5d('0x5f')){var _0x1f80f7=_0x17bf5d[_0xdb5d('0x38')]({'plain':!![]});var _0x2731a2=_0xdb5d('0x39');return db[_0xdb5d('0x62')]['find']({'where':{'name':_0x2731a2,'userProfileId':_0x154f4f['userProfileId']},'raw':!![]})[_0xdb5d('0x22')](function(_0x1ce54b){if(_0x1ce54b&&_0x1ce54b['autoAssociation']===0x0){return db[_0xdb5d('0x3a')][_0xdb5d('0x5d')]({'name':_0x1f80f7[_0xdb5d('0x3c')],'resourceId':_0x1f80f7['id'],'type':_0x1ce54b[_0xdb5d('0x3c')],'sectionId':_0x1ce54b['id']},{})[_0xdb5d('0x22')](function(){return _0x17bf5d;});}else{return _0x17bf5d;}})[_0xdb5d('0x58')](function(_0x582b2b){logger[_0xdb5d('0x28')](_0xdb5d('0x63'),_0x582b2b);throw _0x582b2b;});}return _0x17bf5d;})['then'](respondWithResult(_0xaff544,0xc9))['catch'](handleError(_0xaff544,null));};exports[_0xdb5d('0x36')]=function(_0xe86464,_0x28012c){if(_0xe86464[_0xdb5d('0x5e')]['id']){delete _0xe86464[_0xdb5d('0x5e')]['id'];}return db['WhatsappAccount'][_0xdb5d('0x5c')]({'where':{'id':_0xe86464[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xdb5d('0x22')](handleEntityNotFound(_0x28012c,null))['then'](saveUpdates(_0xe86464[_0xdb5d('0x5e')],null))['then'](respondWithResult(_0x28012c,null))[_0xdb5d('0x58')](handleError(_0x28012c,null));};exports['destroy']=function(_0x532f60,_0x8e4ee5){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x532f60[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x8e4ee5,null))[_0xdb5d('0x22')](removeEntity(_0x8e4ee5,null))[_0xdb5d('0x58')](handleError(_0x8e4ee5,null));};exports[_0xdb5d('0x64')]=function(_0x17e85b,_0x5049a5){return db[_0xdb5d('0x40')][_0xdb5d('0x64')]()[_0xdb5d('0x22')](respondWithResult(_0x5049a5,null))[_0xdb5d('0x58')](handleError(_0x5049a5,null));};exports['addDisposition']=function(_0x11298f,_0x4f8f50,_0x39b7e8){if(_0x11298f['body']['id']){delete _0x11298f[_0xdb5d('0x5e')]['id'];}return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x11298f[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x4f8f50,null))[_0xdb5d('0x22')](function(_0x579899){if(_0x579899){_0x11298f['body'][_0xdb5d('0x65')]=_0x579899['id'];return db['Disposition']['create'](_0x11298f['body']);}})[_0xdb5d('0x22')](respondWithResult(_0x4f8f50,null))[_0xdb5d('0x58')](handleError(_0x4f8f50,null));};exports[_0xdb5d('0x66')]=function(_0x5529f3,_0x414415,_0x386495){var _0xe3a474={'raw':![],'where':{}};var _0x1647dc={};var _0x46746d={'count':0x0,'rows':[]};return db[_0xdb5d('0x40')]['findOne']({'where':{'id':_0x5529f3[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x414415,null))[_0xdb5d('0x22')](function(_0x591cc5){if(_0x591cc5){_0x1647dc[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db[_0xdb5d('0x67')]['rawAttributes']);_0x1647dc[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x5529f3[_0xdb5d('0x42')]);_0x1647dc['filters']=_[_0xdb5d('0x45')](_0x1647dc['model'],_0x1647dc['query']);_0xe3a474[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x1647dc['model'],qs[_0xdb5d('0x47')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0xe3a474['attributes']=_0xe3a474[_0xdb5d('0x48')]['length']?_0xe3a474[_0xdb5d('0x48')]:_0x1647dc[_0xdb5d('0x46')];if(!_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0xe3a474['limit']=qs[_0xdb5d('0x30')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0xe3a474[_0xdb5d('0x32')]=qs[_0xdb5d('0x32')](_0x5529f3[_0xdb5d('0x42')]['offset']);}_0xe3a474['order']=qs[_0xdb5d('0x4c')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0xe3a474[_0xdb5d('0x4d')]=qs['filters'](_[_0xdb5d('0x4e')](_0x5529f3[_0xdb5d('0x42')],_0x1647dc[_0xdb5d('0x44')]));_0xe3a474['where'][_0xdb5d('0x65')]=_0x591cc5['id'];if(_0x5529f3['query'][_0xdb5d('0x4f')]){_0xe3a474[_0xdb5d('0x4d')]=_[_0xdb5d('0x50')](_0xe3a474[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xe3a474['attributes'],function(_0x2347c0){var _0x5926d9={};_0x5926d9[_0x2347c0]={'$like':'%'+_0x5529f3[_0xdb5d('0x42')]['filter']+'%'};return _0x5926d9;})});}_0xe3a474=_[_0xdb5d('0x50')]({},_0xe3a474,_0x5529f3[_0xdb5d('0x53')]);return db['Disposition'][_0xdb5d('0x31')]({'where':_0xe3a474[_0xdb5d('0x4d')]})[_0xdb5d('0x22')](function(_0x57c884){_0x46746d[_0xdb5d('0x31')]=_0x57c884;if(_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0xe3a474[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x67')][_0xdb5d('0x56')](_0xe3a474);})[_0xdb5d('0x22')](function(_0x4907d3){_0x46746d[_0xdb5d('0x57')]=_0x4907d3;return _0x46746d;});}})[_0xdb5d('0x22')](respondWithFilteredResult(_0x414415,_0xe3a474))[_0xdb5d('0x58')](handleError(_0x414415,null));};exports[_0xdb5d('0x68')]=function(_0xfe9809,_0x1e1d45,_0x3552ce){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0xfe9809[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e1d45,null))[_0xdb5d('0x22')](function(_0x168082){if(_0x168082){return _0x168082['removeDispositions'](_0xfe9809[_0xdb5d('0x42')][_0xdb5d('0x69')]);}})['then'](respondWithStatusCode(_0x1e1d45,null))['catch'](handleError(_0x1e1d45,null));};exports[_0xdb5d('0x6a')]=function(_0xb4a3a1,_0x28d85f,_0x177d1d){if(_0xb4a3a1[_0xdb5d('0x5e')]['id']){delete _0xb4a3a1[_0xdb5d('0x5e')]['id'];}return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0xb4a3a1['params']['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x28d85f,null))['then'](function(_0xa692a4){if(_0xa692a4){_0xb4a3a1[_0xdb5d('0x5e')][_0xdb5d('0x65')]=_0xa692a4['id'];return db[_0xdb5d('0x6b')][_0xdb5d('0x5d')](_0xb4a3a1[_0xdb5d('0x5e')]);}})[_0xdb5d('0x22')](respondWithResult(_0x28d85f,null))[_0xdb5d('0x58')](handleError(_0x28d85f,null));};exports[_0xdb5d('0x6c')]=function(_0x25e08a,_0x4d3acd,_0x26755c){var _0x2970e4={'raw':![],'where':{}};var _0x261368={};var _0x81deb4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xdb5d('0x6d')]({'where':{'id':_0x25e08a[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x4d3acd,null))['then'](function(_0xe66407){if(_0xe66407){_0x261368[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db[_0xdb5d('0x6b')][_0xdb5d('0x41')]);_0x261368[_0xdb5d('0x42')]=_['keys'](_0x25e08a[_0xdb5d('0x42')]);_0x261368[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x261368['model'],_0x261368[_0xdb5d('0x42')]);_0x2970e4[_0xdb5d('0x48')]=_['intersection'](_0x261368[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x25e08a['query'][_0xdb5d('0x47')]));_0x2970e4[_0xdb5d('0x48')]=_0x2970e4['attributes'][_0xdb5d('0x49')]?_0x2970e4['attributes']:_0x261368[_0xdb5d('0x46')];if(!_0x25e08a['query'][_0xdb5d('0x4a')](_0xdb5d('0x6e'))){_0x2970e4[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0x2970e4[_0xdb5d('0x32')]=qs['offset'](_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x32')]);}_0x2970e4[_0xdb5d('0x4b')]=qs['sort'](_0x25e08a['query'][_0xdb5d('0x4c')]);_0x2970e4[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x25e08a['query'],_0x261368['filters']));_0x2970e4[_0xdb5d('0x4d')][_0xdb5d('0x65')]=_0xe66407['id'];if(_0x25e08a[_0xdb5d('0x42')]['filter']){_0x2970e4['where']=_[_0xdb5d('0x50')](_0x2970e4[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0x2970e4[_0xdb5d('0x48')],function(_0x406b22){var _0x568422={};_0x568422[_0x406b22]={'$like':'%'+_0x25e08a[_0xdb5d('0x42')]['filter']+'%'};return _0x568422;})});}_0x2970e4=_['merge']({},_0x2970e4,_0x25e08a[_0xdb5d('0x53')]);return db[_0xdb5d('0x6b')][_0xdb5d('0x31')]({'where':_0x2970e4[_0xdb5d('0x4d')]})[_0xdb5d('0x22')](function(_0x5a931f){_0x81deb4[_0xdb5d('0x31')]=_0x5a931f;if(_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x2970e4[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x6b')][_0xdb5d('0x56')](_0x2970e4);})[_0xdb5d('0x22')](function(_0x125543){_0x81deb4['rows']=_0x125543;return _0x81deb4;});}})['then'](respondWithFilteredResult(_0x4d3acd,_0x2970e4))[_0xdb5d('0x58')](handleError(_0x4d3acd,null));};exports[_0xdb5d('0x6f')]=function(_0x3db182,_0x353416,_0x2c81ae){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x3db182[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x353416,null))[_0xdb5d('0x22')](function(_0x158700){if(_0x158700){return _0x158700[_0xdb5d('0x6f')](_0x3db182[_0xdb5d('0x42')][_0xdb5d('0x69')]);}})[_0xdb5d('0x22')](respondWithStatusCode(_0x353416,null))[_0xdb5d('0x58')](handleError(_0x353416,null));};exports[_0xdb5d('0x70')]=function(_0x5e850e,_0x954a6b,_0x5e4e14){return db[_0xdb5d('0x40')]['find']({'where':{'id':_0x5e850e[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x954a6b,null))[_0xdb5d('0x22')](function(_0x379d84){if(_0x379d84){return _0x379d84[_0xdb5d('0x70')](_0x5e850e[_0xdb5d('0x5e')]['ids'],_[_0xdb5d('0x71')](_0x5e850e[_0xdb5d('0x5e')],[_0xdb5d('0x69'),'id'])||{})[_0xdb5d('0x72')](function(_0x4d5bdf){for(var _0x4736ed=0x0;_0x4736ed<_0x5e850e[_0xdb5d('0x5e')]['ids'][_0xdb5d('0x49')];_0x4736ed+=0x1){socket[_0xdb5d('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x5e850e[_0xdb5d('0x5e')][_0xdb5d('0x69')][_0x4736ed]),'WhatsappAccountId':Number(_0x5e850e['params']['id'])});}return _0x4d5bdf;});}})['then'](respondWithResult(_0x954a6b,null))['catch'](handleError(_0x954a6b,null));};exports[_0xdb5d('0x74')]=function(_0x34800c,_0x468829,_0x49c045){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x34800c[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x468829,null))[_0xdb5d('0x22')](function(_0x19709b){if(_0x19709b){return _0x19709b[_0xdb5d('0x74')](_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')])[_0xdb5d('0x22')](function(){if(_['isArray'](_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')])){for(var _0x5b6f77=0x0;_0x5b6f77<_0x34800c['query']['ids'][_0xdb5d('0x49')];_0x5b6f77+=0x1){socket[_0xdb5d('0x73')](_0xdb5d('0x75'),{'UserId':Number(_0x34800c[_0xdb5d('0x42')]['ids'][_0x5b6f77]),'WhatsappAccountId':Number(_0x34800c[_0xdb5d('0x5a')]['id'])});}}else{socket[_0xdb5d('0x73')](_0xdb5d('0x75'),{'UserId':Number(_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')]),'WhatsappAccountId':Number(_0x34800c[_0xdb5d('0x5a')]['id'])});}});}})[_0xdb5d('0x22')](respondWithStatusCode(_0x468829,null))[_0xdb5d('0x58')](handleError(_0x468829,null));};exports[_0xdb5d('0x76')]=function(_0x33d366,_0x228783,_0x43c14a){var _0x52e334={};var _0x4f2371={};var _0xb5020f;var _0x33da0a;return db[_0xdb5d('0x40')][_0xdb5d('0x6d')]({'where':{'id':_0x33d366[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x228783,null))['then'](function(_0x410af5){if(_0x410af5){_0xb5020f=_0x410af5;_0x4f2371[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db['User'][_0xdb5d('0x41')]);_0x4f2371[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x33d366[_0xdb5d('0x42')]);_0x4f2371[_0xdb5d('0x44')]=_['intersection'](_0x4f2371[_0xdb5d('0x46')],_0x4f2371[_0xdb5d('0x42')]);_0x52e334[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x4f2371[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0x52e334[_0xdb5d('0x48')]=_0x52e334[_0xdb5d('0x48')]['length']?_0x52e334[_0xdb5d('0x48')]:_0x4f2371[_0xdb5d('0x46')];_0x52e334[_0xdb5d('0x4b')]=qs[_0xdb5d('0x4c')](_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0x52e334[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x33d366['query'],_0x4f2371[_0xdb5d('0x44')]));if(_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4f')]){_0x52e334[_0xdb5d('0x4d')]=_['merge'](_0x52e334[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0x52e334[_0xdb5d('0x48')],function(_0x22bfcf){var _0x32f027={};_0x32f027[_0x22bfcf]={'$like':'%'+_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4f')]+'%'};return _0x32f027;})});}_0x52e334=_[_0xdb5d('0x50')]({},_0x52e334,_0x33d366[_0xdb5d('0x53')]);return _0xb5020f[_0xdb5d('0x76')](_0x52e334);}})[_0xdb5d('0x22')](function(_0x2101ea){if(_0x2101ea){_0x33da0a=_0x2101ea['length'];if(!_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4a')](_0xdb5d('0x6e'))){_0x52e334[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x33d366['query'][_0xdb5d('0x30')]);_0x52e334['offset']=qs['offset'](_0x33d366[_0xdb5d('0x42')]['offset']);}return _0xb5020f[_0xdb5d('0x76')](_0x52e334);}})['then'](function(_0x4e61c4){if(_0x4e61c4){return _0x4e61c4?{'count':_0x33da0a,'rows':_0x4e61c4}:null;}})[_0xdb5d('0x22')](respondWithResult(_0x228783,null))[_0xdb5d('0x58')](handleError(_0x228783,null));};exports[_0xdb5d('0x77')]=function(_0x14f880,_0x4f58b6){var _0x2a5c62=_0x14f880['params']['id'];var _0x152fd6=_0x14f880[_0xdb5d('0x5e')];var _0x4f0fd1=0xc8;var _0x5ecd96=null;return db[_0xdb5d('0x78')][_0xdb5d('0x79')]({'isolationLevel':db[_0xdb5d('0x78')]['Transaction']['ISOLATION_LEVELS'][_0xdb5d('0x7a')]},function(_0x5b88df){return db['WhatsappAccount']['findOne']({'where':{'id':_0x2a5c62},'transaction':_0x5b88df})[_0xdb5d('0x22')](function(_0x4a98e8){if(_0x4a98e8){return db['WhatsappApplication'][_0xdb5d('0x37')]({'where':{'WhatsappAccountId':_0x2a5c62},'transaction':_0x5b88df})[_0xdb5d('0x22')](function(){var _0x5cb5f2=_[_0xdb5d('0x3f')](_0x152fd6,function(_0x21309b){_0x21309b[_0xdb5d('0x65')]=_0x2a5c62;return _0x21309b;});return db[_0xdb5d('0x7b')][_0xdb5d('0x7c')](_0x5cb5f2,{'transaction':_0x5b88df});});}else{_0x4f0fd1=0x194;_0x5ecd96=[];}});})[_0xdb5d('0x22')](function(){if(_0x4f0fd1!==0x194){return db[_0xdb5d('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2a5c62},'order':_0xdb5d('0x7d')})['then'](function(_0xcd4690){_0x5ecd96=_0xcd4690;});}})[_0xdb5d('0x58')](function(_0x506133){_0x4f0fd1=0x1f4;logger[_0xdb5d('0x28')](_0x506133[_0xdb5d('0x7e')]);if(_0x506133[_0xdb5d('0x3c')]){delete _0x506133['name'];}_0x5ecd96=_0x506133;})['finally'](function(){if(_0x5ecd96===null){_0x4f58b6[_0xdb5d('0x2c')](_0x4f0fd1);}else{if(_0x4f0fd1===0x1f4){_0x4f58b6[_0xdb5d('0x2d')](_0x4f0fd1)['send'](_0x5ecd96);}else{_0x4f58b6[_0xdb5d('0x2d')](_0x4f0fd1)[_0xdb5d('0x2e')](_0x5ecd96);}}});};exports[_0xdb5d('0x7f')]=function(_0x218714,_0x3aa919,_0x5b54c9){var _0xa8dae1={};var _0x82a8b7={};var _0x2e7579;var _0x1ce1ed;return db[_0xdb5d('0x40')][_0xdb5d('0x6d')]({'where':{'id':_0x218714[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x3aa919,null))[_0xdb5d('0x22')](function(_0x520fb8){if(_0x520fb8){_0x2e7579=_0x520fb8;_0x82a8b7[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db['WhatsappApplication']['rawAttributes']);_0x82a8b7[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x218714[_0xdb5d('0x42')]);_0x82a8b7[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x82a8b7[_0xdb5d('0x46')],_0x82a8b7[_0xdb5d('0x42')]);_0xa8dae1['attributes']=_[_0xdb5d('0x45')](_0x82a8b7['model'],qs[_0xdb5d('0x47')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0xa8dae1['attributes']=_0xa8dae1[_0xdb5d('0x48')][_0xdb5d('0x49')]?_0xa8dae1['attributes']:_0x82a8b7[_0xdb5d('0x46')];_0xa8dae1['order']=qs[_0xdb5d('0x4c')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0xa8dae1['where']=qs[_0xdb5d('0x44')](_['pick'](_0x218714[_0xdb5d('0x42')],_0x82a8b7['filters']));if(_0x218714[_0xdb5d('0x42')]['filter']){_0xa8dae1[_0xdb5d('0x4d')]=_['merge'](_0xa8dae1[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xa8dae1['attributes'],function(_0x3db510){var _0x116c13={};_0x116c13[_0x3db510]={'$like':'%'+_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4f')]+'%'};return _0x116c13;})});}_0xa8dae1=_[_0xdb5d('0x50')]({},_0xa8dae1,_0x218714['options']);return _0x2e7579[_0xdb5d('0x7f')](_0xa8dae1);}})[_0xdb5d('0x22')](function(_0x1afc43){if(_0x1afc43){_0x1ce1ed=_0x1afc43[_0xdb5d('0x49')];if(!_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0xa8dae1[_0xdb5d('0x30')]=qs['limit'](_0x218714[_0xdb5d('0x42')]['limit']);_0xa8dae1[_0xdb5d('0x32')]=qs[_0xdb5d('0x32')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x32')]);}return _0x2e7579['getApplications'](_0xa8dae1);}})[_0xdb5d('0x22')](function(_0xad264d){if(_0xad264d){return _0xad264d?{'count':_0x1ce1ed,'rows':_0xad264d}:null;}})['then'](respondWithResult(_0x3aa919,null))[_0xdb5d('0x58')](handleError(_0x3aa919,null));};exports[_0xdb5d('0x80')]=function(_0x1c896d,_0x1e8da,_0x5f237d){var _0x1504fc={'channel':'whatsapp'};var _0x21309f=[];var _0x382def=[];var _0x236aeb={};return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x1c896d[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x7b')],'as':_0xdb5d('0x81')}]})['then'](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x3de202){_0x1504fc[_0xdb5d('0x82')]=_0x3de202;if(_0x1504fc[_0xdb5d('0x82')]&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]==='sinch'&&_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x83')]){if(_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x83')][_0xdb5d('0x49')]===0x0)return;if(_0x1c896d[_0xdb5d('0x5e')]['statuses'][0x0][_0xdb5d('0x84')]!=='read')return;return db[_0xdb5d('0x85')]['update']({'read':!![],'readAt':_0x1c896d[_0xdb5d('0x5e')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x1c896d['body'][_0xdb5d('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0xdb5d('0x22')](function(_0x42d9b3){return _0x1e8da['status'](0xc8)[_0xdb5d('0x2e')](_0x42d9b3);});}_0x1504fc[_0xdb5d('0x86')]=_[_0xdb5d('0x87')](_0x3de202[_0xdb5d('0x81')],[_0xdb5d('0x7d')],[_0xdb5d('0x88')]);if(_0x1504fc[_0xdb5d('0x82')]['Applications']){delete _0x1504fc['account'][_0xdb5d('0x81')];}return db[_0xdb5d('0x89')][_0xdb5d('0x64')]()['then'](function(_0x59f9dd){if(!_0x59f9dd){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0x8c'));}_0x21309f=_[_0xdb5d('0x8d')](_[_0xdb5d('0x43')](_0x59f9dd),['createdAt',_0xdb5d('0x8e')]);_0x382def=_[_0xdb5d('0x8d')](_['keys'](_0x59f9dd),[_0xdb5d('0x8f'),'updatedAt',_0xdb5d('0x90'),_0xdb5d('0x91')]);_0x1504fc[_0xdb5d('0x5e')]={'mapKey':_0xdb5d('0x92')};if(_0x1504fc[_0xdb5d('0x82')]&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]===_0xdb5d('0x93')){_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')]=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x95')]['replace'](_0xdb5d('0x96'),'');_0x1504fc[_0xdb5d('0x5e')]['body']=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x97')];_0x1504fc['body'][_0xdb5d('0x98')]=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x99')];}if(_0x1504fc['account']&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]==='sinch'){_0x1504fc['body']['from']=_0x1c896d[_0xdb5d('0x5e')]['notifications'][0x0][_0xdb5d('0x94')];_0x1504fc[_0xdb5d('0x5e')]['body']=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x9a')][0x0][_0xdb5d('0x2a')][_0xdb5d('0x5e')];_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x98')]=_0x1c896d['body']['notifications'][0x0][_0xdb5d('0x9b')];}if(_0x1504fc[_0xdb5d('0x5e')]['id']){delete _0x1504fc[_0xdb5d('0x5e')]['id'];}if(_[_0xdb5d('0x9c')](_0x1504fc[_0xdb5d('0x5e')]['from'])){throw new db['Sequelize'][(_0xdb5d('0x8b'))](_0xdb5d('0x9d'));}if(_[_0xdb5d('0x9c')](_0x1504fc['body']['body'])||_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x5e')]===''){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0x9e'));}if(_[_0xdb5d('0x9c')](_0x1504fc['body'][_0xdb5d('0x9f')])){throw new db[(_0xdb5d('0x8a'))]['ValidationError'](_0xdb5d('0xa0')+_0x382def);}if(!_[_0xdb5d('0xa1')](_0x382def,_0x1504fc['body'][_0xdb5d('0x9f')])){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0xa2')+_0x382def);}_0x236aeb[_0x1504fc['body']['mapKey']]=_0x1504fc['body']['from'];return db[_0xdb5d('0xa3')][_0xdb5d('0x5c')]({'where':{'id':_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x91')]},'include':[{'model':db[_0xdb5d('0x89')],'as':_0xdb5d('0xa4'),'where':_0x236aeb,'limit':0x1,'order':[[_0xdb5d('0x8e'),_0xdb5d('0xa5')]]}]});})[_0xdb5d('0x22')](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x27824f){if(_0x27824f){_0x1504fc['list']=_[_0xdb5d('0x71')](_0x27824f,[_0xdb5d('0xa4')]);if(_0x27824f[_0xdb5d('0xa4')][_0xdb5d('0x49')]){return _0x27824f[_0xdb5d('0xa4')][0x0];}var _0xed9a6e=_['defaults'](_0x1504fc[_0xdb5d('0x5e')],{'firstName':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'ListId':_0x27824f['id']});_0xed9a6e[_0x1504fc['body']['mapKey']]=_0x1504fc['body']['from'];return db[_0xdb5d('0x89')][_0xdb5d('0x5d')](_0xed9a6e,{'fields':_0x21309f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x2587d3){if(_0x2587d3){_0x1504fc['contact']=_0x2587d3;var _0x285ac8={'ContactId':_0x2587d3['id'],'phone':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id']};var _0x32fa8f={'ContactId':_0x2587d3['id'],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id'],'closed':![]};return db[_0xdb5d('0xa6')][_0xdb5d('0x5c')]({'where':_0x32fa8f})[_0xdb5d('0x22')](function(_0x938403){if(_0x938403){return[_0x938403,![]];}return db[_0xdb5d('0xa6')]['create'](_0x285ac8)['then'](function(_0x3946af){return[_0x3946af,!![]];});});}})[_0xdb5d('0x72')](function(_0x4226ef,_0x44c01b){_0x1504fc[_0xdb5d('0xa7')]=_0x4226ef[_0xdb5d('0x38')]({'plain':!![]});_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xa8')]=![];if(_0x44c01b){if(_0x1504fc['account'][_0xdb5d('0xa9')]){_0x1504fc[_0xdb5d('0x86')][_0xdb5d('0xaa')]({'id':0x0,'priority':_0x1504fc[_0xdb5d('0x86')][_0xdb5d('0x49')]+0x1,'app':_0xdb5d('0xab'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xa8')]=!![];}return db[_0xdb5d('0x85')][_0xdb5d('0x5d')]({'phone':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'messageId':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x98')],'body':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id'],'WhatsappInteractionId':_0x4226ef['id'],'direction':'in','ContactId':_0x4226ef[_0xdb5d('0xac')],'AttachmentId':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0xad')]});})[_0xdb5d('0x22')](function(_0x5b1d84){_0x1504fc[_0xdb5d('0x2a')]=_0x5b1d84;if(_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xae')]){return db[_0xdb5d('0xaf')]['find']({'attributes':['id',_0xdb5d('0x3c')],'where':{'id':_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xae')]}})['then'](function(_0x21782b){if(_0x21782b){_0x1504fc[_0xdb5d('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdb5d('0xb0'),'appdata':_0x21782b[_0xdb5d('0x3c')]+','+(_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0xb1')]||0xa),'interval':_0xdb5d('0xb2')});}return respondWithRpcPromise(_0xdb5d('0xb3'),_0xdb5d('0xb4'),_0x1504fc);});}return respondWithRpcPromise(_0xdb5d('0xb3'),_0xdb5d('0xb4'),_0x1504fc);})[_0xdb5d('0x22')](function(_0x381399){if(_0x381399){var _0x34f232=0xc8;var _0x4e2094=_0xdb5d('0xb5');logger[_0xdb5d('0x23')](_0xdb5d('0x27'),_0x4e2094,_0x34f232,_0xdb5d('0xb6'));logger[_0xdb5d('0x26')](_0xdb5d('0xb7'),_0x4e2094,_0x34f232,'entity\x20found',JSON['stringify'](_0x381399));if(_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]===_0xdb5d('0x93')){return _0x1e8da[_0xdb5d('0x2d')](_0x34f232)[_0xdb5d('0xb8')]('Content-Type',_0xdb5d('0xb9'))[_0xdb5d('0xba')](_0xdb5d('0xbb'));}else{return _0x1e8da[_0xdb5d('0x2d')](_0x34f232)['json'](_0x381399);}}});})['catch'](handleError(_0x1e8da,null));};exports[_0xdb5d('0xba')]=function(_0x22aa6f,_0x486927,_0x537d84){var _0x379979,_0x223da5,_0x9f4981;if(_['isNil'](_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')])||_0x22aa6f[_0xdb5d('0x5e')]['body']===''){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdb5d('0x9c')](_0x22aa6f[_0xdb5d('0x5e')]['to'])){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0xbc'));}_0x379979=_0x22aa6f[_0xdb5d('0x5e')]['to'];return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x22aa6f[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0xa3')],'as':_0xdb5d('0xbd'),'include':[{'model':db['CmContact'],'as':_0xdb5d('0xa4'),'where':{'mobile':_0x379979},'limit':0x1,'order':[[_0xdb5d('0x8e'),_0xdb5d('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x486927,null))[_0xdb5d('0x22')](function(_0xda8082){if(_0xda8082&&_0xda8082[_0xdb5d('0xbd')]){_0x223da5=_0xda8082[_0xdb5d('0x38')]({'plain':!![]});if(_0x223da5['List']&&_0x223da5[_0xdb5d('0xbd')]['Contacts'][_0xdb5d('0x49')]){return _0x223da5[_0xdb5d('0xbd')][_0xdb5d('0xa4')][0x0];}return db[_0xdb5d('0x89')]['create'](_['defaults'](_0x22aa6f[_0xdb5d('0x5e')],{'firstName':_0x379979,'mobile':_0x379979,'phone':_0x379979,'ListId':_0x223da5['ListId']}));}})[_0xdb5d('0x22')](handleEntityNotFound(_0x486927,null))[_0xdb5d('0x22')](function(_0x2abbe0){if(_0x2abbe0){_0x9f4981=_0x2abbe0;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x9f4981['id'],'closed':![],'WhatsappAccountId':_0x223da5['id']}})[_0xdb5d('0x22')](function(_0x5b4738){if(_0x5b4738){return[_0x5b4738,![]];}return db[_0xdb5d('0xa6')][_0xdb5d('0x5d')]({'UserId':_0x22aa6f[_0xdb5d('0x5f')]['id'],'ContactId':_0x9f4981['id'],'WhatsappAccountId':_0x223da5['id'],'phone':_0x379979,'firstMsgDirection':_0xdb5d('0xbe'),'Messages':[_[_0xdb5d('0x50')](_0x22aa6f[_0xdb5d('0x5e')],{'read':![],'body':_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'phone':_0x379979,'WhatsappAccountId':_0x223da5['id'],'UserId':_0x22aa6f['user']['id'],'ContactId':_0x9f4981['id']})]},{'include':[{'model':db[_0xdb5d('0x85')],'as':'Messages'}]})['then'](function(_0x1371ca){return[_0x1371ca,!![]];});});}})[_0xdb5d('0x72')](function(_0x2601a8,_0xd138a0){if(_0xd138a0){return _0x2601a8;}return db['WhatsappMessage'][_0xdb5d('0x5d')](_[_0xdb5d('0x50')](_0x22aa6f[_0xdb5d('0x5e')],{'read':![],'body':_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'phone':_0x379979,'WhatsappAccountId':_0x223da5['id'],'WhatsappInteractionId':_0x2601a8['id'],'UserId':_0x22aa6f['user']['id'],'ContactId':_0x9f4981['id']}))[_0xdb5d('0x22')](function(_0x32f41e){_0x2601a8[_0xdb5d('0xbf')][_0xdb5d('0xc0')]=[];_0x2601a8[_0xdb5d('0xbf')]['Messages']['push'](_0x32f41e['dataValues']);return _0x2601a8;});})[_0xdb5d('0x22')](respondWithResult(_0x486927,null))[_0xdb5d('0x58')](handleError(_0x486927,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5ff32c3..557bd9d 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 _0x50c2=['hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','save','update','remove','emit'];(function(_0x22240f,_0x56417b){var _0x516cf4=function(_0x32a8d3){while(--_0x32a8d3){_0x22240f['push'](_0x22240f['shift']());}};_0x516cf4(++_0x56417b);}(_0x50c2,0xe3));var _0x250c=function(_0x30f6e0,_0x440d88){_0x30f6e0=_0x30f6e0-0x0;var _0x492ea6=_0x50c2[_0x30f6e0];return _0x492ea6;};'use strict';var EventEmitter=require(_0x250c('0x0'));var WhatsappAccount=require(_0x250c('0x1'))['db'][_0x250c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x250c('0x3'),'afterUpdate':_0x250c('0x4'),'afterDestroy':_0x250c('0x5')};function emitEvent(_0x1e8258){return function(_0x342bf2,_0x43b18b,_0x2b228e){WhatsappAccountEvents['emit'](_0x1e8258+':'+_0x342bf2['id'],_0x342bf2);WhatsappAccountEvents[_0x250c('0x6')](_0x1e8258,_0x342bf2);_0x2b228e(null);};}for(var e in events){if(events[_0x250c('0x7')](e)){var event=events[e];WhatsappAccount[_0x250c('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xfbc1=['WhatsappAccount','setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x338693,_0x3ac648){var _0x33d894=function(_0x2d658a){while(--_0x2d658a){_0x338693['push'](_0x338693['shift']());}};_0x33d894(++_0x3ac648);}(_0xfbc1,0xd7));var _0x1fbc=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xfbc1[_0x879e31];return _0x3467e8;};'use strict';var EventEmitter=require(_0x1fbc('0x0'));var WhatsappAccount=require(_0x1fbc('0x1'))['db'][_0x1fbc('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1fbc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e7e86){return function(_0x3eadd7,_0x1c6652,_0x5437cf){WhatsappAccountEvents[_0x1fbc('0x4')](_0x4e7e86+':'+_0x3eadd7['id'],_0x3eadd7);WhatsappAccountEvents[_0x1fbc('0x4')](_0x4e7e86,_0x3eadd7);_0x5437cf(null);};}for(var e in events){if(events[_0x1fbc('0x5')](e)){var event=events[e];WhatsappAccount[_0x1fbc('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4cdfff2..575604d 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 _0x355b=['WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1d1696,_0x17f0a4){var _0x59ca89=function(_0x1996f3){while(--_0x1996f3){_0x1d1696['push'](_0x1d1696['shift']());}};_0x59ca89(++_0x17f0a4);}(_0x355b,0x1ca));var _0xb355=function(_0x58c1b2,_0x44aeea){_0x58c1b2=_0x58c1b2-0x0;var _0x2c5892=_0x355b[_0x58c1b2];return _0x2c5892;};'use strict';var _=require('lodash');var util=require(_0xb355('0x0'));var logger=require(_0xb355('0x1'))(_0xb355('0x2'));var moment=require(_0xb355('0x3'));var BPromise=require(_0xb355('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb355('0x5'));var rimraf=require(_0xb355('0x6'));var config=require(_0xb355('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xb355('0x8')]=function(_0x4ac35a,_0x3dd156){return _0x4ac35a[_0xb355('0x9')](_0xb355('0xa'),attributes,{'tableName':_0xb355('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9d2=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x3e9f24,_0x488fb9){var _0x614e20=function(_0x7425e1){while(--_0x7425e1){_0x3e9f24['push'](_0x3e9f24['shift']());}};_0x614e20(++_0x488fb9);}(_0xd9d2,0x1bf));var _0x2d9d=function(_0x4eeb66,_0x1d7553){_0x4eeb66=_0x4eeb66-0x0;var _0x4aa808=_0xd9d2[_0x4eeb66];return _0x4aa808;};'use strict';var _=require(_0x2d9d('0x0'));var util=require(_0x2d9d('0x1'));var logger=require(_0x2d9d('0x2'))(_0x2d9d('0x3'));var moment=require('moment');var BPromise=require(_0x2d9d('0x4'));var rp=require(_0x2d9d('0x5'));var fs=require('fs');var path=require(_0x2d9d('0x6'));var rimraf=require(_0x2d9d('0x7'));var config=require('../../config/environment');var attributes=require(_0x2d9d('0x8'));module['exports']=function(_0xb34b0a,_0x2cdb09){return _0xb34b0a['define'](_0x2d9d('0x9'),attributes,{'tableName':_0x2d9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index f4e4595..37513ef 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 _0xad7c=['then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','./whatsappAccount.socket','register','request'];(function(_0x1a3eb1,_0x5188d5){var _0x29efec=function(_0x34f0da){while(--_0x34f0da){_0x1a3eb1['push'](_0x1a3eb1['shift']());}};_0x29efec(++_0x5188d5);}(_0xad7c,0xae));var _0xcad7=function(_0x321eb8,_0x545ea6){_0x321eb8=_0x321eb8-0x0;var _0x15b81a=_0xad7c[_0x321eb8];return _0x15b81a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcad7('0x0'));var BPromise=require('bluebird');var rs=require(_0xcad7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcad7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcad7('0x3'))(_0xcad7('0x4'));var config=require('../../config/environment');var jayson=require(_0xcad7('0x5'));var client=jayson[_0xcad7('0x6')]['http']({'port':0x232a});config[_0xcad7('0x7')]=_[_0xcad7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcad7('0x7')]));require(_0xcad7('0x9'))[_0xcad7('0xa')](socket);function respondWithRpcPromise(_0x34e282,_0xffa40b,_0x341ef1){return new BPromise(function(_0x3af7f3,_0x39b339){return client[_0xcad7('0xb')](_0x34e282,_0x341ef1)[_0xcad7('0xc')](function(_0x524a8e){logger['info'](_0xcad7('0xd'),_0xffa40b,_0xcad7('0xe'));logger[_0xcad7('0xf')](_0xcad7('0x10'),_0xffa40b,_0xcad7('0xe'),JSON[_0xcad7('0x11')](_0x524a8e));if(_0x524a8e[_0xcad7('0x12')]){if(_0x524a8e[_0xcad7('0x12')]['code']===0x1f4){logger[_0xcad7('0x12')](_0xcad7('0xd'),_0xffa40b,_0x524a8e[_0xcad7('0x12')]['message']);return _0x39b339(_0x524a8e['error'][_0xcad7('0x13')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xffa40b,_0x524a8e['error'][_0xcad7('0x13')]);return _0x3af7f3(_0x524a8e[_0xcad7('0x12')]['message']);}else{logger[_0xcad7('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0xffa40b,_0xcad7('0xe'));_0x3af7f3(_0x524a8e[_0xcad7('0x15')][_0xcad7('0x13')]);}})[_0xcad7('0x16')](function(_0x3698fb){logger[_0xcad7('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0xffa40b,_0x3698fb);_0x39b339(_0x3698fb);});});}exports[_0xcad7('0x17')]=function(_0x29c48b){var _0xe0dd90=this;return new Promise(function(_0x480d68,_0x31e56d){return db['WhatsappAccount'][_0xcad7('0x18')]({'raw':_0x29c48b[_0xcad7('0x19')]?_0x29c48b[_0xcad7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29c48b['options']?_0x29c48b[_0xcad7('0x19')][_0xcad7('0x1a')]||null:null,'attributes':_0x29c48b[_0xcad7('0x19')]?_0x29c48b[_0xcad7('0x19')][_0xcad7('0x1b')]||null:null,'include':_0x29c48b['options']?_0x29c48b[_0xcad7('0x19')][_0xcad7('0x1c')]?_[_0xcad7('0x1d')](_0x29c48b['options'][_0xcad7('0x1c')],function(_0x3ebf0d){return{'model':db[_0x3ebf0d[_0xcad7('0x1e')]],'as':_0x3ebf0d['as'],'attributes':_0x3ebf0d[_0xcad7('0x1b')],'include':_0x3ebf0d['include']?_['map'](_0x3ebf0d[_0xcad7('0x1c')],function(_0x2a7b26){return{'model':db[_0x2a7b26[_0xcad7('0x1e')]],'as':_0x2a7b26['as'],'attributes':_0x2a7b26[_0xcad7('0x1b')],'include':_0x2a7b26['include']?_[_0xcad7('0x1d')](_0x2a7b26[_0xcad7('0x1c')],function(_0x34c6c1){return{'model':db[_0x34c6c1[_0xcad7('0x1e')]],'as':_0x34c6c1['as'],'attributes':_0x34c6c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x412e25){logger[_0xcad7('0x14')](_0xcad7('0x17'),_0x29c48b);logger['debug'](_0xcad7('0x17'),_0x29c48b,JSON['stringify'](_0x412e25));_0x480d68(_0x412e25);})['catch'](function(_0x2c9f4d){logger[_0xcad7('0x12')](_0xcad7('0x17'),_0x2c9f4d[_0xcad7('0x13')],_0x29c48b);_0x31e56d(_0xe0dd90['error'](0x1f4,_0x2c9f4d[_0xcad7('0x13')]));});});}; \ No newline at end of file +var _0x81b8=['include','model','map','then','ShowWhatsappAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','find','options','raw','attributes'];(function(_0x15d756,_0x135c84){var _0x5a3bcc=function(_0x5aee46){while(--_0x5aee46){_0x15d756['push'](_0x15d756['shift']());}};_0x5a3bcc(++_0x135c84);}(_0x81b8,0x1ce));var _0x881b=function(_0x5e9429,_0x1b3a1e){_0x5e9429=_0x5e9429-0x0;var _0xb9a33f=_0x81b8[_0x5e9429];return _0xb9a33f;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var moment=require(_0x881b('0x2'));var BPromise=require(_0x881b('0x3'));var rs=require(_0x881b('0x4'));var fs=require('fs');var Redis=require(_0x881b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x881b('0x6'));var config=require('../../config/environment');var jayson=require(_0x881b('0x7'));var client=jayson[_0x881b('0x8')][_0x881b('0x9')]({'port':0x232a});config[_0x881b('0xa')]=_[_0x881b('0xb')](config['redis'],{'host':_0x881b('0xc'),'port':0x18eb});var socket=require(_0x881b('0xd'))(new Redis(config['redis']));require(_0x881b('0xe'))[_0x881b('0xf')](socket);function respondWithRpcPromise(_0x38b88e,_0x545e88,_0x1c7729){return new BPromise(function(_0x447d95,_0x14aafd){return client[_0x881b('0x10')](_0x38b88e,_0x1c7729)['then'](function(_0x234aa4){logger[_0x881b('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x545e88,_0x881b('0x12'));logger['debug'](_0x881b('0x13'),_0x545e88,_0x881b('0x12'),JSON[_0x881b('0x14')](_0x234aa4));if(_0x234aa4[_0x881b('0x15')]){if(_0x234aa4[_0x881b('0x15')][_0x881b('0x16')]===0x1f4){logger[_0x881b('0x15')](_0x881b('0x17'),_0x545e88,_0x234aa4[_0x881b('0x15')][_0x881b('0x18')]);return _0x14aafd(_0x234aa4[_0x881b('0x15')][_0x881b('0x18')]);}logger[_0x881b('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x545e88,_0x234aa4['error'][_0x881b('0x18')]);return _0x447d95(_0x234aa4['error']['message']);}else{logger[_0x881b('0x11')](_0x881b('0x17'),_0x545e88,_0x881b('0x12'));_0x447d95(_0x234aa4[_0x881b('0x19')][_0x881b('0x18')]);}})[_0x881b('0x1a')](function(_0x415852){logger['error'](_0x881b('0x17'),_0x545e88,_0x415852);_0x14aafd(_0x415852);});});}exports['ShowWhatsappAccount']=function(_0x279cc0){var _0x279b6b=this;return new Promise(function(_0x5e9af8,_0x3d86d8){return db[_0x881b('0x1b')][_0x881b('0x1c')]({'raw':_0x279cc0[_0x881b('0x1d')]?_0x279cc0['options'][_0x881b('0x1e')]===undefined?!![]:![]:!![],'where':_0x279cc0[_0x881b('0x1d')]?_0x279cc0['options']['where']||null:null,'attributes':_0x279cc0['options']?_0x279cc0[_0x881b('0x1d')][_0x881b('0x1f')]||null:null,'include':_0x279cc0[_0x881b('0x1d')]?_0x279cc0[_0x881b('0x1d')][_0x881b('0x20')]?_['map'](_0x279cc0[_0x881b('0x1d')][_0x881b('0x20')],function(_0x61bcd8){return{'model':db[_0x61bcd8[_0x881b('0x21')]],'as':_0x61bcd8['as'],'attributes':_0x61bcd8['attributes'],'include':_0x61bcd8[_0x881b('0x20')]?_[_0x881b('0x22')](_0x61bcd8[_0x881b('0x20')],function(_0x49b4af){return{'model':db[_0x49b4af['model']],'as':_0x49b4af['as'],'attributes':_0x49b4af[_0x881b('0x1f')],'include':_0x49b4af[_0x881b('0x20')]?_['map'](_0x49b4af[_0x881b('0x20')],function(_0x7d6859){return{'model':db[_0x7d6859[_0x881b('0x21')]],'as':_0x7d6859['as'],'attributes':_0x7d6859['attributes']};}):[]};}):[]};}):[]:[]})[_0x881b('0x23')](function(_0x2e0561){logger[_0x881b('0x11')](_0x881b('0x24'),_0x279cc0);logger[_0x881b('0x25')](_0x881b('0x24'),_0x279cc0,JSON['stringify'](_0x2e0561));_0x5e9af8(_0x2e0561);})['catch'](function(_0x2efd0c){logger['error'](_0x881b('0x24'),_0x2efd0c[_0x881b('0x18')],_0x279cc0);_0x3d86d8(_0x279b6b[_0x881b('0x15')](0x1f4,_0x2efd0c[_0x881b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f7088e9..29d1f32 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 _0x89ab=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','length'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0x89ab,0xaf));var _0xb89a=function(_0xbb8360,_0xc758e9){_0xbb8360=_0xbb8360-0x0;var _0x2476ef=_0x89ab[_0xbb8360];return _0x2476ef;};'use strict';var WhatsappAccountEvents=require(_0xb89a('0x0'));var events=[_0xb89a('0x1'),_0xb89a('0x2'),'update'];function createListener(_0x484a02,_0x5648ca){return function(_0x39184a){_0x5648ca[_0xb89a('0x3')](_0x484a02,_0x39184a);};}function removeListener(_0x484eb1,_0xbdfc6b){return function(){WhatsappAccountEvents['removeListener'](_0x484eb1,_0xbdfc6b);};}exports['register']=function(_0x4df6be){for(var _0x23565e=0x0,_0x2d7f83=events[_0xb89a('0x4')];_0x23565e<_0x2d7f83;_0x23565e++){var _0x3391c0=events[_0x23565e];var _0x4b300c=createListener(_0xb89a('0x5')+_0x3391c0,_0x4df6be);WhatsappAccountEvents['on'](_0x3391c0,_0x4b300c);}}; \ No newline at end of file +var _0x1fb3=['register','length','whatsappAccount:','save','remove','update','emit','removeListener'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0x1fb3,0xeb));var _0x31fb=function(_0x4fcbdb,_0xd92d3f){_0x4fcbdb=_0x4fcbdb-0x0;var _0x2a8e78=_0x1fb3[_0x4fcbdb];return _0x2a8e78;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x31fb('0x0'),_0x31fb('0x1'),_0x31fb('0x2')];function createListener(_0x5027b4,_0x2e6188){return function(_0x2a3a51){_0x2e6188[_0x31fb('0x3')](_0x5027b4,_0x2a3a51);};}function removeListener(_0x5b6a62,_0x11681d){return function(){WhatsappAccountEvents[_0x31fb('0x4')](_0x5b6a62,_0x11681d);};}exports[_0x31fb('0x5')]=function(_0x1daddc){for(var _0x19efd7=0x0,_0x2849a3=events[_0x31fb('0x6')];_0x19efd7<_0x2849a3;_0x19efd7++){var _0x360520=events[_0x19efd7];var _0xc2d270=createListener(_0x31fb('0x7')+_0x360520,_0x1daddc);WhatsappAccountEvents['on'](_0x360520,_0xc2d270);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 89fe624..e9987e1 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 _0x015c=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x267893,_0x32e5b7){var _0x1d0bbd=function(_0xb4d3f4){while(--_0xb4d3f4){_0x267893['push'](_0x267893['shift']());}};_0x1d0bbd(++_0x32e5b7);}(_0x015c,0xaf));var _0xc015=function(_0x2c4808,_0x2f2a0a){_0x2c4808=_0x2c4808-0x0;var _0x1829f5=_0x015c[_0x2c4808];return _0x1829f5;};'use strict';var multer=require(_0xc015('0x0'));var util=require(_0xc015('0x1'));var path=require(_0xc015('0x2'));var timeout=require(_0xc015('0x3'));var express=require(_0xc015('0x4'));var router=express[_0xc015('0x5')]();var fs_extra=require(_0xc015('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc015('0x7'));var config=require(_0xc015('0x8'));var controller=require(_0xc015('0x9'));router['get']('/',auth[_0xc015('0xa')](),controller[_0xc015('0xb')]);router[_0xc015('0xc')](_0xc015('0xd'),auth[_0xc015('0xa')](),controller[_0xc015('0xe')]);router[_0xc015('0xf')]('/',auth[_0xc015('0xa')](),controller[_0xc015('0x10')]);router[_0xc015('0x11')](_0xc015('0xd'),auth[_0xc015('0xa')](),controller[_0xc015('0x12')]);router['delete'](_0xc015('0xd'),auth[_0xc015('0xa')](),controller[_0xc015('0x13')]);module[_0xc015('0x14')]=router; \ No newline at end of file +var _0x28f9=['destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x234da0,_0x5cbfb9){var _0x2f2124=function(_0x513cca){while(--_0x513cca){_0x234da0['push'](_0x234da0['shift']());}};_0x2f2124(++_0x5cbfb9);}(_0x28f9,0xbc));var _0x928f=function(_0x4da1f4,_0x14a3c2){_0x4da1f4=_0x4da1f4-0x0;var _0x566565=_0x28f9[_0x4da1f4];return _0x566565;};'use strict';var multer=require('multer');var util=require(_0x928f('0x0'));var path=require(_0x928f('0x1'));var timeout=require(_0x928f('0x2'));var express=require(_0x928f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x928f('0x4'));var interaction=require(_0x928f('0x5'));var config=require(_0x928f('0x6'));var controller=require(_0x928f('0x7'));router[_0x928f('0x8')]('/',auth[_0x928f('0x9')](),controller['index']);router['get'](_0x928f('0xa'),auth[_0x928f('0x9')](),controller[_0x928f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x928f('0xc')]);router[_0x928f('0xd')]('/:id',auth[_0x928f('0x9')](),controller[_0x928f('0xe')]);router[_0x928f('0xf')](_0x928f('0xa'),auth[_0x928f('0x9')](),controller[_0x928f('0x10')]);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 1e20148..aa7b692 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 _0xe910=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x2b2060,_0x389211){var _0x5492a4=function(_0x215d1e){while(--_0x215d1e){_0x2b2060['push'](_0x2b2060['shift']());}};_0x5492a4(++_0x389211);}(_0xe910,0xb2));var _0x0e91=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xe910[_0x33fcbb];return _0x2efe40;};'use strict';var Sequelize=require(_0x0e91('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0e91('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0e91('0x2')],'allowNull':![],'defaultValue':_0x0e91('0x3')},'appdata':{'type':Sequelize[_0x0e91('0x4')]()},'description':{'type':Sequelize[_0x0e91('0x2')]},'interval':{'type':Sequelize[_0x0e91('0x2')],'defaultValue':_0x0e91('0x5')}}; \ No newline at end of file +var _0xfa20=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0xfa20,0xf9));var _0x0fa2=function(_0x433cbe,_0x1e2ce5){_0x433cbe=_0x433cbe-0x0;var _0x110b24=_0xfa20[_0x433cbe];return _0x110b24;};'use strict';var Sequelize=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]={'priority':{'type':Sequelize[_0x0fa2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0fa2('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0fa2('0x4')]()},'description':{'type':Sequelize[_0x0fa2('0x3')]},'interval':{'type':Sequelize[_0x0fa2('0x3')],'defaultValue':_0x0fa2('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 32b4fb5..7c1be98 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 _0x3c85=['jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x2a727c,_0x2d48c4){var _0x519a2e=function(_0x220fbf){while(--_0x220fbf){_0x2a727c['push'](_0x2a727c['shift']());}};_0x519a2e(++_0x2d48c4);}(_0x3c85,0x1a0));var _0x53c8=function(_0x34310c,_0x53b7bd){_0x34310c=_0x34310c-0x0;var _0x24c30c=_0x3c85[_0x34310c];return _0x24c30c;};'use strict';var emlformat=require(_0x53c8('0x0'));var rimraf=require(_0x53c8('0x1'));var zipdir=require(_0x53c8('0x2'));var jsonpatch=require(_0x53c8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53c8('0x4'));var Mustache=require(_0x53c8('0x5'));var util=require(_0x53c8('0x6'));var path=require('path');var sox=require(_0x53c8('0x7'));var csv=require(_0x53c8('0x8'));var ejs=require(_0x53c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53c8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53c8('0xb'));var Papa=require(_0x53c8('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x53c8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c8('0xe'));var utils=require(_0x53c8('0xf'));var config=require(_0x53c8('0x10'));var licenseUtil=require(_0x53c8('0x11'));var db=require(_0x53c8('0x12'))['db'];function respondWithStatusCode(_0x499ba8,_0x2ccf50){_0x2ccf50=_0x2ccf50||0xcc;return function(_0x3231f6){if(_0x3231f6){return _0x499ba8[_0x53c8('0x13')](_0x2ccf50);}return _0x499ba8['status'](_0x2ccf50)[_0x53c8('0x14')]();};}function respondWithResult(_0x31979e,_0x5a9f7f){_0x5a9f7f=_0x5a9f7f||0xc8;return function(_0x132777){if(_0x132777){return _0x31979e[_0x53c8('0x15')](_0x5a9f7f)[_0x53c8('0x16')](_0x132777);}};}function respondWithFilteredResult(_0xb13c1f,_0x30ff54){return function(_0x1c037f){if(_0x1c037f){var _0x385c39=typeof _0x30ff54[_0x53c8('0x17')]===_0x53c8('0x18')&&typeof _0x30ff54[_0x53c8('0x19')]===_0x53c8('0x18');var _0x44d6e4=_0x1c037f[_0x53c8('0x1a')];var _0x297f98=_0x385c39?0x0:_0x30ff54[_0x53c8('0x17')];var _0x4551b9=_0x385c39?_0x1c037f['count']:_0x30ff54['offset']+_0x30ff54[_0x53c8('0x19')];var _0x1a006c;if(_0x4551b9>=_0x44d6e4){_0x4551b9=_0x44d6e4;_0x1a006c=0xc8;}else{_0x1a006c=0xce;}_0xb13c1f[_0x53c8('0x15')](_0x1a006c);return _0xb13c1f[_0x53c8('0x1b')]('Content-Range',_0x297f98+'-'+_0x4551b9+'/'+_0x44d6e4)[_0x53c8('0x16')](_0x1c037f);}return null;};}function patchUpdates(_0x333990){return function(_0x40cc4c){try{jsonpatch[_0x53c8('0x1c')](_0x40cc4c,_0x333990,!![]);}catch(_0x12190e){return BPromise[_0x53c8('0x1d')](_0x12190e);}return _0x40cc4c[_0x53c8('0x1e')]();};}function saveUpdates(_0x54c1de,_0x1cf910){return function(_0x5b67d5){if(_0x5b67d5){return _0x5b67d5[_0x53c8('0x1f')](_0x54c1de)[_0x53c8('0x20')](function(_0xc329e8){return _0xc329e8;});}return null;};}function removeEntity(_0x2b024,_0x4cb9cb){return function(_0x3b2556){if(_0x3b2556){return _0x3b2556[_0x53c8('0x21')]()[_0x53c8('0x20')](function(){_0x2b024[_0x53c8('0x15')](0xcc)[_0x53c8('0x14')]();});}};}function handleEntityNotFound(_0x454bc5,_0x424211){return function(_0x11c6ca){if(!_0x11c6ca){_0x454bc5[_0x53c8('0x13')](0x194);}return _0x11c6ca;};}function handleError(_0x2821ad,_0x5e9265){_0x5e9265=_0x5e9265||0x1f4;return function(_0x1fe7e4){logger['error'](_0x1fe7e4['stack']);if(_0x1fe7e4[_0x53c8('0x22')]){delete _0x1fe7e4[_0x53c8('0x22')];}_0x2821ad[_0x53c8('0x15')](_0x5e9265)[_0x53c8('0x23')](_0x1fe7e4);};}exports[_0x53c8('0x24')]=function(_0x3f2c72,_0x320293){var _0x4031ba={},_0xf11181={},_0x6aa920={'count':0x0,'rows':[]};var _0x178992=_[_0x53c8('0x25')](db[_0x53c8('0x26')][_0x53c8('0x27')],function(_0x14e750){return{'name':_0x14e750[_0x53c8('0x28')],'type':_0x14e750[_0x53c8('0x29')][_0x53c8('0x2a')]};});_0xf11181[_0x53c8('0x2b')]=_['map'](_0x178992,_0x53c8('0x22'));_0xf11181[_0x53c8('0x2c')]=_[_0x53c8('0x2d')](_0x3f2c72['query']);_0xf11181[_0x53c8('0x2e')]=_[_0x53c8('0x2f')](_0xf11181[_0x53c8('0x2b')],_0xf11181[_0x53c8('0x2c')]);_0x4031ba['attributes']=_['intersection'](_0xf11181[_0x53c8('0x2b')],qs[_0x53c8('0x30')](_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x30')]));_0x4031ba[_0x53c8('0x31')]=_0x4031ba['attributes'][_0x53c8('0x32')]?_0x4031ba['attributes']:_0xf11181[_0x53c8('0x2b')];if(!_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x33')](_0x53c8('0x34'))){_0x4031ba['limit']=qs['limit'](_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x19')]);_0x4031ba[_0x53c8('0x17')]=qs[_0x53c8('0x17')](_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x17')]);}_0x4031ba[_0x53c8('0x35')]=qs[_0x53c8('0x36')](_0x3f2c72['query'][_0x53c8('0x36')]);_0x4031ba[_0x53c8('0x37')]=qs['filters'](_[_0x53c8('0x38')](_0x3f2c72[_0x53c8('0x2c')],_0xf11181[_0x53c8('0x2e')]),_0x178992);if(_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x39')]){_0x4031ba[_0x53c8('0x37')]=_[_0x53c8('0x3a')](_0x4031ba['where'],{'$or':_['map'](_0x178992,function(_0x5a3691){if(_0x5a3691[_0x53c8('0x29')]!==_0x53c8('0x3b')){var _0x13f787={};_0x13f787[_0x5a3691[_0x53c8('0x22')]]={'$like':'%'+_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x39')]+'%'};return _0x13f787;}})});}_0x4031ba=_[_0x53c8('0x3a')]({},_0x4031ba,_0x3f2c72[_0x53c8('0x3c')]);var _0xf4c9b={'where':_0x4031ba[_0x53c8('0x37')]};return db[_0x53c8('0x26')][_0x53c8('0x1a')](_0xf4c9b)[_0x53c8('0x20')](function(_0x1d61e9){_0x6aa920[_0x53c8('0x1a')]=_0x1d61e9;if(_0x3f2c72[_0x53c8('0x2c')][_0x53c8('0x3d')]){_0x4031ba[_0x53c8('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x53c8('0x3f')](_0x4031ba);})[_0x53c8('0x20')](function(_0x3f47a9){_0x6aa920[_0x53c8('0x40')]=_0x3f47a9;return _0x6aa920;})[_0x53c8('0x20')](respondWithFilteredResult(_0x320293,_0x4031ba))[_0x53c8('0x41')](handleError(_0x320293,null));};exports[_0x53c8('0x42')]=function(_0x146878,_0x4d772e){var _0x3ba6dd={'raw':!![],'where':{'id':_0x146878[_0x53c8('0x43')]['id']}},_0x284d91={};_0x284d91[_0x53c8('0x2b')]=_[_0x53c8('0x2d')](db[_0x53c8('0x26')][_0x53c8('0x27')]);_0x284d91[_0x53c8('0x2c')]=_[_0x53c8('0x2d')](_0x146878[_0x53c8('0x2c')]);_0x284d91[_0x53c8('0x2e')]=_[_0x53c8('0x2f')](_0x284d91[_0x53c8('0x2b')],_0x284d91[_0x53c8('0x2c')]);_0x3ba6dd['attributes']=_[_0x53c8('0x2f')](_0x284d91[_0x53c8('0x2b')],qs['fields'](_0x146878['query'][_0x53c8('0x30')]));_0x3ba6dd['attributes']=_0x3ba6dd[_0x53c8('0x31')]['length']?_0x3ba6dd[_0x53c8('0x31')]:_0x284d91[_0x53c8('0x2b')];if(_0x146878[_0x53c8('0x2c')][_0x53c8('0x3d')]){_0x3ba6dd['include']=[{'all':!![]}];}_0x3ba6dd=_['merge']({},_0x3ba6dd,_0x146878['options']);return db[_0x53c8('0x26')][_0x53c8('0x44')](_0x3ba6dd)[_0x53c8('0x20')](handleEntityNotFound(_0x4d772e,null))[_0x53c8('0x20')](respondWithResult(_0x4d772e,null))[_0x53c8('0x41')](handleError(_0x4d772e,null));};exports['create']=function(_0x3fe863,_0x13d1e0){return db[_0x53c8('0x26')][_0x53c8('0x45')](_0x3fe863[_0x53c8('0x46')],{})['then'](respondWithResult(_0x13d1e0,0xc9))[_0x53c8('0x41')](handleError(_0x13d1e0,null));};exports[_0x53c8('0x1f')]=function(_0x487189,_0x143a5a){if(_0x487189[_0x53c8('0x46')]['id']){delete _0x487189[_0x53c8('0x46')]['id'];}return db[_0x53c8('0x26')][_0x53c8('0x44')]({'where':{'id':_0x487189['params']['id']}})['then'](handleEntityNotFound(_0x143a5a,null))['then'](saveUpdates(_0x487189['body'],null))[_0x53c8('0x20')](respondWithResult(_0x143a5a,null))[_0x53c8('0x41')](handleError(_0x143a5a,null));};exports[_0x53c8('0x21')]=function(_0x4809e,_0x52de94){return db[_0x53c8('0x26')][_0x53c8('0x44')]({'where':{'id':_0x4809e[_0x53c8('0x43')]['id']}})[_0x53c8('0x20')](handleEntityNotFound(_0x52de94,null))[_0x53c8('0x20')](removeEntity(_0x52de94,null))[_0x53c8('0x41')](handleError(_0x52de94,null));}; \ No newline at end of file +var _0xe785=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','create','body','find'];(function(_0x1e7587,_0x55b4ed){var _0x513e2b=function(_0x26c763){while(--_0x26c763){_0x1e7587['push'](_0x1e7587['shift']());}};_0x513e2b(++_0x55b4ed);}(_0xe785,0x128));var _0x5e78=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0xe785[_0x3f042c];return _0x280d2e;};'use strict';var emlformat=require(_0x5e78('0x0'));var rimraf=require(_0x5e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e78('0x2'));var rp=require(_0x5e78('0x3'));var moment=require(_0x5e78('0x4'));var BPromise=require(_0x5e78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e78('0x6'));var sox=require(_0x5e78('0x7'));var csv=require(_0x5e78('0x8'));var ejs=require(_0x5e78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e78('0xa'));var crypto=require(_0x5e78('0xb'));var jsforce=require(_0x5e78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e78('0x8'));var querystring=require('querystring');var Papa=require(_0x5e78('0xd'));var Redis=require('ioredis');var authService=require(_0x5e78('0xe'));var qs=require(_0x5e78('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e78('0x10'));var logger=require(_0x5e78('0x11'))(_0x5e78('0x12'));var utils=require(_0x5e78('0x13'));var config=require(_0x5e78('0x14'));var licenseUtil=require(_0x5e78('0x15'));var db=require(_0x5e78('0x16'))['db'];function respondWithStatusCode(_0x53edaa,_0x46b082){_0x46b082=_0x46b082||0xcc;return function(_0x104712){if(_0x104712){return _0x53edaa[_0x5e78('0x17')](_0x46b082);}return _0x53edaa['status'](_0x46b082)[_0x5e78('0x18')]();};}function respondWithResult(_0x2528ba,_0x9e71a4){_0x9e71a4=_0x9e71a4||0xc8;return function(_0x1e49bf){if(_0x1e49bf){return _0x2528ba['status'](_0x9e71a4)[_0x5e78('0x19')](_0x1e49bf);}};}function respondWithFilteredResult(_0x60a88d,_0x1e39e2){return function(_0xc0786e){if(_0xc0786e){var _0x399424=typeof _0x1e39e2[_0x5e78('0x1a')]==='undefined'&&typeof _0x1e39e2['limit']===_0x5e78('0x1b');var _0x263109=_0xc0786e[_0x5e78('0x1c')];var _0x5d6063=_0x399424?0x0:_0x1e39e2['offset'];var _0x53f6a8=_0x399424?_0xc0786e['count']:_0x1e39e2[_0x5e78('0x1a')]+_0x1e39e2[_0x5e78('0x1d')];var _0xe0ccf4;if(_0x53f6a8>=_0x263109){_0x53f6a8=_0x263109;_0xe0ccf4=0xc8;}else{_0xe0ccf4=0xce;}_0x60a88d[_0x5e78('0x1e')](_0xe0ccf4);return _0x60a88d[_0x5e78('0x1f')](_0x5e78('0x20'),_0x5d6063+'-'+_0x53f6a8+'/'+_0x263109)['json'](_0xc0786e);}return null;};}function patchUpdates(_0xa20b19){return function(_0x2b3f5e){try{jsonpatch[_0x5e78('0x21')](_0x2b3f5e,_0xa20b19,!![]);}catch(_0x10166e){return BPromise[_0x5e78('0x22')](_0x10166e);}return _0x2b3f5e[_0x5e78('0x23')]();};}function saveUpdates(_0xbab14d,_0x39e685){return function(_0x56a804){if(_0x56a804){return _0x56a804[_0x5e78('0x24')](_0xbab14d)[_0x5e78('0x25')](function(_0x5d001a){return _0x5d001a;});}return null;};}function removeEntity(_0x341429,_0x1e4e03){return function(_0x3e297e){if(_0x3e297e){return _0x3e297e[_0x5e78('0x26')]()[_0x5e78('0x25')](function(){_0x341429['status'](0xcc)[_0x5e78('0x18')]();});}};}function handleEntityNotFound(_0x874a24,_0x454404){return function(_0x3b39f4){if(!_0x3b39f4){_0x874a24[_0x5e78('0x17')](0x194);}return _0x3b39f4;};}function handleError(_0x341b1e,_0x441b9f){_0x441b9f=_0x441b9f||0x1f4;return function(_0xced025){logger['error'](_0xced025[_0x5e78('0x27')]);if(_0xced025[_0x5e78('0x28')]){delete _0xced025['name'];}_0x341b1e['status'](_0x441b9f)[_0x5e78('0x29')](_0xced025);};}exports['index']=function(_0x8d0a4a,_0x24713c){var _0x4872c5={},_0x1ac4fe={},_0x42db02={'count':0x0,'rows':[]};var _0x54a558=_[_0x5e78('0x2a')](db['WhatsappApplication'][_0x5e78('0x2b')],function(_0x2b27be){return{'name':_0x2b27be[_0x5e78('0x2c')],'type':_0x2b27be[_0x5e78('0x2d')]['key']};});_0x1ac4fe[_0x5e78('0x2e')]=_['map'](_0x54a558,_0x5e78('0x28'));_0x1ac4fe['query']=_[_0x5e78('0x2f')](_0x8d0a4a[_0x5e78('0x30')]);_0x1ac4fe[_0x5e78('0x31')]=_['intersection'](_0x1ac4fe[_0x5e78('0x2e')],_0x1ac4fe[_0x5e78('0x30')]);_0x4872c5['attributes']=_[_0x5e78('0x32')](_0x1ac4fe['model'],qs[_0x5e78('0x33')](_0x8d0a4a[_0x5e78('0x30')]['fields']));_0x4872c5[_0x5e78('0x34')]=_0x4872c5[_0x5e78('0x34')][_0x5e78('0x35')]?_0x4872c5[_0x5e78('0x34')]:_0x1ac4fe[_0x5e78('0x2e')];if(!_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x36')](_0x5e78('0x37'))){_0x4872c5[_0x5e78('0x1d')]=qs['limit'](_0x8d0a4a[_0x5e78('0x30')]['limit']);_0x4872c5[_0x5e78('0x1a')]=qs['offset'](_0x8d0a4a[_0x5e78('0x30')]['offset']);}_0x4872c5[_0x5e78('0x38')]=qs[_0x5e78('0x39')](_0x8d0a4a[_0x5e78('0x30')]['sort']);_0x4872c5[_0x5e78('0x3a')]=qs[_0x5e78('0x31')](_['pick'](_0x8d0a4a['query'],_0x1ac4fe[_0x5e78('0x31')]),_0x54a558);if(_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x3b')]){_0x4872c5[_0x5e78('0x3a')]=_[_0x5e78('0x3c')](_0x4872c5[_0x5e78('0x3a')],{'$or':_[_0x5e78('0x2a')](_0x54a558,function(_0x215631){if(_0x215631[_0x5e78('0x2d')]!==_0x5e78('0x3d')){var _0x38b083={};_0x38b083[_0x215631['name']]={'$like':'%'+_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x3b')]+'%'};return _0x38b083;}})});}_0x4872c5=_[_0x5e78('0x3c')]({},_0x4872c5,_0x8d0a4a[_0x5e78('0x3e')]);var _0x5a0115={'where':_0x4872c5[_0x5e78('0x3a')]};return db[_0x5e78('0x3f')][_0x5e78('0x1c')](_0x5a0115)[_0x5e78('0x25')](function(_0x450974){_0x42db02[_0x5e78('0x1c')]=_0x450974;if(_0x8d0a4a['query'][_0x5e78('0x40')]){_0x4872c5[_0x5e78('0x41')]=[{'all':!![]}];}return db[_0x5e78('0x3f')][_0x5e78('0x42')](_0x4872c5);})[_0x5e78('0x25')](function(_0x4d1ed6){_0x42db02[_0x5e78('0x43')]=_0x4d1ed6;return _0x42db02;})['then'](respondWithFilteredResult(_0x24713c,_0x4872c5))[_0x5e78('0x44')](handleError(_0x24713c,null));};exports[_0x5e78('0x45')]=function(_0x50f558,_0x1b8ccc){var _0x223cde={'raw':!![],'where':{'id':_0x50f558[_0x5e78('0x46')]['id']}},_0x525a3e={};_0x525a3e[_0x5e78('0x2e')]=_[_0x5e78('0x2f')](db['WhatsappApplication'][_0x5e78('0x2b')]);_0x525a3e['query']=_[_0x5e78('0x2f')](_0x50f558[_0x5e78('0x30')]);_0x525a3e[_0x5e78('0x31')]=_[_0x5e78('0x32')](_0x525a3e['model'],_0x525a3e[_0x5e78('0x30')]);_0x223cde[_0x5e78('0x34')]=_['intersection'](_0x525a3e['model'],qs[_0x5e78('0x33')](_0x50f558[_0x5e78('0x30')][_0x5e78('0x33')]));_0x223cde[_0x5e78('0x34')]=_0x223cde[_0x5e78('0x34')]['length']?_0x223cde[_0x5e78('0x34')]:_0x525a3e[_0x5e78('0x2e')];if(_0x50f558[_0x5e78('0x30')][_0x5e78('0x40')]){_0x223cde[_0x5e78('0x41')]=[{'all':!![]}];}_0x223cde=_['merge']({},_0x223cde,_0x50f558[_0x5e78('0x3e')]);return db[_0x5e78('0x3f')]['find'](_0x223cde)['then'](handleEntityNotFound(_0x1b8ccc,null))['then'](respondWithResult(_0x1b8ccc,null))[_0x5e78('0x44')](handleError(_0x1b8ccc,null));};exports[_0x5e78('0x47')]=function(_0x10462a,_0x29bfc0){return db[_0x5e78('0x3f')]['create'](_0x10462a[_0x5e78('0x48')],{})[_0x5e78('0x25')](respondWithResult(_0x29bfc0,0xc9))[_0x5e78('0x44')](handleError(_0x29bfc0,null));};exports['update']=function(_0x2ae6dd,_0xd6522e){if(_0x2ae6dd[_0x5e78('0x48')]['id']){delete _0x2ae6dd[_0x5e78('0x48')]['id'];}return db[_0x5e78('0x3f')]['find']({'where':{'id':_0x2ae6dd[_0x5e78('0x46')]['id']}})[_0x5e78('0x25')](handleEntityNotFound(_0xd6522e,null))['then'](saveUpdates(_0x2ae6dd[_0x5e78('0x48')],null))[_0x5e78('0x25')](respondWithResult(_0xd6522e,null))[_0x5e78('0x44')](handleError(_0xd6522e,null));};exports[_0x5e78('0x26')]=function(_0x29bd68,_0x2bdf3d){return db[_0x5e78('0x3f')][_0x5e78('0x49')]({'where':{'id':_0x29bd68[_0x5e78('0x46')]['id']}})[_0x5e78('0x25')](handleEntityNotFound(_0x2bdf3d,null))['then'](removeEntity(_0x2bdf3d,null))[_0x5e78('0x44')](handleError(_0x2bdf3d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index aecc8a8..0d91ec4 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 _0x102b=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x503f53,_0x2d1bfd){var _0x1924a9=function(_0xfca88d){while(--_0xfca88d){_0x503f53['push'](_0x503f53['shift']());}};_0x1924a9(++_0x2d1bfd);}(_0x102b,0x1be));var _0xb102=function(_0x1f2299,_0x1ccecf){_0x1f2299=_0x1f2299-0x0;var _0x43e103=_0x102b[_0x1f2299];return _0x43e103;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var logger=require('../../config/logger')(_0xb102('0x1'));var moment=require(_0xb102('0x2'));var BPromise=require(_0xb102('0x3'));var rp=require(_0xb102('0x4'));var fs=require('fs');var path=require(_0xb102('0x5'));var rimraf=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var attributes=require(_0xb102('0x8'));module['exports']=function(_0x3325b7,_0x370baa){return _0x3325b7[_0xb102('0x9')](_0xb102('0xa'),attributes,{'tableName':_0xb102('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb102('0xc')});}; \ No newline at end of file +var _0x43fd=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','moment','bluebird'];(function(_0x3212ab,_0x460399){var _0x3412e4=function(_0x40c8d7){while(--_0x40c8d7){_0x3212ab['push'](_0x3212ab['shift']());}};_0x3412e4(++_0x460399);}(_0x43fd,0x1ec));var _0xd43f=function(_0x45c04a,_0x208355){_0x45c04a=_0x45c04a-0x0;var _0x3cc695=_0x43fd[_0x45c04a];return _0x3cc695;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd43f('0x1'));var BPromise=require(_0xd43f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43f('0x3'));var rimraf=require('rimraf');var config=require(_0xd43f('0x4'));var attributes=require(_0xd43f('0x5'));module[_0xd43f('0x6')]=function(_0x33ddff,_0x52e75f){return _0x33ddff[_0xd43f('0x7')](_0xd43f('0x8'),attributes,{'tableName':_0xd43f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd43f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1ace176..84ff11e 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cfe11,_0x30b1ff){var _0x19312c=function(_0x24bbd3){while(--_0x24bbd3){_0x2cfe11['push'](_0x2cfe11['shift']());}};_0x19312c(++_0x30b1ff);}(_0x17ba,0xab));var _0xa17b=function(_0x4eeb78,_0x5c2c76){_0x4eeb78=_0x4eeb78-0x0;var _0x84aba=_0x17ba[_0x4eeb78];return _0x84aba;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x54e356,_0x360588){var _0xd1b961=function(_0x2ab84f){while(--_0x2ab84f){_0x54e356['push'](_0x54e356['shift']());}};_0xd1b961(++_0x360588);}(_0xa8a8,0xec));var _0x8a8a=function(_0xe20d34,_0x2d817a){_0xe20d34=_0xe20d34-0x0;var _0xf7abe0=_0xa8a8[_0xe20d34];return _0xf7abe0;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 9d185b4..491d7d4 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 _0x7a54=['create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','/:id/messages','getMessages','download','post'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x7a54,0x106));var _0x47a5=function(_0x34555c,_0x163b4e){_0x34555c=_0x34555c-0x0;var _0x17bf12=_0x7a54[_0x34555c];return _0x17bf12;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/download',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0x12')]);router[_0x47a5('0x10')](_0x47a5('0x13'),auth[_0x47a5('0xc')](),interaction[_0x47a5('0x14')](_0x47a5('0x15'),_0x47a5('0x16')),controller[_0x47a5('0x17')]);router['put'](_0x47a5('0x18'),auth[_0x47a5('0xc')](),interaction[_0x47a5('0x14')](_0x47a5('0x15'),_0x47a5('0x19')),controller['update']);router['delete'](_0x47a5('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x47a5('0x15'),_0x47a5('0x1a')),controller[_0x47a5('0x1b')]);router[_0x47a5('0x1c')](_0x47a5('0x13'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1d')]);module[_0x47a5('0x1e')]=router; \ No newline at end of file +var _0x6050=['tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','describe','get','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x395c52,_0x5deff4){var _0x2a5ea4=function(_0x2c9893){while(--_0x2c9893){_0x395c52['push'](_0x395c52['shift']());}};_0x2a5ea4(++_0x5deff4);}(_0x6050,0x196));var _0x0605=function(_0x1db929,_0x2de4c2){_0x1db929=_0x1db929-0x0;var _0x50e042=_0x6050[_0x1db929];return _0x50e042;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['get'](_0x0605('0xf'),auth[_0x0605('0xd')](),controller[_0x0605('0x10')]);router[_0x0605('0xb')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')]('/',auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);router[_0x0605('0x13')](_0x0605('0xf'),auth[_0x0605('0xd')](),controller[_0x0605('0x15')]);router[_0x0605('0x13')](_0x0605('0x16'),auth[_0x0605('0xd')](),interaction[_0x0605('0x17')](_0x0605('0x18'),'whatsappinteraction:addtags'),controller[_0x0605('0x19')]);router[_0x0605('0x1a')](_0x0605('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x0605('0x18'),_0x0605('0x1b')),controller[_0x0605('0x1c')]);router[_0x0605('0x1d')](_0x0605('0xc'),auth[_0x0605('0xd')](),interaction[_0x0605('0x17')](_0x0605('0x18'),_0x0605('0x1e')),controller[_0x0605('0x1f')]);router[_0x0605('0x1d')](_0x0605('0x16'),auth[_0x0605('0xd')](),controller[_0x0605('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d3ff8ca..e621f54 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 _0x2428=['out','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5b8495,_0x612384){var _0x4a280c=function(_0x273019){while(--_0x273019){_0x5b8495['push'](_0x5b8495['shift']());}};_0x4a280c(++_0x612384);}(_0x2428,0xd3));var _0x8242=function(_0x221a48,_0x33c154){_0x221a48=_0x221a48-0x0;var _0xdadcb3=_0x2428[_0x221a48];return _0xdadcb3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8242('0x0'));module[_0x8242('0x1')]={'closed':{'type':Sequelize[_0x8242('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8242('0x3')]},'disposition':{'type':Sequelize[_0x8242('0x4')]},'secondDisposition':{'type':Sequelize[_0x8242('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8242('0x4')]},'note':{'type':Sequelize[_0x8242('0x4')]},'phone':{'type':Sequelize[_0x8242('0x4')]},'read1stAt':{'type':Sequelize[_0x8242('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8242('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8242('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8242('0x5')]('in',_0x8242('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8242('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3079=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x5767b2,_0x4da302){var _0x5c746a=function(_0x518061){while(--_0x518061){_0x5767b2['push'](_0x5767b2['shift']());}};_0x5c746a(++_0x4da302);}(_0x3079,0x110));var _0x9307=function(_0x5ac6d9,_0x28cdea){_0x5ac6d9=_0x5ac6d9-0x0;var _0x3eea6e=_0x3079[_0x5ac6d9];return _0x3eea6e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9307('0x0'));module[_0x9307('0x1')]={'closed':{'type':Sequelize[_0x9307('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9307('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9307('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9307('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9307('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in',_0x9307('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9307('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9fa0a74..fe7678a 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 _0xbedb=['addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','attachments','format','fullname','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','disposition','basename','createReadStream','pipe','createWriteStream','direction','System','out','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','TagIds','Tags','split','push','catch','talking','answered','UserId','waiting','closed','unmanaged','total','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','WhatsappAccountId','toString','sequelize','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','WhatsappInteractionId','all','rows','show','params','includeAll','include','create','describe'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbbed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbed('0x1'));var jsonpatch=require(_0xbbed('0x2'));var rp=require(_0xbbed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbed('0x4'));var util=require(_0xbbed('0x5'));var path=require(_0xbbed('0x6'));var sox=require(_0xbbed('0x7'));var csv=require(_0xbbed('0x8'));var ejs=require(_0xbbed('0x9'));var fs=require('fs');var fs_extra=require(_0xbbed('0xa'));var _=require(_0xbbed('0xb'));var squel=require(_0xbbed('0xc'));var crypto=require(_0xbbed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbed('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbed('0xf'));var Redis=require(_0xbbed('0x10'));var authService=require(_0xbbed('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbbed('0x12'));var hardwareService=require(_0xbbed('0x13'));var logger=require(_0xbbed('0x14'))(_0xbbed('0x15'));var utils=require(_0xbbed('0x16'));var config=require(_0xbbed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbed('0x18'))['db'];config['redis']=_[_0xbbed('0x19')](config[_0xbbed('0x1a')],{'host':_0xbbed('0x1b'),'port':0x18eb});var socket=require(_0xbbed('0x1c'))(new Redis(config[_0xbbed('0x1a')]));require(_0xbbed('0x1d'))[_0xbbed('0x1e')](socket);function respondWithStatusCode(_0x331ffb,_0x79be61){_0x79be61=_0x79be61||0xcc;return function(_0x286048){if(_0x286048){return _0x331ffb['sendStatus'](_0x79be61);}return _0x331ffb[_0xbbed('0x1f')](_0x79be61)['end']();};}function respondWithResult(_0x1b58bc,_0x117e1e){_0x117e1e=_0x117e1e||0xc8;return function(_0xf860ff){if(_0xf860ff){return _0x1b58bc[_0xbbed('0x1f')](_0x117e1e)[_0xbbed('0x20')](_0xf860ff);}};}function respondWithFilteredResult(_0x4bd412,_0x19e9ce){return function(_0x2e1789){if(_0x2e1789){var _0x44fd74=typeof _0x19e9ce[_0xbbed('0x21')]===_0xbbed('0x22')&&typeof _0x19e9ce[_0xbbed('0x23')]===_0xbbed('0x22');var _0x431be1=_0x2e1789[_0xbbed('0x24')];var _0x23549d=_0x44fd74?0x0:_0x19e9ce[_0xbbed('0x21')];var _0xf166a4=_0x44fd74?_0x2e1789[_0xbbed('0x24')]:_0x19e9ce['offset']+_0x19e9ce[_0xbbed('0x23')];var _0x2c3b43;if(_0xf166a4>=_0x431be1){_0xf166a4=_0x431be1;_0x2c3b43=0xc8;}else{_0x2c3b43=0xce;}_0x4bd412[_0xbbed('0x1f')](_0x2c3b43);return _0x4bd412['set'](_0xbbed('0x25'),_0x23549d+'-'+_0xf166a4+'/'+_0x431be1)[_0xbbed('0x20')](_0x2e1789);}return null;};}function patchUpdates(_0x6c6c0b){return function(_0x474ad7){try{jsonpatch['apply'](_0x474ad7,_0x6c6c0b,!![]);}catch(_0x13c422){return BPromise['reject'](_0x13c422);}return _0x474ad7[_0xbbed('0x26')]();};}function saveUpdates(_0x149989,_0x5e8070){return function(_0x34f5e5){if(_0x34f5e5){return _0x34f5e5[_0xbbed('0x27')](_0x149989)[_0xbbed('0x28')](function(_0xe1993e){return _0xe1993e;});}return null;};}function removeEntity(_0x3a77c6,_0x11e140){return function(_0x4fba6e){if(_0x4fba6e){return _0x4fba6e[_0xbbed('0x29')]()['then'](function(){_0x3a77c6[_0xbbed('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc8cdb1,_0x457b58){return function(_0x37db7b){if(!_0x37db7b){_0xc8cdb1[_0xbbed('0x2a')](0x194);}return _0x37db7b;};}function handleError(_0x51ef48,_0x1339b9){_0x1339b9=_0x1339b9||0x1f4;return function(_0x45aff2){logger[_0xbbed('0x2b')](_0x45aff2[_0xbbed('0x2c')]);if(_0x45aff2['name']){delete _0x45aff2[_0xbbed('0x2d')];}_0x51ef48['status'](_0x1339b9)[_0xbbed('0x2e')](_0x45aff2);};}function getInteractionUsers(_0x3294b9,_0x4e0137){return new BPromise(function(_0x35fb77,_0xe9870c){try{if(_0x4e0137[_0x3294b9['id']]){_0x3294b9['Users']=_['map'](_0x4e0137[_0x3294b9['id']],function(_0x495983){return{'id':_0x495983['id'],'fullname':_0x495983['fullname']};});}}catch(_0x5601da){_0xe9870c(_0x5601da);}_0x35fb77(_0x3294b9);});}function getInteractionTags(_0x244ef3,_0x315d02){return new BPromise(function(_0x4bbcba,_0x5a3cf7){try{if(_0x244ef3[_0xbbed('0x2f')]){_0x244ef3[_0xbbed('0x30')]=[];_0x244ef3['TagIds'][_0xbbed('0x31')](',')['forEach'](function(_0x32a061){_0x244ef3[_0xbbed('0x30')][_0xbbed('0x32')](_0x315d02[_0x32a061]);});}delete _0x244ef3['TagIds'];}catch(_0x3f4e96){_0x5a3cf7(_0x3f4e96);}_0x4bbcba(_0x244ef3);});}function updateWhatsappInteraction(_0x1e598c,_0x27a932,_0x3b868f){return new BPromise(function(_0x240280,_0x1f4904){return getInteractionUsers(_0x1e598c,_0x3b868f)['then'](function(_0x3324eb){return getInteractionTags(_0x3324eb,_0x27a932);})['then'](function(_0x50233f){return getStateInteraction(_0x50233f);})[_0xbbed('0x28')](function(_0x5dfc63){_0x240280(_0x5dfc63);})[_0xbbed('0x33')](function(_0x46e494){_0x1f4904(_0x46e494);});});}function getStateInteraction(_0x1ce1b1){return new BPromise(function(_0x259d5a){_0x1ce1b1['waiting']=0x0;_0x1ce1b1[_0xbbed('0x34')]=0x0;_0x1ce1b1[_0xbbed('0x35')]=0x0;_0x1ce1b1['unmanaged']=0x0;_0x1ce1b1['total']=0x0;if(!_0x1ce1b1['closed']&&!_0x1ce1b1[_0xbbed('0x36')]){_0x1ce1b1[_0xbbed('0x37')]+=0x1;}if(!_0x1ce1b1[_0xbbed('0x38')]&&_0x1ce1b1[_0xbbed('0x36')]){_0x1ce1b1[_0xbbed('0x34')]+=0x1;if(_0x1ce1b1[_0xbbed('0x37')]){_0x1ce1b1[_0xbbed('0x37')]-=0x1;}}if(_0x1ce1b1['closed']&&_0x1ce1b1[_0xbbed('0x36')]){_0x1ce1b1[_0xbbed('0x35')]+=0x1;if(_0x1ce1b1[_0xbbed('0x34')]){_0x1ce1b1[_0xbbed('0x34')]-=0x1;}}if(_0x1ce1b1[_0xbbed('0x38')]&&!_0x1ce1b1['UserId']){_0x1ce1b1[_0xbbed('0x39')]+=0x1;if(_0x1ce1b1[_0xbbed('0x37')]){_0x1ce1b1['waiting']-=0x1;}}_0x1ce1b1[_0xbbed('0x3a')]+=0x1;_0x259d5a(_0x1ce1b1);});}exports[_0xbbed('0x3b')]=function(_0x1a8cd6,_0x3850a1){var _0x12bb94={},_0x45f514={},_0x4c4564={'count':0x0,'rows':[]};var _0x584bd1=_[_0xbbed('0x3c')](db['WhatsappInteraction'][_0xbbed('0x3d')],function(_0x552ef9){return{'name':_0x552ef9[_0xbbed('0x3e')],'type':_0x552ef9[_0xbbed('0x3f')][_0xbbed('0x40')]};});_0x45f514[_0xbbed('0x41')]=_[_0xbbed('0x3c')](_0x584bd1,_0xbbed('0x2d'));_0x45f514['query']=_[_0xbbed('0x42')](_0x1a8cd6['query']);_0x45f514[_0xbbed('0x43')]=_[_0xbbed('0x44')](_0x45f514[_0xbbed('0x41')],_0x45f514['query']);_0x12bb94[_0xbbed('0x45')]=_['intersection'](_0x45f514['model'],qs[_0xbbed('0x46')](_0x1a8cd6['query']['fields']));_0x12bb94[_0xbbed('0x45')]=_0x12bb94[_0xbbed('0x45')][_0xbbed('0x47')]?_0x12bb94['attributes']:_0x45f514[_0xbbed('0x41')];if(!_0x1a8cd6[_0xbbed('0x48')]['hasOwnProperty'](_0xbbed('0x49'))){_0x12bb94[_0xbbed('0x23')]=qs[_0xbbed('0x23')](_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x23')]);_0x12bb94[_0xbbed('0x21')]=qs[_0xbbed('0x21')](_0x1a8cd6['query'][_0xbbed('0x21')]);}_0x12bb94[_0xbbed('0x4a')]=qs[_0xbbed('0x4b')](_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x4b')]);_0x12bb94[_0xbbed('0x4c')]=qs['filters'](_[_0xbbed('0x4d')](_0x1a8cd6['query'],_0x45f514['filters']),_0x584bd1);var _0x3d5eeb=[];var _0x42a655=squel['select']()[_0xbbed('0x4e')]('id')[_0xbbed('0x4e')](_0xbbed('0x2d'))['field'](_0xbbed('0x4f'))[_0xbbed('0x50')]('tools_tags');var _0x40a42f=squel[_0xbbed('0x51')]()[_0xbbed('0x4e')](_0xbbed('0x52'))[_0xbbed('0x4e')](_0xbbed('0x53'))[_0xbbed('0x4e')](_0xbbed('0x54'))[_0xbbed('0x50')](_0xbbed('0x55'),'ui')[_0xbbed('0x56')](_0xbbed('0x57'),'u',_0xbbed('0x58'));var _0x15c806=squel[_0xbbed('0x51')]()[_0xbbed('0x50')](_0xbbed('0x59'),'i')[_0xbbed('0x56')](_0xbbed('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xbbed('0x56')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xbbed('0x5b'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xbbed('0x56')](_0xbbed('0x5c'),'me',_0xbbed('0x5d'))[_0xbbed('0x56')](_0xbbed('0x5e'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbbed('0x56')]('tools_tags','t',_0xbbed('0x5f'));var _0x205ec4=squel[_0xbbed('0x60')]();var _0x5f2124=[];var _0x4f231f=squel['expr']();var _0x23c649;if(_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x61')]){_0x23c649=as[_0xbbed('0x62')](_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x61')]);var _0x187897=_0x23c649[_0xbbed('0x63')];for(var _0x6ee0dc=0x0;_0x6ee0dc<_0x23c649[_0xbbed('0x64')][_0xbbed('0x47')];_0x6ee0dc++){var _0x592046=_0x23c649[_0xbbed('0x64')][_0x6ee0dc];var _0x1fd0de='i';var _0x41978b=_[_0xbbed('0x65')](_0x584bd1,[_0xbbed('0x2d'),_0x592046[_0xbbed('0x4e')]]);if(!_0x41978b){switch(_0x592046['field']){case'unreadMessages':if(_0x592046[_0xbbed('0x66')]==0x1){_0x15c806[_0xbbed('0x67')]('`'+_0x592046['field']+_0xbbed('0x68'));}else{_0x15c806[_0xbbed('0x67')]('`'+_0x592046['field']+_0xbbed('0x69'));}break;case _0xbbed('0x6a'):if(_0x592046['operator']===_0xbbed('0x6b')){if(_0x592046[_0xbbed('0x66')][_0xbbed('0x31')]('\x20')[_0xbbed('0x47')]>0x1){_0x205ec4[_0x187897]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbbed('0x6c')](_0x592046[_0xbbed('0x66')]),null);}else{var _0x3f28aa='%'+_0x592046[_0xbbed('0x66')]+'%';_0x205ec4[_0x187897](_0xbbed('0x6d'),_0x3f28aa,_0x3f28aa,_0x3f28aa);}}else{_0x41978b=_['find'](_0x584bd1,['name','ContactId']);_0x592046[_0xbbed('0x4e')]=_0xbbed('0x6e');_0x33d774=as[_0xbbed('0x6f')](_0x1fd0de,_0x41978b[_0xbbed('0x3f')],_0x592046);_0x205ec4[_0x187897](_0x33d774[_0xbbed('0x70')],_0x33d774[_0xbbed('0x66')][_0xbbed('0x71')],_0x33d774[_0xbbed('0x66')][_0xbbed('0x72')]);}break;case'Tag':var _0x307cb0=_0x592046[_0xbbed('0x66')][_0xbbed('0x31')](',')[_0xbbed('0x3c')](function(_0x4e8c4c){return Number(_0x4e8c4c);});_0x307cb0[_0xbbed('0x73')](function(_0x31a6d2){_0x4f231f['or'](_0xbbed('0x74'),'%,'+_0x31a6d2+',%');});_0x5f2124=_[_0xbbed('0x75')](_0x5f2124,_0x307cb0);break;case _0xbbed('0x76'):if(_0x592046[_0xbbed('0x77')]===_0xbbed('0x6b')){_0x205ec4[_0x187897]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x592046[_0xbbed('0x66')]+'%',null);}else{_0x41978b=_[_0xbbed('0x65')](_0x584bd1,['name','UserId']);_0x592046[_0xbbed('0x4e')]=_0xbbed('0x36');_0x33d774=as[_0xbbed('0x6f')](_0x1fd0de,_0x41978b[_0xbbed('0x3f')],_0x592046);_0x205ec4[_0x187897](_0x33d774[_0xbbed('0x70')],_0x33d774['value']['start'],_0x33d774[_0xbbed('0x66')]['end']);}break;case _0xbbed('0x78'):_0x33d774=as['buildExpression']('me',null,_0x592046);_0x205ec4[_0x187897](_0x33d774[_0xbbed('0x70')],_0x33d774['value'][_0xbbed('0x71')],_0x33d774[_0xbbed('0x66')][_0xbbed('0x72')]);break;}}else{var _0x33d774=as[_0xbbed('0x6f')](_0x1fd0de,_0x41978b['type'],_0x592046);_0x205ec4[_0x187897](_0x33d774[_0xbbed('0x70')],_0x33d774[_0xbbed('0x66')][_0xbbed('0x71')],_0x33d774['value'][_0xbbed('0x72')]);}}}else{var _0x409367=_(_0x1a8cd6[_0xbbed('0x48')])[_0xbbed('0x42')]()[_0xbbed('0x3c')](function(_0x570bd1){return _[_0xbbed('0x79')](_0x584bd1,[_0xbbed('0x2d'),_0x570bd1])?_0x570bd1:undefined;})[_0xbbed('0x7a')]()['value']();if(!_[_0xbbed('0x7b')](_0x409367)){_0x409367[_0xbbed('0x73')](function(_0x4b32b1){if(_0x4b32b1==='WhatsappAccountId'){_0x15c806['where'](_0xbbed('0x7c'),[]['concat'](_0x1a8cd6[_0xbbed('0x48')][_0x4b32b1]));}else if(_0x4b32b1===_0xbbed('0x7d')){var _0x43bae8=JSON[_0xbbed('0x7e')](_0x1a8cd6['query'][_0x4b32b1])[_0xbbed('0x7f')];var _0x58cc94=JSON[_0xbbed('0x7e')](_0x1a8cd6[_0xbbed('0x48')][_0x4b32b1])[_0xbbed('0x80')];_0x15c806['where'](_0xbbed('0x81'),_0x43bae8,_0x58cc94);}else{if(_0x1a8cd6[_0xbbed('0x48')][_0x4b32b1]===_0xbbed('0x82')){_0x15c806[_0xbbed('0x4c')]('i.'+_0x4b32b1+'\x20IS\x20NULL');}else{_0x15c806[_0xbbed('0x4c')]('i.'+_0x4b32b1+_0xbbed('0x83'),_0x1a8cd6['query'][_0x4b32b1]);}}});}if(_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x84')]){if(_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x84')]==0x1){_0x15c806[_0xbbed('0x67')](_0xbbed('0x85'));}else{_0x15c806[_0xbbed('0x67')](_0xbbed('0x86'));}}if(_0x1a8cd6[_0xbbed('0x48')]['tag']){_0x5f2124=_[_0xbbed('0x87')](_0x1a8cd6['query'][_0xbbed('0x88')])?_0x1a8cd6['query'][_0xbbed('0x88')]:new Array(_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x88')]);_0x5f2124['forEach'](function(_0x141a15){_0x4f231f['or'](_0xbbed('0x74'),'%,'+_0x141a15+',%');});}if(_0x1a8cd6[_0xbbed('0x48')][_0xbbed('0x89')]){var _0x286723=_0x1a8cd6['query'][_0xbbed('0x89')]['replace']('\x5c','\x5c\x5c')[_0xbbed('0x8a')](/'/g,'\x27\x27');if(qs[_0xbbed('0x8b')](_0x286723)){_0x205ec4['or'](_0xbbed('0x8c'),_0x286723+'%')['or']('i.phone\x20LIKE\x20?',_0x286723+'%');}else{_0x205ec4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbbed('0x6c')](_0x286723))['or'](_0xbbed('0x8d'),_0x286723+'%');}}}_0x15c806[_0xbbed('0x4c')](_0x205ec4);_0x15c806[_0xbbed('0x8e')](_0xbbed('0x8f'));var _0x3b2b94={'type':db[_0xbbed('0x90')][_0xbbed('0x91')][_0xbbed('0x92')],'raw':!![]};var _0x9c03ff=_0x15c806[_0xbbed('0x93')]();_0x9c03ff[_0xbbed('0x4e')]('i.id');_0x9c03ff[_0xbbed('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbbed('0x94'));if(_0x12bb94[_0xbbed('0x4a')]){_0x12bb94['order']['forEach'](function(_0x52d7f9){var _0x33a77a=_0x52d7f9[0x0]===_0xbbed('0x95')?_0x52d7f9[0x0]:'i.'+_0x52d7f9[0x0];_0x15c806[_0xbbed('0x4a')](_0x33a77a,_0x52d7f9[0x1]===_0xbbed('0x96')?![]:!![]);});}if(!_[_0xbbed('0x7b')](_0x5f2124)){_0x15c806[_0xbbed('0x67')](_0x4f231f);_0x9c03ff[_0xbbed('0x4c')](_0xbbed('0x97'),_0x5f2124);}BPromise[_0xbbed('0x98')]()[_0xbbed('0x28')](function(){if(!_0x23c649){if(_0x1a8cd6[_0xbbed('0x48')]['WhatsappAccountId'])return;_0x9c03ff[_0xbbed('0x4c')](_0xbbed('0x99'));_0x15c806[_0xbbed('0x4c')](_0xbbed('0x99'));return;}if(_0x1a8cd6[_0xbbed('0x9a')][_0xbbed('0x9b')]!==_0xbbed('0x9c'))return;return _0x1a8cd6[_0xbbed('0x9a')][_0xbbed('0x9d')]({'attributes':['id'],'raw':!![]})[_0xbbed('0x28')](function(_0x738e42){if(_[_0xbbed('0x7b')](_0x738e42)){_0x9c03ff[_0xbbed('0x4c')](_0xbbed('0x9e'));_0x15c806[_0xbbed('0x4c')](_0xbbed('0x9e'));}else{_0x9c03ff[_0xbbed('0x4c')](_0xbbed('0x7c'),_[_0xbbed('0x3c')](_0x738e42,'id'));_0x15c806[_0xbbed('0x4c')](_0xbbed('0x7c'),_[_0xbbed('0x3c')](_0x738e42,'id'));}});})[_0xbbed('0x28')](function(){if(_0x1a8cd6['user'][_0xbbed('0x9b')]===_0xbbed('0x9c')&&!_0x23c649&&!_0x1a8cd6['query'][_0xbbed('0x9f')])return[];return db['sequelize']['query'](_0x9c03ff[_0xbbed('0xa0')](),_0x3b2b94);})[_0xbbed('0x28')](function(_0x931287){_0x4c4564[_0xbbed('0x24')]=_0x931287[_0xbbed('0x47')];if(_0x4c4564['count']===0x0)return[];return db[_0xbbed('0xa1')][_0xbbed('0x48')](_0x42a655[_0xbbed('0xa0')](),_0x3b2b94)[_0xbbed('0x28')](function(_0x58f811){_0x3d5eeb=_['keyBy'](_0x58f811,'id');_0x3b2b94=_[_0xbbed('0xa2')](_0x3b2b94,{'model':db[_0xbbed('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a8cd6['query'][_0xbbed('0x46')]){_0x12bb94[_0xbbed('0x45')][_0xbbed('0x73')](function(_0xebae5e){_0x15c806[_0xbbed('0x4e')]('i.'+_0xebae5e);});}else{_0x15c806[_0xbbed('0x4e')](_0xbbed('0xa4'),'unreadMessages');_0x15c806[_0xbbed('0x4e')](_0xbbed('0xa5'),_0xbbed('0xa6'));_0x15c806[_0xbbed('0x4e')](_0xbbed('0xa7'),_0xbbed('0xa8'));_0x15c806[_0xbbed('0x4e')](_0xbbed('0xa9'),'contactName');_0x15c806[_0xbbed('0x4e')](_0xbbed('0xaa'));_0x15c806[_0xbbed('0x4e')](_0xbbed('0xab'),_0xbbed('0xac'));_0x15c806[_0xbbed('0x4e')]('c.lastName',_0xbbed('0xad'));_0x15c806['field'](_0xbbed('0xae'),'Contact.email');_0x15c806['field'](_0xbbed('0xaf'),_0xbbed('0xb0'));_0x15c806['field'](_0xbbed('0xb1'),_0xbbed('0xb2'));_0x15c806['field'](_0xbbed('0xb3'),_0xbbed('0xb4'));_0x15c806[_0xbbed('0x4e')](_0xbbed('0xb5'),_0xbbed('0xb6'));_0x15c806['field'](_0xbbed('0xb7'),'Owner.internal');_0x15c806[_0xbbed('0x4e')](_0xbbed('0xb8'),_0xbbed('0x2f'));}if(_0x12bb94[_0xbbed('0x23')])_0x15c806['limit'](_0x12bb94[_0xbbed('0x23')]);if(_0x12bb94[_0xbbed('0x21')])_0x15c806[_0xbbed('0x21')](_0x12bb94[_0xbbed('0x21')]);return db[_0xbbed('0xa1')][_0xbbed('0x48')](_0x15c806['toString'](),_0x3b2b94);})[_0xbbed('0x28')](function(_0x5e1801){if(_0x5e1801[_0xbbed('0x47')]>0x0)_0x40a42f[_0xbbed('0x4c')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xbbed('0x3c')](_0x5e1801,'id'));return db[_0xbbed('0xa1')][_0xbbed('0x48')](_0x40a42f[_0xbbed('0xa0')](),_0x3b2b94)[_0xbbed('0x28')](function(_0x2c0c03){var _0x211682=_['groupBy'](_0x2c0c03,_0xbbed('0xb9'));var _0x7b21ce=[];_0x5e1801[_0xbbed('0x73')](function(_0x5a045b){_0x7b21ce[_0xbbed('0x32')](updateWhatsappInteraction(_0x5a045b,_0x3d5eeb,_0x211682));});return BPromise[_0xbbed('0xba')](_0x7b21ce);});});})['then'](function(_0x27f828){_0x4c4564[_0xbbed('0xbb')]=_0x27f828;return _0x4c4564;})['then'](respondWithFilteredResult(_0x3850a1,_0x12bb94))['catch'](handleError(_0x3850a1,null));};exports[_0xbbed('0xbc')]=function(_0x151e1c,_0xab7883){var _0x2ebc0e={'raw':![],'where':{'id':_0x151e1c[_0xbbed('0xbd')]['id']}},_0x390a74={};_0x390a74[_0xbbed('0x41')]=_[_0xbbed('0x42')](db[_0xbbed('0xa3')][_0xbbed('0x3d')]);_0x390a74[_0xbbed('0x48')]=_[_0xbbed('0x42')](_0x151e1c[_0xbbed('0x48')]);_0x390a74[_0xbbed('0x43')]=_[_0xbbed('0x44')](_0x390a74[_0xbbed('0x41')],_0x390a74[_0xbbed('0x48')]);_0x2ebc0e[_0xbbed('0x45')]=_[_0xbbed('0x44')](_0x390a74[_0xbbed('0x41')],qs[_0xbbed('0x46')](_0x151e1c[_0xbbed('0x48')]['fields']));_0x2ebc0e[_0xbbed('0x45')]=_0x2ebc0e[_0xbbed('0x45')]['length']?_0x2ebc0e[_0xbbed('0x45')]:_0x390a74[_0xbbed('0x41')];if(_0x151e1c['query'][_0xbbed('0xbe')]){_0x2ebc0e[_0xbbed('0xbf')]=[{'all':!![]}];}_0x2ebc0e=_[_0xbbed('0xa2')]({},_0x2ebc0e,_0x151e1c['options']);return db[_0xbbed('0xa3')][_0xbbed('0x65')](_0x2ebc0e)[_0xbbed('0x28')](handleEntityNotFound(_0xab7883,null))[_0xbbed('0x28')](respondWithResult(_0xab7883,null))[_0xbbed('0x33')](handleError(_0xab7883,null));};exports[_0xbbed('0xc0')]=function(_0x13a303,_0x4e4579){return db[_0xbbed('0xa3')]['create'](_0x13a303['body'],{})['then'](respondWithResult(_0x4e4579,0xc9))[_0xbbed('0x33')](handleError(_0x4e4579,null));};exports[_0xbbed('0x27')]=function(_0x3ab69f,_0x311b5e){if(_0x3ab69f[_0xbbed('0x78')]['id']){delete _0x3ab69f[_0xbbed('0x78')]['id'];}return db[_0xbbed('0xa3')][_0xbbed('0x65')]({'where':{'id':_0x3ab69f[_0xbbed('0xbd')]['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x311b5e,null))[_0xbbed('0x28')](saveUpdates(_0x3ab69f['body'],null))['then'](respondWithResult(_0x311b5e,null))[_0xbbed('0x33')](handleError(_0x311b5e,null));};exports[_0xbbed('0x29')]=function(_0x3d7221,_0x2c7471){return db[_0xbbed('0xa3')][_0xbbed('0x65')]({'where':{'id':_0x3d7221['params']['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x2c7471,null))[_0xbbed('0x28')](removeEntity(_0x2c7471,null))[_0xbbed('0x33')](handleError(_0x2c7471,null));};exports['describe']=function(_0x708ee4,_0x3d61d6){return db[_0xbbed('0xa3')][_0xbbed('0xc1')]()[_0xbbed('0x28')](respondWithResult(_0x3d61d6,null))[_0xbbed('0x33')](handleError(_0x3d61d6,null));};exports[_0xbbed('0xc2')]=function(_0x45db38,_0x416daa,_0x344dcd){return db[_0xbbed('0xc3')]['find']({'where':{'id':_0x45db38[_0xbbed('0xbd')]['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x416daa,null))['then'](function(_0x3bb2ed){if(_0x3bb2ed){return _0x3bb2ed[_0xbbed('0xc2')](_0x45db38[_0xbbed('0x78')][_0xbbed('0xc4')],_['omit'](_0x45db38[_0xbbed('0x78')],[_0xbbed('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x416daa,null))[_0xbbed('0x33')](handleError(_0x416daa,null));};exports[_0xbbed('0xc5')]=function(_0x4cc327,_0x508de3,_0x4b0cd1){var _0x490483={'raw':![],'where':{}};var _0x32fdce={};var _0x99ea51={'count':0x0,'rows':[]};return db[_0xbbed('0xa3')][_0xbbed('0xc6')]({'where':{'id':_0x4cc327[_0xbbed('0xbd')]['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x508de3,null))[_0xbbed('0x28')](function(_0x500d59){if(_0x500d59){_0x32fdce['model']=_[_0xbbed('0x42')](db[_0xbbed('0xc3')][_0xbbed('0x3d')]);_0x32fdce[_0xbbed('0x48')]=_[_0xbbed('0x42')](_0x4cc327[_0xbbed('0x48')]);_0x32fdce[_0xbbed('0x43')]=_[_0xbbed('0x44')](_0x32fdce[_0xbbed('0x41')],_0x32fdce[_0xbbed('0x48')]);_0x490483[_0xbbed('0x45')]=_[_0xbbed('0x44')](_0x32fdce['model'],qs['fields'](_0x4cc327[_0xbbed('0x48')][_0xbbed('0x46')]));_0x490483[_0xbbed('0x45')]=_0x490483[_0xbbed('0x45')]['length']?_0x490483[_0xbbed('0x45')]:_0x32fdce[_0xbbed('0x41')];if(!_0x4cc327[_0xbbed('0x48')][_0xbbed('0xc7')](_0xbbed('0x49'))){_0x490483[_0xbbed('0x23')]=qs['limit'](_0x4cc327[_0xbbed('0x48')][_0xbbed('0x23')]);_0x490483[_0xbbed('0x21')]=qs['offset'](_0x4cc327[_0xbbed('0x48')][_0xbbed('0x21')]);}_0x490483[_0xbbed('0x4a')]=qs[_0xbbed('0x4b')](_0x4cc327['query']['sort']);_0x490483['where']=qs[_0xbbed('0x43')](_[_0xbbed('0x4d')](_0x4cc327['query'],_0x32fdce['filters']));_0x490483[_0xbbed('0x4c')][_0xbbed('0xb9')]=_0x500d59['id'];if(_0x4cc327[_0xbbed('0x48')]['filter']){_0x490483[_0xbbed('0x4c')]=_[_0xbbed('0xa2')](_0x490483[_0xbbed('0x4c')],{'$or':_[_0xbbed('0x3c')](_0x490483[_0xbbed('0x45')],function(_0x48aad9){var _0x365dc4={};_0x365dc4[_0x48aad9]={'$like':'%'+_0x4cc327['query'][_0xbbed('0x89')]+'%'};return _0x365dc4;})});}if(_0x4cc327[_0xbbed('0x48')]['$gte']){var _0x3140c0=_0x4cc327[_0xbbed('0x48')][_0xbbed('0x7f')][_0xbbed('0x31')](',');var _0x608391={};_0x608391[_0x3140c0[0x0]]={'$gte':moment(_0x3140c0[0x1])['format'](_0xbbed('0xc8'))};_0x490483[_0xbbed('0x4c')]=_[_0xbbed('0xa2')](_0x490483[_0xbbed('0x4c')],_0x608391);}_0x490483=_[_0xbbed('0xa2')]({},_0x490483,_0x4cc327[_0xbbed('0xc9')]);return db[_0xbbed('0xc3')][_0xbbed('0x24')]({'where':_0x490483['where']})[_0xbbed('0x28')](function(_0x31c343){_0x99ea51[_0xbbed('0x24')]=_0x31c343;if(_0x4cc327[_0xbbed('0x48')][_0xbbed('0xbe')]){_0x490483['include']=[{'all':!![]}];}return db[_0xbbed('0xc3')][_0xbbed('0xca')](_0x490483);})['then'](function(_0x286dc8){_0x99ea51['rows']=_0x286dc8;return _0x99ea51;});}})[_0xbbed('0x28')](respondWithFilteredResult(_0x508de3,_0x490483))[_0xbbed('0x33')](handleError(_0x508de3,null));};exports[_0xbbed('0xcb')]=function(_0x732f0d,_0x23ab3d,_0x393880){return db[_0xbbed('0xa3')]['find']({'where':{'id':_0x732f0d[_0xbbed('0xbd')]['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x23ab3d,null))['then'](function(_0x4a5bce){if(_0x4a5bce){return _0x4a5bce[_0xbbed('0xcc')](_0x732f0d['body'][_0xbbed('0xc4')],_[_0xbbed('0xcd')](_0x732f0d[_0xbbed('0x78')],[_0xbbed('0xc4'),'id'])||{})['spread'](function(){return db[_0xbbed('0xce')][_0xbbed('0xca')]({'attributes':['id',_0xbbed('0x2d'),'color'],'where':{'id':_0x732f0d['body']['ids']}});})['then'](function(_0x289efa){socket[_0xbbed('0xcf')](_0xbbed('0xd0'),{'id':Number(_0x732f0d['params']['id']),'tags':_0x289efa||[]});return{'id':Number(_0x732f0d['params']['id']),'tags':_0x289efa||[]};});}})[_0xbbed('0x28')](respondWithResult(_0x23ab3d,null))[_0xbbed('0x33')](handleError(_0x23ab3d,null));};exports['removeTags']=function(_0x466526,_0x1b8d59,_0x4ab265){return db[_0xbbed('0xa3')][_0xbbed('0x65')]({'where':{'id':_0x466526[_0xbbed('0xbd')]['id']}})[_0xbbed('0x28')](handleEntityNotFound(_0x1b8d59,null))[_0xbbed('0x28')](function(_0x3046ef){if(_0x3046ef){return _0x3046ef[_0xbbed('0xd1')](_0x466526[_0xbbed('0x48')][_0xbbed('0xc4')]);}})[_0xbbed('0x28')](respondWithStatusCode(_0x1b8d59,null))[_0xbbed('0x33')](handleError(_0x1b8d59,null));};exports[_0xbbed('0xd2')]=function(_0x534c44,_0xb87bea){var _0x55ad49=moment()[_0xbbed('0xd3')]()['toString']();var _0x2bc467=path[_0xbbed('0xd4')](config[_0xbbed('0xd5')],'server','files',_0xbbed('0xd6'));var _0xf033=path[_0xbbed('0xd4')](config[_0xbbed('0xd5')],_0xbbed('0xd7'),_0xbbed('0xd8'),_0xbbed('0xd9'));var _0x7ecff0=path[_0xbbed('0xd4')](_0x2bc467,_0x55ad49);var _0x1ad577=util[_0xbbed('0xda')]('transcript-%d-%s.zip',_0x534c44[_0xbbed('0xbd')]['id'],_0x55ad49);var _0x24dc3c=path[_0xbbed('0xd4')](_0x2bc467,_0x1ad577);var _0x5de121=[];_0x5de121[_0xbbed('0x32')]({'model':db[_0xbbed('0x76')],'as':'User','attributes':['id',_0xbbed('0xdb')],'raw':!![]});_0x5de121[_0xbbed('0x32')]({'model':db[_0xbbed('0xdc')],'as':'Contact','attributes':['id',_0xbbed('0xdd'),_0xbbed('0xde')],'raw':!![]});if(_0x534c44[_0xbbed('0x48')][_0xbbed('0xd9')]){_0x5de121[_0xbbed('0x32')]({'model':db[_0xbbed('0xdf')],'as':'Attachment','raw':!![]});}var _0x555b88=[{'model':db[_0xbbed('0xc3')],'as':_0xbbed('0xe0'),'attributes':['id','body',_0xbbed('0x7d'),'direction',_0xbbed('0xe1'),_0xbbed('0x84')],'include':_0x5de121}];_0x555b88[_0xbbed('0x32')]({'model':db[_0xbbed('0xe2')],'as':_0xbbed('0xe3'),'attributes':['id',_0xbbed('0x2d')]});_0x555b88[_0xbbed('0x32')]({'model':db['User'],'as':_0xbbed('0xe4'),'attributes':['id','fullname']});return db[_0xbbed('0xa3')][_0xbbed('0x65')]({'where':{'id':_0x534c44[_0xbbed('0xbd')]['id']},'include':_0x555b88})['then'](handleEntityNotFound(_0xb87bea,null))[_0xbbed('0x28')](function(_0x385c86){if(_0x385c86){var _0x5ac586=_0x385c86[_0xbbed('0xe5')]({'plain':!![]});fs[_0xbbed('0xe6')](_0x7ecff0);var _0x3fdb5b={'channel':'Whatsapp','account':_0x5ac586[_0xbbed('0xe3')][_0xbbed('0x2d')],'agent':_0x5ac586[_0xbbed('0xe4')]?_0x5ac586['Owner'][_0xbbed('0xdb')]:_0xbbed('0xe7'),'createdAt':moment(_0x5ac586[_0xbbed('0x7d')])[_0xbbed('0xda')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbbed('0xa0')](),'closedAt':_0x5ac586['closed']?moment(_0x5ac586['closedAt'])[_0xbbed('0xda')](_0xbbed('0xc8'))['toString']():'','disposition':_0x5ac586[_0xbbed('0xe8')],'messages':_(_0x5ac586[_0xbbed('0xe0')])[_0xbbed('0x89')]({'secret':![]})[_0xbbed('0x3c')](function(_0x555cf7){if(_0x555cf7[_0xbbed('0xdf')]){var _0x1895db=path[_0xbbed('0xd4')](_0xf033,_0x555cf7[_0xbbed('0xdf')][_0xbbed('0xe9')]);if(fs['existsSync'](_0x1895db)){fs[_0xbbed('0xea')](_0x1895db)[_0xbbed('0xeb')](fs[_0xbbed('0xec')](path[_0xbbed('0xd4')](_0x7ecff0,_0x555cf7[_0xbbed('0xdf')]['basename'])));}}return{'date':moment(_0x555cf7['createdAt'])[_0xbbed('0xda')](_0xbbed('0xc8'))[_0xbbed('0xa0')](),'sender':_0x555cf7[_0xbbed('0xed')]==='out'?_0x555cf7[_0xbbed('0x76')]?_0x555cf7['User'][_0xbbed('0xdb')]:_0xbbed('0xee'):_0x555cf7[_0xbbed('0x6a')]['firstName']+(_0x555cf7['Contact'][_0xbbed('0xde')]?'\x20'+_0x555cf7[_0xbbed('0x6a')][_0xbbed('0xde')]:''),'body':_0x555cf7[_0xbbed('0xdf')]?_0x555cf7[_0xbbed('0xdf')]['basename']:_0x555cf7[_0xbbed('0x78')],'direction':_0x555cf7[_0xbbed('0xed')]===_0xbbed('0xef')?'A':'C','secret':_0x555cf7[_0xbbed('0xe1')],'read':_0x555cf7['read'],'attachment':_0x555cf7[_0xbbed('0xdf')]};})[_0xbbed('0x66')]()};return ejs[_0xbbed('0xf0')](path[_0xbbed('0xd4')](config[_0xbbed('0xd5')],_0xbbed('0xd7'),_0xbbed('0xf1'),_0xbbed('0xf2')),{'interaction':_0x3fdb5b})['then'](function(_0x556e7d){var _0x40c29c=path['join'](_0x7ecff0,_0xbbed('0xf3')+_0x5ac586['id']+'-'+_0x55ad49+'.pdf');var _0x2a92d0={'path':_0x40c29c,'channel':_0xbbed('0xf4'),'interactionId':_0x5ac586['id']};return pdf[_0xbbed('0xf5')](_0x556e7d,_0x2a92d0);})[_0xbbed('0x28')](function(){return new BPromise(function(_0x25434b,_0x24502a){zipdir(_0x7ecff0,{'saveTo':_0x24dc3c},function(_0x274c27,_0x903e90){if(_0x274c27)return _0x24502a(_0x274c27);return _0x25434b(_0x903e90);});})[_0xbbed('0x28')](function(){return new BPromise(function(_0x4d8d4c,_0x2fe9c4){rimraf(_0x7ecff0,function(_0x3fdce4){if(_0x3fdce4)_0x2fe9c4(_0x3fdce4);return _0x4d8d4c();});});})[_0xbbed('0x28')](function(){return _0xb87bea[_0xbbed('0xd2')](_0x24dc3c,_0x1ad577,function(_0xc38ae9){if(_0xc38ae9){console[_0xbbed('0xf6')](_0xbbed('0xf7'),_0xc38ae9);}else{fs['unlinkSync'](_0x24dc3c);}});});});}else{return _0xb87bea[_0xbbed('0x2a')](0xc8);}})[_0xbbed('0x33')](handleError(_0xb87bea,null));}; \ No newline at end of file +var _0xc113=['total','index','WhatsappInteraction','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','tools_tags','select','u.id','left_join','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','pick','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closedAt','disposition','filter','basename','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','catch','talking','answered','unmanaged','closed','waiting','UserId'];(function(_0x54eff2,_0x327673){var _0x1a9f2a=function(_0x484a76){while(--_0x484a76){_0x54eff2['push'](_0x54eff2['shift']());}};_0x1a9f2a(++_0x327673);}(_0xc113,0x1ab));var _0x3c11=function(_0x3a871e,_0x35a706){_0x3a871e=_0x3a871e-0x0;var _0x25d571=_0xc113[_0x3a871e];return _0x25d571;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require(_0x3c11('0x2'));var jsonpatch=require(_0x3c11('0x3'));var rp=require(_0x3c11('0x4'));var moment=require(_0x3c11('0x5'));var BPromise=require(_0x3c11('0x6'));var Mustache=require(_0x3c11('0x7'));var util=require(_0x3c11('0x8'));var path=require('path');var sox=require(_0x3c11('0x9'));var csv=require(_0x3c11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require(_0x3c11('0xc'));var squel=require(_0x3c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c11('0x11'));var as=require(_0x3c11('0x12'));var pdf=require(_0x3c11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c11('0x14'))(_0x3c11('0x15'));var utils=require(_0x3c11('0x16'));var config=require(_0x3c11('0x17'));var licenseUtil=require(_0x3c11('0x18'));var db=require('../../mysqldb')['db'];config[_0x3c11('0x19')]=_[_0x3c11('0x1a')](config['redis'],{'host':_0x3c11('0x1b'),'port':0x18eb});var socket=require(_0x3c11('0x1c'))(new Redis(config[_0x3c11('0x19')]));require(_0x3c11('0x1d'))[_0x3c11('0x1e')](socket);function respondWithStatusCode(_0x546338,_0xb33319){_0xb33319=_0xb33319||0xcc;return function(_0x2ba437){if(_0x2ba437){return _0x546338[_0x3c11('0x1f')](_0xb33319);}return _0x546338[_0x3c11('0x20')](_0xb33319)[_0x3c11('0x21')]();};}function respondWithResult(_0x5b223f,_0x51ee19){_0x51ee19=_0x51ee19||0xc8;return function(_0x575e69){if(_0x575e69){return _0x5b223f[_0x3c11('0x20')](_0x51ee19)[_0x3c11('0x22')](_0x575e69);}};}function respondWithFilteredResult(_0x474c59,_0x42db8d){return function(_0x1a80a5){if(_0x1a80a5){var _0x35d32f=typeof _0x42db8d[_0x3c11('0x23')]===_0x3c11('0x24')&&typeof _0x42db8d[_0x3c11('0x25')]==='undefined';var _0x4f5f3d=_0x1a80a5[_0x3c11('0x26')];var _0x483d5c=_0x35d32f?0x0:_0x42db8d[_0x3c11('0x23')];var _0x5540b7=_0x35d32f?_0x1a80a5[_0x3c11('0x26')]:_0x42db8d['offset']+_0x42db8d[_0x3c11('0x25')];var _0x4c1759;if(_0x5540b7>=_0x4f5f3d){_0x5540b7=_0x4f5f3d;_0x4c1759=0xc8;}else{_0x4c1759=0xce;}_0x474c59['status'](_0x4c1759);return _0x474c59[_0x3c11('0x27')]('Content-Range',_0x483d5c+'-'+_0x5540b7+'/'+_0x4f5f3d)[_0x3c11('0x22')](_0x1a80a5);}return null;};}function patchUpdates(_0x3695e1){return function(_0xf29434){try{jsonpatch[_0x3c11('0x28')](_0xf29434,_0x3695e1,!![]);}catch(_0x1a8fd4){return BPromise['reject'](_0x1a8fd4);}return _0xf29434[_0x3c11('0x29')]();};}function saveUpdates(_0x4993de,_0x32a0ee){return function(_0x414c02){if(_0x414c02){return _0x414c02['update'](_0x4993de)[_0x3c11('0x2a')](function(_0x20ec9b){return _0x20ec9b;});}return null;};}function removeEntity(_0x2ff8bc,_0x2df95d){return function(_0xd42228){if(_0xd42228){return _0xd42228[_0x3c11('0x2b')]()[_0x3c11('0x2a')](function(){_0x2ff8bc[_0x3c11('0x20')](0xcc)[_0x3c11('0x21')]();});}};}function handleEntityNotFound(_0x3d638c,_0x500073){return function(_0x1a0154){if(!_0x1a0154){_0x3d638c[_0x3c11('0x1f')](0x194);}return _0x1a0154;};}function handleError(_0x3cdf77,_0x9cc373){_0x9cc373=_0x9cc373||0x1f4;return function(_0x50aec6){logger[_0x3c11('0x2c')](_0x50aec6[_0x3c11('0x2d')]);if(_0x50aec6['name']){delete _0x50aec6[_0x3c11('0x2e')];}_0x3cdf77[_0x3c11('0x20')](_0x9cc373)[_0x3c11('0x2f')](_0x50aec6);};}function getInteractionUsers(_0x661068,_0x36a5b4){return new BPromise(function(_0x1e4834,_0x3c5377){try{if(_0x36a5b4[_0x661068['id']]){_0x661068[_0x3c11('0x30')]=_['map'](_0x36a5b4[_0x661068['id']],function(_0x40030d){return{'id':_0x40030d['id'],'fullname':_0x40030d[_0x3c11('0x31')]};});}}catch(_0x1ec787){_0x3c5377(_0x1ec787);}_0x1e4834(_0x661068);});}function getInteractionTags(_0x2d0195,_0xf17e98){return new BPromise(function(_0x196623,_0x12d644){try{if(_0x2d0195['TagIds']){_0x2d0195[_0x3c11('0x32')]=[];_0x2d0195[_0x3c11('0x33')][_0x3c11('0x34')](',')[_0x3c11('0x35')](function(_0xd8a8f2){_0x2d0195[_0x3c11('0x32')]['push'](_0xf17e98[_0xd8a8f2]);});}delete _0x2d0195[_0x3c11('0x33')];}catch(_0x47a450){_0x12d644(_0x47a450);}_0x196623(_0x2d0195);});}function updateWhatsappInteraction(_0x4c374f,_0x325fd9,_0x392790){return new BPromise(function(_0x5140d4,_0x31d88d){return getInteractionUsers(_0x4c374f,_0x392790)[_0x3c11('0x2a')](function(_0x19b137){return getInteractionTags(_0x19b137,_0x325fd9);})['then'](function(_0x2ec870){return getStateInteraction(_0x2ec870);})[_0x3c11('0x2a')](function(_0x25e4d6){_0x5140d4(_0x25e4d6);})[_0x3c11('0x36')](function(_0x482d92){_0x31d88d(_0x482d92);});});}function getStateInteraction(_0x199ab9){return new BPromise(function(_0x3e42bf){_0x199ab9['waiting']=0x0;_0x199ab9[_0x3c11('0x37')]=0x0;_0x199ab9[_0x3c11('0x38')]=0x0;_0x199ab9[_0x3c11('0x39')]=0x0;_0x199ab9['total']=0x0;if(!_0x199ab9[_0x3c11('0x3a')]&&!_0x199ab9['UserId']){_0x199ab9[_0x3c11('0x3b')]+=0x1;}if(!_0x199ab9['closed']&&_0x199ab9['UserId']){_0x199ab9[_0x3c11('0x37')]+=0x1;if(_0x199ab9['waiting']){_0x199ab9[_0x3c11('0x3b')]-=0x1;}}if(_0x199ab9['closed']&&_0x199ab9[_0x3c11('0x3c')]){_0x199ab9[_0x3c11('0x38')]+=0x1;if(_0x199ab9['talking']){_0x199ab9[_0x3c11('0x37')]-=0x1;}}if(_0x199ab9['closed']&&!_0x199ab9[_0x3c11('0x3c')]){_0x199ab9[_0x3c11('0x39')]+=0x1;if(_0x199ab9[_0x3c11('0x3b')]){_0x199ab9['waiting']-=0x1;}}_0x199ab9[_0x3c11('0x3d')]+=0x1;_0x3e42bf(_0x199ab9);});}exports[_0x3c11('0x3e')]=function(_0x16776e,_0x1ffd36){var _0x1859ce={},_0x2ccc27={},_0x3009e2={'count':0x0,'rows':[]};var _0x155d35=_['map'](db[_0x3c11('0x3f')][_0x3c11('0x40')],function(_0x63e7b6){return{'name':_0x63e7b6['fieldName'],'type':_0x63e7b6['type']['key']};});_0x2ccc27[_0x3c11('0x41')]=_[_0x3c11('0x42')](_0x155d35,_0x3c11('0x2e'));_0x2ccc27['query']=_['keys'](_0x16776e[_0x3c11('0x43')]);_0x2ccc27[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x2ccc27[_0x3c11('0x41')],_0x2ccc27[_0x3c11('0x43')]);_0x1859ce[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x2ccc27[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0x16776e['query'][_0x3c11('0x47')]));_0x1859ce[_0x3c11('0x46')]=_0x1859ce[_0x3c11('0x46')][_0x3c11('0x48')]?_0x1859ce[_0x3c11('0x46')]:_0x2ccc27[_0x3c11('0x41')];if(!_0x16776e[_0x3c11('0x43')][_0x3c11('0x49')](_0x3c11('0x4a'))){_0x1859ce[_0x3c11('0x25')]=qs['limit'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x25')]);_0x1859ce[_0x3c11('0x23')]=qs['offset'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x23')]);}_0x1859ce[_0x3c11('0x4b')]=qs[_0x3c11('0x4c')](_0x16776e['query']['sort']);_0x1859ce[_0x3c11('0x4d')]=qs[_0x3c11('0x44')](_['pick'](_0x16776e[_0x3c11('0x43')],_0x2ccc27[_0x3c11('0x44')]),_0x155d35);var _0x2e2398=[];var _0x2b3224=squel['select']()['field']('id')[_0x3c11('0x4e')](_0x3c11('0x2e'))[_0x3c11('0x4e')](_0x3c11('0x4f'))['from'](_0x3c11('0x50'));var _0x22bcae=squel[_0x3c11('0x51')]()[_0x3c11('0x4e')](_0x3c11('0x52'))[_0x3c11('0x4e')]('u.fullname')['field']('ui.WhatsappInteractionId')['from']('user_has_whatsapp_interactions','ui')[_0x3c11('0x53')]('users','u','u.id\x20=\x20ui.UserId');var _0x21643a=squel[_0x3c11('0x51')]()['from'](_0x3c11('0x54'),'i')['left_join'](_0x3c11('0x55'),'c',_0x3c11('0x56'))[_0x3c11('0x53')](_0x3c11('0x57'),'o','o.id\x20=\x20i.UserId')[_0x3c11('0x53')](_0x3c11('0x58'),'a',_0x3c11('0x59'))[_0x3c11('0x53')]('whatsapp_messages','me',_0x3c11('0x5a'))['left_join'](_0x3c11('0x5b'),'it',_0x3c11('0x5c'))[_0x3c11('0x53')](_0x3c11('0x50'),'t',_0x3c11('0x5d'));var _0x457571=squel[_0x3c11('0x5e')]();var _0x4e1c98=[];var _0x31dc5b=squel[_0x3c11('0x5e')]();var _0x58a9a0;if(_0x16776e[_0x3c11('0x43')]['search']){_0x58a9a0=as['parseSearch'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x5f')]);var _0x36f1bd=_0x58a9a0[_0x3c11('0x60')];for(var _0x531ebf=0x0;_0x531ebf<_0x58a9a0['conditions'][_0x3c11('0x48')];_0x531ebf++){var _0x31e6d8=_0x58a9a0[_0x3c11('0x61')][_0x531ebf];var _0x29c783='i';var _0x1dd01c=_[_0x3c11('0x62')](_0x155d35,[_0x3c11('0x2e'),_0x31e6d8[_0x3c11('0x4e')]]);if(!_0x1dd01c){switch(_0x31e6d8[_0x3c11('0x4e')]){case _0x3c11('0x63'):if(_0x31e6d8[_0x3c11('0x64')]==0x1){_0x21643a[_0x3c11('0x65')]('`'+_0x31e6d8['field']+'`\x20=\x200');}else{_0x21643a['having']('`'+_0x31e6d8[_0x3c11('0x4e')]+'`\x20>\x200');}break;case _0x3c11('0x66'):if(_0x31e6d8[_0x3c11('0x67')]==='$substring'){if(_0x31e6d8[_0x3c11('0x64')][_0x3c11('0x34')]('\x20')[_0x3c11('0x48')]>0x1){_0x457571[_0x36f1bd](_0x3c11('0x68'),qs[_0x3c11('0x69')](_0x31e6d8['value']),null);}else{var _0x429d95='%'+_0x31e6d8[_0x3c11('0x64')]+'%';_0x457571[_0x36f1bd](_0x3c11('0x6a'),_0x429d95,_0x429d95,_0x429d95);}}else{_0x1dd01c=_[_0x3c11('0x62')](_0x155d35,['name',_0x3c11('0x6b')]);_0x31e6d8[_0x3c11('0x4e')]='ContactId';_0x152f5a=as[_0x3c11('0x6c')](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')]['start'],_0x152f5a['value']['end']);}break;case'Tag':var _0xb6bf30=_0x31e6d8[_0x3c11('0x64')]['split'](',')['map'](function(_0x28d93a){return Number(_0x28d93a);});_0xb6bf30[_0x3c11('0x35')](function(_0x2815ca){_0x31dc5b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2815ca+',%');});_0x4e1c98=_['union'](_0x4e1c98,_0xb6bf30);break;case'User':if(_0x31e6d8[_0x3c11('0x67')]===_0x3c11('0x6f')){_0x457571[_0x36f1bd](_0x3c11('0x70'),'%'+_0x31e6d8[_0x3c11('0x64')]+'%',null);}else{_0x1dd01c=_['find'](_0x155d35,[_0x3c11('0x2e'),'UserId']);_0x31e6d8[_0x3c11('0x4e')]=_0x3c11('0x3c');_0x152f5a=as[_0x3c11('0x6c')](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);}break;case _0x3c11('0x72'):_0x152f5a=as[_0x3c11('0x6c')]('me',null,_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a['text'],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);break;}}else{var _0x152f5a=as['buildExpression'](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);}}}else{var _0x58f420=_(_0x16776e[_0x3c11('0x43')])['keys']()['map'](function(_0x4ae4ba){return _[_0x3c11('0x73')](_0x155d35,[_0x3c11('0x2e'),_0x4ae4ba])?_0x4ae4ba:undefined;})[_0x3c11('0x74')]()[_0x3c11('0x64')]();if(!_[_0x3c11('0x75')](_0x58f420)){_0x58f420['forEach'](function(_0x2ccccb){if(_0x2ccccb==='WhatsappAccountId'){_0x21643a['where']('i.WhatsappAccountId\x20IN\x20?',[][_0x3c11('0x76')](_0x16776e[_0x3c11('0x43')][_0x2ccccb]));}else if(_0x2ccccb===_0x3c11('0x77')){var _0x1bb682=JSON['parse'](_0x16776e[_0x3c11('0x43')][_0x2ccccb])['$gte'];var _0x9791fe=JSON[_0x3c11('0x78')](_0x16776e['query'][_0x2ccccb])[_0x3c11('0x79')];_0x21643a[_0x3c11('0x4d')](_0x3c11('0x7a'),_0x1bb682,_0x9791fe);}else{if(_0x16776e['query'][_0x2ccccb]===_0x3c11('0x7b')){_0x21643a[_0x3c11('0x4d')]('i.'+_0x2ccccb+_0x3c11('0x7c'));}else{_0x21643a[_0x3c11('0x4d')]('i.'+_0x2ccccb+_0x3c11('0x7d'),_0x16776e[_0x3c11('0x43')][_0x2ccccb]);}}});}if(_0x16776e[_0x3c11('0x43')][_0x3c11('0x7e')]){if(_0x16776e['query'][_0x3c11('0x7e')]==0x1){_0x21643a[_0x3c11('0x65')](_0x3c11('0x7f'));}else{_0x21643a[_0x3c11('0x65')](_0x3c11('0x80'));}}if(_0x16776e['query'][_0x3c11('0x81')]){_0x4e1c98=_[_0x3c11('0x82')](_0x16776e[_0x3c11('0x43')]['tag'])?_0x16776e[_0x3c11('0x43')][_0x3c11('0x81')]:new Array(_0x16776e['query'][_0x3c11('0x81')]);_0x4e1c98[_0x3c11('0x35')](function(_0x21a2b0){_0x31dc5b['or'](_0x3c11('0x83'),'%,'+_0x21a2b0+',%');});}if(_0x16776e[_0x3c11('0x43')]['filter']){var _0x423fad=_0x16776e[_0x3c11('0x43')]['filter'][_0x3c11('0x84')]('\x5c','\x5c\x5c')[_0x3c11('0x84')](/'/g,'\x27\x27');if(qs[_0x3c11('0x85')](_0x423fad)){_0x457571['or'](_0x3c11('0x86'),_0x423fad+'%')['or'](_0x3c11('0x87'),_0x423fad+'%');}else{_0x457571['or'](_0x3c11('0x88'),qs[_0x3c11('0x69')](_0x423fad))['or'](_0x3c11('0x89'),_0x423fad+'%');}}}_0x21643a[_0x3c11('0x4d')](_0x457571);_0x21643a[_0x3c11('0x8a')](_0x3c11('0x8b'));var _0x1822e1={'type':db[_0x3c11('0x8c')][_0x3c11('0x8d')][_0x3c11('0x8e')],'raw':!![]};var _0x15b648=_0x21643a[_0x3c11('0x8f')]();_0x15b648['field'](_0x3c11('0x8b'));_0x15b648[_0x3c11('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3c11('0x63'));if(_0x1859ce['order']){_0x1859ce[_0x3c11('0x4b')][_0x3c11('0x35')](function(_0x3603d1){var _0x342ba2=_0x3603d1[0x0]===_0x3c11('0x90')?_0x3603d1[0x0]:'i.'+_0x3603d1[0x0];_0x21643a[_0x3c11('0x4b')](_0x342ba2,_0x3603d1[0x1]===_0x3c11('0x91')?![]:!![]);});}if(!_[_0x3c11('0x75')](_0x4e1c98)){_0x21643a[_0x3c11('0x65')](_0x31dc5b);_0x15b648[_0x3c11('0x4d')](_0x3c11('0x92'),_0x4e1c98);}BPromise[_0x3c11('0x93')]()['then'](function(){if(!_0x58a9a0){if(_0x16776e[_0x3c11('0x43')][_0x3c11('0x94')])return;_0x15b648[_0x3c11('0x4d')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x21643a[_0x3c11('0x4d')](_0x3c11('0x95'));return;}if(_0x16776e[_0x3c11('0x96')][_0x3c11('0x97')]!==_0x3c11('0x98'))return;return _0x16776e['user'][_0x3c11('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ab45f){if(_[_0x3c11('0x75')](_0x3ab45f)){_0x15b648['where'](_0x3c11('0x9a'));_0x21643a['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x15b648[_0x3c11('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_[_0x3c11('0x42')](_0x3ab45f,'id'));_0x21643a[_0x3c11('0x4d')](_0x3c11('0x9b'),_[_0x3c11('0x42')](_0x3ab45f,'id'));}});})[_0x3c11('0x2a')](function(){if(_0x16776e[_0x3c11('0x96')]['role']===_0x3c11('0x98')&&!_0x58a9a0&&!_0x16776e[_0x3c11('0x43')][_0x3c11('0x94')])return[];return db['sequelize'][_0x3c11('0x43')](_0x15b648[_0x3c11('0x9c')](),_0x1822e1);})[_0x3c11('0x2a')](function(_0x6479f8){_0x3009e2[_0x3c11('0x26')]=_0x6479f8[_0x3c11('0x48')];if(_0x3009e2[_0x3c11('0x26')]===0x0)return[];return db[_0x3c11('0x9d')][_0x3c11('0x43')](_0x2b3224[_0x3c11('0x9c')](),_0x1822e1)[_0x3c11('0x2a')](function(_0xc3d81f){_0x2e2398=_[_0x3c11('0x9e')](_0xc3d81f,'id');_0x1822e1=_['merge'](_0x1822e1,{'model':db[_0x3c11('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16776e['query'][_0x3c11('0x47')]){_0x1859ce[_0x3c11('0x46')][_0x3c11('0x35')](function(_0x2a01cf){_0x21643a[_0x3c11('0x4e')]('i.'+_0x2a01cf);});}else{_0x21643a[_0x3c11('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x21643a[_0x3c11('0x4e')]('a.key',_0x3c11('0x9f'));_0x21643a['field'](_0x3c11('0xa0'),_0x3c11('0xa1'));_0x21643a[_0x3c11('0x4e')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x21643a[_0x3c11('0x4e')]('i.*');_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa2'),_0x3c11('0xa3'));_0x21643a['field'](_0x3c11('0xa4'),_0x3c11('0xa5'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa6'),'Contact.email');_0x21643a['field']('c.phone',_0x3c11('0xa7'));_0x21643a['field'](_0x3c11('0xa8'),'Contact.mobile');_0x21643a[_0x3c11('0x4e')]('c.fax','Contact.fax');_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa9'),_0x3c11('0xaa'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xab'),_0x3c11('0xac'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xad'),_0x3c11('0x33'));}if(_0x1859ce[_0x3c11('0x25')])_0x21643a[_0x3c11('0x25')](_0x1859ce[_0x3c11('0x25')]);if(_0x1859ce[_0x3c11('0x23')])_0x21643a['offset'](_0x1859ce['offset']);return db[_0x3c11('0x9d')][_0x3c11('0x43')](_0x21643a['toString'](),_0x1822e1);})[_0x3c11('0x2a')](function(_0x5a5d40){if(_0x5a5d40[_0x3c11('0x48')]>0x0)_0x22bcae[_0x3c11('0x4d')](_0x3c11('0xae'),_[_0x3c11('0x42')](_0x5a5d40,'id'));return db['sequelize'][_0x3c11('0x43')](_0x22bcae[_0x3c11('0x9c')](),_0x1822e1)[_0x3c11('0x2a')](function(_0x57c20f){var _0x635b51=_[_0x3c11('0xaf')](_0x57c20f,_0x3c11('0xb0'));var _0x1fdf2f=[];_0x5a5d40[_0x3c11('0x35')](function(_0x258f84){_0x1fdf2f[_0x3c11('0xb1')](updateWhatsappInteraction(_0x258f84,_0x2e2398,_0x635b51));});return BPromise[_0x3c11('0xb2')](_0x1fdf2f);});});})[_0x3c11('0x2a')](function(_0x299aaf){_0x3009e2[_0x3c11('0xb3')]=_0x299aaf;return _0x3009e2;})[_0x3c11('0x2a')](respondWithFilteredResult(_0x1ffd36,_0x1859ce))[_0x3c11('0x36')](handleError(_0x1ffd36,null));};exports['show']=function(_0x5a4714,_0x4ad9b0){var _0x5f1c09={'raw':![],'where':{'id':_0x5a4714[_0x3c11('0xb4')]['id']}},_0x4dc93a={};_0x4dc93a[_0x3c11('0x41')]=_['keys'](db[_0x3c11('0x3f')][_0x3c11('0x40')]);_0x4dc93a[_0x3c11('0x43')]=_['keys'](_0x5a4714['query']);_0x4dc93a[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x4dc93a[_0x3c11('0x41')],_0x4dc93a['query']);_0x5f1c09[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x4dc93a[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0x5a4714[_0x3c11('0x43')][_0x3c11('0x47')]));_0x5f1c09[_0x3c11('0x46')]=_0x5f1c09[_0x3c11('0x46')][_0x3c11('0x48')]?_0x5f1c09[_0x3c11('0x46')]:_0x4dc93a[_0x3c11('0x41')];if(_0x5a4714[_0x3c11('0x43')][_0x3c11('0xb5')]){_0x5f1c09[_0x3c11('0xb6')]=[{'all':!![]}];}_0x5f1c09=_['merge']({},_0x5f1c09,_0x5a4714[_0x3c11('0xb7')]);return db['WhatsappInteraction']['find'](_0x5f1c09)[_0x3c11('0x2a')](handleEntityNotFound(_0x4ad9b0,null))['then'](respondWithResult(_0x4ad9b0,null))[_0x3c11('0x36')](handleError(_0x4ad9b0,null));};exports[_0x3c11('0xb8')]=function(_0x4b3aaf,_0x9e2d92){return db[_0x3c11('0x3f')][_0x3c11('0xb8')](_0x4b3aaf['body'],{})[_0x3c11('0x2a')](respondWithResult(_0x9e2d92,0xc9))[_0x3c11('0x36')](handleError(_0x9e2d92,null));};exports[_0x3c11('0xb9')]=function(_0x180501,_0x4ae013){if(_0x180501[_0x3c11('0x72')]['id']){delete _0x180501['body']['id'];}return db['WhatsappInteraction'][_0x3c11('0x62')]({'where':{'id':_0x180501['params']['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4ae013,null))[_0x3c11('0x2a')](saveUpdates(_0x180501[_0x3c11('0x72')],null))[_0x3c11('0x2a')](respondWithResult(_0x4ae013,null))[_0x3c11('0x36')](handleError(_0x4ae013,null));};exports[_0x3c11('0x2b')]=function(_0x12b432,_0x4a82d4){return db[_0x3c11('0x3f')][_0x3c11('0x62')]({'where':{'id':_0x12b432[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4a82d4,null))[_0x3c11('0x2a')](removeEntity(_0x4a82d4,null))[_0x3c11('0x36')](handleError(_0x4a82d4,null));};exports[_0x3c11('0xba')]=function(_0x3251cb,_0x4b71ba){return db[_0x3c11('0x3f')][_0x3c11('0xba')]()[_0x3c11('0x2a')](respondWithResult(_0x4b71ba,null))[_0x3c11('0x36')](handleError(_0x4b71ba,null));};exports[_0x3c11('0xbb')]=function(_0x2ce7fb,_0x3a5996,_0x69719a){return db[_0x3c11('0xbc')][_0x3c11('0x62')]({'where':{'id':_0x2ce7fb[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x3a5996,null))['then'](function(_0x22355b){if(_0x22355b){return _0x22355b[_0x3c11('0xbb')](_0x2ce7fb[_0x3c11('0x72')][_0x3c11('0xbd')],_['omit'](_0x2ce7fb[_0x3c11('0x72')],[_0x3c11('0xbd'),'id'])||{});}})[_0x3c11('0x2a')](respondWithResult(_0x3a5996,null))[_0x3c11('0x36')](handleError(_0x3a5996,null));};exports[_0x3c11('0xbe')]=function(_0xf9fdcf,_0x456382,_0x140461){var _0x36adbb={'raw':![],'where':{}};var _0x30bc31={};var _0xef0942={'count':0x0,'rows':[]};return db[_0x3c11('0x3f')][_0x3c11('0xbf')]({'where':{'id':_0xf9fdcf['params']['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x456382,null))[_0x3c11('0x2a')](function(_0x477260){if(_0x477260){_0x30bc31['model']=_['keys'](db[_0x3c11('0xbc')][_0x3c11('0x40')]);_0x30bc31[_0x3c11('0x43')]=_['keys'](_0xf9fdcf[_0x3c11('0x43')]);_0x30bc31[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x30bc31[_0x3c11('0x41')],_0x30bc31['query']);_0x36adbb[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x30bc31[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x47')]));_0x36adbb[_0x3c11('0x46')]=_0x36adbb[_0x3c11('0x46')][_0x3c11('0x48')]?_0x36adbb[_0x3c11('0x46')]:_0x30bc31['model'];if(!_0xf9fdcf['query'][_0x3c11('0x49')](_0x3c11('0x4a'))){_0x36adbb[_0x3c11('0x25')]=qs['limit'](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x25')]);_0x36adbb[_0x3c11('0x23')]=qs['offset'](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x23')]);}_0x36adbb['order']=qs['sort'](_0xf9fdcf['query'][_0x3c11('0x4c')]);_0x36adbb[_0x3c11('0x4d')]=qs['filters'](_[_0x3c11('0xc0')](_0xf9fdcf[_0x3c11('0x43')],_0x30bc31[_0x3c11('0x44')]));_0x36adbb[_0x3c11('0x4d')][_0x3c11('0xb0')]=_0x477260['id'];if(_0xf9fdcf[_0x3c11('0x43')]['filter']){_0x36adbb[_0x3c11('0x4d')]=_[_0x3c11('0xc1')](_0x36adbb[_0x3c11('0x4d')],{'$or':_['map'](_0x36adbb['attributes'],function(_0x30674e){var _0x18e2b5={};_0x18e2b5[_0x30674e]={'$like':'%'+_0xf9fdcf[_0x3c11('0x43')]['filter']+'%'};return _0x18e2b5;})});}if(_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0xc2')]){var _0x2ee6b3=_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0xc2')][_0x3c11('0x34')](',');var _0x327050={};_0x327050[_0x2ee6b3[0x0]]={'$gte':moment(_0x2ee6b3[0x1])[_0x3c11('0xc3')](_0x3c11('0xc4'))};_0x36adbb['where']=_[_0x3c11('0xc1')](_0x36adbb['where'],_0x327050);}_0x36adbb=_[_0x3c11('0xc1')]({},_0x36adbb,_0xf9fdcf[_0x3c11('0xb7')]);return db[_0x3c11('0xbc')][_0x3c11('0x26')]({'where':_0x36adbb[_0x3c11('0x4d')]})[_0x3c11('0x2a')](function(_0x352121){_0xef0942[_0x3c11('0x26')]=_0x352121;if(_0xf9fdcf[_0x3c11('0x43')]['includeAll']){_0x36adbb[_0x3c11('0xb6')]=[{'all':!![]}];}return db[_0x3c11('0xbc')]['findAll'](_0x36adbb);})[_0x3c11('0x2a')](function(_0x287f02){_0xef0942['rows']=_0x287f02;return _0xef0942;});}})[_0x3c11('0x2a')](respondWithFilteredResult(_0x456382,_0x36adbb))[_0x3c11('0x36')](handleError(_0x456382,null));};exports[_0x3c11('0xc5')]=function(_0x31d373,_0x57948a,_0x542443){return db[_0x3c11('0x3f')][_0x3c11('0x62')]({'where':{'id':_0x31d373[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x57948a,null))[_0x3c11('0x2a')](function(_0x5500cc){if(_0x5500cc){return _0x5500cc[_0x3c11('0xc6')](_0x31d373[_0x3c11('0x72')][_0x3c11('0xbd')],_[_0x3c11('0xc7')](_0x31d373[_0x3c11('0x72')],[_0x3c11('0xbd'),'id'])||{})[_0x3c11('0xc8')](function(){return db[_0x3c11('0xc9')][_0x3c11('0xca')]({'attributes':['id',_0x3c11('0x2e'),'color'],'where':{'id':_0x31d373[_0x3c11('0x72')][_0x3c11('0xbd')]}});})[_0x3c11('0x2a')](function(_0x370db5){socket[_0x3c11('0xcb')](_0x3c11('0xcc'),{'id':Number(_0x31d373[_0x3c11('0xb4')]['id']),'tags':_0x370db5||[]});return{'id':Number(_0x31d373['params']['id']),'tags':_0x370db5||[]};});}})[_0x3c11('0x2a')](respondWithResult(_0x57948a,null))[_0x3c11('0x36')](handleError(_0x57948a,null));};exports['removeTags']=function(_0x504a06,_0x4ea809,_0x45994e){return db[_0x3c11('0x3f')]['find']({'where':{'id':_0x504a06[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4ea809,null))['then'](function(_0x17aa46){if(_0x17aa46){return _0x17aa46[_0x3c11('0xcd')](_0x504a06[_0x3c11('0x43')][_0x3c11('0xbd')]);}})['then'](respondWithStatusCode(_0x4ea809,null))[_0x3c11('0x36')](handleError(_0x4ea809,null));};exports[_0x3c11('0xce')]=function(_0x1c39f2,_0xc1419b){var _0x255d55=moment()[_0x3c11('0xcf')]()[_0x3c11('0x9c')]();var _0x1f6bc9=path[_0x3c11('0xd0')](config['root'],'server',_0x3c11('0xd1'),_0x3c11('0xd2'));var _0x300e0c=path[_0x3c11('0xd0')](config[_0x3c11('0xd3')],_0x3c11('0xd4'),_0x3c11('0xd1'),'attachments');var _0x1a9c9a=path[_0x3c11('0xd0')](_0x1f6bc9,_0x255d55);var _0x48157d=util[_0x3c11('0xc3')](_0x3c11('0xd5'),_0x1c39f2[_0x3c11('0xb4')]['id'],_0x255d55);var _0x317df7=path[_0x3c11('0xd0')](_0x1f6bc9,_0x48157d);var _0x2bbad0=[];_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd6')],'as':_0x3c11('0xd6'),'attributes':['id',_0x3c11('0x31')],'raw':!![]});_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd7')],'as':_0x3c11('0x66'),'attributes':['id','firstName',_0x3c11('0xd8')],'raw':!![]});if(_0x1c39f2[_0x3c11('0x43')]['attachments']){_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd9')],'as':_0x3c11('0xd9'),'raw':!![]});}var _0x43aa78=[{'model':db[_0x3c11('0xbc')],'as':_0x3c11('0xda'),'attributes':['id','body','createdAt','direction',_0x3c11('0xdb'),_0x3c11('0x7e')],'include':_0x2bbad0}];_0x43aa78[_0x3c11('0xb1')]({'model':db[_0x3c11('0xdc')],'as':_0x3c11('0xdd'),'attributes':['id','name']});_0x43aa78[_0x3c11('0xb1')]({'model':db['User'],'as':_0x3c11('0xde'),'attributes':['id',_0x3c11('0x31')]});return db[_0x3c11('0x3f')]['find']({'where':{'id':_0x1c39f2[_0x3c11('0xb4')]['id']},'include':_0x43aa78})[_0x3c11('0x2a')](handleEntityNotFound(_0xc1419b,null))[_0x3c11('0x2a')](function(_0x5d9f14){if(_0x5d9f14){var _0x45f96b=_0x5d9f14[_0x3c11('0xdf')]({'plain':!![]});fs[_0x3c11('0xe0')](_0x1a9c9a);var _0x43c86e={'channel':_0x3c11('0xe1'),'account':_0x45f96b[_0x3c11('0xdd')][_0x3c11('0x2e')],'agent':_0x45f96b[_0x3c11('0xde')]?_0x45f96b[_0x3c11('0xde')][_0x3c11('0x31')]:'N.A.','createdAt':moment(_0x45f96b[_0x3c11('0x77')])[_0x3c11('0xc3')](_0x3c11('0xc4'))[_0x3c11('0x9c')](),'closedAt':_0x45f96b[_0x3c11('0x3a')]?moment(_0x45f96b[_0x3c11('0xe2')])[_0x3c11('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3c11('0x9c')]():'','disposition':_0x45f96b[_0x3c11('0xe3')],'messages':_(_0x45f96b[_0x3c11('0xda')])[_0x3c11('0xe4')]({'secret':![]})[_0x3c11('0x42')](function(_0x2e2692){if(_0x2e2692[_0x3c11('0xd9')]){var _0x11901c=path['join'](_0x300e0c,_0x2e2692[_0x3c11('0xd9')][_0x3c11('0xe5')]);if(fs['existsSync'](_0x11901c)){fs['createReadStream'](_0x11901c)[_0x3c11('0xe6')](fs[_0x3c11('0xe7')](path[_0x3c11('0xd0')](_0x1a9c9a,_0x2e2692['Attachment']['basename'])));}}return{'date':moment(_0x2e2692[_0x3c11('0x77')])[_0x3c11('0xc3')](_0x3c11('0xc4'))[_0x3c11('0x9c')](),'sender':_0x2e2692[_0x3c11('0xe8')]===_0x3c11('0xe9')?_0x2e2692[_0x3c11('0xd6')]?_0x2e2692[_0x3c11('0xd6')][_0x3c11('0x31')]:_0x3c11('0xea'):_0x2e2692[_0x3c11('0x66')][_0x3c11('0xeb')]+(_0x2e2692[_0x3c11('0x66')][_0x3c11('0xd8')]?'\x20'+_0x2e2692['Contact']['lastName']:''),'body':_0x2e2692[_0x3c11('0xd9')]?_0x2e2692[_0x3c11('0xd9')][_0x3c11('0xe5')]:_0x2e2692[_0x3c11('0x72')],'direction':_0x2e2692[_0x3c11('0xe8')]===_0x3c11('0xe9')?'A':'C','secret':_0x2e2692[_0x3c11('0xdb')],'read':_0x2e2692[_0x3c11('0x7e')],'attachment':_0x2e2692[_0x3c11('0xd9')]};})[_0x3c11('0x64')]()};return ejs[_0x3c11('0xec')](path[_0x3c11('0xd0')](config[_0x3c11('0xd3')],_0x3c11('0xd4'),_0x3c11('0xed'),_0x3c11('0xee')),{'interaction':_0x43c86e})[_0x3c11('0x2a')](function(_0x88d3f9){var _0x34a4a6=path[_0x3c11('0xd0')](_0x1a9c9a,_0x3c11('0xef')+_0x45f96b['id']+'-'+_0x255d55+_0x3c11('0xf0'));var _0x1747c3={'path':_0x34a4a6,'channel':_0x3c11('0xe1'),'interactionId':_0x45f96b['id']};return pdf['createPdfFromHTML'](_0x88d3f9,_0x1747c3);})[_0x3c11('0x2a')](function(){return new BPromise(function(_0x251784,_0x1639a2){zipdir(_0x1a9c9a,{'saveTo':_0x317df7},function(_0x13d18e,_0x4d69b1){if(_0x13d18e)return _0x1639a2(_0x13d18e);return _0x251784(_0x4d69b1);});})[_0x3c11('0x2a')](function(){return new BPromise(function(_0x2f0701,_0x21ab0c){rimraf(_0x1a9c9a,function(_0x43aa10){if(_0x43aa10)_0x21ab0c(_0x43aa10);return _0x2f0701();});});})[_0x3c11('0x2a')](function(){return _0xc1419b['download'](_0x317df7,_0x48157d,function(_0x34099c){if(_0x34099c){console[_0x3c11('0xf1')](_0x3c11('0xf2'),_0x34099c);}else{fs[_0x3c11('0xf3')](_0x317df7);}});});});}else{return _0xc1419b[_0x3c11('0x1f')](0xc8);}})['catch'](handleError(_0xc1419b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c547735..ec2b688 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 _0xd139=['WhatsappMessage','setMaxListeners','save','update','remove','getUsers','Users','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd139,0x14e));var _0x9d13=function(_0xb37e21,_0x16c64c){_0xb37e21=_0xb37e21-0x0;var _0x1e8d4e=_0xd139[_0xb37e21];return _0x1e8d4e;};'use strict';var EventEmitter=require(_0x9d13('0x0'));var WhatsappInteraction=require(_0x9d13('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x9d13('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9d13('0x3')](0x0);var events={'afterCreate':_0x9d13('0x4'),'afterUpdate':_0x9d13('0x5'),'afterDestroy':_0x9d13('0x6')};function emitEvent(_0xdeacf6){return function(_0x16b9f2,_0x58c6f5,_0x4c8e60){_0x16b9f2[_0x9d13('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x198d7d){_0x16b9f2['setDataValue'](_0x9d13('0x8'),_0x198d7d['map'](function(_0x5a1220){return{'id':_0x5a1220['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x16b9f2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9d13('0x9')](function(_0xba5caa){_0x16b9f2[_0x9d13('0xa')](_0x9d13('0xb'),_0xba5caa[_0x9d13('0xc')]);WhatsappInteractionEvents['emit'](_0xdeacf6+':'+_0x16b9f2['id'],_0x16b9f2);WhatsappInteractionEvents[_0x9d13('0xd')](_0xdeacf6,_0x16b9f2);_0x4c8e60(null);})[_0x9d13('0xe')](_0x4c8e60(null));};}for(var e in events){if(events[_0x9d13('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x3b75=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then'];(function(_0x37ecca,_0x379262){var _0x5e81d6=function(_0x128bbd){while(--_0x128bbd){_0x37ecca['push'](_0x37ecca['shift']());}};_0x5e81d6(++_0x379262);}(_0x3b75,0xdc));var _0x53b7=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x3b75[_0x2f0057];return _0x17f2c3;};'use strict';var EventEmitter=require(_0x53b7('0x0'));var WhatsappInteraction=require(_0x53b7('0x1'))['db'][_0x53b7('0x2')];var WhatsappMessage=require(_0x53b7('0x1'))['db'][_0x53b7('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53b7('0x4'),'afterUpdate':'update','afterDestroy':_0x53b7('0x5')};function emitEvent(_0x4c9b8f){return function(_0x357ece,_0xb78251,_0x331d88){_0x357ece[_0x53b7('0x6')]({'attributes':['id'],'raw':!![]})[_0x53b7('0x7')](function(_0x5ee630){_0x357ece[_0x53b7('0x8')](_0x53b7('0x9'),_0x5ee630[_0x53b7('0xa')](function(_0x509608){return{'id':_0x509608['id']};}));return WhatsappMessage[_0x53b7('0xb')]({'where':{'WhatsappInteractionId':_0x357ece['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a107a){_0x357ece[_0x53b7('0x8')](_0x53b7('0xc'),_0x3a107a[_0x53b7('0xd')]);WhatsappInteractionEvents[_0x53b7('0xe')](_0x4c9b8f+':'+_0x357ece['id'],_0x357ece);WhatsappInteractionEvents['emit'](_0x4c9b8f,_0x357ece);_0x331d88(null);})[_0x53b7('0xf')](_0x331d88(null));};}for(var e in events){if(events[_0x53b7('0x10')](e)){var event=events[e];WhatsappInteraction[_0x53b7('0x11')](e,emitEvent(event));}}module[_0x53b7('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 79a0a2a..40fe7d4 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 _0xe2ab=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','closed','closedAt'];(function(_0x3629bb,_0x2e27b8){var _0x478e68=function(_0x4e7ec1){while(--_0x4e7ec1){_0x3629bb['push'](_0x3629bb['shift']());}};_0x478e68(++_0x2e27b8);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x37176a,_0x6a3d95){_0x37176a=_0x37176a-0x0;var _0x8058a=_0xe2ab[_0x37176a];return _0x8058a;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var logger=require(_0xbe2a('0x2'))(_0xbe2a('0x3'));var moment=require(_0xbe2a('0x4'));var BPromise=require(_0xbe2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe2a('0x6'));var rimraf=require(_0xbe2a('0x7'));var config=require(_0xbe2a('0x8'));var attributes=require(_0xbe2a('0x9'));module['exports']=function(_0x2023d3,_0x521365){return _0x2023d3[_0xbe2a('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xbe2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfccbff,_0x232194,_0x59b76c){if(_0xfccbff['changed'](_0xbe2a('0xc'))){_0xfccbff[_0xbe2a('0xd')]=moment()['format'](_0xbe2a('0xe'));}_0x59b76c(null,_0xfccbff);}}});}; \ No newline at end of file +var _0xba2f=['util','../../config/logger','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','format','lodash'];(function(_0x4c9e47,_0x2505be){var _0x2a20d5=function(_0x19df9a){while(--_0x19df9a){_0x4c9e47['push'](_0x4c9e47['shift']());}};_0x2a20d5(++_0x2505be);}(_0xba2f,0x151));var _0xfba2=function(_0x2180f3,_0xafbc93){_0x2180f3=_0x2180f3-0x0;var _0x2bb01d=_0xba2f[_0x2180f3];return _0x2bb01d;};'use strict';var _=require(_0xfba2('0x0'));var util=require(_0xfba2('0x1'));var logger=require(_0xfba2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfba2('0x3'));var fs=require('fs');var path=require(_0xfba2('0x4'));var rimraf=require('rimraf');var config=require(_0xfba2('0x5'));var attributes=require(_0xfba2('0x6'));module[_0xfba2('0x7')]=function(_0x277fec,_0x3ca3a6){return _0x277fec[_0xfba2('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xfba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11c127,_0x2b3fe1,_0xdbf15c){if(_0x11c127[_0xfba2('0xa')](_0xfba2('0xb'))){_0x11c127['closedAt']=moment()[_0xfba2('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdbf15c(null,_0x11c127);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4937b3a..b310989 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 _0xedd2=['limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xedd2,0x1c1));var _0x2edd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xedd2[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2edd('0x0'));var util=require('util');var moment=require(_0x2edd('0x1'));var BPromise=require('bluebird');var rs=require(_0x2edd('0x2'));var fs=require('fs');var Redis=require(_0x2edd('0x3'));var db=require(_0x2edd('0x4'))['db'];var utils=require(_0x2edd('0x5'));var logger=require(_0x2edd('0x6'))(_0x2edd('0x7'));var config=require(_0x2edd('0x8'));var jayson=require(_0x2edd('0x9'));var client=jayson[_0x2edd('0xa')][_0x2edd('0xb')]({'port':0x232a});config[_0x2edd('0xc')]=_[_0x2edd('0xd')](config[_0x2edd('0xc')],{'host':_0x2edd('0xe'),'port':0x18eb});var socket=require(_0x2edd('0xf'))(new Redis(config[_0x2edd('0xc')]));require(_0x2edd('0x10'))[_0x2edd('0x11')](socket);function respondWithRpcPromise(_0x79027b,_0x1a3ce2,_0x373cf3){return new BPromise(function(_0x41dc78,_0x1e44a2){return client[_0x2edd('0x12')](_0x79027b,_0x373cf3)[_0x2edd('0x13')](function(_0x1cd224){logger[_0x2edd('0x14')](_0x2edd('0x15'),_0x1a3ce2,_0x2edd('0x16'));logger[_0x2edd('0x17')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1a3ce2,'request\x20sent',JSON[_0x2edd('0x18')](_0x1cd224));if(_0x1cd224[_0x2edd('0x19')]){if(_0x1cd224[_0x2edd('0x19')][_0x2edd('0x1a')]===0x1f4){logger[_0x2edd('0x19')](_0x2edd('0x15'),_0x1a3ce2,_0x1cd224['error']['message']);return _0x1e44a2(_0x1cd224[_0x2edd('0x19')][_0x2edd('0x1b')]);}logger[_0x2edd('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x1a3ce2,_0x1cd224['error'][_0x2edd('0x1b')]);return _0x41dc78(_0x1cd224['error']['message']);}else{logger[_0x2edd('0x14')](_0x2edd('0x15'),_0x1a3ce2,_0x2edd('0x16'));_0x41dc78(_0x1cd224[_0x2edd('0x1c')]['message']);}})[_0x2edd('0x1d')](function(_0x134939){logger[_0x2edd('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x1a3ce2,_0x134939);_0x1e44a2(_0x134939);});});}exports['UpdateWhatsappInteraction']=function(_0x35d56d){var _0x2623ec=this;return new Promise(function(_0x1f7406,_0xd90126){return db[_0x2edd('0x1e')][_0x2edd('0x1f')](_0x35d56d[_0x2edd('0x20')],{'raw':_0x35d56d['options']?_0x35d56d[_0x2edd('0x21')][_0x2edd('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d56d[_0x2edd('0x21')]?_0x35d56d[_0x2edd('0x21')]['where']||null:null,'attributes':_0x35d56d[_0x2edd('0x21')]?_0x35d56d[_0x2edd('0x21')]['attributes']||null:null,'limit':_0x35d56d[_0x2edd('0x21')]?_0x35d56d[_0x2edd('0x21')][_0x2edd('0x23')]||null:null})[_0x2edd('0x13')](function(_0x611ae3){logger['info'](_0x2edd('0x24'),_0x35d56d);logger[_0x2edd('0x17')]('UpdateWhatsappInteraction',_0x35d56d,JSON[_0x2edd('0x18')](_0x611ae3));_0x1f7406(_0x611ae3);})[_0x2edd('0x1d')](function(_0x18c558){logger['error'](_0x2edd('0x24'),_0x18c558[_0x2edd('0x1b')],_0x35d56d);_0xd90126(_0x2623ec[_0x2edd('0x19')](0x1f4,_0x18c558[_0x2edd('0x1b')]));});});};exports[_0x2edd('0x25')]=function(_0x39a52f){return new Promise(function(_0x494942,_0x173dc3){return db[_0x2edd('0x1e')][_0x2edd('0x26')]({'where':_0x39a52f[_0x2edd('0x21')]?_0x39a52f[_0x2edd('0x21')]['where']||null:null})[_0x2edd('0x13')](function(_0x136a73){if(_0x136a73){return _0x136a73[_0x2edd('0x27')](_0x39a52f[_0x2edd('0x20')][_0x2edd('0x28')],_[_0x2edd('0x29')](_0x39a52f['body'],[_0x2edd('0x28'),'id'])||{});}})[_0x2edd('0x2a')](function(_0x2a31c4){logger[_0x2edd('0x14')](_0x2edd('0x2b'),_0x39a52f);logger[_0x2edd('0x17')](_0x2edd('0x2b'),_0x39a52f,JSON[_0x2edd('0x18')](_0x2a31c4));_0x494942(_0x2a31c4);})[_0x2edd('0x1d')](function(_0xe91708){logger[_0x2edd('0x19')](_0x2edd('0x2b'),_0xe91708['message'],_0x39a52f);_0x173dc3(_this[_0x2edd('0x19')](0x1f4,_0xe91708[_0x2edd('0x1b')]));});});}; \ No newline at end of file +var _0x65d2=['catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x65d2,0x85));var _0x265d=function(_0x3efc1d,_0xd364c7){_0x3efc1d=_0x3efc1d-0x0;var _0x51c67c=_0x65d2[_0x3efc1d];return _0x51c67c;};'use strict';var _=require(_0x265d('0x0'));var util=require(_0x265d('0x1'));var moment=require(_0x265d('0x2'));var BPromise=require(_0x265d('0x3'));var rs=require(_0x265d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x265d('0x5'))['db'];var utils=require(_0x265d('0x6'));var logger=require('../../config/logger')(_0x265d('0x7'));var config=require(_0x265d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x265d('0x9')][_0x265d('0xa')]({'port':0x232a});config[_0x265d('0xb')]=_[_0x265d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x265d('0xd'))(new Redis(config[_0x265d('0xb')]));require(_0x265d('0xe'))['register'](socket);function respondWithRpcPromise(_0x53a47c,_0x524773,_0x6ad2ab){return new BPromise(function(_0x31fc8a,_0x5c294d){return client[_0x265d('0xf')](_0x53a47c,_0x6ad2ab)[_0x265d('0x10')](function(_0x5ac745){logger[_0x265d('0x11')](_0x265d('0x12'),_0x524773,_0x265d('0x13'));logger[_0x265d('0x14')](_0x265d('0x15'),_0x524773,'request\x20sent',JSON[_0x265d('0x16')](_0x5ac745));if(_0x5ac745[_0x265d('0x17')]){if(_0x5ac745[_0x265d('0x17')][_0x265d('0x18')]===0x1f4){logger[_0x265d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x524773,_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);return _0x5c294d(_0x5ac745['error'][_0x265d('0x19')]);}logger['error'](_0x265d('0x12'),_0x524773,_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);return _0x31fc8a(_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);}else{logger['info'](_0x265d('0x12'),_0x524773,_0x265d('0x13'));_0x31fc8a(_0x5ac745['result'][_0x265d('0x19')]);}})['catch'](function(_0x1a5fec){logger[_0x265d('0x17')](_0x265d('0x12'),_0x524773,_0x1a5fec);_0x5c294d(_0x1a5fec);});});}exports[_0x265d('0x1a')]=function(_0x4db880){var _0x171ceb=this;return new Promise(function(_0x20e961,_0x521916){return db[_0x265d('0x1b')][_0x265d('0x1c')](_0x4db880[_0x265d('0x1d')],{'raw':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x20')]||null:null,'attributes':_0x4db880['options']?_0x4db880['options'][_0x265d('0x21')]||null:null,'limit':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x22')]||null:null})[_0x265d('0x10')](function(_0x439c94){logger[_0x265d('0x11')](_0x265d('0x1a'),_0x4db880);logger[_0x265d('0x14')](_0x265d('0x1a'),_0x4db880,JSON[_0x265d('0x16')](_0x439c94));_0x20e961(_0x439c94);})[_0x265d('0x23')](function(_0x859e07){logger[_0x265d('0x17')](_0x265d('0x1a'),_0x859e07['message'],_0x4db880);_0x521916(_0x171ceb[_0x265d('0x17')](0x1f4,_0x859e07[_0x265d('0x19')]));});});};exports[_0x265d('0x24')]=function(_0x1cf2f5){return new Promise(function(_0x217b05,_0x86919){return db[_0x265d('0x1b')][_0x265d('0x25')]({'where':_0x1cf2f5[_0x265d('0x1e')]?_0x1cf2f5['options'][_0x265d('0x20')]||null:null})['then'](function(_0x1f5b12){if(_0x1f5b12){return _0x1f5b12[_0x265d('0x26')](_0x1cf2f5[_0x265d('0x1d')][_0x265d('0x27')],_['omit'](_0x1cf2f5['body'],['ids','id'])||{});}})[_0x265d('0x28')](function(_0x10c762){logger[_0x265d('0x11')](_0x265d('0x29'),_0x1cf2f5);logger[_0x265d('0x14')](_0x265d('0x29'),_0x1cf2f5,JSON[_0x265d('0x16')](_0x10c762));_0x217b05(_0x10c762);})[_0x265d('0x23')](function(_0x34ca24){logger[_0x265d('0x17')]('AddTags',_0x34ca24['message'],_0x1cf2f5);_0x86919(_this['error'](0x1f4,_0x34ca24[_0x265d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ddc5acd..3780e6c 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 _0x4a01=['emit','register','length','./whatsappInteraction.events','save','remove','update'];(function(_0x395d0b,_0x33a9bf){var _0x1a55ae=function(_0x1bcc68){while(--_0x1bcc68){_0x395d0b['push'](_0x395d0b['shift']());}};_0x1a55ae(++_0x33a9bf);}(_0x4a01,0x1ca));var _0x14a0=function(_0x2fe64f,_0x2c1808){_0x2fe64f=_0x2fe64f-0x0;var _0x48a541=_0x4a01[_0x2fe64f];return _0x48a541;};'use strict';var WhatsappInteractionEvents=require(_0x14a0('0x0'));var events=[_0x14a0('0x1'),_0x14a0('0x2'),_0x14a0('0x3')];function createListener(_0x4ba2fa,_0x5cbaec){return function(_0x5deaad){_0x5cbaec[_0x14a0('0x4')](_0x4ba2fa,_0x5deaad);};}function removeListener(_0x2b6d42,_0x16df35){return function(){WhatsappInteractionEvents['removeListener'](_0x2b6d42,_0x16df35);};}exports[_0x14a0('0x5')]=function(_0x2ae3de){for(var _0x5bcf04=0x0,_0x199a86=events[_0x14a0('0x6')];_0x5bcf04<_0x199a86;_0x5bcf04++){var _0x2f03ea=events[_0x5bcf04];var _0x5e4905=createListener('whatsappInteraction:'+_0x2f03ea,_0x2ae3de);WhatsappInteractionEvents['on'](_0x2f03ea,_0x5e4905);}}; \ No newline at end of file +var _0xfac1=['length','./whatsappInteraction.events','save','remove','update','removeListener','register'];(function(_0x1eb10f,_0x122f85){var _0x2f51fc=function(_0x59de9a){while(--_0x59de9a){_0x1eb10f['push'](_0x1eb10f['shift']());}};_0x2f51fc(++_0x122f85);}(_0xfac1,0xa2));var _0x1fac=function(_0x5ed082,_0x12c0ef){_0x5ed082=_0x5ed082-0x0;var _0x1423a9=_0xfac1[_0x5ed082];return _0x1423a9;};'use strict';var WhatsappInteractionEvents=require(_0x1fac('0x0'));var events=[_0x1fac('0x1'),_0x1fac('0x2'),_0x1fac('0x3')];function createListener(_0x25ab6c,_0x1ef58b){return function(_0x25e019){_0x1ef58b['emit'](_0x25ab6c,_0x25e019);};}function removeListener(_0x787279,_0x142580){return function(){WhatsappInteractionEvents[_0x1fac('0x4')](_0x787279,_0x142580);};}exports[_0x1fac('0x5')]=function(_0x5b8896){for(var _0x4352d7=0x0,_0x37de8f=events[_0x1fac('0x6')];_0x4352d7<_0x37de8f;_0x4352d7++){var _0x5d5a7b=events[_0x4352d7];var _0x17bbcd=createListener('whatsappInteraction:'+_0x5d5a7b,_0x5b8896);WhatsappInteractionEvents['on'](_0x5d5a7b,_0x17bbcd);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 123eace..69d8f53 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 _0xbdad=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','describe','get','/:id','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xbdad,0x1a0));var _0xdbda=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbdad[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xdbda('0x0'));var util=require(_0xdbda('0x1'));var path=require(_0xdbda('0x2'));var timeout=require(_0xdbda('0x3'));var express=require(_0xdbda('0x4'));var router=express[_0xdbda('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbda('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xdbda('0x7')](),controller[_0xdbda('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdbda('0x9')]);router[_0xdbda('0xa')](_0xdbda('0xb'),auth[_0xdbda('0x7')](),controller['show']);router[_0xdbda('0xc')]('/',auth[_0xdbda('0x7')](),interaction[_0xdbda('0xd')]('whatsapp',_0xdbda('0xe')),controller[_0xdbda('0xf')]);router[_0xdbda('0xc')]('/:id/status',controller[_0xdbda('0x10')]);router[_0xdbda('0x11')](_0xdbda('0xb'),auth['isAuthenticated'](),controller[_0xdbda('0x12')]);router['put'](_0xdbda('0x13'),auth[_0xdbda('0x7')](),controller['accept']);router[_0xdbda('0x11')](_0xdbda('0x14'),auth['isAuthenticated'](),controller['reject']);router[_0xdbda('0x15')](_0xdbda('0xb'),auth[_0xdbda('0x7')](),controller[_0xdbda('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5258=['isAuthenticated','show','post','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','index','/describe'];(function(_0x59478e,_0x5d98d6){var _0x3c6ea1=function(_0x8ec690){while(--_0x8ec690){_0x59478e['push'](_0x59478e['shift']());}};_0x3c6ea1(++_0x5d98d6);}(_0x5258,0x147));var _0x8525=function(_0x480ab2,_0x20b3a7){_0x480ab2=_0x480ab2-0x0;var _0x35c362=_0x5258[_0x480ab2];return _0x35c362;};'use strict';var multer=require(_0x8525('0x0'));var util=require(_0x8525('0x1'));var path=require('path');var timeout=require(_0x8525('0x2'));var express=require(_0x8525('0x3'));var router=express[_0x8525('0x4')]();var fs_extra=require(_0x8525('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8525('0x6'));var config=require('../../config/environment');var controller=require(_0x8525('0x7'));router[_0x8525('0x8')]('/',auth['isAuthenticated'](),controller[_0x8525('0x9')]);router[_0x8525('0x8')](_0x8525('0xa'),auth[_0x8525('0xb')](),controller['describe']);router[_0x8525('0x8')]('/:id',auth[_0x8525('0xb')](),controller[_0x8525('0xc')]);router[_0x8525('0xd')]('/',auth[_0x8525('0xb')](),interaction['tracked']('whatsapp',_0x8525('0xe')),controller['create']);router['post'](_0x8525('0xf'),controller[_0x8525('0x10')]);router[_0x8525('0x11')](_0x8525('0x12'),auth[_0x8525('0xb')](),controller[_0x8525('0x13')]);router['put'](_0x8525('0x14'),auth[_0x8525('0xb')](),controller['accept']);router[_0x8525('0x11')](_0x8525('0x15'),auth[_0x8525('0xb')](),controller[_0x8525('0x16')]);router[_0x8525('0x17')]('/:id',auth[_0x8525('0xb')](),controller[_0x8525('0x18')]);module[_0x8525('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7d54798..e0ab3e8 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 _0xe64b=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x1df79c,_0x5ad8fd){var _0x2f23e4=function(_0x47836f){while(--_0x47836f){_0x1df79c['push'](_0x1df79c['shift']());}};_0x2f23e4(++_0x5ad8fd);}(_0xe64b,0x188));var _0xbe64=function(_0x49ab71,_0x11161d){_0x49ab71=_0x49ab71-0x0;var _0x2c3276=_0xe64b[_0x49ab71];return _0x2c3276;};'use strict';var Sequelize=require(_0xbe64('0x0'));module[_0xbe64('0x1')]={'body':{'type':Sequelize[_0xbe64('0x2')](_0xbe64('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbe64('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe64('0x5')]('in','out'),'defaultValue':_0xbe64('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbe64('0x7')]},'readAt':{'type':Sequelize[_0xbe64('0x8')]},'secret':{'type':Sequelize[_0xbe64('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbe64('0x7')]},'providerResponse':{'type':Sequelize[_0xbe64('0x2')]}}; \ No newline at end of file +var _0xf101=['TEXT','medium','BOOLEAN','ENUM','STRING','DATE','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf101,0x141));var _0x1f10=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xf101[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require('sequelize');module[_0x1f10('0x0')]={'body':{'type':Sequelize[_0x1f10('0x1')](_0x1f10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f10('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f10('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1f10('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1f10('0x5')]},'readAt':{'type':Sequelize[_0x1f10('0x6')]},'secret':{'type':Sequelize[_0x1f10('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f10('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a475560..c663478 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 _0xd0ad=['client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','status','end','offset','limit','count','set','json','save','destroy','stack','name','send','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','email','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','interface','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xd0ad,0xf4));var _0xdd0a=function(_0x3f3db6,_0x2d8f1f){_0x3f3db6=_0x3f3db6-0x0;var _0x3fa280=_0xd0ad[_0x3f3db6];return _0x3fa280;};'use strict';var emlformat=require(_0xdd0a('0x0'));var rimraf=require(_0xdd0a('0x1'));var zipdir=require(_0xdd0a('0x2'));var jsonpatch=require(_0xdd0a('0x3'));var rp=require(_0xdd0a('0x4'));var moment=require('moment');var BPromise=require(_0xdd0a('0x5'));var Mustache=require(_0xdd0a('0x6'));var util=require(_0xdd0a('0x7'));var path=require(_0xdd0a('0x8'));var sox=require(_0xdd0a('0x9'));var csv=require(_0xdd0a('0xa'));var ejs=require(_0xdd0a('0xb'));var fs=require('fs');var fs_extra=require(_0xdd0a('0xc'));var _=require(_0xdd0a('0xd'));var squel=require(_0xdd0a('0xe'));var crypto=require(_0xdd0a('0xf'));var jsforce=require(_0xdd0a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdd0a('0x11'));var Papa=require(_0xdd0a('0x12'));var Redis=require(_0xdd0a('0x13'));var authService=require(_0xdd0a('0x14'));var qs=require(_0xdd0a('0x15'));var as=require(_0xdd0a('0x16'));var hardwareService=require(_0xdd0a('0x17'));var logger=require('../../config/logger')(_0xdd0a('0x18'));var utils=require(_0xdd0a('0x19'));var config=require(_0xdd0a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd0a('0x1b'))['db'];config[_0xdd0a('0x1c')]=_['defaults'](config[_0xdd0a('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdd0a('0x1d'))[_0xdd0a('0x1e')](socket);var jayson=require(_0xdd0a('0x1f'));var client=jayson[_0xdd0a('0x20')][_0xdd0a('0x21')]({'port':0x232c});var client9002=jayson[_0xdd0a('0x20')][_0xdd0a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xddd544,_0x293120,_0xc60ff8,_0x590d70){return new BPromise(function(_0x25b490,_0x3c0bd8){var _0x3c7175=_0x590d70||client;return _0x3c7175[_0xdd0a('0x22')](_0xddd544,_0xc60ff8)[_0xdd0a('0x23')](function(_0x5b101d){logger[_0xdd0a('0x24')](_0xdd0a('0x25'),_0x293120,'request\x20sent');logger[_0xdd0a('0x26')](_0xdd0a('0x27'),_0x293120,_0xdd0a('0x28'),JSON[_0xdd0a('0x29')](_0x5b101d));if(_0x5b101d['error']){if(_0x5b101d['error'][_0xdd0a('0x2a')]===0x1f4){logger[_0xdd0a('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x293120,_0x5b101d['error'][_0xdd0a('0x2c')]);return _0x3c0bd8(_0x5b101d[_0xdd0a('0x2b')][_0xdd0a('0x2c')]);}logger[_0xdd0a('0x2b')](_0xdd0a('0x25'),_0x293120,_0x5b101d[_0xdd0a('0x2b')][_0xdd0a('0x2c')]);return _0x25b490(_0x5b101d[_0xdd0a('0x2b')]['message']);}else{logger[_0xdd0a('0x24')](_0xdd0a('0x25'),_0x293120,_0xdd0a('0x28'));_0x25b490(_0x5b101d['result']['message']);}})[_0xdd0a('0x2d')](function(_0x5e3812){logger[_0xdd0a('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x293120,_0x5e3812);_0x3c0bd8(_0x5e3812);});});}function respondWithStatusCode(_0x4a6c84,_0x34f00f){_0x34f00f=_0x34f00f||0xcc;return function(_0x5ee9f6){if(_0x5ee9f6){return _0x4a6c84[_0xdd0a('0x2e')](_0x34f00f);}return _0x4a6c84[_0xdd0a('0x2f')](_0x34f00f)[_0xdd0a('0x30')]();};}function respondWithResult(_0x1e64d5,_0x3a1424){_0x3a1424=_0x3a1424||0xc8;return function(_0x32d510){if(_0x32d510){return _0x1e64d5[_0xdd0a('0x2f')](_0x3a1424)['json'](_0x32d510);}};}function respondWithFilteredResult(_0x11454f,_0x377027){return function(_0x6c3d9){if(_0x6c3d9){var _0x3089ab=typeof _0x377027[_0xdd0a('0x31')]==='undefined'&&typeof _0x377027[_0xdd0a('0x32')]==='undefined';var _0x2fc4ca=_0x6c3d9[_0xdd0a('0x33')];var _0x35d2ba=_0x3089ab?0x0:_0x377027[_0xdd0a('0x31')];var _0x12e826=_0x3089ab?_0x6c3d9[_0xdd0a('0x33')]:_0x377027[_0xdd0a('0x31')]+_0x377027[_0xdd0a('0x32')];var _0x2609af;if(_0x12e826>=_0x2fc4ca){_0x12e826=_0x2fc4ca;_0x2609af=0xc8;}else{_0x2609af=0xce;}_0x11454f['status'](_0x2609af);return _0x11454f[_0xdd0a('0x34')]('Content-Range',_0x35d2ba+'-'+_0x12e826+'/'+_0x2fc4ca)[_0xdd0a('0x35')](_0x6c3d9);}return null;};}function patchUpdates(_0x11fb64){return function(_0x295441){try{jsonpatch['apply'](_0x295441,_0x11fb64,!![]);}catch(_0x43dc89){return BPromise['reject'](_0x43dc89);}return _0x295441[_0xdd0a('0x36')]();};}function saveUpdates(_0xfd80d4,_0x59765a){return function(_0x1e0fa1){if(_0x1e0fa1){return _0x1e0fa1['update'](_0xfd80d4)[_0xdd0a('0x23')](function(_0x3b224a){return _0x3b224a;});}return null;};}function removeEntity(_0x51b416,_0x1d194a){return function(_0x25e6eb){if(_0x25e6eb){return _0x25e6eb[_0xdd0a('0x37')]()[_0xdd0a('0x23')](function(){_0x51b416['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a79d7,_0x4dfc3c){return function(_0x1fd06f){if(!_0x1fd06f){_0x1a79d7[_0xdd0a('0x2e')](0x194);}return _0x1fd06f;};}function handleError(_0x5226c6,_0x103c8f){_0x103c8f=_0x103c8f||0x1f4;return function(_0xf76a76){logger[_0xdd0a('0x2b')](_0xf76a76[_0xdd0a('0x38')]);if(_0xf76a76['name']){delete _0xf76a76[_0xdd0a('0x39')];}_0x5226c6['status'](_0x103c8f)[_0xdd0a('0x3a')](_0xf76a76);};}exports['index']=function(_0x8c53ca,_0x19d153){var _0x54b665={},_0x58b04c={},_0x14c7df={'count':0x0,'rows':[]};var _0x92a486=_['map'](db['WhatsappMessage'][_0xdd0a('0x3b')],function(_0x348b70){return{'name':_0x348b70[_0xdd0a('0x3c')],'type':_0x348b70[_0xdd0a('0x3d')]['key']};});_0x58b04c[_0xdd0a('0x3e')]=_[_0xdd0a('0x3f')](_0x92a486,'name');_0x58b04c['query']=_['keys'](_0x8c53ca[_0xdd0a('0x40')]);_0x58b04c[_0xdd0a('0x41')]=_[_0xdd0a('0x42')](_0x58b04c[_0xdd0a('0x3e')],_0x58b04c[_0xdd0a('0x40')]);_0x54b665[_0xdd0a('0x43')]=_[_0xdd0a('0x42')](_0x58b04c[_0xdd0a('0x3e')],qs[_0xdd0a('0x44')](_0x8c53ca['query'][_0xdd0a('0x44')]));_0x54b665[_0xdd0a('0x43')]=_0x54b665[_0xdd0a('0x43')][_0xdd0a('0x45')]?_0x54b665[_0xdd0a('0x43')]:_0x58b04c[_0xdd0a('0x3e')];if(!_0x8c53ca[_0xdd0a('0x40')][_0xdd0a('0x46')](_0xdd0a('0x47'))){_0x54b665[_0xdd0a('0x32')]=qs['limit'](_0x8c53ca[_0xdd0a('0x40')]['limit']);_0x54b665['offset']=qs['offset'](_0x8c53ca['query'][_0xdd0a('0x31')]);}_0x54b665['order']=qs[_0xdd0a('0x48')](_0x8c53ca[_0xdd0a('0x40')]['sort']);_0x54b665[_0xdd0a('0x49')]=qs[_0xdd0a('0x41')](_[_0xdd0a('0x4a')](_0x8c53ca[_0xdd0a('0x40')],_0x58b04c[_0xdd0a('0x41')]),_0x92a486);if(_0x8c53ca[_0xdd0a('0x40')][_0xdd0a('0x4b')]){_0x54b665[_0xdd0a('0x49')]=_[_0xdd0a('0x4c')](_0x54b665[_0xdd0a('0x49')],{'$or':_[_0xdd0a('0x3f')](_0x92a486,function(_0x1fc4b7){if(_0x1fc4b7['type']!==_0xdd0a('0x4d')){var _0x32c9bc={};_0x32c9bc[_0x1fc4b7[_0xdd0a('0x39')]]={'$like':'%'+_0x8c53ca[_0xdd0a('0x40')][_0xdd0a('0x4b')]+'%'};return _0x32c9bc;}})});}_0x54b665=_[_0xdd0a('0x4c')]({},_0x54b665,_0x8c53ca[_0xdd0a('0x4e')]);var _0x35a385={'where':_0x54b665[_0xdd0a('0x49')]};return db[_0xdd0a('0x4f')]['count'](_0x35a385)[_0xdd0a('0x23')](function(_0x234b91){_0x14c7df[_0xdd0a('0x33')]=_0x234b91;if(_0x8c53ca[_0xdd0a('0x40')][_0xdd0a('0x50')]){_0x54b665[_0xdd0a('0x51')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xdd0a('0x52')](_0x54b665);})[_0xdd0a('0x23')](function(_0x50e3b6){_0x14c7df[_0xdd0a('0x53')]=_0x50e3b6;return _0x14c7df;})['then'](respondWithFilteredResult(_0x19d153,_0x54b665))[_0xdd0a('0x2d')](handleError(_0x19d153,null));};exports[_0xdd0a('0x54')]=function(_0x4639b9,_0x3d06c3){var _0x47e317={'raw':!![],'where':{'id':_0x4639b9[_0xdd0a('0x55')]['id']}},_0x15a3d4={};_0x15a3d4[_0xdd0a('0x3e')]=_['keys'](db[_0xdd0a('0x4f')][_0xdd0a('0x3b')]);_0x15a3d4['query']=_['keys'](_0x4639b9['query']);_0x15a3d4[_0xdd0a('0x41')]=_[_0xdd0a('0x42')](_0x15a3d4[_0xdd0a('0x3e')],_0x15a3d4[_0xdd0a('0x40')]);_0x47e317[_0xdd0a('0x43')]=_[_0xdd0a('0x42')](_0x15a3d4[_0xdd0a('0x3e')],qs[_0xdd0a('0x44')](_0x4639b9['query'][_0xdd0a('0x44')]));_0x47e317[_0xdd0a('0x43')]=_0x47e317[_0xdd0a('0x43')][_0xdd0a('0x45')]?_0x47e317[_0xdd0a('0x43')]:_0x15a3d4[_0xdd0a('0x3e')];if(_0x4639b9[_0xdd0a('0x40')][_0xdd0a('0x50')]){_0x47e317['include']=[{'all':!![]}];}_0x47e317=_['merge']({},_0x47e317,_0x4639b9[_0xdd0a('0x4e')]);return db['WhatsappMessage'][_0xdd0a('0x56')](_0x47e317)[_0xdd0a('0x23')](handleEntityNotFound(_0x3d06c3,null))[_0xdd0a('0x23')](respondWithResult(_0x3d06c3,null))[_0xdd0a('0x2d')](handleError(_0x3d06c3,null));};exports[_0xdd0a('0x57')]=function(_0x1e7bcb,_0x5c6a99){return db['WhatsappMessage'][_0xdd0a('0x57')](_0x1e7bcb[_0xdd0a('0x58')],{})['then'](respondWithResult(_0x5c6a99,0xc9))['catch'](handleError(_0x5c6a99,null));};exports[_0xdd0a('0x59')]=function(_0x4638bb,_0x460323){if(_0x4638bb[_0xdd0a('0x58')]['id']){delete _0x4638bb[_0xdd0a('0x58')]['id'];}return db[_0xdd0a('0x4f')][_0xdd0a('0x56')]({'where':{'id':_0x4638bb[_0xdd0a('0x55')]['id']}})[_0xdd0a('0x23')](handleEntityNotFound(_0x460323,null))[_0xdd0a('0x23')](saveUpdates(_0x4638bb['body'],null))['then'](respondWithResult(_0x460323,null))['catch'](handleError(_0x460323,null));};exports[_0xdd0a('0x37')]=function(_0x56898c,_0x18ae43){return db[_0xdd0a('0x4f')][_0xdd0a('0x56')]({'where':{'id':_0x56898c[_0xdd0a('0x55')]['id']}})[_0xdd0a('0x23')](handleEntityNotFound(_0x18ae43,null))[_0xdd0a('0x23')](removeEntity(_0x18ae43,null))[_0xdd0a('0x2d')](handleError(_0x18ae43,null));};exports[_0xdd0a('0x5a')]=function(_0x39b0e5,_0x33b7a1){return db[_0xdd0a('0x4f')][_0xdd0a('0x5a')]()[_0xdd0a('0x23')](respondWithResult(_0x33b7a1,null))[_0xdd0a('0x2d')](handleError(_0x33b7a1,null));};var interaction_log=require(_0xdd0a('0x5b'))(_0xdd0a('0x5c'));exports[_0xdd0a('0x5d')]=function(_0x582a1a,_0x382b86,_0x1b3246){var _0x4e9434={'agent':{},'channel':_0xdd0a('0x5e')};if(_0x582a1a[_0xdd0a('0x58')]['id']){delete _0x582a1a['body']['id'];}_0x582a1a['body'][_0xdd0a('0x5f')]=!![];_0x582a1a[_0xdd0a('0x58')][_0xdd0a('0x60')]=moment()[_0xdd0a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x582a1a[_0xdd0a('0x58')][_0xdd0a('0x62')]=_0x582a1a[_0xdd0a('0x58')][_0xdd0a('0x62')]||_0x582a1a[_0xdd0a('0x63')]['id'];_0x4e9434[_0xdd0a('0x64')]['id']=_0x582a1a[_0xdd0a('0x58')][_0xdd0a('0x62')];return db['WhatsappMessage'][_0xdd0a('0x56')]({'where':{'id':_0x582a1a['params']['id'],'UserId':null}})[_0xdd0a('0x23')](handleEntityNotFound(_0x382b86,null))[_0xdd0a('0x23')](saveUpdates(_0x582a1a[_0xdd0a('0x58')],null))[_0xdd0a('0x23')](function(_0x405faa){if(_0x405faa){_0x4e9434[_0xdd0a('0x2c')]=_0x405faa[_0xdd0a('0x65')]({'plain':!![]});return db[_0xdd0a('0x66')][_0xdd0a('0x56')]({'where':{'id':_0x405faa[_0xdd0a('0x67')]}});}return null;})[_0xdd0a('0x23')](handleEntityNotFound(_0x382b86,null))[_0xdd0a('0x23')](function(_0x23a2db){if(_0x23a2db){return _0x23a2db[_0xdd0a('0x59')]({'UserId':_0x582a1a[_0xdd0a('0x58')]['UserId'],'read1stAt':_[_0xdd0a('0x68')](_0x23a2db['read1stAt'])?moment()[_0xdd0a('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdd0a('0x23')](function(_0x26733e){if(_0x26733e){_0x4e9434[_0xdd0a('0x69')]=_0x26733e[_0xdd0a('0x65')]({'plain':!![]});interaction_log[_0xdd0a('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x582a1a['user']['id'],_0x582a1a['user'][_0xdd0a('0x39')],_0x582a1a[_0xdd0a('0x63')]['role'],_0x4e9434[_0xdd0a('0x69')]['id'],_0x582a1a['body']?JSON[_0xdd0a('0x29')](_0x582a1a['body']):_0xdd0a('0x6a'));return respondWithRpcPromise(_0xdd0a('0x6b'),_0xdd0a('0x6c'),_0x4e9434);}return null;})[_0xdd0a('0x23')](function(_0x574837){var _0x18a6c3=_0xdd0a('0x6d')+_0x574837['message'][_0xdd0a('0x6e')];return db['sequelize']['query'](_0x18a6c3,{'type':db[_0xdd0a('0x6f')][_0xdd0a('0x70')][_0xdd0a('0x71')],'raw':!![]})[_0xdd0a('0x23')](function(_0x5b3ba9){return _0x5b3ba9;});})[_0xdd0a('0x23')](function(_0x751089){if(_0x751089){_0x4e9434[_0xdd0a('0x2c')]['contact']=_0x751089[0x0];if(!_0x582a1a[_0xdd0a('0x58')]['UserId'])return;return db[_0xdd0a('0x72')]['find']({'where':{'id':_0x582a1a['body'][_0xdd0a('0x62')],'role':_0xdd0a('0x64')},'attributes':['id','name','fullname',_0xdd0a('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x214f7c){if(!_0x214f7c)return null;_0x4e9434[_0xdd0a('0x2c')][_0xdd0a('0x64')]=_0x214f7c;return _0x4e9434;})['then'](function(_0x509519){if(_0x509519){if(_0x582a1a[_0xdd0a('0x58')][_0xdd0a('0x74')]){_0x4e9434[_0xdd0a('0x2c')]['interface']=util[_0xdd0a('0x61')]('SIP/%s',_0x582a1a[_0xdd0a('0x63')][_0xdd0a('0x39')]);_0x4e9434[_0xdd0a('0x2c')][_0xdd0a('0x75')]=_0x4e9434[_0xdd0a('0x75')];_0x4e9434[_0xdd0a('0x2c')][_0xdd0a('0x76')]=_0x4e9434[_0xdd0a('0x75')];_0x4e9434[_0xdd0a('0x2c')][_0xdd0a('0x77')]=_0xdd0a('0x5d');return respondWithRpcPromise(_0xdd0a('0x78'),_0xdd0a('0x78'),{'event':_0xdd0a('0x79'),'message':_0x4e9434[_0xdd0a('0x2c')]},client9002)[_0xdd0a('0x23')](function(){return _0x4e9434;});}return _0x4e9434;}return null;})['then'](respondWithResult(_0x382b86,null))[_0xdd0a('0x2d')](handleError(_0x382b86,null));};var interaction_log=require('../../config/logger')(_0xdd0a('0x5c'));exports[_0xdd0a('0x7a')]=function(_0x23f54b,_0xb15390,_0x201c01){var _0x2198e9={'agent':{},'channel':_0xdd0a('0x5e')};if(_0x23f54b[_0xdd0a('0x58')]['id']){delete _0x23f54b[_0xdd0a('0x58')]['id'];}_0x23f54b[_0xdd0a('0x58')]['UserId']=_0x23f54b[_0xdd0a('0x58')][_0xdd0a('0x62')]||_0x23f54b[_0xdd0a('0x63')]['id'];_0x2198e9[_0xdd0a('0x64')]['id']=_0x23f54b[_0xdd0a('0x58')][_0xdd0a('0x62')];return db[_0xdd0a('0x4f')][_0xdd0a('0x56')]({'where':{'id':_0x23f54b[_0xdd0a('0x55')]['id'],'UserId':null}})[_0xdd0a('0x23')](handleEntityNotFound(_0xb15390,null))[_0xdd0a('0x23')](function(_0x25a2ff){if(_0x25a2ff){_0x2198e9[_0xdd0a('0x2c')]=_0x25a2ff[_0xdd0a('0x65')]({'plain':!![]});return db[_0xdd0a('0x66')][_0xdd0a('0x56')]({'where':{'id':_0x25a2ff[_0xdd0a('0x67')]}});}return null;})[_0xdd0a('0x23')](handleEntityNotFound(_0xb15390,null))[_0xdd0a('0x23')](function(_0x14fbf9){if(_0x14fbf9){_0x2198e9[_0xdd0a('0x69')]=_0x14fbf9[_0xdd0a('0x65')]({'plain':!![]});interaction_log[_0xdd0a('0x24')](_0xdd0a('0x7b'),_0x23f54b[_0xdd0a('0x63')]['id'],_0x23f54b['user'][_0xdd0a('0x39')],_0x23f54b[_0xdd0a('0x63')]['role'],_0x2198e9['interaction']['id'],_0x23f54b[_0xdd0a('0x58')]?JSON[_0xdd0a('0x29')](_0x23f54b['body']):_0xdd0a('0x6a'));return respondWithRpcPromise('RejectMessage',_0xdd0a('0x7c'),_0x2198e9);}return null;})[_0xdd0a('0x23')](function(_0x312bc3){var _0x8e90c8=_0xdd0a('0x6d')+_0x312bc3[_0xdd0a('0x2c')][_0xdd0a('0x6e')];return db['sequelize'][_0xdd0a('0x40')](_0x8e90c8,{'type':db[_0xdd0a('0x6f')][_0xdd0a('0x70')][_0xdd0a('0x71')],'raw':!![]})[_0xdd0a('0x23')](function(_0x13800c){return _0x13800c;});})['then'](function(_0x13295f){if(_0x13295f){_0x2198e9[_0xdd0a('0x2c')]['contact']=_0x13295f[0x0];if(!_0x23f54b[_0xdd0a('0x58')]['UserId'])return;return db[_0xdd0a('0x72')][_0xdd0a('0x56')]({'where':{'id':_0x23f54b[_0xdd0a('0x58')][_0xdd0a('0x62')],'role':_0xdd0a('0x64')},'attributes':['id','name',_0xdd0a('0x7d'),_0xdd0a('0x73'),'internal'],'raw':!![]});}return null;})[_0xdd0a('0x23')](function(_0x3a2864){if(!_0x3a2864)return null;_0x2198e9[_0xdd0a('0x2c')][_0xdd0a('0x64')]=_0x3a2864;return _0x2198e9;})[_0xdd0a('0x23')](function(_0x24466d){if(_0x24466d){_0x24466d[_0xdd0a('0x2c')][_0xdd0a('0x7e')]=util[_0xdd0a('0x61')](_0xdd0a('0x7f'),_0x23f54b[_0xdd0a('0x63')][_0xdd0a('0x39')]);_0x24466d[_0xdd0a('0x2c')][_0xdd0a('0x75')]=_0x2198e9[_0xdd0a('0x75')];_0x24466d['message'][_0xdd0a('0x76')]=_0x2198e9[_0xdd0a('0x75')];_0x24466d[_0xdd0a('0x2c')][_0xdd0a('0x77')]='reject';respondWithRpcPromise(_0xdd0a('0x78'),_0xdd0a('0x78'),{'event':_0xdd0a('0x80'),'message':_0x24466d[_0xdd0a('0x2c')]},client9002);return _0x2198e9;}return null;})['then'](respondWithResult(_0xb15390,null))[_0xdd0a('0x2d')](handleError(_0xb15390,null));};exports['status']=function(_0x315c33,_0xfa34ec,_0x41e181){if(_0x315c33['body']['id']){delete _0x315c33['body']['id'];}var _0x5e3ccb;return db[_0xdd0a('0x4f')][_0xdd0a('0x56')]({'where':{'id':_0x315c33['params']['id']}})[_0xdd0a('0x23')](handleEntityNotFound(_0xfa34ec,null))[_0xdd0a('0x23')](function(_0xa3c8d7){if(_0xa3c8d7){_0x5e3ccb=_0xa3c8d7;return db[_0xdd0a('0x81')][_0xdd0a('0x56')]({'where':{'id':_0xa3c8d7['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xfa34ec,null))[_0xdd0a('0x23')](function(_0x2ceb91){if(_0x2ceb91){logger[_0xdd0a('0x26')](_0xdd0a('0x82'),_0xdd0a('0x2f'),_0xdd0a('0x83'),_0x2ceb91[_0xdd0a('0x3d')],util[_0xdd0a('0x84')](_0x315c33['body'],{'showHidden':![],'depth':null}));switch(_0x2ceb91[_0xdd0a('0x3d')]){case _0xdd0a('0x85'):if(_0x315c33['body'][_0xdd0a('0x86')]&&_0x315c33[_0xdd0a('0x58')][_0xdd0a('0x86')]===_0x5e3ccb[_0xdd0a('0x87')]&&_0x315c33['body'][_0xdd0a('0x88')]&&_0x315c33[_0xdd0a('0x58')][_0xdd0a('0x88')]===_0xdd0a('0x5f')){return _0x5e3ccb[_0xdd0a('0x59')]({'read':!![]});}else{logger['error'](_0xdd0a('0x89'),'status',_0xdd0a('0x85'),util[_0xdd0a('0x84')](_0x315c33[_0xdd0a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5e3ccb;}})[_0xdd0a('0x23')](respondWithResult(_0xfa34ec,null))[_0xdd0a('0x2d')](handleError(_0xfa34ec,null));}; \ No newline at end of file +var _0xdeb9=['acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','whatsapp-interactions','reject','WhatsappInteraction','role','RejectMessage','rejectMessage','contact','email','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','end','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','describe','../../config/logger','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage'];(function(_0x30f836,_0x3fac56){var _0x8dd7d0=function(_0x486ddc){while(--_0x486ddc){_0x30f836['push'](_0x30f836['shift']());}};_0x8dd7d0(++_0x3fac56);}(_0xdeb9,0x132));var _0x9deb=function(_0x2f723a,_0x139ccf){_0x2f723a=_0x2f723a-0x0;var _0x9e148b=_0xdeb9[_0x2f723a];return _0x9e148b;};'use strict';var emlformat=require(_0x9deb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9deb('0x1'));var jsonpatch=require(_0x9deb('0x2'));var rp=require(_0x9deb('0x3'));var moment=require(_0x9deb('0x4'));var BPromise=require(_0x9deb('0x5'));var Mustache=require(_0x9deb('0x6'));var util=require(_0x9deb('0x7'));var path=require(_0x9deb('0x8'));var sox=require(_0x9deb('0x9'));var csv=require(_0x9deb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9deb('0xb'));var _=require('lodash');var squel=require(_0x9deb('0xc'));var crypto=require('crypto');var jsforce=require(_0x9deb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9deb('0xa'));var querystring=require('querystring');var Papa=require(_0x9deb('0xe'));var Redis=require('ioredis');var authService=require(_0x9deb('0xf'));var qs=require(_0x9deb('0x10'));var as=require(_0x9deb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9deb('0x12'));var config=require(_0x9deb('0x13'));var licenseUtil=require(_0x9deb('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9deb('0x15')](config['redis'],{'host':_0x9deb('0x16'),'port':0x18eb});var socket=require(_0x9deb('0x17'))(new Redis(config[_0x9deb('0x18')]));require(_0x9deb('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9deb('0x1a')]({'port':0x232c});var client9002=jayson[_0x9deb('0x1b')][_0x9deb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xa6012c,_0x109c91,_0x51daf2,_0x1ff8c6){return new BPromise(function(_0x7a9abf,_0x452734){var _0x3c50ab=_0x1ff8c6||client;return _0x3c50ab[_0x9deb('0x1c')](_0xa6012c,_0x51daf2)['then'](function(_0x32f6dc){logger[_0x9deb('0x1d')](_0x9deb('0x1e'),_0x109c91,'request\x20sent');logger[_0x9deb('0x1f')](_0x9deb('0x20'),_0x109c91,'request\x20sent',JSON[_0x9deb('0x21')](_0x32f6dc));if(_0x32f6dc[_0x9deb('0x22')]){if(_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x23')]===0x1f4){logger['error'](_0x9deb('0x1e'),_0x109c91,_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x24')]);return _0x452734(_0x32f6dc[_0x9deb('0x22')]['message']);}logger[_0x9deb('0x22')](_0x9deb('0x1e'),_0x109c91,_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x24')]);return _0x7a9abf(_0x32f6dc[_0x9deb('0x22')]['message']);}else{logger['info'](_0x9deb('0x1e'),_0x109c91,_0x9deb('0x25'));_0x7a9abf(_0x32f6dc['result'][_0x9deb('0x24')]);}})[_0x9deb('0x26')](function(_0x3fe95c){logger[_0x9deb('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x109c91,_0x3fe95c);_0x452734(_0x3fe95c);});});}function respondWithStatusCode(_0x2d45a9,_0x341373){_0x341373=_0x341373||0xcc;return function(_0x21a89d){if(_0x21a89d){return _0x2d45a9[_0x9deb('0x27')](_0x341373);}return _0x2d45a9[_0x9deb('0x28')](_0x341373)['end']();};}function respondWithResult(_0x89ab32,_0x5cdd16){_0x5cdd16=_0x5cdd16||0xc8;return function(_0x5a267e){if(_0x5a267e){return _0x89ab32[_0x9deb('0x28')](_0x5cdd16)[_0x9deb('0x29')](_0x5a267e);}};}function respondWithFilteredResult(_0x3a89be,_0x19acd8){return function(_0x3d464f){if(_0x3d464f){var _0x437550=typeof _0x19acd8[_0x9deb('0x2a')]===_0x9deb('0x2b')&&typeof _0x19acd8[_0x9deb('0x2c')]==='undefined';var _0x326935=_0x3d464f[_0x9deb('0x2d')];var _0xdcdd36=_0x437550?0x0:_0x19acd8[_0x9deb('0x2a')];var _0x497834=_0x437550?_0x3d464f[_0x9deb('0x2d')]:_0x19acd8[_0x9deb('0x2a')]+_0x19acd8[_0x9deb('0x2c')];var _0x321067;if(_0x497834>=_0x326935){_0x497834=_0x326935;_0x321067=0xc8;}else{_0x321067=0xce;}_0x3a89be[_0x9deb('0x28')](_0x321067);return _0x3a89be[_0x9deb('0x2e')]('Content-Range',_0xdcdd36+'-'+_0x497834+'/'+_0x326935)['json'](_0x3d464f);}return null;};}function patchUpdates(_0x1776e6){return function(_0x5461ee){try{jsonpatch['apply'](_0x5461ee,_0x1776e6,!![]);}catch(_0x1932e1){return BPromise['reject'](_0x1932e1);}return _0x5461ee['save']();};}function saveUpdates(_0x22ba01,_0x2f3468){return function(_0x4560b8){if(_0x4560b8){return _0x4560b8[_0x9deb('0x2f')](_0x22ba01)['then'](function(_0x5984b0){return _0x5984b0;});}return null;};}function removeEntity(_0x10ecec,_0x546fa7){return function(_0x391ad7){if(_0x391ad7){return _0x391ad7[_0x9deb('0x30')]()[_0x9deb('0x31')](function(){_0x10ecec[_0x9deb('0x28')](0xcc)[_0x9deb('0x32')]();});}};}function handleEntityNotFound(_0x33066f,_0x15ac16){return function(_0x3852ad){if(!_0x3852ad){_0x33066f[_0x9deb('0x27')](0x194);}return _0x3852ad;};}function handleError(_0x2505ab,_0x8cdd6c){_0x8cdd6c=_0x8cdd6c||0x1f4;return function(_0x4e9a27){logger[_0x9deb('0x22')](_0x4e9a27[_0x9deb('0x33')]);if(_0x4e9a27[_0x9deb('0x34')]){delete _0x4e9a27[_0x9deb('0x34')];}_0x2505ab[_0x9deb('0x28')](_0x8cdd6c)[_0x9deb('0x35')](_0x4e9a27);};}exports['index']=function(_0x6c5eb2,_0x3fd3eb){var _0x33aced={},_0x3560f7={},_0x441eb1={'count':0x0,'rows':[]};var _0x5b4d41=_[_0x9deb('0x36')](db[_0x9deb('0x37')][_0x9deb('0x38')],function(_0x27b6c7){return{'name':_0x27b6c7[_0x9deb('0x39')],'type':_0x27b6c7[_0x9deb('0x3a')][_0x9deb('0x3b')]};});_0x3560f7['model']=_['map'](_0x5b4d41,_0x9deb('0x34'));_0x3560f7[_0x9deb('0x3c')]=_[_0x9deb('0x3d')](_0x6c5eb2['query']);_0x3560f7[_0x9deb('0x3e')]=_[_0x9deb('0x3f')](_0x3560f7[_0x9deb('0x40')],_0x3560f7[_0x9deb('0x3c')]);_0x33aced['attributes']=_[_0x9deb('0x3f')](_0x3560f7['model'],qs['fields'](_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x41')]));_0x33aced[_0x9deb('0x42')]=_0x33aced[_0x9deb('0x42')][_0x9deb('0x43')]?_0x33aced['attributes']:_0x3560f7[_0x9deb('0x40')];if(!_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x44')](_0x9deb('0x45'))){_0x33aced[_0x9deb('0x2c')]=qs[_0x9deb('0x2c')](_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x2c')]);_0x33aced[_0x9deb('0x2a')]=qs['offset'](_0x6c5eb2[_0x9deb('0x3c')]['offset']);}_0x33aced[_0x9deb('0x46')]=qs[_0x9deb('0x47')](_0x6c5eb2['query'][_0x9deb('0x47')]);_0x33aced[_0x9deb('0x48')]=qs[_0x9deb('0x3e')](_[_0x9deb('0x49')](_0x6c5eb2[_0x9deb('0x3c')],_0x3560f7[_0x9deb('0x3e')]),_0x5b4d41);if(_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4a')]){_0x33aced[_0x9deb('0x48')]=_[_0x9deb('0x4b')](_0x33aced['where'],{'$or':_[_0x9deb('0x36')](_0x5b4d41,function(_0x28f25a){if(_0x28f25a[_0x9deb('0x3a')]!==_0x9deb('0x4c')){var _0x3981e7={};_0x3981e7[_0x28f25a['name']]={'$like':'%'+_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4a')]+'%'};return _0x3981e7;}})});}_0x33aced=_['merge']({},_0x33aced,_0x6c5eb2[_0x9deb('0x4d')]);var _0x39ef79={'where':_0x33aced[_0x9deb('0x48')]};return db[_0x9deb('0x37')][_0x9deb('0x2d')](_0x39ef79)[_0x9deb('0x31')](function(_0x50e504){_0x441eb1['count']=_0x50e504;if(_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4e')]){_0x33aced[_0x9deb('0x4f')]=[{'all':!![]}];}return db[_0x9deb('0x37')][_0x9deb('0x50')](_0x33aced);})[_0x9deb('0x31')](function(_0x52b0a2){_0x441eb1['rows']=_0x52b0a2;return _0x441eb1;})[_0x9deb('0x31')](respondWithFilteredResult(_0x3fd3eb,_0x33aced))[_0x9deb('0x26')](handleError(_0x3fd3eb,null));};exports[_0x9deb('0x51')]=function(_0x2b5be1,_0x38cea3){var _0x3daf69={'raw':!![],'where':{'id':_0x2b5be1[_0x9deb('0x52')]['id']}},_0x4287ff={};_0x4287ff['model']=_[_0x9deb('0x3d')](db['WhatsappMessage'][_0x9deb('0x38')]);_0x4287ff['query']=_[_0x9deb('0x3d')](_0x2b5be1['query']);_0x4287ff[_0x9deb('0x3e')]=_[_0x9deb('0x3f')](_0x4287ff[_0x9deb('0x40')],_0x4287ff[_0x9deb('0x3c')]);_0x3daf69[_0x9deb('0x42')]=_[_0x9deb('0x3f')](_0x4287ff[_0x9deb('0x40')],qs[_0x9deb('0x41')](_0x2b5be1['query'][_0x9deb('0x41')]));_0x3daf69[_0x9deb('0x42')]=_0x3daf69['attributes']['length']?_0x3daf69['attributes']:_0x4287ff[_0x9deb('0x40')];if(_0x2b5be1[_0x9deb('0x3c')]['includeAll']){_0x3daf69[_0x9deb('0x4f')]=[{'all':!![]}];}_0x3daf69=_[_0x9deb('0x4b')]({},_0x3daf69,_0x2b5be1[_0x9deb('0x4d')]);return db[_0x9deb('0x37')][_0x9deb('0x53')](_0x3daf69)[_0x9deb('0x31')](handleEntityNotFound(_0x38cea3,null))[_0x9deb('0x31')](respondWithResult(_0x38cea3,null))[_0x9deb('0x26')](handleError(_0x38cea3,null));};exports[_0x9deb('0x54')]=function(_0x5d353d,_0x4e9fbf){return db['WhatsappMessage'][_0x9deb('0x54')](_0x5d353d[_0x9deb('0x55')],{})['then'](respondWithResult(_0x4e9fbf,0xc9))[_0x9deb('0x26')](handleError(_0x4e9fbf,null));};exports[_0x9deb('0x2f')]=function(_0x57114b,_0x14db8b){if(_0x57114b[_0x9deb('0x55')]['id']){delete _0x57114b[_0x9deb('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x57114b[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x14db8b,null))[_0x9deb('0x31')](saveUpdates(_0x57114b[_0x9deb('0x55')],null))[_0x9deb('0x31')](respondWithResult(_0x14db8b,null))[_0x9deb('0x26')](handleError(_0x14db8b,null));};exports['destroy']=function(_0x360bcd,_0x3f4414){return db['WhatsappMessage'][_0x9deb('0x53')]({'where':{'id':_0x360bcd[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x3f4414,null))['then'](removeEntity(_0x3f4414,null))[_0x9deb('0x26')](handleError(_0x3f4414,null));};exports['describe']=function(_0x35ad9a,_0x58466a){return db['WhatsappMessage'][_0x9deb('0x56')]()['then'](respondWithResult(_0x58466a,null))[_0x9deb('0x26')](handleError(_0x58466a,null));};var interaction_log=require(_0x9deb('0x57'))('whatsapp-interactions');exports[_0x9deb('0x58')]=function(_0x561bdd,_0x327f27,_0xf8a357){var _0x116061={'agent':{},'channel':_0x9deb('0x59')};if(_0x561bdd['body']['id']){delete _0x561bdd[_0x9deb('0x55')]['id'];}_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5a')]=!![];_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5b')]=moment()['format'](_0x9deb('0x5c'));_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')]=_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')]||_0x561bdd['user']['id'];_0x116061[_0x9deb('0x5e')]['id']=_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')];return db[_0x9deb('0x37')]['find']({'where':{'id':_0x561bdd[_0x9deb('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x327f27,null))[_0x9deb('0x31')](saveUpdates(_0x561bdd['body'],null))[_0x9deb('0x31')](function(_0x4e739a){if(_0x4e739a){_0x116061[_0x9deb('0x24')]=_0x4e739a['get']({'plain':!![]});return db['WhatsappInteraction'][_0x9deb('0x53')]({'where':{'id':_0x4e739a[_0x9deb('0x5f')]}});}return null;})[_0x9deb('0x31')](handleEntityNotFound(_0x327f27,null))['then'](function(_0x3dea87){if(_0x3dea87){return _0x3dea87['update']({'UserId':_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')],'read1stAt':_[_0x9deb('0x60')](_0x3dea87[_0x9deb('0x61')])?moment()[_0x9deb('0x62')](_0x9deb('0x5c')):undefined});}return null;})[_0x9deb('0x31')](function(_0x339664){if(_0x339664){_0x116061[_0x9deb('0x63')]=_0x339664[_0x9deb('0x64')]({'plain':!![]});interaction_log[_0x9deb('0x1d')](_0x9deb('0x65'),_0x561bdd[_0x9deb('0x66')]['id'],_0x561bdd[_0x9deb('0x66')]['name'],_0x561bdd['user']['role'],_0x116061[_0x9deb('0x63')]['id'],_0x561bdd[_0x9deb('0x55')]?JSON[_0x9deb('0x21')](_0x561bdd[_0x9deb('0x55')]):_0x9deb('0x67'));return respondWithRpcPromise(_0x9deb('0x68'),_0x9deb('0x69'),_0x116061);}return null;})['then'](function(_0x1382a8){var _0x44550c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1382a8[_0x9deb('0x24')][_0x9deb('0x6a')];return db[_0x9deb('0x6b')][_0x9deb('0x3c')](_0x44550c,{'type':db[_0x9deb('0x6c')][_0x9deb('0x6d')][_0x9deb('0x6e')],'raw':!![]})[_0x9deb('0x31')](function(_0x4eef30){return _0x4eef30;});})['then'](function(_0x51c335){if(_0x51c335){_0x116061[_0x9deb('0x24')]['contact']=_0x51c335[0x0];if(!_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')])return;return db['User']['find']({'where':{'id':_0x561bdd['body'][_0x9deb('0x5d')],'role':_0x9deb('0x5e')},'attributes':['id',_0x9deb('0x34'),_0x9deb('0x6f'),'email',_0x9deb('0x70')],'raw':!![]});}return null;})[_0x9deb('0x31')](function(_0x47677e){if(!_0x47677e)return null;_0x116061[_0x9deb('0x24')][_0x9deb('0x5e')]=_0x47677e;return _0x116061;})['then'](function(_0x1aa1cf){if(_0x1aa1cf){if(_0x561bdd[_0x9deb('0x55')][_0x9deb('0x71')]){_0x116061[_0x9deb('0x24')][_0x9deb('0x72')]=util[_0x9deb('0x62')](_0x9deb('0x73'),_0x561bdd[_0x9deb('0x66')][_0x9deb('0x34')]);_0x116061[_0x9deb('0x24')][_0x9deb('0x74')]=_0x116061[_0x9deb('0x74')];_0x116061[_0x9deb('0x24')][_0x9deb('0x75')]=_0x116061[_0x9deb('0x74')];_0x116061[_0x9deb('0x24')][_0x9deb('0x76')]=_0x9deb('0x58');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9deb('0x77'),'message':_0x116061['message']},client9002)[_0x9deb('0x31')](function(){return _0x116061;});}return _0x116061;}return null;})[_0x9deb('0x31')](respondWithResult(_0x327f27,null))[_0x9deb('0x26')](handleError(_0x327f27,null));};var interaction_log=require(_0x9deb('0x57'))(_0x9deb('0x78'));exports[_0x9deb('0x79')]=function(_0x208d03,_0x1400db,_0x286018){var _0x408a6a={'agent':{},'channel':_0x9deb('0x59')};if(_0x208d03[_0x9deb('0x55')]['id']){delete _0x208d03[_0x9deb('0x55')]['id'];}_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')]=_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')]||_0x208d03['user']['id'];_0x408a6a[_0x9deb('0x5e')]['id']=_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')];return db[_0x9deb('0x37')]['find']({'where':{'id':_0x208d03[_0x9deb('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1400db,null))[_0x9deb('0x31')](function(_0x29a787){if(_0x29a787){_0x408a6a['message']=_0x29a787[_0x9deb('0x64')]({'plain':!![]});return db[_0x9deb('0x7a')][_0x9deb('0x53')]({'where':{'id':_0x29a787[_0x9deb('0x5f')]}});}return null;})[_0x9deb('0x31')](handleEntityNotFound(_0x1400db,null))['then'](function(_0x138b20){if(_0x138b20){_0x408a6a[_0x9deb('0x63')]=_0x138b20['get']({'plain':!![]});interaction_log[_0x9deb('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x208d03[_0x9deb('0x66')]['id'],_0x208d03[_0x9deb('0x66')]['name'],_0x208d03[_0x9deb('0x66')][_0x9deb('0x7b')],_0x408a6a[_0x9deb('0x63')]['id'],_0x208d03[_0x9deb('0x55')]?JSON['stringify'](_0x208d03[_0x9deb('0x55')]):'null');return respondWithRpcPromise(_0x9deb('0x7c'),_0x9deb('0x7d'),_0x408a6a);}return null;})[_0x9deb('0x31')](function(_0x29c19c){var _0x31c0db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29c19c[_0x9deb('0x24')]['ContactId'];return db[_0x9deb('0x6b')]['query'](_0x31c0db,{'type':db[_0x9deb('0x6c')][_0x9deb('0x6d')]['SELECT'],'raw':!![]})[_0x9deb('0x31')](function(_0x47be51){return _0x47be51;});})[_0x9deb('0x31')](function(_0x8386b5){if(_0x8386b5){_0x408a6a[_0x9deb('0x24')][_0x9deb('0x7e')]=_0x8386b5[0x0];if(!_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')])return;return db['User']['find']({'where':{'id':_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')],'role':'agent'},'attributes':['id',_0x9deb('0x34'),'fullname',_0x9deb('0x7f'),_0x9deb('0x70')],'raw':!![]});}return null;})[_0x9deb('0x31')](function(_0x4dc09e){if(!_0x4dc09e)return null;_0x408a6a[_0x9deb('0x24')]['agent']=_0x4dc09e;return _0x408a6a;})['then'](function(_0x4b8568){if(_0x4b8568){_0x4b8568['message'][_0x9deb('0x72')]=util[_0x9deb('0x62')](_0x9deb('0x73'),_0x208d03[_0x9deb('0x66')][_0x9deb('0x34')]);_0x4b8568['message'][_0x9deb('0x74')]=_0x408a6a['channel'];_0x4b8568['message'][_0x9deb('0x75')]=_0x408a6a[_0x9deb('0x74')];_0x4b8568['message'][_0x9deb('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x9deb('0x80'),'message':_0x4b8568['message']},client9002);return _0x408a6a;}return null;})[_0x9deb('0x31')](respondWithResult(_0x1400db,null))[_0x9deb('0x26')](handleError(_0x1400db,null));};exports[_0x9deb('0x28')]=function(_0x4d3abb,_0x55a6b3,_0x29316e){if(_0x4d3abb[_0x9deb('0x55')]['id']){delete _0x4d3abb['body']['id'];}var _0x1f0148;return db['WhatsappMessage'][_0x9deb('0x53')]({'where':{'id':_0x4d3abb[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x55a6b3,null))[_0x9deb('0x31')](function(_0xe0409e){if(_0xe0409e){_0x1f0148=_0xe0409e;return db[_0x9deb('0x81')]['find']({'where':{'id':_0xe0409e[_0x9deb('0x82')]}});}})[_0x9deb('0x31')](handleEntityNotFound(_0x55a6b3,null))[_0x9deb('0x31')](function(_0x1cfe25){if(_0x1cfe25){logger[_0x9deb('0x1f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x9deb('0x28'),_0x9deb('0x83'),_0x1cfe25['type'],util[_0x9deb('0x84')](_0x4d3abb[_0x9deb('0x55')],{'showHidden':![],'depth':null}));switch(_0x1cfe25[_0x9deb('0x3a')]){case _0x9deb('0x85'):if(_0x4d3abb['body']['MessageSid']&&_0x4d3abb[_0x9deb('0x55')][_0x9deb('0x86')]===_0x1f0148['messageId']&&_0x4d3abb['body'][_0x9deb('0x87')]&&_0x4d3abb[_0x9deb('0x55')][_0x9deb('0x87')]===_0x9deb('0x5a')){return _0x1f0148['update']({'read':!![]});}else{logger[_0x9deb('0x22')](_0x9deb('0x88'),'status','twilio',util['inspect'](_0x4d3abb[_0x9deb('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1f0148;}})[_0x9deb('0x31')](respondWithResult(_0x55a6b3,null))['catch'](handleError(_0x55a6b3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 23b7871..c5166c6 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 _0xd7a0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x3a3f9d,_0xb9778e){var _0x4b7d94=function(_0xb34ad9){while(--_0xb34ad9){_0x3a3f9d['push'](_0x3a3f9d['shift']());}};_0x4b7d94(++_0xb9778e);}(_0xd7a0,0x163));var _0x0d7a=function(_0x1592d9,_0xf9901d){_0x1592d9=_0x1592d9-0x0;var _0x524738=_0xd7a0[_0x1592d9];return _0x524738;};'use strict';var EventEmitter=require(_0x0d7a('0x0'));var WhatsappMessage=require(_0x0d7a('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0d7a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d7a('0x3'),'afterDestroy':_0x0d7a('0x4')};function emitEvent(_0x470c53){return function(_0x20f67c,_0x208f50,_0x564935){WhatsappMessageEvents[_0x0d7a('0x5')](_0x470c53+':'+_0x20f67c['id'],_0x20f67c);WhatsappMessageEvents[_0x0d7a('0x5')](_0x470c53,_0x20f67c);_0x564935(null);};}for(var e in events){if(events[_0x0d7a('0x6')](e)){var event=events[e];WhatsappMessage[_0x0d7a('0x7')](e,emitEvent(event));}}module[_0x0d7a('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa699=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0xa699,0x6b));var _0x9a69=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xa699[_0x4a45b4];return _0x1a99c9;};'use strict';var EventEmitter=require(_0x9a69('0x0'));var WhatsappMessage=require(_0x9a69('0x1'))['db'][_0x9a69('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9a69('0x3')](0x0);var events={'afterCreate':_0x9a69('0x4'),'afterUpdate':_0x9a69('0x5'),'afterDestroy':_0x9a69('0x6')};function emitEvent(_0x2d3e1f){return function(_0xadacc9,_0x3edccc,_0x143c4f){WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f+':'+_0xadacc9['id'],_0xadacc9);WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f,_0xadacc9);_0x143c4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x9a69('0x8')](e,emitEvent(event));}}module[_0x9a69('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c3ff07f..1d2a10e 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 _0x2fdb=['createdAt','error','out','secret','then','type','twilio','accountSid','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','catch','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','toLowerCase','direction','isNil','findOne','WhatsappInteractionId','update'];(function(_0x4d8bf1,_0x473dff){var _0x522e8=function(_0x35b948){while(--_0x35b948){_0x4d8bf1['push'](_0x4d8bf1['shift']());}};_0x522e8(++_0x473dff);}(_0x2fdb,0x18a));var _0xb2fd=function(_0x316a6e,_0x288d81){_0x316a6e=_0x316a6e-0x0;var _0xd56910=_0x2fdb[_0x316a6e];return _0xd56910;};'use strict';var _=require(_0xb2fd('0x0'));var util=require(_0xb2fd('0x1'));var logger=require(_0xb2fd('0x2'))(_0xb2fd('0x3'));var moment=require(_0xb2fd('0x4'));var BPromise=require(_0xb2fd('0x5'));var rp=require(_0xb2fd('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0xb2fd('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2fd('0x8'));module['exports']=function(_0x95dd5a,_0x5a0e32){return _0x95dd5a[_0xb2fd('0x9')](_0xb2fd('0xa'),attributes,{'tableName':_0xb2fd('0xb'),'paranoid':![],'indexes':[{'name':_0xb2fd('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xb2fd('0xd')],'type':_0xb2fd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2acd3e,_0x3f70a2,_0x6755d3){var _0x25df60=_0x95dd5a[_0xb2fd('0xf')];var _0x534ac8=_0x2acd3e['get']({'plain':!![]});if(_0x534ac8['direction'][_0xb2fd('0x10')]()==='in'||_0x534ac8[_0xb2fd('0x11')][_0xb2fd('0x10')]()==='out'&&!_0x534ac8['secret']&&!_[_0xb2fd('0x12')](_0x534ac8['UserId'])){_0x25df60['WhatsappInteraction'][_0xb2fd('0x13')]({'where':{'id':_0x534ac8[_0xb2fd('0x14')]}})['then'](function(_0x518f0e){if(_0x518f0e){_0x518f0e[_0xb2fd('0x15')]({'lastMsgAt':_0x534ac8[_0xb2fd('0x16')],'lastMsgDirection':_0x534ac8[_0xb2fd('0x11')][_0xb2fd('0x10')]()});}})['catch'](function(_0x43bc45){console[_0xb2fd('0x17')](_0x43bc45);});}if(_0x534ac8['direction']===_0xb2fd('0x18')&&!_0x534ac8[_0xb2fd('0x19')]){var _0x6a598;_0x25df60['WhatsappAccount']['find']({'where':{'id':_0x534ac8['WhatsappAccountId']},'raw':!![]})[_0xb2fd('0x1a')](function(_0x2ab8b6){_0x6a598=_0x2ab8b6;if(_0x6a598&&_0x6a598['type']){switch(_0x6a598[_0xb2fd('0x1b')]){case _0xb2fd('0x1c'):var _0x47c204=require(_0xb2fd('0x1c'));if(_0x6a598[_0xb2fd('0x1d')]&&_0x6a598[_0xb2fd('0x1e')]&&_0x6a598[_0xb2fd('0x1f')]){var _0x4a029e=new _0x47c204(_0x6a598[_0xb2fd('0x1d')],_0x6a598[_0xb2fd('0x1e')]);_0x4a029e['messages'][_0xb2fd('0x20')]({'body':_0x534ac8[_0xb2fd('0xd')],'to':_0xb2fd('0x21')+_0x534ac8[_0xb2fd('0x1f')],'from':'whatsapp:'+_0x6a598['phone'],'statusCallback':_0x6a598['remote']+_0xb2fd('0x22')+_0x534ac8['id']+_0xb2fd('0x23')+_0x6a598[_0xb2fd('0x24')]})[_0xb2fd('0x1a')](function(_0x2d26f1){if(_0x2d26f1[_0xb2fd('0x25')]){return _0x2acd3e[_0xb2fd('0x15')]({'messageId':_0x2d26f1['sid']});}})[_0xb2fd('0x26')](function(_0x30e15d){logger[_0xb2fd('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb2fd('0x1c'),util[_0xb2fd('0x27')](_0x30e15d,{'showHidden':![],'depth':null}));});}else{logger[_0xb2fd('0x17')](_0xb2fd('0x28'),'afterCreate',_0xb2fd('0x1c'),_0xb2fd('0x29'));}break;case _0xb2fd('0x2a'):var _0x4ebef6=_0x6a598[_0xb2fd('0x1d')];var _0x29daca=_0x6a598[_0xb2fd('0x1e')];var _0x3ccc6d=_0x6a598[_0xb2fd('0x2b')]+'/whatsapp/v1/'+_0x4ebef6+_0xb2fd('0x2c');var _0x30790f={'to':[_0x534ac8[_0xb2fd('0x1f')]],'message':{'type':'text','text':_0x534ac8[_0xb2fd('0xd')]}};var _0x50f3d3={'method':'POST','uri':_0x3ccc6d,'headers':{'Authorization':_0xb2fd('0x2d')+_0x29daca,'Content-Type':_0xb2fd('0x2e')},'body':_0x30790f,'json':!![]};rp(_0x50f3d3)[_0xb2fd('0x1a')](function(_0x41fe60){if(_0x41fe60[_0xb2fd('0x2f')][0x0][_0xb2fd('0x30')]){return _0x2acd3e[_0xb2fd('0x15')]({'messageId':_0x41fe60[_0xb2fd('0x2f')][0x0][_0xb2fd('0x30')]});}})[_0xb2fd('0x26')](function(_0x4a17f0){logger['err']('WhatsappMessage,\x20%s',_0x4a17f0);});break;}}})[_0xb2fd('0x31')](function(){_0x6755d3();});}else{_0x6755d3();}}},'charset':_0xb2fd('0x32'),'collate':_0xb2fd('0x33')});}; \ No newline at end of file +var _0x2433=['api','moment','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','update','err','finally','utf8mb4','lodash','util','../../config/logger'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x2433,0xe5));var _0x3243=function(_0x50ee1a,_0xcb8ddd){_0x50ee1a=_0x50ee1a-0x0;var _0x1500ee=_0x2433[_0x50ee1a];return _0x1500ee;};'use strict';var _=require(_0x3243('0x0'));var util=require(_0x3243('0x1'));var logger=require(_0x3243('0x2'))(_0x3243('0x3'));var moment=require(_0x3243('0x4'));var BPromise=require(_0x3243('0x5'));var rp=require('request-promise');var fetch=require(_0x3243('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3243('0x7'));var config=require(_0x3243('0x8'));var attributes=require(_0x3243('0x9'));module['exports']=function(_0x126626,_0x1e9978){return _0x126626[_0x3243('0xa')]('WhatsappMessage',attributes,{'tableName':_0x3243('0xb'),'paranoid':![],'indexes':[{'name':_0x3243('0xc'),'fields':['messageId']},{'name':_0x3243('0xd'),'fields':[_0x3243('0xe')],'type':_0x3243('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5700,_0x53d2f6,_0x3a0880){var _0xaecb31=_0x126626[_0x3243('0x10')];var _0x453db2=_0x1c5700['get']({'plain':!![]});if(_0x453db2[_0x3243('0x11')][_0x3243('0x12')]()==='in'||_0x453db2[_0x3243('0x11')]['toLowerCase']()===_0x3243('0x13')&&!_0x453db2[_0x3243('0x14')]&&!_[_0x3243('0x15')](_0x453db2['UserId'])){_0xaecb31[_0x3243('0x16')][_0x3243('0x17')]({'where':{'id':_0x453db2[_0x3243('0x18')]}})[_0x3243('0x19')](function(_0x455055){if(_0x455055){_0x455055['update']({'lastMsgAt':_0x453db2[_0x3243('0x1a')],'lastMsgDirection':_0x453db2[_0x3243('0x11')][_0x3243('0x12')]()});}})['catch'](function(_0x1d4827){console[_0x3243('0x1b')](_0x1d4827);});}if(_0x453db2[_0x3243('0x11')]===_0x3243('0x13')&&!_0x453db2[_0x3243('0x14')]){var _0x28c067;_0xaecb31[_0x3243('0x1c')]['find']({'where':{'id':_0x453db2[_0x3243('0x1d')]},'raw':!![]})[_0x3243('0x19')](function(_0x2cd8ab){_0x28c067=_0x2cd8ab;if(_0x28c067&&_0x28c067[_0x3243('0x1e')]){switch(_0x28c067['type']){case _0x3243('0x1f'):var _0x58b6c4=require('twilio');if(_0x28c067[_0x3243('0x20')]&&_0x28c067[_0x3243('0x21')]&&_0x28c067[_0x3243('0x22')]){var _0xb11629=new _0x58b6c4(_0x28c067[_0x3243('0x20')],_0x28c067[_0x3243('0x21')]);_0xb11629[_0x3243('0x23')][_0x3243('0x24')]({'body':_0x453db2[_0x3243('0xe')],'to':_0x3243('0x25')+_0x453db2[_0x3243('0x22')],'from':_0x3243('0x25')+_0x28c067['phone'],'statusCallback':_0x28c067[_0x3243('0x26')]+_0x3243('0x27')+_0x453db2['id']+'/status?token='+_0x28c067[_0x3243('0x28')]})[_0x3243('0x19')](function(_0xb1dd8d){if(_0xb1dd8d[_0x3243('0x29')]){return _0x1c5700['update']({'messageId':_0xb1dd8d[_0x3243('0x29')]});}})[_0x3243('0x2a')](function(_0x110a4d){logger[_0x3243('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3243('0x2b'),'twilio',util[_0x3243('0x2c')](_0x110a4d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3243('0x2d'),_0x3243('0x2b'),_0x3243('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3243('0x2e'):var _0x179add=_0x28c067[_0x3243('0x20')];var _0x4c18a7=_0x28c067['authToken'];var _0x3ed9c7=_0x28c067[_0x3243('0x2f')]+_0x3243('0x30')+_0x179add+'/messages/';var _0x582ccc={'to':[_0x453db2[_0x3243('0x22')]],'message':{'type':_0x3243('0x31'),'text':_0x453db2[_0x3243('0xe')]}};var _0x17399a={'method':_0x3243('0x32'),'uri':_0x3ed9c7,'headers':{'Authorization':_0x3243('0x33')+_0x4c18a7,'Content-Type':_0x3243('0x34')},'body':_0x582ccc,'json':!![]};rp(_0x17399a)[_0x3243('0x19')](function(_0x1599f7){if(_0x1599f7['statuses'][0x0][_0x3243('0x35')]){return _0x1c5700[_0x3243('0x36')]({'messageId':_0x1599f7['statuses'][0x0][_0x3243('0x35')]});}})[_0x3243('0x2a')](function(_0xbe516a){logger[_0x3243('0x37')]('WhatsappMessage,\x20%s',_0xbe516a);});break;}}})[_0x3243('0x38')](function(){_0x3a0880();});}else{_0x3a0880();}}},'charset':_0x3243('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cfeab1a..cadb0e0 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 _0x37ab=['create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x1ed354,_0x4bb5be){var _0x532757=function(_0x574f3e){while(--_0x574f3e){_0x1ed354['push'](_0x1ed354['shift']());}};_0x532757(++_0x4bb5be);}(_0x37ab,0x1d2));var _0xb37a=function(_0xec05a,_0xae2200){_0xec05a=_0xec05a-0x0;var _0x5911e2=_0x37ab[_0xec05a];return _0x5911e2;};'use strict';var _=require(_0xb37a('0x0'));var util=require(_0xb37a('0x1'));var moment=require(_0xb37a('0x2'));var BPromise=require(_0xb37a('0x3'));var rs=require(_0xb37a('0x4'));var fs=require('fs');var Redis=require(_0xb37a('0x5'));var db=require(_0xb37a('0x6'))['db'];var utils=require(_0xb37a('0x7'));var logger=require('../../config/logger')(_0xb37a('0x8'));var config=require('../../config/environment');var jayson=require(_0xb37a('0x9'));var client=jayson[_0xb37a('0xa')][_0xb37a('0xb')]({'port':0x232a});config[_0xb37a('0xc')]=_[_0xb37a('0xd')](config['redis'],{'host':_0xb37a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb37a('0xc')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x586195,_0x61df49,_0x424575){return new BPromise(function(_0x585d8f,_0x667c03){return client[_0xb37a('0xf')](_0x586195,_0x424575)[_0xb37a('0x10')](function(_0x47420d){logger[_0xb37a('0x11')](_0xb37a('0x12'),_0x61df49,_0xb37a('0x13'));logger[_0xb37a('0x14')](_0xb37a('0x15'),_0x61df49,_0xb37a('0x13'),JSON[_0xb37a('0x16')](_0x47420d));if(_0x47420d[_0xb37a('0x17')]){if(_0x47420d[_0xb37a('0x17')][_0xb37a('0x18')]===0x1f4){logger[_0xb37a('0x17')](_0xb37a('0x12'),_0x61df49,_0x47420d[_0xb37a('0x17')][_0xb37a('0x19')]);return _0x667c03(_0x47420d['error'][_0xb37a('0x19')]);}logger[_0xb37a('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x61df49,_0x47420d[_0xb37a('0x17')]['message']);return _0x585d8f(_0x47420d[_0xb37a('0x17')][_0xb37a('0x19')]);}else{logger[_0xb37a('0x11')](_0xb37a('0x12'),_0x61df49,_0xb37a('0x13'));_0x585d8f(_0x47420d['result'][_0xb37a('0x19')]);}})[_0xb37a('0x1a')](function(_0x2b469d){logger[_0xb37a('0x17')](_0xb37a('0x12'),_0x61df49,_0x2b469d);_0x667c03(_0x2b469d);});});}exports[_0xb37a('0x1b')]=function(_0x17934b){var _0x20607a=this;return new Promise(function(_0x398369,_0x3e7a32){return db[_0xb37a('0x1c')][_0xb37a('0x1d')](_0x17934b[_0xb37a('0x1e')],{'raw':_0x17934b[_0xb37a('0x1f')]?_0x17934b[_0xb37a('0x1f')][_0xb37a('0x20')]===undefined?!![]:![]:!![]})[_0xb37a('0x10')](function(_0x333824){logger['info'](_0xb37a('0x1b'),_0x17934b);logger[_0xb37a('0x14')](_0xb37a('0x1b'),_0x17934b,JSON[_0xb37a('0x16')](_0x333824));_0x398369(_0x333824);})[_0xb37a('0x1a')](function(_0x9569d7){logger[_0xb37a('0x17')](_0xb37a('0x1b'),_0x9569d7[_0xb37a('0x19')],_0x17934b);_0x3e7a32(_0x20607a[_0xb37a('0x17')](0x1f4,_0x9569d7['message']));});});}; \ No newline at end of file +var _0xce30=['options','CreateWhatsappMessage','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create'];(function(_0x21c5d9,_0x509aca){var _0x3b2160=function(_0x4fc704){while(--_0x4fc704){_0x21c5d9['push'](_0x21c5d9['shift']());}};_0x3b2160(++_0x509aca);}(_0xce30,0x124));var _0x0ce3=function(_0x54aef6,_0x4155fc){_0x54aef6=_0x54aef6-0x0;var _0x1a2d10=_0xce30[_0x54aef6];return _0x1a2d10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ce3('0x0'));var BPromise=require('bluebird');var rs=require(_0x0ce3('0x1'));var fs=require('fs');var Redis=require(_0x0ce3('0x2'));var db=require(_0x0ce3('0x3'))['db'];var utils=require(_0x0ce3('0x4'));var logger=require(_0x0ce3('0x5'))('rpc');var config=require(_0x0ce3('0x6'));var jayson=require(_0x0ce3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0ce3('0x8')]=_[_0x0ce3('0x9')](config[_0x0ce3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ce3('0xa'))(new Redis(config[_0x0ce3('0x8')]));require(_0x0ce3('0xb'))['register'](socket);function respondWithRpcPromise(_0x53466d,_0x212dfd,_0x3cc11c){return new BPromise(function(_0x1b92e7,_0x40b36a){return client[_0x0ce3('0xc')](_0x53466d,_0x3cc11c)[_0x0ce3('0xd')](function(_0x53f250){logger[_0x0ce3('0xe')](_0x0ce3('0xf'),_0x212dfd,_0x0ce3('0x10'));logger[_0x0ce3('0x11')](_0x0ce3('0x12'),_0x212dfd,_0x0ce3('0x10'),JSON[_0x0ce3('0x13')](_0x53f250));if(_0x53f250[_0x0ce3('0x14')]){if(_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x15')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x212dfd,_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);return _0x40b36a(_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);}logger[_0x0ce3('0x14')](_0x0ce3('0xf'),_0x212dfd,_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);return _0x1b92e7(_0x53f250['error']['message']);}else{logger['info'](_0x0ce3('0xf'),_0x212dfd,_0x0ce3('0x10'));_0x1b92e7(_0x53f250[_0x0ce3('0x17')][_0x0ce3('0x16')]);}})[_0x0ce3('0x18')](function(_0x2c1fbc){logger['error'](_0x0ce3('0xf'),_0x212dfd,_0x2c1fbc);_0x40b36a(_0x2c1fbc);});});}exports['CreateWhatsappMessage']=function(_0x39c847){var _0x7f2bed=this;return new Promise(function(_0x155a60,_0x72d396){return db[_0x0ce3('0x19')][_0x0ce3('0x1a')](_0x39c847['body'],{'raw':_0x39c847[_0x0ce3('0x1b')]?_0x39c847[_0x0ce3('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0ce3('0xd')](function(_0x131c23){logger[_0x0ce3('0xe')]('CreateWhatsappMessage',_0x39c847);logger[_0x0ce3('0x11')](_0x0ce3('0x1c'),_0x39c847,JSON['stringify'](_0x131c23));_0x155a60(_0x131c23);})[_0x0ce3('0x18')](function(_0x5bb632){logger[_0x0ce3('0x14')](_0x0ce3('0x1c'),_0x5bb632[_0x0ce3('0x16')],_0x39c847);_0x72d396(_0x7f2bed[_0x0ce3('0x14')](0x1f4,_0x5bb632[_0x0ce3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7a31583..92dcd27 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 _0x4c3c=['save','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x4c3c,0x67));var _0xc4c3=function(_0xa1d623,_0x3e1f5d){_0xa1d623=_0xa1d623-0x0;var _0x4426c7=_0x4c3c[_0xa1d623];return _0x4426c7;};'use strict';var WhatsappMessageEvents=require(_0xc4c3('0x0'));var events=[_0xc4c3('0x1'),'remove',_0xc4c3('0x2')];function createListener(_0xd2d775,_0x17e331){return function(_0x5e10b9){_0x17e331[_0xc4c3('0x3')](_0xd2d775,_0x5e10b9);};}function removeListener(_0x35dac6,_0x92357e){return function(){WhatsappMessageEvents[_0xc4c3('0x4')](_0x35dac6,_0x92357e);};}exports[_0xc4c3('0x5')]=function(_0x3c18eb){for(var _0x5a1485=0x0,_0x2337c0=events[_0xc4c3('0x6')];_0x5a1485<_0x2337c0;_0x5a1485++){var _0x26e220=events[_0x5a1485];var _0x5001c6=createListener(_0xc4c3('0x7')+_0x26e220,_0x3c18eb);WhatsappMessageEvents['on'](_0x26e220,_0x5001c6);}}; \ No newline at end of file +var _0xc451=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x3d2479,_0x250991){var _0x5e0b21=function(_0x232d91){while(--_0x232d91){_0x3d2479['push'](_0x3d2479['shift']());}};_0x5e0b21(++_0x250991);}(_0xc451,0xe8));var _0x1c45=function(_0x564b5f,_0x509958){_0x564b5f=_0x564b5f-0x0;var _0x282788=_0xc451[_0x564b5f];return _0x282788;};'use strict';var WhatsappMessageEvents=require(_0x1c45('0x0'));var events=[_0x1c45('0x1'),_0x1c45('0x2'),_0x1c45('0x3')];function createListener(_0x56d253,_0x80ae55){return function(_0x3baaf8){_0x80ae55[_0x1c45('0x4')](_0x56d253,_0x3baaf8);};}function removeListener(_0xc8e7d7,_0xe557c2){return function(){WhatsappMessageEvents[_0x1c45('0x5')](_0xc8e7d7,_0xe557c2);};}exports[_0x1c45('0x6')]=function(_0x118cf7){for(var _0x3221dd=0x0,_0x52b642=events[_0x1c45('0x7')];_0x3221dd<_0x52b642;_0x3221dd++){var _0x4937b4=events[_0x3221dd];var _0x91e2b4=createListener(_0x1c45('0x8')+_0x4937b4,_0x118cf7);WhatsappMessageEvents['on'](_0x4937b4,_0x91e2b4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9e1ff6c..d2f1ab7 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 _0x9320=['removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete'];(function(_0x1cf066,_0x457fa5){var _0x3debfb=function(_0x4fe283){while(--_0x4fe283){_0x1cf066['push'](_0x1cf066['shift']());}};_0x3debfb(++_0x457fa5);}(_0x9320,0x147));var _0x0932=function(_0x112d5e,_0x4ea38c){_0x112d5e=_0x112d5e-0x0;var _0xa58e53=_0x9320[_0x112d5e];return _0xa58e53;};'use strict';var multer=require(_0x0932('0x0'));var util=require(_0x0932('0x1'));var path=require('path');var timeout=require(_0x0932('0x2'));var express=require(_0x0932('0x3'));var router=express[_0x0932('0x4')]();var fs_extra=require(_0x0932('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0932('0x6'));var controller=require('./whatsappQueue.controller');router[_0x0932('0x7')]('/',auth['isAuthenticated'](),controller[_0x0932('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0932('0x7')](_0x0932('0x9'),auth[_0x0932('0xa')](),controller['show']);router[_0x0932('0x7')](_0x0932('0xb'),auth['isAuthenticated'](),controller[_0x0932('0xc')]);router['get'](_0x0932('0xd'),auth[_0x0932('0xa')](),controller['getTeams']);router[_0x0932('0x7')](_0x0932('0xe'),auth[_0x0932('0xa')](),controller[_0x0932('0xf')]);router[_0x0932('0x10')]('/',auth[_0x0932('0xa')](),controller['create']);router[_0x0932('0x10')](_0x0932('0xd'),auth['isAuthenticated'](),controller[_0x0932('0x11')]);router[_0x0932('0x10')](_0x0932('0xe'),auth[_0x0932('0xa')](),controller[_0x0932('0x12')]);router[_0x0932('0x13')](_0x0932('0x9'),auth[_0x0932('0xa')](),controller[_0x0932('0x14')]);router['delete']('/:id',auth[_0x0932('0xa')](),controller[_0x0932('0x15')]);router[_0x0932('0x16')](_0x0932('0xd'),auth[_0x0932('0xa')](),controller['removeTeams']);router[_0x0932('0x16')](_0x0932('0xe'),auth[_0x0932('0xa')](),controller[_0x0932('0x17')]);module[_0x0932('0x18')]=router; \ No newline at end of file +var _0x1cb8=['/:id/members','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','/:id','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1cb8,0xe5));var _0x81cb=function(_0x180c0f,_0x5d6a54){_0x180c0f=_0x180c0f-0x0;var _0x42ed22=_0x1cb8[_0x180c0f];return _0x42ed22;};'use strict';var multer=require(_0x81cb('0x0'));var util=require('util');var path=require(_0x81cb('0x1'));var timeout=require(_0x81cb('0x2'));var express=require(_0x81cb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x81cb('0x4'));var config=require(_0x81cb('0x5'));var controller=require(_0x81cb('0x6'));router[_0x81cb('0x7')]('/',auth[_0x81cb('0x8')](),controller['index']);router[_0x81cb('0x7')](_0x81cb('0x9'),auth[_0x81cb('0x8')](),controller[_0x81cb('0xa')]);router[_0x81cb('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x81cb('0x7')](_0x81cb('0xb'),auth[_0x81cb('0x8')](),controller['getMembers']);router['get'](_0x81cb('0xc'),auth[_0x81cb('0x8')](),controller[_0x81cb('0xd')]);router[_0x81cb('0x7')]('/:id/users',auth[_0x81cb('0x8')](),controller[_0x81cb('0xe')]);router['post']('/',auth[_0x81cb('0x8')](),controller[_0x81cb('0xf')]);router[_0x81cb('0x10')]('/:id/teams',auth[_0x81cb('0x8')](),controller['addTeams']);router[_0x81cb('0x10')](_0x81cb('0x11'),auth[_0x81cb('0x8')](),controller['addAgents']);router[_0x81cb('0x12')](_0x81cb('0x13'),auth[_0x81cb('0x8')](),controller['update']);router[_0x81cb('0x14')](_0x81cb('0x13'),auth[_0x81cb('0x8')](),controller[_0x81cb('0x15')]);router[_0x81cb('0x14')](_0x81cb('0xc'),auth['isAuthenticated'](),controller[_0x81cb('0x16')]);router[_0x81cb('0x14')](_0x81cb('0x11'),auth[_0x81cb('0x8')](),controller[_0x81cb('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 690b760..e6b098a 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 _0xfc65=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2a3c2a,_0x57158c){var _0xfc97b4=function(_0x502cf2){while(--_0x502cf2){_0x2a3c2a['push'](_0x2a3c2a['shift']());}};_0xfc97b4(++_0x57158c);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x3fbf46,_0x4e8516){_0x3fbf46=_0x3fbf46-0x0;var _0x3b7770=_0xfc65[_0x3fbf46];return _0x3b7770;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module[_0x5fc6('0x1')]={'name':{'type':Sequelize[_0x5fc6('0x2')],'unique':_0x5fc6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5fc6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fc6('0x5')](_0x5fc6('0x6'),_0x5fc6('0x7'),_0x5fc6('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe148=['name','INTEGER','rrmemory','beepall','roundrobin','STRING','sequelize','exports'];(function(_0x3e1d97,_0xe83c60){var _0x33193a=function(_0x1ceba8){while(--_0x1ceba8){_0x3e1d97['push'](_0x3e1d97['shift']());}};_0x33193a(++_0xe83c60);}(_0xe148,0x9e));var _0x8e14=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xe148[_0x3efe87];return _0x56a4cc;};'use strict';var Sequelize=require(_0x8e14('0x0'));module[_0x8e14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8e14('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8e14('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8e14('0x4'),_0x8e14('0x5'),_0x8e14('0x6'))},'description':{'type':Sequelize[_0x8e14('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d25d067..ee54240 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 _0x914a=['spread','emit','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','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','socket.io-emitter','redis','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','WhatsappQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','UserId','agent','whatsappPause','updatedAt','createdAt','rows','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','clone','sequelize','toString','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit'];(function(_0x4ed4e7,_0x255a02){var _0x3c83ef=function(_0x3a3d7f){while(--_0x3a3d7f){_0x4ed4e7['push'](_0x4ed4e7['shift']());}};_0x3c83ef(++_0x255a02);}(_0x914a,0x19c));var _0xa914=function(_0x40e141,_0x4385ee){_0x40e141=_0x40e141-0x0;var _0x3ce15c=_0x914a[_0x40e141];return _0x3ce15c;};'use strict';var emlformat=require(_0xa914('0x0'));var rimraf=require(_0xa914('0x1'));var zipdir=require(_0xa914('0x2'));var jsonpatch=require(_0xa914('0x3'));var rp=require(_0xa914('0x4'));var moment=require(_0xa914('0x5'));var BPromise=require(_0xa914('0x6'));var Mustache=require(_0xa914('0x7'));var util=require(_0xa914('0x8'));var path=require(_0xa914('0x9'));var sox=require(_0xa914('0xa'));var csv=require(_0xa914('0xb'));var ejs=require(_0xa914('0xc'));var fs=require('fs');var fs_extra=require(_0xa914('0xd'));var _=require(_0xa914('0xe'));var squel=require(_0xa914('0xf'));var crypto=require(_0xa914('0x10'));var jsforce=require(_0xa914('0x11'));var deskjs=require(_0xa914('0x12'));var toCsv=require('to-csv');var querystring=require(_0xa914('0x13'));var Papa=require(_0xa914('0x14'));var Redis=require('ioredis');var authService=require(_0xa914('0x15'));var qs=require(_0xa914('0x16'));var as=require(_0xa914('0x17'));var hardwareService=require(_0xa914('0x18'));var logger=require(_0xa914('0x19'))('api');var utils=require(_0xa914('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa914('0x1b'))(new Redis(config[_0xa914('0x1c')]));require(_0xa914('0x1d'))['register'](socket);function respondWithStatusCode(_0x41738d,_0x440858){_0x440858=_0x440858||0xcc;return function(_0x55839d){if(_0x55839d){return _0x41738d[_0xa914('0x1e')](_0x440858);}return _0x41738d[_0xa914('0x1f')](_0x440858)[_0xa914('0x20')]();};}function respondWithResult(_0x3aa06a,_0x2e1580){_0x2e1580=_0x2e1580||0xc8;return function(_0x485016){if(_0x485016){return _0x3aa06a['status'](_0x2e1580)['json'](_0x485016);}};}function respondWithFilteredResult(_0x1ebbad,_0xb79785){return function(_0x585df8){if(_0x585df8){var _0x3c45ed=typeof _0xb79785[_0xa914('0x21')]===_0xa914('0x22')&&typeof _0xb79785[_0xa914('0x23')]===_0xa914('0x22');var _0x36c2fa=_0x585df8[_0xa914('0x24')];var _0x2b3f05=_0x3c45ed?0x0:_0xb79785[_0xa914('0x21')];var _0x5879f2=_0x3c45ed?_0x585df8[_0xa914('0x24')]:_0xb79785['offset']+_0xb79785[_0xa914('0x23')];var _0x1059d6;if(_0x5879f2>=_0x36c2fa){_0x5879f2=_0x36c2fa;_0x1059d6=0xc8;}else{_0x1059d6=0xce;}_0x1ebbad[_0xa914('0x1f')](_0x1059d6);return _0x1ebbad[_0xa914('0x25')]('Content-Range',_0x2b3f05+'-'+_0x5879f2+'/'+_0x36c2fa)[_0xa914('0x26')](_0x585df8);}return null;};}function patchUpdates(_0x5285df){return function(_0x5795c8){try{jsonpatch[_0xa914('0x27')](_0x5795c8,_0x5285df,!![]);}catch(_0x2f69df){return BPromise['reject'](_0x2f69df);}return _0x5795c8['save']();};}function saveUpdates(_0x2c89b2,_0x4938d7){return function(_0x3f0957){if(_0x3f0957){return _0x3f0957[_0xa914('0x28')](_0x2c89b2)[_0xa914('0x29')](function(_0x33bd49){return _0x33bd49;});}return null;};}function removeEntity(_0x31cd02,_0x522d59){return function(_0xda9ee6){if(_0xda9ee6){return _0xda9ee6[_0xa914('0x2a')]()[_0xa914('0x29')](function(){var _0x1dd552=_0xda9ee6[_0xa914('0x2b')]({'plain':!![]});var _0x2987e0=_0xa914('0x2c');return db[_0xa914('0x2d')][_0xa914('0x2a')]({'where':{'type':_0x2987e0,'resourceId':_0x1dd552['id']}})[_0xa914('0x29')](function(){return _0xda9ee6;});})[_0xa914('0x29')](function(){_0x31cd02[_0xa914('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258e6a,_0x5847e4){return function(_0x1a3684){if(!_0x1a3684){_0x258e6a[_0xa914('0x1e')](0x194);}return _0x1a3684;};}function handleError(_0x11ce38,_0x336ead){_0x336ead=_0x336ead||0x1f4;return function(_0x341c1f){logger[_0xa914('0x2e')](_0x341c1f[_0xa914('0x2f')]);if(_0x341c1f['name']){delete _0x341c1f[_0xa914('0x30')];}_0x11ce38[_0xa914('0x1f')](_0x336ead)['send'](_0x341c1f);};}exports['index']=function(_0x2ec3c0,_0x26a2f9){var _0x371fbb={},_0x40d94d={},_0x3c0d72={'count':0x0,'rows':[]};var _0x3edcd0=_['map'](db[_0xa914('0x31')][_0xa914('0x32')],function(_0x4629c2){return{'name':_0x4629c2[_0xa914('0x33')],'type':_0x4629c2[_0xa914('0x34')]['key']};});_0x40d94d[_0xa914('0x35')]=_[_0xa914('0x36')](_0x3edcd0,'name');_0x40d94d[_0xa914('0x37')]=_[_0xa914('0x38')](_0x2ec3c0[_0xa914('0x37')]);_0x40d94d[_0xa914('0x39')]=_['intersection'](_0x40d94d[_0xa914('0x35')],_0x40d94d['query']);_0x371fbb[_0xa914('0x3a')]=_[_0xa914('0x3b')](_0x40d94d[_0xa914('0x35')],qs[_0xa914('0x3c')](_0x2ec3c0[_0xa914('0x37')]['fields']));_0x371fbb['attributes']=_0x371fbb[_0xa914('0x3a')][_0xa914('0x3d')]?_0x371fbb[_0xa914('0x3a')]:_0x40d94d[_0xa914('0x35')];if(!_0x2ec3c0['query'][_0xa914('0x3e')](_0xa914('0x3f'))){_0x371fbb[_0xa914('0x23')]=qs[_0xa914('0x23')](_0x2ec3c0[_0xa914('0x37')][_0xa914('0x23')]);_0x371fbb['offset']=qs[_0xa914('0x21')](_0x2ec3c0[_0xa914('0x37')][_0xa914('0x21')]);}_0x371fbb[_0xa914('0x40')]=qs[_0xa914('0x41')](_0x2ec3c0[_0xa914('0x37')]['sort']);_0x371fbb[_0xa914('0x42')]=qs[_0xa914('0x39')](_[_0xa914('0x43')](_0x2ec3c0[_0xa914('0x37')],_0x40d94d[_0xa914('0x39')]),_0x3edcd0);if(_0x2ec3c0[_0xa914('0x37')][_0xa914('0x44')]){_0x371fbb['where']=_[_0xa914('0x45')](_0x371fbb[_0xa914('0x42')],{'$or':_[_0xa914('0x36')](_0x3edcd0,function(_0x3626de){if(_0x3626de[_0xa914('0x34')]!==_0xa914('0x46')){var _0x5841e5={};_0x5841e5[_0x3626de[_0xa914('0x30')]]={'$like':'%'+_0x2ec3c0['query'][_0xa914('0x44')]+'%'};return _0x5841e5;}})});}_0x371fbb=_[_0xa914('0x45')]({},_0x371fbb,_0x2ec3c0[_0xa914('0x47')]);var _0x1876d1={'where':_0x371fbb[_0xa914('0x42')]};return db['WhatsappQueue'][_0xa914('0x24')](_0x1876d1)[_0xa914('0x29')](function(_0x3a0ce5){_0x3c0d72['count']=_0x3a0ce5;if(_0x2ec3c0['query'][_0xa914('0x48')]){_0x371fbb[_0xa914('0x49')]=[{'all':!![]}];}return db[_0xa914('0x31')][_0xa914('0x4a')](_0x371fbb);})[_0xa914('0x29')](function(_0x126879){_0x3c0d72['rows']=_0x126879;return _0x3c0d72;})['then'](respondWithFilteredResult(_0x26a2f9,_0x371fbb))[_0xa914('0x4b')](handleError(_0x26a2f9,null));};exports[_0xa914('0x4c')]=function(_0x206ef8,_0xb3f5cf){var _0x54fb22={'raw':!![],'where':{'id':_0x206ef8[_0xa914('0x4d')]['id']}},_0x21cbae={};_0x21cbae[_0xa914('0x35')]=_[_0xa914('0x38')](db[_0xa914('0x31')][_0xa914('0x32')]);_0x21cbae[_0xa914('0x37')]=_[_0xa914('0x38')](_0x206ef8['query']);_0x21cbae[_0xa914('0x39')]=_[_0xa914('0x3b')](_0x21cbae[_0xa914('0x35')],_0x21cbae[_0xa914('0x37')]);_0x54fb22['attributes']=_[_0xa914('0x3b')](_0x21cbae[_0xa914('0x35')],qs['fields'](_0x206ef8[_0xa914('0x37')][_0xa914('0x3c')]));_0x54fb22[_0xa914('0x3a')]=_0x54fb22[_0xa914('0x3a')][_0xa914('0x3d')]?_0x54fb22['attributes']:_0x21cbae[_0xa914('0x35')];if(_0x206ef8[_0xa914('0x37')][_0xa914('0x48')]){_0x54fb22[_0xa914('0x49')]=[{'all':!![]}];}_0x54fb22=_[_0xa914('0x45')]({},_0x54fb22,_0x206ef8[_0xa914('0x47')]);return db[_0xa914('0x31')]['find'](_0x54fb22)[_0xa914('0x29')](handleEntityNotFound(_0xb3f5cf,null))[_0xa914('0x29')](respondWithResult(_0xb3f5cf,null))[_0xa914('0x4b')](handleError(_0xb3f5cf,null));};exports[_0xa914('0x4e')]=function(_0x49b225,_0x4ad3e1){return db['WhatsappQueue'][_0xa914('0x4e')](_0x49b225[_0xa914('0x4f')],{})[_0xa914('0x29')](function(_0x4c22c8){var _0x4dc17d=_0x49b225[_0xa914('0x50')][_0xa914('0x2b')]({'plain':!![]});if(!_0x4dc17d)throw new Error(_0xa914('0x51'));if(_0x4dc17d[_0xa914('0x52')]===_0xa914('0x50')){var _0x3f06f6=_0x4c22c8[_0xa914('0x2b')]({'plain':!![]});var _0xc6a1c2='WhatsappQueues';return db[_0xa914('0x53')][_0xa914('0x54')]({'where':{'name':_0xc6a1c2,'userProfileId':_0x4dc17d[_0xa914('0x55')]},'raw':!![]})['then'](function(_0x583650){if(_0x583650&&_0x583650[_0xa914('0x56')]===0x0){return db['UserProfileResource'][_0xa914('0x4e')]({'name':_0x3f06f6[_0xa914('0x30')],'resourceId':_0x3f06f6['id'],'type':_0x583650[_0xa914('0x30')],'sectionId':_0x583650['id']},{})[_0xa914('0x29')](function(){return _0x4c22c8;});}else{return _0x4c22c8;}})[_0xa914('0x4b')](function(_0x5b8b97){logger[_0xa914('0x2e')](_0xa914('0x57'),_0x5b8b97);throw _0x5b8b97;});}return _0x4c22c8;})[_0xa914('0x29')](respondWithResult(_0x4ad3e1,0xc9))[_0xa914('0x4b')](handleError(_0x4ad3e1,null));};exports[_0xa914('0x28')]=function(_0x1ad243,_0x2c869e){if(_0x1ad243[_0xa914('0x4f')]['id']){delete _0x1ad243[_0xa914('0x4f')]['id'];}return db[_0xa914('0x31')]['find']({'where':{'id':_0x1ad243[_0xa914('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c869e,null))[_0xa914('0x29')](saveUpdates(_0x1ad243[_0xa914('0x4f')],null))['then'](respondWithResult(_0x2c869e,null))[_0xa914('0x4b')](handleError(_0x2c869e,null));};exports['destroy']=function(_0x5f0efc,_0x39e906){return db[_0xa914('0x31')][_0xa914('0x54')]({'where':{'id':_0x5f0efc[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](handleEntityNotFound(_0x39e906,null))['then'](removeEntity(_0x39e906,null))[_0xa914('0x4b')](handleError(_0x39e906,null));};exports[_0xa914('0x58')]=function(_0xa54495,_0x3229b6){return db['WhatsappQueue'][_0xa914('0x58')]()[_0xa914('0x29')](respondWithResult(_0x3229b6,null))['catch'](handleError(_0x3229b6,null));};exports[_0xa914('0x59')]=function(_0x2ad12c,_0x56c066,_0x4ea3d4){var _0x30f996={'raw':!![],'where':{}},_0x286dd0={},_0x688430;return db['WhatsappQueue'][_0xa914('0x5a')]({'where':{'id':_0x2ad12c[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](handleEntityNotFound(_0x56c066,null))[_0xa914('0x29')](function(_0x2506fc){if(_0x2506fc){_0x688430=_0x2506fc[_0xa914('0x2b')]({'plain':!![]});_0x286dd0[_0xa914('0x35')]=_[_0xa914('0x38')](db['UserWhatsappQueue'][_0xa914('0x32')]);_0x286dd0[_0xa914('0x37')]=_[_0xa914('0x38')](_0x2ad12c['query']);_0x286dd0[_0xa914('0x39')]=_[_0xa914('0x3b')](_0x286dd0[_0xa914('0x35')],_0x286dd0[_0xa914('0x37')]);_0x30f996[_0xa914('0x3a')]=_[_0xa914('0x3b')](_0x286dd0['model'],qs[_0xa914('0x3c')](_0x2ad12c[_0xa914('0x37')]['fields']));_0x30f996[_0xa914('0x3a')]=_0x30f996[_0xa914('0x3a')][_0xa914('0x3d')]?_0x30f996[_0xa914('0x3a')]:_0x286dd0[_0xa914('0x35')];if(!_0x2ad12c['query']['hasOwnProperty'](_0xa914('0x3f'))){_0x30f996['limit']=qs[_0xa914('0x23')](_0x2ad12c['query'][_0xa914('0x23')]);_0x30f996[_0xa914('0x21')]=qs['offset'](_0x2ad12c[_0xa914('0x37')]['offset']);}_0x30f996[_0xa914('0x40')]=qs[_0xa914('0x41')](_0x2ad12c['query']['sort']);_0x30f996[_0xa914('0x42')]=qs[_0xa914('0x39')](_[_0xa914('0x43')](_0x2ad12c[_0xa914('0x37')],_0x286dd0[_0xa914('0x39')]));_0x30f996[_0xa914('0x42')][_0xa914('0x5b')]=_0x2506fc['id'];if(_0x2ad12c['query'][_0xa914('0x44')]){_0x30f996[_0xa914('0x42')]=_[_0xa914('0x45')](_0x30f996[_0xa914('0x42')],{'$or':_['map'](_0x30f996[_0xa914('0x3a')],function(_0x163403){var _0x35bcca={};_0x35bcca[_0x163403]={'$like':'%'+_0x2ad12c[_0xa914('0x37')][_0xa914('0x44')]+'%'};return _0x35bcca;})});}_0x30f996=_[_0xa914('0x45')]({},_0x30f996,_0x2ad12c['options']);return db[_0xa914('0x5c')][_0xa914('0x4a')](_0x30f996);}})[_0xa914('0x29')](function(_0x42e0a6){if(_0x42e0a6){return db['User']['findAndCountAll']({'where':{'id':_[_0xa914('0x36')](_0x42e0a6,_0xa914('0x5d')),'role':_0xa914('0x5e')},'attributes':['id','name',_0xa914('0x5f'),_0xa914('0x60'),_0xa914('0x61')]});}})[_0xa914('0x29')](function(_0x380a3a){if(_0x380a3a){return{'count':_0x380a3a[_0xa914('0x24')],'rows':_[_0xa914('0x36')](_0x380a3a[_0xa914('0x62')],function(_0x5de39c){return{'membername':_0x5de39c['name'],'UserId':_0x5de39c['id'],'queue_name':_0x688430[_0xa914('0x30')],'WhatsappQueueId':_0x688430['id'],'interface':util['format']('%s/%s','SIP',_0x5de39c[_0xa914('0x30')]),'penalty':0x0,'paused':_0x5de39c[_0xa914('0x5f')],'createdAt':_0x5de39c[_0xa914('0x61')],'updatedAt':_0x5de39c[_0xa914('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56c066,_0x30f996))[_0xa914('0x4b')](handleError(_0x56c066,null));};exports[_0xa914('0x63')]=function(_0x4dbe87,_0x4ca0c6,_0x30aa15){var _0x4bfdb6={};var _0x6a446a={};var _0x39295e;var _0xf6961b;return db['WhatsappQueue'][_0xa914('0x5a')]({'where':{'id':_0x4dbe87[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](handleEntityNotFound(_0x4ca0c6,null))[_0xa914('0x29')](function(_0x24bfe0){if(_0x24bfe0){_0x39295e=_0x24bfe0;_0x6a446a['model']=_['keys'](db[_0xa914('0x64')]['rawAttributes']);_0x6a446a['query']=_[_0xa914('0x38')](_0x4dbe87['query']);_0x6a446a[_0xa914('0x39')]=_['intersection'](_0x6a446a['model'],_0x6a446a[_0xa914('0x37')]);_0x4bfdb6[_0xa914('0x3a')]=_[_0xa914('0x3b')](_0x6a446a['model'],qs['fields'](_0x4dbe87[_0xa914('0x37')][_0xa914('0x3c')]));_0x4bfdb6[_0xa914('0x3a')]=_0x4bfdb6[_0xa914('0x3a')]['length']?_0x4bfdb6[_0xa914('0x3a')]:_0x6a446a[_0xa914('0x35')];_0x4bfdb6[_0xa914('0x40')]=qs[_0xa914('0x41')](_0x4dbe87['query'][_0xa914('0x41')]);_0x4bfdb6[_0xa914('0x42')]=qs[_0xa914('0x39')](_['pick'](_0x4dbe87['query'],_0x6a446a[_0xa914('0x39')]));if(_0x4dbe87['query']['filter']){_0x4bfdb6[_0xa914('0x42')]=_[_0xa914('0x45')](_0x4bfdb6[_0xa914('0x42')],{'$or':_['map'](_0x4bfdb6[_0xa914('0x3a')],function(_0xc5cd7c){var _0x4a696e={};_0x4a696e[_0xc5cd7c]={'$like':'%'+_0x4dbe87[_0xa914('0x37')][_0xa914('0x44')]+'%'};return _0x4a696e;})});}_0x4bfdb6=_['merge']({},_0x4bfdb6,_0x4dbe87[_0xa914('0x47')]);return _0x39295e['getTeams'](_0x4bfdb6);}})[_0xa914('0x29')](function(_0x10605d){if(_0x10605d){_0xf6961b=_0x10605d[_0xa914('0x3d')];if(!_0x4dbe87[_0xa914('0x37')][_0xa914('0x3e')]('nolimit')){_0x4bfdb6[_0xa914('0x23')]=qs[_0xa914('0x23')](_0x4dbe87[_0xa914('0x37')][_0xa914('0x23')]);_0x4bfdb6[_0xa914('0x21')]=qs[_0xa914('0x21')](_0x4dbe87[_0xa914('0x37')][_0xa914('0x21')]);}return _0x39295e[_0xa914('0x63')](_0x4bfdb6);}})[_0xa914('0x29')](function(_0x555445){if(_0x555445){return _0x555445?{'count':_0xf6961b,'rows':_0x555445}:null;}})[_0xa914('0x29')](respondWithResult(_0x4ca0c6,null))['catch'](handleError(_0x4ca0c6,null));};exports['addTeams']=function(_0x2845fe,_0x275332,_0x301e56){var _0x3f7d86=_0x2845fe[_0xa914('0x4f')][_0xa914('0x65')];return db[_0xa914('0x64')][_0xa914('0x4a')]({'where':{'id':_0x3f7d86},'attributes':['id'],'include':[{'model':db[_0xa914('0x66')],'as':_0xa914('0x67'),'attributes':['id',_0xa914('0x30'),_0xa914('0x68'),_0xa914('0x69'),_0xa914('0x6a')],'raw':!![]}]})[_0xa914('0x29')](function(_0xe1faa8){if(_0xe1faa8){var _0x5a3837=_[_0xa914('0x6b')](_0xe1faa8,function(_0x4aa23d){var _0x7bd331=_0x4aa23d[_0xa914('0x2b')]({'plain':!![]});return _0x7bd331[_0xa914('0x67')];});return db[_0xa914('0x31')][_0xa914('0x54')]({'where':{'id':_0x2845fe[_0xa914('0x4d')]['id']}})['then'](function(_0x2196ef){return db['sequelize'][_0xa914('0x6c')](function(_0xd9d6b5){return _0x2196ef['addTeams'](_0x3f7d86,{'transaction':_0xd9d6b5})[_0xa914('0x29')](function(){return BPromise[_0xa914('0x6d')](_0x5a3837,function(_0x192e40){return db['UserWhatsappQueue'][_0xa914('0x6e')]({'where':{'UserId':_0x192e40['id'],'WhatsappQueueId':_0x2845fe[_0xa914('0x4d')]['id']},'transaction':_0xd9d6b5});});})['then'](function(){_0x5a3837['forEach'](function(_0x30a4f9){socket['emit']('userWhatsappQueue:save',{'UserId':_0x30a4f9['id'],'WhatsappQueueId':_0x2196ef['id']});});});});});}})[_0xa914('0x29')](respondWithStatusCode(_0x275332,null))[_0xa914('0x4b')](handleError(_0x275332,null));};exports[_0xa914('0x6f')]=function(_0x3384a9,_0xe49eef,_0x41f7ab){return db[_0xa914('0x64')][_0xa914('0x4a')]({'where':{'id':_0x3384a9[_0xa914('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa914('0x66')],'as':_0xa914('0x67'),'attributes':['id'],'raw':!![]}]})[_0xa914('0x29')](handleEntityNotFound(_0xe49eef,null))[_0xa914('0x29')](function(_0x1cb1fe){var _0x2f73be=_['map'](_0x1cb1fe,'id');var _0x3252de=[];var _0x1aa898=[];var _0x50244d=squel[_0xa914('0x70')]();_0x50244d['field'](_0xa914('0x71'))[_0xa914('0x72')](_0xa914('0x73'),'tq')['join'](_0xa914('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa914('0x42')]('WhatsappQueueId\x20=\x20?',_0x3384a9[_0xa914('0x4d')]['id']);for(var _0x230f58=0x0;_0x230f58<_0x1cb1fe['length'];_0x230f58+=0x1){let _0x3ab733=_0x1cb1fe[_0x230f58];for(var _0x2e7726=0x0;_0x2e7726<_0x3ab733['Agents']['length'];_0x2e7726+=0x1){let _0x11a6e3=_0x3ab733[_0xa914('0x67')][_0x2e7726];var _0x474bb3=_0x50244d[_0xa914('0x75')]();_0x474bb3[_0xa914('0x42')]('ut.UserId\x20=\x20?',_0x11a6e3['id']);_0x1aa898['push'](db[_0xa914('0x76')]['query'](_0x474bb3[_0xa914('0x77')](),{'type':db['sequelize']['QueryTypes'][_0xa914('0x78')]})[_0xa914('0x29')](function(_0x4c5cfb){if(_0x4c5cfb[_0xa914('0x3d')]===0x1){return _0x11a6e3['id'];}else{var _0xeb5597=_[_0xa914('0x79')](_[_0xa914('0x36')](_0x4c5cfb,_0xa914('0x7a')),function(_0x5c0fb8){return _[_0xa914('0x7b')](_0x2f73be,_0x5c0fb8);});if(_0xeb5597){return _0x11a6e3['id'];}}}));}}return BPromise[_0xa914('0x7c')](_0x1aa898)[_0xa914('0x29')](function(_0x2fcfaf){_0x3252de=_(_0x3252de)['union'](_0x2fcfaf)['compact']()[_0xa914('0x7d')]();return db[_0xa914('0x31')]['find']({'where':{'id':_0x3384a9[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](function(_0x14db59){return db[_0xa914('0x76')]['transaction'](function(_0x3540d6){return _0x14db59['removeTeams'](_0x3384a9[_0xa914('0x37')][_0xa914('0x65')],{'transaction':_0x3540d6})['then'](function(){if(!_[_0xa914('0x7e')](_0x3252de)){return _0x14db59[_0xa914('0x7f')](_0x3252de,{'transaction':_0x3540d6});}})[_0xa914('0x29')](function(){_0x3252de[_0xa914('0x80')](function(_0x247cff){socket['emit'](_0xa914('0x81'),{'UserId':_0x247cff,'WhatsappQueueId':_0x14db59['id']});});});});});});})['then'](respondWithStatusCode(_0xe49eef,null))[_0xa914('0x4b')](handleError(_0xe49eef,null));};exports[_0xa914('0x82')]=function(_0x3f2b36,_0xf650,_0x397328){return db['WhatsappQueue'][_0xa914('0x54')]({'where':{'id':_0x3f2b36[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](handleEntityNotFound(_0xf650,null))[_0xa914('0x29')](function(_0xa2c8f1){if(_0xa2c8f1){return _0xa2c8f1['addAgents'](_0x3f2b36[_0xa914('0x4f')][_0xa914('0x65')],_[_0xa914('0x83')](_0x3f2b36[_0xa914('0x4f')],[_0xa914('0x65'),'id'])||{})[_0xa914('0x84')](function(_0x4cfa1f){for(var _0x25700e=0x0;_0x25700e<_0x3f2b36[_0xa914('0x4f')][_0xa914('0x65')][_0xa914('0x3d')];_0x25700e+=0x1){socket[_0xa914('0x85')]('userWhatsappQueue:save',{'UserId':Number(_0x3f2b36[_0xa914('0x4f')][_0xa914('0x65')][_0x25700e]),'WhatsappQueueId':Number(_0x3f2b36[_0xa914('0x4d')]['id'])});}return _0x4cfa1f;});}})[_0xa914('0x29')](respondWithResult(_0xf650,null))[_0xa914('0x4b')](handleError(_0xf650,null));};exports[_0xa914('0x7f')]=function(_0x2ddc7c,_0x191673,_0x51ff24){return db[_0xa914('0x31')][_0xa914('0x54')]({'where':{'id':_0x2ddc7c[_0xa914('0x4d')]['id']}})[_0xa914('0x29')](handleEntityNotFound(_0x191673,null))['then'](function(_0xb8619e){if(_0xb8619e){return _0xb8619e[_0xa914('0x7f')](_0x2ddc7c['query'][_0xa914('0x65')])[_0xa914('0x29')](function(){if(_[_0xa914('0x86')](_0x2ddc7c[_0xa914('0x37')][_0xa914('0x65')])){for(var _0x4970ff=0x0;_0x4970ff<_0x2ddc7c['query'][_0xa914('0x65')][_0xa914('0x3d')];_0x4970ff+=0x1){socket[_0xa914('0x85')](_0xa914('0x81'),{'UserId':Number(_0x2ddc7c[_0xa914('0x37')]['ids'][_0x4970ff]),'WhatsappQueueId':Number(_0x2ddc7c['params']['id'])});}}else{socket[_0xa914('0x85')](_0xa914('0x81'),{'UserId':Number(_0x2ddc7c[_0xa914('0x37')][_0xa914('0x65')]),'WhatsappQueueId':Number(_0x2ddc7c[_0xa914('0x4d')]['id'])});}});}})[_0xa914('0x29')](respondWithStatusCode(_0x191673,null))[_0xa914('0x4b')](handleError(_0x191673,null));};exports[_0xa914('0x87')]=function(_0x3aa695,_0x2734ab,_0x22a3fe){var _0x371c8d={};var _0x5740ab={};var _0x5a4fbf;var _0xd26e61;return db[_0xa914('0x31')][_0xa914('0x5a')]({'where':{'id':_0x3aa695['params']['id']}})[_0xa914('0x29')](handleEntityNotFound(_0x2734ab,null))['then'](function(_0x49154a){if(_0x49154a){_0x5a4fbf=_0x49154a;_0x5740ab[_0xa914('0x35')]=_[_0xa914('0x38')](db[_0xa914('0x66')]['rawAttributes']);_0x5740ab[_0xa914('0x37')]=_['keys'](_0x3aa695['query']);_0x5740ab[_0xa914('0x39')]=_[_0xa914('0x3b')](_0x5740ab[_0xa914('0x35')],_0x5740ab[_0xa914('0x37')]);_0x371c8d['attributes']=_[_0xa914('0x3b')](_0x5740ab[_0xa914('0x35')],qs['fields'](_0x3aa695['query'][_0xa914('0x3c')]));_0x371c8d[_0xa914('0x3a')]=_0x371c8d[_0xa914('0x3a')]['length']?_0x371c8d['attributes']:_0x5740ab['model'];_0x371c8d['order']=qs[_0xa914('0x41')](_0x3aa695[_0xa914('0x37')]['sort']);_0x371c8d['where']=qs['filters'](_[_0xa914('0x43')](_0x3aa695['query'],_0x5740ab[_0xa914('0x39')]));if(_0x3aa695[_0xa914('0x37')][_0xa914('0x44')]){_0x371c8d[_0xa914('0x42')]=_[_0xa914('0x45')](_0x371c8d[_0xa914('0x42')],{'$or':_[_0xa914('0x36')](_0x371c8d[_0xa914('0x3a')],function(_0x325535){var _0x7545c5={};_0x7545c5[_0x325535]={'$like':'%'+_0x3aa695[_0xa914('0x37')][_0xa914('0x44')]+'%'};return _0x7545c5;})});}_0x371c8d=_['merge']({},_0x371c8d,_0x3aa695[_0xa914('0x47')]);return _0x5a4fbf[_0xa914('0x87')](_0x371c8d);}})['then'](function(_0x5285c8){if(_0x5285c8){_0xd26e61=_0x5285c8['length'];if(!_0x3aa695[_0xa914('0x37')][_0xa914('0x3e')](_0xa914('0x3f'))){_0x371c8d['limit']=qs[_0xa914('0x23')](_0x3aa695['query']['limit']);_0x371c8d[_0xa914('0x21')]=qs[_0xa914('0x21')](_0x3aa695[_0xa914('0x37')][_0xa914('0x21')]);}return _0x5a4fbf[_0xa914('0x87')](_0x371c8d);}})[_0xa914('0x29')](function(_0x11d8f6){if(_0x11d8f6){return _0x11d8f6?{'count':_0xd26e61,'rows':_0x11d8f6}:null;}})[_0xa914('0x29')](respondWithResult(_0x2734ab,null))[_0xa914('0x4b')](handleError(_0x2734ab,null));}; \ No newline at end of file +var _0x5bb7=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','whatsappPause','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','flatMap','sequelize','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','apply','save','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','query','keys','filters','intersection','model','fields'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x5bb7,0x15b));var _0x75bb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5bb7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x75bb('0x0'));var rimraf=require(_0x75bb('0x1'));var zipdir=require(_0x75bb('0x2'));var jsonpatch=require(_0x75bb('0x3'));var rp=require(_0x75bb('0x4'));var moment=require('moment');var BPromise=require(_0x75bb('0x5'));var Mustache=require(_0x75bb('0x6'));var util=require(_0x75bb('0x7'));var path=require(_0x75bb('0x8'));var sox=require(_0x75bb('0x9'));var csv=require(_0x75bb('0xa'));var ejs=require(_0x75bb('0xb'));var fs=require('fs');var fs_extra=require(_0x75bb('0xc'));var _=require('lodash');var squel=require(_0x75bb('0xd'));var crypto=require(_0x75bb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75bb('0xa'));var querystring=require(_0x75bb('0xf'));var Papa=require(_0x75bb('0x10'));var Redis=require('ioredis');var authService=require(_0x75bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x75bb('0x12'));var hardwareService=require(_0x75bb('0x13'));var logger=require('../../config/logger')(_0x75bb('0x14'));var utils=require('../../config/utils');var config=require(_0x75bb('0x15'));var licenseUtil=require(_0x75bb('0x16'));var db=require(_0x75bb('0x17'))['db'];config[_0x75bb('0x18')]=_[_0x75bb('0x19')](config[_0x75bb('0x18')],{'host':_0x75bb('0x1a'),'port':0x18eb});var socket=require(_0x75bb('0x1b'))(new Redis(config['redis']));require(_0x75bb('0x1c'))[_0x75bb('0x1d')](socket);function respondWithStatusCode(_0x1735f2,_0x17a46d){_0x17a46d=_0x17a46d||0xcc;return function(_0x1e42c2){if(_0x1e42c2){return _0x1735f2['sendStatus'](_0x17a46d);}return _0x1735f2['status'](_0x17a46d)['end']();};}function respondWithResult(_0x3f672c,_0x1f1902){_0x1f1902=_0x1f1902||0xc8;return function(_0x4f9bb5){if(_0x4f9bb5){return _0x3f672c[_0x75bb('0x1e')](_0x1f1902)[_0x75bb('0x1f')](_0x4f9bb5);}};}function respondWithFilteredResult(_0x2bfacc,_0x401b1e){return function(_0x1bb616){if(_0x1bb616){var _0x1236c0=typeof _0x401b1e[_0x75bb('0x20')]===_0x75bb('0x21')&&typeof _0x401b1e[_0x75bb('0x22')]===_0x75bb('0x21');var _0x113f51=_0x1bb616[_0x75bb('0x23')];var _0x2588de=_0x1236c0?0x0:_0x401b1e[_0x75bb('0x20')];var _0x34f5a3=_0x1236c0?_0x1bb616['count']:_0x401b1e[_0x75bb('0x20')]+_0x401b1e[_0x75bb('0x22')];var _0x2987d4;if(_0x34f5a3>=_0x113f51){_0x34f5a3=_0x113f51;_0x2987d4=0xc8;}else{_0x2987d4=0xce;}_0x2bfacc[_0x75bb('0x1e')](_0x2987d4);return _0x2bfacc[_0x75bb('0x24')]('Content-Range',_0x2588de+'-'+_0x34f5a3+'/'+_0x113f51)[_0x75bb('0x1f')](_0x1bb616);}return null;};}function patchUpdates(_0x11d516){return function(_0x203c3c){try{jsonpatch[_0x75bb('0x25')](_0x203c3c,_0x11d516,!![]);}catch(_0x482d3c){return BPromise['reject'](_0x482d3c);}return _0x203c3c[_0x75bb('0x26')]();};}function saveUpdates(_0x28291f,_0x33dab6){return function(_0x74a399){if(_0x74a399){return _0x74a399['update'](_0x28291f)['then'](function(_0x355408){return _0x355408;});}return null;};}function removeEntity(_0x267bf5,_0x596b56){return function(_0x3f2e7c){if(_0x3f2e7c){return _0x3f2e7c[_0x75bb('0x27')]()[_0x75bb('0x28')](function(){var _0x40cb9b=_0x3f2e7c[_0x75bb('0x29')]({'plain':!![]});var _0x17dd80=_0x75bb('0x2a');return db[_0x75bb('0x2b')][_0x75bb('0x27')]({'where':{'type':_0x17dd80,'resourceId':_0x40cb9b['id']}})[_0x75bb('0x28')](function(){return _0x3f2e7c;});})[_0x75bb('0x28')](function(){_0x267bf5[_0x75bb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9aca,_0x336268){return function(_0xb8e64c){if(!_0xb8e64c){_0x4d9aca[_0x75bb('0x2c')](0x194);}return _0xb8e64c;};}function handleError(_0x338c1b,_0x972058){_0x972058=_0x972058||0x1f4;return function(_0x253c87){logger[_0x75bb('0x2d')](_0x253c87[_0x75bb('0x2e')]);if(_0x253c87[_0x75bb('0x2f')]){delete _0x253c87[_0x75bb('0x2f')];}_0x338c1b[_0x75bb('0x1e')](_0x972058)[_0x75bb('0x30')](_0x253c87);};}exports[_0x75bb('0x31')]=function(_0x49369d,_0x4a5e2d){var _0x4b5a14={},_0x47b726={},_0x199cae={'count':0x0,'rows':[]};var _0x992d1f=_[_0x75bb('0x32')](db[_0x75bb('0x33')][_0x75bb('0x34')],function(_0x1f2d7f){return{'name':_0x1f2d7f['fieldName'],'type':_0x1f2d7f[_0x75bb('0x35')][_0x75bb('0x36')]};});_0x47b726['model']=_['map'](_0x992d1f,_0x75bb('0x2f'));_0x47b726[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x49369d[_0x75bb('0x37')]);_0x47b726[_0x75bb('0x39')]=_['intersection'](_0x47b726['model'],_0x47b726['query']);_0x4b5a14['attributes']=_[_0x75bb('0x3a')](_0x47b726[_0x75bb('0x3b')],qs[_0x75bb('0x3c')](_0x49369d[_0x75bb('0x37')][_0x75bb('0x3c')]));_0x4b5a14['attributes']=_0x4b5a14[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x4b5a14[_0x75bb('0x3d')]:_0x47b726[_0x75bb('0x3b')];if(!_0x49369d[_0x75bb('0x37')][_0x75bb('0x3f')](_0x75bb('0x40'))){_0x4b5a14[_0x75bb('0x22')]=qs['limit'](_0x49369d[_0x75bb('0x37')][_0x75bb('0x22')]);_0x4b5a14[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x49369d[_0x75bb('0x37')][_0x75bb('0x20')]);}_0x4b5a14[_0x75bb('0x41')]=qs[_0x75bb('0x42')](_0x49369d['query'][_0x75bb('0x42')]);_0x4b5a14['where']=qs[_0x75bb('0x39')](_[_0x75bb('0x43')](_0x49369d[_0x75bb('0x37')],_0x47b726[_0x75bb('0x39')]),_0x992d1f);if(_0x49369d['query']['filter']){_0x4b5a14[_0x75bb('0x44')]=_[_0x75bb('0x45')](_0x4b5a14['where'],{'$or':_[_0x75bb('0x32')](_0x992d1f,function(_0x4956d5){if(_0x4956d5['type']!==_0x75bb('0x46')){var _0x4b6599={};_0x4b6599[_0x4956d5['name']]={'$like':'%'+_0x49369d[_0x75bb('0x37')][_0x75bb('0x47')]+'%'};return _0x4b6599;}})});}_0x4b5a14=_[_0x75bb('0x45')]({},_0x4b5a14,_0x49369d['options']);var _0x4a7e1d={'where':_0x4b5a14[_0x75bb('0x44')]};return db['WhatsappQueue'][_0x75bb('0x23')](_0x4a7e1d)['then'](function(_0x4186dc){_0x199cae[_0x75bb('0x23')]=_0x4186dc;if(_0x49369d['query'][_0x75bb('0x48')]){_0x4b5a14[_0x75bb('0x49')]=[{'all':!![]}];}return db[_0x75bb('0x33')][_0x75bb('0x4a')](_0x4b5a14);})[_0x75bb('0x28')](function(_0x3aa57b){_0x199cae[_0x75bb('0x4b')]=_0x3aa57b;return _0x199cae;})[_0x75bb('0x28')](respondWithFilteredResult(_0x4a5e2d,_0x4b5a14))[_0x75bb('0x4c')](handleError(_0x4a5e2d,null));};exports[_0x75bb('0x4d')]=function(_0x3f8677,_0xd79311){var _0x4389cc={'raw':!![],'where':{'id':_0x3f8677[_0x75bb('0x4e')]['id']}},_0x4d16af={};_0x4d16af[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x33')]['rawAttributes']);_0x4d16af[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x3f8677['query']);_0x4d16af[_0x75bb('0x39')]=_[_0x75bb('0x3a')](_0x4d16af['model'],_0x4d16af['query']);_0x4389cc[_0x75bb('0x3d')]=_[_0x75bb('0x3a')](_0x4d16af[_0x75bb('0x3b')],qs[_0x75bb('0x3c')](_0x3f8677[_0x75bb('0x37')][_0x75bb('0x3c')]));_0x4389cc['attributes']=_0x4389cc[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x4389cc[_0x75bb('0x3d')]:_0x4d16af[_0x75bb('0x3b')];if(_0x3f8677[_0x75bb('0x37')][_0x75bb('0x48')]){_0x4389cc[_0x75bb('0x49')]=[{'all':!![]}];}_0x4389cc=_[_0x75bb('0x45')]({},_0x4389cc,_0x3f8677[_0x75bb('0x4f')]);return db['WhatsappQueue']['find'](_0x4389cc)['then'](handleEntityNotFound(_0xd79311,null))[_0x75bb('0x28')](respondWithResult(_0xd79311,null))[_0x75bb('0x4c')](handleError(_0xd79311,null));};exports['create']=function(_0x434df3,_0x36ac5c){return db[_0x75bb('0x33')][_0x75bb('0x50')](_0x434df3[_0x75bb('0x51')],{})['then'](function(_0xbc6aa8){var _0x56fa92=_0x434df3[_0x75bb('0x52')]['get']({'plain':!![]});if(!_0x56fa92)throw new Error(_0x75bb('0x53'));if(_0x56fa92[_0x75bb('0x54')]===_0x75bb('0x52')){var _0x377cc1=_0xbc6aa8[_0x75bb('0x29')]({'plain':!![]});var _0x1607a7=_0x75bb('0x2a');return db[_0x75bb('0x55')][_0x75bb('0x56')]({'where':{'name':_0x1607a7,'userProfileId':_0x56fa92['userProfileId']},'raw':!![]})[_0x75bb('0x28')](function(_0x4b05d4){if(_0x4b05d4&&_0x4b05d4['autoAssociation']===0x0){return db[_0x75bb('0x2b')][_0x75bb('0x50')]({'name':_0x377cc1['name'],'resourceId':_0x377cc1['id'],'type':_0x4b05d4[_0x75bb('0x2f')],'sectionId':_0x4b05d4['id']},{})[_0x75bb('0x28')](function(){return _0xbc6aa8;});}else{return _0xbc6aa8;}})[_0x75bb('0x4c')](function(_0x41183f){logger[_0x75bb('0x2d')](_0x75bb('0x57'),_0x41183f);throw _0x41183f;});}return _0xbc6aa8;})[_0x75bb('0x28')](respondWithResult(_0x36ac5c,0xc9))[_0x75bb('0x4c')](handleError(_0x36ac5c,null));};exports[_0x75bb('0x58')]=function(_0x466b7b,_0x6fd36b){if(_0x466b7b[_0x75bb('0x51')]['id']){delete _0x466b7b['body']['id'];}return db['WhatsappQueue'][_0x75bb('0x56')]({'where':{'id':_0x466b7b[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x6fd36b,null))[_0x75bb('0x28')](saveUpdates(_0x466b7b[_0x75bb('0x51')],null))['then'](respondWithResult(_0x6fd36b,null))[_0x75bb('0x4c')](handleError(_0x6fd36b,null));};exports['destroy']=function(_0x7e4960,_0x4ebb96){return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x7e4960[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x4ebb96,null))[_0x75bb('0x28')](removeEntity(_0x4ebb96,null))['catch'](handleError(_0x4ebb96,null));};exports[_0x75bb('0x59')]=function(_0x4e5de6,_0x4c3f0d){return db[_0x75bb('0x33')][_0x75bb('0x59')]()['then'](respondWithResult(_0x4c3f0d,null))[_0x75bb('0x4c')](handleError(_0x4c3f0d,null));};exports['getMembers']=function(_0x83e44d,_0x58c3a7,_0x435c5f){var _0xb487b3={'raw':!![],'where':{}},_0x46f2f2={},_0x10474c;return db[_0x75bb('0x33')][_0x75bb('0x5a')]({'where':{'id':_0x83e44d[_0x75bb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58c3a7,null))[_0x75bb('0x28')](function(_0x4307e1){if(_0x4307e1){_0x10474c=_0x4307e1[_0x75bb('0x29')]({'plain':!![]});_0x46f2f2[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x5b')][_0x75bb('0x34')]);_0x46f2f2[_0x75bb('0x37')]=_['keys'](_0x83e44d['query']);_0x46f2f2[_0x75bb('0x39')]=_['intersection'](_0x46f2f2[_0x75bb('0x3b')],_0x46f2f2[_0x75bb('0x37')]);_0xb487b3['attributes']=_[_0x75bb('0x3a')](_0x46f2f2[_0x75bb('0x3b')],qs['fields'](_0x83e44d[_0x75bb('0x37')][_0x75bb('0x3c')]));_0xb487b3[_0x75bb('0x3d')]=_0xb487b3['attributes'][_0x75bb('0x3e')]?_0xb487b3[_0x75bb('0x3d')]:_0x46f2f2['model'];if(!_0x83e44d[_0x75bb('0x37')][_0x75bb('0x3f')](_0x75bb('0x40'))){_0xb487b3['limit']=qs[_0x75bb('0x22')](_0x83e44d[_0x75bb('0x37')][_0x75bb('0x22')]);_0xb487b3[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x83e44d['query']['offset']);}_0xb487b3[_0x75bb('0x41')]=qs[_0x75bb('0x42')](_0x83e44d['query'][_0x75bb('0x42')]);_0xb487b3[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_[_0x75bb('0x43')](_0x83e44d['query'],_0x46f2f2[_0x75bb('0x39')]));_0xb487b3[_0x75bb('0x44')][_0x75bb('0x5c')]=_0x4307e1['id'];if(_0x83e44d[_0x75bb('0x37')][_0x75bb('0x47')]){_0xb487b3['where']=_['merge'](_0xb487b3[_0x75bb('0x44')],{'$or':_[_0x75bb('0x32')](_0xb487b3[_0x75bb('0x3d')],function(_0x218bb0){var _0x4c374d={};_0x4c374d[_0x218bb0]={'$like':'%'+_0x83e44d[_0x75bb('0x37')][_0x75bb('0x47')]+'%'};return _0x4c374d;})});}_0xb487b3=_['merge']({},_0xb487b3,_0x83e44d['options']);return db[_0x75bb('0x5b')][_0x75bb('0x4a')](_0xb487b3);}})[_0x75bb('0x28')](function(_0x158c65){if(_0x158c65){return db['User'][_0x75bb('0x5d')]({'where':{'id':_['map'](_0x158c65,'UserId'),'role':'agent'},'attributes':['id',_0x75bb('0x2f'),_0x75bb('0x5e'),'updatedAt',_0x75bb('0x5f')]});}})[_0x75bb('0x28')](function(_0x4ea9d8){if(_0x4ea9d8){return{'count':_0x4ea9d8['count'],'rows':_[_0x75bb('0x32')](_0x4ea9d8['rows'],function(_0x43b5fa){return{'membername':_0x43b5fa[_0x75bb('0x2f')],'UserId':_0x43b5fa['id'],'queue_name':_0x10474c[_0x75bb('0x2f')],'WhatsappQueueId':_0x10474c['id'],'interface':util['format'](_0x75bb('0x60'),_0x75bb('0x61'),_0x43b5fa[_0x75bb('0x2f')]),'penalty':0x0,'paused':_0x43b5fa['whatsappPause'],'createdAt':_0x43b5fa[_0x75bb('0x5f')],'updatedAt':_0x43b5fa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x75bb('0x28')](respondWithFilteredResult(_0x58c3a7,_0xb487b3))[_0x75bb('0x4c')](handleError(_0x58c3a7,null));};exports[_0x75bb('0x62')]=function(_0x5a8a25,_0x5f7d8d,_0x1e11f7){var _0x55419c={};var _0x3b4f71={};var _0xc8e918;var _0x1a738e;return db['WhatsappQueue'][_0x75bb('0x5a')]({'where':{'id':_0x5a8a25[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x5f7d8d,null))['then'](function(_0x453536){if(_0x453536){_0xc8e918=_0x453536;_0x3b4f71['model']=_[_0x75bb('0x38')](db[_0x75bb('0x63')][_0x75bb('0x34')]);_0x3b4f71[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x5a8a25[_0x75bb('0x37')]);_0x3b4f71[_0x75bb('0x39')]=_['intersection'](_0x3b4f71[_0x75bb('0x3b')],_0x3b4f71[_0x75bb('0x37')]);_0x55419c['attributes']=_[_0x75bb('0x3a')](_0x3b4f71[_0x75bb('0x3b')],qs['fields'](_0x5a8a25['query'][_0x75bb('0x3c')]));_0x55419c[_0x75bb('0x3d')]=_0x55419c[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x55419c[_0x75bb('0x3d')]:_0x3b4f71[_0x75bb('0x3b')];_0x55419c['order']=qs[_0x75bb('0x42')](_0x5a8a25[_0x75bb('0x37')][_0x75bb('0x42')]);_0x55419c[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_['pick'](_0x5a8a25['query'],_0x3b4f71[_0x75bb('0x39')]));if(_0x5a8a25[_0x75bb('0x37')]['filter']){_0x55419c['where']=_['merge'](_0x55419c[_0x75bb('0x44')],{'$or':_[_0x75bb('0x32')](_0x55419c[_0x75bb('0x3d')],function(_0x357f29){var _0x4de248={};_0x4de248[_0x357f29]={'$like':'%'+_0x5a8a25['query'][_0x75bb('0x47')]+'%'};return _0x4de248;})});}_0x55419c=_[_0x75bb('0x45')]({},_0x55419c,_0x5a8a25[_0x75bb('0x4f')]);return _0xc8e918[_0x75bb('0x62')](_0x55419c);}})[_0x75bb('0x28')](function(_0x52b51d){if(_0x52b51d){_0x1a738e=_0x52b51d[_0x75bb('0x3e')];if(!_0x5a8a25['query'][_0x75bb('0x3f')](_0x75bb('0x40'))){_0x55419c[_0x75bb('0x22')]=qs[_0x75bb('0x22')](_0x5a8a25[_0x75bb('0x37')][_0x75bb('0x22')]);_0x55419c[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x5a8a25['query']['offset']);}return _0xc8e918[_0x75bb('0x62')](_0x55419c);}})[_0x75bb('0x28')](function(_0x18e784){if(_0x18e784){return _0x18e784?{'count':_0x1a738e,'rows':_0x18e784}:null;}})['then'](respondWithResult(_0x5f7d8d,null))[_0x75bb('0x4c')](handleError(_0x5f7d8d,null));};exports[_0x75bb('0x64')]=function(_0x165103,_0x2a7a85,_0x4a9a5f){var _0x44b98b=_0x165103['body'][_0x75bb('0x65')];return db['Team'][_0x75bb('0x4a')]({'where':{'id':_0x44b98b},'attributes':['id'],'include':[{'model':db[_0x75bb('0x66')],'as':_0x75bb('0x67'),'attributes':['id','name',_0x75bb('0x68'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4ecda9){if(_0x4ecda9){var _0xb9ad80=_[_0x75bb('0x69')](_0x4ecda9,function(_0x438992){var _0x5ebcc2=_0x438992[_0x75bb('0x29')]({'plain':!![]});return _0x5ebcc2[_0x75bb('0x67')];});return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x165103[_0x75bb('0x4e')]['id']}})['then'](function(_0x1e5f3b){return db[_0x75bb('0x6a')]['transaction'](function(_0xf4f16d){return _0x1e5f3b[_0x75bb('0x64')](_0x44b98b,{'transaction':_0xf4f16d})[_0x75bb('0x28')](function(){return BPromise['each'](_0xb9ad80,function(_0x438a82){return db[_0x75bb('0x5b')][_0x75bb('0x6b')]({'where':{'UserId':_0x438a82['id'],'WhatsappQueueId':_0x165103['params']['id']},'transaction':_0xf4f16d});});})[_0x75bb('0x28')](function(){_0xb9ad80[_0x75bb('0x6c')](function(_0x1bb3b8){socket['emit'](_0x75bb('0x6d'),{'UserId':_0x1bb3b8['id'],'WhatsappQueueId':_0x1e5f3b['id']});});});});});}})[_0x75bb('0x28')](respondWithStatusCode(_0x2a7a85,null))[_0x75bb('0x4c')](handleError(_0x2a7a85,null));};exports[_0x75bb('0x6e')]=function(_0x3cb7cc,_0x2cb75a,_0x121a65){return db['Team']['findAll']({'where':{'id':_0x3cb7cc[_0x75bb('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x75bb('0x66')],'as':_0x75bb('0x67'),'attributes':['id'],'raw':!![]}]})[_0x75bb('0x28')](handleEntityNotFound(_0x2cb75a,null))['then'](function(_0x5180c1){var _0x441b=_[_0x75bb('0x32')](_0x5180c1,'id');var _0x3ae125=[];var _0x338d59=[];var _0x1a8403=squel[_0x75bb('0x6f')]();_0x1a8403[_0x75bb('0x70')]('tq.TeamId')[_0x75bb('0x71')](_0x75bb('0x72'),'tq')[_0x75bb('0x73')](_0x75bb('0x74'),'ut',_0x75bb('0x75'))[_0x75bb('0x44')](_0x75bb('0x76'),_0x3cb7cc[_0x75bb('0x4e')]['id']);for(var _0x40360c=0x0;_0x40360c<_0x5180c1['length'];_0x40360c+=0x1){let _0xe15041=_0x5180c1[_0x40360c];for(var _0x336c41=0x0;_0x336c41<_0xe15041[_0x75bb('0x67')][_0x75bb('0x3e')];_0x336c41+=0x1){let _0x1110ab=_0xe15041[_0x75bb('0x67')][_0x336c41];var _0x1c7cd8=_0x1a8403['clone']();_0x1c7cd8[_0x75bb('0x44')]('ut.UserId\x20=\x20?',_0x1110ab['id']);_0x338d59['push'](db[_0x75bb('0x6a')][_0x75bb('0x37')](_0x1c7cd8[_0x75bb('0x77')](),{'type':db[_0x75bb('0x6a')][_0x75bb('0x78')][_0x75bb('0x79')]})[_0x75bb('0x28')](function(_0x270ba8){if(_0x270ba8['length']===0x1){return _0x1110ab['id'];}else{var _0x27b2c9=_['every'](_[_0x75bb('0x32')](_0x270ba8,_0x75bb('0x7a')),function(_0x391468){return _[_0x75bb('0x7b')](_0x441b,_0x391468);});if(_0x27b2c9){return _0x1110ab['id'];}}}));}}return BPromise[_0x75bb('0x7c')](_0x338d59)[_0x75bb('0x28')](function(_0x596f85){_0x3ae125=_(_0x3ae125)[_0x75bb('0x7d')](_0x596f85)[_0x75bb('0x7e')]()['value']();return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x3cb7cc[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](function(_0x52279a){return db[_0x75bb('0x6a')][_0x75bb('0x7f')](function(_0x123e43){return _0x52279a[_0x75bb('0x6e')](_0x3cb7cc[_0x75bb('0x37')][_0x75bb('0x65')],{'transaction':_0x123e43})[_0x75bb('0x28')](function(){if(!_[_0x75bb('0x80')](_0x3ae125)){return _0x52279a[_0x75bb('0x81')](_0x3ae125,{'transaction':_0x123e43});}})[_0x75bb('0x28')](function(){_0x3ae125[_0x75bb('0x6c')](function(_0x43ca7d){socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':_0x43ca7d,'WhatsappQueueId':_0x52279a['id']});});});});});});})['then'](respondWithStatusCode(_0x2cb75a,null))[_0x75bb('0x4c')](handleError(_0x2cb75a,null));};exports[_0x75bb('0x84')]=function(_0x47e607,_0xbce05c,_0x5704bd){return db['WhatsappQueue']['find']({'where':{'id':_0x47e607[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0xbce05c,null))['then'](function(_0x2ce74a){if(_0x2ce74a){return _0x2ce74a[_0x75bb('0x84')](_0x47e607[_0x75bb('0x51')][_0x75bb('0x65')],_['omit'](_0x47e607[_0x75bb('0x51')],['ids','id'])||{})[_0x75bb('0x85')](function(_0x1a2cae){for(var _0x25ecdd=0x0;_0x25ecdd<_0x47e607[_0x75bb('0x51')]['ids'][_0x75bb('0x3e')];_0x25ecdd+=0x1){socket[_0x75bb('0x82')](_0x75bb('0x6d'),{'UserId':Number(_0x47e607[_0x75bb('0x51')]['ids'][_0x25ecdd]),'WhatsappQueueId':Number(_0x47e607[_0x75bb('0x4e')]['id'])});}return _0x1a2cae;});}})[_0x75bb('0x28')](respondWithResult(_0xbce05c,null))[_0x75bb('0x4c')](handleError(_0xbce05c,null));};exports[_0x75bb('0x81')]=function(_0x1ed846,_0x5dc518,_0x3e9b79){return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x1ed846[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x5dc518,null))[_0x75bb('0x28')](function(_0x15f357){if(_0x15f357){return _0x15f357['removeAgents'](_0x1ed846['query'][_0x75bb('0x65')])[_0x75bb('0x28')](function(){if(_[_0x75bb('0x86')](_0x1ed846[_0x75bb('0x37')]['ids'])){for(var _0x4887d9=0x0;_0x4887d9<_0x1ed846['query'][_0x75bb('0x65')][_0x75bb('0x3e')];_0x4887d9+=0x1){socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':Number(_0x1ed846[_0x75bb('0x37')][_0x75bb('0x65')][_0x4887d9]),'WhatsappQueueId':Number(_0x1ed846['params']['id'])});}}else{socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':Number(_0x1ed846[_0x75bb('0x37')]['ids']),'WhatsappQueueId':Number(_0x1ed846['params']['id'])});}});}})[_0x75bb('0x28')](respondWithStatusCode(_0x5dc518,null))[_0x75bb('0x4c')](handleError(_0x5dc518,null));};exports[_0x75bb('0x87')]=function(_0x18e70e,_0x76415,_0x335559){var _0x358c9a={};var _0x336fa2={};var _0x30fe6d;var _0x492bbe;return db[_0x75bb('0x33')][_0x75bb('0x5a')]({'where':{'id':_0x18e70e['params']['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x76415,null))[_0x75bb('0x28')](function(_0x51b3ed){if(_0x51b3ed){_0x30fe6d=_0x51b3ed;_0x336fa2[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x66')][_0x75bb('0x34')]);_0x336fa2['query']=_[_0x75bb('0x38')](_0x18e70e[_0x75bb('0x37')]);_0x336fa2[_0x75bb('0x39')]=_[_0x75bb('0x3a')](_0x336fa2[_0x75bb('0x3b')],_0x336fa2[_0x75bb('0x37')]);_0x358c9a[_0x75bb('0x3d')]=_[_0x75bb('0x3a')](_0x336fa2['model'],qs[_0x75bb('0x3c')](_0x18e70e[_0x75bb('0x37')]['fields']));_0x358c9a[_0x75bb('0x3d')]=_0x358c9a[_0x75bb('0x3d')]['length']?_0x358c9a[_0x75bb('0x3d')]:_0x336fa2[_0x75bb('0x3b')];_0x358c9a[_0x75bb('0x41')]=qs['sort'](_0x18e70e[_0x75bb('0x37')][_0x75bb('0x42')]);_0x358c9a[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_['pick'](_0x18e70e['query'],_0x336fa2[_0x75bb('0x39')]));if(_0x18e70e[_0x75bb('0x37')]['filter']){_0x358c9a[_0x75bb('0x44')]=_['merge'](_0x358c9a['where'],{'$or':_[_0x75bb('0x32')](_0x358c9a[_0x75bb('0x3d')],function(_0x530799){var _0x434816={};_0x434816[_0x530799]={'$like':'%'+_0x18e70e['query']['filter']+'%'};return _0x434816;})});}_0x358c9a=_[_0x75bb('0x45')]({},_0x358c9a,_0x18e70e['options']);return _0x30fe6d['getAgents'](_0x358c9a);}})['then'](function(_0x201b6f){if(_0x201b6f){_0x492bbe=_0x201b6f[_0x75bb('0x3e')];if(!_0x18e70e[_0x75bb('0x37')]['hasOwnProperty'](_0x75bb('0x40'))){_0x358c9a[_0x75bb('0x22')]=qs['limit'](_0x18e70e['query'][_0x75bb('0x22')]);_0x358c9a['offset']=qs[_0x75bb('0x20')](_0x18e70e[_0x75bb('0x37')][_0x75bb('0x20')]);}return _0x30fe6d[_0x75bb('0x87')](_0x358c9a);}})[_0x75bb('0x28')](function(_0x9b83d){if(_0x9b83d){return _0x9b83d?{'count':_0x492bbe,'rows':_0x9b83d}:null;}})[_0x75bb('0x28')](respondWithResult(_0x76415,null))[_0x75bb('0x4c')](handleError(_0x76415,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4c8fb5e..b43b31f 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 _0x4130=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4130,0x93));var _0x0413=function(_0x2fa4af,_0x2c2173){_0x2fa4af=_0x2fa4af-0x0;var _0x42a7d1=_0x4130[_0x2fa4af];return _0x42a7d1;};'use strict';var EventEmitter=require(_0x0413('0x0'));var WhatsappQueue=require(_0x0413('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0413('0x2'),'afterUpdate':_0x0413('0x3'),'afterDestroy':_0x0413('0x4')};function emitEvent(_0x21ee39){return function(_0x7715a4,_0x341c19,_0x43d770){WhatsappQueueEvents['emit'](_0x21ee39+':'+_0x7715a4['id'],_0x7715a4);WhatsappQueueEvents[_0x0413('0x5')](_0x21ee39,_0x7715a4);_0x43d770(null);};}for(var e in events){if(events[_0x0413('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xc4c6=['events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0xc4c6,0x104));var _0x6c4c=function(_0x4054b1,_0x565f95){_0x4054b1=_0x4054b1-0x0;var _0x108764=_0xc4c6[_0x4054b1];return _0x108764;};'use strict';var EventEmitter=require(_0x6c4c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6c4c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6c4c('0x2')](0x0);var events={'afterCreate':_0x6c4c('0x3'),'afterUpdate':_0x6c4c('0x4'),'afterDestroy':_0x6c4c('0x5')};function emitEvent(_0x10cad7){return function(_0x1da53d,_0x2ec29b,_0xa36d46){WhatsappQueueEvents[_0x6c4c('0x6')](_0x10cad7+':'+_0x1da53d['id'],_0x1da53d);WhatsappQueueEvents[_0x6c4c('0x6')](_0x10cad7,_0x1da53d);_0xa36d46(null);};}for(var e in events){if(events[_0x6c4c('0x7')](e)){var event=events[e];WhatsappQueue[_0x6c4c('0x8')](e,emitEvent(event));}}module[_0x6c4c('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 55744c9..2467a88 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 _0xb6d8=['exports','define','WhatsappQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x3934d1,_0xc52cbc){var _0x5ba7e2=function(_0x46bae5){while(--_0x46bae5){_0x3934d1['push'](_0x3934d1['shift']());}};_0x5ba7e2(++_0xc52cbc);}(_0xb6d8,0xd3));var _0x8b6d=function(_0x4806de,_0x3e4738){_0x4806de=_0x4806de-0x0;var _0x5eb6d9=_0xb6d8[_0x4806de];return _0x5eb6d9;};'use strict';var _=require(_0x8b6d('0x0'));var util=require(_0x8b6d('0x1'));var logger=require(_0x8b6d('0x2'))('api');var moment=require(_0x8b6d('0x3'));var BPromise=require(_0x8b6d('0x4'));var rp=require(_0x8b6d('0x5'));var fs=require('fs');var path=require(_0x8b6d('0x6'));var rimraf=require(_0x8b6d('0x7'));var config=require(_0x8b6d('0x8'));var attributes=require(_0x8b6d('0x9'));module[_0x8b6d('0xa')]=function(_0x575354,_0x4229b0){return _0x575354[_0x8b6d('0xb')](_0x8b6d('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4714=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api'];(function(_0x11a890,_0x59b390){var _0x220a4c=function(_0x2ada9e){while(--_0x2ada9e){_0x11a890['push'](_0x11a890['shift']());}};_0x220a4c(++_0x59b390);}(_0x4714,0xe7));var _0x4471=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4714[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4471('0x0'));var util=require(_0x4471('0x1'));var logger=require('../../config/logger')(_0x4471('0x2'));var moment=require(_0x4471('0x3'));var BPromise=require(_0x4471('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4471('0x5'));var rimraf=require(_0x4471('0x6'));var config=require(_0x4471('0x7'));var attributes=require(_0x4471('0x8'));module[_0x4471('0x9')]=function(_0x2e2fcd,_0x5c550a){return _0x2e2fcd[_0x4471('0xa')](_0x4471('0xb'),attributes,{'tableName':_0x4471('0xc'),'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 47a69a7..ab86d70 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 _0xe97f=['message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','include','map','model','then','catch','find','raw','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s'];(function(_0x334d1f,_0x2652ae){var _0x32958b=function(_0x5631cb){while(--_0x5631cb){_0x334d1f['push'](_0x334d1f['shift']());}};_0x32958b(++_0x2652ae);}(_0xe97f,0x11b));var _0xfe97=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe97f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xfe97('0x0'));var util=require(_0xfe97('0x1'));var moment=require('moment');var BPromise=require(_0xfe97('0x2'));var rs=require(_0xfe97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe97('0x4'))('rpc');var config=require(_0xfe97('0x5'));var jayson=require(_0xfe97('0x6'));var client=jayson[_0xfe97('0x7')]['http']({'port':0x232a});config[_0xfe97('0x8')]=_[_0xfe97('0x9')](config[_0xfe97('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe97('0xa'))(new Redis(config[_0xfe97('0x8')]));require(_0xfe97('0xb'))[_0xfe97('0xc')](socket);function respondWithRpcPromise(_0x2d80bd,_0x56f2ab,_0x49a4d6){return new BPromise(function(_0x1e83dd,_0x4d6d91){return client[_0xfe97('0xd')](_0x2d80bd,_0x49a4d6)['then'](function(_0x180928){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x56f2ab,_0xfe97('0xe'));logger[_0xfe97('0xf')](_0xfe97('0x10'),_0x56f2ab,_0xfe97('0xe'),JSON[_0xfe97('0x11')](_0x180928));if(_0x180928[_0xfe97('0x12')]){if(_0x180928[_0xfe97('0x12')][_0xfe97('0x13')]===0x1f4){logger['error'](_0xfe97('0x14'),_0x56f2ab,_0x180928['error'][_0xfe97('0x15')]);return _0x4d6d91(_0x180928[_0xfe97('0x12')][_0xfe97('0x15')]);}logger[_0xfe97('0x12')](_0xfe97('0x14'),_0x56f2ab,_0x180928[_0xfe97('0x12')]['message']);return _0x1e83dd(_0x180928[_0xfe97('0x12')][_0xfe97('0x15')]);}else{logger[_0xfe97('0x16')](_0xfe97('0x14'),_0x56f2ab,_0xfe97('0xe'));_0x1e83dd(_0x180928[_0xfe97('0x17')][_0xfe97('0x15')]);}})['catch'](function(_0x473d7f){logger[_0xfe97('0x12')](_0xfe97('0x14'),_0x56f2ab,_0x473d7f);_0x4d6d91(_0x473d7f);});});}exports[_0xfe97('0x18')]=function(_0x59783f){var _0x5af2d7=this;return new Promise(function(_0x13871b,_0x9c70eb){return db[_0xfe97('0x19')][_0xfe97('0x1a')]({'raw':_0x59783f[_0xfe97('0x1b')]?_0x59783f[_0xfe97('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59783f[_0xfe97('0x1b')]?_0x59783f['options'][_0xfe97('0x1c')]||null:null,'attributes':_0x59783f[_0xfe97('0x1b')]?_0x59783f[_0xfe97('0x1b')][_0xfe97('0x1d')]||null:null,'limit':_0x59783f[_0xfe97('0x1b')]?_0x59783f['options']['limit']||null:null,'include':_0x59783f['options']?_0x59783f['options'][_0xfe97('0x1e')]?_[_0xfe97('0x1f')](_0x59783f['options'][_0xfe97('0x1e')],function(_0x10c53e){return{'model':db[_0x10c53e[_0xfe97('0x20')]],'as':_0x10c53e['as'],'attributes':_0x10c53e['attributes'],'include':_0x10c53e['include']?_[_0xfe97('0x1f')](_0x10c53e[_0xfe97('0x1e')],function(_0x1ae7f3){return{'model':db[_0x1ae7f3['model']],'as':_0x1ae7f3['as'],'attributes':_0x1ae7f3[_0xfe97('0x1d')],'include':_0x1ae7f3[_0xfe97('0x1e')]?_['map'](_0x1ae7f3['include'],function(_0xd4d141){return{'model':db[_0xd4d141['model']],'as':_0xd4d141['as'],'attributes':_0xd4d141[_0xfe97('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfe97('0x21')](function(_0x39e79d){logger['info']('GetWhatsappQueue',_0x59783f);logger[_0xfe97('0xf')](_0xfe97('0x18'),_0x59783f,JSON[_0xfe97('0x11')](_0x39e79d));_0x13871b(_0x39e79d);})[_0xfe97('0x22')](function(_0x2faa72){logger[_0xfe97('0x12')](_0xfe97('0x18'),_0x2faa72[_0xfe97('0x15')],_0x59783f);_0x9c70eb(_0x5af2d7['error'](0x1f4,_0x2faa72[_0xfe97('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x274afc){var _0x35ad41=this;return new Promise(function(_0x1db61b,_0x50f79f){return db[_0xfe97('0x19')][_0xfe97('0x23')]({'raw':_0x274afc[_0xfe97('0x1b')]?_0x274afc[_0xfe97('0x1b')][_0xfe97('0x24')]===undefined?!![]:![]:!![],'where':_0x274afc[_0xfe97('0x1b')]?_0x274afc[_0xfe97('0x1b')][_0xfe97('0x1c')]||null:null,'attributes':_0x274afc[_0xfe97('0x1b')]?_0x274afc[_0xfe97('0x1b')][_0xfe97('0x1d')]||null:null,'include':_0x274afc[_0xfe97('0x1b')]?_0x274afc[_0xfe97('0x1b')][_0xfe97('0x1e')]?_[_0xfe97('0x1f')](_0x274afc['options']['include'],function(_0x6d9350){return{'model':db[_0x6d9350['model']],'as':_0x6d9350['as'],'attributes':_0x6d9350[_0xfe97('0x1d')],'include':_0x6d9350[_0xfe97('0x1e')]?_[_0xfe97('0x1f')](_0x6d9350[_0xfe97('0x1e')],function(_0x10873a){return{'model':db[_0x10873a[_0xfe97('0x20')]],'as':_0x10873a['as'],'attributes':_0x10873a[_0xfe97('0x1d')],'include':_0x10873a[_0xfe97('0x1e')]?_['map'](_0x10873a['include'],function(_0x52009b){return{'model':db[_0x52009b[_0xfe97('0x20')]],'as':_0x52009b['as'],'attributes':_0x52009b[_0xfe97('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfe97('0x21')](function(_0x51554c){logger[_0xfe97('0x16')](_0xfe97('0x25'),_0x274afc);logger[_0xfe97('0xf')](_0xfe97('0x25'),_0x274afc,JSON[_0xfe97('0x11')](_0x51554c));_0x1db61b(_0x51554c);})[_0xfe97('0x22')](function(_0x524477){logger['error'](_0xfe97('0x25'),_0x524477[_0xfe97('0x15')],_0x274afc);_0x50f79f(_0x35ad41[_0xfe97('0x12')](0x1f4,_0x524477[_0xfe97('0x15')]));});});}; \ No newline at end of file +var _0xb4ab=['attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','where'];(function(_0x430352,_0x55b64a){var _0x2e6cca=function(_0x24ffeb){while(--_0x24ffeb){_0x430352['push'](_0x430352['shift']());}};_0x2e6cca(++_0x55b64a);}(_0xb4ab,0x11b));var _0xbb4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4ab[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbb4a('0x0'));var moment=require(_0xbb4a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb4a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb4a('0x3'))['db'];var utils=require(_0xbb4a('0x4'));var logger=require(_0xbb4a('0x5'))(_0xbb4a('0x6'));var config=require('../../config/environment');var jayson=require(_0xbb4a('0x7'));var client=jayson['client'][_0xbb4a('0x8')]({'port':0x232a});config[_0xbb4a('0x9')]=_['defaults'](config[_0xbb4a('0x9')],{'host':_0xbb4a('0xa'),'port':0x18eb});var socket=require(_0xbb4a('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xbb4a('0xc')](socket);function respondWithRpcPromise(_0x172499,_0x396b13,_0x496a7a){return new BPromise(function(_0x1bcaec,_0x252976){return client[_0xbb4a('0xd')](_0x172499,_0x496a7a)[_0xbb4a('0xe')](function(_0x144475){logger[_0xbb4a('0xf')](_0xbb4a('0x10'),_0x396b13,_0xbb4a('0x11'));logger[_0xbb4a('0x12')](_0xbb4a('0x13'),_0x396b13,_0xbb4a('0x11'),JSON['stringify'](_0x144475));if(_0x144475[_0xbb4a('0x14')]){if(_0x144475[_0xbb4a('0x14')][_0xbb4a('0x15')]===0x1f4){logger[_0xbb4a('0x14')](_0xbb4a('0x10'),_0x396b13,_0x144475[_0xbb4a('0x14')]['message']);return _0x252976(_0x144475[_0xbb4a('0x14')]['message']);}logger['error'](_0xbb4a('0x10'),_0x396b13,_0x144475[_0xbb4a('0x14')][_0xbb4a('0x16')]);return _0x1bcaec(_0x144475['error']['message']);}else{logger[_0xbb4a('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x396b13,_0xbb4a('0x11'));_0x1bcaec(_0x144475[_0xbb4a('0x17')][_0xbb4a('0x16')]);}})[_0xbb4a('0x18')](function(_0x5309ff){logger[_0xbb4a('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x396b13,_0x5309ff);_0x252976(_0x5309ff);});});}exports['GetWhatsappQueue']=function(_0x5173c9){var _0x4cb723=this;return new Promise(function(_0x3f4751,_0x25c527){return db[_0xbb4a('0x19')][_0xbb4a('0x1a')]({'raw':_0x5173c9['options']?_0x5173c9[_0xbb4a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1c')]||null:null,'attributes':_0x5173c9['options']?_0x5173c9['options'][_0xbb4a('0x1d')]||null:null,'limit':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1e')]||null:null,'include':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9['options'][_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1f')],function(_0x246628){return{'model':db[_0x246628[_0xbb4a('0x21')]],'as':_0x246628['as'],'attributes':_0x246628[_0xbb4a('0x1d')],'include':_0x246628[_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x246628[_0xbb4a('0x1f')],function(_0x5e7afb){return{'model':db[_0x5e7afb[_0xbb4a('0x21')]],'as':_0x5e7afb['as'],'attributes':_0x5e7afb['attributes'],'include':_0x5e7afb[_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x5e7afb[_0xbb4a('0x1f')],function(_0x2ed205){return{'model':db[_0x2ed205[_0xbb4a('0x21')]],'as':_0x2ed205['as'],'attributes':_0x2ed205[_0xbb4a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c34df){logger[_0xbb4a('0xf')](_0xbb4a('0x22'),_0x5173c9);logger[_0xbb4a('0x12')](_0xbb4a('0x22'),_0x5173c9,JSON[_0xbb4a('0x23')](_0x1c34df));_0x3f4751(_0x1c34df);})[_0xbb4a('0x18')](function(_0x310fe4){logger[_0xbb4a('0x14')]('GetWhatsappQueue',_0x310fe4[_0xbb4a('0x16')],_0x5173c9);_0x25c527(_0x4cb723[_0xbb4a('0x14')](0x1f4,_0x310fe4[_0xbb4a('0x16')]));});});};exports[_0xbb4a('0x24')]=function(_0x3e4a2c){var _0x3f06bf=this;return new Promise(function(_0x16eb25,_0xa01ac0){return db[_0xbb4a('0x19')][_0xbb4a('0x25')]({'raw':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x26')]===undefined?!![]:![]:!![],'where':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x1c')]||null:null,'attributes':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c['options'][_0xbb4a('0x1d')]||null:null,'include':_0x3e4a2c['options']?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x3e4a2c[_0xbb4a('0x1b')]['include'],function(_0x56162d){return{'model':db[_0x56162d[_0xbb4a('0x21')]],'as':_0x56162d['as'],'attributes':_0x56162d[_0xbb4a('0x1d')],'include':_0x56162d[_0xbb4a('0x1f')]?_['map'](_0x56162d[_0xbb4a('0x1f')],function(_0x55285b){return{'model':db[_0x55285b[_0xbb4a('0x21')]],'as':_0x55285b['as'],'attributes':_0x55285b[_0xbb4a('0x1d')],'include':_0x55285b[_0xbb4a('0x1f')]?_['map'](_0x55285b[_0xbb4a('0x1f')],function(_0x18c7da){return{'model':db[_0x18c7da[_0xbb4a('0x21')]],'as':_0x18c7da['as'],'attributes':_0x18c7da[_0xbb4a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb4a('0xe')](function(_0x4cf9d3){logger['info']('ShowWhatsappQueue',_0x3e4a2c);logger[_0xbb4a('0x12')](_0xbb4a('0x24'),_0x3e4a2c,JSON['stringify'](_0x4cf9d3));_0x16eb25(_0x4cf9d3);})[_0xbb4a('0x18')](function(_0x1dc714){logger[_0xbb4a('0x14')](_0xbb4a('0x24'),_0x1dc714[_0xbb4a('0x16')],_0x3e4a2c);_0xa01ac0(_0x3f06bf['error'](0x1f4,_0x1dc714[_0xbb4a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 285803b..a633e0e 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 _0x74b1=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','register','length'];(function(_0x467cb1,_0x228c77){var _0x40f945=function(_0x433caf){while(--_0x433caf){_0x467cb1['push'](_0x467cb1['shift']());}};_0x40f945(++_0x228c77);}(_0x74b1,0x79));var _0x174b=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x74b1[_0x2ab76b];return _0x201126;};'use strict';var WhatsappQueueEvents=require(_0x174b('0x0'));var events=[_0x174b('0x1'),_0x174b('0x2'),_0x174b('0x3')];function createListener(_0x57fa02,_0x11efaf){return function(_0x195dea){_0x11efaf[_0x174b('0x4')](_0x57fa02,_0x195dea);};}function removeListener(_0x416ff2,_0x157a1c){return function(){WhatsappQueueEvents['removeListener'](_0x416ff2,_0x157a1c);};}exports[_0x174b('0x5')]=function(_0x335afd){for(var _0x524687=0x0,_0x3e5ac3=events[_0x174b('0x6')];_0x524687<_0x3e5ac3;_0x524687++){var _0x1dcb91=events[_0x524687];var _0x46dabf=createListener(_0x174b('0x7')+_0x1dcb91,_0x335afd);WhatsappQueueEvents['on'](_0x1dcb91,_0x46dabf);}}; \ No newline at end of file +var _0x8ad5=['register','length','whatsappQueue:','save','remove','emit','removeListener'];(function(_0x21b2b7,_0x1159a6){var _0xba015c=function(_0x1870c5){while(--_0x1870c5){_0x21b2b7['push'](_0x21b2b7['shift']());}};_0xba015c(++_0x1159a6);}(_0x8ad5,0x1d1));var _0x58ad=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8ad5[_0x1ac595];return _0x455fff;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x58ad('0x0'),_0x58ad('0x1'),'update'];function createListener(_0x48ca52,_0x537662){return function(_0x4d71ea){_0x537662[_0x58ad('0x2')](_0x48ca52,_0x4d71ea);};}function removeListener(_0x1d94fd,_0x2f7aec){return function(){WhatsappQueueEvents[_0x58ad('0x3')](_0x1d94fd,_0x2f7aec);};}exports[_0x58ad('0x4')]=function(_0x1a389e){for(var _0x4ff25d=0x0,_0x481a4e=events[_0x58ad('0x5')];_0x4ff25d<_0x481a4e;_0x4ff25d++){var _0x305466=events[_0x4ff25d];var _0x1073b3=createListener(_0x58ad('0x6')+_0x305466,_0x1a389e);WhatsappQueueEvents['on'](_0x305466,_0x1073b3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9b0b2f7..499ffbd 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 _0x6644=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x6eefbb,_0xa09da){var _0x55339a=function(_0x2a40b1){while(--_0x2a40b1){_0x6eefbb['push'](_0x6eefbb['shift']());}};_0x55339a(++_0xa09da);}(_0x6644,0x10b));var _0x4664=function(_0x2dedb9,_0x59b3e2){_0x2dedb9=_0x2dedb9-0x0;var _0x3d2c51=_0x6644[_0x2dedb9];return _0x3d2c51;};'use strict';var multer=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var path=require('path');var timeout=require(_0x4664('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4664('0x3'));var auth=require(_0x4664('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4664('0x5'));var controller=require(_0x4664('0x6'));router[_0x4664('0x7')]('/',auth[_0x4664('0x8')](),controller['index']);router[_0x4664('0x7')](_0x4664('0x9'),auth['isAuthenticated'](),controller[_0x4664('0xa')]);router[_0x4664('0x7')](_0x4664('0xb'),auth[_0x4664('0x8')](),controller[_0x4664('0xc')]);router[_0x4664('0xd')]('/',auth[_0x4664('0x8')](),controller[_0x4664('0xe')]);router[_0x4664('0xf')](_0x4664('0xb'),auth[_0x4664('0x8')](),controller['update']);router[_0x4664('0x10')]('/:id',auth[_0x4664('0x8')](),controller[_0x4664('0x11')]);module[_0x4664('0x12')]=router; \ No newline at end of file +var _0xda2a=['post','create','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x55922f,_0x5b79f4){var _0x530f8a=function(_0x3476fd){while(--_0x3476fd){_0x55922f['push'](_0x55922f['shift']());}};_0x530f8a(++_0x5b79f4);}(_0xda2a,0xb9));var _0xada2=function(_0x321bd2,_0x2b9488){_0x321bd2=_0x321bd2-0x0;var _0x480262=_0xda2a[_0x321bd2];return _0x480262;};'use strict';var multer=require(_0xada2('0x0'));var util=require('util');var path=require(_0xada2('0x1'));var timeout=require(_0xada2('0x2'));var express=require(_0xada2('0x3'));var router=express[_0xada2('0x4')]();var fs_extra=require(_0xada2('0x5'));var auth=require(_0xada2('0x6'));var interaction=require(_0xada2('0x7'));var config=require(_0xada2('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xada2('0x9')]('/',auth[_0xada2('0xa')](),controller[_0xada2('0xb')]);router[_0xada2('0x9')](_0xada2('0xc'),auth[_0xada2('0xa')](),controller[_0xada2('0xd')]);router[_0xada2('0x9')]('/:id',auth[_0xada2('0xa')](),controller[_0xada2('0xe')]);router[_0xada2('0xf')]('/',auth[_0xada2('0xa')](),controller[_0xada2('0x10')]);router['put']('/:id',auth[_0xada2('0xa')](),controller['update']);router[_0xada2('0x11')](_0xada2('0x12'),auth[_0xada2('0xa')](),controller['destroy']);module[_0xada2('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 723302a..b32cc19 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x5b7d78,_0x11354c){var _0x361e54=function(_0x2f6cbd){while(--_0x2f6cbd){_0x5b7d78['push'](_0x5b7d78['shift']());}};_0x361e54(++_0x11354c);}(_0x7a54,0x106));var _0x47a5=function(_0x5cd56d,_0x108fc6){_0x5cd56d=_0x5cd56d-0x0;var _0x51ef33=_0x7a54[_0x5cd56d];return _0x51ef33;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4c05ee,_0x13f5a6){var _0x219c53=function(_0x69ff35){while(--_0x69ff35){_0x4c05ee['push'](_0x4c05ee['shift']());}};_0x219c53(++_0x13f5a6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 f529206..15b6ca8 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 _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0xb731bd,_0x9cefdf){var _0x3a7eb0=function(_0xefe1bc){while(--_0xefe1bc){_0xb731bd['push'](_0xb731bd['shift']());}};_0x3a7eb0(++_0x9cefdf);}(_0xda3f,0xec));var _0xfda3=function(_0x1e6b07,_0x51e01b){_0x1e6b07=_0x1e6b07-0x0;var _0x4282c8=_0xda3f[_0x1e6b07];return _0x4282c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file +var _0x7072=['moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','attributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x3f6976,_0x171add){return function(_0x2ad386){if(!_0x2ad386){_0x3f6976[_0x2707('0x1a')](0x194);}return _0x2ad386;};}function handleError(_0x528b20,_0x2dce16){_0x2dce16=_0x2dce16||0x1f4;return function(_0x4ca05d){logger[_0x2707('0x2a')](_0x4ca05d[_0x2707('0x2b')]);if(_0x4ca05d[_0x2707('0x2c')]){delete _0x4ca05d['name'];}_0x528b20[_0x2707('0x1c')](_0x2dce16)[_0x2707('0x2d')](_0x4ca05d);};}exports[_0x2707('0x2e')]=function(_0x529be8,_0x31e990){var _0x42adf8={},_0x4a99ce={},_0xd63d3f={'count':0x0,'rows':[]};var _0x497c92=_['map'](db[_0x2707('0x2f')]['rawAttributes'],function(_0x2a0d24){return{'name':_0x2a0d24[_0x2707('0x30')],'type':_0x2a0d24[_0x2707('0x31')][_0x2707('0x32')]};});_0x4a99ce['model']=_[_0x2707('0x33')](_0x497c92,_0x2707('0x2c'));_0x4a99ce[_0x2707('0x34')]=_[_0x2707('0x35')](_0x529be8[_0x2707('0x34')]);_0x4a99ce[_0x2707('0x36')]=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],_0x4a99ce[_0x2707('0x34')]);_0x42adf8['attributes']=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],qs['fields'](_0x529be8['query']['fields']));_0x42adf8['attributes']=_0x42adf8['attributes'][_0x2707('0x39')]?_0x42adf8['attributes']:_0x4a99ce['model'];if(!_0x529be8[_0x2707('0x34')][_0x2707('0x3a')]('nolimit')){_0x42adf8[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x529be8['query']['limit']);_0x42adf8[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x529be8['query']['offset']);}_0x42adf8[_0x2707('0x3b')]=qs[_0x2707('0x3c')](_0x529be8['query'][_0x2707('0x3c')]);_0x42adf8[_0x2707('0x3d')]=qs[_0x2707('0x36')](_[_0x2707('0x3e')](_0x529be8[_0x2707('0x34')],_0x4a99ce[_0x2707('0x36')]),_0x497c92);if(_0x529be8['query'][_0x2707('0x3f')]){_0x42adf8[_0x2707('0x3d')]=_[_0x2707('0x40')](_0x42adf8[_0x2707('0x3d')],{'$or':_[_0x2707('0x33')](_0x497c92,function(_0x1b9d71){if(_0x1b9d71[_0x2707('0x31')]!=='VIRTUAL'){var _0x3f85a0={};_0x3f85a0[_0x1b9d71[_0x2707('0x2c')]]={'$like':'%'+_0x529be8[_0x2707('0x34')][_0x2707('0x3f')]+'%'};return _0x3f85a0;}})});}_0x42adf8=_[_0x2707('0x40')]({},_0x42adf8,_0x529be8[_0x2707('0x41')]);var _0x3ed513={'where':_0x42adf8[_0x2707('0x3d')]};return db[_0x2707('0x2f')][_0x2707('0x20')](_0x3ed513)[_0x2707('0x29')](function(_0x3368cd){_0xd63d3f[_0x2707('0x20')]=_0x3368cd;if(_0x529be8[_0x2707('0x34')][_0x2707('0x42')]){_0x42adf8[_0x2707('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x2707('0x44')](_0x42adf8);})[_0x2707('0x29')](function(_0x5053ba){_0xd63d3f[_0x2707('0x45')]=_0x5053ba;return _0xd63d3f;})['then'](respondWithFilteredResult(_0x31e990,_0x42adf8))[_0x2707('0x46')](handleError(_0x31e990,null));};exports[_0x2707('0x47')]=function(_0x3a91da,_0x1d69d3){var _0x13e1c0={'raw':!![],'where':{'id':_0x3a91da[_0x2707('0x48')]['id']}},_0xdeec24={};_0xdeec24['model']=_[_0x2707('0x35')](db[_0x2707('0x2f')]['rawAttributes']);_0xdeec24[_0x2707('0x34')]=_[_0x2707('0x35')](_0x3a91da[_0x2707('0x34')]);_0xdeec24['filters']=_['intersection'](_0xdeec24[_0x2707('0x38')],_0xdeec24[_0x2707('0x34')]);_0x13e1c0['attributes']=_[_0x2707('0x37')](_0xdeec24['model'],qs[_0x2707('0x49')](_0x3a91da[_0x2707('0x34')][_0x2707('0x49')]));_0x13e1c0[_0x2707('0x4a')]=_0x13e1c0['attributes'][_0x2707('0x39')]?_0x13e1c0[_0x2707('0x4a')]:_0xdeec24[_0x2707('0x38')];if(_0x3a91da[_0x2707('0x34')][_0x2707('0x42')]){_0x13e1c0[_0x2707('0x43')]=[{'all':!![]}];}_0x13e1c0=_[_0x2707('0x40')]({},_0x13e1c0,_0x3a91da['options']);return db[_0x2707('0x2f')][_0x2707('0x4b')](_0x13e1c0)[_0x2707('0x29')](handleEntityNotFound(_0x1d69d3,null))[_0x2707('0x29')](respondWithResult(_0x1d69d3,null))[_0x2707('0x46')](handleError(_0x1d69d3,null));};exports['create']=function(_0x35917d,_0x4a6eea){return db[_0x2707('0x2f')][_0x2707('0x4c')](_0x35917d['body'],{})[_0x2707('0x29')](respondWithResult(_0x4a6eea,0xc9))[_0x2707('0x46')](handleError(_0x4a6eea,null));};exports[_0x2707('0x27')]=function(_0x4ae196,_0x1a8034){if(_0x4ae196['body']['id']){delete _0x4ae196[_0x2707('0x4d')]['id'];}return db[_0x2707('0x2f')]['find']({'where':{'id':_0x4ae196[_0x2707('0x48')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x1a8034,null))[_0x2707('0x29')](saveUpdates(_0x4ae196['body'],null))['then'](respondWithResult(_0x1a8034,null))[_0x2707('0x46')](handleError(_0x1a8034,null));};exports[_0x2707('0x28')]=function(_0x292b44,_0x2515dc){return db[_0x2707('0x2f')]['find']({'where':{'id':_0x292b44['params']['id']}})['then'](handleEntityNotFound(_0x2515dc,null))[_0x2707('0x29')](removeEntity(_0x2515dc,null))[_0x2707('0x46')](handleError(_0x2515dc,null));};exports[_0x2707('0x4e')]=function(_0x1dcf74,_0x1ffcce){return db['WhatsappQueueReport'][_0x2707('0x4e')]()[_0x2707('0x29')](respondWithResult(_0x1ffcce,null))['catch'](handleError(_0x1ffcce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 64d3d6e..abe8ad9 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 _0xf4ba=['./whatsappQueueReport.attributes','exports','WhatsappQueueReport','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x336ae9,_0x4ca622){var _0x26df72=function(_0x44a14c){while(--_0x44a14c){_0x336ae9['push'](_0x336ae9['shift']());}};_0x26df72(++_0x4ca622);}(_0xf4ba,0xf5));var _0xaf4b=function(_0xd8a596,_0x188911){_0xd8a596=_0xd8a596-0x0;var _0x41dd24=_0xf4ba[_0xd8a596];return _0x41dd24;};'use strict';var _=require(_0xaf4b('0x0'));var util=require(_0xaf4b('0x1'));var logger=require('../../config/logger')(_0xaf4b('0x2'));var moment=require('moment');var BPromise=require(_0xaf4b('0x3'));var rp=require(_0xaf4b('0x4'));var fs=require('fs');var path=require(_0xaf4b('0x5'));var rimraf=require(_0xaf4b('0x6'));var config=require(_0xaf4b('0x7'));var attributes=require(_0xaf4b('0x8'));module[_0xaf4b('0x9')]=function(_0x1d0794,_0x426b9b){return _0x1d0794['define'](_0xaf4b('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe720=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue'];(function(_0x5adfbf,_0x35a827){var _0x5ab7ba=function(_0xe32168){while(--_0xe32168){_0x5adfbf['push'](_0x5adfbf['shift']());}};_0x5ab7ba(++_0x35a827);}(_0xe720,0x1ec));var _0x0e72=function(_0x35d3c5,_0x3e2ba0){_0x35d3c5=_0x35d3c5-0x0;var _0x17b4a2=_0xe720[_0x35d3c5];return _0x17b4a2;};'use strict';var _=require(_0x0e72('0x0'));var util=require('util');var logger=require(_0x0e72('0x1'))(_0x0e72('0x2'));var moment=require(_0x0e72('0x3'));var BPromise=require(_0x0e72('0x4'));var rp=require(_0x0e72('0x5'));var fs=require('fs');var path=require(_0x0e72('0x6'));var rimraf=require(_0x0e72('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e72('0x8'));module[_0x0e72('0x9')]=function(_0x5038e6,_0x296004){return _0x5038e6[_0x0e72('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x0e72('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 2bf85b8..f1dfa96 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 _0xae4a=['catch','CreateWhatsappQueueReport','options','raw','then','UpdateWhatsappQueueReport','WhatsappQueueReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x1ca93c,_0x3271ab){var _0x185169=function(_0x507763){while(--_0x507763){_0x1ca93c['push'](_0x1ca93c['shift']());}};_0x185169(++_0x3271ab);}(_0xae4a,0x181));var _0xaae4=function(_0xc5477f,_0x1aa5b7){_0xc5477f=_0xc5477f-0x0;var _0x1cbcef=_0xae4a[_0xc5477f];return _0x1cbcef;};'use strict';var _=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var moment=require(_0xaae4('0x2'));var BPromise=require(_0xaae4('0x3'));var rs=require(_0xaae4('0x4'));var fs=require('fs');var Redis=require(_0xaae4('0x5'));var db=require(_0xaae4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaae4('0x7'))('rpc');var config=require(_0xaae4('0x8'));var jayson=require(_0xaae4('0x9'));var client=jayson[_0xaae4('0xa')][_0xaae4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5950d8,_0x163277,_0x5ce203){return new BPromise(function(_0x438b71,_0x111c2b){return client[_0xaae4('0xc')](_0x5950d8,_0x5ce203)['then'](function(_0xa5b36a){logger['info'](_0xaae4('0xd'),_0x163277,_0xaae4('0xe'));logger[_0xaae4('0xf')](_0xaae4('0x10'),_0x163277,'request\x20sent',JSON[_0xaae4('0x11')](_0xa5b36a));if(_0xa5b36a['error']){if(_0xa5b36a['error'][_0xaae4('0x12')]===0x1f4){logger[_0xaae4('0x13')](_0xaae4('0xd'),_0x163277,_0xa5b36a[_0xaae4('0x13')][_0xaae4('0x14')]);return _0x111c2b(_0xa5b36a['error'][_0xaae4('0x14')]);}logger['error'](_0xaae4('0xd'),_0x163277,_0xa5b36a[_0xaae4('0x13')][_0xaae4('0x14')]);return _0x438b71(_0xa5b36a['error'][_0xaae4('0x14')]);}else{logger[_0xaae4('0x15')](_0xaae4('0xd'),_0x163277,_0xaae4('0xe'));_0x438b71(_0xa5b36a[_0xaae4('0x16')][_0xaae4('0x14')]);}})[_0xaae4('0x17')](function(_0x73adba){logger['error'](_0xaae4('0xd'),_0x163277,_0x73adba);_0x111c2b(_0x73adba);});});}exports[_0xaae4('0x18')]=function(_0x4f757b){var _0x297301=this;return new Promise(function(_0x1600d1,_0xa76c9e){return db['WhatsappQueueReport']['create'](_0x4f757b['body'],{'raw':_0x4f757b[_0xaae4('0x19')]?_0x4f757b['options'][_0xaae4('0x1a')]===undefined?!![]:![]:!![]})[_0xaae4('0x1b')](function(_0x333370){logger[_0xaae4('0x15')](_0xaae4('0x18'),_0x4f757b);logger[_0xaae4('0xf')](_0xaae4('0x18'),_0x4f757b,JSON[_0xaae4('0x11')](_0x333370));_0x1600d1(_0x333370);})[_0xaae4('0x17')](function(_0x1c0424){logger[_0xaae4('0x13')](_0xaae4('0x18'),_0x1c0424[_0xaae4('0x14')],_0x4f757b);_0xa76c9e(_0x297301[_0xaae4('0x13')](0x1f4,_0x1c0424[_0xaae4('0x14')]));});});};exports[_0xaae4('0x1c')]=function(_0x5de639){var _0x5a06dd=this;return new Promise(function(_0x59e9b4,_0x540805){return db[_0xaae4('0x1d')]['update'](_0x5de639[_0xaae4('0x1e')],{'raw':_0x5de639[_0xaae4('0x19')]?_0x5de639['options'][_0xaae4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de639[_0xaae4('0x19')]?_0x5de639[_0xaae4('0x19')][_0xaae4('0x1f')]||null:null,'attributes':_0x5de639['options']?_0x5de639[_0xaae4('0x19')][_0xaae4('0x20')]||null:null,'limit':_0x5de639[_0xaae4('0x19')]?_0x5de639[_0xaae4('0x19')][_0xaae4('0x21')]||null:null})[_0xaae4('0x1b')](function(_0x10ca88){logger[_0xaae4('0x15')](_0xaae4('0x1c'),_0x5de639);logger['debug']('UpdateWhatsappQueueReport',_0x5de639,JSON[_0xaae4('0x11')](_0x10ca88));_0x59e9b4(_0x10ca88);})[_0xaae4('0x17')](function(_0x136c67){logger[_0xaae4('0x13')](_0xaae4('0x1c'),_0x136c67[_0xaae4('0x14')],_0x5de639);_0x540805(_0x5a06dd['error'](0x1f4,_0x136c67[_0xaae4('0x14')]));});});}; \ No newline at end of file +var _0x5a1d=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','debug','lodash','util'];(function(_0x10dc5f,_0x3be7d7){var _0x4bdf6b=function(_0x40b9c7){while(--_0x40b9c7){_0x10dc5f['push'](_0x10dc5f['shift']());}};_0x4bdf6b(++_0x3be7d7);}(_0x5a1d,0x11e));var _0xd5a1=function(_0x4eb8f6,_0x3d96ae){_0x4eb8f6=_0x4eb8f6-0x0;var _0x5bc24d=_0x5a1d[_0x4eb8f6];return _0x5bc24d;};'use strict';var _=require(_0xd5a1('0x0'));var util=require(_0xd5a1('0x1'));var moment=require(_0xd5a1('0x2'));var BPromise=require(_0xd5a1('0x3'));var rs=require(_0xd5a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5a1('0x6'));var config=require(_0xd5a1('0x7'));var jayson=require(_0xd5a1('0x8'));var client=jayson[_0xd5a1('0x9')][_0xd5a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c457,_0x27cb4b,_0x4deaf4){return new BPromise(function(_0xf7ee78,_0x351b13){return client['request'](_0x52c457,_0x4deaf4)['then'](function(_0x4799df){logger[_0xd5a1('0xb')](_0xd5a1('0xc'),_0x27cb4b,_0xd5a1('0xd'));logger['debug'](_0xd5a1('0xe'),_0x27cb4b,_0xd5a1('0xd'),JSON[_0xd5a1('0xf')](_0x4799df));if(_0x4799df[_0xd5a1('0x10')]){if(_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x11')]===0x1f4){logger[_0xd5a1('0x10')](_0xd5a1('0xc'),_0x27cb4b,_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x12')]);return _0x351b13(_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x12')]);}logger[_0xd5a1('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x27cb4b,_0x4799df['error'][_0xd5a1('0x12')]);return _0xf7ee78(_0x4799df[_0xd5a1('0x10')]['message']);}else{logger[_0xd5a1('0xb')](_0xd5a1('0xc'),_0x27cb4b,'request\x20sent');_0xf7ee78(_0x4799df[_0xd5a1('0x13')][_0xd5a1('0x12')]);}})[_0xd5a1('0x14')](function(_0x4fd684){logger[_0xd5a1('0x10')](_0xd5a1('0xc'),_0x27cb4b,_0x4fd684);_0x351b13(_0x4fd684);});});}exports['CreateWhatsappQueueReport']=function(_0x260f31){var _0x2a1dfa=this;return new Promise(function(_0x83d974,_0x54004e){return db[_0xd5a1('0x15')][_0xd5a1('0x16')](_0x260f31[_0xd5a1('0x17')],{'raw':_0x260f31['options']?_0x260f31[_0xd5a1('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd5a1('0x19')](function(_0x4e21cd){logger[_0xd5a1('0xb')](_0xd5a1('0x1a'),_0x260f31);logger['debug']('CreateWhatsappQueueReport',_0x260f31,JSON[_0xd5a1('0xf')](_0x4e21cd));_0x83d974(_0x4e21cd);})['catch'](function(_0x428cec){logger[_0xd5a1('0x10')](_0xd5a1('0x1a'),_0x428cec[_0xd5a1('0x12')],_0x260f31);_0x54004e(_0x2a1dfa['error'](0x1f4,_0x428cec['message']));});});};exports[_0xd5a1('0x1b')]=function(_0x41a0df){var _0xc13d66=this;return new Promise(function(_0x2fa630,_0x569473){return db[_0xd5a1('0x15')][_0xd5a1('0x1c')](_0x41a0df[_0xd5a1('0x17')],{'raw':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41a0df['options']?_0x41a0df[_0xd5a1('0x18')][_0xd5a1('0x1d')]||null:null,'attributes':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')][_0xd5a1('0x1e')]||null:null,'limit':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')]['limit']||null:null})['then'](function(_0x3147a1){logger[_0xd5a1('0xb')](_0xd5a1('0x1b'),_0x41a0df);logger[_0xd5a1('0x1f')]('UpdateWhatsappQueueReport',_0x41a0df,JSON[_0xd5a1('0xf')](_0x3147a1));_0x2fa630(_0x3147a1);})[_0xd5a1('0x14')](function(_0x74d3f6){logger[_0xd5a1('0x10')]('UpdateWhatsappQueueReport',_0x74d3f6[_0xd5a1('0x12')],_0x41a0df);_0x569473(_0xc13d66['error'](0x1f4,_0x74d3f6[_0xd5a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 65ca7cc..a0b4701 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 _0xbb32=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb32,0xee));var _0x2bb3=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xbb32[_0x47adb8];return _0x4689a8;};'use strict';var multer=require(_0x2bb3('0x0'));var util=require(_0x2bb3('0x1'));var path=require(_0x2bb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bb3('0x3'));var router=express[_0x2bb3('0x4')]();var fs_extra=require(_0x2bb3('0x5'));var auth=require(_0x2bb3('0x6'));var interaction=require(_0x2bb3('0x7'));var config=require(_0x2bb3('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x2bb3('0x9')]('/',auth[_0x2bb3('0xa')](),controller[_0x2bb3('0xb')]);router['get'](_0x2bb3('0xc'),auth[_0x2bb3('0xa')](),controller[_0x2bb3('0xd')]);router[_0x2bb3('0x9')]('/:id',auth[_0x2bb3('0xa')](),controller[_0x2bb3('0xe')]);router[_0x2bb3('0xf')]('/',auth[_0x2bb3('0xa')](),controller[_0x2bb3('0x10')]);router[_0x2bb3('0x11')](_0x2bb3('0x12'),auth[_0x2bb3('0xa')](),controller[_0x2bb3('0x13')]);router[_0x2bb3('0x14')](_0x2bb3('0x12'),auth[_0x2bb3('0xa')](),controller['destroy']);module[_0x2bb3('0x15')]=router; \ No newline at end of file +var _0x953f=['create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x50b0e6,_0x4fe3c3){var _0x182cef=function(_0x5041d6){while(--_0x5041d6){_0x50b0e6['push'](_0x50b0e6['shift']());}};_0x182cef(++_0x4fe3c3);}(_0x953f,0x99));var _0xf953=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x953f[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xf953('0x0'));var path=require(_0xf953('0x1'));var timeout=require(_0xf953('0x2'));var express=require(_0xf953('0x3'));var router=express[_0xf953('0x4')]();var fs_extra=require(_0xf953('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf953('0x6'));var config=require(_0xf953('0x7'));var controller=require(_0xf953('0x8'));router[_0xf953('0x9')]('/',auth[_0xf953('0xa')](),controller[_0xf953('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf953('0xc')]);router[_0xf953('0x9')]('/:id',auth[_0xf953('0xa')](),controller[_0xf953('0xd')]);router[_0xf953('0xe')]('/',auth[_0xf953('0xa')](),controller[_0xf953('0xf')]);router[_0xf953('0x10')](_0xf953('0x11'),auth[_0xf953('0xa')](),controller[_0xf953('0x12')]);router['delete'](_0xf953('0x11'),auth[_0xf953('0xa')](),controller[_0xf953('0x13')]);module[_0xf953('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index eb21d49..25d85d4 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 _0xaaee=['DATE','sequelize','STRING','ENUM','agent','queue'];(function(_0x56e784,_0x33473f){var _0x5ccf07=function(_0x140636){while(--_0x140636){_0x56e784['push'](_0x56e784['shift']());}};_0x5ccf07(++_0x33473f);}(_0xaaee,0xa9));var _0xeaae=function(_0x407e4a,_0x565357){_0x407e4a=_0x407e4a-0x0;var _0x3e9e99=_0xaaee[_0x407e4a];return _0x3e9e99;};'use strict';var Sequelize=require(_0xeaae('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xeaae('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeaae('0x2')]('account',_0xeaae('0x3'),_0xeaae('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xeaae('0x5')]}}; \ No newline at end of file +var _0x4cdf=['exports','STRING','ENUM','account','agent','DATE','sequelize'];(function(_0x5830f1,_0x1a5dd8){var _0x1a35eb=function(_0x4a829c){while(--_0x4a829c){_0x5830f1['push'](_0x5830f1['shift']());}};_0x1a35eb(++_0x1a5dd8);}(_0x4cdf,0x180));var _0xf4cd=function(_0x535b03,_0x31b3f5){_0x535b03=_0x535b03-0x0;var _0x30908d=_0x4cdf[_0x535b03];return _0x30908d;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'uniqueid':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf4cd('0x3')](_0xf4cd('0x4'),_0xf4cd('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf4cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 33ead48..80b2392 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 _0x61fd=['sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','squel','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x59c530,_0x4a834c){var _0x19b21a=function(_0x253e9d){while(--_0x253e9d){_0x59c530['push'](_0x59c530['shift']());}};_0x19b21a(++_0x4a834c);}(_0x61fd,0xe7));var _0xd61f=function(_0x407879,_0x33e702){_0x407879=_0x407879-0x0;var _0x469241=_0x61fd[_0x407879];return _0x469241;};'use strict';var emlformat=require(_0xd61f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd61f('0x1'));var jsonpatch=require(_0xd61f('0x2'));var rp=require(_0xd61f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd61f('0x4'));var util=require('util');var path=require(_0xd61f('0x5'));var sox=require('sox');var csv=require(_0xd61f('0x6'));var ejs=require(_0xd61f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd61f('0x8'));var crypto=require('crypto');var jsforce=require(_0xd61f('0x9'));var deskjs=require(_0xd61f('0xa'));var toCsv=require(_0xd61f('0x6'));var querystring=require('querystring');var Papa=require(_0xd61f('0xb'));var Redis=require(_0xd61f('0xc'));var authService=require(_0xd61f('0xd'));var qs=require(_0xd61f('0xe'));var as=require(_0xd61f('0xf'));var hardwareService=require(_0xd61f('0x10'));var logger=require(_0xd61f('0x11'))('api');var utils=require(_0xd61f('0x12'));var config=require(_0xd61f('0x13'));var licenseUtil=require(_0xd61f('0x14'));var db=require(_0xd61f('0x15'))['db'];function respondWithStatusCode(_0x4b7b55,_0x35d0b4){_0x35d0b4=_0x35d0b4||0xcc;return function(_0x344d74){if(_0x344d74){return _0x4b7b55['sendStatus'](_0x35d0b4);}return _0x4b7b55[_0xd61f('0x16')](_0x35d0b4)[_0xd61f('0x17')]();};}function respondWithResult(_0x87684f,_0x2b7266){_0x2b7266=_0x2b7266||0xc8;return function(_0x4e727c){if(_0x4e727c){return _0x87684f['status'](_0x2b7266)[_0xd61f('0x18')](_0x4e727c);}};}function respondWithFilteredResult(_0x2da26b,_0x5f1f95){return function(_0x4e86c3){if(_0x4e86c3){var _0xdc5fae=typeof _0x5f1f95[_0xd61f('0x19')]===_0xd61f('0x1a')&&typeof _0x5f1f95[_0xd61f('0x1b')]===_0xd61f('0x1a');var _0x104fbe=_0x4e86c3[_0xd61f('0x1c')];var _0x30ae06=_0xdc5fae?0x0:_0x5f1f95[_0xd61f('0x19')];var _0xca7a5a=_0xdc5fae?_0x4e86c3[_0xd61f('0x1c')]:_0x5f1f95['offset']+_0x5f1f95[_0xd61f('0x1b')];var _0x3c9f34;if(_0xca7a5a>=_0x104fbe){_0xca7a5a=_0x104fbe;_0x3c9f34=0xc8;}else{_0x3c9f34=0xce;}_0x2da26b[_0xd61f('0x16')](_0x3c9f34);return _0x2da26b[_0xd61f('0x1d')](_0xd61f('0x1e'),_0x30ae06+'-'+_0xca7a5a+'/'+_0x104fbe)[_0xd61f('0x18')](_0x4e86c3);}return null;};}function patchUpdates(_0xecac45){return function(_0x1c9811){try{jsonpatch[_0xd61f('0x1f')](_0x1c9811,_0xecac45,!![]);}catch(_0x33a2b2){return BPromise[_0xd61f('0x20')](_0x33a2b2);}return _0x1c9811[_0xd61f('0x21')]();};}function saveUpdates(_0x20b53f,_0x389dfd){return function(_0x3f2f0b){if(_0x3f2f0b){return _0x3f2f0b[_0xd61f('0x22')](_0x20b53f)[_0xd61f('0x23')](function(_0x3a1f29){return _0x3a1f29;});}return null;};}function removeEntity(_0x34bc1b,_0x36c610){return function(_0x1cc60d){if(_0x1cc60d){return _0x1cc60d[_0xd61f('0x24')]()[_0xd61f('0x23')](function(){_0x34bc1b[_0xd61f('0x16')](0xcc)[_0xd61f('0x17')]();});}};}function handleEntityNotFound(_0x46c7b3,_0x207bfb){return function(_0x3867b7){if(!_0x3867b7){_0x46c7b3['sendStatus'](0x194);}return _0x3867b7;};}function handleError(_0x40ee56,_0xc02ed9){_0xc02ed9=_0xc02ed9||0x1f4;return function(_0x29e6f4){logger[_0xd61f('0x25')](_0x29e6f4[_0xd61f('0x26')]);if(_0x29e6f4[_0xd61f('0x27')]){delete _0x29e6f4['name'];}_0x40ee56[_0xd61f('0x16')](_0xc02ed9)[_0xd61f('0x28')](_0x29e6f4);};}exports['index']=function(_0x269058,_0x39eced){var _0x2ade50={},_0x1a309c={},_0x54e3cf={'count':0x0,'rows':[]};var _0x2f6ec6=_[_0xd61f('0x29')](db[_0xd61f('0x2a')][_0xd61f('0x2b')],function(_0xe469f9){return{'name':_0xe469f9['fieldName'],'type':_0xe469f9[_0xd61f('0x2c')][_0xd61f('0x2d')]};});_0x1a309c['model']=_[_0xd61f('0x29')](_0x2f6ec6,_0xd61f('0x27'));_0x1a309c[_0xd61f('0x2e')]=_[_0xd61f('0x2f')](_0x269058[_0xd61f('0x2e')]);_0x1a309c[_0xd61f('0x30')]=_['intersection'](_0x1a309c[_0xd61f('0x31')],_0x1a309c[_0xd61f('0x2e')]);_0x2ade50['attributes']=_[_0xd61f('0x32')](_0x1a309c['model'],qs['fields'](_0x269058[_0xd61f('0x2e')][_0xd61f('0x33')]));_0x2ade50[_0xd61f('0x34')]=_0x2ade50['attributes'][_0xd61f('0x35')]?_0x2ade50[_0xd61f('0x34')]:_0x1a309c[_0xd61f('0x31')];if(!_0x269058[_0xd61f('0x2e')][_0xd61f('0x36')](_0xd61f('0x37'))){_0x2ade50[_0xd61f('0x1b')]=qs[_0xd61f('0x1b')](_0x269058[_0xd61f('0x2e')]['limit']);_0x2ade50['offset']=qs[_0xd61f('0x19')](_0x269058[_0xd61f('0x2e')][_0xd61f('0x19')]);}_0x2ade50[_0xd61f('0x38')]=qs[_0xd61f('0x39')](_0x269058[_0xd61f('0x2e')][_0xd61f('0x39')]);_0x2ade50[_0xd61f('0x3a')]=qs[_0xd61f('0x30')](_[_0xd61f('0x3b')](_0x269058[_0xd61f('0x2e')],_0x1a309c[_0xd61f('0x30')]),_0x2f6ec6);if(_0x269058['query'][_0xd61f('0x3c')]){_0x2ade50['where']=_[_0xd61f('0x3d')](_0x2ade50[_0xd61f('0x3a')],{'$or':_[_0xd61f('0x29')](_0x2f6ec6,function(_0x4f1703){if(_0x4f1703[_0xd61f('0x2c')]!=='VIRTUAL'){var _0x513802={};_0x513802[_0x4f1703[_0xd61f('0x27')]]={'$like':'%'+_0x269058[_0xd61f('0x2e')][_0xd61f('0x3c')]+'%'};return _0x513802;}})});}_0x2ade50=_['merge']({},_0x2ade50,_0x269058[_0xd61f('0x3e')]);var _0x2cb1dc={'where':_0x2ade50[_0xd61f('0x3a')]};return db['WhatsappTransferReport']['count'](_0x2cb1dc)[_0xd61f('0x23')](function(_0x566cd3){_0x54e3cf['count']=_0x566cd3;if(_0x269058['query'][_0xd61f('0x3f')]){_0x2ade50['include']=[{'all':!![]}];}return db[_0xd61f('0x2a')]['findAll'](_0x2ade50);})[_0xd61f('0x23')](function(_0x12f026){_0x54e3cf['rows']=_0x12f026;return _0x54e3cf;})[_0xd61f('0x23')](respondWithFilteredResult(_0x39eced,_0x2ade50))[_0xd61f('0x40')](handleError(_0x39eced,null));};exports[_0xd61f('0x41')]=function(_0x708981,_0xd1c93c){var _0x24c886={'raw':!![],'where':{'id':_0x708981[_0xd61f('0x42')]['id']}},_0x5913b7={};_0x5913b7[_0xd61f('0x31')]=_[_0xd61f('0x2f')](db[_0xd61f('0x2a')][_0xd61f('0x2b')]);_0x5913b7[_0xd61f('0x2e')]=_[_0xd61f('0x2f')](_0x708981[_0xd61f('0x2e')]);_0x5913b7[_0xd61f('0x30')]=_[_0xd61f('0x32')](_0x5913b7[_0xd61f('0x31')],_0x5913b7[_0xd61f('0x2e')]);_0x24c886['attributes']=_[_0xd61f('0x32')](_0x5913b7['model'],qs[_0xd61f('0x33')](_0x708981['query'][_0xd61f('0x33')]));_0x24c886[_0xd61f('0x34')]=_0x24c886[_0xd61f('0x34')][_0xd61f('0x35')]?_0x24c886['attributes']:_0x5913b7[_0xd61f('0x31')];if(_0x708981['query'][_0xd61f('0x3f')]){_0x24c886[_0xd61f('0x43')]=[{'all':!![]}];}_0x24c886=_[_0xd61f('0x3d')]({},_0x24c886,_0x708981['options']);return db[_0xd61f('0x2a')][_0xd61f('0x44')](_0x24c886)[_0xd61f('0x23')](handleEntityNotFound(_0xd1c93c,null))['then'](respondWithResult(_0xd1c93c,null))[_0xd61f('0x40')](handleError(_0xd1c93c,null));};exports[_0xd61f('0x45')]=function(_0x3550b9,_0x5acb68){return db['WhatsappTransferReport']['create'](_0x3550b9[_0xd61f('0x46')],{})['then'](respondWithResult(_0x5acb68,0xc9))[_0xd61f('0x40')](handleError(_0x5acb68,null));};exports['update']=function(_0x2c811b,_0x1c4755){if(_0x2c811b['body']['id']){delete _0x2c811b['body']['id'];}return db[_0xd61f('0x2a')][_0xd61f('0x44')]({'where':{'id':_0x2c811b['params']['id']}})['then'](handleEntityNotFound(_0x1c4755,null))[_0xd61f('0x23')](saveUpdates(_0x2c811b['body'],null))[_0xd61f('0x23')](respondWithResult(_0x1c4755,null))[_0xd61f('0x40')](handleError(_0x1c4755,null));};exports[_0xd61f('0x24')]=function(_0x5eba4a,_0x16b124){return db['WhatsappTransferReport'][_0xd61f('0x44')]({'where':{'id':_0x5eba4a[_0xd61f('0x42')]['id']}})[_0xd61f('0x23')](handleEntityNotFound(_0x16b124,null))['then'](removeEntity(_0x16b124,null))['catch'](handleError(_0x16b124,null));};exports[_0xd61f('0x47')]=function(_0x2d7766,_0x4c7c52){return db[_0xd61f('0x2a')]['describe']()[_0xd61f('0x23')](respondWithResult(_0x4c7c52,null))[_0xd61f('0x40')](handleError(_0x4c7c52,null));}; \ No newline at end of file +var _0xfbf7=['save','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','update','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfbf7,0x14b));var _0x7fbf=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0xfbf7[_0x5cb71a];return _0x3f380f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fbf('0x0'));var zipdir=require(_0x7fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fbf('0x2'));var moment=require(_0x7fbf('0x3'));var BPromise=require(_0x7fbf('0x4'));var Mustache=require(_0x7fbf('0x5'));var util=require(_0x7fbf('0x6'));var path=require('path');var sox=require(_0x7fbf('0x7'));var csv=require(_0x7fbf('0x8'));var ejs=require(_0x7fbf('0x9'));var fs=require('fs');var fs_extra=require(_0x7fbf('0xa'));var _=require(_0x7fbf('0xb'));var squel=require('squel');var crypto=require(_0x7fbf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7fbf('0xd'));var toCsv=require(_0x7fbf('0x8'));var querystring=require(_0x7fbf('0xe'));var Papa=require(_0x7fbf('0xf'));var Redis=require('ioredis');var authService=require(_0x7fbf('0x10'));var qs=require(_0x7fbf('0x11'));var as=require(_0x7fbf('0x12'));var hardwareService=require(_0x7fbf('0x13'));var logger=require(_0x7fbf('0x14'))(_0x7fbf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7fbf('0x16'));var db=require(_0x7fbf('0x17'))['db'];function respondWithStatusCode(_0x5653c3,_0x259e94){_0x259e94=_0x259e94||0xcc;return function(_0x218f7e){if(_0x218f7e){return _0x5653c3['sendStatus'](_0x259e94);}return _0x5653c3[_0x7fbf('0x18')](_0x259e94)[_0x7fbf('0x19')]();};}function respondWithResult(_0x336e60,_0x18ae46){_0x18ae46=_0x18ae46||0xc8;return function(_0x1978d7){if(_0x1978d7){return _0x336e60[_0x7fbf('0x18')](_0x18ae46)['json'](_0x1978d7);}};}function respondWithFilteredResult(_0x4bdab2,_0x254dbb){return function(_0x5657f6){if(_0x5657f6){var _0x12db14=typeof _0x254dbb[_0x7fbf('0x1a')]==='undefined'&&typeof _0x254dbb[_0x7fbf('0x1b')]===_0x7fbf('0x1c');var _0x2dfc38=_0x5657f6[_0x7fbf('0x1d')];var _0x54d853=_0x12db14?0x0:_0x254dbb['offset'];var _0x1bdcc5=_0x12db14?_0x5657f6[_0x7fbf('0x1d')]:_0x254dbb[_0x7fbf('0x1a')]+_0x254dbb[_0x7fbf('0x1b')];var _0x3a3d78;if(_0x1bdcc5>=_0x2dfc38){_0x1bdcc5=_0x2dfc38;_0x3a3d78=0xc8;}else{_0x3a3d78=0xce;}_0x4bdab2[_0x7fbf('0x18')](_0x3a3d78);return _0x4bdab2[_0x7fbf('0x1e')]('Content-Range',_0x54d853+'-'+_0x1bdcc5+'/'+_0x2dfc38)[_0x7fbf('0x1f')](_0x5657f6);}return null;};}function patchUpdates(_0x5b01db){return function(_0x40208f){try{jsonpatch[_0x7fbf('0x20')](_0x40208f,_0x5b01db,!![]);}catch(_0x126a94){return BPromise[_0x7fbf('0x21')](_0x126a94);}return _0x40208f[_0x7fbf('0x22')]();};}function saveUpdates(_0x2bbc8b,_0x5c1a46){return function(_0x28f9a0){if(_0x28f9a0){return _0x28f9a0['update'](_0x2bbc8b)[_0x7fbf('0x23')](function(_0x42f7f7){return _0x42f7f7;});}return null;};}function removeEntity(_0xcf0966,_0x2e1d74){return function(_0x1bf47f){if(_0x1bf47f){return _0x1bf47f[_0x7fbf('0x24')]()[_0x7fbf('0x23')](function(){_0xcf0966[_0x7fbf('0x18')](0xcc)[_0x7fbf('0x19')]();});}};}function handleEntityNotFound(_0x42c898,_0x2bf3bc){return function(_0x57b6d4){if(!_0x57b6d4){_0x42c898['sendStatus'](0x194);}return _0x57b6d4;};}function handleError(_0x4f4ebd,_0x35eeba){_0x35eeba=_0x35eeba||0x1f4;return function(_0x578400){logger[_0x7fbf('0x25')](_0x578400[_0x7fbf('0x26')]);if(_0x578400[_0x7fbf('0x27')]){delete _0x578400['name'];}_0x4f4ebd['status'](_0x35eeba)[_0x7fbf('0x28')](_0x578400);};}exports[_0x7fbf('0x29')]=function(_0x90603a,_0x2c25be){var _0x2872b3={},_0x5346a6={},_0x224ab4={'count':0x0,'rows':[]};var _0x2f6d79=_[_0x7fbf('0x2a')](db[_0x7fbf('0x2b')][_0x7fbf('0x2c')],function(_0xe505d4){return{'name':_0xe505d4[_0x7fbf('0x2d')],'type':_0xe505d4[_0x7fbf('0x2e')]['key']};});_0x5346a6[_0x7fbf('0x2f')]=_[_0x7fbf('0x2a')](_0x2f6d79,_0x7fbf('0x27'));_0x5346a6['query']=_['keys'](_0x90603a[_0x7fbf('0x30')]);_0x5346a6[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x5346a6[_0x7fbf('0x2f')],_0x5346a6[_0x7fbf('0x30')]);_0x2872b3[_0x7fbf('0x33')]=_[_0x7fbf('0x32')](_0x5346a6[_0x7fbf('0x2f')],qs[_0x7fbf('0x34')](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x34')]));_0x2872b3[_0x7fbf('0x33')]=_0x2872b3[_0x7fbf('0x33')][_0x7fbf('0x35')]?_0x2872b3[_0x7fbf('0x33')]:_0x5346a6[_0x7fbf('0x2f')];if(!_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x36')]('nolimit')){_0x2872b3[_0x7fbf('0x1b')]=qs['limit'](_0x90603a['query'][_0x7fbf('0x1b')]);_0x2872b3[_0x7fbf('0x1a')]=qs['offset'](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x1a')]);}_0x2872b3['order']=qs[_0x7fbf('0x37')](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x37')]);_0x2872b3[_0x7fbf('0x38')]=qs[_0x7fbf('0x31')](_[_0x7fbf('0x39')](_0x90603a[_0x7fbf('0x30')],_0x5346a6[_0x7fbf('0x31')]),_0x2f6d79);if(_0x90603a[_0x7fbf('0x30')]['filter']){_0x2872b3[_0x7fbf('0x38')]=_['merge'](_0x2872b3['where'],{'$or':_[_0x7fbf('0x2a')](_0x2f6d79,function(_0x5ba8e8){if(_0x5ba8e8[_0x7fbf('0x2e')]!=='VIRTUAL'){var _0x2900c3={};_0x2900c3[_0x5ba8e8[_0x7fbf('0x27')]]={'$like':'%'+_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x3a')]+'%'};return _0x2900c3;}})});}_0x2872b3=_[_0x7fbf('0x3b')]({},_0x2872b3,_0x90603a[_0x7fbf('0x3c')]);var _0x15476f={'where':_0x2872b3[_0x7fbf('0x38')]};return db['WhatsappTransferReport'][_0x7fbf('0x1d')](_0x15476f)[_0x7fbf('0x23')](function(_0xf81431){_0x224ab4[_0x7fbf('0x1d')]=_0xf81431;if(_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x3d')]){_0x2872b3[_0x7fbf('0x3e')]=[{'all':!![]}];}return db[_0x7fbf('0x2b')][_0x7fbf('0x3f')](_0x2872b3);})[_0x7fbf('0x23')](function(_0x418ae6){_0x224ab4['rows']=_0x418ae6;return _0x224ab4;})[_0x7fbf('0x23')](respondWithFilteredResult(_0x2c25be,_0x2872b3))[_0x7fbf('0x40')](handleError(_0x2c25be,null));};exports[_0x7fbf('0x41')]=function(_0x3e41a7,_0x1cda2e){var _0x366ab4={'raw':!![],'where':{'id':_0x3e41a7['params']['id']}},_0x5b107d={};_0x5b107d[_0x7fbf('0x2f')]=_[_0x7fbf('0x42')](db[_0x7fbf('0x2b')]['rawAttributes']);_0x5b107d[_0x7fbf('0x30')]=_[_0x7fbf('0x42')](_0x3e41a7[_0x7fbf('0x30')]);_0x5b107d[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x5b107d[_0x7fbf('0x2f')],_0x5b107d[_0x7fbf('0x30')]);_0x366ab4[_0x7fbf('0x33')]=_['intersection'](_0x5b107d[_0x7fbf('0x2f')],qs[_0x7fbf('0x34')](_0x3e41a7[_0x7fbf('0x30')]['fields']));_0x366ab4[_0x7fbf('0x33')]=_0x366ab4[_0x7fbf('0x33')]['length']?_0x366ab4[_0x7fbf('0x33')]:_0x5b107d[_0x7fbf('0x2f')];if(_0x3e41a7[_0x7fbf('0x30')][_0x7fbf('0x3d')]){_0x366ab4[_0x7fbf('0x3e')]=[{'all':!![]}];}_0x366ab4=_[_0x7fbf('0x3b')]({},_0x366ab4,_0x3e41a7[_0x7fbf('0x3c')]);return db['WhatsappTransferReport'][_0x7fbf('0x43')](_0x366ab4)['then'](handleEntityNotFound(_0x1cda2e,null))[_0x7fbf('0x23')](respondWithResult(_0x1cda2e,null))['catch'](handleError(_0x1cda2e,null));};exports[_0x7fbf('0x44')]=function(_0x46f991,_0xccd0a3){return db[_0x7fbf('0x2b')]['create'](_0x46f991['body'],{})[_0x7fbf('0x23')](respondWithResult(_0xccd0a3,0xc9))['catch'](handleError(_0xccd0a3,null));};exports[_0x7fbf('0x45')]=function(_0x2d5c9e,_0x47173b){if(_0x2d5c9e[_0x7fbf('0x46')]['id']){delete _0x2d5c9e[_0x7fbf('0x46')]['id'];}return db[_0x7fbf('0x2b')]['find']({'where':{'id':_0x2d5c9e['params']['id']}})[_0x7fbf('0x23')](handleEntityNotFound(_0x47173b,null))[_0x7fbf('0x23')](saveUpdates(_0x2d5c9e['body'],null))[_0x7fbf('0x23')](respondWithResult(_0x47173b,null))[_0x7fbf('0x40')](handleError(_0x47173b,null));};exports[_0x7fbf('0x24')]=function(_0x214123,_0x588558){return db[_0x7fbf('0x2b')][_0x7fbf('0x43')]({'where':{'id':_0x214123[_0x7fbf('0x47')]['id']}})[_0x7fbf('0x23')](handleEntityNotFound(_0x588558,null))[_0x7fbf('0x23')](removeEntity(_0x588558,null))[_0x7fbf('0x40')](handleError(_0x588558,null));};exports[_0x7fbf('0x48')]=function(_0x2e9ae0,_0x18708a){return db['WhatsappTransferReport'][_0x7fbf('0x48')]()[_0x7fbf('0x23')](respondWithResult(_0x18708a,null))[_0x7fbf('0x40')](handleError(_0x18708a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 23bcb88..6f3913d 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 _0x1206=['moment','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x13a7d0,_0x460903){var _0x3e1c4e=function(_0x34ce97){while(--_0x34ce97){_0x13a7d0['push'](_0x13a7d0['shift']());}};_0x3e1c4e(++_0x460903);}(_0x1206,0x96));var _0x6120=function(_0x25fa25,_0x26b171){_0x25fa25=_0x25fa25-0x0;var _0x1a9bbd=_0x1206[_0x25fa25];return _0x1a9bbd;};'use strict';var _=require(_0x6120('0x0'));var util=require(_0x6120('0x1'));var logger=require(_0x6120('0x2'))(_0x6120('0x3'));var moment=require(_0x6120('0x4'));var BPromise=require(_0x6120('0x5'));var rp=require(_0x6120('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6120('0x7'));var config=require('../../config/environment');var attributes=require(_0x6120('0x8'));module[_0x6120('0x9')]=function(_0x3e9fa1,_0x14f2ce){return _0x3e9fa1[_0x6120('0xa')](_0x6120('0xb'),attributes,{'tableName':_0x6120('0xc'),'paranoid':![],'indexes':[{'name':_0x6120('0xd'),'fields':[_0x6120('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18cd=['exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x478927,_0x137268){var _0x37223f=function(_0x16faf8){while(--_0x16faf8){_0x478927['push'](_0x478927['shift']());}};_0x37223f(++_0x137268);}(_0x18cd,0x103));var _0xd18c=function(_0x202b22,_0x2e8402){_0x202b22=_0x202b22-0x0;var _0x495469=_0x18cd[_0x202b22];return _0x495469;};'use strict';var _=require(_0xd18c('0x0'));var util=require(_0xd18c('0x1'));var logger=require(_0xd18c('0x2'))(_0xd18c('0x3'));var moment=require(_0xd18c('0x4'));var BPromise=require(_0xd18c('0x5'));var rp=require(_0xd18c('0x6'));var fs=require('fs');var path=require(_0xd18c('0x7'));var rimraf=require(_0xd18c('0x8'));var config=require(_0xd18c('0x9'));var attributes=require(_0xd18c('0xa'));module[_0xd18c('0xb')]=function(_0x555c7a,_0x9109c5){return _0x555c7a[_0xd18c('0xc')](_0xd18c('0xd'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd18c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 31fde8c..a286a3a 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 _0xe86d=['code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0xe86d,0x71));var _0xde86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe86d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xde86('0x0'));var moment=require(_0xde86('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde86('0x2'));var logger=require(_0xde86('0x3'))('rpc');var config=require(_0xde86('0x4'));var jayson=require(_0xde86('0x5'));var client=jayson[_0xde86('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c01da,_0x57af4d,_0x42c9e5){return new BPromise(function(_0x2a506f,_0xb6ec07){return client[_0xde86('0x7')](_0x1c01da,_0x42c9e5)['then'](function(_0x3ec8de){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x57af4d,_0xde86('0x8'));logger[_0xde86('0x9')](_0xde86('0xa'),_0x57af4d,_0xde86('0x8'),JSON[_0xde86('0xb')](_0x3ec8de));if(_0x3ec8de['error']){if(_0x3ec8de[_0xde86('0xc')][_0xde86('0xd')]===0x1f4){logger[_0xde86('0xc')](_0xde86('0xe'),_0x57af4d,_0x3ec8de['error']['message']);return _0xb6ec07(_0x3ec8de[_0xde86('0xc')][_0xde86('0xf')]);}logger['error'](_0xde86('0xe'),_0x57af4d,_0x3ec8de['error'][_0xde86('0xf')]);return _0x2a506f(_0x3ec8de[_0xde86('0xc')][_0xde86('0xf')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x57af4d,_0xde86('0x8'));_0x2a506f(_0x3ec8de[_0xde86('0x10')][_0xde86('0xf')]);}})[_0xde86('0x11')](function(_0x1ad51e){logger['error'](_0xde86('0xe'),_0x57af4d,_0x1ad51e);_0xb6ec07(_0x1ad51e);});});} \ No newline at end of file +var _0x3f4d=['../../config/logger','../../config/environment','jayson/promise','client','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8b1d29,_0xb306df){var _0x29fe0e=function(_0x1dae4d){while(--_0x1dae4d){_0x8b1d29['push'](_0x8b1d29['shift']());}};_0x29fe0e(++_0xb306df);}(_0x3f4d,0xae));var _0xd3f4=function(_0x97688b,_0x24a0aa){_0x97688b=_0x97688b-0x0;var _0x4e0ca4=_0x3f4d[_0x97688b];return _0x4e0ca4;};'use strict';var _=require(_0xd3f4('0x0'));var util=require(_0xd3f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3f4('0x2'));var fs=require('fs');var Redis=require(_0xd3f4('0x3'));var db=require(_0xd3f4('0x4'))['db'];var utils=require(_0xd3f4('0x5'));var logger=require(_0xd3f4('0x6'))('rpc');var config=require(_0xd3f4('0x7'));var jayson=require(_0xd3f4('0x8'));var client=jayson[_0xd3f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x446639,_0x11cce7,_0x2a4090){return new BPromise(function(_0x3a5253,_0x45faff){return client[_0xd3f4('0xa')](_0x446639,_0x2a4090)['then'](function(_0x34dea8){logger['info'](_0xd3f4('0xb'),_0x11cce7,_0xd3f4('0xc'));logger['debug'](_0xd3f4('0xd'),_0x11cce7,'request\x20sent',JSON[_0xd3f4('0xe')](_0x34dea8));if(_0x34dea8[_0xd3f4('0xf')]){if(_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x10')]===0x1f4){logger[_0xd3f4('0xf')](_0xd3f4('0xb'),_0x11cce7,_0x34dea8['error'][_0xd3f4('0x11')]);return _0x45faff(_0x34dea8['error'][_0xd3f4('0x11')]);}logger['error'](_0xd3f4('0xb'),_0x11cce7,_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x11')]);return _0x3a5253(_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x11')]);}else{logger['info'](_0xd3f4('0xb'),_0x11cce7,'request\x20sent');_0x3a5253(_0x34dea8[_0xd3f4('0x12')][_0xd3f4('0x11')]);}})[_0xd3f4('0x13')](function(_0x471b8f){logger[_0xd3f4('0xf')](_0xd3f4('0xb'),_0x11cce7,_0x471b8f);_0x45faff(_0x471b8f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 111228b..99dcd06 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc1c=['App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','log'];(function(_0x5e490c,_0x244125){var _0xe3d139=function(_0xcaf987){while(--_0xcaf987){_0x5e490c['push'](_0x5e490c['shift']());}};_0xe3d139(++_0x244125);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xbc1c[_0x4d21ff];return _0x22b554;};'use strict';var _=require('lodash');var db=require(_0xcbc1('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xcbc1('0x1'));var rpc=require('./rpc');var config=require(_0xcbc1('0x2'));var logger=require(_0xcbc1('0x3'))(_0xcbc1('0x4'));var pm2=require(_0xcbc1('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xcbc1('0x6'));var chat=require(_0xcbc1('0x7'));var whatsapp=require(_0xcbc1('0x8'));var transcribe=require(_0xcbc1('0x9'));var provider=require(_0xcbc1('0xa'));function main(){return db[_0xcbc1('0xb')]['sync']()[_0xcbc1('0xc')](function(){if(config[_0xcbc1('0xd')]){return seedDb[_0xcbc1('0xe')]();}})[_0xcbc1('0xc')](function(){return checkLicense[_0xcbc1('0xe')]();})[_0xcbc1('0xc')](function(){return rpc['listen']();})[_0xcbc1('0xc')](function(_0x4addfb){logger[_0xcbc1('0xf')](_0x4addfb);return chat[_0xcbc1('0x10')]();})['then'](function(){return whatsapp[_0xcbc1('0x10')]();})['then'](function(){return schedule['start']();})[_0xcbc1('0xc')](function(){return transcribe[_0xcbc1('0x10')]();})['then'](function(){return provider[_0xcbc1('0x10')]();})[_0xcbc1('0xc')](function(_0x56b168){logger['info'](_0x56b168);return pm2[_0xcbc1('0x10')](pm2Config);})['then'](function(_0x33aa46){var _0x3a4b8d=_0x33aa46[_0xcbc1('0x11')](function(_0x2dcafc){return typeof _0x2dcafc[_0xcbc1('0x12')]==='number'&&_0x2dcafc['exitCode']>=0x0;});if(_0x3a4b8d['length']>0x0){throw new Error(_0x3a4b8d[_0xcbc1('0x13')]+_0xcbc1('0x14')+_[_0xcbc1('0x15')](_0x3a4b8d,function(_0x316217){return'\x22'+_0x316217['pm2_env'][_0xcbc1('0x16')]+'\x22';}));}logger[_0xcbc1('0xf')](_0xcbc1('0x17'),_[_0xcbc1('0x15')](_[_0xcbc1('0x11')](_0x33aa46,{'status':_0xcbc1('0x18')}),'name')[_0xcbc1('0x19')]());logger[_0xcbc1('0xf')](_0xcbc1('0x1a'),_['map'](_[_0xcbc1('0x11')](_0x33aa46,function(_0x3b9837){return _0x3b9837[_0xcbc1('0x1b')]!==_0xcbc1('0x18');}),_0xcbc1('0x16'))[_0xcbc1('0x19')]()||'None');console[_0xcbc1('0x1c')](_0xcbc1('0x1d'));})[_0xcbc1('0x1e')](function(_0x1c26e6){console['log'](_0xcbc1('0x1f'),_0x1c26e6);logger[_0xcbc1('0x20')](_0xcbc1('0x21'),_0x1c26e6);process[_0xcbc1('0x22')](0x1);});}main(); \ No newline at end of file +var _0x13f5=['exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','None','log','App\x20Ready!','catch','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x513f('0x0'));var db=require(_0x513f('0x1'))['db'];var seedDb=require(_0x513f('0x2'));var checkLicense=require(_0x513f('0x3'));var rpc=require('./rpc');var config=require(_0x513f('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0x513f('0x5'));var pm2Config=require(_0x513f('0x6'));var schedule=require(_0x513f('0x7'));var chat=require(_0x513f('0x8'));var whatsapp=require(_0x513f('0x9'));var transcribe=require(_0x513f('0xa'));var provider=require(_0x513f('0xb'));function main(){return db[_0x513f('0xc')][_0x513f('0xd')]()[_0x513f('0xe')](function(){if(config[_0x513f('0xf')]){return seedDb[_0x513f('0x10')]();}})['then'](function(){return checkLicense[_0x513f('0x10')]();})[_0x513f('0xe')](function(){return rpc[_0x513f('0x11')]();})[_0x513f('0xe')](function(_0x88288b){logger['info'](_0x88288b);return chat[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return whatsapp['start']();})[_0x513f('0xe')](function(){return schedule[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return transcribe[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return provider[_0x513f('0x12')]();})[_0x513f('0xe')](function(_0x265cd7){logger[_0x513f('0x13')](_0x265cd7);return pm2[_0x513f('0x12')](pm2Config);})[_0x513f('0xe')](function(_0x359478){var _0x3874d1=_0x359478[_0x513f('0x14')](function(_0x57fd65){return typeof _0x57fd65[_0x513f('0x15')]==='number'&&_0x57fd65[_0x513f('0x15')]>=0x0;});if(_0x3874d1[_0x513f('0x16')]>0x0){throw new Error(_0x3874d1[_0x513f('0x16')]+_0x513f('0x17')+_[_0x513f('0x18')](_0x3874d1,function(_0x584305){return'\x22'+_0x584305[_0x513f('0x19')][_0x513f('0x1a')]+'\x22';}));}logger['info'](_0x513f('0x1b'),_['map'](_[_0x513f('0x14')](_0x359478,{'status':_0x513f('0x1c')}),'name')[_0x513f('0x1d')]());logger[_0x513f('0x13')](_0x513f('0x1e'),_[_0x513f('0x18')](_[_0x513f('0x14')](_0x359478,function(_0x1e3a46){return _0x1e3a46['status']!==_0x513f('0x1c');}),_0x513f('0x1a'))['join']()||_0x513f('0x1f'));console[_0x513f('0x20')](_0x513f('0x21'));})[_0x513f('0x22')](function(_0x3d85f7){console[_0x513f('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3d85f7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d85f7);process[_0x513f('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index eafcd6f..59c96f0 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x12a2a5,_0x3fd6dc){_0x12a2a5=_0x12a2a5-0x0;var _0x391209=_0xb43b[_0x12a2a5];return _0x391209;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file +var _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x3920f3,_0x726d50){var _0x4daaa1=function(_0x144351){while(--_0x144351){_0x3920f3['push'](_0x3920f3['shift']());}};_0x4daaa1(++_0x726d50);}(_0x34e8,0x12c));var _0x834e=function(_0x1fbe61,_0x327893){_0x1fbe61=_0x1fbe61-0x0;var _0x3d14ef=_0x34e8[_0x1fbe61];return _0x3d14ef;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 549edfb..ad288d9 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 _0x0727=['createCipher','data','update','binary','write','final','end','unlink','decryptFile','createDecipher','close','encryptString','secret','base64','utf8','crypto','bluebird','../../config/environment','../../config/logger','app','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0727,0xef));var _0x7072=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x0727[_0x199b1f];return _0x267ac9;};'use strict';var crypto=require(_0x7072('0x0'));var fs=require('fs');var BPromise=require(_0x7072('0x1'));var _=require('lodash');var config=require(_0x7072('0x2'));var logger=require(_0x7072('0x3'))(_0x7072('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x7072('0x5')};if(config[_0x7072('0x6')]&&config[_0x7072('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x7072('0x7')]);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x7072('0x8')](config[_0x7072('0x6')][_0x7072('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x355a8b){return AES_SUPPORTED_RX[_0x7072('0x9')](_0x355a8b);}function getSupportedCiphers(){return crypto[_0x7072('0xa')]()[_0x7072('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x4a5dcc){return getSupportedCiphers()[_0x7072('0xc')](_0x4a5dcc)>-0x1;}function combineOptions(_0x289c67){var _0x1824bb={};for(var _0x59a4ec in fileOptions){if(fileOptions['hasOwnProperty'](_0x59a4ec)){_0x1824bb[_0x59a4ec]=fileOptions[_0x59a4ec];}}if(_0x289c67){for(var _0x417d22 in _0x289c67){if(_0x289c67[_0x7072('0xd')](_0x417d22)){_0x1824bb[_0x417d22]=_0x289c67[_0x417d22];}}}return _0x1824bb;}exports[_0x7072('0xe')]=function(_0x5de6cf,_0x4124e2,_0x51ddd6,_0xc5964e){return new BPromise(function(_0xcc7147,_0x3392ea){_0xc5964e=combineOptions(_0xc5964e);var _0x44ea71=new Buffer(_0x51ddd6);var _0x225b66=fs[_0x7072('0xf')](_0x5de6cf);var _0x317b7d=fs[_0x7072('0x10')](_0x4124e2);var _0x32cd04=crypto[_0x7072('0x11')](_0xc5964e[_0x7072('0x7')],_0x44ea71);_0x225b66['on'](_0x7072('0x12'),function(_0xf4cf0e){var _0x16192f=new Buffer(_0x32cd04[_0x7072('0x13')](_0xf4cf0e),_0x7072('0x14'));_0x317b7d[_0x7072('0x15')](_0x16192f);});_0x225b66['on']('end',function(){try{var _0x4643f6=new Buffer(_0x32cd04[_0x7072('0x16')]('binary'),_0x7072('0x14'));_0x317b7d[_0x7072('0x15')](_0x4643f6);_0x317b7d[_0x7072('0x17')]();_0x317b7d['on']('close',function(){return _0xcc7147(_0x4124e2);});}catch(_0x2727aa){fs[_0x7072('0x18')](_0x4124e2);return _0x3392ea(_0x2727aa);}});});};exports[_0x7072('0x19')]=function(_0xf76a87,_0x587906,_0x3e8072,_0x360218){return new BPromise(function(_0x53cd5a,_0x1af65b){_0x360218=combineOptions(_0x360218);var _0x2200ec=new Buffer(_0x3e8072);var _0x536bbc=fs['createReadStream'](_0xf76a87);var _0x177141=fs[_0x7072('0x10')](_0x587906);var _0x2cac98=crypto[_0x7072('0x1a')](_0x360218[_0x7072('0x7')],_0x2200ec);_0x536bbc['on']('data',function(_0xe1f948){var _0x1ddf28=new Buffer(_0x2cac98[_0x7072('0x13')](_0xe1f948),'binary');_0x177141[_0x7072('0x15')](_0x1ddf28);});_0x536bbc['on']('end',function(){try{var _0x26d32e=new Buffer(_0x2cac98[_0x7072('0x16')]('binary'),'binary');_0x177141[_0x7072('0x15')](_0x26d32e);_0x177141[_0x7072('0x17')]();_0x177141['on'](_0x7072('0x1b'),function(){return _0x53cd5a(_0x587906);});}catch(_0x376d3d){fs[_0x7072('0x18')](_0x587906);return _0x1af65b(_0x376d3d);}});});};exports[_0x7072('0x1c')]=function(_0x5d3645,_0x59277e,_0x174d89){var _0x32994b=_0x174d89||stringOptions[_0x7072('0x7')];var _0x2989c5=_0x59277e||stringOptions[_0x7072('0x1d')];var _0x5c8207=crypto[_0x7072('0x11')](_0x32994b,_0x2989c5);var _0x26babf=_0x5c8207[_0x7072('0x13')](_0x5d3645,'utf8',_0x7072('0x1e'));_0x26babf+=_0x5c8207[_0x7072('0x16')](_0x7072('0x1e'));return _0x26babf;};exports['decryptString']=function(_0x29993b,_0x2b9f36,_0x1ea0fc){var _0x1a8146=_0x1ea0fc||stringOptions[_0x7072('0x7')];var _0x41f08a=_0x2b9f36||stringOptions[_0x7072('0x1d')];var _0x10acca=crypto[_0x7072('0x1a')](_0x1a8146,_0x41f08a);var _0x3dd586=_0x10acca[_0x7072('0x13')](_0x29993b,'base64',_0x7072('0x1f'));_0x3dd586+=_0x10acca[_0x7072('0x16')](_0x7072('0x1f'));return _0x3dd586;}; \ No newline at end of file +var _0x0e9c=['indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','createCipher','utf8','base64','decryptString','secret','bluebird','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter'];(function(_0x197043,_0x3ebf47){var _0x233e33=function(_0x17bd0f){while(--_0x17bd0f){_0x197043['push'](_0x197043['shift']());}};_0x233e33(++_0x3ebf47);}(_0x0e9c,0x17f));var _0xc0e9=function(_0x5784e6,_0xd4acb7){_0x5784e6=_0x5784e6-0x0;var _0x43c849=_0x0e9c[_0x5784e6];return _0x43c849;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc0e9('0x0'));var _=require('lodash');var config=require(_0xc0e9('0x1'));var logger=require(_0xc0e9('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc0e9('0x3')][_0xc0e9('0x4')],'algorithm':_0xc0e9('0x5')};const fileOptions={'algorithm':_0xc0e9('0x6')};if(config[_0xc0e9('0x7')]&&config[_0xc0e9('0x7')][_0xc0e9('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc0e9('0x7')]['algorithm']);if(isSupported){fileOptions[_0xc0e9('0x8')]=config[_0xc0e9('0x7')][_0xc0e9('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xc0e9('0x9')](config[_0xc0e9('0x7')][_0xc0e9('0x8')],_0xc0e9('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x3d05ca){return AES_SUPPORTED_RX['test'](_0x3d05ca);}function getSupportedCiphers(){return crypto[_0xc0e9('0xb')]()[_0xc0e9('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x58e08b){return getSupportedCiphers()[_0xc0e9('0xd')](_0x58e08b)>-0x1;}function combineOptions(_0x3be307){var _0x5b44c4={};for(var _0x470384 in fileOptions){if(fileOptions[_0xc0e9('0xe')](_0x470384)){_0x5b44c4[_0x470384]=fileOptions[_0x470384];}}if(_0x3be307){for(var _0x3a81b3 in _0x3be307){if(_0x3be307[_0xc0e9('0xe')](_0x3a81b3)){_0x5b44c4[_0x3a81b3]=_0x3be307[_0x3a81b3];}}}return _0x5b44c4;}exports['encryptFile']=function(_0x498d4f,_0x3a0213,_0xc7beed,_0x487903){return new BPromise(function(_0x1a3217,_0x1381b3){_0x487903=combineOptions(_0x487903);var _0x51be7b=new Buffer(_0xc7beed);var _0x5be2ac=fs[_0xc0e9('0xf')](_0x498d4f);var _0x35dd63=fs[_0xc0e9('0x10')](_0x3a0213);var _0x260886=crypto['createCipher'](_0x487903[_0xc0e9('0x8')],_0x51be7b);_0x5be2ac['on'](_0xc0e9('0x11'),function(_0x2e0268){var _0x85620c=new Buffer(_0x260886[_0xc0e9('0x12')](_0x2e0268),_0xc0e9('0x13'));_0x35dd63[_0xc0e9('0x14')](_0x85620c);});_0x5be2ac['on'](_0xc0e9('0x15'),function(){try{var _0x4b2af6=new Buffer(_0x260886[_0xc0e9('0x16')](_0xc0e9('0x13')),'binary');_0x35dd63[_0xc0e9('0x14')](_0x4b2af6);_0x35dd63[_0xc0e9('0x15')]();_0x35dd63['on'](_0xc0e9('0x17'),function(){return _0x1a3217(_0x3a0213);});}catch(_0x5807cd){fs[_0xc0e9('0x18')](_0x3a0213);return _0x1381b3(_0x5807cd);}});});};exports[_0xc0e9('0x19')]=function(_0x4384b7,_0x1a5058,_0x5c912b,_0x143371){return new BPromise(function(_0x51e837,_0x556b8e){_0x143371=combineOptions(_0x143371);var _0x30e6b5=new Buffer(_0x5c912b);var _0x1f673e=fs['createReadStream'](_0x4384b7);var _0x2b224f=fs['createWriteStream'](_0x1a5058);var _0x3d8ea1=crypto[_0xc0e9('0x1a')](_0x143371[_0xc0e9('0x8')],_0x30e6b5);_0x1f673e['on'](_0xc0e9('0x11'),function(_0x2a7dfc){var _0x4102d7=new Buffer(_0x3d8ea1[_0xc0e9('0x12')](_0x2a7dfc),'binary');_0x2b224f[_0xc0e9('0x14')](_0x4102d7);});_0x1f673e['on'](_0xc0e9('0x15'),function(){try{var _0x259efe=new Buffer(_0x3d8ea1[_0xc0e9('0x16')]('binary'),_0xc0e9('0x13'));_0x2b224f['write'](_0x259efe);_0x2b224f['end']();_0x2b224f['on'](_0xc0e9('0x17'),function(){return _0x51e837(_0x1a5058);});}catch(_0x5e5509){fs[_0xc0e9('0x18')](_0x1a5058);return _0x556b8e(_0x5e5509);}});});};exports[_0xc0e9('0x1b')]=function(_0xfdc79d,_0x2856f6,_0x32625c){var _0xff1281=_0x32625c||stringOptions[_0xc0e9('0x8')];var _0x5af180=_0x2856f6||stringOptions['secret'];var _0x27ea4a=crypto[_0xc0e9('0x1c')](_0xff1281,_0x5af180);var _0x6e3951=_0x27ea4a[_0xc0e9('0x12')](_0xfdc79d,_0xc0e9('0x1d'),_0xc0e9('0x1e'));_0x6e3951+=_0x27ea4a[_0xc0e9('0x16')]('base64');return _0x6e3951;};exports[_0xc0e9('0x1f')]=function(_0x4c6aaf,_0x55b818,_0x215a4a){var _0x322438=_0x215a4a||stringOptions[_0xc0e9('0x8')];var _0x185226=_0x55b818||stringOptions[_0xc0e9('0x20')];var _0x45d652=crypto[_0xc0e9('0x1a')](_0x322438,_0x185226);var _0x25950c=_0x45d652[_0xc0e9('0x12')](_0x4c6aaf,_0xc0e9('0x1e'),_0xc0e9('0x1d'));_0x25950c+=_0x45d652[_0xc0e9('0x16')]('utf8');return _0x25950c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1d662bb..2f0f780 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 _0x5729=['writeFileSync','zip','zip\x20finished','catch','inspect','Failed','exit','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','num','Empty','length','push','SELECT','dirname','.csv','join','mkdirSync','each','csv','%s.%s'];(function(_0xfcfa18,_0x2f924f){var _0xc27500=function(_0x597574){while(--_0x597574){_0xfcfa18['push'](_0xfcfa18['shift']());}};_0xc27500(++_0x2f924f);}(_0x5729,0x82));var _0x9572=function(_0x18fb4c,_0x578f22){_0x18fb4c=_0x18fb4c-0x0;var _0x4a75b3=_0x5729[_0x18fb4c];return _0x4a75b3;};'use strict';var util=require('util');var path=require(_0x9572('0x0'));var _=require(_0x9572('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x9572('0x2'));var rimraf=require(_0x9572('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9572('0x4'))[_0x9572('0x5')];var logger=require('../../config/logger')(_0x9572('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x9572('0x7')][0x2]);var QUERY=process[_0x9572('0x7')][0x3];var PATH=process[_0x9572('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x264fc4,_0x51ee86){var _0x1f3fee={'status':_0x264fc4};var _0x4fb07c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51ee86){_0x1f3fee[_0x9572('0x8')]=_0x51ee86;}return db[_0x9572('0x9')][_0x9572('0xa')](_0x1f3fee,_0x4fb07c);}function main(){var _0x13847b=0x1388;var _0x5d5f4d;logger[_0x9572('0xb')](util[_0x9572('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9572('0xd')));return db[_0x9572('0xe')][_0x9572('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9572('0x10'),_0x9572('0x11')]})[_0x9572('0x12')](function(_0x52f2db){if(_0x52f2db){_0x5d5f4d=_0x52f2db;_0x13847b=_0x5d5f4d[_0x9572('0x11')]||0x1388;}})['then'](function(){return dbH[_0x9572('0x13')][_0x9572('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9572('0x13')][_0x9572('0x15')]['SELECT']});})[_0x9572('0x12')](function(_0x431f35){if(!_0x431f35[0x0][_0x9572('0x16')]){return analyticExtractedReport(_0x9572('0x17'));}var _0x877a14=[];var _0x5977fd=0x0;if(_0x5d5f4d[_0x9572('0x10')]){if(_0x431f35&&_0x431f35[_0x9572('0x18')]){var _0x251dd4=_['range'](_0x431f35[0x0][_0x9572('0x16')]/_0x13847b);var _0x2667c2=Number['isInteger'](_0x431f35[0x0][_0x9572('0x16')]/_0x13847b)?_0x431f35[0x0][_0x9572('0x16')]%_0x13847b:0x0;_0x251dd4['forEach'](function(_0x2c43bb){if(_0x2c43bb>0x0){_0x5977fd+=_0x13847b;}_0x877a14[_0x9572('0x19')](dbH[_0x9572('0x13')][_0x9572('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x13847b,_0x5977fd),{'type':dbH[_0x9572('0x13')][_0x9572('0x15')][_0x9572('0x1a')]}));});if(_0x2667c2>0x0){_0x5977fd+=_0x13847b;_0x877a14[_0x9572('0x19')](dbH['sequelize'][_0x9572('0x14')](util[_0x9572('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2667c2,_0x5977fd),{'type':dbH['sequelize']['QueryTypes'][_0x9572('0x1a')]}));}}}else{_0x877a14[_0x9572('0x19')](dbH[_0x9572('0x13')]['query'](QUERY,{'type':dbH['sequelize'][_0x9572('0x15')][_0x9572('0x1a')]}));}var _0x16281f=path[_0x9572('0x1b')](PATH);var _0x2183e3=path['basename'](PATH,_0x9572('0x1c'));var _0x172f17=_0x5d5f4d[_0x9572('0x10')]&&_0x877a14[_0x9572('0x18')]>0x1;var _0x4dfd76=[];if(!fs['existsSync'](path[_0x9572('0x1d')](_0x16281f,_0x2183e3))&&_0x172f17){fs[_0x9572('0x1e')](path[_0x9572('0x1d')](_0x16281f,_0x2183e3));}return BPromise[_0x9572('0x1f')](_0x877a14,function(_0x22b668){_0x4dfd76[_0x9572('0x19')](_0x22b668);})['then'](function(){for(var _0x5200a8=0x0;_0x5200a8<_0x4dfd76['length'];_0x5200a8+=0x1){var _0x182a53;var _0x210b9e=_0x4dfd76[_0x5200a8];if(_0x172f17){_0x182a53=path[_0x9572('0x1d')](_0x16281f,_0x2183e3,util['format']('%s%d.%s',_0x2183e3,_0x5200a8,_0x9572('0x20')));}else{_0x182a53=path['join'](_0x16281f,util['format'](_0x9572('0x21'),_0x2183e3,_0x9572('0x20')));}fs[_0x9572('0x22')](_0x182a53,csv(_0x210b9e));}})[_0x9572('0x12')](function(){if(_0x172f17){return new Promise(function(_0x48558a){zipdir(path['join'](_0x16281f,_0x2183e3),{'saveTo':path[_0x9572('0x1d')](_0x16281f,util['format']('%s.%s',_0x2183e3,_0x9572('0x23')))},function(_0x23aec7,_0x3155fc){rimraf(path['join'](_0x16281f,_0x2183e3),function(){});_0x48558a(_0x9572('0x24'));});});}})[_0x9572('0x12')](function(){logger[_0x9572('0xb')](util[_0x9572('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9572('0xd')));return analyticExtractedReport('Completed',_0x172f17?util['format'](_0x9572('0x21'),_0x2183e3,_0x172f17?_0x9572('0x23'):_0x9572('0x20')):null);});})[_0x9572('0x25')](function(_0xbd9456){logger['info'](util[_0x9572('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9572('0xd')),util[_0x9572('0x26')](_0xbd9456,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9572('0x27'));})['finally'](function(){process[_0x9572('0x28')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa369=['Failed','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s.%s','writeFileSync','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x1b0d1e,_0x44baa5){var _0x1c74d7=function(_0x33cb41){while(--_0x33cb41){_0x1b0d1e['push'](_0x1b0d1e['shift']());}};_0x1c74d7(++_0x44baa5);}(_0xa369,0xc2));var _0x9a36=function(_0x5ce8cb,_0x17ef31){_0x5ce8cb=_0x5ce8cb-0x0;var _0x4e4a46=_0xa369[_0x5ce8cb];return _0x4e4a46;};'use strict';var util=require(_0x9a36('0x0'));var path=require(_0x9a36('0x1'));var _=require(_0x9a36('0x2'));var csv=require(_0x9a36('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x9a36('0x4'));var rimraf=require(_0x9a36('0x5'));var db=require(_0x9a36('0x6'))['db'];var dbH=require(_0x9a36('0x6'))['dbH'];var logger=require('../../config/logger')(_0x9a36('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9a36('0x8')][0x2]);var QUERY=process[_0x9a36('0x8')][0x3];var PATH=process[_0x9a36('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x505752,_0x59ceec){var _0x2ba3b8={'status':_0x505752};var _0x5b7abe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59ceec){_0x2ba3b8['savename']=_0x59ceec;}return db[_0x9a36('0x9')]['update'](_0x2ba3b8,_0x5b7abe);}function main(){var _0x1c2a8d=0x1388;var _0x50c7b2;logger['info'](util['format'](_0x9a36('0xa'),EXTRACTED_REPORT_ID,_0x9a36('0xb')));return db[_0x9a36('0xc')][_0x9a36('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9a36('0xe'),_0x9a36('0xf')]})['then'](function(_0x59cf98){if(_0x59cf98){_0x50c7b2=_0x59cf98;_0x1c2a8d=_0x50c7b2[_0x9a36('0xf')]||0x1388;}})[_0x9a36('0x10')](function(){return dbH[_0x9a36('0x11')][_0x9a36('0x12')](util[_0x9a36('0x13')](_0x9a36('0x14'),QUERY),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')]['SELECT']});})[_0x9a36('0x10')](function(_0x3a2da8){if(!_0x3a2da8[0x0]['num']){return analyticExtractedReport(_0x9a36('0x16'));}var _0x3ae114=[];var _0x4b62ae=0x0;if(_0x50c7b2[_0x9a36('0xe')]){if(_0x3a2da8&&_0x3a2da8[_0x9a36('0x17')]){var _0x1bfd00=_['range'](_0x3a2da8[0x0][_0x9a36('0x18')]/_0x1c2a8d);var _0x5045b6=Number['isInteger'](_0x3a2da8[0x0][_0x9a36('0x18')]/_0x1c2a8d)?_0x3a2da8[0x0][_0x9a36('0x18')]%_0x1c2a8d:0x0;_0x1bfd00[_0x9a36('0x19')](function(_0x37a496){if(_0x37a496>0x0){_0x4b62ae+=_0x1c2a8d;}_0x3ae114['push'](dbH['sequelize'][_0x9a36('0x12')](util['format'](_0x9a36('0x1a'),QUERY,_0x1c2a8d,_0x4b62ae),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));});if(_0x5045b6>0x0){_0x4b62ae+=_0x1c2a8d;_0x3ae114[_0x9a36('0x1c')](dbH[_0x9a36('0x11')]['query'](util[_0x9a36('0x13')](_0x9a36('0x1a'),QUERY,_0x5045b6,_0x4b62ae),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));}}}else{_0x3ae114[_0x9a36('0x1c')](dbH['sequelize'][_0x9a36('0x12')](QUERY,{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));}var _0x42a2b7=path[_0x9a36('0x1d')](PATH);var _0x133f07=path[_0x9a36('0x1e')](PATH,_0x9a36('0x1f'));var _0x397844=_0x50c7b2[_0x9a36('0xe')]&&_0x3ae114['length']>0x1;var _0x20dbcb=[];if(!fs[_0x9a36('0x20')](path['join'](_0x42a2b7,_0x133f07))&&_0x397844){fs[_0x9a36('0x21')](path[_0x9a36('0x22')](_0x42a2b7,_0x133f07));}return BPromise[_0x9a36('0x23')](_0x3ae114,function(_0x1746c1){_0x20dbcb[_0x9a36('0x1c')](_0x1746c1);})[_0x9a36('0x10')](function(){for(var _0x5a4b67=0x0;_0x5a4b67<_0x20dbcb[_0x9a36('0x17')];_0x5a4b67+=0x1){var _0x212f6f;var _0x5c5465=_0x20dbcb[_0x5a4b67];if(_0x397844){_0x212f6f=path[_0x9a36('0x22')](_0x42a2b7,_0x133f07,util[_0x9a36('0x13')]('%s%d.%s',_0x133f07,_0x5a4b67,'csv'));}else{_0x212f6f=path['join'](_0x42a2b7,util[_0x9a36('0x13')](_0x9a36('0x24'),_0x133f07,'csv'));}fs[_0x9a36('0x25')](_0x212f6f,csv(_0x5c5465));}})['then'](function(){if(_0x397844){return new Promise(function(_0x329318){zipdir(path[_0x9a36('0x22')](_0x42a2b7,_0x133f07),{'saveTo':path[_0x9a36('0x22')](_0x42a2b7,util[_0x9a36('0x13')](_0x9a36('0x24'),_0x133f07,'zip'))},function(_0xa90e90,_0x1df09c){rimraf(path[_0x9a36('0x22')](_0x42a2b7,_0x133f07),function(){});_0x329318(_0x9a36('0x26'));});});}})[_0x9a36('0x10')](function(){logger[_0x9a36('0x27')](util[_0x9a36('0x13')](_0x9a36('0x28'),EXTRACTED_REPORT_ID,_0x9a36('0xb')));return analyticExtractedReport('Completed',_0x397844?util['format'](_0x9a36('0x24'),_0x133f07,_0x397844?_0x9a36('0x29'):_0x9a36('0x2a')):null);});})[_0x9a36('0x2b')](function(_0x5e1414){logger['info'](util['format'](_0x9a36('0x2c'),EXTRACTED_REPORT_ID,_0x9a36('0xb')),util[_0x9a36('0x2d')](_0x5e1414,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9a36('0x2e'));})['finally'](function(){process[_0x9a36('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5ed586b..9e12a2c 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 _0xe58c=['push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','split','then','range','isInteger','num','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body'];(function(_0x3867ac,_0x2ce84a){var _0x3b0023=function(_0x1f5f9e){while(--_0x1f5f9e){_0x3867ac['push'](_0x3867ac['shift']());}};_0x3b0023(++_0x2ce84a);}(_0xe58c,0xa1));var _0xce58=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe58c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xce58('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xce58('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xce58('0x2'));var PdfPrinter=require(_0xce58('0x3'));var zipdir=require(_0xce58('0x4'));var rimraf=require(_0xce58('0x5'));var JSDOM=require('jsdom')[_0xce58('0x6')];var window=new JSDOM('')[_0xce58('0x7')];var BPromise=require(_0xce58('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0xce58('0x9'))[_0xce58('0xa')];var logger=require(_0xce58('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xce58('0xc')][0x3];var PATH=process[_0xce58('0xc')][0x4];var NAME=process[_0xce58('0xc')][0x5];var FORMAT=_0xce58('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1281c5,_0x4c29bd){var _0x2fd2b2={'status':_0x1281c5};var _0x47c8a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c29bd){_0x2fd2b2[_0xce58('0xe')]=_0x4c29bd;}return db['AnalyticExtractedReport'][_0xce58('0xf')](_0x2fd2b2,_0x47c8a3);}function getHeaders(_0x2118db){return _[_0xce58('0x10')](_0x2118db,function(_0x79984b){return{'text':_0x79984b,'style':_0xce58('0x11')};});}function getRows(_0x26008c,_0xc4362c){return _[_0xce58('0x10')](_0xc4362c,function(_0x37edfe){return _(_0x37edfe)[_0xce58('0x12')](_0x26008c)['map'](function(_0x284a89){return _0x284a89?_[_0xce58('0x13')](_0x284a89):'';})[_0xce58('0x14')]();});}function createTable(_0x361045,_0x4fcd5a){var _0x38f230={'widths':_[_0xce58('0x15')](Array(_0x361045[_0xce58('0x16')]),0x91),'heights':function(_0x2fa4a9){return _0x2fa4a9===0x0?_0xce58('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x20ac5c=getHeaders(_0x361045);_0x38f230[_0xce58('0x18')][_0xce58('0x19')](_0x20ac5c);var _0x3748d3=getRows(_0x361045,_0x4fcd5a);_0x38f230[_0xce58('0x18')]=_0x38f230['body'][_0xce58('0x1a')](_0x3748d3);return _0x38f230;}function createTables(_0x30ee36){var _0x2a293a=[];var _0x5569f5=_[_0xce58('0x1b')](Object['keys'](_0x30ee36[0x0]),0x5);_0x5569f5[_0xce58('0x1c')](function(_0xc07d34){_0x2a293a['push'](createTable(_0xc07d34,_0x30ee36));});return _0x2a293a;}function getPDFDocDefinition(_0x2bac2c){var _0x1e178e=util[_0xce58('0x1d')](_0xce58('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xce58('0x1f')])[_0xce58('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xce58('0x1d')](FORMAT));var _0x53f15c=[];for(var _0x40bc67=0x0;_0x40bc67<_0x2bac2c['length'];_0x40bc67++){var _0x41c945=[];if(_0x40bc67===0x0){_0x41c945['push']({'text':_0x1e178e,'style':_0xce58('0x20')});}var _0x15508e={'table':_0x2bac2c[_0x40bc67]};if(_0x40bc67>0x0){_0x15508e[_0xce58('0x21')]=_0xce58('0x22');_0x15508e[_0xce58('0x23')]=[0x0,0x46,0x0,0x0];}_0x41c945[_0xce58('0x19')](_0x15508e);_0x53f15c[_0xce58('0x19')](_0x41c945);}return{'pageSize':'A4','pageOrientation':_0xce58('0x24'),'content':_0x53f15c,'footer':function(_0x10dfb4,_0x3113c8){return{'text':_0x10dfb4['toString']()+_0xce58('0x25')+_0x3113c8,'style':_0xce58('0x26')};},'defaultStyle':{'font':_0xce58('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xce58('0x28')},'footer':{'alignment':_0xce58('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xc0c632){var _0x53da39=0x1388;var _0x317855;if(!_0xc0c632[0x0]['num']){return analyticExtractedReport(_0xce58('0x2a'));}return db[_0xce58('0x2b')][_0xce58('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xce58('0x2d'),'splitSizePdf']})[_0xce58('0x2e')](function(_0x1241f3){if(_0x1241f3){_0x317855=_0x1241f3;_0x53da39=_0x317855['splitSizePdf']||0x3e8;}})['then'](function(){var _0x5dbc52=[];var _0x5050fc=0x0;if(_0x317855['split']){if(_0xc0c632&&_0xc0c632[_0xce58('0x16')]){var _0x433f86=_[_0xce58('0x2f')](_0xc0c632[0x0]['num']/_0x53da39);var _0x263b0d=Number[_0xce58('0x30')](_0xc0c632[0x0][_0xce58('0x31')]/_0x53da39)?_0xc0c632[0x0]['num']%_0x53da39:0x0;_0x433f86[_0xce58('0x1c')](function(_0xf48c31){if(_0xf48c31>0x0){_0x5050fc+=_0x53da39;}_0x5dbc52[_0xce58('0x19')](dbH[_0xce58('0x32')][_0xce58('0x33')](util[_0xce58('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x53da39,_0x5050fc),{'type':dbH[_0xce58('0x32')]['QueryTypes'][_0xce58('0x34')]}));});if(_0x263b0d>0x0){_0x5050fc+=_0x53da39;_0x5dbc52[_0xce58('0x19')](dbH[_0xce58('0x32')]['query'](util[_0xce58('0x1d')](_0xce58('0x35'),QUERY,_0x263b0d,_0x5050fc),{'type':dbH[_0xce58('0x32')][_0xce58('0x36')]['SELECT']}));}}}else{_0x5dbc52['push'](dbH[_0xce58('0x32')][_0xce58('0x33')](QUERY,{'type':dbH[_0xce58('0x32')][_0xce58('0x36')][_0xce58('0x34')]}));}var _0x45d5ed=path[_0xce58('0x37')](PATH);var _0x16b73f=path[_0xce58('0x38')](PATH,_0xce58('0x39'));var _0x35ec8d=_0x317855['split']&&_0x5dbc52[_0xce58('0x16')]>0x1;var _0x2a5fcf=[];if(!fs['existsSync'](path[_0xce58('0x3a')](_0x45d5ed,_0x16b73f))&&_0x35ec8d){fs[_0xce58('0x3b')](path[_0xce58('0x3a')](_0x45d5ed,_0x16b73f));}return BPromise[_0xce58('0x3c')](_0x5dbc52,function(_0x29d1f8){_0x2a5fcf['push'](_0x29d1f8);})[_0xce58('0x2e')](function(){var _0x429ec0=[];for(var _0x234586=0x0;_0x234586<_0x2a5fcf[_0xce58('0x16')];_0x234586+=0x1){var _0x46f643=_0x2a5fcf[_0x234586];var _0x7cf825=createTables(_[_0xce58('0x3d')](_0x46f643));var _0x4c995e;var _0x35ad7e=getPDFDocDefinition(_0x7cf825);var _0x2452d4=getPDFPrinter();var _0x19320f=_0x2452d4[_0xce58('0x3e')](_0x35ad7e);if(_0x35ec8d){_0x4c995e=path[_0xce58('0x3a')](_0x45d5ed,_0x16b73f,util[_0xce58('0x1d')]('%s%d.%s',_0x16b73f,_0x234586,_0xce58('0x3f')));}else{_0x4c995e=path['join'](_0x45d5ed,util[_0xce58('0x1d')](_0xce58('0x40'),_0x16b73f,_0xce58('0x3f')));}_0x429ec0[_0xce58('0x19')](writePDFDocument(_0x19320f,_0x4c995e));}return Promise[_0xce58('0x41')](_0x429ec0);})[_0xce58('0x2e')](function(){if(_0x35ec8d){return new Promise(function(_0x21bdda){zipdir(path[_0xce58('0x3a')](_0x45d5ed,_0x16b73f),{'saveTo':path[_0xce58('0x3a')](_0x45d5ed,util['format'](_0xce58('0x40'),_0x16b73f,_0xce58('0x42')))},function(){rimraf(path['join'](_0x45d5ed,_0x16b73f),function(){});_0x21bdda(_0xce58('0x43'));});});}})[_0xce58('0x2e')](function(){if(!_0x35ec8d)return;rimraf(path[_0xce58('0x3a')](_0x45d5ed,_0x16b73f),function(){});})[_0xce58('0x2e')](function(){logger[_0xce58('0x44')](util[_0xce58('0x1d')](_0xce58('0x45'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xce58('0x46'),_0x35ec8d?util['format'](_0xce58('0x40'),_0x16b73f,_0x35ec8d?_0xce58('0x42'):_0xce58('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xce58('0x44')](util[_0xce58('0x1d')](_0xce58('0x47'),EXTRACTED_REPORT_ID,_0xce58('0x48')));return db[_0xce58('0x49')][_0xce58('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xce58('0x2e')](function(_0x2524a1){EXTRACTED_REPORT=_0x2524a1;return dbH[_0xce58('0x32')][_0xce58('0x33')](util[_0xce58('0x1d')](_0xce58('0x4b'),QUERY),{'type':dbH[_0xce58('0x32')]['QueryTypes'][_0xce58('0x34')]});})[_0xce58('0x2e')](extractReport)[_0xce58('0x4c')](function(_0x13784a){logger[_0xce58('0x44')](util[_0xce58('0x1d')](_0xce58('0x4d'),EXTRACTED_REPORT_ID,'PDF'),util[_0xce58('0x4e')](_0x13784a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xce58('0x4f')](function(){process[_0xce58('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3c1ddf=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xce58('0x51'),'bolditalics':__dirname+_0xce58('0x52')}});return _0x3c1ddf;}function getPDFDocDefinitionFromHTML(_0x47da17,_0x3c0a93){var _0x95357c=util[_0xce58('0x1d')]('%s\x20#%d',_0x3c0a93[_0xce58('0x53')],_0x3c0a93[_0xce58('0x54')]);var _0x4eff9a=moment()['format'](_0xce58('0x55'))[_0xce58('0x13')]();var _0x4e8fad=htmlToPdfmake(_0x47da17,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4e8fad],'defaultStyle':{'font':_0xce58('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xce58('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xce58('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xce58('0x57'),'style':_0xce58('0x20')}];},'footer':function(_0x13cfb4,_0x3d9445){return[{'text':util[_0xce58('0x1d')](_0xce58('0x58'),_0x95357c,_0x13cfb4,_0x3d9445,_0x4eff9a),'style':_0xce58('0x26')}];}};}function writePDFDocument(_0x1959ce,_0x4838c3){return new Promise(function(_0x192209,_0x495a79){var _0x28a464=_0x1959ce[_0xce58('0x59')](fs['createWriteStream'](_0x4838c3));_0x28a464['on']('finish',function(){_0x192209(_0xce58('0x5a'));});_0x28a464['on']('error',function(_0x5d3660){_0x495a79(_0x5d3660);});_0x1959ce[_0xce58('0x5b')]();});}exports[_0xce58('0x5c')]=function(_0x36e98f,_0x3d00fe){var _0x26351e=getPDFPrinter();var _0x4294ab=getPDFDocDefinitionFromHTML(_0x36e98f,_0x3d00fe);var _0x259f6c=_0x26351e[_0xce58('0x3e')](_0x4294ab);return writePDFDocument(_0x259f6c,_0x3d00fe[_0xce58('0x1')])[_0xce58('0x4c')](function(_0xc48c7c){throw _0xc48c7c;});}; \ No newline at end of file +var _0xcaf9=['before','landscape','\x20/\x20','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xcaf9,0xf9));var _0x9caf=function(_0x12d67c,_0x55c1fb){_0x12d67c=_0x12d67c-0x0;var _0x35d2c6=_0xcaf9[_0x12d67c];return _0x35d2c6;};'use strict';var _=require(_0x9caf('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x9caf('0x1'));var moment=require(_0x9caf('0x2'));var htmlToPdfmake=require(_0x9caf('0x3'));var PdfPrinter=require(_0x9caf('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x9caf('0x5'));var JSDOM=require('jsdom')[_0x9caf('0x6')];var window=new JSDOM('')[_0x9caf('0x7')];var BPromise=require(_0x9caf('0x8'));var db=require(_0x9caf('0x9'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x9caf('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9caf('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x9caf('0xb')][0x5];var FORMAT=_0x9caf('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f357e,_0x2e525b){var _0x3b107d={'status':_0x1f357e};var _0xe969ff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e525b){_0x3b107d['savename']=_0x2e525b;}return db[_0x9caf('0xd')][_0x9caf('0xe')](_0x3b107d,_0xe969ff);}function getHeaders(_0x3dbdd4){return _['map'](_0x3dbdd4,function(_0x65c4c){return{'text':_0x65c4c,'style':_0x9caf('0xf')};});}function getRows(_0x4f5ce8,_0xcb8a81){return _[_0x9caf('0x10')](_0xcb8a81,function(_0x291c1f){return _(_0x291c1f)['pick'](_0x4f5ce8)[_0x9caf('0x10')](function(_0x331b8c){return _0x331b8c?_[_0x9caf('0x11')](_0x331b8c):'';})[_0x9caf('0x12')]();});}function createTable(_0x14a7d9,_0xb12f6){var _0x4dd9d4={'widths':_[_0x9caf('0x13')](Array(_0x14a7d9[_0x9caf('0x14')]),0x91),'heights':function(_0x52fcb2){return _0x52fcb2===0x0?_0x9caf('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x29caa6=getHeaders(_0x14a7d9);_0x4dd9d4[_0x9caf('0x16')][_0x9caf('0x17')](_0x29caa6);var _0x369dd0=getRows(_0x14a7d9,_0xb12f6);_0x4dd9d4[_0x9caf('0x16')]=_0x4dd9d4['body']['concat'](_0x369dd0);return _0x4dd9d4;}function createTables(_0x440e60){var _0x34be42=[];var _0x32e7ad=_[_0x9caf('0x18')](Object[_0x9caf('0x19')](_0x440e60[0x0]),0x5);_0x32e7ad['forEach'](function(_0x57669e){_0x34be42[_0x9caf('0x17')](createTable(_0x57669e,_0x440e60));});return _0x34be42;}function getPDFDocDefinition(_0x1bb007){var _0x259384=util[_0x9caf('0x1a')](_0x9caf('0x1b'),NAME,EXTRACTED_REPORT[_0x9caf('0x1c')],moment(EXTRACTED_REPORT[_0x9caf('0x1d')])[_0x9caf('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x9caf('0x1e')])[_0x9caf('0x1a')](FORMAT));var _0x5eec27=[];for(var _0x3ef333=0x0;_0x3ef333<_0x1bb007[_0x9caf('0x14')];_0x3ef333++){var _0x97b508=[];if(_0x3ef333===0x0){_0x97b508[_0x9caf('0x17')]({'text':_0x259384,'style':_0x9caf('0x1f')});}var _0x503d5={'table':_0x1bb007[_0x3ef333]};if(_0x3ef333>0x0){_0x503d5[_0x9caf('0x20')]=_0x9caf('0x21');_0x503d5['margin']=[0x0,0x46,0x0,0x0];}_0x97b508[_0x9caf('0x17')](_0x503d5);_0x5eec27['push'](_0x97b508);}return{'pageSize':'A4','pageOrientation':_0x9caf('0x22'),'content':_0x5eec27,'footer':function(_0x166b9c,_0x3afcbe){return{'text':_0x166b9c[_0x9caf('0x11')]()+_0x9caf('0x23')+_0x3afcbe,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9caf('0x24')},'footer':{'alignment':_0x9caf('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11df84){var _0x119154=0x1388;var _0x6edf8f;if(!_0x11df84[0x0][_0x9caf('0x26')]){return analyticExtractedReport(_0x9caf('0x27'));}return db[_0x9caf('0x28')][_0x9caf('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9caf('0x2a'),'splitSizePdf']})[_0x9caf('0x2b')](function(_0x2e1907){if(_0x2e1907){_0x6edf8f=_0x2e1907;_0x119154=_0x6edf8f[_0x9caf('0x2c')]||0x3e8;}})['then'](function(){var _0x297dd0=[];var _0x22e231=0x0;if(_0x6edf8f['split']){if(_0x11df84&&_0x11df84[_0x9caf('0x14')]){var _0x2126b9=_[_0x9caf('0x2d')](_0x11df84[0x0][_0x9caf('0x26')]/_0x119154);var _0xade01b=Number[_0x9caf('0x2e')](_0x11df84[0x0]['num']/_0x119154)?_0x11df84[0x0][_0x9caf('0x26')]%_0x119154:0x0;_0x2126b9[_0x9caf('0x2f')](function(_0x1ec872){if(_0x1ec872>0x0){_0x22e231+=_0x119154;}_0x297dd0['push'](dbH[_0x9caf('0x30')][_0x9caf('0x31')](util['format'](_0x9caf('0x32'),QUERY,_0x119154,_0x22e231),{'type':dbH[_0x9caf('0x30')]['QueryTypes'][_0x9caf('0x33')]}));});if(_0xade01b>0x0){_0x22e231+=_0x119154;_0x297dd0[_0x9caf('0x17')](dbH[_0x9caf('0x30')]['query'](util[_0x9caf('0x1a')](_0x9caf('0x32'),QUERY,_0xade01b,_0x22e231),{'type':dbH[_0x9caf('0x30')][_0x9caf('0x34')][_0x9caf('0x33')]}));}}}else{_0x297dd0[_0x9caf('0x17')](dbH[_0x9caf('0x30')][_0x9caf('0x31')](QUERY,{'type':dbH[_0x9caf('0x30')][_0x9caf('0x34')][_0x9caf('0x33')]}));}var _0x233112=path[_0x9caf('0x35')](PATH);var _0x589de2=path[_0x9caf('0x36')](PATH,_0x9caf('0x37'));var _0x1e39fb=_0x6edf8f[_0x9caf('0x2a')]&&_0x297dd0[_0x9caf('0x14')]>0x1;var _0x69859d=[];if(!fs[_0x9caf('0x38')](path[_0x9caf('0x39')](_0x233112,_0x589de2))&&_0x1e39fb){fs[_0x9caf('0x3a')](path[_0x9caf('0x39')](_0x233112,_0x589de2));}return BPromise['each'](_0x297dd0,function(_0x211f7e){_0x69859d[_0x9caf('0x17')](_0x211f7e);})[_0x9caf('0x2b')](function(){var _0x34d09b=[];for(var _0x1a5901=0x0;_0x1a5901<_0x69859d['length'];_0x1a5901+=0x1){var _0x566ac1=_0x69859d[_0x1a5901];var _0x2d3d24=createTables(_[_0x9caf('0x3b')](_0x566ac1));var _0x9ac9b1;var _0x149564=getPDFDocDefinition(_0x2d3d24);var _0x110d2b=getPDFPrinter();var _0x50b8d2=_0x110d2b['createPdfKitDocument'](_0x149564);if(_0x1e39fb){_0x9ac9b1=path[_0x9caf('0x39')](_0x233112,_0x589de2,util['format'](_0x9caf('0x3c'),_0x589de2,_0x1a5901,_0x9caf('0x3d')));}else{_0x9ac9b1=path['join'](_0x233112,util[_0x9caf('0x1a')](_0x9caf('0x3e'),_0x589de2,_0x9caf('0x3d')));}_0x34d09b[_0x9caf('0x17')](writePDFDocument(_0x50b8d2,_0x9ac9b1));}return Promise['all'](_0x34d09b);})[_0x9caf('0x2b')](function(){if(_0x1e39fb){return new Promise(function(_0x51be0e){zipdir(path[_0x9caf('0x39')](_0x233112,_0x589de2),{'saveTo':path[_0x9caf('0x39')](_0x233112,util[_0x9caf('0x1a')](_0x9caf('0x3e'),_0x589de2,'zip'))},function(){rimraf(path['join'](_0x233112,_0x589de2),function(){});_0x51be0e(_0x9caf('0x3f'));});});}})[_0x9caf('0x2b')](function(){if(!_0x1e39fb)return;rimraf(path[_0x9caf('0x39')](_0x233112,_0x589de2),function(){});})[_0x9caf('0x2b')](function(){logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x41'),EXTRACTED_REPORT_ID,_0x9caf('0x42')));return analyticExtractedReport(_0x9caf('0x43'),_0x1e39fb?util['format'](_0x9caf('0x3e'),_0x589de2,_0x1e39fb?_0x9caf('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x45'),EXTRACTED_REPORT_ID,_0x9caf('0x42')));return db[_0x9caf('0xd')][_0x9caf('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9caf('0x2b')](function(_0x5346a8){EXTRACTED_REPORT=_0x5346a8;return dbH[_0x9caf('0x30')][_0x9caf('0x31')](util[_0x9caf('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9caf('0x34')][_0x9caf('0x33')]});})[_0x9caf('0x2b')](extractReport)['catch'](function(_0x11a949){logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x47'),EXTRACTED_REPORT_ID,_0x9caf('0x42')),util[_0x9caf('0x48')](_0x11a949,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9caf('0x49'));})[_0x9caf('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9d8752=new PdfPrinter({'Arial':{'normal':__dirname+_0x9caf('0x4b'),'bold':__dirname+_0x9caf('0x4c'),'italics':__dirname+_0x9caf('0x4d'),'bolditalics':__dirname+_0x9caf('0x4e')}});return _0x9d8752;}function getPDFDocDefinitionFromHTML(_0x21697b,_0x3f1711){var _0x595d21=util[_0x9caf('0x1a')](_0x9caf('0x4f'),_0x3f1711[_0x9caf('0x50')],_0x3f1711[_0x9caf('0x51')]);var _0x47a0c8=moment()['format'](_0x9caf('0x52'))[_0x9caf('0x11')]();var _0x1692ba=htmlToPdfmake(_0x21697b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1692ba],'defaultStyle':{'font':_0x9caf('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9caf('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9caf('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9caf('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x9caf('0x1f')}];},'footer':function(_0x24bd40,_0x266b07){return[{'text':util[_0x9caf('0x1a')](_0x9caf('0x55'),_0x595d21,_0x24bd40,_0x266b07,_0x47a0c8),'style':_0x9caf('0x56')}];}};}function writePDFDocument(_0x113d9a,_0xb578d8){return new Promise(function(_0xed04d3,_0x56c52f){var _0x3ebbae=_0x113d9a[_0x9caf('0x57')](fs[_0x9caf('0x58')](_0xb578d8));_0x3ebbae['on'](_0x9caf('0x59'),function(){_0xed04d3(_0x9caf('0x59'));});_0x3ebbae['on'](_0x9caf('0x5a'),function(_0x2b5d7a){_0x56c52f(_0x2b5d7a);});_0x113d9a['end']();});}exports[_0x9caf('0x5b')]=function(_0x24d788,_0x3972f2){var _0x55cbc7=getPDFPrinter();var _0x39fa88=getPDFDocDefinitionFromHTML(_0x24d788,_0x3972f2);var _0x881bbc=_0x55cbc7[_0x9caf('0x5c')](_0x39fa88);return writePDFDocument(_0x881bbc,_0x3972f2[_0x9caf('0x1')])[_0x9caf('0x5d')](function(_0x2338c5){throw _0x2338c5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 115fecb..dacf412 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 _0xc25d=['find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','each','xlsx','%s.%s','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','exit','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','argv','savename','info','format','XLSX'];(function(_0x3dff07,_0x4f0b02){var _0x29b11f=function(_0x838768){while(--_0x838768){_0x3dff07['push'](_0x3dff07['shift']());}};_0x29b11f(++_0x4f0b02);}(_0xc25d,0x1ee));var _0xdc25=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xc25d[_0xae7c2f];return _0x5d7001;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xdc25('0x0'));var BPromise=require(_0xdc25('0x1'));var zipdir=require('zip-dir');var rimraf=require(_0xdc25('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0xdc25('0x3'))['dbH'];var logger=require(_0xdc25('0x4'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdc25('0x5')][0x2]);var QUERY=process[_0xdc25('0x5')][0x3];var PATH=process[_0xdc25('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ce700,_0x268e0d){var _0x16ada1={'status':_0x1ce700};var _0x47bba0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x268e0d){_0x16ada1[_0xdc25('0x6')]=_0x268e0d;}return db['AnalyticExtractedReport']['update'](_0x16ada1,_0x47bba0);}function main(){var _0xe38c6b=0x1388;var _0x148ef6;logger[_0xdc25('0x7')](util[_0xdc25('0x8')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdc25('0x9')));return db['Setting'][_0xdc25('0xa')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xdc25('0xb')]})[_0xdc25('0xc')](function(_0x3e2f24){if(_0x3e2f24){_0x148ef6=_0x3e2f24;_0xe38c6b=_0x148ef6[_0xdc25('0xb')]||0x1388;}})[_0xdc25('0xc')](function(){return dbH[_0xdc25('0xd')][_0xdc25('0xe')](util[_0xdc25('0x8')](_0xdc25('0xf'),QUERY),{'type':dbH[_0xdc25('0xd')][_0xdc25('0x10')][_0xdc25('0x11')]});})[_0xdc25('0xc')](function(_0x9b5078){if(!_0x9b5078[0x0]['num']){return analyticExtractedReport('Empty');}var _0x501182=[];var _0x1a796b=0x0;if(_0x148ef6[_0xdc25('0x12')]){if(_0x9b5078&&_0x9b5078['length']){var _0x59578b=_['range'](_0x9b5078[0x0]['num']/_0xe38c6b);var _0x52234c=Number['isInteger'](_0x9b5078[0x0]['num']/_0xe38c6b)?_0x9b5078[0x0][_0xdc25('0x13')]%_0xe38c6b:0x0;_0x59578b[_0xdc25('0x14')](function(_0x315166){if(_0x315166>0x0){_0x1a796b+=_0xe38c6b;}_0x501182[_0xdc25('0x15')](dbH[_0xdc25('0xd')]['query'](util[_0xdc25('0x8')](_0xdc25('0x16'),QUERY,_0xe38c6b,_0x1a796b),{'type':dbH[_0xdc25('0xd')][_0xdc25('0x10')][_0xdc25('0x11')]}));});if(_0x52234c>0x0){_0x1a796b+=_0xe38c6b;_0x501182[_0xdc25('0x15')](dbH['sequelize'][_0xdc25('0xe')](util['format'](_0xdc25('0x16'),QUERY,_0x52234c,_0x1a796b),{'type':dbH[_0xdc25('0xd')][_0xdc25('0x10')][_0xdc25('0x11')]}));}}}else{_0x501182[_0xdc25('0x15')](dbH['sequelize'][_0xdc25('0xe')](QUERY,{'type':dbH[_0xdc25('0xd')][_0xdc25('0x10')][_0xdc25('0x11')]}));}var _0x68e07e=path[_0xdc25('0x17')](PATH);var _0x5150cc=path[_0xdc25('0x18')](PATH,_0xdc25('0x19'));var _0x3ce867=_0x148ef6['split']&&_0x501182[_0xdc25('0x1a')]>0x1;var _0x28be18=[];if(!fs[_0xdc25('0x1b')](path[_0xdc25('0x1c')](_0x68e07e,_0x5150cc))&&_0x3ce867){fs['mkdirSync'](path[_0xdc25('0x1c')](_0x68e07e,_0x5150cc));}return BPromise[_0xdc25('0x1d')](_0x501182,function(_0x1ae349){_0x28be18[_0xdc25('0x15')](_0x1ae349);})[_0xdc25('0xc')](function(){for(var _0x2259f7=0x0;_0x2259f7<_0x28be18[_0xdc25('0x1a')];_0x2259f7+=0x1){var _0x3de1fd;var _0x3fe3a5=_0x28be18[_0x2259f7];if(_0x3ce867){_0x3de1fd=path[_0xdc25('0x1c')](_0x68e07e,_0x5150cc,util[_0xdc25('0x8')]('%s%d.%s',_0x5150cc,_0x2259f7,_0xdc25('0x1e')));}else{_0x3de1fd=path['join'](_0x68e07e,util[_0xdc25('0x8')](_0xdc25('0x1f'),_0x5150cc,_0xdc25('0x1e')));}fs['writeFileSync'](_0x3de1fd,json2xls(_0x3fe3a5),_0xdc25('0x20'));}})['then'](function(){if(_0x3ce867){return new Promise(function(_0x1aab43){zipdir(path['join'](_0x68e07e,_0x5150cc),{'saveTo':path['join'](_0x68e07e,util[_0xdc25('0x8')](_0xdc25('0x1f'),_0x5150cc,_0xdc25('0x21')))},function(_0x51f943,_0x4eeda6){rimraf(path['join'](_0x68e07e,_0x5150cc),function(){});_0x1aab43(_0xdc25('0x22'));});});}})[_0xdc25('0xc')](function(){logger['info'](util['format'](_0xdc25('0x23'),EXTRACTED_REPORT_ID,_0xdc25('0x9')));return analyticExtractedReport(_0xdc25('0x24'),_0x3ce867?util['format']('%s.%s',_0x5150cc,_0x3ce867?_0xdc25('0x21'):'xlsx'):null);});})[_0xdc25('0x25')](function(_0x55424d){logger[_0xdc25('0x7')](util[_0xdc25('0x8')](_0xdc25('0x26'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xdc25('0x27')](_0x55424d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdc25('0x28'));})['finally'](function(){process[_0xdc25('0x29')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7522=['basename','.xlsx','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','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','length','range','isInteger','num','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push'];(function(_0x31147e,_0x2ff5b9){var _0x395bf8=function(_0x4bdec4){while(--_0x4bdec4){_0x31147e['push'](_0x31147e['shift']());}};_0x395bf8(++_0x2ff5b9);}(_0x7522,0xe3));var _0x2752=function(_0x186ee2,_0x56a3e6){_0x186ee2=_0x186ee2-0x0;var _0x2bce70=_0x7522[_0x186ee2];return _0x2bce70;};'use strict';var util=require(_0x2752('0x0'));var path=require(_0x2752('0x1'));var _=require(_0x2752('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x2752('0x3'));var zipdir=require(_0x2752('0x4'));var rimraf=require('rimraf');var db=require(_0x2752('0x5'))['db'];var dbH=require(_0x2752('0x5'))[_0x2752('0x6')];var logger=require(_0x2752('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2752('0x8')][0x2]);var QUERY=process[_0x2752('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x167416,_0x2aac8a){var _0x2139c8={'status':_0x167416};var _0x488e48={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2aac8a){_0x2139c8[_0x2752('0x9')]=_0x2aac8a;}return db[_0x2752('0xa')][_0x2752('0xb')](_0x2139c8,_0x488e48);}function main(){var _0x2c1f8e=0x1388;var _0x57b1df;logger[_0x2752('0xc')](util['format'](_0x2752('0xd'),EXTRACTED_REPORT_ID,_0x2752('0xe')));return db[_0x2752('0xf')][_0x2752('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2752('0x11'),_0x2752('0x12')]})[_0x2752('0x13')](function(_0x12b816){if(_0x12b816){_0x57b1df=_0x12b816;_0x2c1f8e=_0x57b1df['splitSizeXlsx']||0x1388;}})[_0x2752('0x13')](function(){return dbH[_0x2752('0x14')][_0x2752('0x15')](util['format'](_0x2752('0x16'),QUERY),{'type':dbH['sequelize'][_0x2752('0x17')]['SELECT']});})[_0x2752('0x13')](function(_0x1f9099){if(!_0x1f9099[0x0]['num']){return analyticExtractedReport('Empty');}var _0x185575=[];var _0x16551e=0x0;if(_0x57b1df[_0x2752('0x11')]){if(_0x1f9099&&_0x1f9099[_0x2752('0x18')]){var _0x12727b=_[_0x2752('0x19')](_0x1f9099[0x0]['num']/_0x2c1f8e);var _0x455f99=Number[_0x2752('0x1a')](_0x1f9099[0x0][_0x2752('0x1b')]/_0x2c1f8e)?_0x1f9099[0x0][_0x2752('0x1b')]%_0x2c1f8e:0x0;_0x12727b[_0x2752('0x1c')](function(_0x25bb4d){if(_0x25bb4d>0x0){_0x16551e+=_0x2c1f8e;}_0x185575['push'](dbH[_0x2752('0x14')][_0x2752('0x15')](util[_0x2752('0x1d')](_0x2752('0x1e'),QUERY,_0x2c1f8e,_0x16551e),{'type':dbH['sequelize'][_0x2752('0x17')][_0x2752('0x1f')]}));});if(_0x455f99>0x0){_0x16551e+=_0x2c1f8e;_0x185575['push'](dbH['sequelize'][_0x2752('0x15')](util[_0x2752('0x1d')](_0x2752('0x1e'),QUERY,_0x455f99,_0x16551e),{'type':dbH[_0x2752('0x14')][_0x2752('0x17')][_0x2752('0x1f')]}));}}}else{_0x185575[_0x2752('0x20')](dbH[_0x2752('0x14')][_0x2752('0x15')](QUERY,{'type':dbH[_0x2752('0x14')][_0x2752('0x17')][_0x2752('0x1f')]}));}var _0x219771=path['dirname'](PATH);var _0x4b2772=path[_0x2752('0x21')](PATH,_0x2752('0x22'));var _0x325bed=_0x57b1df[_0x2752('0x11')]&&_0x185575[_0x2752('0x18')]>0x1;var _0x4ec1bb=[];if(!fs['existsSync'](path['join'](_0x219771,_0x4b2772))&&_0x325bed){fs[_0x2752('0x23')](path[_0x2752('0x24')](_0x219771,_0x4b2772));}return BPromise[_0x2752('0x25')](_0x185575,function(_0x19a3a7){_0x4ec1bb[_0x2752('0x20')](_0x19a3a7);})[_0x2752('0x13')](function(){for(var _0x4c2a63=0x0;_0x4c2a63<_0x4ec1bb['length'];_0x4c2a63+=0x1){var _0x483534;var _0x3b3c14=_0x4ec1bb[_0x4c2a63];if(_0x325bed){_0x483534=path[_0x2752('0x24')](_0x219771,_0x4b2772,util[_0x2752('0x1d')](_0x2752('0x26'),_0x4b2772,_0x4c2a63,'xlsx'));}else{_0x483534=path[_0x2752('0x24')](_0x219771,util[_0x2752('0x1d')](_0x2752('0x27'),_0x4b2772,_0x2752('0x28')));}fs[_0x2752('0x29')](_0x483534,json2xls(_0x3b3c14),_0x2752('0x2a'));}})[_0x2752('0x13')](function(){if(_0x325bed){return new Promise(function(_0x5e2f84){zipdir(path[_0x2752('0x24')](_0x219771,_0x4b2772),{'saveTo':path['join'](_0x219771,util['format'](_0x2752('0x27'),_0x4b2772,'zip'))},function(_0x298930,_0x176dfc){rimraf(path[_0x2752('0x24')](_0x219771,_0x4b2772),function(){});_0x5e2f84(_0x2752('0x2b'));});});}})['then'](function(){logger[_0x2752('0xc')](util[_0x2752('0x1d')](_0x2752('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x2752('0x2d'),_0x325bed?util[_0x2752('0x1d')](_0x2752('0x27'),_0x4b2772,_0x325bed?_0x2752('0x2e'):_0x2752('0x28')):null);});})[_0x2752('0x2f')](function(_0x2dbdd4){logger[_0x2752('0xc')](util[_0x2752('0x1d')](_0x2752('0x30'),EXTRACTED_REPORT_ID,_0x2752('0xe')),util[_0x2752('0x31')](_0x2dbdd4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2752('0x32'));})['finally'](function(){process[_0x2752('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3596dd0..7d6d9f3 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 _0xf3bb=['outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','answer','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','queue','playback','priority','extensions','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','inbound','context'];(function(_0x4422d3,_0x2f5689){var _0x5b2429=function(_0x1bd560){while(--_0x1bd560){_0x4422d3['push'](_0x4422d3['shift']());}};_0x5b2429(++_0x2f5689);}(_0xf3bb,0xf1));var _0xbf3b=function(_0x3bb744,_0x4a396d){_0x3bb744=_0x3bb744-0x0;var _0x3bfee1=_0xf3bb[_0x3bb744];return _0x3bfee1;};'use strict';var _=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));function rewrite(_0x782319,_0x3c8353){var _0x447e7c=this;return _0x782319[_0xbf3b('0x2')][_0xbf3b('0x3')]['findAll']({'raw':!![]})[_0xbf3b('0x4')](function(_0x5197cc){_0x447e7c['intervals']=_0x5197cc;return _0x782319[_0xbf3b('0x2')][_0xbf3b('0x5')][_0xbf3b('0x6')]({'where':{'IntervalId':_0x3c8353['IntervalId']},'raw':!![]});})['then'](function(_0x2b37ee){return _0x782319[_0xbf3b('0x2')]['VoiceExtension'][_0xbf3b('0x6')]({'where':{'exten':{'$in':_[_0xbf3b('0x7')](_[_0xbf3b('0x8')](_0x2b37ee,_0xbf3b('0x9')))}},'order':[{'raw':_0xbf3b('0xa')}],'raw':!![]});})[_0xbf3b('0x4')](function(_0x4dc465){var _0x3dc6ec=_['filter'](_0x4dc465,{'priority':'1'});var _0x43df06=_['filter'](_0x4dc465,{'isApp':0x1});var _0x1d20d1=_['groupBy'](_0x43df06,'exten');var _0xe1a80=[_0xbf3b('0xb'),_0xbf3b('0xc')];var _0x324808=[];var _0x57e7c2=[];for(var _0x51c7f2 in _0x1d20d1){if(_0x1d20d1['hasOwnProperty'](_0x51c7f2)){_0x447e7c[_0xbf3b('0xd')]=0x2;_0x447e7c[_0xbf3b('0xe')]=[];_0x447e7c['extension']=_['find'](_0x3dc6ec,{'exten':_0x1d20d1[_0x51c7f2][0x0]['exten']});_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0]['type'],'app':_0xbf3b('0x10'),'appdata':util[_0xbf3b('0x11')](_0xbf3b('0x12'),_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')]),'context':_0x1d20d1[_0x51c7f2][0x0]['context'],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});if(_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')]===_0xbf3b('0x15')){_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':'Set','appdata':'CDR(routeid)='+_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')],'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0]['exten'],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});}else if(_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')]===_0xbf3b('0x17')){if(_0x447e7c[_0xbf3b('0x18')]){_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':'Set','appdata':_0xbf3b('0x19')+(_0x447e7c['extension'][_0xbf3b('0x1a')]?_0xbf3b('0x1b')+_0x447e7c[_0xbf3b('0x18')][_0xbf3b('0x1a')]+'}':_0xbf3b('0x1c')),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0]['exten'],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});}_0x447e7c[_0xbf3b('0xe')]['push']({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':'CDR(routeid)='+_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')],'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});var _0x4fcece=_0x447e7c[_0xbf3b('0xd')]++;_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0]['type'],'app':_0xbf3b('0x1d'),'appdata':_0xbf3b('0x1e')+(_0x4fcece+0x2)+'):Goto('+(_0x4fcece+0x1)+')','context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x4fcece,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});if(_0x447e7c[_0xbf3b('0x18')]){_0x447e7c['extensions'][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':_0x447e7c[_0xbf3b('0x18')][_0xbf3b('0x1a')]?_0xbf3b('0x1f')+_0x447e7c['extension']['cutdigits']+'}':_0xbf3b('0x20'),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});}_0x447e7c[_0xbf3b('0xe')]['push']({'type':_0x1d20d1[_0x51c7f2][0x0]['type'],'app':_0xbf3b('0x10'),'appdata':'outboundrouteid='+_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')],'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c['priority']++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});if(_0x447e7c[_0xbf3b('0x18')]&&_0x447e7c[_0xbf3b('0x18')][_0xbf3b('0x21')]('recordingFormat')&&_0x447e7c['extension'][_0xbf3b('0x22')]!==_0xbf3b('0x23')){_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':_0xbf3b('0x24'),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0]['type'],'app':_0xbf3b('0x10'),'appdata':_0xbf3b('0x25')+_0x447e7c[_0xbf3b('0x18')][_0xbf3b('0x22')]||_0xbf3b('0x26'),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});}}_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c['priority']++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0]['type'],'app':'Set','appdata':_0xbf3b('0x27'),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c['priority']++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});_0x447e7c[_0xbf3b('0xe')][_0xbf3b('0xf')]({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':_0xbf3b('0x28'),'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'priority':_0x447e7c[_0xbf3b('0xd')]++,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});for(var _0x2c919a=0x0,_0x3307fc=0x0;_0x2c919a<_0x1d20d1[_0x51c7f2][_0xbf3b('0x29')];_0x2c919a+=0x1,_0x3307fc=0x0){var _0x1f4727=_0x1d20d1[_0x51c7f2][_0x2c919a];if(_0x1f4727[_0xbf3b('0x13')]){_0x1f4727[_0xbf3b('0x13')]=_0x1f4727[_0xbf3b('0x13')]['toLowerCase']();}var _0x16c311=[];var _0x3f8cc7=[];delete _0x1f4727['id'];delete _0x1f4727[_0xbf3b('0x2a')];delete _0x1f4727['updatedAt'];var _0x4c0470=_0x1f4727[_0xbf3b('0x2b')]!==_0xbf3b('0x2c')?[_0x1f4727[_0xbf3b('0x2b')]]:_0x1f4727[_0xbf3b('0x2d')]?_['map'](_['filter'](_0x447e7c[_0xbf3b('0x2e')],{'IntervalId':_0x1f4727[_0xbf3b('0x2d')]}),_0xbf3b('0x2b')):[];if(_0x1f4727['hasOwnProperty'](_0xbf3b('0x2f'))){if(_0x1f4727[_0xbf3b('0x2f')]&&_0x1f4727['tag']!=='--'){_0x16c311['push']({'type':_0x1f4727['type'],'app':'Set','appdata':_0xbf3b('0x30')+_0x1f4727['tag'],'context':_0x1f4727['context'],'exten':_0x1f4727[_0xbf3b('0x9')],'priority':_0x4c0470['length']+_0x447e7c['priority']+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});}}if(_0x1f4727[_0xbf3b('0x13')]===_0xbf3b('0x17')&&_0x1f4727[_0xbf3b('0x21')](_0xbf3b('0x31'))){if(_0x1f4727['callerID']){_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727[_0xbf3b('0x13')],'app':_0xbf3b('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1f4727[_0xbf3b('0x31')]+')','context':_0x1f4727['context'],'exten':_0x1f4727['exten'],'priority':_0x4c0470[_0xbf3b('0x29')]+_0x447e7c['priority']+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});}else{_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727[_0xbf3b('0x13')],'app':_0xbf3b('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1f4727[_0xbf3b('0x16')],'exten':_0x1f4727['exten'],'priority':_0x4c0470['length']+_0x447e7c[_0xbf3b('0xd')]+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});}}if(_0x1f4727[_0xbf3b('0x21')](_0xbf3b('0x32'))){if(_0xe1a80['indexOf'](_0x1f4727['app'][_0xbf3b('0x33')]())>=0x0&&_0x1f4727['appType']!=='custom'){if(_0x1f4727[_0xbf3b('0x32')]){_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727['type'],'app':_0xbf3b('0x1d'),'appdata':_0xbf3b('0x34'),'context':_0x1f4727[_0xbf3b('0x16')],'exten':_0x1f4727['exten'],'priority':_0x4c0470[_0xbf3b('0x29')]+_0x447e7c['priority']+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727[_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':_0xbf3b('0x35'),'context':_0x1f4727[_0xbf3b('0x16')],'exten':_0x1f4727['exten'],'priority':_0x4c0470[_0xbf3b('0x29')]+_0x447e7c[_0xbf3b('0xd')]+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});}else{_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727[_0xbf3b('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1f4727[_0xbf3b('0x16')],'exten':_0x1f4727[_0xbf3b('0x9')],'priority':_0x4c0470[_0xbf3b('0x29')]+_0x447e7c[_0xbf3b('0xd')]+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});_0x16c311[_0xbf3b('0xf')]({'type':_0x1f4727[_0xbf3b('0x13')],'app':_0xbf3b('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1f4727['context'],'exten':_0x1f4727['exten'],'priority':_0x4c0470[_0xbf3b('0x29')]+_0x447e7c['priority']+_0x3307fc++,'VoiceExtensionId':_0x1f4727[_0xbf3b('0x14')]});}}}for(var _0x179d49=0x0;_0x179d49<_0x4c0470[_0xbf3b('0x29')];_0x179d49+=0x1){var _0x28de4e=_0x447e7c[_0xbf3b('0xd')]+_0x4c0470[_0xbf3b('0x29')];var _0x44ea35=_0x179d49===_0x4c0470['length']-0x1?_0x447e7c[_0xbf3b('0xd')]+_0x16c311['length']+_0x3f8cc7[_0xbf3b('0x29')]+0x2:_0x447e7c[_0xbf3b('0xd')]+_0x179d49+0x1;_0x16c311[_0xbf3b('0x36')](_0x179d49,0x0,{'type':_0x1f4727['type'],'app':_0xbf3b('0x37'),'appdata':_0x4c0470[_0x179d49]+'?'+_0x1f4727[_0xbf3b('0x16')]+_0xbf3b('0x38')+_0x28de4e+':'+_0x1f4727['context']+_0xbf3b('0x38')+_0x44ea35,'exten':_0x1f4727[_0xbf3b('0x9')],'context':_0x1f4727['context'],'priority':_0x447e7c[_0xbf3b('0xd')]+_0x179d49,'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]});}_0x1f4727[_0xbf3b('0xd')]=_0x16c311['length']?_['last'](_0x16c311)[_0xbf3b('0xd')]+0x1:_0x447e7c[_0xbf3b('0xd')];_0x447e7c['priority']=(_0x3f8cc7[_0xbf3b('0x29')]?_[_0xbf3b('0x39')](_0x3f8cc7)['priority']:_0x1f4727[_0xbf3b('0xd')])+0x1;_0x447e7c[_0xbf3b('0xe')]=_['concat'](_0x447e7c[_0xbf3b('0xe')],_0x16c311,[_0x1f4727],_0x3f8cc7);}_0x447e7c[_0xbf3b('0xe')]['push']({'type':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x13')],'app':'Hangup','exten':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x9')],'context':_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x16')],'priority':_0x447e7c[_0xbf3b('0xd')],'VoiceExtensionId':_0x1d20d1[_0x51c7f2][0x0]['VoiceExtensionId']});_0x324808[_0xbf3b('0xf')](_0x1d20d1[_0x51c7f2][0x0][_0xbf3b('0x14')]);_0x57e7c2=_[_0xbf3b('0x3a')](_0x57e7c2,_0x447e7c[_0xbf3b('0xe')]);}}return _0x782319[_0xbf3b('0x3b')](function(_0x1cad1b){return _0x782319[_0xbf3b('0x2')]['VoiceExtension'][_0xbf3b('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x324808}},'transaction':_0x1cad1b})[_0xbf3b('0x4')](function(_0x1540de){return _0x782319[_0xbf3b('0x2')][_0xbf3b('0x5')][_0xbf3b('0x3d')](_[_0xbf3b('0x3e')](_0x57e7c2,_0xbf3b('0xd')),{'transaction':_0x1cad1b});});});})[_0xbf3b('0x3f')](function(_0x189eec){console[_0xbf3b('0x40')](_0x189eec);});}exports[_0xbf3b('0x41')]=rewrite; \ No newline at end of file +var _0x6cfd=['MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','push','type','Set','format','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x429dff,_0x43d8c9){var _0x432121=function(_0x205980){while(--_0x205980){_0x429dff['push'](_0x429dff['shift']());}};_0x432121(++_0x43d8c9);}(_0x6cfd,0x6c));var _0xd6cf=function(_0x2dfa4b,_0x553a93){_0x2dfa4b=_0x2dfa4b-0x0;var _0x87d69f=_0x6cfd[_0x2dfa4b];return _0x87d69f;};'use strict';var _=require(_0xd6cf('0x0'));var util=require(_0xd6cf('0x1'));function rewrite(_0x5181ea,_0x4a328c){var _0x26a90e=this;return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x3')][_0xd6cf('0x4')]({'raw':!![]})['then'](function(_0x4fdc30){_0x26a90e[_0xd6cf('0x5')]=_0x4fdc30;return _0x5181ea['models'][_0xd6cf('0x6')]['findAll']({'where':{'IntervalId':_0x4a328c['IntervalId']},'raw':!![]});})[_0xd6cf('0x7')](function(_0x4e0885){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x4')]({'where':{'exten':{'$in':_[_0xd6cf('0x8')](_['map'](_0x4e0885,_0xd6cf('0x9')))}},'order':[{'raw':_0xd6cf('0xa')}],'raw':!![]});})[_0xd6cf('0x7')](function(_0x15520c){var _0x448a3f=_[_0xd6cf('0xb')](_0x15520c,{'priority':'1'});var _0x935331=_['filter'](_0x15520c,{'isApp':0x1});var _0x5232bf=_[_0xd6cf('0xc')](_0x935331,_0xd6cf('0x9'));var _0x59e664=[_0xd6cf('0xd'),_0xd6cf('0xe')];var _0x48fd03=[];var _0x1727de=[];for(var _0x148ead in _0x5232bf){if(_0x5232bf[_0xd6cf('0xf')](_0x148ead)){_0x26a90e['priority']=0x2;_0x26a90e[_0xd6cf('0x10')]=[];_0x26a90e['extension']=_[_0xd6cf('0x11')](_0x448a3f,{'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')]});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':util[_0xd6cf('0x15')]('CDR(type)=%s',_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]===_0xd6cf('0x19')){_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x1a')+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});}else if(_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]==='outbound'){if(_0x26a90e[_0xd6cf('0x1b')]){_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x1c')+(_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x1d')]?_0xd6cf('0x1e')+_0x26a90e[_0xd6cf('0x1b')]['cutdigits']+'}':_0xd6cf('0x1f')),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':'CDR(routeid)='+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e['priority']++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});var _0x31fec4=_0x26a90e[_0xd6cf('0x17')]++;_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'ExecIf','appdata':_0xd6cf('0x20')+(_0x31fec4+0x2)+_0xd6cf('0x21')+(_0x31fec4+0x1)+')','context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x31fec4,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x26a90e[_0xd6cf('0x1b')]){_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0x26a90e[_0xd6cf('0x1b')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x1d')]+'}':_0xd6cf('0x22'),'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x23')+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x26a90e['extension']&&_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0xf')](_0xd6cf('0x24'))&&_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x24')]!==_0xd6cf('0x25')){_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Set','appdata':_0xd6cf('0x26'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x27')+_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x24')]||'wav','context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x28'),'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Set','appdata':_0xd6cf('0x29'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x2a'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});for(var _0x543487=0x0,_0x14a554=0x0;_0x543487<_0x5232bf[_0x148ead][_0xd6cf('0x2b')];_0x543487+=0x1,_0x14a554=0x0){var _0xc4c612=_0x5232bf[_0x148ead][_0x543487];if(_0xc4c612[_0xd6cf('0x13')]){_0xc4c612[_0xd6cf('0x13')]=_0xc4c612[_0xd6cf('0x13')]['toLowerCase']();}var _0x5d4022=[];var _0x2629d8=[];delete _0xc4c612['id'];delete _0xc4c612[_0xd6cf('0x2c')];delete _0xc4c612[_0xd6cf('0x2d')];var _0x349d9e=_0xc4c612[_0xd6cf('0x2e')]!==_0xd6cf('0x2f')?[_0xc4c612[_0xd6cf('0x2e')]]:_0xc4c612[_0xd6cf('0x30')]?_[_0xd6cf('0x31')](_[_0xd6cf('0xb')](_0x26a90e[_0xd6cf('0x5')],{'IntervalId':_0xc4c612['IntervalId']}),_0xd6cf('0x2e')):[];if(_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x32'))){if(_0xc4c612['tag']&&_0xc4c612[_0xd6cf('0x32')]!=='--'){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x33')+_0xc4c612[_0xd6cf('0x32')],'context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e['priority']+_0x14a554++,'VoiceExtensionId':_0xc4c612['VoiceExtensionId']});}}if(_0xc4c612[_0xd6cf('0x13')]===_0xd6cf('0x34')&&_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x35'))){if(_0xc4c612[_0xd6cf('0x35')]){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':'ExecIf','appdata':_0xd6cf('0x36')+_0xc4c612[_0xd6cf('0x35')]+')','context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e['length']+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}else{_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x37'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}}if(_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x38'))){if(_0x59e664[_0xd6cf('0x39')](_0xc4c612[_0xd6cf('0x3a')][_0xd6cf('0x3b')]())>=0x0&&_0xc4c612[_0xd6cf('0x3c')]!==_0xd6cf('0x3d')){if(_0xc4c612[_0xd6cf('0x38')]){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612['type'],'app':_0xd6cf('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e['length']+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}else{_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x37'),'appdata':_0xd6cf('0x3e'),'context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xc4c612['context'],'exten':_0xc4c612['exten'],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}}}for(var _0x5d2ea8=0x0;_0x5d2ea8<_0x349d9e['length'];_0x5d2ea8+=0x1){var _0x2dd5a3=_0x26a90e[_0xd6cf('0x17')]+_0x349d9e['length'];var _0x52e1e3=_0x5d2ea8===_0x349d9e[_0xd6cf('0x2b')]-0x1?_0x26a90e[_0xd6cf('0x17')]+_0x5d4022[_0xd6cf('0x2b')]+_0x2629d8['length']+0x2:_0x26a90e['priority']+_0x5d2ea8+0x1;_0x5d4022[_0xd6cf('0x3f')](_0x5d2ea8,0x0,{'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x40'),'appdata':_0x349d9e[_0x5d2ea8]+'?'+_0xc4c612[_0xd6cf('0x16')]+_0xd6cf('0x41')+_0x2dd5a3+':'+_0xc4c612['context']+_0xd6cf('0x41')+_0x52e1e3,'exten':_0xc4c612['exten'],'context':_0xc4c612['context'],'priority':_0x26a90e[_0xd6cf('0x17')]+_0x5d2ea8,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0xc4c612['priority']=_0x5d4022['length']?_[_0xd6cf('0x42')](_0x5d4022)[_0xd6cf('0x17')]+0x1:_0x26a90e[_0xd6cf('0x17')];_0x26a90e[_0xd6cf('0x17')]=(_0x2629d8[_0xd6cf('0x2b')]?_[_0xd6cf('0x42')](_0x2629d8)[_0xd6cf('0x17')]:_0xc4c612[_0xd6cf('0x17')])+0x1;_0x26a90e[_0xd6cf('0x10')]=_['concat'](_0x26a90e[_0xd6cf('0x10')],_0x5d4022,[_0xc4c612],_0x2629d8);}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Hangup','exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'priority':_0x26a90e['priority'],'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});_0x48fd03[_0xd6cf('0x12')](_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]);_0x1727de=_[_0xd6cf('0x43')](_0x1727de,_0x26a90e[_0xd6cf('0x10')]);}}return _0x5181ea[_0xd6cf('0x44')](function(_0xe7b933){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x48fd03}},'transaction':_0xe7b933})[_0xd6cf('0x7')](function(_0x14d9b5){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x46')](_[_0xd6cf('0x47')](_0x1727de,_0xd6cf('0x17')),{'transaction':_0xe7b933});});});})[_0xd6cf('0x48')](function(_0x5cfc6a){console[_0xd6cf('0x49')](_0x5cfc6a);});}exports[_0xd6cf('0x4a')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f0ca492..8b7887d 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 _0xbe8f=['SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','into','cm_hopper_final','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','then','get','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','Lists','always','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0xbe8f,0xcf));var _0xfbe8=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xbe8f[_0x5608a3];return _0x1ed50a;};'use strict';var BPromise=require('bluebird');var util=require(_0xfbe8('0x0'));var _=require(_0xfbe8('0x1'));var fs=require('fs');var squel=require(_0xfbe8('0x2'));var Papa=require(_0xfbe8('0x3'));var Redis=require('ioredis');var db=require(_0xfbe8('0x4'))['db'];var config=require(_0xfbe8('0x5'));var logger=require(_0xfbe8('0x6'))(_0xfbe8('0x7'));config[_0xfbe8('0x8')]=_[_0xfbe8('0x9')](config[_0xfbe8('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbe8('0x8')]));require(_0xfbe8('0xa'))[_0xfbe8('0xb')](socket);try{if(!process[_0xfbe8('0xc')][0x2]||process[_0xfbe8('0xc')][0x2]==='undefined'||process[_0xfbe8('0xc')][0x2]===_0xfbe8('0xd')){throw new Error(_0xfbe8('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xfbe8('0xc')][0x3]===_0xfbe8('0xf')||process[_0xfbe8('0xc')][0x3]==='null'||!process[_0xfbe8('0xc')][0x4]||process[_0xfbe8('0xc')][0x4]===_0xfbe8('0xf')||process[_0xfbe8('0xc')][0x4]===_0xfbe8('0xd')){throw new Error(_0xfbe8('0x10'));}var FIELDS=_[_0xfbe8('0x11')](process[_0xfbe8('0xc')][0x3][_0xfbe8('0x12')](','),process[_0xfbe8('0xc')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xfbe8('0xc')][0x5]===_0xfbe8('0xf')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xfbe8('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xfbe8('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0xfbe8('0xc')][0x6]:null;var DUPLICATES=process[_0xfbe8('0xc')][0x7]&&process[_0xfbe8('0xc')][0x7]!==_0xfbe8('0xf')&&process[_0xfbe8('0xc')][0x7]!=='null'?process[_0xfbe8('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xfbe8('0xf')||process[_0xfbe8('0xc')][0x8]===_0xfbe8('0xd')){throw new Error(_0xfbe8('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x44bbd2){logger[_0xfbe8('0x14')](_0x44bbd2);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(_0x283d19,_0x254d00,_0x1f1ab1,_0x3dfb18){var _0x8eb475={'message':_0x254d00};_0x8eb475[_0x283d19]=!![];if(_0x1f1ab1){_0x8eb475['contact']=_0x1f1ab1;}if(_0x3dfb18){_0x8eb475[_0xfbe8('0x15')]=_0x3dfb18;}return _0x8eb475;}function isEmail(_0x595e2d){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))*$/[_0xfbe8('0x16')](_0x595e2d);}function checkRow(_0x5de0ec,_0xcefc81,_0x1dec1f){return new BPromise(function(_0x3c36b1,_0xc52ae4){if(_['isNil'](_0x5de0ec)){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),_0xfbe8('0x17'),null,_0x1dec1f));}if(_0x5de0ec[_0xfbe8('0x18')]&&_0x5de0ec[_0xfbe8('0x18')]['length']){var _0x1bfb70=_[_0xfbe8('0x19')](_0x5de0ec[_0xfbe8('0x18')],_0xfbe8('0x1a'))['join'](';');return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),_0x1bfb70,null,_0x1dec1f));}var _0x29e038={};for(var _0x2d5743 in FIELDS){if(FIELDS[_0xfbe8('0x1b')](_0x2d5743)&&FIELDS[_0x2d5743]){_0x29e038[_0x2d5743]=_0x5de0ec[_0xfbe8('0x1c')][0x0][FIELDS[_0x2d5743]]||_0x5de0ec[_0xfbe8('0x1c')][0x0]['\ufeff'+FIELDS[_0x2d5743]];}}if(!_0x29e038[_0xfbe8('0x1d')]){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),'firstName\x20not\x20specified!',null,_0x1dec1f));}if(!_0x29e038[_0xfbe8('0x1e')]){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),'phone\x20not\x20specified!',null,_0x1dec1f));}if(_0x29e038[_0xfbe8('0x1f')]){var _0xca64ff=moment(_0x29e038[_0xfbe8('0x1f')],_0xfbe8('0x20'));if(!_0xca64ff[_0xfbe8('0x21')]()){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),_0xfbe8('0x22'),null,_0x1dec1f));}}if(_0x29e038['email']){if(!isEmail(_0x29e038['email'])){return _0xc52ae4(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x1dec1f));}}_0x29e038[_0xfbe8('0x23')]=LISTID;_0x29e038[_0xfbe8('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xfbe8('0x25')]&&_0xcefc81){var _0xc4206b={};for(var _0x902599=0x0,_0x2596f4=DUPLICATES['length'];_0x902599<_0x2596f4;_0x902599+=0x1){_0xc4206b[DUPLICATES[_0x902599]]=_0x29e038[DUPLICATES[_0x902599]];}var _0x18f869=_[_0xfbe8('0x26')](_0xcefc81,_0xc4206b);if(_0x18f869){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x27'),_0xfbe8('0x28'),_0x18f869,_0x1dec1f));}}return db[_0xfbe8('0x29')][_0xfbe8('0x2a')](_0x29e038,{'raw':!![],'hooks':![],'fields':_['keys'](_0x29e038)})['then'](function(_0x42b48b){if(DUPLICATES&&DUPLICATES[_0xfbe8('0x25')]&&_0xcefc81){_0xcefc81[_0xfbe8('0x2b')](_[_0xfbe8('0x2c')](_0x29e038,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42b48b['id'];return _0x3c36b1();})[_0xfbe8('0x2d')](function(_0x5e84f1){return _0xc52ae4(handleCheckRowError(_0xfbe8('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5e84f1['message']||JSON['stringify'](_0x5e84f1)),null,_0x1dec1f));});});}function checkHopper(){function _0x1e900c(){return function(_0x41b06a){logger[_0xfbe8('0x14')]('cmContact','checkHopper',util['inspect'](_0x41b06a,{'showHidden':![],'depth':null}));};}var _0x489fe5=function(_0x57f357,_0x5ce362){var _0x5c7326=squel[_0xfbe8('0x2e')]()['into'](_0xfbe8('0x2f'))[_0xfbe8('0x30')]([_0xfbe8('0x1e'),_0xfbe8('0x31'),_0xfbe8('0x32'),_0xfbe8('0x23'),_0x5ce362,_0xfbe8('0x33'),_0xfbe8('0x34')],squel['select']()[_0xfbe8('0x35')](_0xfbe8('0x1e'),_0xfbe8('0x1e'))['field'](_0xfbe8('0x36'),_0xfbe8('0x31'))[_0xfbe8('0x35')]('id',_0xfbe8('0x32'))['field'](LISTID[_0xfbe8('0x37')](),_0xfbe8('0x23'))[_0xfbe8('0x35')](_0x57f357['id'][_0xfbe8('0x37')](),_0x5ce362)[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x33'))[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x34'))[_0xfbe8('0x38')](_0xfbe8('0x39'))[_0xfbe8('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xfbe8('0x3b'),LISTID[_0xfbe8('0x37')]())[_0xfbe8('0x3a')](_0xfbe8('0x3c'))[_0xfbe8('0x3a')](_0xfbe8('0x3d'),squel[_0xfbe8('0x3e')]()[_0xfbe8('0x35')]('phone')[_0xfbe8('0x38')](_0xfbe8('0x2f'))[_0xfbe8('0x3a')](_0x5ce362+_0xfbe8('0x3f'),_0x57f357['id'][_0xfbe8('0x37')]())))[_0xfbe8('0x37')]();return _0x5c7326;};var _0xd38fdc=function(_0x2581b4,_0x50de4d){var _0x473ee7=squel['insert']()[_0xfbe8('0x40')]('cm_hopper')['fromQuery']([_0xfbe8('0x1e'),'scheduledAt',_0xfbe8('0x32'),'ListId',_0x50de4d,'createdAt',_0xfbe8('0x34')],squel['select']()[_0xfbe8('0x35')](_0xfbe8('0x1e'),_0xfbe8('0x1e'))[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x31'))['field']('id',_0xfbe8('0x32'))[_0xfbe8('0x35')](LISTID['toString'](),'ListId')[_0xfbe8('0x35')](_0x2581b4['id'][_0xfbe8('0x37')](),_0x50de4d)[_0xfbe8('0x35')](_0xfbe8('0x36'),'createdAt')[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x34'))[_0xfbe8('0x38')](_0xfbe8('0x39'))[_0xfbe8('0x3a')]('deletedAt\x20IS\x20NULL')[_0xfbe8('0x3a')](_0xfbe8('0x3b'),LISTID[_0xfbe8('0x37')]())[_0xfbe8('0x3a')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xfbe8('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xfbe8('0x3a')](_0xfbe8('0x3d'),squel['select']()[_0xfbe8('0x35')]('calleridnum')[_0xfbe8('0x38')](_0xfbe8('0x41'))['where'](_0x50de4d+_0xfbe8('0x3f'),_0x2581b4['id'][_0xfbe8('0x37')]()))[_0xfbe8('0x3a')](_0xfbe8('0x3d'),squel[_0xfbe8('0x3e')]()[_0xfbe8('0x35')](_0xfbe8('0x1e'))[_0xfbe8('0x38')](_0xfbe8('0x2f'))[_0xfbe8('0x3a')](_0x50de4d+_0xfbe8('0x3f'),_0x2581b4['id'][_0xfbe8('0x37')]())))[_0xfbe8('0x37')]();return _0x473ee7;};function _0x4c74c2(_0x23bc73,_0x393448){var _0x5e3a8f=squel[_0xfbe8('0x2e')]()[_0xfbe8('0x40')](_0xfbe8('0x2f'))[_0xfbe8('0x30')]([_0xfbe8('0x1e'),'scheduledAt',_0xfbe8('0x32'),'ListId',_0x393448,_0xfbe8('0x33'),_0xfbe8('0x34')],squel[_0xfbe8('0x3e')]()['field'](_0xfbe8('0x1e'),_0xfbe8('0x1e'))[_0xfbe8('0x35')]('NOW()','scheduledAt')[_0xfbe8('0x35')]('id',_0xfbe8('0x32'))[_0xfbe8('0x35')](LISTID[_0xfbe8('0x37')](),_0xfbe8('0x23'))[_0xfbe8('0x35')](_0x23bc73['id']['toString'](),_0x393448)[_0xfbe8('0x35')](_0xfbe8('0x36'),'createdAt')[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x34'))[_0xfbe8('0x38')](_0xfbe8('0x39'))[_0xfbe8('0x3a')](_0xfbe8('0x42'))[_0xfbe8('0x3a')](_0xfbe8('0x3b'),LISTID[_0xfbe8('0x37')]())[_0xfbe8('0x3a')](_0xfbe8('0x43'),squel[_0xfbe8('0x44')](hopperContacts))[_0xfbe8('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xfbe8('0x37')]();return _0x5e3a8f;}function _0x41015d(_0x5225e7,_0x4e1b3c){var _0x93854e=squel[_0xfbe8('0x2e')]()[_0xfbe8('0x40')](_0xfbe8('0x45'))['fromQuery']([_0xfbe8('0x1e'),_0xfbe8('0x32'),'ListId',_0x4e1b3c,_0xfbe8('0x33'),_0xfbe8('0x34')],squel[_0xfbe8('0x3e')]()[_0xfbe8('0x35')](_0xfbe8('0x1e'),_0xfbe8('0x1e'))['field']('id',_0xfbe8('0x32'))[_0xfbe8('0x35')](LISTID[_0xfbe8('0x37')](),_0xfbe8('0x23'))[_0xfbe8('0x35')](_0x5225e7['id'][_0xfbe8('0x37')](),_0x4e1b3c)[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x33'))[_0xfbe8('0x35')](_0xfbe8('0x36'),_0xfbe8('0x34'))[_0xfbe8('0x38')](_0xfbe8('0x39'))[_0xfbe8('0x3a')](_0xfbe8('0x42'))['where']('ListId\x20=\x20?',LISTID[_0xfbe8('0x37')]())[_0xfbe8('0x3a')]('id\x20IN\x20?',squel[_0xfbe8('0x44')](hopperContacts))['where'](_0xfbe8('0x3c')))[_0xfbe8('0x37')]();return _0x93854e;}return db['VoiceQueue'][_0xfbe8('0x46')]({'where':{'type':'outbound'},'attributes':['id',_0xfbe8('0x47')],'include':[{'model':db[_0xfbe8('0x48')],'as':'Lists','where':{'id':LISTID}}]})[_0xfbe8('0x49')](function(_0x4fc7e4){var _0x62b2c5=[];if(_0x4fc7e4){var _0x16d8ca;for(var _0x389368=0x0,_0x430e9e;_0x389368<_0x4fc7e4[_0xfbe8('0x25')];_0x389368+=0x1){_0x430e9e=_0x4fc7e4[_0x389368][_0xfbe8('0x4a')]({'plain':!![]});switch(_0x430e9e[_0xfbe8('0x47')]){case'always':_0x62b2c5[_0xfbe8('0x2b')](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0xd38fdc(_0x430e9e,_0xfbe8('0x4d')))['then'](function(){})[_0xfbe8('0x2d')](_0x1e900c()));break;case _0xfbe8('0x4e'):_0x62b2c5[_0xfbe8('0x2b')](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0x489fe5(_0x430e9e,'VoiceQueueId'))['then'](function(){})[_0xfbe8('0x2d')](_0x1e900c()));break;default:_0x62b2c5[_0xfbe8('0x2b')](db['sequelize']['query'](_0x4c74c2(_0x430e9e,_0xfbe8('0x4d')))[_0xfbe8('0x49')](function(){})[_0xfbe8('0x2d')](_0x1e900c()));}}}return _0x62b2c5;})['all']()[_0xfbe8('0x49')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xfbe8('0x48')],'as':_0xfbe8('0x4f'),'where':{'id':LISTID}}]})[_0xfbe8('0x49')](function(_0x2ae621){var _0x5111eb=[];if(_0x2ae621){var _0x4083c3;for(var _0x28710c=0x0,_0x5f26e4;_0x28710c<_0x2ae621[_0xfbe8('0x25')];_0x28710c+=0x1){_0x5f26e4=_0x2ae621[_0x28710c][_0xfbe8('0x4a')]({'plain':!![]});_0x5111eb[_0xfbe8('0x2b')](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0x41015d(_0x5f26e4,_0xfbe8('0x4d')))[_0xfbe8('0x49')](function(){})[_0xfbe8('0x2d')](_0x1e900c()));}}return _0x5111eb;})[_0xfbe8('0x50')]();})[_0xfbe8('0x49')](function(){return db[_0xfbe8('0x51')]['findAll']({'attributes':['id',_0xfbe8('0x47')],'include':[{'model':db['CmList'],'as':_0xfbe8('0x52'),'where':{'id':LISTID}}]})[_0xfbe8('0x49')](function(_0x30e95c){var _0x3c24a5=[];if(_0x30e95c){for(var _0x2d2491=0x0,_0x513728;_0x2d2491<_0x30e95c[_0xfbe8('0x25')];_0x2d2491+=0x1){_0x513728=_0x30e95c[_0x2d2491]['get']({'plain':!![]});switch(_0x513728['dialCheckDuplicateType']){case _0xfbe8('0x53'):_0x3c24a5['push'](db['sequelize'][_0xfbe8('0x4c')](_0xd38fdc(_0x513728,'CampaignId'))[_0xfbe8('0x49')](function(){})['catch'](_0x1e900c()));break;case _0xfbe8('0x4e'):_0x3c24a5[_0xfbe8('0x2b')](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0x489fe5(_0x513728,_0xfbe8('0x54')))[_0xfbe8('0x49')](function(){})['catch'](_0x1e900c()));break;default:_0x3c24a5['push'](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0x4c74c2(_0x513728,_0xfbe8('0x54')))[_0xfbe8('0x49')](function(){})[_0xfbe8('0x2d')](_0x1e900c()));}}}return _0x3c24a5;})[_0xfbe8('0x50')]();})[_0xfbe8('0x49')](function(){return db[_0xfbe8('0x51')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xfbe8('0x4f'),'where':{'id':LISTID}}]})[_0xfbe8('0x49')](function(_0x5a239c){var _0x2b8adc=[];if(_0x5a239c){for(var _0x5e2bea=0x0,_0x4184c5;_0x5e2bea<_0x5a239c['length'];_0x5e2bea+=0x1){_0x4184c5=_0x5a239c[_0x5e2bea][_0xfbe8('0x4a')]({'plain':!![]});_0x2b8adc[_0xfbe8('0x2b')](db[_0xfbe8('0x4b')][_0xfbe8('0x4c')](_0x41015d(_0x4184c5,'CampaignId'))['then'](function(){})[_0xfbe8('0x2d')](_0x1e900c()));}}return _0x2b8adc;})[_0xfbe8('0x50')]();})[_0xfbe8('0x2d')](function(_0x5896a3){logger[_0xfbe8('0x14')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x5896a3[_0xfbe8('0x1a')]);});}var processPromises=function(_0xd6dc54){return BPromise[_0xfbe8('0x50')](promises)[_0xfbe8('0x49')](function(_0x4f2770){})[_0xfbe8('0x2d')](function(_0xe1d97f){logger[_0xfbe8('0x14')](_0xfbe8('0x55'),JSON['stringify'](_0xe1d97f));})[_0xfbe8('0x56')](function(){socket[_0xfbe8('0x57')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xd6dc54){return _0xd6dc54['resume']();}});};var endCsv=function(){return BPromise[_0xfbe8('0x58')]()[_0xfbe8('0x49')](function(){if(hopperContacts){return checkHopper();}})[_0xfbe8('0x49')](function(){socket[_0xfbe8('0x57')](_0xfbe8('0x59')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x47169e){logger[_0xfbe8('0x14')](_0xfbe8('0x5a'),JSON[_0xfbe8('0x5b')](_0x47169e));}finally{process[_0xfbe8('0x5c')](0x0);}});};process['on'](_0xfbe8('0x5d'),function(){logger[_0xfbe8('0x5e')](_0xfbe8('0x5f'));endCsv();});function main(){return BPromise[_0xfbe8('0x58')]()[_0xfbe8('0x49')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xfbe8('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x50e995){var _0x1faa5d=fs[_0xfbe8('0x60')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfbe8('0x61')](_0x1faa5d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d3297,_0x33ecfa){total+=0x1;var _0x58aae8=total;promises['push'](checkRow(_0x4d3297,_0x50e995,_0x58aae8)[_0xfbe8('0x49')](function(){success+=0x1;})[_0xfbe8('0x2d')](function(_0x9deafd){if(_0x9deafd[_0xfbe8('0x14')]){errors+=0x1;delete _0x9deafd[_0xfbe8('0x14')];}else if(_0x9deafd[_0xfbe8('0x27')]){duplicates+=0x1;delete _0x9deafd['duplicate'];}rows[_0xfbe8('0x2b')](_0x9deafd);}));if(total%0xc8===0x0){_0x33ecfa['pause']();return processPromises(_0x33ecfa);}},'complete':function(){return processPromises()[_0xfbe8('0x49')](function(){logger[_0xfbe8('0x5e')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x366a26,_0x41ce7e){logger['info'](_0xfbe8('0x62'),JSON['stringify'](_0x366a26));endCsv();}});})['catch'](function(_0x5df3ba){logger[_0xfbe8('0x14')](_0xfbe8('0x63'),JSON['stringify'](_0x5df3ba));});}main(); \ No newline at end of file +var _0x0df4=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_final','insert','str','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','push','sequelize','onlyIfOpen','query','VoiceQueueId','all','findAll','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x0df4,0x1b8));var _0x40df=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0df4[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x40df('0x0'));var util=require(_0x40df('0x1'));var _=require(_0x40df('0x2'));var fs=require('fs');var squel=require(_0x40df('0x3'));var Papa=require(_0x40df('0x4'));var Redis=require(_0x40df('0x5'));var db=require(_0x40df('0x6'))['db'];var config=require(_0x40df('0x7'));var logger=require(_0x40df('0x8'))(_0x40df('0x9'));config[_0x40df('0xa')]=_[_0x40df('0xb')](config[_0x40df('0xa')],{'host':_0x40df('0xc'),'port':0x18eb});var socket=require(_0x40df('0xd'))(new Redis(config['redis']));require(_0x40df('0xe'))[_0x40df('0xf')](socket);try{if(!process[_0x40df('0x10')][0x2]||process[_0x40df('0x10')][0x2]===_0x40df('0x11')||process[_0x40df('0x10')][0x2]==='null'){throw new Error(_0x40df('0x12'));}var FILEPATH=process[_0x40df('0x10')][0x2];if(!process['argv'][0x3]||process[_0x40df('0x10')][0x3]===_0x40df('0x11')||process['argv'][0x3]===_0x40df('0x13')||!process['argv'][0x4]||process['argv'][0x4]===_0x40df('0x11')||process[_0x40df('0x10')][0x4]===_0x40df('0x13')){throw new Error(_0x40df('0x14'));}var FIELDS=_[_0x40df('0x15')](process[_0x40df('0x10')][0x3][_0x40df('0x16')](','),process[_0x40df('0x10')][0x4][_0x40df('0x16')](','));if(!process['argv'][0x5]||process[_0x40df('0x10')][0x5]==='undefined'||process[_0x40df('0x10')][0x5]===_0x40df('0x13')){throw new Error(_0x40df('0x17'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x40df('0x10')][0x6]&&process[_0x40df('0x10')][0x6]!=='undefined'&&process[_0x40df('0x10')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x40df('0x10')][0x7]&&process['argv'][0x7]!==_0x40df('0x11')&&process[_0x40df('0x10')][0x7]!==_0x40df('0x13')?process[_0x40df('0x10')][0x7]:null;if(!process[_0x40df('0x10')][0x8]||process[_0x40df('0x10')][0x8]===_0x40df('0x11')||process[_0x40df('0x10')][0x8]===_0x40df('0x13')){throw new Error(_0x40df('0x18'));}var SOCKET_TIMESTAMP=process[_0x40df('0x10')][0x8];}catch(_0x29fa2b){logger[_0x40df('0x19')](_0x29fa2b);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(_0x52b70f,_0x596f23,_0x319536,_0x9bbd53){var _0x6e054f={'message':_0x596f23};_0x6e054f[_0x52b70f]=!![];if(_0x319536){_0x6e054f[_0x40df('0x1a')]=_0x319536;}if(_0x9bbd53){_0x6e054f['index']=_0x9bbd53;}return _0x6e054f;}function isEmail(_0x442a8e){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))*$/[_0x40df('0x1b')](_0x442a8e);}function checkRow(_0x3ab55c,_0x1045a0,_0xb82b1e){return new BPromise(function(_0x2e3e9f,_0x38381f){if(_[_0x40df('0x1c')](_0x3ab55c)){return _0x38381f(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xb82b1e));}if(_0x3ab55c['errors']&&_0x3ab55c[_0x40df('0x1d')][_0x40df('0x1e')]){var _0x296756=_[_0x40df('0x1f')](_0x3ab55c['errors'],'message')['join'](';');return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x296756,null,_0xb82b1e));}var _0x39c5d0={};for(var _0x2c560b in FIELDS){if(FIELDS[_0x40df('0x20')](_0x2c560b)&&FIELDS[_0x2c560b]){_0x39c5d0[_0x2c560b]=_0x3ab55c[_0x40df('0x21')][0x0][FIELDS[_0x2c560b]]||_0x3ab55c[_0x40df('0x21')][0x0]['\ufeff'+FIELDS[_0x2c560b]];}}if(!_0x39c5d0[_0x40df('0x22')]){return _0x38381f(handleCheckRowError('error',_0x40df('0x23'),null,_0xb82b1e));}if(!_0x39c5d0[_0x40df('0x24')]){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x25'),null,_0xb82b1e));}if(_0x39c5d0['birthDate']){var _0x1989b5=moment(_0x39c5d0[_0x40df('0x26')],'YYYY-MM-DD');if(!_0x1989b5['isValid']()){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x27'),null,_0xb82b1e));}}if(_0x39c5d0[_0x40df('0x28')]){if(!isEmail(_0x39c5d0[_0x40df('0x28')])){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x29'),null,_0xb82b1e));}}_0x39c5d0[_0x40df('0x2a')]=LISTID;_0x39c5d0[_0x40df('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x40df('0x1e')]&&_0x1045a0){var _0x1bebe3={};for(var _0x4a709f=0x0,_0x356030=DUPLICATES['length'];_0x4a709f<_0x356030;_0x4a709f+=0x1){_0x1bebe3[DUPLICATES[_0x4a709f]]=_0x39c5d0[DUPLICATES[_0x4a709f]];}var _0x496b64=_[_0x40df('0x2c')](_0x1045a0,_0x1bebe3);if(_0x496b64){return _0x38381f(handleCheckRowError('duplicate',_0x40df('0x2d'),_0x496b64,_0xb82b1e));}}return db[_0x40df('0x2e')][_0x40df('0x2f')](_0x39c5d0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x39c5d0)})['then'](function(_0x2187a9){if(DUPLICATES&&DUPLICATES['length']&&_0x1045a0){_0x1045a0['push'](_[_0x40df('0x30')](_0x39c5d0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2187a9['id'];return _0x2e3e9f();})[_0x40df('0x31')](function(_0x14ea1d){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x32')+(_0x14ea1d['message']||JSON[_0x40df('0x33')](_0x14ea1d)),null,_0xb82b1e));});});}function checkHopper(){function _0x4f137f(){return function(_0x52f1e5){logger[_0x40df('0x19')]('cmContact',_0x40df('0x34'),util[_0x40df('0x35')](_0x52f1e5,{'showHidden':![],'depth':null}));};}var _0x3a2700=function(_0x262a7b,_0x557c1a){var _0x192193=squel['insert']()[_0x40df('0x36')](_0x40df('0x37'))[_0x40df('0x38')]([_0x40df('0x24'),_0x40df('0x39'),_0x40df('0x3a'),'ListId',_0x557c1a,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()[_0x40df('0x3e')]('phone',_0x40df('0x24'))[_0x40df('0x3e')]('NOW()','scheduledAt')[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID[_0x40df('0x3f')](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x262a7b['id'][_0x40df('0x3f')](),_0x557c1a)[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3b'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3c'))[_0x40df('0x41')]('cm_contacts')[_0x40df('0x42')]('deletedAt\x20IS\x20NULL')[_0x40df('0x42')](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x40df('0x42')](_0x40df('0x44'),squel[_0x40df('0x3d')]()[_0x40df('0x3e')]('phone')[_0x40df('0x41')](_0x40df('0x37'))[_0x40df('0x42')](_0x557c1a+_0x40df('0x45'),_0x262a7b['id'][_0x40df('0x3f')]())))[_0x40df('0x3f')]();return _0x192193;};var _0x9c8e1a=function(_0x1d15db,_0x59ddbc){var _0x3e9b35=squel['insert']()[_0x40df('0x36')](_0x40df('0x37'))[_0x40df('0x38')](['phone',_0x40df('0x39'),_0x40df('0x3a'),_0x40df('0x2a'),_0x59ddbc,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()['field'](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x39'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID['toString'](),_0x40df('0x2a'))['field'](_0x1d15db['id'][_0x40df('0x3f')](),_0x59ddbc)[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3b'))['field'](_0x40df('0x40'),_0x40df('0x3c'))[_0x40df('0x41')](_0x40df('0x46'))[_0x40df('0x42')](_0x40df('0x47'))['where'](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())[_0x40df('0x42')](_0x40df('0x48'),squel['str'](hopperContacts))[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x40df('0x3e')]('calleridnum')['from'](_0x40df('0x49'))[_0x40df('0x42')](_0x59ddbc+_0x40df('0x45'),_0x1d15db['id'][_0x40df('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x40df('0x3d')]()[_0x40df('0x3e')](_0x40df('0x24'))['from'](_0x40df('0x37'))[_0x40df('0x42')](_0x59ddbc+_0x40df('0x45'),_0x1d15db['id'][_0x40df('0x3f')]())))[_0x40df('0x3f')]();return _0x3e9b35;};function _0x306d6c(_0x2bd470,_0x5660a6){var _0x4377fe=squel[_0x40df('0x4a')]()[_0x40df('0x36')]('cm_hopper')['fromQuery']([_0x40df('0x24'),'scheduledAt',_0x40df('0x3a'),_0x40df('0x2a'),_0x5660a6,_0x40df('0x3b'),_0x40df('0x3c')],squel['select']()[_0x40df('0x3e')](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x39'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID[_0x40df('0x3f')](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x2bd470['id'][_0x40df('0x3f')](),_0x5660a6)[_0x40df('0x3e')]('NOW()',_0x40df('0x3b'))[_0x40df('0x3e')]('NOW()','updatedAt')['from'](_0x40df('0x46'))[_0x40df('0x42')](_0x40df('0x47'))[_0x40df('0x42')](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())['where'](_0x40df('0x48'),squel[_0x40df('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x40df('0x3f')]();return _0x4377fe;}function _0x41f2b2(_0x49cdd7,_0x12c41b){var _0x4b6900=squel[_0x40df('0x4a')]()[_0x40df('0x36')](_0x40df('0x4c'))['fromQuery']([_0x40df('0x24'),_0x40df('0x3a'),'ListId',_0x12c41b,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()[_0x40df('0x3e')](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID['toString'](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x49cdd7['id']['toString'](),_0x12c41b)[_0x40df('0x3e')]('NOW()','createdAt')[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3c'))['from'](_0x40df('0x46'))['where'](_0x40df('0x47'))[_0x40df('0x42')]('ListId\x20=\x20?',LISTID[_0x40df('0x3f')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x40df('0x3f')]();return _0x4b6900;}return db[_0x40df('0x4d')]['findAll']({'where':{'type':_0x40df('0x4e')},'attributes':['id',_0x40df('0x4f')],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x51'),'where':{'id':LISTID}}]})[_0x40df('0x52')](function(_0x59c481){var _0x475ae5=[];if(_0x59c481){var _0x3e0b88;for(var _0x45dd38=0x0,_0x1e1704;_0x45dd38<_0x59c481[_0x40df('0x1e')];_0x45dd38+=0x1){_0x1e1704=_0x59c481[_0x45dd38][_0x40df('0x53')]({'plain':!![]});switch(_0x1e1704['dialCheckDuplicateType']){case'always':_0x475ae5[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x9c8e1a(_0x1e1704,'VoiceQueueId'))[_0x40df('0x52')](function(){})['catch'](_0x4f137f()));break;case _0x40df('0x56'):_0x475ae5[_0x40df('0x54')](db['sequelize'][_0x40df('0x57')](_0x3a2700(_0x1e1704,'VoiceQueueId'))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;default:_0x475ae5[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x306d6c(_0x1e1704,_0x40df('0x58')))['then'](function(){})['catch'](_0x4f137f()));}}}return _0x475ae5;})[_0x40df('0x59')]()['then'](function(){return db[_0x40df('0x4d')][_0x40df('0x5a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x5b'),'where':{'id':LISTID}}]})[_0x40df('0x52')](function(_0x5c3222){var _0x5c5b6b=[];if(_0x5c3222){var _0x6e0b09;for(var _0x36cd7b=0x0,_0x3aa9e0;_0x36cd7b<_0x5c3222[_0x40df('0x1e')];_0x36cd7b+=0x1){_0x3aa9e0=_0x5c3222[_0x36cd7b]['get']({'plain':!![]});_0x5c5b6b['push'](db['sequelize']['query'](_0x41f2b2(_0x3aa9e0,'VoiceQueueId'))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));}}return _0x5c5b6b;})[_0x40df('0x59')]();})[_0x40df('0x52')](function(){return db[_0x40df('0x5c')][_0x40df('0x5a')]({'attributes':['id',_0x40df('0x4f')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x56a986){var _0x35b634=[];if(_0x56a986){for(var _0x4a7602=0x0,_0x2f206e;_0x4a7602<_0x56a986[_0x40df('0x1e')];_0x4a7602+=0x1){_0x2f206e=_0x56a986[_0x4a7602]['get']({'plain':!![]});switch(_0x2f206e[_0x40df('0x4f')]){case _0x40df('0x5d'):_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x9c8e1a(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;case _0x40df('0x56'):_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x3a2700(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;default:_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x306d6c(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));}}}return _0x35b634;})[_0x40df('0x59')]();})[_0x40df('0x52')](function(){return db[_0x40df('0x5c')][_0x40df('0x5a')]({'attributes':['id'],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x2f6dcb){var _0x33539d=[];if(_0x2f6dcb){for(var _0x3e228e=0x0,_0x2d3da3;_0x3e228e<_0x2f6dcb[_0x40df('0x1e')];_0x3e228e+=0x1){_0x2d3da3=_0x2f6dcb[_0x3e228e][_0x40df('0x53')]({'plain':!![]});_0x33539d[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x41f2b2(_0x2d3da3,_0x40df('0x5e')))[_0x40df('0x52')](function(){})['catch'](_0x4f137f()));}}return _0x33539d;})[_0x40df('0x59')]();})['catch'](function(_0xd6ec24){logger[_0x40df('0x19')](_0x40df('0x5f'),_0x40df('0x60'),_0xd6ec24[_0x40df('0x61')]);});}var processPromises=function(_0x52a0e6){return BPromise[_0x40df('0x59')](promises)[_0x40df('0x52')](function(_0x27650c){})[_0x40df('0x31')](function(_0x4c8c56){logger[_0x40df('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0x40df('0x33')](_0x4c8c56));})[_0x40df('0x62')](function(){socket['emit'](_0x40df('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x52a0e6){return _0x52a0e6[_0x40df('0x64')]();}});};var endCsv=function(){return BPromise[_0x40df('0x65')]()[_0x40df('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x40df('0x52')](function(){socket[_0x40df('0x66')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x40df('0x67')](FILEPATH);}catch(_0x5d0d35){logger['error'](_0x40df('0x68'),JSON[_0x40df('0x33')](_0x5d0d35));}finally{process[_0x40df('0x69')](0x0);}});};process['on'](_0x40df('0x6a'),function(){logger['info'](_0x40df('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0x40df('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x40df('0x16')](',');return db[_0x40df('0x2e')][_0x40df('0x5a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x46b39c){var _0x21f62a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x40df('0x6c')](_0x21f62a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x40aed3,_0x1a26d5){total+=0x1;var _0x159e81=total;promises[_0x40df('0x54')](checkRow(_0x40aed3,_0x46b39c,_0x159e81)[_0x40df('0x52')](function(){success+=0x1;})[_0x40df('0x31')](function(_0x515bf6){if(_0x515bf6[_0x40df('0x19')]){errors+=0x1;delete _0x515bf6[_0x40df('0x19')];}else if(_0x515bf6[_0x40df('0x6d')]){duplicates+=0x1;delete _0x515bf6[_0x40df('0x6d')];}rows[_0x40df('0x54')](_0x515bf6);}));if(total%0xc8===0x0){_0x1a26d5[_0x40df('0x6e')]();return processPromises(_0x1a26d5);}},'complete':function(){return processPromises()[_0x40df('0x52')](function(){logger[_0x40df('0x6f')](_0x40df('0x70'));endCsv();});},'error':function(_0x5ae8b7,_0x243e52){logger[_0x40df('0x6f')](_0x40df('0x71'),JSON[_0x40df('0x33')](_0x5ae8b7));endCsv();}});})['catch'](function(_0x1f1ac9){logger[_0x40df('0x19')](_0x40df('0x72'),JSON[_0x40df('0x33')](_0x1f1ac9));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e640df6..f921e00 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 _0x5bd7=['ContactId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.updatedAt','into','ListId','createdAt','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','priority','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','query','spread','catch','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','sequelize','all','timezones','set','offset','send','clone','socket_timestamp','root','server/files/tmp','includes','dialTimezone','header','name','_description','writeFileSync','parse','createReadStream','rows','data','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','trim','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','length','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat'];(function(_0x37554b,_0x1ae745){var _0x377cd=function(_0x2f802c){while(--_0x2f802c){_0x37554b['push'](_0x37554b['shift']());}};_0x377cd(++_0x1ae745);}(_0x5bd7,0x12a));var _0x75bd=function(_0x224ad9,_0x5d97a7){_0x224ad9=_0x224ad9-0x0;var _0x532997=_0x5bd7[_0x224ad9];return _0x532997;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x75bd('0x0'));var Papa=require(_0x75bd('0x1'));var util=require(_0x75bd('0x2'));var BPromise=require('bluebird');var moment=require(_0x75bd('0x3'));var squel=require('squel');var Redis=require(_0x75bd('0x4'));var db=require(_0x75bd('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x75bd('0x6'));var logger=require(_0x75bd('0x7'))(_0x75bd('0x8'));config['redis']=_[_0x75bd('0x9')](config[_0x75bd('0xa')],{'host':_0x75bd('0xb'),'port':0x18eb});var socket=require(_0x75bd('0xc'))(new Redis(config[_0x75bd('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x75bd('0xd')](_0x75bd('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x75bd('0xe'));function isEmail(_0x5521c6){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'](_0x5521c6);}function selectNotIn(_0x7ffa78,_0x5112f0,_0xefd257,_0x555727,_0xe552eb){return squel[_0x75bd('0xf')]()[_0x75bd('0x10')](_0x75bd('0x11'))[_0x75bd('0x12')](_0x555727)[_0x75bd('0x13')](_0x5112f0,null,_0x5112f0+'.id\x20=\x20'+_0x555727+'.'+_0xefd257)['where'](_0x555727+'.'+_0xefd257+'\x20=\x20'+_0x7ffa78+'.'+_0xefd257)[_0x75bd('0x14')](_0x5112f0+_0x75bd('0x15')+_0xe552eb[_0x75bd('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3a1509,_0x1edb5c){promisesAdditionalPhones=[];return db[_0x75bd('0x16')][_0x75bd('0x17')]({'raw':!![],'attributes':['id',_0x75bd('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x75bd('0x19')](function(_0x48c4f1){if(_0x48c4f1!==null){var _0x529357=[];for(var _0x4fa113=0x0;_0x4fa113<_0x48c4f1['length'];_0x4fa113++){var _0x38df20=_0x48c4f1[_0x4fa113];_0x529357[_0x75bd('0x1a')](insertAdditionalPhones(_0x38df20));}}Promise['all'](_0x529357)['then'](function(){_0x3a1509({'val':0x1});});});});}function insertAdditionalPhones(_0x2ab0eb){return new Promise(function(_0x37c85d,_0xb7877){var _0x4a18fd=_0x2ab0eb['AdditionalPhones'];var _0x1bb296=_0x4a18fd['split'](';');var _0x11dcf1=[];orderBy=0x0;for(var _0x365a62=0x0;_0x365a62<_0x1bb296['length'];_0x365a62++){_0x11dcf1[_0x75bd('0x1a')](splitAdditionalPhone(_0x2ab0eb['id'],_0x1bb296[_0x365a62]));}Promise['all'](_0x11dcf1)['then'](function(){_0x37c85d({'val':_0x1bb296[_0x75bd('0x1b')]});});});}function splitAdditionalPhone(_0x18e22f,_0x132b14){return new Promise(function(_0x334bae,_0x1ba6b3){var _0x46fb30=_0x132b14[_0x75bd('0x1c')](':');var _0x277f20=_0x46fb30[0x0];var _0x4a8c0e=_0x46fb30[0x1];if(!_[_0x75bd('0x1d')](_0x4a8c0e)){var _0x44f171=_0x4a8c0e['split']('|');var _0x3b2e62=[];for(var _0x42b215=0x0;_0x42b215<_0x44f171['length'];_0x42b215++){if(_0x44f171[_0x42b215]!==''){var _0x11aba5=_[_0x75bd('0x1e')](promisesAdditionalPhones,{'contactId':_0x18e22f,'phone':_0x44f171[_0x42b215]});if(_0x11aba5['length']==0x0){orderBy++;promisesAdditionalPhones[_0x75bd('0x1a')]({'contactId':_0x18e22f,'contactTypeId':_0x277f20,'phone':_0x44f171[_0x42b215],'orderBy':orderBy});}}}_0x334bae({'ok':0x1});}else _0x334bae({'res':0x0});});}function createAdditionalPhone(_0x38ffe6,_0x220743,_0xc747d8,_0x3e2f9b){var _0x4dbcf8='';var _0x115fb0='';var _0x74438b=_0xc747d8['split']('§');_0x4dbcf8=_0x74438b[0x0];if(_0x74438b['length']==0x2)_0x115fb0=_0x74438b[0x1];return new Promise(function(_0x5570ff,_0x5ee0c1){return db[_0x75bd('0x1f')][_0x75bd('0x20')]({'where':{'CmContactId':_0x38ffe6,'item':_0x4dbcf8}})['then'](function(_0x54d003){if(_0x54d003){return db[_0x75bd('0x1f')][_0x75bd('0x21')]({'ItemTypeId':_0x220743,'description':_0x115fb0,'OrderBy':_0x3e2f9b},{'where':{'CmContactId':_0x38ffe6,'item':_0x4dbcf8}})[_0x75bd('0x19')](function(_0x4d66bd){_0x5570ff({'res':_0x75bd('0x22')});});}else{return db[_0x75bd('0x1f')][_0x75bd('0x23')]({'CmContactId':_0x38ffe6,'item':_0x4dbcf8,'description':_0x115fb0,'ItemTypeId':_0x220743,'OrderBy':_0x3e2f9b,'ItemClass':_0x75bd('0x24')})[_0x75bd('0x19')](function(_0x24ad35){_0x5570ff({'res':_0x75bd('0x25')});});}});});}function insertCmHopper(_0x17ef77,_0x47041e,_0x2bc660,_0x54f75d,_0x58856d){var _0x2ff066=[_0x75bd('0x26'),'cm_contacts.scheduledat','cm_contacts.id',_0x75bd('0x27'),_0x47041e+'.'+_0x54f75d,_0x75bd('0x28'),'cm_contacts.updatedAt',_0x75bd('0x29'),_0x75bd('0x2a'),'\x22'+_0x58856d+'\x22'];return squel[_0x75bd('0x2b')]()['into']('cm_hopper')[_0x75bd('0x2c')]([_0x75bd('0x11'),_0x75bd('0x2d'),_0x75bd('0x2e'),'ListId',_0x54f75d,'createdAt',_0x75bd('0x2f'),'priority',_0x75bd('0x30'),_0x75bd('0x31')],squel['select']()[_0x75bd('0x32')](_0x2ff066)['from'](_0x47041e)[_0x75bd('0x13')](_0x75bd('0x33'),null,_0x75bd('0x34')+_0x47041e+_0x75bd('0x35'))[_0x75bd('0x13')](_0x2bc660,null,_0x2bc660+_0x75bd('0x36')+_0x47041e+'.'+_0x54f75d)[_0x75bd('0x14')](_0x47041e+_0x75bd('0x37'),_0x17ef77)[_0x75bd('0x14')](_0x75bd('0x38'),NOW)[_0x75bd('0x14')](_0x75bd('0x39'),selectNotIn(_0x47041e,_0x2bc660,_0x54f75d,_0x75bd('0x3a'),[_0x75bd('0x3b'),_0x75bd('0x3c')]))[_0x75bd('0x14')](_0x75bd('0x39'),selectNotIn(_0x47041e,_0x2bc660,_0x54f75d,_0x75bd('0x3a'),[_0x75bd('0x3b')])))[_0x75bd('0x3d')]();}function insertCmHopperBlack(_0xf87bf9,_0x39855f,_0x324712,_0x42cd98){var _0x391741=[_0x75bd('0x26'),_0x75bd('0x3e'),_0x75bd('0x27'),_0x39855f+'.'+_0x42cd98,_0x75bd('0x28'),_0x75bd('0x3f')];return squel[_0x75bd('0x2b')]()[_0x75bd('0x40')]('cm_hopper_black')['fromQuery'](['phone',_0x75bd('0x2e'),_0x75bd('0x41'),_0x42cd98,_0x75bd('0x42'),_0x75bd('0x2f')],squel[_0x75bd('0xf')]()['fields'](_0x391741)[_0x75bd('0x12')](_0x39855f)[_0x75bd('0x13')](_0x75bd('0x33'),null,_0x75bd('0x34')+_0x39855f+_0x75bd('0x35'))['join'](_0x324712,null,_0x324712+_0x75bd('0x36')+_0x39855f+'.'+_0x42cd98)[_0x75bd('0x14')](_0x39855f+_0x75bd('0x37'),_0xf87bf9)[_0x75bd('0x14')](_0x75bd('0x38'),NOW)[_0x75bd('0x14')](_0x75bd('0x39'),squel[_0x75bd('0xf')]()[_0x75bd('0x10')]('phone')[_0x75bd('0x12')](_0x75bd('0x43'))[_0x75bd('0x14')](_0x75bd('0x44'),_0xf87bf9)['where'](_0x42cd98+'\x20=\x20'+_0x39855f+'.'+_0x42cd98)))[_0x75bd('0x3d')]();}function insertTzCmHopper(_0x1e2700,_0x18f7d2,_0x30af77,_0x281fe7,_0xaf9e26,_0x18b0f4){var _0x193286=[_0x75bd('0x26'),_0x75bd('0x45')+_0x18b0f4+_0x75bd('0x46'),_0x75bd('0x3e'),_0x75bd('0x27'),_0x18f7d2+'.'+_0x281fe7,_0x75bd('0x28'),'cm_contacts.updatedAt','cm_contacts.priority',_0x75bd('0x2a'),'\x22'+_0xaf9e26+'\x22'];var _0x1f8197=squel[_0x75bd('0x2b')]()[_0x75bd('0x40')](_0x75bd('0x3a'))[_0x75bd('0x2c')]([_0x75bd('0x11'),'scheduledat',_0x75bd('0x2e'),'ListId',_0x281fe7,'createdAt','updatedAt',_0x75bd('0x47'),_0x75bd('0x30'),_0x75bd('0x31')],squel['select']()['fields'](_0x193286)[_0x75bd('0x12')](_0x18f7d2)[_0x75bd('0x13')](_0x75bd('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x18f7d2+'.CmListId')[_0x75bd('0x13')](_0x30af77,null,_0x30af77+_0x75bd('0x36')+_0x18f7d2+'.'+_0x281fe7)[_0x75bd('0x13')](_0x18b0f4,null,_0x18b0f4+'.id\x20=\x20'+_0x18f7d2+'.'+_0x281fe7)[_0x75bd('0x14')](_0x18f7d2+_0x75bd('0x37'),_0x1e2700)[_0x75bd('0x14')](_0x75bd('0x38'),NOW)[_0x75bd('0x14')](_0x75bd('0x39'),selectNotIn(_0x18f7d2,_0x30af77,_0x281fe7,'cm_hopper',[_0x75bd('0x3b'),_0x75bd('0x3c')]))['where'](_0x75bd('0x39'),selectNotIn(_0x18f7d2,_0x30af77,_0x281fe7,'cm_hopper',[_0x75bd('0x3b')])))['toString']();return _0x1f8197;}function insertTzCmHopperBlack(_0x781609,_0x32ed40,_0x41de0c,_0x53d577){var _0x2473f5=[_0x75bd('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x32ed40+'.'+_0x53d577,'cm_contacts.createdAt',_0x75bd('0x3f')];return squel['insert']()[_0x75bd('0x40')]('cm_hopper_black')[_0x75bd('0x2c')]([_0x75bd('0x11'),_0x75bd('0x2e'),'ListId',_0x53d577,_0x75bd('0x42'),_0x75bd('0x2f')],squel[_0x75bd('0xf')]()['fields'](_0x2473f5)[_0x75bd('0x12')](_0x32ed40)[_0x75bd('0x13')]('cm_contacts',null,_0x75bd('0x34')+_0x32ed40+'.CmListId')['join'](_0x41de0c,null,_0x41de0c+_0x75bd('0x36')+_0x32ed40+'.'+_0x53d577)[_0x75bd('0x14')](_0x32ed40+'.CmListId\x20=\x20?',_0x781609)[_0x75bd('0x14')](_0x75bd('0x38'),NOW)[_0x75bd('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x75bd('0xf')]()[_0x75bd('0x10')](_0x75bd('0x11'))['from'](_0x75bd('0x43'))['where'](_0x75bd('0x44'),_0x781609)['where'](_0x53d577+_0x75bd('0x48')+_0x32ed40+'.'+_0x53d577)))['toString']();}function insertCmHopperAdditionalPhones(_0x231f88){var _0xbdc60f=[_0x75bd('0x49'),_0x75bd('0x4a'),_0x75bd('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x75bd('0x40')](_0x75bd('0x4c'))['fromQuery'](['CmHopperId',_0x75bd('0x11'),_0x75bd('0x4d'),'createdAt',_0x75bd('0x2f')],squel[_0x75bd('0xf')]()[_0x75bd('0x32')](_0xbdc60f)[_0x75bd('0x12')](_0x75bd('0x3a'))[_0x75bd('0x13')](_0x75bd('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x75bd('0x13')](_0x75bd('0x4e'),null,_0x75bd('0x4f'))[_0x75bd('0x14')](_0x75bd('0x50'),_0x231f88)[_0x75bd('0x14')](_0x75bd('0x38'),NOW))[_0x75bd('0x3d')]();}function insertCmContact(_0x908d52,_0x28ab8a,_0x71132,_0x50be31){var _0x33ab86=_['concat'](_[_0x75bd('0x51')](_0x50be31),['ListId',_0x75bd('0x52'),_0x75bd('0x42'),_0x75bd('0x2f')]);return squel[_0x75bd('0x2b')]()[_0x75bd('0x40')](_0x75bd('0x33'))[_0x75bd('0x2c')](_0x33ab86,squel[_0x75bd('0xf')]()[_0x75bd('0x32')](_0x33ab86)['from'](_0x28ab8a)[_0x75bd('0x14')]('('+_0x71132[_0x75bd('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x75bd('0xf')]()[_0x75bd('0x32')](_0x71132)[_0x75bd('0x12')]('cm_contacts')['where']('ListId\x20=\x20?',_0x908d52)[_0x75bd('0x14')](_0x75bd('0x53')))[_0x75bd('0x14')](_0x75bd('0x54'),squel['select']()[_0x75bd('0x10')](_0x75bd('0x55'),_0x75bd('0x56'))['from'](_0x28ab8a)[_0x75bd('0x57')](_0x71132[_0x75bd('0x13')](','))))[_0x75bd('0x3d')]();}function handleStop(){logger[_0x75bd('0x58')](_0x75bd('0x59'));stopped=!![];}function handleUncaughtException(_0x57266a){logger[_0x75bd('0x5a')](_0x57266a[_0x75bd('0x5b')]);process[_0x75bd('0x5c')](0x1);}function handleError(_0x507911,_0x348132){stats[_0x75bd('0x5d')][_0x75bd('0x1a')]({'name':_0x348132['code'],'message':_0x348132['message'],'row':_0x507911});}function handleQuery(_0x4e477e){logger[_0x75bd('0x58')](_0x4e477e);return db['sequelize'][_0x75bd('0x5e')](_0x4e477e)[_0x75bd('0x5f')](function(_0x35b9eb){results[_0x75bd('0x1a')](_0x35b9eb);})[_0x75bd('0x60')](function(_0x3edb8f){logger[_0x75bd('0x5a')](_0x3edb8f['message']);});}function updateTzCampaigns(_0x49f366){return new Promise(function(_0x1b57a5,_0x571560){var _0x334256=squel[_0x75bd('0xf')]()[_0x75bd('0x32')](['campaigns.id','campaigns.dialTimezone'])[_0x75bd('0x12')](_0x75bd('0x61'))[_0x75bd('0x13')]('campaigns_has_cm_lists',null,_0x75bd('0x62'))[_0x75bd('0x14')]('campaigns_has_cm_lists.CmListId='+_0x49f366);db['sequelize'][_0x75bd('0x5e')](_0x334256[_0x75bd('0x3d')]())[_0x75bd('0x5f')](function(_0x145ac8){var _0x5a90fa=[];for(var _0x2edc8f=0x0;_0x2edc8f<_0x145ac8[_0x75bd('0x1b')];_0x2edc8f++){_0x5a90fa[_0x75bd('0x1a')](getTimezoneData(_0x145ac8[_0x2edc8f],tmp_campaigns));}BPromise['all'](_0x5a90fa)['then'](function(){_0x1b57a5({'val':0x1});});})[_0x75bd('0x60')](function(_0x7190f6){logger[_0x75bd('0x5a')](_0x7190f6['message']);_0x1b57a5({'val':0x0});});});}function updateTzVoiceQueues(_0x2f29e9){return new Promise(function(_0x47ccc6,_0x8ee735){var _0x495933=squel['select']()[_0x75bd('0x32')]([_0x75bd('0x63'),_0x75bd('0x64')])[_0x75bd('0x12')](_0x75bd('0x65'))[_0x75bd('0x13')]('voice_queues_has_cm_lists',null,_0x75bd('0x66'))[_0x75bd('0x14')](_0x75bd('0x67')+_0x2f29e9);db[_0x75bd('0x68')][_0x75bd('0x5e')](_0x495933['toString']())[_0x75bd('0x5f')](function(_0x32cc98){var _0x676db1=[];for(var _0x38fc01=0x0;_0x38fc01<_0x32cc98[_0x75bd('0x1b')];_0x38fc01++){_0x676db1[_0x75bd('0x1a')](getTimezoneData(_0x32cc98[_0x38fc01],tmp_voice_queues));}BPromise[_0x75bd('0x69')](_0x676db1)['then'](function(){_0x47ccc6({'val':0x1});});})[_0x75bd('0x60')](function(_0x5c7537){logger[_0x75bd('0x5a')](_0x5c7537[_0x75bd('0x5b')]);_0x47ccc6({'val':0x0});});});}function getTimezoneData(_0x553d57,_0x13d797){return new Promise(function(_0x5f6cee,_0x236da9){var _0x2cc01b=shared[_0x75bd('0x6a')];var _0x2b4dc4=_0x2cc01b[_0x553d57['dialTimezone']];if(_[_0x75bd('0x1d')](_0x2b4dc4)){_0x5f6cee({'ret':0x1});}else{var _0x4b4ee0=_0x2b4dc4['utcOffset'];var _0x382398=squel[_0x75bd('0x2b')]()['into'](_0x13d797)[_0x75bd('0x6b')]('id',_0x553d57['id'])['set'](_0x75bd('0x6c'),_0x4b4ee0)[_0x75bd('0x6b')]('dialTimezone',_0x553d57['dialTimezone'])[_0x75bd('0x3d')]();return db[_0x75bd('0x68')][_0x75bd('0x5e')](_0x382398)['spread'](function(_0x5cb67e){_0x5f6cee({'ret':0x1});})[_0x75bd('0x60')](function(_0xf98161){logger[_0x75bd('0x5a')](_0xf98161[_0x75bd('0x5b')]);_0x236da9({'ret':0x1});});}});}function handleTZQuery(_0x35a788){logger[_0x75bd('0x58')](_0x35a788);return db[_0x75bd('0x68')][_0x75bd('0x5e')](_0x35a788)[_0x75bd('0x5f')](function(_0x3eb1b2){})[_0x75bd('0x60')](function(_0x563e2e){logger[_0x75bd('0x5a')](_0x563e2e[_0x75bd('0x5b')]);});}function main(_0xf75d5a,_0x2b2b8f,_0x101962,_0x51ee1e){logger['info']('main',_0xf75d5a,JSON['stringify'](_0x2b2b8f));process[_0x75bd('0x6d')]('start');var _0x581672=_0x2b2b8f['binding'];var _0x380a0b=_[_0x75bd('0x6e')](_0x581672);var _0x458611=_0x2b2b8f[_0x75bd('0x6f')];var _0x4a22d1=path[_0x75bd('0x13')](config[_0x75bd('0x70')],_0x75bd('0x71'),_0x458611+'.csv');hasTZ=_[_0x75bd('0x51')](_0x581672)[_0x75bd('0x72')](_0x75bd('0x73'));var _0x17857c=_['keys'](_0x581672)[_0x75bd('0x13')]();logger[_0x75bd('0x58')](_0x75bd('0x74'),_0x17857c);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x75bd('0x75')]})[_0x75bd('0x19')](function(_0x3c29c4){for(var _0x2fc743=0x0;_0x2fc743<_0x3c29c4[_0x75bd('0x1b')];_0x2fc743++){if(_0x3c29c4[_0x2fc743][_0x75bd('0x75')]in _0x581672){contactItemTypes[_0x75bd('0x1a')](_0x3c29c4[_0x2fc743]);delete _0x380a0b[_0x3c29c4[_0x2fc743][_0x75bd('0x75')]];hasAdditionalPhones=!![];}for(var _0xf216c2 in _0x581672){if(_0x3c29c4[_0x2fc743]['name']+_0x75bd('0x76')===_0xf216c2){phoneDescriptions[_0x75bd('0x1a')]({'itemTypeId':_0x3c29c4[_0x2fc743]['id'],'description':_0xf216c2});delete _0x380a0b[_0xf216c2];}}}if(hasAdditionalPhones)_0x380a0b[_0x75bd('0x18')]='';var _0x1c267d=_[_0x75bd('0x51')](_0x380a0b)['join']();logger[_0x75bd('0x58')](_0x75bd('0x74'),_0x1c267d);fs[_0x75bd('0x77')](_0x4a22d1,_0x1c267d+'\x0a');Papa[_0x75bd('0x78')](fs[_0x75bd('0x79')](_0xf75d5a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x288807,_0x48dd99){try{for(var _0x17ae99=0x0,_0x1377fa=[];_0x17ae99<_0x288807['data'][_0x75bd('0x1b')];_0x17ae99++){stats[_0x75bd('0x7a')]+=0x1;if(_0x288807[_0x75bd('0x5d')][_0x17ae99]){handleError(_0x288807[_0x75bd('0x7b')][_0x17ae99],_0x288807[_0x75bd('0x5d')][_0x17ae99]);}else{var _0x151496=[];var _0xeeb0d5=[];var _0x524b43={};for(var _0x2792f1 in _0x581672){let _0x38ce33=contactItemTypes[_0x75bd('0x7c')](_0x2cabb5=>_0x2cabb5[_0x75bd('0x75')]===_0x2792f1);let _0x9a42ec=contactItemTypes[_0x75bd('0x7c')](_0x17ee2c=>_0x17ee2c[_0x75bd('0x75')]+'_description'===_0x2792f1);if(_[_0x75bd('0x1d')](_0x38ce33)&&_['isNil'](_0x9a42ec)){if(_0x581672[_0x75bd('0x7d')](_0x2792f1)){if(_0x288807[_0x75bd('0x7b')][_0x17ae99][_0x581672[_0x2792f1]]){var _0x2e29c1=_['trim'](_0x288807[_0x75bd('0x7b')][_0x17ae99][_0x581672[_0x2792f1]][_0x75bd('0x7e')](/"/g,'\x27'));switch(_0x2792f1){case'scheduledat':var _0x2c24ac=moment(_0x2e29c1,_0x75bd('0xe'),!![]);if(_0x2c24ac[_0x75bd('0x7f')]()){_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x2e29c1+'\x22');}else{_0x151496['push'](_0x75bd('0x80'));}break;case'priority':var _0x4a26ce=parseInt(_0x2e29c1);_0x2e29c1=_['isNaN'](_0x4a26ce)||_0x4a26ce<0x0||_0x4a26ce>0x4?_0x51ee1e?0x3:0x2:_0x4a26ce;_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x2e29c1+'\x22');break;case _0x75bd('0x30'):var _0x145402=parseInt(_0x2e29c1);if(_[_0x75bd('0x81')](_0x145402)&&_[_0x75bd('0x72')](_0x101962,_0x145402)){_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x145402+'\x22');}else{_0x151496['push'](_0x75bd('0x82'));}break;case _0x75bd('0x83'):if(isEmail(_0x2e29c1)){_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x2e29c1+'\x22');}else{_0x151496[_0x75bd('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x56169b=moment(_0x2e29c1,_0x75bd('0x84'),!![]);if(_0x56169b['isValid']()){_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x2e29c1+'\x22');}else{_0x151496[_0x75bd('0x1a')](_0x75bd('0x85'));}break;case _0x75bd('0x73'):var _0xd39bdd=shared[_0x75bd('0x6a')];var _0x237c85=_0xd39bdd[_0x2e29c1];if(!_[_0x75bd('0x1d')](_0x237c85)){var _0x1ce30d=_0x237c85[_0x75bd('0x86')];_0x1377fa['push']('\x22'+_0x2e29c1+'\x22');_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x1ce30d+'\x22');}break;default:_0x1377fa[_0x75bd('0x1a')]('\x22'+_0x2e29c1+'\x22');}}else{switch(_0x2792f1){case _0x75bd('0x87'):case'phone':_0x151496[_0x75bd('0x1a')](_0x2792f1+'\x20not\x20specified');break;default:_0x1377fa[_0x75bd('0x1a')]('\x22\x22');}}}}else{var _0x25b5c3='';if(!_['isNil'](_0x38ce33)){if(!_0x524b43['hasOwnProperty'](_0x38ce33['id'])){if(!_[_0x75bd('0x1d')](_0x288807[_0x75bd('0x7b')][_0x17ae99][_0x581672[_0x2792f1]])){var _0x2e29c1=_[_0x75bd('0x88')](_0x288807[_0x75bd('0x7b')][_0x17ae99][_0x581672[_0x2792f1]][_0x75bd('0x7e')](/"/g,'\x27'));var _0x228f3a=phoneDescriptions['find'](_0x50af39=>_0x50af39['itemTypeId']===_0x38ce33['id']);if(!_[_0x75bd('0x1d')](_0x228f3a)){var _0x3f136a=_[_0x75bd('0x88')](_0x288807[_0x75bd('0x7b')][_0x17ae99][_0x581672[_0x228f3a['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x3f136a))_0x2e29c1=_0x2e29c1+'§'+_0x3f136a;}if(_0x25b5c3=='')_0x25b5c3=_0x2e29c1;else _0x25b5c3+='|'+_0x2e29c1;}_0xeeb0d5['push'](_0x38ce33['id']+':'+_0x25b5c3);_0x524b43[_0x38ce33['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1377fa['push']('\x22'+_0xeeb0d5[_0x75bd('0x13')](';')+'\x22');}if(_0x151496['length']){handleError(_0x288807[_0x75bd('0x7b')][_0x17ae99],{'code':'SystemRow','message':_0x151496[_0x75bd('0x13')]()});}else{fs[_0x75bd('0x89')](_0x4a22d1,_0x1377fa['join']()+'\x0a');}_0x1377fa=[];}if(!(stats[_0x75bd('0x7a')]%0xc8)){socket['emit'](_0x75bd('0x8a')+_0x458611,stats);stats[_0x75bd('0x5d')]=[];}}if(stopped){logger[_0x75bd('0x58')](_0x75bd('0x8b'));_0x48dd99[_0x75bd('0x8c')]();}}catch(_0x22f4c9){handleError(_0x288807[_0x75bd('0x7b')][_0x17ae99],{'code':_0x75bd('0x8d'),'message':_0x22f4c9['message']});logger[_0x75bd('0x5a')](_0x75bd('0x8e'),_0x22f4c9[_0x75bd('0x5b')]);}},'complete':function(){try{var _0x4d64ba=[];var _0x565abe=[];var _0x47b908=_0x75bd('0x33');if(_0x2b2b8f['duplicates']&&_0x2b2b8f[_0x75bd('0x8f')][_0x75bd('0x1b')]){_0x47b908='cm_contacts_'+_0x458611;_0x4d64ba[_0x75bd('0x1a')](_0x75bd('0x90')+_0x47b908+_0x75bd('0x91'));}tmp_campaigns='campaigns_'+_0x458611;tmp_voice_queues='voice_queues_'+_0x458611;_0x565abe[_0x75bd('0x1a')](_0x75bd('0x90')+tmp_campaigns+_0x75bd('0x92'));_0x565abe['push'](_0x75bd('0x90')+tmp_voice_queues+_0x75bd('0x92'));BPromise['each'](_0x565abe,handleTZQuery)[_0x75bd('0x19')](function(_0x1467e0){updateTzCampaigns(_0x2b2b8f[_0x75bd('0x41')])[_0x75bd('0x19')](function(_0xfb53ca){updateTzVoiceQueues(_0x2b2b8f['ListId'])[_0x75bd('0x19')](function(_0x3f7e6f){if(hasTZ)_0x1c267d=_0x1c267d['replace'](_0x75bd('0x73'),_0x75bd('0x93'));var _0x558405=util['format'](_0x75bd('0x94'),_0x4a22d1,_0x47b908,_0x1c267d,_0x2b2b8f[_0x75bd('0x41')],_0x2b2b8f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x581672['scheduledat'])){_0x558405+=_0x75bd('0x95');}_0x4d64ba[_0x75bd('0x1a')](_0x558405);if(_0x2b2b8f[_0x75bd('0x8f')]&&_0x2b2b8f['duplicates']['length']){_0x4d64ba[_0x75bd('0x1a')](insertCmContact(_0x2b2b8f[_0x75bd('0x41')],_0x47b908,_0x2b2b8f[_0x75bd('0x8f')],_0x581672));_0x4d64ba[_0x75bd('0x1a')](_0x75bd('0x96')+_0x47b908+';');}BPromise[_0x75bd('0x97')](_0x4d64ba,handleQuery)[_0x75bd('0x19')](function(_0x1f329c){BPromise[_0x75bd('0x69')]([handleAdditionalPhones()])[_0x75bd('0x19')](function(){_0x4d64ba=[];for(var _0x83ddb6=0x0;_0x83ddb6\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','filter','split','findOne','updated','CmContactHasItem','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','updatedAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','phone','ListId','createdAt','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts','cm_hopper_black','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','utcOffset','set','offset','dialTimezone','main','send','binding','socket_timestamp','server/files/tmp','.csv'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x33bd9f,_0x3aa9f3){_0x33bd9f=_0x33bd9f-0x0;var _0x26136a=_0xf6e6[_0x33bd9f];return _0x26136a;};'use strict';var fs=require('fs');var path=require(_0x6f6e('0x0'));var _=require(_0x6f6e('0x1'));var Papa=require(_0x6f6e('0x2'));var util=require(_0x6f6e('0x3'));var BPromise=require(_0x6f6e('0x4'));var moment=require(_0x6f6e('0x5'));var squel=require(_0x6f6e('0x6'));var Redis=require(_0x6f6e('0x7'));var db=require(_0x6f6e('0x8'))['db'];var config=require(_0x6f6e('0x9'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')('import');config[_0x6f6e('0xa')]=_['defaults'](config[_0x6f6e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f6e('0xb'))(new Redis(config[_0x6f6e('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('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()['format'](_0x6f6e('0xc'));function isEmail(_0x5a3dca){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))*$/[_0x6f6e('0xd')](_0x5a3dca);}function selectNotIn(_0x4bbb02,_0x43e07a,_0x1c8923,_0x85090c,_0x3fc62b){return squel[_0x6f6e('0xe')]()[_0x6f6e('0xf')]('phone')['from'](_0x85090c)[_0x6f6e('0x10')](_0x43e07a,null,_0x43e07a+'.id\x20=\x20'+_0x85090c+'.'+_0x1c8923)['where'](_0x85090c+'.'+_0x1c8923+'\x20=\x20'+_0x4bbb02+'.'+_0x1c8923)['where'](_0x43e07a+_0x6f6e('0x11')+_0x3fc62b[_0x6f6e('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x50332a,_0x220ae7){promisesAdditionalPhones=[];return db['CmContact'][_0x6f6e('0x12')]({'raw':!![],'attributes':['id',_0x6f6e('0x13')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6f6e('0x14')](function(_0x15139c){if(_0x15139c!==null){var _0xfac229=[];for(var _0x1a6ffc=0x0;_0x1a6ffc<_0x15139c[_0x6f6e('0x15')];_0x1a6ffc++){var _0x5d4a7f=_0x15139c[_0x1a6ffc];_0xfac229[_0x6f6e('0x16')](insertAdditionalPhones(_0x5d4a7f));}}Promise[_0x6f6e('0x17')](_0xfac229)[_0x6f6e('0x14')](function(){_0x50332a({'val':0x1});});});});}function insertAdditionalPhones(_0x2cccaf){return new Promise(function(_0x155e91,_0x29d153){var _0x35f8d0=_0x2cccaf[_0x6f6e('0x13')];var _0x867a1=_0x35f8d0['split'](';');var _0x37f0ad=[];orderBy=0x0;for(var _0x54103c=0x0;_0x54103c<_0x867a1[_0x6f6e('0x15')];_0x54103c++){_0x37f0ad[_0x6f6e('0x16')](splitAdditionalPhone(_0x2cccaf['id'],_0x867a1[_0x54103c]));}Promise[_0x6f6e('0x17')](_0x37f0ad)[_0x6f6e('0x14')](function(){_0x155e91({'val':_0x867a1[_0x6f6e('0x15')]});});});}function splitAdditionalPhone(_0x130970,_0x1b31ec){return new Promise(function(_0x156ce3,_0xc12e2){var _0x3a35d0=_0x1b31ec['split'](':');var _0x251bfa=_0x3a35d0[0x0];var _0x123152=_0x3a35d0[0x1];if(!_['isNil'](_0x123152)){var _0x3dff1b=_0x123152['split']('|');var _0x58f46e=[];for(var _0x49d92c=0x0;_0x49d92c<_0x3dff1b[_0x6f6e('0x15')];_0x49d92c++){if(_0x3dff1b[_0x49d92c]!==''){var _0x3b50bd=_[_0x6f6e('0x18')](promisesAdditionalPhones,{'contactId':_0x130970,'phone':_0x3dff1b[_0x49d92c]});if(_0x3b50bd[_0x6f6e('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0x6f6e('0x16')]({'contactId':_0x130970,'contactTypeId':_0x251bfa,'phone':_0x3dff1b[_0x49d92c],'orderBy':orderBy});}}}_0x156ce3({'ok':0x1});}else _0x156ce3({'res':0x0});});}function createAdditionalPhone(_0x4685b6,_0x376402,_0x14aaef,_0xbbfbe1){var _0x125fa8='';var _0x21019d='';var _0xdb0684=_0x14aaef[_0x6f6e('0x19')]('§');_0x125fa8=_0xdb0684[0x0];if(_0xdb0684[_0x6f6e('0x15')]==0x2)_0x21019d=_0xdb0684[0x1];return new Promise(function(_0x18852b,_0x479956){return db['CmContactHasItem'][_0x6f6e('0x1a')]({'where':{'CmContactId':_0x4685b6,'item':_0x125fa8}})[_0x6f6e('0x14')](function(_0x4fbc90){if(_0x4fbc90){return db['CmContactHasItem']['update']({'ItemTypeId':_0x376402,'description':_0x21019d,'OrderBy':_0xbbfbe1},{'where':{'CmContactId':_0x4685b6,'item':_0x125fa8}})[_0x6f6e('0x14')](function(_0x46f90d){_0x18852b({'res':_0x6f6e('0x1b')});});}else{return db[_0x6f6e('0x1c')][_0x6f6e('0x1d')]({'CmContactId':_0x4685b6,'item':_0x125fa8,'description':_0x21019d,'ItemTypeId':_0x376402,'OrderBy':_0xbbfbe1,'ItemClass':_0x6f6e('0x1e')})[_0x6f6e('0x14')](function(_0x303756){_0x18852b({'res':_0x6f6e('0x1f')});});}});});}function insertCmHopper(_0x4dd384,_0x3c22f1,_0x783821,_0x51579d,_0x1c9a4a){var _0x338706=['cm_contacts.phone',_0x6f6e('0x20'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x3c22f1+'.'+_0x51579d,_0x6f6e('0x23'),_0x6f6e('0x24'),_0x6f6e('0x25'),_0x6f6e('0x26'),'\x22'+_0x1c9a4a+'\x22'];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x6f6e('0x29'))[_0x6f6e('0x2a')](['phone',_0x6f6e('0x2b'),_0x6f6e('0x2c'),'ListId',_0x51579d,'createdAt',_0x6f6e('0x2d'),'priority',_0x6f6e('0x2e'),_0x6f6e('0x2f')],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x338706)[_0x6f6e('0x31')](_0x3c22f1)[_0x6f6e('0x10')]('cm_contacts',null,_0x6f6e('0x32')+_0x3c22f1+'.CmListId')[_0x6f6e('0x10')](_0x783821,null,_0x783821+_0x6f6e('0x33')+_0x3c22f1+'.'+_0x51579d)[_0x6f6e('0x34')](_0x3c22f1+'.CmListId\x20=\x20?',_0x4dd384)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),selectNotIn(_0x3c22f1,_0x783821,_0x51579d,'cm_hopper',[_0x6f6e('0x37'),_0x6f6e('0x38')]))[_0x6f6e('0x34')](_0x6f6e('0x36'),selectNotIn(_0x3c22f1,_0x783821,_0x51579d,_0x6f6e('0x29'),[_0x6f6e('0x37')])))[_0x6f6e('0x39')]();}function insertCmHopperBlack(_0x3303fe,_0x57f921,_0xa183f3,_0x2846ce){var _0xf9159e=[_0x6f6e('0x3a'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x57f921+'.'+_0x2846ce,'cm_contacts.createdAt',_0x6f6e('0x24')];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')]('cm_hopper_black')[_0x6f6e('0x2a')]([_0x6f6e('0x3b'),_0x6f6e('0x2c'),_0x6f6e('0x3c'),_0x2846ce,_0x6f6e('0x3d'),'updatedAt'],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0xf9159e)['from'](_0x57f921)[_0x6f6e('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x57f921+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0xa183f3,null,_0xa183f3+_0x6f6e('0x33')+_0x57f921+'.'+_0x2846ce)[_0x6f6e('0x34')](_0x57f921+_0x6f6e('0x3f'),_0x3303fe)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),squel[_0x6f6e('0xe')]()['field'](_0x6f6e('0x3b'))[_0x6f6e('0x31')]('cm_hopper_black')[_0x6f6e('0x34')](_0x6f6e('0x40'),_0x3303fe)[_0x6f6e('0x34')](_0x2846ce+'\x20=\x20'+_0x57f921+'.'+_0x2846ce)))['toString']();}function insertTzCmHopper(_0x11b6ec,_0x42e682,_0x16266b,_0x58f752,_0x3ddf48,_0x1fec79){var _0x47e284=[_0x6f6e('0x3a'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x1fec79+_0x6f6e('0x41'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x42e682+'.'+_0x58f752,_0x6f6e('0x23'),'cm_contacts.updatedAt',_0x6f6e('0x25'),_0x6f6e('0x26'),'\x22'+_0x3ddf48+'\x22'];var _0x3a65e6=squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x29'))[_0x6f6e('0x2a')](['phone','scheduledat',_0x6f6e('0x2c'),'ListId',_0x58f752,_0x6f6e('0x3d'),'updatedAt','priority',_0x6f6e('0x2e'),_0x6f6e('0x2f')],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x47e284)[_0x6f6e('0x31')](_0x42e682)[_0x6f6e('0x10')](_0x6f6e('0x42'),null,_0x6f6e('0x32')+_0x42e682+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0x16266b,null,_0x16266b+_0x6f6e('0x33')+_0x42e682+'.'+_0x58f752)['join'](_0x1fec79,null,_0x1fec79+'.id\x20=\x20'+_0x42e682+'.'+_0x58f752)[_0x6f6e('0x34')](_0x42e682+_0x6f6e('0x3f'),_0x11b6ec)[_0x6f6e('0x34')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x42e682,_0x16266b,_0x58f752,_0x6f6e('0x29'),['\x22always\x22',_0x6f6e('0x38')]))['where'](_0x6f6e('0x36'),selectNotIn(_0x42e682,_0x16266b,_0x58f752,_0x6f6e('0x29'),[_0x6f6e('0x37')])))['toString']();return _0x3a65e6;}function insertTzCmHopperBlack(_0x27f5f0,_0x551416,_0x96ea87,_0x45f1fd){var _0x3074ee=['cm_contacts.phone',_0x6f6e('0x21'),_0x6f6e('0x22'),_0x551416+'.'+_0x45f1fd,'cm_contacts.createdAt',_0x6f6e('0x24')];return squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x43'))['fromQuery']([_0x6f6e('0x3b'),_0x6f6e('0x2c'),_0x6f6e('0x3c'),_0x45f1fd,_0x6f6e('0x3d'),_0x6f6e('0x2d')],squel['select']()['fields'](_0x3074ee)[_0x6f6e('0x31')](_0x551416)['join']('cm_contacts',null,_0x6f6e('0x32')+_0x551416+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0x96ea87,null,_0x96ea87+_0x6f6e('0x33')+_0x551416+'.'+_0x45f1fd)[_0x6f6e('0x34')](_0x551416+_0x6f6e('0x3f'),_0x27f5f0)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),squel['select']()[_0x6f6e('0xf')]('phone')['from']('cm_hopper_black')['where']('ListId\x20=\x20?',_0x27f5f0)['where'](_0x45f1fd+_0x6f6e('0x44')+_0x551416+'.'+_0x45f1fd)))[_0x6f6e('0x39')]();}function insertCmHopperAdditionalPhones(_0x117334){var _0x5dfa8c=[_0x6f6e('0x45'),_0x6f6e('0x46'),_0x6f6e('0x47'),'cm_contact_has_items.createdAt',_0x6f6e('0x48')];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x6f6e('0x49'))[_0x6f6e('0x2a')]([_0x6f6e('0x4a'),_0x6f6e('0x3b'),_0x6f6e('0x4b'),'createdAt','updatedAt'],squel['select']()[_0x6f6e('0x30')](_0x5dfa8c)[_0x6f6e('0x31')]('cm_hopper')[_0x6f6e('0x10')](_0x6f6e('0x42'),null,_0x6f6e('0x4c'))[_0x6f6e('0x10')](_0x6f6e('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6f6e('0x34')](_0x6f6e('0x4e'),_0x117334)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6f6e('0x39')]();}function insertCmContact(_0x352536,_0x3c2e53,_0x1b45b6,_0x23ba86){var _0x12a4fa=_[_0x6f6e('0x4f')](_[_0x6f6e('0x50')](_0x23ba86),[_0x6f6e('0x3c'),_0x6f6e('0x51'),_0x6f6e('0x3d'),_0x6f6e('0x2d')]);return squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x42'))['fromQuery'](_0x12a4fa,squel['select']()['fields'](_0x12a4fa)['from'](_0x3c2e53)['where']('('+_0x1b45b6[_0x6f6e('0x10')](',')+_0x6f6e('0x52'),squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x1b45b6)['from']('cm_contacts')[_0x6f6e('0x34')](_0x6f6e('0x40'),_0x352536)[_0x6f6e('0x34')]('deletedAt\x20IS\x20NULL'))[_0x6f6e('0x34')](_0x6f6e('0x53'),squel[_0x6f6e('0xe')]()[_0x6f6e('0xf')](_0x6f6e('0x54'),_0x6f6e('0x55'))['from'](_0x3c2e53)['group'](_0x1b45b6['join'](','))))[_0x6f6e('0x39')]();}function handleStop(){logger['info'](_0x6f6e('0x56'));stopped=!![];}function handleUncaughtException(_0x4013db){logger[_0x6f6e('0x57')](_0x4013db[_0x6f6e('0x58')]);process[_0x6f6e('0x59')](0x1);}function handleError(_0x4eebd5,_0x3f8d80){stats[_0x6f6e('0x5a')]['push']({'name':_0x3f8d80[_0x6f6e('0x5b')],'message':_0x3f8d80['message'],'row':_0x4eebd5});}function handleQuery(_0x4f579a){logger[_0x6f6e('0x5c')](_0x4f579a);return db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0x4f579a)['spread'](function(_0x3e7a28){results['push'](_0x3e7a28);})[_0x6f6e('0x5f')](function(_0x4c74bc){logger[_0x6f6e('0x57')](_0x4c74bc[_0x6f6e('0x58')]);});}function updateTzCampaigns(_0x53600c){return new Promise(function(_0x498cea,_0x497589){var _0xf72a24=squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')]([_0x6f6e('0x60'),_0x6f6e('0x61')])[_0x6f6e('0x31')](_0x6f6e('0x62'))[_0x6f6e('0x10')](_0x6f6e('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x6f6e('0x34')](_0x6f6e('0x64')+_0x53600c);db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0xf72a24[_0x6f6e('0x39')]())[_0x6f6e('0x65')](function(_0xea285a){var _0x30799c=[];for(var _0x10e6ae=0x0;_0x10e6ae<_0xea285a[_0x6f6e('0x15')];_0x10e6ae++){_0x30799c[_0x6f6e('0x16')](getTimezoneData(_0xea285a[_0x10e6ae],tmp_campaigns));}BPromise[_0x6f6e('0x17')](_0x30799c)[_0x6f6e('0x14')](function(){_0x498cea({'val':0x1});});})[_0x6f6e('0x5f')](function(_0x2f6612){logger[_0x6f6e('0x57')](_0x2f6612[_0x6f6e('0x58')]);_0x498cea({'val':0x0});});});}function updateTzVoiceQueues(_0x514baf){return new Promise(function(_0x211c75,_0x343673){var _0x2ff985=squel[_0x6f6e('0xe')]()['fields'](['voice_queues.id',_0x6f6e('0x66')])[_0x6f6e('0x31')](_0x6f6e('0x67'))['join'](_0x6f6e('0x68'),null,_0x6f6e('0x69'))[_0x6f6e('0x34')](_0x6f6e('0x6a')+_0x514baf);db[_0x6f6e('0x5d')]['query'](_0x2ff985['toString']())['spread'](function(_0x3cfe4a){var _0x3a7c01=[];for(var _0x23624e=0x0;_0x23624e<_0x3cfe4a[_0x6f6e('0x15')];_0x23624e++){_0x3a7c01[_0x6f6e('0x16')](getTimezoneData(_0x3cfe4a[_0x23624e],tmp_voice_queues));}BPromise[_0x6f6e('0x17')](_0x3a7c01)['then'](function(){_0x211c75({'val':0x1});});})[_0x6f6e('0x5f')](function(_0x2206c5){logger[_0x6f6e('0x57')](_0x2206c5['message']);_0x211c75({'val':0x0});});});}function getTimezoneData(_0x415d94,_0x2afcc5){return new Promise(function(_0x35a659,_0x469504){var _0x5506a8=shared[_0x6f6e('0x6b')];var _0x2d5a22=_0x5506a8[_0x415d94['dialTimezone']];if(_[_0x6f6e('0x6c')](_0x2d5a22)){_0x35a659({'ret':0x1});}else{var _0x196935=_0x2d5a22[_0x6f6e('0x6d')];var _0x350bb2=squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x2afcc5)[_0x6f6e('0x6e')]('id',_0x415d94['id'])['set'](_0x6f6e('0x6f'),_0x196935)['set'](_0x6f6e('0x70'),_0x415d94[_0x6f6e('0x70')])[_0x6f6e('0x39')]();return db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0x350bb2)[_0x6f6e('0x65')](function(_0x1b4f65){_0x35a659({'ret':0x1});})[_0x6f6e('0x5f')](function(_0x4e4d8d){logger[_0x6f6e('0x57')](_0x4e4d8d['message']);_0x469504({'ret':0x1});});}});}function handleTZQuery(_0x3feb97){logger[_0x6f6e('0x5c')](_0x3feb97);return db['sequelize'][_0x6f6e('0x5e')](_0x3feb97)['spread'](function(_0x552242){})[_0x6f6e('0x5f')](function(_0x42dcbb){logger[_0x6f6e('0x57')](_0x42dcbb['message']);});}function main(_0x561ab1,_0x3d9c79,_0x5b6af0,_0xc32259){logger[_0x6f6e('0x5c')](_0x6f6e('0x71'),_0x561ab1,JSON['stringify'](_0x3d9c79));process[_0x6f6e('0x72')]('start');var _0x53cf1=_0x3d9c79[_0x6f6e('0x73')];var _0x3d7953=_['clone'](_0x53cf1);var _0x55d5e6=_0x3d9c79[_0x6f6e('0x74')];var _0x155a42=path[_0x6f6e('0x10')](config['root'],_0x6f6e('0x75'),_0x55d5e6+_0x6f6e('0x76'));hasTZ=_[_0x6f6e('0x50')](_0x53cf1)[_0x6f6e('0x77')]('dialTimezone');var _0x3b159f=_[_0x6f6e('0x50')](_0x53cf1)[_0x6f6e('0x10')]();logger[_0x6f6e('0x5c')](_0x6f6e('0x78'),_0x3b159f);db[_0x6f6e('0x79')][_0x6f6e('0x12')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x16bc76){for(var _0x38c631=0x0;_0x38c631<_0x16bc76['length'];_0x38c631++){if(_0x16bc76[_0x38c631][_0x6f6e('0x7a')]in _0x53cf1){contactItemTypes[_0x6f6e('0x16')](_0x16bc76[_0x38c631]);delete _0x3d7953[_0x16bc76[_0x38c631][_0x6f6e('0x7a')]];hasAdditionalPhones=!![];}for(var _0x907727 in _0x53cf1){if(_0x16bc76[_0x38c631]['name']+_0x6f6e('0x7b')===_0x907727){phoneDescriptions['push']({'itemTypeId':_0x16bc76[_0x38c631]['id'],'description':_0x907727});delete _0x3d7953[_0x907727];}}}if(hasAdditionalPhones)_0x3d7953[_0x6f6e('0x13')]='';var _0x19b123=_[_0x6f6e('0x50')](_0x3d7953)['join']();logger['info'](_0x6f6e('0x78'),_0x19b123);fs['writeFileSync'](_0x155a42,_0x19b123+'\x0a');Papa[_0x6f6e('0x7c')](fs['createReadStream'](_0x561ab1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4300b4,_0x5f16a6){try{for(var _0x2c497c=0x0,_0xfcae0=[];_0x2c497c<_0x4300b4['data'][_0x6f6e('0x15')];_0x2c497c++){stats['rows']+=0x1;if(_0x4300b4[_0x6f6e('0x5a')][_0x2c497c]){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],_0x4300b4[_0x6f6e('0x5a')][_0x2c497c]);}else{var _0x4c3b82=[];var _0x284180=[];var _0x3648ac={};for(var _0x4ecf37 in _0x53cf1){let _0x3743c9=contactItemTypes[_0x6f6e('0x7e')](_0x4f6672=>_0x4f6672[_0x6f6e('0x7a')]===_0x4ecf37);let _0x32953f=contactItemTypes[_0x6f6e('0x7e')](_0x9f771f=>_0x9f771f[_0x6f6e('0x7a')]+'_description'===_0x4ecf37);if(_[_0x6f6e('0x6c')](_0x3743c9)&&_['isNil'](_0x32953f)){if(_0x53cf1[_0x6f6e('0x7f')](_0x4ecf37)){if(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]]){var _0xe34817=_[_0x6f6e('0x80')](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]][_0x6f6e('0x81')](/"/g,'\x27'));switch(_0x4ecf37){case'scheduledat':var _0x3e9c08=moment(_0xe34817,_0x6f6e('0xc'),!![]);if(_0x3e9c08[_0x6f6e('0x82')]()){_0xfcae0['push']('\x22'+_0xe34817+'\x22');}else{_0x4c3b82['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x621f75=parseInt(_0xe34817);_0xe34817=_[_0x6f6e('0x83')](_0x621f75)||_0x621f75<0x0||_0x621f75>0x4?_0xc32259?0x3:0x2:_0x621f75;_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xe34817+'\x22');break;case _0x6f6e('0x2e'):var _0xca79af=parseInt(_0xe34817);if(_['isNumber'](_0xca79af)&&_[_0x6f6e('0x77')](_0x5b6af0,_0xca79af)){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xca79af+'\x22');}else{_0x4c3b82[_0x6f6e('0x16')](_0x6f6e('0x84'));}break;case _0x6f6e('0x85'):if(isEmail(_0xe34817)){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xe34817+'\x22');}else{_0x4c3b82['push'](_0x6f6e('0x86'));}break;case _0x6f6e('0x87'):var _0x4ebc19=moment(_0xe34817,_0x6f6e('0x88'),!![]);if(_0x4ebc19[_0x6f6e('0x82')]()){_0xfcae0['push']('\x22'+_0xe34817+'\x22');}else{_0x4c3b82[_0x6f6e('0x16')](_0x6f6e('0x89'));}break;case _0x6f6e('0x70'):var _0x2ae49a=shared[_0x6f6e('0x6b')];var _0x1cb571=_0x2ae49a[_0xe34817];if(!_['isNil'](_0x1cb571)){var _0x170130=_0x1cb571['utcOffset'];_0xfcae0['push']('\x22'+_0xe34817+'\x22');_0xfcae0['push']('\x22'+_0x170130+'\x22');}break;default:_0xfcae0['push']('\x22'+_0xe34817+'\x22');}}else{switch(_0x4ecf37){case _0x6f6e('0x8a'):case _0x6f6e('0x3b'):_0x4c3b82[_0x6f6e('0x16')](_0x4ecf37+'\x20not\x20specified');break;default:_0xfcae0[_0x6f6e('0x16')]('\x22\x22');}}}}else{var _0xf183d1='';if(!_[_0x6f6e('0x6c')](_0x3743c9)){if(!_0x3648ac[_0x6f6e('0x7f')](_0x3743c9['id'])){if(!_['isNil'](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]])){var _0xe34817=_[_0x6f6e('0x80')](_0x4300b4['data'][_0x2c497c][_0x53cf1[_0x4ecf37]][_0x6f6e('0x81')](/"/g,'\x27'));var _0x1f5e3b=phoneDescriptions[_0x6f6e('0x7e')](_0x51133c=>_0x51133c[_0x6f6e('0x8b')]===_0x3743c9['id']);if(!_[_0x6f6e('0x6c')](_0x1f5e3b)){var _0x3bc989=_[_0x6f6e('0x80')](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x1f5e3b[_0x6f6e('0x8c')]]][_0x6f6e('0x81')](/"/g,'\x27'));if(!_[_0x6f6e('0x6c')](_0x3bc989))_0xe34817=_0xe34817+'§'+_0x3bc989;}if(_0xf183d1=='')_0xf183d1=_0xe34817;else _0xf183d1+='|'+_0xe34817;}_0x284180[_0x6f6e('0x16')](_0x3743c9['id']+':'+_0xf183d1);_0x3648ac[_0x3743c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0x284180[_0x6f6e('0x10')](';')+'\x22');}if(_0x4c3b82[_0x6f6e('0x15')]){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],{'code':_0x6f6e('0x8d'),'message':_0x4c3b82[_0x6f6e('0x10')]()});}else{fs[_0x6f6e('0x8e')](_0x155a42,_0xfcae0['join']()+'\x0a');}_0xfcae0=[];}if(!(stats[_0x6f6e('0x8f')]%0xc8)){socket[_0x6f6e('0x90')](_0x6f6e('0x91')+_0x55d5e6,stats);stats[_0x6f6e('0x5a')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x5f16a6[_0x6f6e('0x92')]();}}catch(_0x3e54f5){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],{'code':_0x6f6e('0x93'),'message':_0x3e54f5['message']});logger[_0x6f6e('0x57')](_0x6f6e('0x94'),_0x3e54f5['message']);}},'complete':function(){try{var _0x478da4=[];var _0x1dce3e=[];var _0x1e9da2=_0x6f6e('0x42');if(_0x3d9c79[_0x6f6e('0x95')]&&_0x3d9c79[_0x6f6e('0x95')][_0x6f6e('0x15')]){_0x1e9da2=_0x6f6e('0x96')+_0x55d5e6;_0x478da4[_0x6f6e('0x16')](_0x6f6e('0x97')+_0x1e9da2+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6f6e('0x98')+_0x55d5e6;tmp_voice_queues=_0x6f6e('0x99')+_0x55d5e6;_0x1dce3e[_0x6f6e('0x16')](_0x6f6e('0x97')+tmp_campaigns+_0x6f6e('0x9a'));_0x1dce3e[_0x6f6e('0x16')](_0x6f6e('0x97')+tmp_voice_queues+_0x6f6e('0x9a'));BPromise[_0x6f6e('0x9b')](_0x1dce3e,handleTZQuery)['then'](function(_0x447909){updateTzCampaigns(_0x3d9c79[_0x6f6e('0x3c')])[_0x6f6e('0x14')](function(_0x24d6d3){updateTzVoiceQueues(_0x3d9c79[_0x6f6e('0x3c')])[_0x6f6e('0x14')](function(_0x2bff8a){if(hasTZ)_0x19b123=_0x19b123[_0x6f6e('0x81')](_0x6f6e('0x70'),'dialTimezone,utcOffset');var _0x26cbe7=util[_0x6f6e('0x9c')](_0x6f6e('0x9d'),_0x155a42,_0x1e9da2,_0x19b123,_0x3d9c79[_0x6f6e('0x3c')],_0x3d9c79[_0x6f6e('0x51')]||null,NOW,NOW);if(_[_0x6f6e('0x6c')](_0x53cf1[_0x6f6e('0x2b')])){_0x26cbe7+=',\x20scheduledAt\x20=\x20NOW()';}_0x478da4[_0x6f6e('0x16')](_0x26cbe7);if(_0x3d9c79[_0x6f6e('0x95')]&&_0x3d9c79[_0x6f6e('0x95')]['length']){_0x478da4['push'](insertCmContact(_0x3d9c79[_0x6f6e('0x3c')],_0x1e9da2,_0x3d9c79[_0x6f6e('0x95')],_0x53cf1));_0x478da4[_0x6f6e('0x16')](_0x6f6e('0x9e')+_0x1e9da2+';');}BPromise[_0x6f6e('0x9b')](_0x478da4,handleQuery)[_0x6f6e('0x14')](function(_0x453e91){BPromise['all']([handleAdditionalPhones()])[_0x6f6e('0x14')](function(){_0x478da4=[];for(var _0x47b68d=0x0;_0x47b68d_0x1dfb9a[_0x1f0f('0x66')]===_0x4753d9);let _0x402563=contactItemTypes[_0x1f0f('0x6d')](_0x2211f9=>_0x2211f9['name']+_0x1f0f('0x67')===_0x4753d9);if(_[_0x1f0f('0x1a')](_0x5aa2eb)&&_[_0x1f0f('0x1a')](_0x402563)){if(_0x4db96e[_0x1f0f('0x6e')](_0x4753d9)){if(_0x22eb19[_0x1f0f('0x6c')][_0x3b3bb2][_0x4db96e[_0x4753d9]]){var _0x113f0a=_['trim'](_0x22eb19[_0x1f0f('0x6c')][_0x3b3bb2][_0x4db96e[_0x4753d9]][_0x1f0f('0x6f')](/"/g,'\x27'));switch(_0x4753d9){case _0x1f0f('0x35'):var _0x5470e1=moment(_0x113f0a,_0x1f0f('0xb'),!![]);if(_0x5470e1[_0x1f0f('0x70')]()){_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x113f0a+'\x22');}else{_0x5429cf['push'](_0x1f0f('0x71'));}break;case _0x1f0f('0x72'):var _0x1db0c4=parseInt(_0x113f0a);_0x113f0a=_[_0x1f0f('0x73')](_0x1db0c4)||_0x1db0c4<0x0||_0x1db0c4>0x4?_0x38c23b?0x3:0x2:_0x1db0c4;_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x113f0a+'\x22');break;case _0x1f0f('0x38'):var _0x4c56b9=parseInt(_0x113f0a);if(_[_0x1f0f('0x74')](_0x4c56b9)&&_[_0x1f0f('0x75')](_0x2c1728,_0x4c56b9)){_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x4c56b9+'\x22');}else{_0x5429cf[_0x1f0f('0x1d')]('agent\x20not\x20exists');}break;case _0x1f0f('0x76'):if(isEmail(_0x113f0a)){_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x113f0a+'\x22');}else{_0x5429cf['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x6b2120=moment(_0x113f0a,_0x1f0f('0x77'),!![]);if(_0x6b2120['isValid']()){_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x113f0a+'\x22');}else{_0x5429cf['push'](_0x1f0f('0x78'));}break;default:_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x113f0a+'\x22');}}else{switch(_0x4753d9){case _0x1f0f('0x79'):case _0x1f0f('0x1b'):_0x5429cf[_0x1f0f('0x1d')](_0x4753d9+'\x20not\x20specified');break;default:_0x125e35[_0x1f0f('0x1d')]('\x22\x22');}}}}else{var _0x585b97='';if(!_[_0x1f0f('0x1a')](_0x5aa2eb)){if(!_0x4ec691[_0x1f0f('0x6e')](_0x5aa2eb['id'])){for(var _0x3c9114=0x0;_0x3c9114<_0x4db96e[_0x4753d9]['length'];_0x3c9114++){var _0x113f0a=_[_0x1f0f('0x7a')](_0x22eb19['data'][_0x3b3bb2][_0x4db96e[_0x4753d9][_0x3c9114]]['replace'](/"/g,'\x27'));var _0x49b2d3=phoneDescriptions['find'](_0x16196e=>_0x16196e[_0x1f0f('0x7b')]===_0x5aa2eb['id']);if(!_[_0x1f0f('0x1a')](_0x49b2d3)){var _0x26c55b=_[_0x1f0f('0x7a')](_0x22eb19[_0x1f0f('0x6c')][_0x3b3bb2][_0x4db96e[_0x49b2d3[_0x1f0f('0x7c')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x1f0f('0x1a')](_0x26c55b))_0x113f0a=_0x113f0a+'§'+_0x26c55b;}if(_0x585b97=='')_0x585b97=_0x113f0a;else _0x585b97+='|'+_0x113f0a;}_0x32c0bb['push'](_0x5aa2eb['id']+':'+_0x585b97);_0x4ec691[_0x5aa2eb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x125e35[_0x1f0f('0x1d')]('\x22'+_0x32c0bb['join'](';')+'\x22');}if(_0x5429cf[_0x1f0f('0x19')]){handleError(_0x22eb19[_0x1f0f('0x6c')][_0x3b3bb2],{'code':'SystemRow','message':_0x5429cf['join']()});}else{fs['appendFileSync'](_0xb2548b,_0x125e35[_0x1f0f('0x10')]()+'\x0a');}_0x125e35=[];}if(!(stats[_0x1f0f('0x7d')]%0xc8)){socket[_0x1f0f('0x7e')]('contact:import:'+_0x5c15dd,stats);stats[_0x1f0f('0x58')]=[];}}if(stopped){logger[_0x1f0f('0x5a')](_0x1f0f('0x7f'));_0x302ed6['abort']();}}catch(_0x45682b){handleError(_0x22eb19[_0x1f0f('0x6c')][_0x3b3bb2],{'code':_0x1f0f('0x80'),'message':_0x45682b['message']});logger['error'](_0x1f0f('0x81'),_0x45682b[_0x1f0f('0x20')]);}},'complete':function(){try{var _0x25c47=[];var _0x32e25b=tempTableName;_0x25c47[_0x1f0f('0x1d')]('CREATE\x20TABLE\x20'+_0x32e25b+_0x1f0f('0x82'));logger[_0x1f0f('0x5a')](_0x1f0f('0x83'),contactItemTypes[_0x1f0f('0x19')]);var _0x526f69=util[_0x1f0f('0xa')](_0x1f0f('0x84'),_0xb2548b,_0x32e25b,_0x59806a,_0x8c4a6c['ListId'],_0x8c4a6c[_0x1f0f('0x53')]||null,NOW,NOW);if(_[_0x1f0f('0x1a')](_0x4db96e[_0x1f0f('0x35')])){_0x526f69+=',\x20scheduledAt\x20=\x20NOW()';}_0x25c47[_0x1f0f('0x1d')](_0x526f69);BPromise['each'](_0x25c47,handleQuery)[_0x1f0f('0x1e')](function(_0x3efe8c){BPromise[_0x1f0f('0x22')]([handleAdditionalPhones()])[_0x1f0f('0x1e')](function(){_0x25c47=[];for(var _0x363565=0x0;_0x363565\x20\x20');}var _0x26c32a=path[_0x1f0f('0x10')](config[_0x1f0f('0x60')],_0x1f0f('0x61'),process[_0x1f0f('0x8e')][0x2]);if(!fs[_0x1f0f('0x8f')](_0x26c32a)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x30213f={};try{_0x30213f=JSON[_0x1f0f('0x6b')](process['argv'][0x3]);if(!_0x30213f[_0x1f0f('0x5d')]){throw new Error(_0x1f0f('0x90'));}var _0x317962=0x0;if(_0x30213f[_0x1f0f('0x5d')][_0x1f0f('0x38')]){_0x317962=0x1;}if(!_0x30213f[_0x1f0f('0x36')]){throw new Error(_0x1f0f('0x91'));}}catch(_0x335159){throw new Error(_0x1f0f('0x92'));}var _0x33395e=[];try{_0x33395e=_['map'](JSON[_0x1f0f('0x6b')](process[_0x1f0f('0x8e')][0x4]),'id');}catch(_0x5cfc53){logger[_0x1f0f('0x5a')]('No\x20agent\x20available');}main(_0x26c32a,_0x30213f,_0x33395e,_0x317962);}validate();process['on'](_0x1f0f('0x93'),handleStop);process['on'](_0x1f0f('0x94'),handleUncaughtException); \ No newline at end of file +var _0x6f4f=['PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ListId','createdAt','.CmListId','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','info','message','exit','errors','code','error','main','send','clone','socket_timestamp','server/files/tmp','body','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','replace','SystemRow','rows','emit','contact:import:','Abort\x20parser','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','squel','ioredis','import','redis','localhost','format','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','all','then','catch','split','filter','push','CmContactHasItem','update'];(function(_0x3f6d88,_0x33fc97){var _0x43fb24=function(_0x36afc3){while(--_0x36afc3){_0x3f6d88['push'](_0x3f6d88['shift']());}};_0x43fb24(++_0x33fc97);}(_0x6f4f,0x187));var _0xf6f4=function(_0xe753,_0x2466a8){_0xe753=_0xe753-0x0;var _0x4ac57a=_0x6f4f[_0xe753];return _0x4ac57a;};'use strict';var fs=require('fs');var path=require(_0xf6f4('0x0'));var _=require(_0xf6f4('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xf6f4('0x2'));var moment=require('moment');var squel=require(_0xf6f4('0x3'));var Redis=require(_0xf6f4('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf6f4('0x5'));config[_0xf6f4('0x6')]=_['defaults'](config[_0xf6f4('0x6')],{'host':_0xf6f4('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6f4('0x6')]));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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0xf6f4('0x8')](_0xf6f4('0x9'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x243122){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'](_0x243122);}function selectNotIn(_0x1621de,_0x5cd977,_0x36de57,_0x5dd589,_0x2f0ac2){return squel[_0xf6f4('0xa')]()[_0xf6f4('0xb')](_0xf6f4('0xc'))[_0xf6f4('0xd')](_0x5dd589)[_0xf6f4('0xe')](_0x5cd977,null,_0x5cd977+_0xf6f4('0xf')+_0x5dd589+'.'+_0x36de57)[_0xf6f4('0x10')](_0x5dd589+'.'+_0x36de57+_0xf6f4('0x11')+_0x1621de+'.'+_0x36de57)[_0xf6f4('0x10')](_0x5cd977+'.dialCheckDuplicateType\x20IN\x20('+_0x2f0ac2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x11ed75,_0x8d9b76){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf6f4('0x12')]['query'](_0xf6f4('0x13')+tempTableName)[_0xf6f4('0x14')](function(_0x1d0441){if(_0x1d0441!==null){var _0x4f5820=[];for(var _0x42c261=0x0;_0x42c261<_0x1d0441[_0xf6f4('0x15')];_0x42c261++){var _0x20d692=_0x1d0441[_0x42c261];if(!_[_0xf6f4('0x16')](_0x20d692[_0xf6f4('0xc')])){if(!_[_0xf6f4('0x16')](_0x20d692[_0xf6f4('0x17')]))_0x4f5820['push'](insertAdditionalPhones(_0x20d692));promisesContact['push']({'contact':_0x20d692});}}}Promise[_0xf6f4('0x18')](_0x4f5820)[_0xf6f4('0x19')](function(){_0x11ed75({'val':0x1});});})[_0xf6f4('0x1a')](function(_0x658373){logger['error'](_0x658373['message']);});});}function insertAdditionalPhones(_0x1d48de){return new Promise(function(_0x1c008b,_0x172a44){var _0x5651ae=_0x1d48de[_0xf6f4('0x17')];if(_[_0xf6f4('0x16')](_0x5651ae))_0x172a44({'val':0x0});else{var _0x4c35e2=_0x5651ae['split'](';');var _0xbc996e=[];orderBy=0x0;for(var _0x3629d2=0x0;_0x3629d2<_0x4c35e2[_0xf6f4('0x15')];_0x3629d2++){_0xbc996e['push'](splitAdditionalPhone(_0x1d48de['id'],_0x4c35e2[_0x3629d2]));}Promise['all'](_0xbc996e)['then'](function(){_0x1c008b({'val':_0x4c35e2[_0xf6f4('0x15')]});});}});}function splitAdditionalPhone(_0x1d1544,_0x38a021){return new Promise(function(_0x39d71e,_0x5353c5){var _0x49f4bb=_0x38a021[_0xf6f4('0x1b')](':');var _0x553827=_0x49f4bb[0x0];var _0x55ce10=_0x49f4bb[0x1];if(_0x55ce10!==''){var _0x154206=_0x55ce10['split']('|');var _0x4f2da9=[];for(var _0x2a6125=0x0;_0x2a6125<_0x154206[_0xf6f4('0x15')];_0x2a6125++){if(_0x154206[_0x2a6125]!==''){var _0x934c7=_[_0xf6f4('0x1c')](promisesAdditionalPhones,{'contactId':_0x1d1544,'phone':_0x154206[_0x2a6125]});if(_0x934c7[_0xf6f4('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0xf6f4('0x1d')]({'contactId':_0x1d1544,'contactTypeId':_0x553827,'phone':_0x154206[_0x2a6125],'orderBy':orderBy});}}}_0x39d71e({'ok':0x1});}else _0x39d71e({'res':0x0});});}function createAdditionalPhone(_0x23dd1b,_0x55f233,_0x4d6999,_0x3e0953){var _0x19ad0d='';var _0x430b89='';var _0x26b2fd=_0x4d6999[_0xf6f4('0x1b')]('§');_0x19ad0d=_0x26b2fd[0x0];if(_0x26b2fd[_0xf6f4('0x15')]==0x2)_0x430b89=_0x26b2fd[0x1];return new Promise(function(_0xee2289,_0x38c806){return db[_0xf6f4('0x1e')]['findOne']({'where':{'CmContactId':_0x23dd1b,'item':_0x19ad0d}})['then'](function(_0x369143){if(_0x369143){return db[_0xf6f4('0x1e')][_0xf6f4('0x1f')]({'ItemTypeId':_0x55f233,'description':_0x430b89,'OrderBy':_0x3e0953},{'where':{'CmContactId':_0x23dd1b,'item':_0x19ad0d}})[_0xf6f4('0x19')](function(_0x392e48){_0xee2289({'res':'updated'});});}else{return db[_0xf6f4('0x1e')]['create']({'CmContactId':_0x23dd1b,'item':_0x19ad0d,'ItemTypeId':_0x55f233,'description':_0x430b89,'OrderBy':_0x3e0953,'ItemClass':_0xf6f4('0x20')})[_0xf6f4('0x19')](function(_0xb628f7){_0xee2289({'res':_0xf6f4('0x21')});});}});});}function updateContact(_0x17f628){return new Promise(function(_0x17bcee,_0x5d0ec7){var _0x233f26=_0x17f628['id'];delete _0x17f628['id'];return db[_0xf6f4('0x22')][_0xf6f4('0x1f')](_0x17f628,{'where':{'id':_0x233f26}})[_0xf6f4('0x19')](function(_0x2ecad4){updatedRows+=0x1;return db[_0xf6f4('0x23')][_0xf6f4('0x1f')]({'phone':_0x17f628[_0xf6f4('0xc')]},{'where':{'ContactId':_0x233f26}})[_0xf6f4('0x19')](function(_0x59dbea){_0x17bcee({'ret':'OK'});});});});}function insertCmHopper(_0x1067b1,_0x2547f2,_0x35262d,_0x371974,_0x271e2b){var _0x101cce=[_0xf6f4('0x24'),'cm_contacts.scheduledat',_0xf6f4('0x25'),_0xf6f4('0x26'),_0x2547f2+'.'+_0x371974,'cm_contacts.createdAt',_0xf6f4('0x27'),_0xf6f4('0x28'),_0xf6f4('0x29'),'\x22'+_0x271e2b+'\x22'];return squel[_0xf6f4('0x2a')]()[_0xf6f4('0x2b')](_0xf6f4('0x2c'))[_0xf6f4('0x2d')](['phone',_0xf6f4('0x2e'),'ContactId','ListId',_0x371974,'createdAt','updatedAt','priority',_0xf6f4('0x2f'),_0xf6f4('0x30')],squel[_0xf6f4('0xa')]()[_0xf6f4('0x31')](_0x101cce)[_0xf6f4('0xd')](_0x2547f2)[_0xf6f4('0xe')](_0xf6f4('0x32'),null,_0xf6f4('0x33')+_0x2547f2+'.CmListId')['join'](_0x35262d,null,_0x35262d+'.id\x20=\x20'+_0x2547f2+'.'+_0x371974)[_0xf6f4('0x10')](_0x2547f2+_0xf6f4('0x34'),_0x1067b1)[_0xf6f4('0x10')](_0xf6f4('0x35'),NOW)[_0xf6f4('0x10')](_0xf6f4('0x36'),selectNotIn(_0x2547f2,_0x35262d,_0x371974,_0xf6f4('0x2c'),[_0xf6f4('0x37'),_0xf6f4('0x38')]))[_0xf6f4('0x10')](_0xf6f4('0x36'),selectNotIn(_0x2547f2,_0x35262d,_0x371974,'cm_hopper',[_0xf6f4('0x37')])))[_0xf6f4('0x39')]();}function insertCmHopperBlack(_0x2f04c3,_0x3c9ec1,_0x2208b5,_0x5de5ba){var _0x468624=[_0xf6f4('0x24'),_0xf6f4('0x25'),_0xf6f4('0x26'),_0x3c9ec1+'.'+_0x5de5ba,_0xf6f4('0x3a'),'cm_contacts.updatedAt'];return squel[_0xf6f4('0x2a')]()[_0xf6f4('0x2b')](_0xf6f4('0x3b'))[_0xf6f4('0x2d')]([_0xf6f4('0xc'),'ContactId',_0xf6f4('0x3c'),_0x5de5ba,_0xf6f4('0x3d'),'updatedAt'],squel[_0xf6f4('0xa')]()[_0xf6f4('0x31')](_0x468624)[_0xf6f4('0xd')](_0x3c9ec1)[_0xf6f4('0xe')]('cm_contacts',null,_0xf6f4('0x33')+_0x3c9ec1+_0xf6f4('0x3e'))[_0xf6f4('0xe')](_0x2208b5,null,_0x2208b5+'.id\x20=\x20'+_0x3c9ec1+'.'+_0x5de5ba)['where'](_0x3c9ec1+_0xf6f4('0x34'),_0x2f04c3)[_0xf6f4('0x10')](_0xf6f4('0x35'),NOW)[_0xf6f4('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf6f4('0xa')]()['field']('phone')[_0xf6f4('0xd')]('cm_hopper_black')[_0xf6f4('0x10')]('ListId\x20=\x20?',_0x2f04c3)[_0xf6f4('0x10')](_0x5de5ba+_0xf6f4('0x3f'),_0x3c9ec1+'.'+_0x5de5ba)))[_0xf6f4('0x39')]();}function insertCmHopperAdditionalPhones(_0x5e4e79){var _0x53e82d=['cm_hopper.id',_0xf6f4('0x40'),_0xf6f4('0x41'),_0xf6f4('0x42'),_0xf6f4('0x43')];return squel[_0xf6f4('0x2a')]()['into'](_0xf6f4('0x44'))[_0xf6f4('0x2d')](['CmHopperId',_0xf6f4('0xc'),_0xf6f4('0x45'),_0xf6f4('0x3d'),_0xf6f4('0x46')],squel[_0xf6f4('0xa')]()[_0xf6f4('0x31')](_0x53e82d)[_0xf6f4('0xd')](_0xf6f4('0x2c'))[_0xf6f4('0xe')](_0xf6f4('0x32'),null,_0xf6f4('0x47'))['join']('cm_contact_has_items',null,_0xf6f4('0x48'))[_0xf6f4('0x10')](_0xf6f4('0x49'),_0x5e4e79)[_0xf6f4('0x10')](_0xf6f4('0x35'),NOW))[_0xf6f4('0x39')]();}function insertCmContact(_0xa03cd7,_0x4be94f,_0x328c5c,_0x47d0bc){var _0xf39ef6=_['concat'](_[_0xf6f4('0x4a')](_0x47d0bc),[_0xf6f4('0x3c'),_0xf6f4('0x4b'),'createdAt',_0xf6f4('0x46')]);return squel['insert']()[_0xf6f4('0x2b')](_0xf6f4('0x32'))[_0xf6f4('0x2d')](_0xf39ef6,squel[_0xf6f4('0xa')]()[_0xf6f4('0x31')](_0xf39ef6)['from'](_0x4be94f)[_0xf6f4('0x10')]('('+_0x328c5c[_0xf6f4('0xe')](',')+_0xf6f4('0x4c'),squel[_0xf6f4('0xa')]()['fields'](_0x328c5c)['from'](_0xf6f4('0x32'))['where'](_0xf6f4('0x4d'),_0xa03cd7))['where'](_0xf6f4('0x4e'),squel[_0xf6f4('0xa')]()[_0xf6f4('0xb')](_0xf6f4('0x4f'),'min_id')[_0xf6f4('0xd')](_0x4be94f)[_0xf6f4('0x50')](_0x328c5c[_0xf6f4('0xe')](','))))[_0xf6f4('0x39')]();}function handleStop(){logger[_0xf6f4('0x51')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4ad098){logger['error'](_0x4ad098[_0xf6f4('0x52')]);process[_0xf6f4('0x53')](0x1);}function handleError(_0x1d1033,_0x583e1b){stats[_0xf6f4('0x54')][_0xf6f4('0x1d')]({'name':_0x583e1b[_0xf6f4('0x55')],'message':_0x583e1b[_0xf6f4('0x52')],'row':_0x1d1033});}function handleQuery(_0x16c295){logger[_0xf6f4('0x51')](_0x16c295);return db['sequelize']['query'](_0x16c295)[_0xf6f4('0x14')](function(_0x1d9039){results[_0xf6f4('0x1d')](_0x1d9039);})[_0xf6f4('0x1a')](function(_0x573549){logger[_0xf6f4('0x56')](_0x573549[_0xf6f4('0x52')]);});}function main(_0x37338d,_0x43c592,_0xf5bfa8,_0x1c2d91){logger[_0xf6f4('0x51')](_0xf6f4('0x57'),_0x37338d,JSON['stringify'](_0x43c592));process[_0xf6f4('0x58')]('start');var _0x42d262=_0x43c592['binding'];var _0x243437=_[_0xf6f4('0x59')](_0x42d262);var _0x30ca0b=_0x43c592[_0xf6f4('0x5a')];var _0x3274cc=path['join'](config['root'],_0xf6f4('0x5b'),_0x30ca0b+'.csv');logger[_0xf6f4('0x51')](_0xf6f4('0x5c'),_0x43c592);db[_0xf6f4('0x5d')][_0xf6f4('0x5e')]({'raw':!![],'attributes':['id',_0xf6f4('0x5f')]})[_0xf6f4('0x19')](function(_0x29ee02){for(var _0x294548=0x0;_0x294548<_0x29ee02['length'];_0x294548++){if(_0x29ee02[_0x294548][_0xf6f4('0x5f')]in _0x42d262){contactItemTypes[_0xf6f4('0x1d')](_0x29ee02[_0x294548]);delete _0x243437[_0x29ee02[_0x294548][_0xf6f4('0x5f')]];hasAdditionalPhones=!![];}for(var _0x41bca8 in _0x42d262){if(_0x29ee02[_0x294548][_0xf6f4('0x5f')]+_0xf6f4('0x60')===_0x41bca8){phoneDescriptions[_0xf6f4('0x1d')]({'itemTypeId':_0x29ee02[_0x294548]['id'],'description':_0x41bca8});delete _0x243437[_0x41bca8];}}}if(hasAdditionalPhones)_0x243437['AdditionalPhones']='';var _0x2f7b3d=_[_0xf6f4('0x4a')](_0x243437)['join']();logger[_0xf6f4('0x51')](_0xf6f4('0x61'),_0x2f7b3d);fs['writeFileSync'](_0x3274cc,_0x2f7b3d+'\x0a');Papa[_0xf6f4('0x62')](fs[_0xf6f4('0x63')](_0x37338d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12f5e0,_0x5930fb){try{for(var _0x119999=0x0,_0x594fd1=[];_0x119999<_0x12f5e0['data']['length'];_0x119999++){stats['rows']+=0x1;if(_0x12f5e0[_0xf6f4('0x54')][_0x119999]){handleError(_0x12f5e0[_0xf6f4('0x64')][_0x119999],_0x12f5e0[_0xf6f4('0x54')][_0x119999]);}else{var _0x330647=[];var _0x16b007=[];var _0x494be3={};for(var _0x3562cd in _0x42d262){let _0x2bf341=contactItemTypes[_0xf6f4('0x65')](_0x511f87=>_0x511f87['name']===_0x3562cd);let _0x2d5ffd=contactItemTypes[_0xf6f4('0x65')](_0x488243=>_0x488243[_0xf6f4('0x5f')]+_0xf6f4('0x60')===_0x3562cd);if(_[_0xf6f4('0x16')](_0x2bf341)&&_[_0xf6f4('0x16')](_0x2d5ffd)){if(_0x42d262[_0xf6f4('0x66')](_0x3562cd)){if(_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd]]){var _0x2bf96f=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd]]['replace'](/"/g,'\x27'));switch(_0x3562cd){case _0xf6f4('0x2e'):var _0x181097=moment(_0x2bf96f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x181097['isValid']()){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647[_0xf6f4('0x1d')](_0xf6f4('0x68'));}break;case _0xf6f4('0x69'):var _0x8bfc44=parseInt(_0x2bf96f);_0x2bf96f=_[_0xf6f4('0x6a')](_0x8bfc44)||_0x8bfc44<0x0||_0x8bfc44>0x4?_0x1c2d91?0x3:0x2:_0x8bfc44;_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');break;case _0xf6f4('0x2f'):var _0x1a2111=parseInt(_0x2bf96f);if(_[_0xf6f4('0x6b')](_0x1a2111)&&_['includes'](_0xf5bfa8,_0x1a2111)){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x1a2111+'\x22');}else{_0x330647[_0xf6f4('0x1d')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2bf96f)){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647[_0xf6f4('0x1d')](_0xf6f4('0x6c'));}break;case'dateOfBirth':var _0x880ac2=moment(_0x2bf96f,'YYYY-MM-DD',!![]);if(_0x880ac2[_0xf6f4('0x6d')]()){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647['push'](_0xf6f4('0x6e'));}break;default:_0x594fd1['push']('\x22'+_0x2bf96f+'\x22');}}else{switch(_0x3562cd){case _0xf6f4('0x6f'):case'phone':_0x330647[_0xf6f4('0x1d')](_0x3562cd+_0xf6f4('0x70'));break;default:_0x594fd1[_0xf6f4('0x1d')]('\x22\x22');}}}}else{var _0x1aaafd='';if(!_[_0xf6f4('0x16')](_0x2bf341)){if(!_0x494be3[_0xf6f4('0x66')](_0x2bf341['id'])){for(var _0x310c4a=0x0;_0x310c4a<_0x42d262[_0x3562cd][_0xf6f4('0x15')];_0x310c4a++){var _0x2bf96f=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd][_0x310c4a]]['replace'](/"/g,'\x27'));var _0x3f149c=phoneDescriptions[_0xf6f4('0x65')](_0x5bf279=>_0x5bf279[_0xf6f4('0x71')]===_0x2bf341['id']);if(!_[_0xf6f4('0x16')](_0x3f149c)){var _0x221e6=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3f149c[_0xf6f4('0x72')]][0x0]][_0xf6f4('0x73')](/"/g,'\x27'));if(!_[_0xf6f4('0x16')](_0x221e6))_0x2bf96f=_0x2bf96f+'§'+_0x221e6;}if(_0x1aaafd=='')_0x1aaafd=_0x2bf96f;else _0x1aaafd+='|'+_0x2bf96f;}_0x16b007[_0xf6f4('0x1d')](_0x2bf341['id']+':'+_0x1aaafd);_0x494be3[_0x2bf341['id']]=0x1;}}}}if(hasAdditionalPhones){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x16b007[_0xf6f4('0xe')](';')+'\x22');}if(_0x330647[_0xf6f4('0x15')]){handleError(_0x12f5e0[_0xf6f4('0x64')][_0x119999],{'code':_0xf6f4('0x74'),'message':_0x330647[_0xf6f4('0xe')]()});}else{fs['appendFileSync'](_0x3274cc,_0x594fd1['join']()+'\x0a');}_0x594fd1=[];}if(!(stats[_0xf6f4('0x75')]%0xc8)){socket[_0xf6f4('0x76')](_0xf6f4('0x77')+_0x30ca0b,stats);stats[_0xf6f4('0x54')]=[];}}if(stopped){logger[_0xf6f4('0x51')](_0xf6f4('0x78'));_0x5930fb['abort']();}}catch(_0x7aa20a){handleError(_0x12f5e0['data'][_0x119999],{'code':_0xf6f4('0x79'),'message':_0x7aa20a[_0xf6f4('0x52')]});logger['error']('step',_0x7aa20a[_0xf6f4('0x52')]);}},'complete':function(){try{var _0x14d44d=[];var _0x37c915=tempTableName;_0x14d44d['push'](_0xf6f4('0x7a')+_0x37c915+_0xf6f4('0x7b'));logger[_0xf6f4('0x51')]('CIS\x20len',contactItemTypes['length']);var _0x5da426=util[_0xf6f4('0x8')]('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',_0x3274cc,_0x37c915,_0x2f7b3d,_0x43c592[_0xf6f4('0x3c')],_0x43c592[_0xf6f4('0x4b')]||null,NOW,NOW);if(_[_0xf6f4('0x16')](_0x42d262['scheduledat'])){_0x5da426+=_0xf6f4('0x7c');}_0x14d44d[_0xf6f4('0x1d')](_0x5da426);BPromise[_0xf6f4('0x7d')](_0x14d44d,handleQuery)[_0xf6f4('0x19')](function(_0x1938ad){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x14d44d=[];for(var _0x5e1aa1=0x0;_0x5e1aa1\x20\x20');}var _0x114815=path[_0xf6f4('0xe')](config[_0xf6f4('0x84')],_0xf6f4('0x5b'),process[_0xf6f4('0x83')][0x2]);if(!fs[_0xf6f4('0x85')](_0x114815)){throw new Error(_0xf6f4('0x86'));}var _0x171a90={};try{_0x171a90=JSON[_0xf6f4('0x62')](process[_0xf6f4('0x83')][0x3]);if(!_0x171a90['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x2f0ef2=0x0;if(_0x171a90[_0xf6f4('0x87')][_0xf6f4('0x2f')]){_0x2f0ef2=0x1;}if(!_0x171a90[_0xf6f4('0x3c')]){throw new Error(_0xf6f4('0x88'));}}catch(_0x25460f){throw new Error('body\x20id\x20mandatory');}var _0x521630=[];try{_0x521630=_[_0xf6f4('0x89')](JSON[_0xf6f4('0x62')](process['argv'][0x4]),'id');}catch(_0x45b487){logger[_0xf6f4('0x51')](_0xf6f4('0x8a'));}main(_0x114815,_0x171a90,_0x521630,_0x2f0ef2);}validate();process['on'](_0xf6f4('0x8b'),handleStop);process['on'](_0xf6f4('0x8c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0a08114..63d009a 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6058=['Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','Member\x20Name','starttime'];(function(_0x45dc60,_0x5b6ac7){var _0x3765ba=function(_0x2e9586){while(--_0x2e9586){_0x45dc60['push'](_0x45dc60['shift']());}};_0x3765ba(++_0x5b6ac7);}(_0x6058,0x6a));var _0x8605=function(_0x2e5bb6,_0x4a569b){_0x2e5bb6=_0x2e5bb6-0x0;var _0xdae9ed=_0x6058[_0x2e5bb6];return _0xdae9ed;};'use strict';exports[_0x8605('0x0')]=function(_0x331a14,_0x3dc54a){var _0x1e1d5c=[{'type':_0x8605('0x1'),'content':_0x8605('0x2'),'variableName':null}];switch(_0x331a14[_0x8605('0x3')]()){case _0x8605('0x4'):switch(_0x3dc54a[_0x8605('0x3')]()){case _0x8605('0x5'):_0x1e1d5c['push']({'type':_0x8605('0x6'),'content':'','variableName':_0x8605('0x7')});_0x1e1d5c[_0x8605('0x8')]({'type':_0x8605('0x6'),'content':'','variableName':_0x8605('0x9')});break;case'outbound':_0x1e1d5c[_0x8605('0x8')]({'type':_0x8605('0x1'),'content':_0x8605('0xa'),'variableName':null});_0x1e1d5c['push']({'type':_0x8605('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x1e1d5c;};exports['getDescriptions']=function(_0x533312,_0x1493a7){var _0x312002=[];switch(_0x533312[_0x8605('0x3')]()){case'voice':switch(_0x1493a7[_0x8605('0x3')]()){case'inbound':_0x312002=[{'type':'string','content':_0x8605('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0xd'),'keyType':_0x8605('0x6'),'variableName':'calleridnum'},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0xe'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0xf')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x10'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x11')},{'type':'keyValue','content':'','key':_0x8605('0x12'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x7')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x13'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x14')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x15'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x16')},{'type':_0x8605('0x1'),'content':_0x8605('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x18'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x19')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x1a'),'keyType':'variable','variableName':_0x8605('0x1b')},{'type':_0x8605('0x1'),'content':_0x8605('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x1d'),'keyType':'variable','variableName':_0x8605('0x16')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x1e'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x1f')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x20'),'keyType':'variable','variableName':_0x8605('0x21')},{'type':'keyValue','content':'','key':_0x8605('0x22'),'keyType':_0x8605('0x6'),'variableName':_0x8605('0x23')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x24'),'keyType':_0x8605('0x6'),'variableName':'talktime'}];break;case _0x8605('0x25'):_0x312002=[{'type':_0x8605('0x1'),'content':_0x8605('0xb'),'variableName':null},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x26'),'keyType':_0x8605('0x6'),'keyContent':'','variableName':_0x8605('0x1b')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x27'),'keyType':_0x8605('0x6'),'keyContent':'','variableName':'membername'},{'type':_0x8605('0xc'),'content':'','key':'UniqueId','keyType':_0x8605('0x6'),'keyContent':'','variableName':_0x8605('0x14')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x15'),'keyType':_0x8605('0x6'),'keyContent':'','variableName':_0x8605('0x28')},{'type':_0x8605('0x1'),'content':_0x8605('0x1c')},{'type':'keyValue','content':'','key':_0x8605('0x29'),'keyType':'variable','keyContent':'','variableName':_0x8605('0x2a')},{'type':_0x8605('0xc'),'content':'','key':_0x8605('0x2b'),'keyType':'variable','keyContent':'','variableName':_0x8605('0x2c')},{'type':'keyValue','content':'','key':_0x8605('0x2d'),'keyType':_0x8605('0x6'),'keyContent':'','variableName':_0x8605('0x2e')},{'type':'keyValue','content':'','key':_0x8605('0x2f'),'keyType':_0x8605('0x6'),'keyContent':'','variableName':_0x8605('0x30')}];break;}}return _0x312002;}; \ No newline at end of file +var _0x0bae=['Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','Called\x20Number','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name'];(function(_0x3ee8d1,_0x54afbd){var _0x5e6660=function(_0x3414a5){while(--_0x3414a5){_0x3ee8d1['push'](_0x3ee8d1['shift']());}};_0x5e6660(++_0x54afbd);}(_0x0bae,0xc1));var _0xe0ba=function(_0x353c86,_0x2511cd){_0x353c86=_0x353c86-0x0;var _0x579b73=_0x0bae[_0x353c86];return _0x579b73;};'use strict';exports[_0xe0ba('0x0')]=function(_0x255f2c,_0x5c7c76){var _0x5a3ba6=[{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x2'),'variableName':null}];switch(_0x255f2c[_0xe0ba('0x3')]()){case _0xe0ba('0x4'):switch(_0x5c7c76[_0xe0ba('0x3')]()){case _0xe0ba('0x5'):_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x7'),'content':'','variableName':_0xe0ba('0x8')});_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x7'),'content':'','variableName':_0xe0ba('0x9')});break;case _0xe0ba('0xa'):_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5a3ba6[_0xe0ba('0x6')]({'type':'variable','content':'','variableName':_0xe0ba('0xb')});break;}}return _0x5a3ba6;};exports[_0xe0ba('0xc')]=function(_0x30beb1,_0x44ab80){var _0x436714=[];switch(_0x30beb1['toLowerCase']()){case _0xe0ba('0x4'):switch(_0x44ab80['toLowerCase']()){case _0xe0ba('0x5'):_0x436714=[{'type':_0xe0ba('0x1'),'content':_0xe0ba('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0xf'),'keyType':'variable','variableName':_0xe0ba('0x9')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x10'),'keyType':_0xe0ba('0x7'),'variableName':'calleridname'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x11'),'keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x12')},{'type':'keyValue','content':'','key':_0xe0ba('0x13'),'keyType':'variable','variableName':_0xe0ba('0x8')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x14'),'keyType':_0xe0ba('0x7'),'variableName':'uniqueid'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x15'),'keyType':_0xe0ba('0x7'),'variableName':'agentcalledAt'},{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x17')},{'type':_0xe0ba('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0xb')},{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x19'),'keyType':'variable','variableName':_0xe0ba('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1b')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x1c'),'keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1d')},{'type':_0xe0ba('0xe'),'content':'','key':'Hold\x20Time','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1e')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x1f'),'keyType':_0xe0ba('0x7'),'variableName':'talktime'}];break;case _0xe0ba('0xa'):_0x436714=[{'type':'string','content':_0xe0ba('0xd'),'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x20'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x14'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x21')},{'type':_0xe0ba('0xe'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xe0ba('0x22')},{'type':_0xe0ba('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x23'),'keyType':'variable','keyContent':'','variableName':_0xe0ba('0x24')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x25'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x26'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x27')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x28'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x29')}];break;}}return _0x436714;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 43b21a4..45661bd 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26bc=['clone','omit','body','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','findOne','then','update','error','tracked','query'];(function(_0x208d4c,_0x3a9eb8){var _0x53e9a4=function(_0x12fca9){while(--_0x12fca9){_0x208d4c['push'](_0x208d4c['shift']());}};_0x53e9a4(++_0x3a9eb8);}(_0x26bc,0x1b6));var _0xc26b=function(_0x3f2f9a,_0x5f0a51){_0x3f2f9a=_0x3f2f9a-0x0;var _0x968c2=_0x26bc[_0x3f2f9a];return _0x968c2;};'use strict';var _=require(_0xc26b('0x0'));var db=require(_0xc26b('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xc26b('0x2')),'mail':require(_0xc26b('0x3'))(_0xc26b('0x4')),'fax':require(_0xc26b('0x3'))(_0xc26b('0x5')),'sms':require(_0xc26b('0x3'))('sms-interactions'),'chat':require('../../config/logger')(_0xc26b('0x6')),'whatsapp':require(_0xc26b('0x3'))(_0xc26b('0x7'))};function getInteractionId(_0x2bfddc,_0x434823,_0x1f7726){if(_0x2bfddc&&_0x2bfddc[_[_0xc26b('0x8')](_0x1f7726)+'InteractionId']){return _0x2bfddc[_['upperFirst'](_0x1f7726)+'InteractionId'];}else if(_0x2bfddc&&_0x2bfddc['id']){return _0x2bfddc['id'];}else if(_0x434823&&_0x434823['id']){return _0x434823['id'];}else{return _0xc26b('0x9');}}function log(_0x402563,_0x615fa,_0x5e2983,_0x2d8b54,_0x1ef0e6,_0x4002e3){loggers[_0x1ef0e6[_0xc26b('0xa')]()][_0x402563](_0xc26b('0xb'),_0x4002e3[_0xc26b('0xc')](),_0x615fa?_0x615fa['id']:null,_0x615fa?_0x615fa[_0xc26b('0xd')]:null,_0x615fa?_0x615fa['role']:null,getInteractionId(_0x5e2983,_0x2d8b54,_0x1ef0e6),_0x5e2983?JSON['stringify'](_0x5e2983):_0xc26b('0xe'));}function updateUser(_0x99388,_0x330745,_0x141402,_0x24c24b,_0x1481d4){db[_[_0xc26b('0x8')](_0x24c24b)+'Interaction'][_0xc26b('0xf')]({'where':{'id':getInteractionId(_0x330745,_0x141402,_0x24c24b)}})[_0xc26b('0x10')](function(_0x12ea72){if(_0x12ea72){return _0x12ea72[_0xc26b('0x11')]({'UserId':_0x99388?_0x99388['id']:null});}})[_0xc26b('0x10')](function(_0x5962aa){if(_0x5962aa){log('info',_0x99388,_0x330745,_0x141402,_0x24c24b,_0x1481d4);}})['catch'](function(){log(_0xc26b('0x12'),_0x99388,_0x330745,_0x141402,_0x24c24b,_0x1481d4);});}exports[_0xc26b('0x13')]=function(_0x40edfe,_0x4d642b){return function(_0x1deb7f,_0xd1bf50,_0x5bf015){var _0x22d6ee=_0x1deb7f['user'];var _0x2a0150={};var _0x2561af=_0x1deb7f[_0xc26b('0x14')];if(_0x2a0150){_0x2a0150=_[_0xc26b('0x15')](_0x1deb7f['body']);_0x2a0150=_[_0xc26b('0x16')](_0x2a0150,[_0xc26b('0x17'),'html',_0xc26b('0x18'),_0xc26b('0x19'),_0xc26b('0x1a')]);}updateUser(_0x22d6ee,_0x2a0150,_0x2561af,_0x40edfe,_0x4d642b);_0x5bf015(null);};}; \ No newline at end of file +var _0x0525=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','info','catch','error','tracked','query','omit','body','html','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','unknown','toLowerCase'];(function(_0x3495cd,_0x369163){var _0x550a1c=function(_0x5a607e){while(--_0x5a607e){_0x3495cd['push'](_0x3495cd['shift']());}};_0x550a1c(++_0x369163);}(_0x0525,0x116));var _0x5052=function(_0x8dc025,_0x438ff5){_0x8dc025=_0x8dc025-0x0;var _0x371ba6=_0x0525[_0x8dc025];return _0x371ba6;};'use strict';var _=require(_0x5052('0x0'));var db=require(_0x5052('0x1'))['db'];var loggers={'openchannel':require(_0x5052('0x2'))(_0x5052('0x3')),'mail':require(_0x5052('0x2'))(_0x5052('0x4')),'fax':require(_0x5052('0x2'))(_0x5052('0x5')),'sms':require(_0x5052('0x2'))(_0x5052('0x6')),'chat':require(_0x5052('0x2'))(_0x5052('0x7')),'whatsapp':require(_0x5052('0x2'))(_0x5052('0x8'))};function getInteractionId(_0x597b8d,_0x27724e,_0x3e7e56){if(_0x597b8d&&_0x597b8d[_[_0x5052('0x9')](_0x3e7e56)+'InteractionId']){return _0x597b8d[_[_0x5052('0x9')](_0x3e7e56)+'InteractionId'];}else if(_0x597b8d&&_0x597b8d['id']){return _0x597b8d['id'];}else if(_0x27724e&&_0x27724e['id']){return _0x27724e['id'];}else{return _0x5052('0xa');}}function log(_0x3faf8d,_0x16fdee,_0x3c7757,_0x46a93e,_0x3fcacb,_0x1b89b2){loggers[_0x3fcacb[_0x5052('0xb')]()][_0x3faf8d](_0x5052('0xc'),_0x1b89b2['toUpperCase'](),_0x16fdee?_0x16fdee['id']:null,_0x16fdee?_0x16fdee[_0x5052('0xd')]:null,_0x16fdee?_0x16fdee[_0x5052('0xe')]:null,getInteractionId(_0x3c7757,_0x46a93e,_0x3fcacb),_0x3c7757?JSON[_0x5052('0xf')](_0x3c7757):_0x5052('0x10'));}function updateUser(_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc){db[_[_0x5052('0x9')](_0xbb1cbb)+_0x5052('0x11')][_0x5052('0x12')]({'where':{'id':getInteractionId(_0x150068,_0x2bbd13,_0xbb1cbb)}})[_0x5052('0x13')](function(_0x4c9c88){if(_0x4c9c88){return _0x4c9c88['update']({'UserId':_0x351ba0?_0x351ba0['id']:null});}})['then'](function(_0x3a06ce){if(_0x3a06ce){log(_0x5052('0x14'),_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc);}})[_0x5052('0x15')](function(){log(_0x5052('0x16'),_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc);});}exports[_0x5052('0x17')]=function(_0x3b6a48,_0x5a5107){return function(_0x299c59,_0x55fd95,_0x5ec52b){var _0x36449a=_0x299c59['user'];var _0xa42268={};var _0x19f97f=_0x299c59[_0x5052('0x18')];if(_0xa42268){_0xa42268=_['clone'](_0x299c59['body']);_0xa42268=_[_0x5052('0x19')](_0xa42268,[_0x5052('0x1a'),_0x5052('0x1b'),'phone','fax',_0x5052('0x1c')]);}updateUser(_0x36449a,_0xa42268,_0x19f97f,_0x3b6a48,_0x5a5107);_0x5ec52b(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c38ea2a..f76dff8 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 _0x9f84=['isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','json','catch','users','User','admin'];(function(_0x1b28de,_0x466873){var _0x3fe976=function(_0x56e8ba){while(--_0x56e8ba){_0x1b28de['push'](_0x1b28de['shift']());}};_0x3fe976(++_0x466873);}(_0x9f84,0x196));var _0x49f8=function(_0x2d638f,_0x828e1e){_0x2d638f=_0x2d638f-0x0;var _0x5a59ed=_0x9f84[_0x2d638f];return _0x5a59ed;};'use strict';var crypto=require(_0x49f8('0x0'));var util=require(_0x49f8('0x1'));var compose=require(_0x49f8('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x49f8('0x3'));function getValueFromLicense(_0x1c0dd8,_0x1aa124){if(_0x1c0dd8&&_0x1aa124){if(_0x1aa124[_0x49f8('0x4')]&&_0x1aa124[_0x49f8('0x5')]){var _0x191065=_0x1aa124[_0x49f8('0x4')];var _0x21071a=_0x1aa124[_0x49f8('0x5')];var _0x1af6b2=_0x191065['split']('-')[0x4];var _0x177d87=_0x191065[_0x49f8('0x6')]('-')[0x0];var _0x375109=crypto[_0x49f8('0x7')](_0x49f8('0x8'),util[_0x49f8('0x9')](_0x49f8('0xa'),_0x1af6b2,_0x191065,_0x177d87));var _0x47e360=_0x375109[_0x49f8('0xb')](_0x21071a,_0x49f8('0xc'),_0x49f8('0xd'));_0x47e360+=_0x375109[_0x49f8('0xe')](_0x49f8('0xd'));var _0x428a53=JSON[_0x49f8('0xf')](_0x47e360);return _0x428a53[_0x49f8('0x10')](_0x1c0dd8)?_0x428a53[_0x1c0dd8]:null;}}return null;}function isLimit(_0x1bc03c,_0x2752f0,_0x466e04,_0x26ac35){var _0xa658ac=_0x2752f0;return compose()[_0x49f8('0x11')](function(_0x28b20b,_0x11b890,_0x398a14){return db[_0x49f8('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x49f8('0x13')](function(_0xaf9aec){var _0x2f14f0=getValueFromLicense(_0x1bc03c,_0xaf9aec);return _0x2f14f0?_0x2f14f0:_0xa658ac;})[_0x49f8('0x13')](function(_0x39b33c){_0xa658ac=_0x39b33c;return _0x466e04[_0x49f8('0x14')](_0x26ac35);})[_0x49f8('0x13')](function(_0x357ba8){if(_0x357ba8>=_0xa658ac){return _0x11b890['status'](0x193)[_0x49f8('0x15')]({'message':util[_0x49f8('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1bc03c)});}_0x398a14();})[_0x49f8('0x16')](function(_0x5c80c1){_0x398a14(_0x5c80c1);});});}function isUserLimit(){return isLimit(_0x49f8('0x17'),0x1,db[_0x49f8('0x18')],{'where':{'$or':[{'role':_0x49f8('0x19')},{'role':'user'}]}});}exports[_0x49f8('0x1a')]=isUserLimit; \ No newline at end of file +var _0x83d4=['hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse'];(function(_0x2fac7d,_0x1c74e0){var _0x21b733=function(_0x1a442f){while(--_0x1a442f){_0x2fac7d['push'](_0x2fac7d['shift']());}};_0x21b733(++_0x1c74e0);}(_0x83d4,0x1cb));var _0x483d=function(_0x264dfd,_0x35a1ce){_0x264dfd=_0x264dfd-0x0;var _0x5e04fd=_0x83d4[_0x264dfd];return _0x5e04fd;};'use strict';var crypto=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var compose=require(_0x483d('0x2'));var db=require(_0x483d('0x3'))['db'];var config=require(_0x483d('0x4'));function getValueFromLicense(_0x19bd34,_0xf8d790){if(_0x19bd34&&_0xf8d790){if(_0xf8d790[_0x483d('0x5')]&&_0xf8d790[_0x483d('0x6')]){var _0x2fd754=_0xf8d790['data1'];var _0x2e3b4f=_0xf8d790[_0x483d('0x6')];var _0x7d3fea=_0x2fd754[_0x483d('0x7')]('-')[0x4];var _0x47ccfc=_0x2fd754[_0x483d('0x7')]('-')[0x0];var _0x1373bb=crypto[_0x483d('0x8')](_0x483d('0x9'),util[_0x483d('0xa')](_0x483d('0xb'),_0x7d3fea,_0x2fd754,_0x47ccfc));var _0x12585f=_0x1373bb[_0x483d('0xc')](_0x2e3b4f,_0x483d('0xd'),_0x483d('0xe'));_0x12585f+=_0x1373bb[_0x483d('0xf')](_0x483d('0xe'));var _0x5bd449=JSON[_0x483d('0x10')](_0x12585f);return _0x5bd449[_0x483d('0x11')](_0x19bd34)?_0x5bd449[_0x19bd34]:null;}}return null;}function isLimit(_0x1a2fef,_0xdfbe72,_0x1ed18b,_0x449f3e){var _0x241fc9=_0xdfbe72;return compose()[_0x483d('0x12')](function(_0xa45a82,_0x5bb954,_0x55bbfc){return db[_0x483d('0x13')][_0x483d('0x14')]({'where':{'id':0x1},'raw':!![]})[_0x483d('0x15')](function(_0x55f42a){var _0x3a9d31=getValueFromLicense(_0x1a2fef,_0x55f42a);return _0x3a9d31?_0x3a9d31:_0x241fc9;})[_0x483d('0x15')](function(_0xf12d9){_0x241fc9=_0xf12d9;return _0x1ed18b[_0x483d('0x16')](_0x449f3e);})[_0x483d('0x15')](function(_0x5f3214){if(_0x5f3214>=_0x241fc9){return _0x5bb954[_0x483d('0x17')](0x193)['json']({'message':util[_0x483d('0xa')](_0x483d('0x18'),_0x1a2fef)});}_0x55bbfc();})['catch'](function(_0x347c22){_0x55bbfc(_0x347c22);});});}function isUserLimit(){return isLimit(_0x483d('0x19'),0x1,db['User'],{'where':{'$or':[{'role':_0x483d('0x1a')},{'role':'user'}]}});}exports[_0x483d('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 65514d4..c3dbcfc 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 _0x043a=['value','includes','$gt','days','format','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','add','minutes','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','operator','$eq','$between'];(function(_0x22a00a,_0x4faf59){var _0x5e7683=function(_0x5cb101){while(--_0x5cb101){_0x22a00a['push'](_0x22a00a['shift']());}};_0x5e7683(++_0x4faf59);}(_0x043a,0xbc));var _0xa043=function(_0x15774a,_0x1bfb4a){_0x15774a=_0x15774a-0x0;var _0x4ec555=_0x043a[_0x15774a];return _0x4ec555;};'use strict';var _=require('lodash');var moment=require(_0xa043('0x0'));exports['parseSearch']=function(_0x2c66fa){var _0x3bdd78={'conditions':[]};_0x3bdd78[_0xa043('0x1')]=_[_0xa043('0x2')](_0x2c66fa,_0xa043('0x3'))?'or':_0xa043('0x4');var _0xa1f500=_0x2c66fa['replace']('[$and]','')[_0xa043('0x5')]('[$or]','')[_0xa043('0x6')]('||');for(var _0x305c3f=0x0;_0x305c3f<_0xa1f500[_0xa043('0x7')];_0x305c3f++){var _0x55c1f3=_0xa1f500[_0x305c3f][_0xa043('0x6')](':=');var _0x51c195=_0x55c1f3[0x0];var _0x4b9e4d=_0x55c1f3['slice'](0x1);_0x4b9e4d[_0xa043('0x8')](function(_0x140792){var _0x47755e=_0x140792[_0xa043('0x6')]('[')[_0xa043('0x9')]();var _0xac56a1=_0x140792[_0xa043('0xa')](/\[(.*?)\]/g);_0xac56a1[_0xa043('0x8')](function(_0x556a3a){var _0x3d3523=_0x556a3a['split']('[')[_0xa043('0xb')](function(_0x3d661a){return _0x3d661a['indexOf'](']')>-0x1;})[_0xa043('0xc')](function(_0x5617a8){return _0x5617a8[_0xa043('0x6')](']')[0x0];})[0x0];_0x3bdd78[_0xa043('0xd')][_0xa043('0xe')]({'field':_0x51c195,'operator':_0x47755e,'value':_0x3d3523});});});}return _0x3bdd78;};exports[_0xa043('0xf')]=function(_0x49b88b,_0x5d0554,_0x2fa3d0){var _0x4ee7cc={};if(_0x5d0554===_0xa043('0x10')){if(_0x2fa3d0[_0xa043('0x11')]===_0xa043('0x12')){_0x2fa3d0['operator']=_0xa043('0x13');_0x2fa3d0[_0xa043('0x14')]+=','+_0x2fa3d0[_0xa043('0x14')];}else if(_[_0xa043('0x15')]([_0xa043('0x16'),'$lte'],_0x2fa3d0[_0xa043('0x11')])){_0x2fa3d0[_0xa043('0x14')]=moment(_0x2fa3d0[_0xa043('0x14')])['add'](0x1,_0xa043('0x17'))[_0xa043('0x18')]('YYYY-MM-DD');}}if(_0x2fa3d0[_0xa043('0x19')]){_0x5d0554=_0x2fa3d0[_0xa043('0x19')];_0x4ee7cc[_0xa043('0x1a')]=_0xa043('0x1b')+_0x49b88b+'.'+_0x2fa3d0[_0xa043('0x1c')]+'\x20AS\x20'+_0x2fa3d0[_0xa043('0x19')]+')\x20'+parseOperator(_0x2fa3d0[_0xa043('0x11')]);}else{_0x4ee7cc['text']=_0x49b88b+'.'+_0x2fa3d0[_0xa043('0x1c')]+'\x20'+parseOperator(_0x2fa3d0[_0xa043('0x11')]);}if(_[_0xa043('0x15')]([_0xa043('0x1d'),_0xa043('0x1e')],_0x2fa3d0[_0xa043('0x11')]))_0x4ee7cc[_0xa043('0x1a')]='('+_0x4ee7cc[_0xa043('0x1a')]+_0xa043('0x1f')+_0x49b88b+'.'+_0x2fa3d0[_0xa043('0x1c')]+'\x20IS\x20NULL)';_0x4ee7cc[_0xa043('0x14')]=parseValue(_0x5d0554,_0x2fa3d0[_0xa043('0x11')],_0x2fa3d0[_0xa043('0x14')]);return _0x4ee7cc;};function parseOperator(_0x15f69a){var _0x5b2e18;switch(_0x15f69a){case _0xa043('0x20'):_0x5b2e18=_0xa043('0x21');break;case _0xa043('0x1e'):_0x5b2e18=_0xa043('0x22');break;case _0xa043('0x12'):_0x5b2e18=_0xa043('0x23');break;case _0xa043('0x1d'):_0x5b2e18=_0xa043('0x24');break;case _0xa043('0x25'):case _0xa043('0x26'):case _0xa043('0x27'):_0x5b2e18=_0xa043('0x28');break;case _0xa043('0x29'):_0x5b2e18=_0xa043('0x2a');break;case _0xa043('0x16'):_0x5b2e18=_0xa043('0x2b');break;case _0xa043('0x2c'):_0x5b2e18=_0xa043('0x2d');break;case'$gte':_0x5b2e18=_0xa043('0x2e');break;case'$between':_0x5b2e18=_0xa043('0x2f');break;}return _0x5b2e18;}function parseValue(_0x3b65da,_0x5d3bb2,_0x260305){var _0xfa3468={'start':undefined,'end':undefined};switch(_0x5d3bb2){case _0xa043('0x20'):case _0xa043('0x1e'):_0xfa3468['start']=_0x260305[_0xa043('0x6')](',');break;case _0xa043('0x25'):_0xfa3468[_0xa043('0x30')]='%'+_0x260305+'%';break;case'$startsWith':_0xfa3468[_0xa043('0x30')]=_0x260305+'%';break;case _0xa043('0x27'):_0xfa3468[_0xa043('0x30')]='%'+_0x260305;break;case'$between':var _0x2fa5fd=_0x260305[_0xa043('0x6')](',');var _0x260305=_0x2fa5fd[_0xa043('0x9')]();var _0x32807e=_0x2fa5fd[_0xa043('0x31')]();if(_0x3b65da==='DATE'){_0x260305=moment(_0x260305)['utcOffset'](0x0,!![])[_0xa043('0x18')]();_0x32807e=moment(_0x32807e)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0xa043('0x32')](0x3b,_0xa043('0x33'))['add'](0x3b,'seconds')[_0xa043('0x18')]();}_0xfa3468={'start':_0x260305,'end':_0x32807e};break;default:_0xfa3468[_0xa043('0x30')]=_0x260305;break;}return _0xfa3468;} \ No newline at end of file +var _0xf98d=['add','hours','minutes','parseSearch','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','>=\x20?','start','$substring','pop','utcOffset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf98d,0x16f));var _0xdf98=function(_0x4f1986,_0x5c65c5){_0x4f1986=_0x4f1986-0x0;var _0x25d085=_0xf98d[_0x4f1986];return _0x25d085;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xdf98('0x0')]=function(_0x76472e){var _0x29127d={'conditions':[]};_0x29127d['sqlOperator']=_[_0xdf98('0x1')](_0x76472e,_0xdf98('0x2'))?'or':_0xdf98('0x3');var _0x38d85d=_0x76472e[_0xdf98('0x4')](_0xdf98('0x5'),'')['replace'](_0xdf98('0x2'),'')['split']('||');for(var _0x2537b6=0x0;_0x2537b6<_0x38d85d[_0xdf98('0x6')];_0x2537b6++){var _0x1b3a2c=_0x38d85d[_0x2537b6][_0xdf98('0x7')](':=');var _0x317161=_0x1b3a2c[0x0];var _0x129135=_0x1b3a2c[_0xdf98('0x8')](0x1);_0x129135['forEach'](function(_0x112ff8){var _0x557567=_0x112ff8[_0xdf98('0x7')]('[')[_0xdf98('0x9')]();var _0x1b1276=_0x112ff8['match'](/\[(.*?)\]/g);_0x1b1276[_0xdf98('0xa')](function(_0x5e8362){var _0x1af4f1=_0x5e8362['split']('[')['filter'](function(_0x5cedb1){return _0x5cedb1[_0xdf98('0xb')](']')>-0x1;})[_0xdf98('0xc')](function(_0x39d406){return _0x39d406['split'](']')[0x0];})[0x0];_0x29127d[_0xdf98('0xd')][_0xdf98('0xe')]({'field':_0x317161,'operator':_0x557567,'value':_0x1af4f1});});});}return _0x29127d;};exports[_0xdf98('0xf')]=function(_0x556627,_0x2be100,_0x4075ea){var _0x3d2461={};if(_0x2be100===_0xdf98('0x10')){if(_0x4075ea[_0xdf98('0x11')]===_0xdf98('0x12')){_0x4075ea[_0xdf98('0x11')]=_0xdf98('0x13');_0x4075ea[_0xdf98('0x14')]+=','+_0x4075ea['value'];}else if(_[_0xdf98('0x15')]([_0xdf98('0x16'),_0xdf98('0x17')],_0x4075ea['operator'])){_0x4075ea['value']=moment(_0x4075ea[_0xdf98('0x14')])['add'](0x1,_0xdf98('0x18'))[_0xdf98('0x19')](_0xdf98('0x1a'));}}if(_0x4075ea[_0xdf98('0x1b')]){_0x2be100=_0x4075ea[_0xdf98('0x1b')];_0x3d2461[_0xdf98('0x1c')]=_0xdf98('0x1d')+_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+_0xdf98('0x1f')+_0x4075ea[_0xdf98('0x1b')]+')\x20'+parseOperator(_0x4075ea[_0xdf98('0x11')]);}else{_0x3d2461[_0xdf98('0x1c')]=_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+'\x20'+parseOperator(_0x4075ea[_0xdf98('0x11')]);}if(_['includes']([_0xdf98('0x20'),_0xdf98('0x21')],_0x4075ea[_0xdf98('0x11')]))_0x3d2461['text']='('+_0x3d2461[_0xdf98('0x1c')]+_0xdf98('0x22')+_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+'\x20IS\x20NULL)';_0x3d2461['value']=parseValue(_0x2be100,_0x4075ea[_0xdf98('0x11')],_0x4075ea[_0xdf98('0x14')]);return _0x3d2461;};function parseOperator(_0x57cccf){var _0x5ab20e;switch(_0x57cccf){case _0xdf98('0x23'):_0x5ab20e='IN\x20?';break;case'$notIn':_0x5ab20e='NOT\x20IN\x20?';break;case'$eq':_0x5ab20e=_0xdf98('0x24');break;case'$ne':_0x5ab20e=_0xdf98('0x25');break;case'$substring':case _0xdf98('0x26'):case _0xdf98('0x27'):_0x5ab20e=_0xdf98('0x28');break;case _0xdf98('0x29'):_0x5ab20e=_0xdf98('0x2a');break;case'$gt':_0x5ab20e=_0xdf98('0x2b');break;case _0xdf98('0x17'):_0x5ab20e='<=\x20?';break;case'$gte':_0x5ab20e=_0xdf98('0x2c');break;case _0xdf98('0x13'):_0x5ab20e='BETWEEN\x20?\x20AND\x20?';break;}return _0x5ab20e;}function parseValue(_0x334cc3,_0x58647d,_0xa5585c){var _0x4893b5={'start':undefined,'end':undefined};switch(_0x58647d){case _0xdf98('0x23'):case _0xdf98('0x21'):_0x4893b5[_0xdf98('0x2d')]=_0xa5585c[_0xdf98('0x7')](',');break;case _0xdf98('0x2e'):_0x4893b5[_0xdf98('0x2d')]='%'+_0xa5585c+'%';break;case _0xdf98('0x26'):_0x4893b5[_0xdf98('0x2d')]=_0xa5585c+'%';break;case _0xdf98('0x27'):_0x4893b5['start']='%'+_0xa5585c;break;case'$between':var _0x4da6b9=_0xa5585c[_0xdf98('0x7')](',');var _0xa5585c=_0x4da6b9[_0xdf98('0x9')]();var _0x4dd197=_0x4da6b9[_0xdf98('0x2f')]();if(_0x334cc3===_0xdf98('0x10')){_0xa5585c=moment(_0xa5585c)['utcOffset'](0x0,!![])[_0xdf98('0x19')]();_0x4dd197=moment(_0x4dd197)[_0xdf98('0x30')](0x0,!![])[_0xdf98('0x31')](0x17,_0xdf98('0x32'))['add'](0x3b,_0xdf98('0x33'))[_0xdf98('0x31')](0x3b,'seconds')[_0xdf98('0x19')]();}_0x4893b5={'start':_0xa5585c,'end':_0x4dd197};break;default:_0x4893b5['start']=_0xa5585c;break;}return _0x4893b5;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5a1d068..82e5c02 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 _0x5162=['attributes','limit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','lodash','parse','keys','includes','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','intersection'];(function(_0x5bac92,_0xdde3b2){var _0x161536=function(_0x327fcd){while(--_0x327fcd){_0x5bac92['push'](_0x5bac92['shift']());}};_0x161536(++_0xdde3b2);}(_0x5162,0x103));var _0x2516=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0x5162[_0x163691];return _0x543ae5;};'use strict';var _=require(_0x2516('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5194e6){var _0x4db25c=['ne'];try{var _0x41fd28=JSON[_0x2516('0x1')](_0x5194e6);var _0x3ce7de=Object[_0x2516('0x2')](_0x41fd28)[0x0];return _0x4db25c[_0x2516('0x3')](_0x3ce7de);}catch(_0x25dce6){return![];}}function getOperatorValue(_0x3a7984){var _0x5b71b5=JSON['parse'](_0x3a7984);var _0x5beeb3=Object[_0x2516('0x2')](_0x5b71b5)[0x0];var _0xba4b36=_0x5b71b5[_0x5beeb3];return{['$'+_0x5beeb3]:_0xba4b36};}exports[_0x2516('0x4')]=function(_0x3a8834){var _0x3abc5d=null;if(_0x3a8834){_0x3abc5d=_0x3a8834[_0x2516('0x5')](',');}return _0x3abc5d;};exports[_0x2516('0x6')]=function(_0x590875,_0x409550){var _0x3f7e71={};if(!_[_0x2516('0x7')](_0x590875)){_['forOwn'](_0x590875,function(_0x530b1b,_0x4ba807){try{if(_0x409550){var _0x4ceaa1=_[_0x2516('0x8')](_0x409550,{'name':_0x4ba807})||{};if(hasSequelizeOperator(_0x530b1b)){_0x3f7e71[_0x4ba807]=getOperatorValue(_0x530b1b);}else if(_0x4ceaa1[_0x2516('0x9')]===_0x2516('0xa')&&_[_0x2516('0xb')](_0x530b1b)){var _0x56c69c=JSON[_0x2516('0x1')](_0x530b1b);var _0x458aca={'$gte':moment(moment(_0x56c69c[_0x2516('0xc')])[_0x2516('0xd')](_0x2516('0xe')))[_0x2516('0xf')]()[_0x2516('0xd')](),'$lte':moment(moment(_0x56c69c[_0x2516('0x10')])[_0x2516('0xd')](_0x2516('0xe')))[_0x2516('0xf')]()[_0x2516('0x11')](0x1,'s')[_0x2516('0xd')]()};_0x3f7e71[_0x4ba807]=_0x458aca;}else if(_0x4ceaa1[_0x2516('0x12')]===_0x2516('0x13')){_0x3f7e71[_0x4ba807]=_0x530b1b;}else{_0x3f7e71[_0x4ba807]=_['isArray'](_0x530b1b)?_0x530b1b:JSON[_0x2516('0x1')](_0x530b1b);}}else{_0x3f7e71[_0x4ba807]=_[_0x2516('0x14')](_0x530b1b)?_0x530b1b:JSON[_0x2516('0x1')](_0x530b1b);}}catch(_0x564d05){_0x3f7e71[_0x4ba807]=_0x530b1b[_0x2516('0x5')](',');}});}return _0x3f7e71;};exports['limit']=function(_0x532d46){_0x532d46=parseInt(_0x532d46,0xa);if(!_0x532d46||_0x532d46<0x0){_0x532d46=LIMIT_VALUE;}return _0x532d46;};exports[_0x2516('0x15')]=function(_0x3583cf){_0x3583cf=parseInt(_0x3583cf,0xa);if(!_0x3583cf||_0x3583cf<0x0){_0x3583cf=0x0;}return _0x3583cf;};exports[_0x2516('0x16')]=function(_0x618aed){var _0x198b93,_0x42ba50=null;if(_0x618aed){_0x198b93=_0x618aed[_0x2516('0x5')](',');_0x42ba50=_[_0x2516('0x17')](_0x198b93,function(_0x248c5a){if(_0x248c5a[_0x2516('0x18')]('-')===0x0){return[_0x248c5a===_0x2516('0x19')?sequelize[_0x2516('0x1a')](sequelize[_0x2516('0x1b')]('priority'),'unsigned'):_0x248c5a[_0x2516('0x1c')](0x1),_0x2516('0x1d')];}else{return[_0x248c5a===_0x2516('0x19')?sequelize[_0x2516('0x1a')](sequelize[_0x2516('0x1b')](_0x2516('0x19')),_0x2516('0x1e')):_0x248c5a,_0x2516('0x1f')];}});}return _0x42ba50;};exports['omit']=function(_0xa4538d,_0x39c63f){if(_[_0x2516('0x7')](_0xa4538d)){return _0xa4538d;}if(_[_0x2516('0x14')](_0xa4538d)){for(var _0x47f4fb=0x0;_0x47f4fb<_0xa4538d[_0x2516('0x20')];_0x47f4fb+=0x1){_0xa4538d[_0x47f4fb]=this[_0x2516('0x21')](_0xa4538d[_0x47f4fb],_0x39c63f);}return _0xa4538d;}if(!_[_0x2516('0x22')](_0xa4538d)){return _0xa4538d;}if(_[_0x2516('0x23')](_0x39c63f)){_0x39c63f=[_0x39c63f];}if(!_[_0x2516('0x14')](_0x39c63f)){return _0xa4538d;}for(var _0x4a3dc8=0x0;_0x4a3dc8<_0x39c63f[_0x2516('0x20')];_0x4a3dc8+=0x1){_[_0x2516('0x24')](_0xa4538d,_0x39c63f[_0x4a3dc8]);}for(var _0x935035 in _0xa4538d){if(_0xa4538d[_0x2516('0x25')](_0x935035)){_0xa4538d[_0x935035]=this[_0x2516('0x21')](_0xa4538d[_0x935035],_0x39c63f);}}return _0xa4538d;};exports[_0x2516('0x26')]=function(_0x556f01){return _0x556f01[_0x2516('0x27')](RegExp(_0x2516('0x28')))?!![]:![];};exports['isEmail']=function(_0x19d90d){return _0x19d90d[_0x2516('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x2516('0x29')]=function(_0x3b1aa6){var _0x539704=[];_0x3b1aa6[_0x2516('0x5')](/[ ,]+/)[_0x2516('0x2a')](function(_0x3c1daf){_0x3c1daf=_0x3c1daf[_0x2516('0x2b')](/([^:]")"+/g,'$1');_0x3c1daf='+'+_0x3c1daf+'*';var _0x12d790=/[ `!@#$%^&*()_\-?~]/;if(_0x3c1daf[_0x2516('0x27')](_0x12d790))_0x3c1daf='\x22'+_0x3c1daf+'\x22';_0x539704[_0x2516('0x2c')](_0x3c1daf);});return _0x539704[_0x2516('0x2d')]('\x20');};exports[_0x2516('0x2e')]=function(_0xe29221,_0x56fda8,_0x3e7a55){var _0x54147b={},_0x35fdf8={};if(_0x56fda8['query'][_0x2516('0x2f')]){_0x56fda8['query']['id']=_0x56fda8[_0x2516('0x30')][_0x2516('0x2f')];delete _0x56fda8[_0x2516('0x30')][_0x2516('0x2f')];}_0x54147b[_0x2516('0x31')]=_[_0x2516('0x17')](_0xe29221,_0x2516('0x12'));_0x54147b[_0x2516('0x30')]=_[_0x2516('0x2')](_0x56fda8['query']);_0x54147b[_0x2516('0x6')]=_[_0x2516('0x32')](_0x54147b[_0x2516('0x31')],_0x54147b[_0x2516('0x30')]);_0x35fdf8['attributes']=_['intersection'](_0x54147b[_0x2516('0x31')],this[_0x2516('0x4')](_0x56fda8[_0x2516('0x30')][_0x2516('0x4')]));_0x35fdf8[_0x2516('0x33')]=_0x35fdf8[_0x2516('0x33')][_0x2516('0x20')]?_0x35fdf8[_0x2516('0x33')]:_0x54147b[_0x2516('0x31')];if(!_0x56fda8[_0x2516('0x30')]['hasOwnProperty']('nolimit')){_0x35fdf8[_0x2516('0x34')]=this[_0x2516('0x34')](_0x56fda8['query']['limit']);_0x35fdf8[_0x2516('0x15')]=this[_0x2516('0x15')](_0x56fda8['query'][_0x2516('0x15')]);}_0x35fdf8['order']=this[_0x2516('0x16')](_0x56fda8[_0x2516('0x30')]['sort']);_0x35fdf8[_0x2516('0x35')]=this[_0x2516('0x6')](_[_0x2516('0x36')](_0x56fda8[_0x2516('0x30')],_0x54147b[_0x2516('0x6')]),_0xe29221);if(_0x56fda8[_0x2516('0x30')][_0x2516('0x37')]){var _0x2371a8=_0xe29221;var _0x346e31=_0x56fda8[_0x2516('0x30')][_0x2516('0x37')];if(typeof _0x346e31===_0x2516('0x38')){_0x2371a8=_[_0x2516('0x37')](_0xe29221,function(_0x4c832b){return _[_0x2516('0x3')](_0x346e31[_0x2516('0x39')],_0x4c832b['name']);});_0x346e31=_0x346e31[_0x2516('0x3a')];}_0x35fdf8[_0x2516('0x35')]=_[_0x2516('0x3b')](_0x35fdf8[_0x2516('0x35')],{'$or':_[_0x2516('0x17')](_0x2371a8,function(_0x582cb6){if(_0x582cb6[_0x2516('0x9')]!==_0x2516('0x3c')){if(_0x3e7a55){return sequelize[_0x2516('0x35')](sequelize['fn'](_0x2516('0x3d'),sequelize[_0x2516('0x1b')](_0x582cb6[_0x2516('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x56fda8[_0x2516('0x30')][_0x2516('0x37')]+'%')});}else{var _0xe64acc={};_0xe64acc[_0x582cb6[_0x2516('0x12')]]={'$like':'%'+_0x56fda8[_0x2516('0x30')][_0x2516('0x37')]+'%'};return _0xe64acc;}}})});}_0x35fdf8=_[_0x2516('0x3b')]({},_0x35fdf8,_0x56fda8['options']);return _0x35fdf8;}; \ No newline at end of file +var _0x2675=['value','where','merge','col','options','lodash','keys','parse','fields','split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','cast','priority','unsigned','substr','ASC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','push','join','getOptions','query','$id','filters','intersection','model','attributes','nolimit','sort','filter','object','includes'];(function(_0x1549fd,_0x56022c){var _0x358e14=function(_0x15f7fd){while(--_0x15f7fd){_0x1549fd['push'](_0x1549fd['shift']());}};_0x358e14(++_0x56022c);}(_0x2675,0x75));var _0x5267=function(_0x3c6631,_0x5dc148){_0x3c6631=_0x3c6631-0x0;var _0x5b165b=_0x2675[_0x3c6631];return _0x5b165b;};'use strict';var _=require(_0x5267('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4f8fae){var _0x1da342=['ne'];try{var _0x2ae442=JSON['parse'](_0x4f8fae);var _0x4600fa=Object[_0x5267('0x1')](_0x2ae442)[0x0];return _0x1da342['includes'](_0x4600fa);}catch(_0x328776){return![];}}function getOperatorValue(_0xf2b350){var _0x4bd042=JSON[_0x5267('0x2')](_0xf2b350);var _0x20f065=Object[_0x5267('0x1')](_0x4bd042)[0x0];var _0x527c16=_0x4bd042[_0x20f065];return{['$'+_0x20f065]:_0x527c16};}exports[_0x5267('0x3')]=function(_0x46bfdf){var _0x506fd7=null;if(_0x46bfdf){_0x506fd7=_0x46bfdf[_0x5267('0x4')](',');}return _0x506fd7;};exports['filters']=function(_0x3ff4e9,_0x207d47){var _0x26e22b={};if(!_['isEmpty'](_0x3ff4e9)){_[_0x5267('0x5')](_0x3ff4e9,function(_0x5060b3,_0x445151){try{if(_0x207d47){var _0x5bbf00=_[_0x5267('0x6')](_0x207d47,{'name':_0x445151})||{};if(hasSequelizeOperator(_0x5060b3)){_0x26e22b[_0x445151]=getOperatorValue(_0x5060b3);}else if(_0x5bbf00[_0x5267('0x7')]===_0x5267('0x8')&&_[_0x5267('0x9')](_0x5060b3)){var _0x1d7090=JSON[_0x5267('0x2')](_0x5060b3);var _0x20785c={'$gte':moment(moment(_0x1d7090[_0x5267('0xa')])[_0x5267('0xb')](_0x5267('0xc')))[_0x5267('0xd')]()[_0x5267('0xb')](),'$lte':moment(moment(_0x1d7090[_0x5267('0xe')])['format']('YYYY-MM-DD'))[_0x5267('0xd')]()[_0x5267('0xf')](0x1,'s')[_0x5267('0xb')]()};_0x26e22b[_0x445151]=_0x20785c;}else if(_0x5bbf00[_0x5267('0x10')]===_0x5267('0x11')){_0x26e22b[_0x445151]=_0x5060b3;}else{_0x26e22b[_0x445151]=_[_0x5267('0x12')](_0x5060b3)?_0x5060b3:JSON[_0x5267('0x2')](_0x5060b3);}}else{_0x26e22b[_0x445151]=_[_0x5267('0x12')](_0x5060b3)?_0x5060b3:JSON[_0x5267('0x2')](_0x5060b3);}}catch(_0xb1c97a){_0x26e22b[_0x445151]=_0x5060b3[_0x5267('0x4')](',');}});}return _0x26e22b;};exports[_0x5267('0x13')]=function(_0x528d61){_0x528d61=parseInt(_0x528d61,0xa);if(!_0x528d61||_0x528d61<0x0){_0x528d61=LIMIT_VALUE;}return _0x528d61;};exports[_0x5267('0x14')]=function(_0x2afd38){_0x2afd38=parseInt(_0x2afd38,0xa);if(!_0x2afd38||_0x2afd38<0x0){_0x2afd38=0x0;}return _0x2afd38;};exports['sort']=function(_0x20cb50){var _0x56733e,_0x1cf835=null;if(_0x20cb50){_0x56733e=_0x20cb50[_0x5267('0x4')](',');_0x1cf835=_[_0x5267('0x15')](_0x56733e,function(_0x2a9f99){if(_0x2a9f99[_0x5267('0x16')]('-')===0x0){return[_0x2a9f99==='priority'?sequelize[_0x5267('0x17')](sequelize['col'](_0x5267('0x18')),_0x5267('0x19')):_0x2a9f99[_0x5267('0x1a')](0x1),'DESC'];}else{return[_0x2a9f99==='priority'?sequelize['cast'](sequelize['col']('priority'),_0x5267('0x19')):_0x2a9f99,_0x5267('0x1b')];}});}return _0x1cf835;};exports[_0x5267('0x1c')]=function(_0x279377,_0x11c8ea){if(_[_0x5267('0x1d')](_0x279377)){return _0x279377;}if(_[_0x5267('0x12')](_0x279377)){for(var _0x220e03=0x0;_0x220e03<_0x279377[_0x5267('0x1e')];_0x220e03+=0x1){_0x279377[_0x220e03]=this['omit'](_0x279377[_0x220e03],_0x11c8ea);}return _0x279377;}if(!_['isObject'](_0x279377)){return _0x279377;}if(_[_0x5267('0x1f')](_0x11c8ea)){_0x11c8ea=[_0x11c8ea];}if(!_[_0x5267('0x12')](_0x11c8ea)){return _0x279377;}for(var _0x5abf95=0x0;_0x5abf95<_0x11c8ea[_0x5267('0x1e')];_0x5abf95+=0x1){_['unset'](_0x279377,_0x11c8ea[_0x5abf95]);}for(var _0x4d7c2a in _0x279377){if(_0x279377[_0x5267('0x20')](_0x4d7c2a)){_0x279377[_0x4d7c2a]=this[_0x5267('0x1c')](_0x279377[_0x4d7c2a],_0x11c8ea);}}return _0x279377;};exports[_0x5267('0x21')]=function(_0x2d2ace){return _0x2d2ace[_0x5267('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x18020c){return _0x18020c[_0x5267('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x5267('0x23')]=function(_0x549a66){var _0x58d685=[];_0x549a66[_0x5267('0x4')](/[ ,]+/)[_0x5267('0x24')](function(_0x1fa725){_0x1fa725=_0x1fa725['replace'](/([^:]")"+/g,'$1');_0x1fa725='+'+_0x1fa725+'*';var _0x59b091=/[ `!@#$%^&*()_\-?~]/;if(_0x1fa725[_0x5267('0x22')](_0x59b091))_0x1fa725='\x22'+_0x1fa725+'\x22';_0x58d685[_0x5267('0x25')](_0x1fa725);});return _0x58d685[_0x5267('0x26')]('\x20');};exports[_0x5267('0x27')]=function(_0x5bbb83,_0x33e456,_0x1a7f4b){var _0x4344c5={},_0xf8d7a3={};if(_0x33e456[_0x5267('0x28')][_0x5267('0x29')]){_0x33e456[_0x5267('0x28')]['id']=_0x33e456[_0x5267('0x28')]['$id'];delete _0x33e456['query'][_0x5267('0x29')];}_0x4344c5['model']=_[_0x5267('0x15')](_0x5bbb83,_0x5267('0x10'));_0x4344c5[_0x5267('0x28')]=_[_0x5267('0x1')](_0x33e456['query']);_0x4344c5[_0x5267('0x2a')]=_[_0x5267('0x2b')](_0x4344c5[_0x5267('0x2c')],_0x4344c5[_0x5267('0x28')]);_0xf8d7a3[_0x5267('0x2d')]=_[_0x5267('0x2b')](_0x4344c5[_0x5267('0x2c')],this[_0x5267('0x3')](_0x33e456['query'][_0x5267('0x3')]));_0xf8d7a3['attributes']=_0xf8d7a3[_0x5267('0x2d')][_0x5267('0x1e')]?_0xf8d7a3[_0x5267('0x2d')]:_0x4344c5[_0x5267('0x2c')];if(!_0x33e456[_0x5267('0x28')][_0x5267('0x20')](_0x5267('0x2e'))){_0xf8d7a3['limit']=this[_0x5267('0x13')](_0x33e456[_0x5267('0x28')][_0x5267('0x13')]);_0xf8d7a3[_0x5267('0x14')]=this[_0x5267('0x14')](_0x33e456[_0x5267('0x28')][_0x5267('0x14')]);}_0xf8d7a3['order']=this[_0x5267('0x2f')](_0x33e456['query'][_0x5267('0x2f')]);_0xf8d7a3['where']=this['filters'](_['pick'](_0x33e456[_0x5267('0x28')],_0x4344c5['filters']),_0x5bbb83);if(_0x33e456[_0x5267('0x28')][_0x5267('0x30')]){var _0x3d4b19=_0x5bbb83;var _0x235982=_0x33e456['query'][_0x5267('0x30')];if(typeof _0x235982===_0x5267('0x31')){_0x3d4b19=_['filter'](_0x5bbb83,function(_0x54a5e5){return _[_0x5267('0x32')](_0x235982['columns'],_0x54a5e5[_0x5267('0x10')]);});_0x235982=_0x235982[_0x5267('0x33')];}_0xf8d7a3[_0x5267('0x34')]=_[_0x5267('0x35')](_0xf8d7a3[_0x5267('0x34')],{'$or':_[_0x5267('0x15')](_0x3d4b19,function(_0x27add5){if(_0x27add5['type']!=='VIRTUAL'){if(_0x1a7f4b){return sequelize[_0x5267('0x34')](sequelize['fn']('lower',sequelize[_0x5267('0x36')](_0x27add5[_0x5267('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x33e456[_0x5267('0x28')][_0x5267('0x30')]+'%')});}else{var _0x299a13={};_0x299a13[_0x27add5[_0x5267('0x10')]]={'$like':'%'+_0x33e456[_0x5267('0x28')][_0x5267('0x30')]+'%'};return _0x299a13;}}})});}_0xf8d7a3=_[_0x5267('0x35')]({},_0xf8d7a3,_0x33e456[_0x5267('0x37')]);return _0xf8d7a3;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index bdf913c..1291235 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(_0x2164d1,_0x5f0080){var _0x88a1f5=function(_0x33fb29){while(--_0x33fb29){_0x2164d1['push'](_0x2164d1['shift']());}};_0x88a1f5(++_0x5f0080);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x4de7ab,_0x44a6c3){var _0x1f3f06=function(_0x55c66b){while(--_0x55c66b){_0x4de7ab['push'](_0x4de7ab['shift']());}};_0x1f3f06(++_0x44a6c3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 de91db7..7c6c7ee 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 _0xedcf=['address','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','length','family','IPv4','internal','head','mac','00:00:00:00:00:00'];(function(_0x23dba1,_0x1da069){var _0x240079=function(_0x2c20c2){while(--_0x2c20c2){_0x23dba1['push'](_0x23dba1['shift']());}};_0x240079(++_0x1da069);}(_0xedcf,0x10a));var _0xfedc=function(_0x131a36,_0x87a61d){_0x131a36=_0x131a36-0x0;var _0x32d66c=_0xedcf[_0x131a36];return _0x32d66c;};'use strict';var _=require(_0xfedc('0x0'));var os=require('os');var crypto=require(_0xfedc('0x1'));var machine=require(_0xfedc('0x2'));var exec=require(_0xfedc('0x3'))[_0xfedc('0x4')];var config=require(_0xfedc('0x5'));function getInterfaces(){var _0x33623f=[];var _0x1cf21a=os['networkInterfaces']();var _0x27da89=_[_0xfedc('0x6')](_['keys'](_0x1cf21a));for(var _0x41afe0=0x0;_0x41afe0<_0x27da89[_0xfedc('0x7')];_0x41afe0++){var _0x31a58c=_0x1cf21a[_0x27da89[_0x41afe0]]['filter'](function(_0x202840){return _0x202840[_0xfedc('0x8')]===_0xfedc('0x9')&&_0x202840[_0xfedc('0xa')]===![];});_0x33623f=_0x33623f['concat'](_0x31a58c);}return _0x33623f;}function getFirstInterface(){var _0x124ad8=_[_0xfedc('0xb')](getInterfaces());return{'macAddress':_0x124ad8&&_0x124ad8[_0xfedc('0xc')]?_0x124ad8[_0xfedc('0xc')]:_0xfedc('0xd'),'ipAddress':_0x124ad8&&_0x124ad8[_0xfedc('0xe')]?_0x124ad8[_0xfedc('0xe')]:'127.0.0.1'};}exports[_0xfedc('0xf')]=getFirstInterface;function getCPUhash(){var _0x18b6e2=_[_0xfedc('0x6')](os[_0xfedc('0x10')]()[_0xfedc('0x11')](function(_0x599f54){return _0x599f54[_0xfedc('0x12')];}))[_0xfedc('0x13')](':');return crypto[_0xfedc('0x14')](_0xfedc('0x15'))['update'](_0x18b6e2)[_0xfedc('0x16')](_0xfedc('0x17'));}exports[_0xfedc('0x18')]=function(){var _0xb7c0c0=os[_0xfedc('0x19')]();var _0x4ce2d4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4ce2d4[_0xfedc('0x1a')](config[_0xfedc('0x1b')])){return config[_0xfedc('0x1b')];}else if(_0xb7c0c0===_0xfedc('0x1c')){return exec(_0xfedc('0x1d'),{'encoding':_0xfedc('0x1e')})[_0xfedc('0x1f')]('\x0d\x0a','');}else{var _0x4e1ac4=getFirstInterface();var _0x2dabc4=getCPUhash();var _0x183b42=_0x2dabc4+'|'+os['hostname']()+'|'+_0x4e1ac4['macAddress']+'|'+_0x4e1ac4[_0xfedc('0x20')];var _0x537a52=crypto[_0xfedc('0x14')](_0xfedc('0x15'))[_0xfedc('0x21')](_0x183b42)[_0xfedc('0x16')](_0xfedc('0x17'));return _0x537a52[_0xfedc('0x22')](0x0,0x8)+'-'+_0x537a52['substring'](0x8,0xc)+'-'+_0x537a52[_0xfedc('0x22')](0xc,0x10)+'-'+_0x537a52[_0xfedc('0x22')](0x10,0x14)+'-'+_0x537a52[_0xfedc('0x22')](0x14);}}; \ No newline at end of file +var _0x5096=['cpus','map','model','join','createHash','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','../environment','orderBy','keys','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x56dd58,_0xb1287d){var _0x103e75=function(_0x369507){while(--_0x369507){_0x56dd58['push'](_0x56dd58['shift']());}};_0x103e75(++_0xb1287d);}(_0x5096,0x96));var _0x6509=function(_0x407654,_0x275ae3){_0x407654=_0x407654-0x0;var _0x521dbd=_0x5096[_0x407654];return _0x521dbd;};'use strict';var _=require(_0x6509('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6509('0x1'));var exec=require(_0x6509('0x2'))['execSync'];var config=require(_0x6509('0x3'));function getInterfaces(){var _0xf7689f=[];var _0x1d8627=os['networkInterfaces']();var _0x35f521=_[_0x6509('0x4')](_[_0x6509('0x5')](_0x1d8627));for(var _0x2e5271=0x0;_0x2e5271<_0x35f521['length'];_0x2e5271++){var _0xb9a4b6=_0x1d8627[_0x35f521[_0x2e5271]]['filter'](function(_0x2547ba){return _0x2547ba[_0x6509('0x6')]===_0x6509('0x7')&&_0x2547ba[_0x6509('0x8')]===![];});_0xf7689f=_0xf7689f[_0x6509('0x9')](_0xb9a4b6);}return _0xf7689f;}function getFirstInterface(){var _0x21ee18=_[_0x6509('0xa')](getInterfaces());return{'macAddress':_0x21ee18&&_0x21ee18[_0x6509('0xb')]?_0x21ee18['mac']:_0x6509('0xc'),'ipAddress':_0x21ee18&&_0x21ee18[_0x6509('0xd')]?_0x21ee18['address']:_0x6509('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x593731=_['orderBy'](os[_0x6509('0xf')]()[_0x6509('0x10')](function(_0x42d59d){return _0x42d59d[_0x6509('0x11')];}))[_0x6509('0x12')](':');return crypto[_0x6509('0x13')]('md5')[_0x6509('0x14')](_0x593731)[_0x6509('0x15')](_0x6509('0x16'));}exports['getUuid']=function(){var _0x1df2a6=os[_0x6509('0x17')]();var _0x51e325=/[0-9a-f-]{36}/;if(config[_0x6509('0x18')]&&_0x51e325[_0x6509('0x19')](config['licenseToken'])){return config[_0x6509('0x18')];}else if(_0x1df2a6===_0x6509('0x1a')){return exec(_0x6509('0x1b'),{'encoding':_0x6509('0x1c')})[_0x6509('0x1d')]('\x0d\x0a','');}else{var _0x4d88b1=getFirstInterface();var _0x3a7564=getCPUhash();var _0x15c666=_0x3a7564+'|'+os['hostname']()+'|'+_0x4d88b1[_0x6509('0x1e')]+'|'+_0x4d88b1[_0x6509('0x1f')];var _0x1f4f6b=crypto['createHash']('md5')[_0x6509('0x14')](_0x15c666)[_0x6509('0x15')](_0x6509('0x16'));return _0x1f4f6b[_0x6509('0x20')](0x0,0x8)+'-'+_0x1f4f6b[_0x6509('0x20')](0x8,0xc)+'-'+_0x1f4f6b[_0x6509('0x20')](0xc,0x10)+'-'+_0x1f4f6b[_0x6509('0x20')](0x10,0x14)+'-'+_0x1f4f6b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8fdc7ab..0cdc2d6 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 _0xdeb8=['DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','error','message','finally','getUuid','License','findOrCreate','spread','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','diff','decryptString','days'];(function(_0xa923d,_0x1c2be7){var _0x3a88f6=function(_0x4454bf){while(--_0x4454bf){_0xa923d['push'](_0xa923d['shift']());}};_0x3a88f6(++_0x1c2be7);}(_0xdeb8,0xae));var _0x8deb=function(_0x260547,_0x3e9e0d){_0x260547=_0x260547-0x0;var _0x125b0a=_0xdeb8[_0x260547];return _0x125b0a;};'use strict';var util=require('util');var moment=require(_0x8deb('0x0'));var rp=require(_0x8deb('0x1'));var BPromise=require(_0x8deb('0x2'));var pkginfo=require(_0x8deb('0x3'))(module,'version');var db=require(_0x8deb('0x4'))['db'];var encryptor=require(_0x8deb('0x5'));var hardware=require(_0x8deb('0x6'));var logger=require('../logger')(_0x8deb('0x7'));var HOST=_0x8deb('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4fb1fe){return new BPromise(function(_0x57d243,_0x350665){var _0x494e67=util[_0x8deb('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x4fb1fe,module[_0x8deb('0xa')][_0x8deb('0xb')]);if(oldToken){_0x494e67=util[_0x8deb('0x9')](_0x8deb('0xc'),HOST,_0x4fb1fe,module[_0x8deb('0xa')][_0x8deb('0xb')],oldToken);}var _0x3182d7={'uri':_0x494e67,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3182d7)[_0x8deb('0xd')](function(_0x749086){_0x57d243(_0x749086);})['catch'](function(_0x1e2865){_0x350665(_0x1e2865);});});}function manageLicense(_0x40ce78,_0x5ddcec){var _0x10acf9=_0x5ddcec[_0x8deb('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x10acf9[_0x8deb('0xf')]!==_0x40ce78&&!_0x10acf9['data2']){oldToken=_0x10acf9[_0x8deb('0xf')];}httpRequest(_0x40ce78)['then'](function(_0x3de5b5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3de5b5[_0x8deb('0x10')]){isOldTokenSent=![];if(!_0x10acf9[_0x8deb('0x7')]&&_0x10acf9[_0x8deb('0x7')]!=_0x3de5b5[_0x8deb('0x7')]||_0x10acf9[_0x8deb('0x7')]&&_0x10acf9[_0x8deb('0x11')]){logger[_0x8deb('0x12')](_0x8deb('0x13'));}if(_0x10acf9[_0x8deb('0x7')]&&!_0x10acf9[_0x8deb('0x11')]&&_0x10acf9[_0x8deb('0x7')]!=_0x3de5b5['license']){logger[_0x8deb('0x12')](_0x8deb('0x14'));}if(_0x10acf9['license']&&!_0x10acf9[_0x8deb('0x11')]&&_0x10acf9['license']==_0x3de5b5[_0x8deb('0x7')]){return _0x5ddcec;}return _0x5ddcec[_0x8deb('0x15')]({'data1':_0x40ce78,'data2':null,'license':_0x3de5b5[_0x8deb('0x7')]});}else{if(_0x3de5b5[_0x8deb('0x7')]||_0x10acf9[_0x8deb('0x7')]){if(!_0x10acf9['data2']){if(_0x10acf9[_0x8deb('0xf')]==_0x40ce78){GRAY_PERIOD_REASON=_0x8deb('0x16');logger[_0x8deb('0x12')](_0x8deb('0x17'));}else{GRAY_PERIOD_REASON=_0x8deb('0x18');logger[_0x8deb('0x12')](_0x8deb('0x19'),_0x10acf9[_0x8deb('0xf')],_0x40ce78);}logger['info'](_0x8deb('0x1a'),GRAY_PERIOD_REASON[_0x8deb('0x1b')](),moment()[_0x8deb('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x5ddcec[_0x8deb('0x15')]({'data2':encryptor['encryptString'](moment()[_0x8deb('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x8deb('0x1c')](encryptor[_0x8deb('0x1d')](_0x10acf9[_0x8deb('0x11')]),_0x8deb('0x1e'))>DAYS){logger[_0x8deb('0x12')](_0x8deb('0x1f'),moment()[_0x8deb('0x9')](_0x8deb('0x20')));isOldTokenSent=![];return _0x5ddcec[_0x8deb('0x15')]({'data1':_0x40ce78,'data2':null,'license':null});}}}else{if(_0x10acf9['data1']!=_0x40ce78){logger[_0x8deb('0x12')](_0x8deb('0x19'),_0x10acf9[_0x8deb('0xf')],_0x40ce78);return _0x5ddcec[_0x8deb('0x15')]({'data1':_0x40ce78,'data2':null,'license':null});}}}return _0x5ddcec;})[_0x8deb('0xd')](function(_0x5e735e){_0x5ddcec=_0x5e735e;})[_0x8deb('0x21')](function(_0x4d1883){logger[_0x8deb('0x22')](_0x4d1883[_0x8deb('0x23')]);})[_0x8deb('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x8deb('0x25')](),_0x5ddcec);},TIME);});}function defaultLicense(){var _0x139bae=hardware[_0x8deb('0x25')]();if(_0x139bae){return db[_0x8deb('0x26')][_0x8deb('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x139bae}})[_0x8deb('0x28')](function(_0xa283bb,_0x5bb037){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x139bae);manageLicense(_0x139bae,_0xa283bb);})['catch'](function(_0x4cb253){logger[_0x8deb('0x22')](_0x4cb253[_0x8deb('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x742a=['default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x59c2bb,_0xec103a){var _0x33cf88=function(_0x17f547){while(--_0x17f547){_0x59c2bb['push'](_0x59c2bb['shift']());}};_0x33cf88(++_0xec103a);}(_0x742a,0x19b));var _0xa742=function(_0x16c2e0,_0x3dc335){_0x16c2e0=_0x16c2e0-0x0;var _0x49b690=_0x742a[_0x16c2e0];return _0x49b690;};'use strict';var util=require(_0xa742('0x0'));var moment=require(_0xa742('0x1'));var rp=require(_0xa742('0x2'));var BPromise=require(_0xa742('0x3'));var pkginfo=require(_0xa742('0x4'))(module,_0xa742('0x5'));var db=require(_0xa742('0x6'))['db'];var encryptor=require(_0xa742('0x7'));var hardware=require(_0xa742('0x8'));var logger=require(_0xa742('0x9'))(_0xa742('0xa'));var HOST=_0xa742('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x45ce24){return new BPromise(function(_0x20afa7,_0x328bb0){var _0x298e33=util[_0xa742('0xc')](_0xa742('0xd'),HOST,_0x45ce24,module[_0xa742('0xe')][_0xa742('0x5')]);if(oldToken){_0x298e33=util[_0xa742('0xc')](_0xa742('0xf'),HOST,_0x45ce24,module[_0xa742('0xe')]['version'],oldToken);}var _0x27ab98={'uri':_0x298e33,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x27ab98)[_0xa742('0x10')](function(_0xc89b7){_0x20afa7(_0xc89b7);})[_0xa742('0x11')](function(_0x1de045){_0x328bb0(_0x1de045);});});}function manageLicense(_0x593105,_0x2a414e){var _0x81c828=_0x2a414e[_0xa742('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x81c828['data1']!==_0x593105&&!_0x81c828['data2']){oldToken=_0x81c828['data1'];}httpRequest(_0x593105)[_0xa742('0x10')](function(_0x1c2736){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1c2736['active']){isOldTokenSent=![];if(!_0x81c828['license']&&_0x81c828[_0xa742('0xa')]!=_0x1c2736[_0xa742('0xa')]||_0x81c828['license']&&_0x81c828[_0xa742('0x13')]){logger[_0xa742('0x14')](_0xa742('0x15'));}if(_0x81c828[_0xa742('0xa')]&&!_0x81c828['data2']&&_0x81c828['license']!=_0x1c2736[_0xa742('0xa')]){logger[_0xa742('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x81c828[_0xa742('0xa')]&&!_0x81c828['data2']&&_0x81c828[_0xa742('0xa')]==_0x1c2736[_0xa742('0xa')]){return _0x2a414e;}return _0x2a414e[_0xa742('0x16')]({'data1':_0x593105,'data2':null,'license':_0x1c2736['license']});}else{if(_0x1c2736[_0xa742('0xa')]||_0x81c828[_0xa742('0xa')]){if(!_0x81c828[_0xa742('0x13')]){if(_0x81c828[_0xa742('0x17')]==_0x593105){GRAY_PERIOD_REASON='Disabled';logger[_0xa742('0x14')](_0xa742('0x18'));}else{GRAY_PERIOD_REASON=_0xa742('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x81c828[_0xa742('0x17')],_0x593105);}logger[_0xa742('0x14')](_0xa742('0x1a'),GRAY_PERIOD_REASON[_0xa742('0x1b')](),moment()[_0xa742('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x2a414e[_0xa742('0x16')]({'data2':encryptor['encryptString'](moment()['format'](_0xa742('0x1c')))});}else{if(moment()[_0xa742('0x1d')](encryptor[_0xa742('0x1e')](_0x81c828[_0xa742('0x13')]),_0xa742('0x1f'))>DAYS){logger[_0xa742('0x14')](_0xa742('0x20'),moment()[_0xa742('0xc')](_0xa742('0x1c')));isOldTokenSent=![];return _0x2a414e[_0xa742('0x16')]({'data1':_0x593105,'data2':null,'license':null});}}}else{if(_0x81c828[_0xa742('0x17')]!=_0x593105){logger[_0xa742('0x14')](_0xa742('0x21'),_0x81c828[_0xa742('0x17')],_0x593105);return _0x2a414e['update']({'data1':_0x593105,'data2':null,'license':null});}}}return _0x2a414e;})[_0xa742('0x10')](function(_0x317fde){_0x2a414e=_0x317fde;})['catch'](function(_0x3844df){logger[_0xa742('0x22')](_0x3844df['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xa742('0x23')](),_0x2a414e);},TIME);});}function defaultLicense(){var _0x36cce5=hardware['getUuid']();if(_0x36cce5){return db[_0xa742('0x24')][_0xa742('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x36cce5}})[_0xa742('0x26')](function(_0x4da242,_0x5a9543){logger[_0xa742('0x14')](_0xa742('0x27'),_0x36cce5);manageLicense(_0x36cce5,_0x4da242);})[_0xa742('0x11')](function(_0x5f3c47){logger[_0xa742('0x22')](_0x5f3c47['message']);});}}exports[_0xa742('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8cf7695..bb5aae3 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 _0xdb02=['uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','getUuid','Breaking\x20license','find','defaults','then','catch'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xdb02,0x84));var _0x2db0=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0xdb02[_0x78db5e];return _0x250b88;};'use strict';var util=require(_0x2db0('0x0'));var _=require(_0x2db0('0x1'));var moment=require(_0x2db0('0x2'));var BPromise=require(_0x2db0('0x3'));var hardware=require('./hardware');var encryptor=require(_0x2db0('0x4'));var db=require(_0x2db0('0x5'))['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':'Demo\x20license','machineUuid':hardware[_0x2db0('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2db0('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x29ec8c){return new BPromise(function(_0x1930c8,_0x8aae6f){return db['License'][_0x2db0('0x8')](_[_0x2db0('0x9')](_0x29ec8c,{'raw':!![],'where':{'id':0x1}}))[_0x2db0('0xa')](function(_0xaa5740){return checkLicense(_0xaa5740,null);})[_0x2db0('0xa')](function(_0x316f9b){_0x1930c8(_0x316f9b);return;})[_0x2db0('0xb')](function(_0x4bcc34){_0x8aae6f(_0x4bcc34);});});}function checkLicense(_0x532147,_0x1dfb19){if(!_0x532147){demoLicense[_0x2db0('0xc')]=_0x532147[_0x2db0('0xd')];return demoLicense;}try{var _0x22eee8=_0x1dfb19||_0x532147[_0x2db0('0xe')];if(_[_0x2db0('0xf')](_0x22eee8)){throw new Error(_0x2db0('0x10'));}var _0x2ecfe7=_0x532147['data1'];var _0x3198d1=_0x532147[_0x2db0('0x11')];var _0x5e1873=_0x2ecfe7[_0x2db0('0x12')]('-')[0x4];var _0x2d8843=_0x2ecfe7[_0x2db0('0x12')]('-')[0x0];var _0x9933a0=encryptor[_0x2db0('0x13')](_0x22eee8,util[_0x2db0('0x14')]('%s:%s:%s',_0x5e1873,_0x2ecfe7,_0x2d8843));var _0x1ca443=JSON[_0x2db0('0x15')](_0x9933a0);_0x1ca443[_0x2db0('0x16')]=![];_0x1ca443[_0x2db0('0xc')]=_0x2ecfe7;_0x1ca443[_0x2db0('0x17')]=hardware[_0x2db0('0x6')]();if(_0x3198d1){var _0x442272=encryptor[_0x2db0('0x13')](_0x3198d1);_0x1ca443[_0x2db0('0x18')]=_0x442272;_0x1ca443[_0x2db0('0x19')]=moment(_0x442272)[_0x2db0('0x1a')](0x7,_0x2db0('0x1b'))['format']();_0x1ca443[_0x2db0('0x1c')]=_0x1ca443[_0x2db0('0xc')]!=_0x1ca443[_0x2db0('0x17')]?_0x2db0('0x1d'):'disabled';}return _0x1ca443;}catch(_0x356ba0){breakingLicense[_0x2db0('0xc')]=_0x532147['data1'];breakingLicense[_0x2db0('0x1e')]=_0x356ba0[_0x2db0('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e239f,_0xbd5af0){getLicense()[_0x2db0('0xa')](function(_0x3d1c42){return db[_0x2db0('0x1f')][_0x2db0('0x20')]({'attributes':[_0x2db0('0x21'),[db[_0x2db0('0x22')]['fn'](_0x2db0('0x23'),db[_0x2db0('0x22')][_0x2db0('0x24')](_0x2db0('0x21'))),_0x2db0('0x25')]],'group':_0x2db0('0x21'),'where':{'role':{'$or':[_0x2db0('0x26'),_0x2db0('0x27'),_0x2db0('0x28')]}},'raw':!![]})[_0x2db0('0xa')](function(_0x17279b){var _0x4dc577={'user':_0x3d1c42[_0x2db0('0x29')]||0x0,'telephone':_0x3d1c42[_0x2db0('0x2a')]||0x0};_0x17279b[_0x2db0('0x2b')](function(_0x17e571){var _0xb92975=_0x17e571['role']==='admin'?_0x2db0('0x27'):_0x17e571[_0x2db0('0x21')];_0x4dc577[_0xb92975]-=_0x17e571[_0x2db0('0x25')];if(_0x4dc577[_0xb92975]<0x0)_0x4dc577[_0xb92975]=0x0;});_0x1e239f(_0x4dc577);return;});})['catch'](function(_0x5a224c){_0xbd5af0(_0x5a224c);});});}function checkUserLimits(_0x4df657){return new BPromise(function(_0x17c1bb,_0x587b15){getLimits()[_0x2db0('0xa')](function(_0x560655){var _0x1659c1=_[_0x2db0('0x2c')](_[_0x2db0('0x2d')](_0x4df657,_0x2db0('0x21')),['admin',_0x2db0('0x27'),_0x2db0('0x28')]);var _0x185799=(_0x1659c1[_0x2db0('0x26')]||0x0)+(_0x1659c1[_0x2db0('0x27')]||0x0);var _0x1a8b82=_0x1659c1[_0x2db0('0x28')]||0x0;if(_0x185799>_0x560655[_0x2db0('0x27')])return _0x587b15(_0x2db0('0x2e'));if(_0x1a8b82>_0x560655['telephone'])return _0x587b15('License\x20limit\x20reached\x20for\x20telephones');return _0x17c1bb();})['catch'](function(_0x4a56cc){_0x587b15(_0x4a56cc);});});}module[_0x2db0('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa209=['%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','telephone','telephones','forEach','user','count','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','format'];(function(_0x5a7733,_0x3e8240){var _0xd72306=function(_0x233f31){while(--_0x233f31){_0x5a7733['push'](_0x5a7733['shift']());}};_0xd72306(++_0x3e8240);}(_0xa209,0xab));var _0x9a20=function(_0x2b981e,_0x3a9c55){_0x2b981e=_0x2b981e-0x0;var _0x4a80a2=_0xa209[_0x2b981e];return _0x4a80a2;};'use strict';var util=require(_0x9a20('0x0'));var _=require(_0x9a20('0x1'));var moment=require(_0x9a20('0x2'));var BPromise=require(_0x9a20('0x3'));var hardware=require(_0x9a20('0x4'));var encryptor=require(_0x9a20('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a20('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9a20('0x7'),'machineUuid':hardware[_0x9a20('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9a20('0x9'),'machineUuid':hardware[_0x9a20('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x20bf39){return new BPromise(function(_0x5b47ea,_0x3d6c8a){return db[_0x9a20('0xa')][_0x9a20('0xb')](_[_0x9a20('0xc')](_0x20bf39,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2063dc){return checkLicense(_0x2063dc,null);})[_0x9a20('0xd')](function(_0x4bc6c9){_0x5b47ea(_0x4bc6c9);return;})[_0x9a20('0xe')](function(_0x424291){_0x3d6c8a(_0x424291);});});}function checkLicense(_0x32963d,_0x4a0bc3){if(!_0x32963d){demoLicense['uuid']=_0x32963d[_0x9a20('0xf')];return demoLicense;}try{var _0x395a1f=_0x4a0bc3||_0x32963d[_0x9a20('0x10')];if(_['isEmpty'](_0x395a1f)){throw new Error(_0x9a20('0x11'));}var _0x1782cb=_0x32963d[_0x9a20('0xf')];var _0x1eda27=_0x32963d[_0x9a20('0x12')];var _0x351705=_0x1782cb[_0x9a20('0x13')]('-')[0x4];var _0x37b552=_0x1782cb[_0x9a20('0x13')]('-')[0x0];var _0x415c8b=encryptor['decryptString'](_0x395a1f,util[_0x9a20('0x14')](_0x9a20('0x15'),_0x351705,_0x1782cb,_0x37b552));var _0x3aa00c=JSON[_0x9a20('0x16')](_0x415c8b);_0x3aa00c[_0x9a20('0x17')]=![];_0x3aa00c[_0x9a20('0x18')]=_0x1782cb;_0x3aa00c[_0x9a20('0x19')]=hardware['getUuid']();if(_0x1eda27){var _0x49035e=encryptor[_0x9a20('0x1a')](_0x1eda27);_0x3aa00c['gray']=_0x49035e;_0x3aa00c[_0x9a20('0x1b')]=moment(_0x49035e)[_0x9a20('0x1c')](0x7,_0x9a20('0x1d'))[_0x9a20('0x14')]();_0x3aa00c['grayReason']=_0x3aa00c['uuid']!=_0x3aa00c[_0x9a20('0x19')]?_0x9a20('0x1e'):_0x9a20('0x1f');}return _0x3aa00c;}catch(_0x3371b9){breakingLicense[_0x9a20('0x18')]=_0x32963d[_0x9a20('0xf')];breakingLicense['message']=_0x3371b9[_0x9a20('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3cc189,_0x3af116){getLicense()[_0x9a20('0xd')](function(_0x228710){return db[_0x9a20('0x21')][_0x9a20('0x22')]({'attributes':[_0x9a20('0x23'),[db[_0x9a20('0x24')]['fn'](_0x9a20('0x25'),db[_0x9a20('0x24')][_0x9a20('0x26')](_0x9a20('0x23'))),'count']],'group':_0x9a20('0x23'),'where':{'role':{'$or':[_0x9a20('0x27'),'user',_0x9a20('0x28')]}},'raw':!![]})['then'](function(_0x63cfc5){var _0x511da9={'user':_0x228710['users']||0x0,'telephone':_0x228710[_0x9a20('0x29')]||0x0};_0x63cfc5[_0x9a20('0x2a')](function(_0x5bf646){var _0x30e343=_0x5bf646[_0x9a20('0x23')]==='admin'?_0x9a20('0x2b'):_0x5bf646['role'];_0x511da9[_0x30e343]-=_0x5bf646[_0x9a20('0x2c')];if(_0x511da9[_0x30e343]<0x0)_0x511da9[_0x30e343]=0x0;});_0x3cc189(_0x511da9);return;});})[_0x9a20('0xe')](function(_0x5c4574){_0x3af116(_0x5c4574);});});}function checkUserLimits(_0x13f0a){return new BPromise(function(_0x5b5fdd,_0xeb6a67){getLimits()['then'](function(_0x4b8b0e){var _0x4e9418=_['pick'](_['countBy'](_0x13f0a,'role'),[_0x9a20('0x27'),'user',_0x9a20('0x28')]);var _0x7244e4=(_0x4e9418['admin']||0x0)+(_0x4e9418[_0x9a20('0x2b')]||0x0);var _0x3cec25=_0x4e9418[_0x9a20('0x28')]||0x0;if(_0x7244e4>_0x4b8b0e[_0x9a20('0x2b')])return _0xeb6a67(_0x9a20('0x2d'));if(_0x3cec25>_0x4b8b0e[_0x9a20('0x28')])return _0xeb6a67(_0x9a20('0x2e'));return _0x5b5fdd();})[_0x9a20('0xe')](function(_0x2abb53){_0xeb6a67(_0x2abb53);});});}module[_0x9a20('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index df053c6..eb0eb86 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 _0xed3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xed3c,0x1a6));var _0xced3=function(_0x281305,_0x2998d6){_0x281305=_0x281305-0x0;var _0x56ffbe=_0xed3c[_0x281305];return _0x56ffbe;};'use strict';module[_0xced3('0x0')]={'DOMAIN':_0xced3('0x1'),'SESSION_SECRET':_0xced3('0x2'),'GOOGLE_ID':_0xced3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0598=['http://localhost:9000','app-id','exports'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x0598,0x92));var _0x8059=function(_0x2b0f2d,_0x51342d){_0x2b0f2d=_0x2b0f2d-0x0;var _0x38d24f=_0x0598[_0x2b0f2d];return _0x38d24f;};'use strict';module[_0x8059('0x0')]={'DOMAIN':_0x8059('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8059('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 632a799..72d1211 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe395=['fileLogger','exports'];(function(_0x2b6b89,_0x172ec0){var _0x5aa6af=function(_0x19cd5e){while(--_0x19cd5e){_0x2b6b89['push'](_0x2b6b89['shift']());}};_0x5aa6af(++_0x172ec0);}(_0xe395,0x1a0));var _0x5e39=function(_0x207f1d,_0x483f0e){_0x207f1d=_0x207f1d-0x0;var _0x18ddc4=_0xe395[_0x207f1d];return _0x18ddc4;};'use strict';var fileLogger=require('../utils/loggers')[_0x5e39('0x0')];module[_0x5e39('0x1')]=fileLogger; \ No newline at end of file +var _0xcaef=['fileLogger','exports'];(function(_0x156367,_0x5d745f){var _0x2efd96=function(_0x2d9805){while(--_0x2d9805){_0x156367['push'](_0x156367['shift']());}};_0x2efd96(++_0x5d745f);}(_0xcaef,0x94));var _0xfcae=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xcaef[_0x32b542];return _0x554d54;};'use strict';var fileLogger=require('../utils/loggers')[_0xfcae('0x0')];module[_0xfcae('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e91fd46..7e5bb03 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 _0xbe3a=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','ami','../../services/ami/index.js'];(function(_0x593de6,_0x569391){var _0x455fa2=function(_0x591ad3){while(--_0x591ad3){_0x593de6['push'](_0x593de6['shift']());}};_0x455fa2(++_0x569391);}(_0xbe3a,0x121));var _0xabe3=function(_0x251ff3,_0x77c3a1){_0x251ff3=_0x251ff3-0x0;var _0x102fc3=_0xbe3a[_0x251ff3];return _0x102fc3;};'use strict';var path=require(_0xabe3('0x0'));var os=require('os');var config={'apps':[{'name':_0xabe3('0x1'),'script':path[_0xabe3('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xabe3('0x3'),'script':path['join'](__dirname,_0xabe3('0x4'))},{'name':_0xabe3('0x5'),'script':path['join'](__dirname,_0xabe3('0x6'))},{'name':_0xabe3('0x7'),'script':path[_0xabe3('0x2')](__dirname,_0xabe3('0x8'))},{'name':_0xabe3('0x9'),'script':path[_0xabe3('0x2')](__dirname,_0xabe3('0xa'))},{'name':_0xabe3('0xb'),'script':path['join'](__dirname,_0xabe3('0xc'))}]};module[_0xabe3('0xd')]=config; \ No newline at end of file +var _0x16cb=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x4170d8,_0x49f2b5){var _0x7a7276=function(_0x1976f4){while(--_0x1976f4){_0x4170d8['push'](_0x4170d8['shift']());}};_0x7a7276(++_0x49f2b5);}(_0x16cb,0x163));var _0xb16c=function(_0x1d0ce7,_0x5938f1){_0x1d0ce7=_0x1d0ce7-0x0;var _0x27d94d=_0x16cb[_0x1d0ce7];return _0x27d94d;};'use strict';var path=require(_0xb16c('0x0'));var os=require('os');var config={'apps':[{'name':_0xb16c('0x1'),'script':path[_0xb16c('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x3'))},{'name':_0xb16c('0x4'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x5'))},{'name':_0xb16c('0x6'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x7'))},{'name':'routing','script':path['join'](__dirname,_0xb16c('0x8'))},{'name':_0xb16c('0x9'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1ba9dac..ce2df69 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 _0x8b34=['delete','dump','saved','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe'];(function(_0x3f658a,_0x3c051f){var _0x19a6dc=function(_0x48c24e){while(--_0x48c24e){_0x3f658a['push'](_0x3f658a['shift']());}};_0x19a6dc(++_0x3c051f);}(_0x8b34,0xd3));var _0x48b3=function(_0x33bc14,_0x3834d8){_0x33bc14=_0x33bc14-0x0;var _0x3f58ad=_0x8b34[_0x33bc14];return _0x3f58ad;};'use strict';var pm2=require('pm2');var BPromise=require(_0x48b3('0x0'));var config=require(_0x48b3('0x1'));function connect(){return new BPromise(function(_0x3d6339,_0x40f63f){return pm2[_0x48b3('0x2')](function(_0x1c66b2){if(_0x1c66b2){return _0x40f63f(_0x1c66b2);}return _0x3d6339('connected');});});};exports[_0x48b3('0x3')]=function(_0x18f2c2){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x3f6382,_0x4e76ac){return pm2['start'](_0x18f2c2,function(_0x58b3a1,_0x3ab693){if(_0x58b3a1){return _0x4e76ac(_0x58b3a1);}pm2['disconnect']();return _0x3f6382(_0x3ab693);});});});};exports['stop']=function(_0x1b569e){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x518f14,_0x22701c){return pm2[_0x48b3('0x5')](_0x1b569e,function(_0x129f03,_0x458749){if(_0x129f03){return _0x22701c(_0x129f03);}pm2[_0x48b3('0x6')]();return _0x518f14(_0x458749);});});});};exports[_0x48b3('0x7')]=function(_0x145c8c){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x1b23c3,_0x46967d){return pm2[_0x48b3('0x7')](_0x145c8c,function(_0xc1687e,_0x4f703a){if(_0xc1687e){return _0x46967d(_0xc1687e);}pm2[_0x48b3('0x6')]();return _0x1b23c3(_0x4f703a);});});});};exports[_0x48b3('0x8')]=function(){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x265f03,_0x9643a5){return pm2[_0x48b3('0x8')](function(_0x55620f,_0x1f8a27){if(_0x55620f){return _0x9643a5(_0x55620f);}pm2[_0x48b3('0x6')]();return _0x265f03(_0x1f8a27);});});});};exports[_0x48b3('0x9')]=function(_0x3bdd12){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x2fe260,_0x5ad405){return pm2[_0x48b3('0x9')](_0x3bdd12,function(_0x1724c8,_0x3d04bc){if(_0x1724c8){return _0x5ad405(_0x1724c8);}pm2['disconnect']();return _0x2fe260(_0x3d04bc);});});});};exports[_0x48b3('0xa')]=function(_0x30de36){return connect()[_0x48b3('0x4')](function(){return new BPromise(function(_0x445aa3,_0x122c5d){return pm2[_0x48b3('0xa')](_0x30de36,function(_0x8ae9c,_0x5ef0f1){if(_0x8ae9c){return _0x122c5d(_0x8ae9c);}pm2[_0x48b3('0x6')]();return _0x445aa3(_0x5ef0f1);});});});};exports[_0x48b3('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5aa76d,_0x4c53f1){return pm2[_0x48b3('0xb')](function(_0x815976){if(_0x815976){return _0x4c53f1(_0x815976);}return _0x5aa76d(_0x48b3('0xc'));});});});}; \ No newline at end of file +var _0x3b48=['dump','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x3b48,0x15f));var _0x83b4=function(_0x4ab8d2,_0x2446b5){_0x4ab8d2=_0x4ab8d2-0x0;var _0x1bcdca=_0x3b48[_0x4ab8d2];return _0x1bcdca;};'use strict';var pm2=require(_0x83b4('0x0'));var BPromise=require(_0x83b4('0x1'));var config=require(_0x83b4('0x2'));function connect(){return new BPromise(function(_0x5d4d7b,_0x36c67a){return pm2[_0x83b4('0x3')](function(_0x59ba29){if(_0x59ba29){return _0x36c67a(_0x59ba29);}return _0x5d4d7b(_0x83b4('0x4'));});});};exports['start']=function(_0x3e98f0){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x2d8a60,_0x3b91e0){return pm2[_0x83b4('0x6')](_0x3e98f0,function(_0x5ecd3e,_0x48537d){if(_0x5ecd3e){return _0x3b91e0(_0x5ecd3e);}pm2[_0x83b4('0x7')]();return _0x2d8a60(_0x48537d);});});});};exports['stop']=function(_0x2f5bbf){return connect()['then'](function(){return new BPromise(function(_0xab19ef,_0x3feb09){return pm2[_0x83b4('0x8')](_0x2f5bbf,function(_0x310029,_0x361bfe){if(_0x310029){return _0x3feb09(_0x310029);}pm2[_0x83b4('0x7')]();return _0xab19ef(_0x361bfe);});});});};exports[_0x83b4('0x9')]=function(_0x3ab91f){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x2e5bb8,_0x286ca2){return pm2[_0x83b4('0x9')](_0x3ab91f,function(_0xd751b9,_0x4ccca8){if(_0xd751b9){return _0x286ca2(_0xd751b9);}pm2['disconnect']();return _0x2e5bb8(_0x4ccca8);});});});};exports[_0x83b4('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46d101,_0xea3c83){return pm2[_0x83b4('0xa')](function(_0x2b59f,_0xe713e6){if(_0x2b59f){return _0xea3c83(_0x2b59f);}pm2[_0x83b4('0x7')]();return _0x46d101(_0xe713e6);});});});};exports[_0x83b4('0xb')]=function(_0x8dc22e){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x1cf3eb,_0x38cc73){return pm2['describe'](_0x8dc22e,function(_0x4c5810,_0x358b53){if(_0x4c5810){return _0x38cc73(_0x4c5810);}pm2[_0x83b4('0x7')]();return _0x1cf3eb(_0x358b53);});});});};exports[_0x83b4('0xc')]=function(_0x229aee){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0xb45758,_0x34af81){return pm2[_0x83b4('0xc')](_0x229aee,function(_0x2fe4a7,_0x40eeec){if(_0x2fe4a7){return _0x34af81(_0x2fe4a7);}pm2[_0x83b4('0x7')]();return _0xb45758(_0x40eeec);});});});};exports[_0x83b4('0xd')]=function(){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0xd46322,_0x425134){return pm2['dump'](function(_0x35db15){if(_0x35db15){return _0x425134(_0x35db15);}return _0xd46322('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7f5d688..a27c987 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 _0x0703=['schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger'];(function(_0x49830b,_0x110f8c){var _0x62a9b6=function(_0x44760a){while(--_0x44760a){_0x49830b['push'](_0x49830b['shift']());}};_0x62a9b6(++_0x110f8c);}(_0x0703,0x186));var _0x3070=function(_0x2a1953,_0x1dd667){_0x2a1953=_0x2a1953-0x0;var _0x221af7=_0x0703[_0x2a1953];return _0x221af7;};'use strict';var _=require(_0x3070('0x0'));var moment=require(_0x3070('0x1'));var Redis=require(_0x3070('0x2'));var util=require(_0x3070('0x3'));var config=require('../../config/environment');var db=require(_0x3070('0x4'))['db'];var logger=require(_0x3070('0x5'))(_0x3070('0x6'));config[_0x3070('0x7')]=_[_0x3070('0x8')](config[_0x3070('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3070('0x9'))(new Redis(config[_0x3070('0x7')]));function closeInteractions(){var _0x19d85c=0x0;var _0x7063c0=[];return db[_0x3070('0xa')][_0x3070('0xb')]({'raw':!![],'attributes':['id',_0x3070('0xc')],'where':{'id':0x1}})[_0x3070('0xd')](function(_0x3a55e3){_0x19d85c=_0x3a55e3[_0x3070('0xc')];if(_0x19d85c){return db[_0x3070('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x3070('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3070('0x10')](_0x3a55e3[_0x3070('0xc')],_0x3070('0x11'))}}});}else{return[];}})[_0x3070('0xd')](function(_0x1d8993){if(_0x1d8993&&_0x1d8993[_0x3070('0x12')]){_0x7063c0=_[_0x3070('0x13')](_0x1d8993||[],'id');logger[_0x3070('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x7063c0[_0x3070('0x15')]());return db[_0x3070('0xe')][_0x3070('0x16')]({'closeReason':_0x3070('0x17'),'disposition':_0x3070('0x18'),'closed':!![],'closedAt':moment()[_0x3070('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x7063c0}});}})[_0x3070('0xd')](function(){if(_0x7063c0&&_0x7063c0['length']){logger[_0x3070('0x14')](_0x3070('0x1a'),_0x7063c0[_0x3070('0x15')]());for(var _0x15f797=0x0;_0x15f797<_0x7063c0[_0x3070('0x12')];_0x15f797++){io['emit'](_0x3070('0x1b'),{'id':_0x7063c0[_0x15f797],'closed':!![]});}}})[_0x3070('0x1c')](function(_0x57724e){logger[_0x3070('0x1d')](_0x3070('0x1e'),_0x57724e?util[_0x3070('0x1f')](_0x57724e,{'showHidden':![],'depth':null}):'');});}exports[_0x3070('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbf9a=['chatTimeout','findAll','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find'];(function(_0x428132,_0x58ecc1){var _0x140eae=function(_0x333d61){while(--_0x333d61){_0x428132['push'](_0x428132['shift']());}};_0x140eae(++_0x58ecc1);}(_0xbf9a,0xbf));var _0xabf9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xbf9a[_0x2ff762];return _0x158b02;};'use strict';var _=require(_0xabf9('0x0'));var moment=require(_0xabf9('0x1'));var Redis=require(_0xabf9('0x2'));var util=require(_0xabf9('0x3'));var config=require(_0xabf9('0x4'));var db=require(_0xabf9('0x5'))['db'];var logger=require(_0xabf9('0x6'))(_0xabf9('0x7'));config[_0xabf9('0x8')]=_[_0xabf9('0x9')](config[_0xabf9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xabf9('0xa'))(new Redis(config[_0xabf9('0x8')]));function closeInteractions(){var _0x527ad4=0x0;var _0x3f6ed6=[];return db[_0xabf9('0xb')][_0xabf9('0xc')]({'raw':!![],'attributes':['id',_0xabf9('0xd')],'where':{'id':0x1}})['then'](function(_0x2c880e){_0x527ad4=_0x2c880e[_0xabf9('0xd')];if(_0x527ad4){return db['ChatInteraction'][_0xabf9('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2c880e['chatTimeout'],_0xabf9('0xf'))}}});}else{return[];}})[_0xabf9('0x10')](function(_0x29d307){if(_0x29d307&&_0x29d307['length']){_0x3f6ed6=_[_0xabf9('0x11')](_0x29d307||[],'id');logger[_0xabf9('0x12')](_0xabf9('0x13'),_0x3f6ed6[_0xabf9('0x14')]());return db[_0xabf9('0x15')][_0xabf9('0x16')]({'closeReason':_0xabf9('0x17'),'disposition':_0xabf9('0x18'),'closed':!![],'closedAt':moment()[_0xabf9('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3f6ed6}});}})[_0xabf9('0x10')](function(){if(_0x3f6ed6&&_0x3f6ed6['length']){logger['info'](_0xabf9('0x1a'),_0x3f6ed6[_0xabf9('0x14')]());for(var _0xde2e1c=0x0;_0xde2e1c<_0x3f6ed6[_0xabf9('0x1b')];_0xde2e1c++){io[_0xabf9('0x1c')]('chatInteraction:update',{'id':_0x3f6ed6[_0xde2e1c],'closed':!![]});}}})[_0xabf9('0x1d')](function(_0x3ab1f2){logger[_0xabf9('0x1e')](_0xabf9('0x1f'),_0x3ab1f2?util[_0xabf9('0x20')](_0x3ab1f2,{'showHidden':![],'depth':null}):'');});}exports[_0xabf9('0x21')]=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 a238428..ff07ccf 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 _0xf398=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf398,0x142));var _0x8f39=function(_0x2d18c1,_0x441187){_0x2d18c1=_0x2d18c1-0x0;var _0x5db21b=_0xf398[_0x2d18c1];return _0x5db21b;};'use strict';function start(){var _0x4dce90=require(_0x8f39('0x0'));return _0x4dce90[_0x8f39('0x1')]();}module[_0x8f39('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xec0a=['exports','startAllRefreshIntervals'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xec0a,0x169));var _0xaec0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xec0a[_0x1facfa];return _0x9ec701;};'use strict';function start(){var _0x430ddb=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x430ddb[_0xaec0('0x0')]();}module[_0xaec0('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 86769b0..2403395 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 _0x9da3=['run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','join','existsSync','status','message','attachments','text','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','index','my\x20id','resolve'];(function(_0x38fbb8,_0x3c4457){var _0x2cfc38=function(_0x319dd3){while(--_0x319dd3){_0x38fbb8['push'](_0x38fbb8['shift']());}};_0x2cfc38(++_0x3c4457);}(_0x9da3,0x1b6));var _0x39da=function(_0x205fda,_0x27a862){_0x205fda=_0x205fda-0x0;var _0x447b43=_0x9da3[_0x205fda];return _0x447b43;};'use strict';var fs=require('fs');var util=require(_0x39da('0x0'));var path=require(_0x39da('0x1'));var _=require(_0x39da('0x2'));var moment=require(_0x39da('0x3'));var CronJobManager=require(_0x39da('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x39da('0x5'));var logger=require(_0x39da('0x6'))(_0x39da('0x7'));var db=require(_0x39da('0x8'))['db'];var analyticCustomReportController=require(_0x39da('0x9'));var analyticDefaultReportController=require(_0x39da('0xa'));var client=jayson[_0x39da('0xb')][_0x39da('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xcf278c,_0x319a84){return function(){logger[_0x39da('0xd')](_0x39da('0xe'),_0xcf278c[_0x39da('0xf')]);var _0x5aed37=!![];var _0x5c9000=_0xcf278c[_0x39da('0x10')][_0x39da('0x11')]();var _0x53a1ab={'account':_0x5c9000,'message':{'from':util[_0x39da('0x12')](_0x39da('0x13'),_0xcf278c[_0x39da('0x10')][_0x39da('0x14')],_0xcf278c[_0x39da('0x10')]['email']||_0xcf278c[_0x39da('0x10')][_0x39da('0x15')]['user']),'to':_0xcf278c[_0x39da('0xf')],'cc':_0xcf278c['cc'],'bcc':_0xcf278c['bcc'],'subject':util[_0x39da('0x12')](_0x39da('0x16'),_0x319a84[_0x39da('0x14')],_0xcf278c[_0x39da('0x17')],_0xcf278c[_0x39da('0x18')])}};var _0x3b784c=path['join'](__dirname,_0x39da('0x19'));var _0x11283c=_0x319a84[_0x39da('0x1a')];var _0x1b037f=util[_0x39da('0x12')](_0x39da('0x1b'),path['basename'](_0x319a84[_0x39da('0x1a')],path[_0x39da('0x1c')](_0x319a84[_0x39da('0x1a')])),'zip');var _0x2fd188=path[_0x39da('0x1d')](_0x3b784c,_0x11283c);var _0x3e6e1f=path[_0x39da('0x1d')](_0x3b784c,_0x1b037f);if(fs[_0x39da('0x1e')](_0x2fd188)){_0x319a84[_0x39da('0x1f')]='Sent';_0x53a1ab[_0x39da('0x20')][_0x39da('0x21')]=[{'filename':_0x11283c,'path':_0x2fd188}];_0x53a1ab[_0x39da('0x20')][_0x39da('0x22')]=util[_0x39da('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x39da('0x23')](_0x319a84,null,0x2));}else if(fs['existsSync'](_0x3e6e1f)){_0x319a84['status']=_0x39da('0x24');_0x53a1ab['message'][_0x39da('0x21')]=[{'filename':_0x1b037f,'path':_0x3e6e1f}];}else{_0x53a1ab[_0x39da('0x20')]['text']=_0x39da('0x25');if(!_0xcf278c[_0x39da('0x26')]){_0x5aed37=![];logger[_0x39da('0xd')](_0x39da('0x27'));}}if(_0x5aed37){return client[_0x39da('0x28')](_0x39da('0x29'),_0x53a1ab)[_0x39da('0x2a')](function(_0x1eca65){if(_0x1eca65[_0x39da('0x2b')]){return logger[_0x39da('0x2b')](_0x39da('0x2c'),JSON[_0x39da('0x23')](_0x1eca65));}return logger[_0x39da('0xd')]('email\x20sent');})[_0x39da('0x2d')](function(_0x4bf620){return logger[_0x39da('0x2b')](_0x39da('0x2c'),JSON[_0x39da('0x23')](_0x4bf620));});}};}function handleError(){return function(_0x50e648){return logger['error'](JSON[_0x39da('0x23')](_0x50e648));};}function handleResult(_0x594b63){return function(_0x213b97){logger[_0x39da('0xd')](_0x39da('0x2e'),JSON[_0x39da('0x23')](_0x213b97));if(_0x594b63[_0x39da('0x10')]&&_0x594b63[_0x39da('0x10')]['Smtp']&&!_[_0x39da('0x2f')](_0x594b63[_0x39da('0xf')])){setTimeout(handleSendEmail(_0x594b63,_0x213b97),0x3c*0x3e8);}};}function handleJob(_0x173268){return function(){try{if(_[_0x39da('0x2f')](_0x173268[_0x39da('0x17')])){return logger[_0x39da('0xd')](_0x39da('0x30'));}if(_[_0x39da('0x2f')](_0x173268[_0x39da('0x18')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x292a33={'startDate':moment()[_0x39da('0x31')](_0x173268[_0x39da('0x17')],_0x173268[_0x39da('0x18')])[_0x39da('0x12')](_0x39da('0x32')),'endDate':moment()[_0x39da('0x12')](_0x39da('0x32')),'type':_0x39da('0x33'),'output':_0x173268['output'],'name':_0x173268[_0x39da('0x14')]};if(!_['isNil'](_0x173268['DefaultReportId'])){logger[_0x39da('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x173268['DefaultReportId']);return analyticDefaultReportController[_0x39da('0x34')]({'id':_0x173268[_0x39da('0x35')]},_0x292a33)[_0x39da('0x2a')](handleResult(_0x173268))['catch'](handleError());}if(!_[_0x39da('0x2f')](_0x173268[_0x39da('0x36')])){logger['info'](_0x39da('0x37'),_0x173268['CustomReportId']);return analyticCustomReportController[_0x39da('0x34')]({'id':_0x173268[_0x39da('0x36')]},_0x292a33)['then'](handleResult(_0x173268))[_0x39da('0x2d')](handleError());}}catch(_0x1d6a94){logger[_0x39da('0x2b')](JSON[_0x39da('0x23')](_0x1d6a94));}return logger[_0x39da('0xd')](_0x39da('0x38'));};}function getJobs(_0x276007){var _0x32182a={};if(_0x276007){_0x32182a['id']=_0x276007;}return db[_0x39da('0x39')][_0x39da('0x3a')]({'where':_0x32182a,'include':[{'model':db[_0x39da('0x10')],'attributes':['id',_0x39da('0x14'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x39da('0x15'),'include':[{'model':db['CloudProvider'],'as':_0x39da('0x3b')}]}]}]})[_0x39da('0x2a')](function(_0x1062e0){var _0xb61e06=_['keys'](manager[_0x39da('0x3c')]);var _0x120386=_[_0x39da('0x3d')](_0x1062e0,function(_0xb41f7c){return _0xb41f7c['id'][_0x39da('0x3e')]();});var _0x556b00=_[_0x39da('0x3f')](_0x1062e0,function(_0x56107b){return _0x56107b['id']['toString']();});var _0x44ca5a=_0x276007?_0x120386:_[_0x39da('0x40')](_0x120386,_0xb61e06);var _0x16e16a=_[_0x39da('0x41')](_0x120386,_0xb61e06);var _0x2362c2=_[_0x39da('0x40')](_0xb61e06,_0x120386);var _0x54a848;var _0x4e1414;for(_0x54a848=0x0;_0x54a848<_0x2362c2[_0x39da('0x42')]&&!_0x276007;_0x54a848+=0x1){_0x4e1414=_0x2362c2[_0x54a848][_0x39da('0x3e')]();if(manager[_0x39da('0x43')](_0x4e1414)){manager['stop'](_0x4e1414);manager[_0x39da('0x44')](_0x4e1414);logger[_0x39da('0xd')]('delete\x20cron',_0x4e1414);}}logger[_0x39da('0xd')]('toRun',JSON[_0x39da('0x23')](_0x44ca5a));for(_0x54a848=0x0;_0x54a848<_0x44ca5a[_0x39da('0x42')];_0x54a848+=0x1){_0x4e1414=_0x44ca5a[_0x54a848][_0x39da('0x3e')]();logger[_0x39da('0xd')](_0x39da('0x45'),_0x4e1414);if(_0x276007){logger[_0x39da('0xd')](_0x39da('0x46'),_0x276007);logger[_0x39da('0xd')](JSON[_0x39da('0x23')](_0x556b00[_0x4e1414]));BPromise[_0x39da('0x47')]()[_0x39da('0x2a')](handleJob(_0x556b00[_0x4e1414]));logger[_0x39da('0xd')](_0x39da('0x48'),_0x556b00[_0x4e1414][_0x39da('0x14')],_0x556b00[_0x4e1414][_0x39da('0x49')]);}else if(_0x556b00[_0x4e1414]['cron']&&_0x556b00[_0x4e1414][_0x39da('0x4a')]&&moment()[_0x39da('0x4b')](_0x556b00[_0x4e1414][_0x39da('0x4c')],_0x556b00[_0x4e1414][_0x39da('0x4d')])){manager[_0x39da('0x4e')](_0x4e1414,_0x556b00[_0x4e1414][_0x39da('0x49')],handleJob(_0x556b00[_0x4e1414]));manager['start'](_0x4e1414);logger[_0x39da('0xd')](_0x39da('0x4f'),_0x556b00[_0x4e1414]['name'],_0x556b00[_0x4e1414][_0x39da('0x49')]);}else if(manager[_0x39da('0x43')](_0x4e1414)){manager[_0x39da('0x50')](_0x4e1414);manager['deleteJob'](_0x4e1414);logger[_0x39da('0xd')]('stop\x20cron',_0x556b00[_0x4e1414][_0x39da('0x14')],_0x556b00[_0x4e1414][_0x39da('0x49')]);}}for(_0x54a848=0x0,_0x4e1414;_0x54a848<_0x16e16a[_0x39da('0x42')]&&!_0x276007;_0x54a848+=0x1){_0x4e1414=_0x16e16a[_0x54a848][_0x39da('0x3e')]();if(manager[_0x39da('0x43')](_0x4e1414)){if(_0x556b00[_0x4e1414][_0x39da('0x49')]&&_0x556b00[_0x4e1414][_0x39da('0x4a')]&&moment()['isBetween'](_0x556b00[_0x4e1414][_0x39da('0x4c')],_0x556b00[_0x4e1414]['endAt'])){manager[_0x39da('0x51')](_0x4e1414,_0x556b00[_0x4e1414][_0x39da('0x49')],handleJob(_0x556b00[_0x4e1414]));logger[_0x39da('0xd')](_0x39da('0x52'),_0x556b00[_0x4e1414]['name'],_0x556b00[_0x4e1414][_0x39da('0x49')]);}else{manager[_0x39da('0x50')](_0x4e1414);manager['deleteJob'](_0x4e1414);logger[_0x39da('0xd')]('stop\x20cron',_0x556b00[_0x4e1414]['name'],_0x556b00[_0x4e1414]['cron']);}}}})[_0x39da('0x2d')](function(_0x262f62){logger[_0x39da('0x2b')](JSON[_0x39da('0x23')](_0x262f62));});}exports[_0x39da('0x53')]=function(_0x2fedee){return getJobs(_0x2fedee);};exports[_0x39da('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3997=['bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','savename','format','%s.%s','extname','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','difference','intersection','length','exists','stop','delete\x20cron','toRun','toString','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','deleteJob','stop\x20cron','run','path','moment','cron-job-manager','jayson/promise'];(function(_0x129046,_0x519448){var _0x4d06d9=function(_0x425c26){while(--_0x425c26){_0x129046['push'](_0x129046['shift']());}};_0x4d06d9(++_0x519448);}(_0x3997,0xef));var _0x7399=function(_0x1af790,_0x720c04){_0x1af790=_0x1af790-0x0;var _0x2aad1e=_0x3997[_0x1af790];return _0x2aad1e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x7399('0x0'));var _=require('lodash');var moment=require(_0x7399('0x1'));var CronJobManager=require(_0x7399('0x2'));var jayson=require(_0x7399('0x3'));var BPromise=require(_0x7399('0x4'));var logger=require(_0x7399('0x5'))(_0x7399('0x6'));var db=require(_0x7399('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x7399('0x8'));var client=jayson[_0x7399('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5d784d,_0x382d39){return function(){logger['info'](_0x7399('0xa'),_0x5d784d[_0x7399('0xb')]);var _0x387c8f=!![];var _0x33d5f1=_0x5d784d[_0x7399('0xc')][_0x7399('0xd')]();var _0x3bf4d3={'account':_0x33d5f1,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5d784d[_0x7399('0xc')][_0x7399('0xe')],_0x5d784d[_0x7399('0xc')][_0x7399('0xb')]||_0x5d784d['MailAccount'][_0x7399('0xf')][_0x7399('0x10')]),'to':_0x5d784d[_0x7399('0xb')],'cc':_0x5d784d['cc'],'bcc':_0x5d784d['bcc'],'subject':util['format'](_0x7399('0x11'),_0x382d39[_0x7399('0xe')],_0x5d784d['subtractNumber'],_0x5d784d[_0x7399('0x12')])}};var _0xb03eed=path['join'](__dirname,'../../files/reports');var _0x31bb71=_0x382d39[_0x7399('0x13')];var _0x4ec85c=util[_0x7399('0x14')](_0x7399('0x15'),path['basename'](_0x382d39['savename'],path[_0x7399('0x16')](_0x382d39['savename'])),_0x7399('0x17'));var _0x3efb73=path[_0x7399('0x18')](_0xb03eed,_0x31bb71);var _0x4e79e9=path['join'](_0xb03eed,_0x4ec85c);if(fs[_0x7399('0x19')](_0x3efb73)){_0x382d39[_0x7399('0x1a')]=_0x7399('0x1b');_0x3bf4d3[_0x7399('0x1c')][_0x7399('0x1d')]=[{'filename':_0x31bb71,'path':_0x3efb73}];_0x3bf4d3[_0x7399('0x1c')]['text']=util[_0x7399('0x14')](_0x7399('0x1e'),JSON[_0x7399('0x1f')](_0x382d39,null,0x2));}else if(fs['existsSync'](_0x4e79e9)){_0x382d39['status']=_0x7399('0x1b');_0x3bf4d3['message']['attachments']=[{'filename':_0x4ec85c,'path':_0x4e79e9}];}else{_0x3bf4d3[_0x7399('0x1c')][_0x7399('0x20')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5d784d[_0x7399('0x21')]){_0x387c8f=![];logger[_0x7399('0x22')](_0x7399('0x23'));}}if(_0x387c8f){return client[_0x7399('0x24')]('SendMail',_0x3bf4d3)[_0x7399('0x25')](function(_0x53b649){if(_0x53b649[_0x7399('0x26')]){return logger[_0x7399('0x26')](_0x7399('0x27'),JSON[_0x7399('0x1f')](_0x53b649));}return logger[_0x7399('0x22')](_0x7399('0x28'));})['catch'](function(_0x43ed6c){return logger[_0x7399('0x26')]('error\x20mail',JSON[_0x7399('0x1f')](_0x43ed6c));});}};}function handleError(){return function(_0x2bd12f){return logger[_0x7399('0x26')](JSON[_0x7399('0x1f')](_0x2bd12f));};}function handleResult(_0x1c958c){return function(_0x319cc5){logger[_0x7399('0x22')](_0x7399('0x29'),JSON[_0x7399('0x1f')](_0x319cc5));if(_0x1c958c['MailAccount']&&_0x1c958c[_0x7399('0xc')][_0x7399('0xf')]&&!_['isNil'](_0x1c958c[_0x7399('0xb')])){setTimeout(handleSendEmail(_0x1c958c,_0x319cc5),0x3c*0x3e8);}};}function handleJob(_0x1c2d5c){return function(){try{if(_[_0x7399('0x2a')](_0x1c2d5c['subtractNumber'])){return logger[_0x7399('0x22')](_0x7399('0x2b'));}if(_[_0x7399('0x2a')](_0x1c2d5c[_0x7399('0x12')])){return logger[_0x7399('0x22')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3872c9={'startDate':moment()[_0x7399('0x2c')](_0x1c2d5c['subtractNumber'],_0x1c2d5c['subtractUnit'])['format'](_0x7399('0x2d')),'endDate':moment()[_0x7399('0x14')](_0x7399('0x2d')),'type':_0x7399('0x2e'),'output':_0x1c2d5c[_0x7399('0x2f')],'name':_0x1c2d5c[_0x7399('0xe')]};if(!_['isNil'](_0x1c2d5c[_0x7399('0x30')])){logger[_0x7399('0x22')](_0x7399('0x31'),_0x1c2d5c[_0x7399('0x30')]);return analyticDefaultReportController[_0x7399('0x32')]({'id':_0x1c2d5c[_0x7399('0x30')]},_0x3872c9)[_0x7399('0x25')](handleResult(_0x1c2d5c))[_0x7399('0x33')](handleError());}if(!_[_0x7399('0x2a')](_0x1c2d5c['CustomReportId'])){logger[_0x7399('0x22')](_0x7399('0x34'),_0x1c2d5c[_0x7399('0x35')]);return analyticCustomReportController[_0x7399('0x32')]({'id':_0x1c2d5c[_0x7399('0x35')]},_0x3872c9)[_0x7399('0x25')](handleResult(_0x1c2d5c))['catch'](handleError());}}catch(_0x2db367){logger[_0x7399('0x26')](JSON[_0x7399('0x1f')](_0x2db367));}return logger[_0x7399('0x22')](_0x7399('0x36'));};}function getJobs(_0x539653){var _0x348905={};if(_0x539653){_0x348905['id']=_0x539653;}return db['Schedule'][_0x7399('0x37')]({'where':_0x348905,'include':[{'model':db[_0x7399('0xc')],'attributes':['id','name',_0x7399('0xb')],'include':[{'model':db[_0x7399('0x38')],'as':_0x7399('0xf'),'include':[{'model':db[_0x7399('0x39')],'as':_0x7399('0x39')}]}]}]})[_0x7399('0x25')](function(_0x5654f5){var _0x42b4f6=_[_0x7399('0x3a')](manager[_0x7399('0x3b')]);var _0x53f59e=_[_0x7399('0x3c')](_0x5654f5,function(_0x49f56e){return _0x49f56e['id']['toString']();});var _0x33ece2=_['keyBy'](_0x5654f5,function(_0x4b5732){return _0x4b5732['id']['toString']();});var _0x33008c=_0x539653?_0x53f59e:_[_0x7399('0x3d')](_0x53f59e,_0x42b4f6);var _0x4358cc=_[_0x7399('0x3e')](_0x53f59e,_0x42b4f6);var _0x4bc476=_['difference'](_0x42b4f6,_0x53f59e);var _0x1437ce;var _0x164c64;for(_0x1437ce=0x0;_0x1437ce<_0x4bc476[_0x7399('0x3f')]&&!_0x539653;_0x1437ce+=0x1){_0x164c64=_0x4bc476[_0x1437ce]['toString']();if(manager[_0x7399('0x40')](_0x164c64)){manager[_0x7399('0x41')](_0x164c64);manager['deleteJob'](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x42'),_0x164c64);}}logger[_0x7399('0x22')](_0x7399('0x43'),JSON['stringify'](_0x33008c));for(_0x1437ce=0x0;_0x1437ce<_0x33008c[_0x7399('0x3f')];_0x1437ce+=0x1){_0x164c64=_0x33008c[_0x1437ce][_0x7399('0x44')]();logger[_0x7399('0x22')](_0x7399('0x45'),_0x164c64);if(_0x539653){logger['info']('my\x20id',_0x539653);logger['info'](JSON['stringify'](_0x33ece2[_0x164c64]));BPromise[_0x7399('0x46')]()[_0x7399('0x25')](handleJob(_0x33ece2[_0x164c64]));logger[_0x7399('0x22')](_0x7399('0x47'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else if(_0x33ece2[_0x164c64][_0x7399('0x48')]&&_0x33ece2[_0x164c64][_0x7399('0x49')]&&moment()[_0x7399('0x4a')](_0x33ece2[_0x164c64][_0x7399('0x4b')],_0x33ece2[_0x164c64][_0x7399('0x4c')])){manager['add'](_0x164c64,_0x33ece2[_0x164c64][_0x7399('0x48')],handleJob(_0x33ece2[_0x164c64]));manager[_0x7399('0x4d')](_0x164c64);logger[_0x7399('0x22')]('add\x20cron',_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else if(manager['exists'](_0x164c64)){manager[_0x7399('0x41')](_0x164c64);manager[_0x7399('0x4e')](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x4f'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64]['cron']);}}for(_0x1437ce=0x0,_0x164c64;_0x1437ce<_0x4358cc[_0x7399('0x3f')]&&!_0x539653;_0x1437ce+=0x1){_0x164c64=_0x4358cc[_0x1437ce][_0x7399('0x44')]();if(manager['exists'](_0x164c64)){if(_0x33ece2[_0x164c64][_0x7399('0x48')]&&_0x33ece2[_0x164c64][_0x7399('0x49')]&&moment()['isBetween'](_0x33ece2[_0x164c64]['startAt'],_0x33ece2[_0x164c64][_0x7399('0x4c')])){manager['update'](_0x164c64,_0x33ece2[_0x164c64][_0x7399('0x48')],handleJob(_0x33ece2[_0x164c64]));logger[_0x7399('0x22')]('update\x20cron',_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else{manager[_0x7399('0x41')](_0x164c64);manager['deleteJob'](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x4f'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64]['cron']);}}}})[_0x7399('0x33')](function(_0x2d9f54){logger['error'](JSON['stringify'](_0x2d9f54));});}exports[_0x7399('0x50')]=function(_0x36c0fc){return getJobs(_0x36c0fc);};exports[_0x7399('0x4d')]=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 aa86d64..69f238c 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 _0x56bd=['CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','Sentiment','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','all','inspect','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','results','length','transcripts','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve'];(function(_0xd993f6,_0x87e11c){var _0x17f563=function(_0x3334ef){while(--_0x3334ef){_0xd993f6['push'](_0xd993f6['shift']());}};_0x17f563(++_0x87e11c);}(_0x56bd,0xe9));var _0xd56b=function(_0x54f0bc,_0x2d4295){_0x54f0bc=_0x54f0bc-0x0;var _0x3022ff=_0x56bd[_0x54f0bc];return _0x3022ff;};var _=require('lodash');var AWS=require(_0xd56b('0x0'));var rp=require(_0xd56b('0x1'));var util=require(_0xd56b('0x2'));var BPromise=require('bluebird');var db=require(_0xd56b('0x3'))['db'];var logger=require(_0xd56b('0x4'))(_0xd56b('0x5'));function getTranscriptionJob(_0x44c7c6,_0x5acb5d,_0x35c53e,_0x2a30fd){return new Promise(function(_0x1ac686,_0x18a88e){var _0x17864e=new AWS[(_0xd56b('0x6'))]({'accessKeyId':_0x5acb5d,'secretAccessKey':_0x44c7c6,'region':_0x35c53e});_0x17864e[_0xd56b('0x7')]({'TranscriptionJobName':_0x2a30fd},function(_0x50ad75,_0x670d9b){if(_0x50ad75){return _0x18a88e(_0x50ad75);}else{return _0x1ac686(_0x670d9b);}});});}function sentiment(_0x39935f,_0x6fde5d,_0x13447e,_0x53b856,_0x5b5abd){return new Promise(function(_0x16b2c9,_0x3271bc){var _0x5a8959=new AWS[(_0xd56b('0x8'))]({'accessKeyId':_0x6fde5d,'secretAccessKey':_0x39935f,'region':_0x13447e});_0x5a8959[_0xd56b('0x9')]({'Text':_0x53b856,'LanguageCode':_0x5b5abd[_0xd56b('0xa')](0x0,0x2)},function(_0x18557f,_0x32343a){if(_0x18557f){return _0x3271bc(_0x18557f);}else{return _0x16b2c9(_0x32343a);}});});}function checkTranscribeJob(_0xef7d68,_0x3fb7dd,_0x35c347){var _0x921afd;return new BPromise(function(_0x2bfff6,_0x3d8828){logger[_0xd56b('0xb')](util[_0xd56b('0xc')](_0xd56b('0xd'),_0xef7d68['id'],_0xef7d68[_0xd56b('0xe')]));return getTranscriptionJob(_0x35c347['data1'],_0x35c347[_0xd56b('0xf')],_0x3fb7dd['transcribeRegion'],_0xef7d68[_0xd56b('0xe')])[_0xd56b('0x10')](function(_0x3f8775){logger[_0xd56b('0xb')](util[_0xd56b('0xc')](_0xd56b('0x11'),_0xef7d68['id'],_0xef7d68[_0xd56b('0xe')],_0x3f8775[_0xd56b('0x12')][_0xd56b('0x13')]));if(!_0xef7d68[_0xd56b('0x14')]){switch(_0x3f8775[_0xd56b('0x12')]['TranscriptionJobStatus']){case'COMPLETED':var _0x5ccee5={'transcribeStatus':_0x3f8775[_0xd56b('0x12')][_0xd56b('0x13')],'fileUri':_0x3f8775[_0xd56b('0x12')][_0xd56b('0x15')][_0xd56b('0x16')]};logger[_0xd56b('0xb')](util[_0xd56b('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0xef7d68['id']));return rp({'uri':_0x3f8775[_0xd56b('0x12')][_0xd56b('0x15')][_0xd56b('0x16')],'json':!![]})[_0xd56b('0x10')](function(_0x276955){logger[_0xd56b('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0xef7d68['id']));if(_0x276955&&_0x276955[_0xd56b('0x17')]&&_0x276955[_0xd56b('0x17')]['transcripts']&&_0x276955[_0xd56b('0x17')]['transcripts'][_0xd56b('0x18')]){_0x5ccee5['fileText']='';for(var _0xc9027d=0x0;_0xc9027d<_0x276955[_0xd56b('0x17')][_0xd56b('0x19')]['length'];_0xc9027d++){_0x5ccee5[_0xd56b('0x14')]+=_0x276955[_0xd56b('0x17')][_0xd56b('0x19')][_0xc9027d][_0xd56b('0x1a')]+'';}}return _0xef7d68[_0xd56b('0x1b')](_0x5ccee5);})[_0xd56b('0x10')](function(){logger[_0xd56b('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xef7d68['id']));if(!_0xef7d68[_0xd56b('0x1c')]){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x1f'));}if(!_0x3fb7dd[_0xd56b('0x20')]||!_0x3fb7dd[_0xd56b('0x21')]||!_0x3fb7dd[_0xd56b('0x22')]||!_0x3fb7dd[_0xd56b('0x23')]||!_0x3fb7dd[_0xd56b('0x24')]){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x25'));}if(!_0x5ccee5['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x3fb7dd[_0xd56b('0x21')]===_0x35c347['id']){return _0x35c347;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xd56b('0x21')]}});}})[_0xd56b('0x10')](function(_0x193c7f){if(!_0x193c7f){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x26'));}if(!_0x193c7f[_0xd56b('0x27')]||!_0x193c7f[_0xd56b('0xf')]){throw new db['Sequelize'][(_0xd56b('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x921afd=_0x193c7f;logger[_0xd56b('0xb')](util[_0xd56b('0xc')](_0xd56b('0x28'),_0xef7d68['id']));return sentiment(_0x921afd[_0xd56b('0x27')],_0x921afd[_0xd56b('0xf')],_0x3fb7dd['sentimentRegion'],_0x5ccee5[_0xd56b('0x14')],_0x3fb7dd[_0xd56b('0x23')]);})['then'](function(_0xbc387e){logger[_0xd56b('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xef7d68['id']));return _0xef7d68[_0xd56b('0x1b')]({'sentiment':_0xbc387e['Sentiment'],'sPositive':_0xbc387e[_0xd56b('0x29')][_0xd56b('0x2a')],'sNegative':_0xbc387e[_0xd56b('0x29')][_0xd56b('0x2b')],'sMixed':_0xbc387e[_0xd56b('0x29')][_0xd56b('0x2c')],'sNeutral':_0xbc387e['SentimentScore'][_0xd56b('0x2d')]});})[_0xd56b('0x10')](function(){logger['info'](util[_0xd56b('0xc')](_0xd56b('0x2e'),_0xef7d68['id']));_0x2bfff6();});case _0xd56b('0x2f'):return _0xef7d68[_0xd56b('0x1b')]({'transcribeStatus':_0xd56b('0x2f'),'failureReason':_0x3f8775[_0xd56b('0x12')][_0xd56b('0x30')]})['then'](function(){logger[_0xd56b('0xb')](util[_0xd56b('0xc')](_0xd56b('0x2e'),_0xef7d68['id']));_0x2bfff6();});default:logger[_0xd56b('0xb')](util['format'](_0xd56b('0x31'),_0xef7d68['id']));break;}}else{return BPromise[_0xd56b('0x32')]()[_0xd56b('0x10')](function(){if(!_0xef7d68[_0xd56b('0x1c')]){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x1f'));}if(!_0x3fb7dd[_0xd56b('0x20')]||!_0x3fb7dd[_0xd56b('0x21')]||!_0x3fb7dd[_0xd56b('0x22')]||!_0x3fb7dd[_0xd56b('0x23')]||!_0x3fb7dd[_0xd56b('0x24')]){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x25'));}if(!_0xef7d68[_0xd56b('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x3fb7dd['sentimentAccountId']===_0x35c347['id']){return _0x35c347;}else{return db[_0xd56b('0x33')][_0xd56b('0x34')]({'where':{'id':_settings[_0xd56b('0x21')]}});}})['then'](function(_0x29bdfe){if(!_0x29bdfe){throw new db['Sequelize'][(_0xd56b('0x1e'))](_0xd56b('0x26'));}if(!_0x29bdfe[_0xd56b('0x27')]||!_0x29bdfe[_0xd56b('0xf')]){throw new db[(_0xd56b('0x1d'))]['ValidationError'](_0xd56b('0x35'));}_0x921afd=_0x29bdfe;logger['info'](util[_0xd56b('0xc')](_0xd56b('0x28'),_0xef7d68['id']));return sentiment(_0x921afd[_0xd56b('0x27')],_0x921afd[_0xd56b('0xf')],_0x3fb7dd[_0xd56b('0x22')],_0xef7d68['fileText'],_0x3fb7dd[_0xd56b('0x23')]);})[_0xd56b('0x10')](function(_0x546731){logger[_0xd56b('0xb')](util[_0xd56b('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xef7d68['id']));return _0xef7d68[_0xd56b('0x1b')]({'sentiment':_0x546731[_0xd56b('0x36')],'sPositive':_0x546731[_0xd56b('0x29')][_0xd56b('0x2a')],'sNegative':_0x546731[_0xd56b('0x29')][_0xd56b('0x2b')],'sMixed':_0x546731[_0xd56b('0x29')][_0xd56b('0x2c')],'sNeutral':_0x546731[_0xd56b('0x29')]['Neutral'],'transcribeStatus':_0xd56b('0x37')});})[_0xd56b('0x10')](function(){logger[_0xd56b('0xb')](util['format'](_0xd56b('0x2e'),_0xef7d68['id']));_0x2bfff6();});}})[_0xd56b('0x38')](function(_0x5d36ed){if(_0x5d36ed){if(!_0x5d36ed[_0xd56b('0x39')]||_0x5d36ed[_0xd56b('0x39')]!==_0xd56b('0x3a')){logger[_0xd56b('0x3b')](util[_0xd56b('0xc')](_0xd56b('0x3c'),_0xef7d68['id']),util['inspect'](_0x5d36ed,{'showHidden':![],'depth':null}));}}_0x2bfff6();});});}function checkTranscribe(){var _0x3e587a;var _0x2ca2e5;var _0x2c76ec;return db['VoiceRecording'][_0xd56b('0x3d')]({'where':{'transcribeStatus':_0xd56b('0x3e')}})[_0xd56b('0x10')](function(_0x40a69b){if(!_0x40a69b||!_0x40a69b[_0xd56b('0x18')]){throw new db['Sequelize'][(_0xd56b('0x1e'))](_0xd56b('0x3f'));}_0x3e587a=_0x40a69b;return db[_0xd56b('0x40')][_0xd56b('0x34')]({'where':{'id':0x1}});})[_0xd56b('0x10')](function(_0x2d4349){if(!_0x2d4349){throw new db['Sequelize'][(_0xd56b('0x1e'))](_0xd56b('0x41'));}_0x2ca2e5=_0x2d4349;if(!_0x2ca2e5[_0xd56b('0x5')]||!_0x2ca2e5['transcribeAccountId']||!_0x2ca2e5[_0xd56b('0x42')]||!_0x2ca2e5[_0xd56b('0x23')]||!_0x2ca2e5[_0xd56b('0x24')]){throw new db[(_0xd56b('0x1d'))][(_0xd56b('0x1e'))](_0xd56b('0x43'));}return db[_0xd56b('0x33')][_0xd56b('0x34')]({'where':{'id':_0x2ca2e5[_0xd56b('0x44')]}});})['then'](function(_0x1900a9){if(!_0x1900a9){throw new db[(_0xd56b('0x1d'))]['ValidationError'](_0xd56b('0x26'));}if(!_0x1900a9[_0xd56b('0x27')]||!_0x1900a9['data2']){throw new db[(_0xd56b('0x1d'))]['ValidationError'](_0xd56b('0x35'));}_0x2c76ec=_0x1900a9;var _0x4433cd=[];_0x3e587a['forEach'](function(_0x22fef4){_0x4433cd['push'](checkTranscribeJob(_0x22fef4,_0x2ca2e5,_0x2c76ec));});return BPromise[_0xd56b('0x45')](_0x4433cd);})['catch'](function(_0x494c01){if(_0x494c01){if(!_0x494c01[_0xd56b('0x39')]||_0x494c01[_0xd56b('0x39')]!=='SequelizeValidationError'){logger[_0xd56b('0x3b')](util[_0xd56b('0x46')](_0x494c01,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb7aa=['detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FailureReason','Cloud\x20Provider\x20not\x20configured','Neutral','name','SequelizeValidationError','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend'];(function(_0x2a7186,_0x23ce2e){var _0x133cff=function(_0x2e98b2){while(--_0x2e98b2){_0x2a7186['push'](_0x2a7186['shift']());}};_0x133cff(++_0x23ce2e);}(_0xb7aa,0x11a));var _0xab7a=function(_0x58cc49,_0x1eadcf){_0x58cc49=_0x58cc49-0x0;var _0x84cb24=_0xb7aa[_0x58cc49];return _0x84cb24;};var _=require(_0xab7a('0x0'));var AWS=require(_0xab7a('0x1'));var rp=require(_0xab7a('0x2'));var util=require(_0xab7a('0x3'));var BPromise=require(_0xab7a('0x4'));var db=require(_0xab7a('0x5'))['db'];var logger=require(_0xab7a('0x6'))(_0xab7a('0x7'));function getTranscriptionJob(_0x34adc3,_0x3b0621,_0x4be0a6,_0x35e114){return new Promise(function(_0x1c761b,_0x2ee412){var _0x29ef15=new AWS['TranscribeService']({'accessKeyId':_0x3b0621,'secretAccessKey':_0x34adc3,'region':_0x4be0a6});_0x29ef15[_0xab7a('0x8')]({'TranscriptionJobName':_0x35e114},function(_0x1e3b23,_0x520d21){if(_0x1e3b23){return _0x2ee412(_0x1e3b23);}else{return _0x1c761b(_0x520d21);}});});}function sentiment(_0x25053d,_0xee9933,_0x40e6e6,_0x2fe540,_0x40cc81){return new Promise(function(_0x3f8d8c,_0x2e2e53){var _0x2ac769=new AWS[(_0xab7a('0x9'))]({'accessKeyId':_0xee9933,'secretAccessKey':_0x25053d,'region':_0x40e6e6});_0x2ac769[_0xab7a('0xa')]({'Text':_0x2fe540,'LanguageCode':_0x40cc81['substring'](0x0,0x2)},function(_0x206795,_0x2353c3){if(_0x206795){return _0x2e2e53(_0x206795);}else{return _0x3f8d8c(_0x2353c3);}});});}function checkTranscribeJob(_0x63aa8c,_0x45cd8e,_0x591638){var _0x28e5de;return new BPromise(function(_0x1926f7,_0x340718){logger[_0xab7a('0xb')](util['format'](_0xab7a('0xc'),_0x63aa8c['id'],_0x63aa8c[_0xab7a('0xd')]));return getTranscriptionJob(_0x591638['data1'],_0x591638[_0xab7a('0xe')],_0x45cd8e[_0xab7a('0xf')],_0x63aa8c[_0xab7a('0xd')])[_0xab7a('0x10')](function(_0x30146c){logger['info'](util[_0xab7a('0x11')](_0xab7a('0x12'),_0x63aa8c['id'],_0x63aa8c['transcribeName'],_0x30146c[_0xab7a('0x13')][_0xab7a('0x14')]));if(!_0x63aa8c[_0xab7a('0x15')]){switch(_0x30146c[_0xab7a('0x13')][_0xab7a('0x14')]){case _0xab7a('0x16'):var _0x2616f5={'transcribeStatus':_0x30146c['TranscriptionJob'][_0xab7a('0x14')],'fileUri':_0x30146c[_0xab7a('0x13')][_0xab7a('0x17')][_0xab7a('0x18')]};logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x19'),_0x63aa8c['id']));return rp({'uri':_0x30146c[_0xab7a('0x13')][_0xab7a('0x17')][_0xab7a('0x18')],'json':!![]})[_0xab7a('0x10')](function(_0x5b7ee4){logger['info'](util['format'](_0xab7a('0x1a'),_0x63aa8c['id']));if(_0x5b7ee4&&_0x5b7ee4[_0xab7a('0x1b')]&&_0x5b7ee4[_0xab7a('0x1b')][_0xab7a('0x1c')]&&_0x5b7ee4[_0xab7a('0x1b')][_0xab7a('0x1c')][_0xab7a('0x1d')]){_0x2616f5['fileText']='';for(var _0x4d2ad4=0x0;_0x4d2ad4<_0x5b7ee4[_0xab7a('0x1b')]['transcripts']['length'];_0x4d2ad4++){_0x2616f5[_0xab7a('0x15')]+=_0x5b7ee4['results'][_0xab7a('0x1c')][_0x4d2ad4][_0xab7a('0x1e')]+'';}}return _0x63aa8c[_0xab7a('0x1f')](_0x2616f5);})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util['format'](_0xab7a('0x20'),_0x63aa8c['id']));if(!_0x63aa8c[_0xab7a('0x21')]){throw new db[(_0xab7a('0x22'))]['ValidationError'](_0xab7a('0x23'));}if(!_0x45cd8e[_0xab7a('0x24')]||!_0x45cd8e[_0xab7a('0x25')]||!_0x45cd8e['sentimentRegion']||!_0x45cd8e['language']||!_0x45cd8e[_0xab7a('0x26')]){throw new db['Sequelize'][(_0xab7a('0x27'))](_0xab7a('0x28'));}if(!_0x2616f5['fileText']){throw new Error(_0xab7a('0x29'));}if(_0x45cd8e[_0xab7a('0x25')]===_0x591638['id']){return _0x591638;}else{return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_settings[_0xab7a('0x25')]}});}})[_0xab7a('0x10')](function(_0x58a509){if(!_0x58a509){throw new db[(_0xab7a('0x22'))]['ValidationError'](_0xab7a('0x2c'));}if(!_0x58a509[_0xab7a('0x2d')]||!_0x58a509[_0xab7a('0xe')]){throw new db['Sequelize'][(_0xab7a('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x28e5de=_0x58a509;logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x2e'),_0x63aa8c['id']));return sentiment(_0x28e5de[_0xab7a('0x2d')],_0x28e5de[_0xab7a('0xe')],_0x45cd8e[_0xab7a('0x2f')],_0x2616f5[_0xab7a('0x15')],_0x45cd8e[_0xab7a('0x30')]);})['then'](function(_0x4300a6){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x31'),_0x63aa8c['id']));return _0x63aa8c['update']({'sentiment':_0x4300a6[_0xab7a('0x32')],'sPositive':_0x4300a6[_0xab7a('0x33')][_0xab7a('0x34')],'sNegative':_0x4300a6['SentimentScore'][_0xab7a('0x35')],'sMixed':_0x4300a6[_0xab7a('0x33')][_0xab7a('0x36')],'sNeutral':_0x4300a6[_0xab7a('0x33')]['Neutral']});})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x63aa8c['id']));_0x1926f7();});case'FAILED':return _0x63aa8c[_0xab7a('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x30146c[_0xab7a('0x13')][_0xab7a('0x37')]})['then'](function(){logger['info'](util[_0xab7a('0x11')](_0xab7a('0x20'),_0x63aa8c['id']));_0x1926f7();});default:logger[_0xab7a('0xb')](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x63aa8c['id']));break;}}else{return BPromise['resolve']()[_0xab7a('0x10')](function(){if(!_0x63aa8c[_0xab7a('0x21')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x45cd8e[_0xab7a('0x24')]||!_0x45cd8e[_0xab7a('0x25')]||!_0x45cd8e[_0xab7a('0x2f')]||!_0x45cd8e['language']||!_0x45cd8e[_0xab7a('0x26')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x28'));}if(!_0x63aa8c['fileText']){throw new Error(_0xab7a('0x29'));}if(_0x45cd8e['sentimentAccountId']===_0x591638['id']){return _0x591638;}else{return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_settings[_0xab7a('0x25')]}});}})['then'](function(_0x103826){if(!_0x103826){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x2c'));}if(!_0x103826['data1']||!_0x103826[_0xab7a('0xe')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x38'));}_0x28e5de=_0x103826;logger['info'](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x63aa8c['id']));return sentiment(_0x28e5de[_0xab7a('0x2d')],_0x28e5de['data2'],_0x45cd8e[_0xab7a('0x2f')],_0x63aa8c[_0xab7a('0x15')],_0x45cd8e['language']);})[_0xab7a('0x10')](function(_0x600bb8){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x31'),_0x63aa8c['id']));return _0x63aa8c[_0xab7a('0x1f')]({'sentiment':_0x600bb8['Sentiment'],'sPositive':_0x600bb8['SentimentScore'][_0xab7a('0x34')],'sNegative':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x35')],'sMixed':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x36')],'sNeutral':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x39')],'transcribeStatus':_0xab7a('0x16')});})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x20'),_0x63aa8c['id']));_0x1926f7();});}})['catch'](function(_0x4b30ff){if(_0x4b30ff){if(!_0x4b30ff[_0xab7a('0x3a')]||_0x4b30ff[_0xab7a('0x3a')]!==_0xab7a('0x3b')){logger['error'](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x63aa8c['id']),util[_0xab7a('0x3c')](_0x4b30ff,{'showHidden':![],'depth':null}));}}_0x1926f7();});});}function checkTranscribe(){var _0x22beab;var _0x5c4478;var _0x49438f;return db['VoiceRecording'][_0xab7a('0x3d')]({'where':{'transcribeStatus':_0xab7a('0x3e')}})['then'](function(_0x4a973f){if(!_0x4a973f||!_0x4a973f[_0xab7a('0x1d')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x3f'));}_0x22beab=_0x4a973f;return db[_0xab7a('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x10d1ca){if(!_0x10d1ca){throw new db['Sequelize'][(_0xab7a('0x27'))]('Settings\x20not\x20available');}_0x5c4478=_0x10d1ca;if(!_0x5c4478[_0xab7a('0x7')]||!_0x5c4478[_0xab7a('0x41')]||!_0x5c4478[_0xab7a('0xf')]||!_0x5c4478[_0xab7a('0x30')]||!_0x5c4478[_0xab7a('0x26')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x42'));}return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_0x5c4478[_0xab7a('0x41')]}});})['then'](function(_0x3bfdae){if(!_0x3bfdae){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x2c'));}if(!_0x3bfdae['data1']||!_0x3bfdae['data2']){throw new db['Sequelize'][(_0xab7a('0x27'))](_0xab7a('0x38'));}_0x49438f=_0x3bfdae;var _0x49f75e=[];_0x22beab[_0xab7a('0x43')](function(_0x28d5e9){_0x49f75e[_0xab7a('0x44')](checkTranscribeJob(_0x28d5e9,_0x5c4478,_0x49438f));});return BPromise[_0xab7a('0x45')](_0x49f75e);})[_0xab7a('0x46')](function(_0x3c0acb){if(_0x3c0acb){if(!_0x3c0acb[_0xab7a('0x3a')]||_0x3c0acb[_0xab7a('0x3a')]!==_0xab7a('0x3b')){logger[_0xab7a('0x47')](util[_0xab7a('0x3c')](_0x3c0acb,{'showHidden':![],'depth':null}));}}});}exports[_0xab7a('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 92605b7..d6fef42 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 _0xdb8d=['schedule','defaults','redis','socket.io-emitter','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../mysqldb','../logger'];(function(_0x4c98e6,_0x25242c){var _0x582226=function(_0xc721fc){while(--_0xc721fc){_0x4c98e6['push'](_0x4c98e6['shift']());}};_0x582226(++_0x25242c);}(_0xdb8d,0xe5));var _0xddb8=function(_0x52c29a,_0x84ee1d){_0x52c29a=_0x52c29a-0x0;var _0x213bf1=_0xdb8d[_0x52c29a];return _0x213bf1;};'use strict';var _=require(_0xddb8('0x0'));var moment=require(_0xddb8('0x1'));var Redis=require(_0xddb8('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0xddb8('0x3'))['db'];var logger=require(_0xddb8('0x4'))(_0xddb8('0x5'));config['redis']=_[_0xddb8('0x6')](config[_0xddb8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xddb8('0x8'))(new Redis(config[_0xddb8('0x7')]));function closeInteractions(){var _0x137d0d=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xddb8('0x9'))}}})[_0xddb8('0xa')](function(_0x8b1791){if(_0x8b1791&&_0x8b1791[_0xddb8('0xb')]){_0x137d0d=_[_0xddb8('0xc')](_0x8b1791||[],'id');logger['info'](_0xddb8('0xd'),_0x137d0d[_0xddb8('0xe')]());return db[_0xddb8('0xf')][_0xddb8('0x10')]({'closeReason':_0xddb8('0x11'),'disposition':_0xddb8('0x12'),'closed':!![],'closedAt':moment()['format'](_0xddb8('0x13'))},{'where':{'id':_0x137d0d}});}})[_0xddb8('0xa')](function(){if(_0x137d0d&&_0x137d0d[_0xddb8('0xb')]){logger[_0xddb8('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x137d0d[_0xddb8('0xe')]());for(var _0x381b32=0x0;_0x381b32<_0x137d0d[_0xddb8('0xb')];_0x381b32++){io['emit'](_0xddb8('0x15'),{'id':_0x137d0d[_0x381b32],'closed':!![]});}}})[_0xddb8('0x16')](function(_0x68c0){logger[_0xddb8('0x17')](_0xddb8('0x18'),_0x68c0?util[_0xddb8('0x19')](_0x68c0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8917=['lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','then','info','whatsappInteraction:update','catch','inspect'];(function(_0x228d79,_0x2b23b7){var _0x64eee3=function(_0x1c42fe){while(--_0x1c42fe){_0x228d79['push'](_0x228d79['shift']());}};_0x64eee3(++_0x2b23b7);}(_0x8917,0xc8));var _0x7891=function(_0x4c29a2,_0x1b7468){_0x4c29a2=_0x4c29a2-0x0;var _0x31cb04=_0x8917[_0x4c29a2];return _0x31cb04;};'use strict';var _=require(_0x7891('0x0'));var moment=require(_0x7891('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x7891('0x2'));var db=require(_0x7891('0x3'))['db'];var logger=require(_0x7891('0x4'))(_0x7891('0x5'));config[_0x7891('0x6')]=_['defaults'](config[_0x7891('0x6')],{'host':_0x7891('0x7'),'port':0x18eb});var io=require(_0x7891('0x8'))(new Redis(config[_0x7891('0x6')]));function closeInteractions(){var _0xce84b1=[];return db[_0x7891('0x9')][_0x7891('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7891('0xb')](0x18,_0x7891('0xc'))}}})['then'](function(_0x194dd4){if(_0x194dd4&&_0x194dd4[_0x7891('0xd')]){_0xce84b1=_[_0x7891('0xe')](_0x194dd4||[],'id');logger['info'](_0x7891('0xf'),_0xce84b1[_0x7891('0x10')]());return db[_0x7891('0x9')][_0x7891('0x11')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x7891('0x12')](_0x7891('0x13'))},{'where':{'id':_0xce84b1}});}})[_0x7891('0x14')](function(){if(_0xce84b1&&_0xce84b1[_0x7891('0xd')]){logger[_0x7891('0x15')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xce84b1[_0x7891('0x10')]());for(var _0x3532fd=0x0;_0x3532fd<_0xce84b1[_0x7891('0xd')];_0x3532fd++){io['emit'](_0x7891('0x16'),{'id':_0xce84b1[_0x3532fd],'closed':!![]});}}})[_0x7891('0x17')](function(_0x1205fc){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1205fc?util[_0x7891('0x18')](_0x1205fc,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 906d743..be0b60a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe106=['log','finished\x20populating','contacts1','CmHopper','hopper1','catch','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com','CmContact','destroy','then','bulkCreate'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe106,0x86));var _0x6e10=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xe106[_0x1c5950];return _0x2b720a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6e10('0x0')+i,'lastName':_0x6e10('0x1')+i,'phone':0xf879fb460+i,'email':_0x6e10('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6e10('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x6e10('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6e10('0x4')](),'updatedAt':Date[_0x6e10('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6e10('0x3')]({'id':i,'firstName':_0x6e10('0x0')+i,'lastName':_0x6e10('0x1')+i,'phone':0xf879fb460+i,'email':_0x6e10('0x2')+i+_0x6e10('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6e10('0x3')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x6e10('0x6')][_0x6e10('0x7')]({'where':{}})[_0x6e10('0x8')](function(){return db[_0x6e10('0x6')][_0x6e10('0x9')](contacts);})[_0x6e10('0x8')](function(){console[_0x6e10('0xa')](_0x6e10('0xb'),_0x6e10('0xc'));return db[_0x6e10('0xd')][_0x6e10('0x7')]({'where':{}});})[_0x6e10('0x8')](function(){return db[_0x6e10('0xd')][_0x6e10('0x9')](hopper);})['then'](function(){console['log'](_0x6e10('0xb'),_0x6e10('0xe'));return db[_0x6e10('0x6')][_0x6e10('0x9')](contacts2);})[_0x6e10('0x8')](function(){console[_0x6e10('0xa')]('finished\x20populating','contacts2');return db[_0x6e10('0xd')][_0x6e10('0x9')](hopper2);})[_0x6e10('0x8')](function(){console[_0x6e10('0xa')](_0x6e10('0xb'),'hopper2');})[_0x6e10('0xf')](function(_0x190597){console['log'](_0x190597);}); \ No newline at end of file +var _0x8936=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy'];(function(_0x152c9a,_0x15db16){var _0x43a214=function(_0x29ce5e){while(--_0x29ce5e){_0x152c9a['push'](_0x152c9a['shift']());}};_0x43a214(++_0x15db16);}(_0x8936,0x172));var _0x6893=function(_0x58fdfd,_0x46f063){_0x58fdfd=_0x58fdfd-0x0;var _0x3a4613=_0x8936[_0x58fdfd];return _0x3a4613;};'use strict';var util=require(_0x6893('0x0'));var db=require(_0x6893('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6893('0x2')]({'id':i,'firstName':_0x6893('0x3')+i,'lastName':_0x6893('0x4')+i,'phone':0xf879fb460+i,'email':_0x6893('0x5')+i+_0x6893('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6893('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6893('0x7')](),'updatedAt':Date[_0x6893('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6893('0x2')]({'id':i,'firstName':_0x6893('0x3')+i,'lastName':_0x6893('0x4')+i,'phone':0xf879fb460+i,'email':_0x6893('0x5')+i+_0x6893('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6893('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6893('0x7')](),'updatedAt':Date[_0x6893('0x7')]()});}db[_0x6893('0x8')][_0x6893('0x9')]({'where':{}})[_0x6893('0xa')](function(){return db[_0x6893('0x8')][_0x6893('0xb')](contacts);})['then'](function(){console[_0x6893('0xc')](_0x6893('0xd'),_0x6893('0xe'));return db['CmHopper'][_0x6893('0x9')]({'where':{}});})[_0x6893('0xa')](function(){return db[_0x6893('0xf')]['bulkCreate'](hopper);})[_0x6893('0xa')](function(){console['log'](_0x6893('0xd'),_0x6893('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0x6893('0xa')](function(){console[_0x6893('0xc')](_0x6893('0xd'),_0x6893('0x11'));return db[_0x6893('0xf')][_0x6893('0xb')](hopper2);})[_0x6893('0xa')](function(){console[_0x6893('0xc')](_0x6893('0xd'),'hopper2');})[_0x6893('0x12')](function(_0xf7040a){console['log'](_0xf7040a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index eb1ab5c..f9bc2b7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa50b=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x2ffc98,_0x5a0140){var _0x1bb50a=function(_0x77385){while(--_0x77385){_0x2ffc98['push'](_0x2ffc98['shift']());}};_0x1bb50a(++_0x5a0140);}(_0xa50b,0xc6));var _0xba50=function(_0x15c053,_0x51ce36){_0x15c053=_0x15c053-0x0;var _0x2a11fd=_0xa50b[_0x15c053];return _0x2a11fd;};'use strict';var util=require('util');var db=require(_0xba50('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xba50('0x1')]({'name':util[_0xba50('0x2')](_0xba50('0x3'),_0xba50('0x4'),i),'fullname':util['format']('%s%s',_0xba50('0x4'),i),'email':util[_0xba50('0x2')](_0xba50('0x5'),'agent',i),'role':_0xba50('0x4'),'password':_0xba50('0x6'),'internal':0xfa0+i,'type':_0xba50('0x7'),'transport':['udp','ws',_0xba50('0x8')],'disallow':['all'],'allow':[_0xba50('0x9')],'defaultuser':util['format']('%s%s',_0xba50('0x4'),i),'encryption':_0xba50('0xa'),'avpf':_0xba50('0xa'),'force_avp':'yes','icesupport':_0xba50('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xba50('0xb'),'dtlsprivatekey':_0xba50('0xc'),'dtlssetup':_0xba50('0xd'),'callerid':util[_0xba50('0x2')](_0xba50('0xe'),util[_0xba50('0x2')](_0xba50('0x3'),'agent',i),0xfa0+i)});}db[_0xba50('0xf')][_0xba50('0x10')](users)[_0xba50('0x11')](function(){console[_0xba50('0x12')](_0xba50('0x13'));})[_0xba50('0x14')](function(_0x36b234){console['log'](_0x36b234);}); \ No newline at end of file +var _0xa02c=['User','log','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>'];(function(_0x8962d6,_0x503ed6){var _0x566f25=function(_0x56b0f0){while(--_0x56b0f0){_0x8962d6['push'](_0x8962d6['shift']());}};_0x566f25(++_0x503ed6);}(_0xa02c,0x101));var _0xca02=function(_0x7378f8,_0x2a4020){_0x7378f8=_0x7378f8-0x0;var _0x3ada3=_0xa02c[_0x7378f8];return _0x3ada3;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xca02('0x0')]({'name':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'fullname':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'email':util['format'](_0xca02('0x4'),_0xca02('0x3'),i),'role':_0xca02('0x3'),'password':_0xca02('0x5'),'internal':0xfa0+i,'type':_0xca02('0x6'),'transport':[_0xca02('0x7'),'ws','wss'],'disallow':[_0xca02('0x8')],'allow':[_0xca02('0x9')],'defaultuser':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'encryption':_0xca02('0xa'),'avpf':_0xca02('0xa'),'force_avp':_0xca02('0xa'),'icesupport':_0xca02('0xa'),'dtlsenable':_0xca02('0xa'),'dtlsverify':'no','dtlscertfile':_0xca02('0xb'),'dtlsprivatekey':_0xca02('0xc'),'dtlssetup':_0xca02('0xd'),'callerid':util[_0xca02('0x1')](_0xca02('0xe'),util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),0xfa0+i)});}db[_0xca02('0xf')]['bulkCreate'](users)['then'](function(){console[_0xca02('0x10')]('add\x20user');})['catch'](function(_0x44e1cb){console[_0xca02('0x10')](_0x44e1cb);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 723fb10..964be6c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x788c=['hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','user','FaxQueues','MailQueue','OpenchannelQueue','Telephones','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','length','voice','chat','fax','sms','whatsapp','leave','ChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','name','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','telephone','Campaign','format','Agents','query','find','userProfileId','handshake','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound'];(function(_0x55fe83,_0x334be3){var _0x890bce=function(_0x1e2253){while(--_0x1e2253){_0x55fe83['push'](_0x55fe83['shift']());}};_0x890bce(++_0x334be3);}(_0x788c,0xf6));var _0xc788=function(_0x3af61e,_0x4616f4){_0x3af61e=_0x3af61e-0x0;var _0x4d6c24=_0x788c[_0x3af61e];return _0x4d6c24;};'use strict';var _=require('lodash');var util=require(_0xc788('0x0'));var BPromise=require('bluebird');var db=require(_0xc788('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc788('0x2')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xc788('0x2'),_0xc788('0x3')],'raw':!![],'where':{'role':_0xc788('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc788('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xc788('0x2')],'where':{'role':_0xc788('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc788('0x2'),_0xc788('0x5')],'where':{'type':_0xc788('0x6')}};function getAssociatedResources(_0x5443ff,_0x21f5a6,_0x5e4ee1){return db[_0xc788('0x7')][_0xc788('0x8')]({'where':{'name':_0x5443ff,'userProfileId':_0x21f5a6},'raw':!![]})[_0xc788('0x9')](function(_0x2e2899){if(_0x2e2899){if(_0x2e2899[_0xc788('0xa')]){switch(_0x5443ff){case _0xc788('0xb'):case _0xc788('0xc'):case'FaxQueues':case _0xc788('0xd'):case _0xc788('0xe'):case _0xc788('0xf'):case _0xc788('0x10'):return db[_0x5e4ee1]['findAll'](queryQueues);case'Telephones':return db[_0x5e4ee1][_0xc788('0x11')](queryTelephones);case _0xc788('0x12'):return db[_0x5e4ee1]['findAll'](queryTrunks);case _0xc788('0x13'):return db[_0x5e4ee1][_0xc788('0x11')](queryCampaigns);}}else{return db[_0xc788('0x14')][_0xc788('0x11')]({'attributes':[_0xc788('0x15')],'where':{'sectionId':_0x2e2899['id']},'raw':!![]})['then'](function(_0x44fa91){if(_0x44fa91){var _0x21bf4b={'where':{'id':_[_0xc788('0x16')](_0x44fa91,_0xc788('0x15'))},'raw':!![]};switch(_0x5e4ee1){case _0xc788('0x17'):_0x21bf4b[_0xc788('0x18')][_0xc788('0x3')]=_0xc788('0x19');break;case _0xc788('0x1a'):_0x21bf4b[_0xc788('0x18')]['type']=_0xc788('0x6');break;}return db[_0x5e4ee1][_0xc788('0x11')](_0x21bf4b);}else{return[];}});}}else{return[];}})['then'](function(_0x254b50){return _0x254b50;});}function joinOrLeaveQueues(_0x27ef44,_0x45f0bb,_0x1a09aa,_0x353ade){_0x27ef44[_0x45f0bb](util[_0xc788('0x1b')]('%s:queue:%s',_0x1a09aa,_0x353ade[_0xc788('0x2')]));if(_0x353ade['Agents']){for(var _0x297702=0x0;_0x297702<_0x353ade[_0xc788('0x1c')]['length'];_0x297702+=0x1){_0x27ef44[_0x45f0bb](util['format']('user:%s',_0x353ade[_0xc788('0x1c')][_0x297702][_0xc788('0x2')]));}}}function joinOrLeave(_0x1e504d,_0x4d457e,_0xf8f2f8){var _0x55ce0f;if(_0x1e504d['handshake'][_0xc788('0x1d')]['id']){db[_0xc788('0x17')][_0xc788('0x1e')]({'attributes':['id',_0xc788('0x2'),_0xc788('0x3'),_0xc788('0x1f')],'where':{'id':_0x1e504d[_0xc788('0x20')][_0xc788('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc788('0x21')],'as':_0xc788('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xc788('0x23')],'as':_0xc788('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc788('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc788('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc788('0x27')],'as':_0xc788('0x28'),'attributes':['id'],'raw':!![]}]})[_0xc788('0x9')](function(_0x15fdd6){if(_0x15fdd6){_0x55ce0f=_0x15fdd6;_0x1e504d[_0x4d457e](util[_0xc788('0x1b')](_0xc788('0x29'),_0x15fdd6[_0xc788('0x2')]));var _0x1d61fe=[];switch(_0x15fdd6[_0xc788('0x3')]){case _0xc788('0x2a'):_0x1e504d[_0x4d457e](_0xc788('0x2b'));_0x1e504d[_0x4d457e](_0xc788('0x2c'));if(queryQueues[_0xc788('0x2d')](_0xc788('0x2e'))){delete queryQueues[_0xc788('0x2e')];}_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x30')][_0xc788('0x11')](queryQueues));_0x1d61fe['push'](db[_0xc788('0x31')][_0xc788('0x11')](queryQueues));_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x32')][_0xc788('0x11')](queryQueues));_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x33')][_0xc788('0x11')](queryQueues));_0x1d61fe[_0xc788('0x2f')](db['MailQueue']['findAll'](queryQueues));_0x1d61fe[_0xc788('0x2f')](db['OpenchannelQueue']['findAll'](queryQueues));_0x1d61fe['push'](db[_0xc788('0x34')][_0xc788('0x11')](queryQueues));_0x1d61fe['push'](db[_0xc788('0x17')][_0xc788('0x11')](queryTelephones));_0x1d61fe[_0xc788('0x2f')](db['Trunk'][_0xc788('0x11')](queryTrunks));_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x1a')][_0xc788('0x11')](queryCampaigns));_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x17')][_0xc788('0x11')](queryAgents));break;case _0xc788('0x35'):_0x1e504d[_0x4d457e]('voice:inbound');_0x1e504d[_0x4d457e](_0xc788('0x2c'));_0x1d61fe['push'](getAssociatedResources(_0xc788('0xb'),_0x15fdd6[_0xc788('0x1f')],'VoiceQueue'));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0xc'),_0x15fdd6[_0xc788('0x1f')],_0xc788('0x31')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0x36'),_0x15fdd6['userProfileId'],'FaxQueue'));_0x1d61fe['push'](getAssociatedResources(_0xc788('0xd'),_0x15fdd6['userProfileId'],_0xc788('0x33')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0xe'),_0x15fdd6[_0xc788('0x1f')],_0xc788('0x37')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0xf'),_0x15fdd6['userProfileId'],_0xc788('0x38')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0x10'),_0x15fdd6[_0xc788('0x1f')],_0xc788('0x34')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0x39'),_0x15fdd6[_0xc788('0x1f')],_0xc788('0x17')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0x12'),_0x15fdd6[_0xc788('0x1f')],_0xc788('0x3a')));_0x1d61fe[_0xc788('0x2f')](getAssociatedResources(_0xc788('0x13'),_0x15fdd6['userProfileId'],_0xc788('0x1a')));_0x1d61fe[_0xc788('0x2f')](db[_0xc788('0x17')][_0xc788('0x11')](queryAgents));break;case _0xc788('0x4'):_0x1e504d[_0x4d457e](_0xc788('0x2b'));_0x1e504d[_0x4d457e](_0xc788('0x2c'));_0x1d61fe[_0xc788('0x2f')](_0x15fdd6[_0xc788('0x3b')]({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe['push'](_0x15fdd6[_0xc788('0x3c')]({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe[_0xc788('0x2f')](_0x15fdd6[_0xc788('0x3d')]({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe[_0xc788('0x2f')](_0x15fdd6[_0xc788('0x3e')]({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe[_0xc788('0x2f')](_0x15fdd6[_0xc788('0x3f')]({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe[_0xc788('0x2f')](_0x15fdd6['getOpenchannelQueues']({'attributes':['id',_0xc788('0x2')]}));_0x1d61fe['push'](_0x15fdd6['getWhatsappQueues']({'attributes':['id',_0xc788('0x2')]}));break;}return BPromise[_0xc788('0x40')](_0x1d61fe);}})[_0xc788('0x9')](function(_0x3bf24c){if(_0x3bf24c&&_0x3bf24c[_0xc788('0x41')]){for(var _0x17d9ae=0x0;_0x17d9ae<_0x3bf24c[_0xc788('0x41')];_0x17d9ae+=0x1){for(var _0x2e0dd4=0x0;_0x2e0dd4<_0x3bf24c[_0x17d9ae][_0xc788('0x41')];_0x2e0dd4+=0x1){switch(_0x17d9ae){case 0x0:joinOrLeaveQueues(_0x1e504d,_0x4d457e,_0xc788('0x42'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x1:joinOrLeaveQueues(_0x1e504d,_0x4d457e,_0xc788('0x43'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x2:joinOrLeaveQueues(_0x1e504d,_0x4d457e,_0xc788('0x44'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x3:joinOrLeaveQueues(_0x1e504d,_0x4d457e,_0xc788('0x45'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x4:joinOrLeaveQueues(_0x1e504d,_0x4d457e,'mail',_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x5:joinOrLeaveQueues(_0x1e504d,_0x4d457e,'openchannel',_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x6:joinOrLeaveQueues(_0x1e504d,_0x4d457e,_0xc788('0x46'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]);break;case 0x7:if(_0x55ce0f[_0xc788('0x3')]!==_0xc788('0x4'))_0x1e504d[_0x4d457e](util[_0xc788('0x1b')]('telephone:%s',_0x3bf24c[_0x17d9ae][_0x2e0dd4][_0xc788('0x2')]));break;case 0x8:if(_0x55ce0f[_0xc788('0x3')]!==_0xc788('0x4'))_0x1e504d[_0x4d457e](util[_0xc788('0x1b')]('trunk:%s',_0x3bf24c[_0x17d9ae][_0x2e0dd4][_0xc788('0x2')]));break;case 0x9:if(_0x55ce0f[_0xc788('0x3')]!==_0xc788('0x4'))_0x1e504d[_0x4d457e](util[_0xc788('0x1b')]('campaign:%s:%s',_0x3bf24c[_0x17d9ae][_0x2e0dd4][_0xc788('0x5')],_0x3bf24c[_0x17d9ae][_0x2e0dd4][_0xc788('0x2')]));break;case 0xa:_0x1e504d[_0x4d457e](util[_0xc788('0x1b')](_0xc788('0x29'),_0x3bf24c[_0x17d9ae][_0x2e0dd4]['name']));break;}}}}})['then'](function(){if(_0x4d457e===_0xc788('0x47')){var _0x482876=_[_0xc788('0x16')](_0x55ce0f[_0xc788('0x48')],'id');return _0x55ce0f['removeChatInteractions'](_0x482876)['then'](function(){for(var _0x41ed34=0x0;_0x41ed34<_0x482876[_0xc788('0x41')];_0x41ed34+=0x1){_0xf8f2f8[_0xc788('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x482876[_0x41ed34]),'UserId':Number(_0x55ce0f['id'])});}});}})[_0xc788('0x9')](function(){if(_0x4d457e===_0xc788('0x47')){var _0x27cd79=_[_0xc788('0x16')](_0x55ce0f['MailInteractions'],'id');return _0x55ce0f[_0xc788('0x4a')](_0x27cd79)[_0xc788('0x9')](function(){for(var _0x5608f4=0x0;_0x5608f4<_0x27cd79[_0xc788('0x41')];_0x5608f4+=0x1){_0xf8f2f8[_0xc788('0x49')](_0xc788('0x4b'),{'MailInteractionId':Number(_0x27cd79[_0x5608f4]),'UserId':Number(_0x55ce0f['id'])});}});}})[_0xc788('0x9')](function(){if(_0x4d457e===_0xc788('0x47')){var _0x17b735=_[_0xc788('0x16')](_0x55ce0f['FaxInteractions'],'id');return _0x55ce0f[_0xc788('0x4c')](_0x17b735)[_0xc788('0x9')](function(){for(var _0x5c164b=0x0;_0x5c164b<_0x17b735[_0xc788('0x41')];_0x5c164b+=0x1){_0xf8f2f8[_0xc788('0x49')](_0xc788('0x4d'),{'FaxInteractionId':Number(_0x17b735[_0x5c164b]),'UserId':Number(_0x55ce0f['id'])});}});}})[_0xc788('0x9')](function(){if(_0x4d457e===_0xc788('0x47')){var _0x175308=_[_0xc788('0x16')](_0x55ce0f[_0xc788('0x25')],'id');return _0x55ce0f[_0xc788('0x4e')](_0x175308)['then'](function(){for(var _0x2793bd=0x0;_0x2793bd<_0x175308[_0xc788('0x41')];_0x2793bd+=0x1){_0xf8f2f8[_0xc788('0x49')](_0xc788('0x4f'),{'SmsInteractionId':Number(_0x175308[_0x2793bd]),'UserId':Number(_0x55ce0f['id'])});}});}})[_0xc788('0x9')](function(){if(_0x4d457e===_0xc788('0x47')){var _0x367a60=_[_0xc788('0x16')](_0x55ce0f[_0xc788('0x50')],'id');return _0x55ce0f['removeOpenchannelInteractions'](_0x367a60)[_0xc788('0x9')](function(){for(var _0x953801=0x0;_0x953801<_0x367a60[_0xc788('0x41')];_0x953801+=0x1){_0xf8f2f8[_0xc788('0x49')](_0xc788('0x51'),{'OpenchannelInteractionId':Number(_0x367a60[_0x953801]),'UserId':Number(_0x55ce0f['id'])});}});}})['then'](function(){if(_0x4d457e==='leave'){var _0x4b76bc=_['map'](_0x55ce0f[_0xc788('0x28')],'id');return _0x55ce0f[_0xc788('0x52')](_0x4b76bc)[_0xc788('0x9')](function(){for(var _0xab439e=0x0;_0xab439e<_0x4b76bc[_0xc788('0x41')];_0xab439e+=0x1){_0xf8f2f8['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4b76bc[_0xab439e]),'UserId':Number(_0x55ce0f['id'])});}});}})[_0xc788('0x53')](function(_0x242e6c){_0x1e504d['log'](_0x242e6c);});}}function onDisconnect(_0x37f3ad,_0x38e7a9){joinOrLeave(_0x37f3ad,'leave',_0x38e7a9);}function onConnect(_0x48e39a){joinOrLeave(_0x48e39a,_0xc788('0x54'));}exports['default']=function(_0x319d74){_0x319d74['on'](_0xc788('0x55'),function(_0x24d1c1){_0x24d1c1[_0xc788('0x56')](0x0);_0x24d1c1[_0xc788('0x57')]=_0x24d1c1[_0xc788('0x58')]['connection'][_0xc788('0x59')]+':'+_0x24d1c1[_0xc788('0x58')][_0xc788('0x55')]['remotePort'];_0x24d1c1[_0xc788('0x5a')]=new Date();_0x24d1c1[_0xc788('0x5b')]=function(_0x5ce4df){console[_0xc788('0x5b')](_0xc788('0x5c')+_0x24d1c1[_0xc788('0x5d')][_0xc788('0x2')]+'['+_0x24d1c1[_0xc788('0x57')]+']',_0x5ce4df);};_0x24d1c1['on'](_0xc788('0x5e'),function(){onDisconnect(_0x24d1c1,_0x319d74);_0x24d1c1[_0xc788('0x5b')](_0xc788('0x5f'));});onConnect(_0x24d1c1);_0x24d1c1[_0xc788('0x5b')](_0xc788('0x60'));});}; \ No newline at end of file +var _0x8d5e=['MailQueue','OpenchannelQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','ChatQueues','SmsQueues','MailQueues'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x8d5e,0xf6));var _0xe8d5=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x8d5e[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var BPromise=require(_0xe8d5('0x2'));var db=require(_0xe8d5('0x3'))['db'];var config=require(_0xe8d5('0x4'));var queryQueues={'attributes':['id',_0xe8d5('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6')],'raw':!![],'where':{'role':_0xe8d5('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':_0xe8d5('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe8d5('0x8')],'where':{'type':_0xe8d5('0x9')}};function getAssociatedResources(_0x1aaa23,_0x20cddc,_0x4e4eae){return db[_0xe8d5('0xa')][_0xe8d5('0xb')]({'where':{'name':_0x1aaa23,'userProfileId':_0x20cddc},'raw':!![]})['then'](function(_0x52b3d8){if(_0x52b3d8){if(_0x52b3d8[_0xe8d5('0xc')]){switch(_0x1aaa23){case _0xe8d5('0xd'):case'ChatQueues':case _0xe8d5('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0xe8d5('0xf'):return db[_0x4e4eae][_0xe8d5('0x10')](queryQueues);case _0xe8d5('0x11'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTelephones);case _0xe8d5('0x12'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTrunks);case _0xe8d5('0x13'):return db[_0x4e4eae][_0xe8d5('0x10')](queryCampaigns);}}else{return db[_0xe8d5('0x14')][_0xe8d5('0x10')]({'attributes':[_0xe8d5('0x15')],'where':{'sectionId':_0x52b3d8['id']},'raw':!![]})['then'](function(_0x2322e6){if(_0x2322e6){var _0xd213e1={'where':{'id':_['map'](_0x2322e6,_0xe8d5('0x15'))},'raw':!![]};switch(_0x4e4eae){case _0xe8d5('0x16'):_0xd213e1[_0xe8d5('0x17')][_0xe8d5('0x6')]='telephone';break;case _0xe8d5('0x18'):_0xd213e1[_0xe8d5('0x17')]['type']='ivr';break;}return db[_0x4e4eae][_0xe8d5('0x10')](_0xd213e1);}else{return[];}});}}else{return[];}})['then'](function(_0x46d317){return _0x46d317;});}function joinOrLeaveQueues(_0x5e3ad2,_0xe2bc71,_0x5933f0,_0x43c0a5){_0x5e3ad2[_0xe2bc71](util[_0xe8d5('0x19')](_0xe8d5('0x1a'),_0x5933f0,_0x43c0a5['name']));if(_0x43c0a5['Agents']){for(var _0x31dda5=0x0;_0x31dda5<_0x43c0a5['Agents'][_0xe8d5('0x1b')];_0x31dda5+=0x1){_0x5e3ad2[_0xe2bc71](util['format'](_0xe8d5('0x1c'),_0x43c0a5[_0xe8d5('0x1d')][_0x31dda5][_0xe8d5('0x5')]));}}}function joinOrLeave(_0x2dc4cc,_0x10de0a,_0x13e7c9){var _0x5c8c96;if(_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']){db['User'][_0xe8d5('0x20')]({'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6'),_0xe8d5('0x21')],'where':{'id':_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe8d5('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x23')],'as':_0xe8d5('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x25')],'as':_0xe8d5('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x27')],'as':_0xe8d5('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x29')],'as':_0xe8d5('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xe8d5('0x2b')](function(_0xc1ad95){if(_0xc1ad95){_0x5c8c96=_0xc1ad95;_0x2dc4cc[_0x10de0a](util['format']('user:%s',_0xc1ad95[_0xe8d5('0x5')]));var _0x215a67=[];switch(_0xc1ad95['role']){case _0xe8d5('0x2c'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));if(queryQueues[_0xe8d5('0x2f')]('include')){delete queryQueues[_0xe8d5('0x30')];}_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x32')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x33')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x34')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x35')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db['MailQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x36')]['findAll'](queryQueues));_0x215a67['push'](db['WhatsappQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67['push'](db[_0xe8d5('0x16')][_0xe8d5('0x10')](queryTelephones));_0x215a67['push'](db[_0xe8d5('0x37')][_0xe8d5('0x10')](queryTrunks));_0x215a67['push'](db[_0xe8d5('0x18')][_0xe8d5('0x10')](queryCampaigns));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x38'):_0x2dc4cc[_0x10de0a]('voice:inbound');_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xd'),_0xc1ad95['userProfileId'],_0xe8d5('0x32')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x39'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x33')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources('FaxQueues',_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x34')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3a'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x35')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3b'),_0xc1ad95['userProfileId'],_0xe8d5('0x3c')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3d'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x36')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xf'),_0xc1ad95[_0xe8d5('0x21')],'WhatsappQueue'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x11'),_0xc1ad95['userProfileId'],_0xe8d5('0x16')));_0x215a67['push'](getAssociatedResources(_0xe8d5('0x12'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x37')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x13'),_0xc1ad95['userProfileId'],'Campaign'));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x7'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a]('voice:outbound');_0x215a67[_0xe8d5('0x31')](_0xc1ad95['getVoiceQueues']({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3e')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3f')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x40')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x41')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x42')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0xe8d5('0x44')](_0x215a67);}})[_0xe8d5('0x2b')](function(_0x25d0f4){if(_0x25d0f4&&_0x25d0f4[_0xe8d5('0x1b')]){for(var _0xa3de7a=0x0;_0xa3de7a<_0x25d0f4[_0xe8d5('0x1b')];_0xa3de7a+=0x1){for(var _0x281346=0x0;_0x281346<_0x25d0f4[_0xa3de7a]['length'];_0x281346+=0x1){switch(_0xa3de7a){case 0x0:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x45'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x1:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x46'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x2:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x47'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x3:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x48'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x4:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x49'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x5:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4a'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x6:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4b'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x7:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4c'),_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x8:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')]('trunk:%s',_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x9:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4d'),_0x25d0f4[_0xa3de7a][_0x281346]['type'],_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;case 0xa:_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x1c'),_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;}}}}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x2233c2=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x22')],'id');return _0x5c8c96['removeChatInteractions'](_0x2233c2)[_0xe8d5('0x2b')](function(){for(var _0xf025b6=0x0;_0xf025b6<_0x2233c2[_0xe8d5('0x1b')];_0xf025b6+=0x1){_0x13e7c9[_0xe8d5('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2233c2[_0xf025b6]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x1218ff=_[_0xe8d5('0x4f')](_0x5c8c96['MailInteractions'],'id');return _0x5c8c96['removeMailInteractions'](_0x1218ff)[_0xe8d5('0x2b')](function(){for(var _0x5a64ca=0x0;_0x5a64ca<_0x1218ff[_0xe8d5('0x1b')];_0x5a64ca+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x51'),{'MailInteractionId':Number(_0x1218ff[_0x5a64ca]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x596f74=_['map'](_0x5c8c96['FaxInteractions'],'id');return _0x5c8c96[_0xe8d5('0x52')](_0x596f74)[_0xe8d5('0x2b')](function(){for(var _0x9a33b4=0x0;_0x9a33b4<_0x596f74[_0xe8d5('0x1b')];_0x9a33b4+=0x1){_0x13e7c9['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x596f74[_0x9a33b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x2ec9dd=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x28')],'id');return _0x5c8c96['removeSmsInteractions'](_0x2ec9dd)[_0xe8d5('0x2b')](function(){for(var _0xe7bbf1=0x0;_0xe7bbf1<_0x2ec9dd[_0xe8d5('0x1b')];_0xe7bbf1+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x53'),{'SmsInteractionId':Number(_0x2ec9dd[_0xe7bbf1]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x23de30=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x54')],'id');return _0x5c8c96[_0xe8d5('0x55')](_0x23de30)[_0xe8d5('0x2b')](function(){for(var _0x3e2ebe=0x0;_0x3e2ebe<_0x23de30[_0xe8d5('0x1b')];_0x3e2ebe+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x56'),{'OpenchannelInteractionId':Number(_0x23de30[_0x3e2ebe]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x1e1e29=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x2a')],'id');return _0x5c8c96[_0xe8d5('0x57')](_0x1e1e29)[_0xe8d5('0x2b')](function(){for(var _0x5e28b4=0x0;_0x5e28b4<_0x1e1e29[_0xe8d5('0x1b')];_0x5e28b4+=0x1){_0x13e7c9['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1e1e29[_0x5e28b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x58')](function(_0x501989){_0x2dc4cc[_0xe8d5('0x59')](_0x501989);});}}function onDisconnect(_0x1967dd,_0x50f81d){joinOrLeave(_0x1967dd,_0xe8d5('0x4e'),_0x50f81d);}function onConnect(_0x12d132){joinOrLeave(_0x12d132,_0xe8d5('0x5a'));}exports[_0xe8d5('0x5b')]=function(_0x2355c8){_0x2355c8['on'](_0xe8d5('0x5c'),function(_0x222dc9){_0x222dc9[_0xe8d5('0x5d')](0x0);_0x222dc9[_0xe8d5('0x5e')]=_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')][_0xe8d5('0x60')]+':'+_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')]['remotePort'];_0x222dc9['connectedAt']=new Date();_0x222dc9[_0xe8d5('0x59')]=function(_0x39dcbd){console[_0xe8d5('0x59')](_0xe8d5('0x61')+_0x222dc9[_0xe8d5('0x62')][_0xe8d5('0x5')]+'['+_0x222dc9['address']+']',_0x39dcbd);};_0x222dc9['on'](_0xe8d5('0x63'),function(){onDisconnect(_0x222dc9,_0x2355c8);_0x222dc9['log'](_0xe8d5('0x64'));});onConnect(_0x222dc9);_0x222dc9['log'](_0xe8d5('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d61a69e..4ce67d4 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 _0xae6b=['afterCreate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','get','motionChannel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','then','contact','UserId','interface','format','name','agent','channel','incomingmessage','catch','AfterCreateMessage','offlineMessage','opened','sequelize','SIP/%s','AfterCreate','closed','changed','substatus','User','find','fullname','email','default','length','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xae6b,0x8f));var _0xbae6=function(_0xe22ceb,_0x27dc83){_0xe22ceb=_0xe22ceb-0x0;var _0x45bb58=_0xae6b[_0xe22ceb];return _0x45bb58;};'use strict';var util=require(_0xbae6('0x0'));var db=require(_0xbae6('0x1'))['db'];var jayson=require(_0xbae6('0x2'));var logger=require(_0xbae6('0x3'))(_0xbae6('0x4'));var client=jayson['client'][_0xbae6('0x5')]({'port':0x232a});var triggers=[{'channel':_0xbae6('0x6'),'model':'ChatInteraction','event':_0xbae6('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xbae6('0x6'),'model':'ChatInteraction','event':'afterUpdate','condition':_0xbae6('0x8'),'callback':afterUpdate},{'channel':_0xbae6('0x6'),'model':_0xbae6('0x9'),'event':_0xbae6('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbae6('0x6'),'model':_0xbae6('0xa'),'event':'afterCreate','condition':_0xbae6('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xbae6('0xc'),'model':_0xbae6('0xd'),'event':_0xbae6('0x7'),'condition':_0xbae6('0xe'),'callback':afterCreate},{'channel':_0xbae6('0xc'),'model':_0xbae6('0xd'),'event':_0xbae6('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0xbae6('0x10'),'event':_0xbae6('0x7'),'condition':_0xbae6('0xb'),'callback':afterCreateMessage},{'channel':_0xbae6('0x11'),'model':'WhatsappInteraction','event':_0xbae6('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xbae6('0x11'),'model':_0xbae6('0x12'),'event':_0xbae6('0xf'),'condition':_0xbae6('0x8'),'callback':afterUpdate},{'channel':_0xbae6('0x11'),'model':_0xbae6('0x13'),'event':'afterCreate','condition':_0xbae6('0xb'),'callback':afterCreateMessage},{'channel':_0xbae6('0x14'),'model':_0xbae6('0x15'),'event':'afterCreate','condition':_0xbae6('0xe'),'callback':afterCreate},{'channel':'Fax','model':_0xbae6('0x15'),'event':_0xbae6('0xf'),'condition':_0xbae6('0x8'),'callback':afterUpdate},{'channel':_0xbae6('0x14'),'model':_0xbae6('0x16'),'event':_0xbae6('0x7'),'condition':_0xbae6('0xb'),'callback':afterCreateMessage},{'channel':_0xbae6('0x17'),'model':_0xbae6('0x18'),'event':'afterCreate','condition':_0xbae6('0xe'),'callback':afterCreate},{'channel':_0xbae6('0x17'),'model':_0xbae6('0x18'),'event':_0xbae6('0xf'),'condition':_0xbae6('0x8'),'callback':afterUpdate},{'channel':_0xbae6('0x17'),'model':_0xbae6('0x19'),'event':_0xbae6('0x7'),'condition':_0xbae6('0xb'),'callback':afterCreateMessage},{'channel':_0xbae6('0x1a'),'model':_0xbae6('0x1b'),'event':'afterCreate','condition':_0xbae6('0xe'),'callback':afterCreate},{'channel':_0xbae6('0x1a'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0xbae6('0x8'),'callback':afterUpdate},{'channel':_0xbae6('0x1a'),'model':_0xbae6('0x1c'),'event':_0xbae6('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x25f5c5){return client[_0xbae6('0x1d')](_0xbae6('0x1e'),_0x25f5c5)['then'](function(_0x154206){logger[_0xbae6('0x1f')](_0xbae6('0x20'),_0xbae6('0x1e'),_0x154206);if(_0x154206[_0xbae6('0x21')]){if(_0x154206['error'][_0xbae6('0x22')]===0x1f4){logger[_0xbae6('0x21')](_0xbae6('0x20'),_0xbae6('0x1e'),_0x154206[_0xbae6('0x21')]);}}})['catch'](function(_0x26a6ac){logger[_0xbae6('0x21')](_0xbae6('0x20'),'EventManager',_0x26a6ac);});}function afterCreateMessage(_0xdf5ce5){return function(_0x1187b3){_0x1187b3=_0x1187b3[_0xbae6('0x23')]({'plain':!![]});_0x1187b3['channel']=_0xdf5ce5;_0x1187b3[_0xbae6('0x24')]=_0xdf5ce5;_0x1187b3[_0xbae6('0x25')]=_0x1187b3['direction'];Promise[_0xbae6('0x26')]()['then'](function(){if(typeof _0x1187b3[_0xbae6('0x27')]===_0xbae6('0x28'))return null;var _0x5db194=_0xbae6('0x29')+_0x1187b3[_0xbae6('0x27')];return db['sequelize'][_0xbae6('0x2a')](_0x5db194,{'type':db[_0xbae6('0x2b')][_0xbae6('0x2c')][_0xbae6('0x2d')],'raw':!![]});})[_0xbae6('0x2e')](function(_0x5f2027){if(_0x5f2027){_0x1187b3[_0xbae6('0x2f')]=_0x5f2027[0x0];}if(typeof _0x1187b3[_0xbae6('0x30')]===_0xbae6('0x28'))return;return getAgent(_0x1187b3['UserId']);})[_0xbae6('0x2e')](function(_0xfbb10c){if(_0xfbb10c){_0x1187b3[_0xbae6('0x31')]=util[_0xbae6('0x32')]('SIP/%s',_0xfbb10c[_0xbae6('0x33')]);_0x1187b3[_0xbae6('0x34')]=_0xfbb10c;_0x1187b3[_0xbae6('0x35')]=_0xdf5ce5;return request({'event':_0xbae6('0x36'),'message':_0x1187b3});}else{return request({'event':'outgoingmessage','message':_0x1187b3});}})[_0xbae6('0x37')](function(_0x1d635e){logger[_0xbae6('0x21')](_0xbae6('0x20'),_0xbae6('0x38'),_0x1d635e);});};}function afterCreateOfflineMessage(_0x726481){return function(_0x3482b7){_0x3482b7=_0x3482b7['get']({'plain':!![]});_0x3482b7[_0xbae6('0x35')]=_0x726481;_0x3482b7[_0xbae6('0x24')]=_0x726481;_0x3482b7['event']=_0xbae6('0x39');return request({'event':_0x3482b7[_0xbae6('0x25')],'message':_0x3482b7});};}function afterCreate(_0x8319c4,_0x414fee){return function(_0xbf98d9){_0xbf98d9=_0xbf98d9[_0xbae6('0x23')]({'plain':!![]});_0xbf98d9[_0xbae6('0x35')]=_0x8319c4;_0xbf98d9[_0xbae6('0x24')]=_0x8319c4;_0xbf98d9[_0xbae6('0x25')]=_0xbae6('0x3a');Promise[_0xbae6('0x26')]()[_0xbae6('0x2e')](function(){var _0x36749c=_0xbae6('0x29')+_0xbf98d9[_0xbae6('0x27')];return db[_0xbae6('0x3b')][_0xbae6('0x2a')](_0x36749c,{'type':db['Sequelize'][_0xbae6('0x2c')][_0xbae6('0x2d')],'raw':!![]});})[_0xbae6('0x2e')](function(_0x2e59a2){if(_0x2e59a2){_0xbf98d9[_0xbae6('0x2f')]=_0x2e59a2[0x0];}if(typeof _0xbf98d9[_0xbae6('0x30')]===_0xbae6('0x28'))return;return getAgent(_0xbf98d9[_0xbae6('0x30')]);})[_0xbae6('0x2e')](function(_0x28adfe){if(_0x28adfe){_0xbf98d9[_0xbae6('0x31')]=util['format'](_0xbae6('0x3c'),_0x28adfe[_0xbae6('0x33')]);_0xbf98d9['agent']=_0x28adfe;}return request({'event':_0x414fee,'message':_0xbf98d9});})[_0xbae6('0x37')](function(_0xf525a1){logger[_0xbae6('0x21')](_0xbae6('0x20'),_0xbae6('0x3d'),_0xf525a1);});};}function afterUpdate(_0x8d2c16){return function(_0x21e894){var _0x525b69=_0x21e894['changed'](_0xbae6('0x3e'))&&_0x21e894[_0xbae6('0x3e')];var _0x13a8b8=_0x21e894[_0xbae6('0x3f')](_0xbae6('0x40'));if(_0x525b69||_0x13a8b8){var _0x2a24c7=_0x525b69?_0xbae6('0x8'):'substatus';var _0x2368c5=_0x21e894[_0xbae6('0x23')]({'plain':!![]});_0x2368c5[_0xbae6('0x35')]=_0x8d2c16;_0x2368c5[_0xbae6('0x24')]=_0x8d2c16;_0x2368c5[_0xbae6('0x25')]=_0x525b69?_0xbae6('0x3e'):_0xbae6('0x40');var _0x28b09d=_0xbae6('0x29')+_0x2368c5[_0xbae6('0x27')];return db['sequelize']['query'](_0x28b09d,{'type':db['Sequelize'][_0xbae6('0x2c')]['SELECT'],'raw':!![]})[_0xbae6('0x2e')](function(_0x3a6a25){if(_0x3a6a25){_0x2368c5['contact']=_0x3a6a25[0x0];}if(typeof _0x2368c5[_0xbae6('0x30')]===_0xbae6('0x28'))return;return getAgent(_0x2368c5[_0xbae6('0x30')]);})[_0xbae6('0x2e')](function(_0x453222){if(_0x453222){_0x2368c5[_0xbae6('0x31')]=util['format'](_0xbae6('0x3c'),_0x453222[_0xbae6('0x33')]);_0x2368c5['agent']=_0x453222;}return request({'event':_0x2a24c7,'message':_0x2368c5});})[_0xbae6('0x37')](function(_0xd23888){logger['error'](_0xbae6('0x20'),'AfterUpdate',_0xd23888);});}};}function getAgent(_0x1c9ca6){return db[_0xbae6('0x41')][_0xbae6('0x42')]({'where':{'id':_0x1c9ca6},'attributes':['id','name',_0xbae6('0x43'),_0xbae6('0x44'),'internal'],'raw':!![]})[_0xbae6('0x2e')](function(_0x599487){return _0x599487;});}exports[_0xbae6('0x45')]=function(){for(var _0x3e4a92=0x0;_0x3e4a92=_0x1b10a6['agents']){throw Error(_0x8161('0x13'));}_0x25b481(_0x548615);})[_0x8161('0x14')](function(_0x3fe18a){_0x258e18(_0x3fe18a);});});}; \ No newline at end of file +var _0xdf7e=['toLowerCase','clearBlockUser','isUndefined','updateAttributes','agent','User','count','then','getLicense','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice','openchannel','isValidChannel'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xdf7e,0x14f));var _0xedf7=function(_0x290fa6,_0x64abe){_0x290fa6=_0x290fa6-0x0;var _0x3ba8f2=_0xdf7e[_0x290fa6];return _0x3ba8f2;};'use strict';var _=require(_0xedf7('0x0'));var BPromise=require(_0xedf7('0x1'));var db=require(_0xedf7('0x2'))['db'];var util=require(_0xedf7('0x3'));var channels=[_0xedf7('0x4'),'mail','chat','fax','sms','whatsapp',_0xedf7('0x5')];exports['getChannels']=function(){return channels;};exports[_0xedf7('0x6')]=function(_0x916a8a){_0x916a8a=_0x916a8a[_0xedf7('0x7')]();return _['includes'](channels,_0x916a8a);};exports[_0xedf7('0x8')]=function(_0x184f7a,_0x29e79f,_0x30ac1d,_0x5cf74e){var _0x2e810e={'loginAttempts':_0x29e79f,'blocked':_0x30ac1d};if(!_[_0xedf7('0x9')](_0x5cf74e)){_0x2e810e['blockedAt']=_0x5cf74e;}return _0x184f7a[_0xedf7('0xa')](_0x2e810e);};exports['getLicense']=function(_0x3ed0ed){return new BPromise(function(_0x26fbe3,_0x3b186e){var _0x1de7f9=0x0;if(_0x3ed0ed['role']!==_0xedf7('0xb')){_0x26fbe3(_0x3ed0ed);}db[_0xedf7('0xc')][_0xedf7('0xd')]({'where':{'role':_0xedf7('0xb'),'online':!![],'id':{'$ne':_0x3ed0ed['id']}}})[_0xedf7('0xe')](function(_0x19e8dc){_0x1de7f9=_0x19e8dc;return util[_0xedf7('0xf')]();})[_0xedf7('0xe')](function(_0x11fe97){if(_0x11fe97&&_0x11fe97[_0xedf7('0x10')]&&_0x1de7f9>=_0x11fe97[_0xedf7('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x26fbe3(_0x3ed0ed);})[_0xedf7('0x11')](function(_0x3f685c){_0x3b186e(_0x3f685c);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2456aed..906adbc 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['Not\x20Found','Forbidden','OutOfInterval','error','stack','status','exports','api','message','Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','name','Entity\x20not\x20found'];(function(_0x12509b,_0x3af9e2){var _0x3db6e7=function(_0x24f7f3){while(--_0x24f7f3){_0x12509b['push'](_0x12509b['shift']());}};_0x3db6e7(++_0x3af9e2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x3071('0x0'));var APIError=function(_0x2afa91,_0x27405a){this[_0x3071('0x1')]=_0x2afa91||_0x3071('0x2');this['name']=_0x27405a||_0x3071('0x3');util[_0x3071('0x4')](APIError,Error);};var APIBadRequestError=function(_0x33a70c){this[_0x3071('0x1')]=_0x33a70c||_0x3071('0x5');this[_0x3071('0x6')]=_0x3071('0x5');util[_0x3071('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xbd737f){this[_0x3071('0x1')]=_0xbd737f||_0x3071('0x7');this[_0x3071('0x6')]=_0x3071('0x8');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x3457cd){switch(_0x3457cd){case _0x3071('0x5'):return 0x190;case _0x3071('0x9'),_0x3071('0xa'):return 0x193;case _0x3071('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a470a){return function(_0x2ace21){logger[_0x3071('0xb')](_0x2ace21[_0x3071('0xc')]);var _0x3ed4a0=getStatusCode(_0x2ace21[_0x3071('0x6')]);if(_0x2ace21['name'])delete _0x2ace21['name'];return _0x4a470a[_0x3071('0xd')](_0x3ed4a0)['send'](_0x2ace21);};}module[_0x3071('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(_0x53b331,_0x37a3f2){var _0x5e3965=function(_0x250ad5){while(--_0x250ad5){_0x53b331['push'](_0x53b331['shift']());}};_0x5e3965(++_0x37a3f2);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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 2292a5f..b32f6ce 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb04a=['status','render','json','exports'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xab04('0x0')][0x194]=function pageNotFound(_0x35f117,_0x44557d){var _0x34d0e2='404';var _0x28963e=0x194;var _0x4657c4={'status':_0x28963e};_0x44557d[_0xab04('0x1')](_0x4657c4['status']);_0x44557d[_0xab04('0x2')](_0x34d0e2,{},function(_0x160dd6,_0x1ad1a7){if(_0x160dd6){return _0x44557d['status'](_0x4657c4[_0xab04('0x1')])[_0xab04('0x3')](_0x4657c4);}_0x44557d['send'](_0x1ad1a7);});}; \ No newline at end of file +var _0x8e3b=['exports','404','status','render','send'];(function(_0xb02995,_0x2d689b){var _0x24c8bd=function(_0x40b921){while(--_0x40b921){_0xb02995['push'](_0xb02995['shift']());}};_0x24c8bd(++_0x2d689b);}(_0x8e3b,0xaa));var _0xb8e3=function(_0x127c7e,_0x470192){_0x127c7e=_0x127c7e-0x0;var _0x45f955=_0x8e3b[_0x127c7e];return _0x45f955;};'use strict';module[_0xb8e3('0x0')][0x194]=function pageNotFound(_0x477dfa,_0x19607d){var _0x74d80c=_0xb8e3('0x1');var _0x29489a=0x194;var _0xaa75da={'status':_0x29489a};_0x19607d[_0xb8e3('0x2')](_0xaa75da['status']);_0x19607d[_0xb8e3('0x3')](_0x74d80c,{},function(_0x5cda82,_0x258b78){if(_0x5cda82){return _0x19607d[_0xb8e3('0x2')](_0xaa75da[_0xb8e3('0x2')])['json'](_0xaa75da);}_0x19607d[_0xb8e3('0x4')](_0x258b78);});}; \ No newline at end of file diff --git a/server/migrations/2.6.6.js b/server/migrations/2.6.6.js index 589c109..99a8015 100644 --- a/server/migrations/2.6.6.js +++ b/server/migrations/2.6.6.js @@ -158,13 +158,6 @@ module.exports = { return new BPromise(function(resolve) { var migration = new Migration(queryInterface); - // START voice_queues_log - migration.changeColumn('voice_queues_log', 'dtm', { - type: Sequelize.DATE, - defaultValue: queryInterface.sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), - }); - // END voice_queues_log - // START FINAL migration.final(resolve); // END FINAL diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 18cb738..f9886bf 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e18=['../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','UserNotification','UserNotifications','SenderId','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceMusicOnHold','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','BlackLists','mailboxuser','mailbox','VoiceMailMessage','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','Interactions','MailApplication','List','ListId','Template','Agents','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Owner','Tag','mail_interaction_has_tags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','ContactId','FaxAccountId','Applications','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','CompanyId','CmContactId','SmsInteractions','cm_contact_has_tags','AdditionalPhones','Agent','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','ParentId','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','Hopper','CmHopperId','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Variable','VariableId','SugarcrmField','Description','DeskConfiguration','DeskAccount','int_desk_configuration_has_tags','Field','ZohoAccount','ZohoField','ZendeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','Dynamics365Field','Dynamics365Configuration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','team_has_whatsapp_queues','VoicePrefixes','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','jstz','determine','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','database','password','options','username','User','import','../api/user/user.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../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','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x4e18,0x11d));var _0x84e1=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x4e18[_0x296144];return _0x5329b1;};'use strict';var config=require(_0x84e1('0x0'));var Sequelize=require(_0x84e1('0x1'));var _=require('lodash');var jstz=require(_0x84e1('0x2'));var timezone=jstz[_0x84e1('0x3')]();config[_0x84e1('0x1')]=_['defaultsDeep'](config[_0x84e1('0x1')],{'database':'motion2','username':_0x84e1('0x4'),'password':_0x84e1('0x5'),'options':{'host':_0x84e1('0x6'),'port':0xcea,'dialect':_0x84e1('0x7'),'dialectOptions':{'charset':_0x84e1('0x8')},'logging':![],'timezone':timezone[_0x84e1('0x9')](),'define':{'charset':'utf8','collate':_0x84e1('0xa')}}});config[_0x84e1('0xb')]=_[_0x84e1('0xc')](config[_0x84e1('0xb')],{'database':_0x84e1('0xd'),'username':_0x84e1('0x4'),'password':_0x84e1('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x84e1('0x7'),'dialectOptions':{'charset':_0x84e1('0x8')},'logging':![],'timezone':timezone[_0x84e1('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x84e1('0x1')][_0x84e1('0xe')],config[_0x84e1('0x1')]['username'],config[_0x84e1('0x1')][_0x84e1('0xf')],config['sequelize'][_0x84e1('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x84e1('0xb')][_0x84e1('0xe')],config[_0x84e1('0xb')][_0x84e1('0x11')],config['sequelizeHistory'][_0x84e1('0xf')],config[_0x84e1('0xb')][_0x84e1('0x10')])};db[_0x84e1('0x12')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x14'));db['VoiceChanSpy']=db[_0x84e1('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x84e1('0x15')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x84e1('0x1')]['import'](_0x84e1('0x16'));db[_0x84e1('0x17')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x18'));db[_0x84e1('0x19')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x1a'));db[_0x84e1('0x1b')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x1c'));db['VoiceMailMessage']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x1d'));db[_0x84e1('0x1e')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x84e1('0x1f')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x20'));db[_0x84e1('0x21')]=db['sequelize']['import'](_0x84e1('0x22'));db[_0x84e1('0x23')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x24'));db[_0x84e1('0x25')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x26'));db['Trunk']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x27'));db['VoiceTransferReport']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x28'));db[_0x84e1('0x29')]=db['sequelize'][_0x84e1('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x84e1('0x2a')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x84e1('0x2b')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x2c'));db[_0x84e1('0x2d')]=db['sequelize'][_0x84e1('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x84e1('0x2e')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x2f'));db[_0x84e1('0x30')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x31'));db[_0x84e1('0x32')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x33'));db[_0x84e1('0x34')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x84e1('0x35')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x36'));db[_0x84e1('0x37')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x38'));db[_0x84e1('0x39')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x3a'));db[_0x84e1('0x3b')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x3c'));db[_0x84e1('0x3d')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x3e'));db[_0x84e1('0x3f')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x40'));db[_0x84e1('0x41')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x84e1('0x1')]['import'](_0x84e1('0x42'));db['MailQueueReport']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x84e1('0x43')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x44'));db[_0x84e1('0x45')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x46'));db['FaxAccount']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x47'));db[_0x84e1('0x48')]=db['sequelize']['import'](_0x84e1('0x49'));db[_0x84e1('0x4a')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x4b'));db[_0x84e1('0x4c')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x4d'));db['FaxQueue']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x4e'));db[_0x84e1('0x4f')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x50'));db[_0x84e1('0x51')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/smsAccount/smsAccount.model');db[_0x84e1('0x52')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x53'));db[_0x84e1('0x54')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x55'));db[_0x84e1('0x56')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x57'));db[_0x84e1('0x58')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x59'));db[_0x84e1('0x5a')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x5b'));db['OpenchannelApplication']=db['sequelize'][_0x84e1('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x5c'));db['OpenchannelMessage']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x5d'));db[_0x84e1('0x5e')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x5f'));db[_0x84e1('0x60')]=db['sequelize']['import'](_0x84e1('0x61'));db[_0x84e1('0x62')]=db['sequelize'][_0x84e1('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x63'));db[_0x84e1('0x64')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x65'));db[_0x84e1('0x66')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x67'));db[_0x84e1('0x68')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x69'));db['ChatQueue']=db[_0x84e1('0x1')]['import'](_0x84e1('0x6a'));db['ChatGroup']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/chatGroup/chatGroup.model');db[_0x84e1('0x6b')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x6c'));db[_0x84e1('0x6d')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x6e'));db[_0x84e1('0x6f')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x70'));db[_0x84e1('0x71')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x72'));db[_0x84e1('0x73')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x74'));db[_0x84e1('0x75')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x84e1('0x76')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x84e1('0x77')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x78'));db[_0x84e1('0x79')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x7a'));db[_0x84e1('0x7b')]=db['sequelize'][_0x84e1('0x13')]('../api/action/action.model');db[_0x84e1('0x7c')]=db['sequelize'][_0x84e1('0x13')]('../api/automation/automation.model');db[_0x84e1('0x7d')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x7e'));db[_0x84e1('0x7f')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x80'));db['Condition']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x81'));db[_0x84e1('0x82')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/interval/interval.model');db[_0x84e1('0x83')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/pause/pause.model');db[_0x84e1('0x84')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x85'));db[_0x84e1('0x86')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x87'));db['Schedule']=db['sequelize']['import'](_0x84e1('0x88'));db[_0x84e1('0x89')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x8a'));db['Tag']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x8b'));db[_0x84e1('0x8c')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x8d'));db[_0x84e1('0x8e')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x8f'));db[_0x84e1('0x90')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x84e1('0x1')]['import']('../api/template/template.model');db['Trigger']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x91'));db['Variable']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/variable/variable.model');db[_0x84e1('0x92')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x93'));db[_0x84e1('0x94')]=db['sequelize']['import'](_0x84e1('0x95'));db['AnalyticCustomReport']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x96'));db[_0x84e1('0x97')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x98'));db['AnalyticExtractedReport']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x99'));db[_0x84e1('0x9a')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x9b'));db['AnalyticFieldReport']=db['sequelize']['import'](_0x84e1('0x9c'));db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x84e1('0x9d')]=db['sequelize']['import'](_0x84e1('0x9e'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x84e1('0x9f'));db[_0x84e1('0xa0')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xa1'));db['SugarcrmAccount']=db['sequelize'][_0x84e1('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x84e1('0xa2')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xa3'));db['SugarcrmField']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xa4'));db['DeskAccount']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xa5'));db['DeskConfiguration']=db[_0x84e1('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x84e1('0xa6')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xa7'));db['ZohoAccount']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xa8'));db[_0x84e1('0xa9')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xaa'));db['ZohoField']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xab'));db['ZendeskConfiguration']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x84e1('0xac')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xad'));db[_0x84e1('0xae')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xaf'));db['FreshdeskConfiguration']=db[_0x84e1('0x1')]['import'](_0x84e1('0xb0'));db[_0x84e1('0xb1')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xb2'));db[_0x84e1('0xb3')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xb4'));db['VtigerConfiguration']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xb5'));db[_0x84e1('0xb6')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xb7'));db[_0x84e1('0xb8')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xb9'));db[_0x84e1('0xba')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xbb'));db['ServicenowField']=db[_0x84e1('0x1')]['import'](_0x84e1('0xbc'));db[_0x84e1('0xbd')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xbe'));db['Dynamics365Configuration']=db[_0x84e1('0x1')]['import'](_0x84e1('0xbf'));db['Dynamics365Field']=db[_0x84e1('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0x84e1('0xc0')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xc1'));db[_0x84e1('0xc2')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xc3'));db[_0x84e1('0xc4')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xc5'));db[_0x84e1('0x92')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x93'));db[_0x84e1('0xc6')]=db[_0x84e1('0x1')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0x84e1('0x1')]['import'](_0x84e1('0xc7'));db[_0x84e1('0xc8')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xc9'));db[_0x84e1('0xca')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xcb'));db[_0x84e1('0xcc')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xcd'));db[_0x84e1('0xce')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xcf'));db[_0x84e1('0xd0')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xd1'));db[_0x84e1('0xd2')]=db[_0x84e1('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x84e1('0xd3')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xd4'));db[_0x84e1('0xd5')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xd6'));db[_0x84e1('0xd7')]=db['sequelize']['import'](_0x84e1('0xd8'));db[_0x84e1('0xd9')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xda'));db[_0x84e1('0xdb')]=db['sequelize']['import'](_0x84e1('0xdc'));db['SquareRecording']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xdd'));db[_0x84e1('0xde')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/squareMessage/squareMessage.model');db[_0x84e1('0xdf')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xe0'));db['License']=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/license/license.model');db[_0x84e1('0xe1')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/campaign/campaign.model');db[_0x84e1('0xe2')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xe3'));db[_0x84e1('0xe4')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xe5'));db[_0x84e1('0xe6')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xe7'));db[_0x84e1('0xe8')]=db[_0x84e1('0x1')][_0x84e1('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x84e1('0xe9')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xea'));db['OpenchannelTransferReport']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xeb'));db['SmsTransferReport']=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xec'));db[_0x84e1('0xed')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xee'));db[_0x84e1('0xef')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xf0'));db[_0x84e1('0xf1')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xf2'));db[_0x84e1('0xf3')]=db['sequelize'][_0x84e1('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x84e1('0xf4')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xf5'));db['UserNotification']=db['sequelize']['import'](_0x84e1('0xf6'));db[_0x84e1('0xf7')]=db[_0x84e1('0x1')]['import'](_0x84e1('0xf8'));db['WhatsappApplication']=db['sequelize']['import'](_0x84e1('0xf9'));db[_0x84e1('0xfa')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xfb'));db[_0x84e1('0xfc')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0xfd'));db[_0x84e1('0xfe')]=db[_0x84e1('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0x84e1('0x13')](_0x84e1('0xff'));db[_0x84e1('0x100')]=db[_0x84e1('0x1')]['import'](_0x84e1('0x101'));db[_0x84e1('0x102')]=db['sequelize']['import'](_0x84e1('0x103'));db['TeamVoiceQueue']=db[_0x84e1('0x1')]['import'](_0x84e1('0x104'));db[_0x84e1('0x105')]=db['sequelize'][_0x84e1('0x13')](_0x84e1('0x106'));db[_0x84e1('0x107')]=db['sequelize']['import'](_0x84e1('0x108'));db[_0x84e1('0x109')]=db[_0x84e1('0x1')][_0x84e1('0x13')](_0x84e1('0x10a'));db['User'][_0x84e1('0x10b')](db[_0x84e1('0x1b')],{'as':_0x84e1('0x1b'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')]['hasOne'](db[_0x84e1('0x109')],{'as':'userSetting','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x10f')],{'as':_0x84e1('0x110'),'foreignKey':_0x84e1('0x10d')});db['User'][_0x84e1('0x10e')](db[_0x84e1('0x29')],{'as':_0x84e1('0x111'),'foreignKey':'UserId'});db[_0x84e1('0x12')]['hasMany'](db[_0x84e1('0x112')],{'as':_0x84e1('0x113'),'onDelete':'cascade','hooks':!![]});db[_0x84e1('0x12')][_0x84e1('0x10e')](db['CmHopperFinal'],{'as':_0x84e1('0x114'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x76')],{'as':_0x84e1('0x115'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x77')],{'as':_0x84e1('0x77'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x116')],{'as':_0x84e1('0x117'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')]['hasMany'](db[_0x84e1('0x64')],{'as':_0x84e1('0x118'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x54')],{'as':'SmsInteractions','foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x4a')],{'as':_0x84e1('0x119'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')]['hasMany'](db[_0x84e1('0x3f')],{'as':_0x84e1('0x11a'),'foreignKey':_0x84e1('0x10d')});db['User'][_0x84e1('0x10e')](db[_0x84e1('0xfa')],{'as':'WhatsappInteractions','foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x12')][_0x84e1('0x10e')](db[_0x84e1('0x11b')],{'as':_0x84e1('0x11c'),'foreignKey':_0x84e1('0x11d')});db[_0x84e1('0x12')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x84e1('0x11e')});db['User'][_0x84e1('0x11f')](db[_0x84e1('0x120')],{'as':_0x84e1('0x121'),'through':_0x84e1('0x122')});db['User']['belongsToMany'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x123'),'through':_0x84e1('0x124')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0xed')],{'as':_0x84e1('0x125'),'through':'cm_user_has_lists'});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0xdf')],{'through':_0x84e1('0x126')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x3f')],{'as':'MailInteractions','through':_0x84e1('0x127')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x64')],{'as':_0x84e1('0x118'),'through':_0x84e1('0x128')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x4a')],{'as':_0x84e1('0x119'),'through':_0x84e1('0x129')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x54')],{'as':'SmsInteractions','through':_0x84e1('0x12a')});db['User'][_0x84e1('0x11f')](db[_0x84e1('0x116')],{'as':'OpenchannelInteractions','through':_0x84e1('0x12b')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0xfa')],{'as':_0x84e1('0x12c'),'through':'user_has_whatsapp_interactions'});db[_0x84e1('0x12')][_0x84e1('0x11f')](db['VoiceQueue'],{'as':_0x84e1('0x12d'),'through':'UserVoiceQueue','required':![]});db[_0x84e1('0x12')][_0x84e1('0x11f')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x84e1('0x107'),'required':![]});db[_0x84e1('0x12')]['belongsToMany'](db['MailQueue'],{'as':_0x84e1('0x12e'),'through':_0x84e1('0x2d'),'required':![]});db['User'][_0x84e1('0x11f')](db[_0x84e1('0x12f')],{'as':_0x84e1('0x130'),'through':_0x84e1('0x2b'),'required':![],'hooks':!![]});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x131')],{'as':_0x84e1('0x132'),'through':_0x84e1('0x2e'),'required':![]});db[_0x84e1('0x12')]['belongsToMany'](db['SmsQueue'],{'as':_0x84e1('0x133'),'through':'UserSmsQueue','required':![]});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x5e')],{'as':_0x84e1('0x134'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x84e1('0x11f')](db[_0x84e1('0x100')],{'as':_0x84e1('0x135'),'through':'UserWhatsappQueue','required':![]});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0xed')],{'through':_0x84e1('0x136')});db[_0x84e1('0x12')]['belongsToMany'](db[_0x84e1('0x60')],{'as':'ChatWebsites','through':_0x84e1('0x137')});db[_0x84e1('0x12')][_0x84e1('0x11f')](db[_0x84e1('0x138')],{'as':_0x84e1('0x139'),'through':_0x84e1('0x13a')});db['User']['belongsToMany'](db[_0x84e1('0x39')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x84e1('0x12')][_0x84e1('0x11f')](db['OpenchannelAccount'],{'as':_0x84e1('0x13b'),'through':'user_has_openchannel_accounts'});db['User'][_0x84e1('0x11f')](db[_0x84e1('0x51')],{'as':_0x84e1('0x13c'),'through':_0x84e1('0x13d')});db['User'][_0x84e1('0x11f')](db[_0x84e1('0xf7')],{'as':'WhatsappAccounts','through':_0x84e1('0x13e')});db[_0x84e1('0x12')]['belongsToMany'](db[_0x84e1('0xdb')],{'as':_0x84e1('0x13f'),'through':_0x84e1('0x140')});db[_0x84e1('0x141')][_0x84e1('0x10e')](db[_0x84e1('0x112')],{'as':_0x84e1('0x142'),'onDelete':'cascade','foreignKey':_0x84e1('0x143')});db['VoiceContext']['hasMany'](db[_0x84e1('0x112')],{'onDelete':_0x84e1('0x10c')});db['VoiceExtension'][_0x84e1('0x10e')](db[_0x84e1('0x112')],{'as':'Applications','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x144')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0x84e1('0x17')][_0x84e1('0x10e')](db[_0x84e1('0x29')],{'as':_0x84e1('0x145'),'foreignKey':_0x84e1('0x146')});db[_0x84e1('0x17')][_0x84e1('0x10e')](db[_0x84e1('0x71')],{'as':_0x84e1('0x147'),'foreignKey':_0x84e1('0x146')});db[_0x84e1('0x17')][_0x84e1('0x10e')](db[_0x84e1('0x75')],{'as':_0x84e1('0x114'),'foreignKey':'VoiceQueueId'});db[_0x84e1('0x17')][_0x84e1('0x10e')](db[_0x84e1('0x76')],{'as':_0x84e1('0x148'),'foreignKey':'VoiceQueueId'});db[_0x84e1('0x17')][_0x84e1('0x10e')](db[_0x84e1('0x77')],{'as':_0x84e1('0x77'),'foreignKey':'VoiceQueueId'});db[_0x84e1('0x17')][_0x84e1('0x10e')](db['CmHopperBlack'],{'as':_0x84e1('0x149'),'foreignKey':_0x84e1('0x146')});db['VoiceQueue'][_0x84e1('0x10e')](db[_0x84e1('0xce')],{'as':_0x84e1('0x14a'),'foreignKey':_0x84e1('0x146')});db[_0x84e1('0x17')][_0x84e1('0x14b')](db[_0x84e1('0x14c')],{'as':_0x84e1('0x14c'),'foreignKey':_0x84e1('0x14d')});db[_0x84e1('0x17')][_0x84e1('0x14b')](db[_0x84e1('0x14c')],{'as':_0x84e1('0x14e'),'foreignKey':'TrunkBackupId'});db[_0x84e1('0x17')]['belongsTo'](db['Interval'],{'as':_0x84e1('0x82'),'foreignKey':_0x84e1('0x14f')});db[_0x84e1('0x17')][_0x84e1('0x14b')](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':_0x84e1('0x151')});db[_0x84e1('0x17')][_0x84e1('0x11f')](db[_0x84e1('0xed')],{'as':_0x84e1('0x125'),'through':_0x84e1('0x152')});db['VoiceQueue'][_0x84e1('0x11f')](db['User'],{'as':'Agents','through':_0x84e1('0x2a')});db['VoiceQueue']['belongsToMany'](db[_0x84e1('0xdf')],{'as':_0x84e1('0x153'),'through':_0x84e1('0x154')});db[_0x84e1('0x17')][_0x84e1('0x11f')](db[_0x84e1('0xed')],{'as':_0x84e1('0x155'),'through':'voice_queues_has_cm_blacklists'});db[_0x84e1('0x10f')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':'User','foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x19')]['belongsTo'](db[_0x84e1('0x12')],{'as':'User','foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x1b')][_0x84e1('0x10e')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x156'),'sourceKey':_0x84e1('0x157')});db[_0x84e1('0x158')][_0x84e1('0x14b')](db['VoiceMail'],{'foreignKey':_0x84e1('0x156'),'targetKey':_0x84e1('0x157')});db[_0x84e1('0x1e')][_0x84e1('0x10e')](db[_0x84e1('0x23')],{'as':'QueueCalls','foreignKey':_0x84e1('0x159'),'constraints':![]});db['VoiceCallReport'][_0x84e1('0x10e')](db[_0x84e1('0x21')],{'as':_0x84e1('0x15a'),'foreignKey':_0x84e1('0x159'),'constraints':![]});db[_0x84e1('0x1e')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':_0x84e1('0x12'),'foreignKey':_0x84e1('0x10d')});db['VoiceCallReport'][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':'ContactId'});db[_0x84e1('0x35')]['belongsTo'](db[_0x84e1('0x39')],{'as':_0x84e1('0x39'),'foreignKey':_0x84e1('0x15c')});db['MailServerIn'][_0x84e1('0x14b')](db[_0x84e1('0x102')],{'as':_0x84e1('0x102'),'foreignKey':_0x84e1('0x15d'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x37')][_0x84e1('0x14b')](db['MailAccount'],{'as':_0x84e1('0x39'),'foreignKey':_0x84e1('0x15c')});db[_0x84e1('0x37')]['belongsTo'](db[_0x84e1('0x102')],{'as':_0x84e1('0x102'),'foreignKey':_0x84e1('0x15d'),'onDelete':'restrict'});db['MailAccount']['hasOne'](db[_0x84e1('0x35')],{'as':_0x84e1('0x15f'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x39')][_0x84e1('0x10b')](db[_0x84e1('0x37')],{'as':_0x84e1('0x160'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x39')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':'MailAccountId','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x39')][_0x84e1('0x10e')](db[_0x84e1('0x7d')],{'as':_0x84e1('0x162'),'foreignKey':_0x84e1('0x15c')});db[_0x84e1('0x39')][_0x84e1('0x10e')](db[_0x84e1('0x41')],{'as':_0x84e1('0x163'),'foreignKey':_0x84e1('0x15c')});db[_0x84e1('0x39')][_0x84e1('0x10e')](db[_0x84e1('0x3f')],{'as':_0x84e1('0x164')});db[_0x84e1('0x39')][_0x84e1('0x10e')](db[_0x84e1('0x165')],{'as':'Applications'});db[_0x84e1('0x39')][_0x84e1('0x14b')](db['CmList'],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x39')]['belongsTo'](db['Template'],{'as':_0x84e1('0x168'),'foreignKey':'TemplateId'});db['MailAccount'][_0x84e1('0x14b')](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':_0x84e1('0x151')});db[_0x84e1('0x39')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x16a')});db[_0x84e1('0x3b')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':'Agents','through':_0x84e1('0x2d')});db[_0x84e1('0x3b')][_0x84e1('0x11f')](db['Team'],{'through':_0x84e1('0x16b'),'as':_0x84e1('0x153')});db[_0x84e1('0x3f')][_0x84e1('0x10e')](db[_0x84e1('0x41')],{'as':_0x84e1('0x163'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x16c')});db[_0x84e1('0x3f')]['belongsTo'](db[_0x84e1('0x39')],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':'ContactId'});db[_0x84e1('0x3f')][_0x84e1('0x14b')](db['User'],{'as':_0x84e1('0x16d'),'foreignKey':'UserId'});db[_0x84e1('0x3f')]['belongsToMany'](db[_0x84e1('0x16e')],{'through':_0x84e1('0x16f'),'as':'Tags'});db[_0x84e1('0x3f')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x16f'),'as':'ThroughTags'});db[_0x84e1('0x3f')][_0x84e1('0x11f')](db['User'],{'as':_0x84e1('0x170'),'through':'user_has_mail_interactions','foreignKey':_0x84e1('0x16c')});db[_0x84e1('0x41')]['hasMany'](db[_0x84e1('0xe4')],{'as':_0x84e1('0x171'),'onDelete':'cascade'});db[_0x84e1('0x41')][_0x84e1('0x14b')](db['User'],{'as':_0x84e1('0x12')});db[_0x84e1('0x41')]['belongsTo'](db[_0x84e1('0x6f')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x15b')});db['MailMessage'][_0x84e1('0x14b')](db[_0x84e1('0x3f')],{'as':_0x84e1('0x172'),'foreignKey':'MailInteractionId'});db[_0x84e1('0x41')][_0x84e1('0x14b')](db[_0x84e1('0x39')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x15c')});db[_0x84e1('0x41')]['belongsTo'](db[_0x84e1('0x60')],{'as':_0x84e1('0x60'),'foreignKey':_0x84e1('0x174')});db['MailMessage'][_0x84e1('0x14b')](db[_0x84e1('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0x84e1('0x175')});db['MailApplication'][_0x84e1('0x14b')](db['User'],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x165')]['belongsTo'](db[_0x84e1('0x3b')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x165')]['belongsTo'](db[_0x84e1('0x39')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x165')][_0x84e1('0x14b')](db[_0x84e1('0x82')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x14f')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x176')});db[_0x84e1('0x177')][_0x84e1('0x14b')](db[_0x84e1('0x39')],{});db[_0x84e1('0x177')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x177')]['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x177')]['belongsTo'](db[_0x84e1('0x3f')],{});db[_0x84e1('0x177')][_0x84e1('0x14b')](db[_0x84e1('0x41')],{});db[_0x84e1('0x177')][_0x84e1('0x14b')](db['User'],{});db[_0x84e1('0x177')][_0x84e1('0x14b')](db[_0x84e1('0x3b')],{});db['Dashboard'][_0x84e1('0x10e')](db[_0x84e1('0x45')],{'as':'Items','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x138')][_0x84e1('0x10e')](db['Disposition'],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x179'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x138')][_0x84e1('0x10e')](db[_0x84e1('0x7d')],{'as':_0x84e1('0x162'),'foreignKey':'FaxAccountId'});db[_0x84e1('0x138')][_0x84e1('0x10e')](db['FaxInteraction'],{'as':_0x84e1('0x164')});db[_0x84e1('0x138')][_0x84e1('0x10e')](db[_0x84e1('0x48')],{'as':_0x84e1('0x17a')});db['FaxAccount']['hasMany'](db['VoiceExtension'],{'as':_0x84e1('0x17b'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x138')][_0x84e1('0x10e')](db[_0x84e1('0x4c')],{'as':_0x84e1('0x163')});db[_0x84e1('0x138')][_0x84e1('0x14b')](db[_0x84e1('0x14c')],{'as':_0x84e1('0x14c')});db[_0x84e1('0x138')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':'List','foreignKey':_0x84e1('0x167')});db[_0x84e1('0x138')][_0x84e1('0x14b')](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x84e1('0x138')]['belongsToMany'](db['User'],{'as':_0x84e1('0x169'),'through':'user_has_fax_accounts'});db[_0x84e1('0x48')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x48')][_0x84e1('0x14b')](db[_0x84e1('0x131')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x48')]['belongsTo'](db[_0x84e1('0x138')],{'onDelete':'restrict'});db[_0x84e1('0x48')][_0x84e1('0x14b')](db[_0x84e1('0x16e')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x176')});db[_0x84e1('0x4a')][_0x84e1('0x10e')](db[_0x84e1('0x4c')],{'as':'Messages','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x17c')});db['FaxInteraction']['belongsTo'](db[_0x84e1('0x138')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x179')});db['FaxInteraction'][_0x84e1('0x14b')](db['CmContact'],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x4a')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':_0x84e1('0x16d'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x4a')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x17d'),'as':_0x84e1('0x17e')});db[_0x84e1('0x4a')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x17d'),'as':_0x84e1('0x17f')});db[_0x84e1('0x4a')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x170'),'through':_0x84e1('0x129'),'foreignKey':_0x84e1('0x17c')});db[_0x84e1('0x4c')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x12')});db[_0x84e1('0x4c')]['belongsTo'](db[_0x84e1('0x4a')],{'as':_0x84e1('0x172'),'foreignKey':_0x84e1('0x17c')});db['FaxMessage'][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x15b')});db[_0x84e1('0x4c')]['belongsTo'](db['Attachment'],{'as':_0x84e1('0xe4'),'foreignKey':_0x84e1('0x180')});db[_0x84e1('0x4c')][_0x84e1('0x14b')](db['FaxAccount'],{'as':'Account','foreignKey':_0x84e1('0x179')});db['FaxQueue'][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x2e')});db[_0x84e1('0x131')][_0x84e1('0x11f')](db[_0x84e1('0xdf')],{'through':_0x84e1('0x181'),'as':'Teams'});db[_0x84e1('0x4f')][_0x84e1('0x14b')](db[_0x84e1('0x138')],{});db[_0x84e1('0x4f')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x4f')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x4f')][_0x84e1('0x14b')](db[_0x84e1('0x4a')],{});db[_0x84e1('0x4f')][_0x84e1('0x14b')](db[_0x84e1('0x4c')],{});db['FaxQueueReport'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{});db['FaxQueueReport'][_0x84e1('0x14b')](db[_0x84e1('0x131')],{});db[_0x84e1('0x51')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x182'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x51')]['hasMany'](db['CannedAnswer'],{'as':_0x84e1('0x162'),'foreignKey':_0x84e1('0x182')});db[_0x84e1('0x51')][_0x84e1('0x10e')](db[_0x84e1('0x56')],{'as':_0x84e1('0x163'),'foreignKey':_0x84e1('0x182')});db[_0x84e1('0x51')][_0x84e1('0x10e')](db[_0x84e1('0x54')],{'as':'Interactions'});db[_0x84e1('0x51')]['hasMany'](db[_0x84e1('0x52')],{'as':_0x84e1('0x17a')});db[_0x84e1('0x51')][_0x84e1('0x14b')](db['CmList'],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x51')][_0x84e1('0x14b')](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':_0x84e1('0x151')});db[_0x84e1('0x51')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x13d')});db['SmsApplication'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x52')][_0x84e1('0x14b')](db[_0x84e1('0x58')],{'onDelete':_0x84e1('0x15e')});db['SmsApplication'][_0x84e1('0x14b')](db[_0x84e1('0x51')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x52')][_0x84e1('0x14b')](db[_0x84e1('0x82')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x14f')});db[_0x84e1('0x52')][_0x84e1('0x14b')](db[_0x84e1('0x16e')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x176')});db[_0x84e1('0x54')]['hasMany'](db[_0x84e1('0x56')],{'as':'Messages','onDelete':_0x84e1('0x10c'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x84e1('0x14b')](db[_0x84e1('0x51')],{'as':_0x84e1('0x173'),'foreignKey':'SmsAccountId'});db[_0x84e1('0x54')]['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x54')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':'Owner','foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x54')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x183'),'as':_0x84e1('0x17e')});db[_0x84e1('0x54')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x183'),'as':_0x84e1('0x17f')});db[_0x84e1('0x54')]['belongsToMany'](db[_0x84e1('0x12')],{'as':'Users','through':_0x84e1('0x12a'),'foreignKey':_0x84e1('0x184')});db[_0x84e1('0x56')][_0x84e1('0x14b')](db['User'],{'as':_0x84e1('0x12')});db[_0x84e1('0x56')][_0x84e1('0x14b')](db['CmContact'],{'onDelete':'cascade','as':_0x84e1('0x15b')});db[_0x84e1('0x56')][_0x84e1('0x14b')](db[_0x84e1('0x54')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x172'),'foreignKey':_0x84e1('0x184')});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x84e1('0x182')});db[_0x84e1('0x58')][_0x84e1('0x11f')](db['User'],{'as':_0x84e1('0x169'),'through':_0x84e1('0x30'),'foreignKey':_0x84e1('0x185')});db['SmsQueue'][_0x84e1('0x11f')](db[_0x84e1('0xdf')],{'through':_0x84e1('0x186'),'as':_0x84e1('0x153')});db[_0x84e1('0x5a')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x187'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x5a')][_0x84e1('0x10e')](db[_0x84e1('0x7d')],{'as':_0x84e1('0x162'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x5a')][_0x84e1('0x10e')](db[_0x84e1('0x116')],{'as':_0x84e1('0x164'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x5a')][_0x84e1('0x10e')](db[_0x84e1('0x188')],{'as':_0x84e1('0x163'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x5a')]['hasMany'](db['OpenchannelApplication'],{'as':_0x84e1('0x17a'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x5a')]['belongsTo'](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x5a')]['belongsTo'](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':_0x84e1('0x151')});db[_0x84e1('0x5a')][_0x84e1('0x11f')](db['User'],{'as':'Agents','through':_0x84e1('0x189')});db[_0x84e1('0x18a')]['belongsTo'](db[_0x84e1('0x12')],{'onDelete':'restrict'});db[_0x84e1('0x18a')][_0x84e1('0x14b')](db[_0x84e1('0x5e')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x18b')});db[_0x84e1('0x18a')][_0x84e1('0x14b')](db[_0x84e1('0x5a')],{'onDelete':'restrict','foreignKey':_0x84e1('0x187')});db[_0x84e1('0x18a')]['belongsTo'](db['Interval'],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x14f')});db[_0x84e1('0x18a')][_0x84e1('0x14b')](db[_0x84e1('0x16e')],{'onDelete':'restrict','foreignKey':_0x84e1('0x176')});db[_0x84e1('0x116')][_0x84e1('0x10e')](db[_0x84e1('0x188')],{'as':_0x84e1('0x163'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x18c')});db['OpenchannelInteraction'][_0x84e1('0x14b')](db[_0x84e1('0x5a')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x116')][_0x84e1('0x14b')](db['CmContact'],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x116')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':'Owner','foreignKey':_0x84e1('0x10d')});db['OpenchannelInteraction']['belongsToMany'](db[_0x84e1('0x16e')],{'through':_0x84e1('0x18d'),'as':'Tags'});db[_0x84e1('0x116')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':'openchannel_interaction_has_tags','as':_0x84e1('0x17f')});db[_0x84e1('0x116')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x170'),'through':_0x84e1('0x12b'),'foreignKey':_0x84e1('0x18c')});db['OpenchannelMessage'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x12')});db['OpenchannelMessage']['belongsTo'](db[_0x84e1('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x84e1('0x188')][_0x84e1('0x14b')](db[_0x84e1('0x116')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x84e1('0x18c')});db[_0x84e1('0x188')][_0x84e1('0x14b')](db['Attachment'],{'as':_0x84e1('0xe4'),'foreignKey':_0x84e1('0x180')});db[_0x84e1('0x188')][_0x84e1('0x14b')](db[_0x84e1('0x5a')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x187')});db[_0x84e1('0x5e')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x32'),'foreignKey':_0x84e1('0x18b')});db[_0x84e1('0x5e')][_0x84e1('0x11f')](db[_0x84e1('0xdf')],{'through':_0x84e1('0x18e'),'as':'Teams'});db[_0x84e1('0x60')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x174'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x60')][_0x84e1('0x10e')](db[_0x84e1('0x7d')],{'as':'Answers','foreignKey':_0x84e1('0x174')});db[_0x84e1('0x60')][_0x84e1('0x10e')](db[_0x84e1('0x6b')],{'as':_0x84e1('0x18f')});db[_0x84e1('0x60')]['hasMany'](db[_0x84e1('0x64')],{'as':'Interactions'});db[_0x84e1('0x60')][_0x84e1('0x10e')](db[_0x84e1('0x190')],{'as':_0x84e1('0x17a')});db[_0x84e1('0x60')][_0x84e1('0x10e')](db[_0x84e1('0x66')],{'as':_0x84e1('0x163')});db['ChatWebsite'][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':'List','foreignKey':_0x84e1('0x167')});db[_0x84e1('0x60')][_0x84e1('0x14b')](db[_0x84e1('0x82')],{'as':_0x84e1('0x82'),'foreignKey':_0x84e1('0x14f')});db['ChatWebsite'][_0x84e1('0x14b')](db[_0x84e1('0x39')],{'as':'MailAccount','foreignKey':_0x84e1('0x15c')});db[_0x84e1('0x60')]['belongsTo'](db[_0x84e1('0x83')],{'as':_0x84e1('0x150'),'foreignKey':_0x84e1('0x151')});db['ChatWebsite'][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x137')});db[_0x84e1('0x62')][_0x84e1('0x14b')](db[_0x84e1('0x5a')],{});db[_0x84e1('0x62')][_0x84e1('0x14b')](db['CmList'],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db['OpenchannelQueueReport']['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x62')][_0x84e1('0x14b')](db[_0x84e1('0x116')],{});db[_0x84e1('0x62')]['belongsTo'](db[_0x84e1('0x188')],{});db['OpenchannelQueueReport'][_0x84e1('0x14b')](db['User'],{});db[_0x84e1('0x62')][_0x84e1('0x14b')](db[_0x84e1('0x5e')],{});db[_0x84e1('0x190')]['belongsTo'](db[_0x84e1('0x12')],{'as':'Agent','foreignKey':_0x84e1('0x10d'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x190')]['belongsTo'](db[_0x84e1('0x12f')],{'as':_0x84e1('0x191'),'foreignKey':_0x84e1('0x192'),'onDelete':'restrict'});db[_0x84e1('0x190')]['belongsTo'](db[_0x84e1('0x60')],{'as':_0x84e1('0x193'),'foreignKey':_0x84e1('0x174'),'onDelete':_0x84e1('0x15e')});db['ChatApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x84e1('0x176')});db[_0x84e1('0x64')][_0x84e1('0x10e')](db[_0x84e1('0x66')],{'as':_0x84e1('0x163'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x194')});db[_0x84e1('0x64')][_0x84e1('0x14b')](db[_0x84e1('0x60')],{'as':_0x84e1('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x84e1('0x64')][_0x84e1('0x14b')](db['CmContact'],{'as':_0x84e1('0x15b'),'foreignKey':'ContactId'});db[_0x84e1('0x64')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':_0x84e1('0x16d'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x64')]['belongsToMany'](db['Tag'],{'through':_0x84e1('0x195'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x84e1('0x16e')],{'through':_0x84e1('0x195'),'as':_0x84e1('0x17f')});db[_0x84e1('0x64')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x170'),'through':_0x84e1('0x128'),'foreignKey':_0x84e1('0x194')});db[_0x84e1('0x66')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x12')});db[_0x84e1('0x66')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'onDelete':'cascade','as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x66')]['belongsTo'](db[_0x84e1('0x64')],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x172'),'foreignKey':_0x84e1('0x194')});db[_0x84e1('0x66')][_0x84e1('0x14b')](db['Attachment'],{'as':_0x84e1('0xe4'),'foreignKey':_0x84e1('0x180')});db[_0x84e1('0x66')][_0x84e1('0x14b')](db['ChatWebsite'],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x174')});db[_0x84e1('0x68')][_0x84e1('0x10e')](db[_0x84e1('0xe4')],{'as':_0x84e1('0x171'),'foreignKey':_0x84e1('0x175'),'onDelete':_0x84e1('0x10c'),'hooks':!![]});db['ChatOfflineMessage'][_0x84e1('0x14b')](db['CmContact'],{'onDelete':_0x84e1('0x10c'),'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x68')][_0x84e1('0x14b')](db[_0x84e1('0x60')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x174')});db['ChatQueue'][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x2b'),'hooks':!![]});db[_0x84e1('0x12f')]['belongsToMany'](db[_0x84e1('0xdf')],{'through':'team_has_chat_queues','as':_0x84e1('0x153')});db['ChatGroup'][_0x84e1('0x10e')](db[_0x84e1('0xc8')],{'as':_0x84e1('0x163'),'foreignKey':'ChatGroupId','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x120')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':'Members','through':_0x84e1('0x122')});db[_0x84e1('0x6b')][_0x84e1('0x14b')](db[_0x84e1('0x60')],{'as':_0x84e1('0x193'),'foreignKey':'ChatWebsiteId'});db[_0x84e1('0x6d')][_0x84e1('0x10e')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x123'),'foreignKey':_0x84e1('0x196')});db['CmContact']['hasMany'](db[_0x84e1('0x8e')],{'as':'Phones','foreignKey':_0x84e1('0x197')});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db[_0x84e1('0x71')],{'as':_0x84e1('0x147'),'foreignKey':_0x84e1('0x178')});db['CmContact']['hasMany'](db['CmHopperFinal'],{'as':_0x84e1('0x114'),'foreignKey':'ContactId'});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x84e1('0x178')});db[_0x84e1('0x6f')]['hasMany'](db['ReportAgentPreview'],{'as':_0x84e1('0x77'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db[_0x84e1('0xce')],{'as':_0x84e1('0x14a'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db[_0x84e1('0x116')],{'as':_0x84e1('0x117'),'foreignKey':_0x84e1('0x178'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db[_0x84e1('0x64')],{'as':_0x84e1('0x118'),'foreignKey':_0x84e1('0x178'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x6f')][_0x84e1('0x10e')](db['SmsInteraction'],{'as':_0x84e1('0x198'),'foreignKey':_0x84e1('0x178'),'onDelete':_0x84e1('0x15e')});db['CmContact'][_0x84e1('0x10e')](db[_0x84e1('0x4a')],{'as':'FaxInteractions','foreignKey':_0x84e1('0x178'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x6f')]['hasMany'](db[_0x84e1('0x3f')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x84e1('0x15e')});db[_0x84e1('0x6f')][_0x84e1('0x14b')](db[_0x84e1('0x6d')],{'as':'Company','foreignKey':_0x84e1('0x196')});db[_0x84e1('0x6f')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':'ListId','onDelete':_0x84e1('0x10c')});db['CmContact']['belongsToMany'](db['User'],{'as':_0x84e1('0x170'),'through':_0x84e1('0x124')});db[_0x84e1('0x6f')]['belongsToMany'](db[_0x84e1('0x16e')],{'as':_0x84e1('0x17e'),'through':_0x84e1('0x199')});db[_0x84e1('0x6f')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x199'),'as':_0x84e1('0x17f')});db['CmHopper'][_0x84e1('0x10e')](db[_0x84e1('0x90')],{'as':_0x84e1('0x19a'),'foreignKey':'CmHopperId'});db[_0x84e1('0x71')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':'ContactId','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x71')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x84e1('0x71')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':_0x84e1('0x19b'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0x71')]['belongsTo'](db['VoiceQueue'],{'as':_0x84e1('0x191'),'foreignKey':_0x84e1('0x146'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x71')][_0x84e1('0x14b')](db['Campaign'],{'as':_0x84e1('0xe1'),'foreignKey':_0x84e1('0x19c'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x71')][_0x84e1('0x14b')](db['User'],{'as':_0x84e1('0x16d'),'foreignKey':_0x84e1('0x19d')});db['CmHopperBlack'][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x84e1('0x73')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':'ListId','onDelete':_0x84e1('0x10c')});db[_0x84e1('0x73')][_0x84e1('0x14b')](db['VoiceQueue'],{'as':_0x84e1('0x191'),'foreignKey':_0x84e1('0x146'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x73')][_0x84e1('0x14b')](db[_0x84e1('0xe1')],{'as':_0x84e1('0xe1'),'foreignKey':_0x84e1('0x19c'),'onDelete':'cascade'});db[_0x84e1('0x7c')][_0x84e1('0x10e')](db[_0x84e1('0x19e')],{'as':{'plural':_0x84e1('0x19f'),'singular':_0x84e1('0x1a0')},'foreignKey':_0x84e1('0x1a1'),'onDelete':_0x84e1('0x10c'),'hooks':!![]});db[_0x84e1('0x7c')][_0x84e1('0x10e')](db[_0x84e1('0x19e')],{'as':{'plural':_0x84e1('0x1a2'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x84e1('0x10c'),'hooks':!![]});db[_0x84e1('0x7c')][_0x84e1('0x10e')](db[_0x84e1('0x7b')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x84e1('0x7f')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x1a3'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0x82')]['hasMany'](db[_0x84e1('0x82')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x84e1('0x10c'),'hooks':!![],'required':![]});db['Interval'][_0x84e1('0x10e')](db['VoiceExtension'],{'as':_0x84e1('0x113'),'foreignKey':_0x84e1('0x14f'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x82')]['hasMany'](db[_0x84e1('0x165')],{'as':_0x84e1('0x1a4'),'foreignKey':_0x84e1('0x14f')});db[_0x84e1('0x82')][_0x84e1('0x10e')](db[_0x84e1('0x190')],{'as':_0x84e1('0x1a5'),'foreignKey':'IntervalId'});db[_0x84e1('0x82')][_0x84e1('0x10e')](db[_0x84e1('0x48')],{'as':'FaxApplications','foreignKey':_0x84e1('0x14f')});db[_0x84e1('0x82')]['hasMany'](db[_0x84e1('0x52')],{'as':_0x84e1('0x1a6'),'foreignKey':'IntervalId'});db[_0x84e1('0x1a7')]['belongsTo'](db['MailAccount'],{});db[_0x84e1('0x1a7')][_0x84e1('0x14b')](db[_0x84e1('0x97')],{'foreignKey':_0x84e1('0x1a8')});db['Schedule']['belongsTo'](db[_0x84e1('0x1a9')],{'foreignKey':_0x84e1('0x1aa')});db[_0x84e1('0x89')][_0x84e1('0x11f')](db[_0x84e1('0x144')],{'as':_0x84e1('0x1ab'),'through':'moh_has_sounds','onDelete':_0x84e1('0x15e')});db[_0x84e1('0x16e')][_0x84e1('0x11f')](db['CmContact'],{'through':_0x84e1('0x199')});db[_0x84e1('0x16e')][_0x84e1('0x11f')](db[_0x84e1('0x64')],{'through':'chat_interaction_has_tags'});db[_0x84e1('0x16e')][_0x84e1('0x11f')](db['MailInteraction'],{'through':_0x84e1('0x16f')});db[_0x84e1('0x16e')][_0x84e1('0x11f')](db[_0x84e1('0x54')],{'through':_0x84e1('0x183')});db['Tag'][_0x84e1('0x11f')](db[_0x84e1('0x4a')],{'through':_0x84e1('0x17d')});db[_0x84e1('0x16e')]['belongsToMany'](db[_0x84e1('0x116')],{'through':_0x84e1('0x18d')});db[_0x84e1('0x16e')][_0x84e1('0x11f')](db['WhatsappInteraction'],{'through':_0x84e1('0x1ac')});db['CmContactHasItem'][_0x84e1('0x14b')](db[_0x84e1('0x8c')],{'as':_0x84e1('0x1ad'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0x84e1('0x14b')](db[_0x84e1('0x71')],{'as':_0x84e1('0x1ae'),'foreignKey':_0x84e1('0x1af')});db[_0x84e1('0x8e')][_0x84e1('0x14b')](db['CmContact'],{'as':'Contact','foreignKey':_0x84e1('0x197')});db[_0x84e1('0x1b0')][_0x84e1('0x10e')](db[_0x84e1('0x19e')],{'as':{'plural':_0x84e1('0x1b1'),'singular':'AllCondition'},'foreignKey':_0x84e1('0x1b2'),'onDelete':_0x84e1('0x10c'),'hooks':!![]});db['Trigger'][_0x84e1('0x10e')](db['Condition'],{'as':{'plural':_0x84e1('0x1b3'),'singular':_0x84e1('0x1b4')},'foreignKey':_0x84e1('0x1b5'),'onDelete':_0x84e1('0x10c'),'hooks':!![]});db[_0x84e1('0x1b0')][_0x84e1('0x10e')](db['Action'],{'as':_0x84e1('0x1b6'),'foreignKey':_0x84e1('0x1b7'),'onDelete':'cascade','hooks':!![]});db[_0x84e1('0x1a9')][_0x84e1('0x10e')](db[_0x84e1('0x1b8')],{'as':_0x84e1('0x1b9'),'onDelete':_0x84e1('0x10c'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x84e1('0x97')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1a8')});db[_0x84e1('0x9a')][_0x84e1('0x10e')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1ba')});db[_0x84e1('0x1b8')][_0x84e1('0x14b')](db[_0x84e1('0x9a')],{'foreignKey':_0x84e1('0x1ba')});db[_0x84e1('0x9d')][_0x84e1('0x10e')](db[_0x84e1('0x1bb')],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1bb')]['hasMany'](db['SalesforceField'],{'as':_0x84e1('0x1be'),'onDelete':_0x84e1('0x10c'),'foreignKey':'SubjectId'});db[_0x84e1('0x1bb')]['hasMany'](db['SalesforceField'],{'as':_0x84e1('0x1bf'),'onDelete':'cascade','foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0x1bb')][_0x84e1('0x10e')](db['SalesforceField'],{'as':_0x84e1('0x1b9'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1bb')]['belongsTo'](db[_0x84e1('0x9d')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0xa0')][_0x84e1('0x10e')](db[_0x84e1('0xa0')],{'as':_0x84e1('0x1c2'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0xa0')]['hasMany'](db[_0x84e1('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x84e1('0xa0')]['hasMany'](db[_0x84e1('0xa0')],{'as':'Field','foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0xa0')][_0x84e1('0x14b')](db[_0x84e1('0x1c4')],{'as':'Variable','foreignKey':_0x84e1('0x1c5')});db['SugarcrmAccount'][_0x84e1('0x10e')](db['SugarcrmConfiguration'],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0xa2')][_0x84e1('0x10e')](db[_0x84e1('0x1c6')],{'as':_0x84e1('0x1be'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0xa2')]['hasMany'](db[_0x84e1('0x1c6')],{'as':_0x84e1('0x1bf'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x84e1('0xa2')][_0x84e1('0x10e')](db[_0x84e1('0x1c6')],{'as':_0x84e1('0x1b9'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0xa2')][_0x84e1('0x14b')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1c6')][_0x84e1('0x10e')](db[_0x84e1('0x1c6')],{'as':_0x84e1('0x1c2'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0x1c6')][_0x84e1('0x10e')](db[_0x84e1('0x1c6')],{'as':_0x84e1('0x1c7'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':'Field','foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1c6')][_0x84e1('0x14b')](db[_0x84e1('0x1c4')],{'as':_0x84e1('0x1c4'),'foreignKey':_0x84e1('0x1c5')});db['DeskAccount'][_0x84e1('0x10e')](db['DeskConfiguration'],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1c8')][_0x84e1('0x10e')](db[_0x84e1('0xa6')],{'as':_0x84e1('0x1be'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0x1c8')][_0x84e1('0x10e')](db[_0x84e1('0xa6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0x1c8')][_0x84e1('0x10e')](db[_0x84e1('0xa6')],{'as':_0x84e1('0x1b9'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1c8')][_0x84e1('0x14b')](db[_0x84e1('0x1c9')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1c8')][_0x84e1('0x11f')](db[_0x84e1('0x16e')],{'through':_0x84e1('0x1ca')});db[_0x84e1('0xa6')][_0x84e1('0x10e')](db[_0x84e1('0xa6')],{'as':'Subject','foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0xa6')]['hasMany'](db[_0x84e1('0xa6')],{'as':_0x84e1('0x1c7'),'foreignKey':'DescriptionId'});db[_0x84e1('0xa6')][_0x84e1('0x10e')](db['DeskField'],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db['DeskField'][_0x84e1('0x14b')](db['Variable'],{'as':_0x84e1('0x1c4'),'foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0x1cc')][_0x84e1('0x10e')](db[_0x84e1('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0xa9')][_0x84e1('0x10e')](db['ZohoField'],{'as':_0x84e1('0x1be'),'onDelete':_0x84e1('0x10c'),'foreignKey':'SubjectId'});db[_0x84e1('0xa9')][_0x84e1('0x10e')](db[_0x84e1('0x1cd')],{'as':_0x84e1('0x1bf'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xa9')][_0x84e1('0x10e')](db[_0x84e1('0x1cd')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x84e1('0x1c1')});db['ZohoConfiguration'][_0x84e1('0x14b')](db[_0x84e1('0x1cc')],{'as':_0x84e1('0x173'),'foreignKey':'AccountId'});db[_0x84e1('0x1cd')][_0x84e1('0x10e')](db['ZohoField'],{'as':_0x84e1('0x1c2'),'foreignKey':_0x84e1('0x1c3')});db['ZohoField'][_0x84e1('0x10e')](db[_0x84e1('0x1cd')],{'as':_0x84e1('0x1c7'),'foreignKey':_0x84e1('0x1c0')});db['ZohoField'][_0x84e1('0x10e')](db['ZohoField'],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1cd')][_0x84e1('0x14b')](db[_0x84e1('0x1c4')],{'as':'Variable','foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0x1ce')][_0x84e1('0x10e')](db[_0x84e1('0x1cf')],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1cf')][_0x84e1('0x10e')](db[_0x84e1('0xac')],{'as':'Subjects','foreignKey':_0x84e1('0x1c3')});db['ZendeskConfiguration'][_0x84e1('0x10e')](db['ZendeskField'],{'as':_0x84e1('0x1bf'),'foreignKey':_0x84e1('0x1c0')});db['ZendeskConfiguration'][_0x84e1('0x10e')](db[_0x84e1('0xac')],{'as':_0x84e1('0x1b9'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1cf')][_0x84e1('0x14b')](db[_0x84e1('0x1ce')],{'as':'Account','foreignKey':'AccountId'});db[_0x84e1('0x1cf')][_0x84e1('0x11f')](db['Tag'],{'through':_0x84e1('0x1d0')});db[_0x84e1('0xac')]['hasMany'](db[_0x84e1('0xac')],{'as':_0x84e1('0x1c2'),'foreignKey':'SubjectId'});db[_0x84e1('0xac')][_0x84e1('0x10e')](db['ZendeskField'],{'as':_0x84e1('0x1c7'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xac')][_0x84e1('0x10e')](db[_0x84e1('0xac')],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db['ZendeskField']['belongsTo'](db[_0x84e1('0x1c4')],{'as':_0x84e1('0x1c4'),'foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0xae')]['hasMany'](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1d1')]['hasMany'](db[_0x84e1('0xb1')],{'as':_0x84e1('0x1be'),'onDelete':'cascade','foreignKey':_0x84e1('0x1c3')});db['FreshdeskConfiguration'][_0x84e1('0x10e')](db[_0x84e1('0xb1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0x1d1')][_0x84e1('0x10e')](db[_0x84e1('0xb1')],{'as':'Fields','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1d1')][_0x84e1('0x14b')](db['FreshdeskAccount'],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1d1')][_0x84e1('0x11f')](db['Tag'],{'through':_0x84e1('0x1d2')});db[_0x84e1('0xb1')][_0x84e1('0x10e')](db['FreshdeskField'],{'as':_0x84e1('0x1c2'),'foreignKey':'SubjectId'});db[_0x84e1('0xb1')][_0x84e1('0x10e')](db[_0x84e1('0xb1')],{'as':_0x84e1('0x1c7'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xb1')][_0x84e1('0x10e')](db['FreshdeskField'],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db['FreshdeskField'][_0x84e1('0x14b')](db[_0x84e1('0x1c4')],{'as':_0x84e1('0x1c4'),'foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0xb3')][_0x84e1('0x10e')](db['VtigerConfiguration'],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1d3')]['hasMany'](db[_0x84e1('0xb6')],{'as':_0x84e1('0x1be'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0x1d3')][_0x84e1('0x10e')](db[_0x84e1('0xb6')],{'as':_0x84e1('0x1bf'),'foreignKey':'DescriptionId'});db[_0x84e1('0x1d3')]['hasMany'](db['VtigerField'],{'as':_0x84e1('0x1b9'),'foreignKey':_0x84e1('0x1c1')});db['VtigerConfiguration']['belongsTo'](db[_0x84e1('0xb3')],{'as':_0x84e1('0x173'),'foreignKey':'AccountId'});db[_0x84e1('0xb6')][_0x84e1('0x10e')](db[_0x84e1('0xb6')],{'as':_0x84e1('0x1c2'),'foreignKey':'SubjectId'});db[_0x84e1('0xb6')]['hasMany'](db[_0x84e1('0xb6')],{'as':'Description','foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xb6')]['hasMany'](db['VtigerField'],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db['VtigerField']['belongsTo'](db[_0x84e1('0x1c4')],{'as':_0x84e1('0x1c4'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x84e1('0x10e')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x84e1('0x10c'),'foreignKey':'AccountId'});db[_0x84e1('0xba')][_0x84e1('0x10e')](db[_0x84e1('0x1d4')],{'as':_0x84e1('0x1be'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0xba')][_0x84e1('0x10e')](db[_0x84e1('0x1d4')],{'as':_0x84e1('0x1bf'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xba')][_0x84e1('0x10e')](db[_0x84e1('0x1d4')],{'as':_0x84e1('0x1b9'),'foreignKey':'FieldId'});db[_0x84e1('0xba')][_0x84e1('0x14b')](db[_0x84e1('0xb8')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0x1d4')][_0x84e1('0x10e')](db[_0x84e1('0x1d4')],{'as':'Subject','foreignKey':_0x84e1('0x1c3')});db['ServicenowField'][_0x84e1('0x10e')](db[_0x84e1('0x1d4')],{'as':_0x84e1('0x1c7'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0x1d4')][_0x84e1('0x10e')](db['ServicenowField'],{'as':'Field','foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1d4')]['belongsTo'](db[_0x84e1('0x1c4')],{'as':'Variable','foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0xbd')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0x84e1('0x14b')](db[_0x84e1('0x102')],{'as':_0x84e1('0x102'),'foreignKey':_0x84e1('0x15d')});db['Dynamics365Configuration'][_0x84e1('0x10e')](db[_0x84e1('0x1d5')],{'as':_0x84e1('0x1be'),'onDelete':_0x84e1('0x10c'),'foreignKey':'SubjectId'});db[_0x84e1('0x1d6')][_0x84e1('0x10e')](db[_0x84e1('0x1d5')],{'as':'Descriptions','onDelete':_0x84e1('0x10c'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x84e1('0x10e')](db[_0x84e1('0x1d5')],{'as':_0x84e1('0x1b9'),'onDelete':_0x84e1('0x10c'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x84e1('0x14b')](db[_0x84e1('0xbd')],{'as':_0x84e1('0x173'),'foreignKey':'AccountId'});db[_0x84e1('0x1d5')][_0x84e1('0x10e')](db[_0x84e1('0x1d5')],{'as':_0x84e1('0x1c2'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0x1d5')][_0x84e1('0x10e')](db[_0x84e1('0x1d5')],{'as':_0x84e1('0x1c7'),'foreignKey':'DescriptionId'});db[_0x84e1('0x1d5')]['hasMany'](db[_0x84e1('0x1d5')],{'as':_0x84e1('0x1cb'),'foreignKey':_0x84e1('0x1c1')});db[_0x84e1('0x1d5')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0xc0')][_0x84e1('0x10e')](db[_0x84e1('0xc2')],{'as':_0x84e1('0x1bc'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0xc2')][_0x84e1('0x10e')](db[_0x84e1('0xc4')],{'as':_0x84e1('0x1be'),'foreignKey':_0x84e1('0x1c3')});db[_0x84e1('0xc2')][_0x84e1('0x10e')](db[_0x84e1('0xc4')],{'as':_0x84e1('0x1bf'),'foreignKey':_0x84e1('0x1c0')});db[_0x84e1('0xc2')]['hasMany'](db[_0x84e1('0xc4')],{'as':_0x84e1('0x1b9'),'foreignKey':'FieldId'});db[_0x84e1('0xc2')][_0x84e1('0x14b')](db[_0x84e1('0xc0')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1bd')});db[_0x84e1('0xc4')]['hasMany'](db[_0x84e1('0xc4')],{'as':_0x84e1('0x1c2'),'foreignKey':'SubjectId'});db[_0x84e1('0xc4')][_0x84e1('0x10e')](db[_0x84e1('0xc4')],{'as':'Description','foreignKey':_0x84e1('0x1c0')});db['FreshsalesField']['hasMany'](db[_0x84e1('0xc4')],{'as':_0x84e1('0x1cb'),'foreignKey':'FieldId'});db[_0x84e1('0xc4')][_0x84e1('0x14b')](db[_0x84e1('0x1c4')],{'as':'Variable','foreignKey':_0x84e1('0x1c5')});db[_0x84e1('0x1d7')][_0x84e1('0x14b')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0x1d7')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0x1d7')][_0x84e1('0x14b')](db[_0x84e1('0x64')],{});db[_0x84e1('0x1d7')][_0x84e1('0x14b')](db[_0x84e1('0x66')],{});db['ChatQueueReport'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{});db[_0x84e1('0x1d7')]['belongsTo'](db[_0x84e1('0x12f')],{});db[_0x84e1('0xc8')][_0x84e1('0x14b')](db['User'],{'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1d8')});db[_0x84e1('0xc8')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1d9')});db['JscriptySessionReport'][_0x84e1('0x10e')](db[_0x84e1('0xcc')],{'foreignKey':_0x84e1('0x1da'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0xce')][_0x84e1('0x10e')](db['JscriptyAnswerReport'],{'foreignKey':_0x84e1('0x1da'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0xd0')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0xd0')]['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0xd0')][_0x84e1('0x14b')](db[_0x84e1('0x54')],{});db[_0x84e1('0xd0')]['belongsTo'](db[_0x84e1('0x56')],{});db[_0x84e1('0xd0')]['belongsTo'](db['User'],{});db[_0x84e1('0xd0')][_0x84e1('0x14b')](db[_0x84e1('0x58')],{});db[_0x84e1('0xd5')][_0x84e1('0x10e')](db[_0x84e1('0xce')],{'foreignKey':_0x84e1('0x1db')});db[_0x84e1('0xd5')][_0x84e1('0x10e')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x84e1('0xd5')][_0x84e1('0x10e')](db[_0x84e1('0xca')],{'foreignKey':_0x84e1('0x1db')});db[_0x84e1('0xdb')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x170'),'through':_0x84e1('0x140')});db['Team'][_0x84e1('0x11f')](db['User'],{'as':'Agents','through':_0x84e1('0x126')});db[_0x84e1('0xdf')][_0x84e1('0x11f')](db[_0x84e1('0x17')],{'through':_0x84e1('0x154'),'as':_0x84e1('0x12d')});db[_0x84e1('0xdf')]['belongsToMany'](db['MailQueue'],{'through':_0x84e1('0x16b'),'as':'MailQueues'});db[_0x84e1('0xdf')][_0x84e1('0x11f')](db[_0x84e1('0x12f')],{'through':_0x84e1('0x1dc'),'as':_0x84e1('0x130')});db[_0x84e1('0xdf')][_0x84e1('0x11f')](db[_0x84e1('0x131')],{'through':_0x84e1('0x181'),'as':_0x84e1('0x132')});db[_0x84e1('0xdf')]['belongsToMany'](db[_0x84e1('0x58')],{'through':_0x84e1('0x186'),'as':'SmsQueues'});db['Team'][_0x84e1('0x11f')](db[_0x84e1('0x5e')],{'through':_0x84e1('0x18e'),'as':'OpenchannelQueues'});db[_0x84e1('0xdf')][_0x84e1('0x11f')](db['WhatsappQueue'],{'through':_0x84e1('0x1dd'),'as':'WhatsappQueues'});db[_0x84e1('0xdf')][_0x84e1('0x11f')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x84e1('0x1de')});db[_0x84e1('0xe1')][_0x84e1('0x10e')](db[_0x84e1('0x71')],{'as':_0x84e1('0x147'),'foreignKey':_0x84e1('0x19c')});db[_0x84e1('0xe1')][_0x84e1('0x10e')](db[_0x84e1('0x75')],{'as':'HopperFinals','foreignKey':_0x84e1('0x19c')});db['Campaign'][_0x84e1('0x10e')](db[_0x84e1('0x76')],{'as':'HopperHistories','foreignKey':_0x84e1('0x19c')});db[_0x84e1('0xe1')][_0x84e1('0x10e')](db[_0x84e1('0x73')],{'as':_0x84e1('0x149'),'foreignKey':_0x84e1('0x19c')});db[_0x84e1('0xe1')][_0x84e1('0x14b')](db[_0x84e1('0x14c')],{'as':_0x84e1('0x14c'),'foreignKey':_0x84e1('0x14d')});db[_0x84e1('0xe1')][_0x84e1('0x14b')](db['Trunk'],{'as':_0x84e1('0x14e'),'foreignKey':_0x84e1('0x1df')});db[_0x84e1('0xe1')]['belongsTo'](db[_0x84e1('0x82')],{'as':_0x84e1('0x82'),'foreignKey':_0x84e1('0x14f')});db[_0x84e1('0xe1')][_0x84e1('0x14b')](db['SquareProject'],{'as':_0x84e1('0xdb'),'foreignKey':_0x84e1('0x1e0')});db[_0x84e1('0xe1')][_0x84e1('0x11f')](db[_0x84e1('0xed')],{'as':_0x84e1('0x125'),'through':_0x84e1('0x1e1')});db[_0x84e1('0xe1')][_0x84e1('0x11f')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x84e1('0x14b')](db[_0x84e1('0x68')],{'as':_0x84e1('0x68'),'foreignKey':_0x84e1('0x175')});db[_0x84e1('0x1e2')][_0x84e1('0x14b')](db[_0x84e1('0x41')],{});db[_0x84e1('0x1e2')][_0x84e1('0x14b')](db[_0x84e1('0x3f')],{});db[_0x84e1('0x1e2')][_0x84e1('0x14b')](db[_0x84e1('0x39')],{'foreignKey':_0x84e1('0x1e3'),'as':_0x84e1('0x1e4')});db[_0x84e1('0x1e2')]['belongsTo'](db[_0x84e1('0x12')],{'foreignKey':_0x84e1('0x1e5'),'as':_0x84e1('0x1e6')});db[_0x84e1('0x1e2')]['belongsTo'](db[_0x84e1('0x12')],{'foreignKey':'ToUserId','as':_0x84e1('0x1e7')});db[_0x84e1('0x1e2')][_0x84e1('0x14b')](db[_0x84e1('0x3b')],{'foreignKey':_0x84e1('0x1e8'),'as':_0x84e1('0x1e9')});db['MailTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x39')],{'foreignKey':_0x84e1('0x1ea'),'as':_0x84e1('0x1eb')});db[_0x84e1('0xe8')][_0x84e1('0x14b')](db['ChatMessage'],{});db[_0x84e1('0xe8')][_0x84e1('0x14b')](db[_0x84e1('0x64')],{});db['ChatTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x60')],{'foreignKey':'FromChatWebsiteId','as':_0x84e1('0x1e4')});db[_0x84e1('0xe8')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'foreignKey':_0x84e1('0x1e5'),'as':'FromAgent'});db['ChatTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'foreignKey':_0x84e1('0x1ec'),'as':'ToAgent'});db['ChatTransferReport']['belongsTo'](db[_0x84e1('0x12f')],{'foreignKey':_0x84e1('0x1ed'),'as':'ToQueue'});db['ChatTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x60')],{'foreignKey':_0x84e1('0x1ee'),'as':_0x84e1('0x1eb')});db['FaxTransferReport']['belongsTo'](db['FaxMessage'],{});db[_0x84e1('0xe9')][_0x84e1('0x14b')](db[_0x84e1('0x4a')],{});db[_0x84e1('0xe9')][_0x84e1('0x14b')](db['FaxAccount'],{'foreignKey':_0x84e1('0x1ef'),'as':_0x84e1('0x1e4')});db['FaxTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'foreignKey':_0x84e1('0x1e5'),'as':'FromAgent'});db[_0x84e1('0xe9')]['belongsTo'](db['User'],{'foreignKey':_0x84e1('0x1ec'),'as':'ToAgent'});db[_0x84e1('0xe9')][_0x84e1('0x14b')](db[_0x84e1('0x131')],{'foreignKey':_0x84e1('0x1f0'),'as':_0x84e1('0x1e9')});db[_0x84e1('0xe9')][_0x84e1('0x14b')](db[_0x84e1('0x138')],{'foreignKey':_0x84e1('0x1f1'),'as':_0x84e1('0x1eb')});db['OpenchannelTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0x188')],{});db[_0x84e1('0x1f2')][_0x84e1('0x14b')](db[_0x84e1('0x116')],{});db[_0x84e1('0x1f2')]['belongsTo'](db[_0x84e1('0x5a')],{'foreignKey':_0x84e1('0x1f3'),'as':_0x84e1('0x1e4')});db[_0x84e1('0x1f2')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'foreignKey':'FromUserId','as':_0x84e1('0x1e6')});db[_0x84e1('0x1f2')][_0x84e1('0x14b')](db['User'],{'foreignKey':'ToUserId','as':_0x84e1('0x1e7')});db[_0x84e1('0x1f2')][_0x84e1('0x14b')](db['OpenchannelQueue'],{'foreignKey':_0x84e1('0x1f4'),'as':_0x84e1('0x1e9')});db[_0x84e1('0x1f2')][_0x84e1('0x14b')](db[_0x84e1('0x5a')],{'foreignKey':_0x84e1('0x1f5'),'as':_0x84e1('0x1eb')});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db[_0x84e1('0x56')],{});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db[_0x84e1('0x54')],{});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db[_0x84e1('0x51')],{'foreignKey':'FromSmsAccountId','as':_0x84e1('0x1e4')});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db['User'],{'foreignKey':_0x84e1('0x1e5'),'as':_0x84e1('0x1e6')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x84e1('0x1ec'),'as':_0x84e1('0x1e7')});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db['SmsQueue'],{'foreignKey':_0x84e1('0x1f7'),'as':_0x84e1('0x1e9')});db[_0x84e1('0x1f6')][_0x84e1('0x14b')](db[_0x84e1('0x51')],{'foreignKey':_0x84e1('0x1f8'),'as':_0x84e1('0x1eb')});db[_0x84e1('0xed')][_0x84e1('0x10e')](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x167'),'onDelete':_0x84e1('0x10c')});db[_0x84e1('0xed')]['hasMany'](db['CmCustomField'],{'as':_0x84e1('0x1f9'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0xed')][_0x84e1('0x10e')](db['CmContact'],{'as':_0x84e1('0x123'),'onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0xed')]['hasMany'](db[_0x84e1('0x75')],{'as':'HopperFinals','foreignKey':_0x84e1('0x167')});db[_0x84e1('0xed')][_0x84e1('0x10e')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x84e1('0x167')});db[_0x84e1('0xed')]['hasMany'](db[_0x84e1('0x77')],{'as':_0x84e1('0x77'),'foreignKey':_0x84e1('0x167')});db['CmList'][_0x84e1('0x11f')](db['VoiceQueue'],{'as':'Queues','through':_0x84e1('0x152')});db[_0x84e1('0xed')]['belongsToMany'](db[_0x84e1('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0x84e1('0x10e')](db[_0x84e1('0x112')],{'as':'Extensions','onDelete':_0x84e1('0x10c')});db[_0x84e1('0xef')][_0x84e1('0x11f')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0x84e1('0xef')][_0x84e1('0x11f')](db[_0x84e1('0xdf')],{'through':_0x84e1('0x105'),'as':_0x84e1('0x153')});db[_0x84e1('0xf1')][_0x84e1('0x10e')](db['User'],{'as':_0x84e1('0x170'),'foreignKey':_0x84e1('0x11e')});db['UserProfile'][_0x84e1('0x10e')](db[_0x84e1('0xf3')],{'as':_0x84e1('0x1fa'),'foreignKey':'userProfileId','onDelete':_0x84e1('0x10c')});db[_0x84e1('0xf3')]['hasMany'](db[_0x84e1('0xf4')],{'as':_0x84e1('0x1fb'),'foreignKey':'sectionId','onDelete':_0x84e1('0x10c')});db['WhatsappAccount']['hasMany'](db[_0x84e1('0x7f')],{'as':_0x84e1('0x161'),'foreignKey':_0x84e1('0x1fc'),'onDelete':'cascade'});db[_0x84e1('0xf7')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x84e1('0x1fc')});db[_0x84e1('0xf7')][_0x84e1('0x10e')](db[_0x84e1('0xfc')],{'as':'Messages','foreignKey':_0x84e1('0x1fc')});db[_0x84e1('0xf7')][_0x84e1('0x10e')](db[_0x84e1('0xfa')],{'as':_0x84e1('0x164')});db['WhatsappAccount']['hasMany'](db[_0x84e1('0x1fd')],{'as':_0x84e1('0x17a')});db['WhatsappAccount'][_0x84e1('0x14b')](db['CmList'],{'as':'List','foreignKey':_0x84e1('0x167')});db[_0x84e1('0xf7')][_0x84e1('0x14b')](db['Pause'],{'as':_0x84e1('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x84e1('0xf7')][_0x84e1('0x11f')](db['User'],{'as':_0x84e1('0x169'),'through':'user_has_whatsapp_accounts'});db[_0x84e1('0x1fd')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'onDelete':_0x84e1('0x15e')});db['WhatsappApplication']['belongsTo'](db[_0x84e1('0x100')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x1fd')][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x1fd')][_0x84e1('0x14b')](db[_0x84e1('0x82')],{'onDelete':_0x84e1('0x15e'),'foreignKey':_0x84e1('0x14f')});db['WhatsappApplication'][_0x84e1('0x14b')](db['Tag'],{'onDelete':_0x84e1('0x15e'),'foreignKey':'TagId'});db[_0x84e1('0xfa')][_0x84e1('0x10e')](db[_0x84e1('0xfc')],{'as':'Messages','onDelete':_0x84e1('0x10c'),'foreignKey':_0x84e1('0x1fe')});db['WhatsappInteraction'][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1fc')});db[_0x84e1('0xfa')]['belongsTo'](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db[_0x84e1('0xfa')]['belongsTo'](db[_0x84e1('0x12')],{'as':_0x84e1('0x16d'),'foreignKey':_0x84e1('0x10d')});db[_0x84e1('0xfa')][_0x84e1('0x11f')](db['Tag'],{'through':_0x84e1('0x1ac'),'as':_0x84e1('0x17e')});db[_0x84e1('0xfa')]['belongsToMany'](db['Tag'],{'through':_0x84e1('0x1ac'),'as':_0x84e1('0x17f')});db[_0x84e1('0xfa')][_0x84e1('0x11f')](db[_0x84e1('0x12')],{'as':_0x84e1('0x170'),'through':_0x84e1('0x1ff'),'foreignKey':_0x84e1('0x1fe')});db['WhatsappMessage'][_0x84e1('0x14b')](db['User'],{'as':_0x84e1('0x12')});db[_0x84e1('0xfc')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x84e1('0xfc')][_0x84e1('0x14b')](db[_0x84e1('0xfa')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x84e1('0x1fe')});db[_0x84e1('0xfc')][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{'as':_0x84e1('0x173'),'foreignKey':_0x84e1('0x1fc')});db[_0x84e1('0xfe')][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{});db[_0x84e1('0xfe')][_0x84e1('0x14b')](db[_0x84e1('0xed')],{'as':_0x84e1('0x166'),'foreignKey':_0x84e1('0x167')});db[_0x84e1('0xfe')][_0x84e1('0x14b')](db[_0x84e1('0x6f')],{'as':_0x84e1('0x15b'),'foreignKey':_0x84e1('0x178')});db['WhatsappQueueReport'][_0x84e1('0x14b')](db[_0x84e1('0xfa')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x84e1('0x100')],{});db[_0x84e1('0xfe')][_0x84e1('0x14b')](db['WhatsappMessage'],{});db[_0x84e1('0xfe')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{});db[_0x84e1('0x200')][_0x84e1('0x14b')](db['WhatsappMessage'],{});db[_0x84e1('0x200')][_0x84e1('0x14b')](db[_0x84e1('0xfa')],{});db[_0x84e1('0x200')][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{'foreignKey':_0x84e1('0x201'),'as':_0x84e1('0x1e4')});db['WhatsappTransferReport'][_0x84e1('0x14b')](db[_0x84e1('0xf7')],{'foreignKey':_0x84e1('0x202'),'as':'ToAccount'});db[_0x84e1('0x200')][_0x84e1('0x14b')](db[_0x84e1('0x100')],{'foreignKey':_0x84e1('0x203'),'as':_0x84e1('0x1e9')});db[_0x84e1('0x200')][_0x84e1('0x14b')](db['User'],{'foreignKey':_0x84e1('0x1e5'),'as':_0x84e1('0x1e6')});db[_0x84e1('0x200')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'foreignKey':_0x84e1('0x1ec'),'as':_0x84e1('0x1e7')});db[_0x84e1('0x100')]['belongsToMany'](db[_0x84e1('0x12')],{'as':_0x84e1('0x169'),'through':_0x84e1('0x34'),'foreignKey':_0x84e1('0x204')});db['WhatsappQueue'][_0x84e1('0x11f')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x84e1('0x153')});db[_0x84e1('0x109')][_0x84e1('0x14b')](db[_0x84e1('0x12')],{'as':_0x84e1('0x205'),'foreignKey':_0x84e1('0x10d'),'onDelete':_0x84e1('0x10c'),'hooks':!![]});db[_0x84e1('0x102')]['hasOne'](db[_0x84e1('0xbd')],{'as':_0x84e1('0xbd'),'onDelete':'restrict'});db['CloudProvider'][_0x84e1('0x10b')](db[_0x84e1('0x35')],{'as':_0x84e1('0x15f'),'onDelete':_0x84e1('0x15e')});db[_0x84e1('0x102')][_0x84e1('0x10b')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0x84e1('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2345=['OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','MailInteractions','user_has_chat_interactions','FaxInteraction','FaxInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','ChatQueues','SmsQueue','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','CmHopperHistory','HopperHistories','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','hasOne','Smtp','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','ChatOfflineMessageId','DashboardItem','Items','Dispositions','FaxAccountId','Answers','Exntensions','FaxApplication','TagId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','Agent','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmContactId','JscriptySessions','Company','cm_contact_has_tags','CmHopperId','Queue','CampaignId','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','CmContactHasItem','ContactItemType','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','DeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','SquareProject','user_has_teams','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','jstz','determine','sequelize','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','127.0.0.1','database','username','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model'];(function(_0x45441a,_0x47e391){var _0x3637bf=function(_0x3e0f4e){while(--_0x3e0f4e){_0x45441a['push'](_0x45441a['shift']());}};_0x3637bf(++_0x47e391);}(_0x2345,0x11a));var _0x5234=function(_0x310b68,_0x4eef50){_0x310b68=_0x310b68-0x0;var _0x4a2316=_0x2345[_0x310b68];return _0x4a2316;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x5234('0x0'));var timezone=jstz[_0x5234('0x1')]();config[_0x5234('0x2')]=_['defaultsDeep'](config[_0x5234('0x2')],{'database':'motion2','username':'xcall','password':_0x5234('0x3'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5234('0x4'),'dialectOptions':{'charset':_0x5234('0x5')},'logging':![],'timezone':timezone[_0x5234('0x6')](),'define':{'charset':_0x5234('0x7'),'collate':_0x5234('0x8')}}});config[_0x5234('0x9')]=_['defaultsDeep'](config[_0x5234('0x9')],{'database':_0x5234('0xa'),'username':_0x5234('0xb'),'password':'xC@LL1234','options':{'host':_0x5234('0xc'),'port':0xcea,'dialect':_0x5234('0x4'),'dialectOptions':{'charset':_0x5234('0x5')},'logging':![],'timezone':timezone[_0x5234('0x6')](),'define':{'charset':_0x5234('0x7'),'collate':_0x5234('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5234('0x2')][_0x5234('0xd')],config[_0x5234('0x2')][_0x5234('0xe')],config[_0x5234('0x2')]['password'],config['sequelize'][_0x5234('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5234('0x9')][_0x5234('0xd')],config['sequelizeHistory'][_0x5234('0xe')],config[_0x5234('0x9')]['password'],config[_0x5234('0x9')][_0x5234('0xf')])};db[_0x5234('0x10')]=db[_0x5234('0x2')]['import'](_0x5234('0x11'));db[_0x5234('0x12')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x14'));db[_0x5234('0x15')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x16'));db['VoiceExtension']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x17'));db[_0x5234('0x18')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x19'));db[_0x5234('0x1a')]=db[_0x5234('0x2')]['import'](_0x5234('0x1b'));db['VoiceRecording']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/screenRecording/screenRecording.model');db[_0x5234('0x1c')]=db['sequelize']['import'](_0x5234('0x1d'));db[_0x5234('0x1e')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x1f'));db['VoiceCallReport']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x20'));db[_0x5234('0x21')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x22'));db[_0x5234('0x23')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x24'));db[_0x5234('0x25')]=db[_0x5234('0x2')]['import'](_0x5234('0x26'));db[_0x5234('0x27')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x28'));db[_0x5234('0x29')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x2a'));db[_0x5234('0x2b')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x5234('0x2c')]=db['sequelize'][_0x5234('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x5234('0x2d')]=db['sequelize'][_0x5234('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x5234('0x2e')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x2f'));db[_0x5234('0x30')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x31'));db['UserSmsQueue']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x32'));db[_0x5234('0x33')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x34'));db[_0x5234('0x35')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x36'));db[_0x5234('0x37')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x38'));db[_0x5234('0x39')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x5234('0x3a')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x3b'));db[_0x5234('0x3c')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/mailQueue/mailQueue.model');db[_0x5234('0x3d')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x3e'));db[_0x5234('0x3f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x40'));db[_0x5234('0x41')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x42'));db[_0x5234('0x43')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x44'));db[_0x5234('0x45')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x46'));db[_0x5234('0x47')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x48'));db['DashboardItem']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x49'));db[_0x5234('0x4a')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4b'));db['FaxApplication']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4c'));db['FaxInteraction']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4d'));db[_0x5234('0x4e')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/faxMessage/faxMessage.model');db[_0x5234('0x4f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x50'));db[_0x5234('0x51')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x52'));db[_0x5234('0x53')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x54'));db[_0x5234('0x55')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x56'));db[_0x5234('0x57')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x58'));db[_0x5234('0x59')]=db['sequelize']['import'](_0x5234('0x5a'));db['SmsQueue']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x5b'));db[_0x5234('0x5c')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x5d'));db['OpenchannelApplication']=db['sequelize'][_0x5234('0x13')](_0x5234('0x5e'));db[_0x5234('0x5f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x60'));db[_0x5234('0x61')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x62'));db[_0x5234('0x63')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x64'));db[_0x5234('0x65')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x66'));db['OpenchannelQueueReport']=db[_0x5234('0x2')]['import'](_0x5234('0x67'));db[_0x5234('0x68')]=db[_0x5234('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0x5234('0x69')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6a'));db[_0x5234('0x6b')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6c'));db['ChatOfflineMessage']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5234('0x6d')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6e'));db['ChatGroup']=db[_0x5234('0x2')]['import'](_0x5234('0x6f'));db['ChatProactiveAction']=db['sequelize'][_0x5234('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x5234('0x70')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x71'));db[_0x5234('0x72')]=db[_0x5234('0x2')]['import'](_0x5234('0x73'));db[_0x5234('0x74')]=db['sequelize']['import'](_0x5234('0x75'));db[_0x5234('0x76')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x77'));db['CmHopperFinal']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x78'));db['CmHopperHistory']=db[_0x5234('0x2')]['import'](_0x5234('0x79'));db[_0x5234('0x7a')]=db[_0x5234('0x2')]['import'](_0x5234('0x7b'));db[_0x5234('0x7c')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x7d'));db['Action']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x7e'));db[_0x5234('0x7f')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x80'));db[_0x5234('0x81')]=db[_0x5234('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x5234('0x82')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x83'));db[_0x5234('0x84')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x85'));db['Interval']=db[_0x5234('0x2')]['import'](_0x5234('0x86'));db[_0x5234('0x87')]=db[_0x5234('0x2')]['import'](_0x5234('0x88'));db[_0x5234('0x89')]=db['sequelize'][_0x5234('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8a'));db[_0x5234('0x8b')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8c'));db['Sound']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8d'));db['ContactItemType']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8e'));db['CmContactHasItem']=db['sequelize']['import'](_0x5234('0x8f'));db[_0x5234('0x90')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x91'));db['Template']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x92'));db['Trigger']=db['sequelize'][_0x5234('0x13')](_0x5234('0x93'));db[_0x5234('0x94')]=db['sequelize']['import']('../api/variable/variable.model');db[_0x5234('0x95')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/integration/integration.model');db[_0x5234('0x96')]=db[_0x5234('0x2')]['import'](_0x5234('0x97'));db[_0x5234('0x98')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x5234('0x99')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x9a'));db['AnalyticExtractedReport']=db[_0x5234('0x2')]['import'](_0x5234('0x9b'));db[_0x5234('0x9c')]=db[_0x5234('0x2')]['import'](_0x5234('0x9d'));db['AnalyticFieldReport']=db['sequelize']['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x5234('0x9e')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x9f'));db[_0x5234('0xa0')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xa1'));db[_0x5234('0xa2')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x5234('0xa3')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xa4'));db[_0x5234('0xa5')]=db['sequelize'][_0x5234('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x5234('0xa6')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x5234('0xa7')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xa8'));db['DeskAccount']=db['sequelize'][_0x5234('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x5234('0xa9')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xaa'));db[_0x5234('0xab')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xac'));db[_0x5234('0xad')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xae'));db[_0x5234('0xaf')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x5234('0xb0')]=db['sequelize']['import'](_0x5234('0xb1'));db[_0x5234('0xb2')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xb3'));db[_0x5234('0xb4')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x5234('0xb5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xb6'));db[_0x5234('0xb7')]=db[_0x5234('0x2')]['import'](_0x5234('0xb8'));db[_0x5234('0xb9')]=db[_0x5234('0x2')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x5234('0xba')]=db['sequelize']['import'](_0x5234('0xbb'));db[_0x5234('0xbc')]=db[_0x5234('0x2')]['import'](_0x5234('0xbd'));db['VtigerConfiguration']=db['sequelize'][_0x5234('0x13')](_0x5234('0xbe'));db['VtigerField']=db['sequelize'][_0x5234('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x5234('0xbf')]=db[_0x5234('0x2')]['import'](_0x5234('0xc0'));db['ServicenowConfiguration']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc1'));db[_0x5234('0xc2')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xc3'));db['Dynamics365Account']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc4'));db[_0x5234('0xc5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc6'));db[_0x5234('0xc7')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc8'));db[_0x5234('0xc9')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xca'));db['FreshsalesConfiguration']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xcb'));db[_0x5234('0x95')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xcc'));db['Network']=db[_0x5234('0x2')]['import'](_0x5234('0xcd'));db[_0x5234('0xce')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x5234('0xcf')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd0'));db[_0x5234('0xd1')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xd2'));db['JscriptyQuestionReport']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd3'));db[_0x5234('0xd4')]=db['sequelize']['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x5234('0xd5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd6'));db[_0x5234('0xd7')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xd8'));db[_0x5234('0xd9')]=db[_0x5234('0x2')]['import'](_0x5234('0xda'));db['JscriptyProject']=db['sequelize']['import'](_0x5234('0xdb'));db[_0x5234('0xdc')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xdd'));db[_0x5234('0xde')]=db[_0x5234('0x2')]['import'](_0x5234('0xdf'));db['SquareProject']=db[_0x5234('0x2')]['import'](_0x5234('0xe0'));db['SquareRecording']=db['sequelize'][_0x5234('0x13')]('../api/squareRecording/squareRecording.model');db[_0x5234('0xe1')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/squareMessage/squareMessage.model');db[_0x5234('0xe2')]=db[_0x5234('0x2')]['import'](_0x5234('0xe3'));db[_0x5234('0xe4')]=db['sequelize']['import']('../api/license/license.model');db[_0x5234('0xe5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xe6'));db['Migration']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xe7'));db[_0x5234('0xe8')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xe9'));db[_0x5234('0xea')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xeb'));db[_0x5234('0xec')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xed'));db['ChatTransferReport']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x5234('0x2')]['import'](_0x5234('0xee'));db[_0x5234('0xef')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf0'));db[_0x5234('0xf1')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf2'));db['CmList']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf3'));db[_0x5234('0xf4')]=db[_0x5234('0x2')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x5234('0xf5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf6'));db['UserProfileSection']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf7'));db[_0x5234('0xf8')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf9'));db['UserNotification']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xfa'));db['WhatsappAccount']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xfb'));db[_0x5234('0xfc')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xfd'));db[_0x5234('0xfe')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x5234('0xff')]=db[_0x5234('0x2')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x5234('0x100')]=db['sequelize'][_0x5234('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5234('0x101')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x102'));db[_0x5234('0x103')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x104'));db[_0x5234('0x105')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x106'));db[_0x5234('0x107')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x108'));db[_0x5234('0x109')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x10a'));db['UserVoicePrefix']=db[_0x5234('0x2')]['import'](_0x5234('0x10b'));db[_0x5234('0x10c')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0x5234('0x10')]['hasOne'](db[_0x5234('0x1c')],{'as':_0x5234('0x1c'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x10e')});db['User']['hasOne'](db[_0x5234('0x10c')],{'as':_0x5234('0x10f'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x111')],{'as':_0x5234('0x112'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x2c')],{'as':_0x5234('0x113'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db[_0x5234('0x114')],{'as':_0x5234('0x115'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db['User'][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db['CmHopperHistory'],{'as':_0x5234('0x117'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db[_0x5234('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x5f')],{'as':_0x5234('0x118'),'foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db[_0x5234('0x69')],{'as':_0x5234('0x119'),'foreignKey':'UserId'});db['User'][_0x5234('0x110')](db['SmsInteraction'],{'as':_0x5234('0x11a'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db['User'][_0x5234('0x110')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db[_0x5234('0x11b')],{'as':_0x5234('0x11c'),'foreignKey':_0x5234('0x11d')});db[_0x5234('0x10')][_0x5234('0x11e')](db[_0x5234('0xf5')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x120')],{'as':'Groups','through':_0x5234('0x121')});db[_0x5234('0x10')][_0x5234('0x11f')](db['CmContact'],{'as':_0x5234('0x122'),'through':_0x5234('0x123')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x124')],{'as':_0x5234('0x125'),'through':_0x5234('0x126')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':'user_has_teams'});db[_0x5234('0x10')][_0x5234('0x11f')](db['MailInteraction'],{'as':_0x5234('0x127'),'through':'user_has_mail_interactions'});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x69')],{'as':_0x5234('0x119'),'through':_0x5234('0x128')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x129')],{'as':_0x5234('0x12a'),'through':'user_has_fax_interactions'});db[_0x5234('0x10')][_0x5234('0x11f')](db['SmsInteraction'],{'as':_0x5234('0x11a'),'through':_0x5234('0x12b')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x5f')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0xfe')],{'as':_0x5234('0x12c'),'through':_0x5234('0x12d')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x1a')],{'as':_0x5234('0x12e'),'through':_0x5234('0x12f'),'required':![]});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0xf4')],{'as':_0x5234('0x130'),'through':_0x5234('0x131'),'required':![]});db['User'][_0x5234('0x11f')](db['MailQueue'],{'as':'MailQueues','through':_0x5234('0x2e'),'required':![]});db['User'][_0x5234('0x11f')](db['ChatQueue'],{'as':_0x5234('0x132'),'through':_0x5234('0x2d'),'required':![],'hooks':!![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x4f')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x133')],{'as':_0x5234('0x134'),'through':'UserSmsQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x63')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x5234('0x10')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x5234('0x135'),'through':'UserWhatsappQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db['CmList'],{'through':_0x5234('0x126')});db[_0x5234('0x10')][_0x5234('0x11f')](db['ChatWebsite'],{'as':_0x5234('0x136'),'through':_0x5234('0x137')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x4a')],{'as':_0x5234('0x138'),'through':_0x5234('0x139')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x3a')],{'as':_0x5234('0x13a'),'through':_0x5234('0x13b')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x5c')],{'as':'OpenchannelAccounts','through':_0x5234('0x13c')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x53')],{'as':_0x5234('0x13d'),'through':_0x5234('0x13e')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x13f')],{'as':_0x5234('0x140'),'through':_0x5234('0x141')});db['User'][_0x5234('0x11f')](db['SquareProject'],{'as':'SquareProjects','through':_0x5234('0x142')});db[_0x5234('0x12')]['hasMany'](db[_0x5234('0x114')],{'as':_0x5234('0x143'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x144')});db[_0x5234('0x15')][_0x5234('0x110')](db['VoiceExtension'],{'onDelete':_0x5234('0x10d')});db[_0x5234('0x114')][_0x5234('0x110')](db[_0x5234('0x114')],{'as':_0x5234('0x145'),'onDelete':'cascade'});db[_0x5234('0x18')][_0x5234('0x11f')](db[_0x5234('0x146')],{'as':_0x5234('0x147'),'through':_0x5234('0x148')});db[_0x5234('0x1a')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x5234('0x149'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')]['hasMany'](db[_0x5234('0x116')],{'as':_0x5234('0x14c'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0x14d')],{'as':_0x5234('0x14e'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':'VoiceQueueId'});db[_0x5234('0x1a')]['hasMany'](db[_0x5234('0x76')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0xd4')],{'as':'JscriptySessions','foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x29'),'foreignKey':_0x5234('0x14f')});db[_0x5234('0x1a')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x150'),'foreignKey':_0x5234('0x151')});db[_0x5234('0x1a')][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':_0x5234('0x153')});db[_0x5234('0x1a')][_0x5234('0x11e')](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x5234('0x11f')](db['CmList'],{'as':_0x5234('0x125'),'through':_0x5234('0x155')});db['VoiceQueue'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x12f')});db['VoiceQueue'][_0x5234('0x11f')](db[_0x5234('0xe2')],{'as':'Teams','through':_0x5234('0x107')});db[_0x5234('0x1a')][_0x5234('0x11f')](db[_0x5234('0x124')],{'as':_0x5234('0x156'),'through':'voice_queues_has_cm_blacklists'});db[_0x5234('0x111')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x157')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x5234('0x10e')});db[_0x5234('0x1c')][_0x5234('0x110')](db['VoiceMailMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x159'),'sourceKey':_0x5234('0x15a')});db['VoiceMailMessage'][_0x5234('0x11e')](db['VoiceMail'],{'foreignKey':_0x5234('0x159'),'targetKey':'mailbox'});db[_0x5234('0x15b')][_0x5234('0x110')](db[_0x5234('0x25')],{'as':_0x5234('0x15c'),'foreignKey':_0x5234('0x15d'),'constraints':![]});db[_0x5234('0x15b')][_0x5234('0x110')](db[_0x5234('0x23')],{'as':_0x5234('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0x5234('0x15b')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10'),'foreignKey':'UserId'});db[_0x5234('0x15b')][_0x5234('0x11e')](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db['MailServerIn'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x3a'),'foreignKey':_0x5234('0x161')});db['MailServerIn'][_0x5234('0x11e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x5234('0x162'),'onDelete':_0x5234('0x163')});db['MailServerOut'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x5234('0x39')][_0x5234('0x11e')](db[_0x5234('0x105')],{'as':_0x5234('0x105'),'foreignKey':_0x5234('0x162'),'onDelete':_0x5234('0x163')});db[_0x5234('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0x5234('0x164'),'onDelete':'cascade'});db[_0x5234('0x3a')][_0x5234('0x165')](db[_0x5234('0x39')],{'as':_0x5234('0x166'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x3a')][_0x5234('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5234('0x161'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x5234('0x81')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x5234('0x3a')]['hasMany'](db[_0x5234('0x41')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x3a')][_0x5234('0x110')](db[_0x5234('0x3f')],{'as':_0x5234('0x167')});db[_0x5234('0x3a')][_0x5234('0x110')](db[_0x5234('0x43')],{'as':'Applications'});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x16a')],{'as':_0x5234('0x16a'),'foreignKey':_0x5234('0x16b')});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x3a')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x16d'),'through':_0x5234('0x13b')});db[_0x5234('0x3c')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x2e')});db[_0x5234('0x3c')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x16e'),'as':_0x5234('0x16f')});db[_0x5234('0x3f')][_0x5234('0x110')](db[_0x5234('0x41')],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x170')});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x3f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x174'),'as':_0x5234('0x175')});db[_0x5234('0x3f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'mail_interaction_has_tags','as':_0x5234('0x176')});db[_0x5234('0x3f')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x177'),'through':_0x5234('0x178'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x5234('0x110')](db[_0x5234('0xe8')],{'as':_0x5234('0x179'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x41')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10')});db['MailMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':'cascade','as':_0x5234('0x15f')});db[_0x5234('0x41')][_0x5234('0x11e')](db[_0x5234('0x3f')],{'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x170')});db['MailMessage'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x41')]['belongsTo'](db[_0x5234('0x65')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x5234('0x41')][_0x5234('0x11e')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x5234('0x17b')});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db['MailApplication'][_0x5234('0x11e')](db['MailQueue'],{'onDelete':_0x5234('0x163')});db[_0x5234('0x43')]['belongsTo'](db[_0x5234('0x3a')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x152')],{'onDelete':_0x5234('0x163'),'foreignKey':'IntervalId'});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x3a')],{});db['MailQueueReport'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x45')][_0x5234('0x11e')](db['MailInteraction'],{});db[_0x5234('0x45')][_0x5234('0x11e')](db['MailMessage'],{});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x10')],{});db[_0x5234('0x45')]['belongsTo'](db[_0x5234('0x3c')],{});db[_0x5234('0x47')][_0x5234('0x110')](db[_0x5234('0x17c')],{'as':_0x5234('0x17d'),'onDelete':'cascade'});db[_0x5234('0x4a')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':_0x5234('0x17f'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x4a')][_0x5234('0x110')](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':_0x5234('0x17f')});db[_0x5234('0x4a')][_0x5234('0x110')](db['FaxInteraction'],{'as':_0x5234('0x167')});db[_0x5234('0x4a')]['hasMany'](db['FaxApplication'],{'as':_0x5234('0x145')});db[_0x5234('0x4a')][_0x5234('0x110')](db['VoiceExtension'],{'as':_0x5234('0x181'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x4a')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x5234('0x4a')][_0x5234('0x11e')](db[_0x5234('0x29')],{'as':_0x5234('0x29')});db['FaxAccount'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x4a')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5234('0x4a')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'user_has_fax_accounts'});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x4f')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x4a')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db[_0x5234('0x129')][_0x5234('0x110')](db[_0x5234('0x4e')],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x184')});db['FaxInteraction'][_0x5234('0x11e')](db[_0x5234('0x4a')],{'as':'Account','foreignKey':_0x5234('0x17f')});db[_0x5234('0x129')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x129')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x129')][_0x5234('0x11f')](db['Tag'],{'through':_0x5234('0x185'),'as':_0x5234('0x175')});db[_0x5234('0x129')]['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x185'),'as':'ThroughTags'});db['FaxInteraction'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':_0x5234('0x186'),'foreignKey':_0x5234('0x184')});db[_0x5234('0x4e')][_0x5234('0x11e')](db['User'],{'onDelete':'cascade','as':_0x5234('0x10')});db['FaxMessage']['belongsTo'](db[_0x5234('0x129')],{'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x184')});db[_0x5234('0x4e')]['belongsTo'](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db[_0x5234('0x4e')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db['FaxMessage'][_0x5234('0x11e')](db['FaxAccount'],{'as':_0x5234('0x171'),'foreignKey':'FaxAccountId'});db[_0x5234('0x4f')][_0x5234('0x11f')](db['User'],{'as':'Agents','through':_0x5234('0x30')});db[_0x5234('0x4f')]['belongsToMany'](db[_0x5234('0xe2')],{'through':_0x5234('0x188'),'as':'Teams'});db[_0x5234('0x51')][_0x5234('0x11e')](db['FaxAccount'],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169')});db[_0x5234('0x51')]['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x5234('0x11e')](db[_0x5234('0x129')],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x4e')],{});db[_0x5234('0x51')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x4f')],{});db[_0x5234('0x53')]['hasMany'](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':_0x5234('0x189'),'onDelete':'cascade'});db[_0x5234('0x53')][_0x5234('0x110')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x5234('0x53')]['hasMany'](db[_0x5234('0x59')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x5234('0x110')](db[_0x5234('0x57')],{'as':_0x5234('0x167')});db[_0x5234('0x53')][_0x5234('0x110')](db[_0x5234('0x55')],{'as':_0x5234('0x145')});db[_0x5234('0x53')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x53')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x53')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x13e')});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db['SmsApplication']['belongsTo'](db[_0x5234('0x133')],{'onDelete':'restrict'});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x53')],{'onDelete':'restrict'});db[_0x5234('0x55')]['belongsTo'](db[_0x5234('0x152')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x57')][_0x5234('0x110')](db['SmsMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x18a')});db[_0x5234('0x57')]['belongsTo'](db[_0x5234('0x53')],{'as':_0x5234('0x171'),'foreignKey':'SmsAccountId'});db[_0x5234('0x57')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5234('0x57')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db['SmsInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x18b'),'as':'Tags'});db['SmsInteraction'][_0x5234('0x11f')](db['Tag'],{'through':_0x5234('0x18b'),'as':_0x5234('0x176')});db[_0x5234('0x57')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_sms_interactions','foreignKey':_0x5234('0x18a')});db[_0x5234('0x59')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10')});db['SmsMessage'][_0x5234('0x11e')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x5234('0x59')][_0x5234('0x11e')](db[_0x5234('0x57')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x5234('0x18a')});db[_0x5234('0x59')][_0x5234('0x11e')](db['SmsAccount'],{'as':_0x5234('0x171'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x16d'),'through':_0x5234('0x18c'),'foreignKey':'SmsQueueId'});db[_0x5234('0x133')][_0x5234('0x11f')](db['Team'],{'through':_0x5234('0x18d'),'as':'Teams'});db[_0x5234('0x5c')][_0x5234('0x110')](db['Disposition'],{'as':_0x5234('0x17e'),'foreignKey':'OpenchannelAccountId','onDelete':_0x5234('0x10d')});db[_0x5234('0x5c')]['hasMany'](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x110')](db['OpenchannelInteraction'],{'as':_0x5234('0x167'),'foreignKey':_0x5234('0x18e')});db['OpenchannelAccount'][_0x5234('0x110')](db[_0x5234('0x61')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x110')](db[_0x5234('0x18f')],{'as':_0x5234('0x145'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x11e')](db['CmList'],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db['OpenchannelAccount']['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db['OpenchannelAccount'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x13c')});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':'restrict'});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x63')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x190')});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'onDelete':_0x5234('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x152')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5234('0x18f')][_0x5234('0x11e')](db['Tag'],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x5f')][_0x5234('0x110')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x191')});db['OpenchannelInteraction'][_0x5234('0x11e')](db[_0x5234('0x5c')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5f')]['belongsTo'](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x5f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x5f')]['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x192'),'as':_0x5234('0x175')});db[_0x5234('0x5f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x5234('0x5f')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_openchannel_interactions','foreignKey':_0x5234('0x191')});db['OpenchannelMessage'][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x10d'),'as':'User'});db['OpenchannelMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db['OpenchannelMessage'][_0x5234('0x11e')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x5234('0x17a'),'foreignKey':'OpenchannelInteractionId'});db[_0x5234('0x61')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db[_0x5234('0x61')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'as':'Account','foreignKey':_0x5234('0x18e')});db[_0x5234('0x63')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x33'),'foreignKey':_0x5234('0x190')});db[_0x5234('0x63')]['belongsToMany'](db[_0x5234('0xe2')],{'through':'team_has_openchannel_queues','as':_0x5234('0x16f')});db[_0x5234('0x65')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':'Dispositions','foreignKey':_0x5234('0x193'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x65')]['hasMany'](db[_0x5234('0x81')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x5234('0x65')][_0x5234('0x110')](db[_0x5234('0x194')],{'as':_0x5234('0x195')});db['ChatWebsite'][_0x5234('0x110')](db[_0x5234('0x69')],{'as':_0x5234('0x167')});db['ChatWebsite'][_0x5234('0x110')](db[_0x5234('0x68')],{'as':_0x5234('0x145')});db[_0x5234('0x65')][_0x5234('0x110')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169')});db['ChatWebsite'][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':'IntervalId'});db[_0x5234('0x65')][_0x5234('0x11e')](db['MailAccount'],{'as':_0x5234('0x3a'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x65')]['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db['ChatWebsite']['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'user_has_chat_websites'});db[_0x5234('0x196')]['belongsTo'](db[_0x5234('0x5c')],{});db[_0x5234('0x196')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x196')]['belongsTo'](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x196')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x5234('0x196')][_0x5234('0x11e')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x5234('0x10')],{});db[_0x5234('0x196')][_0x5234('0x11e')](db[_0x5234('0x63')],{});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x197'),'foreignKey':_0x5234('0x10e'),'onDelete':_0x5234('0x163')});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x6d')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x5234('0x163')});db[_0x5234('0x68')][_0x5234('0x11e')](db[_0x5234('0x65')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x5234('0x163')});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db['ChatInteraction'][_0x5234('0x110')](db['ChatMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x193')});db[_0x5234('0x69')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x69')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':'Owner','foreignKey':_0x5234('0x10e')});db[_0x5234('0x69')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x198'),'as':_0x5234('0x175')});db['ChatInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'chat_interaction_has_tags','as':_0x5234('0x176')});db['ChatInteraction'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_chat_interactions','foreignKey':_0x5234('0x199')});db[_0x5234('0x6b')]['belongsTo'](db['User'],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x10')});db[_0x5234('0x6b')][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':'cascade','as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x6b')]['belongsTo'](db[_0x5234('0x69')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x199')});db[_0x5234('0x6b')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db[_0x5234('0x6b')][_0x5234('0x11e')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x5234('0x193')});db[_0x5234('0x19a')][_0x5234('0x110')](db['Attachment'],{'as':'Attachments','foreignKey':_0x5234('0x17b'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x19a')][_0x5234('0x11e')](db['CmContact'],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x19a')][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x193')});db[_0x5234('0x6d')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'UserChatQueue','hooks':!![]});db[_0x5234('0x6d')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x19b'),'as':'Teams'});db[_0x5234('0x120')]['hasMany'](db[_0x5234('0xcf')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x19c'),'onDelete':_0x5234('0x10d')});db['ChatGroup'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Members','through':'chat_group_has_users'});db[_0x5234('0x194')][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x19d'),'foreignKey':_0x5234('0x193')});db['CmCompany']['hasMany'](db[_0x5234('0x72')],{'as':_0x5234('0x122'),'foreignKey':_0x5234('0x19e')});db[_0x5234('0x72')][_0x5234('0x110')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x5234('0x19f')});db[_0x5234('0x72')]['hasMany'](db[_0x5234('0x74')],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':_0x5234('0x160')});db[_0x5234('0x72')][_0x5234('0x110')](db['CmHopperHistory'],{'as':_0x5234('0x14e'),'foreignKey':'ContactId'});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x72')]['hasMany'](db['JscriptySessionReport'],{'as':_0x5234('0x1a0'),'foreignKey':_0x5234('0x160')});db['CmContact'][_0x5234('0x110')](db[_0x5234('0x5f')],{'as':_0x5234('0x118'),'foreignKey':_0x5234('0x160'),'onDelete':'restrict'});db[_0x5234('0x72')]['hasMany'](db[_0x5234('0x69')],{'as':'ChatInteractions','foreignKey':_0x5234('0x160'),'onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x5234('0x160'),'onDelete':'restrict'});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x129')],{'as':_0x5234('0x12a'),'foreignKey':_0x5234('0x160'),'onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x3f')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x11e')](db[_0x5234('0x70')],{'as':_0x5234('0x1a1'),'foreignKey':_0x5234('0x19e')});db['CmContact']['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169'),'onDelete':_0x5234('0x10d')});db['CmContact'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':_0x5234('0x123')});db[_0x5234('0x72')][_0x5234('0x11f')](db[_0x5234('0x173')],{'as':'Tags','through':_0x5234('0x1a2')});db[_0x5234('0x72')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1a2'),'as':_0x5234('0x176')});db[_0x5234('0x74')]['hasMany'](db[_0x5234('0x90')],{'as':'AdditionalPhones','foreignKey':_0x5234('0x1a3')});db['CmHopper']['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160'),'onDelete':'cascade'});db[_0x5234('0x74')]['belongsTo'](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x74')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x197'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x74')][_0x5234('0x11e')](db['VoiceQueue'],{'as':_0x5234('0x1a4'),'foreignKey':_0x5234('0x14a'),'onDelete':'cascade'});db[_0x5234('0x74')][_0x5234('0x11e')](db[_0x5234('0xe5')],{'as':_0x5234('0xe5'),'foreignKey':_0x5234('0x1a5'),'onDelete':'cascade'});db[_0x5234('0x74')]['belongsTo'](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':'OwnerId'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x5234('0x10d')});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x1a')],{'as':_0x5234('0x1a4'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0xe5')],{'as':'Campaign','foreignKey':_0x5234('0x1a5'),'onDelete':'cascade'});db[_0x5234('0x7f')][_0x5234('0x110')](db['Condition'],{'as':{'plural':'All','singular':_0x5234('0x1a6')},'foreignKey':_0x5234('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x5234('0x7f')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1a8'),'singular':_0x5234('0x1a9')},'foreignKey':'AutomationAnyId','onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x7f')][_0x5234('0x110')](db[_0x5234('0x1aa')],{'as':_0x5234('0x1ab'),'foreignKey':_0x5234('0x1ac'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x5234('0x82')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db[_0x5234('0x152')][_0x5234('0x110')](db[_0x5234('0x152')],{'as':_0x5234('0x1ad'),'foreignKey':_0x5234('0x153'),'onDelete':_0x5234('0x10d'),'hooks':!![],'required':![]});db['Interval'][_0x5234('0x110')](db['VoiceExtension'],{'as':_0x5234('0x115'),'foreignKey':_0x5234('0x153'),'onDelete':_0x5234('0x163')});db['Interval'][_0x5234('0x110')](db[_0x5234('0x43')],{'as':_0x5234('0x1ae'),'foreignKey':_0x5234('0x153')});db[_0x5234('0x152')][_0x5234('0x110')](db[_0x5234('0x68')],{'as':'ChatApplications','foreignKey':_0x5234('0x153')});db['Interval'][_0x5234('0x110')](db[_0x5234('0x182')],{'as':_0x5234('0x1af'),'foreignKey':'IntervalId'});db[_0x5234('0x152')][_0x5234('0x110')](db['SmsApplication'],{'as':_0x5234('0x1b0'),'foreignKey':_0x5234('0x153')});db['Schedule'][_0x5234('0x11e')](db[_0x5234('0x3a')],{});db[_0x5234('0x8b')][_0x5234('0x11e')](db[_0x5234('0x99')],{'foreignKey':_0x5234('0x1b1')});db[_0x5234('0x8b')][_0x5234('0x11e')](db[_0x5234('0x98')],{'foreignKey':'CustomReportId'});db[_0x5234('0x146')][_0x5234('0x11f')](db['VoiceMusicOnHold'],{'as':_0x5234('0x1b2'),'through':_0x5234('0x148'),'onDelete':'restrict'});db[_0x5234('0x173')][_0x5234('0x11f')](db[_0x5234('0x72')],{'through':'cm_contact_has_tags'});db[_0x5234('0x173')]['belongsToMany'](db[_0x5234('0x69')],{'through':_0x5234('0x198')});db['Tag']['belongsToMany'](db[_0x5234('0x3f')],{'through':_0x5234('0x174')});db[_0x5234('0x173')][_0x5234('0x11f')](db[_0x5234('0x57')],{'through':_0x5234('0x18b')});db['Tag'][_0x5234('0x11f')](db[_0x5234('0x129')],{'through':_0x5234('0x185')});db[_0x5234('0x173')][_0x5234('0x11f')](db['OpenchannelInteraction'],{'through':_0x5234('0x192')});db[_0x5234('0x173')]['belongsToMany'](db[_0x5234('0xfe')],{'through':'whatsapp_interaction_has_tags'});db[_0x5234('0x1b3')][_0x5234('0x11e')](db[_0x5234('0x1b4')],{'as':_0x5234('0x1b5'),'foreignKey':_0x5234('0x1b6')});db[_0x5234('0x90')][_0x5234('0x11e')](db[_0x5234('0x74')],{'as':_0x5234('0x1b7'),'foreignKey':_0x5234('0x1a3')});db[_0x5234('0x1b3')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'CmContactId'});db[_0x5234('0x1b8')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1b9'),'singular':_0x5234('0x1ba')},'foreignKey':_0x5234('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0x5234('0x1b8')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1bc'),'singular':_0x5234('0x1bd')},'foreignKey':_0x5234('0x1be'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x1b8')][_0x5234('0x110')](db['Action'],{'as':'Actions','foreignKey':_0x5234('0x1bf'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x98')]['hasMany'](db[_0x5234('0x1c0')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c2'),'hooks':!![]});db['AnalyticDefaultReport'][_0x5234('0x110')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1b1')});db[_0x5234('0x9c')][_0x5234('0x110')](db[_0x5234('0x1c0')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c3')});db['AnalyticFieldReport']['belongsTo'](db[_0x5234('0x9c')],{'foreignKey':_0x5234('0x1c3')});db['SalesforceAccount'][_0x5234('0x110')](db[_0x5234('0xa2')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa2')]['hasMany'](db[_0x5234('0xa3')],{'as':_0x5234('0x1c6'),'onDelete':_0x5234('0x10d'),'foreignKey':'SubjectId'});db[_0x5234('0xa2')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1c7'),'onDelete':'cascade','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa2')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db['SalesforceConfiguration']['belongsTo'](db[_0x5234('0xa0')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa3')]['hasMany'](db[_0x5234('0xa3')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db['SalesforceField'][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa3')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db['SalesforceField'][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xa5')][_0x5234('0x110')](db[_0x5234('0xa6')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa6')][_0x5234('0x11e')](db['SugarcrmAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa7')]['belongsTo'](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['DeskAccount'][_0x5234('0x110')](db[_0x5234('0xa9')],{'as':_0x5234('0x1c4'),'onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa9')][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db['DeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xa9')][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa9')][_0x5234('0x11e')](db[_0x5234('0x1cf')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db[_0x5234('0xa9')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'int_desk_configuration_has_tags'});db[_0x5234('0xab')]['hasMany'](db[_0x5234('0xab')],{'as':_0x5234('0x1ca'),'foreignKey':'SubjectId'});db[_0x5234('0xab')]['hasMany'](db[_0x5234('0xab')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db['DeskField'][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0xab')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['ZohoAccount']['hasMany'](db[_0x5234('0xaf')],{'as':_0x5234('0x1c4'),'onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db['ZohoConfiguration'][_0x5234('0x110')](db[_0x5234('0xb0')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db['ZohoConfiguration']['hasMany'](db[_0x5234('0xb0')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xaf')][_0x5234('0x110')](db['ZohoField'],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x5234('0x11e')](db[_0x5234('0xad')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db['ZohoField'][_0x5234('0x110')](db['ZohoField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xb0')]['hasMany'](db[_0x5234('0xb0')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xb0')][_0x5234('0x110')](db[_0x5234('0xb0')],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xb0')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':'VariableId'});db[_0x5234('0xb2')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb4')][_0x5234('0x110')](db[_0x5234('0xb5')],{'as':_0x5234('0x1c6'),'foreignKey':'SubjectId'});db[_0x5234('0xb4')]['hasMany'](db[_0x5234('0xb5')],{'as':_0x5234('0x1c7'),'foreignKey':_0x5234('0x1c8')});db['ZendeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xb5')],{'as':_0x5234('0x1c1'),'foreignKey':'FieldId'});db[_0x5234('0xb4')][_0x5234('0x11e')](db[_0x5234('0xb2')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb4')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1d0')});db[_0x5234('0xb5')][_0x5234('0x110')](db['ZendeskField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db['ZendeskField']['hasMany'](db[_0x5234('0xb5')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xb5')]['hasMany'](db[_0x5234('0xb5')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db['ZendeskField'][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['FreshdeskAccount'][_0x5234('0x110')](db[_0x5234('0xb9')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db['FreshdeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c6'),'onDelete':_0x5234('0x10d'),'foreignKey':'SubjectId'});db[_0x5234('0xb9')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xb9')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':'FieldId'});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb9')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1d1')});db[_0x5234('0xba')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':'Subject','foreignKey':_0x5234('0x1cb')});db[_0x5234('0xba')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5234('0xba')]['hasMany'](db[_0x5234('0xba')],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xba')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xbc')]['hasMany'](db[_0x5234('0x1d2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d2')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['VtigerConfiguration'][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c7'),'foreignKey':_0x5234('0x1c8')});db['VtigerConfiguration']['hasMany'](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c1'),'foreignKey':'FieldId'});db[_0x5234('0x1d2')][_0x5234('0x11e')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d3')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x5234('0x1cb')});db[_0x5234('0x1d3')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0x1d3')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0x1d3')]['belongsTo'](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':'VariableId'});db[_0x5234('0xbf')][_0x5234('0x110')](db[_0x5234('0x1d4')],{'as':'Configurations','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d4')][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['ServicenowConfiguration'][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':_0x5234('0x1c7'),'foreignKey':'DescriptionId'});db[_0x5234('0x1d4')][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':'Fields','foreignKey':_0x5234('0x1c9')});db[_0x5234('0x1d4')][_0x5234('0x11e')](db[_0x5234('0xbf')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xc2')]['hasMany'](db[_0x5234('0xc2')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xc2')][_0x5234('0x110')](db['ServicenowField'],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc2')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc2')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0x1d5')]['hasMany'](db[_0x5234('0xc5')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d5')][_0x5234('0x11e')](db[_0x5234('0x105')],{'as':_0x5234('0x105'),'foreignKey':_0x5234('0x162')});db[_0x5234('0xc5')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':'Subjects','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xc5')]['hasMany'](db[_0x5234('0xc7')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc5')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':_0x5234('0x1c1'),'onDelete':'cascade','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc5')]['belongsTo'](db[_0x5234('0x1d5')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db['Dynamics365Field']['hasMany'](db[_0x5234('0xc7')],{'as':_0x5234('0x1ca'),'foreignKey':'SubjectId'});db[_0x5234('0xc7')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc7')][_0x5234('0x110')](db['Dynamics365Field'],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc7')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xc9')][_0x5234('0x110')](db[_0x5234('0x1d6')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d6')]['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['FreshsalesConfiguration'][_0x5234('0x110')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x5234('0x1c8')});db['FreshsalesConfiguration']['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1c1'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0x1d6')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d7')]['hasMany'](db['FreshsalesField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0x1d7')][_0x5234('0x110')](db[_0x5234('0x1d7')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0x1d7')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xce')]['belongsTo'](db[_0x5234('0x65')],{});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x69')],{});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x6b')],{});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x10')],{});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x6d')],{});db[_0x5234('0xcf')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x5234('0xcf')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1d8')});db[_0x5234('0xd4')][_0x5234('0x110')](db[_0x5234('0x1d9')],{'foreignKey':_0x5234('0x1da'),'onDelete':_0x5234('0x10d')});db[_0x5234('0xd4')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x5234('0x1da'),'onDelete':_0x5234('0x10d')});db[_0x5234('0xd5')][_0x5234('0x11e')](db['SmsAccount'],{});db[_0x5234('0xd5')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0xd5')][_0x5234('0x11e')](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x57')],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x59')],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x133')],{});db[_0x5234('0x1db')]['hasMany'](db[_0x5234('0xd4')],{'foreignKey':'ProjectId'});db[_0x5234('0x1db')][_0x5234('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0x5234('0x1dc')});db[_0x5234('0x1db')]['hasMany'](db[_0x5234('0xd1')],{'foreignKey':_0x5234('0x1dc')});db[_0x5234('0x1dd')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x177'),'through':_0x5234('0x142')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x1de')});db[_0x5234('0xe2')]['belongsToMany'](db[_0x5234('0x1a')],{'through':_0x5234('0x107'),'as':_0x5234('0x12e')});db[_0x5234('0xe2')][_0x5234('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x5234('0xe2')]['belongsToMany'](db[_0x5234('0x6d')],{'through':_0x5234('0x19b'),'as':_0x5234('0x132')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x4f')],{'through':_0x5234('0x188'),'as':_0x5234('0x1df')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x133')],{'through':_0x5234('0x18d'),'as':_0x5234('0x134')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x63')],{'through':_0x5234('0x1e0'),'as':'OpenchannelQueues'});db[_0x5234('0xe2')][_0x5234('0x11f')](db['WhatsappQueue'],{'through':_0x5234('0x1e1'),'as':_0x5234('0x135')});db['Team'][_0x5234('0x11f')](db['VoicePrefix'],{'through':_0x5234('0x109'),'as':_0x5234('0x130')});db[_0x5234('0xe5')][_0x5234('0x110')](db['CmHopper'],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x5234('0xe5')][_0x5234('0x110')](db[_0x5234('0x14d')],{'as':_0x5234('0x14e'),'foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x110')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x29'),'foreignKey':_0x5234('0x14f')});db[_0x5234('0xe5')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x150'),'foreignKey':_0x5234('0x151')});db[_0x5234('0xe5')][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':_0x5234('0x153')});db[_0x5234('0xe5')][_0x5234('0x11e')](db[_0x5234('0x1dd')],{'as':_0x5234('0x1dd'),'foreignKey':_0x5234('0x1e2')});db[_0x5234('0xe5')][_0x5234('0x11f')](db[_0x5234('0x124')],{'as':_0x5234('0x125'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x5234('0x11f')](db['CmList'],{'as':_0x5234('0x156'),'through':_0x5234('0x1e3')});db['Attachment'][_0x5234('0x11e')](db[_0x5234('0x19a')],{'as':'ChatOfflineMessage','foreignKey':_0x5234('0x17b')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x41')],{});db['MailTransferReport']['belongsTo'](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0x5234('0x3a')],{'foreignKey':_0x5234('0x1e4'),'as':_0x5234('0x1e5')});db['MailTransferReport'][_0x5234('0x11e')](db['User'],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['MailTransferReport'][_0x5234('0x11e')](db[_0x5234('0x3c')],{'foreignKey':_0x5234('0x1ea'),'as':_0x5234('0x1eb')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x3a')],{'foreignKey':_0x5234('0x1ec'),'as':_0x5234('0x1ed')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x6b')],{});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x69')],{});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x65')],{'foreignKey':'FromChatWebsiteId','as':_0x5234('0x1e5')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x6d')],{'foreignKey':_0x5234('0x1ef'),'as':_0x5234('0x1eb')});db['ChatTransferReport'][_0x5234('0x11e')](db[_0x5234('0x65')],{'foreignKey':_0x5234('0x1f0'),'as':'ToAccount'});db[_0x5234('0x1f1')]['belongsTo'](db[_0x5234('0x4e')],{});db[_0x5234('0x1f1')]['belongsTo'](db[_0x5234('0x129')],{});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x4a')],{'foreignKey':_0x5234('0x1f2'),'as':_0x5234('0x1e5')});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':'FromUserId','as':_0x5234('0x1e7')});db[_0x5234('0x1f1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x4f')],{'foreignKey':_0x5234('0x1f3'),'as':_0x5234('0x1eb')});db[_0x5234('0x1f1')][_0x5234('0x11e')](db[_0x5234('0x4a')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x5234('0x61')],{});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x5f')],{});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'foreignKey':_0x5234('0x1f4'),'as':_0x5234('0x1e5')});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e6'),'as':'FromAgent'});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['OpenchannelTransferReport'][_0x5234('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x5234('0x1f5'),'as':_0x5234('0x1eb')});db['OpenchannelTransferReport'][_0x5234('0x11e')](db['OpenchannelAccount'],{'foreignKey':_0x5234('0x1f6'),'as':_0x5234('0x1ed')});db[_0x5234('0xf1')][_0x5234('0x11e')](db['SmsMessage'],{});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x57')],{});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x53')],{'foreignKey':_0x5234('0x1f7'),'as':'FromAccount'});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':'ToAgent'});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x133')],{'foreignKey':_0x5234('0x1f8'),'as':_0x5234('0x1eb')});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x53')],{'foreignKey':_0x5234('0x1f9'),'as':'ToAccount'});db[_0x5234('0x124')][_0x5234('0x110')](db['Disposition'],{'as':_0x5234('0x17e'),'foreignKey':'ListId','onDelete':_0x5234('0x10d')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x7c')],{'as':_0x5234('0x1fa'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x124')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x5234('0x124')][_0x5234('0x110')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x5234('0x169')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':'ListId'});db[_0x5234('0x124')]['belongsToMany'](db[_0x5234('0x1a')],{'as':_0x5234('0x1fb'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x126')});db[_0x5234('0xf4')][_0x5234('0x110')](db[_0x5234('0x114')],{'as':'Extensions','onDelete':_0x5234('0x10d')});db[_0x5234('0xf4')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'UserVoicePrefix'});db[_0x5234('0xf4')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x109'),'as':_0x5234('0x16f')});db[_0x5234('0xf5')][_0x5234('0x110')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'foreignKey':_0x5234('0x1fc')});db[_0x5234('0xf5')][_0x5234('0x110')](db[_0x5234('0x1fd')],{'as':_0x5234('0x1fe'),'foreignKey':_0x5234('0x1fc'),'onDelete':'cascade'});db[_0x5234('0x1fd')][_0x5234('0x110')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x5234('0x1ff'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':'WhatsappAccountId','onDelete':_0x5234('0x10d')});db['WhatsappAccount'][_0x5234('0x110')](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':'WhatsappAccountId'});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xff')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x200')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xfe')],{'as':_0x5234('0x167')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xfc')],{'as':_0x5234('0x145')});db['WhatsappAccount'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db[_0x5234('0x13f')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x13f')]['belongsToMany'](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x141')});db[_0x5234('0xfc')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x5234('0xfc')][_0x5234('0x11e')](db[_0x5234('0x103')],{'onDelete':_0x5234('0x163')});db['WhatsappApplication'][_0x5234('0x11e')](db[_0x5234('0x13f')],{'onDelete':_0x5234('0x163')});db[_0x5234('0xfc')][_0x5234('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x5234('0x153')});db[_0x5234('0xfc')]['belongsTo'](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db[_0x5234('0xfe')][_0x5234('0x110')](db[_0x5234('0xff')],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x5234('0x11e')](db[_0x5234('0x13f')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x200')});db[_0x5234('0xfe')]['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db['WhatsappInteraction']['belongsTo'](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db['WhatsappInteraction']['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x201'),'as':'Tags'});db['WhatsappInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'whatsapp_interaction_has_tags','as':_0x5234('0x176')});db[_0x5234('0xfe')]['belongsToMany'](db['User'],{'as':'Users','through':_0x5234('0x12d'),'foreignKey':_0x5234('0x202')});db[_0x5234('0xff')][_0x5234('0x11e')](db['User'],{'as':_0x5234('0x10')});db['WhatsappMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db[_0x5234('0xff')][_0x5234('0x11e')](db[_0x5234('0xfe')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x5234('0x202')});db[_0x5234('0xff')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'as':'Account','foreignKey':_0x5234('0x200')});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x13f')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0xfe')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x103')],{});db[_0x5234('0x100')]['belongsTo'](db[_0x5234('0xff')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0xff')],{});db[_0x5234('0x101')][_0x5234('0x11e')](db['WhatsappInteraction'],{});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'foreignKey':_0x5234('0x203'),'as':_0x5234('0x1e5')});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'foreignKey':_0x5234('0x204'),'as':_0x5234('0x1ed')});db[_0x5234('0x101')][_0x5234('0x11e')](db['WhatsappQueue'],{'foreignKey':_0x5234('0x205'),'as':_0x5234('0x1eb')});db[_0x5234('0x101')]['belongsTo'](db['User'],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0x101')]['belongsTo'](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db[_0x5234('0x103')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x35'),'foreignKey':_0x5234('0x206')});db['WhatsappQueue'][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x1e1'),'as':'Teams'});db['UserSetting'][_0x5234('0x11e')](db['User'],{'as':_0x5234('0x207'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x5234('0x105')][_0x5234('0x165')](db['Dynamics365Account'],{'as':_0x5234('0x1d5'),'onDelete':_0x5234('0x163')});db['CloudProvider'][_0x5234('0x165')](db[_0x5234('0x37')],{'as':_0x5234('0x164'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':_0x5234('0x166'),'onDelete':_0x5234('0x163')});module[_0x5234('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e667311..bba43bb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4eda=['/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/www','/snippet','snippet','3.0.0','/plugins','route','get','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/messages','/api/chat/offline_messages','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','/api/variables','./api/variable','./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/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4eda,0x11b));var _0xa4ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4eda[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0xa4ed('0x0'));var express=require(_0xa4ed('0x1'));var errors=require(_0xa4ed('0x2'));var config=require(_0xa4ed('0x3'));var setupLoggers=require(_0xa4ed('0x4'))[_0xa4ed('0x5')];var clientSideLogs=require(_0xa4ed('0x6'));exports['default']=function(_0xfa76aa){return setupLoggers(_0xfa76aa)[_0xa4ed('0x7')](function(){_0xfa76aa['use'](_0xa4ed('0x8'),require(_0xa4ed('0x9')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xb'),require(_0xa4ed('0xc')));_0xfa76aa[_0xa4ed('0xa')]('/api/voice/contexts',require(_0xa4ed('0xd')));_0xfa76aa['use'](_0xa4ed('0xe'),require(_0xa4ed('0xf')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x10'),require(_0xa4ed('0x11')));_0xfa76aa[_0xa4ed('0xa')]('/api/voice/queues',require(_0xa4ed('0x12')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x13'),require(_0xa4ed('0x14')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x15'),require(_0xa4ed('0x16')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x17'),require(_0xa4ed('0x18')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x19'),require(_0xa4ed('0x1a')));_0xfa76aa['use'](_0xa4ed('0x1b'),require(_0xa4ed('0x1c')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x1d'),require(_0xa4ed('0x1e')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x1f'),require(_0xa4ed('0x20')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x21'),require(_0xa4ed('0x22')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x23'),require('./api/memberReport'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x24'),require('./api/trunk'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x25'),require('./api/voiceTransferReport'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x26'),require(_0xa4ed('0x27')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x28'),require(_0xa4ed('0x29')));_0xfa76aa[_0xa4ed('0xa')]('/api/mail/queues',require(_0xa4ed('0x2a')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x2b'),require(_0xa4ed('0x2c')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x2d'),require(_0xa4ed('0x2e')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x2f'),require('./api/mailMessage'));_0xfa76aa['use'](_0xa4ed('0x30'),require(_0xa4ed('0x31')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x32'),require('./api/mailQueueReport'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x33'),require(_0xa4ed('0x34')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x35'),require('./api/dashboardItem'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x36'),require(_0xa4ed('0x37')));_0xfa76aa['use'](_0xa4ed('0x38'),require(_0xa4ed('0x39')));_0xfa76aa['use']('/api/fax/interactions',require(_0xa4ed('0x3a')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x3b'),require(_0xa4ed('0x3c')));_0xfa76aa['use'](_0xa4ed('0x3d'),require(_0xa4ed('0x3e')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x3f'),require(_0xa4ed('0x40')));_0xfa76aa[_0xa4ed('0xa')]('/api/sms/accounts',require(_0xa4ed('0x41')));_0xfa76aa[_0xa4ed('0xa')]('/api/sms/applications',require(_0xa4ed('0x42')));_0xfa76aa[_0xa4ed('0xa')]('/api/sms/interactions',require('./api/smsInteraction'));_0xfa76aa['use'](_0xa4ed('0x43'),require('./api/smsMessage'));_0xfa76aa['use']('/api/sms/queues',require(_0xa4ed('0x44')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x45'),require('./api/openchannelAccount'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x46'),require(_0xa4ed('0x47')));_0xfa76aa['use'](_0xa4ed('0x48'),require(_0xa4ed('0x49')));_0xfa76aa[_0xa4ed('0xa')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x4a'),require('./api/openchannelQueue'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x4b'),require(_0xa4ed('0x4c')));_0xfa76aa['use'](_0xa4ed('0x4d'),require(_0xa4ed('0x4e')));_0xfa76aa['use']('/api/chat/applications',require(_0xa4ed('0x4f')));_0xfa76aa[_0xa4ed('0xa')]('/api/chat/interactions',require('./api/chatInteraction'));_0xfa76aa['use'](_0xa4ed('0x50'),require('./api/chatMessage'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x51'),require('./api/chatOfflineMessage'));_0xfa76aa[_0xa4ed('0xa')]('/api/chat/queues',require(_0xa4ed('0x52')));_0xfa76aa[_0xa4ed('0xa')]('/api/chat/groups',require(_0xa4ed('0x53')));_0xfa76aa['use'](_0xa4ed('0x54'),require('./api/chatProactiveAction'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x55'),require(_0xa4ed('0x56')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x57'),require(_0xa4ed('0x58')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x59'),require(_0xa4ed('0x5a')));_0xfa76aa['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0xfa76aa['use'](_0xa4ed('0x5b'),require(_0xa4ed('0x5c')));_0xfa76aa['use'](_0xa4ed('0x5d'),require(_0xa4ed('0x5e')));_0xfa76aa[_0xa4ed('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x5f'),require(_0xa4ed('0x60')));_0xfa76aa[_0xa4ed('0xa')]('/api/automations',require('./api/automation'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x61'),require('./api/cannedAnswer'));_0xfa76aa[_0xa4ed('0xa')]('/api/dispositions',require(_0xa4ed('0x62')));_0xfa76aa['use'](_0xa4ed('0x63'),require(_0xa4ed('0x64')));_0xfa76aa['use']('/api/intervals',require(_0xa4ed('0x65')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x66'),require('./api/pause'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x67'),require(_0xa4ed('0x68')));_0xfa76aa['use'](_0xa4ed('0x69'),require(_0xa4ed('0x6a')));_0xfa76aa['use'](_0xa4ed('0x6b'),require('./api/schedule'));_0xfa76aa[_0xa4ed('0xa')]('/api/sounds',require(_0xa4ed('0x6c')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x6d'),require(_0xa4ed('0x6e')));_0xfa76aa[_0xa4ed('0xa')]('/api/contact_item_types',require(_0xa4ed('0x6f')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x70'),require(_0xa4ed('0x71')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x72'),require('./api/cmHopperAdditionalPhone'));_0xfa76aa['use'](_0xa4ed('0x73'),require('./api/template'));_0xfa76aa['use'](_0xa4ed('0x74'),require('./api/trigger'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x75'),require(_0xa4ed('0x76')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations',require(_0xa4ed('0x77')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x78'),require(_0xa4ed('0x79')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x7a'),require(_0xa4ed('0x7b')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x7c'),require(_0xa4ed('0x7d')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x7e'),require(_0xa4ed('0x7f')));_0xfa76aa['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x80'),require(_0xa4ed('0x81')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x82'),require(_0xa4ed('0x83')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x84'),require(_0xa4ed('0x85')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/salesforce/configurations',require(_0xa4ed('0x86')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x87'),require('./api/intSalesforceField'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x88'),require(_0xa4ed('0x89')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/sugarcrm/configurations',require(_0xa4ed('0x8a')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/sugarcrm/fields',require(_0xa4ed('0x8b')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x8c'),require(_0xa4ed('0x8d')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0xfa76aa['use'](_0xa4ed('0x8e'),require(_0xa4ed('0x8f')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x90'),require(_0xa4ed('0x91')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x92'),require(_0xa4ed('0x93')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x94'),require(_0xa4ed('0x95')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x96'),require('./api/intZendeskAccount'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x97'),require(_0xa4ed('0x98')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x99'),require(_0xa4ed('0x9a')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x9b'),require(_0xa4ed('0x9c')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x9d'),require('./api/intFreshdeskConfiguration'));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/freshdesk/fields',require(_0xa4ed('0x9e')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x9f'),require(_0xa4ed('0xa0')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/vtiger/configurations',require(_0xa4ed('0xa1')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xa2'),require('./api/intVtigerField'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xa3'),require(_0xa4ed('0xa4')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xa5'),require(_0xa4ed('0xa6')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xa7'),require(_0xa4ed('0xa8')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/dynamics365/accounts',require(_0xa4ed('0xa9')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/dynamics365/fields',require(_0xa4ed('0xaa')));_0xfa76aa['use']('/api/integrations/freshsales/accounts',require(_0xa4ed('0xab')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xac'),require(_0xa4ed('0xad')));_0xfa76aa[_0xa4ed('0xa')]('/api/integrations/freshsales/fields',require(_0xa4ed('0xae')));_0xfa76aa['use']('/api/networks',require('./api/network'));_0xfa76aa[_0xa4ed('0xa')]('/api/chat/reports/queue',require(_0xa4ed('0xaf')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xb0'),require('./api/chatInternalMessage'));_0xfa76aa[_0xa4ed('0xa')]('/api/jscripty/answers/reports',require(_0xa4ed('0xb1')));_0xfa76aa[_0xa4ed('0xa')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xfa76aa['use'](_0xa4ed('0xb2'),require(_0xa4ed('0xb3')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xb4'),require(_0xa4ed('0xb5')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xb6'),require('./api/squareReport'));_0xfa76aa['use'](_0xa4ed('0xb7'),require(_0xa4ed('0xb8')));_0xfa76aa[_0xa4ed('0xa')]('/api/jscripty/projects',require(_0xa4ed('0xb9')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xba'),require(_0xa4ed('0xbb')));_0xfa76aa[_0xa4ed('0xa')]('/api/square/odbc',require(_0xa4ed('0xbc')));_0xfa76aa['use'](_0xa4ed('0xbd'),require('./api/squareProject'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xbe'),require('./api/squareRecording'));_0xfa76aa['use']('/api/square/messages',require(_0xa4ed('0xbf')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xc0'),require('./api/team'));_0xfa76aa['use'](_0xa4ed('0xc1'),require(_0xa4ed('0xc2')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xc3'),require('./api/campaign'));_0xfa76aa['use']('/api/migrations',require(_0xa4ed('0xc4')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xc5'),require(_0xa4ed('0xc6')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xc7'),require(_0xa4ed('0xc8')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xc9'),require(_0xa4ed('0xca')));_0xfa76aa[_0xa4ed('0xa')]('/api/chat/reports/transfer',require(_0xa4ed('0xcb')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xcc'),require(_0xa4ed('0xcd')));_0xfa76aa['use'](_0xa4ed('0xce'),require(_0xa4ed('0xcf')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xd0'),require('./api/smsTransferReport'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xd1'),require(_0xa4ed('0xd2')));_0xfa76aa['use'](_0xa4ed('0xd3'),require(_0xa4ed('0xd4')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xd5'),require('./api/userProfile'));_0xfa76aa['use']('/api/userProfile/sections',require(_0xa4ed('0xd6')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xd7'),require(_0xa4ed('0xd8')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xd9'),require(_0xa4ed('0xda')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xdb'),require(_0xa4ed('0xdc')));_0xfa76aa[_0xa4ed('0xa')]('/api/whatsapp/applications',require(_0xa4ed('0xdd')));_0xfa76aa[_0xa4ed('0xa')]('/api/whatsapp/interactions',require(_0xa4ed('0xde')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xdf'),require(_0xa4ed('0xe0')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xe1'),require(_0xa4ed('0xe2')));_0xfa76aa['use'](_0xa4ed('0xe3'),require('./api/whatsappTransferReport'));_0xfa76aa['use'](_0xa4ed('0xe4'),require(_0xa4ed('0xe5')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xe6'),require(_0xa4ed('0xe7')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xe8'),require(_0xa4ed('0xe9')));_0xfa76aa['use'](_0xa4ed('0xea'),require('./api/user-setting'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xeb'),require(_0xa4ed('0xec')));_0xfa76aa['use'](_0xa4ed('0xed'),require(_0xa4ed('0xee')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xef'),require(_0xa4ed('0xf0')));_0xfa76aa['use'](_0xa4ed('0xf1'),require(_0xa4ed('0xf2')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xf3'),require(_0xa4ed('0xf4')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xf5'),require(_0xa4ed('0xf6')));_0xfa76aa[_0xa4ed('0xa')]('/api/system',require('./api/system'));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xf7'),require(_0xa4ed('0xf8')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xf9'),require(_0xa4ed('0xfa')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xfb'),clientSideLogs);_0xfa76aa[_0xa4ed('0xa')]('/apidoc',express[_0xa4ed('0xfc')](path[_0xa4ed('0xfd')](config[_0xa4ed('0xfe')],'/apidoc')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0xff'),express[_0xa4ed('0xfc')](path[_0xa4ed('0xfd')](config['root'],_0xa4ed('0xff'))));_0xfa76aa[_0xa4ed('0xa')]('/demo',express[_0xa4ed('0xfc')](path[_0xa4ed('0xfd')](config[_0xa4ed('0xfe')],'/demo')));_0xfa76aa[_0xa4ed('0xa')](_0xa4ed('0x100'),express[_0xa4ed('0xfc')](path['join'](config[_0xa4ed('0xfe')],_0xa4ed('0x101'),_0xa4ed('0x102'))));_0xfa76aa['use'](_0xa4ed('0x103'),express[_0xa4ed('0xfc')](path[_0xa4ed('0xfd')](config[_0xa4ed('0xfe')],'/server/files/plugins')));_0xfa76aa[_0xa4ed('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xa4ed('0x105')](errors[0x194]);_0xfa76aa['route']('/*')[_0xa4ed('0x105')](function(_0x5dadd9,_0x5ce9a9){_0x5ce9a9['sendFile'](path['resolve'](_0xfa76aa['get'](_0xa4ed('0x106'))+_0xa4ed('0x107')));});return _0xfa76aa;});}; \ No newline at end of file +var _0x8ffc=['/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/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/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues'];(function(_0x3b3f65,_0x5354bc){var _0x2e3ce1=function(_0x5aa023){while(--_0x5aa023){_0x3b3f65['push'](_0x3b3f65['shift']());}};_0x2e3ce1(++_0x5354bc);}(_0x8ffc,0xc6));var _0xc8ff=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x8ffc[_0x34843e];return _0x598f7f;};'use strict';var path=require('path');var express=require(_0xc8ff('0x0'));var errors=require(_0xc8ff('0x1'));var config=require(_0xc8ff('0x2'));var setupLoggers=require(_0xc8ff('0x3'))[_0xc8ff('0x4')];var clientSideLogs=require(_0xc8ff('0x5'));exports[_0xc8ff('0x6')]=function(_0x1d4737){return setupLoggers(_0x1d4737)[_0xc8ff('0x7')](function(){_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9'),require(_0xc8ff('0xa')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb'),require('./api/voiceChanSpy'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc'),require(_0xc8ff('0xd')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe'),require(_0xc8ff('0xf')));_0x1d4737[_0xc8ff('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x10'),require(_0xc8ff('0x11')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x12'),require(_0xc8ff('0x13')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x14'),require('./api/screenRecording'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x15'),require('./api/voiceMail'));_0x1d4737['use'](_0xc8ff('0x16'),require(_0xc8ff('0x17')));_0x1d4737[_0xc8ff('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x1d4737['use'](_0xc8ff('0x18'),require(_0xc8ff('0x19')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x1a'),require('./api/voiceAgentReport'));_0x1d4737[_0xc8ff('0x8')]('/api/voice/queues/reports',require(_0xc8ff('0x1b')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x1c'),require(_0xc8ff('0x1d')));_0x1d4737[_0xc8ff('0x8')]('/api/trunks',require(_0xc8ff('0x1e')));_0x1d4737['use'](_0xc8ff('0x1f'),require('./api/voiceTransferReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x20'),require('./api/mailServerOut'));_0x1d4737['use'](_0xc8ff('0x21'),require(_0xc8ff('0x22')));_0x1d4737['use']('/api/mail/queues',require(_0xc8ff('0x23')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x24'),require(_0xc8ff('0x25')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x26'),require(_0xc8ff('0x27')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x28'),require('./api/mailMessage'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x29'),require(_0xc8ff('0x2a')));_0x1d4737['use'](_0xc8ff('0x2b'),require(_0xc8ff('0x2c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x2d'),require('./api/dashboard'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x2e'),require(_0xc8ff('0x2f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x30'),require(_0xc8ff('0x31')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/applications',require(_0xc8ff('0x32')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/interactions',require(_0xc8ff('0x33')));_0x1d4737['use'](_0xc8ff('0x34'),require('./api/faxMessage'));_0x1d4737[_0xc8ff('0x8')]('/api/fax/queues',require(_0xc8ff('0x35')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x36'),require(_0xc8ff('0x37')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/applications',require(_0xc8ff('0x38')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x39'),require(_0xc8ff('0x3a')));_0x1d4737['use'](_0xc8ff('0x3b'),require('./api/smsQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3c'),require('./api/openchannelAccount'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3d'),require(_0xc8ff('0x3e')));_0x1d4737[_0xc8ff('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3f'),require(_0xc8ff('0x40')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x41'),require('./api/openchannelQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x42'),require('./api/chatWebsite'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x43'),require(_0xc8ff('0x44')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x45'),require(_0xc8ff('0x46')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x47'),require('./api/chatInteraction'));_0x1d4737['use'](_0xc8ff('0x48'),require(_0xc8ff('0x49')));_0x1d4737[_0xc8ff('0x8')]('/api/chat/offline_messages',require(_0xc8ff('0x4a')));_0x1d4737['use']('/api/chat/queues',require('./api/chatQueue'));_0x1d4737[_0xc8ff('0x8')]('/api/chat/groups',require(_0xc8ff('0x4b')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x4c'),require(_0xc8ff('0x4d')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x4e'),require(_0xc8ff('0x4f')));_0x1d4737[_0xc8ff('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x1d4737['use'](_0xc8ff('0x50'),require(_0xc8ff('0x51')));_0x1d4737['use'](_0xc8ff('0x52'),require(_0xc8ff('0x53')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x54'),require(_0xc8ff('0x55')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x56'),require(_0xc8ff('0x57')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x58'),require(_0xc8ff('0x59')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x5a'),require(_0xc8ff('0x5b')));_0x1d4737['use'](_0xc8ff('0x5c'),require(_0xc8ff('0x5d')));_0x1d4737['use'](_0xc8ff('0x5e'),require(_0xc8ff('0x5f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x60'),require(_0xc8ff('0x61')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x62'),require(_0xc8ff('0x63')));_0x1d4737['use'](_0xc8ff('0x64'),require(_0xc8ff('0x65')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x66'),require(_0xc8ff('0x67')));_0x1d4737['use']('/api/cdr',require(_0xc8ff('0x68')));_0x1d4737[_0xc8ff('0x8')]('/api/voiceQueuesLog',require(_0xc8ff('0x69')));_0x1d4737[_0xc8ff('0x8')]('/api/schedules',require(_0xc8ff('0x6a')));_0x1d4737['use'](_0xc8ff('0x6b'),require(_0xc8ff('0x6c')));_0x1d4737['use'](_0xc8ff('0x6d'),require(_0xc8ff('0x6e')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x6f'),require(_0xc8ff('0x70')));_0x1d4737['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x71'),require(_0xc8ff('0x72')));_0x1d4737[_0xc8ff('0x8')]('/api/templates',require('./api/template'));_0x1d4737['use'](_0xc8ff('0x73'),require('./api/trigger'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x74'),require(_0xc8ff('0x75')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations',require(_0xc8ff('0x76')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x77'),require('./api/integrationReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x78'),require('./api/analyticCustomReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x79'),require(_0xc8ff('0x7a')));_0x1d4737['use'](_0xc8ff('0x7b'),require('./api/analyticExtractedReport'));_0x1d4737['use'](_0xc8ff('0x7c'),require(_0xc8ff('0x7d')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x7e'),require(_0xc8ff('0x7f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x80'),require('./api/analyticTreeReport'));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/salesforce/accounts',require(_0xc8ff('0x81')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/salesforce/configurations',require(_0xc8ff('0x82')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x83'),require(_0xc8ff('0x84')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/sugarcrm/accounts',require(_0xc8ff('0x85')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x86'),require(_0xc8ff('0x87')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x88'),require(_0xc8ff('0x89')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/desk/accounts',require(_0xc8ff('0x8a')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x8b'),require(_0xc8ff('0x8c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x8d'),require(_0xc8ff('0x8e')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zoho/accounts',require(_0xc8ff('0x8f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x90'),require(_0xc8ff('0x91')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x92'),require(_0xc8ff('0x93')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zendesk/accounts',require(_0xc8ff('0x94')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x95'),require(_0xc8ff('0x96')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x97'),require(_0xc8ff('0x98')));_0x1d4737['use'](_0xc8ff('0x99'),require('./api/intFreshdeskField'));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/vtiger/accounts',require(_0xc8ff('0x9a')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9b'),require(_0xc8ff('0x9c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9d'),require(_0xc8ff('0x9e')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9f'),require(_0xc8ff('0xa0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa1'),require(_0xc8ff('0xa2')));_0x1d4737['use'](_0xc8ff('0xa3'),require(_0xc8ff('0xa4')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/dynamics365/configurations',require(_0xc8ff('0xa5')));_0x1d4737['use']('/api/integrations/dynamics365/fields',require(_0xc8ff('0xa6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa7'),require(_0xc8ff('0xa8')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa9'),require('./api/intFreshsalesConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xaa'),require(_0xc8ff('0xab')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xac'),require(_0xc8ff('0xad')));_0x1d4737['use'](_0xc8ff('0xae'),require(_0xc8ff('0xaf')));_0x1d4737[_0xc8ff('0x8')]('/api/chat/internal/messages',require(_0xc8ff('0xb0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb1'),require(_0xc8ff('0xb2')));_0x1d4737[_0xc8ff('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb3'),require('./api/jscriptySessionReport'));_0x1d4737[_0xc8ff('0x8')]('/api/sms/reports/queue',require(_0xc8ff('0xb4')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb5'),require(_0xc8ff('0xb6')));_0x1d4737['use'](_0xc8ff('0xb7'),require(_0xc8ff('0xb8')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb9'),require(_0xc8ff('0xba')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xbb'),require(_0xc8ff('0xbc')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xbd'),require(_0xc8ff('0xbe')));_0x1d4737['use'](_0xc8ff('0xbf'),require(_0xc8ff('0xc0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc1'),require(_0xc8ff('0xc2')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc3'),require(_0xc8ff('0xc4')));_0x1d4737[_0xc8ff('0x8')]('/api/teams',require('./api/team'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc5'),require(_0xc8ff('0xc6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc7'),require(_0xc8ff('0xc8')));_0x1d4737['use'](_0xc8ff('0xc9'),require(_0xc8ff('0xca')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcb'),require('./api/attachment'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcc'),require(_0xc8ff('0xcd')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xce'),require('./api/mailTransferReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcf'),require(_0xc8ff('0xd0')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/reports/transfer',require(_0xc8ff('0xd1')));_0x1d4737['use']('/api/openchannel/reports/transfer',require(_0xc8ff('0xd2')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/reports/transfer',require(_0xc8ff('0xd3')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd4'),require(_0xc8ff('0xd5')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd6'),require('./api/voicePrefix'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd7'),require(_0xc8ff('0xd8')));_0x1d4737['use'](_0xc8ff('0xd9'),require(_0xc8ff('0xda')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdb'),require('./api/userProfileResource'));_0x1d4737[_0xc8ff('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdc'),require(_0xc8ff('0xdd')));_0x1d4737[_0xc8ff('0x8')]('/api/whatsapp/applications',require(_0xc8ff('0xde')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdf'),require('./api/whatsappInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe0'),require(_0xc8ff('0xe1')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe2'),require(_0xc8ff('0xe3')));_0x1d4737[_0xc8ff('0x8')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x1d4737['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe4'),require(_0xc8ff('0xe5')));_0x1d4737['use']('/api/realtime',require('./api/realtime'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe6'),require(_0xc8ff('0xe7')));_0x1d4737[_0xc8ff('0x8')]('/api/auth/local',require(_0xc8ff('0xe8')));_0x1d4737['use']('/api/auth/google',require(_0xc8ff('0xe9')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xea'),require(_0xc8ff('0xeb')));_0x1d4737['use']('/api/jira',require(_0xc8ff('0xec')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xed'),require(_0xc8ff('0xee')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xef'),require(_0xc8ff('0xf0')));_0x1d4737['use'](_0xc8ff('0xf1'),require(_0xc8ff('0xf2')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf3'),require(_0xc8ff('0xf4')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf5'),require(_0xc8ff('0xf6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf7'),clientSideLogs);_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf8'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],'/apidoc')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfc'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xfc'))));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfd'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xfd'))));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfe'),express['static'](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xff'),_0xc8ff('0x100'))));_0x1d4737[_0xc8ff('0x8')]('/plugins',express['static'](path['join'](config[_0xc8ff('0xfb')],'/server/files/plugins')));_0x1d4737[_0xc8ff('0x101')](_0xc8ff('0x102'))[_0xc8ff('0x103')](errors[0x194]);_0x1d4737[_0xc8ff('0x101')]('/*')[_0xc8ff('0x103')](function(_0x5e558f,_0x4e2500){_0x4e2500[_0xc8ff('0x104')](path[_0xc8ff('0x105')](_0x1d4737[_0xc8ff('0x103')](_0xc8ff('0x106'))+_0xc8ff('0x107')));});return _0x1d4737;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2871f28..c922fbd 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaed=['../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xbaed,0x81));var _0xdbae=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xbaed[_0x28394f];return _0x2618d2;};'use strict';var jayson=require(_0xdbae('0x0'));var _=require(_0xdbae('0x1'));var config=require('../config/environment');exports[_0xdbae('0x2')]=function(){return new Promise(function(_0x456d9e,_0x178da5){var _0x3e6d6e={};_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x4')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x5')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x6')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x7')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x8')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x9')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0xa')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0xb')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/memberReport/memberReport.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0xc')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0xd')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0xe')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0xf')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x10')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x11')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x12')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/mailMessage/mailMessage.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x13')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x14')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/faxAccount/faxAccount.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x15')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/faxInteraction/faxInteraction.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x16')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/faxQueue/faxQueue.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x17')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x18')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/smsInteraction/smsInteraction.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x19')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/smsQueue/smsQueue.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x1a')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x1b')));_0x3e6d6e=_['merge'](_0x3e6d6e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x1c')));_0x3e6d6e=_['merge'](_0x3e6d6e,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/chatInteraction/chatInteraction.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x1d')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x1e')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/cmContact/cmContact.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x1f')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x20')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x21')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x22')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x23')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x24')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x25')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x26')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x27')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x28')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x29')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/variable/variable.rpc'));_0x3e6d6e=_['merge'](_0x3e6d6e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x2a')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x2b')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x2c')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x2d')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x2e')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x2f')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x30')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x31')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x32')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x33')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x34')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/squareReport/squareReport.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x35')));_0x3e6d6e=_['merge'](_0x3e6d6e,require(_0xdbae('0x36')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x37')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x38')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x39')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3a')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3b')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3c')));_0x3e6d6e=_['merge'](_0x3e6d6e,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3d')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3e')));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3e6d6e=_[_0xdbae('0x3')](_0x3e6d6e,require(_0xdbae('0x3f')));var _0x33a36c=jayson['server'](_0x3e6d6e)[_0xdbae('0x40')]();var _0x53bd86=config[_0xdbae('0x41')][_0xdbae('0x42')]||config['port']+0x1;var _0x2216fc=config[_0xdbae('0x41')]['ip']||_0xdbae('0x43');_0x33a36c['on'](_0xdbae('0x44'),function(_0x11666a){return _0x178da5(_0x11666a);});_0x33a36c[_0xdbae('0x2')](_0x53bd86,_0x2216fc,function(){console[_0xdbae('0x45')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2216fc,_0x53bd86);require(_0xdbae('0x46'))[_0xdbae('0x47')]();return _0x456d9e(_0xdbae('0x48')+_0x2216fc+':'+_0x53bd86);});});}; \ No newline at end of file +var _0x09b0=['../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc'];(function(_0x45f1b5,_0x1fcb86){var _0x282f59=function(_0xe1e01e){while(--_0xe1e01e){_0x45f1b5['push'](_0x45f1b5['shift']());}};_0x282f59(++_0x1fcb86);}(_0x09b0,0x6e));var _0x009b=function(_0x375bdc,_0x56d0c2){_0x375bdc=_0x375bdc-0x0;var _0xad9532=_0x09b0[_0x375bdc];return _0xad9532;};'use strict';var jayson=require(_0x009b('0x0'));var _=require(_0x009b('0x1'));var config=require(_0x009b('0x2'));exports[_0x009b('0x3')]=function(){return new Promise(function(_0x226ef2,_0x236156){var _0x8742bc={};_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/user/user.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x5')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x6')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x7')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x8')));_0x8742bc=_['merge'](_0x8742bc,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x9')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0xa')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xb')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/trunk/trunk.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xc')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0xd')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xe')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/mailQueue/mailQueue.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xf')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x10')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x11')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x12')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x13')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x14')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x15')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x16')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/faxQueue/faxQueue.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x17')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x18')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x19')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1a')));_0x8742bc=_['merge'](_0x8742bc,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1c')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1d')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1e')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1f')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x20')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x21')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmContact/cmContact.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/cmHopper/cmHopper.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x22')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x23')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x24')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x25')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x26')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x27')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x28')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/trigger/trigger.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x29')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2a')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2c')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2d')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2e')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2f')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x30')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x31')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x32')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x33')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x34')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x35')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x36')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/squareRecording/squareRecording.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x37')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/campaign/campaign.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x38')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x39')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x3a')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x3b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x3c')));var _0x165804=jayson['server'](_0x8742bc)[_0x009b('0x3d')]();var _0x1f9502=config[_0x009b('0x3e')]['port']||config['port']+0x1;var _0x3d8c11=config['rpc']['ip']||'localhost';_0x165804['on']('error',function(_0x344327){return _0x236156(_0x344327);});_0x165804[_0x009b('0x3')](_0x1f9502,_0x3d8c11,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3d8c11,_0x1f9502);require('../config/triggers')[_0x009b('0x3f')]();return _0x226ef2(_0x009b('0x40')+_0x3d8c11+':'+_0x1f9502);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d0436cb..394372f 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 _0x57e8=['sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','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','exports','lodash','./error','call','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','inherits','prototype','sendRequest'];(function(_0x53340d,_0x3c5a3c){var _0x555a9e=function(_0x268441){while(--_0x268441){_0x53340d['push'](_0x53340d['shift']());}};_0x555a9e(++_0x3c5a3c);}(_0x57e8,0x10a));var _0x857e=function(_0x1bc246,_0x25ad93){_0x1bc246=_0x1bc246-0x0;var _0x1106ea=_0x57e8[_0x1bc246];return _0x1106ea;};'use strict';var util=require('util');var _=require(_0x857e('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x857e('0x1'));function AGIChannel(_0x5d1d1f){var _0x333dc6=this,_0x8df9a0=new AGIReply(),_0x440ec1=![],_0x4d789c={};EventEmitter[_0x857e('0x2')](_0x333dc6);_0x5d1d1f[_0x857e('0x3')](_0x857e('0x4'));_0x5d1d1f['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x8df9a0[_0x857e('0x3')](_0x857e('0x4'));_0x8df9a0['on']('headers',function(_0x11e565){for(var _0x2a03a7 in _0x11e565){_0x333dc6[_0x2a03a7]=_0x11e565[_0x2a03a7];}_0x333dc6[_0x857e('0x5')](_0x857e('0x6'));});_0x8df9a0['on'](_0x857e('0x7'),function(_0x10b853){if(_0x10b853[_0x857e('0x8')]()==_0x857e('0x9')){_0x333dc6['emit'](_0x857e('0x9'));return;}if(_0x10b853[_0x857e('0xa')](0x0,0xb)==_0x857e('0xb')){_0x440ec1=!![];}if(_0x440ec1){_0x4d789c['rx']+=_0x10b853+'\x0a';if(_0x10b853[_0x857e('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x440ec1=![];}}else{_0x4d789c['rx']=_0x10b853;}if(_0x440ec1){return;}if(typeof _0x4d789c['cb']==_0x857e('0xd')){var _0x1cc44b=_0x4d789c['rx'][_0x857e('0xa')](0x0,0x3),_0x3dff72=null,_0x17610e=null;_0x1cc44b=parseInt(_0x1cc44b);if(isNaN(_0x1cc44b)){_0x4d789c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x857e('0xe')});return;}if(_0x1cc44b!=0xc8){_0x4d789c['cb'](null,{'code':_0x1cc44b,'result':-0x1,'extra':'KO'});return;}_0x3dff72=_0x4d789c['rx'][_0x857e('0xa')](0x4)[_0x857e('0xf')](_0x857e('0x10'),'');if(_0x3dff72[_0x857e('0x11')]('\x20')!=-0x1){_0x3dff72=_0x3dff72[_0x857e('0x12')](0x0,_0x3dff72[_0x857e('0x11')]('\x20'));}if(_[_0x857e('0x13')](_0x3dff72,'-1')){_0x3dff72=parseInt(_0x3dff72);}_0x17610e=_0x4d789c['rx'][_0x857e('0x14')]('\x20');if(_0x17610e[_0x857e('0x15')]==0x3){_0x17610e=_0x17610e[0x2][_0x857e('0xa')](0x1,_0x17610e[0x2][_0x857e('0x15')]-0x1);}else if(_0x17610e[_0x857e('0x15')]>0x3){var _0x4ac34f=/\((.+)\)/;var _0xe6f202=_0x4d789c['rx'][_0x857e('0x16')](_0x4ac34f);if(_0xe6f202){_0x17610e=_0xe6f202[0x1];}else{_0x17610e=null;}}else{_0x17610e=null;}_0x4d789c['cb'](null,{'code':_0x1cc44b,'result':_0x3dff72,'extra':_0x17610e});}});_0x5d1d1f['on'](_0x857e('0x17'),function(_0x501161){_0x333dc6[_0x857e('0x5')](_0x857e('0x17'),new AGIError(_0x857e('0x18'),_0x501161['code']));});_0x5d1d1f['on']('close',function(){_0x333dc6[_0x857e('0x5')](_0x857e('0x19'),new AGIError(_0x857e('0x1a')));});_0x5d1d1f['on'](_0x857e('0x1b'),function(){_0x333dc6[_0x857e('0x5')](_0x857e('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x5d1d1f['destroy']();});_0x5d1d1f[_0x857e('0x1c')](_0x8df9a0);this[_0x857e('0x1d')]=function(_0x3a54e9,_0x1ec2c3){var _0x3a54e9=_0x3a54e9||'',_0x1ec2c3=typeof _0x1ec2c3==_0x857e('0xd')?_0x1ec2c3:new Function();_0x4d789c={'tx':_0x3a54e9,'rx':'','cb':_0x1ec2c3};_0x5d1d1f[_0x857e('0x1e')](_0x3a54e9+'\x0a');},this[_0x857e('0x19')]=function(){_0x5d1d1f['destroy']();};}util[_0x857e('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x857e('0x20')][_0x857e('0x21')]=function(_0x414d0d){return this['command'][_0x857e('0x22')](this,_0x414d0d);};AGIChannel[_0x857e('0x20')][_0x857e('0x23')]=function(){return this[_0x857e('0x21')](_0x857e('0x24'));};AGIChannel['prototype'][_0x857e('0x25')]=function(_0x53f497,_0x94b7c4,_0x33b823){_0x53f497=_0x53f497===undefined?_0x857e('0x26'):_0x53f497;_0x94b7c4=_0x94b7c4===undefined?'5':_0x94b7c4;_0x33b823=_0x33b823===undefined?'1':_0x33b823;return this[_0x857e('0x21')](util['format'](_0x857e('0x27'),_0x53f497,_0x94b7c4*0x3e8,_0x33b823));};AGIChannel['prototype'][_0x857e('0x28')]=function(_0x1ac7ea){_0x1ac7ea=_0x1ac7ea||'NO\x20MESSAGE';return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x2a'),_0x1ac7ea));};AGIChannel['prototype']['exec']=function(_0x3dae29,_0x1bf472){if(_['isArray'](_0x1bf472)){return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x2b'),_0x3dae29,_0x1bf472['join'](',')));}return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x2b'),_0x3dae29,_0x1bf472));};AGIChannel['prototype'][_0x857e('0x2c')]=function(_0x42ba7c){return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x2d'),_0x42ba7c));};AGIChannel[_0x857e('0x20')][_0x857e('0x2e')]=function(_0xeb54dd){return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x2f'),_0xeb54dd));};AGIChannel[_0x857e('0x20')][_0x857e('0x30')]=function(_0x1c33ec){return this[_0x857e('0x21')](util['format'](_0x857e('0x31'),_0x1c33ec));};AGIChannel[_0x857e('0x20')][_0x857e('0x9')]=function(){return this[_0x857e('0x21')]('HANGUP');};AGIChannel['prototype'][_0x857e('0x32')]=function(_0x5a0af5,_0x434a7b){var _0x556fe5=_[_0x857e('0x33')](_0x434a7b)||_[_0x857e('0x34')](_0x434a7b)?_0x434a7b[_0x857e('0x35')]():_0x434a7b;return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x36'),_0x5a0af5,_0x556fe5?_0x556fe5[_0x857e('0x35')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x857e('0x20')][_0x857e('0x37')]=function(_0x1f295e,_0x15b372){return this['sendRequest'](util[_0x857e('0x29')](_0x857e('0x38'),_0x1f295e,_0x15b372));};AGIChannel[_0x857e('0x20')][_0x857e('0x39')]=function(_0x5243e0,_0x170bd0){return this[_0x857e('0x21')](util[_0x857e('0x29')](_0x857e('0x3a'),_0x5243e0,_0x170bd0));};AGIChannel[_0x857e('0x20')]['sayPhonetic']=function(_0x497145,_0x580ebc){return this[_0x857e('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x497145,_0x580ebc));};AGIChannel[_0x857e('0x20')][_0x857e('0x3b')]=function(_0x50a96e,_0x5a0071,_0x30219f){_0x5a0071=_0x5a0071||this[_0x857e('0x3c')];_0x30219f=_0x30219f||0x1;this['setContext'](_0x50a96e);this['setExtension'](_0x5a0071);this['setPriority'](_0x30219f);return this[_0x857e('0x28')](util[_0x857e('0x29')](_0x857e('0x3d'),_0x50a96e,_0x5a0071,_0x30219f));};AGIChannel[_0x857e('0x20')][_0x857e('0x3e')]=function(_0x11bbdb){return this[_0x857e('0x21')](util['format'](_0x857e('0x3f'),_0x11bbdb));};AGIChannel['prototype'][_0x857e('0x40')]=function(_0x163bc2,_0x325734,_0x15ee25,_0x4c2c62,_0x5bbb4a,_0x1614ee){_0x325734=_0x325734||'wav';_0x15ee25=_0x15ee25||'';_0x4c2c62=_0x4c2c62===undefined?-0x1:_0x4c2c62==='-1'?-0x1:_0x4c2c62*0x3e8;_0x5bbb4a=_0x5bbb4a===undefined?'':'s='+_0x5bbb4a;_0x1614ee=_0x1614ee?_0x857e('0x41'):'';return this[_0x857e('0x21')](util['format'](_0x857e('0x42'),_0x163bc2,_0x325734,_0x15ee25,_0x4c2c62,_0x1614ee,_0x5bbb4a));};AGIChannel[_0x857e('0x20')]['streamFile']=function(_0x58b025,_0x53f588){_0x53f588=_0x53f588||'';return this[_0x857e('0x21')](util['format'](_0x857e('0x43'),_0x58b025,_0x53f588));};AGIChannel[_0x857e('0x20')][_0x857e('0x44')]=function(_0x4a17da){return this['exec'](_0x857e('0x45'),_0x4a17da);};AGIChannel[_0x857e('0x20')][_0x857e('0x46')]=function(_0x4b22f4){return this[_0x857e('0x47')](_0x857e('0x48'),_0x4b22f4);};AGIChannel[_0x857e('0x20')][_0x857e('0x17')]=function(_0x208667,_0x4e4325){this[_0x857e('0x28')](util['format'](_0x857e('0x49'),_0x208667['id'],_0x208667['label'],_0x4e4325));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x857e('0x4a')]=AGIChannel; \ No newline at end of file +var _0x8cb8=['substring','520-Invalid','search','no\x20code','replace','result=','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','function','write','sendRequest','sync','prototype','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','call','setEncoding','ready','line','toLowerCase','emit','hangup'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8cb8,0x1da));var _0x88cb=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x8cb8[_0x3ec333];return _0x15ccb8;};'use strict';var util=require('util');var _=require(_0x88cb('0x0'));var EventEmitter=require('events')[_0x88cb('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x310721){var _0x34501e=this,_0x3d0714=new AGIReply(),_0x535248=![],_0x5298d8={};EventEmitter[_0x88cb('0x2')](_0x34501e);_0x310721[_0x88cb('0x3')]('utf8');_0x310721['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3d0714[_0x88cb('0x3')]('utf8');_0x3d0714['on']('headers',function(_0x163174){for(var _0x5eb110 in _0x163174){_0x34501e[_0x5eb110]=_0x163174[_0x5eb110];}_0x34501e['emit'](_0x88cb('0x4'));});_0x3d0714['on'](_0x88cb('0x5'),function(_0x2825ca){if(_0x2825ca[_0x88cb('0x6')]()=='hangup'){_0x34501e[_0x88cb('0x7')](_0x88cb('0x8'));return;}if(_0x2825ca[_0x88cb('0x9')](0x0,0xb)==_0x88cb('0xa')){_0x535248=!![];}if(_0x535248){_0x5298d8['rx']+=_0x2825ca+'\x0a';if(_0x2825ca[_0x88cb('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0x535248=![];}}else{_0x5298d8['rx']=_0x2825ca;}if(_0x535248){return;}if(typeof _0x5298d8['cb']=='function'){var _0x1466fb=_0x5298d8['rx'][_0x88cb('0x9')](0x0,0x3),_0x2b1dbf=null,_0x1561c6=null;_0x1466fb=parseInt(_0x1466fb);if(isNaN(_0x1466fb)){_0x5298d8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x88cb('0xc')});return;}if(_0x1466fb!=0xc8){_0x5298d8['cb'](null,{'code':_0x1466fb,'result':-0x1,'extra':'KO'});return;}_0x2b1dbf=_0x5298d8['rx'][_0x88cb('0x9')](0x4)[_0x88cb('0xd')](_0x88cb('0xe'),'');if(_0x2b1dbf[_0x88cb('0xf')]('\x20')!=-0x1){_0x2b1dbf=_0x2b1dbf['substr'](0x0,_0x2b1dbf[_0x88cb('0xf')]('\x20'));}if(_[_0x88cb('0x10')](_0x2b1dbf,'-1')){_0x2b1dbf=parseInt(_0x2b1dbf);}_0x1561c6=_0x5298d8['rx'][_0x88cb('0x11')]('\x20');if(_0x1561c6[_0x88cb('0x12')]==0x3){_0x1561c6=_0x1561c6[0x2][_0x88cb('0x9')](0x1,_0x1561c6[0x2][_0x88cb('0x12')]-0x1);}else if(_0x1561c6[_0x88cb('0x12')]>0x3){var _0xbe8e9d=/\((.+)\)/;var _0x4cdd9c=_0x5298d8['rx'][_0x88cb('0x13')](_0xbe8e9d);if(_0x4cdd9c){_0x1561c6=_0x4cdd9c[0x1];}else{_0x1561c6=null;}}else{_0x1561c6=null;}_0x5298d8['cb'](null,{'code':_0x1466fb,'result':_0x2b1dbf,'extra':_0x1561c6});}});_0x310721['on']('error',function(_0x35037a){_0x34501e[_0x88cb('0x7')]('error',new AGIError(_0x88cb('0x14'),_0x35037a[_0x88cb('0x15')]));});_0x310721['on']('close',function(){_0x34501e['emit'](_0x88cb('0x16'),new AGIError(_0x88cb('0x17')));});_0x310721['on'](_0x88cb('0x18'),function(){_0x34501e['emit'](_0x88cb('0x18'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x310721['destroy']();});_0x310721[_0x88cb('0x19')](_0x3d0714);this['command']=function(_0x16bc05,_0x331e00){var _0x16bc05=_0x16bc05||'',_0x331e00=typeof _0x331e00==_0x88cb('0x1a')?_0x331e00:new Function();_0x5298d8={'tx':_0x16bc05,'rx':'','cb':_0x331e00};_0x310721[_0x88cb('0x1b')](_0x16bc05+'\x0a');},this[_0x88cb('0x16')]=function(){_0x310721['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x88cb('0x1c')]=function(_0x606c07){return this['command'][_0x88cb('0x1d')](this,_0x606c07);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x1f')]=function(){return this[_0x88cb('0x1c')](_0x88cb('0x20'));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x21')]=function(_0x1b17de,_0x9d8863,_0x8dab3){_0x1b17de=_0x1b17de===undefined?'beep':_0x1b17de;_0x9d8863=_0x9d8863===undefined?'5':_0x9d8863;_0x8dab3=_0x8dab3===undefined?'1':_0x8dab3;return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x23'),_0x1b17de,_0x9d8863*0x3e8,_0x8dab3));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x24')]=function(_0x250d9e){_0x250d9e=_0x250d9e||'NO\x20MESSAGE';return this[_0x88cb('0x1c')](util['format'](_0x88cb('0x25'),_0x250d9e));};AGIChannel[_0x88cb('0x1e')]['exec']=function(_0x54ad0c,_0x41d7d5){if(_['isArray'](_0x41d7d5)){return this['sendRequest'](util['format'](_0x88cb('0x26'),_0x54ad0c,_0x41d7d5['join'](',')));}return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x26'),_0x54ad0c,_0x41d7d5));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x27')]=function(_0x2ab223){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x28'),_0x2ab223));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x29')]=function(_0x5ddbd4){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x2a'),_0x5ddbd4));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x2b')]=function(_0x135fa1){return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x2c'),_0x135fa1));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x8')]=function(){return this[_0x88cb('0x1c')]('HANGUP');};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x2d')]=function(_0x399a5b,_0x259476){var _0x4cfcec=_['isBoolean'](_0x259476)||_[_0x88cb('0x2e')](_0x259476)?_0x259476['toString']():_0x259476;return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x2f'),_0x399a5b,_0x4cfcec?_0x4cfcec[_0x88cb('0x30')]()[_0x88cb('0xd')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x88cb('0x31')]=function(_0xeecc5,_0x2ae2e8){return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x32'),_0xeecc5,_0x2ae2e8));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x33')]=function(_0x190cf1,_0x1fc57a){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')]('SAY\x20DIGITS\x20%s\x20%s',_0x190cf1,_0x1fc57a));};AGIChannel[_0x88cb('0x1e')]['sayPhonetic']=function(_0xaf4d57,_0x26c89a){return this['sendRequest'](util[_0x88cb('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xaf4d57,_0x26c89a));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x34')]=function(_0x66cac5,_0x860358,_0x151b11){_0x860358=_0x860358||this[_0x88cb('0x35')];_0x151b11=_0x151b11||0x1;this['setContext'](_0x66cac5);this[_0x88cb('0x29')](_0x860358);this['setPriority'](_0x151b11);return this[_0x88cb('0x24')](util[_0x88cb('0x22')]('GOTO\x20%s\x20%s\x20%s',_0x66cac5,_0x860358,_0x151b11));};AGIChannel[_0x88cb('0x1e')]['getVariable']=function(_0x3ce7cb){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x36'),_0x3ce7cb));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x37')]=function(_0x5adc4f,_0x5b88b4,_0x1c1e64,_0x1b5634,_0x30275f,_0x1b254b){_0x5b88b4=_0x5b88b4||_0x88cb('0x38');_0x1c1e64=_0x1c1e64||'';_0x1b5634=_0x1b5634===undefined?-0x1:_0x1b5634==='-1'?-0x1:_0x1b5634*0x3e8;_0x30275f=_0x30275f===undefined?'':'s='+_0x30275f;_0x1b254b=_0x1b254b?_0x88cb('0x39'):'';return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x3a'),_0x5adc4f,_0x5b88b4,_0x1c1e64,_0x1b5634,_0x1b254b,_0x30275f));};AGIChannel['prototype'][_0x88cb('0x3b')]=function(_0xc70a8c,_0xf3cf34){_0xf3cf34=_0xf3cf34||'';return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x3c'),_0xc70a8c,_0xf3cf34));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x3d')]=function(_0x1994da){return this['exec'](_0x88cb('0x3e'),_0x1994da);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x3f')]=function(_0x27a256){return this['exec'](_0x88cb('0x40'),_0x27a256);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x41')]=function(_0x311031,_0x4699c8){this['noop'](util['format'](_0x88cb('0x42'),_0x311031['id'],_0x311031[_0x88cb('0x43')],_0x4699c8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x88cb('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0fa7242..e413d44 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 _0xc3eb=['Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xc3eb,0xc8));var _0xbc3e=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0xc3eb[_0x11ba46];return _0x1c8c6f;};'use strict';var util=require(_0xbc3e('0x0'));var error={'E_AGI_UNDEFINED':_0xbc3e('0x1'),'E_AGI_ARGUMENT_PORT':_0xbc3e('0x2'),'E_AGI_SERVER_ERROR':_0xbc3e('0x3'),'E_AGI_SERVER_CLOSE':_0xbc3e('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xbc3e('0x5'),'E_AGI_SOCKET_ERROR':_0xbc3e('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xbc3e('0x7'),'E_AGI_COMMAND_EMPTY':_0xbc3e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbc3e('0x9'),'E_AGI_IVR_ENTRY':_0xbc3e('0xa')};function AGIError(_0x27d5b9){var _0x27d5b9=_0x27d5b9||null,_0x43a77b=_0x43a77b||[],_0x5be045=0x1,_0x4ff243='';if(!error[_0x27d5b9]){_0x27d5b9=_0xbc3e('0xb');}_0x43a77b['push'](error[_0x27d5b9]);while(arguments[_0x5be045]){_0x43a77b[_0xbc3e('0xc')](arguments[_0x5be045]);_0x5be045++;}_0x4ff243=util[_0xbc3e('0xd')][_0xbc3e('0xe')](util,_0x43a77b);this['message']=_0x4ff243;this[_0xbc3e('0xf')]=_0x27d5b9;}module[_0xbc3e('0x10')]=AGIError; \ No newline at end of file +var _0x2417=['name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2417,0x16d));var _0x7241=function(_0x5ecc5d,_0x38d142){_0x5ecc5d=_0x5ecc5d-0x0;var _0x5b98a3=_0x2417[_0x5ecc5d];return _0x5b98a3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7241('0x0'),'E_AGI_ARGUMENT_PORT':_0x7241('0x1'),'E_AGI_SERVER_ERROR':_0x7241('0x2'),'E_AGI_SERVER_CLOSE':_0x7241('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7241('0x4'),'E_AGI_SOCKET_CLOSE':_0x7241('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7241('0x6'),'E_AGI_IVR_ENTRY':_0x7241('0x7')};function AGIError(_0x2252be){var _0x2252be=_0x2252be||null,_0x368816=_0x368816||[],_0x511a9c=0x1,_0x17de4b='';if(!error[_0x2252be]){_0x2252be=_0x7241('0x8');}_0x368816[_0x7241('0x9')](error[_0x2252be]);while(arguments[_0x511a9c]){_0x368816[_0x7241('0x9')](arguments[_0x511a9c]);_0x511a9c++;}_0x17de4b=util[_0x7241('0xa')][_0x7241('0xb')](util,_0x368816);this[_0x7241('0xc')]=_0x17de4b;this[_0x7241('0xd')]=_0x2252be;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 086a08e..f4d4320 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 _0x5470=['error','E_AGI_SERVER_ERROR','agi','parse','projectUpdate','exports','events','EventEmitter','redis','defaults','emit'];(function(_0xb7e470,_0x3854a9){var _0x4c3743=function(_0x212aec){while(--_0x212aec){_0xb7e470['push'](_0xb7e470['shift']());}};_0x4c3743(++_0x3854a9);}(_0x5470,0x17c));var _0x0547=function(_0x3c3837,_0x441231){_0x3c3837=_0x3c3837-0x0;var _0x3e33cf=_0x5470[_0x3c3837];return _0x3e33cf;};'use strict';var _=require('lodash');var EventEmitter=require(_0x0547('0x0'))[_0x0547('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require('../../config/environment');config[_0x0547('0x2')]=_[_0x0547('0x3')](config[_0x0547('0x2')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0547('0x2')]);sub['subscribe']('agi',function(_0x155a76){if(_0x155a76)return eventEmitter[_0x0547('0x4')](_0x0547('0x5'),new AGIError(_0x0547('0x6'),_0x155a76));});sub['on']('message',function(_0x1bee7f,_0x3403d2){if(_0x1bee7f!==_0x0547('0x7'))return;try{var _0xf276e3=JSON[_0x0547('0x8')](_0x3403d2);eventEmitter[_0x0547('0x4')](_0x0547('0x9'),_0xf276e3);}catch(_0x7ee34b){eventEmitter[_0x0547('0x4')](_0x0547('0x5'),new AGIError(_0x0547('0x6'),_0x7ee34b));}});module[_0x0547('0xa')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf51e=['parse','emit','projectUpdate','exports','lodash','events','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','error','E_AGI_SERVER_ERROR','message'];(function(_0x21362f,_0x4637e1){var _0x17f9fe=function(_0x521f60){while(--_0x521f60){_0x21362f['push'](_0x21362f['shift']());}};_0x17f9fe(++_0x4637e1);}(_0xf51e,0xf4));var _0xef51=function(_0x136ff9,_0x16b929){_0x136ff9=_0x136ff9-0x0;var _0x38ddd4=_0xf51e[_0x136ff9];return _0x38ddd4;};'use strict';var _=require(_0xef51('0x0'));var EventEmitter=require(_0xef51('0x1'))['EventEmitter'];var Redis=require(_0xef51('0x2'));var AGIError=require(_0xef51('0x3'));var config=require(_0xef51('0x4'));config[_0xef51('0x5')]=_[_0xef51('0x6')](config[_0xef51('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xef51('0x5')]);sub[_0xef51('0x7')](_0xef51('0x8'),function(_0x4dd2f1){if(_0x4dd2f1)return eventEmitter['emit'](_0xef51('0x9'),new AGIError(_0xef51('0xa'),_0x4dd2f1));});sub['on'](_0xef51('0xb'),function(_0x480c5b,_0x5bfb1d){if(_0x480c5b!==_0xef51('0x8'))return;try{var _0x480d04=JSON[_0xef51('0xc')](_0x5bfb1d);eventEmitter[_0xef51('0xd')](_0xef51('0xe'),_0x480d04);}catch(_0x2167b9){eventEmitter['emit'](_0xef51('0x9'),new AGIError(_0xef51('0xa'),_0x2167b9));}});module[_0xef51('0xf')]={'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 1b3facb..8ec5e09 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 _0x5e4e=['split','agicommand','vswitch','default','target','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','addVertex','prototype','push','size','relations','numberOfEdges','traverseBFS','info','no\x20vertex\x20found','length','condition'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x5e4e,0xcf));var _0xe5e4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5e4e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var logger=require(_0xe5e4('0x0'))(_0xe5e4('0x1'));var verticesWithRetry=['menu',_0xe5e4('0x2'),_0xe5e4('0x3')];var Graph=function(){this[_0xe5e4('0x4')]={};this[_0xe5e4('0x5')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xe5e4('0x6')]=function(_0x2447d4){this[_0xe5e4('0x4')][_0x2447d4['id']]=_0x2447d4;this['edges'][_0x2447d4['id']]=[];};Graph[_0xe5e4('0x7')]['addEdge']=function(_0x81fe58,_0x11ca6f,_0x32ec89){this[_0xe5e4('0x5')][_0x81fe58][_0xe5e4('0x8')]({'target':_0x11ca6f,'condition':_0x32ec89});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xe5e4('0x9')]=function(){return _[_0xe5e4('0x9')](this[_0xe5e4('0x4')]);};Graph[_0xe5e4('0x7')][_0xe5e4('0xa')]=function(){return this[_0xe5e4('0xb')];};Graph[_0xe5e4('0x7')]['getVertex']=function(_0x5117a6){return this[_0xe5e4('0x4')][_0x5117a6];};Graph[_0xe5e4('0x7')][_0xe5e4('0xc')]=function(_0x2c9c4c,_0x586753){if(!this[_0xe5e4('0x4')][_0x2c9c4c]){return logger[_0xe5e4('0xd')](_0xe5e4('0xe'));}var _0xac443b=_0x586753(this[_0xe5e4('0x4')][_0x2c9c4c]);if(!_0xac443b){return logger[_0xe5e4('0xd')]('stop\x20traverse');}if(this[_0xe5e4('0x5')][_0x2c9c4c][_0xe5e4('0xf')]===0x0){return logger[_0xe5e4('0xd')]('no\x20edge/s\x20available');}for(var _0x4f96f3=0x0,_0x2ca32e=[],_0x2063a8=![];_0x4f96f3\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','find','arg_1','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','getAll','./server','port','listening','util','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','findIndex','splice','push','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xc068,0x1a3));var _0x8c06=function(_0x2745de,_0x39a9d6){_0x2745de=_0x2745de-0x0;var _0x135b5=_0xc068[_0x2745de];return _0x135b5;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x8c06('0x0'));var config=require(_0x8c06('0x1'));var logger=require('../../config/logger')(_0x8c06('0x2'));var utilLicense=require(_0x8c06('0x3'));var rpc=require(_0x8c06('0x4'));var Project=require(_0x8c06('0x5'));var AGIEmitter=require(_0x8c06('0x6'))[_0x8c06('0x7')];var projects=[];config[_0x8c06('0x2')]=_[_0x8c06('0x8')](config[_0x8c06('0x2')],{'ip':_0x8c06('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5b8f8b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5b8f8b);agiHandler(_0x5b8f8b);}catch(_0x483a0d){logger['error'](_0x483a0d['stack']);}});});}function projectUpdateHandler(_0x55ed37){try{var _0x4c5bef=_[_0x8c06('0xa')](projects,['id',_0x55ed37['id']]);if(_0x4c5bef>-0x1){if(_0x55ed37['deleted']===!![]){projects[_0x8c06('0xb')](_0x4c5bef,0x1);}else{projects[_0x4c5bef]=_0x55ed37;}}else{projects[_0x8c06('0xc')](_0x55ed37);}}catch(_0x1b50a8){logger[_0x8c06('0xd')](_0x1b50a8[_0x8c06('0xe')]);}}function listeningHandler(){console[_0x8c06('0xf')](_0x8c06('0x10'),config[_0x8c06('0x2')]['port']);logger[_0x8c06('0x11')](util[_0x8c06('0x12')](_0x8c06('0x13'),config[_0x8c06('0x2')]['ip'],config[_0x8c06('0x2')]['port']));}function errorHandler(_0x2c5474){if(_0x2c5474&&_0x2c5474[_0x8c06('0x14')]&&_0x2c5474[_0x8c06('0x15')]){logger[_0x8c06('0xd')](util['format'](_0x8c06('0x16'),_0x2c5474['name'],_0x2c5474[_0x8c06('0x15')]));}else{logger[_0x8c06('0xd')](util[_0x8c06('0x12')](_0x8c06('0x17'),_0x2c5474['stack']));}}function closeHandler(){logger[_0x8c06('0x11')](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[_0x8c06('0x18')],this[_0x8c06('0x19')],this[_0x8c06('0x1a')],this[_0x8c06('0x1b')]));try{createSquareReport(this);}catch(_0x4d782e){logger[_0x8c06('0xd')](_0x4d782e[_0x8c06('0xe')]);}}function timeoutHandler(){logger[_0x8c06('0x11')](util['format'](_0x8c06('0x1c'),this['arg_1'],this[_0x8c06('0x18')],this[_0x8c06('0x19')],this[_0x8c06('0x1a')],this[_0x8c06('0x1b')]));}function hangupHandler(){logger[_0x8c06('0x11')](util[_0x8c06('0x12')](_0x8c06('0x1d'),this['arg_1'],this[_0x8c06('0x18')],this[_0x8c06('0x19')],this[_0x8c06('0x1a')],this[_0x8c06('0x1b')]));this[_0x8c06('0x1e')]=!![];}function createSquareReport(_0x503669,_0x4ec58a){rpc[_0x8c06('0x1f')](_0x503669)[_0x8c06('0x20')](function(_0x245ba6){if(_0x4ec58a){_0x4ec58a(null,_0x245ba6);}})[_0x8c06('0x21')](function(_0x2d55ed){if(_0x4ec58a){_0x4ec58a(null,_0x2d55ed);}});}function setChannelVariables(_0x540d71){for(var _0x434f08 in _0x540d71){if(_0x540d71[_0x8c06('0x22')](_0x434f08)){if(_0x434f08[_0x8c06('0x23')](_0x8c06('0x24'))===0x0){_0x540d71[_0x434f08[_0x8c06('0x25')](0x4)]=_0x540d71[_0x434f08];delete _0x540d71[_0x434f08];}}}}function agiHandler(_0x149b1d){logger[_0x8c06('0x26')](_0x8c06('0x27'),JSON[_0x8c06('0x28')](_0x149b1d,null,0x2));logger['info'](util[_0x8c06('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x149b1d['arg_1'],_0x149b1d['calleridname'],_0x149b1d['callerid'],_0x149b1d[_0x8c06('0x1a')],_0x149b1d[_0x8c06('0x1b')]));_0x149b1d['on'](_0x8c06('0xd'),errorHandler);_0x149b1d['on'](_0x8c06('0x29'),closeHandler);_0x149b1d['on']('timeout',timeoutHandler);_0x149b1d['evtHangup']=![];_0x149b1d['on']('hangup',hangupHandler);var _0x49ee7e=_[_0x8c06('0x2a')](projects,[_0x8c06('0x14'),_0x149b1d[_0x8c06('0x2b')]]);if(!_0x49ee7e)return Project[_0x8c06('0x2c')](_0x149b1d);if(!_0x49ee7e[_0x8c06('0x2d')])return Project[_0x8c06('0x2e')](_0x149b1d);return Project[_0x8c06('0x2f')](_0x49ee7e,_0x149b1d);}function main(){var _0x2d6e68;return utilLicense[_0x8c06('0x30')]()['then'](function(_0x3dfbea){if(!_0x3dfbea)return;if(_0x3dfbea[_0x8c06('0x31')]){if(_0x3dfbea[_0x8c06('0x32')]&&_0x3dfbea['callysquare']>0x0){logger[_0x8c06('0x11')](util[_0x8c06('0x12')](_0x8c06('0x33'),_0x3dfbea[_0x8c06('0x32')]));_0x2d6e68=_0x3dfbea[_0x8c06('0x32')];}else{logger[_0x8c06('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x8c06('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2d6e68=-0x1;}})[_0x8c06('0x20')](function(){return Project[_0x8c06('0x34')]();})['then'](function(_0x402498){projects=_0x402498;return;})[_0x8c06('0x21')](function(_0x43e633){logger['error']('[LICENSE]',_0x43e633[_0x8c06('0xe')]);})['finally'](function(){var _0x57f378=require(_0x8c06('0x35'))(config[_0x8c06('0x2')][_0x8c06('0x36')],config[_0x8c06('0x2')]['ip'],_0x2d6e68);_0x57f378['on'](_0x8c06('0xd'),errorHandler);_0x57f378['on'](_0x8c06('0x37'),listeningHandler);_0x57f378['on']('connection',connectionHandler);_0x57f378['on'](_0x8c06('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0xc278=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','stack','findIndex','deleted','splice','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug'];(function(_0x2bf109,_0x46c8d1){var _0x471d1=function(_0xb8261e){while(--_0xb8261e){_0x2bf109['push'](_0x2bf109['shift']());}};_0x471d1(++_0x46c8d1);}(_0xc278,0xc2));var _0x8c27=function(_0x288dbf,_0x202108){_0x288dbf=_0x288dbf-0x0;var _0x2a8f03=_0xc278[_0x288dbf];return _0x2a8f03;};'use strict';var _=require(_0x8c27('0x0'));var syncho=require(_0x8c27('0x1'));var util=require('util');var config=require(_0x8c27('0x2'));var logger=require(_0x8c27('0x3'))(_0x8c27('0x4'));var utilLicense=require(_0x8c27('0x5'));var rpc=require(_0x8c27('0x6'));var Project=require('./project');var AGIEmitter=require(_0x8c27('0x7'))[_0x8c27('0x8')];var projects=[];config[_0x8c27('0x4')]=_[_0x8c27('0x9')](config[_0x8c27('0x4')],{'ip':_0x8c27('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x51e6b0){process[_0x8c27('0xb')](function(){syncho(function(){try{setChannelVariables(_0x51e6b0);agiHandler(_0x51e6b0);}catch(_0x3c3018){logger['error'](_0x3c3018[_0x8c27('0xc')]);}});});}function projectUpdateHandler(_0x592742){try{var _0x50f355=_[_0x8c27('0xd')](projects,['id',_0x592742['id']]);if(_0x50f355>-0x1){if(_0x592742[_0x8c27('0xe')]===!![]){projects[_0x8c27('0xf')](_0x50f355,0x1);}else{projects[_0x50f355]=_0x592742;}}else{projects['push'](_0x592742);}}catch(_0x92f9f7){logger[_0x8c27('0x10')](_0x92f9f7[_0x8c27('0xc')]);}}function listeningHandler(){console['log'](_0x8c27('0x11'),config[_0x8c27('0x4')][_0x8c27('0x12')]);logger[_0x8c27('0x13')](util[_0x8c27('0x14')](_0x8c27('0x15'),config[_0x8c27('0x4')]['ip'],config[_0x8c27('0x4')]['port']));}function errorHandler(_0x55d019){if(_0x55d019&&_0x55d019[_0x8c27('0x16')]&&_0x55d019[_0x8c27('0x17')]){logger[_0x8c27('0x10')](util['format'](_0x8c27('0x18'),_0x55d019['name'],_0x55d019[_0x8c27('0x17')]));}else{logger[_0x8c27('0x10')](util[_0x8c27('0x14')](_0x8c27('0x19'),_0x55d019[_0x8c27('0xc')]));}}function closeHandler(){logger['info'](util['format'](_0x8c27('0x1a'),this[_0x8c27('0x1b')],this['calleridname'],this[_0x8c27('0x1c')],this['dnid'],this[_0x8c27('0x1d')]));try{createSquareReport(this);}catch(_0x1da533){logger[_0x8c27('0x10')](_0x1da533[_0x8c27('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x8c27('0x14')](_0x8c27('0x1e'),this[_0x8c27('0x1b')],this['calleridname'],this['callerid'],this[_0x8c27('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x8c27('0x13')](util[_0x8c27('0x14')](_0x8c27('0x20'),this[_0x8c27('0x1b')],this[_0x8c27('0x21')],this['callerid'],this[_0x8c27('0x1f')],this[_0x8c27('0x1d')]));this[_0x8c27('0x22')]=!![];}function createSquareReport(_0x2e0101,_0x5cf7a7){rpc[_0x8c27('0x23')](_0x2e0101)['then'](function(_0x1dd984){if(_0x5cf7a7){_0x5cf7a7(null,_0x1dd984);}})[_0x8c27('0x24')](function(_0x43ee91){if(_0x5cf7a7){_0x5cf7a7(null,_0x43ee91);}});}function setChannelVariables(_0x3d7d9d){for(var _0x2fd411 in _0x3d7d9d){if(_0x3d7d9d[_0x8c27('0x25')](_0x2fd411)){if(_0x2fd411[_0x8c27('0x26')](_0x8c27('0x27'))===0x0){_0x3d7d9d[_0x2fd411[_0x8c27('0x28')](0x4)]=_0x3d7d9d[_0x2fd411];delete _0x3d7d9d[_0x2fd411];}}}}function agiHandler(_0x47329b){logger[_0x8c27('0x29')]('variables',JSON[_0x8c27('0x2a')](_0x47329b,null,0x2));logger[_0x8c27('0x13')](util['format'](_0x8c27('0x2b'),_0x47329b[_0x8c27('0x1b')],_0x47329b[_0x8c27('0x21')],_0x47329b[_0x8c27('0x1c')],_0x47329b['dnid'],_0x47329b[_0x8c27('0x1d')]));_0x47329b['on'](_0x8c27('0x10'),errorHandler);_0x47329b['on'](_0x8c27('0x2c'),closeHandler);_0x47329b['on'](_0x8c27('0x2d'),timeoutHandler);_0x47329b[_0x8c27('0x22')]=![];_0x47329b['on']('hangup',hangupHandler);var _0x160960=_[_0x8c27('0x2e')](projects,['name',_0x47329b[_0x8c27('0x1b')]]);if(!_0x160960)return Project[_0x8c27('0x2f')](_0x47329b);if(!_0x160960[_0x8c27('0x30')])return Project['handleUnpublished'](_0x47329b);return Project[_0x8c27('0x31')](_0x160960,_0x47329b);}function main(){var _0xeeb562;return utilLicense[_0x8c27('0x32')]()[_0x8c27('0x33')](function(_0x3072b3){if(!_0x3072b3)return;if(_0x3072b3[_0x8c27('0x34')]){if(_0x3072b3[_0x8c27('0x35')]&&_0x3072b3[_0x8c27('0x35')]>0x0){logger[_0x8c27('0x13')](util[_0x8c27('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3072b3[_0x8c27('0x35')]));_0xeeb562=_0x3072b3[_0x8c27('0x35')];}else{logger[_0x8c27('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x8c27('0x36'));_0xeeb562=-0x1;}})[_0x8c27('0x33')](function(){return Project[_0x8c27('0x37')]();})[_0x8c27('0x33')](function(_0x3886f5){projects=_0x3886f5;return;})[_0x8c27('0x24')](function(_0x3dd8f2){logger[_0x8c27('0x10')](_0x8c27('0x38'),_0x3dd8f2[_0x8c27('0xc')]);})['finally'](function(){var _0x2798c7=require(_0x8c27('0x39'))(config[_0x8c27('0x4')][_0x8c27('0x12')],config['agi']['ip'],_0xeeb562);_0x2798c7['on'](_0x8c27('0x10'),errorHandler);_0x2798c7['on'](_0x8c27('0x3a'),listeningHandler);_0x2798c7['on']('connection',connectionHandler);_0x2798c7['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 96b8250..ba66903 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 _0xe8d1=['catch','sendMailMessage','SendMail','jayson/promise','client','http','error','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe8d1,0x1ab));var _0x1e8d=function(_0x3120e6,_0x324456){_0x3120e6=_0x3120e6-0x0;var _0x5b739f=_0xe8d1[_0x3120e6];return _0x5b739f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1e8d('0x0'));var client=jayson[_0x1e8d('0x1')][_0x1e8d('0x2')]({'port':0x232b});function request(_0xbbd39a,_0x2d7c0b){return new BPromise(function(_0x30a45f,_0x20d514){return client['request'](_0xbbd39a,_0x2d7c0b)['then'](function(_0x59f168){if(_0x59f168[_0x1e8d('0x3')]){return _0x20d514(_0x59f168[_0x1e8d('0x3')]['message']);}else{return _0x30a45f(_0x59f168[_0x1e8d('0x4')]);}})[_0x1e8d('0x5')](function(_0x47a4e3){return _0x20d514(_0x47a4e3);});});}exports[_0x1e8d('0x6')]=function(_0x5589e9,_0x4284a5){return request(_0x1e8d('0x7'),{'account':_0x5589e9,'message':_0x4284a5});}; \ No newline at end of file +var _0x8ba9=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x8ba9,0x1ce));var _0x98ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8ba9[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x98ba('0x0'));var jayson=require(_0x98ba('0x1'));var client=jayson[_0x98ba('0x2')]['http']({'port':0x232b});function request(_0x39cc24,_0x44ebe0){return new BPromise(function(_0x540759,_0x317f2e){return client[_0x98ba('0x3')](_0x39cc24,_0x44ebe0)[_0x98ba('0x4')](function(_0x41b328){if(_0x41b328[_0x98ba('0x5')]){return _0x317f2e(_0x41b328[_0x98ba('0x5')]['message']);}else{return _0x540759(_0x41b328['result']);}})[_0x98ba('0x6')](function(_0x21f671){return _0x317f2e(_0x21f671);});});}exports[_0x98ba('0x7')]=function(_0x1993f8,_0x1d7ff6){return request(_0x98ba('0x8'),{'account':_0x1993f8,'message':_0x1d7ff6});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index ab4e364..909b765 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 _0xfe99=['root','inspect','production','start','stringify','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','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','uniqueid','finally','debug','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','omit','mxCell','isArray','length','target','source','value','toJson','mxGraphModel'];(function(_0x173c30,_0x1c4b93){var _0x10f604=function(_0x35cce2){while(--_0x35cce2){_0x173c30['push'](_0x173c30['shift']());}};_0x10f604(++_0x1c4b93);}(_0xfe99,0x115));var _0x9fe9=function(_0x10bfc9,_0x27a27e){_0x10bfc9=_0x10bfc9-0x0;var _0x27b310=_0xfe99[_0x10bfc9];return _0x27b310;};'use strict';var _=require(_0x9fe9('0x0'));var moment=require(_0x9fe9('0x1'));var parser=require('xml2json');var util=require(_0x9fe9('0x2'));var logger=require(_0x9fe9('0x3'))(_0x9fe9('0x4'));var rpc=require(_0x9fe9('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x9fe9('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9fe9('0x7')]()[_0x9fe9('0x8')](function(_0x51392d){logger[_0x9fe9('0x9')](_0x9fe9('0xa'),_0x51392d[_0x9fe9('0xb')]);return[];});}function addVertex(_0x44908b,_0xb385b5,_0x54402e){_0xb385b5['agicommand']=_0x54402e;if(_0xb385b5[_0x9fe9('0xc')](_0x9fe9('0xd'))){_0xb385b5['maxRetry']=parseInt(_0xb385b5['retry'],0xa);}_0x44908b['addVertex'](_[_0x9fe9('0xe')](_0xb385b5,_0x9fe9('0xf')));}function initGraph(_0x17c55c,_0x37bdf5){var _0x49ec56=new Graph();for(var _0x3a2c88 in _0x17c55c){if(_0x17c55c['hasOwnProperty'](_0x3a2c88)){if(_[_0x9fe9('0x10')](_0x17c55c[_0x3a2c88])){for(var _0x2a7ead=0x0;_0x2a7ead<_0x17c55c[_0x3a2c88]['length'];_0x2a7ead+=0x1){addVertex(_0x49ec56,_0x17c55c[_0x3a2c88][_0x2a7ead],_0x3a2c88);}}else{addVertex(_0x49ec56,_0x17c55c[_0x3a2c88],_0x3a2c88);}}}for(var _0x2d479d=0x0;_0x2d479d<_0x37bdf5[_0x9fe9('0x11')];_0x2d479d+=0x1){if(_0x37bdf5[_0x2d479d]['source']&&_0x37bdf5[_0x2d479d][_0x9fe9('0x12')]){_0x49ec56['addEdge'](_0x37bdf5[_0x2d479d][_0x9fe9('0x13')],_0x37bdf5[_0x2d479d][_0x9fe9('0x12')],_0x37bdf5[_0x2d479d][_0x9fe9('0x14')]);}}return _0x49ec56;}function getRoot(_0x250648){return parser[_0x9fe9('0x15')](_0x250648,{'object':!![]})[_0x9fe9('0x16')][_0x9fe9('0x17')];}function inspect(_0x1b5970){return util[_0x9fe9('0x18')](_0x1b5970,{'showHidden':![],'depth':null});}function initialize(_0x29b184,_0xf48e9d){var _0x23be99=getRoot(_0x29b184[_0x9fe9('0x19')]);if(!_0x23be99||!_0x23be99[_0x9fe9('0x1a')])return;var _0x3c4d56,_0x5c9601,_0x184083;logger['debug']('root',JSON[_0x9fe9('0x1b')](_0x23be99,null,0x2));_0xf48e9d['joinAt']=moment()[_0x9fe9('0x1c')](_0x9fe9('0x1d'));_0x3c4d56=initGraph(_['omit'](_0x23be99,'mxCell'),_0x23be99[_0x9fe9('0xf')]);_0x5c9601=new Vertices(_0xf48e9d,rpc,mailRpc);logger[_0x9fe9('0x1e')](util['format'](_0x9fe9('0x1f'),_0xf48e9d[_0x9fe9('0x20')],_0xf48e9d[_0x9fe9('0x21')],_0xf48e9d[_0x9fe9('0x22')],_0xf48e9d['dnid'],_0xf48e9d['uniqueid']));_0x3c4d56[_0x9fe9('0x23')](_0x23be99[_0x9fe9('0x1a')]['id'],function(_0x215b3a){try{_0x215b3a=_0x5c9601[_0x9fe9('0x24')](_0x215b3a);logger['debug'](_0x9fe9('0x25'),JSON['stringify'](_0x215b3a,null,0x2));if(_0x215b3a['agicommand']===_0x9fe9('0x26')){logger[_0x9fe9('0x1e')](_0x9fe9('0x27'));_0xf48e9d['context']=_0x215b3a[_0x9fe9('0x28')]||_0xf48e9d[_0x9fe9('0x28')];_0xf48e9d[_0x9fe9('0x29')]=_0x215b3a[_0x9fe9('0x29')];_0xf48e9d[_0x9fe9('0x2a')]=_0x215b3a[_0x9fe9('0x2a')]?_0x215b3a[_0x9fe9('0x2a')]-0x1:0x1;return null;}else if(_0x215b3a&&_0x5c9601[_0x215b3a[_0x9fe9('0x2b')]]){_0x184083=_0x5c9601[_0x215b3a[_0x9fe9('0x2b')]](_0x215b3a);logger['info'](_0x9fe9('0x2c'),JSON['stringify'](_0x184083,null,0x2));if(_0x184083&&_0x184083[_0x9fe9('0x2d')]===AGI_CODE_SUCCESS&&_0x184083[_0x9fe9('0x2e')]!==AGI_RESULT_ERROR&&!_0xf48e9d[_0x9fe9('0x2f')]){logger['debug'](_0x9fe9('0x2c'),inspect(_0x184083));return _[_0x9fe9('0x30')](_0x184083['result'])?null:_0x184083[_0x9fe9('0x2e')][_0x9fe9('0x31')]();}else{logger[_0x9fe9('0x9')](_0x9fe9('0x2c'),inspect(_0x184083));return null;}}else{logger['error'](_0x9fe9('0x32'));return null;}}catch(_0x1b3415){logger['error'](_0x1b3415[_0x9fe9('0xb')]);return null;}});if(_0x23be99['finally']){logger[_0x9fe9('0x1e')](util[_0x9fe9('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xf48e9d[_0x9fe9('0x20')],_0xf48e9d[_0x9fe9('0x21')],_0xf48e9d[_0x9fe9('0x22')],_0xf48e9d['dnid'],_0xf48e9d[_0x9fe9('0x33')]));_0x3c4d56[_0x9fe9('0x23')](_0x23be99[_0x9fe9('0x34')]['id'],function(_0x483b9e){try{_0x483b9e=_0x5c9601[_0x9fe9('0x24')](_0x483b9e);logger[_0x9fe9('0x35')](_0x9fe9('0x25'),JSON[_0x9fe9('0x1b')](_0x483b9e,null,0x2));if(_0x483b9e&&_0x5c9601[_0x483b9e[_0x9fe9('0x2b')]]){_0x184083=_0x5c9601[_0x483b9e['agicommand']](_0x483b9e);if(_0x184083){logger[_0x9fe9('0x35')](_0x9fe9('0x2c'),inspect(_0x184083));return _['isUndefined'](_0x184083[_0x9fe9('0x2e')])?null:_0x184083[_0x9fe9('0x2e')][_0x9fe9('0x31')]();}else{logger[_0x9fe9('0x9')](_0x9fe9('0x2c'),inspect(_0x184083));return null;}}else{logger[_0x9fe9('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x3c74b5){logger['error'](_0x3c74b5[_0x9fe9('0xb')]);return null;}});}logger['info'](util[_0x9fe9('0x1c')](_0x9fe9('0x36'),_0xf48e9d[_0x9fe9('0x20')],_0xf48e9d['calleridname'],_0xf48e9d[_0x9fe9('0x22')],_0xf48e9d['dnid'],_0xf48e9d[_0x9fe9('0x33')]));logger[_0x9fe9('0x1e')](util[_0x9fe9('0x1c')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xf48e9d[_0x9fe9('0x28')],_0xf48e9d['extension'],parseInt(_0xf48e9d[_0x9fe9('0x2a')],0xa)+0x1));_0xf48e9d[_0x9fe9('0x37')](_0xf48e9d[_0x9fe9('0x28')],_0xf48e9d['extension'],parseInt(_0xf48e9d['priority'],0xa)+0x1);_0xf48e9d[_0x9fe9('0x38')]();}function handleNotFound(_0xb1b90){logger['error'](util[_0x9fe9('0x1c')](_0x9fe9('0x39'),_0xb1b90[_0x9fe9('0x20')]));_0xb1b90[_0x9fe9('0x37')](_0xb1b90['context'],_0xb1b90[_0x9fe9('0x29')],parseInt(_0xb1b90[_0x9fe9('0x2a')],0xa)+0x1);_0xb1b90[_0x9fe9('0x38')]();}function handleUnpublished(_0x240c29){logger[_0x9fe9('0x9')](util['format'](_0x9fe9('0x3a'),_0x240c29[_0x9fe9('0x20')]));_0x240c29['continueAt'](_0x240c29[_0x9fe9('0x28')],_0x240c29[_0x9fe9('0x29')],parseInt(_0x240c29[_0x9fe9('0x2a')],0xa)+0x1);_0x240c29[_0x9fe9('0x38')]();}module[_0x9fe9('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xdfa1=['close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','target','addEdge','source','value','mxGraphModel','root','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','agicommand\x20not\x20found','finally','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfa1,0x1e2));var _0x1dfa=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdfa1[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x1dfa('0x0'));var moment=require(_0x1dfa('0x1'));var parser=require(_0x1dfa('0x2'));var util=require(_0x1dfa('0x3'));var logger=require(_0x1dfa('0x4'))(_0x1dfa('0x5'));var rpc=require(_0x1dfa('0x6'));var mailRpc=require(_0x1dfa('0x7'));var Graph=require(_0x1dfa('0x8'));var Vertices=require(_0x1dfa('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1dfa('0xa')]()['catch'](function(_0x36afbb){logger[_0x1dfa('0xb')](_0x1dfa('0xc'),_0x36afbb[_0x1dfa('0xd')]);return[];});}function addVertex(_0x49f4bd,_0x6c64af,_0xae0d7c){_0x6c64af[_0x1dfa('0xe')]=_0xae0d7c;if(_0x6c64af['hasOwnProperty'](_0x1dfa('0xf'))){_0x6c64af['maxRetry']=parseInt(_0x6c64af['retry'],0xa);}_0x49f4bd[_0x1dfa('0x10')](_['omit'](_0x6c64af,'mxCell'));}function initGraph(_0x2771ab,_0x149149){var _0x1e261d=new Graph();for(var _0x19dd94 in _0x2771ab){if(_0x2771ab[_0x1dfa('0x11')](_0x19dd94)){if(_[_0x1dfa('0x12')](_0x2771ab[_0x19dd94])){for(var _0x49cee4=0x0;_0x49cee4<_0x2771ab[_0x19dd94][_0x1dfa('0x13')];_0x49cee4+=0x1){addVertex(_0x1e261d,_0x2771ab[_0x19dd94][_0x49cee4],_0x19dd94);}}else{addVertex(_0x1e261d,_0x2771ab[_0x19dd94],_0x19dd94);}}}for(var _0x40e23f=0x0;_0x40e23f<_0x149149[_0x1dfa('0x13')];_0x40e23f+=0x1){if(_0x149149[_0x40e23f]['source']&&_0x149149[_0x40e23f][_0x1dfa('0x14')]){_0x1e261d[_0x1dfa('0x15')](_0x149149[_0x40e23f][_0x1dfa('0x16')],_0x149149[_0x40e23f][_0x1dfa('0x14')],_0x149149[_0x40e23f][_0x1dfa('0x17')]);}}return _0x1e261d;}function getRoot(_0x1f0078){return parser['toJson'](_0x1f0078,{'object':!![]})[_0x1dfa('0x18')][_0x1dfa('0x19')];}function inspect(_0x4190af){return util['inspect'](_0x4190af,{'showHidden':![],'depth':null});}function initialize(_0x3640ad,_0x48465e){var _0x337455=getRoot(_0x3640ad[_0x1dfa('0x1a')]);if(!_0x337455||!_0x337455[_0x1dfa('0x1b')])return;var _0x19f5af,_0x22f1eb,_0x624850;logger[_0x1dfa('0x1c')](_0x1dfa('0x19'),JSON[_0x1dfa('0x1d')](_0x337455,null,0x2));_0x48465e[_0x1dfa('0x1e')]=moment()[_0x1dfa('0x1f')](_0x1dfa('0x20'));_0x19f5af=initGraph(_[_0x1dfa('0x21')](_0x337455,_0x1dfa('0x22')),_0x337455['mxCell']);_0x22f1eb=new Vertices(_0x48465e,rpc,mailRpc);logger[_0x1dfa('0x23')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x48465e[_0x1dfa('0x24')],_0x48465e[_0x1dfa('0x25')],_0x48465e['callerid'],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));_0x19f5af[_0x1dfa('0x28')](_0x337455[_0x1dfa('0x1b')]['id'],function(_0x50af10){try{_0x50af10=_0x22f1eb[_0x1dfa('0x29')](_0x50af10);logger[_0x1dfa('0x1c')]('vertex',JSON[_0x1dfa('0x1d')](_0x50af10,null,0x2));if(_0x50af10['agicommand']===_0x1dfa('0x2a')){logger['info'](_0x1dfa('0x2b'));_0x48465e[_0x1dfa('0x2c')]=_0x50af10[_0x1dfa('0x2c')]||_0x48465e[_0x1dfa('0x2c')];_0x48465e[_0x1dfa('0x2d')]=_0x50af10[_0x1dfa('0x2d')];_0x48465e[_0x1dfa('0x2e')]=_0x50af10[_0x1dfa('0x2e')]?_0x50af10[_0x1dfa('0x2e')]-0x1:0x1;return null;}else if(_0x50af10&&_0x22f1eb[_0x50af10[_0x1dfa('0xe')]]){_0x624850=_0x22f1eb[_0x50af10[_0x1dfa('0xe')]](_0x50af10);logger[_0x1dfa('0x23')](_0x1dfa('0x2f'),JSON[_0x1dfa('0x1d')](_0x624850,null,0x2));if(_0x624850&&_0x624850['code']===AGI_CODE_SUCCESS&&_0x624850[_0x1dfa('0x30')]!==AGI_RESULT_ERROR&&!_0x48465e['evtHangup']){logger[_0x1dfa('0x1c')](_0x1dfa('0x2f'),inspect(_0x624850));return _[_0x1dfa('0x31')](_0x624850[_0x1dfa('0x30')])?null:_0x624850['result']['toString']();}else{logger['error'](_0x1dfa('0x2f'),inspect(_0x624850));return null;}}else{logger[_0x1dfa('0xb')](_0x1dfa('0x32'));return null;}}catch(_0x1de02f){logger[_0x1dfa('0xb')](_0x1de02f[_0x1dfa('0xd')]);return null;}});if(_0x337455[_0x1dfa('0x33')]){logger['info'](util[_0x1dfa('0x1f')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x48465e['arg_1'],_0x48465e[_0x1dfa('0x25')],_0x48465e['callerid'],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));_0x19f5af[_0x1dfa('0x28')](_0x337455['finally']['id'],function(_0x5077f9){try{_0x5077f9=_0x22f1eb['clear'](_0x5077f9);logger[_0x1dfa('0x1c')](_0x1dfa('0x34'),JSON['stringify'](_0x5077f9,null,0x2));if(_0x5077f9&&_0x22f1eb[_0x5077f9[_0x1dfa('0xe')]]){_0x624850=_0x22f1eb[_0x5077f9[_0x1dfa('0xe')]](_0x5077f9);if(_0x624850){logger['debug'](_0x1dfa('0x2f'),inspect(_0x624850));return _['isUndefined'](_0x624850[_0x1dfa('0x30')])?null:_0x624850[_0x1dfa('0x30')][_0x1dfa('0x35')]();}else{logger[_0x1dfa('0xb')](_0x1dfa('0x2f'),inspect(_0x624850));return null;}}else{logger[_0x1dfa('0xb')](_0x1dfa('0x32'));return null;}}catch(_0x16e777){logger[_0x1dfa('0xb')](_0x16e777['stack']);return null;}});}logger[_0x1dfa('0x23')](util[_0x1dfa('0x1f')](_0x1dfa('0x36'),_0x48465e['arg_1'],_0x48465e['calleridname'],_0x48465e[_0x1dfa('0x37')],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));logger[_0x1dfa('0x23')](util[_0x1dfa('0x1f')](_0x1dfa('0x38'),_0x48465e[_0x1dfa('0x2c')],_0x48465e['extension'],parseInt(_0x48465e['priority'],0xa)+0x1));_0x48465e[_0x1dfa('0x39')](_0x48465e[_0x1dfa('0x2c')],_0x48465e[_0x1dfa('0x2d')],parseInt(_0x48465e[_0x1dfa('0x2e')],0xa)+0x1);_0x48465e[_0x1dfa('0x3a')]();}function handleNotFound(_0x20fdad){logger[_0x1dfa('0xb')](util[_0x1dfa('0x1f')]('Project\x20%s\x20not\x20found',_0x20fdad[_0x1dfa('0x24')]));_0x20fdad['continueAt'](_0x20fdad[_0x1dfa('0x2c')],_0x20fdad['extension'],parseInt(_0x20fdad[_0x1dfa('0x2e')],0xa)+0x1);_0x20fdad[_0x1dfa('0x3a')]();}function handleUnpublished(_0x3d409f){logger['error'](util[_0x1dfa('0x1f')]('Project\x20%s\x20not\x20published',_0x3d409f[_0x1dfa('0x24')]));_0x3d409f[_0x1dfa('0x39')](_0x3d409f[_0x1dfa('0x2c')],_0x3d409f[_0x1dfa('0x2d')],parseInt(_0x3d409f['priority'],0xa)+0x1);_0x3d409f['close']();}module[_0x1dfa('0x3b')]={'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 4e108fd..5b1d211 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 _0x6bc9=['trim','emit','headers','line','util','stream','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x6bc9,0x1cc));var _0x96bc=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0x6bc9[_0x1f69bc];return _0x1ac3c5;};'use strict';var util=require(_0x96bc('0x0'));var Transform=require(_0x96bc('0x1'))[_0x96bc('0x2')];function AGIReply(_0x21c34f){Transform[_0x96bc('0x3')](this,_0x21c34f);this['_localBuffer']='';this[_0x96bc('0x4')]=![];}util[_0x96bc('0x5')](AGIReply,Transform);AGIReply[_0x96bc('0x6')][_0x96bc('0x7')]=function(_0x513ac8,_0x58a1da,_0x44bc83){var _0x1b2f9c='\x0a',_0x1ed822=['\x0a\x0a',_0x96bc('0x8')],_0x362bdc=-0x1,_0x2c3155=-0x1,_0x21b35c='',_0x4fb65e=0x0,_0x13a486='',_0x3bee70='';this[_0x96bc('0x9')]+=_0x513ac8[_0x96bc('0xa')]();_0x13a486=this[_0x96bc('0x9')];if(!this['_inBody']){_0x4fb65e=0x0;while(_0x1ed822[_0x4fb65e]){while((_0x2c3155=_0x13a486[_0x96bc('0xb')](_0x1ed822[_0x4fb65e]))!=-0x1){_0x21b35c=_0x1ed822[_0x4fb65e];_0x3bee70=_0x13a486[_0x96bc('0xc')](0x0,_0x2c3155);_0x13a486=_0x13a486[_0x96bc('0xc')](_0x2c3155+_0x21b35c[_0x96bc('0xd')]);var _0x501413=_0x3bee70[_0x96bc('0xe')](_0x1b2f9c),_0x1e2285=0x0,_0x339b1c={},_0x56e8f6='',_0x189b47='',_0x20f238=-0x1;while(_0x501413[_0x1e2285]){_0x20f238=_0x501413[_0x1e2285][_0x96bc('0xb')](':');if(_0x20f238!=-0x1){_0x56e8f6=_0x501413[_0x1e2285]['slice'](0x0,_0x20f238)[_0x96bc('0xf')]();_0x189b47=_0x501413[_0x1e2285]['slice'](_0x20f238+0x1)[_0x96bc('0xf')]();if(_0x56e8f6['length']>0x0){_0x339b1c[_0x56e8f6]=_0x189b47;}}else{}_0x1e2285++;}this[_0x96bc('0x10')](_0x96bc('0x11'),_0x339b1c);this[_0x96bc('0x4')]=!![];}_0x4fb65e++;}this[_0x96bc('0x9')]=_0x13a486;}else{while((_0x362bdc=_0x13a486[_0x96bc('0xb')](_0x1b2f9c))!=-0x1){_0x3bee70=_0x13a486[_0x96bc('0xc')](0x0,_0x362bdc);this[_0x96bc('0x10')](_0x96bc('0x12'),_0x3bee70);_0x13a486=_0x13a486[_0x96bc('0xc')](_0x362bdc+_0x1b2f9c[_0x96bc('0xd')]);}this[_0x96bc('0x9')]=_0x13a486;}_0x44bc83();};module['exports']=AGIReply; \ No newline at end of file +var _0xf031=['prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','_inBody','indexOf','substring','slice','trim','emit','headers','line','length','Transform','call','inherits'];(function(_0x1729d5,_0x5921c5){var _0x6bb300=function(_0x31303a){while(--_0x31303a){_0x1729d5['push'](_0x1729d5['shift']());}};_0x6bb300(++_0x5921c5);}(_0xf031,0xfc));var _0x1f03=function(_0xfbaa8b,_0x350d63){_0xfbaa8b=_0xfbaa8b-0x0;var _0x33c32c=_0xf031[_0xfbaa8b];return _0x33c32c;};'use strict';var util=require('util');var Transform=require('stream')[_0x1f03('0x0')];function AGIReply(_0x68cc71){Transform[_0x1f03('0x1')](this,_0x68cc71);this['_localBuffer']='';this['_inBody']=![];}util[_0x1f03('0x2')](AGIReply,Transform);AGIReply[_0x1f03('0x3')][_0x1f03('0x4')]=function(_0x4bcab4,_0x399588,_0x2dc000){var _0xfef1='\x0a',_0x23c63b=['\x0a\x0a',_0x1f03('0x5')],_0x416bc0=-0x1,_0x5e37ab=-0x1,_0x239813='',_0x3c6256=0x0,_0x30a3fb='',_0x45f3eb='';this[_0x1f03('0x6')]+=_0x4bcab4[_0x1f03('0x7')]();_0x30a3fb=this[_0x1f03('0x6')];if(!this[_0x1f03('0x8')]){_0x3c6256=0x0;while(_0x23c63b[_0x3c6256]){while((_0x5e37ab=_0x30a3fb[_0x1f03('0x9')](_0x23c63b[_0x3c6256]))!=-0x1){_0x239813=_0x23c63b[_0x3c6256];_0x45f3eb=_0x30a3fb[_0x1f03('0xa')](0x0,_0x5e37ab);_0x30a3fb=_0x30a3fb[_0x1f03('0xa')](_0x5e37ab+_0x239813['length']);var _0x271884=_0x45f3eb['split'](_0xfef1),_0x32e868=0x0,_0xc2c7f5={},_0x84c916='',_0x3dd878='',_0x3a82be=-0x1;while(_0x271884[_0x32e868]){_0x3a82be=_0x271884[_0x32e868][_0x1f03('0x9')](':');if(_0x3a82be!=-0x1){_0x84c916=_0x271884[_0x32e868][_0x1f03('0xb')](0x0,_0x3a82be)[_0x1f03('0xc')]();_0x3dd878=_0x271884[_0x32e868][_0x1f03('0xb')](_0x3a82be+0x1)[_0x1f03('0xc')]();if(_0x84c916['length']>0x0){_0xc2c7f5[_0x84c916]=_0x3dd878;}}else{}_0x32e868++;}this[_0x1f03('0xd')](_0x1f03('0xe'),_0xc2c7f5);this[_0x1f03('0x8')]=!![];}_0x3c6256++;}this['_localBuffer']=_0x30a3fb;}else{while((_0x416bc0=_0x30a3fb[_0x1f03('0x9')](_0xfef1))!=-0x1){_0x45f3eb=_0x30a3fb[_0x1f03('0xa')](0x0,_0x416bc0);this['emit'](_0x1f03('0xf'),_0x45f3eb);_0x30a3fb=_0x30a3fb[_0x1f03('0xa')](_0x416bc0+_0xfef1[_0x1f03('0x10')]);}this[_0x1f03('0x6')]=_0x30a3fb;}_0x2dc000();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 10c414f..1fd3d6d 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 _0x1da1=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','catch','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x449be5,_0x438034){var _0x416b7c=function(_0x312eb8){while(--_0x312eb8){_0x449be5['push'](_0x449be5['shift']());}};_0x416b7c(++_0x438034);}(_0x1da1,0x1a4));var _0x11da=function(_0x5a724d,_0x36d1f3){_0x5a724d=_0x5a724d-0x0;var _0x3cea0f=_0x1da1[_0x5a724d];return _0x3cea0f;};'use strict';var _=require(_0x11da('0x0'));var moment=require(_0x11da('0x1'));var jayson=require(_0x11da('0x2'));var client=jayson[_0x11da('0x3')][_0x11da('0x4')]({'port':0x2329});function request(_0x5b0fe4,_0x55af86){return new Promise(function(_0x23014b,_0x1beca5){return client[_0x11da('0x5')](_0x5b0fe4,_0x55af86)['then'](function(_0xb2c841){if(_0xb2c841[_0x11da('0x6')]){return _0x1beca5(_0xb2c841[_0x11da('0x6')]['message']);}else{return _0x23014b(_0xb2c841['result']);}})[_0x11da('0x7')](function(_0x109f4b){return _0x1beca5(_0x109f4b);});});}exports['getSquareProjects']=function(){return request(_0x11da('0x8'),{'options':{'raw':![],'attributes':['id',_0x11da('0x9'),'production']}});};exports[_0x11da('0xa')]=function(_0xd8df99){return request(_0x11da('0xb'),{'options':{'raw':![],'where':{'name':_0xd8df99},'attributes':[_0x11da('0xc')]}});};exports[_0x11da('0xd')]=function(_0x37e537){return request(_0x11da('0xe'),{'options':{'raw':![],'where':{'id':_0x37e537},'include':[{'model':_0x11da('0xf'),'as':_0x11da('0x10'),'include':[{'model':'CloudProvider','as':_0x11da('0x11')}]}],'attributes':['id',_0x11da('0x9'),_0x11da('0x12')],'smtp':!![]}});};exports[_0x11da('0x13')]=function(_0x41d836){return request('ShowSquareProject',{'options':{'where':{'id':_0x41d836},'attributes':[_0x11da('0x9')]}});};exports[_0x11da('0x14')]=function(_0x2ee64d){return request(_0x11da('0x15'),{'options':{'where':{'id':_0x2ee64d},'attributes':[_0x11da('0x9')]}});};exports['getVariableById']=function(_0x1a0f47){return request('ShowVariable',{'options':{'where':{'id':_0x1a0f47},'attributes':[_0x11da('0x9')]}});};exports[_0x11da('0x16')]=function(_0x278f02){return request(_0x11da('0x17'),{'options':{'where':{'id':_0x278f02},'attributes':[_0x11da('0x18')]}});};exports[_0x11da('0x19')]=function(_0x9a4aa0){return request(_0x11da('0x1a'),{'options':{'where':{'id':_0x9a4aa0},'attributes':[_0x11da('0x9')]}});};exports[_0x11da('0x1b')]=function(_0x463c3d){return request(_0x11da('0x1c'),{'options':{'where':{'phone':_0x463c3d['phone']},'attributes':['id']}});};exports[_0x11da('0x1d')]=function(_0x2e2ae0){return request(_0x11da('0x1e'),{'options':{'where':{'id':_0x2e2ae0},'attributes':[_0x11da('0x9')]}});};exports[_0x11da('0x1f')]=function(_0x4dfdaf){return request(_0x11da('0x20'),{'options':{'where':{'id':_0x4dfdaf},'attributes':[_0x11da('0x21')]}});};exports[_0x11da('0x22')]=function(_0x481dd4){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x481dd4},'include':[{'model':_0x11da('0x23'),'as':_0x11da('0x24')}]}});};exports[_0x11da('0x25')]=function(_0x514fc4){return request(_0x11da('0x26'),{'options':{'where':{'id':_0x514fc4},'attributes':['id','name']}});};exports[_0x11da('0x27')]=function(_0x3a90db){return request(_0x11da('0x28'),{'body':_0x3a90db});};exports[_0x11da('0x29')]=function(_0x2b03dd){return request(_0x11da('0x2a'),{'body':_0x2b03dd});};exports['createSquareReport']=function(_0x5b2e7f){return request(_0x11da('0x2b'),{'body':_[_0x11da('0x2c')](_0x5b2e7f,{'project_name':_0x5b2e7f['arg_1'],'prev_project_name':_0x5b2e7f[_0x11da('0x2d')]||'','is_subproject':_0x5b2e7f[_0x11da('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0x11da('0x2e'))})});};exports[_0x11da('0x2f')]=function(_0x30ef75){return request(_0x11da('0x30'),{'body':_0x30ef75});};exports[_0x11da('0x31')]=function(_0x5e9c07){return request(_0x11da('0x32'),{'body':_0x5e9c07});};exports[_0x11da('0x33')]=function(_0x219ac0){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x219ac0[_0x11da('0x34')],'ListId':_0x219ac0['ListId']}}})['then'](function(_0x315488){if(_0x315488){return _0x315488;}return request(_0x11da('0x35'),{'body':_0x219ac0});});};exports[_0x11da('0x36')]=function(_0x4c66cd){return request('ShowPause',{'options':{'where':{'id':_0x4c66cd},'attributes':[_0x11da('0x9')]}});};exports[_0x11da('0x37')]=function(_0x1dbd81,_0x4bf513){return request(_0x11da('0x38'),{'body':{'interface':_0x4bf513},'options':{'where':_0x1dbd81}});};exports[_0x11da('0x39')]=function(_0x56e74d,_0x1ccd67,_0x4f58b8){return request('PauseUser',{'body':{'type':_0x1ccd67,'uniqueid':_0x4f58b8},'options':{'where':_0x56e74d}});};exports[_0x11da('0x3a')]=function(_0x1b27de){return request(_0x11da('0x3b'),{'body':{},'options':{'where':_0x1b27de}});};exports[_0x11da('0x3c')]=function(_0x37132f){return request(_0x11da('0x3d'),{'body':{},'options':{'where':_0x37132f}});}; \ No newline at end of file +var _0x4a25=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','UnpauseUser','agentLogout','lodash','jayson/promise','http','request','then','error','result','catch','name','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x4a25,0x1d4));var _0x54a2=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4a25[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0x54a2('0x0'));var moment=require('moment');var jayson=require(_0x54a2('0x1'));var client=jayson['client'][_0x54a2('0x2')]({'port':0x2329});function request(_0x1631ce,_0x446759){return new Promise(function(_0x3e5d5b,_0x5c6c1f){return client[_0x54a2('0x3')](_0x1631ce,_0x446759)[_0x54a2('0x4')](function(_0x240603){if(_0x240603[_0x54a2('0x5')]){return _0x5c6c1f(_0x240603[_0x54a2('0x5')]['message']);}else{return _0x3e5d5b(_0x240603[_0x54a2('0x6')]);}})[_0x54a2('0x7')](function(_0x1d7b2c){return _0x5c6c1f(_0x1d7b2c);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x54a2('0x8'),'production']}});};exports[_0x54a2('0x9')]=function(_0x28655c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x28655c},'attributes':[_0x54a2('0xa')]}});};exports[_0x54a2('0xb')]=function(_0x4ee059){return request(_0x54a2('0xc'),{'options':{'raw':![],'where':{'id':_0x4ee059},'include':[{'model':_0x54a2('0xd'),'as':'Smtp','include':[{'model':_0x54a2('0xe'),'as':_0x54a2('0xe')}]}],'attributes':['id',_0x54a2('0x8'),_0x54a2('0xf')],'smtp':!![]}});};exports[_0x54a2('0x10')]=function(_0x352200){return request(_0x54a2('0x11'),{'options':{'where':{'id':_0x352200},'attributes':[_0x54a2('0x8')]}});};exports['getVoiceQueueById']=function(_0x348e31){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x348e31},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x12')]=function(_0xb61800){return request(_0x54a2('0x13'),{'options':{'where':{'id':_0xb61800},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x14')]=function(_0x740ad){return request(_0x54a2('0x15'),{'options':{'where':{'id':_0x740ad},'attributes':[_0x54a2('0x16')]}});};exports[_0x54a2('0x17')]=function(_0x528ca9){return request('ShowUser',{'options':{'where':{'id':_0x528ca9},'attributes':['name']}});};exports[_0x54a2('0x18')]=function(_0x5356ea){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5356ea['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x67f8a5){return request(_0x54a2('0x19'),{'options':{'where':{'id':_0x67f8a5},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x1a')]=function(_0xd9a51d){return request(_0x54a2('0x1b'),{'options':{'where':{'id':_0xd9a51d},'attributes':[_0x54a2('0x1c')]}});};exports[_0x54a2('0x1d')]=function(_0x4c1545){return request(_0x54a2('0x1e'),{'options':{'raw':![],'where':{'id':_0x4c1545},'include':[{'model':_0x54a2('0x1f'),'as':_0x54a2('0x20')}]}});};exports['getSmsAccountById']=function(_0x3a080a){return request(_0x54a2('0x21'),{'options':{'where':{'id':_0x3a080a},'attributes':['id','name']}});};exports[_0x54a2('0x22')]=function(_0x22b6ed){return request('CreateSmsMessage',{'body':_0x22b6ed});};exports[_0x54a2('0x23')]=function(_0x110fd5){return request(_0x54a2('0x24'),{'body':_0x110fd5});};exports[_0x54a2('0x25')]=function(_0x35b3f2){return request(_0x54a2('0x26'),{'body':_['merge'](_0x35b3f2,{'project_name':_0x35b3f2[_0x54a2('0x27')],'prev_project_name':_0x35b3f2[_0x54a2('0x28')]||'','is_subproject':_0x35b3f2['arg_2']?!![]:![],'leaveAt':moment()[_0x54a2('0x29')](_0x54a2('0x2a'))})});};exports[_0x54a2('0x2b')]=function(_0x423870){return request(_0x54a2('0x2c'),{'body':_0x423870});};exports['createSquareMessage']=function(_0xc8f32d){return request(_0x54a2('0x2d'),{'body':_0xc8f32d});};exports[_0x54a2('0x2e')]=function(_0x3a2690){return request(_0x54a2('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3a2690[_0x54a2('0x30')],'ListId':_0x3a2690[_0x54a2('0x31')]}}})[_0x54a2('0x4')](function(_0x17ba86){if(_0x17ba86){return _0x17ba86;}return request('CreateCmContact',{'body':_0x3a2690});});};exports[_0x54a2('0x32')]=function(_0x5f54c1){return request('ShowPause',{'options':{'where':{'id':_0x5f54c1},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x33')]=function(_0x4576ce,_0x27e593){return request(_0x54a2('0x34'),{'body':{'interface':_0x27e593},'options':{'where':_0x4576ce}});};exports[_0x54a2('0x35')]=function(_0x1e38e6,_0x5e904a,_0x136b61){return request('PauseUser',{'body':{'type':_0x5e904a,'uniqueid':_0x136b61},'options':{'where':_0x1e38e6}});};exports['agentUnpause']=function(_0x402385){return request(_0x54a2('0x36'),{'body':{},'options':{'where':_0x402385}});};exports[_0x54a2('0x37')]=function(_0x88ea06){return request('LogoutUser',{'body':{},'options':{'where':_0x88ea06}});}; \ 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 3278b59..f78751e 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 _0x1a44=['./polly','exports'];(function(_0xe1130d,_0x4edd01){var _0x3f6a3a=function(_0x5428b6){while(--_0x5428b6){_0xe1130d['push'](_0xe1130d['shift']());}};_0x3f6a3a(++_0x4edd01);}(_0x1a44,0xc4));var _0x41a4=function(_0x5952f8,_0x6fa170){_0x5952f8=_0x5952f8-0x0;var _0x5b108d=_0x1a44[_0x5952f8];return _0x5b108d;};var polly=require(_0x41a4('0x0'));var lex=require('./lex');module[_0x41a4('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x624c=['./lex','exports'];(function(_0xd3b0ac,_0x2f5065){var _0x3d773e=function(_0x2e10d1){while(--_0x2e10d1){_0xd3b0ac['push'](_0xd3b0ac['shift']());}};_0x3d773e(++_0x2f5065);}(_0x624c,0x1ee));var _0xc624=function(_0x5c6efe,_0x4126d6){_0x5c6efe=_0x5c6efe-0x0;var _0x181a12=_0x624c[_0x5c6efe];return _0x181a12;};var polly=require('./polly');var lex=require(_0xc624('0x0'));module[_0xc624('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index d0a3899..adc3c38 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 _0xe5b5=['exports','./lib/api'];(function(_0x13ddfa,_0x20efa3){var _0x5f07b3=function(_0x417239){while(--_0x417239){_0x13ddfa['push'](_0x13ddfa['shift']());}};_0x5f07b3(++_0x20efa3);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0xe5b5[_0x5cab28];return _0xa3554d;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +var _0x70e0=['exports','./lib/api'];(function(_0x2627e3,_0x5bb123){var _0x55621b=function(_0x230e5a){while(--_0x230e5a){_0x2627e3['push'](_0x2627e3['shift']());}};_0x55621b(++_0x5bb123);}(_0x70e0,0x17b));var _0x070e=function(_0x546f27,_0x4dd8a5){_0x546f27=_0x546f27-0x0;var _0x2d40d4=_0x70e0[_0x546f27];return _0x2d40d4;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ 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 d10a92e..9e6ae91 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(_0x3b94f6,_0x49e43c){var _0x4dd58d=function(_0x4d7095){while(--_0x4d7095){_0x3b94f6['push'](_0x3b94f6['shift']());}};_0x4dd58d(++_0x49e43c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x5e68d5,_0x43b170){var _0x11f1b6=function(_0x1781a6){while(--_0x1781a6){_0x5e68d5['push'](_0x5e68d5['shift']());}};_0x11f1b6(++_0x43b170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 957f0b6..1fdce8a 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 _0xf52c=['./lib/api','exports'];(function(_0x195588,_0xacd327){var _0x5232f0=function(_0x571fe9){while(--_0x571fe9){_0x195588['push'](_0x195588['shift']());}};_0x5232f0(++_0xacd327);}(_0xf52c,0x156));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0xcf52('0x0'));module[_0xcf52('0x1')]=function(_0x526f5a,_0x389e01,_0x1ee3e9,_0x39390a,_0x5eb121,_0x244570,_0x4f2b34){return polly(_0x526f5a,_0x389e01,_0x1ee3e9,_0x39390a,_0x5eb121,_0x244570,_0x4f2b34);}; \ No newline at end of file +var _0xc750=['./lib/api','exports'];(function(_0x313ddc,_0x3bb735){var _0x3eed02=function(_0x342eb9){while(--_0x342eb9){_0x313ddc['push'](_0x313ddc['shift']());}};_0x3eed02(++_0x3bb735);}(_0xc750,0x158));var _0x0c75=function(_0x109628,_0x5184cb){_0x109628=_0x109628-0x0;var _0x556b86=_0xc750[_0x109628];return _0x556b86;};'use strict';var polly=require(_0x0c75('0x0'));module[_0x0c75('0x1')]=function(_0x3a4673,_0x9c423b,_0x2f2990,_0x5b9979,_0x5862a3,_0x220b52,_0x3acab9){return polly(_0x3a4673,_0x9c423b,_0x2f2990,_0x5b9979,_0x5862a3,_0x220b52,_0x3acab9);}; \ 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 819f5b3..aacfe5d 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 _0xdf14=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x3ea9eb,_0xb976f7){var _0x155bc4=function(_0x48f92d){while(--_0x48f92d){_0x3ea9eb['push'](_0x3ea9eb['shift']());}};_0x155bc4(++_0xb976f7);}(_0xdf14,0x16e));var _0x4df1=function(_0x199209,_0x24062d){_0x199209=_0x199209-0x0;var _0x187c96=_0xdf14[_0x199209];return _0x187c96;};'use strict';var fs=require('fs');var path=require(_0x4df1('0x0'));var BPromise=require(_0x4df1('0x1'));var rs=require(_0x4df1('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4a1f9e,_0x1f7e46,_0x34e746){return new BPromise(function(_0x5de7c4,_0x5572a9){_0x4a1f9e['synthesizeSpeech'](_0x1f7e46,function(_0x105c30,_0x20e578){if(_0x105c30){_0x5572a9(_0x105c30);}else if(_0x20e578){if(_0x20e578[_0x4df1('0x3')]instanceof Buffer){fs['writeFile'](_0x34e746,_0x20e578[_0x4df1('0x3')],function(_0x4c4393){if(_0x4c4393){_0x5572a9(_0x4c4393);}else{_0x5de7c4();}});}else{_0x5572a9(new Error(_0x4df1('0x4')));}}else{_0x5572a9(new Error(_0x4df1('0x5')));}});});}module['exports']=function(_0x89cd31,_0x3f0699,_0x283f27,_0x19d5aa,_0x4b40c5,_0x449170,_0x177523){var _0x3a4321=new AWS[(_0x4df1('0x6'))]({'accessKeyId':_0x89cd31,'secretAccessKey':_0x3f0699,'region':_0x283f27});var _0x3f17f6={'Text':_0x4b40c5,'TextType':_0x449170||_0x4df1('0x7'),'OutputFormat':_0x4df1('0x8'),'VoiceId':_0x19d5aa};return pollyResult(_0x3a4321,_0x3f17f6,_0x177523);}; \ No newline at end of file +var _0xde19=['Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x35ecde,_0x2c20ba){var _0x4918f5=function(_0x42ca9c){while(--_0x42ca9c){_0x35ecde['push'](_0x35ecde['shift']());}};_0x4918f5(++_0x2c20ba);}(_0xde19,0x1bf));var _0x9de1=function(_0x56aca3,_0x4c01d1){_0x56aca3=_0x56aca3-0x0;var _0x54d207=_0xde19[_0x56aca3];return _0x54d207;};'use strict';var fs=require('fs');var path=require(_0x9de1('0x0'));var BPromise=require(_0x9de1('0x1'));var rs=require('randomstring');var AWS=require(_0x9de1('0x2'));function pollyResult(_0x28f32d,_0x3dd29f,_0x217b16){return new BPromise(function(_0x165c29,_0xb47680){_0x28f32d[_0x9de1('0x3')](_0x3dd29f,function(_0x493db7,_0x254c8d){if(_0x493db7){_0xb47680(_0x493db7);}else if(_0x254c8d){if(_0x254c8d[_0x9de1('0x4')]instanceof Buffer){fs[_0x9de1('0x5')](_0x217b16,_0x254c8d['AudioStream'],function(_0x51cedd){if(_0x51cedd){_0xb47680(_0x51cedd);}else{_0x165c29();}});}else{_0xb47680(new Error(_0x9de1('0x6')));}}else{_0xb47680(new Error(_0x9de1('0x7')));}});});}module[_0x9de1('0x8')]=function(_0x54e24a,_0x39a037,_0x1bb278,_0x1ea046,_0x111646,_0x4e3bec,_0xbf2ae7){var _0x594128=new AWS[(_0x9de1('0x9'))]({'accessKeyId':_0x54e24a,'secretAccessKey':_0x39a037,'region':_0x1bb278});var _0x565de7={'Text':_0x111646,'TextType':_0x4e3bec||_0x9de1('0xa'),'OutputFormat':_0x9de1('0xb'),'VoiceId':_0x1ea046};return pollyResult(_0x594128,_0x565de7,_0xbf2ae7);}; \ 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 8b90e95..b11db52 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 _0xaa50=['./lib/api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xaa50,0x183));var _0x0aa5=function(_0x645adc,_0x23ab56){_0x645adc=_0x645adc-0x0;var _0x253557=_0xaa50[_0x645adc];return _0x253557;};'use strict';var asr=require(_0x0aa5('0x0'));module['exports']=function(_0x579221,_0x1beb33,_0x4a7f10,_0x56a4c0){return asr(_0x579221,_0x1beb33,_0x4a7f10);}; \ No newline at end of file +var _0x04fb=['exports'];(function(_0x3eeabe,_0x2c8839){var _0x276c10=function(_0x592380){while(--_0x592380){_0x3eeabe['push'](_0x3eeabe['shift']());}};_0x276c10(++_0x2c8839);}(_0x04fb,0x12c));var _0xb04f=function(_0x17c5e9,_0x2134dc){_0x17c5e9=_0x17c5e9-0x0;var _0x17fcb3=_0x04fb[_0x17c5e9];return _0x17fcb3;};'use strict';var asr=require('./lib/api');module[_0xb04f('0x0')]=function(_0x5e2c68,_0x5978b1,_0x20de93,_0x217a9b){return asr(_0x5e2c68,_0x5978b1,_0x20de93);}; \ 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 8c3de70..e5d257d 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 _0x9f62=['string','length','key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','bluebird','exports'];(function(_0xbbb9bd,_0xc2df33){var _0x4e099=function(_0x39cb8b){while(--_0x39cb8b){_0xbbb9bd['push'](_0xbbb9bd['shift']());}};_0x4e099(++_0xc2df33);}(_0x9f62,0x154));var _0x29f6=function(_0x4840bc,_0x5c1fde){_0x4840bc=_0x4840bc-0x0;var _0x3d0995=_0x9f62[_0x4840bc];return _0x3d0995;};'use strict';var url=require('url');var BPromise=require(_0x29f6('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x29f6('0x1')]=function(_0x254ab3,_0x548050,_0x5618b7){return new BPromise(function(_0x54d164,_0x258ddd){var _0x2f0420;if(typeof _0x254ab3!==_0x29f6('0x2')||_0x254ab3[_0x29f6('0x3')]===0x0){return _0x258ddd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x548050!==_0x29f6('0x2')||_0x548050[_0x29f6('0x3')]===0x0){return _0x258ddd(_0x29f6('0x4'));}if(typeof _0x5618b7!==_0x29f6('0x5')&&(typeof _0x5618b7!==_0x29f6('0x2')||_0x5618b7['length']===0x0)){return _0x258ddd('lang\x20should\x20be\x20a\x20string');}try{_0x2f0420=fs['readFileSync'](_0x254ab3)['toString'](_0x29f6('0x6'));}catch(_0x44db16){return _0x258ddd(_0x44db16);}return _0x54d164({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x548050,'body':{'config':{'encoding':_0x29f6('0x7'),'sampleRateHertz':_0x29f6('0x8'),'languageCode':_0x5618b7},'audio':{'content':_0x2f0420}},'json':!![]});});}; \ No newline at end of file +var _0x05b0=['readFileSync','8000','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x4740f8,_0x31261f){var _0x260ba9=function(_0x2bb599){while(--_0x2bb599){_0x4740f8['push'](_0x4740f8['shift']());}};_0x260ba9(++_0x31261f);}(_0x05b0,0x188));var _0x005b=function(_0x2615d2,_0x497a64){_0x2615d2=_0x2615d2-0x0;var _0xc51a6c=_0x05b0[_0x2615d2];return _0xc51a6c;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x005b('0x0');module[_0x005b('0x1')]=function(_0x4c8e5f,_0xbc782b,_0x2f5c09){return new BPromise(function(_0x4a76d7,_0x342d08){var _0x2849ed;if(typeof _0x4c8e5f!=='string'||_0x4c8e5f[_0x005b('0x2')]===0x0){return _0x342d08(_0x005b('0x3'));}if(typeof _0xbc782b!==_0x005b('0x4')||_0xbc782b[_0x005b('0x2')]===0x0){return _0x342d08(_0x005b('0x5'));}if(typeof _0x2f5c09!==_0x005b('0x6')&&(typeof _0x2f5c09!==_0x005b('0x4')||_0x2f5c09['length']===0x0)){return _0x342d08(_0x005b('0x7'));}try{_0x2849ed=fs[_0x005b('0x8')](_0x4c8e5f)['toString']('base64');}catch(_0x451641){return _0x342d08(_0x451641);}return _0x4a76d7({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xbc782b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x005b('0x9'),'languageCode':_0x2f5c09},'audio':{'content':_0x2849ed}},'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 d627521..077675a 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 _0xeb36=['exports'];(function(_0x2e3a9f,_0x26da8f){var _0x1e89b7=function(_0x362f6d){while(--_0x362f6d){_0x2e3a9f['push'](_0x2e3a9f['shift']());}};_0x1e89b7(++_0x26da8f);}(_0xeb36,0x11a));var _0x6eb3=function(_0x30dd71,_0x42083c){_0x30dd71=_0x30dd71-0x0;var _0x58b54d=_0xeb36[_0x30dd71];return _0x58b54d;};var asr=require('./asr');module[_0x6eb3('0x0')]={'asr':asr}; \ No newline at end of file +var _0x78e0=['exports','./asr'];(function(_0x9f52a,_0x11bbcf){var _0x1ca182=function(_0x1a0beb){while(--_0x1a0beb){_0x9f52a['push'](_0x9f52a['shift']());}};_0x1ca182(++_0x11bbcf);}(_0x78e0,0x1df));var _0x078e=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0x78e0[_0x21ba7d];return _0x1445b6;};var asr=require(_0x078e('0x0'));module[_0x078e('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 0fbf203..2c696c5 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 _0x8737=['dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','https:','data','wav','error\x20convert','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','readFileSync','toString','base64','googleCloudTTS','ssml','input','voice','audioConfig','MP3','POST','.mp3','audioContent','writeFile','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','status','code','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x8737,0x10d));var _0x7873=function(_0xd631c9,_0x55e13e){_0xd631c9=_0xd631c9-0x0;var _0x4180e9=_0x8737[_0xd631c9];return _0x4180e9;};'use strict';var apiai=require(_0x7873('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x7873('0x1'));var fs=require('fs');var http=require(_0x7873('0x2'));var https=require(_0x7873('0x3'));var md5=require(_0x7873('0x4'));var path=require(_0x7873('0x5'));var querystring=require(_0x7873('0x6'));var rp=require(_0x7873('0x7'));var rs=require(_0x7873('0x8'));var sox=require(_0x7873('0x9'));var tts=require('google-tts-api');var urlParse=require(_0x7873('0xa'))[_0x7873('0xb')];var util=require(_0x7873('0xc'));var aws=require(_0x7873('0xd'));var google=require(_0x7873('0xe'));var sestek=require(_0x7873('0xf'));var tilde=require('./tilde');var logger=require(_0x7873('0x10'))(_0x7873('0x11'));var ISPEECH_API=_0x7873('0x12');function downloadFile(_0x252ec5,_0x15d808){return new BPromise(function(_0x1d805c,_0x3eee75){var _0x47be04=urlParse(_0x252ec5);var _0x30ee9b=_0x47be04[_0x7873('0x13')]==='https:'?https:http;var _0x359082={'host':_0x47be04[_0x7873('0x14')],'path':_0x47be04['path'],'headers':{'user-agent':_0x7873('0x15')}};_0x30ee9b[_0x7873('0x16')](_0x359082,function(_0x241f88){if(_0x241f88[_0x7873('0x17')]!==0xc8){logger['error'](_0x7873('0x18')+_0x252ec5+_0x7873('0x19')+_0x241f88[_0x7873('0x17')]+'\x20('+_0x241f88['statusMessage']+')');_0x3eee75(new Error(_0x7873('0x18')+_0x252ec5+_0x7873('0x19')+_0x241f88['statusCode']+'\x20('+_0x241f88[_0x7873('0x1a')]+')'));return;}var _0xf8fd7b=fs['createWriteStream'](_0x15d808);_0xf8fd7b['on'](_0x7873('0x1b'),function(){logger[_0x7873('0x1c')](_0x7873('0x1d'));_0xf8fd7b['close'](_0x1d805c);});_0xf8fd7b['on'](_0x7873('0x1e'),function(_0x3fe1ad){fs[_0x7873('0x1f')](_0x15d808);logger[_0x7873('0x1e')](_0x7873('0x20'),_0x3fe1ad);_0x3eee75(_0x3fe1ad);});_0x241f88[_0x7873('0x21')](_0xf8fd7b);})['on'](_0x7873('0x1e'),function(_0x37caf0){logger['error'](_0x37caf0);_0x3eee75(_0x37caf0);})[_0x7873('0x22')]();});}function uploadFile(_0x1ef5f2){return new BPromise(function(_0x3ac642,_0x7da0f6){var _0x574fa8=urlParse(_0x1ef5f2);var _0x45e03c=_0x574fa8[_0x7873('0x13')]===_0x7873('0x23')?https:http;var _0x40e0a8={'host':_0x574fa8['host'],'path':_0x574fa8['path'],'headers':{'user-agent':_0x7873('0x15')}};_0x45e03c[_0x7873('0x16')](_0x40e0a8,function(_0x5b8eb9){if(_0x5b8eb9[_0x7873('0x17')]!==0xc8){_0x7da0f6(new Error(_0x7873('0x18')+_0x1ef5f2+_0x7873('0x19')+_0x5b8eb9[_0x7873('0x17')]+'\x20('+_0x5b8eb9[_0x7873('0x1a')]+')'));return;}var _0x8f24a0='';_0x5b8eb9['on'](_0x7873('0x24'),function(_0x7a2bce){_0x8f24a0+=_0x7a2bce;});_0x5b8eb9['on'](_0x7873('0x22'),function(){_0x3ac642(_0x8f24a0);});})['on'](_0x7873('0x1e'),function(_0x54e3ea){_0x7da0f6(_0x54e3ea);})['end']();});}function convertFile(_0x566a54,_0x18652e){return new BPromise(function(_0x382a54,_0x2440aa){var _0x13a576=sox['transcode'](_0x566a54,_0x18652e,{'sampleRate':0x1f40,'format':_0x7873('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13a576['on'](_0x7873('0x1e'),function(_0x4bd2a9){logger['error'](_0x7873('0x26'),_0x4bd2a9);_0x2440aa(_0x4bd2a9);});_0x13a576['on'](_0x7873('0x22'),function(){logger['info']('finish\x20to\x20convert');_0x382a54();});_0x13a576['start']();});}function base64Decode(_0x1da252,_0x28b6df){var _0x461351=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+_0x7873('0x2a'));fs[_0x7873('0x2b')](_0x461351,_0x1da252,'base64');return convertFile(_0x461351,_0x28b6df)[_0x7873('0x2c')](function(){try{fs[_0x7873('0x1f')](_0x461351);fs[_0x7873('0x2d')](_0x28b6df,_0x7873('0x2e'));}catch(_0x45a74e){logger['error'](_0x45a74e);}return _0x28b6df['split']('.')[0x0];});}function base64Encode(_0x74a37c){var _0x583e99=fs[_0x7873('0x2f')](_0x74a37c);return new Buffer(_0x583e99)[_0x7873('0x30')](_0x7873('0x31'));}exports[_0x7873('0x32')]=function(_0x40d701,_0x391335,_0x17d02e,_0x4df7fa,_0x58177e,_0x1e4132){var _0x33d99a,_0xe7e216;var _0x435347='https://texttospeech.googleapis.com/v1/';var _0x347541='?key='+_0x40d701;var _0x1c9f79={};if(_0x391335===_0x7873('0x33')){_0x1c9f79['input']={'ssml':_0x17d02e};}else{_0x1c9f79[_0x7873('0x34')]={'text':_0x17d02e};};_0x1c9f79[_0x7873('0x35')]={'languageCode':_0x4df7fa,'ssmlGender':_0x58177e};_0x1c9f79[_0x7873('0x36')]={'audioEncoding':_0x7873('0x37'),'sampleRateHertz':0x1f40};var _0x24a7d6={'url':_0x435347+'text:synthesize'+_0x347541,'method':_0x7873('0x38'),'json':!![],'body':_0x1c9f79};return rp(_0x24a7d6)[_0x7873('0x2c')](function(_0x842e1){return new BPromise(function(_0x223d88,_0x5375bd){_0x33d99a=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs['generate'](0x4)+_0x7873('0x39'));var _0x1bf94c=Buffer['from'](_0x842e1[_0x7873('0x3a')],_0x7873('0x31'));return fs[_0x7873('0x3b')](_0x33d99a,_0x1bf94c,function(_0x6c3135){_0x5375bd(_0x6c3135);},function(_0x48493e){fs['chmodSync'](_0x33d99a,_0x7873('0x2e'));_0x223d88(_0x48493e);});});})['then'](function(_0x649d87){_0xe7e216=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+'.wav');return convertFile(_0x33d99a,_0xe7e216);})['then'](function(){try{fs['unlink'](_0x33d99a);fs[_0x7873('0x2d')](_0xe7e216,'777');}catch(_0x347a0a){logger[_0x7873('0x1e')](_0x347a0a);}logger[_0x7873('0x1c')]('googleCloudTTS\x20path',_0xe7e216['split']('.')[0x0]);return _0xe7e216[_0x7873('0x3c')]('.')[0x0];});};exports['googleTTS']=function(_0x374840,_0x26b630){var _0x4d6c74=_0x7873('0x3d');var _0x4accb0,_0x31fde;var _0x19eab4;var _0x3eb20b={'encoding':'utf8','method':_0x7873('0x38'),'timeout':0x2710,'url':_0x4d6c74,'headers':{'Content-Type':_0x7873('0x3e')},'body':_0x7873('0x3f')+encodeURIComponent(JSON[_0x7873('0x40')]([[[_0x7873('0x41'),JSON[_0x7873('0x40')]([_0x374840,_0x26b630||'en',![],_0x7873('0x42')]),null,_0x7873('0x43')]]]))};return rp(_0x3eb20b)['then'](function(_0x876bea){try{_0x19eab4=eval(_0x876bea[_0x7873('0x44')](0x5))[0x0][0x2];}catch(_0x1bf42){throw new Error(_0x7873('0x45')+_0x876bea['data']);}if(!_0x19eab4){if(_0x374840[_0x7873('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x26b630+_0x7873('0x47'));}}try{_0x19eab4=eval(_0x19eab4)[0x0];}catch(_0x18360){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x3da2ca=_0x19eab4;_0x4accb0=path['resolve'](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+'.mp3');fs[_0x7873('0x2b')](_0x4accb0,_0x19eab4,{'encoding':_0x7873('0x31')});_0x31fde=path[_0x7873('0x27')](__dirname,'tmp',rs[_0x7873('0x29')](0x4)+'.wav');return convertFile(_0x4accb0,_0x31fde);})[_0x7873('0x2c')](function(){try{fs[_0x7873('0x1f')](_0x4accb0);fs[_0x7873('0x2d')](_0x31fde,_0x7873('0x2e'));}catch(_0x1d1083){logger[_0x7873('0x1e')](_0x1d1083);}logger[_0x7873('0x1c')](_0x7873('0x48'),_0x31fde[_0x7873('0x3c')]('.')[0x0]);return _0x31fde[_0x7873('0x3c')]('.')[0x0];});};exports['googleASR']=function(_0xe8e8b,_0x39992d,_0x5b792e){return google[_0x7873('0x49')](_0xe8e8b,_0x39992d,_0x5b792e)[_0x7873('0x2c')](function(_0x148f3e){logger[_0x7873('0x1c')](_0x148f3e[_0x7873('0x4a')]);return rp(_0x148f3e);})[_0x7873('0x2c')](function(_0x327b3b){var _0x53dbd6='';var _0x1e142d=0x0;try{fs[_0x7873('0x1f')](_0xe8e8b);}catch(_0x3ce68c){logger[_0x7873('0x1e')](_0x3ce68c);}if(_0x327b3b&&_0x327b3b[_0x7873('0x4b')]){_0x53dbd6=_0x327b3b['results'][_0x7873('0x4c')](function(_0x578db4){return _0x578db4&&_0x578db4['alternatives'][0x0]&&_0x578db4[_0x7873('0x4d')][0x0]['transcript']?_0x578db4[_0x7873('0x4d')][0x0][_0x7873('0x4e')]:'';})[_0x7873('0x4f')]('\x0a');_0x1e142d=_0x327b3b['results'][_0x7873('0x4c')](function(_0x8f13ca){return _0x8f13ca&&_0x8f13ca['alternatives'][0x0]&&_0x8f13ca[_0x7873('0x4d')][0x0][_0x7873('0x50')]?_0x8f13ca[_0x7873('0x4d')][0x0][_0x7873('0x50')]:0x0;})[_0x7873('0x4f')]('\x0a');}logger[_0x7873('0x1c')](_0x7873('0x51'),_0x53dbd6);logger['info'](_0x7873('0x52'),_0x1e142d);return{'transcript':_0x53dbd6,'confidence':_0x1e142d};})[_0x7873('0x53')](function(_0x24edcf){logger['error'](_0x7873('0x54'),_0x24edcf[_0x7873('0x17')],_0x24edcf[_0x7873('0x55')],_0x24edcf[_0x7873('0x56')]);});};exports[_0x7873('0x57')]=function(_0x31cc27,_0x32fbfa,_0x5a9374,_0x2030b4){var _0x387f05=apiai(_0x32fbfa,{'language':_0x2030b4||'en'});return _0x387f05[_0x7873('0x58')](_0x5a9374,{'sessionId':md5(_0x31cc27)})[_0x7873('0x2c')](function(_0x4a6c49){logger[_0x7873('0x1c')](JSON[_0x7873('0x40')](_0x4a6c49));return{'source':_0x4a6c49[_0x7873('0x59')][_0x7873('0x5a')],'resolvedQuery':_0x4a6c49['result']['resolvedQuery'],'action':_0x4a6c49[_0x7873('0x59')][_0x7873('0x5b')],'actionIncomplete':_0x4a6c49[_0x7873('0x59')][_0x7873('0x5c')],'speech':_0x4a6c49[_0x7873('0x59')]['fulfillment']['speech'],'score':_0x4a6c49[_0x7873('0x59')]['score'],'statusCode':_0x4a6c49[_0x7873('0x5d')][_0x7873('0x5e')],'endConversation':_0x4a6c49[_0x7873('0x59')]['metadata'][_0x7873('0x5f')]||![],'isFallbackIntent':_0x4a6c49[_0x7873('0x59')]['metadata']['isFallbackIntent']};});};exports[_0x7873('0x60')]=function(_0x1d9fd4,_0x1178be,_0x6a3717,_0x311ba5,_0x48e41a,_0x180985){var _0xd5596f=_0x311ba5[_0x7873('0x61')](/\\n/g,'\x0a');var _0x30cac2={'credentials':{'private_key':_0xd5596f,'client_email':_0x6a3717}};var _0x4b37b0=new dialogflow[(_0x7873('0x62'))](_0x30cac2);var _0x27f5de=_0x4b37b0[_0x7873('0x63')](_0x1178be,md5(_0x1d9fd4));var _0x1c18af={'session':_0x27f5de,'queryInput':{'text':{'text':_0x48e41a,'languageCode':_0x180985}}};return _0x4b37b0[_0x7873('0x64')](_0x1c18af)[_0x7873('0x2c')](function(_0x385980){if(_0x385980&&_0x385980[_0x7873('0x46')]){logger[_0x7873('0x1c')](_0x7873('0x65'),JSON['stringify'](_0x385980));var _0xd4d455=_0x385980[0x0];if(_0xd4d455){var _0x9c9989={'action':_0xd4d455['queryResult']['action'],'allRequiredParamsPresent':_0xd4d455['queryResult'][_0x7873('0x66')],'endConversation':_0xd4d455['queryResult'][_0x7873('0x67')]&&_0xd4d455[_0x7873('0x68')][_0x7873('0x67')][_0x7873('0x69')]?_0xd4d455[_0x7873('0x68')][_0x7873('0x67')][_0x7873('0x69')][_0x7873('0x6a')][_0x7873('0x6b')]:![],'fulfillmentText':_0xd4d455[_0x7873('0x68')][_0x7873('0x6c')],'intentName':_0xd4d455[_0x7873('0x68')][_0x7873('0x6d')][_0x7873('0x55')],'intentDisplayName':_0xd4d455[_0x7873('0x68')]['intent'][_0x7873('0x6e')],'isFallbackIntent':_0xd4d455[_0x7873('0x68')]['intent'][_0x7873('0x6f')],'languageCode':_0xd4d455[_0x7873('0x68')]['languageCode'],'queryText':_0xd4d455[_0x7873('0x68')][_0x7873('0x70')],'responseId':_0xd4d455[_0x7873('0x71')],'score':_0xd4d455['queryResult'][_0x7873('0x72')],'speech':_0xd4d455[_0x7873('0x68')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x385980)};return _0x9c9989;}}});};exports[_0x7873('0x73')]=function(_0x4d7ef6,_0x4d48d7,_0x3f4af4,_0x5134d2){return tilde['asr'](_0x4d7ef6,_0x4d48d7,_0x3f4af4,_0x5134d2)[_0x7873('0x2c')](function(_0x47fde5){try{fs['unlink'](_0x4d7ef6);}catch(_0x92722d){logger['error'](_0x92722d);}logger[_0x7873('0x1c')]('Tilde\x20ASR\x20transcription',_0x47fde5[_0x7873('0x4e')]);logger[_0x7873('0x1c')](_0x7873('0x74'),_0x47fde5[_0x7873('0x50')]);return _0x47fde5;});};exports[_0x7873('0x75')]=function(_0x25f1bf,_0x2f4242,_0x1ced51,_0x17ad7c,_0x261ac8,_0x42ef9d){var _0x1da4f5=path[_0x7873('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x7873('0x39'));var _0x1eb9a9;return aws[_0x7873('0x76')](_0x25f1bf,_0x2f4242,_0x1ced51,_0x17ad7c,_0x261ac8,_0x42ef9d,_0x1da4f5)['then'](function(){_0x1eb9a9=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+'.wav');return convertFile(_0x1da4f5,_0x1eb9a9);})['then'](function(){try{fs['unlink'](_0x1da4f5);fs[_0x7873('0x2d')](_0x1eb9a9,_0x7873('0x2e'));}catch(_0x302806){logger['error'](_0x302806);}return _0x1eb9a9[_0x7873('0x3c')]('.')[0x0];});};exports[_0x7873('0x77')]=function(_0x21fc01,_0x2da2fc,_0x53ecf5,_0x2ad559,_0x1cb22a,_0x2324e8){return aws[_0x7873('0x78')](_0x21fc01,_0x2da2fc,_0x53ecf5,_0x2ad559,_0x1cb22a,_0x2324e8)[_0x7873('0x2c')](function(_0x47edf5){logger[_0x7873('0x1c')](JSON[_0x7873('0x40')](_0x47edf5));return _0x47edf5;});};exports[_0x7873('0x79')]=function(_0x484ed8,_0x20b888,_0x44bc07,_0x1b5216){var _0x3776a4=util[_0x7873('0x7a')](_0x7873('0x7b'),ISPEECH_API,_0x484ed8,encodeURIComponent(_0x20b888),_0x44bc07,_0x1b5216);var _0x35228d=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+'.mp3');var _0x413561;return downloadFile(_0x3776a4,_0x35228d)[_0x7873('0x2c')](function(){_0x413561=path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+_0x7873('0x2a'));return convertFile(_0x35228d,_0x413561);})[_0x7873('0x2c')](function(){try{fs['unlink'](_0x35228d);fs[_0x7873('0x2d')](_0x413561,_0x7873('0x2e'));}catch(_0xcf78f1){logger[_0x7873('0x1e')](_0xcf78f1);}return _0x413561[_0x7873('0x3c')]('.')[0x0];});};exports[_0x7873('0x7c')]=function(_0x2badb4,_0x1cff5f,_0x509e94,_0xc64634){var _0x342ec5=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1cff5f,_0x509e94,base64Encode(_0x2badb4),_0xc64634?util[_0x7873('0x7a')](_0x7873('0x7d'),encodeURIComponent(_0xc64634)):_0x7873('0x7e'));return uploadFile(_0x342ec5)[_0x7873('0x2c')](function(_0x55b716){return querystring[_0x7873('0xb')](_0x55b716);});};exports[_0x7873('0x7f')]=function(_0x247e97,_0xb91d7a){return sestek['nda'](_0x247e97,_0xb91d7a)[_0x7873('0x2c')](function(_0x598aba){logger['info'](JSON[_0x7873('0x40')](_0x598aba));var _0x5ecbb0={'speech':_0x598aba['text'],'action':_0x598aba[_0x7873('0x80')]?_0x598aba[_0x7873('0x80')][_0x7873('0x81')]:undefined,'actiondata':_0x598aba[_0x7873('0x80')]?_0x598aba[_0x7873('0x80')][_0x7873('0x82')]:undefined};if(_0x598aba['channelData']&&_0x598aba['channelData'][_0x7873('0x83')]){return base64Decode(_0x598aba[_0x7873('0x80')][_0x7873('0x83')][_0x7873('0x84')],path[_0x7873('0x27')](__dirname,_0x7873('0x28'),rs[_0x7873('0x29')](0x4)+_0x7873('0x2a')))[_0x7873('0x2c')](function(_0x3ffbf9){_0x5ecbb0[_0x7873('0x85')]=_0x3ffbf9;return _0x5ecbb0;});}return _0x5ecbb0;});};exports[_0x7873('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x883d=['score','status','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','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','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','close','unlink','pipe','end','https:','host','data','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','text:synthesize','POST','tmp','.mp3','from','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','fulfillment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x883d,0xac));var _0xd883=function(_0x3b1fe4,_0x36e8c3){_0x3b1fe4=_0x3b1fe4-0x0;var _0x542998=_0x883d[_0x3b1fe4];return _0x542998;};'use strict';var apiai=require(_0xd883('0x0'));var BPromise=require(_0xd883('0x1'));var dialogflow=require(_0xd883('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xd883('0x3'));var md5=require(_0xd883('0x4'));var path=require('path');var querystring=require(_0xd883('0x5'));var rp=require(_0xd883('0x6'));var rs=require('randomstring');var sox=require(_0xd883('0x7'));var tts=require(_0xd883('0x8'));var urlParse=require(_0xd883('0x9'))[_0xd883('0xa')];var util=require(_0xd883('0xb'));var aws=require(_0xd883('0xc'));var google=require(_0xd883('0xd'));var sestek=require(_0xd883('0xe'));var tilde=require(_0xd883('0xf'));var logger=require(_0xd883('0x10'))(_0xd883('0x11'));var ISPEECH_API=_0xd883('0x12');function downloadFile(_0x2fd59f,_0x5b54e1){return new BPromise(function(_0xf71b7,_0x3b4571){var _0xe04d20=urlParse(_0x2fd59f);var _0x3c00eb=_0xe04d20[_0xd883('0x13')]==='https:'?https:http;var _0x26fe44={'host':_0xe04d20['host'],'path':_0xe04d20[_0xd883('0x14')],'headers':{'user-agent':_0xd883('0x15')}};_0x3c00eb[_0xd883('0x16')](_0x26fe44,function(_0x313222){if(_0x313222['statusCode']!==0xc8){logger[_0xd883('0x17')](_0xd883('0x18')+_0x2fd59f+'\x20failed,\x20status\x20code\x20=\x20'+_0x313222[_0xd883('0x19')]+'\x20('+_0x313222[_0xd883('0x1a')]+')');_0x3b4571(new Error(_0xd883('0x18')+_0x2fd59f+_0xd883('0x1b')+_0x313222[_0xd883('0x19')]+'\x20('+_0x313222['statusMessage']+')'));return;}var _0x357235=fs[_0xd883('0x1c')](_0x5b54e1);_0x357235['on']('finish',function(){logger[_0xd883('0x1d')]('finish\x20download\x20file');_0x357235[_0xd883('0x1e')](_0xf71b7);});_0x357235['on'](_0xd883('0x17'),function(_0x4ff666){fs[_0xd883('0x1f')](_0x5b54e1);logger['error']('download\x20error',_0x4ff666);_0x3b4571(_0x4ff666);});_0x313222[_0xd883('0x20')](_0x357235);})['on'](_0xd883('0x17'),function(_0x11d0a1){logger[_0xd883('0x17')](_0x11d0a1);_0x3b4571(_0x11d0a1);})[_0xd883('0x21')]();});}function uploadFile(_0x283ecf){return new BPromise(function(_0x420a98,_0x198cb){var _0x1fbeb9=urlParse(_0x283ecf);var _0x18d687=_0x1fbeb9[_0xd883('0x13')]===_0xd883('0x22')?https:http;var _0x4776b2={'host':_0x1fbeb9[_0xd883('0x23')],'path':_0x1fbeb9[_0xd883('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x18d687[_0xd883('0x16')](_0x4776b2,function(_0x29e8ee){if(_0x29e8ee['statusCode']!==0xc8){_0x198cb(new Error(_0xd883('0x18')+_0x283ecf+_0xd883('0x1b')+_0x29e8ee[_0xd883('0x19')]+'\x20('+_0x29e8ee[_0xd883('0x1a')]+')'));return;}var _0x48e022='';_0x29e8ee['on'](_0xd883('0x24'),function(_0x3c0796){_0x48e022+=_0x3c0796;});_0x29e8ee['on'](_0xd883('0x21'),function(){_0x420a98(_0x48e022);});})['on'](_0xd883('0x17'),function(_0x1ea7a5){_0x198cb(_0x1ea7a5);})[_0xd883('0x21')]();});}function convertFile(_0x36446f,_0x5a1503){return new BPromise(function(_0x2fa0b4,_0x3165dd){var _0x3b3075=sox['transcode'](_0x36446f,_0x5a1503,{'sampleRate':0x1f40,'format':_0xd883('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b3075['on']('error',function(_0x314220){logger['error'](_0xd883('0x26'),_0x314220);_0x3165dd(_0x314220);});_0x3b3075['on'](_0xd883('0x21'),function(){logger[_0xd883('0x1d')](_0xd883('0x27'));_0x2fa0b4();});_0x3b3075['start']();});}function base64Decode(_0x36f1e0,_0xdb5161){var _0x1fed0f=path[_0xd883('0x28')](__dirname,'tmp',rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));fs[_0xd883('0x2b')](_0x1fed0f,_0x36f1e0,_0xd883('0x2c'));return convertFile(_0x1fed0f,_0xdb5161)[_0xd883('0x2d')](function(){try{fs[_0xd883('0x1f')](_0x1fed0f);fs[_0xd883('0x2e')](_0xdb5161,_0xd883('0x2f'));}catch(_0x1b4bdd){logger[_0xd883('0x17')](_0x1b4bdd);}return _0xdb5161[_0xd883('0x30')]('.')[0x0];});}function base64Encode(_0x36169e){var _0x5dac41=fs['readFileSync'](_0x36169e);return new Buffer(_0x5dac41)['toString'](_0xd883('0x2c'));}exports[_0xd883('0x31')]=function(_0x20190c,_0x23ca55,_0x3fb230,_0x429a61,_0x8354e9,_0x2f1b33){var _0x411503,_0x3cd068;var _0x3060ed=_0xd883('0x32');var _0x6c9ca8=_0xd883('0x33')+_0x20190c;var _0x9f1319={};if(_0x23ca55===_0xd883('0x34')){_0x9f1319[_0xd883('0x35')]={'ssml':_0x3fb230};}else{_0x9f1319[_0xd883('0x35')]={'text':_0x3fb230};};_0x9f1319['voice']={'languageCode':_0x429a61,'ssmlGender':_0x8354e9};_0x9f1319['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x332d72={'url':_0x3060ed+_0xd883('0x36')+_0x6c9ca8,'method':_0xd883('0x37'),'json':!![],'body':_0x9f1319};return rp(_0x332d72)[_0xd883('0x2d')](function(_0x1ac879){return new BPromise(function(_0x258d19,_0x38f878){_0x411503=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x39'));var _0x186f02=Buffer[_0xd883('0x3a')](_0x1ac879['audioContent'],_0xd883('0x2c'));return fs['writeFile'](_0x411503,_0x186f02,function(_0x50da74){_0x38f878(_0x50da74);},function(_0x200bd5){fs[_0xd883('0x2e')](_0x411503,_0xd883('0x2f'));_0x258d19(_0x200bd5);});});})['then'](function(_0x46f7f7){_0x3cd068=path['resolve'](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+'.wav');return convertFile(_0x411503,_0x3cd068);})[_0xd883('0x2d')](function(){try{fs[_0xd883('0x1f')](_0x411503);fs['chmodSync'](_0x3cd068,_0xd883('0x2f'));}catch(_0x326e1f){logger[_0xd883('0x17')](_0x326e1f);}logger[_0xd883('0x1d')](_0xd883('0x3b'),_0x3cd068[_0xd883('0x30')]('.')[0x0]);return _0x3cd068[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x3c')]=function(_0xfc38e4,_0x2332ee){var _0x1f7e5b=_0xd883('0x3d');var _0x453ccb,_0x5d0644;var _0x265945;var _0x430c20={'encoding':_0xd883('0x3e'),'method':_0xd883('0x37'),'timeout':0x2710,'url':_0x1f7e5b,'headers':{'Content-Type':_0xd883('0x3f')},'body':_0xd883('0x40')+encodeURIComponent(JSON[_0xd883('0x41')]([[[_0xd883('0x42'),JSON[_0xd883('0x41')]([_0xfc38e4,_0x2332ee||'en',![],'null']),null,_0xd883('0x43')]]]))};return rp(_0x430c20)[_0xd883('0x2d')](function(_0x1c2a7b){try{_0x265945=eval(_0x1c2a7b['slice'](0x5))[0x0][0x2];}catch(_0x577ce2){throw new Error(_0xd883('0x44')+_0x1c2a7b[_0xd883('0x24')]);}if(!_0x265945){if(_0xfc38e4[_0xd883('0x45')]>0xc8){throw new Error(_0xd883('0x46'));}else{throw new Error(_0xd883('0x47')+_0x2332ee+'\x22\x20might\x20not\x20exist');}}try{_0x265945=eval(_0x265945)[0x0];}catch(_0x17974e){throw new Error(_0xd883('0x44')+res['data']);}const _0x149506=_0x265945;_0x453ccb=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+'.mp3');fs[_0xd883('0x2b')](_0x453ccb,_0x265945,{'encoding':_0xd883('0x2c')});_0x5d0644=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));return convertFile(_0x453ccb,_0x5d0644);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0x453ccb);fs[_0xd883('0x2e')](_0x5d0644,'777');}catch(_0x4e27e7){logger['error'](_0x4e27e7);}logger[_0xd883('0x1d')]('goggleTTS\x20path',_0x5d0644[_0xd883('0x30')]('.')[0x0]);return _0x5d0644[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x48')]=function(_0x215ab6,_0x2a7f36,_0x5b1d69){return google[_0xd883('0x49')](_0x215ab6,_0x2a7f36,_0x5b1d69)[_0xd883('0x2d')](function(_0x370a2d){logger[_0xd883('0x1d')](_0x370a2d[_0xd883('0x4a')]);return rp(_0x370a2d);})[_0xd883('0x2d')](function(_0x145b89){var _0x29af46='';var _0x5eaeb1=0x0;try{fs[_0xd883('0x1f')](_0x215ab6);}catch(_0x497c18){logger[_0xd883('0x17')](_0x497c18);}if(_0x145b89&&_0x145b89[_0xd883('0x4b')]){_0x29af46=_0x145b89[_0xd883('0x4b')][_0xd883('0x4c')](function(_0x4e68e4){return _0x4e68e4&&_0x4e68e4['alternatives'][0x0]&&_0x4e68e4['alternatives'][0x0]['transcript']?_0x4e68e4[_0xd883('0x4d')][0x0][_0xd883('0x4e')]:'';})['join']('\x0a');_0x5eaeb1=_0x145b89[_0xd883('0x4b')][_0xd883('0x4c')](function(_0x1b83c4){return _0x1b83c4&&_0x1b83c4[_0xd883('0x4d')][0x0]&&_0x1b83c4[_0xd883('0x4d')][0x0]['confidence']?_0x1b83c4[_0xd883('0x4d')][0x0][_0xd883('0x4f')]:0x0;})['join']('\x0a');}logger['info'](_0xd883('0x50'),_0x29af46);logger['info'](_0xd883('0x51'),_0x5eaeb1);return{'transcript':_0x29af46,'confidence':_0x5eaeb1};})[_0xd883('0x52')](function(_0x471608){logger[_0xd883('0x17')](_0xd883('0x53'),_0x471608['statusCode'],_0x471608[_0xd883('0x54')],_0x471608[_0xd883('0x55')]);});};exports[_0xd883('0x56')]=function(_0x3f4597,_0x16b896,_0x463b87,_0x49d010){var _0x384205=apiai(_0x16b896,{'language':_0x49d010||'en'});return _0x384205[_0xd883('0x57')](_0x463b87,{'sessionId':md5(_0x3f4597)})[_0xd883('0x2d')](function(_0x37e718){logger[_0xd883('0x1d')](JSON[_0xd883('0x41')](_0x37e718));return{'source':_0x37e718[_0xd883('0x58')][_0xd883('0x59')],'resolvedQuery':_0x37e718[_0xd883('0x58')][_0xd883('0x5a')],'action':_0x37e718[_0xd883('0x58')]['action'],'actionIncomplete':_0x37e718['result']['actionIncomplete'],'speech':_0x37e718[_0xd883('0x58')][_0xd883('0x5b')]['speech'],'score':_0x37e718[_0xd883('0x58')][_0xd883('0x5c')],'statusCode':_0x37e718[_0xd883('0x5d')]['code'],'endConversation':_0x37e718[_0xd883('0x58')][_0xd883('0x5e')]['endConversation']||![],'isFallbackIntent':_0x37e718['result'][_0xd883('0x5e')]['isFallbackIntent']};});};exports[_0xd883('0x5f')]=function(_0x3f695d,_0x329b55,_0x483534,_0x46221c,_0x2a5ce5,_0x53ade7){var _0x32feaa=_0x46221c[_0xd883('0x60')](/\\n/g,'\x0a');var _0x5c50ea={'credentials':{'private_key':_0x32feaa,'client_email':_0x483534}};var _0x43565c=new dialogflow[(_0xd883('0x61'))](_0x5c50ea);var _0x3f5e5d=_0x43565c[_0xd883('0x62')](_0x329b55,md5(_0x3f695d));var _0x54f827={'session':_0x3f5e5d,'queryInput':{'text':{'text':_0x2a5ce5,'languageCode':_0x53ade7}}};return _0x43565c[_0xd883('0x63')](_0x54f827)['then'](function(_0xc33163){if(_0xc33163&&_0xc33163[_0xd883('0x45')]){logger[_0xd883('0x1d')](_0xd883('0x64'),JSON[_0xd883('0x41')](_0xc33163));var _0x4dbd32=_0xc33163[0x0];if(_0x4dbd32){var _0x4d9756={'action':_0x4dbd32[_0xd883('0x65')]['action'],'allRequiredParamsPresent':_0x4dbd32[_0xd883('0x65')][_0xd883('0x66')],'endConversation':_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')]&&_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')][_0xd883('0x68')]?_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')][_0xd883('0x68')][_0xd883('0x69')][_0xd883('0x6a')]:![],'fulfillmentText':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6b')],'intentName':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6c')]['name'],'intentDisplayName':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6c')]['displayName'],'isFallbackIntent':_0x4dbd32['queryResult']['intent'][_0xd883('0x6d')],'languageCode':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6e')],'queryText':_0x4dbd32[_0xd883('0x65')]['queryText'],'responseId':_0x4dbd32[_0xd883('0x6f')],'score':_0x4dbd32[_0xd883('0x65')][_0xd883('0x70')],'speech':_0x4dbd32[_0xd883('0x65')]['fulfillmentText'],'providerResponse':JSON[_0xd883('0x41')](_0xc33163)};return _0x4d9756;}}});};exports[_0xd883('0x71')]=function(_0x332f10,_0x583519,_0x1b8b58,_0x14ceb5){return tilde[_0xd883('0x49')](_0x332f10,_0x583519,_0x1b8b58,_0x14ceb5)[_0xd883('0x2d')](function(_0xb91292){try{fs[_0xd883('0x1f')](_0x332f10);}catch(_0x2b4a2f){logger[_0xd883('0x17')](_0x2b4a2f);}logger['info'](_0xd883('0x72'),_0xb91292['transcript']);logger[_0xd883('0x1d')](_0xd883('0x73'),_0xb91292[_0xd883('0x4f')]);return _0xb91292;});};exports['awsPolly']=function(_0x49c881,_0x4cb6f4,_0x3874ce,_0x52669e,_0x2e032b,_0x20a7f4){var _0x118555=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x39'));var _0x5b4378;return aws['polly'](_0x49c881,_0x4cb6f4,_0x3874ce,_0x52669e,_0x2e032b,_0x20a7f4,_0x118555)[_0xd883('0x2d')](function(){_0x5b4378=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+'.wav');return convertFile(_0x118555,_0x5b4378);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0x118555);fs[_0xd883('0x2e')](_0x5b4378,_0xd883('0x2f'));}catch(_0x5d41aa){logger[_0xd883('0x17')](_0x5d41aa);}return _0x5b4378[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x74')]=function(_0x382c91,_0x416365,_0x38903c,_0x2ef794,_0x355105,_0x445441){return aws[_0xd883('0x75')](_0x382c91,_0x416365,_0x38903c,_0x2ef794,_0x355105,_0x445441)[_0xd883('0x2d')](function(_0x385304){logger[_0xd883('0x1d')](JSON[_0xd883('0x41')](_0x385304));return _0x385304;});};exports[_0xd883('0x76')]=function(_0x5fc39d,_0x40c931,_0x1d6c33,_0xd84e6b){var _0x521c0b=util['format'](_0xd883('0x77'),ISPEECH_API,_0x5fc39d,encodeURIComponent(_0x40c931),_0x1d6c33,_0xd84e6b);var _0xc63adf=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x39'));var _0x42169d;return downloadFile(_0x521c0b,_0xc63adf)[_0xd883('0x2d')](function(){_0x42169d=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));return convertFile(_0xc63adf,_0x42169d);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0xc63adf);fs[_0xd883('0x2e')](_0x42169d,_0xd883('0x2f'));}catch(_0x106aab){logger[_0xd883('0x17')](_0x106aab);}return _0x42169d['split']('.')[0x0];});};exports[_0xd883('0x78')]=function(_0x1090a1,_0x4c82bb,_0x52b53a,_0x3fa369){var _0x1bf668=util[_0xd883('0x79')](_0xd883('0x7a'),ISPEECH_API,_0x4c82bb,_0x52b53a,base64Encode(_0x1090a1),_0x3fa369?util[_0xd883('0x79')](_0xd883('0x7b'),encodeURIComponent(_0x3fa369)):_0xd883('0x7c'));return uploadFile(_0x1bf668)[_0xd883('0x2d')](function(_0x22d783){return querystring[_0xd883('0xa')](_0x22d783);});};exports[_0xd883('0x7d')]=function(_0x117a09,_0x337acd){return sestek['nda'](_0x117a09,_0x337acd)[_0xd883('0x2d')](function(_0x144a65){logger['info'](JSON['stringify'](_0x144a65));var _0x9a439a={'speech':_0x144a65[_0xd883('0x7e')],'action':_0x144a65[_0xd883('0x7f')]?_0x144a65[_0xd883('0x7f')]['CustomAction']:undefined,'actiondata':_0x144a65[_0xd883('0x7f')]?_0x144a65[_0xd883('0x7f')]['CustomActionData']:undefined};if(_0x144a65['channelData']&&_0x144a65[_0xd883('0x7f')][_0xd883('0x80')]){return base64Decode(_0x144a65[_0xd883('0x7f')]['AudioFromTts'][_0xd883('0x81')],path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x2a')))[_0xd883('0x2d')](function(_0x24213e){_0x9a439a[_0xd883('0x82')]=_0x24213e;return _0x9a439a;});}return _0x9a439a;});};exports[_0xd883('0x83')]=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 47421e6..a2ca2a0 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 _0x3164=['exports'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x3164,0x6a));var _0x4316=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x3164[_0x150bff];return _0x296f9a;};var nda=require('./nda');module[_0x4316('0x0')]={'nda':nda}; \ No newline at end of file +var _0x7a8c=['./nda'];(function(_0xe7693c,_0x3faab7){var _0x5e6a1e=function(_0x113c68){while(--_0x113c68){_0xe7693c['push'](_0xe7693c['shift']());}};_0x5e6a1e(++_0x3faab7);}(_0x7a8c,0x7d));var _0xc7a8=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7a8c[_0x4fde08];return _0x12e725;};var nda=require(_0xc7a8('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 16ac844..86136a2 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 _0x12c9=['POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName','AudioOutputSettings','custom_action','body','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports'];(function(_0x5776b3,_0x24b6e2){var _0x24f18d=function(_0xcb033f){while(--_0xcb033f){_0x5776b3['push'](_0x5776b3['shift']());}};_0x24f18d(++_0x24b6e2);}(_0x12c9,0x9f));var _0x912c=function(_0x2c7392,_0x57ffc8){_0x2c7392=_0x2c7392-0x0;var _0x605ad5=_0x12c9[_0x2c7392];return _0x605ad5;};'use strict';var rp=require(_0x912c('0x0'));var url=require('url');var logger=require(_0x912c('0x1'))('agi');module[_0x912c('0x2')]=function(_0x522495,_0x3364ce){var _0x2740fa={'method':_0x912c('0x3'),'uri':url[_0x912c('0x4')](_0x3364ce[_0x912c('0x5')],_0x912c('0x6')),'form':{'grant_type':_0x912c('0x7'),'username':_0x3364ce['username'],'password':_0x3364ce[_0x912c('0x7')]},'json':!![]};return rp(_0x2740fa)[_0x912c('0x8')](function(_0x4745c5){var _0x486e08={'method':_0x912c('0x3'),'uri':url['resolve'](_0x3364ce['ndassistant_url'],_0x912c('0x9')),'body':{'type':_0x3364ce['ndaactivity_type']||'message','channelId':'Nda','conversation':{'id':_0x522495[_0x912c('0xa')]},'from':{'id':_0x522495['callerid'],'name':_0x522495[_0x912c('0xb')]},'recipient':{'id':_0x522495[_0x912c('0xc')],'name':_0x522495[_0x912c('0xd')]},'text':_0x3364ce[_0x912c('0xe')],'channelData':{}},'headers':{'Authorization':_0x912c('0xf')+_0x4745c5[_0x912c('0x10')]},'json':!![]};if(_0x3364ce[_0x912c('0x11')]){_0x486e08['body'][_0x912c('0x12')][_0x912c('0x13')]=_0x3364ce[_0x912c('0x11')];}if(_0x3364ce['ndagenerate_audio']=='1'){_0x486e08['body'][_0x912c('0x12')][_0x912c('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3364ce[_0x912c('0x15')]){_0x486e08[_0x912c('0x16')]['channelData']['CustomAction']=_0x3364ce[_0x912c('0x15')];if(_0x3364ce[_0x912c('0x17')]){_0x486e08[_0x912c('0x16')]['channelData'][_0x912c('0x18')]=_0x3364ce[_0x912c('0x17')];}}logger[_0x912c('0x19')](JSON[_0x912c('0x1a')](_0x486e08));return rp(_0x486e08);});}; \ No newline at end of file +var _0x8d08=['stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','calleridname','extension','text','Bearer\x20','channelData','ProjectName','project','AudioOutputSettings','audio/wav','body','CustomAction','custom_action','CustomActionData','custom_action_data'];(function(_0x1158c6,_0x50b140){var _0x203075=function(_0x28cb4b){while(--_0x28cb4b){_0x1158c6['push'](_0x1158c6['shift']());}};_0x203075(++_0x50b140);}(_0x8d08,0x118));var _0x88d0=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x8d08[_0x42d1f8];return _0x40d234;};'use strict';var rp=require(_0x88d0('0x0'));var url=require(_0x88d0('0x1'));var logger=require(_0x88d0('0x2'))(_0x88d0('0x3'));module[_0x88d0('0x4')]=function(_0x2c31dd,_0x371bdb){var _0x2f99b6={'method':_0x88d0('0x5'),'uri':url[_0x88d0('0x6')](_0x371bdb[_0x88d0('0x7')],_0x88d0('0x8')),'form':{'grant_type':'password','username':_0x371bdb[_0x88d0('0x9')],'password':_0x371bdb[_0x88d0('0xa')]},'json':!![]};return rp(_0x2f99b6)['then'](function(_0x42ceda){var _0x511c4a={'method':_0x88d0('0x5'),'uri':url['resolve'](_0x371bdb[_0x88d0('0xb')],_0x88d0('0xc')),'body':{'type':_0x371bdb[_0x88d0('0xd')]||'message','channelId':_0x88d0('0xe'),'conversation':{'id':_0x2c31dd[_0x88d0('0xf')]},'from':{'id':_0x2c31dd['callerid'],'name':_0x2c31dd[_0x88d0('0x10')]},'recipient':{'id':_0x2c31dd['dnid'],'name':_0x2c31dd[_0x88d0('0x11')]},'text':_0x371bdb[_0x88d0('0x12')],'channelData':{}},'headers':{'Authorization':_0x88d0('0x13')+_0x42ceda['access_token']},'json':!![]};if(_0x371bdb['project']){_0x511c4a['body'][_0x88d0('0x14')][_0x88d0('0x15')]=_0x371bdb[_0x88d0('0x16')];}if(_0x371bdb['ndagenerate_audio']=='1'){_0x511c4a['body']['channelData'][_0x88d0('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x88d0('0x18')};}if(_0x371bdb['custom_action']){_0x511c4a[_0x88d0('0x19')][_0x88d0('0x14')][_0x88d0('0x1a')]=_0x371bdb[_0x88d0('0x1b')];if(_0x371bdb['custom_action_data']){_0x511c4a[_0x88d0('0x19')][_0x88d0('0x14')][_0x88d0('0x1c')]=_0x371bdb[_0x88d0('0x1d')];}}logger['info'](JSON[_0x88d0('0x1e')](_0x511c4a));return rp(_0x511c4a);});}; \ 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 133d086..9928bb8 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 _0xdad3=['exports','./lib/api'];(function(_0x9905fb,_0x352ce9){var _0x19977a=function(_0x553201){while(--_0x553201){_0x9905fb['push'](_0x9905fb['shift']());}};_0x19977a(++_0x352ce9);}(_0xdad3,0x99));var _0x3dad=function(_0x248fe8,_0x987968){_0x248fe8=_0x248fe8-0x0;var _0x1b1487=_0xdad3[_0x248fe8];return _0x1b1487;};'use strict';var asr=require(_0x3dad('0x0'));module[_0x3dad('0x1')]=function(_0x113e99,_0xa5b5f8,_0x1e02f8,_0x255507){return asr(_0x113e99,_0xa5b5f8,_0x1e02f8,_0x255507);}; \ No newline at end of file +var _0xdf8e=['exports','./lib/api'];(function(_0x19223d,_0x4a5a7a){var _0x33e726=function(_0xe3bdca){while(--_0xe3bdca){_0x19223d['push'](_0x19223d['shift']());}};_0x33e726(++_0x4a5a7a);}(_0xdf8e,0x89));var _0xedf8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdf8e[_0x1facfa];return _0x9ec701;};'use strict';var asr=require(_0xedf8('0x0'));module[_0xedf8('0x1')]=function(_0x53f1ec,_0x81bef1,_0x19ad37,_0x2ef0ab){return asr(_0x53f1ec,_0x81bef1,_0x19ad37,_0x2ef0ab);}; \ 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 26aebd1..2a9411e 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 _0x576f=['terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','close','EOS','error'];(function(_0x1ce3ea,_0x4f5e5a){var _0x3c25d3=function(_0x1d3150){while(--_0x1d3150){_0x1ce3ea['push'](_0x1ce3ea['shift']());}};_0x3c25d3(++_0x4f5e5a);}(_0x576f,0x14c));var _0xf576=function(_0x37fb9a,_0x652f5b){_0x37fb9a=_0x37fb9a-0x0;var _0x4c5f98=_0x576f[_0x37fb9a];return _0x4c5f98;};'use strict';var BPromise=require(_0xf576('0x0'));var _=require(_0xf576('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xf576('0x2'))(_0xf576('0x3'));module['exports']=function(_0x2c4c0b,_0x21cab8,_0x184d19,_0x5daa7c){return new BPromise(function(_0x3b46f2,_0x319fb1){logger[_0xf576('0x4')](_0xf576('0x5'),_0x5daa7c||_0xf576('0x6'));var _0x4c3375=new WebSocket(_0x5daa7c||_0xf576('0x6'),{'perMessageDeflate':![]});var _0x218cdc='';var _0x2c20c9='0';var _0x18c311='1';var _0x1cc9e8=_0xf576('0x7');function _0x46945e(_0x9af917){var _0x4eb03a=crypto[_0xf576('0x8')](_0xf576('0x9'));_0x4eb03a['update'](_0x9af917);return _0x4eb03a[_0xf576('0xa')](_0xf576('0xb'));}function _0x30bdd4(){try{logger[_0xf576('0x4')](_0xf576('0xc'));var _0x409185=moment()['unix']();var _0x3cb496=_0x46945e(_0x409185+_0x21cab8+_0x184d19);_0x4c3375[_0xf576('0xd')](JSON[_0xf576('0xe')]({'appID':_0x21cab8,'timestamp':_0x409185,'appKey':_0x3cb496}));var _0x1a45c2=fs['createReadStream'](_0x2c4c0b);_0x1a45c2['on']('data',function(_0xf1243d){_0x4c3375[_0xf576('0xd')](_0xf1243d);});_0x1a45c2['on'](_0xf576('0xf'),function(){_0x4c3375[_0xf576('0xd')](_0xf576('0x10'));});}catch(_0x414ed7){logger[_0xf576('0x11')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x414ed7));_0x4c3375[_0xf576('0x12')]();}}function _0x2ce270(_0x547b41){try{if(_0x547b41){var _0x15d06d=JSON[_0xf576('0x13')](_0x547b41);switch(_0x15d06d[_0xf576('0x14')]){case 0x0:if(_0x15d06d[_0xf576('0x15')]){if(_0x15d06d[_0xf576('0x15')]['final']){logger[_0xf576('0x4')](_0xf576('0x16'),JSON['stringify'](_0x15d06d[_0xf576('0x15')][_0xf576('0x17')]));_0x218cdc=_0x15d06d[_0xf576('0x15')][_0xf576('0x17')][0x0][_0xf576('0x18')];_0x2c20c9=_0x15d06d[_0xf576('0x15')][_0xf576('0x17')][0x0][_0xf576('0x19')];_0x18c311='0';_0x1cc9e8=_0xf576('0x1a');_0x4c3375[_0xf576('0x12')]();}}break;case 0x1:logger[_0xf576('0x4')](_0xf576('0x7'));_0x18c311='1';_0x1cc9e8=_0xf576('0x7');break;case 0x2:logger[_0xf576('0x4')](_0xf576('0x1b'));_0x18c311='2';_0x1cc9e8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x18c311='9';_0x1cc9e8='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xf576('0x4')](_0xf576('0x1c'));_0x18c311='10';_0x1cc9e8='Authentication\x20failed.';break;case 0xb:logger[_0xf576('0x4')](_0xf576('0x1d'));_0x18c311='11';_0x1cc9e8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x7ed319){logger[_0xf576('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf576('0xe')](_0x7ed319));_0x4c3375[_0xf576('0x12')]();}}function _0x292824(){logger[_0xf576('0x4')](_0xf576('0x1e'));_0x3b46f2({'transcript':_0x218cdc,'confidence':_0x2c20c9,'status':_0x18c311,'status_message':_0x1cc9e8});}function _0x19cf92(_0x25cd1b){logger[_0xf576('0x11')](_0xf576('0x1f'));if(!_['isNil'](_0x25cd1b)){logger[_0xf576('0x11')](_[_0xf576('0x20')](_0x25cd1b)?JSON[_0xf576('0xe')](_0x25cd1b):_0x25cd1b);}}_0x4c3375['on'](_0xf576('0x21'),_0x30bdd4);_0x4c3375['on'](_0xf576('0x22'),_0x2ce270);_0x4c3375['on']('close',_0x292824);_0x4c3375['on'](_0xf576('0x11'),_0x19cf92);});}; \ No newline at end of file +var _0xd710=['stringify','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x3b5f86,_0x1ce247){var _0x49d370=function(_0x14b5fe){while(--_0x14b5fe){_0x3b5f86['push'](_0x3b5f86['shift']());}};_0x49d370(++_0x1ce247);}(_0xd710,0x128));var _0x0d71=function(_0x2cc7c9,_0x27f605){_0x2cc7c9=_0x2cc7c9-0x0;var _0x2200a0=_0xd710[_0x2cc7c9];return _0x2200a0;};'use strict';var BPromise=require('bluebird');var _=require(_0x0d71('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0d71('0x1'));var logger=require(_0x0d71('0x2'))(_0x0d71('0x3'));module[_0x0d71('0x4')]=function(_0x3e7a74,_0x480493,_0x18162e,_0x45c522){return new BPromise(function(_0x5ec686,_0x9b0bc5){logger[_0x0d71('0x5')](_0x0d71('0x6'),_0x45c522||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xa4df25=new WebSocket(_0x45c522||_0x0d71('0x7'),{'perMessageDeflate':![]});var _0x3483a8='';var _0x3d2057='0';var _0x499162='1';var _0x9391b6=_0x0d71('0x8');function _0x56dc01(_0x19e131){var _0x1cbe85=crypto[_0x0d71('0x9')]('sha1');_0x1cbe85[_0x0d71('0xa')](_0x19e131);return _0x1cbe85[_0x0d71('0xb')](_0x0d71('0xc'));}function _0x4c24dc(){try{logger['info'](_0x0d71('0xd'));var _0x50e003=moment()[_0x0d71('0xe')]();var _0x4a7e34=_0x56dc01(_0x50e003+_0x480493+_0x18162e);_0xa4df25[_0x0d71('0xf')](JSON[_0x0d71('0x10')]({'appID':_0x480493,'timestamp':_0x50e003,'appKey':_0x4a7e34}));var _0x4efdf8=fs['createReadStream'](_0x3e7a74);_0x4efdf8['on'](_0x0d71('0x11'),function(_0x1dc15f){_0xa4df25['send'](_0x1dc15f);});_0x4efdf8['on'](_0x0d71('0x12'),function(){_0xa4df25[_0x0d71('0xf')](_0x0d71('0x13'));});}catch(_0x29f6a0){logger[_0x0d71('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0d71('0x10')](_0x29f6a0));_0xa4df25[_0x0d71('0x15')]();}}function _0x36d849(_0x829ab0){try{if(_0x829ab0){var _0x1ba553=JSON[_0x0d71('0x16')](_0x829ab0);switch(_0x1ba553[_0x0d71('0x17')]){case 0x0:if(_0x1ba553[_0x0d71('0x18')]){if(_0x1ba553['result'][_0x0d71('0x19')]){logger[_0x0d71('0x5')](_0x0d71('0x1a'),JSON[_0x0d71('0x10')](_0x1ba553['result'][_0x0d71('0x1b')]));_0x3483a8=_0x1ba553[_0x0d71('0x18')][_0x0d71('0x1b')][0x0][_0x0d71('0x1c')];_0x3d2057=_0x1ba553[_0x0d71('0x18')][_0x0d71('0x1b')][0x0][_0x0d71('0x1d')];_0x499162='0';_0x9391b6='Success.';_0xa4df25[_0x0d71('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x499162='1';_0x9391b6=_0x0d71('0x8');break;case 0x2:logger[_0x0d71('0x5')](_0x0d71('0x1e'));_0x499162='2';_0x9391b6=_0x0d71('0x1e');break;case 0x9:logger[_0x0d71('0x5')](_0x0d71('0x1f'));_0x499162='9';_0x9391b6=_0x0d71('0x1f');break;case 0xa:logger[_0x0d71('0x5')](_0x0d71('0x20'));_0x499162='10';_0x9391b6=_0x0d71('0x20');break;case 0xb:logger['info'](_0x0d71('0x21'));_0x499162='11';_0x9391b6=_0x0d71('0x21');}}}catch(_0x73aa0b){logger[_0x0d71('0x14')](_0x0d71('0x22'),JSON[_0x0d71('0x10')](_0x73aa0b));_0xa4df25['terminate']();}}function _0x1988ea(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x5ec686({'transcript':_0x3483a8,'confidence':_0x3d2057,'status':_0x499162,'status_message':_0x9391b6});}function _0x5dc8d4(_0x1214e7){logger['error'](_0x0d71('0x23'));if(!_['isNil'](_0x1214e7)){logger[_0x0d71('0x14')](_[_0x0d71('0x24')](_0x1214e7)?JSON[_0x0d71('0x10')](_0x1214e7):_0x1214e7);}}_0xa4df25['on'](_0x0d71('0x25'),_0x4c24dc);_0xa4df25['on'](_0x0d71('0x26'),_0x36d849);_0xa4df25['on'](_0x0d71('0x12'),_0x1988ea);_0xa4df25['on'](_0x0d71('0x14'),_0x5dc8d4);});}; \ 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 e04be0f..b7212a6 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 _0xa167=['./asr'];(function(_0x4d449c,_0x314cb2){var _0x57572f=function(_0xbe4b81){while(--_0xbe4b81){_0x4d449c['push'](_0x4d449c['shift']());}};_0x57572f(++_0x314cb2);}(_0xa167,0xb5));var _0x7a16=function(_0x2f2c21,_0x59db3d){_0x2f2c21=_0x2f2c21-0x0;var _0x42a166=_0xa167[_0x2f2c21];return _0x42a166;};var asr=require(_0x7a16('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x31e2=['./asr','exports'];(function(_0x38c471,_0x5888bd){var _0x452335=function(_0x19f8f2){while(--_0x19f8f2){_0x38c471['push'](_0x38c471['shift']());}};_0x452335(++_0x5888bd);}(_0x31e2,0xe0));var _0x231e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x31e2[_0x3de8a4];return _0x4635cf;};var asr=require(_0x231e('0x0'));module[_0x231e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 024cc33..16ae3f4 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xe706,0xa3));var _0x6e70=function(_0x27685e,_0x845417){_0x27685e=_0x27685e-0x0;var _0x224a6f=_0xe706[_0x27685e];return _0x224a6f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4bbf267..822dd74 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 _0x0f42=['replaceAll','extra','getAndSetVariable','maxRetry','mrcpsynth','label','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','createSquareDetailsReport','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','getVariable','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','no\x20key\x20configured','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','retry','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','gosub','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','failure','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','odbc','moment','request-promise','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','menu','channel','rpc','mailRpc','prototype','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','agicommand','arg_1','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','awsLex','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split'];(function(_0x385dcb,_0x4228f3){var _0xe84761=function(_0x5b7a8c){while(--_0x5b7a8c){_0x385dcb['push'](_0x385dcb['shift']());}};_0xe84761(++_0x4228f3);}(_0x0f42,0x126));var _0x20f4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f42[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0x20f4('0x0'));var _=require(_0x20f4('0x1'));var sh=require(_0x20f4('0x2'));var odbc=require(_0x20f4('0x3'))();var rs=require('randomstring');var moment=require(_0x20f4('0x4'));var Mustache=require('mustache');var rp=require(_0x20f4('0x5'));var logger=require('../../config/logger')(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var shared=require(_0x20f4('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x20f4('0x9');var recursiveMapAttributes=[_0x20f4('0xa'),'rawBody'];var verticesWithRetry=[_0x20f4('0xb'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4a9fd1,_0x1f42a2,_0x4f3d95){this[_0x20f4('0xc')]=_0x4a9fd1;this[_0x20f4('0xd')]=_0x1f42a2;this[_0x20f4('0xe')]=_0x4f3d95;};AGIVertices[_0x20f4('0xf')]['getVariable']=function(_0x393046,_0x56906a){this[_0x20f4('0xd')][_0x20f4('0x10')](_0x393046)[_0x20f4('0x11')](function(_0x35be6e){_0x56906a(null,_0x35be6e?_0x35be6e['name']:![]);})[_0x20f4('0x12')](function(_0x122f9e){_0x56906a(_0x122f9e);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x13')]=function(_0x1d083f,_0x41f67e){this[_0x20f4('0xd')][_0x20f4('0x14')](_0x1d083f)[_0x20f4('0x11')](function(_0x28a265){_0x41f67e(null,_0x28a265?_0x28a265[_0x20f4('0x15')]:![]);})['catch'](function(_0x55937c){_0x41f67e(_0x55937c);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x16')]=function(_0x18d4c5,_0x36fdc2){this[_0x20f4('0xd')]['getSquareProjectById'](_0x18d4c5)[_0x20f4('0x11')](function(_0x2b40b1){_0x36fdc2(null,_0x2b40b1?_0x2b40b1[_0x20f4('0x15')]:![]);})['catch'](function(_0x291f34){_0x36fdc2(_0x291f34);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x17')]=function(_0x4f82b5,_0x594454){this[_0x20f4('0xd')]['getSquareOdbcById'](_0x4f82b5)['then'](function(_0x83ee22){_0x594454(null,_0x83ee22?_0x83ee22['dsn']:![]);})[_0x20f4('0x12')](function(_0x21e793){_0x594454(_0x21e793);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x18')]=function(_0x214bf2,_0x2540ef){this['rpc'][_0x20f4('0x19')](_0x214bf2)[_0x20f4('0x11')](function(_0x134cca){_0x2540ef(null,_0x134cca?_0x134cca[_0x20f4('0x15')]:![]);})[_0x20f4('0x12')](function(_0x55a1f5){_0x2540ef(_0x55a1f5);});};AGIVertices['prototype'][_0x20f4('0x1a')]=function(_0x328bb8,_0x4c26fe){this[_0x20f4('0xd')][_0x20f4('0x1b')](_0x328bb8)['then'](function(_0x2b1e91){_0x4c26fe(null,_0x2b1e91?_0x2b1e91[_0x20f4('0x15')]:![]);})['catch'](function(_0x124958){_0x4c26fe(_0x124958);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1c')]=function(_0xba7007,_0x360340){var _0x33da20=this;this[_0x20f4('0xd')][_0x20f4('0x1d')](_0xba7007)[_0x20f4('0x11')](function(_0x11423a){_0x360340(null,_0x11423a?_0x33da20[_0x20f4('0x1e')](_0x11423a[_0x20f4('0x1f')]):![]);})[_0x20f4('0x12')](function(_0x367b2a){_0x360340(_0x367b2a);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x20')]=function(_0x2f964a,_0x5abbe5){this['rpc']['getMailAccountById'](_0x2f964a)[_0x20f4('0x11')](function(_0x43cab8){_0x5abbe5(null,_0x43cab8?_0x43cab8:![]);})[_0x20f4('0x12')](function(_0x53916a){_0x5abbe5(_0x53916a);});};AGIVertices['prototype'][_0x20f4('0x21')]=function(_0x1f85c8,_0x38ac33,_0x40e3bb){this['mailRpc'][_0x20f4('0x21')](_0x1f85c8,_0x38ac33)['then'](function(){_0x40e3bb(null);})[_0x20f4('0x12')](function(_0x1a4028){_0x40e3bb(_0x1a4028);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x22')]=function(_0x3ec1ed,_0x3438e2){this[_0x20f4('0xd')][_0x20f4('0x23')](_0x3ec1ed)[_0x20f4('0x11')](function(_0x5abf34){if(_0x5abf34){if(_0x5abf34[_0x20f4('0x24')]){_0x3438e2(null,[_0x5abf34[_0x20f4('0x25')]]);}else{_0x3438e2(null,_[_0x20f4('0x26')](_0x5abf34['Intervals'],'interval'));}}else{_0x3438e2(null,![]);}})[_0x20f4('0x12')](function(_0x482c2d){_0x3438e2(_0x482c2d);});};AGIVertices['prototype']['getSoundPath']=function(_0xb1504b){return util[_0x20f4('0x27')](_0x20f4('0x28'),FILES_PATH,_0xb1504b);};AGIVertices[_0x20f4('0xf')]['getQueryOdbc']=function(_0x5e1cdf,_0x43d1ec,_0x34f5df){odbc[_0x20f4('0x29')](_0x5e1cdf,function(_0x5117fb){if(_0x5117fb){logger[_0x20f4('0x2a')](_0x20f4('0x2b'),_0x5117fb);_0x34f5df(_0x5117fb);}else{logger[_0x20f4('0x2c')](_0x20f4('0x2d'));odbc[_0x20f4('0x2e')](_0x43d1ec,function(_0x9145f1,_0x3af857){if(_0x9145f1){logger[_0x20f4('0x2c')](_0x20f4('0x2f'),_0x43d1ec);_0x34f5df(_0x9145f1);}else{logger[_0x20f4('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x43d1ec);odbc[_0x20f4('0x30')](function(_0x3e6211){if(_0x3e6211){logger[_0x20f4('0x2a')](_0x20f4('0x31'),_0x3e6211);}_0x34f5df(null,_0x3af857);});}});}});};AGIVertices['prototype'][_0x20f4('0x32')]=function(_0x818fa,_0x5d0b5e){this[_0x20f4('0xd')][_0x20f4('0x33')](_0x818fa)[_0x20f4('0x11')](function(_0x5a1e4a){_0x5d0b5e(null,_0x5a1e4a?_0x5a1e4a:![]);})[_0x20f4('0x12')](function(_0x2a4f94){_0x5d0b5e(_0x2a4f94);});};AGIVertices[_0x20f4('0xf')]['createSmsMessage']=function(_0x16a1a8,_0x2d9bf8){this[_0x20f4('0xd')][_0x20f4('0x34')](_0x16a1a8)[_0x20f4('0x11')](function(_0x4bee91){_0x2d9bf8(null,_0x4bee91);})[_0x20f4('0x12')](function(_0x2ea566){_0x2d9bf8(_0x2ea566);});};AGIVertices[_0x20f4('0xf')]['createSquareDetailsReport']=function(_0xc0bea4,_0x562b53,_0x36dd61){this[_0x20f4('0xd')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x20f4('0x35')],'node':_0xc0bea4['label'],'application':_0xc0bea4[_0x20f4('0x36')],'data':_0x562b53||null,'project_name':this[_0x20f4('0xc')][_0x20f4('0x37')],'callerid':this[_0x20f4('0xc')]['callerid']})[_0x20f4('0x11')](function(_0x1b64fb){if(_0x36dd61){_0x36dd61(null,_0x1b64fb);}})[_0x20f4('0x12')](function(_0x1d362f){if(_0x36dd61){_0x36dd61(_0x1d362f);}});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x38')]=function(_0x5e8e1b,_0x2a6660,_0x112121,_0x5591b4){this[_0x20f4('0xd')]['createSquareRecording']({'uniqueid':this[_0x20f4('0xc')][_0x20f4('0x35')],'callerid':this['channel']['callerid'],'calleridname':this[_0x20f4('0xc')][_0x20f4('0x39')],'context':this['channel'][_0x20f4('0x3a')],'extension':this['channel']['extension'],'priority':this['channel']['priority'],'accountcode':this[_0x20f4('0xc')][_0x20f4('0x3b')],'dnid':this[_0x20f4('0xc')][_0x20f4('0x3c')],'projectName':this[_0x20f4('0xc')][_0x20f4('0x37')],'saveName':_0x2a6660,'filename':_0x5e8e1b[_0x20f4('0x3d')]||_0x2a6660,'savePath':_0x112121})[_0x20f4('0x11')](function(_0x2bbef3){_0x5591b4(null,_0x2bbef3);})['catch'](function(_0x12db43){_0x5591b4(_0x12db43);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x3e')]=function(_0x1f2e6f,_0x2f5a6d,_0x18b316,_0x1c5d6c,_0x48e1d0){this[_0x20f4('0xd')][_0x20f4('0x3e')]({'uniqueid':this[_0x20f4('0xc')][_0x20f4('0x35')],'body':_0x1f2e6f,'direction':_0x2f5a6d,'providerName':_0x18b316,'providerResponse':_0x1c5d6c})[_0x20f4('0x11')](function(_0x1cfe2a){if(_0x48e1d0){_0x48e1d0(null,_0x1cfe2a);}})['catch'](function(_0x49299f){if(_0x48e1d0){_0x48e1d0(_0x49299f);}});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x3f')]=function(_0x281a84,_0x26a493){this[_0x20f4('0xd')][_0x20f4('0x3f')]({'firstName':_[_0x20f4('0x40')](_0x281a84[_0x20f4('0x15')])||_['isNil'](_0x281a84[_0x20f4('0x15')])?_0x20f4('0x41')+Math[_0x20f4('0x42')]():_0x281a84['name'],'lastName':_['isEmpty'](_0x281a84[_0x20f4('0x43')])||_[_0x20f4('0x44')](_0x281a84[_0x20f4('0x43')])?null:_0x281a84[_0x20f4('0x43')],'phone':_0x281a84[_0x20f4('0x45')],'ListId':_0x281a84[_0x20f4('0x46')],'scheduledat':_0x281a84[_0x20f4('0x47')],'callbackUniqueid':this['channel'][_0x20f4('0x35')],'tags':'callback','description':_0x20f4('0x48')+_0x281a84['scheduledAt'][_0x20f4('0x49')](),'priority':_0x281a84[_0x20f4('0x4a')]})[_0x20f4('0x11')](function(_0x28f9ec){_0x26a493(null,_0x28f9ec);})[_0x20f4('0x12')](function(_0xb79a68){_0x26a493(_0xb79a68);});};AGIVertices['prototype'][_0x20f4('0x4b')]=function(_0x454aa9,_0x137a0c){this[_0x20f4('0xd')]['getPauseById'](_0x454aa9)[_0x20f4('0x11')](function(_0x5b7a18){_0x137a0c(null,_0x5b7a18?_0x5b7a18[_0x20f4('0x15')]:![]);})[_0x20f4('0x12')](function(_0xa1702e){_0x137a0c(_0xa1702e);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x4c')]=function(_0x50c7a6,_0x5e9a36,_0x5cd3e7){var _0x147242={'role':_0x20f4('0x4d')};_0x147242[_0x50c7a6]=this[_0x20f4('0xc')][_0x20f4('0x4e')];this[_0x20f4('0xd')]['agentPause'](_0x147242,_0x5e9a36,this[_0x20f4('0xc')][_0x20f4('0x35')])[_0x20f4('0x11')](function(_0x23087c){_0x5cd3e7(null,_[_0x20f4('0x44')](_0x23087c)?![]:!![]);})[_0x20f4('0x12')](function(_0x5bdd46){logger[_0x20f4('0x2a')](_0x5bdd46);_0x5cd3e7(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x2acbcd,_0x2290bc){var _0x59de69={'role':'agent'};_0x59de69[_0x2acbcd]=this[_0x20f4('0xc')][_0x20f4('0x4e')];this[_0x20f4('0xd')][_0x20f4('0x4f')](_0x59de69)[_0x20f4('0x11')](function(_0x2dc06b){_0x2290bc(null,_[_0x20f4('0x44')](_0x2dc06b)?![]:!![]);})[_0x20f4('0x12')](function(_0x5f4ad1){logger[_0x20f4('0x2a')](_0x5f4ad1);_0x2290bc(null,![]);});};AGIVertices[_0x20f4('0xf')]['agentLogout']=function(_0x5cad89,_0x580e49){var _0x574efa={'role':_0x20f4('0x4d')};_0x574efa[_0x5cad89]=this[_0x20f4('0xc')][_0x20f4('0x4e')];this['rpc'][_0x20f4('0x50')](_0x574efa)[_0x20f4('0x11')](function(_0x5e5307){_0x580e49(null,_['isNil'](_0x5e5307)?![]:!![]);})[_0x20f4('0x12')](function(_0x219a52){logger[_0x20f4('0x2a')](_0x219a52);_0x580e49(null,![]);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x51')]=function(_0x5e2660,_0x15dd4c){var _0x1cae10={'role':_0x20f4('0x4d')};_0x1cae10[_0x5e2660]=this[_0x20f4('0xc')][_0x20f4('0x4e')];var _0x227b61=_0x5e2660!='internal'?util[_0x20f4('0x27')](_0x20f4('0x52'),_0x20f4('0x53'),this[_0x20f4('0xc')][_0x20f4('0x4e')]):undefined;this['rpc'][_0x20f4('0x51')](_0x1cae10,_0x227b61)['then'](function(_0x5ed0f5){_0x15dd4c(null,_[_0x20f4('0x44')](_0x5ed0f5)?![]:!![]);})[_0x20f4('0x12')](function(_0xe607d1){logger['error'](_0xe607d1);_0x15dd4c(null,![]);});};AGIVertices['prototype'][_0x20f4('0x54')]=function(_0x53a6e4,_0x485326){sh[_0x20f4('0x55')](_[_0x20f4('0x56')](_0x53a6e4),function(_0x360f84,_0x91a679){var _0x30b96b=_0x91a679[_0x20f4('0x57')](/(\r\n|\n|\r)/gm,'');_0x485326(null,_0x30b96b);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x58')]=function(_0x54bc1c,_0x4a3de2){scripts[_0x20f4('0x58')](_0x54bc1c[_0x20f4('0x59')],_0x54bc1c[_0x20f4('0x5a')]||_0x20f4('0x5b'),_0x54bc1c[_0x20f4('0x5b')],_0x54bc1c['languageCode']||'en-US',_0x54bc1c['ssmlGender']||_0x20f4('0x5c'),_0x54bc1c[_0x20f4('0x5d')]||_0x20f4('0x5e'))[_0x20f4('0x11')](function(_0x13bde3){_0x4a3de2(null,_0x13bde3);})[_0x20f4('0x12')](function(_0x2bdb63){_0x4a3de2(_0x2bdb63);});};AGIVertices['prototype'][_0x20f4('0x5f')]=function(_0x569aff,_0x1099a4){scripts[_0x20f4('0x5f')](_0x569aff[_0x20f4('0x5b')],_0x569aff[_0x20f4('0x60')]||'en',0x1)[_0x20f4('0x11')](function(_0x5a1207){_0x1099a4(null,_0x5a1207);})[_0x20f4('0x12')](function(_0x10c953){_0x1099a4(_0x10c953);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x61')]=function(_0x24759d,_0x500f02){var _0x951d25={'uri':_0x24759d[_0x20f4('0x62')],'method':_0x24759d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24759d['timeout'])==='number'&&parseInt(_0x24759d['timeout'])>=0x1?parseInt(_0x24759d[_0x20f4('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x20f4('0x64')](['POST','PUT'],_0x951d25['method'][_0x20f4('0x65')]())){try{_0x951d25[_0x20f4('0x66')]=_0x24759d[_0x20f4('0x67')]?JSON[_0x20f4('0x68')](_0x24759d['rawBody']):{};}catch(_0x1e8431){logger[_0x20f4('0x2a')](_0x20f4('0x69'),_0x1e8431);}}try{_0x951d25[_0x20f4('0x6a')]=_0x24759d[_0x20f4('0xa')]?JSON[_0x20f4('0x68')](_0x24759d[_0x20f4('0xa')]):{};}catch(_0x4b1876){logger[_0x20f4('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4b1876);}if(_0x24759d[_0x20f4('0x6b')]){try{var _0x2ff547=require(_0x24759d[_0x20f4('0x6b')])[_0x20f4('0x6c')](this,_0x951d25);_0x951d25[_0x20f4('0x6d')]=Mustache[_0x20f4('0x6e')](_0x24759d[_0x20f4('0x62')],_0x2ff547,{},['$$','$$']);if(_0x951d25['headers']){_0x951d25['headers']=JSON['parse'](Mustache['render'](JSON[_0x20f4('0x6f')](_0x951d25[_0x20f4('0x6a')]),_0x2ff547,{},['$$','$$']));}if(_0x951d25[_0x20f4('0x66')]){_0x951d25[_0x20f4('0x66')]=JSON[_0x20f4('0x68')](Mustache[_0x20f4('0x6e')](JSON[_0x20f4('0x6f')](_0x951d25[_0x20f4('0x66')]),_0x2ff547,{},['$$','$$']));}}catch(_0x7948cf){logger[_0x20f4('0x2a')](_0x20f4('0x70'),_0x7948cf);}}rp(_0x951d25)[_0x20f4('0x11')](function(_0x3b51ee){var _0xdf3a04={'statusCode':_0x3b51ee[_0x20f4('0x71')]||0xc8,'statusMessage':_0x3b51ee[_0x20f4('0x72')]||'OK','headers':_0x3b51ee[_0x20f4('0x6a')]||{},'body':_0x3b51ee['body']||{}};_0x500f02(null,_0xdf3a04);})[_0x20f4('0x12')](function(_0x142d27){var _0x644250={'statusCode':_0x142d27['statusCode']||0x1f4,'statusMessage':_0x142d27[_0x20f4('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x142d27[_0x20f4('0x74')][_0x20f4('0x6a')]||{},'body':_0x142d27[_0x20f4('0x74')][_0x20f4('0x66')]||{}};_0x500f02(null,_0x644250);});};AGIVertices[_0x20f4('0xf')]['googleDialogflow']=function(_0x302360,_0xcad0e2){scripts[_0x20f4('0x75')](this[_0x20f4('0xc')][_0x20f4('0x35')],_0x302360[_0x20f4('0x76')],_0x302360[_0x20f4('0x5b')],_0x302360[_0x20f4('0x77')]||'en')[_0x20f4('0x11')](function(_0x5d2531){_0xcad0e2(null,_0x5d2531);})[_0x20f4('0x12')](function(_0x420710){_0xcad0e2(_0x420710);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x78')]=function(_0x297c00,_0x460f9d){scripts['googleDialogflowV2'](this[_0x20f4('0xc')][_0x20f4('0x35')],_0x297c00[_0x20f4('0x79')],_0x297c00[_0x20f4('0x7a')],_0x297c00[_0x20f4('0x7b')],_0x297c00[_0x20f4('0x5b')],_0x297c00[_0x20f4('0x7c')]||'en')[_0x20f4('0x11')](function(_0x4c5923){_0x460f9d(null,_0x4c5923);})[_0x20f4('0x12')](function(_0x238f0f){_0x460f9d(_0x238f0f);});};AGIVertices[_0x20f4('0xf')]['sestekNDA']=function(_0x1aff2a,_0x1ab4e9){scripts[_0x20f4('0x7d')](this[_0x20f4('0xc')],_0x1aff2a)[_0x20f4('0x11')](function(_0x4e9c6c){_0x1ab4e9(null,_0x4e9c6c);})[_0x20f4('0x12')](function(_0x59a093){_0x1ab4e9(_0x59a093);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x7e')]=function(_0x555d35,_0x38107c){scripts['ispeechTTS'](_0x555d35[_0x20f4('0x76')],_0x555d35[_0x20f4('0x5b')],_0x555d35['ispeech_tts_language']||'en-US',_0x555d35[_0x20f4('0x7f')])[_0x20f4('0x11')](function(_0x225e0d){_0x38107c(null,_0x225e0d);})[_0x20f4('0x12')](function(_0x1c898e){_0x38107c(_0x1c898e);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x80')]=function(_0x3519df,_0xdbaf2e,_0x2795c7){scripts['ispeechASR'](_0xdbaf2e,_0x3519df[_0x20f4('0x76')],_0x3519df[_0x20f4('0x81')]||_0x20f4('0x82'),this[_0x20f4('0x83')](_0x3519df[_0x20f4('0x84')])?_0x3519df['model']:undefined)['then'](function(_0xca2e3b){_0x2795c7(null,_0xca2e3b);})['catch'](function(_0x58cabb){_0x2795c7(_0x58cabb);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x85')]=function(_0x232201,_0x5852ef){scripts[_0x20f4('0x85')](_0x232201[_0x20f4('0x86')],_0x232201[_0x20f4('0x87')],_0x232201['aws_polly_region'],_0x232201[_0x20f4('0x88')]||'Amy',_0x232201[_0x20f4('0x5b')],_0x232201['aws_text_type']||_0x20f4('0x5b'))[_0x20f4('0x11')](function(_0x27c4d9){_0x5852ef(null,_0x27c4d9);})[_0x20f4('0x12')](function(_0x46f464){_0x5852ef(_0x46f464);});};AGIVertices['prototype']['awsLex']=function(_0x2bf0b8,_0x49f906){scripts[_0x20f4('0x89')](this[_0x20f4('0xc')][_0x20f4('0x35')],_0x2bf0b8[_0x20f4('0x86')],_0x2bf0b8[_0x20f4('0x87')],_0x2bf0b8['aws_lex_region'],_0x2bf0b8['text'],_0x2bf0b8['aws_bot_name'])['then'](function(_0x2aee9c){_0x49f906(null,_0x2aee9c);})[_0x20f4('0x12')](function(_0x1c8b53){_0x49f906(_0x1c8b53);});};AGIVertices[_0x20f4('0xf')]['googleASR']=function(_0x8cddc5,_0x3d5b54,_0x25eb4e){scripts['googleASR'](_0x3d5b54,_0x8cddc5['key'],_0x8cddc5[_0x20f4('0x8a')]||_0x20f4('0x82'))['then'](function(_0x39c0a8){_0x25eb4e(null,_0x39c0a8);})[_0x20f4('0x12')](function(_0xb2ec91){_0x25eb4e(_0xb2ec91);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x8b')]=function(_0x47bf0b,_0xdc9e0d,_0x7ea107){scripts['tildeASR'](_0xdc9e0d,_0x47bf0b[_0x20f4('0x8c')],_0x47bf0b[_0x20f4('0x8d')],_0x47bf0b[_0x20f4('0x6d')])['then'](function(_0x2642e7){_0x7ea107(null,_0x2642e7);})['catch'](function(_0x3c939c){_0x7ea107(_0x3c939c);});};AGIVertices[_0x20f4('0xf')][_0x20f4('0x8e')]=function(_0x35fd3b){var _0x109c91=_[_0x20f4('0x64')](verticesWithRetry,_0x35fd3b[_0x20f4('0x36')])?_0x35fd3b:_[_0x20f4('0x8f')](_0x35fd3b);for(var _0x59ad7c in _0x109c91){if(_0x109c91[_0x20f4('0x90')](_0x59ad7c)){if(_0x109c91[_0x59ad7c]&&_[_0x20f4('0x91')](_0x109c91[_0x59ad7c])){if(_[_0x20f4('0x64')](recursiveMapAttributes,_0x59ad7c)){_0x109c91[_0x59ad7c]=this[_0x20f4('0x92')](_0x109c91[_0x59ad7c]);}else{_0x109c91[_0x59ad7c]=this[_0x20f4('0x93')](_0x109c91[_0x59ad7c]);}}}}return _0x109c91;};AGIVertices[_0x20f4('0xf')][_0x20f4('0x94')]=function(_0x22881d){for(var _0x174843 in _0x22881d){if(_0x22881d['hasOwnProperty'](_0x174843)){if(_[_0x20f4('0x95')](_0x22881d[_0x174843])){this[_0x20f4('0x94')](_0x22881d[_0x174843]);}else if(_[_0x20f4('0x96')](_0x22881d[_0x174843])){for(var _0x38f186=0x0;_0x38f186<_0x22881d[_0x174843][_0x20f4('0x97')];_0x38f186++){this[_0x20f4('0x94')](_0x22881d[_0x174843][_0x38f186]);}}else if(_[_0x20f4('0x91')](_0x22881d[_0x174843])){_0x22881d[_0x174843]=this[_0x20f4('0x93')](_0x22881d[_0x174843]);}}}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x98')]=function(_0x218092,_0x127eca){for(var _0x4baa55 in _0x218092){if(_0x218092['hasOwnProperty'](_0x4baa55)){if(_[_0x20f4('0x95')](_0x218092[_0x4baa55])){if(!_[_0x20f4('0x40')](_0x218092[_0x4baa55])){this['saveRestApiResult'](_0x218092[_0x4baa55],util[_0x20f4('0x27')](_0x20f4('0x99'),_0x127eca,_0x4baa55));}}else if(_[_0x20f4('0x96')](_0x218092[_0x4baa55])){for(var _0x487f84=0x0;_0x487f84<_0x218092[_0x4baa55][_0x20f4('0x97')];_0x487f84++){this['saveRestApiResult'](_0x218092[_0x4baa55][_0x487f84],util[_0x20f4('0x27')]('%s.%s',_0x127eca,_0x4baa55+'['+_0x487f84+']'));}}else{if(!_[_0x20f4('0x44')](_0x218092[_0x4baa55])){this[_0x20f4('0xc')][_0x20f4('0x9a')](util['format'](_0x20f4('0x99'),_0x127eca,_0x4baa55),_0x218092[_0x4baa55]);}}}}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x92')]=function(_0x4a56b6){try{var _0xd23563=JSON['parse'](_0x4a56b6);this['recursiveNodeIndex'](_0xd23563);return JSON['stringify'](_0xd23563);}catch(_0x381782){return this[_0x20f4('0x93')](_0x4a56b6);}};AGIVertices[_0x20f4('0xf')]['replaceAllVariables']=function(_0x4c0147){var _0x180745=_0x4c0147[_0x20f4('0x9b')]('{');for(var _0xb60c7d=0x1;_0xb60c7d<_0x180745[_0x20f4('0x97')];_0xb60c7d+=0x1){var _0x3c1abc=_0x180745[_0xb60c7d]['split']('}');if(_0x3c1abc[_0x20f4('0x97')]>0x1){_0x4c0147=_0x4c0147[_0x20f4('0x9c')]('{'+_0x3c1abc[0x0]+'}',this[_0x20f4('0xc')]['getVariable'](_0x3c1abc[0x0])[_0x20f4('0x9d')]||_0x3c1abc[0x0]);}}if(_0x180745['length']===0x1){return _0x4c0147[_0x20f4('0x49')]();}return this[_0x20f4('0x93')](_0x4c0147);};AGIVertices['prototype'][_0x20f4('0x9e')]=function(_0x5beeaf,_0x312a53){var _0x329ec0=this[_0x20f4('0xc')]['getVariable'](_0x5beeaf);if(_0x329ec0['result']===-0x1){return _0x329ec0;}logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x312a53,_0x329ec0[_0x20f4('0x9d')]));return this[_0x20f4('0xc')][_0x20f4('0x9a')](_0x312a53,_0x329ec0['extra']);};AGIVertices[_0x20f4('0xf')][_0x20f4('0x83')]=function(_0x5ab227){return _0x5ab227&&_0x5ab227!=='0'&&_0x5ab227!=='-1'&&_0x5ab227!=='';};AGIVertices['prototype'][_0x20f4('0x9f')]=function(_0x1af3e6){this['createSquareDetailsReport'][_0x20f4('0x6c')](this,_0x1af3e6,'-');_0x1af3e6['retry']=_0x1af3e6[_0x20f4('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x20f4('0xf')][_0x20f4('0xa0')]=function(_0x2d19c5){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2d19c5[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x2d19c5['text'])){return this[_0x20f4('0xc')]['noop'](_0x20f4('0xa2'));}var _0xc349bc='\x22'+_0x2d19c5[_0x20f4('0x5b')]+'\x22';if(this[_0x20f4('0x83')](_0x2d19c5[_0x20f4('0x74')])){_0xc349bc+=','+_0x2d19c5['options'];}var _0x3a8fe7=this['channel']['exec'](_0x20f4('0xa3'),_0xc349bc);if(_0x3a8fe7['result']===-0x1){return _0x3a8fe7;}return this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xa5'),_0xc349bc));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xa6')]=function(_0xdf76aa){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0xa7'),_0xdf76aa[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0xdf76aa[_0x20f4('0xa8')])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xa9'));}var _0x540244=_0xdf76aa[_0x20f4('0xa8')];if(this[_0x20f4('0x83')](_0xdf76aa['options'])){_0x540244+=','+_0xdf76aa[_0x20f4('0x74')];}var _0x48bd78=this[_0x20f4('0xc')][_0x20f4('0x55')](_0x20f4('0xaa'),_0x540244);if(_0x48bd78[_0x20f4('0xab')]===-0x1){return _0x48bd78;}var _0xa69601=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x20f4('0xac'));if(_0xa69601[_0x20f4('0xab')]===-0x1){return _0xa69601;}var _0x2f5d27=this['getAndSetVariable']('RECOG_INPUT()',_0x20f4('0xad'));if(_0x2f5d27[_0x20f4('0xab')]===-0x1){return _0x2f5d27;}var _0x114b67=this[_0x20f4('0x9e')]('RECOG_INSTANCE()',_0x20f4('0xae'));if(_0x114b67[_0x20f4('0xab')]===-0x1){return _0x114b67;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x540244));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x6')]=function(_0x44bd9a){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0xaf'),_0x44bd9a[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0x6')]([_0x44bd9a['command'],_0x44bd9a['args']]);};AGIVertices['prototype'][_0x20f4('0xb0')]=function(_0x5536f1){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xb1'),_0x5536f1['label']));if(this['isConfigured'](_0x5536f1[_0x20f4('0x63')])){logger['info'](util['format'](_0x20f4('0xb2'),_0x5536f1[_0x20f4('0x63')]));var _0x22b445=this[_0x20f4('0xc')][_0x20f4('0xb3')](_0x5536f1[_0x20f4('0x63')]);if(_0x22b445[_0x20f4('0xab')]===-0x1){return _0x22b445;}}return this[_0x20f4('0xc')][_0x20f4('0xb0')]();};AGIVertices[_0x20f4('0xf')]['callback']=function(_0x5352d1){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5352d1[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x5352d1[_0x20f4('0x46')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x5352d1,_0x20f4('0xb4'));}_0x5352d1[_0x20f4('0x47')]=moment();if(this[_0x20f4('0x83')](_0x5352d1[_0x20f4('0xb5')])){_0x5352d1[_0x20f4('0x47')]=moment()[_0x20f4('0xb6')](_0x5352d1[_0x20f4('0xb5')],_0x20f4('0xb7'));}if(!this[_0x20f4('0x83')](_0x5352d1['callback_priority'])){_0x5352d1['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x5352d1);return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xb8'),_0x5352d1[_0x20f4('0x45')],_0x5352d1['list_id'],_0x5352d1[_0x20f4('0x47')]));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xb9')]=function(_0x31bc74){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xba'),_0x31bc74[_0x20f4('0xa1')]));var _0x43d520=this[_0x20f4('0xc')]['exec'](_0x31bc74['application'],_0x31bc74[_0x20f4('0x74')]);if(_0x43d520[_0x20f4('0xab')]===-0x1){return _0x43d520;}return this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xbb'),_0x31bc74['application'],_0x31bc74[_0x20f4('0x74')]));};AGIVertices[_0x20f4('0xf')]['lumenvoxtts']=function(_0x4ebe66){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xbc'),_0x4ebe66['label']));if(!this[_0x20f4('0x83')](_0x4ebe66['text'])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xa2'));}var _0x29473a='\x22'+_0x4ebe66['text']+'\x22';if(this[_0x20f4('0x83')](_0x4ebe66['options'])){_0x29473a+=','+_0x4ebe66[_0x20f4('0x74')];}var _0x4b72fd=this[_0x20f4('0xc')][_0x20f4('0x55')](_0x20f4('0xa3'),_0x29473a);if(_0x4b72fd[_0x20f4('0xab')]===-0x1){return _0x4b72fd;}return this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0xa5'),_0x29473a));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xbd')]=function(_0x2db47f){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2db47f[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x2db47f[_0x20f4('0x5b')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20text\x20configured');}var _0x591e68='\x22'+_0x2db47f[_0x20f4('0x5b')]+'\x22';if(this[_0x20f4('0x83')](_0x2db47f[_0x20f4('0x74')])){_0x591e68+=','+_0x2db47f['options'];}var _0x47db79=this['channel'][_0x20f4('0x55')](_0x20f4('0xa3'),_0x591e68);if(_0x47db79['result']===-0x1){return _0x47db79;}return this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x591e68));};AGIVertices[_0x20f4('0xf')]['lumenvoxasr']=function(_0x227728){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xbe'),_0x227728[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x227728[_0x20f4('0xa8')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xa9'));}var _0x266855=_0x227728[_0x20f4('0xa8')];if(this['isConfigured'](_0x227728[_0x20f4('0x74')])){_0x266855+=','+_0x227728[_0x20f4('0x74')];}var _0x3cec3f=this[_0x20f4('0xc')][_0x20f4('0x55')](_0x20f4('0xaa'),_0x266855);if(_0x3cec3f[_0x20f4('0xab')]===-0x1){return _0x3cec3f;}var _0x2dda08=this[_0x20f4('0x9e')](_0x20f4('0xbf'),_0x20f4('0xc0'));if(_0x2dda08['result']===-0x1){return _0x2dda08;}var _0x3c99eb=this[_0x20f4('0x9e')](_0x20f4('0xc1'),_0x20f4('0xc2'));if(_0x3c99eb['result']===-0x1){return _0x3c99eb;}var _0x491280=this[_0x20f4('0x9e')](_0x20f4('0xc3'),_0x20f4('0xc4'));if(_0x491280[_0x20f4('0xab')]===-0x1){return _0x491280;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xc5'),_0x266855));};AGIVertices['prototype'][_0x20f4('0xc6')]=function(_0x367d5e){logger['info'](util[_0x20f4('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x367d5e[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x367d5e[_0x20f4('0xa8')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20grammar\x20configured');}var _0x1fc6e4=_0x367d5e[_0x20f4('0xa8')];if(this[_0x20f4('0x83')](_0x367d5e['options'])){_0x1fc6e4+=','+_0x367d5e[_0x20f4('0x74')];}var _0x556544=this['channel'][_0x20f4('0x55')](_0x20f4('0xaa'),_0x1fc6e4);if(_0x556544['result']===-0x1){return _0x556544;}var _0x2fa4bd=this['getAndSetVariable'](_0x20f4('0xbf'),'SESTEK_ASR_CONFIDENCE');if(_0x2fa4bd[_0x20f4('0xab')]===-0x1){return _0x2fa4bd;}var _0x35ab33=this['getAndSetVariable'](_0x20f4('0xc1'),_0x20f4('0xc7'));if(_0x35ab33['result']===-0x1){return _0x35ab33;}var _0x536c3d=this[_0x20f4('0x9e')]('RECOG_INSTANCE()',_0x20f4('0xc8'));if(_0x536c3d['result']===-0x1){return _0x536c3d;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xc5'),_0x1fc6e4));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xc9')]=function(_0x27f853){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xca'),_0x27f853[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x27f853[_0x20f4('0xcb')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x27f853,_0x20f4('0xcc'));}var _0x405718=this[_0x20f4('0x17')][_0x20f4('0x6c')](this,_0x27f853[_0x20f4('0xcb')]);if(!_0x405718){return this[_0x20f4('0xc')]['error'](_0x27f853,_0x20f4('0xcd'));}if(!this[_0x20f4('0x83')](_0x27f853[_0x20f4('0x2e')])){return this['channel'][_0x20f4('0x2a')](_0x27f853,_0x20f4('0xce'));}var _0x2de396=_0x27f853[_0x20f4('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')]('query:\x20%s',_0x2de396));var _0xca2d53=this[_0x20f4('0xcf')]['sync'](this,_0x405718,_0x2de396);this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x27f853,_0x2de396);if(!this['isConfigured'](_0x27f853['variable_id'])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xd1'));}var _0x243d04=this['getVariable'][_0x20f4('0x6c')](this,_0x27f853[_0x20f4('0xd2')]);if(!_0x243d04){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x27f853,'no\x20variable\x20found');}var _0x3191e6=this;_0xca2d53[_0x20f4('0xd3')](function(_0x50c80c,_0x3d7f68){Object[_0x20f4('0xd4')](_0x50c80c)[_0x20f4('0xd3')](function(_0x9cb60e){_0x3191e6[_0x20f4('0xc')][_0x20f4('0x9a')](util[_0x20f4('0x27')]('%s[%s][%s]',_0x243d04,_0x3d7f68,_0x9cb60e),_0x50c80c[_0x9cb60e]);});});this[_0x20f4('0xc')]['setVariable'](util['format']('%s_ROWS_COUNT',_0x243d04),_0xca2d53[_0x20f4('0x97')]);return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xd5'),_0x243d04));};AGIVertices['prototype']['dial']=function(_0x15bbdd){logger[_0x20f4('0xd6')](util[_0x20f4('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x15bbdd['label']));if(!this[_0x20f4('0x83')](_0x15bbdd[_0x20f4('0xd7')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x15bbdd,_0x20f4('0xd8'));}var _0x407242=this[_0x20f4('0x18')][_0x20f4('0x6c')](this,_0x15bbdd[_0x20f4('0xd7')]);if(!_0x407242){return this['channel']['error'](_0x15bbdd,'no\x20user\x20found');}var _0x2241df=this[_0x20f4('0xc')]['exec']('DIAL',[util[_0x20f4('0x27')](_0x20f4('0xd9'),_0x407242),_0x15bbdd['timeout'],_0x15bbdd['opts'],_0x15bbdd['url']]);if(_0x2241df['result']===-0x1){return _0x2241df;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format'](_0x20f4('0xda'),'DIAL'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xdb')]=function(_0x1381df){logger['info'](util[_0x20f4('0x27')](_0x20f4('0xdc'),_0x1381df[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x1381df['key'])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20key\x20configured');}if(!this[_0x20f4('0x83')](_0x1381df[_0x20f4('0x5b')])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xa2'));}this[_0x20f4('0xc')][_0x20f4('0xdd')]=!![];this[_0x20f4('0xd0')](_0x1381df);this['createSquareMessage'](_0x1381df['text'],'in','','');this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xde'),_0x1381df[_0x20f4('0x5b')]));var _0x1ae08e=this[_0x20f4('0x75')]['sync'](this,_0x1381df);if(_0x1ae08e){for(var _0x2e34d4 in _0x1ae08e){if(_0x1ae08e[_0x20f4('0x90')](_0x2e34d4)){this[_0x20f4('0xc')]['setVariable'](util['format'](_0x20f4('0xdf'),_0x2e34d4[_0x20f4('0x65')]()),_0x1ae08e[_0x2e34d4]);}}this[_0x20f4('0x3e')](_0x1ae08e['speech'],_0x20f4('0xe0'),_0x20f4('0xdb'),'');return this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0xe1'),_0x1ae08e[_0x20f4('0xe2')]));}return this['channel'][_0x20f4('0x2a')](_0x1381df,_0x20f4('0xe3'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xe4')]=function(_0x181b38){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0xe5'),_0x181b38[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x181b38['dialogflowV2_project_id'])){return this[_0x20f4('0xc')]['noop'](_0x20f4('0xe6'));}if(!this['isConfigured'](_0x181b38[_0x20f4('0x7a')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x181b38[_0x20f4('0x7b')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xe7'));}if(!this[_0x20f4('0x83')](_0x181b38[_0x20f4('0x7c')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xe8'));}if(!this['isConfigured'](_0x181b38[_0x20f4('0x5b')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xa2'));}this[_0x20f4('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x181b38);this[_0x20f4('0x3e')](_0x181b38[_0x20f4('0x5b')],'in','','');this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xe9'),_0x181b38['text']));var _0x1a3084=this[_0x20f4('0x78')][_0x20f4('0x6c')](this,_0x181b38);if(_0x1a3084){for(var _0x3f55e2 in _0x1a3084){if(_0x1a3084['hasOwnProperty'](_0x3f55e2)){if(_0x3f55e2!==_0x20f4('0xea')){this[_0x20f4('0xc')][_0x20f4('0x9a')](util[_0x20f4('0x27')](_0x20f4('0xdf'),_0x3f55e2['toUpperCase']()),_0x1a3084[_0x3f55e2]);}}}this[_0x20f4('0x3e')](_0x1a3084[_0x20f4('0xe2')],'out','dialogflowV2',_0x1a3084[_0x20f4('0xea')]);return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('DialogflowV2\x20Result\x20%s',_0x1a3084[_0x20f4('0xe2')]));}return this['channel'][_0x20f4('0x2a')](_0x181b38,_0x20f4('0xeb'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0xec')]=function(_0x1315f1){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0xed'),_0x1315f1[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x1315f1[_0x20f4('0xee')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xef'));}if(!this[_0x20f4('0x83')](_0x1315f1[_0x20f4('0xf0')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20username\x20configured');}if(!this[_0x20f4('0x83')](_0x1315f1[_0x20f4('0xf1')])){return this[_0x20f4('0xc')]['noop'](_0x20f4('0xf2'));}if(!this['isConfigured'](_0x1315f1[_0x20f4('0xf3')])){return this[_0x20f4('0xc')]['noop']('no\x20text\x20configured');}this[_0x20f4('0xc')][_0x20f4('0xdd')]=!![];this[_0x20f4('0xd0')](_0x1315f1);this[_0x20f4('0x3e')](_0x1315f1[_0x20f4('0x5b')],'in','','');this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xf4'),_0x1315f1[_0x20f4('0x5b')]));var _0x37afa9=this[_0x20f4('0x7d')][_0x20f4('0x6c')](this,_0x1315f1);if(_0x37afa9){for(var _0xb0d1ac in _0x37afa9){if(_0x37afa9[_0x20f4('0x90')](_0xb0d1ac)){this['channel'][_0x20f4('0x9a')](util['format'](_0x20f4('0xf5'),_0xb0d1ac['toUpperCase']()),_0x37afa9[_0xb0d1ac]);}}this[_0x20f4('0x3e')](_0x37afa9[_0x20f4('0xe2')],_0x20f4('0xe0'),_0x20f4('0xec'),'');if(_0x37afa9[_0x20f4('0xf6')]){this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xf7'),_0x37afa9[_0x20f4('0xf6')]));var _0x27684f=this[_0x20f4('0xc')][_0x20f4('0xf8')](_0x37afa9['audiofile']);try{fs['unlink'](_0x37afa9[_0x20f4('0xf6')]+_0x20f4('0xf9'));}catch(_0x4b8275){logger['error'](_0x4b8275);}return _0x27684f;}else{return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xfa'),_0x37afa9[_0x20f4('0xe2')]));}}return this[_0x20f4('0xc')]['error'](_0x1315f1,_0x20f4('0xfb'));};AGIVertices[_0x20f4('0xf')]['end']=function(_0xe12df5){logger['info'](util[_0x20f4('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0xe12df5[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0xa4')]('end');};AGIVertices['prototype'][_0x20f4('0xfc')]=function(_0x441b51){logger[_0x20f4('0x2c')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x441b51[_0x20f4('0xa1')]));var _0x45eb99='';if(_0x441b51[_0x20f4('0xfd')]){if(!this[_0x20f4('0x83')](_0x441b51['trunk_id'])){return this['channel'][_0x20f4('0x2a')](_0x441b51,_0x20f4('0xfe'));}else{var _0x399746=parseInt(_0x441b51['trunk_id'],0xa);if(isNaN(_0x399746)){_0x45eb99=_0x441b51[_0x20f4('0xfd')];}else{_0x45eb99=this[_0x20f4('0x1a')][_0x20f4('0x6c')](this,_0x441b51[_0x20f4('0xfd')]);if(!_0x45eb99){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x441b51,_0x20f4('0xff'));}}}}else if(_0x441b51[_0x20f4('0x100')]){_0x45eb99=_0x441b51[_0x20f4('0x100')];}else{return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x441b51,_0x20f4('0xfe'));}var _0x1c7ded=this[_0x20f4('0xc')][_0x20f4('0x55')](_0x20f4('0x101'),[util[_0x20f4('0x27')](_0x20f4('0x102'),_0x45eb99,_0x441b51[_0x20f4('0x45')]),_0x441b51['timeout'],_0x441b51[_0x20f4('0x103')],_0x441b51[_0x20f4('0x62')]]);if(_0x1c7ded['result']===-0x1){return _0x1c7ded;}return this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0xda'),_0x20f4('0x101')));};AGIVertices['prototype']['finally']=function(_0x332fd6){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x104'),_0x332fd6[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x105'));};AGIVertices['prototype'][_0x20f4('0x106')]=function(_0x1b3ec1){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x107'),_0x1b3ec1[_0x20f4('0xa1')]));if(_0x1b3ec1['retry']===0x0){return this['maxRetry'](_0x1b3ec1);}_0x1b3ec1['retry']-=0x1;if(!this[_0x20f4('0x83')](_0x1b3ec1[_0x20f4('0x108')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1b3ec1,_0x20f4('0x109'));}var _0x1f415f=this[_0x20f4('0x1c')]['sync'](this,_0x1b3ec1[_0x20f4('0x108')]);if(!_0x1f415f){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1b3ec1,_0x20f4('0x10a'));}if(!this['isConfigured'](_0x1b3ec1[_0x20f4('0xd2')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x323708=this[_0x20f4('0xc')]['getData'](_0x1f415f,_0x1b3ec1[_0x20f4('0x10b')],_0x1b3ec1[_0x20f4('0x10c')]);var _0x32bd41=_0x323708[_0x20f4('0xab')]?_0x323708['result'][_0x20f4('0x49')]():'';logger[_0x20f4('0x2c')](_0x20f4('0x10d'),JSON[_0x20f4('0x6f')](_0x323708));if(_0x323708[_0x20f4('0xab')]===-0x1){this[_0x20f4('0xd0')]['sync'](this,_0x1b3ec1,_0x32bd41);return _0x323708;}else if(_0x323708[_0x20f4('0x9d')]==='timeout'){_0x323708[_0x20f4('0xab')]=_0x32bd41['length']>=parseInt(_0x1b3ec1[_0x20f4('0x10e')])?'x':'i';}else{_0x323708[_0x20f4('0xab')]=_0x32bd41[_0x20f4('0x97')]>=parseInt(_0x1b3ec1[_0x20f4('0x10e')])&&_0x32bd41['length']<=parseInt(_0x1b3ec1[_0x20f4('0x10c')])?'x':'i';}var _0x3624ce=this[_0x20f4('0x10f')][_0x20f4('0x6c')](this,_0x1b3ec1['variable_id']);if(!_0x3624ce){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1b3ec1,'no\x20variable\x20found');}this[_0x20f4('0xc')][_0x20f4('0x9a')](_0x3624ce,_0x32bd41);if(this['isConfigured'](_0x1b3ec1[_0x20f4('0x110')])){var _0x110c38=parseInt(_0x1b3ec1[_0x20f4('0x110')],0xa);var _0x22ec60=rs[_0x20f4('0x111')]({'charset':'*','length':_0x110c38});var _0x47d943=_0x32bd41[_0x20f4('0x97')];if(_0x47d943>0x0){if(_0x47d943>_0x110c38){this['createSquareDetailsReport'][_0x20f4('0x6c')](this,_0x1b3ec1,_0x1b3ec1[_0x20f4('0x112')]==='first'?_0x22ec60+_0x32bd41[_0x20f4('0x113')](_0x110c38):_0x32bd41[_0x20f4('0x113')](0x0,_0x47d943-_0x110c38)+_0x22ec60);}else{this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x1b3ec1,rs[_0x20f4('0x111')]({'charset':'*','length':_0x47d943}));}}else{this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x1b3ec1,'');}}else{this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x1b3ec1,_0x32bd41);}return _0x323708;};AGIVertices[_0x20f4('0xf')][_0x20f4('0x114')]=function(_0x58bd30){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x115'),_0x58bd30[_0x20f4('0xa1')]));return this[_0x20f4('0x106')](_0x58bd30);};AGIVertices[_0x20f4('0xf')]['goal']=function(_0x29ac70){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x116'),_0x29ac70['label']));this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x29ac70,_0x29ac70['goalname']);return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x117'),_0x29ac70[_0x20f4('0x118')]));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x119')]=function(_0xb667f8){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x11a'),_0xb667f8[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0xb667f8[_0x20f4('0x86')])||!this[_0x20f4('0x83')](_0xb667f8[_0x20f4('0x87')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x20f4('0x83')](_0xb667f8[_0x20f4('0x5b')])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xa2'));}this['channel']['noop'](util[_0x20f4('0x27')](_0x20f4('0x11b'),_0xb667f8[_0x20f4('0x5b')]));var _0x4cf2e9=this[_0x20f4('0x85')][_0x20f4('0x6c')](this,_0xb667f8);if(_0x4cf2e9){this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0x11c'),_0x4cf2e9));var _0x493995=this[_0x20f4('0xc')]['streamFile'](_0x4cf2e9);try{fs[_0x20f4('0x11d')](_0x4cf2e9+'.wav');}catch(_0x562f05){logger[_0x20f4('0x2a')](_0x562f05);}return _0x493995;}return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0xb667f8,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x20f4('0x11e')]=function(_0xf499fa){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x11f'),_0xf499fa['label']));if(!this['isConfigured'](_0xf499fa[_0x20f4('0x86')])||!this[_0x20f4('0x83')](_0xf499fa['aws_secret_access_key'])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0x120'));}if(!this[_0x20f4('0x83')](_0xf499fa[_0x20f4('0x121')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x122'));}if(!this[_0x20f4('0x83')](_0xf499fa[_0x20f4('0x5b')])){return this[_0x20f4('0xc')]['noop']('no\x20text\x20configured');}this[_0x20f4('0xc')][_0x20f4('0xdd')]=!![];this[_0x20f4('0xd0')](_0xf499fa);this[_0x20f4('0x3e')](_0xf499fa['text'],'in','','');this['channel'][_0x20f4('0xa4')](util['format'](_0x20f4('0x123'),_0xf499fa[_0x20f4('0x5b')]));var _0xeecfc2=this[_0x20f4('0x89')][_0x20f4('0x6c')](this,_0xf499fa);if(_0xeecfc2){for(var _0x258b05 in _0xeecfc2){if(_0xeecfc2[_0x20f4('0x90')](_0x258b05)&&_[_0x20f4('0x91')](_0xeecfc2[_0x258b05])){this[_0x20f4('0xc')][_0x20f4('0x9a')](util[_0x20f4('0x27')](_0x20f4('0x124'),_0x258b05[_0x20f4('0x65')]()),_0xeecfc2[_0x258b05]);}}if(_[_0x20f4('0x44')](_0xeecfc2[_0x20f4('0x73')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x125'));}else{this[_0x20f4('0x3e')](_0xeecfc2[_0x20f4('0x73')],'out',_0x20f4('0x126'),'');return this['channel'][_0x20f4('0xa4')](util['format'](_0x20f4('0x127'),_0xeecfc2['message']));}}return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0xf499fa,_0x20f4('0x128'));};AGIVertices[_0x20f4('0xf')]['googleasr']=function(_0x396f47){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x396f47[_0x20f4('0xa1')],_0x396f47['timeout']));if(!this[_0x20f4('0x83')](_0x396f47['key'])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0x129'));}var _0x4918b0='wav';var _0x341d8f=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xd29e6e=util[_0x20f4('0x27')](_0x20f4('0x99'),_0x341d8f,_0x4918b0);var _0xf43409=!![];if(_0x396f47[_0x20f4('0x12a')]===_0x20f4('0x12b')){_0xf43409=![];}var _0x4ce4b3=this[_0x20f4('0xc')][_0x20f4('0x12c')](_0x341d8f,_0x4918b0,_0x396f47[_0x20f4('0x12d')],_0x396f47[_0x20f4('0x63')],undefined,_0xf43409);if(_0x4ce4b3[_0x20f4('0xab')]!==-0x1){this[_0x20f4('0xc')]['noop'](util['format'](_0x20f4('0x12e'),_0xd29e6e));var _0xbcc53e=this['googleASR'][_0x20f4('0x6c')](this,_0x396f47,_0xd29e6e);if(_0xbcc53e){for(var _0xa1eb7d in _0xbcc53e){if(_0xbcc53e[_0x20f4('0x90')](_0xa1eb7d)){this[_0x20f4('0xc')][_0x20f4('0x9a')](util['format'](_0x20f4('0x12f'),_0xa1eb7d[_0x20f4('0x65')]()),_0xbcc53e[_0xa1eb7d]);}}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('GoogleASR\x20Result\x20%s',JSON[_0x20f4('0x6f')](_0xbcc53e)));}}return _0x4ce4b3;};AGIVertices[_0x20f4('0xf')][_0x20f4('0x130')]=function(_0x165c02){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x131'),_0x165c02['label']));if(!this[_0x20f4('0x83')](_0x165c02[_0x20f4('0x8c')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x132'));}if(!this[_0x20f4('0x83')](_0x165c02['appsecret'])){return this['channel']['noop'](_0x20f4('0x133'));}var _0x8fe829=_0x20f4('0x134');var _0x2750f7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x20f4('0x111')](0x4));var _0x3b4adc=util[_0x20f4('0x27')](_0x20f4('0x99'),_0x2750f7,_0x8fe829);var _0x55ffde=!![];if(_0x165c02[_0x20f4('0x12a')]===_0x20f4('0x12b')){_0x55ffde=![];}var _0x4d7df2=this['channel'][_0x20f4('0x12c')](_0x2750f7,_0x8fe829,_0x165c02[_0x20f4('0x12d')],_0x165c02[_0x20f4('0x63')],undefined,_0x55ffde);if(_0x4d7df2[_0x20f4('0xab')]!==-0x1){this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('tilde\x20%s\x20file\x20created',_0x3b4adc));var _0x269c79=this[_0x20f4('0x8b')]['sync'](this,_0x165c02,_0x3b4adc);if(_0x269c79){for(var _0x72d55a in _0x269c79){if(_0x269c79[_0x20f4('0x90')](_0x72d55a)){this[_0x20f4('0xc')]['setVariable'](util[_0x20f4('0x27')]('TILDE_ASR_%s',_0x72d55a[_0x20f4('0x65')]()),_0x269c79[_0x72d55a]);}}return this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x135'),JSON[_0x20f4('0x6f')](_0x269c79)));}}return _0x4d7df2;};AGIVertices[_0x20f4('0xf')][_0x20f4('0x136')]=function(_0x9c0e4a){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x137'),_0x9c0e4a[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0x138')](_0x9c0e4a[_0x20f4('0x3a')],_0x9c0e4a[_0x20f4('0x139')],_0x9c0e4a[_0x20f4('0x13a')]);};AGIVertices[_0x20f4('0xf')][_0x20f4('0x13b')]=function(_0xa4cb67){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x13c'),_0xa4cb67[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0xa4cb67[_0x20f4('0x13d')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0xa4cb67,_0x20f4('0x13e'));}try{var _0x13f884=eval(_0xa4cb67[_0x20f4('0x13d')])?_0x20f4('0x13f'):_0x20f4('0x140');this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x141'),_0xa4cb67['condition'],_0x13f884));return{'code':0xc8,'result':_0x13f884};}catch(_0x36b1ec){return{'code':0xc8,'result':_0x20f4('0x140')};}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x142')]=function(_0x195cd4){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x143'),_0x195cd4[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x195cd4['interval_id'])){return this['channel'][_0x20f4('0x2a')](_0x195cd4,_0x20f4('0x144'));}var _0x71cb53=this[_0x20f4('0x22')][_0x20f4('0x6c')](this,_0x195cd4[_0x20f4('0x145')]);if(!_0x71cb53){return this['channel'][_0x20f4('0x2a')](_0x195cd4,_0x20f4('0x146'));}for(var _0x1daa90=0x0;_0x1daa90<_0x71cb53[_0x20f4('0x97')];_0x1daa90+=0x1){var _0x1f06bc=this[_0x20f4('0xc')][_0x20f4('0x10f')](util['format'](_0x20f4('0x147'),_0x71cb53[_0x1daa90]));if(_0x1f06bc['result']===-0x1){return _0x1f06bc;}logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x148'),_0x71cb53[_0x1daa90],_0x1f06bc[_0x20f4('0x9d')]));if(_0x1f06bc[_0x20f4('0x9d')]===_0x20f4('0x13f')){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x148'),_0x71cb53[_0x1daa90],_0x20f4('0x13f')));this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x148'),_0x71cb53[_0x1daa90],_0x20f4('0x13f')));return{'code':0xc8,'result':_0x20f4('0x13f')};}else{logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x71cb53[_0x1daa90],_0x20f4('0x140')));this[_0x20f4('0xc')]['noop'](util['format'](_0x20f4('0x148'),_0x71cb53[_0x1daa90],_0x20f4('0x140')));}}return{'code':0xc8,'result':_0x20f4('0x140')};};AGIVertices['prototype'][_0x20f4('0x149')]=function(_0x10314a){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x14a'),_0x10314a[_0x20f4('0xa1')]));return this['channel'][_0x20f4('0x149')]();};AGIVertices[_0x20f4('0xf')]['ispeechasr']=function(_0xd29d28){logger[_0x20f4('0x2c')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xd29d28[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0xd29d28[_0x20f4('0x76')])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0x129'));}var _0x40b142=_0x20f4('0x134');var _0x4993fb=util[_0x20f4('0x27')](_0x20f4('0x14b'),FILES_PATH,rs['generate'](0x4));var _0x38275d=util[_0x20f4('0x27')](_0x20f4('0x99'),_0x4993fb,_0x40b142);var _0x2c41cd=!![];if(_0xd29d28[_0x20f4('0x12a')]===_0x20f4('0x12b')){_0x2c41cd=![];}var _0x1c3185=this['channel']['recordFile'](_0x4993fb,_0x40b142,_0xd29d28[_0x20f4('0x12d')],_0xd29d28[_0x20f4('0x63')],undefined,_0x2c41cd);if(_0x1c3185[_0x20f4('0xab')]!==-0x1){this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format'](_0x20f4('0x14c'),_0x38275d));var _0x337b06=this[_0x20f4('0x80')][_0x20f4('0x6c')](this,_0xd29d28,_0x38275d);if(_0x337b06){for(var _0x20126a in _0x337b06){if(_0x337b06[_0x20f4('0x90')](_0x20126a)){this['channel'][_0x20f4('0x9a')](util[_0x20f4('0x27')](_0x20f4('0x14d'),_0x20126a[_0x20f4('0x65')]()),_0x337b06[_0x20126a]);}}return this['channel'][_0x20f4('0xa4')](util['format'](_0x20f4('0x14e'),JSON[_0x20f4('0x6f')](_0x337b06)));}}return _0x1c3185;};AGIVertices['prototype']['ispeechtts']=function(_0x58386f){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x14f'),_0x58386f['label']));if(!this[_0x20f4('0x83')](_0x58386f[_0x20f4('0x76')])){return this['channel']['noop'](_0x20f4('0x129'));}if(!this['isConfigured'](_0x58386f[_0x20f4('0x5b')])){return this['channel'][_0x20f4('0xa4')]('no\x20text\x20configured');}this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x58386f[_0x20f4('0x5b')]));var _0x5ae808=this[_0x20f4('0x7e')]['sync'](this,_0x58386f);if(_0x5ae808){this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x14c'),_0x5ae808));var _0x792b50=this['channel'][_0x20f4('0xf8')](_0x5ae808,_0x58386f['intKey']);try{fs[_0x20f4('0x11d')](_0x5ae808+_0x20f4('0xf9'));}catch(_0x54bfc3){logger[_0x20f4('0x2a')](_0x54bfc3);}return _0x792b50;}return this['channel'][_0x20f4('0x2a')](_0x58386f,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x20f4('0xf')]['login']=function(_0x1dd963){logger[_0x20f4('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1dd963[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x1dd963['findBy'])){return this['channel'][_0x20f4('0x2a')](_0x1dd963,_0x20f4('0x150'));}logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x151'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x1dd963['findBy']));var _0x45ac9a=this[_0x20f4('0x51')][_0x20f4('0x6c')](this,_0x1dd963[_0x20f4('0x152')]);if(_0x45ac9a){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x153'),this[_0x20f4('0xc')]['callerid'],_0x1dd963[_0x20f4('0x152')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x153'),this['channel']['callerid'],_0x1dd963[_0x20f4('0x152')]));return{'code':0xc8,'result':_0x20f4('0x154')};}else{logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x20f4('0xc')]['callerid'],_0x1dd963[_0x20f4('0x152')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x1dd963['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x155')]=function(_0x297c9f){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x156'),_0x297c9f['label']));if(!this[_0x20f4('0x83')](_0x297c9f[_0x20f4('0x152')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x297c9f,_0x20f4('0x150'));}logger['info'](util[_0x20f4('0x27')](_0x20f4('0x151'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x297c9f[_0x20f4('0x152')]));var _0x305dab=this['agentLogout'][_0x20f4('0x6c')](this,_0x297c9f[_0x20f4('0x152')]);if(_0x305dab){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x153'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x297c9f[_0x20f4('0x152')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x20f4('0xc')]['callerid'],_0x297c9f[_0x20f4('0x152')]));return{'code':0xc8,'result':_0x20f4('0x154')};}else{logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x157'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x297c9f[_0x20f4('0x152')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format'](_0x20f4('0x157'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x297c9f[_0x20f4('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x158')]=function(_0x11324a){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x159'),_0x11324a[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x11324a[_0x20f4('0x15a')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x11324a,'no\x20operation\x20configured');}this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x15b'),_0x11324a[_0x20f4('0x15a')]));var _0x19b94e=eval(_0x11324a[_0x20f4('0x15a')]);if(!this['isConfigured'](_0x11324a[_0x20f4('0xd2')])){return this['channel'][_0x20f4('0xa4')](_0x20f4('0xd1'));}var _0xd7168d=this[_0x20f4('0x10f')]['sync'](this,_0x11324a[_0x20f4('0xd2')]);if(!_0xd7168d){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x11324a,_0x20f4('0x15c'));}if(_[_0x20f4('0x96')](_0x19b94e)){var _0xf44c26=this;_0x19b94e[_0x20f4('0xd3')](function(_0x37584e,_0x2aa473){_0xf44c26['channel']['setVariable'](util['format'](_0x20f4('0x15d'),_0xd7168d,_0x2aa473),_0x37584e);});return this[_0x20f4('0xc')]['noop'](util['format'](_0x20f4('0x15e'),_0xd7168d));}else{return this[_0x20f4('0xc')][_0x20f4('0x9a')](_0xd7168d,_0x19b94e);}};AGIVertices['prototype'][_0x20f4('0xb')]=function(_0x1dc2fc){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1dc2fc[_0x20f4('0xa1')]));if(_0x1dc2fc[_0x20f4('0x15f')]===0x0){return this['maxRetry'](_0x1dc2fc);}_0x1dc2fc[_0x20f4('0x15f')]-=0x1;if(!this[_0x20f4('0x83')](_0x1dc2fc['file_id'])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1dc2fc,_0x20f4('0x109'));}var _0x5b6f8e=this[_0x20f4('0x1c')][_0x20f4('0x6c')](this,_0x1dc2fc[_0x20f4('0x108')]);if(!_0x5b6f8e){return this['channel'][_0x20f4('0x2a')](_0x1dc2fc,'no\x20file\x20audio\x20found');}var _0x2c5456=this['channel'][_0x20f4('0x160')](_0x5b6f8e,_0x1dc2fc[_0x20f4('0x10b')],_0x1dc2fc[_0x20f4('0x161')]);var _0xc19e48=_0x2c5456[_0x20f4('0xab')];if(_0x2c5456[_0x20f4('0xab')]===-0x1){this['createSquareDetailsReport'][_0x20f4('0x6c')](this,_0x1dc2fc,'-1');return _0x2c5456;}else if(_0x2c5456[_0x20f4('0x9d')]===_0x20f4('0x63')){_0x2c5456[_0x20f4('0xab')]=_0x2c5456[_0x20f4('0xab')]['length']>0x0?_0x2c5456[_0x20f4('0xab')]:'t';}else if(_['isEmpty'](_0x2c5456[_0x20f4('0xab')])){_0x2c5456['result']='#';_0xc19e48='#';}if(!this[_0x20f4('0x83')](_0x1dc2fc[_0x20f4('0xd2')])){this['channel'][_0x20f4('0xa4')](_0x20f4('0xd1'));}else{var _0x5d1f18=this['getVariable'][_0x20f4('0x6c')](this,_0x1dc2fc['variable_id']);if(!_0x5d1f18){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1dc2fc,_0x20f4('0x15c'));}this[_0x20f4('0xc')]['setVariable'](_0x5d1f18,_0xc19e48);}this[_0x20f4('0xd0')]['sync'](this,_0x1dc2fc,_0xc19e48);return _0x2c5456;};AGIVertices['prototype'][_0x20f4('0xa4')]=function(_0x13681c){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x162'),_0x13681c[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x13681c['output']||_0x13681c[_0x20f4('0xa1')]);};AGIVertices['prototype'][_0x20f4('0x163')]=function(_0x3aef0b){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x164'),_0x3aef0b[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x3aef0b[_0x20f4('0x152')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x3aef0b,_0x20f4('0x150'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x20f4('0x4e')],_0x3aef0b[_0x20f4('0x152')]));var _0xa694=this['getPause'][_0x20f4('0x6c')](this,_0x3aef0b[_0x20f4('0x165')]);var _0x3b8d0a=this['agentPause'][_0x20f4('0x6c')](this,_0x3aef0b[_0x20f4('0x152')],_0xa694);if(_0x3b8d0a){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x153'),this['channel']['callerid'],_0x3aef0b[_0x20f4('0x152')]));this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0x153'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x3aef0b[_0x20f4('0x152')]));return{'code':0xc8,'result':_0x20f4('0x154')};}else{logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x157'),this['channel'][_0x20f4('0x4e')],_0x3aef0b[_0x20f4('0x152')]));this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x153'),this['channel'][_0x20f4('0x4e')],_0x3aef0b[_0x20f4('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x166')]=function(_0x1e94fa){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x167'),_0x1e94fa[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x1e94fa[_0x20f4('0x108')])){return this['channel'][_0x20f4('0x2a')](_0x1e94fa,'no\x20file\x20audio\x20selected');}var _0xe0b000=this[_0x20f4('0x1c')][_0x20f4('0x6c')](this,_0x1e94fa[_0x20f4('0x108')]);if(!_0xe0b000){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1e94fa,_0x20f4('0x10a'));}var _0x1b752f=this[_0x20f4('0xc')][_0x20f4('0x55')]('PLAYBACK',[_0xe0b000,_0x1e94fa[_0x20f4('0x103')]]);if(_0x1b752f[_0x20f4('0xab')]===-0x1){return _0x1b752f;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format'](_0x20f4('0xbb'),'PLAYBACK',_0xe0b000));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x168')]=function(_0x2f30e8){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x169'),_0x2f30e8[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x2f30e8[_0x20f4('0x16a')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x2f30e8,_0x20f4('0x16b'));}var _0x38dacb='';var _0x179f77=parseInt(_0x2f30e8['queue_id'],0xa);if(isNaN(_0x179f77)){_0x38dacb=_0x2f30e8[_0x20f4('0x16a')];}else{_0x38dacb=this[_0x20f4('0x13')][_0x20f4('0x6c')](this,_0x2f30e8[_0x20f4('0x16a')]);if(!_0x38dacb){return this['channel'][_0x20f4('0x2a')](_0x2f30e8,_0x20f4('0x16c'));}}var _0x64cc89='';if(this['isConfigured'](_0x2f30e8['file_id'])){var _0x3dff48=this['getSound']['sync'](this,_0x2f30e8[_0x20f4('0x108')]);if(_0x3dff48){_0x64cc89=_0x3dff48;}}this['createSquareDetailsReport']['sync'](this,_0x2f30e8,_0x38dacb);if(_0x2f30e8['opts'][_0x20f4('0x16d')]('x')<0x0){_0x2f30e8['opts']+='x';}if(_0x2f30e8[_0x20f4('0x103')][_0x20f4('0x16d')]('X')<0x0){_0x2f30e8[_0x20f4('0x103')]+='X';}this[_0x20f4('0xc')][_0x20f4('0x9a')]('XMCS-QUEUE',_0x38dacb?_0x38dacb[_0x20f4('0x16e')]():'');var _0x4d86a8=this[_0x20f4('0xc')][_0x20f4('0x55')]('QUEUE',[_0x38dacb,_0x2f30e8[_0x20f4('0x103')],_0x2f30e8['url'],_0x64cc89,_0x2f30e8['timeout'],_0x2f30e8[_0x20f4('0x6')],_0x2f30e8['macro'],_0x2f30e8[_0x20f4('0x16f')],'',_0x2f30e8['position']]);if(_0x4d86a8[_0x20f4('0xab')]===-0x1){return _0x4d86a8;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xbb'),_0x20f4('0x170'),_0x38dacb));};AGIVertices[_0x20f4('0xf')]['record']=function(_0x4c8781){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x171'),_0x4c8781['label']));var _0x596bf4=_0x4c8781['recordingFormat']||_0x20f4('0x134');var _0x2cbfe6=util[_0x20f4('0x27')](_0x20f4('0x172'),this['channel'][_0x20f4('0x35')],rs[_0x20f4('0x111')](0x5));var _0x3547b3=util[_0x20f4('0x27')](_0x20f4('0x173'),FILES_PATH,_0x2cbfe6,_0x596bf4);var _0x198d72=util[_0x20f4('0x27')]('%s/recordings/%s',FILES_PATH,_0x2cbfe6);this[_0x20f4('0x38')][_0x20f4('0x6c')](this,_0x4c8781,_0x2cbfe6,_0x3547b3);this['channel'][_0x20f4('0x9a')](_0x20f4('0x174'),_0x2cbfe6);logger[_0x20f4('0x2c')](_0x20f4('0x175'),_0x198d72,_0x596bf4,_0x4c8781[_0x20f4('0x176')],_0x4c8781[_0x20f4('0x63')]);return this['channel'][_0x20f4('0x12c')](_0x198d72,_0x596bf4,_0x4c8781[_0x20f4('0x176')],_0x4c8781[_0x20f4('0x63')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x1c1e45){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x177'),_0x1c1e45[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x1c1e45[_0x20f4('0x62')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x178'));}var _0x2661f0=this[_0x20f4('0x61')][_0x20f4('0x6c')](this,_0x1c1e45);logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x179'),util[_0x20f4('0x17a')](_0x2661f0,{'showHidden':![],'depth':null})));if(!this[_0x20f4('0x83')](_0x1c1e45['variable_id'])){return this[_0x20f4('0xc')]['noop'](_0x20f4('0x17b'));}var _0xa1d114=this[_0x20f4('0x10f')]['sync'](this,_0x1c1e45['variable_id']);if(!_0xa1d114){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1c1e45,_0x20f4('0x15c'));}this[_0x20f4('0xc')][_0x20f4('0x9a')](util[_0x20f4('0x27')](_0x20f4('0x17c'),_0xa1d114),_0x2661f0[_0x20f4('0x71')]?_0x2661f0[_0x20f4('0x71')]:_0x20f4('0x17d'));this[_0x20f4('0xc')][_0x20f4('0x9a')](util['format']('%s_STATUS_MESSAGE',_0xa1d114),_0x2661f0[_0x20f4('0x72')]?_0x2661f0[_0x20f4('0x72')]:'OK');if(_0x2661f0[_0x20f4('0x66')]){try{this['saveRestApiResult'](_0x2661f0['body'],_0xa1d114);}catch(_0x3c5a70){logger[_0x20f4('0x2a')](util[_0x20f4('0x27')](_0x20f4('0x17e'),_0xa1d114));}}return this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')]('variable\x20%s\x20set',_0xa1d114));};AGIVertices['prototype'][_0x20f4('0x17f')]=function(_0xce6572){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x180'),_0xce6572['label']));return this[_0x20f4('0xc')][_0x20f4('0x181')](_0xce6572[_0x20f4('0x182')][_0x20f4('0x57')](/\s+/g,''),_0xce6572['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x4a27fa){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x183'),_0x4a27fa['label']));return this[_0x20f4('0xc')][_0x20f4('0x184')](_0x4a27fa[_0x20f4('0x185')][_0x20f4('0x57')](/\s+/g,''),_0x4a27fa[_0x20f4('0x176')]);};AGIVertices[_0x20f4('0xf')]['sayphonetic']=function(_0x43a98b){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x186'),_0x43a98b[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0x187')](_0x43a98b[_0x20f4('0x5b')],_0x43a98b[_0x20f4('0x176')]);};AGIVertices[_0x20f4('0xf')]['sendMail']=function(_0x1557e8){logger['info'](util[_0x20f4('0x27')](_0x20f4('0x188'),_0x1557e8[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x1557e8[_0x20f4('0x189')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x18a'));}var _0x406c15=this[_0x20f4('0x20')][_0x20f4('0x6c')](this,_0x1557e8[_0x20f4('0x189')]);if(!_0x406c15||!_0x406c15['Smtp']){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1557e8,_0x20f4('0x18b'));}var _0x5e6474={'from':util['format'](_0x20f4('0x18c'),_0x406c15['name'],_0x406c15[_0x20f4('0x18d')]||_0x406c15[_0x20f4('0x18e')][_0x20f4('0x18f')]),'to':_0x1557e8['to']||'','cc':_0x1557e8['cc']||'','bcc':_0x1557e8[_0x20f4('0x190')]||'','subject':_0x1557e8[_0x20f4('0x191')],'html':_0x1557e8['text'],'text':_0x1557e8[_0x20f4('0x5b')]};if(this[_0x20f4('0x83')](_0x1557e8['template_id'])){}logger[_0x20f4('0xd6')](_0x20f4('0x192'),JSON[_0x20f4('0x6f')](_0x5e6474));this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x1557e8,_0x1557e8[_0x20f4('0x189')]);this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0x193'),_0x406c15[_0x20f4('0x15')]));this[_0x20f4('0x21')][_0x20f4('0x6c')](this,_0x406c15[_0x20f4('0x194')],_0x5e6474);return this['channel']['noop'](_0x20f4('0x195'));};AGIVertices['prototype']['sendFax']=function(_0x23bf80){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x196'),_0x23bf80[_0x20f4('0xa1')]));return this[_0x20f4('0xc')][_0x20f4('0xa4')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x498083){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x197'),_0x498083[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x498083[_0x20f4('0x198')])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x199'));}var _0x2ef62f=this['getSmsAccount'][_0x20f4('0x6c')](this,_0x498083['sms_account_id']);if(!_0x2ef62f){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x498083,_0x20f4('0x19a'));}var _0x1cee95={'body':_0x498083[_0x20f4('0x19b')],'phone':_0x498083['to']||'','SmsAccountId':_0x2ef62f['id']};logger['debug'](_0x20f4('0x19c'),JSON['stringify'](_0x1cee95));this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x498083,_0x498083[_0x20f4('0x198')]);this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x19d'),_0x2ef62f[_0x20f4('0x15')]));this[_0x20f4('0x34')][_0x20f4('0x6c')](this,_0x1cee95);return this[_0x20f4('0xc')]['noop'](_0x20f4('0x19e'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x19f')]=function(_0x5f1714){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5f1714[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x5f1714[_0x20f4('0xd2')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x5f1714,_0x20f4('0x1a0'));}var _0x29b735=this[_0x20f4('0x10f')][_0x20f4('0x6c')](this,_0x5f1714[_0x20f4('0xd2')]);if(!_0x29b735){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x5f1714,'no\x20variable\x20found');}return this['channel']['setVariable'](_0x29b735,_0x5f1714[_0x20f4('0x1a1')]);};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1a2')]=function(_0x16fc60){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x1a3'),_0x16fc60[_0x20f4('0xa1')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x1a4'));if(_0x16fc60[_0x20f4('0xb0')]==='yes'){this[_0x20f4('0xc')][_0x20f4('0xa4')]('Answer');return this[_0x20f4('0xc')][_0x20f4('0xb0')]();}return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0x1a5'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1a6')]=function(_0x18ba4f){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x1a7'),_0x18ba4f[_0x20f4('0xa1')]));if(!this[_0x20f4('0x83')](_0x18ba4f[_0x20f4('0x1a8')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x18ba4f,_0x20f4('0x1a9'));}var _0x48eafa=this[_0x20f4('0x16')]['sync'](this,_0x18ba4f[_0x20f4('0x1a8')]);if(!this[_0x20f4('0x83')](_0x48eafa)){return this[_0x20f4('0xc')]['error'](_0x18ba4f,util[_0x20f4('0x27')](_0x20f4('0x1aa'),_0x18ba4f['project_id']));}if(_0x48eafa===this[_0x20f4('0xc')]['arg_1']){return this[_0x20f4('0xc')]['error'](_0x18ba4f,_0x20f4('0x1ab'));}this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x18ba4f,_0x48eafa);var _0x15a20a=this[_0x20f4('0xc')][_0x20f4('0x55')]('AGI',util[_0x20f4('0x27')](_0x20f4('0x1ac'),config['agi']['host']||_0x20f4('0x1ad'),_0x48eafa,this[_0x20f4('0xc')]['arg_1']));if(_0x15a20a[_0x20f4('0xab')]===-0x1){return _0x15a20a;}return this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')]('Executed\x20command\x20%s\x20%s','AGI',_0x48eafa));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1ae')]=function(_0x25c12c){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x1af'),_0x25c12c[_0x20f4('0xa1')]));var _0x241149=this[_0x20f4('0x54')][_0x20f4('0x6c')](this,_0x25c12c[_0x20f4('0x1b0')]);this[_0x20f4('0xd0')][_0x20f4('0x6c')](this,_0x25c12c,_0x25c12c[_0x20f4('0x1b0')]);if(this[_0x20f4('0x83')](_0x25c12c['variable_id'])){var _0x44576d=this['getVariable'][_0x20f4('0x6c')](this,_0x25c12c[_0x20f4('0xd2')]);if(_0x44576d){this[_0x20f4('0xc')]['setVariable'](_0x44576d,_0x241149);return this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')](_0x20f4('0x1b1'),_0x25c12c[_0x20f4('0x1b0')],_0x44576d));}}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x25c12c[_0x20f4('0x1b0')]));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1b2')]=function(_0x1240c5){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x1b3'),_0x1240c5[_0x20f4('0xa1')]));_0x1240c5[_0x20f4('0x5b')]=_0x1240c5[_0x20f4('0x5b')][_0x20f4('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20f4('0x83')](_0x1240c5['apiKey'])){return this[_0x20f4('0xc')][_0x20f4('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0x20f4('0x83')](_0x1240c5['text'])){return this[_0x20f4('0xc')][_0x20f4('0xa4')](_0x20f4('0xa2'));}this[_0x20f4('0xc')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1240c5[_0x20f4('0x5b')]));var _0x3be621=this[_0x20f4('0x58')][_0x20f4('0x6c')](this,_0x1240c5);if(_0x3be621){this[_0x20f4('0xc')]['noop'](util[_0x20f4('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3be621));var _0x58bcea=this[_0x20f4('0xc')][_0x20f4('0xf8')](_0x3be621);try{fs[_0x20f4('0x11d')](_0x3be621+'.wav');}catch(_0x1f4b15){logger[_0x20f4('0x2a')](_0x1f4b15);}return _0x58bcea;}return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x1240c5,_0x20f4('0x1b4'));};AGIVertices['prototype']['tts']=function(_0x51189f){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x1b5'),_0x51189f[_0x20f4('0xa1')]));_0x51189f[_0x20f4('0x5b')]=_0x51189f[_0x20f4('0x5b')][_0x20f4('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20f4('0x83')](_0x51189f[_0x20f4('0x5b')])){return this['channel']['noop'](_0x20f4('0xa2'));}this['channel'][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x1b6'),_0x51189f[_0x20f4('0x5b')]));var _0x4a7736=this[_0x20f4('0x5f')][_0x20f4('0x6c')](this,_0x51189f);if(_0x4a7736){this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0x1b7'),_0x4a7736));var _0x554975=this[_0x20f4('0xc')][_0x20f4('0xf8')](_0x4a7736);try{fs[_0x20f4('0x11d')](_0x4a7736+'.wav');}catch(_0x33f048){logger['error'](_0x33f048);}return _0x554975;}return this['channel'][_0x20f4('0x2a')](_0x51189f,_0x20f4('0x1b8'));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1b9')]=function(_0x310964){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x1ba'),_0x310964[_0x20f4('0xa1')]));if(!this['isConfigured'](_0x310964['findBy'])){return this['channel'][_0x20f4('0x2a')](_0x310964,_0x20f4('0x150'));}logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x151'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x310964[_0x20f4('0x152')]));var _0x163325=this[_0x20f4('0x4f')][_0x20f4('0x6c')](this,_0x310964[_0x20f4('0x152')]);if(_0x163325){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x153'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x310964[_0x20f4('0x152')]));this['channel'][_0x20f4('0xa4')](util['format'](_0x20f4('0x153'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x310964[_0x20f4('0x152')]));return{'code':0xc8,'result':_0x20f4('0x154')};}else{logger[_0x20f4('0x2c')](util[_0x20f4('0x27')](_0x20f4('0x157'),this[_0x20f4('0xc')][_0x20f4('0x4e')],_0x310964[_0x20f4('0x152')]));this[_0x20f4('0xc')][_0x20f4('0xa4')](util['format'](_0x20f4('0x157'),this[_0x20f4('0xc')]['callerid'],_0x310964[_0x20f4('0x152')]));return{'code':0xc8,'result':_0x20f4('0x1bb')};}};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1bc')]=function(_0x4e4dc7){logger[_0x20f4('0x2c')](util['format'](_0x20f4('0x1bd'),_0x4e4dc7[_0x20f4('0xa1')]));var _0x357c69=this[_0x20f4('0xc')][_0x20f4('0x55')](_0x20f4('0x1be'),[_0x4e4dc7[_0x20f4('0x1bf')],_0x4e4dc7[_0x20f4('0x74')]]);if(_0x357c69[_0x20f4('0xab')]===-0x1){return _0x357c69;}return this[_0x20f4('0xc')][_0x20f4('0xa4')](util[_0x20f4('0x27')](_0x20f4('0xbb'),_0x20f4('0x1be'),_0x4e4dc7[_0x20f4('0x1bf')]));};AGIVertices[_0x20f4('0xf')][_0x20f4('0x1c0')]=function(_0x4611fe){logger[_0x20f4('0x2c')](util[_0x20f4('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4611fe['label']));if(!this[_0x20f4('0x83')](_0x4611fe[_0x20f4('0xd2')])){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x4611fe,_0x20f4('0x1a0'));}var _0x3b890c=this[_0x20f4('0x10f')][_0x20f4('0x6c')](this,_0x4611fe[_0x20f4('0xd2')]);if(!_0x3b890c){return this[_0x20f4('0xc')][_0x20f4('0x2a')](_0x4611fe,_0x20f4('0x15c'));}var _0xb35b4a=this[_0x20f4('0xc')][_0x20f4('0x10f')](_0x3b890c);return{'code':0xc8,'result':_0xb35b4a[_0x20f4('0x9d')]?_0xb35b4a['extra']:'-'};};String['prototype'][_0x20f4('0x9c')]=function(_0x1a30cf,_0x16218c){return this[_0x20f4('0x9b')](_0x1a30cf)[_0x20f4('0x1c1')](_0x16218c);};module['exports']=AGIVertices; \ No newline at end of file +var _0x39cb=['catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccountById','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','arg_1','file','createSquareMessage','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','replaceAllVariables','saveRestApiResult','%s.%s','length','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','createCmContact','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','condition','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','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','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','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','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','lodash','shelljs','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','getVariable','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xb39c('0x0'));var sh=require(_0xb39c('0x1'));var odbc=require('odbc')();var rs=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var Mustache=require('mustache');var rp=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var shared=require(_0xb39c('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xb39c('0x9');var recursiveMapAttributes=[_0xb39c('0xa'),_0xb39c('0xb')];var verticesWithRetry=[_0xb39c('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x41557b,_0x7aa397,_0x3ffb94){this[_0xb39c('0xd')]=_0x41557b;this['rpc']=_0x7aa397;this['mailRpc']=_0x3ffb94;};AGIVertices['prototype'][_0xb39c('0xe')]=function(_0x497ffc,_0xaa6a32){this[_0xb39c('0xf')][_0xb39c('0x10')](_0x497ffc)[_0xb39c('0x11')](function(_0x2a5c79){_0xaa6a32(null,_0x2a5c79?_0x2a5c79[_0xb39c('0x12')]:![]);})['catch'](function(_0x31e07e){_0xaa6a32(_0x31e07e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x14')]=function(_0x5e4caf,_0xf4662a){this[_0xb39c('0xf')][_0xb39c('0x15')](_0x5e4caf)[_0xb39c('0x11')](function(_0x469fa9){_0xf4662a(null,_0x469fa9?_0x469fa9[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x5277ce){_0xf4662a(_0x5277ce);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x17')]=function(_0x10989d,_0x1c2c5f){this[_0xb39c('0xf')][_0xb39c('0x18')](_0x10989d)[_0xb39c('0x11')](function(_0x4e02cf){_0x1c2c5f(null,_0x4e02cf?_0x4e02cf[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x559ad6){_0x1c2c5f(_0x559ad6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x19')]=function(_0x28bbe1,_0x447352){this['rpc'][_0xb39c('0x1a')](_0x28bbe1)[_0xb39c('0x11')](function(_0x5e4a0b){_0x447352(null,_0x5e4a0b?_0x5e4a0b[_0xb39c('0x1b')]:![]);})[_0xb39c('0x16')](function(_0x1d3e2d){_0x447352(_0x1d3e2d);});};AGIVertices['prototype']['getUser']=function(_0x2789fd,_0x1a5b9d){this[_0xb39c('0xf')]['getUserById'](_0x2789fd)[_0xb39c('0x11')](function(_0x438207){_0x1a5b9d(null,_0x438207?_0x438207[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x3b03ed){_0x1a5b9d(_0x3b03ed);});};AGIVertices['prototype'][_0xb39c('0x1c')]=function(_0xbeab7e,_0x583ee5){this[_0xb39c('0xf')][_0xb39c('0x1d')](_0xbeab7e)[_0xb39c('0x11')](function(_0x12be70){_0x583ee5(null,_0x12be70?_0x12be70[_0xb39c('0x12')]:![]);})['catch'](function(_0x23a2f1){_0x583ee5(_0x23a2f1);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1e')]=function(_0x4c06fa,_0x41fff2){var _0x337532=this;this['rpc'][_0xb39c('0x1f')](_0x4c06fa)[_0xb39c('0x11')](function(_0x328db1){_0x41fff2(null,_0x328db1?_0x337532['getSoundPath'](_0x328db1[_0xb39c('0x20')]):![]);})[_0xb39c('0x16')](function(_0x59172f){_0x41fff2(_0x59172f);});};AGIVertices[_0xb39c('0x13')]['getMailAccount']=function(_0x8e2d7,_0x2d2743){this[_0xb39c('0xf')][_0xb39c('0x21')](_0x8e2d7)[_0xb39c('0x11')](function(_0x52e642){_0x2d2743(null,_0x52e642?_0x52e642:![]);})[_0xb39c('0x16')](function(_0x57aa3b){_0x2d2743(_0x57aa3b);});};AGIVertices[_0xb39c('0x13')]['sendMailMessage']=function(_0x5a2cf4,_0xe2111a,_0x3a96b9){this[_0xb39c('0x22')]['sendMailMessage'](_0x5a2cf4,_0xe2111a)['then'](function(){_0x3a96b9(null);})[_0xb39c('0x16')](function(_0x1befe2){_0x3a96b9(_0x1befe2);});};AGIVertices['prototype'][_0xb39c('0x23')]=function(_0x1c04a7,_0x30bdf0){this[_0xb39c('0xf')][_0xb39c('0x24')](_0x1c04a7)[_0xb39c('0x11')](function(_0x41cdd1){if(_0x41cdd1){if(_0x41cdd1[_0xb39c('0x25')]){_0x30bdf0(null,[_0x41cdd1[_0xb39c('0x26')]]);}else{_0x30bdf0(null,_[_0xb39c('0x27')](_0x41cdd1[_0xb39c('0x28')],_0xb39c('0x26')));}}else{_0x30bdf0(null,![]);}})[_0xb39c('0x16')](function(_0x2f6b5a){_0x30bdf0(_0x2f6b5a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x29')]=function(_0x8e5a74){return util[_0xb39c('0x2a')](_0xb39c('0x2b'),FILES_PATH,_0x8e5a74);};AGIVertices['prototype'][_0xb39c('0x2c')]=function(_0x45177f,_0x5ee5a5,_0x56e80a){odbc['open'](_0x45177f,function(_0x22d673){if(_0x22d673){logger[_0xb39c('0x2d')](_0xb39c('0x2e'),_0x22d673);_0x56e80a(_0x22d673);}else{logger['info'](_0xb39c('0x2f'));odbc[_0xb39c('0x30')](_0x5ee5a5,function(_0x44afba,_0x3f5357){if(_0x44afba){logger[_0xb39c('0x31')]('Error\x20executing\x20query\x20%s',_0x5ee5a5);_0x56e80a(_0x44afba);}else{logger[_0xb39c('0x31')](_0xb39c('0x32'),_0x5ee5a5);odbc['close'](function(_0x111909){if(_0x111909){logger['error'](_0xb39c('0x33'),_0x111909);}_0x56e80a(null,_0x3f5357);});}});}});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x34')]=function(_0x4c043a,_0x406fc6){this[_0xb39c('0xf')][_0xb39c('0x35')](_0x4c043a)[_0xb39c('0x11')](function(_0x10b87b){_0x406fc6(null,_0x10b87b?_0x10b87b:![]);})[_0xb39c('0x16')](function(_0x17ed52){_0x406fc6(_0x17ed52);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x36')]=function(_0x263544,_0x38359d){this[_0xb39c('0xf')]['createSmsMessage'](_0x263544)[_0xb39c('0x11')](function(_0xbeb7b3){_0x38359d(null,_0xbeb7b3);})[_0xb39c('0x16')](function(_0x29ea9e){_0x38359d(_0x29ea9e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x37')]=function(_0x1db549,_0x8cb33a,_0xfe51a9){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'node':_0x1db549['label'],'application':_0x1db549['agicommand'],'data':_0x8cb33a||null,'project_name':this[_0xb39c('0xd')]['arg_1'],'callerid':this[_0xb39c('0xd')][_0xb39c('0x39')]})[_0xb39c('0x11')](function(_0x271867){if(_0xfe51a9){_0xfe51a9(null,_0x271867);}})[_0xb39c('0x16')](function(_0x4ffdec){if(_0xfe51a9){_0xfe51a9(_0x4ffdec);}});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x3a')]=function(_0x4d2a47,_0x494e6d,_0x2f2fce,_0x53408c){this['rpc'][_0xb39c('0x3a')]({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'callerid':this[_0xb39c('0xd')][_0xb39c('0x39')],'calleridname':this[_0xb39c('0xd')][_0xb39c('0x3b')],'context':this[_0xb39c('0xd')][_0xb39c('0x3c')],'extension':this[_0xb39c('0xd')]['extension'],'priority':this[_0xb39c('0xd')][_0xb39c('0x3d')],'accountcode':this[_0xb39c('0xd')][_0xb39c('0x3e')],'dnid':this[_0xb39c('0xd')][_0xb39c('0x3f')],'projectName':this[_0xb39c('0xd')][_0xb39c('0x40')],'saveName':_0x494e6d,'filename':_0x4d2a47[_0xb39c('0x41')]||_0x494e6d,'savePath':_0x2f2fce})[_0xb39c('0x11')](function(_0x2150aa){_0x53408c(null,_0x2150aa);})[_0xb39c('0x16')](function(_0x470766){_0x53408c(_0x470766);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x42')]=function(_0x44b825,_0x4ee3fc,_0x283acf,_0x2755f3,_0x1d647c){this[_0xb39c('0xf')][_0xb39c('0x42')]({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'body':_0x44b825,'direction':_0x4ee3fc,'providerName':_0x283acf,'providerResponse':_0x2755f3})[_0xb39c('0x11')](function(_0x4b0917){if(_0x1d647c){_0x1d647c(null,_0x4b0917);}})['catch'](function(_0x32bba9){if(_0x1d647c){_0x1d647c(_0x32bba9);}});};AGIVertices[_0xb39c('0x13')]['createCmContact']=function(_0x4f4f51,_0x226f60){this[_0xb39c('0xf')]['createCmContact']({'firstName':_[_0xb39c('0x43')](_0x4f4f51['name'])||_['isNil'](_0x4f4f51[_0xb39c('0x12')])?'callback_'+Math[_0xb39c('0x44')]():_0x4f4f51[_0xb39c('0x12')],'lastName':_[_0xb39c('0x43')](_0x4f4f51[_0xb39c('0x45')])||_[_0xb39c('0x46')](_0x4f4f51[_0xb39c('0x45')])?null:_0x4f4f51['lastName'],'phone':_0x4f4f51[_0xb39c('0x47')],'ListId':_0x4f4f51[_0xb39c('0x48')],'scheduledat':_0x4f4f51[_0xb39c('0x49')],'callbackUniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'tags':'callback','description':_0xb39c('0x4a')+_0x4f4f51['scheduledAt'][_0xb39c('0x4b')](),'priority':_0x4f4f51[_0xb39c('0x4c')]})[_0xb39c('0x11')](function(_0x9e4e89){_0x226f60(null,_0x9e4e89);})[_0xb39c('0x16')](function(_0x24a2d6){_0x226f60(_0x24a2d6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x4d')]=function(_0x390e68,_0x3c17d1){this[_0xb39c('0xf')][_0xb39c('0x4e')](_0x390e68)[_0xb39c('0x11')](function(_0x33c0c6){_0x3c17d1(null,_0x33c0c6?_0x33c0c6[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0xc7238e){_0x3c17d1(_0xc7238e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x4f')]=function(_0x49f118,_0x57f2f4,_0x1e9893){var _0x15534c={'role':'agent'};_0x15534c[_0x49f118]=this[_0xb39c('0xd')][_0xb39c('0x39')];this['rpc'][_0xb39c('0x4f')](_0x15534c,_0x57f2f4,this[_0xb39c('0xd')][_0xb39c('0x38')])[_0xb39c('0x11')](function(_0x453a21){_0x1e9893(null,_[_0xb39c('0x46')](_0x453a21)?![]:!![]);})['catch'](function(_0x34bcb0){logger[_0xb39c('0x2d')](_0x34bcb0);_0x1e9893(null,![]);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x50')]=function(_0x3fd183,_0x1d0fbf){var _0x53b491={'role':'agent'};_0x53b491[_0x3fd183]=this[_0xb39c('0xd')][_0xb39c('0x39')];this[_0xb39c('0xf')][_0xb39c('0x50')](_0x53b491)[_0xb39c('0x11')](function(_0x4d6968){_0x1d0fbf(null,_['isNil'](_0x4d6968)?![]:!![]);})[_0xb39c('0x16')](function(_0x274707){logger[_0xb39c('0x2d')](_0x274707);_0x1d0fbf(null,![]);});};AGIVertices['prototype'][_0xb39c('0x51')]=function(_0x4836f7,_0x2f3c24){var _0x5ce5fb={'role':_0xb39c('0x52')};_0x5ce5fb[_0x4836f7]=this[_0xb39c('0xd')][_0xb39c('0x39')];this['rpc'][_0xb39c('0x51')](_0x5ce5fb)[_0xb39c('0x11')](function(_0x14b448){_0x2f3c24(null,_[_0xb39c('0x46')](_0x14b448)?![]:!![]);})[_0xb39c('0x16')](function(_0x31f8be){logger[_0xb39c('0x2d')](_0x31f8be);_0x2f3c24(null,![]);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x53')]=function(_0x158ac5,_0x34127d){var _0x227152={'role':_0xb39c('0x52')};_0x227152[_0x158ac5]=this[_0xb39c('0xd')][_0xb39c('0x39')];var _0x31b9c1=_0x158ac5!=_0xb39c('0x54')?util['format'](_0xb39c('0x55'),_0xb39c('0x56'),this[_0xb39c('0xd')]['callerid']):undefined;this[_0xb39c('0xf')]['agentLogin'](_0x227152,_0x31b9c1)['then'](function(_0x8d8f59){_0x34127d(null,_[_0xb39c('0x46')](_0x8d8f59)?![]:!![]);})[_0xb39c('0x16')](function(_0x40bbd5){logger[_0xb39c('0x2d')](_0x40bbd5);_0x34127d(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x26d08c,_0x27723c){sh['exec'](_[_0xb39c('0x57')](_0x26d08c),function(_0x5727b8,_0xc1c51){var _0x32acb6=_0xc1c51[_0xb39c('0x58')](/(\r\n|\n|\r)/gm,'');_0x27723c(null,_0x32acb6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x59')]=function(_0xfe586,_0x5f69ef){scripts[_0xb39c('0x59')](_0xfe586[_0xb39c('0x5a')],_0xfe586[_0xb39c('0x5b')]||_0xb39c('0x5c'),_0xfe586[_0xb39c('0x5c')],_0xfe586[_0xb39c('0x5d')]||'en-US',_0xfe586[_0xb39c('0x5e')]||'MALE',_0xfe586[_0xb39c('0x5f')]||_0xb39c('0x60'))['then'](function(_0x2a19bc){_0x5f69ef(null,_0x2a19bc);})[_0xb39c('0x16')](function(_0x2fe97a){_0x5f69ef(_0x2fe97a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x61')]=function(_0x382640,_0x4869d7){scripts[_0xb39c('0x61')](_0x382640[_0xb39c('0x5c')],_0x382640[_0xb39c('0x62')]||'en',0x1)[_0xb39c('0x11')](function(_0x9a039a){_0x4869d7(null,_0x9a039a);})[_0xb39c('0x16')](function(_0x3f4677){_0x4869d7(_0x3f4677);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x63')]=function(_0x47e986,_0x42c8c1){var _0x20610f={'uri':_0x47e986[_0xb39c('0x64')],'method':_0x47e986[_0xb39c('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x47e986[_0xb39c('0x66')])===_0xb39c('0x67')&&parseInt(_0x47e986[_0xb39c('0x66')])>=0x1?parseInt(_0x47e986['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xb39c('0x68')]([_0xb39c('0x69'),_0xb39c('0x6a')],_0x20610f[_0xb39c('0x65')][_0xb39c('0x6b')]())){try{_0x20610f[_0xb39c('0x6c')]=_0x47e986[_0xb39c('0xb')]?JSON[_0xb39c('0x6d')](_0x47e986['rawBody']):{};}catch(_0x3dc3d8){logger['error'](_0xb39c('0x6e'),_0x3dc3d8);}}try{_0x20610f[_0xb39c('0x6f')]=_0x47e986[_0xb39c('0xa')]?JSON[_0xb39c('0x6d')](_0x47e986[_0xb39c('0xa')]):{};}catch(_0x2287c7){logger[_0xb39c('0x2d')](_0xb39c('0x70'),_0x2287c7);}if(_0x47e986['computedVariables']){try{var _0x21f1d2=require(_0x47e986[_0xb39c('0x71')])[_0xb39c('0x72')](this,_0x20610f);_0x20610f[_0xb39c('0x73')]=Mustache[_0xb39c('0x74')](_0x47e986[_0xb39c('0x64')],_0x21f1d2,{},['$$','$$']);if(_0x20610f[_0xb39c('0x6f')]){_0x20610f[_0xb39c('0x6f')]=JSON[_0xb39c('0x6d')](Mustache[_0xb39c('0x74')](JSON[_0xb39c('0x75')](_0x20610f[_0xb39c('0x6f')]),_0x21f1d2,{},['$$','$$']));}if(_0x20610f[_0xb39c('0x6c')]){_0x20610f[_0xb39c('0x6c')]=JSON[_0xb39c('0x6d')](Mustache[_0xb39c('0x74')](JSON['stringify'](_0x20610f['body']),_0x21f1d2,{},['$$','$$']));}}catch(_0x4519a8){logger[_0xb39c('0x2d')](_0xb39c('0x76'),_0x4519a8);}}rp(_0x20610f)['then'](function(_0x62a6cb){var _0x74411={'statusCode':_0x62a6cb[_0xb39c('0x77')]||0xc8,'statusMessage':_0x62a6cb[_0xb39c('0x78')]||'OK','headers':_0x62a6cb[_0xb39c('0x6f')]||{},'body':_0x62a6cb[_0xb39c('0x6c')]||{}};_0x42c8c1(null,_0x74411);})[_0xb39c('0x16')](function(_0x5adff7){var _0x41d28f={'statusCode':_0x5adff7[_0xb39c('0x77')]||0x1f4,'statusMessage':_0x5adff7['message']||_0xb39c('0x79'),'headers':_0x5adff7['options'][_0xb39c('0x6f')]||{},'body':_0x5adff7[_0xb39c('0x7a')][_0xb39c('0x6c')]||{}};_0x42c8c1(null,_0x41d28f);});};AGIVertices['prototype'][_0xb39c('0x7b')]=function(_0x374086,_0x56b863){scripts[_0xb39c('0x7b')](this[_0xb39c('0xd')][_0xb39c('0x38')],_0x374086[_0xb39c('0x7c')],_0x374086[_0xb39c('0x5c')],_0x374086[_0xb39c('0x7d')]||'en')[_0xb39c('0x11')](function(_0x3b6e39){_0x56b863(null,_0x3b6e39);})[_0xb39c('0x16')](function(_0x13775e){_0x56b863(_0x13775e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x7e')]=function(_0x43eb48,_0x2c524b){scripts[_0xb39c('0x7e')](this[_0xb39c('0xd')][_0xb39c('0x38')],_0x43eb48[_0xb39c('0x7f')],_0x43eb48[_0xb39c('0x80')],_0x43eb48[_0xb39c('0x81')],_0x43eb48[_0xb39c('0x5c')],_0x43eb48[_0xb39c('0x82')]||'en')[_0xb39c('0x11')](function(_0x48ec2b){_0x2c524b(null,_0x48ec2b);})[_0xb39c('0x16')](function(_0x27a47a){_0x2c524b(_0x27a47a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x83')]=function(_0x52b991,_0x3d0243){scripts[_0xb39c('0x83')](this['channel'],_0x52b991)[_0xb39c('0x11')](function(_0x3b70ce){_0x3d0243(null,_0x3b70ce);})[_0xb39c('0x16')](function(_0x2c17cb){_0x3d0243(_0x2c17cb);});};AGIVertices[_0xb39c('0x13')]['ispeechTTS']=function(_0x313f61,_0x398165){scripts['ispeechTTS'](_0x313f61[_0xb39c('0x7c')],_0x313f61[_0xb39c('0x5c')],_0x313f61[_0xb39c('0x84')]||_0xb39c('0x85'),_0x313f61[_0xb39c('0x86')])[_0xb39c('0x11')](function(_0x458351){_0x398165(null,_0x458351);})[_0xb39c('0x16')](function(_0x1b007a){_0x398165(_0x1b007a);});};AGIVertices[_0xb39c('0x13')]['ispeechASR']=function(_0x36975c,_0x2c733e,_0x28d120){scripts[_0xb39c('0x87')](_0x2c733e,_0x36975c['key'],_0x36975c[_0xb39c('0x88')]||_0xb39c('0x85'),this[_0xb39c('0x89')](_0x36975c[_0xb39c('0x8a')])?_0x36975c['model']:undefined)[_0xb39c('0x11')](function(_0x3ffab2){_0x28d120(null,_0x3ffab2);})[_0xb39c('0x16')](function(_0x1c45c8){_0x28d120(_0x1c45c8);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x8b')]=function(_0x2ebfd8,_0x43557f){scripts['awsPolly'](_0x2ebfd8[_0xb39c('0x8c')],_0x2ebfd8[_0xb39c('0x8d')],_0x2ebfd8[_0xb39c('0x8e')],_0x2ebfd8[_0xb39c('0x8f')]||_0xb39c('0x90'),_0x2ebfd8[_0xb39c('0x5c')],_0x2ebfd8[_0xb39c('0x91')]||'text')['then'](function(_0x23ff98){_0x43557f(null,_0x23ff98);})[_0xb39c('0x16')](function(_0x40d511){_0x43557f(_0x40d511);});};AGIVertices['prototype'][_0xb39c('0x92')]=function(_0x42a882,_0x474b07){scripts[_0xb39c('0x92')](this[_0xb39c('0xd')]['uniqueid'],_0x42a882[_0xb39c('0x8c')],_0x42a882[_0xb39c('0x8d')],_0x42a882[_0xb39c('0x93')],_0x42a882[_0xb39c('0x5c')],_0x42a882[_0xb39c('0x94')])[_0xb39c('0x11')](function(_0x24eba1){_0x474b07(null,_0x24eba1);})[_0xb39c('0x16')](function(_0x5d40fe){_0x474b07(_0x5d40fe);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x95')]=function(_0x1ed19a,_0x163158,_0x2bb8e1){scripts['googleASR'](_0x163158,_0x1ed19a[_0xb39c('0x7c')],_0x1ed19a[_0xb39c('0x96')]||_0xb39c('0x85'))[_0xb39c('0x11')](function(_0x33a01f){_0x2bb8e1(null,_0x33a01f);})[_0xb39c('0x16')](function(_0x3a9185){_0x2bb8e1(_0x3a9185);});};AGIVertices['prototype'][_0xb39c('0x97')]=function(_0x1da4a2,_0x489988,_0x50ee92){scripts[_0xb39c('0x97')](_0x489988,_0x1da4a2['appid'],_0x1da4a2[_0xb39c('0x98')],_0x1da4a2['uri'])[_0xb39c('0x11')](function(_0x4c6fb9){_0x50ee92(null,_0x4c6fb9);})[_0xb39c('0x16')](function(_0x1316f4){_0x50ee92(_0x1316f4);});};AGIVertices[_0xb39c('0x13')]['clear']=function(_0x5f5c95){var _0x27d29a=_[_0xb39c('0x68')](verticesWithRetry,_0x5f5c95['agicommand'])?_0x5f5c95:_[_0xb39c('0x99')](_0x5f5c95);for(var _0x176284 in _0x27d29a){if(_0x27d29a['hasOwnProperty'](_0x176284)){if(_0x27d29a[_0x176284]&&_[_0xb39c('0x9a')](_0x27d29a[_0x176284])){if(_[_0xb39c('0x68')](recursiveMapAttributes,_0x176284)){_0x27d29a[_0x176284]=this[_0xb39c('0x9b')](_0x27d29a[_0x176284]);}else{_0x27d29a[_0x176284]=this['replaceAllVariables'](_0x27d29a[_0x176284]);}}}}return _0x27d29a;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9c')]=function(_0x1226ff){for(var _0x98bfbb in _0x1226ff){if(_0x1226ff[_0xb39c('0x9d')](_0x98bfbb)){if(_[_0xb39c('0x9e')](_0x1226ff[_0x98bfbb])){this[_0xb39c('0x9c')](_0x1226ff[_0x98bfbb]);}else if(_['isArray'](_0x1226ff[_0x98bfbb])){for(var _0x15f244=0x0;_0x15f244<_0x1226ff[_0x98bfbb]['length'];_0x15f244++){this['recursiveNodeIndex'](_0x1226ff[_0x98bfbb][_0x15f244]);}}else if(_[_0xb39c('0x9a')](_0x1226ff[_0x98bfbb])){_0x1226ff[_0x98bfbb]=this[_0xb39c('0x9f')](_0x1226ff[_0x98bfbb]);}}}};AGIVertices[_0xb39c('0x13')][_0xb39c('0xa0')]=function(_0x3a7dd5,_0x46b77a){for(var _0xac1d01 in _0x3a7dd5){if(_0x3a7dd5[_0xb39c('0x9d')](_0xac1d01)){if(_[_0xb39c('0x9e')](_0x3a7dd5[_0xac1d01])){if(!_['isEmpty'](_0x3a7dd5[_0xac1d01])){this[_0xb39c('0xa0')](_0x3a7dd5[_0xac1d01],util['format'](_0xb39c('0xa1'),_0x46b77a,_0xac1d01));}}else if(_['isArray'](_0x3a7dd5[_0xac1d01])){for(var _0x1aff94=0x0;_0x1aff94<_0x3a7dd5[_0xac1d01][_0xb39c('0xa2')];_0x1aff94++){this[_0xb39c('0xa0')](_0x3a7dd5[_0xac1d01][_0x1aff94],util['format']('%s.%s',_0x46b77a,_0xac1d01+'['+_0x1aff94+']'));}}else{if(!_[_0xb39c('0x46')](_0x3a7dd5[_0xac1d01])){this['channel']['setVariable'](util[_0xb39c('0x2a')](_0xb39c('0xa1'),_0x46b77a,_0xac1d01),_0x3a7dd5[_0xac1d01]);}}}}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9b')]=function(_0x160763){try{var _0x4e09f3=JSON['parse'](_0x160763);this['recursiveNodeIndex'](_0x4e09f3);return JSON['stringify'](_0x4e09f3);}catch(_0x53dfbb){return this[_0xb39c('0x9f')](_0x160763);}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9f')]=function(_0x407e9d){var _0x532ff2=_0x407e9d[_0xb39c('0xa3')]('{');for(var _0x2ad1a1=0x1;_0x2ad1a1<_0x532ff2[_0xb39c('0xa2')];_0x2ad1a1+=0x1){var _0x643963=_0x532ff2[_0x2ad1a1][_0xb39c('0xa3')]('}');if(_0x643963[_0xb39c('0xa2')]>0x1){_0x407e9d=_0x407e9d[_0xb39c('0xa4')]('{'+_0x643963[0x0]+'}',this['channel'][_0xb39c('0xe')](_0x643963[0x0])['extra']||_0x643963[0x0]);}}if(_0x532ff2[_0xb39c('0xa2')]===0x1){return _0x407e9d['toString']();}return this[_0xb39c('0x9f')](_0x407e9d);};AGIVertices[_0xb39c('0x13')][_0xb39c('0xa5')]=function(_0x1e6a98,_0xe63cd8){var _0x3821f4=this[_0xb39c('0xd')][_0xb39c('0xe')](_0x1e6a98);if(_0x3821f4[_0xb39c('0xa6')]===-0x1){return _0x3821f4;}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xa7'),_0xe63cd8,_0x3821f4[_0xb39c('0xa8')]));return this[_0xb39c('0xd')][_0xb39c('0xa9')](_0xe63cd8,_0x3821f4[_0xb39c('0xa8')]);};AGIVertices['prototype'][_0xb39c('0x89')]=function(_0x29442a){return _0x29442a&&_0x29442a!=='0'&&_0x29442a!=='-1'&&_0x29442a!=='';};AGIVertices[_0xb39c('0x13')][_0xb39c('0xaa')]=function(_0x518c87){this[_0xb39c('0x37')]['sync'](this,_0x518c87,'-');_0x518c87['retry']=_0x518c87[_0xb39c('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb39c('0x13')][_0xb39c('0xab')]=function(_0x17144a){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xac'),_0x17144a[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x17144a[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}var _0x55d99a='\x22'+_0x17144a[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x17144a[_0xb39c('0x7a')])){_0x55d99a+=','+_0x17144a[_0xb39c('0x7a')];}var _0xd47cc0=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb1'),_0x55d99a);if(_0xd47cc0[_0xb39c('0xa6')]===-0x1){return _0xd47cc0;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x55d99a));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xb2')]=function(_0x490eb9){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xb3'),_0x490eb9['label']));if(!this[_0xb39c('0x89')](_0x490eb9[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0xe5ea1d=_0x490eb9[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x490eb9[_0xb39c('0x7a')])){_0xe5ea1d+=','+_0x490eb9[_0xb39c('0x7a')];}var _0x21c9a4=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb6'),_0xe5ea1d);if(_0x21c9a4[_0xb39c('0xa6')]===-0x1){return _0x21c9a4;}var _0x4e9eef=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xb8'));if(_0x4e9eef[_0xb39c('0xa6')]===-0x1){return _0x4e9eef;}var _0x446d2b=this[_0xb39c('0xa5')](_0xb39c('0xb9'),_0xb39c('0xba'));if(_0x446d2b[_0xb39c('0xa6')]===-0x1){return _0x446d2b;}var _0x26a080=this[_0xb39c('0xa5')]('RECOG_INSTANCE()',_0xb39c('0xbb'));if(_0x26a080[_0xb39c('0xa6')]===-0x1){return _0x26a080;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xe5ea1d));};AGIVertices['prototype'][_0xb39c('0x6')]=function(_0x23a1cb){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0xbc'),_0x23a1cb[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x6')]([_0x23a1cb['command'],_0x23a1cb['args']]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0xbd')]=function(_0x9b179){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xbe'),_0x9b179[_0xb39c('0xad')]));if(this[_0xb39c('0x89')](_0x9b179[_0xb39c('0x66')])){logger['info'](util['format'](_0xb39c('0xbf'),_0x9b179['timeout']));var _0x2952d2=this[_0xb39c('0xd')][_0xb39c('0xc0')](_0x9b179[_0xb39c('0x66')]);if(_0x2952d2[_0xb39c('0xa6')]===-0x1){return _0x2952d2;}}return this[_0xb39c('0xd')][_0xb39c('0xbd')]();};AGIVertices['prototype']['callback']=function(_0x1e7fd7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xc1'),_0x1e7fd7['label']));if(!this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0x48')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x1e7fd7,'no\x20list\x20selected');}_0x1e7fd7[_0xb39c('0x49')]=moment();if(this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0xc2')])){_0x1e7fd7[_0xb39c('0x49')]=moment()[_0xb39c('0xc3')](_0x1e7fd7[_0xb39c('0xc2')],'minutes');}if(!this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0x4c')])){_0x1e7fd7[_0xb39c('0x4c')]=0x2;}this[_0xb39c('0xc4')]['sync'](this,_0x1e7fd7);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1e7fd7['phone'],_0x1e7fd7['list_id'],_0x1e7fd7[_0xb39c('0x49')]));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xc5')]=function(_0x208169){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xc6'),_0x208169[_0xb39c('0xad')]));var _0x4070b5=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0x208169[_0xb39c('0xc7')],_0x208169[_0xb39c('0x7a')]);if(_0x4070b5[_0xb39c('0xa6')]===-0x1){return _0x4070b5;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),_0x208169['application'],_0x208169['options']));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xc9')]=function(_0x20e2fb){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20e2fb['label']));if(!this['isConfigured'](_0x20e2fb[_0xb39c('0x5c')])){return this['channel']['noop'](_0xb39c('0xaf'));}var _0x32aeb9='\x22'+_0x20e2fb[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x20e2fb['options'])){_0x32aeb9+=','+_0x20e2fb[_0xb39c('0x7a')];}var _0x21e98b=this[_0xb39c('0xd')][_0xb39c('0xb0')]('MRCPSynth',_0x32aeb9);if(_0x21e98b[_0xb39c('0xa6')]===-0x1){return _0x21e98b;}return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0xca'),_0x32aeb9));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xcb')]=function(_0x77ad7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x77ad7[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x77ad7[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0xaf'));}var _0x345e8a='\x22'+_0x77ad7[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x77ad7[_0xb39c('0x7a')])){_0x345e8a+=','+_0x77ad7[_0xb39c('0x7a')];}var _0x2f3824=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb1'),_0x345e8a);if(_0x2f3824[_0xb39c('0xa6')]===-0x1){return _0x2f3824;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0xca'),_0x345e8a));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xcc')]=function(_0x508757){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xcd'),_0x508757['label']));if(!this[_0xb39c('0x89')](_0x508757[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0x2a0e34=_0x508757[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x508757[_0xb39c('0x7a')])){_0x2a0e34+=','+_0x508757[_0xb39c('0x7a')];}var _0x2d17ae=this['channel'][_0xb39c('0xb0')]('MRCPRecog',_0x2a0e34);if(_0x2d17ae[_0xb39c('0xa6')]===-0x1){return _0x2d17ae;}var _0x2ec13d=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xce'));if(_0x2ec13d['result']===-0x1){return _0x2ec13d;}var _0x40f39a=this[_0xb39c('0xa5')](_0xb39c('0xb9'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x40f39a[_0xb39c('0xa6')]===-0x1){return _0x40f39a;}var _0x521716=this[_0xb39c('0xa5')](_0xb39c('0xcf'),_0xb39c('0xd0'));if(_0x521716[_0xb39c('0xa6')]===-0x1){return _0x521716;}return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xd1'),_0x2a0e34));};AGIVertices[_0xb39c('0x13')]['sestekasr']=function(_0x434a36){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x434a36[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x434a36[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0x652129=_0x434a36[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x434a36[_0xb39c('0x7a')])){_0x652129+=','+_0x434a36[_0xb39c('0x7a')];}var _0x5dda97=this['channel'][_0xb39c('0xb0')](_0xb39c('0xb6'),_0x652129);if(_0x5dda97[_0xb39c('0xa6')]===-0x1){return _0x5dda97;}var _0x3ccf84=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xd2'));if(_0x3ccf84['result']===-0x1){return _0x3ccf84;}var _0x531a49=this[_0xb39c('0xa5')]('RECOG_INPUT()',_0xb39c('0xd3'));if(_0x531a49[_0xb39c('0xa6')]===-0x1){return _0x531a49;}var _0x49617f=this[_0xb39c('0xa5')]('RECOG_INSTANCE()',_0xb39c('0xd4'));if(_0x49617f[_0xb39c('0xa6')]===-0x1){return _0x49617f;}return this['channel']['noop'](util[_0xb39c('0x2a')](_0xb39c('0xd1'),_0x652129));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xd5')]=function(_0x554314){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x554314[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x554314[_0xb39c('0xd6')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd7'));}var _0x48b6f8=this[_0xb39c('0x19')][_0xb39c('0x72')](this,_0x554314[_0xb39c('0xd6')]);if(!_0x48b6f8){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd8'));}if(!this['isConfigured'](_0x554314[_0xb39c('0x30')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd9'));}var _0x39478f=_0x554314['query'][_0xb39c('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0xda'),_0x39478f));var _0x3bcbc8=this[_0xb39c('0x2c')][_0xb39c('0x72')](this,_0x48b6f8,_0x39478f);this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x554314,_0x39478f);if(!this[_0xb39c('0x89')](_0x554314[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}var _0x37f362=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x554314[_0xb39c('0xdb')]);if(!_0x37f362){return this['channel'][_0xb39c('0x2d')](_0x554314,'no\x20variable\x20found');}var _0x13152b=this;_0x3bcbc8[_0xb39c('0xdd')](function(_0x53411f,_0x15ad96){Object[_0xb39c('0xde')](_0x53411f)[_0xb39c('0xdd')](function(_0x4cf325){_0x13152b[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0xdf'),_0x37f362,_0x15ad96,_0x4cf325),_0x53411f[_0x4cf325]);});});this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('%s_ROWS_COUNT',_0x37f362),_0x3bcbc8[_0xb39c('0xa2')]);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xe0'),_0x37f362));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xe1')]=function(_0x54769c){logger['debug'](util[_0xb39c('0x2a')](_0xb39c('0xe2'),_0x54769c[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x54769c[_0xb39c('0xe3')])){return this[_0xb39c('0xd')]['error'](_0x54769c,_0xb39c('0xe4'));}var _0x1187d1=this['getUser'][_0xb39c('0x72')](this,_0x54769c[_0xb39c('0xe3')]);if(!_0x1187d1){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x54769c,_0xb39c('0xe5'));}var _0x23ccb1=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xe6'),[util[_0xb39c('0x2a')](_0xb39c('0xe7'),_0x1187d1),_0x54769c[_0xb39c('0x66')],_0x54769c[_0xb39c('0xe8')],_0x54769c[_0xb39c('0x64')]]);if(_0x23ccb1['result']===-0x1){return _0x23ccb1;}return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0xe9'),_0xb39c('0xe6')));};AGIVertices['prototype']['dialogflow']=function(_0x5cc266){logger[_0xb39c('0x31')](util['format'](_0xb39c('0xea'),_0x5cc266[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x5cc266[_0xb39c('0x7c')])){return this[_0xb39c('0xd')]['noop']('no\x20key\x20configured');}if(!this[_0xb39c('0x89')](_0x5cc266[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')]('no\x20text\x20configured');}this[_0xb39c('0xd')][_0xb39c('0xeb')]=!![];this['createSquareDetailsReport'](_0x5cc266);this[_0xb39c('0x42')](_0x5cc266['text'],'in','','');this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xec'),_0x5cc266['text']));var _0x44e1c3=this[_0xb39c('0x7b')][_0xb39c('0x72')](this,_0x5cc266);if(_0x44e1c3){for(var _0x17a084 in _0x44e1c3){if(_0x44e1c3['hasOwnProperty'](_0x17a084)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0xed'),_0x17a084['toUpperCase']()),_0x44e1c3[_0x17a084]);}}this[_0xb39c('0x42')](_0x44e1c3['speech'],_0xb39c('0xee'),'dialogflow','');return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Dialogflow\x20Result\x20%s',_0x44e1c3[_0xb39c('0xef')]));}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x5cc266,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0xf0')]=function(_0x4e4636){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4e4636[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x7f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xf1'));}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x80')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0xf2'));}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x81')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xf3'));}if(!this['isConfigured'](_0x4e4636[_0xb39c('0x82')])){return this['channel'][_0xb39c('0xae')]('no\x20anguage\x20configured');}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0xaf'));}this['channel'][_0xb39c('0xeb')]=!![];this[_0xb39c('0x37')](_0x4e4636);this['createSquareMessage'](_0x4e4636[_0xb39c('0x5c')],'in','','');this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xf4'),_0x4e4636[_0xb39c('0x5c')]));var _0x23a3b2=this[_0xb39c('0x7e')][_0xb39c('0x72')](this,_0x4e4636);if(_0x23a3b2){for(var _0x4e6152 in _0x23a3b2){if(_0x23a3b2[_0xb39c('0x9d')](_0x4e6152)){if(_0x4e6152!==_0xb39c('0xf5')){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('DIALOGFLOW_%s',_0x4e6152[_0xb39c('0x6b')]()),_0x23a3b2[_0x4e6152]);}}}this[_0xb39c('0x42')](_0x23a3b2['speech'],_0xb39c('0xee'),_0xb39c('0xf0'),_0x23a3b2['providerResponse']);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xf6'),_0x23a3b2[_0xb39c('0xef')]));}return this[_0xb39c('0xd')]['error'](_0x4e4636,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0xf7')]=function(_0x34f3bf){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0xf8'),_0x34f3bf['label']));if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xf9')])){return this['channel']['noop'](_0xb39c('0xfa'));}if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xfb')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0xfc'));}if(!this['isConfigured'](_0x34f3bf[_0xb39c('0xfd')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xfe'));}if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xff')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this['channel'][_0xb39c('0xeb')]=!![];this[_0xb39c('0x37')](_0x34f3bf);this[_0xb39c('0x42')](_0x34f3bf['text'],'in','','');this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x100'),_0x34f3bf['text']));var _0x566ef3=this[_0xb39c('0x83')]['sync'](this,_0x34f3bf);if(_0x566ef3){for(var _0x67ecae in _0x566ef3){if(_0x566ef3[_0xb39c('0x9d')](_0x67ecae)){this[_0xb39c('0xd')]['setVariable'](util[_0xb39c('0x2a')]('SESTEK_NDA_%s',_0x67ecae[_0xb39c('0x6b')]()),_0x566ef3[_0x67ecae]);}}this[_0xb39c('0x42')](_0x566ef3[_0xb39c('0xef')],_0xb39c('0xee'),'sesteknda','');if(_0x566ef3['audiofile']){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x101'),_0x566ef3[_0xb39c('0x102')]));var _0x2a8aff=this[_0xb39c('0xd')][_0xb39c('0x103')](_0x566ef3[_0xb39c('0x102')]);try{fs[_0xb39c('0x104')](_0x566ef3[_0xb39c('0x102')]+_0xb39c('0x105'));}catch(_0x9e7a1){logger['error'](_0x9e7a1);}return _0x2a8aff;}else{return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0x106'),_0x566ef3[_0xb39c('0xef')]));}}return this['channel'][_0xb39c('0x2d')](_0x34f3bf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0x107')]=function(_0x2478f4){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x108'),_0x2478f4[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x107'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x109')]=function(_0x4f1f49){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x10a'),_0x4f1f49[_0xb39c('0xad')]));var _0x46e4fe='';if(_0x4f1f49[_0xb39c('0x10b')]){if(!this[_0xb39c('0x89')](_0x4f1f49[_0xb39c('0x10b')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x4f1f49,_0xb39c('0x10c'));}else{var _0x475041=parseInt(_0x4f1f49[_0xb39c('0x10b')],0xa);if(isNaN(_0x475041)){_0x46e4fe=_0x4f1f49[_0xb39c('0x10b')];}else{_0x46e4fe=this[_0xb39c('0x1c')][_0xb39c('0x72')](this,_0x4f1f49['trunk_id']);if(!_0x46e4fe){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x4f1f49,'no\x20trunk\x20found');}}}}else if(_0x4f1f49[_0xb39c('0x10d')]){_0x46e4fe=_0x4f1f49['trunk_name'];}else{return this[_0xb39c('0xd')]['error'](_0x4f1f49,'no\x20trunk\x20selected');}var _0x1386ae=this['channel'][_0xb39c('0xb0')](_0xb39c('0xe6'),[util[_0xb39c('0x2a')](_0xb39c('0x10e'),_0x46e4fe,_0x4f1f49['phone']),_0x4f1f49[_0xb39c('0x66')],_0x4f1f49[_0xb39c('0xe8')],_0x4f1f49['url']]);if(_0x1386ae['result']===-0x1){return _0x1386ae;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xe9'),_0xb39c('0xe6')));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x10f')]=function(_0x2dffab){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2dffab['label']));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x10f'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x110')]=function(_0x2a6407){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x111'),_0x2a6407['label']));if(_0x2a6407[_0xb39c('0x112')]===0x0){return this['maxRetry'](_0x2a6407);}_0x2a6407['retry']-=0x1;if(!this[_0xb39c('0x89')](_0x2a6407[_0xb39c('0x113')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x2a6407,_0xb39c('0x114'));}var _0x317a78=this[_0xb39c('0x1e')]['sync'](this,_0x2a6407[_0xb39c('0x113')]);if(!_0x317a78){return this[_0xb39c('0xd')]['error'](_0x2a6407,_0xb39c('0x115'));}if(!this['isConfigured'](_0x2a6407[_0xb39c('0xdb')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4302b1=this['channel']['getData'](_0x317a78,_0x2a6407['response'],_0x2a6407[_0xb39c('0x116')]);var _0x269e47=_0x4302b1[_0xb39c('0xa6')]?_0x4302b1[_0xb39c('0xa6')]['toString']():'';logger['info'](_0xb39c('0x117'),JSON[_0xb39c('0x75')](_0x4302b1));if(_0x4302b1[_0xb39c('0xa6')]===-0x1){this[_0xb39c('0x37')]['sync'](this,_0x2a6407,_0x269e47);return _0x4302b1;}else if(_0x4302b1[_0xb39c('0xa8')]===_0xb39c('0x66')){_0x4302b1['result']=_0x269e47[_0xb39c('0xa2')]>=parseInt(_0x2a6407[_0xb39c('0x118')])?'x':'i';}else{_0x4302b1[_0xb39c('0xa6')]=_0x269e47[_0xb39c('0xa2')]>=parseInt(_0x2a6407[_0xb39c('0x118')])&&_0x269e47['length']<=parseInt(_0x2a6407[_0xb39c('0x116')])?'x':'i';}var _0x143363=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x2a6407['variable_id']);if(!_0x143363){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x2a6407,_0xb39c('0x119'));}this['channel'][_0xb39c('0xa9')](_0x143363,_0x269e47);if(this[_0xb39c('0x89')](_0x2a6407['hiddendigitsnum'])){var _0x9e2498=parseInt(_0x2a6407[_0xb39c('0x11a')],0xa);var _0x5982f7=rs[_0xb39c('0x11b')]({'charset':'*','length':_0x9e2498});var _0x6e21b=_0x269e47[_0xb39c('0xa2')];if(_0x6e21b>0x0){if(_0x6e21b>_0x9e2498){this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x2a6407,_0x2a6407[_0xb39c('0x11c')]===_0xb39c('0x11d')?_0x5982f7+_0x269e47[_0xb39c('0x11e')](_0x9e2498):_0x269e47['substr'](0x0,_0x6e21b-_0x9e2498)+_0x5982f7);}else{this[_0xb39c('0x37')]['sync'](this,_0x2a6407,rs[_0xb39c('0x11b')]({'charset':'*','length':_0x6e21b}));}}else{this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x2a6407,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x2a6407,_0x269e47);}return _0x4302b1;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x11f')]=function(_0x38f723){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x120'),_0x38f723[_0xb39c('0xad')]));return this['getdigits'](_0x38f723);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x121')]=function(_0x4f5cf1){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x122'),_0x4f5cf1['label']));this['createSquareDetailsReport'][_0xb39c('0x72')](this,_0x4f5cf1,_0x4f5cf1[_0xb39c('0x123')]);return this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x124'),_0x4f5cf1[_0xb39c('0x123')]));};AGIVertices['prototype'][_0xb39c('0x125')]=function(_0xbc154a){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x126'),_0xbc154a['label']));if(!this[_0xb39c('0x89')](_0xbc154a[_0xb39c('0x8c')])||!this['isConfigured'](_0xbc154a[_0xb39c('0x8d')])){return this[_0xb39c('0xd')][_0xb39c('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xbc154a['text'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0xbc154a[_0xb39c('0x5c')]));var _0x4b189b=this[_0xb39c('0x8b')][_0xb39c('0x72')](this,_0xbc154a);if(_0x4b189b){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x127'),_0x4b189b));var _0x191319=this[_0xb39c('0xd')][_0xb39c('0x103')](_0x4b189b);try{fs[_0xb39c('0x104')](_0x4b189b+_0xb39c('0x105'));}catch(_0x5a973f){logger[_0xb39c('0x2d')](_0x5a973f);}return _0x191319;}return this[_0xb39c('0xd')]['error'](_0xbc154a,_0xb39c('0x128'));};AGIVertices['prototype'][_0xb39c('0x129')]=function(_0x209dc0){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x12a'),_0x209dc0[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x8c')])||!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x8d')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x12b'));}if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x94')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x12c'));}if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x5c')])){return this['channel']['noop'](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xeb')]=!![];this['createSquareDetailsReport'](_0x209dc0);this[_0xb39c('0x42')](_0x209dc0['text'],'in','','');this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x12d'),_0x209dc0[_0xb39c('0x5c')]));var _0x57365b=this['awsLex'][_0xb39c('0x72')](this,_0x209dc0);if(_0x57365b){for(var _0x337ff0 in _0x57365b){if(_0x57365b[_0xb39c('0x9d')](_0x337ff0)&&_['isString'](_0x57365b[_0x337ff0])){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x12e'),_0x337ff0['toUpperCase']()),_0x57365b[_0x337ff0]);}}if(_[_0xb39c('0x46')](_0x57365b[_0xb39c('0x12f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x130'));}else{this[_0xb39c('0x42')](_0x57365b[_0xb39c('0x12f')],_0xb39c('0xee'),_0xb39c('0x131'),'');return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x132'),_0x57365b[_0xb39c('0x12f')]));}}return this[_0xb39c('0xd')]['error'](_0x209dc0,_0xb39c('0x133'));};AGIVertices[_0xb39c('0x13')]['googleasr']=function(_0x13aaf1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x134'),_0x13aaf1[_0xb39c('0xad')],_0x13aaf1[_0xb39c('0x66')]));if(!this[_0xb39c('0x89')](_0x13aaf1['key'])){return this[_0xb39c('0xd')]['noop']('no\x20key\x20configured');}var _0x33f1b8=_0xb39c('0x135');var _0x10cbce=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,rs['generate'](0x4));var _0x3dd80e=util['format']('%s.%s',_0x10cbce,_0x33f1b8);var _0x505731=!![];if(_0x13aaf1['beep']===_0xb39c('0x137')){_0x505731=![];}var _0x547405=this['channel'][_0xb39c('0x138')](_0x10cbce,_0x33f1b8,_0x13aaf1[_0xb39c('0x139')],_0x13aaf1[_0xb39c('0x66')],undefined,_0x505731);if(_0x547405[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x13a'),_0x3dd80e));var _0x127d63=this[_0xb39c('0x95')][_0xb39c('0x72')](this,_0x13aaf1,_0x3dd80e);if(_0x127d63){for(var _0x13204e in _0x127d63){if(_0x127d63[_0xb39c('0x9d')](_0x13204e)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x13b'),_0x13204e[_0xb39c('0x6b')]()),_0x127d63[_0x13204e]);}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x13c'),JSON[_0xb39c('0x75')](_0x127d63)));}}return _0x547405;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x13d')]=function(_0x214987){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x13e'),_0x214987[_0xb39c('0xad')]));if(!this['isConfigured'](_0x214987[_0xb39c('0x13f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x140'));}if(!this[_0xb39c('0x89')](_0x214987['appsecret'])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x141'));}var _0x303b57=_0xb39c('0x135');var _0x3726ef=util['format'](_0xb39c('0x136'),FILES_PATH,rs[_0xb39c('0x11b')](0x4));var _0x4edf11=util['format'](_0xb39c('0xa1'),_0x3726ef,_0x303b57);var _0xf10c21=!![];if(_0x214987[_0xb39c('0x142')]==='NOBEEP'){_0xf10c21=![];}var _0x4c3933=this[_0xb39c('0xd')][_0xb39c('0x138')](_0x3726ef,_0x303b57,_0x214987[_0xb39c('0x139')],_0x214987['timeout'],undefined,_0xf10c21);if(_0x4c3933[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x143'),_0x4edf11));var _0x14ab58=this[_0xb39c('0x97')][_0xb39c('0x72')](this,_0x214987,_0x4edf11);if(_0x14ab58){for(var _0x24d35d in _0x14ab58){if(_0x14ab58[_0xb39c('0x9d')](_0x24d35d)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x144'),_0x24d35d['toUpperCase']()),_0x14ab58[_0x24d35d]);}}return this['channel']['noop'](util['format'](_0xb39c('0x145'),JSON[_0xb39c('0x75')](_0x14ab58)));}}return _0x4c3933;};AGIVertices['prototype']['gotoc']=function(_0x40b2f2){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x146'),_0x40b2f2[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x147')](_0x40b2f2[_0xb39c('0x3c')],_0x40b2f2[_0xb39c('0x148')],_0x40b2f2['priority']);};AGIVertices['prototype'][_0xb39c('0x149')]=function(_0x427757){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x14a'),_0x427757['label']));if(!this['isConfigured'](_0x427757['condition'])){return this[_0xb39c('0xd')]['error'](_0x427757,_0xb39c('0x14b'));}try{var _0x259b68=eval(_0x427757['condition'])?_0xb39c('0x14c'):_0xb39c('0x14d');this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x427757[_0xb39c('0x14e')],_0x259b68));return{'code':0xc8,'result':_0x259b68};}catch(_0xd37b92){return{'code':0xc8,'result':_0xb39c('0x14d')};}};AGIVertices[_0xb39c('0x13')]['gotoiftime']=function(_0x3a9d0a){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x14f'),_0x3a9d0a[_0xb39c('0xad')]));if(!this['isConfigured'](_0x3a9d0a['interval_id'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9d0a,_0xb39c('0x150'));}var _0x19fbcf=this[_0xb39c('0x23')]['sync'](this,_0x3a9d0a['interval_id']);if(!_0x19fbcf){return this['channel'][_0xb39c('0x2d')](_0x3a9d0a,_0xb39c('0x151'));}for(var _0x7ec883=0x0;_0x7ec883<_0x19fbcf[_0xb39c('0xa2')];_0x7ec883+=0x1){var _0x33bbb8=this[_0xb39c('0xd')][_0xb39c('0xe')](util[_0xb39c('0x2a')]('IFTIME(%s?true:false)',_0x19fbcf[_0x7ec883]));if(_0x33bbb8[_0xb39c('0xa6')]===-0x1){return _0x33bbb8;}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],_0x33bbb8['extra']));if(_0x33bbb8['extra']===_0xb39c('0x14c')){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],_0xb39c('0x14c')));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('IFTIME\x20%s\x20%s',_0x19fbcf[_0x7ec883],_0xb39c('0x14c')));return{'code':0xc8,'result':_0xb39c('0x14c')};}else{logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('IFTIME\x20%s\x20%s',_0x19fbcf[_0x7ec883],_0xb39c('0x14d')));this['channel']['noop'](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],'false'));}}return{'code':0xc8,'result':_0xb39c('0x14d')};};AGIVertices[_0xb39c('0x13')][_0xb39c('0x153')]=function(_0x269b90){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x154'),_0x269b90[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x153')]();};AGIVertices[_0xb39c('0x13')][_0xb39c('0x155')]=function(_0x4061f2){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x156'),_0x4061f2[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x4061f2[_0xb39c('0x7c')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x157'));}var _0x3b97e3=_0xb39c('0x135');var _0x2b50ad=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,rs['generate'](0x4));var _0xa45d5c=util[_0xb39c('0x2a')](_0xb39c('0xa1'),_0x2b50ad,_0x3b97e3);var _0x53b791=!![];if(_0x4061f2[_0xb39c('0x142')]===_0xb39c('0x137')){_0x53b791=![];}var _0x275504=this[_0xb39c('0xd')][_0xb39c('0x138')](_0x2b50ad,_0x3b97e3,_0x4061f2['intKey'],_0x4061f2[_0xb39c('0x66')],undefined,_0x53b791);if(_0x275504[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x158'),_0xa45d5c));var _0xdbdcd8=this['ispeechASR']['sync'](this,_0x4061f2,_0xa45d5c);if(_0xdbdcd8){for(var _0x3cf9ce in _0xdbdcd8){if(_0xdbdcd8['hasOwnProperty'](_0x3cf9ce)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x159'),_0x3cf9ce['toUpperCase']()),_0xdbdcd8[_0x3cf9ce]);}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x15a'),JSON[_0xb39c('0x75')](_0xdbdcd8)));}}return _0x275504;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x15b')]=function(_0x79ac6e){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x79ac6e[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x79ac6e[_0xb39c('0x7c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0x157'));}if(!this[_0xb39c('0x89')](_0x79ac6e[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x79ac6e[_0xb39c('0x5c')]));var _0x2d7d53=this['ispeechTTS']['sync'](this,_0x79ac6e);if(_0x2d7d53){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('ispeech\x20%s\x20file\x20created',_0x2d7d53));var _0x5e8812=this['channel']['streamFile'](_0x2d7d53,_0x79ac6e[_0xb39c('0x139')]);try{fs[_0xb39c('0x104')](_0x2d7d53+_0xb39c('0x105'));}catch(_0x4de4f3){logger[_0xb39c('0x2d')](_0x4de4f3);}return _0x5e8812;}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x79ac6e,_0xb39c('0x15c'));};AGIVertices['prototype'][_0xb39c('0x15d')]=function(_0x471787){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x15e'),_0x471787[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x471787[_0xb39c('0x15f')])){return this[_0xb39c('0xd')]['error'](_0x471787,_0xb39c('0x160'));}logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x161'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787['findBy']));var _0x213ad6=this[_0xb39c('0x53')][_0xb39c('0x72')](this,_0x471787[_0xb39c('0x15f')]);if(_0x213ad6){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0x162'),this[_0xb39c('0xd')]['callerid'],_0x471787['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x164')]=function(_0x283fc2){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x283fc2[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x283fc2[_0xb39c('0x15f')])){return this['channel'][_0xb39c('0x2d')](_0x283fc2,_0xb39c('0x160'));}logger[_0xb39c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb39c('0xd')]['callerid'],_0x283fc2[_0xb39c('0x15f')]));var _0x17bc39=this['agentLogout'][_0xb39c('0x72')](this,_0x283fc2['findBy']);if(_0x17bc39){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this['channel']['callerid'],_0x283fc2['findBy']));this['channel'][_0xb39c('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb39c('0xd')][_0xb39c('0x39')],_0x283fc2['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')][_0xb39c('0x39')],_0x283fc2[_0xb39c('0x15f')]));this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x283fc2[_0xb39c('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb39c('0x165')]=function(_0x3a9add){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a9add[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x3a9add['operation'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9add,_0xb39c('0x166'));}this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x167'),_0x3a9add[_0xb39c('0x168')]));var _0x55340c=eval(_0x3a9add['operation']);if(!this['isConfigured'](_0x3a9add['variable_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}var _0x27b0fd=this[_0xb39c('0xe')]['sync'](this,_0x3a9add['variable_id']);if(!_0x27b0fd){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9add,_0xb39c('0x119'));}if(_['isArray'](_0x55340c)){var _0x39dfce=this;_0x55340c[_0xb39c('0xdd')](function(_0x220f02,_0x4f6730){_0x39dfce[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x169'),_0x27b0fd,_0x4f6730),_0x220f02);});return this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x16a'),_0x27b0fd));}else{return this[_0xb39c('0xd')][_0xb39c('0xa9')](_0x27b0fd,_0x55340c);}};AGIVertices[_0xb39c('0x13')]['menu']=function(_0x259a66){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x16b'),_0x259a66[_0xb39c('0xad')]));if(_0x259a66[_0xb39c('0x112')]===0x0){return this[_0xb39c('0xaa')](_0x259a66);}_0x259a66['retry']-=0x1;if(!this[_0xb39c('0x89')](_0x259a66['file_id'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x259a66,_0xb39c('0x114'));}var _0x5ca753=this[_0xb39c('0x1e')][_0xb39c('0x72')](this,_0x259a66[_0xb39c('0x113')]);if(!_0x5ca753){return this['channel']['error'](_0x259a66,_0xb39c('0x115'));}var _0x1b6618=this['channel'][_0xb39c('0x16c')](_0x5ca753,_0x259a66['response'],_0x259a66[_0xb39c('0x16d')]);var _0x410b9f=_0x1b6618[_0xb39c('0xa6')];if(_0x1b6618[_0xb39c('0xa6')]===-0x1){this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x259a66,'-1');return _0x1b6618;}else if(_0x1b6618['extra']===_0xb39c('0x66')){_0x1b6618[_0xb39c('0xa6')]=_0x1b6618['result'][_0xb39c('0xa2')]>0x0?_0x1b6618['result']:'t';}else if(_['isEmpty'](_0x1b6618['result'])){_0x1b6618[_0xb39c('0xa6')]='#';_0x410b9f='#';}if(!this[_0xb39c('0x89')](_0x259a66[_0xb39c('0xdb')])){this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}else{var _0x4cb84e=this['getVariable'][_0xb39c('0x72')](this,_0x259a66['variable_id']);if(!_0x4cb84e){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x259a66,_0xb39c('0x119'));}this[_0xb39c('0xd')]['setVariable'](_0x4cb84e,_0x410b9f);}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x259a66,_0x410b9f);return _0x1b6618;};AGIVertices[_0xb39c('0x13')][_0xb39c('0xae')]=function(_0x4d6699){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x16e'),_0x4d6699[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0x4d6699[_0xb39c('0x16f')]||_0x4d6699[_0xb39c('0xad')]);};AGIVertices['prototype'][_0xb39c('0x170')]=function(_0x4af1b1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x171'),_0x4af1b1[_0xb39c('0xad')]));if(!this['isConfigured'](_0x4af1b1['findBy'])){return this['channel']['error'](_0x4af1b1,'no\x20find\x20by\x20configured');}logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x161'),this['channel'][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));var _0x5330b9=this[_0xb39c('0x4d')][_0xb39c('0x72')](this,_0x4af1b1[_0xb39c('0x172')]);var _0x1ddfd4=this[_0xb39c('0x4f')][_0xb39c('0x72')](this,_0x4af1b1[_0xb39c('0x15f')],_0x5330b9);if(_0x1ddfd4){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb39c('0x39')],_0x4af1b1['findBy']));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x4af1b1['findBy']));return{'code':0xc8,'result':_0xb39c('0x173')};}else{logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));return{'code':0xc8,'result':_0xb39c('0x174')};}};AGIVertices[_0xb39c('0x13')]['playback']=function(_0x592681){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x175'),_0x592681[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x592681[_0xb39c('0x113')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x592681,_0xb39c('0x114'));}var _0x3c6168=this[_0xb39c('0x1e')]['sync'](this,_0x592681[_0xb39c('0x113')]);if(!_0x3c6168){return this['channel'][_0xb39c('0x2d')](_0x592681,'no\x20file\x20audio\x20found');}var _0x5e4a9d=this[_0xb39c('0xd')]['exec'](_0xb39c('0x176'),[_0x3c6168,_0x592681[_0xb39c('0xe8')]]);if(_0x5e4a9d[_0xb39c('0xa6')]===-0x1){return _0x5e4a9d;}return this['channel']['noop'](util['format'](_0xb39c('0xc8'),_0xb39c('0x176'),_0x3c6168));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x177')]=function(_0x137bd1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x178'),_0x137bd1['label']));if(!this[_0xb39c('0x89')](_0x137bd1[_0xb39c('0x179')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x137bd1,_0xb39c('0x17a'));}var _0xb330ee='';var _0x471c12=parseInt(_0x137bd1[_0xb39c('0x179')],0xa);if(isNaN(_0x471c12)){_0xb330ee=_0x137bd1[_0xb39c('0x179')];}else{_0xb330ee=this[_0xb39c('0x14')][_0xb39c('0x72')](this,_0x137bd1[_0xb39c('0x179')]);if(!_0xb330ee){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x137bd1,'no\x20queue\x20found');}}var _0x82e970='';if(this[_0xb39c('0x89')](_0x137bd1[_0xb39c('0x113')])){var _0x111f1e=this['getSound']['sync'](this,_0x137bd1[_0xb39c('0x113')]);if(_0x111f1e){_0x82e970=_0x111f1e;}}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x137bd1,_0xb330ee);if(_0x137bd1[_0xb39c('0xe8')][_0xb39c('0x17b')]('x')<0x0){_0x137bd1[_0xb39c('0xe8')]+='x';}if(_0x137bd1[_0xb39c('0xe8')][_0xb39c('0x17b')]('X')<0x0){_0x137bd1[_0xb39c('0xe8')]+='X';}this[_0xb39c('0xd')]['setVariable'](_0xb39c('0x17c'),_0xb330ee?_0xb330ee['toLowerCase']():'');var _0x1064a3=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0x17d'),[_0xb330ee,_0x137bd1[_0xb39c('0xe8')],_0x137bd1[_0xb39c('0x64')],_0x82e970,_0x137bd1[_0xb39c('0x66')],_0x137bd1['agi'],_0x137bd1['macro'],_0x137bd1[_0xb39c('0x17e')],'',_0x137bd1[_0xb39c('0x17f')]]);if(_0x1064a3['result']===-0x1){return _0x1064a3;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),_0xb39c('0x17d'),_0xb330ee));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x180')]=function(_0x2c6195){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2c6195[_0xb39c('0xad')]));var _0x3d35d8=_0x2c6195[_0xb39c('0x181')]||_0xb39c('0x135');var _0x1fe27d=util[_0xb39c('0x2a')](_0xb39c('0x182'),this['channel'][_0xb39c('0x38')],rs[_0xb39c('0x11b')](0x5));var _0xe8bc4b=util[_0xb39c('0x2a')](_0xb39c('0x183'),FILES_PATH,_0x1fe27d,_0x3d35d8);var _0x1e3763=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,_0x1fe27d);this[_0xb39c('0x3a')][_0xb39c('0x72')](this,_0x2c6195,_0x1fe27d,_0xe8bc4b);this[_0xb39c('0xd')][_0xb39c('0xa9')](_0xb39c('0x184'),_0x1fe27d);logger[_0xb39c('0x31')](_0xb39c('0x185'),_0x1e3763,_0x3d35d8,_0x2c6195[_0xb39c('0x186')],_0x2c6195[_0xb39c('0x66')]);return this['channel'][_0xb39c('0x138')](_0x1e3763,_0x3d35d8,_0x2c6195[_0xb39c('0x186')],_0x2c6195['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xb39c('0x187')]=function(_0x135997){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x188'),_0x135997[_0xb39c('0xad')]));if(!this['isConfigured'](_0x135997[_0xb39c('0x64')])){return this[_0xb39c('0xd')]['noop']('no\x20url\x20configured');}var _0x2c1dff=this[_0xb39c('0x63')][_0xb39c('0x72')](this,_0x135997);logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Response:',util[_0xb39c('0x189')](_0x2c1dff,{'showHidden':![],'depth':null})));if(!this[_0xb39c('0x89')](_0x135997['variable_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x18a'));}var _0x549303=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x135997[_0xb39c('0xdb')]);if(!_0x549303){return this['channel'][_0xb39c('0x2d')](_0x135997,_0xb39c('0x119'));}this[_0xb39c('0xd')][_0xb39c('0xa9')](util['format'](_0xb39c('0x18b'),_0x549303),_0x2c1dff[_0xb39c('0x77')]?_0x2c1dff[_0xb39c('0x77')]:_0xb39c('0x18c'));this['channel'][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('%s_STATUS_MESSAGE',_0x549303),_0x2c1dff['statusMessage']?_0x2c1dff[_0xb39c('0x78')]:'OK');if(_0x2c1dff[_0xb39c('0x6c')]){try{this[_0xb39c('0xa0')](_0x2c1dff[_0xb39c('0x6c')],_0x549303);}catch(_0x462c29){logger['error'](util[_0xb39c('0x2a')](_0xb39c('0x18d'),_0x549303));}}return this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')]('variable\x20%s\x20set',_0x549303));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x18e')]=function(_0x1145d7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x18f'),_0x1145d7['label']));return this[_0xb39c('0xd')]['sayDigits'](_0x1145d7[_0xb39c('0x190')][_0xb39c('0x58')](/\s+/g,''),_0x1145d7[_0xb39c('0x186')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x191')]=function(_0x13b33d){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x13b33d[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x192')](_0x13b33d['number'][_0xb39c('0x58')](/\s+/g,''),_0x13b33d['escape_digits']);};AGIVertices[_0xb39c('0x13')]['sayphonetic']=function(_0x217eb6){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x193'),_0x217eb6[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x194')](_0x217eb6[_0xb39c('0x5c')],_0x217eb6[_0xb39c('0x186')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x195')]=function(_0x3c508b){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x196'),_0x3c508b[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x3c508b[_0xb39c('0x197')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x198'));}var _0x34ee73=this['getMailAccount'][_0xb39c('0x72')](this,_0x3c508b[_0xb39c('0x197')]);if(!_0x34ee73||!_0x34ee73[_0xb39c('0x199')]){return this['channel']['error'](_0x3c508b,_0xb39c('0x19a'));}var _0x28b364={'from':util[_0xb39c('0x2a')](_0xb39c('0x19b'),_0x34ee73[_0xb39c('0x12')],_0x34ee73['email']||_0x34ee73[_0xb39c('0x199')]['user']),'to':_0x3c508b['to']||'','cc':_0x3c508b['cc']||'','bcc':_0x3c508b[_0xb39c('0x19c')]||'','subject':_0x3c508b[_0xb39c('0x19d')],'html':_0x3c508b['text'],'text':_0x3c508b[_0xb39c('0x5c')]};if(this[_0xb39c('0x89')](_0x3c508b[_0xb39c('0x19e')])){}logger[_0xb39c('0x19f')]('sendMail\x20message',JSON['stringify'](_0x28b364));this[_0xb39c('0x37')]['sync'](this,_0x3c508b,_0x3c508b[_0xb39c('0x197')]);this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0x1a0'),_0x34ee73[_0xb39c('0x12')]));this[_0xb39c('0x1a1')][_0xb39c('0x72')](this,_0x34ee73[_0xb39c('0x1a2')],_0x28b364);return this[_0xb39c('0xd')][_0xb39c('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1a3')]=function(_0x2200b1){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x1a4'),_0x2200b1['label']));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1a5'));};AGIVertices['prototype']['sendSMS']=function(_0x11b324){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1a6'),_0x11b324[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x11b324['sms_account_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1a7'));}var _0x540115=this[_0xb39c('0x34')]['sync'](this,_0x11b324['sms_account_id']);if(!_0x540115){return this['channel'][_0xb39c('0x2d')](_0x11b324,_0xb39c('0x1a8'));}var _0x470b63={'body':_0x11b324['sms_text'],'phone':_0x11b324['to']||'','SmsAccountId':_0x540115['id']};logger[_0xb39c('0x19f')](_0xb39c('0x1a9'),JSON[_0xb39c('0x75')](_0x470b63));this[_0xb39c('0x37')]['sync'](this,_0x11b324,_0x11b324[_0xb39c('0x1aa')]);this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1ab'),_0x540115[_0xb39c('0x12')]));this[_0xb39c('0x36')][_0xb39c('0x72')](this,_0x470b63);return this[_0xb39c('0xd')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb39c('0x13')]['set']=function(_0x221b63){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1ac'),_0x221b63[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x221b63[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x221b63,'no\x20variable\x20selected');}var _0xadebe1=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x221b63['variable_id']);if(!_0xadebe1){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x221b63,'no\x20variable\x20found');}return this['channel']['setVariable'](_0xadebe1,_0x221b63[_0xb39c('0x1ad')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1ae')]=function(_0x25c64d){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x25c64d[_0xb39c('0xad')]));this['channel']['noop'](_0xb39c('0x1af'));if(_0x25c64d[_0xb39c('0xbd')]===_0xb39c('0x1b0')){this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1b1'));return this[_0xb39c('0xd')][_0xb39c('0xbd')]();}return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1b2'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1b3')]=function(_0x68a5ca){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1b4'),_0x68a5ca[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x68a5ca[_0xb39c('0x1b5')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,_0xb39c('0x1b6'));}var _0x1ec221=this[_0xb39c('0x17')]['sync'](this,_0x68a5ca[_0xb39c('0x1b5')]);if(!this['isConfigured'](_0x1ec221)){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,util[_0xb39c('0x2a')](_0xb39c('0x1b7'),_0x68a5ca[_0xb39c('0x1b5')]));}if(_0x1ec221===this['channel'][_0xb39c('0x40')]){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,_0xb39c('0x1b8'));}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x68a5ca,_0x1ec221);var _0x3130be=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0x1b9'),util[_0xb39c('0x2a')](_0xb39c('0x1ba'),config[_0xb39c('0x6')][_0xb39c('0x1bb')]||_0xb39c('0x1bc'),_0x1ec221,this['channel'][_0xb39c('0x40')]));if(_0x3130be[_0xb39c('0xa6')]===-0x1){return _0x3130be;}return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),'AGI',_0x1ec221));};AGIVertices[_0xb39c('0x13')]['system']=function(_0x38d641){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1bd'),_0x38d641['label']));var _0x794cbf=this[_0xb39c('0x1be')][_0xb39c('0x72')](this,_0x38d641[_0xb39c('0x1bf')]);this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x38d641,_0x38d641[_0xb39c('0x1bf')]);if(this[_0xb39c('0x89')](_0x38d641['variable_id'])){var _0x5e78db=this[_0xb39c('0xe')]['sync'](this,_0x38d641[_0xb39c('0xdb')]);if(_0x5e78db){this[_0xb39c('0xd')][_0xb39c('0xa9')](_0x5e78db,_0x794cbf);return this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x1c0'),_0x38d641[_0xb39c('0x1bf')],_0x5e78db));}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c1'),_0x38d641[_0xb39c('0x1bf')]));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1c2')]=function(_0x1c698f){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1c698f[_0xb39c('0xad')]));_0x1c698f[_0xb39c('0x5c')]=_0x1c698f[_0xb39c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb39c('0x89')](_0x1c698f['apiKey'])){return this['channel']['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x1c698f[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c3'),_0x1c698f[_0xb39c('0x5c')]));var _0x500250=this[_0xb39c('0x59')]['sync'](this,_0x1c698f);if(_0x500250){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c4'),_0x500250));var _0x1d96a2=this[_0xb39c('0xd')]['streamFile'](_0x500250);try{fs[_0xb39c('0x104')](_0x500250+_0xb39c('0x105'));}catch(_0x46e1d5){logger['error'](_0x46e1d5);}return _0x1d96a2;}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x1c698f,_0xb39c('0x1c5'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1c6')]=function(_0x2d2bdd){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2d2bdd[_0xb39c('0xad')]));_0x2d2bdd[_0xb39c('0x5c')]=_0x2d2bdd[_0xb39c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2d2bdd[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x1c7'),_0x2d2bdd[_0xb39c('0x5c')]));var _0xda4c06=this[_0xb39c('0x61')][_0xb39c('0x72')](this,_0x2d2bdd);if(_0xda4c06){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c8'),_0xda4c06));var _0x67fb4f=this[_0xb39c('0xd')][_0xb39c('0x103')](_0xda4c06);try{fs[_0xb39c('0x104')](_0xda4c06+_0xb39c('0x105'));}catch(_0x43393a){logger[_0xb39c('0x2d')](_0x43393a);}return _0x67fb4f;}return this['channel'][_0xb39c('0x2d')](_0x2d2bdd,_0xb39c('0x1c9'));};AGIVertices['prototype'][_0xb39c('0x1ca')]=function(_0x382b0b){logger['info'](util['format'](_0xb39c('0x1cb'),_0x382b0b[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x382b0b['findBy'])){return this[_0xb39c('0xd')]['error'](_0x382b0b,_0xb39c('0x160'));}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x161'),this['channel'][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));var _0x289a88=this[_0xb39c('0x50')]['sync'](this,_0x382b0b['findBy']);if(_0x289a88){logger['info'](util['format'](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x382b0b[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')]['callerid'],_0x382b0b[_0xb39c('0x15f')]));return{'code':0xc8,'result':_0xb39c('0x174')};}};AGIVertices[_0xb39c('0x13')]['voicemail']=function(_0x2e4335){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1cc'),_0x2e4335['label']));var _0x33c22d=this[_0xb39c('0xd')]['exec']('VOICEMAIL',[_0x2e4335[_0xb39c('0x1cd')],_0x2e4335[_0xb39c('0x7a')]]);if(_0x33c22d[_0xb39c('0xa6')]===-0x1){return _0x33c22d;}return this['channel']['noop'](util['format'](_0xb39c('0xc8'),'VOICEMAIL',_0x2e4335[_0xb39c('0x1cd')]));};AGIVertices['prototype'][_0xb39c('0x1ce')]=function(_0x14af29){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1cf'),_0x14af29[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x14af29[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x14af29,_0xb39c('0x1d0'));}var _0xeab725=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x14af29[_0xb39c('0xdb')]);if(!_0xeab725){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x14af29,_0xb39c('0x119'));}var _0x25d5bd=this['channel'][_0xb39c('0xe')](_0xeab725);return{'code':0xc8,'result':_0x25d5bd[_0xb39c('0xa8')]?_0x25d5bd['extra']:'-'};};String[_0xb39c('0x13')][_0xb39c('0xa4')]=function(_0x1f38d1,_0x24208e){return this[_0xb39c('0xa3')](_0x1f38d1)[_0xb39c('0x1d1')](_0x24208e);};module[_0xb39c('0x1d2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 91d03b8..e4b2015 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 _0xa052=['error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','prototype','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','message','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','channels','interface','ACW','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch'];(function(_0x259a60,_0x26786f){var _0x5dabc9=function(_0x44b7cb){while(--_0x44b7cb){_0x259a60['push'](_0x259a60['shift']());}};_0x5dabc9(++_0x26786f);}(_0xa052,0x123));var _0x2a05=function(_0x511b26,_0x46cb69){_0x511b26=_0x511b26-0x0;var _0x5d4719=_0xa052[_0x511b26];return _0x5d4719;};'use strict';var util=require(_0x2a05('0x0'));var _=require(_0x2a05('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x2a05('0x2'))('acw');var RpcUser=require(_0x2a05('0x3'));var RpcVoiceAgentReport=require(_0x2a05('0x4'));function Acw(_0x55ec95){this[_0x2a05('0x5')]=_0x55ec95['voiceQueues'];this[_0x2a05('0x6')]=_0x55ec95[_0x2a05('0x6')];this[_0x2a05('0x7')]=_0x55ec95[_0x2a05('0x7')];this['channels']={};ami['on'](_0x2a05('0x8'),this[_0x2a05('0x9')][_0x2a05('0xa')](this));ami['on'](_0x2a05('0xb'),this[_0x2a05('0xc')]['bind'](this));ami['on'](_0x2a05('0xd'),this[_0x2a05('0xe')]['bind'](this));ami['on']('agentringnoanswer',this[_0x2a05('0xf')][_0x2a05('0xa')](this));ami['on']('attendedtransfer',this[_0x2a05('0x10')]['bind'](this));ami['on'](_0x2a05('0x11'),this['syncBlindTransfer'][_0x2a05('0xa')](this));ami['on'](_0x2a05('0x12'),this[_0x2a05('0x13')][_0x2a05('0xa')](this));}function getDiff(_0x25a3be){var _0x247d85=moment()[_0x2a05('0x14')](0x0);var _0x22afbc=moment(_0x25a3be)[_0x2a05('0x14')](0x0);return _0x247d85['diff'](_0x22afbc,_0x2a05('0x15'));}Acw['prototype'][_0x2a05('0x16')]=function(_0x4ab750){try{var _0x3586a1=this;var _0x4df5db=this[_0x2a05('0x17')][_0x4ab750][_0x2a05('0x18')];var _0x36b1c8=this[_0x2a05('0x17')][_0x4ab750]['queue'];var _0x351420=this[_0x2a05('0x5')][_0x36b1c8];var _0x55f48a=![];var _0x58e467=_0x2a05('0x19');if(_0x351420['mandatoryDisposition']){if(_0x351420[_0x2a05('0x1a')][_0x2a05('0x1b')]){_0x55f48a=!![];_0x58e467=_0x351420[_0x2a05('0x1a')][_0x2a05('0x1b')];}}ami[_0x2a05('0x1c')]({'action':'QueuePause','interface':_0x4df5db,'paused':!![],'reason':_0x58e467})[_0x2a05('0x1d')](function(_0x586b20){if(_0x3586a1[_0x2a05('0x6')][_0x4df5db]){return RpcUser['getAgent'](_0x3586a1[_0x2a05('0x6')][_0x4df5db]['id'])[_0x2a05('0x1d')](function(_0x36e344){if(_0x36e344&&!_0x36e344[_0x2a05('0x1e')]){logger[_0x2a05('0x1f')](_0x2a05('0x20'),_0x4ab750,_0x4df5db,_0x36b1c8);var _0x54b065=_0x3586a1[_0x2a05('0x17')][_0x4ab750][_0x2a05('0x21')]&&_0x3586a1[_0x2a05('0x17')][_0x4ab750][_0x2a05('0x22')]?_0x3586a1[_0x2a05('0x17')][_0x4ab750][_0x2a05('0x22')]:_0x4ab750;return RpcUser[_0x2a05('0x23')](_0x3586a1[_0x2a05('0x6')][_0x4df5db],_0x58e467,_0x54b065)[_0x2a05('0x1d')](function(_0x436d6e){if(!_0x55f48a){_0x3586a1[_0x2a05('0x7')][_0x4df5db]={};logger[_0x2a05('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4ab750,_0x3586a1[_0x2a05('0x5')][_0x36b1c8][_0x2a05('0x24')],_0x4df5db,_0x36b1c8);_0x3586a1['timers'][_0x4df5db]['timer']=setTimeout(_0x3586a1['stopAcw'][_0x2a05('0xa')](_0x3586a1,_0x4df5db),_0x3586a1['voiceQueues'][_0x36b1c8]['acwTimeout']*0x3e8);_0x3586a1[_0x2a05('0x7')][_0x4df5db]['lastPauseAt']=moment()[_0x2a05('0x25')](_0x2a05('0x26'));_0x3586a1[_0x2a05('0x7')][_0x4df5db][_0x2a05('0x27')]=_0x4ab750;_0x3586a1['timers'][_0x4df5db][_0x2a05('0x28')]=_0x36b1c8;_0x3586a1['timers'][_0x4df5db][_0x2a05('0x29')]=function(){var _0xdcfc0a=getDiff(_0x3586a1[_0x2a05('0x7')][_0x4df5db]['lastPauseAt']);clearTimeout(_0x3586a1[_0x2a05('0x7')][_0x4df5db][_0x2a05('0x2a')]);_0x3586a1['timers'][_0x4df5db]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0xdcfc0a},_0x3586a1[_0x2a05('0x7')][_0x4df5db]['uniqueid'],_0x4df5db)[_0x2a05('0x1d')](function(_0x15cfa0){logger['info'](_0x2a05('0x2b'),_0x4ab750,_0xdcfc0a,_0x15cfa0);})[_0x2a05('0x2c')](function(_0x27d653){logger[_0x2a05('0x2d')](_0x2a05('0x2e'),_0x4ab750,_0x27d653);});delete _0x3586a1[_0x2a05('0x7')][_0x4df5db];};}});}else{logger[_0x2a05('0x1f')](_0x2a05('0x2f'),_0x4ab750,_0x4df5db,_0x36b1c8);}});}})['catch'](function(_0x33b494){logger[_0x2a05('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4ab750,_0x3586a1[_0x2a05('0x5')][_0x36b1c8][_0x2a05('0x24')],_0x4df5db,_0x36b1c8);})[_0x2a05('0x30')](function(){delete _0x3586a1[_0x2a05('0x17')][_0x4ab750];});}catch(_0x365fb3){logger[_0x2a05('0x2d')](_0x2a05('0x31'),_0x365fb3['message']);}};Acw[_0x2a05('0x32')][_0x2a05('0x33')]=function(_0x3ac7bf){try{var _0x3947b2=this;if(_0x3947b2[_0x2a05('0x7')][_0x3ac7bf]){_0x3947b2[_0x2a05('0x7')][_0x3ac7bf][_0x2a05('0x2a')]=![];var _0x247948=_0x3947b2[_0x2a05('0x7')][_0x3ac7bf]['uniqueid'];var _0x4bad52=_0x3947b2[_0x2a05('0x7')][_0x3ac7bf]['queue'];var _0x6b4fbc=_0x3947b2['voiceQueues'][_0x4bad52]['acwTimeout'];logger[_0x2a05('0x1f')](_0x2a05('0x34'),_0x247948,_0x3ac7bf);RpcUser[_0x2a05('0x35')](this[_0x2a05('0x6')][_0x3ac7bf]);RpcVoiceAgentReport[_0x2a05('0x36')]({'acwtime':_0x6b4fbc,'agentacw':!![]},_0x247948,_0x3ac7bf)[_0x2a05('0x1d')](function(_0x5de7d2){logger[_0x2a05('0x1f')](_0x2a05('0x2b'),_0x247948,_0x6b4fbc,_0x5de7d2);})[_0x2a05('0x2c')](function(_0x40d1fe){logger['error'](_0x2a05('0x2e'),_0x247948,_0x40d1fe);});}else{logger[_0x2a05('0x2d')](_0x2a05('0x37'),_0x3ac7bf);if(_0x3947b2[_0x2a05('0x7')]){logger[_0x2a05('0x1f')]('[ACW][TIMERS]',JSON[_0x2a05('0x38')](_0x3947b2['timers']));}}}catch(_0x2cc68e){logger[_0x2a05('0x2d')]('[ACW][STOP]\x20%s',_0x2cc68e[_0x2a05('0x39')]);}};Acw[_0x2a05('0x32')][_0x2a05('0x9')]=function(_0x41ff85){try{if(this['voiceQueues'][_0x41ff85[_0x2a05('0x28')]]&&(this[_0x2a05('0x5')][_0x41ff85['queue']]['acw']||this[_0x2a05('0x5')][_0x41ff85[_0x2a05('0x28')]]['mandatoryDisposition'])){if(this[_0x2a05('0x6')][_0x41ff85[_0x2a05('0x18')]]){this['channels'][_0x41ff85[_0x2a05('0x27')]]={'queue':_0x41ff85[_0x2a05('0x28')],'interface':_0x41ff85[_0x2a05('0x18')],'destlinkedid':_0x41ff85['destlinkedid']};}}}catch(_0x54f985){logger['error'](_0x2a05('0x3a'),_0x54f985['message']);}};Acw[_0x2a05('0x32')][_0x2a05('0x13')]=function(_0x575208){try{if(this['voiceQueues'][_0x575208[_0x2a05('0x28')]]&&(this['voiceQueues'][_0x575208['queue']]['acw']||this['voiceQueues'][_0x575208[_0x2a05('0x28')]][_0x2a05('0x3b')])){if(this[_0x2a05('0x6')][_0x575208['interface']]){this['channels'][_0x575208[_0x2a05('0x27')]]={'queue':_0x575208[_0x2a05('0x28')],'interface':_0x575208[_0x2a05('0x18')]};}}}catch(_0x145139){logger[_0x2a05('0x2d')](_0x2a05('0x3c'),_0x145139[_0x2a05('0x39')]);}};Acw[_0x2a05('0x32')]['syncHangupRequest']=function(_0x354670){try{if(this['channels'][_0x354670[_0x2a05('0x27')]]&&_[_0x2a05('0x3d')](this[_0x2a05('0x17')][_0x354670['uniqueid']][_0x2a05('0x21')])){logger[_0x2a05('0x1f')](_0x2a05('0x3e'),_0x354670[_0x2a05('0x27')]);this['startAcw'](_0x354670['uniqueid']);}else if(this['channels'][_0x354670[_0x2a05('0x3f')]]&&_['isUndefined'](this['channels'][_0x354670[_0x2a05('0x3f')]][_0x2a05('0x21')])){logger[_0x2a05('0x1f')](_0x2a05('0x40'),_0x354670['linkedid']);this[_0x2a05('0x16')](_0x354670[_0x2a05('0x3f')]);}}catch(_0x410975){logger[_0x2a05('0x2d')](_0x2a05('0x41'),_0x410975['message']);}};Acw[_0x2a05('0x32')][_0x2a05('0xe')]=function(_0x15656c){try{if(this[_0x2a05('0x17')][_0x15656c[_0x2a05('0x27')]]&&this[_0x2a05('0x17')][_0x15656c[_0x2a05('0x27')]][_0x2a05('0x21')]){logger[_0x2a05('0x1f')](_0x2a05('0x42'),_0x15656c['uniqueid']);this[_0x2a05('0x16')](_0x15656c['uniqueid']);}else if(this[_0x2a05('0x17')][_0x15656c[_0x2a05('0x3f')]]&&this[_0x2a05('0x17')][_0x15656c[_0x2a05('0x3f')]][_0x2a05('0x21')]){logger[_0x2a05('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x15656c[_0x2a05('0x3f')]);this[_0x2a05('0x16')](_0x15656c[_0x2a05('0x3f')]);}}catch(_0x5268e){logger[_0x2a05('0x2d')](_0x2a05('0x43'),_0x5268e[_0x2a05('0x39')]);}};Acw[_0x2a05('0x32')][_0x2a05('0x10')]=function(_0x509847){try{if(!_[_0x2a05('0x44')](this[_0x2a05('0x17')][_0x509847[_0x2a05('0x45')]])){this['startAcw'](_0x509847['transfereeuniqueid']);if(this[_0x2a05('0x17')][_0x509847[_0x2a05('0x46')]]){this[_0x2a05('0x17')][_0x509847['secondtransfereruniqueid']][_0x2a05('0x21')]=!![];this[_0x2a05('0x17')][_0x509847[_0x2a05('0x47')]]=this[_0x2a05('0x17')][_0x509847[_0x2a05('0x46')]];delete this['channels'][_0x509847['secondtransfereruniqueid']];}}else if(!_[_0x2a05('0x44')](this[_0x2a05('0x17')][_0x509847['transfertargetuniqueid']])){this[_0x2a05('0x16')](_0x509847['transfertargetuniqueid']);if(this[_0x2a05('0x17')][_0x509847['origtransfereruniqueid']]){this[_0x2a05('0x17')][_0x509847[_0x2a05('0x48')]][_0x2a05('0x21')]=!![];this[_0x2a05('0x17')][_0x509847[_0x2a05('0x45')]]=this[_0x2a05('0x17')][_0x509847[_0x2a05('0x48')]];delete this['channels'][_0x509847[_0x2a05('0x48')]];}}}catch(_0x617443){logger[_0x2a05('0x2d')](_0x2a05('0x49'),_0x617443[_0x2a05('0x39')]);}};Acw[_0x2a05('0x32')][_0x2a05('0x4a')]=function(_0xcb240f){try{if(this[_0x2a05('0x17')][_0xcb240f[_0x2a05('0x4b')]]){logger[_0x2a05('0x1f')](_0x2a05('0x4c'),JSON[_0x2a05('0x38')](_0xcb240f['transfereruniqueid']));this[_0x2a05('0x16')](_0xcb240f[_0x2a05('0x4b')]);}else if(this[_0x2a05('0x17')][_0xcb240f['transfererlinkedid']]){logger[_0x2a05('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x2a05('0x38')](_0xcb240f[_0x2a05('0x4d')]));this[_0x2a05('0x16')](_0xcb240f[_0x2a05('0x4d')]);}}catch(_0x345e8e){logger['error'](_0x2a05('0x4e'),_0x345e8e[_0x2a05('0x39')]);}};Acw['prototype'][_0x2a05('0xf')]=function(_0xde0940){try{if(this['voiceQueues'][_0xde0940['queue']]&&this[_0x2a05('0x5')][_0xde0940[_0x2a05('0x28')]][_0x2a05('0x4f')]===_0x2a05('0x50')){if(this['agents'][_0xde0940[_0x2a05('0x18')]]){logger[_0x2a05('0x1f')](_0x2a05('0x51'),_0xde0940[_0x2a05('0x27')],_0xde0940[_0x2a05('0x18')],_0xde0940['queue']);return RpcUser[_0x2a05('0x23')](this[_0x2a05('0x6')][_0xde0940['interface']],_0x2a05('0x52'),_0xde0940[_0x2a05('0x27')]);}}}catch(_0x3c651b){logger[_0x2a05('0x2d')](_0x2a05('0x53'),_0x3c651b['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x46df=['timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','channels','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','queue','updateAcw'];(function(_0xcf807,_0x4c736b){var _0x2ef9e9=function(_0x33ed42){while(--_0x33ed42){_0xcf807['push'](_0xcf807['shift']());}};_0x2ef9e9(++_0x4c736b);}(_0x46df,0x1c3));var _0xf46d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x46df[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xf46d('0x0'));var _=require(_0xf46d('0x1'));var moment=require(_0xf46d('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xf46d('0x3'));var RpcUser=require(_0xf46d('0x4'));var RpcVoiceAgentReport=require(_0xf46d('0x5'));function Acw(_0x2e76d2){this[_0xf46d('0x6')]=_0x2e76d2['voiceQueues'];this['agents']=_0x2e76d2[_0xf46d('0x7')];this[_0xf46d('0x8')]=_0x2e76d2[_0xf46d('0x8')];this['channels']={};ami['on']('agentconnect',this[_0xf46d('0x9')][_0xf46d('0xa')](this));ami['on']('hanguprequest',this[_0xf46d('0xb')][_0xf46d('0xa')](this));ami['on'](_0xf46d('0xc'),this[_0xf46d('0xd')]['bind'](this));ami['on'](_0xf46d('0xe'),this[_0xf46d('0xf')][_0xf46d('0xa')](this));ami['on']('attendedtransfer',this[_0xf46d('0x10')]['bind'](this));ami['on'](_0xf46d('0x11'),this[_0xf46d('0x12')][_0xf46d('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0xf46d('0x13')][_0xf46d('0xa')](this));}function getDiff(_0x4350cb){var _0x5de760=moment()[_0xf46d('0x14')](0x0);var _0xa19074=moment(_0x4350cb)[_0xf46d('0x14')](0x0);return _0x5de760['diff'](_0xa19074,_0xf46d('0x15'));}Acw[_0xf46d('0x16')][_0xf46d('0x17')]=function(_0xb11754){try{var _0x31dce1=this;var _0x2bdce2=this['channels'][_0xb11754][_0xf46d('0x18')];var _0x530fcb=this['channels'][_0xb11754]['queue'];var _0x48daa0=this[_0xf46d('0x6')][_0x530fcb];var _0x5f26eb=![];var _0x2bbc18=_0xf46d('0x19');if(_0x48daa0[_0xf46d('0x1a')]){if(_0x48daa0['mandatoryDispositionPause']['name']){_0x5f26eb=!![];_0x2bbc18=_0x48daa0[_0xf46d('0x1b')]['name'];}}ami['Action']({'action':_0xf46d('0x1c'),'interface':_0x2bdce2,'paused':!![],'reason':_0x2bbc18})[_0xf46d('0x1d')](function(_0x408e95){if(_0x31dce1[_0xf46d('0x7')][_0x2bdce2]){return RpcUser[_0xf46d('0x1e')](_0x31dce1[_0xf46d('0x7')][_0x2bdce2]['id'])[_0xf46d('0x1d')](function(_0x20f86b){if(_0x20f86b&&!_0x20f86b[_0xf46d('0x1f')]){logger[_0xf46d('0x20')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xb11754,_0x2bdce2,_0x530fcb);var _0x13a88d=_0x31dce1['channels'][_0xb11754]['attended']&&_0x31dce1[_0xf46d('0x21')][_0xb11754][_0xf46d('0x22')]?_0x31dce1[_0xf46d('0x21')][_0xb11754][_0xf46d('0x22')]:_0xb11754;return RpcUser['savePause'](_0x31dce1[_0xf46d('0x7')][_0x2bdce2],_0x2bbc18,_0x13a88d)[_0xf46d('0x1d')](function(_0x1c1654){if(!_0x5f26eb){_0x31dce1[_0xf46d('0x8')][_0x2bdce2]={};logger[_0xf46d('0x20')](_0xf46d('0x23'),_0xb11754,_0x31dce1[_0xf46d('0x6')][_0x530fcb][_0xf46d('0x24')],_0x2bdce2,_0x530fcb);_0x31dce1[_0xf46d('0x8')][_0x2bdce2]['timer']=setTimeout(_0x31dce1[_0xf46d('0x25')][_0xf46d('0xa')](_0x31dce1,_0x2bdce2),_0x31dce1['voiceQueues'][_0x530fcb]['acwTimeout']*0x3e8);_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x31dce1[_0xf46d('0x8')][_0x2bdce2]['uniqueid']=_0xb11754;_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x27')]=_0x530fcb;_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x28')]=function(){var _0x3bc319=getDiff(_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x26')]);clearTimeout(_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x29')]);_0x31dce1['timers'][_0x2bdce2][_0xf46d('0x29')]=![];RpcVoiceAgentReport[_0xf46d('0x2a')]({'acwtime':_0x3bc319},_0x31dce1['timers'][_0x2bdce2][_0xf46d('0x2b')],_0x2bdce2)[_0xf46d('0x1d')](function(_0x5933ab){logger[_0xf46d('0x20')](_0xf46d('0x2c'),_0xb11754,_0x3bc319,_0x5933ab);})[_0xf46d('0x2d')](function(_0x1972cc){logger[_0xf46d('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0xb11754,_0x1972cc);});delete _0x31dce1[_0xf46d('0x8')][_0x2bdce2];};}});}else{logger[_0xf46d('0x20')](_0xf46d('0x2f'),_0xb11754,_0x2bdce2,_0x530fcb);}});}})[_0xf46d('0x2d')](function(_0x56e15f){logger[_0xf46d('0x2e')](_0xf46d('0x23'),_0xb11754,_0x31dce1[_0xf46d('0x6')][_0x530fcb][_0xf46d('0x24')],_0x2bdce2,_0x530fcb);})[_0xf46d('0x30')](function(){delete _0x31dce1[_0xf46d('0x21')][_0xb11754];});}catch(_0x372533){logger[_0xf46d('0x2e')](_0xf46d('0x31'),_0x372533[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x25')]=function(_0x28d5d2){try{var _0x2ae453=this;if(_0x2ae453[_0xf46d('0x8')][_0x28d5d2]){_0x2ae453['timers'][_0x28d5d2][_0xf46d('0x29')]=![];var _0x537b9d=_0x2ae453[_0xf46d('0x8')][_0x28d5d2][_0xf46d('0x2b')];var _0x344d57=_0x2ae453[_0xf46d('0x8')][_0x28d5d2]['queue'];var _0x5466bd=_0x2ae453[_0xf46d('0x6')][_0x344d57][_0xf46d('0x24')];logger[_0xf46d('0x20')](_0xf46d('0x33'),_0x537b9d,_0x28d5d2);RpcUser[_0xf46d('0x34')](this[_0xf46d('0x7')][_0x28d5d2]);RpcVoiceAgentReport[_0xf46d('0x2a')]({'acwtime':_0x5466bd,'agentacw':!![]},_0x537b9d,_0x28d5d2)[_0xf46d('0x1d')](function(_0x179792){logger['info'](_0xf46d('0x2c'),_0x537b9d,_0x5466bd,_0x179792);})[_0xf46d('0x2d')](function(_0x323e49){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x537b9d,_0x323e49);});}else{logger[_0xf46d('0x2e')](_0xf46d('0x35'),_0x28d5d2);if(_0x2ae453[_0xf46d('0x8')]){logger['info'](_0xf46d('0x36'),JSON[_0xf46d('0x37')](_0x2ae453[_0xf46d('0x8')]));}}}catch(_0x51bb25){logger[_0xf46d('0x2e')](_0xf46d('0x38'),_0x51bb25[_0xf46d('0x32')]);}};Acw['prototype'][_0xf46d('0x9')]=function(_0xe2e812){try{if(this[_0xf46d('0x6')][_0xe2e812[_0xf46d('0x27')]]&&(this['voiceQueues'][_0xe2e812[_0xf46d('0x27')]]['acw']||this[_0xf46d('0x6')][_0xe2e812[_0xf46d('0x27')]][_0xf46d('0x1a')])){if(this['agents'][_0xe2e812[_0xf46d('0x18')]]){this[_0xf46d('0x21')][_0xe2e812['uniqueid']]={'queue':_0xe2e812[_0xf46d('0x27')],'interface':_0xe2e812[_0xf46d('0x18')],'destlinkedid':_0xe2e812[_0xf46d('0x22')]};}}}catch(_0x59836e){logger[_0xf46d('0x2e')](_0xf46d('0x39'),_0x59836e['message']);}};Acw[_0xf46d('0x16')][_0xf46d('0x13')]=function(_0x3be068){try{if(this[_0xf46d('0x6')][_0x3be068['queue']]&&(this[_0xf46d('0x6')][_0x3be068[_0xf46d('0x27')]]['acw']||this[_0xf46d('0x6')][_0x3be068[_0xf46d('0x27')]][_0xf46d('0x1a')])){if(this[_0xf46d('0x7')][_0x3be068[_0xf46d('0x18')]]){this[_0xf46d('0x21')][_0x3be068['uniqueid']]={'queue':_0x3be068[_0xf46d('0x27')],'interface':_0x3be068[_0xf46d('0x18')]};}}}catch(_0x33a5a9){logger[_0xf46d('0x2e')](_0xf46d('0x3a'),_0x33a5a9[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xb')]=function(_0x32fcd2){try{if(this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x2b')]]&&_[_0xf46d('0x3b')](this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x2b')]]['attended'])){logger[_0xf46d('0x20')](_0xf46d('0x3c'),_0x32fcd2[_0xf46d('0x2b')]);this[_0xf46d('0x17')](_0x32fcd2[_0xf46d('0x2b')]);}else if(this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x3d')]]&&_['isUndefined'](this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x3d')]][_0xf46d('0x3e')])){logger['info'](_0xf46d('0x3f'),_0x32fcd2[_0xf46d('0x3d')]);this['startAcw'](_0x32fcd2[_0xf46d('0x3d')]);}}catch(_0xbea5cc){logger[_0xf46d('0x2e')](_0xf46d('0x40'),_0xbea5cc[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xd')]=function(_0x3c1d8e){try{if(this['channels'][_0x3c1d8e[_0xf46d('0x2b')]]&&this[_0xf46d('0x21')][_0x3c1d8e[_0xf46d('0x2b')]]['attended']){logger[_0xf46d('0x20')](_0xf46d('0x41'),_0x3c1d8e[_0xf46d('0x2b')]);this[_0xf46d('0x17')](_0x3c1d8e['uniqueid']);}else if(this[_0xf46d('0x21')][_0x3c1d8e[_0xf46d('0x3d')]]&&this[_0xf46d('0x21')][_0x3c1d8e['linkedid']][_0xf46d('0x3e')]){logger['info'](_0xf46d('0x42'),_0x3c1d8e['linkedid']);this[_0xf46d('0x17')](_0x3c1d8e['linkedid']);}}catch(_0x1a656e){logger[_0xf46d('0x2e')](_0xf46d('0x43'),_0x1a656e[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x10')]=function(_0xc70581){try{if(!_[_0xf46d('0x44')](this[_0xf46d('0x21')][_0xc70581['transfereeuniqueid']])){this['startAcw'](_0xc70581[_0xf46d('0x45')]);if(this[_0xf46d('0x21')][_0xc70581['secondtransfereruniqueid']]){this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x46')]][_0xf46d('0x3e')]=!![];this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x47')]]=this['channels'][_0xc70581['secondtransfereruniqueid']];delete this[_0xf46d('0x21')][_0xc70581['secondtransfereruniqueid']];}}else if(!_[_0xf46d('0x44')](this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x47')]])){this['startAcw'](_0xc70581[_0xf46d('0x47')]);if(this['channels'][_0xc70581[_0xf46d('0x48')]]){this['channels'][_0xc70581[_0xf46d('0x48')]][_0xf46d('0x3e')]=!![];this[_0xf46d('0x21')][_0xc70581['transfereeuniqueid']]=this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x48')]];delete this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x48')]];}}}catch(_0x259607){logger[_0xf46d('0x2e')](_0xf46d('0x49'),_0x259607[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x12')]=function(_0x33223c){try{if(this[_0xf46d('0x21')][_0x33223c[_0xf46d('0x4a')]]){logger[_0xf46d('0x20')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf46d('0x37')](_0x33223c[_0xf46d('0x4a')]));this[_0xf46d('0x17')](_0x33223c['transfereruniqueid']);}else if(this['channels'][_0x33223c[_0xf46d('0x4b')]]){logger[_0xf46d('0x20')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xf46d('0x37')](_0x33223c['transfererlinkedid']));this['startAcw'](_0x33223c[_0xf46d('0x4b')]);}}catch(_0x284106){logger['error'](_0xf46d('0x4c'),_0x284106[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xf')]=function(_0x5cef6c){try{if(this['voiceQueues'][_0x5cef6c[_0xf46d('0x27')]]&&this['voiceQueues'][_0x5cef6c[_0xf46d('0x27')]]['autopause']===_0xf46d('0x4d')){if(this[_0xf46d('0x7')][_0x5cef6c['interface']]){logger[_0xf46d('0x20')](_0xf46d('0x4e'),_0x5cef6c[_0xf46d('0x2b')],_0x5cef6c['interface'],_0x5cef6c[_0xf46d('0x27')]);return RpcUser[_0xf46d('0x4f')](this['agents'][_0x5cef6c[_0xf46d('0x18')]],_0xf46d('0x50'),_0x5cef6c[_0xf46d('0x2b')]);}}}catch(_0x268d60){logger[_0xf46d('0x2e')](_0xf46d('0x51'),_0x268d60[_0xf46d('0x32')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index af6e387..ca9381b 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x51d445,_0x5d84cf){var _0xe1100f=function(_0x498c8b){while(--_0x498c8b){_0x51d445['push'](_0x51d445['shift']());}};_0xe1100f(++_0x5d84cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x4605a6,_0x4ee25f){_0x4605a6=_0x4605a6-0x0;var _0x18bc7a=_0xb10b[_0x4605a6];return _0x18bc7a;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x178a03,_0x4116e7){var _0x3d860d=function(_0x4a9aed){while(--_0x4a9aed){_0x178a03['push'](_0x178a03['shift']());}};_0x3d860d(++_0x4116e7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x0b0e[_0x57f345];return _0x255e43;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f97fabb..c93cd27 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x424a50,_0x1fd66d){var _0x1427b2=function(_0x35f2a0){while(--_0x35f2a0){_0x424a50['push'](_0x424a50['shift']());}};_0x1427b2(++_0x1fd66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0xbf9f51,_0x527014){var _0x2c6175=function(_0x3f2061){while(--_0x3f2061){_0xbf9f51['push'](_0xbf9f51['shift']());}};_0x2c6175(++_0x527014);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4e71ac,_0x42aced){_0x4e71ac=_0x4e71ac-0x0;var _0x11d76c=_0xbdb7[_0x4e71ac];return _0x11d76c;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 2255fe0..c8cc7c6 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf190=['ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xf190,0x162));var _0x0f19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf190[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0f19('0x0'));var _=require(_0x0f19('0x1'));var moment=require('moment');function checkNameSurname(_0x4c954e,_0x52cb9c,_0x2b3fde){var _0x2b3cae='';if(!_['isNil'](_0x52cb9c)&&'string'===typeof _0x52cb9c){_0x2b3cae+=_0x52cb9c;}if(!_[_0x0f19('0x2')](_0x2b3fde)&&_0x0f19('0x3')===typeof _0x2b3fde){_0x2b3cae+='\x20'+_0x2b3fde;}if(_0x2b3cae!==''){return _0x2b3cae;}return _0x4c954e;}function Action(_0x28e3b9,_0x1fc7c4,_0x56bd09){this[_0x0f19('0x4')]=_0x28e3b9;this[_0x0f19('0x5')]=_0x56bd09||undefined;this[_0x0f19('0x6')]=checkNameSurname(_0x1fc7c4[_0x0f19('0x7')][_0x0f19('0x8')],_0x1fc7c4[_0x0f19('0x7')][_0x0f19('0x9')],_0x1fc7c4[_0x0f19('0x7')][_0x0f19('0xa')]);this['number']=_0x1fc7c4['phone'];this['queue']=_0x28e3b9['name'];this[_0x0f19('0xb')]=_0x1fc7c4[_0x0f19('0xb')]||![];this[_0x0f19('0xc')]=_0x28e3b9[_0x0f19('0xc')];this['dialQueueTimeout']=_0x28e3b9[_0x0f19('0xd')]||0x3;this[_0x0f19('0xe')]=_0x1fc7c4[_0x0f19('0xe')];this[_0x0f19('0xf')]=_0x1fc7c4[_0x0f19('0xf')];this[_0x0f19('0x10')]=_0x1fc7c4['countcongestionretry'];this[_0x0f19('0x11')]=_0x1fc7c4[_0x0f19('0x11')];this[_0x0f19('0x12')]=_0x1fc7c4[_0x0f19('0x12')];this[_0x0f19('0x13')]=_0x1fc7c4[_0x0f19('0x13')];this[_0x0f19('0x14')]=_0x1fc7c4[_0x0f19('0x14')];this[_0x0f19('0x15')]=_0x1fc7c4[_0x0f19('0x15')];this[_0x0f19('0x16')]=_0x1fc7c4[_0x0f19('0x16')];this[_0x0f19('0x17')]=_0x1fc7c4[_0x0f19('0x17')];this[_0x0f19('0x18')]=_0x1fc7c4[_0x0f19('0x18')];this[_0x0f19('0x19')]=_0x1fc7c4[_0x0f19('0x19')];this['VoiceQueueId']=_0x1fc7c4[_0x0f19('0x1a')];this[_0x0f19('0x1b')]=_0x1fc7c4[_0x0f19('0x1b')];this['idHopper']=_0x1fc7c4['id'];this[_0x0f19('0x1c')]=_0x1fc7c4[_0x0f19('0x7')][_0x0f19('0x9')]||'';this[_0x0f19('0x1d')]=moment()[_0x0f19('0x1e')](_0x0f19('0x1f'));this[_0x0f19('0x20')]=_0x1fc7c4[_0x0f19('0x20')];this[_0x0f19('0x21')]=_0x1fc7c4[_0x0f19('0x21')];this[_0x0f19('0x22')]=_0x1fc7c4[_0x0f19('0x22')];this['recallme']=_0x1fc7c4['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x0f19('0x23')]['getCaller']=function(){return util[_0x0f19('0x1e')](_0x0f19('0x24'),this[_0x0f19('0x6')],this[_0x0f19('0x4')][_0x0f19('0x25')]>0x0?this['number'][_0x0f19('0x26')](this[_0x0f19('0x4')]['dialCutDigit']):this[_0x0f19('0x27')]);};Action[_0x0f19('0x23')][_0x0f19('0x28')]=function(){return this['queue'];};module[_0x0f19('0x29')]=Action; \ No newline at end of file +var _0x9ace=['exports','util','lodash','moment','isNil','string','uniqueid','Contact','firstName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue'];(function(_0x356bca,_0x523386){var _0x28cb11=function(_0x2f113a){while(--_0x2f113a){_0x356bca['push'](_0x356bca['shift']());}};_0x28cb11(++_0x523386);}(_0x9ace,0x10f));var _0xe9ac=function(_0x12254a,_0x3ce844){_0x12254a=_0x12254a-0x0;var _0x50965b=_0x9ace[_0x12254a];return _0x50965b;};'use strict';var util=require(_0xe9ac('0x0'));var _=require(_0xe9ac('0x1'));var moment=require(_0xe9ac('0x2'));function checkNameSurname(_0x35688d,_0x592913,_0x28060e){var _0x3b0f91='';if(!_[_0xe9ac('0x3')](_0x592913)&&'string'===typeof _0x592913){_0x3b0f91+=_0x592913;}if(!_['isNil'](_0x28060e)&&_0xe9ac('0x4')===typeof _0x28060e){_0x3b0f91+='\x20'+_0x28060e;}if(_0x3b0f91!==''){return _0x3b0f91;}return _0x35688d;}function Action(_0x3a33cf,_0x2c276a,_0x378ed0){this['voiceQueue']=_0x3a33cf;this[_0xe9ac('0x5')]=_0x378ed0||undefined;this['name']=checkNameSurname(_0x2c276a['Contact']['phone'],_0x2c276a[_0xe9ac('0x6')][_0xe9ac('0x7')],_0x2c276a[_0xe9ac('0x6')]['lastName']);this[_0xe9ac('0x8')]=_0x2c276a['phone'];this[_0xe9ac('0x9')]=_0x3a33cf[_0xe9ac('0xa')];this[_0xe9ac('0xb')]=_0x2c276a[_0xe9ac('0xb')]||![];this[_0xe9ac('0xc')]=_0x3a33cf['type'];this[_0xe9ac('0xd')]=_0x3a33cf[_0xe9ac('0xd')]||0x3;this[_0xe9ac('0xe')]=_0x2c276a[_0xe9ac('0xe')];this['countbusyretry']=_0x2c276a['countbusyretry'];this['countcongestionretry']=_0x2c276a[_0xe9ac('0xf')];this['countnoanswerretry']=_0x2c276a['countnoanswerretry'];this['countnosuchnumberretry']=_0x2c276a[_0xe9ac('0x10')];this['countdropretry']=_0x2c276a[_0xe9ac('0x11')];this[_0xe9ac('0x12')]=_0x2c276a[_0xe9ac('0x12')];this[_0xe9ac('0x13')]=_0x2c276a[_0xe9ac('0x13')];this[_0xe9ac('0x14')]=_0x2c276a['countagentrejectretry'];this[_0xe9ac('0x15')]=_0x2c276a[_0xe9ac('0x15')];this[_0xe9ac('0x16')]=_0x2c276a[_0xe9ac('0x16')];this[_0xe9ac('0x17')]=_0x2c276a['UserId'];this[_0xe9ac('0x18')]=_0x2c276a['VoiceQueueId'];this['CampaignId']=_0x2c276a[_0xe9ac('0x19')];this[_0xe9ac('0x1a')]=_0x2c276a['id'];this[_0xe9ac('0x1b')]=_0x2c276a[_0xe9ac('0x6')][_0xe9ac('0x7')]||'';this[_0xe9ac('0x1c')]=moment()[_0xe9ac('0x1d')](_0xe9ac('0x1e'));this[_0xe9ac('0x1f')]=_0x2c276a['callback'];this[_0xe9ac('0x20')]=_0x2c276a['callbackuniqueid'];this[_0xe9ac('0x21')]=_0x2c276a[_0xe9ac('0x21')];this['recallme']=_0x2c276a[_0xe9ac('0x22')];this[_0xe9ac('0x23')]='';this[_0xe9ac('0x24')]='';}Action[_0xe9ac('0x25')][_0xe9ac('0x26')]=function(){return util['format'](_0xe9ac('0x27'),this['name'],this[_0xe9ac('0x28')][_0xe9ac('0x29')]>0x0?this[_0xe9ac('0x8')][_0xe9ac('0x2a')](this[_0xe9ac('0x28')][_0xe9ac('0x29')]):this[_0xe9ac('0x8')]);};Action[_0xe9ac('0x25')][_0xe9ac('0x2b')]=function(){return this[_0xe9ac('0x9')];};module[_0xe9ac('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 5faf8f0..e951d9e 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4b8=['countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3497cf,_0x1947f6){var _0x3157f4=function(_0x137fe7){while(--_0x137fe7){_0x3497cf['push'](_0x3497cf['shift']());}};_0x3157f4(++_0x1947f6);}(_0xc4b8,0xa1));var _0x8c4b=function(_0x3a252b,_0x348882){_0x3a252b=_0x3a252b-0x0;var _0x4e70ab=_0xc4b8[_0x3a252b];return _0x4e70ab;};'use strict';var util=require(_0x8c4b('0x0'));var _=require(_0x8c4b('0x1'));var moment=require('moment');function getSeconds(_0x146e94,_0x123491){var _0x1f664c=moment(_0x146e94)[_0x8c4b('0x2')](0x0);var _0x328ca6=moment(_0x123491)['milliseconds'](0x0);return _0x1f664c[_0x8c4b('0x3')](_0x328ca6,_0x8c4b('0x4'));}function AgentComplete(_0x4f5c79,_0xb9fcb9){this['state']=0x4;this[_0x8c4b('0x5')]='Answer';this[_0x8c4b('0x6')]=_0x4f5c79[_0x8c4b('0x6')];this[_0x8c4b('0x7')]=_0x4f5c79[_0x8c4b('0x7')];this[_0x8c4b('0x8')]=_0x4f5c79[_0x8c4b('0x7')]===_0x8c4b('0x9')?_0x8c4b('0xa'):_0x4f5c79['type'];this['countbusyretry']=_0x4f5c79[_0x8c4b('0xb')];this['countcongestionretry']=_0x4f5c79[_0x8c4b('0xc')];this['countnoanswerretry']=_0x4f5c79[_0x8c4b('0xd')];this[_0x8c4b('0xe')]=_0x4f5c79[_0x8c4b('0xb')]+_0x4f5c79[_0x8c4b('0xc')]+_0x4f5c79[_0x8c4b('0xd')]+_0x4f5c79[_0x8c4b('0xf')]+_0x4f5c79['countdropretry']+_0x4f5c79[_0x8c4b('0x10')]+_0x4f5c79[_0x8c4b('0x11')]+_0x4f5c79['countagentrejectretry'];this['countnosuchnumberretry']=_0x4f5c79[_0x8c4b('0xf')];this[_0x8c4b('0x12')]=_0x4f5c79['countdropretry'];this[_0x8c4b('0x10')]=_0x4f5c79[_0x8c4b('0x10')];this[_0x8c4b('0x11')]=_0x4f5c79['countmachineretry'];this[_0x8c4b('0x13')]=_0x4f5c79[_0x8c4b('0x13')];this[_0x8c4b('0x14')]=_0xb9fcb9['uniqueid'];this['calleridname']=_0x4f5c79[_0x8c4b('0x15')];this[_0x8c4b('0x16')]=_0x4f5c79[_0x8c4b('0x17')];this[_0x8c4b('0x18')]=_0x4f5c79[_0x8c4b('0x18')];this[_0x8c4b('0x19')]=_0x4f5c79[_0x8c4b('0x19')];this[_0x8c4b('0x1a')]=_0x4f5c79[_0x8c4b('0x1a')];this[_0x8c4b('0x1b')]=moment()[_0x8c4b('0x1c')](_0x8c4b('0x1d'));this['ringtime']=getSeconds(_0x4f5c79[_0x8c4b('0x19')],_0x4f5c79['starttime']);this[_0x8c4b('0x1e')]=getSeconds(_0x4f5c79['answertime'],_0x4f5c79[_0x8c4b('0x19')]);this[_0x8c4b('0x1f')]=getSeconds(this[_0x8c4b('0x1b')],_0x4f5c79['answertime']);this['queue']=_0xb9fcb9[_0x8c4b('0xa')];this[_0x8c4b('0x20')]=_0xb9fcb9['membername'];this[_0x8c4b('0x21')]=_0xb9fcb9[_0x8c4b('0x21')];this['callback']=_0x4f5c79['callback'];this[_0x8c4b('0x22')]=_0x4f5c79[_0x8c4b('0x22')];this[_0x8c4b('0x23')]=_0x4f5c79[_0x8c4b('0x23')];this[_0x8c4b('0x24')]=_0x4f5c79[_0x8c4b('0x24')];this['ContactId']=_0x4f5c79[_0x8c4b('0x25')];this[_0x8c4b('0x26')]=_0x4f5c79['ListId'];this[_0x8c4b('0x27')]=_0x4f5c79[_0x8c4b('0x27')];this[_0x8c4b('0x28')]=_0x4f5c79[_0x8c4b('0x28')];this[_0x8c4b('0x29')]=_0x4f5c79[_0x8c4b('0x29')];this[_0x8c4b('0x2a')]=_0x4f5c79[_0x8c4b('0x2a')]||'';this[_0x8c4b('0x2b')]=_0x4f5c79[_0x8c4b('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xdca9=['holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2e1be2,_0x110634){var _0x253dd6=function(_0x2dc60b){while(--_0x2dc60b){_0x2e1be2['push'](_0x2e1be2['shift']());}};_0x253dd6(++_0x110634);}(_0xdca9,0x129));var _0x9dca=function(_0x4b8d20,_0x45b36e){_0x4b8d20=_0x4b8d20-0x0;var _0x4913ff=_0xdca9[_0x4b8d20];return _0x4913ff;};'use strict';var util=require(_0x9dca('0x0'));var _=require(_0x9dca('0x1'));var moment=require(_0x9dca('0x2'));function getSeconds(_0x27f9cf,_0x181c5d){var _0xdeb88b=moment(_0x27f9cf)[_0x9dca('0x3')](0x0);var _0x4440fd=moment(_0x181c5d)[_0x9dca('0x3')](0x0);return _0xdeb88b[_0x9dca('0x4')](_0x4440fd,'seconds');}function AgentComplete(_0x474204,_0x259a59){this[_0x9dca('0x5')]=0x4;this[_0x9dca('0x6')]='Answer';this[_0x9dca('0x7')]=_0x474204[_0x9dca('0x7')];this['type']=_0x474204[_0x9dca('0x8')];this[_0x9dca('0x9')]=_0x474204['type']===_0x9dca('0xa')?_0x9dca('0xb'):_0x474204['type'];this[_0x9dca('0xc')]=_0x474204['countbusyretry'];this[_0x9dca('0xd')]=_0x474204[_0x9dca('0xd')];this[_0x9dca('0xe')]=_0x474204[_0x9dca('0xe')];this[_0x9dca('0xf')]=_0x474204[_0x9dca('0xc')]+_0x474204['countcongestionretry']+_0x474204[_0x9dca('0xe')]+_0x474204[_0x9dca('0x10')]+_0x474204[_0x9dca('0x11')]+_0x474204[_0x9dca('0x12')]+_0x474204[_0x9dca('0x13')]+_0x474204[_0x9dca('0x14')];this[_0x9dca('0x10')]=_0x474204[_0x9dca('0x10')];this[_0x9dca('0x11')]=_0x474204[_0x9dca('0x11')];this[_0x9dca('0x12')]=_0x474204[_0x9dca('0x12')];this[_0x9dca('0x13')]=_0x474204['countmachineretry'];this[_0x9dca('0x14')]=_0x474204[_0x9dca('0x14')];this[_0x9dca('0x15')]=_0x259a59[_0x9dca('0x15')];this[_0x9dca('0x16')]=_0x474204[_0x9dca('0x17')];this[_0x9dca('0x18')]=_0x474204[_0x9dca('0x19')];this['starttime']=_0x474204[_0x9dca('0x1a')];this[_0x9dca('0x1b')]=_0x474204[_0x9dca('0x1b')];this[_0x9dca('0x1c')]=_0x474204['answertime'];this[_0x9dca('0x1d')]=moment()[_0x9dca('0x1e')](_0x9dca('0x1f'));this['ringtime']=getSeconds(_0x474204[_0x9dca('0x1b')],_0x474204['starttime']);this[_0x9dca('0x20')]=getSeconds(_0x474204[_0x9dca('0x1c')],_0x474204['responsetime']);this['talktime']=getSeconds(this[_0x9dca('0x1d')],_0x474204['answertime']);this['queue']=_0x259a59['queue'];this[_0x9dca('0x21')]=_0x259a59[_0x9dca('0x21')];this[_0x9dca('0x22')]=_0x259a59[_0x9dca('0x22')];this[_0x9dca('0x23')]=_0x474204[_0x9dca('0x23')];this['callbackuniqueid']=_0x474204[_0x9dca('0x24')];this[_0x9dca('0x25')]=_0x474204['callbackat'];this[_0x9dca('0x26')]=_0x474204['recallme'];this[_0x9dca('0x27')]=_0x474204[_0x9dca('0x27')];this[_0x9dca('0x28')]=_0x474204['ListId'];this[_0x9dca('0x29')]=_0x474204[_0x9dca('0x29')];this[_0x9dca('0x2a')]=_0x474204[_0x9dca('0x2a')];this[_0x9dca('0x2b')]=_0x474204[_0x9dca('0x2b')];this[_0x9dca('0x2c')]=_0x474204[_0x9dca('0x2c')]||'';this[_0x9dca('0x2d')]=_0x474204[_0x9dca('0x2d')]||'';}module[_0x9dca('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 622ea54..eb50e1e 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5089=['originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5089,0x1bb));var _0x9508=function(_0x1e7f4d,_0x20acaa){_0x1e7f4d=_0x1e7f4d-0x0;var _0x5f0fd9=_0x5089[_0x1e7f4d];return _0x5f0fd9;};'use strict';var util=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var moment=require('moment');function getSeconds(_0x2d60c7,_0x35878a){var _0x7dd13d=moment(_0x2d60c7)[_0x9508('0x2')](0x0);var _0x172549=moment(_0x35878a)['milliseconds'](0x0);return _0x7dd13d[_0x9508('0x3')](_0x172549,'seconds');}function Final(_0x3d6516){this[_0x9508('0x4')]=_0x3d6516[_0x9508('0x4')];this['scheduledat']=_0x3d6516[_0x9508('0x5')];this[_0x9508('0x6')]=_0x3d6516['type'];this[_0x9508('0x7')]=_0x3d6516[_0x9508('0x6')]==='outbound'?_0x9508('0x8'):_0x3d6516['type'];this[_0x9508('0x9')]=_0x3d6516[_0x9508('0x9')];this[_0x9508('0xa')]=_0x3d6516[_0x9508('0xa')];this[_0x9508('0xb')]=_0x3d6516[_0x9508('0xb')];this['countglobal']=_0x3d6516[_0x9508('0x9')]+_0x3d6516['countcongestionretry']+_0x3d6516[_0x9508('0xb')]+_0x3d6516[_0x9508('0xc')]+_0x3d6516['countdropretry']+_0x3d6516[_0x9508('0xd')]+_0x3d6516[_0x9508('0xe')]+_0x3d6516[_0x9508('0xf')];this[_0x9508('0xc')]=_0x3d6516['countnosuchnumberretry'];this[_0x9508('0x10')]=_0x3d6516[_0x9508('0x10')];this['countabandonedretry']=_0x3d6516[_0x9508('0xd')];this['countmachineretry']=_0x3d6516[_0x9508('0xe')];this[_0x9508('0xf')]=_0x3d6516[_0x9508('0xf')];this[_0x9508('0x8')]=_0x3d6516[_0x9508('0x8')];this[_0x9508('0x11')]=_0x3d6516[_0x9508('0x11')];this[_0x9508('0x12')]=_0x3d6516['calleridnum'];this[_0x9508('0x13')]=_0x3d6516[_0x9508('0x13')];this[_0x9508('0x14')]=_0x3d6516[_0x9508('0x14')];this[_0x9508('0x15')]=_0x3d6516[_0x9508('0x14')];this['ringtime']=_0x3d6516['ringtime']||0x0;this[_0x9508('0x16')]=_0x3d6516['holdtime']||0x0;this[_0x9508('0x17')]=_0x3d6516['talktime']||0x0;this[_0x9508('0x18')]=_0x3d6516[_0x9508('0x18')];this[_0x9508('0x19')]=_0x3d6516[_0x9508('0x19')];this[_0x9508('0x1a')]=_0x3d6516[_0x9508('0x1a')];this[_0x9508('0x1b')]=_0x3d6516['recallme'];this['ContactId']=_0x3d6516[_0x9508('0x1c')];this[_0x9508('0x1d')]=_0x3d6516[_0x9508('0x1d')];this[_0x9508('0x1e')]=_0x3d6516[_0x9508('0x1e')];this[_0x9508('0x1f')]=_0x3d6516['VoiceQueueId'];this['CampaignId']=_0x3d6516[_0x9508('0x20')];this['originatecalleridnum']=_0x3d6516['originatecalleridnum']||'';this[_0x9508('0x21')]=_0x3d6516['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0x04de=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ListId','UserId'];(function(_0x51295c,_0x4004e5){var _0x3faa89=function(_0x1826da){while(--_0x1826da){_0x51295c['push'](_0x51295c['shift']());}};_0x3faa89(++_0x4004e5);}(_0x04de,0x107));var _0xe04d=function(_0x393cde,_0x44b2f3){_0x393cde=_0x393cde-0x0;var _0x3a09af=_0x04de[_0x393cde];return _0x3a09af;};'use strict';var util=require(_0xe04d('0x0'));var _=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));function getSeconds(_0x299552,_0x1e650d){var _0x28f63f=moment(_0x299552)[_0xe04d('0x3')](0x0);var _0x43c4b1=moment(_0x1e650d)[_0xe04d('0x3')](0x0);return _0x28f63f[_0xe04d('0x4')](_0x43c4b1,_0xe04d('0x5'));}function Final(_0x4804c8){this['uniqueid']=_0x4804c8['uniqueid'];this['scheduledat']=_0x4804c8[_0xe04d('0x6')];this[_0xe04d('0x7')]=_0x4804c8[_0xe04d('0x7')];this[_0xe04d('0x8')]=_0x4804c8[_0xe04d('0x7')]===_0xe04d('0x9')?_0xe04d('0xa'):_0x4804c8[_0xe04d('0x7')];this['countbusyretry']=_0x4804c8[_0xe04d('0xb')];this[_0xe04d('0xc')]=_0x4804c8[_0xe04d('0xc')];this[_0xe04d('0xd')]=_0x4804c8[_0xe04d('0xd')];this[_0xe04d('0xe')]=_0x4804c8[_0xe04d('0xb')]+_0x4804c8[_0xe04d('0xc')]+_0x4804c8[_0xe04d('0xd')]+_0x4804c8['countnosuchnumberretry']+_0x4804c8[_0xe04d('0xf')]+_0x4804c8[_0xe04d('0x10')]+_0x4804c8[_0xe04d('0x11')]+_0x4804c8[_0xe04d('0x12')];this[_0xe04d('0x13')]=_0x4804c8[_0xe04d('0x13')];this[_0xe04d('0xf')]=_0x4804c8[_0xe04d('0xf')];this[_0xe04d('0x10')]=_0x4804c8[_0xe04d('0x10')];this[_0xe04d('0x11')]=_0x4804c8[_0xe04d('0x11')];this['countagentrejectretry']=_0x4804c8[_0xe04d('0x12')];this['queue']=_0x4804c8[_0xe04d('0xa')];this['calleridname']=_0x4804c8[_0xe04d('0x14')];this[_0xe04d('0x15')]=_0x4804c8[_0xe04d('0x15')];this[_0xe04d('0x16')]=_0x4804c8[_0xe04d('0x16')];this[_0xe04d('0x17')]=_0x4804c8[_0xe04d('0x17')];this[_0xe04d('0x18')]=_0x4804c8[_0xe04d('0x17')];this['ringtime']=_0x4804c8[_0xe04d('0x19')]||0x0;this[_0xe04d('0x1a')]=_0x4804c8[_0xe04d('0x1a')]||0x0;this[_0xe04d('0x1b')]=_0x4804c8[_0xe04d('0x1b')]||0x0;this[_0xe04d('0x1c')]=_0x4804c8['callback'];this[_0xe04d('0x1d')]=_0x4804c8[_0xe04d('0x1d')];this['callbackat']=_0x4804c8['callbackat'];this['recallme']=_0x4804c8[_0xe04d('0x1e')];this['ContactId']=_0x4804c8['ContactId'];this[_0xe04d('0x1f')]=_0x4804c8[_0xe04d('0x1f')];this['UserId']=_0x4804c8[_0xe04d('0x20')];this['VoiceQueueId']=_0x4804c8[_0xe04d('0x21')];this['CampaignId']=_0x4804c8[_0xe04d('0x22')];this[_0xe04d('0x23')]=_0x4804c8[_0xe04d('0x23')]||'';this[_0xe04d('0x24')]=_0x4804c8[_0xe04d('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 199dbcf..34b98fe 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x285e=['endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','milliseconds','diff','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime'];(function(_0x10cc81,_0x172700){var _0x3bbe1e=function(_0x319ed2){while(--_0x319ed2){_0x10cc81['push'](_0x10cc81['shift']());}};_0x3bbe1e(++_0x172700);}(_0x285e,0x16d));var _0xe285=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x285e[_0x87b0ff];return _0x3bc0b2;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe285('0x0'));function getSeconds(_0x368f80,_0x2bac65){var _0x2b9606=moment(_0x368f80)[_0xe285('0x1')](0x0);var _0x51af94=moment(_0x2bac65)[_0xe285('0x1')](0x0);return _0x2b9606[_0xe285('0x2')](_0x51af94,'seconds');}function Hangup(_0x538ec7,_0x4b731f){this[_0xe285('0x3')]=0x4;this['statedesc']=_0xe285('0x4');this[_0xe285('0x5')]=_0x538ec7[_0xe285('0x5')];this[_0xe285('0x6')]=_0x538ec7[_0xe285('0x6')];this['campaigntype']=_0x538ec7['type']===_0xe285('0x7')?_0xe285('0x8'):_0x538ec7[_0xe285('0x6')];this[_0xe285('0x9')]=_0x538ec7[_0xe285('0x9')];this['countcongestionretry']=_0x538ec7['countcongestionretry'];this['countnoanswerretry']=_0x538ec7[_0xe285('0xa')];this[_0xe285('0xb')]=_0x538ec7[_0xe285('0x9')]+_0x538ec7[_0xe285('0xc')]+_0x538ec7['countnoanswerretry']+_0x538ec7[_0xe285('0xd')]+_0x538ec7[_0xe285('0xe')]+_0x538ec7[_0xe285('0xf')]+_0x538ec7[_0xe285('0x10')]+_0x538ec7[_0xe285('0x11')];this[_0xe285('0xd')]=_0x538ec7['countnosuchnumberretry'];this[_0xe285('0xe')]=_0x538ec7[_0xe285('0xe')];this[_0xe285('0xf')]=_0x538ec7[_0xe285('0xf')];this['countmachineretry']=_0x538ec7[_0xe285('0x10')];this['countagentrejectretry']=_0x538ec7[_0xe285('0x11')];this[_0xe285('0x12')]=_0x4b731f['uniqueid'];this['calleridname']=_0x538ec7['name'];this[_0xe285('0x13')]=_0x538ec7['number'];this['starttime']=_0x538ec7[_0xe285('0x14')];this[_0xe285('0x15')]=_0x538ec7[_0xe285('0x15')];this['endtime']=moment()['format'](_0xe285('0x16'));this['ringtime']=getSeconds(_0x538ec7['responsetime'],_0x538ec7[_0xe285('0x14')]);this[_0xe285('0x17')]=0x0;this[_0xe285('0x18')]=getSeconds(this[_0xe285('0x19')],_0x538ec7[_0xe285('0x15')]);this[_0xe285('0x8')]=_0x538ec7[_0xe285('0x8')];this[_0xe285('0x1a')]=_0xe285('0x1b');this[_0xe285('0x1c')]=_0x4b731f[_0xe285('0x1d')];this[_0xe285('0x1e')]=_0x538ec7[_0xe285('0x1e')];this[_0xe285('0x1f')]=_0x538ec7['callbackuniqueid'];this[_0xe285('0x20')]=_0x538ec7[_0xe285('0x20')];this[_0xe285('0x21')]=_0x538ec7[_0xe285('0x21')];this[_0xe285('0x22')]=_0x538ec7['ContactId'];this['ListId']=_0x538ec7[_0xe285('0x23')];this[_0xe285('0x24')]=_0x538ec7[_0xe285('0x24')];this[_0xe285('0x25')]=_0x538ec7[_0xe285('0x25')];this[_0xe285('0x26')]=_0x538ec7['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x4b28=['CampaignId','exports','util','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','starttime','holdtime','talktime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4cfbbc,_0xd5ead8){var _0x1a0e21=function(_0x414cb6){while(--_0x414cb6){_0x4cfbbc['push'](_0x4cfbbc['shift']());}};_0x1a0e21(++_0xd5ead8);}(_0x4b28,0xa6));var _0x84b2=function(_0x6bddc3,_0x36563e){_0x6bddc3=_0x6bddc3-0x0;var _0x868581=_0x4b28[_0x6bddc3];return _0x868581;};'use strict';var util=require(_0x84b2('0x0'));var _=require('lodash');var moment=require(_0x84b2('0x1'));function getSeconds(_0x691e41,_0x5751a8){var _0x5344f0=moment(_0x691e41)[_0x84b2('0x2')](0x0);var _0x91f14e=moment(_0x5751a8)['milliseconds'](0x0);return _0x5344f0['diff'](_0x91f14e,_0x84b2('0x3'));}function Hangup(_0x30644d,_0xcadf6c){this[_0x84b2('0x4')]=0x4;this[_0x84b2('0x5')]=_0x84b2('0x6');this[_0x84b2('0x7')]=_0x30644d['scheduledat'];this['type']=_0x30644d[_0x84b2('0x8')];this['campaigntype']=_0x30644d[_0x84b2('0x8')]==='outbound'?_0x84b2('0x9'):_0x30644d[_0x84b2('0x8')];this[_0x84b2('0xa')]=_0x30644d['countbusyretry'];this['countcongestionretry']=_0x30644d['countcongestionretry'];this[_0x84b2('0xb')]=_0x30644d[_0x84b2('0xb')];this[_0x84b2('0xc')]=_0x30644d[_0x84b2('0xa')]+_0x30644d['countcongestionretry']+_0x30644d[_0x84b2('0xb')]+_0x30644d[_0x84b2('0xd')]+_0x30644d['countdropretry']+_0x30644d[_0x84b2('0xe')]+_0x30644d[_0x84b2('0xf')]+_0x30644d[_0x84b2('0x10')];this[_0x84b2('0xd')]=_0x30644d[_0x84b2('0xd')];this['countdropretry']=_0x30644d[_0x84b2('0x11')];this[_0x84b2('0xe')]=_0x30644d[_0x84b2('0xe')];this[_0x84b2('0xf')]=_0x30644d[_0x84b2('0xf')];this[_0x84b2('0x10')]=_0x30644d['countagentrejectretry'];this[_0x84b2('0x12')]=_0xcadf6c[_0x84b2('0x12')];this['calleridname']=_0x30644d[_0x84b2('0x13')];this[_0x84b2('0x14')]=_0x30644d[_0x84b2('0x15')];this['starttime']=_0x30644d['starttime'];this[_0x84b2('0x16')]=_0x30644d[_0x84b2('0x16')];this[_0x84b2('0x17')]=moment()[_0x84b2('0x18')](_0x84b2('0x19'));this['ringtime']=getSeconds(_0x30644d[_0x84b2('0x16')],_0x30644d[_0x84b2('0x1a')]);this[_0x84b2('0x1b')]=0x0;this[_0x84b2('0x1c')]=getSeconds(this['endtime'],_0x30644d[_0x84b2('0x16')]);this[_0x84b2('0x9')]=_0x30644d[_0x84b2('0x9')];this[_0x84b2('0x1d')]=_0x84b2('0x1e');this['reason']=_0xcadf6c['cause-txt'];this['callback']=_0x30644d[_0x84b2('0x1f')];this[_0x84b2('0x20')]=_0x30644d[_0x84b2('0x20')];this[_0x84b2('0x21')]=_0x30644d[_0x84b2('0x21')];this[_0x84b2('0x22')]=_0x30644d[_0x84b2('0x22')];this[_0x84b2('0x23')]=_0x30644d[_0x84b2('0x23')];this[_0x84b2('0x24')]=_0x30644d['ListId'];this[_0x84b2('0x25')]=_0x30644d['UserId'];this['VoiceQueueId']=_0x30644d[_0x84b2('0x26')];this[_0x84b2('0x27')]=_0x30644d[_0x84b2('0x27')];}module[_0x84b2('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9750a74..0b2be05 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6263=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x6263,0x1cb));var _0x3626=function(_0x3855f4,_0x16073b){_0x3855f4=_0x3855f4-0x0;var _0x3d4e63=_0x6263[_0x3855f4];return _0x3d4e63;};'use strict';var util=require(_0x3626('0x0'));var _=require(_0x3626('0x1'));var moment=require(_0x3626('0x2'));function getSeconds(_0x170e0a,_0x296010){var _0x39ea34=moment(_0x170e0a)[_0x3626('0x3')](0x0);var _0x3e0376=moment(_0x296010)[_0x3626('0x3')](0x0);return _0x39ea34['diff'](_0x3e0376,'seconds');}function History(_0x12a67c){this[_0x3626('0x4')]=_0x12a67c[_0x3626('0x4')];this['scheduledat']=_0x12a67c[_0x3626('0x5')]||undefined;this[_0x3626('0x6')]=_0x12a67c[_0x3626('0x6')];this[_0x3626('0x7')]=_0x12a67c[_0x3626('0x6')]===_0x3626('0x8')?'queue':_0x12a67c[_0x3626('0x6')];this[_0x3626('0x9')]=_0x12a67c[_0x3626('0x9')];this[_0x3626('0xa')]=_0x12a67c[_0x3626('0xa')];this[_0x3626('0xb')]=_0x12a67c[_0x3626('0xb')];this[_0x3626('0xc')]=_0x12a67c[_0x3626('0x9')]+_0x12a67c['countcongestionretry']+_0x12a67c[_0x3626('0xb')]+_0x12a67c[_0x3626('0xd')]+_0x12a67c[_0x3626('0xe')]+_0x12a67c['countabandonedretry']+_0x12a67c[_0x3626('0xf')]+_0x12a67c[_0x3626('0x10')];this[_0x3626('0xd')]=_0x12a67c[_0x3626('0xd')];this['countdropretry']=_0x12a67c[_0x3626('0xe')];this[_0x3626('0x11')]=_0x12a67c[_0x3626('0x11')];this['countmachineretry']=_0x12a67c[_0x3626('0xf')];this['countagentrejectretry']=_0x12a67c[_0x3626('0x10')];this[_0x3626('0x12')]=_0x12a67c['queue'];this[_0x3626('0x13')]=_0x12a67c[_0x3626('0x14')];this[_0x3626('0x15')]=_0x12a67c[_0x3626('0x16')];this['starttime']=_0x12a67c[_0x3626('0x17')];this['responsetime']=_0x12a67c[_0x3626('0x18')];this[_0x3626('0x19')]=_0x12a67c['responsetime'];this[_0x3626('0x1a')]=getSeconds(_0x12a67c[_0x3626('0x18')],_0x12a67c[_0x3626('0x17')]);this['holdtime']=0x0;this[_0x3626('0x1b')]=0x0;this['callback']=_0x12a67c[_0x3626('0x1c')];this[_0x3626('0x1d')]=_0x12a67c[_0x3626('0x1d')];this[_0x3626('0x1e')]=_0x12a67c[_0x3626('0x1e')];this['recallme']=_0x12a67c[_0x3626('0x1f')];this[_0x3626('0x20')]=_0x12a67c[_0x3626('0x20')];this[_0x3626('0x21')]=_0x12a67c[_0x3626('0x21')];this['UserId']=_0x12a67c['UserId'];this[_0x3626('0x22')]=_0x12a67c['VoiceQueueId'];this[_0x3626('0x23')]=_0x12a67c[_0x3626('0x23')];this[_0x3626('0x24')]=_0x12a67c[_0x3626('0x24')]||'';this[_0x3626('0x25')]=_0x12a67c[_0x3626('0x25')]||'';}module[_0x3626('0x26')]=History; \ No newline at end of file +var _0x6097=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6097,0x8d));var _0x7609=function(_0xe775be,_0x4822af){_0xe775be=_0xe775be-0x0;var _0x49e73c=_0x6097[_0xe775be];return _0x49e73c;};'use strict';var util=require(_0x7609('0x0'));var _=require('lodash');var moment=require(_0x7609('0x1'));function getSeconds(_0x833834,_0x30420c){var _0xee53ad=moment(_0x833834)[_0x7609('0x2')](0x0);var _0x5685d9=moment(_0x30420c)['milliseconds'](0x0);return _0xee53ad[_0x7609('0x3')](_0x5685d9,'seconds');}function History(_0x524454){this[_0x7609('0x4')]=_0x524454[_0x7609('0x4')];this[_0x7609('0x5')]=_0x524454[_0x7609('0x5')]||undefined;this[_0x7609('0x6')]=_0x524454[_0x7609('0x6')];this[_0x7609('0x7')]=_0x524454['type']===_0x7609('0x8')?_0x7609('0x9'):_0x524454[_0x7609('0x6')];this[_0x7609('0xa')]=_0x524454[_0x7609('0xa')];this['countcongestionretry']=_0x524454[_0x7609('0xb')];this[_0x7609('0xc')]=_0x524454[_0x7609('0xc')];this[_0x7609('0xd')]=_0x524454['countbusyretry']+_0x524454['countcongestionretry']+_0x524454[_0x7609('0xc')]+_0x524454[_0x7609('0xe')]+_0x524454[_0x7609('0xf')]+_0x524454[_0x7609('0x10')]+_0x524454[_0x7609('0x11')]+_0x524454[_0x7609('0x12')];this[_0x7609('0xe')]=_0x524454[_0x7609('0xe')];this[_0x7609('0xf')]=_0x524454[_0x7609('0xf')];this['countabandonedretry']=_0x524454[_0x7609('0x10')];this[_0x7609('0x11')]=_0x524454[_0x7609('0x11')];this['countagentrejectretry']=_0x524454[_0x7609('0x12')];this['queue']=_0x524454[_0x7609('0x9')];this[_0x7609('0x13')]=_0x524454[_0x7609('0x14')];this[_0x7609('0x15')]=_0x524454['number'];this[_0x7609('0x16')]=_0x524454[_0x7609('0x16')];this['responsetime']=_0x524454['responsetime'];this[_0x7609('0x17')]=_0x524454['responsetime'];this[_0x7609('0x18')]=getSeconds(_0x524454['responsetime'],_0x524454['starttime']);this[_0x7609('0x19')]=0x0;this[_0x7609('0x1a')]=0x0;this[_0x7609('0x1b')]=_0x524454[_0x7609('0x1b')];this['callbackuniqueid']=_0x524454[_0x7609('0x1c')];this[_0x7609('0x1d')]=_0x524454[_0x7609('0x1d')];this['recallme']=_0x524454['recallme'];this[_0x7609('0x1e')]=_0x524454[_0x7609('0x1e')];this[_0x7609('0x1f')]=_0x524454[_0x7609('0x1f')];this[_0x7609('0x20')]=_0x524454[_0x7609('0x20')];this[_0x7609('0x21')]=_0x524454[_0x7609('0x21')];this['CampaignId']=_0x524454[_0x7609('0x22')];this[_0x7609('0x23')]=_0x524454[_0x7609('0x23')]||'';this[_0x7609('0x24')]=_0x524454['originatecalleridname']||'';}module[_0x7609('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0f1fbf2..045b8f7 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 _0xa68c=['is\x20disactive','state','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','[actions]','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','syncVarSet','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','TIMEOUT','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','queueCallerAbandonCreateState','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','run','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','content','all','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','online','Agent','user:%s','checkPreviewRecallReminder','checkIfTime','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','NoSuchNumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedRetryFrequency','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./agentComplete','./queueCallerAbandon','env','127.0.0.1','rrmemory','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','emit','type','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','debug','inspect','stack','length','originated','undefined','error','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED'];(function(_0x410f60,_0x400603){var _0x3b47d0=function(_0x4e19f8){while(--_0x4e19f8){_0x410f60['push'](_0x410f60['shift']());}};_0x3b47d0(++_0x400603);}(_0xa68c,0x187));var _0xca68=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa68c[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require(_0xca68('0x0'));var _=require(_0xca68('0x1'));var BPromise=require(_0xca68('0x2'));var uuid=require(_0xca68('0x3'));var moment=require(_0xca68('0x4'));var rr=require('rr');var md5=require(_0xca68('0x5'));var Redis=require(_0xca68('0x6'));var ut=require(_0xca68('0x7'));var config=require(_0xca68('0x8'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xca68('0x9'))('booked');var loggerPredictive=require(_0xca68('0x9'))(_0xca68('0xa'));var loggerPredictiveCalls=require(_0xca68('0x9'))(_0xca68('0xb'));var loggerSyncQueueSummary=require(_0xca68('0x9'))(_0xca68('0xc'));var ami=require(_0xca68('0xd'));config[_0xca68('0xe')]=_[_0xca68('0xf')](config[_0xca68('0xe')],{'host':_0xca68('0x10'),'port':0x18eb});var io=require(_0xca68('0x11'))(new Redis(config[_0xca68('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0xca68('0x12'));var cmHopperAdditionalPhone=require(_0xca68('0x13'));var cmHopperBlack=require(_0xca68('0x14'));var voiceQueueRt=require(_0xca68('0x15'));var RpcSetting=require(_0xca68('0x16'));var Action=require(_0xca68('0x17'));var History=require('./history');var Final=require(_0xca68('0x18'));var AgentComplete=require(_0xca68('0x19'));var QueueCallerAbandon=require(_0xca68('0x1a'));var Hangup=require('./hangup');var ipAgi=process[_0xca68('0x1b')]['XCALLY_IP_AGI']||_0xca68('0x1c');var strategy={'rrmemory':_0xca68('0x1d'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xca68('0x1e')]=function(_0x252712){this[_0xca68('0x1f')]=this[_0xca68('0x1f')]?this[_0xca68('0x1f')][_0xca68('0x20')](_0x252712):_0x252712();};function Dialer(_0x44a9dc,_0x3fda43){this[_0xca68('0x21')]=new Sequence();this[_0xca68('0x22')]=_0x3fda43;this[_0xca68('0x23')]=_0x44a9dc[_0xca68('0x23')];this[_0xca68('0x24')]=_0x44a9dc[_0xca68('0x24')];this[_0xca68('0x25')]=_0x44a9dc[_0xca68('0x25')];this['trunks']=_0x44a9dc[_0xca68('0x26')];this['maxNumberOriginate']=config[_0xca68('0x27')]||0x2;this[_0xca68('0x28')]={};this[_0xca68('0x29')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0xca68('0x2a')]={};this[_0xca68('0x2b')]={};this[_0xca68('0x2c')]={};this[_0xca68('0x2d')]={};this[_0xca68('0x2e')]={};ami['on'](_0xca68('0x2f'),this[_0xca68('0x30')]['bind'](this));ami['on'](_0xca68('0x31'),this[_0xca68('0x32')][_0xca68('0x33')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xca68('0x33')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xca68('0x33')](this));ami['on']('custom:queuesummary',this[_0xca68('0xc')][_0xca68('0x33')](this));ami['on'](_0xca68('0x34'),this['syncQueueSummaryComplete'][_0xca68('0x33')](this));ami['on'](_0xca68('0x35'),this[_0xca68('0x36')][_0xca68('0x33')](this));ami['on'](_0xca68('0x37'),this[_0xca68('0x38')][_0xca68('0x33')](this));ami['on'](_0xca68('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0xca68('0x3a'),this['syncQueueMember'][_0xca68('0x33')](this));ami['on'](_0xca68('0x3b'),this[_0xca68('0x3c')][_0xca68('0x33')](this));this[_0xca68('0x3d')]();this[_0xca68('0x3e')]();RpcSetting[_0xca68('0x3f')]()['then'](function(_0xb32707){previewRecallmeReminderInterval=_0xb32707[_0xca68('0x40')];});}function isNotNull(_0x264e34){return _0x264e34!==null&&!_[_0xca68('0x41')](_0x264e34);}function checkIsLoggedIn(_0x42fc47,_0x1383dc){return function(){if(_0x1383dc<=0x0){_0x42fc47[_0xca68('0x42')]='AGENTS_NOT_LOGGED';throw _0x42fc47['name']+_0xca68('0x43');}};}function isActive(_0x3cdbd3){return _0x3cdbd3;}function checkIsActive(_0x5233d7,_0xc4012c){return function(){if(!isActive(_0xc4012c)){_0x5233d7[_0xca68('0x42')]='NOT_ACTIVE';throw _0x5233d7['name']+_0xca68('0x44');}};}function checkInterval(_0x415246){return function(){if(!isNotNull(_0x415246[_0xca68('0x45')])){_0x415246[_0xca68('0x42')]=_0xca68('0x46');throw _0x415246[_0xca68('0x47')]+_0xca68('0x48');}if(!isNotNull(_0x415246[_0xca68('0x45')][_0xca68('0x49')])){_0x415246[_0xca68('0x42')]=_0xca68('0x46');throw _0x415246['name']+_0xca68('0x48');}if(!isNotNull(_[_0xca68('0x4a')](_0x415246[_0xca68('0x45')][_0xca68('0x49')]))){_0x415246[_0xca68('0x42')]=_0xca68('0x46');throw _0x415246['name']+_0xca68('0x48');}};}function msgResponse(_0x66c053,_0x489e99,_0x56ac2d){return{'action':_0x66c053,'response':_0x489e99,'message':_0x56ac2d,'stack':_0x56ac2d};}function myreject(_0x532807){return function(_0x2bde21){return _0x532807(msgResponse(_0xca68('0x4b'),'Error',JSON[_0xca68('0x4c')](_0x2bde21)));};}function getSeconds(_0x3d3333,_0x70e5ad){var _0x1a8cd9=moment(_0x3d3333)[_0xca68('0x4d')](0x0);var _0x4ab21e=moment(_0x70e5ad)[_0xca68('0x4d')](0x0);return _0x1a8cd9[_0xca68('0x4e')](_0x4ab21e,'seconds');}function emit(_0x1f5f89,_0x1ef265,_0x3fd9dd){io['to'](_0x1f5f89)[_0xca68('0x4f')](_0x1ef265,_0x3fd9dd);}function emitVoiceQueueSummary(_0xc49648){if(_0xc49648[_0xca68('0x50')]==='outbound'){var _0x4ba804={'id':_0xc49648['id'],'name':_0xc49648['name'],'strategy':_0xc49648[_0xca68('0x51')],'answered':_0xc49648['answered'],'available':_0xc49648[_0xca68('0x52')],'loggedIn':_0xc49648[_0xca68('0x53')],'pTalking':_0xc49648['pTalking'],'sumBillable':_0xc49648[_0xca68('0x54')],'sumDuration':_0xc49648[_0xca68('0x55')],'sumHoldTime':_0xc49648[_0xca68('0x56')]||0x0,'talking':_0xc49648[_0xca68('0x57')],'total':_0xc49648[_0xca68('0x58')],'type':_0xc49648[_0xca68('0x50')],'unmanaged':_0xc49648[_0xca68('0x59')],'abandoned':_0xc49648['abandoned'],'waiting':_0xc49648['waiting'],'loggedInDb':_0xc49648[_0xca68('0x5a')],'dialActive':_0xc49648[_0xca68('0x5b')],'dialMethod':_0xc49648[_0xca68('0x5c')],'dialOriginateCallerIdName':_0xc49648[_0xca68('0x5d')],'dialOriginateCallerIdNumber':_0xc49648[_0xca68('0x5e')],'dialOriginateTimeout':_0xc49648[_0xca68('0x5f')],'dialPrefix':_0xc49648['dialPrefix'],'outboundAnswerAgiCallsDay':_0xc49648[_0xca68('0x60')],'outboundAnswerCallsDay':_0xc49648[_0xca68('0x61')],'outboundBlacklistCallsDay':_0xc49648[_0xca68('0x62')],'outboundBusyCallsDay':_0xc49648['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xc49648[_0xca68('0x63')],'outboundDropCallsDayACS':_0xc49648[_0xca68('0x64')],'outboundDropCallsDayCallersExit':_0xc49648[_0xca68('0x65')],'outboundDropCallsDayTimeout':_0xc49648[_0xca68('0x66')],'outboundNoAnswerCallsDay':_0xc49648[_0xca68('0x67')],'outboundNoSuchCallsDay':_0xc49648[_0xca68('0x68')],'outboundOriginateFailureCallsDay':_0xc49648['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xc49648[_0xca68('0x69')],'outboundRejectCallsDay':_0xc49648['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xc49648[_0xca68('0x6a')],'predictiveIntervalAnsweredCalls':_0xc49648['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xc49648[_0xca68('0x6b')],'predictiveIntervalAvgTalktime':_0xc49648[_0xca68('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0xc49648[_0xca68('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0xc49648['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xc49648[_0xca68('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0xc49648[_0xca68('0x6f')],'predictiveIntervalHitRate':_0xc49648[_0xca68('0x70')],'predictiveIntervalMultiplicativeFactor':_0xc49648['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xc49648[_0xca68('0x71')],'predictiveIntervalAvailable':_0xc49648[_0xca68('0x72')],'predictiveIntervalTotalCalls':_0xc49648['predictiveIntervalTotalCalls'],'message':_0xc49648['message'],'originated':_0xc49648['originated'],'erlangCalls':_0xc49648['erlangCalls'],'erlangCallToSecond':_0xc49648[_0xca68('0x73')],'erlangAbandonmentRate':_0xc49648[_0xca68('0x74')],'erlangBusyFactor':_0xc49648[_0xca68('0x75')],'startPredictive':_0xc49648['startPredictive'],'startProgressive':_0xc49648['startProgressive']};if(_0xc49648[_0xca68('0x76')]){_0x4ba804[_0xca68('0x76')]={'id':_0xc49648[_0xca68('0x76')]['id'],'name':_0xc49648[_0xca68('0x76')][_0xca68('0x47')],'active':_0xc49648[_0xca68('0x76')][_0xca68('0x77')],'callerid':_0xc49648[_0xca68('0x76')]['callerid']};}if(_0xc49648['Interval']){_0x4ba804[_0xca68('0x45')]={'id':_0xc49648[_0xca68('0x45')]['id'],'name':_0xc49648['Interval']['name']};}var _0x1a5860=md5(JSON['stringify'](_0x4ba804));if(_0xc49648[_0xca68('0x5')]!==_0x1a5860){_0xc49648[_0xca68('0x5')]=_0x1a5860;emit(util['format']('voice:queue:%s',_0x4ba804['name']),_0xca68('0x78'),_0x4ba804);}}}function emitCampaignSummary(_0x1b44ff){if(_0x1b44ff['type']===_0xca68('0x79')){emit(util[_0xca68('0x7a')](_0xca68('0x7b'),_0x1b44ff[_0xca68('0x47')]),_0xca68('0x7c'),_0x1b44ff);}}function checkGetDataPredictive(_0x414c62){if(isNotNull(_0x414c62)&&!_[_0xca68('0x4a')](_0x414c62)){loggerPredictive[_0xca68('0x7d')](_0xca68('0x7e'));loggerPredictive[_0xca68('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x414c62[_0xca68('0x7f')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x80'),_0x414c62[_0xca68('0x81')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x82'),_0x414c62['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xca68('0x7d')](_0xca68('0x83'),_0x414c62[_0xca68('0x6d')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x84'),_0x414c62[_0xca68('0x6b')]);loggerPredictive['info'](_0xca68('0x85'),_0x414c62[_0xca68('0x6c')]);loggerPredictive['info']('---------------------------');if(_0x414c62[_0xca68('0x7f')]>0x0){if(!_[_0xca68('0x41')](_0x414c62['predictiveIntervalAvgTalktime'])&&_0x414c62[_0xca68('0x6c')]>0x0){return!![];}loggerPredictive[_0xca68('0x7d')](_0xca68('0x86'));if(!_['isUndefined'](_0x414c62['predictiveIntervalAvgHoldtime'])&&_0x414c62[_0xca68('0x6b')]>0x0){return!![];}loggerPredictive[_0xca68('0x7d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xca68('0x7d')](_0xca68('0x87'));}}else{loggerPredictive[_0xca68('0x7d')](_0xca68('0x88'));}return![];}function mergeDataErlangB(_0x4854f2){return function(_0x556bfe){loggerPredictive[_0xca68('0x7d')]('---------\x20ErlangB\x20---------');loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x556bfe[_0xca68('0x89')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x8a'),_0x556bfe[_0xca68('0x73')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x8b'),_0x556bfe[_0xca68('0x74')]);loggerPredictive['info'](_0xca68('0x8c'),_0x556bfe['erlangBusyFactor']);loggerPredictive[_0xca68('0x7d')](_0xca68('0x8b'),_0x556bfe[_0xca68('0x74')]);loggerPredictive[_0xca68('0x7d')](_0xca68('0x8d'));_['merge'](_0x4854f2,_0x556bfe);};}function getDiff(_0x4f1de4){var _0x52df6d=moment()[_0xca68('0x4d')](0x0);var _0x1c9cc2=moment(_0x4f1de4)[_0xca68('0x4d')](0x0);return _0x52df6d['diff'](_0x1c9cc2,'seconds');}function ifInterval(_0x28197f,_0x6edd4c){if(_[_0xca68('0x41')](_0x6edd4c)){return![];}return getDiff(_0x6edd4c)<_0x28197f*0x3c;}function freeVariablesPredictive(_0x29afac){if(isNotNull(_0x29afac)){if(!_[_0xca68('0x41')](_0x29afac['startProgressive'])){_0x29afac[_0xca68('0x2b')]=undefined;loggerPredictive[_0xca68('0x7d')](_0x29afac[_0xca68('0x47')],_0xca68('0x8e'));}if(!_[_0xca68('0x41')](_0x29afac[_0xca68('0x2a')])){_0x29afac[_0xca68('0x2a')]=undefined;loggerPredictive[_0xca68('0x7d')](_0x29afac[_0xca68('0x47')],_0xca68('0x8f'));}if(!_['isUndefined'](_0x29afac[_0xca68('0x90')])){clearInterval(_0x29afac[_0xca68('0x90')]);_0x29afac[_0xca68('0x90')]=undefined;loggerPredictive['info'](_0x29afac[_0xca68('0x47')],_0xca68('0x91'));}}}function erlangb(_0x263916,_0x3145f6){if(_0x3145f6===0x0){return 0x0;}var _0x4a5797=0x1;for(var _0x43ce19=0x1;_0x43ce19<=_0x3145f6;_0x43ce19+=0x1){_0x4a5797=0x1+_0x4a5797*_0x43ce19/_0x263916;}return 0x1/_0x4a5797;}function isVoiceQueueOutbound(_0x2e9eaa){return _0x2e9eaa===_0xca68('0x92');}function isNotPreview(_0x410928){return _0x410928!=='preview';}function isCampaignIvr(_0x16bf98){return _0x16bf98===_0xca68('0x79');}function getCallerId(_0x34d9a0,_0x210ffc,_0x5e39a5){if(!_[_0xca68('0x41')](_0x5e39a5)&&typeof _0x5e39a5===_0xca68('0x93')&&!_['isEmpty'](_0x5e39a5)){if(!_['isUndefined'](_0x210ffc)&&typeof _0x210ffc===_0xca68('0x93')&&!_[_0xca68('0x4a')](_0x210ffc)){return util[_0xca68('0x7a')]('\x22%s\x22\x20<%s>',_0x210ffc,_0x5e39a5);}return util[_0xca68('0x7a')]('\x22%s\x22\x20<%s>',_0x5e39a5,_0x5e39a5);}if(!_[_0xca68('0x41')](_0x34d9a0)&&typeof _0x34d9a0===_0xca68('0x93')&&!_['isEmpty'](_0x34d9a0)){return _0x34d9a0;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x379f61,_0x2066a4){return function(_0x5a32ed){freeVariablesPredictive(_0x2066a4);emitVoiceQueueSummary(_0x2066a4);emitCampaignSummary(_0x2066a4);loggerSyncQueueSummary[_0xca68('0x94')](_0x379f61,util[_0xca68('0x95')](_0x5a32ed,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x645396,_0x27f8d9){return function(_0x200803){loggerPredictive['error'](_0x27f8d9['name'],_0x645396);loggerPredictive['error'](_0x200803[_0xca68('0x96')]);freeVariablesPredictive(_0x27f8d9);};}function loggerCatch(_0x30a0ee){return function(_0x2390b3){logger['error'](_0x30a0ee,util['inspect'](_0x2390b3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xc2fc36){return _0xc2fc36&&!_['isUndefined'](_0xc2fc36)&&_0xc2fc36[_0xca68('0x97')]>0x0;}function decremetOriginate(_0x92799c){if(!_[_0xca68('0x41')](_0x92799c)&&_0x92799c!==null){if(typeof _0x92799c[_0xca68('0x98')]!==_0xca68('0x99')){if(_0x92799c[_0xca68('0x98')]>0x0){_0x92799c[_0xca68('0x98')]-=0x1;}else{logger[_0xca68('0x9a')](_0xca68('0x9b'));}}}else{logger[_0xca68('0x9a')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5311bb,_0x12770c,_0x47d071){if(_0x12770c>_0x47d071){for(var _0x36ad60=0x0;_0x36ad60<_0x12770c-_0x47d071;_0x36ad60+=0x1){decremetOriginate(_0x5311bb);}}}function loggerGetContactDialer(_0x1e4797,_0x5a9ee6,_0x1eb407){return function(_0x11b6cb){checkContactLowerLimitOriginate(_0x5a9ee6,_0x1eb407,0x0);logger[_0xca68('0x9a')](_0x1e4797,util['inspect'](_0x11b6cb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x452566){return function(_0x2d605f){if(isNotNull(_0x2d605f)&&isNotNull(_0x2d605f[0x0])){if(_0x2d605f[0x0][_0xca68('0x9c')]>0x0){_0x452566[_0xca68('0x42')]=_0xca68('0x9d');logger['info'](_0xca68('0x9e')+_0x452566[_0xca68('0x47')],_0x2d605f[0x0]['contactsRescheduled'],'contacts');}else{_0x452566[_0xca68('0x42')]=_0xca68('0x9f');logger[_0xca68('0x7d')](_0xca68('0xa0')+_0x452566[_0xca68('0x47')]);}}};}function notSendMessagesQueue(_0x2b4679){if(_0x2b4679[_0xca68('0xa1')]){freeVariablesPredictive(_0x2b4679);if(_0x2b4679[_0xca68('0x98')]===0x0&&_0x2b4679['talking']===0x0&&_0x2b4679[_0xca68('0xa2')]===0x0&&(_0x2b4679['pTalking']||0x0)===0x0){_0x2b4679[_0xca68('0xa1')]=![];_0x2b4679[_0xca68('0x52')]=0x0;_0x2b4679['message']=_0xca68('0xa3');loggerSyncQueueSummary[_0xca68('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2b4679[_0xca68('0x47')],'is\x20not\x20active');}else{_0x2b4679[_0xca68('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0xca68('0xa4'),_0x2b4679['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x2b4679);}}function notSendMessagesCampaign(_0x498db3){if(_0x498db3[_0xca68('0xa1')]){if(_0x498db3[_0xca68('0x98')]===0x0){_0x498db3[_0xca68('0xa1')]=![];_0x498db3['message']=_0xca68('0xa3');loggerSyncQueueSummary[_0xca68('0x94')](_0xca68('0xa5'),_0x498db3['name'],_0xca68('0xa6'));}else{_0x498db3['message']=_0xca68('0xa7');loggerSyncQueueSummary[_0xca68('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x498db3[_0xca68('0x47')],_0xca68('0xa8'));}emitCampaignSummary(_0x498db3);}}function createObjHistory(_0x286781,_0x1756ed,_0x47f2fb,_0x5d2d90,_0x2618db){_0x286781['message']=_0x47f2fb;var _0x18ef3c=new Action(_0x286781,_0x1756ed);var _0x386bab=new History(_0x18ef3c);_0x386bab[_0xca68('0xa9')]=_0x5d2d90;_0x386bab['statedesc']=_0x2618db;_0x386bab['endtime']=_0x18ef3c[_0xca68('0xaa')];return _0x386bab;}Dialer[_0xca68('0xab')]['loopClearZombieChannels']=function(){var _0x2365a0=this;setInterval(function(){_0x2365a0[_0xca68('0xac')](_0x2365a0[_0xca68('0xad')],_0xca68('0xae'));_0x2365a0[_0xca68('0xac')](_0x2365a0['actions'],_0xca68('0xaf'));},0x32c8);};Dialer[_0xca68('0xab')][_0xca68('0xac')]=function(_0x3c5993,_0x53c59d){var _0x3283e1=this;for(var _0x36d37e in _0x3c5993){if(typeof _0x3c5993[_0x36d37e]!==_0xca68('0x99')){this[_0xca68('0x21')][_0xca68('0x1e')](function(){if(!_['isNil'](_0x3c5993[_0x36d37e])){return ami[_0xca68('0xb0')]({'action':'status','channel':_0x3c5993[_0x36d37e][_0xca68('0xb1')]})[_0xca68('0xb2')](function(_0xc53e1d){if(_0xc53e1d[_0xca68('0x42')]===_0xca68('0xb3')){setTimeout(function(){if(_0x3c5993[_0x36d37e]&&_0x3c5993[_0x36d37e][_0xca68('0x50')]!==_0xca68('0x79')){_0x3283e1[_0xca68('0xb4')](_0x3283e1[_0xca68('0x23')][_0x3c5993[_0x36d37e]['queue']]);logger[_0xca68('0x9a')](_0xca68('0xb5'),_0x53c59d,_0x36d37e,_0x3c5993[_0x36d37e][_0xca68('0xb6')]);delete _0x3c5993[_0x36d37e];}if(_0x3c5993[_0x36d37e]&&_0x3c5993[_0x36d37e][_0xca68('0x50')]===_0xca68('0x79')){_0x3283e1['updateOriginated'](_0x3283e1[_0xca68('0x24')][_0x3c5993[_0x36d37e]['queue']]);logger['error'](_0xca68('0xb7'),_0x53c59d,_0x36d37e,_0x3c5993[_0x36d37e][_0xca68('0xb6')]);delete _0x3c5993[_0x36d37e];}},0x2328);}});}});}}};Dialer[_0xca68('0xab')][_0xca68('0xb8')]=function(_0x51f7b0){return BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](cmHopper[_0xca68('0xb8')](_0x51f7b0))[_0xca68('0xb2')](loggerCatch(_0xca68('0xbb')));};Dialer[_0xca68('0xab')]['checkIsBlackList']=function(_0x5ce460){return BPromise['resolve']()['then'](cmHopperBlack[_0xca68('0xbc')](_0x5ce460))[_0xca68('0xb2')](loggerCatch(_0xca68('0xbd')));};Dialer[_0xca68('0xab')][_0xca68('0xbe')]=function(_0x20d5eb,_0x564721,_0x5d79f2){return BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](cmHopperAdditionalPhone[_0xca68('0xbe')](_0x20d5eb,_0x564721,_0x5d79f2))[_0xca68('0xb2')](loggerCatch(_0xca68('0xbf')));};Dialer[_0xca68('0xab')][_0xca68('0xc0')]=function(_0x214654,_0x4efcef,_0x1d1619){return BPromise[_0xca68('0xb9')]()['then'](cmHopperAdditionalPhone[_0xca68('0xc0')](_0x214654,_0x4efcef,_0x1d1619))['catch'](loggerCatch(_0xca68('0xc1')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x51a1ce){return BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](cmHopperBlack[_0xca68('0xc2')](_0x51a1ce))['catch'](loggerCatch(_0xca68('0xc3')));};Dialer[_0xca68('0xab')][_0xca68('0xc4')]=function(_0x748ae){return BPromise['resolve']()['then'](cmHopperHistory[_0xca68('0xc5')](_0x748ae))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xca68('0xab')][_0xca68('0xc6')]=function(_0x75cd55){return BPromise['resolve']()['then'](cmHopper[_0xca68('0xc6')](_0x75cd55))[_0xca68('0xb2')](loggerCatch(_0xca68('0xc7')));};Dialer[_0xca68('0xab')][_0xca68('0xc8')]=function(_0x5ef1dc,_0x1cadcb,_0x400ee3){return BPromise[_0xca68('0xb9')]()['then'](cmHopper[_0xca68('0xc8')](_0x5ef1dc,_0x1cadcb,_0x400ee3))[_0xca68('0xb2')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xca68('0xab')][_0xca68('0xc9')]=function(_0x320fee,_0x28757e,_0x56b291,_0x147f4c,_0x274038){return BPromise[_0xca68('0xb9')]()['then'](cmHopper[_0xca68('0xc9')](_0x320fee,_0x28757e,_0x56b291,_0x147f4c))['catch'](function(_0x228fbf){_0x274038[_0xca68('0xca')]-=_0x56b291;_0x274038[_0xca68('0xca')]=_0x274038['temp']>0x0?_0x274038[_0xca68('0xca')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x228fbf);});};Dialer['prototype'][_0xca68('0xcb')]=function(_0x538cb2,_0x25fca0,_0x3e1056,_0x1f4501){return BPromise[_0xca68('0xb9')]()['then'](cmHopper['getContactDialerIvr'](_0x538cb2,_0x25fca0,_0x3e1056))[_0xca68('0xb2')](function(_0x432ece){_0x1f4501['temp']-=_0x25fca0;_0x1f4501[_0xca68('0xca')]=_0x1f4501[_0xca68('0xca')]>0x0?_0x1f4501[_0xca68('0xca')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x432ece);});};Dialer[_0xca68('0xab')][_0xca68('0xcc')]=function(_0x408e3b){return BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](voiceQueueRt[_0xca68('0xcc')](_0x408e3b))[_0xca68('0xb2')](loggerCatch(_0xca68('0xcd')));};Dialer[_0xca68('0xab')][_0xca68('0xce')]=function(_0x2df7f0){return BPromise[_0xca68('0xb9')]()['then'](cmHopper[_0xca68('0xce')](_0x2df7f0))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xca68('0xcf')]=function(_0x15ae56){return BPromise['resolve']()[_0xca68('0xba')](cmHopperHistory[_0xca68('0xcf')](_0x15ae56))[_0xca68('0xb2')](loggerCatch(_0xca68('0xd0')));};Dialer['prototype']['updateOriginated']=function(_0x4bdb95){if(!_[_0xca68('0x41')](_0x4bdb95)&&_0x4bdb95!==null){if(typeof _0x4bdb95[_0xca68('0x98')]!==_0xca68('0x99')){if(_0x4bdb95[_0xca68('0x98')]>0x0){_0x4bdb95[_0xca68('0x98')]-=0x1;}else{logger[_0xca68('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xca68('0x9a')](_0xca68('0xd1'));}};Dialer[_0xca68('0xab')][_0xca68('0xd2')]=function(_0x16d5df,_0x19f783){var _0x5c8f7f=this;return function(_0x522a6f){_0x5c8f7f[_0xca68('0xb4')](_0x19f783);logger[_0xca68('0x9a')](_0x16d5df,util[_0xca68('0x95')](_0x522a6f,{'showHidden':![],'depth':null}));};};Dialer[_0xca68('0xab')][_0xca68('0xd3')]=function(_0x4af6ef,_0x484a3e,_0x1d7944){var _0x4e1991={'state':0x19,'statedesc':_0xca68('0xd4')};this[_0xca68('0xb4')](_0x484a3e);this[_0xca68('0xd5')](_[_0xca68('0xd6')](_0x4e1991,_[_0xca68('0xd7')](_0x1d7944,[_0xca68('0xd8'),_0xca68('0xd9'),_0xca68('0xda'),_0xca68('0xdb'),'CampaignId'])),'[emptyContact][createHistory]',_0xca68('0xdc'));logger[_0xca68('0x9a')](_0x4af6ef);};Dialer[_0xca68('0xab')][_0xca68('0xdd')]=function(_0x5577ba){return _0x5577ba===_0xca68('0xde');};Dialer[_0xca68('0xab')][_0xca68('0xdf')]=function(_0x2f0b37){return!_[_0xca68('0x41')](_0x2f0b37)&&_0x2f0b37&&!_[_0xca68('0x41')](_0x2f0b37[_0xca68('0x47')])&&!_['isUndefined'](_0x2f0b37[_0xca68('0x77')])&&_0x2f0b37[_0xca68('0x77')]&&(this[_0xca68('0x26')][util[_0xca68('0x7a')](_0xca68('0xe0'),_0x2f0b37['name'])][_0xca68('0xe1')]===_0xca68('0xe2')||this[_0xca68('0x26')][util['format']('SIP/%s',_0x2f0b37['name'])][_0xca68('0xe1')]===_0xca68('0xe3'));};Dialer['prototype']['saveInDb']=function(_0x2e0969,_0x4b0eb6,_0x846be3){this[_0xca68('0xcf')](_0x2e0969)['catch'](loggerCatch(_0x4b0eb6));this[_0xca68('0xce')](_0x2e0969)['catch'](loggerCatch(_0x846be3));};Dialer[_0xca68('0xab')][_0xca68('0xe4')]=function(_0x45b896){var _0x4cafaa=this[_0xca68('0xad')][_0x45b896['uniqueid']];var _0x319645;if(!_[_0xca68('0xe5')](_0x45b896)&&!_[_0xca68('0xe5')](_0x45b896['variable'])&&!_[_0xca68('0xe5')](_0x45b896[_0xca68('0xe6')][_0xca68('0xe7')])&&_0x45b896[_0xca68('0xe8')]===_0xca68('0xe9')&&_0x4cafaa){if(_0x4cafaa['type']!==_0xca68('0x79')&&this[_0xca68('0x23')][_0x4cafaa['queue']][_0xca68('0xea')]&&_0x45b896[_0xca68('0xeb')]===_0xca68('0xec')){delete this[_0xca68('0xad')][_0x45b896[_0xca68('0xed')]];this['updateOriginated'](this[_0xca68('0x23')][_0x4cafaa['queue']]);this[_0xca68('0x23')][_0x4cafaa['queue']][_0xca68('0x61')]+=0x1;this[_0xca68('0x23')][_0x4cafaa['queue']][_0xca68('0x60')]+=0x1;_0x319645=new Hangup(_0x4cafaa,_0x45b896);_0x319645[_0xca68('0xa9')]=0x12;_0x319645['statedesc']=_0xca68('0xee');_0x319645[_0xca68('0xef')]=_0xca68('0xf0');ami['emit'](_0xca68('0xf1'),ut[_0xca68('0xf2')](_0x319645,_0xca68('0xf3')));this[_0xca68('0xd5')](_0x319645,_0xca68('0xf4'),_0xca68('0xf5'));}if(_0x4cafaa['type']!=='ivr'&&this['voiceQueues'][_0x4cafaa[_0xca68('0xb6')]]['dialAMDActive']&&_0x45b896[_0xca68('0xeb')]===_0xca68('0xf6')){var _0x220af1=this;return new BPromise(function(_0xfcee85,_0x26a817){delete _0x220af1[_0xca68('0xad')][_0x45b896[_0xca68('0xed')]];_0x220af1[_0xca68('0xb4')](_0x220af1[_0xca68('0x23')][_0x4cafaa[_0xca68('0xb6')]]);_0x220af1['voiceQueues'][_0x4cafaa[_0xca68('0xb6')]][_0xca68('0x61')]+=0x1;_0x220af1[_0xca68('0x23')][_0x4cafaa[_0xca68('0xb6')]][_0xca68('0x60')]+=0x1;var _0x4ce524=_0x220af1[_0xca68('0x23')][_0x4cafaa[_0xca68('0xb6')]];var _0x487e63=new Hangup(_0x4cafaa,_0x45b896);_0x487e63[_0xca68('0xa9')]=0x13;_0x487e63[_0xca68('0xf7')]=_0xca68('0xf8');_0x487e63[_0xca68('0xef')]=_0xca68('0xf0');_0x487e63['countmachineretry']+=0x1;_0x487e63[_0xca68('0xf9')]+=0x1;_0x487e63['amd']=!![];ami[_0xca68('0x4f')](_0xca68('0xf1'),ut[_0xca68('0xf2')](_0x487e63,_0xca68('0xf3')));_0x220af1[_0xca68('0xcf')](_0x487e63)[_0xca68('0xb2')](loggerCatch(_0xca68('0xfa')));if(_0x487e63[_0xca68('0xfb')]+_0x487e63[_0xca68('0xfc')]+_0x487e63[_0xca68('0xfd')]+_0x487e63[_0xca68('0xfe')]+_0x487e63[_0xca68('0xff')]+_0x487e63[_0xca68('0x100')]+_0x487e63[_0xca68('0x101')]+_0x487e63[_0xca68('0x102')]>=_0x4ce524['dialGlobalMaxRetry']){_0x220af1['stateGlobal'](_0x487e63,_0xfcee85,_0x26a817,_0xca68('0x103'));}else{if(_0x487e63['countmachineretry']>=_0x4ce524['dialMachineMaxRetry']){_0x220af1[_0xca68('0x104')](_0x487e63,_0xfcee85,_0x26a817,_0xca68('0x105'));}else{_0x220af1[_0xca68('0xc6')]({'active':![],'countmachineretry':_0x487e63[_0xca68('0x101')],'scheduledat':moment()[_0xca68('0x106')](_0x4ce524[_0xca68('0x107')],_0xca68('0x108'))['format'](_0xca68('0x109')),'ContactId':_0x487e63[_0xca68('0xd8')],'ListId':_0x487e63[_0xca68('0xd9')],'VoiceQueueId':_0x487e63[_0xca68('0xdb')]||undefined,'CampaignId':_0x487e63[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x10b')));_0xfcee85({'reschedule':0x1});}}});}if(_0x4cafaa[_0xca68('0x50')]===_0xca68('0x79')&&this[_0xca68('0x24')][_0x4cafaa[_0xca68('0xb6')]]['dialAMDActive']&&_0x45b896[_0xca68('0xeb')]===_0xca68('0xec')){delete this[_0xca68('0xad')][_0x45b896['uniqueid']];this[_0xca68('0xb4')](this[_0xca68('0x24')][_0x4cafaa[_0xca68('0xb6')]]);_0x319645=new Hangup(_0x4cafaa,_0x45b896);_0x319645[_0xca68('0xa9')]=0x12;_0x319645[_0xca68('0xf7')]=_0xca68('0xee');_0x319645[_0xca68('0xef')]=_0xca68('0xf0');ami[_0xca68('0x4f')]('custom:amd',ut[_0xca68('0xf2')](_0x319645,_0xca68('0xf3')));this[_0xca68('0xd5')](_0x319645,'[syncHangupInAMDIvr][createHistory]',_0xca68('0x10c'));}if(_0x4cafaa['type']===_0xca68('0x79')&&this[_0xca68('0x24')][_0x4cafaa['queue']][_0xca68('0xea')]&&_0x45b896[_0xca68('0xeb')]===_0xca68('0xf6')){var _0x220af1=this;return new BPromise(function(_0x5a55e1,_0x32dbba){delete _0x220af1[_0xca68('0xad')][_0x45b896[_0xca68('0xed')]];_0x220af1[_0xca68('0xb4')](_0x220af1['campaigns'][_0x4cafaa[_0xca68('0xb6')]]);_0x220af1[_0xca68('0x24')][_0x4cafaa['queue']][_0xca68('0x61')]+=0x1;_0x220af1[_0xca68('0x24')][_0x4cafaa[_0xca68('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3056f5=_0x220af1[_0xca68('0x24')][_0x4cafaa['queue']];var _0x53939b=new Hangup(_0x4cafaa,_0x45b896);_0x53939b[_0xca68('0xa9')]=0x13;_0x53939b['statedesc']=_0xca68('0xf8');_0x53939b['membername']='AMD';_0x53939b[_0xca68('0x101')]+=0x1;_0x53939b[_0xca68('0xf9')]+=0x1;_0x53939b['amd']=!![];ami[_0xca68('0x4f')]('custom:amd',ut[_0xca68('0xf2')](_0x53939b,_0xca68('0xf3')));_0x220af1[_0xca68('0xcf')](_0x53939b)['catch'](loggerCatch(_0xca68('0xfa')));if(_0x53939b[_0xca68('0xfb')]+_0x53939b[_0xca68('0xfc')]+_0x53939b['countnoanswerretry']+_0x53939b['countnosuchnumberretry']+_0x53939b[_0xca68('0xff')]+_0x53939b[_0xca68('0x100')]+_0x53939b[_0xca68('0x101')]+_0x53939b['countagentrejectretry']>=_0x3056f5[_0xca68('0x10d')]){_0x220af1[_0xca68('0x10e')](_0x53939b,_0x5a55e1,_0x32dbba,_0xca68('0x103'));}else{if(_0x53939b[_0xca68('0x101')]>=_0x3056f5[_0xca68('0x10f')]){_0x220af1[_0xca68('0x104')](_0x53939b,_0x5a55e1,_0x32dbba,_0xca68('0x105'));}else{_0x220af1[_0xca68('0xc6')]({'active':![],'countmachineretry':_0x53939b[_0xca68('0x101')],'scheduledat':moment()['add'](_0x3056f5[_0xca68('0x107')],'minutes')['format'](_0xca68('0x109')),'ContactId':_0x53939b[_0xca68('0xd8')],'ListId':_0x53939b[_0xca68('0xd9')],'VoiceQueueId':_0x53939b['VoiceQueueId']||undefined,'CampaignId':_0x53939b['CampaignId']||undefined})['catch'](loggerCatch(_0xca68('0x10b')));_0x5a55e1({'reschedule':0x1});}}});}}};Dialer[_0xca68('0xab')]['syncHangup']=function(_0x1ac179){var _0x44d73d=this['uniqueId'][_0x1ac179[_0xca68('0xed')]];var _0x20b3ed=this;var _0x5a2cf0;if(_0x44d73d&&_0x44d73d[_0xca68('0x50')]==='ivr'){delete this[_0xca68('0xad')][_0x1ac179[_0xca68('0xed')]];this['updateOriginated'](this['campaigns'][_0x44d73d[_0xca68('0xb6')]]);this[_0xca68('0x24')][_0x44d73d[_0xca68('0xb6')]][_0xca68('0x110')]+=0x1;_0x5a2cf0=new Hangup(_0x44d73d,_0x1ac179);this[_0xca68('0xcf')](_0x5a2cf0)[_0xca68('0xb2')](loggerCatch(_0xca68('0x111')));this[_0xca68('0xce')](_0x5a2cf0)[_0xca68('0xb2')](loggerCatch(_0xca68('0x112')));}if(_0x44d73d&&_0x44d73d[_0xca68('0x50')]!==_0xca68('0x79')&&isNotNull(this[_0xca68('0x23')][_0x44d73d[_0xca68('0xb6')]]['dialQueueProject'])){delete this[_0xca68('0xad')][_0x1ac179[_0xca68('0xed')]];this[_0xca68('0xb4')](this['voiceQueues'][_0x44d73d[_0xca68('0xb6')]]);this[_0xca68('0x23')][_0x44d73d[_0xca68('0xb6')]][_0xca68('0x61')]+=0x1;this[_0xca68('0x23')][_0x44d73d[_0xca68('0xb6')]][_0xca68('0x60')]+=0x1;_0x5a2cf0=new Hangup(_0x44d73d,_0x1ac179);_0x5a2cf0[_0xca68('0xa9')]=0x10;_0x5a2cf0['statedesc']=_0xca68('0x113');_0x5a2cf0['membername']=_0xca68('0x114');this['createHistory'](_0x5a2cf0)['catch'](loggerCatch(_0xca68('0x111')));this[_0xca68('0xce')](_0x5a2cf0)[_0xca68('0xb2')](loggerCatch(_0xca68('0x112')));}if(_0x44d73d&&_0x44d73d[_0xca68('0x50')]!==_0xca68('0x79')&&!isNotNull(this[_0xca68('0x23')][_0x44d73d['queue']][_0xca68('0x115')])){delete this[_0xca68('0xad')][_0x1ac179[_0xca68('0xed')]];this[_0xca68('0xb4')](this[_0xca68('0x23')][_0x44d73d[_0xca68('0xb6')]]);this[_0xca68('0x23')][_0x44d73d[_0xca68('0xb6')]][_0xca68('0x6a')]+=0x1;_0x5a2cf0=new Hangup(_0x44d73d,_0x1ac179);_0x5a2cf0[_0xca68('0xa9')]=0xc;_0x5a2cf0[_0xca68('0xf7')]=_0x1ac179[_0xca68('0x116')];_0x5a2cf0[_0xca68('0xef')]='Unknow';this[_0xca68('0xcf')](_0x5a2cf0)[_0xca68('0xb2')](loggerCatch(_0xca68('0x111')));this[_0xca68('0xce')](_0x5a2cf0)['catch'](loggerCatch(_0xca68('0x112')));}};Dialer[_0xca68('0xab')][_0xca68('0x117')]=function(_0xbbd68){var _0x4f8556=this[_0xca68('0xad')][_0xbbd68['uniqueid']];var _0x4884d9=this;if(this[_0xca68('0x23')][_0xbbd68[_0xca68('0xb6')]]){if(_0x4f8556&&_0x4f8556[_0xca68('0x50')]!==_0xca68('0x79')){delete this['uniqueId'][_0xbbd68[_0xca68('0xed')]];this[_0xca68('0x23')][_0xbbd68[_0xca68('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x4f27e8=new AgentComplete(_0x4f8556,_0xbbd68);if(_0xbbd68[_0xca68('0x118')]===_0xca68('0x119')){_0x4f27e8['agiafterat']=this[_0xca68('0x23')][_0xbbd68[_0xca68('0xb6')]][_0xca68('0x11a')]&&this[_0xca68('0x23')][_0xbbd68[_0xca68('0xb6')]][_0xca68('0x11b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xca68('0xcf')](_0x4f27e8)[_0xca68('0xb2')](loggerCatch(_0xca68('0x11c')));this[_0xca68('0xce')](_0x4f27e8)[_0xca68('0xb2')](loggerCatch(_0xca68('0x11d')));}}};Dialer[_0xca68('0xab')][_0xca68('0x30')]=function(_0xdc584){if(this['voiceQueues'][_0xdc584[_0xca68('0xb6')]]){if(this[_0xca68('0xad')][_0xdc584[_0xca68('0xed')]]&&this[_0xca68('0xad')][_0xdc584[_0xca68('0xed')]][_0xca68('0x50')]!==_0xca68('0x79')){this['updateOriginated'](this[_0xca68('0x23')][_0xdc584[_0xca68('0xb6')]]);this[_0xca68('0xad')][_0xdc584[_0xca68('0xed')]][_0xca68('0x11e')]=moment()[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x37bb31,_0x2894ff){this[_0xca68('0xcf')](_0x37bb31)[_0xca68('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2894ff==0x0){this[_0xca68('0xce')](_0x37bb31)['catch'](loggerCatch(_0xca68('0x11f')));}};Dialer['prototype'][_0xca68('0x32')]=function(_0x53f0da){var _0x35a25f=this[_0xca68('0xad')][_0x53f0da[_0xca68('0xed')]];var _0x1c9838=this;var _0x4c0121=![];var _0x44c340;var _0x52a800;if(this['voiceQueues'][_0x53f0da[_0xca68('0xb6')]]){if(_0x35a25f&&_0x35a25f[_0xca68('0x50')]!==_0xca68('0x79')){delete this[_0xca68('0xad')][_0x53f0da['uniqueid']];this[_0xca68('0xb4')](this[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]);_0x35a25f[_0xca68('0x120')]=moment()[_0xca68('0x7a')](_0xca68('0x109'));var _0x134017=new QueueCallerAbandon(_0x35a25f,_0x53f0da);if(getSeconds(_0x35a25f[_0xca68('0x120')],_0x35a25f[_0xca68('0x121')])>=_0x35a25f[_0xca68('0x122')]){this['voiceQueues'][_0x53f0da['queue']][_0xca68('0x123')]+=0x1;this['voiceQueues'][_0x53f0da[_0xca68('0xb6')]][_0xca68('0x66')]+=0x1;this[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]][_0xca68('0x6f')]+=0x1;_0x134017[_0xca68('0xa9')]=0xa;_0x134017[_0xca68('0xf7')]=_0xca68('0x124');_0x134017['dropreason']=_0xca68('0x125');_0x134017[_0xca68('0x126')]=this[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]['dialQueueProject2']?moment()[_0xca68('0x7a')](_0xca68('0x109')):undefined;_0x134017[_0xca68('0xff')]+=0x1;_0x134017['countglobal']+=0x1;_0x44c340=this['voiceQueues'][_0x53f0da[_0xca68('0xb6')]][_0xca68('0x127')];_0x52a800=this[_0xca68('0x23')][_0x53f0da['queue']][_0xca68('0x128')];_0x1c9838[_0xca68('0xbe')](_0x134017,_0x134017[_0xca68('0xa9')],_0x35a25f[_0xca68('0x129')])[_0xca68('0xba')](function(_0x4ba8ed){_0x4c0121=_0x4ba8ed[_0xca68('0x12a')]==0x1;if(_0x134017['countdropretry']>=_0x1c9838[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]['dialDropMaxRetry']){_0x1c9838[_0xca68('0x12b')](_0x134017,_0x4ba8ed[_0xca68('0x12a')]);}else{_0x1c9838['rescheduleContact']({'active':![],'countdropretry':_0x134017[_0xca68('0xff')],'scheduledat':moment()[_0xca68('0x106')](_0x1c9838[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]][_0xca68('0x127')],'minutes')[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35a25f[_0xca68('0xd8')],'ListId':_0x35a25f[_0xca68('0xd9')],'VoiceQueueId':_0x35a25f[_0xca68('0xdb')]||undefined,'CampaignId':_0x35a25f[_0xca68('0x10a')]||undefined})['catch'](loggerCatch(_0xca68('0x12c')));var _0x28e8dd=new History(_0x134017);_0x28e8dd['state']=0xa;_0x28e8dd[_0xca68('0xf7')]='Drop';_0x28e8dd[_0xca68('0xaa')]=moment()['format'](_0xca68('0x109'));_0x28e8dd['endtime']=_0x28e8dd[_0xca68('0xaa')];_0x28e8dd[_0xca68('0x12d')]=_0x134017[_0xca68('0x12d')];_0x28e8dd['calleridnum']=_0x134017[_0xca68('0x12e')];_0x1c9838[_0xca68('0xcf')](_0x28e8dd)[_0xca68('0xb2')](loggerCatch(_0xca68('0x12f')));}})[_0xca68('0xba')](function(_0x15f3a1){if(_0x4c0121)_0x1c9838['swapAdditionalPhones'](_0x134017,_0x44c340,_0x52a800)[_0xca68('0xba')](function(_0x473534){return 0x1;});});}else{this[_0xca68('0x23')][_0x53f0da['queue']][_0xca68('0x6d')]+=0x1;this[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]['outboundDropCallsDayCallersExit']+=0x1;_0x134017[_0xca68('0xa9')]=0xb;_0x134017[_0xca68('0xf7')]=_0xca68('0x130');_0x134017[_0xca68('0x131')]=_0xca68('0x132');_0x134017[_0xca68('0x100')]+=0x1;_0x134017[_0xca68('0xf9')]+=0x1;_0x44c340=this[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]['dialAbandonedRetryFrequency'];_0x52a800=this['voiceQueues'][_0x53f0da[_0xca68('0xb6')]]['callAdditionalPhoneAfterMin'];_0x1c9838[_0xca68('0xbe')](_0x134017,_0x134017[_0xca68('0xa9')],_0x35a25f[_0xca68('0x129')])[_0xca68('0xba')](function(_0x2f9812){if(_0x134017[_0xca68('0x100')]>=_0x1c9838['voiceQueues'][_0x53f0da['queue']][_0xca68('0x133')]){_0x1c9838['queueCallerAbandonCreateState'](_0x134017,_0x2f9812[_0xca68('0x12a')]);}else{_0x1c9838['rescheduleContact']({'active':![],'countabandonedretry':_0x134017['countabandonedretry'],'scheduledat':moment()[_0xca68('0x106')](_0x1c9838[_0xca68('0x23')][_0x53f0da[_0xca68('0xb6')]]['dialAbandonedRetryFrequency'],_0xca68('0x108'))[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35a25f['ContactId'],'ListId':_0x35a25f['ListId'],'VoiceQueueId':_0x35a25f[_0xca68('0xdb')]||undefined,'CampaignId':_0x35a25f[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x134')));var _0x1f4d01=new History(_0x134017);_0x1f4d01[_0xca68('0xa9')]=0xb;_0x1f4d01[_0xca68('0xf7')]=_0xca68('0x130');_0x1f4d01['starttime']=moment()['format'](_0xca68('0x109'));_0x1f4d01['endtime']=_0x1f4d01['starttime'];_0x1f4d01[_0xca68('0x12d')]=_0x134017[_0xca68('0x12d')];_0x1f4d01[_0xca68('0x12e')]=_0x134017[_0xca68('0x12e')];_0x1c9838[_0xca68('0xcf')](_0x1f4d01)['catch'](loggerCatch(_0xca68('0x135')));}})[_0xca68('0xba')](function(_0x49483b){if(_0x4c0121)_0x1c9838[_0xca68('0xc0')](_0x134017,_0x44c340,_0x52a800)[_0xca68('0xba')](function(_0x5be9f8){return 0x1;});});}}}};Dialer[_0xca68('0xab')]['syncNewExten']=function(_0xe7babf){if(this['actions'][_0xe7babf[_0xca68('0xed')]]){this[_0xca68('0x29')][_0xe7babf['uniqueid']][_0xca68('0xb1')]=_0xe7babf['channel'];}if(this[_0xca68('0xad')][_0xe7babf['uniqueid']]){this[_0xca68('0xad')][_0xe7babf[_0xca68('0xed')]]['channel']=_0xe7babf['channel'];}};Dialer['prototype'][_0xca68('0x136')]=function(_0x96ae68){if(strategy[this[_0xca68('0x23')][this[_0xca68('0x29')][_0x96ae68['actionid']][_0xca68('0xb6')]][_0xca68('0x51')]]==='roundrobin'){if(this[_0xca68('0x29')][_0x96ae68['actionid']]&&_[_0xca68('0xe5')](this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]][_0xca68('0x138')])&&_0x96ae68[_0xca68('0xe1')]==='1'&&_0x96ae68['paused']==='0'){if(this[_0xca68('0x25')][_0x96ae68[_0xca68('0x139')]]){if(!this['agents'][_0x96ae68[_0xca68('0x139')]][_0xca68('0x138')]){this[_0xca68('0x25')][_0x96ae68[_0xca68('0x139')]][_0xca68('0x138')]=!![];this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]][_0xca68('0x138')]=!![];this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]][_0xca68('0x139')]=_0x96ae68[_0xca68('0x139')];}}}}else if((strategy[this[_0xca68('0x23')][this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]][_0xca68('0xb6')]][_0xca68('0x51')]]||_0xca68('0x1d'))===_0xca68('0x1d')){if(this['actions'][_0x96ae68[_0xca68('0x137')]]){if(this[_0xca68('0x25')][_0x96ae68['stateinterface']]){this[_0xca68('0x29')][_0x96ae68['actionid']][_0xca68('0x139')]=_0x96ae68[_0xca68('0x139')];if(_[_0xca68('0xe5')](this[_0xca68('0x2d')][this['actions'][_0x96ae68[_0xca68('0x137')]]['queue']])){this[_0xca68('0x2d')][this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]]['queue']]=[];}this['queueBooked'][this[_0xca68('0x29')][_0x96ae68[_0xca68('0x137')]][_0xca68('0xb6')]][_0xca68('0x13a')](_[_0xca68('0xd6')](_['pick'](this[_0xca68('0x29')][_0x96ae68['actionid']],['idHopper','stateinterface']),{'status':_0x96ae68[_0xca68('0xe1')],'paused':_0x96ae68['paused']}));}}}};function unlockQueueStatus(_0x206492,_0x2b7cf4){setTimeout(function(){if(_[_0xca68('0x41')](_0x206492[_0xca68('0x13b')])){loggerBooked[_0xca68('0x9a')](_0xca68('0x13c'),_0x2b7cf4);}_0x206492['queueStatusComplete']=!![];loggerBooked[_0xca68('0x7d')]('[booked][unlockQueueStatus]',_0x2b7cf4,JSON[_0xca68('0x4c')](_[_0xca68('0xd7')](_0x206492,['name',_0xca68('0x13b')])));},0x1f3);}Dialer[_0xca68('0xab')][_0xca68('0x3c')]=function(_0x2788d2){var _0x349787=this;var _0x525b80=_0x349787['voiceQueues'][_0x349787['actions'][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]];if(strategy[this[_0xca68('0x23')][this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]][_0xca68('0x51')]]==='roundrobin'){if(this['actions'][_0x2788d2[_0xca68('0x137')]]&&this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0x139')]){this[_0xca68('0x22')]['run'](this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0x13d')],this['actions'][_0x2788d2['actionid']]['stateinterface'])[_0xca68('0xb2')](function(_0x2100a3){logger[_0xca68('0x9a')](_0xca68('0x13e'),util['inspect'](_0x2100a3,{'showHidden':![],'depth':null}));})[_0xca68('0x20')](function(){_0x349787[_0xca68('0xb4')](_0x349787[_0xca68('0x23')][_0x349787[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]]);_0x349787[_0xca68('0x25')][_0x349787[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0x139')]]['locked']=![];delete _0x349787[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]];unlockQueueStatus(_0x525b80);});}else{this[_0xca68('0xb4')](this['voiceQueues'][this['actions'][_0x2788d2[_0xca68('0x137')]]['queue']]);this[_0xca68('0xc6')]({'active':![],'ContactId':this[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xd8')],'ListId':this[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xd9')],'VoiceQueueId':this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2788d2['actionid']][_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x13f')));delete this['actions'][_0x2788d2['actionid']];unlockQueueStatus(_0x525b80);}}else if((strategy[this[_0xca68('0x23')][this[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xb6')]]['strategy']]||_0xca68('0x1d'))===_0xca68('0x1d')){var _0x5aaea8;if(this['actions'][_0x2788d2[_0xca68('0x137')]]&&!_[_0xca68('0x4a')](this['queueBooked'][this['actions'][_0x2788d2[_0xca68('0x137')]]['queue']])){if(this['queueBookedRR'][_0x349787[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xb6')]]){this[_0xca68('0x2e')][_0x349787[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]]=this['queueBookedRR'][this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]]?this[_0xca68('0x2e')][this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]]['queue']]:this[_0xca68('0x2d')][this['actions'][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]]?this[_0xca68('0x2d')][this[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xb6')]][_0xca68('0x140')]||0x0:0x0;}this[_0xca68('0x2d')][this[_0xca68('0x29')][_0x2788d2['actionid']][_0xca68('0xb6')]][_0xca68('0x140')]=this[_0xca68('0x2e')][this[_0xca68('0x29')][_0x2788d2[_0xca68('0x137')]][_0xca68('0xb6')]];for(var _0x34d20d=0x0;_0x34d20d=0x0;})[_0xca68('0xb2')](myreject(_0x5e928f)));}}else{_0x337b6b[_0xca68('0x13a')](ami['Action']({'action':_0xca68('0x158'),'command':util[_0xca68('0x7a')](_0xca68('0x159'),_0x24aaa7,!_['isUndefined'](config[_0xca68('0x154')][_0x195be7])?_0x195be7:'')})[_0xca68('0xba')](function(_0x9a923){return _0x9a923[_0xca68('0x15d')][_0xca68('0x15b')](_0xca68('0x15c'))>=0x0;})[_0xca68('0xb2')](myreject(_0x5e928f)));}BPromise[_0xca68('0x15e')](_0x337b6b)['then'](function(_0x410a84){var _0x511b00=_['some'](_0x410a84);if(_0x511b00){return _0x2a9f30(_0x511b00);}else{_0x5d2cdc[_0xca68('0x42')]=_0xf767be?'GLOBAL_INTERVAL_IS_OVERTIME':_0xca68('0x15f');return _0x5e928f(msgResponse('[ifTime][promiseAll]',_0xca68('0x150'),_0xca68('0x160')+_0xf767be+'\x20'+_0x4c8750+_0xca68('0x161')+util['inspect'](_0x24aaa7,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x195be7));}})[_0xca68('0xb2')](function(_0x2e2755){return _0x5e928f(msgResponse(_0xca68('0x14e'),_0xca68('0x150'),JSON[_0xca68('0x4c')](_0x2e2755)));});});};Dialer[_0xca68('0xab')]['checkDialMethod']=function(_0x1c595e){var _0x108fe9=this;return function(){switch(_0x1c595e['dialMethod']){case _0xca68('0x162'):freeVariablesPredictive(_0x1c595e);_0x108fe9[_0xca68('0x163')](_0x1c595e,0x1);break;case _0xca68('0x164'):freeVariablesPredictive(_0x1c595e);_0x108fe9['handlePower'](_0x1c595e,_0x1c595e[_0xca68('0x165')]);break;case _0xca68('0xa'):_0x108fe9['predictive'](_0x1c595e);break;case _0xca68('0x166'):freeVariablesPredictive(_0x1c595e);_0x108fe9[_0xca68('0x163')](_0x1c595e,0x1);break;default:freeVariablesPredictive(_0x1c595e);logger[_0xca68('0x9a')](_0xca68('0x167'),_0x1c595e[_0xca68('0x47')],_0xca68('0x168'));}};};Dialer[_0xca68('0xab')]['launchHandleIvr']=function(_0x3e2e7d){var _0x3f728b=this;return function(){_0x3f728b['handleIvr'](_0x3e2e7d);};};Dialer[_0xca68('0xab')][_0xca68('0xc')]=function(_0x59ecce){var _0x427775=this;if(isNotPreview(_0x59ecce[_0xca68('0x5c')])){if(isVoiceQueueOutbound(_0x59ecce[_0xca68('0x50')])&&isActive(_0x59ecce[_0xca68('0x5b')])){_0x59ecce['sendMessageOneNotActive']=!![];BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](checkIsLoggedIn(_0x59ecce,_0x59ecce['loggedIn']))[_0xca68('0xba')](checkIsActive(_0x59ecce,_0x59ecce[_0xca68('0x5b')]))['then'](checkInterval(_0x59ecce))[_0xca68('0xba')](_0x427775[_0xca68('0x14b')](_0x59ecce))[_0xca68('0xba')](_0x427775['checkIfTime'](_0x59ecce[_0xca68('0x169')],_0x59ecce[_0xca68('0x16a')],_0x59ecce[_0xca68('0x47')],_0x59ecce))[_0xca68('0xba')](_0x427775[_0xca68('0x14f')](_0x59ecce['Interval'],_0x59ecce[_0xca68('0x16a')],_0x59ecce['name'],_0x59ecce))[_0xca68('0xba')](_0x427775[_0xca68('0x16b')](_0x59ecce))[_0xca68('0xb2')](loggerCatchQueueSummary(_0xca68('0x16c'),_0x59ecce));}else{notSendMessagesQueue(_0x59ecce);}}else{freeVariablesPredictive(_0x59ecce);}};Dialer[_0xca68('0xab')][_0xca68('0x16d')]=_[_0xca68('0x16e')](function(){var _0x4c2a8f=_['filter'](this['voiceQueues'],function(_0x565d0e){return _0x565d0e[_0xca68('0x16f')];});var _0x3dae71=_[_0xca68('0x170')](this[_0xca68('0x25')],function(_0xc999c){return _0xc999c[_0xca68('0x171')]&&_0xc999c['status']===_0xca68('0xe2');});if(_0x4c2a8f[_0xca68('0x97')]>0x0&&_0x3dae71['length']>0x0){return BPromise[_0xca68('0xb9')]()[_0xca68('0xba')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x4c2a8f,'id'),previewRecallmeReminderInterval,_['map'](_0x3dae71,'id')))['then'](function(_0x4fdae4){for(var _0x3c5b88=0x0;_0x3c5b88<_0x4fdae4[_0xca68('0x97')];_0x3c5b88++){var _0xb77034=_0x4fdae4[_0x3c5b88][_0xca68('0x172')][_0xca68('0x47')];if(_0xb77034)io['to'](util[_0xca68('0x7a')](_0xca68('0x173'),_0xb77034))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x4fdae4[_0x3c5b88]});}})['catch'](function(_0x361e99){logger[_0xca68('0x9a')](_0xca68('0x174'),_0x361e99);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xca68('0xab')][_0xca68('0x14a')]=function(){var _0x16e606=this;var _0x110465;for(var _0x40191c in this['campaigns']){if(typeof this[_0xca68('0x24')][_0x40191c]!==_0xca68('0x99')){_0x110465=this['campaigns'][_0x40191c];if(isCampaignIvr(_0x110465[_0xca68('0x50')])&&isActive(_0x110465['active'])){_0x110465[_0xca68('0xa1')]=!![];BPromise['resolve']()[_0xca68('0xba')](checkIsActive(_0x110465,_0x110465['active']))[_0xca68('0xba')](checkInterval(_0x110465))[_0xca68('0xba')](_0x16e606[_0xca68('0x14b')](_0x110465))[_0xca68('0xba')](_0x16e606[_0xca68('0x175')](_0x110465[_0xca68('0x169')],_0x110465[_0xca68('0x16a')],_0x110465[_0xca68('0x47')],_0x110465))[_0xca68('0xba')](_0x16e606[_0xca68('0x14f')](_0x110465['Interval'],_0x110465['dialTimezone'],_0x110465['name'],_0x110465))[_0xca68('0xba')](_0x16e606[_0xca68('0x176')](_0x110465))[_0xca68('0xb2')](loggerCatchQueueSummary(_0xca68('0x177'),_0x110465));}else{notSendMessagesCampaign(_0x110465);}}}};function getCallerIdRandom(_0x21658b,_0xc2f0ad){var _0x59c763;var _0x133f52;var _0x3727ee;if(_0xc2f0ad<=0x0){_0xc2f0ad=0x1;}_0x59c763=new RegExp(_0xca68('0x178')+_0xc2f0ad+'}$');_0x133f52=Math[_0xca68('0x179')](0xa,_0xc2f0ad-0x1);_0x3727ee=Math[_0xca68('0x179')](0xa,_0xc2f0ad)-0x1;return util[_0xca68('0x7a')]('%s',_[_0xca68('0x17a')](_0x21658b,_0x59c763,_[_0xca68('0x17b')](_0x133f52,_0x3727ee)));}function extractCalleridName(_0x5e74d2){var _0x1f8612=_0x5e74d2['match'](/"(.*?)"/);return _0x1f8612?_0x1f8612[0x1]:_0x5e74d2;}function extractCalleridNumber(_0x4598fa){var _0x2dd669=_0x4598fa['match'](/<(.*?)>/);return _0x2dd669?_0x2dd669[0x1]:_0x4598fa;}Dialer['prototype'][_0xca68('0x17c')]=function(_0x22edcb,_0x441a4a){var _0x48d5f5=this;var _0x5092de=uuid['v4']();this[_0xca68('0x29')][_0x5092de]=new Action(_0x22edcb,_0x441a4a,_0x5092de);return new BPromise(function(_0x1dad2d,_0x2aaec9){if(_[_0xca68('0x41')](_0x22edcb)&&typeof _0x22edcb!==_0xca68('0x17d')){return _0x2aaec9(msgResponse(_0xca68('0x17e'),_0xca68('0x150'),'voiceQueue\x20is\x20undefine'));}if(_[_0xca68('0x41')](_0x441a4a[_0xca68('0x17f')])||_0x441a4a[_0xca68('0x17f')]===null){return _0x2aaec9(msgResponse(_0xca68('0x17e'),_0xca68('0x150'),'contact\x20is\x20undefine'));}var _0xc1193e={'XMD-CALLERID':_0x48d5f5[_0xca68('0x29')][_0x5092de][_0xca68('0x180')](),'XMD-AGI':_0x22edcb['dialQueueProject']?util[_0xca68('0x7a')](_0xca68('0x181'),ipAgi,_0x22edcb[_0xca68('0x115')]):_0xca68('0x182'),'XMD-AGIAFTER':_0x22edcb['dialQueueProject2']?util[_0xca68('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x22edcb[_0xca68('0x11a')]):_0xca68('0x182'),'XMD-QUEUE':_0x22edcb[_0xca68('0x50')]===_0xca68('0x92')?util['format'](_0xca68('0x183'),_0x22edcb[_0xca68('0x47')],_0x22edcb[_0xca68('0x184')]||'',_0x22edcb[_0xca68('0x11b')]?'c':'',_0x22edcb[_0xca68('0x122')]||0x3):'NONE','XMD-CONTACTID':_0x441a4a['ContactId'],'XMD-CDRTYPE':_0xca68('0x185'),'CALLERID(all)':_0x48d5f5[_0xca68('0x29')][_0x5092de][_0xca68('0x180')](),'XMD-AMD':_0x22edcb[_0xca68('0xea')]?_0xca68('0x186'):'NONE','XMD-DESTINATION':_0xca68('0xe9')};if(_0x22edcb[_0xca68('0xea')]){_0xc1193e[_0xca68('0x187')]=_0x22edcb[_0xca68('0x188')]||0x9c4;_0xc1193e['XMD-AMDGREETING']=_0x22edcb['dialAMDGreeting']||0x5dc;_0xc1193e[_0xca68('0x189')]=_0x22edcb[_0xca68('0x18a')]||0x320;_0xc1193e[_0xca68('0x18b')]=_0x22edcb['dialAMDTotalAnalysisTime']||0x1388;_0xc1193e[_0xca68('0x18c')]=_0x22edcb[_0xca68('0x18d')]||0x64;_0xc1193e[_0xca68('0x18e')]=_0x22edcb[_0xca68('0x18f')]||0x32;_0xc1193e[_0xca68('0x190')]=_0x22edcb[_0xca68('0x191')]||0x3;_0xc1193e['XMD-AMDSILENCETHRESHOLD']=_0x22edcb['dialAMDSilenceThreshold']||0x100;_0xc1193e[_0xca68('0x192')]=_0x22edcb[_0xca68('0x193')]||0x1388;}if(_0x22edcb[_0xca68('0x50')]===_0xca68('0x92')){_0xc1193e[_0xca68('0x194')]=_0x441a4a[_0xca68('0xdb')];}else{_0xc1193e['XMD-CAMPAIGNID']=_0x441a4a[_0xca68('0x10a')];}for(var _0x146ef8 in _0x441a4a[_0xca68('0x195')]){if(typeof _0x441a4a[_0xca68('0x195')][_0x146ef8]!==_0xca68('0x99')){if(isNotNull(_0x441a4a[_0xca68('0x195')][_0x146ef8])&&_0x146ef8!=='id'&&_0x146ef8!==_0xca68('0x196')&&_0x146ef8!==_0xca68('0x197')&&_0x146ef8!==_0xca68('0x198')){_0xc1193e[util['format'](_0xca68('0x199'),_0xca68('0x19a'),_[_0xca68('0x19b')](_0x146ef8))]=_0x441a4a[_0xca68('0x195')][_0x146ef8];}}}var _0xda3b72=_0x48d5f5['isTrunkReachable'](_0x22edcb[_0xca68('0x76')])?getCallerId(_0x22edcb['Trunk'][_0xca68('0x19c')],_0x22edcb['dialOriginateCallerIdName'],_0x22edcb[_0xca68('0x19d')]>0x0?getCallerIdRandom(_0x22edcb[_0xca68('0x5e')],_0x22edcb['dialRandomLastDigitCallerIdNumber']):_0x22edcb[_0xca68('0x5e')]):getCallerId(_[_0xca68('0xe5')](_0x22edcb['TrunkBackup'])?_0x22edcb[_0xca68('0x76')][_0xca68('0x19c')]:_0x22edcb[_0xca68('0x14c')][_0xca68('0x19c')],_0x22edcb[_0xca68('0x5d')],_0x22edcb[_0xca68('0x19d')]>0x0?getCallerIdRandom(_0x22edcb[_0xca68('0x5e')],_0x22edcb['dialRandomLastDigitCallerIdNumber']):_0x22edcb[_0xca68('0x5e')]);if(_0xda3b72){_0xc1193e[_0xca68('0x19e')]=_0x48d5f5[_0xca68('0x29')][_0x5092de][_0xca68('0x19f')]=extractCalleridName(_0xda3b72);_0xc1193e['XMD-ORIGINATECALLERIDNUM']=_0x441a4a[_0xca68('0x17f')];}return ami[_0xca68('0xb0')]({'actionid':_0x5092de,'action':_0xca68('0x17e'),'channel':_0x48d5f5['isTrunkReachable'](_0x22edcb['Trunk'])?util[_0xca68('0x7a')](_0xca68('0x1a0'),_0x22edcb[_0xca68('0x76')]['name'],isNotNull(_0x22edcb[_0xca68('0x1a1')])?_0x22edcb[_0xca68('0x1a1')][_0xca68('0x1a2')]()||'':'',_0x22edcb[_0xca68('0x1a3')]>0x0?_0x441a4a[_0xca68('0x17f')][_0xca68('0x1a4')](_0x22edcb[_0xca68('0x1a3')]):_0x441a4a[_0xca68('0x17f')]):util[_0xca68('0x7a')](_0xca68('0x1a0'),_['isNil'](_0x22edcb[_0xca68('0x14c')])?_0x22edcb['Trunk']['name']:_0x22edcb[_0xca68('0x14c')][_0xca68('0x47')],isNotNull(_0x22edcb['dialPrefix'])?_0x22edcb['dialPrefix'][_0xca68('0x1a2')]()||'':'',_0x22edcb[_0xca68('0x1a3')]>0x0?_0x441a4a[_0xca68('0x17f')][_0xca68('0x1a4')](_0x22edcb[_0xca68('0x1a3')]):_0x441a4a[_0xca68('0x17f')]),'callerid':_0xda3b72,'Exten':'xcally-motion-dialer','Context':_0xca68('0x1a5'),'Priority':'1','variable':_0xc1193e,'timeout':(_0x22edcb[_0xca68('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5092de})[_0xca68('0xba')](function(_0x46f36c){return _0x1dad2d(_0x46f36c);})['catch'](function(_0x573af1){_0x22edcb[_0xca68('0x1a6')]+=0x1;var _0x2aabd1=new History(_0x48d5f5[_0xca68('0x29')][_0x5092de]);logger['error'](util[_0xca68('0x7a')](_0xca68('0x1a7'),JSON[_0xca68('0x4c')](_0x573af1)));_0x2aabd1[_0xca68('0xa9')]=0xe;_0x2aabd1[_0xca68('0xf7')]=_0xca68('0x1a8');_0x2aabd1['starttime']=moment()[_0xca68('0x7a')](_0xca68('0x109'));_0x2aabd1[_0xca68('0x1a9')]=_0x2aabd1[_0xca68('0xaa')];_0x48d5f5['createHistory'](_0x2aabd1)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1aa')));_0x48d5f5['moveContactManagedDialer'](_0x2aabd1)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x48d5f5['actions'][_0x5092de];return _0x2aaec9(msgResponse(_0xca68('0x17e'),_0xca68('0x1ab'),_0xca68('0x1ac')));});});});};Dialer['prototype'][_0xca68('0x1ad')]=function(_0x442178){var _0x5dc2ea=this[_0xca68('0x29')][_0x442178[_0xca68('0x137')]];if(_0x5dc2ea){delete this[_0xca68('0x29')][_0x442178[_0xca68('0x137')]];_0x5dc2ea[_0xca68('0x121')]=moment()[_0xca68('0x7a')](_0xca68('0x109'));var _0x36df25=_0x5dc2ea[_0xca68('0x50')]===_0xca68('0x79')?this[_0xca68('0x24')][_0x5dc2ea[_0xca68('0xb6')]]:this[_0xca68('0x23')][_0x5dc2ea[_0xca68('0x1ae')]()];if(!this[_0xca68('0xdd')](_0x442178[_0xca68('0x1af')])){this[_0xca68('0xb4')](_0x36df25);return this[_0xca68('0x1b0')](_0x5dc2ea,_0x36df25,_0x442178)[_0xca68('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xca68('0xad')][_0x442178[_0xca68('0xed')]]=_0x5dc2ea;}};Dialer['prototype']['checkRetriveMax']=function(_0x31804c,_0x4c756c,_0x1152cf){var _0x44e497=new History(_0x4c756c);if(_0x44e497[_0xca68('0xfb')]+_0x44e497['countcongestionretry']+_0x44e497[_0xca68('0xfd')]+_0x44e497[_0xca68('0xfe')]+_0x44e497[_0xca68('0xff')]+_0x44e497[_0xca68('0x100')]+_0x44e497[_0xca68('0x101')]+_0x44e497[_0xca68('0x102')]>=_0x1152cf[_0xca68('0x10d')]-0x1){return!![];}switch(_0x31804c){case 0x3:if(_0x44e497['countnoanswerretry']>=_0x1152cf[_0xca68('0x1b1')]-0x1){return!![];}this[_0xca68('0xc6')]({'active':![],'countnoanswerretry':_0x44e497[_0xca68('0xfd')]+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf[_0xca68('0x1b2')],_0xca68('0x108'))[_0xca68('0x7a')](_0xca68('0x109')),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497['ListId'],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x1b3')));break;case 0x5:if(_0x44e497['countbusyretry']>=_0x1152cf[_0xca68('0x1b4')]-0x1){return!![];}this[_0xca68('0xc6')]({'active':![],'countbusyretry':_0x44e497[_0xca68('0xfb')]+=0x1,'scheduledat':moment()['add'](_0x1152cf[_0xca68('0x1b5')],_0xca68('0x108'))[_0xca68('0x7a')](_0xca68('0x109')),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497['CampaignId']||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x1b6')));break;case 0x8:if(_0x44e497[_0xca68('0xfc')]>=_0x1152cf[_0xca68('0x1b7')]-0x1){return!![];}this[_0xca68('0xc6')]({'active':![],'countcongestionretry':_0x44e497['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x1152cf['dialCongestionRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})['catch'](loggerCatch(_0xca68('0x1b8')));break;case 0x0:if(_0x44e497[_0xca68('0xfe')]>=_0x1152cf[_0xca68('0x1b9')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x44e497[_0xca68('0xfe')]+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf[_0xca68('0x1ba')],'minutes')[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497['VoiceQueueId']||undefined,'CampaignId':_0x44e497['CampaignId']||undefined})['catch'](loggerCatch(_0xca68('0x1bb')));}break;case 0xa:if(_0x44e497[_0xca68('0xff')]>=_0x1152cf[_0xca68('0x1bc')]-0x1){return!![];}this[_0xca68('0xc6')]({'active':![],'countdropretry':_0x44e497['countdropretry']+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf[_0xca68('0x127')],_0xca68('0x108'))['format'](_0xca68('0x109')),'ContactId':_0x44e497['ContactId'],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497['VoiceQueueId']||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x12c')));break;case 0xb:if(_0x44e497[_0xca68('0x100')]>=_0x1152cf[_0xca68('0x133')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x44e497['countabandonedretry']+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf['dialAbandonedRetryFrequency'],_0xca68('0x108'))[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x134')));break;case 0x13:if(_0x44e497[_0xca68('0x101')]>=_0x1152cf['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x44e497['countmachineretry']+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf[_0xca68('0x107')],_0xca68('0x108'))['format'](_0xca68('0x109')),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x10b')));break;case 0x14:if(_0x44e497[_0xca68('0x102')]>=_0x1152cf[_0xca68('0x1bd')]-0x1){return!![];}this[_0xca68('0xc6')]({'active':![],'countagentrejectretry':_0x44e497[_0xca68('0x102')]+=0x1,'scheduledat':moment()[_0xca68('0x106')](_0x1152cf[_0xca68('0x1be')],_0xca68('0x108'))[_0xca68('0x7a')](_0xca68('0x109')),'ContactId':_0x44e497[_0xca68('0xd8')],'ListId':_0x44e497[_0xca68('0xd9')],'VoiceQueueId':_0x44e497[_0xca68('0xdb')]||undefined,'CampaignId':_0x44e497[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x1bf')));break;default:return!![];}};Dialer[_0xca68('0xab')][_0xca68('0x1b0')]=function(_0x402899,_0x34abe3,_0x537b75){var _0x25fca3=this;var _0x815271=new History(_0x402899);var _0x107273=![];var _0x2b720a;var _0x2f3851;return new BPromise(function(_0x43f215,_0x2c92e8){if(_[_0xca68('0x41')](_0x34abe3)&&typeof _0x34abe3!==_0xca68('0x17d')){return _0x2c92e8(msgResponse(_0xca68('0x1c0'),_0xca68('0x150'),'entity\x20is\x20undefine'));}if(_[_0xca68('0x41')](_0x537b75)&&typeof _0x537b75!==_0xca68('0x17d')){return _0x2c92e8(msgResponse(_0xca68('0x1c0'),'Failure','evt\x20is\x20undefine'));}_0x25fca3[_0xca68('0xbe')](_0x815271,_0x537b75[_0xca68('0x118')],_0x34abe3)[_0xca68('0xba')](function(_0xf4f8ec){if(_0xf4f8ec[_0xca68('0x12a')]==0x1)_0x107273=!![];switch(_0x537b75[_0xca68('0x118')]){case'0':_0x34abe3[_0xca68('0x68')]+=0x1;_0x815271[_0xca68('0xa9')]=0x0;_0x815271[_0xca68('0xf7')]=_0xca68('0x1c1');_0x815271['countnosuchnumberretry']+=0x1;_0x815271[_0xca68('0xf9')]+=0x1;ami[_0xca68('0x4f')]('custom:agentnosuchnumber',ut[_0xca68('0xf2')](_0x402899,'nosuchnumber'));_0x2b720a=_0x34abe3[_0xca68('0x1ba')];_0x2f3851=_0x34abe3[_0xca68('0x128')];_0x25fca3[_0xca68('0xcf')](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0xfa')));if(_0x25fca3[_0xca68('0x1c2')](0x0,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0xfe')]>=_0x34abe3[_0xca68('0x1b9')]){_0x25fca3['createStateFinal'](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1c3'));}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x34abe3['outboundNoAnswerCallsDay']+=0x1;_0x815271['state']=0x3;_0x815271['statedesc']=_0xca68('0x1c4');_0x815271[_0xca68('0xfd')]+=0x1;_0x815271['countglobal']+=0x1;ami[_0xca68('0x4f')](_0xca68('0x1c5'),ut['buildObj'](_0x402899,'noanswer'));_0x2b720a=_0x34abe3['dialNoAnswerRetryFrequency'];_0x2f3851=_0x34abe3[_0xca68('0x128')];_0x25fca3[_0xca68('0xcf')](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1c6')));if(_0x25fca3[_0xca68('0x1c2')](0x3,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271['countnoanswerretry']>=_0x34abe3[_0xca68('0x1b1')]){_0x25fca3[_0xca68('0x104')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1c7'));}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1c7'));}}break;case'5':_0x34abe3[_0xca68('0x1c8')]+=0x1;_0x815271['state']=0x5;_0x815271['statedesc']=_0xca68('0x1c9');_0x815271[_0xca68('0xfb')]+=0x1;_0x815271[_0xca68('0xf9')]+=0x1;ami['emit'](_0xca68('0x1ca'),ut['buildObj'](_0x402899,'busy'));_0x2b720a=_0x34abe3['dialBusyRetryFrequency'];_0x2f3851=_0x34abe3[_0xca68('0x128')];_0x25fca3[_0xca68('0xcf')](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1cb')));if(_0x25fca3[_0xca68('0x1c2')](0x5,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0xfb')]>=_0x34abe3['dialBusyMaxRetry']){_0x25fca3[_0xca68('0x104')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1cc'));}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,'reason\x205\x20busy');}}break;case'8':_0x34abe3['outboundCongestionCallsDay']+=0x1;_0x815271[_0xca68('0xa9')]=0x8;_0x815271[_0xca68('0xf7')]=_0xca68('0x1cd');_0x815271[_0xca68('0xfc')]+=0x1;_0x815271[_0xca68('0xf9')]+=0x1;_0x2b720a=_0x34abe3[_0xca68('0x1ce')];_0x2f3851=_0x34abe3[_0xca68('0x128')];ami[_0xca68('0x4f')](_0xca68('0x1cf'),ut[_0xca68('0xf2')](_0x402899,'congestion'));_0x25fca3['createHistory'](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1d0')));if(_0x25fca3[_0xca68('0x1c2')](0x8,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0xfc')]>=_0x34abe3[_0xca68('0x1b7')]){_0x25fca3['createStateFinal'](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1d1'));}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1d1'));}}break;case'11':_0x34abe3[_0xca68('0x1d2')]+=0x1;_0x815271[_0xca68('0xa9')]=0xb;_0x815271[_0xca68('0xf7')]=_0xca68('0x130');_0x815271[_0xca68('0x100')]+=0x1;_0x815271[_0xca68('0xf9')]+=0x1;_0x2b720a=_0x34abe3[_0xca68('0x1d3')];_0x2f3851=_0x34abe3[_0xca68('0x128')];_0x25fca3['createHistory'](_0x815271)[_0xca68('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x25fca3['checkRetriveMax'](0xb,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0x100')]>=_0x34abe3['dialAbandonedMaxRetry']){_0x25fca3[_0xca68('0x104')](_0x815271,_0x43f215,_0x2c92e8,'reason\x2011\x20abandoned');}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1d4'));}}break;case'20':_0x34abe3[_0xca68('0x1d5')]+=0x1;_0x815271[_0xca68('0xa9')]=0x14;_0x815271['statedesc']=_0xca68('0x1d6');_0x815271[_0xca68('0x102')]+=0x1;_0x815271['countglobal']+=0x1;_0x2b720a=_0x34abe3[_0xca68('0x1be')];_0x2f3851=_0x34abe3[_0xca68('0x128')];ami[_0xca68('0x4f')](_0xca68('0x1d7'),ut[_0xca68('0xf2')](_0x402899,_0xca68('0x1d8')));_0x25fca3['createHistory'](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1d9')));if(_0x25fca3[_0xca68('0x1c2')](0x14,_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0x102')]>=_0x34abe3[_0xca68('0x1bd')]){_0x25fca3[_0xca68('0x104')](_0x815271,_0x43f215,_0x2c92e8,_0xca68('0x1da'));}else{_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,'reason\x2020\x20agentreject');}}break;default:_0x34abe3[_0xca68('0x6a')]+=0x1;_0x815271[_0xca68('0xa9')]=0xc;_0x815271[_0xca68('0xf7')]=_0x537b75[_0xca68('0x118')];_0x2b720a=_0x34abe3[_0xca68('0x1be')];_0x2f3851=_0x34abe3[_0xca68('0x128')];_0x25fca3[_0xca68('0xcf')](_0x815271)[_0xca68('0xb2')](loggerCatch(_0xca68('0x1db')));if(_0x25fca3[_0xca68('0x1c2')](_0x537b75[_0xca68('0x118')],_0x402899,_0x34abe3)&&!_0x107273){if(_0x815271[_0xca68('0xfb')]+_0x815271[_0xca68('0xfc')]+_0x815271[_0xca68('0xfd')]+_0x815271[_0xca68('0xfe')]+_0x815271[_0xca68('0xff')]+_0x815271[_0xca68('0x100')]+_0x815271[_0xca68('0x101')]+_0x815271[_0xca68('0x102')]>=_0x34abe3[_0xca68('0x10d')]){_0x25fca3[_0xca68('0x10e')](_0x815271,_0x43f215,_0x2c92e8,_0x537b75['reason']);}else{_0x25fca3[_0xca68('0x104')](_0x815271,_0x43f215,_0x2c92e8,_0x537b75[_0xca68('0x118')]);}}}})[_0xca68('0xba')](function(_0x267e02){if(_0x107273){_0x25fca3['swapAdditionalPhones'](_0x815271,_0x2b720a,_0x2f3851)[_0xca68('0xba')](function(_0x4f4403){return _0x43f215(0x1);});}});});};Dialer[_0xca68('0xab')][_0xca68('0x10e')]=function(_0x50e030,_0x54f369,_0x41a4ab,_0x7894b2){var _0x3e1998=new Final(_0x50e030);_0x3e1998[_0xca68('0xa9')]=0xf;_0x3e1998[_0xca68('0xf7')]='Global';this[_0xca68('0x104')](_0x3e1998,_0x54f369,_0x41a4ab,_0x7894b2);};Dialer['prototype'][_0xca68('0x104')]=function(_0x3c1045,_0xa65137,_0x3db416,_0x5ddc98){this[_0xca68('0xce')](_0x3c1045)[_0xca68('0xba')](function(){return _0xa65137(msgResponse(_0xca68('0x1c0'),_0xca68('0xde'),_0x5ddc98));})[_0xca68('0xb2')](function(){return _0x3db416(msgResponse(_0xca68('0x1dc'),_0xca68('0x150'),_0xca68('0x1dd')));});};Dialer['prototype']['predictive']=function(_0x5ab2db){var _0x10f9cb=_0x5ab2db[_0xca68('0x1de')]/0x64;var _0x58776f=_0x5ab2db[_0xca68('0x66')]/(_0x5ab2db[_0xca68('0x66')]+_0x5ab2db[_0xca68('0x61')]);var _0x308a58=Math[_0xca68('0x1df')](_0x5ab2db[_0xca68('0x72')]*(_0x5ab2db['predictiveIntervalMaxThreshold']/0x64));var _0x44ac65=Math[_0xca68('0x1df')](_0x5ab2db['predictiveIntervalAvailable']*(_0x5ab2db[_0xca68('0x1e0')]/0x64));var _0x4804b0=_0x5ab2db[_0xca68('0x52')]+_0x5ab2db[_0xca68('0x57')];var _0x3a22e4=Math[_0xca68('0x1e1')](_0x5ab2db[_0xca68('0x89')]*_0x5ab2db['erlangAbandonmentRate']*_0x5ab2db[_0xca68('0x70')]*_0x5ab2db[_0xca68('0x1e2')]);if(_[_0xca68('0x41')](_0x5ab2db['startProgressive'])){if(!_[_0xca68('0x41')](_0x5ab2db[_0xca68('0x2a')])){_0x5ab2db['startPredictive']=undefined;loggerPredictive[_0xca68('0x9a')](_0xca68('0x1e3'),_0xca68('0x1e4'));}if(!_['isUndefined'](_0x5ab2db[_0xca68('0x90')])){loggerPredictive[_0xca68('0x9a')](_0xca68('0x1e3'),_0xca68('0x1e5'));clearInterval(_0x5ab2db['handlePredictive']);_0x5ab2db['handlePredictive']=undefined;}_0x5ab2db[_0xca68('0x2b')]=moment()[_0xca68('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5ab2db['name'],_0xca68('0x1e6'),_0x5ab2db['startProgressive']);this[_0xca68('0x163')](_0x5ab2db,0x1);}else if(ifInterval(_0x5ab2db[_0xca68('0x1e7')],_0x5ab2db['startProgressive'])){this[_0xca68('0x163')](_0x5ab2db,0x1);loggerPredictiveCalls['info'](_0xca68('0x1e8'),_0x5ab2db[_0xca68('0x2b')],_0x5ab2db[_0xca68('0x47')]);_0x5ab2db[_0xca68('0x89')]=0x0;_0x5ab2db['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x10f9cb<_0x58776f&&_0x5ab2db[_0xca68('0x1e9')]===_0xca68('0x1ea')){freeVariablesPredictive(_0x5ab2db);loggerPredictive[_0xca68('0x7d')](_0xca68('0x1eb'),_0xca68('0x1ec'),_0x58776f,'startProgressive',_0x5ab2db['name']);}else if(_0x3a22e4<_0x5ab2db['predictiveIntervalErlangCallsDroppedCalls']&&_0x5ab2db[_0xca68('0x1e9')]===_0xca68('0x1ea')){freeVariablesPredictive(_0x5ab2db);loggerPredictive[_0xca68('0x7d')](_0xca68('0x1ed'),_0xca68('0x1ee'),_0x3a22e4,_0xca68('0x1ef'),_0x5ab2db[_0xca68('0x6f')],_0xca68('0x2b'),_0x5ab2db[_0xca68('0x47')]);}else if(!ifInterval(_0x5ab2db[_0xca68('0x1e7')],_0x5ab2db[_0xca68('0x2b')])&&_[_0xca68('0x41')](_0x5ab2db[_0xca68('0x2a')])&&!_[_0xca68('0x41')](_0x5ab2db[_0xca68('0x2b')])){_0x5ab2db['startPredictive']=moment()['format'](_0xca68('0x109'));loggerPredictive[_0xca68('0x7d')](_0x5ab2db[_0xca68('0x47')],_0xca68('0x1f0'),_0x5ab2db['startPredictive']);this[_0xca68('0xc4')](_0x5ab2db['dialPredictiveInterval'])[_0xca68('0xba')](this['getDataPredictive'](_0x5ab2db))[_0xca68('0xba')](mergeDataErlangB(_0x5ab2db))[_0xca68('0xba')](this[_0xca68('0x1f1')](_0x5ab2db))[_0xca68('0xb2')](loggerCatchPredictive(_0xca68('0x1f2'),_0x5ab2db));}else if(!ifInterval(_0x5ab2db[_0xca68('0x1e7')],_0x5ab2db[_0xca68('0x2a')])){_0x5ab2db[_0xca68('0x6f')]=0x0;_0x5ab2db[_0xca68('0x2a')]=moment()[_0xca68('0x7a')](_0xca68('0x109'));loggerPredictive[_0xca68('0x7d')](_0x5ab2db['name'],_0xca68('0x1f3'),_0x5ab2db[_0xca68('0x2a')]);clearInterval(_0x5ab2db[_0xca68('0x90')]);_0x5ab2db[_0xca68('0x90')]=undefined;this[_0xca68('0xc4')](_0x5ab2db[_0xca68('0x1e7')])['then'](this[_0xca68('0x1f4')](_0x5ab2db))['then'](mergeDataErlangB(_0x5ab2db))['then'](this[_0xca68('0x1f1')](_0x5ab2db))[_0xca68('0xb2')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5ab2db));}else if(_0x5ab2db[_0xca68('0x72')]&&_0x4804b0<_0x5ab2db[_0xca68('0x72')]-_0x44ac65){freeVariablesPredictive(_0x5ab2db);loggerPredictive['info'](_0x5ab2db[_0xca68('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4804b0,')\x20are\x20less\x20than\x20threshold\x20(',_0x5ab2db['predictiveIntervalAvailable'],'-',_0x44ac65,'=',_0x5ab2db[_0xca68('0x72')]-_0x44ac65,')');}else if(_0x5ab2db[_0xca68('0x72')]&&_0x4804b0>_0x5ab2db['predictiveIntervalAvailable']+_0x308a58){freeVariablesPredictive(_0x5ab2db);loggerPredictive[_0xca68('0x7d')](_0x5ab2db[_0xca68('0x47')],_0xca68('0x1f5'),_0x4804b0,_0xca68('0x1f6'),_0x5ab2db[_0xca68('0x72')],'+',_0x308a58,'=',_0x5ab2db[_0xca68('0x72')]+_0x308a58,')');}};Dialer['prototype'][_0xca68('0x1f4')]=function(_0x2f775e){var _0x494210=this;return function(_0x112832){return new BPromise(function(_0x2e38e7,_0x294220){_[_0xca68('0xd6')](_0x2f775e,_0x112832[0x0]);if(checkGetDataPredictive(_0x112832[0x0])){var _0x36ca64=_0x2f775e['predictiveIntervalAvailable']=_0x2f775e[_0xca68('0x57')]+_0x2f775e[_0xca68('0x52')];var _0x44be76=_0x2f775e[_0xca68('0x1e7')]*0x3c;var _0xf447d5=_0x112832[0x0][_0xca68('0x6c')]+_0x112832[0x0][_0xca68('0x6b')];var _0x543e13=(_0x112832[0x0][_0xca68('0x81')]+_0x112832[0x0][_0xca68('0x123')]+_0x112832[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x112832[0x0]['predictiveIntervalTotalCalls'];_0x2f775e[_0xca68('0x70')]=_0x543e13>0x0?_0x543e13:0x1;switch(_0x2f775e['dialPredictiveOptimization']){case'dropRate':var _0x5164b5=_0x2f775e['dialPredictiveOptimizationPercentage']/0x64;return _0x494210[_0xca68('0x1f7')](_0x36ca64,_0x44be76,_0xf447d5,_0x543e13,_0x5164b5)['then'](function(_0x49d515){return _0x2e38e7(_0x49d515);});case'agentBusyFactor':var _0x44a17=_0x2f775e[_0xca68('0x1de')]/0x64;return _0x494210[_0xca68('0x1f8')](_0x36ca64,_0x44be76,_0xf447d5,_0x543e13,_0x44a17)[_0xca68('0xba')](function(_0x97eda3){return _0x2e38e7(_0x97eda3);});default:return _0x294220(msgResponse(_0xca68('0x1f9'),_0xca68('0x150'),_0xca68('0x1fa')));}}else{return _0x294220(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0xca68('0xab')][_0xca68('0x1fb')]=function(_0x4e20d5){var _0x572b3c=this;return function(_0x471ed4){return new BPromise(function(_0x1b9981,_0x60ae4b){_[_0xca68('0xd6')](_0x4e20d5,_0x471ed4[0x0]);if(checkGetDataPredictive(_0x471ed4[0x0])){loggerPredictive[_0xca68('0x7d')](JSON[_0xca68('0x4c')](_0x471ed4[0x0]));if(_0x4e20d5[_0xca68('0x1e9')]==='dropRate'){return _0x572b3c[_0xca68('0xcc')](_0x4e20d5['id'])[_0xca68('0xba')](function(_0x479131){var _0x2a4164=_0x4e20d5[_0xca68('0x53')]-_0x479131[0x0][_0xca68('0x1fc')];var _0x2b4ce6=_0x4e20d5[_0xca68('0x1e7')]*0x3c;var _0x2dcaf8=_0x471ed4[0x0]['predictiveIntervalAvgTalktime']+_0x471ed4[0x0]['predictiveIntervalAvgHoldtime'];var _0x589201=(_0x471ed4[0x0][_0xca68('0x81')]+_0x471ed4[0x0][_0xca68('0x123')]+_0x471ed4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x471ed4[0x0]['predictiveIntervalTotalCalls'];var _0x4c3b16=_0x4e20d5[_0xca68('0x1de')]/0x64;_0x4e20d5[_0xca68('0x71')]=_0x479131[0x0][_0xca68('0x1fc')]||0x0;_0x4e20d5['predictiveIntervalHitRate']=_0x589201>0x0?_0x589201:0x1;return _0x572b3c[_0xca68('0x1f7')](_0x2a4164,_0x2b4ce6,_0x2dcaf8,_0x589201,_0x4c3b16);})['then'](function(_0x48f392){return _0x1b9981(_0x48f392);})[_0xca68('0xb2')](function(_0x489953){return _0x60ae4b(msgResponse(_0xca68('0x1fd'),_0xca68('0x150'),JSON[_0xca68('0x4c')](_0x489953)));});}if(_0x4e20d5[_0xca68('0x1e9')]===_0xca68('0x1fe')){return _0x572b3c[_0xca68('0xcc')](_0x4e20d5['id'])['then'](function(_0x394414){var _0x2c25e2=_0x4e20d5[_0xca68('0x53')]-_0x394414[0x0]['outboundQueuePauses'];var _0x3082e0=_0x4e20d5[_0xca68('0x1e7')]*0x3c;var _0x200081=_0x471ed4[0x0][_0xca68('0x6c')]+_0x471ed4[0x0][_0xca68('0x6b')];var _0x177f1b=(_0x471ed4[0x0][_0xca68('0x81')]+_0x471ed4[0x0][_0xca68('0x123')]+_0x471ed4[0x0][_0xca68('0x6d')])/_0x471ed4[0x0][_0xca68('0x7f')];var _0x3937b9=_0x4e20d5[_0xca68('0x1de')]/0x64;_0x4e20d5['predictiveIntervalPauses']=_0x394414[0x0][_0xca68('0x1fc')]||0x0;_0x4e20d5['predictiveIntervalHitRate']=_0x177f1b>0x0?_0x177f1b:0x1;return _0x572b3c[_0xca68('0x1f8')](_0x2c25e2,_0x3082e0,_0x200081,_0x177f1b,_0x3937b9);})['then'](function(_0x199eb0){return _0x1b9981(_0x199eb0);})[_0xca68('0xb2')](function(_0xa6fb14){return _0x60ae4b(msgResponse(_0xca68('0x1fd'),'Failure',JSON[_0xca68('0x4c')](_0xa6fb14)));});}}else{return _0x60ae4b(msgResponse(_0xca68('0x1f9'),_0xca68('0x150'),_0xca68('0x1ff')));}});};};Dialer['prototype'][_0xca68('0x1f1')]=function(_0x33819d){var _0x4cbc30=this;return function(){var _0x32a9f9=0x0;var _0x5bdfc0=Math[_0xca68('0x1e1')](_0x33819d['erlangCallToSecond']*0x3e8);if(_0x5bdfc0>0x0){_0x5bdfc0=_0x5bdfc0<0x64?0x64:_0x5bdfc0;loggerPredictive['info'](_0x33819d[_0xca68('0x47')],'one\x20call\x20every:',_0x5bdfc0,_0xca68('0x4d'));_0x33819d[_0xca68('0x90')]=setInterval(function(){_0x4cbc30[_0xca68('0x90')](_0x33819d);loggerPredictiveCalls[_0xca68('0x7d')](_0xca68('0x200'),_0x32a9f9+=0x1);},_0x5bdfc0);}else{loggerPredictive[_0xca68('0x7d')](_0x33819d[_0xca68('0x47')],_0xca68('0x201'));}};};Dialer['prototype'][_0xca68('0x202')]=function(_0x15cdcc,_0x57f266){var _0x4ef27f=this;return function(_0x2d95f6){if(_[_0xca68('0x4a')](_0x2d95f6)){if(_[_0xca68('0xe5')](_0x57f266['UserId'])||!_0x57f266['recallme']){if(_0x15cdcc[_0xca68('0x5c')]==='booked'){_0x15cdcc[_0xca68('0x13b')]=_[_0xca68('0x41')](_0x15cdcc[_0xca68('0x13b')])?!![]:_0x15cdcc[_0xca68('0x13b')];var _0x1cfd3f=uuid['v4']();_0x4ef27f[_0xca68('0x29')][_0x1cfd3f]=new Action(_0x15cdcc,_0x57f266,_0x1cfd3f);loggerBooked['info'](_0xca68('0x203'),_0x1cfd3f,_0xca68('0x204'),JSON[_0xca68('0x4c')](_0x15cdcc[_0xca68('0x13b')]),_0xca68('0x205'),_0x15cdcc[_0xca68('0x47')]);if(_0x15cdcc[_0xca68('0x13b')]){_0x15cdcc[_0xca68('0x13b')]=![];_0x4ef27f[_0xca68('0x2d')][_0x4ef27f[_0xca68('0x29')][_0x1cfd3f][_0xca68('0xb6')]]=[];ami[_0xca68('0xb0')]({'actionid':_0x1cfd3f,'action':'queuestatus','queue':_0x15cdcc[_0xca68('0x47')]})['catch'](function(){_0x4ef27f[_0xca68('0xb4')](_0x15cdcc);_0x4ef27f[_0xca68('0xc6')]({'active':![],'ContactId':_0x4ef27f[_0xca68('0x29')][_0x1cfd3f][_0xca68('0xd8')],'ListId':_0x4ef27f[_0xca68('0x29')][_0x1cfd3f]['ListId'],'VoiceQueueId':_0x4ef27f['actions'][_0x1cfd3f]['VoiceQueueId']||undefined,'CampaignId':_0x4ef27f[_0xca68('0x29')][_0x1cfd3f][_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x206')));delete _0x4ef27f['actions'][_0x1cfd3f];});}else{loggerBooked[_0xca68('0x7d')](_0xca68('0x207'),JSON[_0xca68('0x4c')](_0x15cdcc['queueStatusComplete']),_0xca68('0x205'),_0x15cdcc['name']);_0x4ef27f[_0xca68('0xb4')](_0x15cdcc);_0x4ef27f['rescheduleContact']({'active':![],'ContactId':_0x4ef27f['actions'][_0x1cfd3f][_0xca68('0xd8')],'ListId':_0x4ef27f['actions'][_0x1cfd3f]['ListId'],'VoiceQueueId':_0x4ef27f[_0xca68('0x29')][_0x1cfd3f]['VoiceQueueId']||undefined,'CampaignId':_0x4ef27f[_0xca68('0x29')][_0x1cfd3f][_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x206')));delete _0x4ef27f[_0xca68('0x29')][_0x1cfd3f];}}else{return _0x4ef27f['actionOriginate'](_0x15cdcc,_0x57f266);}}else{if(getDiff(_0x57f266[_0xca68('0x208')])<_0x15cdcc[_0xca68('0x209')]*0x3c){if(_0x57f266[_0xca68('0x172')]&&!_0x57f266[_0xca68('0x172')][_0xca68('0x20a')]){_0x4ef27f[_0xca68('0x22')][_0xca68('0x145')](_0x57f266['id'])[_0xca68('0x20')](function(){_0x4ef27f[_0xca68('0xb4')](_0x15cdcc);});}else{_0x4ef27f[_0xca68('0xc8')]({'active':![]},_0x57f266['id'],0x1)[_0xca68('0x20')](function(){_0x4ef27f['updateOriginated'](_0x15cdcc);});}}else{_0x15cdcc['outboundReCallsDay']+=0x1;_0x4ef27f[_0xca68('0xb4')](_0x15cdcc);if(_0x15cdcc[_0xca68('0x20b')]){_0x4ef27f[_0xca68('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x57f266[_0xca68('0xd8')],'ListId':_0x57f266[_0xca68('0xd9')],'VoiceQueueId':_0x57f266[_0xca68('0xdb')]||undefined,'CampaignId':_0x57f266[_0xca68('0x10a')]||undefined})[_0xca68('0xb2')](loggerCatch(_0xca68('0x20c')));_0x4ef27f[_0xca68('0xcf')](createObjHistory(_0x15cdcc,_0x57f266,'RECALLINQUEUE',0x17,_0xca68('0x20d')))['catch'](loggerCatch(_0xca68('0x20e')));}else{_0x4ef27f[_0xca68('0xd5')](createObjHistory(_0x15cdcc,_0x57f266,_0xca68('0x20f'),0x16,_0xca68('0x210')),_0xca68('0x211'),'[Originate][HistoryRecallClose]');}}}}else{_0x15cdcc[_0xca68('0x62')]+=0x1;_0x4ef27f['saveInDb'](createObjHistory(_0x15cdcc,_0x57f266,_0xca68('0x212'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xca68('0x213'));throw _0xca68('0x214');}};};Dialer[_0xca68('0xab')]['handleIvr']=function(_0x9d8771){var _0x4fce75=this;var _0x24c142=_0x9d8771[_0xca68('0x215')]-_0x9d8771[_0xca68('0x98')]-_0x9d8771['temp'];emitCampaignSummary(_0x9d8771);if(_0x24c142>0x0){if(_0x24c142>this[_0xca68('0x27')]){_0x24c142=this[_0xca68('0x27')];}_0x9d8771[_0xca68('0xca')]+=_0x24c142;this['getContactDialerIvr'](_0x9d8771['id'],_0x24c142,_0x9d8771[_0xca68('0x216')],_0x9d8771)[_0xca68('0xba')](function(_0x3cbb8c){_0x9d8771[_0xca68('0xca')]-=_0x24c142;_0x9d8771[_0xca68('0xca')]=_0x9d8771[_0xca68('0xca')]>0x0?_0x9d8771[_0xca68('0xca')]:0x0;if(!checkContactEmpty(_0x3cbb8c)){_0x9d8771[_0xca68('0x42')]=_0xca68('0x9f');logger[_0xca68('0x7d')](_0xca68('0x217')+_0x9d8771[_0xca68('0x47')]);}else{_0x9d8771[_0xca68('0x98')]+=_0x3cbb8c[_0xca68('0x97')];_0x9d8771[_0xca68('0x42')]=_0xca68('0x218');for(var _0x5395da=0x0;_0x5395da<_0x3cbb8c[_0xca68('0x97')];_0x5395da+=0x1){_0x9d8771['ivrTotalCallsDays']+=0x1;if(_[_0xca68('0xe5')](_0x3cbb8c[_0x5395da])||_[_0xca68('0xe5')](_0x3cbb8c[_0x5395da]['Contact'])||_[_0xca68('0xe5')](_0x3cbb8c[_0x5395da][_0xca68('0x17f')])){_0x4fce75[_0xca68('0xd3')]('[actionOriginate]\x20',_0x9d8771,_0x3cbb8c[_0x5395da]);}else{_0x4fce75[_0xca68('0xc2')](_['pick'](_0x3cbb8c[_0x5395da],[_0xca68('0x10a'),'Contact.phone']))[_0xca68('0xba')](_0x4fce75[_0xca68('0x202')](_0x9d8771,_0x3cbb8c[_0x5395da]))['catch'](_0x4fce75['loggerHandler'](_0xca68('0x219'),_0x9d8771));}}}})[_0xca68('0xb2')](loggerGetContactDialer(_0xca68('0x21a'),_0x9d8771,_0x24c142));}};Dialer[_0xca68('0xab')][_0xca68('0x163')]=function(_0x517f52,_0x1f8c4b){var _0x4b9a21=this;var _0x48a951=[];var _0x3bdc6b=_0x1f8c4b>=0x1?_0x1f8c4b:0x1;if(_0x517f52[_0xca68('0x5c')]==='booked'){_0x3bdc6b=0x1;}var _0x34f809=Math['floor'](_0x517f52[_0xca68('0x52')]*_0x3bdc6b)-_0x517f52[_0xca68('0x98')]-_0x517f52[_0xca68('0xca')];emitVoiceQueueSummary(_0x517f52);if(_0x517f52[_0xca68('0x21b')]>0x0){var _0x5bab72=_0x517f52['dialLimitQueue']-_0x517f52[_0xca68('0x98')]-_0x517f52['talking']-_0x517f52[_0xca68('0xca')]-_0x517f52[_0xca68('0x21c')];if(_0x34f809>_0x5bab72){_0x34f809=_0x5bab72;}}if(_0x34f809>0x0){if(_0x517f52[_0xca68('0x5c')]===_0xca68('0x166')){_0x34f809=0x1;}if(_0x34f809>this[_0xca68('0x27')]){_0x34f809=this['maxNumberOriginate'];}_0x517f52['temp']+=_0x34f809;for(var _0x411072 in this[_0xca68('0x25')]){if(typeof this[_0xca68('0x25')][_0x411072]!==_0xca68('0x99')){if(this[_0xca68('0x25')][_0x411072][_0xca68('0xa9')]===_0xca68('0x21d')&&this[_0xca68('0x25')][_0x411072][_0xca68('0xe1')]===_0xca68('0xe2')){_0x48a951[_0xca68('0x13a')](this[_0xca68('0x25')][_0x411072]['id']);}}}this[_0xca68('0xc9')](_0x517f52['id'],_0x48a951,_0x34f809,_0x517f52[_0xca68('0x216')],_0x517f52)[_0xca68('0xba')](function(_0x3af5e7){_0x517f52[_0xca68('0xca')]-=_0x34f809;_0x517f52['temp']=_0x517f52[_0xca68('0xca')]>0x0?_0x517f52[_0xca68('0xca')]:0x0;if(!checkContactEmpty(_0x3af5e7)){_0x4b9a21['countReScheduled'](_0x517f52)[_0xca68('0xba')](sendMessageReschedule(_0x517f52))[_0xca68('0xb2')](loggerCatch(_0xca68('0xbb')));}else{_0x517f52[_0xca68('0x98')]+=_0x3af5e7[_0xca68('0x97')];_0x517f52[_0xca68('0x42')]=_0x517f52[_0xca68('0x5c')]===_0xca68('0x166')?_0xca68('0x186'):_0xca68('0x218');for(var _0x5c9031=0x0;_0x5c9031<_0x3af5e7['length'];_0x5c9031+=0x1){if(_[_0xca68('0xe5')](_0x3af5e7[_0x5c9031])||_[_0xca68('0xe5')](_0x3af5e7[_0x5c9031][_0xca68('0x195')])||_[_0xca68('0xe5')](_0x3af5e7[_0x5c9031][_0xca68('0x17f')])){_0x4b9a21['emptyContact'](_0xca68('0x21e'),_0x517f52,_0x3af5e7[_0x5c9031]);}else{_0x4b9a21[_0xca68('0xbc')](_['pick'](_0x3af5e7[_0x5c9031],[_0xca68('0xdb'),_0xca68('0x21f')]))[_0xca68('0xba')](_0x4b9a21[_0xca68('0x202')](_0x517f52,_0x3af5e7[_0x5c9031]))[_0xca68('0xb2')](_0x4b9a21[_0xca68('0xd2')]('[actionOriginate]\x20',_0x517f52));}}}})[_0xca68('0xb2')](loggerGetContactDialer(_0xca68('0x220'),_0x517f52,_0x34f809));}};Dialer['prototype'][_0xca68('0x90')]=function(_0x7a9df2){if(_0x7a9df2[_0xca68('0x21b')]>0x0){var _0x34352b=_0x7a9df2[_0xca68('0x21b')]-_0x7a9df2[_0xca68('0x98')]-_0x7a9df2[_0xca68('0x57')];if(_0x34352b>0x0){this[_0xca68('0x221')](_0x7a9df2);}else{loggerPredictiveCalls[_0xca68('0x7d')](_0xca68('0x222'));}}else{this[_0xca68('0x221')](_0x7a9df2);}};Dialer[_0xca68('0xab')][_0xca68('0x221')]=function(_0x3d5385){var _0x131f57=this;var _0x15ca8b=[];_0x3d5385['originated']+=0x1;for(var _0x47fd8e in this['agents']){if(typeof this[_0xca68('0x25')][_0x47fd8e]!==_0xca68('0x99')){if(this[_0xca68('0x25')][_0x47fd8e][_0xca68('0xa9')]==='not_inuse'&&this[_0xca68('0x25')][_0x47fd8e][_0xca68('0xe1')]===_0xca68('0xe2')){_0x15ca8b[_0xca68('0x13a')](this[_0xca68('0x25')][_0x47fd8e]['id']);}}}this['getContactDialer'](_0x3d5385['id'],_0x15ca8b,0x1,_0x3d5385[_0xca68('0x216')],_0x3d5385)[_0xca68('0xba')](function(_0xeac7e6){if(!checkContactEmpty(_0xeac7e6)){checkContactLowerLimitOriginate(_0x3d5385,0x1,0x0);_0x131f57[_0xca68('0xb8')](_0x3d5385)[_0xca68('0xba')](sendMessageReschedule(_0x3d5385))[_0xca68('0xb2')](loggerCatch(_0xca68('0xbb')));}else{_0x3d5385['message']=_0xca68('0x218');if(_[_0xca68('0xe5')](_0xeac7e6[0x0])||_['isNil'](_0xeac7e6[0x0]['Contact'])||_['isNil'](_0xeac7e6[0x0][_0xca68('0x17f')])){_0x131f57['emptyContact'](_0xca68('0x21e'),_0x3d5385,_0xeac7e6[0x0]);}else{_0x131f57[_0xca68('0xbc')](_['pick'](_0xeac7e6[0x0],[_0xca68('0xdb'),_0xca68('0x21f')]))['then'](_0x131f57['checkContactBlack'](_0x3d5385,_0xeac7e6[0x0]))['catch'](_0x131f57['loggerHandler']('[actionOriginatePredictive]\x20',_0x3d5385));}}})[_0xca68('0xb2')](loggerGetContactDialer(_0xca68('0x223'),_0x3d5385,0x1));emitVoiceQueueSummary(_0x3d5385);};Dialer[_0xca68('0xab')][_0xca68('0x1f7')]=function(_0x455dba,_0x2de173,_0x398a3d,_0x6ec690,_0x5f29ec,_0x5da864){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xca68('0x7d')](_0xca68('0x224'),_0x455dba);loggerPredictive[_0xca68('0x7d')](_0xca68('0x225'),_0x2de173);loggerPredictive[_0xca68('0x7d')](_0xca68('0x226'),_0x398a3d);loggerPredictive[_0xca68('0x7d')](_0xca68('0x227'),_0x6ec690);loggerPredictive[_0xca68('0x7d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f29ec);loggerPredictive['info'](_0xca68('0x8d'));return new BPromise(function(_0xe85a65,_0x13c679){if(_0x455dba<=0x0||isNaN(_0x455dba)){return _0x13c679(msgResponse('[abandonmentRate]','Error',_0xca68('0x228')+_0x455dba));}if(_0x398a3d<=0x0||isNaN(_0x398a3d)){return _0x13c679(msgResponse(_0xca68('0x229'),'Error',_0xca68('0x22a')+_0x398a3d));}if(_0x6ec690<=0x0||isNaN(_0x6ec690)){return _0x13c679(msgResponse(_0xca68('0x229'),'Error',_0xca68('0x22b')+_0x6ec690));}if(_0x2de173<=0x0||isNaN(_0x2de173)){return _0x13c679(msgResponse(_0xca68('0x229'),_0xca68('0x1ab'),_0xca68('0x22c')+_0x2de173));}if(_0x5f29ec<=0x0||isNaN(_0x5f29ec)){return _0x13c679(msgResponse('[abandonmentRate]',_0xca68('0x1ab'),'Amax\x20=\x20'+_0x5f29ec));}_0x5da864=_0x5da864||0x0;var _0x3f7b7b=0x1/_0x398a3d;var _0x1978b5=0x0;var _0x194074=0x0;var _0x5e5f8c=0x0;var _0x359820=0x0;for(var _0x1c5ef2=0x0;_0x5e5f8c<_0x5f29ec;_0x1c5ef2+=0x1){_0x194074=_0x1c5ef2/_0x2de173;_0x1978b5=(_0x6ec690*_0x194074+_0x5da864)/_0x3f7b7b;_0x5e5f8c=erlangb(_0x1978b5,_0x455dba);_0x359820=_0x1978b5/_0x455dba*(0x1-erlangb(_0x1978b5,_0x455dba));}return _0xe85a65({'erlangCalls':_0x1c5ef2,'erlangCallToSecond':_0x2de173/_0x1c5ef2,'erlangAbandonmentRate':_0x5e5f8c,'erlangBusyFactor':_0x359820});});};Dialer[_0xca68('0xab')][_0xca68('0x1f8')]=function(_0x19777d,_0x5c4eec,_0x33ea42,_0x3eb86c,_0x55051e,_0x16edbd){loggerPredictive['info'](_0xca68('0x22d'));loggerPredictive[_0xca68('0x7d')](_0xca68('0x224'),_0x19777d);loggerPredictive[_0xca68('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c4eec);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33ea42);loggerPredictive[_0xca68('0x7d')](_0xca68('0x227'),_0x3eb86c);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55051e);loggerPredictive[_0xca68('0x7d')](_0xca68('0x8d'));return new BPromise(function(_0x4b8d74,_0x12a36b){if(_0x19777d<=0x0||isNaN(_0x19777d)){return _0x12a36b(msgResponse(_0xca68('0x22e'),_0xca68('0x1ab'),_0xca68('0x228')+_0x19777d));}if(_0x33ea42<=0x0||isNaN(_0x33ea42)){return _0x12a36b(msgResponse(_0xca68('0x22e'),_0xca68('0x1ab'),_0xca68('0x22a')+_0x33ea42));}if(_0x3eb86c<=0x0||isNaN(_0x3eb86c)){return _0x12a36b(msgResponse(_0xca68('0x22e'),'Error',_0xca68('0x22b')+_0x3eb86c));}if(_0x5c4eec<=0x0||isNaN(_0x5c4eec)){return _0x12a36b(msgResponse('[busyFactor]',_0xca68('0x1ab'),'interval\x20=\x20'+_0x5c4eec));}if(_0x55051e<=0x0||isNaN(_0x55051e)){return _0x12a36b(msgResponse(_0xca68('0x22e'),_0xca68('0x1ab'),'Umin\x20=\x20'+_0x55051e));}_0x16edbd=_0x16edbd||0x0;var _0x19981f=0x1/_0x33ea42;var _0x11a35b=0x0;var _0x40dd4c=0x0;var _0x13ae7f=0x0;var _0x1c845a=0x0;for(var _0x821166=0x0;_0x1c845a<_0x55051e;_0x821166+=0x1){_0x40dd4c=_0x821166/_0x5c4eec;_0x11a35b=(_0x3eb86c*_0x40dd4c+_0x16edbd)/_0x19981f;_0x13ae7f=erlangb(_0x11a35b,_0x19777d);_0x1c845a=_0x11a35b/_0x19777d*(0x1-erlangb(_0x11a35b,_0x19777d));}return _0x4b8d74({'erlangCalls':_0x821166,'erlangCallToSecond':_0x5c4eec/_0x821166,'erlangAbandonmentRate':_0x13ae7f,'erlangBusyFactor':_0x1c845a});});};module['exports']=Dialer; \ No newline at end of file +var _0xc4e6=['diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','milliseconds','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','format','error','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','then','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','saveInDb','pick','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','outboundAnswerCallsDay','statedesc','HangupInAMD','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','minutes','ContactId','ListId','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','dialQueueProject','Unknow','[syncHangupIvr]','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','indexOf','command','iftime\x20%s,%s','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','predictive','method\x20not\x20recognized','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','filter','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','syncCampaigns','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','outboundQueuePauses','predictiveIntervalHitRate','[CatchErlangB]','busyFactor','[getDataPredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','loggerHandler','dialLimitQueue','not_inuse','dialOrderByScheduledAt','ACTIVE','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xc4e6[_0x3932eb];return _0x5316e5;};'use strict';var util=require(_0x6c4e('0x0'));var _=require(_0x6c4e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6c4e('0x2'));var moment=require(_0x6c4e('0x3'));var rr=require('rr');var md5=require(_0x6c4e('0x4'));var Redis=require(_0x6c4e('0x5'));var ut=require('../preview/util/util');var config=require(_0x6c4e('0x6'));var logger=require(_0x6c4e('0x7'))(_0x6c4e('0x8'));var loggerBooked=require('../../../config/logger')(_0x6c4e('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x6c4e('0x7'))(_0x6c4e('0xa'));var loggerSyncQueueSummary=require(_0x6c4e('0x7'))(_0x6c4e('0xb'));var ami=require(_0x6c4e('0xc'));config[_0x6c4e('0xd')]=_[_0x6c4e('0xe')](config[_0x6c4e('0xd')],{'host':_0x6c4e('0xf'),'port':0x18eb});var io=require(_0x6c4e('0x10'))(new Redis(config[_0x6c4e('0xd')]));var cmHopper=require(_0x6c4e('0x11'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x6c4e('0x12'));var cmHopperBlack=require(_0x6c4e('0x13'));var voiceQueueRt=require(_0x6c4e('0x14'));var RpcSetting=require('../rpc/setting');var Action=require(_0x6c4e('0x15'));var History=require(_0x6c4e('0x16'));var Final=require(_0x6c4e('0x17'));var AgentComplete=require(_0x6c4e('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x6c4e('0x19'));var ipAgi=process[_0x6c4e('0x1a')][_0x6c4e('0x1b')]||_0x6c4e('0x1c');var strategy={'rrmemory':_0x6c4e('0x1d'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6c4e('0x1e')][_0x6c4e('0x1f')]=function(_0x1b7746){this['tail']=this['tail']?this['tail']['finally'](_0x1b7746):_0x1b7746();};function Dialer(_0xb0b06c,_0x5946e1){this[_0x6c4e('0x20')]=new Sequence();this['preview']=_0x5946e1;this[_0x6c4e('0x21')]=_0xb0b06c[_0x6c4e('0x21')];this['campaigns']=_0xb0b06c[_0x6c4e('0x22')];this['agents']=_0xb0b06c[_0x6c4e('0x23')];this[_0x6c4e('0x24')]=_0xb0b06c[_0x6c4e('0x24')];this[_0x6c4e('0x25')]=config['maxNumberOriginate']||0x2;this[_0x6c4e('0x26')]={};this[_0x6c4e('0x27')]={};this['contactsId']={};this[_0x6c4e('0x28')]={};this[_0x6c4e('0x29')]={};this[_0x6c4e('0x2a')]={};this[_0x6c4e('0x2b')]={};this[_0x6c4e('0x2c')]={};this['queueBooked']={};this[_0x6c4e('0x2d')]={};ami['on'](_0x6c4e('0x2e'),this['syncAgentConnect']['bind'](this));ami['on'](_0x6c4e('0x2f'),this[_0x6c4e('0x30')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x32'),this[_0x6c4e('0x33')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x34'),this['syncAgentComplete'][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x35'),this[_0x6c4e('0xb')][_0x6c4e('0x31')](this));ami['on']('custom:queuesummarycomplete',this[_0x6c4e('0x36')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x37'),this[_0x6c4e('0x38')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x39'),this[_0x6c4e('0x3a')]['bind'](this));ami['on'](_0x6c4e('0x3b'),this[_0x6c4e('0x3c')]['bind'](this));ami['on'](_0x6c4e('0x3d'),this[_0x6c4e('0x3e')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x6c4e('0x3f')][_0x6c4e('0x31')](this));this['loopCampaigns']();this[_0x6c4e('0x40')]();RpcSetting[_0x6c4e('0x41')]()['then'](function(_0x3e6412){previewRecallmeReminderInterval=_0x3e6412['previewRecallmeReminderInterval'];});}function isNotNull(_0x153743){return _0x153743!==null&&!_[_0x6c4e('0x42')](_0x153743);}function checkIsLoggedIn(_0x5a9e0d,_0x25c96a){return function(){if(_0x25c96a<=0x0){_0x5a9e0d['message']=_0x6c4e('0x43');throw _0x5a9e0d[_0x6c4e('0x44')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x418283){return _0x418283;}function checkIsActive(_0x597d1a,_0x338d3e){return function(){if(!isActive(_0x338d3e)){_0x597d1a[_0x6c4e('0x45')]=_0x6c4e('0x46');throw _0x597d1a[_0x6c4e('0x44')]+_0x6c4e('0x47');}};}function checkInterval(_0xd6285d){return function(){if(!isNotNull(_0xd6285d['Interval'])){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+_0x6c4e('0x49');}if(!isNotNull(_0xd6285d[_0x6c4e('0x4a')][_0x6c4e('0x4b')])){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0xd6285d[_0x6c4e('0x4a')][_0x6c4e('0x4b')]))){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+_0x6c4e('0x49');}};}function msgResponse(_0x18b459,_0x27aaa2,_0x385be7){return{'action':_0x18b459,'response':_0x27aaa2,'message':_0x385be7,'stack':_0x385be7};}function myreject(_0x58e446){return function(_0x5ec04c){return _0x58e446(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x5ec04c)));};}function getSeconds(_0x2d2755,_0x2fe749){var _0x444834=moment(_0x2d2755)['milliseconds'](0x0);var _0x465569=moment(_0x2fe749)['milliseconds'](0x0);return _0x444834[_0x6c4e('0x4c')](_0x465569,_0x6c4e('0x4d'));}function emit(_0x564ee7,_0x5712ea,_0x3ddb81){io['to'](_0x564ee7)[_0x6c4e('0x4e')](_0x5712ea,_0x3ddb81);}function emitVoiceQueueSummary(_0x203e7c){if(_0x203e7c[_0x6c4e('0x4f')]===_0x6c4e('0x50')){var _0x10ccd2={'id':_0x203e7c['id'],'name':_0x203e7c[_0x6c4e('0x44')],'strategy':_0x203e7c[_0x6c4e('0x51')],'answered':_0x203e7c[_0x6c4e('0x52')],'available':_0x203e7c[_0x6c4e('0x53')],'loggedIn':_0x203e7c['loggedIn'],'pTalking':_0x203e7c[_0x6c4e('0x54')],'sumBillable':_0x203e7c[_0x6c4e('0x55')],'sumDuration':_0x203e7c[_0x6c4e('0x56')],'sumHoldTime':_0x203e7c[_0x6c4e('0x57')]||0x0,'talking':_0x203e7c[_0x6c4e('0x58')],'total':_0x203e7c[_0x6c4e('0x59')],'type':_0x203e7c[_0x6c4e('0x4f')],'unmanaged':_0x203e7c[_0x6c4e('0x5a')],'abandoned':_0x203e7c[_0x6c4e('0x5b')],'waiting':_0x203e7c[_0x6c4e('0x5c')],'loggedInDb':_0x203e7c[_0x6c4e('0x5d')],'dialActive':_0x203e7c['dialActive'],'dialMethod':_0x203e7c[_0x6c4e('0x5e')],'dialOriginateCallerIdName':_0x203e7c['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x203e7c[_0x6c4e('0x5f')],'dialOriginateTimeout':_0x203e7c[_0x6c4e('0x60')],'dialPrefix':_0x203e7c[_0x6c4e('0x61')],'outboundAnswerAgiCallsDay':_0x203e7c[_0x6c4e('0x62')],'outboundAnswerCallsDay':_0x203e7c['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x203e7c[_0x6c4e('0x63')],'outboundBusyCallsDay':_0x203e7c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x203e7c[_0x6c4e('0x64')],'outboundDropCallsDayACS':_0x203e7c['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x203e7c[_0x6c4e('0x65')],'outboundDropCallsDayTimeout':_0x203e7c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x203e7c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x203e7c[_0x6c4e('0x66')],'outboundOriginateFailureCallsDay':_0x203e7c[_0x6c4e('0x67')],'outboundReCallsDay':_0x203e7c[_0x6c4e('0x68')],'outboundRejectCallsDay':_0x203e7c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x203e7c[_0x6c4e('0x69')],'predictiveIntervalAnsweredCalls':_0x203e7c[_0x6c4e('0x6a')],'predictiveIntervalAvgHoldtime':_0x203e7c[_0x6c4e('0x6b')],'predictiveIntervalAvgTalktime':_0x203e7c[_0x6c4e('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x203e7c[_0x6c4e('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x203e7c[_0x6c4e('0x6e')],'predictiveIntervalErlangCalls':_0x203e7c[_0x6c4e('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x203e7c[_0x6c4e('0x70')],'predictiveIntervalHitRate':_0x203e7c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x203e7c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x203e7c[_0x6c4e('0x71')],'predictiveIntervalAvailable':_0x203e7c[_0x6c4e('0x72')],'predictiveIntervalTotalCalls':_0x203e7c['predictiveIntervalTotalCalls'],'message':_0x203e7c[_0x6c4e('0x45')],'originated':_0x203e7c['originated'],'erlangCalls':_0x203e7c[_0x6c4e('0x73')],'erlangCallToSecond':_0x203e7c[_0x6c4e('0x74')],'erlangAbandonmentRate':_0x203e7c[_0x6c4e('0x75')],'erlangBusyFactor':_0x203e7c['erlangBusyFactor'],'startPredictive':_0x203e7c['startPredictive'],'startProgressive':_0x203e7c[_0x6c4e('0x2b')]};if(_0x203e7c[_0x6c4e('0x76')]){_0x10ccd2[_0x6c4e('0x76')]={'id':_0x203e7c[_0x6c4e('0x76')]['id'],'name':_0x203e7c[_0x6c4e('0x76')]['name'],'active':_0x203e7c[_0x6c4e('0x76')][_0x6c4e('0x77')],'callerid':_0x203e7c['Trunk'][_0x6c4e('0x78')]};}if(_0x203e7c[_0x6c4e('0x4a')]){_0x10ccd2[_0x6c4e('0x4a')]={'id':_0x203e7c[_0x6c4e('0x4a')]['id'],'name':_0x203e7c[_0x6c4e('0x4a')][_0x6c4e('0x44')]};}var _0x23136f=md5(JSON[_0x6c4e('0x79')](_0x10ccd2));if(_0x203e7c[_0x6c4e('0x4')]!==_0x23136f){_0x203e7c['md5']=_0x23136f;emit(util['format'](_0x6c4e('0x7a'),_0x10ccd2[_0x6c4e('0x44')]),_0x6c4e('0x7b'),_0x10ccd2);}}}function emitCampaignSummary(_0x456825){if(_0x456825[_0x6c4e('0x4f')]===_0x6c4e('0x7c')){emit(util['format']('campaign:ivr:%s',_0x456825['name']),'campaign:save',_0x456825);}}function checkGetDataPredictive(_0x4045b1){if(isNotNull(_0x4045b1)&&!_[_0x6c4e('0x7d')](_0x4045b1)){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x7f'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x80'),_0x4045b1[_0x6c4e('0x81')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x82'),_0x4045b1[_0x6c4e('0x6a')]);loggerPredictive['info'](_0x6c4e('0x83'),_0x4045b1[_0x6c4e('0x6e')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x84'),_0x4045b1[_0x6c4e('0x6d')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x85'),_0x4045b1[_0x6c4e('0x6b')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x86'),_0x4045b1[_0x6c4e('0x6c')]);loggerPredictive['info']('---------------------------');if(_0x4045b1[_0x6c4e('0x81')]>0x0){if(!_[_0x6c4e('0x42')](_0x4045b1['predictiveIntervalAvgTalktime'])&&_0x4045b1[_0x6c4e('0x6c')]>0x0){return!![];}loggerPredictive[_0x6c4e('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x6c4e('0x42')](_0x4045b1[_0x6c4e('0x6b')])&&_0x4045b1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x87'));}else{loggerPredictive[_0x6c4e('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x6c4e('0x88'));}return![];}function mergeDataErlangB(_0x26dfa0){return function(_0x4ac82d){loggerPredictive[_0x6c4e('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x6c4e('0x89'),_0x4ac82d['erlangCalls']);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8a'),_0x4ac82d[_0x6c4e('0x74')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8b'),_0x4ac82d[_0x6c4e('0x75')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8c'),_0x4ac82d[_0x6c4e('0x8d')]);loggerPredictive['info'](_0x6c4e('0x8b'),_0x4ac82d['erlangAbandonmentRate']);loggerPredictive['info'](_0x6c4e('0x8e'));_[_0x6c4e('0x8f')](_0x26dfa0,_0x4ac82d);};}function getDiff(_0x11b28f){var _0x4593ed=moment()[_0x6c4e('0x90')](0x0);var _0x5c3e4e=moment(_0x11b28f)['milliseconds'](0x0);return _0x4593ed[_0x6c4e('0x4c')](_0x5c3e4e,_0x6c4e('0x4d'));}function ifInterval(_0x4698db,_0x42f3d2){if(_['isUndefined'](_0x42f3d2)){return![];}return getDiff(_0x42f3d2)<_0x4698db*0x3c;}function freeVariablesPredictive(_0x2bac22){if(isNotNull(_0x2bac22)){if(!_[_0x6c4e('0x42')](_0x2bac22['startProgressive'])){_0x2bac22[_0x6c4e('0x2b')]=undefined;loggerPredictive['info'](_0x2bac22[_0x6c4e('0x44')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x6c4e('0x42')](_0x2bac22[_0x6c4e('0x2a')])){_0x2bac22[_0x6c4e('0x2a')]=undefined;loggerPredictive[_0x6c4e('0x7e')](_0x2bac22[_0x6c4e('0x44')],_0x6c4e('0x91'));}if(!_[_0x6c4e('0x42')](_0x2bac22[_0x6c4e('0x92')])){clearInterval(_0x2bac22[_0x6c4e('0x92')]);_0x2bac22[_0x6c4e('0x92')]=undefined;loggerPredictive[_0x6c4e('0x7e')](_0x2bac22[_0x6c4e('0x44')],_0x6c4e('0x93'));}}}function erlangb(_0x2c7bb5,_0x4eb6d2){if(_0x4eb6d2===0x0){return 0x0;}var _0x2ceae9=0x1;for(var _0x1aa55b=0x1;_0x1aa55b<=_0x4eb6d2;_0x1aa55b+=0x1){_0x2ceae9=0x1+_0x2ceae9*_0x1aa55b/_0x2c7bb5;}return 0x1/_0x2ceae9;}function isVoiceQueueOutbound(_0x769f14){return _0x769f14===_0x6c4e('0x50');}function isNotPreview(_0x5e8156){return _0x5e8156!==_0x6c4e('0x94');}function isCampaignIvr(_0x23e559){return _0x23e559===_0x6c4e('0x7c');}function getCallerId(_0x1464cb,_0x5a0ef0,_0x509f6f){if(!_[_0x6c4e('0x42')](_0x509f6f)&&typeof _0x509f6f===_0x6c4e('0x95')&&!_[_0x6c4e('0x7d')](_0x509f6f)){if(!_[_0x6c4e('0x42')](_0x5a0ef0)&&typeof _0x5a0ef0==='string'&&!_[_0x6c4e('0x7d')](_0x5a0ef0)){return util['format'](_0x6c4e('0x96'),_0x5a0ef0,_0x509f6f);}return util[_0x6c4e('0x97')](_0x6c4e('0x96'),_0x509f6f,_0x509f6f);}if(!_[_0x6c4e('0x42')](_0x1464cb)&&typeof _0x1464cb===_0x6c4e('0x95')&&!_['isEmpty'](_0x1464cb)){return _0x1464cb;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x42a74d,_0xa4d262){return function(_0x269751){freeVariablesPredictive(_0xa4d262);emitVoiceQueueSummary(_0xa4d262);emitCampaignSummary(_0xa4d262);loggerSyncQueueSummary['debug'](_0x42a74d,util['inspect'](_0x269751,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x127516,_0x27764e){return function(_0x5d0103){loggerPredictive['error'](_0x27764e[_0x6c4e('0x44')],_0x127516);loggerPredictive[_0x6c4e('0x98')](_0x5d0103['stack']);freeVariablesPredictive(_0x27764e);};}function loggerCatch(_0x112da2){return function(_0x145b27){logger[_0x6c4e('0x98')](_0x112da2,util[_0x6c4e('0x99')](_0x145b27,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x27c111){return _0x27c111&&!_[_0x6c4e('0x42')](_0x27c111)&&_0x27c111[_0x6c4e('0x9a')]>0x0;}function decremetOriginate(_0x3edeef){if(!_[_0x6c4e('0x42')](_0x3edeef)&&_0x3edeef!==null){if(typeof _0x3edeef[_0x6c4e('0x9b')]!==_0x6c4e('0x9c')){if(_0x3edeef[_0x6c4e('0x9b')]>0x0){_0x3edeef['originated']-=0x1;}else{logger['error'](_0x6c4e('0x9d'));}}}else{logger[_0x6c4e('0x98')](_0x6c4e('0x9e'));}}function checkContactLowerLimitOriginate(_0x1a7e32,_0x40b359,_0x4493a3){if(_0x40b359>_0x4493a3){for(var _0x5da568=0x0;_0x5da568<_0x40b359-_0x4493a3;_0x5da568+=0x1){decremetOriginate(_0x1a7e32);}}}function loggerGetContactDialer(_0xaee3c0,_0x7809a4,_0x65f4ac){return function(_0x5c2c17){checkContactLowerLimitOriginate(_0x7809a4,_0x65f4ac,0x0);logger[_0x6c4e('0x98')](_0xaee3c0,util[_0x6c4e('0x99')](_0x5c2c17,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x419a1a){return function(_0x5b998b){if(isNotNull(_0x5b998b)&&isNotNull(_0x5b998b[0x0])){if(_0x5b998b[0x0][_0x6c4e('0x9f')]>0x0){_0x419a1a[_0x6c4e('0x45')]=_0x6c4e('0xa0');logger[_0x6c4e('0x7e')]('[getContactDialer2][ReScheduled]'+_0x419a1a['name'],_0x5b998b[0x0][_0x6c4e('0x9f')],_0x6c4e('0xa1'));}else{_0x419a1a['message']=_0x6c4e('0xa2');logger[_0x6c4e('0x7e')](_0x6c4e('0xa3')+_0x419a1a[_0x6c4e('0x44')]);}}};}function notSendMessagesQueue(_0x1679d3){if(_0x1679d3[_0x6c4e('0xa4')]){freeVariablesPredictive(_0x1679d3);if(_0x1679d3[_0x6c4e('0x9b')]===0x0&&_0x1679d3[_0x6c4e('0x58')]===0x0&&_0x1679d3[_0x6c4e('0x5c')]===0x0&&(_0x1679d3['pTalking']||0x0)===0x0){_0x1679d3[_0x6c4e('0xa4')]=![];_0x1679d3[_0x6c4e('0x53')]=0x0;_0x1679d3['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xa6'),_0x1679d3[_0x6c4e('0x44')],_0x6c4e('0xa7'));}else{_0x1679d3['message']=_0x6c4e('0xa8');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xa6'),_0x1679d3[_0x6c4e('0x44')],_0x6c4e('0xa9'));}emitVoiceQueueSummary(_0x1679d3);}}function notSendMessagesCampaign(_0x545674){if(_0x545674[_0x6c4e('0xa4')]){if(_0x545674['originated']===0x0){_0x545674[_0x6c4e('0xa4')]=![];_0x545674[_0x6c4e('0x45')]=_0x6c4e('0x46');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xaa'),_0x545674[_0x6c4e('0x44')],'is\x20not\x20active');}else{_0x545674[_0x6c4e('0x45')]=_0x6c4e('0xa8');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xaa'),_0x545674['name'],_0x6c4e('0xa9'));}emitCampaignSummary(_0x545674);}}function createObjHistory(_0x15f070,_0xad50ed,_0x51bdaa,_0x5b8bca,_0x219a57){_0x15f070[_0x6c4e('0x45')]=_0x51bdaa;var _0x27a6b6=new Action(_0x15f070,_0xad50ed);var _0x45e4e7=new History(_0x27a6b6);_0x45e4e7[_0x6c4e('0xab')]=_0x5b8bca;_0x45e4e7['statedesc']=_0x219a57;_0x45e4e7[_0x6c4e('0xac')]=_0x27a6b6[_0x6c4e('0xad')];return _0x45e4e7;}Dialer[_0x6c4e('0x1e')][_0x6c4e('0x40')]=function(){var _0x1527f7=this;setInterval(function(){_0x1527f7[_0x6c4e('0xae')](_0x1527f7['uniqueId'],_0x6c4e('0xaf'));_0x1527f7[_0x6c4e('0xae')](_0x1527f7[_0x6c4e('0x27')],_0x6c4e('0xb0'));},0x32c8);};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xae')]=function(_0x1bc743,_0x5bc584){var _0x49c600=this;for(var _0x395d62 in _0x1bc743){if(typeof _0x1bc743[_0x395d62]!=='undefined'){this[_0x6c4e('0x20')]['enqueue'](function(){if(!_[_0x6c4e('0xb1')](_0x1bc743[_0x395d62])){return ami[_0x6c4e('0xb2')]({'action':_0x6c4e('0xb3'),'channel':_0x1bc743[_0x395d62][_0x6c4e('0xb4')]})[_0x6c4e('0xb5')](function(_0x35c2d6){if(_0x35c2d6[_0x6c4e('0x45')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1bc743[_0x395d62]&&_0x1bc743[_0x395d62]['type']!==_0x6c4e('0x7c')){_0x49c600[_0x6c4e('0xb6')](_0x49c600[_0x6c4e('0x21')][_0x1bc743[_0x395d62]['queue']]);logger[_0x6c4e('0x98')](_0x6c4e('0xb7'),_0x5bc584,_0x395d62,_0x1bc743[_0x395d62][_0x6c4e('0xb8')]);delete _0x1bc743[_0x395d62];}if(_0x1bc743[_0x395d62]&&_0x1bc743[_0x395d62]['type']===_0x6c4e('0x7c')){_0x49c600[_0x6c4e('0xb6')](_0x49c600['campaigns'][_0x1bc743[_0x395d62][_0x6c4e('0xb8')]]);logger['error'](_0x6c4e('0xb9'),_0x5bc584,_0x395d62,_0x1bc743[_0x395d62][_0x6c4e('0xb8')]);delete _0x1bc743[_0x395d62];}},0x2328);}});}});}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xba')]=function(_0x72a70){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xba')](_0x72a70))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbc')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xbd')]=function(_0x5f37c5){return BPromise['resolve']()['then'](cmHopperBlack[_0x6c4e('0xbd')](_0x5f37c5))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbe')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xbf')]=function(_0x348fda,_0x50737b,_0x51f224){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x348fda,_0x50737b,_0x51f224))[_0x6c4e('0xb5')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc1')]=function(_0x32f0c1,_0x293f10,_0x34ca63){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperAdditionalPhone[_0x6c4e('0xc1')](_0x32f0c1,_0x293f10,_0x34ca63))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xc2')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc3')]=function(_0x4c2be3){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperBlack[_0x6c4e('0xc3')](_0x4c2be3))[_0x6c4e('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc4')]=function(_0xd1b6bb){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperHistory[_0x6c4e('0xc5')](_0xd1b6bb))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xc6')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc7')]=function(_0x4f7f7c){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopper['rescheduleContact'](_0x4f7f7c))['catch'](loggerCatch(_0x6c4e('0xc8')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc9')]=function(_0x4dc9b9,_0x13963b,_0x1282c9){return BPromise['resolve']()[_0x6c4e('0xc0')](cmHopper[_0x6c4e('0xc9')](_0x4dc9b9,_0x13963b,_0x1282c9))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xca')));};Dialer['prototype']['getContactDialer']=function(_0x54e379,_0x3c20fe,_0x471fc3,_0x2e06cf,_0x4a1b53){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xcb')](_0x54e379,_0x3c20fe,_0x471fc3,_0x2e06cf))[_0x6c4e('0xb5')](function(_0x131ffb){_0x4a1b53[_0x6c4e('0xcc')]-=_0x471fc3;_0x4a1b53[_0x6c4e('0xcc')]=_0x4a1b53[_0x6c4e('0xcc')]>0x0?_0x4a1b53[_0x6c4e('0xcc')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x131ffb);});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xcd')]=function(_0x1f6d24,_0x2a6922,_0x44bffb,_0x35ae02){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xcd')](_0x1f6d24,_0x2a6922,_0x44bffb))['catch'](function(_0x22ab9a){_0x35ae02[_0x6c4e('0xcc')]-=_0x2a6922;_0x35ae02[_0x6c4e('0xcc')]=_0x35ae02[_0x6c4e('0xcc')]>0x0?_0x35ae02[_0x6c4e('0xcc')]:0x0;loggerCatch(_0x6c4e('0xce'))(_0x22ab9a);});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xcf')]=function(_0x626748){return BPromise['resolve']()['then'](voiceQueueRt[_0x6c4e('0xcf')](_0x626748))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd0')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd1')]=function(_0x151532){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopper[_0x6c4e('0xd1')](_0x151532))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd2')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd3')]=function(_0x251030){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperHistory[_0x6c4e('0xd3')](_0x251030))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd4')));};Dialer[_0x6c4e('0x1e')]['updateOriginated']=function(_0x3f448b){if(!_[_0x6c4e('0x42')](_0x3f448b)&&_0x3f448b!==null){if(typeof _0x3f448b[_0x6c4e('0x9b')]!=='undefined'){if(_0x3f448b['originated']>0x0){_0x3f448b['originated']-=0x1;}else{logger[_0x6c4e('0x98')](_0x6c4e('0xd5'));}}}else{logger[_0x6c4e('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6c4e('0x1e')]['loggerHandler']=function(_0x5d5019,_0x1f4729){var _0x4eb3b6=this;return function(_0x2ec4c3){_0x4eb3b6['updateOriginated'](_0x1f4729);logger['error'](_0x5d5019,util[_0x6c4e('0x99')](_0x2ec4c3,{'showHidden':![],'depth':null}));};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd6')]=function(_0x1d7876,_0x175652,_0x40469a){var _0x5bb70b={'state':0x19,'statedesc':'notFound'};this[_0x6c4e('0xb6')](_0x175652);this[_0x6c4e('0xd7')](_[_0x6c4e('0x8f')](_0x5bb70b,_[_0x6c4e('0xd8')](_0x40469a,['ContactId','ListId','UserId',_0x6c4e('0xd9'),_0x6c4e('0xda')])),_0x6c4e('0xdb'),_0x6c4e('0xdc'));logger[_0x6c4e('0x98')](_0x1d7876);};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xdd')]=function(_0x115e75){return _0x115e75===_0x6c4e('0xde');};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xdf')]=function(_0x2dcbad){return!_['isUndefined'](_0x2dcbad)&&_0x2dcbad&&!_[_0x6c4e('0x42')](_0x2dcbad[_0x6c4e('0x44')])&&!_[_0x6c4e('0x42')](_0x2dcbad[_0x6c4e('0x77')])&&_0x2dcbad[_0x6c4e('0x77')]&&(this[_0x6c4e('0x24')][util['format']('SIP/%s',_0x2dcbad[_0x6c4e('0x44')])][_0x6c4e('0xb3')]===_0x6c4e('0xe0')||this['trunks'][util['format'](_0x6c4e('0xe1'),_0x2dcbad['name'])][_0x6c4e('0xb3')]===_0x6c4e('0xe2'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd7')]=function(_0x525445,_0x482235,_0xa02fd5){this[_0x6c4e('0xd3')](_0x525445)[_0x6c4e('0xb5')](loggerCatch(_0x482235));this[_0x6c4e('0xd1')](_0x525445)[_0x6c4e('0xb5')](loggerCatch(_0xa02fd5));};Dialer[_0x6c4e('0x1e')]['syncVarSet']=function(_0x26d585){var _0x47650a=this[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];var _0x17736e;if(!_[_0x6c4e('0xb1')](_0x26d585)&&!_['isNil'](_0x26d585[_0x6c4e('0xe4')])&&!_[_0x6c4e('0xb1')](_0x26d585[_0x6c4e('0xe4')][_0x6c4e('0xe5')])&&_0x26d585[_0x6c4e('0xe6')]==='xcally-motion-dialer'&&_0x47650a){if(_0x47650a[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&this[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585[_0x6c4e('0xe8')]==='HANGUP'){delete this['uniqueId'][_0x26d585['uniqueid']];this[_0x6c4e('0xb6')](this['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]]);this['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;this[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0x62')]+=0x1;_0x17736e=new Hangup(_0x47650a,_0x26d585);_0x17736e['state']=0x12;_0x17736e[_0x6c4e('0xea')]=_0x6c4e('0xeb');_0x17736e['membername']=_0x6c4e('0xec');ami[_0x6c4e('0x4e')](_0x6c4e('0xed'),ut[_0x6c4e('0xee')](_0x17736e,'amd'));this[_0x6c4e('0xd7')](_0x17736e,_0x6c4e('0xef'),'[syncHangupInAMD]');}if(_0x47650a[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&this[_0x6c4e('0x21')][_0x47650a['queue']]['dialAMDActive']&&_0x26d585[_0x6c4e('0xe8')]==='MACHINE'){var _0x110fe4=this;return new BPromise(function(_0x4049c4,_0x477aaa){delete _0x110fe4['uniqueId'][_0x26d585[_0x6c4e('0xe3')]];_0x110fe4['updateOriginated'](_0x110fe4['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]]);_0x110fe4[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;_0x110fe4['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0x62')]+=0x1;var _0x521939=_0x110fe4[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]];var _0x52c7e8=new Hangup(_0x47650a,_0x26d585);_0x52c7e8[_0x6c4e('0xab')]=0x13;_0x52c7e8[_0x6c4e('0xea')]=_0x6c4e('0xf0');_0x52c7e8[_0x6c4e('0xf1')]=_0x6c4e('0xec');_0x52c7e8[_0x6c4e('0xf2')]+=0x1;_0x52c7e8[_0x6c4e('0xf3')]+=0x1;_0x52c7e8[_0x6c4e('0xf4')]=!![];ami[_0x6c4e('0x4e')](_0x6c4e('0xed'),ut[_0x6c4e('0xee')](_0x52c7e8,_0x6c4e('0xf4')));_0x110fe4[_0x6c4e('0xd3')](_0x52c7e8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x52c7e8[_0x6c4e('0xf6')]+_0x52c7e8[_0x6c4e('0xf7')]+_0x52c7e8[_0x6c4e('0xf8')]+_0x52c7e8[_0x6c4e('0xf9')]+_0x52c7e8[_0x6c4e('0xfa')]+_0x52c7e8[_0x6c4e('0xfb')]+_0x52c7e8[_0x6c4e('0xf2')]+_0x52c7e8[_0x6c4e('0xfc')]>=_0x521939['dialGlobalMaxRetry']){_0x110fe4[_0x6c4e('0xfd')](_0x52c7e8,_0x4049c4,_0x477aaa,'reason19\x20machine....');}else{if(_0x52c7e8[_0x6c4e('0xf2')]>=_0x521939[_0x6c4e('0xfe')]){_0x110fe4[_0x6c4e('0xff')](_0x52c7e8,_0x4049c4,_0x477aaa,'reason\x2019\x20machine....');}else{_0x110fe4[_0x6c4e('0xc7')]({'active':![],'countmachineretry':_0x52c7e8['countmachineretry'],'scheduledat':moment()[_0x6c4e('0x100')](_0x521939['dialMachineRetryFrequency'],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x52c7e8[_0x6c4e('0x102')],'ListId':_0x52c7e8[_0x6c4e('0x103')],'VoiceQueueId':_0x52c7e8[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x52c7e8['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x4049c4({'reschedule':0x1});}}});}if(_0x47650a[_0x6c4e('0x4f')]==='ivr'&&this['campaigns'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585[_0x6c4e('0xe8')]===_0x6c4e('0x104')){delete this[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]]);_0x17736e=new Hangup(_0x47650a,_0x26d585);_0x17736e[_0x6c4e('0xab')]=0x12;_0x17736e[_0x6c4e('0xea')]=_0x6c4e('0xeb');_0x17736e[_0x6c4e('0xf1')]=_0x6c4e('0xec');ami[_0x6c4e('0x4e')]('custom:amd',ut[_0x6c4e('0xee')](_0x17736e,_0x6c4e('0xf4')));this[_0x6c4e('0xd7')](_0x17736e,_0x6c4e('0x105'),_0x6c4e('0x106'));}if(_0x47650a[_0x6c4e('0x4f')]===_0x6c4e('0x7c')&&this[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585['value']===_0x6c4e('0x107')){var _0x110fe4=this;return new BPromise(function(_0x31458b,_0x229eb2){delete _0x110fe4[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];_0x110fe4[_0x6c4e('0xb6')](_0x110fe4[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]]);_0x110fe4['campaigns'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;_0x110fe4['campaigns'][_0x47650a[_0x6c4e('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4fae22=_0x110fe4['campaigns'][_0x47650a['queue']];var _0x39b8a3=new Hangup(_0x47650a,_0x26d585);_0x39b8a3[_0x6c4e('0xab')]=0x13;_0x39b8a3[_0x6c4e('0xea')]=_0x6c4e('0xf0');_0x39b8a3['membername']=_0x6c4e('0xec');_0x39b8a3[_0x6c4e('0xf2')]+=0x1;_0x39b8a3[_0x6c4e('0xf3')]+=0x1;_0x39b8a3[_0x6c4e('0xf4')]=!![];ami['emit']('custom:amd',ut[_0x6c4e('0xee')](_0x39b8a3,_0x6c4e('0xf4')));_0x110fe4[_0x6c4e('0xd3')](_0x39b8a3)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x39b8a3[_0x6c4e('0xf6')]+_0x39b8a3[_0x6c4e('0xf7')]+_0x39b8a3[_0x6c4e('0xf8')]+_0x39b8a3['countnosuchnumberretry']+_0x39b8a3[_0x6c4e('0xfa')]+_0x39b8a3[_0x6c4e('0xfb')]+_0x39b8a3[_0x6c4e('0xf2')]+_0x39b8a3[_0x6c4e('0xfc')]>=_0x4fae22[_0x6c4e('0x108')]){_0x110fe4[_0x6c4e('0xfd')](_0x39b8a3,_0x31458b,_0x229eb2,_0x6c4e('0x109'));}else{if(_0x39b8a3['countmachineretry']>=_0x4fae22[_0x6c4e('0xfe')]){_0x110fe4['createStateFinal'](_0x39b8a3,_0x31458b,_0x229eb2,_0x6c4e('0x10a'));}else{_0x110fe4[_0x6c4e('0xc7')]({'active':![],'countmachineretry':_0x39b8a3[_0x6c4e('0xf2')],'scheduledat':moment()[_0x6c4e('0x100')](_0x4fae22[_0x6c4e('0x10b')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x39b8a3[_0x6c4e('0x102')],'ListId':_0x39b8a3[_0x6c4e('0x103')],'VoiceQueueId':_0x39b8a3[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x39b8a3['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10d')));_0x31458b({'reschedule':0x1});}}});}}};Dialer[_0x6c4e('0x1e')]['syncHangup']=function(_0x5a0fbd){var _0xe22ca9=this[_0x6c4e('0x28')][_0x5a0fbd['uniqueid']];var _0x512775=this;var _0x447f33;if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]===_0x6c4e('0x7c')){delete this[_0x6c4e('0x28')][_0x5a0fbd[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x22')][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x22')][_0xe22ca9['queue']][_0x6c4e('0x10e')]+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);this[_0x6c4e('0xd3')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10f')));this[_0x6c4e('0xd1')](_0x447f33)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]!=='ivr'&&isNotNull(this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]]['dialQueueProject'])){delete this[_0x6c4e('0x28')][_0x5a0fbd['uniqueid']];this[_0x6c4e('0xb6')](this['voiceQueues'][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;this[_0x6c4e('0x21')][_0xe22ca9['queue']][_0x6c4e('0x62')]+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);_0x447f33[_0x6c4e('0xab')]=0x10;_0x447f33[_0x6c4e('0xea')]=_0x6c4e('0x110');_0x447f33[_0x6c4e('0xf1')]=_0x6c4e('0x111');this['createHistory'](_0x447f33)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6c4e('0xd1')](_0x447f33)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&!isNotNull(this['voiceQueues'][_0xe22ca9['queue']][_0x6c4e('0x112')])){delete this[_0x6c4e('0x28')][_0x5a0fbd[_0x6c4e('0xe3')]];this['updateOriginated'](this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x21')][_0xe22ca9['queue']]['outboundUnknownCallsDay']+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);_0x447f33[_0x6c4e('0xab')]=0xc;_0x447f33[_0x6c4e('0xea')]=_0x5a0fbd['cause-txt'];_0x447f33['membername']=_0x6c4e('0x113');this[_0x6c4e('0xd3')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10f')));this[_0x6c4e('0xd1')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x114')));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x115')]=function(_0x5030da){var _0x9d1638=this['uniqueId'][_0x5030da[_0x6c4e('0xe3')]];var _0x3f797f=this;if(this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]]){if(_0x9d1638&&_0x9d1638[_0x6c4e('0x4f')]!=='ivr'){delete this['uniqueId'][_0x5030da[_0x6c4e('0xe3')]];this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;var _0x5cc71d=new AgentComplete(_0x9d1638,_0x5030da);if(_0x5030da[_0x6c4e('0x116')]==='agent'){_0x5cc71d[_0x6c4e('0x117')]=this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]][_0x6c4e('0x118')]&&this['voiceQueues'][_0x5030da[_0x6c4e('0xb8')]]['dialAgiAfterHangupAgent']?moment()[_0x6c4e('0x97')](_0x6c4e('0x10c')):undefined;}this['createHistory'](_0x5cc71d)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x119')));this[_0x6c4e('0xd1')](_0x5cc71d)['catch'](loggerCatch(_0x6c4e('0x11a')));}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x11b')]=function(_0x25a715){if(this['voiceQueues'][_0x25a715[_0x6c4e('0xb8')]]){if(this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]]&&this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]][_0x6c4e('0x4f')]!==_0x6c4e('0x7c')){this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][_0x25a715[_0x6c4e('0xb8')]]);this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]][_0x6c4e('0x11c')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x11d')]=function(_0x12c4c8,_0x217119){this[_0x6c4e('0xd3')](_0x12c4c8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x119')));if(_0x217119==0x0){this[_0x6c4e('0xd1')](_0x12c4c8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x11e')));}};Dialer['prototype'][_0x6c4e('0x30')]=function(_0x40e785){var _0x214d3f=this['uniqueId'][_0x40e785['uniqueid']];var _0x1f8356=this;var _0xcfe998=![];var _0x39a279;var _0x4d9032;if(this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]]){if(_0x214d3f&&_0x214d3f[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')){delete this[_0x6c4e('0x28')][_0x40e785[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][_0x40e785['queue']]);_0x214d3f[_0x6c4e('0x11f')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));var _0x368b61=new QueueCallerAbandon(_0x214d3f,_0x40e785);if(getSeconds(_0x214d3f[_0x6c4e('0x11f')],_0x214d3f[_0x6c4e('0x120')])>=_0x214d3f[_0x6c4e('0x121')]){this[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x6e')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x122')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x70')]+=0x1;_0x368b61[_0x6c4e('0xab')]=0xa;_0x368b61[_0x6c4e('0xea')]=_0x6c4e('0x123');_0x368b61[_0x6c4e('0x124')]=_0x6c4e('0x125');_0x368b61['agiafterat']=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x118')]?moment()[_0x6c4e('0x97')](_0x6c4e('0x10c')):undefined;_0x368b61[_0x6c4e('0xfa')]+=0x1;_0x368b61[_0x6c4e('0xf3')]+=0x1;_0x39a279=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x126')];_0x4d9032=this[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x127')];_0x1f8356[_0x6c4e('0xbf')](_0x368b61,_0x368b61[_0x6c4e('0xab')],_0x214d3f[_0x6c4e('0x128')])[_0x6c4e('0xc0')](function(_0x9c3689){_0xcfe998=_0x9c3689[_0x6c4e('0x129')]==0x1;if(_0x368b61[_0x6c4e('0xfa')]>=_0x1f8356[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x12a')]){_0x1f8356[_0x6c4e('0x11d')](_0x368b61,_0x9c3689[_0x6c4e('0x129')]);}else{_0x1f8356[_0x6c4e('0xc7')]({'active':![],'countdropretry':_0x368b61[_0x6c4e('0xfa')],'scheduledat':moment()['add'](_0x1f8356[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x126')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x214d3f['ContactId'],'ListId':_0x214d3f[_0x6c4e('0x103')],'VoiceQueueId':_0x214d3f[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x214d3f[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x12b')));var _0x533be9=new History(_0x368b61);_0x533be9['state']=0xa;_0x533be9[_0x6c4e('0xea')]=_0x6c4e('0x123');_0x533be9[_0x6c4e('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x533be9['endtime']=_0x533be9['starttime'];_0x533be9[_0x6c4e('0x12c')]=_0x368b61['calleridname'];_0x533be9['calleridnum']=_0x368b61[_0x6c4e('0x12d')];_0x1f8356[_0x6c4e('0xd3')](_0x533be9)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x6c4e('0xc0')](function(_0x1fc138){if(_0xcfe998)_0x1f8356[_0x6c4e('0xc1')](_0x368b61,_0x39a279,_0x4d9032)[_0x6c4e('0xc0')](function(_0x7f20ab){return 0x1;});});}else{this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x6d')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x65')]+=0x1;_0x368b61[_0x6c4e('0xab')]=0xb;_0x368b61[_0x6c4e('0xea')]=_0x6c4e('0x12e');_0x368b61['dropreason']=_0x6c4e('0x12f');_0x368b61['countabandonedretry']+=0x1;_0x368b61[_0x6c4e('0xf3')]+=0x1;_0x39a279=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]]['dialAbandonedRetryFrequency'];_0x4d9032=this['voiceQueues'][_0x40e785['queue']][_0x6c4e('0x127')];_0x1f8356[_0x6c4e('0xbf')](_0x368b61,_0x368b61[_0x6c4e('0xab')],_0x214d3f[_0x6c4e('0x128')])[_0x6c4e('0xc0')](function(_0x1da368){if(_0x368b61[_0x6c4e('0xfb')]>=_0x1f8356['voiceQueues'][_0x40e785[_0x6c4e('0xb8')]]['dialAbandonedMaxRetry']){_0x1f8356[_0x6c4e('0x11d')](_0x368b61,_0x1da368[_0x6c4e('0x129')]);}else{_0x1f8356[_0x6c4e('0xc7')]({'active':![],'countabandonedretry':_0x368b61[_0x6c4e('0xfb')],'scheduledat':moment()['add'](_0x1f8356['voiceQueues'][_0x40e785['queue']][_0x6c4e('0x130')],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x214d3f[_0x6c4e('0x102')],'ListId':_0x214d3f[_0x6c4e('0x103')],'VoiceQueueId':_0x214d3f[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x214d3f['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x11b50d=new History(_0x368b61);_0x11b50d[_0x6c4e('0xab')]=0xb;_0x11b50d[_0x6c4e('0xea')]='Abandoned';_0x11b50d['starttime']=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));_0x11b50d[_0x6c4e('0xac')]=_0x11b50d[_0x6c4e('0xad')];_0x11b50d[_0x6c4e('0x12c')]=_0x368b61['calleridname'];_0x11b50d[_0x6c4e('0x12d')]=_0x368b61[_0x6c4e('0x12d')];_0x1f8356[_0x6c4e('0xd3')](_0x11b50d)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x131')));}})['then'](function(_0x88cb13){if(_0xcfe998)_0x1f8356[_0x6c4e('0xc1')](_0x368b61,_0x39a279,_0x4d9032)[_0x6c4e('0xc0')](function(_0x5b30c1){return 0x1;});});}}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3a')]=function(_0x1aa1cf){if(this[_0x6c4e('0x27')][_0x1aa1cf[_0x6c4e('0xe3')]]){this['actions'][_0x1aa1cf[_0x6c4e('0xe3')]][_0x6c4e('0xb4')]=_0x1aa1cf[_0x6c4e('0xb4')];}if(this[_0x6c4e('0x28')][_0x1aa1cf[_0x6c4e('0xe3')]]){this[_0x6c4e('0x28')][_0x1aa1cf[_0x6c4e('0xe3')]]['channel']=_0x1aa1cf['channel'];}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3e')]=function(_0x31a798){if(strategy[this['voiceQueues'][this['actions'][_0x31a798[_0x6c4e('0x132')]]['queue']][_0x6c4e('0x51')]]===_0x6c4e('0x133')){if(this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]]&&_[_0x6c4e('0xb1')](this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0x134')])&&_0x31a798[_0x6c4e('0xb3')]==='1'&&_0x31a798[_0x6c4e('0x135')]==='0'){if(this[_0x6c4e('0x23')][_0x31a798[_0x6c4e('0x136')]]){if(!this['agents'][_0x31a798[_0x6c4e('0x136')]][_0x6c4e('0x134')]){this[_0x6c4e('0x23')][_0x31a798[_0x6c4e('0x136')]][_0x6c4e('0x134')]=!![];this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0x134')]=!![];this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0x136')]=_0x31a798[_0x6c4e('0x136')];}}}}else if((strategy[this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]]['queue']][_0x6c4e('0x51')]]||'rrmemory')===_0x6c4e('0x1d')){if(this['actions'][_0x31a798[_0x6c4e('0x132')]]){if(this['agents'][_0x31a798[_0x6c4e('0x136')]]){this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0x136')]=_0x31a798[_0x6c4e('0x136')];if(_[_0x6c4e('0xb1')](this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0xb8')]])){this['queueBooked'][this['actions'][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]=[];}this['queueBooked'][this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x138')](_[_0x6c4e('0x8f')](_['pick'](this[_0x6c4e('0x27')][_0x31a798['actionid']],[_0x6c4e('0x139'),_0x6c4e('0x136')]),{'status':_0x31a798[_0x6c4e('0xb3')],'paused':_0x31a798[_0x6c4e('0x135')]}));}}}};function unlockQueueStatus(_0x13943c,_0x1bd1fd){setTimeout(function(){if(_[_0x6c4e('0x42')](_0x13943c[_0x6c4e('0x13a')])){loggerBooked[_0x6c4e('0x98')](_0x6c4e('0x13b'),_0x1bd1fd);}_0x13943c['queueStatusComplete']=!![];loggerBooked[_0x6c4e('0x7e')](_0x6c4e('0x13c'),_0x1bd1fd,JSON[_0x6c4e('0x79')](_['pick'](_0x13943c,[_0x6c4e('0x44'),_0x6c4e('0x13a')])));},0x1f3);}Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3f')]=function(_0x292ec8){var _0x30b46a=this;var _0x78d330=_0x30b46a[_0x6c4e('0x21')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0xb8')]];if(strategy[this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]][_0x6c4e('0x51')]]===_0x6c4e('0x133')){if(this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]&&this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0x136')]){this[_0x6c4e('0x94')][_0x6c4e('0x13d')](this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x139')],this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x136')])[_0x6c4e('0xb5')](function(_0x37aa87){logger[_0x6c4e('0x98')](_0x6c4e('0x13e'),util['inspect'](_0x37aa87,{'showHidden':![],'depth':null}));})[_0x6c4e('0x13f')](function(){_0x30b46a[_0x6c4e('0xb6')](_0x30b46a[_0x6c4e('0x21')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]);_0x30b46a['agents'][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x136')]]['locked']=![];delete _0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]];unlockQueueStatus(_0x78d330);});}else{this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['queue']]);this[_0x6c4e('0xc7')]({'active':![],'ContactId':this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0x102')],'ListId':this['actions'][_0x292ec8[_0x6c4e('0x132')]]['ListId'],'VoiceQueueId':this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x140')));delete this['actions'][_0x292ec8['actionid']];unlockQueueStatus(_0x78d330);}}else if((strategy[this['voiceQueues'][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]][_0x6c4e('0x51')]]||_0x6c4e('0x1d'))===_0x6c4e('0x1d')){var _0x4832f4;if(this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]&&!_[_0x6c4e('0x7d')](this['queueBooked'][this['actions'][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]])){if(this[_0x6c4e('0x2d')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]){this[_0x6c4e('0x2d')][_0x30b46a['actions'][_0x292ec8[_0x6c4e('0x132')]]['queue']]=this[_0x6c4e('0x2d')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['queue']]?this[_0x6c4e('0x2d')][this['actions'][_0x292ec8['actionid']]['queue']]:this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]?this['queueBooked'][this['actions'][_0x292ec8['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x141')]||0x0:0x0;}this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x141')]=this['queueBookedRR'][this['actions'][_0x292ec8[_0x6c4e('0x132')]]['queue']];for(var _0x2a89a8=0x0;_0x2a89a8=0x0;})['catch'](myreject(_0x8c9e32)));}}else{_0x33f275['push'](ami[_0x6c4e('0xb2')]({'action':_0x6c4e('0x15a'),'command':util[_0x6c4e('0x97')](_0x6c4e('0x15b'),_0xe7ff5a,!_[_0x6c4e('0x42')](config[_0x6c4e('0x156')][_0x27c4f0])?_0x27c4f0:'')})[_0x6c4e('0xc0')](function(_0xf5a578){return _0xf5a578['content'][_0x6c4e('0x159')](_0x6c4e('0x15c'))>=0x0;})['catch'](myreject(_0x8c9e32)));}BPromise[_0x6c4e('0x15d')](_0x33f275)[_0x6c4e('0xc0')](function(_0x196606){var _0x23fe1e=_['some'](_0x196606);if(_0x23fe1e){return _0x367503(_0x23fe1e);}else{_0x3d320f[_0x6c4e('0x45')]=_0x321a91?_0x6c4e('0x15e'):_0x6c4e('0x15f');return _0x8c9e32(msgResponse(_0x6c4e('0x160'),_0x6c4e('0x153'),_0x6c4e('0x161')+_0x321a91+'\x20'+_0x233cb6+_0x6c4e('0x162')+util[_0x6c4e('0x99')](_0xe7ff5a,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x27c4f0));}})[_0x6c4e('0xb5')](function(_0x5ed61b){return _0x8c9e32(msgResponse(_0x6c4e('0x151'),'Failure',JSON[_0x6c4e('0x79')](_0x5ed61b)));});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x163')]=function(_0x3bc765){var _0x170706=this;return function(){switch(_0x3bc765['dialMethod']){case _0x6c4e('0x164'):freeVariablesPredictive(_0x3bc765);_0x170706[_0x6c4e('0x165')](_0x3bc765,0x1);break;case _0x6c4e('0x166'):freeVariablesPredictive(_0x3bc765);_0x170706['handlePower'](_0x3bc765,_0x3bc765['dialPowerLevel']);break;case _0x6c4e('0x167'):_0x170706[_0x6c4e('0x167')](_0x3bc765);break;case _0x6c4e('0x9'):freeVariablesPredictive(_0x3bc765);_0x170706['handlePower'](_0x3bc765,0x1);break;default:freeVariablesPredictive(_0x3bc765);logger[_0x6c4e('0x98')]('Queue',_0x3bc765[_0x6c4e('0x44')],_0x6c4e('0x168'));}};};Dialer[_0x6c4e('0x1e')]['launchHandleIvr']=function(_0x24ced0){var _0x30fd02=this;return function(){_0x30fd02[_0x6c4e('0x169')](_0x24ced0);};};Dialer[_0x6c4e('0x1e')]['syncQueueSummary']=function(_0x49423a){var _0x204035=this;if(isNotPreview(_0x49423a[_0x6c4e('0x5e')])){if(isVoiceQueueOutbound(_0x49423a[_0x6c4e('0x4f')])&&isActive(_0x49423a[_0x6c4e('0x16a')])){_0x49423a[_0x6c4e('0xa4')]=!![];BPromise['resolve']()[_0x6c4e('0xc0')](checkIsLoggedIn(_0x49423a,_0x49423a['loggedIn']))[_0x6c4e('0xc0')](checkIsActive(_0x49423a,_0x49423a[_0x6c4e('0x16a')]))['then'](checkInterval(_0x49423a))[_0x6c4e('0xc0')](_0x204035[_0x6c4e('0x16b')](_0x49423a))[_0x6c4e('0xc0')](_0x204035['checkIfTime'](_0x49423a[_0x6c4e('0x16c')],_0x49423a[_0x6c4e('0x16d')],_0x49423a[_0x6c4e('0x44')],_0x49423a))[_0x6c4e('0xc0')](_0x204035['checkIfTimeIntervals'](_0x49423a['Interval'],_0x49423a[_0x6c4e('0x16d')],_0x49423a[_0x6c4e('0x44')],_0x49423a))[_0x6c4e('0xc0')](_0x204035[_0x6c4e('0x163')](_0x49423a))['catch'](loggerCatchQueueSummary(_0x6c4e('0x16e'),_0x49423a));}else{notSendMessagesQueue(_0x49423a);}}else{freeVariablesPredictive(_0x49423a);}};Dialer[_0x6c4e('0x1e')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x496f22=_['filter'](this[_0x6c4e('0x21')],function(_0x586cdd){return _0x586cdd[_0x6c4e('0x16f')];});var _0x373b8a=_[_0x6c4e('0x170')](this[_0x6c4e('0x23')],function(_0x3ca1d9){return _0x3ca1d9['online']&&_0x3ca1d9['status']===_0x6c4e('0xe0');});if(_0x496f22['length']>0x0&&_0x373b8a[_0x6c4e('0x9a')]>0x0){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0x171')](_['map'](_0x496f22,'id'),previewRecallmeReminderInterval,_['map'](_0x373b8a,'id')))[_0x6c4e('0xc0')](function(_0x57ae7e){for(var _0x31216b=0x0;_0x31216b<_0x57ae7e['length'];_0x31216b++){var _0x32c180=_0x57ae7e[_0x31216b][_0x6c4e('0x172')][_0x6c4e('0x44')];if(_0x32c180)io['to'](util[_0x6c4e('0x97')](_0x6c4e('0x173'),_0x32c180))[_0x6c4e('0x4e')](_0x6c4e('0x174'),{'hopper':_0x57ae7e[_0x31216b]});}})['catch'](function(_0x2dc974){logger[_0x6c4e('0x98')](_0x6c4e('0x175'),_0x2dc974);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6c4e('0x1e')][_0x6c4e('0x176')]=function(){var _0x630fab=this;var _0xd61917;for(var _0x295e7b in this[_0x6c4e('0x22')]){if(typeof this[_0x6c4e('0x22')][_0x295e7b]!==_0x6c4e('0x9c')){_0xd61917=this['campaigns'][_0x295e7b];if(isCampaignIvr(_0xd61917[_0x6c4e('0x4f')])&&isActive(_0xd61917['active'])){_0xd61917[_0x6c4e('0xa4')]=!![];BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](checkIsActive(_0xd61917,_0xd61917[_0x6c4e('0x77')]))[_0x6c4e('0xc0')](checkInterval(_0xd61917))[_0x6c4e('0xc0')](_0x630fab['checkIsTrunkReachable'](_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x150')](_0xd61917['dialGlobalInterval'],_0xd61917[_0x6c4e('0x16d')],_0xd61917[_0x6c4e('0x44')],_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x152')](_0xd61917[_0x6c4e('0x4a')],_0xd61917[_0x6c4e('0x16d')],_0xd61917[_0x6c4e('0x44')],_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x177')](_0xd61917))[_0x6c4e('0xb5')](loggerCatchQueueSummary(_0x6c4e('0x178'),_0xd61917));}else{notSendMessagesCampaign(_0xd61917);}}}};function getCallerIdRandom(_0x401c69,_0x179b2e){var _0x310501;var _0x3c7f70;var _0x21c27c;if(_0x179b2e<=0x0){_0x179b2e=0x1;}_0x310501=new RegExp('\x5cw{0,'+_0x179b2e+'}$');_0x3c7f70=Math[_0x6c4e('0x179')](0xa,_0x179b2e-0x1);_0x21c27c=Math[_0x6c4e('0x179')](0xa,_0x179b2e)-0x1;return util[_0x6c4e('0x97')]('%s',_[_0x6c4e('0x17a')](_0x401c69,_0x310501,_[_0x6c4e('0x17b')](_0x3c7f70,_0x21c27c)));}function extractCalleridName(_0x42539d){var _0x11c92b=_0x42539d[_0x6c4e('0x17c')](/"(.*?)"/);return _0x11c92b?_0x11c92b[0x1]:_0x42539d;}function extractCalleridNumber(_0x5bfc1d){var _0x45cb7f=_0x5bfc1d['match'](/<(.*?)>/);return _0x45cb7f?_0x45cb7f[0x1]:_0x5bfc1d;}Dialer[_0x6c4e('0x1e')]['actionOriginate']=function(_0x6f30f4,_0x2858ae){var _0x136c64=this;var _0x6b7d4=uuid['v4']();this[_0x6c4e('0x27')][_0x6b7d4]=new Action(_0x6f30f4,_0x2858ae,_0x6b7d4);return new BPromise(function(_0x31fd55,_0x745b1a){if(_['isUndefined'](_0x6f30f4)&&typeof _0x6f30f4!=='object'){return _0x745b1a(msgResponse('originate',_0x6c4e('0x153'),_0x6c4e('0x17d')));}if(_[_0x6c4e('0x42')](_0x2858ae[_0x6c4e('0x17e')])||_0x2858ae[_0x6c4e('0x17e')]===null){return _0x745b1a(msgResponse(_0x6c4e('0x17f'),_0x6c4e('0x153'),_0x6c4e('0x180')));}var _0x4d7b8a={'XMD-CALLERID':_0x136c64[_0x6c4e('0x27')][_0x6b7d4]['getCaller'](),'XMD-AGI':_0x6f30f4[_0x6c4e('0x112')]?util['format'](_0x6c4e('0x181'),ipAgi,_0x6f30f4[_0x6c4e('0x112')]):'NONE','XMD-AGIAFTER':_0x6f30f4[_0x6c4e('0x118')]?util[_0x6c4e('0x97')](_0x6c4e('0x181'),ipAgi,_0x6f30f4['dialQueueProject2']):_0x6c4e('0x182'),'XMD-QUEUE':_0x6f30f4[_0x6c4e('0x4f')]===_0x6c4e('0x50')?util['format']('\x22%s,%s%s,,,%s\x22',_0x6f30f4[_0x6c4e('0x44')],_0x6f30f4[_0x6c4e('0x183')]||'',_0x6f30f4['dialAgiAfterHangupAgent']?'c':'',_0x6f30f4['dialQueueTimeout']||0x3):_0x6c4e('0x182'),'XMD-CONTACTID':_0x2858ae[_0x6c4e('0x102')],'XMD-CDRTYPE':_0x6c4e('0x8'),'CALLERID(all)':_0x136c64[_0x6c4e('0x27')][_0x6b7d4][_0x6c4e('0x184')](),'XMD-AMD':_0x6f30f4[_0x6c4e('0xe7')]?'ACTIVE':_0x6c4e('0x182'),'XMD-DESTINATION':_0x6c4e('0x185')};if(_0x6f30f4['dialAMDActive']){_0x4d7b8a[_0x6c4e('0x186')]=_0x6f30f4[_0x6c4e('0x187')]||0x9c4;_0x4d7b8a['XMD-AMDGREETING']=_0x6f30f4[_0x6c4e('0x188')]||0x5dc;_0x4d7b8a['XMD-AMDAFTERGREETINGSILENCE']=_0x6f30f4[_0x6c4e('0x189')]||0x320;_0x4d7b8a[_0x6c4e('0x18a')]=_0x6f30f4[_0x6c4e('0x18b')]||0x1388;_0x4d7b8a[_0x6c4e('0x18c')]=_0x6f30f4[_0x6c4e('0x18d')]||0x64;_0x4d7b8a[_0x6c4e('0x18e')]=_0x6f30f4[_0x6c4e('0x18f')]||0x32;_0x4d7b8a[_0x6c4e('0x190')]=_0x6f30f4[_0x6c4e('0x191')]||0x3;_0x4d7b8a['XMD-AMDSILENCETHRESHOLD']=_0x6f30f4[_0x6c4e('0x192')]||0x100;_0x4d7b8a['XMD-AMDMAXIMUMWORDLENGTH']=_0x6f30f4['dialAMDMaximumWordLength']||0x1388;}if(_0x6f30f4[_0x6c4e('0x4f')]===_0x6c4e('0x50')){_0x4d7b8a[_0x6c4e('0x193')]=_0x2858ae[_0x6c4e('0xd9')];}else{_0x4d7b8a['XMD-CAMPAIGNID']=_0x2858ae[_0x6c4e('0xda')];}for(var _0xf699d7 in _0x2858ae[_0x6c4e('0x194')]){if(typeof _0x2858ae[_0x6c4e('0x194')][_0xf699d7]!==_0x6c4e('0x9c')){if(isNotNull(_0x2858ae[_0x6c4e('0x194')][_0xf699d7])&&_0xf699d7!=='id'&&_0xf699d7!=='tags'&&_0xf699d7!==_0x6c4e('0x195')&&_0xf699d7!==_0x6c4e('0x196')){_0x4d7b8a[util[_0x6c4e('0x97')](_0x6c4e('0x197'),_0x6c4e('0x198'),_[_0x6c4e('0x199')](_0xf699d7))]=_0x2858ae['Contact'][_0xf699d7];}}}var _0x26b0ac=_0x136c64[_0x6c4e('0xdf')](_0x6f30f4[_0x6c4e('0x76')])?getCallerId(_0x6f30f4[_0x6c4e('0x76')]['callerid'],_0x6f30f4[_0x6c4e('0x19a')],_0x6f30f4[_0x6c4e('0x19b')]>0x0?getCallerIdRandom(_0x6f30f4['dialOriginateCallerIdNumber'],_0x6f30f4[_0x6c4e('0x19b')]):_0x6f30f4[_0x6c4e('0x5f')]):getCallerId(_[_0x6c4e('0xb1')](_0x6f30f4[_0x6c4e('0x14d')])?_0x6f30f4[_0x6c4e('0x76')]['callerid']:_0x6f30f4[_0x6c4e('0x14d')]['callerid'],_0x6f30f4[_0x6c4e('0x19a')],_0x6f30f4[_0x6c4e('0x19b')]>0x0?getCallerIdRandom(_0x6f30f4['dialOriginateCallerIdNumber'],_0x6f30f4[_0x6c4e('0x19b')]):_0x6f30f4[_0x6c4e('0x5f')]);if(_0x26b0ac){_0x4d7b8a['XMD-ORIGINATECALLERIDNAME']=_0x136c64[_0x6c4e('0x27')][_0x6b7d4][_0x6c4e('0x19c')]=extractCalleridName(_0x26b0ac);_0x4d7b8a[_0x6c4e('0x19d')]=_0x2858ae[_0x6c4e('0x17e')];}return ami[_0x6c4e('0xb2')]({'actionid':_0x6b7d4,'action':_0x6c4e('0x17f'),'channel':_0x136c64[_0x6c4e('0xdf')](_0x6f30f4[_0x6c4e('0x76')])?util[_0x6c4e('0x97')](_0x6c4e('0x19e'),_0x6f30f4['Trunk'][_0x6c4e('0x44')],isNotNull(_0x6f30f4['dialPrefix'])?_0x6f30f4[_0x6c4e('0x61')][_0x6c4e('0x19f')]()||'':'',_0x6f30f4[_0x6c4e('0x1a0')]>0x0?_0x2858ae[_0x6c4e('0x17e')][_0x6c4e('0x1a1')](_0x6f30f4['dialCutDigit']):_0x2858ae[_0x6c4e('0x17e')]):util[_0x6c4e('0x97')]('SIP/%s/%s%s',_[_0x6c4e('0xb1')](_0x6f30f4['TrunkBackup'])?_0x6f30f4[_0x6c4e('0x76')][_0x6c4e('0x44')]:_0x6f30f4[_0x6c4e('0x14d')][_0x6c4e('0x44')],isNotNull(_0x6f30f4[_0x6c4e('0x61')])?_0x6f30f4[_0x6c4e('0x61')][_0x6c4e('0x19f')]()||'':'',_0x6f30f4[_0x6c4e('0x1a0')]>0x0?_0x2858ae['phone'][_0x6c4e('0x1a1')](_0x6f30f4[_0x6c4e('0x1a0')]):_0x2858ae[_0x6c4e('0x17e')]),'callerid':_0x26b0ac,'Exten':_0x6c4e('0x185'),'Context':_0x6c4e('0x1a2'),'Priority':'1','variable':_0x4d7b8a,'timeout':(_0x6f30f4[_0x6c4e('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6b7d4})[_0x6c4e('0xc0')](function(_0x13a2d5){return _0x31fd55(_0x13a2d5);})[_0x6c4e('0xb5')](function(_0x7b7dc7){_0x6f30f4['outboundOriginateFailureCallsDay']+=0x1;var _0x519591=new History(_0x136c64[_0x6c4e('0x27')][_0x6b7d4]);logger[_0x6c4e('0x98')](util[_0x6c4e('0x97')](_0x6c4e('0x1a3'),JSON[_0x6c4e('0x79')](_0x7b7dc7)));_0x519591[_0x6c4e('0xab')]=0xe;_0x519591[_0x6c4e('0xea')]=_0x6c4e('0x1a4');_0x519591[_0x6c4e('0xad')]=moment()['format'](_0x6c4e('0x10c'));_0x519591[_0x6c4e('0xac')]=_0x519591[_0x6c4e('0xad')];_0x136c64[_0x6c4e('0xd3')](_0x519591)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1a5')));_0x136c64[_0x6c4e('0xd1')](_0x519591)['catch'](loggerCatch(_0x6c4e('0x1a5')))[_0x6c4e('0x13f')](function(){delete _0x136c64['actions'][_0x6b7d4];return _0x745b1a(msgResponse('originate',_0x6c4e('0x1a6'),_0x6c4e('0x1a7')));});});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x33')]=function(_0x4701e7){var _0x1c22df=this[_0x6c4e('0x27')][_0x4701e7[_0x6c4e('0x132')]];if(_0x1c22df){delete this[_0x6c4e('0x27')][_0x4701e7[_0x6c4e('0x132')]];_0x1c22df[_0x6c4e('0x120')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));var _0xbe0b41=_0x1c22df[_0x6c4e('0x4f')]===_0x6c4e('0x7c')?this[_0x6c4e('0x22')][_0x1c22df[_0x6c4e('0xb8')]]:this[_0x6c4e('0x21')][_0x1c22df[_0x6c4e('0x1a8')]()];if(!this[_0x6c4e('0xdd')](_0x4701e7[_0x6c4e('0x1a9')])){this[_0x6c4e('0xb6')](_0xbe0b41);return this[_0x6c4e('0x1aa')](_0x1c22df,_0xbe0b41,_0x4701e7)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1ab')));}this['uniqueId'][_0x4701e7[_0x6c4e('0xe3')]]=_0x1c22df;}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1ac')]=function(_0x42d890,_0x106a5,_0x99e4b9){var _0x37514a=new History(_0x106a5);if(_0x37514a[_0x6c4e('0xf6')]+_0x37514a[_0x6c4e('0xf7')]+_0x37514a[_0x6c4e('0xf8')]+_0x37514a[_0x6c4e('0xf9')]+_0x37514a[_0x6c4e('0xfa')]+_0x37514a[_0x6c4e('0xfb')]+_0x37514a[_0x6c4e('0xf2')]+_0x37514a['countagentrejectretry']>=_0x99e4b9[_0x6c4e('0x108')]-0x1){return!![];}switch(_0x42d890){case 0x3:if(_0x37514a['countnoanswerretry']>=_0x99e4b9[_0x6c4e('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x37514a[_0x6c4e('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x99e4b9[_0x6c4e('0x1ae')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1af')));break;case 0x5:if(_0x37514a[_0x6c4e('0xf6')]>=_0x99e4b9[_0x6c4e('0x1b0')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countbusyretry':_0x37514a[_0x6c4e('0xf6')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9['dialBusyRetryFrequency'],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1b1')));break;case 0x8:if(_0x37514a[_0x6c4e('0xf7')]>=_0x99e4b9['dialCongestionMaxRetry']-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countcongestionretry':_0x37514a[_0x6c4e('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x99e4b9[_0x6c4e('0x1b2')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a['VoiceQueueId']||undefined,'CampaignId':_0x37514a['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1b3')));break;case 0x0:if(_0x37514a[_0x6c4e('0xf9')]>=_0x99e4b9[_0x6c4e('0x1b4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x37514a[_0x6c4e('0xf9')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x1b5')],'minutes')[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1b6')));}break;case 0xa:if(_0x37514a[_0x6c4e('0xfa')]>=_0x99e4b9['dialDropMaxRetry']-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countdropretry':_0x37514a['countdropretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x126')],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a['ListId'],'VoiceQueueId':_0x37514a['VoiceQueueId']||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x12b')));break;case 0xb:if(_0x37514a[_0x6c4e('0xfb')]>=_0x99e4b9[_0x6c4e('0x1b7')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countabandonedretry':_0x37514a[_0x6c4e('0xfb')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x130')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x37514a[_0x6c4e('0xf2')]>=_0x99e4b9['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x37514a['countmachineretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x10b')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a['ListId'],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10d')));break;case 0x14:if(_0x37514a['countagentrejectretry']>=_0x99e4b9[_0x6c4e('0x1b8')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countagentrejectretry':_0x37514a['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x1b9')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1ba')));break;default:return!![];}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1aa')]=function(_0x5e5b56,_0x444143,_0x431e11){var _0x52cfb9=this;var _0x550080=new History(_0x5e5b56);var _0x1ae225=![];var _0xf2b281;var _0x4bfcba;return new BPromise(function(_0x186b4b,_0x2602d2){if(_[_0x6c4e('0x42')](_0x444143)&&typeof _0x444143!==_0x6c4e('0x1bb')){return _0x2602d2(msgResponse(_0x6c4e('0x1bc'),_0x6c4e('0x153'),_0x6c4e('0x1bd')));}if(_[_0x6c4e('0x42')](_0x431e11)&&typeof _0x431e11!==_0x6c4e('0x1bb')){return _0x2602d2(msgResponse('[callProgressDetecting]',_0x6c4e('0x153'),_0x6c4e('0x1be')));}_0x52cfb9[_0x6c4e('0xbf')](_0x550080,_0x431e11[_0x6c4e('0x116')],_0x444143)[_0x6c4e('0xc0')](function(_0x50bc00){if(_0x50bc00['additional']==0x1)_0x1ae225=!![];switch(_0x431e11[_0x6c4e('0x116')]){case'0':_0x444143[_0x6c4e('0x66')]+=0x1;_0x550080[_0x6c4e('0xab')]=0x0;_0x550080['statedesc']='NoSuchNumber';_0x550080[_0x6c4e('0xf9')]+=0x1;_0x550080['countglobal']+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1bf'),ut[_0x6c4e('0xee')](_0x5e5b56,'nosuchnumber'));_0xf2b281=_0x444143['dialNoSuchNumberRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x0,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf9')]>=_0x444143[_0x6c4e('0x1b4')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c0'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c0'));}}break;case'3':_0x444143['outboundNoAnswerCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0x3;_0x550080[_0x6c4e('0xea')]='NoAnswer';_0x550080[_0x6c4e('0xf8')]+=0x1;_0x550080['countglobal']+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1c1'),ut[_0x6c4e('0xee')](_0x5e5b56,_0x6c4e('0x1c2')));_0xf2b281=_0x444143[_0x6c4e('0x1ae')];_0x4bfcba=_0x444143['callAdditionalPhoneAfterMin'];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1c3')));if(_0x52cfb9['checkRetriveMax'](0x3,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf8')]>=_0x444143[_0x6c4e('0x1ad')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c4'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c4'));}}break;case'5':_0x444143['outboundBusyCallsDay']+=0x1;_0x550080['state']=0x5;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1c5');_0x550080[_0x6c4e('0xf6')]+=0x1;_0x550080[_0x6c4e('0xf3')]+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1c6'),ut['buildObj'](_0x5e5b56,_0x6c4e('0x1c7')));_0xf2b281=_0x444143['dialBusyRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9['createHistory'](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1c8')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x5,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf6')]>=_0x444143[_0x6c4e('0x1b0')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,'reason\x205\x20busy');}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c9'));}}break;case'8':_0x444143[_0x6c4e('0x64')]+=0x1;_0x550080[_0x6c4e('0xab')]=0x8;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1ca');_0x550080[_0x6c4e('0xf7')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143['dialCongestionRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];ami[_0x6c4e('0x4e')]('custom:agentcongestion',ut[_0x6c4e('0xee')](_0x5e5b56,'congestion'));_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1cb')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x8,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080['countcongestionretry']>=_0x444143[_0x6c4e('0x1cc')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cd'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cd'));}}break;case'11':_0x444143[_0x6c4e('0x1ce')]+=0x1;_0x550080[_0x6c4e('0xab')]=0xb;_0x550080[_0x6c4e('0xea')]='Abandoned';_0x550080[_0x6c4e('0xfb')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143[_0x6c4e('0x130')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x131')));if(_0x52cfb9['checkRetriveMax'](0xb,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xfb')]>=_0x444143[_0x6c4e('0x1b7')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,'reason\x2011\x20abandoned');}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cf'));}}break;case'20':_0x444143['outboundRejectCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0x14;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1d0');_0x550080[_0x6c4e('0xfc')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143[_0x6c4e('0x1b9')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];ami[_0x6c4e('0x4e')]('custom:agentreject',ut['buildObj'](_0x5e5b56,_0x6c4e('0x1d1')));_0x52cfb9['createHistory'](_0x550080)[_0x6c4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x52cfb9[_0x6c4e('0x1ac')](0x14,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xfc')]>=_0x444143[_0x6c4e('0x1b8')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1d2'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1d2'));}}break;default:_0x444143['outboundUnknownCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0xc;_0x550080[_0x6c4e('0xea')]=_0x431e11[_0x6c4e('0x116')];_0xf2b281=_0x444143[_0x6c4e('0x1b9')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x52cfb9['checkRetriveMax'](_0x431e11['reason'],_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf6')]+_0x550080[_0x6c4e('0xf7')]+_0x550080['countnoanswerretry']+_0x550080[_0x6c4e('0xf9')]+_0x550080['countdropretry']+_0x550080['countabandonedretry']+_0x550080['countmachineretry']+_0x550080[_0x6c4e('0xfc')]>=_0x444143[_0x6c4e('0x108')]){_0x52cfb9['stateGlobal'](_0x550080,_0x186b4b,_0x2602d2,_0x431e11[_0x6c4e('0x116')]);}else{_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x431e11['reason']);}}}})[_0x6c4e('0xc0')](function(_0x2120a7){if(_0x1ae225){_0x52cfb9[_0x6c4e('0xc1')](_0x550080,_0xf2b281,_0x4bfcba)[_0x6c4e('0xc0')](function(_0x53df45){return _0x186b4b(0x1);});}});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xfd')]=function(_0x4eb0c3,_0x4bb527,_0x238452,_0x25e719){var _0x5eb320=new Final(_0x4eb0c3);_0x5eb320[_0x6c4e('0xab')]=0xf;_0x5eb320[_0x6c4e('0xea')]=_0x6c4e('0x1d3');this['createStateFinal'](_0x5eb320,_0x4bb527,_0x238452,_0x25e719);};Dialer[_0x6c4e('0x1e')]['createStateFinal']=function(_0x5ed347,_0x5dcfae,_0x2d6e8e,_0x20b015){this[_0x6c4e('0xd1')](_0x5ed347)['then'](function(){return _0x5dcfae(msgResponse(_0x6c4e('0x1bc'),_0x6c4e('0xde'),_0x20b015));})[_0x6c4e('0xb5')](function(){return _0x2d6e8e(msgResponse(_0x6c4e('0x1d4'),_0x6c4e('0x153'),_0x6c4e('0x1d5')));});};Dialer[_0x6c4e('0x1e')]['predictive']=function(_0x1abd42){var _0x1c7bb7=_0x1abd42['dialPredictiveOptimizationPercentage']/0x64;var _0x3f15f3=_0x1abd42[_0x6c4e('0x122')]/(_0x1abd42[_0x6c4e('0x122')]+_0x1abd42[_0x6c4e('0xe9')]);var _0x3eb51b=Math[_0x6c4e('0x1d6')](_0x1abd42[_0x6c4e('0x72')]*(_0x1abd42[_0x6c4e('0x1d7')]/0x64));var _0x243196=Math[_0x6c4e('0x1d6')](_0x1abd42[_0x6c4e('0x72')]*(_0x1abd42[_0x6c4e('0x1d8')]/0x64));var _0x4e80e4=_0x1abd42['available']+_0x1abd42[_0x6c4e('0x58')];var _0x257466=Math[_0x6c4e('0x1d9')](_0x1abd42[_0x6c4e('0x73')]*_0x1abd42[_0x6c4e('0x75')]*_0x1abd42['predictiveIntervalHitRate']*_0x1abd42[_0x6c4e('0x1da')]);if(_['isUndefined'](_0x1abd42[_0x6c4e('0x2b')])){if(!_['isUndefined'](_0x1abd42['startPredictive'])){_0x1abd42[_0x6c4e('0x2a')]=undefined;loggerPredictive['error'](_0x6c4e('0x1db'),_0x6c4e('0x1dc'));}if(!_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x92')])){loggerPredictive[_0x6c4e('0x98')](_0x6c4e('0x1db'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1abd42[_0x6c4e('0x92')]);_0x1abd42['handlePredictive']=undefined;}_0x1abd42[_0x6c4e('0x2b')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive['info'](_0x1abd42[_0x6c4e('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x1abd42[_0x6c4e('0x2b')]);this[_0x6c4e('0x165')](_0x1abd42,0x1);}else if(ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2b')])){this[_0x6c4e('0x165')](_0x1abd42,0x1);loggerPredictiveCalls[_0x6c4e('0x7e')](_0x6c4e('0x1de'),_0x1abd42['startProgressive'],_0x1abd42[_0x6c4e('0x44')]);_0x1abd42[_0x6c4e('0x73')]=0x0;_0x1abd42[_0x6c4e('0x70')]=0x0;}else if(_0x1c7bb7<_0x3f15f3&&_0x1abd42[_0x6c4e('0x1df')]==='dropRate'){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x1e0'),_0x6c4e('0x1e1'),_0x3f15f3,'startProgressive',_0x1abd42[_0x6c4e('0x44')]);}else if(_0x257466<_0x1abd42[_0x6c4e('0x70')]&&_0x1abd42[_0x6c4e('0x1df')]===_0x6c4e('0x1e2')){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x6c4e('0x1e3'),_0x257466,_0x6c4e('0x1e4'),_0x1abd42[_0x6c4e('0x70')],_0x6c4e('0x2b'),_0x1abd42[_0x6c4e('0x44')]);}else if(!ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2b')])&&_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x2a')])&&!_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x2b')])){_0x1abd42['startPredictive']=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive['info'](_0x1abd42['name'],_0x6c4e('0x1e5'),_0x1abd42[_0x6c4e('0x2a')]);this[_0x6c4e('0xc4')](_0x1abd42[_0x6c4e('0x1dd')])[_0x6c4e('0xc0')](this['getDataPredictive'](_0x1abd42))[_0x6c4e('0xc0')](mergeDataErlangB(_0x1abd42))[_0x6c4e('0xc0')](this[_0x6c4e('0x1e6')](_0x1abd42))[_0x6c4e('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1abd42));}else if(!ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2a')])){_0x1abd42[_0x6c4e('0x70')]=0x0;_0x1abd42[_0x6c4e('0x2a')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive[_0x6c4e('0x7e')](_0x1abd42[_0x6c4e('0x44')],'recalculate\x20predictive\x20at',_0x1abd42[_0x6c4e('0x2a')]);clearInterval(_0x1abd42['handlePredictive']);_0x1abd42[_0x6c4e('0x92')]=undefined;this[_0x6c4e('0xc4')](_0x1abd42[_0x6c4e('0x1dd')])['then'](this[_0x6c4e('0x1e7')](_0x1abd42))[_0x6c4e('0xc0')](mergeDataErlangB(_0x1abd42))[_0x6c4e('0xc0')](this[_0x6c4e('0x1e6')](_0x1abd42))[_0x6c4e('0xb5')](loggerCatchPredictive(_0x6c4e('0x1e8'),_0x1abd42));}else if(_0x1abd42[_0x6c4e('0x72')]&&_0x4e80e4<_0x1abd42['predictiveIntervalAvailable']-_0x243196){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')](_0x1abd42[_0x6c4e('0x44')],_0x6c4e('0x1e9'),_0x4e80e4,_0x6c4e('0x1ea'),_0x1abd42[_0x6c4e('0x72')],'-',_0x243196,'=',_0x1abd42['predictiveIntervalAvailable']-_0x243196,')');}else if(_0x1abd42[_0x6c4e('0x72')]&&_0x4e80e4>_0x1abd42[_0x6c4e('0x72')]+_0x3eb51b){freeVariablesPredictive(_0x1abd42);loggerPredictive['info'](_0x1abd42[_0x6c4e('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4e80e4,_0x6c4e('0x1eb'),_0x1abd42[_0x6c4e('0x72')],'+',_0x3eb51b,'=',_0x1abd42['predictiveIntervalAvailable']+_0x3eb51b,')');}};Dialer[_0x6c4e('0x1e')]['getDataPredictive']=function(_0x3ec82c){var _0x2a1569=this;return function(_0x44ec6c){return new BPromise(function(_0x4bccb0,_0x52672e){_[_0x6c4e('0x8f')](_0x3ec82c,_0x44ec6c[0x0]);if(checkGetDataPredictive(_0x44ec6c[0x0])){var _0x7e03f1=_0x3ec82c[_0x6c4e('0x72')]=_0x3ec82c[_0x6c4e('0x58')]+_0x3ec82c[_0x6c4e('0x53')];var _0x31bc7f=_0x3ec82c[_0x6c4e('0x1dd')]*0x3c;var _0x58c346=_0x44ec6c[0x0][_0x6c4e('0x6c')]+_0x44ec6c[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a7dc8=(_0x44ec6c[0x0]['predictiveIntervalAnsweredCalls']+_0x44ec6c[0x0][_0x6c4e('0x6e')]+_0x44ec6c[0x0][_0x6c4e('0x6d')])/_0x44ec6c[0x0][_0x6c4e('0x81')];_0x3ec82c['predictiveIntervalHitRate']=_0x4a7dc8>0x0?_0x4a7dc8:0x1;switch(_0x3ec82c[_0x6c4e('0x1df')]){case _0x6c4e('0x1e2'):var _0x5e6c38=_0x3ec82c[_0x6c4e('0x1ec')]/0x64;return _0x2a1569[_0x6c4e('0x1ed')](_0x7e03f1,_0x31bc7f,_0x58c346,_0x4a7dc8,_0x5e6c38)[_0x6c4e('0xc0')](function(_0x4ab967){return _0x4bccb0(_0x4ab967);});case _0x6c4e('0x1ee'):var _0x57b888=_0x3ec82c['dialPredictiveOptimizationPercentage']/0x64;return _0x2a1569['busyFactor'](_0x7e03f1,_0x31bc7f,_0x58c346,_0x4a7dc8,_0x57b888)[_0x6c4e('0xc0')](function(_0x257780){return _0x4bccb0(_0x257780);});default:return _0x52672e(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x52672e(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x6c4e('0x1e')]['getDataPredictiveOld']=function(_0x4c2e05){var _0x3b5eaf=this;return function(_0x2628ec){return new BPromise(function(_0x5ea26e,_0x3c442b){_['merge'](_0x4c2e05,_0x2628ec[0x0]);if(checkGetDataPredictive(_0x2628ec[0x0])){loggerPredictive[_0x6c4e('0x7e')](JSON[_0x6c4e('0x79')](_0x2628ec[0x0]));if(_0x4c2e05[_0x6c4e('0x1df')]==='dropRate'){return _0x3b5eaf['getVoiceQueueRtPauses'](_0x4c2e05['id'])[_0x6c4e('0xc0')](function(_0x4d07ae){var _0x9152a6=_0x4c2e05['loggedIn']-_0x4d07ae[0x0]['outboundQueuePauses'];var _0x33937c=_0x4c2e05[_0x6c4e('0x1dd')]*0x3c;var _0x3e774c=_0x2628ec[0x0][_0x6c4e('0x6c')]+_0x2628ec[0x0][_0x6c4e('0x6b')];var _0x4a7283=(_0x2628ec[0x0][_0x6c4e('0x6a')]+_0x2628ec[0x0][_0x6c4e('0x6e')]+_0x2628ec[0x0][_0x6c4e('0x6d')])/_0x2628ec[0x0]['predictiveIntervalTotalCalls'];var _0x242b20=_0x4c2e05[_0x6c4e('0x1ec')]/0x64;_0x4c2e05['predictiveIntervalPauses']=_0x4d07ae[0x0][_0x6c4e('0x1ef')]||0x0;_0x4c2e05[_0x6c4e('0x1f0')]=_0x4a7283>0x0?_0x4a7283:0x1;return _0x3b5eaf[_0x6c4e('0x1ed')](_0x9152a6,_0x33937c,_0x3e774c,_0x4a7283,_0x242b20);})[_0x6c4e('0xc0')](function(_0x4e62d0){return _0x5ea26e(_0x4e62d0);})[_0x6c4e('0xb5')](function(_0x3b6054){return _0x3c442b(msgResponse(_0x6c4e('0x1f1'),'Failure',JSON['stringify'](_0x3b6054)));});}if(_0x4c2e05[_0x6c4e('0x1df')]==='agentBusyFactor'){return _0x3b5eaf[_0x6c4e('0xcf')](_0x4c2e05['id'])[_0x6c4e('0xc0')](function(_0xf428ea){var _0xd6ead4=_0x4c2e05['loggedIn']-_0xf428ea[0x0][_0x6c4e('0x1ef')];var _0x6ed5de=_0x4c2e05['dialPredictiveInterval']*0x3c;var _0x1ca471=_0x2628ec[0x0][_0x6c4e('0x6c')]+_0x2628ec[0x0][_0x6c4e('0x6b')];var _0x22fd6f=(_0x2628ec[0x0][_0x6c4e('0x6a')]+_0x2628ec[0x0][_0x6c4e('0x6e')]+_0x2628ec[0x0][_0x6c4e('0x6d')])/_0x2628ec[0x0][_0x6c4e('0x81')];var _0x2b89ca=_0x4c2e05[_0x6c4e('0x1ec')]/0x64;_0x4c2e05['predictiveIntervalPauses']=_0xf428ea[0x0][_0x6c4e('0x1ef')]||0x0;_0x4c2e05[_0x6c4e('0x1f0')]=_0x22fd6f>0x0?_0x22fd6f:0x1;return _0x3b5eaf[_0x6c4e('0x1f2')](_0xd6ead4,_0x6ed5de,_0x1ca471,_0x22fd6f,_0x2b89ca);})[_0x6c4e('0xc0')](function(_0x1c3562){return _0x5ea26e(_0x1c3562);})[_0x6c4e('0xb5')](function(_0x1da7da){return _0x3c442b(msgResponse('[CatchErlangB]',_0x6c4e('0x153'),JSON[_0x6c4e('0x79')](_0x1da7da)));});}}else{return _0x3c442b(msgResponse(_0x6c4e('0x1f3'),'Failure','check\x20failure'));}});};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1e6')]=function(_0x40ca75){var _0x30efb5=this;return function(){var _0x2a17ca=0x0;var _0x399cde=Math[_0x6c4e('0x1d9')](_0x40ca75['erlangCallToSecond']*0x3e8);if(_0x399cde>0x0){_0x399cde=_0x399cde<0x64?0x64:_0x399cde;loggerPredictive[_0x6c4e('0x7e')](_0x40ca75[_0x6c4e('0x44')],'one\x20call\x20every:',_0x399cde,_0x6c4e('0x90'));_0x40ca75[_0x6c4e('0x92')]=setInterval(function(){_0x30efb5[_0x6c4e('0x92')](_0x40ca75);loggerPredictiveCalls[_0x6c4e('0x7e')]('[handlePredictive]',_0x2a17ca+=0x1);},_0x399cde);}else{loggerPredictive[_0x6c4e('0x7e')](_0x40ca75[_0x6c4e('0x44')],_0x6c4e('0x1f4'));}};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1f5')]=function(_0x25ca18,_0x44beba){var _0x336a29=this;return function(_0x86cb15){if(_[_0x6c4e('0x7d')](_0x86cb15)){if(_[_0x6c4e('0xb1')](_0x44beba[_0x6c4e('0x1f6')])||!_0x44beba['recallme']){if(_0x25ca18[_0x6c4e('0x5e')]==='booked'){_0x25ca18[_0x6c4e('0x13a')]=_[_0x6c4e('0x42')](_0x25ca18[_0x6c4e('0x13a')])?!![]:_0x25ca18[_0x6c4e('0x13a')];var _0x556b8e=uuid['v4']();_0x336a29[_0x6c4e('0x27')][_0x556b8e]=new Action(_0x25ca18,_0x44beba,_0x556b8e);loggerBooked[_0x6c4e('0x7e')]('[booked][checkContactBlack]',_0x556b8e,_0x6c4e('0x1f7'),JSON[_0x6c4e('0x79')](_0x25ca18[_0x6c4e('0x13a')]),'Queue:\x20',_0x25ca18[_0x6c4e('0x44')]);if(_0x25ca18[_0x6c4e('0x13a')]){_0x25ca18[_0x6c4e('0x13a')]=![];_0x336a29[_0x6c4e('0x137')][_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xb8')]]=[];ami[_0x6c4e('0xb2')]({'actionid':_0x556b8e,'action':_0x6c4e('0x1f8'),'queue':_0x25ca18['name']})[_0x6c4e('0xb5')](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);_0x336a29[_0x6c4e('0xc7')]({'active':![],'ContactId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0x102')],'ListId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0x103')],'VoiceQueueId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xd9')]||undefined,'CampaignId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xda')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x336a29[_0x6c4e('0x27')][_0x556b8e];});}else{loggerBooked[_0x6c4e('0x7e')](_0x6c4e('0x1f9'),JSON[_0x6c4e('0x79')](_0x25ca18[_0x6c4e('0x13a')]),_0x6c4e('0x1fa'),_0x25ca18['name']);_0x336a29[_0x6c4e('0xb6')](_0x25ca18);_0x336a29['rescheduleContact']({'active':![],'ContactId':_0x336a29[_0x6c4e('0x27')][_0x556b8e]['ContactId'],'ListId':_0x336a29['actions'][_0x556b8e][_0x6c4e('0x103')],'VoiceQueueId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xd9')]||undefined,'CampaignId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1fb')));delete _0x336a29[_0x6c4e('0x27')][_0x556b8e];}}else{return _0x336a29[_0x6c4e('0x1fc')](_0x25ca18,_0x44beba);}}else{if(getDiff(_0x44beba[_0x6c4e('0x1fd')])<_0x25ca18[_0x6c4e('0x1fe')]*0x3c){if(_0x44beba['Agent']&&!_0x44beba[_0x6c4e('0x172')][_0x6c4e('0x1ff')]){_0x336a29[_0x6c4e('0x94')][_0x6c4e('0x13d')](_0x44beba['id'])['finally'](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);});}else{_0x336a29[_0x6c4e('0xc9')]({'active':![]},_0x44beba['id'],0x1)['finally'](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);});}}else{_0x25ca18[_0x6c4e('0x68')]+=0x1;_0x336a29[_0x6c4e('0xb6')](_0x25ca18);if(_0x25ca18['dialRecallInQueue']){_0x336a29['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x44beba[_0x6c4e('0x102')],'ListId':_0x44beba[_0x6c4e('0x103')],'VoiceQueueId':_0x44beba['VoiceQueueId']||undefined,'CampaignId':_0x44beba[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x200')));_0x336a29[_0x6c4e('0xd3')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x201'),0x17,_0x6c4e('0x202')))[_0x6c4e('0xb5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x336a29[_0x6c4e('0xd7')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x203'),0x16,'RecallFailedTimeout'),_0x6c4e('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x25ca18[_0x6c4e('0x63')]+=0x1;_0x336a29[_0x6c4e('0xd7')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x205'),0xd,_0x6c4e('0x206')),_0x6c4e('0x207'),_0x6c4e('0x208'));throw _0x6c4e('0x209');}};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x169')]=function(_0x4e5377){var _0x5f7a59=this;var _0x4f35e6=_0x4e5377['limitCalls']-_0x4e5377[_0x6c4e('0x9b')]-_0x4e5377[_0x6c4e('0xcc')];emitCampaignSummary(_0x4e5377);if(_0x4f35e6>0x0){if(_0x4f35e6>this[_0x6c4e('0x25')]){_0x4f35e6=this[_0x6c4e('0x25')];}_0x4e5377['temp']+=_0x4f35e6;this[_0x6c4e('0xcd')](_0x4e5377['id'],_0x4f35e6,_0x4e5377['dialOrderByScheduledAt'],_0x4e5377)[_0x6c4e('0xc0')](function(_0x250831){_0x4e5377['temp']-=_0x4f35e6;_0x4e5377[_0x6c4e('0xcc')]=_0x4e5377[_0x6c4e('0xcc')]>0x0?_0x4e5377['temp']:0x0;if(!checkContactEmpty(_0x250831)){_0x4e5377['message']=_0x6c4e('0xa2');logger[_0x6c4e('0x7e')]('[getContactCampaign2][Empty]'+_0x4e5377[_0x6c4e('0x44')]);}else{_0x4e5377[_0x6c4e('0x9b')]+=_0x250831['length'];_0x4e5377[_0x6c4e('0x45')]='RUNNING';for(var _0x5af352=0x0;_0x5af352<_0x250831[_0x6c4e('0x9a')];_0x5af352+=0x1){_0x4e5377['ivrTotalCallsDays']+=0x1;if(_[_0x6c4e('0xb1')](_0x250831[_0x5af352])||_['isNil'](_0x250831[_0x5af352][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x250831[_0x5af352][_0x6c4e('0x17e')])){_0x5f7a59['emptyContact']('[actionOriginate]\x20',_0x4e5377,_0x250831[_0x5af352]);}else{_0x5f7a59[_0x6c4e('0xc3')](_[_0x6c4e('0xd8')](_0x250831[_0x5af352],['CampaignId','Contact.phone']))[_0x6c4e('0xc0')](_0x5f7a59[_0x6c4e('0x1f5')](_0x4e5377,_0x250831[_0x5af352]))['catch'](_0x5f7a59[_0x6c4e('0x20a')]('[actionOriginateIvr]\x20',_0x4e5377));}}}})[_0x6c4e('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x4e5377,_0x4f35e6));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x165')]=function(_0xa59afe,_0x369c0d){var _0xf0cbb8=this;var _0x23a6c1=[];var _0x4faae0=_0x369c0d>=0x1?_0x369c0d:0x1;if(_0xa59afe[_0x6c4e('0x5e')]===_0x6c4e('0x9')){_0x4faae0=0x1;}var _0x5841e0=Math[_0x6c4e('0x1d9')](_0xa59afe[_0x6c4e('0x53')]*_0x4faae0)-_0xa59afe['originated']-_0xa59afe[_0x6c4e('0xcc')];emitVoiceQueueSummary(_0xa59afe);if(_0xa59afe[_0x6c4e('0x20b')]>0x0){var _0x43ac40=_0xa59afe[_0x6c4e('0x20b')]-_0xa59afe[_0x6c4e('0x9b')]-_0xa59afe[_0x6c4e('0x58')]-_0xa59afe[_0x6c4e('0xcc')]-_0xa59afe['pTalking'];if(_0x5841e0>_0x43ac40){_0x5841e0=_0x43ac40;}}if(_0x5841e0>0x0){if(_0xa59afe[_0x6c4e('0x5e')]===_0x6c4e('0x9')){_0x5841e0=0x1;}if(_0x5841e0>this[_0x6c4e('0x25')]){_0x5841e0=this[_0x6c4e('0x25')];}_0xa59afe[_0x6c4e('0xcc')]+=_0x5841e0;for(var _0x397bd8 in this['agents']){if(typeof this[_0x6c4e('0x23')][_0x397bd8]!=='undefined'){if(this['agents'][_0x397bd8][_0x6c4e('0xab')]===_0x6c4e('0x20c')&&this[_0x6c4e('0x23')][_0x397bd8][_0x6c4e('0xb3')]===_0x6c4e('0xe0')){_0x23a6c1[_0x6c4e('0x138')](this[_0x6c4e('0x23')][_0x397bd8]['id']);}}}this[_0x6c4e('0xcb')](_0xa59afe['id'],_0x23a6c1,_0x5841e0,_0xa59afe[_0x6c4e('0x20d')],_0xa59afe)[_0x6c4e('0xc0')](function(_0x477408){_0xa59afe[_0x6c4e('0xcc')]-=_0x5841e0;_0xa59afe[_0x6c4e('0xcc')]=_0xa59afe[_0x6c4e('0xcc')]>0x0?_0xa59afe[_0x6c4e('0xcc')]:0x0;if(!checkContactEmpty(_0x477408)){_0xf0cbb8[_0x6c4e('0xba')](_0xa59afe)[_0x6c4e('0xc0')](sendMessageReschedule(_0xa59afe))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbc')));}else{_0xa59afe[_0x6c4e('0x9b')]+=_0x477408['length'];_0xa59afe['message']=_0xa59afe['dialMethod']===_0x6c4e('0x9')?_0x6c4e('0x20e'):_0x6c4e('0x20f');for(var _0x316322=0x0;_0x316322<_0x477408[_0x6c4e('0x9a')];_0x316322+=0x1){if(_[_0x6c4e('0xb1')](_0x477408[_0x316322])||_[_0x6c4e('0xb1')](_0x477408[_0x316322][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x477408[_0x316322][_0x6c4e('0x17e')])){_0xf0cbb8[_0x6c4e('0xd6')](_0x6c4e('0x210'),_0xa59afe,_0x477408[_0x316322]);}else{_0xf0cbb8['checkIsBlackList'](_['pick'](_0x477408[_0x316322],[_0x6c4e('0xd9'),_0x6c4e('0x211')]))[_0x6c4e('0xc0')](_0xf0cbb8[_0x6c4e('0x1f5')](_0xa59afe,_0x477408[_0x316322]))[_0x6c4e('0xb5')](_0xf0cbb8[_0x6c4e('0x20a')](_0x6c4e('0x210'),_0xa59afe));}}}})[_0x6c4e('0xb5')](loggerGetContactDialer(_0x6c4e('0x212'),_0xa59afe,_0x5841e0));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x92')]=function(_0x5cbe4d){if(_0x5cbe4d[_0x6c4e('0x20b')]>0x0){var _0x2c7e4c=_0x5cbe4d[_0x6c4e('0x20b')]-_0x5cbe4d[_0x6c4e('0x9b')]-_0x5cbe4d[_0x6c4e('0x58')];if(_0x2c7e4c>0x0){this['tryOriginatePredictive'](_0x5cbe4d);}else{loggerPredictiveCalls[_0x6c4e('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x6c4e('0x213')](_0x5cbe4d);}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x213')]=function(_0x3cc11c){var _0x570aac=this;var _0x1375cf=[];_0x3cc11c[_0x6c4e('0x9b')]+=0x1;for(var _0x4ed605 in this[_0x6c4e('0x23')]){if(typeof this[_0x6c4e('0x23')][_0x4ed605]!==_0x6c4e('0x9c')){if(this[_0x6c4e('0x23')][_0x4ed605][_0x6c4e('0xab')]===_0x6c4e('0x20c')&&this[_0x6c4e('0x23')][_0x4ed605][_0x6c4e('0xb3')]===_0x6c4e('0xe0')){_0x1375cf[_0x6c4e('0x138')](this[_0x6c4e('0x23')][_0x4ed605]['id']);}}}this['getContactDialer'](_0x3cc11c['id'],_0x1375cf,0x1,_0x3cc11c['dialOrderByScheduledAt'],_0x3cc11c)['then'](function(_0x79914f){if(!checkContactEmpty(_0x79914f)){checkContactLowerLimitOriginate(_0x3cc11c,0x1,0x0);_0x570aac[_0x6c4e('0xba')](_0x3cc11c)[_0x6c4e('0xc0')](sendMessageReschedule(_0x3cc11c))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3cc11c[_0x6c4e('0x45')]=_0x6c4e('0x20f');if(_[_0x6c4e('0xb1')](_0x79914f[0x0])||_[_0x6c4e('0xb1')](_0x79914f[0x0][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x79914f[0x0][_0x6c4e('0x17e')])){_0x570aac[_0x6c4e('0xd6')](_0x6c4e('0x210'),_0x3cc11c,_0x79914f[0x0]);}else{_0x570aac['checkIsBlackList'](_[_0x6c4e('0xd8')](_0x79914f[0x0],[_0x6c4e('0xd9'),'Contact.phone']))[_0x6c4e('0xc0')](_0x570aac[_0x6c4e('0x1f5')](_0x3cc11c,_0x79914f[0x0]))[_0x6c4e('0xb5')](_0x570aac['loggerHandler'](_0x6c4e('0x214'),_0x3cc11c));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x3cc11c,0x1));emitVoiceQueueSummary(_0x3cc11c);};Dialer[_0x6c4e('0x1e')]['abandonmentRate']=function(_0x559a33,_0x42d188,_0x16b4e2,_0x1c9a00,_0x1e3215,_0xa3c233){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x215'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x216'),_0x559a33);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x217'),_0x42d188);loggerPredictive[_0x6c4e('0x7e')]('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',_0x16b4e2);loggerPredictive['info'](_0x6c4e('0x218'),_0x1c9a00);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x219'),_0x1e3215);loggerPredictive['info'](_0x6c4e('0x8e'));return new BPromise(function(_0x53d78e,_0x1711c0){if(_0x559a33<=0x0||isNaN(_0x559a33)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),'m\x20=\x20'+_0x559a33));}if(_0x16b4e2<=0x0||isNaN(_0x16b4e2)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21b')+_0x16b4e2));}if(_0x1c9a00<=0x0||isNaN(_0x1c9a00)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21c')+_0x1c9a00));}if(_0x42d188<=0x0||isNaN(_0x42d188)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21d')+_0x42d188));}if(_0x1e3215<=0x0||isNaN(_0x1e3215)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),'Amax\x20=\x20'+_0x1e3215));}_0xa3c233=_0xa3c233||0x0;var _0x2a6f98=0x1/_0x16b4e2;var _0x163147=0x0;var _0x504290=0x0;var _0x5e3a28=0x0;var _0x3de726=0x0;for(var _0x506fd7=0x0;_0x5e3a28<_0x1e3215;_0x506fd7+=0x1){_0x504290=_0x506fd7/_0x42d188;_0x163147=(_0x1c9a00*_0x504290+_0xa3c233)/_0x2a6f98;_0x5e3a28=erlangb(_0x163147,_0x559a33);_0x3de726=_0x163147/_0x559a33*(0x1-erlangb(_0x163147,_0x559a33));}return _0x53d78e({'erlangCalls':_0x506fd7,'erlangCallToSecond':_0x42d188/_0x506fd7,'erlangAbandonmentRate':_0x5e3a28,'erlangBusyFactor':_0x3de726});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1f2')]=function(_0x5c8fac,_0x43ac25,_0x5c82ae,_0x58ec3d,_0x1d40a5,_0x47f2e1){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x21e'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x216'),_0x5c8fac);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x217'),_0x43ac25);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x21f'),_0x5c82ae);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x218'),_0x58ec3d);loggerPredictive['info'](_0x6c4e('0x220'),_0x1d40a5);loggerPredictive['info'](_0x6c4e('0x8e'));return new BPromise(function(_0x5cd59a,_0x657fc0){if(_0x5c8fac<=0x0||isNaN(_0x5c8fac)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x222')+_0x5c8fac));}if(_0x5c82ae<=0x0||isNaN(_0x5c82ae)){return _0x657fc0(msgResponse('[busyFactor]',_0x6c4e('0x1a6'),_0x6c4e('0x21b')+_0x5c82ae));}if(_0x58ec3d<=0x0||isNaN(_0x58ec3d)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x21c')+_0x58ec3d));}if(_0x43ac25<=0x0||isNaN(_0x43ac25)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),'Error',_0x6c4e('0x21d')+_0x43ac25));}if(_0x1d40a5<=0x0||isNaN(_0x1d40a5)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x223')+_0x1d40a5));}_0x47f2e1=_0x47f2e1||0x0;var _0x5d38c2=0x1/_0x5c82ae;var _0x37cdd1=0x0;var _0x1fa674=0x0;var _0x232c80=0x0;var _0x121ff3=0x0;for(var _0xd2018e=0x0;_0x121ff3<_0x1d40a5;_0xd2018e+=0x1){_0x1fa674=_0xd2018e/_0x43ac25;_0x37cdd1=(_0x58ec3d*_0x1fa674+_0x47f2e1)/_0x5d38c2;_0x232c80=erlangb(_0x37cdd1,_0x5c8fac);_0x121ff3=_0x37cdd1/_0x5c8fac*(0x1-erlangb(_0x37cdd1,_0x5c8fac));}return _0x5cd59a({'erlangCalls':_0xd2018e,'erlangCallToSecond':_0x43ac25/_0xd2018e,'erlangAbandonmentRate':_0x232c80,'erlangBusyFactor':_0x121ff3});});};module[_0x6c4e('0x224')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 84ae7ef..e68534d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96af=['scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','responsetime','droptime','endtime','ringtime','starttime','talktime','queue','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x26a8aa,_0xcc692a){var _0x3d35f7=function(_0x125686){while(--_0x125686){_0x26a8aa['push'](_0x26a8aa['shift']());}};_0x3d35f7(++_0xcc692a);}(_0x96af,0x194));var _0xf96a=function(_0x20229e,_0xa59f8a){_0x20229e=_0x20229e-0x0;var _0x317377=_0x96af[_0x20229e];return _0x317377;};'use strict';var util=require(_0xf96a('0x0'));var _=require(_0xf96a('0x1'));var moment=require(_0xf96a('0x2'));function getSeconds(_0x581337,_0x25ea08){var _0x53b6cc=moment(_0x581337)[_0xf96a('0x3')](0x0);var _0xdc8f3a=moment(_0x25ea08)[_0xf96a('0x3')](0x0);return _0x53b6cc[_0xf96a('0x4')](_0xdc8f3a,_0xf96a('0x5'));}function QueueCallerAbandon(_0x1ba799,_0x5cee18){this[_0xf96a('0x6')]=_0x1ba799[_0xf96a('0x6')];this[_0xf96a('0x7')]=_0x1ba799[_0xf96a('0x7')];this[_0xf96a('0x8')]=_0x1ba799['type']==='outbound'?'queue':_0x1ba799[_0xf96a('0x7')];this[_0xf96a('0x9')]=_0x1ba799[_0xf96a('0x9')];this[_0xf96a('0xa')]=_0x1ba799[_0xf96a('0xa')];this['countnoanswerretry']=_0x1ba799[_0xf96a('0xb')];this[_0xf96a('0xc')]=_0x1ba799[_0xf96a('0x9')]+_0x1ba799['countcongestionretry']+_0x1ba799['countnoanswerretry']+_0x1ba799[_0xf96a('0xd')]+_0x1ba799['countdropretry']+_0x1ba799[_0xf96a('0xe')]+_0x1ba799[_0xf96a('0xf')]+_0x1ba799[_0xf96a('0x10')];this['countnosuchnumberretry']=_0x1ba799['countnosuchnumberretry'];this[_0xf96a('0x11')]=_0x1ba799[_0xf96a('0x11')];this[_0xf96a('0xe')]=_0x1ba799[_0xf96a('0xe')];this[_0xf96a('0xf')]=_0x1ba799[_0xf96a('0xf')];this[_0xf96a('0x10')]=_0x1ba799['countagentrejectretry'];this[_0xf96a('0x12')]=_0x5cee18['uniqueid'];this['calleridname']=_0x1ba799[_0xf96a('0x13')];this[_0xf96a('0x14')]=_0x1ba799['number'];this['starttime']=_0x1ba799['starttime'];this[_0xf96a('0x15')]=_0x1ba799[_0xf96a('0x15')];this[_0xf96a('0x16')]=_0x1ba799[_0xf96a('0x16')];this[_0xf96a('0x17')]=this[_0xf96a('0x16')];this[_0xf96a('0x18')]=getSeconds(_0x1ba799[_0xf96a('0x15')],_0x1ba799[_0xf96a('0x19')]);this['holdtime']=getSeconds(this[_0xf96a('0x16')],_0x1ba799[_0xf96a('0x15')]);this[_0xf96a('0x1a')]=0x0;this[_0xf96a('0x1b')]=_0x5cee18[_0xf96a('0x1b')];this[_0xf96a('0x1c')]=_0x5cee18[_0xf96a('0x1d')];this[_0xf96a('0x1e')]=_0x5cee18[_0xf96a('0x1e')];this['callback']=_0x1ba799['callback'];this[_0xf96a('0x1f')]=_0x1ba799['callbackuniqueid'];this[_0xf96a('0x20')]=_0x1ba799[_0xf96a('0x20')];this[_0xf96a('0x21')]=_0x1ba799[_0xf96a('0x21')];this[_0xf96a('0x22')]=_0x1ba799[_0xf96a('0x22')];this[_0xf96a('0x23')]=_0x1ba799[_0xf96a('0x23')];this['UserId']=_0x1ba799[_0xf96a('0x24')];this['VoiceQueueId']=_0x1ba799[_0xf96a('0x25')];this['CampaignId']=_0x1ba799[_0xf96a('0x26')];this['originatecalleridnum']=_0x1ba799['originatecalleridnum']||'';this[_0xf96a('0x27')]=_0x1ba799[_0xf96a('0x27')]||'';}module[_0xf96a('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x469a=['responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x469a,0x1ca));var _0xa469=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x469a[_0x2b5eae];return _0x5f3ac9;};'use strict';var util=require(_0xa469('0x0'));var _=require('lodash');var moment=require(_0xa469('0x1'));function getSeconds(_0x2c2e46,_0x49bbf2){var _0x2d45ee=moment(_0x2c2e46)[_0xa469('0x2')](0x0);var _0x1e34b5=moment(_0x49bbf2)[_0xa469('0x2')](0x0);return _0x2d45ee[_0xa469('0x3')](_0x1e34b5,'seconds');}function QueueCallerAbandon(_0x57c511,_0x462236){this[_0xa469('0x4')]=_0x57c511['scheduledat'];this[_0xa469('0x5')]=_0x57c511[_0xa469('0x5')];this[_0xa469('0x6')]=_0x57c511[_0xa469('0x5')]===_0xa469('0x7')?_0xa469('0x8'):_0x57c511['type'];this[_0xa469('0x9')]=_0x57c511[_0xa469('0x9')];this[_0xa469('0xa')]=_0x57c511[_0xa469('0xa')];this[_0xa469('0xb')]=_0x57c511[_0xa469('0xb')];this[_0xa469('0xc')]=_0x57c511[_0xa469('0x9')]+_0x57c511[_0xa469('0xa')]+_0x57c511[_0xa469('0xb')]+_0x57c511[_0xa469('0xd')]+_0x57c511[_0xa469('0xe')]+_0x57c511[_0xa469('0xf')]+_0x57c511[_0xa469('0x10')]+_0x57c511[_0xa469('0x11')];this[_0xa469('0xd')]=_0x57c511[_0xa469('0xd')];this['countdropretry']=_0x57c511[_0xa469('0xe')];this[_0xa469('0xf')]=_0x57c511[_0xa469('0xf')];this['countmachineretry']=_0x57c511[_0xa469('0x10')];this[_0xa469('0x11')]=_0x57c511[_0xa469('0x11')];this[_0xa469('0x12')]=_0x462236[_0xa469('0x12')];this[_0xa469('0x13')]=_0x57c511['name'];this['calleridnum']=_0x57c511[_0xa469('0x14')];this[_0xa469('0x15')]=_0x57c511[_0xa469('0x15')];this[_0xa469('0x16')]=_0x57c511['responsetime'];this[_0xa469('0x17')]=_0x57c511[_0xa469('0x17')];this[_0xa469('0x18')]=this[_0xa469('0x17')];this[_0xa469('0x19')]=getSeconds(_0x57c511[_0xa469('0x16')],_0x57c511[_0xa469('0x15')]);this[_0xa469('0x1a')]=getSeconds(this[_0xa469('0x17')],_0x57c511[_0xa469('0x16')]);this[_0xa469('0x1b')]=0x0;this[_0xa469('0x8')]=_0x462236[_0xa469('0x8')];this['membername']=_0x462236[_0xa469('0x1c')];this[_0xa469('0x1d')]=_0x462236[_0xa469('0x1d')];this[_0xa469('0x1e')]=_0x57c511['callback'];this[_0xa469('0x1f')]=_0x57c511[_0xa469('0x1f')];this['callbackat']=_0x57c511[_0xa469('0x20')];this[_0xa469('0x21')]=_0x57c511[_0xa469('0x21')];this[_0xa469('0x22')]=_0x57c511[_0xa469('0x22')];this[_0xa469('0x23')]=_0x57c511[_0xa469('0x23')];this[_0xa469('0x24')]=_0x57c511[_0xa469('0x24')];this['VoiceQueueId']=_0x57c511['VoiceQueueId'];this[_0xa469('0x25')]=_0x57c511['CampaignId'];this[_0xa469('0x26')]=_0x57c511[_0xa469('0x26')]||'';this['originatecalleridname']=_0x57c511['originatecalleridname']||'';}module[_0xa469('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f2e23c7..ae4057d 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(_0x2510e0,_0xf559ef){var _0x202935=function(_0x45f532){while(--_0x45f532){_0x2510e0['push'](_0x2510e0['shift']());}};_0x202935(++_0xf559ef);}(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x47396f,_0x48ecca){var _0x3c4e36=function(_0x2f65eb){while(--_0x2f65eb){_0x47396f['push'](_0x47396f['shift']());}};_0x3c4e36(++_0x48ecca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 479bdd0..a495dfc 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 _0xac2c=['[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','bluebird','uuid','tiff2pdf','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','exten','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','name','then','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac2c,0x1c6));var _0xcac2=function(_0x5406ab,_0x10ddda){_0x5406ab=_0x5406ab-0x0;var _0x47e633=_0xac2c[_0x5406ab];return _0x47e633;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xcac2('0x0'));var uuid=require(_0xcac2('0x1'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xcac2('0x2'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xcac2('0x3'));var ami=require(_0xcac2('0x4'));var rpcDb=require(_0xcac2('0x5'));var Channel=require(_0xcac2('0x6'));var ut=require('./util/util');var Action=require(_0xcac2('0x7'));var faxAccount=require(_0xcac2('0x8'));var attachment=require(_0xcac2('0x9'));var faxMessage=require(_0xcac2('0xa'));function Fax(_0x1ebc42){this[_0xcac2('0xb')]={};this[_0xcac2('0xc')]=_0x1ebc42[_0xcac2('0xc')];this[_0xcac2('0xd')]=_0x1ebc42['trunks'];this[_0xcac2('0xe')]={};ami['on'](_0xcac2('0xf'),this['syncNewchannel'][_0xcac2('0x10')](this));ami['on'](_0xcac2('0x11'),this[_0xcac2('0x12')]['bind'](this));ami['on'](_0xcac2('0x13'),this[_0xcac2('0x14')][_0xcac2('0x10')](this));ami['on'](_0xcac2('0x15'),this[_0xcac2('0x16')][_0xcac2('0x10')](this));ami['on'](_0xcac2('0x17'),this[_0xcac2('0x18')]['bind'](this));ami['on'](_0xcac2('0x19'),this['syncReceiveFax'][_0xcac2('0x10')](this));ami['on']('hangup',this[_0xcac2('0x1a')][_0xcac2('0x10')](this));ami['on'](_0xcac2('0x1b'),this[_0xcac2('0x1c')][_0xcac2('0x10')](this));}Fax[_0xcac2('0x1d')][_0xcac2('0x1e')]=function(_0x904b72){if(_0x904b72[_0xcac2('0x1f')]==='from-voip-provider'){for(var _0x5afba2 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x5afba2)){if(_0x904b72[_0xcac2('0x20')]===this[_0xcac2('0xc')][_0x5afba2][_0xcac2('0x21')]){this[_0xcac2('0xb')][_0x904b72['uniqueid']]={};this[_0xcac2('0xb')][_0x904b72[_0xcac2('0x22')]][_0xcac2('0x23')]=_0x904b72[_0xcac2('0x23')];this['channels'][_0x904b72[_0xcac2('0x22')]]['id']=this[_0xcac2('0xc')][_0x5afba2]['id'];this[_0xcac2('0xb')][_0x904b72[_0xcac2('0x22')]]['name']=this['faxAccounts'][_0x5afba2]['name'];logger[_0xcac2('0x24')](_0x904b72['uniqueid'],_0xcac2('0x25'));}}}}if(this[_0xcac2('0xe')][_0x904b72['uniqueid']]){this['channels'][_0x904b72[_0xcac2('0x22')]]={};this[_0xcac2('0xb')][_0x904b72[_0xcac2('0x22')]][_0xcac2('0x23')]=_0x904b72['channel'];logger['info'](_0x904b72[_0xcac2('0x22')],_0xcac2('0x25'));}};Fax[_0xcac2('0x1d')][_0xcac2('0x12')]=function(_0x2c5b37){if(this[_0xcac2('0xb')][_0x2c5b37[_0xcac2('0x22')]]){for(var _0x477f68 in _0x2c5b37[_0xcac2('0x26')]){if(_0x2c5b37[_0xcac2('0x26')][_0xcac2('0x27')](_0x477f68)){this[_0xcac2('0xb')][_0x2c5b37['uniqueid']][_0x477f68]=_0x2c5b37['value'];}}}};Fax['prototype']['syncNewState']=function(_0x18fb31){if(this['channels'][_0x18fb31[_0xcac2('0x22')]]){this[_0xcac2('0xb')][_0x18fb31[_0xcac2('0x22')]][_0xcac2('0x28')]=_0x18fb31[_0xcac2('0x28')];this[_0xcac2('0xb')][_0x18fb31[_0xcac2('0x22')]][_0xcac2('0x29')]=_0x18fb31[_0xcac2('0x29')];}};Fax['prototype'][_0xcac2('0x16')]=function(_0x16654e){if(this[_0xcac2('0xb')][_0x16654e[_0xcac2('0x22')]]){for(var _0x2bba84 in _0x16654e[_0xcac2('0x26')]){if(_0x16654e[_0xcac2('0x26')][_0xcac2('0x27')](_0x2bba84)){this[_0xcac2('0xb')][_0x16654e[_0xcac2('0x22')]][_0x2bba84]=_0x16654e[_0xcac2('0x2a')];}}}};Fax[_0xcac2('0x1d')][_0xcac2('0x18')]=function(_0x6acc0){if(this['channels'][_0x6acc0[_0xcac2('0x22')]]){this['channels'][_0x6acc0['uniqueid']]['operation']=_0x6acc0[_0xcac2('0x2b')];this[_0xcac2('0xb')][_0x6acc0[_0xcac2('0x22')]][_0xcac2('0x2c')]=_0x6acc0['status'];this['channels'][_0x6acc0[_0xcac2('0x22')]]['localstationid']=_0x6acc0[_0xcac2('0x21')];this[_0xcac2('0xb')][_0x6acc0['uniqueid']]['filename']=_0x6acc0[_0xcac2('0x2d')];logger[_0xcac2('0x24')](_0x6acc0[_0xcac2('0x22')],_0xcac2('0x2e'));}};Fax['prototype'][_0xcac2('0x2f')]=function(_0x1fe329){var _0x2d1f2e=this;if(this[_0xcac2('0xb')][_0x1fe329['uniqueid']]){var _0x2a84dc=this[_0xcac2('0xb')][_0x1fe329[_0xcac2('0x22')]]['id'];this['channels'][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x30')]=_0x1fe329[_0xcac2('0x30')];this['channels'][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x31')]=_0x1fe329['pagestransferred'];this['channels'][_0x1fe329['uniqueid']][_0xcac2('0x21')]=_0x1fe329[_0xcac2('0x21')];this['channels'][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x32')]=_0x1fe329[_0xcac2('0x32')];this[_0xcac2('0xb')][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x33')]=_0x1fe329['transferrate'];this[_0xcac2('0xb')][_0x1fe329['uniqueid']][_0xcac2('0x2d')]=_0x1fe329[_0xcac2('0x2d')];this[_0xcac2('0xb')][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x34')]=_0x1fe329[_0xcac2('0x34')];if(this[_0xcac2('0xb')][_0x1fe329[_0xcac2('0x22')]][_0xcac2('0x31')]>0x0){tiff2pdf(_0x1fe329[_0xcac2('0x2d')],_0xcac2('0x35'),function(_0xe6d88c){logger[_0xcac2('0x24')](_0x1fe329[_0xcac2('0x22')],_0xcac2('0x36'),_0xe6d88c['message']);attachment['create']({'name':path[_0xcac2('0x37')](_0x1fe329[_0xcac2('0x2d')])[_0xcac2('0x38')],'basename':path['parse'](_0x1fe329[_0xcac2('0x2d')])['name']+'.pdf','type':'application/pdf'})[_0xcac2('0x39')](function(_0x39ac8e){faxAccount['notify'](_0x2a84dc,{'from':_0x1fe329[_0xcac2('0x34')],'mapKey':'fax','body':path[_0xcac2('0x37')](_0x1fe329[_0xcac2('0x2d')])['name']+_0xcac2('0x3a'),'AttachmentId':_0x39ac8e['id']})['catch'](function(_0x430b8d){logger[_0xcac2('0x3b')](_0x1fe329[_0xcac2('0x22')],_0xcac2('0x3c'),JSON[_0xcac2('0x3d')](_0x430b8d));});})[_0xcac2('0x3e')](function(_0x49b6ba){logger[_0xcac2('0x3b')](_0x1fe329[_0xcac2('0x22')],'\x20receiveFax\x20',JSON[_0xcac2('0x3d')](_0x49b6ba));});});}logger[_0xcac2('0x24')](_0x1fe329[_0xcac2('0x22')],_0xcac2('0x3f'));}};Fax['prototype'][_0xcac2('0x1c')]=function(_0x1a79f8){if(this[_0xcac2('0xe')][_0x1a79f8[_0xcac2('0x22')]]){_[_0xcac2('0x40')](this['channels'][_0x1a79f8['uniqueid']],_[_0xcac2('0x41')](_0x1a79f8,[_0xcac2('0x42'),'reason']));}};function updateStatus(_0x552676){if(_0x552676[_0xcac2('0x43')]){faxMessage[_0xcac2('0x44')](_0x552676[_0xcac2('0x43')],{'failMessage':_0xcac2('0x45')})[_0xcac2('0x39')](function(_0x47b05e){ut[_0xcac2('0x46')](_0xcac2('0x47'),_0x47b05e);})[_0xcac2('0x3e')](function(_0x5e6c36){ut[_0xcac2('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x5e6c36);});}else{ut[_0xcac2('0x46')](_0xcac2('0x48'));}}Fax[_0xcac2('0x1d')][_0xcac2('0x49')]=function(_0x34f369,_0x401762,_0x52e2e0){var _0x27d85e=this;var _0x1aae39={};if(_0x401762){_0x1aae39={'read':_0x401762};}else{_0x1aae39={'failMessage':_0x52e2e0};}if(this[_0xcac2('0xe')][_0x34f369][_0xcac2('0x43')]){faxMessage[_0xcac2('0x44')](this['actions'][_0x34f369]['AttachmentId'],_0x1aae39)['then'](function(_0x2e4bfa){ut[_0xcac2('0x46')](_0xcac2('0x4a'),_0x2e4bfa);})['catch'](function(_0x36eece){ut[_0xcac2('0x46')](_0xcac2('0x4b'),_0x36eece);})[_0xcac2('0x4c')](function(){delete _0x27d85e[_0xcac2('0xb')][_0x34f369];delete _0x27d85e['actions'][_0x34f369];});}else{ut[_0xcac2('0x46')](_0xcac2('0x4d'));delete this[_0xcac2('0xb')][_0x34f369];delete this[_0xcac2('0xe')][_0x34f369];}};Fax[_0xcac2('0x1d')][_0xcac2('0x1a')]=function(_0xa8431d){var _0x5b4700=this;if(this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]]){if(this['actions'][_0xa8431d[_0xcac2('0x22')]]){this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]]['id']=this['actions'][_0xa8431d[_0xcac2('0x22')]]['id'];this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]][_0xcac2('0x38')]=this[_0xcac2('0xe')][_0xa8431d[_0xcac2('0x22')]][_0xcac2('0x38')];}logger[_0xcac2('0x24')](_0xa8431d[_0xcac2('0x22')],this[_0xcac2('0xe')][_0xa8431d['uniqueid']]?_0xcac2('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0xcac2('0x3d')](this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]]));if(this[_0xcac2('0xe')][_0xa8431d[_0xcac2('0x22')]]){if(this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]][_0xcac2('0x4f')]>0x0&&this['channels'][_0xa8431d['uniqueid']]['faxstatus']===_0xcac2('0x50')){this[_0xcac2('0x49')](_0xa8431d['uniqueid'],!![]);}else{this[_0xcac2('0x49')](_0xa8431d[_0xcac2('0x22')],![],this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]]['faxstatusstring']?_0xcac2('0x51')+this[_0xcac2('0xb')][_0xa8431d[_0xcac2('0x22')]]['faxstatusstring']:_0xcac2('0x52'));}}}};Fax[_0xcac2('0x1d')][_0xcac2('0x53')]=function(_0x494d2c){var _0x31b24b=this;return new BPromise(function(_0xa07bed,_0x537f07){_0x31b24b['execOriginate'](_0x494d2c,_0x31b24b[_0xcac2('0xc')][_0x494d2c[_0xcac2('0x54')]])[_0xcac2('0x39')](function(_0x57e8d4){ut[_0xcac2('0x46')](_0xcac2('0x55'),_0x57e8d4);_0xa07bed(ut[_0xcac2('0x56')](_0xcac2('0x57')));})[_0xcac2('0x3e')](function(_0x2cfda3){ut[_0xcac2('0x46')](_0xcac2('0x58'),_0x2cfda3);updateStatus(_0x494d2c);_0x537f07(ut[_0xcac2('0x56')]('Fax\x20failed'));});});};Fax[_0xcac2('0x1d')]['checkAfterSend']=function(_0x1415a9){var _0xdc6303=this;return new BPromise(function(_0x434059,_0x1a9000){var _0x1a2806=_0xdc6303[_0xcac2('0x59')](_0xdc6303[_0xcac2('0xc')][_0x1415a9[_0xcac2('0x54')]][_0xcac2('0x5a')],_0x1415a9);if(_0x1a2806[_0xcac2('0x5b')]){_0x434059(ut[_0xcac2('0x56')](_0xcac2('0x5c')));}else{_0x1a9000(ut['message'](_0x1a2806[_0xcac2('0x56')]));}});};function originate(_0x578e3b,_0x407ba4,_0x41949b){return new BPromise(function(_0x563eb8,_0x2dc593){if(_0x41949b){var _0x2cce8a=util[_0xcac2('0x5d')]('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[_0xcac2('0x37')](_0x578e3b[_0xcac2('0x5e')])['name'],_0x578e3b['path']);gs['execute'](_0x2cce8a)[_0xcac2('0x39')](function(){_0x578e3b[_0xcac2('0x5e')]=util[_0xcac2('0x5d')]('%s/%s.tif',path['parse'](_0x578e3b[_0xcac2('0x5e')])['dir'],path[_0xcac2('0x37')](_0x578e3b[_0xcac2('0x5e')])['name']);_0x407ba4[_0xcac2('0x5f')]=_0x578e3b[_0xcac2('0x5e')];ut[_0xcac2('0x46')]('Convert\x20pdf\x20to\x20tif','');ami[_0xcac2('0x60')](ut[_0xcac2('0x61')](_0x578e3b,_0x407ba4))[_0xcac2('0x39')](function(_0x148105){_0x563eb8(_0x148105);})[_0xcac2('0x3e')](function(_0x223893){_0x2dc593(_0x223893);});})[_0xcac2('0x3e')](function(_0x3885da){_0x2dc593(_0x3885da);});}else{ami[_0xcac2('0x60')](ut['variablesAction'](_0x578e3b,_0x407ba4))[_0xcac2('0x39')](function(_0x4f0cc9){_0x563eb8(_0x4f0cc9);})[_0xcac2('0x3e')](function(_0x84a3c0){_0x2dc593(_0x84a3c0);});}});}Fax[_0xcac2('0x1d')][_0xcac2('0x62')]=function(_0x16336e,_0x589e66){var _0x29b76f=this;return new BPromise(function(_0x3e24c2,_0x4324b5){var _0x4232c4=uuid['v4']();var _0x24a34c=ut[_0xcac2('0x63')](_0x16336e,_0x589e66);_0x29b76f['actions'][_0x4232c4]=new Action(_0x4232c4,_0x589e66,_0x16336e);var _0x31eee2=_0x29b76f[_0xcac2('0xe')][_0x4232c4];if(path[_0xcac2('0x37')](_0x16336e[_0xcac2('0x5e')])[_0xcac2('0x64')]===_0xcac2('0x3a')){originate(_0x31eee2,_0x24a34c,!![])[_0xcac2('0x39')](function(_0x5ef698){_0x3e24c2(_0x5ef698);})['catch'](function(_0x58319b){_0x4324b5(_0x58319b);});}else{originate(_0x31eee2,_0x24a34c,![])['then'](function(_0x44c870){_0x3e24c2(_0x44c870);})[_0xcac2('0x3e')](function(_0x104425){_0x4324b5(_0x104425);});}});};Fax['prototype'][_0xcac2('0x65')]=function(_0x27169c){return!_[_0xcac2('0x66')](_0x27169c)&&!_[_0xcac2('0x66')](_0x27169c[_0xcac2('0x38')])&&!_['isNil'](_0x27169c[_0xcac2('0x67')])&&_0x27169c[_0xcac2('0x67')]&&!_[_0xcac2('0x66')](this['trunks'][util[_0xcac2('0x5d')](_0xcac2('0x68'),_0x27169c[_0xcac2('0x38')])])&&!_[_0xcac2('0x66')](this[_0xcac2('0xd')][util[_0xcac2('0x5d')]('SIP/%s',_0x27169c[_0xcac2('0x38')])]['status'])&&(this['trunks'][util[_0xcac2('0x5d')](_0xcac2('0x68'),_0x27169c['name'])][_0xcac2('0x2c')]==='reachable'||this[_0xcac2('0xd')][util[_0xcac2('0x5d')]('SIP/%s',_0x27169c[_0xcac2('0x38')])][_0xcac2('0x2c')]===_0xcac2('0x69'));};Fax[_0xcac2('0x1d')][_0xcac2('0x59')]=function(_0x4ad1c2,_0x29635c){if(!this[_0xcac2('0x65')](_0x4ad1c2)){ut[_0xcac2('0x46')](_0xcac2('0x6a'),_['isNil'](_0x4ad1c2)?'':_0x4ad1c2[_0xcac2('0x38')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xcac2('0x6b')};}if(_[_0xcac2('0x66')](_0x29635c[_0xcac2('0x3')])){ut[_0xcac2('0x46')](_0xcac2('0x6c'),JSON[_0xcac2('0x3d')](_0x29635c));return{'isValid':![],'message':_0xcac2('0x6d')};}if(_[_0xcac2('0x66')](_0x29635c['path'])){ut[_0xcac2('0x46')](_0xcac2('0x6e'),JSON[_0xcac2('0x3d')](_0x29635c));return{'isValid':![],'message':_0xcac2('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x6fd6=['isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','name','\x20syncNewchannel\x20','channel','info','prototype','variable','value','channelstate','channelstatedesc','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6fd6,0x86));var _0x66fd=function(_0x5882f4,_0x2865d8){_0x5882f4=_0x5882f4-0x0;var _0x3c32e0=_0x6fd6[_0x5882f4];return _0x3c32e0;};'use strict';var util=require(_0x66fd('0x0'));var _=require(_0x66fd('0x1'));var BPromise=require(_0x66fd('0x2'));var uuid=require(_0x66fd('0x3'));var moment=require(_0x66fd('0x4'));var path=require(_0x66fd('0x5'));var tiff2pdf=require(_0x66fd('0x6'));var gs=require(_0x66fd('0x7'));var logger=require('../../../config/logger')(_0x66fd('0x8'));var ami=require(_0x66fd('0x9'));var rpcDb=require(_0x66fd('0xa'));var Channel=require(_0x66fd('0xb'));var ut=require(_0x66fd('0xc'));var Action=require(_0x66fd('0xd'));var faxAccount=require(_0x66fd('0xe'));var attachment=require(_0x66fd('0xf'));var faxMessage=require(_0x66fd('0x10'));function Fax(_0x4c5ced){this['channels']={};this[_0x66fd('0x11')]=_0x4c5ced['faxAccounts'];this['trunks']=_0x4c5ced[_0x66fd('0x12')];this[_0x66fd('0x13')]={};ami['on'](_0x66fd('0x14'),this[_0x66fd('0x15')]['bind'](this));ami['on'](_0x66fd('0x16'),this[_0x66fd('0x17')]['bind'](this));ami['on'](_0x66fd('0x18'),this[_0x66fd('0x19')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1b'),this[_0x66fd('0x1c')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1d'),this[_0x66fd('0x1e')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1f'),this[_0x66fd('0x20')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x21'),this[_0x66fd('0x22')]['bind'](this));ami['on']('originateresponse',this[_0x66fd('0x23')][_0x66fd('0x1a')](this));}Fax['prototype']['syncNewchannel']=function(_0x3373f1){if(_0x3373f1[_0x66fd('0x24')]===_0x66fd('0x25')){for(var _0x36b400 in this[_0x66fd('0x11')]){if(this['faxAccounts'][_0x66fd('0x26')](_0x36b400)){if(_0x3373f1['exten']===this['faxAccounts'][_0x36b400][_0x66fd('0x27')]){this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]={};this['channels'][_0x3373f1[_0x66fd('0x29')]]['channel']=_0x3373f1['channel'];this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]['id']=this[_0x66fd('0x11')][_0x36b400]['id'];this['channels'][_0x3373f1[_0x66fd('0x29')]][_0x66fd('0x2a')]=this[_0x66fd('0x11')][_0x36b400][_0x66fd('0x2a')];logger['info'](_0x3373f1[_0x66fd('0x29')],_0x66fd('0x2b'));}}}}if(this[_0x66fd('0x13')][_0x3373f1[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]={};this['channels'][_0x3373f1['uniqueid']][_0x66fd('0x2c')]=_0x3373f1[_0x66fd('0x2c')];logger[_0x66fd('0x2d')](_0x3373f1[_0x66fd('0x29')],_0x66fd('0x2b'));}};Fax[_0x66fd('0x2e')][_0x66fd('0x17')]=function(_0x43cdc0){if(this[_0x66fd('0x28')][_0x43cdc0['uniqueid']]){for(var _0x2a786d in _0x43cdc0[_0x66fd('0x2f')]){if(_0x43cdc0[_0x66fd('0x2f')][_0x66fd('0x26')](_0x2a786d)){this[_0x66fd('0x28')][_0x43cdc0[_0x66fd('0x29')]][_0x2a786d]=_0x43cdc0[_0x66fd('0x30')];}}}};Fax[_0x66fd('0x2e')][_0x66fd('0x19')]=function(_0x237b24){if(this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]]['channelstate']=_0x237b24[_0x66fd('0x31')];this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]][_0x66fd('0x32')]=_0x237b24[_0x66fd('0x32')];}};Fax[_0x66fd('0x2e')][_0x66fd('0x1c')]=function(_0x2776b1){if(this[_0x66fd('0x28')][_0x2776b1[_0x66fd('0x29')]]){for(var _0x3f96df in _0x2776b1[_0x66fd('0x2f')]){if(_0x2776b1[_0x66fd('0x2f')]['hasOwnProperty'](_0x3f96df)){this[_0x66fd('0x28')][_0x2776b1[_0x66fd('0x29')]][_0x3f96df]=_0x2776b1[_0x66fd('0x30')];}}}};Fax[_0x66fd('0x2e')]['syncFaxStatus']=function(_0x67d7c6){if(this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x33')]=_0x67d7c6[_0x66fd('0x33')];this[_0x66fd('0x28')][_0x67d7c6['uniqueid']]['status']=_0x67d7c6['status'];this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x27')]=_0x67d7c6[_0x66fd('0x27')];this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x34')]=_0x67d7c6[_0x66fd('0x34')];logger[_0x66fd('0x2d')](_0x67d7c6['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x66fd('0x2e')][_0x66fd('0x20')]=function(_0x41a407){var _0x283b6c=this;if(this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]){var _0x4de7f2=this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['id'];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x35')]=_0x41a407[_0x66fd('0x35')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['pagestransferred']=_0x41a407[_0x66fd('0x36')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x27')]=_0x41a407[_0x66fd('0x27')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x37')]=_0x41a407[_0x66fd('0x37')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['transferrate']=_0x41a407[_0x66fd('0x38')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x34')]=_0x41a407['filename'];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x39')]=_0x41a407[_0x66fd('0x39')];if(this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['pagestransferred']>0x0){tiff2pdf(_0x41a407[_0x66fd('0x34')],_0x66fd('0x3a'),function(_0x54307f){logger[_0x66fd('0x2d')](_0x41a407[_0x66fd('0x29')],_0x66fd('0x3b'),_0x54307f[_0x66fd('0x3c')]);attachment[_0x66fd('0x3d')]({'name':path['parse'](_0x41a407[_0x66fd('0x34')])[_0x66fd('0x2a')],'basename':path[_0x66fd('0x3e')](_0x41a407[_0x66fd('0x34')])[_0x66fd('0x2a')]+_0x66fd('0x3f'),'type':'application/pdf'})[_0x66fd('0x40')](function(_0x52ea28){faxAccount['notify'](_0x4de7f2,{'from':_0x41a407[_0x66fd('0x39')],'mapKey':_0x66fd('0x8'),'body':path[_0x66fd('0x3e')](_0x41a407[_0x66fd('0x34')])['name']+_0x66fd('0x3f'),'AttachmentId':_0x52ea28['id']})['catch'](function(_0x54c56d){logger['error'](_0x41a407[_0x66fd('0x29')],'\x20notify\x20',JSON[_0x66fd('0x41')](_0x54c56d));});})['catch'](function(_0x3db31e){logger[_0x66fd('0x42')](_0x41a407['uniqueid'],_0x66fd('0x43'),JSON[_0x66fd('0x41')](_0x3db31e));});});}logger[_0x66fd('0x2d')](_0x41a407[_0x66fd('0x29')],_0x66fd('0x43'));}};Fax[_0x66fd('0x2e')]['syncOriginateResponse']=function(_0x51d3cf){if(this[_0x66fd('0x13')][_0x51d3cf[_0x66fd('0x29')]]){_[_0x66fd('0x44')](this[_0x66fd('0x28')][_0x51d3cf[_0x66fd('0x29')]],_[_0x66fd('0x45')](_0x51d3cf,[_0x66fd('0x46'),_0x66fd('0x47')]));}};function updateStatus(_0x3c3e77){if(_0x3c3e77['AttachmentId']){faxMessage[_0x66fd('0x48')](_0x3c3e77[_0x66fd('0x49')],{'failMessage':_0x66fd('0x4a')})[_0x66fd('0x40')](function(_0x14fd90){ut[_0x66fd('0x4b')](_0x66fd('0x4c'),_0x14fd90);})[_0x66fd('0x4d')](function(_0x12ed5a){ut[_0x66fd('0x4b')](_0x66fd('0x4e'),_0x12ed5a);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x66fd('0x4f')]=function(_0x1f6187,_0x1146e2,_0x86493a){var _0x35aa05=this;var _0x38c20d={};if(_0x1146e2){_0x38c20d={'read':_0x1146e2};}else{_0x38c20d={'failMessage':_0x86493a};}if(this[_0x66fd('0x13')][_0x1f6187]['AttachmentId']){faxMessage[_0x66fd('0x48')](this[_0x66fd('0x13')][_0x1f6187][_0x66fd('0x49')],_0x38c20d)[_0x66fd('0x40')](function(_0x14182c){ut[_0x66fd('0x4b')]('[Fax][Message][Updated]',_0x14182c);})[_0x66fd('0x4d')](function(_0x43ee04){ut[_0x66fd('0x4b')](_0x66fd('0x50'),_0x43ee04);})[_0x66fd('0x51')](function(){delete _0x35aa05[_0x66fd('0x28')][_0x1f6187];delete _0x35aa05[_0x66fd('0x13')][_0x1f6187];});}else{ut[_0x66fd('0x4b')](_0x66fd('0x52'));delete this[_0x66fd('0x28')][_0x1f6187];delete this[_0x66fd('0x13')][_0x1f6187];}};Fax[_0x66fd('0x2e')][_0x66fd('0x22')]=function(_0x521614){var _0x5c01b2=this;if(this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]]){if(this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x521614['uniqueid']]['id']=this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]['id'];this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]][_0x66fd('0x2a')]=this['actions'][_0x521614[_0x66fd('0x29')]][_0x66fd('0x2a')];}logger[_0x66fd('0x2d')](_0x521614[_0x66fd('0x29')],this[_0x66fd('0x13')][_0x521614['uniqueid']]?_0x66fd('0x53'):_0x66fd('0x54'),JSON[_0x66fd('0x41')](this[_0x66fd('0x28')][_0x521614['uniqueid']]));if(this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]){if(this['channels'][_0x521614[_0x66fd('0x29')]]['faxpages']>0x0&&this['channels'][_0x521614['uniqueid']][_0x66fd('0x1d')]===_0x66fd('0x55')){this[_0x66fd('0x4f')](_0x521614[_0x66fd('0x29')],!![]);}else{this[_0x66fd('0x4f')](_0x521614[_0x66fd('0x29')],![],this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]][_0x66fd('0x56')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x521614[_0x66fd('0x29')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x66fd('0x2e')][_0x66fd('0x57')]=function(_0x388cda){var _0x26f192=this;return new BPromise(function(_0x5e6211,_0x584ffb){_0x26f192[_0x66fd('0x58')](_0x388cda,_0x26f192[_0x66fd('0x11')][_0x388cda['FaxAccountId']])[_0x66fd('0x40')](function(_0x18fbb5){ut[_0x66fd('0x4b')](_0x66fd('0x59'),_0x18fbb5);_0x5e6211(ut[_0x66fd('0x3c')](_0x66fd('0x5a')));})[_0x66fd('0x4d')](function(_0x171b36){ut[_0x66fd('0x4b')](_0x66fd('0x5b'),_0x171b36);updateStatus(_0x388cda);_0x584ffb(ut[_0x66fd('0x3c')](_0x66fd('0x5c')));});});};Fax[_0x66fd('0x2e')]['checkAfterSend']=function(_0x5a4ed8){var _0x4ad395=this;return new BPromise(function(_0x285e6d,_0x40638d){var _0x57ad66=_0x4ad395[_0x66fd('0x5d')](_0x4ad395[_0x66fd('0x11')][_0x5a4ed8['FaxAccountId']][_0x66fd('0x5e')],_0x5a4ed8);if(_0x57ad66['isValid']){_0x285e6d(ut['message']('Trunk\x20Reachable'));}else{_0x40638d(ut[_0x66fd('0x3c')](_0x57ad66['message']));}});};function originate(_0x5e26df,_0x325d13,_0x22a7e3){return new BPromise(function(_0x5bb1f7,_0x53b0e0){if(_0x22a7e3){var _0x995762=util[_0x66fd('0x5f')](_0x66fd('0x60'),path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])[_0x66fd('0x2a')],_0x5e26df[_0x66fd('0x5')]);gs[_0x66fd('0x61')](_0x995762)[_0x66fd('0x40')](function(){_0x5e26df[_0x66fd('0x5')]=util[_0x66fd('0x5f')]('%s/%s.tif',path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])['dir'],path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])[_0x66fd('0x2a')]);_0x325d13[_0x66fd('0x62')]=_0x5e26df[_0x66fd('0x5')];ut['logger'](_0x66fd('0x63'),'');ami[_0x66fd('0x64')](ut[_0x66fd('0x65')](_0x5e26df,_0x325d13))[_0x66fd('0x40')](function(_0x3d591f){_0x5bb1f7(_0x3d591f);})['catch'](function(_0x3e1a8b){_0x53b0e0(_0x3e1a8b);});})[_0x66fd('0x4d')](function(_0x4026cb){_0x53b0e0(_0x4026cb);});}else{ami[_0x66fd('0x64')](ut[_0x66fd('0x65')](_0x5e26df,_0x325d13))[_0x66fd('0x40')](function(_0x2b2b90){_0x5bb1f7(_0x2b2b90);})['catch'](function(_0x5c6b7d){_0x53b0e0(_0x5c6b7d);});}});}Fax[_0x66fd('0x2e')][_0x66fd('0x58')]=function(_0x2c1b78,_0x5be9d1){var _0x54b866=this;return new BPromise(function(_0x486200,_0x415a53){var _0x5956a2=uuid['v4']();var _0x575a80=ut[_0x66fd('0x66')](_0x2c1b78,_0x5be9d1);_0x54b866[_0x66fd('0x13')][_0x5956a2]=new Action(_0x5956a2,_0x5be9d1,_0x2c1b78);var _0x1f330e=_0x54b866[_0x66fd('0x13')][_0x5956a2];if(path[_0x66fd('0x3e')](_0x2c1b78[_0x66fd('0x5')])[_0x66fd('0x67')]===_0x66fd('0x3f')){originate(_0x1f330e,_0x575a80,!![])[_0x66fd('0x40')](function(_0x47fe2a){_0x486200(_0x47fe2a);})[_0x66fd('0x4d')](function(_0x3cfe62){_0x415a53(_0x3cfe62);});}else{originate(_0x1f330e,_0x575a80,![])['then'](function(_0x133d35){_0x486200(_0x133d35);})[_0x66fd('0x4d')](function(_0x460f9b){_0x415a53(_0x460f9b);});}});};Fax[_0x66fd('0x2e')][_0x66fd('0x68')]=function(_0x12437f){return!_[_0x66fd('0x69')](_0x12437f)&&!_['isNil'](_0x12437f[_0x66fd('0x2a')])&&!_[_0x66fd('0x69')](_0x12437f['active'])&&_0x12437f[_0x66fd('0x6a')]&&!_[_0x66fd('0x69')](this['trunks'][util['format'](_0x66fd('0x6b'),_0x12437f[_0x66fd('0x2a')])])&&!_[_0x66fd('0x69')](this[_0x66fd('0x12')][util['format']('SIP/%s',_0x12437f[_0x66fd('0x2a')])][_0x66fd('0x6c')])&&(this['trunks'][util['format'](_0x66fd('0x6b'),_0x12437f[_0x66fd('0x2a')])][_0x66fd('0x6c')]===_0x66fd('0x6d')||this[_0x66fd('0x12')][util[_0x66fd('0x5f')]('SIP/%s',_0x12437f['name'])]['status']===_0x66fd('0x6e'));};Fax['prototype']['checkTrunk']=function(_0x439fbc,_0x14b3f3){if(!this['isTrunkReachable'](_0x439fbc)){ut[_0x66fd('0x4b')](_0x66fd('0x6f'),_[_0x66fd('0x69')](_0x439fbc)?'':_0x439fbc[_0x66fd('0x2a')]+_0x66fd('0x70'));return{'isValid':![],'message':_0x66fd('0x71')};}if(_[_0x66fd('0x69')](_0x14b3f3[_0x66fd('0x8')])){ut['logger'](_0x66fd('0x72'),JSON[_0x66fd('0x41')](_0x14b3f3));return{'isValid':![],'message':_0x66fd('0x73')};}if(_[_0x66fd('0x69')](_0x14b3f3[_0x66fd('0x5')])){ut['logger'](_0x66fd('0x74'),JSON['stringify'](_0x14b3f3));return{'isValid':![],'message':_0x66fd('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x66fd('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index dc31c4f..2b2897f 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 _0x8dbb=['lodash','error','inspect','notify','then','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x43c1f8,_0x22bbf6){var _0x4aafd4=function(_0x23278d){while(--_0x23278d){_0x43c1f8['push'](_0x43c1f8['shift']());}};_0x4aafd4(++_0x22bbf6);}(_0x8dbb,0x177));var _0xb8db=function(_0xdd90bf,_0x525f28){_0xdd90bf=_0xdd90bf-0x0;var _0x3d7ff9=_0x8dbb[_0xdd90bf];return _0x3d7ff9;};'use strict';var util=require(_0xb8db('0x0'));var BPromise=require(_0xb8db('0x1'));var logger=require(_0xb8db('0x2'))('preview');var _=require(_0xb8db('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2fe416){return function(_0x11b1c6){logger[_0xb8db('0x4')](_0x2fe416,util[_0xb8db('0x5')](_0x11b1c6,{'showHidden':![],'depth':null}));};}exports[_0xb8db('0x6')]=function(_0x2dc166,_0x46bef4){return BPromise['resolve']()[_0xb8db('0x7')](faxAccount[_0xb8db('0x6')](_0x2dc166,_0x46bef4))['catch'](loggerCatch(_0xb8db('0x8')));}; \ No newline at end of file +var _0x42b0=['lodash','../rpc/faxAccount','error','resolve','then','notify','catch','[Notify]\x20','util','../../../config/logger','preview'];(function(_0x4fac73,_0x33b7a1){var _0x5e24a4=function(_0x11874a){while(--_0x11874a){_0x4fac73['push'](_0x4fac73['shift']());}};_0x5e24a4(++_0x33b7a1);}(_0x42b0,0xc3));var _0x042b=function(_0xac7e76,_0x1fa476){_0xac7e76=_0xac7e76-0x0;var _0x51bf57=_0x42b0[_0xac7e76];return _0x51bf57;};'use strict';var util=require(_0x042b('0x0'));var BPromise=require('bluebird');var logger=require(_0x042b('0x1'))(_0x042b('0x2'));var _=require(_0x042b('0x3'));var faxAccount=require(_0x042b('0x4'));function loggerCatch(_0x149002){return function(_0x548aab){logger[_0x042b('0x5')](_0x149002,util['inspect'](_0x548aab,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2ee9dd,_0x58e4e1){return BPromise[_0x042b('0x6')]()[_0x042b('0x7')](faxAccount[_0x042b('0x8')](_0x2ee9dd,_0x58e4e1))[_0x042b('0x9')](loggerCatch(_0x042b('0xa')));}; \ 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 3d5df1e..5ef8af9 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 _0x059b=['inspect','util','../../../../config/logger','fax','exec','info','\x20Error\x20:'];(function(_0x5b8b49,_0x581544){var _0x5d30df=function(_0x9f0e70){while(--_0x9f0e70){_0x5b8b49['push'](_0x5b8b49['shift']());}};_0x5d30df(++_0x581544);}(_0x059b,0x17b));var _0xb059=function(_0x2edb8f,_0x4aad0c){_0x2edb8f=_0x2edb8f-0x0;var _0x1da469=_0x059b[_0x2edb8f];return _0x1da469;};'use strict';var util=require(_0xb059('0x0'));var logger=require(_0xb059('0x1'))(_0xb059('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xb059('0x3')];exports['execute']=function(_0x4931d9){return new BPromise(function(_0xa69dbc,_0x3ac712){exec(_0x4931d9,function(_0x17c4cb,_0x106ddd,_0x5f0141){logger['info']('Exec\x20gs',_0x106ddd);if(_0x17c4cb){logger[_0xb059('0x4')]('Exec\x20gs',_0xb059('0x5'),util[_0xb059('0x6')](_0x17c4cb,{'showHidden':![],'depth':null}),_0x106ddd,_0x5f0141);_0x3ac712(_0x17c4cb);}_0xa69dbc(_0x106ddd);});});}; \ No newline at end of file +var _0xca53=['util','../../../../config/logger','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xca53,0x90));var _0x3ca5=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0xca53[_0x14540b];return _0x394822;};'use strict';var util=require(_0x3ca5('0x0'));var logger=require(_0x3ca5('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x3ca5('0x2'))[_0x3ca5('0x3')];exports[_0x3ca5('0x4')]=function(_0x4d66a6){return new BPromise(function(_0x4a4bdf,_0x57e2ba){exec(_0x4d66a6,function(_0x1ba9d8,_0x420d54,_0x562492){logger['info'](_0x3ca5('0x5'),_0x420d54);if(_0x1ba9d8){logger[_0x3ca5('0x6')](_0x3ca5('0x5'),_0x3ca5('0x7'),util[_0x3ca5('0x8')](_0x1ba9d8,{'showHidden':![],'depth':null}),_0x420d54,_0x562492);_0x57e2ba(_0x1ba9d8);}_0x4a4bdf(_0x420d54);});});}; \ 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 00be051..14c7ac2 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 _0x1a33=['headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a33,0x18a));var _0x31a3=function(_0x34513f,_0x2d46eb){_0x34513f=_0x34513f-0x0;var _0x359515=_0x1a33[_0x34513f];return _0x359515;};'use strict';var util=require(_0x31a3('0x0'));var _=require(_0x31a3('0x1'));var moment=require(_0x31a3('0x2'));var logger=require(_0x31a3('0x3'))(_0x31a3('0x4'));exports[_0x31a3('0x5')]=function(_0x2fdae7){return{'message':_0x2fdae7};};exports[_0x31a3('0x6')]=function(_0x3a7f8a,_0x292159){logger[_0x31a3('0x7')](_0x3a7f8a,util[_0x31a3('0x8')](_0x292159,{'showHidden':![],'depth':null}));};exports[_0x31a3('0x9')]=function(_0x5e5033,_0x3bcdc8){var _0x338286={'XMF-ECM':_0x3bcdc8[_0x31a3('0xa')],'XMF-HEADERINFO':_0x3bcdc8[_0x31a3('0xb')],'XMF-MINRATE':_0x3bcdc8[_0x31a3('0xc')],'XMF-MAXRATE':_0x3bcdc8[_0x31a3('0xd')],'XMF-MODEM':util[_0x31a3('0xe')]('\x22%s\x22',_0x3bcdc8[_0x31a3('0xf')]),'XMF-GATEWAY':_0x3bcdc8[_0x31a3('0x10')],'XMF-FAXDETECT':_0x3bcdc8[_0x31a3('0x11')],'XMF-T38TIMEOUT':_0x3bcdc8[_0x31a3('0x12')],'XMF-LOCALSTATIONID':_0x3bcdc8[_0x31a3('0x13')],'XMF-PATH':_0x5e5033[_0x31a3('0x14')]};return _0x338286;};exports[_0x31a3('0x15')]=function(_0x1e4e7f,_0x34b03c){return{'actionid':_0x1e4e7f[_0x31a3('0x16')],'action':_0x31a3('0x17'),'channel':_0x1e4e7f['channel'],'Exten':_0x31a3('0x18'),'Context':_0x31a3('0x19'),'Priority':'1','callerid':util[_0x31a3('0xe')](_0x31a3('0x1a'),_0x1e4e7f[_0x31a3('0xb')]?_0x1e4e7f[_0x31a3('0xb')]:'',_0x1e4e7f['localstationid']),'variable':_0x34b03c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1e4e7f['uniqueid']};}; \ No newline at end of file +var _0x5978=['\x22%s\x22\x20<%s>','uniqueid','util','lodash','../../../../config/logger','message','logger','info','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip'];(function(_0x1d4392,_0x20314d){var _0xed2d1f=function(_0x3c7003){while(--_0x3c7003){_0x1d4392['push'](_0x1d4392['shift']());}};_0xed2d1f(++_0x20314d);}(_0x5978,0x172));var _0x8597=function(_0x1fad59,_0xb36e05){_0x1fad59=_0x1fad59-0x0;var _0x2f92b8=_0x5978[_0x1fad59];return _0x2f92b8;};'use strict';var util=require(_0x8597('0x0'));var _=require(_0x8597('0x1'));var moment=require('moment');var logger=require(_0x8597('0x2'))('fax');exports[_0x8597('0x3')]=function(_0x322bce){return{'message':_0x322bce};};exports[_0x8597('0x4')]=function(_0x5a7305,_0x5a9335){logger[_0x8597('0x5')](_0x5a7305,util['inspect'](_0x5a9335,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x210922,_0x105e44){var _0x43cca3={'XMF-ECM':_0x105e44['ecm'],'XMF-HEADERINFO':_0x105e44[_0x8597('0x6')],'XMF-MINRATE':_0x105e44[_0x8597('0x7')],'XMF-MAXRATE':_0x105e44[_0x8597('0x8')],'XMF-MODEM':util[_0x8597('0x9')](_0x8597('0xa'),_0x105e44['modem']),'XMF-GATEWAY':_0x105e44[_0x8597('0xb')],'XMF-FAXDETECT':_0x105e44[_0x8597('0xc')],'XMF-T38TIMEOUT':_0x105e44[_0x8597('0xd')],'XMF-LOCALSTATIONID':_0x105e44[_0x8597('0xe')],'XMF-PATH':_0x210922[_0x8597('0xf')]};return _0x43cca3;};exports[_0x8597('0x10')]=function(_0x27582c,_0xb89eb2){return{'actionid':_0x27582c['uniqueid'],'action':_0x8597('0x11'),'channel':_0x27582c[_0x8597('0x12')],'Exten':_0x8597('0x13'),'Context':_0x8597('0x14'),'Priority':'1','callerid':util[_0x8597('0x9')](_0x8597('0x15'),_0x27582c[_0x8597('0x6')]?_0x27582c[_0x8597('0x6')]:'',_0x27582c[_0x8597('0xe')]),'variable':_0xb89eb2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x27582c[_0x8597('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 424a789..85be13a 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 _0x1fcc=['inspect','bluebird','util','moment','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen'];(function(_0x5967d8,_0x485566){var _0x33b055=function(_0x275280){while(--_0x275280){_0x5967d8['push'](_0x5967d8['shift']());}};_0x33b055(++_0x485566);}(_0x1fcc,0x125));var _0xc1fc=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x1fcc[_0xd2d54];return _0x78b113;};'use strict';var BPromise=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var moment=require(_0xc1fc('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xc1fc('0x3'));var Acw=require(_0xc1fc('0x4'));var Trigger=require(_0xc1fc('0x5'));var Dialer=require(_0xc1fc('0x6'));var Preview=require(_0xc1fc('0x7'));var Fax=require(_0xc1fc('0x8'));var user=require(_0xc1fc('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xc1fc('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xc1fc('0xb'));var trigger=require(_0xc1fc('0xc'));var template=require(_0xc1fc('0xd'));var cmHopperHistory=require(_0xc1fc('0xe'));var campaign=require(_0xc1fc('0xf'));var voiceExtension=require(_0xc1fc('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc1fc('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xc1fc('0x12'));var freshdesk=require(_0xc1fc('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc1fc('0x14'));var vtiger=require(_0xc1fc('0x15'));var freshsales=require(_0xc1fc('0x16'));var servicenow=require(_0xc1fc('0x17'));var dynamics365=require(_0xc1fc('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(_0xc1fc('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc1fc('0x1a')](_0xc1fc('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc1fc('0x1c')]()[_0xc1fc('0x1d')](user['getAgents']())[_0xc1fc('0x1d')](realtime['initAgents']())[_0xc1fc('0x1d')](user[_0xc1fc('0x1e')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x1f')]())[_0xc1fc('0x1d')](trunk[_0xc1fc('0x20')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x21')]())[_0xc1fc('0x1d')](voiceQueue[_0xc1fc('0x22')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x23')]())[_0xc1fc('0x1d')](trigger['getTriggers']())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x24')]())['then'](template[_0xc1fc('0x25')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x26')]())[_0xc1fc('0x1d')](zendesk[_0xc1fc('0x27')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x28')]())[_0xc1fc('0x1d')](salesforce[_0xc1fc('0x29')]())['then'](realtime[_0xc1fc('0x2a')]())[_0xc1fc('0x1d')](sugarcrm[_0xc1fc('0x2b')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x2c')]())[_0xc1fc('0x1d')](freshdesk[_0xc1fc('0x2d')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x2e')]())[_0xc1fc('0x1d')](desk[_0xc1fc('0x2f')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x30')]())[_0xc1fc('0x1d')](zoho['getZohoAccounts']())['then'](realtime[_0xc1fc('0x31')]())[_0xc1fc('0x1d')](vtiger[_0xc1fc('0x32')]())['then'](realtime[_0xc1fc('0x33')]())['then'](freshsales[_0xc1fc('0x34')]())['then'](realtime[_0xc1fc('0x35')]())['then'](servicenow[_0xc1fc('0x36')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x37')]())[_0xc1fc('0x1d')](dynamics365['getDynamics365Accounts']())[_0xc1fc('0x1d')](realtime['initDynamics365Accounts']())[_0xc1fc('0x1d')](campaign[_0xc1fc('0x38')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x39')]())['then'](voiceExtension[_0xc1fc('0x3a')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x3b')]())[_0xc1fc('0x1d')](faxAccount[_0xc1fc('0x3c')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x3d')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xc1fc('0x1c')]()[_0xc1fc('0x1d')](voiceQueueReport[_0xc1fc('0x3e')]())[_0xc1fc('0x1d')](realtime['initVoiceQueueReports']())[_0xc1fc('0x1d')](cmHopperHistory[_0xc1fc('0x3f')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x40')]())[_0xc1fc('0x1d')](cmHopperHistory[_0xc1fc('0x41')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x42')]())[_0xc1fc('0x1d')](voiceCallReport[_0xc1fc('0x43')]())[_0xc1fc('0x1d')](realtime[_0xc1fc('0x44')]())[_0xc1fc('0x45')](function(_0x16edcc){logger[_0xc1fc('0x46')]('[index.js][initParams]',util['inspect'](_0x16edcc,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc1fc('0x47')](realtime,preview,fax)['then'](function(_0x317786){return initRealtime();})[_0xc1fc('0x1d')](function(){return initParams();})[_0xc1fc('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc1fc('0x45')](function(_0x37c481){logger[_0xc1fc('0x46')]('[index.js][main]',util[_0xc1fc('0x48')](_0x37c481,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x612a=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x21ccee,_0x59b41a){var _0x4e3f8d=function(_0x1f6418){while(--_0x1f6418){_0x21ccee['push'](_0x21ccee['shift']());}};_0x4e3f8d(++_0x59b41a);}(_0x612a,0x1c7));var _0xa612=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x612a[_0x737a1f];return _0x16eba1;};'use strict';var BPromise=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var moment=require(_0xa612('0x2'));var server=require(_0xa612('0x3'));var Realtime=require(_0xa612('0x4'));var Report=require(_0xa612('0x5'));var Acw=require(_0xa612('0x6'));var Trigger=require(_0xa612('0x7'));var Dialer=require('./dialer');var Preview=require(_0xa612('0x8'));var Fax=require(_0xa612('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xa612('0xa'));var voiceQueueReport=require(_0xa612('0xb'));var voiceCallReport=require(_0xa612('0xc'));var trunk=require(_0xa612('0xd'));var trigger=require(_0xa612('0xe'));var template=require(_0xa612('0xf'));var cmHopperHistory=require(_0xa612('0x10'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xa612('0x11'));var faxAccount=require(_0xa612('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xa612('0x13'));var sugarcrm=require(_0xa612('0x14'));var freshdesk=require(_0xa612('0x15'));var desk=require(_0xa612('0x16'));var zoho=require(_0xa612('0x17'));var vtiger=require(_0xa612('0x18'));var freshsales=require(_0xa612('0x19'));var servicenow=require(_0xa612('0x1a'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xa612('0x1b'))(_0xa612('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa612('0x1d')](_0xa612('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xa612('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa612('0x1f')]()['then'](user['getAgents']())[_0xa612('0x20')](realtime[_0xa612('0x21')]())[_0xa612('0x20')](user[_0xa612('0x22')]())['then'](realtime[_0xa612('0x23')]())[_0xa612('0x20')](trunk[_0xa612('0x24')]())[_0xa612('0x20')](realtime['initTrunks']())[_0xa612('0x20')](voiceQueue[_0xa612('0x25')]())[_0xa612('0x20')](realtime[_0xa612('0x26')]())[_0xa612('0x20')](trigger[_0xa612('0x27')]())[_0xa612('0x20')](realtime[_0xa612('0x28')]())[_0xa612('0x20')](template[_0xa612('0x29')]())[_0xa612('0x20')](realtime['initTemplates']())[_0xa612('0x20')](zendesk[_0xa612('0x2a')]())['then'](realtime[_0xa612('0x2b')]())[_0xa612('0x20')](salesforce[_0xa612('0x2c')]())[_0xa612('0x20')](realtime['initSalesforceAccounts']())[_0xa612('0x20')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xa612('0x2d')]())[_0xa612('0x20')](freshdesk[_0xa612('0x2e')]())[_0xa612('0x20')](realtime[_0xa612('0x2f')]())['then'](desk[_0xa612('0x30')]())['then'](realtime[_0xa612('0x31')]())[_0xa612('0x20')](zoho['getZohoAccounts']())[_0xa612('0x20')](realtime[_0xa612('0x32')]())[_0xa612('0x20')](vtiger['getVtigerAccounts']())['then'](realtime[_0xa612('0x33')]())[_0xa612('0x20')](freshsales['getFreshsalesAccounts']())[_0xa612('0x20')](realtime[_0xa612('0x34')]())[_0xa612('0x20')](servicenow[_0xa612('0x35')]())[_0xa612('0x20')](realtime[_0xa612('0x36')]())['then'](dynamics365[_0xa612('0x37')]())[_0xa612('0x20')](realtime[_0xa612('0x38')]())[_0xa612('0x20')](campaign[_0xa612('0x39')]())[_0xa612('0x20')](realtime[_0xa612('0x3a')]())[_0xa612('0x20')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa612('0x3b')]())[_0xa612('0x20')](faxAccount[_0xa612('0x3c')]())[_0xa612('0x20')](realtime['initFaxAccounts']())[_0xa612('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0xa612('0x1f')]()[_0xa612('0x20')](voiceQueueReport[_0xa612('0x3d')]())[_0xa612('0x20')](realtime[_0xa612('0x3e')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xa612('0x3f')]())[_0xa612('0x20')](cmHopperHistory[_0xa612('0x40')]())[_0xa612('0x20')](realtime[_0xa612('0x41')]())[_0xa612('0x20')](voiceCallReport[_0xa612('0x42')]())[_0xa612('0x20')](realtime[_0xa612('0x43')]())[_0xa612('0x44')](function(_0x4d5c5f){logger['error'](_0xa612('0x45'),util[_0xa612('0x46')](_0x4d5c5f,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa612('0x47')](realtime,preview,fax)[_0xa612('0x20')](function(_0x402b62){return initRealtime();})[_0xa612('0x20')](function(){return initParams();})[_0xa612('0x20')](function(){report[_0xa612('0x48')]();setInterval(initRealtime,0x1388);})[_0xa612('0x44')](function(_0x22a215){logger['error'](_0xa612('0x49'),util[_0xa612('0x46')](_0x22a215,{'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 ab35b0b..8b196b4 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x2b38b2,_0x5d1a95){var _0x53c23b=function(_0x919616){while(--_0x919616){_0x2b38b2['push'](_0x2b38b2['shift']());}};_0x53c23b(++_0x5d1a95);}(_0x70e0,0x17b));var _0x070e=function(_0x25fc77,_0x1d00d3){_0x25fc77=_0x25fc77-0x0;var _0x28b970=_0x70e0[_0x25fc77];return _0x28b970;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x2dc8e3,_0x5cb082){var _0x40526d=function(_0xee42dd){while(--_0xee42dd){_0x2dc8e3['push'](_0x2dc8e3['shift']());}};_0x40526d(++_0x5cb082);}(_0xe706,0xa3));var _0x6e70=function(_0x822a3f,_0x32fd83){_0x822a3f=_0x822a3f-0x0;var _0x1053e7=_0xe706[_0x822a3f];return _0x1053e7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index c6b8ca7..bfc02d3 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 _0x1d01=['ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x1d01,0x1e5));var _0x11d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1d01[_0x2dafbe];return _0x58a45a;};'use strict';function Campaign(_0x17026e){this['id']=_0x17026e['id']||0x0;this[_0x11d0('0x0')]=_0x17026e[_0x11d0('0x0')]||'';this['type']=_0x17026e['type']||_0x11d0('0x1');this[_0x11d0('0x2')]=0x0;this[_0x11d0('0x3')]=0x0;this[_0x11d0('0x4')]=0x0;this[_0x11d0('0x5')]=0x0;this['message']='';this[_0x11d0('0x6')]=!![];this[_0x11d0('0x7')]=_0x17026e[_0x11d0('0x7')];this[_0x11d0('0x8')]=_0x17026e[_0x11d0('0x8')];this[_0x11d0('0x9')]=_0x17026e[_0x11d0('0x9')]||null;this[_0x11d0('0xa')]=_0x17026e[_0x11d0('0xa')]?_0x17026e['dialGlobalInterval']:null;this[_0x11d0('0xb')]=_0x17026e[_0x11d0('0xb')];this['dialOriginateCallerIdNumber']=_0x17026e['dialOriginateCallerIdNumber'];this[_0x11d0('0xc')]=_0x17026e['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x17026e[_0x11d0('0xd')];this[_0x11d0('0xe')]=_0x17026e['dialCongestionRetryFrequency'];this[_0x11d0('0xf')]=_0x17026e[_0x11d0('0xf')];this[_0x11d0('0x10')]=_0x17026e['dialBusyRetryFrequency'];this[_0x11d0('0x11')]=_0x17026e[_0x11d0('0x11')];this[_0x11d0('0x12')]=_0x17026e[_0x11d0('0x12')];this[_0x11d0('0x13')]=_0x17026e['dialGlobalMaxRetry'];this[_0x11d0('0x14')]=_0x17026e[_0x11d0('0x14')]||0x3;this[_0x11d0('0x15')]=_0x17026e[_0x11d0('0x15')]||0x96;this[_0x11d0('0x16')]=_0x17026e[_0x11d0('0x16')]||0x3;this['dialDropRetryFrequency']=_0x17026e['dialDropRetryFrequency']||0x96;this[_0x11d0('0x17')]=_0x17026e[_0x11d0('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x17026e[_0x11d0('0x18')]||0x96;this[_0x11d0('0x19')]=_0x17026e['dialMachineMaxRetry']||0x3;this[_0x11d0('0x1a')]=_0x17026e[_0x11d0('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x17026e[_0x11d0('0x1b')]||0x3;this[_0x11d0('0x1c')]=_0x17026e[_0x11d0('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x17026e[_0x11d0('0x1d')]||'DESC';this[_0x11d0('0x1e')]=_0x17026e[_0x11d0('0x1e')]||undefined;this[_0x11d0('0x1f')]=_0x17026e[_0x11d0('0x1f')]||undefined;this[_0x11d0('0x20')]=_0x17026e[_0x11d0('0x20')]||undefined;this['TrunkBackup']=_0x17026e[_0x11d0('0x21')]?_0x17026e[_0x11d0('0x21')]:undefined;this['Trunk']=_0x17026e[_0x11d0('0x22')]?_0x17026e['Trunk']:undefined;this[_0x11d0('0x23')]=_0x17026e[_0x11d0('0x23')]?_0x17026e[_0x11d0('0x23')]:undefined;this[_0x11d0('0x24')]=_0x17026e['SquareProject']?_0x17026e[_0x11d0('0x24')]:undefined;this[_0x11d0('0x25')]=_0x17026e[_0x11d0('0x24')]?_0x17026e[_0x11d0('0x24')][_0x11d0('0x0')]:undefined;this[_0x11d0('0x26')]=_0x17026e[_0x11d0('0x26')]||![];this[_0x11d0('0x27')]=_0x17026e[_0x11d0('0x27')];this['dialAMDGreeting']=_0x17026e[_0x11d0('0x28')];this[_0x11d0('0x29')]=_0x17026e['dialAMDAfterGreetingSilence'];this[_0x11d0('0x2a')]=_0x17026e['dialAMDTotalAnalysisTime'];this[_0x11d0('0x2b')]=_0x17026e[_0x11d0('0x2b')];this['dialAMDBetweenWordsSilence']=_0x17026e[_0x11d0('0x2c')];this[_0x11d0('0x2d')]=_0x17026e[_0x11d0('0x2d')];this[_0x11d0('0x2e')]=_0x17026e['dialAMDSilenceThreshold'];this[_0x11d0('0x2f')]=_0x17026e[_0x11d0('0x2f')];}module[_0x11d0('0x30')]=Campaign; \ No newline at end of file +var _0x5a48=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x154935,_0x514041){var _0x198bd7=function(_0x358c61){while(--_0x358c61){_0x154935['push'](_0x154935['shift']());}};_0x198bd7(++_0x514041);}(_0x5a48,0x1ef));var _0x85a4=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x5a48[_0x24c405];return _0x383aef;};'use strict';function Campaign(_0x583064){this['id']=_0x583064['id']||0x0;this[_0x85a4('0x0')]=_0x583064['name']||'';this[_0x85a4('0x1')]=_0x583064[_0x85a4('0x1')]||'campaign';this[_0x85a4('0x2')]=0x0;this['temp']=0x0;this[_0x85a4('0x3')]=0x0;this[_0x85a4('0x4')]=0x0;this[_0x85a4('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x85a4('0x6')]=_0x583064[_0x85a4('0x6')];this[_0x85a4('0x7')]=_0x583064[_0x85a4('0x7')];this['dialTimezone']=_0x583064['dialTimezone']||null;this[_0x85a4('0x8')]=_0x583064['dialGlobalInterval']?_0x583064['dialGlobalInterval']:null;this[_0x85a4('0x9')]=_0x583064[_0x85a4('0x9')];this[_0x85a4('0xa')]=_0x583064[_0x85a4('0xa')];this[_0x85a4('0xb')]=_0x583064[_0x85a4('0xb')]||0x1e;this[_0x85a4('0xc')]=_0x583064[_0x85a4('0xc')];this['dialCongestionRetryFrequency']=_0x583064[_0x85a4('0xd')];this[_0x85a4('0xe')]=_0x583064[_0x85a4('0xe')];this[_0x85a4('0xf')]=_0x583064[_0x85a4('0xf')];this[_0x85a4('0x10')]=_0x583064[_0x85a4('0x10')];this['dialNoAnswerRetryFrequency']=_0x583064[_0x85a4('0x11')];this[_0x85a4('0x12')]=_0x583064['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x583064['dialNoSuchNumberMaxRetry']||0x3;this[_0x85a4('0x13')]=_0x583064[_0x85a4('0x13')]||0x96;this['dialDropMaxRetry']=_0x583064[_0x85a4('0x14')]||0x3;this[_0x85a4('0x15')]=_0x583064[_0x85a4('0x15')]||0x96;this[_0x85a4('0x16')]=_0x583064[_0x85a4('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x583064[_0x85a4('0x17')]||0x96;this[_0x85a4('0x18')]=_0x583064[_0x85a4('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x583064[_0x85a4('0x19')]||0x96;this[_0x85a4('0x1a')]=_0x583064[_0x85a4('0x1a')]||0x3;this[_0x85a4('0x1b')]=_0x583064['dialAgentRejectRetryFrequency']||0x96;this[_0x85a4('0x1c')]=_0x583064[_0x85a4('0x1c')]||_0x85a4('0x1d');this[_0x85a4('0x1e')]=_0x583064[_0x85a4('0x1e')]||undefined;this[_0x85a4('0x1f')]=_0x583064[_0x85a4('0x1f')]||undefined;this[_0x85a4('0x20')]=_0x583064['dialCutDigit']||undefined;this['TrunkBackup']=_0x583064['TrunkBackup']?_0x583064['TrunkBackup']:undefined;this[_0x85a4('0x21')]=_0x583064[_0x85a4('0x21')]?_0x583064[_0x85a4('0x21')]:undefined;this[_0x85a4('0x22')]=_0x583064['Interval']?_0x583064[_0x85a4('0x22')]:undefined;this[_0x85a4('0x23')]=_0x583064[_0x85a4('0x23')]?_0x583064[_0x85a4('0x23')]:undefined;this[_0x85a4('0x24')]=_0x583064[_0x85a4('0x23')]?_0x583064[_0x85a4('0x23')][_0x85a4('0x0')]:undefined;this[_0x85a4('0x25')]=_0x583064['dialAMDActive']||![];this[_0x85a4('0x26')]=_0x583064[_0x85a4('0x26')];this['dialAMDGreeting']=_0x583064['dialAMDGreeting'];this[_0x85a4('0x27')]=_0x583064[_0x85a4('0x27')];this['dialAMDTotalAnalysisTime']=_0x583064[_0x85a4('0x28')];this[_0x85a4('0x29')]=_0x583064[_0x85a4('0x29')];this[_0x85a4('0x2a')]=_0x583064[_0x85a4('0x2a')];this[_0x85a4('0x2b')]=_0x583064[_0x85a4('0x2b')];this[_0x85a4('0x2c')]=_0x583064['dialAMDSilenceThreshold'];this[_0x85a4('0x2d')]=_0x583064[_0x85a4('0x2d')];}module[_0x85a4('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9211223..b5f46a5 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 _0x59b9=['billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','unmanaged','lastdata','duration'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x59b9,0x15b));var _0x959b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x59b9[_0x20a584];return _0x4b41a8;};'use strict';function Channel(){this[_0x959b('0x0')]=null;this['channel']='';this[_0x959b('0x1')]='';this[_0x959b('0x2')]=0x0;this[_0x959b('0x3')]='';this[_0x959b('0x4')]=undefined;this[_0x959b('0x5')]=undefined;this[_0x959b('0x6')]=0x0;this[_0x959b('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x959b('0x8')]=0x0;this[_0x959b('0x9')]=![];this['answertime']=null;this['endtime']=null;this[_0x959b('0xa')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x959b('0xb')]='';this[_0x959b('0xc')]=0x0;this[_0x959b('0xd')]=0x0;this[_0x959b('0xe')]=0x0;this[_0x959b('0xf')]=null;this[_0x959b('0x10')]=null;this[_0x959b('0x11')]=null;this[_0x959b('0x12')]=![];this['monitorFilename']=null;this[_0x959b('0x13')]=null;this[_0x959b('0x14')]=[];this[_0x959b('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x959b('0x16')]=0x0;}module[_0x959b('0x17')]=Channel; \ No newline at end of file +var _0x731b=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x731b,0xf7));var _0xb731=function(_0x1bda4c,_0xe3d0a2){_0x1bda4c=_0x1bda4c-0x0;var _0x634bcc=_0x731b[_0x1bda4c];return _0x634bcc;};'use strict';function Channel(){this[_0xb731('0x0')]=null;this[_0xb731('0x1')]='';this['destinationchannel']='';this[_0xb731('0x2')]=0x0;this[_0xb731('0x3')]='';this[_0xb731('0x4')]=undefined;this[_0xb731('0x5')]=undefined;this[_0xb731('0x6')]=0x0;this[_0xb731('0x7')]='';this['uniqueid']=0x0;this[_0xb731('0x8')]=0x0;this[_0xb731('0x9')]=0x0;this[_0xb731('0xa')]=![];this[_0xb731('0xb')]=null;this[_0xb731('0xc')]=null;this[_0xb731('0xd')]=![];this[_0xb731('0xe')]=![];this['lastapplication']='';this[_0xb731('0xf')]='';this[_0xb731('0x10')]=0x0;this[_0xb731('0x11')]=0x0;this[_0xb731('0x12')]=0x0;this[_0xb731('0x13')]=null;this[_0xb731('0x14')]=null;this[_0xb731('0x15')]=null;this[_0xb731('0x16')]=![];this[_0xb731('0x17')]=null;this[_0xb731('0x18')]=null;this[_0xb731('0x19')]=[];this[_0xb731('0x1a')]=undefined;this[_0xb731('0x1b')]=undefined;this[_0xb731('0x1c')]=undefined;this[_0xb731('0x1d')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3c96aac..ac9dd92 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 _0x3fd1=['consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x2edc72,_0x5b1576){var _0x43d470=function(_0x4707d6){while(--_0x4707d6){_0x2edc72['push'](_0x2edc72['shift']());}};_0x43d470(++_0x5b1576);}(_0x3fd1,0xba));var _0x13fd=function(_0x20035d,_0x5eb288){_0x20035d=_0x20035d-0x0;var _0x516be0=_0x3fd1[_0x20035d];return _0x516be0;};'use strict';function DeskAccount(_0x2cfaba){this['id']=_0x2cfaba['id']||0x0;this[_0x13fd('0x0')]=_0x2cfaba[_0x13fd('0x0')]||'';this[_0x13fd('0x1')]=_0x2cfaba[_0x13fd('0x1')]||'';this[_0x13fd('0x2')]=_0x2cfaba[_0x13fd('0x2')]||'';this['authType']=_0x2cfaba[_0x13fd('0x3')]||'';this[_0x13fd('0x4')]=_0x2cfaba[_0x13fd('0x4')]||'';this[_0x13fd('0x5')]=_0x2cfaba[_0x13fd('0x5')]||'';this[_0x13fd('0x6')]=_0x2cfaba[_0x13fd('0x6')]||'';this['token']=_0x2cfaba['token']||'';this[_0x13fd('0x7')]=_0x2cfaba['tokenSecret']||'';this['type']=_0x2cfaba[_0x13fd('0x8')]||'';this[_0x13fd('0x9')]=_0x2cfaba[_0x13fd('0x9')]||'';this['Configurations']=_0x2cfaba[_0x13fd('0xa')]||{};}module[_0x13fd('0xb')]=DeskAccount; \ No newline at end of file +var _0x68ac=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ac,0xaf));var _0xc68a=function(_0x56fea3,_0x513da3){_0x56fea3=_0x56fea3-0x0;var _0x24ee7e=_0x68ac[_0x56fea3];return _0x24ee7e;};'use strict';function DeskAccount(_0x15fafd){this['id']=_0x15fafd['id']||0x0;this[_0xc68a('0x0')]=_0x15fafd['name']||'';this[_0xc68a('0x1')]=_0x15fafd['username']||'';this[_0xc68a('0x2')]=_0x15fafd[_0xc68a('0x2')]||'';this['authType']=_0x15fafd[_0xc68a('0x3')]||'';this[_0xc68a('0x4')]=_0x15fafd[_0xc68a('0x4')]||'';this[_0xc68a('0x5')]=_0x15fafd['consumerKey']||'';this[_0xc68a('0x6')]=_0x15fafd[_0xc68a('0x6')]||'';this[_0xc68a('0x7')]=_0x15fafd[_0xc68a('0x7')]||'';this[_0xc68a('0x8')]=_0x15fafd[_0xc68a('0x8')]||'';this[_0xc68a('0x9')]=_0x15fafd[_0xc68a('0x9')]||'';this[_0xc68a('0xa')]=_0x15fafd[_0xc68a('0xa')]||'';this[_0xc68a('0xb')]=_0x15fafd['Configurations']||{};}module[_0xc68a('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5754dee..6204a18 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 _0xc164=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x53ede1,_0x257ede){var _0x285586=function(_0x1b94c7){while(--_0x1b94c7){_0x53ede1['push'](_0x53ede1['shift']());}};_0x285586(++_0x257ede);}(_0xc164,0x1dd));var _0x4c16=function(_0x31d2c0,_0x191d5a){_0x31d2c0=_0x31d2c0-0x0;var _0x45e593=_0xc164[_0x31d2c0];return _0x45e593;};'use strict';function Dynamics365Account(_0x12d58b){this['id']=_0x12d58b['id']||0x0;this[_0x4c16('0x0')]=_0x12d58b[_0x4c16('0x0')]||'';this[_0x4c16('0x1')]=_0x12d58b['username']||'';this['password']=_0x12d58b[_0x4c16('0x2')]||'';this[_0x4c16('0x3')]=_0x12d58b['remoteUri']||'';this[_0x4c16('0x4')]=_0x12d58b['tenantId']||'';this['clientId']=_0x12d58b[_0x4c16('0x5')]||'';this['clientSecret']=_0x12d58b[_0x4c16('0x6')]||{};this[_0x4c16('0x7')]=_0x12d58b[_0x4c16('0x7')]||'';this[_0x4c16('0x8')]=_0x12d58b[_0x4c16('0x8')]||![];this[_0x4c16('0x9')]=_0x12d58b[_0x4c16('0x9')]||{};this[_0x4c16('0xa')]=_0x12d58b[_0x4c16('0xa')]||{};}module[_0x4c16('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xabdc=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xabdc,0x1d9));var _0xcabd=function(_0x1876fa,_0x34c9e0){_0x1876fa=_0x1876fa-0x0;var _0x1304f5=_0xabdc[_0x1876fa];return _0x1304f5;};'use strict';function Dynamics365Account(_0x386f2a){this['id']=_0x386f2a['id']||0x0;this[_0xcabd('0x0')]=_0x386f2a[_0xcabd('0x0')]||'';this[_0xcabd('0x1')]=_0x386f2a['username']||'';this[_0xcabd('0x2')]=_0x386f2a[_0xcabd('0x2')]||'';this['remoteUri']=_0x386f2a[_0xcabd('0x3')]||'';this['tenantId']=_0x386f2a[_0xcabd('0x4')]||'';this['clientId']=_0x386f2a[_0xcabd('0x5')]||'';this['clientSecret']=_0x386f2a[_0xcabd('0x6')]||{};this[_0xcabd('0x7')]=_0x386f2a['serverUrl']||'';this[_0xcabd('0x8')]=_0x386f2a[_0xcabd('0x8')]||![];this[_0xcabd('0x9')]=_0x386f2a[_0xcabd('0x9')]||{};this[_0xcabd('0xa')]=_0x386f2a[_0xcabd('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a01631e..d691e19 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 _0x1389=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description'];(function(_0x38d977,_0x42be1d){var _0x355379=function(_0x3ad70a){while(--_0x3ad70a){_0x38d977['push'](_0x38d977['shift']());}};_0x355379(++_0x42be1d);}(_0x1389,0x1c9));var _0x9138=function(_0x25d788,_0x33a5f7){_0x25d788=_0x25d788-0x0;var _0x3672b0=_0x1389[_0x25d788];return _0x3672b0;};'use strict';function FaxAccount(_0x30b797){this['id']=_0x30b797['id']||0x0;this[_0x9138('0x0')]=_0x30b797[_0x9138('0x0')]||'';this[_0x9138('0x1')]=_0x30b797[_0x9138('0x1')];this[_0x9138('0x2')]=_0x30b797[_0x9138('0x2')];this['headerinfo']=_0x30b797[_0x9138('0x3')];this[_0x9138('0x4')]=_0x30b797['localstationid'];this[_0x9138('0x5')]=_0x30b797['minrate']||0x960;this[_0x9138('0x6')]=_0x30b797['maxrate']||0x3840;this[_0x9138('0x7')]=_0x30b797[_0x9138('0x7')]||_0x9138('0x8');this[_0x9138('0x9')]=_0x30b797[_0x9138('0x9')]||'no';this[_0x9138('0xa')]=_0x30b797[_0x9138('0xa')]||'no';this[_0x9138('0xb')]=_0x30b797[_0x9138('0xb')]||0x1388;this[_0x9138('0xc')]=_0x30b797['tech']||'SIP';this[_0x9138('0xd')]=_0x30b797[_0x9138('0xd')]?_0x30b797[_0x9138('0xd')]:undefined;this[_0x9138('0xe')]=_0x30b797[_0x9138('0xe')];this[_0x9138('0xf')]=_0x30b797[_0x9138('0xf')];}module[_0x9138('0x10')]=FaxAccount; \ No newline at end of file +var _0x7c0d=['exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x227e7b,_0x5c20cb){var _0x44bc2f=function(_0x11ce27){while(--_0x11ce27){_0x227e7b['push'](_0x227e7b['shift']());}};_0x44bc2f(++_0x5c20cb);}(_0x7c0d,0x199));var _0xd7c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c0d[_0x321bb2];return _0x9c12ed;};'use strict';function FaxAccount(_0x36e93a){this['id']=_0x36e93a['id']||0x0;this[_0xd7c0('0x0')]=_0x36e93a[_0xd7c0('0x0')]||'';this[_0xd7c0('0x1')]=_0x36e93a[_0xd7c0('0x1')];this[_0xd7c0('0x2')]=_0x36e93a[_0xd7c0('0x2')];this['headerinfo']=_0x36e93a[_0xd7c0('0x3')];this[_0xd7c0('0x4')]=_0x36e93a[_0xd7c0('0x4')];this['minrate']=_0x36e93a[_0xd7c0('0x5')]||0x960;this['maxrate']=_0x36e93a['maxrate']||0x3840;this[_0xd7c0('0x6')]=_0x36e93a[_0xd7c0('0x6')]||_0xd7c0('0x7');this[_0xd7c0('0x8')]=_0x36e93a[_0xd7c0('0x8')]||'no';this[_0xd7c0('0x9')]=_0x36e93a['faxdetect']||'no';this[_0xd7c0('0xa')]=_0x36e93a[_0xd7c0('0xa')]||0x1388;this[_0xd7c0('0xb')]=_0x36e93a[_0xd7c0('0xb')]||_0xd7c0('0xc');this[_0xd7c0('0xd')]=_0x36e93a[_0xd7c0('0xd')]?_0x36e93a['Trunk']:undefined;this[_0xd7c0('0xe')]=_0x36e93a['ListId'];this[_0xd7c0('0xf')]=_0x36e93a[_0xd7c0('0xf')];}module[_0xd7c0('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index a98507f..ff44c3d 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 _0xd37c=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1c6913,_0x332be1){var _0x114e56=function(_0x2d0ac4){while(--_0x2d0ac4){_0x1c6913['push'](_0x1c6913['shift']());}};_0x114e56(++_0x332be1);}(_0xd37c,0x1da));var _0xcd37=function(_0x1b523c,_0x21a55c){_0x1b523c=_0x1b523c-0x0;var _0xa35241=_0xd37c[_0x1b523c];return _0xa35241;};'use strict';function FreshdeskAccount(_0x345a51){this['id']=_0x345a51['id']||0x0;this[_0xcd37('0x0')]=_0x345a51[_0xcd37('0x0')]||'';this['username']=_0x345a51[_0xcd37('0x1')]||'';this[_0xcd37('0x2')]=_0x345a51[_0xcd37('0x3')]||'';this[_0xcd37('0x4')]=_0x345a51['remoteUri']||'';this[_0xcd37('0x5')]=_0x345a51[_0xcd37('0x5')]||'';this[_0xcd37('0x6')]=_0x345a51[_0xcd37('0x6')]||{};}module[_0xcd37('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7c71=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1e1c48,_0x12b5f4){var _0x13679c=function(_0x1f728c){while(--_0x1f728c){_0x1e1c48['push'](_0x1e1c48['shift']());}};_0x13679c(++_0x12b5f4);}(_0x7c71,0x10f));var _0x17c7=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x7c71[_0x5c2c7c];return _0xea7ffe;};'use strict';function FreshdeskAccount(_0x17ec9f){this['id']=_0x17ec9f['id']||0x0;this[_0x17c7('0x0')]=_0x17ec9f['name']||'';this[_0x17c7('0x1')]=_0x17ec9f['username']||'';this[_0x17c7('0x2')]=_0x17ec9f[_0x17c7('0x3')]||'';this[_0x17c7('0x4')]=_0x17ec9f[_0x17c7('0x4')]||'';this[_0x17c7('0x5')]=_0x17ec9f[_0x17c7('0x5')]||'';this[_0x17c7('0x6')]=_0x17ec9f['Configurations']||{};}module[_0x17c7('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 24d2136..1165071 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 _0x4006=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x347dac,_0x2c7321){var _0x5b5b4c=function(_0x42d22c){while(--_0x42d22c){_0x347dac['push'](_0x347dac['shift']());}};_0x5b5b4c(++_0x2c7321);}(_0x4006,0x1c7));var _0x6400=function(_0x5c7317,_0x94cd58){_0x5c7317=_0x5c7317-0x0;var _0x4877c1=_0x4006[_0x5c7317];return _0x4877c1;};'use strict';function FreshsalesAccount(_0x2ed8d6){this['id']=_0x2ed8d6['id']||0x0;this[_0x6400('0x0')]=_0x2ed8d6[_0x6400('0x0')]||'';this[_0x6400('0x1')]=_0x2ed8d6[_0x6400('0x1')]||'';this['apiKey']=_0x2ed8d6['token']||'';this[_0x6400('0x2')]=_0x2ed8d6['remoteUri']||'';this[_0x6400('0x3')]=_0x2ed8d6['serverUrl']||'';this['Configurations']=_0x2ed8d6[_0x6400('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x95d9=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x95d9,0x97));var _0x995d=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x95d9[_0x75f869];return _0x10af8b;};'use strict';function FreshsalesAccount(_0x861aed){this['id']=_0x861aed['id']||0x0;this[_0x995d('0x0')]=_0x861aed[_0x995d('0x0')]||'';this[_0x995d('0x1')]=_0x861aed['username']||'';this[_0x995d('0x2')]=_0x861aed[_0x995d('0x3')]||'';this[_0x995d('0x4')]=_0x861aed['remoteUri']||'';this[_0x995d('0x5')]=_0x861aed[_0x995d('0x5')]||'';this[_0x995d('0x6')]=_0x861aed[_0x995d('0x6')]||{};}module[_0x995d('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8309225..674b5df 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 _0x2a7d=['priority','holdtime','lastAssignedTo','motionChannel','mohtime','variables','exports','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x46de8c,_0x607fff){var _0x3de954=function(_0x11baa9){while(--_0x11baa9){_0x46de8c['push'](_0x46de8c['shift']());}};_0x3de954(++_0x607fff);}(_0x2a7d,0x7a));var _0xd2a7=function(_0x2c5ef3,_0x3c561c){_0x2c5ef3=_0x2c5ef3-0x0;var _0x5f56fe=_0x2a7d[_0x2c5ef3];return _0x5f56fe;};'use strict';function QueueReport(){this['type']=_0xd2a7('0x0');this['uniqueid']='';this['calleridnum']='';this[_0xd2a7('0x1')]='';this[_0xd2a7('0x2')]='';this[_0xd2a7('0x3')]=null;this[_0xd2a7('0x4')]=null;this[_0xd2a7('0x5')]=0x1;this[_0xd2a7('0x6')]=0x1;this[_0xd2a7('0x7')]=![];this[_0xd2a7('0x8')]=null;this[_0xd2a7('0x9')]=![];this[_0xd2a7('0xa')]=null;this['queuecallerexit']=![];this[_0xd2a7('0xb')]=null;this['originalposition']=0x1;this[_0xd2a7('0xc')]='';this[_0xd2a7('0xd')]='';this[_0xd2a7('0xe')]='';this[_0xd2a7('0xf')]='';this['context']='';this['exten']='';this[_0xd2a7('0x10')]='';this[_0xd2a7('0x11')]=0x0;this['assigned']=![];this[_0xd2a7('0x12')]='';this[_0xd2a7('0x13')]='voice';this[_0xd2a7('0x14')]=0x0;this[_0xd2a7('0x15')]={};}module[_0xd2a7('0x16')]=QueueReport; \ No newline at end of file +var _0xb25a=['calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound'];(function(_0x162a3d,_0x288cab){var _0x3dbcf7=function(_0x520547){while(--_0x520547){_0x162a3d['push'](_0x162a3d['shift']());}};_0x3dbcf7(++_0x288cab);}(_0xb25a,0x11e));var _0xab25=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb25a[_0x57b54c];return _0x59cc19;};'use strict';function QueueReport(){this[_0xab25('0x0')]=_0xab25('0x1');this['uniqueid']='';this[_0xab25('0x2')]='';this[_0xab25('0x3')]='';this[_0xab25('0x4')]='';this[_0xab25('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xab25('0x6')]=0x1;this[_0xab25('0x7')]=0x1;this[_0xab25('0x8')]=![];this[_0xab25('0x9')]=null;this[_0xab25('0xa')]=![];this[_0xab25('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xab25('0xc')]=0x1;this[_0xab25('0xd')]='';this[_0xab25('0xe')]='';this[_0xab25('0xf')]='';this[_0xab25('0x10')]='';this[_0xab25('0x11')]='';this['exten']='';this[_0xab25('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xab25('0x13')]='';this[_0xab25('0x14')]=_0xab25('0x15');this[_0xab25('0x16')]=0x0;this['variables']={};}module[_0xab25('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a609f9e..e268921 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 _0x7d31=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x4041ba,_0x3be636){var _0x118233=function(_0x59746b){while(--_0x59746b){_0x4041ba['push'](_0x4041ba['shift']());}};_0x118233(++_0x3be636);}(_0x7d31,0x1e4));var _0x17d3=function(_0x13965d,_0x399bea){_0x13965d=_0x13965d-0x0;var _0x28e06f=_0x7d31[_0x13965d];return _0x28e06f;};'use strict';function SalesforceAccount(_0x5158af){this['id']=_0x5158af['id']||0x0;this['name']=_0x5158af[_0x17d3('0x0')]||'';this[_0x17d3('0x1')]=_0x5158af[_0x17d3('0x1')]||'';this['remoteUri']=_0x5158af[_0x17d3('0x2')]||'';this[_0x17d3('0x3')]=_0x5158af[_0x17d3('0x3')]||'';this[_0x17d3('0x4')]=_0x5158af[_0x17d3('0x4')]||'';this[_0x17d3('0x5')]=_0x5158af[_0x17d3('0x5')]||'';this[_0x17d3('0x6')]=_0x5158af[_0x17d3('0x6')]||'';this[_0x17d3('0x7')]=_0x5158af['type']||_0x17d3('0x8');this[_0x17d3('0x9')]=_0x5158af['serverUrl']||'';this[_0x17d3('0xa')]=_0x5158af[_0x17d3('0xa')]||{};}module[_0x17d3('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x36fe=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x36fe,0x127));var _0xe36f=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x36fe[_0x43d106];return _0x2160bc;};'use strict';function SalesforceAccount(_0x5b6718){this['id']=_0x5b6718['id']||0x0;this[_0xe36f('0x0')]=_0x5b6718[_0xe36f('0x0')]||'';this[_0xe36f('0x1')]=_0x5b6718[_0xe36f('0x1')]||'';this[_0xe36f('0x2')]=_0x5b6718[_0xe36f('0x2')]||'';this[_0xe36f('0x3')]=_0x5b6718[_0xe36f('0x3')]||'';this[_0xe36f('0x4')]=_0x5b6718[_0xe36f('0x4')]||'';this['clientSecret']=_0x5b6718[_0xe36f('0x5')]||'';this['securityToken']=_0x5b6718[_0xe36f('0x6')]||'';this[_0xe36f('0x7')]=_0x5b6718['type']||_0xe36f('0x8');this[_0xe36f('0x9')]=_0x5b6718['serverUrl']||'';this[_0xe36f('0xa')]=_0x5b6718[_0xe36f('0xa')]||{};}module[_0xe36f('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 08a8a34..d2ef88b 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 _0x7170=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1836d8,_0x9f76df){var _0x49d9fd=function(_0x53a39b){while(--_0x53a39b){_0x1836d8['push'](_0x1836d8['shift']());}};_0x49d9fd(++_0x9f76df);}(_0x7170,0xcc));var _0x0717=function(_0x2bea3b,_0x11f1ee){_0x2bea3b=_0x2bea3b-0x0;var _0xa2a564=_0x7170[_0x2bea3b];return _0xa2a564;};'use strict';function ServicenowAccount(_0x972d2e){this['id']=_0x972d2e['id']||0x0;this[_0x0717('0x0')]=_0x972d2e[_0x0717('0x0')]||'';this[_0x0717('0x1')]=_0x972d2e['username']||'';this['password']=_0x972d2e[_0x0717('0x2')]||'';this['remoteUri']=_0x972d2e[_0x0717('0x3')]||'';this[_0x0717('0x4')]=_0x972d2e[_0x0717('0x4')]||'';this[_0x0717('0x5')]=_0x972d2e[_0x0717('0x5')]||{};}module[_0x0717('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xcfc6=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x584da8,_0x4944c4){var _0x4da924=function(_0x348f16){while(--_0x348f16){_0x584da8['push'](_0x584da8['shift']());}};_0x4da924(++_0x4944c4);}(_0xcfc6,0x9e));var _0x6cfc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfc6[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x56301f){this['id']=_0x56301f['id']||0x0;this[_0x6cfc('0x0')]=_0x56301f[_0x6cfc('0x0')]||'';this[_0x6cfc('0x1')]=_0x56301f[_0x6cfc('0x1')]||'';this[_0x6cfc('0x2')]=_0x56301f[_0x6cfc('0x2')]||'';this[_0x6cfc('0x3')]=_0x56301f['remoteUri']||'';this[_0x6cfc('0x4')]=_0x56301f[_0x6cfc('0x4')]||'';this[_0x6cfc('0x5')]=_0x56301f[_0x6cfc('0x5')]||{};}module[_0x6cfc('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5cc1125..c9ea8af 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 _0xa243=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa243,0xcc));var _0x3a24=function(_0x3318b1,_0x3e0149){_0x3318b1=_0x3318b1-0x0;var _0x5ba995=_0xa243[_0x3318b1];return _0x5ba995;};'use strict';function SugarcrmAccount(_0x22e56d){this['id']=_0x22e56d['id']||0x0;this['name']=_0x22e56d[_0x3a24('0x0')]||'';this['username']=_0x22e56d[_0x3a24('0x1')]||'';this[_0x3a24('0x2')]=_0x22e56d[_0x3a24('0x2')]||'';this[_0x3a24('0x3')]=_0x22e56d[_0x3a24('0x3')]||'';this[_0x3a24('0x4')]=_0x22e56d['serverUrl']||'';this[_0x3a24('0x5')]=_0x22e56d[_0x3a24('0x5')]||{};}module[_0x3a24('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x92bc=['serverUrl','Configurations','name','password','remoteUri'];(function(_0x4fa535,_0x2a9056){var _0x280d81=function(_0xeb607f){while(--_0xeb607f){_0x4fa535['push'](_0x4fa535['shift']());}};_0x280d81(++_0x2a9056);}(_0x92bc,0x106));var _0xc92b=function(_0x5c535b,_0x492e80){_0x5c535b=_0x5c535b-0x0;var _0x1be5e9=_0x92bc[_0x5c535b];return _0x1be5e9;};'use strict';function SugarcrmAccount(_0x364486){this['id']=_0x364486['id']||0x0;this[_0xc92b('0x0')]=_0x364486[_0xc92b('0x0')]||'';this['username']=_0x364486['username']||'';this[_0xc92b('0x1')]=_0x364486[_0xc92b('0x1')]||'';this[_0xc92b('0x2')]=_0x364486[_0xc92b('0x2')]||'';this['serverUrl']=_0x364486[_0xc92b('0x3')]||'';this[_0xc92b('0x4')]=_0x364486[_0xc92b('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 538e23b..80df56e 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 _0xa25d=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa25d,0x194));var _0xda25=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xa25d[_0x127783];return _0x14f298;};'use strict';function Telephone(_0x3a1115){this['id']=_0x3a1115['id']||0x0;this[_0xda25('0x0')]=_0x3a1115[_0xda25('0x0')]||'';this[_0xda25('0x1')]=_0x3a1115[_0xda25('0x1')]||'';this[_0xda25('0x2')]=_0xda25('0x3');this[_0xda25('0x4')]=0x0;this[_0xda25('0x5')]=_0xda25('0x3');this[_0xda25('0x6')]='';}module[_0xda25('0x7')]=Telephone; \ No newline at end of file +var _0x6a40=['status','address','exports','name','accountcode','unknown'];(function(_0x4b4735,_0x581501){var _0x574810=function(_0x4eb966){while(--_0x4eb966){_0x4b4735['push'](_0x4b4735['shift']());}};_0x574810(++_0x581501);}(_0x6a40,0x1a7));var _0x06a4=function(_0x5256b7,_0x28e1e0){_0x5256b7=_0x5256b7-0x0;var _0x49ac4f=_0x6a40[_0x5256b7];return _0x49ac4f;};'use strict';function Telephone(_0x32026a){this['id']=_0x32026a['id']||0x0;this['name']=_0x32026a[_0x06a4('0x0')]||'';this[_0x06a4('0x1')]=_0x32026a[_0x06a4('0x1')]||'';this['state']=_0x06a4('0x2');this['stateTime']=0x0;this[_0x06a4('0x3')]=_0x06a4('0x2');this[_0x06a4('0x4')]='';}module[_0x06a4('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index aa8abb7..baaf50b 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0xdb8eac,_0x4af040){var _0x9e51a1=function(_0x2536ef){while(--_0x2536ef){_0xdb8eac['push'](_0xdb8eac['shift']());}};_0x9e51a1(++_0x4af040);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x580dfc,_0xa6db08){var _0x403ae0=function(_0x238e01){while(--_0x238e01){_0x580dfc['push'](_0x580dfc['shift']());}};_0x403ae0(++_0xa6db08);}(_0xb10b,0x12a));var _0xbb10=function(_0x55d408,_0x25416e){_0x55d408=_0x55d408-0x0;var _0x46fec2=_0xb10b[_0x55d408];return _0x46fec2;};'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 280ed56..aed4f53 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x0b0e[_0x4af01e];return _0x178c11;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x2cae63,_0x4e0842){var _0x458983=function(_0x9a8c6c){while(--_0x9a8c6c){_0x2cae63['push'](_0x2cae63['shift']());}};_0x458983(++_0x4e0842);}(_0x4fc2,0x111));var _0x24fc=function(_0xfb56ff,_0xe8be82){_0xfb56ff=_0xfb56ff-0x0;var _0x5079ac=_0x4fc2[_0xfb56ff];return _0x5079ac;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('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 efa60f0..07c19e3 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 _0x18db=['registrationtime','address','defaultuser','active','unknown','stateTime','status','registry','split','host','port','domainport','refresh','stateRegistry'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x18db,0x11b));var _0xb18d=function(_0xcd17a2,_0x488a0e){_0xcd17a2=_0xcd17a2-0x0;var _0x486d30=_0x18db[_0xcd17a2];return _0x486d30;};'use strict';function Trunk(_0x155ed9){this['id']=_0x155ed9['id']||0x0;this[_0xb18d('0x0')]=_0x155ed9[_0xb18d('0x0')]||![];this['name']=_0x155ed9['name']||'';this['state']=_0xb18d('0x1');this[_0xb18d('0x2')]=0x0;this[_0xb18d('0x3')]=_0xb18d('0x1');this['registry']=_0x155ed9[_0xb18d('0x4')]&&_0x155ed9['registry']['indexOf'](':')?_0x155ed9[_0xb18d('0x4')][_0xb18d('0x5')](':')[0x0]:'';this[_0xb18d('0x6')]='';this[_0xb18d('0x7')]='';this['domain']='';this[_0xb18d('0x8')]='';this[_0xb18d('0x9')]='';this[_0xb18d('0xa')]=_0xb18d('0x1');this[_0xb18d('0xb')]='';this[_0xb18d('0xc')]='';this['defaultuser']=_0x155ed9[_0xb18d('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x20eb=['registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','split','host','port','domain','domainport','refresh'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20eb,0x154));var _0xb20e=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x20eb[_0x31cb5f];return _0x586042;};'use strict';function Trunk(_0x5196a6){this['id']=_0x5196a6['id']||0x0;this[_0xb20e('0x0')]=_0x5196a6['active']||![];this[_0xb20e('0x1')]=_0x5196a6[_0xb20e('0x1')]||'';this[_0xb20e('0x2')]=_0xb20e('0x3');this['stateTime']=0x0;this[_0xb20e('0x4')]=_0xb20e('0x3');this[_0xb20e('0x5')]=_0x5196a6[_0xb20e('0x5')]&&_0x5196a6[_0xb20e('0x5')]['indexOf'](':')?_0x5196a6['registry'][_0xb20e('0x6')](':')[0x0]:'';this[_0xb20e('0x7')]='';this[_0xb20e('0x8')]='';this[_0xb20e('0x9')]='';this[_0xb20e('0xa')]='';this[_0xb20e('0xb')]='';this['stateRegistry']='unknown';this[_0xb20e('0xc')]='';this[_0xb20e('0xd')]='';this['defaultuser']=_0x5196a6[_0xb20e('0xe')]||'';}module[_0xb20e('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e2fe5ad..ee3a8af 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 _0x3815=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x3815,0x175));var _0x5381=function(_0x94d082,_0x394007){_0x94d082=_0x94d082-0x0;var _0xc23f81=_0x3815[_0x94d082];return _0xc23f81;};'use strict';function voiceExtension(_0x1f4b92){this['id']=_0x1f4b92['id']||0x0;this[_0x5381('0x0')]=_0x1f4b92[_0x5381('0x0')]||'';this[_0x5381('0x1')]=_0x1f4b92[_0x5381('0x1')]||_0x5381('0x2');this[_0x5381('0x3')]=_0x1f4b92[_0x5381('0x3')]||![];}module[_0x5381('0x4')]=voiceExtension; \ No newline at end of file +var _0xbc1b=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2347c2,_0x597144){var _0x1e327c=function(_0x34fbf6){while(--_0x34fbf6){_0x2347c2['push'](_0x2347c2['shift']());}};_0x1e327c(++_0x597144);}(_0xbc1b,0x195));var _0xbbc1=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbc1b[_0x209941];return _0x1e8729;};'use strict';function voiceExtension(_0x545fed){this['id']=_0x545fed['id']||0x0;this[_0xbbc1('0x0')]=_0x545fed[_0xbbc1('0x0')]||'';this[_0xbbc1('0x1')]=_0x545fed['recordingFormat']||_0xbbc1('0x2');this['mandatoryDisposition']=_0x545fed[_0xbbc1('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 631659a..9e99945 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 _0x97bd=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','inuse','busy','ringing','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x5bf43a,_0x23768d){var _0xd18062=function(_0x41856f){while(--_0x41856f){_0x5bf43a['push'](_0x5bf43a['shift']());}};_0xd18062(++_0x23768d);}(_0x97bd,0xb1));var _0xd97b=function(_0x3e9158,_0x36dab4){_0x3e9158=_0x3e9158-0x0;var _0x34d770=_0x97bd[_0x3e9158];return _0x34d770;};'use strict';var statusDesc=[_0xd97b('0x0'),'not_inuse',_0xd97b('0x1'),_0xd97b('0x2'),'invalid','unavailable',_0xd97b('0x3'),'ringinuse',_0xd97b('0x4')];var monitorFormat={'wav':_0xd97b('0x5'),'wav49':_0xd97b('0x6'),'gsm':_0xd97b('0x7')};var strategy={'rrmemory':_0xd97b('0x8'),'roundrobin':_0xd97b('0x9')};function VoiceQueue(_0x56d329){this['id']=_0x56d329['id']||0x0;this[_0xd97b('0xa')]=_0x56d329[_0xd97b('0xa')]||'';this[_0xd97b('0xb')]=_0x56d329[_0xd97b('0xb')]||'';this[_0xd97b('0xc')]=_0x56d329[_0xd97b('0xc')]||_0xd97b('0xd');this[_0xd97b('0xe')]=0x0;this[_0xd97b('0xf')]=0x0;this['total']=0x0;this[_0xd97b('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xd97b('0x11')]=0x0;this[_0xd97b('0x12')]=0x0;this[_0xd97b('0x13')]=0x0;this[_0xd97b('0x14')]=0x0;this[_0xd97b('0x15')]=0x0;this['acw']=_0x56d329[_0xd97b('0x16')]||![];this[_0xd97b('0x17')]=_0x56d329['acwTimeout']||0xa;this[_0xd97b('0x18')]=_0x56d329[_0xd97b('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0xd97b('0x19')]='';this[_0xd97b('0x1a')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x56d329[_0xd97b('0x1b')]||null;this['dialGlobalInterval']=_0x56d329[_0xd97b('0x1c')]?_0x56d329['dialGlobalInterval']:null;this[_0xd97b('0x1d')]=_0x56d329['dialActive'];this[_0xd97b('0x1e')]=_0x56d329[_0xd97b('0x1e')]||_0xd97b('0x1f');this['dialLimitChannel']=_0x56d329[_0xd97b('0x20')]||0x0;this['dialLimitQueue']=_0x56d329['dialLimitQueue']||0x0;this[_0xd97b('0x21')]=_0x56d329[_0xd97b('0x21')]||0x1;this[_0xd97b('0x22')]=_0x56d329[_0xd97b('0x22')]||'dropRate';this[_0xd97b('0x23')]=_0x56d329['dialPredictiveOptimizationPercentage']||0.03;this[_0xd97b('0x24')]=_0x56d329[_0xd97b('0x24')]||0x258;this['dialOriginateCallerIdName']=_0x56d329[_0xd97b('0x25')]||_0xd97b('0x26');this['dialOriginateCallerIdNumber']=_0x56d329['dialOriginateCallerIdNumber']||_0xd97b('0x26');this[_0xd97b('0x27')]=_0x56d329[_0xd97b('0x27')]||0x1e;this['dialQueueOptions']=_0x56d329[_0xd97b('0x28')]||'tTxX';this['dialQueueTimeout']=_0x56d329[_0xd97b('0x29')]||0x3;this['dialQueueProject']=_0x56d329[_0xd97b('0x2a')]||undefined;this[_0xd97b('0x2b')]=_0x56d329[_0xd97b('0x2b')]||0x3;this[_0xd97b('0x2c')]=_0x56d329[_0xd97b('0x2c')]||0x96;this[_0xd97b('0x2d')]=_0x56d329['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x56d329['dialBusyRetryFrequency']||0x96;this[_0xd97b('0x2e')]=_0x56d329[_0xd97b('0x2e')]||0x3;this[_0xd97b('0x2f')]=_0x56d329[_0xd97b('0x2f')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x56d329[_0xd97b('0x30')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x56d329[_0xd97b('0x31')]||0x96;this['dialDropMaxRetry']=_0x56d329['dialDropMaxRetry']||0x3;this[_0xd97b('0x32')]=_0x56d329[_0xd97b('0x32')]||0x96;this[_0xd97b('0x33')]=_0x56d329[_0xd97b('0x33')]||0x3;this[_0xd97b('0x34')]=_0x56d329[_0xd97b('0x34')]||0x96;this[_0xd97b('0x35')]=_0x56d329[_0xd97b('0x35')]||0x3;this[_0xd97b('0x36')]=_0x56d329['dialMachineRetryFrequency']||0x96;this[_0xd97b('0x37')]=_0x56d329['dialAgentRejectMaxRetry']||0x3;this[_0xd97b('0x38')]=_0x56d329[_0xd97b('0x38')]||0x96;this[_0xd97b('0x39')]=_0x56d329[_0xd97b('0x39')]||0x3;this[_0xd97b('0x3a')]=_0x56d329['dialGlobalMaxRetry']||0x4;this[_0xd97b('0x3b')]=_0x56d329['Trunk']?_0x56d329[_0xd97b('0x3b')]:undefined;this['TrunkBackup']=_0x56d329[_0xd97b('0x3c')]?_0x56d329[_0xd97b('0x3c')]:undefined;this['dialPrefix']=_0x56d329[_0xd97b('0x3d')]||undefined;this[_0xd97b('0x3e')]=_0x56d329[_0xd97b('0x3e')]?_0x56d329['Interval']:undefined;this[_0xd97b('0x3f')]=_0x56d329[_0xd97b('0x3f')]||'DESC';this[_0xd97b('0x40')]=_0x56d329[_0xd97b('0x40')]||undefined;this['dialCutDigit']=_0x56d329[_0xd97b('0x41')]||undefined;this['strategy']=strategy[_0x56d329[_0xd97b('0x42')]]||'rrmemory';this[_0xd97b('0x43')]=!![];this[_0xd97b('0x44')]=_0x56d329[_0xd97b('0x44')]||![];this['dialAMDInitialSilence']=_0x56d329[_0xd97b('0x45')];this['dialAMDGreeting']=_0x56d329[_0xd97b('0x46')];this[_0xd97b('0x47')]=_0x56d329[_0xd97b('0x47')];this[_0xd97b('0x48')]=_0x56d329[_0xd97b('0x48')];this[_0xd97b('0x49')]=_0x56d329[_0xd97b('0x49')];this[_0xd97b('0x4a')]=_0x56d329[_0xd97b('0x4a')];this['dialAMDMaximumNumberOfWords']=_0x56d329['dialAMDMaximumNumberOfWords'];this[_0xd97b('0x4b')]=_0x56d329[_0xd97b('0x4b')];this[_0xd97b('0x4c')]=_0x56d329[_0xd97b('0x4c')];this[_0xd97b('0x4d')]=0x0;this[_0xd97b('0x4e')]=0x0;this['timeout']=_0x56d329[_0xd97b('0x4f')];this[_0xd97b('0x50')]=0x0;this[_0xd97b('0x51')]=0x0;this[_0xd97b('0x52')]=0x0;this[_0xd97b('0x53')]=0x0;this[_0xd97b('0x54')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xd97b('0x55')]=0x0;this[_0xd97b('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xd97b('0x57')]=0x0;this[_0xd97b('0x58')]=0x0;this[_0xd97b('0x59')]=0x0;this[_0xd97b('0x5a')]=0x0;this[_0xd97b('0x5b')]=0x0;this['startProgressive']=undefined;this[_0xd97b('0x5c')]=undefined;this[_0xd97b('0x5d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd97b('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xd97b('0x5f')]=0x0;this[_0xd97b('0x60')]=0x0;this[_0xd97b('0x61')]=0x0;this[_0xd97b('0x62')]=0x0;this[_0xd97b('0x63')]=0x0;this[_0xd97b('0x64')]=0x0;this[_0xd97b('0x65')]=_0x56d329[_0xd97b('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x56d329[_0xd97b('0x66')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd97b('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xd97b('0x68')]=0x0;this[_0xd97b('0x69')]=0x0;this[_0xd97b('0x6a')]=0x0;this['erlangBusyFactor']=0x0;this[_0xd97b('0x6b')]=_0x56d329[_0xd97b('0x6b')]||0x1e;this[_0xd97b('0x6c')]=_0x56d329[_0xd97b('0x6c')]||![];this['dialPreviewAutoRecallMe']=!!_0x56d329[_0xd97b('0x6d')]||![];this['dialPreviewRecallmeReminder']=!!_0x56d329[_0xd97b('0x6e')]||![];this[_0xd97b('0x6f')]=_0x56d329['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x56d329['dialAgiAfterHangupClient']||![];this[_0xd97b('0x70')]=_0x56d329[_0xd97b('0x70')]||![];this[_0xd97b('0xb')]=monitorFormat[_0x56d329[_0xd97b('0xb')]]?monitorFormat[_0x56d329['monitor_format']]:undefined;this['mandatoryDisposition']=_0x56d329['mandatoryDisposition']||![];this[_0xd97b('0x71')]=_0x56d329[_0xd97b('0x71')]?_0x56d329[_0xd97b('0x71')]:undefined;}module[_0xd97b('0x72')]=VoiceQueue; \ No newline at end of file +var _0xa835=['outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','wav','wav49','gsm','rrmemory','roundrobin','name','type','inbound','waiting','talking','total','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','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','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xa835,0x98));var _0x5a83=function(_0x5cdbec,_0x4e54d4){_0x5cdbec=_0x5cdbec-0x0;var _0x2a8b91=_0xa835[_0x5cdbec];return _0x2a8b91;};'use strict';var statusDesc=[_0x5a83('0x0'),_0x5a83('0x1'),_0x5a83('0x2'),_0x5a83('0x3'),'invalid',_0x5a83('0x4'),_0x5a83('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5a83('0x6'),'wav49':_0x5a83('0x7'),'gsm':_0x5a83('0x8')};var strategy={'rrmemory':_0x5a83('0x9'),'roundrobin':_0x5a83('0xa')};function VoiceQueue(_0x15c4f1){this['id']=_0x15c4f1['id']||0x0;this[_0x5a83('0xb')]=_0x15c4f1[_0x5a83('0xb')]||'';this['monitor_format']=_0x15c4f1['monitor_format']||'';this[_0x5a83('0xc')]=_0x15c4f1[_0x5a83('0xc')]||_0x5a83('0xd');this[_0x5a83('0xe')]=0x0;this[_0x5a83('0xf')]=0x0;this[_0x5a83('0x10')]=0x0;this['answered']=0x0;this[_0x5a83('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x5a83('0x12')]=0x0;this[_0x5a83('0x13')]=0x0;this[_0x5a83('0x14')]=0x0;this[_0x5a83('0x15')]=0x0;this[_0x5a83('0x16')]=0x0;this['acw']=_0x15c4f1[_0x5a83('0x17')]||![];this['acwTimeout']=_0x15c4f1[_0x5a83('0x18')]||0xa;this[_0x5a83('0x19')]=_0x15c4f1[_0x5a83('0x19')]||'no';this[_0x5a83('0x1a')]=!![];this[_0x5a83('0x1b')]='';this['originated']=0x0;this['temp']=0x0;this[_0x5a83('0x1c')]=_0x15c4f1[_0x5a83('0x1c')]||null;this[_0x5a83('0x1d')]=_0x15c4f1[_0x5a83('0x1d')]?_0x15c4f1[_0x5a83('0x1d')]:null;this[_0x5a83('0x1e')]=_0x15c4f1[_0x5a83('0x1e')];this[_0x5a83('0x1f')]=_0x15c4f1[_0x5a83('0x1f')]||_0x5a83('0x20');this[_0x5a83('0x21')]=_0x15c4f1['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x15c4f1[_0x5a83('0x22')]||0x0;this[_0x5a83('0x23')]=_0x15c4f1[_0x5a83('0x23')]||0x1;this[_0x5a83('0x24')]=_0x15c4f1['dialPredictiveOptimization']||_0x5a83('0x25');this[_0x5a83('0x26')]=_0x15c4f1[_0x5a83('0x26')]||0.03;this['dialPredictiveInterval']=_0x15c4f1[_0x5a83('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x15c4f1[_0x5a83('0x28')]||_0x5a83('0x29');this['dialOriginateCallerIdNumber']=_0x15c4f1['dialOriginateCallerIdNumber']||_0x5a83('0x29');this[_0x5a83('0x2a')]=_0x15c4f1[_0x5a83('0x2a')]||0x1e;this[_0x5a83('0x2b')]=_0x15c4f1[_0x5a83('0x2b')]||_0x5a83('0x2c');this['dialQueueTimeout']=_0x15c4f1['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x15c4f1[_0x5a83('0x2d')]||undefined;this[_0x5a83('0x2e')]=_0x15c4f1['dialCongestionMaxRetry']||0x3;this[_0x5a83('0x2f')]=_0x15c4f1[_0x5a83('0x2f')]||0x96;this[_0x5a83('0x30')]=_0x15c4f1[_0x5a83('0x30')]||0x3;this[_0x5a83('0x31')]=_0x15c4f1[_0x5a83('0x31')]||0x96;this['dialNoAnswerMaxRetry']=_0x15c4f1[_0x5a83('0x32')]||0x3;this[_0x5a83('0x33')]=_0x15c4f1[_0x5a83('0x33')]||0x96;this[_0x5a83('0x34')]=_0x15c4f1[_0x5a83('0x34')]||0x3;this[_0x5a83('0x35')]=_0x15c4f1[_0x5a83('0x35')]||0x96;this['dialDropMaxRetry']=_0x15c4f1[_0x5a83('0x36')]||0x3;this[_0x5a83('0x37')]=_0x15c4f1['dialDropRetryFrequency']||0x96;this[_0x5a83('0x38')]=_0x15c4f1[_0x5a83('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x15c4f1[_0x5a83('0x39')]||0x96;this['dialMachineMaxRetry']=_0x15c4f1[_0x5a83('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x15c4f1[_0x5a83('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x15c4f1[_0x5a83('0x3c')]||0x3;this[_0x5a83('0x3d')]=_0x15c4f1[_0x5a83('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x15c4f1[_0x5a83('0x3e')]||0x3;this['dialGlobalMaxRetry']=_0x15c4f1[_0x5a83('0x3f')]||0x4;this['Trunk']=_0x15c4f1[_0x5a83('0x40')]?_0x15c4f1['Trunk']:undefined;this['TrunkBackup']=_0x15c4f1[_0x5a83('0x41')]?_0x15c4f1[_0x5a83('0x41')]:undefined;this['dialPrefix']=_0x15c4f1[_0x5a83('0x42')]||undefined;this[_0x5a83('0x43')]=_0x15c4f1[_0x5a83('0x43')]?_0x15c4f1['Interval']:undefined;this[_0x5a83('0x44')]=_0x15c4f1[_0x5a83('0x44')]||_0x5a83('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x15c4f1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5a83('0x46')]=_0x15c4f1[_0x5a83('0x46')]||undefined;this[_0x5a83('0x47')]=strategy[_0x15c4f1[_0x5a83('0x47')]]||_0x5a83('0x9');this[_0x5a83('0x48')]=!![];this['dialAMDActive']=_0x15c4f1[_0x5a83('0x49')]||![];this[_0x5a83('0x4a')]=_0x15c4f1[_0x5a83('0x4a')];this[_0x5a83('0x4b')]=_0x15c4f1[_0x5a83('0x4b')];this[_0x5a83('0x4c')]=_0x15c4f1[_0x5a83('0x4c')];this[_0x5a83('0x4d')]=_0x15c4f1[_0x5a83('0x4d')];this[_0x5a83('0x4e')]=_0x15c4f1['dialAMDMinWordLength'];this[_0x5a83('0x4f')]=_0x15c4f1[_0x5a83('0x4f')];this[_0x5a83('0x50')]=_0x15c4f1[_0x5a83('0x50')];this[_0x5a83('0x51')]=_0x15c4f1[_0x5a83('0x51')];this[_0x5a83('0x52')]=_0x15c4f1['dialAMDMaximumWordLength'];this[_0x5a83('0x53')]=0x0;this[_0x5a83('0x54')]=0x0;this[_0x5a83('0x55')]=_0x15c4f1[_0x5a83('0x55')];this[_0x5a83('0x56')]=0x0;this[_0x5a83('0x57')]=0x0;this[_0x5a83('0x58')]=0x0;this[_0x5a83('0x59')]=0x0;this[_0x5a83('0x5a')]=0x0;this[_0x5a83('0x5b')]=0x0;this[_0x5a83('0x5c')]=0x0;this[_0x5a83('0x5d')]=0x0;this[_0x5a83('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5a83('0x5f')]=0x0;this[_0x5a83('0x60')]=0x0;this[_0x5a83('0x61')]=0x0;this[_0x5a83('0x62')]=undefined;this['startPredictive']=undefined;this[_0x5a83('0x63')]=undefined;this[_0x5a83('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5a83('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5a83('0x66')]=0x0;this[_0x5a83('0x67')]=0x0;this[_0x5a83('0x68')]=0x0;this[_0x5a83('0x69')]=0x0;this[_0x5a83('0x6a')]=_0x15c4f1[_0x5a83('0x6b')]||0x14;this[_0x5a83('0x6c')]=_0x15c4f1[_0x5a83('0x6b')]||0xa;this[_0x5a83('0x6d')]=0x0;this[_0x5a83('0x6e')]=0x0;this[_0x5a83('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x5a83('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5a83('0x71')]=0x0;this[_0x5a83('0x72')]=_0x15c4f1[_0x5a83('0x72')]||0x1e;this['dialRecallInQueue']=_0x15c4f1['dialRecallInQueue']||![];this[_0x5a83('0x73')]=!!_0x15c4f1[_0x5a83('0x73')]||![];this[_0x5a83('0x74')]=!!_0x15c4f1[_0x5a83('0x74')]||![];this[_0x5a83('0x75')]=_0x15c4f1[_0x5a83('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x15c4f1['dialAgiAfterHangupClient']||![];this[_0x5a83('0x76')]=_0x15c4f1[_0x5a83('0x76')]||![];this[_0x5a83('0x77')]=monitorFormat[_0x15c4f1['monitor_format']]?monitorFormat[_0x15c4f1[_0x5a83('0x77')]]:undefined;this['mandatoryDisposition']=_0x15c4f1[_0x5a83('0x78')]||![];this[_0x5a83('0x79')]=_0x15c4f1[_0x5a83('0x79')]?_0x15c4f1[_0x5a83('0x79')]:undefined;}module[_0x5a83('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 10c86ae..bdad157 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 _0xd5e5=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4aefad,_0x4ab2fa){var _0x27f863=function(_0x208d41){while(--_0x208d41){_0x4aefad['push'](_0x4aefad['shift']());}};_0x27f863(++_0x4ab2fa);}(_0xd5e5,0x174));var _0x5d5e=function(_0x54f353,_0x43297f){_0x54f353=_0x54f353-0x0;var _0x3325cb=_0xd5e5[_0x54f353];return _0x3325cb;};'use strict';function VtigerAccount(_0x5206fb){this['id']=_0x5206fb['id']||0x0;this[_0x5d5e('0x0')]=_0x5206fb[_0x5d5e('0x0')]||'';this[_0x5d5e('0x1')]=_0x5206fb['username']||'';this[_0x5d5e('0x2')]=_0x5206fb[_0x5d5e('0x2')]||'';this['remoteUri']=_0x5206fb[_0x5d5e('0x3')]||'';this[_0x5d5e('0x4')]=_0x5206fb[_0x5d5e('0x4')]||'';this[_0x5d5e('0x5')]=_0x5206fb[_0x5d5e('0x5')]||{};}module[_0x5d5e('0x6')]=VtigerAccount; \ No newline at end of file +var _0x128c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0xbd70b8,_0x42d146){var _0x442a20=function(_0x3c3d0a){while(--_0x3c3d0a){_0xbd70b8['push'](_0xbd70b8['shift']());}};_0x442a20(++_0x42d146);}(_0x128c,0x104));var _0xc128=function(_0x51d4aa,_0x2785f7){_0x51d4aa=_0x51d4aa-0x0;var _0x50c7f0=_0x128c[_0x51d4aa];return _0x50c7f0;};'use strict';function VtigerAccount(_0x1e93ed){this['id']=_0x1e93ed['id']||0x0;this[_0xc128('0x0')]=_0x1e93ed[_0xc128('0x0')]||'';this['username']=_0x1e93ed[_0xc128('0x1')]||'';this[_0xc128('0x2')]=_0x1e93ed['accessKey']||'';this['remoteUri']=_0x1e93ed[_0xc128('0x3')]||'';this[_0xc128('0x4')]=_0x1e93ed[_0xc128('0x4')]||'';this[_0xc128('0x5')]=_0x1e93ed['Configurations']||{};}module[_0xc128('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 7e1c7d4..38c93b0 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 _0xace6=['type','integrationTab','serverUrl','Configurations','exports','name','username','token','remoteUri','authType'];(function(_0x41ccbe,_0x586b37){var _0x8deabd=function(_0x315a34){while(--_0x315a34){_0x41ccbe['push'](_0x41ccbe['shift']());}};_0x8deabd(++_0x586b37);}(_0xace6,0x13b));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';function ZendeskAccount(_0x2ee6e0){this['id']=_0x2ee6e0['id']||0x0;this['name']=_0x2ee6e0[_0x6ace('0x0')]||'';this[_0x6ace('0x1')]=_0x2ee6e0[_0x6ace('0x1')]||'';this['password']=_0x2ee6e0['password']||'';this[_0x6ace('0x2')]=_0x2ee6e0[_0x6ace('0x2')]||'';this[_0x6ace('0x3')]=_0x2ee6e0[_0x6ace('0x3')]||'';this['authType']=_0x2ee6e0[_0x6ace('0x4')]||'';this[_0x6ace('0x5')]=_0x2ee6e0['type']||_0x6ace('0x6');this[_0x6ace('0x7')]=_0x2ee6e0[_0x6ace('0x7')]||'';this['Configurations']=_0x2ee6e0[_0x6ace('0x8')]||{};}module[_0x6ace('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xef3c=['integrationTab','Configurations','name','username','password','token','remoteUri','authType','type'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xef3c,0xb6));var _0xcef3=function(_0x5b74d5,_0x3465cc){_0x5b74d5=_0x5b74d5-0x0;var _0x36f412=_0xef3c[_0x5b74d5];return _0x36f412;};'use strict';function ZendeskAccount(_0x22cc49){this['id']=_0x22cc49['id']||0x0;this[_0xcef3('0x0')]=_0x22cc49[_0xcef3('0x0')]||'';this[_0xcef3('0x1')]=_0x22cc49[_0xcef3('0x1')]||'';this[_0xcef3('0x2')]=_0x22cc49['password']||'';this[_0xcef3('0x3')]=_0x22cc49['token']||'';this[_0xcef3('0x4')]=_0x22cc49[_0xcef3('0x4')]||'';this[_0xcef3('0x5')]=_0x22cc49[_0xcef3('0x5')]||'';this[_0xcef3('0x6')]=_0x22cc49[_0xcef3('0x6')]||_0xcef3('0x7');this['serverUrl']=_0x22cc49['serverUrl']||'';this['Configurations']=_0x22cc49[_0xcef3('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index e4848c6..526ed68 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 _0x425e=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x18b591,_0x4a2baf){var _0x37b7f5=function(_0x421f59){while(--_0x421f59){_0x18b591['push'](_0x18b591['shift']());}};_0x37b7f5(++_0x4a2baf);}(_0x425e,0x159));var _0xe425=function(_0x63c10d,_0x5b5169){_0x63c10d=_0x63c10d-0x0;var _0x3016dd=_0x425e[_0x63c10d];return _0x3016dd;};'use strict';function ZohoAccount(_0x2f1737){this['id']=_0x2f1737['id']||0x0;this['name']=_0x2f1737[_0xe425('0x0')]||'';this[_0xe425('0x1')]=_0x2f1737[_0xe425('0x1')]||'';this['host']=_0x2f1737[_0xe425('0x2')]||'';this[_0xe425('0x3')]=_0x2f1737[_0xe425('0x3')]||'';this[_0xe425('0x4')]=_0x2f1737[_0xe425('0x4')]||'';this['clientSecret']=_0x2f1737[_0xe425('0x5')]||'';this[_0xe425('0x6')]=_0x2f1737[_0xe425('0x6')]||'';this[_0xe425('0x7')]=_0x2f1737[_0xe425('0x7')]||'';this[_0xe425('0x8')]=_0x2f1737[_0xe425('0x8')]||'';this[_0xe425('0x9')]=_0x2f1737['Configurations']||{};}module[_0xe425('0xa')]=ZohoAccount; \ No newline at end of file +var _0x9390=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','code'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x9390,0x1c4));var _0x0939=function(_0x13ca2b,_0x3efee7){_0x13ca2b=_0x13ca2b-0x0;var _0x10cf2f=_0x9390[_0x13ca2b];return _0x10cf2f;};'use strict';function ZohoAccount(_0x13851d){this['id']=_0x13851d['id']||0x0;this[_0x0939('0x0')]=_0x13851d['name']||'';this[_0x0939('0x1')]=_0x13851d[_0x0939('0x1')]||'';this[_0x0939('0x2')]=_0x13851d['host']||'';this[_0x0939('0x3')]=_0x13851d[_0x0939('0x3')]||'';this[_0x0939('0x4')]=_0x13851d['clientId']||'';this[_0x0939('0x5')]=_0x13851d[_0x0939('0x5')]||'';this['serverUrl']=_0x13851d['serverUrl']||'';this[_0x0939('0x6')]=_0x13851d[_0x0939('0x6')]||'';this[_0x0939('0x7')]=_0x13851d['refreshToken']||'';this[_0x0939('0x8')]=_0x13851d['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index bfa2521..d0f1203 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 _0x0b0e=['prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x178318,_0x435456){var _0x57f6c1=function(_0x2d23e1){while(--_0x2d23e1){_0x178318['push'](_0x178318['shift']());}};_0x57f6c1(++_0x435456);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29fa3d,_0x45d24f){_0x29fa3d=_0x29fa3d-0x0;var _0x5d4bbf=_0x0b0e[_0x29fa3d];return _0x5d4bbf;};'use strict';var util=require(_0xe0b0('0x0'));var _=require('lodash');var moment=require(_0xe0b0('0x1'));function checkNameSurname(_0x536e9b,_0x7e5a8a,_0xdf715e){var _0x3b5e2b='';if(!_[_0xe0b0('0x2')](_0x7e5a8a)&&_0xe0b0('0x3')===typeof _0x7e5a8a){_0x3b5e2b+=_0x7e5a8a;}if(!_[_0xe0b0('0x2')](_0xdf715e)&&_0xe0b0('0x3')===typeof _0xdf715e){_0x3b5e2b+='\x20'+_0xdf715e;}if(_0x3b5e2b!==''){return _0x3b5e2b;}return _0x536e9b;}function Action(_0x185efa,_0x30e20d,_0x28e40f,_0x219b1c,_0x5cf9cc){this['uniqueid']=_0x28e40f||undefined;this[_0xe0b0('0x4')]=_0x185efa['id'];this[_0xe0b0('0x5')]=_0x30e20d[_0xe0b0('0x6')];this[_0xe0b0('0x7')]=_0x30e20d['type'];this[_0xe0b0('0x8')]=_0xe0b0('0x5');this['dialAnswer']=![];this[_0xe0b0('0x9')]=_[_0xe0b0('0x2')](_0x185efa['Agent'])?undefined:_0x185efa[_0xe0b0('0xa')][_0xe0b0('0x6')];this[_0xe0b0('0xb')]=this['membername']?util[_0xe0b0('0xc')](_0xe0b0('0xd'),this[_0xe0b0('0x9')]):_0x219b1c||undefined;this[_0xe0b0('0xe')]=checkNameSurname(_0x185efa[_0xe0b0('0xf')]['phone'],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x10')],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x11')]);this[_0xe0b0('0x12')]=_0x185efa['active']||![];this[_0xe0b0('0x13')]=_0x185efa['phone'];this[_0xe0b0('0x14')]=_0x185efa[_0xe0b0('0x14')];this['countbusyretry']=_0x185efa[_0xe0b0('0x15')]||0x0;this['countcongestionretry']=_0x185efa[_0xe0b0('0x16')]||0x0;this[_0xe0b0('0x17')]=_0x185efa['countnoanswerretry']||0x0;this['countglobal']=(_0x185efa[_0xe0b0('0x15')]||0x0)+(_0x185efa['countcongestionretry']||0x0)+(_0x185efa['countnoanswerretry']||0x0)+(_0x185efa['countnosuchnumberretry']||0x0)+(_0x185efa[_0xe0b0('0x18')]||0x0)+(_0x185efa['countabandonedretry']||0x0)+(_0x185efa['countmachineretry']||0x0)+(_0x185efa[_0xe0b0('0x19')]||0x0);this['countnosuchnumberretry']=_0x185efa[_0xe0b0('0x1a')]||0x0;this['countdropretry']=_0x185efa[_0xe0b0('0x18')]||0x0;this[_0xe0b0('0x1b')]=_0x185efa[_0xe0b0('0x1b')]||0x0;this[_0xe0b0('0x1c')]=_0x185efa[_0xe0b0('0x1c')]||0x0;this['countagentrejectretry']=_0x185efa['countagentrejectretry']||0x0;this[_0xe0b0('0x1d')]=_0x185efa['callback'];this[_0xe0b0('0x1e')]=_0x185efa[_0xe0b0('0x1e')];this['callbackat']=_0x185efa[_0xe0b0('0x1f')];this['recallme']=_0x185efa[_0xe0b0('0x20')];this['ContactId']=_0x185efa[_0xe0b0('0x21')];this['ListId']=_0x185efa[_0xe0b0('0x22')];this['UserId']=_[_0xe0b0('0x2')](_0x185efa['Agent'])?_0x185efa[_0xe0b0('0x23')]:_0x185efa['Agent']['id'];this[_0xe0b0('0x24')]=_0x185efa[_0xe0b0('0x24')];this[_0xe0b0('0x25')]='';this[_0xe0b0('0x26')]='';}Action[_0xe0b0('0x27')][_0xe0b0('0x28')]=function(){return util['format'](_0xe0b0('0x29'),this[_0xe0b0('0xe')],this['number']);};module[_0xe0b0('0x2a')]=Action; \ No newline at end of file +var _0xe5af=['Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','lodash','moment','string','uniqueid','idContact','queue','type','dialAnswer','isNil','Agent','name','channelAgent','format','SIP/%s','membername','calleridname'];(function(_0x244f32,_0x451b06){var _0x417d07=function(_0x494268){while(--_0x494268){_0x244f32['push'](_0x244f32['shift']());}};_0x417d07(++_0x451b06);}(_0xe5af,0x9c));var _0xfe5a=function(_0x591a59,_0x3f9d6c){_0x591a59=_0x591a59-0x0;var _0x29ca33=_0xe5af[_0x591a59];return _0x29ca33;};'use strict';var util=require('util');var _=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));function checkNameSurname(_0x4b1845,_0x9a3743,_0x1bad12){var _0x23b7f0='';if(!_['isNil'](_0x9a3743)&&_0xfe5a('0x2')===typeof _0x9a3743){_0x23b7f0+=_0x9a3743;}if(!_['isNil'](_0x1bad12)&&'string'===typeof _0x1bad12){_0x23b7f0+='\x20'+_0x1bad12;}if(_0x23b7f0!==''){return _0x23b7f0;}return _0x4b1845;}function Action(_0x37455d,_0x2039cd,_0x4e418f,_0x5eea2e,_0x356c69){this[_0xfe5a('0x3')]=_0x4e418f||undefined;this[_0xfe5a('0x4')]=_0x37455d['id'];this[_0xfe5a('0x5')]=_0x2039cd['name'];this[_0xfe5a('0x6')]=_0x2039cd['type'];this['campaigntype']=_0xfe5a('0x5');this[_0xfe5a('0x7')]=![];this['membername']=_[_0xfe5a('0x8')](_0x37455d[_0xfe5a('0x9')])?undefined:_0x37455d[_0xfe5a('0x9')][_0xfe5a('0xa')];this[_0xfe5a('0xb')]=this['membername']?util[_0xfe5a('0xc')](_0xfe5a('0xd'),this[_0xfe5a('0xe')]):_0x5eea2e||undefined;this[_0xfe5a('0xf')]=checkNameSurname(_0x37455d[_0xfe5a('0x10')]['phone'],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x11')],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x12')]);this[_0xfe5a('0x13')]=_0x37455d[_0xfe5a('0x13')]||![];this[_0xfe5a('0x14')]=_0x37455d[_0xfe5a('0x15')];this[_0xfe5a('0x16')]=_0x37455d[_0xfe5a('0x16')];this[_0xfe5a('0x17')]=_0x37455d[_0xfe5a('0x17')]||0x0;this[_0xfe5a('0x18')]=_0x37455d[_0xfe5a('0x18')]||0x0;this[_0xfe5a('0x19')]=_0x37455d[_0xfe5a('0x19')]||0x0;this['countglobal']=(_0x37455d[_0xfe5a('0x17')]||0x0)+(_0x37455d[_0xfe5a('0x18')]||0x0)+(_0x37455d['countnoanswerretry']||0x0)+(_0x37455d[_0xfe5a('0x1a')]||0x0)+(_0x37455d[_0xfe5a('0x1b')]||0x0)+(_0x37455d[_0xfe5a('0x1c')]||0x0)+(_0x37455d['countmachineretry']||0x0)+(_0x37455d['countagentrejectretry']||0x0);this[_0xfe5a('0x1a')]=_0x37455d[_0xfe5a('0x1a')]||0x0;this[_0xfe5a('0x1b')]=_0x37455d[_0xfe5a('0x1b')]||0x0;this[_0xfe5a('0x1c')]=_0x37455d[_0xfe5a('0x1c')]||0x0;this['countmachineretry']=_0x37455d[_0xfe5a('0x1d')]||0x0;this['countagentrejectretry']=_0x37455d[_0xfe5a('0x1e')]||0x0;this[_0xfe5a('0x1f')]=_0x37455d[_0xfe5a('0x1f')];this['callbackuniqueid']=_0x37455d['callbackuniqueid'];this[_0xfe5a('0x20')]=_0x37455d[_0xfe5a('0x20')];this['recallme']=_0x37455d[_0xfe5a('0x21')];this[_0xfe5a('0x22')]=_0x37455d['ContactId'];this[_0xfe5a('0x23')]=_0x37455d[_0xfe5a('0x23')];this[_0xfe5a('0x24')]=_[_0xfe5a('0x8')](_0x37455d['Agent'])?_0x37455d[_0xfe5a('0x24')]:_0x37455d[_0xfe5a('0x9')]['id'];this[_0xfe5a('0x25')]=_0x37455d[_0xfe5a('0x25')];this[_0xfe5a('0x26')]='';this[_0xfe5a('0x27')]='';}Action[_0xfe5a('0x28')][_0xfe5a('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xfe5a('0xf')],this['number']);};module[_0xfe5a('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index aa29959..8ef823e 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 _0xe107=['NoSuchNumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','execRun','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','Action','variablesAction','[originated][increment]','lookAgent','logLookAgent','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','ioredis','preview','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','booked','outbound','isNil','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xe107,0xb3));var _0x7e10=function(_0x10e03e,_0x2df3eb){_0x10e03e=_0x10e03e-0x0;var _0x42126c=_0xe107[_0x10e03e];return _0x42126c;};'use strict';var util=require(_0x7e10('0x0'));var _=require('lodash');var BPromise=require(_0x7e10('0x1'));var uuid=require(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var md5=require('md5');var Redis=require(_0x7e10('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x7e10('0x5'));var loggerAction=require(_0x7e10('0x6'))(_0x7e10('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x7e10('0x8'));var Action=require(_0x7e10('0x9'));var ut=require(_0x7e10('0xa'));config[_0x7e10('0xb')]=_['defaults'](config['redis'],{'host':_0x7e10('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x7e10('0xd')][_0x7e10('0xe')]=function(_0x2b2850){this[_0x7e10('0xf')]=this[_0x7e10('0xf')]?this['tail'][_0x7e10('0x10')](_0x2b2850):_0x2b2850();};function Preview(_0x55ea26){this[_0x7e10('0x11')]=new Sequence();this[_0x7e10('0x12')]=_0x55ea26[_0x7e10('0x13')];this['trunks']=_0x55ea26[_0x7e10('0x14')];this[_0x7e10('0x15')]={};this[_0x7e10('0x16')]=_0x55ea26[_0x7e10('0x16')];this[_0x7e10('0x17')]=0x0;ami['on'](_0x7e10('0x18'),this[_0x7e10('0x19')][_0x7e10('0x1a')](this));ami['on']('hangup',this[_0x7e10('0x1b')][_0x7e10('0x1a')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x7e10('0x1a')](this));ami['on']('dialend',this[_0x7e10('0x1c')][_0x7e10('0x1a')](this));ami['on'](_0x7e10('0x1d'),this[_0x7e10('0x1e')]['bind'](this));ami['on'](_0x7e10('0x1f'),this[_0x7e10('0x20')][_0x7e10('0x1a')](this));ami['on']('attendedtransfer',this[_0x7e10('0x21')][_0x7e10('0x1a')](this));ami['on'](_0x7e10('0x22'),this[_0x7e10('0x23')][_0x7e10('0x1a')](this));this['loopCampaigns'](this[_0x7e10('0x12')]);}function emit(_0x2c6227,_0x550306,_0x3c5629){io['to'](_0x2c6227)[_0x7e10('0x24')](_0x550306,_0x3c5629);}function emitCampaignPreview(_0x29405c){if(_0x29405c[_0x7e10('0x25')]==='outbound'){var _0x415cb7={'id':_0x29405c['id'],'name':_0x29405c[_0x7e10('0x26')],'strategy':_0x29405c[_0x7e10('0x27')],'answered':_0x29405c[_0x7e10('0x28')],'available':_0x29405c[_0x7e10('0x29')],'loggedIn':_0x29405c[_0x7e10('0x2a')],'pTalking':_0x29405c[_0x7e10('0x2b')],'sumBillable':_0x29405c[_0x7e10('0x2c')],'sumDuration':_0x29405c['sumDuration'],'sumHoldTime':_0x29405c['sumHoldTime']||0x0,'talking':_0x29405c[_0x7e10('0x2d')],'total':_0x29405c[_0x7e10('0x2e')],'type':_0x29405c[_0x7e10('0x25')],'unmanaged':_0x29405c[_0x7e10('0x2f')],'abandoned':_0x29405c['abandoned'],'waiting':_0x29405c['waiting'],'loggedInDb':_0x29405c[_0x7e10('0x30')],'dialActive':_0x29405c[_0x7e10('0x31')],'dialMethod':_0x29405c[_0x7e10('0x32')],'dialOriginateCallerIdName':_0x29405c[_0x7e10('0x33')],'dialOriginateCallerIdNumber':_0x29405c[_0x7e10('0x34')],'dialOriginateTimeout':_0x29405c[_0x7e10('0x35')],'dialPrefix':_0x29405c[_0x7e10('0x36')],'outboundAnswerAgiCallsDay':_0x29405c[_0x7e10('0x37')],'outboundAnswerCallsDay':_0x29405c[_0x7e10('0x38')],'outboundBlacklistCallsDay':_0x29405c[_0x7e10('0x39')],'outboundBusyCallsDay':_0x29405c[_0x7e10('0x3a')],'outboundCongestionCallsDay':_0x29405c['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x29405c[_0x7e10('0x3b')],'outboundDropCallsDayCallersExit':_0x29405c[_0x7e10('0x3c')],'outboundDropCallsDayTimeout':_0x29405c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x29405c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x29405c[_0x7e10('0x3d')],'outboundOriginateFailureCallsDay':_0x29405c[_0x7e10('0x3e')],'outboundReCallsDay':_0x29405c['outboundReCallsDay'],'outboundRejectCallsDay':_0x29405c[_0x7e10('0x3f')],'outboundUnknownCallsDay':_0x29405c['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x29405c[_0x7e10('0x40')],'predictiveIntervalAnsweredCalls':_0x29405c[_0x7e10('0x41')],'predictiveIntervalAvgHoldtime':_0x29405c[_0x7e10('0x42')],'predictiveIntervalAvgTalktime':_0x29405c[_0x7e10('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x29405c[_0x7e10('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x29405c[_0x7e10('0x45')],'predictiveIntervalErlangCalls':_0x29405c['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x29405c[_0x7e10('0x46')],'predictiveIntervalHitRate':_0x29405c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x29405c[_0x7e10('0x47')],'predictiveIntervalPauses':_0x29405c[_0x7e10('0x48')],'predictiveIntervalAvailable':_0x29405c[_0x7e10('0x49')],'predictiveIntervalTotalCalls':_0x29405c[_0x7e10('0x4a')],'message':_0x29405c[_0x7e10('0x4b')],'originated':_0x29405c[_0x7e10('0x4c')],'erlangCalls':_0x29405c[_0x7e10('0x4d')],'erlangCallToSecond':_0x29405c[_0x7e10('0x4e')],'erlangAbandonmentRate':_0x29405c[_0x7e10('0x4f')],'erlangBusyFactor':_0x29405c['erlangBusyFactor'],'startPredictive':_0x29405c[_0x7e10('0x50')],'startProgressive':_0x29405c[_0x7e10('0x51')]};if(_0x29405c[_0x7e10('0x52')]){_0x415cb7[_0x7e10('0x52')]={'id':_0x29405c[_0x7e10('0x52')]['id'],'name':_0x29405c['Trunk'][_0x7e10('0x26')],'active':_0x29405c[_0x7e10('0x52')][_0x7e10('0x53')],'callerid':_0x29405c[_0x7e10('0x52')]['callerid']};}if(_0x29405c['Interval']){_0x415cb7[_0x7e10('0x54')]={'id':_0x29405c[_0x7e10('0x54')]['id'],'name':_0x29405c[_0x7e10('0x54')][_0x7e10('0x26')]};}var _0x5a4376=md5(JSON[_0x7e10('0x55')](_0x415cb7));if(_0x29405c[_0x7e10('0x56')]!==_0x5a4376){_0x29405c['md5']=_0x5a4376;emit(util[_0x7e10('0x57')](_0x7e10('0x58'),_0x415cb7['name']),'voice_queue:save',_0x415cb7);}}}function emitVoiceQueueChannelRemove(_0x4d5aaa){logger[_0x7e10('0x59')](_0x7e10('0x5a'),JSON[_0x7e10('0x55')](_0x4d5aaa));emit(util[_0x7e10('0x57')](_0x7e10('0x58'),_0x4d5aaa[_0x7e10('0x26')]),_0x7e10('0x5b'),_0x4d5aaa);io[_0x7e10('0x24')]('voice_queue_presence:remove',_0x4d5aaa);}function notSendMessagesQueue(_0x260737){if(_0x260737[_0x7e10('0x5c')]){if(_0x260737[_0x7e10('0x4c')]===0x0&&_0x260737[_0x7e10('0x2b')]===0x0){_0x260737['sendMessageOneNotActive']=![];_0x260737[_0x7e10('0x29')]=0x0;_0x260737[_0x7e10('0x5d')]=0x0;_0x260737[_0x7e10('0x4b')]=_0x7e10('0x5e');ut[_0x7e10('0x5f')](_0x7e10('0x60'),_0x260737[_0x7e10('0x26')]+'\x20is\x20not\x20active');}else{_0x260737[_0x7e10('0x4b')]=_0x7e10('0x61');ut['logger'](_0x7e10('0x60'),_0x260737[_0x7e10('0x26')]+_0x7e10('0x62'));}emitCampaignPreview(_0x260737);}}Preview['prototype'][_0x7e10('0x63')]=function(){var _0x117309=this;setInterval(function(){_0x117309[_0x7e10('0x64')]();},0x7cf);};Preview[_0x7e10('0xd')][_0x7e10('0x64')]=function(){var _0x4c2946=this[_0x7e10('0x12')];this[_0x7e10('0x17')]+=0x1;for(var _0x3f6b39 in _0x4c2946){if(_0x4c2946[_0x7e10('0x65')](_0x3f6b39)&&(_0x4c2946[_0x3f6b39][_0x7e10('0x32')]==='preview'||_0x4c2946[_0x3f6b39][_0x7e10('0x32')]===_0x7e10('0x66'))&&_0x4c2946[_0x3f6b39]['type']==='outbound'){if(this[_0x7e10('0x17')]>0x7){this[_0x7e10('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x4c2946[_0x7e10('0x65')](_0x3f6b39)&&_0x4c2946[_0x3f6b39]['dialMethod']===_0x7e10('0x5')&&_0x4c2946[_0x3f6b39]['type']===_0x7e10('0x67')){if(_0x4c2946[_0x3f6b39][_0x7e10('0x31')]){this['setMessage'](_0x4c2946[_0x3f6b39]);if(_0x4c2946[_0x3f6b39]['dialPreviewAutoRecallMe'])this['recallMe'](_0x4c2946[_0x3f6b39]);}else{notSendMessagesQueue(_0x4c2946[_0x3f6b39]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x427f42){var _0x16c5ac=this;this[_0x7e10('0x11')][_0x7e10('0xe')](function(){if(!_[_0x7e10('0x68')](_0x16c5ac['actions'][_0x427f42])){loggerAction[_0x7e10('0x59')]('[clearZombieChannels][talking]',_0x427f42,_0x7e10('0x69'),_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6a')],_0x7e10('0x6b'),JSON['stringify'](_0x16c5ac['campaignsPreview'][_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6a')]]['originated']),'pTalking:\x20',JSON[_0x7e10('0x55')](_0x16c5ac[_0x7e10('0x12')][_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6a')]][_0x7e10('0x2b')]),JSON[_0x7e10('0x55')](_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6c')]),JSON['stringify'](_[_0x7e10('0x6d')](_0x16c5ac['actions'][_0x427f42],[_0x7e10('0x6e'),_0x7e10('0x6f'),_0x7e10('0x70'),'ListId'])));return ami['Action']({'action':_0x7e10('0x71'),'channel':_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x72')]})[_0x7e10('0x73')](function(_0x174346){if(_0x174346['message']===_0x7e10('0x74')){setTimeout(function(){if(_0x16c5ac['actions'][_0x427f42]){ut['updateOriginated'](_0x16c5ac[_0x7e10('0x12')][_0x16c5ac[_0x7e10('0x15')][_0x427f42]['queue']],_0x7e10('0x75'));if(_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6c')]===!![]){ut[_0x7e10('0x76')](_0x16c5ac[_0x7e10('0x12')][_0x16c5ac[_0x7e10('0x15')][_0x427f42]['queue']],_0x7e10('0x75'));ut[_0x7e10('0x77')](_0x7e10('0x78')+_0x427f42,_0x16c5ac[_0x7e10('0x15')][_0x427f42][_0x7e10('0x6a')]);}ut[_0x7e10('0x77')](_0x7e10('0x79')+_0x427f42,_0x16c5ac['actions'][_0x427f42][_0x7e10('0x6a')]);delete _0x16c5ac[_0x7e10('0x15')][_0x427f42];}},0x2328);}});}});};Preview[_0x7e10('0xd')]['clearZombieChannels']=function(){var _0x53e58d=this;loggerAction[_0x7e10('0x59')](_0x7e10('0x7a'),_[_0x7e10('0x7b')](this[_0x7e10('0x15')]));for(var _0x13a8a5 in this['actions']){if(_0x53e58d[_0x7e10('0x15')][_0x7e10('0x65')](_0x13a8a5)){_0x53e58d[_0x7e10('0x7c')](_0x13a8a5);}}};Preview[_0x7e10('0xd')]['recallMe']=function(_0x201cbc){var _0x4a105b=this;rpcDb[_0x7e10('0x7d')](_0x201cbc['id'],ut[_0x7e10('0x7e')](this[_0x7e10('0x16')]))[_0x7e10('0x7f')](function(_0x2ede43){if(!_['isNil'](_0x2ede43)){for(var _0x29ec6f=0x0;_0x29ec6f<_0x2ede43['length'];_0x29ec6f+=0x1){if(ut['getDiff'](_0x2ede43[_0x29ec6f][_0x7e10('0x80')])<_0x201cbc['dialRecallMeTimeout']*0x3c){if(_0x2ede43[_0x29ec6f][_0x7e10('0x81')]&&!_0x2ede43[_0x29ec6f]['Agent'][_0x7e10('0x82')]){_0x4a105b[_0x7e10('0x83')](_0x2ede43[_0x29ec6f]['id'])[_0x7e10('0x7f')](ut[_0x7e10('0x84')](_0x7e10('0x85')))[_0x7e10('0x73')](ut[_0x7e10('0x84')](_0x7e10('0x85')));}else{rpcDb[_0x7e10('0x86')](_0x2ede43[_0x29ec6f]['id']);}}else{var _0x33d7c7=new Action(_0x2ede43[_0x29ec6f],_0x201cbc);_0x33d7c7['starttime']=moment()[_0x7e10('0x57')](_0x7e10('0x87'));_0x201cbc['outboundReCallsDay']+=0x1;ut[_0x7e10('0x88')](_0x33d7c7,0x17,_0x7e10('0x89'));if(_0x201cbc[_0x7e10('0x8a')]){rpcDb['rescheduleContactInQueue'](ut[_0x7e10('0x8b')](_0x2ede43[_0x29ec6f]));rpcDb['createCustomerHistory'](_0x33d7c7,_0x7e10('0x8c'));}else{ut[_0x7e10('0x88')](_0x33d7c7,0x16,_0x7e10('0x8d'));rpcDb[_0x7e10('0x8e')](_0x33d7c7,_0x7e10('0x8f'));rpcDb[_0x7e10('0x90')](_0x33d7c7,'[HistoryRecallClose]');}}}}})[_0x7e10('0x73')](ut['logger2'](_0x7e10('0x91')));};Preview['prototype']['setMessage']=function(_0x3f4ceb){_0x3f4ceb[_0x7e10('0x5c')]=!![];if(ut[_0x7e10('0x92')](_0x3f4ceb['loggedIn'])){_0x3f4ceb[_0x7e10('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x7e10('0x93')](_0x3f4ceb[_0x7e10('0x31')])){_0x3f4ceb[_0x7e10('0x4b')]=_0x7e10('0x5e');}else if(!this['isTrunkReachable'](_0x3f4ceb[_0x7e10('0x52')])){if(!this[_0x7e10('0x94')](_0x3f4ceb[_0x7e10('0x95')])){_0x3f4ceb[_0x7e10('0x4b')]=_0x7e10('0x96');}else{_0x3f4ceb[_0x7e10('0x4b')]='ACTIVE';}}else{_0x3f4ceb[_0x7e10('0x4b')]=_0x7e10('0x97');}emitCampaignPreview(_0x3f4ceb);};Preview['prototype'][_0x7e10('0x98')]=function(_0x2f2480,_0xb5c062,_0x37c98c){var _0x188a4e=this;var _0x5cd85b=this[_0x7e10('0x15')][_0xb5c062];var _0x566dc1=this['campaignsPreview'][_0x5cd85b[_0x7e10('0x6a')]];var _0x116e08;var _0x2cb9eb=![];var _0x49e265=0x2;var _0x418b7e=0x3;if(_0x566dc1){switch(_0x37c98c){case'1':_0x566dc1[_0x7e10('0x3d')]+=0x1;_0x5cd85b[_0x7e10('0x99')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x0,_0x7e10('0x9c'));ami[_0x7e10('0x24')]('custom:agentnosuchnumber',ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0x9e')));rpcDb[_0x7e10('0x8e')](_0x5cd85b,'[callProgressDetectingCustomer][logNoSuch]');_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'0',_0x566dc1)['then'](function(_0x48c692){_0x2cb9eb=_0x48c692[_0x7e10('0xa0')]==0x1;_0x49e265=_0x566dc1['dialNoSuchNumberRetryFrequency'];_0x418b7e=_0x566dc1['callAdditionalPhoneAfterMin'];if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,_0x7e10('0xa3'));rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xa4'));}else{if(_0x5cd85b[_0x7e10('0x99')]>=_0x566dc1[_0x7e10('0xa5')]){rpcDb[_0x7e10('0x90')](_0x5cd85b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x7e10('0xa6')](ut[_0x7e10('0xa7')](_0x5cd85b,'countnosuchnumberretry',_0x566dc1[_0x7e10('0xa8')]),_0x5cd85b[_0x7e10('0xa9')],_0x5cd85b[_0x7e10('0xaa')]);}}delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xab')]];}else{_0x5cd85b[_0x7e10('0x99')]++;logger[_0x7e10('0x59')]('actioncountonusuch',_0x5cd85b[_0x7e10('0x99')]);logger[_0x7e10('0x59')]('id',_0x5cd85b[_0x7e10('0xac')]);_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b[_0x7e10('0xac')],'field':{'countnosuchnumberretry':_0x5cd85b[_0x7e10('0x99')]}})[_0x7e10('0x7f')](function(){_0x188a4e['swapAdditionalPhones'](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});break;case _0x7e10('0xae'):var _0x4cdd5d=moment()[_0x7e10('0x57')](_0x7e10('0x87'));_0x5cd85b[_0x7e10('0xaf')]=_0x4cdd5d;_0x5cd85b[_0x7e10('0xb0')]=_0x4cdd5d;_0x5cd85b[_0x7e10('0x6c')]=!![];_0x566dc1[_0x7e10('0x2b')]+=0x1;logger[_0x7e10('0x59')](_0x7e10('0xb1'),_0x5cd85b['uniqueid'],_0x7e10('0xb2'),_0x566dc1[_0x7e10('0x26')],'pTalking:\x20',_0x566dc1[_0x7e10('0x2b')]);ami[_0x7e10('0x24')](_0x7e10('0xb3'),ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xb4'),this['campaignsPreview'][_0x5cd85b[_0x7e10('0x6a')]]));if(_0x566dc1['acw']){ami[_0x7e10('0x24')](_0x7e10('0xb5'),ut[_0x7e10('0xb6')](_0x5cd85b));}break;case'16':ami[_0x7e10('0x24')](_0x7e10('0xb7'),ut[_0x7e10('0x9d')](_0x5cd85b,'complete',this[_0x7e10('0x12')][_0x5cd85b[_0x7e10('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xb8')));_0x566dc1[_0x7e10('0x38')]+=0x1;_0x566dc1[_0x7e10('0x2e')]+=0x1;_0x566dc1[_0x7e10('0x28')]+=0x1;ut[_0x7e10('0x76')](_0x566dc1,'[16]');_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x4,_0x7e10('0xb9'));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xba'));rpcDb['createCustomerFinal'](_0x5cd85b,_0x7e10('0xbb'));rpcDb[_0x7e10('0xbc')](_0x5cd85b);_0x566dc1[_0x7e10('0xbd')]+=_0x5cd85b[_0x7e10('0xbe')];_0x566dc1['sumBillable']+=_0x5cd85b[_0x7e10('0xbe')];logger[_0x7e10('0x59')](_0x7e10('0xbf'),_0x5cd85b[_0x7e10('0xc0')],_0x7e10('0xb2'),_0x566dc1[_0x7e10('0x26')],_0x7e10('0xc1'),_0x566dc1[_0x7e10('0x2b')]);delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xab')]];break;case _0x7e10('0xc2'):_0x566dc1[_0x7e10('0x3a')]+=0x1;_0x5cd85b[_0x7e10('0xc3')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut['totalGlobal'](_0x5cd85b);ut['logCustomer'](_0x5cd85b,0x5,'Busy');_0x49e265=_0x566dc1['dialBusyRetryFrequency'];_0x418b7e=_0x566dc1[_0x7e10('0xc4')];ami['emit'](_0x7e10('0xc5'),ut['buildObj'](_0x5cd85b,_0x7e10('0xc6')));rpcDb[_0x7e10('0x8e')](_0x5cd85b,'[callProgressDetectingCustomer][logBusy]');_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'5',_0x566dc1)[_0x7e10('0x7f')](function(_0xcb7cf1){_0x2cb9eb=_0xcb7cf1['additional']==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,'Global');rpcDb['createCustomerFinal'](_0x116e08,_0x7e10('0xc7'));}else{if(_0x5cd85b['countbusyretry']>=_0x566dc1[_0x7e10('0xc8')]){rpcDb[_0x7e10('0x90')](_0x5cd85b,_0x7e10('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x7e10('0xa7')](_0x5cd85b,_0x7e10('0xc3'),_0x566dc1['dialBusyRetryFrequency']),_0x5cd85b['unlockAgent'],_0x5cd85b[_0x7e10('0xaa')]);}}}else{_0x5cd85b['countbusyretry']++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b['idContact'],'field':{'countbusyretry':_0x5cd85b[_0x7e10('0xc3')]}})['then'](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)['then'](function(){});});}});break;case _0x7e10('0xcb'):_0x566dc1[_0x7e10('0xcc')]+=0x1;_0x5cd85b[_0x7e10('0xcd')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x3,_0x7e10('0xce'));_0x49e265=_0x566dc1[_0x7e10('0xcf')];_0x418b7e=_0x566dc1[_0x7e10('0xc4')];ami[_0x7e10('0x24')](_0x7e10('0xd0'),ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xd1')));rpcDb['createCustomerHistory'](_0x5cd85b,'[callProgressDetectingCustomer][logNoAnswer]');_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'3',_0x566dc1)[_0x7e10('0x7f')](function(_0x319539){_0x2cb9eb=_0x319539[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut['totalGlobal'](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,'Global');rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xd2'));}else{if(_0x5cd85b[_0x7e10('0xcd')]>=_0x566dc1[_0x7e10('0xd3')]){rpcDb[_0x7e10('0x90')](_0x5cd85b,_0x7e10('0xd4'));}else{rpcDb[_0x7e10('0xa6')](ut['scheduledAt'](_0x5cd85b,'countnoanswerretry',_0x566dc1['dialNoAnswerRetryFrequency']),_0x5cd85b[_0x7e10('0xa9')],_0x5cd85b[_0x7e10('0xaa')]);}}}else{_0x5cd85b['countnoanswerretry']++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b['idContact'],'field':{'countnoanswerretry':_0x5cd85b[_0x7e10('0xcd')]}})['then'](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});break;case _0x7e10('0xd5'):_0x566dc1['outboundCongestionCallsDay']+=0x1;_0x5cd85b[_0x7e10('0xd6')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x8,_0x7e10('0xd7'));_0x49e265=_0x566dc1[_0x7e10('0xd8')];_0x418b7e=_0x566dc1['callAdditionalPhoneAfterMin'];ami[_0x7e10('0x24')](_0x7e10('0xd9'),ut['buildObj'](_0x5cd85b,'congestion'));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xda'));_0x188a4e['verifyAdditionalPhones'](_0x5cd85b,'8',_0x566dc1)[_0x7e10('0x7f')](function(_0x54fe2c){_0x2cb9eb=_0x54fe2c[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,'Global');rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xdb'));}else{if(_0x5cd85b[_0x7e10('0xd6')]>=_0x566dc1[_0x7e10('0xdc')]){rpcDb['createCustomerFinal'](_0x5cd85b,_0x7e10('0xda'));}else{rpcDb[_0x7e10('0xa6')](ut[_0x7e10('0xa7')](_0x5cd85b,_0x7e10('0xd6'),_0x566dc1[_0x7e10('0xdd')]),_0x5cd85b[_0x7e10('0xa9')],_0x5cd85b['activeContact']);}}}else{_0x5cd85b[_0x7e10('0xd6')]++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b[_0x7e10('0xac')],'field':{'countcongestionretry':_0x5cd85b[_0x7e10('0xd6')]}})[_0x7e10('0x7f')](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});break;case _0x7e10('0xde'):_0x566dc1['outboundRejectCallsDay']+=0x1;_0x5cd85b['countagentrejectretry']+=0x1;_0x5cd85b['countglobal']=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x14,'AgentReject');_0x49e265=_0x566dc1[_0x7e10('0xdf')];_0x418b7e=_0x566dc1[_0x7e10('0xc4')];ami[_0x7e10('0x24')](_0x7e10('0xe0'),ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xe1')));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xe2'));_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'20',_0x566dc1)['then'](function(_0x36c7dc){_0x2cb9eb=_0x36c7dc[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut['cloneAction'](_0x5cd85b,0x14,'AgentReject');rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xe3'));}else{if(_0x5cd85b['countagentrejectretry']>=_0x566dc1['dialAgentRejectMaxRetry']){rpcDb[_0x7e10('0x90')](_0x5cd85b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x7e10('0xa6')](ut['scheduledAt'](_0x5cd85b,_0x7e10('0xe4'),_0x566dc1[_0x7e10('0xdf')]),_0x5cd85b[_0x7e10('0xa9')],_0x5cd85b[_0x7e10('0xaa')]);}}}else{_0x5cd85b[_0x7e10('0xcd')]++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b[_0x7e10('0xac')],'field':{'countnoanswerretry':_0x5cd85b[_0x7e10('0xcd')]}})[_0x7e10('0x7f')](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});break;case _0x7e10('0xe5'):_0x566dc1[_0x7e10('0x40')]+=0x1;_0x5cd85b[_0x7e10('0xe6')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0xb,_0x7e10('0xe7'));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xe8'));_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'11',_0x566dc1)['then'](function(_0x16085f){_0x2cb9eb=_0x16085f[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1['dialGlobalMaxRetry']){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,_0x7e10('0xa3'));rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xe8'));}else{if(_0x5cd85b[_0x7e10('0xe9')]>=_0x566dc1[_0x7e10('0xea')]){rpcDb[_0x7e10('0x90')](_0x5cd85b,_0x7e10('0xe8'));}else{rpcDb[_0x7e10('0xa6')](ut[_0x7e10('0xa7')](_0x5cd85b,_0x7e10('0xe6'),_0x566dc1[_0x7e10('0xeb')]),_0x5cd85b[_0x7e10('0xa9')],_0x5cd85b['activeContact']);}}}else{_0x5cd85b[_0x7e10('0xcd')]++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b['idContact'],'field':{'countnoanswerretry':_0x5cd85b['countnoanswerretry']}})[_0x7e10('0x7f')](function(){_0x188a4e['swapAdditionalPhones'](_0x5cd85b,_0x49e265,_0x418b7e)['then'](function(){});});}});break;case'18':_0x566dc1[_0x7e10('0xec')]+=0x1;_0x5cd85b['countmachineretry']+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut['logCustomer'](_0x5cd85b,0x12,_0x2f2480[_0x7e10('0xed')]||_0x2f2480[_0x7e10('0xee')]);ami[_0x7e10('0x24')](_0x7e10('0xef'),ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xf0')));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xf1'));_0x188a4e['verifyAdditionalPhones'](_0x5cd85b,'18',_0x566dc1)[_0x7e10('0x7f')](function(_0x39c0b1){_0x2cb9eb=_0x39c0b1['additional']==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1['dialGlobalMaxRetry']){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0x12,_0x7e10('0xa3'));rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xf1'));}else{rpcDb[_0x7e10('0x90')](_0x5cd85b,_0x7e10('0xf1'));}}else{_0x5cd85b[_0x7e10('0xcd')]++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b[_0x7e10('0xac')],'field':{'countnoanswerretry':_0x5cd85b[_0x7e10('0xcd')]}})['then'](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xab')]];break;case'19':_0x566dc1[_0x7e10('0xec')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut[_0x7e10('0x9b')](_0x5cd85b);ut[_0x7e10('0x88')](_0x5cd85b,0x13,_0x2f2480['cause-txt']||_0x2f2480[_0x7e10('0xee')]);ami[_0x7e10('0x24')]('custom:amd',ut[_0x7e10('0x9d')](_0x5cd85b,_0x7e10('0xf0')));rpcDb[_0x7e10('0x8e')](_0x5cd85b,_0x7e10('0xf2'));_0x188a4e['verifyAdditionalPhones'](_0x5cd85b,'18',_0x566dc1)[_0x7e10('0x7f')](function(_0x366791){_0x2cb9eb=_0x366791[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1[_0x7e10('0xa1')]){_0x116e08=ut['cloneAction'](_0x5cd85b,0xf,_0x7e10('0xa3'));rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xf2'));}else{rpcDb[_0x7e10('0x90')](_0x5cd85b,'[callProgressDetectingCustomer][machine]');}}else{_0x5cd85b['countnoanswerretry']++;_0x188a4e[_0x7e10('0xad')]({'id':_0x5cd85b[_0x7e10('0xac')],'field':{'countnoanswerretry':_0x5cd85b[_0x7e10('0xcd')]}})['then'](function(){_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)[_0x7e10('0x7f')](function(){});});}});delete this['actions'][_0x2f2480[_0x7e10('0xab')]];break;default:if(_0x5cd85b[_0x7e10('0x6c')]){ut[_0x7e10('0x76')](_0x566dc1,'[default]');ut[_0x7e10('0x77')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x566dc1[_0x7e10('0x26')],_0x2f2480);}_0x566dc1[_0x7e10('0xec')]+=0x1;_0x5cd85b[_0x7e10('0x9a')]=ut['totalGlobal'](_0x5cd85b);ut['logCustomer'](_0x5cd85b,0xc,_0x2f2480[_0x7e10('0xed')]||_0x2f2480['dialstatus']);_0x49e265=_0x566dc1[_0x7e10('0xdf')];_0x418b7e=_0x566dc1[_0x7e10('0xc4')];rpcDb['createCustomerHistory'](_0x5cd85b,_0x7e10('0xf3'));_0x188a4e[_0x7e10('0x9f')](_0x5cd85b,'20',_0x566dc1)[_0x7e10('0x7f')](function(_0x1b4003){_0x2cb9eb=_0x1b4003[_0x7e10('0xa0')]==0x1;if(!_0x2cb9eb){if(ut[_0x7e10('0x9b')](_0x5cd85b)>=_0x566dc1['dialGlobalMaxRetry']){_0x116e08=ut[_0x7e10('0xa2')](_0x5cd85b,0xf,'Global');rpcDb[_0x7e10('0x90')](_0x116e08,_0x7e10('0xf4'));}else{rpcDb[_0x7e10('0x90')](_0x5cd85b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xab')]];}else{_0x188a4e[_0x7e10('0xca')](_0x5cd85b,_0x49e265,_0x418b7e)['then'](function(_0xb8be2a){});}});}if(!(_0x5cd85b[_0x7e10('0x6c')]&&_0x37c98c==='16')){ut['updateOriginated'](_0x566dc1,_0x7e10('0xf5'));logger[_0x7e10('0x59')]('[originated][decrement][callProgressDetectingCustomer]',_0x5cd85b[_0x7e10('0xc0')],_0x7e10('0xb2'),_0x566dc1[_0x7e10('0x26')],_0x7e10('0x6b'),_0x566dc1[_0x7e10('0x4c')]);}if(_0x37c98c!==_0x7e10('0xae')){delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xab')]];delete this[_0x7e10('0x15')][_0x2f2480[_0x7e10('0xf6')]];}}};Preview[_0x7e10('0xd')]['callProgressDetectingAgent']=function(_0xf55b9b,_0x4fac56,_0x203c4f){if(_['isUndefined'](_0x4fac56)&&_0x7e10('0xf7')!==typeof _0x4fac56){return;}if(_[_0x7e10('0xf8')](_0x203c4f)&&_0x7e10('0xf7')!==typeof _0x203c4f){return;}switch(_0x203c4f[_0x7e10('0xf9')]){case'0':ut[_0x7e10('0xfa')](_0xf55b9b,0x0,_0x7e10('0x9c'));rpcDb[_0x7e10('0xfb')](_0xf55b9b,_0x7e10('0xfc'));break;case'3':ut[_0x7e10('0xfa')](_0xf55b9b,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0xf55b9b,_0x7e10('0xfd'));break;case'5':ut[_0x7e10('0xfa')](_0xf55b9b,0x5,'Busy');rpcDb['createAgentHistory'](_0xf55b9b,_0x7e10('0xfe'));break;case'8':ut[_0x7e10('0xfa')](_0xf55b9b,0x8,'Congestion');rpcDb[_0x7e10('0xfb')](_0xf55b9b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x7e10('0xfa')](_0xf55b9b,0x16,_0x7e10('0xff'));rpcDb[_0x7e10('0xfb')](_0xf55b9b,_0x7e10('0x100'));break;default:ut['logAgent'](_0xf55b9b,0xc,_0x203c4f['reason']);rpcDb[_0x7e10('0xfb')](_0xf55b9b,_0x7e10('0x101'));}ut[_0x7e10('0x102')](_0x4fac56,_0x7e10('0x103'));logger[_0x7e10('0x59')](_0x7e10('0x104'),_0xf55b9b[_0x7e10('0xc0')],_0x7e10('0xb2'),_0x4fac56['name'],_0x7e10('0x6b'),_0x4fac56['originated']);delete this[_0x7e10('0x15')][_0xf55b9b[_0x7e10('0xc0')]];};Preview[_0x7e10('0xd')]['verifyAdditionalPhones']=function(_0x57d6af,_0xf8d04e,_0x6bd559){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x7e10('0x9f')](_0x57d6af,_0xf8d04e,_0x6bd559))[_0x7e10('0x73')](logger[_0x7e10('0x59')](_0x7e10('0x105')));};Preview[_0x7e10('0xd')][_0x7e10('0xca')]=function(_0x58a53b,_0x4a8611,_0x277621){return BPromise[_0x7e10('0x106')]()[_0x7e10('0x7f')](cmHopperAdditionalPhone[_0x7e10('0xca')](_0x58a53b,_0x4a8611,_0x277621))[_0x7e10('0x73')](logger[_0x7e10('0x59')](_0x7e10('0x107')));};Preview['prototype'][_0x7e10('0xad')]=function(_0xe2ebb5){return BPromise[_0x7e10('0x106')]()[_0x7e10('0x7f')](cmHopperAdditionalPhone[_0x7e10('0xad')](_0xe2ebb5))[_0x7e10('0x73')](logger[_0x7e10('0x59')](_0x7e10('0x108')));};Preview[_0x7e10('0xd')][_0x7e10('0x109')]=function(_0x4ea3a8,_0x595ce2,_0x2bba90,_0x96315c,_0x3edc03){var _0x109cb6=this;return new BPromise(function(_0x44d9a4,_0x59fb69){if(_[_0x7e10('0x68')](_0x595ce2)||_[_0x7e10('0x68')](_0x595ce2[_0x7e10('0x10a')])||_[_0x7e10('0x68')](_0x595ce2[_0x7e10('0x10b')])||_[_0x7e10('0x68')](_0x595ce2[_0x7e10('0x70')])){_0x59fb69(ut['message'](_0x7e10('0x10c'),_0x96315c,_0x3edc03));return;}var _0x27b56c=uuid['v4']();var _0x2cd82d=_0x109cb6[_0x7e10('0x12')][_0x595ce2[_0x7e10('0x69')]['name']];var _0x4c82b0=_0x2bba90?_0x109cb6[_0x7e10('0x16')][_0x2bba90]['id']:undefined;_0x109cb6[_0x7e10('0x15')][_0x27b56c]=new Action(_0x595ce2,_0x2cd82d,_0x27b56c,_0x2bba90,_0x4c82b0);var _0x3985ab=_0x109cb6[_0x7e10('0x15')][_0x27b56c];_0x3985ab[_0x7e10('0xa9')]=_0x96315c;_0x3985ab['activeContact']=_0x3edc03;_0x3985ab['lookAgent']=_0x2bba90;if(_[_0x7e10('0x10d')](_0x4ea3a8)){_0x109cb6['execCall'](_0x3985ab,_0x2cd82d,_0x595ce2,_0x2bba90)[_0x7e10('0x7f')](function(_0x29fa1a){logger[_0x7e10('0x59')](_0x7e10('0x10e'),_0x7e10('0x10f')+_0x3985ab[_0x7e10('0x6a')]+'\x20IdHopper:\x20'+_0x3985ab[_0x7e10('0xac')],JSON[_0x7e10('0x55')](_0x29fa1a));ami[_0x7e10('0x24')](_0x7e10('0x110'),ut['buildObj'](_0x3985ab,'called',_0x109cb6[_0x7e10('0x12')][_0x3985ab[_0x7e10('0x6a')]]));_0x44d9a4(ut[_0x7e10('0x4b')](_0x7e10('0x111')));})[_0x7e10('0x73')](function(_0x31787e){ut[_0x7e10('0x5f')](_0x7e10('0x112'),_0x31787e);_0x59fb69(ut[_0x7e10('0x4b')]('Call\x20failed',_0x96315c,_0x3edc03));});}else{_0x2cd82d[_0x7e10('0x39')]+=0x1;ut['logBlacklist'](_0x3985ab);rpcDb[_0x7e10('0x113')](_0x3985ab,_0x7e10('0x114'));delete _0x109cb6[_0x7e10('0x15')][_0x27b56c];_0x59fb69(ut[_0x7e10('0x4b')](_0x7e10('0x115'),_0x96315c,_0x3edc03));}});};Preview[_0x7e10('0xd')][_0x7e10('0x94')]=function(_0x46af1c){return!_[_0x7e10('0x68')](_0x46af1c)&&!_[_0x7e10('0x68')](_0x46af1c[_0x7e10('0x26')])&&!_[_0x7e10('0x68')](_0x46af1c[_0x7e10('0x53')])&&_0x46af1c[_0x7e10('0x53')]&&!_[_0x7e10('0x68')](this[_0x7e10('0x14')][util['format'](_0x7e10('0x116'),_0x46af1c[_0x7e10('0x26')])])&&!_[_0x7e10('0x68')](this[_0x7e10('0x14')][util[_0x7e10('0x57')](_0x7e10('0x116'),_0x46af1c[_0x7e10('0x26')])][_0x7e10('0x71')])&&(this[_0x7e10('0x14')][util[_0x7e10('0x57')](_0x7e10('0x116'),_0x46af1c[_0x7e10('0x26')])]['status']==='reachable'||this[_0x7e10('0x14')][util[_0x7e10('0x57')](_0x7e10('0x116'),_0x46af1c[_0x7e10('0x26')])]['status']==='unmonitored');};Preview[_0x7e10('0xd')][_0x7e10('0x83')]=function(_0x4b73d8,_0x49e0a9){var _0xeed1fb=this;return new BPromise(function(_0xf75653,_0x41de0b){_0xeed1fb[_0x7e10('0x117')](_0x4b73d8,_0x49e0a9)[_0x7e10('0x7f')](function(_0x19c620){_0xf75653(_[_0x7e10('0x6d')](_0x19c620,['message']));})['catch'](function(_0x421b3){if(_0x421b3['unlock']){rpcDb[_0x7e10('0x118')](_0x4b73d8);}if(_0x421b3[_0x7e10('0x53')]){rpcDb['disableContact'](_0x4b73d8);}_0x41de0b(_[_0x7e10('0x6d')](_0x421b3,[_0x7e10('0x4b')]));});});};Preview[_0x7e10('0xd')]['execRun']=function(_0x14119a,_0x4c58ad){var _0x5003bc=this;return new BPromise(function(_0x18c2d2,_0x347c7a){var _0x38d49e,_0x1276f3;rpcDb[_0x7e10('0x119')](_0x14119a)[_0x7e10('0x7f')](function(_0x164c0b){if(!_[_0x7e10('0x68')](_0x164c0b[0x0])){_0x1276f3=_0x164c0b[0x0][_0x7e10('0x11a')]?![]:!![];_0x38d49e=_0x164c0b[0x0][_0x7e10('0x11a')]?!![]:![];_0x38d49e=_0x4c58ad?!![]:_0x38d49e;}var _0x49ba8d=_0x5003bc[_0x7e10('0x11b')](_0x164c0b);if(_0x49ba8d['isValid']){rpcDb[_0x7e10('0x11c')](_[_0x7e10('0x6d')](_0x164c0b[0x0],['VoiceQueueId',_0x7e10('0x10b')]))[_0x7e10('0x7f')](function(_0x25cb17){_0x5003bc[_0x7e10('0x109')](_0x25cb17,_0x164c0b[0x0],_0x4c58ad,_0x1276f3,_0x38d49e)[_0x7e10('0x7f')](function(_0x4dc420){_0x18c2d2(_0x4dc420);})[_0x7e10('0x73')](function(_0x494cdd){_0x347c7a(_0x494cdd);});})[_0x7e10('0x73')](function(_0x3c7c8d){ut[_0x7e10('0x5f')](_0x7e10('0x11d'),_0x3c7c8d);_0x347c7a(ut[_0x7e10('0x4b')](_0x7e10('0x11e'),_0x1276f3,_0x38d49e));});}else{_0x347c7a(ut[_0x7e10('0x4b')](_0x49ba8d['message'],_0x1276f3,_0x38d49e));}})['catch'](function(_0x2eb7f9){ut[_0x7e10('0x5f')](_0x7e10('0x11f'),_0x2eb7f9);_0x347c7a(ut[_0x7e10('0x4b')](_0x7e10('0x11e'),![],!![]));});});};Preview[_0x7e10('0xd')][_0x7e10('0x11b')]=function(_0x5a75d4){if(_[_0x7e10('0x68')](_0x5a75d4)||_['isEmpty'](_0x5a75d4)||!_[_0x7e10('0x68')](_0x5a75d4[0x0]['Agent'])&&_['isNil'](_0x5a75d4[0x0][_0x7e10('0x81')][_0x7e10('0x26')])){ut[_0x7e10('0x5f')](_0x7e10('0x120'),_0x5a75d4);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5b1188=this[_0x7e10('0x12')][_0x5a75d4[0x0][_0x7e10('0x69')]['name']];_0x5b1188[_0x7e10('0x4b')]=_0x7e10('0x97');if(_['isNil'](_0x5b1188)){ut[_0x7e10('0x5f')](_0x7e10('0x121'),_0x5b1188);return{'isValid':![],'message':_0x7e10('0x122')};}if(!this[_0x7e10('0x94')](_0x5b1188['Trunk'])){ut[_0x7e10('0x5f')](_0x7e10('0x123'),_0x7e10('0x124')+_0x5b1188[_0x7e10('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x7e10('0x94')](_0x5b1188[_0x7e10('0x95')])){ut[_0x7e10('0x5f')](_0x7e10('0x123'),_0x5b1188[_0x7e10('0x26')]+_0x7e10('0x125'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x7e10('0x93')](_0x5b1188[_0x7e10('0x31')])){ut[_0x7e10('0x5f')](_0x7e10('0x126'),_0x5b1188[_0x7e10('0x26')]+_0x7e10('0x127'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5b1188[_0x7e10('0x26')]+_0x7e10('0x127')};}return{'isValid':!![],'message':_0x7e10('0x128')};};Preview[_0x7e10('0xd')]['execCall']=function(_0x17f754,_0x3b1e53,_0x391648,_0x279f96){var _0x35f58b=this;return new BPromise(function(_0x3d98a8,_0x5e4bd7){var _0x5cfdbf=_0x17f754[_0x7e10('0xc0')];var _0x22a515=_0x35f58b[_0x7e10('0x94')](_0x3b1e53[_0x7e10('0x52')])?util[_0x7e10('0x57')](_0x7e10('0x129'),_0x3b1e53[_0x7e10('0x52')]['name'],_[_0x7e10('0x68')](_0x3b1e53[_0x7e10('0x36')])?'':_0x3b1e53[_0x7e10('0x36')][_0x7e10('0x12a')]()||'',_0x3b1e53[_0x7e10('0x12b')]>0x0?_0x391648[_0x7e10('0x10b')]['substring'](_0x3b1e53[_0x7e10('0x12b')]):_0x391648['phone']):util[_0x7e10('0x57')](_0x7e10('0x129'),_['isNil'](_0x3b1e53[_0x7e10('0x95')])?_0x3b1e53[_0x7e10('0x52')][_0x7e10('0x26')]:_0x3b1e53['TrunkBackup']['name'],_[_0x7e10('0x68')](_0x3b1e53['dialPrefix'])?'':_0x3b1e53[_0x7e10('0x36')][_0x7e10('0x12a')]()||'',_0x3b1e53[_0x7e10('0x12b')]>0x0?_0x391648['phone'][_0x7e10('0x12c')](_0x3b1e53[_0x7e10('0x12b')]):_0x391648[_0x7e10('0x10b')]);var _0xd4a6cc=_0x35f58b[_0x7e10('0x94')](_0x3b1e53[_0x7e10('0x52')])?ut[_0x7e10('0x12d')](_0x3b1e53['Trunk'][_0x7e10('0x12e')],_0x3b1e53[_0x7e10('0x33')],_0x3b1e53[_0x7e10('0x12f')]>0x0?ut[_0x7e10('0x130')](_0x3b1e53[_0x7e10('0x34')],_0x3b1e53[_0x7e10('0x12f')]):_0x3b1e53[_0x7e10('0x34')]):ut[_0x7e10('0x12d')](_[_0x7e10('0x68')](_0x3b1e53[_0x7e10('0x95')])?_0x3b1e53[_0x7e10('0x52')][_0x7e10('0x12e')]:_0x3b1e53['TrunkBackup'][_0x7e10('0x12e')],_0x3b1e53[_0x7e10('0x33')],_0x3b1e53[_0x7e10('0x12f')]>0x0?ut[_0x7e10('0x130')](_0x3b1e53[_0x7e10('0x34')],_0x3b1e53[_0x7e10('0x12f')]):_0x3b1e53[_0x7e10('0x34')]);if(_0xd4a6cc){_0x17f754['originatecalleridname']=ut['extractCalleridName'](_0xd4a6cc);_0x17f754[_0x7e10('0x131')]=ut[_0x7e10('0x132')](_0xd4a6cc);}var _0x566c04=ut[_0x7e10('0x133')](_0x3b1e53,_0x391648,_0x22a515,_0xd4a6cc,_0x5cfdbf,_0x17f754);_[_0x7e10('0x134')](_0x17f754,ut['toLowerVariables'](_0x566c04));_0x17f754[_0x7e10('0x135')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x7e10('0x136')](ut[_0x7e10('0x137')](_0x17f754,_0x3b1e53,_0x566c04,_0x17f754[_0x7e10('0xaa')],_0x279f96))[_0x7e10('0x7f')](function(_0x85fab1){_0x3b1e53[_0x7e10('0x4c')]+=0x1;logger[_0x7e10('0x59')](_0x7e10('0x138'),_0x5cfdbf,_0x7e10('0xb2'),_0x3b1e53[_0x7e10('0x26')],_0x7e10('0x6b'),_0x3b1e53['originated']);_0x3d98a8(_0x85fab1);})[_0x7e10('0x73')](function(_0x2866fb){ut[_0x7e10('0xfa')](_0x17f754,0xe,'OriginateError');rpcDb[_0x7e10('0xfb')](_0x17f754,'[originateFailure][logOriginateFailure]');_0x5e4bd7(_0x2866fb);});});};Preview[_0x7e10('0xd')][_0x7e10('0x1e')]=function(_0x3850cf){if(this[_0x7e10('0x15')][_0x3850cf[_0x7e10('0xab')]]){this[_0x7e10('0x15')][_0x3850cf[_0x7e10('0xab')]]['channel']=_0x3850cf[_0x7e10('0x72')];}};Preview['prototype'][_0x7e10('0x19')]=function(_0xe82c0e){var _0x1dc1b0=this;var _0x50f887=this[_0x7e10('0x15')][_0xe82c0e['actionid']];if(_0x50f887){if(_0x50f887[_0x7e10('0x139')]&&this[_0x7e10('0x16')][_0x50f887['lookAgent']]){ut[_0x7e10('0x13a')](_0x50f887,this[_0x7e10('0x16')][_0x50f887[_0x7e10('0x139')]][_0x7e10('0x26')],this[_0x7e10('0x16')][_0x50f887['lookAgent']]['id']);}var _0x5ce622=_['clone'](_0x50f887);_0x5ce622['responsetime']=moment()[_0x7e10('0x57')](_0x7e10('0x87'));var _0x487ad8=_0x1dc1b0[_0x7e10('0x12')][_0x50f887[_0x7e10('0x6a')]];if(ut['isFailure'](_0xe82c0e['response'])){if(_0x50f887[_0x7e10('0xa9')]){rpcDb['unlockContact'](_0x50f887[_0x7e10('0xac')]);}if(_0x50f887[_0x7e10('0xaa')]){rpcDb[_0x7e10('0x86')](_0x50f887[_0x7e10('0xac')]);}ami[_0x7e10('0x24')]('custom:agentringnoanswer',ut['buildObj'](_0x50f887,_0x7e10('0x13b'),this[_0x7e10('0x12')][_0x50f887[_0x7e10('0x6a')]]));this[_0x7e10('0x13c')](_0x5ce622,_0x487ad8,_0xe82c0e);}else{_0x50f887[_0x7e10('0x135')]=moment()[_0x7e10('0x57')](_0x7e10('0x87'));ut['logAgent'](_0x5ce622,0x4,_0x7e10('0xb9'));rpcDb[_0x7e10('0xfb')](_0x5ce622,_0x7e10('0x13d'));}}};Preview[_0x7e10('0xd')][_0x7e10('0x1b')]=function(_0x565d16){var _0x27e25a=this;var _0xbaf3a7=this[_0x7e10('0x15')][_0x565d16[_0x7e10('0xab')]];var _0x1ad392;if(_0xbaf3a7){_0x1ad392=this[_0x7e10('0x12')][_0xbaf3a7[_0x7e10('0x6a')]];logger['info'](_0x7e10('0x13e'),_0x565d16[_0x7e10('0xab')],_0x7e10('0xb2'),_0x1ad392[_0x7e10('0x26')],_0x7e10('0xc1'),_0x1ad392['pTalking']);}if(this['actions'][_0x565d16['linkedid']]&&_0x565d16[_0x7e10('0xab')]!==_0x565d16[_0x7e10('0xc0')]){if(_0x565d16[_0x7e10('0x13f')]==='16'&&this[_0x7e10('0x15')][_0x565d16[_0x7e10('0xab')]][_0x7e10('0x6c')]){this[_0x7e10('0x98')](_0x565d16,_0x565d16[_0x7e10('0xab')],_0x565d16[_0x7e10('0x13f')]);}else if(this['actions'][_0x565d16['linkedid']][_0x7e10('0x6c')]){logger[_0x7e10('0x59')](_0x7e10('0x140'),_0x565d16[_0x7e10('0xab')],_0x565d16[_0x7e10('0x13f')],_0x7e10('0xb2'),_0x1ad392[_0x7e10('0x26')],_0x7e10('0xc1'),_0x1ad392[_0x7e10('0x2b')]);this['callProgressDetectingCustomer'](_0x565d16,_0x565d16[_0x7e10('0xab')],_0x565d16[_0x7e10('0x13f')]);}}else if(_0xbaf3a7&&_[_0x7e10('0x68')](_0xbaf3a7[_0x7e10('0x141')])&&_0x1ad392[_0x7e10('0x142')]&&_0x565d16[_0x7e10('0xab')]===_0x565d16[_0x7e10('0xc0')]&&_['isNil'](_0x565d16['reason'])&&_0x565d16[_0x7e10('0x13f')]==='16'&&_0x565d16['channelstate']==='6'&&_[_0x7e10('0xf8')](_0xbaf3a7[_0x7e10('0x143')])){if(_0xbaf3a7[_0x7e10('0xa9')]){rpcDb[_0x7e10('0x118')](_0xbaf3a7[_0x7e10('0xac')]);}if(_0xbaf3a7[_0x7e10('0xaa')]){rpcDb['disableContact'](_0xbaf3a7[_0x7e10('0xac')]);}_0x565d16[_0x7e10('0xf9')]='22';this[_0x7e10('0x13c')](_0xbaf3a7,_0x1ad392,_0x565d16);}else if(_0xbaf3a7&&_0xbaf3a7['transfer']){if(_0x565d16[_0x7e10('0x13f')]==='16'&&this[_0x7e10('0x15')][_0x565d16[_0x7e10('0xab')]]['dialAnswer']){logger[_0x7e10('0x59')](_0x7e10('0x144'),_0x565d16[_0x7e10('0xab')],_0x565d16['cause'],_0x7e10('0xb2'),_0x1ad392[_0x7e10('0x26')],_0x7e10('0xc1'),_0x1ad392[_0x7e10('0x2b')]);this[_0x7e10('0x98')](_0x565d16,_0x565d16[_0x7e10('0xab')],_0x565d16[_0x7e10('0x13f')]);}else if(this['actions'][_0x565d16['linkedid']][_0x7e10('0x6c')]){logger[_0x7e10('0x59')]('[syncHangup][talking][cause]',_0x565d16[_0x7e10('0xab')],_0x565d16['cause'],_0x7e10('0xb2'),_0x1ad392[_0x7e10('0x26')],_0x7e10('0xc1'),_0x1ad392[_0x7e10('0x2b')]);this[_0x7e10('0x98')](_0x565d16,_0x565d16['linkedid'],_0x565d16['cause']);}}};Preview['prototype'][_0x7e10('0x1c')]=function(_0x26a193){if(this[_0x7e10('0x15')][_0x26a193[_0x7e10('0xf6')]]&&_0x26a193[_0x7e10('0xf6')]!==_0x26a193['destuniqueid']){this['callProgressDetectingCustomer'](_0x26a193,_0x26a193[_0x7e10('0xf6')],_0x26a193[_0x7e10('0xee')]);}};Preview[_0x7e10('0xd')]['syncHangupRequest']=function(_0x548cad){if(this[_0x7e10('0x15')][_0x548cad[_0x7e10('0xab')]]&&_0x548cad[_0x7e10('0xab')]!==_0x548cad[_0x7e10('0xc0')]&&!this['actions'][_0x548cad['linkedid']][_0x7e10('0x6c')]){if(_0x548cad[_0x7e10('0x13f')]==='1'){this[_0x7e10('0x98')](_0x548cad,_0x548cad[_0x7e10('0xab')],_0x548cad[_0x7e10('0x13f')]);}}};Preview[_0x7e10('0xd')]['addVariable']=function(_0x1489c3,_0x1258b1,_0x9eb7f7){if(this[_0x7e10('0x15')][_0x1489c3]){if(_[_0x7e10('0x68')](this[_0x7e10('0x15')][_0x1489c3][_0x7e10('0x145')])){this[_0x7e10('0x15')][_0x1489c3]['variables']={};}this[_0x7e10('0x15')][_0x1489c3][_0x7e10('0x145')][_0x1258b1]=_0x9eb7f7;}};Preview[_0x7e10('0xd')][_0x7e10('0x20')]=function(_0x570015){try{if(!_[_0x7e10('0x68')](_0x570015)){if(ut['filterKey'](_[_0x7e10('0x146')](_0x570015[_0x7e10('0x147')])[0x0])){this['addVariable'](_0x570015['uniqueid'],_['keys'](_0x570015['variable'])[0x0],_0x570015[_0x7e10('0x148')]);}}}catch(_0x34af96){logger[_0x7e10('0x149')](_0x7e10('0x14a'),util[_0x7e10('0x14b')](_0x34af96,{'showHidden':![],'depth':null}));}};Preview[_0x7e10('0xd')][_0x7e10('0x21')]=function(_0x1ebbca){if(_0x1ebbca){if(this[_0x7e10('0x15')][_0x1ebbca[_0x7e10('0x14c')]]){this[_0x7e10('0x15')][_0x1ebbca[_0x7e10('0x14c')]][_0x7e10('0x143')]=!![];}}};Preview[_0x7e10('0xd')][_0x7e10('0x23')]=function(_0x21a04a){if(_0x21a04a){if(this[_0x7e10('0x15')][_0x21a04a[_0x7e10('0x14d')]]){this[_0x7e10('0x15')][_0x21a04a[_0x7e10('0x14d')]]['transfer']=!![];}}};module[_0x7e10('0x14e')]=Preview; \ No newline at end of file +var _0x7bae=['syncAttendedTransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','loggedIn','pTalking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','status','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','lookAgent','logLookAgent','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','syncHangupRequest','addVariable','variables','filterKey','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncVarSet','attendedtransfer'];(function(_0x3f18ba,_0x34ee38){var _0x1212f1=function(_0x4e89ca){while(--_0x4e89ca){_0x3f18ba['push'](_0x3f18ba['shift']());}};_0x1212f1(++_0x34ee38);}(_0x7bae,0x13b));var _0xe7ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7bae[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe7ba('0x0'));var uuid=require(_0xe7ba('0x1'));var moment=require('moment');var md5=require(_0xe7ba('0x2'));var Redis=require('ioredis');var config=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var loggerAction=require(_0xe7ba('0x4'))(_0xe7ba('0x6'));var ami=require(_0xe7ba('0x7'));var rpcDb=require(_0xe7ba('0x8'));var cmHopperAdditionalPhone=require(_0xe7ba('0x9'));var Action=require(_0xe7ba('0xa'));var ut=require(_0xe7ba('0xb'));config[_0xe7ba('0xc')]=_[_0xe7ba('0xd')](config[_0xe7ba('0xc')],{'host':_0xe7ba('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7ba('0xc')]));var Sequence=function(){};Sequence[_0xe7ba('0xf')][_0xe7ba('0x10')]=function(_0x276bc3){this[_0xe7ba('0x11')]=this[_0xe7ba('0x11')]?this[_0xe7ba('0x11')][_0xe7ba('0x12')](_0x276bc3):_0x276bc3();};function Preview(_0x194447){this['sequence']=new Sequence();this[_0xe7ba('0x13')]=_0x194447['voiceQueues'];this[_0xe7ba('0x14')]=_0x194447[_0xe7ba('0x14')];this[_0xe7ba('0x15')]={};this[_0xe7ba('0x16')]=_0x194447[_0xe7ba('0x16')];this[_0xe7ba('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe7ba('0x18')](this));ami['on'](_0xe7ba('0x19'),this[_0xe7ba('0x1a')]['bind'](this));ami['on'](_0xe7ba('0x1b'),this['syncHangupRequest']['bind'](this));ami['on']('dialend',this[_0xe7ba('0x1c')]['bind'](this));ami['on'](_0xe7ba('0x1d'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xe7ba('0x1e')][_0xe7ba('0x18')](this));ami['on'](_0xe7ba('0x1f'),this[_0xe7ba('0x20')][_0xe7ba('0x18')](this));ami['on']('blindtransfer',this[_0xe7ba('0x21')][_0xe7ba('0x18')](this));this[_0xe7ba('0x22')](this[_0xe7ba('0x13')]);}function emit(_0x4aaf35,_0x1076c5,_0x2936b7){io['to'](_0x4aaf35)['emit'](_0x1076c5,_0x2936b7);}function emitCampaignPreview(_0x191863){if(_0x191863[_0xe7ba('0x23')]===_0xe7ba('0x24')){var _0x7ab9e4={'id':_0x191863['id'],'name':_0x191863[_0xe7ba('0x25')],'strategy':_0x191863[_0xe7ba('0x26')],'answered':_0x191863[_0xe7ba('0x27')],'available':_0x191863[_0xe7ba('0x28')],'loggedIn':_0x191863[_0xe7ba('0x29')],'pTalking':_0x191863[_0xe7ba('0x2a')],'sumBillable':_0x191863['sumBillable'],'sumDuration':_0x191863['sumDuration'],'sumHoldTime':_0x191863['sumHoldTime']||0x0,'talking':_0x191863['talking'],'total':_0x191863[_0xe7ba('0x2b')],'type':_0x191863['type'],'unmanaged':_0x191863['unmanaged'],'abandoned':_0x191863['abandoned'],'waiting':_0x191863[_0xe7ba('0x2c')],'loggedInDb':_0x191863[_0xe7ba('0x2d')],'dialActive':_0x191863[_0xe7ba('0x2e')],'dialMethod':_0x191863[_0xe7ba('0x2f')],'dialOriginateCallerIdName':_0x191863[_0xe7ba('0x30')],'dialOriginateCallerIdNumber':_0x191863[_0xe7ba('0x31')],'dialOriginateTimeout':_0x191863[_0xe7ba('0x32')],'dialPrefix':_0x191863[_0xe7ba('0x33')],'outboundAnswerAgiCallsDay':_0x191863['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x191863[_0xe7ba('0x34')],'outboundBlacklistCallsDay':_0x191863['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x191863[_0xe7ba('0x35')],'outboundCongestionCallsDay':_0x191863[_0xe7ba('0x36')],'outboundDropCallsDayACS':_0x191863[_0xe7ba('0x37')],'outboundDropCallsDayCallersExit':_0x191863['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x191863['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x191863[_0xe7ba('0x38')],'outboundNoSuchCallsDay':_0x191863[_0xe7ba('0x39')],'outboundOriginateFailureCallsDay':_0x191863[_0xe7ba('0x3a')],'outboundReCallsDay':_0x191863[_0xe7ba('0x3b')],'outboundRejectCallsDay':_0x191863[_0xe7ba('0x3c')],'outboundUnknownCallsDay':_0x191863['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x191863[_0xe7ba('0x3d')],'predictiveIntervalAnsweredCalls':_0x191863[_0xe7ba('0x3e')],'predictiveIntervalAvgHoldtime':_0x191863['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x191863[_0xe7ba('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x191863['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x191863['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x191863[_0xe7ba('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x191863[_0xe7ba('0x41')],'predictiveIntervalHitRate':_0x191863[_0xe7ba('0x42')],'predictiveIntervalMultiplicativeFactor':_0x191863['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x191863[_0xe7ba('0x43')],'predictiveIntervalAvailable':_0x191863['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x191863[_0xe7ba('0x44')],'message':_0x191863[_0xe7ba('0x45')],'originated':_0x191863[_0xe7ba('0x46')],'erlangCalls':_0x191863[_0xe7ba('0x47')],'erlangCallToSecond':_0x191863[_0xe7ba('0x48')],'erlangAbandonmentRate':_0x191863['erlangAbandonmentRate'],'erlangBusyFactor':_0x191863[_0xe7ba('0x49')],'startPredictive':_0x191863[_0xe7ba('0x4a')],'startProgressive':_0x191863['startProgressive']};if(_0x191863[_0xe7ba('0x4b')]){_0x7ab9e4[_0xe7ba('0x4b')]={'id':_0x191863[_0xe7ba('0x4b')]['id'],'name':_0x191863['Trunk'][_0xe7ba('0x25')],'active':_0x191863[_0xe7ba('0x4b')]['active'],'callerid':_0x191863[_0xe7ba('0x4b')][_0xe7ba('0x4c')]};}if(_0x191863[_0xe7ba('0x4d')]){_0x7ab9e4['Interval']={'id':_0x191863[_0xe7ba('0x4d')]['id'],'name':_0x191863[_0xe7ba('0x4d')]['name']};}var _0x330e98=md5(JSON[_0xe7ba('0x4e')](_0x7ab9e4));if(_0x191863[_0xe7ba('0x2')]!==_0x330e98){_0x191863['md5']=_0x330e98;emit(util['format'](_0xe7ba('0x4f'),_0x7ab9e4[_0xe7ba('0x25')]),_0xe7ba('0x50'),_0x7ab9e4);}}}function emitVoiceQueueChannelRemove(_0x9bd315){logger[_0xe7ba('0x51')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xe7ba('0x4e')](_0x9bd315));emit(util[_0xe7ba('0x52')](_0xe7ba('0x4f'),_0x9bd315[_0xe7ba('0x25')]),'voice_queue_channel:remove',_0x9bd315);io[_0xe7ba('0x53')](_0xe7ba('0x54'),_0x9bd315);}function notSendMessagesQueue(_0x46e31a){if(_0x46e31a[_0xe7ba('0x55')]){if(_0x46e31a[_0xe7ba('0x46')]===0x0&&_0x46e31a[_0xe7ba('0x2a')]===0x0){_0x46e31a[_0xe7ba('0x55')]=![];_0x46e31a['available']=0x0;_0x46e31a[_0xe7ba('0x56')]=0x0;_0x46e31a[_0xe7ba('0x45')]=_0xe7ba('0x57');ut[_0xe7ba('0x58')](_0xe7ba('0x59'),_0x46e31a[_0xe7ba('0x25')]+_0xe7ba('0x5a'));}else{_0x46e31a[_0xe7ba('0x45')]=_0xe7ba('0x5b');ut['logger'](_0xe7ba('0x59'),_0x46e31a[_0xe7ba('0x25')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x46e31a);}}Preview['prototype'][_0xe7ba('0x22')]=function(){var _0xf4bf4a=this;setInterval(function(){_0xf4bf4a[_0xe7ba('0x5c')]();},0x7cf);};Preview['prototype'][_0xe7ba('0x5c')]=function(){var _0x82246e=this[_0xe7ba('0x13')];this[_0xe7ba('0x17')]+=0x1;for(var _0xac3f51 in _0x82246e){if(_0x82246e['hasOwnProperty'](_0xac3f51)&&(_0x82246e[_0xac3f51][_0xe7ba('0x2f')]==='preview'||_0x82246e[_0xac3f51][_0xe7ba('0x2f')]===_0xe7ba('0x5d'))&&_0x82246e[_0xac3f51][_0xe7ba('0x23')]===_0xe7ba('0x24')){if(this[_0xe7ba('0x17')]>0x7){this[_0xe7ba('0x17')]=0x0;this[_0xe7ba('0x5e')]();}}if(_0x82246e[_0xe7ba('0x5f')](_0xac3f51)&&_0x82246e[_0xac3f51]['dialMethod']===_0xe7ba('0x5')&&_0x82246e[_0xac3f51][_0xe7ba('0x23')]===_0xe7ba('0x24')){if(_0x82246e[_0xac3f51][_0xe7ba('0x2e')]){this[_0xe7ba('0x60')](_0x82246e[_0xac3f51]);if(_0x82246e[_0xac3f51][_0xe7ba('0x61')])this[_0xe7ba('0x62')](_0x82246e[_0xac3f51]);}else{notSendMessagesQueue(_0x82246e[_0xac3f51]);}}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x63')]=function(_0x46c456){var _0x4bccc4=this;this[_0xe7ba('0x64')]['enqueue'](function(){if(!_[_0xe7ba('0x65')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456])){loggerAction[_0xe7ba('0x51')](_0xe7ba('0x66'),_0x46c456,_0xe7ba('0x67'),_0x4bccc4[_0xe7ba('0x15')][_0x46c456]['queue'],_0xe7ba('0x68'),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]][_0xe7ba('0x46')]),_0xe7ba('0x6a'),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]]['pTalking']),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x6b')]),JSON[_0xe7ba('0x4e')](_[_0xe7ba('0x6c')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456],['contactId',_0xe7ba('0x6d'),_0xe7ba('0x6e'),'ListId'])));return ami[_0xe7ba('0x6f')]({'action':_0xe7ba('0x70'),'channel':_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x71')]})['catch'](function(_0x54e2ad){if(_0x54e2ad[_0xe7ba('0x45')]===_0xe7ba('0x72')){setTimeout(function(){if(_0x4bccc4[_0xe7ba('0x15')][_0x46c456]){ut['updateOriginated'](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]],_0xe7ba('0x73'));if(_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x6b')]===!![]){ut[_0xe7ba('0x74')](_0x4bccc4['campaignsPreview'][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]],_0xe7ba('0x73'));ut['loggerError'](_0xe7ba('0x75')+_0x46c456,_0x4bccc4[_0xe7ba('0x15')][_0x46c456]['queue']);}ut[_0xe7ba('0x76')](_0xe7ba('0x77')+_0x46c456,_0x4bccc4['actions'][_0x46c456][_0xe7ba('0x69')]);delete _0x4bccc4['actions'][_0x46c456];}},0x2328);}});}});};Preview[_0xe7ba('0xf')][_0xe7ba('0x5e')]=function(){var _0x30df6b=this;loggerAction['info'](_0xe7ba('0x78'),_[_0xe7ba('0x79')](this[_0xe7ba('0x15')]));for(var _0x2e76ec in this[_0xe7ba('0x15')]){if(_0x30df6b['actions'][_0xe7ba('0x5f')](_0x2e76ec)){_0x30df6b[_0xe7ba('0x63')](_0x2e76ec);}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x62')]=function(_0x435dee){var _0x50aecc=this;rpcDb[_0xe7ba('0x7a')](_0x435dee['id'],ut[_0xe7ba('0x7b')](this[_0xe7ba('0x16')]))[_0xe7ba('0x7c')](function(_0x57b23e){if(!_[_0xe7ba('0x65')](_0x57b23e)){for(var _0x28e3cf=0x0;_0x28e3cf<_0x57b23e[_0xe7ba('0x7d')];_0x28e3cf+=0x1){if(ut[_0xe7ba('0x7e')](_0x57b23e[_0x28e3cf][_0xe7ba('0x7f')])<_0x435dee[_0xe7ba('0x80')]*0x3c){if(_0x57b23e[_0x28e3cf]['Agent']&&!_0x57b23e[_0x28e3cf][_0xe7ba('0x81')][_0xe7ba('0x82')]){_0x50aecc[_0xe7ba('0x83')](_0x57b23e[_0x28e3cf]['id'])['then'](ut[_0xe7ba('0x84')](_0xe7ba('0x85')))[_0xe7ba('0x86')](ut[_0xe7ba('0x84')](_0xe7ba('0x85')));}else{rpcDb[_0xe7ba('0x87')](_0x57b23e[_0x28e3cf]['id']);}}else{var _0x3a7bfb=new Action(_0x57b23e[_0x28e3cf],_0x435dee);_0x3a7bfb[_0xe7ba('0x88')]=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));_0x435dee[_0xe7ba('0x3b')]+=0x1;ut[_0xe7ba('0x8a')](_0x3a7bfb,0x17,'RecallInQueue');if(_0x435dee[_0xe7ba('0x8b')]){rpcDb[_0xe7ba('0x8c')](ut[_0xe7ba('0x8d')](_0x57b23e[_0x28e3cf]));rpcDb['createCustomerHistory'](_0x3a7bfb,_0xe7ba('0x8e'));}else{ut['logCustomer'](_0x3a7bfb,0x16,_0xe7ba('0x8f'));rpcDb[_0xe7ba('0x90')](_0x3a7bfb,_0xe7ba('0x91'));rpcDb['createCustomerFinal'](_0x3a7bfb,'[HistoryRecallClose]');}}}}})[_0xe7ba('0x86')](ut[_0xe7ba('0x84')](_0xe7ba('0x92')));};Preview['prototype'][_0xe7ba('0x60')]=function(_0x6866ef){_0x6866ef[_0xe7ba('0x55')]=!![];if(ut[_0xe7ba('0x93')](_0x6866ef[_0xe7ba('0x29')])){_0x6866ef['message']=_0xe7ba('0x94');}else if(!ut[_0xe7ba('0x95')](_0x6866ef[_0xe7ba('0x2e')])){_0x6866ef['message']=_0xe7ba('0x57');}else if(!this[_0xe7ba('0x96')](_0x6866ef[_0xe7ba('0x4b')])){if(!this[_0xe7ba('0x96')](_0x6866ef[_0xe7ba('0x97')])){_0x6866ef[_0xe7ba('0x45')]=_0xe7ba('0x98');}else{_0x6866ef[_0xe7ba('0x45')]=_0xe7ba('0x99');}}else{_0x6866ef[_0xe7ba('0x45')]='ACTIVE';}emitCampaignPreview(_0x6866ef);};Preview[_0xe7ba('0xf')][_0xe7ba('0x9a')]=function(_0x344d29,_0xa6da9e,_0x4d8773){var _0x4c0d12=this;var _0x103eb8=this[_0xe7ba('0x15')][_0xa6da9e];var _0x10bd7c=this['campaignsPreview'][_0x103eb8['queue']];var _0x5561cc;var _0x15c4c9=![];var _0x42925d=0x2;var _0x4c64eb=0x3;if(_0x10bd7c){switch(_0x4d8773){case'1':_0x10bd7c[_0xe7ba('0x39')]+=0x1;_0x103eb8['countnosuchnumberretry']+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut['totalGlobal'](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x0,'NoSuchNumber');ami['emit'](_0xe7ba('0x9c'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0x9e')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0x9f'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'0',_0x10bd7c)['then'](function(_0x5a3591){_0x15c4c9=_0x5a3591[_0xe7ba('0xa1')]==0x1;_0x42925d=_0x10bd7c[_0xe7ba('0xa2')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xa9'));}else{if(_0x103eb8[_0xe7ba('0xaa')]>=_0x10bd7c[_0xe7ba('0xab')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xa9'));}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,'countnosuchnumberretry',_0x10bd7c[_0xe7ba('0xa2')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];}else{_0x103eb8[_0xe7ba('0xaa')]++;logger[_0xe7ba('0x51')](_0xe7ba('0xb1'),_0x103eb8[_0xe7ba('0xaa')]);logger[_0xe7ba('0x51')]('id',_0x103eb8[_0xe7ba('0xb2')]);_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnosuchnumberretry':_0x103eb8[_0xe7ba('0xaa')]}})['then'](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xb5'):var _0x53187a=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));_0x103eb8[_0xe7ba('0xb6')]=_0x53187a;_0x103eb8[_0xe7ba('0xb7')]=_0x53187a;_0x103eb8['dialAnswer']=!![];_0x10bd7c[_0xe7ba('0x2a')]+=0x1;logger[_0xe7ba('0x51')](_0xe7ba('0xb8'),_0x103eb8[_0xe7ba('0xb9')],'\x20Queue',_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x10bd7c[_0xe7ba('0x2a')]);ami[_0xe7ba('0x53')](_0xe7ba('0xba'),ut['buildObj'](_0x103eb8,'connect',this['campaignsPreview'][_0x103eb8[_0xe7ba('0x69')]]));if(_0x10bd7c[_0xe7ba('0xbb')]){ami[_0xe7ba('0x53')](_0xe7ba('0xbc'),ut[_0xe7ba('0xbd')](_0x103eb8));}break;case'16':ami[_0xe7ba('0x53')]('custom:agentcomplete',ut[_0xe7ba('0x9d')](_0x103eb8,'complete',this[_0xe7ba('0x13')][_0x103eb8[_0xe7ba('0x69')]]));emitVoiceQueueChannelRemove(ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xbe')));_0x10bd7c[_0xe7ba('0x34')]+=0x1;_0x10bd7c[_0xe7ba('0x2b')]+=0x1;_0x10bd7c['answered']+=0x1;ut[_0xe7ba('0x74')](_0x10bd7c,_0xe7ba('0xbf'));_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x4,'Answer');rpcDb[_0xe7ba('0x90')](_0x103eb8,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xc0'));rpcDb[_0xe7ba('0xc1')](_0x103eb8);_0x10bd7c[_0xe7ba('0xc2')]+=_0x103eb8[_0xe7ba('0xc3')];_0x10bd7c[_0xe7ba('0xc4')]+=_0x103eb8[_0xe7ba('0xc3')];logger[_0xe7ba('0x51')](_0xe7ba('0xc5'),_0x103eb8[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x10bd7c[_0xe7ba('0x2a')]);delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];break;case _0xe7ba('0xc7'):_0x10bd7c[_0xe7ba('0x35')]+=0x1;_0x103eb8[_0xe7ba('0xc8')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x5,_0xe7ba('0xc9'));_0x42925d=_0x10bd7c[_0xe7ba('0xca')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami['emit']('custom:agentbusy',ut['buildObj'](_0x103eb8,_0xe7ba('0xcb')));rpcDb[_0xe7ba('0x90')](_0x103eb8,'[callProgressDetectingCustomer][logBusy]');_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'5',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x271769){_0x15c4c9=_0x271769['additional']==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c['dialGlobalMaxRetry']){_0x5561cc=ut['cloneAction'](_0x103eb8,0xf,'Global');rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xcc'));}else{if(_0x103eb8[_0xe7ba('0xc8')]>=_0x10bd7c[_0xe7ba('0xcd')]){rpcDb['createCustomerFinal'](_0x103eb8,_0xe7ba('0xce'));}else{rpcDb[_0xe7ba('0xac')](ut['scheduledAt'](_0x103eb8,'countbusyretry',_0x10bd7c[_0xe7ba('0xca')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xc8')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countbusyretry':_0x103eb8[_0xe7ba('0xc8')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xcf'):_0x10bd7c[_0xe7ba('0x38')]+=0x1;_0x103eb8[_0xe7ba('0xd0')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x3,_0xe7ba('0xd1'));_0x42925d=_0x10bd7c[_0xe7ba('0xd2')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xd3'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xd4')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xd5'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'3',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x511a7a){_0x15c4c9=_0x511a7a['additional']==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xd6'));}else{if(_0x103eb8['countnoanswerretry']>=_0x10bd7c['dialNoAnswerMaxRetry']){rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xd0'),_0x10bd7c[_0xe7ba('0xd2')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)['then'](function(){});});}});break;case'CONGESTION':_0x10bd7c[_0xe7ba('0x36')]+=0x1;_0x103eb8[_0xe7ba('0xd7')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut['logCustomer'](_0x103eb8,0x8,_0xe7ba('0xd8'));_0x42925d=_0x10bd7c[_0xe7ba('0xd9')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xda'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xdb')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xdc'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'8',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x195342){_0x15c4c9=_0x195342[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,'Global');rpcDb['createCustomerFinal'](_0x5561cc,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x103eb8[_0xe7ba('0xd7')]>=_0x10bd7c[_0xe7ba('0xdd')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xd7'),_0x10bd7c[_0xe7ba('0xca')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd7')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countcongestionretry':_0x103eb8[_0xe7ba('0xd7')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case'CANCEL':_0x10bd7c[_0xe7ba('0x3c')]+=0x1;_0x103eb8['countagentrejectretry']+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x14,_0xe7ba('0xde'));_0x42925d=_0x10bd7c[_0xe7ba('0xdf')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xe0'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xe1')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xe2'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'20',_0x10bd7c)['then'](function(_0x17267b){_0x15c4c9=_0x17267b[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut['cloneAction'](_0x103eb8,0x14,_0xe7ba('0xde'));rpcDb['createCustomerFinal'](_0x5561cc,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x103eb8[_0xe7ba('0xe3')]>=_0x10bd7c[_0xe7ba('0xe4')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xe5'));}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xe3'),_0x10bd7c[_0xe7ba('0xdf')]),_0x103eb8['unlockAgent'],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12['incrementPreviewCounters']({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xe6'):_0x10bd7c[_0xe7ba('0x3d')]+=0x1;_0x103eb8[_0xe7ba('0xe7')]+=0x1;_0x103eb8['countglobal']=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0xb,_0xe7ba('0xe8'));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xe9'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'11',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x344ddd){_0x15c4c9=_0x344ddd[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xe9'));}else{if(_0x103eb8[_0xe7ba('0xea')]>=_0x10bd7c[_0xe7ba('0xeb')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xe9'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x103eb8,_0xe7ba('0xe7'),_0x10bd7c[_0xe7ba('0xec')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12['swapAdditionalPhones'](_0x103eb8,_0x42925d,_0x4c64eb)['then'](function(){});});}});break;case'18':_0x10bd7c['outboundUnknownCallsDay']+=0x1;_0x103eb8[_0xe7ba('0xed')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut['logCustomer'](_0x103eb8,0x12,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);ami[_0xe7ba('0x53')](_0xe7ba('0xf0'),ut['buildObj'](_0x103eb8,'amd'));rpcDb['createCustomerHistory'](_0x103eb8,'[callProgressDetectingCustomer][hangupInAMD]');_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'18',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x2d4926){_0x15c4c9=_0x2d4926[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c['dialGlobalMaxRetry']){_0x5561cc=ut['cloneAction'](_0x103eb8,0x12,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x103eb8,_0xe7ba('0xf1'));}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});delete this['actions'][_0x344d29[_0xe7ba('0xb0')]];break;case'19':_0x10bd7c[_0xe7ba('0xf2')]+=0x1;_0x103eb8['countglobal']=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x13,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);ami[_0xe7ba('0x53')]('custom:amd',ut['buildObj'](_0x103eb8,_0xe7ba('0xf3')));rpcDb['createCustomerHistory'](_0x103eb8,_0xe7ba('0xf4'));_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'18',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x24ce3b){_0x15c4c9=_0x24ce3b['additional']==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xf4'));}else{rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][machine]');}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12['incrementPreviewCounters']({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});delete this[_0xe7ba('0x15')][_0x344d29['linkedid']];break;default:if(_0x103eb8[_0xe7ba('0x6b')]){ut[_0xe7ba('0x74')](_0x10bd7c,'[default]');ut[_0xe7ba('0x76')](_0xe7ba('0xf5')+_0x10bd7c['name'],_0x344d29);}_0x10bd7c[_0xe7ba('0xf2')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0xc,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);_0x42925d=_0x10bd7c[_0xe7ba('0xdf')];_0x4c64eb=_0x10bd7c['callAdditionalPhoneAfterMin'];rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xf6'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'20',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x20ef6b){_0x15c4c9=_0x20ef6b['additional']==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,'Global');rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xf7'));}else{rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x344d29[_0xe7ba('0xb0')]];}else{_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(_0x12ff21){});}});}if(!(_0x103eb8[_0xe7ba('0x6b')]&&_0x4d8773==='16')){ut[_0xe7ba('0xf8')](_0x10bd7c,_0xe7ba('0xf9'));logger[_0xe7ba('0x51')](_0xe7ba('0xfa'),_0x103eb8[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x10bd7c['originated']);}if(_0x4d8773!==_0xe7ba('0xb5')){delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];delete this['actions'][_0x344d29['destlinkedid']];}}};Preview[_0xe7ba('0xf')][_0xe7ba('0xfb')]=function(_0xe364a6,_0x481d16,_0xd1f6a9){if(_[_0xe7ba('0xfc')](_0x481d16)&&'object'!==typeof _0x481d16){return;}if(_[_0xe7ba('0xfc')](_0xd1f6a9)&&_0xe7ba('0xfd')!==typeof _0xd1f6a9){return;}switch(_0xd1f6a9[_0xe7ba('0xfe')]){case'0':ut[_0xe7ba('0xff')](_0xe364a6,0x0,_0xe7ba('0x100'));rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x102'));break;case'3':ut[_0xe7ba('0xff')](_0xe364a6,0x3,_0xe7ba('0xd1'));rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x103'));break;case'5':ut[_0xe7ba('0xff')](_0xe364a6,0x5,'Busy');rpcDb['createAgentHistory'](_0xe364a6,_0xe7ba('0x104'));break;case'8':ut['logAgent'](_0xe364a6,0x8,'Congestion');rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x105'));break;case'22':ut[_0xe7ba('0xff')](_0xe364a6,0x16,'AnswerAGI');rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x106'));break;default:ut[_0xe7ba('0xff')](_0xe364a6,0xc,_0xd1f6a9[_0xe7ba('0xfe')]);rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x105'));}ut['updateOriginated'](_0x481d16,_0xe7ba('0x107'));logger[_0xe7ba('0x51')](_0xe7ba('0x108'),_0xe364a6[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x481d16[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x481d16[_0xe7ba('0x46')]);delete this[_0xe7ba('0x15')][_0xe364a6[_0xe7ba('0xb9')]];};Preview[_0xe7ba('0xf')][_0xe7ba('0xa0')]=function(_0x1f8440,_0x3e574c,_0x4d094d){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone[_0xe7ba('0xa0')](_0x1f8440,_0x3e574c,_0x4d094d))[_0xe7ba('0x86')](logger[_0xe7ba('0x51')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe7ba('0xf')][_0xe7ba('0xb4')]=function(_0x46a66e,_0x3d186e,_0x24ad68){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46a66e,_0x3d186e,_0x24ad68))[_0xe7ba('0x86')](logger['info'](_0xe7ba('0x10a')));};Preview[_0xe7ba('0xf')][_0xe7ba('0xb3')]=function(_0x5e8020){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone[_0xe7ba('0xb3')](_0x5e8020))[_0xe7ba('0x86')](logger[_0xe7ba('0x51')](_0xe7ba('0x10b')));};Preview[_0xe7ba('0xf')][_0xe7ba('0x10c')]=function(_0x4a9f46,_0x185a05,_0xcf12d8,_0x2d6d14,_0x3b9fdd){var _0x1e6665=this;return new BPromise(function(_0x209e82,_0x48043b){if(_[_0xe7ba('0x65')](_0x185a05)||_[_0xe7ba('0x65')](_0x185a05[_0xe7ba('0x10d')])||_['isNil'](_0x185a05[_0xe7ba('0x10e')])||_[_0xe7ba('0x65')](_0x185a05[_0xe7ba('0x6e')])){_0x48043b(ut[_0xe7ba('0x45')](_0xe7ba('0x10f'),_0x2d6d14,_0x3b9fdd));return;}var _0x3f1ef6=uuid['v4']();var _0x397b66=_0x1e6665['campaignsPreview'][_0x185a05[_0xe7ba('0x67')][_0xe7ba('0x25')]];var _0x3304e4=_0xcf12d8?_0x1e6665[_0xe7ba('0x16')][_0xcf12d8]['id']:undefined;_0x1e6665[_0xe7ba('0x15')][_0x3f1ef6]=new Action(_0x185a05,_0x397b66,_0x3f1ef6,_0xcf12d8,_0x3304e4);var _0x539f0e=_0x1e6665[_0xe7ba('0x15')][_0x3f1ef6];_0x539f0e[_0xe7ba('0xae')]=_0x2d6d14;_0x539f0e[_0xe7ba('0xaf')]=_0x3b9fdd;_0x539f0e['lookAgent']=_0xcf12d8;if(_['isEmpty'](_0x4a9f46)){_0x1e6665[_0xe7ba('0x110')](_0x539f0e,_0x397b66,_0x185a05,_0xcf12d8)['then'](function(_0x4baf24){logger[_0xe7ba('0x51')](_0xe7ba('0x111'),_0xe7ba('0x112')+_0x539f0e[_0xe7ba('0x69')]+_0xe7ba('0x113')+_0x539f0e[_0xe7ba('0xb2')],JSON[_0xe7ba('0x4e')](_0x4baf24));ami[_0xe7ba('0x53')](_0xe7ba('0x114'),ut[_0xe7ba('0x9d')](_0x539f0e,_0xe7ba('0x115'),_0x1e6665[_0xe7ba('0x13')][_0x539f0e[_0xe7ba('0x69')]]));_0x209e82(ut[_0xe7ba('0x45')](_0xe7ba('0x116')));})[_0xe7ba('0x86')](function(_0x598ccb){ut[_0xe7ba('0x58')](_0xe7ba('0x117'),_0x598ccb);_0x48043b(ut[_0xe7ba('0x45')]('Call\x20failed',_0x2d6d14,_0x3b9fdd));});}else{_0x397b66[_0xe7ba('0x118')]+=0x1;ut[_0xe7ba('0x119')](_0x539f0e);rpcDb[_0xe7ba('0x11a')](_0x539f0e,_0xe7ba('0x11b'));delete _0x1e6665[_0xe7ba('0x15')][_0x3f1ef6];_0x48043b(ut[_0xe7ba('0x45')](_0xe7ba('0x11c'),_0x2d6d14,_0x3b9fdd));}});};Preview['prototype'][_0xe7ba('0x96')]=function(_0xc8d663){return!_['isNil'](_0xc8d663)&&!_[_0xe7ba('0x65')](_0xc8d663[_0xe7ba('0x25')])&&!_[_0xe7ba('0x65')](_0xc8d663[_0xe7ba('0x11d')])&&_0xc8d663['active']&&!_['isNil'](this[_0xe7ba('0x14')][util[_0xe7ba('0x52')](_0xe7ba('0x11e'),_0xc8d663['name'])])&&!_[_0xe7ba('0x65')](this[_0xe7ba('0x14')][util[_0xe7ba('0x52')]('SIP/%s',_0xc8d663[_0xe7ba('0x25')])][_0xe7ba('0x70')])&&(this[_0xe7ba('0x14')][util[_0xe7ba('0x52')](_0xe7ba('0x11e'),_0xc8d663[_0xe7ba('0x25')])]['status']===_0xe7ba('0x11f')||this['trunks'][util[_0xe7ba('0x52')]('SIP/%s',_0xc8d663['name'])][_0xe7ba('0x70')]===_0xe7ba('0x120'));};Preview[_0xe7ba('0xf')]['run']=function(_0x590302,_0x43e7ae){var _0x58d6b6=this;return new BPromise(function(_0x46e23b,_0x4326e7){_0x58d6b6[_0xe7ba('0x121')](_0x590302,_0x43e7ae)['then'](function(_0x460955){_0x46e23b(_['pick'](_0x460955,[_0xe7ba('0x45')]));})[_0xe7ba('0x86')](function(_0x3d0629){if(_0x3d0629[_0xe7ba('0x122')]){rpcDb[_0xe7ba('0x123')](_0x590302);}if(_0x3d0629[_0xe7ba('0x11d')]){rpcDb[_0xe7ba('0x87')](_0x590302);}_0x4326e7(_[_0xe7ba('0x6c')](_0x3d0629,[_0xe7ba('0x45')]));});});};Preview[_0xe7ba('0xf')]['execRun']=function(_0x271c92,_0x57369d){var _0xfd8ca5=this;return new BPromise(function(_0x36a876,_0xb69f38){var _0x3e0c94,_0x56a3b1;rpcDb[_0xe7ba('0x124')](_0x271c92)['then'](function(_0x1dce67){if(!_[_0xe7ba('0x65')](_0x1dce67[0x0])){_0x56a3b1=_0x1dce67[0x0]['recallme']?![]:!![];_0x3e0c94=_0x1dce67[0x0][_0xe7ba('0x125')]?!![]:![];_0x3e0c94=_0x57369d?!![]:_0x3e0c94;}var _0x32997a=_0xfd8ca5['validateContact'](_0x1dce67);if(_0x32997a[_0xe7ba('0x126')]){rpcDb[_0xe7ba('0x127')](_[_0xe7ba('0x6c')](_0x1dce67[0x0],[_0xe7ba('0x6e'),_0xe7ba('0x10e')]))['then'](function(_0x1dd95a){_0xfd8ca5['checkInBlack'](_0x1dd95a,_0x1dce67[0x0],_0x57369d,_0x56a3b1,_0x3e0c94)[_0xe7ba('0x7c')](function(_0x28877c){_0x36a876(_0x28877c);})[_0xe7ba('0x86')](function(_0x444304){_0xb69f38(_0x444304);});})[_0xe7ba('0x86')](function(_0x501ba7){ut['logger']('[Preview][checkIsBlackList]',_0x501ba7);_0xb69f38(ut['message'](_0xe7ba('0x128'),_0x56a3b1,_0x3e0c94));});}else{_0xb69f38(ut[_0xe7ba('0x45')](_0x32997a[_0xe7ba('0x45')],_0x56a3b1,_0x3e0c94));}})[_0xe7ba('0x86')](function(_0x4d615b){ut[_0xe7ba('0x58')](_0xe7ba('0x129'),_0x4d615b);_0xb69f38(ut[_0xe7ba('0x45')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xe7ba('0xf')]['validateContact']=function(_0x5ce535){if(_[_0xe7ba('0x65')](_0x5ce535)||_[_0xe7ba('0x12a')](_0x5ce535)||!_[_0xe7ba('0x65')](_0x5ce535[0x0][_0xe7ba('0x81')])&&_[_0xe7ba('0x65')](_0x5ce535[0x0][_0xe7ba('0x81')][_0xe7ba('0x25')])){ut[_0xe7ba('0x58')]('[Preview][validateContact][Empty\x20Contact]',_0x5ce535);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2b09bc=this[_0xe7ba('0x13')][_0x5ce535[0x0][_0xe7ba('0x67')]['name']];_0x2b09bc[_0xe7ba('0x45')]=_0xe7ba('0x99');if(_['isNil'](_0x2b09bc)){ut[_0xe7ba('0x58')]('[Preview][validateContact][Empty\x20Campaign]',_0x2b09bc);return{'isValid':![],'message':_0xe7ba('0x12b')};}if(!this[_0xe7ba('0x96')](_0x2b09bc[_0xe7ba('0x4b')])){ut['logger'](_0xe7ba('0x12c'),_0xe7ba('0x12d')+_0x2b09bc[_0xe7ba('0x25')]+_0xe7ba('0x12e'));if(!this[_0xe7ba('0x96')](_0x2b09bc[_0xe7ba('0x97')])){ut[_0xe7ba('0x58')](_0xe7ba('0x12c'),_0x2b09bc[_0xe7ba('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe7ba('0x12f')};}}if(!ut[_0xe7ba('0x95')](_0x2b09bc[_0xe7ba('0x2e')])){ut[_0xe7ba('0x58')](_0xe7ba('0x130'),_0x2b09bc[_0xe7ba('0x25')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe7ba('0x12d')+_0x2b09bc['name']+_0xe7ba('0x131')};}return{'isValid':!![],'message':_0xe7ba('0x132')};};Preview[_0xe7ba('0xf')][_0xe7ba('0x110')]=function(_0x5e4cf7,_0x254649,_0x5aadc3,_0x57c753){var _0x5a5071=this;return new BPromise(function(_0x5bc97c,_0xa8e027){var _0x5dd240=_0x5e4cf7[_0xe7ba('0xb9')];var _0x562a78=_0x5a5071[_0xe7ba('0x96')](_0x254649[_0xe7ba('0x4b')])?util[_0xe7ba('0x52')](_0xe7ba('0x133'),_0x254649[_0xe7ba('0x4b')][_0xe7ba('0x25')],_['isNil'](_0x254649[_0xe7ba('0x33')])?'':_0x254649[_0xe7ba('0x33')][_0xe7ba('0x134')]()||'',_0x254649[_0xe7ba('0x135')]>0x0?_0x5aadc3[_0xe7ba('0x10e')][_0xe7ba('0x136')](_0x254649[_0xe7ba('0x135')]):_0x5aadc3[_0xe7ba('0x10e')]):util[_0xe7ba('0x52')](_0xe7ba('0x133'),_['isNil'](_0x254649[_0xe7ba('0x97')])?_0x254649['Trunk'][_0xe7ba('0x25')]:_0x254649[_0xe7ba('0x97')]['name'],_[_0xe7ba('0x65')](_0x254649[_0xe7ba('0x33')])?'':_0x254649[_0xe7ba('0x33')][_0xe7ba('0x134')]()||'',_0x254649[_0xe7ba('0x135')]>0x0?_0x5aadc3['phone'][_0xe7ba('0x136')](_0x254649[_0xe7ba('0x135')]):_0x5aadc3[_0xe7ba('0x10e')]);var _0x1d31d3=_0x5a5071[_0xe7ba('0x96')](_0x254649[_0xe7ba('0x4b')])?ut[_0xe7ba('0x137')](_0x254649[_0xe7ba('0x4b')][_0xe7ba('0x4c')],_0x254649[_0xe7ba('0x30')],_0x254649['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x254649['dialOriginateCallerIdNumber'],_0x254649['dialRandomLastDigitCallerIdNumber']):_0x254649[_0xe7ba('0x31')]):ut['getCallerId'](_['isNil'](_0x254649[_0xe7ba('0x97')])?_0x254649['Trunk']['callerid']:_0x254649[_0xe7ba('0x97')]['callerid'],_0x254649[_0xe7ba('0x30')],_0x254649['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe7ba('0x138')](_0x254649['dialOriginateCallerIdNumber'],_0x254649[_0xe7ba('0x139')]):_0x254649[_0xe7ba('0x31')]);if(_0x1d31d3){_0x5e4cf7[_0xe7ba('0x13a')]=ut['extractCalleridName'](_0x1d31d3);_0x5e4cf7[_0xe7ba('0x13b')]=ut[_0xe7ba('0x13c')](_0x1d31d3);}var _0x3ac7fa=ut['addVariables'](_0x254649,_0x5aadc3,_0x562a78,_0x1d31d3,_0x5dd240,_0x5e4cf7);_[_0xe7ba('0x13d')](_0x5e4cf7,ut[_0xe7ba('0x13e')](_0x3ac7fa));_0x5e4cf7['starttime']=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));ami[_0xe7ba('0x6f')](ut['variablesAction'](_0x5e4cf7,_0x254649,_0x3ac7fa,_0x5e4cf7['activeContact'],_0x57c753))[_0xe7ba('0x7c')](function(_0x1865f7){_0x254649[_0xe7ba('0x46')]+=0x1;logger[_0xe7ba('0x51')](_0xe7ba('0x13f'),_0x5dd240,_0xe7ba('0xc6'),_0x254649[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x254649[_0xe7ba('0x46')]);_0x5bc97c(_0x1865f7);})[_0xe7ba('0x86')](function(_0x343aad){ut[_0xe7ba('0xff')](_0x5e4cf7,0xe,'OriginateError');rpcDb[_0xe7ba('0x101')](_0x5e4cf7,_0xe7ba('0x140'));_0xa8e027(_0x343aad);});});};Preview[_0xe7ba('0xf')][_0xe7ba('0x141')]=function(_0xf14f0c){if(this[_0xe7ba('0x15')][_0xf14f0c[_0xe7ba('0xb0')]]){this[_0xe7ba('0x15')][_0xf14f0c['linkedid']][_0xe7ba('0x71')]=_0xf14f0c[_0xe7ba('0x71')];}};Preview[_0xe7ba('0xf')][_0xe7ba('0x142')]=function(_0xb7948d){var _0x34f6b1=this;var _0x34518a=this[_0xe7ba('0x15')][_0xb7948d['actionid']];if(_0x34518a){if(_0x34518a[_0xe7ba('0x143')]&&this[_0xe7ba('0x16')][_0x34518a[_0xe7ba('0x143')]]){ut[_0xe7ba('0x144')](_0x34518a,this['agents'][_0x34518a[_0xe7ba('0x143')]][_0xe7ba('0x25')],this[_0xe7ba('0x16')][_0x34518a[_0xe7ba('0x143')]]['id']);}var _0x5043e6=_['clone'](_0x34518a);_0x5043e6[_0xe7ba('0xb6')]=moment()[_0xe7ba('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x9471fb=_0x34f6b1[_0xe7ba('0x13')][_0x34518a[_0xe7ba('0x69')]];if(ut[_0xe7ba('0x145')](_0xb7948d[_0xe7ba('0x146')])){if(_0x34518a[_0xe7ba('0xae')]){rpcDb['unlockContact'](_0x34518a[_0xe7ba('0xb2')]);}if(_0x34518a[_0xe7ba('0xaf')]){rpcDb[_0xe7ba('0x87')](_0x34518a['idContact']);}ami[_0xe7ba('0x53')]('custom:agentringnoanswer',ut[_0xe7ba('0x9d')](_0x34518a,_0xe7ba('0x147'),this[_0xe7ba('0x13')][_0x34518a[_0xe7ba('0x69')]]));this[_0xe7ba('0xfb')](_0x5043e6,_0x9471fb,_0xb7948d);}else{_0x34518a[_0xe7ba('0x88')]=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));ut['logAgent'](_0x5043e6,0x4,_0xe7ba('0x148'));rpcDb[_0xe7ba('0x101')](_0x5043e6,_0xe7ba('0x149'));}}};Preview['prototype'][_0xe7ba('0x1a')]=function(_0x2416ea){var _0x1da56f=this;var _0x35ff64=this['actions'][_0x2416ea['linkedid']];var _0x14ade1;if(_0x35ff64){_0x14ade1=this['campaignsPreview'][_0x35ff64['queue']];logger[_0xe7ba('0x51')]('[syncHangup][talking]',_0x2416ea[_0xe7ba('0xb0')],'\x20Queue',_0x14ade1[_0xe7ba('0x25')],'pTalking:\x20',_0x14ade1[_0xe7ba('0x2a')]);}if(this[_0xe7ba('0x15')][_0x2416ea['linkedid']]&&_0x2416ea['linkedid']!==_0x2416ea[_0xe7ba('0xb9')]){if(_0x2416ea[_0xe7ba('0x14a')]==='16'&&this['actions'][_0x2416ea[_0xe7ba('0xb0')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea['cause']);}else if(this[_0xe7ba('0x15')][_0x2416ea[_0xe7ba('0xb0')]][_0xe7ba('0x6b')]){logger[_0xe7ba('0x51')](_0xe7ba('0x14b'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea['cause'],'\x20Queue',_0x14ade1['name'],_0xe7ba('0x6a'),_0x14ade1[_0xe7ba('0x2a')]);this['callProgressDetectingCustomer'](_0x2416ea,_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')]);}}else if(_0x35ff64&&_[_0xe7ba('0x65')](_0x35ff64[_0xe7ba('0x14c')])&&_0x14ade1[_0xe7ba('0x14d')]&&_0x2416ea[_0xe7ba('0xb0')]===_0x2416ea[_0xe7ba('0xb9')]&&_[_0xe7ba('0x65')](_0x2416ea[_0xe7ba('0xfe')])&&_0x2416ea[_0xe7ba('0x14a')]==='16'&&_0x2416ea[_0xe7ba('0x14e')]==='6'&&_[_0xe7ba('0xfc')](_0x35ff64[_0xe7ba('0x14f')])){if(_0x35ff64['unlockAgent']){rpcDb[_0xe7ba('0x123')](_0x35ff64['idContact']);}if(_0x35ff64['activeContact']){rpcDb['disableContact'](_0x35ff64[_0xe7ba('0xb2')]);}_0x2416ea['reason']='22';this[_0xe7ba('0xfb')](_0x35ff64,_0x14ade1,_0x2416ea);}else if(_0x35ff64&&_0x35ff64[_0xe7ba('0x14f')]){if(_0x2416ea[_0xe7ba('0x14a')]==='16'&&this['actions'][_0x2416ea[_0xe7ba('0xb0')]]['dialAnswer']){logger[_0xe7ba('0x51')](_0xe7ba('0x150'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')],'\x20Queue',_0x14ade1[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x14ade1[_0xe7ba('0x2a')]);this[_0xe7ba('0x9a')](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea[_0xe7ba('0x14a')]);}else if(this[_0xe7ba('0x15')][_0x2416ea['linkedid']][_0xe7ba('0x6b')]){logger[_0xe7ba('0x51')](_0xe7ba('0x14b'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')],_0xe7ba('0xc6'),_0x14ade1[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x14ade1['pTalking']);this[_0xe7ba('0x9a')](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea[_0xe7ba('0x14a')]);}}};Preview['prototype'][_0xe7ba('0x1c')]=function(_0x61f9fa){if(this[_0xe7ba('0x15')][_0x61f9fa[_0xe7ba('0x151')]]&&_0x61f9fa[_0xe7ba('0x151')]!==_0x61f9fa['destuniqueid']){this[_0xe7ba('0x9a')](_0x61f9fa,_0x61f9fa['destlinkedid'],_0x61f9fa[_0xe7ba('0xef')]);}};Preview[_0xe7ba('0xf')][_0xe7ba('0x152')]=function(_0x5deee3){if(this['actions'][_0x5deee3['linkedid']]&&_0x5deee3['linkedid']!==_0x5deee3[_0xe7ba('0xb9')]&&!this['actions'][_0x5deee3[_0xe7ba('0xb0')]]['dialAnswer']){if(_0x5deee3[_0xe7ba('0x14a')]==='1'){this[_0xe7ba('0x9a')](_0x5deee3,_0x5deee3[_0xe7ba('0xb0')],_0x5deee3[_0xe7ba('0x14a')]);}}};Preview['prototype'][_0xe7ba('0x153')]=function(_0x1d0404,_0x51559d,_0x50a28a){if(this['actions'][_0x1d0404]){if(_[_0xe7ba('0x65')](this[_0xe7ba('0x15')][_0x1d0404][_0xe7ba('0x154')])){this[_0xe7ba('0x15')][_0x1d0404]['variables']={};}this[_0xe7ba('0x15')][_0x1d0404][_0xe7ba('0x154')][_0x51559d]=_0x50a28a;}};Preview['prototype'][_0xe7ba('0x1e')]=function(_0x169bac){try{if(!_[_0xe7ba('0x65')](_0x169bac)){if(ut[_0xe7ba('0x155')](_['keys'](_0x169bac['variable'])[0x0])){this['addVariable'](_0x169bac[_0xe7ba('0xb9')],_['keys'](_0x169bac['variable'])[0x0],_0x169bac['value']);}}}catch(_0x2bc08e){logger[_0xe7ba('0x156')]('[syncVarSet][Preview]',util[_0xe7ba('0x157')](_0x2bc08e,{'showHidden':![],'depth':null}));}};Preview[_0xe7ba('0xf')][_0xe7ba('0x20')]=function(_0x3302a8){if(_0x3302a8){if(this[_0xe7ba('0x15')][_0x3302a8[_0xe7ba('0x158')]]){this[_0xe7ba('0x15')][_0x3302a8['transfertargetlinkedid']][_0xe7ba('0x14f')]=!![];}}};Preview['prototype'][_0xe7ba('0x21')]=function(_0x46765d){if(_0x46765d){if(this[_0xe7ba('0x15')][_0x46765d[_0xe7ba('0x159')]]){this[_0xe7ba('0x15')][_0x46765d['transfererlinkedid']][_0xe7ba('0x14f')]=!![];}}};module[_0xe7ba('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1e7754f..9b43740 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 _0x9c91=['crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20'];(function(_0x1f10ae,_0x4025ce){var _0x32a732=function(_0x2bbf38){while(--_0x2bbf38){_0x1f10ae['push'](_0x1f10ae['shift']());}};_0x32a732(++_0x4025ce);}(_0x9c91,0x1ae));var _0x19c9=function(_0x263199,_0x4ece81){_0x263199=_0x263199-0x0;var _0x4a8a35=_0x9c91[_0x263199];return _0x4a8a35;};'use strict';var util=require(_0x19c9('0x0'));var BPromise=require(_0x19c9('0x1'));var logger=require(_0x19c9('0x2'))(_0x19c9('0x3'));var _=require(_0x19c9('0x4'));var cmHopper=require(_0x19c9('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x19c9('0x6'));var cmHopperBlack=require(_0x19c9('0x7'));var voiceQueueRt=require(_0x19c9('0x8'));var agentReportPreview=require(_0x19c9('0x9'));var voiceQueueReport=require(_0x19c9('0xa'));function loggerCatch(_0x1b0a43){return function(_0x2a7e8d){logger[_0x19c9('0xb')](_0x1b0a43,util[_0x19c9('0xc')](_0x2a7e8d,{'showHidden':![],'depth':null}));};}function create(_0x7edd34){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopperHistory[_0x19c9('0xf')](_0x7edd34))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x11')));}function createAgent(_0x2569f0){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](agentReportPreview[_0x19c9('0xf')](_0x2569f0))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x11')));}function moveContact(_0x3ff093){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x12')](_0x3ff093,!![]))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x13')));}exports[_0x19c9('0x14')]=function(_0xc11340){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopperBlack[_0x19c9('0x14')](_0xc11340))['catch'](loggerCatch(_0x19c9('0x15')));};exports[_0x19c9('0x16')]=function(_0x14285e){return BPromise['resolve']()[_0x19c9('0xe')](cmHopper[_0x19c9('0x16')](_0x14285e))['catch'](loggerCatch(_0x19c9('0x17')));};exports[_0x19c9('0xf')]=function(_0x4f1ab6,_0x2f9d1b){create(_0x4f1ab6)['catch'](loggerCatch(_0x2f9d1b));moveContact(_0x4f1ab6)[_0x19c9('0x10')](loggerCatch(_0x2f9d1b));};exports['createAgentHistory']=function(_0x59a1e1,_0x38f862){createAgent(_0x59a1e1)[_0x19c9('0x10')](loggerCatch(_0x38f862));};exports['createCustomerHistory']=function(_0x36f553,_0x4bab22){create(_0x36f553)[_0x19c9('0x10')](loggerCatch(_0x4bab22));};exports[_0x19c9('0x18')]=function(_0x5275a6,_0x30a190){moveContact(_0x5275a6)['catch'](loggerCatch(_0x30a190));};exports[_0x19c9('0x19')]=function(_0x36e1c1,_0x7d21f2,_0x14a59c){if(_0x7d21f2){_0x36e1c1['UserId']=null;}if(_0x14a59c){_0x36e1c1[_0x19c9('0x1a')]=![];}return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper['rescheduleContact'](_0x36e1c1))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x1b')));};exports[_0x19c9('0x1c')]=function(_0xb22b1c){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x1c')](_0xb22b1c))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x1d')));};exports[_0x19c9('0x1e')]=function(_0x5f40be){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x1e')]({'UserId':null},_0x5f40be,0x1))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x1f')));};exports[_0x19c9('0x20')]=function(_0x3d9956){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x1e')]({'active':![]},_0x3d9956,0x1))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x21')));};exports[_0x19c9('0x22')]=function(_0x3f7e61){var _0x4ecf13={};_0x4ecf13[_0x19c9('0x23')]=_0x3f7e61[_0x19c9('0x23')];_0x4ecf13[_0x19c9('0x24')]=_0x3f7e61['uniqueid'];_0x4ecf13[_0x19c9('0x25')]=_0x3f7e61[_0x19c9('0x25')];_0x4ecf13[_0x19c9('0x26')]=_0x3f7e61[_0x19c9('0x26')];_0x4ecf13[_0x19c9('0x27')]=_0x3f7e61[_0x19c9('0x27')];_0x4ecf13[_0x19c9('0x28')]=_0x3f7e61['answertime'];_0x4ecf13[_0x19c9('0x29')]=_0x3f7e61['answertime'];_0x4ecf13[_0x19c9('0x2a')]=0x1;_0x4ecf13['queuecallercompleteAt']=_0x3f7e61[_0x19c9('0x2b')];_0x4ecf13[_0x19c9('0x2c')]=_0x3f7e61[_0x19c9('0x2d')];_0x4ecf13[_0x19c9('0x2e')]=_0x19c9('0x2f');_0x4ecf13[_0x19c9('0x30')]=_0x19c9('0x31');_0x4ecf13[_0x19c9('0x32')]=0x0;_0x4ecf13[_0x19c9('0x33')]=0x1;_0x4ecf13[_0x19c9('0x34')]=_0x3f7e61[_0x19c9('0x2d')];_0x4ecf13['queuecallerexitreason']='COMPLETED';return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](voiceQueueReport[_0x19c9('0x35')](_0x4ecf13))['catch'](loggerCatch(_0x19c9('0x36')));};exports[_0x19c9('0x37')]=function(_0x183dac,_0x37487b){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x37')](_0x183dac,_0x37487b))[_0x19c9('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x19c9('0x38')]=function(_0x53d352){return BPromise[_0x19c9('0xd')]()[_0x19c9('0xe')](cmHopper[_0x19c9('0x19')](_0x53d352,!![],!![]))[_0x19c9('0x10')](loggerCatch(_0x19c9('0x39')));}; \ No newline at end of file +var _0x6abc=['getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6abc,0x145));var _0xc6ab=function(_0x2749cd,_0x1d51ac){_0x2749cd=_0x2749cd-0x0;var _0x6417a7=_0x6abc[_0x2749cd];return _0x6417a7;};'use strict';var util=require(_0xc6ab('0x0'));var BPromise=require('bluebird');var logger=require(_0xc6ab('0x1'))(_0xc6ab('0x2'));var _=require(_0xc6ab('0x3'));var cmHopper=require(_0xc6ab('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xc6ab('0x5'));var agentReportPreview=require(_0xc6ab('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5bed80){return function(_0x1c1168){logger[_0xc6ab('0x7')](_0x5bed80,util[_0xc6ab('0x8')](_0x1c1168,{'showHidden':![],'depth':null}));};}function create(_0x52165a){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopperHistory[_0xc6ab('0xb')](_0x52165a))['catch'](loggerCatch(_0xc6ab('0xc')));}function createAgent(_0x497559){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](agentReportPreview['createHistory'](_0x497559))['catch'](loggerCatch(_0xc6ab('0xc')));}function moveContact(_0x445ebc){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0xd')](_0x445ebc,!![]))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0xf')));}exports[_0xc6ab('0x10')]=function(_0x5b9c70){return BPromise[_0xc6ab('0x9')]()['then'](cmHopperBlack[_0xc6ab('0x10')](_0x5b9c70))[_0xc6ab('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc6ab('0x11')]=function(_0x3c8e66){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x11')](_0x3c8e66))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xc6ab('0xb')]=function(_0x50e5ab,_0x26a060){create(_0x50e5ab)[_0xc6ab('0xe')](loggerCatch(_0x26a060));moveContact(_0x50e5ab)[_0xc6ab('0xe')](loggerCatch(_0x26a060));};exports['createAgentHistory']=function(_0x5307f6,_0x4b151b){createAgent(_0x5307f6)[_0xc6ab('0xe')](loggerCatch(_0x4b151b));};exports[_0xc6ab('0x12')]=function(_0x1956db,_0xd1f9fc){create(_0x1956db)[_0xc6ab('0xe')](loggerCatch(_0xd1f9fc));};exports['createCustomerFinal']=function(_0x433b29,_0x35bf7f){moveContact(_0x433b29)[_0xc6ab('0xe')](loggerCatch(_0x35bf7f));};exports[_0xc6ab('0x13')]=function(_0x327e22,_0x53fa49,_0x477621){if(_0x53fa49){_0x327e22['UserId']=null;}if(_0x477621){_0x327e22['active']=![];}return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x13')](_0x327e22))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x14')));};exports[_0xc6ab('0x15')]=function(_0x1f2af4){return BPromise[_0xc6ab('0x9')]()['then'](cmHopper['countReScheduled'](_0x1f2af4))[_0xc6ab('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0xc6ab('0x16')]=function(_0x230820){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x16')]({'UserId':null},_0x230820,0x1))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x17')));};exports[_0xc6ab('0x18')]=function(_0x710d50){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper['unlockContact']({'active':![]},_0x710d50,0x1))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x19')));};exports[_0xc6ab('0x1a')]=function(_0x510bb0){var _0x4a6d00={};_0x4a6d00[_0xc6ab('0x1b')]=_0x510bb0[_0xc6ab('0x1b')];_0x4a6d00[_0xc6ab('0x1c')]=_0x510bb0[_0xc6ab('0x1c')];_0x4a6d00[_0xc6ab('0x1d')]=_0x510bb0[_0xc6ab('0x1d')];_0x4a6d00['calleridname']=_0x510bb0[_0xc6ab('0x1e')];_0x4a6d00[_0xc6ab('0x1f')]=_0x510bb0[_0xc6ab('0x1f')];_0x4a6d00['queuecallerjoinAt']=_0x510bb0[_0xc6ab('0x20')];_0x4a6d00[_0xc6ab('0x21')]=_0x510bb0[_0xc6ab('0x20')];_0x4a6d00['queuecallercomplete']=0x1;_0x4a6d00[_0xc6ab('0x22')]=_0x510bb0[_0xc6ab('0x23')];_0x4a6d00['connectedlinename']=_0x510bb0[_0xc6ab('0x24')];_0x4a6d00[_0xc6ab('0x25')]=_0xc6ab('0x26');_0x4a6d00[_0xc6ab('0x27')]=_0xc6ab('0x28');_0x4a6d00['holdtime']=0x0;_0x4a6d00['assigned']=0x1;_0x4a6d00[_0xc6ab('0x29')]=_0x510bb0[_0xc6ab('0x24')];_0x4a6d00['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0xc6ab('0xa')](voiceQueueReport[_0xc6ab('0x2a')](_0x4a6d00))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xc6ab('0x2b')]=function(_0xfd452d,_0x16f3d4){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x2b')](_0xfd452d,_0x16f3d4))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xc6ab('0x2c')]=function(_0x2ebfa3){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x13')](_0x2ebfa3,!![],!![]))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x2d')));}; \ 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 5d17dd5..f752f6e 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 _0x4abd=['xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','inspect','loggerError','error','logger2','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','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','logAgent','ringtime','membername','UserId','endtime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','diff','createBody','CampaignId','filterKey','idContact','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter'];(function(_0x33cc13,_0x41eebf){var _0x1e8879=function(_0x149e10){while(--_0x149e10){_0x33cc13['push'](_0x33cc13['shift']());}};_0x1e8879(++_0x41eebf);}(_0x4abd,0x11e));var _0xd4ab=function(_0x127316,_0x2774a8){_0x127316=_0x127316-0x0;var _0x34d919=_0x4abd[_0x127316];return _0x34d919;};'use strict';var util=require(_0xd4ab('0x0'));var _=require(_0xd4ab('0x1'));var moment=require('moment');var logger=require(_0xd4ab('0x2'))(_0xd4ab('0x3'));var ipAgi=process[_0xd4ab('0x4')]['XCALLY_IP_AGI']||_0xd4ab('0x5');function getSeconds(_0x39c393,_0x3d06c0){var _0x281e14=moment(_0x39c393)[_0xd4ab('0x6')](0x0);var _0x23d2d2=moment(_0x3d06c0)[_0xd4ab('0x6')](0x0);return _0x281e14['diff'](_0x23d2d2,_0xd4ab('0x7'));}exports['loggerCatch']=function(_0x42c7b9){return function(_0x293db0){logger['error'](_0x42c7b9,util['inspect'](_0x293db0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4e8d3e,_0x3ade0f){logger['info'](_0x4e8d3e,util[_0xd4ab('0x8')](_0x3ade0f,{'showHidden':![],'depth':null}));};exports[_0xd4ab('0x9')]=function(_0x577516,_0x2976c8){logger[_0xd4ab('0xa')](_0x577516,util['inspect'](_0x2976c8,{'showHidden':![],'depth':null}));};exports[_0xd4ab('0xb')]=function(_0x2870f2){return function(_0x3c9233){logger['info'](_0x2870f2,util[_0xd4ab('0x8')](_0x3c9233,{'showHidden':![],'depth':null}));};};exports[_0xd4ab('0xc')]=function(_0x33c31b,_0xd49d66,_0xb1c641){return{'message':_0x33c31b,'unlock':_0xd49d66,'active':_0xb1c641};};exports[_0xd4ab('0xd')]=function(_0x1ecde6,_0x2e7fe3,_0x27446c){if(!_['isUndefined'](_0x27446c)&&_0xd4ab('0xe')===typeof _0x27446c&&!_[_0xd4ab('0xf')](_0x27446c)){if(!_['isUndefined'](_0x2e7fe3)&&_0xd4ab('0xe')===typeof _0x2e7fe3&&!_['isEmpty'](_0x2e7fe3)){return util[_0xd4ab('0x10')]('\x22%s\x22\x20<%s>',_0x2e7fe3,_0x27446c);}return util['format'](_0xd4ab('0x11'),_0x27446c,_0x27446c);}if(!_['isUndefined'](_0x1ecde6)&&_0xd4ab('0xe')===typeof _0x1ecde6&&!_['isEmpty'](_0x1ecde6)){return _0x1ecde6;}return _0xd4ab('0x12');};exports[_0xd4ab('0x13')]=function(_0x8ba33f){if(_[_0xd4ab('0x14')](_0x8ba33f)){return![];}return _0x8ba33f;};exports[_0xd4ab('0x15')]=function(_0x40d84a,_0x42059b,_0x48a561,_0x334aed,_0x549361,_0x2ba5ba){var _0x160e61={'XMD-QUEUE':_0x42059b['Queue']?_0x42059b[_0xd4ab('0x16')][_0xd4ab('0x17')]:'','XMD-CALLERID':_0x334aed,'XMD-CALLERID-PREVIEW':_0x2ba5ba?util[_0xd4ab('0x10')](_0xd4ab('0x11'),_0x2ba5ba['calleridname'],_0x2ba5ba['calleridnum']):_0x334aed,'XMD-DIALID':_0x549361,'XMD-CONTACTID':_0x42059b[_0xd4ab('0x18')],'XMD-CDRTYPE':_0xd4ab('0x19'),'CALLERID(all)':_0x334aed,'XMD-VOICEQUEUEID':_0x42059b[_0xd4ab('0x1a')],'XMD-DIALCHANNEL':_0x48a561,'XMD-DIALTIMEOUT':_0x40d84a[_0xd4ab('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x40d84a['dialQueueProject2']?'g':'',_[_0xd4ab('0xf')](_0x40d84a[_0xd4ab('0x1c')])?'':_0xd4ab('0x1d')),'XMD-DIALURL':_0x40d84a[_0xd4ab('0x1e')]||'','XMD-AGI':_0x40d84a[_0xd4ab('0x1f')]?util[_0xd4ab('0x10')](_0xd4ab('0x20'),ipAgi,_0x40d84a[_0xd4ab('0x1f')]):'NONE','XMD-AGIAFTER':_0x40d84a[_0xd4ab('0x21')]?util['format'](_0xd4ab('0x20'),ipAgi,_0x40d84a['dialQueueProject2']):_0xd4ab('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x2ba5ba?_0x2ba5ba[_0xd4ab('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x2ba5ba?_0x2ba5ba['originatecalleridname']:'','XMD-DESTINATION':_0xd4ab('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x40d84a['monitor_format'])){_0x160e61[util[_0xd4ab('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x40d84a[_0xd4ab('0x1c')];_0x160e61[util[_0xd4ab('0x10')]('%s',_0xd4ab('0x25'))]=_0x549361;}if(_0x42059b&&_0x42059b[_0xd4ab('0x26')]){for(var _0x1c6206 in _0x42059b['Contact']){if(_0x42059b[_0xd4ab('0x26')][_0xd4ab('0x27')](_0x1c6206)){if(!_[_0xd4ab('0x14')](_0x42059b[_0xd4ab('0x26')][_0x1c6206])&&_0x1c6206!=='id'&&_0x1c6206!==_0xd4ab('0x28')&&_0x1c6206!==_0xd4ab('0x29')&&_0x1c6206!==_0xd4ab('0x2a')){_0x160e61[util['format']('%s%s',_0xd4ab('0x2b'),_['toUpper'](_0x1c6206))]=_0x42059b['Contact'][_0x1c6206];}}}}return _0x160e61;};exports[_0xd4ab('0x2c')]=function(_0x3f6507){var _0x1608bd={};for(var _0x1afab2 in _0x3f6507){if(_0x3f6507[_0xd4ab('0x27')](_0x1afab2)){_0x1608bd[util[_0xd4ab('0x10')]('%s',_[_0xd4ab('0x2d')](_0x1afab2))]=_0x3f6507[_0x1afab2];}}return{'variables':_0x1608bd};};exports[_0xd4ab('0x2e')]=function(_0x77ef4f,_0x572969){if(!_[_0xd4ab('0x14')](_0x77ef4f)){if(_0x77ef4f['hasOwnProperty'](_0xd4ab('0x2f'))){if(_0x77ef4f[_0xd4ab('0x2f')]>0x0){_0x77ef4f[_0xd4ab('0x2f')]-=0x1;}else{logger[_0xd4ab('0xa')](_0xd4ab('0x30'),_0x572969);}}}else{logger[_0xd4ab('0xa')](_0xd4ab('0x31'),_0x572969);}};exports[_0xd4ab('0x32')]=function(_0x4b3b94){var _0x413e0c=moment()[_0xd4ab('0x10')](_0xd4ab('0x33'));_0x4b3b94[_0xd4ab('0x34')]=0xd;_0x4b3b94[_0xd4ab('0x35')]=_0xd4ab('0x36');_0x4b3b94[_0xd4ab('0x37')]=_0x413e0c;_0x4b3b94[_0xd4ab('0x38')]=_0x413e0c;_0x4b3b94['endtime']=_0x413e0c;};exports[_0xd4ab('0x39')]=function(_0x171043,_0x58c4c8,_0x4faad9){var _0x469225=moment()[_0xd4ab('0x10')](_0xd4ab('0x33'));_0x171043[_0xd4ab('0x34')]=_0x58c4c8;_0x171043[_0xd4ab('0x35')]=_0x4faad9;_0x171043[_0xd4ab('0x38')]=_0x469225;_0x171043[_0xd4ab('0x3a')]=getSeconds(_0x171043[_0xd4ab('0x38')],_0x171043[_0xd4ab('0x37')]);};exports['logLookAgent']=function(_0x19fdfa,_0x4f5634,_0xbd451d){_0x19fdfa[_0xd4ab('0x3b')]=_0x4f5634;_0x19fdfa[_0xd4ab('0x3c')]=_0xbd451d;};exports['logCustomer']=function(_0x5347ff,_0x44e7d2,_0x3e3850){var _0x47ee0f=moment()[_0xd4ab('0x10')](_0xd4ab('0x33'));_0x5347ff['state']=_0x44e7d2;_0x5347ff['statedesc']=_0x3e3850;_0x5347ff[_0xd4ab('0x38')]=_0x5347ff[_0xd4ab('0x38')]?_0x5347ff[_0xd4ab('0x38')]:_0x47ee0f;_0x5347ff['endtime']=_0x5347ff['endtime']?_0x5347ff[_0xd4ab('0x3d')]:_0x47ee0f;_0x5347ff[_0xd4ab('0x3a')]=getSeconds(_0x5347ff[_0xd4ab('0x38')]||0x0,_0x5347ff[_0xd4ab('0x37')]||0x0);_0x5347ff['talktime']=_0x5347ff[_0xd4ab('0x3e')]?getSeconds(_0x5347ff[_0xd4ab('0x3d')],_0x5347ff[_0xd4ab('0x3e')]):0x0;};exports[_0xd4ab('0x3f')]=function(_0x48d50e){return _0x48d50e===_0xd4ab('0x40');};exports[_0xd4ab('0x41')]=function(_0x5cfaf8,_0x1c751f,_0x58c5d9,_0x90f8b5,_0x10572b){var _0x583e4a=_0x90f8b5?'RECALL':_0x5cfaf8[_0xd4ab('0x42')];_0x583e4a=_0x10572b?_0xd4ab('0x43'):_0x583e4a;return{'actionid':_0x5cfaf8[_0xd4ab('0x44')],'action':'originate','channel':_0x5cfaf8[_0xd4ab('0x45')],'callerid':util[_0xd4ab('0x10')]('\x22%s\x22\x20<%s>',_0x583e4a,_0x5cfaf8[_0xd4ab('0x46')]),'Exten':'xcally-motion-preview','Context':_0xd4ab('0x47'),'Priority':'1','variable':_0x58c5d9,'timeout':(_0x1c751f[_0xd4ab('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cfaf8[_0xd4ab('0x44')]};};exports[_0xd4ab('0x49')]=function(_0x434caa){return _0x434caa[_0xd4ab('0x4a')]+_0x434caa[_0xd4ab('0x4b')]+_0x434caa[_0xd4ab('0x4c')]+_0x434caa['countagentrejectretry']+_0x434caa['countnosuchnumberretry'];};exports[_0xd4ab('0x4d')]=function(_0x397099){var _0x4a58a0=_[_0xd4ab('0x4e')](_0x397099);_0x4a58a0[_0xd4ab('0x34')]=0xf;_0x4a58a0[_0xd4ab('0x35')]=_0xd4ab('0x4f');return _0x4a58a0;};exports[_0xd4ab('0x50')]=function(_0x581d74,_0x39140f,_0x3d18d9){var _0x1ca5c0={};_0x1ca5c0[_0x39140f]=_0x581d74[_0x39140f];_0x1ca5c0[_0xd4ab('0x51')]=![];_0x1ca5c0[_0xd4ab('0x52')]=moment()['add'](_0x3d18d9,'minutes')['format'](_0xd4ab('0x33'));_0x1ca5c0[_0xd4ab('0x18')]=_0x581d74['ContactId'];_0x1ca5c0[_0xd4ab('0x53')]=_0x581d74[_0xd4ab('0x53')];_0x1ca5c0[_0xd4ab('0x1a')]=_0x581d74[_0xd4ab('0x1a')]||undefined;return _0x1ca5c0;};exports[_0xd4ab('0x54')]=function(_0x33fb14,_0x26fbbf){if(!_[_0xd4ab('0x14')](_0x33fb14)){if(_0x33fb14['pTalking']>0x0){_0x33fb14[_0xd4ab('0x55')]-=0x1;}else{logger['error'](_0x26fbbf,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xd4ab('0xa')](_0x26fbbf,_0xd4ab('0x56'));}};exports[_0xd4ab('0x57')]=function(_0x2a1965){if(_0x2a1965<=0x0){return!![];}return![];};exports[_0xd4ab('0x58')]=function(_0x4d843c,_0x39874d,_0x167c8f){_0x4d843c[_0xd4ab('0x59')]=_0x39874d;_0x4d843c[_0xd4ab('0x17')]=_0x4d843c[_0xd4ab('0x5a')];_0x4d843c[_0xd4ab('0x5b')]=_0x4d843c['channelAgent'];_0x4d843c[_0xd4ab('0x5c')]=_0xd4ab('0x5d');if(_0x167c8f){_0x4d843c[_0xd4ab('0x5e')]=_0x167c8f[_0xd4ab('0x5e')];}return _0x4d843c;};exports[_0xd4ab('0x5f')]=function(_0x1f8f6e){var _0x1c8f37={};_0x1c8f37['queue']=_0x1f8f6e[_0xd4ab('0x5a')];_0x1c8f37[_0xd4ab('0x5b')]=_0x1f8f6e[_0xd4ab('0x45')];_0x1c8f37[_0xd4ab('0x44')]=_0x1f8f6e[_0xd4ab('0x44')];return _0x1c8f37;};exports[_0xd4ab('0x60')]=function(_0x1d2ca4){var _0x55d974=[];for(var _0x500fce in _0x1d2ca4){if(_0x1d2ca4[_0xd4ab('0x27')](_0x500fce)){if(!_[_0xd4ab('0x14')](_0x1d2ca4[_0x500fce])&&_0x1d2ca4[_0x500fce][_0xd4ab('0x34')]==='not_inuse'&&_0x1d2ca4[_0x500fce][_0xd4ab('0x61')]===_0xd4ab('0x62')){_0x55d974['push'](_0x1d2ca4[_0x500fce]['id']);}}}return _0x55d974;};exports['getDiff']=function(_0x218a7c){var _0x9664db=moment()['milliseconds'](0x0);var _0x214b82=moment(_0x218a7c)[_0xd4ab('0x6')](0x0);return _0x9664db[_0xd4ab('0x63')](_0x214b82,_0xd4ab('0x7'));};exports[_0xd4ab('0x64')]=function(_0x83f4c2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x83f4c2['ContactId'],'ListId':_0x83f4c2[_0xd4ab('0x53')],'VoiceQueueId':_0x83f4c2['VoiceQueueId']||undefined,'CampaignId':_0x83f4c2[_0xd4ab('0x65')]||undefined};};exports[_0xd4ab('0x66')]=function(_0x13605a){if(_0x13605a==='uniqueid'||_0x13605a===_0xd4ab('0x67')||_0x13605a===_0xd4ab('0x5a')||_0x13605a==='type'||_0x13605a==='campaigntype'||_0x13605a===_0xd4ab('0x68')||_0x13605a===_0xd4ab('0x3b')||_0x13605a===_0xd4ab('0x45')||_0x13605a===_0xd4ab('0x42')||_0x13605a===_0xd4ab('0x51')||_0x13605a===_0xd4ab('0x46')||_0x13605a===_0xd4ab('0x52')||_0x13605a==='countbusyretry'||_0x13605a===_0xd4ab('0x4b')||_0x13605a===_0xd4ab('0x4c')||_0x13605a===_0xd4ab('0x69')||_0x13605a===_0xd4ab('0x6a')||_0x13605a==='callbackuniqueid'||_0x13605a===_0xd4ab('0x6b')||_0x13605a===_0xd4ab('0x6c')||_0x13605a==='ContactId'||_0x13605a===_0xd4ab('0x53')||_0x13605a===_0xd4ab('0x3c')||_0x13605a===_0xd4ab('0x1a')||_0x13605a===_0xd4ab('0x6d')||_0x13605a==='xmd-voicequeueid'||_0x13605a===_0xd4ab('0x6e')||_0x13605a===_0xd4ab('0x6f')||_0x13605a===_0xd4ab('0x70')||_0x13605a===_0xd4ab('0x71')||_0x13605a===_0xd4ab('0x72')||_0x13605a==='xmd-dialoptions'||_0x13605a==='xmd-dialid'||_0x13605a==='xmd-dialchannel'||_0x13605a===_0xd4ab('0x73')||_0x13605a===_0xd4ab('0x74')||_0x13605a===_0xd4ab('0x75')||_0x13605a===_0xd4ab('0x76')||_0x13605a===_0xd4ab('0x77')||_0x13605a==='rtpaudioqos'||_0x13605a===_0xd4ab('0x78')||_0x13605a===_0xd4ab('0x79')||_0x13605a===_0xd4ab('0x7a')||_0x13605a===_0xd4ab('0x7b')||_0x13605a===_0xd4ab('0x7c')||_0x13605a===_0xd4ab('0x7d')||_0x13605a===_0xd4ab('0x7e')||_0x13605a===_0xd4ab('0x7f')||_0x13605a===_0xd4ab('0x78')||_0x13605a==='rtpaudioqosjitter'||_0x13605a==='rtpaudioqosjitterbridged'||_0x13605a===_0xd4ab('0x7b')||_0x13605a===_0xd4ab('0x7c')||_0x13605a===_0xd4ab('0x7d')||_0x13605a==='rtpaudioqosrttbridged'||_0x13605a===_0xd4ab('0x80')||_0x13605a===_0xd4ab('0x81')||_0x13605a===_0xd4ab('0x34')||_0x13605a===_0xd4ab('0x35')){return![];}return!![];};exports[_0xd4ab('0x82')]=function(_0x5299cf,_0x309760){var _0x183b73,_0x5157ba,_0x4ac33;if(_0x309760<=0x0){_0x309760=0x1;}_0x183b73=new RegExp(_0xd4ab('0x83')+_0x309760+'}$');_0x5157ba=Math[_0xd4ab('0x84')](0xa,_0x309760-0x1);_0x4ac33=Math[_0xd4ab('0x84')](0xa,_0x309760)-0x1;return util['format']('%s',_['replace'](_0x5299cf,_0x183b73,_['random'](_0x5157ba,_0x4ac33)));};exports[_0xd4ab('0x85')]=function(_0xddc32d){var _0x5145dd=_0xddc32d[_0xd4ab('0x86')](/"(.*?)"/);return _0x5145dd?_0x5145dd[0x1]:_0xddc32d;};exports['extractCalleridNumber']=function(_0x19c0cc){var _0x5dc2a4=_0x19c0cc['match'](/<(.*?)>/);return _0x5dc2a4?_0x5dc2a4[0x1]:_0x19c0cc;}; \ No newline at end of file +var _0xca86=['xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','logger','inspect','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countnoanswerretry','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xca86,0x138));var _0x6ca8=function(_0x5cfa4a,_0x20b2ad){_0x5cfa4a=_0x5cfa4a-0x0;var _0x2590f1=_0xca86[_0x5cfa4a];return _0x2590f1;};'use strict';var util=require(_0x6ca8('0x0'));var _=require(_0x6ca8('0x1'));var moment=require(_0x6ca8('0x2'));var logger=require(_0x6ca8('0x3'))(_0x6ca8('0x4'));var ipAgi=process[_0x6ca8('0x5')][_0x6ca8('0x6')]||_0x6ca8('0x7');function getSeconds(_0x3be4b5,_0x3f7293){var _0x3868b0=moment(_0x3be4b5)['milliseconds'](0x0);var _0x147c33=moment(_0x3f7293)['milliseconds'](0x0);return _0x3868b0[_0x6ca8('0x8')](_0x147c33,_0x6ca8('0x9'));}exports[_0x6ca8('0xa')]=function(_0x4262e0){return function(_0x5dca45){logger[_0x6ca8('0xb')](_0x4262e0,util['inspect'](_0x5dca45,{'showHidden':![],'depth':null}));};};exports[_0x6ca8('0xc')]=function(_0x4d5e36,_0x3f5f06){logger['info'](_0x4d5e36,util['inspect'](_0x3f5f06,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x44cc86,_0x27a51f){logger[_0x6ca8('0xb')](_0x44cc86,util[_0x6ca8('0xd')](_0x27a51f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x5e6564){return function(_0xfb92f8){logger[_0x6ca8('0xe')](_0x5e6564,util['inspect'](_0xfb92f8,{'showHidden':![],'depth':null}));};};exports[_0x6ca8('0xf')]=function(_0x277804,_0x4f5ce4,_0x62f409){return{'message':_0x277804,'unlock':_0x4f5ce4,'active':_0x62f409};};exports[_0x6ca8('0x10')]=function(_0x14549b,_0xbf8c1f,_0x17a751){if(!_[_0x6ca8('0x11')](_0x17a751)&&_0x6ca8('0x12')===typeof _0x17a751&&!_[_0x6ca8('0x13')](_0x17a751)){if(!_['isUndefined'](_0xbf8c1f)&&_0x6ca8('0x12')===typeof _0xbf8c1f&&!_[_0x6ca8('0x13')](_0xbf8c1f)){return util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0xbf8c1f,_0x17a751);}return util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0x17a751,_0x17a751);}if(!_['isUndefined'](_0x14549b)&&_0x6ca8('0x12')===typeof _0x14549b&&!_[_0x6ca8('0x13')](_0x14549b)){return _0x14549b;}return _0x6ca8('0x16');};exports[_0x6ca8('0x17')]=function(_0x28b049){if(_[_0x6ca8('0x18')](_0x28b049)){return![];}return _0x28b049;};exports[_0x6ca8('0x19')]=function(_0xfadafe,_0x579a70,_0xa2afb6,_0x351eff,_0x5af268,_0x5c3ddb){var _0x594e81={'XMD-QUEUE':_0x579a70[_0x6ca8('0x1a')]?_0x579a70['Queue']['name']:'','XMD-CALLERID':_0x351eff,'XMD-CALLERID-PREVIEW':_0x5c3ddb?util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0x5c3ddb[_0x6ca8('0x1b')],_0x5c3ddb['calleridnum']):_0x351eff,'XMD-DIALID':_0x5af268,'XMD-CONTACTID':_0x579a70[_0x6ca8('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x351eff,'XMD-VOICEQUEUEID':_0x579a70['VoiceQueueId'],'XMD-DIALCHANNEL':_0xa2afb6,'XMD-DIALTIMEOUT':_0xfadafe[_0x6ca8('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x6ca8('0x14')](_0x6ca8('0x1e'),_0xfadafe[_0x6ca8('0x1f')]?'g':'',_['isEmpty'](_0xfadafe[_0x6ca8('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xfadafe[_0x6ca8('0x21')]||'','XMD-AGI':_0xfadafe[_0x6ca8('0x22')]?util[_0x6ca8('0x14')](_0x6ca8('0x23'),ipAgi,_0xfadafe['dialQueueProject']):_0x6ca8('0x24'),'XMD-AGIAFTER':_0xfadafe[_0x6ca8('0x1f')]?util[_0x6ca8('0x14')](_0x6ca8('0x23'),ipAgi,_0xfadafe[_0x6ca8('0x1f')]):_0x6ca8('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5c3ddb?_0x5c3ddb[_0x6ca8('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x5c3ddb?_0x5c3ddb['originatecalleridname']:'','XMD-DESTINATION':_0x6ca8('0x26'),'SIPADDHEADER':_0x6ca8('0x27')};if(!_[_0x6ca8('0x13')](_0xfadafe[_0x6ca8('0x20')])){_0x594e81[util[_0x6ca8('0x14')]('%s',_0x6ca8('0x28'))]=_0xfadafe[_0x6ca8('0x20')];_0x594e81[util[_0x6ca8('0x14')]('%s',_0x6ca8('0x29'))]=_0x5af268;}if(_0x579a70&&_0x579a70[_0x6ca8('0x2a')]){for(var _0x55e6a9 in _0x579a70[_0x6ca8('0x2a')]){if(_0x579a70['Contact'][_0x6ca8('0x2b')](_0x55e6a9)){if(!_[_0x6ca8('0x18')](_0x579a70[_0x6ca8('0x2a')][_0x55e6a9])&&_0x55e6a9!=='id'&&_0x55e6a9!=='tags'&&_0x55e6a9!==_0x6ca8('0x2c')&&_0x55e6a9!==_0x6ca8('0x2d')){_0x594e81[util[_0x6ca8('0x14')](_0x6ca8('0x2e'),_0x6ca8('0x2f'),_[_0x6ca8('0x30')](_0x55e6a9))]=_0x579a70[_0x6ca8('0x2a')][_0x55e6a9];}}}}return _0x594e81;};exports[_0x6ca8('0x31')]=function(_0x22ae2f){var _0x38f807={};for(var _0xb76c46 in _0x22ae2f){if(_0x22ae2f['hasOwnProperty'](_0xb76c46)){_0x38f807[util[_0x6ca8('0x14')]('%s',_[_0x6ca8('0x32')](_0xb76c46))]=_0x22ae2f[_0xb76c46];}}return{'variables':_0x38f807};};exports['updateOriginated']=function(_0x3dabcb,_0xd522b2){if(!_[_0x6ca8('0x18')](_0x3dabcb)){if(_0x3dabcb['hasOwnProperty'](_0x6ca8('0x33'))){if(_0x3dabcb[_0x6ca8('0x33')]>0x0){_0x3dabcb[_0x6ca8('0x33')]-=0x1;}else{logger[_0x6ca8('0xb')](_0x6ca8('0x34'),_0xd522b2);}}}else{logger[_0x6ca8('0xb')](_0x6ca8('0x35'),_0xd522b2);}};exports[_0x6ca8('0x36')]=function(_0xf4f104){var _0x386aa9=moment()[_0x6ca8('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0xf4f104['state']=0xd;_0xf4f104[_0x6ca8('0x37')]=_0x6ca8('0x38');_0xf4f104[_0x6ca8('0x39')]=_0x386aa9;_0xf4f104['responsetime']=_0x386aa9;_0xf4f104[_0x6ca8('0x3a')]=_0x386aa9;};exports['logAgent']=function(_0x60b655,_0x2e32a0,_0x298c99){var _0x53d59c=moment()[_0x6ca8('0x14')](_0x6ca8('0x3b'));_0x60b655[_0x6ca8('0x3c')]=_0x2e32a0;_0x60b655[_0x6ca8('0x37')]=_0x298c99;_0x60b655[_0x6ca8('0x3d')]=_0x53d59c;_0x60b655[_0x6ca8('0x3e')]=getSeconds(_0x60b655['responsetime'],_0x60b655['starttime']);};exports[_0x6ca8('0x3f')]=function(_0x3cccfa,_0x218bf1,_0x3b3cb0){_0x3cccfa[_0x6ca8('0x40')]=_0x218bf1;_0x3cccfa[_0x6ca8('0x41')]=_0x3b3cb0;};exports[_0x6ca8('0x42')]=function(_0x1178af,_0x3fc49a,_0x3556a7){var _0x3cb933=moment()['format'](_0x6ca8('0x3b'));_0x1178af[_0x6ca8('0x3c')]=_0x3fc49a;_0x1178af[_0x6ca8('0x37')]=_0x3556a7;_0x1178af[_0x6ca8('0x3d')]=_0x1178af['responsetime']?_0x1178af[_0x6ca8('0x3d')]:_0x3cb933;_0x1178af['endtime']=_0x1178af[_0x6ca8('0x3a')]?_0x1178af['endtime']:_0x3cb933;_0x1178af[_0x6ca8('0x3e')]=getSeconds(_0x1178af[_0x6ca8('0x3d')]||0x0,_0x1178af[_0x6ca8('0x39')]||0x0);_0x1178af[_0x6ca8('0x43')]=_0x1178af[_0x6ca8('0x44')]?getSeconds(_0x1178af['endtime'],_0x1178af[_0x6ca8('0x44')]):0x0;};exports[_0x6ca8('0x45')]=function(_0x45eff5){return _0x45eff5===_0x6ca8('0x46');};exports[_0x6ca8('0x47')]=function(_0x3e0d35,_0x1963ae,_0x3f7f53,_0x328f9e,_0x3dc155){var _0x92bc5e=_0x328f9e?_0x6ca8('0x48'):_0x3e0d35[_0x6ca8('0x1b')];_0x92bc5e=_0x3dc155?'BOOKED':_0x92bc5e;return{'actionid':_0x3e0d35[_0x6ca8('0x49')],'action':_0x6ca8('0x4a'),'channel':_0x3e0d35[_0x6ca8('0x4b')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x92bc5e,_0x3e0d35[_0x6ca8('0x4c')]),'Exten':_0x6ca8('0x26'),'Context':_0x6ca8('0x4d'),'Priority':'1','variable':_0x3f7f53,'timeout':(_0x1963ae[_0x6ca8('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e0d35['uniqueid']};};exports[_0x6ca8('0x4f')]=function(_0x5a1156){return _0x5a1156[_0x6ca8('0x50')]+_0x5a1156[_0x6ca8('0x51')]+_0x5a1156['countnoanswerretry']+_0x5a1156['countagentrejectretry']+_0x5a1156[_0x6ca8('0x52')];};exports[_0x6ca8('0x53')]=function(_0x521077){var _0x1a9ec7=_[_0x6ca8('0x54')](_0x521077);_0x1a9ec7[_0x6ca8('0x3c')]=0xf;_0x1a9ec7['statedesc']=_0x6ca8('0x55');return _0x1a9ec7;};exports[_0x6ca8('0x56')]=function(_0x3d5f4b,_0x184038,_0x200630){var _0x5e4658={};_0x5e4658[_0x184038]=_0x3d5f4b[_0x184038];_0x5e4658['active']=![];_0x5e4658['scheduledat']=moment()[_0x6ca8('0x57')](_0x200630,'minutes')[_0x6ca8('0x14')](_0x6ca8('0x3b'));_0x5e4658[_0x6ca8('0x1c')]=_0x3d5f4b['ContactId'];_0x5e4658[_0x6ca8('0x58')]=_0x3d5f4b[_0x6ca8('0x58')];_0x5e4658['VoiceQueueId']=_0x3d5f4b[_0x6ca8('0x59')]||undefined;return _0x5e4658;};exports[_0x6ca8('0x5a')]=function(_0x362c91,_0x3a895b){if(!_[_0x6ca8('0x18')](_0x362c91)){if(_0x362c91[_0x6ca8('0x5b')]>0x0){_0x362c91[_0x6ca8('0x5b')]-=0x1;}else{logger['error'](_0x3a895b,_0x6ca8('0x5c'));}}else{logger[_0x6ca8('0xb')](_0x3a895b,_0x6ca8('0x5d'));}};exports[_0x6ca8('0x5e')]=function(_0x3d36ae){if(_0x3d36ae<=0x0){return!![];}return![];};exports[_0x6ca8('0x5f')]=function(_0x2bc0a9,_0x1a2dc3,_0x386268){_0x2bc0a9[_0x6ca8('0x60')]=_0x1a2dc3;_0x2bc0a9['name']=_0x2bc0a9[_0x6ca8('0x61')];_0x2bc0a9['interface']=_0x2bc0a9[_0x6ca8('0x4b')];_0x2bc0a9[_0x6ca8('0x62')]='voice';if(_0x386268){_0x2bc0a9[_0x6ca8('0x63')]=_0x386268[_0x6ca8('0x63')];}return _0x2bc0a9;};exports[_0x6ca8('0x64')]=function(_0x58e939){var _0x50326e={};_0x50326e['queue']=_0x58e939['queue'];_0x50326e[_0x6ca8('0x65')]=_0x58e939['channelAgent'];_0x50326e[_0x6ca8('0x49')]=_0x58e939[_0x6ca8('0x49')];return _0x50326e;};exports[_0x6ca8('0x66')]=function(_0x4f11f6){var _0x34cd85=[];for(var _0x5c2db2 in _0x4f11f6){if(_0x4f11f6[_0x6ca8('0x2b')](_0x5c2db2)){if(!_['isNil'](_0x4f11f6[_0x5c2db2])&&_0x4f11f6[_0x5c2db2][_0x6ca8('0x3c')]===_0x6ca8('0x67')&&_0x4f11f6[_0x5c2db2][_0x6ca8('0x68')]===_0x6ca8('0x69')){_0x34cd85['push'](_0x4f11f6[_0x5c2db2]['id']);}}}return _0x34cd85;};exports['getDiff']=function(_0x447e05){var _0x6419ec=moment()[_0x6ca8('0x6a')](0x0);var _0x382b00=moment(_0x447e05)[_0x6ca8('0x6a')](0x0);return _0x6419ec['diff'](_0x382b00,'seconds');};exports[_0x6ca8('0x6b')]=function(_0x56c746){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x56c746[_0x6ca8('0x1c')],'ListId':_0x56c746[_0x6ca8('0x58')],'VoiceQueueId':_0x56c746[_0x6ca8('0x59')]||undefined,'CampaignId':_0x56c746[_0x6ca8('0x6c')]||undefined};};exports[_0x6ca8('0x6d')]=function(_0x1f1a34){if(_0x1f1a34==='uniqueid'||_0x1f1a34===_0x6ca8('0x6e')||_0x1f1a34===_0x6ca8('0x61')||_0x1f1a34===_0x6ca8('0x6f')||_0x1f1a34===_0x6ca8('0x70')||_0x1f1a34==='dialAnswer'||_0x1f1a34===_0x6ca8('0x40')||_0x1f1a34===_0x6ca8('0x4b')||_0x1f1a34===_0x6ca8('0x1b')||_0x1f1a34==='active'||_0x1f1a34===_0x6ca8('0x4c')||_0x1f1a34===_0x6ca8('0x71')||_0x1f1a34==='countbusyretry'||_0x1f1a34===_0x6ca8('0x51')||_0x1f1a34===_0x6ca8('0x72')||_0x1f1a34===_0x6ca8('0x73')||_0x1f1a34===_0x6ca8('0x74')||_0x1f1a34===_0x6ca8('0x75')||_0x1f1a34==='callbackat'||_0x1f1a34==='recallme'||_0x1f1a34==='ContactId'||_0x1f1a34===_0x6ca8('0x58')||_0x1f1a34===_0x6ca8('0x41')||_0x1f1a34===_0x6ca8('0x59')||_0x1f1a34===_0x6ca8('0x76')||_0x1f1a34===_0x6ca8('0x77')||_0x1f1a34==='xmd-queue'||_0x1f1a34===_0x6ca8('0x78')||_0x1f1a34===_0x6ca8('0x79')||_0x1f1a34==='xmd-dialurl'||_0x1f1a34===_0x6ca8('0x7a')||_0x1f1a34===_0x6ca8('0x7b')||_0x1f1a34===_0x6ca8('0x7c')||_0x1f1a34===_0x6ca8('0x7d')||_0x1f1a34===_0x6ca8('0x7e')||_0x1f1a34===_0x6ca8('0x7f')||_0x1f1a34===_0x6ca8('0x80')||_0x1f1a34==='xmd-agiafter'||_0x1f1a34===_0x6ca8('0x81')||_0x1f1a34===_0x6ca8('0x82')||_0x1f1a34===_0x6ca8('0x83')||_0x1f1a34===_0x6ca8('0x84')||_0x1f1a34===_0x6ca8('0x85')||_0x1f1a34===_0x6ca8('0x86')||_0x1f1a34==='rtpaudioqoslossbridged'||_0x1f1a34===_0x6ca8('0x87')||_0x1f1a34===_0x6ca8('0x88')||_0x1f1a34==='rtpaudioqos'||_0x1f1a34===_0x6ca8('0x83')||_0x1f1a34==='rtpaudioqosjitter'||_0x1f1a34===_0x6ca8('0x85')||_0x1f1a34==='rtpaudioqosloss'||_0x1f1a34===_0x6ca8('0x89')||_0x1f1a34===_0x6ca8('0x87')||_0x1f1a34===_0x6ca8('0x88')||_0x1f1a34===_0x6ca8('0x8a')||_0x1f1a34==='bridgepvtcallid'||_0x1f1a34===_0x6ca8('0x3c')||_0x1f1a34===_0x6ca8('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2cd496,_0x75c6c5){var _0x4b4c48,_0x4c25e7,_0x557bf1;if(_0x75c6c5<=0x0){_0x75c6c5=0x1;}_0x4b4c48=new RegExp('\x5cw{0,'+_0x75c6c5+'}$');_0x4c25e7=Math[_0x6ca8('0x8b')](0xa,_0x75c6c5-0x1);_0x557bf1=Math[_0x6ca8('0x8b')](0xa,_0x75c6c5)-0x1;return util[_0x6ca8('0x14')]('%s',_[_0x6ca8('0x8c')](_0x2cd496,_0x4b4c48,_[_0x6ca8('0x8d')](_0x4c25e7,_0x557bf1)));};exports[_0x6ca8('0x8e')]=function(_0x4c4409){var _0x2927da=_0x4c4409[_0x6ca8('0x8f')](/"(.*?)"/);return _0x2927da?_0x2927da[0x1]:_0x4c4409;};exports[_0x6ca8('0x90')]=function(_0x47f5b1){var _0x293c6c=_0x47f5b1[_0x6ca8('0x8f')](/<(.*?)>/);return _0x293c6c?_0x293c6c[0x1]:_0x47f5b1;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 975d2c2..2b0f742 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 _0x301a=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x301a,0x17b));var _0xa301=function(_0x26a936,_0x13024d){_0x26a936=_0x26a936-0x0;var _0x4746af=_0x301a[_0x26a936];return _0x4746af;};'use strict';exports[_0xa301('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa301('0x1'),'required':!![]},'membername':{'type':_0xa301('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xa301('0x2'),'required':![]}};exports[_0xa301('0x3')]={'queue':{'type':_0xa301('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa301('0x4')]={'interface':{'type':_0xa301('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xa301('0x1'),'required':![]}};exports[_0xa301('0x5')]={'module':{'type':_0xa301('0x1'),'required':![]}};exports[_0xa301('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa301('0x7')]={'uniqueid':{'type':_0xa301('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xa301('0x1')},'mixmonitorid':{'type':_0xa301('0x1')}};exports[_0xa301('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa301('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa301('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x874d=['queueremove','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','boolean'];(function(_0x142edf,_0x54f41e){var _0x35b53a=function(_0x1ae227){while(--_0x1ae227){_0x142edf['push'](_0x142edf['shift']());}};_0x35b53a(++_0x54f41e);}(_0x874d,0x1e8));var _0xd874=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x874d[_0x3b76f7];return _0x43984e;};'use strict';exports['queueadd']={'queue':{'type':_0xd874('0x0'),'required':!![]},'interface':{'type':_0xd874('0x0'),'required':!![]},'membername':{'type':_0xd874('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xd874('0x1'),'required':![]}};exports[_0xd874('0x2')]={'queue':{'type':_0xd874('0x0'),'required':!![]},'interface':{'type':_0xd874('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xd874('0x0'),'required':!![]},'paused':{'type':_0xd874('0x1')},'reason':{'type':_0xd874('0x0'),'required':![]}};exports[_0xd874('0x3')]={'module':{'type':_0xd874('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xd874('0x0'),'required':!![]}};exports[_0xd874('0x4')]={'uniqueid':{'type':_0xd874('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xd874('0x0')}};exports[_0xd874('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd874('0x6')]={'uniqueid':{'type':_0xd874('0x0'),'required':!![]},'exten':{'type':_0xd874('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5f2c1b7..3b72d69 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 _0x0a5d=['abandoned','queuecallerleaveAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','merge','initFaxAccounts','faxAccounts','util','moment','../model/telephone','../model/trunk','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','interface','SIP/%s','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','name','isUndefined','initVoiceQueues','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerabandon'];(function(_0x57a5e7,_0x595179){var _0x4f2ad7=function(_0x492d1f){while(--_0x492d1f){_0x57a5e7['push'](_0x57a5e7['shift']());}};_0x4f2ad7(++_0x595179);}(_0x0a5d,0x7a));var _0xd0a5=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x0a5d[_0x2becba];return _0x90b5dd;};'use strict';var BPromise=require('bluebird');var util=require(_0xd0a5('0x0'));var _=require('lodash');var moment=require(_0xd0a5('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xd0a5('0x2'));var Trunk=require(_0xd0a5('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xd0a5('0x4'));var Template=require('../model/template');var Campaign=require(_0xd0a5('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xd0a5('0x6'));var SalesforceAccount=require(_0xd0a5('0x7'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xd0a5('0x8'));var ZohoAccount=require(_0xd0a5('0x9'));var DeskAccount=require(_0xd0a5('0xa'));var VtigerAccount=require(_0xd0a5('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xd0a5('0xc'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xd0a5('0xd')]={};this[_0xd0a5('0xe')]={};this[_0xd0a5('0xf')]={};this[_0xd0a5('0x10')]={};this[_0xd0a5('0x11')]={};this['campaigns']={};this[_0xd0a5('0x12')]={};this[_0xd0a5('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd0a5('0x14')]={};this[_0xd0a5('0x15')]={};this['queueChannels']={};this[_0xd0a5('0x16')]={};this[_0xd0a5('0x17')]={};this[_0xd0a5('0x18')]={};this[_0xd0a5('0x19')]={};this['salesforceAccounts']={};this[_0xd0a5('0x1a')]={};this[_0xd0a5('0x1b')]={};this[_0xd0a5('0x1c')]={};this[_0xd0a5('0x1d')]={};this[_0xd0a5('0x1e')]={};this[_0xd0a5('0x1f')]={};this[_0xd0a5('0x20')]={};this[_0xd0a5('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x3bd6c3,_0x315648,_0x268529){var _0x248c07=_[_0xd0a5('0x22')](_0x3bd6c3,function(_0x1e39c1,_0x585c5b){return _0x1e39c1[_0x268529];});for(var _0x1d03ab in _0x315648){if(_0x315648[_0xd0a5('0x23')](_0x1d03ab)){if(!_0x248c07[_0x1d03ab]){delete _0x315648[_0x1d03ab];}}}}function freeIsNotKeySip(_0x2c56e3,_0x16f608){var _0x1334ae=_['mapKeys'](_0x2c56e3,function(_0x5d13c6,_0x2252e6){return util[_0xd0a5('0x24')]('SIP/%s',_0x5d13c6['name']);});for(var _0x3d0fdb in _0x16f608){if(_0x16f608[_0xd0a5('0x23')](_0x3d0fdb)){if(!_0x1334ae[_0x3d0fdb]){delete _0x16f608[_0x3d0fdb];}}}}function freeIsNotKeyAgent(_0x296dd3,_0x44665d){var _0x34f8cf=_[_0xd0a5('0x22')](_0x296dd3,function(_0x59314b,_0x44e99c){var _0x45743e=_['isNil'](_0x59314b[_0xd0a5('0x25')])?util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0x59314b['name']):_0x59314b[_0xd0a5('0x25')];return _0x45743e;});for(var _0x3eb685 in _0x44665d){if(_0x44665d[_0xd0a5('0x23')](_0x3eb685)){if(!_0x34f8cf[_0x3eb685]){delete _0x44665d[_0x3eb685];}}}}function clearVoiceCallReports(_0xcfc7cc){_0xcfc7cc[_0xd0a5('0x27')]=0x0;_0xcfc7cc[_0xd0a5('0x28')]=0x0;_0xcfc7cc[_0xd0a5('0x29')]=0x0;_0xcfc7cc['sumDuration']=0x0;_0xcfc7cc[_0xd0a5('0x2a')]=0x0;}function clearCampaigns(_0x42f9fe){if(!_[_0xd0a5('0x2b')](_0x42f9fe)){for(var _0x26b414 in _0x42f9fe){if(_0x42f9fe[_0xd0a5('0x23')](_0x26b414)){_0x42f9fe[_0x26b414][_0xd0a5('0x2c')]=0x0;_0x42f9fe[_0x26b414][_0xd0a5('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x141996){if(!_['isEmpty'](_0x141996)){for(var _0x112ef5 in _0x141996){if(_0x141996['hasOwnProperty'](_0x112ef5)){_0x141996[_0x112ef5][_0xd0a5('0x27')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x28')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x2e')]=0x0;_0x141996[_0x112ef5]['abandoned']=0x0;_0x141996[_0x112ef5][_0xd0a5('0x29')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x2f')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x2a')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x30')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x31')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x32')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x33')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x34')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x35')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x36')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x37')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x38')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x39')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x3a')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x3b')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x30')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x3c')]=0x0;_0x141996[_0x112ef5][_0xd0a5('0x3d')]=!![];}}}}Realtime[_0xd0a5('0x3e')][_0xd0a5('0x3f')]=function(_0x14a84e,_0x1809b9){for(var _0x29e70a in _0x1809b9){if(_0x14a84e[_0xd0a5('0x23')](_0x29e70a)){_0x14a84e[_0x29e70a]=_0x1809b9[_0x29e70a];}}};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x40')]=function(){var _0x132aff=this;return function(_0x53f43e){if(_0x53f43e){freeIsNotKeyAgent(_0x53f43e,_0x132aff[_0xd0a5('0xd')]);for(var _0x5e5a29=0x0,_0x494ca6={},_0x218823={};_0x5e5a29<_0x53f43e[_0xd0a5('0x41')];_0x5e5a29+=0x1){_0x494ca6=_0x53f43e[_0x5e5a29];var _0x32f761=_['isNil'](_0x494ca6[_0xd0a5('0x25')])?util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0x494ca6[_0xd0a5('0x42')]):_0x494ca6[_0xd0a5('0x25')];if(_['isUndefined'](_0x132aff['agents'][_0x32f761])){_0x132aff['agents'][_0x32f761]=new Agent(_0x494ca6);}else{_0x132aff[_0xd0a5('0x3f')](_0x132aff[_0xd0a5('0xd')][_0x32f761],_0x494ca6);}}}return _0x132aff[_0xd0a5('0xd')];};};Realtime[_0xd0a5('0x3e')]['initTelephones']=function(){var _0x586a2b=this;return function(_0x198026){if(_0x198026){freeIsNotKeySip(_0x198026,_0x586a2b['telephones']);for(var _0x2fcfa1=0x0,_0x19217e={},_0x19cbfb={};_0x2fcfa1<_0x198026[_0xd0a5('0x41')];_0x2fcfa1+=0x1){_0x19217e=_0x198026[_0x2fcfa1];if(_['isUndefined'](_0x586a2b['telephones'][util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0x19217e[_0xd0a5('0x42')])])){_0x586a2b[_0xd0a5('0xe')][util[_0xd0a5('0x24')]('SIP/%s',_0x19217e['name'])]=new Telephone(_0x19217e);}else{_0x586a2b[_0xd0a5('0x3f')](_0x586a2b[_0xd0a5('0xe')][util['format']('SIP/%s',_0x19217e[_0xd0a5('0x42')])],_0x19217e);}}}return _0x586a2b[_0xd0a5('0xe')];};};Realtime[_0xd0a5('0x3e')]['initTrunks']=function(){var _0x5195db=this;return function(_0x234fec){if(_0x234fec){freeIsNotKeySip(_0x234fec,_0x5195db[_0xd0a5('0xf')]);for(var _0x3af8e7=0x0,_0xd81ffa={},_0x5aa211={};_0x3af8e7<_0x234fec[_0xd0a5('0x41')];_0x3af8e7+=0x1){_0xd81ffa=_0x234fec[_0x3af8e7];if(_[_0xd0a5('0x43')](_0x5195db['trunks'][util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0xd81ffa[_0xd0a5('0x42')])])){_0x5195db[_0xd0a5('0xf')][util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0xd81ffa[_0xd0a5('0x42')])]=new Trunk(_0xd81ffa);}else{_0x5195db[_0xd0a5('0x3f')](_0x5195db[_0xd0a5('0xf')][util[_0xd0a5('0x24')](_0xd0a5('0x26'),_0xd81ffa[_0xd0a5('0x42')])],_0xd81ffa);}}}return _0x5195db[_0xd0a5('0xf')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x44')]=function(){var _0x57f3fd=this;return function(_0x206a66){if(_0x206a66){freeIsNotKey(_0x206a66,_0x57f3fd[_0xd0a5('0x10')],_0xd0a5('0x42'));for(var _0x46f3b6=0x0,_0x461efc={},_0x344fc6={};_0x46f3b6<_0x206a66['length'];_0x46f3b6+=0x1){_0x461efc=_0x206a66[_0x46f3b6];if(_[_0xd0a5('0x43')](_0x57f3fd[_0xd0a5('0x10')][_0x461efc[_0xd0a5('0x42')]])){_0x57f3fd[_0xd0a5('0x10')][_0x461efc[_0xd0a5('0x42')]]=new VoiceQueue(_0x461efc);}else{_0x57f3fd[_0xd0a5('0x3f')](_0x57f3fd['voiceQueues'][_0x461efc['name']],_0x461efc);}}}return _0x57f3fd[_0xd0a5('0x10')];};};Realtime[_0xd0a5('0x3e')]['initTriggers']=function(){var _0x53bb53=this;return function(_0x2f3d03){if(_0x2f3d03){freeIsNotKey(_0x2f3d03,_0x53bb53[_0xd0a5('0x11')],'id');for(var _0x289b1a=0x0,_0x291e5a={},_0x2a58ff={};_0x289b1a<_0x2f3d03[_0xd0a5('0x41')];_0x289b1a+=0x1){_0x291e5a=_0x2f3d03[_0x289b1a];if(_[_0xd0a5('0x43')](_0x53bb53[_0xd0a5('0x11')][_0x291e5a['id']])){_0x53bb53[_0xd0a5('0x11')][_0x291e5a['id']]=new Trigger(_0x291e5a);}else{_0x53bb53[_0xd0a5('0x3f')](_0x53bb53['triggers'][_0x291e5a['id']],_0x291e5a);}}}return _0x53bb53['triggers'];};};Realtime[_0xd0a5('0x3e')]['initTemplates']=function(){var _0x1a9783=this;return function(_0x1ff7fa){if(_0x1ff7fa){freeIsNotKey(_0x1ff7fa,_0x1a9783[_0xd0a5('0x12')],'id');for(var _0x24efe5=0x0,_0x1c3468={},_0x13f877={};_0x24efe5<_0x1ff7fa[_0xd0a5('0x41')];_0x24efe5+=0x1){_0x1c3468=_0x1ff7fa[_0x24efe5];if(_['isUndefined'](_0x1a9783['templates'][_0x1c3468['id']])){_0x1a9783[_0xd0a5('0x12')][_0x1c3468['id']]=new Template(_0x1c3468);}else{_0x1a9783['mergeFromDatabase'](_0x1a9783[_0xd0a5('0x12')][_0x1c3468['id']],_0x1c3468);}}}return _0x1a9783[_0xd0a5('0x12')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x45')]=function(){var _0x2e9246=this;return function(_0x58c19f){if(_0x58c19f){freeIsNotKey(_0x58c19f,_0x2e9246[_0xd0a5('0x19')],'id');for(var _0x1d2ccb=0x0,_0x12d20d={},_0x41d2db={};_0x1d2ccb<_0x58c19f['length'];_0x1d2ccb+=0x1){_0x12d20d=_0x58c19f[_0x1d2ccb];if(_[_0xd0a5('0x43')](_0x2e9246[_0xd0a5('0x19')][_0x12d20d['id']])){_0x2e9246['zendeskAccounts'][_0x12d20d['id']]=new ZendeskAccount(_0x12d20d);}else{_0x2e9246[_0xd0a5('0x3f')](_0x2e9246[_0xd0a5('0x19')][_0x12d20d['id']],_0x12d20d);}}}return _0x2e9246[_0xd0a5('0x19')];};};Realtime['prototype'][_0xd0a5('0x46')]=function(){var _0x3175fa=this;return function(_0x3ec823){if(_0x3ec823){freeIsNotKey(_0x3ec823,_0x3175fa[_0xd0a5('0x47')],'id');for(var _0x53b3a9=0x0,_0x49f7c1={},_0x1310ab={};_0x53b3a9<_0x3ec823[_0xd0a5('0x41')];_0x53b3a9+=0x1){_0x49f7c1=_0x3ec823[_0x53b3a9];if(_[_0xd0a5('0x43')](_0x3175fa[_0xd0a5('0x47')][_0x49f7c1['id']])){_0x3175fa[_0xd0a5('0x47')][_0x49f7c1['id']]=new SalesforceAccount(_0x49f7c1);}else{_0x3175fa['mergeFromDatabase'](_0x3175fa['salesforceAccounts'][_0x49f7c1['id']],_0x49f7c1);}}}return _0x3175fa['salesforceAccounts'];};};Realtime['prototype'][_0xd0a5('0x48')]=function(){var _0x11b38f=this;return function(_0x475d41){if(_0x475d41){freeIsNotKey(_0x475d41,_0x11b38f[_0xd0a5('0x1b')],'id');for(var _0x597120=0x0,_0x17dbe7={},_0x41e457={};_0x597120<_0x475d41['length'];_0x597120+=0x1){_0x17dbe7=_0x475d41[_0x597120];if(_[_0xd0a5('0x43')](_0x11b38f[_0xd0a5('0x1b')][_0x17dbe7['id']])){_0x11b38f['freshdeskAccounts'][_0x17dbe7['id']]=new FreshdeskAccount(_0x17dbe7);}else{_0x11b38f[_0xd0a5('0x3f')](_0x11b38f[_0xd0a5('0x1b')][_0x17dbe7['id']],_0x17dbe7);}}}return _0x11b38f[_0xd0a5('0x1b')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x49')]=function(){var _0x480c63=this;return function(_0x15de65){if(_0x15de65){freeIsNotKey(_0x15de65,_0x480c63[_0xd0a5('0x1c')],'id');for(var _0x42f876=0x0,_0x5bdd23={},_0x3157a4={};_0x42f876<_0x15de65['length'];_0x42f876+=0x1){_0x5bdd23=_0x15de65[_0x42f876];if(_['isUndefined'](_0x480c63['zohoAccounts'][_0x5bdd23['id']])){_0x480c63[_0xd0a5('0x1c')][_0x5bdd23['id']]=new ZohoAccount(_0x5bdd23);}else{_0x480c63[_0xd0a5('0x3f')](_0x480c63[_0xd0a5('0x1c')][_0x5bdd23['id']],_0x5bdd23);}}}return _0x480c63['zohoAccounts'];};};Realtime['prototype'][_0xd0a5('0x4a')]=function(){var _0x333c28=this;return function(_0x49dc4b){if(_0x49dc4b){freeIsNotKey(_0x49dc4b,_0x333c28[_0xd0a5('0x1d')],'id');for(var _0x46a62e=0x0,_0x62540d={},_0x50a80e={};_0x46a62e<_0x49dc4b[_0xd0a5('0x41')];_0x46a62e+=0x1){_0x62540d=_0x49dc4b[_0x46a62e];if(_['isUndefined'](_0x333c28[_0xd0a5('0x1d')][_0x62540d['id']])){_0x333c28['deskAccounts'][_0x62540d['id']]=new DeskAccount(_0x62540d);}else{_0x333c28[_0xd0a5('0x3f')](_0x333c28[_0xd0a5('0x1d')][_0x62540d['id']],_0x62540d);}}}return _0x333c28[_0xd0a5('0x1d')];};};Realtime['prototype'][_0xd0a5('0x4b')]=function(){var _0x21d1fd=this;return function(_0x3d4f42){if(_0x3d4f42){freeIsNotKey(_0x3d4f42,_0x21d1fd[_0xd0a5('0x1a')],'id');for(var _0x45ef4a=0x0,_0x1ec594={},_0x531d0e={};_0x45ef4a<_0x3d4f42['length'];_0x45ef4a+=0x1){_0x1ec594=_0x3d4f42[_0x45ef4a];if(_[_0xd0a5('0x43')](_0x21d1fd['sugarcrmAccounts'][_0x1ec594['id']])){_0x21d1fd[_0xd0a5('0x1a')][_0x1ec594['id']]=new SugarcrmAccount(_0x1ec594);}else{_0x21d1fd[_0xd0a5('0x3f')](_0x21d1fd['sugarcrmAccounts'][_0x1ec594['id']],_0x1ec594);}}}return _0x21d1fd[_0xd0a5('0x1a')];};};Realtime[_0xd0a5('0x3e')]['initVtigerAccounts']=function(){var _0x54eb1f=this;return function(_0x4bced1){if(_0x4bced1){freeIsNotKey(_0x4bced1,_0x54eb1f[_0xd0a5('0x1e')],'id');for(var _0x5887a4=0x0,_0x5ac5bc={},_0x134a2b={};_0x5887a4<_0x4bced1[_0xd0a5('0x41')];_0x5887a4+=0x1){_0x5ac5bc=_0x4bced1[_0x5887a4];if(_['isUndefined'](_0x54eb1f[_0xd0a5('0x1e')][_0x5ac5bc['id']])){_0x54eb1f['vtigerAccounts'][_0x5ac5bc['id']]=new VtigerAccount(_0x5ac5bc);}else{_0x54eb1f[_0xd0a5('0x3f')](_0x54eb1f[_0xd0a5('0x1e')][_0x5ac5bc['id']],_0x5ac5bc);}}}return _0x54eb1f[_0xd0a5('0x1e')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x132a1b=this;return function(_0x129fdc){if(_0x129fdc){freeIsNotKey(_0x129fdc,_0x132a1b['servicenowAccounts'],'id');for(var _0x51dd8c=0x0,_0x2b395c={},_0x460550={};_0x51dd8c<_0x129fdc[_0xd0a5('0x41')];_0x51dd8c+=0x1){_0x2b395c=_0x129fdc[_0x51dd8c];if(_[_0xd0a5('0x43')](_0x132a1b[_0xd0a5('0x1f')][_0x2b395c['id']])){_0x132a1b[_0xd0a5('0x1f')][_0x2b395c['id']]=new ServicenowAccount(_0x2b395c);}else{_0x132a1b[_0xd0a5('0x3f')](_0x132a1b[_0xd0a5('0x1f')][_0x2b395c['id']],_0x2b395c);}}}return _0x132a1b[_0xd0a5('0x1f')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x4c')]=function(){var _0x541916=this;return function(_0x1b0cff){if(_0x1b0cff){freeIsNotKey(_0x1b0cff,_0x541916[_0xd0a5('0x20')],'id');for(var _0x2484b4=0x0,_0x57a145={},_0x2ea9a5={};_0x2484b4<_0x1b0cff['length'];_0x2484b4+=0x1){_0x57a145=_0x1b0cff[_0x2484b4];if(_['isUndefined'](_0x541916['dynamics365Accounts'][_0x57a145['id']])){_0x541916['dynamics365Accounts'][_0x57a145['id']]=new Dynamics365Account(_0x57a145);}else{_0x541916[_0xd0a5('0x3f')](_0x541916['dynamics365Accounts'][_0x57a145['id']],_0x57a145);}}}return _0x541916['dynamics365Accounts'];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x4d')]=function(){var _0x38228f=this;return function(_0x5c345e){if(_0x5c345e){freeIsNotKey(_0x5c345e,_0x38228f[_0xd0a5('0x21')],'id');for(var _0x59c221=0x0,_0x3468f9={},_0x25f0dc={};_0x59c221<_0x5c345e['length'];_0x59c221+=0x1){_0x3468f9=_0x5c345e[_0x59c221];if(_[_0xd0a5('0x43')](_0x38228f[_0xd0a5('0x21')][_0x3468f9['id']])){_0x38228f[_0xd0a5('0x21')][_0x3468f9['id']]=new FreshsalesAccount(_0x3468f9);}else{_0x38228f[_0xd0a5('0x3f')](_0x38228f[_0xd0a5('0x21')][_0x3468f9['id']],_0x3468f9);}}}return _0x38228f['freshsalesAccounts'];};};Realtime['prototype'][_0xd0a5('0x4e')]=function(){var _0x4a0b98=this;return function(_0xa665b7){for(var _0x544f2f=0x0;_0x544f2f<_0xa665b7[_0xd0a5('0x41')];_0x544f2f+=0x1){_['merge'](_0x4a0b98[_0xd0a5('0x10')][_0xa665b7[_0x544f2f]['name']],_0xa665b7[_0x544f2f]);}return _0x4a0b98[_0xd0a5('0x10')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x4f')]=function(){var _0x2f3990=this;return function(_0x687789){clearVoiceQueues(_0x2f3990[_0xd0a5('0x10')]);if(_0x687789){_0x687789=_['groupBy'](_0x687789,'uniqueid');for(var _0x58960a in _0x687789){if(_0x687789[_0xd0a5('0x23')](_0x58960a)){var _0x470779={};for(var _0x848714=0x0;_0x848714<_0x687789[_0x58960a][_0xd0a5('0x41')];_0x848714+=0x1){var _0x317a8f=_0x687789[_0x58960a][_0x848714][_0xd0a5('0x50')];if(_0x2f3990[_0xd0a5('0x10')][_0x317a8f]){if(_0x687789[_0x58960a][_0x848714]['queuecallerexit']){_0x2f3990[_0xd0a5('0x10')][_0x317a8f]['unmanaged']+=0x1;}if(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x51')]){_0x2f3990[_0xd0a5('0x10')][_0x317a8f][_0xd0a5('0x52')]+=0x1;}_0x2f3990[_0xd0a5('0x10')][_0x317a8f][_0xd0a5('0x29')]+=moment(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x53')])['diff'](moment(_0x687789[_0x58960a][_0x848714]['queuecallerjoinAt']),_0xd0a5('0x54'))||0x0;if(_0x848714===_0x687789[_0x58960a]['length']-0x1){_0x2f3990[_0xd0a5('0x10')][_0x317a8f][_0xd0a5('0x2f')]+=moment(_0x687789[_0x58960a][_0x848714]['queuecallercompleteAt']||_0x687789[_0x58960a][_0x848714][_0xd0a5('0x55')]||_0x687789[_0x58960a][_0x848714][_0xd0a5('0x56')])[_0xd0a5('0x57')](moment(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x58')]),_0xd0a5('0x54'))||0x0;_0x2f3990[_0xd0a5('0x10')][_0x317a8f][_0xd0a5('0x27')]+=0x1;if(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x59')]){_0x2f3990['voiceQueues'][_0x317a8f]['answered']+=0x1;_0x2f3990[_0xd0a5('0x10')][_0x317a8f][_0xd0a5('0x2a')]+=moment(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x5a')])[_0xd0a5('0x57')](moment(_0x687789[_0x58960a][_0x848714][_0xd0a5('0x53')]),'seconds')||0x0;}}else{_0x2f3990['voiceQueues'][_0x317a8f]['sumDuration']+=_0x2f3990['voiceQueues'][_0x317a8f][_0xd0a5('0x29')]||0x0;}}}}}}return _0x2f3990[_0xd0a5('0x10')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x5b')]=function(){var _0x2d59e4=this;return function(_0x52fa6e){clearVoiceCallReports(_0x2d59e4[_0xd0a5('0x13')]);if(_0x52fa6e){for(var _0x303507=0x0;_0x303507<_0x52fa6e[_0xd0a5('0x41')];_0x303507+=0x1){_0x2d59e4['outbound'][_0xd0a5('0x27')]+=0x1;_0x2d59e4[_0xd0a5('0x13')]['sumDuration']+=_0x52fa6e[_0x303507][_0xd0a5('0x5c')];if(_0x52fa6e[_0x303507][_0xd0a5('0x5d')]===_0xd0a5('0x5e')){_0x2d59e4['outbound']['answered']+=0x1;_0x2d59e4[_0xd0a5('0x13')][_0xd0a5('0x29')]+=_0x52fa6e[_0x303507][_0xd0a5('0x5c')]-_0x52fa6e[_0x303507][_0xd0a5('0x5f')]||0x0;_0x2d59e4[_0xd0a5('0x13')]['sumBillable']+=_0x52fa6e[_0x303507][_0xd0a5('0x5f')];}}}return _0x2d59e4[_0xd0a5('0x13')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x60')]=function(){var _0xaddadc=this;return function(_0x41c072){if(_0x41c072){freeIsNotKey(_0x41c072,_0xaddadc[_0xd0a5('0x61')],'name');for(var _0x18039d=0x0,_0x41031a={};_0x18039d<_0x41c072[_0xd0a5('0x41')];_0x18039d+=0x1){_0x41031a=_0x41c072[_0x18039d];if(_['isUndefined'](_0xaddadc[_0xd0a5('0x61')][_0x41031a[_0xd0a5('0x42')]])){_0xaddadc['campaigns'][_0x41031a[_0xd0a5('0x42')]]=new Campaign(_0x41031a);}else{_0xaddadc['mergeFromDatabase'](_0xaddadc[_0xd0a5('0x61')][_0x41031a[_0xd0a5('0x42')]],_0x41031a);_0xaddadc[_0xd0a5('0x61')][_0x41031a[_0xd0a5('0x42')]]['dialQueueProject']=_0x41031a[_0xd0a5('0x62')]?_0x41031a[_0xd0a5('0x62')]['name']:undefined;}}}return _0xaddadc[_0xd0a5('0x61')];};};Realtime[_0xd0a5('0x3e')]['initVoiceExtensions']=function(){var _0x187a86=this;return function(_0x50758f){if(_0x50758f){freeIsNotKey(_0x50758f,_0x187a86[_0xd0a5('0x14')],'id');for(var _0x130eb2=0x0,_0x159f23={};_0x130eb2<_0x50758f[_0xd0a5('0x41')];_0x130eb2+=0x1){_0x159f23=_0x50758f[_0x130eb2];if(_[_0xd0a5('0x43')](_0x187a86[_0xd0a5('0x14')][_0x159f23['id']])){_0x187a86[_0xd0a5('0x14')][_0x159f23['id']]=new VoiceExtension(_0x159f23);}else{_0x187a86['mergeFromDatabase'](_0x187a86['voiceExtensions'][_0x159f23['id']],_0x159f23);}}}return _0x187a86[_0xd0a5('0x14')];};};Realtime[_0xd0a5('0x3e')]['initCampaignHopperHistory']=function(){var _0x2d6769=this;return function(_0x25a837){clearCampaigns(_0x2d6769[_0xd0a5('0x61')]);for(var _0x3fe6e2=0x0;_0x3fe6e2<_0x25a837['length'];_0x3fe6e2+=0x1){_[_0xd0a5('0x63')](_0x2d6769['campaigns'][_0x25a837[_0x3fe6e2]['name']],_0x25a837[_0x3fe6e2]);}return _0x2d6769[_0xd0a5('0x61')];};};Realtime[_0xd0a5('0x3e')][_0xd0a5('0x64')]=function(){var _0x1bd9da=this;return function(_0x3c7a36){if(_0x3c7a36){freeIsNotKey(_0x3c7a36,_0x1bd9da[_0xd0a5('0x65')],'id');for(var _0x3bab72=0x0,_0xde4890={},_0x58e625={};_0x3bab72<_0x3c7a36[_0xd0a5('0x41')];_0x3bab72+=0x1){_0xde4890=_0x3c7a36[_0x3bab72];if(_['isUndefined'](_0x1bd9da['faxAccounts'][_0xde4890['id']])){_0x1bd9da[_0xd0a5('0x65')][_0xde4890['id']]=new FaxAccount(_0xde4890);}else{_0x1bd9da['mergeFromDatabase'](_0x1bd9da[_0xd0a5('0x65')][_0xde4890['id']],_0xde4890);}}}return _0x1bd9da[_0xd0a5('0x65')];};};module['exports']=Realtime; \ No newline at end of file +var _0x3ea1=['dialQueueProject','SquareProject','initFaxAccounts','exports','util','lodash','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','agents','length','SIP/%s','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','duration','disposition','billableseconds','initCampaigns'];(function(_0x309b59,_0x4eceb6){var _0x369c42=function(_0x1f3a2f){while(--_0x1f3a2f){_0x309b59['push'](_0x309b59['shift']());}};_0x369c42(++_0x4eceb6);}(_0x3ea1,0x1ac));var _0x13ea=function(_0x4c1e1b,_0x4d6411){_0x4c1e1b=_0x4c1e1b-0x0;var _0xc0a3f=_0x3ea1[_0x4c1e1b];return _0xc0a3f;};'use strict';var BPromise=require('bluebird');var util=require(_0x13ea('0x0'));var _=require(_0x13ea('0x1'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x13ea('0x2'));var VoiceQueue=require(_0x13ea('0x3'));var Trigger=require(_0x13ea('0x4'));var Template=require(_0x13ea('0x5'));var Campaign=require(_0x13ea('0x6'));var VoiceExtension=require(_0x13ea('0x7'));var ZendeskAccount=require(_0x13ea('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x13ea('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x13ea('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x13ea('0xb'));var ServicenowAccount=require(_0x13ea('0xc'));var Dynamics365Account=require(_0x13ea('0xd'));var FreshsalesAccount=require(_0x13ea('0xe'));var FaxAccount=require(_0x13ea('0xf'));var Realtime=function(){this['agents']={};this[_0x13ea('0x10')]={};this[_0x13ea('0x11')]={};this[_0x13ea('0x12')]={};this[_0x13ea('0x13')]={};this[_0x13ea('0x14')]={};this[_0x13ea('0x15')]={};this[_0x13ea('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x13ea('0x17')]={};this[_0x13ea('0x18')]={};this[_0x13ea('0x19')]={};this[_0x13ea('0x1a')]={};this['timers']={};this[_0x13ea('0x1b')]={};this[_0x13ea('0x1c')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x13ea('0x1d')]={};this[_0x13ea('0x1e')]={};this[_0x13ea('0x1f')]={};this[_0x13ea('0x20')]={};this['servicenowAccounts']={};this[_0x13ea('0x21')]={};this[_0x13ea('0x22')]={};this[_0x13ea('0x23')]={};};function freeIsNotKey(_0x556cc5,_0x3f25a5,_0x40d825){var _0x36c4e5=_[_0x13ea('0x24')](_0x556cc5,function(_0x3fb461,_0x2ddf9d){return _0x3fb461[_0x40d825];});for(var _0x23503e in _0x3f25a5){if(_0x3f25a5[_0x13ea('0x25')](_0x23503e)){if(!_0x36c4e5[_0x23503e]){delete _0x3f25a5[_0x23503e];}}}}function freeIsNotKeySip(_0x387819,_0x50e625){var _0x3ab021=_['mapKeys'](_0x387819,function(_0x54547a,_0x17c5b4){return util[_0x13ea('0x26')]('SIP/%s',_0x54547a[_0x13ea('0x27')]);});for(var _0x150bb2 in _0x50e625){if(_0x50e625[_0x13ea('0x25')](_0x150bb2)){if(!_0x3ab021[_0x150bb2]){delete _0x50e625[_0x150bb2];}}}}function freeIsNotKeyAgent(_0x578ab5,_0x4e8c6d){var _0x24d31c=_[_0x13ea('0x24')](_0x578ab5,function(_0x308ae7,_0x51e25a){var _0x39022b=_[_0x13ea('0x28')](_0x308ae7[_0x13ea('0x29')])?util['format']('SIP/%s',_0x308ae7[_0x13ea('0x27')]):_0x308ae7[_0x13ea('0x29')];return _0x39022b;});for(var _0x53664e in _0x4e8c6d){if(_0x4e8c6d[_0x13ea('0x25')](_0x53664e)){if(!_0x24d31c[_0x53664e]){delete _0x4e8c6d[_0x53664e];}}}}function clearVoiceCallReports(_0x4f4264){_0x4f4264[_0x13ea('0x2a')]=0x0;_0x4f4264[_0x13ea('0x2b')]=0x0;_0x4f4264[_0x13ea('0x2c')]=0x0;_0x4f4264[_0x13ea('0x2d')]=0x0;_0x4f4264[_0x13ea('0x2e')]=0x0;}function clearCampaigns(_0x1c9002){if(!_['isEmpty'](_0x1c9002)){for(var _0x470cb1 in _0x1c9002){if(_0x1c9002[_0x13ea('0x25')](_0x470cb1)){_0x1c9002[_0x470cb1][_0x13ea('0x2f')]=0x0;_0x1c9002[_0x470cb1][_0x13ea('0x30')]=0x0;}}}}function clearVoiceQueues(_0x108f2f){if(!_['isEmpty'](_0x108f2f)){for(var _0x1a1ee9 in _0x108f2f){if(_0x108f2f[_0x13ea('0x25')](_0x1a1ee9)){_0x108f2f[_0x1a1ee9][_0x13ea('0x2a')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2b')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x31')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x32')]=0x0;_0x108f2f[_0x1a1ee9]['sumHoldTime']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2d')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2e')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x33')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x34')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x35')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x36')]=0x0;_0x108f2f[_0x1a1ee9]['outboundNoSuchCallsDay']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x37')]=0x0;_0x108f2f[_0x1a1ee9]['outboundDropCallsDayTimeout']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x38')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x39')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3a')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3b')]=0x0;_0x108f2f[_0x1a1ee9]['outboundReCallsDay']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x33')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3c')]=0x0;_0x108f2f[_0x1a1ee9]['queueStatusComplete']=!![];}}}}Realtime[_0x13ea('0x3d')][_0x13ea('0x3e')]=function(_0x38dd10,_0x200781){for(var _0x347e22 in _0x200781){if(_0x38dd10[_0x13ea('0x25')](_0x347e22)){_0x38dd10[_0x347e22]=_0x200781[_0x347e22];}}};Realtime[_0x13ea('0x3d')][_0x13ea('0x3f')]=function(){var _0x5f5b6f=this;return function(_0x1e5a6f){if(_0x1e5a6f){freeIsNotKeyAgent(_0x1e5a6f,_0x5f5b6f[_0x13ea('0x40')]);for(var _0x56cb1c=0x0,_0x151979={},_0x1fb293={};_0x56cb1c<_0x1e5a6f[_0x13ea('0x41')];_0x56cb1c+=0x1){_0x151979=_0x1e5a6f[_0x56cb1c];var _0x2c293a=_[_0x13ea('0x28')](_0x151979[_0x13ea('0x29')])?util[_0x13ea('0x26')](_0x13ea('0x42'),_0x151979[_0x13ea('0x27')]):_0x151979[_0x13ea('0x29')];if(_[_0x13ea('0x43')](_0x5f5b6f['agents'][_0x2c293a])){_0x5f5b6f[_0x13ea('0x40')][_0x2c293a]=new Agent(_0x151979);}else{_0x5f5b6f['mergeFromDatabase'](_0x5f5b6f[_0x13ea('0x40')][_0x2c293a],_0x151979);}}}return _0x5f5b6f[_0x13ea('0x40')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x44')]=function(){var _0x3a38bc=this;return function(_0x126b6c){if(_0x126b6c){freeIsNotKeySip(_0x126b6c,_0x3a38bc[_0x13ea('0x10')]);for(var _0x3cf50d=0x0,_0x51a301={},_0x46d0a6={};_0x3cf50d<_0x126b6c[_0x13ea('0x41')];_0x3cf50d+=0x1){_0x51a301=_0x126b6c[_0x3cf50d];if(_[_0x13ea('0x43')](_0x3a38bc[_0x13ea('0x10')][util[_0x13ea('0x26')]('SIP/%s',_0x51a301[_0x13ea('0x27')])])){_0x3a38bc['telephones'][util['format'](_0x13ea('0x42'),_0x51a301['name'])]=new Telephone(_0x51a301);}else{_0x3a38bc['mergeFromDatabase'](_0x3a38bc[_0x13ea('0x10')][util[_0x13ea('0x26')]('SIP/%s',_0x51a301[_0x13ea('0x27')])],_0x51a301);}}}return _0x3a38bc[_0x13ea('0x10')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x45')]=function(){var _0x2ea315=this;return function(_0x3da83e){if(_0x3da83e){freeIsNotKeySip(_0x3da83e,_0x2ea315[_0x13ea('0x11')]);for(var _0x471bca=0x0,_0x3679e2={},_0x48c3db={};_0x471bca<_0x3da83e[_0x13ea('0x41')];_0x471bca+=0x1){_0x3679e2=_0x3da83e[_0x471bca];if(_[_0x13ea('0x43')](_0x2ea315['trunks'][util['format']('SIP/%s',_0x3679e2[_0x13ea('0x27')])])){_0x2ea315[_0x13ea('0x11')][util[_0x13ea('0x26')](_0x13ea('0x42'),_0x3679e2[_0x13ea('0x27')])]=new Trunk(_0x3679e2);}else{_0x2ea315['mergeFromDatabase'](_0x2ea315[_0x13ea('0x11')][util[_0x13ea('0x26')](_0x13ea('0x42'),_0x3679e2[_0x13ea('0x27')])],_0x3679e2);}}}return _0x2ea315['trunks'];};};Realtime['prototype'][_0x13ea('0x46')]=function(){var _0x2fa7d8=this;return function(_0x280159){if(_0x280159){freeIsNotKey(_0x280159,_0x2fa7d8['voiceQueues'],'name');for(var _0x101e7b=0x0,_0x11ec4e={},_0x35b625={};_0x101e7b<_0x280159[_0x13ea('0x41')];_0x101e7b+=0x1){_0x11ec4e=_0x280159[_0x101e7b];if(_[_0x13ea('0x43')](_0x2fa7d8[_0x13ea('0x12')][_0x11ec4e[_0x13ea('0x27')]])){_0x2fa7d8['voiceQueues'][_0x11ec4e['name']]=new VoiceQueue(_0x11ec4e);}else{_0x2fa7d8[_0x13ea('0x3e')](_0x2fa7d8[_0x13ea('0x12')][_0x11ec4e[_0x13ea('0x27')]],_0x11ec4e);}}}return _0x2fa7d8['voiceQueues'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x47')]=function(){var _0x513651=this;return function(_0x1f8996){if(_0x1f8996){freeIsNotKey(_0x1f8996,_0x513651[_0x13ea('0x13')],'id');for(var _0x36a862=0x0,_0x178517={},_0x451bc3={};_0x36a862<_0x1f8996[_0x13ea('0x41')];_0x36a862+=0x1){_0x178517=_0x1f8996[_0x36a862];if(_[_0x13ea('0x43')](_0x513651[_0x13ea('0x13')][_0x178517['id']])){_0x513651[_0x13ea('0x13')][_0x178517['id']]=new Trigger(_0x178517);}else{_0x513651[_0x13ea('0x3e')](_0x513651[_0x13ea('0x13')][_0x178517['id']],_0x178517);}}}return _0x513651['triggers'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x48')]=function(){var _0x452f23=this;return function(_0x2190e4){if(_0x2190e4){freeIsNotKey(_0x2190e4,_0x452f23[_0x13ea('0x15')],'id');for(var _0x48a10f=0x0,_0x46fcc2={},_0xc29b93={};_0x48a10f<_0x2190e4['length'];_0x48a10f+=0x1){_0x46fcc2=_0x2190e4[_0x48a10f];if(_['isUndefined'](_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']])){_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']]=new Template(_0x46fcc2);}else{_0x452f23[_0x13ea('0x3e')](_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']],_0x46fcc2);}}}return _0x452f23[_0x13ea('0x15')];};};Realtime[_0x13ea('0x3d')]['initZendeskAccounts']=function(){var _0x2a2ee3=this;return function(_0x21a807){if(_0x21a807){freeIsNotKey(_0x21a807,_0x2a2ee3['zendeskAccounts'],'id');for(var _0x3eddc8=0x0,_0x3e44ed={},_0x25e179={};_0x3eddc8<_0x21a807['length'];_0x3eddc8+=0x1){_0x3e44ed=_0x21a807[_0x3eddc8];if(_[_0x13ea('0x43')](_0x2a2ee3[_0x13ea('0x1c')][_0x3e44ed['id']])){_0x2a2ee3['zendeskAccounts'][_0x3e44ed['id']]=new ZendeskAccount(_0x3e44ed);}else{_0x2a2ee3[_0x13ea('0x3e')](_0x2a2ee3[_0x13ea('0x1c')][_0x3e44ed['id']],_0x3e44ed);}}}return _0x2a2ee3['zendeskAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x49')]=function(){var _0x34fbd7=this;return function(_0x8ca180){if(_0x8ca180){freeIsNotKey(_0x8ca180,_0x34fbd7['salesforceAccounts'],'id');for(var _0x7a5027=0x0,_0x42b77f={},_0x4755e5={};_0x7a5027<_0x8ca180[_0x13ea('0x41')];_0x7a5027+=0x1){_0x42b77f=_0x8ca180[_0x7a5027];if(_['isUndefined'](_0x34fbd7[_0x13ea('0x4a')][_0x42b77f['id']])){_0x34fbd7['salesforceAccounts'][_0x42b77f['id']]=new SalesforceAccount(_0x42b77f);}else{_0x34fbd7[_0x13ea('0x3e')](_0x34fbd7[_0x13ea('0x4a')][_0x42b77f['id']],_0x42b77f);}}}return _0x34fbd7[_0x13ea('0x4a')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4b')]=function(){var _0x5b7d19=this;return function(_0x4cce19){if(_0x4cce19){freeIsNotKey(_0x4cce19,_0x5b7d19[_0x13ea('0x1d')],'id');for(var _0x167a55=0x0,_0x2e82f7={},_0xe9e46={};_0x167a55<_0x4cce19[_0x13ea('0x41')];_0x167a55+=0x1){_0x2e82f7=_0x4cce19[_0x167a55];if(_[_0x13ea('0x43')](_0x5b7d19[_0x13ea('0x1d')][_0x2e82f7['id']])){_0x5b7d19[_0x13ea('0x1d')][_0x2e82f7['id']]=new FreshdeskAccount(_0x2e82f7);}else{_0x5b7d19[_0x13ea('0x3e')](_0x5b7d19['freshdeskAccounts'][_0x2e82f7['id']],_0x2e82f7);}}}return _0x5b7d19[_0x13ea('0x1d')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4c')]=function(){var _0x2a311a=this;return function(_0x4ad6d2){if(_0x4ad6d2){freeIsNotKey(_0x4ad6d2,_0x2a311a['zohoAccounts'],'id');for(var _0x131706=0x0,_0x169064={},_0x5bb68c={};_0x131706<_0x4ad6d2[_0x13ea('0x41')];_0x131706+=0x1){_0x169064=_0x4ad6d2[_0x131706];if(_[_0x13ea('0x43')](_0x2a311a[_0x13ea('0x1e')][_0x169064['id']])){_0x2a311a[_0x13ea('0x1e')][_0x169064['id']]=new ZohoAccount(_0x169064);}else{_0x2a311a[_0x13ea('0x3e')](_0x2a311a['zohoAccounts'][_0x169064['id']],_0x169064);}}}return _0x2a311a['zohoAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4d')]=function(){var _0xf68ec1=this;return function(_0x1d6ec5){if(_0x1d6ec5){freeIsNotKey(_0x1d6ec5,_0xf68ec1[_0x13ea('0x1f')],'id');for(var _0x17b98b=0x0,_0x5983a7={},_0x12e77d={};_0x17b98b<_0x1d6ec5['length'];_0x17b98b+=0x1){_0x5983a7=_0x1d6ec5[_0x17b98b];if(_[_0x13ea('0x43')](_0xf68ec1['deskAccounts'][_0x5983a7['id']])){_0xf68ec1[_0x13ea('0x1f')][_0x5983a7['id']]=new DeskAccount(_0x5983a7);}else{_0xf68ec1['mergeFromDatabase'](_0xf68ec1[_0x13ea('0x1f')][_0x5983a7['id']],_0x5983a7);}}}return _0xf68ec1[_0x13ea('0x1f')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4e')]=function(){var _0x850cef=this;return function(_0xbe0037){if(_0xbe0037){freeIsNotKey(_0xbe0037,_0x850cef[_0x13ea('0x4f')],'id');for(var _0x398e52=0x0,_0x2d5cb1={},_0x502a4f={};_0x398e52<_0xbe0037[_0x13ea('0x41')];_0x398e52+=0x1){_0x2d5cb1=_0xbe0037[_0x398e52];if(_[_0x13ea('0x43')](_0x850cef['sugarcrmAccounts'][_0x2d5cb1['id']])){_0x850cef[_0x13ea('0x4f')][_0x2d5cb1['id']]=new SugarcrmAccount(_0x2d5cb1);}else{_0x850cef[_0x13ea('0x3e')](_0x850cef[_0x13ea('0x4f')][_0x2d5cb1['id']],_0x2d5cb1);}}}return _0x850cef['sugarcrmAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x50')]=function(){var _0x5cb003=this;return function(_0x210e5a){if(_0x210e5a){freeIsNotKey(_0x210e5a,_0x5cb003[_0x13ea('0x20')],'id');for(var _0x775d5c=0x0,_0x267534={},_0x11bddf={};_0x775d5c<_0x210e5a[_0x13ea('0x41')];_0x775d5c+=0x1){_0x267534=_0x210e5a[_0x775d5c];if(_[_0x13ea('0x43')](_0x5cb003[_0x13ea('0x20')][_0x267534['id']])){_0x5cb003[_0x13ea('0x20')][_0x267534['id']]=new VtigerAccount(_0x267534);}else{_0x5cb003[_0x13ea('0x3e')](_0x5cb003[_0x13ea('0x20')][_0x267534['id']],_0x267534);}}}return _0x5cb003['vtigerAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x51')]=function(){var _0x329243=this;return function(_0x33dac1){if(_0x33dac1){freeIsNotKey(_0x33dac1,_0x329243[_0x13ea('0x52')],'id');for(var _0x66e38d=0x0,_0x89ad69={},_0x460ff4={};_0x66e38d<_0x33dac1[_0x13ea('0x41')];_0x66e38d+=0x1){_0x89ad69=_0x33dac1[_0x66e38d];if(_[_0x13ea('0x43')](_0x329243['servicenowAccounts'][_0x89ad69['id']])){_0x329243[_0x13ea('0x52')][_0x89ad69['id']]=new ServicenowAccount(_0x89ad69);}else{_0x329243[_0x13ea('0x3e')](_0x329243[_0x13ea('0x52')][_0x89ad69['id']],_0x89ad69);}}}return _0x329243['servicenowAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x53')]=function(){var _0x27d996=this;return function(_0x4872b2){if(_0x4872b2){freeIsNotKey(_0x4872b2,_0x27d996[_0x13ea('0x21')],'id');for(var _0x3f5d76=0x0,_0x2c267f={},_0x1f616c={};_0x3f5d76<_0x4872b2[_0x13ea('0x41')];_0x3f5d76+=0x1){_0x2c267f=_0x4872b2[_0x3f5d76];if(_[_0x13ea('0x43')](_0x27d996[_0x13ea('0x21')][_0x2c267f['id']])){_0x27d996[_0x13ea('0x21')][_0x2c267f['id']]=new Dynamics365Account(_0x2c267f);}else{_0x27d996['mergeFromDatabase'](_0x27d996[_0x13ea('0x21')][_0x2c267f['id']],_0x2c267f);}}}return _0x27d996['dynamics365Accounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x54')]=function(){var _0xfa69db=this;return function(_0x3ffb9d){if(_0x3ffb9d){freeIsNotKey(_0x3ffb9d,_0xfa69db['freshsalesAccounts'],'id');for(var _0x1126d2=0x0,_0x8509fb={},_0x59046d={};_0x1126d2<_0x3ffb9d[_0x13ea('0x41')];_0x1126d2+=0x1){_0x8509fb=_0x3ffb9d[_0x1126d2];if(_[_0x13ea('0x43')](_0xfa69db[_0x13ea('0x22')][_0x8509fb['id']])){_0xfa69db['freshsalesAccounts'][_0x8509fb['id']]=new FreshsalesAccount(_0x8509fb);}else{_0xfa69db[_0x13ea('0x3e')](_0xfa69db[_0x13ea('0x22')][_0x8509fb['id']],_0x8509fb);}}}return _0xfa69db[_0x13ea('0x22')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x55')]=function(){var _0xac4e74=this;return function(_0x17c15b){for(var _0x2a3616=0x0;_0x2a3616<_0x17c15b['length'];_0x2a3616+=0x1){_[_0x13ea('0x56')](_0xac4e74[_0x13ea('0x12')][_0x17c15b[_0x2a3616][_0x13ea('0x27')]],_0x17c15b[_0x2a3616]);}return _0xac4e74[_0x13ea('0x12')];};};Realtime[_0x13ea('0x3d')]['initVoiceQueueReports']=function(){var _0x455a62=this;return function(_0x21c94e){clearVoiceQueues(_0x455a62[_0x13ea('0x12')]);if(_0x21c94e){_0x21c94e=_[_0x13ea('0x57')](_0x21c94e,_0x13ea('0x58'));for(var _0x5108c7 in _0x21c94e){if(_0x21c94e[_0x13ea('0x25')](_0x5108c7)){var _0x3d19b5={};for(var _0x42c63a=0x0;_0x42c63a<_0x21c94e[_0x5108c7]['length'];_0x42c63a+=0x1){var _0x459819=_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x59')];if(_0x455a62['voiceQueues'][_0x459819]){if(_0x21c94e[_0x5108c7][_0x42c63a]['queuecallerexit']){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x31')]+=0x1;}if(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5a')]){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x32')]+=0x1;}_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2c')]+=moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5b')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5c')]),_0x13ea('0x5d'))||0x0;if(_0x42c63a===_0x21c94e[_0x5108c7]['length']-0x1){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2d')]+=moment(_0x21c94e[_0x5108c7][_0x42c63a]['queuecallercompleteAt']||_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5e')]||_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5f')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5c')]),_0x13ea('0x5d'))||0x0;_0x455a62[_0x13ea('0x12')][_0x459819]['total']+=0x1;if(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x60')]){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2b')]+=0x1;_0x455a62[_0x13ea('0x12')][_0x459819]['sumBillable']+=moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x61')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5b')]),_0x13ea('0x5d'))||0x0;}}else{_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2d')]+=_0x455a62['voiceQueues'][_0x459819]['sumHoldTime']||0x0;}}}}}}return _0x455a62[_0x13ea('0x12')];};};Realtime[_0x13ea('0x3d')]['initVoiceCallReports']=function(){var _0x3d7428=this;return function(_0x531a17){clearVoiceCallReports(_0x3d7428[_0x13ea('0x16')]);if(_0x531a17){for(var _0x2a4ded=0x0;_0x2a4ded<_0x531a17[_0x13ea('0x41')];_0x2a4ded+=0x1){_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2a')]+=0x1;_0x3d7428['outbound'][_0x13ea('0x2d')]+=_0x531a17[_0x2a4ded][_0x13ea('0x62')];if(_0x531a17[_0x2a4ded][_0x13ea('0x63')]==='ANSWERED'){_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2b')]+=0x1;_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2c')]+=_0x531a17[_0x2a4ded]['duration']-_0x531a17[_0x2a4ded][_0x13ea('0x64')]||0x0;_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2e')]+=_0x531a17[_0x2a4ded][_0x13ea('0x64')];}}}return _0x3d7428[_0x13ea('0x16')];};};Realtime['prototype'][_0x13ea('0x65')]=function(){var _0x11ca16=this;return function(_0x58bcc5){if(_0x58bcc5){freeIsNotKey(_0x58bcc5,_0x11ca16[_0x13ea('0x14')],_0x13ea('0x27'));for(var _0x8136d4=0x0,_0x34fcdb={};_0x8136d4<_0x58bcc5['length'];_0x8136d4+=0x1){_0x34fcdb=_0x58bcc5[_0x8136d4];if(_[_0x13ea('0x43')](_0x11ca16['campaigns'][_0x34fcdb[_0x13ea('0x27')]])){_0x11ca16[_0x13ea('0x14')][_0x34fcdb[_0x13ea('0x27')]]=new Campaign(_0x34fcdb);}else{_0x11ca16[_0x13ea('0x3e')](_0x11ca16['campaigns'][_0x34fcdb[_0x13ea('0x27')]],_0x34fcdb);_0x11ca16[_0x13ea('0x14')][_0x34fcdb[_0x13ea('0x27')]][_0x13ea('0x66')]=_0x34fcdb[_0x13ea('0x67')]?_0x34fcdb['SquareProject']['name']:undefined;}}}return _0x11ca16['campaigns'];};};Realtime[_0x13ea('0x3d')]['initVoiceExtensions']=function(){var _0x4d0f59=this;return function(_0x39dbdd){if(_0x39dbdd){freeIsNotKey(_0x39dbdd,_0x4d0f59[_0x13ea('0x17')],'id');for(var _0x5ef1a9=0x0,_0x51aae2={};_0x5ef1a9<_0x39dbdd['length'];_0x5ef1a9+=0x1){_0x51aae2=_0x39dbdd[_0x5ef1a9];if(_[_0x13ea('0x43')](_0x4d0f59[_0x13ea('0x17')][_0x51aae2['id']])){_0x4d0f59[_0x13ea('0x17')][_0x51aae2['id']]=new VoiceExtension(_0x51aae2);}else{_0x4d0f59['mergeFromDatabase'](_0x4d0f59['voiceExtensions'][_0x51aae2['id']],_0x51aae2);}}}return _0x4d0f59['voiceExtensions'];};};Realtime[_0x13ea('0x3d')]['initCampaignHopperHistory']=function(){var _0x45f315=this;return function(_0x275f4c){clearCampaigns(_0x45f315['campaigns']);for(var _0x4bb620=0x0;_0x4bb620<_0x275f4c['length'];_0x4bb620+=0x1){_[_0x13ea('0x56')](_0x45f315['campaigns'][_0x275f4c[_0x4bb620][_0x13ea('0x27')]],_0x275f4c[_0x4bb620]);}return _0x45f315['campaigns'];};};Realtime['prototype'][_0x13ea('0x68')]=function(){var _0x511b24=this;return function(_0x44e796){if(_0x44e796){freeIsNotKey(_0x44e796,_0x511b24['faxAccounts'],'id');for(var _0x31b619=0x0,_0x3f42b5={},_0x4b063d={};_0x31b619<_0x44e796[_0x13ea('0x41')];_0x31b619+=0x1){_0x3f42b5=_0x44e796[_0x31b619];if(_[_0x13ea('0x43')](_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']])){_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']]=new FaxAccount(_0x3f42b5);}else{_0x511b24[_0x13ea('0x3e')](_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']],_0x3f42b5);}}}return _0x511b24[_0x13ea('0x23')];};};module[_0x13ea('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f19f164..c55e224 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 _0x5866=['custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','isNil','telephones','name','interface','format','SIP/%s','length','findAgent','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitors','filename','connectedlinename','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport'];(function(_0x516ac4,_0x8b2375){var _0x35c675=function(_0x3c0972){while(--_0x3c0972){_0x516ac4['push'](_0x516ac4['shift']());}};_0x35c675(++_0x8b2375);}(_0x5866,0xa2));var _0x6586=function(_0x30aecc,_0x240706){_0x30aecc=_0x30aecc-0x0;var _0x4cb3c9=_0x5866[_0x30aecc];return _0x4cb3c9;};'use strict';var _=require('lodash');var moment=require(_0x6586('0x0'));var util=require(_0x6586('0x1'));var config=require('../../../config/environment');var ami=require(_0x6586('0x2'));var RpcVoiceAgentReport=require(_0x6586('0x3'));var RpcVoiceCallReport=require(_0x6586('0x4'));var RpcVoiceDialReport=require(_0x6586('0x5'));var RpcMemberReport=require(_0x6586('0x6'));var RpcVoiceQueueReport=require(_0x6586('0x7'));var RpcVoiceRecording=require(_0x6586('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6586('0x9'));var VoiceAgentReport=require(_0x6586('0xa'));var VoiceDialReport=require(_0x6586('0xb'));var UserReport=require(_0x6586('0xc'));function Report(_0x424cd8){this[_0x6586('0xd')]=_0x424cd8;this[_0x6586('0xe')]=_0x424cd8['agents'];this['telephones']=_0x424cd8['telephones'];}Report[_0x6586('0xf')][_0x6586('0x10')]=function(_0x321235){var _0x1ace5d=new VoiceQueueReport(this[_0x6586('0xd')]);var _0x5d73bc=new VoiceAgentReport(this[_0x6586('0xd')]);var _0x3e3c11=new VoiceDialReport(this['realtime']);var _0x3158be=new VoiceCallReport(this[_0x6586('0xd')]);var _0x214a2b=new UserReport(this[_0x6586('0xd')]);if(config['xdr']&&config[_0x6586('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x6586('0x12')][_0x6586('0x13')](this));ami['on'](_0x6586('0x14'),this[_0x6586('0x15')][_0x6586('0x13')](this));ami['on'](_0x6586('0x16'),this[_0x6586('0x17')][_0x6586('0x13')](this));ami['on'](_0x6586('0x18'),this[_0x6586('0x19')][_0x6586('0x13')](this));ami['on'](_0x6586('0x1a'),this[_0x6586('0x1b')][_0x6586('0x13')](this));ami['on'](_0x6586('0x1c'),this[_0x6586('0x1d')][_0x6586('0x13')](this));}};Report['prototype']['findAgent']=function(_0x3cb8c7){var _0x4375ad;_0x4375ad=_[_0x6586('0x1e')](this['agents'],function(_0xce2510){return _0xce2510[_0x6586('0x1f')]==_0x3cb8c7||_0xce2510['name']==_0x3cb8c7;});if(_[_0x6586('0x20')](_0x4375ad)){var _0x5b481b=_[_0x6586('0x1e')](this[_0x6586('0x21')],function(_0x258e8c){return _0x258e8c['accountcode']==_0x3cb8c7||_0x258e8c[_0x6586('0x22')]==_0x3cb8c7;});if(_0x5b481b){_0x4375ad=_[_0x6586('0x1e')](this[_0x6586('0xe')],function(_0xb4090d){return _0xb4090d[_0x6586('0x23')]==util[_0x6586('0x24')](_0x6586('0x25'),_0x5b481b[_0x6586('0x22')]);});}}return _0x4375ad;};Report['prototype']['voiceQueueReport']=function(_0x3c49e9){for(var _0x335cf9=0x0;_0x335cf9<_0x3c49e9[_0x6586('0x26')];_0x335cf9+=0x1){var _0x3f9c3f=this[_0x6586('0x27')](_0x3c49e9[_0x335cf9]['connectedlinenum']);if(_0x3f9c3f){_0x3c49e9[_0x335cf9][_0x6586('0x1f')]=_0x3f9c3f[_0x6586('0x1f')];_0x3c49e9[_0x335cf9]['assigned']=!![];_0x3c49e9[_0x335cf9][_0x6586('0x28')]=_0x3f9c3f[_0x6586('0x22')];_0x3c49e9[_0x335cf9][_0x6586('0x23')]=_['isNil'](_0x3f9c3f[_0x6586('0x23')])?util[_0x6586('0x24')]('SIP/%s',_0x3f9c3f[_0x6586('0x22')]):_0x3f9c3f['interface'];if(_0x3c49e9[_0x335cf9][_0x6586('0x29')]){_0x3c49e9[_0x335cf9][_0x6586('0x2a')]=moment()[_0x6586('0x24')](_0x6586('0x2b'));}if(_0x3c49e9[_0x335cf9][_0x6586('0x2c')]){_0x3c49e9[_0x335cf9][_0x6586('0x2d')]=moment()['format'](_0x6586('0x2b'));}RpcMemberReport[_0x6586('0x12')](_0x3c49e9[_0x335cf9]);}RpcVoiceQueueReport[_0x6586('0x2e')](_0x3c49e9[_0x335cf9]);}};function extractCalleridNumber(_0x4c4490){var _0x2ac608=_0x4c4490[_0x6586('0x2f')](/<(.*?)>/);return _0x2ac608?_0x2ac608[0x1]:_0x4c4490;}Report[_0x6586('0xf')]['getAgentByInternal']=function(_0x17a218){for(var _0x1d6d7e=0x0;_0x1d6d7e/);return _0x424eff?_0x424eff[0x1]:_0x9764aa;}Report[_0x4197('0xd')]['getAgentByInternal']=function(_0xb6882a){for(var _0x1b63be=0x0;_0x1b63be',_0x59b7ee[_0x4197('0x3e')],_0x59b7ee['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x59b7ee[_0x4197('0x3f')]]){var _0x156a4f=RpcVoiceTransferReport['transfers'][_0x59b7ee['linkedid']];_0x156a4f[_0x4197('0x40')]=_0x59b7ee[_0x4197('0x41')];RpcVoiceTransferReport['blindTransfer'](_0x156a4f);delete RpcVoiceTransferReport['transfers'][_0x59b7ee['linkedid']];}if(_[_0x4197('0x1e')](_0x59b7ee['type'])){_0x59b7ee[_0x4197('0x33')]=this[_0x4197('0x2d')](_0x59b7ee);}if(_[_0x4197('0x1e')](_0x59b7ee[_0x4197('0x42')])){var _0x56da0e=_0x59b7ee['channel'][_0x4197('0x43')]('-')[0x0];var _0x407ae4=this[_0x4197('0x1f')][_0x56da0e];if(!_0x407ae4)_0x407ae4=this[_0x4197('0x44')](_0x59b7ee[_0x4197('0x1c')]);if(_0x407ae4){_0x59b7ee[_0x4197('0x42')]=_0x407ae4['id'];_0x59b7ee['membername']=_0x407ae4['name'];}}RpcVoiceCallReport[_0x4197('0x2a')](_0x59b7ee);if(_0x59b7ee[_0x4197('0x45')]){for(var _0x34d890=0x0;_0x34d890<_0x59b7ee[_0x4197('0x46')]['length'];_0x34d890+=0x1){_0x59b7ee[_0x4197('0x47')]=_0x59b7ee[_0x4197('0x46')][_0x34d890]['filename'];_0x59b7ee[_0x4197('0x48')]=_0x59b7ee[_0x4197('0x46')][_0x34d890][_0x4197('0x48')];if(_0x59b7ee['exten']==_0x4197('0x49')){_0x59b7ee['calleridnum']=_0x59b7ee[_0x4197('0x3d')];_0x59b7ee['calleridname']=_0x59b7ee[_0x4197('0x4a')];_0x59b7ee[_0x4197('0x3d')]=_0x59b7ee[_0x4197('0x1c')];_0x59b7ee['connectedlinename']=_0x59b7ee[_0x4197('0x4b')];_0x59b7ee['exten']=_0x59b7ee[_0x4197('0x39')];}else if(_0x59b7ee[_0x4197('0x32')]==_0x4197('0x4c')){_0x59b7ee[_0x4197('0x2e')]=_0x59b7ee[_0x4197('0x31')];_0x59b7ee[_0x4197('0x32')]=_0x59b7ee[_0x4197('0x39')];}RpcVoiceRecording[_0x4197('0x2a')](_0x59b7ee);}}};Report[_0x4197('0xd')]['voiceAgentReport']=function(_0x33d7b0){if(_[_0x4197('0x4d')](_0x33d7b0)){_0x33d7b0['forEach'](function(_0x1874fe){RpcVoiceAgentReport[_0x4197('0x2a')](_0x1874fe);});}else{RpcVoiceAgentReport[_0x4197('0x2a')](_0x33d7b0);}};Report['prototype']['voiceDialReport']=function(_0x497ad9){RpcVoiceDialReport[_0x4197('0x2a')](_0x497ad9);var _0x4f77d3;var _0x502951;var _0x493589=_0x497ad9['channel'];if(_[_0x4197('0x4e')](_0x493589,'Local')){_0x502951=_0x493589[_0x4197('0x4f')](_0x493589['indexOf']('/')+0x1,_0x493589[_0x4197('0x50')]('@'));_0x4f77d3=_[_0x4197('0x1b')](this[_0x4197('0x1f')],function(_0x3e94dd){return _0x3e94dd[_0x4197('0x51')]==_0x502951||_0x3e94dd[_0x4197('0x52')]==_0x502951||_0x3e94dd[_0x4197('0x1c')]==_0x502951;});}else{_0x502951=_0x493589[_0x4197('0x4f')](_0x493589[_0x4197('0x50')]('/')+0x1,_0x493589['lastIndexOf']('-'));_0x4f77d3=this[_0x4197('0x1a')](_0x502951);}if(_0x4f77d3){_0x497ad9[_0x4197('0x20')]=_[_0x4197('0x1e')](_0x4f77d3[_0x4197('0x20')])?util[_0x4197('0x21')](_0x4197('0x22'),_0x4f77d3[_0x4197('0x1d')]):_0x4f77d3[_0x4197('0x20')];_0x497ad9[_0x4197('0x4b')]=_0x4f77d3['name'];_0x497ad9[_0x4197('0x1c')]=_0x4f77d3[_0x4197('0x1c')];RpcMemberReport[_0x4197('0x15')](_0x497ad9);}};Report[_0x4197('0xd')][_0x4197('0x17')]=function(_0x53d4eb){RpcVoiceTransferReport[_0x4197('0x53')][_0x53d4eb[_0x4197('0x54')]]=_0x53d4eb;};Report[_0x4197('0xd')]['attendedTransfer']=function(_0x2b3c34){RpcVoiceTransferReport[_0x4197('0x19')](_0x2b3c34);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f0aa90e..9d7bae6 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 _0x9e8f=['telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','stateRegistry','state','omit','actionid','format','name','trunk:save','error','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','debug','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','indexOf','phone','accountcode','peerstatus','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','defaults','socket.io-emitter','redis','trunks','agents'];(function(_0xab2f46,_0xf5cd3c){var _0x13e330=function(_0x1ec28a){while(--_0x1ec28a){_0xab2f46['push'](_0xab2f46['shift']());}};_0x13e330(++_0xf5cd3c);}(_0x9e8f,0x121));var _0xf9e8=function(_0x2cfa21,_0x5f5974){_0x2cfa21=_0x2cfa21-0x0;var _0xa7d73f=_0x9e8f[_0x2cfa21];return _0xa7d73f;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xf9e8('0x0'));var BPromise=require(_0xf9e8('0x1'));var config=require(_0xf9e8('0x2'));var logger=require(_0xf9e8('0x3'))(_0xf9e8('0x4'));var ami=require(_0xf9e8('0x5'));config['redis']=_[_0xf9e8('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf9e8('0x7'))(new Redis(config[_0xf9e8('0x8')]));function UserReport(_0x433ce4){this[_0xf9e8('0x9')]=_0x433ce4['trunks'];this[_0xf9e8('0xa')]=_0x433ce4[_0xf9e8('0xa')];this[_0xf9e8('0xb')]=_0x433ce4[_0xf9e8('0xb')];ami['on'](_0xf9e8('0xc'),this[_0xf9e8('0xd')][_0xf9e8('0xe')](this));ami['on'](_0xf9e8('0xf'),this[_0xf9e8('0xd')][_0xf9e8('0xe')](this));ami['on'](_0xf9e8('0x10'),this[_0xf9e8('0x11')][_0xf9e8('0xe')](this));ami['on']('peerstatus',this[_0xf9e8('0x12')][_0xf9e8('0xe')](this));return this[_0xf9e8('0x13')]();}function showSipRegistrations(){Promise[_0xf9e8('0x14')]()[_0xf9e8('0x15')](ami[_0xf9e8('0x16')]())['catch'](function(_0x2602d6){logger['error']('[userReport][sipshowregistry]',util[_0xf9e8('0x17')](_0x2602d6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xf9e8('0x15')](ami[_0xf9e8('0x18')]())[_0xf9e8('0x19')](function(_0x2955b6){logger['error'](_0xf9e8('0x1a'),util['inspect'](_0x2955b6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xf9e8('0x14')]()['then'](ami[_0xf9e8('0x1b')]())[_0xf9e8('0x19')](function(_0x58899b){logger['error'](_0xf9e8('0x1c'),util['inspect'](_0x58899b,{'showHidden':![],'depth':null}));});}UserReport[_0xf9e8('0x1d')][_0xf9e8('0x13')]=function(){setInterval(function(){BPromise[_0xf9e8('0x14')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0xf9e8('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xf9e8('0x1d')][_0xf9e8('0x1e')]=function(_0x234bc1){return _0x234bc1!==null&&!_[_0xf9e8('0x1f')](_0x234bc1);};UserReport[_0xf9e8('0x1d')][_0xf9e8('0x20')]=function(_0x389387,_0x4318a1,_0x4a3b16){io['to'](_0x389387)['emit'](_0x4318a1,_0x4a3b16);};UserReport[_0xf9e8('0x1d')][_0xf9e8('0xd')]=function(_0x313573){try{if(this[_0xf9e8('0x1e')](_0x313573)){logger[_0xf9e8('0x21')](_0xf9e8('0x22'),_0x313573[_0xf9e8('0x23')],_0x313573['state']);logger['debug'](_0xf9e8('0x24'),util[_0xf9e8('0x17')](_0x313573,{'showHidden':![],'depth':null}));var _0x55d312=_[_0xf9e8('0x25')](this[_0xf9e8('0x9')],{'defaultuser':_0x313573[_0xf9e8('0x23')]});if(_0x55d312){_0x313573[_0xf9e8('0x26')]=_0x313573[_0xf9e8('0x27')];_['merge'](_0x55d312,_[_0xf9e8('0x28')](_0x313573,['event',_0xf9e8('0x29'),'username',_0xf9e8('0x27')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xf9e8('0x17')](_0x55d312,{'showHidden':![],'depth':null}));this[_0xf9e8('0x20')](util[_0xf9e8('0x2a')]('trunk:%s',_0x55d312[_0xf9e8('0x2b')]),_0xf9e8('0x2c'),_0x55d312);}}}catch(_0x1377ae){logger[_0xf9e8('0x2d')](_0xf9e8('0x24'),util[_0xf9e8('0x17')](_0x1377ae,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x2da70a){try{if(this[_0xf9e8('0x1e')](_0x2da70a)){logger[_0xf9e8('0x21')](_0xf9e8('0x2e'),_0x2da70a[_0xf9e8('0x2f')],_0x2da70a[_0xf9e8('0x27')]);logger['debug'](_0xf9e8('0x30'),util[_0xf9e8('0x17')](_0x2da70a,{'showHidden':![],'depth':null}));if(this[_0xf9e8('0xa')][_0x2da70a['device']]){if(!this[_0xf9e8('0xa')][_0x2da70a['device']][_0xf9e8('0x31')]||_0x2da70a['state'][_0xf9e8('0x32')]()==_0xf9e8('0x33')){this['agents'][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x31')]=![];if(this[_0xf9e8('0xa')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x27')]!==_0x2da70a[_0xf9e8('0x27')][_0xf9e8('0x32')]()){this[_0xf9e8('0xa')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x34')]=_[_0xf9e8('0x35')](moment()[_0xf9e8('0x2a')]('x'));}this[_0xf9e8('0xa')][_0x2da70a['device']][_0xf9e8('0x27')]=_0x2da70a['state'][_0xf9e8('0x32')]();this[_0xf9e8('0xa')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x36')](_0x2da70a);}}else if(this[_0xf9e8('0xb')][_0x2da70a['device']]){if(this[_0xf9e8('0xb')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x27')]!==_0x2da70a[_0xf9e8('0x27')]['toLowerCase']()){this[_0xf9e8('0xb')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x34')]=_[_0xf9e8('0x35')](moment()['format']('x'));}this[_0xf9e8('0xb')][_0x2da70a['device']][_0xf9e8('0x27')]=_0x2da70a['state']['toLowerCase']();logger[_0xf9e8('0x37')](_0xf9e8('0x38'),util[_0xf9e8('0x17')](this[_0xf9e8('0xb')][_0x2da70a[_0xf9e8('0x2f')]],{'showHidden':![],'depth':null}));this[_0xf9e8('0x20')](util[_0xf9e8('0x2a')](_0xf9e8('0x39'),this['telephones'][_0x2da70a['device']][_0xf9e8('0x2b')]),_0xf9e8('0x3a'),this[_0xf9e8('0xb')][_0x2da70a[_0xf9e8('0x2f')]]);}else if(this[_0xf9e8('0x9')][_0x2da70a[_0xf9e8('0x2f')]]){if(this[_0xf9e8('0x9')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x27')]!==_0x2da70a[_0xf9e8('0x27')]['toLowerCase']()){this[_0xf9e8('0x9')][_0x2da70a['device']][_0xf9e8('0x34')]=_['toNumber'](moment()[_0xf9e8('0x2a')]('x'));}this[_0xf9e8('0x9')][_0x2da70a[_0xf9e8('0x2f')]][_0xf9e8('0x27')]=_0x2da70a['state'][_0xf9e8('0x32')]();logger['debug'](_0xf9e8('0x3b'),util[_0xf9e8('0x17')](this[_0xf9e8('0x9')][_0x2da70a[_0xf9e8('0x2f')]],{'showHidden':![],'depth':null}));this[_0xf9e8('0x20')](util[_0xf9e8('0x2a')](_0xf9e8('0x3c'),this[_0xf9e8('0x9')][_0x2da70a['device']][_0xf9e8('0x2b')]),_0xf9e8('0x2c'),this['trunks'][_0x2da70a[_0xf9e8('0x2f')]]);}else if(_[_0xf9e8('0x3d')](_0x2da70a[_0xf9e8('0x2f')],_0xf9e8('0x3e'))){var _0xd8acb8=_0x2da70a[_0xf9e8('0x2f')];var _0x2e3e1b=_0xd8acb8['substring'](_0xd8acb8[_0xf9e8('0x3f')]('/')+0x1,_0xd8acb8['indexOf']('@'));var _0x544866=_[_0xf9e8('0x25')](this[_0xf9e8('0xa')],function(_0x1dc4d9){return _0x1dc4d9['mobile']==_0x2e3e1b||_0x1dc4d9[_0xf9e8('0x40')]==_0x2e3e1b||_0x1dc4d9[_0xf9e8('0x41')]==_0x2e3e1b;});if(_0x544866){if(_0x544866[_0xf9e8('0x27')]!==_0x2da70a[_0xf9e8('0x27')]['toLowerCase']()){_0x544866[_0xf9e8('0x34')]=_[_0xf9e8('0x35')](moment()[_0xf9e8('0x2a')]('x'));}_0x544866['state']=_0x2da70a['state'][_0xf9e8('0x32')]();_0x544866[_0xf9e8('0x31')]=!![];_0x544866[_0xf9e8('0x36')](_0x2da70a);}}}}catch(_0x38db14){logger['error']('[userReport][devicestatechange]',util[_0xf9e8('0x17')](_0x38db14,{'showHidden':![],'depth':null}));}};UserReport[_0xf9e8('0x1d')]['syncPeerStatus']=function(_0x260634){try{if(this['isNotNull'](_0x260634)&&this[_0xf9e8('0x1e')](_0x260634[_0xf9e8('0x42')])){logger[_0xf9e8('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x260634['peer'],_0x260634['address'],_0x260634[_0xf9e8('0x42')]);logger['debug']('[userReport][peerstatus]',util['inspect'](_0x260634,{'showHidden':![],'depth':null}));if(this[_0xf9e8('0xa')][_0x260634[_0xf9e8('0x43')]]){if(!this['agents'][_0x260634['peer']][_0xf9e8('0x31')]||_0x260634[_0xf9e8('0x42')][_0xf9e8('0x32')]()==_0xf9e8('0x44')){this[_0xf9e8('0xa')][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x31')]=![];this['agents'][_0x260634['peer']][_0xf9e8('0x45')]=_0x260634[_0xf9e8('0x42')][_0xf9e8('0x32')]();this['agents'][_0x260634['peer']][_0xf9e8('0x46')]=_0x260634[_0xf9e8('0x46')];this['agents'][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x36')](_0x260634);}}else if(this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]]){this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x45')]=_0x260634['peerstatus']['toLowerCase']();this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x46')]=_0x260634[_0xf9e8('0x46')];logger[_0xf9e8('0x37')](_0xf9e8('0x47'),util[_0xf9e8('0x17')](this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xf9e8('0x39'),this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x2b')]),'telephone:save',this[_0xf9e8('0xb')][_0x260634[_0xf9e8('0x43')]]);}else if(this[_0xf9e8('0x9')][_0x260634[_0xf9e8('0x43')]]){this[_0xf9e8('0x9')][_0x260634[_0xf9e8('0x43')]][_0xf9e8('0x45')]=_0x260634[_0xf9e8('0x42')]['toLowerCase']();this[_0xf9e8('0x9')][_0x260634['peer']][_0xf9e8('0x46')]=_0x260634['address'];logger[_0xf9e8('0x37')](_0xf9e8('0x48'),util[_0xf9e8('0x17')](this[_0xf9e8('0x9')][_0x260634[_0xf9e8('0x43')]],{'showHidden':![],'depth':null}));this[_0xf9e8('0x20')](util[_0xf9e8('0x2a')](_0xf9e8('0x3c'),this['trunks'][_0x260634['peer']][_0xf9e8('0x2b')]),_0xf9e8('0x2c'),this['trunks'][_0x260634[_0xf9e8('0x43')]]);}}}catch(_0x16d0b7){logger['error'](_0xf9e8('0x49'),util[_0xf9e8('0x17')](_0x16d0b7,{'showHidden':![],'depth':null}));}};module[_0xf9e8('0x4a')]=UserReport; \ No newline at end of file +var _0x47e1=['actionSipPeerStatus','prototype','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','name','trunk:save','syncDeviceState','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','telephone:%s','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','then','actionSipShowRegistry','error','inspect','resolve','actionDeviceStateList','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x47e1,0x76));var _0x147e=function(_0x1745e7,_0x1616a7){_0x1745e7=_0x1745e7-0x0;var _0x2b6c8c=_0x47e1[_0x1745e7];return _0x2b6c8c;};'use strict';var _=require(_0x147e('0x0'));var moment=require(_0x147e('0x1'));var util=require(_0x147e('0x2'));var Redis=require(_0x147e('0x3'));var BPromise=require(_0x147e('0x4'));var config=require(_0x147e('0x5'));var logger=require(_0x147e('0x6'))(_0x147e('0x7'));var ami=require(_0x147e('0x8'));config['redis']=_['defaults'](config[_0x147e('0x9')],{'host':_0x147e('0xa'),'port':0x18eb});var io=require(_0x147e('0xb'))(new Redis(config['redis']));function UserReport(_0x2c08fc){this[_0x147e('0xc')]=_0x2c08fc[_0x147e('0xc')];this[_0x147e('0xd')]=_0x2c08fc[_0x147e('0xd')];this[_0x147e('0xe')]=_0x2c08fc[_0x147e('0xe')];ami['on'](_0x147e('0xf'),this[_0x147e('0x10')][_0x147e('0x11')](this));ami['on'](_0x147e('0x12'),this[_0x147e('0x10')][_0x147e('0x11')](this));ami['on'](_0x147e('0x13'),this['syncDeviceState'][_0x147e('0x11')](this));ami['on'](_0x147e('0x14'),this['syncPeerStatus'][_0x147e('0x11')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x147e('0x15')](ami[_0x147e('0x16')]())['catch'](function(_0xd4befa){logger[_0x147e('0x17')]('[userReport][sipshowregistry]',util[_0x147e('0x18')](_0xd4befa,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x147e('0x19')]()[_0x147e('0x15')](ami[_0x147e('0x1a')]())[_0x147e('0x1b')](function(_0x537ce1){logger[_0x147e('0x17')]('[userReport][devicestatelist]',util[_0x147e('0x18')](_0x537ce1,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x147e('0x19')]()[_0x147e('0x15')](ami[_0x147e('0x1c')]())[_0x147e('0x1b')](function(_0x29a048){logger[_0x147e('0x17')]('[userReport][sippeerstatus]',util[_0x147e('0x18')](_0x29a048,{'showHidden':![],'depth':null}));});}UserReport[_0x147e('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x147e('0x19')]()[_0x147e('0x15')](showSipRegistrations())[_0x147e('0x15')](listDeviceStates())[_0x147e('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x147e('0x1e')]=function(_0x160d65){return _0x160d65!==null&&!_['isUndefined'](_0x160d65);};UserReport['prototype']['emit']=function(_0x2cf316,_0x11786d,_0x30de74){io['to'](_0x2cf316)['emit'](_0x11786d,_0x30de74);};UserReport[_0x147e('0x1d')][_0x147e('0x10')]=function(_0x5aa2ec){try{if(this[_0x147e('0x1e')](_0x5aa2ec)){logger[_0x147e('0x1f')](_0x147e('0x20'),_0x5aa2ec[_0x147e('0x21')],_0x5aa2ec[_0x147e('0x22')]);logger['debug'](_0x147e('0x23'),util[_0x147e('0x18')](_0x5aa2ec,{'showHidden':![],'depth':null}));var _0x16b067=_[_0x147e('0x24')](this[_0x147e('0xc')],{'defaultuser':_0x5aa2ec[_0x147e('0x21')]});if(_0x16b067){_0x5aa2ec['stateRegistry']=_0x5aa2ec[_0x147e('0x22')];_[_0x147e('0x25')](_0x16b067,_[_0x147e('0x26')](_0x5aa2ec,[_0x147e('0x27'),_0x147e('0x28'),_0x147e('0x21'),_0x147e('0x22')]));logger[_0x147e('0x29')](_0x147e('0x2a'),util[_0x147e('0x18')](_0x16b067,{'showHidden':![],'depth':null}));this[_0x147e('0x2b')](util[_0x147e('0x2c')](_0x147e('0x2d'),_0x16b067[_0x147e('0x2e')]),_0x147e('0x2f'),_0x16b067);}}}catch(_0x26376e){logger[_0x147e('0x17')](_0x147e('0x23'),util[_0x147e('0x18')](_0x26376e,{'showHidden':![],'depth':null}));}};UserReport[_0x147e('0x1d')][_0x147e('0x30')]=function(_0x26cfa4){try{if(this[_0x147e('0x1e')](_0x26cfa4)){logger[_0x147e('0x1f')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x26cfa4[_0x147e('0x31')],_0x26cfa4[_0x147e('0x22')]);logger['debug'](_0x147e('0x32'),util[_0x147e('0x18')](_0x26cfa4,{'showHidden':![],'depth':null}));if(this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]]){if(!this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x33')]||_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]()==_0x147e('0x35')){this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x33')]=![];if(this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]!==_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]()){this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x36')]=_[_0x147e('0x37')](moment()[_0x147e('0x2c')]('x'));}this[_0x147e('0xd')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]=_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]();this['agents'][_0x26cfa4[_0x147e('0x31')]]['updateStatusRealtime'](_0x26cfa4);}}else if(this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]]){if(this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]!==_0x26cfa4[_0x147e('0x22')]['toLowerCase']()){this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x36')]=_['toNumber'](moment()[_0x147e('0x2c')]('x'));}this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]=_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]();logger['debug'](_0x147e('0x38'),util['inspect'](this[_0x147e('0xe')][_0x26cfa4['device']],{'showHidden':![],'depth':null}));this[_0x147e('0x2b')](util[_0x147e('0x2c')]('telephone:%s',this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x2e')]),_0x147e('0x39'),this[_0x147e('0xe')][_0x26cfa4[_0x147e('0x31')]]);}else if(this[_0x147e('0xc')][_0x26cfa4[_0x147e('0x31')]]){if(this[_0x147e('0xc')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]!==_0x26cfa4['state'][_0x147e('0x34')]()){this[_0x147e('0xc')][_0x26cfa4['device']]['stateTime']=_[_0x147e('0x37')](moment()['format']('x'));}this[_0x147e('0xc')][_0x26cfa4[_0x147e('0x31')]][_0x147e('0x22')]=_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]();logger[_0x147e('0x29')](_0x147e('0x3a'),util['inspect'](this[_0x147e('0xc')][_0x26cfa4[_0x147e('0x31')]],{'showHidden':![],'depth':null}));this[_0x147e('0x2b')](util[_0x147e('0x2c')](_0x147e('0x2d'),this['trunks'][_0x26cfa4[_0x147e('0x31')]]['name']),_0x147e('0x2f'),this[_0x147e('0xc')][_0x26cfa4[_0x147e('0x31')]]);}else if(_[_0x147e('0x3b')](_0x26cfa4['device'],_0x147e('0x3c'))){var _0x3b14b6=_0x26cfa4[_0x147e('0x31')];var _0x20f2a1=_0x3b14b6[_0x147e('0x3d')](_0x3b14b6['indexOf']('/')+0x1,_0x3b14b6['indexOf']('@'));var _0x446ee4=_['find'](this[_0x147e('0xd')],function(_0x558505){return _0x558505[_0x147e('0x3e')]==_0x20f2a1||_0x558505[_0x147e('0x3f')]==_0x20f2a1||_0x558505[_0x147e('0x40')]==_0x20f2a1;});if(_0x446ee4){if(_0x446ee4[_0x147e('0x22')]!==_0x26cfa4[_0x147e('0x22')][_0x147e('0x34')]()){_0x446ee4['stateTime']=_[_0x147e('0x37')](moment()[_0x147e('0x2c')]('x'));}_0x446ee4[_0x147e('0x22')]=_0x26cfa4['state'][_0x147e('0x34')]();_0x446ee4[_0x147e('0x33')]=!![];_0x446ee4[_0x147e('0x41')](_0x26cfa4);}}}}catch(_0x412bb0){logger['error']('[userReport][devicestatechange]',util[_0x147e('0x18')](_0x412bb0,{'showHidden':![],'depth':null}));}};UserReport[_0x147e('0x1d')]['syncPeerStatus']=function(_0x4e8860){try{if(this[_0x147e('0x1e')](_0x4e8860)&&this[_0x147e('0x1e')](_0x4e8860['peerstatus'])){logger[_0x147e('0x1f')](_0x147e('0x42'),_0x4e8860[_0x147e('0x43')],_0x4e8860[_0x147e('0x44')],_0x4e8860[_0x147e('0x14')]);logger[_0x147e('0x29')](_0x147e('0x45'),util[_0x147e('0x18')](_0x4e8860,{'showHidden':![],'depth':null}));if(this[_0x147e('0xd')][_0x4e8860[_0x147e('0x43')]]){if(!this['agents'][_0x4e8860[_0x147e('0x43')]]['local']||_0x4e8860[_0x147e('0x14')][_0x147e('0x34')]()=='registered'){this[_0x147e('0xd')][_0x4e8860[_0x147e('0x43')]][_0x147e('0x33')]=![];this['agents'][_0x4e8860['peer']][_0x147e('0x46')]=_0x4e8860[_0x147e('0x14')][_0x147e('0x34')]();this[_0x147e('0xd')][_0x4e8860[_0x147e('0x43')]][_0x147e('0x44')]=_0x4e8860['address'];this['agents'][_0x4e8860[_0x147e('0x43')]][_0x147e('0x41')](_0x4e8860);}}else if(this[_0x147e('0xe')][_0x4e8860[_0x147e('0x43')]]){this['telephones'][_0x4e8860['peer']]['status']=_0x4e8860['peerstatus'][_0x147e('0x34')]();this['telephones'][_0x4e8860[_0x147e('0x43')]]['address']=_0x4e8860[_0x147e('0x44')];logger[_0x147e('0x29')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x147e('0x18')](this[_0x147e('0xe')][_0x4e8860[_0x147e('0x43')]],{'showHidden':![],'depth':null}));this[_0x147e('0x2b')](util[_0x147e('0x2c')](_0x147e('0x47'),this['telephones'][_0x4e8860['peer']][_0x147e('0x2e')]),_0x147e('0x39'),this[_0x147e('0xe')][_0x4e8860[_0x147e('0x43')]]);}else if(this[_0x147e('0xc')][_0x4e8860[_0x147e('0x43')]]){this[_0x147e('0xc')][_0x4e8860[_0x147e('0x43')]][_0x147e('0x46')]=_0x4e8860[_0x147e('0x14')][_0x147e('0x34')]();this['trunks'][_0x4e8860[_0x147e('0x43')]][_0x147e('0x44')]=_0x4e8860[_0x147e('0x44')];logger[_0x147e('0x29')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x4e8860[_0x147e('0x43')]],{'showHidden':![],'depth':null}));this[_0x147e('0x2b')](util['format'](_0x147e('0x2d'),this[_0x147e('0xc')][_0x4e8860[_0x147e('0x43')]][_0x147e('0x2e')]),_0x147e('0x2f'),this[_0x147e('0xc')][_0x4e8860[_0x147e('0x43')]]);}}}catch(_0x19a1ea){logger[_0x147e('0x17')](_0x147e('0x45'),util['inspect'](_0x19a1ea,{'showHidden':![],'depth':null}));}};module[_0x147e('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0c28c80..81d2c8e 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 _0x2097=['voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound'];(function(_0x1a57d,_0x5e2fa1){var _0x22a26a=function(_0x43e79c){while(--_0x43e79c){_0x1a57d['push'](_0x1a57d['shift']());}};_0x22a26a(++_0x5e2fa1);}(_0x2097,0x1ab));var _0x7209=function(_0x525f70,_0x1b1e66){_0x525f70=_0x525f70-0x0;var _0x5ddc25=_0x2097[_0x525f70];return _0x5ddc25;};'use strict';var _=require(_0x7209('0x0'));var moment=require('moment');var util=require(_0x7209('0x1'));var Redis=require('ioredis');var config=require(_0x7209('0x2'));var logger=require(_0x7209('0x3'))(_0x7209('0x4'));var ami=require(_0x7209('0x5'));config['redis']=_[_0x7209('0x6')](config['redis'],{'host':_0x7209('0x7'),'port':0x18eb});var io=require(_0x7209('0x8'))(new Redis(config[_0x7209('0x9')]));function VoiceAgentReport(_0x186f13){this[_0x7209('0xa')]={};this['voiceChannels']=_0x186f13[_0x7209('0xa')];this[_0x7209('0xb')]=_0x186f13[_0x7209('0xb')];this[_0x7209('0xc')]=_0x186f13[_0x7209('0xc')];this[_0x7209('0xd')]={};ami['on'](_0x7209('0xe'),this[_0x7209('0xf')][_0x7209('0x10')](this));ami['on']('agentconnect',this[_0x7209('0x11')]['bind'](this));ami['on'](_0x7209('0x12'),this[_0x7209('0x13')][_0x7209('0x10')](this));ami['on']('queuecallerabandon',this[_0x7209('0x14')][_0x7209('0x10')](this));ami['on'](_0x7209('0x15'),this[_0x7209('0x16')][_0x7209('0x10')](this));ami['on']('varset',this[_0x7209('0x17')]['bind'](this));ami['on'](_0x7209('0x18'),this['syncHangup'][_0x7209('0x10')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x7209('0x10')](this));ami['on']('musiconholdstop',this[_0x7209('0x19')][_0x7209('0x10')](this));ami['on'](_0x7209('0x1a'),this[_0x7209('0x1b')]['bind'](this));ami['on'](_0x7209('0x1c'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x1e')]=function(_0x17c268,_0x1254f2,_0x4143ec){io['to'](_0x17c268)[_0x7209('0x1e')](_0x1254f2,_0x4143ec);};VoiceAgentReport['prototype'][_0x7209('0x1f')]=function(_0x3b720b){return _0x3b720b!==null&&!_[_0x7209('0x20')](_0x3b720b);};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0xf')]=function(_0x351724){try{if(this[_0x7209('0x1f')](_0x351724)){logger[_0x7209('0x21')](_0x7209('0x22'),_0x351724[_0x7209('0x23')],_0x351724['membername'],_0x351724[_0x7209('0x24')]);logger[_0x7209('0x25')](_0x7209('0x26'),_0x351724[_0x7209('0x23')],util[_0x7209('0x27')](_0x351724,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7209('0xa')][_0x351724['uniqueid']])){this['channels'][_0x351724[_0x7209('0x23')]]={};}if(_[_0x7209('0x20')](this[_0x7209('0xa')][_0x351724['uniqueid']][_0x351724[_0x7209('0x24')]])){this[_0x7209('0xa')][_0x351724[_0x7209('0x23')]][_0x351724['destuniqueid']]={'agentcalledAt':moment()[_0x7209('0x28')](_0x7209('0x29')),'lastevent':_0x7209('0x2a'),'mandatoryDisposition':this[_0x7209('0xb')][_0x351724[_0x7209('0x2b')]]?this['voiceQueues'][_0x351724[_0x7209('0x2b')]][_0x7209('0x2c')]||![]:![],'type':this[_0x7209('0xb')][_0x351724['queue']]?this[_0x7209('0xb')][_0x351724['queue']][_0x7209('0x2d')]||_0x7209('0x2e'):_0x7209('0x2e'),'variables':this[_0x7209('0xd')][_0x351724[_0x7209('0x23')]],'motionChannel':_0x7209('0x2f')};}_[_0x7209('0x30')](this[_0x7209('0xa')][_0x351724[_0x7209('0x23')]][_0x351724['destuniqueid']],_[_0x7209('0x31')](_0x351724,['event',_0x7209('0x32')]));logger[_0x7209('0x25')](_0x7209('0x33'),_0x351724[_0x7209('0x23')],util[_0x7209('0x27')](this[_0x7209('0xa')][_0x351724['uniqueid']][_0x351724[_0x7209('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7209('0x1e')](_0x7209('0x34'),this['channels'][_0x351724[_0x7209('0x23')]][_0x351724[_0x7209('0x24')]]);var _0x3ef88a={'id':this[_0x7209('0xc')][_0x351724[_0x7209('0x35')]]['id'],'calleridnum':this[_0x7209('0xa')][_0x351724[_0x7209('0x23')]][_0x351724[_0x7209('0x24')]][_0x7209('0x36')],'queue':this[_0x7209('0xa')][_0x351724[_0x7209('0x23')]][_0x351724[_0x7209('0x24')]][_0x7209('0x2b')],'variables':this['channels'][_0x351724['uniqueid']][_0x351724[_0x7209('0x24')]]['variables']};logger['debug'](_0x7209('0x37'),_0x351724['uniqueid'],util[_0x7209('0x27')](_0x3ef88a,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x7209('0x38'),_0x351724[_0x7209('0x39')]),_0x7209('0x3a'),_0x3ef88a);}}catch(_0x58da00){logger['error'](_0x7209('0x3b'),_0x351724[_0x7209('0x23')],util['inspect'](_0x58da00,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x11')]=function(_0x2a2baa){try{if(this[_0x7209('0x1f')](_0x2a2baa)){if(this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]]){logger['debug'](_0x7209('0x3c'),_0x2a2baa[_0x7209('0x23')],util[_0x7209('0x27')](_0x2a2baa,{'showHidden':![],'depth':null}));for(var _0xfd476d in this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]]){if(this['channels'][_0x2a2baa[_0x7209('0x23')]][_0x7209('0x3d')](_0xfd476d)){if(_0x2a2baa[_0x7209('0x24')]===_0xfd476d){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a2baa[_0x7209('0x23')],_0x2a2baa[_0x7209('0x39')],_0x2a2baa[_0x7209('0x24')]);this['channels'][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x3e')]=moment()[_0x7209('0x28')](_0x7209('0x29'));this[_0x7209('0xa')][_0x2a2baa['uniqueid']][_0xfd476d][_0x7209('0x3f')]=_0x2a2baa[_0x7209('0x3f')];this[_0x7209('0xa')][_0x2a2baa['uniqueid']][_0xfd476d][_0x7209('0x40')]=_0x2a2baa[_0x7209('0x40')];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x41')]=_0x2a2baa['destchannelstate'];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x42')]=_0x2a2baa[_0x7209('0x42')];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x43')]=_0x2a2baa[_0x7209('0x43')];this[_0x7209('0xa')][_0x2a2baa['uniqueid']][_0xfd476d][_0x7209('0x44')]=_0x7209('0x45');if(this['voiceChannels'][this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d]['uniqueid']]){var _0x3ab825=this[_0x7209('0x46')][this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d]['uniqueid']][_0x7209('0x47')];this['channels'][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x47')]=_0x3ab825;_0x2a2baa[_0x7209('0x47')]=_0x3ab825;}_[_0x7209('0x30')](this[_0x7209('0xc')][_0x2a2baa[_0x7209('0x35')]],_[_0x7209('0x48')](_0x2a2baa,[_0x7209('0x2b'),_0x7209('0x49'),_0x7209('0x47')]));logger[_0x7209('0x25')](_0x7209('0x4a'),_0x2a2baa[_0x7209('0x23')],util[_0x7209('0x27')](this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0x2a2baa[_0x7209('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7209('0x1e')](_0x7209('0x4b'),this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0x2a2baa[_0x7209('0x24')]]);logger[_0x7209('0x25')](_0x7209('0x4c'),_0x2a2baa[_0x7209('0x23')],util['inspect'](this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0x2a2baa[_0x7209('0x24')]],{'showHidden':![],'depth':null}));this[_0x7209('0x1e')](util[_0x7209('0x28')](_0x7209('0x38'),_0x2a2baa[_0x7209('0x39')]),_0x7209('0x4d'),this['channels'][_0x2a2baa['uniqueid']][_0x2a2baa[_0x7209('0x24')]]);}else if(!this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x12')]&&!this['channels'][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x15')]){logger[_0x7209('0x21')](_0x7209('0x4e'),_0x2a2baa[_0x7209('0x23')],this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x39')],_0xfd476d);this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x12')]=!![];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x4f')]=moment()['format'](_0x7209('0x29'));this[_0x7209('0xa')][_0x2a2baa['uniqueid']][_0xfd476d]['answeredelsewheredestinationuniqueid']=_0x2a2baa[_0x7209('0x24')];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x50')]=_0x2a2baa[_0x7209('0x39')];this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d][_0x7209('0x44')]=_0x7209('0x51');this[_0x7209('0xa')][_0x2a2baa[_0x7209('0x23')]][_0xfd476d]['reason']=_0x7209('0x51');logger[_0x7209('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2a2baa['uniqueid'],util[_0x7209('0x27')](this['channels'][_0x2a2baa['uniqueid']][_0xfd476d],{'showHidden':![],'depth':null}));ami['emit'](_0x7209('0x52'),this[_0x7209('0xa')][_0x2a2baa['uniqueid']][_0xfd476d]);}}}}}}catch(_0x48c380){logger[_0x7209('0x53')](_0x7209('0x54'),_0x2a2baa['uniqueid'],util[_0x7209('0x27')](_0x48c380,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x13')]=function(_0x1643a7){try{if(this['isNotNull'](_0x1643a7)){logger['debug'](_0x7209('0x55'),_0x1643a7['uniqueid'],util[_0x7209('0x27')](_0x1643a7,{'showHidden':![],'depth':null}));if(this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]]&&this['channels'][_0x1643a7[_0x7209('0x23')]][_0x1643a7[_0x7209('0x24')]]){logger[_0x7209('0x21')](_0x7209('0x56'),_0x1643a7[_0x7209('0x23')],_0x1643a7[_0x7209('0x39')],_0x1643a7[_0x7209('0x24')]);this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]][_0x1643a7['destuniqueid']][_0x7209('0x12')]=!![];this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]][_0x1643a7[_0x7209('0x24')]][_0x7209('0x4f')]=moment()['format'](_0x7209('0x29'));this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]][_0x1643a7[_0x7209('0x24')]][_0x7209('0x44')]='rejected';this['channels'][_0x1643a7[_0x7209('0x23')]][_0x1643a7[_0x7209('0x24')]][_0x7209('0x57')]=_0x7209('0x58');logger[_0x7209('0x25')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x1643a7['uniqueid'],util['inspect'](this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]][_0x1643a7[_0x7209('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7209('0x1e')]('custom:agentringnoanswer',this[_0x7209('0xa')][_0x1643a7[_0x7209('0x23')]][_0x1643a7['destuniqueid']]);}}}catch(_0x57fd7f){logger[_0x7209('0x53')](_0x7209('0x59'),_0x1643a7['uniqueid'],util[_0x7209('0x27')](_0x57fd7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x14')]=function(_0xf4e7d3){try{if(this[_0x7209('0x1f')](_0xf4e7d3)){logger['debug'](_0x7209('0x5a'),_0xf4e7d3[_0x7209('0x23')],util[_0x7209('0x27')](_0xf4e7d3,{'showHidden':![],'depth':null}));if(this[_0x7209('0xa')][_0xf4e7d3['uniqueid']]){for(var _0x28de7b in this['channels'][_0xf4e7d3[_0x7209('0x23')]]){if(this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x7209('0x3d')](_0x28de7b)&&!this['channels'][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b][_0x7209('0x12')]&&!this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b][_0x7209('0x15')]){logger[_0x7209('0x21')](_0x7209('0x5b'),_0xf4e7d3['uniqueid'],this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b]['membername'],_0x28de7b);this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b]['agentringnoanswer']=!![];this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b][_0x7209('0x4f')]=moment()['format'](_0x7209('0x29'));this[_0x7209('0xa')][_0xf4e7d3['uniqueid']][_0x28de7b]['lastevent']='abandoned';this[_0x7209('0xa')][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b][_0x7209('0x57')]='abandoned';logger[_0x7209('0x25')](_0x7209('0x5c'),_0xf4e7d3[_0x7209('0x23')],util[_0x7209('0x27')](this['channels'][_0xf4e7d3[_0x7209('0x23')]][_0x28de7b],{'showHidden':![],'depth':null}));ami[_0x7209('0x1e')](_0x7209('0x5d'),this[_0x7209('0xa')][_0xf4e7d3['uniqueid']][_0x28de7b]);}}}}}catch(_0x5cb8a9){logger[_0x7209('0x53')](_0x7209('0x5e'),_0xf4e7d3[_0x7209('0x23')],util[_0x7209('0x27')](_0x5cb8a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x57b3d3){try{if(this[_0x7209('0x1f')](_0x57b3d3)){logger[_0x7209('0x25')](_0x7209('0x5f'),_0x57b3d3[_0x7209('0x23')],util[_0x7209('0x27')](_0x57b3d3,{'showHidden':![],'depth':null}));if(this[_0x7209('0xa')][_0x57b3d3['uniqueid']]){for(var _0x48a3c0 in this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]]){if(this['channels'][_0x57b3d3[_0x7209('0x23')]][_0x7209('0x3d')](_0x48a3c0)){if(this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0][_0x7209('0x3e')]&&!this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0]['agentcomplete']){logger[_0x7209('0x21')](_0x7209('0x60'),_0x57b3d3[_0x7209('0x23')],this['channels'][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0][_0x7209('0x39')],_0x48a3c0);this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0][_0x7209('0x15')]=!![];this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0][_0x7209('0x61')]=moment()[_0x7209('0x28')](_0x7209('0x29'));this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0][_0x7209('0x44')]='complete';this[_0x7209('0xa')][_0x57b3d3['uniqueid']][_0x48a3c0][_0x7209('0x57')]=_0x57b3d3[_0x7209('0x57')]==_0x7209('0x62')?_0x7209('0x63'):_0x57b3d3[_0x7209('0x57')];this[_0x7209('0xa')][_0x57b3d3['uniqueid']][_0x48a3c0][_0x7209('0x64')]=_0x57b3d3[_0x7209('0x64')];if(this[_0x7209('0xb')][_0x57b3d3[_0x7209('0x2b')]]&&this[_0x7209('0xb')][_0x57b3d3[_0x7209('0x2b')]][_0x7209('0x65')]){this[_0x7209('0xa')][_0x57b3d3['uniqueid']][_0x48a3c0][_0x7209('0x66')]=this['voiceQueues'][_0x57b3d3[_0x7209('0x2b')]]['acwTimeout'];this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0]['agentacw']=!![];}this['agents'][_0x57b3d3[_0x7209('0x35')]]=_[_0x7209('0x31')](this[_0x7209('0xc')][_0x57b3d3[_0x7209('0x35')]],[_0x7209('0x2b'),'destconnectedlinenum']);logger[_0x7209('0x25')](_0x7209('0x67'),_0x57b3d3[_0x7209('0x23')],util[_0x7209('0x27')](this['channels'][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0],{'showHidden':![],'depth':null}));ami['emit'](_0x7209('0x68'),this[_0x7209('0xa')][_0x57b3d3[_0x7209('0x23')]][_0x48a3c0]);logger[_0x7209('0x25')](_0x7209('0x69'),_0x57b3d3[_0x7209('0x23')],util[_0x7209('0x27')]({'id':this[_0x7209('0xc')][_0x57b3d3['interface']]['id'],'destaccountcode':_0x57b3d3[_0x7209('0x6a')]},{'showHidden':![],'depth':null}));this[_0x7209('0x1e')](util[_0x7209('0x28')](_0x7209('0x38'),_0x57b3d3['membername']),'user:agentcomplete',{'id':this[_0x7209('0xc')][_0x57b3d3['interface']]['id'],'destaccountcode':_0x57b3d3[_0x7209('0x6a')]});}}}}}}catch(_0x1d9957){logger[_0x7209('0x53')]('[%s][voiceAgentReport][agentcomplete]',_0x57b3d3['uniqueid'],util[_0x7209('0x27')](_0x1d9957,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')]['syncVarSet']=function(_0x3ddc5e){try{if(this['isNotNull'](_0x3ddc5e)){logger[_0x7209('0x25')](_0x7209('0x6b'),_0x3ddc5e['uniqueid'],util[_0x7209('0x27')](_0x3ddc5e,{'showHidden':![],'depth':null}));this[_0x7209('0x6c')](_0x3ddc5e[_0x7209('0x23')],_[_0x7209('0x6d')](_0x3ddc5e[_0x7209('0x6e')])[0x0],_0x3ddc5e['value']);if(this[_0x7209('0xa')][_0x3ddc5e[_0x7209('0x23')]]){for(var _0x29386a in this[_0x7209('0xa')][_0x3ddc5e[_0x7209('0x23')]]){if(this[_0x7209('0xa')][_0x3ddc5e[_0x7209('0x23')]][_0x7209('0x3d')](_0x29386a)){logger[_0x7209('0x21')](_0x7209('0x6f'),_0x3ddc5e[_0x7209('0x23')],_0x29386a,_[_0x7209('0x6d')](_0x3ddc5e['variable'])[0x0],_0x3ddc5e[_0x7209('0x70')]);if(_[_0x7209('0x20')](this['channels'][_0x3ddc5e['uniqueid']][_0x29386a]['variables'])){this['channels'][_0x3ddc5e[_0x7209('0x23')]][_0x29386a][_0x7209('0xd')]={};}this[_0x7209('0xa')][_0x3ddc5e[_0x7209('0x23')]][_0x29386a][_0x7209('0xd')]=this[_0x7209('0xd')][_0x3ddc5e[_0x7209('0x23')]];}}}}}catch(_0x43b41d){logger[_0x7209('0x53')](_0x7209('0x71'),_0x3ddc5e[_0x7209('0x23')],util[_0x7209('0x27')](_0x43b41d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x6c')]=function(_0x32109b,_0x2a82a8,_0x1a3814){var _0xd0055d=[_0x7209('0x72'),_0x7209('0x73'),_0x7209('0x74'),_0x7209('0x75'),_0x7209('0x76'),'rtpaudioqoslossbridged',_0x7209('0x77'),_0x7209('0x78'),_0x7209('0x79'),_0x7209('0x7a'),_0x7209('0x7b'),_0x7209('0x7c'),'membercalls',_0x7209('0x7d'),_0x7209('0x7e'),'memberlastcall',_0x7209('0x39'),_0x7209('0x7f'),_0x7209('0x80')];if(!_[_0x7209('0x81')](_0x2a82a8)&&!_['includes'](_0xd0055d,_0x2a82a8)){if(_[_0x7209('0x20')](this[_0x7209('0xd')][_0x32109b])){this[_0x7209('0xd')][_0x32109b]={};}this[_0x7209('0xd')][_0x32109b][_0x2a82a8]=_0x1a3814;}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x82')]=function(_0x43947a){try{if(this[_0x7209('0x1f')](_0x43947a)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x43947a[_0x7209('0x23')],util[_0x7209('0x27')](_0x43947a,{'showHidden':![],'depth':null}));if(this['channels'][_0x43947a['uniqueid']]){for(var _0x591727 in this[_0x7209('0xa')][_0x43947a[_0x7209('0x23')]]){if(this[_0x7209('0xa')][_0x43947a['uniqueid']][_0x7209('0x3d')](_0x591727)){if(this[_0x7209('0xa')][_0x43947a[_0x7209('0x23')]][_0x591727]['reason']==_0x7209('0x62')&&this[_0x7209('0xa')][_0x43947a['uniqueid']][_0x591727]['agentcomplete']){logger[_0x7209('0x21')](_0x7209('0x83'),_0x43947a[_0x7209('0x23')],_0x591727);this[_0x7209('0xa')][_0x43947a['uniqueid']][_0x591727]['agentcompleteAt']=moment()[_0x7209('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x7209('0x25')](_0x7209('0x84'),_0x43947a['uniqueid'],util['inspect'](_['values'](this[_0x7209('0xa')][_0x43947a[_0x7209('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x7209('0x1e')](_0x7209('0x85'),_['values'](this['channels'][_0x43947a['uniqueid']]));delete this[_0x7209('0xa')][_0x43947a[_0x7209('0x23')]];}if(this[_0x7209('0xd')][_0x43947a['uniqueid']]){delete this[_0x7209('0xd')][_0x43947a[_0x7209('0x23')]];}}}catch(_0x5c6d7e){logger[_0x7209('0x53')](_0x7209('0x86'),_0x43947a[_0x7209('0x23')],util[_0x7209('0x27')](_0x5c6d7e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x1b')]=function(_0x57d594){try{if(this[_0x7209('0x1f')](_0x57d594)){logger[_0x7209('0x25')](_0x7209('0x87'),_0x57d594[_0x7209('0x23')],util['inspect'](_0x57d594,{'showHidden':![],'depth':null}));if(this[_0x7209('0xa')][_0x57d594['transfereeuniqueid']]){for(var _0x5d1b9f in this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]]){if(this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]][_0x7209('0x3d')](_0x5d1b9f)){if(_0x57d594[_0x7209('0x89')]===_0x5d1b9f){logger[_0x7209('0x21')](_0x7209('0x8a'),_0x57d594[_0x7209('0x23')],this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]][_0x5d1b9f][_0x7209('0x39')],_0x5d1b9f);var _0xf80547=moment();this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]][_0x5d1b9f][_0x7209('0x15')]=!![];this[_0x7209('0xa')][_0x57d594['transfereeuniqueid']][_0x5d1b9f][_0x7209('0x61')]=moment()[_0x7209('0x28')](_0x7209('0x29'));this['channels'][_0x57d594[_0x7209('0x88')]][_0x5d1b9f]['lastevent']=_0x7209('0x8b');this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]][_0x5d1b9f][_0x7209('0x57')]=_0x7209('0x62');this[_0x7209('0xa')][_0x57d594['transfereeuniqueid']][_0x5d1b9f][_0x7209('0x64')]=_0xf80547[_0x7209('0x8c')](this[_0x7209('0xa')][_0x57d594[_0x7209('0x88')]][_0x5d1b9f][_0x7209('0x3e')],_0x7209('0x8d'));}}}}if(this['channels'][_0x57d594[_0x7209('0x8e')]]){var _0x2ca8ea=this[_0x7209('0xa')][_0x57d594[_0x7209('0x8e')]];this['channels'][_0x57d594[_0x7209('0x8e')]]=this[_0x7209('0xa')][_0x57d594['transfereeuniqueid']];this['channels'][_0x57d594[_0x7209('0x88')]]=_0x2ca8ea;}}}catch(_0xcf2c2f){logger[_0x7209('0x53')](_0x7209('0x8f'),_0x57d594[_0x7209('0x23')],util[_0x7209('0x27')](_0xcf2c2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7209('0x1d')][_0x7209('0x90')]=function(_0x2bd4d5){try{if(this[_0x7209('0x1f')](_0x2bd4d5)){logger[_0x7209('0x25')](_0x7209('0x91'),_0x2bd4d5[_0x7209('0x23')],util[_0x7209('0x27')](_0x2bd4d5,{'showHidden':![],'depth':null}));if(this[_0x7209('0xa')][_0x2bd4d5[_0x7209('0x88')]]){for(var _0xc9dc63 in this['channels'][_0x2bd4d5[_0x7209('0x88')]]){if(this[_0x7209('0xa')][_0x2bd4d5[_0x7209('0x88')]][_0x7209('0x3d')](_0xc9dc63)){if(_0x2bd4d5['transfereruniqueid']===_0xc9dc63){logger[_0x7209('0x21')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2bd4d5[_0x7209('0x23')],this[_0x7209('0xa')][_0x2bd4d5['transfereeuniqueid']][_0xc9dc63][_0x7209('0x39')],_0xc9dc63);var _0x5c002c=moment();this[_0x7209('0xa')][_0x2bd4d5[_0x7209('0x88')]][_0xc9dc63][_0x7209('0x15')]=!![];this[_0x7209('0xa')][_0x2bd4d5['transfereeuniqueid']][_0xc9dc63][_0x7209('0x61')]=_0x5c002c;this['channels'][_0x2bd4d5[_0x7209('0x88')]][_0xc9dc63][_0x7209('0x44')]=_0x7209('0x8b');this[_0x7209('0xa')][_0x2bd4d5[_0x7209('0x88')]][_0xc9dc63][_0x7209('0x57')]='transfer';this['channels'][_0x2bd4d5[_0x7209('0x88')]][_0xc9dc63]['talktime']=_0x5c002c['diff'](this[_0x7209('0xa')][_0x2bd4d5['transfereeuniqueid']][_0xc9dc63][_0x7209('0x3e')],_0x7209('0x8d'));}}}}}}catch(_0x41d4b2){logger[_0x7209('0x53')](_0x7209('0x92'),_0x2bd4d5[_0x7209('0x23')],util[_0x7209('0x27')](_0x41d4b2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7209('0x93')]=function(_0x94682a){var _0xb6882e='';try{if(this[_0x7209('0x1f')](_0x94682a)){logger[_0x7209('0x25')](_0x7209('0x94'),_0x94682a[_0x7209('0x23')],util['inspect'](_0x94682a,{'showHidden':![],'depth':null}));if(_0x94682a[_0x7209('0x95')]){_0xb6882e=_0x94682a[_0x7209('0x95')][_0x7209('0x96')](0x0,_0x94682a[_0x7209('0x95')][_0x7209('0x97')]('-'));if(this[_0x7209('0xc')][_0xb6882e]){logger[_0x7209('0x21')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x94682a[_0x7209('0x23')],_0xb6882e);this[_0x7209('0xc')][_0xb6882e][_0x7209('0x98')]=!![];}}}}catch(_0x1b5ea6){logger[_0x7209('0x53')](_0x7209('0x99'),_0x94682a[_0x7209('0x23')],util[_0x7209('0x27')](_0x1b5ea6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7209('0x19')]=function(_0x5d7a15){var _0x2ef7c5='';try{if(this[_0x7209('0x1f')](_0x5d7a15)){logger[_0x7209('0x25')](_0x7209('0x9a'),_0x5d7a15['uniqueid'],util['inspect'](_0x5d7a15,{'showHidden':![],'depth':null}));if(_0x5d7a15['channel']){_0x2ef7c5=_0x5d7a15[_0x7209('0x95')][_0x7209('0x96')](0x0,_0x5d7a15[_0x7209('0x95')][_0x7209('0x97')]('-'));if(this['agents'][_0x2ef7c5]){logger[_0x7209('0x21')](_0x7209('0x9b'),_0x5d7a15[_0x7209('0x23')],_0x2ef7c5);this['agents'][_0x2ef7c5][_0x7209('0x98')]=![];}}}}catch(_0x287a15){logger['error'](_0x7209('0x9c'),_0x5d7a15[_0x7209('0x23')],util[_0x7209('0x27')](_0x287a15,{'showHidden':![],'depth':null}));}};module[_0x7209('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0x7208=['value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','called','queue','inbound','voice','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','interface','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','pick','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwtime','acwTimeout','agentacw','destconnectedlinenum','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','keys','variable'];(function(_0x15bcc0,_0x3462f7){var _0x3c6a6b=function(_0x5fa956){while(--_0x5fa956){_0x15bcc0['push'](_0x15bcc0['shift']());}};_0x3c6a6b(++_0x3462f7);}(_0x7208,0xbd));var _0x8720=function(_0x54d01f,_0x1b15fd){_0x54d01f=_0x54d01f-0x0;var _0x1e2a3c=_0x7208[_0x54d01f];return _0x1e2a3c;};'use strict';var _=require(_0x8720('0x0'));var moment=require('moment');var util=require(_0x8720('0x1'));var Redis=require(_0x8720('0x2'));var config=require(_0x8720('0x3'));var logger=require(_0x8720('0x4'))(_0x8720('0x5'));var ami=require('../ami');config[_0x8720('0x6')]=_[_0x8720('0x7')](config[_0x8720('0x6')],{'host':_0x8720('0x8'),'port':0x18eb});var io=require(_0x8720('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2e42ba){this[_0x8720('0xa')]={};this[_0x8720('0xb')]=_0x2e42ba[_0x8720('0xa')];this[_0x8720('0xc')]=_0x2e42ba['voiceQueues'];this[_0x8720('0xd')]=_0x2e42ba['agents'];this[_0x8720('0xe')]={};ami['on'](_0x8720('0xf'),this[_0x8720('0x10')][_0x8720('0x11')](this));ami['on']('agentconnect',this[_0x8720('0x12')]['bind'](this));ami['on'](_0x8720('0x13'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x8720('0x14'),this[_0x8720('0x15')][_0x8720('0x11')](this));ami['on'](_0x8720('0x16'),this[_0x8720('0x17')][_0x8720('0x11')](this));ami['on'](_0x8720('0x18'),this['syncVarSet']['bind'](this));ami['on'](_0x8720('0x19'),this[_0x8720('0x1a')]['bind'](this));ami['on'](_0x8720('0x1b'),this['syncMusicOnHoldStart'][_0x8720('0x11')](this));ami['on'](_0x8720('0x1c'),this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this[_0x8720('0x1d')][_0x8720('0x11')](this));ami['on'](_0x8720('0x1e'),this[_0x8720('0x1f')][_0x8720('0x11')](this));}VoiceAgentReport['prototype'][_0x8720('0x20')]=function(_0x450437,_0x110088,_0x5adb42){io['to'](_0x450437)[_0x8720('0x20')](_0x110088,_0x5adb42);};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x22')]=function(_0x27a16e){return _0x27a16e!==null&&!_[_0x8720('0x23')](_0x27a16e);};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x10')]=function(_0x3921a8){try{if(this[_0x8720('0x22')](_0x3921a8)){logger[_0x8720('0x24')](_0x8720('0x25'),_0x3921a8[_0x8720('0x26')],_0x3921a8[_0x8720('0x27')],_0x3921a8[_0x8720('0x28')]);logger[_0x8720('0x29')](_0x8720('0x2a'),_0x3921a8[_0x8720('0x26')],util[_0x8720('0x2b')](_0x3921a8,{'showHidden':![],'depth':null}));if(_[_0x8720('0x23')](this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]])){this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]]={};}if(_['isUndefined'](this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]])){this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8['destuniqueid']]={'agentcalledAt':moment()[_0x8720('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x8720('0x2d'),'mandatoryDisposition':this['voiceQueues'][_0x3921a8[_0x8720('0x2e')]]?this[_0x8720('0xc')][_0x3921a8[_0x8720('0x2e')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x3921a8[_0x8720('0x2e')]]?this['voiceQueues'][_0x3921a8[_0x8720('0x2e')]]['type']||_0x8720('0x2f'):_0x8720('0x2f'),'variables':this[_0x8720('0xe')][_0x3921a8[_0x8720('0x26')]],'motionChannel':_0x8720('0x30')};}_[_0x8720('0x31')](this['channels'][_0x3921a8[_0x8720('0x26')]][_0x3921a8['destuniqueid']],_[_0x8720('0x32')](_0x3921a8,[_0x8720('0x33'),'privilege']));logger[_0x8720('0x29')](_0x8720('0x34'),_0x3921a8['uniqueid'],util[_0x8720('0x2b')](this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]]);var _0x3ecd42={'id':this[_0x8720('0xd')][_0x3921a8[_0x8720('0x35')]]['id'],'calleridnum':this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]]['calleridnum'],'queue':this[_0x8720('0xa')][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]]['queue'],'variables':this['channels'][_0x3921a8[_0x8720('0x26')]][_0x3921a8[_0x8720('0x28')]][_0x8720('0xe')]};logger[_0x8720('0x29')](_0x8720('0x36'),_0x3921a8['uniqueid'],util['inspect'](_0x3ecd42,{'showHidden':![],'depth':null}));this[_0x8720('0x20')](util[_0x8720('0x2c')]('user:%s',_0x3921a8[_0x8720('0x27')]),_0x8720('0x37'),_0x3ecd42);}}catch(_0x2f16e4){logger[_0x8720('0x38')]('[%s][voiceAgentReport][agentcalled]',_0x3921a8[_0x8720('0x26')],util[_0x8720('0x2b')](_0x2f16e4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x12')]=function(_0x1443b7){try{if(this['isNotNull'](_0x1443b7)){if(this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]]){logger[_0x8720('0x29')](_0x8720('0x39'),_0x1443b7['uniqueid'],util[_0x8720('0x2b')](_0x1443b7,{'showHidden':![],'depth':null}));for(var _0x372aa5 in this[_0x8720('0xa')][_0x1443b7['uniqueid']]){if(this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x8720('0x3a')](_0x372aa5)){if(_0x1443b7[_0x8720('0x28')]===_0x372aa5){logger[_0x8720('0x24')](_0x8720('0x3b'),_0x1443b7[_0x8720('0x26')],_0x1443b7[_0x8720('0x27')],_0x1443b7[_0x8720('0x28')]);this['channels'][_0x1443b7[_0x8720('0x26')]][_0x372aa5]['agentconnectAt']=moment()['format'](_0x8720('0x3c'));this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5]['connectedlinename']=_0x1443b7['connectedlinename'];this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x3d')]=_0x1443b7[_0x8720('0x3d')];this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x3e')]=_0x1443b7['destchannelstate'];this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x3f')]=_0x1443b7[_0x8720('0x3f')];this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5]['holdtime']=_0x1443b7[_0x8720('0x40')];this[_0x8720('0xa')][_0x1443b7['uniqueid']][_0x372aa5]['lastevent']=_0x8720('0x41');if(this[_0x8720('0xb')][this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x26')]]){var _0x34f7e1=this[_0x8720('0xb')][this['channels'][_0x1443b7['uniqueid']][_0x372aa5][_0x8720('0x26')]]['routealias'];this[_0x8720('0xa')][_0x1443b7['uniqueid']][_0x372aa5][_0x8720('0x42')]=_0x34f7e1;_0x1443b7['routealias']=_0x34f7e1;}_[_0x8720('0x31')](this[_0x8720('0xd')][_0x1443b7[_0x8720('0x35')]],_[_0x8720('0x43')](_0x1443b7,[_0x8720('0x2e'),'destconnectedlinenum',_0x8720('0x42')]));logger[_0x8720('0x29')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x1443b7['uniqueid'],util[_0x8720('0x2b')](this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x1443b7[_0x8720('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8720('0x44'),this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x1443b7['destuniqueid']]);logger['debug'](_0x8720('0x45'),_0x1443b7[_0x8720('0x26')],util['inspect'](this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x1443b7['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x8720('0x20')](util[_0x8720('0x2c')](_0x8720('0x46'),_0x1443b7[_0x8720('0x27')]),_0x8720('0x47'),this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x1443b7[_0x8720('0x28')]]);}else if(!this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5]['agentringnoanswer']&&!this['channels'][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x16')]){logger[_0x8720('0x24')](_0x8720('0x48'),_0x1443b7['uniqueid'],this[_0x8720('0xa')][_0x1443b7['uniqueid']][_0x372aa5][_0x8720('0x27')],_0x372aa5);this[_0x8720('0xa')][_0x1443b7['uniqueid']][_0x372aa5][_0x8720('0x13')]=!![];this['channels'][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x49')]=moment()[_0x8720('0x2c')](_0x8720('0x3c'));this['channels'][_0x1443b7['uniqueid']][_0x372aa5]['answeredelsewheredestinationuniqueid']=_0x1443b7[_0x8720('0x28')];this['channels'][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x4a')]=_0x1443b7['membername'];this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5][_0x8720('0x4b')]=_0x8720('0x4c');this[_0x8720('0xa')][_0x1443b7['uniqueid']][_0x372aa5][_0x8720('0x4d')]=_0x8720('0x4c');logger[_0x8720('0x29')](_0x8720('0x4e'),_0x1443b7[_0x8720('0x26')],util[_0x8720('0x2b')](this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5],{'showHidden':![],'depth':null}));ami[_0x8720('0x20')](_0x8720('0x4f'),this[_0x8720('0xa')][_0x1443b7[_0x8720('0x26')]][_0x372aa5]);}}}}}}catch(_0x3f1f9c){logger[_0x8720('0x38')](_0x8720('0x50'),_0x1443b7[_0x8720('0x26')],util[_0x8720('0x2b')](_0x3f1f9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8720('0x51')]=function(_0x20fc7c){try{if(this[_0x8720('0x22')](_0x20fc7c)){logger['debug'](_0x8720('0x52'),_0x20fc7c[_0x8720('0x26')],util[_0x8720('0x2b')](_0x20fc7c,{'showHidden':![],'depth':null}));if(this[_0x8720('0xa')][_0x20fc7c['uniqueid']]&&this[_0x8720('0xa')][_0x20fc7c['uniqueid']][_0x20fc7c[_0x8720('0x28')]]){logger[_0x8720('0x24')](_0x8720('0x53'),_0x20fc7c[_0x8720('0x26')],_0x20fc7c[_0x8720('0x27')],_0x20fc7c['destuniqueid']);this['channels'][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c['destuniqueid']]['agentringnoanswer']=!![];this[_0x8720('0xa')][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c[_0x8720('0x28')]][_0x8720('0x49')]=moment()['format'](_0x8720('0x3c'));this[_0x8720('0xa')][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c['destuniqueid']][_0x8720('0x4b')]=_0x8720('0x54');this['channels'][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c[_0x8720('0x28')]]['reason']=_0x8720('0x54');logger[_0x8720('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x20fc7c[_0x8720('0x26')],util['inspect'](this['channels'][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c[_0x8720('0x28')]],{'showHidden':![],'depth':null}));ami[_0x8720('0x20')](_0x8720('0x55'),this['channels'][_0x20fc7c[_0x8720('0x26')]][_0x20fc7c['destuniqueid']]);}}}catch(_0x36f28e){logger[_0x8720('0x38')]('[%s][voiceAgentReport][agentringnoanswer]',_0x20fc7c[_0x8720('0x26')],util[_0x8720('0x2b')](_0x36f28e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8720('0x15')]=function(_0x3ff404){try{if(this[_0x8720('0x22')](_0x3ff404)){logger['debug'](_0x8720('0x56'),_0x3ff404['uniqueid'],util['inspect'](_0x3ff404,{'showHidden':![],'depth':null}));if(this[_0x8720('0xa')][_0x3ff404[_0x8720('0x26')]]){for(var _0x1ec392 in this[_0x8720('0xa')][_0x3ff404['uniqueid']]){if(this['channels'][_0x3ff404[_0x8720('0x26')]][_0x8720('0x3a')](_0x1ec392)&&!this['channels'][_0x3ff404[_0x8720('0x26')]][_0x1ec392][_0x8720('0x13')]&&!this[_0x8720('0xa')][_0x3ff404[_0x8720('0x26')]][_0x1ec392][_0x8720('0x16')]){logger[_0x8720('0x24')](_0x8720('0x57'),_0x3ff404[_0x8720('0x26')],this[_0x8720('0xa')][_0x3ff404[_0x8720('0x26')]][_0x1ec392][_0x8720('0x27')],_0x1ec392);this[_0x8720('0xa')][_0x3ff404['uniqueid']][_0x1ec392][_0x8720('0x13')]=!![];this[_0x8720('0xa')][_0x3ff404[_0x8720('0x26')]][_0x1ec392][_0x8720('0x49')]=moment()['format'](_0x8720('0x3c'));this['channels'][_0x3ff404[_0x8720('0x26')]][_0x1ec392][_0x8720('0x4b')]=_0x8720('0x58');this['channels'][_0x3ff404[_0x8720('0x26')]][_0x1ec392]['reason']=_0x8720('0x58');logger[_0x8720('0x29')](_0x8720('0x59'),_0x3ff404['uniqueid'],util[_0x8720('0x2b')](this[_0x8720('0xa')][_0x3ff404['uniqueid']][_0x1ec392],{'showHidden':![],'depth':null}));ami[_0x8720('0x20')](_0x8720('0x5a'),this['channels'][_0x3ff404['uniqueid']][_0x1ec392]);}}}}}catch(_0x10101e){logger[_0x8720('0x38')]('[%s][voiceAgentReport][queuecallerabandon]',_0x3ff404[_0x8720('0x26')],util[_0x8720('0x2b')](_0x10101e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x17')]=function(_0x27f793){try{if(this[_0x8720('0x22')](_0x27f793)){logger[_0x8720('0x29')](_0x8720('0x5b'),_0x27f793['uniqueid'],util[_0x8720('0x2b')](_0x27f793,{'showHidden':![],'depth':null}));if(this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]]){for(var _0x5784bd in this['channels'][_0x27f793[_0x8720('0x26')]]){if(this[_0x8720('0xa')][_0x27f793['uniqueid']][_0x8720('0x3a')](_0x5784bd)){if(this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x5c')]&&!this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd]['agentcomplete']){logger['info'](_0x8720('0x5d'),_0x27f793[_0x8720('0x26')],this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x27')],_0x5784bd);this[_0x8720('0xa')][_0x27f793['uniqueid']][_0x5784bd][_0x8720('0x16')]=!![];this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x5e')]=moment()[_0x8720('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x4b')]=_0x8720('0x5f');this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x4d')]=_0x27f793['reason']=='transfer'?_0x8720('0x60'):_0x27f793['reason'];this['channels'][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x61')]=_0x27f793['talktime'];if(this[_0x8720('0xc')][_0x27f793[_0x8720('0x2e')]]&&this[_0x8720('0xc')][_0x27f793[_0x8720('0x2e')]]['acw']){this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x62')]=this[_0x8720('0xc')][_0x27f793[_0x8720('0x2e')]][_0x8720('0x63')];this['channels'][_0x27f793[_0x8720('0x26')]][_0x5784bd][_0x8720('0x64')]=!![];}this[_0x8720('0xd')][_0x27f793[_0x8720('0x35')]]=_[_0x8720('0x32')](this[_0x8720('0xd')][_0x27f793[_0x8720('0x35')]],[_0x8720('0x2e'),_0x8720('0x65')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x27f793[_0x8720('0x26')],util[_0x8720('0x2b')](this[_0x8720('0xa')][_0x27f793['uniqueid']][_0x5784bd],{'showHidden':![],'depth':null}));ami[_0x8720('0x20')](_0x8720('0x66'),this[_0x8720('0xa')][_0x27f793[_0x8720('0x26')]][_0x5784bd]);logger[_0x8720('0x29')](_0x8720('0x67'),_0x27f793['uniqueid'],util[_0x8720('0x2b')]({'id':this[_0x8720('0xd')][_0x27f793[_0x8720('0x35')]]['id'],'destaccountcode':_0x27f793['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x8720('0x20')](util[_0x8720('0x2c')]('user:%s',_0x27f793[_0x8720('0x27')]),_0x8720('0x68'),{'id':this[_0x8720('0xd')][_0x27f793[_0x8720('0x35')]]['id'],'destaccountcode':_0x27f793[_0x8720('0x69')]});}}}}}}catch(_0x302e03){logger[_0x8720('0x38')](_0x8720('0x6a'),_0x27f793['uniqueid'],util[_0x8720('0x2b')](_0x302e03,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8720('0x6b')]=function(_0x50d5d8){try{if(this[_0x8720('0x22')](_0x50d5d8)){logger[_0x8720('0x29')]('[%s][voiceAgentReport][varset]\x20event:',_0x50d5d8[_0x8720('0x26')],util['inspect'](_0x50d5d8,{'showHidden':![],'depth':null}));this[_0x8720('0x6c')](_0x50d5d8['uniqueid'],_[_0x8720('0x6d')](_0x50d5d8[_0x8720('0x6e')])[0x0],_0x50d5d8[_0x8720('0x6f')]);if(this[_0x8720('0xa')][_0x50d5d8[_0x8720('0x26')]]){for(var _0x281aab in this[_0x8720('0xa')][_0x50d5d8[_0x8720('0x26')]]){if(this[_0x8720('0xa')][_0x50d5d8[_0x8720('0x26')]][_0x8720('0x3a')](_0x281aab)){logger[_0x8720('0x24')](_0x8720('0x70'),_0x50d5d8['uniqueid'],_0x281aab,_[_0x8720('0x6d')](_0x50d5d8['variable'])[0x0],_0x50d5d8['value']);if(_[_0x8720('0x23')](this[_0x8720('0xa')][_0x50d5d8[_0x8720('0x26')]][_0x281aab][_0x8720('0xe')])){this['channels'][_0x50d5d8[_0x8720('0x26')]][_0x281aab][_0x8720('0xe')]={};}this[_0x8720('0xa')][_0x50d5d8[_0x8720('0x26')]][_0x281aab][_0x8720('0xe')]=this[_0x8720('0xe')][_0x50d5d8[_0x8720('0x26')]];}}}}}catch(_0x3f9f4a){logger['error'](_0x8720('0x71'),_0x50d5d8['uniqueid'],util[_0x8720('0x2b')](_0x3f9f4a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x6c')]=function(_0x31aa3a,_0x4bf96d,_0x568807){var _0x113e7f=[_0x8720('0x72'),'rtpaudioqosbridged',_0x8720('0x73'),'rtpaudioqosjitterbridged',_0x8720('0x74'),_0x8720('0x75'),_0x8720('0x76'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0x8720('0x77'),'bridgepvtcallid','membercalls',_0x8720('0x78'),_0x8720('0x79'),_0x8720('0x7a'),_0x8720('0x27'),_0x8720('0x7b'),_0x8720('0x7c')];if(!_[_0x8720('0x7d')](_0x4bf96d)&&!_['includes'](_0x113e7f,_0x4bf96d)){if(_['isUndefined'](this[_0x8720('0xe')][_0x31aa3a])){this[_0x8720('0xe')][_0x31aa3a]={};}this['variables'][_0x31aa3a][_0x4bf96d]=_0x568807;}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x1a')]=function(_0x4b8bd6){try{if(this[_0x8720('0x22')](_0x4b8bd6)){logger[_0x8720('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x4b8bd6[_0x8720('0x26')],util['inspect'](_0x4b8bd6,{'showHidden':![],'depth':null}));if(this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]]){for(var _0x31ccf6 in this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]]){if(this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]][_0x8720('0x3a')](_0x31ccf6)){if(this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]][_0x31ccf6][_0x8720('0x4d')]==_0x8720('0x7e')&&this[_0x8720('0xa')][_0x4b8bd6['uniqueid']][_0x31ccf6][_0x8720('0x16')]){logger['info'](_0x8720('0x7f'),_0x4b8bd6['uniqueid'],_0x31ccf6);this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]][_0x31ccf6]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x8720('0x29')](_0x8720('0x80'),_0x4b8bd6[_0x8720('0x26')],util[_0x8720('0x2b')](_[_0x8720('0x81')](this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x8720('0x82'),_['values'](this[_0x8720('0xa')][_0x4b8bd6[_0x8720('0x26')]]));delete this[_0x8720('0xa')][_0x4b8bd6['uniqueid']];}if(this[_0x8720('0xe')][_0x4b8bd6[_0x8720('0x26')]]){delete this[_0x8720('0xe')][_0x4b8bd6[_0x8720('0x26')]];}}}catch(_0x34ab30){logger[_0x8720('0x38')]('[%s][voiceAgentReport][hangup]',_0x4b8bd6[_0x8720('0x26')],util[_0x8720('0x2b')](_0x34ab30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x1d')]=function(_0x816e1c){try{if(this[_0x8720('0x22')](_0x816e1c)){logger[_0x8720('0x29')](_0x8720('0x83'),_0x816e1c['uniqueid'],util[_0x8720('0x2b')](_0x816e1c,{'showHidden':![],'depth':null}));if(this['channels'][_0x816e1c['transfereeuniqueid']]){for(var _0x4bfa51 in this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]]){if(this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]][_0x8720('0x3a')](_0x4bfa51)){if(_0x816e1c[_0x8720('0x85')]===_0x4bfa51){logger[_0x8720('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x816e1c['uniqueid'],this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]][_0x4bfa51]['membername'],_0x4bfa51);var _0x554ebb=moment();this[_0x8720('0xa')][_0x816e1c['transfereeuniqueid']][_0x4bfa51][_0x8720('0x16')]=!![];this[_0x8720('0xa')][_0x816e1c['transfereeuniqueid']][_0x4bfa51][_0x8720('0x5e')]=moment()[_0x8720('0x2c')](_0x8720('0x3c'));this['channels'][_0x816e1c[_0x8720('0x84')]][_0x4bfa51][_0x8720('0x4b')]=_0x8720('0x5f');this['channels'][_0x816e1c[_0x8720('0x84')]][_0x4bfa51]['reason']='transfer';this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]][_0x4bfa51][_0x8720('0x61')]=_0x554ebb['diff'](this[_0x8720('0xa')][_0x816e1c['transfereeuniqueid']][_0x4bfa51][_0x8720('0x5c')],_0x8720('0x86'));}}}}if(this['channels'][_0x816e1c[_0x8720('0x87')]]){var _0x3495d9=this[_0x8720('0xa')][_0x816e1c[_0x8720('0x87')]];this['channels'][_0x816e1c[_0x8720('0x87')]]=this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]];this[_0x8720('0xa')][_0x816e1c[_0x8720('0x84')]]=_0x3495d9;}}}catch(_0x2c21ad){logger[_0x8720('0x38')]('[%s][voiceAgentReport][attendedtransfer]',_0x816e1c[_0x8720('0x26')],util[_0x8720('0x2b')](_0x2c21ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x1f')]=function(_0x2c635e){try{if(this[_0x8720('0x22')](_0x2c635e)){logger[_0x8720('0x29')](_0x8720('0x88'),_0x2c635e['uniqueid'],util[_0x8720('0x2b')](_0x2c635e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c635e[_0x8720('0x84')]]){for(var _0x17def8 in this[_0x8720('0xa')][_0x2c635e['transfereeuniqueid']]){if(this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x8720('0x3a')](_0x17def8)){if(_0x2c635e[_0x8720('0x89')]===_0x17def8){logger[_0x8720('0x24')](_0x8720('0x8a'),_0x2c635e['uniqueid'],this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x17def8][_0x8720('0x27')],_0x17def8);var _0x37a710=moment();this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x17def8][_0x8720('0x16')]=!![];this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x17def8][_0x8720('0x5e')]=_0x37a710;this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x17def8][_0x8720('0x4b')]=_0x8720('0x5f');this[_0x8720('0xa')][_0x2c635e[_0x8720('0x84')]][_0x17def8][_0x8720('0x4d')]=_0x8720('0x7e');this[_0x8720('0xa')][_0x2c635e['transfereeuniqueid']][_0x17def8][_0x8720('0x61')]=_0x37a710[_0x8720('0x8b')](this[_0x8720('0xa')][_0x2c635e['transfereeuniqueid']][_0x17def8][_0x8720('0x5c')],'seconds');}}}}}}catch(_0x4c06c3){logger[_0x8720('0x38')]('[%s][voiceAgentReport][blindtransfer]',_0x2c635e[_0x8720('0x26')],util[_0x8720('0x2b')](_0x4c06c3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8720('0x21')][_0x8720('0x8c')]=function(_0x18f8a4){var _0x5d174f='';try{if(this['isNotNull'](_0x18f8a4)){logger['debug'](_0x8720('0x8d'),_0x18f8a4['uniqueid'],util['inspect'](_0x18f8a4,{'showHidden':![],'depth':null}));if(_0x18f8a4[_0x8720('0x8e')]){_0x5d174f=_0x18f8a4['channel'][_0x8720('0x8f')](0x0,_0x18f8a4['channel'][_0x8720('0x90')]('-'));if(this[_0x8720('0xd')][_0x5d174f]){logger[_0x8720('0x24')](_0x8720('0x91'),_0x18f8a4[_0x8720('0x26')],_0x5d174f);this[_0x8720('0xd')][_0x5d174f][_0x8720('0x92')]=!![];}}}}catch(_0x3ab57d){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x18f8a4['uniqueid'],util[_0x8720('0x2b')](_0x3ab57d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8720('0x93')]=function(_0x24b3e8){var _0x43e05c='';try{if(this[_0x8720('0x22')](_0x24b3e8)){logger[_0x8720('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x24b3e8['uniqueid'],util['inspect'](_0x24b3e8,{'showHidden':![],'depth':null}));if(_0x24b3e8[_0x8720('0x8e')]){_0x43e05c=_0x24b3e8[_0x8720('0x8e')]['substring'](0x0,_0x24b3e8[_0x8720('0x8e')][_0x8720('0x90')]('-'));if(this[_0x8720('0xd')][_0x43e05c]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x24b3e8[_0x8720('0x26')],_0x43e05c);this['agents'][_0x43e05c]['onhold']=![];}}}}catch(_0x39d3e1){logger[_0x8720('0x38')](_0x8720('0x94'),_0x24b3e8[_0x8720('0x26')],util[_0x8720('0x2b')](_0x39d3e1,{'showHidden':![],'depth':null}));}};module[_0x8720('0x95')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index b603215..788d549 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 _0xf72b=['xcally-motion-preview','connectedlinename','UserId','membername','answered','holdtime','destinationchannel','routealias','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcallid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','newexten','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','appdata','applicationdata','startsWith','CDR(routeAlias)','duration','subtract','lastapplication','lastdata','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answertime','diff','starttime','seconds'];(function(_0x1d8619,_0x5e644b){var _0x29adc2=function(_0x49f5a2){while(--_0x49f5a2){_0x1d8619['push'](_0x1d8619['shift']());}};_0x29adc2(++_0x5e644b);}(_0xf72b,0x1d9));var _0xbf72=function(_0x1783f9,_0x4eeb45){_0x1783f9=_0x1783f9-0x0;var _0x3960e2=_0xf72b[_0x1783f9];return _0x3960e2;};'use strict';var _=require(_0xbf72('0x0'));var moment=require('moment');var util=require(_0xbf72('0x1'));var path=require('path');var Redis=require(_0xbf72('0x2'));var config=require(_0xbf72('0x3'));var logger=require('../../../config/logger')(_0xbf72('0x4'));var ami=require(_0xbf72('0x5'));var Channel=require(_0xbf72('0x6'));var RpcSetting=require(_0xbf72('0x7'));var applications=[_0xbf72('0x8'),_0xbf72('0x9'),'agi',_0xbf72('0xa'),_0xbf72('0xb'),_0xbf72('0xc')];var dispositions=[_0xbf72('0xd'),_0xbf72('0xe'),_0xbf72('0xe'),'NO\x20ANSWER',_0xbf72('0xd'),'NO\x20ANSWER',_0xbf72('0xf'),_0xbf72('0x10'),'FAILED',_0xbf72('0xe'),_0xbf72('0xe')];config[_0xbf72('0x11')]=_[_0xbf72('0x12')](config[_0xbf72('0x11')],{'host':_0xbf72('0x13'),'port':0x18eb});var io=require(_0xbf72('0x14'))(new Redis(config[_0xbf72('0x11')]));function VoiceCallReport(_0x5967f5){this[_0xbf72('0x15')]=_0x5967f5[_0xbf72('0x15')];this[_0xbf72('0x16')]=_0x5967f5['agents'];this[_0xbf72('0x17')]={};ami['on']('coreshowchannel',this['syncNewExten']['bind'](this));ami['on'](_0xbf72('0x18'),this[_0xbf72('0x19')][_0xbf72('0x1a')](this));ami['on'](_0xbf72('0x1b'),this[_0xbf72('0x1c')][_0xbf72('0x1a')](this));ami['on']('newstate',this[_0xbf72('0x1d')][_0xbf72('0x1a')](this));ami['on'](_0xbf72('0x1e'),this[_0xbf72('0x1f')][_0xbf72('0x1a')](this));ami['on']('hangup',this['syncHangup'][_0xbf72('0x1a')](this));ami['on'](_0xbf72('0x20'),this[_0xbf72('0x21')][_0xbf72('0x1a')](this));ami['on'](_0xbf72('0x22'),this[_0xbf72('0x23')][_0xbf72('0x1a')](this));ami['on']('blindtransfer',this[_0xbf72('0x24')][_0xbf72('0x1a')](this));ami['on'](_0xbf72('0x25'),this[_0xbf72('0x26')][_0xbf72('0x1a')](this));ami['on']('musiconholdstop',this[_0xbf72('0x27')][_0xbf72('0x1a')](this));try{logger['info'](_0xbf72('0x28'));ami[_0xbf72('0x29')]();}catch(_0x267c41){logger['error'](_0xbf72('0x2a'),util[_0xbf72('0x2b')](_0x267c41,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x2d')]=function(_0x4f4dc0){return _0x4f4dc0!==null&&!_[_0xbf72('0x2e')](_0x4f4dc0);};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x2f')]=function(_0x54fdfe,_0x3b3171,_0xd8fefc){io['to'](_0x54fdfe)[_0xbf72('0x2f')](_0x3b3171,_0xd8fefc);};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x21')]=function(_0x2b1ff1){try{if(this[_0xbf72('0x2d')](_0x2b1ff1)){logger[_0xbf72('0x30')](_0xbf72('0x31'),_0x2b1ff1[_0xbf72('0x32')],_0x2b1ff1[_0xbf72('0x33')],_0x2b1ff1[_0xbf72('0x34')]);logger[_0xbf72('0x35')](_0xbf72('0x36'),_0x2b1ff1[_0xbf72('0x32')],util['inspect'](_0x2b1ff1,{'showHidden':![],'depth':null}));if(_0x2b1ff1[_0xbf72('0x32')]===_0x2b1ff1[_0xbf72('0x37')]){if(!_[_0xbf72('0x2e')](this[_0xbf72('0x15')][_0x2b1ff1[_0xbf72('0x32')]])){_[_0xbf72('0x38')](this[_0xbf72('0x15')][_0x2b1ff1[_0xbf72('0x32')]],_[_0xbf72('0x39')](_0x2b1ff1,_[_0xbf72('0x3a')](this[_0xbf72('0x15')][_0x2b1ff1[_0xbf72('0x32')]])));}}if(_0x2b1ff1[_0xbf72('0x3b')]===_0xbf72('0x3c')){if(this['agents'][_0x2b1ff1[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]){if(_0x2b1ff1[_0xbf72('0x3f')]=='xcally-motion-preview'){this['agents'][_0x2b1ff1['channel'][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x40')]=_0x2b1ff1[_0xbf72('0x41')];this['emit'](util[_0xbf72('0x42')](_0xbf72('0x43'),this['agents'][_0x2b1ff1[_0xbf72('0x3d')]['split']('-')[0x0]][_0xbf72('0x44')]),_0xbf72('0x45'),{'destaccountcode':this['agents'][_0x2b1ff1['channel'][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x46')],'destconnectedlinenum':_0x2b1ff1[_0xbf72('0x41')]});}}}}}catch(_0x3f70a8){logger[_0xbf72('0x47')](_0xbf72('0x48'),_0x2b1ff1[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x3f70a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf72('0x2c')]['syncNewChannel']=function(_0x40a1b2){try{if(this[_0xbf72('0x2d')](_0x40a1b2)){logger[_0xbf72('0x35')](_0xbf72('0x49'),_0x40a1b2['uniqueid'],util[_0xbf72('0x2b')](_0x40a1b2,{'showHidden':![],'depth':null}));if(this[_0xbf72('0x15')][_0x40a1b2['uniqueid']])return;if(_0x40a1b2[_0xbf72('0x3d')]==='OutgoingSpoolFailed')return;if(_0x40a1b2['uniqueid']!==_0x40a1b2['linkedid']&&!this['blindTransfers'][_0x40a1b2[_0xbf72('0x37')]])return;logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x40a1b2[_0xbf72('0x32')],_0x40a1b2['context'],_0x40a1b2[_0xbf72('0x3f')]);this[_0xbf72('0x15')][_0x40a1b2['uniqueid']]=new Channel();this[_0xbf72('0x15')][_0x40a1b2['uniqueid']]['starttime']=moment()[_0xbf72('0x42')](_0xbf72('0x4a'));this[_0xbf72('0x15')][_0x40a1b2[_0xbf72('0x32')]][_0xbf72('0x4b')]=dispositions[_[_0xbf72('0x4c')](_0x40a1b2[_0xbf72('0x4d')])];_[_0xbf72('0x38')](this['channels'][_0x40a1b2[_0xbf72('0x32')]],_[_0xbf72('0x39')](_0x40a1b2,_['keys'](this[_0xbf72('0x15')][_0x40a1b2['uniqueid']])));if(_0x40a1b2['context']===_0xbf72('0x3c')){if(this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]){if(_[_0xbf72('0x2e')](this['agents'][_0x40a1b2['channel']['split']('-')[0x0]][_0xbf72('0x40')])){this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['destconnectedlinenum']=_0x40a1b2['exten'];logger[_0xbf72('0x35')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x40a1b2[_0xbf72('0x32')],util[_0xbf72('0x2b')]({'id':this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x46')],'destconnectedlinenum':_0x40a1b2['exten']},{'showHidden':![],'depth':null}));this[_0xbf72('0x2f')](util[_0xbf72('0x42')]('user:%s',this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x44')]),_0xbf72('0x45'),{'id':this[_0xbf72('0x16')][_0x40a1b2[_0xbf72('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x40a1b2['channel'][_0xbf72('0x3e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x40a1b2[_0xbf72('0x3f')]});}}}}}catch(_0x4f1c8a){logger['error']('[%s][voiceCallReport][newchannel]',_0x40a1b2[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x4f1c8a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x19')]=function(_0x3d36de){try{if(this[_0xbf72('0x2d')](_0x3d36de)){logger['debug'](_0xbf72('0x4e'),_0x3d36de['uniqueid'],util[_0xbf72('0x2b')](_0x3d36de,{'showHidden':![],'depth':null}));if(_0x3d36de['channel']===_0xbf72('0x4f')||_0x3d36de[_0xbf72('0x3f')]==='h')return;if(_0x3d36de[_0xbf72('0x32')]===_0x3d36de[_0xbf72('0x37')]||this[_0xbf72('0x17')][_0x3d36de[_0xbf72('0x37')]]){_0x3d36de[_0xbf72('0x50')]=_0x3d36de[_0xbf72('0x50')][_0xbf72('0x51')]();_0x3d36de['applicationdata']=_0x3d36de[_0xbf72('0x52')]||_0x3d36de[_0xbf72('0x53')];if(_0x3d36de[_0xbf72('0x52')]&&!_0x3d36de['appdata'][_0xbf72('0x54')](_0xbf72('0x55'))&&_0x3d36de[_0xbf72('0x50')]!==_0xbf72('0x9')){_0x3d36de[_0xbf72('0x53')]=_0x3d36de['applicationdata'][_0xbf72('0x51')]();}logger[_0xbf72('0x30')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x3d36de[_0xbf72('0x32')],_0x3d36de['application'],_0x3d36de['applicationdata']);if(_[_0xbf72('0x2e')](this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]])){this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]]=new Channel();this['channels'][_0x3d36de['uniqueid']]['starttime']=_0x3d36de[_0xbf72('0x56')]?moment()[_0xbf72('0x57')](moment[_0xbf72('0x56')](_0x3d36de[_0xbf72('0x56')])['seconds'](),'seconds')[_0xbf72('0x42')](_0xbf72('0x4a')):moment()[_0xbf72('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf72('0x15')][_0x3d36de['uniqueid']][_0xbf72('0x4b')]=_0xbf72('0xd');}_['merge'](this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]],_['pick'](_0x3d36de,_[_0xbf72('0x3a')](this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]])));if(_['includes'](applications,_0x3d36de['application'])){this['channels'][_0x3d36de[_0xbf72('0x32')]][_0xbf72('0x58')]=_0x3d36de[_0xbf72('0x50')];this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]][_0xbf72('0x59')]=_0x3d36de[_0xbf72('0x53')];if(_0x3d36de[_0xbf72('0x50')]===_0xbf72('0x8')&&_['startsWith'](_0x3d36de[_0xbf72('0x53')][_0xbf72('0x51')](),'cdr(')){var _0x2983ed=_0x3d36de[_0xbf72('0x53')][_0xbf72('0x3e')]('=');var _0x435453=_0x2983ed[0x0][_0xbf72('0x51')]()[_0xbf72('0x5a')](/cdr\((.*)\)/);if(_0x435453){if(_0x435453[0x1]===_0xbf72('0x5b')&&!_[_0xbf72('0x5c')](this[_0xbf72('0x15')][_0x3d36de['uniqueid']][_0x435453[0x1]]))return;this['channels'][_0x3d36de[_0xbf72('0x32')]][_0x435453[0x1]]=_0x2983ed[0x1];}}else if(_0x3d36de[_0xbf72('0x50')]===_0xbf72('0x9')){this[_0xbf72('0x15')][_0x3d36de[_0xbf72('0x32')]][_0xbf72('0x9')]=_0x3d36de[_0xbf72('0x53')][_0xbf72('0x3e')](',')[0x0];}}}}}catch(_0x49824f){logger[_0xbf72('0x47')](_0xbf72('0x5d'),_0x3d36de[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x49824f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x1d')]=function(_0x1ba67d){try{if(this['isNotNull'](_0x1ba67d)){logger[_0xbf72('0x30')](_0xbf72('0x5e'),_0x1ba67d[_0xbf72('0x32')],_0x1ba67d[_0xbf72('0x37')],_0x1ba67d[_0xbf72('0x33')],_0x1ba67d[_0xbf72('0x34')]);logger[_0xbf72('0x35')](_0xbf72('0x5f'),_0x1ba67d['uniqueid'],util[_0xbf72('0x2b')](_0x1ba67d,{'showHidden':![],'depth':null}));if(_0x1ba67d[_0xbf72('0x4d')]!=='6')return;if(_0x1ba67d[_0xbf72('0x32')]!==_0x1ba67d['linkedid']){var _0xcb2987=moment();if(this[_0xbf72('0x15')][_0x1ba67d['linkedid']]){if(!this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]['answered']){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]['answered']=!![];this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x60')]=_0xcb2987[_0xbf72('0x42')](_0xbf72('0x4a'));if(this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]['starttime']){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]['holdtime']=_0xcb2987[_0xbf72('0x61')](this['channels'][_0x1ba67d['linkedid']][_0xbf72('0x62')],_0xbf72('0x63'));}}this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x37')]=_0x1ba67d[_0xbf72('0x32')];if(_0x1ba67d['calleridnum']!==_0xbf72('0x64')){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x41')]=_0x1ba67d['calleridnum'];}this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x65')]=_0x1ba67d[_0xbf72('0x33')];this['channels'][_0x1ba67d[_0xbf72('0x37')]]['destinationchannel']=_0x1ba67d[_0xbf72('0x3d')];this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]['disposition']=dispositions[_[_0xbf72('0x4c')](_0x1ba67d[_0xbf72('0x4d')])];if(this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x66')]=this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['id'];this[_0xbf72('0x15')][_0x1ba67d['linkedid']][_0xbf72('0x67')]=this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')]['split']('-')[0x0]][_0xbf72('0x44')];}}if(this['channels'][_0x1ba67d[_0xbf72('0x32')]]){if(!this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x68')]){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]]['answered']=!![];this[_0xbf72('0x15')][_0x1ba67d['uniqueid']][_0xbf72('0x60')]=_0xcb2987['format'](_0xbf72('0x4a'));if(this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x62')]){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x69')]=_0xcb2987[_0xbf72('0x61')](this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x62')],_0xbf72('0x63'));}}if(_0x1ba67d[_0xbf72('0x34')]!==_0xbf72('0x64')){this[_0xbf72('0x15')][_0x1ba67d['uniqueid']]['connectedlinenum']=_0x1ba67d[_0xbf72('0x34')];}this['channels'][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x65')]=_0x1ba67d['calleridname'];this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x6a')]=_0x1ba67d['channel'];this[_0xbf72('0x15')][_0x1ba67d['uniqueid']][_0xbf72('0x4b')]=dispositions[_[_0xbf72('0x4c')](_0x1ba67d['channelstate'])];}}else{if(this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]]){if(this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]){this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]][_0xbf72('0x66')]=this['agents'][_0x1ba67d['channel'][_0xbf72('0x3e')]('-')[0x0]]['id'];this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]]['membername']=this[_0xbf72('0x16')][_0x1ba67d['channel'][_0xbf72('0x3e')]('-')[0x0]]['name'];}}}if(_0x1ba67d[_0xbf72('0x3b')]===_0xbf72('0x3c')){if(this[_0xbf72('0x16')][_0x1ba67d['channel'][_0xbf72('0x3e')]('-')[0x0]]){this[_0xbf72('0x16')][_0x1ba67d['channel'][_0xbf72('0x3e')]('-')[0x0]]['destconnectedlinenum']=_0x1ba67d[_0xbf72('0x3f')];var _0x24490f,_0x270882;if(this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]]){_0x24490f=this[_0xbf72('0x15')][_0x1ba67d['uniqueid']][_0xbf72('0x6b')];_0x270882=this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x32')]]['queue'];}else if(this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]]){_0x24490f=this['channels'][_0x1ba67d['linkedid']]['routealias'];_0x270882=this[_0xbf72('0x15')][_0x1ba67d[_0xbf72('0x37')]][_0xbf72('0x9')];}logger[_0xbf72('0x35')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1ba67d[_0xbf72('0x32')],util['inspect']({'id':this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x1ba67d[_0xbf72('0x3d')]['split']('-')[0x0]][_0xbf72('0x46')],'destconnectedlinenum':_0x1ba67d[_0xbf72('0x3f')],'routealias':_0x24490f,'queue':_0x270882||undefined},{'showHidden':![],'depth':null}));this[_0xbf72('0x2f')](util['format'](_0xbf72('0x43'),this['agents'][_0x1ba67d['channel'][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x44')]),'user:agentconnect',{'id':this[_0xbf72('0x16')][_0x1ba67d[_0xbf72('0x3d')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x1ba67d[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x46')],'destconnectedlinenum':_0x1ba67d['exten'],'routealias':_0x24490f,'queue':_0x270882||undefined});}}}}catch(_0x33d1a2){logger[_0xbf72('0x47')]('[%s][voiceCallReport][newstate]',_0x1ba67d[_0xbf72('0x32')],util['inspect'](_0x33d1a2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x6c')]=function(_0x5bc71f,_0xcdfdca){try{if(this[_0xbf72('0x15')][_0x5bc71f]){logger[_0xbf72('0x30')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5bc71f,_0xcdfdca);this[_0xbf72('0x15')][_0x5bc71f][_0xbf72('0x6d')]=!![];if(_[_0xbf72('0x6e')](_0xcdfdca,_0xbf72('0x6f'))){_0xcdfdca=_0xcdfdca['replace'](_0xbf72('0x6f'),_0xbf72('0x70'));}this[_0xbf72('0x15')][_0x5bc71f][_0xbf72('0x71')]=_0xcdfdca;var _0xfb8ca3=_[_0xbf72('0x72')](this[_0xbf72('0x15')][_0x5bc71f]['monitors'],{'filename':_0xcdfdca});if(_[_0xbf72('0x5c')](_0xfb8ca3)){this['channels'][_0x5bc71f][_0xbf72('0x73')][_0xbf72('0x74')]({'filename':_0xcdfdca,'createdAt':moment()['format'](_0xbf72('0x4a')),'mixmonitorid':'','status':_0xbf72('0x75')});}}}catch(_0x3978f6){logger['error'](_0xbf72('0x76'),_0x5bc71f,util[_0xbf72('0x2b')](_0x3978f6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbf72('0x1f')]=function(_0x5a7364){try{if(this[_0xbf72('0x2d')](_0x5a7364)){logger['debug'](_0xbf72('0x77'),_0x5a7364[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x5a7364,{'showHidden':![],'depth':null}));if(this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x32')]]&&_0x5a7364[_0xbf72('0x3d')]!=_0xbf72('0x4f')){if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')])){if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x79')])){logger[_0xbf72('0x30')](_0xbf72('0x7a'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this[_0xbf72('0x6c')](_0x5a7364['uniqueid'],_0x5a7364['value']);}else if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')]['xmd-phone'])){logger[_0xbf72('0x30')](_0xbf72('0x7c'),_0x5a7364['uniqueid'],_0x5a7364[_0xbf72('0x7b')]);this['channels'][_0x5a7364['uniqueid']]['calleridnum']=_0x5a7364[_0xbf72('0x7b')];}else if(this['isNotNull'](_0x5a7364['variable'][_0xbf72('0x7d')])){logger[_0xbf72('0x30')](_0xbf72('0x7e'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x7f')]=_0x5a7364[_0xbf72('0x7b')];}else if(this[_0xbf72('0x2d')](_0x5a7364['variable'][_0xbf72('0x80')])){logger[_0xbf72('0x30')](_0xbf72('0x81'),_0x5a7364['uniqueid'],_0x5a7364[_0xbf72('0x7b')]);this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x5b')]=_0x5a7364['value'];}else if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x82')])){logger[_0xbf72('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')][_0xbf72('0x3e')](',')[0x0]);this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x9')]=_0x5a7364['value']['split'](',')[0x0];}else if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x83')])){logger['info'](_0xbf72('0x84'),_0x5a7364[_0xbf72('0x32')],_0x5a7364['value']);this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x32')]]['originatecalleridnum']=_0x5a7364[_0xbf72('0x7b')];}else if(this[_0xbf72('0x2d')](_0x5a7364['variable']['xmd-destination'])){logger[_0xbf72('0x30')](_0xbf72('0x85'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this['channels'][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x86')]=_0x5a7364[_0xbf72('0x7b')];}else if(this['isNotNull'](_0x5a7364['variable']['xmd-callerid-preview'])){logger[_0xbf72('0x30')](_0xbf72('0x87'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this['channels'][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x88')]=_0x5a7364[_0xbf72('0x7b')];}else if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x89')])){logger[_0xbf72('0x30')](_0xbf72('0x8a'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this['channels'][_0x5a7364[_0xbf72('0x32')]][_0xbf72('0x9')]=_0x5a7364[_0xbf72('0x7b')];}else if(this[_0xbf72('0x2d')](_0x5a7364['variable']['sipcallid'])){logger[_0xbf72('0x30')](_0xbf72('0x8b'),_0x5a7364[_0xbf72('0x32')],_0x5a7364[_0xbf72('0x7b')]);this[_0xbf72('0x15')][_0x5a7364['uniqueid']]['sipcalluniqueid']=_0x5a7364[_0xbf72('0x7b')];}}}else if(this[_0xbf72('0x2d')](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x79')])){if(_0x5a7364[_0xbf72('0x7b')]){var _0x225f00=path[_0xbf72('0x8c')](_0x5a7364[_0xbf72('0x7b')])[_0xbf72('0x44')];logger[_0xbf72('0x30')](_0xbf72('0x7a'),_0x225f00,_0x5a7364['value']);this[_0xbf72('0x6c')](_0x225f00,_0x5a7364['value']);}}else if(this[_0xbf72('0x15')][_0x5a7364[_0xbf72('0x37')]]){if(this['isNotNull'](_0x5a7364[_0xbf72('0x78')])){if(this['isNotNull'](_0x5a7364[_0xbf72('0x78')][_0xbf72('0x8d')])){logger['info'](_0xbf72('0x8b'),_0x5a7364[_0xbf72('0x37')],_0x5a7364[_0xbf72('0x7b')]);this[_0xbf72('0x15')][_0x5a7364['linkedid']]['sipcalllinkedid']=_0x5a7364[_0xbf72('0x7b')];}}}}}catch(_0x15b3c8){logger[_0xbf72('0x47')](_0xbf72('0x8e'),_0x5a7364[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x15b3c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf72('0x2c')][_0xbf72('0x8f')]=function(_0x3f5c83){try{if(this[_0xbf72('0x2d')](_0x3f5c83)){logger[_0xbf72('0x35')](_0xbf72('0x90'),_0x3f5c83[_0xbf72('0x32')],util[_0xbf72('0x2b')](_0x3f5c83,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x3f5c83[_0xbf72('0x37')]]){if(this['channels'][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]]){this['channels'][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]][_0xbf72('0x32')]=_0x3f5c83[_0xbf72('0x32')];this['channels'][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]][_0xbf72('0x68')]=this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]]['answered'];this[_0xbf72('0x15')][this['blindTransfers'][_0x3f5c83['linkedid']][_0xbf72('0x37')]][_0xbf72('0x60')]=this[_0xbf72('0x15')][_0x3f5c83['uniqueid']]['answertime'];this['channels'][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]][_0xbf72('0x6a')]=this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]][_0xbf72('0x3d')];this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83['linkedid']][_0xbf72('0x37')]][_0xbf72('0x4b')]=this[_0xbf72('0x15')][_0x3f5c83['uniqueid']]['disposition'];this[_0xbf72('0x15')][_0x3f5c83['uniqueid']]=this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x37')]];delete this[_0xbf72('0x15')][this['blindTransfers'][_0x3f5c83[_0xbf72('0x37')]]['linkedid']];}else if(this[_0xbf72('0x15')][this['blindTransfers'][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x32')]]){this['channels'][this[_0xbf72('0x17')][_0x3f5c83['linkedid']][_0xbf72('0x32')]][_0xbf72('0x32')]=[this[_0xbf72('0x15')][this['blindTransfers'][_0x3f5c83[_0xbf72('0x37')]]['uniqueid']][_0xbf72('0x37')],this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83['linkedid']][_0xbf72('0x32')]]['linkedid']=this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83['linkedid']][_0xbf72('0x32')]][_0xbf72('0x32')]][0x0];this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x32')]][_0xbf72('0x68')]=this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x68')];this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]]['uniqueid']]['answertime']=this[_0xbf72('0x15')][_0x3f5c83['uniqueid']][_0xbf72('0x60')];this['channels'][this['blindTransfers'][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x32')]][_0xbf72('0x6a')]=this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]]['uniqueid']][_0xbf72('0x3d')];this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83['linkedid']][_0xbf72('0x32')]][_0xbf72('0x4b')]=this['channels'][_0x3f5c83[_0xbf72('0x32')]]['disposition'];this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]]=this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x32')]];delete this[_0xbf72('0x15')][this[_0xbf72('0x17')][_0x3f5c83[_0xbf72('0x37')]][_0xbf72('0x32')]];}}if(this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]]){logger[_0xbf72('0x30')](_0xbf72('0x91'),_0x3f5c83[_0xbf72('0x32')],_0x3f5c83['cause-txt']);var _0xefd730=moment();this['channels'][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x92')]=_0xefd730[_0xbf72('0x42')](_0xbf72('0x4a'));this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x56')]=_0xefd730[_0xbf72('0x61')](this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x62')],_0xbf72('0x63'));if(this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x68')]){this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x93')]=_0xefd730['diff'](this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x60')],_0xbf72('0x63'));this['channels'][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x69')]=this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]][_0xbf72('0x56')]-this[_0xbf72('0x15')][_0x3f5c83[_0xbf72('0x32')]]['billableseconds'];}if(_0x3f5c83[_0xbf72('0x3b')]===_0xbf72('0x3c')){if(this['agents'][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]){this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]=_[_0xbf72('0x94')](this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')]['split']('-')[0x0]],[_0xbf72('0x40')]);logger[_0xbf72('0x35')](_0xbf72('0x95'),_0x3f5c83[_0xbf72('0x32')],util[_0xbf72('0x2b')]({'id':this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x46')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xbf72('0x42')](_0xbf72('0x43'),this['agents'][_0x3f5c83['channel'][_0xbf72('0x3e')]('-')[0x0]][_0xbf72('0x44')]),_0xbf72('0x96'),{'id':this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0xbf72('0x16')][_0x3f5c83[_0xbf72('0x3d')][_0xbf72('0x3e')]('-')[0x0]]['accountcode']});for(var _0x339af5=0x0;_0x339af50x0?_0x3af460:0x0;this[_0xc059('0xe')][_0xcc5f37[_0xc059('0x64')]][_0xc059('0x6c')]=this[_0xc059('0xe')][_0xcc5f37[_0xc059('0x64')]][_0xc059('0x6c')]>_[_0xc059('0x6a')](_0xcc5f37['loggedin'])?_[_0xc059('0x6a')](_0xcc5f37[_0xc059('0x6b')]):this[_0xc059('0xe')][_0xcc5f37[_0xc059('0x64')]][_0xc059('0x6c')];this[_0xc059('0x4b')](this[_0xc059('0xe')][_0xcc5f37[_0xc059('0x64')]],_0xc059('0x6d'));}logger['debug'](_0xc059('0x6e'),util[_0xc059('0x35')](this['voiceQueues'][_0xcc5f37[_0xc059('0x64')]],{'showHidden':![],'depth':null}));ami[_0xc059('0x3c')]('custom:queuesummary',this['voiceQueues'][_0xcc5f37['queue']]);}}}catch(_0x17b6ff){logger[_0xc059('0x36')](_0xc059('0x62'),util['inspect'](_0x17b6ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0x13')]=function(_0x434578){logger[_0xc059('0x3e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x434578,{'showHidden':![],'depth':null}));ami[_0xc059('0x3c')](_0xc059('0x6f'),{});this[_0xc059('0xf')]=!![];};VoiceQueueReport[_0xc059('0x3a')]['syncQueueCallerJoin']=function(_0x18ccb7){try{if(this[_0xc059('0x5d')](_0x18ccb7)){logger[_0xc059('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x18ccb7['uniqueid'],util[_0xc059('0x35')](_0x18ccb7,{'showHidden':![],'depth':null}));if(_[_0xc059('0x70')](this[_0xc059('0xb')][_0x18ccb7[_0xc059('0x41')]]))this[_0xc059('0xb')][_0x18ccb7[_0xc059('0x41')]]=[];if(_[_0xc059('0x70')](this[_0xc059('0x2a')][_0x18ccb7[_0xc059('0x41')]]))this[_0xc059('0x2a')][_0x18ccb7[_0xc059('0x41')]]={};var _0x128c04=new QueueReport();_0x128c04[_0xc059('0x43')]=_0x18ccb7[_0xc059('0x64')];_0x128c04[_0xc059('0x53')]=this[_0xc059('0xe')][_0x128c04[_0xc059('0x43')]]&&this[_0xc059('0xe')][_0x128c04[_0xc059('0x43')]]['type']?this['voiceQueues'][_0x128c04[_0xc059('0x43')]]['type']||_0xc059('0x71'):_0xc059('0x71');_0x128c04[_0xc059('0x64')]=_0x18ccb7['queue'];_0x128c04[_0xc059('0x72')]=moment()[_0xc059('0x5b')](_0xc059('0x73'));_0x128c04[_0xc059('0x74')]=_0x18ccb7[_0xc059('0x74')];_0x128c04['count']=_0x18ccb7[_0xc059('0x75')];_0x128c04[_0xc059('0x41')]=_0x18ccb7[_0xc059('0x41')];_0x128c04['routealias']=this['channels'][_0x18ccb7['uniqueid']]['routealias'];logger[_0xc059('0x66')](_0xc059('0x76'),_0x128c04[_0xc059('0x43')],_0x128c04[_0xc059('0x53')]);_['merge'](_0x128c04,_['pick'](_0x18ccb7,_['keys'](_0x128c04)));this[_0xc059('0xb')][_0x18ccb7['uniqueid']]['push'](_0x128c04);this[_0xc059('0x2a')][_0x18ccb7['uniqueid']]=_0x128c04;this['emitVoiceQueueChannelSave'](_0x128c04,'queuecallerjoin');}}catch(_0x402024){logger[_0xc059('0x36')]('[%s][voiceQueueReport][queuecallerjoin]',_0x18ccb7['uniqueid'],util[_0xc059('0x35')](_0x402024,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')]['syncQueueCallerAbandon']=function(_0x535162){try{if(this[_0xc059('0x5d')](_0x535162)){logger[_0xc059('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x535162['uniqueid'],util[_0xc059('0x35')](_0x535162,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x535162[_0xc059('0x41')]]){var _0xddf8a1=_[_0xc059('0x77')](this[_0xc059('0xb')][_0x535162[_0xc059('0x41')]]);_0xddf8a1[_0xc059('0x78')]=![];_0xddf8a1['queuecallercompleteAt']=null;_0xddf8a1['holdtime']=_0x535162['holdtime'];_0xddf8a1[_0xc059('0x79')]=_0x535162[_0xc059('0x79')];_0xddf8a1[_0xc059('0x15')]=!![];_0xddf8a1['queuecallerabandonAt']=moment()[_0xc059('0x5b')](_0xc059('0x73'));_0xddf8a1[_0xc059('0x47')]='ABANDONED';_0xddf8a1[_0xc059('0x7a')]=null;logger[_0xc059('0x66')](_0xc059('0x7b'),_0xddf8a1[_0xc059('0x43')],_0xddf8a1[_0xc059('0x53')]);this[_0xc059('0x2a')][_0x535162[_0xc059('0x41')]]=_0xddf8a1;this['emitVoiceQueueChannelRemove'](_0xddf8a1,_0xc059('0x15'));}}}catch(_0x4398b6){logger['error'](_0xc059('0x7c'),_0x535162['uniqueid'],util[_0xc059('0x35')](_0x4398b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0x17')]=function(_0x389db7){try{if(this[_0xc059('0x5d')](_0x389db7)){logger[_0xc059('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x389db7[_0xc059('0x41')],util[_0xc059('0x35')](_0x389db7,{'showHidden':![],'depth':null}));if(this[_0xc059('0xb')][_0x389db7['uniqueid']]){var _0x132578=_[_0xc059('0x77')](this['queueReports'][_0x389db7[_0xc059('0x41')]]);_0x132578['queuecallerleaveAt']=moment()[_0xc059('0x5b')](_0xc059('0x73'));_0x132578[_0xc059('0x7d')]=_0x389db7['connectedlinenum'];_0x132578['connectedlinename']=_0x389db7[_0xc059('0x7e')];logger[_0xc059('0x66')](_0xc059('0x7f'),_0x132578[_0xc059('0x43')],_0x132578[_0xc059('0x53')],_0x389db7[_0xc059('0x7d')],_0x389db7['connectedlinename']);this[_0xc059('0x2a')][_0x389db7[_0xc059('0x41')]]=_0x132578;this[_0xc059('0x3d')](_0x132578,_0xc059('0x80'));}}}catch(_0x337786){logger['error'](_0xc059('0x81'),_0x389db7[_0xc059('0x41')],util[_0xc059('0x35')](_0x337786,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0x82')]=function(_0x2df8cd){try{if(this['isNotNull'](_0x2df8cd)){logger[_0xc059('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x2df8cd[_0xc059('0x41')],util[_0xc059('0x35')](_0x2df8cd,{'showHidden':![],'depth':null}));if(this[_0xc059('0xb')][_0x2df8cd[_0xc059('0x41')]]){var _0x27bfa1=_[_0xc059('0x77')](this['queueReports'][_0x2df8cd[_0xc059('0x41')]]);_0x27bfa1[_0xc059('0x78')]=!![];_0x27bfa1[_0xc059('0x47')]=_0xc059('0x83');logger[_0xc059('0x66')](_0xc059('0x84'),_0x27bfa1['name'],_0x27bfa1[_0xc059('0x53')]);}}}catch(_0x2de13d){logger[_0xc059('0x36')](_0xc059('0x85'),_0x2df8cd[_0xc059('0x41')],util[_0xc059('0x35')](_0x2de13d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0x18')]=function(_0x1516a7){try{if(this['isNotNull'](_0x1516a7)){logger['debug'](_0xc059('0x86'),_0x1516a7[_0xc059('0x41')],util[_0xc059('0x35')](_0x1516a7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1516a7[_0xc059('0x41')]]){var _0x324ec3=_[_0xc059('0x77')](this[_0xc059('0xb')][_0x1516a7[_0xc059('0x41')]]);_0x324ec3[_0xc059('0x15')]=![];_0x324ec3[_0xc059('0x87')]=null;_0x324ec3[_0xc059('0x88')]=!![];_0x324ec3['lastAssignedTo']=_0x1516a7[_0xc059('0x89')];_0x324ec3['holdtime']=_0x1516a7[_0xc059('0x8a')];_0x324ec3[_0xc059('0x78')]=!![];_0x324ec3['queuecallerexit']=![];_0x324ec3[_0xc059('0x8b')]=null;if(!_0x324ec3[_0xc059('0x8c')]){if(_0x1516a7['reason']==_0xc059('0x8c')){_0x324ec3[_0xc059('0x47')]=_0xc059('0x8d');logger[_0xc059('0x66')](_0xc059('0x8e'),_0x324ec3[_0xc059('0x43')],_0x324ec3[_0xc059('0x53')]);}else{if(_[_0xc059('0x8f')](_0x1516a7[_0xc059('0x30')]['toLowerCase'](),_0xc059('0x90'))){if(this[_0xc059('0xb')][_0x1516a7[_0xc059('0x91')]]){var _0x390574=_[_0xc059('0x77')](this['queueReports'][_0x1516a7['linkedid']]);_0x390574['queuecallercomplete']=![];_0x390574['queuecallerexit']=!![];_0x390574[_0xc059('0x8b')]=moment(_0x324ec3[_0xc059('0x72')])[_0xc059('0x92')](_0x1516a7[_0xc059('0x8a')],_0xc059('0x93'))['format'](_0xc059('0x73'));_0x390574['queuecallerexitreason']=_0xc059('0x94');_0x390574[_0xc059('0x8c')]=!![];_0x390574[_0xc059('0x95')]='FORWARD';_0x390574['transferexten']=_0x1516a7[_0xc059('0x96')];_0x390574[_0xc059('0x97')]=_0x1516a7[_0xc059('0x41')];logger[_0xc059('0x66')](_0xc059('0x98'),_0x390574[_0xc059('0x43')],_0x390574[_0xc059('0x53')]);var _0xb6c129=this[_0xc059('0xb')][_0x1516a7[_0xc059('0x91')]];this[_0xc059('0xb')][_0x1516a7[_0xc059('0x91')]]=this[_0xc059('0xb')][_0x1516a7[_0xc059('0x41')]];this[_0xc059('0xb')][_0x1516a7[_0xc059('0x41')]]=_0xb6c129;}}else{_0x324ec3[_0xc059('0x47')]='COMPLETEDBY'+_0x1516a7['reason'][_0xc059('0x99')]();logger['info'](_0xc059('0x9a'),_0x324ec3[_0xc059('0x43')],_0x324ec3[_0xc059('0x53')],_0x324ec3[_0xc059('0x47')]);}}}this[_0xc059('0x2a')][_0x1516a7[_0xc059('0x41')]]=_0x324ec3;this[_0xc059('0x45')](_0x324ec3,_0xc059('0x9b'));}}}catch(_0x128273){logger[_0xc059('0x36')](_0xc059('0x86'),_0x1516a7[_0xc059('0x41')],util[_0xc059('0x35')](_0x128273,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc059('0x19')]=function(_0x490b1c){try{if(this[_0xc059('0x5d')](_0x490b1c)){logger[_0xc059('0x3e')](_0xc059('0x9c'),_0x490b1c[_0xc059('0x41')],util[_0xc059('0x35')](_0x490b1c,{'showHidden':![],'depth':null}));this[_0xc059('0x9d')](_0x490b1c['uniqueid'],_['keys'](_0x490b1c[_0xc059('0x9e')])[0x0],_0x490b1c[_0xc059('0x9f')]);if(this[_0xc059('0xb')][_0x490b1c[_0xc059('0x41')]]){var _0x458df3=_[_0xc059('0x77')](this[_0xc059('0xb')][_0x490b1c[_0xc059('0x41')]]);if(_0x458df3){if(this['isNotNull'](_0x490b1c[_0xc059('0x9e')])&&this['isNotNull'](_0x490b1c[_0xc059('0x9e')][_0xc059('0xa0')])){switch(_0x490b1c['value']){case'CONTINUE':_0x458df3['queuecallerexit']=![];_0x458df3[_0xc059('0x8b')]=null;break;case _0xc059('0xa1'):_0x458df3['lastevent']=_0xc059('0xa2');_0x458df3[_0xc059('0xa3')]=!![];_0x458df3[_0xc059('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x458df3[_0xc059('0xa4')]=moment()[_0xc059('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xc059('0x3e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x490b1c[_0xc059('0x41')],util['inspect'](_0x458df3,{'showHidden':![],'depth':null}));ami[_0xc059('0x3c')](_0xc059('0xa5'),_0x458df3);break;default:_0x458df3[_0xc059('0xa3')]=!![];_0x458df3[_0xc059('0x8b')]=moment()[_0xc059('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x458df3[_0xc059('0xa4')]=moment()['format'](_0xc059('0x73'));}_0x458df3[_0xc059('0x15')]=![];_0x458df3['queuecallerabandonAt']=null;_0x458df3[_0xc059('0x47')]=_0x490b1c[_0xc059('0x9f')];this[_0xc059('0x2a')][_0x490b1c[_0xc059('0x41')]]=_0x458df3;this[_0xc059('0x45')](_0x458df3,_0xc059('0xa6'));}else if(this['isNotNull'](_0x490b1c[_0xc059('0x9e')])&&this[_0xc059('0x5d')](_0x490b1c[_0xc059('0x9e')]['queueposition'])){if(!_0x458df3['queuecallerabandon']){_0x458df3[_0xc059('0xa3')]=!![];_0x458df3[_0xc059('0x8b')]=moment()[_0xc059('0x5b')](_0xc059('0x73'));_0x458df3[_0xc059('0x47')]=_0xc059('0xa7');_0x458df3[_0xc059('0xa4')]=moment()['format'](_0xc059('0x73'));this['channels'][_0x490b1c[_0xc059('0x41')]]=_0x458df3;}}logger[_0xc059('0x66')](_0xc059('0xa8'),_0x490b1c[_0xc059('0x41')],_0x458df3[_0xc059('0x43')],_0x458df3[_0xc059('0x53')],_[_0xc059('0xa9')](_0x490b1c['variable'])[0x0],_0x490b1c['value']);_0x458df3[_0xc059('0x11')]=this[_0xc059('0x11')][_0x490b1c[_0xc059('0x41')]];}}}}catch(_0x52b2ef){logger[_0xc059('0x36')](_0xc059('0x9c'),_0x490b1c[_0xc059('0x41')],util['inspect'](_0x52b2ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0x9d')]=function(_0x1c44bf,_0x516d4a,_0x219c21){var _0x30dd0c=['rtpaudioqos','rtpaudioqosbridged',_0xc059('0xaa'),'rtpaudioqosjitterbridged',_0xc059('0xab'),'rtpaudioqoslossbridged',_0xc059('0xac'),_0xc059('0xad'),_0xc059('0xae'),_0xc059('0xaf'),_0xc059('0xb0'),_0xc059('0xb1'),_0xc059('0xb2'),'memberdynamic','memberinterface',_0xc059('0xb3'),_0xc059('0x89'),'memberpenalty',_0xc059('0xb4')];if(!_[_0xc059('0x2d')](_0x516d4a)&&!_[_0xc059('0xb5')](_0x30dd0c,_0x516d4a)){if(_['isUndefined'](this['variables'][_0x1c44bf])){this[_0xc059('0x11')][_0x1c44bf]={};}this[_0xc059('0x11')][_0x1c44bf][_0x516d4a]=_0x219c21;}};VoiceQueueReport[_0xc059('0x3a')][_0xc059('0xb6')]=function(_0x180a7a,_0x2d63c3,_0x47dd12){var _0x4b7ba1={};for(var _0x320bd4=0x0;_0x320bd40x0?_0x90c4fc:0x0;this[_0xf9a5('0x12')][_0x4ffa7d[_0xf9a5('0x6b')]][_0xf9a5('0x30')]=this['voiceQueues'][_0x4ffa7d['queue']][_0xf9a5('0x30')]>_[_0xf9a5('0x70')](_0x4ffa7d['loggedin'])?_['toNumber'](_0x4ffa7d[_0xf9a5('0x72')]):this['voiceQueues'][_0x4ffa7d[_0xf9a5('0x6b')]]['talking'];this[_0xf9a5('0x52')](this['voiceQueues'][_0x4ffa7d[_0xf9a5('0x6b')]],_0xf9a5('0x73'));}logger[_0xf9a5('0x45')](_0xf9a5('0x74'),util[_0xf9a5('0x3c')](this[_0xf9a5('0x12')][_0x4ffa7d[_0xf9a5('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0x75'),this[_0xf9a5('0x12')][_0x4ffa7d['queue']]);}}}catch(_0x41c7df){logger[_0xf9a5('0x3a')](_0xf9a5('0x69'),util[_0xf9a5('0x3c')](_0x41c7df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf9a5('0x17')]=function(_0x4eee86){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xf9a5('0x3c')](_0x4eee86,{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0x76'),{});this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xf9a5('0x77')]=function(_0x603eaa){try{if(this[_0xf9a5('0x64')](_0x603eaa)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x603eaa[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x603eaa,{'showHidden':![],'depth':null}));if(_[_0xf9a5('0x78')](this[_0xf9a5('0xe')][_0x603eaa['uniqueid']]))this[_0xf9a5('0xe')][_0x603eaa[_0xf9a5('0x48')]]=[];if(_[_0xf9a5('0x78')](this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]]))this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]]={};var _0x28e22f=new QueueReport();_0x28e22f[_0xf9a5('0x4b')]=_0x603eaa['queue'];_0x28e22f['type']=this[_0xf9a5('0x12')][_0x28e22f[_0xf9a5('0x4b')]]&&this[_0xf9a5('0x12')][_0x28e22f[_0xf9a5('0x4b')]][_0xf9a5('0x5a')]?this['voiceQueues'][_0x28e22f[_0xf9a5('0x4b')]][_0xf9a5('0x5a')]||'inbound':_0xf9a5('0x53');_0x28e22f[_0xf9a5('0x6b')]=_0x603eaa[_0xf9a5('0x6b')];_0x28e22f['queuecallerjoinAt']=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x28e22f['position']=_0x603eaa[_0xf9a5('0x7a')];_0x28e22f[_0xf9a5('0x7b')]=_0x603eaa[_0xf9a5('0x7b')];_0x28e22f[_0xf9a5('0x48')]=_0x603eaa[_0xf9a5('0x48')];_0x28e22f['routealias']=this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]][_0xf9a5('0x7c')];logger[_0xf9a5('0x6c')](_0xf9a5('0x7d'),_0x28e22f[_0xf9a5('0x4b')],_0x28e22f[_0xf9a5('0x5a')]);_['merge'](_0x28e22f,_[_0xf9a5('0x7e')](_0x603eaa,_['keys'](_0x28e22f)));this[_0xf9a5('0xe')][_0x603eaa[_0xf9a5('0x48')]][_0xf9a5('0x7f')](_0x28e22f);this['channels'][_0x603eaa[_0xf9a5('0x48')]]=_0x28e22f;this[_0xf9a5('0x44')](_0x28e22f,'queuecallerjoin');}}catch(_0x50c9a2){logger['error'](_0xf9a5('0x80'),_0x603eaa[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x50c9a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1b')]=function(_0x1a058a){try{if(this[_0xf9a5('0x64')](_0x1a058a)){logger[_0xf9a5('0x45')](_0xf9a5('0x81'),_0x1a058a[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x1a058a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1a058a[_0xf9a5('0x48')]]){var _0x5c8460=_['last'](this[_0xf9a5('0xe')][_0x1a058a[_0xf9a5('0x48')]]);_0x5c8460[_0xf9a5('0x82')]=![];_0x5c8460[_0xf9a5('0x83')]=null;_0x5c8460[_0xf9a5('0x84')]=_0x1a058a['holdtime'];_0x5c8460['originalposition']=_0x1a058a[_0xf9a5('0x85')];_0x5c8460['queuecallerabandon']=!![];_0x5c8460[_0xf9a5('0x86')]=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c8460['queuecallerexitreason']='ABANDONED';_0x5c8460['lastAssignedTo']=null;logger[_0xf9a5('0x6c')](_0xf9a5('0x87'),_0x5c8460['name'],_0x5c8460['type']);this[_0xf9a5('0x10')][_0x1a058a[_0xf9a5('0x48')]]=_0x5c8460;this[_0xf9a5('0x41')](_0x5c8460,'queuecallerabandon');}}}catch(_0x605446){logger['error'](_0xf9a5('0x81'),_0x1a058a['uniqueid'],util[_0xf9a5('0x3c')](_0x605446,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1c')]=function(_0x1d7a7f){try{if(this[_0xf9a5('0x64')](_0x1d7a7f)){logger[_0xf9a5('0x45')](_0xf9a5('0x88'),_0x1d7a7f[_0xf9a5('0x48')],util['inspect'](_0x1d7a7f,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x1d7a7f[_0xf9a5('0x48')]]){var _0x719ac2=_[_0xf9a5('0x89')](this[_0xf9a5('0xe')][_0x1d7a7f[_0xf9a5('0x48')]]);_0x719ac2[_0xf9a5('0x8a')]=moment()['format'](_0xf9a5('0x79'));_0x719ac2[_0xf9a5('0x8b')]=_0x1d7a7f[_0xf9a5('0x8b')];_0x719ac2[_0xf9a5('0x8c')]=_0x1d7a7f[_0xf9a5('0x8c')];logger[_0xf9a5('0x6c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x719ac2[_0xf9a5('0x4b')],_0x719ac2[_0xf9a5('0x5a')],_0x1d7a7f[_0xf9a5('0x8b')],_0x1d7a7f[_0xf9a5('0x8c')]);this[_0xf9a5('0x10')][_0x1d7a7f[_0xf9a5('0x48')]]=_0x719ac2;this[_0xf9a5('0x44')](_0x719ac2,_0xf9a5('0x8d'));}}}catch(_0x2a7032){logger[_0xf9a5('0x3a')](_0xf9a5('0x88'),_0x1d7a7f[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x2a7032,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf9a5('0x8e')]=function(_0x381ebd){try{if(this[_0xf9a5('0x64')](_0x381ebd)){logger[_0xf9a5('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x381ebd[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x381ebd,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x381ebd[_0xf9a5('0x48')]]){var _0x544806=_[_0xf9a5('0x89')](this['queueReports'][_0x381ebd['uniqueid']]);_0x544806[_0xf9a5('0x82')]=!![];_0x544806['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xf9a5('0x6c')](_0xf9a5('0x8f'),_0x544806[_0xf9a5('0x4b')],_0x544806[_0xf9a5('0x5a')]);}}}catch(_0x483c9c){logger['error'](_0xf9a5('0x90'),_0x381ebd[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x483c9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1e')]=function(_0x509af9){try{if(this[_0xf9a5('0x64')](_0x509af9)){logger[_0xf9a5('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x509af9[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x509af9,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x509af9['uniqueid']]){var _0x56f611=_['last'](this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0x48')]]);_0x56f611[_0xf9a5('0x1a')]=![];_0x56f611[_0xf9a5('0x86')]=null;_0x56f611[_0xf9a5('0x91')]=!![];_0x56f611[_0xf9a5('0x92')]=_0x509af9[_0xf9a5('0x93')];_0x56f611[_0xf9a5('0x84')]=_0x509af9[_0xf9a5('0x84')];_0x56f611[_0xf9a5('0x82')]=!![];_0x56f611[_0xf9a5('0x94')]=![];_0x56f611[_0xf9a5('0x95')]=null;if(!_0x56f611['transfer']){if(_0x509af9[_0xf9a5('0x96')]=='transfer'){_0x56f611['queuecallerexitreason']=_0xf9a5('0x97');logger[_0xf9a5('0x6c')](_0xf9a5('0x98'),_0x56f611[_0xf9a5('0x4b')],_0x56f611['type']);}else{if(_['startsWith'](_0x509af9[_0xf9a5('0x99')]['toLowerCase'](),_0xf9a5('0x9a'))){if(this[_0xf9a5('0xe')][_0x509af9['linkedid']]){var _0x5b3db0=_[_0xf9a5('0x89')](this['queueReports'][_0x509af9['linkedid']]);_0x5b3db0[_0xf9a5('0x82')]=![];_0x5b3db0[_0xf9a5('0x94')]=!![];_0x5b3db0[_0xf9a5('0x95')]=moment(_0x56f611['queuecallerjoinAt'])[_0xf9a5('0x9b')](_0x509af9[_0xf9a5('0x84')],_0xf9a5('0x9c'))[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x5b3db0[_0xf9a5('0x4f')]=_0xf9a5('0x9d');_0x5b3db0[_0xf9a5('0x9e')]=!![];_0x5b3db0['transfertype']=_0xf9a5('0x9f');_0x5b3db0[_0xf9a5('0xa0')]=_0x509af9['destexten'];_0x5b3db0[_0xf9a5('0xa1')]=_0x509af9[_0xf9a5('0x48')];logger[_0xf9a5('0x6c')](_0xf9a5('0xa2'),_0x5b3db0[_0xf9a5('0x4b')],_0x5b3db0['type']);var _0x380402=this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0xa3')]];this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0xa3')]]=this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0x48')]];this['queueReports'][_0x509af9[_0xf9a5('0x48')]]=_0x380402;}}else{_0x56f611[_0xf9a5('0x4f')]=_0xf9a5('0xa4')+_0x509af9['reason'][_0xf9a5('0xa5')]();logger[_0xf9a5('0x6c')](_0xf9a5('0xa6'),_0x56f611[_0xf9a5('0x4b')],_0x56f611['type'],_0x56f611['queuecallerexitreason']);}}}this[_0xf9a5('0x10')][_0x509af9[_0xf9a5('0x48')]]=_0x56f611;this[_0xf9a5('0x41')](_0x56f611,'agentcomplete');}}}catch(_0x7a2de8){logger['error'](_0xf9a5('0xa7'),_0x509af9[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x7a2de8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0xa8')]=function(_0x312c6b){try{if(this[_0xf9a5('0x64')](_0x312c6b)){logger[_0xf9a5('0x45')](_0xf9a5('0xa9'),_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x312c6b,{'showHidden':![],'depth':null}));this['addVariable'](_0x312c6b[_0xf9a5('0x48')],_[_0xf9a5('0xaa')](_0x312c6b[_0xf9a5('0xab')])[0x0],_0x312c6b[_0xf9a5('0xac')]);if(this[_0xf9a5('0xe')][_0x312c6b[_0xf9a5('0x48')]]){var _0x4d95f4=_[_0xf9a5('0x89')](this[_0xf9a5('0xe')][_0x312c6b[_0xf9a5('0x48')]]);if(_0x4d95f4){if(this[_0xf9a5('0x64')](_0x312c6b['variable'])&&this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')][_0xf9a5('0xad')])){switch(_0x312c6b[_0xf9a5('0xac')]){case _0xf9a5('0xae'):_0x4d95f4[_0xf9a5('0x94')]=![];_0x4d95f4['queuecallerexitAt']=null;break;case _0xf9a5('0xaf'):_0x4d95f4[_0xf9a5('0xb0')]='timeout';_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4[_0xf9a5('0x95')]=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x4d95f4['queuecallerleaveAt']=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));logger[_0xf9a5('0x45')](_0xf9a5('0xb1'),_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x4d95f4,{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0xb2'),_0x4d95f4);break;default:_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4['queuecallerexitAt']=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d95f4[_0xf9a5('0x8a')]=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));}_0x4d95f4[_0xf9a5('0x1a')]=![];_0x4d95f4[_0xf9a5('0x86')]=null;_0x4d95f4[_0xf9a5('0x4f')]=_0x312c6b[_0xf9a5('0xac')];this[_0xf9a5('0x10')][_0x312c6b[_0xf9a5('0x48')]]=_0x4d95f4;this[_0xf9a5('0x41')](_0x4d95f4,'varset');}else if(this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')])&&this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')]['queueposition'])){if(!_0x4d95f4[_0xf9a5('0x1a')]){_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4[_0xf9a5('0x95')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d95f4['queuecallerexitreason']=_0xf9a5('0xb3');_0x4d95f4[_0xf9a5('0x8a')]=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf9a5('0x10')][_0x312c6b['uniqueid']]=_0x4d95f4;}}logger[_0xf9a5('0x6c')](_0xf9a5('0xb4'),_0x312c6b['uniqueid'],_0x4d95f4[_0xf9a5('0x4b')],_0x4d95f4[_0xf9a5('0x5a')],_[_0xf9a5('0xaa')](_0x312c6b[_0xf9a5('0xab')])[0x0],_0x312c6b['value']);_0x4d95f4[_0xf9a5('0x15')]=this[_0xf9a5('0x15')][_0x312c6b[_0xf9a5('0x48')]];}}}}catch(_0x4e296e){logger[_0xf9a5('0x3a')]('[%s][voiceQueueReport][varset]',_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x4e296e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0xb5')]=function(_0x4afb31,_0x536f3b,_0x4706a7){var _0x42fbde=[_0xf9a5('0xb6'),_0xf9a5('0xb7'),_0xf9a5('0xb8'),'rtpaudioqosjitterbridged',_0xf9a5('0xb9'),_0xf9a5('0xba'),_0xf9a5('0xbb'),'rtpaudioqosrttbridged',_0xf9a5('0xbc'),_0xf9a5('0xbd'),'bridgepeer',_0xf9a5('0xbe'),_0xf9a5('0xbf'),_0xf9a5('0xc0'),_0xf9a5('0xc1'),_0xf9a5('0xc2'),_0xf9a5('0x93'),_0xf9a5('0xc3'),'memberrealtime'];if(!_[_0xf9a5('0x36')](_0x536f3b)&&!_[_0xf9a5('0xc4')](_0x42fbde,_0x536f3b)){if(_[_0xf9a5('0x78')](this['variables'][_0x4afb31])){this[_0xf9a5('0x15')][_0x4afb31]={};}this[_0xf9a5('0x15')][_0x4afb31][_0x536f3b]=_0x4706a7;}};VoiceQueueReport['prototype'][_0xf9a5('0xc5')]=function(_0x232993,_0x9f9053,_0xd8d509){var _0x1bf735={};for(var _0x9925a2=0x0;_0x9925a2=0x0?moment(_0x2e7451[_0xae8a('0x16')])[_0xae8a('0xd')](_0x2e7451['starttime'],_0xae8a('0xe')):null,'data1':_0xae8a('0x18'),'data2':_0x2e7451[_0xae8a('0x12')],'data3':_0x2e7451[_0xae8a('0x19')],'data4':_0x2e7451[_0xae8a('0x1a')]||null,'role':_0xae8a('0x11'),'internal':_0x2e7451['accountcode']?_[_0xae8a('0x1b')](_0x2e7451[_0xae8a('0x12')]):undefined,'uniqueid':_0x2e7451[_0xae8a('0x1c')]},'log':_0xae8a('0x13')});}; \ No newline at end of file +var _0x2db9=['seconds','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','interface','SIP/%s','TALKING','queuecallerleaveAt','inbound','exten','queue','agent','accountcode','toNumber','uniqueid','diff','starttime'];(function(_0x241c06,_0x15979c){var _0x3a736b=function(_0x11fb16){while(--_0x11fb16){_0x241c06['push'](_0x241c06['shift']());}};_0x3a736b(++_0x15979c);}(_0x2db9,0x1b2));var _0x92db=function(_0x16a3bd,_0x26b540){_0x16a3bd=_0x16a3bd-0x0;var _0x35b9c3=_0x2db9[_0x16a3bd];return _0x35b9c3;};'use strict';var moment=require(_0x92db('0x0'));var _=require(_0x92db('0x1'));var util=require(_0x92db('0x2'));var client=require(_0x92db('0x3'));exports[_0x92db('0x4')]=function(_0x35fbb2){var _0x1ae68e=_0x35fbb2['queuecallercompleteAt']||_0x35fbb2[_0x92db('0x5')];return client[_0x92db('0x6')](_0x92db('0x7'),{'body':{'channel':_0x92db('0x8'),'membername':_0x35fbb2['lastAssignedTo'],'interface':_['isNil'](_0x35fbb2[_0x92db('0x9')])?util['format'](_0x92db('0xa'),_0x35fbb2['lastAssignedTo']):_0x35fbb2[_0x92db('0x9')],'type':_0x92db('0xb'),'enterAt':_0x35fbb2[_0x92db('0xc')],'exitAt':_0x1ae68e,'duration':moment(_0x1ae68e)['diff'](_0x35fbb2[_0x92db('0xc')],'seconds'),'data1':_0x92db('0xd'),'data2':_0x35fbb2['calleridnum'],'data3':_0x35fbb2[_0x92db('0xe')],'data4':null,'data5':_0x35fbb2[_0x92db('0xf')],'role':_0x92db('0x10'),'internal':_0x35fbb2[_0x92db('0x11')]?_[_0x92db('0x12')](_0x35fbb2[_0x92db('0x11')]):undefined,'uniqueid':_0x35fbb2[_0x92db('0x13')]},'log':_0x92db('0x7')});};exports['voiceDialReport']=function(_0x54aa16){return client['Request'](_0x92db('0x7'),{'body':{'channel':'voice','membername':_0x54aa16['membername'],'interface':_0x54aa16[_0x92db('0x9')],'type':'TALKING','enterAt':_0x54aa16['starttime'],'exitAt':_0x54aa16['endtime'],'duration':moment(_0x54aa16['endtime'])[_0x92db('0x14')](_0x54aa16[_0x92db('0x15')],_0x92db('0x16'))>=0x0?moment(_0x54aa16['endtime'])[_0x92db('0x14')](_0x54aa16[_0x92db('0x15')],_0x92db('0x16')):null,'data1':'outbound','data2':_0x54aa16['accountcode'],'data3':_0x54aa16[_0x92db('0xe')],'data4':_0x54aa16[_0x92db('0x17')]||null,'role':_0x92db('0x10'),'internal':_0x54aa16[_0x92db('0x11')]?_[_0x92db('0x12')](_0x54aa16[_0x92db('0x11')]):undefined,'uniqueid':_0x54aa16['uniqueid']},'log':_0x92db('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7036c23..45c6879 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 _0xca73=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x40d358,_0x41aa24){var _0x1d8528=function(_0x53cf0a){while(--_0x53cf0a){_0x40d358['push'](_0x40d358['shift']());}};_0x1d8528(++_0x41aa24);}(_0xca73,0x1ee));var _0x3ca7=function(_0x4c586e,_0x2571ae){_0x4c586e=_0x4c586e-0x0;var _0x40d9a5=_0xca73[_0x4c586e];return _0x40d9a5;};'use strict';var client=require(_0x3ca7('0x0'));exports[_0x3ca7('0x1')]=function(){return client['Request'](_0x3ca7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3ca7('0x3'),_0x3ca7('0x4')]},'log':_0x3ca7('0x5')});}; \ No newline at end of file +var _0xbb84=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbb84,0x158));var _0x4bb8=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xbb84[_0x487496];return _0x539dc8;};'use strict';var client=require(_0x4bb8('0x0'));exports[_0x4bb8('0x1')]=function(){return client[_0x4bb8('0x2')](_0x4bb8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x4bb8('0x4')]},'log':_0x4bb8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 3ff04bb..d5b1162 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 _0x3f77=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x47a5c0,_0x5be9e4){var _0x3d1986=function(_0x2f54d7){while(--_0x2f54d7){_0x47a5c0['push'](_0x47a5c0['shift']());}};_0x3d1986(++_0x5be9e4);}(_0x3f77,0xa0));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x73f7('0x0'));exports[_0x73f7('0x1')]=function(_0x3c7822){return function(_0x4008be){return client[_0x73f7('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x73f7('0x3'),_0x73f7('0x4')]},'log':_0x73f7('0x5')});};}; \ No newline at end of file +var _0x2584=['html','../client','Request','GetTemplate'];(function(_0x355fd4,_0x224a5f){var _0x242b66=function(_0x8ebd40){while(--_0x8ebd40){_0x355fd4['push'](_0x355fd4['shift']());}};_0x242b66(++_0x224a5f);}(_0x2584,0x155));var _0x4258=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0x2584[_0x42bfb7];return _0x5c497d;};'use strict';var client=require(_0x4258('0x0'));exports['getTemplates']=function(_0x428352){return function(_0x3ee7d7){return client[_0x4258('0x1')](_0x4258('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x4258('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a1b602b..aa28519 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 _0x66f1=['operator','value','AnyConditions','Action','action','data1','data2','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','status','AllConditions','field'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x66f1,0x118));var _0x166f=function(_0x1e9d08,_0x1027a7){_0x1e9d08=_0x1e9d08-0x0;var _0x1f53cb=_0x66f1[_0x1e9d08];return _0x1f53cb;};'use strict';var client=require(_0x166f('0x0'));exports[_0x166f('0x1')]=function(_0x345d3f){return function(_0x2d0741){return client[_0x166f('0x2')](_0x166f('0x3'),{'options':{'raw':![],'attributes':['id',_0x166f('0x4'),'channel',_0x166f('0x5')],'include':[{'model':'Condition','as':_0x166f('0x6'),'attributes':['id',_0x166f('0x7'),_0x166f('0x8'),_0x166f('0x9')]},{'model':'Condition','as':_0x166f('0xa'),'attributes':['id','field',_0x166f('0x8'),'value']},{'model':_0x166f('0xb'),'as':'Actions','attributes':['id',_0x166f('0xc'),_0x166f('0xd'),_0x166f('0xe'),'data3',_0x166f('0xf'),'data5',_0x166f('0x10'),_0x166f('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x97c5=['data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action','data2','data3','data4','data5','data6'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x97c5,0x1b6));var _0x597c=function(_0x4abb33,_0x160d22){_0x4abb33=_0x4abb33-0x0;var _0x3d7026=_0x97c5[_0x4abb33];return _0x3d7026;};'use strict';var client=require('../client');exports[_0x597c('0x0')]=function(_0x14abc2){return function(_0xaa9fb3){return client[_0x597c('0x1')](_0x597c('0x2'),{'options':{'raw':![],'attributes':['id',_0x597c('0x3'),_0x597c('0x4'),'status'],'include':[{'model':_0x597c('0x5'),'as':_0x597c('0x6'),'attributes':['id',_0x597c('0x7'),_0x597c('0x8'),_0x597c('0x9')]},{'model':'Condition','as':_0x597c('0xa'),'attributes':['id','field',_0x597c('0x8'),_0x597c('0x9')]},{'model':'Action','as':_0x597c('0xb'),'attributes':['id',_0x597c('0xc'),'data1',_0x597c('0xd'),_0x597c('0xe'),_0x597c('0xf'),_0x597c('0x10'),_0x597c('0x11'),_0x597c('0x12')]}]},'log':_0x597c('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 195d714..f45af91 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 _0xbd3b=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x3ed15c,_0x18aa9b){var _0x2966c7=function(_0x3744bd){while(--_0x3744bd){_0x3ed15c['push'](_0x3ed15c['shift']());}};_0x2966c7(++_0x18aa9b);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x2f5100,_0x565cbe){_0x2f5100=_0x2f5100-0x0;var _0x40c4bc=_0xbd3b[_0x2f5100];return _0x40c4bc;};'use strict';var client=require(_0xbbd3('0x0'));exports[_0xbbd3('0x1')]=function(_0x41cb28){return function(_0x56e668){return client[_0xbbd3('0x2')](_0xbbd3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbbd3('0x4'),_0xbbd3('0x5'),'defaultuser']},'log':_0xbbd3('0x3')});};}; \ No newline at end of file +var _0xb734=['getTrunks','Request','GetTrunk','../client'];(function(_0x121ee7,_0x344b91){var _0x147a9e=function(_0x4f052c){while(--_0x4f052c){_0x121ee7['push'](_0x121ee7['shift']());}};_0x147a9e(++_0x344b91);}(_0xb734,0xe3));var _0x4b73=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0xb734[_0x2be104];return _0x31c115;};'use strict';var client=require(_0x4b73('0x0'));exports[_0x4b73('0x1')]=function(_0x3c586e){return function(_0x19d14b){return client[_0x4b73('0x2')](_0x4b73('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry','defaultuser']},'log':_0x4b73('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4972710..8f4f39d 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe706,0xa3));var _0x6e70=function(_0x3c9c05,_0x31f740){_0x3c9c05=_0x3c9c05-0x0;var _0x2f1d51=_0xe706[_0x3c9c05];return _0x2f1d51;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x9e26ff,_0x84ca10){var _0x3087bb=function(_0x1c4908){while(--_0x1c4908){_0x9e26ff['push'](_0x9e26ff['shift']());}};_0x3087bb(++_0x84ca10);}(_0xedd9,0xfc));var _0x9edd=function(_0x697f53,_0x3e55bd){_0x697f53=_0x697f53-0x0;var _0x3465cf=_0xedd9[_0x697f53];return _0x3465cf;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 229c6ec..00028cd 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 _0x48c8=['update','../client','create','Request','CreateVoiceAgentReport'];(function(_0x18fcc3,_0x540e38){var _0x146bcd=function(_0x2cbd8e){while(--_0x2cbd8e){_0x18fcc3['push'](_0x18fcc3['shift']());}};_0x146bcd(++_0x540e38);}(_0x48c8,0x8d));var _0x848c=function(_0x41cc3f,_0x2678a2){_0x41cc3f=_0x41cc3f-0x0;var _0x47ff58=_0x48c8[_0x41cc3f];return _0x47ff58;};'use strict';var client=require(_0x848c('0x0'));exports[_0x848c('0x1')]=function(_0x669dfa){return client[_0x848c('0x2')](_0x848c('0x3'),{'body':_0x669dfa,'log':_0x848c('0x3')});};exports[_0x848c('0x4')]=function(_0x5bade6,_0x3a4a86,_0x9b177a){return client[_0x848c('0x2')]('UpdateVoiceAgentReport',{'body':_0x5bade6,'options':{'where':{'uniqueid':_0x3a4a86,'interface':_0x9b177a,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xcc9b=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xcc9b,0x138));var _0xbcc9=function(_0x3e0272,_0x205c23){_0x3e0272=_0x3e0272-0x0;var _0x536b19=_0xcc9b[_0x3e0272];return _0x536b19;};'use strict';var client=require(_0xbcc9('0x0'));exports[_0xbcc9('0x1')]=function(_0x38da8b){return client['Request'](_0xbcc9('0x2'),{'body':_0x38da8b,'log':_0xbcc9('0x2')});};exports[_0xbcc9('0x3')]=function(_0x59eebf,_0x586f5c,_0x17cd0a){return client[_0xbcc9('0x4')](_0xbcc9('0x5'),{'body':_0x59eebf,'options':{'where':{'uniqueid':_0x586f5c,'interface':_0x17cd0a,'agentcomplete':!![]}},'log':_0xbcc9('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 81c2a35..5daab2a 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 _0x8100=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','callerid'];(function(_0x35efa1,_0x4c89fe){var _0x2479d8=function(_0x122f88){while(--_0x122f88){_0x35efa1['push'](_0x35efa1['shift']());}};_0x2479d8(++_0x4c89fe);}(_0x8100,0x161));var _0x0810=function(_0x10de0c,_0x2c985c){_0x10de0c=_0x10de0c-0x0;var _0x23b3be=_0x8100[_0x10de0c];return _0x23b3be;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x0810('0x0'));var client=require(_0x0810('0x1'));exports[_0x0810('0x2')]=function(_0x22b37c){return client[_0x0810('0x3')](_0x0810('0x4'),{'body':_['merge'](_0x22b37c,{'source':_0x22b37c[_0x0810('0x5')],'destinationcontext':_0x22b37c['context'],'callerid':_0x22b37c[_0x0810('0x6')],'amaflags':_0x0810('0x7')}),'log':_0x0810('0x4')});};exports[_0x0810('0x8')]=function(){return function(){return client[_0x0810('0x3')](_0x0810('0x9'),{'options':{'where':{'type':[_0x0810('0xa')],'createdAt':{'$between':[moment()['startOf']('day')['format'](_0x0810('0xb')),moment()[_0x0810('0xc')]('day')[_0x0810('0xd')](_0x0810('0xb'))]}},'attributes':['type',_0x0810('0xe'),_0x0810('0xf'),_0x0810('0x10')]},'log':_0x0810('0x11')});};}; \ No newline at end of file +var _0x89c9=['disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x89c9,0x163));var _0x989c=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x89c9[_0x3e0191];return _0xf2ae83;};'use strict';var moment=require('moment');var util=require(_0x989c('0x0'));var _=require(_0x989c('0x1'));var client=require(_0x989c('0x2'));exports[_0x989c('0x3')]=function(_0x4ab78f){return client[_0x989c('0x4')](_0x989c('0x5'),{'body':_[_0x989c('0x6')](_0x4ab78f,{'source':_0x4ab78f[_0x989c('0x7')],'destinationcontext':_0x4ab78f[_0x989c('0x8')],'callerid':_0x4ab78f[_0x989c('0x9')],'amaflags':_0x989c('0xa')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x989c('0x4')](_0x989c('0xb'),{'options':{'where':{'type':[_0x989c('0xc')],'createdAt':{'$between':[moment()[_0x989c('0xd')](_0x989c('0xe'))['format'](_0x989c('0xf')),moment()[_0x989c('0x10')]('day')[_0x989c('0x11')](_0x989c('0xf'))]}},'attributes':[_0x989c('0x12'),_0x989c('0x13'),_0x989c('0x14'),'billableseconds']},'log':_0x989c('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9668d8e..f6c4494 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 _0xee51=['../client','create','Request','CreateVoiceDialReport'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xee51,0x7c));var _0x1ee5=function(_0x35620b,_0xb74597){_0x35620b=_0x35620b-0x0;var _0x5d51c3=_0xee51[_0x35620b];return _0x5d51c3;};'use strict';var client=require(_0x1ee5('0x0'));exports[_0x1ee5('0x1')]=function(_0x2b2bd3){return client[_0x1ee5('0x2')](_0x1ee5('0x3'),{'body':_0x2b2bd3,'log':_0x1ee5('0x3')});}; \ No newline at end of file +var _0x2a71=['CreateVoiceDialReport','../client','Request'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x2a71,0x13c));var _0x12a7=function(_0x3d9167,_0x2439d3){_0x3d9167=_0x3d9167-0x0;var _0x3c85be=_0x2a71[_0x3d9167];return _0x3c85be;};'use strict';var client=require(_0x12a7('0x0'));exports['create']=function(_0x4b76f8){return client[_0x12a7('0x1')]('CreateVoiceDialReport',{'body':_0x4b76f8,'log':_0x12a7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7645d2c..d9d3c24 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 _0xffe1=['recordingFormat','../client','getVoiceExtensions','exten'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xffe1,0x175));var _0x1ffe=function(_0x4f2bc0,_0x1a63dc){_0x4f2bc0=_0x4f2bc0-0x0;var _0x1c7559=_0xffe1[_0x4f2bc0];return _0x1c7559;};'use strict';var client=require(_0x1ffe('0x0'));exports[_0x1ffe('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x1ffe('0x2'),_0x1ffe('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1ffe('0x1')});};}; \ No newline at end of file +var _0x55e0=['../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x319a6a,_0x295f55){var _0x2ba9f4=function(_0x1c0f2e){while(--_0x1c0f2e){_0x319a6a['push'](_0x319a6a['shift']());}};_0x2ba9f4(++_0x295f55);}(_0x55e0,0xdc));var _0x055e=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0x55e0[_0x18d8e9];return _0x1b9102;};'use strict';var client=require(_0x055e('0x0'));exports[_0x055e('0x1')]=function(){return function(){return client[_0x055e('0x2')](_0x055e('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x055e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d0afece..2bd9ea8 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 _0x5ad4=['monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x17c8c1,_0x116a69){var _0x5b44c1=function(_0x383fc9){while(--_0x383fc9){_0x17c8c1['push'](_0x17c8c1['shift']());}};_0x5b44c1(++_0x116a69);}(_0x5ad4,0x172));var _0x45ad=function(_0x30880c,_0x19d23d){_0x30880c=_0x30880c-0x0;var _0x2cb84b=_0x5ad4[_0x30880c];return _0x2cb84b;};'use strict';var client=require(_0x45ad('0x0'));exports[_0x45ad('0x1')]=function(){return function(){return client[_0x45ad('0x2')](_0x45ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x45ad('0x4'),_0x45ad('0x5'),_0x45ad('0x6'),_0x45ad('0x7'),_0x45ad('0x8'),_0x45ad('0x9'),_0x45ad('0xa'),_0x45ad('0xb'),_0x45ad('0xc'),_0x45ad('0xd'),_0x45ad('0xe'),_0x45ad('0xf'),_0x45ad('0x10'),_0x45ad('0x11'),_0x45ad('0x12'),_0x45ad('0x13'),_0x45ad('0x14'),_0x45ad('0x15'),_0x45ad('0x16'),_0x45ad('0x17'),'dialCongestionMaxRetry',_0x45ad('0x18'),'dialBusyMaxRetry',_0x45ad('0x19'),_0x45ad('0x1a'),_0x45ad('0x1b'),_0x45ad('0x1c'),'dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType',_0x45ad('0x1d'),_0x45ad('0x1e'),'dialAMDGreeting',_0x45ad('0x1f'),_0x45ad('0x20'),_0x45ad('0x21'),_0x45ad('0x22'),_0x45ad('0x23'),_0x45ad('0x24'),_0x45ad('0x25'),_0x45ad('0x26'),_0x45ad('0x27'),'dialRecallInQueue','dialOrderByScheduledAt',_0x45ad('0x28'),_0x45ad('0x29'),_0x45ad('0x2a'),'monitor_format',_0x45ad('0x2b'),_0x45ad('0x2c'),_0x45ad('0x2d'),_0x45ad('0x2e'),'dialNoSuchNumberRetryFrequency',_0x45ad('0x2f'),_0x45ad('0x30'),_0x45ad('0x31'),'dialAbandonedRetryFrequency',_0x45ad('0x32'),_0x45ad('0x33'),_0x45ad('0x34'),_0x45ad('0x35'),'mandatoryDisposition',_0x45ad('0x36'),_0x45ad('0x37'),_0x45ad('0x38'),_0x45ad('0x39'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x45ad('0x3a'),'as':_0x45ad('0x3a'),'attributes':['id',_0x45ad('0x4'),_0x45ad('0x3b'),_0x45ad('0x3c')]},{'model':'Pause','as':_0x45ad('0x3d'),'attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name','callerid',_0x45ad('0x3c')]},{'model':_0x45ad('0x3e'),'as':_0x45ad('0x3e'),'attributes':['id',_0x45ad('0x4')],'include':[{'model':_0x45ad('0x3e'),'as':'Intervals','attributes':['id','name','interval']}]}]},'log':_0x45ad('0x1')});};}; \ No newline at end of file +var _0x864b=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','name','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x864b,0x179));var _0xb864=function(_0xe3803e,_0x37e9ce){_0xe3803e=_0xe3803e-0x0;var _0x312c82=_0x864b[_0xe3803e];return _0x312c82;};'use strict';var client=require(_0xb864('0x0'));exports[_0xb864('0x1')]=function(){return function(){return client['Request'](_0xb864('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xb864('0x3'),_0xb864('0x4'),_0xb864('0x5'),_0xb864('0x6'),_0xb864('0x7'),_0xb864('0x8'),_0xb864('0x9'),'dialLimitChannel',_0xb864('0xa'),_0xb864('0xb'),_0xb864('0xc'),'dialPredictiveOptimizationPercentage',_0xb864('0xd'),_0xb864('0xe'),_0xb864('0xf'),_0xb864('0x10'),_0xb864('0x11'),_0xb864('0x12'),_0xb864('0x13'),_0xb864('0x14'),'dialCongestionRetryFrequency',_0xb864('0x15'),_0xb864('0x16'),_0xb864('0x17'),'dialNoAnswerRetryFrequency',_0xb864('0x18'),_0xb864('0x19'),_0xb864('0x1a'),_0xb864('0x1b'),_0xb864('0x1c'),_0xb864('0x1d'),_0xb864('0x1e'),'dialAMDGreeting',_0xb864('0x1f'),_0xb864('0x20'),_0xb864('0x21'),_0xb864('0x22'),'dialAMDMaximumNumberOfWords',_0xb864('0x23'),_0xb864('0x24'),_0xb864('0x25'),_0xb864('0x26'),'dialRecallInQueue',_0xb864('0x27'),_0xb864('0x28'),_0xb864('0x29'),'dialQueueProject2',_0xb864('0x6'),_0xb864('0x2a'),_0xb864('0x2b'),_0xb864('0x2c'),'dialNoSuchNumberMaxRetry',_0xb864('0x2d'),_0xb864('0x2e'),_0xb864('0x2f'),_0xb864('0x30'),_0xb864('0x31'),_0xb864('0x32'),_0xb864('0x33'),_0xb864('0x34'),'dialAgentRejectRetryFrequency',_0xb864('0x35'),'dialPredictiveIntervalMaxThreshold',_0xb864('0x36'),'dialPreviewAutoRecallMe',_0xb864('0x37'),_0xb864('0x38')],'include':[{'model':_0xb864('0x39'),'as':'Trunk','attributes':['id','name',_0xb864('0x3a'),_0xb864('0x3b')]},{'model':_0xb864('0x3c'),'as':_0xb864('0x3d'),'attributes':['id','name']},{'model':_0xb864('0x39'),'as':_0xb864('0x3e'),'attributes':['id',_0xb864('0x3f'),_0xb864('0x3a'),_0xb864('0x3b')]},{'model':_0xb864('0x40'),'as':_0xb864('0x40'),'attributes':['id',_0xb864('0x3f')],'include':[{'model':_0xb864('0x40'),'as':_0xb864('0x41'),'attributes':['id',_0xb864('0x3f'),_0xb864('0x42')]}]}]},'log':_0xb864('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index db2df6f..a07402f 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(_0x4a9a4c,_0x5d4b1a){var _0x3f214d=function(_0x1eb73a){while(--_0x1eb73a){_0x4a9a4c['push'](_0x4a9a4c['shift']());}};_0x3f214d(++_0x5d4b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x1ce92b,_0x12fe42){var _0x3ff61a=function(_0xb5acf7){while(--_0xb5acf7){_0x1ce92b['push'](_0x1ce92b['shift']());}};_0x3ff61a(++_0x12fe42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 dfbd24c..c097da9 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 _0x7d9d=['GetVoiceQueueRtPauses','Request'];(function(_0xac93fa,_0x3f3c00){var _0x4a1cbc=function(_0x18218e){while(--_0x18218e){_0xac93fa['push'](_0xac93fa['shift']());}};_0x4a1cbc(++_0x3f3c00);}(_0x7d9d,0x81));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x2f5225){return function(){return client[_0xd7d9('0x0')](_0xd7d9('0x1'),{'options':{'where':{'VoiceQueueId':_0x2f5225,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xa1af=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x498d86,_0x5245de){var _0x4f2fcb=function(_0x1ed83a){while(--_0x1ed83a){_0x498d86['push'](_0x498d86['shift']());}};_0x4f2fcb(++_0x5245de);}(_0xa1af,0xf5));var _0xfa1a=function(_0x508b33,_0x1766fc){_0x508b33=_0x508b33-0x0;var _0x5aa426=_0xa1af[_0x508b33];return _0x5aa426;};'use strict';var client=require('../client');exports[_0xfa1a('0x0')]=function(_0x4a181e){return function(){return client['Request'](_0xfa1a('0x1'),{'options':{'where':{'VoiceQueueId':_0x4a181e,'paused':!![]},'raw':!![]},'log':_0xfa1a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ba84f20..fc605a6 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(_0x2d5b8e,_0x407ca4){var _0x3db561=function(_0x3af285){while(--_0x3af285){_0x2d5b8e['push'](_0x2d5b8e['shift']());}};_0x3db561(++_0x407ca4);}(_0x7a54,0x106));var _0x47a5=function(_0x21b5bf,_0x425f1d){_0x21b5bf=_0x21b5bf-0x0;var _0x21dfc2=_0x7a54[_0x21b5bf];return _0x21dfc2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4793cf,_0x489514){var _0x2aed09=function(_0x225b66){while(--_0x225b66){_0x4793cf['push'](_0x4793cf['shift']());}};_0x2aed09(++_0x489514);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 64dc638..9aeac17 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 _0x3bb7=['attendedTransfer','result','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','blind','CreateVoiceTransferReport'];(function(_0x2e7d64,_0x834768){var _0x47406b=function(_0x158de2){while(--_0x158de2){_0x2e7d64['push'](_0x2e7d64['shift']());}};_0x47406b(++_0x834768);}(_0x3bb7,0xbb));var _0x73bb=function(_0xeefaee,_0x4c8038){_0xeefaee=_0xeefaee-0x0;var _0x225a0e=_0x3bb7[_0xeefaee];return _0x225a0e;};'use strict';var client=require(_0x73bb('0x0'));exports[_0x73bb('0x1')]={};exports['blindTransfer']=function(_0x28cd97){return client[_0x73bb('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x28cd97['result'],'transfererchannel':_0x28cd97['transfererchannel'],'transferercalleridnum':_0x28cd97[_0x73bb('0x3')],'transferercalleridname':_0x28cd97[_0x73bb('0x4')],'transfererconnectedlinenum':_0x28cd97[_0x73bb('0x5')],'transfererconnectedlinename':_0x28cd97[_0x73bb('0x6')],'transfereraccountcode':_0x28cd97[_0x73bb('0x7')],'transferercontext':_0x28cd97['transferercontext'],'transfererexten':_0x28cd97['transfererexten'],'transfererlinkedid':_0x28cd97[_0x73bb('0x8')],'transfereechannel':_0x28cd97['transfereechannel'],'transfereecalleridnum':_0x28cd97[_0x73bb('0x9')],'transfereecalleridname':_0x28cd97['transfereecalleridname'],'transfereeconnectedlinenum':_0x28cd97[_0x73bb('0xa')],'transfereeconnectedlinename':_0x28cd97['transfereeconnectedlinename'],'transfereeaccountcode':_0x28cd97[_0x73bb('0xb')],'transfereecontext':_0x28cd97['transfereecontext'],'transfereeexten':_0x28cd97[_0x73bb('0xc')],'transfereelinkedid':_0x28cd97[_0x73bb('0xd')],'isexternal':_0x28cd97['isexternal'],'context':_0x28cd97['context'],'extension':_0x28cd97[_0x73bb('0xe')],'type':_0x73bb('0xf')},'log':_0x73bb('0x10')});};exports[_0x73bb('0x11')]=function(_0x38bee6){return client[_0x73bb('0x2')](_0x73bb('0x10'),{'body':{'result':_0x38bee6[_0x73bb('0x12')],'transfererchannel':_0x38bee6['origtransfererchannel'],'transferercalleridnum':_0x38bee6[_0x73bb('0x13')],'transferercalleridname':_0x38bee6['origtransferercalleridname'],'transfererconnectedlinenum':_0x38bee6[_0x73bb('0x14')],'transfererconnectedlinename':_0x38bee6['secondtransfererconnectedlinename'],'transfereraccountcode':_0x38bee6[_0x73bb('0x15')],'transferercontext':_0x38bee6[_0x73bb('0x16')],'transfererexten':_0x38bee6[_0x73bb('0x17')],'transfererlinkedid':_0x38bee6[_0x73bb('0x18')],'transfereechannel':_0x38bee6[_0x73bb('0x19')],'transfereecalleridnum':_0x38bee6[_0x73bb('0x1a')],'transfereecalleridname':_0x38bee6[_0x73bb('0x1b')],'transfereeconnectedlinenum':_0x38bee6['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x38bee6[_0x73bb('0x1c')],'transfereeaccountcode':_0x38bee6[_0x73bb('0x1d')],'transfereecontext':_0x38bee6[_0x73bb('0x1e')],'transfereeexten':_0x38bee6[_0x73bb('0x1f')],'transfereelinkedid':_0x38bee6['transfertargetlinkedid'],'isexternal':_0x38bee6['isexternal'],'context':_0x38bee6[_0x73bb('0x20')],'extension':_0x38bee6[_0x73bb('0x21')],'type':'attended'},'log':_0x73bb('0x10')});}; \ No newline at end of file +var _0x30c3=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname'];(function(_0xc47611,_0x1d130d){var _0x4819f8=function(_0x2f64fb){while(--_0x2f64fb){_0xc47611['push'](_0xc47611['shift']());}};_0x4819f8(++_0x1d130d);}(_0x30c3,0x1e2));var _0x330c=function(_0x593683,_0x2b3213){_0x593683=_0x593683-0x0;var _0x44cc39=_0x30c3[_0x593683];return _0x44cc39;};'use strict';var client=require(_0x330c('0x0'));exports[_0x330c('0x1')]={};exports[_0x330c('0x2')]=function(_0x1e5107){return client[_0x330c('0x3')](_0x330c('0x4'),{'body':{'result':_0x1e5107[_0x330c('0x5')],'transfererchannel':_0x1e5107['transfererchannel'],'transferercalleridnum':_0x1e5107[_0x330c('0x6')],'transferercalleridname':_0x1e5107[_0x330c('0x7')],'transfererconnectedlinenum':_0x1e5107[_0x330c('0x8')],'transfererconnectedlinename':_0x1e5107[_0x330c('0x9')],'transfereraccountcode':_0x1e5107[_0x330c('0xa')],'transferercontext':_0x1e5107[_0x330c('0xb')],'transfererexten':_0x1e5107[_0x330c('0xc')],'transfererlinkedid':_0x1e5107[_0x330c('0xd')],'transfereechannel':_0x1e5107['transfereechannel'],'transfereecalleridnum':_0x1e5107[_0x330c('0xe')],'transfereecalleridname':_0x1e5107[_0x330c('0xf')],'transfereeconnectedlinenum':_0x1e5107['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1e5107['transfereeconnectedlinename'],'transfereeaccountcode':_0x1e5107[_0x330c('0x10')],'transfereecontext':_0x1e5107[_0x330c('0x11')],'transfereeexten':_0x1e5107['transfereeexten'],'transfereelinkedid':_0x1e5107[_0x330c('0x12')],'isexternal':_0x1e5107[_0x330c('0x13')],'context':_0x1e5107[_0x330c('0x14')],'extension':_0x1e5107['extension'],'type':_0x330c('0x15')},'log':_0x330c('0x4')});};exports[_0x330c('0x16')]=function(_0x2bed67){return client[_0x330c('0x3')](_0x330c('0x4'),{'body':{'result':_0x2bed67[_0x330c('0x5')],'transfererchannel':_0x2bed67['origtransfererchannel'],'transferercalleridnum':_0x2bed67[_0x330c('0x17')],'transferercalleridname':_0x2bed67['origtransferercalleridname'],'transfererconnectedlinenum':_0x2bed67[_0x330c('0x18')],'transfererconnectedlinename':_0x2bed67['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2bed67[_0x330c('0x19')],'transferercontext':_0x2bed67[_0x330c('0x1a')],'transfererexten':_0x2bed67['secondtransfererexten'],'transfererlinkedid':_0x2bed67[_0x330c('0x1b')],'transfereechannel':_0x2bed67[_0x330c('0x1c')],'transfereecalleridnum':_0x2bed67[_0x330c('0x1d')],'transfereecalleridname':_0x2bed67['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2bed67[_0x330c('0x1e')],'transfereeconnectedlinename':_0x2bed67[_0x330c('0x1f')],'transfereeaccountcode':_0x2bed67['transfertargetaccountcode'],'transfereecontext':_0x2bed67[_0x330c('0x20')],'transfereeexten':_0x2bed67['transfertargetexten'],'transfereelinkedid':_0x2bed67[_0x330c('0x21')],'isexternal':_0x2bed67['isexternal'],'context':_0x2bed67['origtransferercontext'],'extension':_0x2bed67['origtransfererexten'],'type':_0x330c('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c95f01e..44e6dfa 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 _0x6931=['isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','channels','channel','StopMixMonitor','destinationchannel','stop','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','campaigns','event','Event\x20name\x20mandatory','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','keys','Action','message','catch','error','join','command','action','Command','then','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','voicechannel','map','uniqueid','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/'];(function(_0x1d2300,_0x471d76){var _0x2015a1=function(_0x3afe96){while(--_0x3afe96){_0x1d2300['push'](_0x1d2300['shift']());}};_0x2015a1(++_0x471d76);}(_0x6931,0x1a9));var _0x1693=function(_0x13b56c,_0x4b6f7a){_0x13b56c=_0x13b56c-0x0;var _0x3b9a8c=_0x6931[_0x13b56c];return _0x3b9a8c;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var jayson=require(_0x1693('0x2'));var schema=require(_0x1693('0x3'));var BPromise=require(_0x1693('0x4'));var moment=require(_0x1693('0x5'));var config=require(_0x1693('0x6'));var properties=require(_0x1693('0x7'));var ami=require('../ami');exports[_0x1693('0x8')]=function(_0x2ca960,_0x378fa6,_0x455646){return new BPromise(function(_0x379d6c,_0x5de567){var _0x3ab149={'QueuePause':function(_0x2ec499){return new Promise(function(_0x18e32e,_0x579434){var _0xc66466=util[_0x1693('0x9')](_0x1693('0xa'),_0x1693('0xb'),_0x2ec499[_0x1693('0xc')]);if(_0x2ca960[_0x1693('0xd')]&&_0x2ca960[_0x1693('0xd')][_0xc66466]&&_0x2ca960[_0x1693('0xd')][_0xc66466][_0x1693('0xe')]){_0x2ca960[_0x1693('0xd')][_0xc66466][_0x1693('0xf')]();}if(_0x2ca960['agents'][_0xc66466]){_0x2ca960[_0x1693('0x10')][_0xc66466][_0x1693('0x11')]({'statePause':_0x2ec499[_0x1693('0x12')]?!![]:![]});}_0x18e32e({'code':0xc8,'message':_0x1693('0x13')});});},'Reload':function(_0x10122d){var _0x50e17b=this;return new Promise(function(_0x4744ed,_0x5cede5){if(ami[_0x1693('0x14')]()==![]){return _0x5cede5(_0x50e17b['error'](0x1f4,[config[_0x1693('0x15')]['ip'],config['asterisk'][_0x1693('0x16')],_0x1693('0x17')]['join']('\x20')));}_0x10122d=_['pick'](_0x10122d,_[_0x1693('0x18')](properties['module']));_0x10122d['action']='Reload';return ami[_0x1693('0x19')](_0x10122d)['then'](function(_0x49e7fb){_0x4744ed({'code':0xc8,'message':_0x49e7fb[_0x1693('0x1a')]});})[_0x1693('0x1b')](function(_0x7ef2){_0x5cede5(_0x50e17b[_0x1693('0x1c')](0x1f5,_0x7ef2[_0x1693('0x1a')]));});});},'Command':function(_0x7a19ae){var _0x4c3977=this;return new Promise(function(_0x5c4159,_0x266bb6){if(ami[_0x1693('0x14')]()==![]){return _0x266bb6(_0x4c3977['error'](0x1f4,[config[_0x1693('0x15')]['ip'],config[_0x1693('0x15')][_0x1693('0x16')],_0x1693('0x17')][_0x1693('0x1d')]('\x20')));}_0x7a19ae=_['pick'](_0x7a19ae,_0x1693('0x1e'));_0x7a19ae[_0x1693('0x1f')]=_0x1693('0x20');return ami[_0x1693('0x19')](_0x7a19ae)[_0x1693('0x21')](function(_0x2fa64c){_0x5c4159({'code':0xc8,'message':_0x2fa64c['content']});})[_0x1693('0x1b')](function(_0x5a5165){_0x266bb6(_0x4c3977[_0x1693('0x1c')](0x1f5,_0x5a5165[_0x1693('0x1a')]));});});},'VoiceQueues':function(_0x31ef48){return new Promise(function(_0x56bc00,_0x108ba9){var _0x341a72=[];for(var _0x43cfb6 in _0x2ca960[_0x1693('0x22')]){if(_0x2ca960[_0x1693('0x22')][_0x1693('0x23')](_0x43cfb6)){var _0x404bf1=_0x2ca960['voiceQueues'][_0x43cfb6];var _0x2d0806={'id':_0x404bf1['id'],'name':_0x404bf1['name'],'strategy':_0x404bf1[_0x1693('0x24')],'answered':_0x404bf1['answered'],'available':_0x404bf1[_0x1693('0x25')],'loggedIn':_0x404bf1[_0x1693('0x26')],'pTalking':_0x404bf1[_0x1693('0x27')],'sumBillable':_0x404bf1[_0x1693('0x28')],'sumDuration':_0x404bf1['sumDuration'],'sumHoldTime':_0x404bf1[_0x1693('0x29')]||0x0,'talking':_0x404bf1[_0x1693('0x2a')],'total':_0x404bf1['total'],'type':_0x404bf1['type'],'unmanaged':_0x404bf1[_0x1693('0x2b')],'abandoned':_0x404bf1['abandoned'],'waiting':_0x404bf1['waiting'],'loggedInDb':_0x404bf1['loggedInDb']};if(_0x404bf1[_0x1693('0x2c')]===_0x1693('0x2d')){_0x2d0806['dialActive']=_0x404bf1[_0x1693('0x2e')];_0x2d0806['dialMethod']=_0x404bf1[_0x1693('0x2f')];_0x2d0806['dialOriginateCallerIdName']=_0x404bf1[_0x1693('0x30')];_0x2d0806[_0x1693('0x31')]=_0x404bf1[_0x1693('0x31')];_0x2d0806['dialOriginateTimeout']=_0x404bf1[_0x1693('0x32')];_0x2d0806[_0x1693('0x33')]=_0x404bf1[_0x1693('0x33')];_0x2d0806[_0x1693('0x34')]=_0x404bf1[_0x1693('0x34')];_0x2d0806[_0x1693('0x35')]=_0x404bf1[_0x1693('0x35')];_0x2d0806[_0x1693('0x36')]=_0x404bf1[_0x1693('0x36')];_0x2d0806[_0x1693('0x37')]=_0x404bf1[_0x1693('0x37')];_0x2d0806[_0x1693('0x38')]=_0x404bf1['outboundBusyCallsDay'];_0x2d0806[_0x1693('0x39')]=_0x404bf1['outboundCongestionCallsDay'];_0x2d0806[_0x1693('0x3a')]=_0x404bf1[_0x1693('0x3a')];_0x2d0806[_0x1693('0x3b')]=_0x404bf1[_0x1693('0x3b')];_0x2d0806[_0x1693('0x3c')]=_0x404bf1[_0x1693('0x3c')];_0x2d0806[_0x1693('0x3d')]=_0x404bf1[_0x1693('0x3d')];_0x2d0806[_0x1693('0x3e')]=_0x404bf1['outboundNoSuchCallsDay'];_0x2d0806[_0x1693('0x3f')]=_0x404bf1[_0x1693('0x3f')];_0x2d0806[_0x1693('0x40')]=_0x404bf1[_0x1693('0x40')];_0x2d0806[_0x1693('0x41')]=_0x404bf1[_0x1693('0x41')];_0x2d0806[_0x1693('0x42')]=_0x404bf1[_0x1693('0x42')];_0x2d0806[_0x1693('0x43')]=_0x404bf1[_0x1693('0x43')];_0x2d0806['predictiveIntervalAvgHoldtime']=_0x404bf1['predictiveIntervalAvgHoldtime'];_0x2d0806['predictiveIntervalAvgTalktime']=_0x404bf1[_0x1693('0x44')];_0x2d0806[_0x1693('0x45')]=_0x404bf1[_0x1693('0x45')];_0x2d0806[_0x1693('0x46')]=_0x404bf1[_0x1693('0x46')];_0x2d0806[_0x1693('0x47')]=_0x404bf1[_0x1693('0x47')];_0x2d0806[_0x1693('0x48')]=_0x404bf1[_0x1693('0x48')];_0x2d0806[_0x1693('0x49')]=_0x404bf1[_0x1693('0x49')];_0x2d0806[_0x1693('0x4a')]=_0x404bf1['predictiveIntervalMultiplicativeFactor'];_0x2d0806[_0x1693('0x4b')]=_0x404bf1[_0x1693('0x4b')];_0x2d0806[_0x1693('0x4c')]=_0x404bf1[_0x1693('0x4c')];_0x2d0806[_0x1693('0x4d')]=_0x404bf1[_0x1693('0x4d')];_0x2d0806['message']=_0x404bf1[_0x1693('0x1a')];_0x2d0806['originated']=_0x404bf1['originated'];_0x2d0806['erlangCalls']=_0x404bf1['erlangCalls'];_0x2d0806['erlangCallToSecond']=_0x404bf1[_0x1693('0x4e')];_0x2d0806[_0x1693('0x4f')]=_0x404bf1[_0x1693('0x4f')];_0x2d0806['erlangBusyFactor']=_0x404bf1['erlangBusyFactor'];_0x2d0806['startPredictive']=_0x404bf1[_0x1693('0x50')];_0x2d0806[_0x1693('0x51')]=_0x404bf1[_0x1693('0x51')];}if(_0x404bf1['Trunk']){_0x2d0806[_0x1693('0x52')]={'id':_0x404bf1[_0x1693('0x52')]['id'],'name':_0x404bf1['Trunk'][_0x1693('0xc')],'active':_0x404bf1['Trunk'][_0x1693('0x53')],'callerid':_0x404bf1[_0x1693('0x52')][_0x1693('0x54')]};}if(_0x404bf1['Interval']){_0x2d0806[_0x1693('0x55')]={'id':_0x404bf1['Interval']['id'],'name':_0x404bf1[_0x1693('0x55')][_0x1693('0xc')]};}_0x341a72[_0x1693('0x56')](_0x2d0806);}}_0x56bc00({'count':_0x341a72[_0x1693('0x57')],'rows':_0x341a72});});},'UpdateVoiceQueue':function(_0x357d62){return new Promise(function(_0x55f9be,_0x5c6737){var _0x54519b=_[_0x1693('0x58')](_0x2ca960[_0x1693('0x22')],{'id':parseInt(_0x357d62['id'])});var _0x2e865c=_[_0x1693('0x59')](_0x357d62,['id']);if(_0x54519b){for(var _0x250d80 in _0x2e865c){if(typeof _0x2e865c[_0x250d80]!=='undefined'&&typeof _0x54519b[_0x250d80]!==_0x1693('0x5a')){_0x54519b[_0x250d80]=_0x2e865c[_0x250d80];}}_0x55f9be(_0x54519b);}else{_0x5c6737();}});},'VoiceChannels':function(_0x30838c){return new Promise(function(_0x4614e1,_0x5a7791){var _0x1e55a5=_['values'](_0x2ca960['channels']);_0x4614e1({'count':_0x1e55a5[_0x1693('0x57')],'rows':_0x1e55a5});});},'VoiceChannelMixMonitor':function(_0x3c7bc6){var _0x11076a=this;return new Promise(function(_0xfa85eb,_0x4743d0){if(ami['isConnected']()==![]){return _0x4743d0(_0x11076a['error'](0x1f4,[config[_0x1693('0x15')]['ip'],config[_0x1693('0x15')]['username'],_0x1693('0x17')][_0x1693('0x1d')]('\x20')));}var _0x5206e7=schema(properties[_0x1693('0x5b')])[_0x1693('0x3')](_0x3c7bc6);if(_0x5206e7[_0x1693('0x57')]>0x0){return _0x4743d0(_0x11076a[_0x1693('0x1c')](0x1f4,_[_0x1693('0x5c')](_0x5206e7,'message')[_0x1693('0x1d')](',\x20')));}var _0x56cb03=_['find'](_0x2ca960['channels'],{'uniqueid':_0x3c7bc6[_0x1693('0x5d')]});if(_0x56cb03&&_0x56cb03['channel']){var _0x4d7f9c=util[_0x1693('0x9')](_0x1693('0x5e'),_0x3c7bc6[_0x1693('0x5f')]||_0x3c7bc6[_0x1693('0x5d')],_0x3c7bc6[_0x1693('0x9')]||_0x1693('0x60'));return ami[_0x1693('0x19')]({'action':'MixMonitor','channel':_0x56cb03['channel'],'file':_0x4d7f9c,'options':'ai(mixmonitorid)'})[_0x1693('0x21')](function(_0x1a9303){var _0x29a1fe=_['find'](_0x56cb03[_0x1693('0x61')],{'filename':_0x1693('0x62')+_0x4d7f9c['toLowerCase']()});if(_[_0x1693('0x63')](_0x29a1fe)){_0x56cb03[_0x1693('0x61')][_0x1693('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x4d7f9c[_0x1693('0x64')](),'createdAt':moment()[_0x1693('0x9')](_0x1693('0x65')),'mixmonitorid':_0x1a9303[_0x1693('0x66')],'status':_0x1693('0x67')});}else{_0x29a1fe[_0x1693('0x66')]=_0x1a9303[_0x1693('0x66')];_0x29a1fe[_0x1693('0x68')]=_0x1693('0x67');}_0xfa85eb({'code':0xc8,'message':[_0x3c7bc6[_0x1693('0x5d')],'MixMonitor\x20Success',_0x1a9303[_0x1693('0x66')]][_0x1693('0x1d')]('\x20'),'mixmonitorid':_0x1a9303[_0x1693('0x66')]});})[_0x1693('0x1b')](function(_0x45a1d2){_0x4743d0(_0x11076a['error'](0x1f5,[_0x3c7bc6[_0x1693('0x5d')],_0x45a1d2['message']['toLowerCase']()][_0x1693('0x1d')]('\x20')));});}else{return _0x4743d0(_0x11076a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4fe87e){var _0x463ba1=this;return new Promise(function(_0x986f14,_0x298fd2){if(ami['isConnected']()==![]){return _0x298fd2(_0x463ba1[_0x1693('0x1c')](0x1f4,[config[_0x1693('0x15')]['ip'],config[_0x1693('0x15')][_0x1693('0x16')],_0x1693('0x17')][_0x1693('0x1d')]('\x20')));}var _0x58e30d=schema(properties[_0x1693('0x5b')])[_0x1693('0x3')](_0x4fe87e);if(_0x58e30d[_0x1693('0x57')]>0x0){return _0x298fd2(_0x463ba1[_0x1693('0x1c')](0x1f4,_[_0x1693('0x5c')](_0x58e30d,'message')['join'](',\x20')));}var _0x52e4c2=_['find'](_0x2ca960[_0x1693('0x69')],{'uniqueid':_0x4fe87e[_0x1693('0x5d')]});if(_0x52e4c2){return BPromise['resolve']()[_0x1693('0x21')](function(){if(_0x52e4c2[_0x1693('0x6a')]){return ami[_0x1693('0x19')]({'action':_0x1693('0x6b'),'channel':_0x52e4c2[_0x1693('0x6a')],'mixmonitorid':_0x4fe87e[_0x1693('0x66')]})['catch'](function(_0x36fd60){});}})['then'](function(){if(_0x52e4c2['destinationchannel']){return ami[_0x1693('0x19')]({'action':_0x1693('0x6b'),'channel':_0x52e4c2[_0x1693('0x6c')],'mixmonitorid':_0x4fe87e[_0x1693('0x66')]})[_0x1693('0x1b')](function(_0x4fc095){});}})[_0x1693('0x21')](function(_0x1a8e9){var _0x3e6469=_[_0x1693('0x58')](_0x52e4c2[_0x1693('0x61')],{'mixmonitorid':_0x4fe87e['mixmonitorid']});if(_0x3e6469){_0x3e6469[_0x1693('0x68')]=_0x1693('0x6d');}})[_0x1693('0x21')](function(){var _0x15632b=util['format'](_0x1693('0x5e'),_0x4fe87e[_0x1693('0x5f')]||_0x4fe87e[_0x1693('0x5d')],_0x4fe87e[_0x1693('0x9')]||_0x1693('0x60'));var _0x2dd1c0=_['find'](_0x52e4c2['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x15632b[_0x1693('0x64')]()});if(_0x2dd1c0){_0x2dd1c0[_0x1693('0x68')]='stop';}})[_0x1693('0x21')](function(){_0x986f14({'code':0xc8,'message':[_0x4fe87e[_0x1693('0x5d')],'StopMixMonitor\x20Success'][_0x1693('0x1d')]('\x20')});})['catch'](function(_0xec49ff){_0x298fd2(_0x463ba1[_0x1693('0x1c')](0x1f5,[_0x4fe87e[_0x1693('0x5d')],_0xec49ff[_0x1693('0x1a')][_0x1693('0x64')]()][_0x1693('0x1d')]('\x20')));});}else{return _0x298fd2(_0x463ba1[_0x1693('0x1c')](0x1f5,_0x1693('0x6e')));}});},'VoiceQueuesChannels':function(_0x2ae139){return new Promise(function(_0x584a14,_0x3753c3){var _0x4c651d=_[_0x1693('0x6f')](_0x2ca960[_0x1693('0x70')]);_0x584a14({'count':_0x4c651d[_0x1693('0x57')],'rows':_0x4c651d});});},'VoiceQueuesChannel':function(_0x497d36){var _0x499f55=this;return new Promise(function(_0x1f4bc4,_0x4a719d){var _0x4041bb=schema(properties[_0x1693('0x71')])[_0x1693('0x3')](_0x497d36);if(_0x4041bb['length']>0x0){return _0x4a719d(_0x499f55['error'](0x1f4,_[_0x1693('0x5c')](_0x4041bb,_0x1693('0x1a'))[_0x1693('0x1d')](',\x20')));}var _0x528a65=_[_0x1693('0x58')](_0x2ca960['queueChannels'],{'uniqueid':_0x497d36[_0x1693('0x5d')]});if(_0x528a65){_0x1f4bc4(_0x528a65);}else{return _0x4a719d(_0x499f55[_0x1693('0x1c')](0x1f5,_0x1693('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x45fe2f){var _0x5eccc4=this;return new Promise(function(_0xe83bf,_0x2cf356){if(ami[_0x1693('0x14')]()==![]){return _0x2cf356(_0x5eccc4[_0x1693('0x1c')](0x1f4,[config[_0x1693('0x15')]['ip'],config[_0x1693('0x15')][_0x1693('0x16')],_0x1693('0x17')][_0x1693('0x1d')]('\x20')));}var _0x157152=schema(properties[_0x1693('0x72')])[_0x1693('0x3')](_0x45fe2f);if(_0x157152[_0x1693('0x57')]>0x0){return _0x2cf356(_0x5eccc4[_0x1693('0x1c')](0x1f4,_[_0x1693('0x5c')](_0x157152,_0x1693('0x1a'))['join'](',\x20')));}var _0x4b0ef1=_[_0x1693('0x58')](_0x2ca960[_0x1693('0x70')],{'uniqueid':_0x45fe2f['uniqueid']});if(_0x4b0ef1&&_0x4b0ef1[_0x1693('0x6a')]){return ami[_0x1693('0x19')]({'action':_0x1693('0x73'),'channel':_0x4b0ef1['channel']})[_0x1693('0x21')](function(_0x395a9e){_0xe83bf({'code':0xc8,'message':[_0x45fe2f[_0x1693('0x5d')],_0x395a9e[_0x1693('0x1a')][_0x1693('0x64')]()][_0x1693('0x1d')]('\x20')});})[_0x1693('0x1b')](function(_0xaec248){_0x2cf356(_0x5eccc4['error'](0x1f5,[_0x45fe2f[_0x1693('0x5d')],_0xaec248['message'][_0x1693('0x64')]()][_0x1693('0x1d')]('\x20')));});}else{return _0x2cf356(_0x5eccc4[_0x1693('0x1c')](0x1f5,_0x1693('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x56e3a6){var _0x26bd2e=this;return new Promise(function(_0x4f90bd,_0xb9fd27){if(ami[_0x1693('0x14')]()==![]){return _0xb9fd27(_0x26bd2e[_0x1693('0x1c')](0x1f4,[config[_0x1693('0x15')]['ip'],config[_0x1693('0x15')][_0x1693('0x16')],_0x1693('0x17')][_0x1693('0x1d')]('\x20')));}var _0x594773=schema(properties[_0x1693('0x74')])['validate'](_0x56e3a6);if(_0x594773['length']>0x0){return _0xb9fd27(_0x26bd2e[_0x1693('0x1c')](0x1f4,_[_0x1693('0x5c')](_0x594773,_0x1693('0x1a'))[_0x1693('0x1d')](',\x20')));}var _0x44e29e=_['find'](_0x2ca960['queueChannels'],{'uniqueid':_0x56e3a6[_0x1693('0x5d')]});if(_0x44e29e&&_0x44e29e[_0x1693('0x6a')]){return ami[_0x1693('0x19')]({'action':_0x1693('0x75'),'channel':_0x44e29e[_0x1693('0x6a')],'exten':_0x56e3a6['exten'],'context':_0x56e3a6[_0x1693('0x76')]||_0x44e29e[_0x1693('0x76')],'priority':0x1})[_0x1693('0x21')](function(_0x42894f){_0x4f90bd({'code':0xc8,'message':[_0x56e3a6[_0x1693('0x5d')],_0x42894f['message'][_0x1693('0x64')]()][_0x1693('0x1d')]('\x20')});})[_0x1693('0x1b')](function(_0xa2adc4){_0xb9fd27(_0x26bd2e[_0x1693('0x1c')](0x1f5,[_0x56e3a6[_0x1693('0x5d')],_0xa2adc4[_0x1693('0x1a')]['toLowerCase']()][_0x1693('0x1d')]('\x20')));});}else{return _0xb9fd27(_0x26bd2e[_0x1693('0x1c')](0x1f5,_0x1693('0x6e')));}});},'Agents':function(_0x535d7a){return new Promise(function(_0x3743fc,_0x591f37){var _0x584e49=_[_0x1693('0x6f')](_0x2ca960[_0x1693('0x10')]);_0x3743fc({'count':_0x584e49[_0x1693('0x57')],'rows':_0x584e49});});},'Telephones':function(_0x53461c){return new Promise(function(_0x1d5ccf,_0x5a3922){var _0x1f721d=_[_0x1693('0x6f')](_0x2ca960[_0x1693('0x77')]);_0x1d5ccf({'count':_0x1f721d[_0x1693('0x57')],'rows':_0x1f721d});});},'Trunks':function(_0x33e2e1){return new Promise(function(_0x4abd34,_0x45201a){var _0x11ce8f=_[_0x1693('0x6f')](_0x2ca960['trunks']);_0x4abd34({'count':_0x11ce8f['length'],'rows':_0x11ce8f});});},'OutboundChannels':function(_0x31006c){return new Promise(function(_0xfca320,_0x543ba7){var _0x34efbd=_['values'](_0x2ca960[_0x1693('0x78')]);_0xfca320({'count':_0x34efbd[_0x1693('0x57')],'rows':_0x34efbd});});},'Outbound':function(_0x4ee6f4){return new Promise(function(_0x1f4195,_0x5f3155){_0x1f4195(_0x2ca960['outbound']);});},'Campaigns':function(_0x15b6cf){return new Promise(function(_0x34b652,_0x57dad7){var _0x57470d=_[_0x1693('0x6f')](_0x2ca960[_0x1693('0x79')]);_0x34b652({'count':_0x57470d['length'],'rows':_0x57470d});});},'VoiceQueuesPreview':function(_0x6dec6f){var _0x20362f=this;return new Promise(function(_0x469d66,_0x4a4463){_0x378fa6['run'](_0x6dec6f['id'])[_0x1693('0x21')](function(_0x3cd068){_0x469d66({'code':0xc8,'message':_0x3cd068[_0x1693('0x1a')]});})[_0x1693('0x1b')](function(_0x4ae05){_0x4a4463(_0x20362f[_0x1693('0x1c')](0x1f4,_0x4ae05[_0x1693('0x1a')]));});});},'EventManager':function(_0x5da984){var _0x5544c0=this;return new Promise(function(_0xb40378,_0x2d9b0e){if(!_0x5da984[_0x1693('0x7a')]){return _0x2d9b0e(_0x5544c0[_0x1693('0x1c')](0x1f4,_0x1693('0x7b')));}ami['emit']('custom:'+_0x5da984['event'],_0x5da984[_0x1693('0x1a')]);_0xb40378({'code':0xc8,'message':_0x5da984});});},'FaxAccounts':function(_0x1cccc8){return new Promise(function(_0x2be526,_0x59a3a9){var _0x47901d=_[_0x1693('0x6f')](_0x2ca960['faxAccounts']);_0x2be526({'count':_0x47901d[_0x1693('0x57')],'rows':_0x47901d});});},'SendFax':function(_0xa46a74){var _0x4cef47=this;return new Promise(function(_0x130347,_0x1807fa){_0x455646[_0x1693('0x7c')](_0xa46a74)[_0x1693('0x21')](function(_0x105ad0){_0x130347({'code':0xc8,'message':_0x105ad0[_0x1693('0x1a')]});})[_0x1693('0x1b')](function(_0x1868bf){_0x1807fa(_0x4cef47[_0x1693('0x1c')](0x1f4,_0x1868bf[_0x1693('0x1a')]));});});},'CheckAfterSend':function(_0x4611b7){var _0x545ab8=this;return new Promise(function(_0x1b5253,_0x39a9a9){_0x455646['checkAfterSend'](_0x4611b7)[_0x1693('0x21')](function(_0x24d654){_0x1b5253({'code':0xc8,'message':_0x24d654[_0x1693('0x1a')]});})[_0x1693('0x1b')](function(_0x35bbea){_0x39a9a9(_0x545ab8[_0x1693('0x1c')](0x1f4,_0x35bbea[_0x1693('0x1a')]));});});}};var _0x1f2b1a=jayson[_0x1693('0x7d')](_0x3ab149)[_0x1693('0x7e')]();_0x1f2b1a['on'](_0x1693('0x1c'),function(_0x4de909){return _0x5de567(_0x4de909);});_0x1f2b1a[_0x1693('0x8')](0x232a,_0x1693('0x7f'),function(){console[_0x1693('0x80')](_0x1693('0x81'),0x232a);return _0x379d6c(_0x1693('0x82')+0x232a);});});}; \ No newline at end of file +var _0x15ef=['timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','then','command','Command','content','voiceQueues','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','validate','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','MixMonitor\x20Success','catch','voicechannel','StopMixMonitor','destinationchannel','stop','%s.%s','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannelhangup','map','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x15ef,0x80));var _0xf15e=function(_0xbc5e53,_0x5c06ae){_0xbc5e53=_0xbc5e53-0x0;var _0x56b9a8=_0x15ef[_0xbc5e53];return _0x56b9a8;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var jayson=require(_0xf15e('0x1'));var schema=require('validate');var BPromise=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var config=require(_0xf15e('0x4'));var properties=require(_0xf15e('0x5'));var ami=require(_0xf15e('0x6'));exports['listen']=function(_0x1b9a24,_0x5c0553,_0x5e96b4){return new BPromise(function(_0x5ba863,_0x66708e){var _0x232359={'QueuePause':function(_0x490097){return new Promise(function(_0x2d6e94,_0x4daf89){var _0x1168c3=util[_0xf15e('0x7')](_0xf15e('0x8'),_0xf15e('0x9'),_0x490097['name']);if(_0x1b9a24['timers']&&_0x1b9a24['timers'][_0x1168c3]&&_0x1b9a24[_0xf15e('0xa')][_0x1168c3][_0xf15e('0xb')]){_0x1b9a24['timers'][_0x1168c3]['updateAcw']();}if(_0x1b9a24['agents'][_0x1168c3]){_0x1b9a24[_0xf15e('0xc')][_0x1168c3][_0xf15e('0xd')]({'statePause':_0x490097[_0xf15e('0xe')]?!![]:![]});}_0x2d6e94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x442d51){var _0x1b8543=this;return new Promise(function(_0x16a04a,_0x5da521){if(ami[_0xf15e('0xf')]()==![]){return _0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}_0x442d51=_[_0xf15e('0x15')](_0x442d51,_['keys'](properties[_0xf15e('0x16')]));_0x442d51[_0xf15e('0x17')]='Reload';return ami[_0xf15e('0x18')](_0x442d51)[_0xf15e('0x19')](function(_0x45e418){_0x16a04a({'code':0xc8,'message':_0x45e418['message']});})['catch'](function(_0x3ad067){_0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f5,_0x3ad067['message']));});});},'Command':function(_0x86d14f){var _0x1f1f33=this;return new Promise(function(_0xa47259,_0x4b144c){if(ami['isConnected']()==![]){return _0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x86d14f=_[_0xf15e('0x15')](_0x86d14f,_0xf15e('0x1a'));_0x86d14f[_0xf15e('0x17')]=_0xf15e('0x1b');return ami['Action'](_0x86d14f)[_0xf15e('0x19')](function(_0xa09c0c){_0xa47259({'code':0xc8,'message':_0xa09c0c[_0xf15e('0x1c')]});})['catch'](function(_0x248c4b){_0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f5,_0x248c4b['message']));});});},'VoiceQueues':function(_0x5d381a){return new Promise(function(_0x2e6d94,_0xb36af){var _0x1fd237=[];for(var _0x471079 in _0x1b9a24[_0xf15e('0x1d')]){if(_0x1b9a24['voiceQueues']['hasOwnProperty'](_0x471079)){var _0x3f9d64=_0x1b9a24[_0xf15e('0x1d')][_0x471079];var _0x4a83e5={'id':_0x3f9d64['id'],'name':_0x3f9d64[_0xf15e('0x1e')],'strategy':_0x3f9d64[_0xf15e('0x1f')],'answered':_0x3f9d64[_0xf15e('0x20')],'available':_0x3f9d64[_0xf15e('0x21')],'loggedIn':_0x3f9d64[_0xf15e('0x22')],'pTalking':_0x3f9d64[_0xf15e('0x23')],'sumBillable':_0x3f9d64[_0xf15e('0x24')],'sumDuration':_0x3f9d64[_0xf15e('0x25')],'sumHoldTime':_0x3f9d64['sumHoldTime']||0x0,'talking':_0x3f9d64[_0xf15e('0x26')],'total':_0x3f9d64[_0xf15e('0x27')],'type':_0x3f9d64[_0xf15e('0x28')],'unmanaged':_0x3f9d64['unmanaged'],'abandoned':_0x3f9d64[_0xf15e('0x29')],'waiting':_0x3f9d64[_0xf15e('0x2a')],'loggedInDb':_0x3f9d64['loggedInDb']};if(_0x3f9d64[_0xf15e('0x28')]===_0xf15e('0x2b')){_0x4a83e5[_0xf15e('0x2c')]=_0x3f9d64['dialActive'];_0x4a83e5[_0xf15e('0x2d')]=_0x3f9d64[_0xf15e('0x2d')];_0x4a83e5[_0xf15e('0x2e')]=_0x3f9d64[_0xf15e('0x2e')];_0x4a83e5['dialOriginateCallerIdNumber']=_0x3f9d64[_0xf15e('0x2f')];_0x4a83e5[_0xf15e('0x30')]=_0x3f9d64['dialOriginateTimeout'];_0x4a83e5[_0xf15e('0x31')]=_0x3f9d64[_0xf15e('0x31')];_0x4a83e5[_0xf15e('0x32')]=_0x3f9d64['temp'];_0x4a83e5[_0xf15e('0x33')]=_0x3f9d64[_0xf15e('0x33')];_0x4a83e5['outboundAnswerCallsDay']=_0x3f9d64[_0xf15e('0x34')];_0x4a83e5['outboundBlacklistCallsDay']=_0x3f9d64[_0xf15e('0x35')];_0x4a83e5[_0xf15e('0x36')]=_0x3f9d64['outboundBusyCallsDay'];_0x4a83e5['outboundCongestionCallsDay']=_0x3f9d64[_0xf15e('0x37')];_0x4a83e5[_0xf15e('0x38')]=_0x3f9d64['outboundDropCallsDayACS'];_0x4a83e5[_0xf15e('0x39')]=_0x3f9d64[_0xf15e('0x39')];_0x4a83e5[_0xf15e('0x3a')]=_0x3f9d64[_0xf15e('0x3a')];_0x4a83e5[_0xf15e('0x3b')]=_0x3f9d64[_0xf15e('0x3b')];_0x4a83e5['outboundNoSuchCallsDay']=_0x3f9d64[_0xf15e('0x3c')];_0x4a83e5[_0xf15e('0x3d')]=_0x3f9d64[_0xf15e('0x3d')];_0x4a83e5[_0xf15e('0x3e')]=_0x3f9d64[_0xf15e('0x3e')];_0x4a83e5[_0xf15e('0x3f')]=_0x3f9d64[_0xf15e('0x3f')];_0x4a83e5[_0xf15e('0x40')]=_0x3f9d64['outboundUnknownCallsDay'];_0x4a83e5[_0xf15e('0x41')]=_0x3f9d64['predictiveIntervalAnsweredCalls'];_0x4a83e5[_0xf15e('0x42')]=_0x3f9d64[_0xf15e('0x42')];_0x4a83e5[_0xf15e('0x43')]=_0x3f9d64[_0xf15e('0x43')];_0x4a83e5[_0xf15e('0x44')]=_0x3f9d64[_0xf15e('0x44')];_0x4a83e5['predictiveIntervalDroppedCallsTimeout']=_0x3f9d64[_0xf15e('0x45')];_0x4a83e5[_0xf15e('0x46')]=_0x3f9d64[_0xf15e('0x46')];_0x4a83e5[_0xf15e('0x47')]=_0x3f9d64['predictiveIntervalErlangCallsDroppedCalls'];_0x4a83e5['predictiveIntervalHitRate']=_0x3f9d64[_0xf15e('0x48')];_0x4a83e5[_0xf15e('0x49')]=_0x3f9d64[_0xf15e('0x49')];_0x4a83e5['predictiveIntervalPauses']=_0x3f9d64['predictiveIntervalPauses'];_0x4a83e5['predictiveIntervalAvailable']=_0x3f9d64['predictiveIntervalAvailable'];_0x4a83e5['predictiveIntervalTotalCalls']=_0x3f9d64[_0xf15e('0x4a')];_0x4a83e5[_0xf15e('0x4b')]=_0x3f9d64[_0xf15e('0x4b')];_0x4a83e5['originated']=_0x3f9d64[_0xf15e('0x4c')];_0x4a83e5['erlangCalls']=_0x3f9d64[_0xf15e('0x4d')];_0x4a83e5[_0xf15e('0x4e')]=_0x3f9d64[_0xf15e('0x4e')];_0x4a83e5[_0xf15e('0x4f')]=_0x3f9d64['erlangAbandonmentRate'];_0x4a83e5[_0xf15e('0x50')]=_0x3f9d64[_0xf15e('0x50')];_0x4a83e5[_0xf15e('0x51')]=_0x3f9d64[_0xf15e('0x51')];_0x4a83e5[_0xf15e('0x52')]=_0x3f9d64['startProgressive'];}if(_0x3f9d64[_0xf15e('0x53')]){_0x4a83e5[_0xf15e('0x53')]={'id':_0x3f9d64[_0xf15e('0x53')]['id'],'name':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x1e')],'active':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x54')],'callerid':_0x3f9d64['Trunk'][_0xf15e('0x55')]};}if(_0x3f9d64[_0xf15e('0x56')]){_0x4a83e5['Interval']={'id':_0x3f9d64['Interval']['id'],'name':_0x3f9d64[_0xf15e('0x56')]['name']};}_0x1fd237['push'](_0x4a83e5);}}_0x2e6d94({'count':_0x1fd237[_0xf15e('0x57')],'rows':_0x1fd237});});},'UpdateVoiceQueue':function(_0x3d99f8){return new Promise(function(_0x4cdfa6,_0x4becd6){var _0x1f2e17=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x1d')],{'id':parseInt(_0x3d99f8['id'])});var _0x33df95=_[_0xf15e('0x59')](_0x3d99f8,['id']);if(_0x1f2e17){for(var _0x31a916 in _0x33df95){if(typeof _0x33df95[_0x31a916]!==_0xf15e('0x5a')&&typeof _0x1f2e17[_0x31a916]!==_0xf15e('0x5a')){_0x1f2e17[_0x31a916]=_0x33df95[_0x31a916];}}_0x4cdfa6(_0x1f2e17);}else{_0x4becd6();}});},'VoiceChannels':function(_0x4fd67c){return new Promise(function(_0x1dba1c,_0x44f075){var _0x3b79a8=_['values'](_0x1b9a24['channels']);_0x1dba1c({'count':_0x3b79a8[_0xf15e('0x57')],'rows':_0x3b79a8});});},'VoiceChannelMixMonitor':function(_0x368a1f){var _0x382ae5=this;return new Promise(function(_0x3da6fe,_0x1cb428){if(ami[_0xf15e('0xf')]()==![]){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')]['join']('\x20')));}var _0x378492=schema(properties['voicechannel'])[_0xf15e('0x5b')](_0x368a1f);if(_0x378492[_0xf15e('0x57')]>0x0){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,_['map'](_0x378492,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x30c8ac=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x368a1f[_0xf15e('0x5d')]});if(_0x30c8ac&&_0x30c8ac[_0xf15e('0x5e')]){var _0x2507b3=util[_0xf15e('0x7')]('%s.%s',_0x368a1f[_0xf15e('0x5f')]||_0x368a1f[_0xf15e('0x5d')],_0x368a1f[_0xf15e('0x7')]||_0xf15e('0x60'));return ami[_0xf15e('0x18')]({'action':'MixMonitor','channel':_0x30c8ac[_0xf15e('0x5e')],'file':_0x2507b3,'options':_0xf15e('0x61')})[_0xf15e('0x19')](function(_0x25827b){var _0x3235d8=_[_0xf15e('0x58')](_0x30c8ac[_0xf15e('0x62')],{'filename':_0xf15e('0x63')+_0x2507b3[_0xf15e('0x64')]()});if(_[_0xf15e('0x65')](_0x3235d8)){_0x30c8ac[_0xf15e('0x62')][_0xf15e('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2507b3[_0xf15e('0x64')](),'createdAt':moment()[_0xf15e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x25827b['mixmonitorid'],'status':_0xf15e('0x67')});}else{_0x3235d8[_0xf15e('0x68')]=_0x25827b['mixmonitorid'];_0x3235d8['status']=_0xf15e('0x67');}_0x3da6fe({'code':0xc8,'message':[_0x368a1f[_0xf15e('0x5d')],_0xf15e('0x69'),_0x25827b[_0xf15e('0x68')]][_0xf15e('0x14')]('\x20'),'mixmonitorid':_0x25827b[_0xf15e('0x68')]});})[_0xf15e('0x6a')](function(_0x54efa8){_0x1cb428(_0x382ae5['error'](0x1f5,[_0x368a1f[_0xf15e('0x5d')],_0x54efa8['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x30b2f3){var _0x295d49=this;return new Promise(function(_0x469a1b,_0x13837c){if(ami['isConnected']()==![]){return _0x13837c(_0x295d49['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')]['username'],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x1eec69=schema(properties[_0xf15e('0x6b')])[_0xf15e('0x5b')](_0x30b2f3);if(_0x1eec69['length']>0x0){return _0x13837c(_0x295d49['error'](0x1f4,_['map'](_0x1eec69,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x5f1121=_['find'](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x30b2f3['uniqueid']});if(_0x5f1121){return BPromise['resolve']()['then'](function(){if(_0x5f1121['channel']){return ami['Action']({'action':_0xf15e('0x6c'),'channel':_0x5f1121[_0xf15e('0x5e')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})['catch'](function(_0x4979fd){});}})[_0xf15e('0x19')](function(){if(_0x5f1121[_0xf15e('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5f1121[_0xf15e('0x6d')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})[_0xf15e('0x6a')](function(_0x532f5b){});}})['then'](function(_0x37e0b2){var _0x44cefb=_['find'](_0x5f1121['monitors'],{'mixmonitorid':_0x30b2f3['mixmonitorid']});if(_0x44cefb){_0x44cefb['status']=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){var _0x53630b=util['format'](_0xf15e('0x6f'),_0x30b2f3['filename']||_0x30b2f3[_0xf15e('0x5d')],_0x30b2f3['format']||_0xf15e('0x60'));var _0x2a3255=_[_0xf15e('0x58')](_0x5f1121['monitors'],{'filename':_0xf15e('0x63')+_0x53630b['toLowerCase']()});if(_0x2a3255){_0x2a3255[_0xf15e('0x70')]=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){_0x469a1b({'code':0xc8,'message':[_0x30b2f3[_0xf15e('0x5d')],_0xf15e('0x71')][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x2ea42f){_0x13837c(_0x295d49['error'](0x1f5,[_0x30b2f3[_0xf15e('0x5d')],_0x2ea42f['message']['toLowerCase']()][_0xf15e('0x14')]('\x20')));});}else{return _0x13837c(_0x295d49['error'](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannels':function(_0x37ed48){return new Promise(function(_0x2cff3a,_0x2cf9f7){var _0x45a25a=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x74')]);_0x2cff3a({'count':_0x45a25a[_0xf15e('0x57')],'rows':_0x45a25a});});},'VoiceQueuesChannel':function(_0x18b2d2){var _0x8c9b10=this;return new Promise(function(_0x4f57f5,_0x5df791){var _0x72d9b6=schema(properties['voicequeuechannel'])['validate'](_0x18b2d2);if(_0x72d9b6[_0xf15e('0x57')]>0x0){return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f4,_['map'](_0x72d9b6,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x574403=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x18b2d2['uniqueid']});if(_0x574403){_0x4f57f5(_0x574403);}else{return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x30cf00){var _0x380fb2=this;return new Promise(function(_0x19890b,_0x340451){if(ami['isConnected']()==![]){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}var _0xbf57fb=schema(properties[_0xf15e('0x75')])['validate'](_0x30cf00);if(_0xbf57fb[_0xf15e('0x57')]>0x0){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0xbf57fb,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x482082=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x30cf00[_0xf15e('0x5d')]});if(_0x482082&&_0x482082[_0xf15e('0x5e')]){return ami['Action']({'action':'Hangup','channel':_0x482082[_0xf15e('0x5e')]})['then'](function(_0x449164){_0x19890b({'code':0xc8,'message':[_0x30cf00[_0xf15e('0x5d')],_0x449164['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')});})['catch'](function(_0x8c5913){_0x340451(_0x380fb2['error'](0x1f5,[_0x30cf00[_0xf15e('0x5d')],_0x8c5913[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x4d320f){var _0x5025bb=this;return new Promise(function(_0x3c1ac2,_0x18bc85){if(ami['isConnected']()==![]){return _0x18bc85(_0x5025bb['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x474c24=schema(properties['voicequeuechannelredirect'])[_0xf15e('0x5b')](_0x4d320f);if(_0x474c24['length']>0x0){return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0x474c24,_0xf15e('0x4b'))['join'](',\x20')));}var _0x40beaf=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x4d320f[_0xf15e('0x5d')]});if(_0x40beaf&&_0x40beaf[_0xf15e('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x40beaf[_0xf15e('0x5e')],'exten':_0x4d320f[_0xf15e('0x77')],'context':_0x4d320f[_0xf15e('0x78')]||_0x40beaf['context'],'priority':0x1})[_0xf15e('0x19')](function(_0x346ed4){_0x3c1ac2({'code':0xc8,'message':[_0x4d320f[_0xf15e('0x5d')],_0x346ed4[_0xf15e('0x4b')]['toLowerCase']()][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x91a322){_0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,[_0x4d320f[_0xf15e('0x5d')],_0x91a322[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34ee2f){return new Promise(function(_0x56e37c,_0x1484a4){var _0x1108bd=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0xc')]);_0x56e37c({'count':_0x1108bd['length'],'rows':_0x1108bd});});},'Telephones':function(_0x4f251c){return new Promise(function(_0x4a6ea5,_0x4ba658){var _0x532693=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x79')]);_0x4a6ea5({'count':_0x532693[_0xf15e('0x57')],'rows':_0x532693});});},'Trunks':function(_0x2450b1){return new Promise(function(_0x459d82,_0xcee4f5){var _0x387a2c=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7a')]);_0x459d82({'count':_0x387a2c['length'],'rows':_0x387a2c});});},'OutboundChannels':function(_0x425290){return new Promise(function(_0x10406e,_0x4a3a36){var _0x299be3=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7b')]);_0x10406e({'count':_0x299be3[_0xf15e('0x57')],'rows':_0x299be3});});},'Outbound':function(_0x48414e){return new Promise(function(_0x44c30b,_0x40f151){_0x44c30b(_0x1b9a24[_0xf15e('0x2b')]);});},'Campaigns':function(_0x39f9ce){return new Promise(function(_0x426b4b,_0x1bf82a){var _0xdf7775=_['values'](_0x1b9a24[_0xf15e('0x7c')]);_0x426b4b({'count':_0xdf7775[_0xf15e('0x57')],'rows':_0xdf7775});});},'VoiceQueuesPreview':function(_0x51d84b){var _0x295a21=this;return new Promise(function(_0x402613,_0x5b1c88){_0x5c0553[_0xf15e('0x7d')](_0x51d84b['id'])[_0xf15e('0x19')](function(_0x228a23){_0x402613({'code':0xc8,'message':_0x228a23['message']});})[_0xf15e('0x6a')](function(_0x8f566e){_0x5b1c88(_0x295a21[_0xf15e('0x10')](0x1f4,_0x8f566e[_0xf15e('0x4b')]));});});},'EventManager':function(_0x412200){var _0x3a9705=this;return new Promise(function(_0x1c2891,_0x4ee137){if(!_0x412200[_0xf15e('0x7e')]){return _0x4ee137(_0x3a9705[_0xf15e('0x10')](0x1f4,_0xf15e('0x7f')));}ami[_0xf15e('0x80')](_0xf15e('0x81')+_0x412200['event'],_0x412200['message']);_0x1c2891({'code':0xc8,'message':_0x412200});});},'FaxAccounts':function(_0x51819f){return new Promise(function(_0x26591d,_0x1a9e87){var _0x863deb=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x82')]);_0x26591d({'count':_0x863deb[_0xf15e('0x57')],'rows':_0x863deb});});},'SendFax':function(_0x22f526){var _0x49f1b4=this;return new Promise(function(_0x3daaf6,_0x27f242){_0x5e96b4[_0xf15e('0x83')](_0x22f526)['then'](function(_0x528d11){_0x3daaf6({'code':0xc8,'message':_0x528d11['message']});})[_0xf15e('0x6a')](function(_0x3f9a36){_0x27f242(_0x49f1b4[_0xf15e('0x10')](0x1f4,_0x3f9a36[_0xf15e('0x4b')]));});});},'CheckAfterSend':function(_0x369af7){var _0x29f953=this;return new Promise(function(_0x3a9b61,_0x38851f){_0x5e96b4[_0xf15e('0x84')](_0x369af7)[_0xf15e('0x19')](function(_0x17d407){_0x3a9b61({'code':0xc8,'message':_0x17d407[_0xf15e('0x4b')]});})[_0xf15e('0x6a')](function(_0x40b26e){_0x38851f(_0x29f953[_0xf15e('0x10')](0x1f4,_0x40b26e['message']));});});}};var _0x3f1966=jayson[_0xf15e('0x85')](_0x232359)[_0xf15e('0x86')]();_0x3f1966['on']('error',function(_0xd854c8){return _0x66708e(_0xd854c8);});_0x3f1966[_0xf15e('0x87')](0x232a,_0xf15e('0x88'),function(){console['log'](_0xf15e('0x89'),0x232a);return _0x5ba863(_0xf15e('0x8a')+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 8ebc258..23bfe04 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 _0xcf55=['../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment'];(function(_0x579495,_0x309aea){var _0x86dd72=function(_0x28abab){while(--_0x28abab){_0x579495['push'](_0x579495['shift']());}};_0x86dd72(++_0x309aea);}(_0xcf55,0x14b));var _0x5cf5=function(_0x2c9bf0,_0x4999f1){_0x2c9bf0=_0x2c9bf0-0x0;var _0x14fa8a=_0xcf55[_0x2c9bf0];return _0x14fa8a;};'use strict';var _=require(_0x5cf5('0x0'));var BPromise=require(_0x5cf5('0x1'));var Redis=require(_0x5cf5('0x2'));var util=require(_0x5cf5('0x3'));var config=require(_0x5cf5('0x4'));var logger=require(_0x5cf5('0x5'))(_0x5cf5('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x5cf5('0x7')]=_[_0x5cf5('0x8')](config[_0x5cf5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5cf5('0x9'))(new Redis(config[_0x5cf5('0x7')]));function emit(_0x13f6ee,_0x57b925,_0x1ea21d,_0x5e6ac5,_0x5aa5af){logger['info'](_0x5cf5('0xa'),_0x13f6ee,_0x57b925['id'],_0x1ea21d,_0x5e6ac5,JSON[_0x5cf5('0xb')](_0x5aa5af));io['to'](_0x1ea21d)[_0x5cf5('0xc')](_0x5e6ac5,_0x5aa5af);}exports[_0x5cf5('0xd')]=function(_0x64b95e,_0x46d180,_0x3be7b7,_0x1be9e9){var _0xdffc26,_0x4c5a96;var _0x867116={};var _0x53d59d;var _0x515560=Number(_0x3be7b7[_0x5cf5('0xe')]);var _0x49b251=_0x3be7b7[_0x5cf5('0xf')]?Boolean(Number(_0x3be7b7[_0x5cf5('0xf')])):![];var _0x23bd32;var _0x2d4c24=![];if(!_[_0x5cf5('0x10')](_0x3be7b7['data5'])){if(_0x3be7b7[_0x5cf5('0x11')]=='1')_0x2d4c24=!![];}if(!_0x2d4c24){if(_0x1be9e9['xmd-contactid']){_0x867116['id']=_0x1be9e9['xmd-contactid'];}}if(!_0x867116['id']){_0x867116[_0x5cf5('0x12')]=_0x515560;_0x23bd32=_0x3be7b7[_0x5cf5('0x13')]&&_0x3be7b7['data3']!=='0'?_0x3be7b7[_0x5cf5('0x13')][_0x5cf5('0x14')](','):[_0x5cf5('0x15')];_0x867116[_0x5cf5('0x16')]=_[_0x5cf5('0x17')](_0x23bd32,function(_0x515554){var _0x3acfc7={};_0x3acfc7[_0x515554]=_0x1be9e9[_0x5cf5('0x18')]?_0x1be9e9[_0x5cf5('0x19')]:_0x1be9e9[_0x5cf5('0x1a')];return _0x3acfc7;});_0x53d59d=_0x1be9e9[_0x5cf5('0x18')]?_0x1be9e9[_0x5cf5('0x19')]:_0x1be9e9[_0x5cf5('0x1a')];}var _0x31d0d3=['id',_0x5cf5('0x1b'),_0x5cf5('0x1c'),'phone','mobile',_0x5cf5('0x1d'),_0x5cf5('0x12'),'createdAt',_0x5cf5('0x1e'),_0x5cf5('0x1f')];var _0x56b245=_['union'](_0x31d0d3,_0x23bd32);BPromise[_0x5cf5('0x20')]()[_0x5cf5('0x21')](cmContactRpc[_0x5cf5('0x22')]({'attributes':_0x56b245,'where':_0x867116,'phone':_0x53d59d}))[_0x5cf5('0x21')](function(_0xdb2ce1){_0x4c5a96=_0xdb2ce1;if(!_[_0x5cf5('0x23')](_0x4c5a96)){if(_0x4c5a96[_0x5cf5('0x24')]===0x1){_0xdffc26=_0x4c5a96[0x0];logger[_0x5cf5('0x25')](_0x5cf5('0x26'),_0x1be9e9[_0x5cf5('0x27')],_0x46d180['id'],_0xdffc26['id']);}else{logger[_0x5cf5('0x25')](_0x5cf5('0x28'),_0x1be9e9[_0x5cf5('0x27')],_0x46d180['id'],_[_0x5cf5('0x17')](_0x4c5a96,'id')['join'](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1be9e9[_0x5cf5('0x27')],_0x46d180['id']);var _0x3220f4={'ListId':_0x515560};var _0x5dacec=_0x3be7b7[_0x5cf5('0x29')]&&_0x3be7b7[_0x5cf5('0x29')]!=='0'?_0x3be7b7[_0x5cf5('0x29')]:_0x5cf5('0x15');if(_0x49b251){logger[_0x5cf5('0x25')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1be9e9[_0x5cf5('0x27')],_0x46d180['id']);_0x3220f4[_0x5dacec]=_['isNil'](_0x1be9e9['routeId'])?_0x1be9e9['calleridnum']:_0x1be9e9[_0x5cf5('0x19')];if(_[_0x5cf5('0x10')](_0x1be9e9[_0x5cf5('0x18')])){_0x3220f4[_0x5cf5('0x1b')]=_0x1be9e9[_0x5cf5('0x2a')]&&_0x1be9e9[_0x5cf5('0x2a')]!==''?_0x1be9e9[_0x5cf5('0x2a')]:_0x5cf5('0x2b');}else{_0x3220f4[_0x5cf5('0x1b')]=_0x1be9e9[_0x5cf5('0x2c')]&&_0x1be9e9[_0x5cf5('0x2c')]!==''?_0x1be9e9[_0x5cf5('0x2c')]:_0x5cf5('0x2b');}return BPromise['resolve']()[_0x5cf5('0x21')](cmContactRpc[_0x5cf5('0x2d')](_0x3220f4))['then'](function(_0x1d74c9){_0xdffc26=_0x1d74c9;_0x4c5a96[_0x5cf5('0x2e')](_0x1d74c9);if(_0xdffc26){logger[_0x5cf5('0x25')](_0x5cf5('0x2f'),_0x1be9e9['uniqueid'],_0x46d180['id'],_0xdffc26['id']);}return;});}else{logger[_0x5cf5('0x25')](_0x5cf5('0x30'),_0x1be9e9[_0x5cf5('0x27')],_0x46d180['id']);_0x3220f4[_0x5dacec]=_['isNil'](_0x1be9e9[_0x5cf5('0x18')])?_0x1be9e9[_0x5cf5('0x1a')]:_0x1be9e9['destcalleridnum'];if(_['isNil'](_0x1be9e9[_0x5cf5('0x18')])){_0x3220f4['firstName']=_0x1be9e9[_0x5cf5('0x2a')]&&_0x1be9e9[_0x5cf5('0x2a')]!==_0x5cf5('0x31')?_0x1be9e9[_0x5cf5('0x2a')]:_0x5cf5('0x2b');}else{_0x3220f4['firstName']=_0x1be9e9[_0x5cf5('0x2c')]&&_0x1be9e9['destcalleridname']!==''?_0x1be9e9[_0x5cf5('0x2c')]:_0x5cf5('0x2b');}_0xdffc26=_0x3220f4;_0x4c5a96[_0x5cf5('0x2e')](_0x3220f4);return;}}})['then'](function(){if(_0x64b95e){emit(_0x1be9e9[_0x5cf5('0x27')],_0x46d180,util[_0x5cf5('0x32')](_0x5cf5('0x33'),_0x64b95e[_0x5cf5('0x34')]),util[_0x5cf5('0x32')](_0x5cf5('0x35'),_0x3be7b7['action'][_0x5cf5('0x36')]()),{'evt':_[_0x5cf5('0x37')](_0x1be9e9,{'autoCreate':_0x49b251}),'contact':_0xdffc26===undefined?{}:_0xdffc26,'contacts':_0x4c5a96['length']===0x0?undefined:_0x4c5a96});}});}; \ No newline at end of file +var _0xc0bf=['then','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve'];(function(_0x5aea54,_0x311cd0){var _0x4ebfa2=function(_0x521940){while(--_0x521940){_0x5aea54['push'](_0x5aea54['shift']());}};_0x4ebfa2(++_0x311cd0);}(_0xc0bf,0x8c));var _0xfc0b=function(_0x13af9e,_0x4a7f6c){_0x13af9e=_0x13af9e-0x0;var _0x36b3cd=_0xc0bf[_0x13af9e];return _0x36b3cd;};'use strict';var _=require('lodash');var BPromise=require(_0xfc0b('0x0'));var Redis=require(_0xfc0b('0x1'));var util=require(_0xfc0b('0x2'));var config=require(_0xfc0b('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xfc0b('0x4'));config[_0xfc0b('0x5')]=_[_0xfc0b('0x6')](config[_0xfc0b('0x5')],{'host':_0xfc0b('0x7'),'port':0x18eb});var io=require(_0xfc0b('0x8'))(new Redis(config[_0xfc0b('0x5')]));function emit(_0x3c8ee5,_0x25ac20,_0x2c41c0,_0x4f3506,_0x56cd73){logger['info']('[CM][%s][%s]',_0x3c8ee5,_0x25ac20['id'],_0x2c41c0,_0x4f3506,JSON[_0xfc0b('0x9')](_0x56cd73));io['to'](_0x2c41c0)[_0xfc0b('0xa')](_0x4f3506,_0x56cd73);}exports[_0xfc0b('0xb')]=function(_0x5d8dc4,_0x4ffbcd,_0x2b08cc,_0x340bca){var _0x4ac994,_0x4c9483;var _0x1b0524={};var _0x2dcb62;var _0x5c4e08=Number(_0x2b08cc['data1']);var _0x416b3f=_0x2b08cc['data2']?Boolean(Number(_0x2b08cc[_0xfc0b('0xc')])):![];var _0x5360a9;var _0x30d64a=![];if(!_['isNil'](_0x2b08cc[_0xfc0b('0xd')])){if(_0x2b08cc[_0xfc0b('0xd')]=='1')_0x30d64a=!![];}if(!_0x30d64a){if(_0x340bca[_0xfc0b('0xe')]){_0x1b0524['id']=_0x340bca['xmd-contactid'];}}if(!_0x1b0524['id']){_0x1b0524[_0xfc0b('0xf')]=_0x5c4e08;_0x5360a9=_0x2b08cc[_0xfc0b('0x10')]&&_0x2b08cc['data3']!=='0'?_0x2b08cc['data3'][_0xfc0b('0x11')](','):[_0xfc0b('0x12')];_0x1b0524[_0xfc0b('0x13')]=_[_0xfc0b('0x14')](_0x5360a9,function(_0x3d1423){var _0x4ba05c={};_0x4ba05c[_0x3d1423]=_0x340bca[_0xfc0b('0x15')]?_0x340bca[_0xfc0b('0x16')]:_0x340bca['calleridnum'];return _0x4ba05c;});_0x2dcb62=_0x340bca[_0xfc0b('0x15')]?_0x340bca[_0xfc0b('0x16')]:_0x340bca[_0xfc0b('0x17')];}var _0x1fad5f=['id','firstName',_0xfc0b('0x18'),'phone',_0xfc0b('0x19'),_0xfc0b('0x1a'),_0xfc0b('0xf'),_0xfc0b('0x1b'),_0xfc0b('0x1c'),_0xfc0b('0x1d')];var _0x13db13=_['union'](_0x1fad5f,_0x5360a9);BPromise[_0xfc0b('0x1e')]()[_0xfc0b('0x1f')](cmContactRpc['getContacts']({'attributes':_0x13db13,'where':_0x1b0524,'phone':_0x2dcb62}))[_0xfc0b('0x1f')](function(_0x2a5e89){_0x4c9483=_0x2a5e89;if(!_['isEmpty'](_0x4c9483)){if(_0x4c9483['length']===0x1){_0x4ac994=_0x4c9483[0x0];logger[_0xfc0b('0x20')](_0xfc0b('0x21'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_0x4ac994['id']);}else{logger['info'](_0xfc0b('0x23'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_[_0xfc0b('0x14')](_0x4c9483,'id')[_0xfc0b('0x24')](','));}return;}else{logger['info'](_0xfc0b('0x25'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id']);var _0x37fc69={'ListId':_0x5c4e08};var _0x562330=_0x2b08cc[_0xfc0b('0x26')]&&_0x2b08cc[_0xfc0b('0x26')]!=='0'?_0x2b08cc['data4']:'phone';if(_0x416b3f){logger[_0xfc0b('0x20')](_0xfc0b('0x27'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id']);_0x37fc69[_0x562330]=_['isNil'](_0x340bca[_0xfc0b('0x15')])?_0x340bca[_0xfc0b('0x17')]:_0x340bca['destcalleridnum'];if(_[_0xfc0b('0x28')](_0x340bca['routeId'])){_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2a')]&&_0x340bca[_0xfc0b('0x2a')]!==''?_0x340bca[_0xfc0b('0x2a')]:_0xfc0b('0x2b');}else{_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2c')]&&_0x340bca[_0xfc0b('0x2c')]!==_0xfc0b('0x2d')?_0x340bca[_0xfc0b('0x2c')]:_0xfc0b('0x2b');}return BPromise['resolve']()[_0xfc0b('0x1f')](cmContactRpc[_0xfc0b('0x2e')](_0x37fc69))['then'](function(_0x3fea17){_0x4ac994=_0x3fea17;_0x4c9483[_0xfc0b('0x2f')](_0x3fea17);if(_0x4ac994){logger[_0xfc0b('0x20')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_0x4ac994['id']);}return;});}else{logger[_0xfc0b('0x20')](_0xfc0b('0x30'),_0x340bca['uniqueid'],_0x4ffbcd['id']);_0x37fc69[_0x562330]=_[_0xfc0b('0x28')](_0x340bca[_0xfc0b('0x15')])?_0x340bca['calleridnum']:_0x340bca[_0xfc0b('0x16')];if(_['isNil'](_0x340bca[_0xfc0b('0x15')])){_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2a')]&&_0x340bca[_0xfc0b('0x2a')]!==_0xfc0b('0x2d')?_0x340bca[_0xfc0b('0x2a')]:'Unknown';}else{_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2c')]&&_0x340bca[_0xfc0b('0x2c')]!==_0xfc0b('0x2d')?_0x340bca['destcalleridname']:_0xfc0b('0x2b');}_0x4ac994=_0x37fc69;_0x4c9483[_0xfc0b('0x2f')](_0x37fc69);return;}}})[_0xfc0b('0x1f')](function(){if(_0x5d8dc4){emit(_0x340bca[_0xfc0b('0x22')],_0x4ffbcd,util[_0xfc0b('0x31')](_0xfc0b('0x32'),_0x5d8dc4[_0xfc0b('0x33')]),util[_0xfc0b('0x31')](_0xfc0b('0x34'),_0x2b08cc[_0xfc0b('0x35')][_0xfc0b('0x36')]()),{'evt':_[_0xfc0b('0x37')](_0x340bca,{'autoCreate':_0x416b3f}),'contact':_0x4ac994===undefined?{}:_0x4ac994,'contacts':_0x4c9483[_0xfc0b('0x38')]===0x0?undefined:_0x4c9483});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d1e12cf..f7e75c6 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 _0xd664=['toLowerCase','contactmanager','integration','exec','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','operator','value','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','util','lodash','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','motionChannel','undefined','voice','checkTriggers','checkTrigger','merge','Actions','length','interface','action','motionbar','browser','data1','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xd664,0xa5));var _0x4d66=function(_0x101c02,_0x27b6f0){_0x101c02=_0x101c02-0x0;var _0x1d7654=_0xd664[_0x101c02];return _0x1d7654;};'use strict';var util=require(_0x4d66('0x0'));var _=require(_0x4d66('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x4d66('0x2'));var integration=require(_0x4d66('0x3'));var cmContact=require('./cmContact');var script=require(_0x4d66('0x4'));var config=require(_0x4d66('0x5'));var logger=require(_0x4d66('0x6'))(_0x4d66('0x7'));var ami=require(_0x4d66('0x8'));config['redis']=_[_0x4d66('0x9')](config[_0x4d66('0xa')],{'host':_0x4d66('0xb'),'port':0x18eb});var io=require(_0x4d66('0xc'))(new Redis(config[_0x4d66('0xa')]));var operators={'equals':function(_0x2eb5b6,_0x434138){return _0x2eb5b6==_0x434138;},'not_equals':function(_0xcea314,_0x958e74){return _0xcea314!=_0x958e74;}};var barAndWebActions=[_0x4d66('0xd'),'url',_0x4d66('0xe')];function Trigger(_0x1b6432){this[_0x4d66('0xf')]=_0x1b6432[_0x4d66('0xf')];this[_0x4d66('0x10')]=_0x1b6432[_0x4d66('0x10')];this[_0x4d66('0x11')]=_0x1b6432[_0x4d66('0x11')];this[_0x4d66('0x12')]=_0x1b6432[_0x4d66('0x12')];this[_0x4d66('0x13')]=_0x1b6432[_0x4d66('0x13')];this[_0x4d66('0x14')]=_0x1b6432[_0x4d66('0x14')];this['freshdeskAccounts']=_0x1b6432[_0x4d66('0x15')];this['salesforceAccounts']=_0x1b6432[_0x4d66('0x16')];this[_0x4d66('0x17')]=_0x1b6432[_0x4d66('0x17')];this['zohoAccounts']=_0x1b6432[_0x4d66('0x18')];this[_0x4d66('0x19')]=_0x1b6432[_0x4d66('0x19')];this['vtigerAccounts']=_0x1b6432[_0x4d66('0x1a')];this[_0x4d66('0x1b')]=_0x1b6432[_0x4d66('0x1b')];this['dynamics365Accounts']=_0x1b6432[_0x4d66('0x1c')];this[_0x4d66('0x1d')]=_0x1b6432[_0x4d66('0x1d')];this[_0x4d66('0x1e')]={'zendesk':this[_0x4d66('0x14')],'salesforce':this[_0x4d66('0x16')],'freshdesk':this[_0x4d66('0x15')],'sugarcrm':this[_0x4d66('0x17')],'zoho':this[_0x4d66('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x4d66('0x1a')],'dynamics365':this[_0x4d66('0x1c')],'freshsales':this[_0x4d66('0x1d')],'servicenow':this[_0x4d66('0x1b')]};ami['on'](_0x4d66('0x1f'),this['syncCustomEvent'][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x21'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on']('custom:agentringnoanswer',this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x23'),this[_0x4d66('0x22')]['bind'](this));ami['on'](_0x4d66('0x24'),this[_0x4d66('0x22')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0x4d66('0x22')]['bind'](this));ami['on'](_0x4d66('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4d66('0x26'),this['syncCustomEvent'][_0x4d66('0x20')](this));ami['on']('custom:agentreject',this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x27'),this[_0x4d66('0x22')]['bind'](this));ami['on'](_0x4d66('0x28'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x29'),this[_0x4d66('0x22')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on']('custom:dialconnect',this[_0x4d66('0x2a')]['bind'](this));ami['on'](_0x4d66('0x2b'),this[_0x4d66('0x2a')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x2c'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on']('custom:closedinteraction',this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x2d'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x2e'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x2f'),this[_0x4d66('0x22')][_0x4d66('0x20')](this));ami['on'](_0x4d66('0x30'),this[_0x4d66('0x22')]['bind'](this));ami['on'](_0x4d66('0x31'),this[_0x4d66('0x22')]['bind'](this));ami['on'](_0x4d66('0x32'),this['syncCustomEvent']['bind'](this));}Trigger['prototype'][_0x4d66('0x33')]=function(_0x3290b7,_0x297db6,_0xf0d5eb){logger[_0x4d66('0x34')](_0x3290b7,_0x297db6,JSON[_0x4d66('0x35')](_0xf0d5eb));io['to'](_0x3290b7)[_0x4d66('0x33')](_0x297db6,_0xf0d5eb);};Trigger[_0x4d66('0x36')][_0x4d66('0x22')]=function(_0x4c4d9b){var _0x551deb=_['clone'](_0x4c4d9b);if(typeof _0x551deb[_0x4d66('0x37')]===_0x4d66('0x38')){_0x551deb[_0x4d66('0x37')]=_0x4d66('0x39');}this['checkTriggers'](_0x551deb);};Trigger['prototype'][_0x4d66('0x2a')]=function(_0x98f08c){if(this[_0x4d66('0x10')][_0x98f08c['interface']]){this[_0x4d66('0x22')](_0x98f08c);}};Trigger[_0x4d66('0x36')][_0x4d66('0x3a')]=function(_0x2e50f5){var _0x2eee3a;for(var _0x296d1a in this[_0x4d66('0xf')]){if(this[_0x4d66('0xf')]['hasOwnProperty'](_0x296d1a)){if(this[_0x4d66('0xf')][_0x296d1a]['status']){_0x2eee3a=this[_0x4d66('0x3b')](this[_0x4d66('0xf')][_0x296d1a],_0x2e50f5);if(_0x2eee3a){_[_0x4d66('0x3c')](_0x2e50f5,_0x2e50f5['variables']);for(var _0x4993ce=0x0,_0x3a6c60,_0x57652a,_0xcf8c19;_0x4993ce0x0){_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 _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0xed70b3,_0x1a54a){var _0x2ed0ec=function(_0x44acee){while(--_0x44acee){_0xed70b3['push'](_0xed70b3['shift']());}};_0x2ed0ec(++_0x1a54a);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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 a1320a9..b9acd71 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 _0xb313=['phonecall','callDirection','queue','/contacts(','phonecalls','assign','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','clientSecret','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','customField','idField','indexOf','content','incidents','getString','Subjects','Descriptions','Fields','ticketType'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb313,0x1d5));var _0x3b31=function(_0x27bd57,_0x40c4d5){_0x27bd57=_0x27bd57-0x0;var _0x35e9c6=_0xb313[_0x27bd57];return _0x35e9c6;};'use strict';var _=require(_0x3b31('0x0'));var rp=require(_0x3b31('0x1'));var util=require(_0x3b31('0x2'));var intUtil=require(_0x3b31('0x3'));var md5=require(_0x3b31('0x4'));var Redis=require(_0x3b31('0x5'));var logger=require(_0x3b31('0x6'))('dynamics365');var config=require(_0x3b31('0x7'));config[_0x3b31('0x8')]=_[_0x3b31('0x9')](config[_0x3b31('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3b31('0xa'))(new Redis(config[_0x3b31('0x8')]));function getAuthToken(_0x39a8e9,_0x40a5cd,_0x2b3843){if(_0x39a8e9['modernAuthentication']){_0x39a8e9[_0x3b31('0xb')]=_0x39a8e9[_0x3b31('0xc')][_0x3b31('0xd')];_0x39a8e9[_0x3b31('0xe')]=_0x39a8e9[_0x3b31('0xc')][_0x3b31('0xf')];return Promise[_0x3b31('0x10')](_0x39a8e9['CloudProvider'][_0x3b31('0x11')]);}var _0x2f7c5b={'method':_0x3b31('0x12'),'uri':_0x40a5cd,'form':{'client_id':_0x39a8e9['clientId'],'resource':_0x39a8e9['remoteUri'],'username':_0x39a8e9[_0x3b31('0x13')],'password':_0x39a8e9['password'],'grant_type':_0x3b31('0x14'),'client_secret':_0x39a8e9[_0x3b31('0x15')]},'json':!![]};return rp(_0x2f7c5b)['then'](function(_0x221701){return _0x221701[_0x3b31('0x16')];})[_0x3b31('0x17')](function(_0x159385){logger['error']('['+[_0x2b3843[_0x3b31('0x18')]()]+_0x3b31('0x19'));return _0x159385[_0x3b31('0x1a')];});}function getUser(_0x30f9d0,_0x2684df,_0x57707c,_0x4e1208,_0x4b675b,_0x289349){return new Promise(function(_0x4497a8,_0x5d03c7){return getAuthToken(_0x2684df,_0x4e1208,_0x289349)[_0x3b31('0x1b')](function(_0x9eb8b2){var _0x4619e8={'method':_0x3b31('0x1c'),'uri':_0x4b675b+_0x3b31('0x1d'),'headers':{'Authorization':_0x3b31('0x1e')+_0x9eb8b2,'OData-Version':_0x3b31('0x1f')},'json':!![]};return rp(_0x4619e8);})[_0x3b31('0x1b')](function(_0x2bfe52){var _0x29aeba=_0x2bfe52[_0x3b31('0x20')];var _0x14920b=![];var _0x3389a0=null;if(!_[_0x3b31('0x21')](_0x57707c)){if(intUtil[_0x3b31('0x22')](_0x57707c[_0x3b31('0x23')])){_0x30f9d0[_0x3b31('0x24')]=_0x57707c['email'];for(_0x3389a0=0x0;_0x3389a0<_0x29aeba[_0x3b31('0x25')];_0x3389a0++){if(_0x29aeba[_0x3389a0][_0x3b31('0x26')]===_0x57707c[_0x3b31('0x23')]&&!_0x29aeba[_0x3389a0]['isdisabled']){_0x14920b=!![];logger[_0x3b31('0x27')]('['+[_0x289349[_0x3b31('0x18')]()]+_0x3b31('0x28')+_0x29aeba[_0x3389a0][_0x3b31('0x29')]+'!');_0x30f9d0[_0x3b31('0x2a')]=_0x29aeba[_0x3389a0][_0x3b31('0x29')];}}}}if(!_0x14920b){logger[_0x3b31('0x27')]('['+[_0x289349[_0x3b31('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x30f9d0[_0x3b31('0x24')]=_0x2684df[_0x3b31('0x13')];for(_0x3389a0=0x0;_0x3389a0<_0x29aeba['length'];_0x3389a0++){if(_0x29aeba[_0x3389a0][_0x3b31('0x26')]===_0x2684df[_0x3b31('0x13')]){_0x30f9d0['userId']=_0x29aeba[_0x3389a0]['systemuserid'];}}}_0x4497a8(_0x30f9d0);})[_0x3b31('0x17')](function(_0x434c4f){_0x5d03c7(_0x434c4f[_0x3b31('0x1a')]);});});}function createEndUser(_0x110a13,_0x3a9829,_0xc2ae6e,_0x5a3dc1,_0x488b5e,_0x415400,_0x464eac){return new Promise(function(_0x44e49a,_0x3f728c){return getAuthToken(_0x3a9829,_0xc2ae6e,_0x415400)[_0x3b31('0x1b')](function(_0x4bb287){var _0x25b32b=_0x415400[_0x3b31('0x2b')]()===_0x3b31('0x2c')?_0x488b5e[_0x3b31('0x2d')]:_0x488b5e[_0x3b31('0x2e')];var _0x2eb390={'method':_0x3b31('0x12'),'uri':_0x5a3dc1+'contacts','body':{'fullname':_0x25b32b,'firstname':_0x25b32b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b31('0x2f')+_0x110a13[_0x3b31('0x2a')]+')'},'headers':{'Authorization':_0x3b31('0x1e')+_0x4bb287,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2eb390[_0x3b31('0x30')][_0x464eac]=_0x25b32b;return rp(_0x2eb390);})[_0x3b31('0x1b')](function(_0x4b3d9a){var _0x146b3b=_0x4b3d9a[_0x3b31('0x31')]['odata-entityid'];var _0x4ee49c=_0x146b3b[_0x3b31('0x32')](_0x146b3b['lastIndexOf']('(')+0x1,_0x146b3b[_0x3b31('0x33')](')'));_0x110a13[_0x3b31('0x34')]=_0x4ee49c;_0x44e49a(_0x110a13);})['catch'](function(_0x313d7e){_0x3f728c(_0x313d7e[_0x3b31('0x1a')]);});});}function getEndUser(_0x2e3493,_0x42f232,_0x3a4a92,_0x4aaded,_0x471e1f,_0x460f69,_0x3099f4,_0x280ca9){var _0x4a6963=_0x460f69[_0x3b31('0x2b')]()===_0x3b31('0x2c')?_0x471e1f[_0x3b31('0x2d')]:_0x471e1f[_0x3b31('0x2e')];return getAuthToken(_0x42f232,_0x3a4a92,_0x460f69)[_0x3b31('0x1b')](function(_0x3300dd){_0x280ca9=_0x280ca9?_0x280ca9:_0x3b31('0x35');var _0x1f873d={'method':_0x3b31('0x1c'),'uri':_0x4aaded+_0x3b31('0x36')+_0x280ca9+'&$filter='+_0x280ca9+_0x3b31('0x37')+_0x4a6963[_0x3b31('0x38')]('+',_0x3b31('0x39'))+'\x27','headers':{'Authorization':_0x3b31('0x1e')+_0x3300dd,'If-None-Match':null,'OData-Version':_0x3b31('0x1f')},'json':!![]};return rp(_0x1f873d);})[_0x3b31('0x1b')](function(_0x5e51a4){var _0x2983d4=![];if(!_0x5e51a4)return _0x2983d4;var _0x3fb896=_0x5e51a4[_0x3b31('0x20')];for(var _0x366020=0x0;_0x366020<_0x3fb896[_0x3b31('0x25')];_0x366020++){if(_0x3fb896[_0x366020][_0x280ca9]===_0x4a6963){_0x2983d4=!![];_0x2e3493['enduserId']=_0x3fb896[_0x366020][_0x3b31('0x3a')];}}return _0x2983d4;})[_0x3b31('0x1b')](function(_0x2e516b){if(_0x2e516b)return _0x2e3493;if(_0x3099f4===_0x3b31('0x3b')){logger[_0x3b31('0x27')]('['+[_0x460f69[_0x3b31('0x18')]()]+_0x3b31('0x3c'));return _0x2e3493;}return createEndUser(_0x2e3493,_0x42f232,_0x3a4a92,_0x4aaded,_0x471e1f,_0x460f69,_0x280ca9)[_0x3b31('0x1b')](function(_0x2915a5){logger[_0x3b31('0x27')]('['+[_0x460f69[_0x3b31('0x18')]()]+_0x3b31('0x3d'),_0x2915a5['enduserId']);return _0x2915a5;});});}function getCustomFields(_0x4a8b8d,_0x260d70,_0x4482db){var _0x1cbc51={};if(_0x4a8b8d[_0x3b31('0x25')]>0x0){_[_0x3b31('0x3e')](_0x4a8b8d,function(_0x946980){if(_[_0x3b31('0x3f')]([_0x3b31('0x40'),'picklist'],_0x946980[_0x3b31('0x41')])&&_0x946980['nameField']&&!_0x946980[_0x3b31('0x42')]){var _0x12e002=_0x946980[_0x3b31('0x43')]['toLowerCase']();var _0x212c24=_0x12e002[_0x3b31('0x32')](0x0,_0x12e002['indexOf']('_'));var _0x327663=_0x12e002[_0x3b31('0x32')](_0x12e002[_0x3b31('0x44')]('_')+0x1);if(_0x212c24===_0x4482db){_0x1cbc51[_0x327663]=_0x946980[_0x3b31('0x45')];}}});}return _0x1cbc51;}function getTicket(_0x5d260f,_0x1a1245,_0x353672,_0x4dbede,_0x3ef044,_0x2ee053,_0x1b70e8){return new Promise(function(_0x308f11,_0x2c0856){var _0x4ad9f0;return getAuthToken(_0x1a1245,_0x353672,_0x1b70e8)[_0x3b31('0x1b')](function(_0x52ced9){if(_0x2ee053['ticketType']==='incident'){_0x4ad9f0={'method':_0x3b31('0x12'),'uri':_0x4dbede+_0x3b31('0x46'),'body':Object['assign']({},{'title':intUtil[_0x3b31('0x47')](_0x2ee053[_0x3b31('0x48')],_0x3ef044,'\x20'),'description':intUtil['getString'](_0x2ee053[_0x3b31('0x49')],_0x3ef044,'\x0a'),'customerid_contact@odata.bind':_0x5d260f['enduserId']?'/contacts('+_0x5d260f['enduserId']+')':undefined,'ownerid@odata.bind':_0x3b31('0x2f')+_0x5d260f['userId']+')','caseorigincode':'1'},getCustomFields(_0x2ee053[_0x3b31('0x4a')],_0x3ef044,_0x2ee053[_0x3b31('0x4b')])),'headers':{'Authorization':_0x3b31('0x1e')+_0x52ced9,'OData-Version':_0x3b31('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2ee053[_0x3b31('0x4b')]===_0x3b31('0x4c')){var _0x5ddddb=_0x5d260f[_0x3b31('0x34')]?[{'partyid_systemuser@odata.bind':_0x3b31('0x2f')+_0x5d260f[_0x3b31('0x2a')]+')','participationtypemask':_0x5d260f[_0x3b31('0x4d')]===_0x3b31('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x3b31('0x4f')+_0x5d260f[_0x3b31('0x34')]+')','participationtypemask':_0x5d260f[_0x3b31('0x4d')]===_0x3b31('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3b31('0x2f')+_0x5d260f[_0x3b31('0x2a')]+')','participationtypemask':_0x5d260f[_0x3b31('0x4d')]===_0x3b31('0x4e')?0x2:0x1}];_0x4ad9f0={'method':_0x3b31('0x12'),'uri':_0x4dbede+_0x3b31('0x50'),'body':Object[_0x3b31('0x51')]({},{'subject':intUtil[_0x3b31('0x47')](_0x2ee053[_0x3b31('0x48')],_0x3ef044,'\x20'),'phonenumber':String(_0x3ef044['calleridnum']),'description':intUtil[_0x3b31('0x47')](_0x2ee053['Descriptions'],_0x3ef044,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5d260f['enduserId']?_0x3b31('0x4f')+_0x5d260f[_0x3b31('0x34')]+')':undefined,'ownerid@odata.bind':_0x3b31('0x2f')+_0x5d260f[_0x3b31('0x2a')]+')','directioncode':_0x5d260f[_0x3b31('0x4d')]===_0x3b31('0x4e')?![]:!![],'phonecall_activity_parties':_0x5ddddb},getCustomFields(_0x2ee053[_0x3b31('0x4a')],_0x3ef044,_0x2ee053[_0x3b31('0x4b')])),'headers':{'Authorization':_0x3b31('0x1e')+_0x52ced9,'OData-Version':_0x3b31('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4ad9f0);})['then'](function(_0x345acc){var _0x1e67d6=_0x345acc[_0x3b31('0x31')][_0x3b31('0x52')];var _0x110fc0=_0x1e67d6[_0x3b31('0x32')](_0x1e67d6[_0x3b31('0x33')]('(')+0x1,_0x1e67d6[_0x3b31('0x33')](')'));_0x5d260f[_0x3b31('0x53')]=_0x110fc0;_0x308f11(_0x5d260f);})['catch'](function(_0x3a82bc){_0x2c0856(_0x3a82bc[_0x3b31('0x1a')]);});});}function emit(_0x434945,_0x29421b,_0x5487f7,_0x4cb98b){var _0x1544a4={'uri':util[_0x3b31('0x54')](_0x3b31('0x55'),_0x434945,_0x5487f7,_0x4cb98b)};io['to'](util['format']('user:%s',_0x29421b))[_0x3b31('0x56')]('trigger:browser:url',_0x1544a4);}exports['cs']=function(_0x45adbf,_0xff4ad1,_0xdcaa66,_0x2367ed,_0x537673,_0x3d5f92,_0x196e3a,_0x300ac1){var _0x4123c5={};_0x3d5f92[_0x3b31('0xb')]=_0x3d5f92[_0x3b31('0x57')]?intUtil[_0x3b31('0x58')](_0x3d5f92[_0x3b31('0xc')][_0x3b31('0xd')]):intUtil[_0x3b31('0x58')](_0x3d5f92[_0x3b31('0xb')]);_0x3d5f92['serverUrl']=intUtil[_0x3b31('0x58')](_0x3d5f92[_0x3b31('0x59')]);_0x4123c5[_0x3b31('0x4d')]=_0x300ac1===_0x3b31('0x4e')||_0x300ac1===_0x3b31('0x5a')?_0x3b31('0x4e'):_0x3b31('0x2c');var _0x2e0fbb=_0x3d5f92[_0x3b31('0x57')]?util[_0x3b31('0x54')](_0x3b31('0x5b'),_0x3d5f92[_0x3b31('0xc')][_0x3b31('0xd')]):util[_0x3b31('0x54')](_0x3b31('0x5b'),_0x3d5f92['remoteUri']);var _0x42e154=util[_0x3b31('0x54')](_0x3b31('0x5c'),_0x3d5f92['tenantId']);var _0x1e7a19=util['format'](_0x3b31('0x5d'),_0x3d5f92[_0x3b31('0x59')],_0xff4ad1[_0x3b31('0x5e')],md5(_0xff4ad1[_0x3b31('0x5e')]));if(_0x537673&&_0x537673[_0x3b31('0x5f')]){logger[_0x3b31('0x27')](_0x3b31('0x60'),_0x3b31('0x61'));_0xff4ad1['recordingURL']=_0x1e7a19;}else if(_0x196e3a&&_0x196e3a[_0x3b31('0x62')]&&_0x196e3a[_0x3b31('0x62')]!=='none'){logger['info'](_0x3b31('0x63'),'Recording\x20is\x20enabled!');_0xff4ad1['recordingURL']=_0x1e7a19;}else{_0xff4ad1['recordingURL']='';}return getUser(_0x4123c5,_0x3d5f92,_0x2367ed,_0x42e154,_0x2e0fbb,_0x300ac1)[_0x3b31('0x1b')](function(_0x290d04){logger[_0x3b31('0x27')]('['+_0x300ac1[_0x3b31('0x18')]()+_0x3b31('0x64'),_0x290d04['userId']);logger[_0x3b31('0x27')]('['+_0x300ac1[_0x3b31('0x18')]()+_0x3b31('0x65'),_0x290d04['userEmail']);return getEndUser(_0x290d04,_0x3d5f92,_0x42e154,_0x2e0fbb,_0xff4ad1,_0x300ac1,_0xdcaa66[_0x3b31('0x66')],_0xdcaa66['additionalSearchContact']);})[_0x3b31('0x1b')](function(_0x30a457){logger[_0x3b31('0x27')]('['+_0x300ac1['toUpperCase']()+_0x3b31('0x67'),_0x30a457['enduserId']);logger[_0x3b31('0x27')]('['+_0x300ac1[_0x3b31('0x18')]()+_0x3b31('0x68'),_0xff4ad1[_0x3b31('0x2e')]);return getTicket(_0x30a457,_0x3d5f92,_0x42e154,_0x2e0fbb,_0xff4ad1,_0xdcaa66,_0x300ac1);})[_0x3b31('0x1b')](function(_0x2d3bde){logger['info'](util[_0x3b31('0x54')]('['+_0x300ac1[_0x3b31('0x18')]()+_0x3b31('0x69'),_0xdcaa66[_0x3b31('0x4b')],_0x2d3bde[_0x3b31('0x53')]));logger[_0x3b31('0x27')](util[_0x3b31('0x54')]('['+_0x300ac1[_0x3b31('0x18')]()+_0x3b31('0x6a'),_0x300ac1));if(_0x300ac1!==_0x3b31('0x5a')&&_0xdcaa66['openNewTab']){logger[_0x3b31('0x27')]('['+_0x300ac1[_0x3b31('0x18')]()+']',_0x3b31('0x6b'));emit(_0x3d5f92[_0x3b31('0xb')],_0x2367ed['name'],_0xdcaa66[_0x3b31('0x4b')],_0x2d3bde[_0x3b31('0x53')]);}})[_0x3b31('0x17')](function(_0x56636f){logger[_0x3b31('0x6c')]('['+_0x300ac1[_0x3b31('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x56636f[_0x3b31('0x1a')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x56636f);});}; \ No newline at end of file +var _0x421b=['%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\x20ID\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incidents','getString','/contacts(','Fields','callDirection','queue','phonecalls','assign','Subjects','Descriptions','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x2130f6,_0x2f0a73){var _0xdba2be=function(_0x4e0c25){while(--_0x4e0c25){_0x2130f6['push'](_0x2130f6['shift']());}};_0xdba2be(++_0x2f0a73);}(_0x421b,0x81));var _0xb421=function(_0x17a020,_0x1b7d52){_0x17a020=_0x17a020-0x0;var _0x41c51c=_0x421b[_0x17a020];return _0x41c51c;};'use strict';var _=require('lodash');var rp=require(_0xb421('0x0'));var util=require(_0xb421('0x1'));var intUtil=require(_0xb421('0x2'));var md5=require(_0xb421('0x3'));var Redis=require(_0xb421('0x4'));var logger=require(_0xb421('0x5'))(_0xb421('0x6'));var config=require(_0xb421('0x7'));config[_0xb421('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb421('0x9'))(new Redis(config['redis']));function getAuthToken(_0x29635a,_0x8bc69d,_0x19578d){if(_0x29635a[_0xb421('0xa')]){_0x29635a[_0xb421('0xb')]=_0x29635a[_0xb421('0xc')][_0xb421('0xd')];_0x29635a[_0xb421('0xe')]=_0x29635a[_0xb421('0xc')][_0xb421('0xf')];return Promise[_0xb421('0x10')](_0x29635a[_0xb421('0xc')][_0xb421('0x11')]);}var _0x7fcc15={'method':_0xb421('0x12'),'uri':_0x8bc69d,'form':{'client_id':_0x29635a[_0xb421('0x13')],'resource':_0x29635a['remoteUri'],'username':_0x29635a['username'],'password':_0x29635a[_0xb421('0x14')],'grant_type':_0xb421('0x14'),'client_secret':_0x29635a['clientSecret']},'json':!![]};return rp(_0x7fcc15)[_0xb421('0x15')](function(_0x4c937f){return _0x4c937f[_0xb421('0x16')];})[_0xb421('0x17')](function(_0x707add){logger[_0xb421('0x18')]('['+[_0x19578d[_0xb421('0x19')]()]+_0xb421('0x1a'));return _0x707add[_0xb421('0x1b')];});}function getUser(_0x5c744f,_0x4d5d8b,_0x323970,_0xd43f5a,_0x5b89da,_0x2428a1){return new Promise(function(_0x17f99c,_0x4138ff){return getAuthToken(_0x4d5d8b,_0xd43f5a,_0x2428a1)[_0xb421('0x15')](function(_0x75055d){var _0x93d1fc={'method':_0xb421('0x1c'),'uri':_0x5b89da+_0xb421('0x1d'),'headers':{'Authorization':_0xb421('0x1e')+_0x75055d,'OData-Version':_0xb421('0x1f')},'json':!![]};return rp(_0x93d1fc);})['then'](function(_0x46187c){var _0xdee179=_0x46187c[_0xb421('0x20')];var _0x3da2bf=![];var _0x19a7ec=null;if(!_[_0xb421('0x21')](_0x323970)){if(intUtil[_0xb421('0x22')](_0x323970[_0xb421('0x23')])){_0x5c744f['userEmail']=_0x323970[_0xb421('0x23')];for(_0x19a7ec=0x0;_0x19a7ec<_0xdee179[_0xb421('0x24')];_0x19a7ec++){if(_0xdee179[_0x19a7ec][_0xb421('0x25')]===_0x323970['email']&&!_0xdee179[_0x19a7ec]['isdisabled']){_0x3da2bf=!![];logger['info']('['+[_0x2428a1[_0xb421('0x19')]()]+_0xb421('0x26')+_0xdee179[_0x19a7ec][_0xb421('0x27')]+'!');_0x5c744f[_0xb421('0x28')]=_0xdee179[_0x19a7ec]['systemuserid'];}}}}if(!_0x3da2bf){logger[_0xb421('0x29')]('['+[_0x2428a1[_0xb421('0x19')]()]+_0xb421('0x2a'));_0x5c744f[_0xb421('0x2b')]=_0x4d5d8b['username'];for(_0x19a7ec=0x0;_0x19a7ec<_0xdee179[_0xb421('0x24')];_0x19a7ec++){if(_0xdee179[_0x19a7ec][_0xb421('0x25')]===_0x4d5d8b['username']){_0x5c744f[_0xb421('0x28')]=_0xdee179[_0x19a7ec][_0xb421('0x27')];}}}_0x17f99c(_0x5c744f);})[_0xb421('0x17')](function(_0x331a8a){_0x4138ff(_0x331a8a[_0xb421('0x1b')]);});});}function createEndUser(_0x531300,_0x5d9efb,_0x3c87f2,_0x4a87ae,_0x48e72c,_0x2ac6b7,_0x106d9a){return new Promise(function(_0x4e8e69,_0x1f24f5){return getAuthToken(_0x5d9efb,_0x3c87f2,_0x2ac6b7)[_0xb421('0x15')](function(_0x37ab5c){var _0x1eac10=_0x2ac6b7[_0xb421('0x2c')]()===_0xb421('0x2d')?_0x48e72c[_0xb421('0x2e')]:_0x48e72c['calleridnum'];var _0x1c3d26={'method':'POST','uri':_0x4a87ae+_0xb421('0x2f'),'body':{'fullname':_0x1eac10,'firstname':_0x1eac10,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb421('0x30')+_0x531300[_0xb421('0x28')]+')'},'headers':{'Authorization':_0xb421('0x1e')+_0x37ab5c,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x1c3d26[_0xb421('0x31')][_0x106d9a]=_0x1eac10;return rp(_0x1c3d26);})[_0xb421('0x15')](function(_0x353adf){var _0xceb616=_0x353adf['headers'][_0xb421('0x32')];var _0x187c30=_0xceb616[_0xb421('0x33')](_0xceb616[_0xb421('0x34')]('(')+0x1,_0xceb616['lastIndexOf'](')'));_0x531300[_0xb421('0x35')]=_0x187c30;_0x4e8e69(_0x531300);})['catch'](function(_0x262fce){_0x1f24f5(_0x262fce['message']);});});}function getEndUser(_0x3f38c6,_0x2b8f6b,_0x2df8b2,_0xf20f1a,_0x50f03d,_0x19f278,_0x16c5c4,_0x3e5b4f){var _0x980cc4=_0x19f278[_0xb421('0x2c')]()===_0xb421('0x2d')?_0x50f03d[_0xb421('0x2e')]:_0x50f03d[_0xb421('0x36')];return getAuthToken(_0x2b8f6b,_0x2df8b2,_0x19f278)[_0xb421('0x15')](function(_0x464ad6){_0x3e5b4f=_0x3e5b4f?_0x3e5b4f:_0xb421('0x37');var _0x44cacf={'method':_0xb421('0x1c'),'uri':_0xf20f1a+_0xb421('0x38')+_0x3e5b4f+_0xb421('0x39')+_0x3e5b4f+_0xb421('0x3a')+_0x980cc4['replace']('+',_0xb421('0x3b'))+'\x27','headers':{'Authorization':_0xb421('0x1e')+_0x464ad6,'If-None-Match':null,'OData-Version':_0xb421('0x1f')},'json':!![]};return rp(_0x44cacf);})[_0xb421('0x15')](function(_0x391013){var _0x2e1868=![];if(!_0x391013)return _0x2e1868;var _0x35fa8b=_0x391013['value'];for(var _0x270b3b=0x0;_0x270b3b<_0x35fa8b[_0xb421('0x24')];_0x270b3b++){if(_0x35fa8b[_0x270b3b][_0x3e5b4f]===_0x980cc4){_0x2e1868=!![];_0x3f38c6[_0xb421('0x35')]=_0x35fa8b[_0x270b3b][_0xb421('0x3c')];}}return _0x2e1868;})[_0xb421('0x15')](function(_0x4e1b4b){if(_0x4e1b4b)return _0x3f38c6;if(_0x16c5c4==='nothing'){logger[_0xb421('0x29')]('['+[_0x19f278[_0xb421('0x19')]()]+_0xb421('0x3d'));return _0x3f38c6;}return createEndUser(_0x3f38c6,_0x2b8f6b,_0x2df8b2,_0xf20f1a,_0x50f03d,_0x19f278,_0x3e5b4f)[_0xb421('0x15')](function(_0xed08e2){logger['info']('['+[_0x19f278[_0xb421('0x19')]()]+_0xb421('0x3e'),_0xed08e2[_0xb421('0x35')]);return _0xed08e2;});});}function getCustomFields(_0x4af4f0,_0x12f5c3,_0x2df43a){var _0xb6b449={};if(_0x4af4f0['length']>0x0){_[_0xb421('0x3f')](_0x4af4f0,function(_0x125ceb){if(_[_0xb421('0x40')]([_0xb421('0x41'),_0xb421('0x42')],_0x125ceb[_0xb421('0x43')])&&_0x125ceb[_0xb421('0x44')]&&!_0x125ceb[_0xb421('0x45')]){var _0x31a3f4=_0x125ceb['idField'][_0xb421('0x2c')]();var _0x486db5=_0x31a3f4['substring'](0x0,_0x31a3f4[_0xb421('0x46')]('_'));var _0x4b2f51=_0x31a3f4['substring'](_0x31a3f4[_0xb421('0x46')]('_')+0x1);if(_0x486db5===_0x2df43a){_0xb6b449[_0x4b2f51]=_0x125ceb[_0xb421('0x47')];}}});}return _0xb6b449;}function getTicket(_0x3909f4,_0x23ac61,_0x5a8a39,_0x20bc7a,_0x2ed2b4,_0xd322b0,_0x38b7c1){return new Promise(function(_0xd0abf3,_0xc0f9b2){var _0x517a4c;return getAuthToken(_0x23ac61,_0x5a8a39,_0x38b7c1)[_0xb421('0x15')](function(_0x1e17ae){if(_0xd322b0[_0xb421('0x48')]==='incident'){_0x517a4c={'method':_0xb421('0x12'),'uri':_0x20bc7a+_0xb421('0x49'),'body':Object['assign']({},{'title':intUtil[_0xb421('0x4a')](_0xd322b0['Subjects'],_0x2ed2b4,'\x20'),'description':intUtil[_0xb421('0x4a')](_0xd322b0['Descriptions'],_0x2ed2b4,'\x0a'),'customerid_contact@odata.bind':_0x3909f4[_0xb421('0x35')]?_0xb421('0x4b')+_0x3909f4['enduserId']+')':undefined,'ownerid@odata.bind':_0xb421('0x30')+_0x3909f4['userId']+')','caseorigincode':'1'},getCustomFields(_0xd322b0[_0xb421('0x4c')],_0x2ed2b4,_0xd322b0[_0xb421('0x48')])),'headers':{'Authorization':_0xb421('0x1e')+_0x1e17ae,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd322b0[_0xb421('0x48')]==='phonecall'){var _0xfb5b6e=_0x3909f4[_0xb421('0x35')]?[{'partyid_systemuser@odata.bind':_0xb421('0x30')+_0x3909f4[_0xb421('0x28')]+')','participationtypemask':_0x3909f4['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3909f4['enduserId']+')','participationtypemask':_0x3909f4[_0xb421('0x4d')]===_0xb421('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb421('0x30')+_0x3909f4['userId']+')','participationtypemask':_0x3909f4[_0xb421('0x4d')]===_0xb421('0x4e')?0x2:0x1}];_0x517a4c={'method':_0xb421('0x12'),'uri':_0x20bc7a+_0xb421('0x4f'),'body':Object[_0xb421('0x50')]({},{'subject':intUtil[_0xb421('0x4a')](_0xd322b0[_0xb421('0x51')],_0x2ed2b4,'\x20'),'phonenumber':String(_0x2ed2b4[_0xb421('0x36')]),'description':intUtil[_0xb421('0x4a')](_0xd322b0[_0xb421('0x52')],_0x2ed2b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3909f4[_0xb421('0x35')]?_0xb421('0x4b')+_0x3909f4[_0xb421('0x35')]+')':undefined,'ownerid@odata.bind':_0xb421('0x30')+_0x3909f4[_0xb421('0x28')]+')','directioncode':_0x3909f4[_0xb421('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0xfb5b6e},getCustomFields(_0xd322b0[_0xb421('0x4c')],_0x2ed2b4,_0xd322b0[_0xb421('0x48')])),'headers':{'Authorization':'Bearer\x20'+_0x1e17ae,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x517a4c);})[_0xb421('0x15')](function(_0x31ab11){var _0x104758=_0x31ab11[_0xb421('0x53')][_0xb421('0x32')];var _0x1861b1=_0x104758['substring'](_0x104758[_0xb421('0x34')]('(')+0x1,_0x104758[_0xb421('0x34')](')'));_0x3909f4['ticketId']=_0x1861b1;_0xd0abf3(_0x3909f4);})[_0xb421('0x17')](function(_0x4bf0e6){_0xc0f9b2(_0x4bf0e6['message']);});});}function emit(_0x165a15,_0x47be87,_0x25529f,_0x5c8f50){var _0xaa137f={'uri':util[_0xb421('0x54')](_0xb421('0x55'),_0x165a15,_0x25529f,_0x5c8f50)};io['to'](util['format'](_0xb421('0x56'),_0x47be87))[_0xb421('0x57')]('trigger:browser:url',_0xaa137f);}exports['cs']=function(_0x38b04e,_0x23524b,_0x34c247,_0x3351c5,_0x42ec02,_0x5e6bab,_0x2843c4,_0x198815){var _0x39bc89={};_0x5e6bab[_0xb421('0xb')]=_0x5e6bab[_0xb421('0xa')]?intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0xc')]['data7']):intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0xb')]);_0x5e6bab[_0xb421('0x59')]=intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0x59')]);_0x39bc89[_0xb421('0x4d')]=_0x198815===_0xb421('0x4e')||_0x198815===_0xb421('0x5a')?_0xb421('0x4e'):_0xb421('0x2d');var _0x4884e7=_0x5e6bab[_0xb421('0xa')]?util[_0xb421('0x54')]('%s/api/data/v9.0/',_0x5e6bab[_0xb421('0xc')][_0xb421('0xd')]):util[_0xb421('0x54')](_0xb421('0x5b'),_0x5e6bab['remoteUri']);var _0x224c44=util[_0xb421('0x54')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5e6bab[_0xb421('0xe')]);var _0x200cc4=util[_0xb421('0x54')](_0xb421('0x5c'),_0x5e6bab[_0xb421('0x59')],_0x23524b[_0xb421('0x5d')],md5(_0x23524b[_0xb421('0x5d')]));if(_0x42ec02&&_0x42ec02[_0xb421('0x5e')]){logger['info']('[QUEUE]',_0xb421('0x5f'));_0x23524b[_0xb421('0x60')]=_0x200cc4;}else if(_0x2843c4&&_0x2843c4[_0xb421('0x61')]&&_0x2843c4['recordingFormat']!==_0xb421('0x62')){logger[_0xb421('0x29')](_0xb421('0x63'),'Recording\x20is\x20enabled!');_0x23524b[_0xb421('0x60')]=_0x200cc4;}else{_0x23524b[_0xb421('0x60')]='';}return getUser(_0x39bc89,_0x5e6bab,_0x3351c5,_0x224c44,_0x4884e7,_0x198815)[_0xb421('0x15')](function(_0x35a9ac){logger['info']('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x64'),_0x35a9ac['userId']);logger['info']('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x35a9ac[_0xb421('0x2b')]);return getEndUser(_0x35a9ac,_0x5e6bab,_0x224c44,_0x4884e7,_0x23524b,_0x198815,_0x34c247[_0xb421('0x65')],_0x34c247['additionalSearchContact']);})['then'](function(_0x2763c7){logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2763c7['enduserId']);logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x23524b['calleridnum']);return getTicket(_0x2763c7,_0x5e6bab,_0x224c44,_0x4884e7,_0x23524b,_0x34c247,_0x198815);})['then'](function(_0x4f460e){logger[_0xb421('0x29')](util[_0xb421('0x54')]('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x66'),_0x34c247[_0xb421('0x48')],_0x4f460e['ticketId']));logger['info'](util['format']('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x67'),_0x198815));if(_0x198815!==_0xb421('0x5a')&&_0x34c247[_0xb421('0x68')]){logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']',_0xb421('0x69'));emit(_0x5e6bab['remoteUri'],_0x3351c5[_0xb421('0x6a')],_0x34c247[_0xb421('0x48')],_0x4f460e[_0xb421('0x6b')]);}})['catch'](function(_0x281ac5){logger[_0xb421('0x18')]('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x6c'),_0x281ac5[_0xb421('0x1b')]);console[_0xb421('0x18')](_0xb421('0x6d'),_0x281ac5);});}; \ 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 9e0e6b2..76231fd 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 _0xf2d0=['customField','push','type','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','toUpperCase','lastevent','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','name','Fields','mapValues','keyBy','custom_fields','value','format','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','content','idField'];(function(_0x277406,_0x448d2b){var _0x340e83=function(_0x32dd11){while(--_0x32dd11){_0x277406['push'](_0x277406['shift']());}};_0x340e83(++_0x448d2b);}(_0xf2d0,0x1ee));var _0x0f2d=function(_0x30c4e5,_0x8964dd){_0x30c4e5=_0x30c4e5-0x0;var _0x26ca98=_0xf2d0[_0x30c4e5];return _0x26ca98;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x0f2d('0x0'));var util=require(_0x0f2d('0x1'));var Redis=require(_0x0f2d('0x2'));var intUtil=require('./util');var config=require(_0x0f2d('0x3'));var logger=require(_0x0f2d('0x4'))(_0x0f2d('0x5'));config['redis']=_[_0x0f2d('0x6')](config[_0x0f2d('0x7')],{'host':_0x0f2d('0x8'),'port':0x18eb});var io=require(_0x0f2d('0x9'))(new Redis(config[_0x0f2d('0x7')]));var headers={'Content-Type':_0x0f2d('0xa'),'Accept':_0x0f2d('0xa')};function emit(_0x576d65,_0x5f0d0b,_0x8b123f){io['to'](_0x576d65)[_0x0f2d('0xb')](_0x5f0d0b,_0x8b123f);}function getTicket(_0x50446d,_0x1fbdcc,_0x54f8ac,_0x299c00,_0x2de1b7){logger['info'](_0x0f2d('0xc'));var _0x333210=_[_0x0f2d('0xd')]({'responder_id':_0x1fbdcc['id'],'requester_id':_0x54f8ac['id'],'name':util['format'](_0x0f2d('0xe'),_0x2de1b7[_0x0f2d('0xf')]),'phone':_0x2de1b7[_0x0f2d('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x299c00[_0x0f2d('0x11')],_0x2de1b7,'\x20'),'description':intUtil[_0x0f2d('0x12')](_0x299c00['Descriptions'],_0x2de1b7,_0x0f2d('0x13')),'tags':getTags(_0x299c00['Tags'],_0x0f2d('0x14'))},getCustomFields(_0x299c00[_0x0f2d('0x15')],_0x2de1b7));_0x333210['custom_fields']=_[_0x0f2d('0x16')](_[_0x0f2d('0x17')](_0x333210[_0x0f2d('0x18')],'id'),_0x0f2d('0x19'));return request({'uri':util[_0x0f2d('0x1a')]('%s/api/v2/tickets',_0x50446d[_0x0f2d('0x1b')]),'method':_0x0f2d('0x1c'),'body':_0x333210})[_0x0f2d('0x1d')](function(_0x207d02){logger[_0x0f2d('0x1e')](_0x0f2d('0x1f'));return _0x207d02;});}function getUser(_0x9a09a6,_0x4aab69){if(intUtil[_0x0f2d('0x20')](_0x4aab69)){return request({'uri':util['format'](_0x0f2d('0x21'),_0x9a09a6[_0x0f2d('0x1b')]),'qs':{'email':_0x4aab69}})[_0x0f2d('0x1d')](function(_0x27c570){if(_0x27c570[_0x0f2d('0x22')]){logger[_0x0f2d('0x1e')](_0x0f2d('0x23'));return _['find'](_0x27c570,function(_0x106420){return _0x106420[_0x0f2d('0x24')][_0x0f2d('0x25')]===_0x4aab69;});}else{logger[_0x0f2d('0x1e')](_0x0f2d('0x26'));return request({'uri':util[_0x0f2d('0x1a')]('%s/api/v2/agents/me',_0x9a09a6[_0x0f2d('0x1b')])})[_0x0f2d('0x1d')](function(_0x25c5b8){logger['info']('Admin\x20account\x20selected.');return _0x25c5b8;});}});}else{logger[_0x0f2d('0x1e')](_0x0f2d('0x27'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x9a09a6[_0x0f2d('0x1b')])})[_0x0f2d('0x1d')](function(_0x3db58c){logger[_0x0f2d('0x1e')](_0x0f2d('0x28'));return _0x3db58c;});}}function getEndUser(_0x377498,_0x183885,_0x24ddfc){logger[_0x0f2d('0x1e')](_0x0f2d('0x29'),_0x24ddfc);return request({'uri':util[_0x0f2d('0x1a')](_0x0f2d('0x2a'),_0x377498[_0x0f2d('0x1b')]),'qs':{'phone':_0x24ddfc}})[_0x0f2d('0x1d')](function(_0x20d141){if(_0x20d141['length']){logger[_0x0f2d('0x1e')]('Enduser\x20found!');return _[_0x0f2d('0x2b')](_0x20d141,{'phone':_0x24ddfc});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x0f2d('0x1a')](_0x0f2d('0x2a'),_0x377498[_0x0f2d('0x1b')]),'method':'POST','body':{'name':_0x183885,'phone':_0x24ddfc}})[_0x0f2d('0x1d')](function(_0x265417){logger[_0x0f2d('0x1e')](_0x0f2d('0x2c'));return _0x265417;});}});}function getAuth(_0x25bb06){return util[_0x0f2d('0x1a')](_0x0f2d('0x2d'),new Buffer(_0x25bb06[_0x0f2d('0x2e')]+':X')[_0x0f2d('0x2f')]('base64'));}function request(_0x41fdcc){logger[_0x0f2d('0x30')](_0x0f2d('0x31'),JSON[_0x0f2d('0x32')](_0x41fdcc));return rp(_[_0x0f2d('0x6')](_0x41fdcc,{'method':_0x0f2d('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x6b0abc,_0x20fe1c){var _0x35329e=[];if(_0x6b0abc&&_0x6b0abc[_0x0f2d('0x22')]>0x0){_0x35329e=_[_0x0f2d('0x34')](_0x6b0abc,_0x20fe1c);}return _0x35329e;}function getCustomFields(_0x180562,_0x31940c){var _0x19d7ae=[];var _0x26b09e={'custom_fields':[]};if(_0x180562[_0x0f2d('0x22')]>0x0){_[_0x0f2d('0x35')](_0x180562,function(_0x28405b){if(_[_0x0f2d('0x36')](['string',_0x0f2d('0x37')],_0x28405b['type'])&&_0x28405b['nameField']&&!_0x28405b['customField']){_0x26b09e[_0x28405b['nameField']['toLowerCase']()]=_0x28405b[_0x0f2d('0x38')]['toString']();}else if(_[_0x0f2d('0x36')](['string',_0x0f2d('0x37')],_0x28405b['type'])&&_0x28405b[_0x0f2d('0x39')]&&_0x28405b[_0x0f2d('0x3a')]){_0x26b09e[_0x0f2d('0x18')][_0x0f2d('0x3b')]({'id':_0x28405b[_0x0f2d('0x39')],'value':_0x28405b['content']['toString']()});}else if(_0x28405b[_0x0f2d('0x3c')]===_0x0f2d('0x3d')&&_0x28405b[_0x0f2d('0x3e')]&&_0x28405b[_0x0f2d('0x39')]&&_0x28405b[_0x0f2d('0x3a')]){_0x31940c[_0x28405b[_0x0f2d('0x3e')]]&&_0x26b09e[_0x0f2d('0x18')]['push']({'id':_0x28405b[_0x0f2d('0x39')],'value':_0x31940c[_0x28405b[_0x0f2d('0x3e')]][_0x0f2d('0x2f')]()});}else if(_0x28405b[_0x0f2d('0x3c')]==='customVariable'&&_0x28405b[_0x0f2d('0x3f')]&&_0x28405b['Variable'][_0x0f2d('0x14')]&&_0x28405b['idField']&&_0x28405b[_0x0f2d('0x3a')]){_0x31940c[_0x28405b[_0x0f2d('0x3f')][_0x0f2d('0x14')]['toLowerCase']()]&&_0x26b09e[_0x0f2d('0x18')][_0x0f2d('0x3b')]({'id':_0x28405b[_0x0f2d('0x39')],'value':_0x31940c[_0x28405b[_0x0f2d('0x3f')][_0x0f2d('0x14')][_0x0f2d('0x40')]()][_0x0f2d('0x2f')]()});}});}return _0x26b09e;}exports[_0x0f2d('0x41')]=function(_0x5eb3f7,_0x3c352a,_0x2a75c5,_0x17926e,_0x18ddc8,_0x93b62a){var _0x500462,_0x3eea55;_0x93b62a[_0x0f2d('0x1b')]=intUtil[_0x0f2d('0x42')](_0x93b62a[_0x0f2d('0x1b')]);_0x93b62a['serverUrl']=intUtil[_0x0f2d('0x42')](_0x93b62a['serverUrl']);if(_0x18ddc8&&_0x18ddc8[_0x0f2d('0x43')]){logger[_0x0f2d('0x1e')](_0x0f2d('0x44'),_0x0f2d('0x45'));_0x3c352a[_0x0f2d('0x46')]=util[_0x0f2d('0x1a')](_0x0f2d('0x47'),_0x93b62a['serverUrl'],_0x3c352a[_0x0f2d('0x48')],md5(_0x3c352a[_0x0f2d('0x48')]));}else{_0x3c352a['recordingURL']='';}headers[_0x0f2d('0x49')]=getAuth(_0x93b62a);return getUser(_0x93b62a,_0x17926e[_0x0f2d('0x25')])[_0x0f2d('0x1d')](function(_0x2b3248){_0x500462=_0x2b3248;logger[_0x0f2d('0x1e')](_0x0f2d('0x4a'),_0x500462['id']);return getEndUser(_0x93b62a,_0x3c352a[_0x0f2d('0xf')],_0x3c352a[_0x0f2d('0x10')]);})[_0x0f2d('0x1d')](function(_0x31bebb){_0x3eea55=_0x31bebb;logger[_0x0f2d('0x1e')](_0x0f2d('0x4b'),_0x3eea55['id']);return getTicket(_0x93b62a,_0x500462,_0x3eea55,_0x2a75c5,_0x3c352a);})['then'](function(_0x5ca187){if(_0x5ca187&&_0x5ca187['id']){logger['info'](_0x0f2d('0x1f'));logger[_0x0f2d('0x1e')](_0x0f2d('0x4c'),_0x5ca187['id']);logger[_0x0f2d('0x1e')](_0x0f2d('0x44'),_0x0f2d('0x4d'));emit(util[_0x0f2d('0x1a')](_0x0f2d('0x4e'),_0x17926e[_0x0f2d('0x14')]),'trigger:browser:url',{'uri':util[_0x0f2d('0x1a')](_0x0f2d('0x4f'),_0x93b62a[_0x0f2d('0x1b')],_0x5ca187['id'])});}})[_0x0f2d('0x50')](function(_0x423101){logger[_0x0f2d('0x51')](_0x0f2d('0x44'),JSON['stringify'](_0x423101));});};exports[_0x0f2d('0x52')]=function(_0x20c165,_0x190b0f,_0x4e825b,_0xabc7b0,_0x43dd56,_0x2826fc,_0x4c6672){var _0x1c60ac,_0x5281a1;_0x2826fc[_0x0f2d('0x1b')]=intUtil[_0x0f2d('0x42')](_0x2826fc[_0x0f2d('0x1b')]);_0x2826fc[_0x0f2d('0x53')]=intUtil[_0x0f2d('0x42')](_0x2826fc['serverUrl']);if(_0x4c6672&&_0x4c6672[_0x0f2d('0x54')]&&_0x4c6672[_0x0f2d('0x54')]!==_0x0f2d('0x55')){logger[_0x0f2d('0x1e')](_0x0f2d('0x56'),'Recording\x20is\x20enabled!');_0x190b0f[_0x0f2d('0x46')]=util[_0x0f2d('0x1a')](_0x0f2d('0x47'),_0x2826fc[_0x0f2d('0x53')],_0x190b0f['uniqueid'],md5(_0x190b0f[_0x0f2d('0x48')]));}headers[_0x0f2d('0x49')]=getAuth(_0x2826fc);return getUser(_0x2826fc,_0xabc7b0[_0x0f2d('0x25')])[_0x0f2d('0x1d')](function(_0x64e82e){_0x1c60ac=_0x64e82e;logger[_0x0f2d('0x1e')]('The\x20User\x20ID\x20is:',_0x1c60ac['id']);return getEndUser(_0x2826fc,_0x190b0f[_0x0f2d('0x57')],_0x190b0f[_0x0f2d('0x58')]);})[_0x0f2d('0x1d')](function(_0x2d86bc){_0x5281a1=_0x2d86bc;logger[_0x0f2d('0x1e')](_0x0f2d('0x4b'),_0x5281a1['id']);return getTicket(_0x2826fc,_0x1c60ac,_0x5281a1,_0x4e825b,_0x190b0f);})[_0x0f2d('0x1d')](function(_0x10053e){if(_0x10053e&&_0x10053e['id']){logger['info'](_0x0f2d('0x1f'));logger['info'](_0x0f2d('0x4c'),_0x10053e['id']);logger[_0x0f2d('0x1e')](_0x0f2d('0x56'),_0x0f2d('0x4d'));emit(util[_0x0f2d('0x1a')](_0x0f2d('0x4e'),_0xabc7b0['name']),_0x0f2d('0x59'),{'uri':util['format'](_0x0f2d('0x4f'),_0x2826fc[_0x0f2d('0x1b')],_0x10053e['id'])});}})[_0x0f2d('0x50')](function(_0x4c118e){logger[_0x0f2d('0x51')](_0x0f2d('0x56'),JSON['stringify'](_0x4c118e));});};exports['unmanaged']=function(_0x5e28bc,_0x1e3b62,_0x3c5361,_0x164666,_0x44e256,_0x3d1502){var _0x1c7245,_0x248c3e;_0x3d1502[_0x0f2d('0x1b')]=intUtil[_0x0f2d('0x42')](_0x3d1502[_0x0f2d('0x1b')]);_0x3d1502[_0x0f2d('0x53')]=intUtil['stripTrailingSlash'](_0x3d1502[_0x0f2d('0x53')]);if(_0x44e256&&_0x44e256['monitor_format']){logger['info']('['+_0x1e3b62['lastevent'][_0x0f2d('0x5a')]()+']',_0x0f2d('0x45'));_0x1e3b62['recordingURL']=util['format'](_0x0f2d('0x47'),_0x3d1502[_0x0f2d('0x53')],_0x1e3b62[_0x0f2d('0x48')],md5(_0x1e3b62[_0x0f2d('0x48')]));}else{_0x1e3b62[_0x0f2d('0x46')]='';}headers[_0x0f2d('0x49')]=getAuth(_0x3d1502);return getUser(_0x3d1502,'')[_0x0f2d('0x1d')](function(_0x17f690){_0x1c7245=_0x17f690;logger[_0x0f2d('0x1e')](_0x0f2d('0x4a'),_0x1c7245['id']);return getEndUser(_0x3d1502,_0x1e3b62[_0x0f2d('0xf')],_0x1e3b62[_0x0f2d('0x10')]);})[_0x0f2d('0x1d')](function(_0x4bb39b){_0x248c3e=_0x4bb39b;logger[_0x0f2d('0x1e')](_0x0f2d('0x4b'),_0x248c3e['id']);return getTicket(_0x3d1502,_0x1c7245,_0x248c3e,_0x3c5361,_0x1e3b62);})['then'](function(_0x4f9f33){if(_0x4f9f33){logger[_0x0f2d('0x1e')](_0x0f2d('0x1f'));logger['info'](_0x0f2d('0x4c'),_0x4f9f33['id']);}})[_0x0f2d('0x50')](function(_0x2e45ec){logger['error']('['+_0x1e3b62[_0x0f2d('0x5b')][_0x0f2d('0x5a')]()+']',JSON[_0x0f2d('0x32')](_0x2e45ec));});}; \ No newline at end of file +var _0x03cc=['lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','keyBy','custom_fields','value','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','type','customField','nameField','toLowerCase','content','picklist','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','unmanaged'];(function(_0x14727c,_0x107ac3){var _0xd21131=function(_0x35cf49){while(--_0x35cf49){_0x14727c['push'](_0x14727c['shift']());}};_0xd21131(++_0x107ac3);}(_0x03cc,0x119));var _0xc03c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x03cc[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xc03c('0x0'));var rp=require(_0xc03c('0x1'));var md5=require(_0xc03c('0x2'));var util=require(_0xc03c('0x3'));var Redis=require(_0xc03c('0x4'));var intUtil=require(_0xc03c('0x5'));var config=require(_0xc03c('0x6'));var logger=require(_0xc03c('0x7'))(_0xc03c('0x8'));config[_0xc03c('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc03c('0xa'))(new Redis(config[_0xc03c('0x9')]));var headers={'Content-Type':_0xc03c('0xb'),'Accept':'application/json'};function emit(_0x17328,_0x3ea050,_0x5396fb){io['to'](_0x17328)['emit'](_0x3ea050,_0x5396fb);}function getTicket(_0x13a293,_0x57413b,_0x2138fd,_0x237d9f,_0x1c2eed){logger[_0xc03c('0xc')](_0xc03c('0xd'));var _0x4e40cb=_[_0xc03c('0xe')]({'responder_id':_0x57413b['id'],'requester_id':_0x2138fd['id'],'name':util[_0xc03c('0xf')](_0xc03c('0x10'),_0x1c2eed['calleridname']),'phone':_0x1c2eed[_0xc03c('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc03c('0x12')](_0x237d9f[_0xc03c('0x13')],_0x1c2eed,'\x20'),'description':intUtil[_0xc03c('0x12')](_0x237d9f[_0xc03c('0x14')],_0x1c2eed,_0xc03c('0x15')),'tags':getTags(_0x237d9f['Tags'],_0xc03c('0x16'))},getCustomFields(_0x237d9f[_0xc03c('0x17')],_0x1c2eed));_0x4e40cb['custom_fields']=_[_0xc03c('0x18')](_[_0xc03c('0x19')](_0x4e40cb[_0xc03c('0x1a')],'id'),_0xc03c('0x1b'));return request({'uri':util[_0xc03c('0xf')]('%s/api/v2/tickets',_0x13a293[_0xc03c('0x1c')]),'method':_0xc03c('0x1d'),'body':_0x4e40cb})[_0xc03c('0x1e')](function(_0x135561){logger[_0xc03c('0xc')](_0xc03c('0x1f'));return _0x135561;});}function getUser(_0x461fdb,_0x4a891a){if(intUtil['validateEmail'](_0x4a891a)){return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x20'),_0x461fdb[_0xc03c('0x1c')]),'qs':{'email':_0x4a891a}})['then'](function(_0x56aeef){if(_0x56aeef[_0xc03c('0x21')]){logger[_0xc03c('0xc')]('Agent\x20found!');return _[_0xc03c('0x22')](_0x56aeef,function(_0x1515de){return _0x1515de[_0xc03c('0x23')][_0xc03c('0x24')]===_0x4a891a;});}else{logger[_0xc03c('0xc')](_0xc03c('0x25'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x26'),_0x461fdb['remoteUri'])})['then'](function(_0x24e682){logger[_0xc03c('0xc')](_0xc03c('0x27'));return _0x24e682;});}});}else{logger[_0xc03c('0xc')](_0xc03c('0x28'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x26'),_0x461fdb[_0xc03c('0x1c')])})[_0xc03c('0x1e')](function(_0x295ab3){logger[_0xc03c('0xc')]('Admin\x20account\x20selected.');return _0x295ab3;});}}function getEndUser(_0x4c5b7b,_0x23e00b,_0x358593){logger[_0xc03c('0xc')](_0xc03c('0x29'),_0x358593);return request({'uri':util[_0xc03c('0xf')]('%s/api/v2/contacts',_0x4c5b7b[_0xc03c('0x1c')]),'qs':{'phone':_0x358593}})[_0xc03c('0x1e')](function(_0x46db71){if(_0x46db71[_0xc03c('0x21')]){logger['info'](_0xc03c('0x2a'));return _[_0xc03c('0x22')](_0x46db71,{'phone':_0x358593});}else{logger[_0xc03c('0xc')](_0xc03c('0x2b'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x2c'),_0x4c5b7b[_0xc03c('0x1c')]),'method':'POST','body':{'name':_0x23e00b,'phone':_0x358593}})[_0xc03c('0x1e')](function(_0x320920){logger[_0xc03c('0xc')](_0xc03c('0x2d'));return _0x320920;});}});}function getAuth(_0x584d0a){return util[_0xc03c('0xf')]('Basic\x20%s',new Buffer(_0x584d0a[_0xc03c('0x2e')]+':X')[_0xc03c('0x2f')](_0xc03c('0x30')));}function request(_0x356f24){logger[_0xc03c('0x31')](_0xc03c('0x32'),JSON[_0xc03c('0x33')](_0x356f24));return rp(_[_0xc03c('0x34')](_0x356f24,{'method':_0xc03c('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x45972a,_0xb2bb0){var _0x2cf9c0=[];if(_0x45972a&&_0x45972a[_0xc03c('0x21')]>0x0){_0x2cf9c0=_['map'](_0x45972a,_0xb2bb0);}return _0x2cf9c0;}function getCustomFields(_0x3dc0b0,_0x93222c){var _0x4b8f5e=[];var _0x3905d0={'custom_fields':[]};if(_0x3dc0b0[_0xc03c('0x21')]>0x0){_[_0xc03c('0x36')](_0x3dc0b0,function(_0x435ac9){if(_[_0xc03c('0x37')](['string','picklist'],_0x435ac9[_0xc03c('0x38')])&&_0x435ac9['nameField']&&!_0x435ac9[_0xc03c('0x39')]){_0x3905d0[_0x435ac9[_0xc03c('0x3a')][_0xc03c('0x3b')]()]=_0x435ac9[_0xc03c('0x3c')][_0xc03c('0x2f')]();}else if(_[_0xc03c('0x37')](['string',_0xc03c('0x3d')],_0x435ac9[_0xc03c('0x38')])&&_0x435ac9['idField']&&_0x435ac9[_0xc03c('0x39')]){_0x3905d0[_0xc03c('0x1a')][_0xc03c('0x3e')]({'id':_0x435ac9[_0xc03c('0x3f')],'value':_0x435ac9[_0xc03c('0x3c')][_0xc03c('0x2f')]()});}else if(_0x435ac9[_0xc03c('0x38')]===_0xc03c('0x40')&&_0x435ac9[_0xc03c('0x41')]&&_0x435ac9[_0xc03c('0x3f')]&&_0x435ac9['customField']){_0x93222c[_0x435ac9[_0xc03c('0x41')]]&&_0x3905d0['custom_fields'][_0xc03c('0x3e')]({'id':_0x435ac9[_0xc03c('0x3f')],'value':_0x93222c[_0x435ac9[_0xc03c('0x41')]][_0xc03c('0x2f')]()});}else if(_0x435ac9['type']===_0xc03c('0x42')&&_0x435ac9[_0xc03c('0x43')]&&_0x435ac9[_0xc03c('0x43')][_0xc03c('0x16')]&&_0x435ac9['idField']&&_0x435ac9[_0xc03c('0x39')]){_0x93222c[_0x435ac9[_0xc03c('0x43')]['name'][_0xc03c('0x3b')]()]&&_0x3905d0['custom_fields'][_0xc03c('0x3e')]({'id':_0x435ac9['idField'],'value':_0x93222c[_0x435ac9[_0xc03c('0x43')][_0xc03c('0x16')]['toLowerCase']()][_0xc03c('0x2f')]()});}});}return _0x3905d0;}exports['queue']=function(_0x11bf3b,_0x2ff0bc,_0x28520a,_0x5d42aa,_0x148bfc,_0x687f39){var _0x4e4572,_0x1cc59b;_0x687f39[_0xc03c('0x1c')]=intUtil[_0xc03c('0x44')](_0x687f39[_0xc03c('0x1c')]);_0x687f39[_0xc03c('0x45')]=intUtil[_0xc03c('0x44')](_0x687f39['serverUrl']);if(_0x148bfc&&_0x148bfc[_0xc03c('0x46')]){logger[_0xc03c('0xc')]('[QUEUE]',_0xc03c('0x47'));_0x2ff0bc[_0xc03c('0x48')]=util[_0xc03c('0xf')](_0xc03c('0x49'),_0x687f39[_0xc03c('0x45')],_0x2ff0bc[_0xc03c('0x4a')],md5(_0x2ff0bc['uniqueid']));}else{_0x2ff0bc[_0xc03c('0x48')]='';}headers[_0xc03c('0x4b')]=getAuth(_0x687f39);return getUser(_0x687f39,_0x5d42aa[_0xc03c('0x24')])[_0xc03c('0x1e')](function(_0x5ca58c){_0x4e4572=_0x5ca58c;logger[_0xc03c('0xc')](_0xc03c('0x4c'),_0x4e4572['id']);return getEndUser(_0x687f39,_0x2ff0bc[_0xc03c('0x4d')],_0x2ff0bc['calleridnum']);})['then'](function(_0x55fe11){_0x1cc59b=_0x55fe11;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x1cc59b['id']);return getTicket(_0x687f39,_0x4e4572,_0x1cc59b,_0x28520a,_0x2ff0bc);})[_0xc03c('0x1e')](function(_0x1f909a){if(_0x1f909a&&_0x1f909a['id']){logger[_0xc03c('0xc')](_0xc03c('0x1f'));logger[_0xc03c('0xc')](_0xc03c('0x4f'),_0x1f909a['id']);logger[_0xc03c('0xc')]('[QUEUE]',_0xc03c('0x50'));emit(util[_0xc03c('0xf')](_0xc03c('0x51'),_0x5d42aa[_0xc03c('0x16')]),_0xc03c('0x52'),{'uri':util[_0xc03c('0xf')](_0xc03c('0x53'),_0x687f39[_0xc03c('0x1c')],_0x1f909a['id'])});}})[_0xc03c('0x54')](function(_0x5d196e){logger[_0xc03c('0x55')]('[QUEUE]',JSON[_0xc03c('0x33')](_0x5d196e));});};exports['outbound']=function(_0x24ca9c,_0x4da070,_0x361200,_0x274b0f,_0x573561,_0x11687c,_0x1fe0c0){var _0x5d2d2e,_0x582ad4;_0x11687c['remoteUri']=intUtil[_0xc03c('0x44')](_0x11687c[_0xc03c('0x1c')]);_0x11687c[_0xc03c('0x45')]=intUtil['stripTrailingSlash'](_0x11687c[_0xc03c('0x45')]);if(_0x1fe0c0&&_0x1fe0c0[_0xc03c('0x56')]&&_0x1fe0c0['recordingFormat']!==_0xc03c('0x57')){logger[_0xc03c('0xc')](_0xc03c('0x58'),_0xc03c('0x47'));_0x4da070['recordingURL']=util[_0xc03c('0xf')](_0xc03c('0x49'),_0x11687c[_0xc03c('0x45')],_0x4da070[_0xc03c('0x4a')],md5(_0x4da070[_0xc03c('0x4a')]));}headers[_0xc03c('0x4b')]=getAuth(_0x11687c);return getUser(_0x11687c,_0x274b0f[_0xc03c('0x24')])[_0xc03c('0x1e')](function(_0x3fff36){_0x5d2d2e=_0x3fff36;logger[_0xc03c('0xc')](_0xc03c('0x4c'),_0x5d2d2e['id']);return getEndUser(_0x11687c,_0x4da070[_0xc03c('0x59')],_0x4da070['destcalleridnum']);})[_0xc03c('0x1e')](function(_0x4b596b){_0x582ad4=_0x4b596b;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x582ad4['id']);return getTicket(_0x11687c,_0x5d2d2e,_0x582ad4,_0x361200,_0x4da070);})[_0xc03c('0x1e')](function(_0x151e04){if(_0x151e04&&_0x151e04['id']){logger['info'](_0xc03c('0x1f'));logger['info'](_0xc03c('0x4f'),_0x151e04['id']);logger[_0xc03c('0xc')](_0xc03c('0x58'),_0xc03c('0x50'));emit(util[_0xc03c('0xf')](_0xc03c('0x51'),_0x274b0f['name']),_0xc03c('0x52'),{'uri':util[_0xc03c('0xf')](_0xc03c('0x53'),_0x11687c['remoteUri'],_0x151e04['id'])});}})['catch'](function(_0x314149){logger[_0xc03c('0x55')](_0xc03c('0x58'),JSON[_0xc03c('0x33')](_0x314149));});};exports[_0xc03c('0x5a')]=function(_0x29937c,_0x4d2e58,_0x70847e,_0x2fe8de,_0x91de1,_0x48d2b4){var _0x2a5334,_0x527c03;_0x48d2b4[_0xc03c('0x1c')]=intUtil['stripTrailingSlash'](_0x48d2b4['remoteUri']);_0x48d2b4[_0xc03c('0x45')]=intUtil['stripTrailingSlash'](_0x48d2b4['serverUrl']);if(_0x91de1&&_0x91de1[_0xc03c('0x46')]){logger[_0xc03c('0xc')]('['+_0x4d2e58[_0xc03c('0x5b')][_0xc03c('0x5c')]()+']','Recording\x20is\x20enabled!');_0x4d2e58[_0xc03c('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48d2b4[_0xc03c('0x45')],_0x4d2e58[_0xc03c('0x4a')],md5(_0x4d2e58[_0xc03c('0x4a')]));}else{_0x4d2e58[_0xc03c('0x48')]='';}headers[_0xc03c('0x4b')]=getAuth(_0x48d2b4);return getUser(_0x48d2b4,'')[_0xc03c('0x1e')](function(_0x2155bf){_0x2a5334=_0x2155bf;logger['info'](_0xc03c('0x4c'),_0x2a5334['id']);return getEndUser(_0x48d2b4,_0x4d2e58[_0xc03c('0x4d')],_0x4d2e58['calleridnum']);})[_0xc03c('0x1e')](function(_0x43f2cf){_0x527c03=_0x43f2cf;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x527c03['id']);return getTicket(_0x48d2b4,_0x2a5334,_0x527c03,_0x70847e,_0x4d2e58);})[_0xc03c('0x1e')](function(_0x4a70ac){if(_0x4a70ac){logger[_0xc03c('0xc')](_0xc03c('0x1f'));logger[_0xc03c('0xc')](_0xc03c('0x4f'),_0x4a70ac['id']);}})['catch'](function(_0x102424){logger[_0xc03c('0x55')]('['+_0x4d2e58['lastevent'][_0xc03c('0x5c')]()+']',JSON['stringify'](_0x102424));});}; \ 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 f30a6a9..d3148d9 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 _0x76d8=['Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','then','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','Subjects','Contact','ticketId','Task\x20created:','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x76d8,0x191));var _0x876d=function(_0x29910d,_0x165c42){_0x29910d=_0x29910d-0x0;var _0x491da6=_0x76d8[_0x29910d];return _0x491da6;};'use strict';var _=require(_0x876d('0x0'));var rp=require(_0x876d('0x1'));var md5=require(_0x876d('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x876d('0x3'));var Redis=require(_0x876d('0x4'));var intUtil=require(_0x876d('0x5'));var config=require(_0x876d('0x6'));var logger=require(_0x876d('0x7'))('freshsales');config[_0x876d('0x8')]=_[_0x876d('0x9')](config[_0x876d('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x876d('0x8')]));function getAdminId(_0x4a05dc,_0x187278,_0x3b447b,_0xfd3023){return new Promise(function(_0x3c7552,_0x1a67cc){var _0x573cb6=![];var _0x12ef21={'method':_0x876d('0xa'),'uri':_0xfd3023+_0x876d('0xb'),'json':!![]};_0x12ef21[_0x876d('0xc')]=_0x3b447b;logger[_0x876d('0xd')](_0x876d('0xe'));return rp(_0x12ef21)['then'](function(_0x293ae8){if(_0x293ae8){var _0x2c1033=_0x293ae8[_0x876d('0xf')];var _0x524c3e=null;for(_0x524c3e=0x0;_0x524c3e<_0x2c1033[_0x876d('0x10')];_0x524c3e++){if(_0x2c1033[_0x524c3e][_0x876d('0x11')]===_0x4a05dc[_0x876d('0x12')]){_0x4a05dc[_0x876d('0x13')]=_0x2c1033[_0x524c3e]['id'];_0x573cb6=!![];}}if(_0x573cb6){logger['info'](_0x876d('0x14'),_0x4a05dc[_0x876d('0x13')]);_0x3c7552(_0x4a05dc);}else{_0x1a67cc({'statusCode':0x194,'message':_0x876d('0x15')});}}else{_0x1a67cc({'statusCode':0x194,'message':_0x876d('0x15')});}})[_0x876d('0x16')](function(_0x20adce){logger['error']('['+[_0x187278[_0x876d('0x17')]()]+']',_0x20adce[_0x876d('0x18')]);_0x1a67cc(_0x20adce);});});}function getUser(_0x40469e,_0x2377bd,_0x155d88){return function(_0x1e4fe6){return new Promise(function(_0x5f128e,_0x12a632){var _0x35afe4={'method':_0x876d('0xa'),'uri':_0x155d88+_0x876d('0xb'),'json':!![]};_0x35afe4['headers']=_0x2377bd;logger['info'](_0x876d('0x19'));return rp(_0x35afe4)['then'](function(_0x1f1101){if(_0x1f1101){var _0xe3a109=_0x1f1101['users'];var _0x1197a6=![];var _0x5af61b=null;if(_0x1e4fe6[_0x876d('0x1a')]!==null){logger[_0x876d('0xd')](_0x876d('0x1b'),_0x1e4fe6[_0x876d('0x1a')]);_0x1e4fe6['userEmail']=_0x1e4fe6[_0x876d('0x1a')];for(_0x5af61b=0x0;_0x5af61b<_0xe3a109['length'];_0x5af61b++){if(_0xe3a109[_0x5af61b][_0x876d('0x11')]===_0x1e4fe6[_0x876d('0x1a')]){_0x1197a6=!![];_0x1e4fe6['userId']=_0xe3a109[_0x5af61b]['id'];logger['info'](_0x876d('0x1c'),_0x1e4fe6[_0x876d('0x1d')]);}}}if(!_0x1197a6){logger[_0x876d('0xd')](_0x876d('0x1e'));_0x1e4fe6[_0x876d('0x1f')]=_0x1e4fe6[_0x876d('0x12')];_0x1e4fe6[_0x876d('0x1d')]=_0x1e4fe6['adminId'];_0x1197a6=!![];}if(_0x1197a6){_0x5f128e(_0x1e4fe6);}else{_0x12a632({'statusCode':0x194,'message':_0x876d('0x15')});}}else{_0x12a632({'statusCode':0x194,'message':_0x876d('0x15')});}})[_0x876d('0x16')](function(_0x208272){logger[_0x876d('0x20')]('['+[_0x40469e[_0x876d('0x17')]()]+']',_0x208272[_0x876d('0x18')]);_0x12a632(_0x208272);});});};}function searchContact(_0x437aa7,_0xdeb94b,_0x1a010c,_0x293e59){return new Promise(function(_0x805ccb,_0x4ce31c){var _0x225e94={'method':_0x876d('0xa'),'headers':_0xdeb94b,'uri':_0x437aa7+_0x876d('0x21')+_0x293e59+_0x876d('0x22')+_0x1a010c+_0x876d('0x23'),'json':!![]};rp(_0x225e94)['then'](function(_0x2922dc){var _0x1d0cef=_[_0x876d('0x24')](_0x2922dc[_0x876d('0x25')][_0x876d('0x25')],[_0x1a010c,_0x293e59]);_0x805ccb(_0x1d0cef);})['catch'](function(_0x2b2d06){_0x4ce31c(_0x2b2d06);});});}function getEndUser(_0xeb36,_0x238e90,_0x507a7e){return function(_0x441001){return new Promise(function(_0x695f7b,_0x5bbd42){logger[_0x876d('0xd')](util[_0x876d('0x26')](_0x876d('0x27'),_0x441001[_0x876d('0x28')]));searchContact(_0x507a7e,_0x238e90,_0x876d('0x29'),_0x441001[_0x876d('0x28')])[_0x876d('0x2a')](function(_0x42ae01){if(_0x42ae01){_0x441001[_0x876d('0x2b')]=_0x42ae01['id'];logger[_0x876d('0xd')](_0x876d('0x2c'),_0x441001[_0x876d('0x2b')]);return _0x695f7b(_0x441001);}searchContact(_0x507a7e,_0x238e90,_0x876d('0x2d'),_0x441001['contactNumber'])[_0x876d('0x2a')](function(_0x166730){if(_0x166730){_0x441001[_0x876d('0x2b')]=_0x166730['id'];logger[_0x876d('0xd')]('Contact\x20found\x20work_number:',_0x441001[_0x876d('0x2b')]);return _0x695f7b(_0x441001);}createEndUser(_0x441001,_0xeb36,_0x238e90,_0x507a7e)[_0x876d('0x2a')](function(_0x1646d9){logger[_0x876d('0xd')](_0x876d('0x2e'),_0x1646d9['endUserId']);return _0x695f7b(_0x1646d9);});});})[_0x876d('0x16')](function(_0x398d25){_0x5bbd42(_0x398d25);});});};}function createEndUser(_0x87d6cb,_0x5b111d,_0x242037,_0x91eb84){return new Promise(function(_0x4d1187,_0x3a512b){var _0x4a0a25=moment();var _0x319a34={'method':'POST','uri':_0x91eb84+_0x876d('0x2f'),'body':{'contact':{'last_name':_0x87d6cb[_0x876d('0x28')],'work_number':_0x87d6cb[_0x876d('0x28')],'mobile_number':_0x87d6cb[_0x876d('0x28')],'owner_id':_0x87d6cb[_0x876d('0x1d')],'created_at':_0x4a0a25[_0x876d('0x26')](_0x876d('0x30'))}},'json':!![]};_0x319a34[_0x876d('0xc')]=_0x242037;logger[_0x876d('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x319a34)['then'](function(_0x92dc94){_0x87d6cb[_0x876d('0x2b')]=_0x92dc94[_0x876d('0x31')]['id'];_0x4d1187(_0x87d6cb);})[_0x876d('0x16')](function(_0x1358e5){logger['error']('['+[_0x5b111d['toUpperCase']()]+']',_0x1358e5[_0x876d('0x18')]);_0x3a512b(_0x1358e5[_0x876d('0x18')]);});});}function getTicket(_0x45bb90,_0x37cacf,_0x45c744,_0x2688fb,_0x1dba61){return function(_0x175f1f){logger[_0x876d('0xd')](_0x876d('0x32'));return new Promise(function(_0x1e381d,_0x34a5e1){var _0xf853fd=moment();var _0x51f89b={'method':_0x876d('0x33'),'uri':_0x45c744+'/api/tasks','body':{'title':intUtil['getString'](_0x2688fb[_0x876d('0x34')],_0x1dba61,'\x20'),'description':intUtil['getString'](_0x2688fb['Descriptions'],_0x1dba61,'\x0a'),'owner_id':_0x175f1f[_0x876d('0x1d')],'creater_id':_0x175f1f[_0x876d('0x13')],'targetable_id':_0x175f1f['endUserId'],'targetable_type':_0x876d('0x35'),'created_at':_0xf853fd[_0x876d('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xf853fd['add'](0x1e,'m')[_0x876d('0x26')](_0x876d('0x30'))},'json':!![]};_0x51f89b[_0x876d('0xc')]=_0x37cacf;return rp(_0x51f89b)[_0x876d('0x2a')](function(_0x339320){_0x175f1f[_0x876d('0x36')]=_0x339320['task']['id'];logger['info'](_0x876d('0x37'),_0x175f1f[_0x876d('0x36')]);_0x1e381d(_0x175f1f);})[_0x876d('0x16')](function(_0x1b8ff6){logger[_0x876d('0x20')]('['+[_0x45bb90['toUpperCase']()]+']',_0x1b8ff6[_0x876d('0x18')]);_0x34a5e1(_0x1b8ff6[_0x876d('0x18')]);});});};}function emit(_0x5ab996,_0x56e5ee,_0x1beb3b){var _0x35002e={'uri':_0x5ab996+'/contacts/'+_0x1beb3b};io['to'](util[_0x876d('0x26')]('user:%s',_0x56e5ee))['emit'](_0x876d('0x38'),_0x35002e);}exports['cs']=function(_0x39c713,_0x1f4231,_0x315144,_0x4cac7e,_0x1f6001,_0x5723d5,_0x1259a3,_0x550a1c){var _0x20ff62={};var _0x1dbe98={'Authorization':_0x876d('0x39')+_0x5723d5['apiKey']};_0x5723d5[_0x876d('0x3a')]=intUtil['stripTrailingSlash'](_0x5723d5[_0x876d('0x3a')]);_0x5723d5[_0x876d('0x3b')]=intUtil[_0x876d('0x3c')](_0x5723d5[_0x876d('0x3b')]);var _0xd0ddf1=_0x5723d5['remoteUri'];_0x20ff62[_0x876d('0x12')]=_0x5723d5[_0x876d('0x3d')];_0x20ff62[_0x876d('0x28')]=_0x550a1c[_0x876d('0x3e')]()==='outbound'?_0x1f4231[_0x876d('0x3f')]:_0x1f4231[_0x876d('0x40')];_0x20ff62[_0x876d('0x41')]=_0x550a1c===_0x876d('0x42')||_0x550a1c===_0x876d('0x43')?_0x876d('0x42'):'outbound';if(_0x4cac7e){_0x20ff62[_0x876d('0x1a')]=_0x4cac7e[_0x876d('0x11')];}var _0x19d94d=util[_0x876d('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5723d5[_0x876d('0x3b')],_0x1f4231['uniqueid'],md5(_0x1f4231['uniqueid']));if(_0x1f6001&&_0x1f6001[_0x876d('0x44')]){logger[_0x876d('0xd')](_0x876d('0x45'),'Recording\x20is\x20enabled!');_0x1f4231['recordingURL']=_0x19d94d;}else if(_0x1259a3&&_0x1259a3[_0x876d('0x46')]&&_0x1259a3['recordingFormat']!==_0x876d('0x47')){logger[_0x876d('0xd')](_0x876d('0x48'),_0x876d('0x49'));_0x1f4231['recordingURL']=_0x19d94d;}else{_0x1f4231[_0x876d('0x4a')]='';}return getAdminId(_0x20ff62,_0x550a1c,_0x1dbe98,_0xd0ddf1)['then'](getUser(_0x550a1c,_0x1dbe98,_0xd0ddf1))[_0x876d('0x2a')](getEndUser(_0x550a1c,_0x1dbe98,_0xd0ddf1))[_0x876d('0x2a')](getTicket(_0x550a1c,_0x1dbe98,_0xd0ddf1,_0x315144,_0x1f4231))['then'](function(_0x3e4676){logger['info'](util[_0x876d('0x26')](_0x876d('0x4b'),_0x3e4676['ticketId']));if(_0x550a1c!==_0x876d('0x43')){logger[_0x876d('0xd')]('['+[_0x550a1c[_0x876d('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0xd0ddf1,_0x4cac7e[_0x876d('0x4c')],_0x3e4676[_0x876d('0x2b')]);}})[_0x876d('0x16')](function(_0x1a7256){logger[_0x876d('0x20')]('['+[_0x550a1c[_0x876d('0x17')]()]+_0x876d('0x4d'),util[_0x876d('0x4e')](_0x1a7256,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1022=['ioredis','./util','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20with\x20email','agentEmail','length','userId','User\x20found:','adminId','&f=','&entities=contact','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','moment'];(function(_0x246bc3,_0x5e2894){var _0x9d635=function(_0x137ca2){while(--_0x137ca2){_0x246bc3['push'](_0x246bc3['shift']());}};_0x9d635(++_0x5e2894);}(_0x1022,0x183));var _0x2102=function(_0x46aad3,_0x5c363f){_0x46aad3=_0x46aad3-0x0;var _0x20e425=_0x1022[_0x46aad3];return _0x20e425;};'use strict';var _=require(_0x2102('0x0'));var rp=require('request-promise');var md5=require(_0x2102('0x1'));var util=require('util');var moment=require(_0x2102('0x2'));var Promise=require('bluebird');var Redis=require(_0x2102('0x3'));var intUtil=require(_0x2102('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x2102('0x5')]=_[_0x2102('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2102('0x7'))(new Redis(config['redis']));function getAdminId(_0x492cf6,_0x3bc272,_0x1e60f6,_0x381667){return new Promise(function(_0x4eb301,_0x22b973){var _0x3fb0eb=![];var _0x4daee4={'method':_0x2102('0x8'),'uri':_0x381667+_0x2102('0x9'),'json':!![]};_0x4daee4[_0x2102('0xa')]=_0x1e60f6;logger['info'](_0x2102('0xb'));return rp(_0x4daee4)[_0x2102('0xc')](function(_0x429fe6){if(_0x429fe6){var _0x55b585=_0x429fe6[_0x2102('0xd')];var _0x1996fc=null;for(_0x1996fc=0x0;_0x1996fc<_0x55b585['length'];_0x1996fc++){if(_0x55b585[_0x1996fc][_0x2102('0xe')]===_0x492cf6[_0x2102('0xf')]){_0x492cf6['adminId']=_0x55b585[_0x1996fc]['id'];_0x3fb0eb=!![];}}if(_0x3fb0eb){logger[_0x2102('0x10')](_0x2102('0x11'),_0x492cf6['adminId']);_0x4eb301(_0x492cf6);}else{_0x22b973({'statusCode':0x194,'message':_0x2102('0x12')});}}else{_0x22b973({'statusCode':0x194,'message':_0x2102('0x12')});}})[_0x2102('0x13')](function(_0x3d5aa8){logger[_0x2102('0x14')]('['+[_0x3bc272[_0x2102('0x15')]()]+']',_0x3d5aa8[_0x2102('0x16')]);_0x22b973(_0x3d5aa8);});});}function getUser(_0x258480,_0x24288f,_0x555276){return function(_0x72c0b4){return new Promise(function(_0x57739c,_0x1ec861){var _0x2a8f6b={'method':'GET','uri':_0x555276+_0x2102('0x9'),'json':!![]};_0x2a8f6b['headers']=_0x24288f;logger[_0x2102('0x10')]('Getting\x20user\x20list');return rp(_0x2a8f6b)[_0x2102('0xc')](function(_0x35c92a){if(_0x35c92a){var _0x5df89f=_0x35c92a[_0x2102('0xd')];var _0x4fe9ea=![];var _0xfc8c78=null;if(_0x72c0b4['agentEmail']!==null){logger[_0x2102('0x10')](_0x2102('0x17'),_0x72c0b4[_0x2102('0x18')]);_0x72c0b4['userEmail']=_0x72c0b4[_0x2102('0x18')];for(_0xfc8c78=0x0;_0xfc8c78<_0x5df89f[_0x2102('0x19')];_0xfc8c78++){if(_0x5df89f[_0xfc8c78][_0x2102('0xe')]===_0x72c0b4['agentEmail']){_0x4fe9ea=!![];_0x72c0b4[_0x2102('0x1a')]=_0x5df89f[_0xfc8c78]['id'];logger['info'](_0x2102('0x1b'),_0x72c0b4[_0x2102('0x1a')]);}}}if(!_0x4fe9ea){logger[_0x2102('0x10')]('Admin\x20selected');_0x72c0b4['userEmail']=_0x72c0b4[_0x2102('0xf')];_0x72c0b4['userId']=_0x72c0b4[_0x2102('0x1c')];_0x4fe9ea=!![];}if(_0x4fe9ea){_0x57739c(_0x72c0b4);}else{_0x1ec861({'statusCode':0x194,'message':_0x2102('0x12')});}}else{_0x1ec861({'statusCode':0x194,'message':_0x2102('0x12')});}})[_0x2102('0x13')](function(_0x1c1e7d){logger['error']('['+[_0x258480[_0x2102('0x15')]()]+']',_0x1c1e7d[_0x2102('0x16')]);_0x1ec861(_0x1c1e7d);});});};}function searchContact(_0x5b7e42,_0x2d7ca7,_0x2b8acd,_0x4f0d16){return new Promise(function(_0x54a075,_0x10f61f){var _0x2b5e04={'method':_0x2102('0x8'),'headers':_0x2d7ca7,'uri':_0x5b7e42+'/api/lookup?q='+_0x4f0d16+_0x2102('0x1d')+_0x2b8acd+_0x2102('0x1e'),'json':!![]};rp(_0x2b5e04)[_0x2102('0xc')](function(_0x5b70d9){var _0x481475=_[_0x2102('0x1f')](_0x5b70d9['contacts'][_0x2102('0x20')],[_0x2b8acd,_0x4f0d16]);_0x54a075(_0x481475);})[_0x2102('0x13')](function(_0x33a318){_0x10f61f(_0x33a318);});});}function getEndUser(_0x2cc515,_0x57e1b1,_0x1d2373){return function(_0x2eaf93){return new Promise(function(_0x22bd43,_0x2870ab){logger[_0x2102('0x10')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x2eaf93[_0x2102('0x21')]));searchContact(_0x1d2373,_0x57e1b1,'mobile_number',_0x2eaf93['contactNumber'])[_0x2102('0xc')](function(_0x2a74d7){if(_0x2a74d7){_0x2eaf93[_0x2102('0x22')]=_0x2a74d7['id'];logger[_0x2102('0x10')](_0x2102('0x23'),_0x2eaf93[_0x2102('0x22')]);return _0x22bd43(_0x2eaf93);}searchContact(_0x1d2373,_0x57e1b1,'work_number',_0x2eaf93['contactNumber'])['then'](function(_0x5f075e){if(_0x5f075e){_0x2eaf93[_0x2102('0x22')]=_0x5f075e['id'];logger[_0x2102('0x10')](_0x2102('0x24'),_0x2eaf93[_0x2102('0x22')]);return _0x22bd43(_0x2eaf93);}createEndUser(_0x2eaf93,_0x2cc515,_0x57e1b1,_0x1d2373)[_0x2102('0xc')](function(_0x113a8e){logger[_0x2102('0x10')](_0x2102('0x25'),_0x113a8e['endUserId']);return _0x22bd43(_0x113a8e);});});})['catch'](function(_0x36c596){_0x2870ab(_0x36c596);});});};}function createEndUser(_0x1a013e,_0x2fd5db,_0x575b0b,_0x48f9b1){return new Promise(function(_0x321743,_0x543a8a){var _0x14dbd9=moment();var _0x453988={'method':_0x2102('0x26'),'uri':_0x48f9b1+_0x2102('0x27'),'body':{'contact':{'last_name':_0x1a013e['contactNumber'],'work_number':_0x1a013e[_0x2102('0x21')],'mobile_number':_0x1a013e[_0x2102('0x21')],'owner_id':_0x1a013e['userId'],'created_at':_0x14dbd9[_0x2102('0x28')](_0x2102('0x29'))}},'json':!![]};_0x453988['headers']=_0x575b0b;logger[_0x2102('0x10')](_0x2102('0x2a'));return rp(_0x453988)[_0x2102('0xc')](function(_0x210313){_0x1a013e[_0x2102('0x22')]=_0x210313[_0x2102('0x2b')]['id'];_0x321743(_0x1a013e);})[_0x2102('0x13')](function(_0x2cac5a){logger[_0x2102('0x14')]('['+[_0x2fd5db['toUpperCase']()]+']',_0x2cac5a[_0x2102('0x16')]);_0x543a8a(_0x2cac5a['message']);});});}function getTicket(_0xe82b48,_0x11e082,_0x1e9044,_0x206677,_0x10c9b1){return function(_0x464ccf){logger[_0x2102('0x10')]('Creating\x20new\x20task');return new Promise(function(_0x202e0b,_0x69a52e){var _0x36abca=moment();var _0x12e953={'method':_0x2102('0x26'),'uri':_0x1e9044+_0x2102('0x2c'),'body':{'title':intUtil[_0x2102('0x2d')](_0x206677[_0x2102('0x2e')],_0x10c9b1,'\x20'),'description':intUtil[_0x2102('0x2d')](_0x206677[_0x2102('0x2f')],_0x10c9b1,'\x0a'),'owner_id':_0x464ccf[_0x2102('0x1a')],'creater_id':_0x464ccf['adminId'],'targetable_id':_0x464ccf[_0x2102('0x22')],'targetable_type':'Contact','created_at':_0x36abca[_0x2102('0x28')](_0x2102('0x29')),'due_date':_0x36abca['add'](0x1e,'m')[_0x2102('0x28')](_0x2102('0x29'))},'json':!![]};_0x12e953[_0x2102('0xa')]=_0x11e082;return rp(_0x12e953)['then'](function(_0x423559){_0x464ccf[_0x2102('0x30')]=_0x423559[_0x2102('0x31')]['id'];logger[_0x2102('0x10')](_0x2102('0x32'),_0x464ccf[_0x2102('0x30')]);_0x202e0b(_0x464ccf);})['catch'](function(_0x394598){logger['error']('['+[_0xe82b48['toUpperCase']()]+']',_0x394598['message']);_0x69a52e(_0x394598[_0x2102('0x16')]);});});};}function emit(_0x2944df,_0x369096,_0x1a7380){var _0x272123={'uri':_0x2944df+_0x2102('0x33')+_0x1a7380};io['to'](util[_0x2102('0x28')](_0x2102('0x34'),_0x369096))[_0x2102('0x35')]('trigger:browser:url',_0x272123);}exports['cs']=function(_0x42ab1e,_0x113444,_0x1702b9,_0x4b9b0c,_0x52dfb4,_0x11e699,_0x59d683,_0x2acd4b){var _0x5a7b85={};var _0x1b09cd={'Authorization':_0x2102('0x36')+_0x11e699['apiKey']};_0x11e699[_0x2102('0x37')]=intUtil[_0x2102('0x38')](_0x11e699[_0x2102('0x37')]);_0x11e699['serverUrl']=intUtil[_0x2102('0x38')](_0x11e699[_0x2102('0x39')]);var _0x272fc7=_0x11e699[_0x2102('0x37')];_0x5a7b85['adminEmail']=_0x11e699[_0x2102('0x3a')];_0x5a7b85[_0x2102('0x21')]=_0x2acd4b[_0x2102('0x3b')]()===_0x2102('0x3c')?_0x113444['destcalleridnum']:_0x113444[_0x2102('0x3d')];_0x5a7b85[_0x2102('0x3e')]=_0x2acd4b===_0x2102('0x3f')||_0x2acd4b==='unmanaged'?_0x2102('0x3f'):_0x2102('0x3c');if(_0x4b9b0c){_0x5a7b85[_0x2102('0x18')]=_0x4b9b0c[_0x2102('0xe')];}var _0x56db61=util[_0x2102('0x28')](_0x2102('0x40'),_0x11e699['serverUrl'],_0x113444['uniqueid'],md5(_0x113444[_0x2102('0x41')]));if(_0x52dfb4&&_0x52dfb4[_0x2102('0x42')]){logger[_0x2102('0x10')](_0x2102('0x43'),_0x2102('0x44'));_0x113444[_0x2102('0x45')]=_0x56db61;}else if(_0x59d683&&_0x59d683[_0x2102('0x46')]&&_0x59d683[_0x2102('0x46')]!==_0x2102('0x47')){logger[_0x2102('0x10')](_0x2102('0x48'),_0x2102('0x44'));_0x113444[_0x2102('0x45')]=_0x56db61;}else{_0x113444[_0x2102('0x45')]='';}return getAdminId(_0x5a7b85,_0x2acd4b,_0x1b09cd,_0x272fc7)[_0x2102('0xc')](getUser(_0x2acd4b,_0x1b09cd,_0x272fc7))['then'](getEndUser(_0x2acd4b,_0x1b09cd,_0x272fc7))[_0x2102('0xc')](getTicket(_0x2acd4b,_0x1b09cd,_0x272fc7,_0x1702b9,_0x113444))[_0x2102('0xc')](function(_0x47e9a7){logger[_0x2102('0x10')](util[_0x2102('0x28')](_0x2102('0x49'),_0x47e9a7[_0x2102('0x30')]));if(_0x2acd4b!==_0x2102('0x4a')){logger[_0x2102('0x10')]('['+[_0x2acd4b[_0x2102('0x15')]()]+']',_0x2102('0x4b'));emit(_0x272fc7,_0x4b9b0c[_0x2102('0x4c')],_0x47e9a7[_0x2102('0x22')]);}})[_0x2102('0x13')](function(_0x1d1f17){logger[_0x2102('0x14')]('['+[_0x2acd4b[_0x2102('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x2102('0x4d')](_0x1d1f17,{'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 a13d5fe..0f0c052 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 _0x4d70=['sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','toLowerCase','data2','find','Configurations','data3','queue','log','EVENT\x20UNKNOWN','data1','freshdesk','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','salesforce'];(function(_0x31c323,_0x49259d){var _0x2b0f7c=function(_0x38944e){while(--_0x38944e){_0x31c323['push'](_0x31c323['shift']());}};_0x2b0f7c(++_0x49259d);}(_0x4d70,0x1d2));var _0x04d7=function(_0x27a300,_0x56ed6e){_0x27a300=_0x27a300-0x0;var _0x4ea908=_0x4d70[_0x27a300];return _0x4ea908;};'use strict';var _=require('lodash');var util=require(_0x04d7('0x0'));var zendesk=require(_0x04d7('0x1'));var salesforce=require(_0x04d7('0x2'));var sugarcrm=require(_0x04d7('0x3'));var freshdesk=require(_0x04d7('0x4'));var zoho=require(_0x04d7('0x5'));var desk=require('./desk');var vtiger=require(_0x04d7('0x6'));var servicenow=require(_0x04d7('0x7'));var dynamics365=require(_0x04d7('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x04d7('0x9'),_0x04d7('0xa'),'freshdesk',_0x04d7('0xb'),_0x04d7('0xc'),_0x04d7('0xd'),_0x04d7('0xe'),'freshsales',_0x04d7('0xf')];exports[_0x04d7('0x10')]=function(_0x104e30,_0x531aca,_0x2c2ec1,_0x56f191,_0x1f66e0,_0x360776){if(_0x2c2ec1){if(_['includes'](integrations,_0x104e30['data1'][_0x04d7('0x11')]())){try{var _0x505fb7=null;var _0xf86237='';var _0x4fa785=_0x2c2ec1[_0x104e30['data1'][_0x04d7('0x11')]()];if(_0x4fa785){var _0x5e3bf8=_0x4fa785[_0x104e30[_0x04d7('0x12')]];if(_0x5e3bf8){var _0x523aaa=_[_0x04d7('0x13')](_0x5e3bf8[_0x04d7('0x14')],{'id':parseInt(_0x104e30[_0x04d7('0x15')],0xa)});if(_0x523aaa){if(_0x56f191){if(_0x1f66e0&&_0x531aca['queue']){_0xf86237=_0x04d7('0x16');}else if(_0x531aca['routeId']){_0xf86237='outbound';}else{console[_0x04d7('0x17')](_0x04d7('0x18'),_0x531aca);}}else{_0xf86237='unmanaged';}switch(_0x104e30[_0x04d7('0x19')][_0x04d7('0x11')]()){case'zendesk':zendesk[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0x9'):salesforce[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0xa'):sugarcrm[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0x1a'):freshdesk[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0xb'):zoho[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0xc'):desk[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0xd'):vtiger[_0xf86237](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776);break;case _0x04d7('0x1b'):freshsales['cs'](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776,_0xf86237);break;case _0x04d7('0xf'):servicenow['cs'](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776,_0xf86237);break;case'dynamics365':dynamics365['cs'](_0x104e30,_0x531aca,_0x523aaa,_0x56f191,_0x1f66e0,_0x5e3bf8,_0x360776,_0xf86237);break;default:console[_0x04d7('0x17')](_0x04d7('0x1c'));}}else{_0x505fb7=require(_0x04d7('0x1d'))(_0x104e30['data1']['toLowerCase']());_0x505fb7[_0x04d7('0x1e')](_0x04d7('0x1f'),util[_0x04d7('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x104e30[_0x04d7('0x19')][_0x04d7('0x11')](),_0x104e30[_0x04d7('0x15')]));}}else{_0x505fb7=require(_0x04d7('0x1d'))(_0x104e30[_0x04d7('0x19')][_0x04d7('0x11')]());_0x505fb7[_0x04d7('0x1e')](_0x04d7('0x1f'),util[_0x04d7('0x20')](_0x04d7('0x21'),_0x104e30[_0x04d7('0x19')][_0x04d7('0x11')](),_0x104e30[_0x04d7('0x12')]));}}else{}}catch(_0x577475){console[_0x04d7('0x1e')](_0x577475);}}}}; \ No newline at end of file +var _0xd634=['queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','data3'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xd634,0x16d));var _0x4d63=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xd634[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var zendesk=require(_0x4d63('0x2'));var salesforce=require(_0x4d63('0x3'));var sugarcrm=require(_0x4d63('0x4'));var freshdesk=require(_0x4d63('0x5'));var zoho=require(_0x4d63('0x6'));var desk=require(_0x4d63('0x7'));var vtiger=require(_0x4d63('0x8'));var servicenow=require(_0x4d63('0x9'));var dynamics365=require(_0x4d63('0xa'));var freshsales=require(_0x4d63('0xb'));var integrations=[_0x4d63('0xc'),_0x4d63('0xd'),_0x4d63('0xe'),'freshdesk',_0x4d63('0xf'),'desk','vtiger',_0x4d63('0x10'),_0x4d63('0x11'),_0x4d63('0x12')];exports[_0x4d63('0x13')]=function(_0x2a3f77,_0x3f70c3,_0x12ead8,_0x2b319a,_0x3dd9c6,_0x38b292){if(_0x12ead8){if(_[_0x4d63('0x14')](integrations,_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')]())){try{var _0x4d2ec2=null;var _0x58c95b='';var _0x32e0c8=_0x12ead8[_0x2a3f77[_0x4d63('0x15')]['toLowerCase']()];if(_0x32e0c8){var _0x154d37=_0x32e0c8[_0x2a3f77[_0x4d63('0x17')]];if(_0x154d37){var _0x127c48=_['find'](_0x154d37['Configurations'],{'id':parseInt(_0x2a3f77[_0x4d63('0x18')],0xa)});if(_0x127c48){if(_0x2b319a){if(_0x3dd9c6&&_0x3f70c3[_0x4d63('0x19')]){_0x58c95b=_0x4d63('0x19');}else if(_0x3f70c3[_0x4d63('0x1a')]){_0x58c95b=_0x4d63('0x1b');}else{console[_0x4d63('0x1c')](_0x4d63('0x1d'),_0x3f70c3);}}else{_0x58c95b=_0x4d63('0x1e');}switch(_0x2a3f77['data1'][_0x4d63('0x16')]()){case _0x4d63('0xc'):zendesk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xd'):salesforce[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xe'):sugarcrm[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0x1f'):freshdesk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xf'):zoho[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'desk':desk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'vtiger':vtiger[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'freshsales':freshsales['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;case _0x4d63('0x12'):servicenow['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;case _0x4d63('0x10'):dynamics365['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;default:console[_0x4d63('0x1c')](_0x4d63('0x20'));}}else{_0x4d2ec2=require(_0x4d63('0x21'))(_0x2a3f77['data1']['toLowerCase']());_0x4d2ec2[_0x4d63('0x22')]('[EXEC]',util[_0x4d63('0x23')](_0x4d63('0x24'),_0x2a3f77['data1']['toLowerCase'](),_0x2a3f77[_0x4d63('0x18')]));}}else{_0x4d2ec2=require('../../../../config/logger')(_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')]());_0x4d2ec2['error'](_0x4d63('0x25'),util[_0x4d63('0x23')](_0x4d63('0x26'),_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')](),_0x2a3f77['data2']));}}else{}}catch(_0x517308){console[_0x4d63('0x22')](_0x517308);}}}}; \ 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 1ececcf..56983bc 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 _0x7596=['LastName','Company','No\x20Company','upperFirst','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','user:%s','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridname',']\x20Ticket\x20%s\x20created.','toUpperCase','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','WhoId','Case','account','AccountId','lead','leadId','info','sobject','create','isNil','execute','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','merge','Contact','length','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','contact','Phone','attributes','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.','','format'];(function(_0x544032,_0x30d572){var _0x1bee8e=function(_0x2faf1a){while(--_0x2faf1a){_0x544032['push'](_0x544032['shift']());}};_0x1bee8e(++_0x30d572);}(_0x7596,0x1c1));var _0x6759=function(_0x385eee,_0x270cca){_0x385eee=_0x385eee-0x0;var _0x41fd49=_0x7596[_0x385eee];return _0x41fd49;};'use strict';var _=require('lodash');var rp=require(_0x6759('0x0'));var moment=require(_0x6759('0x1'));var BPromise=require(_0x6759('0x2'));var md5=require(_0x6759('0x3'));var jsforce=require(_0x6759('0x4'));var util=require(_0x6759('0x5'));var Redis=require(_0x6759('0x6'));var intUtil=require('./util');var config=require(_0x6759('0x7'));var logger=require(_0x6759('0x8'))('salesforce');config[_0x6759('0x9')]=_[_0x6759('0xa')](config[_0x6759('0x9')],{'host':_0x6759('0xb'),'port':0x18eb});var io=require(_0x6759('0xc'))(new Redis(config[_0x6759('0x9')]));function emit(_0x3b279b,_0x1ad0d8,_0x176768){io['to'](_0x3b279b)[_0x6759('0xd')](_0x1ad0d8,_0x176768);}function getTicket(_0x1d14e7,_0x185d36,_0x209ba0,_0x517cf3,_0x3b14c9,_0x33f279,_0xf7f666,_0x1a163d){var _0x4fe09a=Object[_0x6759('0xe')]({},{'OwnerId':_0x185d36['id'],'Subject':intUtil[_0x6759('0xf')](_0x517cf3['Subjects'],_0x3b14c9,'\x20'),'Description':intUtil[_0x6759('0xf')](_0x517cf3[_0x6759('0x10')],_0x3b14c9,'\x0a')},getCustomFields(_0x33f279,_0x3b14c9));if(_0x209ba0){if(_0x517cf3[_0x6759('0x11')]==='Task'){_0x4fe09a[_0x6759('0x12')]=moment[_0x6759('0x13')]();_0x4fe09a['IsReminderSet']=![];_0x4fe09a[_0x6759('0x14')]=![];if(_0x209ba0[_0x6759('0x15')]==='contact'||_0x209ba0[_0x6759('0x15')]==='lead'){_0x4fe09a[_0x6759('0x16')]=_0x209ba0['id'];}else if(_0x209ba0[_0x6759('0x15')]==='account'){_0x4fe09a['WhatId']=_0x209ba0['id'];}}else if(_0x517cf3['ticketType']===_0x6759('0x17')){if(_0x209ba0['endUserType']==='contact'){_0x4fe09a['ContactId']=_0x209ba0['id'];}else if(_0x209ba0[_0x6759('0x15')]===_0x6759('0x18')){_0x4fe09a[_0x6759('0x19')]=_0x209ba0['id'];}else if(_0x209ba0[_0x6759('0x15')]===_0x6759('0x1a')&&_0x517cf3['leadId']){_0x4fe09a[_0x517cf3[_0x6759('0x1b')]]=_0x209ba0['id'];}else{logger[_0x6759('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xf7f666[_0x6759('0x1d')](_0x517cf3[_0x6759('0x11')])[_0x6759('0x1e')](_0x4fe09a);}function getUser(_0x40ccb3,_0x1a5f70,_0x43bb00){if(!_[_0x6759('0x1f')](_0x1a5f70)&&intUtil['validateEmail'](_0x1a5f70)){var _0x4a23da={'Email':_0x1a5f70};var _0x4071a8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x43bb00[_0x6759('0x1d')]('User')['find'](_0x4a23da,_0x4071a8)[_0x6759('0x20')]()['then'](function(_0x1e2a07){if(_0x1e2a07['length']){var _0x3bc2cf=_[_0x6759('0x21')](_0x1e2a07,function(_0x42bdfd){return _0x42bdfd[_0x6759('0x22')]===_0x1a5f70;});if(_0x3bc2cf){logger[_0x6759('0x1c')](_0x6759('0x23'),_0x1a5f70);return BPromise[_0x6759('0x24')]({'id':_0x3bc2cf['Id'],'name':_0x3bc2cf[_0x6759('0x25')]});}}else{logger[_0x6759('0x1c')](_0x6759('0x26'),_0x1a5f70);return _0x43bb00[_0x6759('0x27')]()[_0x6759('0x28')](function(_0x8aaa43){return BPromise[_0x6759('0x24')]({'id':_0x8aaa43['user_id'],'name':_0x8aaa43[_0x6759('0x29')]});});}});}else{logger[_0x6759('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1a5f70);return _0x43bb00[_0x6759('0x27')]()[_0x6759('0x28')](function(_0x187de7){return BPromise[_0x6759('0x24')]({'id':_0x187de7[_0x6759('0x2a')],'name':_0x187de7[_0x6759('0x29')]});});}}function getEndUser(_0x4cb4d7,_0x527d2a,_0x2e7781,_0x687de,_0xa44e18){var _0x486735={'$or':{'Phone':_0x687de}};var _0x3bf6f5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6759('0x24')]()[_0x6759('0x28')](function(){logger['info'](_0x6759('0x2b'),_0x687de,_0x527d2a[_0x6759('0x2c')]);switch(_0x527d2a['moduleSearch']){case _0x6759('0x2d'):var _0x396aa8=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a['additionalSearchContact']){var _0x1dfffb={};_0x1dfffb[_0x527d2a['additionalSearchContact']]=_0x687de;_[_0x6759('0x2f')](_0x396aa8['$or'],_0x1dfffb);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x30'))[_0x6759('0x21')](_0x396aa8,_0x3bf6f5)[_0x6759('0x20')]()[_0x6759('0x28')](function(_0x21d370){if(_0x21d370&&_0x21d370[_0x6759('0x31')]){return _0x21d370;}else{var _0x13f7c2=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a[_0x6759('0x32')]){var _0x16879d={};_0x16879d[_0x527d2a[_0x6759('0x32')]]=_0x687de;_[_0x6759('0x2f')](_0x13f7c2[_0x6759('0x33')],_0x16879d);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x34'))[_0x6759('0x21')](_0x13f7c2,_0x3bf6f5);}});case _0x6759('0x35'):var _0x5a0f26=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a[_0x6759('0x36')]){var _0x1dfffb={};_0x1dfffb[_0x527d2a[_0x6759('0x36')]]=_0x687de;_[_0x6759('0x2f')](_0x5a0f26[_0x6759('0x33')],_0x1dfffb);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x37'))[_0x6759('0x21')](_0x5a0f26,_0x3bf6f5)[_0x6759('0x20')]()['then'](function(_0x327bba){if(_0x327bba&&_0x327bba['length']){return _0x327bba;}else{var _0xdea163=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a[_0x6759('0x38')]){var _0x22012f={};_0x22012f[_0x527d2a['additionalSearchContact']]=_0x687de;_[_0x6759('0x2f')](_0xdea163[_0x6759('0x33')],_0x22012f);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x30'))[_0x6759('0x21')](_0xdea163,_0x3bf6f5)['then'](function(_0x2dfec8){if(_0x2dfec8&&_0x2dfec8[_0x6759('0x31')]){return _0x2dfec8;}else{var _0xaf2413=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a[_0x6759('0x32')]){var _0x6314f4={};_0x6314f4[_0x527d2a[_0x6759('0x32')]]=_0x687de;_[_0x6759('0x2f')](_0xaf2413[_0x6759('0x33')],_0x6314f4);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x34'))[_0x6759('0x21')](_0xaf2413,_0x3bf6f5);}});}});case _0x6759('0x39'):var _0x396aa8=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a[_0x6759('0x38')]){var _0x1dfffb={};_0x1dfffb[_0x527d2a[_0x6759('0x38')]]=_0x687de;_[_0x6759('0x2f')](_0x396aa8[_0x6759('0x33')],_0x1dfffb);}return _0xa44e18[_0x6759('0x1d')]('Contact')[_0x6759('0x21')](_0x396aa8,_0x3bf6f5)[_0x6759('0x20')]();case _0x6759('0x1a'):var _0x1518d2=_['cloneDeep'](_0x486735);if(_0x527d2a[_0x6759('0x32')]){var _0x1dfffb={};_0x1dfffb[_0x527d2a['additionalSearchLead']]=_0x687de;_[_0x6759('0x2f')](_0x1518d2[_0x6759('0x33')],_0x1dfffb);}return _0xa44e18['sobject'](_0x6759('0x34'))[_0x6759('0x21')](_0x1518d2,_0x3bf6f5);case _0x6759('0x18'):var _0x5a0f26=_[_0x6759('0x2e')](_0x486735);if(_0x527d2a['additionalSearchAccount']){var _0x1dfffb={};_0x1dfffb[_0x527d2a['additionalSearchAccount']]=_0x687de;_[_0x6759('0x2f')](_0x5a0f26[_0x6759('0x33')],_0x1dfffb);}return _0xa44e18[_0x6759('0x1d')](_0x6759('0x37'))[_0x6759('0x21')](_0x5a0f26,_0x3bf6f5);default:return null;}})[_0x6759('0x28')](function(_0xab2299){if(_0xab2299&&_0xab2299[_0x6759('0x31')]){var _0x2d204f=_['first'](_0xab2299);if(_0x2d204f){return BPromise[_0x6759('0x24')]({'id':_0x2d204f['Id'],'name':_0x2d204f[_0x6759('0x25')],'phone':_0x2d204f[_0x6759('0x3a')],'endUserType':_0x2d204f[_0x6759('0x3b')]['type'][_0x6759('0x3c')]()});}}})[_0x6759('0x28')](function(_0x4a9c36){if(_0x4a9c36){logger['info'](_0x6759('0x3d'),_0x4a9c36[_0x6759('0x15')],_0x687de);return BPromise[_0x6759('0x24')](_0x4a9c36);}else{logger[_0x6759('0x1c')](_0x6759('0x3e'),_0x687de);var _0xa5fd18={'Phone':_0x687de};if(_0x527d2a[_0x6759('0x3f')]){if(_0x527d2a[_0x6759('0x3f')]===_0x6759('0x39')){logger[_0x6759('0x1c')](_0x6759('0x40'),_0x687de,_0x527d2a[_0x6759('0x3f')]);_0xa5fd18['LastName']=_0x2e7781!==_0x6759('0x41')?_0x2e7781:util[_0x6759('0x42')]('Caller\x20-\x20%s',_0x687de);}else if(_0x527d2a[_0x6759('0x3f')]===_0x6759('0x1a')){logger[_0x6759('0x1c')](_0x6759('0x40'),_0x687de,_0x527d2a[_0x6759('0x3f')]);_0xa5fd18[_0x6759('0x43')]=_0x2e7781!==_0x6759('0x41')?_0x2e7781:util[_0x6759('0x42')]('Caller\x20-\x20%s',_0x687de);_0xa5fd18[_0x6759('0x44')]=_0x6759('0x45');}else if(_0x527d2a[_0x6759('0x3f')]===_0x6759('0x18')){logger[_0x6759('0x1c')](_0x6759('0x40'),_0x687de,_0x527d2a[_0x6759('0x3f')]);_0xa5fd18[_0x6759('0x25')]=_0x2e7781!==_0x6759('0x41')?_0x2e7781:util[_0x6759('0x42')]('Caller\x20-\x20%s',_0x687de);}else{return null;}}return _0xa44e18[_0x6759('0x1d')](_[_0x6759('0x46')](_0x527d2a[_0x6759('0x3f')]))[_0x6759('0x1e')](_0xa5fd18)[_0x6759('0x28')](function(_0x134d7c){return BPromise['resolve']({'id':_0x134d7c['id'],'endUserType':_0x527d2a['moduleCreate']});});}});}function getCustomFields(_0x2e61e2,_0x4f02bc){var _0x42d618={};if(_0x2e61e2['length']>0x0){_[_0x6759('0x47')](_0x2e61e2,function(_0x10fb06){if(_[_0x6759('0x48')]([_0x6759('0x49'),'picklist'],_0x10fb06[_0x6759('0x4a')])&&_0x10fb06[_0x6759('0x4b')]){_0x42d618[_0x10fb06['idField']]=_0x10fb06[_0x6759('0x4c')][_0x6759('0x4d')]();}else if(_0x10fb06[_0x6759('0x4a')]===_0x6759('0x4e')&&_0x10fb06[_0x6759('0x4f')]&&_0x10fb06[_0x6759('0x4b')]){_0x4f02bc[_0x10fb06[_0x6759('0x4f')]]&&(_0x42d618[_0x10fb06['idField']]=_0x4f02bc[_0x10fb06['variableName']][_0x6759('0x4d')]());}else if(_0x10fb06['type']===_0x6759('0x50')&&_0x10fb06[_0x6759('0x51')]&&_0x10fb06[_0x6759('0x51')]['name']&&_0x10fb06['idField']){_0x4f02bc[_0x10fb06[_0x6759('0x51')][_0x6759('0x52')][_0x6759('0x3c')]()]&&(_0x42d618[_0x10fb06['idField']]=_0x4f02bc[_0x10fb06[_0x6759('0x51')][_0x6759('0x52')][_0x6759('0x3c')]()][_0x6759('0x4d')]());}});}return _0x42d618;}function getConnection(_0x1b8273){var _0xe32230=_0x1b8273[_0x6759('0x53')][_0x6759('0x54')](_0x1b8273[_0x6759('0x55')]);var _0x3397a6=new jsforce[(_0x6759('0x56'))]({'oauth2':{'loginUrl':_0x1b8273[_0x6759('0x57')]||'https://login.salesforce.com','clientId':_0x1b8273[_0x6759('0x58')],'clientSecret':_0x1b8273[_0x6759('0x59')]}});return _0x3397a6[_0x6759('0x5a')](_0x1b8273[_0x6759('0x5b')],_0xe32230)[_0x6759('0x28')](function(){logger['info'](_0x6759('0x5c'));return _0x3397a6;});}exports[_0x6759('0x5d')]=function(_0x3b4d29,_0x54053c,_0x31a1f5,_0xb3cad8,_0x751e4c,_0x4722c2){var _0x31c8b3,_0x9713b0,_0x2477fb,_0x35de0f;_0x4722c2[_0x6759('0x5e')]=intUtil[_0x6759('0x5f')](_0x4722c2[_0x6759('0x5e')]);_0x4722c2[_0x6759('0x57')]=intUtil[_0x6759('0x5f')](_0x4722c2[_0x6759('0x57')]);if(_0x751e4c&&_0x751e4c[_0x6759('0x60')]){logger[_0x6759('0x1c')](_0x6759('0x61'),_0x6759('0x62'));_0x54053c['recordingURL']=util[_0x6759('0x42')](_0x6759('0x63'),_0x4722c2[_0x6759('0x5e')],_0x54053c['uniqueid'],md5(_0x54053c[_0x6759('0x64')]));}else{_0x54053c[_0x6759('0x65')]='';}return getConnection(_0x4722c2)['then'](function(_0x499258){_0x35de0f=_0x499258;return getUser(_0x4722c2,_0xb3cad8['email'],_0x35de0f);})['then'](function(_0x5f5d78){_0x31c8b3=_0x5f5d78;return getEndUser(_0x4722c2,_0x31a1f5,_0x54053c['calleridname'],_0x54053c[_0x6759('0x66')],_0x35de0f);})[_0x6759('0x28')](function(_0x848f80){_0x9713b0=_0x848f80;return getTicket(_0x4722c2,_0x31c8b3,_0x9713b0,_0x31a1f5,_0x54053c,_0x31a1f5[_0x6759('0x67')],_0x35de0f,'queue');})[_0x6759('0x28')](function(_0x318def){_0x2477fb=_0x318def;logger[_0x6759('0x1c')](_0x6759('0x68'),_0x2477fb['id']);logger[_0x6759('0x1c')](_0x6759('0x69'),_0x2477fb['id'],_0xb3cad8[_0x6759('0x52')],_0x4722c2['type']);switch(_0x4722c2['type']){case _0x6759('0x6a'):emit(util[_0x6759('0x42')]('user:%s',_0xb3cad8['name']),'trigger:salesforce:display',{'recordId':_0x2477fb['id']});break;case _0x6759('0x6b'):emit(util[_0x6759('0x42')]('user:%s',_0xb3cad8[_0x6759('0x52')]),_0x6759('0x6c'),{'uri':util[_0x6759('0x42')](_0x6759('0x6d'),_0x35de0f[_0x6759('0x6e')],_0x2477fb['id'])});break;default:logger[_0x6759('0x6f')](_0x6759('0x70'));}})[_0x6759('0x71')](function(_0x3d4aa9){logger[_0x6759('0x6f')](_0x6759('0x61'),_0x3d4aa9);});};exports['outbound']=function(_0x5c41bb,_0x3e539c,_0x48e868,_0xa18f6a,_0x197817,_0x53eac7,_0x14bf65){var _0x40b8d2,_0x323b12,_0x342764,_0x3eba0d;_0x53eac7['serverUrl']=intUtil[_0x6759('0x5f')](_0x53eac7[_0x6759('0x5e')]);_0x53eac7[_0x6759('0x57')]=intUtil[_0x6759('0x5f')](_0x53eac7[_0x6759('0x57')]);if(_0x14bf65&&_0x14bf65[_0x6759('0x72')]&&_0x14bf65[_0x6759('0x72')]!=='none'){logger[_0x6759('0x1c')](_0x6759('0x73'),_0x6759('0x62'));_0x3e539c[_0x6759('0x65')]=util[_0x6759('0x42')](_0x6759('0x63'),_0x53eac7[_0x6759('0x5e')],_0x3e539c[_0x6759('0x64')],md5(_0x3e539c[_0x6759('0x64')]));}return getConnection(_0x53eac7)[_0x6759('0x28')](function(_0x310b58){_0x3eba0d=_0x310b58;return getUser(_0x53eac7,_0xa18f6a[_0x6759('0x74')],_0x3eba0d);})[_0x6759('0x28')](function(_0x3ca88d){_0x40b8d2=_0x3ca88d;return getEndUser(_0x53eac7,_0x48e868,_0x3e539c[_0x6759('0x75')],_0x3e539c[_0x6759('0x76')],_0x3eba0d);})[_0x6759('0x28')](function(_0x2bcaa8){_0x323b12=_0x2bcaa8;return getTicket(_0x53eac7,_0x40b8d2,_0x323b12,_0x48e868,_0x3e539c,_0x48e868[_0x6759('0x67')],_0x3eba0d,_0x6759('0x77'));})[_0x6759('0x28')](function(_0x44d0cf){_0x342764=_0x44d0cf;logger[_0x6759('0x1c')](_0x6759('0x78'),_0x342764['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x342764['id'],_0xa18f6a[_0x6759('0x52')],_0x53eac7['type']);switch(_0x53eac7[_0x6759('0x4a')]){case _0x6759('0x6a'):emit(util[_0x6759('0x42')]('user:%s',_0xa18f6a[_0x6759('0x52')]),_0x6759('0x79'),{'recordId':_0x342764['id']});break;case _0x6759('0x6b'):emit(util[_0x6759('0x42')](_0x6759('0x7a'),_0xa18f6a[_0x6759('0x52')]),_0x6759('0x6c'),{'uri':util[_0x6759('0x42')](_0x6759('0x6d'),_0x3eba0d[_0x6759('0x6e')],_0x342764['id'])});break;default:logger[_0x6759('0x6f')](_0x6759('0x73'),_0x6759('0x7b'));}})[_0x6759('0x71')](function(_0x30701b){logger['error'](_0x6759('0x73'),_0x30701b);});};exports[_0x6759('0x7c')]=function(_0x2463e4,_0x3337cc,_0x15b2dd,_0x3e2ba5,_0x1ab874,_0x7bb79b){var _0x4f3be8,_0x1195e0,_0x1c8664,_0xcacd2e;_0x7bb79b[_0x6759('0x5e')]=intUtil[_0x6759('0x5f')](_0x7bb79b['serverUrl']);_0x7bb79b[_0x6759('0x57')]=intUtil[_0x6759('0x5f')](_0x7bb79b[_0x6759('0x57')]);if(_0x1ab874&&_0x1ab874['monitor_format']){logger[_0x6759('0x1c')]('['+_0x3337cc[_0x6759('0x7d')]['toUpperCase']()+']',_0x6759('0x62'));_0x3337cc[_0x6759('0x65')]=util[_0x6759('0x42')](_0x6759('0x63'),_0x7bb79b[_0x6759('0x5e')],_0x3337cc['uniqueid'],md5(_0x3337cc[_0x6759('0x64')]));}else{_0x3337cc[_0x6759('0x65')]='';}return getConnection(_0x7bb79b)['then'](function(_0x25f5ab){_0xcacd2e=_0x25f5ab;if(!_['isNil'](_0x3e2ba5)){return getUser(_0x7bb79b,_0x3e2ba5['name'],_0xcacd2e);}else{return getUser(_0x7bb79b,null,_0xcacd2e);}})[_0x6759('0x28')](function(_0x326916){_0x4f3be8=_0x326916;return getEndUser(_0x7bb79b,_0x15b2dd,_0x3337cc[_0x6759('0x7e')],_0x3337cc[_0x6759('0x66')],_0xcacd2e);})['then'](function(_0x3abae4){_0x1195e0=_0x3abae4;return getTicket(_0x7bb79b,_0x4f3be8,_0x1195e0,_0x15b2dd,_0x3337cc,_0x15b2dd[_0x6759('0x67')],_0xcacd2e);})['then'](function(_0x5bda46){_0x1c8664=_0x5bda46;logger[_0x6759('0x1c')]('['+_0x3337cc[_0x6759('0x7d')]['toUpperCase']()+_0x6759('0x7f'),_0x1c8664['id']);logger[_0x6759('0x1c')]('['+_0x3337cc[_0x6759('0x7d')][_0x6759('0x80')]()+']\x20Integration\x20account\x20type\x20%s.',_0x7bb79b['type']);})[_0x6759('0x71')](function(_0x4a7799){logger[_0x6759('0x6f')]('['+_0x3337cc[_0x6759('0x7d')][_0x6759('0x80')]()+']',_0x4a7799);});}; \ No newline at end of file +var _0x55e8=['bluebird','md5','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','contact','first','Phone','attributes','type','toLowerCase','moduleCreate','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','forEach','includes','string','idField','content','variable','variableName','customVariable','Variable','name','toString','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','serverUrl','none','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment'];(function(_0x49923f,_0x671404){var _0x560684=function(_0x5a152b){while(--_0x5a152b){_0x49923f['push'](_0x49923f['shift']());}};_0x560684(++_0x671404);}(_0x55e8,0x183));var _0x855e=function(_0x2e55cf,_0x2b3721){_0x2e55cf=_0x2e55cf-0x0;var _0x46d0c3=_0x55e8[_0x2e55cf];return _0x46d0c3;};'use strict';var _=require(_0x855e('0x0'));var rp=require(_0x855e('0x1'));var moment=require(_0x855e('0x2'));var BPromise=require(_0x855e('0x3'));var md5=require(_0x855e('0x4'));var jsforce=require(_0x855e('0x5'));var util=require('util');var Redis=require(_0x855e('0x6'));var intUtil=require('./util');var config=require(_0x855e('0x7'));var logger=require(_0x855e('0x8'))(_0x855e('0x9'));config[_0x855e('0xa')]=_[_0x855e('0xb')](config[_0x855e('0xa')],{'host':_0x855e('0xc'),'port':0x18eb});var io=require(_0x855e('0xd'))(new Redis(config[_0x855e('0xa')]));function emit(_0x2d5974,_0x28579e,_0x11344e){io['to'](_0x2d5974)[_0x855e('0xe')](_0x28579e,_0x11344e);}function getTicket(_0x166d3b,_0x250f80,_0x173103,_0x284b6e,_0x4c7a97,_0x24924a,_0x3d1bc0,_0x23749f){var _0x299545=Object[_0x855e('0xf')]({},{'OwnerId':_0x250f80['id'],'Subject':intUtil[_0x855e('0x10')](_0x284b6e[_0x855e('0x11')],_0x4c7a97,'\x20'),'Description':intUtil[_0x855e('0x10')](_0x284b6e[_0x855e('0x12')],_0x4c7a97,'\x0a')},getCustomFields(_0x24924a,_0x4c7a97));if(_0x173103){if(_0x284b6e[_0x855e('0x13')]==='Task'){_0x299545[_0x855e('0x14')]=moment[_0x855e('0x15')]();_0x299545[_0x855e('0x16')]=![];_0x299545[_0x855e('0x17')]=![];if(_0x173103[_0x855e('0x18')]==='contact'||_0x173103[_0x855e('0x18')]===_0x855e('0x19')){_0x299545[_0x855e('0x1a')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]===_0x855e('0x1b')){_0x299545[_0x855e('0x1c')]=_0x173103['id'];}}else if(_0x284b6e['ticketType']===_0x855e('0x1d')){if(_0x173103[_0x855e('0x18')]==='contact'){_0x299545[_0x855e('0x1e')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]==='account'){_0x299545[_0x855e('0x1f')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]==='lead'&&_0x284b6e['leadId']){_0x299545[_0x284b6e[_0x855e('0x20')]]=_0x173103['id'];}else{logger[_0x855e('0x21')](_0x855e('0x22'));}}}return _0x3d1bc0[_0x855e('0x23')](_0x284b6e[_0x855e('0x13')])[_0x855e('0x24')](_0x299545);}function getUser(_0x353345,_0x41e044,_0x1c704f){if(!_[_0x855e('0x25')](_0x41e044)&&intUtil[_0x855e('0x26')](_0x41e044)){var _0x266f05={'Email':_0x41e044};var _0x8d2151={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1c704f['sobject'](_0x855e('0x27'))[_0x855e('0x28')](_0x266f05,_0x8d2151)[_0x855e('0x29')]()[_0x855e('0x2a')](function(_0xe75887){if(_0xe75887['length']){var _0x1c996b=_[_0x855e('0x28')](_0xe75887,function(_0xca1537){return _0xca1537[_0x855e('0x2b')]===_0x41e044;});if(_0x1c996b){logger[_0x855e('0x21')]('Agent\x20%s\x20found.',_0x41e044);return BPromise[_0x855e('0x2c')]({'id':_0x1c996b['Id'],'name':_0x1c996b['Name']});}}else{logger[_0x855e('0x21')](_0x855e('0x2d'),_0x41e044);return _0x1c704f[_0x855e('0x2e')]()['then'](function(_0x443c0e){return BPromise[_0x855e('0x2c')]({'id':_0x443c0e[_0x855e('0x2f')],'name':_0x443c0e[_0x855e('0x30')]});});}});}else{logger[_0x855e('0x21')](_0x855e('0x2d'),_0x41e044);return _0x1c704f[_0x855e('0x2e')]()[_0x855e('0x2a')](function(_0x555c5b){return BPromise[_0x855e('0x2c')]({'id':_0x555c5b['user_id'],'name':_0x555c5b[_0x855e('0x30')]});});}}function getEndUser(_0x386b64,_0x583d68,_0x30004d,_0x323f62,_0x3dbb20){var _0xebd052={'$or':{'Phone':_0x323f62}};var _0x31e3ea={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x855e('0x2a')](function(){logger[_0x855e('0x21')](_0x855e('0x31'),_0x323f62,_0x583d68[_0x855e('0x32')]);switch(_0x583d68[_0x855e('0x32')]){case _0x855e('0x33'):var _0x404c19=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x35')]){var _0x1985fe={};_0x1985fe[_0x583d68['additionalSearchContact']]=_0x323f62;_[_0x855e('0x36')](_0x404c19[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')]('Contact')[_0x855e('0x28')](_0x404c19,_0x31e3ea)[_0x855e('0x29')]()[_0x855e('0x2a')](function(_0x2e3310){if(_0x2e3310&&_0x2e3310[_0x855e('0x38')]){return _0x2e3310;}else{var _0x42562c=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x4e6756={};_0x4e6756[_0x583d68[_0x855e('0x39')]]=_0x323f62;_[_0x855e('0x36')](_0x42562c['$or'],_0x4e6756);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3a'))[_0x855e('0x28')](_0x42562c,_0x31e3ea);}});case _0x855e('0x3b'):var _0x152cf3=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x3c')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x3c')]]=_0x323f62;_[_0x855e('0x36')](_0x152cf3[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3d'))[_0x855e('0x28')](_0x152cf3,_0x31e3ea)[_0x855e('0x29')]()['then'](function(_0x30edd5){if(_0x30edd5&&_0x30edd5[_0x855e('0x38')]){return _0x30edd5;}else{var _0x5519cc=_[_0x855e('0x34')](_0xebd052);if(_0x583d68['additionalSearchContact']){var _0x4724b7={};_0x4724b7[_0x583d68[_0x855e('0x35')]]=_0x323f62;_[_0x855e('0x36')](_0x5519cc[_0x855e('0x37')],_0x4724b7);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3e'))[_0x855e('0x28')](_0x5519cc,_0x31e3ea)[_0x855e('0x2a')](function(_0x349bd1){if(_0x349bd1&&_0x349bd1['length']){return _0x349bd1;}else{var _0x2efadb=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x3a1e70={};_0x3a1e70[_0x583d68[_0x855e('0x39')]]=_0x323f62;_['merge'](_0x2efadb['$or'],_0x3a1e70);}return _0x3dbb20['sobject'](_0x855e('0x3a'))[_0x855e('0x28')](_0x2efadb,_0x31e3ea);}});}});case _0x855e('0x3f'):var _0x404c19=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x35')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x35')]]=_0x323f62;_['merge'](_0x404c19[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')]('Contact')[_0x855e('0x28')](_0x404c19,_0x31e3ea)[_0x855e('0x29')]();case _0x855e('0x19'):var _0x263032=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x39')]]=_0x323f62;_[_0x855e('0x36')](_0x263032[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3a'))['find'](_0x263032,_0x31e3ea);case _0x855e('0x1b'):var _0x152cf3=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x3c')]){var _0x1985fe={};_0x1985fe[_0x583d68['additionalSearchAccount']]=_0x323f62;_[_0x855e('0x36')](_0x152cf3[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3d'))['find'](_0x152cf3,_0x31e3ea);default:return null;}})[_0x855e('0x2a')](function(_0x3347f1){if(_0x3347f1&&_0x3347f1[_0x855e('0x38')]){var _0x45c609=_[_0x855e('0x40')](_0x3347f1);if(_0x45c609){return BPromise[_0x855e('0x2c')]({'id':_0x45c609['Id'],'name':_0x45c609['Name'],'phone':_0x45c609[_0x855e('0x41')],'endUserType':_0x45c609[_0x855e('0x42')][_0x855e('0x43')][_0x855e('0x44')]()});}}})[_0x855e('0x2a')](function(_0xfc94f){if(_0xfc94f){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xfc94f[_0x855e('0x18')],_0x323f62);return BPromise[_0x855e('0x2c')](_0xfc94f);}else{logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x323f62);var _0x486d4e={'Phone':_0x323f62};if(_0x583d68[_0x855e('0x45')]){if(_0x583d68['moduleCreate']===_0x855e('0x3f')){logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x323f62,_0x583d68[_0x855e('0x45')]);_0x486d4e[_0x855e('0x46')]=_0x30004d!==_0x855e('0x47')?_0x30004d:util['format'](_0x855e('0x48'),_0x323f62);}else if(_0x583d68[_0x855e('0x45')]===_0x855e('0x19')){logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x323f62,_0x583d68[_0x855e('0x45')]);_0x486d4e[_0x855e('0x46')]=_0x30004d!==_0x855e('0x47')?_0x30004d:util[_0x855e('0x49')](_0x855e('0x48'),_0x323f62);_0x486d4e[_0x855e('0x4a')]=_0x855e('0x4b');}else if(_0x583d68[_0x855e('0x45')]===_0x855e('0x1b')){logger['info'](_0x855e('0x4c'),_0x323f62,_0x583d68['moduleCreate']);_0x486d4e['Name']=_0x30004d!==''?_0x30004d:util[_0x855e('0x49')](_0x855e('0x48'),_0x323f62);}else{return null;}}return _0x3dbb20[_0x855e('0x23')](_['upperFirst'](_0x583d68[_0x855e('0x45')]))['create'](_0x486d4e)['then'](function(_0x4386f8){return BPromise[_0x855e('0x2c')]({'id':_0x4386f8['id'],'endUserType':_0x583d68[_0x855e('0x45')]});});}});}function getCustomFields(_0x478d49,_0x579a98){var _0x499e0f={};if(_0x478d49[_0x855e('0x38')]>0x0){_[_0x855e('0x4d')](_0x478d49,function(_0x5cbb21){if(_[_0x855e('0x4e')]([_0x855e('0x4f'),'picklist'],_0x5cbb21[_0x855e('0x43')])&&_0x5cbb21[_0x855e('0x50')]){_0x499e0f[_0x5cbb21['idField']]=_0x5cbb21[_0x855e('0x51')]['toString']();}else if(_0x5cbb21['type']===_0x855e('0x52')&&_0x5cbb21[_0x855e('0x53')]&&_0x5cbb21[_0x855e('0x50')]){_0x579a98[_0x5cbb21['variableName']]&&(_0x499e0f[_0x5cbb21[_0x855e('0x50')]]=_0x579a98[_0x5cbb21[_0x855e('0x53')]]['toString']());}else if(_0x5cbb21[_0x855e('0x43')]===_0x855e('0x54')&&_0x5cbb21[_0x855e('0x55')]&&_0x5cbb21[_0x855e('0x55')][_0x855e('0x56')]&&_0x5cbb21['idField']){_0x579a98[_0x5cbb21[_0x855e('0x55')][_0x855e('0x56')]['toLowerCase']()]&&(_0x499e0f[_0x5cbb21['idField']]=_0x579a98[_0x5cbb21['Variable'][_0x855e('0x56')][_0x855e('0x44')]()][_0x855e('0x57')]());}});}return _0x499e0f;}function getConnection(_0x4c505e){var _0x6e20de=_0x4c505e['password'][_0x855e('0x58')](_0x4c505e['securityToken']);var _0x438b70=new jsforce[(_0x855e('0x59'))]({'oauth2':{'loginUrl':_0x4c505e[_0x855e('0x5a')]||_0x855e('0x5b'),'clientId':_0x4c505e[_0x855e('0x5c')],'clientSecret':_0x4c505e[_0x855e('0x5d')]}});return _0x438b70['login'](_0x4c505e[_0x855e('0x5e')],_0x6e20de)['then'](function(){logger[_0x855e('0x21')](_0x855e('0x5f'));return _0x438b70;});}exports[_0x855e('0x60')]=function(_0x5de2bb,_0x366c45,_0x1399c5,_0x4441ae,_0x34e0ed,_0x5b15a9){var _0x51eb0a,_0x11b24e,_0x1d1f20,_0x9fb078;_0x5b15a9['serverUrl']=intUtil[_0x855e('0x61')](_0x5b15a9['serverUrl']);_0x5b15a9[_0x855e('0x5a')]=intUtil['stripTrailingSlash'](_0x5b15a9[_0x855e('0x5a')]);if(_0x34e0ed&&_0x34e0ed[_0x855e('0x62')]){logger[_0x855e('0x21')](_0x855e('0x63'),_0x855e('0x64'));_0x366c45[_0x855e('0x65')]=util['format'](_0x855e('0x66'),_0x5b15a9['serverUrl'],_0x366c45[_0x855e('0x67')],md5(_0x366c45[_0x855e('0x67')]));}else{_0x366c45[_0x855e('0x65')]='';}return getConnection(_0x5b15a9)[_0x855e('0x2a')](function(_0x4d4cb2){_0x9fb078=_0x4d4cb2;return getUser(_0x5b15a9,_0x4441ae[_0x855e('0x68')],_0x9fb078);})[_0x855e('0x2a')](function(_0x167654){_0x51eb0a=_0x167654;return getEndUser(_0x5b15a9,_0x1399c5,_0x366c45[_0x855e('0x69')],_0x366c45[_0x855e('0x6a')],_0x9fb078);})[_0x855e('0x2a')](function(_0x46f506){_0x11b24e=_0x46f506;return getTicket(_0x5b15a9,_0x51eb0a,_0x11b24e,_0x1399c5,_0x366c45,_0x1399c5['Fields'],_0x9fb078,'queue');})[_0x855e('0x2a')](function(_0x2aba1d){_0x1d1f20=_0x2aba1d;logger[_0x855e('0x21')](_0x855e('0x6b'),_0x1d1f20['id']);logger[_0x855e('0x21')](_0x855e('0x6c'),_0x1d1f20['id'],_0x4441ae['name'],_0x5b15a9[_0x855e('0x43')]);switch(_0x5b15a9[_0x855e('0x43')]){case _0x855e('0x6d'):emit(util['format'](_0x855e('0x6e'),_0x4441ae[_0x855e('0x56')]),'trigger:salesforce:display',{'recordId':_0x1d1f20['id']});break;case'newTab':emit(util[_0x855e('0x49')](_0x855e('0x6e'),_0x4441ae[_0x855e('0x56')]),_0x855e('0x6f'),{'uri':util[_0x855e('0x49')](_0x855e('0x70'),_0x9fb078[_0x855e('0x71')],_0x1d1f20['id'])});break;default:logger[_0x855e('0x72')](_0x855e('0x73'));}})[_0x855e('0x74')](function(_0x5d98b3){logger[_0x855e('0x72')](_0x855e('0x63'),_0x5d98b3);});};exports['outbound']=function(_0x27de79,_0x4a3d90,_0x3c2a47,_0x109356,_0x38944d,_0x268e22,_0x47bbbb){var _0x1c4b7b,_0x3f3e4d,_0x15f741,_0xa8c0bb;_0x268e22[_0x855e('0x75')]=intUtil[_0x855e('0x61')](_0x268e22[_0x855e('0x75')]);_0x268e22[_0x855e('0x5a')]=intUtil[_0x855e('0x61')](_0x268e22[_0x855e('0x5a')]);if(_0x47bbbb&&_0x47bbbb['recordingFormat']&&_0x47bbbb['recordingFormat']!==_0x855e('0x76')){logger[_0x855e('0x21')]('[OUTBOUND]',_0x855e('0x64'));_0x4a3d90[_0x855e('0x65')]=util['format'](_0x855e('0x66'),_0x268e22[_0x855e('0x75')],_0x4a3d90[_0x855e('0x67')],md5(_0x4a3d90[_0x855e('0x67')]));}return getConnection(_0x268e22)[_0x855e('0x2a')](function(_0x829d02){_0xa8c0bb=_0x829d02;return getUser(_0x268e22,_0x109356['email'],_0xa8c0bb);})[_0x855e('0x2a')](function(_0xcb9b43){_0x1c4b7b=_0xcb9b43;return getEndUser(_0x268e22,_0x3c2a47,_0x4a3d90[_0x855e('0x77')],_0x4a3d90['destcalleridnum'],_0xa8c0bb);})[_0x855e('0x2a')](function(_0x14a8ab){_0x3f3e4d=_0x14a8ab;return getTicket(_0x268e22,_0x1c4b7b,_0x3f3e4d,_0x3c2a47,_0x4a3d90,_0x3c2a47[_0x855e('0x78')],_0xa8c0bb,_0x855e('0x79'));})[_0x855e('0x2a')](function(_0xd17242){_0x15f741=_0xd17242;logger['info'](_0x855e('0x7a'),_0x15f741['id']);logger['info'](_0x855e('0x7b'),_0x15f741['id'],_0x109356[_0x855e('0x56')],_0x268e22[_0x855e('0x43')]);switch(_0x268e22[_0x855e('0x43')]){case'integrationTab':emit(util[_0x855e('0x49')](_0x855e('0x6e'),_0x109356[_0x855e('0x56')]),'trigger:salesforce:display',{'recordId':_0x15f741['id']});break;case'newTab':emit(util['format'](_0x855e('0x6e'),_0x109356['name']),_0x855e('0x6f'),{'uri':util['format']('%s/%s/e',_0xa8c0bb[_0x855e('0x71')],_0x15f741['id'])});break;default:logger['error'](_0x855e('0x7c'),_0x855e('0x7d'));}})['catch'](function(_0x88fca8){logger[_0x855e('0x72')]('[OUTBOUND]',_0x88fca8);});};exports[_0x855e('0x7e')]=function(_0x16df15,_0x2d5e8c,_0x2e82c4,_0x48b830,_0x47d401,_0x2ea279){var _0xb0e326,_0x27ad1b,_0x57e395,_0x33d494;_0x2ea279[_0x855e('0x75')]=intUtil[_0x855e('0x61')](_0x2ea279[_0x855e('0x75')]);_0x2ea279[_0x855e('0x5a')]=intUtil[_0x855e('0x61')](_0x2ea279[_0x855e('0x5a')]);if(_0x47d401&&_0x47d401[_0x855e('0x62')]){logger[_0x855e('0x21')]('['+_0x2d5e8c['lastevent'][_0x855e('0x7f')]()+']',_0x855e('0x64'));_0x2d5e8c[_0x855e('0x65')]=util[_0x855e('0x49')](_0x855e('0x66'),_0x2ea279[_0x855e('0x75')],_0x2d5e8c[_0x855e('0x67')],md5(_0x2d5e8c[_0x855e('0x67')]));}else{_0x2d5e8c['recordingURL']='';}return getConnection(_0x2ea279)[_0x855e('0x2a')](function(_0x47d1f5){_0x33d494=_0x47d1f5;if(!_['isNil'](_0x48b830)){return getUser(_0x2ea279,_0x48b830[_0x855e('0x56')],_0x33d494);}else{return getUser(_0x2ea279,null,_0x33d494);}})[_0x855e('0x2a')](function(_0x31369b){_0xb0e326=_0x31369b;return getEndUser(_0x2ea279,_0x2e82c4,_0x2d5e8c[_0x855e('0x69')],_0x2d5e8c[_0x855e('0x6a')],_0x33d494);})[_0x855e('0x2a')](function(_0x9de831){_0x27ad1b=_0x9de831;return getTicket(_0x2ea279,_0xb0e326,_0x27ad1b,_0x2e82c4,_0x2d5e8c,_0x2e82c4[_0x855e('0x78')],_0x33d494);})[_0x855e('0x2a')](function(_0x195606){_0x57e395=_0x195606;logger[_0x855e('0x21')]('['+_0x2d5e8c[_0x855e('0x80')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x57e395['id']);logger[_0x855e('0x21')]('['+_0x2d5e8c[_0x855e('0x80')][_0x855e('0x7f')]()+_0x855e('0x81'),_0x2ea279[_0x855e('0x43')]);})[_0x855e('0x74')](function(_0x1de827){logger['error']('['+_0x2d5e8c[_0x855e('0x80')]['toUpperCase']()+']',_0x1de827);});}; \ 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 e5a4758..eb6936f 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 _0x6503=[']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','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','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','result','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Fields'];(function(_0x5c21e,_0x5a2b39){var _0x2b6fc7=function(_0x283283){while(--_0x283283){_0x5c21e['push'](_0x5c21e['shift']());}};_0x2b6fc7(++_0x5a2b39);}(_0x6503,0x1d0));var _0x3650=function(_0x11347e,_0x378d58){_0x11347e=_0x11347e-0x0;var _0x4f71d1=_0x6503[_0x11347e];return _0x4f71d1;};'use strict';var _=require('lodash');var Promise=require(_0x3650('0x0'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3650('0x1'));config[_0x3650('0x2')]=_[_0x3650('0x3')](config[_0x3650('0x2')],{'host':_0x3650('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3650('0x2')]));function getAdminUser(_0x47a837,_0x38efa1,_0x20d24c,_0x313e2a,_0x5bd573,_0x3797bb){return new Promise(function(_0x3dafa3,_0x1849c2){var _0x154f0e={'method':_0x3650('0x5'),'uri':_0x313e2a+_0x3650('0x6')+'&'+_0x5bd573+'&'+_0x3797bb,'auth':_0x38efa1,'json':!![]};return rp(_0x154f0e)[_0x3650('0x7')](function(_0x53b20e){if(_0x53b20e['result'][_0x3650('0x8')]>0x0){_0x20d24c[_0x3650('0x9')]=_0x53b20e['result'][0x0]['sys_id'];}logger[_0x3650('0xa')]('['+[_0x47a837[_0x3650('0xb')]()]+_0x3650('0xc'),_0x20d24c);_0x3dafa3(_0x20d24c);})['catch'](function(_0x11da2b){logger[_0x3650('0xd')]('['+[_0x47a837['toUpperCase']()]+']',_0x11da2b[_0x3650('0xe')]);_0x1849c2(_0x11da2b[_0x3650('0xe')]);});});}function getUser(_0x4927ef,_0x56c732,_0xe6ebf8,_0x4dd15e,_0x2e4b28){return function(_0x2244ae){logger[_0x3650('0xa')]('['+[_0x4927ef[_0x3650('0xb')]()]+_0x3650('0xf'),_0x2244ae);return new Promise(function(_0x413272,_0x4327fd){if(intUtil[_0x3650('0x10')](_0x2244ae[_0x3650('0x11')])){var _0x1bcec3={'method':'GET','uri':_0xe6ebf8+_0x3650('0x12')+_0x2244ae[_0x3650('0x11')]+'&'+_0x4dd15e+'&'+_0x2e4b28,'auth':_0x56c732,'json':!![]};logger[_0x3650('0xa')]('['+[_0x4927ef[_0x3650('0xb')]()]+_0x3650('0x13'),_0x1bcec3);return rp(_0x1bcec3)[_0x3650('0x7')](function(_0x444a42){logger[_0x3650('0xa')]('['+[_0x4927ef[_0x3650('0xb')]()]+'],\x20getUser\x20entity',_0x444a42);if(_0x444a42[_0x3650('0x14')]['length']>0x0&&String(_0x444a42[_0x3650('0x14')][0x0]['active'])===_0x3650('0x15')){_0x2244ae[_0x3650('0x16')]=_0x444a42['result'][0x0][_0x3650('0x17')];}else{_0x2244ae['userId']=_0x2244ae[_0x3650('0x9')];_0x2244ae[_0x3650('0x11')]=_0x2244ae[_0x3650('0x18')];}logger['info']('['+[_0x4927ef[_0x3650('0xb')]()]+_0x3650('0x19'),_0x2244ae);_0x413272(_0x2244ae);})[_0x3650('0x1a')](function(_0x4b10c1){logger['error']('['+[_0x4927ef[_0x3650('0xb')]()]+']',_0x4b10c1[_0x3650('0xe')]);_0x4327fd(_0x4b10c1['message']);});}else{logger['info']('['+[_0x4927ef[_0x3650('0xb')]()]+_0x3650('0x1b'));_0x2244ae[_0x3650('0x16')]=_0x2244ae[_0x3650('0x9')];_0x2244ae[_0x3650('0x11')]=_0x2244ae['adminEmail'];_0x413272(_0x2244ae);}});};}function createEndUser(_0x2a4d0b,_0x156b98,_0x1f213a,_0x401dcf,_0x4b12f6){logger[_0x3650('0xa')]('['+[_0x2a4d0b[_0x3650('0xb')]()]+'],\x20createEndUser\x20input\x20crm',_0x1f213a);return new Promise(function(_0x4aebc7,_0x2c1dd0){var _0x5ecc7e={'method':_0x3650('0x1c'),'uri':_0x401dcf+_0x3650('0x1d')+_0x4b12f6,'body':{'user_name':_0x1f213a[_0x3650('0x1e')],'roles':_0x3650('0x1f'),'first_name':_0x1f213a['endUserNumber'],'active':'true','date_format':_0x3650('0x20'),'phone':_0x1f213a[_0x3650('0x1e')]},'auth':_0x156b98,'json':!![]};return rp(_0x5ecc7e)[_0x3650('0x7')](function(_0x9ee2b1){logger[_0x3650('0xa')]('['+[_0x2a4d0b[_0x3650('0xb')]()]+_0x3650('0x21'),_0x9ee2b1[_0x3650('0x14')]);_0x1f213a[_0x3650('0x22')]=_0x9ee2b1[_0x3650('0x14')]['sys_id'];_0x4aebc7(_0x1f213a);})[_0x3650('0x1a')](function(_0x3179aa){logger[_0x3650('0xd')]('['+[_0x2a4d0b['toUpperCase']()]+']',_0x3179aa[_0x3650('0xe')]);_0x2c1dd0(_0x3179aa['message']);});});}function getEndUser(_0x2d62da,_0x1c4775,_0x57c58b,_0x2de8cc,_0x12472f){return function(_0x2332d8){logger[_0x3650('0xa')]('['+[_0x2d62da['toUpperCase']()]+_0x3650('0x23'),_0x2332d8);return new Promise(function(_0x1a19b0,_0x44fd55){var _0x30d3a1={'method':_0x3650('0x5'),'uri':_0x57c58b+_0x3650('0x24')+_0x2332d8[_0x3650('0x1e')]+'&'+_0x2de8cc+'&'+_0x12472f,'auth':_0x1c4775,'json':!![]};return rp(_0x30d3a1)[_0x3650('0x7')](function(_0x1f367e){if(_0x1f367e[_0x3650('0x14')]['length']>0x0){_0x2332d8['endUserId']=_0x1f367e[_0x3650('0x14')][0x0][_0x3650('0x17')];logger[_0x3650('0xa')]('['+[_0x2d62da['toUpperCase']()]+_0x3650('0x25'),_0x2332d8);_0x1a19b0(_0x2332d8);}else{return createEndUser(_0x2d62da,_0x1c4775,_0x2332d8,_0x57c58b,_0x2de8cc)[_0x3650('0x7')](function(_0x3096ed){logger[_0x3650('0xa')]('['+[_0x2d62da[_0x3650('0xb')]()]+_0x3650('0x26'),_0x3096ed);_0x1a19b0(_0x3096ed);});}})[_0x3650('0x1a')](function(_0x32cdf4){logger[_0x3650('0xd')]('['+[_0x2d62da[_0x3650('0xb')]()]+']',_0x32cdf4['message']);_0x44fd55(_0x32cdf4[_0x3650('0xe')]);});});};}function getCustomFields(_0x4f7bd6,_0x4c3c7c){var _0x21f36c={};if(_0x4f7bd6[_0x3650('0x8')]>0x0){_[_0x3650('0x27')](_0x4f7bd6,function(_0x30b1e4){if(_['includes']([_0x3650('0x28'),_0x3650('0x29')],_0x30b1e4[_0x3650('0x2a')])&&_0x30b1e4[_0x3650('0x2b')]&&!_0x30b1e4[_0x3650('0x2c')]){_0x21f36c[_0x30b1e4[_0x3650('0x2b')][_0x3650('0x2d')]()]=_0x30b1e4[_0x3650('0x2e')][_0x3650('0x2f')]();}else if(_[_0x3650('0x30')]([_0x3650('0x28'),_0x3650('0x29')],_0x30b1e4[_0x3650('0x2a')])&&_0x30b1e4[_0x3650('0x31')]&&_0x30b1e4[_0x3650('0x2c')]){_0x21f36c[_0x30b1e4['idField'][_0x3650('0x2d')]()]=_0x30b1e4[_0x3650('0x2e')][_0x3650('0x2f')]();}else if(_0x30b1e4['type']===_0x3650('0x32')&&_0x30b1e4[_0x3650('0x33')]&&_0x30b1e4[_0x3650('0x31')]&&_0x30b1e4[_0x3650('0x2c')]){_0x21f36c[_0x30b1e4[_0x3650('0x31')][_0x3650('0x2d')]()]=_0x4c3c7c[_0x30b1e4[_0x3650('0x33')]]['toString']();}else if(_0x30b1e4[_0x3650('0x2a')]===_0x3650('0x34')&&_0x30b1e4[_0x3650('0x35')]&&_0x30b1e4[_0x3650('0x35')]['name']&&_0x30b1e4[_0x3650('0x31')]&&_0x30b1e4[_0x3650('0x2c')]){_0x21f36c[_0x30b1e4['idField']['toLowerCase']()]=_0x4c3c7c[_0x30b1e4[_0x3650('0x35')][_0x3650('0x36')][_0x3650('0x2d')]()][_0x3650('0x2f')]();}});}return _0x21f36c;}function getTicket(_0x2b6771,_0x135090,_0x360c7a,_0x2d29c1,_0x4222b9,_0x1bf174){return function(_0x361bf0){logger[_0x3650('0xa')]('['+[_0x2b6771[_0x3650('0xb')]()]+_0x3650('0x37'),_0x361bf0);return new Promise(function(_0x64dedd,_0x418994){var _0x5388b3=_0x2b6771[_0x3650('0x2d')]()===_0x3650('0x38')?_0x361bf0['userId']:_0x361bf0[_0x3650('0x22')];var _0x1dc762={'method':_0x3650('0x1c'),'uri':_0x360c7a+'incident'+'?'+_0x1bf174,'body':Object[_0x3650('0x39')]({},{'active':_0x3650('0x15'),'caller_id':_0x5388b3,'assigned_to':_0x361bf0[_0x3650('0x16')],'short_description':intUtil[_0x3650('0x3a')](_0x2d29c1[_0x3650('0x3b')],_0x4222b9,'\x20'),'description':intUtil[_0x3650('0x3a')](_0x2d29c1['Descriptions'],_0x4222b9,'\x0a')},getCustomFields(_0x2d29c1[_0x3650('0x3c')],_0x4222b9)),'auth':_0x135090,'json':!![]};return rp(_0x1dc762)[_0x3650('0x7')](function(_0x301529){logger['info']('['+[_0x2b6771[_0x3650('0xb')]()]+_0x3650('0x3d'),_0x301529[_0x3650('0x14')]);_0x361bf0[_0x3650('0x3e')]=_0x301529[_0x3650('0x14')][_0x3650('0x17')];_0x361bf0['ticketNumber']=_0x301529[_0x3650('0x14')][_0x3650('0x3f')];logger[_0x3650('0xa')]('['+[_0x2b6771[_0x3650('0xb')]()]+_0x3650('0x40'),_0x361bf0);_0x64dedd(_0x361bf0);})['catch'](function(_0x413b52){logger[_0x3650('0xd')]('['+[_0x2b6771[_0x3650('0xb')]()]+']',_0x413b52[_0x3650('0xe')]);_0x418994(_0x413b52[_0x3650('0xe')]);});});};}function createRemoteTag(_0x440207,_0x2feafa,_0x1f948d,_0x386121){return new Promise(function(_0x508e5d,_0x14f1a6){var _0x6d606c={'method':_0x3650('0x1c'),'uri':_0x1f948d+_0x3650('0x41')+'?'+_0x386121,'body':{'short_description':_0x440207,'global':!![],'active':!![],'name':_0x440207},'auth':_0x2feafa,'json':!![]};return rp(_0x6d606c)[_0x3650('0x7')](function(_0x41e52e){var _0xf9ff45=_0x41e52e[_0x3650('0x14')][_0x3650('0x17')];_0x508e5d(_0xf9ff45);});});}function getRemoteTag(_0x5e174b,_0x42e07d,_0x3af8cb,_0x2ba226,_0x12544b){return new Promise(function(_0x793e7f,_0x252df3){var _0x37e5d1={'method':_0x3650('0x5'),'uri':_0x3af8cb+_0x3650('0x41')+_0x3650('0x42')+_0x5e174b+'&'+_0x2ba226,'auth':_0x42e07d,'json':!![]};return rp(_0x37e5d1)['then'](function(_0x54ce59){if(_0x54ce59[_0x3650('0x14')][_0x3650('0x8')]>0x0){var _0x3b7479=_0x54ce59[_0x3650('0x14')][0x0]['sys_id'];_0x793e7f(_0x3b7479);}else{return createRemoteTag(_0x5e174b,_0x42e07d,_0x3af8cb,_0x2ba226)[_0x3650('0x7')](function(_0x215b16){_0x793e7f(_0x215b16);});}});});}function assignTagToIncident(_0x48d8b6,_0x3e75eb,_0x26d4f6,_0x5c800d,_0x24aee0){return new Promise(function(_0x133a99,_0x5bd02c){var _0x313486={'method':'POST','uri':_0x26d4f6+_0x3650('0x43')+'?'+_0x24aee0,'body':{'label':_0x48d8b6,'table':'incident','id_type':'Incident','table_key':_0x5c800d[_0x3650('0x3e')],'title':_0x3650('0x44')+_0x5c800d[_0x3650('0x45')],'id_display':_0x5c800d['ticketNumber']},'auth':_0x3e75eb,'json':!![]};return rp(_0x313486)[_0x3650('0x7')](function(_0xfd5b05){_0x133a99();})[_0x3650('0x1a')](function(){_0x133a99();});});}function manageTags(_0x5d9dec,_0x3bf401,_0x227a34,_0xe6c856,_0x4195f1,_0x2b2b33,_0x2b0774){return new Promise(function(_0x3606a4,_0x3f1f9f){var _0x7d3db9=[];_0x3bf401[_0x3650('0x27')](function(_0x57f954){_0x7d3db9['push'](getRemoteTag(_0x57f954,_0x227a34,_0xe6c856,_0x2b2b33,_0x2b0774));});return Promise[_0x3650('0x46')](_0x7d3db9)[_0x3650('0x7')](function(_0x160637){if(_0x160637[_0x3650('0x8')]){logger[_0x3650('0xa')]('['+[_0x5d9dec['toUpperCase']()]+_0x3650('0x47'),_0x160637);var _0x6376b7=[];_0x160637[_0x3650('0x27')](function(_0x32a6e0){_0x6376b7[_0x3650('0x48')](assignTagToIncident(_0x32a6e0,_0x227a34,_0xe6c856,_0x4195f1,_0x2b2b33));});return Promise['all'](_0x6376b7)[_0x3650('0x7')](function(){_0x3606a4();})[_0x3650('0x1a')](function(){_0x3606a4();});}else{_0x3606a4();}});});}function getTags(_0x220b4c,_0x535fbf,_0x2dcec6,_0xb76ce,_0x5d743f,_0x403d14){return function(_0x1cf1b3){return new Promise(function(_0x44519d,_0x2136e4){var _0x5088e4=[];var _0x480eb1=_0xb76ce['Tags'];if(_0x480eb1&&_0x480eb1[_0x3650('0x8')]>0x0){_0x5088e4=_[_0x3650('0x49')](_0x480eb1,_0x3650('0x36'));}if(_0x5088e4[_0x3650('0x8')]>0x0){return manageTags(_0x220b4c,_0x5088e4,_0x535fbf,_0x2dcec6,_0x1cf1b3,_0x5d743f,_0x403d14)[_0x3650('0x7')](function(){_0x44519d(_0x1cf1b3);});}else{_0x44519d(_0x1cf1b3);}});};}function emit(_0x4aca57,_0x454b9f,_0x441d8f){var _0x856dad=_0x3650('0x4a')+_0x3650('0x4b')+_0x3650('0x4c')+_0x3650('0x4d');var _0x38033b={'uri':_0x4aca57+_0x3650('0x4e')+_0x441d8f+_0x856dad};io['to'](util[_0x3650('0x4f')]('user:%s',_0x454b9f))['emit']('trigger:browser:url',_0x38033b);}exports['cs']=function(_0x168610,_0x1b9578,_0x489fe3,_0xf4be6f,_0x2020d0,_0x51bb76,_0x3cebd5,_0x4f3aa9){var _0x59ec78={};var _0x2ab2dd={'user':_0x51bb76[_0x3650('0x50')],'pass':_0x51bb76['password']};var _0x45e6de=_0x3650('0x51');var _0x22350e=_0x3650('0x52');_0x51bb76[_0x3650('0x53')]=intUtil[_0x3650('0x54')](_0x51bb76[_0x3650('0x53')]);_0x51bb76['serverUrl']=intUtil[_0x3650('0x54')](_0x51bb76[_0x3650('0x55')]);var _0x175614=util[_0x3650('0x4f')](_0x3650('0x56'),_0x51bb76[_0x3650('0x53')]);_0x59ec78['userEmail']=!_['isNil'](_0xf4be6f)?_0xf4be6f[_0x3650('0x57')]:null;_0x59ec78[_0x3650('0x18')]=_0x51bb76[_0x3650('0x57')];_0x59ec78['endUserNumber']=_0x4f3aa9[_0x3650('0x2d')]()==='outbound'?_0x1b9578['destcalleridnum']:_0x1b9578['calleridnum'];_0x59ec78[_0x3650('0x58')]=_0x4f3aa9===_0x3650('0x59')||_0x4f3aa9===_0x3650('0x5a')?'queue':_0x3650('0x38');var _0x414cbc=util[_0x3650('0x4f')](_0x3650('0x5b'),_0x51bb76[_0x3650('0x55')],_0x1b9578[_0x3650('0x5c')],md5(_0x1b9578[_0x3650('0x5c')]));if(_0x2020d0&&_0x2020d0[_0x3650('0x5d')]){logger[_0x3650('0xa')](_0x3650('0x5e'),_0x3650('0x5f'));_0x1b9578[_0x3650('0x60')]=_0x414cbc;}else if(_0x3cebd5&&_0x3cebd5[_0x3650('0x61')]&&_0x3cebd5[_0x3650('0x61')]!==_0x3650('0x62')){logger['info'](_0x3650('0x63'),_0x3650('0x5f'));_0x1b9578[_0x3650('0x60')]=_0x414cbc;}else{_0x1b9578[_0x3650('0x60')]='';}return getAdminUser(_0x4f3aa9,_0x2ab2dd,_0x59ec78,_0x175614,_0x22350e,_0x45e6de)[_0x3650('0x7')](getUser(_0x4f3aa9,_0x2ab2dd,_0x175614,_0x22350e,_0x45e6de))[_0x3650('0x7')](getEndUser(_0x4f3aa9,_0x2ab2dd,_0x175614,_0x22350e,_0x45e6de))['then'](getTicket(_0x4f3aa9,_0x2ab2dd,_0x175614,_0x489fe3,_0x1b9578,_0x22350e))[_0x3650('0x7')](function(_0x1b0651){logger[_0x3650('0xa')](util['format'](_0x3650('0x64'),_0x1b0651[_0x3650('0x3e')]));logger['info'](util['format'](_0x3650('0x65'),_0x4f3aa9));if(_0x4f3aa9!==_0x3650('0x5a')){logger['info']('['+[_0x4f3aa9[_0x3650('0xb')]()]+']',_0x3650('0x66'));emit(_0x51bb76[_0x3650('0x53')],_0xf4be6f[_0x3650('0x36')],_0x1b0651[_0x3650('0x3e')]);}})[_0x3650('0x1a')](function(_0x477c2c){logger[_0x3650('0xd')]('['+[_0x4f3aa9[_0x3650('0xb')]()]+_0x3650('0x67'),util[_0x3650('0x68')](_0x477c2c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8733=['bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','toString','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8733,0x6d));var _0x3873=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0x8733[_0x1abafe];return _0x4fae5a;};'use strict';var _=require(_0x3873('0x0'));var Promise=require(_0x3873('0x1'));var rp=require(_0x3873('0x2'));var util=require(_0x3873('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x3873('0x4'));var config=require(_0x3873('0x5'));var logger=require(_0x3873('0x6'))(_0x3873('0x7'));config[_0x3873('0x8')]=_[_0x3873('0x9')](config[_0x3873('0x8')],{'host':_0x3873('0xa'),'port':0x18eb});var io=require(_0x3873('0xb'))(new Redis(config['redis']));function getAdminUser(_0x2e0543,_0x545c25,_0x281aa9,_0x531498,_0x1e9862,_0x14e18f){return new Promise(function(_0x1e8f43,_0x276e56){var _0x11d7b9={'method':_0x3873('0xc'),'uri':_0x531498+_0x3873('0xd')+'&'+_0x1e9862+'&'+_0x14e18f,'auth':_0x545c25,'json':!![]};return rp(_0x11d7b9)[_0x3873('0xe')](function(_0x5d754f){if(_0x5d754f[_0x3873('0xf')]['length']>0x0){_0x281aa9[_0x3873('0x10')]=_0x5d754f[_0x3873('0xf')][0x0][_0x3873('0x11')];}logger['info']('['+[_0x2e0543['toUpperCase']()]+_0x3873('0x12'),_0x281aa9);_0x1e8f43(_0x281aa9);})[_0x3873('0x13')](function(_0x4d5d2b){logger[_0x3873('0x14')]('['+[_0x2e0543[_0x3873('0x15')]()]+']',_0x4d5d2b[_0x3873('0x16')]);_0x276e56(_0x4d5d2b[_0x3873('0x16')]);});});}function getUser(_0x36ade2,_0xedc2d4,_0x2f070f,_0x303af0,_0xbac5d3){return function(_0x424b57){logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x18'),_0x424b57);return new Promise(function(_0x1d41b3,_0x47e818){if(intUtil['validateEmail'](_0x424b57[_0x3873('0x19')])){var _0x3367b2={'method':'GET','uri':_0x2f070f+_0x3873('0x1a')+_0x424b57[_0x3873('0x19')]+'&'+_0x303af0+'&'+_0xbac5d3,'auth':_0xedc2d4,'json':!![]};logger['info']('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x1b'),_0x3367b2);return rp(_0x3367b2)[_0x3873('0xe')](function(_0x4a7993){logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x1c'),_0x4a7993);if(_0x4a7993[_0x3873('0xf')]['length']>0x0&&String(_0x4a7993['result'][0x0]['active'])===_0x3873('0x1d')){_0x424b57[_0x3873('0x1e')]=_0x4a7993[_0x3873('0xf')][0x0][_0x3873('0x11')];}else{_0x424b57['userId']=_0x424b57[_0x3873('0x10')];_0x424b57[_0x3873('0x19')]=_0x424b57[_0x3873('0x1f')];}logger['info']('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x20'),_0x424b57);_0x1d41b3(_0x424b57);})[_0x3873('0x13')](function(_0x4a27e4){logger[_0x3873('0x14')]('['+[_0x36ade2[_0x3873('0x15')]()]+']',_0x4a27e4[_0x3873('0x16')]);_0x47e818(_0x4a27e4[_0x3873('0x16')]);});}else{logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+']\x20using\x20admin\x20profile');_0x424b57[_0x3873('0x1e')]=_0x424b57['adminId'];_0x424b57['userEmail']=_0x424b57[_0x3873('0x1f')];_0x1d41b3(_0x424b57);}});};}function createEndUser(_0x13b1c4,_0x2f9ec2,_0x294d98,_0x5439d7,_0x1e8177){logger[_0x3873('0x17')]('['+[_0x13b1c4['toUpperCase']()]+_0x3873('0x21'),_0x294d98);return new Promise(function(_0x750ceb,_0x5747e4){var _0x5c9789={'method':_0x3873('0x22'),'uri':_0x5439d7+'sys_user?'+_0x1e8177,'body':{'user_name':_0x294d98[_0x3873('0x23')],'roles':_0x3873('0x24'),'first_name':_0x294d98[_0x3873('0x23')],'active':_0x3873('0x1d'),'date_format':_0x3873('0x25'),'phone':_0x294d98[_0x3873('0x23')]},'auth':_0x2f9ec2,'json':!![]};return rp(_0x5c9789)[_0x3873('0xe')](function(_0x1359ff){logger['info']('['+[_0x13b1c4[_0x3873('0x15')]()]+_0x3873('0x26'),_0x1359ff['result']);_0x294d98[_0x3873('0x27')]=_0x1359ff[_0x3873('0xf')]['sys_id'];_0x750ceb(_0x294d98);})[_0x3873('0x13')](function(_0x40a409){logger[_0x3873('0x14')]('['+[_0x13b1c4[_0x3873('0x15')]()]+']',_0x40a409[_0x3873('0x16')]);_0x5747e4(_0x40a409[_0x3873('0x16')]);});});}function getEndUser(_0x4d8314,_0xa20ca5,_0x1e4196,_0x5c310b,_0xe620e6){return function(_0x75d550){logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x28'),_0x75d550);return new Promise(function(_0x40ec5d,_0x4aef85){var _0x11190a={'method':_0x3873('0xc'),'uri':_0x1e4196+_0x3873('0x29')+_0x75d550[_0x3873('0x23')]+'&'+_0x5c310b+'&'+_0xe620e6,'auth':_0xa20ca5,'json':!![]};return rp(_0x11190a)['then'](function(_0xdca6c6){if(_0xdca6c6['result'][_0x3873('0x2a')]>0x0){_0x75d550[_0x3873('0x27')]=_0xdca6c6[_0x3873('0xf')][0x0][_0x3873('0x11')];logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x2b'),_0x75d550);_0x40ec5d(_0x75d550);}else{return createEndUser(_0x4d8314,_0xa20ca5,_0x75d550,_0x1e4196,_0x5c310b)[_0x3873('0xe')](function(_0x3bd66f){logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x2c'),_0x3bd66f);_0x40ec5d(_0x3bd66f);});}})['catch'](function(_0x44a891){logger['error']('['+[_0x4d8314[_0x3873('0x15')]()]+']',_0x44a891['message']);_0x4aef85(_0x44a891[_0x3873('0x16')]);});});};}function getCustomFields(_0x3b89c2,_0x225e77){var _0x5cc1da={};if(_0x3b89c2['length']>0x0){_[_0x3873('0x2d')](_0x3b89c2,function(_0xeeb6ac){if(_['includes']([_0x3873('0x2e'),_0x3873('0x2f')],_0xeeb6ac[_0x3873('0x30')])&&_0xeeb6ac[_0x3873('0x31')]&&!_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac['nameField'][_0x3873('0x33')]()]=_0xeeb6ac[_0x3873('0x34')]['toString']();}else if(_['includes'](['string',_0x3873('0x2f')],_0xeeb6ac[_0x3873('0x30')])&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac['idField'][_0x3873('0x33')]()]=_0xeeb6ac[_0x3873('0x34')]['toString']();}else if(_0xeeb6ac[_0x3873('0x30')]===_0x3873('0x36')&&_0xeeb6ac[_0x3873('0x37')]&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac[_0x3873('0x35')][_0x3873('0x33')]()]=_0x225e77[_0xeeb6ac[_0x3873('0x37')]][_0x3873('0x38')]();}else if(_0xeeb6ac[_0x3873('0x30')]==='customVariable'&&_0xeeb6ac[_0x3873('0x39')]&&_0xeeb6ac[_0x3873('0x39')]['name']&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac['customField']){_0x5cc1da[_0xeeb6ac['idField'][_0x3873('0x33')]()]=_0x225e77[_0xeeb6ac[_0x3873('0x39')]['name'][_0x3873('0x33')]()][_0x3873('0x38')]();}});}return _0x5cc1da;}function getTicket(_0x29b6c4,_0x110f5a,_0x50d051,_0x2e2e7e,_0x35b7a4,_0x121aca){return function(_0x169423){logger[_0x3873('0x17')]('['+[_0x29b6c4[_0x3873('0x15')]()]+_0x3873('0x3a'),_0x169423);return new Promise(function(_0x28e243,_0x3cf757){var _0x5ebe06=_0x29b6c4[_0x3873('0x33')]()===_0x3873('0x3b')?_0x169423[_0x3873('0x1e')]:_0x169423[_0x3873('0x27')];var _0x1d77ee={'method':'POST','uri':_0x50d051+_0x3873('0x3c')+'?'+_0x121aca,'body':Object[_0x3873('0x3d')]({},{'active':_0x3873('0x1d'),'caller_id':_0x5ebe06,'assigned_to':_0x169423[_0x3873('0x1e')],'short_description':intUtil['getString'](_0x2e2e7e[_0x3873('0x3e')],_0x35b7a4,'\x20'),'description':intUtil[_0x3873('0x3f')](_0x2e2e7e[_0x3873('0x40')],_0x35b7a4,'\x0a')},getCustomFields(_0x2e2e7e[_0x3873('0x41')],_0x35b7a4)),'auth':_0x110f5a,'json':!![]};return rp(_0x1d77ee)['then'](function(_0x41f469){logger[_0x3873('0x17')]('['+[_0x29b6c4[_0x3873('0x15')]()]+_0x3873('0x42'),_0x41f469[_0x3873('0xf')]);_0x169423['ticketId']=_0x41f469[_0x3873('0xf')][_0x3873('0x11')];_0x169423[_0x3873('0x43')]=_0x41f469[_0x3873('0xf')][_0x3873('0x44')];logger[_0x3873('0x17')]('['+[_0x29b6c4['toUpperCase']()]+_0x3873('0x45'),_0x169423);_0x28e243(_0x169423);})['catch'](function(_0x33e2fb){logger[_0x3873('0x14')]('['+[_0x29b6c4['toUpperCase']()]+']',_0x33e2fb[_0x3873('0x16')]);_0x3cf757(_0x33e2fb[_0x3873('0x16')]);});});};}function createRemoteTag(_0x34293c,_0x4cf6dd,_0x1e42d4,_0x10f301){return new Promise(function(_0x11c655,_0x591b81){var _0x4fb45c={'method':_0x3873('0x22'),'uri':_0x1e42d4+_0x3873('0x46')+'?'+_0x10f301,'body':{'short_description':_0x34293c,'global':!![],'active':!![],'name':_0x34293c},'auth':_0x4cf6dd,'json':!![]};return rp(_0x4fb45c)['then'](function(_0x2ad0d1){var _0x24beff=_0x2ad0d1['result'][_0x3873('0x11')];_0x11c655(_0x24beff);});});}function getRemoteTag(_0x2152a4,_0xbdd372,_0x1a6738,_0x33e712,_0xe742ec){return new Promise(function(_0x3fa195,_0x57df9){var _0x58490f={'method':_0x3873('0xc'),'uri':_0x1a6738+_0x3873('0x46')+_0x3873('0x47')+_0x2152a4+'&'+_0x33e712,'auth':_0xbdd372,'json':!![]};return rp(_0x58490f)[_0x3873('0xe')](function(_0x21ade0){if(_0x21ade0[_0x3873('0xf')][_0x3873('0x2a')]>0x0){var _0x301de1=_0x21ade0[_0x3873('0xf')][0x0][_0x3873('0x11')];_0x3fa195(_0x301de1);}else{return createRemoteTag(_0x2152a4,_0xbdd372,_0x1a6738,_0x33e712)[_0x3873('0xe')](function(_0x7c4171){_0x3fa195(_0x7c4171);});}});});}function assignTagToIncident(_0x1f50e4,_0x4583dc,_0x8188c7,_0xd0a35f,_0xac445a){return new Promise(function(_0x315a22,_0x50b257){var _0x38ef78={'method':_0x3873('0x22'),'uri':_0x8188c7+_0x3873('0x48')+'?'+_0xac445a,'body':{'label':_0x1f50e4,'table':_0x3873('0x3c'),'id_type':_0x3873('0x49'),'table_key':_0xd0a35f[_0x3873('0x4a')],'title':_0x3873('0x4b')+_0xd0a35f[_0x3873('0x43')],'id_display':_0xd0a35f[_0x3873('0x43')]},'auth':_0x4583dc,'json':!![]};return rp(_0x38ef78)['then'](function(_0x850c6e){_0x315a22();})[_0x3873('0x13')](function(){_0x315a22();});});}function manageTags(_0x4e0a4f,_0x4c1c55,_0x570aac,_0x2ec2bf,_0x24ee09,_0x25eec9,_0x9aadbb){return new Promise(function(_0x37e9f3,_0x223f5f){var _0x3a777d=[];_0x4c1c55[_0x3873('0x2d')](function(_0x41b408){_0x3a777d[_0x3873('0x4c')](getRemoteTag(_0x41b408,_0x570aac,_0x2ec2bf,_0x25eec9,_0x9aadbb));});return Promise[_0x3873('0x4d')](_0x3a777d)[_0x3873('0xe')](function(_0x3f18db){if(_0x3f18db[_0x3873('0x2a')]){logger[_0x3873('0x17')]('['+[_0x4e0a4f[_0x3873('0x15')]()]+_0x3873('0x4e'),_0x3f18db);var _0x47dc5c=[];_0x3f18db['forEach'](function(_0x38c3a0){_0x47dc5c[_0x3873('0x4c')](assignTagToIncident(_0x38c3a0,_0x570aac,_0x2ec2bf,_0x24ee09,_0x25eec9));});return Promise[_0x3873('0x4d')](_0x47dc5c)[_0x3873('0xe')](function(){_0x37e9f3();})['catch'](function(){_0x37e9f3();});}else{_0x37e9f3();}});});}function getTags(_0xd58fe0,_0xc719d3,_0x4dec94,_0x4941bc,_0x1ee7ab,_0x4eef63){return function(_0x18158f){return new Promise(function(_0x3f15fc,_0x18bca6){var _0x5a61a6=[];var _0x31c41d=_0x4941bc[_0x3873('0x4f')];if(_0x31c41d&&_0x31c41d['length']>0x0){_0x5a61a6=_['map'](_0x31c41d,_0x3873('0x50'));}if(_0x5a61a6[_0x3873('0x2a')]>0x0){return manageTags(_0xd58fe0,_0x5a61a6,_0xc719d3,_0x4dec94,_0x18158f,_0x1ee7ab,_0x4eef63)[_0x3873('0xe')](function(){_0x3f15fc(_0x18158f);});}else{_0x3f15fc(_0x18158f);}});};}function emit(_0x381bec,_0x46d359,_0x24da4f){var _0x50bb66=_0x3873('0x51')+_0x3873('0x52')+_0x3873('0x53')+_0x3873('0x54');var _0x72fd83={'uri':_0x381bec+_0x3873('0x55')+_0x24da4f+_0x50bb66};io['to'](util[_0x3873('0x56')](_0x3873('0x57'),_0x46d359))[_0x3873('0x58')]('trigger:browser:url',_0x72fd83);}exports['cs']=function(_0x17760c,_0x76917d,_0x2d5f35,_0x250ecb,_0x5e02f9,_0x3c9244,_0x238aad,_0x123c86){var _0x436754={};var _0x9c4c6b={'user':_0x3c9244['username'],'pass':_0x3c9244['password']};var _0x119531=_0x3873('0x59');var _0x3836e8=_0x3873('0x5a');_0x3c9244['remoteUri']=intUtil[_0x3873('0x5b')](_0x3c9244[_0x3873('0x5c')]);_0x3c9244[_0x3873('0x5d')]=intUtil[_0x3873('0x5b')](_0x3c9244[_0x3873('0x5d')]);var _0x1de8be=util['format'](_0x3873('0x5e'),_0x3c9244[_0x3873('0x5c')]);_0x436754[_0x3873('0x19')]=!_[_0x3873('0x5f')](_0x250ecb)?_0x250ecb[_0x3873('0x60')]:null;_0x436754[_0x3873('0x1f')]=_0x3c9244['email'];_0x436754['endUserNumber']=_0x123c86['toLowerCase']()==='outbound'?_0x76917d['destcalleridnum']:_0x76917d[_0x3873('0x61')];_0x436754[_0x3873('0x62')]=_0x123c86===_0x3873('0x63')||_0x123c86===_0x3873('0x64')?_0x3873('0x63'):_0x3873('0x3b');var _0x375fab=util['format'](_0x3873('0x65'),_0x3c9244[_0x3873('0x5d')],_0x76917d[_0x3873('0x66')],md5(_0x76917d[_0x3873('0x66')]));if(_0x5e02f9&&_0x5e02f9['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x76917d[_0x3873('0x67')]=_0x375fab;}else if(_0x238aad&&_0x238aad['recordingFormat']&&_0x238aad[_0x3873('0x68')]!=='none'){logger[_0x3873('0x17')](_0x3873('0x69'),'Recording\x20is\x20enabled!');_0x76917d[_0x3873('0x67')]=_0x375fab;}else{_0x76917d[_0x3873('0x67')]='';}return getAdminUser(_0x123c86,_0x9c4c6b,_0x436754,_0x1de8be,_0x3836e8,_0x119531)[_0x3873('0xe')](getUser(_0x123c86,_0x9c4c6b,_0x1de8be,_0x3836e8,_0x119531))[_0x3873('0xe')](getEndUser(_0x123c86,_0x9c4c6b,_0x1de8be,_0x3836e8,_0x119531))[_0x3873('0xe')](getTicket(_0x123c86,_0x9c4c6b,_0x1de8be,_0x2d5f35,_0x76917d,_0x3836e8))[_0x3873('0xe')](function(_0xc39721){logger[_0x3873('0x17')](util[_0x3873('0x56')](_0x3873('0x6a'),_0xc39721[_0x3873('0x4a')]));logger[_0x3873('0x17')](util[_0x3873('0x56')](_0x3873('0x6b'),_0x123c86));if(_0x123c86!==_0x3873('0x64')){logger[_0x3873('0x17')]('['+[_0x123c86['toUpperCase']()]+']',_0x3873('0x6c'));emit(_0x3c9244[_0x3873('0x5c')],_0x250ecb[_0x3873('0x50')],_0xc39721[_0x3873('0x4a')]);}})[_0x3873('0x13')](function(_0x1713a3){logger[_0x3873('0x14')]('['+[_0x123c86['toUpperCase']()]+_0x3873('0x6d'),util['inspect'](_0x1713a3,{'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 6527943..ab8f8f9 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 _0xbf4f=['user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','version','unmanaged','monitor_format','toUpperCase','isNil','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','Agent\x20found!','resolve','value','name_value_list','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','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','toString','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbf4f,0x18a));var _0xfbf4=function(_0x53c2ec,_0x56b6f8){_0x53c2ec=_0x53c2ec-0x0;var _0xbd4cd0=_0xbf4f[_0x53c2ec];return _0xbd4cd0;};'use strict';var _=require(_0xfbf4('0x0'));var rp=require(_0xfbf4('0x1'));var BPromise=require(_0xfbf4('0x2'));var md5=require('md5');var util=require(_0xfbf4('0x3'));var Redis=require('ioredis');var intUtil=require(_0xfbf4('0x4'));var config=require(_0xfbf4('0x5'));var logger=require(_0xfbf4('0x6'))(_0xfbf4('0x7'));config[_0xfbf4('0x8')]=_[_0xfbf4('0x9')](config[_0xfbf4('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xfbf4('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0xb09ed7,_0x633f01,_0x4a980d){io['to'](_0xb09ed7)[_0xfbf4('0xb')](_0x633f01,_0x4a980d);}function getTicket(_0x34f446,_0x4cfc05,_0x3905c4,_0xe15e5d,_0x5c1313,_0x1bc13,_0x445b6b,_0xefba28){logger[_0xfbf4('0xc')]('Creating\x20new\x20ticket...');var _0x2af6c8=new Date();var _0x55c039=[{'name':_0xfbf4('0xd'),'value':intUtil[_0xfbf4('0xe')](_0xe15e5d[_0xfbf4('0xf')],_0x5c1313,'\x20')},{'name':_0xfbf4('0x10'),'value':_0x4cfc05['id']},{'name':'created_by','value':_0x4cfc05['id']},{'name':_0xfbf4('0x11'),'value':intUtil[_0xfbf4('0xe')](_0xe15e5d[_0xfbf4('0x12')],_0x5c1313,'\x0a')},{'name':_0xfbf4('0x13'),'value':_0x2af6c8[_0xfbf4('0x14')]()[_0xfbf4('0x15')](0x0,0x13)[_0xfbf4('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xfbf4('0x17'),'value':_0x3905c4['id']},{'name':_0xfbf4('0x18'),'value':_0xfbf4('0x19')},{'name':_0xfbf4('0x1a'),'value':_0x3905c4[_0xfbf4('0xd')]},{'name':_0xfbf4('0x1b'),'value':_0xefba28}];if(_0x1bc13[_0xfbf4('0x1c')]){_[_0xfbf4('0x1d')](_0x1bc13,function(_0x426afc){if(_0x5c1313[_0x426afc[_0xfbf4('0x1e')]]){_0x55c039['push']({'name':_0x426afc[_0xfbf4('0x1f')],'value':_0x5c1313[_0x426afc[_0xfbf4('0x1e')]]});}});}return request({'form':{'method':_0xfbf4('0x20'),'input_type':_0xfbf4('0x21'),'response_type':_0xfbf4('0x21'),'rest_data':JSON[_0xfbf4('0x22')]({'session':_0x445b6b['id'],'module_name':_0xfbf4('0x23'),'name_value_list':_0x55c039})}});}function getAuth(_0x53a3a0){return util[_0xfbf4('0x24')]('Basic\x20%s',new Buffer(_0x53a3a0[_0xfbf4('0x25')]+':X')['toString'](_0xfbf4('0x26')));}function getServerInfo(_0x3b3d23){return request({'form':{'method':_0xfbf4('0x27'),'input_type':_0xfbf4('0x21'),'response_type':_0xfbf4('0x21'),'rest_data':JSON[_0xfbf4('0x22')]({'session':_0x3b3d23['id']})}});}function getUser(_0x364715,_0x2f176d,_0x489a12){if(!_['isNil'](_0x2f176d)){logger[_0xfbf4('0xc')]('Getting\x20agent\x20with\x20name',_0x2f176d);return request({'form':{'method':_0xfbf4('0x28'),'input_type':_0xfbf4('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x489a12['id'],'module_name':'Employees','query':util[_0xfbf4('0x24')](_0xfbf4('0x29'),_0x2f176d),'order_by':'','offset':'0','select_fields':['id','name',_0xfbf4('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfbf4('0x2b')](function(_0x3acb80){if(_0x3acb80[_0xfbf4('0x2c')][_0xfbf4('0x1c')]){var _0x40ca7a=_['find'](_0x3acb80[_0xfbf4('0x2c')],function(_0x1fd591){return _0x1fd591['name_value_list'][_0xfbf4('0x2a')]['value']===_0x2f176d;});if(_0x40ca7a){logger[_0xfbf4('0xc')](_0xfbf4('0x2d'));return BPromise[_0xfbf4('0x2e')]({'id':_0x40ca7a['name_value_list']['id'][_0xfbf4('0x2f')],'name':_0x40ca7a[_0xfbf4('0x30')]['name'][_0xfbf4('0x2f')]});}}logger[_0xfbf4('0xc')](_0xfbf4('0x31'));return BPromise['resolve']({'id':_0x489a12[_0xfbf4('0x30')][_0xfbf4('0x32')]['value'],'name':_0x489a12[_0xfbf4('0x30')][_0xfbf4('0x2a')]['value']});});}else{logger[_0xfbf4('0xc')](_0xfbf4('0x33'));return BPromise[_0xfbf4('0x2e')]({'id':_0x489a12[_0xfbf4('0x30')][_0xfbf4('0x32')]['value'],'name':_0x489a12[_0xfbf4('0x30')]['user_name']['value']});}}function getEndUser(_0x42d77f,_0x5f1434,_0x3f1f5f,_0x1038ec){logger[_0xfbf4('0xc')](_0xfbf4('0x34'),_0x3f1f5f);return request({'form':{'method':'get_entry_list','input_type':_0xfbf4('0x21'),'response_type':_0xfbf4('0x21'),'rest_data':JSON['stringify']({'session':_0x1038ec['id'],'module_name':_0xfbf4('0x19'),'query':util[_0xfbf4('0x24')](_0xfbf4('0x35'),_0x3f1f5f),'order_by':'','offset':'0','select_fields':['id',_0xfbf4('0xd'),_0xfbf4('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfbf4('0x2b')](function(_0x1b448d){if(_0x1b448d[_0xfbf4('0x2c')][_0xfbf4('0x1c')]){var _0x7a23e8=_[_0xfbf4('0x37')](_0x1b448d[_0xfbf4('0x2c')],function(_0xe1499){return _0xe1499[_0xfbf4('0x30')][_0xfbf4('0x36')]['value']===_0x3f1f5f;});if(_0x7a23e8){logger[_0xfbf4('0xc')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x7a23e8[_0xfbf4('0x30')]['id'][_0xfbf4('0x2f')],'name':_0x7a23e8[_0xfbf4('0x30')][_0xfbf4('0xd')]['value'],'phone':_0x7a23e8[_0xfbf4('0x30')][_0xfbf4('0x36')][_0xfbf4('0x2f')]});}}else{logger[_0xfbf4('0xc')](_0xfbf4('0x38'));return request({'form':{'method':_0xfbf4('0x20'),'input_type':'JSON','response_type':_0xfbf4('0x21'),'rest_data':JSON[_0xfbf4('0x22')]({'session':_0x1038ec['id'],'module_name':_0xfbf4('0x19'),'name_value_list':[{'name':_0xfbf4('0x39'),'value':_0x5f1434!==_0xfbf4('0x3a')?_0x5f1434:util[_0xfbf4('0x24')](_0xfbf4('0x3b'),_0x3f1f5f)},{'name':_0xfbf4('0x36'),'value':_0x3f1f5f}]})}})['then'](function(_0x3c2407){logger['info'](_0xfbf4('0x3c'));return BPromise[_0xfbf4('0x2e')]({'id':_0x3c2407['id'],'name':_0x3c2407['entry_list'][_0xfbf4('0x39')][_0xfbf4('0x2f')],'phone':_0x3c2407[_0xfbf4('0x2c')][_0xfbf4('0x36')][_0xfbf4('0x2f')]});});}});}function request(_0x3e1173){logger[_0xfbf4('0x3d')](_0xfbf4('0x3e'),JSON[_0xfbf4('0x22')](_0x3e1173));return rp(_[_0xfbf4('0x3f')](def,_0x3e1173));}function getTags(_0x54233a,_0x458a2e){var _0x34cd08=[];if(_0x54233a&&_0x54233a['length']>0x0){_0x34cd08=_[_0xfbf4('0x40')](_0x54233a,_0x458a2e);}return _0x34cd08;}function getCustomFields(_0x38ff3e,_0x3857de){var _0x510880=[];var _0x46745c={'custom_fields':[]};if(_0x38ff3e[_0xfbf4('0x1c')]>0x0){_[_0xfbf4('0x1d')](_0x38ff3e,function(_0x489306){if(_0x489306[_0xfbf4('0x41')]===_0xfbf4('0x42')&&_0x489306[_0xfbf4('0x43')]&&!_0x489306[_0xfbf4('0x44')]){_0x46745c[_0x489306[_0xfbf4('0x43')][_0xfbf4('0x45')]()]=_0x489306[_0xfbf4('0x46')]['toString']();}else if(_0x489306[_0xfbf4('0x41')]==='string'&&_0x489306['idField']&&_0x489306[_0xfbf4('0x44')]){_0x46745c[_0xfbf4('0x47')][_0xfbf4('0x48')]({'id':_0x489306[_0xfbf4('0x1f')],'value':_0x489306[_0xfbf4('0x46')]['toString']()});}else if(_0x489306[_0xfbf4('0x41')]===_0xfbf4('0x49')&&_0x489306[_0xfbf4('0x1e')]&&_0x489306[_0xfbf4('0x1f')]&&_0x489306[_0xfbf4('0x44')]){_0x3857de[_0x489306[_0xfbf4('0x1e')]]&&_0x46745c[_0xfbf4('0x47')][_0xfbf4('0x48')]({'id':_0x489306[_0xfbf4('0x1f')],'value':_0x3857de[_0x489306[_0xfbf4('0x1e')]]['toString']()});}else if(_0x489306[_0xfbf4('0x41')]===_0xfbf4('0x4a')&&_0x489306[_0xfbf4('0x4b')]&&_0x489306[_0xfbf4('0x4b')]['name']&&_0x489306[_0xfbf4('0x1f')]&&_0x489306[_0xfbf4('0x44')]){_0x3857de[_0x489306[_0xfbf4('0x4b')]['name'][_0xfbf4('0x45')]()]&&_0x46745c[_0xfbf4('0x47')][_0xfbf4('0x48')]({'id':_0x489306['idField'],'value':_0x3857de[_0x489306[_0xfbf4('0x4b')]['name'][_0xfbf4('0x45')]()][_0xfbf4('0x4c')]()});}});}return _0x46745c;}function getConnection(_0x5d5481){return request({'method':_0xfbf4('0x4d'),'form':{'method':_0xfbf4('0x4e'),'input_type':_0xfbf4('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5d5481[_0xfbf4('0x4f')],'password':_0x5d5481[_0xfbf4('0x50')],'encryption':_0xfbf4('0x51')},'application':_0xfbf4('0x52')})}})['then'](function(_0x5c0efe){var _0xa82bb4=_0x5c0efe;if(_0xa82bb4['id']){def['sessionID']=_0xa82bb4['id'];return BPromise[_0xfbf4('0x2e')](_0xa82bb4);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5d5481['id']));}});}function setRelationship(_0x526bce,_0x4aba92,_0x1b7ad1,_0x1f116c){return request({'form':{'method':'set_relationship','input_type':_0xfbf4('0x21'),'response_type':_0xfbf4('0x21'),'rest_data':JSON['stringify']({'session':_0x526bce['id'],'module_name':_0xfbf4('0x23'),'module_id':_0x1b7ad1['id'],'link_field_name':_0x1f116c,'related_ids':[_0x4aba92['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfbf4('0x53')]=function(_0x2d6f00,_0x3ebc56,_0x20fdd9,_0x23c4dc,_0x56c6e0,_0x500efd){var _0x2bd6da,_0x268abf,_0x4b4bad,_0x1a84d8;_0x500efd[_0xfbf4('0x54')]=intUtil[_0xfbf4('0x55')](_0x500efd[_0xfbf4('0x54')]);_0x500efd[_0xfbf4('0x56')]=intUtil[_0xfbf4('0x55')](_0x500efd['serverUrl']);def['uri']=util[_0xfbf4('0x24')](_0xfbf4('0x57'),_0x500efd[_0xfbf4('0x54')]);if(_0x56c6e0&&_0x56c6e0['monitor_format']){logger[_0xfbf4('0xc')](_0xfbf4('0x58'),_0xfbf4('0x59'));_0x3ebc56['recordingURL']=util[_0xfbf4('0x24')](_0xfbf4('0x5a'),_0x500efd[_0xfbf4('0x56')],_0x3ebc56[_0xfbf4('0x5b')],md5(_0x3ebc56[_0xfbf4('0x5b')]));}else{_0x3ebc56['recordingURL']='';}return getConnection(_0x500efd)[_0xfbf4('0x2b')](function(_0x5668aa){_0x1a84d8=_0x5668aa;return getUser(_0x500efd,_0x23c4dc[_0xfbf4('0xd')],_0x1a84d8);})['then'](function(_0x34c73a){_0x2bd6da=_0x34c73a;logger[_0xfbf4('0xc')]('The\x20User\x20ID\x20is:',_0x2bd6da['id']);return getEndUser(_0x500efd,_0x3ebc56[_0xfbf4('0x5c')],_0x3ebc56[_0xfbf4('0x5d')],_0x1a84d8);})[_0xfbf4('0x2b')](function(_0x3ede1e){_0x268abf=_0x3ede1e;logger[_0xfbf4('0xc')]('The\x20Enduser\x20ID\x20is:',_0x268abf['id']);return getTicket(_0x500efd,_0x2bd6da,_0x268abf,_0x20fdd9,_0x3ebc56,_0x20fdd9[_0xfbf4('0x5e')],_0x1a84d8,_0xfbf4('0x5f'));})[_0xfbf4('0x2b')](function(_0x166e17){_0x4b4bad=_0x166e17;logger[_0xfbf4('0xc')]('Ticket\x20created!');logger[_0xfbf4('0xc')](_0xfbf4('0x60'),_0x4b4bad['id']);return setRelationship(_0x1a84d8,_0x2bd6da,_0x4b4bad,'users');})['then'](function(){return setRelationship(_0x1a84d8,_0x268abf,_0x4b4bad,_0xfbf4('0x61'));})[_0xfbf4('0x2b')](function(){return getServerInfo(_0x1a84d8);})[_0xfbf4('0x2b')](function(_0x429ce0){var _0x5f2b9c=parseInt(_0x429ce0['version'][_0xfbf4('0x62')](0x0));var _0x36de4e=util[_0xfbf4('0x24')](_0xfbf4('0x63'),_0x500efd[_0xfbf4('0x54')],_0x4b4bad['id']);if(_0x5f2b9c>0x6){_0x36de4e=util['format'](_0xfbf4('0x64'),_0x500efd[_0xfbf4('0x54')],_0x4b4bad['id']);}logger[_0xfbf4('0xc')]('[QUEUE]',_0xfbf4('0x65'));emit(util[_0xfbf4('0x24')](_0xfbf4('0x66'),_0x23c4dc[_0xfbf4('0xd')]),_0xfbf4('0x67'),{'uri':_0x36de4e});})[_0xfbf4('0x68')](function(_0x34b06d){logger[_0xfbf4('0x69')](_0xfbf4('0x58'),JSON[_0xfbf4('0x22')](_0x34b06d));});};exports[_0xfbf4('0x6a')]=function(_0x47e63a,_0x58bff3,_0x3c0d70,_0x312065,_0x18ea70,_0x3e72a9,_0x45bb91){var _0x1c436a,_0x37f2a7,_0x417f12,_0x57c420;_0x3e72a9[_0xfbf4('0x54')]=intUtil['stripTrailingSlash'](_0x3e72a9[_0xfbf4('0x54')]);_0x3e72a9[_0xfbf4('0x56')]=intUtil[_0xfbf4('0x55')](_0x3e72a9[_0xfbf4('0x56')]);def[_0xfbf4('0x6b')]=util[_0xfbf4('0x24')](_0xfbf4('0x57'),_0x3e72a9[_0xfbf4('0x54')]);if(_0x45bb91&&_0x45bb91[_0xfbf4('0x6c')]&&_0x45bb91[_0xfbf4('0x6c')]!==_0xfbf4('0x6d')){logger['info'](_0xfbf4('0x6e'),_0xfbf4('0x59'));_0x58bff3['recordingURL']=util[_0xfbf4('0x24')](_0xfbf4('0x5a'),_0x3e72a9['serverUrl'],_0x58bff3[_0xfbf4('0x5b')],md5(_0x58bff3[_0xfbf4('0x5b')]));}return getConnection(_0x3e72a9)[_0xfbf4('0x2b')](function(_0x32e114){_0x57c420=_0x32e114;return getUser(_0x3e72a9,_0x312065[_0xfbf4('0xd')],_0x57c420);})[_0xfbf4('0x2b')](function(_0x5a2528){_0x1c436a=_0x5a2528;logger['info'](_0xfbf4('0x6f'),_0x1c436a['id']);return getEndUser(_0x3e72a9,_0x58bff3[_0xfbf4('0x70')],_0x58bff3[_0xfbf4('0x71')],_0x57c420);})['then'](function(_0x331440){_0x37f2a7=_0x331440;logger['info']('The\x20Enduser\x20ID\x20is:',_0x37f2a7['id']);return getTicket(_0x3e72a9,_0x1c436a,_0x37f2a7,_0x3c0d70,_0x58bff3,_0x3c0d70[_0xfbf4('0x5e')],_0x57c420,_0xfbf4('0x72'));})[_0xfbf4('0x2b')](function(_0xe4ef1d){_0x417f12=_0xe4ef1d;logger[_0xfbf4('0xc')](_0xfbf4('0x73'));logger[_0xfbf4('0xc')](_0xfbf4('0x60'),_0x417f12['id']);return setRelationship(_0x57c420,_0x1c436a,_0x417f12,_0xfbf4('0x74'));})[_0xfbf4('0x2b')](function(){return setRelationship(_0x57c420,_0x37f2a7,_0x417f12,_0xfbf4('0x61'));})[_0xfbf4('0x2b')](function(){return getServerInfo(_0x57c420);})['then'](function(_0x11bacd){var _0x2cba4f=parseInt(_0x11bacd[_0xfbf4('0x75')][_0xfbf4('0x62')](0x0));var _0x5d20b7=util[_0xfbf4('0x24')](_0xfbf4('0x63'),_0x3e72a9[_0xfbf4('0x54')],_0x417f12['id']);if(_0x2cba4f>0x6){_0x5d20b7=util['format'](_0xfbf4('0x64'),_0x3e72a9[_0xfbf4('0x54')],_0x417f12['id']);}logger[_0xfbf4('0xc')](_0xfbf4('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfbf4('0x24')](_0xfbf4('0x66'),_0x312065[_0xfbf4('0xd')]),_0xfbf4('0x67'),{'uri':_0x5d20b7});})[_0xfbf4('0x68')](function(_0x26b69e){logger[_0xfbf4('0x69')](_0xfbf4('0x6e'),JSON[_0xfbf4('0x22')](_0x26b69e));});};exports[_0xfbf4('0x76')]=function(_0x14a864,_0x4598e6,_0x2531e2,_0x4b6f8e,_0x5c9ce7,_0xf601){var _0x321200,_0xc3dcdd,_0x262583,_0xd36943;_0xf601['remoteUri']=intUtil[_0xfbf4('0x55')](_0xf601['remoteUri']);_0xf601['serverUrl']=intUtil[_0xfbf4('0x55')](_0xf601[_0xfbf4('0x56')]);def[_0xfbf4('0x6b')]=util[_0xfbf4('0x24')](_0xfbf4('0x57'),_0xf601['remoteUri']);if(_0x5c9ce7&&_0x5c9ce7[_0xfbf4('0x77')]){logger[_0xfbf4('0xc')]('['+_0x4598e6['lastevent'][_0xfbf4('0x78')]()+']','Recording\x20is\x20enabled!');_0x4598e6['recordingURL']=util[_0xfbf4('0x24')](_0xfbf4('0x5a'),_0xf601[_0xfbf4('0x56')],_0x4598e6[_0xfbf4('0x5b')],md5(_0x4598e6[_0xfbf4('0x5b')]));}else{_0x4598e6['recordingURL']='';}return getConnection(_0xf601)[_0xfbf4('0x2b')](function(_0x1ff270){_0xd36943=_0x1ff270;if(!_[_0xfbf4('0x79')](_0x4b6f8e)){return getUser(_0xf601,_0x4b6f8e[_0xfbf4('0xd')],_0xd36943);}else{return getUser(_0xf601,null,_0xd36943);}})[_0xfbf4('0x2b')](function(_0x106923){_0x321200=_0x106923;logger['info']('The\x20User\x20ID\x20is:',_0x321200['id']);return getEndUser(_0xf601,_0x4598e6['calleridname'],_0x4598e6[_0xfbf4('0x5d')],_0xd36943);})[_0xfbf4('0x2b')](function(_0x333881){_0xc3dcdd=_0x333881;logger[_0xfbf4('0xc')](_0xfbf4('0x7a'),_0xc3dcdd['id']);return getTicket(_0xf601,_0x321200,_0xc3dcdd,_0x2531e2,_0x4598e6,_0x2531e2[_0xfbf4('0x5e')],_0xd36943,_0xfbf4('0x5f'));})[_0xfbf4('0x2b')](function(_0x2d02e0){_0x262583=_0x2d02e0;logger['info'](_0xfbf4('0x73'));logger[_0xfbf4('0xc')](_0xfbf4('0x60'),_0x262583['id']);return setRelationship(_0xd36943,_0x321200,_0x262583,_0xfbf4('0x74'));})[_0xfbf4('0x2b')](function(){return setRelationship(_0xd36943,_0xc3dcdd,_0x262583,_0xfbf4('0x61'));})[_0xfbf4('0x2b')](function(){return getServerInfo(_0xd36943);})[_0xfbf4('0x68')](function(_0x524384){logger[_0xfbf4('0x69')]('['+_0x4598e6[_0xfbf4('0x7b')][_0xfbf4('0x78')]()+']',JSON[_0xfbf4('0x22')](_0x524384));});}; \ No newline at end of file +var _0x9b22=['uri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','length','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x425396,_0x58190d){var _0x31c212=function(_0x59f71c){while(--_0x59f71c){_0x425396['push'](_0x425396['shift']());}};_0x31c212(++_0x58190d);}(_0x9b22,0x9d));var _0x29b2=function(_0x5a89b2,_0x437a57){_0x5a89b2=_0x5a89b2-0x0;var _0x27a3eb=_0x9b22[_0x5a89b2];return _0x27a3eb;};'use strict';var _=require(_0x29b2('0x0'));var rp=require(_0x29b2('0x1'));var BPromise=require('bluebird');var md5=require(_0x29b2('0x2'));var util=require(_0x29b2('0x3'));var Redis=require(_0x29b2('0x4'));var intUtil=require('./util');var config=require(_0x29b2('0x5'));var logger=require(_0x29b2('0x6'))(_0x29b2('0x7'));config[_0x29b2('0x8')]=_[_0x29b2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x29b2('0xa'))(new Redis(config[_0x29b2('0x8')]));var def={'method':_0x29b2('0xb'),'json':!![]};function emit(_0x4a3801,_0x4c39a2,_0x494854){io['to'](_0x4a3801)[_0x29b2('0xc')](_0x4c39a2,_0x494854);}function getTicket(_0x22ed62,_0x40ef2b,_0x3cc78c,_0x58a014,_0x1b1599,_0x187a60,_0xda3661,_0x450852){logger[_0x29b2('0xd')](_0x29b2('0xe'));var _0x1f60c3=new Date();var _0x18a0ca=[{'name':_0x29b2('0xf'),'value':intUtil[_0x29b2('0x10')](_0x58a014[_0x29b2('0x11')],_0x1b1599,'\x20')},{'name':_0x29b2('0x12'),'value':_0x40ef2b['id']},{'name':'created_by','value':_0x40ef2b['id']},{'name':_0x29b2('0x13'),'value':intUtil['getString'](_0x58a014[_0x29b2('0x14')],_0x1b1599,'\x0a')},{'name':_0x29b2('0x15'),'value':_0x1f60c3[_0x29b2('0x16')]()[_0x29b2('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x29b2('0x18'),'value':'15'},{'name':_0x29b2('0x19'),'value':_0x3cc78c['id']},{'name':_0x29b2('0x1a'),'value':'Contacts'},{'name':_0x29b2('0x1b'),'value':_0x3cc78c[_0x29b2('0xf')]},{'name':_0x29b2('0x1c'),'value':_0x450852}];if(_0x187a60['length']){_[_0x29b2('0x1d')](_0x187a60,function(_0xafe11e){if(_0x1b1599[_0xafe11e[_0x29b2('0x1e')]]){_0x18a0ca[_0x29b2('0x1f')]({'name':_0xafe11e['idField'],'value':_0x1b1599[_0xafe11e[_0x29b2('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x29b2('0x20'),'response_type':'JSON','rest_data':JSON[_0x29b2('0x21')]({'session':_0xda3661['id'],'module_name':_0x29b2('0x22'),'name_value_list':_0x18a0ca})}});}function getAuth(_0x4b9d58){return util['format'](_0x29b2('0x23'),new Buffer(_0x4b9d58[_0x29b2('0x24')]+':X')[_0x29b2('0x25')](_0x29b2('0x26')));}function getServerInfo(_0x26a7aa){return request({'form':{'method':_0x29b2('0x27'),'input_type':_0x29b2('0x20'),'response_type':'JSON','rest_data':JSON[_0x29b2('0x21')]({'session':_0x26a7aa['id']})}});}function getUser(_0x56089c,_0x45341c,_0x422b3d){if(!_[_0x29b2('0x28')](_0x45341c)){logger[_0x29b2('0xd')](_0x29b2('0x29'),_0x45341c);return request({'form':{'method':_0x29b2('0x2a'),'input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x422b3d['id'],'module_name':_0x29b2('0x2b'),'query':util[_0x29b2('0x2c')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x45341c),'order_by':'','offset':'0','select_fields':['id',_0x29b2('0xf'),_0x29b2('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x29b2('0x2e')](function(_0x51a4f1){if(_0x51a4f1[_0x29b2('0x2f')][_0x29b2('0x30')]){var _0x2da0af=_[_0x29b2('0x31')](_0x51a4f1[_0x29b2('0x2f')],function(_0x478435){return _0x478435[_0x29b2('0x32')][_0x29b2('0x2d')]['value']===_0x45341c;});if(_0x2da0af){logger[_0x29b2('0xd')](_0x29b2('0x33'));return BPromise[_0x29b2('0x34')]({'id':_0x2da0af[_0x29b2('0x32')]['id'][_0x29b2('0x35')],'name':_0x2da0af['name_value_list']['name'][_0x29b2('0x35')]});}}logger[_0x29b2('0xd')](_0x29b2('0x36'));return BPromise['resolve']({'id':_0x422b3d['name_value_list'][_0x29b2('0x37')][_0x29b2('0x35')],'name':_0x422b3d[_0x29b2('0x32')][_0x29b2('0x2d')][_0x29b2('0x35')]});});}else{logger['info'](_0x29b2('0x38'));return BPromise[_0x29b2('0x34')]({'id':_0x422b3d[_0x29b2('0x32')][_0x29b2('0x37')][_0x29b2('0x35')],'name':_0x422b3d['name_value_list'][_0x29b2('0x2d')][_0x29b2('0x35')]});}}function getEndUser(_0x5c067d,_0x1b8eef,_0x1eae7f,_0x4fb289){logger['info'](_0x29b2('0x39'),_0x1eae7f);return request({'form':{'method':_0x29b2('0x2a'),'input_type':_0x29b2('0x20'),'response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x4fb289['id'],'module_name':_0x29b2('0x3a'),'query':util['format'](_0x29b2('0x3b'),_0x1eae7f),'order_by':'','offset':'0','select_fields':['id','name',_0x29b2('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x246ba5){if(_0x246ba5[_0x29b2('0x2f')][_0x29b2('0x30')]){var _0x17a515=_['find'](_0x246ba5[_0x29b2('0x2f')],function(_0x45bce3){return _0x45bce3[_0x29b2('0x32')][_0x29b2('0x3c')][_0x29b2('0x35')]===_0x1eae7f;});if(_0x17a515){logger[_0x29b2('0xd')](_0x29b2('0x3d'));return BPromise['resolve']({'id':_0x17a515[_0x29b2('0x32')]['id'][_0x29b2('0x35')],'name':_0x17a515['name_value_list']['name'][_0x29b2('0x35')],'phone':_0x17a515[_0x29b2('0x32')][_0x29b2('0x3c')][_0x29b2('0x35')]});}}else{logger[_0x29b2('0xd')](_0x29b2('0x3e'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x4fb289['id'],'module_name':_0x29b2('0x3a'),'name_value_list':[{'name':'first_name','value':_0x1b8eef!==_0x29b2('0x3f')?_0x1b8eef:util[_0x29b2('0x2c')]('Caller\x20-\x20%s',_0x1eae7f)},{'name':_0x29b2('0x3c'),'value':_0x1eae7f}]})}})[_0x29b2('0x2e')](function(_0x72b116){logger[_0x29b2('0xd')](_0x29b2('0x40'));return BPromise[_0x29b2('0x34')]({'id':_0x72b116['id'],'name':_0x72b116[_0x29b2('0x2f')][_0x29b2('0x41')][_0x29b2('0x35')],'phone':_0x72b116['entry_list'][_0x29b2('0x3c')]['value']});});}});}function request(_0x5baa5e){logger['debug'](_0x29b2('0x42'),JSON['stringify'](_0x5baa5e));return rp(_['merge'](def,_0x5baa5e));}function getTags(_0x18cc92,_0x3bdcf4){var _0x5ba6b4=[];if(_0x18cc92&&_0x18cc92[_0x29b2('0x30')]>0x0){_0x5ba6b4=_[_0x29b2('0x43')](_0x18cc92,_0x3bdcf4);}return _0x5ba6b4;}function getCustomFields(_0x38667e,_0x2d1060){var _0x3b8c03=[];var _0x573800={'custom_fields':[]};if(_0x38667e[_0x29b2('0x30')]>0x0){_[_0x29b2('0x1d')](_0x38667e,function(_0x16c749){if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x45')&&_0x16c749[_0x29b2('0x46')]&&!_0x16c749[_0x29b2('0x47')]){_0x573800[_0x16c749['nameField'][_0x29b2('0x48')]()]=_0x16c749[_0x29b2('0x49')][_0x29b2('0x25')]();}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x45')&&_0x16c749[_0x29b2('0x4a')]&&_0x16c749[_0x29b2('0x47')]){_0x573800[_0x29b2('0x4b')]['push']({'id':_0x16c749[_0x29b2('0x4a')],'value':_0x16c749[_0x29b2('0x49')]['toString']()});}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x4c')&&_0x16c749[_0x29b2('0x1e')]&&_0x16c749['idField']&&_0x16c749[_0x29b2('0x47')]){_0x2d1060[_0x16c749['variableName']]&&_0x573800[_0x29b2('0x4b')][_0x29b2('0x1f')]({'id':_0x16c749[_0x29b2('0x4a')],'value':_0x2d1060[_0x16c749[_0x29b2('0x1e')]]['toString']()});}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x4d')&&_0x16c749['Variable']&&_0x16c749['Variable'][_0x29b2('0xf')]&&_0x16c749['idField']&&_0x16c749[_0x29b2('0x47')]){_0x2d1060[_0x16c749['Variable'][_0x29b2('0xf')]['toLowerCase']()]&&_0x573800['custom_fields']['push']({'id':_0x16c749['idField'],'value':_0x2d1060[_0x16c749['Variable'][_0x29b2('0xf')][_0x29b2('0x48')]()][_0x29b2('0x25')]()});}});}return _0x573800;}function getConnection(_0x39ec9){return request({'method':'POST','form':{'method':_0x29b2('0x4e'),'input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'user_auth':{'user_name':_0x39ec9['username'],'password':_0x39ec9[_0x29b2('0x4f')],'encryption':_0x29b2('0x50')},'application':_0x29b2('0x51')})}})[_0x29b2('0x2e')](function(_0x533e26){var _0x154f26=_0x533e26;if(_0x154f26['id']){def[_0x29b2('0x52')]=_0x154f26['id'];return BPromise[_0x29b2('0x34')](_0x154f26);}else{throw new Error(util['format'](_0x29b2('0x53'),_0x39ec9['id']));}});}function setRelationship(_0x1b6f7a,_0x3ecfb8,_0x49e52b,_0xc40cba){return request({'form':{'method':_0x29b2('0x54'),'input_type':_0x29b2('0x20'),'response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x1b6f7a['id'],'module_name':_0x29b2('0x22'),'module_id':_0x49e52b['id'],'link_field_name':_0xc40cba,'related_ids':[_0x3ecfb8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x29b2('0x55')]=function(_0x573ec8,_0x31ee33,_0xd751ad,_0x5b93ae,_0x590549,_0x554559){var _0x1e4a1a,_0x49b5cd,_0x4b534a,_0x56c695;_0x554559[_0x29b2('0x56')]=intUtil[_0x29b2('0x57')](_0x554559['remoteUri']);_0x554559[_0x29b2('0x58')]=intUtil['stripTrailingSlash'](_0x554559[_0x29b2('0x58')]);def[_0x29b2('0x59')]=util[_0x29b2('0x2c')]('%s/service/v4_1/rest.php',_0x554559['remoteUri']);if(_0x590549&&_0x590549['monitor_format']){logger[_0x29b2('0xd')](_0x29b2('0x5a'),_0x29b2('0x5b'));_0x31ee33['recordingURL']=util['format'](_0x29b2('0x5c'),_0x554559[_0x29b2('0x58')],_0x31ee33[_0x29b2('0x5d')],md5(_0x31ee33['uniqueid']));}else{_0x31ee33['recordingURL']='';}return getConnection(_0x554559)['then'](function(_0x4fa544){_0x56c695=_0x4fa544;return getUser(_0x554559,_0x5b93ae[_0x29b2('0xf')],_0x56c695);})[_0x29b2('0x2e')](function(_0x2e9661){_0x1e4a1a=_0x2e9661;logger[_0x29b2('0xd')]('The\x20User\x20ID\x20is:',_0x1e4a1a['id']);return getEndUser(_0x554559,_0x31ee33[_0x29b2('0x5e')],_0x31ee33[_0x29b2('0x5f')],_0x56c695);})[_0x29b2('0x2e')](function(_0x1e6c08){_0x49b5cd=_0x1e6c08;logger[_0x29b2('0xd')](_0x29b2('0x60'),_0x49b5cd['id']);return getTicket(_0x554559,_0x1e4a1a,_0x49b5cd,_0xd751ad,_0x31ee33,_0xd751ad[_0x29b2('0x61')],_0x56c695,_0x29b2('0x62'));})['then'](function(_0x190e1d){_0x4b534a=_0x190e1d;logger['info']('Ticket\x20created!');logger[_0x29b2('0xd')](_0x29b2('0x63'),_0x4b534a['id']);return setRelationship(_0x56c695,_0x1e4a1a,_0x4b534a,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x56c695,_0x49b5cd,_0x4b534a,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x56c695);})['then'](function(_0x366556){var _0x498b8c=parseInt(_0x366556[_0x29b2('0x66')]['charAt'](0x0));var _0x550336=util['format'](_0x29b2('0x67'),_0x554559[_0x29b2('0x56')],_0x4b534a['id']);if(_0x498b8c>0x6){_0x550336=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x554559['remoteUri'],_0x4b534a['id']);}logger[_0x29b2('0xd')](_0x29b2('0x5a'),_0x29b2('0x68'));emit(util[_0x29b2('0x2c')](_0x29b2('0x69'),_0x5b93ae['name']),_0x29b2('0x6a'),{'uri':_0x550336});})['catch'](function(_0x43680c){logger[_0x29b2('0x6b')](_0x29b2('0x5a'),JSON[_0x29b2('0x21')](_0x43680c));});};exports['outbound']=function(_0x3b6bb6,_0x26cff7,_0x44e48b,_0x2f0e54,_0x4d4f92,_0x230290,_0x135a31){var _0x113c5c,_0x156e56,_0x2d2db4,_0x14d2ed;_0x230290[_0x29b2('0x56')]=intUtil['stripTrailingSlash'](_0x230290[_0x29b2('0x56')]);_0x230290[_0x29b2('0x58')]=intUtil['stripTrailingSlash'](_0x230290[_0x29b2('0x58')]);def['uri']=util[_0x29b2('0x2c')](_0x29b2('0x6c'),_0x230290['remoteUri']);if(_0x135a31&&_0x135a31['recordingFormat']&&_0x135a31[_0x29b2('0x6d')]!=='none'){logger['info'](_0x29b2('0x6e'),_0x29b2('0x5b'));_0x26cff7[_0x29b2('0x6f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x230290['serverUrl'],_0x26cff7['uniqueid'],md5(_0x26cff7[_0x29b2('0x5d')]));}return getConnection(_0x230290)[_0x29b2('0x2e')](function(_0x5d653a){_0x14d2ed=_0x5d653a;return getUser(_0x230290,_0x2f0e54[_0x29b2('0xf')],_0x14d2ed);})[_0x29b2('0x2e')](function(_0xd0b746){_0x113c5c=_0xd0b746;logger['info'](_0x29b2('0x70'),_0x113c5c['id']);return getEndUser(_0x230290,_0x26cff7[_0x29b2('0x71')],_0x26cff7[_0x29b2('0x72')],_0x14d2ed);})[_0x29b2('0x2e')](function(_0x2d01fe){_0x156e56=_0x2d01fe;logger[_0x29b2('0xd')]('The\x20Enduser\x20ID\x20is:',_0x156e56['id']);return getTicket(_0x230290,_0x113c5c,_0x156e56,_0x44e48b,_0x26cff7,_0x44e48b[_0x29b2('0x61')],_0x14d2ed,_0x29b2('0x73'));})[_0x29b2('0x2e')](function(_0x134634){_0x2d2db4=_0x134634;logger[_0x29b2('0xd')](_0x29b2('0x74'));logger[_0x29b2('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2d2db4['id']);return setRelationship(_0x14d2ed,_0x113c5c,_0x2d2db4,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x14d2ed,_0x156e56,_0x2d2db4,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x14d2ed);})[_0x29b2('0x2e')](function(_0x238d0d){var _0x4fda40=parseInt(_0x238d0d[_0x29b2('0x66')][_0x29b2('0x75')](0x0));var _0x382d1a=util['format'](_0x29b2('0x67'),_0x230290[_0x29b2('0x56')],_0x2d2db4['id']);if(_0x4fda40>0x6){_0x382d1a=util[_0x29b2('0x2c')](_0x29b2('0x76'),_0x230290[_0x29b2('0x56')],_0x2d2db4['id']);}logger[_0x29b2('0xd')](_0x29b2('0x6e'),_0x29b2('0x68'));emit(util[_0x29b2('0x2c')](_0x29b2('0x69'),_0x2f0e54[_0x29b2('0xf')]),_0x29b2('0x6a'),{'uri':_0x382d1a});})[_0x29b2('0x77')](function(_0x435763){logger[_0x29b2('0x6b')](_0x29b2('0x6e'),JSON[_0x29b2('0x21')](_0x435763));});};exports['unmanaged']=function(_0x14e57d,_0x535bc9,_0x4ddaa,_0x1972fb,_0x221cc3,_0x27381e){var _0x151ba6,_0x5819dd,_0x67ab3c,_0x28c781;_0x27381e['remoteUri']=intUtil[_0x29b2('0x57')](_0x27381e[_0x29b2('0x56')]);_0x27381e[_0x29b2('0x58')]=intUtil[_0x29b2('0x57')](_0x27381e['serverUrl']);def[_0x29b2('0x59')]=util[_0x29b2('0x2c')](_0x29b2('0x6c'),_0x27381e[_0x29b2('0x56')]);if(_0x221cc3&&_0x221cc3[_0x29b2('0x78')]){logger['info']('['+_0x535bc9[_0x29b2('0x79')][_0x29b2('0x7a')]()+']',_0x29b2('0x5b'));_0x535bc9[_0x29b2('0x6f')]=util['format'](_0x29b2('0x5c'),_0x27381e[_0x29b2('0x58')],_0x535bc9[_0x29b2('0x5d')],md5(_0x535bc9['uniqueid']));}else{_0x535bc9[_0x29b2('0x6f')]='';}return getConnection(_0x27381e)[_0x29b2('0x2e')](function(_0x4450ec){_0x28c781=_0x4450ec;if(!_[_0x29b2('0x28')](_0x1972fb)){return getUser(_0x27381e,_0x1972fb['name'],_0x28c781);}else{return getUser(_0x27381e,null,_0x28c781);}})['then'](function(_0x139294){_0x151ba6=_0x139294;logger['info']('The\x20User\x20ID\x20is:',_0x151ba6['id']);return getEndUser(_0x27381e,_0x535bc9[_0x29b2('0x5e')],_0x535bc9['calleridnum'],_0x28c781);})[_0x29b2('0x2e')](function(_0x301abb){_0x5819dd=_0x301abb;logger[_0x29b2('0xd')](_0x29b2('0x60'),_0x5819dd['id']);return getTicket(_0x27381e,_0x151ba6,_0x5819dd,_0x4ddaa,_0x535bc9,_0x4ddaa[_0x29b2('0x61')],_0x28c781,_0x29b2('0x62'));})[_0x29b2('0x2e')](function(_0x556a8d){_0x67ab3c=_0x556a8d;logger[_0x29b2('0xd')](_0x29b2('0x74'));logger[_0x29b2('0xd')](_0x29b2('0x63'),_0x67ab3c['id']);return setRelationship(_0x28c781,_0x151ba6,_0x67ab3c,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x28c781,_0x5819dd,_0x67ab3c,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x28c781);})[_0x29b2('0x77')](function(_0x21c855){logger[_0x29b2('0x6b')]('['+_0x535bc9[_0x29b2('0x79')][_0x29b2('0x7a')]()+']',JSON[_0x29b2('0x21')](_0x21c855));});}; \ 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 f95f240..e21c668 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 _0xa8fa=['variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','util','getString','length','type','push','content'];(function(_0x2ae9c5,_0x1b11d1){var _0x5414da=function(_0xbf0140){while(--_0xbf0140){_0x2ae9c5['push'](_0x2ae9c5['shift']());}};_0x5414da(++_0x1b11d1);}(_0xa8fa,0xdb));var _0xaa8f=function(_0x284fc2,_0x4d1c8f){_0x284fc2=_0x284fc2-0x0;var _0x43dffa=_0xa8fa[_0x284fc2];return _0x43dffa;};'use strict';var _=require('lodash');var util=require(_0xaa8f('0x0'));exports[_0xaa8f('0x1')]=function(_0x47082f,_0x252d05,_0x205a54){var _0x242895=[];if(_0x47082f[_0xaa8f('0x2')]>0x0){var _0x5cbc69=_['sortBy'](_0x47082f,['id']);for(var _0x3519ae=0x0;_0x3519ae<_0x5cbc69[_0xaa8f('0x2')];_0x3519ae++){var _0x4e6dbf=_0x5cbc69[_0x3519ae];if(_0x4e6dbf[_0xaa8f('0x3')]==='string'){_0x242895[_0xaa8f('0x4')](_0x4e6dbf[_0xaa8f('0x5')]);}else if(_0x4e6dbf[_0xaa8f('0x3')]===_0xaa8f('0x6')&&_0x4e6dbf[_0xaa8f('0x7')]){_0x252d05[_0x4e6dbf[_0xaa8f('0x7')]]&&_0x242895['push'](_0x252d05[_0x4e6dbf[_0xaa8f('0x7')]][_0xaa8f('0x8')]());}else if(_0x4e6dbf[_0xaa8f('0x3')]==='customVariable'&&_0x4e6dbf[_0xaa8f('0x9')]&&_0x4e6dbf[_0xaa8f('0x9')]['name']){_0x252d05[_0x4e6dbf['Variable']['name']['toLowerCase']()]&&_0x242895[_0xaa8f('0x4')](_0x252d05[_0x4e6dbf['Variable'][_0xaa8f('0xa')][_0xaa8f('0xb')]()][_0xaa8f('0x8')]());}else if(_0x4e6dbf[_0xaa8f('0x3')]===_0xaa8f('0xc')){if(_0x4e6dbf[_0xaa8f('0xd')]===_0xaa8f('0xe')&&_0x4e6dbf['key']){_0x242895[_0xaa8f('0x4')](util['format']('%s:\x20%s',_0x4e6dbf[_0xaa8f('0xf')],_0x4e6dbf[_0xaa8f('0x10')]));}else if(_0x4e6dbf[_0xaa8f('0xd')]===_0xaa8f('0x6')&&_0x4e6dbf[_0xaa8f('0x7')]&&_0x4e6dbf['key']){_0x252d05[_0x4e6dbf['variableName']]&&_0x242895[_0xaa8f('0x4')](util[_0xaa8f('0x11')](_0xaa8f('0x12'),_0x4e6dbf[_0xaa8f('0xf')],_0x252d05[_0x4e6dbf['variableName']]));}else if(_0x4e6dbf[_0xaa8f('0xd')]==='customVariable'&&_0x4e6dbf[_0xaa8f('0x9')]&&_0x4e6dbf['Variable'][_0xaa8f('0xa')]&&_0x4e6dbf[_0xaa8f('0xf')]){_0x252d05[_0x4e6dbf[_0xaa8f('0x9')][_0xaa8f('0xa')][_0xaa8f('0xb')]()]&&_0x242895['push'](util[_0xaa8f('0x11')](_0xaa8f('0x12'),_0x4e6dbf[_0xaa8f('0xf')],_0x252d05[_0x4e6dbf[_0xaa8f('0x9')][_0xaa8f('0xa')][_0xaa8f('0xb')]()]));}}}}return _0x242895[_0xaa8f('0x13')](_0x205a54);};exports[_0xaa8f('0x14')]=function(_0x379b9e){var _0x40622e=_0x379b9e[_0xaa8f('0x15')](-0x1);if(_0x40622e==='/'){_0x379b9e=_0x379b9e[_0xaa8f('0x16')](0x0,_0x379b9e[_0xaa8f('0x17')](_0x40622e));}return _0x379b9e;};exports[_0xaa8f('0x18')]=function(_0x4b1feb){if(!_['isNil'](_0x4b1feb)&&_0x4b1feb!==''){var _0x3b77b2=/^(([^<>()\[\]\\.,;:\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 _0x3b77b2['test'](String(_0x4b1feb)[_0xaa8f('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x3041=['keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','keyValue'];(function(_0x351a91,_0x1b45f6){var _0x430dd3=function(_0x8b51f0){while(--_0x8b51f0){_0x351a91['push'](_0x351a91['shift']());}};_0x430dd3(++_0x1b45f6);}(_0x3041,0x1f2));var _0x1304=function(_0x5b4daa,_0xc385e4){_0x5b4daa=_0x5b4daa-0x0;var _0x9b569c=_0x3041[_0x5b4daa];return _0x9b569c;};'use strict';var _=require(_0x1304('0x0'));var util=require(_0x1304('0x1'));exports[_0x1304('0x2')]=function(_0x3343b,_0x47bd27,_0x59fc09){var _0x190cc7=[];if(_0x3343b[_0x1304('0x3')]>0x0){var _0x38670c=_['sortBy'](_0x3343b,['id']);for(var _0x153860=0x0;_0x153860<_0x38670c[_0x1304('0x3')];_0x153860++){var _0x26151c=_0x38670c[_0x153860];if(_0x26151c['type']===_0x1304('0x4')){_0x190cc7[_0x1304('0x5')](_0x26151c[_0x1304('0x6')]);}else if(_0x26151c[_0x1304('0x7')]===_0x1304('0x8')&&_0x26151c[_0x1304('0x9')]){_0x47bd27[_0x26151c[_0x1304('0x9')]]&&_0x190cc7[_0x1304('0x5')](_0x47bd27[_0x26151c[_0x1304('0x9')]][_0x1304('0xa')]());}else if(_0x26151c['type']===_0x1304('0xb')&&_0x26151c[_0x1304('0xc')]&&_0x26151c[_0x1304('0xc')][_0x1304('0xd')]){_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')]['toLowerCase']()]&&_0x190cc7[_0x1304('0x5')](_0x47bd27[_0x26151c[_0x1304('0xc')]['name']['toLowerCase']()][_0x1304('0xa')]());}else if(_0x26151c[_0x1304('0x7')]===_0x1304('0xe')){if(_0x26151c[_0x1304('0xf')]===_0x1304('0x4')&&_0x26151c[_0x1304('0x10')]){_0x190cc7[_0x1304('0x5')](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c[_0x1304('0x10')],_0x26151c[_0x1304('0x13')]));}else if(_0x26151c[_0x1304('0xf')]===_0x1304('0x8')&&_0x26151c[_0x1304('0x9')]&&_0x26151c[_0x1304('0x10')]){_0x47bd27[_0x26151c[_0x1304('0x9')]]&&_0x190cc7['push'](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c[_0x1304('0x10')],_0x47bd27[_0x26151c[_0x1304('0x9')]]));}else if(_0x26151c['keyType']===_0x1304('0xb')&&_0x26151c[_0x1304('0xc')]&&_0x26151c[_0x1304('0xc')][_0x1304('0xd')]&&_0x26151c['key']){_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')]['toLowerCase']()]&&_0x190cc7['push'](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c['key'],_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')][_0x1304('0x14')]()]));}}}}return _0x190cc7[_0x1304('0x15')](_0x59fc09);};exports['stripTrailingSlash']=function(_0x379bc6){var _0x73ea94=_0x379bc6[_0x1304('0x16')](-0x1);if(_0x73ea94==='/'){_0x379bc6=_0x379bc6[_0x1304('0x17')](0x0,_0x379bc6['lastIndexOf'](_0x73ea94));}return _0x379bc6;};exports[_0x1304('0x18')]=function(_0x491439){if(!_[_0x1304('0x19')](_0x491439)&&_0x491439!==''){var _0x47d122=/^(([^<>()\[\]\\.,;:\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 _0x47d122[_0x1304('0x1a')](String(_0x491439)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 4eb6bdf..0b8fd84 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(_0xada936,_0x5c47b3){var _0xaf8d53=function(_0x52e61c){while(--_0x52e61c){_0xada936['push'](_0xada936['shift']());}};_0xaf8d53(++_0x5c47b3);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xe706,0xa3));var _0x6e70=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0xe706[_0x255227];return _0x43a3e4;};'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 3bd805b..0307ab5 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 _0x16ee=['then','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','base64','debug','[HTTP]','GET','forEach','includes','picklist','type','nameField','customField','content','toString','string','custom_fields','idField','variable','variableName','customVariable','Variable','push','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','Descriptions','getString','Fields','info','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','%s/users/me.json'];(function(_0x2d4c25,_0x203639){var _0x396726=function(_0x2de5db){while(--_0x2de5db){_0x2d4c25['push'](_0x2d4c25['shift']());}};_0x396726(++_0x203639);}(_0x16ee,0x1a6));var _0xe16e=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x16ee[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xe16e('0x0'));var rp=require(_0xe16e('0x1'));var md5=require('md5');var util=require(_0xe16e('0x2'));var Redis=require(_0xe16e('0x3'));var intUtil=require(_0xe16e('0x4'));var config=require(_0xe16e('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0xe16e('0x6')]=_[_0xe16e('0x7')](config[_0xe16e('0x6')],{'host':_0xe16e('0x8'),'port':0x18eb});var io=require(_0xe16e('0x9'))(new Redis(config['redis']));function emit(_0x90a032,_0x295cfc,_0x511466){io['to'](_0x90a032)[_0xe16e('0xa')](_0x295cfc,_0x511466);}var headers={'Content-Type':_0xe16e('0xb'),'Accept':_0xe16e('0xb')};function getTicket(_0x252016,_0x1f6540,_0x24b602,_0x10a6e8,_0x40eb59){logger['info'](_0xe16e('0xc'));return request({'uri':util['format'](_0xe16e('0xd'),_0x252016[_0xe16e('0xe')]),'method':_0xe16e('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x24b602['id'],'submitter_id':_0x1f6540?_0x1f6540['id']:undefined,'assignee_id':_0x1f6540?_0x1f6540['id']:undefined,'tags':getTags(_0x10a6e8[_0xe16e('0x10')],_0xe16e('0x11')),'subject':intUtil['getString'](_0x10a6e8[_0xe16e('0x12')],_0x40eb59,'\x20'),'description':intUtil['getString'](_0x10a6e8[_0xe16e('0x13')],_0x40eb59,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe16e('0x14')](_0x10a6e8['Descriptions'],_0x40eb59,'\x0a')}},getCustomFields(_0x10a6e8[_0xe16e('0x15')],_0x40eb59))}})['then'](function(_0x3ac32c){logger[_0xe16e('0x16')](_0xe16e('0x17'));return _0x3ac32c[_0xe16e('0x18')];});}function getUser(_0x3b3e14,_0x575cec){if(intUtil[_0xe16e('0x19')](_0x575cec)){logger['info']('Getting\x20agent\x20with\x20email',_0x575cec);return request({'uri':util[_0xe16e('0x1a')](_0xe16e('0x1b'),_0x3b3e14[_0xe16e('0xe')]),'qs':{'query':util[_0xe16e('0x1a')](_0xe16e('0x1c'),_0x575cec)}})['then'](function(_0x579dca){if(_0x579dca[_0xe16e('0x1d')]){logger['info'](_0xe16e('0x1e'));return _[_0xe16e('0x1f')](_0x579dca[_0xe16e('0x20')],{'email':_0x575cec,'role':'agent'});}else{logger[_0xe16e('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe16e('0x1a')](_0xe16e('0x21'),_0x3b3e14[_0xe16e('0xe')])})[_0xe16e('0x22')](function(_0x4a3f63){logger[_0xe16e('0x16')](_0xe16e('0x23'));return _0x4a3f63['user'];});}});}else{logger['info'](_0xe16e('0x24'));return request({'uri':util[_0xe16e('0x1a')](_0xe16e('0x21'),_0x3b3e14[_0xe16e('0xe')])})['then'](function(_0x24b08b){logger[_0xe16e('0x16')](_0xe16e('0x23'));return _0x24b08b[_0xe16e('0x25')];});}}function getEndUser(_0x423aa4,_0x307f3e,_0xeb68f8){logger[_0xe16e('0x16')](_0xe16e('0x26'),_0xeb68f8);return request({'uri':util['format'](_0xe16e('0x1b'),_0x423aa4[_0xe16e('0xe')]),'qs':{'query':util[_0xe16e('0x1a')](_0xe16e('0x27'),_0xeb68f8)}})[_0xe16e('0x22')](function(_0x14103a){var _0x580d6d;if(_0x14103a[_0xe16e('0x20')][_0xe16e('0x28')]){_0x14103a[_0xe16e('0x20')]=_[_0xe16e('0x29')](_0x14103a['results'],{'suspended':![],'role':_0xe16e('0x2a')});if(_0x14103a[_0xe16e('0x20')]['length']){_0x580d6d=_[_0xe16e('0x2b')](_0x14103a[_0xe16e('0x20')]);}}if(_0x580d6d){logger[_0xe16e('0x16')](_0xe16e('0x2c'));return _0x580d6d;}else{logger['info'](_0xe16e('0x2d'));return request({'uri':util[_0xe16e('0x1a')](_0xe16e('0x2e'),_0x423aa4[_0xe16e('0xe')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0xe16e('0x2f'),_0x307f3e||_0xeb68f8),'phone':_0xeb68f8}}})['then'](function(_0x47ac9f){logger[_0xe16e('0x16')]('Enduser\x20created.');return _0x47ac9f['user'];});}});}function getAuth(_0x2a8e4d){var _0x1654d9;if(_0x2a8e4d[_0xe16e('0x30')]===_0xe16e('0x31')){_0x1654d9=util[_0xe16e('0x1a')](_0xe16e('0x32'),_0x2a8e4d[_0xe16e('0x33')],_0x2a8e4d[_0xe16e('0x31')]);}else if(_0x2a8e4d[_0xe16e('0x30')]==='token'){_0x1654d9=util[_0xe16e('0x1a')](_0xe16e('0x34'),_0x2a8e4d[_0xe16e('0x33')],_0x2a8e4d[_0xe16e('0x35')]);}return util[_0xe16e('0x1a')]('Basic\x20%s',new Buffer(_0x1654d9)['toString'](_0xe16e('0x36')));}function request(_0x3d9bbe){logger[_0xe16e('0x37')](_0xe16e('0x38'),JSON['stringify'](_0x3d9bbe));return rp(_[_0xe16e('0x7')](_0x3d9bbe,{'method':_0xe16e('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x6854df,_0x37f64d){var _0x5d4667=[];if(_0x6854df&&_0x6854df['length']>0x0){_0x5d4667=_['map'](_0x6854df,_0x37f64d);}return _0x5d4667;}function getCustomFields(_0x37d378,_0x32eda1){var _0x5c8ab7=[];var _0x2732f9={'custom_fields':[]};if(_0x37d378['length']>0x0){_[_0xe16e('0x3a')](_0x37d378,function(_0x28c7dd){if(_[_0xe16e('0x3b')](['string',_0xe16e('0x3c')],_0x28c7dd[_0xe16e('0x3d')])&&_0x28c7dd[_0xe16e('0x3e')]&&!_0x28c7dd[_0xe16e('0x3f')]){_0x2732f9[_0x28c7dd[_0xe16e('0x3e')]['toLowerCase']()]=_0x28c7dd[_0xe16e('0x40')][_0xe16e('0x41')]();}else if(_['includes']([_0xe16e('0x42'),_0xe16e('0x3c')],_0x28c7dd[_0xe16e('0x3d')])&&_0x28c7dd['idField']&&_0x28c7dd[_0xe16e('0x3f')]){_0x2732f9[_0xe16e('0x43')]['push']({'id':_0x28c7dd[_0xe16e('0x44')],'value':_0x28c7dd[_0xe16e('0x40')][_0xe16e('0x41')]()});}else if(_0x28c7dd[_0xe16e('0x3d')]===_0xe16e('0x45')&&_0x28c7dd['variableName']&&_0x28c7dd[_0xe16e('0x44')]&&_0x28c7dd[_0xe16e('0x3f')]){_0x32eda1[_0x28c7dd[_0xe16e('0x46')]]&&_0x2732f9[_0xe16e('0x43')]['push']({'id':_0x28c7dd['idField'],'value':_0x32eda1[_0x28c7dd['variableName']]['toString']()});}else if(_0x28c7dd[_0xe16e('0x3d')]===_0xe16e('0x47')&&_0x28c7dd['Variable']&&_0x28c7dd[_0xe16e('0x48')][_0xe16e('0x11')]&&_0x28c7dd[_0xe16e('0x44')]&&_0x28c7dd[_0xe16e('0x3f')]){_0x32eda1[_0x28c7dd[_0xe16e('0x48')]['name']['toLowerCase']()]&&_0x2732f9['custom_fields'][_0xe16e('0x49')]({'id':_0x28c7dd[_0xe16e('0x44')],'value':_0x32eda1[_0x28c7dd[_0xe16e('0x48')][_0xe16e('0x11')][_0xe16e('0x4a')]()][_0xe16e('0x41')]()});}});}return _0x2732f9;}exports[_0xe16e('0x4b')]=function(_0x497aaf,_0x5c74a4,_0x101d9d,_0x907660,_0x5bea92,_0x1b3489){var _0x3799ca,_0x398bf1;_0x1b3489[_0xe16e('0xe')]=intUtil[_0xe16e('0x4c')](_0x1b3489['remoteUri']);_0x1b3489['serverUrl']=intUtil['stripTrailingSlash'](_0x1b3489[_0xe16e('0x4d')]);if(_0x5bea92&&_0x5bea92[_0xe16e('0x4e')]){logger[_0xe16e('0x16')](_0xe16e('0x4f'),_0xe16e('0x50'));_0x5c74a4[_0xe16e('0x51')]=util[_0xe16e('0x1a')](_0xe16e('0x52'),_0x1b3489[_0xe16e('0x4d')],_0x5c74a4['uniqueid'],md5(_0x5c74a4[_0xe16e('0x53')]));}else{_0x5c74a4[_0xe16e('0x51')]='';}headers[_0xe16e('0x54')]=getAuth(_0x1b3489);return getUser(_0x1b3489,_0x907660[_0xe16e('0x55')])[_0xe16e('0x22')](function(_0x5bc470){_0x3799ca=_0x5bc470;logger[_0xe16e('0x16')](_0xe16e('0x56'),_0x3799ca['id']);return getEndUser(_0x1b3489,_0x5c74a4[_0xe16e('0x57')],_0x5c74a4[_0xe16e('0x58')]);})[_0xe16e('0x22')](function(_0x341a5f){_0x398bf1=_0x341a5f;logger[_0xe16e('0x16')](_0xe16e('0x59'),_0x398bf1['id']);return getTicket(_0x1b3489,_0x3799ca,_0x398bf1,_0x101d9d,_0x5c74a4);})[_0xe16e('0x22')](function(_0x62074c){if(_0x62074c){logger[_0xe16e('0x16')]('The\x20Ticket\x20ID\x20is:',_0x62074c['id']);switch(_0x1b3489[_0xe16e('0x3d')]){case'integrationTab':logger[_0xe16e('0x16')](_0xe16e('0x4f'),_0xe16e('0x5a'));return request({'uri':util[_0xe16e('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1b3489[_0xe16e('0xe')],_0x3799ca['id'],_0x62074c['id']),'method':_0xe16e('0xf')});case _0xe16e('0x5b'):logger[_0xe16e('0x16')](_0xe16e('0x4f'),_0xe16e('0x5c'));emit(util['format'](_0xe16e('0x5d'),_0x907660[_0xe16e('0x11')]),_0xe16e('0x5e'),{'uri':util['format'](_0xe16e('0x5f'),_0x1b3489[_0xe16e('0xe')]['replace'](_0xe16e('0x60'),''),_0x62074c['id'])});break;default:logger['error'](_0xe16e('0x4f'),_0xe16e('0x61'));}}})['catch'](function(_0x2fc2c9){logger[_0xe16e('0x62')](_0xe16e('0x63'),util[_0xe16e('0x64')](_0x2fc2c9,{'showHidden':!![],'depth':null}));});};exports[_0xe16e('0x65')]=function(_0x6101ac,_0x421661,_0x29b731,_0x2d97ce,_0x341c79,_0x1ee5df,_0x299a05){var _0x15aca2,_0x363dae;_0x1ee5df[_0xe16e('0xe')]=intUtil[_0xe16e('0x4c')](_0x1ee5df[_0xe16e('0xe')]);_0x1ee5df[_0xe16e('0x4d')]=intUtil[_0xe16e('0x4c')](_0x1ee5df[_0xe16e('0x4d')]);if(_0x299a05&&_0x299a05[_0xe16e('0x66')]&&_0x299a05[_0xe16e('0x66')]!==_0xe16e('0x67')){logger[_0xe16e('0x16')](_0xe16e('0x68'),'Recording\x20is\x20enabled!');_0x421661['recordingURL']=util[_0xe16e('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ee5df[_0xe16e('0x4d')],_0x421661[_0xe16e('0x53')],md5(_0x421661[_0xe16e('0x53')]));}headers['Authorization']=getAuth(_0x1ee5df);return getUser(_0x1ee5df,_0x2d97ce[_0xe16e('0x55')])['then'](function(_0x8aa1ed){_0x15aca2=_0x8aa1ed;logger['info'](_0xe16e('0x56'),_0x15aca2['id']);return getEndUser(_0x1ee5df,_0x421661['destcalleridname'],_0x421661['destcalleridnum']);})[_0xe16e('0x22')](function(_0x35b8a2){_0x363dae=_0x35b8a2;logger[_0xe16e('0x16')](_0xe16e('0x59'),_0x363dae['id']);return getTicket(_0x1ee5df,_0x15aca2,_0x363dae,_0x29b731,_0x421661);})[_0xe16e('0x22')](function(_0x59c1fb){if(_0x59c1fb){logger[_0xe16e('0x16')](_0xe16e('0x69'),_0x59c1fb['id']);switch(_0x1ee5df[_0xe16e('0x3d')]){case _0xe16e('0x6a'):logger[_0xe16e('0x16')](_0xe16e('0x68'),_0xe16e('0x5a'));return request({'uri':util[_0xe16e('0x1a')](_0xe16e('0x6b'),_0x1ee5df[_0xe16e('0xe')],_0x15aca2['id'],_0x59c1fb['id']),'method':_0xe16e('0xf')});case _0xe16e('0x5b'):logger[_0xe16e('0x16')](_0xe16e('0x68'),_0xe16e('0x5c'));emit(util[_0xe16e('0x1a')](_0xe16e('0x5d'),_0x2d97ce[_0xe16e('0x11')]),_0xe16e('0x5e'),{'uri':util['format'](_0xe16e('0x5f'),_0x1ee5df[_0xe16e('0xe')][_0xe16e('0x6c')]('/api/v2',''),_0x59c1fb['id'])});break;default:logger[_0xe16e('0x62')](_0xe16e('0x68'),_0xe16e('0x61'));}}})[_0xe16e('0x6d')](function(_0x3bd724){logger[_0xe16e('0x62')](_0xe16e('0x6e'),util[_0xe16e('0x64')](_0x3bd724,{'showHidden':!![],'depth':null}));});};exports[_0xe16e('0x6f')]=function(_0x22405d,_0x477cee,_0x1bb9af,_0x7215a0,_0x92e44f,_0x114efc){var _0x48c707,_0x170809;_0x114efc[_0xe16e('0xe')]=intUtil['stripTrailingSlash'](_0x114efc[_0xe16e('0xe')]);_0x114efc[_0xe16e('0x4d')]=intUtil[_0xe16e('0x4c')](_0x114efc[_0xe16e('0x4d')]);if(_0x92e44f&&_0x92e44f[_0xe16e('0x4e')]){logger['info']('['+_0x477cee[_0xe16e('0x70')][_0xe16e('0x71')]()+']',_0xe16e('0x50'));_0x477cee[_0xe16e('0x51')]=util[_0xe16e('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x114efc[_0xe16e('0x4d')],_0x477cee[_0xe16e('0x53')],md5(_0x477cee['uniqueid']));}else{_0x477cee[_0xe16e('0x51')]='';}headers[_0xe16e('0x54')]=getAuth(_0x114efc);return getUser(_0x114efc)['then'](function(_0x5a9669){_0x48c707=_0x5a9669;logger['info'](_0xe16e('0x56'),_0x48c707['id']);return getEndUser(_0x114efc,_0x477cee['calleridname'],_0x477cee[_0xe16e('0x58')]);})[_0xe16e('0x22')](function(_0x52c879){_0x170809=_0x52c879;logger[_0xe16e('0x16')]('The\x20Enduser\x20ID\x20is:',_0x170809['id']);return getTicket(_0x114efc,_0x48c707,_0x170809,_0x1bb9af,_0x477cee);})[_0xe16e('0x22')](function(_0x1cb94b){if(_0x1cb94b){logger[_0xe16e('0x16')]('The\x20Ticket\x20ID\x20is:',_0x1cb94b['id']);}})[_0xe16e('0x6d')](function(_0x2d0977){logger['error']('['+_0x477cee[_0xe16e('0x70')][_0xe16e('0x71')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xe16e('0x64')](_0x2d0977,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1cf7=['stringify','map','forEach','includes','string','nameField','content','picklist','idField','customField','push','type','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug'];(function(_0xad3764,_0x9b3ad1){var _0x38b603=function(_0x56fb4d){while(--_0x56fb4d){_0xad3764['push'](_0xad3764['shift']());}};_0x38b603(++_0x9b3ad1);}(_0x1cf7,0xa3));var _0x71cf=function(_0x38cf05,_0x4047ab){_0x38cf05=_0x38cf05-0x0;var _0x35205f=_0x1cf7[_0x38cf05];return _0x35205f;};'use strict';var _=require(_0x71cf('0x0'));var rp=require(_0x71cf('0x1'));var md5=require('md5');var util=require(_0x71cf('0x2'));var Redis=require(_0x71cf('0x3'));var intUtil=require(_0x71cf('0x4'));var config=require('../../../../config/environment');var logger=require(_0x71cf('0x5'))(_0x71cf('0x6'));config[_0x71cf('0x7')]=_[_0x71cf('0x8')](config[_0x71cf('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x71cf('0x9'))(new Redis(config[_0x71cf('0x7')]));function emit(_0x3e5ba0,_0x8ed75a,_0x5961c8){io['to'](_0x3e5ba0)[_0x71cf('0xa')](_0x8ed75a,_0x5961c8);}var headers={'Content-Type':_0x71cf('0xb'),'Accept':'application/json'};function getTicket(_0x2a26db,_0x260dae,_0xd22d09,_0xe84646,_0x1b84c6){logger[_0x71cf('0xc')](_0x71cf('0xd'));return request({'uri':util[_0x71cf('0xe')](_0x71cf('0xf'),_0x2a26db['remoteUri']),'method':_0x71cf('0x10'),'body':{'ticket':_['merge']({'requester_id':_0xd22d09['id'],'submitter_id':_0x260dae?_0x260dae['id']:undefined,'assignee_id':_0x260dae?_0x260dae['id']:undefined,'tags':getTags(_0xe84646[_0x71cf('0x11')],_0x71cf('0x12')),'subject':intUtil['getString'](_0xe84646[_0x71cf('0x13')],_0x1b84c6,'\x20'),'description':intUtil[_0x71cf('0x14')](_0xe84646[_0x71cf('0x15')],_0x1b84c6,'\x0a'),'comment':{'public':![],'body':intUtil[_0x71cf('0x14')](_0xe84646['Descriptions'],_0x1b84c6,'\x0a')}},getCustomFields(_0xe84646[_0x71cf('0x16')],_0x1b84c6))}})[_0x71cf('0x17')](function(_0x18e9bd){logger[_0x71cf('0xc')](_0x71cf('0x18'));return _0x18e9bd[_0x71cf('0x19')];});}function getUser(_0x21fddb,_0x5ada85){if(intUtil[_0x71cf('0x1a')](_0x5ada85)){logger[_0x71cf('0xc')]('Getting\x20agent\x20with\x20email',_0x5ada85);return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x1b'),_0x21fddb[_0x71cf('0x1c')]),'qs':{'query':util[_0x71cf('0xe')](_0x71cf('0x1d'),_0x5ada85)}})['then'](function(_0x494d0d){if(_0x494d0d[_0x71cf('0x1e')]){logger['info']('Agent\x20found!');return _[_0x71cf('0x1f')](_0x494d0d[_0x71cf('0x20')],{'email':_0x5ada85,'role':_0x71cf('0x21')});}else{logger['info'](_0x71cf('0x22'));return request({'uri':util[_0x71cf('0xe')]('%s/users/me.json',_0x21fddb[_0x71cf('0x1c')])})[_0x71cf('0x17')](function(_0x1d0570){logger[_0x71cf('0xc')]('Admin\x20account\x20selected.');return _0x1d0570[_0x71cf('0x23')];});}});}else{logger[_0x71cf('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x24'),_0x21fddb[_0x71cf('0x1c')])})[_0x71cf('0x17')](function(_0x3574e7){logger['info'](_0x71cf('0x25'));return _0x3574e7[_0x71cf('0x23')];});}}function getEndUser(_0x20caa8,_0x5b0758,_0x30ef7b){logger[_0x71cf('0xc')]('Searching\x20enduser\x20with\x20phone',_0x30ef7b);return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x1b'),_0x20caa8[_0x71cf('0x1c')]),'qs':{'query':util[_0x71cf('0xe')](_0x71cf('0x26'),_0x30ef7b)}})[_0x71cf('0x17')](function(_0x3a31dc){var _0x4a46e4;if(_0x3a31dc['results'][_0x71cf('0x27')]){_0x3a31dc['results']=_[_0x71cf('0x28')](_0x3a31dc[_0x71cf('0x20')],{'suspended':![],'role':_0x71cf('0x29')});if(_0x3a31dc[_0x71cf('0x20')][_0x71cf('0x27')]){_0x4a46e4=_[_0x71cf('0x2a')](_0x3a31dc[_0x71cf('0x20')]);}}if(_0x4a46e4){logger[_0x71cf('0xc')](_0x71cf('0x2b'));return _0x4a46e4;}else{logger['info'](_0x71cf('0x2c'));return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x2d'),_0x20caa8['remoteUri']),'method':_0x71cf('0x10'),'body':{'user':{'role':_0x71cf('0x29'),'name':util[_0x71cf('0xe')](_0x71cf('0x2e'),_0x5b0758||_0x30ef7b),'phone':_0x30ef7b}}})[_0x71cf('0x17')](function(_0x3fca00){logger[_0x71cf('0xc')](_0x71cf('0x2f'));return _0x3fca00[_0x71cf('0x23')];});}});}function getAuth(_0x26782a){var _0x52131a;if(_0x26782a[_0x71cf('0x30')]==='password'){_0x52131a=util[_0x71cf('0xe')](_0x71cf('0x31'),_0x26782a[_0x71cf('0x32')],_0x26782a[_0x71cf('0x33')]);}else if(_0x26782a['authType']==='token'){_0x52131a=util[_0x71cf('0xe')]('%s/token:%s',_0x26782a['username'],_0x26782a[_0x71cf('0x34')]);}return util[_0x71cf('0xe')](_0x71cf('0x35'),new Buffer(_0x52131a)[_0x71cf('0x36')](_0x71cf('0x37')));}function request(_0x2642bc){logger[_0x71cf('0x38')]('[HTTP]',JSON[_0x71cf('0x39')](_0x2642bc));return rp(_[_0x71cf('0x8')](_0x2642bc,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e1111,_0x15f198){var _0x825a64=[];if(_0x3e1111&&_0x3e1111['length']>0x0){_0x825a64=_[_0x71cf('0x3a')](_0x3e1111,_0x15f198);}return _0x825a64;}function getCustomFields(_0x5c53cf,_0x5d9502){var _0x108338=[];var _0x32bcaf={'custom_fields':[]};if(_0x5c53cf['length']>0x0){_[_0x71cf('0x3b')](_0x5c53cf,function(_0x92dc2d){if(_[_0x71cf('0x3c')]([_0x71cf('0x3d'),'picklist'],_0x92dc2d['type'])&&_0x92dc2d['nameField']&&!_0x92dc2d['customField']){_0x32bcaf[_0x92dc2d[_0x71cf('0x3e')]['toLowerCase']()]=_0x92dc2d[_0x71cf('0x3f')][_0x71cf('0x36')]();}else if(_[_0x71cf('0x3c')]([_0x71cf('0x3d'),_0x71cf('0x40')],_0x92dc2d['type'])&&_0x92dc2d[_0x71cf('0x41')]&&_0x92dc2d[_0x71cf('0x42')]){_0x32bcaf['custom_fields'][_0x71cf('0x43')]({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x92dc2d['content'][_0x71cf('0x36')]()});}else if(_0x92dc2d[_0x71cf('0x44')]==='variable'&&_0x92dc2d['variableName']&&_0x92dc2d[_0x71cf('0x41')]&&_0x92dc2d[_0x71cf('0x42')]){_0x5d9502[_0x92dc2d['variableName']]&&_0x32bcaf[_0x71cf('0x45')][_0x71cf('0x43')]({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x5d9502[_0x92dc2d[_0x71cf('0x46')]]['toString']()});}else if(_0x92dc2d['type']===_0x71cf('0x47')&&_0x92dc2d[_0x71cf('0x48')]&&_0x92dc2d[_0x71cf('0x48')][_0x71cf('0x12')]&&_0x92dc2d['idField']&&_0x92dc2d[_0x71cf('0x42')]){_0x5d9502[_0x92dc2d[_0x71cf('0x48')]['name']['toLowerCase']()]&&_0x32bcaf[_0x71cf('0x45')]['push']({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x5d9502[_0x92dc2d[_0x71cf('0x48')][_0x71cf('0x12')]['toLowerCase']()]['toString']()});}});}return _0x32bcaf;}exports[_0x71cf('0x49')]=function(_0x5b9a4c,_0x223308,_0x1eb187,_0x45665f,_0x6c7d6c,_0x2ee6de){var _0x586933,_0x33176c;_0x2ee6de[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x2ee6de[_0x71cf('0x1c')]);_0x2ee6de[_0x71cf('0x4b')]=intUtil['stripTrailingSlash'](_0x2ee6de[_0x71cf('0x4b')]);if(_0x6c7d6c&&_0x6c7d6c[_0x71cf('0x4c')]){logger[_0x71cf('0xc')](_0x71cf('0x4d'),'Recording\x20is\x20enabled!');_0x223308[_0x71cf('0x4e')]=util[_0x71cf('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ee6de[_0x71cf('0x4b')],_0x223308[_0x71cf('0x4f')],md5(_0x223308[_0x71cf('0x4f')]));}else{_0x223308[_0x71cf('0x4e')]='';}headers[_0x71cf('0x50')]=getAuth(_0x2ee6de);return getUser(_0x2ee6de,_0x45665f[_0x71cf('0x51')])[_0x71cf('0x17')](function(_0x27af77){_0x586933=_0x27af77;logger[_0x71cf('0xc')](_0x71cf('0x52'),_0x586933['id']);return getEndUser(_0x2ee6de,_0x223308['calleridname'],_0x223308[_0x71cf('0x53')]);})[_0x71cf('0x17')](function(_0x141fe){_0x33176c=_0x141fe;logger['info'](_0x71cf('0x54'),_0x33176c['id']);return getTicket(_0x2ee6de,_0x586933,_0x33176c,_0x1eb187,_0x223308);})['then'](function(_0x3b619){if(_0x3b619){logger[_0x71cf('0xc')](_0x71cf('0x55'),_0x3b619['id']);switch(_0x2ee6de[_0x71cf('0x44')]){case _0x71cf('0x56'):logger[_0x71cf('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ee6de[_0x71cf('0x1c')],_0x586933['id'],_0x3b619['id']),'method':_0x71cf('0x10')});case _0x71cf('0x57'):logger['info'](_0x71cf('0x4d'),_0x71cf('0x58'));emit(util[_0x71cf('0xe')](_0x71cf('0x59'),_0x45665f['name']),_0x71cf('0x5a'),{'uri':util[_0x71cf('0xe')]('%s/agent/tickets/%s',_0x2ee6de[_0x71cf('0x1c')][_0x71cf('0x5b')]('/api/v2',''),_0x3b619['id'])});break;default:logger[_0x71cf('0x5c')](_0x71cf('0x4d'),_0x71cf('0x5d'));}}})[_0x71cf('0x5e')](function(_0x45feac){logger['error'](_0x71cf('0x5f'),util[_0x71cf('0x60')](_0x45feac,{'showHidden':!![],'depth':null}));});};exports[_0x71cf('0x61')]=function(_0x46bce3,_0x36a462,_0x2447e8,_0x4f659e,_0x27ae89,_0x14de42,_0x5c8f62){var _0x11ab33,_0xce1513;_0x14de42[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x14de42[_0x71cf('0x1c')]);_0x14de42['serverUrl']=intUtil[_0x71cf('0x4a')](_0x14de42['serverUrl']);if(_0x5c8f62&&_0x5c8f62[_0x71cf('0x62')]&&_0x5c8f62[_0x71cf('0x62')]!==_0x71cf('0x63')){logger[_0x71cf('0xc')](_0x71cf('0x64'),'Recording\x20is\x20enabled!');_0x36a462[_0x71cf('0x4e')]=util[_0x71cf('0xe')](_0x71cf('0x65'),_0x14de42[_0x71cf('0x4b')],_0x36a462['uniqueid'],md5(_0x36a462[_0x71cf('0x4f')]));}headers[_0x71cf('0x50')]=getAuth(_0x14de42);return getUser(_0x14de42,_0x4f659e[_0x71cf('0x51')])[_0x71cf('0x17')](function(_0x22839a){_0x11ab33=_0x22839a;logger[_0x71cf('0xc')](_0x71cf('0x52'),_0x11ab33['id']);return getEndUser(_0x14de42,_0x36a462[_0x71cf('0x66')],_0x36a462['destcalleridnum']);})['then'](function(_0xcd6540){_0xce1513=_0xcd6540;logger[_0x71cf('0xc')](_0x71cf('0x54'),_0xce1513['id']);return getTicket(_0x14de42,_0x11ab33,_0xce1513,_0x2447e8,_0x36a462);})[_0x71cf('0x17')](function(_0x1f2579){if(_0x1f2579){logger[_0x71cf('0xc')](_0x71cf('0x55'),_0x1f2579['id']);switch(_0x14de42[_0x71cf('0x44')]){case'integrationTab':logger['info'](_0x71cf('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x71cf('0x67'),_0x14de42['remoteUri'],_0x11ab33['id'],_0x1f2579['id']),'method':_0x71cf('0x10')});case _0x71cf('0x57'):logger[_0x71cf('0xc')](_0x71cf('0x64'),_0x71cf('0x58'));emit(util[_0x71cf('0xe')](_0x71cf('0x59'),_0x4f659e[_0x71cf('0x12')]),_0x71cf('0x5a'),{'uri':util[_0x71cf('0xe')](_0x71cf('0x68'),_0x14de42[_0x71cf('0x1c')]['replace']('/api/v2',''),_0x1f2579['id'])});break;default:logger['error'](_0x71cf('0x64'),_0x71cf('0x5d'));}}})[_0x71cf('0x5e')](function(_0x12aeb7){logger[_0x71cf('0x5c')](_0x71cf('0x69'),util[_0x71cf('0x60')](_0x12aeb7,{'showHidden':!![],'depth':null}));});};exports[_0x71cf('0x6a')]=function(_0x54184b,_0xcb9fcf,_0x53633a,_0x559186,_0x3fec37,_0x557e5d){var _0x5ac534,_0x3a5292;_0x557e5d[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x557e5d[_0x71cf('0x1c')]);_0x557e5d[_0x71cf('0x4b')]=intUtil[_0x71cf('0x4a')](_0x557e5d[_0x71cf('0x4b')]);if(_0x3fec37&&_0x3fec37[_0x71cf('0x4c')]){logger[_0x71cf('0xc')]('['+_0xcb9fcf[_0x71cf('0x6b')][_0x71cf('0x6c')]()+']','Recording\x20is\x20enabled!');_0xcb9fcf[_0x71cf('0x4e')]=util['format'](_0x71cf('0x65'),_0x557e5d[_0x71cf('0x4b')],_0xcb9fcf['uniqueid'],md5(_0xcb9fcf['uniqueid']));}else{_0xcb9fcf[_0x71cf('0x4e')]='';}headers[_0x71cf('0x50')]=getAuth(_0x557e5d);return getUser(_0x557e5d)[_0x71cf('0x17')](function(_0x2455e3){_0x5ac534=_0x2455e3;logger[_0x71cf('0xc')]('The\x20User\x20ID\x20is:',_0x5ac534['id']);return getEndUser(_0x557e5d,_0xcb9fcf['calleridname'],_0xcb9fcf[_0x71cf('0x53')]);})[_0x71cf('0x17')](function(_0x41a1bb){_0x3a5292=_0x41a1bb;logger['info'](_0x71cf('0x54'),_0x3a5292['id']);return getTicket(_0x557e5d,_0x5ac534,_0x3a5292,_0x53633a,_0xcb9fcf);})[_0x71cf('0x17')](function(_0x1eac3e){if(_0x1eac3e){logger[_0x71cf('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1eac3e['id']);}})[_0x71cf('0x5e')](function(_0x11ac18){logger[_0x71cf('0x5c')]('['+_0xcb9fcf['lastevent'][_0x71cf('0x6c')]()+']'+_0x71cf('0x6d'),util['inspect'](_0x11ac18,{'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 471a613..4142820 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 _0xff2e=['refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','info','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','email','destcalleridname','unmanaged','toUpperCase','md5','moment','ioredis','zoho','redis','defaults','socket.io-emitter','emit','stringify','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret'];(function(_0x359529,_0x53c83b){var _0x5d8a03=function(_0x3a0e30){while(--_0x3a0e30){_0x359529['push'](_0x359529['shift']());}};_0x5d8a03(++_0x53c83b);}(_0xff2e,0x198));var _0xeff2=function(_0x3d1868,_0xdaac4f){_0x3d1868=_0x3d1868-0x0;var _0x121ee7=_0xff2e[_0x3d1868];return _0x121ee7;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeff2('0x0'));var util=require('util');var intUtil=require('./util');var moment=require(_0xeff2('0x1'));var Redis=require(_0xeff2('0x2'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xeff2('0x3'));config[_0xeff2('0x4')]=_[_0xeff2('0x5')](config[_0xeff2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xeff2('0x6'))(new Redis(config[_0xeff2('0x4')]));function emit(_0x1cc523,_0x21a078,_0x2f6411){io['to'](_0x1cc523)[_0xeff2('0x7')](_0x21a078,_0x2f6411);}function request(_0x521a72){logger['debug']('[HTTP]',JSON[_0xeff2('0x8')](_0x521a72));return rp(_0x521a72);}function getCustomFields(_0xd8348e,_0x5c2cf2){var _0x990b66={};if(_0xd8348e['length']>0x0){_[_0xeff2('0x9')](_0xd8348e,function(_0x5eab5e){if(_[_0xeff2('0xa')](['string',_0xeff2('0xb')],_0x5eab5e[_0xeff2('0xc')])&&_0x5eab5e[_0xeff2('0xd')]){_0x990b66[_0x5eab5e['idField']]=_0x5eab5e[_0xeff2('0xe')][_0xeff2('0xf')]();}else if(_0x5eab5e[_0xeff2('0xc')]===_0xeff2('0x10')&&_0x5eab5e[_0xeff2('0x11')]&&_0x5eab5e['idField']&&_0x5c2cf2[_0x5eab5e[_0xeff2('0x11')]]){_0x990b66[_0x5eab5e[_0xeff2('0xd')]]=_0x5c2cf2[_0x5eab5e[_0xeff2('0x11')]]['toString']();}else if(_0x5eab5e[_0xeff2('0xc')]===_0xeff2('0x12')&&_0x5eab5e['Variable']&&_0x5eab5e[_0xeff2('0x13')]['name']&&_0x5eab5e[_0xeff2('0xd')]&&_0x5c2cf2[_0x5eab5e[_0xeff2('0x13')][_0xeff2('0x14')][_0xeff2('0x15')]()]){_0x990b66[_0x5eab5e[_0xeff2('0xd')]]=_0x5c2cf2[_0x5eab5e[_0xeff2('0x13')][_0xeff2('0x14')][_0xeff2('0x15')]()]['toString']();}});}return _0x990b66;}function getName(_0x551564){if(_0x551564[_0xeff2('0x16')]('\x20')>0x0){var _0x1cea20=_0x551564['split'](/ (.+)/);if(_0x1cea20[0x1]){return _0x1cea20;}}return[_0x551564,_0x551564];}var accountsTokens={};function getAccessToken(_0x22f308){return new Promise(function(_0x3c5219,_0x23accd){if(!_[_0xeff2('0x17')](accountsTokens[_0x22f308['id']])&&!_['isNil'](accountsTokens[_0x22f308['id']][_0xeff2('0x18')])){if(moment()[_0xeff2('0x19')](accountsTokens[_0x22f308['id']][_0xeff2('0x1a')])){_0x3c5219(accountsTokens[_0x22f308['id']][_0xeff2('0x18')]);}}var _0x59aa78;switch(_0x22f308['zone']){case'US':_0x59aa78='https://accounts.zoho.com';break;case'AU':_0x59aa78=_0xeff2('0x1b');break;case'EU':_0x59aa78=_0xeff2('0x1c');break;case'IN':_0x59aa78='https://accounts.zoho.in';break;case'CN':_0x59aa78=_0xeff2('0x1d');break;default:_0x59aa78=_0xeff2('0x1c');break;}var _0x6b9909={'method':'POST','uri':_0x59aa78+_0xeff2('0x1e'),'qs':{'refresh_token':_0x22f308[_0xeff2('0x1f')],'client_id':_0x22f308['clientId'],'client_secret':_0x22f308[_0xeff2('0x20')],'grant_type':_0xeff2('0x21')},'json':!![]};return rp(_0x6b9909)['then'](function(_0x3e7e5b){accountsTokens[_0x22f308['id']]={'access_token':_0x3e7e5b[_0xeff2('0x18')],'expires_in':moment()[_0xeff2('0x22')](_0x3e7e5b[_0xeff2('0x1a')],_0xeff2('0x23'))};_0x3c5219(_0x3e7e5b[_0xeff2('0x18')]);})[_0xeff2('0x24')](function(_0x16995e){logger[_0xeff2('0x25')](_0xeff2('0x26'),_0x16995e[_0xeff2('0x27')]);_0x23accd(_0x16995e);});});}function getUser(_0x216e22,_0x2b84cb,_0x55d9fd,_0x559991){logger['info'](_0xeff2('0x28'));return request({'method':_0xeff2('0x29'),'uri':util[_0xeff2('0x2a')](_0xeff2('0x2b'),_0x2b84cb),'qs':{'type':_0xeff2('0x2c')},'headers':{'Authorization':_0xeff2('0x2d')+_0x216e22},'json':!![]})[_0xeff2('0x2e')](function(_0x4cd381){if(_0x4cd381[_0xeff2('0x2f')]){var _0x4e029a=-0x1;if(_['isArrayLikeObject'](_0x4cd381[_0xeff2('0x2f')])){if(!_[_0xeff2('0x17')](_0x559991)){_0x4e029a=_[_0xeff2('0x30')](_0x4cd381[_0xeff2('0x2f')],function(_0x51cd80){return _0x51cd80['email']===_0x559991;});}if(_0x4e029a>=0x0){logger[_0xeff2('0x31')](_0xeff2('0x32'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x4e029a=_[_0xeff2('0x30')](_0x4cd381['users'],function(_0x229fd0){return _0x229fd0[_0xeff2('0x33')][_0xeff2('0x14')]===_0xeff2('0x34');});}return _0x4cd381['users'][_0x4e029a];}else{if(_0x4cd381[_0xeff2('0x35')][_0xeff2('0x33')][_0xeff2('0x14')]==='Administrator'){logger[_0xeff2('0x31')](_0xeff2('0x36'));user=_0x4cd381['user'];return user;}else{logger[_0xeff2('0x25')](_0xeff2('0x37'),JSON[_0xeff2('0x8')](_0x4cd381));throw new Error(_0xeff2('0x38')+JSON[_0xeff2('0x8')](_0x4cd381));}}}else{logger['error'](_0xeff2('0x37'),JSON[_0xeff2('0x8')](_0x4cd381));throw new Error(_0xeff2('0x38')+JSON[_0xeff2('0x8')](_0x4cd381));}})[_0xeff2('0x24')](function(_0x24b729){console[_0xeff2('0x25')](_0x24b729);});}function getZohoUser(_0x44c8dc,_0xa9f9ff){return new BPromise(function(_0x14d8d5,_0x32243d){request(_0x44c8dc)[_0xeff2('0x2e')](function(_0x3a16e5){var _0x34163d=null;if(_0x3a16e5){_0x34163d=_0x3a16e5[_0xeff2('0x39')][0x0];_0x34163d[_0xeff2('0x3a')]=_0xa9f9ff;}_0x14d8d5(_0x34163d);})[_0xeff2('0x24')](function(_0x1c7f48){_0x32243d(_0x1c7f48);});});}function createEndUser(_0x29ca5f,_0x4e797d,_0x2cca21,_0x4c5124,_0x4a09a4,_0x54a6ca){var _0x2cca21=getName(_0x2cca21);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4e797d+_0xeff2('0x3b')+_[_0xeff2('0x3c')](_0x54a6ca[_0xeff2('0x3d')])+'s','body':{'data':[{'Last_Name':_0x2cca21[0x1],'First_Name':_0x2cca21[0x0],'Phone':_0x4c5124,'Owner':{'name':!_[_0xeff2('0x17')](_0x4a09a4[_0xeff2('0x3e')][_0xeff2('0x14')])?_0x4a09a4[_0xeff2('0x3e')]['name']:!_[_0xeff2('0x17')](_0x4a09a4[_0xeff2('0x3f')])?_0x4a09a4[_0xeff2('0x3f')]+'\x20'+_0x4a09a4[_0xeff2('0x40')]:_0x4a09a4[_0xeff2('0x40')],'id':_0x4a09a4['id']}}]},'headers':{'Authorization':_0xeff2('0x2d')+_0x29ca5f},'json':!![]})[_0xeff2('0x2e')](function(_0x218c9c){if(_0x218c9c&&_0x218c9c[_0xeff2('0x39')][0x0][_0xeff2('0x41')]===_0xeff2('0x42')){var _0x3ca3aa=_0x218c9c[_0xeff2('0x39')][0x0][_0xeff2('0x43')];_0x3ca3aa[_0xeff2('0x3a')]=_['startCase'](_0x54a6ca[_0xeff2('0x3d')])+'s';return _0x3ca3aa;}logger[_0xeff2('0x25')](_0xeff2('0x37'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xeff2('0x8')](data));})[_0xeff2('0x24')](function(_0x5c8ff2){console['log'](_0xeff2('0x44'),_0x5c8ff2);});}function getEndUser(_0x5babf5,_0x3f535c,_0xe7d912,_0x1ded67,_0x19d36a,_0x2635b0,_0x39c6ee){var _0x2eef08={'method':'GET','uri':'','headers':{'Authorization':_0xeff2('0x2d')+_0x5babf5},'json':!![]};switch(_0x39c6ee[_0xeff2('0x45')]){case _0xeff2('0x46'):_0x2eef08[_0xeff2('0x47')]=_0xeff2('0x48')+_0x3f535c+_0xeff2('0x49')+_0x19d36a+'))';return getZohoUser(_0x2eef08,_0xeff2('0x4a'))['then'](function(_0x2f806a){if(_0x2f806a)return _0x2f806a;_0x2eef08[_0xeff2('0x47')]=_0xeff2('0x48')+_0x3f535c+_0xeff2('0x4b')+_0x19d36a+'))';return getZohoUser(_0x2eef08,_0xeff2('0x4c'))[_0xeff2('0x2e')](function(_0x2490d8){if(_0x2490d8)return _0x2490d8;if(_0x39c6ee['moduleCreate']!=_0xeff2('0x4d')){return createEndUser(_0x5babf5,_0x3f535c,_0x1ded67,_0x19d36a,_0x2635b0,_0x39c6ee);}else{return{};}});});break;case'contact':_0x2eef08[_0xeff2('0x47')]=_0xeff2('0x48')+_0x3f535c+_0xeff2('0x49')+_0x19d36a+'))';return getZohoUser(_0x2eef08,_0xeff2('0x4a'))[_0xeff2('0x2e')](function(_0x319bb2){if(_0x319bb2)return _0x319bb2;if(_0x39c6ee[_0xeff2('0x3d')]!=_0xeff2('0x4d')){return createEndUser(_0x5babf5,_0x3f535c,_0x1ded67,_0x19d36a,_0x2635b0,_0x39c6ee);}else{return{};}});break;case _0xeff2('0x4e'):_0x2eef08[_0xeff2('0x47')]=_0xeff2('0x48')+_0x3f535c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x19d36a+'))';return getZohoUser(_0x2eef08,_0xeff2('0x4c'))[_0xeff2('0x2e')](function(_0x165758){if(_0x165758)return _0x165758;if(_0x39c6ee[_0xeff2('0x3d')]!='nothing'){return createEndUser(_0x5babf5,_0x3f535c,_0x1ded67,_0x19d36a,_0x2635b0,_0x39c6ee);}else{return{};}});break;}}function getCall(_0x5eea84,_0x3030e6,_0x2785f2,_0x5a9430,_0x38b3fa,_0x459ea5,_0x39aa6d,_0x499e96){logger[_0xeff2('0x31')]('Creating\x20new\x20call...');var _0x84fa79={};_0x84fa79['Owner']={'name':!_[_0xeff2('0x17')](_0x5a9430[_0xeff2('0x3e')]['name'])&&!_[_0xeff2('0x17')](_0x5a9430[_0xeff2('0x33')]['name'])&&_0x5a9430[_0xeff2('0x33')][_0xeff2('0x14')]===_0xeff2('0x4f')?_0x5a9430[_0xeff2('0x3e')][_0xeff2('0x14')]:!_[_0xeff2('0x17')](_0x5a9430[_0xeff2('0x3f')])?_0x5a9430[_0xeff2('0x3f')]+'\x20'+_0x5a9430['last_name']:_0x5a9430[_0xeff2('0x40')],'id':_0x5a9430['id']};_0x84fa79['Subject']=intUtil[_0xeff2('0x50')](_0x459ea5[_0xeff2('0x51')],_0x39aa6d,'\x20');_0x84fa79[_0xeff2('0x52')]=intUtil[_0xeff2('0x50')](_0x459ea5[_0xeff2('0x53')],_0x39aa6d,'\x0a');if(_0x38b3fa[_0xeff2('0x3a')]===_0xeff2('0x4a')){_0x84fa79[_0xeff2('0x54')]={'name':!_['isNil'](_0x38b3fa[_0xeff2('0x55')])?_0x38b3fa[_0xeff2('0x55')]:!_[_0xeff2('0x17')](_0x38b3fa['First_Name'])?_0x38b3fa[_0xeff2('0x56')]+'\x20'+_0x38b3fa[_0xeff2('0x57')]:_0x38b3fa[_0xeff2('0x57')],'id':_0x38b3fa['id']};}if(_0x38b3fa[_0xeff2('0x3a')]===_0xeff2('0x4c')){_0x84fa79[_0xeff2('0x58')]={'name':!_[_0xeff2('0x17')](_0x38b3fa['Full_Name'])?_0x38b3fa[_0xeff2('0x55')]:!_[_0xeff2('0x17')](_0x38b3fa[_0xeff2('0x56')])?_0x38b3fa[_0xeff2('0x56')]+'\x20'+_0x38b3fa[_0xeff2('0x57')]:_0x38b3fa[_0xeff2('0x57')],'id':_0x38b3fa['id']};_0x84fa79['$se_module']=_[_0xeff2('0x3c')](_0x38b3fa[_0xeff2('0x3a')]);}if(_0x39aa6d['talktime']){_0x84fa79[_0xeff2('0x59')]=moment[_0xeff2('0x5a')](parseInt(_0x39aa6d['talktime'])*0x3e8)[_0xeff2('0x2a')]('mm:ss');}else if(_0x39aa6d['answertime']&&_0x39aa6d[_0xeff2('0x5b')]){_0x84fa79[_0xeff2('0x59')]=moment[_0xeff2('0x5a')](moment(_0x39aa6d[_0xeff2('0x5b')],_0xeff2('0x5c'))[_0xeff2('0x5d')](moment(_0x39aa6d['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xeff2('0x2a')](_0xeff2('0x5e'));}switch(_0x39aa6d[_0xeff2('0x5f')]){case _0xeff2('0x60'):_0x84fa79[_0xeff2('0x61')]=_0xeff2('0x62');break;case'complete':case _0xeff2('0x63'):_0x84fa79[_0xeff2('0x61')]=_0xeff2('0x64');break;case _0xeff2('0x65'):_0x84fa79[_0xeff2('0x61')]=_0xeff2('0x66');break;case _0xeff2('0x67'):_0x84fa79[_0xeff2('0x61')]=_0xeff2('0x68');break;case _0xeff2('0x69'):_0x84fa79['Call_Result']=_0xeff2('0x6a');default:}_0x84fa79[_0xeff2('0x6b')]=(_0x499e96===_0xeff2('0x6c')?moment(_0x39aa6d[_0xeff2('0x6d')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x39aa6d['agentcalledAt'])[_0xeff2('0x2a')](_0xeff2('0x5c')))||moment()[_0xeff2('0x2a')](_0xeff2('0x5c'));_0x84fa79[_0xeff2('0x6e')]=_0x499e96||_0xeff2('0x6f');_0x84fa79=_[_0xeff2('0x70')](_0x84fa79,getCustomFields(_0x459ea5[_0xeff2('0x71')],_0x39aa6d));return request({'method':_0xeff2('0x72'),'uri':_0xeff2('0x48')+_0x3030e6+_0xeff2('0x73'),'headers':{'Authorization':_0xeff2('0x2d')+_0x5eea84},'body':{'data':[_0x84fa79]},'json':!![]})[_0xeff2('0x2e')](function(_0xa67c57){if(_0xa67c57&&_0xa67c57[_0xeff2('0x39')][0x0][_0xeff2('0x41')]==='SUCCESS'){logger[_0xeff2('0x31')](_0xeff2('0x74'));return{'id':_0xa67c57[_0xeff2('0x39')][0x0][_0xeff2('0x43')]['id']};}})[_0xeff2('0x24')](function(_0x40f4ef){logger[_0xeff2('0x31')](_0xeff2('0x75'),_0x40f4ef['stack']);console[_0xeff2('0x76')](_0xeff2('0x75'),_0x40f4ef);});}exports[_0xeff2('0x77')]=function(_0x223350,_0x30a2ee,_0xfea1eb,_0x4ab06f,_0x57ea77,_0x40a28e){var _0x47d0f5,_0x2d1b62,_0x574675;_0x40a28e[_0xeff2('0x78')]=intUtil[_0xeff2('0x79')](_0x40a28e[_0xeff2('0x78')]);_0x40a28e[_0xeff2('0x7a')]=intUtil[_0xeff2('0x79')](_0x40a28e[_0xeff2('0x7a')]);if(_0x57ea77&&_0x57ea77[_0xeff2('0x7b')]){logger[_0xeff2('0x31')](_0xeff2('0x7c'),_0xeff2('0x7d'));_0x30a2ee[_0xeff2('0x7e')]=_0x40a28e[_0xeff2('0x7a')]+_0xeff2('0x7f')+_0x30a2ee[_0xeff2('0x80')]+_0xeff2('0x81')+md5(_0x30a2ee[_0xeff2('0x80')]);}else{_0x30a2ee['recordingURL']='';}var _0x5ebec8=_0x40a28e[_0xeff2('0x78')]===_0xeff2('0x82')?'eu':_0xeff2('0x83');return getAccessToken(_0x40a28e)[_0xeff2('0x2e')](function(_0x22a653){_0x574675=_0x22a653;return getUser(_0x574675,_0x5ebec8,_0x40a28e,_0x4ab06f['email']);})[_0xeff2('0x2e')](function(_0x1ca168){_0x47d0f5=_0x1ca168;logger[_0xeff2('0x31')](_0xeff2('0x84'),_0x47d0f5['id']);return getEndUser(_0x574675,_0x5ebec8,_0x40a28e,_0x30a2ee[_0xeff2('0x85')],_0x30a2ee[_0xeff2('0x86')],_0x47d0f5,_0xfea1eb);})[_0xeff2('0x2e')](function(_0x36841c){_0x2d1b62=_0x36841c;return getCall(_0x574675,_0x5ebec8,_0x40a28e,_0x47d0f5,_0x2d1b62,_0xfea1eb,_0x30a2ee,'Inbound');})[_0xeff2('0x2e')](function(_0x178010){if(_0x178010){logger['info'](_0xeff2('0x87'),_0x178010['id']);logger[_0xeff2('0x31')](_0xeff2('0x7c'),_0xeff2('0x88'));emit(util[_0xeff2('0x2a')](_0xeff2('0x89'),_0x4ab06f[_0xeff2('0x14')]),_0xeff2('0x8a'),{'uri':_0xeff2('0x8b')+_0x40a28e[_0xeff2('0x78')]+_0xeff2('0x8c')+_0x178010['id']});}})['catch'](function(_0x2d1daf){logger[_0xeff2('0x25')](_0xeff2('0x7c'),JSON['stringify'](_0x2d1daf));});};exports['outbound']=function(_0x1da542,_0x5cc85e,_0x2c2718,_0x2002cd,_0x3c4213,_0x15fe2e,_0x2c4c21){var _0x3fb9e9,_0x4435a4,_0x2d8370;_0x15fe2e[_0xeff2('0x78')]=intUtil[_0xeff2('0x79')](_0x15fe2e[_0xeff2('0x78')]);_0x15fe2e[_0xeff2('0x7a')]=intUtil[_0xeff2('0x79')](_0x15fe2e[_0xeff2('0x7a')]);if(_0x2c4c21&&_0x2c4c21['recordingFormat']&&_0x2c4c21['recordingFormat']!==_0xeff2('0x8d')){logger[_0xeff2('0x31')](_0xeff2('0x8e'),_0xeff2('0x7d'));_0x5cc85e[_0xeff2('0x7e')]=_0x15fe2e['serverUrl']+_0xeff2('0x7f')+_0x5cc85e[_0xeff2('0x80')]+_0xeff2('0x81')+md5(_0x5cc85e[_0xeff2('0x80')]);}var _0xb3ceea=_0x15fe2e[_0xeff2('0x78')]===_0xeff2('0x82')?'eu':_0xeff2('0x83');return getAccessToken(_0x15fe2e)[_0xeff2('0x2e')](function(_0x346876){_0x2d8370=_0x346876;return getUser(_0x2d8370,_0xb3ceea,_0x15fe2e,_0x2002cd[_0xeff2('0x8f')]);})[_0xeff2('0x2e')](function(_0x1224c6){_0x3fb9e9=_0x1224c6;logger[_0xeff2('0x31')](_0xeff2('0x84'),_0x3fb9e9['id']);return getEndUser(_0x2d8370,_0xb3ceea,_0x15fe2e,_0x5cc85e[_0xeff2('0x90')],_0x5cc85e['destcalleridnum'],_0x3fb9e9,_0x2c2718);})[_0xeff2('0x2e')](function(_0x520716){_0x4435a4=_0x520716;return getCall(_0x2d8370,_0xb3ceea,_0x15fe2e,_0x3fb9e9,_0x4435a4,_0x2c2718,_0x5cc85e,'Outbound');})[_0xeff2('0x2e')](function(_0x540fb9){if(_0x540fb9){logger[_0xeff2('0x31')](_0xeff2('0x87'),_0x540fb9['id']);logger['info']('[OUTBOUND]',_0xeff2('0x88'));emit(util[_0xeff2('0x2a')](_0xeff2('0x89'),_0x2002cd[_0xeff2('0x14')]),_0xeff2('0x8a'),{'uri':'https://crm.'+_0x15fe2e['host']+_0xeff2('0x8c')+_0x540fb9['id']});}})[_0xeff2('0x24')](function(_0x52dde7){logger[_0xeff2('0x25')]('[OUTBOUND]',JSON[_0xeff2('0x8')](_0x52dde7));});};exports[_0xeff2('0x91')]=function(_0x53291e,_0x7f899c,_0x470b6b,_0x3448d8,_0x5d6c3e,_0x2e3b91){var _0x2c13e6,_0x291fd9,_0x31b60b;_0x2e3b91[_0xeff2('0x78')]=intUtil[_0xeff2('0x79')](_0x2e3b91[_0xeff2('0x78')]);_0x2e3b91[_0xeff2('0x7a')]=intUtil['stripTrailingSlash'](_0x2e3b91['serverUrl']);if(_0x5d6c3e&&_0x5d6c3e[_0xeff2('0x7b')]){logger[_0xeff2('0x31')]('['+_0x7f899c[_0xeff2('0x5f')][_0xeff2('0x92')]()+']',_0xeff2('0x7d'));_0x7f899c['recordingURL']=_0x2e3b91[_0xeff2('0x7a')]+_0xeff2('0x7f')+_0x7f899c['uniqueid']+_0xeff2('0x81')+md5(_0x7f899c[_0xeff2('0x80')]);}else{_0x7f899c[_0xeff2('0x7e')]='';}var _0x278ccb=_0x2e3b91['host']===_0xeff2('0x82')?'eu':_0xeff2('0x83');return getAccessToken(_0x2e3b91)['then'](function(_0x1fb550){_0x31b60b=_0x1fb550;return getUser(_0x31b60b,_0x278ccb,_0x2e3b91);})[_0xeff2('0x2e')](function(_0x4f66d8){_0x2c13e6=_0x4f66d8;logger['info'](_0xeff2('0x84'),_0x2c13e6['id']);return getEndUser(_0x31b60b,_0x278ccb,_0x2e3b91,_0x7f899c[_0xeff2('0x85')],_0x7f899c[_0xeff2('0x86')],_0x2c13e6,_0x470b6b);})[_0xeff2('0x2e')](function(_0x5802d0){_0x291fd9=_0x5802d0;return getCall(_0x31b60b,_0x278ccb,_0x2e3b91,_0x2c13e6,_0x291fd9,_0x470b6b,_0x7f899c,_0xeff2('0x6f'));})[_0xeff2('0x2e')](function(_0x37e736){if(_0x37e736){logger['info'](_0xeff2('0x87'),_0x37e736['id']);}})['catch'](function(_0x17a5cf){logger[_0xeff2('0x25')]('['+_0x7f899c[_0xeff2('0x5f')][_0xeff2('0x92')]()+']',JSON[_0xeff2('0x8')](_0x17a5cf));});}; \ No newline at end of file +var _0xda45=['add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','https://www.zohoapis.%s/crm/v2/users','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','moduleCreate','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','uri','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','format','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Zoho-oauthtoken\x20','SUCCESS','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','com','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xda45,0x111));var _0x5da4=function(_0x43d342,_0x534f07){_0x43d342=_0x43d342-0x0;var _0x184e94=_0xda45[_0x43d342];return _0x184e94;};'use strict';var _=require(_0x5da4('0x0'));var rp=require(_0x5da4('0x1'));var md5=require(_0x5da4('0x2'));var util=require(_0x5da4('0x3'));var intUtil=require(_0x5da4('0x4'));var moment=require(_0x5da4('0x5'));var Redis=require(_0x5da4('0x6'));var BPromise=require(_0x5da4('0x7'));var config=require(_0x5da4('0x8'));var logger=require(_0x5da4('0x9'))('zoho');config[_0x5da4('0xa')]=_[_0x5da4('0xb')](config[_0x5da4('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5da4('0xa')]));function emit(_0x1f3fa3,_0x524c5f,_0x1dafeb){io['to'](_0x1f3fa3)[_0x5da4('0xc')](_0x524c5f,_0x1dafeb);}function request(_0x19abdf){logger[_0x5da4('0xd')](_0x5da4('0xe'),JSON[_0x5da4('0xf')](_0x19abdf));return rp(_0x19abdf);}function getCustomFields(_0x5de6fd,_0x3b04e4){var _0x5e5ee0={};if(_0x5de6fd['length']>0x0){_['forEach'](_0x5de6fd,function(_0x14e9d1){if(_[_0x5da4('0x10')]([_0x5da4('0x11'),_0x5da4('0x12')],_0x14e9d1[_0x5da4('0x13')])&&_0x14e9d1[_0x5da4('0x14')]){_0x5e5ee0[_0x14e9d1[_0x5da4('0x14')]]=_0x14e9d1[_0x5da4('0x15')][_0x5da4('0x16')]();}else if(_0x14e9d1[_0x5da4('0x13')]===_0x5da4('0x17')&&_0x14e9d1['variableName']&&_0x14e9d1['idField']&&_0x3b04e4[_0x14e9d1['variableName']]){_0x5e5ee0[_0x14e9d1['idField']]=_0x3b04e4[_0x14e9d1[_0x5da4('0x18')]][_0x5da4('0x16')]();}else if(_0x14e9d1['type']==='customVariable'&&_0x14e9d1[_0x5da4('0x19')]&&_0x14e9d1[_0x5da4('0x19')]['name']&&_0x14e9d1[_0x5da4('0x14')]&&_0x3b04e4[_0x14e9d1['Variable'][_0x5da4('0x1a')][_0x5da4('0x1b')]()]){_0x5e5ee0[_0x14e9d1[_0x5da4('0x14')]]=_0x3b04e4[_0x14e9d1[_0x5da4('0x19')][_0x5da4('0x1a')][_0x5da4('0x1b')]()][_0x5da4('0x16')]();}});}return _0x5e5ee0;}function getName(_0x52b3a6){if(_0x52b3a6['indexOf']('\x20')>0x0){var _0x5c0f96=_0x52b3a6[_0x5da4('0x1c')](/ (.+)/);if(_0x5c0f96[0x1]){return _0x5c0f96;}}return[_0x52b3a6,_0x52b3a6];}var accountsTokens={};function getAccessToken(_0x46e309){return new Promise(function(_0x586a55,_0x5632d6){if(!_[_0x5da4('0x1d')](accountsTokens[_0x46e309['id']])&&!_[_0x5da4('0x1d')](accountsTokens[_0x46e309['id']][_0x5da4('0x1e')])){if(moment()[_0x5da4('0x1f')](accountsTokens[_0x46e309['id']][_0x5da4('0x20')])){_0x586a55(accountsTokens[_0x46e309['id']][_0x5da4('0x1e')]);}}var _0x241474;switch(_0x46e309['zone']){case'US':_0x241474=_0x5da4('0x21');break;case'AU':_0x241474='https://accounts.zoho.com.au';break;case'EU':_0x241474=_0x5da4('0x22');break;case'IN':_0x241474='https://accounts.zoho.in';break;case'CN':_0x241474=_0x5da4('0x23');break;default:_0x241474='https://accounts.zoho.eu';break;}var _0x10b362={'method':_0x5da4('0x24'),'uri':_0x241474+_0x5da4('0x25'),'qs':{'refresh_token':_0x46e309[_0x5da4('0x26')],'client_id':_0x46e309[_0x5da4('0x27')],'client_secret':_0x46e309[_0x5da4('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x10b362)['then'](function(_0x96c7a2){accountsTokens[_0x46e309['id']]={'access_token':_0x96c7a2[_0x5da4('0x1e')],'expires_in':moment()[_0x5da4('0x29')](_0x96c7a2[_0x5da4('0x20')],_0x5da4('0x2a'))};_0x586a55(_0x96c7a2[_0x5da4('0x1e')]);})[_0x5da4('0x2b')](function(_0x327b4f){logger[_0x5da4('0x2c')](_0x5da4('0x2d'),_0x327b4f['stack']);_0x5632d6(_0x327b4f);});});}function getUser(_0x464885,_0x49f1f2,_0xf58f9a,_0x5ae52d){logger[_0x5da4('0x2e')]('Search\x20user');return request({'method':_0x5da4('0x2f'),'uri':util['format'](_0x5da4('0x30'),_0x49f1f2),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x464885},'json':!![]})[_0x5da4('0x31')](function(_0x404c48){if(_0x404c48[_0x5da4('0x32')]){var _0x38c4ec=-0x1;if(_[_0x5da4('0x33')](_0x404c48['users'])){if(!_['isNil'](_0x5ae52d)){_0x38c4ec=_[_0x5da4('0x34')](_0x404c48['users'],function(_0xd10c0b){return _0xd10c0b[_0x5da4('0x35')]===_0x5ae52d;});}if(_0x38c4ec>=0x0){logger[_0x5da4('0x2e')](_0x5da4('0x36'));}else{logger['info'](_0x5da4('0x37'));_0x38c4ec=_[_0x5da4('0x34')](_0x404c48[_0x5da4('0x32')],function(_0x343dca){return _0x343dca[_0x5da4('0x38')][_0x5da4('0x1a')]===_0x5da4('0x39');});}return _0x404c48['users'][_0x38c4ec];}else{if(_0x404c48[_0x5da4('0x3a')]['profile'][_0x5da4('0x1a')]===_0x5da4('0x39')){logger[_0x5da4('0x2e')](_0x5da4('0x37'));user=_0x404c48['user'];return user;}else{logger[_0x5da4('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5da4('0xf')](_0x404c48));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x404c48));}}}else{logger[_0x5da4('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5da4('0xf')](_0x404c48));throw new Error(_0x5da4('0x3b')+JSON[_0x5da4('0xf')](_0x404c48));}})[_0x5da4('0x2b')](function(_0x17da48){console[_0x5da4('0x2c')](_0x17da48);});}function getZohoUser(_0x5eb6a6,_0x13356d){return new BPromise(function(_0x4b8251,_0x40e2ce){request(_0x5eb6a6)[_0x5da4('0x31')](function(_0x1d8430){var _0x188a6f=null;if(_0x1d8430){_0x188a6f=_0x1d8430[_0x5da4('0x3c')][0x0];_0x188a6f[_0x5da4('0x3d')]=_0x13356d;}_0x4b8251(_0x188a6f);})[_0x5da4('0x2b')](function(_0x8ff8f2){_0x40e2ce(_0x8ff8f2);});});}function createEndUser(_0xaed536,_0x1bf6cb,_0x3acf90,_0x59080b,_0x4b89d9,_0x1fbe7e){var _0x3acf90=getName(_0x3acf90);return request({'method':'POST','uri':_0x5da4('0x3e')+_0x1bf6cb+_0x5da4('0x3f')+_[_0x5da4('0x40')](_0x1fbe7e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3acf90[0x1],'First_Name':_0x3acf90[0x0],'Phone':_0x59080b,'Owner':{'name':!_[_0x5da4('0x1d')](_0x4b89d9[_0x5da4('0x41')][_0x5da4('0x1a')])?_0x4b89d9[_0x5da4('0x41')]['name']:!_[_0x5da4('0x1d')](_0x4b89d9[_0x5da4('0x42')])?_0x4b89d9[_0x5da4('0x42')]+'\x20'+_0x4b89d9[_0x5da4('0x43')]:_0x4b89d9[_0x5da4('0x43')],'id':_0x4b89d9['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xaed536},'json':!![]})[_0x5da4('0x31')](function(_0x52946a){if(_0x52946a&&_0x52946a[_0x5da4('0x3c')][0x0][_0x5da4('0x44')]==='SUCCESS'){var _0x3ab724=_0x52946a['data'][0x0][_0x5da4('0x45')];_0x3ab724[_0x5da4('0x3d')]=_[_0x5da4('0x40')](_0x1fbe7e[_0x5da4('0x46')])+'s';return _0x3ab724;}logger['error'](_0x5da4('0x47'),JSON['stringify'](data));throw new Error(_0x5da4('0x48')+JSON['stringify'](data));})[_0x5da4('0x2b')](function(_0x4cc1c5){console[_0x5da4('0x49')](_0x5da4('0x4a'),_0x4cc1c5);});}function getEndUser(_0x33b3da,_0x5adbeb,_0x18a440,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2){var _0x49b7fa={'method':_0x5da4('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33b3da},'json':!![]};switch(_0x3cf3b2['moduleSearch']){case _0x5da4('0x4b'):_0x49b7fa['uri']=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4c')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x4d'))[_0x5da4('0x31')](function(_0xd93780){if(_0xd93780)return _0xd93780;_0x49b7fa['uri']=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4e')+_0x54208b+'))';return getZohoUser(_0x49b7fa,'Leads')[_0x5da4('0x31')](function(_0x258067){if(_0x258067)return _0x258067;if(_0x3cf3b2[_0x5da4('0x46')]!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});});break;case _0x5da4('0x50'):_0x49b7fa[_0x5da4('0x51')]='https://www.zohoapis.'+_0x5adbeb+_0x5da4('0x4c')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x4d'))['then'](function(_0x11ae03){if(_0x11ae03)return _0x11ae03;if(_0x3cf3b2['moduleCreate']!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});break;case _0x5da4('0x52'):_0x49b7fa[_0x5da4('0x51')]=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4e')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x53'))['then'](function(_0x108025){if(_0x108025)return _0x108025;if(_0x3cf3b2[_0x5da4('0x46')]!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});break;}}function getCall(_0x325670,_0x1a3bfa,_0x3528e0,_0x355221,_0x3a00a9,_0x26bf4b,_0x57d813,_0x4e4e3b){logger[_0x5da4('0x2e')](_0x5da4('0x54'));var _0x5692ee={};_0x5692ee[_0x5da4('0x55')]={'name':!_[_0x5da4('0x1d')](_0x355221[_0x5da4('0x41')][_0x5da4('0x1a')])&&!_['isNil'](_0x355221[_0x5da4('0x38')][_0x5da4('0x1a')])&&_0x355221['profile']['name']===_0x5da4('0x56')?_0x355221[_0x5da4('0x41')][_0x5da4('0x1a')]:!_[_0x5da4('0x1d')](_0x355221[_0x5da4('0x42')])?_0x355221['first_name']+'\x20'+_0x355221[_0x5da4('0x43')]:_0x355221[_0x5da4('0x43')],'id':_0x355221['id']};_0x5692ee['Subject']=intUtil[_0x5da4('0x57')](_0x26bf4b[_0x5da4('0x58')],_0x57d813,'\x20');_0x5692ee[_0x5da4('0x59')]=intUtil[_0x5da4('0x57')](_0x26bf4b['Descriptions'],_0x57d813,'\x0a');if(_0x3a00a9[_0x5da4('0x3d')]===_0x5da4('0x4d')){_0x5692ee[_0x5da4('0x5a')]={'name':!_[_0x5da4('0x1d')](_0x3a00a9['Full_Name'])?_0x3a00a9[_0x5da4('0x5b')]:!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5c')])?_0x3a00a9[_0x5da4('0x5c')]+'\x20'+_0x3a00a9['Last_Name']:_0x3a00a9[_0x5da4('0x5d')],'id':_0x3a00a9['id']};}if(_0x3a00a9['enduserType']==='Leads'){_0x5692ee[_0x5da4('0x5e')]={'name':!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5b')])?_0x3a00a9['Full_Name']:!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5c')])?_0x3a00a9[_0x5da4('0x5c')]+'\x20'+_0x3a00a9['Last_Name']:_0x3a00a9['Last_Name'],'id':_0x3a00a9['id']};_0x5692ee[_0x5da4('0x5f')]=_[_0x5da4('0x40')](_0x3a00a9[_0x5da4('0x3d')]);}if(_0x57d813['talktime']){_0x5692ee[_0x5da4('0x60')]=moment['utc'](parseInt(_0x57d813[_0x5da4('0x61')])*0x3e8)[_0x5da4('0x62')]('mm:ss');}else if(_0x57d813['answertime']&&_0x57d813[_0x5da4('0x63')]){_0x5692ee[_0x5da4('0x60')]=moment[_0x5da4('0x64')](moment(_0x57d813[_0x5da4('0x63')],_0x5da4('0x65'))[_0x5da4('0x66')](moment(_0x57d813[_0x5da4('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0x5da4('0x62')](_0x5da4('0x68'));}switch(_0x57d813['lastevent']){case _0x5da4('0x69'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x6b');break;case _0x5da4('0x6c'):case _0x5da4('0x6d'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x6e');break;case _0x5da4('0x6f'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x70');break;case'abandoned':_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x71');break;case _0x5da4('0x72'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x73');default:}_0x5692ee['Call_Start_Time']=(_0x4e4e3b===_0x5da4('0x74')?moment(_0x57d813['starttime'])[_0x5da4('0x62')](_0x5da4('0x65')):moment(_0x57d813[_0x5da4('0x75')])[_0x5da4('0x62')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x5da4('0x62')](_0x5da4('0x65'));_0x5692ee[_0x5da4('0x76')]=_0x4e4e3b||_0x5da4('0x77');_0x5692ee=_[_0x5da4('0x78')](_0x5692ee,getCustomFields(_0x26bf4b[_0x5da4('0x79')],_0x57d813));return request({'method':_0x5da4('0x24'),'uri':_0x5da4('0x3e')+_0x1a3bfa+_0x5da4('0x7a'),'headers':{'Authorization':_0x5da4('0x7b')+_0x325670},'body':{'data':[_0x5692ee]},'json':!![]})[_0x5da4('0x31')](function(_0x107039){if(_0x107039&&_0x107039['data'][0x0][_0x5da4('0x44')]===_0x5da4('0x7c')){logger['info'](_0x5da4('0x7d'));return{'id':_0x107039[_0x5da4('0x3c')][0x0]['details']['id']};}})['catch'](function(_0x3ffb60){logger[_0x5da4('0x2e')](_0x5da4('0x7e'),_0x3ffb60['stack']);console[_0x5da4('0x49')](_0x5da4('0x7e'),_0x3ffb60);});}exports[_0x5da4('0x7f')]=function(_0x397e5e,_0x19fa6b,_0x2eb1ee,_0x981871,_0x2dc820,_0x147694){var _0x3bc278,_0x14c587,_0x2cada0;_0x147694['host']=intUtil['stripTrailingSlash'](_0x147694['host']);_0x147694['serverUrl']=intUtil[_0x5da4('0x80')](_0x147694[_0x5da4('0x81')]);if(_0x2dc820&&_0x2dc820['monitor_format']){logger[_0x5da4('0x2e')](_0x5da4('0x82'),'Recording\x20is\x20enabled!');_0x19fa6b['recordingURL']=_0x147694[_0x5da4('0x81')]+_0x5da4('0x83')+_0x19fa6b[_0x5da4('0x84')]+_0x5da4('0x85')+md5(_0x19fa6b[_0x5da4('0x84')]);}else{_0x19fa6b[_0x5da4('0x86')]='';}var _0x41e4df=_0x147694[_0x5da4('0x87')]==='zoho.eu'?'eu':_0x5da4('0x88');return getAccessToken(_0x147694)[_0x5da4('0x31')](function(_0x1c3384){_0x2cada0=_0x1c3384;return getUser(_0x2cada0,_0x41e4df,_0x147694,_0x981871[_0x5da4('0x35')]);})[_0x5da4('0x31')](function(_0xff1609){_0x3bc278=_0xff1609;logger[_0x5da4('0x2e')]('The\x20User\x20ID\x20is:',_0x3bc278['id']);return getEndUser(_0x2cada0,_0x41e4df,_0x147694,_0x19fa6b['calleridname'],_0x19fa6b['calleridnum'],_0x3bc278,_0x2eb1ee);})[_0x5da4('0x31')](function(_0x21ff24){_0x14c587=_0x21ff24;return getCall(_0x2cada0,_0x41e4df,_0x147694,_0x3bc278,_0x14c587,_0x2eb1ee,_0x19fa6b,_0x5da4('0x77'));})[_0x5da4('0x31')](function(_0x566778){if(_0x566778){logger[_0x5da4('0x2e')](_0x5da4('0x89'),_0x566778['id']);logger[_0x5da4('0x2e')](_0x5da4('0x82'),_0x5da4('0x8a'));emit(util[_0x5da4('0x62')](_0x5da4('0x8b'),_0x981871[_0x5da4('0x1a')]),'trigger:browser:url',{'uri':_0x5da4('0x8c')+_0x147694[_0x5da4('0x87')]+_0x5da4('0x8d')+_0x566778['id']});}})['catch'](function(_0x5e1dff){logger['error'](_0x5da4('0x82'),JSON['stringify'](_0x5e1dff));});};exports[_0x5da4('0x74')]=function(_0x3a658b,_0xe2f1f,_0x9ceeeb,_0x4b7f7d,_0x3de55e,_0x5607fb,_0x29414f){var _0x15f952,_0x883edc,_0x1696c3;_0x5607fb['host']=intUtil[_0x5da4('0x80')](_0x5607fb['host']);_0x5607fb[_0x5da4('0x81')]=intUtil[_0x5da4('0x80')](_0x5607fb[_0x5da4('0x81')]);if(_0x29414f&&_0x29414f['recordingFormat']&&_0x29414f[_0x5da4('0x8e')]!==_0x5da4('0x8f')){logger[_0x5da4('0x2e')](_0x5da4('0x90'),_0x5da4('0x91'));_0xe2f1f[_0x5da4('0x86')]=_0x5607fb[_0x5da4('0x81')]+_0x5da4('0x83')+_0xe2f1f[_0x5da4('0x84')]+'/downloads?type=uniqueid&token='+md5(_0xe2f1f[_0x5da4('0x84')]);}var _0x55e4a9=_0x5607fb[_0x5da4('0x87')]===_0x5da4('0x92')?'eu':'com';return getAccessToken(_0x5607fb)[_0x5da4('0x31')](function(_0x5cc055){_0x1696c3=_0x5cc055;return getUser(_0x1696c3,_0x55e4a9,_0x5607fb,_0x4b7f7d[_0x5da4('0x35')]);})[_0x5da4('0x31')](function(_0x13d7ec){_0x15f952=_0x13d7ec;logger[_0x5da4('0x2e')](_0x5da4('0x93'),_0x15f952['id']);return getEndUser(_0x1696c3,_0x55e4a9,_0x5607fb,_0xe2f1f[_0x5da4('0x94')],_0xe2f1f[_0x5da4('0x95')],_0x15f952,_0x9ceeeb);})[_0x5da4('0x31')](function(_0x2b73e6){_0x883edc=_0x2b73e6;return getCall(_0x1696c3,_0x55e4a9,_0x5607fb,_0x15f952,_0x883edc,_0x9ceeeb,_0xe2f1f,'Outbound');})[_0x5da4('0x31')](function(_0x490950){if(_0x490950){logger[_0x5da4('0x2e')]('The\x20Call\x20ID\x20is:',_0x490950['id']);logger['info'](_0x5da4('0x90'),_0x5da4('0x8a'));emit(util[_0x5da4('0x62')](_0x5da4('0x8b'),_0x4b7f7d['name']),_0x5da4('0x96'),{'uri':_0x5da4('0x8c')+_0x5607fb[_0x5da4('0x87')]+_0x5da4('0x8d')+_0x490950['id']});}})[_0x5da4('0x2b')](function(_0x546151){logger['error']('[OUTBOUND]',JSON['stringify'](_0x546151));});};exports[_0x5da4('0x97')]=function(_0x1e478b,_0x4f97c5,_0x281fae,_0x380099,_0x375425,_0x4eb77f){var _0x2c0a03,_0x50b819,_0x27ab86;_0x4eb77f[_0x5da4('0x87')]=intUtil[_0x5da4('0x80')](_0x4eb77f['host']);_0x4eb77f['serverUrl']=intUtil['stripTrailingSlash'](_0x4eb77f['serverUrl']);if(_0x375425&&_0x375425[_0x5da4('0x98')]){logger[_0x5da4('0x2e')]('['+_0x4f97c5[_0x5da4('0x99')][_0x5da4('0x9a')]()+']',_0x5da4('0x91'));_0x4f97c5[_0x5da4('0x86')]=_0x4eb77f[_0x5da4('0x81')]+'/api/voice/recordings/'+_0x4f97c5[_0x5da4('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x4f97c5[_0x5da4('0x84')]);}else{_0x4f97c5[_0x5da4('0x86')]='';}var _0xd7a762=_0x4eb77f[_0x5da4('0x87')]===_0x5da4('0x92')?'eu':_0x5da4('0x88');return getAccessToken(_0x4eb77f)[_0x5da4('0x31')](function(_0x340775){_0x27ab86=_0x340775;return getUser(_0x27ab86,_0xd7a762,_0x4eb77f);})[_0x5da4('0x31')](function(_0x30c5c9){_0x2c0a03=_0x30c5c9;logger['info']('The\x20User\x20ID\x20is:',_0x2c0a03['id']);return getEndUser(_0x27ab86,_0xd7a762,_0x4eb77f,_0x4f97c5[_0x5da4('0x9b')],_0x4f97c5[_0x5da4('0x9c')],_0x2c0a03,_0x281fae);})[_0x5da4('0x31')](function(_0x135bd3){_0x50b819=_0x135bd3;return getCall(_0x27ab86,_0xd7a762,_0x4eb77f,_0x2c0a03,_0x50b819,_0x281fae,_0x4f97c5,_0x5da4('0x77'));})['then'](function(_0x3bd055){if(_0x3bd055){logger[_0x5da4('0x2e')]('The\x20Call\x20ID\x20is:',_0x3bd055['id']);}})[_0x5da4('0x2b')](function(_0x2fb544){logger['error']('['+_0x4f97c5[_0x5da4('0x99')][_0x5da4('0x9a')]()+']',JSON[_0x5da4('0xf')](_0x2fb544));});}; \ 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 87e18ad..96dc2f9 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 _0xb580=['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','data2','Script','data3'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xb580,0x146));var _0x0b58=function(_0x1d649f,_0x202b57){_0x1d649f=_0x1d649f-0x0;var _0x2c4034=_0xb580[_0x1d649f];return _0x2c4034;};'use strict';var util=require('util');var sh=require(_0x0b58('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x30cc0c,_0x2d7631){var _0x39a936=_0x30cc0c[_0x0b58('0x1')]?_0x30cc0c[_0x0b58('0x1')]:_0x0b58('0x2');var _0x48b788=_0x30cc0c[_0x0b58('0x3')]?Mustache[_0x0b58('0x4')](_0x30cc0c[_0x0b58('0x3')],_0x2d7631):_0x2d7631;sh[_0x0b58('0x5')](_0x48b788,function(_0x922e3d,_0x4a8b6d,_0x1de51d){if(_0x922e3d!==0x0){logger[_0x0b58('0x6')](util[_0x0b58('0x7')](_0x0b58('0x8'),_0x39a936,_0x48b788,_0x922e3d,_0x1de51d));}else{logger[_0x0b58('0x9')](util[_0x0b58('0x7')](_0x0b58('0xa'),_0x39a936,_0x48b788,_0x4a8b6d));}});}; \ No newline at end of file +var _0x9bb9=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','shelljs','data2','exec','error','format'];(function(_0x2e71f9,_0x21bfed){var _0x3ce8d5=function(_0x191c98){while(--_0x191c98){_0x2e71f9['push'](_0x2e71f9['shift']());}};_0x3ce8d5(++_0x21bfed);}(_0x9bb9,0xe1));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x99bb('0x0'));var sh=require(_0x99bb('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x462d28,_0x157cbe){var _0x50e017=_0x462d28[_0x99bb('0x2')]?_0x462d28[_0x99bb('0x2')]:'Script';var _0x498b1e=_0x462d28['data3']?Mustache['render'](_0x462d28['data3'],_0x157cbe):_0x157cbe;sh[_0x99bb('0x3')](_0x498b1e,function(_0x1c907c,_0x34ee3f,_0x41d7fb){if(_0x1c907c!==0x0){logger[_0x99bb('0x4')](util[_0x99bb('0x5')](_0x99bb('0x6'),_0x50e017,_0x498b1e,_0x1c907c,_0x41d7fb));}else{logger['info'](util[_0x99bb('0x5')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x50e017,_0x498b1e,_0x34ee3f));}});}; \ 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 65c2220..dc1f04c 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 _0x7d98=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','number','data5','data6','parse','error','GET','DELETE','POST','PUT','data7'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7d98,0xe2));var _0x87d9=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x7d98[_0x3f8282];return _0x50f918;};'use strict';var rp=require(_0x87d9('0x0'));var util=require(_0x87d9('0x1'));var _=require(_0x87d9('0x2'));var Mustache=require(_0x87d9('0x3'));var logger=require(_0x87d9('0x4'))('trigger');exports[_0x87d9('0x5')]=function(_0x2d6e0b,_0x2ade58){var _0x1fa406,_0x58a7fe;var _0x541a6f={'method':_0x2d6e0b[_0x87d9('0x6')][_0x87d9('0x7')](),'uri':Mustache[_0x87d9('0x8')](_0x2d6e0b['data2'],_0x2ade58),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2d6e0b['data5'])===_0x87d9('0x9')&&parseInt(_0x2d6e0b[_0x87d9('0xa')])>=0x1&&parseInt(_0x2d6e0b[_0x87d9('0xa')])<=0xa?parseInt(_0x2d6e0b[_0x87d9('0xa')])*0x3e8:0x5*0x3e8};try{_0x541a6f['headers']=_0x2d6e0b[_0x87d9('0xb')]?JSON[_0x87d9('0xc')](Mustache[_0x87d9('0x8')](_0x2d6e0b[_0x87d9('0xb')],_0x2ade58)):{};}catch(_0x29870f){logger[_0x87d9('0xd')](_0x29870f['stack']);}switch(_0x2d6e0b[_0x87d9('0x6')]['toUpperCase']()){case _0x87d9('0xe'):case _0x87d9('0xf'):_0x1fa406=null;_0x541a6f['qs']=_0x2ade58;break;case _0x87d9('0x10'):case _0x87d9('0x11'):if(_0x2d6e0b['data7']){try{_0x1fa406=JSON[_0x87d9('0xc')](Mustache[_0x87d9('0x8')](_0x2d6e0b[_0x87d9('0x12')],_0x2ade58));_0x541a6f['body']=_0x1fa406;}catch(_0x3dd40f){logger['error'](_0x3dd40f['stack']);logger[_0x87d9('0xd')](_0x87d9('0x13'));}}else{_0x1fa406=_0x2ade58;_0x541a6f[_0x87d9('0x14')]=_0x1fa406;}break;}logger[_0x87d9('0x15')](util[_0x87d9('0x16')](_0x87d9('0x17'),_0x2d6e0b[_0x87d9('0x6')],_0x2d6e0b[_0x87d9('0x18')],JSON[_0x87d9('0x19')](_0x541a6f)));rp(_0x541a6f)[_0x87d9('0x1a')](function(_0x280f55){_0x1fa406=!_[_0x87d9('0x1b')](_0x1fa406)?_0x87d9('0x1c')+_0x1fa406:'';_0x58a7fe=typeof _0x280f55[_0x87d9('0x14')]===_0x87d9('0x1d')?JSON[_0x87d9('0x19')](_0x280f55[_0x87d9('0x14')]):_0x280f55[_0x87d9('0x14')];logger[_0x87d9('0x15')](util[_0x87d9('0x16')](_0x87d9('0x1e'),_0x2d6e0b['data1'],_0x2d6e0b[_0x87d9('0x18')],_0x280f55[_0x87d9('0x1f')],_0x58a7fe));})[_0x87d9('0x20')](function(_0x588099){logger[_0x87d9('0xd')](util[_0x87d9('0x16')](_0x87d9('0x21'),_0x2d6e0b[_0x87d9('0x6')],_0x2d6e0b['data2'],_0x588099[_0x87d9('0x1f')],_0x588099['name'],_0x588099[_0x87d9('0x22')]));});}; \ No newline at end of file +var _0x775c=['../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','stack','GET','DELETE','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x775c,0x150));var _0xc775=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x775c[_0x1e7b16];return _0x37fadc;};'use strict';var rp=require(_0xc775('0x0'));var util=require(_0xc775('0x1'));var _=require(_0xc775('0x2'));var Mustache=require(_0xc775('0x3'));var logger=require(_0xc775('0x4'))(_0xc775('0x5'));exports[_0xc775('0x6')]=function(_0x4a0028,_0x41232c){var _0x50db19,_0xf2bd76;var _0x51d852={'method':_0x4a0028[_0xc775('0x7')][_0xc775('0x8')](),'uri':Mustache[_0xc775('0x9')](_0x4a0028['data2'],_0x41232c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a0028[_0xc775('0xa')])===_0xc775('0xb')&&parseInt(_0x4a0028[_0xc775('0xa')])>=0x1&&parseInt(_0x4a0028[_0xc775('0xa')])<=0xa?parseInt(_0x4a0028['data5'])*0x3e8:0x5*0x3e8};try{_0x51d852[_0xc775('0xc')]=_0x4a0028[_0xc775('0xd')]?JSON[_0xc775('0xe')](Mustache[_0xc775('0x9')](_0x4a0028[_0xc775('0xd')],_0x41232c)):{};}catch(_0x4da761){logger['error'](_0x4da761[_0xc775('0xf')]);}switch(_0x4a0028[_0xc775('0x7')][_0xc775('0x8')]()){case _0xc775('0x10'):case _0xc775('0x11'):_0x50db19=null;_0x51d852['qs']=_0x41232c;break;case'POST':case'PUT':if(_0x4a0028[_0xc775('0x12')]){try{_0x50db19=JSON[_0xc775('0xe')](Mustache[_0xc775('0x9')](_0x4a0028[_0xc775('0x12')],_0x41232c));_0x51d852[_0xc775('0x13')]=_0x50db19;}catch(_0x531e3c){logger[_0xc775('0x14')](_0x531e3c[_0xc775('0xf')]);logger[_0xc775('0x14')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x50db19=_0x41232c;_0x51d852[_0xc775('0x13')]=_0x50db19;}break;}logger[_0xc775('0x15')](util[_0xc775('0x16')](_0xc775('0x17'),_0x4a0028[_0xc775('0x7')],_0x4a0028[_0xc775('0x18')],JSON[_0xc775('0x19')](_0x51d852)));rp(_0x51d852)[_0xc775('0x1a')](function(_0x1fc74f){_0x50db19=!_['isNil'](_0x50db19)?_0xc775('0x1b')+_0x50db19:'';_0xf2bd76=typeof _0x1fc74f['body']===_0xc775('0x1c')?JSON['stringify'](_0x1fc74f['body']):_0x1fc74f[_0xc775('0x13')];logger[_0xc775('0x15')](util[_0xc775('0x16')](_0xc775('0x1d'),_0x4a0028[_0xc775('0x7')],_0x4a0028[_0xc775('0x18')],_0x1fc74f[_0xc775('0x1e')],_0xf2bd76));})[_0xc775('0x1f')](function(_0xf27868){logger[_0xc775('0x14')](util[_0xc775('0x16')](_0xc775('0x20'),_0x4a0028['data1'],_0x4a0028[_0xc775('0x18')],_0xf27868[_0xc775('0x1e')],_0xf27868['name'],_0xf27868[_0xc775('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 55c2422..9165925 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 _0x2cf9=['then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','request'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x2cf9,0x73));var _0x92cf=function(_0x16797e,_0x485d85){_0x16797e=_0x16797e-0x0;var _0x333c87=_0x2cf9[_0x16797e];return _0x333c87;};'use strict';var jayson=require(_0x92cf('0x0'));var BPromise=require(_0x92cf('0x1'));var logger=require(_0x92cf('0x2'))(_0x92cf('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x14d948,_0x4e466b){return new BPromise(function(_0x52076b,_0x31399f){return client[_0x92cf('0x4')](_0x14d948,_0x4e466b)[_0x92cf('0x5')](function(_0x4ea2a2){logger[_0x92cf('0x6')](_0x92cf('0x7'),_0x92cf('0x3'),_0x14d948,_0x4e466b,_0x4ea2a2);if(_0x4ea2a2[_0x92cf('0x8')]){logger[_0x92cf('0x8')](_0x92cf('0x7'),_0x92cf('0x3'),_0x14d948,_0x4ea2a2[_0x92cf('0x8')][_0x92cf('0x9')],_0x4e466b);return _0x31399f(_0x4ea2a2[_0x92cf('0x8')][_0x92cf('0x9')]);}else{return _0x52076b(_0x4ea2a2[_0x92cf('0xa')]);}})['catch'](function(_0x5ecabc){logger[_0x92cf('0x8')]('rpc',_0x92cf('0x3'),_0x14d948,_0x5ecabc,_0x4e466b);return _0x31399f(_0x5ecabc);});});};module[_0x92cf('0xb')]=client; \ No newline at end of file +var _0x0fa5=['routing','client','request','then','debug','rpc','error','message','catch','../../config/logger'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x0fa5,0xdb));var _0x50fa=function(_0x26a515,_0x286339){_0x26a515=_0x26a515-0x0;var _0x314682=_0x0fa5[_0x26a515];return _0x314682;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x50fa('0x0'))(_0x50fa('0x1'));var client=jayson[_0x50fa('0x2')]['http']({'port':0x2329});client['Request']=function(_0x19579b,_0x8d8ffc){return new BPromise(function(_0x569f87,_0x581cc){return client[_0x50fa('0x3')](_0x19579b,_0x8d8ffc)[_0x50fa('0x4')](function(_0x525e7e){logger[_0x50fa('0x5')](_0x50fa('0x6'),_0x50fa('0x1'),_0x19579b,_0x8d8ffc,_0x525e7e);if(_0x525e7e[_0x50fa('0x7')]){logger['error'](_0x50fa('0x6'),_0x50fa('0x1'),_0x19579b,_0x525e7e[_0x50fa('0x7')]['message'],_0x8d8ffc);return _0x581cc(_0x525e7e[_0x50fa('0x7')][_0x50fa('0x8')]);}else{return _0x569f87(_0x525e7e['result']);}})[_0x50fa('0x9')](function(_0x388a45){logger['error']('rpc',_0x50fa('0x1'),_0x19579b,_0x388a45,_0x8d8ffc);return _0x581cc(_0x388a45);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6fdae7a..fa05ea5 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 _0x1465=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','refresh','getSettings','loginMailFrequency','catch','./realtime'];(function(_0x56092a,_0x291ce5){var _0x1c9558=function(_0x5bf0c5){while(--_0x5bf0c5){_0x56092a['push'](_0x56092a['shift']());}};_0x1c9558(++_0x291ce5);}(_0x1465,0xa8));var _0x5146=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x1465[_0x3e2fcf];return _0x497db7;};'use strict';var server=require('./server');var Realtime=require(_0x5146('0x0'));var EmailChannel=require(_0x5146('0x1'));var mailAccount=require(_0x5146('0x2'));var setting=require(_0x5146('0x3'));var logger=require(_0x5146('0x4'))(_0x5146('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5146('0x6')]()['then'](mailAccount[_0x5146('0x7')]())[_0x5146('0x8')](realtime['initMailAccounts']())[_0x5146('0x8')](function(){email[_0x5146('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x5146('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0x5146('0xa')]();})['then'](function(_0xe8839d){return setInterval(initRealtime,_0xe8839d[_0x5146('0xb')]*0x3e8);})[_0x5146('0xc')](function(_0xface0f){logger['error']('Email\x20service\x20initialization',_0xface0f);});}main(); \ No newline at end of file +var _0x6de0=['error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x3439fa,_0x5c46cd){var _0x445161=function(_0x5f3d21){while(--_0x5f3d21){_0x3439fa['push'](_0x3439fa['shift']());}};_0x445161(++_0x5c46cd);}(_0x6de0,0x71));var _0x06de=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x6de0[_0x4fbfd9];return _0x31dc94;};'use strict';var server=require(_0x06de('0x0'));var Realtime=require(_0x06de('0x1'));var EmailChannel=require(_0x06de('0x2'));var mailAccount=require(_0x06de('0x3'));var setting=require(_0x06de('0x4'));var logger=require(_0x06de('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x06de('0x6')]()[_0x06de('0x7')](mailAccount[_0x06de('0x8')]())[_0x06de('0x7')](realtime[_0x06de('0x9')]())[_0x06de('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x06de('0xa')](realtime,email)[_0x06de('0x7')](function(){return initRealtime();})[_0x06de('0x7')](function(){return setting[_0x06de('0xb')]();})[_0x06de('0x7')](function(_0x3b828d){return setInterval(initRealtime,_0x3b828d[_0x06de('0xc')]*0x3e8);})['catch'](function(_0x4ba4a6){logger[_0x06de('0xd')]('Email\x20service\x20initialization',_0x4ba4a6);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index de56731..693668b 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 _0xe688=['Imap','total','isNil','emit','refresh','hasOwnProperty','service','provider','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','smtp','verifySmtp','Smtp','lastSync','verify','verified','exports','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','active','status'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xe688,0x1ca));var _0x8e68=function(_0x53cb5e,_0x2a8ef5){_0x53cb5e=_0x53cb5e-0x0;var _0x5d3eaf=_0xe688[_0x53cb5e];return _0x5d3eaf;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x8e68('0x0'));var md5=require(_0x8e68('0x1'));var Redis=require('ioredis');var config=require(_0x8e68('0x2'));var logger=require(_0x8e68('0x3'))(_0x8e68('0x4'));config[_0x8e68('0x5')]=_[_0x8e68('0x6')](config[_0x8e68('0x5')],{'host':_0x8e68('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e68('0x5')]));var EmailImap=require(_0x8e68('0x8'));var EmailSmtp=require(_0x8e68('0x9'));var mailAccount=require(_0x8e68('0xa'));var md5Accounts={};function EmailChannel(_0x2cb2df){logger[_0x8e68('0xb')](_0x8e68('0xc'));this[_0x8e68('0xd')]=_0x2cb2df[_0x8e68('0xd')];this[_0x8e68('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x8e68('0xf')]['emit']=function(_0x179a4e){var _0x102af4=this[_0x8e68('0xd')][_0x179a4e];var _0x3a353b={'id':_0x102af4['id'],'name':_0x102af4[_0x8e68('0x10')],'key':_0x102af4['key'],'active':_0x102af4[_0x8e68('0x11')],'Imap':{'status':_0x102af4['Imap'][_0x8e68('0x12')],'messageStatus':_0x102af4[_0x8e68('0x13')]['messageStatus'],'total':_0x102af4[_0x8e68('0x13')][_0x8e68('0x14')]}};if(_[_0x8e68('0x15')](md5Accounts[_0x179a4e])){md5Accounts[_0x179a4e]={};}var _0x323f7a=md5(JSON['stringify'](_0x3a353b));if(md5Accounts[_0x179a4e][_0x8e68('0x1')]!==_0x323f7a){md5Accounts[_0x179a4e]['md5']=_0x323f7a;io[_0x8e68('0x16')]('mailAccount:update',_0x3a353b);}};EmailChannel['prototype'][_0x8e68('0x17')]=function(_0x247836){for(var _0x5fa06e in _0x247836){if(_0x247836[_0x8e68('0x18')](_0x5fa06e)){if(_0x247836[_0x5fa06e]['Imap']&&_0x247836[_0x5fa06e][_0x8e68('0x11')]){var _0x1ef02c=_0x247836[_0x5fa06e][_0x8e68('0x13')];if(!_0x1ef02c[_0x8e68('0x19')]&&_0x247836[_0x5fa06e]['provider']!=='custom')_0x1ef02c[_0x8e68('0x19')]=_0x247836[_0x5fa06e][_0x8e68('0x1a')];if(!this[_0x8e68('0xe')]['hasOwnProperty'](_0x1ef02c['id'])){this[_0x8e68('0xe')][_0x1ef02c['id']]=new EmailImap(_0x1ef02c,_0x247836[_0x5fa06e]['email']);this[_0x8e68('0xe')][_0x1ef02c['id']]['on'](_0x8e68('0x1b'),this[_0x8e68('0x1c')][_0x8e68('0x1d')](this,_0x5fa06e));this[_0x8e68('0xe')][_0x1ef02c['id']]['on'](_0x8e68('0x4'),this['handleImapEmail'][_0x8e68('0x1d')](this,_0x5fa06e));this[_0x8e68('0xe')][_0x1ef02c['id']]['on'](_0x8e68('0x1e'),this[_0x8e68('0x1f')][_0x8e68('0x1d')](this,_0x5fa06e));this[_0x8e68('0xe')][_0x1ef02c['id']]['on'](_0x8e68('0x20'),this[_0x8e68('0x21')]['bind'](this,_0x5fa06e));}}else{if(_['isNil'](this[_0x8e68('0xd')][_0x5fa06e][_0x8e68('0x13')])){this[_0x8e68('0xd')][_0x5fa06e][_0x8e68('0x13')]={};}this[_0x8e68('0xd')][_0x5fa06e][_0x8e68('0x13')][_0x8e68('0x12')]=_0x8e68('0x22');this[_0x8e68('0xd')][_0x5fa06e]['Imap'][_0x8e68('0x23')]='';this['emit'](_0x5fa06e);}}}};EmailChannel[_0x8e68('0xf')][_0x8e68('0x1c')]=function(_0x84e711,_0x4ec5af){if(this[_0x8e68('0xd')][_0x84e711]){this[_0x8e68('0xd')][_0x84e711][_0x8e68('0x13')][_0x8e68('0x12')]=_0x8e68('0x24');this[_0x8e68('0xd')][_0x84e711]['Imap'][_0x8e68('0x23')]=_0x4ec5af[_0x8e68('0x10')];if(_0x4ec5af['messages']){this[_0x8e68('0xd')][_0x84e711]['Imap'][_0x8e68('0x14')]=_0x4ec5af[_0x8e68('0x25')][_0x8e68('0x14')];}return this[_0x8e68('0x16')](_0x84e711);}};EmailChannel['prototype'][_0x8e68('0x26')]=function(_0xcda0ee,_0x2606fa){logger[_0x8e68('0xb')](_0x8e68('0x27'),_0x2606fa[_0x8e68('0x28')],_0x2606fa[_0x8e68('0x29')],_0x2606fa[_0x8e68('0x2a')],_0xcda0ee);if(this[_0x8e68('0xd')][_0xcda0ee]){return mailAccount['notify'](_0xcda0ee,_0x2606fa)[_0x8e68('0x2b')](function(_0x552caf){if(_0x552caf){logger['info'](_0x8e68('0x2c'));}})[_0x8e68('0x2d')](function(_0x3eaeb7){logger[_0x8e68('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x3eaeb7));});}};EmailChannel[_0x8e68('0xf')]['handleImapEnd']=function(_0x3c43de){if(this[_0x8e68('0xd')][_0x3c43de]&&this['mailAccounts'][_0x3c43de][_0x8e68('0x13')]){if(this[_0x8e68('0xe')][this[_0x8e68('0xd')][_0x3c43de][_0x8e68('0x13')]['id']]){delete this[_0x8e68('0xe')][this['mailAccounts'][_0x3c43de]['Imap']['id']];}this[_0x8e68('0xd')][_0x3c43de][_0x8e68('0x13')]['lastSync']=moment();this[_0x8e68('0x16')](_0x3c43de);}};EmailChannel['prototype']['handleImapError']=function(_0x4f5974,_0x417bd1){if(this[_0x8e68('0xd')][_0x4f5974]){this[_0x8e68('0xd')][_0x4f5974][_0x8e68('0x13')][_0x8e68('0x12')]=_0x8e68('0x20');this[_0x8e68('0xd')][_0x4f5974][_0x8e68('0x13')][_0x8e68('0x23')]=_0x417bd1;return this['emit'](_0x4f5974);}};EmailChannel[_0x8e68('0xf')]['sendMail']=function(_0x3f1404,_0x224114){return this[_0x8e68('0x2e')]['send'](_0x3f1404,_0x224114);};EmailChannel[_0x8e68('0xf')][_0x8e68('0x2f')]=function(_0x5e57ce){var _0x32e1cc=this;if(this[_0x8e68('0xd')][_0x5e57ce['id']]){if(_[_0x8e68('0x15')](this[_0x8e68('0xd')][_0x5e57ce['id']][_0x8e68('0x30')])){this['mailAccounts'][_0x5e57ce['id']]['Smtp']={};}this[_0x8e68('0xd')][_0x5e57ce['id']][_0x8e68('0x30')][_0x8e68('0x31')]=moment();return new BPromise(function(_0x1ef58e,_0x7b01b){return _0x32e1cc['smtp'][_0x8e68('0x32')](_0x5e57ce)[_0x8e68('0x2b')](function(_0x365709){_0x32e1cc[_0x8e68('0xd')][_0x5e57ce['id']][_0x8e68('0x30')][_0x8e68('0x12')]=_0x8e68('0x33');_0x32e1cc['mailAccounts'][_0x5e57ce['id']][_0x8e68('0x30')][_0x8e68('0x23')]='';_0x32e1cc['emit'](_0x5e57ce['id']);_0x1ef58e(_0x365709);})[_0x8e68('0x2d')](function(_0xf0802a){_0x32e1cc[_0x8e68('0xd')][_0x5e57ce['id']]['Smtp'][_0x8e68('0x12')]=_0x8e68('0x20');_0x32e1cc['mailAccounts'][_0x5e57ce['id']][_0x8e68('0x30')][_0x8e68('0x23')]=_0xf0802a;_0x32e1cc['emit'](_0x5e57ce['id']);_0x7b01b(_0xf0802a);});});}return this[_0x8e68('0x2e')]['verify'](_0x5e57ce);};module[_0x8e68('0x34')]=EmailChannel; \ No newline at end of file +var _0x0e7d=['messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','custom','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','status','prototype','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verify','catch','exports','lodash','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap'];(function(_0x175e6e,_0x12470d){var _0xdf5494=function(_0x36f903){while(--_0x36f903){_0x175e6e['push'](_0x175e6e['shift']());}};_0xdf5494(++_0x12470d);}(_0x0e7d,0x187));var _0xd0e7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0e7d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd0e7('0x0'));var moment=require(_0xd0e7('0x1'));var BPromise=require(_0xd0e7('0x2'));var md5=require(_0xd0e7('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xd0e7('0x4'))(_0xd0e7('0x5'));config[_0xd0e7('0x6')]=_[_0xd0e7('0x7')](config['redis'],{'host':_0xd0e7('0x8'),'port':0x18eb});var io=require(_0xd0e7('0x9'))(new Redis(config[_0xd0e7('0x6')]));var EmailImap=require(_0xd0e7('0xa'));var EmailSmtp=require(_0xd0e7('0xb'));var mailAccount=require(_0xd0e7('0xc'));var md5Accounts={};function EmailChannel(_0x39b62b){logger[_0xd0e7('0xd')](_0xd0e7('0xe'));this[_0xd0e7('0xf')]=_0x39b62b['mailAccounts'];this['imapAccounts']={};this[_0xd0e7('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xd0e7('0x11')]=function(_0x8f6244){var _0x598920=this[_0xd0e7('0xf')][_0x8f6244];var _0x378bee={'id':_0x598920['id'],'name':_0x598920[_0xd0e7('0x12')],'key':_0x598920[_0xd0e7('0x13')],'active':_0x598920[_0xd0e7('0x14')],'Imap':{'status':_0x598920[_0xd0e7('0x15')]['status'],'messageStatus':_0x598920[_0xd0e7('0x15')][_0xd0e7('0x16')],'total':_0x598920[_0xd0e7('0x15')][_0xd0e7('0x17')]}};if(_['isNil'](md5Accounts[_0x8f6244])){md5Accounts[_0x8f6244]={};}var _0x390d90=md5(JSON[_0xd0e7('0x18')](_0x378bee));if(md5Accounts[_0x8f6244][_0xd0e7('0x3')]!==_0x390d90){md5Accounts[_0x8f6244][_0xd0e7('0x3')]=_0x390d90;io[_0xd0e7('0x11')](_0xd0e7('0x19'),_0x378bee);}};EmailChannel['prototype'][_0xd0e7('0x1a')]=function(_0x312853){for(var _0x5babce in _0x312853){if(_0x312853[_0xd0e7('0x1b')](_0x5babce)){if(_0x312853[_0x5babce]['Imap']&&_0x312853[_0x5babce][_0xd0e7('0x14')]){var _0x4e4cb8=_0x312853[_0x5babce][_0xd0e7('0x15')];if(!_0x4e4cb8['service']&&_0x312853[_0x5babce]['provider']!==_0xd0e7('0x1c'))_0x4e4cb8[_0xd0e7('0x1d')]=_0x312853[_0x5babce][_0xd0e7('0x1e')];if(!this[_0xd0e7('0x1f')][_0xd0e7('0x1b')](_0x4e4cb8['id'])){this[_0xd0e7('0x1f')][_0x4e4cb8['id']]=new EmailImap(_0x4e4cb8,_0x312853[_0x5babce][_0xd0e7('0x5')]);this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on'](_0xd0e7('0x20'),this[_0xd0e7('0x21')][_0xd0e7('0x22')](this,_0x5babce));this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on'](_0xd0e7('0x5'),this[_0xd0e7('0x23')][_0xd0e7('0x22')](this,_0x5babce));this['imapAccounts'][_0x4e4cb8['id']]['on'](_0xd0e7('0x24'),this[_0xd0e7('0x25')][_0xd0e7('0x22')](this,_0x5babce));this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on']('error',this[_0xd0e7('0x26')]['bind'](this,_0x5babce));}}else{if(_[_0xd0e7('0x27')](this[_0xd0e7('0xf')][_0x5babce][_0xd0e7('0x15')])){this[_0xd0e7('0xf')][_0x5babce][_0xd0e7('0x15')]={};}this[_0xd0e7('0xf')][_0x5babce]['Imap'][_0xd0e7('0x28')]='disabled';this['mailAccounts'][_0x5babce][_0xd0e7('0x15')][_0xd0e7('0x16')]='';this[_0xd0e7('0x11')](_0x5babce);}}}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x21')]=function(_0x4a26aa,_0x18202c){if(this['mailAccounts'][_0x4a26aa]){this[_0xd0e7('0xf')][_0x4a26aa]['Imap'][_0xd0e7('0x28')]=_0xd0e7('0x2a');this['mailAccounts'][_0x4a26aa][_0xd0e7('0x15')][_0xd0e7('0x16')]=_0x18202c[_0xd0e7('0x12')];if(_0x18202c[_0xd0e7('0x2b')]){this[_0xd0e7('0xf')][_0x4a26aa]['Imap'][_0xd0e7('0x17')]=_0x18202c[_0xd0e7('0x2b')][_0xd0e7('0x17')];}return this[_0xd0e7('0x11')](_0x4a26aa);}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x23')]=function(_0x147be3,_0x5e2f46){logger[_0xd0e7('0xd')](_0xd0e7('0x2c'),_0x5e2f46[_0xd0e7('0x2d')],_0x5e2f46[_0xd0e7('0x2e')],_0x5e2f46[_0xd0e7('0x2f')],_0x147be3);if(this[_0xd0e7('0xf')][_0x147be3]){return mailAccount['notify'](_0x147be3,_0x5e2f46)[_0xd0e7('0x30')](function(_0x1e8959){if(_0x1e8959){logger[_0xd0e7('0xd')](_0xd0e7('0x31'));}})['catch'](function(_0x20260d){logger[_0xd0e7('0x32')](_0xd0e7('0x33'),JSON[_0xd0e7('0x18')](_0x20260d));});}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x25')]=function(_0x1334db){if(this[_0xd0e7('0xf')][_0x1334db]&&this[_0xd0e7('0xf')][_0x1334db]['Imap']){if(this[_0xd0e7('0x1f')][this[_0xd0e7('0xf')][_0x1334db]['Imap']['id']]){delete this[_0xd0e7('0x1f')][this['mailAccounts'][_0x1334db][_0xd0e7('0x15')]['id']];}this['mailAccounts'][_0x1334db][_0xd0e7('0x15')]['lastSync']=moment();this[_0xd0e7('0x11')](_0x1334db);}};EmailChannel['prototype']['handleImapError']=function(_0x44f14c,_0xee100d){if(this[_0xd0e7('0xf')][_0x44f14c]){this[_0xd0e7('0xf')][_0x44f14c][_0xd0e7('0x15')][_0xd0e7('0x28')]='error';this[_0xd0e7('0xf')][_0x44f14c][_0xd0e7('0x15')]['messageStatus']=_0xee100d;return this['emit'](_0x44f14c);}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x34')]=function(_0x37f3b2,_0x22e79d){return this[_0xd0e7('0x10')][_0xd0e7('0x35')](_0x37f3b2,_0x22e79d);};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x36')]=function(_0x1ae377){var _0x4717ce=this;if(this['mailAccounts'][_0x1ae377['id']]){if(_[_0xd0e7('0x27')](this['mailAccounts'][_0x1ae377['id']]['Smtp'])){this[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')]={};}this['mailAccounts'][_0x1ae377['id']][_0xd0e7('0x37')]['lastSync']=moment();return new BPromise(function(_0x5bd987,_0xfadae0){return _0x4717ce[_0xd0e7('0x10')][_0xd0e7('0x38')](_0x1ae377)['then'](function(_0xaae992){_0x4717ce['mailAccounts'][_0x1ae377['id']][_0xd0e7('0x37')]['status']='verified';_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')][_0xd0e7('0x16')]='';_0x4717ce[_0xd0e7('0x11')](_0x1ae377['id']);_0x5bd987(_0xaae992);})[_0xd0e7('0x39')](function(_0x374b87){_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')][_0xd0e7('0x28')]='error';_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')]['messageStatus']=_0x374b87;_0x4717ce[_0xd0e7('0x11')](_0x1ae377['id']);_0xfadae0(_0x374b87);});});}return this['smtp'][_0xd0e7('0x38')](_0x1ae377);};module[_0xd0e7('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f039708..0be5339 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 _0xd117=['handleError','end','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError','closeBox','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','emit','handleFetchEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','handleEnd','error','bind','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','openBox','handleOpenBox','readUnseen','handleCloseBox'];(function(_0x52db3f,_0x37ab5f){var _0x41b731=function(_0x3f1c11){while(--_0x3f1c11){_0x52db3f['push'](_0x52db3f['shift']());}};_0x41b731(++_0x37ab5f);}(_0xd117,0x182));var _0x7d11=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xd117[_0x27d8bc];return _0x4b04cb;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var Imap=require(_0x7d11('0x2'));var simpleParser=require(_0x7d11('0x3'))[_0x7d11('0x4')];var Iconv=require(_0x7d11('0x5'))[_0x7d11('0x6')];var EventEmitter=require(_0x7d11('0x7'))[_0x7d11('0x8')];var utils=require(_0x7d11('0x9'));var logger=require(_0x7d11('0xa'))(_0x7d11('0xb'));function EmailImap(_0x27d7e8,_0x40c3c4){this[_0x7d11('0xc')]=_0x7d11('0xd');this['account']=this[_0x7d11('0xe')](_0x27d7e8,_0x40c3c4);this[_0x7d11('0x2')]=new Imap(this[_0x7d11('0xf')]);this['imap'][_0x7d11('0x10')](_0x7d11('0x11'),this[_0x7d11('0x12')]['bind'](this));this[_0x7d11('0x2')]['once']('end',this[_0x7d11('0x13')]['bind'](this));this['imap']['on'](_0x7d11('0x14'),this['handleError'][_0x7d11('0x15')](this));this[_0x7d11('0x2')]['connect']();}util[_0x7d11('0x16')](EmailImap,EventEmitter);EmailImap[_0x7d11('0x17')]['getAccount']=function(_0x324de5,_0x16949d){var _0x20a2df={'connTimeout':_0x324de5[_0x7d11('0x18')]?_0x324de5[_0x7d11('0x18')]*0x3e8:0x2710,'authTimeout':_0x324de5[_0x7d11('0x19')]?_0x324de5[_0x7d11('0x19')]*0x3e8:0x1388};if(_0x324de5[_0x7d11('0x1a')]){_0x20a2df['user']=_0x324de5[_0x7d11('0x1b')];_0x20a2df[_0x7d11('0xb')]=_0x16949d||_0x324de5[_0x7d11('0x1b')]||_0x7d11('0x1c');if(_0x324de5[_0x7d11('0x1d')]){_0x20a2df['xoauth2']=utils[_0x7d11('0x1e')](_0x324de5[_0x7d11('0x1f')]['data5'],_0x324de5['user']);}else{_0x20a2df[_0x7d11('0x20')]=_0x324de5['password'];}}else{if(_0x324de5[_0x7d11('0x21')]){_0x20a2df['user']=_0x324de5[_0x7d11('0x1b')];_0x20a2df[_0x7d11('0x20')]=_0x324de5[_0x7d11('0x20')];}}_0x20a2df[_0x7d11('0x22')]=_0x324de5[_0x7d11('0x22')];_0x20a2df[_0x7d11('0x23')]=_0x324de5[_0x7d11('0x23')]||0x3e1;if(_0x324de5[_0x7d11('0x24')]){_0x20a2df['tls']=!![];}else{_0x20a2df[_0x7d11('0x24')]=![];_0x20a2df['autotls']='required';}return _0x20a2df;};EmailImap['prototype'][_0x7d11('0x12')]=function(){this[_0x7d11('0x2')][_0x7d11('0x25')](this[_0x7d11('0xc')],![],this[_0x7d11('0x26')][_0x7d11('0x15')](this));};EmailImap[_0x7d11('0x17')][_0x7d11('0x26')]=function(_0x5e2f2f,_0x36c2b4){if(_0x5e2f2f){this['handleError'](_0x5e2f2f,!![]);}else{this['emit']('box',_0x36c2b4);this[_0x7d11('0x27')]();}};EmailImap['prototype'][_0x7d11('0x28')]=function(_0x30e4c6){if(_0x30e4c6){this[_0x7d11('0x29')](_0x30e4c6,!![]);}else{this['imap'][_0x7d11('0x2a')]();}};EmailImap[_0x7d11('0x17')][_0x7d11('0x27')]=function(){this['imap'][_0x7d11('0x2b')]([_0x7d11('0x2c')],this[_0x7d11('0x2d')][_0x7d11('0x15')](this));};EmailImap['prototype'][_0x7d11('0x2d')]=function(_0x512f7f,_0x1bc218){if(_0x512f7f){this['handleError'](_0x512f7f,!![]);}else{if(_0x1bc218[_0x7d11('0x2e')]){try{var _0xba4e80=this[_0x7d11('0x2')]['fetch'](_0x1bc218,{'bodies':'','markSeen':!![]});_0xba4e80['on']('message',this[_0x7d11('0x2f')][_0x7d11('0x15')](this));_0xba4e80['once'](_0x7d11('0x14'),this[_0x7d11('0x30')][_0x7d11('0x15')](this));_0xba4e80['once'](_0x7d11('0x2a'),this['handleFetchEnd']['bind'](this));}catch(_0x3a88c9){logger['error'](_0x3a88c9);}}else{this[_0x7d11('0x2')][_0x7d11('0x31')](!![],this[_0x7d11('0x28')][_0x7d11('0x15')](this));}}};EmailImap['prototype'][_0x7d11('0x2f')]=function(_0x1f282b){_0x1f282b['on']('body',this['handleMessageBody'][_0x7d11('0x15')](this));_0x1f282b[_0x7d11('0x10')]('attributes',this[_0x7d11('0x32')]['bind'](this));_0x1f282b['once'](_0x7d11('0x2a'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x7d11('0x17')][_0x7d11('0x33')]=function(_0x1b96d8){simpleParser(_0x1b96d8,{'Iconv':Iconv},this[_0x7d11('0x34')][_0x7d11('0x15')](this));};EmailImap[_0x7d11('0x17')][_0x7d11('0x32')]=function(){};EmailImap[_0x7d11('0x17')][_0x7d11('0x35')]=function(){};EmailImap[_0x7d11('0x17')][_0x7d11('0x34')]=function(_0x779731,_0x5d2305){if(_0x779731){logger[_0x7d11('0x14')](_0x779731);}else{var _0x49d16b=this;utils[_0x7d11('0x36')](this[_0x7d11('0xf')],_0x5d2305,function(_0x36be62){_0x49d16b[_0x7d11('0x37')]('email',_0x36be62);});}};EmailImap[_0x7d11('0x17')][_0x7d11('0x38')]=function(){this[_0x7d11('0x2')][_0x7d11('0x31')](!![],this['handleCloseBox'][_0x7d11('0x15')](this));};EmailImap['prototype'][_0x7d11('0x30')]=function(_0x4d89c3){this[_0x7d11('0x29')](_0x4d89c3);this[_0x7d11('0x2')][_0x7d11('0x31')](!![],this[_0x7d11('0x28')]['bind'](this));};EmailImap['prototype'][_0x7d11('0x13')]=function(){this[_0x7d11('0x37')]('end');};EmailImap[_0x7d11('0x17')][_0x7d11('0x29')]=function(_0x3563e7,_0x77e1e8){logger[_0x7d11('0x14')](_0x7d11('0x29'),this['account'][_0x7d11('0xb')],JSON['stringify'](_0x3563e7));var _0x2f4a76='';if(_0x3563e7){if(_0x3563e7[_0x7d11('0x39')]){_0x2f4a76=_0x3563e7[_0x7d11('0x39')];}else{for(var _0x3c5491 in _0x3563e7){if(_0x3563e7[_0x7d11('0x3a')](_0x3c5491)){_0x2f4a76+=_[_0x7d11('0x3b')](_0x3c5491)+':\x20'+_0x3563e7[_0x3c5491]+'\x0a';}}}}if(_0x77e1e8){this['imap']['end']();}else{this['emit'](_0x7d11('0x14'),_0x2f4a76);this[_0x7d11('0x37')](_0x7d11('0x2a'));}};module[_0x7d11('0x3c')]=EmailImap; \ No newline at end of file +var _0xa9fc=['handleMessageBody','handleSimpleParser','email','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','EventEmitter','./utils','mailbox','account','getAccount','once','ready','bind','end','handleError','connect','inherits','prototype','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','handleCloseBox','attributes','handleMessageAttributes','handleMessageEnd'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xa9fc,0x19f));var _0xca9f=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xa9fc[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var Imap=require(_0xca9f('0x2'));var simpleParser=require(_0xca9f('0x3'))[_0xca9f('0x4')];var Iconv=require('iconv')[_0xca9f('0x5')];var EventEmitter=require('events')[_0xca9f('0x6')];var utils=require(_0xca9f('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x5c7268,_0x234d90){this['mailbox']=_0x5c7268[_0xca9f('0x8')];this[_0xca9f('0x9')]=this[_0xca9f('0xa')](_0x5c7268,_0x234d90);this[_0xca9f('0x2')]=new Imap(this[_0xca9f('0x9')]);this[_0xca9f('0x2')][_0xca9f('0xb')](_0xca9f('0xc'),this['handleReady'][_0xca9f('0xd')](this));this[_0xca9f('0x2')][_0xca9f('0xb')](_0xca9f('0xe'),this['handleEnd'][_0xca9f('0xd')](this));this[_0xca9f('0x2')]['on']('error',this[_0xca9f('0xf')][_0xca9f('0xd')](this));this[_0xca9f('0x2')][_0xca9f('0x10')]();}util[_0xca9f('0x11')](EmailImap,EventEmitter);EmailImap[_0xca9f('0x12')][_0xca9f('0xa')]=function(_0x2cb6f4,_0x33f8c7){var _0x864d21={'connTimeout':_0x2cb6f4['connTimeout']?_0x2cb6f4['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2cb6f4[_0xca9f('0x13')]?_0x2cb6f4['authTimeout']*0x3e8:0x1388};if(_0x2cb6f4['service']){_0x864d21[_0xca9f('0x14')]=_0x2cb6f4[_0xca9f('0x14')];_0x864d21['email']=_0x33f8c7||_0x2cb6f4[_0xca9f('0x14')]||'anonymous@xcally.com';if(_0x2cb6f4[_0xca9f('0x15')]){_0x864d21['xoauth2']=utils[_0xca9f('0x16')](_0x2cb6f4[_0xca9f('0x17')][_0xca9f('0x18')],_0x2cb6f4[_0xca9f('0x14')]);}else{_0x864d21[_0xca9f('0x19')]=_0x2cb6f4['password'];}}else{if(_0x2cb6f4[_0xca9f('0x1a')]){_0x864d21['user']=_0x2cb6f4[_0xca9f('0x14')];_0x864d21[_0xca9f('0x19')]=_0x2cb6f4[_0xca9f('0x19')];}}_0x864d21[_0xca9f('0x1b')]=_0x2cb6f4[_0xca9f('0x1b')];_0x864d21['port']=_0x2cb6f4[_0xca9f('0x1c')]||0x3e1;if(_0x2cb6f4[_0xca9f('0x1d')]){_0x864d21[_0xca9f('0x1d')]=!![];}else{_0x864d21[_0xca9f('0x1d')]=![];_0x864d21[_0xca9f('0x1e')]='required';}return _0x864d21;};EmailImap['prototype'][_0xca9f('0x1f')]=function(){this[_0xca9f('0x2')][_0xca9f('0x20')](this[_0xca9f('0x8')],![],this[_0xca9f('0x21')]['bind'](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x21')]=function(_0x46a0e8,_0x4d64eb){if(_0x46a0e8){this[_0xca9f('0xf')](_0x46a0e8,!![]);}else{this[_0xca9f('0x22')](_0xca9f('0x23'),_0x4d64eb);this[_0xca9f('0x24')]();}};EmailImap[_0xca9f('0x12')]['handleCloseBox']=function(_0xa5f9bc){if(_0xa5f9bc){this[_0xca9f('0xf')](_0xa5f9bc,!![]);}else{this[_0xca9f('0x2')][_0xca9f('0xe')]();}};EmailImap[_0xca9f('0x12')]['readUnseen']=function(){this['imap'][_0xca9f('0x25')](['UNSEEN'],this[_0xca9f('0x26')][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x26')]=function(_0x5a270a,_0x596703){if(_0x5a270a){this[_0xca9f('0xf')](_0x5a270a,!![]);}else{if(_0x596703['length']){try{var _0x26b33d=this['imap'][_0xca9f('0x27')](_0x596703,{'bodies':'','markSeen':!![]});_0x26b33d['on'](_0xca9f('0x28'),this[_0xca9f('0x29')][_0xca9f('0xd')](this));_0x26b33d[_0xca9f('0xb')](_0xca9f('0x2a'),this['handleFetchError']['bind'](this));_0x26b33d[_0xca9f('0xb')]('end',this[_0xca9f('0x2b')][_0xca9f('0xd')](this));}catch(_0x2c2d98){logger['error'](_0x2c2d98);}}else{this['imap'][_0xca9f('0x2c')](!![],this[_0xca9f('0x2d')][_0xca9f('0xd')](this));}}};EmailImap['prototype'][_0xca9f('0x29')]=function(_0xb0fd80){_0xb0fd80['on']('body',this['handleMessageBody'][_0xca9f('0xd')](this));_0xb0fd80[_0xca9f('0xb')](_0xca9f('0x2e'),this[_0xca9f('0x2f')][_0xca9f('0xd')](this));_0xb0fd80[_0xca9f('0xb')](_0xca9f('0xe'),this[_0xca9f('0x30')][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x31')]=function(_0x46339a){simpleParser(_0x46339a,{'Iconv':Iconv},this[_0xca9f('0x32')]['bind'](this));};EmailImap[_0xca9f('0x12')]['handleMessageAttributes']=function(){};EmailImap[_0xca9f('0x12')][_0xca9f('0x30')]=function(){};EmailImap['prototype'][_0xca9f('0x32')]=function(_0xa06d9f,_0x244db6){if(_0xa06d9f){logger[_0xca9f('0x2a')](_0xa06d9f);}else{var _0x2644bf=this;utils['parser'](this['account'],_0x244db6,function(_0x4b5da3){_0x2644bf[_0xca9f('0x22')](_0xca9f('0x33'),_0x4b5da3);});}};EmailImap[_0xca9f('0x12')]['handleFetchEnd']=function(){this[_0xca9f('0x2')][_0xca9f('0x2c')](!![],this['handleCloseBox'][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')]['handleFetchError']=function(_0x29ae50){this[_0xca9f('0xf')](_0x29ae50);this[_0xca9f('0x2')][_0xca9f('0x2c')](!![],this[_0xca9f('0x2d')]['bind'](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x34')]=function(){this['emit'](_0xca9f('0xe'));};EmailImap[_0xca9f('0x12')][_0xca9f('0xf')]=function(_0xaaf496,_0x29d300){logger[_0xca9f('0x2a')](_0xca9f('0xf'),this[_0xca9f('0x9')][_0xca9f('0x33')],JSON[_0xca9f('0x35')](_0xaaf496));var _0x2bc911='';if(_0xaaf496){if(_0xaaf496[_0xca9f('0x36')]){_0x2bc911=_0xaaf496['textCode'];}else{for(var _0x185b82 in _0xaaf496){if(_0xaaf496[_0xca9f('0x37')](_0x185b82)){_0x2bc911+=_[_0xca9f('0x38')](_0x185b82)+':\x20'+_0xaaf496[_0x185b82]+'\x0a';}}}}if(_0x29d300){this[_0xca9f('0x2')][_0xca9f('0xe')]();}else{this['emit']('error',_0x2bc911);this[_0xca9f('0x22')]('end');}};module[_0xca9f('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index a18132e..9a223b6 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 _0x99b5=['exports','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport'];(function(_0x6c0189,_0x191374){var _0x4ef60b=function(_0x4bacfe){while(--_0x4bacfe){_0x6c0189['push'](_0x6c0189['shift']());}};_0x4ef60b(++_0x191374);}(_0x99b5,0x10f));var _0x599b=function(_0x346960,_0x1a843c){_0x346960=_0x346960-0x0;var _0x3fef3c=_0x99b5[_0x346960];return _0x3fef3c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x599b('0x0'));function EmailSmtp(){}EmailSmtp[_0x599b('0x1')][_0x599b('0x2')]=function(_0x1ca431,_0x4278dc){return new Promise(function(_0x1b463b,_0x761cd0){var _0x2ef9f0=nodemailer['createTransport'](_0x1ca431);_0x2ef9f0[_0x599b('0x3')](_0x599b('0x4'),inlineBase64());_0x2ef9f0[_0x599b('0x5')](_0x4278dc,function(_0x2f8d06,_0x246e38){if(_0x2f8d06){_0x761cd0(_0x2f8d06[_0x599b('0x6')]());}else{_0x1b463b(_0x246e38);}});});};EmailSmtp[_0x599b('0x1')][_0x599b('0x7')]=function(_0x455f44){return new Promise(function(_0x32b749,_0x555c03){var _0x28dfb4=nodemailer[_0x599b('0x8')](_0x455f44);_0x28dfb4['verify'](function(_0x5571a9,_0x5915f2){if(_0x5571a9){_0x555c03(_0x5571a9['toString']());}else{if(_0x5915f2){_0x32b749(_0x5915f2);}else{_0x555c03('Not\x20verifired');}}});});};module[_0x599b('0x9')]=EmailSmtp; \ No newline at end of file +var _0x5974=['nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x5bde03,_0x1c4f8b){var _0xd64357=function(_0xcfa127){while(--_0xcfa127){_0x5bde03['push'](_0x5bde03['shift']());}};_0xd64357(++_0x1c4f8b);}(_0x5974,0x1dc));var _0x4597=function(_0x4cbde1,_0x5785ec){_0x4cbde1=_0x4cbde1-0x0;var _0x37d42=_0x5974[_0x4cbde1];return _0x37d42;};'use strict';var nodemailer=require(_0x4597('0x0'));var inlineBase64=require(_0x4597('0x1'));function EmailSmtp(){}EmailSmtp[_0x4597('0x2')][_0x4597('0x3')]=function(_0x320586,_0x328b3f){return new Promise(function(_0x2c56d9,_0x44d33c){var _0x14d8b1=nodemailer[_0x4597('0x4')](_0x320586);_0x14d8b1['use']('compile',inlineBase64());_0x14d8b1['sendMail'](_0x328b3f,function(_0x42b180,_0x5b71a1){if(_0x42b180){_0x44d33c(_0x42b180[_0x4597('0x5')]());}else{_0x2c56d9(_0x5b71a1);}});});};EmailSmtp[_0x4597('0x2')][_0x4597('0x6')]=function(_0x97c17b){return new Promise(function(_0x134f29,_0xe6c4ef){var _0x5f5dab=nodemailer[_0x4597('0x4')](_0x97c17b);_0x5f5dab[_0x4597('0x6')](function(_0x3f624c,_0x17ee5c){if(_0x3f624c){_0xe6c4ef(_0x3f624c['toString']());}else{if(_0x17ee5c){_0x134f29(_0x17ee5c);}else{_0xe6c4ef(_0x4597('0x7'));}}});});};module[_0x4597('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6338975..532162e 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 _0xd3ba=['\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','Anonymous','length','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20'];(function(_0x44638b,_0x21d816){var _0x34b05a=function(_0x1b6f6e){while(--_0x1b6f6e){_0x44638b['push'](_0x44638b['shift']());}};_0x34b05a(++_0x21d816);}(_0xd3ba,0x13a));var _0xad3b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd3ba[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xad3b('0x0'));var moment=require(_0xad3b('0x1'));var random=require(_0xad3b('0x2'));var fs=require('fs');var path=require(_0xad3b('0x3'));var util=require(_0xad3b('0x4'));var tnef=require(_0xad3b('0x5'));var logger=require(_0xad3b('0x6'))(_0xad3b('0x7'));var config=require(_0xad3b('0x8'));function getAddress(_0x204a00){var _0xcb26ec=_[_0xad3b('0x9')](_0x204a00[_0xad3b('0xa')]);return _0xcb26ec&&_0xcb26ec['address']?_0xcb26ec[_0xad3b('0xb')]:_0xad3b('0xc')+random[_0xad3b('0xd')](0x6)+_0xad3b('0xe');}function getFirstName(_0x1358c8){var _0x3ec85d=_[_0xad3b('0x9')](_0x1358c8[_0xad3b('0xa')]);if(_0x3ec85d&&_0x3ec85d['name']){if(_0x3ec85d[_0xad3b('0xf')]==_0x3ec85d[_0xad3b('0xb')]){return _0x3ec85d[_0xad3b('0xf')][_0xad3b('0x10')](0x0,_0x3ec85d[_0xad3b('0xf')][_0xad3b('0x11')]('@'));}var _0x2239af=_0x3ec85d['name'][_0xad3b('0x12')](/\s+/);return _0x2239af['length']>0x1?_0x2239af['slice'](0x0,-0x1)[_0xad3b('0x13')]('\x20'):_0x3ec85d[_0xad3b('0xf')];}return _0xad3b('0x14');}function getLastName(_0x1203f5){var _0x19c2e6=_[_0xad3b('0x9')](_0x1203f5['value']);if(_0x19c2e6&&_0x19c2e6[_0xad3b('0xf')]){var _0x420021=_0x19c2e6[_0xad3b('0xf')]['split'](/\s+/);return _0x420021[_0xad3b('0x15')]>0x1?_0x420021[_0xad3b('0x16')]():'';}return'';}function getMails(_0x4bd4cc,_0x3c7752){var _0x3b9185='';for(var _0x52b479=0x0;_0x52b479<_0x3c7752['value'][_0xad3b('0x15')];_0x52b479+=0x1){if(_0x3c7752[_0xad3b('0xa')][_0x52b479]['address']!==_0x4bd4cc){if(!_[_0xad3b('0x17')](_0x3b9185)){_0x3b9185+=',';}_0x3b9185+=_0x3c7752[_0xad3b('0xa')][_0x52b479][_0xad3b('0xf')]||_0x3c7752[_0xad3b('0xa')][_0x52b479]['address']||'';_0x3b9185+='\x20<';_0x3b9185+=_0x3c7752['value'][_0x52b479][_0xad3b('0xb')]?_0x3c7752['value'][_0x52b479][_0xad3b('0xb')]:_0xad3b('0xc')+random[_0xad3b('0xd')](0x6)+_0xad3b('0xe');_0x3b9185+='>';}}return _0x3b9185;}function parseEmail(_0x17716c,_0x47b9a7,_0x4dc5a1){if(_0x47b9a7[_0xad3b('0x18')]){var _0x1fa414=/)<[^<]*)*<\/script>/gi;while(_0x1fa414[_0xad3b('0x19')](_0x47b9a7[_0xad3b('0x18')])){_0x47b9a7['html']=_0x47b9a7['html'][_0xad3b('0x1a')](_0x1fa414,'');}if(_0x47b9a7[_0xad3b('0x18')][_0xad3b('0x1b')](_0xad3b('0x1c'))){var _0x2c7963=[];_0x47b9a7[_0xad3b('0x1d')][_0xad3b('0x1e')](_0x409bfc=>{_0x2c7963[_0xad3b('0x1f')](_0x409bfc[_0xad3b('0x20')]);});var _0x233d8a=/]+>/g;var _0x1f9b35=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2d14e4=_0x47b9a7[_0xad3b('0x18')][_0xad3b('0x1a')](_0x1f9b35,_0xad3b('0x21'));var _0x5c528d=_0x2d14e4['replace'](_0x233d8a,'_IMG');for(let _0x5961ab=0x0;_0x5961ab<_0x2c7963[_0xad3b('0x15')];_0x5961ab++){var _0xec43ed=_0x5c528d[_0xad3b('0x1a')](_0xad3b('0x22'),_0xad3b('0x23')+_0x2c7963[_0x5961ab]+_0xad3b('0x24'));_0x5c528d=_0xec43ed;}_0x47b9a7[_0xad3b('0x18')]=_0x5c528d;}_0x4dc5a1[_0xad3b('0x25')]=_0x47b9a7['html'];}else{_0x4dc5a1['body']=_0x47b9a7[_0xad3b('0x26')];}if(_0x4dc5a1[_0xad3b('0x25')]){_0x4dc5a1[_0xad3b('0x25')]=_0x4dc5a1[_0xad3b('0x25')][_0xad3b('0x1a')](/0x0){var _0x490572=[_0xad3b('0x32'),_0xad3b('0x33'),_0xad3b('0x34')];for(var _0x543352=0x0;_0x543352<_0x47b9a7[_0xad3b('0x35')][_0xad3b('0x15')];_0x543352++){var _0xc969a3=_[_0xad3b('0x11')](_0x490572,_0x47b9a7[_0xad3b('0x35')][_0x543352][_0xad3b('0x36')]);if(_0xc969a3>=0x0){_0x4dc5a1[_0xad3b('0x37')]=!![];}}}return _0x4dc5a1;}exports[_0xad3b('0x38')]=function(_0x4711fe,_0xa82a0f,_0x2c7e33){var _0x3a4d14={'from':getAddress(_0xa82a0f[_0xad3b('0x39')]),'firstName':getFirstName(_0xa82a0f[_0xad3b('0x39')]),'lastName':getLastName(_0xa82a0f[_0xad3b('0x39')]),'mapKey':'email','message':{'from':getMails(_0x4711fe[_0xad3b('0x7')],_0xa82a0f[_0xad3b('0x39')]),'to':_0x4711fe[_0xad3b('0x7')],'cc':'','subject':_0xa82a0f['subject']||'','messageId':_0xa82a0f['messageId'],'inReplyTo':_0xa82a0f['inReplyTo'],'sentAt':moment(_0xa82a0f[_0xad3b('0x3a')])['format'](_0xad3b('0x3b')),'attach':![],'attachments':[]}};if(!_0xa82a0f[_0xad3b('0x18')]&&!_0xa82a0f[_0xad3b('0x26')]){var _0x36bc78=_[_0xad3b('0x3c')](_0xa82a0f['attachments'],{'contentType':_0xad3b('0x3d')});if(_0x36bc78[_0xad3b('0x15')]){logger['info'](util[_0xad3b('0x2f')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xa82a0f['messageId']));tnef[_0xad3b('0x3e')](_[_0xad3b('0x3f')](_0x36bc78)['content'],function(_0x56359d,_0x2b169e){if(_0x2b169e){_0xa82a0f[_0xad3b('0x18')]=_0x2b169e[_0xad3b('0x40')]||_0xad3b('0x41');if(_0x2b169e[_0xad3b('0x42')]){for(var _0x122aa2=0x0;_0x122aa2<_0x2b169e['Attachments'][_0xad3b('0x15')];_0x122aa2++){var _0xc5f74e=_0x2b169e[_0xad3b('0x42')][_0x122aa2];_0x3a4d14[_0xad3b('0x28')]['attachments']['push']({'filename':_0xc5f74e[_0xad3b('0x43')],'content':Buffer[_0xad3b('0x39')](_0xc5f74e['Data'])});}}}_0x2c7e33(parseEmail(_0x4711fe,_0xa82a0f,_0x3a4d14));});}else{_0xa82a0f[_0xad3b('0x18')]='

Empty\x20message

';_0x2c7e33(parseEmail(_0x4711fe,_0xa82a0f,_0x3a4d14));}}else{_0x2c7e33(parseEmail(_0x4711fe,_0xa82a0f,_0x3a4d14));}};exports['generateXOAuth2Token']=function(_0xfa62cf,_0x1de35d){var _0x28be00=['user='+(_0x1de35d||''),'auth=Bearer\x20'+_0xfa62cf,'',''];return Buffer[_0xad3b('0x39')](_0x28be00['join'](''),_0xad3b('0x44'))['toString'](_0xad3b('0x45'));}; \ No newline at end of file +var _0x221f=['headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','inReplyTo','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','email','value','address','generate','head','name','substring','indexOf','length','slice','join','Anonymous','split','pop','isEmpty','@xcally.com','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5bf17b[_0xf221('0xe')](0x0,-0x1)[_0xf221('0xf')]('\x20'):_0x4a57f7[_0xf221('0xa')];}return _0xf221('0x10');}function getLastName(_0x34068b){var _0x572dd9=_[_0xf221('0x9')](_0x34068b[_0xf221('0x6')]);if(_0x572dd9&&_0x572dd9[_0xf221('0xa')]){var _0x1a31f3=_0x572dd9[_0xf221('0xa')][_0xf221('0x11')](/\s+/);return _0x1a31f3['length']>0x1?_0x1a31f3[_0xf221('0x12')]():'';}return'';}function getMails(_0x40d475,_0x3f207f){var _0x3f8dd3='';for(var _0x1720dc=0x0;_0x1720dc<_0x3f207f[_0xf221('0x6')][_0xf221('0xd')];_0x1720dc+=0x1){if(_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]!==_0x40d475){if(!_[_0xf221('0x13')](_0x3f8dd3)){_0x3f8dd3+=',';}_0x3f8dd3+=_0x3f207f['value'][_0x1720dc][_0xf221('0xa')]||_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]||'';_0x3f8dd3+='\x20<';_0x3f8dd3+=_0x3f207f[_0xf221('0x6')][_0x1720dc]['address']?_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]:'anonymous'+random[_0xf221('0x8')](0x6)+_0xf221('0x14');_0x3f8dd3+='>';}}return _0x3f8dd3;}function parseEmail(_0x3ec196,_0x338954,_0x536850){if(_0x338954[_0xf221('0x15')]){var _0x232e01=/)<[^<]*)*<\/script>/gi;while(_0x232e01['test'](_0x338954['html'])){_0x338954[_0xf221('0x15')]=_0x338954[_0xf221('0x15')][_0xf221('0x16')](_0x232e01,'');}if(_0x338954[_0xf221('0x15')][_0xf221('0x17')]('{_0x46a275[_0xf221('0x1a')](_0x1fef75[_0xf221('0x1b')]);});var _0x1e5926=/]+>/g;var _0xed98af=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x488475=_0x338954[_0xf221('0x15')][_0xf221('0x16')](_0xed98af,_0xf221('0x1c'));var _0x1b1898=_0x488475['replace'](_0x1e5926,'_IMG');for(let _0x22b12c=0x0;_0x22b12c<_0x46a275[_0xf221('0xd')];_0x22b12c++){var _0x16b563=_0x1b1898[_0xf221('0x16')](_0xf221('0x1d'),_0xf221('0x1e')+_0x46a275[_0x22b12c]+_0xf221('0x1f'));_0x1b1898=_0x16b563;}_0x338954[_0xf221('0x15')]=_0x1b1898;}_0x536850[_0xf221('0x20')]=_0x338954[_0xf221('0x15')];}else{_0x536850[_0xf221('0x20')]=_0x338954[_0xf221('0x21')];}if(_0x536850[_0xf221('0x20')]){_0x536850[_0xf221('0x20')]=_0x536850[_0xf221('0x20')][_0xf221('0x16')](/0x0){var _0x38c18d=[_0xf221('0x30'),_0xf221('0x31'),_0xf221('0x32')];for(var _0x95a6ef=0x0;_0x95a6ef<_0x338954[_0xf221('0x2f')][_0xf221('0xd')];_0x95a6ef++){var _0x54e423=_[_0xf221('0xc')](_0x38c18d,_0x338954['headerLines'][_0x95a6ef][_0xf221('0x33')]);if(_0x54e423>=0x0){_0x536850[_0xf221('0x34')]=!![];}}}return _0x536850;}exports['parser']=function(_0x14de18,_0x28726d,_0x81a8e3){var _0x1a92c2={'from':getAddress(_0x28726d['from']),'firstName':getFirstName(_0x28726d['from']),'lastName':getLastName(_0x28726d[_0xf221('0x35')]),'mapKey':_0xf221('0x5'),'message':{'from':getMails(_0x14de18[_0xf221('0x5')],_0x28726d['from']),'to':_0x14de18['email'],'cc':'','subject':_0x28726d[_0xf221('0x36')]||'','messageId':_0x28726d['messageId'],'inReplyTo':_0x28726d[_0xf221('0x37')],'sentAt':moment(_0x28726d['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x28726d[_0xf221('0x15')]&&!_0x28726d[_0xf221('0x21')]){var _0x86bc90=_['filter'](_0x28726d['attachments'],{'contentType':_0xf221('0x38')});if(_0x86bc90['length']){logger[_0xf221('0x39')](util[_0xf221('0x29')](_0xf221('0x3a'),_0x28726d[_0xf221('0x3b')]));tnef[_0xf221('0x3c')](_[_0xf221('0x3d')](_0x86bc90)['content'],function(_0x420e14,_0x49aff8){if(_0x49aff8){_0x28726d['html']=_0x49aff8[_0xf221('0x3e')]||_0xf221('0x3f');if(_0x49aff8[_0xf221('0x40')]){for(var _0x587242=0x0;_0x587242<_0x49aff8['Attachments']['length'];_0x587242++){var _0x871477=_0x49aff8[_0xf221('0x40')][_0x587242];_0x1a92c2['message'][_0xf221('0x18')][_0xf221('0x1a')]({'filename':_0x871477[_0xf221('0x41')],'content':Buffer[_0xf221('0x35')](_0x871477[_0xf221('0x42')])});}}}_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));});}else{_0x28726d[_0xf221('0x15')]=_0xf221('0x3f');_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));}}else{_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));}};exports['generateXOAuth2Token']=function(_0x555271,_0x2b159e){var _0x57b4eb=[_0xf221('0x43')+(_0x2b159e||''),'auth=Bearer\x20'+_0x555271,'',''];return Buffer[_0xf221('0x35')](_0x57b4eb[_0xf221('0xf')](''),_0xf221('0x44'))[_0xf221('0x45')](_0xf221('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a685e14..13ce2a1 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 _0x9418=['SERV','active','Smtp','exports','lodash','name','Service','key'];(function(_0x223d68,_0x47d455){var _0x92add9=function(_0x3541ef){while(--_0x3541ef){_0x223d68['push'](_0x223d68['shift']());}};_0x92add9(++_0x47d455);}(_0x9418,0xec));var _0x8941=function(_0x4089c7,_0x120195){_0x4089c7=_0x4089c7-0x0;var _0x33dd04=_0x9418[_0x4089c7];return _0x33dd04;};'use strict';var _=require(_0x8941('0x0'));function MailAccount(_0xf9ae11){this['id']=_0xf9ae11['id']||0x0;this[_0x8941('0x1')]=_0xf9ae11[_0x8941('0x1')]||_0x8941('0x2');this[_0x8941('0x3')]=_0xf9ae11['key']||_0x8941('0x4');this[_0x8941('0x5')]=_0xf9ae11[_0x8941('0x5')]||![];this['Imap']=_0xf9ae11['Imap']||[];this[_0x8941('0x6')]=_0xf9ae11[_0x8941('0x6')]||[];}module[_0x8941('0x7')]=MailAccount; \ No newline at end of file +var _0xbc8f=['lodash','name','Service','key','active','Imap','Smtp'];(function(_0x4d96e7,_0x2dc0dc){var _0x51166a=function(_0xe9a33d){while(--_0xe9a33d){_0x4d96e7['push'](_0x4d96e7['shift']());}};_0x51166a(++_0x2dc0dc);}(_0xbc8f,0xf5));var _0xfbc8=function(_0x354cf3,_0x59ed03){_0x354cf3=_0x354cf3-0x0;var _0x2c4856=_0xbc8f[_0x354cf3];return _0x2c4856;};'use strict';var _=require(_0xfbc8('0x0'));function MailAccount(_0x40c349){this['id']=_0x40c349['id']||0x0;this[_0xfbc8('0x1')]=_0x40c349[_0xfbc8('0x1')]||_0xfbc8('0x2');this[_0xfbc8('0x3')]=_0x40c349[_0xfbc8('0x3')]||'SERV';this[_0xfbc8('0x4')]=_0x40c349[_0xfbc8('0x4')]||![];this[_0xfbc8('0x5')]=_0x40c349[_0xfbc8('0x5')]||[];this[_0xfbc8('0x6')]=_0x40c349['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 612c8e9..44bb80e 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 _0x06e5=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x06e5,0x1a9));var _0x506e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x06e5[_0x32d457];return _0x338386;};'use strict';var _=require(_0x506e('0x0'));var MailAccount=require(_0x506e('0x1'));var Realtime=function(){this[_0x506e('0x2')]={};};function freeIsNotKey(_0x344b76,_0x28369c,_0x56e8aa){var _0xfd230d=_['mapKeys'](_0x344b76,function(_0x3e91e1,_0x17452d){return _0x3e91e1[_0x56e8aa];});for(var _0x15cb61 in _0x28369c){if(_0x28369c[_0x506e('0x3')](_0x15cb61)){if(!_0xfd230d[_0x15cb61]){delete _0x28369c[_0x15cb61];}}}}Realtime[_0x506e('0x4')][_0x506e('0x5')]=function(_0x514ed4,_0x485351){for(var _0x2f4627 in _0x485351){if(_0x514ed4['hasOwnProperty'](_0x2f4627)){_0x514ed4[_0x2f4627]=_0x485351[_0x2f4627];}}};Realtime['prototype'][_0x506e('0x6')]=function(){var _0x34c369=this;return function(_0x1640c1){if(_0x1640c1){freeIsNotKey(_0x1640c1,_0x34c369[_0x506e('0x2')],'id');for(var _0x3d93c3=0x0,_0x36419e={},_0x852c1e={};_0x3d93c3<_0x1640c1[_0x506e('0x7')];_0x3d93c3+=0x1){_0x36419e=_0x1640c1[_0x3d93c3];if(_[_0x506e('0x8')](_0x34c369[_0x506e('0x2')][_0x36419e['id']])){_0x34c369[_0x506e('0x2')][_0x36419e['id']]=new MailAccount(_0x36419e);}else{_[_0x506e('0x9')](_0x34c369['mailAccounts'][_0x36419e['id']],_0x36419e);}}}return _0x34c369['mailAccounts'];};};module[_0x506e('0xa')]=Realtime; \ No newline at end of file +var _0x45fa=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x45fa,0xa3));var _0xa45f=function(_0x43ae31,_0x4465a1){_0x43ae31=_0x43ae31-0x0;var _0x34891b=_0x45fa[_0x43ae31];return _0x34891b;};'use strict';var _=require(_0xa45f('0x0'));var MailAccount=require(_0xa45f('0x1'));var Realtime=function(){this[_0xa45f('0x2')]={};};function freeIsNotKey(_0x3b91bd,_0x34be1d,_0x544cf4){var _0xcfd4a4=_[_0xa45f('0x3')](_0x3b91bd,function(_0x57ec9f,_0xa84f87){return _0x57ec9f[_0x544cf4];});for(var _0x57e91a in _0x34be1d){if(_0x34be1d[_0xa45f('0x4')](_0x57e91a)){if(!_0xcfd4a4[_0x57e91a]){delete _0x34be1d[_0x57e91a];}}}}Realtime[_0xa45f('0x5')][_0xa45f('0x6')]=function(_0x56411f,_0x390594){for(var _0x304bf9 in _0x390594){if(_0x56411f['hasOwnProperty'](_0x304bf9)){_0x56411f[_0x304bf9]=_0x390594[_0x304bf9];}}};Realtime[_0xa45f('0x5')]['initMailAccounts']=function(){var _0x924138=this;return function(_0x4436ae){if(_0x4436ae){freeIsNotKey(_0x4436ae,_0x924138[_0xa45f('0x2')],'id');for(var _0x5c8991=0x0,_0x552f09={},_0x21c07e={};_0x5c8991<_0x4436ae[_0xa45f('0x7')];_0x5c8991+=0x1){_0x552f09=_0x4436ae[_0x5c8991];if(_[_0xa45f('0x8')](_0x924138[_0xa45f('0x2')][_0x552f09['id']])){_0x924138[_0xa45f('0x2')][_0x552f09['id']]=new MailAccount(_0x552f09);}else{_[_0xa45f('0x9')](_0x924138['mailAccounts'][_0x552f09['id']],_0x552f09);}}}return _0x924138[_0xa45f('0x2')];};};module[_0xa45f('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index af9dd27..245b375 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 _0xbbd7=['active','key','ListId','TemplateId','MailServerIn','CloudProvider','name','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','service','email'];(function(_0x49d3f0,_0x288092){var _0x198efc=function(_0x1592fc){while(--_0x1592fc){_0x49d3f0['push'](_0x49d3f0['shift']());}};_0x198efc(++_0x288092);}(_0xbbd7,0x8c));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x7bbd('0x0')]=function(){return function(){return client[_0x7bbd('0x1')]('GetMailAccount',{'options':{'attributes':['id','name','provider',_0x7bbd('0x2'),_0x7bbd('0x3'),_0x7bbd('0x4'),_0x7bbd('0x5'),_0x7bbd('0x6'),_0x7bbd('0x7')],'raw':![],'include':[{'model':_0x7bbd('0x8'),'as':'Imap','include':[{'model':_0x7bbd('0x9'),'attributes':['id',_0x7bbd('0xa'),_0x7bbd('0x2'),_0x7bbd('0xb'),'data5'],'as':'CloudProvider'}]},{'model':_0x7bbd('0xc'),'as':_0x7bbd('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0x7bbd('0xa'),_0x7bbd('0x2'),'type',_0x7bbd('0xe')],'as':_0x7bbd('0x9')}]}]},'log':_0x7bbd('0xf')});};};exports[_0x7bbd('0x10')]=function(_0x3e5c6a,_0x4325d0){return client['Request']('NotifyMailAccount',{'account':{'id':_0x3e5c6a},'body':_0x4325d0,'log':_0x7bbd('0x11')});}; \ No newline at end of file +var _0x5cd5=['active','key','ListId','Imap','type','data5','MailServerOut','CloudProvider','notify','../client','getMailAccounts','Request','GetMailAccount','name','service','email'];(function(_0x1b4cd6,_0x5f3733){var _0x1b10f9=function(_0x15b45b){while(--_0x15b45b){_0x1b4cd6['push'](_0x1b4cd6['shift']());}};_0x1b10f9(++_0x5f3733);}(_0x5cd5,0x149));var _0x55cd=function(_0x212228,_0x44d0d3){_0x212228=_0x212228-0x0;var _0x502230=_0x5cd5[_0x212228];return _0x502230;};'use strict';var client=require(_0x55cd('0x0'));exports[_0x55cd('0x1')]=function(){return function(){return client[_0x55cd('0x2')](_0x55cd('0x3'),{'options':{'attributes':['id',_0x55cd('0x4'),'provider',_0x55cd('0x5'),_0x55cd('0x6'),_0x55cd('0x7'),_0x55cd('0x8'),_0x55cd('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x55cd('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x55cd('0x4'),_0x55cd('0x5'),_0x55cd('0xb'),_0x55cd('0xc')],'as':'CloudProvider'}]},{'model':_0x55cd('0xd'),'as':'Smtp','include':[{'model':_0x55cd('0xe'),'attributes':['id',_0x55cd('0x4'),'service',_0x55cd('0xb'),_0x55cd('0xc')],'as':_0x55cd('0xe')}]}]},'log':'getMailAccount'});};};exports[_0x55cd('0xf')]=function(_0xaae085,_0x5a4d3e){return client[_0x55cd('0x2')]('NotifyMailAccount',{'account':{'id':_0xaae085},'body':_0x5a4d3e,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ef8128f..242f20a 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 _0x87c8=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x13f3a7,_0x234a74){var _0x252746=function(_0x4395bc){while(--_0x4395bc){_0x13f3a7['push'](_0x13f3a7['shift']());}};_0x252746(++_0x234a74);}(_0x87c8,0x17a));var _0x887c=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x87c8[_0x11ce46];return _0x368a1e;};'use strict';var client=require(_0x887c('0x0'));exports[_0x887c('0x1')]=function(){return client[_0x887c('0x2')](_0x887c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x887c('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x8a78=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a78,0x1ae));var _0x88a7=function(_0x2423d7,_0xe6ec57){_0x2423d7=_0x2423d7-0x0;var _0x151d17=_0x8a78[_0x2423d7];return _0x151d17;};'use strict';var client=require(_0x88a7('0x0'));exports[_0x88a7('0x1')]=function(){return client['Request'](_0x88a7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x88a7('0x3')]},'log':_0x88a7('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 08746f3..d6dea78 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 c42177e..83d41d0 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 _0xa90f=['port','socket.io','polling','redis','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa90f,0xc2));var _0xfa90=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0xa90f[_0x171520];return _0x3cc729;};'use strict';var _=require(_0xfa90('0x0'));var http=require(_0xfa90('0x1'));var express=require(_0xfa90('0x2'));var sticky=require(_0xfa90('0x3'));var Redis=require(_0xfa90('0x4'));var config=require(_0xfa90('0x5'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0xfa90('0x6')])){var socketio=require(_0xfa90('0x7'))(server,{'transports':['websocket',_0xfa90('0x8')]});config[_0xfa90('0x9')]=_['defaults'](config[_0xfa90('0x9')],{'host':'localhost','port':0x18eb});socketio[_0xfa90('0xa')](require('socket.io-redis')({'pubClient':new Redis(config[_0xfa90('0x9')]),'subClient':new Redis(config['redis'])}));require(_0xfa90('0xb'))[_0xfa90('0xc')]();require(_0xfa90('0xd'))[_0xfa90('0xc')](socketio);require(_0xfa90('0xe'))[_0xfa90('0xc')](app);require(_0xfa90('0xf'))['default'](app);}else{server[_0xfa90('0x10')]('listening',function(){console[_0xfa90('0x11')](_0xfa90('0x12'),config[_0xfa90('0x6')]);});}exports=module[_0xfa90('0x13')]=app; \ No newline at end of file +var _0x90b9=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x90b9,0x17a));var _0x990b=function(_0x5e5da7,_0x27613f){_0x5e5da7=_0x5e5da7-0x0;var _0x46e66d=_0x90b9[_0x5e5da7];return _0x46e66d;};'use strict';var _=require('lodash');var http=require(_0x990b('0x0'));var express=require('express');var sticky=require(_0x990b('0x1'));var Redis=require('ioredis');var config=require(_0x990b('0x2'));var app=express();var server=http[_0x990b('0x3')](app);server[_0x990b('0x4')]=0xdbba0;if(sticky[_0x990b('0x5')](server,config[_0x990b('0x6')])){var socketio=require(_0x990b('0x7'))(server,{'transports':[_0x990b('0x8'),'polling']});config[_0x990b('0x9')]=_[_0x990b('0xa')](config[_0x990b('0x9')],{'host':_0x990b('0xb'),'port':0x18eb});socketio[_0x990b('0xc')](require(_0x990b('0xd'))({'pubClient':new Redis(config[_0x990b('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x990b('0xe'))[_0x990b('0xf')]();require(_0x990b('0x10'))[_0x990b('0xf')](socketio);require(_0x990b('0x11'))[_0x990b('0xf')](app);require('../../routes')[_0x990b('0xf')](app);}else{server[_0x990b('0x12')](_0x990b('0x13'),function(){console[_0x990b('0x14')](_0x990b('0x15'),config[_0x990b('0x6')]);});}exports=module[_0x990b('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 97f80ee..cbbc631 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 _0x5f60=['result','exports','jayson/promise','../../config/logger','client','http','Request','request','then','debug','routing','error','rpc','message'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x5f60,0x1c2));var _0x05f6=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x5f60[_0xe1269d];return _0x261ca1;};'use strict';var jayson=require(_0x05f6('0x0'));var BPromise=require('bluebird');var logger=require(_0x05f6('0x1'))('routing');var client=jayson[_0x05f6('0x2')][_0x05f6('0x3')]({'port':0x2329});client[_0x05f6('0x4')]=function(_0x51737b,_0x5affc3){return new BPromise(function(_0x2c441a,_0x142375){return client[_0x05f6('0x5')](_0x51737b,_0x5affc3)[_0x05f6('0x6')](function(_0x4ab9ea){logger[_0x05f6('0x7')]('rpc',_0x05f6('0x8'),_0x51737b,_0x5affc3,_0x4ab9ea);if(_0x4ab9ea[_0x05f6('0x9')]){logger[_0x05f6('0x9')](_0x05f6('0xa'),_0x05f6('0x8'),_0x51737b,_0x4ab9ea[_0x05f6('0x9')][_0x05f6('0xb')],_0x5affc3);return _0x142375(_0x4ab9ea[_0x05f6('0x9')][_0x05f6('0xb')]);}else{return _0x2c441a(_0x4ab9ea[_0x05f6('0xc')]);}})['catch'](function(_0x55f7b7){logger['error'](_0x05f6('0xa'),'routing',_0x51737b,_0x55f7b7,_0x5affc3);return _0x142375(_0x55f7b7);});});};module[_0x05f6('0xd')]=client; \ No newline at end of file +var _0x5d59=['Request','request','then','rpc','message','error','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x3c8f6b,_0x5c5156){var _0x2f69f6=function(_0x14b01b){while(--_0x14b01b){_0x3c8f6b['push'](_0x3c8f6b['shift']());}};_0x2f69f6(++_0x5c5156);}(_0x5d59,0x13c));var _0x95d5=function(_0x195223,_0x121404){_0x195223=_0x195223-0x0;var _0x3a62dd=_0x5d59[_0x195223];return _0x3a62dd;};'use strict';var jayson=require(_0x95d5('0x0'));var BPromise=require(_0x95d5('0x1'));var logger=require(_0x95d5('0x2'))(_0x95d5('0x3'));var client=jayson[_0x95d5('0x4')][_0x95d5('0x5')]({'port':0x2329});client[_0x95d5('0x6')]=function(_0x43e1d4,_0x3fb28f){return new BPromise(function(_0xf1fc5d,_0x3f1de1){return client[_0x95d5('0x7')](_0x43e1d4,_0x3fb28f)[_0x95d5('0x8')](function(_0xb8a227){logger['debug'](_0x95d5('0x9'),_0x95d5('0x3'),_0x43e1d4,_0x3fb28f,_0xb8a227);if(_0xb8a227['error']){logger['error']('rpc',_0x95d5('0x3'),_0x43e1d4,_0xb8a227['error'][_0x95d5('0xa')],_0x3fb28f);return _0x3f1de1(_0xb8a227[_0x95d5('0xb')][_0x95d5('0xa')]);}else{return _0xf1fc5d(_0xb8a227['result']);}})[_0x95d5('0xc')](function(_0x485f7a){logger[_0x95d5('0xb')]('rpc',_0x95d5('0x3'),_0x43e1d4,_0x485f7a,_0x3fb28f);return _0x3f1de1(_0x485f7a);});});};module[_0x95d5('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6f01947..ac63d6d 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 _0xf582=['getAgents','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0xcf1cc8,_0x14ce2e){var _0x2009b7=function(_0x238b9e){while(--_0x238b9e){_0xcf1cc8['push'](_0xcf1cc8['shift']());}};_0x2009b7(++_0x14ce2e);}(_0xf582,0x6e));var _0x2f58=function(_0x41e59f,_0x436edf){_0x41e59f=_0x41e59f-0x0;var _0x2c5bcf=_0xf582[_0x41e59f];return _0x2c5bcf;};'use strict';var BPromise=require(_0x2f58('0x0'));var server=require(_0x2f58('0x1'));var Realtime=require(_0x2f58('0x2'));var user=require(_0x2f58('0x3'));var interval=require(_0x2f58('0x4'));var openchannelQueue=require(_0x2f58('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x2f58('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x2f58('0x7'));var whatsappQueue=require(_0x2f58('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2f58('0x9')]()['then'](user[_0x2f58('0xa')]())[_0x2f58('0xb')](realtime['initAgents']())[_0x2f58('0xb')](interval[_0x2f58('0xc')]())[_0x2f58('0xb')](realtime['initIntervals']())[_0x2f58('0xb')](openchannelQueue[_0x2f58('0xd')]())[_0x2f58('0xb')](realtime[_0x2f58('0xe')]())[_0x2f58('0xb')](chatQueue['getChatQueues']())[_0x2f58('0xb')](realtime[_0x2f58('0xf')]())[_0x2f58('0xb')](smsQueue[_0x2f58('0x10')]())[_0x2f58('0xb')](realtime[_0x2f58('0x11')]())[_0x2f58('0xb')](mailQueue['getMailQueues']())[_0x2f58('0xb')](realtime[_0x2f58('0x12')]())[_0x2f58('0xb')](faxQueue[_0x2f58('0x13')]())[_0x2f58('0xb')](realtime[_0x2f58('0x14')]())[_0x2f58('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x2f58('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0x2f58('0x16')](realtime)['then'](function(_0x4c4a9c){return initRealtime();})[_0x2f58('0xb')](function(_0xb046b0){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4b1054){console[_0x2f58('0x17')](_0x4b1054);});}main(); \ No newline at end of file +var _0xb57b=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval'];(function(_0x369c66,_0x12b66f){var _0x1ed4ca=function(_0x5061e0){while(--_0x5061e0){_0x369c66['push'](_0x369c66['shift']());}};_0x1ed4ca(++_0x12b66f);}(_0xb57b,0xab));var _0xbb57=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb57b[_0x2763f2];return _0x3ef471;};'use strict';var BPromise=require(_0xbb57('0x0'));var server=require(_0xbb57('0x1'));var Realtime=require('./realtime');var user=require(_0xbb57('0x2'));var interval=require(_0xbb57('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbb57('0x4'));var mailQueue=require(_0xbb57('0x5'));var faxQueue=require(_0xbb57('0x6'));var whatsappQueue=require(_0xbb57('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbb57('0x8')]()[_0xbb57('0x9')](user[_0xbb57('0xa')]())[_0xbb57('0x9')](realtime[_0xbb57('0xb')]())[_0xbb57('0x9')](interval[_0xbb57('0xc')]())[_0xbb57('0x9')](realtime[_0xbb57('0xd')]())[_0xbb57('0x9')](openchannelQueue[_0xbb57('0xe')]())[_0xbb57('0x9')](realtime[_0xbb57('0xf')]())['then'](chatQueue[_0xbb57('0x10')]())['then'](realtime['initChatQueues']())[_0xbb57('0x9')](smsQueue[_0xbb57('0x11')]())[_0xbb57('0x9')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())['then'](realtime[_0xbb57('0x12')]())[_0xbb57('0x9')](faxQueue[_0xbb57('0x13')]())['then'](realtime[_0xbb57('0x14')]())[_0xbb57('0x9')](whatsappQueue['getWhatsappQueues']())[_0xbb57('0x9')](realtime[_0xbb57('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xbb57('0x16')](realtime)['then'](function(_0x3a6a28){return initRealtime();})[_0xbb57('0x9')](function(_0x4d0886){return setInterval(initRealtime,0x1388);})[_0xbb57('0x17')](function(_0x458cdb){console[_0xbb57('0x18')](_0x458cdb);});}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 115da7b..abfca0a 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x242225,_0x23e175){var _0x272125=function(_0x494143){while(--_0x494143){_0x242225['push'](_0x242225['shift']());}};_0x272125(++_0x23e175);}(_0x814b,0x1a2));var _0xb814=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x814b[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x4b570f,_0x1b2f2e){var _0x3f7990=function(_0x1c6c30){while(--_0x1c6c30){_0x4b570f['push'](_0x4b570f['shift']());}};_0x3f7990(++_0x1b2f2e);}(_0x814b,0x1a2));var _0xb814=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x814b[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};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 0245232..14e6e68 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 _0x010f=['bluebird','jayson/promise','client','http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x1199f6,_0x4f6e85){var _0x1c1579=function(_0xdd3def){while(--_0xdd3def){_0x1199f6['push'](_0x1199f6['shift']());}};_0x1c1579(++_0x4f6e85);}(_0x010f,0x1b8));var _0xf010=function(_0xb7e8df,_0x3ad41f){_0xb7e8df=_0xb7e8df-0x0;var _0x1f4cb6=_0x010f[_0xb7e8df];return _0x1f4cb6;};'use strict';var BPromise=require(_0xf010('0x0'));var jayson=require(_0xf010('0x1'));var client=jayson[_0xf010('0x2')][_0xf010('0x3')]({'port':0x232b});function request(_0x50c23e,_0xd8f98a){return new BPromise(function(_0x3dbb86,_0xb8596c){return client[_0xf010('0x4')](_0x50c23e,_0xd8f98a)['then'](function(_0x4b14d0){if(_0x4b14d0[_0xf010('0x5')]){return _0xb8596c(_0x4b14d0[_0xf010('0x5')][_0xf010('0x6')]);}else{return _0x3dbb86(_0x4b14d0[_0xf010('0x7')]);}})['catch'](function(_0x470118){return _0xb8596c(_0x470118);});});}exports[_0xf010('0x8')]=function(_0x54a3f6,_0xfc4afc){return request(_0xf010('0x9'),{'account':_0x54a3f6,'message':_0xfc4afc});}; \ No newline at end of file +var _0xb21b=['sendMailMessage','SendMail','bluebird','jayson/promise','http','then','error','result','catch'];(function(_0x40bbf3,_0x54e356){var _0x5432b6=function(_0x56fc48){while(--_0x56fc48){_0x40bbf3['push'](_0x40bbf3['shift']());}};_0x5432b6(++_0x54e356);}(_0xb21b,0x18e));var _0xbb21=function(_0x4b951d,_0x1a53f6){_0x4b951d=_0x4b951d-0x0;var _0x2678ce=_0xb21b[_0x4b951d];return _0x2678ce;};'use strict';var BPromise=require(_0xbb21('0x0'));var jayson=require(_0xbb21('0x1'));var client=jayson['client'][_0xbb21('0x2')]({'port':0x232b});function request(_0x551d38,_0x4af871){return new BPromise(function(_0x1ecd67,_0x13639c){return client['request'](_0x551d38,_0x4af871)[_0xbb21('0x3')](function(_0x1520aa){if(_0x1520aa[_0xbb21('0x4')]){return _0x13639c(_0x1520aa[_0xbb21('0x4')]['message']);}else{return _0x1ecd67(_0x1520aa[_0xbb21('0x5')]);}})[_0xbb21('0x6')](function(_0x485310){return _0x13639c(_0x485310);});});}exports[_0xbb21('0x7')]=function(_0x59280e,_0xd79013){return request(_0xbb21('0x8'),{'account':_0x59280e,'message':_0xd79013});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 51ecd82..b2da6a8 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 _0x9921=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','chat','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatStatusTime','mailCurrentCapacity','faxCurrentCapacity','smsStatusTime','whatsappCapacity','emit','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity'];(function(_0x5962b4,_0x84be73){var _0xe6443c=function(_0x2b37d4){while(--_0x2b37d4){_0x5962b4['push'](_0x5962b4['shift']());}};_0xe6443c(++_0x84be73);}(_0x9921,0x154));var _0x1992=function(_0x111c6d,_0xb16b03){_0x111c6d=_0x111c6d-0x0;var _0x1904f2=_0x9921[_0x111c6d];return _0x1904f2;};'use strict';var _=require(_0x1992('0x0'));var moment=require(_0x1992('0x1'));var md5=require(_0x1992('0x2'));var Redis=require(_0x1992('0x3'));var config=require(_0x1992('0x4'));config[_0x1992('0x5')]=_[_0x1992('0x6')](config[_0x1992('0x5')],{'host':_0x1992('0x7'),'port':0x18eb});var io=require(_0x1992('0x8'))(new Redis(config[_0x1992('0x5')]));function Agent(_0x37ad07){this['id']=_0x37ad07['id']||0x0;this[_0x1992('0x9')]=_0x37ad07[_0x1992('0x9')]||'';this['online']=_0x37ad07[_0x1992('0xa')]||!![];this[_0x1992('0xb')]=_0x37ad07['voicePause']||![];this[_0x1992('0xc')]=_0x37ad07[_0x1992('0xc')]||![];this['mailPause']=_0x37ad07[_0x1992('0xd')]||![];this[_0x1992('0xe')]=_0x37ad07[_0x1992('0xe')]||![];this['smsPause']=_0x37ad07[_0x1992('0xf')]||![];this['openchannelPause']=_0x37ad07[_0x1992('0x10')]||![];this[_0x1992('0x11')]=_0x1992('0x12');this['chatStatusTime']=0x0;this[_0x1992('0x13')]=_0x37ad07[_0x1992('0x13')]||0x0;this[_0x1992('0x14')]=0x0;this[_0x1992('0x15')]=_0x1992('0x12');this[_0x1992('0x16')]=0x0;this[_0x1992('0x17')]=_0x37ad07[_0x1992('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x1992('0x18')]=_0x1992('0x12');this[_0x1992('0x19')]=0x0;this[_0x1992('0x1a')]=_0x37ad07['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x1992('0x1b')]=_0x1992('0x12');this['smsStatusTime']=0x0;this[_0x1992('0x1c')]=_0x37ad07['smsCapacity']||0x0;this[_0x1992('0x1d')]=0x0;this[_0x1992('0x1e')]=_0x1992('0x12');this[_0x1992('0x1f')]=0x0;this['whatsappCapacity']=_0x37ad07['whatsappCapacity']||0x0;this[_0x1992('0x20')]=0x0;this[_0x1992('0x21')]=_0x1992('0x12');this[_0x1992('0x22')]=0x0;this[_0x1992('0x23')]=_0x37ad07[_0x1992('0x23')]||0x0;this[_0x1992('0x24')]=0x0;this[_0x1992('0x25')]=![];this[_0x1992('0x26')]=undefined;this[_0x1992('0x2')]='';this[_0x1992('0x27')]();}Agent[_0x1992('0x28')]['getChannelStatus']=function(_0x3d5e2f){if(this[_0x3d5e2f+_0x1992('0x29')]>0x0){if(this[_0x3d5e2f+_0x1992('0x2a')]>0x0&&this[_0x3d5e2f+_0x1992('0x29')]>=this[_0x3d5e2f+_0x1992('0x2a')]){return'maxcapacity';}else{return _0x1992('0x2b');}}else{return _0x1992('0x2c');}};Agent[_0x1992('0x28')]['updateRealtime']=function(){var _0x398833=['mail',_0x1992('0x2d'),'openchannel',_0x1992('0x2e'),_0x1992('0x2f'),_0x1992('0x30')];for(var _0x4824ba=0x0;_0x4824ba<_0x398833[_0x1992('0x31')];_0x4824ba+=0x1){var _0x2ca0f6=this[_0x1992('0x32')](_0x398833[_0x4824ba]);if(this[_0x398833[_0x4824ba]+_0x1992('0x33')]!==_0x2ca0f6){this[_0x398833[_0x4824ba]+_0x1992('0x34')]=_[_0x1992('0x35')](moment()['format']('x'));}this[_0x398833[_0x4824ba]+_0x1992('0x33')]=_0x2ca0f6;}var _0x555743={'id':this['id'],'name':this[_0x1992('0x9')],'online':this[_0x1992('0xa')],'voicePause':this[_0x1992('0xb')],'chatPause':this[_0x1992('0xc')],'mailPause':this[_0x1992('0xd')],'smsPause':this[_0x1992('0xf')],'faxPause':this[_0x1992('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x1992('0x11')],'chatStatusTime':this[_0x1992('0x36')],'chatCapacity':this[_0x1992('0x13')],'chatCurrentCapacity':this[_0x1992('0x14')],'mailStatus':this[_0x1992('0x15')],'mailStatusTime':this[_0x1992('0x16')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x1992('0x37')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x1992('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x1992('0x38')],'smsStatus':this[_0x1992('0x1b')],'smsStatusTime':this[_0x1992('0x39')],'smsCapacity':this[_0x1992('0x1c')],'smsCurrentCapacity':this[_0x1992('0x1d')],'whatsappStatus':this[_0x1992('0x1e')],'whatsappStatusTime':this[_0x1992('0x1f')],'whatsappCapacity':this[_0x1992('0x3a')],'whatsappCurrentCapacity':this[_0x1992('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x1992('0x22')],'openchannelCapacity':this[_0x1992('0x23')],'openchannelCurrentCapacity':this[_0x1992('0x24')],'busy':this[_0x1992('0x25')],'busyQueue':this[_0x1992('0x26')]};var _0x29e397=md5(JSON['stringify'](_0x555743));if(this[_0x1992('0x2')]!==_0x29e397){this['md5']=_0x29e397;io[_0x1992('0x3b')]('user:save',_0x555743);}};module['exports']=Agent; \ No newline at end of file +var _0x3c67=['format','chatStatusTime','mailStatus','smsCapacity','whatsappStatusTime','openchannelCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','idle','mail','fax','sms','length','Status','StatusTime','toNumber'];(function(_0x2876a0,_0x5a09e3){var _0x5c4aae=function(_0x499cd2){while(--_0x499cd2){_0x2876a0['push'](_0x2876a0['shift']());}};_0x5c4aae(++_0x5a09e3);}(_0x3c67,0x131));var _0x73c6=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x3c67[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var moment=require(_0x73c6('0x0'));var md5=require(_0x73c6('0x1'));var Redis=require(_0x73c6('0x2'));var config=require(_0x73c6('0x3'));config[_0x73c6('0x4')]=_[_0x73c6('0x5')](config[_0x73c6('0x4')],{'host':_0x73c6('0x6'),'port':0x18eb});var io=require(_0x73c6('0x7'))(new Redis(config[_0x73c6('0x4')]));function Agent(_0x539e97){this['id']=_0x539e97['id']||0x0;this[_0x73c6('0x8')]=_0x539e97[_0x73c6('0x8')]||'';this[_0x73c6('0x9')]=_0x539e97['online']||!![];this['voicePause']=_0x539e97[_0x73c6('0xa')]||![];this[_0x73c6('0xb')]=_0x539e97['chatPause']||![];this[_0x73c6('0xc')]=_0x539e97[_0x73c6('0xc')]||![];this[_0x73c6('0xd')]=_0x539e97[_0x73c6('0xd')]||![];this[_0x73c6('0xe')]=_0x539e97['smsPause']||![];this[_0x73c6('0xf')]=_0x539e97[_0x73c6('0xf')]||![];this[_0x73c6('0x10')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x539e97[_0x73c6('0x11')]||0x0;this[_0x73c6('0x12')]=0x0;this['mailStatus']=_0x73c6('0x13');this[_0x73c6('0x14')]=0x0;this[_0x73c6('0x15')]=_0x539e97[_0x73c6('0x15')]||0x0;this[_0x73c6('0x16')]=0x0;this[_0x73c6('0x17')]=_0x73c6('0x13');this[_0x73c6('0x18')]=0x0;this[_0x73c6('0x19')]=_0x539e97['faxCapacity']||0x0;this[_0x73c6('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x73c6('0x1b')]=0x0;this['smsCapacity']=_0x539e97['smsCapacity']||0x0;this[_0x73c6('0x1c')]=0x0;this[_0x73c6('0x1d')]=_0x73c6('0x13');this['whatsappStatusTime']=0x0;this[_0x73c6('0x1e')]=_0x539e97['whatsappCapacity']||0x0;this[_0x73c6('0x1f')]=0x0;this[_0x73c6('0x20')]='unknown';this[_0x73c6('0x21')]=0x0;this['openchannelCapacity']=_0x539e97['openchannelCapacity']||0x0;this[_0x73c6('0x22')]=0x0;this[_0x73c6('0x23')]=![];this[_0x73c6('0x24')]=undefined;this['md5']='';this[_0x73c6('0x25')]();}Agent[_0x73c6('0x26')]['getChannelStatus']=function(_0x2c15ef){if(this[_0x2c15ef+_0x73c6('0x27')]>0x0){if(this[_0x2c15ef+_0x73c6('0x28')]>0x0&&this[_0x2c15ef+'CurrentCapacity']>=this[_0x2c15ef+_0x73c6('0x28')]){return'maxcapacity';}else{return'working';}}else{return _0x73c6('0x29');}};Agent[_0x73c6('0x26')][_0x73c6('0x25')]=function(){var _0x26baf5=[_0x73c6('0x2a'),'chat','openchannel',_0x73c6('0x2b'),_0x73c6('0x2c'),'whatsapp'];for(var _0x16dd23=0x0;_0x16dd23<_0x26baf5[_0x73c6('0x2d')];_0x16dd23+=0x1){var _0x6d2556=this['getChannelStatus'](_0x26baf5[_0x16dd23]);if(this[_0x26baf5[_0x16dd23]+_0x73c6('0x2e')]!==_0x6d2556){this[_0x26baf5[_0x16dd23]+_0x73c6('0x2f')]=_[_0x73c6('0x30')](moment()[_0x73c6('0x31')]('x'));}this[_0x26baf5[_0x16dd23]+'Status']=_0x6d2556;}var _0x428c48={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x73c6('0xa')],'chatPause':this[_0x73c6('0xb')],'mailPause':this[_0x73c6('0xc')],'smsPause':this[_0x73c6('0xe')],'faxPause':this[_0x73c6('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x73c6('0x10')],'chatStatusTime':this[_0x73c6('0x32')],'chatCapacity':this[_0x73c6('0x11')],'chatCurrentCapacity':this[_0x73c6('0x12')],'mailStatus':this[_0x73c6('0x33')],'mailStatusTime':this[_0x73c6('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x73c6('0x16')],'faxStatus':this[_0x73c6('0x17')],'faxStatusTime':this[_0x73c6('0x18')],'faxCapacity':this[_0x73c6('0x19')],'faxCurrentCapacity':this[_0x73c6('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x73c6('0x34')],'smsCurrentCapacity':this[_0x73c6('0x1c')],'whatsappStatus':this[_0x73c6('0x1d')],'whatsappStatusTime':this[_0x73c6('0x35')],'whatsappCapacity':this[_0x73c6('0x1e')],'whatsappCurrentCapacity':this[_0x73c6('0x1f')],'openchannelStatus':this[_0x73c6('0x20')],'openchannelStatusTime':this[_0x73c6('0x21')],'openchannelCapacity':this[_0x73c6('0x36')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x73c6('0x23')],'busyQueue':this['busyQueue']};var _0x43aa54=md5(JSON[_0x73c6('0x37')](_0x428c48));if(this[_0x73c6('0x1')]!==_0x43aa54){this['md5']=_0x43aa54;io[_0x73c6('0x38')](_0x73c6('0x39'),_0x428c48);}};module[_0x73c6('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ed34cf8..a8fb7c2 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 _0xb790=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','ioredis','../../../config/environment','redis'];(function(_0x153e55,_0x2934a9){var _0x247804=function(_0x5daaaa){while(--_0x5daaaa){_0x153e55['push'](_0x153e55['shift']());}};_0x247804(++_0x2934a9);}(_0xb790,0x88));var _0x0b79=function(_0x169d7f,_0x129afd){_0x169d7f=_0x169d7f-0x0;var _0x28e8c=_0xb790[_0x169d7f];return _0x28e8c;};'use strict';var _=require('lodash');var md5=require(_0x0b79('0x0'));var util=require('util');var Redis=require(_0x0b79('0x1'));var config=require(_0x0b79('0x2'));config[_0x0b79('0x3')]=_[_0x0b79('0x4')](config[_0x0b79('0x3')],{'host':_0x0b79('0x5'),'port':0x18eb});var io=require(_0x0b79('0x6'))(new Redis(config[_0x0b79('0x3')]));function ChatQueue(_0x46086e){this['id']=_0x46086e['id']||0x0;this[_0x0b79('0x7')]=_0x46086e[_0x0b79('0x7')]||'';this[_0x0b79('0x8')]=_0x46086e[_0x0b79('0x8')]||0xa;this[_0x0b79('0x9')]=_0x46086e[_0x0b79('0x9')]||_0x0b79('0xa');this[_0x0b79('0xb')]=_0x46086e[_0x0b79('0xb')];this['mapAgentsId']={};this[_0x0b79('0xc')]=0x0;this[_0x0b79('0x0')]='';this[_0x0b79('0xd')]();this[_0x0b79('0xe')]();}ChatQueue[_0x0b79('0xf')][_0x0b79('0xd')]=function(){var _0x3953a6=this[_0x0b79('0x10')]['_rr'];this['mapAgentsId']=_['map'](this[_0x0b79('0xb')],'id');this[_0x0b79('0x10')][_0x0b79('0x11')]=_0x3953a6;};ChatQueue['prototype'][_0x0b79('0xe')]=function(){this[_0x0b79('0x12')]=0x0;this[_0x0b79('0x13')]=0x0;for(var _0x510a8f=0x0;_0x510a8f=0x0?this[_0x0b79('0x16')]:0x0;var _0x1d81b9={'id':this['id'],'available':this[_0x0b79('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x0b79('0x13')],'waiting':this[_0x0b79('0xc')]};var _0x102aa6=md5(JSON[_0x0b79('0x17')](_0x1d81b9));if(this[_0x0b79('0x0')]!==_0x102aa6){this[_0x0b79('0x0')]=_0x102aa6;io['to'](util[_0x0b79('0x18')](_0x0b79('0x19'),_0x1d81b9[_0x0b79('0x7')]))['emit'](_0x0b79('0x1a'),_0x1d81b9);}};module[_0x0b79('0x1b')]=ChatQueue; \ No newline at end of file +var _0xfdfe=['../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','emit','chat_queue:save','md5','ioredis'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xfdfe,0x1d2));var _0xefdf=function(_0x52a6ae,_0x7a9374){_0x52a6ae=_0x52a6ae-0x0;var _0x49baf4=_0xfdfe[_0x52a6ae];return _0x49baf4;};'use strict';var _=require('lodash');var md5=require(_0xefdf('0x0'));var util=require('util');var Redis=require(_0xefdf('0x1'));var config=require(_0xefdf('0x2'));config[_0xefdf('0x3')]=_[_0xefdf('0x4')](config[_0xefdf('0x3')],{'host':_0xefdf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xefdf('0x3')]));function ChatQueue(_0x4accc4){this['id']=_0x4accc4['id']||0x0;this[_0xefdf('0x6')]=_0x4accc4[_0xefdf('0x6')]||'';this[_0xefdf('0x7')]=_0x4accc4[_0xefdf('0x7')]||0xa;this[_0xefdf('0x8')]=_0x4accc4['strategy']||_0xefdf('0x9');this[_0xefdf('0xa')]=_0x4accc4[_0xefdf('0xa')];this['mapAgentsId']={};this[_0xefdf('0xb')]=0x0;this[_0xefdf('0x0')]='';this['updateRouting']();this[_0xefdf('0xc')]();}ChatQueue[_0xefdf('0xd')]['updateRouting']=function(){var _0x107275=this[_0xefdf('0xe')]['_rr'];this[_0xefdf('0xe')]=_[_0xefdf('0xf')](this[_0xefdf('0xa')],'id');this[_0xefdf('0xe')][_0xefdf('0x10')]=_0x107275;};ChatQueue['prototype'][_0xefdf('0xc')]=function(){this[_0xefdf('0x11')]=0x0;this[_0xefdf('0x12')]=0x0;for(var _0x406846=0x0;_0x406846=0x0?this['available']:0x0;var _0x3356fe={'id':this['id'],'available':this[_0xefdf('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xefdf('0x6')],'paused':this[_0xefdf('0x12')],'waiting':this[_0xefdf('0xb')]};var _0x10a134=md5(JSON['stringify'](_0x3356fe));if(this[_0xefdf('0x0')]!==_0x10a134){this[_0xefdf('0x0')]=_0x10a134;io['to'](util['format'](_0xefdf('0x17'),_0x3356fe['name']))[_0xefdf('0x18')](_0xefdf('0x19'),_0x3356fe);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b86bde6..997dc73 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 _0xddbb=['online','faxPause','available','paused','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xddbb,0x7d));var _0xbddb=function(_0x454628,_0xa9e27b){_0x454628=_0x454628-0x0;var _0x1db588=_0xddbb[_0x454628];return _0x1db588;};'use strict';var _=require(_0xbddb('0x0'));var md5=require(_0xbddb('0x1'));var util=require(_0xbddb('0x2'));var Redis=require('ioredis');var config=require(_0xbddb('0x3'));config[_0xbddb('0x4')]=_[_0xbddb('0x5')](config[_0xbddb('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbddb('0x6'))(new Redis(config[_0xbddb('0x4')]));function FaxQueue(_0x11ab4c){this['id']=_0x11ab4c['id']||0x0;this[_0xbddb('0x7')]=_0x11ab4c['name']||'';this[_0xbddb('0x8')]=_0x11ab4c[_0xbddb('0x8')]||0xa;this[_0xbddb('0x9')]=_0x11ab4c[_0xbddb('0x9')]||_0xbddb('0xa');this[_0xbddb('0xb')]=_0x11ab4c[_0xbddb('0xb')];this[_0xbddb('0xc')]={};this[_0xbddb('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xbddb('0xe')]();}FaxQueue[_0xbddb('0xf')][_0xbddb('0x10')]=function(){var _0x222291=this[_0xbddb('0xc')][_0xbddb('0x11')];this[_0xbddb('0xc')]=_[_0xbddb('0x12')](this[_0xbddb('0xb')],'id');this['mapAgentsId'][_0xbddb('0x11')]=_0x222291;};FaxQueue[_0xbddb('0xf')]['updateRealtime']=function(){this[_0xbddb('0x13')]=0x0;this['paused']=0x0;for(var _0x533e9e=0x0;_0x533e9e=0x0?this[_0xbddb('0x16')]:0x0;var _0x5adce0={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbddb('0x13')],'name':this['name'],'paused':this[_0xbddb('0x17')],'waiting':this[_0xbddb('0xd')]};var _0x2d8701=md5(JSON[_0xbddb('0x18')](_0x5adce0));if(this[_0xbddb('0x1')]!==_0x2d8701){this['md5']=_0x2d8701;io['to'](util[_0xbddb('0x19')]('fax:queue:%s',_0x5adce0['name']))[_0xbddb('0x1a')](_0xbddb('0x1b'),_0x5adce0);}};module[_0xbddb('0x1c')]=FaxQueue; \ No newline at end of file +var _0x4fe7=['prototype','loggedIn','paused','length','online','faxPause','available','name','stringify','format','fax:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fe7,0x81));var _0x74fe=function(_0x250e9b,_0xdca9ad){_0x250e9b=_0x250e9b-0x0;var _0x343c58=_0x4fe7[_0x250e9b];return _0x343c58;};'use strict';var _=require(_0x74fe('0x0'));var md5=require(_0x74fe('0x1'));var util=require('util');var Redis=require(_0x74fe('0x2'));var config=require(_0x74fe('0x3'));config['redis']=_['defaults'](config[_0x74fe('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x74fe('0x5'))(new Redis(config['redis']));function FaxQueue(_0x15062a){this['id']=_0x15062a['id']||0x0;this['name']=_0x15062a['name']||'';this[_0x74fe('0x6')]=_0x15062a[_0x74fe('0x6')]||0xa;this[_0x74fe('0x7')]=_0x15062a[_0x74fe('0x7')]||_0x74fe('0x8');this['Agents']=_0x15062a[_0x74fe('0x9')];this[_0x74fe('0xa')]={};this[_0x74fe('0xb')]=0x0;this[_0x74fe('0x1')]='';this[_0x74fe('0xc')]();this[_0x74fe('0xd')]();}FaxQueue['prototype'][_0x74fe('0xc')]=function(){var _0x835937=this[_0x74fe('0xa')][_0x74fe('0xe')];this[_0x74fe('0xa')]=_[_0x74fe('0xf')](this[_0x74fe('0x9')],'id');this[_0x74fe('0xa')][_0x74fe('0xe')]=_0x835937;};FaxQueue[_0x74fe('0x10')][_0x74fe('0xd')]=function(){this[_0x74fe('0x11')]=0x0;this[_0x74fe('0x12')]=0x0;for(var _0x1dcb71=0x0;_0x1dcb71=0x0?this[_0x74fe('0x16')]:0x0;var _0x12c2dd={'id':this['id'],'available':this[_0x74fe('0x16')],'loggedIn':this[_0x74fe('0x11')],'name':this[_0x74fe('0x17')],'paused':this['paused'],'waiting':this[_0x74fe('0xb')]};var _0x1068fe=md5(JSON[_0x74fe('0x18')](_0x12c2dd));if(this[_0x74fe('0x1')]!==_0x1068fe){this['md5']=_0x1068fe;io['to'](util[_0x74fe('0x19')](_0x74fe('0x1a'),_0x12c2dd[_0x74fe('0x17')]))[_0x74fe('0x1b')]('fax_queue:save',_0x12c2dd);}};module[_0x74fe('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c4cb751..3a4cf57 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 _0x9edd=['name','Intervals'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9edd,0x10e));var _0xd9ed=function(_0x2f4e4c,_0x333f7c){_0x2f4e4c=_0x2f4e4c-0x0;var _0x33735c=_0x9edd[_0x2f4e4c];return _0x33735c;};'use strict';function Interval(_0x319c00){this['id']=_0x319c00['id']||0x0;this[_0xd9ed('0x0')]=_0x319c00[_0xd9ed('0x0')]||'';this['Intervals']=_0x319c00[_0xd9ed('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x4031=['name','Intervals','exports'];(function(_0x381496,_0x2c6909){var _0xc053f1=function(_0x4bb11c){while(--_0x4bb11c){_0x381496['push'](_0x381496['shift']());}};_0xc053f1(++_0x2c6909);}(_0x4031,0x1a1));var _0x1403=function(_0x229f7a,_0x57039f){_0x229f7a=_0x229f7a-0x0;var _0x239ab7=_0x4031[_0x229f7a];return _0x239ab7;};'use strict';function Interval(_0x3c2d18){this['id']=_0x3c2d18['id']||0x0;this[_0x1403('0x0')]=_0x3c2d18[_0x1403('0x0')]||'';this['Intervals']=_0x3c2d18[_0x1403('0x1')]||{};}module[_0x1403('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 ce640f2..417bdb3 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 _0x4cf4=['mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','map','_rr','prototype','updateRealtime','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cf4,0x7a));var _0x44cf=function(_0xdbb962,_0x523201){_0xdbb962=_0xdbb962-0x0;var _0xf4675b=_0x4cf4[_0xdbb962];return _0xf4675b;};'use strict';var _=require(_0x44cf('0x0'));var md5=require(_0x44cf('0x1'));var util=require(_0x44cf('0x2'));var Redis=require('ioredis');var config=require(_0x44cf('0x3'));config[_0x44cf('0x4')]=_['defaults'](config[_0x44cf('0x4')],{'host':_0x44cf('0x5'),'port':0x18eb});var io=require(_0x44cf('0x6'))(new Redis(config['redis']));function MailQueue(_0x5905b2){this['id']=_0x5905b2['id']||0x0;this['name']=_0x5905b2[_0x44cf('0x7')]||'';this[_0x44cf('0x8')]=_0x5905b2[_0x44cf('0x8')]||0xa;this[_0x44cf('0x9')]=_0x5905b2[_0x44cf('0x9')]||_0x44cf('0xa');this[_0x44cf('0xb')]=_0x5905b2[_0x44cf('0xb')];this[_0x44cf('0xc')]={};this[_0x44cf('0xd')]=0x0;this[_0x44cf('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x14f93b=this[_0x44cf('0xc')]['_rr'];this[_0x44cf('0xc')]=_[_0x44cf('0xe')](this['Agents'],'id');this[_0x44cf('0xc')][_0x44cf('0xf')]=_0x14f93b;};MailQueue[_0x44cf('0x10')][_0x44cf('0x11')]=function(){this[_0x44cf('0x12')]=0x0;this['paused']=0x0;for(var _0x131514=0x0;_0x131514=0x0?this['available']:0x0;var _0x299c32={'id':this['id'],'available':this[_0x44cf('0x17')],'loggedIn':this[_0x44cf('0x12')],'name':this[_0x44cf('0x7')],'paused':this[_0x44cf('0x16')],'waiting':this[_0x44cf('0xd')]};var _0xbf1ad6=md5(JSON[_0x44cf('0x18')](_0x299c32));if(this[_0x44cf('0x1')]!==_0xbf1ad6){this[_0x44cf('0x1')]=_0xbf1ad6;io['to'](util[_0x44cf('0x19')](_0x44cf('0x1a'),_0x299c32[_0x44cf('0x7')]))[_0x44cf('0x1b')](_0x44cf('0x1c'),_0x299c32);}};module[_0x44cf('0x1d')]=MailQueue; \ No newline at end of file +var _0xe2ec=['mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','mailPause','available','format','name'];(function(_0x5f31e4,_0x5c6e6e){var _0xc7f3f2=function(_0x55753a){while(--_0x55753a){_0x5f31e4['push'](_0x5f31e4['shift']());}};_0xc7f3f2(++_0x5c6e6e);}(_0xe2ec,0x13a));var _0xce2e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe2ec[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xce2e('0x0'));var md5=require(_0xce2e('0x1'));var util=require(_0xce2e('0x2'));var Redis=require('ioredis');var config=require(_0xce2e('0x3'));config[_0xce2e('0x4')]=_[_0xce2e('0x5')](config[_0xce2e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xce2e('0x6'))(new Redis(config[_0xce2e('0x4')]));function MailQueue(_0x20afc9){this['id']=_0x20afc9['id']||0x0;this['name']=_0x20afc9['name']||'';this['timeout']=_0x20afc9['timeout']||0xa;this[_0xce2e('0x7')]=_0x20afc9[_0xce2e('0x7')]||_0xce2e('0x8');this['Agents']=_0x20afc9[_0xce2e('0x9')];this['mapAgentsId']={};this[_0xce2e('0xa')]=0x0;this[_0xce2e('0x1')]='';this[_0xce2e('0xb')]();this[_0xce2e('0xc')]();}MailQueue[_0xce2e('0xd')][_0xce2e('0xb')]=function(){var _0x3006c7=this['mapAgentsId'][_0xce2e('0xe')];this['mapAgentsId']=_[_0xce2e('0xf')](this[_0xce2e('0x9')],'id');this[_0xce2e('0x10')][_0xce2e('0xe')]=_0x3006c7;};MailQueue[_0xce2e('0xd')][_0xce2e('0xc')]=function(){this[_0xce2e('0x11')]=0x0;this[_0xce2e('0x12')]=0x0;for(var _0x55cdf6=0x0;_0x55cdf6=0x0?this[_0xce2e('0x15')]:0x0;var _0x13bebb={'id':this['id'],'available':this['available'],'loggedIn':this[_0xce2e('0x11')],'name':this['name'],'paused':this[_0xce2e('0x12')],'waiting':this[_0xce2e('0xa')]};var _0x36d9aa=md5(JSON['stringify'](_0x13bebb));if(this['md5']!==_0x36d9aa){this['md5']=_0x36d9aa;io['to'](util[_0xce2e('0x16')]('mail:queue:%s',_0x13bebb[_0xce2e('0x17')]))['emit'](_0xce2e('0x18'),_0x13bebb);}};module[_0xce2e('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7acafba..d4d0a6b 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 _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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7a54,0x106));var _0x47a5=function(_0x1c427d,_0x3c8b49){_0x1c427d=_0x1c427d-0x0;var _0xb9e82d=_0x7a54[_0x1c427d];return _0xb9e82d;};'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 +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5fc0b9,_0x3a90ec){var _0xa7cbdf=function(_0x128d98){while(--_0x128d98){_0x5fc0b9['push'](_0x5fc0b9['shift']());}};_0xa7cbdf(++_0x3a90ec);}(_0x5fc3,0xa8));var _0x35fc=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0x5fc3[_0x119b3e];return _0x1169ae;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f538bac..46b5935 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 _0x4ea3=['format','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','_rr','mapAgentsId','map','updateRealtime','loggedIn','paused','length','online','available','stringify'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x34ea('0x0'));var md5=require(_0x34ea('0x1'));var util=require(_0x34ea('0x2'));var Redis=require(_0x34ea('0x3'));var config=require('../../../config/environment');config[_0x34ea('0x4')]=_['defaults'](config[_0x34ea('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x34ea('0x4')]));function SmsQueue(_0xa3a2cf){this['id']=_0xa3a2cf['id']||0x0;this[_0x34ea('0x5')]=_0xa3a2cf[_0x34ea('0x5')]||'';this[_0x34ea('0x6')]=_0xa3a2cf[_0x34ea('0x6')]||0xa;this[_0x34ea('0x7')]=_0xa3a2cf['strategy']||_0x34ea('0x8');this[_0x34ea('0x9')]=_0xa3a2cf[_0x34ea('0x9')];this['mapAgentsId']={};this[_0x34ea('0xa')]=0x0;this[_0x34ea('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x34ea('0xb')][_0x34ea('0xc')]=function(){var _0x167667=this['mapAgentsId'][_0x34ea('0xd')];this[_0x34ea('0xe')]=_[_0x34ea('0xf')](this[_0x34ea('0x9')],'id');this[_0x34ea('0xe')][_0x34ea('0xd')]=_0x167667;};SmsQueue[_0x34ea('0xb')][_0x34ea('0x10')]=function(){this[_0x34ea('0x11')]=0x0;this[_0x34ea('0x12')]=0x0;for(var _0x36a4c6=0x0;_0x36a4c6=0x0?this[_0x34ea('0x15')]:0x0;var _0x5aeea3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x34ea('0x11')],'name':this[_0x34ea('0x5')],'paused':this[_0x34ea('0x12')],'waiting':this[_0x34ea('0xa')]};var _0x52af16=md5(JSON[_0x34ea('0x16')](_0x5aeea3));if(this[_0x34ea('0x1')]!==_0x52af16){this[_0x34ea('0x1')]=_0x52af16;io['to'](util[_0x34ea('0x17')]('sms:queue:%s',_0x5aeea3['name']))[_0x34ea('0x18')](_0x34ea('0x19'),_0x5aeea3);}};module[_0x34ea('0x1a')]=SmsQueue; \ No newline at end of file +var _0x31c2=['sms:queue:%s','exports','lodash','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x31c2,0x98));var _0x231c=function(_0xf8788f,_0x4913e2){_0xf8788f=_0xf8788f-0x0;var _0x45766c=_0x31c2[_0xf8788f];return _0x45766c;};'use strict';var _=require(_0x231c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x231c('0x1'));var config=require(_0x231c('0x2'));config['redis']=_[_0x231c('0x3')](config[_0x231c('0x4')],{'host':_0x231c('0x5'),'port':0x18eb});var io=require(_0x231c('0x6'))(new Redis(config[_0x231c('0x4')]));function SmsQueue(_0x243f47){this['id']=_0x243f47['id']||0x0;this[_0x231c('0x7')]=_0x243f47[_0x231c('0x7')]||'';this['timeout']=_0x243f47[_0x231c('0x8')]||0xa;this['strategy']=_0x243f47[_0x231c('0x9')]||_0x231c('0xa');this[_0x231c('0xb')]=_0x243f47[_0x231c('0xb')];this['mapAgentsId']={};this[_0x231c('0xc')]=0x0;this[_0x231c('0xd')]='';this[_0x231c('0xe')]();this[_0x231c('0xf')]();}SmsQueue[_0x231c('0x10')][_0x231c('0xe')]=function(){var _0x4f2f2c=this['mapAgentsId']['_rr'];this[_0x231c('0x11')]=_[_0x231c('0x12')](this[_0x231c('0xb')],'id');this[_0x231c('0x11')][_0x231c('0x13')]=_0x4f2f2c;};SmsQueue[_0x231c('0x10')][_0x231c('0xf')]=function(){this[_0x231c('0x14')]=0x0;this[_0x231c('0x15')]=0x0;for(var _0x221c9c=0x0;_0x221c9c=0x0?this[_0x231c('0x19')]:0x0;var _0x59282c={'id':this['id'],'available':this[_0x231c('0x19')],'loggedIn':this[_0x231c('0x14')],'name':this[_0x231c('0x7')],'paused':this[_0x231c('0x15')],'waiting':this[_0x231c('0xc')]};var _0x270985=md5(JSON[_0x231c('0x1a')](_0x59282c));if(this[_0x231c('0xd')]!==_0x270985){this['md5']=_0x270985;io['to'](util[_0x231c('0x1b')](_0x231c('0x1c'),_0x59282c[_0x231c('0x7')]))['emit']('sms_queue:save',_0x59282c);}};module[_0x231c('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index be7896b..3b2d1c4 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 _0x57dd=['emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','loggedIn','whatsappPause','available','waiting','stringify'];(function(_0x520be8,_0x376e0e){var _0x5d9c5e=function(_0x22f529){while(--_0x22f529){_0x520be8['push'](_0x520be8['shift']());}};_0x5d9c5e(++_0x376e0e);}(_0x57dd,0xcd));var _0xd57d=function(_0x2b5bab,_0x2018e1){_0x2b5bab=_0x2b5bab-0x0;var _0x243b04=_0x57dd[_0x2b5bab];return _0x243b04;};'use strict';var _=require(_0xd57d('0x0'));var md5=require(_0xd57d('0x1'));var util=require(_0xd57d('0x2'));var Redis=require(_0xd57d('0x3'));var config=require(_0xd57d('0x4'));config[_0xd57d('0x5')]=_[_0xd57d('0x6')](config['redis'],{'host':_0xd57d('0x7'),'port':0x18eb});var io=require(_0xd57d('0x8'))(new Redis(config[_0xd57d('0x5')]));function WhatsappQueue(_0x589189){this['id']=_0x589189['id']||0x0;this[_0xd57d('0x9')]=_0x589189['name']||'';this['timeout']=_0x589189[_0xd57d('0xa')]||0xa;this[_0xd57d('0xb')]=_0x589189[_0xd57d('0xb')]||'beepall';this[_0xd57d('0xc')]=_0x589189[_0xd57d('0xc')];this[_0xd57d('0xd')]={};this['waiting']=0x0;this[_0xd57d('0x1')]='';this[_0xd57d('0xe')]();this[_0xd57d('0xf')]();}WhatsappQueue['prototype'][_0xd57d('0xe')]=function(){var _0x4daf01=this['mapAgentsId'][_0xd57d('0x10')];this[_0xd57d('0xd')]=_[_0xd57d('0x11')](this[_0xd57d('0xc')],'id');this[_0xd57d('0xd')]['_rr']=_0x4daf01;};WhatsappQueue[_0xd57d('0x12')][_0xd57d('0xf')]=function(){this['loggedIn']=0x0;this[_0xd57d('0x13')]=0x0;for(var _0x2baa96=0x0;_0x2baa96=0x0?this[_0xd57d('0x18')]:0x0;var _0x4d773d={'id':this['id'],'available':this[_0xd57d('0x18')],'loggedIn':this[_0xd57d('0x16')],'name':this[_0xd57d('0x9')],'paused':this['paused'],'waiting':this[_0xd57d('0x19')]};var _0x3e9333=md5(JSON[_0xd57d('0x1a')](_0x4d773d));if(this[_0xd57d('0x1')]!==_0x3e9333){this['md5']=_0x3e9333;io['to'](util['format']('whatsapp:queue:%s',_0x4d773d[_0xd57d('0x9')]))[_0xd57d('0x1b')](_0xd57d('0x1c'),_0x4d773d);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x5dfd=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','whatsappPause','available','md5','format'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x5dfd,0x1a8));var _0xd5df=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x5dfd[_0x128bef];return _0x1ba862;};'use strict';var _=require(_0xd5df('0x0'));var md5=require('md5');var util=require(_0xd5df('0x1'));var Redis=require('ioredis');var config=require(_0xd5df('0x2'));config[_0xd5df('0x3')]=_[_0xd5df('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd5df('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x5bc187){this['id']=_0x5bc187['id']||0x0;this[_0xd5df('0x6')]=_0x5bc187[_0xd5df('0x6')]||'';this['timeout']=_0x5bc187[_0xd5df('0x7')]||0xa;this[_0xd5df('0x8')]=_0x5bc187['strategy']||_0xd5df('0x9');this[_0xd5df('0xa')]=_0x5bc187[_0xd5df('0xa')];this[_0xd5df('0xb')]={};this[_0xd5df('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xd5df('0xd')]();}WhatsappQueue[_0xd5df('0xe')][_0xd5df('0xf')]=function(){var _0x55ea10=this[_0xd5df('0xb')][_0xd5df('0x10')];this['mapAgentsId']=_[_0xd5df('0x11')](this[_0xd5df('0xa')],'id');this[_0xd5df('0xb')][_0xd5df('0x10')]=_0x55ea10;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xd5df('0x12')]=0x0;this[_0xd5df('0x13')]=0x0;for(var _0x368937=0x0;_0x368937=0x0?this[_0xd5df('0x17')]:0x0;var _0x14ec10={'id':this['id'],'available':this[_0xd5df('0x17')],'loggedIn':this[_0xd5df('0x12')],'name':this[_0xd5df('0x6')],'paused':this[_0xd5df('0x13')],'waiting':this[_0xd5df('0xc')]};var _0x17296e=md5(JSON['stringify'](_0x14ec10));if(this[_0xd5df('0x18')]!==_0x17296e){this[_0xd5df('0x18')]=_0x17296e;io['to'](util[_0xd5df('0x19')](_0xd5df('0x1a'),_0x14ec10['name']))[_0xd5df('0x1b')](_0xd5df('0x1c'),_0x14ec10);}};module[_0xd5df('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e80b4a1..eca8f7a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x39945f,_0x55de99){var _0x425cb4=function(_0x2eacc1){while(--_0x2eacc1){_0x39945f['push'](_0x39945f['shift']());}};_0x425cb4(++_0x55de99);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e18a,_0x2d220a){_0x4e18a=_0x4e18a-0x0;var _0x56cc08=_0xb10b[_0x4e18a];return _0x56cc08;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9910827..e197e92 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 _0xe784=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xe784,0x1b9));var _0x4e78=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe784[_0x68c979];return _0x4f0001;};'use strict';var client=require(_0x4e78('0x0'));exports[_0x4e78('0x1')]=function(_0x45c0ba,_0xcfbc34){return client[_0x4e78('0x2')]('UpdateChatInteraction',{'body':_0xcfbc34,'options':{'where':{'id':_0x45c0ba}},'log':_0x4e78('0x3')});};exports[_0x4e78('0x4')]=function(_0x9e71c7,_0x2faac3){return client[_0x4e78('0x2')](_0x4e78('0x5'),{'body':_0x2faac3,'options':{'where':{'id':_0x9e71c7}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xd2af=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x3f56b8,_0x298a38){var _0x5cd0b0=function(_0x279597){while(--_0x279597){_0x3f56b8['push'](_0x3f56b8['shift']());}};_0x5cd0b0(++_0x298a38);}(_0xd2af,0x1c0));var _0xfd2a=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xd2af[_0x1f1e31];return _0x229b56;};'use strict';var client=require(_0xfd2a('0x0'));exports[_0xfd2a('0x1')]=function(_0x4a1353,_0x3ddc17){return client[_0xfd2a('0x2')](_0xfd2a('0x3'),{'body':_0x3ddc17,'options':{'where':{'id':_0x4a1353}},'log':_0xfd2a('0x4')});};exports[_0xfd2a('0x5')]=function(_0x3c5356,_0x221e53){return client[_0xfd2a('0x2')]('AddTagsToChatInteraction',{'body':_0x221e53,'options':{'where':{'id':_0x3c5356}},'log':_0xfd2a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ae24c08..88c193c 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 _0x4bbd=['Request','CreateChatMessage','../client','create'];(function(_0x562ef2,_0x78b67a){var _0x34bfcd=function(_0x51be4e){while(--_0x51be4e){_0x562ef2['push'](_0x562ef2['shift']());}};_0x34bfcd(++_0x78b67a);}(_0x4bbd,0x6a));var _0xd4bb=function(_0x39c0fe,_0x56309f){_0x39c0fe=_0x39c0fe-0x0;var _0x2d2ccd=_0x4bbd[_0x39c0fe];return _0x2d2ccd;};'use strict';var client=require(_0xd4bb('0x0'));exports[_0xd4bb('0x1')]=function(_0x55b7b8){return client[_0xd4bb('0x2')](_0xd4bb('0x3'),{'body':_0x55b7b8,'log':'createChatMessage'});}; \ No newline at end of file +var _0x4b37=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x1a9e91,_0x1a5893){var _0x5b6902=function(_0x312e54){while(--_0x312e54){_0x1a9e91['push'](_0x1a9e91['shift']());}};_0x5b6902(++_0x1a5893);}(_0x4b37,0xfc));var _0x74b3=function(_0x2a5350,_0x416aaf){_0x2a5350=_0x2a5350-0x0;var _0x56a2af=_0x4b37[_0x2a5350];return _0x56a2af;};'use strict';var client=require(_0x74b3('0x0'));exports[_0x74b3('0x1')]=function(_0x2d834c){return client[_0x74b3('0x2')](_0x74b3('0x3'),{'body':_0x2d834c,'log':_0x74b3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a3539b3..b16912c 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 _0x3ca4=['chatPause','../client','getChatQueues','Request','timeout','strategy','User','Agents','name','online'];(function(_0x35a441,_0x3a2ec6){var _0x571ce3=function(_0x161827){while(--_0x161827){_0x35a441['push'](_0x35a441['shift']());}};_0x571ce3(++_0x3a2ec6);}(_0x3ca4,0x17d));var _0x43ca=function(_0x2c6397,_0x3680a7){_0x2c6397=_0x2c6397-0x0;var _0x110542=_0x3ca4[_0x2c6397];return _0x110542;};'use strict';var client=require(_0x43ca('0x0'));exports[_0x43ca('0x1')]=function(){return function(){return client[_0x43ca('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x43ca('0x3'),_0x43ca('0x4')],'include':[{'model':_0x43ca('0x5'),'as':_0x43ca('0x6'),'attributes':['id',_0x43ca('0x7'),_0x43ca('0x8'),_0x43ca('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x9b67=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x9b67,0xf6));var _0x79b6=function(_0xa59b92,_0x242230){_0xa59b92=_0xa59b92-0x0;var _0x390b70=_0x9b67[_0xa59b92];return _0x390b70;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(){return function(){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'options':{'raw':![],'attributes':['id',_0x79b6('0x4'),'timeout',_0x79b6('0x5')],'include':[{'model':_0x79b6('0x6'),'as':'Agents','attributes':['id','name',_0x79b6('0x7'),_0x79b6('0x8')]}]},'log':_0x79b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0885382..ad252f2 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 _0xbc17=['CreateChatQueueReport','UpdateChatQueueReport','../client','create','Request'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0xbc17[_0x2fd69d];return _0x5d5ef3;};'use strict';var client=require(_0x7bc1('0x0'));exports[_0x7bc1('0x1')]=function(_0x5e8e5a){return client[_0x7bc1('0x2')](_0x7bc1('0x3'),{'body':_0x5e8e5a,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3ff36d,_0x7aa41e){return client['Request'](_0x7bc1('0x4'),{'body':_0x7aa41e,'options':{'where':{'uniqueid':_0x3ff36d},'order':[['id','DESC']],'limit':0x1},'log':_0x7bc1('0x4')});}; \ No newline at end of file +var _0x9181=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0x9181,0x182));var _0x1918=function(_0x422ee3,_0x1dbb5f){_0x422ee3=_0x422ee3-0x0;var _0x5444e3=_0x9181[_0x422ee3];return _0x5444e3;};'use strict';var client=require(_0x1918('0x0'));exports[_0x1918('0x1')]=function(_0x13ad9b){return client[_0x1918('0x2')](_0x1918('0x3'),{'body':_0x13ad9b,'log':'CreateChatQueueReport'});};exports[_0x1918('0x4')]=function(_0x5c38a7,_0x32e178){return client[_0x1918('0x2')](_0x1918('0x5'),{'body':_0x32e178,'options':{'where':{'uniqueid':_0x5c38a7},'order':[['id',_0x1918('0x6')]],'limit':0x1},'log':_0x1918('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c880448..18e077e 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x25b9db,_0x4092a4){var _0x291869=function(_0x5cc4d7){while(--_0x5cc4d7){_0x25b9db['push'](_0x25b9db['shift']());}};_0x291869(++_0x4092a4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2b92c1,_0x5892cb){var _0x581968=function(_0x46ef60){while(--_0x46ef60){_0x2b92c1['push'](_0x2b92c1['shift']());}};_0x581968(++_0x5892cb);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 394805c..5ea0d2d 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 _0xeed6=['createFaxMessage','create','CreateFaxMessage'];(function(_0x2e6a20,_0x294a14){var _0x32608e=function(_0x1727ed){while(--_0x1727ed){_0x2e6a20['push'](_0x2e6a20['shift']());}};_0x32608e(++_0x294a14);}(_0xeed6,0x100));var _0x6eed=function(_0x53575f,_0x28ed35){_0x53575f=_0x53575f-0x0;var _0x5c45e8=_0xeed6[_0x53575f];return _0x5c45e8;};'use strict';var client=require('../client');exports[_0x6eed('0x0')]=function(_0x38b76e){return client['Request'](_0x6eed('0x1'),{'body':_0x38b76e,'log':_0x6eed('0x2')});}; \ No newline at end of file +var _0x7110=['createFaxMessage','../client','create','Request'];(function(_0x2e7186,_0x19221c){var _0x442fd2=function(_0x5f47eb){while(--_0x5f47eb){_0x2e7186['push'](_0x2e7186['shift']());}};_0x442fd2(++_0x19221c);}(_0x7110,0xa9));var _0x0711=function(_0x23257f,_0x51fa72){_0x23257f=_0x23257f-0x0;var _0xefbb1c=_0x7110[_0x23257f];return _0xefbb1c;};'use strict';var client=require(_0x0711('0x0'));exports[_0x0711('0x1')]=function(_0x53ef5f){return client[_0x0711('0x2')]('CreateFaxMessage',{'body':_0x53ef5f,'log':_0x0711('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f1fb1ad..5785989 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 _0xf689=['GetFaxQueue','timeout','strategy','User','name','getFaxQueues','Request'];(function(_0x36368f,_0x9a18d3){var _0x2f6412=function(_0x385533){while(--_0x385533){_0x36368f['push'](_0x36368f['shift']());}};_0x2f6412(++_0x9a18d3);}(_0xf689,0x101));var _0x9f68=function(_0x1aa054,_0x27c239){_0x1aa054=_0x1aa054-0x0;var _0x47253d=_0xf689[_0x1aa054];return _0x47253d;};'use strict';var client=require('../client');exports[_0x9f68('0x0')]=function(){return function(){return client[_0x9f68('0x1')](_0x9f68('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9f68('0x3'),_0x9f68('0x4')],'include':[{'model':_0x9f68('0x5'),'as':'Agents','attributes':['id',_0x9f68('0x6'),'online','faxPause']}]},'log':_0x9f68('0x0')});};}; \ No newline at end of file +var _0xf0f8=['name','timeout','strategy','User','Agents','online','getFaxQueues','Request','GetFaxQueue'];(function(_0x3bc52b,_0x249b02){var _0x141ca5=function(_0x35f78a){while(--_0x35f78a){_0x3bc52b['push'](_0x3bc52b['shift']());}};_0x141ca5(++_0x249b02);}(_0xf0f8,0x1da));var _0x8f0f=function(_0x5a918d,_0x134727){_0x5a918d=_0x5a918d-0x0;var _0x45016b=_0xf0f8[_0x5a918d];return _0x45016b;};'use strict';var client=require('../client');exports[_0x8f0f('0x0')]=function(){return function(){return client[_0x8f0f('0x1')](_0x8f0f('0x2'),{'options':{'raw':![],'attributes':['id',_0x8f0f('0x3'),_0x8f0f('0x4'),_0x8f0f('0x5')],'include':[{'model':_0x8f0f('0x6'),'as':_0x8f0f('0x7'),'attributes':['id',_0x8f0f('0x3'),_0x8f0f('0x8'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9e76342..3add481 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 _0x2257=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x5f22f9,_0x5a5eca){var _0x5bfd9f=function(_0x433981){while(--_0x433981){_0x5f22f9['push'](_0x5f22f9['shift']());}};_0x5bfd9f(++_0x5a5eca);}(_0x2257,0x1d1));var _0x7225=function(_0x34760e,_0x40fef1){_0x34760e=_0x34760e-0x0;var _0x2d6949=_0x2257[_0x34760e];return _0x2d6949;};'use strict';var client=require(_0x7225('0x0'));exports[_0x7225('0x1')]=function(_0x31add8){return client[_0x7225('0x2')](_0x7225('0x3'),{'body':_0x31add8,'log':_0x7225('0x3')});};exports[_0x7225('0x4')]=function(_0x1a83cc,_0x2fa5b5){return client[_0x7225('0x2')](_0x7225('0x5'),{'body':_0x2fa5b5,'options':{'where':{'uniqueid':_0x1a83cc},'order':[['id',_0x7225('0x6')]],'limit':0x1},'log':_0x7225('0x5')});}; \ No newline at end of file +var _0x5be7=['Request','DESC','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update'];(function(_0x124ac9,_0x1de2b9){var _0x5881da=function(_0x4998de){while(--_0x4998de){_0x124ac9['push'](_0x124ac9['shift']());}};_0x5881da(++_0x1de2b9);}(_0x5be7,0x1e6));var _0x75be=function(_0x4aa0be,_0x31dccf){_0x4aa0be=_0x4aa0be-0x0;var _0x44809b=_0x5be7[_0x4aa0be];return _0x44809b;};'use strict';var client=require(_0x75be('0x0'));exports[_0x75be('0x1')]=function(_0x5511f5){return client['Request'](_0x75be('0x2'),{'body':_0x5511f5,'log':'CreateFaxQueueReport'});};exports[_0x75be('0x3')]=function(_0x1d6e3c,_0x1d9f4){return client[_0x75be('0x4')]('UpdateFaxQueueReport',{'body':_0x1d9f4,'options':{'where':{'uniqueid':_0x1d6e3c},'order':[['id',_0x75be('0x5')]],'limit':0x1},'log':_0x75be('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 69fc726..dead40a 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 _0x79da=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x24e9a8,_0x32350d){var _0x226602=function(_0x1cbbb5){while(--_0x1cbbb5){_0x24e9a8['push'](_0x24e9a8['shift']());}};_0x226602(++_0x32350d);}(_0x79da,0x15e));var _0xa79d=function(_0x42d3ce,_0x507fd4){_0x42d3ce=_0x42d3ce-0x0;var _0x5b450a=_0x79da[_0x42d3ce];return _0x5b450a;};'use strict';var client=require(_0xa79d('0x0'));exports[_0xa79d('0x1')]=function(){return function(){return client[_0xa79d('0x2')](_0xa79d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa79d('0x4')],'include':[{'model':_0xa79d('0x5'),'as':_0xa79d('0x6'),'attributes':['id',_0xa79d('0x4'),'interval']}]},'log':_0xa79d('0x1')});};}; \ No newline at end of file +var _0xfe05=['Request','name','Intervals','interval','../client','getIntervals'];(function(_0x823b40,_0x5e2c7a){var _0x595d26=function(_0x14c0b5){while(--_0x14c0b5){_0x823b40['push'](_0x823b40['shift']());}};_0x595d26(++_0x5e2c7a);}(_0xfe05,0x6a));var _0x5fe0=function(_0x241812,_0x5295bc){_0x241812=_0x241812-0x0;var _0x2ead48=_0xfe05[_0x241812];return _0x2ead48;};'use strict';var client=require(_0x5fe0('0x0'));exports[_0x5fe0('0x1')]=function(){return function(){return client[_0x5fe0('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5fe0('0x3')],'include':[{'model':'Interval','as':_0x5fe0('0x4'),'attributes':['id',_0x5fe0('0x3'),_0x5fe0('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b72caf1..a8c7717 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 _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x77e6,0x1a6));var _0x677e=function(_0x162af1,_0x51597d){_0x162af1=_0x162af1-0x0;var _0x5d1ab6=_0x77e6[_0x162af1];return _0x5d1ab6;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file +var _0x32b6=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x19f683,_0x445ee2){var _0x50128f=function(_0x4365d9){while(--_0x4365d9){_0x19f683['push'](_0x19f683['shift']());}};_0x50128f(++_0x445ee2);}(_0x32b6,0x1d1));var _0x632b=function(_0x3c59d4,_0x47763e){_0x3c59d4=_0x3c59d4-0x0;var _0x37760f=_0x32b6[_0x3c59d4];return _0x37760f;};'use strict';var client=require(_0x632b('0x0'));exports[_0x632b('0x1')]=function(_0x4d7646,_0x1f0635){return client[_0x632b('0x2')]('UpdateMailInteraction',{'body':_0x1f0635,'options':{'where':{'id':_0x4d7646}},'log':'updateMailInteraction'});};exports[_0x632b('0x3')]=function(_0x3435e8,_0x3ba3a7){return client[_0x632b('0x2')](_0x632b('0x4'),{'body':_0x3ba3a7,'options':{'where':{'id':_0x3435e8}},'log':_0x632b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ea7e55c..80f55fd 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 _0x6d57=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x3424b5,_0x4e7a6d){var _0x3f0196=function(_0x23e0e2){while(--_0x23e0e2){_0x3424b5['push'](_0x3424b5['shift']());}};_0x3f0196(++_0x4e7a6d);}(_0x6d57,0x1a0));var _0x76d5=function(_0x34101c,_0x105207){_0x34101c=_0x34101c-0x0;var _0x32f0b6=_0x6d57[_0x34101c];return _0x32f0b6;};'use strict';var client=require(_0x76d5('0x0'));exports[_0x76d5('0x1')]=function(_0x3e6d33){return client[_0x76d5('0x2')](_0x76d5('0x3'),{'body':_0x3e6d33,'log':_0x76d5('0x4')});}; \ No newline at end of file +var _0x6178=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x5b3aca,_0x3d0d08){var _0x3c93b1=function(_0x11a2f5){while(--_0x11a2f5){_0x5b3aca['push'](_0x5b3aca['shift']());}};_0x3c93b1(++_0x3d0d08);}(_0x6178,0x164));var _0x8617=function(_0x25e6b9,_0x9d17ea){_0x25e6b9=_0x25e6b9-0x0;var _0x4bfb70=_0x6178[_0x25e6b9];return _0x4bfb70;};'use strict';var client=require(_0x8617('0x0'));exports[_0x8617('0x1')]=function(_0x1b9414){return client[_0x8617('0x2')](_0x8617('0x3'),{'body':_0x1b9414,'log':_0x8617('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ea8db07..f47ee27 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 _0xf1e5=['../client','Request','name','timeout','Agents','online','mailPause'];(function(_0x2bddf4,_0x138d23){var _0x5afc05=function(_0x1732de){while(--_0x1732de){_0x2bddf4['push'](_0x2bddf4['shift']());}};_0x5afc05(++_0x138d23);}(_0xf1e5,0x70));var _0x5f1e=function(_0x2215de,_0x48777e){_0x2215de=_0x2215de-0x0;var _0x532b81=_0xf1e5[_0x2215de];return _0x532b81;};'use strict';var client=require(_0x5f1e('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x5f1e('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x5f1e('0x2'),_0x5f1e('0x3'),'strategy'],'include':[{'model':'User','as':_0x5f1e('0x4'),'attributes':['id',_0x5f1e('0x2'),_0x5f1e('0x5'),_0x5f1e('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x4dd1=['strategy','User','Agents','getMailQueues','Request','GetMailQueue','name'];(function(_0x5e43d0,_0x263557){var _0x7065e9=function(_0x1fc783){while(--_0x1fc783){_0x5e43d0['push'](_0x5e43d0['shift']());}};_0x7065e9(++_0x263557);}(_0x4dd1,0x122));var _0x14dd=function(_0x37865a,_0xda171f){_0x37865a=_0x37865a-0x0;var _0xa6fec5=_0x4dd1[_0x37865a];return _0xa6fec5;};'use strict';var client=require('../client');exports[_0x14dd('0x0')]=function(){return function(){return client[_0x14dd('0x1')](_0x14dd('0x2'),{'options':{'raw':![],'attributes':['id',_0x14dd('0x3'),'timeout',_0x14dd('0x4')],'include':[{'model':_0x14dd('0x5'),'as':_0x14dd('0x6'),'attributes':['id',_0x14dd('0x3'),'online','mailPause']}]},'log':_0x14dd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0aaf4f2..237661a 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 _0xf3cd=['create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','../client'];(function(_0x12885b,_0x4ce691){var _0x52625a=function(_0x1720c3){while(--_0x1720c3){_0x12885b['push'](_0x12885b['shift']());}};_0x52625a(++_0x4ce691);}(_0xf3cd,0x1a3));var _0xdf3c=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xf3cd[_0x151381];return _0x2afab6;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x355489){return client['Request'](_0xdf3c('0x2'),{'body':_0x355489,'log':_0xdf3c('0x2')});};exports[_0xdf3c('0x3')]=function(_0x6cd00,_0x37f2cf){return client[_0xdf3c('0x4')](_0xdf3c('0x5'),{'body':_0x37f2cf,'options':{'where':{'uniqueid':_0x6cd00},'order':[['id','DESC']],'limit':0x1},'log':_0xdf3c('0x5')});}; \ No newline at end of file +var _0x1be8=['UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x535581,_0xbe38e9){var _0x393ae1=function(_0x5bae9f){while(--_0x5bae9f){_0x535581['push'](_0x535581['shift']());}};_0x393ae1(++_0xbe38e9);}(_0x1be8,0x7d));var _0x81be=function(_0x35c33d,_0x46defa){_0x35c33d=_0x35c33d-0x0;var _0x5139b3=_0x1be8[_0x35c33d];return _0x5139b3;};'use strict';var client=require('../client');exports[_0x81be('0x0')]=function(_0xd4467){return client[_0x81be('0x1')](_0x81be('0x2'),{'body':_0xd4467,'log':_0x81be('0x2')});};exports['update']=function(_0x217e95,_0x339f38){return client[_0x81be('0x1')](_0x81be('0x3'),{'body':_0x339f38,'options':{'where':{'uniqueid':_0x217e95},'order':[['id','DESC']],'limit':0x1},'log':_0x81be('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 11400b0..22ec0d3 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 _0xe3c9=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x126c0e,_0x39ed92){var _0x48717f=function(_0x90f2a3){while(--_0x90f2a3){_0x126c0e['push'](_0x126c0e['shift']());}};_0x48717f(++_0x39ed92);}(_0xe3c9,0x19c));var _0x9e3c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe3c9[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x9e3c('0x0'));exports['update']=function(_0x565eae,_0x5f39e7){return client[_0x9e3c('0x1')](_0x9e3c('0x2'),{'body':_0x5f39e7,'options':{'where':{'id':_0x565eae}},'log':'updateOpenchannelInteraction'});};exports[_0x9e3c('0x3')]=function(_0x280afe,_0x52418d){return client[_0x9e3c('0x1')](_0x9e3c('0x4'),{'body':_0x52418d,'options':{'where':{'id':_0x280afe}},'log':_0x9e3c('0x5')});}; \ No newline at end of file +var _0x55c0=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x55c0,0x6b));var _0x055c=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x55c0[_0x4d1d2c];return _0x2c4cb9;};'use strict';var client=require(_0x055c('0x0'));exports['update']=function(_0xacf025,_0x532ce6){return client['Request'](_0x055c('0x1'),{'body':_0x532ce6,'options':{'where':{'id':_0xacf025}},'log':_0x055c('0x2')});};exports[_0x055c('0x3')]=function(_0x23f09c,_0x450f76){return client[_0x055c('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x450f76,'options':{'where':{'id':_0x23f09c}},'log':_0x055c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 5a248a5..e55ae31 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 _0x2e30=['Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x515317,_0x50f672){var _0x59d670=function(_0x37a15b){while(--_0x37a15b){_0x515317['push'](_0x515317['shift']());}};_0x59d670(++_0x50f672);}(_0x2e30,0x6c));var _0x02e3=function(_0x554edb,_0x299247){_0x554edb=_0x554edb-0x0;var _0x45a6c9=_0x2e30[_0x554edb];return _0x45a6c9;};'use strict';var client=require('../client');exports['create']=function(_0xe20da1){return client[_0x02e3('0x0')](_0x02e3('0x1'),{'body':_0xe20da1,'log':_0x02e3('0x2')});}; \ No newline at end of file +var _0x7390=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x7390,0x1ae));var _0x0739=function(_0x306d1d,_0x3f5497){_0x306d1d=_0x306d1d-0x0;var _0x3caec9=_0x7390[_0x306d1d];return _0x3caec9;};'use strict';var client=require('../client');exports[_0x0739('0x0')]=function(_0x6ec870){return client[_0x0739('0x1')](_0x0739('0x2'),{'body':_0x6ec870,'log':_0x0739('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d6892f1..58dd627 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 _0x9762=['strategy','User','Agents','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout'];(function(_0xfc3212,_0x259661){var _0x46f90c=function(_0x2c2125){while(--_0x2c2125){_0xfc3212['push'](_0xfc3212['shift']());}};_0x46f90c(++_0x259661);}(_0x9762,0x136));var _0x2976=function(_0x29061d,_0x5bd197){_0x29061d=_0x29061d-0x0;var _0x378837=_0x9762[_0x29061d];return _0x378837;};'use strict';var client=require(_0x2976('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x2976('0x1')](_0x2976('0x2'),{'options':{'raw':![],'attributes':['id',_0x2976('0x3'),_0x2976('0x4'),_0x2976('0x5')],'include':[{'model':_0x2976('0x6'),'as':_0x2976('0x7'),'attributes':['id',_0x2976('0x3'),'online','openchannelPause']}]},'log':_0x2976('0x8')});};}; \ No newline at end of file +var _0xe6c4=['../client','getOpenchannelQueues','name','timeout','strategy','User','online'];(function(_0x37f79c,_0x38f023){var _0x3e8566=function(_0xc347c5){while(--_0xc347c5){_0x37f79c['push'](_0x37f79c['shift']());}};_0x3e8566(++_0x38f023);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x5b04f7,_0x2a905a){_0x5b04f7=_0x5b04f7-0x0;var _0x439554=_0xe6c4[_0x5b04f7];return _0x439554;};'use strict';var client=require(_0x4e6c('0x0'));exports[_0x4e6c('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4e6c('0x2'),_0x4e6c('0x3'),_0x4e6c('0x4')],'include':[{'model':_0x4e6c('0x5'),'as':'Agents','attributes':['id',_0x4e6c('0x2'),_0x4e6c('0x6'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ba3ae01..3031e49 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 _0x30fe=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create'];(function(_0x106e63,_0x3c194a){var _0xcbea94=function(_0x3a1fdb){while(--_0x3a1fdb){_0x106e63['push'](_0x106e63['shift']());}};_0xcbea94(++_0x3c194a);}(_0x30fe,0x149));var _0xe30f=function(_0x5d65d4,_0x188ae1){_0x5d65d4=_0x5d65d4-0x0;var _0x5d2229=_0x30fe[_0x5d65d4];return _0x5d2229;};'use strict';var client=require('../client');exports[_0xe30f('0x0')]=function(_0x55d7a8){return client[_0xe30f('0x1')]('CreateOpenchannelQueueReport',{'body':_0x55d7a8,'log':_0xe30f('0x2')});};exports[_0xe30f('0x3')]=function(_0x3d6bbb,_0x27590a){return client[_0xe30f('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x27590a,'options':{'where':{'uniqueid':_0x3d6bbb},'order':[['id',_0xe30f('0x4')]],'limit':0x1},'log':_0xe30f('0x5')});}; \ No newline at end of file +var _0xcbb5=['Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport','update'];(function(_0x586c5b,_0x6a1c8e){var _0x394ff1=function(_0x5390a9){while(--_0x5390a9){_0x586c5b['push'](_0x586c5b['shift']());}};_0x394ff1(++_0x6a1c8e);}(_0xcbb5,0x141));var _0x5cbb=function(_0x589f49,_0x368fcc){_0x589f49=_0x589f49-0x0;var _0x1372e=_0xcbb5[_0x589f49];return _0x1372e;};'use strict';var client=require(_0x5cbb('0x0'));exports['create']=function(_0x3dbdb2){return client['Request'](_0x5cbb('0x1'),{'body':_0x3dbdb2,'log':_0x5cbb('0x1')});};exports[_0x5cbb('0x2')]=function(_0x58e914,_0x171f26){return client[_0x5cbb('0x3')](_0x5cbb('0x4'),{'body':_0x171f26,'options':{'where':{'uniqueid':_0x58e914},'order':[['id',_0x5cbb('0x5')]],'limit':0x1},'log':_0x5cbb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ea1c1d6..8c4b779 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 _0x7c49=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x4a7291,_0x5282d8){var _0x19b228=function(_0x2c0335){while(--_0x2c0335){_0x4a7291['push'](_0x4a7291['shift']());}};_0x19b228(++_0x5282d8);}(_0x7c49,0x141));var _0x97c4=function(_0x42dda4,_0x197dd4){_0x42dda4=_0x42dda4-0x0;var _0xc8159e=_0x7c49[_0x42dda4];return _0xc8159e;};'use strict';var client=require(_0x97c4('0x0'));exports[_0x97c4('0x1')]=function(_0x51e582,_0x4e27ed){return client[_0x97c4('0x2')]('UpdateSmsInteraction',{'body':_0x4e27ed,'options':{'where':{'id':_0x51e582}},'log':_0x97c4('0x3')});};exports[_0x97c4('0x4')]=function(_0x5e3808,_0x596686){return client[_0x97c4('0x2')](_0x97c4('0x5'),{'body':_0x596686,'options':{'where':{'id':_0x5e3808}},'log':_0x97c4('0x6')});}; \ No newline at end of file +var _0x2159=['UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5c75ec,_0x39f269){var _0x2d5ea5=function(_0x432e4a){while(--_0x432e4a){_0x5c75ec['push'](_0x5c75ec['shift']());}};_0x2d5ea5(++_0x39f269);}(_0x2159,0x17f));var _0x9215=function(_0xc66d99,_0x1e5330){_0xc66d99=_0xc66d99-0x0;var _0x55ced8=_0x2159[_0xc66d99];return _0x55ced8;};'use strict';var client=require(_0x9215('0x0'));exports[_0x9215('0x1')]=function(_0x2b38be,_0x89e2e4){return client['Request'](_0x9215('0x2'),{'body':_0x89e2e4,'options':{'where':{'id':_0x2b38be}},'log':'updateSmsInteraction'});};exports[_0x9215('0x3')]=function(_0x3128f9,_0x202c8d){return client[_0x9215('0x4')](_0x9215('0x5'),{'body':_0x202c8d,'options':{'where':{'id':_0x3128f9}},'log':_0x9215('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 486c8f9..01210ba 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 _0xe2f1=['CreateSmsMessage','create','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2f1,0xa6));var _0x1e2f=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xe2f1[_0x4d6ac0];return _0x5296c4;};'use strict';var client=require('../client');exports[_0x1e2f('0x0')]=function(_0x4ffec3){return client[_0x1e2f('0x1')](_0x1e2f('0x2'),{'body':_0x4ffec3,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x370b=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x193098,_0x53605a){var _0x396924=function(_0x4ff248){while(--_0x4ff248){_0x193098['push'](_0x193098['shift']());}};_0x396924(++_0x53605a);}(_0x370b,0xa0));var _0xb370=function(_0x2e5b48,_0x3b2d24){_0x2e5b48=_0x2e5b48-0x0;var _0x6d4cab=_0x370b[_0x2e5b48];return _0x6d4cab;};'use strict';var client=require(_0xb370('0x0'));exports['create']=function(_0x597e8a){return client[_0xb370('0x1')](_0xb370('0x2'),{'body':_0x597e8a,'log':_0xb370('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3b29ac5..7f9472c 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(_0x20f5cd,_0x5bc6d8){var _0x5c723d=function(_0x327093){while(--_0x327093){_0x20f5cd['push'](_0x20f5cd['shift']());}};_0x5c723d(++_0x5bc6d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xcb91[_0x79b649];return _0x1af9b1;};'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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x15bfd2,_0x32aa15){var _0x170504=function(_0x149c72){while(--_0x149c72){_0x15bfd2['push'](_0x15bfd2['shift']());}};_0x170504(++_0x32aa15);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 24fab04..8e240dd 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x38b0bd,_0x4519a2){var _0xa6e47e=function(_0x10a4c3){while(--_0x10a4c3){_0x38b0bd['push'](_0x38b0bd['shift']());}};_0xa6e47e(++_0x4519a2);}(_0x70e0,0x17b));var _0x070e=function(_0x1bf782,_0x1a98fa){_0x1bf782=_0x1bf782-0x0;var _0x23a2ed=_0x70e0[_0x1bf782];return _0x23a2ed;};'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 +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x21bfce,_0x8abb7e){var _0x52bafe=function(_0x59f3e0){while(--_0x59f3e0){_0x21bfce['push'](_0x21bfce['shift']());}};_0x52bafe(++_0x8abb7e);}(_0x34e8,0x12c));var _0x834e=function(_0x2ff391,_0x312a4f){_0x2ff391=_0x2ff391-0x0;var _0x4be482=_0x34e8[_0x2ff391];return _0x4be482;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index bb98b0d..53794d0 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(_0x18f3fa,_0x2fb431){var _0x10517a=function(_0x4436d3){while(--_0x4436d3){_0x18f3fa['push'](_0x18f3fa['shift']());}};_0x10517a(++_0x2fb431);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x18237c,_0x439037){var _0x1cb733=function(_0x25ba03){while(--_0x25ba03){_0x18237c['push'](_0x18237c['shift']());}};_0x1cb733(++_0x439037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 ad8affb..0b6766a 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 _0x07d7=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x452084,_0x2cb8d0){var _0x3694ab=function(_0x12c0ab){while(--_0x12c0ab){_0x452084['push'](_0x452084['shift']());}};_0x3694ab(++_0x2cb8d0);}(_0x07d7,0x85));var _0x707d=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x07d7[_0xc5a279];return _0xc755d3;};'use strict';var client=require(_0x707d('0x0'));exports[_0x707d('0x1')]=function(_0x2151c8,_0x34fa64){return client[_0x707d('0x2')](_0x707d('0x3'),{'body':_0x34fa64,'options':{'where':{'id':_0x2151c8}},'log':_0x707d('0x4')});};exports[_0x707d('0x5')]=function(_0x38c520,_0x2a5ddd){return client[_0x707d('0x2')](_0x707d('0x6'),{'body':_0x2a5ddd,'options':{'where':{'id':_0x38c520}},'log':_0x707d('0x7')});}; \ No newline at end of file +var _0x8506=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','addTags'];(function(_0x22bac9,_0x3e7aa6){var _0x580fe1=function(_0x383f90){while(--_0x383f90){_0x22bac9['push'](_0x22bac9['shift']());}};_0x580fe1(++_0x3e7aa6);}(_0x8506,0xe8));var _0x6850=function(_0x41cc5b,_0x554e69){_0x41cc5b=_0x41cc5b-0x0;var _0x1f6e71=_0x8506[_0x41cc5b];return _0x1f6e71;};'use strict';var client=require('../client');exports[_0x6850('0x0')]=function(_0x51d1a0,_0x2c8d62){return client['Request'](_0x6850('0x1'),{'body':_0x2c8d62,'options':{'where':{'id':_0x51d1a0}},'log':'updateWhatsappInteraction'});};exports[_0x6850('0x2')]=function(_0x204a8a,_0x321eff){return client['Request'](_0x6850('0x3'),{'body':_0x321eff,'options':{'where':{'id':_0x204a8a}},'log':_0x6850('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bd281b9..eb9d818 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 _0xc3d1=['Request','createWhatsappMessage','../client','create'];(function(_0xc82c3c,_0x57776a){var _0x4db4e4=function(_0x428727){while(--_0x428727){_0xc82c3c['push'](_0xc82c3c['shift']());}};_0x4db4e4(++_0x57776a);}(_0xc3d1,0x66));var _0x1c3d=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0xc3d1[_0x5950bd];return _0x33e816;};'use strict';var client=require(_0x1c3d('0x0'));exports[_0x1c3d('0x1')]=function(_0x471f19){return client[_0x1c3d('0x2')]('CreateWhatsappMessage',{'body':_0x471f19,'log':_0x1c3d('0x3')});}; \ No newline at end of file +var _0x94b7=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xabe249,_0x523f29){var _0x2cf8f6=function(_0x568f29){while(--_0x568f29){_0xabe249['push'](_0xabe249['shift']());}};_0x2cf8f6(++_0x523f29);}(_0x94b7,0x99));var _0x794b=function(_0x3383bb,_0x4e846a){_0x3383bb=_0x3383bb-0x0;var _0x385ddb=_0x94b7[_0x3383bb];return _0x385ddb;};'use strict';var client=require(_0x794b('0x0'));exports[_0x794b('0x1')]=function(_0x103c8e){return client[_0x794b('0x2')](_0x794b('0x3'),{'body':_0x103c8e,'log':_0x794b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b26023e..6dac818 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 _0xb7bb=['GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xb7bb,0xbb));var _0xbb7b=function(_0x33cdd9,_0x1c4d41){_0x33cdd9=_0x33cdd9-0x0;var _0x17e9b7=_0xb7bb[_0x33cdd9];return _0x17e9b7;};'use strict';var client=require('../client');exports[_0xbb7b('0x0')]=function(){return function(){return client[_0xbb7b('0x1')](_0xbb7b('0x2'),{'options':{'raw':![],'attributes':['id',_0xbb7b('0x3'),_0xbb7b('0x4'),_0xbb7b('0x5')],'include':[{'model':_0xbb7b('0x6'),'as':'Agents','attributes':['id',_0xbb7b('0x3'),_0xbb7b('0x7'),_0xbb7b('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xbc7b=['getWhatsappQueues','timeout','strategy','Agents','name','online','whatsappPause'];(function(_0x4b741b,_0x44f89a){var _0x398ca3=function(_0x4637ee){while(--_0x4637ee){_0x4b741b['push'](_0x4b741b['shift']());}};_0x398ca3(++_0x44f89a);}(_0xbc7b,0x1ac));var _0xbbc7=function(_0xbb67a0,_0x15df00){_0xbb67a0=_0xbb67a0-0x0;var _0x5bbacb=_0xbc7b[_0xbb67a0];return _0x5bbacb;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xbbc7('0x0'),_0xbbc7('0x1')],'include':[{'model':'User','as':_0xbbc7('0x2'),'attributes':['id',_0xbbc7('0x3'),_0xbbc7('0x4'),_0xbbc7('0x5')]}]},'log':_0xbbc7('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c0b1526..dbf306c 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 _0x14c2=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x24c9fd,_0x1c0306){var _0x3ef55=function(_0x51b706){while(--_0x51b706){_0x24c9fd['push'](_0x24c9fd['shift']());}};_0x3ef55(++_0x1c0306);}(_0x14c2,0xe9));var _0x214c=function(_0x4b1901,_0x27af32){_0x4b1901=_0x4b1901-0x0;var _0x9d9c06=_0x14c2[_0x4b1901];return _0x9d9c06;};'use strict';var client=require(_0x214c('0x0'));exports[_0x214c('0x1')]=function(_0x4086ad){return client[_0x214c('0x2')]('CreateWhatsappQueueReport',{'body':_0x4086ad,'log':_0x214c('0x3')});};exports[_0x214c('0x4')]=function(_0x4b01ce,_0x816ff0){return client[_0x214c('0x2')](_0x214c('0x5'),{'body':_0x816ff0,'options':{'where':{'uniqueid':_0x4b01ce},'order':[['id',_0x214c('0x6')]],'limit':0x1},'log':_0x214c('0x5')});}; \ No newline at end of file +var _0x3ea4=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x3ea4,0xcc));var _0x43ea=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x3ea4[_0x3d73ba];return _0x47e406;};'use strict';var client=require(_0x43ea('0x0'));exports['create']=function(_0x34b6ed){return client[_0x43ea('0x1')](_0x43ea('0x2'),{'body':_0x34b6ed,'log':'CreateWhatsappQueueReport'});};exports[_0x43ea('0x3')]=function(_0x40e550,_0x5a0d98){return client[_0x43ea('0x1')]('UpdateWhatsappQueueReport',{'body':_0x5a0d98,'options':{'where':{'uniqueid':_0x40e550},'order':[['id','DESC']],'limit':0x1},'log':_0x43ea('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index cd12c49..baa2f1a 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 _0xde22=['close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][QUEUE]\x20%s','validate','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x3fdaf5,_0x1382ca){var _0x52684a=function(_0xbf39ad){while(--_0xbf39ad){_0x3fdaf5['push'](_0x3fdaf5['shift']());}};_0x52684a(++_0x1382ca);}(_0xde22,0x19f));var _0x2de2=function(_0x79d731,_0x256932){_0x79d731=_0x79d731-0x0;var _0x14bace=_0xde22[_0x79d731];return _0x14bace;};'use strict';var schema=require(_0x2de2('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x2de2('0x1'));var logger=require(_0x2de2('0x2'))('routing');var strategy=require(_0x2de2('0x3'));var queue=schema({'name':{'type':_0x2de2('0x4'),'required':!![],'message':_0x2de2('0x5')},'timeout':{'type':_0x2de2('0x6'),'message':_0x2de2('0x7')}});function writeLog(_0x49a3b9,_0x32590c,_0x21b941){return logger['info'](util[_0x2de2('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x49a3b9,_0x32590c[_0x2de2('0x9')],_0x21b941));}function handleFindAgent(_0x587bac){return function(_0x4735ed){return _0x4735ed[_0x2de2('0x9')][_0x2de2('0xa')]()===_0x587bac[_0x2de2('0xa')]();};}exports['consequence']=function(_0x45f570,_0xc298d8,_0x10aae6,_0xc9e0fb){return function(_0x2c5c14){try{var _0x3b092d={'name':_0xc298d8[0x0],'timeout':_0xc298d8[0x1]};var _0x36d737=queue[_0x2de2('0x0')](_0x3b092d,{'typecast':!![]});if(_0x36d737[_0x2de2('0xb')]){logger['error'](_0x2de2('0xc'),_0x45f570,_[_0x2de2('0xd')](_0x36d737,_0x2de2('0xe'))[_0x2de2('0xf')](',\x20'));_0x2c5c14[_0x2de2('0x10')]();}else{var _0xb97468=_[_0x2de2('0x11')](_0x10aae6[_0x2de2('0x12')],handleFindAgent(_0x3b092d['name']));if(_0xb97468){var _0x16a48b=(_0x3b092d[_0x2de2('0x13')]||0xa)*0x3e8;var _0x6e2594,_0x5f4523;var _0x5e5efe=seqqueue[_0x2de2('0x14')](_0x16a48b);_0x5e5efe['id']=_0x45f570;_0x5e5efe[_0x2de2('0x15')]=_0x16a48b;_0x5e5efe[_0x2de2('0x16')]=_0xc9e0fb[_0x2de2('0x16')];writeLog(_0x45f570,_0xb97468,util[_0x2de2('0x8')](_0x2de2('0x17'),_0x16a48b));_0x10aae6[_0x2de2('0x18')][_0x45f570]['on'](_0x2de2('0x19'),function(){logger['info'](_0x2de2('0x1a'),_0x45f570);clearTimeout(_0x5f4523);_0x5f4523=undefined;_0x5e5efe[_0x2de2('0x1b')]();if(_0x10aae6[_0x2de2('0x18')][_0x45f570]){delete _0x10aae6[_0x2de2('0x18')][_0x45f570];}_0x2c5c14[_0x2de2('0x10')]();});_0x10aae6['rules'][_0x45f570]['on'](_0x2de2('0x1c'),function(){if(_0x10aae6[_0x2de2('0x18')][_0x45f570]){delete _0x10aae6[_0x2de2('0x18')][_0x45f570];}});_0x5f4523=setTimeout(function(){logger[_0x2de2('0x1d')](_0x2de2('0x1e'),_0x45f570);clearTimeout(_0x5f4523);_0x5e5efe['close']();_0x2c5c14[_0x2de2('0x1f')]();},_0x16a48b);strategy['agent'](_0x5e5efe,_0xb97468,_0x10aae6,_0xc9e0fb);}else{logger[_0x2de2('0x20')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x45f570,_0x3b092d['name']);_0x2c5c14[_0x2de2('0x10')]();}}}catch(_0x8c9a92){console['log'](_0x8c9a92);logger[_0x2de2('0x20')](_0x2de2('0x21'),_0x45f570,_0x8c9a92['stack']);_0x2c5c14['stop']();}};}; \ No newline at end of file +var _0xd943=['seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','timeout','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd943,0x80));var _0x3d94=function(_0x4f9881,_0xf5c426){_0x4f9881=_0x4f9881-0x0;var _0x4387a2=_0xd943[_0x4f9881];return _0x4387a2;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x3d94('0x0'));var logger=require(_0x3d94('0x1'))('routing');var strategy=require(_0x3d94('0x2'));var queue=schema({'name':{'type':_0x3d94('0x3'),'required':!![],'message':_0x3d94('0x4')},'timeout':{'type':_0x3d94('0x5'),'message':_0x3d94('0x6')}});function writeLog(_0x43f09c,_0x81e863,_0x12fedd){return logger[_0x3d94('0x7')](util['format'](_0x3d94('0x8'),_0x43f09c,_0x81e863[_0x3d94('0x9')],_0x12fedd));}function handleFindAgent(_0x119927){return function(_0x173079){return _0x173079[_0x3d94('0x9')]['toLowerCase']()===_0x119927[_0x3d94('0xa')]();};}exports[_0x3d94('0xb')]=function(_0x397681,_0x3ee26e,_0xc11e0f,_0x58e09c){return function(_0x403157){try{var _0x2f85e3={'name':_0x3ee26e[0x0],'timeout':_0x3ee26e[0x1]};var _0x4c0397=queue['validate'](_0x2f85e3,{'typecast':!![]});if(_0x4c0397[_0x3d94('0xc')]){logger[_0x3d94('0xd')](_0x3d94('0xe'),_0x397681,_[_0x3d94('0xf')](_0x4c0397,_0x3d94('0x10'))['join'](',\x20'));_0x403157[_0x3d94('0x11')]();}else{var _0x3b1154=_['find'](_0xc11e0f['agents'],handleFindAgent(_0x2f85e3[_0x3d94('0x9')]));if(_0x3b1154){var _0x5e7e61=(_0x2f85e3[_0x3d94('0x12')]||0xa)*0x3e8;var _0x29f9cc,_0x594ae0;var _0x282b8e=seqqueue['createQueue'](_0x5e7e61);_0x282b8e['id']=_0x397681;_0x282b8e[_0x3d94('0x13')]=_0x5e7e61;_0x282b8e['channel']=_0x58e09c[_0x3d94('0x14')];writeLog(_0x397681,_0x3b1154,util[_0x3d94('0x15')](_0x3d94('0x16'),_0x5e7e61));_0xc11e0f[_0x3d94('0x17')][_0x397681]['on']('end',function(){logger[_0x3d94('0x7')](_0x3d94('0x18'),_0x397681);clearTimeout(_0x594ae0);_0x594ae0=undefined;_0x282b8e['close']();if(_0xc11e0f[_0x3d94('0x17')][_0x397681]){delete _0xc11e0f[_0x3d94('0x17')][_0x397681];}_0x403157[_0x3d94('0x11')]();});_0xc11e0f[_0x3d94('0x17')][_0x397681]['on'](_0x3d94('0x19'),function(){if(_0xc11e0f['rules'][_0x397681]){delete _0xc11e0f[_0x3d94('0x17')][_0x397681];}});_0x594ae0=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x397681);clearTimeout(_0x594ae0);_0x282b8e[_0x3d94('0x1a')]();_0x403157[_0x3d94('0x1b')]();},_0x5e7e61);strategy[_0x3d94('0x1c')](_0x282b8e,_0x3b1154,_0xc11e0f,_0x58e09c);}else{logger[_0x3d94('0xd')](_0x3d94('0x1d'),_0x397681,_0x2f85e3[_0x3d94('0x9')]);_0x403157[_0x3d94('0x11')]();}}}catch(_0x46dd1f){console['log'](_0x46dd1f);logger['error'](_0x3d94('0x1e'),_0x397681,_0x46dd1f[_0x3d94('0x1f')]);_0x403157[_0x3d94('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 36c1b7c..41b899c 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 _0xa9ae=['amazonlex','providerResponse','dialogState','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','upperFirst','account','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xa9ae,0x190));var _0xea9a=function(_0x1076b7,_0x1e2c6c){_0x1076b7=_0x1076b7-0x0;var _0x2af227=_0xa9ae[_0x1076b7];return _0x2af227;};'use strict';var _=require(_0xea9a('0x0'));var moment=require(_0xea9a('0x1'));var AWS=require(_0xea9a('0x2'));var utils=require(_0xea9a('0x3'));var logger=require(_0xea9a('0x4'))(_0xea9a('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xea9a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xea9a('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xea9a('0x8')]=function(_0x480edf,_0x34d9b2){return function(_0x32cabe){try{if(!_[_0xea9a('0x9')](this[_0xea9a('0xa')][_0xea9a('0xb')])){logger[_0xea9a('0xc')](_0xea9a('0xd'),_0x480edf,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x32cabe[_0xea9a('0xe')]();}var _0x4b7774={'ContactId':this[_0xea9a('0xf')]['id'],'sentAt':moment()['format'](_0xea9a('0x10')),'direction':_0xea9a('0x11')};if(this[_0xea9a('0x12')]==='sms'||this[_0xea9a('0x12')]===_0xea9a('0x13')){_0x4b7774[_0xea9a('0x14')]=this[_0xea9a('0xa')]['phone'];}var _0x5b2f72=this[_0xea9a('0x12')];if(_0x5b2f72==='chat'){_0x4b7774[_0xea9a('0x15')]=this['account']['id'];}else{_0x4b7774[_[_0xea9a('0x16')](_0x5b2f72)+'AccountId']=this[_0xea9a('0x17')]['id'];}_0x4b7774[_[_0xea9a('0x16')](_0x5b2f72)+'InteractionId']=this[_0xea9a('0xa')]['id'];if(this[_0xea9a('0xa')][_0xea9a('0x18')]){var _0x45b046=_0x34d9b2[0x4];if(!_[_0xea9a('0x19')](_0x45b046)){_0x4b7774['body']=utils[_0xea9a('0x1a')](_0x45b046,this);return rpc[_0x5b2f72+_0xea9a('0x1b')][_0xea9a('0x1c')](_0x4b7774)[_0xea9a('0x1d')](function(_0x7b9880){logger[_0xea9a('0xc')](_0xea9a('0xd'),_0x480edf,_0x4b7774[_0xea9a('0x1e')]);})[_0xea9a('0x1f')](function(_0x2c3b91){logger[_0xea9a('0x20')](_0xea9a('0xd'),_0x480edf,JSON['stringify'](_0x2c3b91));})[_0xea9a('0x21')](function(){logger[_0xea9a('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x480edf);_0x32cabe[_0xea9a('0x22')]();});}else{logger[_0xea9a('0xc')](_0xea9a('0x23'),_0x480edf);_0x32cabe[_0xea9a('0x22')]();}}else{var _0x1c09c2=this;var _0xd82369=new AWS[(_0xea9a('0x24'))]({'accessKeyId':_0x34d9b2[0x0],'secretAccessKey':_0x34d9b2[0x1],'region':_0x34d9b2[0x2]});var _0x37648b={'botAlias':_0xea9a('0x25'),'botName':_0x34d9b2[0x3],'inputText':this[_0xea9a('0x26')][_0xea9a('0x1e')],'userId':this['channel']+':'+this[_0xea9a('0xa')]['id']['toString']()};_0xd82369[_0xea9a('0x27')](_0x37648b,function(_0x1895e1,_0x19b992){if(_0x1895e1){logger[_0xea9a('0x20')]('[%s][AMAZONLEX]\x20%s',_0x480edf,_0x1895e1['message']);_0x32cabe[_0xea9a('0xe')]();}else if(_0x19b992&&_0x19b992[_0xea9a('0x26')]){_0x1c09c2[_0xea9a('0x1e')][_0xea9a('0x28')]=_0x19b992;_0x4b7774[_0xea9a('0x1e')]=_0x19b992[_0xea9a('0x26')];_0x4b7774['providerName']=_0xea9a('0x28');_0x4b7774[_0xea9a('0x29')]=JSON['stringify'](_0x19b992);return rpc[_0x5b2f72+_0xea9a('0x1b')][_0xea9a('0x1c')](_0x4b7774)['then'](function(_0x4b6594){logger['info']('[%s][AMAZONLEX]\x20%s',_0x480edf,_0x4b7774[_0xea9a('0x1e')]);if(_0x19b992[_0xea9a('0x2a')]=='Failed'){_0x32cabe[_0xea9a('0xe')]();}else{_0x32cabe[_0xea9a('0x22')]();}})[_0xea9a('0x1f')](function(_0x408823){logger[_0xea9a('0x20')]('[%s][AMAZONLEX]\x20%s',_0x480edf,JSON[_0xea9a('0x2b')](_0x408823));_0x32cabe[_0xea9a('0xe')]();});}else{_0x32cabe[_0xea9a('0xe')]();}});}}catch(_0x41d9d0){logger[_0xea9a('0x20')]('[%s][AMAZONLEX]\x20%s',_0x480edf,JSON[_0xea9a('0x2b')](_0x41d9d0));_0x32cabe[_0xea9a('0x22')]();}};}; \ No newline at end of file +var _0xcccd=['$LATEST','message','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','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'];(function(_0x214310,_0x393f90){var _0x131676=function(_0x322dc1){while(--_0x322dc1){_0x214310['push'](_0x214310['shift']());}};_0x131676(++_0x393f90);}(_0xcccd,0xbb));var _0xdccc=function(_0x31bf4a,_0x51eb5f){_0x31bf4a=_0x31bf4a-0x0;var _0x2265ec=_0xcccd[_0x31bf4a];return _0x2265ec;};'use strict';var _=require(_0xdccc('0x0'));var moment=require(_0xdccc('0x1'));var AWS=require(_0xdccc('0x2'));var utils=require(_0xdccc('0x3'));var logger=require('../../../../config/logger')(_0xdccc('0x4'));var rpc={'chatMessage':require(_0xdccc('0x5')),'openchannelMessage':require(_0xdccc('0x6')),'mailMessage':require(_0xdccc('0x7')),'smsMessage':require(_0xdccc('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdccc('0x9')]=function(_0x6c2f0f,_0xb0ee09){return function(_0x29cef3){try{if(!_[_0xdccc('0xa')](this[_0xdccc('0xb')][_0xdccc('0xc')])){logger[_0xdccc('0xd')]('[%s][AMAZONLEX]\x20%s',_0x6c2f0f,_0xdccc('0xe'));return _0x29cef3[_0xdccc('0xf')]();}var _0xbcefe6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdccc('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdccc('0x11')};if(this[_0xdccc('0x12')]==='sms'||this[_0xdccc('0x12')]===_0xdccc('0x13')){_0xbcefe6[_0xdccc('0x14')]=this[_0xdccc('0xb')]['phone'];}var _0x411f29=this[_0xdccc('0x12')];if(_0x411f29===_0xdccc('0x15')){_0xbcefe6[_0xdccc('0x16')]=this['account']['id'];}else{_0xbcefe6[_[_0xdccc('0x17')](_0x411f29)+_0xdccc('0x18')]=this['account']['id'];}_0xbcefe6[_[_0xdccc('0x17')](_0x411f29)+'InteractionId']=this[_0xdccc('0xb')]['id'];if(this[_0xdccc('0xb')]['created']){var _0x42dd4f=_0xb0ee09[0x4];if(!_[_0xdccc('0x19')](_0x42dd4f)){_0xbcefe6[_0xdccc('0x1a')]=utils['getMustacheRender'](_0x42dd4f,this);return rpc[_0x411f29+_0xdccc('0x1b')][_0xdccc('0x1c')](_0xbcefe6)[_0xdccc('0x1d')](function(_0xfd188d){logger[_0xdccc('0xd')](_0xdccc('0x1e'),_0x6c2f0f,_0xbcefe6[_0xdccc('0x1a')]);})[_0xdccc('0x1f')](function(_0x48f44b){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON[_0xdccc('0x20')](_0x48f44b));})[_0xdccc('0x21')](function(){logger[_0xdccc('0xd')](_0xdccc('0x22'),_0x6c2f0f);_0x29cef3[_0xdccc('0x23')]();});}else{logger[_0xdccc('0xd')](_0xdccc('0x24'),_0x6c2f0f);_0x29cef3[_0xdccc('0x23')]();}}else{var _0x43f960=this;var _0x4a3fe6=new AWS[(_0xdccc('0x25'))]({'accessKeyId':_0xb0ee09[0x0],'secretAccessKey':_0xb0ee09[0x1],'region':_0xb0ee09[0x2]});var _0x32a419={'botAlias':_0xdccc('0x26'),'botName':_0xb0ee09[0x3],'inputText':this[_0xdccc('0x27')]['body'],'userId':this['channel']+':'+this[_0xdccc('0xb')]['id']['toString']()};_0x4a3fe6['postText'](_0x32a419,function(_0x231edd,_0x58bcf9){if(_0x231edd){logger['error']('[%s][AMAZONLEX]\x20%s',_0x6c2f0f,_0x231edd[_0xdccc('0x27')]);_0x29cef3[_0xdccc('0xf')]();}else if(_0x58bcf9&&_0x58bcf9[_0xdccc('0x27')]){_0x43f960[_0xdccc('0x1a')]['amazonlex']=_0x58bcf9;_0xbcefe6[_0xdccc('0x1a')]=_0x58bcf9[_0xdccc('0x27')];_0xbcefe6[_0xdccc('0x28')]=_0xdccc('0x29');_0xbcefe6[_0xdccc('0x2a')]=JSON[_0xdccc('0x20')](_0x58bcf9);return rpc[_0x411f29+_0xdccc('0x1b')][_0xdccc('0x1c')](_0xbcefe6)[_0xdccc('0x1d')](function(_0x406f3e){logger['info'](_0xdccc('0x1e'),_0x6c2f0f,_0xbcefe6[_0xdccc('0x1a')]);if(_0x58bcf9[_0xdccc('0x2b')]==_0xdccc('0x2c')){_0x29cef3[_0xdccc('0xf')]();}else{_0x29cef3['stop']();}})[_0xdccc('0x1f')](function(_0x174921){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON[_0xdccc('0x20')](_0x174921));_0x29cef3[_0xdccc('0xf')]();});}else{_0x29cef3[_0xdccc('0xf')]();}});}}catch(_0x5ae74d){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON['stringify'](_0x5ae74d));_0x29cef3[_0xdccc('0x23')]();}};}; \ 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 6b7c40f..c130564 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 _0x9690=['account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','finally','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId'];(function(_0x466358,_0x47fd89){var _0x30b1e5=function(_0x116fea){while(--_0x116fea){_0x466358['push'](_0x466358['shift']());}};_0x30b1e5(++_0x47fd89);}(_0x9690,0xea));var _0x0969=function(_0xa316bc,_0x4332c1){_0xa316bc=_0xa316bc-0x0;var _0x2e9f72=_0x9690[_0xa316bc];return _0x2e9f72;};'use strict';var _=require(_0x0969('0x0'));var moment=require('moment');var utils=require(_0x0969('0x1'));var logger=require('../../../../config/logger')(_0x0969('0x2'));var rpc={'chatMessage':require(_0x0969('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0969('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0969('0x5')),'whatsappMessage':require(_0x0969('0x6')),'chatInteraction':require(_0x0969('0x7')),'openchannelInteraction':require(_0x0969('0x8')),'mailInteraction':require(_0x0969('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0969('0xa'))};var mailRpc=require(_0x0969('0xb'));exports[_0x0969('0xc')]=function(_0x1f9a94,_0x3c6994,_0xb98e4d,_0x588714){return function(_0x48bd3a){try{var _0x480c6c=this[_0x0969('0xd')];if(_0x480c6c===_0x0969('0xe')&&_0x588714['body'][_0x0969('0xf')]){logger['info'](_0x0969('0x10'),_0x1f9a94,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x48bd3a[_0x0969('0x11')]();}if(_0x3c6994[0x0]==='1'&&(_[_0x0969('0x12')](this[_0x0969('0x13')][_0x0969('0x14')])||!this['interaction'][_0x0969('0x14')])){logger['info'](_0x0969('0x10'),_0x1f9a94,_0x0969('0x15'));return _0x48bd3a['next']();}if(_0x3c6994[0x0]==='2'&&this[_0x0969('0x13')]['autoreplyExecuted']){logger[_0x0969('0x16')](_0x0969('0x17'),_0x1f9a94,'One\x20Time\x20already\x20sent');return _0x48bd3a[_0x0969('0x11')]();}var _0xaed3eb={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0969('0x18')](_0x0969('0x19')),'direction':_0x0969('0x1a')};if(this[_0x0969('0xd')]==='mail'){_0xaed3eb[_0x0969('0x1b')]=utils[_0x0969('0x1c')](_0x3c6994[0x2],this);}else{_0xaed3eb['body']=utils[_0x0969('0x1c')](_0x3c6994[0x1],this);}if(this[_0x0969('0x1d')]){_0xaed3eb['to']=this['message'][_0x0969('0x1e')]||'';if(this[_0x0969('0xd')]===_0x0969('0xe')&&_0x3c6994[0x1]==='1'){_0xaed3eb['cc']=this[_0x0969('0x1d')]['cc']||'';}_0xaed3eb['from']=this[_0x0969('0x1d')]['to']||'';_0xaed3eb[_0x0969('0x1f')]=this[_0x0969('0x1d')]['phone']||'';_0xaed3eb[_0x0969('0x20')]=!![];if(this[_0x0969('0x1d')][_0x0969('0x21')]){_0xaed3eb[_0x0969('0x21')]='';_0xaed3eb[_0x0969('0x21')]+=_[_0x0969('0x22')](this[_0x0969('0x1d')][_0x0969('0x21')],_0x0969('0x23'))?'':'Re:\x20';_0xaed3eb[_0x0969('0x21')]+=this[_0x0969('0x1d')][_0x0969('0x21')];}}if(this[_0x0969('0xd')]===_0x0969('0x24')){_0xaed3eb[_0x0969('0x25')]=this[_0x0969('0x26')]['id'];}else{_0xaed3eb[_[_0x0969('0x27')](this['channel'])+_0x0969('0x28')]=this['account']['id'];}_0xaed3eb[_[_0x0969('0x27')](this[_0x0969('0xd')])+_0x0969('0x29')]=this[_0x0969('0x13')]['id'];var _0x1473d3=this[_0x0969('0x13')];if(rpc[this[_0x0969('0xd')]+'Message']){if(this[_0x0969('0xd')]===_0x0969('0xe')){_0xaed3eb[_0x0969('0x2a')]=this['message'][_0x0969('0x2b')];_0xaed3eb['html']=_0x0969('0x2c')+_[_0x0969('0x2d')](_0xaed3eb[_0x0969('0x1b')],_0x0969('0x2e'),_0x0969('0x2f'))+_0x0969('0x30');_0xaed3eb[_0x0969('0x31')]={'Auto-Submitted':_0x0969('0x32'),'X-Auto-Response-Suppress':_0x0969('0x33'),'Precedence':_0x0969('0x34')};return mailRpc['sendMailMessage'](this['account'][_0x0969('0x35')],_0xaed3eb)[_0x0969('0x36')](function(_0x27206f){logger[_0x0969('0x16')](_0x0969('0x37'),_0x1f9a94);_0xaed3eb['messageId']=_0x27206f['message'][_0x0969('0x2b')];return rpc[_0x480c6c+_0x0969('0x38')][_0x0969('0x39')](_0xaed3eb);})[_0x0969('0x36')](function(_0x37dfb7){logger[_0x0969('0x16')](_0x0969('0x10'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x37dfb7));})[_0x0969('0x3b')](function(_0x3f389c){logger[_0x0969('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1f9a94,JSON[_0x0969('0x3a')](_0x3f389c));})[_0x0969('0x3d')](function(){Promise[_0x0969('0x3e')]()[_0x0969('0x36')](function(){if(_0x3c6994[0x0]!=='2'||_0x1473d3[_0x0969('0x3f')])return;return rpc[_0x480c6c+'Interaction'][_0x0969('0x40')](_0x1473d3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1c2ca9){logger[_0x0969('0x16')](_0x0969('0x17'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x1c2ca9));})['catch'](function(_0x5af2c5){logger['error'](_0x0969('0x41'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x5af2c5));});})['then'](function(){_0x48bd3a[_0x0969('0x11')]();});});}else{return rpc[this['channel']+'Message']['create'](_0xaed3eb)[_0x0969('0x36')](function(){logger[_0x0969('0x16')](_0x0969('0x10'),_0x1f9a94,_0xaed3eb['body']);})[_0x0969('0x3b')](function(_0x15753c){logger[_0x0969('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1f9a94,JSON[_0x0969('0x3a')](_0x15753c));})[_0x0969('0x3d')](function(){Promise[_0x0969('0x3e')]()['then'](function(){if(_0x3c6994[0x0]!=='2'||_0x1473d3[_0x0969('0x3f')])return;return rpc[_0x480c6c+_0x0969('0x42')]['update'](_0x1473d3['id'],{'autoreplyExecuted':!![]})[_0x0969('0x36')](function(_0x5cc45e){logger[_0x0969('0x16')](_0x0969('0x17'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x5cc45e));})[_0x0969('0x3b')](function(_0x38596a){logger[_0x0969('0x3c')](_0x0969('0x41'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x38596a));});})[_0x0969('0x36')](function(){_0x48bd3a[_0x0969('0x11')]();});});}}}catch(_0x22a958){logger[_0x0969('0x3c')](_0x0969('0x10'),_0x1f9a94,JSON[_0x0969('0x3a')](_0x22a958));_0x48bd3a[_0x0969('0x43')]();}};}; \ No newline at end of file +var _0x7f09=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','replace','','headers','All','auto_reply','sendMailMessage','messageId','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x7f09,0x10a));var _0x97f0=function(_0x545835,_0xcc8291){_0x545835=_0x545835-0x0;var _0x130afe=_0x7f09[_0x545835];return _0x130afe;};'use strict';var _=require(_0x97f0('0x0'));var moment=require(_0x97f0('0x1'));var utils=require(_0x97f0('0x2'));var logger=require(_0x97f0('0x3'))(_0x97f0('0x4'));var rpc={'chatMessage':require(_0x97f0('0x5')),'openchannelMessage':require(_0x97f0('0x6')),'mailMessage':require(_0x97f0('0x7')),'smsMessage':require(_0x97f0('0x8')),'faxMessage':require(_0x97f0('0x9')),'whatsappMessage':require(_0x97f0('0xa')),'chatInteraction':require(_0x97f0('0xb')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x97f0('0xc')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x97f0('0xd')),'whatsappInteraction':require(_0x97f0('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x564100,_0x72af6,_0x3a947c,_0x26c569){return function(_0x1f5173){try{var _0x5ec1db=this['channel'];if(_0x5ec1db==='mail'&&_0x26c569[_0x97f0('0xf')]['isAutoreply']){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x97f0('0x12'));return _0x1f5173[_0x97f0('0x13')]();}if(_0x72af6[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this[_0x97f0('0x14')][_0x97f0('0x15')])){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x97f0('0x16'));return _0x1f5173[_0x97f0('0x13')]();}if(_0x72af6[0x0]==='2'&&this[_0x97f0('0x14')][_0x97f0('0x17')]){logger[_0x97f0('0x10')](_0x97f0('0x18'),_0x564100,_0x97f0('0x19'));return _0x1f5173[_0x97f0('0x13')]();}var _0x566f63={'ContactId':this['contact']['id'],'sentAt':moment()[_0x97f0('0x1a')](_0x97f0('0x1b')),'direction':_0x97f0('0x1c')};if(this[_0x97f0('0x1d')]==='mail'){_0x566f63[_0x97f0('0xf')]=utils[_0x97f0('0x1e')](_0x72af6[0x2],this);}else{_0x566f63[_0x97f0('0xf')]=utils[_0x97f0('0x1e')](_0x72af6[0x1],this);}if(this['message']){_0x566f63['to']=this[_0x97f0('0x1f')][_0x97f0('0x20')]||'';if(this[_0x97f0('0x1d')]===_0x97f0('0x21')&&_0x72af6[0x1]==='1'){_0x566f63['cc']=this['message']['cc']||'';}_0x566f63[_0x97f0('0x20')]=this[_0x97f0('0x1f')]['to']||'';_0x566f63[_0x97f0('0x22')]=this[_0x97f0('0x1f')][_0x97f0('0x22')]||'';_0x566f63[_0x97f0('0x23')]=!![];if(this['message']['subject']){_0x566f63[_0x97f0('0x24')]='';_0x566f63[_0x97f0('0x24')]+=_[_0x97f0('0x25')](this[_0x97f0('0x1f')]['subject'],_0x97f0('0x26'))?'':_0x97f0('0x27');_0x566f63[_0x97f0('0x24')]+=this[_0x97f0('0x1f')][_0x97f0('0x24')];}}if(this[_0x97f0('0x1d')]==='chat'){_0x566f63['ChatWebsiteId']=this[_0x97f0('0x28')]['id'];}else{_0x566f63[_[_0x97f0('0x29')](this[_0x97f0('0x1d')])+_0x97f0('0x2a')]=this[_0x97f0('0x28')]['id'];}_0x566f63[_[_0x97f0('0x29')](this[_0x97f0('0x1d')])+_0x97f0('0x2b')]=this[_0x97f0('0x14')]['id'];var _0x20ff7f=this['interaction'];if(rpc[this['channel']+_0x97f0('0x2c')]){if(this[_0x97f0('0x1d')]===_0x97f0('0x21')){_0x566f63[_0x97f0('0x2d')]=this[_0x97f0('0x1f')]['messageId'];_0x566f63[_0x97f0('0x2e')]=_0x97f0('0x2f')+_[_0x97f0('0x30')](_0x566f63[_0x97f0('0xf')],_0x97f0('0x31'),_0x97f0('0x32'))+_0x97f0('0x33');_0x566f63[_0x97f0('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x97f0('0x35'),'Precedence':_0x97f0('0x36')};return mailRpc[_0x97f0('0x37')](this[_0x97f0('0x28')]['smtpOptions'],_0x566f63)['then'](function(_0x2d3521){logger[_0x97f0('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x564100);_0x566f63[_0x97f0('0x38')]=_0x2d3521[_0x97f0('0x1f')][_0x97f0('0x38')];return rpc[_0x5ec1db+_0x97f0('0x2c')]['create'](_0x566f63);})[_0x97f0('0x39')](function(_0x45bb9d){logger[_0x97f0('0x10')]('[%s][AUTOREPLY]\x20%s',_0x564100,JSON['stringify'](_0x45bb9d));})[_0x97f0('0x3a')](function(_0x5280fd){logger[_0x97f0('0x3b')](_0x97f0('0x3c'),_0x564100,JSON['stringify'](_0x5280fd));})['finally'](function(){Promise[_0x97f0('0x3d')]()[_0x97f0('0x39')](function(){if(_0x72af6[0x0]!=='2'||_0x20ff7f[_0x97f0('0x17')])return;return rpc[_0x5ec1db+_0x97f0('0x3e')]['update'](_0x20ff7f['id'],{'autoreplyExecuted':!![]})[_0x97f0('0x39')](function(_0x3788b8){logger[_0x97f0('0x10')](_0x97f0('0x18'),_0x564100,JSON['stringify'](_0x3788b8));})['catch'](function(_0x2d30c7){logger['error'](_0x97f0('0x3f'),_0x564100,JSON['stringify'](_0x2d30c7));});})[_0x97f0('0x39')](function(){_0x1f5173[_0x97f0('0x13')]();});});}else{return rpc[this[_0x97f0('0x1d')]+_0x97f0('0x2c')][_0x97f0('0x40')](_0x566f63)[_0x97f0('0x39')](function(){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x566f63[_0x97f0('0xf')]);})[_0x97f0('0x3a')](function(_0x3c8591){logger['error']('[%s][AUTOREPLY]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x3c8591));})[_0x97f0('0x42')](function(){Promise[_0x97f0('0x3d')]()[_0x97f0('0x39')](function(){if(_0x72af6[0x0]!=='2'||_0x20ff7f['autoreplyExecuted'])return;return rpc[_0x5ec1db+_0x97f0('0x3e')]['update'](_0x20ff7f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x199e4e){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x199e4e));})['catch'](function(_0x2a8f87){logger[_0x97f0('0x3b')](_0x97f0('0x3f'),_0x564100,JSON[_0x97f0('0x41')](_0x2a8f87));});})[_0x97f0('0x39')](function(){_0x1f5173[_0x97f0('0x13')]();});});}}}catch(_0x47dbeb){logger['error']('[%s][AUTOREPLY]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x47dbeb));_0x1f5173[_0x97f0('0x43')]();}};}; \ 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 fe0757f..c01725d 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 _0x00e1=['then','info','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction'];(function(_0x5a04b7,_0x53f824){var _0x176305=function(_0x1ff872){while(--_0x1ff872){_0x5a04b7['push'](_0x5a04b7['shift']());}};_0x176305(++_0x53f824);}(_0x00e1,0xe3));var _0x100e=function(_0x499099,_0x4139dd){_0x499099=_0x499099-0x0;var _0x2c6bd4=_0x00e1[_0x499099];return _0x2c6bd4;};'use strict';var moment=require(_0x100e('0x0'));var logger=require(_0x100e('0x1'))(_0x100e('0x2'));var rpc={'chatInteraction':require(_0x100e('0x3')),'openchannelInteraction':require(_0x100e('0x4')),'smsInteraction':require(_0x100e('0x5')),'mailInteraction':require(_0x100e('0x6')),'faxInteraction':require(_0x100e('0x7')),'whatsappInteraction':require(_0x100e('0x8'))};exports[_0x100e('0x9')]=function(_0x2fb0cb,_0x455004,_0x45b364,_0x12832b){return function(_0x7114f1){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x2fb0cb,_0x455004[0x0]);var _0x388202={'closed':0x1,'closedAt':moment()['format'](_0x100e('0xa')),'closeReason':_0x100e('0xb'),'disposition':_0x455004[0x0]};if(rpc[_0x12832b[_0x100e('0xc')]+'Interaction']){rpc[_0x12832b[_0x100e('0xc')]+'Interaction'][_0x100e('0xd')](_0x12832b[_0x100e('0xe')]['id'],_0x388202)[_0x100e('0xf')](function(_0x15ed44){logger[_0x100e('0x10')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2fb0cb,_0x12832b[_0x100e('0xe')]['id']);})['catch'](function(_0x24d1a6){logger['error'](_0x100e('0x11'),_0x2fb0cb,JSON[_0x100e('0x12')](_0x24d1a6));})[_0x100e('0x13')](function(){_0x7114f1[_0x100e('0x14')]();});}}catch(_0x3c0e27){logger[_0x100e('0x15')](_0x100e('0x11'),_0x2fb0cb,JSON[_0x100e('0x12')](_0x3c0e27));_0x7114f1['stop']();}};}; \ No newline at end of file +var _0xa8fe=['then','info','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction'];(function(_0x4d755c,_0x16f4ae){var _0x3135e2=function(_0x2971d7){while(--_0x2971d7){_0x4d755c['push'](_0x4d755c['shift']());}};_0x3135e2(++_0x16f4ae);}(_0xa8fe,0x184));var _0xea8f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa8fe[_0x57b54c];return _0x59cc19;};'use strict';var moment=require('moment');var logger=require(_0xea8f('0x0'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xea8f('0x1')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xea8f('0x2')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xea8f('0x3')]=function(_0x3e8b7b,_0xeae301,_0x5b9f45,_0x84966e){return function(_0x2e24fb){try{logger['info'](_0xea8f('0x4'),_0x3e8b7b,_0xeae301[0x0]);var _0x42778f={'closed':0x1,'closedAt':moment()[_0xea8f('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xea8f('0x6'),'disposition':_0xeae301[0x0]};if(rpc[_0x84966e[_0xea8f('0x7')]+_0xea8f('0x8')]){rpc[_0x84966e[_0xea8f('0x7')]+_0xea8f('0x8')][_0xea8f('0x9')](_0x84966e[_0xea8f('0xa')]['id'],_0x42778f)[_0xea8f('0xb')](function(_0xce3059){logger[_0xea8f('0xc')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3e8b7b,_0x84966e[_0xea8f('0xa')]['id']);})[_0xea8f('0xd')](function(_0x25c6c7){logger[_0xea8f('0xe')](_0xea8f('0xf'),_0x3e8b7b,JSON[_0xea8f('0x10')](_0x25c6c7));})[_0xea8f('0x11')](function(){_0x2e24fb[_0xea8f('0x12')]();});}}catch(_0x3a36b6){logger[_0xea8f('0xe')](_0xea8f('0xf'),_0x3e8b7b,JSON[_0xea8f('0x10')](_0x3a36b6));_0x2e24fb[_0xea8f('0x12')]();}};}; \ 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 f2dca3f..9ff42b5 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 _0xe08b=['providerName','providerResponse','stringify','metadata','endConversation','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe08b,0x10e));var _0xbe08=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe08b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbe08('0x0'));var moment=require('moment');var apiai=require(_0xbe08('0x1'));var md5=require(_0xbe08('0x2'));var utils=require('./utils');var logger=require(_0xbe08('0x3'))(_0xbe08('0x4'));var rpc={'chatMessage':require(_0xbe08('0x5')),'openchannelMessage':require(_0xbe08('0x6')),'mailMessage':require(_0xbe08('0x7')),'smsMessage':require(_0xbe08('0x8')),'faxMessage':require(_0xbe08('0x9')),'whatsappMessage':require(_0xbe08('0xa'))};exports[_0xbe08('0xb')]=function(_0x2f78b1,_0x34958a){return function(_0x2321c3){try{if(!_[_0xbe08('0xc')](this['interaction'][_0xbe08('0xd')])){logger[_0xbe08('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2f78b1,_0xbe08('0xf'));return _0x2321c3[_0xbe08('0x10')]();}var _0x47ca8d={'ContactId':this[_0xbe08('0x11')]['id'],'sentAt':moment()[_0xbe08('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xbe08('0x13')};if(this[_0xbe08('0x14')]===_0xbe08('0x15')||this[_0xbe08('0x14')]==='whatsapp'){_0x47ca8d[_0xbe08('0x16')]=this['interaction'][_0xbe08('0x16')];}var _0x2bc404=this[_0xbe08('0x14')];if(_0x2bc404===_0xbe08('0x17')){_0x47ca8d[_0xbe08('0x18')]=this[_0xbe08('0x19')]['id'];}else{_0x47ca8d[_[_0xbe08('0x1a')](_0x2bc404)+_0xbe08('0x1b')]=this[_0xbe08('0x19')]['id'];}_0x47ca8d[_[_0xbe08('0x1a')](_0x2bc404)+_0xbe08('0x1c')]=this[_0xbe08('0x1d')]['id'];if(this[_0xbe08('0x1d')][_0xbe08('0x1e')]){var _0x337787=_0x34958a[0x2];if(!_[_0xbe08('0x1f')](_0x337787)){_0x47ca8d[_0xbe08('0x20')]=utils[_0xbe08('0x21')](_0x337787,this);return rpc[_0x2bc404+'Message'][_0xbe08('0x22')](_0x47ca8d)[_0xbe08('0x23')](function(_0x154559){logger[_0xbe08('0xe')](_0xbe08('0x24'),_0x2f78b1,_0x47ca8d[_0xbe08('0x20')]);})[_0xbe08('0x25')](function(_0x4c9952){logger[_0xbe08('0x26')](_0xbe08('0x24'),_0x2f78b1,JSON['stringify'](_0x4c9952));})['finally'](function(){logger[_0xbe08('0xe')](_0xbe08('0x27'),_0x2f78b1);_0x2321c3[_0xbe08('0x28')]();});}else{logger['info'](_0xbe08('0x29'),_0x2f78b1);_0x2321c3[_0xbe08('0x28')]();}}else{var _0x42143c=this;var _0x45697b=apiai(_0x34958a[0x0],{'language':_0x34958a[0x1]||'en'});return _0x45697b[_0xbe08('0x2a')](this[_0xbe08('0x2b')][_0xbe08('0x20')],{'sessionId':md5(this[_0xbe08('0x1d')]['id'])})[_0xbe08('0x23')](function(_0x493d13){_0x42143c[_0xbe08('0x20')][_0xbe08('0x2c')]=_0x493d13;_0x47ca8d[_0xbe08('0x20')]=_0x493d13[_0xbe08('0x2d')][_0xbe08('0x2e')][_0xbe08('0x2f')];_0x47ca8d[_0xbe08('0x30')]=_0xbe08('0x2c');_0x47ca8d[_0xbe08('0x31')]=JSON[_0xbe08('0x32')](_0x493d13);return rpc[_0x2bc404+'Message'][_0xbe08('0x22')](_0x47ca8d)[_0xbe08('0x23')](function(_0x27ed43){logger[_0xbe08('0xe')](_0xbe08('0x24'),_0x2f78b1,_0x47ca8d[_0xbe08('0x20')]);if(_0x493d13['result'][_0xbe08('0x33')][_0xbe08('0x34')]){_0x2321c3[_0xbe08('0x10')]();}else{_0x2321c3[_0xbe08('0x28')]();}})[_0xbe08('0x25')](function(_0x523be0){logger[_0xbe08('0x26')](_0xbe08('0x24'),_0x2f78b1,JSON[_0xbe08('0x32')](_0x523be0));_0x2321c3['next']();});})[_0xbe08('0x25')](function(_0x31b820){logger['error'](_0xbe08('0x24'),_0x2f78b1,_0x31b820[_0xbe08('0x2b')]);_0x2321c3['next']();});}}catch(_0x31c07c){logger[_0xbe08('0x26')](_0xbe08('0x24'),_0x2f78b1,JSON[_0xbe08('0x32')](_0x31c07c));_0x2321c3[_0xbe08('0x28')]();}};}; \ No newline at end of file +var _0x4cb5=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','stringify','lodash','moment','apiai-promise','md5'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4cb5,0x8f));var _0x54cb=function(_0x165081,_0x153678){_0x165081=_0x165081-0x0;var _0x1a7af0=_0x4cb5[_0x165081];return _0x1a7af0;};'use strict';var _=require(_0x54cb('0x0'));var moment=require(_0x54cb('0x1'));var apiai=require(_0x54cb('0x2'));var md5=require(_0x54cb('0x3'));var utils=require('./utils');var logger=require(_0x54cb('0x4'))(_0x54cb('0x5'));var rpc={'chatMessage':require(_0x54cb('0x6')),'openchannelMessage':require(_0x54cb('0x7')),'mailMessage':require(_0x54cb('0x8')),'smsMessage':require(_0x54cb('0x9')),'faxMessage':require(_0x54cb('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x54cb('0xb')]=function(_0x2a3817,_0x5f4830){return function(_0x3f2076){try{if(!_['isNil'](this[_0x54cb('0xc')][_0x54cb('0xd')])){logger[_0x54cb('0xe')](_0x54cb('0xf'),_0x2a3817,_0x54cb('0x10'));return _0x3f2076[_0x54cb('0x11')]();}var _0x55a794={'ContactId':this['contact']['id'],'sentAt':moment()[_0x54cb('0x12')](_0x54cb('0x13')),'direction':'out'};if(this[_0x54cb('0x14')]===_0x54cb('0x15')||this[_0x54cb('0x14')]===_0x54cb('0x16')){_0x55a794[_0x54cb('0x17')]=this[_0x54cb('0xc')]['phone'];}var _0x344cb2=this[_0x54cb('0x14')];if(_0x344cb2===_0x54cb('0x18')){_0x55a794[_0x54cb('0x19')]=this[_0x54cb('0x1a')]['id'];}else{_0x55a794[_[_0x54cb('0x1b')](_0x344cb2)+'AccountId']=this[_0x54cb('0x1a')]['id'];}_0x55a794[_[_0x54cb('0x1b')](_0x344cb2)+_0x54cb('0x1c')]=this[_0x54cb('0xc')]['id'];if(this[_0x54cb('0xc')]['created']){var _0x288cf5=_0x5f4830[0x2];if(!_[_0x54cb('0x1d')](_0x288cf5)){_0x55a794[_0x54cb('0x1e')]=utils[_0x54cb('0x1f')](_0x288cf5,this);return rpc[_0x344cb2+_0x54cb('0x20')]['create'](_0x55a794)['then'](function(_0x238364){logger[_0x54cb('0xe')](_0x54cb('0xf'),_0x2a3817,_0x55a794[_0x54cb('0x1e')]);})[_0x54cb('0x21')](function(_0x46d2ff){logger[_0x54cb('0x22')](_0x54cb('0xf'),_0x2a3817,JSON['stringify'](_0x46d2ff));})['finally'](function(){logger[_0x54cb('0xe')](_0x54cb('0x23'),_0x2a3817);_0x3f2076['stop']();});}else{logger[_0x54cb('0xe')](_0x54cb('0x24'),_0x2a3817);_0x3f2076[_0x54cb('0x25')]();}}else{var _0x1c4145=this;var _0x204137=apiai(_0x5f4830[0x0],{'language':_0x5f4830[0x1]||'en'});return _0x204137[_0x54cb('0x26')](this[_0x54cb('0x27')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x54cb('0x28')](function(_0x2ccd2b){_0x1c4145[_0x54cb('0x1e')][_0x54cb('0x29')]=_0x2ccd2b;_0x55a794['body']=_0x2ccd2b[_0x54cb('0x2a')][_0x54cb('0x2b')][_0x54cb('0x2c')];_0x55a794[_0x54cb('0x2d')]=_0x54cb('0x29');_0x55a794[_0x54cb('0x2e')]=JSON['stringify'](_0x2ccd2b);return rpc[_0x344cb2+'Message']['create'](_0x55a794)[_0x54cb('0x28')](function(_0xdba85c){logger[_0x54cb('0xe')](_0x54cb('0xf'),_0x2a3817,_0x55a794['body']);if(_0x2ccd2b[_0x54cb('0x2a')][_0x54cb('0x2f')]['endConversation']){_0x3f2076[_0x54cb('0x11')]();}else{_0x3f2076[_0x54cb('0x25')]();}})[_0x54cb('0x21')](function(_0x121f38){logger[_0x54cb('0x22')](_0x54cb('0xf'),_0x2a3817,JSON[_0x54cb('0x30')](_0x121f38));_0x3f2076['next']();});})[_0x54cb('0x21')](function(_0x3d8e60){logger[_0x54cb('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2a3817,_0x3d8e60[_0x54cb('0x27')]);_0x3f2076[_0x54cb('0x11')]();});}}catch(_0x1d3847){logger[_0x54cb('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2a3817,JSON['stringify'](_0x1d3847));_0x3f2076[_0x54cb('0x25')]();}};}; \ 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 41b9784..64666e6 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 _0x6aed=['../../rpc/whatsappMessage','clone','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','phone','channel','chat','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','catch','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','message','dialogflow','md5','moment','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x33abc5,_0x483f74){var _0x32accc=function(_0x16bbe1){while(--_0x16bbe1){_0x33abc5['push'](_0x33abc5['shift']());}};_0x32accc(++_0x483f74);}(_0x6aed,0x10c));var _0xd6ae=function(_0x335392,_0x1917fe){_0x335392=_0x335392-0x0;var _0x5c008a=_0x6aed[_0x335392];return _0x5c008a;};'use strict';var _=require('lodash');var dialogflow=require(_0xd6ae('0x0'));var md5=require(_0xd6ae('0x1'));var moment=require(_0xd6ae('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0xd6ae('0x3'));var utils=require(_0xd6ae('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd6ae('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd6ae('0x6')),'faxMessage':require(_0xd6ae('0x7')),'whatsappMessage':require(_0xd6ae('0x8'))};function createMessage(_0x1c99e1,_0x471949,_0x142671,_0x1b457b){return new Promise(function(_0x546bf1,_0x27d0bc){var _0x90d5da=_[_0xd6ae('0x9')](_0x142671);_0x90d5da[_0xd6ae('0xa')]=_0x1b457b;return rpc[_0x471949+_0xd6ae('0xb')]['create'](_0x90d5da)[_0xd6ae('0xc')](function(){logger['info'](_0xd6ae('0xd'),_0x1c99e1,_0x90d5da[_0xd6ae('0xa')]);_0x546bf1();})['catch'](function(_0x1f43b8){logger[_0xd6ae('0xe')](_0xd6ae('0xd'),_0x1c99e1,JSON[_0xd6ae('0xf')](_0x1f43b8));_0x27d0bc(_0x1f43b8);});});}exports[_0xd6ae('0x10')]=function(_0x440340,_0x28439c){return function(_0xdc3c37){try{if(!_['isNil'](this[_0xd6ae('0x11')][_0xd6ae('0x12')])){logger[_0xd6ae('0x13')](_0xd6ae('0xd'),_0x440340,_0xd6ae('0x14'));return _0xdc3c37[_0xd6ae('0x15')]();}var _0x4e4410={'ContactId':this[_0xd6ae('0x16')]['id'],'sentAt':moment()[_0xd6ae('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd6ae('0x18')};if(this['channel']===_0xd6ae('0x19')||this['channel']==='whatsapp'){_0x4e4410[_0xd6ae('0x1a')]=this[_0xd6ae('0x11')][_0xd6ae('0x1a')];}var _0x478dba=this[_0xd6ae('0x1b')];if(_0x478dba===_0xd6ae('0x1c')){_0x4e4410['ChatWebsiteId']=this['account']['id'];}else{_0x4e4410[_['upperFirst'](_0x478dba)+_0xd6ae('0x1d')]=this['account']['id'];}_0x4e4410[_[_0xd6ae('0x1e')](_0x478dba)+_0xd6ae('0x1f')]=this['interaction']['id'];if(this[_0xd6ae('0x11')][_0xd6ae('0x20')]){var _0x39d7c9=_0x28439c[0x4];if(!_[_0xd6ae('0x21')](_0x39d7c9)){_0x4e4410[_0xd6ae('0xa')]=utils[_0xd6ae('0x22')](_0x39d7c9,this);return rpc[_0x478dba+_0xd6ae('0xb')][_0xd6ae('0x23')](_0x4e4410)[_0xd6ae('0xc')](function(_0x476be1){logger[_0xd6ae('0x13')](_0xd6ae('0xd'),_0x440340,_0x4e4410[_0xd6ae('0xa')]);})[_0xd6ae('0x24')](function(_0x3fff5f){logger[_0xd6ae('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x440340,JSON['stringify'](_0x3fff5f));})[_0xd6ae('0x25')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x440340);_0xdc3c37[_0xd6ae('0x26')]();});}else{logger[_0xd6ae('0x13')](_0xd6ae('0x27'),_0x440340);_0xdc3c37[_0xd6ae('0x26')]();}}else{var _0x57c3bf=this;var _0x4e911e=_0x28439c[0x2]['replace'](/\\n/g,'\x0a');var _0x436994={'credentials':{'private_key':_0x4e911e,'client_email':_0x28439c[0x1]}};var _0x27f416=new dialogflow[(_0xd6ae('0x28'))](_0x436994);var _0x391714=_0x27f416[_0xd6ae('0x29')](_0x28439c[0x0],md5(_0x57c3bf['interaction']['id']));var _0x562995={'session':_0x391714,'queryInput':{'text':{'text':_0x57c3bf['message'][_0xd6ae('0xa')],'languageCode':_0x28439c[0x3]||'en'}}};return _0x27f416[_0xd6ae('0x2a')](_0x562995)[_0xd6ae('0xc')](function(_0x5259dc){if(_0x5259dc&&_0x5259dc[_0xd6ae('0x2b')]){_0x57c3bf['body']['dialogflowV2']=_0x5259dc;var _0xff904f=_0x5259dc[0x0];var _0x2e2d83=_0xff904f[_0xd6ae('0x2c')][_0xd6ae('0x2d')]&&_0xff904f['queryResult']['diagnosticInfo'][_0xd6ae('0x2e')]?_0xff904f[_0xd6ae('0x2c')]['diagnosticInfo'][_0xd6ae('0x2e')][_0xd6ae('0x2f')][_0xd6ae('0x30')]:![];_0x57c3bf['body'][_0xd6ae('0x31')]=_0xff904f[_0xd6ae('0x2c')][_0xd6ae('0x32')];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x33')]=_0xff904f[_0xd6ae('0x2c')]['allRequiredParamsPresent'];_0x57c3bf['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0xff904f['queryResult'][_0xd6ae('0x2d')]&&_0xff904f[_0xd6ae('0x2c')][_0xd6ae('0x2d')][_0xd6ae('0x2e')]?_0xff904f['queryResult'][_0xd6ae('0x2d')][_0xd6ae('0x2e')][_0xd6ae('0x2f')][_0xd6ae('0x30')]:![];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x34')]=_0xff904f[_0xd6ae('0x2c')]['intent'][_0xd6ae('0x35')];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x36')]=_0xff904f['queryResult'][_0xd6ae('0x37')][_0xd6ae('0x38')];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x39')]=_0xff904f[_0xd6ae('0x2c')][_0xd6ae('0x37')][_0xd6ae('0x3a')];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x3b')]=_0xff904f[_0xd6ae('0x2c')][_0xd6ae('0x3c')];_0x57c3bf[_0xd6ae('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0xff904f[_0xd6ae('0x2c')]['queryText'];_0x57c3bf[_0xd6ae('0xa')][_0xd6ae('0x3d')]=_0xff904f[_0xd6ae('0x2c')]['intentDetectionConfidence'];_0x4e4410[_0xd6ae('0x3e')]=_0xd6ae('0x3f');_0x4e4410[_0xd6ae('0x40')]=JSON[_0xd6ae('0xf')](_0x5259dc);var _0x5e4157=[];for(var _0x4ef6db=0x0;_0x4ef6db<_0x5259dc[_0xd6ae('0x2b')];_0x4ef6db++){var _0x52fb1f=_0x5259dc[_0x4ef6db];if(_0x52fb1f&&_0x52fb1f[_0xd6ae('0x2c')]&&_0x52fb1f[_0xd6ae('0x2c')][_0xd6ae('0x41')]){_0x5e4157[_0xd6ae('0x42')](createMessage(_0x440340,_0x478dba,_0x4e4410,_0x52fb1f['queryResult']['fulfillmentText']));}}return Promise[_0xd6ae('0x43')](_0x5e4157)['then'](function(){if(_0x2e2d83){_0xdc3c37[_0xd6ae('0x15')]();}else{_0xdc3c37[_0xd6ae('0x26')]();}})['catch'](function(_0x5ef43b){logger[_0xd6ae('0xe')](_0xd6ae('0xd'),_0x440340,JSON[_0xd6ae('0xf')](_0x5ef43b));_0xdc3c37['next']();});}})['catch'](function(_0x5a4e4e){logger[_0xd6ae('0xe')](_0xd6ae('0xd'),_0x440340,_0x5a4e4e[_0xd6ae('0x44')]);_0xdc3c37[_0xd6ae('0x15')]();});}}catch(_0x55d3cb){logger[_0xd6ae('0xe')](_0xd6ae('0xd'),_0x440340,JSON[_0xd6ae('0xf')](_0x55d3cb));_0xdc3c37[_0xd6ae('0x26')]();}};}; \ No newline at end of file +var _0x6782=['queryResult','fields','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','lodash','md5','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','diagnosticInfo'];(function(_0x2ad81c,_0x14d20b){var _0x49fe5c=function(_0x5aa386){while(--_0x5aa386){_0x2ad81c['push'](_0x2ad81c['shift']());}};_0x49fe5c(++_0x14d20b);}(_0x6782,0xdd));var _0x2678=function(_0xfa738,_0x4dcd1b){_0xfa738=_0xfa738-0x0;var _0x35119c=_0x6782[_0xfa738];return _0x35119c;};'use strict';var _=require(_0x2678('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x2678('0x1'));var moment=require(_0x2678('0x2'));var Promise=require('bluebird');var logger=require(_0x2678('0x3'))(_0x2678('0x4'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2678('0x5')),'mailMessage':require(_0x2678('0x6')),'smsMessage':require(_0x2678('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2678('0x8'))};function createMessage(_0x4b86d6,_0x5f51f5,_0x2d8075,_0x16d0e5){return new Promise(function(_0x1fa446,_0x340446){var _0x43edff=_[_0x2678('0x9')](_0x2d8075);_0x43edff['body']=_0x16d0e5;return rpc[_0x5f51f5+_0x2678('0xa')][_0x2678('0xb')](_0x43edff)[_0x2678('0xc')](function(){logger[_0x2678('0xd')](_0x2678('0xe'),_0x4b86d6,_0x43edff[_0x2678('0xf')]);_0x1fa446();})[_0x2678('0x10')](function(_0x4e3fc5){logger[_0x2678('0x11')](_0x2678('0xe'),_0x4b86d6,JSON[_0x2678('0x12')](_0x4e3fc5));_0x340446(_0x4e3fc5);});});}exports[_0x2678('0x13')]=function(_0x146619,_0x3aba62){return function(_0x466ede){try{if(!_[_0x2678('0x14')](this[_0x2678('0x15')][_0x2678('0x16')])){logger['info'](_0x2678('0xe'),_0x146619,_0x2678('0x17'));return _0x466ede[_0x2678('0x18')]();}var _0x22fb52={'ContactId':this[_0x2678('0x19')]['id'],'sentAt':moment()['format'](_0x2678('0x1a')),'direction':_0x2678('0x1b')};if(this[_0x2678('0x1c')]===_0x2678('0x1d')||this[_0x2678('0x1c')]===_0x2678('0x1e')){_0x22fb52['phone']=this[_0x2678('0x15')][_0x2678('0x1f')];}var _0x5d2a51=this[_0x2678('0x1c')];if(_0x5d2a51===_0x2678('0x20')){_0x22fb52[_0x2678('0x21')]=this[_0x2678('0x22')]['id'];}else{_0x22fb52[_[_0x2678('0x23')](_0x5d2a51)+_0x2678('0x24')]=this[_0x2678('0x22')]['id'];}_0x22fb52[_[_0x2678('0x23')](_0x5d2a51)+_0x2678('0x25')]=this[_0x2678('0x15')]['id'];if(this[_0x2678('0x15')][_0x2678('0x26')]){var _0x25dbaf=_0x3aba62[0x4];if(!_[_0x2678('0x27')](_0x25dbaf)){_0x22fb52[_0x2678('0xf')]=utils['getMustacheRender'](_0x25dbaf,this);return rpc[_0x5d2a51+_0x2678('0xa')][_0x2678('0xb')](_0x22fb52)['then'](function(_0x275bf8){logger[_0x2678('0xd')](_0x2678('0xe'),_0x146619,_0x22fb52['body']);})['catch'](function(_0x290120){logger[_0x2678('0x11')](_0x2678('0xe'),_0x146619,JSON[_0x2678('0x12')](_0x290120));})[_0x2678('0x28')](function(){logger[_0x2678('0xd')](_0x2678('0x29'),_0x146619);_0x466ede[_0x2678('0x2a')]();});}else{logger[_0x2678('0xd')](_0x2678('0x2b'),_0x146619);_0x466ede['stop']();}}else{var _0x1b55f7=this;var _0x151f4e=_0x3aba62[0x2][_0x2678('0x2c')](/\\n/g,'\x0a');var _0x4ebbec={'credentials':{'private_key':_0x151f4e,'client_email':_0x3aba62[0x1]}};var _0x11bc15=new dialogflow[(_0x2678('0x2d'))](_0x4ebbec);var _0x2b4fd3=_0x11bc15['sessionPath'](_0x3aba62[0x0],md5(_0x1b55f7[_0x2678('0x15')]['id']));var _0x2227fa={'session':_0x2b4fd3,'queryInput':{'text':{'text':_0x1b55f7[_0x2678('0x2e')][_0x2678('0xf')],'languageCode':_0x3aba62[0x3]||'en'}}};return _0x11bc15[_0x2678('0x2f')](_0x2227fa)[_0x2678('0xc')](function(_0x488cd7){if(_0x488cd7&&_0x488cd7[_0x2678('0x30')]){_0x1b55f7['body'][_0x2678('0x31')]=_0x488cd7;var _0x4163a2=_0x488cd7[0x0];var _0x13d5e2=_0x4163a2['queryResult'][_0x2678('0x32')]&&_0x4163a2[_0x2678('0x33')][_0x2678('0x32')]['fields']?_0x4163a2[_0x2678('0x33')][_0x2678('0x32')][_0x2678('0x34')]['end_conversation'][_0x2678('0x35')]:![];_0x1b55f7['body']['DIALOGFLOWV2_ACTION']=_0x4163a2[_0x2678('0x33')]['action'];_0x1b55f7[_0x2678('0xf')][_0x2678('0x36')]=_0x4163a2[_0x2678('0x33')]['allRequiredParamsPresent'];_0x1b55f7[_0x2678('0xf')][_0x2678('0x37')]=_0x4163a2[_0x2678('0x33')][_0x2678('0x32')]&&_0x4163a2[_0x2678('0x33')][_0x2678('0x32')][_0x2678('0x34')]?_0x4163a2[_0x2678('0x33')][_0x2678('0x32')][_0x2678('0x34')]['end_conversation'][_0x2678('0x35')]:![];_0x1b55f7[_0x2678('0xf')]['DIALOGFLOWV2_INTENTNAME']=_0x4163a2[_0x2678('0x33')][_0x2678('0x38')][_0x2678('0x39')];_0x1b55f7[_0x2678('0xf')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4163a2[_0x2678('0x33')][_0x2678('0x38')]['displayName'];_0x1b55f7['body'][_0x2678('0x3a')]=_0x4163a2['queryResult']['intent'][_0x2678('0x3b')];_0x1b55f7[_0x2678('0xf')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4163a2['queryResult'][_0x2678('0x3c')];_0x1b55f7[_0x2678('0xf')][_0x2678('0x3d')]=_0x4163a2[_0x2678('0x33')]['queryText'];_0x1b55f7['body'][_0x2678('0x3e')]=_0x4163a2[_0x2678('0x33')][_0x2678('0x3f')];_0x22fb52[_0x2678('0x40')]=_0x2678('0x31');_0x22fb52[_0x2678('0x41')]=JSON[_0x2678('0x12')](_0x488cd7);var _0x3724e8=[];for(var _0x1a5c1a=0x0;_0x1a5c1a<_0x488cd7[_0x2678('0x30')];_0x1a5c1a++){var _0x536514=_0x488cd7[_0x1a5c1a];if(_0x536514&&_0x536514[_0x2678('0x33')]&&_0x536514['queryResult'][_0x2678('0x42')]){_0x3724e8[_0x2678('0x43')](createMessage(_0x146619,_0x5d2a51,_0x22fb52,_0x536514['queryResult'][_0x2678('0x42')]));}}return Promise['all'](_0x3724e8)['then'](function(){if(_0x13d5e2){_0x466ede[_0x2678('0x18')]();}else{_0x466ede[_0x2678('0x2a')]();}})[_0x2678('0x10')](function(_0x5ca65d){logger[_0x2678('0x11')](_0x2678('0xe'),_0x146619,JSON[_0x2678('0x12')](_0x5ca65d));_0x466ede['next']();});}})[_0x2678('0x10')](function(_0x17b611){logger[_0x2678('0x11')](_0x2678('0xe'),_0x146619,_0x17b611['message']);_0x466ede[_0x2678('0x18')]();});}}catch(_0x18557a){logger[_0x2678('0x11')](_0x2678('0xe'),_0x146619,JSON['stringify'](_0x18557a));_0x466ede[_0x2678('0x2a')]();}};}; \ 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 c00031d..c205866 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 _0xe581=['map','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','length','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe581,0x120));var _0x1e58=function(_0x18b99b,_0x31b93b){_0x18b99b=_0x18b99b-0x0;var _0x4e3152=_0xe581[_0x18b99b];return _0x4e3152;};'use strict';var schema=require(_0x1e58('0x0'));var _=require(_0x1e58('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x1e58('0x2'));var logger=require(_0x1e58('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x1e58('0x4'),'required':!![],'message':_0x1e58('0x5')},'priorityTrue':{'type':_0x1e58('0x6'),'message':_0x1e58('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x1e58('0x8')]=function(_0x3873a3,_0x19c871){return function(_0x127deb){try{var _0x149a91={'condition':htmlToText[_0x1e58('0x9')](utils['getMustacheRender'](_0x19c871[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x19c871[0x1],'priorityFalse':_0x19c871[0x2]};var _0x17e1ea=gotoif['validate'](_0x149a91,{'typecast':!![]});if(_0x17e1ea[_0x1e58('0xa')]){logger[_0x1e58('0xb')]('[%s][GOTOIF]\x20%s',_0x3873a3,_[_0x1e58('0xc')](_0x17e1ea,'message')['join'](',\x20'));_0x127deb[_0x1e58('0xd')]();}else{try{var _0x1c1d8e=eval('('+_0x149a91[_0x1e58('0xe')]+')');var _0x341637=_0x1c1d8e?_0x149a91['priorityTrue']:_0x149a91[_0x1e58('0xf')];logger[_0x1e58('0x10')](_0x1e58('0x11'),_0x3873a3,_0x149a91[_0x1e58('0xe')],_0x1c1d8e,_0x341637||_0x1e58('0x12'));if(_0x341637){var _0x574b1c=_['findIndex'](_0x127deb[_0x1e58('0x13')](),{'p':_0x341637});if(_0x574b1c>=0x0){logger[_0x1e58('0x10')](_0x1e58('0x14'),_0x3873a3,_0x341637||_0x1e58('0x12'),_0x574b1c);_0x127deb[_0x1e58('0x12')](_0x574b1c);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3873a3,_0x341637||_0x1e58('0x12'));_0x127deb[_0x1e58('0xd')]();}}else{_0x127deb[_0x1e58('0x12')]();}}catch(_0x56d872){logger[_0x1e58('0xb')](_0x1e58('0x15'),_0x3873a3,_0x56d872[_0x1e58('0x16')]);_0x127deb[_0x1e58('0xd')]();}}}catch(_0x178f53){logger[_0x1e58('0xb')](_0x1e58('0x17'),_0x3873a3,JSON[_0x1e58('0x18')](_0x178f53));_0x127deb[_0x1e58('0xd')]();}};}; \ No newline at end of file +var _0x6883=['stop','priorityFalse','info','condition','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','map','message','join'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6883,0xe0));var _0x3688=function(_0x23ce1a,_0x575413){_0x23ce1a=_0x23ce1a-0x0;var _0x1a9bac=_0x6883[_0x23ce1a];return _0x1a9bac;};'use strict';var schema=require(_0x3688('0x0'));var _=require(_0x3688('0x1'));var htmlToText=require(_0x3688('0x2'));var utils=require(_0x3688('0x3'));var logger=require(_0x3688('0x4'))(_0x3688('0x5'));var gotoif=schema({'condition':{'type':_0x3688('0x6'),'required':!![],'message':_0x3688('0x7')},'priorityTrue':{'type':_0x3688('0x8'),'message':_0x3688('0x9')},'priorityFalse':{'type':_0x3688('0x8'),'message':_0x3688('0xa')}});exports[_0x3688('0xb')]=function(_0x2dade8,_0x26f54d){return function(_0x202c92){try{var _0x2b5262={'condition':htmlToText[_0x3688('0xc')](utils[_0x3688('0xd')](_0x26f54d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x26f54d[0x1],'priorityFalse':_0x26f54d[0x2]};var _0x223901=gotoif[_0x3688('0x0')](_0x2b5262,{'typecast':!![]});if(_0x223901[_0x3688('0xe')]){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20%s',_0x2dade8,_[_0x3688('0x10')](_0x223901,_0x3688('0x11'))[_0x3688('0x12')](',\x20'));_0x202c92[_0x3688('0x13')]();}else{try{var _0x27414d=eval('('+_0x2b5262['condition']+')');var _0x287ad2=_0x27414d?_0x2b5262['priorityTrue']:_0x2b5262[_0x3688('0x14')];logger[_0x3688('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2dade8,_0x2b5262[_0x3688('0x16')],_0x27414d,_0x287ad2||_0x3688('0x17'));if(_0x287ad2){var _0x4437d6=_['findIndex'](_0x202c92['rules'](),{'p':_0x287ad2});if(_0x4437d6>=0x0){logger[_0x3688('0x15')](_0x3688('0x18'),_0x2dade8,_0x287ad2||_0x3688('0x17'),_0x4437d6);_0x202c92[_0x3688('0x17')](_0x4437d6);}else{logger[_0x3688('0x15')](_0x3688('0x19'),_0x2dade8,_0x287ad2||_0x3688('0x17'));_0x202c92[_0x3688('0x13')]();}}else{_0x202c92[_0x3688('0x17')]();}}catch(_0xf6a9b0){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2dade8,_0xf6a9b0[_0x3688('0x11')]);_0x202c92['stop']();}}}catch(_0x5bfc5c){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20%s',_0x2dade8,JSON[_0x3688('0x1a')](_0x5bfc5c));_0x202c92[_0x3688('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 149f5ee..7fa1b3a 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 _0x0233=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','map','message','join','stop','info'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0233,0x135));var _0x3023=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0233[_0x413feb];return _0x40ee88;};'use strict';var schema=require(_0x3023('0x0'));var _=require(_0x3023('0x1'));var logger=require('../../../../config/logger')(_0x3023('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3023('0x3')}});exports[_0x3023('0x4')]=function(_0x2434bc,_0x521250){return function(_0x306ed5){try{var _0x23ad1d={'priority':_0x521250[0x0]};var _0x17f6f4=gotop[_0x3023('0x0')](_0x23ad1d,{'typecast':!![]});if(_0x17f6f4[_0x3023('0x5')]){logger['error']('[%s][GOTOP]\x20%s',_0x2434bc,_[_0x3023('0x6')](_0x17f6f4,_0x3023('0x7'))[_0x3023('0x8')](',\x20'));_0x306ed5[_0x3023('0x9')]();}else{logger[_0x3023('0xa')](_0x3023('0xb'),_0x2434bc,_0x23ad1d[_0x3023('0xc')]);if(_0x23ad1d[_0x3023('0xc')]){var _0x5e444a=_[_0x3023('0xd')](_0x306ed5['rules'](),{'p':_0x23ad1d['priority']});if(_0x5e444a>=0x0){logger[_0x3023('0xa')](_0x3023('0xe'),_0x2434bc,_0x23ad1d[_0x3023('0xc')]||_0x3023('0xf'),_0x5e444a);_0x306ed5['next'](_0x5e444a);}else{logger[_0x3023('0xa')](_0x3023('0x10'),_0x2434bc,_0x23ad1d['priority']||_0x3023('0xf'));_0x306ed5[_0x3023('0x9')]();}}else{_0x306ed5[_0x3023('0xf')]();}}}catch(_0x23eb75){logger[_0x3023('0x11')](_0x3023('0x12'),_0x2434bc,JSON[_0x3023('0x13')](_0x23eb75));_0x306ed5[_0x3023('0x9')]();}};}; \ No newline at end of file +var _0x0565=['routing','number','consequence','length','error','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','../../../../config/logger'];(function(_0x28efc9,_0xaa9d83){var _0x3d397c=function(_0x4eecae){while(--_0x4eecae){_0x28efc9['push'](_0x28efc9['shift']());}};_0x3d397c(++_0xaa9d83);}(_0x0565,0x6e));var _0x5056=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x0565[_0x710815];return _0x5b3b89;};'use strict';var schema=require(_0x5056('0x0'));var _=require('lodash');var logger=require(_0x5056('0x1'))(_0x5056('0x2'));var gotop=schema({'priority':{'type':_0x5056('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x5056('0x4')]=function(_0xc1e4b9,_0xaea5da){return function(_0x29af91){try{var _0x1035cd={'priority':_0xaea5da[0x0]};var _0x490a97=gotop['validate'](_0x1035cd,{'typecast':!![]});if(_0x490a97[_0x5056('0x5')]){logger[_0x5056('0x6')]('[%s][GOTOP]\x20%s',_0xc1e4b9,_['map'](_0x490a97,'message')[_0x5056('0x7')](',\x20'));_0x29af91[_0x5056('0x8')]();}else{logger[_0x5056('0x9')](_0x5056('0xa'),_0xc1e4b9,_0x1035cd[_0x5056('0xb')]);if(_0x1035cd[_0x5056('0xb')]){var _0x2114aa=_['findIndex'](_0x29af91[_0x5056('0xc')](),{'p':_0x1035cd[_0x5056('0xb')]});if(_0x2114aa>=0x0){logger[_0x5056('0x9')](_0x5056('0xd'),_0xc1e4b9,_0x1035cd[_0x5056('0xb')]||_0x5056('0xe'),_0x2114aa);_0x29af91[_0x5056('0xe')](_0x2114aa);}else{logger[_0x5056('0x9')](_0x5056('0xf'),_0xc1e4b9,_0x1035cd['priority']||_0x5056('0xe'));_0x29af91[_0x5056('0x8')]();}}else{_0x29af91['next']();}}}catch(_0xdc6f48){logger[_0x5056('0x6')]('[%s][GOTOP]\x20%s',_0xc1e4b9,JSON['stringify'](_0xdc6f48));_0x29af91[_0x5056('0x8')]();}};}; \ 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 f296713..f31052c 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 _0xe235=['error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body'];(function(_0xea68da,_0x102982){var _0x252d8e=function(_0xf1fe7f){while(--_0xf1fe7f){_0xea68da['push'](_0xea68da['shift']());}};_0x252d8e(++_0x102982);}(_0xe235,0xe4));var _0x5e23=function(_0xcdbf03,_0x84540c){_0xcdbf03=_0xcdbf03-0x0;var _0x318cf5=_0xe235[_0xcdbf03];return _0x318cf5;};'use strict';var _=require(_0x5e23('0x0'));var utils=require(_0x5e23('0x1'));var logger=require(_0x5e23('0x2'))(_0x5e23('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5e23('0x4')),'smsMessage':require(_0x5e23('0x5')),'faxMessage':require(_0x5e23('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x37cae3,_0x37c8a7){return function(_0x1b49b2){try{var _0x1c9b2b={'body':utils[_0x5e23('0x7')](_0x37c8a7[0x0],this),'ContactId':this[_0x5e23('0x8')]['id']};if(this[_0x5e23('0x9')]===_0x5e23('0xa')){_0x1c9b2b[_0x5e23('0xb')]=this[_0x5e23('0xc')]['id'];}else{_0x1c9b2b[_[_0x5e23('0xd')](this[_0x5e23('0x9')])+_0x5e23('0xe')]=this[_0x5e23('0xc')]['id'];}_0x1c9b2b[_['upperFirst'](this[_0x5e23('0x9')])+_0x5e23('0xf')]=this[_0x5e23('0x10')]['id'];if(rpc[this['channel']+_0x5e23('0x11')]){return rpc[this['channel']+_0x5e23('0x11')][_0x5e23('0x12')](_0x1c9b2b)['then'](function(_0xf54178){logger[_0x5e23('0x13')](_0x5e23('0x14'),_0x37cae3,_0x1c9b2b[_0x5e23('0x15')]);_0x1b49b2['next']();})['catch'](function(_0x301787){logger[_0x5e23('0x16')](_0x5e23('0x14'),_0x37cae3,JSON[_0x5e23('0x17')](_0x301787));_0x1b49b2[_0x5e23('0x18')]();});}}catch(_0x14f7ba){logger[_0x5e23('0x16')](_0x5e23('0x14'),_0x37cae3,JSON[_0x5e23('0x17')](_0x14f7ba));_0x1b49b2[_0x5e23('0x18')]();}};}; \ No newline at end of file +var _0x3df4=['lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','account','upperFirst','AccountId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3df4,0x12b));var _0x43df=function(_0x509f5b,_0x32fbcc){_0x509f5b=_0x509f5b-0x0;var _0x37b878=_0x3df4[_0x509f5b];return _0x37b878;};'use strict';var _=require(_0x43df('0x0'));var utils=require('./utils');var logger=require(_0x43df('0x1'))(_0x43df('0x2'));var rpc={'chatMessage':require(_0x43df('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x43df('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x43df('0x5')),'whatsappMessage':require(_0x43df('0x6'))};exports['consequence']=function(_0x585b47,_0x5329be){return function(_0x355392){try{var _0x4fe147={'body':utils[_0x43df('0x7')](_0x5329be[0x0],this),'ContactId':this[_0x43df('0x8')]['id']};if(this[_0x43df('0x9')]==='chat'){_0x4fe147['ChatWebsiteId']=this[_0x43df('0xa')]['id'];}else{_0x4fe147[_[_0x43df('0xb')](this[_0x43df('0x9')])+_0x43df('0xc')]=this[_0x43df('0xa')]['id'];}_0x4fe147[_[_0x43df('0xb')](this[_0x43df('0x9')])+'InteractionId']=this[_0x43df('0xd')]['id'];if(rpc[this[_0x43df('0x9')]+_0x43df('0xe')]){return rpc[this[_0x43df('0x9')]+'Message']['create'](_0x4fe147)[_0x43df('0xf')](function(_0x18be5e){logger[_0x43df('0x10')](_0x43df('0x11'),_0x585b47,_0x4fe147[_0x43df('0x12')]);_0x355392[_0x43df('0x13')]();})['catch'](function(_0x11c991){logger[_0x43df('0x14')](_0x43df('0x11'),_0x585b47,JSON['stringify'](_0x11c991));_0x355392[_0x43df('0x15')]();});}}catch(_0x4be769){logger[_0x43df('0x14')](_0x43df('0x11'),_0x585b47,JSON[_0x43df('0x16')](_0x4be769));_0x355392[_0x43df('0x15')]();}};}; \ 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 44173cf..f1c982e 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 _0x7291=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x510aad,_0x521233){var _0x4522a2=function(_0x9a572a){while(--_0x9a572a){_0x510aad['push'](_0x510aad['shift']());}};_0x4522a2(++_0x521233);}(_0x7291,0x1a7));var _0x1729=function(_0x3b89a5,_0x19ccf9){_0x3b89a5=_0x3b89a5-0x0;var _0x59f8d9=_0x7291[_0x3b89a5];return _0x59f8d9;};'use strict';var utils=require(_0x1729('0x0'));var logger=require(_0x1729('0x1'))(_0x1729('0x2'));exports[_0x1729('0x3')]=function(_0x11c6dc,_0x453e3c){return function(_0x1c72ac){try{logger[_0x1729('0x4')](_0x1729('0x5'),_0x11c6dc,utils[_0x1729('0x6')](_0x453e3c[0x0],this));_0x1c72ac[_0x1729('0x7')]();}catch(_0x3196dc){logger[_0x1729('0x8')](_0x1729('0x5'),_0x11c6dc,JSON['stringify'](_0x3196dc));_0x1c72ac['stop']();}};}; \ No newline at end of file +var _0xcd9a=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x29e4b8,_0x1ff29b){var _0x3b5d2e=function(_0x48e273){while(--_0x48e273){_0x29e4b8['push'](_0x29e4b8['shift']());}};_0x3b5d2e(++_0x1ff29b);}(_0xcd9a,0x1b3));var _0xacd9=function(_0xf3c18d,_0x2c3f98){_0xf3c18d=_0xf3c18d-0x0;var _0x31ac86=_0xcd9a[_0xf3c18d];return _0x31ac86;};'use strict';var utils=require(_0xacd9('0x0'));var logger=require(_0xacd9('0x1'))(_0xacd9('0x2'));exports[_0xacd9('0x3')]=function(_0x12a47f,_0x1eff04){return function(_0x103bc5){try{logger[_0xacd9('0x4')](_0xacd9('0x5'),_0x12a47f,utils[_0xacd9('0x6')](_0x1eff04[0x0],this));_0x103bc5[_0xacd9('0x7')]();}catch(_0x3a8e41){logger[_0xacd9('0x8')](_0xacd9('0x5'),_0x12a47f,JSON[_0xacd9('0x9')](_0x3a8e41));_0x103bc5[_0xacd9('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 964ff68..c29eba4 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 _0xdd45=['YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','WebsiteId','info','name','create','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','map','join','stop','find','Queues','createQueue','qtimeout','end','rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0xdd45,0x10a));var _0x5dd4=function(_0x3ab030,_0x243dc5){_0x3ab030=_0x3ab030-0x0;var _0x50c7aa=_0xdd45[_0x3ab030];return _0x50c7aa;};'use strict';var schema=require(_0x5dd4('0x0'));var _=require('lodash');var util=require(_0x5dd4('0x1'));var seqqueue=require(_0x5dd4('0x2'));var moment=require(_0x5dd4('0x3'));var Redis=require(_0x5dd4('0x4'));var config=require(_0x5dd4('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5dd4('0x6'));config[_0x5dd4('0x7')]=_['defaults'](config[_0x5dd4('0x7')],{'host':_0x5dd4('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5dd4('0x7')]));var attributes=['id',_0x5dd4('0x9'),_0x5dd4('0xa'),_0x5dd4('0xb'),_0x5dd4('0xc'),'joinAt'];function emit(_0x1cbde6,_0x224202,_0x5cec30){io['to'](_0x1cbde6)[_0x5dd4('0xd')](_0x224202,_0x5cec30);}function emitChannelQueueInteraction(_0x2f34dd,_0x38b396,_0x46cead,_0x2aa7af,_0x27748a,_0x1f8631,_0x90f6d9,_0x252c49){var _0xfea1f2=_[_0x5dd4('0xe')](_0x46cead);_0xfea1f2['queue_id']=_0x252c49;_0xfea1f2[_0x5dd4('0xb')]=_0x38b396;_0xfea1f2[_0x5dd4('0xa')]=_0x2aa7af;_0xfea1f2['id']=_0x27748a;if(_0x1f8631){_0x90f6d9[util[_0x5dd4('0xf')](_0x5dd4('0x10'),_0x2f34dd)][_0x27748a]=_[_0x5dd4('0x11')](_0xfea1f2,attributes);}else{delete _0x90f6d9[util[_0x5dd4('0xf')]('%sQueuesWaitingInteractions',_0x2f34dd)][_0x27748a];}emit(util[_0x5dd4('0xf')](_0x5dd4('0x12'),_0x2f34dd,_0x38b396),util[_0x5dd4('0xf')](_0x5dd4('0x13'),_0x2f34dd,_0x1f8631?_0x5dd4('0x14'):_0x5dd4('0x15')),_[_0x5dd4('0x11')](_0xfea1f2,attributes));}var rpc={'openchannelQueueReport':require(_0x5dd4('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x5dd4('0x17')),'smsQueueReport':require(_0x5dd4('0x18')),'faxQueueReport':require(_0x5dd4('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x5dd4('0x1a'),'required':!![],'message':_0x5dd4('0x1b')},'timeout':{'type':'number','message':_0x5dd4('0x1c')}});function startRouting(_0x527d9a,_0x356aa6,_0x4d360b,_0x2d6974){if(_0x527d9a&&_0x356aa6&&_0x4d360b){_0x356aa6['waiting']+=0x1;var _0x141df6={'uniqueid':_0x527d9a,'from':_0x4d360b[_0x5dd4('0x1d')]?_0x4d360b[_0x5dd4('0x1d')]['from']:'','joinAt':moment()[_0x5dd4('0xf')](_0x5dd4('0x1e')),'ContactId':_0x4d360b[_0x5dd4('0x1f')]?_0x4d360b[_0x5dd4('0x1f')]['id']:null,'ListId':_0x4d360b[_0x5dd4('0x20')]?_0x4d360b[_0x5dd4('0x20')]['id']:null};_0x141df6[_[_0x5dd4('0x21')](_0x4d360b['channel'])+_0x5dd4('0x22')]=_0x356aa6['id']||null;_0x141df6[_[_0x5dd4('0x21')](_0x4d360b[_0x5dd4('0x23')])+_0x5dd4('0x24')]=_0x4d360b['interaction']?_0x4d360b[_0x5dd4('0x25')]['id']:null;_0x141df6[_[_0x5dd4('0x21')](_0x4d360b['channel'])+_0x5dd4('0x26')]=_0x4d360b['message']?_0x4d360b[_0x5dd4('0x27')]['id']:null;_0x141df6[_[_0x5dd4('0x21')](_0x4d360b[_0x5dd4('0x23')])+(_0x4d360b['channel']!=='chat'?'AccountId':_0x5dd4('0x28'))]=_0x4d360b[_0x5dd4('0xa')]?_0x4d360b[_0x5dd4('0xa')]['id']:null;logger[_0x5dd4('0x29')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x527d9a,_0x356aa6[_0x5dd4('0x2a')]));emitChannelQueueInteraction(_0x4d360b['channel'],_0x356aa6['name'],_0x141df6,_0x4d360b[_0x5dd4('0xa')][_0x5dd4('0x2a')],_0x4d360b[_0x5dd4('0x27')]['id'],!![],_0x2d6974,_0x356aa6['id']);if(rpc[_0x4d360b[_0x5dd4('0x23')]+'QueueReport']){return rpc[_0x4d360b[_0x5dd4('0x23')]+'QueueReport'][_0x5dd4('0x2b')](_0x141df6)['catch'](function(_0x231ae7){logger[_0x5dd4('0x2c')](_0x5dd4('0x2d'));});}}}function stopRouting(_0x176a93,_0x3ede33,_0x1ac938,_0x36aa04){if(_0x176a93&&_0x3ede33){_0x3ede33[_0x5dd4('0x2e')]-=0x1;var _0x53241b={'leaveAt':moment()[_0x5dd4('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x5dd4('0x1e')),'reason':_0x5dd4('0x2f')};logger[_0x5dd4('0x29')](util[_0x5dd4('0xf')](_0x5dd4('0x30'),_0x176a93,_0x3ede33[_0x5dd4('0x2a')]));emitChannelQueueInteraction(_0x1ac938[_0x5dd4('0x23')],_0x3ede33[_0x5dd4('0x2a')],_0x1ac938[_0x5dd4('0x1d')],_0x1ac938[_0x5dd4('0xa')][_0x5dd4('0x2a')],_0x1ac938[_0x5dd4('0x27')]['id'],![],_0x36aa04,_0x3ede33['id']);if(rpc[_0x1ac938[_0x5dd4('0x23')]+_0x5dd4('0x31')]){return rpc[_0x1ac938['channel']+_0x5dd4('0x31')][_0x5dd4('0x32')](_0x176a93,_0x53241b)['catch'](function(_0x208b36){logger[_0x5dd4('0x2c')](_0x5dd4('0x33'));});}}}function endRouting(_0x31529c,_0x577bed,_0x553ba2,_0x55d065){if(_0x31529c&&_0x577bed){_0x577bed['waiting']-=0x1;var _0x6c1329={'leaveAt':moment()[_0x5dd4('0xf')](_0x5dd4('0x1e')),'exitAt':moment()[_0x5dd4('0xf')](_0x5dd4('0x1e')),'reason':_0x5dd4('0x34')};logger[_0x5dd4('0x29')](util[_0x5dd4('0xf')](_0x5dd4('0x35'),_0x31529c,_0x577bed[_0x5dd4('0x2a')]));emitChannelQueueInteraction(_0x553ba2[_0x5dd4('0x23')],_0x577bed[_0x5dd4('0x2a')],_0x553ba2['body'],_0x553ba2[_0x5dd4('0xa')][_0x5dd4('0x2a')],_0x553ba2[_0x5dd4('0x27')]['id'],![],_0x55d065);if(rpc[_0x553ba2[_0x5dd4('0x23')]+'QueueReport']){return rpc[_0x553ba2[_0x5dd4('0x23')]+_0x5dd4('0x31')][_0x5dd4('0x32')](_0x31529c,_0x6c1329)[_0x5dd4('0x36')](function(_0x3fd795){logger[_0x5dd4('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x210378){return function(_0x121197){return _0x121197[_0x5dd4('0x2a')][_0x5dd4('0x37')]()===_0x210378[_0x5dd4('0x37')]();};}exports[_0x5dd4('0x38')]=function(_0x1b00ef,_0x1e1c0b,_0x21ce32,_0x41ff42){return function(_0x24228c){try{var _0x9c0241={'name':_0x1e1c0b[0x0],'timeout':_0x1e1c0b[0x1]};var _0x23c377=queue['validate'](_0x9c0241,{'typecast':!![]});if(_0x23c377['length']){logger['error']('[%s][QUEUE]\x20%s',_0x1b00ef,_[_0x5dd4('0x39')](_0x23c377,'message')[_0x5dd4('0x3a')](',\x20'));_0x24228c[_0x5dd4('0x3b')]();}else{var _0xdeaaf6=_[_0x5dd4('0x3c')](_0x21ce32[_0x41ff42[_0x5dd4('0x23')]+_0x5dd4('0x3d')],handleFindQueue(_0x9c0241['name']));if(_0xdeaaf6){startRouting(_0x1b00ef,_0xdeaaf6,_0x41ff42,_0x21ce32);var _0x7b014e=(_0xdeaaf6[_0x5dd4('0x34')]||0xa)*0x3e8;var _0x57b00f=(_0x9c0241[_0x5dd4('0x34')]||0x14)*0x3e8;var _0x1d9add,_0x1d7c34;if(_0x7b014e>_0x57b00f){_0x57b00f=_0x7b014e;}var _0x321b5a=seqqueue[_0x5dd4('0x3e')](_0x7b014e);_0x321b5a['id']=_0x1b00ef;_0x321b5a['atimeout']=_0x7b014e;_0x321b5a[_0x5dd4('0x3f')]=_0x57b00f;_0x321b5a['channel']=_0x41ff42[_0x5dd4('0x23')];_0x21ce32['rules'][_0x1b00ef]['on'](_0x5dd4('0x40'),function(){logger[_0x5dd4('0x29')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1b00ef);stopRouting(_0x1b00ef,_0xdeaaf6,_0x41ff42,_0x21ce32);clearTimeout(_0x1d9add);_0x1d9add=undefined;_0x321b5a['close'](!![]);if(_0x21ce32[_0x5dd4('0x41')][_0x1b00ef]){delete _0x21ce32[_0x5dd4('0x41')][_0x1b00ef];}_0x24228c[_0x5dd4('0x3b')]();});_0x21ce32[_0x5dd4('0x41')][_0x1b00ef]['on']('complete',function(){if(_0x21ce32[_0x5dd4('0x41')][_0x1b00ef]){delete _0x21ce32['rules'][_0x1b00ef];}});_0x1d9add=setTimeout(function(){logger['info'](_0x5dd4('0x42'),_0x1b00ef);endRouting(_0x1b00ef,_0xdeaaf6,_0x41ff42,_0x21ce32);clearTimeout(_0x1d9add);_0x321b5a[_0x5dd4('0x43')](!![]);_0x24228c[_0x5dd4('0x44')]();},_0x57b00f);switch(_0xdeaaf6[_0x5dd4('0x45')]){case _0x5dd4('0x46'):strategy[_0x5dd4('0x46')](_0x321b5a,_0xdeaaf6,_0x21ce32,_0x41ff42);break;default:strategy[_0x5dd4('0x47')](_0x321b5a,_0xdeaaf6,_0x21ce32,_0x41ff42);}}else{logger[_0x5dd4('0x2c')](_0x5dd4('0x48'),_0x1b00ef,_0x9c0241[_0x5dd4('0x2a')]);_0x24228c[_0x5dd4('0x3b')]();}}}catch(_0x156bdd){console['log'](_0x156bdd);logger['error']('[%s][QUEUE]\x20%s',_0x1b00ef,_0x156bdd[_0x5dd4('0x49')]);_0x24228c['stop']();}};}; \ No newline at end of file +var _0x09d1=['QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','strategy','rrmemory','log','stack','validate','lodash','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel'];(function(_0x1c12ba,_0x578e46){var _0x1a67fb=function(_0x16f680){while(--_0x16f680){_0x1c12ba['push'](_0x1c12ba['shift']());}};_0x1a67fb(++_0x578e46);}(_0x09d1,0xba));var _0x109d=function(_0xe5af4c,_0x360f55){_0xe5af4c=_0xe5af4c-0x0;var _0x2dcc8d=_0x09d1[_0xe5af4c];return _0x2dcc8d;};'use strict';var schema=require(_0x109d('0x0'));var _=require(_0x109d('0x1'));var util=require('util');var seqqueue=require(_0x109d('0x2'));var moment=require(_0x109d('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x109d('0x4'))(_0x109d('0x5'));var strategy=require(_0x109d('0x6'));config[_0x109d('0x7')]=_['defaults'](config['redis'],{'host':_0x109d('0x8'),'port':0x18eb});var io=require(_0x109d('0x9'))(new Redis(config[_0x109d('0x7')]));var attributes=['id',_0x109d('0xa'),_0x109d('0xb'),_0x109d('0xc'),_0x109d('0xd'),_0x109d('0xe')];function emit(_0x26e8a2,_0x11c41b,_0x55260b){io['to'](_0x26e8a2)[_0x109d('0xf')](_0x11c41b,_0x55260b);}function emitChannelQueueInteraction(_0x3114cb,_0x3b6731,_0x424035,_0x41e61b,_0x578bb2,_0x587581,_0x104ba0,_0x586dc0){var _0x2048d5=_[_0x109d('0x10')](_0x424035);_0x2048d5[_0x109d('0xa')]=_0x586dc0;_0x2048d5[_0x109d('0xc')]=_0x3b6731;_0x2048d5['account']=_0x41e61b;_0x2048d5['id']=_0x578bb2;if(_0x587581){_0x104ba0[util[_0x109d('0x11')]('%sQueuesWaitingInteractions',_0x3114cb)][_0x578bb2]=_['pick'](_0x2048d5,attributes);}else{delete _0x104ba0[util[_0x109d('0x11')](_0x109d('0x12'),_0x3114cb)][_0x578bb2];}emit(util[_0x109d('0x11')](_0x109d('0x13'),_0x3114cb,_0x3b6731),util[_0x109d('0x11')](_0x109d('0x14'),_0x3114cb,_0x587581?'save':_0x109d('0x15')),_['pick'](_0x2048d5,attributes));}var rpc={'openchannelQueueReport':require(_0x109d('0x16')),'mailQueueReport':require(_0x109d('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x109d('0x18')),'faxQueueReport':require(_0x109d('0x19')),'whatsappQueueReport':require(_0x109d('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x109d('0x1b'),'message':_0x109d('0x1c')}});function startRouting(_0x3c38f7,_0x16286a,_0x512a89,_0x1e83b3){if(_0x3c38f7&&_0x16286a&&_0x512a89){_0x16286a[_0x109d('0x1d')]+=0x1;var _0x3e6658={'uniqueid':_0x3c38f7,'from':_0x512a89['body']?_0x512a89[_0x109d('0x1e')][_0x109d('0xd')]:'','joinAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'ContactId':_0x512a89[_0x109d('0x20')]?_0x512a89['contact']['id']:null,'ListId':_0x512a89[_0x109d('0x21')]?_0x512a89[_0x109d('0x21')]['id']:null};_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+_0x109d('0x24')]=_0x16286a['id']||null;_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+'InteractionId']=_0x512a89[_0x109d('0x25')]?_0x512a89[_0x109d('0x25')]['id']:null;_0x3e6658[_[_0x109d('0x22')](_0x512a89['channel'])+'MessageId']=_0x512a89[_0x109d('0x26')]?_0x512a89['message']['id']:null;_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+(_0x512a89[_0x109d('0x23')]!==_0x109d('0x27')?_0x109d('0x28'):_0x109d('0x29'))]=_0x512a89['account']?_0x512a89[_0x109d('0xb')]['id']:null;logger[_0x109d('0x2a')](util['format'](_0x109d('0x2b'),_0x3c38f7,_0x16286a[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x512a89[_0x109d('0x23')],_0x16286a['name'],_0x3e6658,_0x512a89['account'][_0x109d('0x2c')],_0x512a89[_0x109d('0x26')]['id'],!![],_0x1e83b3,_0x16286a['id']);if(rpc[_0x512a89[_0x109d('0x23')]+_0x109d('0x2d')]){return rpc[_0x512a89[_0x109d('0x23')]+_0x109d('0x2d')][_0x109d('0x2e')](_0x3e6658)['catch'](function(_0x17650f){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x43c630,_0x37157d,_0x5ae6fa,_0x506f53){if(_0x43c630&&_0x37157d){_0x37157d['waiting']-=0x1;var _0x3cadc6={'leaveAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'acceptAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'reason':_0x109d('0x2f')};logger['info'](util['format'](_0x109d('0x30'),_0x43c630,_0x37157d[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x5ae6fa[_0x109d('0x23')],_0x37157d['name'],_0x5ae6fa['body'],_0x5ae6fa[_0x109d('0xb')][_0x109d('0x2c')],_0x5ae6fa[_0x109d('0x26')]['id'],![],_0x506f53,_0x37157d['id']);if(rpc[_0x5ae6fa[_0x109d('0x23')]+_0x109d('0x2d')]){return rpc[_0x5ae6fa[_0x109d('0x23')]+_0x109d('0x2d')][_0x109d('0x31')](_0x43c630,_0x3cadc6)[_0x109d('0x32')](function(_0x19441f){logger['error'](_0x109d('0x33'));});}}}function endRouting(_0xd6729f,_0xd3e6cc,_0x3ca95b,_0x18074f){if(_0xd6729f&&_0xd3e6cc){_0xd3e6cc[_0x109d('0x1d')]-=0x1;var _0x51c506={'leaveAt':moment()[_0x109d('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'reason':_0x109d('0x34')};logger[_0x109d('0x2a')](util[_0x109d('0x11')]('[%s][END:QUEUE][NAME:%s]',_0xd6729f,_0xd3e6cc[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x3ca95b['channel'],_0xd3e6cc[_0x109d('0x2c')],_0x3ca95b[_0x109d('0x1e')],_0x3ca95b['account'][_0x109d('0x2c')],_0x3ca95b['message']['id'],![],_0x18074f);if(rpc[_0x3ca95b[_0x109d('0x23')]+'QueueReport']){return rpc[_0x3ca95b['channel']+_0x109d('0x2d')][_0x109d('0x31')](_0xd6729f,_0x51c506)[_0x109d('0x32')](function(_0x39889d){logger[_0x109d('0x35')](_0x109d('0x33'));});}}}function handleFindQueue(_0x16d4e7){return function(_0x2e3529){return _0x2e3529[_0x109d('0x2c')][_0x109d('0x36')]()===_0x16d4e7[_0x109d('0x36')]();};}exports[_0x109d('0x37')]=function(_0x4195e7,_0x1a4833,_0x31732c,_0x27caa0){return function(_0x16fc7a){try{var _0x2a645e={'name':_0x1a4833[0x0],'timeout':_0x1a4833[0x1]};var _0x502313=queue['validate'](_0x2a645e,{'typecast':!![]});if(_0x502313[_0x109d('0x38')]){logger['error'](_0x109d('0x39'),_0x4195e7,_[_0x109d('0x3a')](_0x502313,_0x109d('0x26'))[_0x109d('0x3b')](',\x20'));_0x16fc7a[_0x109d('0x3c')]();}else{var _0x36ad9d=_[_0x109d('0x3d')](_0x31732c[_0x27caa0['channel']+_0x109d('0x3e')],handleFindQueue(_0x2a645e['name']));if(_0x36ad9d){startRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);var _0x3dcdc2=(_0x36ad9d[_0x109d('0x34')]||0xa)*0x3e8;var _0x3709b4=(_0x2a645e[_0x109d('0x34')]||0x14)*0x3e8;var _0x2d316f,_0x80aaa2;if(_0x3dcdc2>_0x3709b4){_0x3709b4=_0x3dcdc2;}var _0x3bad93=seqqueue[_0x109d('0x3f')](_0x3dcdc2);_0x3bad93['id']=_0x4195e7;_0x3bad93[_0x109d('0x40')]=_0x3dcdc2;_0x3bad93[_0x109d('0x41')]=_0x3709b4;_0x3bad93[_0x109d('0x23')]=_0x27caa0[_0x109d('0x23')];_0x31732c[_0x109d('0x42')][_0x4195e7]['on'](_0x109d('0x43'),function(){logger[_0x109d('0x2a')](_0x109d('0x44'),_0x4195e7);stopRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);clearTimeout(_0x2d316f);_0x2d316f=undefined;_0x3bad93[_0x109d('0x45')](!![]);if(_0x31732c['rules'][_0x4195e7]){delete _0x31732c[_0x109d('0x42')][_0x4195e7];}_0x16fc7a[_0x109d('0x3c')]();});_0x31732c[_0x109d('0x42')][_0x4195e7]['on']('complete',function(){if(_0x31732c[_0x109d('0x42')][_0x4195e7]){delete _0x31732c['rules'][_0x4195e7];}});_0x2d316f=setTimeout(function(){logger[_0x109d('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4195e7);endRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);clearTimeout(_0x2d316f);_0x3bad93[_0x109d('0x45')](!![]);_0x16fc7a['next']();},_0x3709b4);switch(_0x36ad9d[_0x109d('0x46')]){case _0x109d('0x47'):strategy['rrmemory'](_0x3bad93,_0x36ad9d,_0x31732c,_0x27caa0);break;default:strategy['beepall'](_0x3bad93,_0x36ad9d,_0x31732c,_0x27caa0);}}else{logger[_0x109d('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4195e7,_0x2a645e[_0x109d('0x2c')]);_0x16fc7a['stop']();}}}catch(_0x498172){console[_0x109d('0x48')](_0x498172);logger[_0x109d('0x35')](_0x109d('0x39'),_0x4195e7,_0x498172[_0x109d('0x49')]);_0x16fc7a[_0x109d('0x3c')]();}};}; \ 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 da048d0..faf1fb1 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 _0x00d2=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents'];(function(_0x4ef00a,_0x4489c0){var _0x2a1109=function(_0x3f68b7){while(--_0x3f68b7){_0x4ef00a['push'](_0x4ef00a['shift']());}};_0x2a1109(++_0x4489c0);}(_0x00d2,0x8c));var _0x200d=function(_0x27a6e3,_0x466699){_0x27a6e3=_0x27a6e3-0x0;var _0xc6e431=_0x00d2[_0x27a6e3];return _0xc6e431;};'use strict';var _=require(_0x200d('0x0'));var uuid=require(_0x200d('0x1'));var util=require(_0x200d('0x2'));var logger=require(_0x200d('0x3'))('routing');var Agent=function(_0x59488e,_0x5d498d,_0xfaa910,_0x2afbda){this[_0x200d('0x4')]=uuid['v4']();this[_0x200d('0x5')]=_0x59488e;this[_0x200d('0x6')]=_0x5d498d;this[_0x200d('0x7')]=_0xfaa910;this[_0x200d('0x8')]=_0x2afbda;this['squeue'][_0x200d('0x9')](this[_0x200d('0xa')][_0x200d('0xb')](this),this[_0x200d('0xc')][_0x200d('0xb')](this));this[_0x200d('0x5')]['on'](_0x200d('0xd'),this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x200d('0xe')][_0x200d('0xb')](this));};Agent[_0x200d('0xf')][_0x200d('0x9')]=function(){this['squeue']['push'](this[_0x200d('0xa')][_0x200d('0xb')](this),this[_0x200d('0xc')]['bind'](this));};Agent[_0x200d('0xf')][_0x200d('0xe')]=function(){this[_0x200d('0xc')](!![]);};Agent[_0x200d('0xf')]['handleRun']=function(){logger[_0x200d('0x10')](_0x200d('0x11'),this[_0x200d('0x5')]['id'],this['agent']['id']);if(_[_0x200d('0x12')](this[_0x200d('0x7')][_0x200d('0x13')][this[_0x200d('0x6')]['id']])){logger[_0x200d('0x10')](_0x200d('0x14'),this[_0x200d('0x5')]['id'],this[_0x200d('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x200d('0x15')]||util[_0x200d('0x16')](this[_0x200d('0x5')]['id'],this['realtime'][_0x200d('0x13')][this[_0x200d('0x6')]['id']],this[_0x200d('0x5')][_0x200d('0x17')],![])){this[_0x200d('0x7')][_0x200d('0x13')][this[_0x200d('0x6')]['id']][_0x200d('0x18')]=!![];this[_0x200d('0x7')]['agents'][this['agent']['id']][_0x200d('0x19')]=undefined;util[_0x200d('0x1a')](this[_0x200d('0x4')],this[_0x200d('0x5')]['id'],this[_0x200d('0x7')][_0x200d('0x13')][this[_0x200d('0x6')]['id']],null,this[_0x200d('0x8')]);util[_0x200d('0x1b')](this[_0x200d('0x5')]['id'],this['realtime'][_0x200d('0x13')][this['agent']['id']],_0x200d('0x1c')+(this[_0x200d('0x8')][_0x200d('0x15')]?':FORCED':''));}else{logger[_0x200d('0x10')](_0x200d('0x1d'),this[_0x200d('0x5')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x200d('0xf')][_0x200d('0xc')]=function(_0xa1475a){if(_[_0x200d('0x12')](this[_0x200d('0x7')]['agents'][this['agent']['id']])){return logger[_0x200d('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x200d('0x5')]['id'],this[_0x200d('0x6')]['id']);}else{logger[_0x200d('0x10')](_0x200d('0x1e'),this[_0x200d('0x5')]['id'],this[_0x200d('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x200d('0x5')]['id'],this[_0x200d('0x7')]['agents'][this[_0x200d('0x6')]['id']],null,this['routing']);this[_0x200d('0x7')]['agents'][this[_0x200d('0x6')]['id']][_0x200d('0x18')]=![];this[_0x200d('0x7')][_0x200d('0x13')][this[_0x200d('0x6')]['id']][_0x200d('0x19')]=undefined;util[_0x200d('0x1b')](this[_0x200d('0x5')]['id'],this[_0x200d('0x7')][_0x200d('0x13')][this[_0x200d('0x6')]['id']],_0xa1475a?'STOP':_0x200d('0x1f'));}if(!_0xa1475a){setTimeout(this[_0x200d('0x9')]['bind'](this),0x3e8);}};function agent(_0xaea119,_0x582f77,_0x552cb2,_0x7b0ba0){return new Agent(_0xaea119,_0x582f77,_0x552cb2,_0x7b0ba0);}module['exports']=agent; \ No newline at end of file +var _0xa67e=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','busyQueue','showNotification','notificationId','writeLog','RINGING'];(function(_0x4e91bc,_0x121e9a){var _0x3c657f=function(_0x48f214){while(--_0x48f214){_0x4e91bc['push'](_0x4e91bc['shift']());}};_0x3c657f(++_0x121e9a);}(_0xa67e,0xa1));var _0xea67=function(_0x3d641e,_0x1be41c){_0x3d641e=_0x3d641e-0x0;var _0x3da8b9=_0xa67e[_0x3d641e];return _0x3da8b9;};'use strict';var _=require(_0xea67('0x0'));var uuid=require(_0xea67('0x1'));var util=require('./util');var logger=require(_0xea67('0x2'))(_0xea67('0x3'));var Agent=function(_0x33f5dc,_0x1ca54b,_0x8014f1,_0x346cf5){this['notificationId']=uuid['v4']();this[_0xea67('0x4')]=_0x33f5dc;this[_0xea67('0x5')]=_0x1ca54b;this['realtime']=_0x8014f1;this[_0xea67('0x3')]=_0x346cf5;this[_0xea67('0x4')]['push'](this[_0xea67('0x6')][_0xea67('0x7')](this),this[_0xea67('0x8')][_0xea67('0x7')](this));this[_0xea67('0x4')]['on'](_0xea67('0x9'),this[_0xea67('0x8')][_0xea67('0x7')](this));this['squeue']['on'](_0xea67('0xa'),this['handleDrained'][_0xea67('0x7')](this));};Agent[_0xea67('0xb')]['push']=function(){this['squeue'][_0xea67('0xc')](this[_0xea67('0x6')][_0xea67('0x7')](this),this[_0xea67('0x8')][_0xea67('0x7')](this));};Agent['prototype'][_0xea67('0xd')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xea67('0x6')]=function(){logger[_0xea67('0xe')](_0xea67('0xf'),this['squeue']['id'],this[_0xea67('0x5')]['id']);if(_[_0xea67('0x10')](this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']])){logger[_0xea67('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);setTimeout(this[_0xea67('0xc')][_0xea67('0x7')](this),0x3e8);}else{if(this[_0xea67('0x3')][_0xea67('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0xea67('0x12')][this[_0xea67('0x5')]['id']],this[_0xea67('0x4')]['channel'],![])){this['realtime'][_0xea67('0x12')][this['agent']['id']]['busy']=!![];this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']][_0xea67('0x14')]=undefined;util[_0xea67('0x15')](this[_0xea67('0x16')],this[_0xea67('0x4')]['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],null,this['routing']);util[_0xea67('0x17')](this['squeue']['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],_0xea67('0x18')+(this[_0xea67('0x3')][_0xea67('0x13')]?_0xea67('0x19'):''));}else{logger[_0xea67('0xe')](_0xea67('0x1a'),this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);setTimeout(this[_0xea67('0xc')]['bind'](this),0x3e8);}}};Agent[_0xea67('0xb')][_0xea67('0x8')]=function(_0x564484){if(_[_0xea67('0x10')](this['realtime'][_0xea67('0x12')][this[_0xea67('0x5')]['id']])){return logger[_0xea67('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);}else{logger[_0xea67('0xe')](_0xea67('0x1b'),this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);util[_0xea67('0x1c')](this[_0xea67('0x16')],this['squeue']['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],null,this['routing']);this['realtime'][_0xea67('0x12')][this['agent']['id']]['busy']=![];this[_0xea67('0x11')][_0xea67('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0xea67('0x17')](this[_0xea67('0x4')]['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],_0x564484?_0xea67('0x1d'):'TIMEOUT');}if(!_0x564484){setTimeout(this[_0xea67('0xc')][_0xea67('0x7')](this),0x3e8);}};function agent(_0x1299cb,_0x20341c,_0x1357ab,_0x557d0d){return new Agent(_0x1299cb,_0x20341c,_0x1357ab,_0x557d0d);}module[_0xea67('0x1e')]=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 2c0224b..efe29dd 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 _0xde2c=['notificationId','squeue','queue','realtime','push','handleRun','bind','timeout','drained','handleDrained','handleTimeout','prototype','isNil','length','Agents','agents','debug','isAgentAvailable','RINGING','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','writeLog','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xde2c,0x7f));var _0xcde2=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xde2c[_0x1fb4e1];return _0x22d1b0;};'use strict';var _=require(_0xcde2('0x0'));var uuid=require(_0xcde2('0x1'));var util=require(_0xcde2('0x2'));var logger=require(_0xcde2('0x3'))(_0xcde2('0x4'));var Beepall=function(_0x40fa0a,_0x33bb0c,_0x3a309f,_0x55c175){this[_0xcde2('0x5')]=uuid['v4']();this[_0xcde2('0x6')]=_0x40fa0a;this[_0xcde2('0x7')]=_0x33bb0c;this[_0xcde2('0x8')]=_0x3a309f;this[_0xcde2('0x4')]=_0x55c175;this['squeue'][_0xcde2('0x9')](this[_0xcde2('0xa')][_0xcde2('0xb')](this),this['handleTimeout']['bind'](this));this[_0xcde2('0x6')]['on'](_0xcde2('0xc'),this['handleTimeout'][_0xcde2('0xb')](this));this[_0xcde2('0x6')]['on'](_0xcde2('0xd'),this[_0xcde2('0xe')]['bind'](this));};Beepall['prototype'][_0xcde2('0x9')]=function(){this[_0xcde2('0x6')][_0xcde2('0x9')](this[_0xcde2('0xa')][_0xcde2('0xb')](this),this[_0xcde2('0xf')]['bind'](this));};Beepall[_0xcde2('0x10')]['handleDrained']=function(){this[_0xcde2('0xf')](!![]);};Beepall['prototype']['handleRun']=function(){var _0x34e079=!![];if(!_[_0xcde2('0x11')](this[_0xcde2('0x7')])&&!_[_0xcde2('0x11')](this[_0xcde2('0x7')]['Agents'])&&this[_0xcde2('0x7')]['Agents'][_0xcde2('0x12')]>0x0){for(var _0x198840=0x0,_0xbade43;_0x1988400x0){for(var _0x9045e6=0x0,_0x21aa11;_0x9045e60x0&&_0x5a7b53[_0x32f8b6+_0xe032('0x22')]>=_0x5a7b53[_0x32f8b6+_0xe032('0x23')]){writeLog(_0x136f5d,_0x5a7b53,_0x32f8b6[_0xe032('0x24')]()+_0xe032('0x25'));return![];}}return!![];};exports[_0xe032('0x26')]=function(_0x2b6ffa,_0x4dcbf1,_0x1ac20b,_0x5bb36a,_0x189ed4){return sendNotification(!![],_0x2b6ffa,_0x4dcbf1,_0x1ac20b,_0x5bb36a,_0x189ed4);};exports[_0xe032('0x27')]=function(_0x3106aa,_0x2a521b,_0x5cc95d,_0x5573e4,_0x3e2575){return sendNotification(![],_0x3106aa,_0x2a521b,_0x5cc95d,_0x5573e4,_0x3e2575);};exports[_0xe032('0x28')]=writeLog; \ No newline at end of file +var _0x5d17=['split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','format','emit'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x5d17,0x114));var _0x75d1=function(_0x197767,_0x400276){_0x197767=_0x197767-0x0;var _0x5422c6=_0x5d17[_0x197767];return _0x5422c6;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x75d1('0x2'));var logger=require(_0x75d1('0x3'))(_0x75d1('0x4'));config['redis']=_[_0x75d1('0x5')](config[_0x75d1('0x6')],{'host':_0x75d1('0x7'),'port':0x18eb});var io=require(_0x75d1('0x8'))(new Redis(config['redis']));function sendNotification(_0x458681,_0x116a51,_0x5c957a,_0x1ee61b,_0x3a9d5e,_0x105607){io['to'](util[_0x75d1('0x9')]('user:%s',_0x1ee61b['name']))[_0x75d1('0xa')]('user:save',_0x1ee61b);var _0x57be31=_0x105607||{};var _0x120b53=_0x5c957a[_0x75d1('0xb')]('.');var _0x4d4aa1={'uniqueid':_0x116a51,'channel':_0x120b53[0x0],'id':_0x120b53[0x1],'title':_0x120b53[0x0]+_0x75d1('0xc'),'interactionId':_0x120b53[0x2],'queue':_0x3a9d5e?_0x3a9d5e[_0x75d1('0xd')]:null,'sound':_0x57be31[_0x75d1('0xe')][_0x75d1('0xf')],'shake':_0x57be31[_0x75d1('0xe')][_0x75d1('0x10')]};try{if(!_0x57be31['body']){_0x57be31[_0x75d1('0x11')]={};}if(_0x3a9d5e){_0x57be31[_0x75d1('0x11')][_0x75d1('0x12')]=_0x3a9d5e;}else if(_0x57be31[_0x75d1('0x11')]['queue']){delete _0x57be31['body']['queue'];}_0x4d4aa1[_0x75d1('0x13')]=utils[_0x75d1('0x14')](_0x57be31[_0x75d1('0xe')]['notificationTemplate'],_0x57be31);}catch(_0x1f9620){_0x4d4aa1[_0x75d1('0x13')]=_0x75d1('0x15');logger[_0x75d1('0x16')](util[_0x75d1('0x9')](_0x75d1('0x17'),_0x116a51,_0x1f9620[_0x75d1('0x18')]));}io['to'](util[_0x75d1('0x9')](_0x75d1('0x19'),_0x1ee61b[_0x75d1('0xd')]))[_0x75d1('0xa')](util['format']('notification:%s',_0x458681?_0x75d1('0x1a'):_0x75d1('0x1b')),_0x4d4aa1);}function writeLog(_0x56730d,_0x31eb88,_0x406143){return logger[_0x75d1('0x1c')](util[_0x75d1('0x9')](_0x75d1('0x1d'),_0x56730d,_0x31eb88[_0x75d1('0xd')],_0x406143));}exports['isAgentAvailable']=function(_0x1d9d25,_0x522924,_0x501cc7,_0x1cb58c){if(_0x522924[_0x75d1('0x1e')]){writeLog(_0x1d9d25,_0x522924,'BUSY');return![];}if(!_0x522924[_0x75d1('0x1f')]){writeLog(_0x1d9d25,_0x522924,'OFFLINE');return![];}if(_0x522924[_0x501cc7+_0x75d1('0x20')]){writeLog(_0x1d9d25,_0x522924,_0x75d1('0x21'));return![];}if(_0x1cb58c&&_0x522924[_0x75d1('0x22')](_0x501cc7+'Capacity')&&_0x522924['hasOwnProperty'](_0x501cc7+_0x75d1('0x23'))){if(_0x522924[_0x501cc7+_0x75d1('0x24')]>0x0&&_0x522924[_0x501cc7+_0x75d1('0x23')]>=_0x522924[_0x501cc7+_0x75d1('0x24')]){writeLog(_0x1d9d25,_0x522924,_0x501cc7['toUpperCase']()+_0x75d1('0x25'));return![];}}return!![];};exports[_0x75d1('0x26')]=function(_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9){return sendNotification(!![],_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9);};exports[_0x75d1('0x27')]=function(_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e){return sendNotification(![],_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e);};exports[_0x75d1('0x28')]=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 7f455f8..f09f07d 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 _0x4fdb=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x3bc4c4,_0x3e7bb8){_0x3bc4c4=_0x3bc4c4-0x0;var _0x2eed2e=_0x4fdb[_0x3bc4c4];return _0x2eed2e;};'use strict';var schema=require(_0xb4fd('0x0'));var sh=require(_0xb4fd('0x1'));var _=require(_0xb4fd('0x2'));var utils=require(_0xb4fd('0x3'));var logger=require(_0xb4fd('0x4'))(_0xb4fd('0x5'));var system=schema({'command':{'type':_0xb4fd('0x6'),'required':!![],'message':_0xb4fd('0x7')}});exports[_0xb4fd('0x8')]=function(_0x5b73bb,_0x308de6){return function(_0x5c07c5){try{var _0x14052b={'command':_0x308de6[0x0]};var _0x5d8b39=system['validate'](_0x14052b,{'typecast':!![]});if(_0x5d8b39[_0xb4fd('0x9')]){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_['map'](_0x5d8b39,'message')[_0xb4fd('0xc')](',\x20'));logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5['next']();}else{var _0x1e1e16=this;var _0x17ac4b=utils[_0xb4fd('0xf')](_0x308de6[0x0],this);logger[_0xb4fd('0xd')](_0xb4fd('0x10'),_0x5b73bb,_0x17ac4b);sh['exec'](_[_0xb4fd('0x11')](_0x17ac4b),function(_0x1f3e30,_0x2e8ee1){logger[_0xb4fd('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b73bb,_0x1f3e30);if(_0x1f3e30==0x0){var _0x38173d=_0x2e8ee1[_0xb4fd('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb4fd('0x13')](_0x308de6[0x1])||_['isEmpty'](_0x308de6[0x1])){logger[_0xb4fd('0xd')](_0xb4fd('0x14'),_0x5b73bb);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}else{logger[_0xb4fd('0xd')](_0xb4fd('0x16'),_0x5b73bb,_0x308de6[0x1],_0x38173d);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}}_0x5c07c5[_0xb4fd('0x17')]();});}}catch(_0x47e288){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_[_0xb4fd('0x18')](_0x47e288)?JSON[_0xb4fd('0x19')](_0x47e288):_0x47e288);logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5[_0xb4fd('0x17')]();}};}; \ No newline at end of file +var _0xfe72=['string','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xfe72,0x1a3));var _0x2fe7=function(_0xedce5d,_0x91b7db){_0xedce5d=_0xedce5d-0x0;var _0x4bee3b=_0xfe72[_0xedce5d];return _0x4bee3b;};'use strict';var schema=require(_0x2fe7('0x0'));var sh=require(_0x2fe7('0x1'));var _=require(_0x2fe7('0x2'));var utils=require(_0x2fe7('0x3'));var logger=require(_0x2fe7('0x4'))(_0x2fe7('0x5'));var system=schema({'command':{'type':_0x2fe7('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5b6979,_0x3aaf20){return function(_0x3d4a1a){try{var _0x4bb752={'command':_0x3aaf20[0x0]};var _0xcc087c=system[_0x2fe7('0x0')](_0x4bb752,{'typecast':!![]});if(_0xcc087c[_0x2fe7('0x7')]){logger[_0x2fe7('0x8')](_0x2fe7('0x9'),_0x5b6979,_[_0x2fe7('0xa')](_0xcc087c,'message')['join'](',\x20'));logger[_0x2fe7('0xb')](_0x2fe7('0xc'),_0x5b6979);_0x3d4a1a[_0x2fe7('0xd')]();}else{var _0x5af0a2=this;var _0x277b98=utils[_0x2fe7('0xe')](_0x3aaf20[0x0],this);logger['info'](_0x2fe7('0xf'),_0x5b6979,_0x277b98);sh[_0x2fe7('0x10')](_[_0x2fe7('0x11')](_0x277b98),function(_0x1e20fc,_0x41e8b5){logger[_0x2fe7('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b6979,_0x1e20fc);if(_0x1e20fc==0x0){var _0xa5385e=_0x41e8b5[_0x2fe7('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2fe7('0x13')](_0x3aaf20[0x1])||_[_0x2fe7('0x14')](_0x3aaf20[0x1])){logger[_0x2fe7('0xb')](_0x2fe7('0x15'),_0x5b6979);_0x5af0a2[_0x2fe7('0x16')][_0x3aaf20[0x1]]=_0xa5385e;}else{logger[_0x2fe7('0xb')](_0x2fe7('0x17'),_0x5b6979,_0x3aaf20[0x1],_0xa5385e);_0x5af0a2[_0x2fe7('0x16')][_0x3aaf20[0x1]]=_0xa5385e;}}_0x3d4a1a[_0x2fe7('0xd')]();});}}catch(_0x427986){logger['error'](_0x2fe7('0x9'),_0x5b6979,_['isObject'](_0x427986)?JSON[_0x2fe7('0x18')](_0x427986):_0x427986);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5b6979);_0x3d4a1a[_0x2fe7('0xd')]();}};}; \ 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 a73238a..f17afc8 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 _0x51f4=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x51f4,0x177));var _0x451f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x51f4[_0x2641f9];return _0x585741;};'use strict';var schema=require(_0x451f('0x0'));var _=require(_0x451f('0x1'));var rpc={'chatInteraction':require(_0x451f('0x2')),'openchannelInteraction':require(_0x451f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x451f('0x4')),'faxInteraction':require(_0x451f('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x451f('0x6'))(_0x451f('0x7'));var tag=schema({'tag':{'type':_0x451f('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x57cba0,_0x48fa8f,_0x4051e3,_0x264c4e){return function(_0x1379ff){try{var _0x272576={'tag':_0x48fa8f[0x0]};var _0x3ef87f=tag['validate'](_0x272576,{'typecast':!![]});if(_0x3ef87f[_0x451f('0x9')]){logger['error'](_0x451f('0xa'),_0x57cba0,_['map'](_0x3ef87f,_0x451f('0xb'))[_0x451f('0xc')](',\x20'));logger[_0x451f('0xd')](_0x451f('0xe'),_0x57cba0);_0x1379ff[_0x451f('0xf')]();}else{var _0x130976={'ids':[_0x48fa8f[0x0]]};if(rpc[_0x264c4e[_0x451f('0x10')]+_0x451f('0x11')]){rpc[_0x264c4e[_0x451f('0x10')]+_0x451f('0x11')][_0x451f('0x12')](_0x264c4e[_0x451f('0x13')]['id'],_0x130976)[_0x451f('0x14')](function(_0x8c4675){logger[_0x451f('0xd')](_0x451f('0x15'),_0x57cba0,_0x48fa8f[0x1],_0x264c4e['channel'],_0x264c4e['interaction']['id']);})[_0x451f('0x16')](function(_0x324269){logger[_0x451f('0x17')](_0x451f('0xa'),_0x57cba0,JSON['stringify'](_0x324269));logger[_0x451f('0xd')](_0x451f('0xe'),_0x57cba0);})[_0x451f('0x18')](function(){_0x1379ff['next']();});}}}catch(_0x209204){logger[_0x451f('0x17')](_0x451f('0xa'),_0x57cba0,_[_0x451f('0x19')](_0x209204)?JSON[_0x451f('0x1a')](_0x209204):_0x209204);logger[_0x451f('0xd')](_0x451f('0xe'),_0x57cba0);_0x1379ff['next']();}};}; \ No newline at end of file +var _0x592a=['consequence','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','info','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number'];(function(_0x2649b8,_0x6692f){var _0x2506ea=function(_0x26103){while(--_0x26103){_0x2649b8['push'](_0x2649b8['shift']());}};_0x2506ea(++_0x6692f);}(_0x592a,0xa0));var _0xa592=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x592a[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0xa592('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa592('0x1')),'openchannelInteraction':require(_0xa592('0x2')),'smsInteraction':require(_0xa592('0x3')),'mailInteraction':require(_0xa592('0x4')),'faxInteraction':require(_0xa592('0x5')),'whatsappInteraction':require(_0xa592('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xa592('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa592('0x8')]=function(_0x5db14b,_0x1539f7,_0x1f5baa,_0x139000){return function(_0x55d7a7){try{var _0x401bd3={'tag':_0x1539f7[0x0]};var _0x3b34f8=tag[_0xa592('0x0')](_0x401bd3,{'typecast':!![]});if(_0x3b34f8[_0xa592('0x9')]){logger[_0xa592('0xa')](_0xa592('0xb'),_0x5db14b,_[_0xa592('0xc')](_0x3b34f8,_0xa592('0xd'))['join'](',\x20'));logger['info'](_0xa592('0xe'),_0x5db14b);_0x55d7a7[_0xa592('0xf')]();}else{var _0xa06d87={'ids':[_0x1539f7[0x0]]};if(rpc[_0x139000[_0xa592('0x10')]+_0xa592('0x11')]){rpc[_0x139000[_0xa592('0x10')]+'Interaction'][_0xa592('0x12')](_0x139000[_0xa592('0x13')]['id'],_0xa06d87)[_0xa592('0x14')](function(_0x190197){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5db14b,_0x1539f7[0x1],_0x139000[_0xa592('0x10')],_0x139000[_0xa592('0x13')]['id']);})[_0xa592('0x15')](function(_0x2261c7){logger[_0xa592('0xa')]('[%s][TAG]\x20%s',_0x5db14b,JSON['stringify'](_0x2261c7));logger[_0xa592('0x16')](_0xa592('0xe'),_0x5db14b);})['finally'](function(){_0x55d7a7['next']();});}}}catch(_0x4647f3){logger[_0xa592('0xa')](_0xa592('0xb'),_0x5db14b,_[_0xa592('0x17')](_0x4647f3)?JSON['stringify'](_0x4647f3):_0x4647f3);logger[_0xa592('0x16')](_0xa592('0xe'),_0x5db14b);_0x55d7a7['next']();}};}; \ 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 baf9f9b..0541cc7 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 _0xc264=['error','isObject','stop','next','routing','lodash','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','params','stringify','utf8','application/json-rpc','then','result','logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x523742,_0xc4fcb8){var _0x5dd80f=function(_0xaaf6a){while(--_0xaaf6a){_0x523742['push'](_0x523742['shift']());}};_0x5dd80f(++_0xc4fcb8);}(_0xc264,0x17e));var _0x4c26=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc264[_0x5f09c5];return _0x426ad9;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x4c26('0x0'));var _=require(_0x4c26('0x1'));var arr=[];exports['consequence']=function(_0x192e5b,_0x3b2b45){return function(_0x9ec691){var _0x3b1f0d=_0x3b2b45[0xa];var _0x295ff7=_0x3b2b45[0xb];var _0x3a8e27=_0x3b2b45[0xc];var _0x463277=_0x3b2b45[0xd];var _0x1e9670=_0x3b2b45[0xe];var _0x121d14=_0x3b2b45[0xf][_0x4c26('0x2')](/\n/g,_0x4c26('0x3'));var _0x6ca033=_0x3b2b45[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4c26('0x4')](_0x295ff7)){arr[_0x4c26('0x5')](_0x295ff7);var _0x2f5aca=_0x3b2b45[0x3];var _0x760b40=_0x3b2b45[0x4];var _0x477a16=_0x3b2b45[0x1];var _0x145c7c=_0x3b2b45[0x0];var _0x2c8d68={};_0x2c8d68['urlOnAnswer']=_0x3b2b45[0x8]+_0x4c26('0x6')+_0x3a8e27+'|'+_0x3b1f0d+'|'+_0x463277+'|'+_0x295ff7+'|'+_0x1e9670;_0x2c8d68[_0x4c26('0x7')]=_0x3b2b45[0x7]+_0x4c26('0x6')+_0x3a8e27+'|'+_0x3b1f0d+'|'+_0x463277+'|'+_0x295ff7+'|'+_0x1e9670+'|'+_0x121d14+'|'+_0x6ca033;_0x2c8d68[_0x4c26('0x8')]=_0x3b2b45[0x9];var _0x18f966={};_0x18f966[_0x4c26('0x9')]=_0x4c26('0xa');_0x18f966['method']='login';var _0x21748f=[];_0x21748f['push'](_0x3b2b45[0x2]);_0x21748f[_0x4c26('0x5')](_0x3b2b45[0x5]);_0x21748f[_0x4c26('0x5')](_0x3b2b45[0x6]);_0x18f966[_0x4c26('0xb')]=_0x21748f;_0x18f966['id']=0x1;var _0x149121=JSON[_0x4c26('0xc')](_0x18f966);var _0x210c3e={'encoding':_0x4c26('0xd'),'method':'POST','timeout':0x2710,'url':_0x2f5aca,'headers':{'Content-Type':_0x4c26('0xe')},'body':_0x149121};return rp(_0x210c3e)[_0x4c26('0xf')](function(_0x1046ae){const _0x308bb6=JSON['parse'](_0x1046ae);if(!_0x308bb6[_0x4c26('0x10')][_0x4c26('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x44ef06=_0x295ff7;var _0x540b14=_0x4c26('0x12')+_0x477a16+_0x4c26('0x13')+_0x145c7c+_0x4c26('0x14')+_0x44ef06+'&data='+JSON[_0x4c26('0xc')](_0x2c8d68);var _0x1f1dbd=_0x760b40+'?'+_0x540b14;return rp(_0x1f1dbd);})[_0x4c26('0xf')](function(_0x1d7895){logger[_0x4c26('0x15')](_0x4c26('0x16'),_0x192e5b,_0x1d7895);_0x9ec691['stop']();})['catch'](function(_0x304acc){logger[_0x4c26('0x17')]('[%s][TVOX]\x20%s',_0x192e5b,_[_0x4c26('0x18')](_0x304acc)?JSON[_0x4c26('0xc')](_0x304acc):_0x304acc);_0x9ec691[_0x4c26('0x19')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x192e5b);_0x9ec691[_0x4c26('0x1a')]();}};}; \ No newline at end of file +var _0xb8d7=['logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','login','params','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x4f03f6,_0x15994e){var _0x146130=function(_0xe4c9c0){while(--_0xe4c9c0){_0x4f03f6['push'](_0x4f03f6['shift']());}};_0x146130(++_0x15994e);}(_0xb8d7,0xdf));var _0x7b8d=function(_0x9d77b5,_0x4fcdb3){_0x9d77b5=_0x9d77b5-0x0;var _0x4b26d0=_0xb8d7[_0x9d77b5];return _0x4b26d0;};'use strict';var rp=require(_0x7b8d('0x0'));var logger=require('../../../../config/logger')(_0x7b8d('0x1'));var _=require(_0x7b8d('0x2'));var arr=[];exports[_0x7b8d('0x3')]=function(_0xdd84aa,_0x2d506c){return function(_0x459f25){var _0x2d8504=_0x2d506c[0xa];var _0x31a744=_0x2d506c[0xb];var _0x261ee8=_0x2d506c[0xc];var _0x3ae5cc=_0x2d506c[0xd];var _0x28c9f8=_0x2d506c[0xe];var _0x221fd8=_0x2d506c[0xf][_0x7b8d('0x4')](/\n/g,_0x7b8d('0x5'));var _0x555bf1=_0x2d506c[0x10][_0x7b8d('0x4')](/\n/g,'\x20');if(!arr[_0x7b8d('0x6')](_0x31a744)){arr[_0x7b8d('0x7')](_0x31a744);var _0x2f299c=_0x2d506c[0x3];var _0x59a8ea=_0x2d506c[0x4];var _0x72a501=_0x2d506c[0x1];var _0x351816=_0x2d506c[0x0];var _0x27c314={};_0x27c314[_0x7b8d('0x8')]=_0x2d506c[0x8]+'?params='+_0x261ee8+'|'+_0x2d8504+'|'+_0x3ae5cc+'|'+_0x31a744+'|'+_0x28c9f8;_0x27c314[_0x7b8d('0x9')]=_0x2d506c[0x7]+_0x7b8d('0xa')+_0x261ee8+'|'+_0x2d8504+'|'+_0x3ae5cc+'|'+_0x31a744+'|'+_0x28c9f8+'|'+_0x221fd8+'|'+_0x555bf1;_0x27c314[_0x7b8d('0xb')]=_0x2d506c[0x9];var _0x3d4bf8={};_0x3d4bf8[_0x7b8d('0xc')]='2.0';_0x3d4bf8[_0x7b8d('0xd')]=_0x7b8d('0xe');var _0x205ff7=[];_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x2]);_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x5]);_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x6]);_0x3d4bf8[_0x7b8d('0xf')]=_0x205ff7;_0x3d4bf8['id']=0x1;var _0x1fc32c=JSON['stringify'](_0x3d4bf8);var _0x415d35={'encoding':_0x7b8d('0x10'),'method':_0x7b8d('0x11'),'timeout':0x2710,'url':_0x2f299c,'headers':{'Content-Type':_0x7b8d('0x12')},'body':_0x1fc32c};return rp(_0x415d35)[_0x7b8d('0x13')](function(_0x18bd74){const _0x359f70=JSON[_0x7b8d('0x14')](_0x18bd74);if(!_0x359f70[_0x7b8d('0x15')][_0x7b8d('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x46d661=_0x31a744;var _0x408eb9=_0x7b8d('0x17')+_0x72a501+_0x7b8d('0x18')+_0x351816+_0x7b8d('0x19')+_0x46d661+'&data='+JSON['stringify'](_0x27c314);var _0x41c438=_0x59a8ea+'?'+_0x408eb9;return rp(_0x41c438);})[_0x7b8d('0x13')](function(_0x45f4ca){logger[_0x7b8d('0x1a')](_0x7b8d('0x1b'),_0xdd84aa,_0x45f4ca);_0x459f25[_0x7b8d('0x1c')]();})[_0x7b8d('0x1d')](function(_0x49553e){logger[_0x7b8d('0x1e')](_0x7b8d('0x1f'),_0xdd84aa,_[_0x7b8d('0x20')](_0x49553e)?JSON[_0x7b8d('0x21')](_0x49553e):_0x49553e);_0x459f25[_0x7b8d('0x1c')]();});}else{logger[_0x7b8d('0x1a')](_0x7b8d('0x22'),_0xdd84aa);_0x459f25['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 76f7358..45812db 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x32204d,_0x1d166d){var _0x463f4c=function(_0x39ba0b){while(--_0x39ba0b){_0x32204d['push'](_0x32204d['shift']());}};_0x463f4c(++_0x1d166d);}(_0xe706,0xa3));var _0x6e70=function(_0x4927dc,_0x54b3f6){_0x4927dc=_0x4927dc-0x0;var _0x45e1c3=_0xe706[_0x4927dc];return _0x45e1c3;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2d95ff,_0x50cb4a){var _0x54e1bb=function(_0x42f543){while(--_0x42f543){_0x2d95ff['push'](_0x2d95ff['shift']());}};_0x54e1bb(++_0x50cb4a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 75a7831..36d940d 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 _0xe43c=['../lib/rule-engine','%s.%s.%s','IntervalId','map','Intervals','interval','isNil','rules','channel','message','interaction','applications','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','body','%s:%s:%s','./interval','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','loggedIn','waiting','mailQueues','paused','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport'];(function(_0x26aafa,_0x100c92){var _0x13b20e=function(_0x3f6216){while(--_0x3f6216){_0x26aafa['push'](_0x26aafa['shift']());}};_0x13b20e(++_0x100c92);}(_0xe43c,0x180));var _0xce43=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe43c[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xce43('0x0'));var util=require(_0xce43('0x1'));var path=require(_0xce43('0x2'));var fs=require('fs');var jayson=require(_0xce43('0x3'));var BPromise=require(_0xce43('0x4'));var uuid=require(_0xce43('0x5'));var utils=require('./applications/utils');var config=require(_0xce43('0x6'));var logger=require('../../../config/logger')(_0xce43('0x7'));var rpc={'openchannelQueueReport':require(_0xce43('0x8')),'mailQueueReport':require(_0xce43('0x9')),'chatQueueReport':require(_0xce43('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xce43('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xce43('0xc'));function getId(_0x5c4af2,_0x3affb9,_0x48b578){return util['format'](_0xce43('0xd'),_0x5c4af2,_0x3affb9||0x0,_0x48b578||0x0);}function getIntervals(_0x364f44,_0x4a62bd){var _0x5ec3f9=[];if(!_['isNil'](_0x4a62bd[_0xce43('0xe')])&&!_['isNil'](_0x364f44[_0x4a62bd[_0xce43('0xe')]])&&!_['isNil'](_0x364f44[_0x4a62bd[_0xce43('0xe')]]['Intervals'])){_0x5ec3f9=_[_0xce43('0xf')](_0x364f44[_0x4a62bd[_0xce43('0xe')]][_0xce43('0x10')],_0xce43('0x11'));}else if(!_[_0xce43('0x12')](_0x4a62bd[_0xce43('0x11')])){_0x5ec3f9=[_0x4a62bd[_0xce43('0x11')]];}return _0x5ec3f9;}exports['listen']=function(_0x3034c7){_0x3034c7[_0xce43('0x13')]={};return new BPromise(function(_0x3cd0f7,_0x27ab4a){var _0x4cb58a={'Start':function(_0x588ddb){var _0x3c0948=this;return new Promise(function(_0x3e4218,_0x2eb70b){if(_0x588ddb){try{var _0x2a9cb4=[];var _0xd5282=getId(_0x588ddb[_0xce43('0x14')],_0x588ddb['message']?_0x588ddb[_0xce43('0x15')]['id']:0x0,_0x588ddb[_0xce43('0x16')]?_0x588ddb[_0xce43('0x16')]['id']:0x0);if(_0x588ddb[_0xce43('0x17')]&&_['isArray'](_0x588ddb[_0xce43('0x17')])&&_0x588ddb[_0xce43('0x17')][_0xce43('0x18')]){for(var _0x2506de=0x0;_0x2506de<_0x588ddb[_0xce43('0x17')][_0xce43('0x18')];_0x2506de+=0x1){var _0x5327e8=_0x588ddb[_0xce43('0x17')][_0x2506de];if(fs[_0xce43('0x19')](path['join'](__dirname,_0xce43('0x17'),_0x5327e8[_0xce43('0x1a')]+_0xce43('0x1b')))){var _0x5a5bd1=[];switch(_0x5327e8['app'][_0xce43('0x1c')]()){case _0xce43('0x1d'):var _0x2b8862=_0x5327e8[_0xce43('0x1e')][_0xce43('0x1f')](',');if(_0x588ddb[_0xce43('0x14')]===_0xce43('0x20')){_0x5a5bd1['push'](_0x2b8862[0x0]);_0x5a5bd1[_0xce43('0x21')](_0x2b8862[0x1]);_0x5a5bd1[_0xce43('0x21')](_0x2b8862[_0xce43('0x22')](0x2,_0x2b8862[_0xce43('0x18')])['join'](','));}else{_0x5a5bd1[_0xce43('0x21')](_0x2b8862[0x0]);_0x5a5bd1[_0xce43('0x21')](_0x2b8862[_0xce43('0x22')](0x1,_0x2b8862[_0xce43('0x18')])[_0xce43('0x23')](','));}break;case _0xce43('0x24'):var _0x49e958=_0x5327e8[_0xce43('0x1e')]['split'](',');_0x5a5bd1[_0xce43('0x21')](_0x49e958[0x0]);_0x5a5bd1[_0xce43('0x21')](_0x49e958[0x1]);_0x5a5bd1[_0xce43('0x21')](_0x49e958[_0xce43('0x22')](0x2,_0x49e958['length'])[_0xce43('0x23')](','));break;case _0xce43('0x25'):var _0x2a2d1d=_0x5327e8[_0xce43('0x1e')]['split'](',');_0x5a5bd1[_0xce43('0x21')](_0x2a2d1d[0x0]);_0x5a5bd1[_0xce43('0x21')](_0x2a2d1d[0x1]);_0x5a5bd1['push'](_0x2a2d1d[0x2]);_0x5a5bd1[_0xce43('0x21')](_0x2a2d1d[0x3]);_0x5a5bd1[_0xce43('0x21')](_0x2a2d1d[_0xce43('0x22')](0x4,_0x2a2d1d[_0xce43('0x18')])[_0xce43('0x23')](','));break;case _0xce43('0x26'):var _0x496d25=_0x5327e8['appdata'][_0xce43('0x1f')](',');_0x5a5bd1[_0xce43('0x21')](_0x496d25[0x0]);_0x5a5bd1['push'](_0x496d25[0x1]);_0x5a5bd1[_0xce43('0x21')](_0x496d25[0x2]);_0x5a5bd1[_0xce43('0x21')](_0x496d25[0x3]);_0x5a5bd1[_0xce43('0x21')](_0x496d25[_0xce43('0x22')](0x4,_0x496d25[_0xce43('0x18')])['join'](','));break;case _0xce43('0x15'):_0x5a5bd1[_0xce43('0x21')](_0x5327e8[_0xce43('0x1e')]);break;case _0xce43('0x27'):_0x5a5bd1[_0xce43('0x21')](_0x5327e8[_0xce43('0x28')]);_0x5a5bd1[_0xce43('0x21')](_0x5327e8[_0xce43('0x1e')]);break;case _0xce43('0x29'):var _0x1c9abc=utils[_0xce43('0x2a')](_0x588ddb[_0xce43('0x2b')][_0xce43('0x2c')],_0x588ddb);var _0x24a782=_0x5327e8[_0xce43('0x1e')][_0xce43('0x1f')](',');_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x0]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x1]);_0x5a5bd1['push'](_0x24a782[0x2]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x3]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x4]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x5]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x6]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x7]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0x8]);_0x5a5bd1['push'](_0x24a782[0x9]);_0x5a5bd1[_0xce43('0x21')](_0x24a782[0xa]);_0x5a5bd1[_0xce43('0x21')](_0x588ddb[_0xce43('0x16')]['id']);_0x5a5bd1[_0xce43('0x21')](_0x588ddb[_0xce43('0x15')]['id']);_0x5a5bd1['push'](_0x5327e8['ChatWebsiteId']);_0x5a5bd1[_0xce43('0x21')](_0x588ddb[_0xce43('0x16')]['ContactId']);_0x5a5bd1[_0xce43('0x21')](_0x588ddb[_0xce43('0x2d')][_0xce43('0x2d')]);_0x5a5bd1[_0xce43('0x21')](_0x1c9abc);break;default:_0x5a5bd1=_['isNil'](_0x5327e8[_0xce43('0x1e')])?[]:_0x5327e8['appdata'][_0xce43('0x1f')](',');}var _0x442729={'id':util['format'](_0xce43('0x2e'),_0xd5282,_0x5327e8['id'],_0x5327e8[_0xce43('0x1a')]),'condition':require(_0xce43('0x2f'))['condition'](_0xd5282,getIntervals(_0x3034c7['intervals'],_0x5327e8),_0x3034c7),'consequence':require(_0xce43('0x30')+_0x5327e8[_0xce43('0x1a')])[_0xce43('0x31')](_0xd5282,_0x5a5bd1,_0x3034c7,_0x588ddb),'p':_0x5327e8['priority']||0x0};logger[_0xce43('0x32')](_0xce43('0x33'),_0x442729['id'],_0xce43('0x34'),getIntervals(_0x3034c7[_0xce43('0x35')],_0x5327e8)['join'](_0xce43('0x36')));_0x2a9cb4[_0xce43('0x21')](_0x442729);}else{logger[_0xce43('0x37')](_0xce43('0x38'),path[_0xce43('0x23')](__dirname,_0xce43('0x17'),_0x5327e8[_0xce43('0x1a')]+_0xce43('0x1b')));}}_0x3034c7[_0xce43('0x13')][_0xd5282]=new RuleEngine(_0x2a9cb4);_0x3034c7['rules'][_0xd5282]['execute'](_0x588ddb,function(_0x23ee74){logger[_0xce43('0x32')](_0xce43('0x39'),JSON[_0xce43('0x3a')](_0x23ee74[_0xce43('0x3b')]));if(_0x3034c7[_0xce43('0x13')][_0xd5282]){_0x3034c7[_0xce43('0x13')][_0xd5282][_0xce43('0x3c')](_0xce43('0x3d'));}});return _0x3e4218({'code':0xc8,'message':_0x588ddb});}else{logger[_0xce43('0x32')](_0xce43('0x3e'));return _0x3e4218({'code':0xc8,'message':_0x588ddb});}}catch(_0x1cef39){logger[_0xce43('0x37')](_0x1cef39[_0xce43('0x3f')]);return _0x2eb70b(_0x3c0948[_0xce43('0x37')](0x1f4,_0x1cef39));}}return _0x2eb70b(_0xce43('0x40'));});},'AcceptMessage':function(_0x37a1ee){var _0x3eec59=this;return new Promise(function(_0x5b8350,_0x3635d8){if(_0x37a1ee[_0xce43('0x41')]&&_0x37a1ee[_0xce43('0x41')]['id']){if(_0x3034c7['agents'][_0x37a1ee['agent']['id']]){_0x3034c7[_0xce43('0x42')][_0x37a1ee['agent']['id']]['busy']=![];_0x3034c7['agents'][_0x37a1ee['agent']['id']][_0xce43('0x43')]=undefined;}}if(_0x37a1ee[_0xce43('0x15')]&&_0x37a1ee['message']['id']){try{var _0x643553=getId(_0x37a1ee['channel'],_0x37a1ee['message']?_0x37a1ee[_0xce43('0x15')]['id']:0x0,_0x37a1ee['interaction']?_0x37a1ee['interaction']['id']:0x0);if(_0x3034c7[_0xce43('0x13')][_0x643553]){_0x3034c7[_0xce43('0x13')][_0x643553]['emit']('end');if(rpc[_0x37a1ee[_0xce43('0x14')]+'QueueReport']){rpc[_0x37a1ee[_0xce43('0x14')]+_0xce43('0x44')]['update'](_0x643553,{'UserId':_0x37a1ee[_0xce43('0x15')][_0xce43('0x45')]})[_0xce43('0x46')](function(_0x180fa2){logger[_0xce43('0x37')](_0xce43('0x47'));});}}return _0x5b8350({'code':0xc8,'message':_0x37a1ee});}catch(_0x3a418f){logger[_0xce43('0x37')](_0x3a418f[_0xce43('0x3f')]);return _0x3635d8(_0x3eec59['error'](0x1f4,_0x3a418f));}}logger['error'](_0xce43('0x48'));return _0x3635d8(_0x3eec59[_0xce43('0x37')](0x1f4,_0xce43('0x48')));});},'RejectMessage':function(_0xc9e65e){var _0x17b110=this;return new Promise(function(_0x43ba4f,_0x59a74d){if(_0xc9e65e[_0xce43('0x41')]&&_0xc9e65e[_0xce43('0x41')]['id']){try{if(_0x3034c7[_0xce43('0x42')][_0xc9e65e[_0xce43('0x41')]['id']]){_0x3034c7[_0xce43('0x42')][_0xc9e65e[_0xce43('0x41')]['id']][_0xce43('0x49')]=![];_0x3034c7[_0xce43('0x42')][_0xc9e65e[_0xce43('0x41')]['id']][_0xce43('0x43')]=undefined;}return _0x43ba4f({'code':0xc8,'message':_0xc9e65e});}catch(_0x42cf25){logger['error'](_0x42cf25[_0xce43('0x3f')]);return _0x59a74d(_0x17b110[_0xce43('0x37')](0x1f4,_0x42cf25));}}logger[_0xce43('0x37')]('message\x20is\x20empty');return _0x59a74d(_0x17b110[_0xce43('0x37')](0x1f4,_0xce43('0x48')));});},'AbandonInteraction':function(_0x28a19c){var _0x5114a2=this;return new Promise(function(_0x5472d9,_0x1fbe0b){if(_0x28a19c['channel']&&_0x28a19c[_0xce43('0x16')]&&_0x28a19c[_0xce43('0x16')]['id']){try{var _0x44e351=getId(_0x28a19c['channel'],_0x28a19c['message']?_0x28a19c['message']['id']:0x0,_0x28a19c['interaction']?_0x28a19c['interaction']['id']:0x0);if(_0x3034c7['rules'][_0x44e351]){_0x3034c7[_0xce43('0x13')][_0x44e351][_0xce43('0x3c')](_0xce43('0x4a'));}return _0x5472d9({'code':0xc8,'message':_0x28a19c});}catch(_0x1acb75){logger['error'](_0x1acb75['stack']);return _0x1fbe0b(_0x5114a2[_0xce43('0x37')](0x1f4,_0x1acb75));}}logger[_0xce43('0x37')](_0xce43('0x48'));return _0x1fbe0b(_0x5114a2[_0xce43('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x456eec){var _0xdb94a7=this;return new Promise(function(_0x4b3017,_0x34fb0d){if(_0x3034c7[_0xce43('0x42')][_0xce43('0x4b')](_0x456eec['id'])){for(var _0x5f49df in _0x456eec[_0xce43('0x4c')]){if(_0x456eec[_0xce43('0x4c')][_0xce43('0x4b')](_0x5f49df)){if(_0x3034c7['agents'][_0x456eec['id']]['hasOwnProperty'](_0x5f49df+_0xce43('0x4d'))){_0x3034c7['agents'][_0x456eec['id']][_0x5f49df+_0xce43('0x4d')]=parseInt(_0x456eec['capacity'][_0x5f49df],0xa);}}}_0x3034c7[_0xce43('0x42')][_0x456eec['id']]['updateRealtime']();return _0x4b3017({'code':0xc8,'message':_0x3034c7['agents'][_0x456eec['id']]});}else{return _0x34fb0d(_0xdb94a7[_0xce43('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2b2af4){return new Promise(function(_0x311f69,_0x445e5a){var _0x37cadd=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x42')]);_0x311f69({'count':_0x37cadd[_0xce43('0x18')],'rows':_0x37cadd});});},'ChatQueues':function(_0x2e2680){return new Promise(function(_0x1aa98f,_0x3514fd){var _0x806287=[];for(var _0x494f10 in _0x3034c7[_0xce43('0x4f')]){if(_0x3034c7[_0xce43('0x4f')][_0xce43('0x4b')](_0x494f10)){var _0x286d08=_0x3034c7[_0xce43('0x4f')][_0x494f10];var _0x41c26e={'id':_0x286d08['id'],'available':_0x286d08[_0xce43('0x50')],'loggedIn':_0x286d08[_0xce43('0x51')],'name':_0x286d08['name'],'paused':_0x286d08['paused'],'waiting':_0x286d08[_0xce43('0x52')]};_0x806287[_0xce43('0x21')](_0x41c26e);}}_0x1aa98f({'count':_0x806287['length'],'rows':_0x806287});});},'MailQueues':function(_0x1b46fb){return new Promise(function(_0x5d4992,_0x5ac262){var _0x176305=[];for(var _0x3925f4 in _0x3034c7[_0xce43('0x53')]){if(_0x3034c7[_0xce43('0x53')][_0xce43('0x4b')](_0x3925f4)){var _0x4b1f4e=_0x3034c7[_0xce43('0x53')][_0x3925f4];var _0x3b83b3={'id':_0x4b1f4e['id'],'available':_0x4b1f4e['available'],'loggedIn':_0x4b1f4e[_0xce43('0x51')],'name':_0x4b1f4e['name'],'paused':_0x4b1f4e[_0xce43('0x54')],'waiting':_0x4b1f4e[_0xce43('0x52')]};_0x176305[_0xce43('0x21')](_0x3b83b3);}}_0x5d4992({'count':_0x176305['length'],'rows':_0x176305});});},'OpenchannelQueues':function(_0x1f1506){return new Promise(function(_0x48d113,_0xbaf075){var _0x596da4=[];for(var _0x29c768 in _0x3034c7['openchannelQueues']){if(_0x3034c7['openchannelQueues']['hasOwnProperty'](_0x29c768)){var _0x259320=_0x3034c7['openchannelQueues'][_0x29c768];var _0x4c8861={'id':_0x259320['id'],'available':_0x259320[_0xce43('0x50')],'loggedIn':_0x259320[_0xce43('0x51')],'name':_0x259320[_0xce43('0x55')],'paused':_0x259320['paused'],'waiting':_0x259320[_0xce43('0x52')]};_0x596da4[_0xce43('0x21')](_0x4c8861);}}_0x48d113({'count':_0x596da4[_0xce43('0x18')],'rows':_0x596da4});});},'SmsQueues':function(_0x350d10){return new Promise(function(_0x4bb87b,_0x4a9e6c){var _0x1b4b62=[];for(var _0x341e62 in _0x3034c7[_0xce43('0x56')]){if(_0x3034c7[_0xce43('0x56')]['hasOwnProperty'](_0x341e62)){var _0x1762c7=_0x3034c7[_0xce43('0x56')][_0x341e62];var _0x5e756c={'id':_0x1762c7['id'],'available':_0x1762c7[_0xce43('0x50')],'loggedIn':_0x1762c7['loggedIn'],'name':_0x1762c7[_0xce43('0x55')],'paused':_0x1762c7[_0xce43('0x54')],'waiting':_0x1762c7[_0xce43('0x52')]};_0x1b4b62[_0xce43('0x21')](_0x5e756c);}}_0x4bb87b({'count':_0x1b4b62[_0xce43('0x18')],'rows':_0x1b4b62});});},'FaxQueues':function(_0x3c76d8){return new Promise(function(_0x4155f1,_0x2e0fdb){var _0x4237c4=[];for(var _0x1c4c83 in _0x3034c7[_0xce43('0x57')]){if(_0x3034c7[_0xce43('0x57')][_0xce43('0x4b')](_0x1c4c83)){var _0x161a06=_0x3034c7['faxQueues'][_0x1c4c83];var _0x55816f={'id':_0x161a06['id'],'available':_0x161a06[_0xce43('0x50')],'loggedIn':_0x161a06[_0xce43('0x51')],'name':_0x161a06[_0xce43('0x55')],'paused':_0x161a06['paused'],'waiting':_0x161a06[_0xce43('0x52')]};_0x4237c4['push'](_0x55816f);}}_0x4155f1({'count':_0x4237c4[_0xce43('0x18')],'rows':_0x4237c4});});},'WhatsappQueues':function(_0x8fd118){return new Promise(function(_0x567a25,_0x379dc3){var _0x45e9df=[];for(var _0x57258d in _0x3034c7[_0xce43('0x58')]){if(_0x3034c7['whatsappQueues'][_0xce43('0x4b')](_0x57258d)){var _0x1e1b7e=_0x3034c7[_0xce43('0x58')][_0x57258d];var _0x24a4bc={'id':_0x1e1b7e['id'],'available':_0x1e1b7e[_0xce43('0x50')],'loggedIn':_0x1e1b7e[_0xce43('0x51')],'name':_0x1e1b7e[_0xce43('0x55')],'paused':_0x1e1b7e[_0xce43('0x54')],'waiting':_0x1e1b7e[_0xce43('0x52')]};_0x45e9df[_0xce43('0x21')](_0x24a4bc);}}_0x567a25({'count':_0x45e9df[_0xce43('0x18')],'rows':_0x45e9df});});},'ChatQueuesWaitingInteractions':function(_0x561dab){return new Promise(function(_0x50ed25,_0x5c2865){var _0x3a44cf=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x59')]);_0x50ed25({'count':_0x3a44cf[_0xce43('0x18')],'rows':_0x3a44cf});});},'MailQueuesWaitingInteractions':function(_0x334e78){return new Promise(function(_0x3bedeb,_0x366501){var _0x60d883=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x5a')]);_0x3bedeb({'count':_0x60d883['length'],'rows':_0x60d883});});},'OpenchannelQueuesWaitingInteractions':function(_0x130f6c){return new Promise(function(_0x4f09da,_0x49f2d7){var _0xa53e44=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x5b')]);_0x4f09da({'count':_0xa53e44[_0xce43('0x18')],'rows':_0xa53e44});});},'SmsQueuesWaitingInteractions':function(_0x34609a){return new Promise(function(_0x4188e8,_0x3174a6){var _0x13f712=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x5c')]);_0x4188e8({'count':_0x13f712[_0xce43('0x18')],'rows':_0x13f712});});},'FaxQueuesWaitingInteractions':function(_0x46c2b2){return new Promise(function(_0x45c3f6,_0x5ba9f7){var _0x302704=_[_0xce43('0x4e')](_0x3034c7['faxQueuesWaitingInteractions']);_0x45c3f6({'count':_0x302704[_0xce43('0x18')],'rows':_0x302704});});},'WhatsappQueuesWaitingInteractions':function(_0x213c62){return new Promise(function(_0x8d10df,_0x591e91){var _0x30e9c5=_[_0xce43('0x4e')](_0x3034c7[_0xce43('0x5d')]);_0x8d10df({'count':_0x30e9c5[_0xce43('0x18')],'rows':_0x30e9c5});});}};var _0x489ff9=jayson['server'](_0x4cb58a)[_0xce43('0x5e')]();_0x489ff9['on'](_0xce43('0x37'),function(_0x344e9f){logger[_0xce43('0x37')](JSON[_0xce43('0x3a')](_0x344e9f));return _0x27ab4a(_0x344e9f);});_0x489ff9[_0xce43('0x5f')](0x232c,_0xce43('0x60'),function(){console['log'](_0xce43('0x61'),0x232c);return _0x3cd0f7(_0xce43('0x62')+0x232c);});});}; \ No newline at end of file +var _0x0834=['chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','rules','channel','message','applications','isArray','length','existsSync','app','.js','toLowerCase','appdata','mail','slice','join','push','dialogflow','split','dialogflowv2','amazonlex','tag','tvox','notificationTemplate','interaction','ContactId','body','%s:%s:%s','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values'];(function(_0x346331,_0x433e98){var _0x4af775=function(_0x5ca6ca){while(--_0x5ca6ca){_0x346331['push'](_0x346331['shift']());}};_0x4af775(++_0x433e98);}(_0x0834,0x18e));var _0x4083=function(_0xeba35c,_0x2e5dad){_0xeba35c=_0xeba35c-0x0;var _0x2f2c39=_0x0834[_0xeba35c];return _0x2f2c39;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x4083('0x0'));var fs=require('fs');var jayson=require(_0x4083('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('routing');var rpc={'openchannelQueueReport':require(_0x4083('0x4')),'mailQueueReport':require(_0x4083('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x4083('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x4083('0x7'))};var RuleEngine=require(_0x4083('0x8'));function getId(_0x2c42bb,_0x1d56dd,_0x129337){return util[_0x4083('0x9')](_0x4083('0xa'),_0x2c42bb,_0x1d56dd||0x0,_0x129337||0x0);}function getIntervals(_0x6db0e5,_0x2a5093){var _0x2d739c=[];if(!_[_0x4083('0xb')](_0x2a5093[_0x4083('0xc')])&&!_[_0x4083('0xb')](_0x6db0e5[_0x2a5093[_0x4083('0xc')]])&&!_[_0x4083('0xb')](_0x6db0e5[_0x2a5093['IntervalId']]['Intervals'])){_0x2d739c=_[_0x4083('0xd')](_0x6db0e5[_0x2a5093[_0x4083('0xc')]]['Intervals'],_0x4083('0xe'));}else if(!_[_0x4083('0xb')](_0x2a5093[_0x4083('0xe')])){_0x2d739c=[_0x2a5093['interval']];}return _0x2d739c;}exports['listen']=function(_0xb5badb){_0xb5badb[_0x4083('0xf')]={};return new BPromise(function(_0x5dbe62,_0xa2fde8){var _0x316e54={'Start':function(_0xc7c267){var _0x146632=this;return new Promise(function(_0x38757d,_0x4d59c7){if(_0xc7c267){try{var _0x259b2b=[];var _0x10cadd=getId(_0xc7c267[_0x4083('0x10')],_0xc7c267[_0x4083('0x11')]?_0xc7c267['message']['id']:0x0,_0xc7c267['interaction']?_0xc7c267['interaction']['id']:0x0);if(_0xc7c267[_0x4083('0x12')]&&_[_0x4083('0x13')](_0xc7c267['applications'])&&_0xc7c267[_0x4083('0x12')]['length']){for(var _0x2ae9d5=0x0;_0x2ae9d5<_0xc7c267[_0x4083('0x12')][_0x4083('0x14')];_0x2ae9d5+=0x1){var _0xa18842=_0xc7c267['applications'][_0x2ae9d5];if(fs[_0x4083('0x15')](path['join'](__dirname,_0x4083('0x12'),_0xa18842[_0x4083('0x16')]+_0x4083('0x17')))){var _0x94d72c=[];switch(_0xa18842['app'][_0x4083('0x18')]()){case'autoreply':var _0x2e4dff=_0xa18842[_0x4083('0x19')]['split'](',');if(_0xc7c267['channel']===_0x4083('0x1a')){_0x94d72c['push'](_0x2e4dff[0x0]);_0x94d72c['push'](_0x2e4dff[0x1]);_0x94d72c['push'](_0x2e4dff[_0x4083('0x1b')](0x2,_0x2e4dff[_0x4083('0x14')])[_0x4083('0x1c')](','));}else{_0x94d72c['push'](_0x2e4dff[0x0]);_0x94d72c[_0x4083('0x1d')](_0x2e4dff[_0x4083('0x1b')](0x1,_0x2e4dff[_0x4083('0x14')])['join'](','));}break;case _0x4083('0x1e'):var _0x323736=_0xa18842['appdata'][_0x4083('0x1f')](',');_0x94d72c[_0x4083('0x1d')](_0x323736[0x0]);_0x94d72c[_0x4083('0x1d')](_0x323736[0x1]);_0x94d72c[_0x4083('0x1d')](_0x323736[_0x4083('0x1b')](0x2,_0x323736[_0x4083('0x14')])[_0x4083('0x1c')](','));break;case _0x4083('0x20'):var _0x2a56b5=_0xa18842['appdata']['split'](',');_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x0]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x1]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x2]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x3]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[_0x4083('0x1b')](0x4,_0x2a56b5['length'])[_0x4083('0x1c')](','));break;case _0x4083('0x21'):var _0x2a1eda=_0xa18842[_0x4083('0x19')][_0x4083('0x1f')](',');_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x0]);_0x94d72c['push'](_0x2a1eda[0x1]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x2]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x3]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[_0x4083('0x1b')](0x4,_0x2a1eda[_0x4083('0x14')])[_0x4083('0x1c')](','));break;case'message':_0x94d72c[_0x4083('0x1d')](_0xa18842['appdata']);break;case _0x4083('0x22'):_0x94d72c[_0x4083('0x1d')](_0xa18842['TagId']);_0x94d72c[_0x4083('0x1d')](_0xa18842[_0x4083('0x19')]);break;case _0x4083('0x23'):var _0x35c732=utils['getMustacheRender'](_0xc7c267['account'][_0x4083('0x24')],_0xc7c267);var _0x93cd06=_0xa18842['appdata'][_0x4083('0x1f')](',');_0x94d72c['push'](_0x93cd06[0x0]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x1]);_0x94d72c['push'](_0x93cd06[0x2]);_0x94d72c['push'](_0x93cd06[0x3]);_0x94d72c['push'](_0x93cd06[0x4]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x5]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x6]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x7]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x8]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x9]);_0x94d72c['push'](_0x93cd06[0xa]);_0x94d72c['push'](_0xc7c267[_0x4083('0x25')]['id']);_0x94d72c[_0x4083('0x1d')](_0xc7c267['message']['id']);_0x94d72c[_0x4083('0x1d')](_0xa18842['ChatWebsiteId']);_0x94d72c['push'](_0xc7c267['interaction'][_0x4083('0x26')]);_0x94d72c[_0x4083('0x1d')](_0xc7c267[_0x4083('0x27')]['body']);_0x94d72c['push'](_0x35c732);break;default:_0x94d72c=_[_0x4083('0xb')](_0xa18842['appdata'])?[]:_0xa18842[_0x4083('0x19')][_0x4083('0x1f')](',');}var _0x3264ec={'id':util[_0x4083('0x9')](_0x4083('0x28'),_0x10cadd,_0xa18842['id'],_0xa18842[_0x4083('0x16')]),'condition':require('./interval')[_0x4083('0x29')](_0x10cadd,getIntervals(_0xb5badb[_0x4083('0x2a')],_0xa18842),_0xb5badb),'consequence':require('./applications/'+_0xa18842['app'])[_0x4083('0x2b')](_0x10cadd,_0x94d72c,_0xb5badb,_0xc7c267),'p':_0xa18842['priority']||0x0};logger[_0x4083('0x2c')](_0x4083('0x2d'),_0x3264ec['id'],_0x4083('0x2e'),getIntervals(_0xb5badb['intervals'],_0xa18842)[_0x4083('0x1c')](_0x4083('0x2f')));_0x259b2b[_0x4083('0x1d')](_0x3264ec);}else{logger['error'](_0x4083('0x30'),path[_0x4083('0x1c')](__dirname,_0x4083('0x12'),_0xa18842[_0x4083('0x16')]+_0x4083('0x17')));}}_0xb5badb[_0x4083('0xf')][_0x10cadd]=new RuleEngine(_0x259b2b);_0xb5badb[_0x4083('0xf')][_0x10cadd][_0x4083('0x31')](_0xc7c267,function(_0x595a4f){logger['info'](_0x4083('0x32'),JSON[_0x4083('0x33')](_0x595a4f[_0x4083('0x34')]));if(_0xb5badb[_0x4083('0xf')][_0x10cadd]){_0xb5badb[_0x4083('0xf')][_0x10cadd][_0x4083('0x35')](_0x4083('0x36'));}});return _0x38757d({'code':0xc8,'message':_0xc7c267});}else{logger['info'](_0x4083('0x37'));return _0x38757d({'code':0xc8,'message':_0xc7c267});}}catch(_0x1faead){logger[_0x4083('0x38')](_0x1faead[_0x4083('0x39')]);return _0x4d59c7(_0x146632[_0x4083('0x38')](0x1f4,_0x1faead));}}return _0x4d59c7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x436313){var _0x586050=this;return new Promise(function(_0x53e0f8,_0x1287bc){if(_0x436313[_0x4083('0x3a')]&&_0x436313[_0x4083('0x3a')]['id']){if(_0xb5badb[_0x4083('0x3b')][_0x436313['agent']['id']]){_0xb5badb[_0x4083('0x3b')][_0x436313['agent']['id']][_0x4083('0x3c')]=![];_0xb5badb[_0x4083('0x3b')][_0x436313[_0x4083('0x3a')]['id']]['busyQueue']=undefined;}}if(_0x436313[_0x4083('0x11')]&&_0x436313[_0x4083('0x11')]['id']){try{var _0xa79370=getId(_0x436313['channel'],_0x436313[_0x4083('0x11')]?_0x436313[_0x4083('0x11')]['id']:0x0,_0x436313[_0x4083('0x25')]?_0x436313[_0x4083('0x25')]['id']:0x0);if(_0xb5badb[_0x4083('0xf')][_0xa79370]){_0xb5badb[_0x4083('0xf')][_0xa79370][_0x4083('0x35')]('end');if(rpc[_0x436313[_0x4083('0x10')]+_0x4083('0x3d')]){rpc[_0x436313[_0x4083('0x10')]+_0x4083('0x3d')]['update'](_0xa79370,{'UserId':_0x436313[_0x4083('0x11')]['UserId']})[_0x4083('0x3e')](function(_0x2c7e01){logger['error'](_0x4083('0x3f'));});}}return _0x53e0f8({'code':0xc8,'message':_0x436313});}catch(_0x2306cf){logger[_0x4083('0x38')](_0x2306cf[_0x4083('0x39')]);return _0x1287bc(_0x586050[_0x4083('0x38')](0x1f4,_0x2306cf));}}logger[_0x4083('0x38')]('message\x20is\x20empty');return _0x1287bc(_0x586050['error'](0x1f4,_0x4083('0x40')));});},'RejectMessage':function(_0x1735d5){var _0x560bfb=this;return new Promise(function(_0x432e25,_0x367e67){if(_0x1735d5[_0x4083('0x3a')]&&_0x1735d5['agent']['id']){try{if(_0xb5badb[_0x4083('0x3b')][_0x1735d5['agent']['id']]){_0xb5badb[_0x4083('0x3b')][_0x1735d5[_0x4083('0x3a')]['id']][_0x4083('0x3c')]=![];_0xb5badb[_0x4083('0x3b')][_0x1735d5[_0x4083('0x3a')]['id']]['busyQueue']=undefined;}return _0x432e25({'code':0xc8,'message':_0x1735d5});}catch(_0x5f0349){logger[_0x4083('0x38')](_0x5f0349['stack']);return _0x367e67(_0x560bfb[_0x4083('0x38')](0x1f4,_0x5f0349));}}logger[_0x4083('0x38')]('message\x20is\x20empty');return _0x367e67(_0x560bfb['error'](0x1f4,_0x4083('0x40')));});},'AbandonInteraction':function(_0x450dce){var _0x2b7ded=this;return new Promise(function(_0x80a9be,_0x3546ef){if(_0x450dce['channel']&&_0x450dce[_0x4083('0x25')]&&_0x450dce['interaction']['id']){try{var _0x2f5919=getId(_0x450dce[_0x4083('0x10')],_0x450dce[_0x4083('0x11')]?_0x450dce['message']['id']:0x0,_0x450dce[_0x4083('0x25')]?_0x450dce[_0x4083('0x25')]['id']:0x0);if(_0xb5badb[_0x4083('0xf')][_0x2f5919]){_0xb5badb[_0x4083('0xf')][_0x2f5919][_0x4083('0x35')](_0x4083('0x41'));}return _0x80a9be({'code':0xc8,'message':_0x450dce});}catch(_0x24f7f9){logger[_0x4083('0x38')](_0x24f7f9[_0x4083('0x39')]);return _0x3546ef(_0x2b7ded[_0x4083('0x38')](0x1f4,_0x24f7f9));}}logger[_0x4083('0x38')](_0x4083('0x40'));return _0x3546ef(_0x2b7ded[_0x4083('0x38')](0x1f4,_0x4083('0x40')));});},'AgentCapacity':function(_0x4d0d8c){var _0x2d8585=this;return new Promise(function(_0x585f4c,_0x28a001){if(_0xb5badb[_0x4083('0x3b')][_0x4083('0x42')](_0x4d0d8c['id'])){for(var _0x54bc61 in _0x4d0d8c['capacity']){if(_0x4d0d8c[_0x4083('0x43')][_0x4083('0x42')](_0x54bc61)){if(_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x4083('0x42')](_0x54bc61+_0x4083('0x44'))){_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x54bc61+_0x4083('0x44')]=parseInt(_0x4d0d8c[_0x4083('0x43')][_0x54bc61],0xa);}}}_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x4083('0x45')]();return _0x585f4c({'code':0xc8,'message':_0xb5badb['agents'][_0x4d0d8c['id']]});}else{return _0x28a001(_0x2d8585[_0x4083('0x38')](0x1f4,_0x4083('0x46')));}});},'Agents':function(_0x36b59d){return new Promise(function(_0x4775f3,_0x56d092){var _0x1a7df7=_[_0x4083('0x47')](_0xb5badb['agents']);_0x4775f3({'count':_0x1a7df7['length'],'rows':_0x1a7df7});});},'ChatQueues':function(_0x134998){return new Promise(function(_0x93f03a,_0x4e8117){var _0x455f28=[];for(var _0x48fc94 in _0xb5badb[_0x4083('0x48')]){if(_0xb5badb[_0x4083('0x48')]['hasOwnProperty'](_0x48fc94)){var _0xd303c5=_0xb5badb[_0x4083('0x48')][_0x48fc94];var _0x1ec9e0={'id':_0xd303c5['id'],'available':_0xd303c5[_0x4083('0x49')],'loggedIn':_0xd303c5['loggedIn'],'name':_0xd303c5[_0x4083('0x4a')],'paused':_0xd303c5[_0x4083('0x4b')],'waiting':_0xd303c5['waiting']};_0x455f28[_0x4083('0x1d')](_0x1ec9e0);}}_0x93f03a({'count':_0x455f28[_0x4083('0x14')],'rows':_0x455f28});});},'MailQueues':function(_0x318cdc){return new Promise(function(_0x5f480b,_0x3956a4){var _0x364e5a=[];for(var _0x484564 in _0xb5badb['mailQueues']){if(_0xb5badb[_0x4083('0x4c')][_0x4083('0x42')](_0x484564)){var _0x504b76=_0xb5badb['mailQueues'][_0x484564];var _0xea250={'id':_0x504b76['id'],'available':_0x504b76[_0x4083('0x49')],'loggedIn':_0x504b76[_0x4083('0x4d')],'name':_0x504b76[_0x4083('0x4a')],'paused':_0x504b76['paused'],'waiting':_0x504b76[_0x4083('0x4e')]};_0x364e5a[_0x4083('0x1d')](_0xea250);}}_0x5f480b({'count':_0x364e5a[_0x4083('0x14')],'rows':_0x364e5a});});},'OpenchannelQueues':function(_0x1dba07){return new Promise(function(_0x255f0f,_0x1d5239){var _0x492591=[];for(var _0x43461f in _0xb5badb['openchannelQueues']){if(_0xb5badb['openchannelQueues'][_0x4083('0x42')](_0x43461f)){var _0x43054e=_0xb5badb[_0x4083('0x4f')][_0x43461f];var _0xf8abd7={'id':_0x43054e['id'],'available':_0x43054e['available'],'loggedIn':_0x43054e[_0x4083('0x4d')],'name':_0x43054e[_0x4083('0x4a')],'paused':_0x43054e[_0x4083('0x4b')],'waiting':_0x43054e[_0x4083('0x4e')]};_0x492591[_0x4083('0x1d')](_0xf8abd7);}}_0x255f0f({'count':_0x492591[_0x4083('0x14')],'rows':_0x492591});});},'SmsQueues':function(_0x175a17){return new Promise(function(_0x10f925,_0x3d8008){var _0x45db6a=[];for(var _0x5e5bea in _0xb5badb[_0x4083('0x50')]){if(_0xb5badb[_0x4083('0x50')][_0x4083('0x42')](_0x5e5bea)){var _0x3f8532=_0xb5badb[_0x4083('0x50')][_0x5e5bea];var _0x4901a3={'id':_0x3f8532['id'],'available':_0x3f8532[_0x4083('0x49')],'loggedIn':_0x3f8532[_0x4083('0x4d')],'name':_0x3f8532['name'],'paused':_0x3f8532['paused'],'waiting':_0x3f8532['waiting']};_0x45db6a[_0x4083('0x1d')](_0x4901a3);}}_0x10f925({'count':_0x45db6a[_0x4083('0x14')],'rows':_0x45db6a});});},'FaxQueues':function(_0x2c66b4){return new Promise(function(_0x387888,_0xad3e9b){var _0x302141=[];for(var _0x5c14cc in _0xb5badb[_0x4083('0x51')]){if(_0xb5badb[_0x4083('0x51')]['hasOwnProperty'](_0x5c14cc)){var _0x353f46=_0xb5badb[_0x4083('0x51')][_0x5c14cc];var _0x20d994={'id':_0x353f46['id'],'available':_0x353f46['available'],'loggedIn':_0x353f46[_0x4083('0x4d')],'name':_0x353f46[_0x4083('0x4a')],'paused':_0x353f46['paused'],'waiting':_0x353f46[_0x4083('0x4e')]};_0x302141[_0x4083('0x1d')](_0x20d994);}}_0x387888({'count':_0x302141[_0x4083('0x14')],'rows':_0x302141});});},'WhatsappQueues':function(_0x446777){return new Promise(function(_0x3f42cd,_0x4d5a9b){var _0x4b76f7=[];for(var _0x444a5c in _0xb5badb['whatsappQueues']){if(_0xb5badb['whatsappQueues'][_0x4083('0x42')](_0x444a5c)){var _0x3341fa=_0xb5badb[_0x4083('0x52')][_0x444a5c];var _0x17faeb={'id':_0x3341fa['id'],'available':_0x3341fa[_0x4083('0x49')],'loggedIn':_0x3341fa['loggedIn'],'name':_0x3341fa[_0x4083('0x4a')],'paused':_0x3341fa['paused'],'waiting':_0x3341fa[_0x4083('0x4e')]};_0x4b76f7[_0x4083('0x1d')](_0x17faeb);}}_0x3f42cd({'count':_0x4b76f7[_0x4083('0x14')],'rows':_0x4b76f7});});},'ChatQueuesWaitingInteractions':function(_0x2c66d0){return new Promise(function(_0x300d71,_0x5cfeea){var _0x164429=_['values'](_0xb5badb[_0x4083('0x53')]);_0x300d71({'count':_0x164429[_0x4083('0x14')],'rows':_0x164429});});},'MailQueuesWaitingInteractions':function(_0x5194f0){return new Promise(function(_0x4af317,_0x9a0e44){var _0x49d185=_['values'](_0xb5badb['mailQueuesWaitingInteractions']);_0x4af317({'count':_0x49d185['length'],'rows':_0x49d185});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f2182){return new Promise(function(_0x2c42e0,_0x13f0cb){var _0x4d1523=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x54')]);_0x2c42e0({'count':_0x4d1523[_0x4083('0x14')],'rows':_0x4d1523});});},'SmsQueuesWaitingInteractions':function(_0x173953){return new Promise(function(_0x2185a1,_0x5ee4e1){var _0x57df0f=_[_0x4083('0x47')](_0xb5badb['smsQueuesWaitingInteractions']);_0x2185a1({'count':_0x57df0f['length'],'rows':_0x57df0f});});},'FaxQueuesWaitingInteractions':function(_0x3ba754){return new Promise(function(_0x22da0b,_0x323610){var _0x40bef5=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x55')]);_0x22da0b({'count':_0x40bef5['length'],'rows':_0x40bef5});});},'WhatsappQueuesWaitingInteractions':function(_0x428290){return new Promise(function(_0x1724d7,_0x1b4274){var _0x3d8278=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x56')]);_0x1724d7({'count':_0x3d8278[_0x4083('0x14')],'rows':_0x3d8278});});}};var _0x1d7ef0=jayson[_0x4083('0x57')](_0x316e54)[_0x4083('0x58')]();_0x1d7ef0['on'](_0x4083('0x38'),function(_0x2d86ad){logger['error'](JSON[_0x4083('0x33')](_0x2d86ad));return _0xa2fde8(_0x2d86ad);});_0x1d7ef0[_0x4083('0x59')](0x232c,_0x4083('0x5a'),function(){console[_0x4083('0x5b')](_0x4083('0x5c'),0x232c);return _0x5dbe62(_0x4083('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index abfe8c0..8fefd04 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 _0x6741=['\x20|\x20','when','join','stack','bluebird','../../../config/logger','routing','client','http','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','message','all','then','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x5190ea,_0x1c4717){var _0x223d48=function(_0x434304){while(--_0x434304){_0x5190ea['push'](_0x5190ea['shift']());}};_0x223d48(++_0x1c4717);}(_0x6741,0x162));var _0x1674=function(_0x5599c3,_0x2e751e){_0x5599c3=_0x5599c3-0x0;var _0x149f3=_0x6741[_0x5599c3];return _0x149f3;};'use strict';var util=require('util');var BPromise=require(_0x1674('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x1674('0x1'))(_0x1674('0x2'));var client=jayson[_0x1674('0x3')][_0x1674('0x4')]({'port':0x232a});function request(_0x21737c,_0x3a4885){return new BPromise(function(_0x1e46e4,_0x1ae081){return client['request'](_0x21737c,_0x3a4885)['then'](function(_0x50665d){if(_0x50665d[_0x1674('0x5')]){return _0x1ae081(_0x50665d['error']['message']);}else{return _0x1e46e4(_0x50665d[_0x1674('0x6')]);}})[_0x1674('0x7')](function(_0x243ee2){return _0x1ae081(_0x243ee2);});});}exports[_0x1674('0x8')]=function(_0x1a76e3,_0x29a890,_0x51ea8a){return function(_0x4aabff){if(_0x51ea8a[_0x1674('0x9')]&&!_0x51ea8a[_0x1674('0x9')][_0x1a76e3]){logger[_0x1674('0xa')](_0x1674('0xb'),_0x1a76e3);return _0x4aabff[_0x1674('0xc')]();}var _0x318a59=[];for(var _0x6bca8a=0x0;_0x6bca8a<_0x29a890['length'];_0x6bca8a+=0x1){_0x318a59[_0x1674('0xd')](request('Command',{'command':util[_0x1674('0xe')](_0x1674('0xf'),_0x29a890[_0x6bca8a])})['then'](function(_0x2bd8ea){return _0x2bd8ea&&_0x2bd8ea[_0x1674('0x10')]&&_0x2bd8ea[_0x1674('0x10')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0x5cbed8){logger[_0x1674('0x5')]('[%s][INTERVAL]\x20%s',_0x1a76e3,_0x29a890[_0x6bca8a]);}));}BPromise[_0x1674('0x11')](_0x318a59)[_0x1674('0x12')](function(_0x3b29de){var _0x1fa40b=_[_0x1674('0x13')](_0x3b29de);logger[_0x1674('0xa')](_0x1674('0x14'),_0x1a76e3,_0x29a890['join'](_0x1674('0x15')),_0x1fa40b);_0x4aabff[_0x1674('0x16')](_0x1fa40b);})[_0x1674('0x7')](function(_0x4a4b07){console['log'](_0x4a4b07);logger['error'](_0x1674('0x14'),_0x1a76e3,_0x29a890[_0x1674('0x17')]('\x20|\x20'),_0x4a4b07[_0x1674('0x18')]);_0x4aabff[_0x1674('0xc')]();});};}; \ No newline at end of file +var _0xa780=['indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','then','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xa780,0x123));var _0x0a78=function(_0x393f89,_0xb03990){_0x393f89=_0x393f89-0x0;var _0x4d5e99=_0xa780[_0x393f89];return _0x4d5e99;};'use strict';var util=require(_0x0a78('0x0'));var BPromise=require(_0x0a78('0x1'));var jayson=require(_0x0a78('0x2'));var _=require(_0x0a78('0x3'));var logger=require(_0x0a78('0x4'))(_0x0a78('0x5'));var client=jayson['client'][_0x0a78('0x6')]({'port':0x232a});function request(_0x2eb468,_0x5f0a17){return new BPromise(function(_0x414b2d,_0x3c117a){return client['request'](_0x2eb468,_0x5f0a17)[_0x0a78('0x7')](function(_0x3b82f7){if(_0x3b82f7['error']){return _0x3c117a(_0x3b82f7['error'][_0x0a78('0x8')]);}else{return _0x414b2d(_0x3b82f7[_0x0a78('0x9')]);}})['catch'](function(_0x1de668){return _0x3c117a(_0x1de668);});});}exports['condition']=function(_0x84f545,_0xc9362d,_0x667bb9){return function(_0x5737aa){if(_0x667bb9['rules']&&!_0x667bb9[_0x0a78('0xa')][_0x84f545]){logger[_0x0a78('0xb')](_0x0a78('0xc'),_0x84f545);return _0x5737aa[_0x0a78('0xd')]();}var _0x541599=[];for(var _0x107835=0x0;_0x107835<_0xc9362d[_0x0a78('0xe')];_0x107835+=0x1){_0x541599[_0x0a78('0xf')](request(_0x0a78('0x10'),{'command':util[_0x0a78('0x11')](_0x0a78('0x12'),_0xc9362d[_0x107835])})[_0x0a78('0x7')](function(_0x279a5f){return _0x279a5f&&_0x279a5f[_0x0a78('0x8')]&&_0x279a5f['message'][_0x0a78('0x13')](_0x0a78('0x14'))>=0x0?!![]:![];})[_0x0a78('0x15')](function(_0x110d9f){logger[_0x0a78('0x16')](_0x0a78('0x17'),_0x84f545,_0xc9362d[_0x107835]);}));}BPromise[_0x0a78('0x18')](_0x541599)[_0x0a78('0x7')](function(_0x3b0af8){var _0x4de338=_[_0x0a78('0x19')](_0x3b0af8);logger['info'](_0x0a78('0x1a'),_0x84f545,_0xc9362d[_0x0a78('0x1b')](_0x0a78('0x1c')),_0x4de338);_0x5737aa[_0x0a78('0x1d')](_0x4de338);})[_0x0a78('0x15')](function(_0x193601){console[_0x0a78('0x1e')](_0x193601);logger[_0x0a78('0x16')](_0x0a78('0x1a'),_0x84f545,_0xc9362d['join'](_0x0a78('0x1c')),_0x193601['stack']);_0x5737aa[_0x0a78('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 337a9f1..bb1d989 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 _0xa74f=['calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answered_elsewhere','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','indexOf','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue'];(function(_0x241551,_0x3b04bb){var _0x3e41dc=function(_0x23b61a){while(--_0x23b61a){_0x241551['push'](_0x241551['shift']());}};_0x3e41dc(++_0x3b04bb);}(_0xa74f,0x9a));var _0xfa74=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa74f[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xfa74('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4c4c00,_0x4b5765){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3'),_0x4c4c00[_0xfa74('0x4')],_0x4c4c00['channel'],_0x4c4c00[_0xfa74('0x5')],_0x4c4c00['membername'],_0x4c4c00['interface'],_0x4c4c00[_0xfa74('0x6')],_0x4c4c00[_0xfa74('0x7')],_0x4c4c00[_0xfa74('0x8')]));if(_0x4c4c00[_0xfa74('0x5')]){utils[_0xfa74('0x9')](_0x4c4c00[_0xfa74('0x5')])['then'](function(_0x32f55c){if(_0x32f55c){_0x4c4c00[_0xfa74('0xa')]=_0x32f55c[_0xfa74('0xa')];_0x4c4c00[_0xfa74('0xb')]=_0x4c4c00['agentcomplete']?_0x32f55c[_0xfa74('0xc')]:![];_0x4c4c00[_0xfa74('0xd')]=_0x4c4c00['agentacw']?_0x32f55c[_0xfa74('0xe')]:0x0;}utils[_0xfa74('0xf')](_0xfa74('0x10'),_0x4c4c00);});}else{utils[_0xfa74('0xf')]('CreateVoiceAgentReport',_0x4c4c00);}if(_0x4b5765){delete transfers[_0x4c4c00[_0xfa74('0x4')]];}else{delete agents[_0x4c4c00[_0xfa74('0x11')]];}}exports[_0xfa74('0x12')]=function(_0x278e8b){try{utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b[_0xfa74('0x4')]),_0x278e8b);agents[_0x278e8b[_0xfa74('0x11')]]=_0x278e8b;agents[_0x278e8b[_0xfa74('0x11')]]['agentcalledAt']=utils[_0xfa74('0x14')]();agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x8')]=_0xfa74('0x15');agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x7')]=null;agents[_0x278e8b[_0xfa74('0x11')]]['connectedlinename']=null;utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x278e8b['uniqueid'],agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x16')],_0x278e8b[_0xfa74('0x11')]));}catch(_0x5a863f){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b['uniqueid']),_0x5a863f);}};exports[_0xfa74('0x18')]=function(_0x302eb4){try{if(!_[_0xfa74('0x19')](agents[_0x302eb4['destuniqueid']])){utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x1a'),_0x302eb4[_0xfa74('0x4')]),_0x302eb4);utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x302eb4['uniqueid'],agents[_0x302eb4[_0xfa74('0x11')]]['membername'],_0x302eb4['destuniqueid']));agents[_0x302eb4['destuniqueid']][_0xfa74('0x18')]=!![];agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1b')]=utils['now']();agents[_0x302eb4['destuniqueid']][_0xfa74('0x8')]=_0xfa74('0x1c');agents[_0x302eb4['destuniqueid']][_0xfa74('0x1d')]='timeout';agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1e')]=_0x302eb4['ringtime']?parseInt(_0x302eb4[_0xfa74('0x1f')])/0x3e8:0x0;agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x20')]=0x0;unanswered[_0xfa74('0x21')](_0x302eb4['destuniqueid']);}}catch(_0xd9c55d){utils[_0xfa74('0x17')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]',_0x302eb4['uniqueid']),_0xd9c55d);}};exports[_0xfa74('0x22')]=function(_0x8b706e){try{_['forIn'](agents,function(_0x4b38fc,_0x343466){if(_0x4b38fc['uniqueid']==_0x8b706e[_0xfa74('0x4')]&&!_['includes'](unanswered,_0x4b38fc[_0xfa74('0x11')])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x8b706e);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x25'),_0x8b706e[_0xfa74('0x4')],_0x4b38fc[_0xfa74('0x16')],_0x4b38fc[_0xfa74('0x11')]));_0x4b38fc[_0xfa74('0x18')]=!![];_0x4b38fc['agentringnoanswerAt']=utils[_0xfa74('0x14')]();_0x4b38fc['lastevent']=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1d')]=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1e')]=_0x8b706e['holdtime'];_0x4b38fc['talktime']=0x0;writeDB(_0x4b38fc);}});}catch(_0x390ed4){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x390ed4);}};exports[_0xfa74('0x27')]=function(_0x231698){try{if(agents[_0x231698['destuniqueid']]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x231698['uniqueid']),_0x231698);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x28'),_0x231698[_0xfa74('0x4')],agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x16')],_0x231698[_0xfa74('0x11')]));agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x29')]=utils['now']();agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x7')]=_0x231698[_0xfa74('0x7')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x2a')]=_0x231698[_0xfa74('0x2a')];agents[_0x231698['destuniqueid']][_0xfa74('0x1e')]=_0x231698[_0xfa74('0x1f')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x8')]='connect';_[_0xfa74('0x2b')](agents,function(_0x13d9a5,_0xe8491b){if(_0x13d9a5[_0xfa74('0x11')]!=_0x231698['destuniqueid']&&_0x13d9a5[_0xfa74('0x4')]==_0x231698[_0xfa74('0x4')]){_0x13d9a5[_0xfa74('0x20')]=0x0;_0x13d9a5['holdtime']=_0x231698['ringtime'];_0x13d9a5[_0xfa74('0x18')]=!![];_0x13d9a5[_0xfa74('0x1b')]=utils[_0xfa74('0x14')]();_0x13d9a5[_0xfa74('0x8')]='answered_elsewhere';_0x13d9a5[_0xfa74('0x1d')]=_0xfa74('0x2c');_0x13d9a5['answeredelsewheredestinationuniqueid']=_0x231698['destuniqueid'];_0x13d9a5['answeredelsewheremembername']=_0x231698['membername'];writeDB(_0x13d9a5);}});}}catch(_0x95c891){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2d'),_0x231698[_0xfa74('0x4')]),_0x95c891);}};exports[_0xfa74('0x2e')]=function(_0x7735c5){try{if(!_['isNil'](agents[_0x7735c5[_0xfa74('0x11')]])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5[_0xfa74('0x4')]),_0x7735c5);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x30'),_0x7735c5[_0xfa74('0x4')],agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x16')],_0x7735c5[_0xfa74('0x11')]));agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x2e')]=!![];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')]=utils['now']();agents[_0x7735c5[_0xfa74('0x11')]]['talktime']=utils[_0xfa74('0x32')](agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')],agents[_0x7735c5[_0xfa74('0x11')]]['agentconnectAt']);agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x1d')]=_0x7735c5['reason'];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x8')]='complete';writeDB(agents[_0x7735c5[_0xfa74('0x11')]]);}}catch(_0x134d95){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5['uniqueid']),_0x134d95);}};exports['blindtransfer']=function(_0x36f6ca){try{if(!_[_0xfa74('0x19')](agents[_0x36f6ca['transfereruniqueid']])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca['uniqueid']),_0x36f6ca);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x34'),_0x36f6ca[_0xfa74('0x4')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x16')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')]));agents[_0x36f6ca[_0xfa74('0x35')]]['transfer']=!![];agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x36')]=_0xfa74('0x37');agents[_0x36f6ca[_0xfa74('0x35')]]['transferexten']=_0x36f6ca['extension'];agents[_0x36f6ca[_0xfa74('0x35')]]['transferuniqueid']=agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')];}}catch(_0x427469){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca[_0xfa74('0x4')]),_0x427469);}};exports['attendedtransfer']=function(_0x118cfc){try{utils['debug'](util[_0xfa74('0x2')]('[%s][agents][attendedtransfer]',_0x118cfc['origtransfereruniqueid']),_0x118cfc);if(_0x118cfc[_0xfa74('0x38')]==_0x118cfc[_0xfa74('0x39')]){if(!_['isNil'](agents[_0x118cfc['secondtransfereruniqueid']])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x36')]='ATTENDED';agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3d')]=_0x118cfc['origtransfererexten'];agents[_0x118cfc['secondtransfereruniqueid']][_0xfa74('0x3e')]=_0x118cfc[_0xfa74('0x38')];}if(_0x118cfc[_0xfa74('0x3f')]&&agents[_0x118cfc[_0xfa74('0x3f')]]){agents[_0x118cfc[_0xfa74('0x3f')]]['agententerreason']=0x1;transfers[_0x118cfc[_0xfa74('0x3f')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x3f')]]);transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x6')]=agents[_0x118cfc['secondtransfereruniqueid']]['calleridnum'];transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x40')];transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x29')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x1e')]=0x0;transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x42')]=0x2;}}else if(_0x118cfc['secondtransfereruniqueid']==_0x118cfc[_0xfa74('0x43')]){if(!_[_0xfa74('0x19')](agents[_0x118cfc[_0xfa74('0x38')]])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x36')]=_0xfa74('0x44');agents[_0x118cfc[_0xfa74('0x38')]]['transferexten']=_0x118cfc[_0xfa74('0x45')];agents[_0x118cfc[_0xfa74('0x38')]]['transferuniqueid']=_0x118cfc['secondtransfereruniqueid'];}if(_0x118cfc[_0xfa74('0x46')]&&agents[_0x118cfc['transfertargetuniqueid']]){agents[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x1;transfers[_0x118cfc[_0xfa74('0x46')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x46')]]);transfers[_0x118cfc['transfertargetuniqueid']]['calleridnum']=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x6')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x40')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x29')]=utils['now']();transfers[_0x118cfc[_0xfa74('0x46')]]['holdtime']=0x0;transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x2;}}}catch(_0x15b586){utils['error'](util[_0xfa74('0x2')](_0xfa74('0x47'),_0x118cfc[_0xfa74('0x38')]),_0x15b586);}};exports['hangup']=function(_0x1b8c06){try{utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x1b8c06);if(agents[_0x1b8c06['uniqueid']]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]===_0xfa74('0x1c')){if(_0x1b8c06[_0xfa74('0x49')]==='21'){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]=_0xfa74('0x4a');agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4a');}utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);var _0x491529=unanswered[_0xfa74('0x4b')](_0x1b8c06[_0xfa74('0x4')]);if(_0x491529>-0x1){unanswered[_0xfa74('0x4c')](_0x491529,0x1);}}if(transfers[_0x1b8c06[_0xfa74('0x4')]]){transfers[_0x1b8c06['uniqueid']][_0xfa74('0x2e')]=!![];transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();transfers[_0x1b8c06['uniqueid']][_0xfa74('0x20')]=utils['diffTime'](transfers[_0x1b8c06['uniqueid']][_0xfa74('0x31')],transfers[_0x1b8c06['uniqueid']][_0xfa74('0x29')]);transfers[_0x1b8c06[_0xfa74('0x4')]]['reason']='agent';transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06['uniqueid'],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],transfers[_0x1b8c06[_0xfa74('0x4')]]['lastevent']));writeDB(transfers[_0x1b8c06[_0xfa74('0x4')]],!![]);}if(agents[_0x1b8c06[_0xfa74('0x4')]]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x2e')]=!![];agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();agents[_0x1b8c06['uniqueid']]['talktime']=utils['diffTime'](agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]);agents[_0x1b8c06[_0xfa74('0x4')]]['reason']=agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x3c')]?'transfer':_0xfa74('0x4e');agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x4f'),_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06['uniqueid']]['reason'],agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);}}catch(_0x4d46e1){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x4d46e1);}}; \ No newline at end of file +var _0x58a4=['clone','hangup','[%s][agents][hangup]','cause','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','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','debug','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid'];(function(_0x5c422a,_0x2376e5){var _0x6c5b33=function(_0x3138c0){while(--_0x3138c0){_0x5c422a['push'](_0x5c422a['shift']());}};_0x6c5b33(++_0x2376e5);}(_0x58a4,0xbf));var _0x458a=function(_0x5b33ad,_0x2a7d55){_0x5b33ad=_0x5b33ad-0x0;var _0x16ec00=_0x58a4[_0x5b33ad];return _0x16ec00;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var utils=require(_0x458a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e23ea,_0xd2a36e){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x5'),_0x1e23ea[_0x458a('0x6')],_0x1e23ea[_0x458a('0x7')],_0x1e23ea[_0x458a('0x8')],_0x1e23ea[_0x458a('0x9')],_0x1e23ea[_0x458a('0xa')],_0x1e23ea['calleridnum'],_0x1e23ea['connectedlinenum'],_0x1e23ea[_0x458a('0xb')]));if(_0x1e23ea[_0x458a('0x8')]){utils[_0x458a('0xc')](_0x1e23ea[_0x458a('0x8')])[_0x458a('0xd')](function(_0x55bf10){if(_0x55bf10){_0x1e23ea['type']=_0x55bf10[_0x458a('0xe')];_0x1e23ea[_0x458a('0xf')]=_0x1e23ea[_0x458a('0x10')]?_0x55bf10[_0x458a('0x11')]:![];_0x1e23ea[_0x458a('0x12')]=_0x1e23ea['agentacw']?_0x55bf10[_0x458a('0x13')]:0x0;}utils[_0x458a('0x14')]('CreateVoiceAgentReport',_0x1e23ea);});}else{utils[_0x458a('0x14')](_0x458a('0x15'),_0x1e23ea);}if(_0xd2a36e){delete transfers[_0x1e23ea[_0x458a('0x6')]];}else{delete agents[_0x1e23ea[_0x458a('0x16')]];}}exports[_0x458a('0x17')]=function(_0x5bd09e){try{utils['debug'](util[_0x458a('0x4')]('[%s][agents][agentcalled]',_0x5bd09e[_0x458a('0x6')]),_0x5bd09e);agents[_0x5bd09e[_0x458a('0x16')]]=_0x5bd09e;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();agents[_0x5bd09e[_0x458a('0x16')]]['lastevent']='called';agents[_0x5bd09e['destuniqueid']][_0x458a('0x1a')]=null;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x1b')]=null;utils['info'](util[_0x458a('0x4')](_0x458a('0x1c'),_0x5bd09e[_0x458a('0x6')],agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x9')],_0x5bd09e['destuniqueid']));}catch(_0x4f57e3){utils[_0x458a('0x1d')](util['format'](_0x458a('0x1e'),_0x5bd09e[_0x458a('0x6')]),_0x4f57e3);}};exports['agentringnoanswer']=function(_0x468416){try{if(!_['isNil'](agents[_0x468416[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util['format'](_0x458a('0x20'),_0x468416[_0x458a('0x6')]),_0x468416);utils['info'](util[_0x458a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x468416[_0x458a('0x6')],agents[_0x468416['destuniqueid']][_0x458a('0x9')],_0x468416['destuniqueid']));agents[_0x468416[_0x458a('0x16')]][_0x458a('0x21')]=!![];agents[_0x468416[_0x458a('0x16')]][_0x458a('0x22')]=utils[_0x458a('0x19')]();agents[_0x468416[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x24')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x25')]=_0x468416['ringtime']?parseInt(_0x468416[_0x458a('0x26')])/0x3e8:0x0;agents[_0x468416[_0x458a('0x16')]]['talktime']=0x0;unanswered['push'](_0x468416[_0x458a('0x16')]);}}catch(_0x596fe2){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x20'),_0x468416['uniqueid']),_0x596fe2);}};exports[_0x458a('0x27')]=function(_0x2531f7){try{_[_0x458a('0x28')](agents,function(_0x562c36,_0x47e20d){if(_0x562c36[_0x458a('0x6')]==_0x2531f7['uniqueid']&&!_[_0x458a('0x29')](unanswered,_0x562c36['destuniqueid'])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]',_0x2531f7[_0x458a('0x6')]),_0x2531f7);utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2531f7[_0x458a('0x6')],_0x562c36[_0x458a('0x9')],_0x562c36[_0x458a('0x16')]));_0x562c36[_0x458a('0x21')]=!![];_0x562c36[_0x458a('0x22')]=utils['now']();_0x562c36[_0x458a('0xb')]=_0x458a('0x2a');_0x562c36[_0x458a('0x24')]=_0x458a('0x2a');_0x562c36[_0x458a('0x25')]=_0x2531f7[_0x458a('0x25')];_0x562c36['talktime']=0x0;writeDB(_0x562c36);}});}catch(_0x2a6b9c){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x2b'),_0x2531f7[_0x458a('0x6')]),_0x2a6b9c);}};exports[_0x458a('0x2c')]=function(_0x262ad0){try{if(agents[_0x262ad0[_0x458a('0x16')]]){utils[_0x458a('0x1f')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x262ad0);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x2e'),_0x262ad0[_0x458a('0x6')],agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x9')],_0x262ad0[_0x458a('0x16')]));agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x2f')]=utils[_0x458a('0x19')]();agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x1a')]=_0x262ad0[_0x458a('0x1a')];agents[_0x262ad0['destuniqueid']][_0x458a('0x1b')]=_0x262ad0[_0x458a('0x1b')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x30');_[_0x458a('0x28')](agents,function(_0x44c5ba,_0x20cf10){if(_0x44c5ba['destuniqueid']!=_0x262ad0[_0x458a('0x16')]&&_0x44c5ba[_0x458a('0x6')]==_0x262ad0['uniqueid']){_0x44c5ba[_0x458a('0x31')]=0x0;_0x44c5ba[_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];_0x44c5ba['agentringnoanswer']=!![];_0x44c5ba[_0x458a('0x22')]=utils[_0x458a('0x19')]();_0x44c5ba[_0x458a('0xb')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x24')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x33')]=_0x262ad0[_0x458a('0x16')];_0x44c5ba['answeredelsewheremembername']=_0x262ad0[_0x458a('0x9')];writeDB(_0x44c5ba);}});}}catch(_0x145e3c){utils[_0x458a('0x1d')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x145e3c);}};exports['agentcomplete']=function(_0x598707){try{if(!_[_0x458a('0x34')](agents[_0x598707[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][agentcomplete]',_0x598707['uniqueid']),_0x598707);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x35'),_0x598707[_0x458a('0x6')],agents[_0x598707['destuniqueid']][_0x458a('0x9')],_0x598707[_0x458a('0x16')]));agents[_0x598707['destuniqueid']][_0x458a('0x10')]=!![];agents[_0x598707['destuniqueid']][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x598707[_0x458a('0x16')]]['talktime']=utils[_0x458a('0x37')](agents[_0x598707[_0x458a('0x16')]][_0x458a('0x36')],agents[_0x598707['destuniqueid']]['agentconnectAt']);agents[_0x598707[_0x458a('0x16')]][_0x458a('0x24')]=_0x598707[_0x458a('0x24')];agents[_0x598707['destuniqueid']]['lastevent']=_0x458a('0x38');writeDB(agents[_0x598707[_0x458a('0x16')]]);}}catch(_0x25bee8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x39'),_0x598707[_0x458a('0x6')]),_0x25bee8);}};exports[_0x458a('0x3a')]=function(_0xb22232){try{if(!_[_0x458a('0x34')](agents[_0xb22232[_0x458a('0x3b')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232[_0x458a('0x6')]),_0xb22232);utils[_0x458a('0x3')](util['format'](_0x458a('0x3d'),_0xb22232[_0x458a('0x6')],agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x9')],agents[_0xb22232[_0x458a('0x3b')]]['uniqueid']));agents[_0xb22232['transfereruniqueid']]['transfer']=!![];agents[_0xb22232[_0x458a('0x3b')]]['transfertype']=_0x458a('0x3e');agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x3f')]=_0xb22232[_0x458a('0x40')];agents[_0xb22232[_0x458a('0x3b')]]['transferuniqueid']=agents[_0xb22232['transfereruniqueid']][_0x458a('0x6')];}}catch(_0x2d8b77){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232['uniqueid']),_0x2d8b77);}};exports[_0x458a('0x41')]=function(_0x4eed01){try{utils[_0x458a('0x1f')](util['format'](_0x458a('0x42'),_0x4eed01['origtransfereruniqueid']),_0x4eed01);if(_0x4eed01['origtransfereruniqueid']==_0x4eed01['origtransfererlinkedid']){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x43')]])){utils['info'](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01[_0x458a('0x45')],agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x9')]));agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x47')]=_0x458a('0x48');agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x3f')]=_0x4eed01[_0x458a('0x49')];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4a')]=_0x4eed01[_0x458a('0x45')];}if(_0x4eed01[_0x458a('0x4b')]&&agents[_0x4eed01[_0x458a('0x4b')]]){agents[_0x4eed01[_0x458a('0x4b')]]['agententerreason']=0x1;transfers[_0x4eed01[_0x458a('0x4b')]]=_['clone'](agents[_0x4eed01[_0x458a('0x4b')]]);transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x43')]]['calleridnum'];transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x2f')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x25')]=0x0;transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4e')]=0x2;}}else if(_0x4eed01[_0x458a('0x43')]==_0x4eed01[_0x458a('0x4f')]){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x45')]])){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01['origtransfereruniqueid'],agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x9')]));agents[_0x4eed01['origtransfereruniqueid']][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x45')]]['transfertype']=_0x458a('0x48');agents[_0x4eed01[_0x458a('0x45')]]['transferexten']=_0x4eed01[_0x458a('0x50')];agents[_0x4eed01[_0x458a('0x45')]]['transferuniqueid']=_0x4eed01[_0x458a('0x43')];}if(_0x4eed01[_0x458a('0x51')]&&agents[_0x4eed01[_0x458a('0x51')]]){agents[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x1;transfers[_0x4eed01[_0x458a('0x51')]]=_[_0x458a('0x52')](agents[_0x4eed01[_0x458a('0x51')]]);transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4c')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x2f')]=utils['now']();transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x25')]=0x0;transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x2;}}}catch(_0xfb99c8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x42'),_0x4eed01[_0x458a('0x45')]),_0xfb99c8);}};exports[_0x458a('0x53')]=function(_0x31074e){try{utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x31074e);if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e['uniqueid']][_0x458a('0x24')]==='timeout'){if(_0x31074e[_0x458a('0x55')]==='21'){agents[_0x31074e[_0x458a('0x6')]]['reason']=_0x458a('0x56');agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]='rejected';}utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x57'),_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e['uniqueid']][_0x458a('0x24')],agents[_0x31074e['uniqueid']]['lastevent']));writeDB(agents[_0x31074e[_0x458a('0x6')]]);var _0x36ba6e=unanswered[_0x458a('0x58')](_0x31074e[_0x458a('0x6')]);if(_0x36ba6e>-0x1){unanswered[_0x458a('0x59')](_0x36ba6e,0x1);}}if(transfers[_0x31074e[_0x458a('0x6')]]){transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x10')]=!![];transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](transfers[_0x31074e['uniqueid']]['agentcompleteAt'],transfers[_0x31074e['uniqueid']][_0x458a('0x2f')]);transfers[_0x31074e['uniqueid']][_0x458a('0x24')]=_0x458a('0x5a');transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],transfers[_0x31074e[_0x458a('0x6')]]['membername'],transfers[_0x31074e[_0x458a('0x6')]]['reason'],transfers[_0x31074e[_0x458a('0x6')]]['lastevent']));writeDB(transfers[_0x31074e[_0x458a('0x6')]],!![]);}if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]){agents[_0x31074e['uniqueid']][_0x458a('0x10')]=!![];agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](agents[_0x31074e[_0x458a('0x6')]]['agentcompleteAt'],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]);agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')]=agents[_0x31074e['uniqueid']][_0x458a('0x46')]?_0x458a('0x46'):'agent';agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]));writeDB(agents[_0x31074e['uniqueid']]);}}catch(_0x1f9925){utils['error'](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x1f9925);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c4ff9e6..abca53b 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 _0x1602=['debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','noop','gotoif','lastapplication','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','recording','newchannel'];(function(_0x6a1786,_0x30b3cb){var _0x443cd9=function(_0x5deef3){while(--_0x5deef3){_0x6a1786['push'](_0x6a1786['shift']());}};_0x443cd9(++_0x30b3cb);}(_0x1602,0x135));var _0x2160=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1602[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2160('0x0'));var util=require(_0x2160('0x1'));var utils=require(_0x2160('0x2'));var transfers=require(_0x2160('0x3'));var dispositions=[_0x2160('0x4'),_0x2160('0x5'),_0x2160('0x5'),_0x2160('0x4'),_0x2160('0x4'),_0x2160('0x4'),'ANSWERED','BUSY','FAILED',_0x2160('0x5'),_0x2160('0x5')];var channels={};function writeDB(_0x33a580){var _0x4b33e2;if(transfers[_0x2160('0x6')][_0x33a580[_0x2160('0x7')]]){_0x4b33e2=_0x33a580[_0x2160('0x7')];_0x33a580['uniqueid']=transfers[_0x2160('0x6')][_0x33a580['uniqueid']][_0x2160('0x8')];}utils['info'](util[_0x2160('0x9')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x33a580['uniqueid'],_0x33a580[_0x2160('0xa')],_0x33a580[_0x2160('0xb')],_0x33a580[_0x2160('0xc')],_0x33a580[_0x2160('0xd')],_0x33a580[_0x2160('0xe')],_0x33a580[_0x2160('0xf')],_0x33a580[_0x2160('0x10')]));if(_0x33a580[_0x2160('0x11')]){utils[_0x2160('0x12')](_0x33a580[_0x2160('0x11')])[_0x2160('0x13')](function(_0xc37a45){if(_0xc37a45){_0x33a580['UserId']=_0xc37a45['id'];}utils['request'](_0x2160('0x14'),_0x33a580);});}else{utils[_0x2160('0x15')](_0x2160('0x14'),_0x33a580);}if(channels[_0x33a580[_0x2160('0x7')]]){delete channels[_0x33a580[_0x2160('0x7')]];}else if(_0x4b33e2&&channels[_0x4b33e2]){if(!transfers['blinds'][_0x4b33e2][_0x2160('0x16')])delete transfers[_0x2160('0x6')][_0x4b33e2];delete channels[_0x4b33e2];}}exports[_0x2160('0x17')]=function(_0x59d29f){try{utils[_0x2160('0x18')](util[_0x2160('0x9')](_0x2160('0x19'),_0x59d29f[_0x2160('0x7')]),_0x59d29f);if(_0x59d29f[_0x2160('0x7')]==_0x59d29f[_0x2160('0x1a')]&&_0x59d29f[_0x2160('0xa')]!=_0x2160('0x1b')){utils[_0x2160('0x1c')](util[_0x2160('0x9')](_0x2160('0x1d'),_0x59d29f['uniqueid'],_0x59d29f[_0x2160('0x1e')],_0x59d29f[_0x2160('0x1f')]));channels[_0x59d29f[_0x2160('0x7')]]={'uniqueid':_0x59d29f[_0x2160('0x7')],'accountcode':_0x59d29f[_0x2160('0x11')],'source':_0x59d29f[_0x2160('0xe')],'destination':_0x59d29f['exten'],'destinationcontext':_0x59d29f['context'],'channel':_0x59d29f[_0x2160('0xa')],'starttime':utils[_0x2160('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2160('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x17fea4){utils[_0x2160('0x21')](util[_0x2160('0x9')](_0x2160('0x19'),_0x59d29f[_0x2160('0x7')]),_0x17fea4);}};exports[_0x2160('0x22')]=function(_0x5378a6){try{utils[_0x2160('0x18')](util[_0x2160('0x9')](_0x2160('0x23'),_0x5378a6[_0x2160('0x7')]),_0x5378a6);if(!_['isNil'](channels[_0x5378a6['uniqueid']])&&_0x5378a6[_0x2160('0x24')]==0x6){utils['info'](util['format'](_0x2160('0x25'),_0x5378a6[_0x2160('0x7')],_0x5378a6['context'],_0x5378a6['channel']));if(_[_0x2160('0x26')](channels[_0x5378a6['uniqueid']][_0x2160('0x27')])){channels[_0x5378a6[_0x2160('0x7')]]['systemanswertime']=utils[_0x2160('0x20')]();}}else if(!_[_0x2160('0x26')](channels[_0x5378a6['linkedid']])&&_0x5378a6[_0x2160('0x24')]==0x6&&_0x5378a6[_0x2160('0x1e')]!='transfer'){utils[_0x2160('0x1c')](util[_0x2160('0x9')](_0x2160('0x28'),_0x5378a6[_0x2160('0x7')],_0x5378a6[_0x2160('0x1a')],_0x5378a6['context'],_0x5378a6[_0x2160('0xa')]));channels[_0x5378a6['linkedid']][_0x2160('0x11')]=_0x5378a6[_0x2160('0x11')];channels[_0x5378a6[_0x2160('0x1a')]][_0x2160('0x29')]=_0x5378a6[_0x2160('0xa')];if(_[_0x2160('0x26')](channels[_0x5378a6[_0x2160('0x1a')]][_0x2160('0x2a')])){channels[_0x5378a6['linkedid']]['answertime']=utils['now']();}channels[_0x5378a6['linkedid']][_0x2160('0x2b')]=dispositions[_[_0x2160('0x2c')](_0x5378a6[_0x2160('0x24')])]||'ANSWERED';}}catch(_0x5105f4){utils[_0x2160('0x21')](util['format']('[%s][calls][newstate]',_0x5378a6[_0x2160('0x7')]),_0x5105f4);}};exports[_0x2160('0x2d')]=function(_0xbf8de6){try{if(!_[_0x2160('0x26')](channels[_0xbf8de6[_0x2160('0x7')]])){utils[_0x2160('0x18')](util[_0x2160('0x9')](_0x2160('0x2e'),_0xbf8de6[_0x2160('0x7')]),_0xbf8de6);if(_[_0x2160('0x26')](channels[_0xbf8de6[_0x2160('0x7')]]['callerid'])){channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x2f')]=_0xbf8de6[_0x2160('0x30')]+'\x20<'+_0xbf8de6[_0x2160('0xe')]+'>';}utils[_0x2160('0x1c')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xbf8de6['uniqueid'],channels[_0xbf8de6['uniqueid']][_0x2160('0x2f')],_0xbf8de6[_0x2160('0x31')]));channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x32')]=utils[_0x2160('0x20')]();channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x33')]=utils[_0x2160('0x34')](channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x32')],channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x35')]);channels[_0xbf8de6[_0x2160('0x7')]]['billableseconds']=channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x2a')]?utils[_0x2160('0x34')](channels[_0xbf8de6[_0x2160('0x7')]]['endtime'],channels[_0xbf8de6[_0x2160('0x7')]][_0x2160('0x2a')]):0x0;writeDB(channels[_0xbf8de6[_0x2160('0x7')]]);}}catch(_0x2b2a42){utils[_0x2160('0x21')](util['format'](_0x2160('0x2e'),_0xbf8de6[_0x2160('0x7')]),_0x2b2a42);}};exports[_0x2160('0x36')]=function(_0x98c20a){try{if(!_['isNil'](channels[_0x98c20a['localtwolinkedid']])){utils['debug'](util[_0x2160('0x9')]('[%s][calls][attendedtransfer]',_0x98c20a[_0x2160('0x37')]),_0x98c20a);if(channels[_0x98c20a[_0x2160('0x38')]][_0x2160('0xa')]==_0x98c20a[_0x2160('0x39')]){utils[_0x2160('0x1c')](util[_0x2160('0x9')](_0x2160('0x3a'),_0x98c20a[_0x2160('0x37')],_0x98c20a[_0x2160('0x38')],_0x98c20a[_0x2160('0x3b')]));channels[_0x98c20a[_0x2160('0x38')]][_0x2160('0x29')]=_0x98c20a[_0x2160('0x3b')];channels[_0x98c20a[_0x2160('0x38')]][_0x2160('0x3c')]='_attended';}else if(channels[_0x98c20a[_0x2160('0x38')]]['channel']=_0x98c20a[_0x2160('0x3d')]){utils['info'](util[_0x2160('0x9')](_0x2160('0x3a'),_0x98c20a[_0x2160('0x37')],_0x98c20a['localtwolinkedid'],_0x98c20a['origtransfererchannel']));channels[_0x98c20a[_0x2160('0x38')]][_0x2160('0x29')]=_0x98c20a['origtransfererchannel'];channels[_0x98c20a[_0x2160('0x38')]]['userfield']=_0x2160('0x3e');}}}catch(_0x5104c2){utils[_0x2160('0x21')](util['format'](_0x2160('0x3f'),_0x98c20a[_0x2160('0x37')]),_0x5104c2);}};exports[_0x2160('0x40')]=function(_0x319f9f){try{if(!_[_0x2160('0x26')](channels[_0x319f9f[_0x2160('0x7')]])){utils[_0x2160('0x18')](util[_0x2160('0x9')](_0x2160('0x41'),_0x319f9f[_0x2160('0x7')]),_0x319f9f);channels[_0x319f9f[_0x2160('0x7')]][_0x2160('0x42')]=utils['now']();utils[_0x2160('0x1c')](util[_0x2160('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x319f9f[_0x2160('0x7')],channels[_0x319f9f['uniqueid']][_0x2160('0x42')]));}}catch(_0x5143d2){utils[_0x2160('0x21')](util['format'](_0x2160('0x41'),_0x319f9f['uniqueid']),_0x5143d2);}};exports[_0x2160('0x43')]=function(_0x2c3eff){try{if(!_['isNil'](channels[_0x2c3eff[_0x2160('0x7')]])){utils[_0x2160('0x18')](util['format']('[%s][calls][musiconholdstop]',_0x2c3eff[_0x2160('0x7')]),_0x2c3eff);if(!_['isNil'](channels[_0x2c3eff[_0x2160('0x7')]]['musiconholdstartAt'])){channels[_0x2c3eff[_0x2160('0x7')]][_0x2160('0x44')]+=utils['diffTime'](utils[_0x2160('0x20')](),channels[_0x2c3eff['uniqueid']][_0x2160('0x42')]);utils['info'](util[_0x2160('0x9')](_0x2160('0x45'),_0x2c3eff[_0x2160('0x7')],channels[_0x2c3eff[_0x2160('0x7')]][_0x2160('0x44')]));delete channels[_0x2c3eff[_0x2160('0x7')]]['musiconholdstartAt'];}}}catch(_0x2edef3){utils[_0x2160('0x21')](util[_0x2160('0x9')](_0x2160('0x46'),_0x2c3eff['uniqueid']),_0x2edef3);}};exports['varset']=function(_0x5bf38e){try{if(!_[_0x2160('0x26')](channels[_0x5bf38e['uniqueid']])){utils[_0x2160('0x18')](util[_0x2160('0x9')](_0x2160('0x47'),_0x5bf38e['uniqueid']),_0x5bf38e);if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x49')])){utils[_0x2160('0x1c')](util['format'](_0x2160('0x4a'),_0x5bf38e[_0x2160('0x7')],_0x5bf38e[_0x2160('0x4b')]));channels[_0x5bf38e['uniqueid']][_0x2160('0x4c')]=_0x5bf38e[_0x2160('0x4b')];}if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x4d')])){utils[_0x2160('0x1c')](util[_0x2160('0x9')](_0x2160('0x4e'),_0x5bf38e[_0x2160('0x7')],_0x5bf38e[_0x2160('0x4b')]));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x4f')]=_0x5bf38e[_0x2160('0x4b')];channels[_0x5bf38e['uniqueid']][_0x2160('0x2f')]='\x22'+_0x5bf38e['value']+_0x2160('0x50')+_0x5bf38e[_0x2160('0x4b')]+'>';}if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x51')])||!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x52')])){utils[_0x2160('0x1c')](util['format'](_0x2160('0x53'),_0x5bf38e['uniqueid'],!_['isNil'](_0x5bf38e[_0x2160('0x48')][_0x2160('0x51')])?_0x2160('0x51'):'xmd-callerid',_0x5bf38e['value']));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x2f')]=_0x5bf38e['value'];}if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x54')])||!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x55')])){utils['info'](util[_0x2160('0x9')](_0x2160('0x53'),_0x5bf38e[_0x2160('0x7')],!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x54')])?_0x2160('0x54'):_0x2160('0x55'),_0x5bf38e['value']));channels[_0x5bf38e['uniqueid']]['lastapplication']=_0x2160('0x56');channels[_0x5bf38e['uniqueid']][_0x2160('0x57')]=_0x5bf38e[_0x2160('0x4b')];channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0xb')]=!![];}if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x58')])){utils[_0x2160('0x1c')](util['format'](_0x2160('0x59'),_0x5bf38e[_0x2160('0x7')],_0x5bf38e['value']));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x5a')]=_0x5bf38e['value'];}if(!_['isNil'](_0x5bf38e['variable'][_0x2160('0x5b')])){utils[_0x2160('0x1c')](util[_0x2160('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5bf38e[_0x2160('0x7')],_0x5bf38e[_0x2160('0x4b')]));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x5c')]=_0x5bf38e[_0x2160('0x4b')];}if(!_[_0x2160('0x26')](_0x5bf38e['variable'][_0x2160('0x5d')])){utils[_0x2160('0x1c')](util[_0x2160('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5bf38e[_0x2160('0x7')],_0x5bf38e[_0x2160('0x4b')]));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x5e')]=_0x5bf38e[_0x2160('0x4b')];}if(!_[_0x2160('0x26')](_0x5bf38e[_0x2160('0x48')][_0x2160('0x5f')])){utils[_0x2160('0x1c')](util[_0x2160('0x9')](_0x2160('0x60'),_0x5bf38e[_0x2160('0x7')],_0x5bf38e['value']));channels[_0x5bf38e[_0x2160('0x7')]][_0x2160('0x5f')]=_0x5bf38e[_0x2160('0x4b')];}}}catch(_0x1555f7){utils[_0x2160('0x21')](util[_0x2160('0x9')](_0x2160('0x47'),_0x5bf38e[_0x2160('0x7')]),_0x1555f7);}};exports[_0x2160('0x61')]=function(_0x71af00){try{if(!_['isNil'](channels[_0x71af00[_0x2160('0x7')]])){utils[_0x2160('0x18')](util[_0x2160('0x9')]('[%s][calls][newexten]',_0x71af00[_0x2160('0x7')]),_0x71af00);utils['info'](util['format'](_0x2160('0x62'),_0x71af00['uniqueid'],_0x71af00[_0x2160('0x63')],_0x71af00[_0x2160('0x64')]));if(_0x71af00[_0x2160('0x63')][_0x2160('0x65')]()==_0x2160('0x66')&&_[_0x2160('0x67')](_0x71af00[_0x2160('0x64')][_0x2160('0x65')](),_0x2160('0x68'))){var _0x3134fe=_0x71af00[_0x2160('0x64')]['split']('=');var _0x437e76=_0x3134fe[0x0][_0x2160('0x69')](_0x3134fe[0x0][_0x2160('0x6a')]('(')+0x1,_0x3134fe[0x0]['lastIndexOf'](')'));var _0x54a663=_0x3134fe[0x1];channels[_0x71af00['uniqueid']][_0x437e76]=_0x54a663;}if(!_['includes']([_0x2160('0x2d'),_0x2160('0x6b'),'execif',_0x2160('0x66'),_0x2160('0x6c')],_0x71af00[_0x2160('0x63')]['toLowerCase']())){channels[_0x71af00[_0x2160('0x7')]][_0x2160('0x6d')]=_0x71af00[_0x2160('0x63')];channels[_0x71af00[_0x2160('0x7')]][_0x2160('0x57')]=_0x71af00[_0x2160('0x64')];}}}catch(_0x58dc50){utils[_0x2160('0x21')](util[_0x2160('0x9')](_0x2160('0x6e'),_0x71af00['uniqueid']),_0x58dc50);}}; \ No newline at end of file +var _0xcbb1=['xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','lastIndexOf','includes','noop','lastapplication','util','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','format','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','answertime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x901681,_0x266d9a){_0x901681=_0x901681-0x0;var _0x32478f=_0xcbb1[_0x901681];return _0x32478f;};'use strict';var _=require('lodash');var util=require(_0x1cbb('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x1cbb('0x1'),_0x1cbb('0x2'),_0x1cbb('0x2'),_0x1cbb('0x1'),'NO\x20ANSWER',_0x1cbb('0x1'),_0x1cbb('0x3'),'BUSY','FAILED',_0x1cbb('0x2'),_0x1cbb('0x2')];var channels={};function writeDB(_0x3d2d8e){var _0x5381a3;if(transfers[_0x1cbb('0x4')][_0x3d2d8e[_0x1cbb('0x5')]]){_0x5381a3=_0x3d2d8e[_0x1cbb('0x5')];_0x3d2d8e[_0x1cbb('0x5')]=transfers['blinds'][_0x3d2d8e[_0x1cbb('0x5')]][_0x1cbb('0x6')];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3d2d8e[_0x1cbb('0x5')],_0x3d2d8e[_0x1cbb('0x7')],_0x3d2d8e[_0x1cbb('0x8')],_0x3d2d8e[_0x1cbb('0x9')],_0x3d2d8e[_0x1cbb('0xa')],_0x3d2d8e[_0x1cbb('0xb')],_0x3d2d8e['connectedlinenum'],_0x3d2d8e[_0x1cbb('0xc')]));if(_0x3d2d8e[_0x1cbb('0xd')]){utils[_0x1cbb('0xe')](_0x3d2d8e[_0x1cbb('0xd')])[_0x1cbb('0xf')](function(_0x5ceb02){if(_0x5ceb02){_0x3d2d8e['UserId']=_0x5ceb02['id'];}utils[_0x1cbb('0x10')](_0x1cbb('0x11'),_0x3d2d8e);});}else{utils['request'](_0x1cbb('0x11'),_0x3d2d8e);}if(channels[_0x3d2d8e['uniqueid']]){delete channels[_0x3d2d8e[_0x1cbb('0x5')]];}else if(_0x5381a3&&channels[_0x5381a3]){if(!transfers[_0x1cbb('0x4')][_0x5381a3][_0x1cbb('0x12')])delete transfers[_0x1cbb('0x4')][_0x5381a3];delete channels[_0x5381a3];}}exports['newchannel']=function(_0x28b0d4){try{utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][newchannel]',_0x28b0d4[_0x1cbb('0x5')]),_0x28b0d4);if(_0x28b0d4[_0x1cbb('0x5')]==_0x28b0d4[_0x1cbb('0x14')]&&_0x28b0d4['channel']!='OutgoingSpoolFailed'){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x16'),_0x28b0d4['uniqueid'],_0x28b0d4[_0x1cbb('0x17')],_0x28b0d4['exten']));channels[_0x28b0d4[_0x1cbb('0x5')]]={'uniqueid':_0x28b0d4[_0x1cbb('0x5')],'accountcode':_0x28b0d4[_0x1cbb('0xd')],'source':_0x28b0d4[_0x1cbb('0xb')],'destination':_0x28b0d4[_0x1cbb('0x18')],'destinationcontext':_0x28b0d4[_0x1cbb('0x17')],'channel':_0x28b0d4['channel'],'starttime':utils[_0x1cbb('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1cbb('0x1'),'amaflags':_0x1cbb('0x1a')};}}catch(_0x2aa724){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1c'),_0x28b0d4[_0x1cbb('0x5')]),_0x2aa724);}};exports['newstate']=function(_0x3b9562){try{utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562['uniqueid']),_0x3b9562);if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x21'),_0x3b9562['uniqueid'],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]][_0x1cbb('0x22')])){channels[_0x3b9562[_0x1cbb('0x5')]]['systemanswertime']=utils[_0x1cbb('0x19')]();}}else if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6&&_0x3b9562[_0x1cbb('0x17')]!=_0x1cbb('0x23')){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x24'),_0x3b9562[_0x1cbb('0x5')],_0x3b9562[_0x1cbb('0x14')],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0xd')]=_0x3b9562[_0x1cbb('0xd')];channels[_0x3b9562[_0x1cbb('0x14')]]['destinationchannel']=_0x3b9562[_0x1cbb('0x7')];if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]]['answertime'])){channels[_0x3b9562[_0x1cbb('0x14')]]['answertime']=utils[_0x1cbb('0x19')]();}channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0x25')]=dispositions[_[_0x1cbb('0x26')](_0x3b9562[_0x1cbb('0x20')])]||_0x1cbb('0x3');}}catch(_0x2166dd){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562[_0x1cbb('0x5')]),_0x2166dd);}};exports[_0x1cbb('0x27')]=function(_0x11e030){try{if(!_[_0x1cbb('0x1f')](channels[_0x11e030['uniqueid']])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][hangup]',_0x11e030[_0x1cbb('0x5')]),_0x11e030);if(_['isNil'](channels[_0x11e030[_0x1cbb('0x5')]]['callerid'])){channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')]=_0x11e030[_0x1cbb('0x29')]+'\x20<'+_0x11e030[_0x1cbb('0xb')]+'>';}utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x2a'),_0x11e030[_0x1cbb('0x5')],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')],_0x11e030[_0x1cbb('0x2b')]));channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2c')]=utils[_0x1cbb('0x19')]();channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2d')]=utils[_0x1cbb('0x2e')](channels[_0x11e030['uniqueid']][_0x1cbb('0x2c')],channels[_0x11e030[_0x1cbb('0x5')]]['starttime']);channels[_0x11e030['uniqueid']][_0x1cbb('0x2f')]=channels[_0x11e030['uniqueid']][_0x1cbb('0x30')]?utils[_0x1cbb('0x2e')](channels[_0x11e030[_0x1cbb('0x5')]]['endtime'],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x30')]):0x0;writeDB(channels[_0x11e030[_0x1cbb('0x5')]]);}}catch(_0xe4a38a){utils[_0x1cbb('0x1b')](util['format'](_0x1cbb('0x31'),_0x11e030[_0x1cbb('0x5')]),_0xe4a38a);}};exports[_0x1cbb('0x32')]=function(_0x51b7d8){try{if(!_['isNil'](channels[_0x51b7d8[_0x1cbb('0x33')]])){utils[_0x1cbb('0x1d')](util['format'](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x51b7d8);if(channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x7')]==_0x51b7d8[_0x1cbb('0x35')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x38')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x38')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}else if(channels[_0x51b7d8[_0x1cbb('0x33')]]['channel']=_0x51b7d8[_0x1cbb('0x3c')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x3d')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x3d')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}}}catch(_0x4b5330){utils['error'](util[_0x1cbb('0x13')](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x4b5330);}};exports[_0x1cbb('0x3e')]=function(_0x10f17c){try{if(!_[_0x1cbb('0x1f')](channels[_0x10f17c[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x10f17c);channels[_0x10f17c[_0x1cbb('0x5')]][_0x1cbb('0x3f')]=utils[_0x1cbb('0x19')]();utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x40'),_0x10f17c[_0x1cbb('0x5')],channels[_0x10f17c[_0x1cbb('0x5')]]['musiconholdstartAt']));}}catch(_0x456966){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x456966);}};exports[_0x1cbb('0x41')]=function(_0x1f643d){try{if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]])){utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x1f643d);if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')])){channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]+=utils[_0x1cbb('0x2e')](utils[_0x1cbb('0x19')](),channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')]);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x43'),_0x1f643d['uniqueid'],channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]));delete channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')];}}}catch(_0x18ff02){utils[_0x1cbb('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x18ff02);}};exports[_0x1cbb('0x44')]=function(_0x2653b5){try{if(!_[_0x1cbb('0x1f')](channels[_0x2653b5[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x45'),_0x2653b5[_0x1cbb('0x5')]),_0x2653b5);if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x47')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x48'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['source']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4a')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x4b'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x4c')]=_0x2653b5[_0x1cbb('0x49')];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x28')]='\x22'+_0x2653b5[_0x1cbb('0x49')]+_0x1cbb('0x4d')+_0x2653b5[_0x1cbb('0x49')]+'>';}if(!_['isNil'](_0x2653b5['variable'][_0x1cbb('0x4e')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4f')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x50'),_0x2653b5['uniqueid'],!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x4e')])?'xmd-callerid-preview':_0x1cbb('0x4f'),_0x2653b5['value']));channels[_0x2653b5['uniqueid']]['callerid']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x51')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')]['xmcs-queue'])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x50'),_0x2653b5[_0x1cbb('0x5')],!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x51')])?_0x1cbb('0x51'):_0x1cbb('0x52'),_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['lastapplication']=_0x1cbb('0x53');channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x2653b5['value'];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x8')]=!![];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x55')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x56'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x57')]=_0x2653b5[_0x1cbb('0x49')];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x58')])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x59'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x5a')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5b')])){utils['info'](util['format'](_0x1cbb('0x5c'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5['uniqueid']][_0x1cbb('0x5d')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5e')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x5f'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['sipcallid']=_0x2653b5['value'];}}}catch(_0x3c72e4){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][varset]',_0x2653b5[_0x1cbb('0x5')]),_0x3c72e4);}};exports[_0x1cbb('0x60')]=function(_0x965e68){try{if(!_[_0x1cbb('0x1f')](channels[_0x965e68['uniqueid']])){utils['debug'](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68[_0x1cbb('0x5')]),_0x965e68);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x965e68[_0x1cbb('0x5')],_0x965e68[_0x1cbb('0x62')],_0x965e68[_0x1cbb('0x63')]));if(_0x965e68[_0x1cbb('0x62')]['toLowerCase']()==_0x1cbb('0x64')&&_[_0x1cbb('0x65')](_0x965e68['appdata'][_0x1cbb('0x66')](),_0x1cbb('0x67'))){var _0x7d166e=_0x965e68[_0x1cbb('0x63')]['split']('=');var _0x45503c=_0x7d166e[0x0]['substring'](_0x7d166e[0x0][_0x1cbb('0x68')]('(')+0x1,_0x7d166e[0x0][_0x1cbb('0x68')](')'));var _0x1bcc3f=_0x7d166e[0x1];channels[_0x965e68['uniqueid']][_0x45503c]=_0x1bcc3f;}if(!_[_0x1cbb('0x69')](['hangup',_0x1cbb('0x6a'),'execif',_0x1cbb('0x64'),'gotoif'],_0x965e68[_0x1cbb('0x62')][_0x1cbb('0x66')]())){channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x6b')]=_0x965e68[_0x1cbb('0x62')];channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x965e68[_0x1cbb('0x63')];}}}catch(_0x4d2bd9){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68['uniqueid']),_0x4d2bd9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9e9cb42..13d5c67 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 _0x50a3=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect'];(function(_0x1b0899,_0x179c99){var _0x30273f=function(_0x3013e7){while(--_0x3013e7){_0x1b0899['push'](_0x1b0899['shift']());}};_0x30273f(++_0x179c99);}(_0x50a3,0x137));var _0x350a=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0x50a3[_0x2abaae];return _0x5b5745;};'use strict';var utils=require('./utils');exports[_0x350a('0x0')]=function(){utils[_0x350a('0x1')](_0x350a('0x2'));};exports[_0x350a('0x3')]=function(){utils['info'](_0x350a('0x4'));};exports[_0x350a('0x5')]=function(){utils[_0x350a('0x1')](_0x350a('0x6'));};exports[_0x350a('0x7')]=function(_0x16434c){utils[_0x350a('0x7')](_0x350a('0x8'),_0x16434c);};exports[_0x350a('0x9')]=function(){utils['info'](_0x350a('0xa'));};exports[_0x350a('0xb')]=function(_0x5cf0dd){}; \ No newline at end of file +var _0x896b=['[core]\x20connected','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','./utils'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x896b,0xf7));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xb896('0x0'));exports['connect']=function(){utils['info'](_0xb896('0x1'));};exports['shutdown']=function(){utils['info'](_0xb896('0x2'));};exports['fullybooted']=function(){utils[_0xb896('0x3')](_0xb896('0x4'));};exports[_0xb896('0x5')]=function(_0x2a2819){utils[_0xb896('0x5')](_0xb896('0x6'),_0x2a2819);};exports[_0xb896('0x7')]=function(){utils[_0xb896('0x3')]('[core]\x20close');};exports['managerevent']=function(_0x6b51bb){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 45f603a..ecd304a 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 _0xf39d=['holdtime','diffTime','lodash','./utils','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','calleridname','cause-txt','assign','complete','duration','endtime'];(function(_0x43ef77,_0x484153){var _0x18a821=function(_0x223e3f){while(--_0x223e3f){_0x43ef77['push'](_0x43ef77['shift']());}};_0x18a821(++_0x484153);}(_0xf39d,0x1a9));var _0xdf39=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xf39d[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xdf39('0x0'));var util=require('util');var utils=require(_0xdf39('0x1'));var dials={};function writeDB(_0x2f696f){utils[_0xdf39('0x2')](util[_0xdf39('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2f696f[_0xdf39('0x4')],_0x2f696f['channel'],_0x2f696f[_0xdf39('0x5')],_0x2f696f[_0xdf39('0x6')],_0x2f696f[_0xdf39('0x7')],_0x2f696f['dialstatus']));utils[_0xdf39('0x8')](_0xdf39('0x9'),_0x2f696f);delete dials[_0x2f696f[_0xdf39('0x4')]];}exports['newexten']=function(_0xbd0672){try{utils['debug'](util[_0xdf39('0x3')]('[%s][dials][newexten]',_0xbd0672[_0xdf39('0x4')]),_0xbd0672);utils[_0xdf39('0x2')](util[_0xdf39('0x3')](_0xdf39('0xa'),_0xbd0672['uniqueid'],_0xbd0672[_0xdf39('0xb')],_0xbd0672[_0xdf39('0xc')]));if(_0xbd0672[_0xdf39('0xb')][_0xdf39('0xd')]()=='set'&&_['startsWith'](_0xbd0672[_0xdf39('0xc')][_0xdf39('0xd')](),_0xdf39('0xe'))){var _0xa35a85=_0xbd0672[_0xdf39('0xc')][_0xdf39('0xf')]('=');dials[_0xbd0672[_0xdf39('0x4')]]={'routeId':_0xa35a85[0x1]};}}catch(_0x59b97d){utils[_0xdf39('0x10')](util[_0xdf39('0x3')](_0xdf39('0x11'),_0xbd0672[_0xdf39('0x4')]),_0x59b97d);}};exports['varset']=function(_0xebaa0a){try{utils[_0xdf39('0x12')](util[_0xdf39('0x3')](_0xdf39('0x13'),_0xebaa0a[_0xdf39('0x4')]),_0xebaa0a);if(!_[_0xdf39('0x14')](_0xebaa0a[_0xdf39('0x15')]['outboundrouteid'])){utils[_0xdf39('0x2')](util[_0xdf39('0x3')](_0xdf39('0x16'),_0xebaa0a[_0xdf39('0x4')],_0xebaa0a[_0xdf39('0x17')]));dials[_0xebaa0a[_0xdf39('0x4')]]={'routeId':_0xebaa0a[_0xdf39('0x17')]};}}catch(_0x49f122){utils['error'](util[_0xdf39('0x3')]('[%s][dials][varset]',_0xebaa0a[_0xdf39('0x4')]),_0x49f122);}};exports[_0xdf39('0x18')]=function(_0x26dc4a){try{if(!_[_0xdf39('0x14')](dials[_0x26dc4a[_0xdf39('0x4')]])){utils['debug'](util[_0xdf39('0x3')](_0xdf39('0x19'),_0x26dc4a['uniqueid']),_0x26dc4a);dials[_0x26dc4a['uniqueid']]=_['assign'](dials[_0x26dc4a['uniqueid']],_0x26dc4a);dials[_0x26dc4a['uniqueid']]['starttime']=utils[_0xdf39('0x1a')]();dials[_0x26dc4a['uniqueid']][_0xdf39('0x1b')]=_0xdf39('0x1c');utils[_0xdf39('0x2')](util['format'](_0xdf39('0x1d'),_0x26dc4a[_0xdf39('0x4')],dials[_0x26dc4a[_0xdf39('0x4')]][_0xdf39('0x1e')]));}}catch(_0x59bf2c){utils['error'](util[_0xdf39('0x3')](_0xdf39('0x19'),_0x26dc4a['uniqueid']),_0x59bf2c);}};exports[_0xdf39('0x1f')]=function(_0x1b9ae8){try{if(!_['isNil'](dials[_0x1b9ae8['uniqueid']])){utils[_0xdf39('0x12')](util[_0xdf39('0x3')]('[%s][dials][dialend]',_0x1b9ae8['uniqueid']),_0x1b9ae8);dials[_0x1b9ae8[_0xdf39('0x4')]][_0xdf39('0x20')]=_0x1b9ae8[_0xdf39('0x20')];if(_0x1b9ae8[_0xdf39('0x20')]==_0xdf39('0x21')){dials[_0x1b9ae8['uniqueid']]=_['assign'](dials[_0x1b9ae8[_0xdf39('0x4')]],_0x1b9ae8);dials[_0x1b9ae8[_0xdf39('0x4')]][_0xdf39('0x22')]=utils[_0xdf39('0x1a')]();dials[_0x1b9ae8[_0xdf39('0x4')]][_0xdf39('0x1b')]=_0xdf39('0x23');utils[_0xdf39('0x2')](util[_0xdf39('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1b9ae8['uniqueid'],_0x1b9ae8['dialstatus'],dials[_0x1b9ae8['uniqueid']][_0xdf39('0x22')]));}else{utils[_0xdf39('0x2')](util['format'](_0xdf39('0x24'),_0x1b9ae8[_0xdf39('0x4')],_0x1b9ae8['dialstatus']));}}}catch(_0x5a5c90){utils[_0xdf39('0x10')](util['format'](_0xdf39('0x25'),_0x1b9ae8['uniqueid']),_0x5a5c90);}};exports['hangup']=function(_0x508b21){try{if(!_['isNil'](dials[_0x508b21[_0xdf39('0x4')]])){utils[_0xdf39('0x12')](util[_0xdf39('0x3')](_0xdf39('0x26'),_0x508b21['uniqueid']),_0x508b21);utils[_0xdf39('0x2')](util[_0xdf39('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x508b21[_0xdf39('0x4')],_0x508b21[_0xdf39('0x6')],_0x508b21[_0xdf39('0x27')],_0x508b21[_0xdf39('0x28')]));dials[_0x508b21[_0xdf39('0x4')]]=_[_0xdf39('0x29')](dials[_0x508b21['uniqueid']],{'endtime':utils[_0xdf39('0x1a')](),'lastevent':_0xdf39('0x2a')});dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x2b')]=utils['diffTime'](dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x2c')],dials[_0x508b21['uniqueid']][_0xdf39('0x1e')]);dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x2d')]=utils[_0xdf39('0x2e')](dials[_0x508b21[_0xdf39('0x4')]]['answertime']||dials[_0x508b21[_0xdf39('0x4')]]['endtime'],dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x1e')]);dials[_0x508b21['uniqueid']]['billableseconds']=dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x22')]?utils[_0xdf39('0x2e')](dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x2c')],dials[_0x508b21[_0xdf39('0x4')]][_0xdf39('0x22')]):0x0;writeDB(dials[_0x508b21[_0xdf39('0x4')]]);}}catch(_0x5298ae){utils[_0xdf39('0x10')](util[_0xdf39('0x3')](_0xdf39('0x26'),_0x508b21['uniqueid']),_0x5298ae);}}; \ No newline at end of file +var _0xefcd=['ANSWER','assign','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','isNil','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','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','application','appdata','toLowerCase','cdr(routeid)','split','[%s][dials][newexten]','varset','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0xefcd,0xdc));var _0xdefc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xefcd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdefc('0x0'));var util=require(_0xdefc('0x1'));var utils=require(_0xdefc('0x2'));var dials={};function writeDB(_0x724a3b){utils[_0xdefc('0x3')](util['format'](_0xdefc('0x4'),_0x724a3b[_0xdefc('0x5')],_0x724a3b[_0xdefc('0x6')],_0x724a3b[_0xdefc('0x7')],_0x724a3b[_0xdefc('0x8')],_0x724a3b[_0xdefc('0x9')],_0x724a3b[_0xdefc('0xa')]));utils[_0xdefc('0xb')](_0xdefc('0xc'),_0x724a3b);delete dials[_0x724a3b[_0xdefc('0x5')]];}exports[_0xdefc('0xd')]=function(_0x28f2c5){try{utils[_0xdefc('0xe')](util['format']('[%s][dials][newexten]',_0x28f2c5[_0xdefc('0x5')]),_0x28f2c5);utils['info'](util[_0xdefc('0xf')](_0xdefc('0x10'),_0x28f2c5[_0xdefc('0x5')],_0x28f2c5[_0xdefc('0x11')],_0x28f2c5[_0xdefc('0x12')]));if(_0x28f2c5[_0xdefc('0x11')][_0xdefc('0x13')]()=='set'&&_['startsWith'](_0x28f2c5['appdata'][_0xdefc('0x13')](),_0xdefc('0x14'))){var _0x5e7d59=_0x28f2c5[_0xdefc('0x12')][_0xdefc('0x15')]('=');dials[_0x28f2c5[_0xdefc('0x5')]]={'routeId':_0x5e7d59[0x1]};}}catch(_0xf35f48){utils['error'](util[_0xdefc('0xf')](_0xdefc('0x16'),_0x28f2c5[_0xdefc('0x5')]),_0xf35f48);}};exports[_0xdefc('0x17')]=function(_0x534586){try{utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x18'),_0x534586[_0xdefc('0x5')]),_0x534586);if(!_['isNil'](_0x534586['variable'][_0xdefc('0x19')])){utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x1a'),_0x534586[_0xdefc('0x5')],_0x534586[_0xdefc('0x1b')]));dials[_0x534586[_0xdefc('0x5')]]={'routeId':_0x534586[_0xdefc('0x1b')]};}}catch(_0x3dd499){utils[_0xdefc('0x1c')](util['format'](_0xdefc('0x18'),_0x534586['uniqueid']),_0x3dd499);}};exports[_0xdefc('0x1d')]=function(_0x52e5e1){try{if(!_['isNil'](dials[_0x52e5e1['uniqueid']])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x1e'),_0x52e5e1[_0xdefc('0x5')]),_0x52e5e1);dials[_0x52e5e1[_0xdefc('0x5')]]=_['assign'](dials[_0x52e5e1[_0xdefc('0x5')]],_0x52e5e1);dials[_0x52e5e1[_0xdefc('0x5')]][_0xdefc('0x1f')]=utils['now']();dials[_0x52e5e1[_0xdefc('0x5')]]['lastevent']='called';utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x20'),_0x52e5e1[_0xdefc('0x5')],dials[_0x52e5e1[_0xdefc('0x5')]][_0xdefc('0x1f')]));}}catch(_0x2fa178){utils['error'](util[_0xdefc('0xf')]('[%s][dials][dialbegin]',_0x52e5e1[_0xdefc('0x5')]),_0x2fa178);}};exports[_0xdefc('0x21')]=function(_0x4d7910){try{if(!_['isNil'](dials[_0x4d7910[_0xdefc('0x5')]])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x22'),_0x4d7910[_0xdefc('0x5')]),_0x4d7910);dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0xa')]=_0x4d7910[_0xdefc('0xa')];if(_0x4d7910[_0xdefc('0xa')]==_0xdefc('0x23')){dials[_0x4d7910[_0xdefc('0x5')]]=_[_0xdefc('0x24')](dials[_0x4d7910[_0xdefc('0x5')]],_0x4d7910);dials[_0x4d7910['uniqueid']]['answertime']=utils[_0xdefc('0x25')]();dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0x26')]=_0xdefc('0x27');utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x28'),_0x4d7910[_0xdefc('0x5')],_0x4d7910[_0xdefc('0xa')],dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0x29')]));}else{utils[_0xdefc('0x3')](util[_0xdefc('0xf')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4d7910['uniqueid'],_0x4d7910[_0xdefc('0xa')]));}}}catch(_0x539e46){utils['error'](util[_0xdefc('0xf')](_0xdefc('0x22'),_0x4d7910[_0xdefc('0x5')]),_0x539e46);}};exports[_0xdefc('0x2a')]=function(_0x2a67a7){try{if(!_[_0xdefc('0x2b')](dials[_0x2a67a7[_0xdefc('0x5')]])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x2c'),_0x2a67a7[_0xdefc('0x5')]),_0x2a67a7);utils[_0xdefc('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2a67a7[_0xdefc('0x5')],_0x2a67a7[_0xdefc('0x8')],_0x2a67a7[_0xdefc('0x2d')],_0x2a67a7[_0xdefc('0x2e')]));dials[_0x2a67a7[_0xdefc('0x5')]]=_['assign'](dials[_0x2a67a7['uniqueid']],{'endtime':utils[_0xdefc('0x25')](),'lastevent':_0xdefc('0x2f')});dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x30')]=utils[_0xdefc('0x31')](dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7['uniqueid']]['starttime']);dials[_0x2a67a7['uniqueid']][_0xdefc('0x32')]=utils['diffTime'](dials[_0x2a67a7['uniqueid']][_0xdefc('0x29')]||dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x1f')]);dials[_0x2a67a7['uniqueid']]['billableseconds']=dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x29')]?utils[_0xdefc('0x31')](dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7[_0xdefc('0x5')]]['answertime']):0x0;writeDB(dials[_0x2a67a7[_0xdefc('0x5')]]);}}catch(_0x584721){utils[_0xdefc('0x1c')](util['format'](_0xdefc('0x2c'),_0x2a67a7[_0xdefc('0x5')]),_0x584721);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index db0c2ea..fa660c4 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 _0xfa70=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','env','production','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','cdr'];(function(_0x16a496,_0x2380e2){var _0x5d2c35=function(_0x26fd43){while(--_0x26fd43){_0x16a496['push'](_0x16a496['shift']());}};_0x5d2c35(++_0x2380e2);}(_0xfa70,0x196));var _0x0fa7=function(_0x3ab5bd,_0x56fbcf){_0x3ab5bd=_0x3ab5bd-0x0;var _0xe4109d=_0xfa70[_0x3ab5bd];return _0xe4109d;};var AsteriskManager=require(_0x0fa7('0x0'));var config=require(_0x0fa7('0x1'));var utils=require(_0x0fa7('0x2'));var util=require(_0x0fa7('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x0fa7('0x4')]?!config[_0x0fa7('0x5')][_0x0fa7('0x4')]:!![];var isProduction=config[_0x0fa7('0x6')]===_0x0fa7('0x7')||![];var isLocalAsterisk=config[_0x0fa7('0x5')]&&config[_0x0fa7('0x5')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x0fa7('0x8')][_0x0fa7('0x9')],config[_0x0fa7('0x8')]['ip'],config[_0x0fa7('0x8')][_0x0fa7('0xa')],config[_0x0fa7('0x8')]['password'],!![]);ami[_0x0fa7('0xb')]();if(!isXDREnabled){utils[_0x0fa7('0xc')](_0x0fa7('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0fa7('0xc')](_0x0fa7('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x0fa7('0xf'));var queues=require(_0x0fa7('0x10'));var recordings=require('./recordings.controller');var members=require(_0x0fa7('0x11'));var dials=require(_0x0fa7('0x12'));var transfers=require(_0x0fa7('0x13'));var core=require('./core.controller');ami['on'](_0x0fa7('0x14'),core[_0x0fa7('0x14')]);ami['on']('shutdown',core[_0x0fa7('0x15')]);ami['on'](_0x0fa7('0x16'),core[_0x0fa7('0x16')]);ami['on']('error',core[_0x0fa7('0x17')]);ami['on']('close',core['close']);ami['on'](_0x0fa7('0x18'),core[_0x0fa7('0x18')]);ami['on'](_0x0fa7('0x19'),function(_0x322d71){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')]('[%s][index][devicestatechange]',_0x322d71['device']),_0x322d71);members[_0x0fa7('0x19')](_0x322d71);}catch(_0x34f7df){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')](_0x0fa7('0x1c'),_0x322d71['device']),_0x34f7df);}});ami['on'](_0x0fa7('0x1d'),function(_0x246632){try{utils['debug'](util[_0x0fa7('0x1b')]('[%s][index][agentcalled]',_0x246632[_0x0fa7('0x1e')]),_0x246632);agents['agentcalled'](_0x246632);}catch(_0x4ea813){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')]('[%s][index][agentcalled]',_0x246632[_0x0fa7('0x1e')]),_0x4ea813);}});ami['on'](_0x0fa7('0x1f'),function(_0x4a910a){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')]('[%s][index][agentringnoanswer]',_0x4a910a['uniqueid']),_0x4a910a);agents[_0x0fa7('0x1f')](_0x4a910a);}catch(_0x2cc0db){utils[_0x0fa7('0x17')](util['format']('[%s][index][agentringnoanswer]',_0x4a910a[_0x0fa7('0x1e')]),_0x2cc0db);}});ami['on'](_0x0fa7('0x20'),function(_0x29693e){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x21'),_0x29693e['uniqueid']),_0x29693e);agents[_0x0fa7('0x20')](_0x29693e);queues[_0x0fa7('0x20')](_0x29693e);}catch(_0x3757c6){utils['error'](util[_0x0fa7('0x1b')](_0x0fa7('0x21'),_0x29693e['uniqueid']),_0x3757c6);}});ami['on'](_0x0fa7('0x22'),function(_0x5d3938){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x23'),_0x5d3938[_0x0fa7('0x1e')]),_0x5d3938);agents['agentcomplete'](_0x5d3938);queues[_0x0fa7('0x22')](_0x5d3938);members[_0x0fa7('0x22')](_0x5d3938);}catch(_0x3abc57){utils[_0x0fa7('0x17')](util['format'](_0x0fa7('0x23'),_0x5d3938[_0x0fa7('0x1e')]),_0x3abc57);}});ami['on'](_0x0fa7('0x24'),function(_0x2d8b79){try{utils['debug'](util[_0x0fa7('0x1b')]('[%s][index][queuecallerabandon]',_0x2d8b79[_0x0fa7('0x1e')]),_0x2d8b79);agents[_0x0fa7('0x24')](_0x2d8b79);queues[_0x0fa7('0x24')](_0x2d8b79);}catch(_0x28e0a9){utils[_0x0fa7('0x17')](util['format'](_0x0fa7('0x25'),_0x2d8b79[_0x0fa7('0x1e')]),_0x28e0a9);}});ami['on']('queuecallerjoin',function(_0x2cb541){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x26'),_0x2cb541[_0x0fa7('0x1e')]),_0x2cb541);queues['queuecallerjoin'](_0x2cb541);recordings['queuecallerjoin'](_0x2cb541);}catch(_0x5839c0){utils['error'](util[_0x0fa7('0x1b')](_0x0fa7('0x26'),_0x2cb541[_0x0fa7('0x1e')]),_0x5839c0);}});ami['on'](_0x0fa7('0x27'),function(_0x1f2aa2){try{utils[_0x0fa7('0x1a')](util['format'](_0x0fa7('0x28'),_0x1f2aa2[_0x0fa7('0x1e')]),_0x1f2aa2);queues[_0x0fa7('0x27')](_0x1f2aa2);}catch(_0x40e690){utils['error'](util[_0x0fa7('0x1b')]('[%s][index][queuecallerleave]',_0x1f2aa2[_0x0fa7('0x1e')]),_0x40e690);}});ami['on'](_0x0fa7('0x29'),function(_0x54ecf4){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x2a'),_0x54ecf4[_0x0fa7('0x1e')]),_0x54ecf4);queues[_0x0fa7('0x29')](_0x54ecf4);calls[_0x0fa7('0x29')](_0x54ecf4);}catch(_0x4a61f8){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')](_0x0fa7('0x2a'),_0x54ecf4[_0x0fa7('0x1e')]),_0x4a61f8);}});ami['on'](_0x0fa7('0x2b'),function(_0x371e97){try{utils[_0x0fa7('0x1a')](util['format'](_0x0fa7('0x2c'),_0x371e97[_0x0fa7('0x1e')]),_0x371e97);queues[_0x0fa7('0x2b')](_0x371e97);calls['musiconholdstop'](_0x371e97);}catch(_0x485984){utils['error'](util[_0x0fa7('0x1b')](_0x0fa7('0x2c'),_0x371e97[_0x0fa7('0x1e')]),_0x485984);}});ami['on']('newstate',function(_0x3aad6d){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x2d'),_0x3aad6d[_0x0fa7('0x1e')]),_0x3aad6d);calls[_0x0fa7('0x2e')](_0x3aad6d);recordings[_0x0fa7('0x2e')](_0x3aad6d);}catch(_0x2fdb67){utils['error'](util['format'](_0x0fa7('0x2d'),_0x3aad6d[_0x0fa7('0x1e')]),_0x2fdb67);}});ami['on'](_0x0fa7('0x2f'),function(_0x234347){try{utils['debug'](util[_0x0fa7('0x1b')]('[%s][index][hangup]',_0x234347['uniqueid']),_0x234347);calls[_0x0fa7('0x2f')](_0x234347);recordings[_0x0fa7('0x2f')](_0x234347);dials[_0x0fa7('0x2f')](_0x234347);agents[_0x0fa7('0x2f')](_0x234347);queues['hangup'](_0x234347);}catch(_0x42c7d7){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')]('[%s][index][hangup]',_0x234347['uniqueid']),_0x42c7d7);}});ami['on'](_0x0fa7('0x30'),function(_0x256c0b){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')]('[%s][index][cdr]',_0x256c0b[_0x0fa7('0x1e')]),_0x256c0b);members[_0x0fa7('0x30')](_0x256c0b);}catch(_0x3c3aed){utils[_0x0fa7('0x17')](util['format'](_0x0fa7('0x31'),_0x256c0b[_0x0fa7('0x1e')]),_0x3c3aed);}});ami['on'](_0x0fa7('0x32'),function(_0x407452){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')]('[%s][index][blindtransfer]',_0x407452[_0x0fa7('0x1e')]),_0x407452);queues[_0x0fa7('0x32')](_0x407452);agents[_0x0fa7('0x32')](_0x407452);transfers[_0x0fa7('0x32')](_0x407452);recordings[_0x0fa7('0x32')](_0x407452);}catch(_0x3d0a38){utils['error'](util[_0x0fa7('0x1b')](_0x0fa7('0x33'),_0x407452[_0x0fa7('0x1e')]),_0x3d0a38);}});ami['on']('attendedtransfer',function(_0x5083fa){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x34'),_0x5083fa['origtransfereruniqueid']),_0x5083fa);queues[_0x0fa7('0x35')](_0x5083fa);transfers[_0x0fa7('0x35')](_0x5083fa);agents['attendedtransfer'](_0x5083fa);calls[_0x0fa7('0x35')](_0x5083fa);}catch(_0x46ed56){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')](_0x0fa7('0x34'),_0x5083fa[_0x0fa7('0x36')]),_0x46ed56);}});ami['on'](_0x0fa7('0x37'),function(_0x4d1578){try{utils['debug'](util[_0x0fa7('0x1b')](_0x0fa7('0x38'),_0x4d1578[_0x0fa7('0x1e')]),_0x4d1578);queues[_0x0fa7('0x37')](_0x4d1578);recordings['varset'](_0x4d1578);calls[_0x0fa7('0x37')](_0x4d1578);dials[_0x0fa7('0x37')](_0x4d1578);}catch(_0x294850){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')](_0x0fa7('0x38'),_0x4d1578[_0x0fa7('0x1e')]),_0x294850);}});ami['on']('newexten',function(_0x15fdb5){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x39'),_0x15fdb5['uniqueid']),_0x15fdb5);calls['newexten'](_0x15fdb5);recordings[_0x0fa7('0x3a')](_0x15fdb5);dials['newexten'](_0x15fdb5);}catch(_0x4f1563){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')]('[%s][index][newexten]',_0x15fdb5[_0x0fa7('0x1e')]),_0x4f1563);}});ami['on'](_0x0fa7('0x3b'),function(_0xed1ef0){try{utils['debug'](util[_0x0fa7('0x1b')](_0x0fa7('0x3c'),_0xed1ef0[_0x0fa7('0x1e')]),_0xed1ef0);calls[_0x0fa7('0x3b')](_0xed1ef0);recordings[_0x0fa7('0x3b')](_0xed1ef0);}catch(_0x4d86ce){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')](_0x0fa7('0x3c'),_0xed1ef0['uniqueid']),_0x4d86ce);}});ami['on'](_0x0fa7('0x3d'),function(_0x5024db){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x3e'),_0x5024db[_0x0fa7('0x1e')]),_0x5024db);dials[_0x0fa7('0x3d')](_0x5024db);}catch(_0x5ea7ef){utils[_0x0fa7('0x17')](util[_0x0fa7('0x1b')]('[%s]dialbegin',_0x5024db[_0x0fa7('0x1e')]),_0x5ea7ef);}});ami['on'](_0x0fa7('0x3f'),function(_0x5134eb){try{utils[_0x0fa7('0x1a')](util[_0x0fa7('0x1b')](_0x0fa7('0x40'),_0x5134eb['uniqueid']),_0x5134eb);dials['dialend'](_0x5134eb);}catch(_0x339a92){utils['error'](util['format'](_0x0fa7('0x40'),_0x5134eb[_0x0fa7('0x1e')]),_0x339a92);}});} \ No newline at end of file +var _0x4c2a=['debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent'];(function(_0xd9adcd,_0x4c8dcd){var _0x5232a1=function(_0x4b0661){while(--_0x4b0661){_0xd9adcd['push'](_0xd9adcd['shift']());}};_0x5232a1(++_0x4c8dcd);}(_0x4c2a,0x1c9));var _0xa4c2=function(_0x4bf0de,_0x5d04c0){_0x4bf0de=_0x4bf0de-0x0;var _0xb77cf9=_0x4c2a[_0x4bf0de];return _0xb77cf9;};var AsteriskManager=require(_0xa4c2('0x0'));var config=require(_0xa4c2('0x1'));var utils=require(_0xa4c2('0x2'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0xa4c2('0x3')][_0xa4c2('0x4')]?!config['xdr'][_0xa4c2('0x4')]:!![];var isProduction=config[_0xa4c2('0x5')]===_0xa4c2('0x6')||![];var isLocalAsterisk=config[_0xa4c2('0x3')]&&config[_0xa4c2('0x3')][_0xa4c2('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xa4c2('0x8')][_0xa4c2('0x9')],config['asterisk']['ip'],config[_0xa4c2('0x8')][_0xa4c2('0xa')],config[_0xa4c2('0x8')][_0xa4c2('0xb')],!![]);ami[_0xa4c2('0xc')]();if(!isXDREnabled){utils['info'](_0xa4c2('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xa4c2('0xe'));}else{var agents=require(_0xa4c2('0xf'));var calls=require(_0xa4c2('0x10'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xa4c2('0x11'));var dials=require('./dials.controller');var transfers=require(_0xa4c2('0x12'));var core=require(_0xa4c2('0x13'));ami['on'](_0xa4c2('0x14'),core[_0xa4c2('0x14')]);ami['on'](_0xa4c2('0x15'),core[_0xa4c2('0x15')]);ami['on'](_0xa4c2('0x16'),core[_0xa4c2('0x16')]);ami['on'](_0xa4c2('0x17'),core[_0xa4c2('0x17')]);ami['on'](_0xa4c2('0x18'),core['close']);ami['on'](_0xa4c2('0x19'),core[_0xa4c2('0x19')]);ami['on']('devicestatechange',function(_0x5134ea){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x1b'),_0x5134ea[_0xa4c2('0x1c')]),_0x5134ea);members[_0xa4c2('0x1d')](_0x5134ea);}catch(_0x4a3029){utils['error'](util[_0xa4c2('0x1e')](_0xa4c2('0x1b'),_0x5134ea['device']),_0x4a3029);}});ami['on'](_0xa4c2('0x1f'),function(_0xe32c94){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x20'),_0xe32c94[_0xa4c2('0x21')]),_0xe32c94);agents[_0xa4c2('0x1f')](_0xe32c94);}catch(_0x4325a3){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x20'),_0xe32c94[_0xa4c2('0x21')]),_0x4325a3);}});ami['on'](_0xa4c2('0x22'),function(_0x2c5c5c){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')]('[%s][index][agentringnoanswer]',_0x2c5c5c[_0xa4c2('0x21')]),_0x2c5c5c);agents[_0xa4c2('0x22')](_0x2c5c5c);}catch(_0x233fc6){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x23'),_0x2c5c5c['uniqueid']),_0x233fc6);}});ami['on'](_0xa4c2('0x24'),function(_0x2280e4){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x25'),_0x2280e4[_0xa4c2('0x21')]),_0x2280e4);agents['agentconnect'](_0x2280e4);queues[_0xa4c2('0x24')](_0x2280e4);}catch(_0x5cc1ef){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x25'),_0x2280e4['uniqueid']),_0x5cc1ef);}});ami['on'](_0xa4c2('0x26'),function(_0x141b37){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')]('[%s][index][agentcomplete]',_0x141b37[_0xa4c2('0x21')]),_0x141b37);agents['agentcomplete'](_0x141b37);queues[_0xa4c2('0x26')](_0x141b37);members['agentcomplete'](_0x141b37);}catch(_0x71f48b){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][agentcomplete]',_0x141b37['uniqueid']),_0x71f48b);}});ami['on'](_0xa4c2('0x27'),function(_0x30f236){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x28'),_0x30f236[_0xa4c2('0x21')]),_0x30f236);agents[_0xa4c2('0x27')](_0x30f236);queues['queuecallerabandon'](_0x30f236);}catch(_0x9c0853){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s][index][queuecallerabandon]',_0x30f236['uniqueid']),_0x9c0853);}});ami['on'](_0xa4c2('0x29'),function(_0x1209df){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x2a'),_0x1209df[_0xa4c2('0x21')]),_0x1209df);queues[_0xa4c2('0x29')](_0x1209df);recordings['queuecallerjoin'](_0x1209df);}catch(_0x5aa44b){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][queuecallerjoin]',_0x1209df[_0xa4c2('0x21')]),_0x5aa44b);}});ami['on'](_0xa4c2('0x2b'),function(_0x2e26a5){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x2c'),_0x2e26a5[_0xa4c2('0x21')]),_0x2e26a5);queues[_0xa4c2('0x2b')](_0x2e26a5);}catch(_0x5984f1){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s][index][queuecallerleave]',_0x2e26a5['uniqueid']),_0x5984f1);}});ami['on'](_0xa4c2('0x2d'),function(_0x48251e){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x2e'),_0x48251e[_0xa4c2('0x21')]),_0x48251e);queues[_0xa4c2('0x2d')](_0x48251e);calls[_0xa4c2('0x2d')](_0x48251e);}catch(_0x2a6bac){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x2e'),_0x48251e['uniqueid']),_0x2a6bac);}});ami['on'](_0xa4c2('0x2f'),function(_0x135257){try{utils['debug'](util[_0xa4c2('0x1e')]('[%s][index][musiconholdstop]',_0x135257[_0xa4c2('0x21')]),_0x135257);queues['musiconholdstop'](_0x135257);calls['musiconholdstop'](_0x135257);}catch(_0x1ea0b6){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][musiconholdstop]',_0x135257[_0xa4c2('0x21')]),_0x1ea0b6);}});ami['on'](_0xa4c2('0x30'),function(_0x41b5bf){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x31'),_0x41b5bf['uniqueid']),_0x41b5bf);calls[_0xa4c2('0x30')](_0x41b5bf);recordings[_0xa4c2('0x30')](_0x41b5bf);}catch(_0x2d4674){utils[_0xa4c2('0x17')](util['format'](_0xa4c2('0x31'),_0x41b5bf[_0xa4c2('0x21')]),_0x2d4674);}});ami['on'](_0xa4c2('0x32'),function(_0x45164a){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x33'),_0x45164a[_0xa4c2('0x21')]),_0x45164a);calls['hangup'](_0x45164a);recordings[_0xa4c2('0x32')](_0x45164a);dials[_0xa4c2('0x32')](_0x45164a);agents['hangup'](_0x45164a);queues[_0xa4c2('0x32')](_0x45164a);}catch(_0x215f41){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x33'),_0x45164a['uniqueid']),_0x215f41);}});ami['on']('cdr',function(_0x4b811a){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x34'),_0x4b811a[_0xa4c2('0x21')]),_0x4b811a);members[_0xa4c2('0x35')](_0x4b811a);}catch(_0x20a55e){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x34'),_0x4b811a[_0xa4c2('0x21')]),_0x20a55e);}});ami['on'](_0xa4c2('0x36'),function(_0x5a29ac){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x37'),_0x5a29ac[_0xa4c2('0x21')]),_0x5a29ac);queues[_0xa4c2('0x36')](_0x5a29ac);agents[_0xa4c2('0x36')](_0x5a29ac);transfers[_0xa4c2('0x36')](_0x5a29ac);recordings[_0xa4c2('0x36')](_0x5a29ac);}catch(_0x3f8079){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x37'),_0x5a29ac[_0xa4c2('0x21')]),_0x3f8079);}});ami['on'](_0xa4c2('0x38'),function(_0x29aa31){try{utils['debug'](util[_0xa4c2('0x1e')]('[%s][index][attendedtransfer]',_0x29aa31[_0xa4c2('0x39')]),_0x29aa31);queues[_0xa4c2('0x38')](_0x29aa31);transfers[_0xa4c2('0x38')](_0x29aa31);agents[_0xa4c2('0x38')](_0x29aa31);calls[_0xa4c2('0x38')](_0x29aa31);}catch(_0x32210d){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x3a'),_0x29aa31[_0xa4c2('0x39')]),_0x32210d);}});ami['on'](_0xa4c2('0x3b'),function(_0x525279){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x3c'),_0x525279[_0xa4c2('0x21')]),_0x525279);queues['varset'](_0x525279);recordings['varset'](_0x525279);calls['varset'](_0x525279);dials[_0xa4c2('0x3b')](_0x525279);}catch(_0x333569){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x3c'),_0x525279[_0xa4c2('0x21')]),_0x333569);}});ami['on']('newexten',function(_0x2b29e0){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x3d'),_0x2b29e0[_0xa4c2('0x21')]),_0x2b29e0);calls[_0xa4c2('0x3e')](_0x2b29e0);recordings['newexten'](_0x2b29e0);dials[_0xa4c2('0x3e')](_0x2b29e0);}catch(_0x571493){utils['error'](util['format'](_0xa4c2('0x3d'),_0x2b29e0[_0xa4c2('0x21')]),_0x571493);}});ami['on'](_0xa4c2('0x3f'),function(_0x1b8fab){try{utils[_0xa4c2('0x1a')](util['format']('[%s][index][newchannel]',_0x1b8fab[_0xa4c2('0x21')]),_0x1b8fab);calls[_0xa4c2('0x3f')](_0x1b8fab);recordings['newchannel'](_0x1b8fab);}catch(_0x589191){utils['error'](util[_0xa4c2('0x1e')](_0xa4c2('0x40'),_0x1b8fab[_0xa4c2('0x21')]),_0x589191);}});ami['on'](_0xa4c2('0x41'),function(_0x2bdda6){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x42'),_0x2bdda6[_0xa4c2('0x21')]),_0x2bdda6);dials[_0xa4c2('0x41')](_0x2bdda6);}catch(_0x3c09b9){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s]dialbegin',_0x2bdda6[_0xa4c2('0x21')]),_0x3c09b9);}});ami['on'](_0xa4c2('0x43'),function(_0x1d7c0a){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x44'),_0x1d7c0a['uniqueid']),_0x1d7c0a);dials[_0xa4c2('0x43')](_0x1d7c0a);}catch(_0x563605){utils['error'](util['format'](_0xa4c2('0x44'),_0x1d7c0a[_0xa4c2('0x21')]),_0x563605);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 0d7e252..b089b91 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 _0xa7d7=['exitAt','now','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','interface','data2','membername','type','getUserByInterface','then','internal','CreateMemberReport','getUserByName','split','name','catch','error','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','INUSE','BUSY','voice','TALKING','isNil'];(function(_0x10219b,_0x561b71){var _0x313825=function(_0x229957){while(--_0x229957){_0x10219b['push'](_0x10219b['shift']());}};_0x313825(++_0x561b71);}(_0xa7d7,0x179));var _0x7a7d=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xa7d7[_0x308213];return _0x2e1619;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var utils=require(_0x7a7d('0x2'));var members={};var exclude=[_0x7a7d('0x3'),_0x7a7d('0x4')];function writeDB(_0x4a7661){utils[_0x7a7d('0x5')](util[_0x7a7d('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x4a7661['uniqueid'],_0x4a7661[_0x7a7d('0x7')],_0x4a7661['channel'],_0x4a7661[_0x7a7d('0x8')],_0x4a7661[_0x7a7d('0x9')],_0x4a7661[_0x7a7d('0xa')]));if(_0x4a7661[_0x7a7d('0x7')]){utils[_0x7a7d('0xb')](_0x4a7661[_0x7a7d('0x7')])[_0x7a7d('0xc')](function(_0x3d9480){if(_0x3d9480){_0x4a7661[_0x7a7d('0x9')]=_0x3d9480['name'];_0x4a7661['internal']=_0x3d9480[_0x7a7d('0xd')];utils['request'](_0x7a7d('0xe'),_0x4a7661);}else{utils[_0x7a7d('0xf')](_0x4a7661[_0x7a7d('0x7')][_0x7a7d('0x10')]('/')[0x1])[_0x7a7d('0xc')](function(_0xa8ee3c){if(_0xa8ee3c){_0x4a7661[_0x7a7d('0x9')]=_0xa8ee3c[_0x7a7d('0x11')];_0x4a7661[_0x7a7d('0xd')]=_0xa8ee3c[_0x7a7d('0xd')];utils['request']('CreateMemberReport',_0x4a7661);}});}})[_0x7a7d('0x12')](function(_0x510f02){utils[_0x7a7d('0x13')](util['format']('[%s][members][writeDB]',_0x4a7661[_0x7a7d('0x14')]),_0x510f02);});}delete members[_0x4a7661['interface']];}function startsWith(_0x15e142,_0x1c7c14){return _[_0x7a7d('0x15')](_0x15e142,function(_0x4a1d1e){return _[_0x7a7d('0x16')](_0x1c7c14,_0x4a1d1e);});}exports[_0x7a7d('0x17')]=function(_0x3f9462){try{utils['debug'](util['format'](_0x7a7d('0x18'),members[_0x3f9462['device']]?members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x14')]:_0x3f9462['device']),_0x3f9462);utils[_0x7a7d('0x5')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3f9462[_0x7a7d('0x19')]]?members[_0x3f9462['device']][_0x7a7d('0x14')]:_0x3f9462['device'],_0x3f9462['state'],_0x3f9462['device']));switch(_0x3f9462['state']){case _0x7a7d('0x1a'):case _0x7a7d('0x1b'):if(!startsWith(exclude,_0x3f9462[_0x7a7d('0x19')])){members[_0x3f9462[_0x7a7d('0x19')]]={'channel':_0x7a7d('0x1c'),'interface':_0x3f9462[_0x7a7d('0x19')],'type':_0x7a7d('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x7a7d('0x1e')](members[_0x3f9462[_0x7a7d('0x19')]])){members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x1f')]=utils[_0x7a7d('0x20')]();members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x21')]=utils[_0x7a7d('0x22')](members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x1f')],members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x23')]);if(members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x14')]){writeDB(members[_0x3f9462[_0x7a7d('0x19')]]);}}break;default:break;}}catch(_0xbc9166){utils[_0x7a7d('0x13')](util['format'](_0x7a7d('0x18'),members[_0x3f9462[_0x7a7d('0x19')]]?members[_0x3f9462[_0x7a7d('0x19')]][_0x7a7d('0x14')]:_0x3f9462[_0x7a7d('0x19')]),_0xbc9166);}};exports[_0x7a7d('0x24')]=function(_0x26762a){try{if(!_[_0x7a7d('0x1e')](members[_0x26762a['interface']])){utils[_0x7a7d('0x25')](util[_0x7a7d('0x6')](_0x7a7d('0x26'),_0x26762a['uniqueid']),_0x26762a);utils['info'](util[_0x7a7d('0x6')](_0x7a7d('0x27'),_0x26762a[_0x7a7d('0x14')],_0x26762a[_0x7a7d('0x7')],_0x26762a[_0x7a7d('0x28')]));members[_0x26762a[_0x7a7d('0x7')]]=_[_0x7a7d('0x29')](members[_0x26762a[_0x7a7d('0x7')]],{'data4':_0x26762a['queue'],'uniqueid':_0x26762a[_0x7a7d('0x14')]});}}catch(_0x3fe698){utils['error'](util[_0x7a7d('0x6')]('[%s][members][agentcomplete]',_0x26762a[_0x7a7d('0x14')]),_0x3fe698);}};exports[_0x7a7d('0x2a')]=function(_0x128464){try{utils[_0x7a7d('0x25')](util[_0x7a7d('0x6')]('[%s][members][cdr]',_0x128464['uniqueid']),_0x128464);if(_0x128464[_0x7a7d('0x2b')]){var _0xf45eb=_0x128464[_0x7a7d('0x2b')][_0x7a7d('0x10')]('-')[0x0];if(!_[_0x7a7d('0x1e')](members[_0xf45eb])){members[_0xf45eb]=_['assign'](members[_0xf45eb],{'data1':members[_0xf45eb][_0x7a7d('0x2c')]||_0x128464[_0x7a7d('0xa')],'data2':members[_0xf45eb][_0x7a7d('0x8')]||_0x128464[_0x7a7d('0x2d')],'data3':members[_0xf45eb][_0x7a7d('0x2e')]||_0x128464[_0x7a7d('0x2f')],'uniqueid':members[_0xf45eb]['uniqueid']||_0x128464[_0x7a7d('0x14')]});utils[_0x7a7d('0x5')](util[_0x7a7d('0x6')](_0x7a7d('0x30'),_0x128464['uniqueid'],members[_0xf45eb][_0x7a7d('0x2c')],members[_0xf45eb][_0x7a7d('0x8')],members[_0xf45eb][_0x7a7d('0x2e')]));if(members[_0xf45eb][_0x7a7d('0x1f')]){writeDB(members[_0xf45eb]);}}}if(_0x128464['destinationchannel']){var _0xda4830=_0x128464[_0x7a7d('0x31')][_0x7a7d('0x10')]('-')[0x0];if(!_[_0x7a7d('0x1e')](members[_0xda4830])){members[_0xda4830]=_[_0x7a7d('0x29')](members[_0xda4830],{'data1':members[_0xda4830][_0x7a7d('0x2c')]||_0x128464[_0x7a7d('0xa')],'data2':members[_0xda4830][_0x7a7d('0x8')]||_0x128464[_0x7a7d('0x2d')],'data3':members[_0xda4830][_0x7a7d('0x2e')]||_0x128464[_0x7a7d('0x2f')],'uniqueid':members[_0xda4830][_0x7a7d('0x14')]||_0x128464[_0x7a7d('0x14')]});utils[_0x7a7d('0x5')](util['format'](_0x7a7d('0x30'),_0x128464[_0x7a7d('0x14')],members[_0xda4830][_0x7a7d('0x2c')],members[_0xda4830][_0x7a7d('0x8')],members[_0xda4830][_0x7a7d('0x2e')]));if(members[_0xda4830]['exitAt']){writeDB(members[_0xda4830]);}}}}catch(_0x56d3c8){utils[_0x7a7d('0x13')](util[_0x7a7d('0x6')](_0x7a7d('0x32'),_0x128464[_0x7a7d('0x14')]),_0x56d3c8);}}; \ No newline at end of file +var _0xa1a2=['[%s][members][devicestatechange]','device','state','INUSE','now','agent','isNil','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','source','data3','exitAt','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','name','catch','error','[%s][members][writeDB]','startsWith','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1a2,0x76));var _0x2a1a=function(_0x2d6dff,_0x1e5f34){_0x2d6dff=_0x2d6dff-0x0;var _0x4fb5a9=_0xa1a2[_0x2d6dff];return _0x4fb5a9;};'use strict';var _=require(_0x2a1a('0x0'));var util=require(_0x2a1a('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x2a1a('0x2')];function writeDB(_0x2149ed){utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')](_0x2a1a('0x5'),_0x2149ed[_0x2a1a('0x6')],_0x2149ed[_0x2a1a('0x7')],_0x2149ed[_0x2a1a('0x8')],_0x2149ed[_0x2a1a('0x9')],_0x2149ed[_0x2a1a('0xa')],_0x2149ed[_0x2a1a('0xb')]));if(_0x2149ed[_0x2a1a('0x7')]){utils[_0x2a1a('0xc')](_0x2149ed['interface'])[_0x2a1a('0xd')](function(_0x485725){if(_0x485725){_0x2149ed[_0x2a1a('0xa')]=_0x485725['name'];_0x2149ed[_0x2a1a('0xe')]=_0x485725[_0x2a1a('0xe')];utils[_0x2a1a('0xf')]('CreateMemberReport',_0x2149ed);}else{utils[_0x2a1a('0x10')](_0x2149ed[_0x2a1a('0x7')]['split']('/')[0x1])[_0x2a1a('0xd')](function(_0x1fd772){if(_0x1fd772){_0x2149ed['membername']=_0x1fd772[_0x2a1a('0x11')];_0x2149ed[_0x2a1a('0xe')]=_0x1fd772['internal'];utils[_0x2a1a('0xf')]('CreateMemberReport',_0x2149ed);}});}})[_0x2a1a('0x12')](function(_0x50560c){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')](_0x2a1a('0x14'),_0x2149ed[_0x2a1a('0x6')]),_0x50560c);});}delete members[_0x2149ed[_0x2a1a('0x7')]];}function startsWith(_0x28fd00,_0x27f019){return _['some'](_0x28fd00,function(_0x2d3ade){return _[_0x2a1a('0x15')](_0x27f019,_0x2d3ade);});}exports['devicestatechange']=function(_0x33c00e){try{utils[_0x2a1a('0x16')](util[_0x2a1a('0x4')](_0x2a1a('0x17'),members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]][_0x2a1a('0x6')]:_0x33c00e[_0x2a1a('0x18')]),_0x33c00e);utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]][_0x2a1a('0x6')]:_0x33c00e[_0x2a1a('0x18')],_0x33c00e[_0x2a1a('0x19')],_0x33c00e['device']));switch(_0x33c00e[_0x2a1a('0x19')]){case _0x2a1a('0x1a'):case'BUSY':if(!startsWith(exclude,_0x33c00e[_0x2a1a('0x18')])){members[_0x33c00e[_0x2a1a('0x18')]]={'channel':'voice','interface':_0x33c00e[_0x2a1a('0x18')],'type':'TALKING','enterAt':utils[_0x2a1a('0x1b')](),'role':_0x2a1a('0x1c')};}break;case'NOT_INUSE':if(!_[_0x2a1a('0x1d')](members[_0x33c00e[_0x2a1a('0x18')]])){members[_0x33c00e[_0x2a1a('0x18')]]['exitAt']=utils[_0x2a1a('0x1b')]();members[_0x33c00e['device']][_0x2a1a('0x1e')]=utils[_0x2a1a('0x1f')](members[_0x33c00e[_0x2a1a('0x18')]]['exitAt'],members[_0x33c00e['device']]['enterAt']);if(members[_0x33c00e[_0x2a1a('0x18')]]['uniqueid']){writeDB(members[_0x33c00e[_0x2a1a('0x18')]]);}}break;default:break;}}catch(_0x18c908){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')]('[%s][members][devicestatechange]',members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]]['uniqueid']:_0x33c00e['device']),_0x18c908);}};exports[_0x2a1a('0x20')]=function(_0x290292){try{if(!_['isNil'](members[_0x290292['interface']])){utils[_0x2a1a('0x16')](util[_0x2a1a('0x4')](_0x2a1a('0x21'),_0x290292[_0x2a1a('0x6')]),_0x290292);utils[_0x2a1a('0x3')](util['format'](_0x2a1a('0x22'),_0x290292['uniqueid'],_0x290292[_0x2a1a('0x7')],_0x290292[_0x2a1a('0x23')]));members[_0x290292['interface']]=_['assign'](members[_0x290292[_0x2a1a('0x7')]],{'data4':_0x290292['queue'],'uniqueid':_0x290292[_0x2a1a('0x6')]});}}catch(_0x49f7d5){utils['error'](util[_0x2a1a('0x4')](_0x2a1a('0x21'),_0x290292[_0x2a1a('0x6')]),_0x49f7d5);}};exports[_0x2a1a('0x24')]=function(_0x1cdffa){try{utils[_0x2a1a('0x16')](util['format'](_0x2a1a('0x25'),_0x1cdffa[_0x2a1a('0x6')]),_0x1cdffa);if(_0x1cdffa[_0x2a1a('0x8')]){var _0x24a0d6=_0x1cdffa['channel'][_0x2a1a('0x26')]('-')[0x0];if(!_['isNil'](members[_0x24a0d6])){members[_0x24a0d6]=_[_0x2a1a('0x27')](members[_0x24a0d6],{'data1':members[_0x24a0d6][_0x2a1a('0x28')]||_0x1cdffa['type'],'data2':members[_0x24a0d6][_0x2a1a('0x9')]||_0x1cdffa[_0x2a1a('0x29')],'data3':members[_0x24a0d6][_0x2a1a('0x2a')]||_0x1cdffa['destination'],'uniqueid':members[_0x24a0d6][_0x2a1a('0x6')]||_0x1cdffa[_0x2a1a('0x6')]});utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1cdffa['uniqueid'],members[_0x24a0d6]['data1'],members[_0x24a0d6][_0x2a1a('0x9')],members[_0x24a0d6][_0x2a1a('0x2a')]));if(members[_0x24a0d6][_0x2a1a('0x2b')]){writeDB(members[_0x24a0d6]);}}}if(_0x1cdffa[_0x2a1a('0x2c')]){var _0x1df829=_0x1cdffa[_0x2a1a('0x2c')]['split']('-')[0x0];if(!_['isNil'](members[_0x1df829])){members[_0x1df829]=_[_0x2a1a('0x27')](members[_0x1df829],{'data1':members[_0x1df829][_0x2a1a('0x28')]||_0x1cdffa[_0x2a1a('0xb')],'data2':members[_0x1df829][_0x2a1a('0x9')]||_0x1cdffa[_0x2a1a('0x29')],'data3':members[_0x1df829][_0x2a1a('0x2a')]||_0x1cdffa[_0x2a1a('0x2d')],'uniqueid':members[_0x1df829]['uniqueid']||_0x1cdffa[_0x2a1a('0x6')]});utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')](_0x2a1a('0x2e'),_0x1cdffa['uniqueid'],members[_0x1df829][_0x2a1a('0x28')],members[_0x1df829]['data2'],members[_0x1df829]['data3']));if(members[_0x1df829][_0x2a1a('0x2b')]){writeDB(members[_0x1df829]);}}}}catch(_0x3af3ba){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')]('[%s][members][cdr]',_0x1cdffa[_0x2a1a('0x6')]),_0x3af3ba);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2a6d723..f43b4f5 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 _0x73e1=['[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','[%s][queues][queuecallerjoin]','hangup','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfer','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x73e1,0x7a));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x173e('0x0'));var util=require(_0x173e('0x1'));var utils=require(_0x173e('0x2'));var queues={};function writeDB(_0x35491a){utils['info'](util[_0x173e('0x3')](_0x173e('0x4'),_0x35491a[_0x173e('0x5')],_0x35491a['channel'],_0x35491a['queue'],_0x35491a[_0x173e('0x6')],_0x35491a[_0x173e('0x7')],_0x35491a[_0x173e('0x8')],_0x35491a[_0x173e('0x9')]));if(_0x35491a[_0x173e('0xa')]){utils[_0x173e('0xb')](_0x35491a[_0x173e('0xa')])[_0x173e('0xc')](function(_0x3ba532){if(_0x3ba532){_0x35491a[_0x173e('0xd')]=_0x3ba532[_0x173e('0xd')];}utils[_0x173e('0xe')](_0x173e('0xf'),_0x35491a);});}else{utils[_0x173e('0xe')]('CreateVoiceQueueReport',_0x35491a);}if(_0x35491a[_0x173e('0x10')]){delete queues[_0x35491a[_0x173e('0x10')]];}else{delete queues[_0x35491a[_0x173e('0x5')]];}}exports[_0x173e('0x11')]=function(_0x4ca35f){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x4ca35f[_0x173e('0x5')]),_0x4ca35f);utils['info'](util[_0x173e('0x3')](_0x173e('0x12'),_0x4ca35f[_0x173e('0x5')],_0x4ca35f[_0x173e('0xa')],_0x4ca35f['position']));queues[_0x4ca35f[_0x173e('0x5')]]=_[_0x173e('0x13')](_0x4ca35f,{'originalposition':_0x4ca35f['position'],'queuecallerjoinAt':utils[_0x173e('0x14')](),'mohtime':0x0});}catch(_0x4b01e0){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x16'),_0x4ca35f[_0x173e('0x5')]),_0x4b01e0);}};exports[_0x173e('0x17')]=function(_0x44187b){try{if(!_['isNil'](queues[_0x44187b[_0x173e('0x5')]])){utils[_0x173e('0x18')](util[_0x173e('0x3')]('[%s][queues][hangup]',_0x44187b[_0x173e('0x5')]),_0x44187b);if(queues[_0x44187b['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x19')]&&!queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x1a')]){queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x1b')]=!![];queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x1c')]=utils[_0x173e('0x14')]();queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x9')]=_0x173e('0x1d');}utils['info'](util[_0x173e('0x3')](_0x173e('0x1e'),_0x44187b[_0x173e('0x5')],queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x1f')],queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x9')]));writeDB(queues[_0x44187b[_0x173e('0x5')]]);}else if(queues[_0x44187b[_0x173e('0x5')]]['transfereduniqueid']){utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x21'),_0x44187b[_0x173e('0x5')],queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x1f')],queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x10')]));queues[queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x10')]]=queues[_0x44187b['uniqueid']];queues[queues[_0x44187b[_0x173e('0x5')]][_0x173e('0x10')]][_0x173e('0x22')]=0x2;delete queues[_0x44187b['uniqueid']];}}}catch(_0x425197){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x23'),_0x44187b[_0x173e('0x5')]),_0x425197);}};exports[_0x173e('0x24')]=function(_0x3c3569){try{utils['debug'](util[_0x173e('0x3')]('[%s][queues][varset]',_0x3c3569[_0x173e('0x5')]),_0x3c3569);if(!_[_0x173e('0x25')](_0x3c3569[_0x173e('0x26')][_0x173e('0x27')])&&_0x3c3569[_0x173e('0x28')][_0x173e('0x29')]()!==_0x173e('0x2a')){if(!_[_0x173e('0x25')](queues[_0x3c3569[_0x173e('0x5')]])){queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x19')]=![];queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x2b')]=null;queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x1a')]=!![];queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x2c')]=utils[_0x173e('0x14')]();queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x9')]=_0x3c3569[_0x173e('0x28')][_0x173e('0x29')]();utils[_0x173e('0x20')](util[_0x173e('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3c3569[_0x173e('0x5')],queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x1f')],_0x3c3569[_0x173e('0x28')],queues[_0x3c3569['uniqueid']][_0x173e('0x9')]));writeDB(queues[_0x3c3569[_0x173e('0x5')]]);}}else if(!_[_0x173e('0x25')](_0x3c3569[_0x173e('0x26')]['queueposition'])){if(!_[_0x173e('0x25')](queues[_0x3c3569['uniqueid']])&&!queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x19')]){queues[_0x3c3569[_0x173e('0x5')]]['queuecallerabandon']=![];queues[_0x3c3569[_0x173e('0x5')]]['queuecallerabandonAt']=null;queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x1a')]=!![];queues[_0x3c3569['uniqueid']][_0x173e('0x2c')]=utils[_0x173e('0x14')]();queues[_0x3c3569[_0x173e('0x5')]]['queuecallerexitreason']=_0x173e('0x2d');utils[_0x173e('0x20')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3c3569[_0x173e('0x5')],queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x1f')],_0x3c3569[_0x173e('0x28')],queues[_0x3c3569[_0x173e('0x5')]][_0x173e('0x9')]));}}}catch(_0x168753){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x2e'),_0x3c3569['uniqueid']),_0x168753);}};exports[_0x173e('0x19')]=function(_0x5ab1f0){try{if(!_[_0x173e('0x25')](queues[_0x5ab1f0[_0x173e('0x5')]])){utils[_0x173e('0x18')](util[_0x173e('0x3')](_0x173e('0x2f'),_0x5ab1f0['uniqueid']),_0x5ab1f0);queues[_0x5ab1f0[_0x173e('0x5')]][_0x173e('0x1a')]=![];queues[_0x5ab1f0['uniqueid']][_0x173e('0x2c')]=null;queues[_0x5ab1f0['uniqueid']][_0x173e('0x19')]=!![];queues[_0x5ab1f0[_0x173e('0x5')]][_0x173e('0x2b')]=utils[_0x173e('0x14')]();queues[_0x5ab1f0[_0x173e('0x5')]]['queuecallerexitreason']='ABANDONED';utils['info'](util[_0x173e('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5ab1f0['uniqueid'],queues[_0x5ab1f0['uniqueid']][_0x173e('0x1f')],queues[_0x5ab1f0[_0x173e('0x5')]][_0x173e('0x9')]));}}catch(_0x4815a1){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x2f'),_0x5ab1f0['uniqueid']),_0x4815a1);}};exports[_0x173e('0x30')]=function(_0x17305e){try{if(!_['isNil'](queues[_0x17305e['uniqueid']])){utils[_0x173e('0x18')](util[_0x173e('0x3')](_0x173e('0x31'),_0x17305e[_0x173e('0x5')]),_0x17305e);utils[_0x173e('0x20')](util[_0x173e('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x17305e[_0x173e('0x5')],queues[_0x17305e[_0x173e('0x5')]]['name'],_0x17305e['connectedlinenum'],_0x17305e['connectedlinename']));queues[_0x17305e[_0x173e('0x5')]]['queuecallerleave']=!![];queues[_0x17305e['uniqueid']]['queuecallerleaveAt']=utils[_0x173e('0x14')]();queues[_0x17305e[_0x173e('0x5')]][_0x173e('0x32')]=utils[_0x173e('0x33')](queues[_0x17305e[_0x173e('0x5')]][_0x173e('0x34')],queues[_0x17305e[_0x173e('0x5')]][_0x173e('0x35')]);queues[_0x17305e[_0x173e('0x5')]][_0x173e('0x36')]=_0x17305e[_0x173e('0x36')];queues[_0x17305e['uniqueid']][_0x173e('0x37')]=_0x17305e['count'];queues[_0x17305e[_0x173e('0x5')]][_0x173e('0x38')]=_0x17305e[_0x173e('0x38')];queues[_0x17305e['uniqueid']]['connectedlinename']=_0x17305e[_0x173e('0x39')];}}catch(_0x3ab691){utils['error'](util['format'](_0x173e('0x31'),_0x17305e[_0x173e('0x5')]),_0x3ab691);}};exports[_0x173e('0x3a')]=function(_0x5474d5){try{if(!_[_0x173e('0x25')](queues[_0x5474d5['uniqueid']])){utils[_0x173e('0x18')](util[_0x173e('0x3')](_0x173e('0x3b'),_0x5474d5[_0x173e('0x5')]),_0x5474d5);utils['info'](util[_0x173e('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5474d5[_0x173e('0x5')],queues[_0x5474d5['uniqueid']][_0x173e('0x1f')],_0x5474d5['membername'],_0x5474d5['destaccountcode']));queues[_0x5474d5[_0x173e('0x5')]][_0x173e('0x19')]=![];queues[_0x5474d5[_0x173e('0x5')]][_0x173e('0x19')]=![];queues[_0x5474d5[_0x173e('0x5')]][_0x173e('0x2b')]=null;queues[_0x5474d5[_0x173e('0x5')]][_0x173e('0x1a')]=![];queues[_0x5474d5[_0x173e('0x5')]][_0x173e('0x9')]=null;queues[_0x5474d5['uniqueid']]['queuecallerexitAt']=null;queues[_0x5474d5[_0x173e('0x5')]]['assigned']=!![];queues[_0x5474d5[_0x173e('0x5')]]['accountcode']=_0x5474d5[_0x173e('0x3c')];queues[_0x5474d5['uniqueid']][_0x173e('0x6')]=_0x5474d5[_0x173e('0x3d')];}}catch(_0x5ce1f7){utils[_0x173e('0x15')](util[_0x173e('0x3')]('[%s][queues][agentconnect]',_0x5474d5[_0x173e('0x5')]),_0x5ce1f7);}};exports[_0x173e('0x3e')]=function(_0x327951){try{if(!_['isNil'](queues[_0x327951['uniqueid']])){if(queues[_0x327951[_0x173e('0x5')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x173e('0x3f'),_0x327951[_0x173e('0x5')]),_0x327951);queues[_0x327951['uniqueid']]['queuecallerabandon']=![];queues[_0x327951[_0x173e('0x5')]][_0x173e('0x19')]=![];queues[_0x327951[_0x173e('0x5')]][_0x173e('0x2b')]=null;queues[_0x327951[_0x173e('0x5')]][_0x173e('0x1a')]=![];queues[_0x327951[_0x173e('0x5')]][_0x173e('0x2c')]=null;queues[_0x327951[_0x173e('0x5')]]['assigned']=!![];queues[_0x327951[_0x173e('0x5')]][_0x173e('0x6')]=_0x327951[_0x173e('0x3d')];queues[_0x327951[_0x173e('0x5')]][_0x173e('0x1b')]=!![];queues[_0x327951[_0x173e('0x5')]]['queuecallercompleteAt']=utils[_0x173e('0x14')]();if(_0x327951[_0x173e('0x40')]=='transfer'){if(!queues[_0x327951[_0x173e('0x5')]]['transfer']){queues[_0x327951[_0x173e('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x327951[_0x173e('0x5')]]['queuecallerexitreason']=_0x173e('0x41')+_0x327951[_0x173e('0x40')][_0x173e('0x29')]();}utils['info'](util[_0x173e('0x3')](_0x173e('0x42'),_0x327951['uniqueid'],queues[_0x327951['uniqueid']]['name'],_0x327951['membername'],queues[_0x327951[_0x173e('0x5')]][_0x173e('0x9')]));writeDB(queues[_0x327951['uniqueid']]);}}}catch(_0x6cce7c){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x327951[_0x173e('0x5')]),_0x6cce7c);}};exports[_0x173e('0x43')]=function(_0x415ae9){try{if(!_[_0x173e('0x25')](queues[_0x415ae9['transfereeuniqueid']])){utils[_0x173e('0x18')](util[_0x173e('0x3')]('[%s][queues][blindtransfer]',_0x415ae9[_0x173e('0x5')]),_0x415ae9);queues[_0x415ae9[_0x173e('0x44')]][_0x173e('0x45')]=!![];queues[_0x415ae9[_0x173e('0x44')]]['transfertype']=_0x173e('0x46');queues[_0x415ae9[_0x173e('0x44')]][_0x173e('0x47')]=_0x415ae9[_0x173e('0x48')];queues[_0x415ae9['transfereeuniqueid']][_0x173e('0x49')]=_0x415ae9[_0x173e('0x44')];queues[_0x415ae9['transfereeuniqueid']][_0x173e('0x9')]='BLINDTRANSFER';utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x4a'),_0x415ae9[_0x173e('0x5')],queues[_0x415ae9['transfereeuniqueid']][_0x173e('0x1f')],_0x415ae9['transfereeuniqueid'],_0x415ae9[_0x173e('0x48')]));}}catch(_0x74b6d8){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x4b'),_0x415ae9[_0x173e('0x5')]),_0x74b6d8);}};exports['attendedtransfer']=function(_0x2733b3){try{utils[_0x173e('0x18')](util['format'](_0x173e('0x4c'),_0x2733b3[_0x173e('0x4d')]),_0x2733b3);if(_0x2733b3['origtransfereruniqueid']==_0x2733b3[_0x173e('0x4e')]){if(!_['isNil'](queues[_0x2733b3[_0x173e('0x4f')]])){utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x50'),_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3[_0x173e('0x4f')]][_0x173e('0x1f')],_0x2733b3['origtransfererexten']));queues[_0x2733b3[_0x173e('0x4f')]][_0x173e('0x45')]=!![];queues[_0x2733b3[_0x173e('0x4f')]][_0x173e('0x51')]='ATTENDED';queues[_0x2733b3[_0x173e('0x4f')]]['transferexten']=_0x2733b3['origtransfererexten'];queues[_0x2733b3['secondtransfererlinkedid']][_0x173e('0x49')]=_0x2733b3[_0x173e('0x4d')];queues[_0x2733b3[_0x173e('0x4f')]][_0x173e('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x2733b3[_0x173e('0x4e')]])){if(_0x2733b3['transfereelinkedid']&&queues[_0x2733b3['transfereelinkedid']]){queues[_0x2733b3[_0x173e('0x52')]]['queuecallerenterreason']=0x1;queues[_0x2733b3['transfereeuniqueid']]=_[_0x173e('0x53')](queues[_0x2733b3[_0x173e('0x52')]]);queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x10')]=_0x2733b3[_0x173e('0x54')];queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x22')]=0x2;queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x7')]=queues[_0x2733b3[_0x173e('0x4f')]]['calleridnum'];queues[_0x2733b3['transfereeuniqueid']][_0x173e('0x55')]=queues[_0x2733b3[_0x173e('0x4f')]][_0x173e('0x55')];queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x35')]=utils[_0x173e('0x14')]();queues[_0x2733b3['transfereeuniqueid']][_0x173e('0x34')]=utils[_0x173e('0x14')]();queues[_0x2733b3['transfereeuniqueid']][_0x173e('0x32')]=0x0;queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x56')]=0x0;utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x57'),_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x1f')],queues[_0x2733b3['transfereeuniqueid']][_0x173e('0x7')],queues[_0x2733b3[_0x173e('0x44')]][_0x173e('0x55')]));}else{utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x58'),_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3['origtransfererlinkedid']][_0x173e('0x1f')],_0x2733b3[_0x173e('0x4f')]));queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x10')]=_0x2733b3[_0x173e('0x4f')];}}}else if(_0x2733b3[_0x173e('0x59')]==_0x2733b3[_0x173e('0x4f')]){if(!_['isNil'](queues[_0x2733b3['origtransfererlinkedid']])){utils[_0x173e('0x20')](util[_0x173e('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3[_0x173e('0x4e')]]['name'],_0x2733b3[_0x173e('0x59')],_0x2733b3[_0x173e('0x5a')]));queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x45')]=!![];queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x51')]=_0x173e('0x5b');queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x47')]=_0x2733b3[_0x173e('0x5a')];queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x49')]=_0x2733b3[_0x173e('0x59')];queues[_0x2733b3[_0x173e('0x4e')]]['queuecallerexitreason']=_0x173e('0x5c');}if(!_[_0x173e('0x25')](queues[_0x2733b3[_0x173e('0x4f')]])){if(_0x2733b3[_0x173e('0x5d')]&&queues[_0x2733b3[_0x173e('0x5d')]]){queues[_0x2733b3[_0x173e('0x5d')]][_0x173e('0x22')]=0x1;queues[_0x2733b3['transfertargetuniqueid']]=_[_0x173e('0x53')](queues[_0x2733b3['transfertargetlinkedid']]);queues[_0x2733b3['transfertargetuniqueid']][_0x173e('0x10')]=_0x2733b3[_0x173e('0x54')];queues[_0x2733b3[_0x173e('0x54')]]['queuecallerenterreason']=0x2;queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x7')]=queues[_0x2733b3[_0x173e('0x4e')]][_0x173e('0x7')];queues[_0x2733b3['transfertargetuniqueid']][_0x173e('0x55')]=queues[_0x2733b3[_0x173e('0x4e')]]['calleridname'];queues[_0x2733b3[_0x173e('0x54')]]['queuecallerjoinAt']=utils[_0x173e('0x14')]();queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x34')]=utils[_0x173e('0x14')]();queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x32')]=0x0;queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x56')]=0x0;utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x5e'),_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x1f')],queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x10')],queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x7')],queues[_0x2733b3[_0x173e('0x54')]][_0x173e('0x55')]));}else{utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x58'),_0x2733b3[_0x173e('0x4d')],queues[_0x2733b3[_0x173e('0x4f')]]['name'],_0x2733b3[_0x173e('0x4e')]));queues[_0x2733b3['secondtransfererlinkedid']][_0x173e('0x10')]=_0x2733b3[_0x173e('0x4e')];}}}}catch(_0x17390f){utils['error'](util[_0x173e('0x3')](_0x173e('0x4c'),_0x2733b3[_0x173e('0x4d')]),_0x17390f);}};exports[_0x173e('0x5f')]=function(_0x5922a5){try{if(!_[_0x173e('0x25')](queues[_0x5922a5[_0x173e('0x5')]])){utils[_0x173e('0x18')](util['format'](_0x173e('0x60'),_0x5922a5[_0x173e('0x5')]),_0x5922a5);queues[_0x5922a5[_0x173e('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x173e('0x20')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x5922a5[_0x173e('0x5')],queues[_0x5922a5['uniqueid']]['name'],queues[_0x5922a5['uniqueid']][_0x173e('0x61')]));}}catch(_0x4f1648){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x60'),_0x5922a5[_0x173e('0x5')]),_0x4f1648);}};exports[_0x173e('0x62')]=function(_0x2e6a42){try{if(!_[_0x173e('0x25')](queues[_0x2e6a42[_0x173e('0x5')]])){if(!_[_0x173e('0x25')](queues[_0x2e6a42[_0x173e('0x5')]][_0x173e('0x61')])){utils['debug'](util['format'](_0x173e('0x63'),_0x2e6a42['uniqueid']),_0x2e6a42);queues[_0x2e6a42[_0x173e('0x5')]]['mohtime']+=utils[_0x173e('0x33')](utils[_0x173e('0x14')](),queues[_0x2e6a42[_0x173e('0x5')]][_0x173e('0x61')]);utils[_0x173e('0x20')](util[_0x173e('0x3')](_0x173e('0x64'),_0x2e6a42['uniqueid'],queues[_0x2e6a42[_0x173e('0x5')]][_0x173e('0x1f')],queues[_0x2e6a42['uniqueid']]['mohtime']));delete queues[_0x2e6a42[_0x173e('0x5')]][_0x173e('0x61')];}}}catch(_0x56b4a3){utils[_0x173e('0x15')](util[_0x173e('0x3')](_0x173e('0x63'),_0x2e6a42[_0x173e('0x5')]),_0x56b4a3);}}; \ No newline at end of file +var _0x9aff=['isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','membername','assigned','accountcode','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup'];(function(_0x11b304,_0x13a189){var _0x2fda04=function(_0x1bf729){while(--_0x1bf729){_0x11b304['push'](_0x11b304['shift']());}};_0x2fda04(++_0x13a189);}(_0x9aff,0x1e7));var _0xf9af=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9aff[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xf9af('0x0'));var utils=require(_0xf9af('0x1'));var queues={};function writeDB(_0x3f8745){utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x4'),_0x3f8745['uniqueid'],_0x3f8745['channel'],_0x3f8745[_0xf9af('0x5')],_0x3f8745[_0xf9af('0x6')],_0x3f8745['calleridnum'],_0x3f8745['accountcode'],_0x3f8745[_0xf9af('0x7')]));if(_0x3f8745['queue']){utils[_0xf9af('0x8')](_0x3f8745[_0xf9af('0x5')])[_0xf9af('0x9')](function(_0x15f07d){if(_0x15f07d){_0x3f8745[_0xf9af('0xa')]=_0x15f07d['type'];}utils['request'](_0xf9af('0xb'),_0x3f8745);});}else{utils[_0xf9af('0xc')](_0xf9af('0xb'),_0x3f8745);}if(_0x3f8745[_0xf9af('0xd')]){delete queues[_0x3f8745['transfereduniqueid']];}else{delete queues[_0x3f8745[_0xf9af('0xe')]];}}exports[_0xf9af('0xf')]=function(_0x4a68d7){try{utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x11'),_0x4a68d7[_0xf9af('0xe')]),_0x4a68d7);utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x12'),_0x4a68d7[_0xf9af('0xe')],_0x4a68d7[_0xf9af('0x5')],_0x4a68d7[_0xf9af('0x13')]));queues[_0x4a68d7[_0xf9af('0xe')]]=_['assign'](_0x4a68d7,{'originalposition':_0x4a68d7[_0xf9af('0x13')],'queuecallerjoinAt':utils[_0xf9af('0x14')](),'mohtime':0x0});}catch(_0x430bff){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x11'),_0x4a68d7[_0xf9af('0xe')]),_0x430bff);}};exports[_0xf9af('0x16')]=function(_0x240704){try{if(!_[_0xf9af('0x17')](queues[_0x240704['uniqueid']])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x18'),_0x240704[_0xf9af('0xe')]),_0x240704);if(queues[_0x240704[_0xf9af('0xe')]]['queuecallerleaveAt']){if(!queues[_0x240704[_0xf9af('0xe')]]['queuecallerabandon']&&!queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x19')]){queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1a')]=!![];queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1b')]=utils['now']();queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x7')]=_0xf9af('0x1c');}utils[_0xf9af('0x2')](util['format'](_0xf9af('0x1d'),_0x240704[_0xf9af('0xe')],queues[_0x240704[_0xf9af('0xe')]]['name'],queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x7')]));writeDB(queues[_0x240704[_0xf9af('0xe')]]);}else if(queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0xd')]){utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x1e'),_0x240704[_0xf9af('0xe')],queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1f')],queues[_0x240704['uniqueid']][_0xf9af('0xd')]));queues[queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0xd')]]=queues[_0x240704[_0xf9af('0xe')]];queues[queues[_0x240704[_0xf9af('0xe')]]['transfereduniqueid']][_0xf9af('0x20')]=0x2;delete queues[_0x240704['uniqueid']];}}}catch(_0x54f682){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x18'),_0x240704[_0xf9af('0xe')]),_0x54f682);}};exports[_0xf9af('0x21')]=function(_0x5136f3){try{utils[_0xf9af('0x10')](util['format'](_0xf9af('0x22'),_0x5136f3[_0xf9af('0xe')]),_0x5136f3);if(!_[_0xf9af('0x17')](_0x5136f3[_0xf9af('0x23')][_0xf9af('0x24')])&&_0x5136f3['value']['toUpperCase']()!==_0xf9af('0x25')){if(!_[_0xf9af('0x17')](queues[_0x5136f3['uniqueid']])){queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x27')]=null;queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x19')]=!![];queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x28')]=utils['now']();queues[_0x5136f3['uniqueid']][_0xf9af('0x7')]=_0x5136f3['value'][_0xf9af('0x29')]();utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x5136f3[_0xf9af('0xe')],queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x1f')],_0x5136f3['value'],queues[_0x5136f3['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5136f3[_0xf9af('0xe')]]);}}else if(!_[_0xf9af('0x17')](_0x5136f3[_0xf9af('0x23')][_0xf9af('0x2a')])){if(!_[_0xf9af('0x17')](queues[_0x5136f3[_0xf9af('0xe')]])&&!queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerabandon']){queues[_0x5136f3['uniqueid']]['queuecallerabandon']=![];queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerabandonAt']=null;queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x19')]=!![];queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerexitAt']=utils[_0xf9af('0x14')]();queues[_0x5136f3['uniqueid']]['queuecallerexitreason']=_0xf9af('0x2b');utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x2c'),_0x5136f3[_0xf9af('0xe')],queues[_0x5136f3[_0xf9af('0xe')]]['name'],_0x5136f3['value'],queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerexitreason']));}}}catch(_0x39b924){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x22'),_0x5136f3[_0xf9af('0xe')]),_0x39b924);}};exports[_0xf9af('0x26')]=function(_0x4a6127){try{if(!_[_0xf9af('0x17')](queues[_0x4a6127['uniqueid']])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x2d'),_0x4a6127[_0xf9af('0xe')]),_0x4a6127);queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x19')]=![];queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x28')]=null;queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x26')]=!![];queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x27')]=utils['now']();queues[_0x4a6127['uniqueid']][_0xf9af('0x7')]=_0xf9af('0x2e');utils['info'](util['format'](_0xf9af('0x2f'),_0x4a6127['uniqueid'],queues[_0x4a6127[_0xf9af('0xe')]]['name'],queues[_0x4a6127['uniqueid']][_0xf9af('0x7')]));}}catch(_0xb03f67){utils['error'](util[_0xf9af('0x3')](_0xf9af('0x2d'),_0x4a6127[_0xf9af('0xe')]),_0xb03f67);}};exports[_0xf9af('0x30')]=function(_0x425000){try{if(!_[_0xf9af('0x17')](queues[_0x425000[_0xf9af('0xe')]])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x31'),_0x425000[_0xf9af('0xe')]),_0x425000);utils[_0xf9af('0x2')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x425000[_0xf9af('0xe')],queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x1f')],_0x425000['connectedlinenum'],_0x425000[_0xf9af('0x32')]));queues[_0x425000['uniqueid']][_0xf9af('0x30')]=!![];queues[_0x425000['uniqueid']][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x425000[_0xf9af('0xe')]]['holdtime']=utils[_0xf9af('0x34')](queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x33')],queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x35')]);queues[_0x425000['uniqueid']][_0xf9af('0x13')]=_0x425000['position'];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x36')]=_0x425000[_0xf9af('0x36')];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x37')]=_0x425000[_0xf9af('0x37')];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x32')]=_0x425000[_0xf9af('0x32')];}}catch(_0x19ca74){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x31'),_0x425000['uniqueid']),_0x19ca74);}};exports[_0xf9af('0x38')]=function(_0x2f1546){try{if(!_['isNil'](queues[_0x2f1546[_0xf9af('0xe')]])){utils['debug'](util[_0xf9af('0x3')]('[%s][queues][agentconnect]',_0x2f1546['uniqueid']),_0x2f1546);utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2f1546['uniqueid'],queues[_0x2f1546['uniqueid']][_0xf9af('0x1f')],_0x2f1546[_0xf9af('0x39')],_0x2f1546['destaccountcode']));queues[_0x2f1546['uniqueid']][_0xf9af('0x26')]=![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0x2f1546['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2f1546[_0xf9af('0xe')]]['queuecallerexit']=![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x7')]=null;queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x28')]=null;queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x3a')]=!![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x3b')]=_0x2f1546[_0xf9af('0x3c')];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x6')]=_0x2f1546[_0xf9af('0x39')];}}catch(_0x99e883){utils[_0xf9af('0x15')](util['format'](_0xf9af('0x3d'),_0x2f1546[_0xf9af('0xe')]),_0x99e883);}};exports[_0xf9af('0x3e')]=function(_0xd42368){try{if(!_[_0xf9af('0x17')](queues[_0xd42368[_0xf9af('0xe')]])){if(queues[_0xd42368['uniqueid']][_0xf9af('0x33')]){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x3f'),_0xd42368['uniqueid']),_0xd42368);queues[_0xd42368[_0xf9af('0xe')]]['queuecallerabandon']=![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x27')]=null;queues[_0xd42368['uniqueid']][_0xf9af('0x19')]=![];queues[_0xd42368[_0xf9af('0xe')]]['queuecallerexitAt']=null;queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x3a')]=!![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x6')]=_0xd42368[_0xf9af('0x39')];queues[_0xd42368['uniqueid']][_0xf9af('0x1a')]=!![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x1b')]=utils[_0xf9af('0x14')]();if(_0xd42368[_0xf9af('0x40')]==_0xf9af('0x41')){if(!queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x41')]){queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]=_0xf9af('0x42');}}else{queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]='COMPLETEDBY'+_0xd42368['reason']['toUpperCase']();}utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x43'),_0xd42368[_0xf9af('0xe')],queues[_0xd42368['uniqueid']]['name'],_0xd42368[_0xf9af('0x39')],queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]));writeDB(queues[_0xd42368[_0xf9af('0xe')]]);}}}catch(_0x1b66f5){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x3f'),_0xd42368[_0xf9af('0xe')]),_0x1b66f5);}};exports[_0xf9af('0x44')]=function(_0x1e0ad){try{if(!_[_0xf9af('0x17')](queues[_0x1e0ad[_0xf9af('0x45')]])){utils['debug'](util[_0xf9af('0x3')]('[%s][queues][blindtransfer]',_0x1e0ad[_0xf9af('0xe')]),_0x1e0ad);queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x41')]=!![];queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x46')]=_0xf9af('0x47');queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x48')]=_0x1e0ad[_0xf9af('0x49')];queues[_0x1e0ad[_0xf9af('0x45')]]['transferuniqueid']=_0x1e0ad[_0xf9af('0x45')];queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x7')]=_0xf9af('0x4a');utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1e0ad[_0xf9af('0xe')],queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x1f')],_0x1e0ad['transfereeuniqueid'],_0x1e0ad[_0xf9af('0x49')]));}}catch(_0x4a95d0){utils[_0xf9af('0x15')](util['format']('[%s][queues][blindtransfer]',_0x1e0ad['uniqueid']),_0x4a95d0);}};exports[_0xf9af('0x4b')]=function(_0x206573){try{utils[_0xf9af('0x10')](util['format'](_0xf9af('0x4c'),_0x206573[_0xf9af('0x4d')]),_0x206573);if(_0x206573[_0xf9af('0x4d')]==_0x206573['origtransfererlinkedid']){if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x4e')]])){utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x206573[_0xf9af('0x4d')],queues[_0x206573['secondtransfererlinkedid']][_0xf9af('0x1f')],_0x206573[_0xf9af('0x4f')]));queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x41')]=!![];queues[_0x206573[_0xf9af('0x4e')]]['transfertype']=_0xf9af('0x50');queues[_0x206573['secondtransfererlinkedid']][_0xf9af('0x48')]=_0x206573[_0xf9af('0x4f')];queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x51')]=_0x206573[_0xf9af('0x4d')];queues[_0x206573[_0xf9af('0x4e')]]['queuecallerexitreason']=_0xf9af('0x52');}if(!_[_0xf9af('0x17')](queues[_0x206573['origtransfererlinkedid']])){if(_0x206573['transfereelinkedid']&&queues[_0x206573['transfereelinkedid']]){queues[_0x206573[_0xf9af('0x53')]][_0xf9af('0x20')]=0x1;queues[_0x206573[_0xf9af('0x45')]]=_[_0xf9af('0x54')](queues[_0x206573['transfereelinkedid']]);queues[_0x206573['transfereeuniqueid']]['transfereduniqueid']=_0x206573[_0xf9af('0x55')];queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x20')]=0x2;queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x56')]=queues[_0x206573[_0xf9af('0x4e')]]['calleridnum'];queues[_0x206573['transfereeuniqueid']][_0xf9af('0x57')]=queues[_0x206573[_0xf9af('0x4e')]]['calleridname'];queues[_0x206573[_0xf9af('0x45')]]['queuecallerjoinAt']=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x58')]=0x0;queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x59')]=0x0;utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x5a'),_0x206573['origtransfereruniqueid'],queues[_0x206573[_0xf9af('0x45')]]['name'],queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x56')],queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x57')]));}else{utils[_0xf9af('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x206573['origtransfereruniqueid'],queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x1f')],_0x206573[_0xf9af('0x4e')]));queues[_0x206573['origtransfererlinkedid']][_0xf9af('0xd')]=_0x206573[_0xf9af('0x4e')];}}}else if(_0x206573[_0xf9af('0x5c')]==_0x206573['secondtransfererlinkedid']){if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x5b')]])){utils[_0xf9af('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x1f')],_0x206573['secondtransfereruniqueid'],_0x206573[_0xf9af('0x5d')]));queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x41')]=!![];queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x46')]=_0xf9af('0x50');queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x48')]=_0x206573[_0xf9af('0x5d')];queues[_0x206573[_0xf9af('0x5b')]]['transferuniqueid']=_0x206573[_0xf9af('0x5c')];queues[_0x206573[_0xf9af('0x5b')]]['queuecallerexitreason']=_0xf9af('0x52');}if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x4e')]])){if(_0x206573[_0xf9af('0x5e')]&&queues[_0x206573['transfertargetlinkedid']]){queues[_0x206573[_0xf9af('0x5e')]][_0xf9af('0x20')]=0x1;queues[_0x206573[_0xf9af('0x55')]]=_[_0xf9af('0x54')](queues[_0x206573['transfertargetlinkedid']]);queues[_0x206573['transfertargetuniqueid']][_0xf9af('0xd')]=_0x206573['transfertargetuniqueid'];queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x20')]=0x2;queues[_0x206573[_0xf9af('0x55')]]['calleridnum']=queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x56')];queues[_0x206573[_0xf9af('0x55')]]['calleridname']=queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x57')];queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x35')]=utils['now']();queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x58')]=0x0;queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x59')]=0x0;utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x5f'),_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x1f')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0xd')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x56')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x57')]));}else{utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x1f')],_0x206573[_0xf9af('0x5b')]));queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0xd')]=_0x206573[_0xf9af('0x5b')];}}}}catch(_0x56cb91){utils['error'](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]',_0x206573[_0xf9af('0x4d')]),_0x56cb91);}};exports[_0xf9af('0x60')]=function(_0x3b1659){try{if(!_[_0xf9af('0x17')](queues[_0x3b1659[_0xf9af('0xe')]])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')]('[%s][queues][musiconholdstart]',_0x3b1659[_0xf9af('0xe')]),_0x3b1659);queues[_0x3b1659['uniqueid']][_0xf9af('0x61')]=utils[_0xf9af('0x14')]();utils[_0xf9af('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3b1659[_0xf9af('0xe')],queues[_0x3b1659[_0xf9af('0xe')]][_0xf9af('0x1f')],queues[_0x3b1659['uniqueid']][_0xf9af('0x61')]));}}catch(_0x12d41d){utils['error'](util[_0xf9af('0x3')](_0xf9af('0x62'),_0x3b1659[_0xf9af('0xe')]),_0x12d41d);}};exports[_0xf9af('0x63')]=function(_0x571ccd){try{if(!_[_0xf9af('0x17')](queues[_0x571ccd[_0xf9af('0xe')]])){if(!_[_0xf9af('0x17')](queues[_0x571ccd[_0xf9af('0xe')]][_0xf9af('0x61')])){utils[_0xf9af('0x10')](util['format'](_0xf9af('0x64'),_0x571ccd[_0xf9af('0xe')]),_0x571ccd);queues[_0x571ccd[_0xf9af('0xe')]]['mohtime']+=utils[_0xf9af('0x34')](utils[_0xf9af('0x14')](),queues[_0x571ccd[_0xf9af('0xe')]]['musiconholdstartAt']);utils[_0xf9af('0x2')](util['format'](_0xf9af('0x65'),_0x571ccd[_0xf9af('0xe')],queues[_0x571ccd[_0xf9af('0xe')]]['name'],queues[_0x571ccd[_0xf9af('0xe')]][_0xf9af('0x59')]));delete queues[_0x571ccd[_0xf9af('0xe')]]['musiconholdstartAt'];}}}catch(_0x1b59f4){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x64'),_0x571ccd[_0xf9af('0xe')]),_0x1b59f4);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3aa44fd..e22be46 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 _0x6d5b=['queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','newchannel','debug','[%s][recordings][newchannel]','context','exten','channel','newstate','[%s][recordings][newstate]','info','isNil','channelstate','transfer','linkedid','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','error','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','split','substring','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s'];(function(_0x5cdf85,_0x4f5610){var _0x109a19=function(_0x97db52){while(--_0x97db52){_0x5cdf85['push'](_0x5cdf85['shift']());}};_0x109a19(++_0x4f5610);}(_0x6d5b,0x11e));var _0xb6d5=function(_0x51a022,_0x31f20e){_0x51a022=_0x51a022-0x0;var _0x2667f2=_0x6d5b[_0x51a022];return _0x2667f2;};'use strict';var _=require(_0xb6d5('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2d443a){var _0x59e1ab;utils['info'](util[_0xb6d5('0x1')](_0xb6d5('0x2'),_0x2d443a[_0xb6d5('0x3')]));if(transfers[_0xb6d5('0x4')][_0x2d443a[_0xb6d5('0x3')]]){_0x59e1ab=_0x2d443a['uniqueid'];_0x2d443a[_0xb6d5('0x3')]=transfers[_0xb6d5('0x4')][_0x2d443a[_0xb6d5('0x3')]][_0xb6d5('0x5')];}if(_0x2d443a[_0xb6d5('0x6')]){utils[_0xb6d5('0x7')](_0x2d443a[_0xb6d5('0x6')])[_0xb6d5('0x8')](function(_0x455e3b){if(_0x455e3b){_0x2d443a['membername']=_0x455e3b[_0xb6d5('0x9')];_0x2d443a[_0xb6d5('0xa')]=_0x455e3b['id'];}utils[_0xb6d5('0xb')]('CreateVoiceRecording',_0x2d443a);});}else{utils[_0xb6d5('0xb')]('CreateVoiceRecording',_0x2d443a);}if(_0x59e1ab)delete transfers[_0xb6d5('0x4')][_0x59e1ab];}exports[_0xb6d5('0xc')]=function(_0x2cc965){try{utils[_0xb6d5('0xd')](util[_0xb6d5('0x1')](_0xb6d5('0xe'),_0x2cc965[_0xb6d5('0x3')]),_0x2cc965);if(_0x2cc965[_0xb6d5('0x3')]==_0x2cc965['linkedid']){utils['info'](util[_0xb6d5('0x1')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2cc965[_0xb6d5('0x3')],_0x2cc965[_0xb6d5('0xf')],_0x2cc965['exten']));recordings[_0x2cc965['uniqueid']]={'uniqueid':_0x2cc965[_0xb6d5('0x3')],'accountcode':_0x2cc965['accountcode'],'exten':_0x2cc965[_0xb6d5('0x10')],'context':_0x2cc965[_0xb6d5('0xf')],'channel':_0x2cc965[_0xb6d5('0x11')],'monitors':[]};}}catch(_0x2cab70){utils['error'](util[_0xb6d5('0x1')]('[%s][recordings][newchannel]',_0x2cc965[_0xb6d5('0x3')]),_0x2cab70);}};exports[_0xb6d5('0x12')]=function(_0x30a7ff){try{utils[_0xb6d5('0xd')](util['format'](_0xb6d5('0x13'),_0x30a7ff[_0xb6d5('0x3')]),_0x30a7ff);if(!_['isNil'](recordings[_0x30a7ff['uniqueid']])&&_0x30a7ff['channelstate']==0x6){utils[_0xb6d5('0x14')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x30a7ff['uniqueid'],_0x30a7ff[_0xb6d5('0xf')],_0x30a7ff['channel']));}else if(!_[_0xb6d5('0x15')](recordings[_0x30a7ff['linkedid']])&&_0x30a7ff[_0xb6d5('0x16')]==0x6&&_0x30a7ff['context']!=_0xb6d5('0x17')){utils[_0xb6d5('0x14')](util[_0xb6d5('0x1')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x30a7ff['uniqueid'],_0x30a7ff['linkedid'],_0x30a7ff[_0xb6d5('0xf')],_0x30a7ff[_0xb6d5('0x11')]));recordings[_0x30a7ff[_0xb6d5('0x18')]][_0xb6d5('0x6')]=_0x30a7ff['accountcode'];}}catch(_0x3d0927){utils['error'](util[_0xb6d5('0x1')](_0xb6d5('0x13'),_0x30a7ff[_0xb6d5('0x3')]),_0x3d0927);}};exports[_0xb6d5('0x19')]=function(_0x3c9da5){try{if(!_[_0xb6d5('0x15')](_0x3c9da5[_0xb6d5('0x1a')])&&!_[_0xb6d5('0x15')](_0x3c9da5[_0xb6d5('0x1a')][_0xb6d5('0x1b')])){utils[_0xb6d5('0xd')](util[_0xb6d5('0x1')](_0xb6d5('0x1c'),_0x3c9da5['uniqueid']),_0x3c9da5);utils[_0xb6d5('0x14')](util[_0xb6d5('0x1')](_0xb6d5('0x1d'),_0x3c9da5[_0xb6d5('0x3')],_0x3c9da5[_0xb6d5('0x1a')],_0x3c9da5[_0xb6d5('0x1e')]));if(_['endsWith'](_0x3c9da5[_0xb6d5('0x1e')],_0xb6d5('0x1f'))){_0x3c9da5[_0xb6d5('0x1e')]=_0x3c9da5['value'][_0xb6d5('0x20')](_0xb6d5('0x1f'),_0xb6d5('0x21'));}if(recordings[_0x3c9da5[_0xb6d5('0x18')]]){var _0x19b7d9=_['find'](recordings[_0x3c9da5[_0xb6d5('0x18')]][_0xb6d5('0x22')],{'value':_0x3c9da5['value']});if(_[_0xb6d5('0x15')](_0x19b7d9)){recordings[_0x3c9da5[_0xb6d5('0x18')]]['monitors']['push']({'value':_0x3c9da5[_0xb6d5('0x1e')]});}}}}catch(_0x2bc26d){utils[_0xb6d5('0x23')](util['format'](_0xb6d5('0x1c'),_0x3c9da5['uniqueid']),_0x2bc26d);}};exports['hangup']=function(_0x8512b1){try{if(!_[_0xb6d5('0x15')](recordings[_0x8512b1[_0xb6d5('0x3')]])){utils[_0xb6d5('0xd')](util[_0xb6d5('0x1')](_0xb6d5('0x24'),_0x8512b1[_0xb6d5('0x3')]),_0x8512b1);utils[_0xb6d5('0x14')](util[_0xb6d5('0x1')](_0xb6d5('0x25'),_0x8512b1[_0xb6d5('0x3')],_0x8512b1[_0xb6d5('0x26')],_0x8512b1[_0xb6d5('0x27')],_0x8512b1[_0xb6d5('0x28')]));recordings[_0x8512b1['uniqueid']][_0xb6d5('0x26')]=_0x8512b1[_0xb6d5('0x26')];recordings[_0x8512b1[_0xb6d5('0x3')]]['calleridname']=_0x8512b1[_0xb6d5('0x27')];recordings[_0x8512b1[_0xb6d5('0x3')]][_0xb6d5('0x29')]=_0x8512b1[_0xb6d5('0x29')];recordings[_0x8512b1[_0xb6d5('0x3')]][_0xb6d5('0x2a')]=_0x8512b1[_0xb6d5('0x2a')];if(recordings[_0x8512b1[_0xb6d5('0x3')]][_0xb6d5('0x2b')]==_0xb6d5('0x2c')&&recordings[_0x8512b1[_0xb6d5('0x3')]][_0xb6d5('0x6')]){recordings[_0x8512b1[_0xb6d5('0x3')]]['connectedlinenum']=recordings[_0x8512b1['uniqueid']][_0xb6d5('0x6')];recordings[_0x8512b1['uniqueid']][_0xb6d5('0x2a')]='';}recordings[_0x8512b1['uniqueid']][_0xb6d5('0x22')][_0xb6d5('0x2d')](function(_0x2bf275){var _0xf81e95=_[_0xb6d5('0x2e')](recordings[_0x8512b1[_0xb6d5('0x3')]]);_0xf81e95[_0xb6d5('0x1e')]=_0x2bf275[_0xb6d5('0x1e')];writeDB(_0xf81e95);});delete recordings[_0x8512b1[_0xb6d5('0x3')]];}}catch(_0x3bace3){utils[_0xb6d5('0x23')](util['format'](_0xb6d5('0x24'),_0x8512b1[_0xb6d5('0x3')]),_0x3bace3);}};exports[_0xb6d5('0x2f')]=function(_0x4cf4e8){try{if(!_['isNil'](recordings[_0x4cf4e8['uniqueid']])){utils['debug'](util[_0xb6d5('0x1')]('[%s][recordings][newexten]',_0x4cf4e8['uniqueid']),_0x4cf4e8);utils['info'](util[_0xb6d5('0x1')](_0xb6d5('0x30'),_0x4cf4e8['uniqueid'],_0x4cf4e8['application'],_0x4cf4e8[_0xb6d5('0x31')]));if(_0x4cf4e8[_0xb6d5('0x32')][_0xb6d5('0x33')]()==_0xb6d5('0x34')&&_['startsWith'](_0x4cf4e8['appdata'][_0xb6d5('0x33')](),'cdr')){var _0xd6c1b3=_0x4cf4e8[_0xb6d5('0x31')][_0xb6d5('0x35')]('=');var _0x16c19b=_0xd6c1b3[0x0][_0xb6d5('0x36')](_0xd6c1b3[0x0]['lastIndexOf']('(')+0x1,_0xd6c1b3[0x0]['lastIndexOf'](')'));var _0xb6d527=_0xd6c1b3[0x1];recordings[_0x4cf4e8[_0xb6d5('0x3')]][_0x16c19b]=_0xb6d527;}}}catch(_0x217ec5){utils['error'](util[_0xb6d5('0x1')](_0xb6d5('0x37'),_0x4cf4e8[_0xb6d5('0x3')]),_0x217ec5);}};exports[_0xb6d5('0x38')]=function(_0x2c4076){try{if(!_[_0xb6d5('0x15')](recordings[_0x2c4076[_0xb6d5('0x3')]])){utils['debug'](util[_0xb6d5('0x1')](_0xb6d5('0x39'),_0x2c4076[_0xb6d5('0x3')]),_0x2c4076);utils[_0xb6d5('0x14')](util[_0xb6d5('0x1')](_0xb6d5('0x3a'),_0x2c4076[_0xb6d5('0x3')],_0x2c4076[_0xb6d5('0x3b')]));recordings[_0x2c4076['uniqueid']]['queue']=_0x2c4076[_0xb6d5('0x3b')];}}catch(_0xc4139c){utils[_0xb6d5('0x23')](util['format'](_0xb6d5('0x39'),_0x2c4076[_0xb6d5('0x3')]),_0xc4139c);}};exports[_0xb6d5('0x3c')]=function(_0x4906c7){try{utils[_0xb6d5('0xd')](util[_0xb6d5('0x1')](_0xb6d5('0x3d'),_0x4906c7[_0xb6d5('0x3')]),_0x4906c7);utils[_0xb6d5('0x14')](util['format'](_0xb6d5('0x3e'),_0x4906c7[_0xb6d5('0x3')],_0x4906c7[_0xb6d5('0x3f')],_0x4906c7[_0xb6d5('0x40')],_0x4906c7[_0xb6d5('0x41')],_0x4906c7[_0xb6d5('0x42')]));if(recordings[_0x4906c7[_0xb6d5('0x43')]]&&transfers[_0xb6d5('0x4')][_0x4906c7[_0xb6d5('0x43')]]){transfers['blinds'][_0x4906c7[_0xb6d5('0x43')]][_0xb6d5('0x44')]=!![];}}catch(_0x49fbf9){utils[_0xb6d5('0x23')](util['format']('[%s][recordings][blindtransfer]',_0x4906c7[_0xb6d5('0x3')]),_0x49fbf9);}}; \ No newline at end of file +var _0x595c=['[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','accountcode','connectedlinename','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','getUserByInternal','membername','name','request','CreateVoiceRecording','blinds','newchannel','debug','format'];(function(_0xdafdbc,_0xe260b0){var _0x1108de=function(_0x27d66c){while(--_0x27d66c){_0xdafdbc['push'](_0xdafdbc['shift']());}};_0x1108de(++_0xe260b0);}(_0x595c,0x80));var _0xc595=function(_0x5d1a0c,_0x2dacd3){_0x5d1a0c=_0x5d1a0c-0x0;var _0x4642c2=_0x595c[_0x5d1a0c];return _0x4642c2;};'use strict';var _=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var utils=require(_0xc595('0x2'));var transfers=require(_0xc595('0x3'));var recordings={};function writeDB(_0x229420){var _0x4b54bc;utils['info'](util['format'](_0xc595('0x4'),_0x229420[_0xc595('0x5')]));if(transfers['blinds'][_0x229420[_0xc595('0x5')]]){_0x4b54bc=_0x229420[_0xc595('0x5')];_0x229420[_0xc595('0x5')]=transfers['blinds'][_0x229420[_0xc595('0x5')]][_0xc595('0x6')];}if(_0x229420['accountcode']){utils[_0xc595('0x7')](_0x229420['accountcode'])['then'](function(_0x928233){if(_0x928233){_0x229420[_0xc595('0x8')]=_0x928233[_0xc595('0x9')];_0x229420['UserId']=_0x928233['id'];}utils[_0xc595('0xa')](_0xc595('0xb'),_0x229420);});}else{utils[_0xc595('0xa')](_0xc595('0xb'),_0x229420);}if(_0x4b54bc)delete transfers[_0xc595('0xc')][_0x4b54bc];}exports[_0xc595('0xd')]=function(_0x2e578a){try{utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x10'),_0x2e578a[_0xc595('0x5')]),_0x2e578a);if(_0x2e578a['uniqueid']==_0x2e578a[_0xc595('0x11')]){utils[_0xc595('0x12')](util['format'](_0xc595('0x13'),_0x2e578a[_0xc595('0x5')],_0x2e578a[_0xc595('0x14')],_0x2e578a[_0xc595('0x15')]));recordings[_0x2e578a[_0xc595('0x5')]]={'uniqueid':_0x2e578a['uniqueid'],'accountcode':_0x2e578a['accountcode'],'exten':_0x2e578a[_0xc595('0x15')],'context':_0x2e578a[_0xc595('0x14')],'channel':_0x2e578a[_0xc595('0x16')],'monitors':[]};}}catch(_0x178045){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x10'),_0x2e578a[_0xc595('0x5')]),_0x178045);}};exports[_0xc595('0x18')]=function(_0x2caa62){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x2caa62[_0xc595('0x5')]),_0x2caa62);if(!_[_0xc595('0x19')](recordings[_0x2caa62['uniqueid']])&&_0x2caa62[_0xc595('0x1a')]==0x6){utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x1b'),_0x2caa62['uniqueid'],_0x2caa62[_0xc595('0x14')],_0x2caa62[_0xc595('0x16')]));}else if(!_['isNil'](recordings[_0x2caa62[_0xc595('0x11')]])&&_0x2caa62[_0xc595('0x1a')]==0x6&&_0x2caa62[_0xc595('0x14')]!=_0xc595('0x1c')){utils[_0xc595('0x12')](util[_0xc595('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2caa62['uniqueid'],_0x2caa62[_0xc595('0x11')],_0x2caa62[_0xc595('0x14')],_0x2caa62['channel']));recordings[_0x2caa62[_0xc595('0x11')]]['accountcode']=_0x2caa62['accountcode'];}}catch(_0x18956c){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x1d'),_0x2caa62[_0xc595('0x5')]),_0x18956c);}};exports[_0xc595('0x1e')]=function(_0x58dfff){try{if(!_[_0xc595('0x19')](_0x58dfff[_0xc595('0x1f')])&&!_['isNil'](_0x58dfff['variable'][_0xc595('0x20')])){utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x21'),_0x58dfff['uniqueid']),_0x58dfff);utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x22'),_0x58dfff['uniqueid'],_0x58dfff[_0xc595('0x1f')],_0x58dfff[_0xc595('0x23')]));if(_[_0xc595('0x24')](_0x58dfff[_0xc595('0x23')],_0xc595('0x25'))){_0x58dfff[_0xc595('0x23')]=_0x58dfff[_0xc595('0x23')][_0xc595('0x26')]('.wav49',_0xc595('0x27'));}if(recordings[_0x58dfff[_0xc595('0x11')]]){var _0x32ae7b=_[_0xc595('0x28')](recordings[_0x58dfff[_0xc595('0x11')]][_0xc595('0x29')],{'value':_0x58dfff[_0xc595('0x23')]});if(_[_0xc595('0x19')](_0x32ae7b)){recordings[_0x58dfff['linkedid']][_0xc595('0x29')][_0xc595('0x2a')]({'value':_0x58dfff['value']});}}}}catch(_0x40a533){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x21'),_0x58dfff[_0xc595('0x5')]),_0x40a533);}};exports['hangup']=function(_0x253462){try{if(!_[_0xc595('0x19')](recordings[_0x253462[_0xc595('0x5')]])){utils['debug'](util[_0xc595('0xf')](_0xc595('0x2b'),_0x253462[_0xc595('0x5')]),_0x253462);utils['info'](util['format'](_0xc595('0x2c'),_0x253462['uniqueid'],_0x253462[_0xc595('0x2d')],_0x253462[_0xc595('0x2e')],_0x253462['cause-txt']));recordings[_0x253462['uniqueid']]['calleridnum']=_0x253462[_0xc595('0x2d')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x2e')]=_0x253462[_0xc595('0x2e')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x2f')]=_0x253462[_0xc595('0x2f')];recordings[_0x253462[_0xc595('0x5')]]['connectedlinename']=_0x253462['connectedlinename'];if(recordings[_0x253462[_0xc595('0x5')]]['type']=='outbound'&&recordings[_0x253462['uniqueid']]['accountcode']){recordings[_0x253462['uniqueid']]['connectedlinenum']=recordings[_0x253462['uniqueid']][_0xc595('0x30')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x31')]='';}recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x29')]['forEach'](function(_0x12115b){var _0x2642f7=_[_0xc595('0x32')](recordings[_0x253462[_0xc595('0x5')]]);_0x2642f7['value']=_0x12115b[_0xc595('0x23')];writeDB(_0x2642f7);});delete recordings[_0x253462[_0xc595('0x5')]];}}catch(_0x10ab93){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x2b'),_0x253462[_0xc595('0x5')]),_0x10ab93);}};exports[_0xc595('0x33')]=function(_0x262e79){try{if(!_['isNil'](recordings[_0x262e79['uniqueid']])){utils['debug'](util[_0xc595('0xf')](_0xc595('0x34'),_0x262e79['uniqueid']),_0x262e79);utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x35'),_0x262e79['uniqueid'],_0x262e79['application'],_0x262e79['appdata']));if(_0x262e79[_0xc595('0x36')][_0xc595('0x37')]()==_0xc595('0x38')&&_[_0xc595('0x39')](_0x262e79[_0xc595('0x3a')]['toLowerCase'](),_0xc595('0x3b'))){var _0x25034b=_0x262e79['appdata'][_0xc595('0x3c')]('=');var _0x2106db=_0x25034b[0x0][_0xc595('0x3d')](_0x25034b[0x0][_0xc595('0x3e')]('(')+0x1,_0x25034b[0x0]['lastIndexOf'](')'));var _0x6666ae=_0x25034b[0x1];recordings[_0x262e79[_0xc595('0x5')]][_0x2106db]=_0x6666ae;}}}catch(_0x2fba66){utils[_0xc595('0x17')](util['format'](_0xc595('0x34'),_0x262e79[_0xc595('0x5')]),_0x2fba66);}};exports[_0xc595('0x3f')]=function(_0x770b74){try{if(!_[_0xc595('0x19')](recordings[_0x770b74[_0xc595('0x5')]])){utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x40'),_0x770b74['uniqueid']),_0x770b74);utils[_0xc595('0x12')](util['format'](_0xc595('0x41'),_0x770b74[_0xc595('0x5')],_0x770b74[_0xc595('0x42')]));recordings[_0x770b74[_0xc595('0x5')]]['queue']=_0x770b74[_0xc595('0x42')];}}catch(_0x334aa2){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x770b74[_0xc595('0x5')]),_0x334aa2);}};exports[_0xc595('0x43')]=function(_0x25068c){try{utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x44'),_0x25068c['uniqueid']),_0x25068c);utils[_0xc595('0x12')](util['format'](_0xc595('0x45'),_0x25068c[_0xc595('0x5')],_0x25068c['transferercalleridnum'],_0x25068c['transferercalleridname'],_0x25068c['transfereecalleridnum'],_0x25068c[_0xc595('0x46')]));if(recordings[_0x25068c[_0xc595('0x47')]]&&transfers[_0xc595('0xc')][_0x25068c[_0xc595('0x47')]]){transfers[_0xc595('0xc')][_0x25068c[_0xc595('0x47')]]['recording']=!![];}}catch(_0x561b2c){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x44'),_0x25068c[_0xc595('0x5')]),_0x561b2c);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9f7ed5b..76eadf0 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 _0x27b0=['[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','format','type','origtransfereruniqueid','blinds','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','attendedtransfer','debug'];(function(_0x4f1423,_0x13cc99){var _0x33c235=function(_0x48f704){while(--_0x48f704){_0x4f1423['push'](_0x4f1423['shift']());}};_0x33c235(++_0x13cc99);}(_0x27b0,0x171));var _0x027b=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0x27b0[_0x5eb1a8];return _0x14c11c;};'use strict';var _=require(_0x027b('0x0'));var util=require('util');var utils=require(_0x027b('0x1'));function writeDB(_0x52efbc){utils['info'](util[_0x027b('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x52efbc[_0x027b('0x3')]==='attended'?_0x52efbc[_0x027b('0x4')]:_0x52efbc['uniqueid'],_0x52efbc['type']));utils['request']('CreateVoiceTransferReport',_0x52efbc);}exports[_0x027b('0x5')]={};exports[_0x027b('0x6')]=function(_0x1a0dd3){try{utils['debug'](util[_0x027b('0x2')](_0x027b('0x7'),_0x1a0dd3[_0x027b('0x8')]),_0x1a0dd3);utils[_0x027b('0x9')](util[_0x027b('0x2')](_0x027b('0xa'),_0x1a0dd3[_0x027b('0x8')],_0x1a0dd3[_0x027b('0xb')],_0x1a0dd3[_0x027b('0xc')],_0x1a0dd3['transfereecalleridnum'],_0x1a0dd3['transfereecalleridname']));_0x1a0dd3['type']=_0x027b('0xd');exports['blinds'][_0x1a0dd3['transfereruniqueid']]=_0x1a0dd3;writeDB(_0x1a0dd3);}catch(_0x1cb374){utils['error'](util[_0x027b('0x2')](_0x027b('0x7'),_0x1a0dd3['uniqueid']),_0x1cb374);}};exports[_0x027b('0xe')]=function(_0x4c8e53){try{utils[_0x027b('0xf')](util[_0x027b('0x2')](_0x027b('0x10'),_0x4c8e53[_0x027b('0x4')]),_0x4c8e53);utils['info'](util[_0x027b('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4c8e53[_0x027b('0x4')],_0x4c8e53[_0x027b('0x11')],_0x4c8e53[_0x027b('0x12')],_0x4c8e53[_0x027b('0x13')],_0x4c8e53[_0x027b('0x14')]));_0x4c8e53=_[_0x027b('0x15')](_0x4c8e53,{'transfererchannel':_0x4c8e53[_0x027b('0x16')],'transferercalleridnum':_0x4c8e53[_0x027b('0x11')],'transferercalleridname':_0x4c8e53[_0x027b('0x12')],'transfererconnectedlinenum':_0x4c8e53['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4c8e53['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4c8e53[_0x027b('0x17')],'transferercontext':_0x4c8e53[_0x027b('0x18')],'transfererexten':_0x4c8e53[_0x027b('0x19')],'transfererlinkedid':_0x4c8e53['origtransfererlinkedid'],'context':_0x4c8e53['origtransferercontext'],'extension':_0x4c8e53['origtransfererexten'],'type':'attended'});if(_['isNil'](_0x4c8e53[_0x027b('0x1a')])){_0x4c8e53=_[_0x027b('0x15')](_0x4c8e53,{'transfereechannel':_0x4c8e53[_0x027b('0x1b')],'transfereecalleridnum':_0x4c8e53[_0x027b('0x13')],'transfereecalleridname':_0x4c8e53[_0x027b('0x14')],'transfereeconnectedlinenum':_0x4c8e53[_0x027b('0x1c')],'transfereeconnectedlinename':_0x4c8e53[_0x027b('0x1d')],'transfereeaccountcode':_0x4c8e53[_0x027b('0x1e')],'transfereecontext':_0x4c8e53[_0x027b('0x1f')],'transfereeexten':_0x4c8e53[_0x027b('0x20')],'transfereelinkedid':_0x4c8e53[_0x027b('0x21')]});}writeDB(_0x4c8e53);}catch(_0x4b7c4d){utils[_0x027b('0x22')](util['format'](_0x027b('0x10'),_0x4c8e53[_0x027b('0x4')]),_0x4b7c4d);}}; \ No newline at end of file +var _0x2276=['lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error'];(function(_0x58217c,_0x2aea63){var _0x4de8d6=function(_0x578024){while(--_0x578024){_0x58217c['push'](_0x58217c['shift']());}};_0x4de8d6(++_0x2aea63);}(_0x2276,0x1c3));var _0x6227=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x2276[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0x6227('0x0'));var util=require(_0x6227('0x1'));var utils=require(_0x6227('0x2'));function writeDB(_0x2d0b03){utils[_0x6227('0x3')](util[_0x6227('0x4')](_0x6227('0x5'),_0x2d0b03[_0x6227('0x6')]===_0x6227('0x7')?_0x2d0b03[_0x6227('0x8')]:_0x2d0b03[_0x6227('0x9')],_0x2d0b03[_0x6227('0x6')]));utils[_0x6227('0xa')](_0x6227('0xb'),_0x2d0b03);}exports['blinds']={};exports[_0x6227('0xc')]=function(_0xf1809b){try{utils[_0x6227('0xd')](util[_0x6227('0x4')](_0x6227('0xe'),_0xf1809b[_0x6227('0x9')]),_0xf1809b);utils[_0x6227('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xf1809b[_0x6227('0x9')],_0xf1809b[_0x6227('0xf')],_0xf1809b[_0x6227('0x10')],_0xf1809b['transfereecalleridnum'],_0xf1809b[_0x6227('0x11')]));_0xf1809b[_0x6227('0x6')]='blind';exports['blinds'][_0xf1809b[_0x6227('0x12')]]=_0xf1809b;writeDB(_0xf1809b);}catch(_0x9a88a7){utils['error'](util[_0x6227('0x4')](_0x6227('0xe'),_0xf1809b[_0x6227('0x9')]),_0x9a88a7);}};exports[_0x6227('0x13')]=function(_0x35319a){try{utils[_0x6227('0xd')](util[_0x6227('0x4')](_0x6227('0x14'),_0x35319a[_0x6227('0x8')]),_0x35319a);utils[_0x6227('0x3')](util[_0x6227('0x4')](_0x6227('0x15'),_0x35319a['origtransfereruniqueid'],_0x35319a['origtransferercalleridnum'],_0x35319a['origtransferercalleridname'],_0x35319a['transfertargetcalleridnum'],_0x35319a[_0x6227('0x16')]));_0x35319a=_[_0x6227('0x17')](_0x35319a,{'transfererchannel':_0x35319a[_0x6227('0x18')],'transferercalleridnum':_0x35319a[_0x6227('0x19')],'transferercalleridname':_0x35319a['origtransferercalleridname'],'transfererconnectedlinenum':_0x35319a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x35319a[_0x6227('0x1a')],'transfereraccountcode':_0x35319a['origtransfereraccountcode'],'transferercontext':_0x35319a[_0x6227('0x1b')],'transfererexten':_0x35319a[_0x6227('0x1c')],'transfererlinkedid':_0x35319a[_0x6227('0x1d')],'context':_0x35319a[_0x6227('0x1e')],'extension':_0x35319a[_0x6227('0x1f')],'type':_0x6227('0x7')});if(_[_0x6227('0x20')](_0x35319a[_0x6227('0x21')])){_0x35319a=_[_0x6227('0x17')](_0x35319a,{'transfereechannel':_0x35319a['transfertargetchannel'],'transfereecalleridnum':_0x35319a[_0x6227('0x22')],'transfereecalleridname':_0x35319a[_0x6227('0x16')],'transfereeconnectedlinenum':_0x35319a[_0x6227('0x23')],'transfereeconnectedlinename':_0x35319a[_0x6227('0x24')],'transfereeaccountcode':_0x35319a['transfertargetaccountcode'],'transfereecontext':_0x35319a[_0x6227('0x25')],'transfereeexten':_0x35319a[_0x6227('0x26')],'transfereelinkedid':_0x35319a[_0x6227('0x27')]});}writeDB(_0x35319a);}catch(_0xc0f44d){utils[_0x6227('0x28')](util['format'](_0x6227('0x14'),_0x35319a['origtransfereruniqueid']),_0xc0f44d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c1e854f..f23e621 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 _0x5302=['info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','../../config/logger'];(function(_0x4f82e2,_0x3f25a5){var _0x3c1fe4=function(_0xd7d258){while(--_0xd7d258){_0x4f82e2['push'](_0x4f82e2['shift']());}};_0x3c1fe4(++_0x3f25a5);}(_0x5302,0x1b5));var _0x2530=function(_0xe27035,_0x1f4876){_0xe27035=_0xe27035-0x0;var _0x3745bc=_0x5302[_0xe27035];return _0x3745bc;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x2530('0x0'));var util=require(_0x2530('0x1'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x2530('0x2'))('xdr');exports[_0x2530('0x3')]=function(_0x4ae9db,_0x371cf1){logger[_0x2530('0x3')](_0x4ae9db,_0x371cf1?util[_0x2530('0x4')](_0x371cf1,{'showHidden':![],'depth':null}):'');};exports[_0x2530('0x5')]=function(_0x9f762,_0x574655){logger[_0x2530('0x5')](_0x9f762,_0x574655?util[_0x2530('0x4')](_0x574655,{'showHidden':![],'depth':null}):'');};exports[_0x2530('0x6')]=function(_0x1070de,_0x3f7422){logger[_0x2530('0x6')](_0x1070de,_0x3f7422?util[_0x2530('0x4')](_0x3f7422,{'showHidden':![],'depth':null}):'');};exports[_0x2530('0x7')]=function(_0x2ebbb7,_0x35b948){return client[_0x2530('0x7')](_0x2ebbb7,{'body':_0x35b948})[_0x2530('0x8')](function(_0x3a8848){logger[_0x2530('0x5')](_0x2530('0x9'),_0x2ebbb7,_0x3a8848?util[_0x2530('0x4')](_0x3a8848,{'showHidden':![],'depth':null}):'');})[_0x2530('0xa')](function(_0x4d69e3){logger[_0x2530('0x6')](_0x2530('0x9'),_0x2ebbb7,_0x4d69e3?util[_0x2530('0x4')](_0x4d69e3,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9df06c){return client[_0x2530('0x7')](_0x2530('0xb'),{'options':{'raw':!![],'attributes':['id',_0x2530('0xc'),'name','interface'],'where':_0x9df06c,'limit':0x1}})['then'](function(_0x4f7a1e){logger[_0x2530('0x5')](_0x2530('0xd'),JSON['stringify'](_0x9df06c),_0x4f7a1e?util[_0x2530('0x4')](_0x4f7a1e,{'showHidden':![],'depth':null}):'');return _0x4f7a1e[_0x2530('0xe')][_0x2530('0xf')]?_0x4f7a1e[_0x2530('0xe')][0x0]:null;});}exports[_0x2530('0x10')]=function(_0x1af188){return new BPromise(function(_0x3aac94,_0x117c5d){if(_0x1af188){return getUser({'internal':_0x1af188})[_0x2530('0x8')](function(_0x5a2e0c){logger[_0x2530('0x3')](_0x2530('0x11'),_0x1af188,_0x5a2e0c?_0x2530('0x12'):_0x2530('0x13'));return _0x3aac94(_0x5a2e0c);})[_0x2530('0xa')](function(_0xde715e){logger[_0x2530('0x6')](_0x2530('0x14'),_0xde715e?util[_0x2530('0x4')](_0xde715e,{'showHidden':![],'depth':null}):'');return _0x3aac94(null);});}return _0x3aac94(null);});};exports[_0x2530('0x15')]=function(_0x23bcea){return new BPromise(function(_0x5243d2,_0x1c2c2c){if(_0x23bcea){return getUser({'interface':_0x23bcea})[_0x2530('0x8')](function(_0x4a1108){logger['info'](_0x2530('0x16'),_0x23bcea,_0x4a1108?_0x2530('0x12'):_0x2530('0x13'));return _0x5243d2(_0x4a1108);})[_0x2530('0xa')](function(_0x3dcf2c){logger['error'](_0x2530('0x17'),_0x3dcf2c?util[_0x2530('0x4')](_0x3dcf2c,{'showHidden':![],'depth':null}):'');return _0x5243d2(null);});}return _0x5243d2(null);});};exports[_0x2530('0x18')]=function(_0x313252){return new BPromise(function(_0x704ca5,_0x56381d){if(_0x313252){return getUser({'name':_0x313252})[_0x2530('0x8')](function(_0x520879){logger[_0x2530('0x3')](_0x2530('0x19'),_0x313252,_0x520879?_0x2530('0x12'):'notfound');return _0x704ca5(_0x520879);})[_0x2530('0xa')](function(_0x539de1){logger['error'](_0x2530('0x1a'),_0x539de1?util[_0x2530('0x4')](_0x539de1,{'showHidden':![],'depth':null}):'');return _0x704ca5(null);});}return _0x704ca5(null);});};exports[_0x2530('0x1b')]=function(_0x502052){return new BPromise(function(_0x27e7e2,_0x5b9bd2){if(_0x502052){return client['request'](_0x2530('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x2530('0x1d'),_0x2530('0x1e'),'acw','acwTimeout'],'where':{'name':_0x502052},'limit':0x1}})[_0x2530('0x8')](function(_0xe63792){logger[_0x2530('0x5')]('[utils][getVoiceQueueByName]\x20name:%s',_0x502052,_0xe63792?util['inspect'](_0xe63792,{'showHidden':![],'depth':null}):'');logger[_0x2530('0x3')](_0x2530('0x1f'),_0x502052,_0xe63792?_0x2530('0x12'):_0x2530('0x13'));return _0x27e7e2(_0xe63792['result'][_0x2530('0xf')]?_0xe63792['result'][0x0]:null);})[_0x2530('0xa')](function(_0x174ad9){logger[_0x2530('0x6')](_0x2530('0x20'),_0x174ad9?util[_0x2530('0x4')](_0x174ad9,{'showHidden':![],'depth':null}):'');return _0x27e7e2(null);});}return _0x27e7e2(null);});};exports[_0x2530('0x21')]=function(_0x13c43a,_0xf330c6){return moment(_0x13c43a)[_0x2530('0x22')](_0xf330c6,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x3db365,_0x4bb52a){return moment(_0x3db365)['subtract'](_0x4bb52a,_0x2530('0x23'))[_0x2530('0x24')](_0x2530('0x25'));};exports[_0x2530('0x26')]=function(_0x5313aa,_0x2219dd){return moment(_0x5313aa)[_0x2530('0x27')](moment(_0x2219dd),'seconds');};exports[_0x2530('0x28')]=function(_0x4ea40d,_0x6a3bad){return parseInt(_0x4ea40d,0xa)+parseInt(_0x6a3bad,0xa);};exports[_0x2530('0x29')]=function(){return moment()['format'](_0x2530('0x25'));};exports[_0x2530('0x2a')]=function(_0x160990,_0x452d8c){if(_0x452d8c){return moment(_0x160990)[_0x2530('0x2a')](_0x452d8c);}return!![];};exports['isBefore']=function(_0x4e2e51,_0x510e76){if(_0x510e76){return moment(_0x4e2e51)[_0x2530('0x2b')](_0x510e76);}else if(_0x4e2e51){return!![];}return![];}; \ No newline at end of file +var _0x3116=['diffTime','diff','seconds','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract'];(function(_0x3f28be,_0x53cd8f){var _0x1f890b=function(_0x2e3bd8){while(--_0x2e3bd8){_0x3f28be['push'](_0x3f28be['shift']());}};_0x1f890b(++_0x53cd8f);}(_0x3116,0x17e));var _0x6311=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3116[_0x4fc9e6];return _0x551d28;};'use strict';var BPromise=require(_0x6311('0x0'));var jayson=require(_0x6311('0x1'));var moment=require(_0x6311('0x2'));var util=require(_0x6311('0x3'));var client=jayson[_0x6311('0x4')][_0x6311('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0x6311('0x6'));exports[_0x6311('0x7')]=function(_0x343c28,_0x17ef65){logger['info'](_0x343c28,_0x17ef65?util[_0x6311('0x8')](_0x17ef65,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0x9')]=function(_0x68dd4,_0xb84543){logger[_0x6311('0x9')](_0x68dd4,_0xb84543?util[_0x6311('0x8')](_0xb84543,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0xa')]=function(_0x2c608a,_0x1bbb9a){logger[_0x6311('0xa')](_0x2c608a,_0x1bbb9a?util['inspect'](_0x1bbb9a,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0xb')]=function(_0x26b08f,_0x18567d){return client[_0x6311('0xb')](_0x26b08f,{'body':_0x18567d})['then'](function(_0x4ebbd4){logger[_0x6311('0x9')]('[utils][request]\x20name:%s',_0x26b08f,_0x4ebbd4?util[_0x6311('0x8')](_0x4ebbd4,{'showHidden':![],'depth':null}):'');})[_0x6311('0xc')](function(_0x17da35){logger[_0x6311('0xa')](_0x6311('0xd'),_0x26b08f,_0x17da35?util['inspect'](_0x17da35,{'showHidden':![],'depth':null}):'');});};function getUser(_0x18b67c){return client[_0x6311('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x6311('0xe'),'name',_0x6311('0xf')],'where':_0x18b67c,'limit':0x1}})[_0x6311('0x10')](function(_0xadfb75){logger['debug'](_0x6311('0x11'),JSON[_0x6311('0x12')](_0x18b67c),_0xadfb75?util[_0x6311('0x8')](_0xadfb75,{'showHidden':![],'depth':null}):'');return _0xadfb75[_0x6311('0x13')][_0x6311('0x14')]?_0xadfb75['result'][0x0]:null;});}exports[_0x6311('0x15')]=function(_0x12fd31){return new BPromise(function(_0x195800,_0x5288ac){if(_0x12fd31){return getUser({'internal':_0x12fd31})[_0x6311('0x10')](function(_0x4adf8f){logger['info'](_0x6311('0x16'),_0x12fd31,_0x4adf8f?_0x6311('0x17'):_0x6311('0x18'));return _0x195800(_0x4adf8f);})[_0x6311('0xc')](function(_0x2088a3){logger[_0x6311('0xa')](_0x6311('0x19'),_0x2088a3?util[_0x6311('0x8')](_0x2088a3,{'showHidden':![],'depth':null}):'');return _0x195800(null);});}return _0x195800(null);});};exports[_0x6311('0x1a')]=function(_0x4e085a){return new BPromise(function(_0x301c4a,_0x3c5e92){if(_0x4e085a){return getUser({'interface':_0x4e085a})[_0x6311('0x10')](function(_0x754561){logger[_0x6311('0x7')](_0x6311('0x1b'),_0x4e085a,_0x754561?_0x6311('0x17'):'notfound');return _0x301c4a(_0x754561);})[_0x6311('0xc')](function(_0x1f80f7){logger[_0x6311('0xa')]('[utils][getUserByInterface]',_0x1f80f7?util[_0x6311('0x8')](_0x1f80f7,{'showHidden':![],'depth':null}):'');return _0x301c4a(null);});}return _0x301c4a(null);});};exports[_0x6311('0x1c')]=function(_0xe9951){return new BPromise(function(_0x4c0a5d,_0x2015ee){if(_0xe9951){return getUser({'name':_0xe9951})[_0x6311('0x10')](function(_0x571991){logger[_0x6311('0x7')](_0x6311('0x1d'),_0xe9951,_0x571991?_0x6311('0x17'):_0x6311('0x18'));return _0x4c0a5d(_0x571991);})[_0x6311('0xc')](function(_0x42bc03){logger[_0x6311('0xa')]('[utils][getUserByName]',_0x42bc03?util[_0x6311('0x8')](_0x42bc03,{'showHidden':![],'depth':null}):'');return _0x4c0a5d(null);});}return _0x4c0a5d(null);});};exports[_0x6311('0x1e')]=function(_0x5da083){return new BPromise(function(_0x1fdf0a,_0x5b0dbe){if(_0x5da083){return client[_0x6311('0xb')](_0x6311('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x6311('0x20'),'type',_0x6311('0x21'),_0x6311('0x22')],'where':{'name':_0x5da083},'limit':0x1}})[_0x6311('0x10')](function(_0x17fdbf){logger[_0x6311('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5da083,_0x17fdbf?util[_0x6311('0x8')](_0x17fdbf,{'showHidden':![],'depth':null}):'');logger[_0x6311('0x7')](_0x6311('0x23'),_0x5da083,_0x17fdbf?_0x6311('0x17'):_0x6311('0x18'));return _0x1fdf0a(_0x17fdbf['result']['length']?_0x17fdbf[_0x6311('0x13')][0x0]:null);})['catch'](function(_0x49d3ba){logger[_0x6311('0xa')]('[utils][getVoiceQueueByName]',_0x49d3ba?util[_0x6311('0x8')](_0x49d3ba,{'showHidden':![],'depth':null}):'');return _0x1fdf0a(null);});}return _0x1fdf0a(null);});};exports['addTime']=function(_0x273938,_0x447291){return moment(_0x273938)[_0x6311('0x24')](_0x447291,'seconds')[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x27')]=function(_0x2049ea,_0x16fea8){return moment(_0x2049ea)[_0x6311('0x28')](_0x16fea8,'seconds')[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x29')]=function(_0x238d0d,_0x56b3dc){return moment(_0x238d0d)[_0x6311('0x2a')](moment(_0x56b3dc),_0x6311('0x2b'));};exports[_0x6311('0x2c')]=function(_0x29e08f,_0x193a10){return parseInt(_0x29e08f,0xa)+parseInt(_0x193a10,0xa);};exports['now']=function(){return moment()[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x2d')]=function(_0xb52e6d,_0xb92e9a){if(_0xb92e9a){return moment(_0xb52e6d)[_0x6311('0x2d')](_0xb92e9a);}return!![];};exports['isBefore']=function(_0x18ebee,_0x11a423){if(_0x11a423){return moment(_0x18ebee)[_0x6311('0x2e')](_0x11a423);}else if(_0x18ebee){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 9d5bb4f..7b6442b 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 _0xf411=['path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','ensureDir','then','catch','user','data','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','name','device','other','agent_name','test','setupLoggers','lodash'];(function(_0x23a0f1,_0x1020ad){var _0x1ea440=function(_0x6af7f6){while(--_0x6af7f6){_0x23a0f1['push'](_0x23a0f1['shift']());}};_0x1ea440(++_0x1020ad);}(_0xf411,0x182));var _0x1f41=function(_0x3c2527,_0x119897){_0x3c2527=_0x3c2527-0x0;var _0x52babb=_0xf411[_0x3c2527];return _0x52babb;};var fs=require('fs-extra');var _=require(_0x1f41('0x0'));var ewinston=require('express-winston');var path=require(_0x1f41('0x1'));var util=require(_0x1f41('0x2'));var fileLogger=require('./loggers')[_0x1f41('0x3')];var safeTemplate=require(_0x1f41('0x4'))[_0x1f41('0x5')];var maskSensitiveData=require(_0x1f41('0x6'))[_0x1f41('0x7')];function ClientSideLogger(){function _0x4223b1(_0x4dad9e){var _0x3ff23d=path[_0x1f41('0x8')](_0x1f41('0x9'),_0x1f41('0xa'),'xcally');var _0x12b43f=path['join'](_0x1f41('0xb'),_0x4dad9e[_0x1f41('0xc')]+'-'+_0x4dad9e['name']);return fs[_0x1f41('0xd')](path['join'](_0x3ff23d,_0x12b43f))[_0x1f41('0xe')](function(){var _0x4fce96=fileLogger(_0x1f41('0xb'),path[_0x1f41('0x8')](_0x3ff23d,_0x12b43f));return _0x4fce96;})[_0x1f41('0xf')](function(_0x3ec951){throw _0x3ec951;});}this[_0x1f41('0xa')]=function(_0x11c060,_0x14e122,_0x50118d,_0xa24776){return _0x4223b1(_0x11c060['user'])['then'](function(_0x368307){var _0x1906d4=_0x368307[_0x14e122];return _0x1906d4;})[_0x1f41('0xe')](function(_0x3054bc){var _0x199220=_0x11c060['user']?_0x11c060[_0x1f41('0x10')]['id']:'no-user';var _0x70fada=_0xa24776[_0x1f41('0x11')];var _0x461ba8=_0xa24776['timestamp'];var _0x231814=new Date(Number(_0x461ba8));return _0x3054bc(_0x199220,_0x231814,_0x50118d,_0x70fada);})['catch'](function(_0x14316b){fileLogger(_0x1f41('0xb'))['error'](_0x14316b);});};}function setupLoggers(_0x2cb5af){return new Promise(function(_0x28db73){var _0x286344=new ClientSideLogger();var _0x54d18c=fileLogger(_0x1f41('0x12'));var _0x2ea053=fileLogger(_0x1f41('0x13'));_0x2cb5af[_0x1f41('0x14')]('client-side-logger',_0x286344);_0x2cb5af[_0x1f41('0x15')](ewinston['logger']({'winstonInstance':_0x54d18c,'meta':![],'statusLevels':!![],'msg':function(_0x288470,_0x269196){var _0x1dc188=_0x1f41('0x16');if(!_[_0x1f41('0x17')](_0x288470[_0x1f41('0x18')])){_0x1dc188+=_0x1f41('0x19');var _0x269761=_0x288470[_0x1f41('0x18')];maskSensitiveData(_0x269761);}return safeTemplate(util[_0x1f41('0x1a')](_0x1dc188,_0x288470['method'],_0x288470[_0x1f41('0x1b')][_0x1f41('0x1c')]?_0x288470[_0x1f41('0x1b')][_0x1f41('0x1c')]:_0x288470[_0x1f41('0x1d')][_0x1f41('0x1e')]||_0x288470['ip'],_0x288470['url'],_0x269196[_0x1f41('0x1f')],_0x269196[_0x1f41('0x20')],_0x288470[_0x1f41('0x10')]?_0x288470[_0x1f41('0x10')]['id']:null,_0x288470[_0x1f41('0x10')]?_0x288470[_0x1f41('0x10')]['name']:null,_0x288470[_0x1f41('0x10')]?_0x288470[_0x1f41('0x10')][_0x1f41('0xc')]:null,_0x269761?util[_0x1f41('0x21')](_0x269761,![],null):''));}}));_0x2cb5af[_0x1f41('0x15')](ewinston['logger']({'winstonInstance':_0x2ea053,'meta':![],'statusLevels':!![],'msg':function(_0x145c3d,_0x374ada){var _0x39e3ee=_0x1f41('0x22');if(_0x145c3d[_0x1f41('0x18')]&&_0x145c3d[_0x1f41('0x18')]['device']&&_0x145c3d[_0x1f41('0x18')]['agent_id']){_0x39e3ee=_0x1f41('0x23');}return util[_0x1f41('0x1a')](_0x39e3ee,_0x145c3d['method'],_0x145c3d[_0x1f41('0x1b')][_0x1f41('0x1c')]?_0x145c3d[_0x1f41('0x1b')][_0x1f41('0x1c')]:_0x145c3d['connection'][_0x1f41('0x1e')]||_0x145c3d['ip'],_0x145c3d[_0x1f41('0x24')],_0x374ada[_0x1f41('0x1f')],_0x374ada[_0x1f41('0x20')],_0x145c3d[_0x1f41('0x10')]?_0x145c3d[_0x1f41('0x10')]['id']:null,_0x145c3d[_0x1f41('0x10')]?_0x145c3d[_0x1f41('0x10')][_0x1f41('0x25')]:null,_0x145c3d[_0x1f41('0x10')]?_0x145c3d[_0x1f41('0x10')]['role']:null,_0x145c3d[_0x1f41('0x18')]&&_0x145c3d[_0x1f41('0x18')][_0x1f41('0x26')]?_0x145c3d[_0x1f41('0x18')][_0x1f41('0x26')]:_0x1f41('0x27'),_0x145c3d[_0x1f41('0x18')]&&_0x145c3d['body']['agent_id']?_0x145c3d[_0x1f41('0x18')]['agent_id']:'',_0x145c3d[_0x1f41('0x18')]&&_0x145c3d[_0x1f41('0x18')][_0x1f41('0x28')]?_0x145c3d[_0x1f41('0x18')][_0x1f41('0x28')]:'');},'ignoreRoute':function(_0x5679a3){var _0x16f22a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x16f22a[_0x1f41('0x29')](_0x5679a3[_0x1f41('0x24')]);}}));return _0x28db73();});}exports[_0x1f41('0x2a')]=setupLoggers; \ No newline at end of file +var _0x1e60=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_name','test','fs-extra','lodash','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','xcally','client','role','name','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','device'];(function(_0x15f476,_0x399e5e){var _0x383f45=function(_0x9d06d8){while(--_0x9d06d8){_0x15f476['push'](_0x15f476['shift']());}};_0x383f45(++_0x399e5e);}(_0x1e60,0x1ea));var _0x01e6=function(_0x1980e7,_0x24ef67){_0x1980e7=_0x1980e7-0x0;var _0xb8b59a=_0x1e60[_0x1980e7];return _0xb8b59a;};var fs=require(_0x01e6('0x0'));var _=require(_0x01e6('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x01e6('0x2'));var fileLogger=require(_0x01e6('0x3'))[_0x01e6('0x4')];var safeTemplate=require(_0x01e6('0x5'))[_0x01e6('0x6')];var maskSensitiveData=require(_0x01e6('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x2a90b9(_0x57343b){var _0x4a1357=path[_0x01e6('0x8')]('/var','log',_0x01e6('0x9'));var _0x3b929a=path[_0x01e6('0x8')](_0x01e6('0xa'),_0x57343b[_0x01e6('0xb')]+'-'+_0x57343b[_0x01e6('0xc')]);return fs['ensureDir'](path['join'](_0x4a1357,_0x3b929a))[_0x01e6('0xd')](function(){var _0x212f80=fileLogger('client',path[_0x01e6('0x8')](_0x4a1357,_0x3b929a));return _0x212f80;})[_0x01e6('0xe')](function(_0x4bef75){throw _0x4bef75;});}this['log']=function(_0x497077,_0x375ef9,_0x6bc0c7,_0x44969a){return _0x2a90b9(_0x497077['user'])[_0x01e6('0xd')](function(_0x26f4cf){var _0x14d9b3=_0x26f4cf[_0x375ef9];return _0x14d9b3;})['then'](function(_0x501998){var _0x3729d6=_0x497077[_0x01e6('0xf')]?_0x497077[_0x01e6('0xf')]['id']:'no-user';var _0x162d8a=_0x44969a[_0x01e6('0x10')];var _0x1177da=_0x44969a[_0x01e6('0x11')];var _0x20d5bc=new Date(Number(_0x1177da));return _0x501998(_0x3729d6,_0x20d5bc,_0x6bc0c7,_0x162d8a);})['catch'](function(_0x1aecbf){fileLogger(_0x01e6('0xa'))[_0x01e6('0x12')](_0x1aecbf);});};}function setupLoggers(_0x167e25){return new Promise(function(_0xb5fca){var _0x273f33=new ClientSideLogger();var _0x536a93=fileLogger(_0x01e6('0x13'));var _0x3a9ea7=fileLogger(_0x01e6('0x14'));_0x167e25[_0x01e6('0x15')](_0x01e6('0x16'),_0x273f33);_0x167e25[_0x01e6('0x17')](ewinston['logger']({'winstonInstance':_0x536a93,'meta':![],'statusLevels':!![],'msg':function(_0x234267,_0xd23d4e){var _0x5e819c=_0x01e6('0x18');if(!_[_0x01e6('0x19')](_0x234267[_0x01e6('0x1a')])){_0x5e819c+=_0x01e6('0x1b');var _0x275637=_0x234267[_0x01e6('0x1a')];maskSensitiveData(_0x275637);}return safeTemplate(util[_0x01e6('0x1c')](_0x5e819c,_0x234267[_0x01e6('0x1d')],_0x234267[_0x01e6('0x1e')][_0x01e6('0x1f')]?_0x234267[_0x01e6('0x1e')]['x-forwarded-for']:_0x234267[_0x01e6('0x20')][_0x01e6('0x21')]||_0x234267['ip'],_0x234267[_0x01e6('0x22')],_0xd23d4e['statusCode'],_0xd23d4e[_0x01e6('0x23')],_0x234267[_0x01e6('0xf')]?_0x234267['user']['id']:null,_0x234267[_0x01e6('0xf')]?_0x234267['user'][_0x01e6('0xc')]:null,_0x234267[_0x01e6('0xf')]?_0x234267[_0x01e6('0xf')][_0x01e6('0xb')]:null,_0x275637?util[_0x01e6('0x24')](_0x275637,![],null):''));}}));_0x167e25[_0x01e6('0x17')](ewinston['logger']({'winstonInstance':_0x3a9ea7,'meta':![],'statusLevels':!![],'msg':function(_0x2d0042,_0x5ec9fa){var _0x1e1b43='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x25')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x26')]){_0x1e1b43=_0x01e6('0x27');}return util[_0x01e6('0x1c')](_0x1e1b43,_0x2d0042['method'],_0x2d0042[_0x01e6('0x1e')]['x-forwarded-for']?_0x2d0042['headers'][_0x01e6('0x1f')]:_0x2d0042[_0x01e6('0x20')]['remoteAddress']||_0x2d0042['ip'],_0x2d0042['url'],_0x5ec9fa[_0x01e6('0x28')],_0x5ec9fa[_0x01e6('0x23')],_0x2d0042[_0x01e6('0xf')]?_0x2d0042[_0x01e6('0xf')]['id']:null,_0x2d0042[_0x01e6('0xf')]?_0x2d0042[_0x01e6('0xf')][_0x01e6('0xc')]:null,_0x2d0042[_0x01e6('0xf')]?_0x2d0042['user']['role']:null,_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042['body'][_0x01e6('0x25')]?_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x25')]:_0x01e6('0x29'),_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042['body'][_0x01e6('0x26')]?_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x26')]:'',_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x2a')]?_0x2d0042[_0x01e6('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x36e600){var _0x17e1fa=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17e1fa[_0x01e6('0x2b')](_0x36e600[_0x01e6('0x22')]);}}));return _0xb5fca();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1d61bd7..99d8078 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aff=['join','format','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','message','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','transports','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','moment','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','/var/log/xcally'];(function(_0x30977b,_0x22be64){var _0x339a92=function(_0x2d7a68){while(--_0x2d7a68){_0x30977b['push'](_0x30977b['shift']());}};_0x339a92(++_0x22be64);}(_0x2aff,0xa6));var _0xf2af=function(_0x484982,_0x3f92e3){_0x484982=_0x484982-0x0;var _0xbc13a5=_0x2aff[_0x484982];return _0xbc13a5;};'use strict';var path=require(_0xf2af('0x0'));var util=require('util');var moment=require(_0xf2af('0x1'));var winston=require(_0xf2af('0x2'));var config=require('../config/environment');var debugLevel=config[_0xf2af('0x3')]?config[_0xf2af('0x3')][_0xf2af('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xf2af('0x5'),'error':_0xf2af('0x6'),'warn':_0xf2af('0x7'),'info':_0xf2af('0x8'),'print':_0xf2af('0x9'),'success':'bold\x20green','http':_0xf2af('0xa'),'verbose':_0xf2af('0xb'),'debug':_0xf2af('0xc'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x58a668,_0x12247c,_0x25ca3a){var _0x77e740=_0x58a668||_0xf2af('0xd');return path[_0xf2af('0xe')](_0x77e740,util[_0xf2af('0xf')]('%s-%s.log',_0x12247c,_0x25ca3a));}function formatter(_0x4f5230,_0x4b12c3){_0x4b12c3['message']=_0x4b12c3['message'][_0xf2af('0x10')](/@@{/g,_0xf2af('0x11'))[_0xf2af('0x10')](/}@@/g,_0xf2af('0x12'))[_0xf2af('0x10')](/@{/g,'{{')[_0xf2af('0x10')](/}@/g,'}}');return util[_0xf2af('0xf')](_0xf2af('0x13'),moment()[_0xf2af('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4b12c3['level']['toUpperCase'](),_0x4f5230,_0x4b12c3[_0xf2af('0x14')]);}function fileFormat(_0x14893b,_0x38b251){_0x38b251['message']=_0x38b251[_0xf2af('0x14')][_0xf2af('0x10')](/@@{/g,_0xf2af('0x11'))[_0xf2af('0x10')](/}@@/g,_0xf2af('0x12'))[_0xf2af('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x21d669=_0x38b251[_0xf2af('0x15')]&&Object[_0xf2af('0x16')](_0x38b251[_0xf2af('0x15')])[_0xf2af('0x17')]?'\x0a\x09'+JSON['stringify'](_0x38b251[_0xf2af('0x15')]):'';return util[_0xf2af('0xf')](_0xf2af('0x18'),moment()[_0xf2af('0xf')](_0xf2af('0x19')),_0x38b251[_0xf2af('0x1a')][_0xf2af('0x1b')](),_0x14893b,_0x38b251['message'],_0x21d669);}function consoleLogger(){var _0x27037a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf2af('0x1c'))]['Console']({'level':_0xf2af('0x1d'),'json':![],'formatter':function(_0x5bdded){return formatter('',_0x5bdded);}})]});return _0x27037a;}function fileLogger(_0x300e1c,_0x3ebb41){var _0x285e79=new winston[(_0xf2af('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf2af('0x1f'))]({'name':util[_0xf2af('0xf')](_0xf2af('0x20'),_0x300e1c,_0xf2af('0x21')),'filename':getLogFileName(_0x3ebb41,_0x300e1c,_0xf2af('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf8877f){return fileFormat(_0x300e1c,_0xf8877f);}}),new winston['transports'][(_0xf2af('0x1f'))]({'name':util['format'](_0xf2af('0x20'),_0x300e1c,debugLevel),'filename':getLogFileName(_0x3ebb41,_0x300e1c,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18ffbe){return fileFormat(_0x300e1c,_0x18ffbe);}}),new winston[(_0xf2af('0x1c'))]['Console']({'level':_0xf2af('0x1d'),'json':![],'formatter':function(_0x13ad3a){return fileFormat(_0x300e1c,_0x13ad3a);}})]});return _0x285e79;}exports[_0xf2af('0x22')]=consoleLogger;exports[_0xf2af('0x23')]=fileLogger; \ No newline at end of file +var _0xe098=['[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','message','{{{','replace','}}}'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xe098,0x9f));var _0x8e09=function(_0x19130c,_0x59628d){_0x19130c=_0x19130c-0x0;var _0x48710f=_0xe098[_0x19130c];return _0x48710f;};'use strict';var path=require(_0x8e09('0x0'));var util=require(_0x8e09('0x1'));var moment=require(_0x8e09('0x2'));var winston=require(_0x8e09('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x8e09('0x4')][_0x8e09('0x5')]():_0x8e09('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x8e09('0x7'),'error':_0x8e09('0x8'),'warn':_0x8e09('0x9'),'info':_0x8e09('0xa'),'print':_0x8e09('0xb'),'success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0x8e09('0xc'),'silly':_0x8e09('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1d4615,_0x577cb5,_0x26998c){var _0x2f269a=_0x1d4615||_0x8e09('0xe');return path[_0x8e09('0xf')](_0x2f269a,util[_0x8e09('0x10')]('%s-%s.log',_0x577cb5,_0x26998c));}function formatter(_0x5e0d50,_0x19042d){_0x19042d[_0x8e09('0x11')]=_0x19042d[_0x8e09('0x11')]['replace'](/@@{/g,_0x8e09('0x12'))[_0x8e09('0x13')](/}@@/g,_0x8e09('0x14'))[_0x8e09('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x8e09('0x15'),moment()[_0x8e09('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x19042d[_0x8e09('0x16')][_0x8e09('0x17')](),_0x5e0d50,_0x19042d[_0x8e09('0x11')]);}function fileFormat(_0x1ea73c,_0x3cdf6e){_0x3cdf6e[_0x8e09('0x11')]=_0x3cdf6e[_0x8e09('0x11')][_0x8e09('0x13')](/@@{/g,_0x8e09('0x12'))[_0x8e09('0x13')](/}@@/g,_0x8e09('0x14'))[_0x8e09('0x13')](/@{/g,'{{')[_0x8e09('0x13')](/}@/g,'}}');var _0x3ee53c=_0x3cdf6e[_0x8e09('0x18')]&&Object[_0x8e09('0x19')](_0x3cdf6e[_0x8e09('0x18')])['length']?'\x0a\x09'+JSON[_0x8e09('0x1a')](_0x3cdf6e[_0x8e09('0x18')]):'';return util[_0x8e09('0x10')](_0x8e09('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x3cdf6e[_0x8e09('0x16')][_0x8e09('0x17')](),_0x1ea73c,_0x3cdf6e[_0x8e09('0x11')],_0x3ee53c);}function consoleLogger(){var _0x2bf63c=new winston[(_0x8e09('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8e09('0x1d'))][(_0x8e09('0x1e'))]({'level':_0x8e09('0x1f'),'json':![],'formatter':function(_0x378489){return formatter('',_0x378489);}})]});return _0x2bf63c;}function fileLogger(_0x5d2468,_0x101b6b){var _0x18a102=new winston[(_0x8e09('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8e09('0x1d'))][(_0x8e09('0x20'))]({'name':util[_0x8e09('0x10')]('%s-%s',_0x5d2468,_0x8e09('0x21')),'filename':getLogFileName(_0x101b6b,_0x5d2468,'error'),'level':_0x8e09('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c73ff){return fileFormat(_0x5d2468,_0x2c73ff);}}),new winston[(_0x8e09('0x1d'))]['File']({'name':util[_0x8e09('0x10')]('%s-%s',_0x5d2468,debugLevel),'filename':getLogFileName(_0x101b6b,_0x5d2468,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc6daff){return fileFormat(_0x5d2468,_0xc6daff);}}),new winston['transports']['Console']({'level':_0x8e09('0x1f'),'json':![],'formatter':function(_0x1e403f){return fileFormat(_0x5d2468,_0x1e403f);}})]});return _0x18a102;}exports[_0x8e09('0x22')]=consoleLogger;exports[_0x8e09('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index cf48b8e..f7134ac 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 _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x4975,0x86));var _0x5497=function(_0x218fdc,_0x15844a){_0x218fdc=_0x218fdc-0x0;var _0x1b4c29=_0x4975[_0x218fdc];return _0x1b4c29;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4975,0x86));var _0x5497=function(_0x160f09,_0x3d4b43){_0x160f09=_0x160f09-0x0;var _0x1f6e25=_0x4975[_0x160f09];return _0x1f6e25;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a161bf1..c04d91c 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 _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x3e602b,_0x8b4c76){var _0x2647e3=function(_0x741538){while(--_0x741538){_0x3e602b['push'](_0x3e602b['shift']());}};_0x2647e3(++_0x8b4c76);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x0b0e[_0x2ae8ce];return _0x4bf686;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate; \ No newline at end of file +var _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x5a430d,_0x1a9bd3){var _0x3bb9d6=function(_0x49a9f8){while(--_0x49a9f8){_0x5a430d['push'](_0x5a430d['shift']());}};_0x3bb9d6(++_0x1a9bd3);}(_0xea28,0x13a));var _0x8ea2=function(_0x4b6404,_0x3ef4b0){_0x4b6404=_0x4b6404-0x0;var _0xaa6704=_0xea28[_0x4b6404];return _0xaa6704;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file